This is python.info, produced by makeinfo version 7.1 from python.texi.

     Python 3.14.3, 2月 19, 2026

     Author name not set

     Copyright © 2001 Python Software Foundation

INFO-DIR-SECTION Miscellaneous
START-INFO-DIR-ENTRY
* python: (python.info). One line description of project
END-INFO-DIR-ENTRY


   Generated by Sphinx 8.2.3.


File: python.info,  Node: Top,  Next: What's New in Python,  Up: (dir)

Python
******

     Python 3.14.3, 2月 19, 2026

     Author name not set

     Copyright © 2001 Python Software Foundation

* Menu:

* What's New in Python::
* Python チュートリアル::
* Python のセットアップと利用::
* Python 言語リファレンス::
* Python 標準ライブラリ::
* Python インタプリタの拡張と埋め込み::
* Python/C API リファレンスマニュアル::
* Python モジュールのインストール::
* Python HOWTO::
* Python よくある質問::
* 非推奨: 非推奨<14>.
* 用語集: 用語集<2>.
* このドキュメントについて::
* バグへの対処::
* Copyright::
* 歴史とライセンス::
* Pythonモジュール索引::
* 索引::

 -- The Detailed Node Listing --

What's New in Python

* What's new in Python 3.14: What's new in Python 3 14.
* What's New In Python 3.13: What's New In Python 3 13.
* What's New In Python 3.12: What's New In Python 3 12.
* What's New In Python 3.11: What's New In Python 3 11.
* What's New In Python 3.10: What's New In Python 3 10.
* What's New In Python 3.9: What's New In Python 3 9.
* What's New In Python 3.8: What's New In Python 3 8.
* What's New In Python 3.7: What's New In Python 3 7.
* What's New In Python 3.6: What's New In Python 3 6.
* What's New In Python 3.5: What's New In Python 3 5.
* What's New In Python 3.4: What's New In Python 3 4.
* What's New In Python 3.3: What's New In Python 3 3.
* What's New In Python 3.2: What's New In Python 3 2.
* What's New In Python 3.1: What's New In Python 3 1.
* What's New In Python 3.0: What's New In Python 3 0.
* What's New in Python 2.7: What's New in Python 2 7.
* What's New in Python 2.6: What's New in Python 2 6.
* What's New in Python 2.5: What's New in Python 2 5.
* What's New in Python 2.4: What's New in Python 2 4.
* What's New in Python 2.3: What's New in Python 2 3.
* What's New in Python 2.2: What's New in Python 2 2.
* What's New in Python 2.1: What's New in Python 2 1.
* What's New in Python 2.0: What's New in Python 2 0.
* 変更履歴::

What's new in Python 3.14

* 概要: 概要 -- リリースハイライト. リリースハイライト
* 新しい機能::
* Other language changes::
* 新しいモジュール::
* Improved modules::
* 最適化::
* 削除::
* 非推奨::
* CPython バイトコードの変更::
* C API changes::
* Build changes::
* Porting to Python 3.14: Porting to Python 3 14.
* Notable changes in 3.14.1: Notable changes in 3 14 1.

新しい機能

* PEP 649 と PEP 749; アノテーションの遅延評価: PEP 649 と PEP 749 アノテーションの遅延評価.
* PEP 734; Multiple interpreters in the standard library: PEP 734 Multiple interpreters in the standard library.
* PEP 750; テンプレート文字列リテラル: PEP 750 テンプレート文字列リテラル.
* PEP 768; Safe external debugger interface: PEP 768 Safe external debugger interface.
* A new type of interpreter::
* Free-threaded mode improvements::
* エラーメッセージの改善::
* PEP 784; Zstandard support in the standard library: PEP 784 Zstandard support in the standard library.
* Asyncio introspection capabilities::
* Concurrent safe warnings control::

Other language changes

* Built-ins::
* コマンドラインと環境::
* PEP 758; Allow except and except* expressions without brackets: PEP 758 Allow except and except* expressions without brackets.
* PEP 765; Control flow in finally blocks: PEP 765 Control flow in finally blocks.
* Incremental garbage collection::
* Default interactive shell::

Improved modules

* argparse::
* ast::
* asyncio::
* calendar::
* concurrent.futures: concurrent futures.
* configparser::
* contextvars::
* ctypes::
* curses::
* datetime::
* decimal::
* difflib::
* dis::
* errno::
* faulthandler::
* fnmatch::
* fractions::
* functools::
* getopt::
* getpass::
* graphlib::
* heapq::
* hmac::
* http::
* imaplib::
* inspect::
* io::
* json::
* linecache::
* logging.handlers: logging handlers.
* math::
* mimetypes::
* multiprocessing::
* operator::
* os::
* os.path: os path.
* pathlib::
* pdb::
* pickle::
* プラットフォーム::
* pydoc::
* re::
* socket::
* ssl::
* struct::
* symtable::
* sys::
* sys.monitoring: sys monitoring.
* sysconfig::
* tarfile::
* threading::
* tkinter::
* turtle::
* types::
* typing::
* unicodedata::
* unittest::
* urllib::
* uuid::
* webbrowser::
* zipfile::

最適化

* asyncio: asyncio<2>.
* base64::
* bdb::
* difflib: difflib<2>.
* gc::
* io: io<2>.
* pathlib: pathlib<2>.
* pdb: pdb<2>.
* textwrap::
* uuid: uuid<2>.
* zlib::

削除

* argparse: argparse<2>.
* ast: ast<2>.
* asyncio: asyncio<3>.
* email::
* importlib.abc: importlib abc.
* itertools::
* pathlib: pathlib<3>.
* pkgutil::
* pty::
* sqlite3::
* urllib: urllib<2>.

非推奨

* New deprecations::
* Pending removal in Python 3.15: Pending removal in Python 3 15.
* Pending removal in Python 3.16: Pending removal in Python 3 16.
* Pending removal in Python 3.17: Pending removal in Python 3 17.
* Pending removal in Python 3.18: Pending removal in Python 3 18.
* Pending removal in Python 3.19: Pending removal in Python 3 19.
* Pending removal in future versions::

CPython バイトコードの変更

* Pseudo-instructions::

C API changes

* Python configuration C API::
* New features in the C API::
* Limited C API changes::
* Removed C APIs::
* Deprecated C APIs::

Deprecated C APIs

* Pending removal in Python 3.15: Pending removal in Python 3 15<2>.
* Pending removal in Python 3.16: Pending removal in Python 3 16<2>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<2>.
* Pending removal in future versions: Pending removal in future versions<2>.

Build changes

* build-details.json: build-details json.
* Discontinuation of PGP signatures::
* Free-threaded Python is officially supported::
* Binary releases for the experimental just-in-time compiler::

Porting to Python 3.14

* Python API の変更::
* Changes in annotations (PEP 649 and PEP 749): Changes in annotations PEP 649 and PEP 749.
* C API の変更::

Changes in annotations (PEP 649 and PEP 749)

* Implications for annotated code::
* Implications for readers of __annotations__::
* Related changes::
* from __future__ import annotations::

What's New In Python 3.13

* 概要: 概要 -- リリースハイライト<2>. リリースハイライト
* 新しい機能: 新しい機能<2>.
* その他の言語変更::
* 新たなモジュール::
* 改良されたモジュール::
* 最適化: 最適化<2>.
* Removed Modules And APIs::
* New Deprecations::
* CPython Bytecode Changes::
* C API の変更: C API の変更<2>.
* Build Changes::
* Porting to Python 3.13: Porting to Python 3 13.
* Regression Test Changes::

新しい機能

* 改善された対話的インタープリタ::
* エラーメッセージの改善: エラーメッセージの改善<2>.
* フリースレッドの CPython::
* 実験的な Just-in-time (JIT) コンパイラ;: 実験的な Just-in-time JIT コンパイラ.
* Defined mutation semantics for locals(): Defined mutation semantics for locals.
* Support for mobile platforms::

改良されたモジュール

* argparse: argparse<3>.
* 配列::
* ast: ast<3>.
* asyncio: asyncio<4>.
* base64: base64<2>.
* compileall::
* concurrent.futures: concurrent futures<2>.
* configparser: configparser<2>.
* copy::
* ctypes: ctypes<2>.
* dbm::
* dis: dis<2>.
* doctest::
* email: email<2>.
* enum::
* fractions: fractions<2>.
* glob::
* importlib::
* io: io<3>.
* ipaddress::
* itertools: itertools<2>.
* marshal::
* math: math<2>.
* mimetypes: mimetypes<2>.
* mmap::
* multiprocessing: multiprocessing<2>.
* os: os<2>.
* os.path: os path<2>.
* pathlib: pathlib<4>.
* pdb: pdb<3>.
* queue::
* random::
* re: re<2>.
* shutil::
* site::
* sqlite3: sqlite3<2>.
* ssl: ssl<2>.
* statistics::
* subprocess::
* sys: sys<2>.
* tempfile::
* time::
* tkinter: tkinter<2>.
* traceback::
* types: types<2>.
* typing: typing<2>.
* unicodedata: unicodedata<2>.
* venv::
* warnings::
* xml::
* zipimport::

Removed Modules And APIs

* PEP 594; Remove "dead batteries" from the standard library: PEP 594 Remove "dead batteries" from the standard library.
* 2to3::
* builtins::
* configparser: configparser<3>.
* importlib.metadata: importlib metadata.
* locale::
* opcode::
* optparse::
* pathlib: pathlib<5>.
* re: re<3>.
* tkinter.tix: tkinter tix.
* turtle: turtle<2>.
* typing: typing<3>.
* unittest: unittest<2>.
* urllib: urllib<3>.
* webbrowser: webbrowser<2>.

New Deprecations

* Pending removal in Python 3.14: Pending removal in Python 3 14.
* Pending removal in Python 3.15: Pending removal in Python 3 15<3>.
* Pending removal in Python 3.16: Pending removal in Python 3 16<3>.
* Pending removal in Python 3.17: Pending removal in Python 3 17<2>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<3>.
* Pending removal in Python 3.19: Pending removal in Python 3 19<2>.
* Pending removal in future versions: Pending removal in future versions<3>.

C API の変更

* 新しい機能: 新しい機能<3>.
* Changed C APIs::
* Limited C API Changes::
* Removed C APIs: Removed C APIs<2>.
* Deprecated C APIs: Deprecated C APIs<2>.

Deprecated C APIs

* Pending removal in Python 3.14: Pending removal in Python 3 14<2>.
* Pending removal in Python 3.15: Pending removal in Python 3 15<4>.
* Pending removal in Python 3.16: Pending removal in Python 3 16<4>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<4>.
* Pending removal in future versions: Pending removal in future versions<4>.

Porting to Python 3.13

* Python API の変更: Python API の変更<2>.
* C API の変更: C API の変更<3>.

What's New In Python 3.12

* 概要: 概要 -- リリースハイライト<3>. リリースハイライト
* 新しい機能: 新しい機能<4>.
* 型ヒントに関連する新しい機能::
* その他の言語変更: その他の言語変更<2>.
* 新たなモジュール: 新たなモジュール<2>.
* 改良されたモジュール: 改良されたモジュール<2>.
* 最適化: 最適化<3>.
* CPython バイトコードの変更: CPython バイトコードの変更<2>.
* Demos and Tools::
* 非推奨: 非推奨<2>.
* 削除: 削除<2>.
* Python 3.12 への移植: Python 3 12 への移植.
* Build Changes: Build Changes<2>.
* C API の変更: C API の変更<4>.

新しい機能

* PEP 695; 型パラメータの構文: PEP 695 型パラメータの構文.
* PEP 701; f-strings の構文的な形式化: PEP 701 f-strings の構文的な形式化.
* PEP 684; インタープリタごとの GIL: PEP 684 インタープリタごとの GIL.
* PEP 669; CPython の低影響モニタリング: PEP 669 CPython の低影響モニタリング.
* PEP 688; バッファプロトコルを Python で利用可能にする: PEP 688 バッファプロトコルを Python で利用可能にする.
* PEP 709; 内包表記のインライン化: PEP 709 内包表記のインライン化.
* エラーメッセージの改善: エラーメッセージの改善<3>.

型ヒントに関連する新しい機能

* PEP 692; Using TypedDict for more precise **kwargs typing: PEP 692 Using TypedDict for more precise **kwargs typing.
* PEP 698; Override Decorator for Static Typing: PEP 698 Override Decorator for Static Typing.

改良されたモジュール

* array::
* asyncio: asyncio<5>.
* calendar: calendar<2>.
* csv::
* dis: dis<3>.
* fractions: fractions<3>.
* importlib.resources: importlib resources.
* inspect: inspect<2>.
* itertools: itertools<3>.
* math: math<3>.
* os: os<3>.
* os.path: os path<3>.
* pathlib: pathlib<6>.
* プラットフォーム: プラットフォーム<2>.
* pdb: pdb<4>.
* random: random<2>.
* shutil: shutil<2>.
* sqlite3: sqlite3<3>.
* statistics: statistics<2>.
* sys: sys<3>.
* tempfile: tempfile<2>.
* threading: threading<2>.
* tkinter: tkinter<3>.
* tokenize::
* types: types<3>.
* typing: typing<4>.
* unicodedata: unicodedata<3>.
* unittest: unittest<3>.
* uuid: uuid<3>.

非推奨

* Pending removal in Python 3.13: Pending removal in Python 3 13.
* Pending removal in Python 3.14: Pending removal in Python 3 14<3>.
* Pending removal in Python 3.15: Pending removal in Python 3 15<5>.
* Pending removal in Python 3.16: Pending removal in Python 3 16<5>.
* Pending removal in Python 3.17: Pending removal in Python 3 17<3>.
* Pending removal in future versions: Pending removal in future versions<5>.

削除

* asynchat and asyncore::
* configparser: configparser<4>.
* distutils::
* ensurepip::
* enum: enum<2>.
* ftplib::
* gzip::
* hashlib::
* importlib: importlib<2>.
* imp::
* io: io<4>.
* locale: locale<2>.
* smtpd::
* sqlite3: sqlite3<4>.
* ssl: ssl<3>.
* unittest: unittest<4>.
* webbrowser: webbrowser<3>.
* xml.etree.ElementTree: xml etree ElementTree.
* zipimport: zipimport<2>.
* その他::

Python 3.12 への移植

* Python API の変更: Python API の変更<3>.

C API の変更

* 新しい機能: 新しい機能<5>.
* Python 3.12 への移植: Python 3 12 への移植<2>.
* 非推奨: 非推奨<3>.
* 削除: 削除<3>.

非推奨

* Pending removal in Python 3.14: Pending removal in Python 3 14<4>.
* Pending removal in Python 3.15: Pending removal in Python 3 15<6>.
* Pending removal in Python 3.16: Pending removal in Python 3 16<6>.
* Pending removal in future versions: Pending removal in future versions<6>.

What's New In Python 3.11

* 概要: 概要 -- リリースハイライト<4>. リリースハイライト
* 新しい機能: 新しい機能<6>.
* 型ヒントに関連する新しい機能: 型ヒントに関連する新しい機能<2>.
* その他の言語変更: その他の言語変更<3>.
* その他の CPython の実装の変更::
* 新たなモジュール: 新たなモジュール<3>.
* 改良されたモジュール: 改良されたモジュール<3>.
* 最適化: 最適化<4>.
* Faster CPython::
* CPython バイトコードの変更: CPython バイトコードの変更<3>.
* 非推奨: 非推奨<4>.
* Pending Removal in Python 3.12: Pending Removal in Python 3 12.
* 削除: 削除<4>.
* Porting to Python 3.11: Porting to Python 3 11.
* Build Changes: Build Changes<3>.
* C API の変更: C API の変更<5>.
* Python 3.11.4での重要な変更点: Python 3 11 4での重要な変更点.
* Python 3.11.5での重要な変更点: Python 3 11 5での重要な変更点.

新しい機能

* PEP 657; トレースバックのエラー位置の詳細化: PEP 657 トレースバックのエラー位置の詳細化.
* PEP 654; 例外グループと except*: PEP 654 例外グループと except*.
* PEP 678; ノートによって例外を充実させる: PEP 678 ノートによって例外を充実させる.
* Windows py.exe ランチャーの改善: Windows py exe ランチャーの改善.

型ヒントに関連する新しい機能

* PEP 646; Variadic generics: PEP 646 Variadic generics.
* PEP 655; Marking individual TypedDict items as required or not-required: PEP 655 Marking individual TypedDict items as required or not-required.
* PEP 673; Self 型: PEP 673 Self 型.
* PEP 675; Arbitrary literal string type: PEP 675 Arbitrary literal string type.
* PEP 681; Data class transforms: PEP 681 Data class transforms.
* PEP 563 may not be the future::

改良されたモジュール

* asyncio: asyncio<6>.
* contextlib::
* データクラス::
* datetime: datetime<2>.
* enum: enum<3>.
* fcntl::
* fractions: fractions<4>.
* functools: functools<2>.
* gzip: gzip<2>.
* hashlib: hashlib<2>.
* IDLE と idelelib::
* inspect: inspect<3>.
* locale: locale<3>.
* logging::
* math: math<4>.
* operator: operator<2>.
* os: os<4>.
* pathlib: pathlib<7>.
* re: re<4>.
* shutil: shutil<3>.
* socket: socket<2>.
* sqlite3: sqlite3<5>.
* string::
* sys: sys<4>.
* sysconfig: sysconfig<2>.
* tempfile: tempfile<3>.
* threading: threading<3>.
* time: time<2>.
* tkinter: tkinter<4>.
* traceback: traceback<2>.
* typing: typing<5>.
* unicodedata: unicodedata<4>.
* unittest: unittest<5>.
* venv: venv<2>.
* warnings: warnings<2>.
* zipfile: zipfile<2>.

Faster CPython

* Faster Startup::
* Faster Runtime::
* Misc::
* FAQ::
* About::

Faster Startup

* Frozen imports / Static code objects::

Faster Runtime

* Cheaper, lazy Python frames: Cheaper lazy Python frames.
* Inlined Python function calls::
* PEP 659; Specializing Adaptive Interpreter: PEP 659 Specializing Adaptive Interpreter.

FAQ

* How should I write my code to utilize these speedups?::
* Will CPython 3.11 use more memory?: Will CPython 3 11 use more memory?.
* I don't see any speedups in my workload. Why?: I don't see any speedups in my workload Why?.
* Is there a JIT compiler?::

CPython バイトコードの変更

* New opcodes::
* Replaced opcodes::
* Changed/removed opcodes::

非推奨

* Language/Builtins::
* モジュール::
* Standard Library::

C API の変更

* 新しい機能: 新しい機能<7>.
* Porting to Python 3.11: Porting to Python 3 11<2>.
* 非推奨: 非推奨<5>.
* Pending Removal in Python 3.12: Pending Removal in Python 3 12<2>.
* 削除: 削除<5>.

Python 3.11.4での重要な変更点

* tarfile: tarfile<2>.

Python 3.11.5での重要な変更点

* OpenSSL::

What's New In Python 3.10

* 概要: 概要 -- リリースハイライト<5>. リリースハイライト
* 新しい機能: 新しい機能<8>.
* 型ヒントに関連する新しい機能: 型ヒントに関連する新しい機能<3>.
* その他の言語変更: その他の言語変更<4>.
* 新たなモジュール: 新たなモジュール<4>.
* 改良されたモジュール: 改良されたモジュール<4>.
* 最適化: 最適化<5>.
* 非推奨: 非推奨<6>.
* 削除: 削除<6>.
* Porting to Python 3.10: Porting to Python 3 10.
* CPython バイトコードの変更: CPython バイトコードの変更<4>.
* Build Changes: Build Changes<4>.
* C API の変更: C API の変更<7>.
* Notable security feature in 3.10.7: Notable security feature in 3 10 7.
* Notable security feature in 3.10.8: Notable security feature in 3 10 8.
* Notable changes in 3.10.12: Notable changes in 3 10 12.

新しい機能

* カッコ内のコンテキストマネージャー::
* エラーメッセージの改善: エラーメッセージの改善<4>.
* PEP 626; デバッグおよびその他のツール用の正確な行番号。: PEP 626 デバッグおよびその他のツール用の正確な行番号。.
* PEP 634; 構造的パターンマッチ: PEP 634 構造的パターンマッチ.
* Optional EncodingWarning and encoding="locale" option::

エラーメッセージの改善

* SyntaxErrors::
* IndentationErrors::
* AttributeErrors::
* NameErrors::

PEP 634: 構造的パターンマッチ

* 構文と演算::
* 宣言的なアプローチ::
* 単純パターン; リテラルとのマッチ: 単純パターン リテラルとのマッチ.
* リテラルと変数を組み合わせたパターン::
* パターンとクラス::
* ネストしたパターン::
* 複雑なパターンとワイルドカード::
* ガード::
* その他の主要な機能::

単純パターン: リテラルとのマッチ

* ワイルドカードがないときの振る舞い::

パターンとクラス

* 位置パラメータを用いたパターン::

型ヒントに関連する新しい機能

* PEP 604; New Type Union Operator: PEP 604 New Type Union Operator.
* PEP 612; Parameter Specification Variables: PEP 612 Parameter Specification Variables.
* PEP 613; TypeAlias: PEP 613 TypeAlias.
* PEP 647; User-Defined Type Guards: PEP 647 User-Defined Type Guards.

改良されたモジュール

* asyncio: asyncio<7>.
* argparse: argparse<4>.
* array: array<2>.
* asynchat, asyncore, smtpd: asynchat asyncore smtpd.
* base64: base64<3>.
* bdb: bdb<2>.
* bisect::
* codecs::
* collections.abc: collections abc.
* contextlib: contextlib<2>.
* curses: curses<2>.
* データクラス: データクラス<2>.
* distutils: distutils<2>.
* doctest: doctest<2>.
* エンコーディング::
* enum: enum<4>.
* fileinput::
* faulthandler: faulthandler<2>.
* gc: gc<2>.
* glob: glob<2>.
* hashlib: hashlib<3>.
* hmac: hmac<2>.
* IDLE と idelelib: IDLE と idelelib<2>.
* importlib.metadata: importlib metadata<2>.
* inspect: inspect<4>.
* itertools: itertools<4>.
* linecache: linecache<2>.
* os: os<5>.
* os.path: os path<4>.
* pathlib: pathlib<8>.
* プラットフォーム: プラットフォーム<3>.
* pprint::
* py_compile::
* pyclbr::
* shelve::
* statistics: statistics<3>.
* site: site<2>.
* socket: socket<3>.
* ssl: ssl<4>.
* sqlite3: sqlite3<6>.
* sys: sys<5>.
* _thread::
* threading: threading<4>.
* traceback: traceback<3>.
* types: types<4>.
* typing: typing<6>.
* unittest: unittest<6>.
* urllib.parse: urllib parse.
* xml: xml<2>.
* zipimport: zipimport<3>.

データクラス

* __slots__::
* Keyword-only fields::

Porting to Python 3.10

* Changes in the Python syntax::
* Python API の変更: Python API の変更<4>.
* C API の変更: C API の変更<6>.

C API の変更

* PEP 652; Maintaining the Stable ABI: PEP 652 Maintaining the Stable ABI.
* 新しい機能: 新しい機能<9>.
* Porting to Python 3.10: Porting to Python 3 10<2>.
* 非推奨: 非推奨<7>.
* 削除: 削除<7>.

Notable changes in 3.10.12

* tarfile: tarfile<3>.

What's New In Python 3.9

* 概要: 概要 -- リリースハイライト<6>. リリースハイライト
* コード中の非推奨警告(DeprecationWarning)をチェックして下さい: コード中の非推奨警告 DeprecationWarning をチェックして下さい.
* 新しい機能: 新しい機能<10>.
* その他の言語変更: その他の言語変更<5>.
* 新たなモジュール: 新たなモジュール<5>.
* 改良されたモジュール: 改良されたモジュール<5>.
* 最適化: 最適化<6>.
* 非推奨: 非推奨<8>.
* 削除: 削除<8>.
* Python 3.9への移植: Python 3 9への移植.
* Build Changes: Build Changes<5>.
* C API の変更: C API の変更<9>.
* Python 3.9.1 での重要な変更点: Python 3 9 1 での重要な変更点.
* Python 3.9.2 での重要な変更点: Python 3 9 2 での重要な変更点.
* Python 3.9.3 での重要な変更点: Python 3 9 3 での重要な変更点.
* Python 3.9.5での重要な変更点: Python 3 9 5での重要な変更点.
* Notable security feature in 3.9.14: Notable security feature in 3 9 14.
* Notable changes in 3.9.17: Notable changes in 3 9 17.

新しい機能

* 辞書のマージと更新演算子::
* prefixとsuffixを削除する新しい文字列メソッド::
* 標準コレクション型の型ヒントにおける総称型 (generics) の使用: 標準コレクション型の型ヒントにおける総称型 generics の使用.
* 新しいパーサー::

新たなモジュール

* zoneinfo::
* graphlib: graphlib<2>.

改良されたモジュール

* ast: ast<4>.
* asyncio: asyncio<8>.
* compileall: compileall<2>.
* concurrent.futures: concurrent futures<3>.
* curses: curses<3>.
* datetime: datetime<3>.
* distutils: distutils<3>.
* fcntl: fcntl<2>.
* ftplib: ftplib<2>.
* gc: gc<3>.
* hashlib: hashlib<4>.
* http: http<2>.
* IDLE と idelelib: IDLE と idelelib<3>.
* imaplib: imaplib<2>.
* importlib: importlib<3>.
* inspect: inspect<5>.
* ipaddress: ipaddress<2>.
* math: math<5>.
* multiprocessing: multiprocessing<3>.
* nntplib::
* os: os<6>.
* pathlib: pathlib<9>.
* pdb: pdb<5>.
* poplib::
* pprint: pprint<2>.
* pydoc: pydoc<2>.
* random: random<3>.
* signal::
* smtplib::
* socket: socket<4>.
* time: time<3>.
* sys: sys<6>.
* tracemalloc::
* typing: typing<7>.
* unicodedata: unicodedata<5>.
* venv: venv<3>.
* xml: xml<3>.

Python 3.9への移植

* Python API の変更: Python API の変更<5>.
* C API の変更: C API の変更<8>.
* CPython バイトコードの変更: CPython バイトコードの変更<5>.

C API の変更

* 新しい機能: 新しい機能<11>.
* Python 3.9への移植: Python 3 9への移植<2>.
* 削除: 削除<9>.

Python 3.9.1 での重要な変更点

* typing: typing<8>.
* macOS 11.0 (Big Sur) と Appleシリコンの Mac のサポート: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート.

Python 3.9.2 での重要な変更点

* collections.abc: collections abc<2>.
* urllib.parse: urllib parse<2>.

Python 3.9.5での重要な変更点

* urllib.parse: urllib parse<3>.

Notable changes in 3.9.17

* tarfile: tarfile<4>.

What's New In Python 3.8

* 概要: 概要 -- リリースハイライト<7>. リリースハイライト
* 新しい機能: 新しい機能<12>.
* その他の言語変更: その他の言語変更<6>.
* 新たなモジュール: 新たなモジュール<6>.
* 改良されたモジュール: 改良されたモジュール<6>.
* 最適化: 最適化<7>.
* ビルドならびに C API の変更::
* 非推奨: 非推奨<9>.
* API と機能の削除::
* Python 3.8 への移植: Python 3 8 への移植.
* Python3.8.1 での重要な変更点: Python3 8 1 での重要な変更点.
* Python3.8.2 での重要な変更点: Python3 8 2 での重要な変更点.
* Notable changes in Python 3.8.3: Notable changes in Python 3 8 3.
* Python3.8.8 での重要な変更点: Python3 8 8 での重要な変更点.
* Notable changes in Python 3.8.9: Notable changes in Python 3 8 9.
* Notable changes in Python 3.8.10: Notable changes in Python 3 8 10.
* Notable changes in Python 3.8.10: Notable changes in Python 3 8 10<2>.
* Notable changes in Python 3.8.12: Notable changes in Python 3 8 12.
* Notable security feature in 3.8.14: Notable security feature in 3 8 14.
* Notable changes in 3.8.17: Notable changes in 3 8 17.

新しい機能

* 代入式::
* 位置専用引数::
* コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム::
* デバッグビルドとリリースビルドのABI 共通化::
* f-string での = を用いたオブジェクトの表現::
* PEP 578; Pythonランタイムの監査フック: PEP 578 Pythonランタイムの監査フック.
* PEP 587; Python 初期化設定: PEP 587 Python 初期化設定.
* PEP 590; Vectorcall; a fast calling protocol for CPython: PEP 590 Vectorcall a fast calling protocol for CPython.
* Pickle プロトコルバージョン 5 による帯域外データバッファ::

改良されたモジュール

* ast: ast<5>.
* asyncio: asyncio<9>.
* builtins: builtins<2>.
* collections::
* cProfile::
* csv: csv<2>.
* curses: curses<4>.
* ctypes: ctypes<3>.
* datetime: datetime<4>.
* functools: functools<3>.
* gc: gc<4>.
* gettext::
* gzip: gzip<3>.
* IDLE と idelelib: IDLE と idelelib<4>.
* inspect: inspect<6>.
* io: io<5>.
* itertools: itertools<5>.
* json.tool: json tool.
* logging: logging<2>.
* math: math<6>.
* mmap: mmap<2>.
* multiprocessing: multiprocessing<4>.
* os: os<7>.
* os.path: os path<5>.
* pathlib: pathlib<10>.
* pickle: pickle<2>.
* plistlib::
* pprint: pprint<3>.
* py_compile: py_compile<2>.
* shlex::
* shutil: shutil<4>.
* socket: socket<5>.
* ssl: ssl<5>.
* statistics: statistics<4>.
* sys: sys<7>.
* tarfile: tarfile<5>.
* threading: threading<5>.
* tokenize: tokenize<2>.
* tkinter: tkinter<5>.
* time: time<4>.
* typing: typing<9>.
* unicodedata: unicodedata<6>.
* unittest: unittest<7>.
* venv: venv<4>.
* weakref::
* xml: xml<4>.
* xmlrpc::

Python 3.8 への移植

* Python の挙動の変更::
* Python API の変更: Python API の変更<6>.
* C API の変更: C API の変更<10>.
* CPython バイトコードの変更: CPython バイトコードの変更<6>.
* Demos and Tools: Demos and Tools<2>.

Notable changes in Python 3.8.10

* macOS 11.0 (Big Sur) と Appleシリコンの Mac のサポート: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート<2>.

Notable changes in Python 3.8.10

* urllib.parse: urllib parse<4>.

Notable changes in Python 3.8.12

* Python API の変更: Python API の変更<7>.

Notable changes in 3.8.17

* tarfile: tarfile<6>.

What's New In Python 3.7

* 概要: 概要 -- リリースハイライト<8>. リリースハイライト
* 新しい機能: 新しい機能<13>.
* その他の言語変更: その他の言語変更<7>.
* 新たなモジュール: 新たなモジュール<7>.
* 改良されたモジュール: 改良されたモジュール<7>.
* C API の変更: C API の変更<11>.
* Build Changes: Build Changes<6>.
* 最適化: 最適化<8>.
* その他の CPython の実装の変更: その他の CPython の実装の変更<2>.
* 非推奨の Python の挙動::
* 非推奨の Python モジュール、関数、メソッド::
* C API の非推奨の関数ならびに型::
* サポート対象プラットフォームからの除外::
* API と機能の削除: API と機能の削除<2>.
* Module Removals::
* Windows-only Changes::
* Python 3.7 への移植: Python 3 7 への移植.
* Python 3.7.1 での重要な変更点: Python 3 7 1 での重要な変更点.
* Python 3.7.2 での重要な変更点: Python 3 7 2 での重要な変更点.
* Python 3.7.6 での重要な変更点: Python 3 7 6 での重要な変更点.
* Python 3.7.10 での重要な変更点: Python 3 7 10 での重要な変更点.
* Notable changes in Python 3.7.11: Notable changes in Python 3 7 11.
* Notable security feature in 3.7.14: Notable security feature in 3 7 14.

新しい機能

* PEP 563; アノテーションの遅延評価: PEP 563 アノテーションの遅延評価.
* PEP 538; レガシーな C ロケールの抑圧: PEP 538 レガシーな C ロケールの抑圧.
* PEP 540; 強制 UTF-8 実行モード: PEP 540 強制 UTF-8 実行モード.
* PEP 553; 組み込みの breakpoint(): PEP 553 組み込みの breakpoint.
* PEP 539; スレッドローカルストレージのための新しい C API: PEP 539 スレッドローカルストレージのための新しい C API.
* PEP 562; モジュール属性へのアクセスのカスタマイズ: PEP 562 モジュール属性へのアクセスのカスタマイズ.
* PEP 564; ナノ秒単位の分解能を持つ新しい時間関数: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数.
* PEP 565; Show DeprecationWarning in __main__: PEP 565 Show DeprecationWarning in __main__.
* PEP 560; typing モジュールとジェネリック型に対する言語コアによるサポート: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート.
* PEP 552; Hash-based .pyc Files: PEP 552 Hash-based pyc Files.
* PEP 545; Python Documentation Translations: PEP 545 Python Documentation Translations.
* Python Development Mode (-X dev): Python Development Mode -X dev.

新たなモジュール

* contextvars: contextvars<2>.
* データクラス: データクラス<3>.
* importlib.resources: importlib resources<2>.

改良されたモジュール

* argparse: argparse<5>.
* asyncio: asyncio<10>.
* binascii::
* calendar: calendar<3>.
* collections: collections<2>.
* compileall: compileall<3>.
* concurrent.futures: concurrent futures<4>.
* contextlib: contextlib<3>.
* cProfile: cProfile<2>.
* crypt::
* datetime: datetime<5>.
* dbm: dbm<2>.
* decimal: decimal<2>.
* dis: dis<4>.
* distutils: distutils<4>.
* enum: enum<5>.
* functools: functools<4>.
* gc: gc<5>.
* hmac: hmac<3>.
* http.client: http client.
* http.server: http server.
* idlelib と IDLE::
* importlib: importlib<4>.
* io: io<6>.
* ipaddress: ipaddress<3>.
* itertools: itertools<6>.
* locale: locale<4>.
* logging: logging<3>.
* math: math<7>.
* mimetypes: mimetypes<3>.
* msilib::
* multiprocessing: multiprocessing<5>.
* os: os<8>.
* pathlib: pathlib<11>.
* pdb: pdb<6>.
* py_compile: py_compile<3>.
* pydoc: pydoc<3>.
* queue: queue<2>.
* re: re<5>.
* signal: signal<2>.
* socket: socket<6>.
* socketserver::
* sqlite3: sqlite3<7>.
* ssl: ssl<6>.
* string: string<2>.
* subprocess: subprocess<2>.
* sys: sys<8>.
* time: time<5>.
* tkinter: tkinter<6>.
* tracemalloc: tracemalloc<2>.
* types: types<5>.
* unicodedata: unicodedata<7>.
* unittest: unittest<8>.
* unittest.mock: unittest mock.
* urllib.parse: urllib parse<5>.
* uu::
* uuid: uuid<4>.
* warnings: warnings<3>.
* xml: xml<5>.
* xml.etree: xml etree.
* xmlrpc.server: xmlrpc server.
* zipapp::
* zipfile: zipfile<3>.

非推奨の Python モジュール、関数、メソッド

* aifc::
* asyncio: asyncio<11>.
* collections: collections<3>.
* dbm: dbm<3>.
* enum: enum<6>.
* gettext: gettext<2>.
* importlib: importlib<5>.
* locale: locale<5>.
* macpath::
* threading: threading<6>.
* socket: socket<7>.
* ssl: ssl<7>.
* sunau::
* sys: sys<9>.
* wave::

Python 3.7 への移植

* Python の挙動の変更: Python の挙動の変更<2>.
* Python API の変更: Python API の変更<8>.
* C API の変更: C API の変更<12>.
* CPython バイトコードの変更: CPython バイトコードの変更<7>.
* Windows-only Changes: Windows-only Changes<2>.
* その他の CPython の実装の変更: その他の CPython の実装の変更<3>.

What's New In Python 3.6

* 概要: 概要 -- リリースハイライト<9>. リリースハイライト
* 新しい機能: 新しい機能<14>.
* その他の言語変更: その他の言語変更<8>.
* 新たなモジュール: 新たなモジュール<8>.
* 改良されたモジュール: 改良されたモジュール<8>.
* 最適化: 最適化<9>.
* ビルドならびに C API の変更: ビルドならびに C API の変更<2>.
* その他の改善::
* 非推奨: 非推奨<10>.
* 削除: 削除<10>.
* Python 3.6 への移植: Python 3 6 への移植.
* Notable changes in Python 3.6.2: Notable changes in Python 3 6 2.
* Notable changes in Python 3.6.4: Notable changes in Python 3 6 4.
* Notable changes in Python 3.6.5: Notable changes in Python 3 6 5.
* Notable changes in Python 3.6.7: Notable changes in Python 3 6 7.
* Notable changes in Python 3.6.10: Notable changes in Python 3 6 10.
* Notable changes in Python 3.6.13: Notable changes in Python 3 6 13.
* Notable changes in Python 3.6.14: Notable changes in Python 3 6 14.

新しい機能

* PEP 498; フォーマット済み文字列リテラル: PEP 498 フォーマット済み文字列リテラル.
* PEP 526; 変数アノテーションの文法: PEP 526 変数アノテーションの文法.
* PEP 515; 数値リテラル内のアンダースコア: PEP 515 数値リテラル内のアンダースコア.
* PEP 525; 非同期ジェネレータ: PEP 525 非同期ジェネレータ.
* PEP 530; 非同期内包表記: PEP 530 非同期内包表記.
* PEP 487; Simpler customization of class creation: PEP 487 Simpler customization of class creation.
* PEP 487; 記述子プロトコルの改善: PEP 487 記述子プロトコルの改善.
* PEP 519; ファイルシステムパスプロトコルの追加: PEP 519 ファイルシステムパスプロトコルの追加.
* PEP 495; 地域時間の曖昧さ回避: PEP 495 地域時間の曖昧さ回避.
* PEP 529; Windows ファイルシステムのエンコーディングを UTF-8 に変更: PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更.
* PEP 528; Windows コンソールのエンコーディングを UTF-8 に変更: PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更.
* PEP 520; クラス属性の定義の順番を保持: PEP 520 クラス属性の定義の順番を保持.
* PEP 468; キーワード引数の順番の保持: PEP 468 キーワード引数の順番の保持.
* 新たな dict 実装::
* PEP 523; CPython にフレーム評価 API を追加: PEP 523 CPython にフレーム評価 API を追加.
* PYTHONMALLOC 環境変数::
* DTrace and SystemTap probing support::

新たなモジュール

* secrets::

改良されたモジュール

* array: array<3>.
* ast: ast<6>.
* asyncio: asyncio<12>.
* binascii: binascii<2>.
* cmath::
* collections: collections<4>.
* concurrent.futures: concurrent futures<5>.
* contextlib: contextlib<4>.
* datetime: datetime<6>.
* decimal: decimal<3>.
* distutils: distutils<5>.
* email: email<3>.
* エンコーディング: エンコーディング<2>.
* enum: enum<7>.
* faulthandler: faulthandler<3>.
* fileinput: fileinput<2>.
* hashlib: hashlib<5>.
* http.client: http client<2>.
* idlelib と IDLE: idlelib と IDLE<2>.
* importlib: importlib<6>.
* inspect: inspect<7>.
* json: json<2>.
* logging: logging<4>.
* math: math<8>.
* multiprocessing: multiprocessing<6>.
* os: os<9>.
* pathlib: pathlib<12>.
* pdb: pdb<7>.
* pickle: pickle<3>.
* pickletools::
* pydoc: pydoc<4>.
* random: random<4>.
* re: re<6>.
* readline::
* rlcompleter::
* shlex: shlex<2>.
* site: site<3>.
* sqlite3: sqlite3<8>.
* socket: socket<8>.
* socketserver: socketserver<2>.
* ssl: ssl<8>.
* statistics: statistics<5>.
* struct: struct<2>.
* subprocess: subprocess<3>.
* sys: sys<10>.
* telnetlib::
* time: time<6>.
* timeit::
* tkinter: tkinter<7>.
* traceback: traceback<4>.
* tracemalloc: tracemalloc<3>.
* typing: typing<10>.
* unicodedata: unicodedata<8>.
* unittest.mock: unittest mock<2>.
* urllib.request: urllib request.
* urllib.robotparser: urllib robotparser.
* venv: venv<5>.
* warnings: warnings<4>.
* winreg::
* winsound::
* xmlrpc.client: xmlrpc client.
* zipfile: zipfile<4>.
* zlib: zlib<2>.

非推奨

* 新たなキーワード::
* 非推奨の Python 挙動::
* 非推奨の Python モジュール、関数、メソッド: 非推奨の Python モジュール、関数、メソッド<2>.
* xml: xml<6>.
* C API の非推奨の関数ならびに型: C API の非推奨の関数ならびに型<2>.
* 非推奨のビルドオプション::

非推奨の Python モジュール、関数、メソッド

* asynchat::
* asyncore::
* dbm: dbm<4>.
* distutils: distutils<6>.
* grp::
* importlib: importlib<7>.
* os: os<10>.
* re: re<7>.
* ssl: ssl<9>.
* tkinter: tkinter<8>.
* venv: venv<6>.

削除

* API と機能の削除: API と機能の削除<3>.

Python 3.6 への移植

* 'python' コマンドの挙動の変更::
* Python API の変更: Python API の変更<9>.
* C API の変更: C API の変更<13>.
* CPython バイトコードの変更: CPython バイトコードの変更<8>.

Notable changes in Python 3.6.2

* New make regen-all build target::
* Removal of make touch build target::

What's New In Python 3.5

* 概要: 概要 -- リリースハイライト<10>. リリースハイライト
* 新しい機能: 新しい機能<15>.
* その他の言語変更: その他の言語変更<9>.
* 新たなモジュール: 新たなモジュール<9>.
* 改良されたモジュール: 改良されたモジュール<9>.
* その他のモジュールレベルの変更::
* 最適化: 最適化<10>.
* ビルドならびに C API の変更: ビルドならびに C API の変更<3>.
* 非推奨: 非推奨<11>.
* 削除: 削除<11>.
* Python 3.5 への移植: Python 3 5 への移植.
* Notable changes in Python 3.5.4: Notable changes in Python 3 5 4.

新しい機能

* PEP 492 - コルーチン、 async と await 構文::
* PEP 465 - 行列の乗算専用の中置演算子::
* PEP 448 - 追加可能なアンパックへの一般化::
* PEP 461 - bytes および bytearray のパーセント書式化サポート::
* PEP 484 - 型ヒント::
* PEP 471 - os.scandir() 関数: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ. より良く、速いディレクトリイテレータ
* PEP 475; EINTR で失敗したシステムコールの再試行: PEP 475 EINTR で失敗したシステムコールの再試行.
* PEP 479; ジェネレータ内の StopIteration の処理の変更: PEP 479 ジェネレータ内の StopIteration の処理の変更.
* PEP 485; 近似的に等しいことを調べる関数: PEP 485 近似的に等しいことを調べる関数.
* PEP 486; Python ランチャーが仮想環境を認識する: PEP 486 Python ランチャーが仮想環境を認識する.
* PEP 488; PYO ファイルの廃止: PEP 488 PYO ファイルの廃止.
* PEP 489; 拡張モジュールの多段階初期化: PEP 489 拡張モジュールの多段階初期化.

新たなモジュール

* typing: typing<11>.
* zipapp: zipapp<2>.

改良されたモジュール

* argparse: argparse<6>.
* asyncio: asyncio<13>.
* bz2::
* cgi::
* cmath: cmath<2>.
* コード::
* collections: collections<5>.
* collections.abc: collections abc<3>.
* compileall: compileall<4>.
* concurrent.futures: concurrent futures<6>.
* configparser: configparser<5>.
* contextlib: contextlib<5>.
* csv: csv<3>.
* curses: curses<5>.
* dbm: dbm<5>.
* difflib: difflib<3>.
* distutils: distutils<7>.
* doctest: doctest<3>.
* email: email<4>.
* enum: enum<8>.
* faulthandler: faulthandler<4>.
* functools: functools<5>.
* glob: glob<3>.
* gzip: gzip<4>.
* heapq: heapq<2>.
* http: http<3>.
* http.client: http client<3>.
* idlelib と IDLE: idlelib と IDLE<3>.
* imaplib: imaplib<3>.
* imghdr::
* importlib: importlib<8>.
* inspect: inspect<8>.
* io: io<7>.
* ipaddress: ipaddress<4>.
* json: json<3>.
* linecache: linecache<3>.
* locale: locale<6>.
* logging: logging<5>.
* lzma::
* math: math<9>.
* multiprocessing: multiprocessing<7>.
* operator: operator<3>.
* os: os<11>.
* pathlib: pathlib<13>.
* pickle: pickle<4>.
* poplib: poplib<2>.
* re: re<8>.
* readline: readline<2>.
* selectors::
* shutil: shutil<5>.
* signal: signal<3>.
* smtpd: smtpd<2>.
* smtplib: smtplib<2>.
* sndhdr::
* socket: socket<9>.
* ssl: ssl<10>.
* sqlite3: sqlite3<9>.
* subprocess: subprocess<4>.
* sys: sys<11>.
* sysconfig: sysconfig<3>.
* tarfile: tarfile<7>.
* threading: threading<7>.
* time: time<7>.
* timeit: timeit<2>.
* tkinter: tkinter<9>.
* traceback: traceback<5>.
* types: types<6>.
* unicodedata: unicodedata<9>.
* unittest: unittest<9>.
* unittest.mock: unittest mock<3>.
* urllib: urllib<4>.
* wsgiref::
* xmlrpc: xmlrpc<2>.
* xml.sax: xml sax.
* zipfile: zipfile<5>.

ssl

* メモリ BIO サポート::
* Application-Layer Protocol Negotiation Support::
* その他の変更::

非推奨

* 新たなキーワード: 新たなキーワード<2>.
* 非推奨の Python の挙動: 非推奨の Python の挙動<2>.
* サポートされないオペレーティングシステム::
* 非推奨の Python モジュール、関数、メソッド: 非推奨の Python モジュール、関数、メソッド<3>.

削除

* API と機能の削除: API と機能の削除<4>.

Python 3.5 への移植

* Python の挙動の変更: Python の挙動の変更<3>.
* Python API の変更: Python API の変更<10>.
* C API の変更: C API の変更<14>.

Notable changes in Python 3.5.4

* New make regen-all build target: New make regen-all build target<2>.
* Removal of make touch build target: Removal of make touch build target<2>.

What's New In Python 3.4

* 概要: 概要 -- リリースハイライト<11>. リリースハイライト
* 新しい機能: 新しい機能<16>.
* 新たなモジュール: 新たなモジュール<10>.
* 改良されたモジュール: 改良されたモジュール<10>.
* CPython の実装の変更::
* 非推奨: 非推奨<12>.
* 削除: 削除<12>.
* Python 3.4 への移植: Python 3 4 への移植.
* 3.4.3 の変更: 3 4 3 の変更.

新しい機能

* PEP 453; Python インストール時の PIP の明示的なブートストラッピング: PEP 453 Python インストール時の PIP の明示的なブートストラッピング.
* PEP 446; 新規作成されたファイル記述子は継承不可: PEP 446 新規作成されたファイル記述子は継承不可.
* Codec 処理の改良::
* PEP 451; インポートシステムのための ModuleSpec 型: PEP 451 インポートシステムのための ModuleSpec 型.
* その他の言語変更: その他の言語変更<10>.

PEP 453: Python インストール時の PIP の明示的なブートストラッピング

* デフォルトでの pip のブートストラッピング::
* ドキュメントの変更::

新たなモジュール

* asyncio: asyncio<14>.
* ensurepip: ensurepip<2>.
* enum: enum<9>.
* pathlib: pathlib<14>.
* selectors: selectors<2>.
* statistics: statistics<6>.
* tracemalloc: tracemalloc<4>.

改良されたモジュール

* abc::
* aifc: aifc<2>.
* argparse: argparse<7>.
* audioop::
* base64: base64<4>.
* collections: collections<6>.
* colorsys::
* contextlib: contextlib<6>.
* dbm: dbm<6>.
* dis: dis<5>.
* doctest: doctest<4>.
* email: email<5>.
* filecmp::
* functools: functools<6>.
* gc: gc<6>.
* glob: glob<4>.
* hashlib: hashlib<6>.
* hmac: hmac<4>.
* html::
* http: http<4>.
* idlelib と IDLE: idlelib と IDLE<4>.
* importlib: importlib<9>.
* inspect: inspect<9>.
* ipaddress: ipaddress<5>.
* logging: logging<6>.
* marshal: marshal<2>.
* mmap: mmap<3>.
* multiprocessing: multiprocessing<8>.
* operator: operator<4>.
* os: os<12>.
* pdb: pdb<8>.
* pickle: pickle<5>.
* plistlib: plistlib<2>.
* poplib: poplib<3>.
* pprint: pprint<4>.
* pty: pty<2>.
* pydoc: pydoc<5>.
* re: re<9>.
* resource::
* select::
* shelve: shelve<2>.
* shutil: shutil<6>.
* smtpd: smtpd<3>.
* smtplib: smtplib<3>.
* socket: socket<10>.
* sqlite3: sqlite3<10>.
* ssl: ssl<11>.
* stat::
* struct: struct<3>.
* subprocess: subprocess<5>.
* sunau: sunau<2>.
* sys: sys<12>.
* tarfile: tarfile<8>.
* textwrap: textwrap<2>.
* threading: threading<8>.
* traceback: traceback<6>.
* types: types<7>.
* urllib: urllib<5>.
* unittest: unittest<10>.
* venv: venv<7>.
* wave: wave<2>.
* weakref: weakref<2>.
* xml.etree: xml etree<2>.
* zipfile: zipfile<6>.

CPython の実装の変更

* PEP 445; CPython のメモリアロケータのカスタマイズ: PEP 445 CPython のメモリアロケータのカスタマイズ.
* PEP 442; オブジェクトの安全なファイナライゼーション: PEP 442 オブジェクトの安全なファイナライゼーション.
* PEP 456; 安全で取り換え可能なハッシュアルゴリズム: PEP 456 安全で取り換え可能なハッシュアルゴリズム.
* PEP 436; Argument Clinic: PEP 436 Argument Clinic.
* その他のビルド並びに C API の変更::
* その他の改善: その他の改善<2>.
* 大幅な最適化::

非推奨

* Python API の非推奨項目::
* 非推奨の機能::

削除

* サポートされなくなったオペレーティングシステム::
* API と機能の削除: API と機能の削除<5>.
* コードの整理::

Python 3.4 への移植

* 'python' コマンドの挙動の変更: 'python' コマンドの挙動の変更<2>.
* Python API の変更: Python API の変更<11>.
* C API の変更: C API の変更<15>.

3.4.3 の変更

* PEP 476; stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化.

What's New In Python 3.3

* 概要: 概要 -- リリースハイライト<12>. リリースハイライト
* PEP 405; 仮想環境: PEP 405 仮想環境.
* PEP 420; 暗黙的な名前空間パッケージ: PEP 420 暗黙的な名前空間パッケージ.
* PEP 3118; 新たなメモリビューの実装とバッファプロトコルのドキュメント: PEP 3118 新たなメモリビューの実装とバッファプロトコルのドキュメント.
* PEP 393; 文字列の柔軟な表現: PEP 393 文字列の柔軟な表現.
* PEP 397; Windows の Python ランチャ: PEP 397 Windows の Python ランチャ.
* PEP 3151; OS および IO 例外階層の手直し: PEP 3151 OS および IO 例外階層の手直し.
* PEP 380; サブジェネレータへの委譲構文: PEP 380 サブジェネレータへの委譲構文.
* PEP 409; 例外コンテキストの抑制: PEP 409 例外コンテキストの抑制.
* PEP 414; 明示的なユニコードリテラル: PEP 414 明示的なユニコードリテラル.
* PEP 3155; クラスと関数の正規名: PEP 3155 クラスと関数の正規名.
* PEP 412; キー共有辞書: PEP 412 キー共有辞書.
* PEP 362; 関数シグニチャオブジェクト: PEP 362 関数シグニチャオブジェクト.
* PEP 421; sys.implementation の追加: PEP 421 sys implementation の追加.
* インポート実装としての importlib の使用::
* その他の言語変更: その他の言語変更<11>.
* 細粒度のインポートロック::
* 組み込みの関数と型::
* 新たなモジュール: 新たなモジュール<11>.
* 改良されたモジュール: 改良されたモジュール<11>.
* 最適化: 最適化<11>.
* ビルドならびに C API の変更: ビルドならびに C API の変更<4>.
* 非推奨: 非推奨<13>.
* Python 3.3 への移植: Python 3 3 への移植.

PEP 3118: 新たなメモリビューの実装とバッファプロトコルのドキュメント

* フィーチャー::
* API の変更::

PEP 393: 文字列の柔軟な表現

* 機能性::
* 性能およびリソース使用量::

PEP 421: sys.implementation の追加

* SimpleNamespace::

インポート実装としての importlib の使用

* 新たな API::
* 目に見える変化::

新たなモジュール

* faulthandler: faulthandler<5>.
* ipaddress: ipaddress<6>.
* lzma: lzma<2>.

改良されたモジュール

* abc: abc<2>.
* array: array<4>.
* base64: base64<5>.
* binascii: binascii<3>.
* bz2: bz2<2>.
* codecs: codecs<2>.
* collections: collections<7>.
* contextlib: contextlib<7>.
* crypt: crypt<2>.
* curses: curses<6>.
* datetime: datetime<7>.
* decimal: decimal<4>.
* email: email<6>.
* ftplib: ftplib<3>.
* functools: functools<7>.
* gc: gc<7>.
* hmac: hmac<5>.
* http: http<5>.
* html: html<2>.
* imaplib: imaplib<4>.
* inspect: inspect<10>.
* io: io<8>.
* itertools: itertools<7>.
* logging: logging<7>.
* math: math<10>.
* mmap: mmap<4>.
* multiprocessing: multiprocessing<9>.
* nntplib: nntplib<2>.
* os: os<13>.
* pdb: pdb<9>.
* pickle: pickle<6>.
* pydoc: pydoc<6>.
* re: re<10>.
* sched::
* select: select<2>.
* shlex: shlex<3>.
* shutil: shutil<7>.
* signal: signal<4>.
* smtpd: smtpd<4>.
* smtplib: smtplib<4>.
* socket: socket<11>.
* socketserver: socketserver<3>.
* sqlite3: sqlite3<11>.
* ssl: ssl<12>.
* stat: stat<2>.
* struct: struct<4>.
* subprocess: subprocess<6>.
* sys: sys<13>.
* tarfile: tarfile<9>.
* tempfile: tempfile<4>.
* textwrap: textwrap<3>.
* threading: threading<9>.
* time: time<8>.
* types: types<8>.
* unittest: unittest<11>.
* urllib: urllib<6>.
* webbrowser: webbrowser<4>.
* xml.etree.ElementTree: xml etree ElementTree<2>.
* zlib: zlib<3>.

decimal

* フィーチャー: フィーチャー<2>.
* API の変更: API の変更<2>.

email

* ポリシーフレームワーク::
* 新規ヘッダ API を伴った暫定ポリシー::
* その他のAPIの変更::

非推奨

* サポートされないオペレーティングシステム: サポートされないオペレーティングシステム<2>.
* 非推奨の Python モジュール、関数、メソッド: 非推奨の Python モジュール、関数、メソッド<4>.
* C API の非推奨の関数ならびに型: C API の非推奨の関数ならびに型<3>.
* 非推奨の機能: 非推奨の機能<2>.

Python 3.3 への移植

* Python コードの移植::
* C コードの移植::
* C 拡張のビルド::
* コマンドラインスイッチの変更::

What's New In Python 3.2

* PEP 384; 安定 ABI の定義: PEP 384 安定 ABI の定義.
* PEP 389; argparse コマンドライン解析モジュール: PEP 389 argparse コマンドライン解析モジュール.
* PEP 391; logging の辞書ベースの設定: PEP 391 logging の辞書ベースの設定.
* PEP 3148; concurrent.futures モジュール: PEP 3148 concurrent futures モジュール.
* PEP 3147; PYC リポジトリーディレクトリ: PEP 3147 PYC リポジトリーディレクトリ.
* PEP 3149; ABI バージョンでタグ付けされた .so ファイル: PEP 3149 ABI バージョンでタグ付けされた so ファイル.
* PEP 3333; Python Web Server Gateway Interface v1.0.1: PEP 3333 Python Web Server Gateway Interface v1 0 1.
* その他の言語変更: その他の言語変更<12>.
* 新たなモジュール、改良されたモジュール、非推奨のモジュール::
* マルチスレッディング::
* 最適化: 最適化<12>.
* Unicode 文字列型::
* Codecs::
* ドキュメント::
* IDLE::
* コードリポジトリ::
* ビルドならびに C API の変更: ビルドならびに C API の変更<5>.
* Python 3.2 への移植: Python 3 2 への移植.

新たなモジュール、改良されたモジュール、非推奨のモジュール

* email: email<7>.
* elementtree::
* functools: functools<8>.
* itertools: itertools<8>.
* collections: collections<8>.
* threading: threading<10>.
* datetime と time::
* math: math<11>.
* abc: abc<3>.
* io: io<9>.
* reprlib::
* logging: logging<8>.
* csv: csv<4>.
* contextlib: contextlib<8>.
* decimal と fractions::
* ftp::
* popen::
* select: select<3>.
* gzip と zipfile::
* tarfile: tarfile<10>.
* hashlib: hashlib<7>.
* ast: ast<7>.
* os: os<14>.
* shutil: shutil<8>.
* sqlite3: sqlite3<12>.
* html: html<3>.
* socket: socket<12>.
* ssl: ssl<13>.
* nntp::
* certificates::
* imaplib: imaplib<5>.
* http.client: http client<4>.
* unittest: unittest<12>.
* random: random<5>.
* poplib: poplib<4>.
* asyncore: asyncore<2>.
* tempfile: tempfile<5>.
* inspect: inspect<11>.
* pydoc: pydoc<7>.
* dis: dis<6>.
* dbm: dbm<7>.
* ctypes: ctypes<4>.
* site: site<4>.
* sysconfig: sysconfig<4>.
* pdb: pdb<10>.
* configparser: configparser<6>.
* urllib.parse: urllib parse<6>.
* mailbox::
* turtledemo::

What's New In Python 3.1

* PEP 372; 順序付き辞書: PEP 372 順序付き辞書.
* PEP 378; 1000区切りのための書式指定子: PEP 378 1000区切りのための書式指定子.
* その他の言語変更: その他の言語変更<13>.
* 新たなモジュール、改良されたモジュール、非推奨のモジュール: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>.
* 最適化: 最適化<13>.
* IDLE: IDLE<2>.
* ビルドならびに C API の変更: ビルドならびに C API の変更<6>.
* Python 3.1 への移植: Python 3 1 への移植.

What's New In Python 3.0

* よくある悩みの種::
* 構文の変更の概要::
* Python 2.6 で既にあった変更: Python 2 6 で既にあった変更.
* ライブラリの変更::
* PEP 3101; 文字列整形の新たなアプローチ: PEP 3101 文字列整形の新たなアプローチ.
* 例外に関する変更::
* その他の変更: その他の変更<2>.
* ビルドならびに C API の変更: ビルドならびに C API の変更<7>.
* 性能::
* Python 3.0 への移植: Python 3 0 への移植.

よくある悩みの種

* print関数::
* リストからビューおよびイテレータへ::
* 順序比較::
* 整数::
* Unicode 対 8 ビット、ではなく、テキスト対データに::

構文の変更の概要

* 新たな構文::
* 変更された構文::
* 削除された操作::

その他の変更

* 演算子と特殊メソッド::
* 組み込み::

What's New in Python 2.7

* Python 2.x の今後: Python 2 x の今後.
* Deprecation Warnings の扱いの変更::
* Python 3.1 の機能: Python 3 1 の機能.
* PEP 372; collections に順序付き辞書を追加: PEP 372 collections に順序付き辞書を追加.
* PEP 378; 1000区切りのための書式指定子: PEP 378 1000区切りのための書式指定子<2>.
* PEP 389; コマンドライン解析のための argparse モジュール: PEP 389 コマンドライン解析のための argparse モジュール.
* PEP 391; logging の辞書ベースの設定: PEP 391 logging の辞書ベースの設定<2>.
* PEP 3106; 辞書 View: PEP 3106 辞書 View.
* PEP 3137; memoryview オブジェクト: PEP 3137 memoryview オブジェクト.
* その他の言語変更: その他の言語変更<14>.
* 新しいモジュールと改良されたモジュール::
* ビルドならびに C API の変更: ビルドならびに C API の変更<8>.
* その他の変更と修正::
* Python 2.7 への移植: Python 2 7 への移植.
* Python 2.7 メンテナンスリリースで追加された新機能: Python 2 7 メンテナンスリリースで追加された新機能.
* 謝辞::

その他の言語変更

* インタプリタの変更::
* 最適化: 最適化<14>.

新しいモジュールと改良されたモジュール

* 新しいモジュール; importlib: 新しいモジュール importlib.
* 新しいモジュール; sysconfig: 新しいモジュール sysconfig.
* ttk; Tk のテーマ付きウィジェット: ttk Tk のテーマ付きウィジェット.
* 更新されたモジュール; unittest: 更新されたモジュール unittest.
* 更新されたモジュール; ElementTree 1.3: 更新されたモジュール ElementTree 1 3.

ビルドならびに C API の変更

* カプセル::
* ポート特有の変更; Windows: ポート特有の変更 Windows.
* ポート特有の変更; Mac OS X: ポート特有の変更 Mac OS X.
* ポート特有の変更; FreeBSD: ポート特有の変更 FreeBSD.

Python 2.7 メンテナンスリリースで追加された新機能

* デバッグモード用の2つの新しい環境変数::
* PEP 434; IDLE 拡張についての全てのブランチにおける例外的な扱い: PEP 434 IDLE 拡張についての全てのブランチにおける例外的な扱い.
* PEP 466; Python 2.7 のためのネットワークセキュリティ拡張: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張.
* PEP 477; Python 2.7 への ensurepip (PEP 453) バックポート: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート.
* PEP 476; stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化<2>.
* PEP 493; HTTPS verification migration tools for Python 2.7: PEP 493 HTTPS verification migration tools for Python 2 7.
* New make regen-all build target: New make regen-all build target<3>.
* Removal of make touch build target: Removal of make touch build target<3>.

PEP 477: Python 2.7 への ensurepip (PEP 453) バックポート

* デフォルトでの pip のブートストラッピング: デフォルトでの pip のブートストラッピング<2>.
* ドキュメントの変更: ドキュメントの変更<2>.

What's New in Python 2.6

* Python 3.0: Python 3 0.
* 開発プロセスに関する変更::
* PEP 343; "with" ステートメント: PEP 343 "with" ステートメント.
* PEP 366; メインモジュールからの明示的相対インポート: PEP 366 メインモジュールからの明示的相対インポート.
* PEP 370; ユーザごとの site-packages ディレクトリ: PEP 370 ユーザごとの site-packages ディレクトリ.
* PEP 371; multiprocessing パッケージ: PEP 371 multiprocessing パッケージ.
* PEP 3101; 進化版文字列フォーマッティング: PEP 3101 進化版文字列フォーマッティング.
* PEP 3105; print を関数にする: PEP 3105 print を関数にする.
* PEP 3110; 例外処理の変更: PEP 3110 例外処理の変更.
* PEP 3112; バイトリテラル: PEP 3112 バイトリテラル.
* PEP 3116; 新しい I/O ライブラリ: PEP 3116 新しい I/O ライブラリ.
* PEP 3118; 改訂版バッファプロトコル: PEP 3118 改訂版バッファプロトコル.
* PEP 3119; 抽象基底クラス: PEP 3119 抽象基底クラス.
* PEP 3127; 整数リテラルのサポートと文法: PEP 3127 整数リテラルのサポートと文法.
* PEP 3129; クラスデコレータ: PEP 3129 クラスデコレータ.
* PEP 3141; 数値の型階層: PEP 3141 数値の型階層.
* その他の言語変更: その他の言語変更<15>.
* 新しいモジュールと改良されたモジュール: 新しいモジュールと改良されたモジュール<2>.
* 非推奨と削除::
* ビルドならびに C API の変更: ビルドならびに C API の変更<9>.
* Python 2.6 への移植: Python 2 6 への移植.
* 謝辞: 謝辞<2>.

開発プロセスに関する変更

* 新しい課題トラッカー; Roundup: 新しい課題トラッカー Roundup.
* 新しいドキュメンテーションフォーマット; Sphinx を使っての reStructuredText: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText.

PEP 343: "with" ステートメント

* コンテキストマネージャを書く::
* contextlib モジュール::

PEP 3141: 数値の型階層

* fractions モジュール::

その他の言語変更

* 最適化: 最適化<15>.
* インタプリタの変更: インタプリタの変更<2>.

新しいモジュールと改良されたモジュール

* ast モジュール::
* The future_builtins module::
* json モジュール; JavaScript オブジェクト記法: json モジュール JavaScript オブジェクト記法.
* plistlib モジュール; プロパティリストパーサ: plistlib モジュール プロパティリストパーサ.
* ctypes の強化::
* SSL サポートの改善::

ビルドならびに C API の変更

* ポート特有の変更; Windows: ポート特有の変更 Windows<2>.
* ポート特有の変更; Mac OS X: ポート特有の変更 Mac OS X<2>.
* ポート特有の変更; IRIX: ポート特有の変更 IRIX.

What's New in Python 2.5

* PEP 308; 条件式 (Conditional Expressions): PEP 308 条件式 Conditional Expressions.
* PEP 309; 関数の部分適用: PEP 309 関数の部分適用.
* PEP 314; Metadata for Python Software Packages v1.1: PEP 314 Metadata for Python Software Packages v1 1.
* PEP 328; 絶対インポート、相対インポート: PEP 328 絶対インポート、相対インポート.
* PEP 338 - モジュールをスクリプトとして実行する::
* PEP 341; try/except/finally の一体化: PEP 341 try/except/finally の一体化.
* PEP 342; ジェネレータの新機能: PEP 342 ジェネレータの新機能.
* PEP 343; "with" ステートメント: PEP 343 "with" ステートメント<2>.
* PEP 352; 例外の新スタイルクラス化: PEP 352 例外の新スタイルクラス化.
* PEP 353; 添え字型に ssize_t を使う: PEP 353 添え字型に ssize_t を使う.
* PEP 357; '__index__' メソッド: PEP 357 '__index__' メソッド.
* その他の言語変更: その他の言語変更<16>.
* 新たなモジュール、改良されたモジュール、削除されたモジュール::
* ビルドならびに C API の変更: ビルドならびに C API の変更<10>.
* Python 2.5 への移植: Python 2 5 への移植.
* 謝辞: 謝辞<3>.

PEP 343: "with" ステートメント

* コンテキストマネージャを書く: コンテキストマネージャを書く<2>.
* contextlib モジュール: contextlib モジュール<2>.

その他の言語変更

* 対話的なインタプリタの変更::
* 最適化: 最適化<16>.

新たなモジュール、改良されたモジュール、削除されたモジュール

* ctypes パッケージ::
* ElementTree パッケージ::
* hashlib パッケージ::
* sqlite3 パッケージ::
* wsgiref パッケージ::

ビルドならびに C API の変更

* ポート特有の変更::

What's New in Python 2.4

* PEP 218; ビルトインの集合オブジェクト: PEP 218 ビルトインの集合オブジェクト.
* PEP 237; 長整数と整数を一体化していく: PEP 237 長整数と整数を一体化していく.
* PEP 289; ジェネレータ式: PEP 289 ジェネレータ式.
* PEP 292; より単純な文字列置換 (string substitution): PEP 292 より単純な文字列置換 string substitution.
* PEP 318; 関数とメソッドのためのデコレータ: PEP 318 関数とメソッドのためのデコレータ.
* PEP 322; 逆順のイテレーション: PEP 322 逆順のイテレーション.
* PEP 324; 新しい subprocess モジュール: PEP 324 新しい subprocess モジュール.
* PEP 327; Decimal データ型: PEP 327 Decimal データ型.
* PEP 328; マルチラインインポート: PEP 328 マルチラインインポート.
* PEP 331; Locale に依存しない Float/String 変換: PEP 331 Locale に依存しない Float/String 変換.
* その他の言語変更: その他の言語変更<17>.
* 新たなモジュール、改良されたモジュール、非推奨のモジュール: 新たなモジュール、改良されたモジュール、非推奨のモジュール<3>.
* ビルドならびに C API の変更: ビルドならびに C API の変更<11>.
* Python 2.4 への移植: Python 2 4 への移植.
* 謝辞: 謝辞<4>.

PEP 327: Decimal データ型

* なぜ Decimal が必要なのか?::
* Decimal 型::
* Context 型::

その他の言語変更

* 最適化: 最適化<17>.

新たなモジュール、改良されたモジュール、非推奨のモジュール

* cookielib::
* doctest: doctest<5>.

ビルドならびに C API の変更

* ポート特有の変更: ポート特有の変更<2>.

What's New in Python 2.3

* PEP 218; 標準の集合データ型: PEP 218 標準の集合データ型.
* PEP 255; 単純なジェネレータ: PEP 255 単純なジェネレータ.
* PEP 263; ソースコードのエンコーディング: PEP 263 ソースコードのエンコーディング.
* PEP 273; Zip アーカイブからモジュールをインポートする: PEP 273 Zip アーカイブからモジュールをインポートする.
* PEP 277; Windows NT での Unicode ファイル名サポート: PEP 277 Windows NT での Unicode ファイル名サポート.
* PEP 278; Universal Newline サポート: PEP 278 Universal Newline サポート.
* PEP 279; enumerate(): PEP 279 enumerate.
* PEP 282; ロギングパッケージ: PEP 282 ロギングパッケージ.
* PEP 285; Boolean 型: PEP 285 Boolean 型.
* PEP 293; コーデックエラーを処理するコールバック: PEP 293 コーデックエラーを処理するコールバック.
* PEP 301; パッケージインデクスと、 Distutils のためのメタデータ: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ.
* PEP 302; 新たなインポートフック: PEP 302 新たなインポートフック.
* PEP 305; カンマ区切り形式ファイル: PEP 305 カンマ区切り形式ファイル.
* PEP 307; Pickle の機能拡張: PEP 307 Pickle の機能拡張.
* 拡張スライス::
* その他の言語変更: その他の言語変更<18>.
* 新たなモジュール、改良されたモジュール、非推奨のモジュール: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>.
* Pymalloc; 特殊化されたオブジェクトアロケータ: Pymalloc 特殊化されたオブジェクトアロケータ.
* ビルドならびに C API の変更: ビルドならびに C API の変更<12>.
* その他の変更と修正: その他の変更と修正<2>.
* Python 2.3 への移植: Python 2 3 への移植.
* 謝辞: 謝辞<5>.

その他の言語変更

* 文字列に関する変更::
* 最適化: 最適化<18>.

新たなモジュール、改良されたモジュール、非推奨のモジュール

* 日付時刻型::
* optparse モジュール::

ビルドならびに C API の変更

* ポート特有の変更: ポート特有の変更<3>.

What's New in Python 2.2

* はじめに::
* PEP 252 と PEP 253; 型とクラスについての変更: PEP 252 と PEP 253 型とクラスについての変更.
* PEP 234; イテレータ: PEP 234 イテレータ.
* PEP 255; 単純なジェネレータ: PEP 255 単純なジェネレータ<2>.
* PEP 237; 長整数と整数を一体化していく: PEP 237 長整数と整数を一体化していく<2>.
* PEP 238; 除算演算子を変更していく: PEP 238 除算演算子を変更していく.
* Unicode の変更::
* PEP 227; 入れ子状のスコープ: PEP 227 入れ子状のスコープ.
* 新しいモジュールと改良されたモジュール: 新しいモジュールと改良されたモジュール<3>.
* インタプリタの変更と修正::
* その他の変更と修正: その他の変更と修正<3>.
* 謝辞: 謝辞<6>.

PEP 252 と PEP 253: 型とクラスについての変更

* 旧と新クラス::
* デスクリプタ::
* 多重継承; ダイヤモンドルール: 多重継承 ダイヤモンドルール.
* 属性アクセス::
* 関連リンク::

What's New in Python 2.1

* はじめに: はじめに<2>.
* PEP 227; 入れ子状のスコープ: PEP 227 入れ子状のスコープ<2>.
* PEP 236; __future__ 指示文: PEP 236 __future__ 指示文.
* PEP 207; 拡張比較: PEP 207 拡張比較.
* PEP 230; 警告フレームワーク: PEP 230 警告フレームワーク.
* PEP 229; 新しいビルドシステム: PEP 229 新しいビルドシステム.
* PEP 205; 弱参照: PEP 205 弱参照.
* PEP 232; 関数の属性: PEP 232 関数の属性.
* PEP 235; 大文字小文字を区別しないプラットフォームでのモジュールの読み込み: PEP 235 大文字小文字を区別しないプラットフォームでのモジュールの読み込み.
* PEP 217; 対話モード用 Display Hook: PEP 217 対話モード用 Display Hook.
* PEP 208; 新しい型強制モデル: PEP 208 新しい型強制モデル.
* PEP 241; Pythonソフトウェアパッケージのためのメタデータ: PEP 241 Pythonソフトウェアパッケージのためのメタデータ.
* 新しいモジュールと改良されたモジュール: 新しいモジュールと改良されたモジュール<4>.
* その他の変更と修正: その他の変更と修正<4>.
* 謝辞: 謝辞<7>.

What's New in Python 2.0

* はじめに: はじめに<3>.
* Python 1.6 はいかがですか?: Python 1 6 はいかがですか?.
* 新しい開発プロセス::
* Unicode 文字列型: Unicode 文字列型<2>.
* リストの内包表記::
* 累算代入 (Augmented Assignment): 累算代入 Augmented Assignment.
* 文字列メソッド::
* 循環参照のガベージコレクション::
* その他の言語コアの変更::
* Python 2.0 への移植: Python 2 0 への移植.
* 拡張と埋め込みについての変更::
* Distutils; モジュールの簡単インストール: Distutils モジュールの簡単インストール.
* XML モジュール::
* 更新されたモジュール::
* 新しいモジュール: 新しいモジュール<2>.
* IDLE の改善::
* 削除されたモジュール、非推奨となったモジュール::
* 謝辞: 謝辞<8>.

その他の言語コアの変更

* 言語のマイナー変更::
* ビルトイン関数の変更::

XML モジュール

* SAX2 サポート::
* DOM サポート::
* PyXML との関係::

変更履歴

* Python next::
* Python 3.14.3 final: Python 3 14 3 final.
* Python 3.14.2 final: Python 3 14 2 final.
* Python 3.14.1 final: Python 3 14 1 final.
* Python 3.14.0 final: Python 3 14 0 final.
* Python 3.14.0 release candidate 3: Python 3 14 0 release candidate 3.
* Python 3.14.0 release candidate 2: Python 3 14 0 release candidate 2.
* Python 3.14.0 release candidate 1: Python 3 14 0 release candidate 1.
* Python 3.14.0 beta 4: Python 3 14 0 beta 4.
* Python 3.14.0 beta 3: Python 3 14 0 beta 3.
* Python 3.14.0 beta 2: Python 3 14 0 beta 2.
* Python 3.14.0 beta 1: Python 3 14 0 beta 1.
* Python 3.14.0 alpha 7: Python 3 14 0 alpha 7.
* Python 3.14.0 alpha 6: Python 3 14 0 alpha 6.
* Python 3.14.0 alpha 5: Python 3 14 0 alpha 5.
* Python 3.14.0 alpha 4: Python 3 14 0 alpha 4.
* Python 3.14.0 alpha 3: Python 3 14 0 alpha 3.
* Python 3.14.0 alpha 2: Python 3 14 0 alpha 2.
* Python 3.14.0 alpha 1: Python 3 14 0 alpha 1.
* Python 3.13.0 beta 1: Python 3 13 0 beta 1.
* Python 3.13.0 alpha 6: Python 3 13 0 alpha 6.
* Python 3.13.0 alpha 5: Python 3 13 0 alpha 5.
* Python 3.13.0 alpha 4: Python 3 13 0 alpha 4.
* Python 3.13.0 alpha 3: Python 3 13 0 alpha 3.
* Python 3.13.0 alpha 2: Python 3 13 0 alpha 2.
* Python 3.13.0 alpha 1: Python 3 13 0 alpha 1.
* Python 3.12.0 beta 1: Python 3 12 0 beta 1.
* Python 3.12.0 alpha 7: Python 3 12 0 alpha 7.
* Python 3.12.0 alpha 6: Python 3 12 0 alpha 6.
* Python 3.12.0 alpha 5: Python 3 12 0 alpha 5.
* Python 3.12.0 alpha 4: Python 3 12 0 alpha 4.
* Python 3.12.0 alpha 3: Python 3 12 0 alpha 3.
* Python 3.12.0 alpha 2: Python 3 12 0 alpha 2.
* Python 3.12.0 alpha 1: Python 3 12 0 alpha 1.
* Python 3.11.0 beta 1: Python 3 11 0 beta 1.
* Python 3.11.0 alpha 7: Python 3 11 0 alpha 7.
* Python 3.11.0 alpha 6: Python 3 11 0 alpha 6.
* Python 3.11.0 alpha 5: Python 3 11 0 alpha 5.
* Python 3.11.0 alpha 4: Python 3 11 0 alpha 4.
* Python 3.11.0 alpha 3: Python 3 11 0 alpha 3.
* Python 3.11.0 alpha 2: Python 3 11 0 alpha 2.
* Python 3.11.0 alpha 1: Python 3 11 0 alpha 1.
* Python 3.10.0 beta 1: Python 3 10 0 beta 1.
* Python 3.10.0 alpha 7: Python 3 10 0 alpha 7.
* Python 3.10.0 alpha 6: Python 3 10 0 alpha 6.
* Python 3.10.0 alpha 5: Python 3 10 0 alpha 5.
* Python 3.10.0 alpha 4: Python 3 10 0 alpha 4.
* Python 3.10.0 alpha 3: Python 3 10 0 alpha 3.
* Python 3.10.0 alpha 2: Python 3 10 0 alpha 2.
* Python 3.10.0 alpha 1: Python 3 10 0 alpha 1.
* Python 3.9.0 beta 1: Python 3 9 0 beta 1.
* Python 3.9.0 alpha 6: Python 3 9 0 alpha 6.
* Python 3.9.0 alpha 5: Python 3 9 0 alpha 5.
* Python 3.9.0 alpha 4: Python 3 9 0 alpha 4.
* Python 3.9.0 alpha 3: Python 3 9 0 alpha 3.
* Python 3.9.0 alpha 2: Python 3 9 0 alpha 2.
* Python 3.9.0 alpha 1: Python 3 9 0 alpha 1.
* Python 3.8.0 beta 1: Python 3 8 0 beta 1.
* Python 3.8.0 alpha 4: Python 3 8 0 alpha 4.
* Python 3.8.0 alpha 3: Python 3 8 0 alpha 3.
* Python 3.8.0 alpha 2: Python 3 8 0 alpha 2.
* Python 3.8.0 alpha 1: Python 3 8 0 alpha 1.
* Python 3.7.0 final: Python 3 7 0 final.
* Python 3.7.0 release candidate 1: Python 3 7 0 release candidate 1.
* Python 3.7.0 beta 5: Python 3 7 0 beta 5.
* Python 3.7.0 beta 4: Python 3 7 0 beta 4.
* Python 3.7.0 beta 3: Python 3 7 0 beta 3.
* Python 3.7.0 beta 2: Python 3 7 0 beta 2.
* Python 3.7.0 beta 1: Python 3 7 0 beta 1.
* Python 3.7.0 alpha 4: Python 3 7 0 alpha 4.
* Python 3.7.0 alpha 3: Python 3 7 0 alpha 3.
* Python 3.7.0 alpha 2: Python 3 7 0 alpha 2.
* Python 3.7.0 alpha 1: Python 3 7 0 alpha 1.
* Python 3.6.6 final: Python 3 6 6 final.
* Python 3.6.6 release candidate 1: Python 3 6 6 release candidate 1.
* Python 3.6.5 final: Python 3 6 5 final.
* Python 3.6.5 release candidate 1: Python 3 6 5 release candidate 1.
* Python 3.6.4 final: Python 3 6 4 final.
* Python 3.6.4 release candidate 1: Python 3 6 4 release candidate 1.
* Python 3.6.3 final: Python 3 6 3 final.
* Python 3.6.3 release candidate 1: Python 3 6 3 release candidate 1.
* Python 3.6.2 final: Python 3 6 2 final.
* Python 3.6.2 release candidate 2: Python 3 6 2 release candidate 2.
* Python 3.6.2 release candidate 1: Python 3 6 2 release candidate 1.
* Python 3.6.1 final: Python 3 6 1 final.
* Python 3.6.1 release candidate 1: Python 3 6 1 release candidate 1.
* Python 3.6.0 final: Python 3 6 0 final.
* Python 3.6.0 release candidate 2: Python 3 6 0 release candidate 2.
* Python 3.6.0 release candidate 1: Python 3 6 0 release candidate 1.
* Python 3.6.0 beta 4: Python 3 6 0 beta 4.
* Python 3.6.0 beta 3: Python 3 6 0 beta 3.
* Python 3.6.0 beta 2: Python 3 6 0 beta 2.
* Python 3.6.0 beta 1: Python 3 6 0 beta 1.
* Python 3.6.0 alpha 4: Python 3 6 0 alpha 4.
* Python 3.6.0 alpha 3: Python 3 6 0 alpha 3.
* Python 3.6.0 alpha 2: Python 3 6 0 alpha 2.
* Python 3.6.0 alpha 1: Python 3 6 0 alpha 1.
* Python 3.5.5 final: Python 3 5 5 final.
* Python 3.5.5 release candidate 1: Python 3 5 5 release candidate 1.
* Python 3.5.4 final: Python 3 5 4 final.
* Python 3.5.4 release candidate 1: Python 3 5 4 release candidate 1.
* Python 3.5.3 final: Python 3 5 3 final.
* Python 3.5.3 release candidate 1: Python 3 5 3 release candidate 1.
* Python 3.5.2 final: Python 3 5 2 final.
* Python 3.5.2 release candidate 1: Python 3 5 2 release candidate 1.
* Python 3.5.1 final: Python 3 5 1 final.
* Python 3.5.1 release candidate 1: Python 3 5 1 release candidate 1.
* Python 3.5.0 final: Python 3 5 0 final.
* Python 3.5.0 release candidate 4: Python 3 5 0 release candidate 4.
* Python 3.5.0 release candidate 3: Python 3 5 0 release candidate 3.
* Python 3.5.0 release candidate 2: Python 3 5 0 release candidate 2.
* Python 3.5.0 release candidate 1: Python 3 5 0 release candidate 1.
* Python 3.5.0 beta 4: Python 3 5 0 beta 4.
* Python 3.5.0 beta 3: Python 3 5 0 beta 3.
* Python 3.5.0 beta 2: Python 3 5 0 beta 2.
* Python 3.5.0 beta 1: Python 3 5 0 beta 1.
* Python 3.5.0 alpha 4: Python 3 5 0 alpha 4.
* Python 3.5.0 alpha 3: Python 3 5 0 alpha 3.
* Python 3.5.0 alpha 2: Python 3 5 0 alpha 2.
* Python 3.5.0 alpha 1: Python 3 5 0 alpha 1.

Python next

* macOS::
* Windows::
* ライブラリ::
* ドキュメント: ドキュメント<2>.
* Core and Builtins::

Python 3.14.3 final

* Windows: Windows<2>.
* Tools/Demos::
* テスト::
* セキュリティ::
* ライブラリ: ライブラリ<2>.
* IDLE: IDLE<3>.
* ドキュメント: ドキュメント<3>.
* Core and Builtins: Core and Builtins<2>.
* C API::
* ビルド::

Python 3.14.2 final

* セキュリティ: セキュリティ<2>.
* ライブラリ: ライブラリ<3>.
* Core and Builtins: Core and Builtins<3>.
* ライブラリ: ライブラリ<4>.

Python 3.14.1 final

* Windows: Windows<3>.
* Tools/Demos: Tools/Demos<2>.
* テスト: テスト<2>.
* セキュリティ: セキュリティ<3>.
* ライブラリ: ライブラリ<5>.
* IDLE: IDLE<4>.
* ドキュメント: ドキュメント<4>.
* Core and Builtins: Core and Builtins<4>.
* ライブラリ: ライブラリ<6>.
* Core and Builtins: Core and Builtins<5>.
* ライブラリ: ライブラリ<7>.
* Core and Builtins: Core and Builtins<6>.
* ライブラリ: ライブラリ<8>.
* Core and Builtins: Core and Builtins<7>.
* ライブラリ: ライブラリ<9>.
* Core and Builtins: Core and Builtins<8>.
* ライブラリ: ライブラリ<10>.
* Core and Builtins: Core and Builtins<9>.
* ライブラリ: ライブラリ<11>.
* Core and Builtins: Core and Builtins<10>.
* C API: C API<2>.
* ビルド: ビルド<2>.

Python 3.14.0 final

* macOS: macOS<2>.
* Windows: Windows<4>.
* Tools/Demos: Tools/Demos<3>.
* セキュリティ: セキュリティ<4>.
* ライブラリ: ライブラリ<12>.

Python 3.14.0 release candidate 3

* Windows: Windows<5>.
* Tools/Demos: Tools/Demos<4>.
* セキュリティ: セキュリティ<5>.
* ライブラリ: ライブラリ<13>.
* Core and Builtins: Core and Builtins<11>.

Python 3.14.0 release candidate 2

* macOS: macOS<3>.
* Windows: Windows<6>.
* ライブラリ: ライブラリ<14>.
* ドキュメント: ドキュメント<5>.
* Core and Builtins: Core and Builtins<12>.
* C API: C API<3>.
* ビルド: ビルド<3>.

Python 3.14.0 release candidate 1

* Tools/Demos: Tools/Demos<5>.
* セキュリティ: セキュリティ<6>.
* ライブラリ: ライブラリ<15>.
* Core and Builtins: Core and Builtins<13>.
* ライブラリ: ライブラリ<16>.
* Core and Builtins: Core and Builtins<14>.
* ライブラリ: ライブラリ<17>.
* Core and Builtins: Core and Builtins<15>.
* C API: C API<4>.
* ビルド: ビルド<4>.

Python 3.14.0 beta 4

* Tools/Demos: Tools/Demos<6>.
* テスト: テスト<3>.
* セキュリティ: セキュリティ<7>.
* ライブラリ: ライブラリ<18>.
* ドキュメント: ドキュメント<6>.
* Core and Builtins: Core and Builtins<16>.
* C API: C API<5>.
* ビルド: ビルド<5>.

Python 3.14.0 beta 3

* Windows: Windows<7>.
* テスト: テスト<4>.
* セキュリティ: セキュリティ<8>.
* ライブラリ: ライブラリ<19>.
* ドキュメント: ドキュメント<7>.
* Core and Builtins: Core and Builtins<17>.
* ライブラリ: ライブラリ<20>.
* Core and Builtins: Core and Builtins<18>.
* ライブラリ: ライブラリ<21>.
* Core and Builtins: Core and Builtins<19>.
* ライブラリ: ライブラリ<22>.
* Core and Builtins: Core and Builtins<20>.
* C API: C API<6>.
* ビルド: ビルド<6>.

Python 3.14.0 beta 2

* Windows: Windows<8>.
* Tools/Demos: Tools/Demos<7>.
* テスト: テスト<5>.
* セキュリティ: セキュリティ<9>.
* ライブラリ: ライブラリ<23>.
* Core and Builtins: Core and Builtins<21>.
* C API: C API<7>.
* ビルド: ビルド<7>.

Python 3.14.0 beta 1

* Windows: Windows<9>.
* Tools/Demos: Tools/Demos<8>.
* テスト: テスト<6>.
* セキュリティ: セキュリティ<10>.
* ライブラリ: ライブラリ<24>.
* IDLE: IDLE<5>.
* ドキュメント: ドキュメント<8>.
* Core and Builtins: Core and Builtins<22>.
* ライブラリ: ライブラリ<25>.
* Core and Builtins: Core and Builtins<23>.
* ライブラリ: ライブラリ<26>.
* Core and Builtins: Core and Builtins<24>.
* ライブラリ: ライブラリ<27>.
* C API: C API<8>.
* ビルド: ビルド<8>.

Python 3.14.0 alpha 7

* macOS: macOS<4>.
* Windows: Windows<10>.
* Tools/Demos: Tools/Demos<9>.
* テスト: テスト<7>.
* セキュリティ: セキュリティ<11>.
* ライブラリ: ライブラリ<28>.
* ドキュメント: ドキュメント<9>.
* Core and Builtins: Core and Builtins<25>.
* ライブラリ: ライブラリ<29>.
* Core and Builtins: Core and Builtins<26>.
* C API: C API<9>.
* ビルド: ビルド<9>.

Python 3.14.0 alpha 6

* macOS: macOS<5>.
* Windows: Windows<11>.
* Tools/Demos: Tools/Demos<10>.
* テスト: テスト<8>.
* セキュリティ: セキュリティ<12>.
* ライブラリ: ライブラリ<30>.
* ドキュメント: ドキュメント<10>.
* Core and Builtins: Core and Builtins<27>.
* ライブラリ: ライブラリ<31>.
* Core and Builtins: Core and Builtins<28>.
* ライブラリ: ライブラリ<32>.
* Core and Builtins: Core and Builtins<29>.
* C API: C API<10>.
* ビルド: ビルド<10>.

Python 3.14.0 alpha 5

* macOS: macOS<6>.
* Tools/Demos: Tools/Demos<11>.
* テスト: テスト<9>.
* セキュリティ: セキュリティ<13>.
* ライブラリ: ライブラリ<33>.
* IDLE: IDLE<6>.
* ドキュメント: ドキュメント<11>.
* Core and Builtins: Core and Builtins<30>.
* ライブラリ: ライブラリ<34>.
* Core and Builtins: Core and Builtins<31>.
* ライブラリ: ライブラリ<35>.
* Core and Builtins: Core and Builtins<32>.
* ライブラリ: ライブラリ<36>.
* C API: C API<11>.
* ビルド: ビルド<11>.

Python 3.14.0 alpha 4

* macOS: macOS<7>.
* Tools/Demos: Tools/Demos<12>.
* テスト: テスト<10>.
* ライブラリ: ライブラリ<37>.
* Core and Builtins: Core and Builtins<33>.
* ライブラリ: ライブラリ<38>.
* Core and Builtins: Core and Builtins<34>.
* ライブラリ: ライブラリ<39>.
* Core and Builtins: Core and Builtins<35>.
* C API: C API<12>.
* ビルド: ビルド<12>.

Python 3.14.0 alpha 3

* Windows: Windows<12>.
* Tools/Demos: Tools/Demos<13>.
* テスト: テスト<11>.
* セキュリティ: セキュリティ<14>.
* ライブラリ: ライブラリ<40>.
* ドキュメント: ドキュメント<12>.
* Core and Builtins: Core and Builtins<36>.
* ライブラリ: ライブラリ<41>.
* Core and Builtins: Core and Builtins<37>.
* C API: C API<13>.
* ビルド: ビルド<13>.

Python 3.14.0 alpha 2

* Windows: Windows<13>.
* Tools/Demos: Tools/Demos<14>.
* テスト: テスト<12>.
* セキュリティ: セキュリティ<15>.
* ライブラリ: ライブラリ<42>.
* ドキュメント: ドキュメント<13>.
* Core and Builtins: Core and Builtins<38>.
* ライブラリ: ライブラリ<43>.
* Core and Builtins: Core and Builtins<39>.
* ライブラリ: ライブラリ<44>.
* Core and Builtins: Core and Builtins<40>.
* ライブラリ: ライブラリ<45>.
* C API: C API<14>.
* ビルド: ビルド<14>.

Python 3.14.0 alpha 1

* macOS: macOS<8>.
* Windows: Windows<14>.
* Tools/Demos: Tools/Demos<15>.
* テスト: テスト<13>.
* セキュリティ: セキュリティ<16>.
* ライブラリ: ライブラリ<46>.
* IDLE: IDLE<7>.
* ドキュメント: ドキュメント<14>.
* Core and Builtins: Core and Builtins<41>.
* ライブラリ: ライブラリ<47>.
* Core and Builtins: Core and Builtins<42>.
* ライブラリ: ライブラリ<48>.
* Core and Builtins: Core and Builtins<43>.
* ライブラリ: ライブラリ<49>.
* Core and Builtins: Core and Builtins<44>.
* ライブラリ: ライブラリ<50>.
* Core and Builtins: Core and Builtins<45>.
* ライブラリ: ライブラリ<51>.
* Core and Builtins: Core and Builtins<46>.
* ライブラリ: ライブラリ<52>.
* Core and Builtins: Core and Builtins<47>.
* ライブラリ: ライブラリ<53>.
* Core and Builtins: Core and Builtins<48>.
* C API: C API<15>.
* ビルド: ビルド<15>.

Python 3.13.0 beta 1

* セキュリティ: セキュリティ<17>.
* Core and Builtins: Core and Builtins<49>.
* ライブラリ: ライブラリ<54>.
* Core and Builtins: Core and Builtins<50>.
* ライブラリ: ライブラリ<55>.
* ドキュメント: ドキュメント<15>.
* ビルド: ビルド<16>.
* Windows: Windows<15>.
* macOS: macOS<9>.
* IDLE: IDLE<8>.
* C API: C API<16>.

Python 3.13.0 alpha 6

* Core and Builtins: Core and Builtins<51>.
* ライブラリ: ライブラリ<56>.
* Core and Builtins: Core and Builtins<52>.
* ライブラリ: ライブラリ<57>.
* ドキュメント: ドキュメント<16>.
* テスト: テスト<14>.
* ビルド: ビルド<17>.
* Windows: Windows<16>.
* C API: C API<17>.

Python 3.13.0 alpha 5

* セキュリティ: セキュリティ<18>.
* Core and Builtins: Core and Builtins<53>.
* ライブラリ: ライブラリ<58>.
* Core and Builtins: Core and Builtins<54>.
* ライブラリ: ライブラリ<59>.
* Core and Builtins: Core and Builtins<55>.
* ライブラリ: ライブラリ<60>.
* ドキュメント: ドキュメント<17>.
* テスト: テスト<15>.
* ビルド: ビルド<18>.
* Windows: Windows<17>.
* macOS: macOS<10>.
* IDLE: IDLE<9>.
* Tools/Demos: Tools/Demos<16>.
* C API: C API<18>.

Python 3.13.0 alpha 4

* セキュリティ: セキュリティ<19>.
* Core and Builtins: Core and Builtins<56>.
* ライブラリ: ライブラリ<61>.
* ドキュメント: ドキュメント<18>.
* テスト: テスト<16>.
* ビルド: ビルド<19>.
* Windows: Windows<18>.
* macOS: macOS<11>.
* IDLE: IDLE<10>.
* Tools/Demos: Tools/Demos<17>.
* C API: C API<19>.

Python 3.13.0 alpha 3

* セキュリティ: セキュリティ<20>.
* Core and Builtins: Core and Builtins<57>.
* ライブラリ: ライブラリ<62>.
* ドキュメント: ドキュメント<19>.
* テスト: テスト<17>.
* ビルド: ビルド<20>.
* Windows: Windows<19>.
* macOS: macOS<12>.
* IDLE: IDLE<11>.
* C API: C API<20>.

Python 3.13.0 alpha 2

* Core and Builtins: Core and Builtins<58>.
* ライブラリ: ライブラリ<63>.
* テスト: テスト<18>.
* ビルド: ビルド<21>.
* Windows: Windows<20>.
* macOS: macOS<13>.
* IDLE: IDLE<12>.
* Tools/Demos: Tools/Demos<18>.
* C API: C API<21>.

Python 3.13.0 alpha 1

* セキュリティ: セキュリティ<21>.
* Core and Builtins: Core and Builtins<59>.
* ライブラリ: ライブラリ<64>.
* ドキュメント: ドキュメント<20>.
* テスト: テスト<19>.
* ビルド: ビルド<22>.
* Windows: Windows<21>.
* macOS: macOS<14>.
* IDLE: IDLE<13>.
* Tools/Demos: Tools/Demos<19>.
* C API: C API<22>.

Python 3.12.0 beta 1

* セキュリティ: セキュリティ<22>.
* ライブラリ: ライブラリ<65>.
* Core and Builtins: Core and Builtins<60>.
* ライブラリ: ライブラリ<66>.
* Core and Builtins: Core and Builtins<61>.
* ライブラリ: ライブラリ<67>.
* ドキュメント: ドキュメント<21>.
* テスト: テスト<20>.
* ビルド: ビルド<23>.
* Windows: Windows<22>.
* macOS: macOS<15>.
* IDLE: IDLE<14>.
* Tools/Demos: Tools/Demos<20>.
* C API: C API<23>.

Python 3.12.0 alpha 7

* Core and Builtins: Core and Builtins<62>.
* ライブラリ: ライブラリ<68>.
* Core and Builtins: Core and Builtins<63>.
* ビルド: ビルド<24>.
* Core and Builtins: Core and Builtins<64>.
* ライブラリ: ライブラリ<69>.
* ドキュメント: ドキュメント<22>.
* テスト: テスト<21>.
* ビルド: ビルド<25>.
* Windows: Windows<23>.
* Tools/Demos: Tools/Demos<21>.
* C API: C API<24>.

Python 3.12.0 alpha 6

* セキュリティ: セキュリティ<23>.
* Core and Builtins: Core and Builtins<65>.
* ライブラリ: ライブラリ<70>.
* ドキュメント: ドキュメント<23>.
* テスト: テスト<22>.
* ビルド: ビルド<26>.
* Windows: Windows<24>.
* macOS: macOS<16>.
* C API: C API<25>.

Python 3.12.0 alpha 5

* セキュリティ: セキュリティ<24>.
* Core and Builtins: Core and Builtins<66>.
* ライブラリ: ライブラリ<71>.
* ドキュメント: ドキュメント<24>.
* テスト: テスト<23>.
* ビルド: ビルド<27>.
* Windows: Windows<25>.

Python 3.12.0 alpha 4

* Core and Builtins: Core and Builtins<67>.
* ライブラリ: ライブラリ<72>.
* Core and Builtins: Core and Builtins<68>.
* ライブラリ: ライブラリ<73>.
* Core and Builtins: Core and Builtins<69>.
* ライブラリ: ライブラリ<74>.
* ドキュメント: ドキュメント<25>.
* テスト: テスト<24>.
* ビルド: ビルド<28>.
* Windows: Windows<26>.
* macOS: macOS<17>.
* Tools/Demos: Tools/Demos<22>.
* C API: C API<26>.

Python 3.12.0 alpha 3

* セキュリティ: セキュリティ<25>.
* Core and Builtins: Core and Builtins<70>.
* ライブラリ: ライブラリ<75>.
* Core and Builtins: Core and Builtins<71>.
* ライブラリ: ライブラリ<76>.
* ドキュメント: ドキュメント<26>.
* テスト: テスト<25>.
* ビルド: ビルド<29>.
* Windows: Windows<27>.
* macOS: macOS<18>.
* Tools/Demos: Tools/Demos<23>.
* C API: C API<27>.

Python 3.12.0 alpha 2

* セキュリティ: セキュリティ<26>.
* Core and Builtins: Core and Builtins<72>.
* ビルド: ビルド<30>.
* Core and Builtins: Core and Builtins<73>.
* ライブラリ: ライブラリ<77>.
* ドキュメント: ドキュメント<27>.
* テスト: テスト<26>.
* ビルド: ビルド<31>.
* Windows: Windows<28>.
* macOS: macOS<19>.
* C API: C API<28>.

Python 3.12.0 alpha 1

* セキュリティ: セキュリティ<27>.
* Core and Builtins: Core and Builtins<74>.
* ライブラリ: ライブラリ<78>.
* Core and Builtins: Core and Builtins<75>.
* ライブラリ: ライブラリ<79>.
* Core and Builtins: Core and Builtins<76>.
* ライブラリ: ライブラリ<80>.
* Core and Builtins: Core and Builtins<77>.
* ライブラリ: ライブラリ<81>.
* Core and Builtins: Core and Builtins<78>.
* ライブラリ: ライブラリ<82>.
* Core and Builtins: Core and Builtins<79>.
* ライブラリ: ライブラリ<83>.
* Core and Builtins: Core and Builtins<80>.
* ライブラリ: ライブラリ<84>.
* Core and Builtins: Core and Builtins<81>.
* ライブラリ: ライブラリ<85>.
* Core and Builtins: Core and Builtins<82>.
* ライブラリ: ライブラリ<86>.
* Core and Builtins: Core and Builtins<83>.
* ライブラリ: ライブラリ<87>.
* ドキュメント: ドキュメント<28>.
* テスト: テスト<27>.
* ビルド: ビルド<32>.
* Windows: Windows<29>.
* macOS: macOS<20>.
* IDLE: IDLE<15>.
* Tools/Demos: Tools/Demos<24>.
* C API: C API<29>.

Python 3.11.0 beta 1

* セキュリティ: セキュリティ<28>.
* Core and Builtins: Core and Builtins<84>.
* ライブラリ: ライブラリ<88>.
* Core and Builtins: Core and Builtins<85>.
* ビルド: ビルド<33>.
* Core and Builtins: Core and Builtins<86>.
* ライブラリ: ライブラリ<89>.
* ドキュメント: ドキュメント<29>.
* テスト: テスト<28>.
* ビルド: ビルド<34>.
* Windows: Windows<30>.
* macOS: macOS<21>.
* Tools/Demos: Tools/Demos<25>.
* C API: C API<30>.

Python 3.11.0 alpha 7

* Core and Builtins: Core and Builtins<87>.
* ライブラリ: ライブラリ<90>.
* Core and Builtins: Core and Builtins<88>.
* ライブラリ: ライブラリ<91>.
* Core and Builtins: Core and Builtins<89>.
* ライブラリ: ライブラリ<92>.
* ドキュメント: ドキュメント<30>.
* テスト: テスト<29>.
* ビルド: ビルド<35>.
* Windows: Windows<31>.
* macOS: macOS<22>.
* Tools/Demos: Tools/Demos<26>.
* C API: C API<31>.

Python 3.11.0 alpha 6

* Core and Builtins: Core and Builtins<90>.
* ライブラリ: ライブラリ<93>.
* Core and Builtins: Core and Builtins<91>.
* ライブラリ: ライブラリ<94>.
* Core and Builtins: Core and Builtins<92>.
* ライブラリ: ライブラリ<95>.
* Core and Builtins: Core and Builtins<93>.
* ライブラリ: ライブラリ<96>.
* ドキュメント: ドキュメント<31>.
* テスト: テスト<30>.
* ビルド: ビルド<36>.
* Windows: Windows<32>.
* IDLE: IDLE<16>.
* C API: C API<32>.

Python 3.11.0 alpha 5

* Core and Builtins: Core and Builtins<94>.
* ライブラリ: ライブラリ<97>.
* Core and Builtins: Core and Builtins<95>.
* ライブラリ: ライブラリ<98>.
* ビルド: ビルド<37>.
* Core and Builtins: Core and Builtins<96>.
* ライブラリ: ライブラリ<99>.
* ドキュメント: ドキュメント<32>.
* テスト: テスト<31>.
* ビルド: ビルド<38>.
* Windows: Windows<33>.
* macOS: macOS<23>.
* IDLE: IDLE<17>.
* C API: C API<33>.

Python 3.11.0 alpha 4

* Core and Builtins: Core and Builtins<97>.
* ライブラリ: ライブラリ<100>.
* Core and Builtins: Core and Builtins<98>.
* ライブラリ: ライブラリ<101>.
* Core and Builtins: Core and Builtins<99>.
* ライブラリ: ライブラリ<102>.
* Core and Builtins: Core and Builtins<100>.
* ライブラリ: ライブラリ<103>.
* ドキュメント: ドキュメント<33>.
* テスト: テスト<32>.
* ビルド: ビルド<39>.
* Windows: Windows<34>.
* macOS: macOS<24>.
* C API: C API<34>.

Python 3.11.0 alpha 3

* Core and Builtins: Core and Builtins<101>.
* ライブラリ: ライブラリ<104>.
* Core and Builtins: Core and Builtins<102>.
* ライブラリ: ライブラリ<105>.
* ドキュメント: ドキュメント<34>.
* テスト: テスト<33>.
* ビルド: ビルド<40>.
* Windows: Windows<35>.
* macOS: macOS<25>.
* C API: C API<35>.

Python 3.11.0 alpha 2

* Core and Builtins: Core and Builtins<103>.
* ライブラリ: ライブラリ<106>.
* ドキュメント: ドキュメント<35>.
* テスト: テスト<34>.
* ビルド: ビルド<41>.
* Windows: Windows<36>.
* macOS: macOS<26>.
* IDLE: IDLE<18>.
* C API: C API<36>.

Python 3.11.0 alpha 1

* セキュリティ: セキュリティ<29>.
* Core and Builtins: Core and Builtins<104>.
* ライブラリ: ライブラリ<107>.
* Core and Builtins: Core and Builtins<105>.
* ライブラリ: ライブラリ<108>.
* Core and Builtins: Core and Builtins<106>.
* ライブラリ: ライブラリ<109>.
* Core and Builtins: Core and Builtins<107>.
* ライブラリ: ライブラリ<110>.
* Core and Builtins: Core and Builtins<108>.
* ライブラリ: ライブラリ<111>.
* Core and Builtins: Core and Builtins<109>.
* ライブラリ: ライブラリ<112>.
* Core and Builtins: Core and Builtins<110>.
* ライブラリ: ライブラリ<113>.
* Core and Builtins: Core and Builtins<111>.
* ライブラリ: ライブラリ<114>.
* Core and Builtins: Core and Builtins<112>.
* ライブラリ: ライブラリ<115>.
* Core and Builtins: Core and Builtins<113>.
* ライブラリ: ライブラリ<116>.
* ドキュメント: ドキュメント<36>.
* テスト: テスト<35>.
* ビルド: ビルド<42>.
* Windows: Windows<37>.
* macOS: macOS<27>.
* IDLE: IDLE<19>.
* Tools/Demos: Tools/Demos<27>.
* C API: C API<37>.

Python 3.10.0 beta 1

* セキュリティ: セキュリティ<30>.
* Core and Builtins: Core and Builtins<114>.
* ライブラリ: ライブラリ<117>.
* Core and Builtins: Core and Builtins<115>.
* ライブラリ: ライブラリ<118>.
* Core and Builtins: Core and Builtins<116>.
* ライブラリ: ライブラリ<119>.
* ドキュメント: ドキュメント<37>.
* テスト: テスト<36>.
* ビルド: ビルド<43>.
* Windows: Windows<38>.
* macOS: macOS<28>.
* IDLE: IDLE<20>.
* C API: C API<38>.

Python 3.10.0 alpha 7

* セキュリティ: セキュリティ<31>.
* Core and Builtins: Core and Builtins<117>.
* ライブラリ: ライブラリ<120>.
* Core and Builtins: Core and Builtins<118>.
* ライブラリ: ライブラリ<121>.
* ドキュメント: ドキュメント<38>.
* テスト: テスト<37>.
* ビルド: ビルド<44>.
* Windows: Windows<39>.
* IDLE: IDLE<21>.
* C API: C API<39>.

Python 3.10.0 alpha 6

* セキュリティ: セキュリティ<32>.
* Core and Builtins: Core and Builtins<119>.
* ライブラリ: ライブラリ<122>.
* Core and Builtins: Core and Builtins<120>.
* ライブラリ: ライブラリ<123>.
* Core and Builtins: Core and Builtins<121>.
* ライブラリ: ライブラリ<124>.
* ドキュメント: ドキュメント<39>.
* テスト: テスト<38>.
* ビルド: ビルド<45>.
* Windows: Windows<40>.
* macOS: macOS<29>.
* IDLE: IDLE<22>.
* C API: C API<40>.

Python 3.10.0 alpha 5

* セキュリティ: セキュリティ<33>.
* Core and Builtins: Core and Builtins<122>.
* ライブラリ: ライブラリ<125>.
* Core and Builtins: Core and Builtins<123>.
* ライブラリ: ライブラリ<126>.
* ドキュメント: ドキュメント<40>.
* テスト: テスト<39>.
* ビルド: ビルド<46>.
* Windows: Windows<41>.
* macOS: macOS<30>.
* IDLE: IDLE<23>.
* C API: C API<41>.

Python 3.10.0 alpha 4

* Core and Builtins: Core and Builtins<124>.
* ライブラリ: ライブラリ<127>.
* Core and Builtins: Core and Builtins<125>.
* ライブラリ: ライブラリ<128>.
* Core and Builtins: Core and Builtins<126>.
* ライブラリ: ライブラリ<129>.
* ドキュメント: ドキュメント<41>.
* テスト: テスト<40>.
* ビルド: ビルド<47>.
* macOS: macOS<31>.
* Tools/Demos: Tools/Demos<28>.
* C API: C API<42>.

Python 3.10.0 alpha 3

* セキュリティ: セキュリティ<34>.
* Core and Builtins: Core and Builtins<127>.
* ライブラリ: ライブラリ<130>.
* Core and Builtins: Core and Builtins<128>.
* ライブラリ: ライブラリ<131>.
* Core and Builtins: Core and Builtins<129>.
* ライブラリ: ライブラリ<132>.
* Core and Builtins: Core and Builtins<130>.
* ライブラリ: ライブラリ<133>.
* ドキュメント: ドキュメント<42>.
* テスト: テスト<41>.
* ビルド: ビルド<48>.
* Windows: Windows<42>.
* macOS: macOS<32>.
* IDLE: IDLE<24>.
* Tools/Demos: Tools/Demos<29>.
* C API: C API<43>.

Python 3.10.0 alpha 2

* セキュリティ: セキュリティ<35>.
* Core and Builtins: Core and Builtins<131>.
* ライブラリ: ライブラリ<134>.
* Core and Builtins: Core and Builtins<132>.
* ライブラリ: ライブラリ<135>.
* ドキュメント: ドキュメント<43>.
* テスト: テスト<42>.
* ビルド: ビルド<49>.
* Windows: Windows<43>.
* macOS: macOS<33>.
* IDLE: IDLE<25>.
* C API: C API<44>.

Python 3.10.0 alpha 1

* セキュリティ: セキュリティ<36>.
* Core and Builtins: Core and Builtins<133>.
* ライブラリ: ライブラリ<136>.
* Core and Builtins: Core and Builtins<134>.
* ライブラリ: ライブラリ<137>.
* Core and Builtins: Core and Builtins<135>.
* ライブラリ: ライブラリ<138>.
* Core and Builtins: Core and Builtins<136>.
* ライブラリ: ライブラリ<139>.
* Core and Builtins: Core and Builtins<137>.
* ライブラリ: ライブラリ<140>.
* Core and Builtins: Core and Builtins<138>.
* ライブラリ: ライブラリ<141>.
* Core and Builtins: Core and Builtins<139>.
* ライブラリ: ライブラリ<142>.
* Core and Builtins: Core and Builtins<140>.
* ライブラリ: ライブラリ<143>.
* Core and Builtins: Core and Builtins<141>.
* ライブラリ: ライブラリ<144>.
* Core and Builtins: Core and Builtins<142>.
* ライブラリ: ライブラリ<145>.
* Core and Builtins: Core and Builtins<143>.
* ライブラリ: ライブラリ<146>.
* Core and Builtins: Core and Builtins<144>.
* ライブラリ: ライブラリ<147>.
* Core and Builtins: Core and Builtins<145>.
* ライブラリ: ライブラリ<148>.
* Core and Builtins: Core and Builtins<146>.
* ライブラリ: ライブラリ<149>.
* Core and Builtins: Core and Builtins<147>.
* ライブラリ: ライブラリ<150>.
* ドキュメント: ドキュメント<44>.
* テスト: テスト<43>.
* ビルド: ビルド<50>.
* Windows: Windows<44>.
* macOS: macOS<34>.
* IDLE: IDLE<26>.
* C API: C API<45>.

Python 3.9.0 beta 1

* セキュリティ: セキュリティ<37>.
* Core and Builtins: Core and Builtins<148>.
* ライブラリ: ライブラリ<151>.
* ドキュメント: ドキュメント<45>.
* テスト: テスト<44>.
* ビルド: ビルド<51>.
* Windows: Windows<45>.
* macOS: macOS<35>.
* Tools/Demos: Tools/Demos<30>.
* C API: C API<46>.

Python 3.9.0 alpha 6

* セキュリティ: セキュリティ<38>.
* Core and Builtins: Core and Builtins<149>.
* ライブラリ: ライブラリ<152>.
* ドキュメント: ドキュメント<46>.
* テスト: テスト<45>.
* ビルド: ビルド<52>.
* Windows: Windows<46>.
* macOS: macOS<36>.
* IDLE: IDLE<27>.
* Tools/Demos: Tools/Demos<31>.
* C API: C API<47>.

Python 3.9.0 alpha 5

* セキュリティ: セキュリティ<39>.
* Core and Builtins: Core and Builtins<150>.
* ライブラリ: ライブラリ<153>.
* ドキュメント: ドキュメント<47>.
* テスト: テスト<46>.
* ビルド: ビルド<53>.
* Windows: Windows<47>.
* macOS: macOS<37>.
* IDLE: IDLE<28>.
* Tools/Demos: Tools/Demos<32>.
* C API: C API<48>.

Python 3.9.0 alpha 4

* セキュリティ: セキュリティ<40>.
* Core and Builtins: Core and Builtins<151>.
* ライブラリ: ライブラリ<154>.
* ドキュメント: ドキュメント<48>.
* テスト: テスト<47>.
* ビルド: ビルド<54>.
* Windows: Windows<48>.
* IDLE: IDLE<29>.
* C API: C API<49>.

Python 3.9.0 alpha 3

* Core and Builtins: Core and Builtins<152>.
* ライブラリ: ライブラリ<155>.
* ドキュメント: ドキュメント<49>.
* ビルド: ビルド<55>.
* IDLE: IDLE<30>.
* C API: C API<50>.

Python 3.9.0 alpha 2

* セキュリティ: セキュリティ<41>.
* Core and Builtins: Core and Builtins<153>.
* ライブラリ: ライブラリ<156>.
* ドキュメント: ドキュメント<50>.
* テスト: テスト<48>.
* ビルド: ビルド<56>.
* Windows: Windows<49>.
* macOS: macOS<38>.
* IDLE: IDLE<31>.
* C API: C API<51>.

Python 3.9.0 alpha 1

* セキュリティ: セキュリティ<42>.
* Core and Builtins: Core and Builtins<154>.
* ライブラリ: ライブラリ<157>.
* ドキュメント: ドキュメント<51>.
* テスト: テスト<49>.
* ビルド: ビルド<57>.
* Windows: Windows<50>.
* macOS: macOS<39>.
* IDLE: IDLE<32>.
* Tools/Demos: Tools/Demos<33>.
* C API: C API<52>.

Python 3.8.0 beta 1

* セキュリティ: セキュリティ<43>.
* Core and Builtins: Core and Builtins<155>.
* ライブラリ: ライブラリ<158>.
* ドキュメント: ドキュメント<52>.
* テスト: テスト<50>.
* ビルド: ビルド<58>.
* Windows: Windows<51>.
* macOS: macOS<40>.
* IDLE: IDLE<33>.
* Tools/Demos: Tools/Demos<34>.
* C API: C API<53>.

Python 3.8.0 alpha 4

* セキュリティ: セキュリティ<44>.
* Core and Builtins: Core and Builtins<156>.
* ライブラリ: ライブラリ<159>.
* ドキュメント: ドキュメント<53>.
* テスト: テスト<51>.
* ビルド: ビルド<59>.
* Windows: Windows<52>.
* macOS: macOS<41>.
* IDLE: IDLE<34>.
* Tools/Demos: Tools/Demos<35>.
* C API: C API<54>.

Python 3.8.0 alpha 3

* セキュリティ: セキュリティ<45>.
* Core and Builtins: Core and Builtins<157>.
* ライブラリ: ライブラリ<160>.
* ドキュメント: ドキュメント<54>.
* テスト: テスト<52>.
* ビルド: ビルド<60>.
* Windows: Windows<53>.
* IDLE: IDLE<35>.
* Tools/Demos: Tools/Demos<36>.
* C API: C API<55>.

Python 3.8.0 alpha 2

* Core and Builtins: Core and Builtins<158>.
* ライブラリ: ライブラリ<161>.
* ドキュメント: ドキュメント<55>.
* テスト: テスト<53>.
* Windows: Windows<54>.
* IDLE: IDLE<36>.

Python 3.8.0 alpha 1

* セキュリティ: セキュリティ<46>.
* Core and Builtins: Core and Builtins<159>.
* ライブラリ: ライブラリ<162>.
* ドキュメント: ドキュメント<56>.
* テスト: テスト<54>.
* ビルド: ビルド<61>.
* Windows: Windows<55>.
* macOS: macOS<42>.
* IDLE: IDLE<37>.
* Tools/Demos: Tools/Demos<37>.
* C API: C API<56>.

Python 3.7.0 final

* ライブラリ: ライブラリ<163>.
* C API: C API<57>.

Python 3.7.0 release candidate 1

* Core and Builtins: Core and Builtins<160>.
* ライブラリ: ライブラリ<164>.
* ドキュメント: ドキュメント<57>.
* ビルド: ビルド<62>.
* Windows: Windows<56>.
* IDLE: IDLE<38>.

Python 3.7.0 beta 5

* Core and Builtins: Core and Builtins<161>.
* ライブラリ: ライブラリ<165>.
* ドキュメント: ドキュメント<58>.
* テスト: テスト<55>.
* ビルド: ビルド<63>.
* macOS: macOS<43>.
* IDLE: IDLE<39>.

Python 3.7.0 beta 4

* Core and Builtins: Core and Builtins<162>.
* ライブラリ: ライブラリ<166>.
* ドキュメント: ドキュメント<59>.
* テスト: テスト<56>.
* ビルド: ビルド<64>.
* Windows: Windows<57>.
* macOS: macOS<44>.
* IDLE: IDLE<40>.
* Tools/Demos: Tools/Demos<38>.

Python 3.7.0 beta 3

* セキュリティ: セキュリティ<47>.
* Core and Builtins: Core and Builtins<163>.
* ライブラリ: ライブラリ<167>.
* ドキュメント: ドキュメント<60>.
* テスト: テスト<57>.
* ビルド: ビルド<65>.
* Windows: Windows<58>.
* macOS: macOS<45>.
* IDLE: IDLE<41>.
* Tools/Demos: Tools/Demos<39>.
* C API: C API<58>.

Python 3.7.0 beta 2

* セキュリティ: セキュリティ<48>.
* Core and Builtins: Core and Builtins<164>.
* ライブラリ: ライブラリ<168>.
* ドキュメント: ドキュメント<61>.
* テスト: テスト<58>.
* ビルド: ビルド<66>.
* Windows: Windows<59>.
* macOS: macOS<46>.
* IDLE: IDLE<42>.
* Tools/Demos: Tools/Demos<40>.

Python 3.7.0 beta 1

* Core and Builtins: Core and Builtins<165>.
* ライブラリ: ライブラリ<169>.
* ドキュメント: ドキュメント<62>.
* テスト: テスト<59>.
* ビルド: ビルド<67>.
* Windows: Windows<60>.
* macOS: macOS<47>.
* C API: C API<59>.

Python 3.7.0 alpha 4

* Core and Builtins: Core and Builtins<166>.
* ライブラリ: ライブラリ<170>.
* ドキュメント: ドキュメント<63>.
* テスト: テスト<60>.
* Windows: Windows<61>.
* Tools/Demos: Tools/Demos<41>.
* C API: C API<60>.

Python 3.7.0 alpha 3

* Core and Builtins: Core and Builtins<167>.
* ライブラリ: ライブラリ<171>.
* ドキュメント: ドキュメント<64>.
* テスト: テスト<61>.
* ビルド: ビルド<68>.
* Windows: Windows<62>.
* macOS: macOS<48>.
* IDLE: IDLE<43>.
* Tools/Demos: Tools/Demos<42>.
* C API: C API<61>.

Python 3.7.0 alpha 2

* Core and Builtins: Core and Builtins<168>.
* ライブラリ: ライブラリ<172>.
* ドキュメント: ドキュメント<65>.
* ビルド: ビルド<69>.
* IDLE: IDLE<44>.
* C API: C API<62>.

Python 3.7.0 alpha 1

* セキュリティ: セキュリティ<49>.
* Core and Builtins: Core and Builtins<169>.
* ライブラリ: ライブラリ<173>.
* ドキュメント: ドキュメント<66>.
* テスト: テスト<62>.
* ビルド: ビルド<70>.
* Windows: Windows<63>.
* IDLE: IDLE<45>.
* Tools/Demos: Tools/Demos<43>.
* C API: C API<63>.

Python 3.6.6 release candidate 1

* Core and Builtins: Core and Builtins<170>.
* ライブラリ: ライブラリ<174>.
* ドキュメント: ドキュメント<67>.
* テスト: テスト<63>.
* ビルド: ビルド<71>.
* Windows: Windows<64>.
* macOS: macOS<49>.
* IDLE: IDLE<46>.
* Tools/Demos: Tools/Demos<44>.
* C API: C API<64>.

Python 3.6.5 final

* テスト: テスト<64>.
* ビルド: ビルド<72>.

Python 3.6.5 release candidate 1

* セキュリティ: セキュリティ<50>.
* Core and Builtins: Core and Builtins<171>.
* ライブラリ: ライブラリ<175>.
* ドキュメント: ドキュメント<68>.
* テスト: テスト<65>.
* ビルド: ビルド<73>.
* Windows: Windows<65>.
* macOS: macOS<50>.
* IDLE: IDLE<47>.
* Tools/Demos: Tools/Demos<45>.
* C API: C API<65>.

Python 3.6.4 release candidate 1

* Core and Builtins: Core and Builtins<172>.
* ライブラリ: ライブラリ<176>.
* ドキュメント: ドキュメント<69>.
* テスト: テスト<66>.
* ビルド: ビルド<74>.
* Windows: Windows<66>.
* macOS: macOS<51>.
* IDLE: IDLE<48>.
* Tools/Demos: Tools/Demos<46>.
* C API: C API<66>.

Python 3.6.3 final

* ライブラリ: ライブラリ<177>.
* ビルド: ビルド<75>.

Python 3.6.3 release candidate 1

* セキュリティ: セキュリティ<51>.
* Core and Builtins: Core and Builtins<173>.
* ライブラリ: ライブラリ<178>.
* ドキュメント: ドキュメント<70>.
* テスト: テスト<67>.
* ビルド: ビルド<76>.
* Windows: Windows<67>.
* IDLE: IDLE<49>.
* Tools/Demos: Tools/Demos<47>.

Python 3.6.2 release candidate 2

* セキュリティ: セキュリティ<52>.

Python 3.6.2 release candidate 1

* セキュリティ: セキュリティ<53>.
* Core and Builtins: Core and Builtins<174>.
* ライブラリ: ライブラリ<179>.
* IDLE: IDLE<50>.
* C API: C API<67>.
* ビルド: ビルド<77>.
* ドキュメント: ドキュメント<71>.
* Tools/Demos: Tools/Demos<48>.
* テスト: テスト<68>.
* Windows: Windows<68>.

Python 3.6.1 final

* Core and Builtins: Core and Builtins<175>.
* ビルド: ビルド<78>.

Python 3.6.1 release candidate 1

* Core and Builtins: Core and Builtins<176>.
* ライブラリ: ライブラリ<180>.
* IDLE: IDLE<51>.
* Windows: Windows<69>.
* C API: C API<68>.
* ドキュメント: ドキュメント<72>.
* テスト: テスト<69>.
* ビルド: ビルド<79>.

Python 3.6.0 release candidate 2

* Core and Builtins: Core and Builtins<177>.
* Tools/Demos: Tools/Demos<49>.
* Windows: Windows<70>.
* ビルド: ビルド<80>.

Python 3.6.0 release candidate 1

* Core and Builtins: Core and Builtins<178>.
* ライブラリ: ライブラリ<181>.
* C API: C API<69>.
* ドキュメント: ドキュメント<73>.
* Tools/Demos: Tools/Demos<50>.

Python 3.6.0 beta 4

* Core and Builtins: Core and Builtins<179>.
* ライブラリ: ライブラリ<182>.
* ドキュメント: ドキュメント<74>.
* テスト: テスト<70>.
* ビルド: ビルド<81>.

Python 3.6.0 beta 3

* Core and Builtins: Core and Builtins<180>.
* ライブラリ: ライブラリ<183>.
* Windows: Windows<71>.
* ビルド: ビルド<82>.
* テスト: テスト<71>.

Python 3.6.0 beta 2

* Core and Builtins: Core and Builtins<181>.
* ライブラリ: ライブラリ<184>.
* Windows: Windows<72>.
* C API: C API<70>.
* ビルド: ビルド<83>.
* テスト: テスト<72>.

Python 3.6.0 beta 1

* Core and Builtins: Core and Builtins<182>.
* ライブラリ: ライブラリ<185>.
* IDLE: IDLE<52>.
* C API: C API<71>.
* テスト: テスト<73>.
* ビルド: ビルド<84>.
* Tools/Demos: Tools/Demos<51>.
* Windows: Windows<73>.

Python 3.6.0 alpha 4

* Core and Builtins: Core and Builtins<183>.
* ライブラリ: ライブラリ<186>.
* IDLE: IDLE<53>.
* テスト: テスト<74>.
* Windows: Windows<74>.
* ビルド: ビルド<85>.

Python 3.6.0 alpha 3

* セキュリティ: セキュリティ<54>.
* Core and Builtins: Core and Builtins<184>.
* ライブラリ: ライブラリ<187>.
* IDLE: IDLE<54>.
* C API: C API<72>.
* ビルド: ビルド<86>.
* Tools/Demos: Tools/Demos<52>.
* ドキュメント: ドキュメント<75>.
* テスト: テスト<75>.

Python 3.6.0 alpha 2

* セキュリティ: セキュリティ<55>.
* Core and Builtins: Core and Builtins<185>.
* ライブラリ: ライブラリ<188>.
* IDLE: IDLE<55>.
* ドキュメント: ドキュメント<76>.
* テスト: テスト<76>.
* Windows: Windows<75>.
* ビルド: ビルド<87>.
* C API: C API<73>.
* Tools/Demos: Tools/Demos<53>.

Python 3.6.0 alpha 1

* セキュリティ: セキュリティ<56>.
* Core and Builtins: Core and Builtins<186>.
* ライブラリ: ライブラリ<189>.
* IDLE: IDLE<56>.
* ドキュメント: ドキュメント<77>.
* テスト: テスト<77>.
* ビルド: ビルド<88>.
* Windows: Windows<76>.
* Tools/Demos: Tools/Demos<54>.
* C API: C API<74>.

Python 3.5.5 release candidate 1

* セキュリティ: セキュリティ<57>.
* Core and Builtins: Core and Builtins<187>.
* ライブラリ: ライブラリ<190>.

Python 3.5.4 final

* ライブラリ: ライブラリ<191>.

Python 3.5.4 release candidate 1

* セキュリティ: セキュリティ<58>.
* Core and Builtins: Core and Builtins<188>.
* ライブラリ: ライブラリ<192>.
* ドキュメント: ドキュメント<78>.
* テスト: テスト<78>.
* ビルド: ビルド<89>.
* Windows: Windows<77>.
* C API: C API<75>.

Python 3.5.3 release candidate 1

* セキュリティ: セキュリティ<59>.
* Core and Builtins: Core and Builtins<189>.
* ライブラリ: ライブラリ<193>.
* IDLE: IDLE<57>.
* C API: C API<76>.
* ドキュメント: ドキュメント<79>.
* テスト: テスト<79>.
* Tools/Demos: Tools/Demos<55>.
* Windows: Windows<78>.
* ビルド: ビルド<90>.

Python 3.5.2 final

* Core and Builtins: Core and Builtins<190>.
* テスト: テスト<80>.
* IDLE: IDLE<58>.

Python 3.5.2 release candidate 1

* セキュリティ: セキュリティ<60>.
* Core and Builtins: Core and Builtins<191>.
* ライブラリ: ライブラリ<194>.
* IDLE: IDLE<59>.
* ドキュメント: ドキュメント<80>.
* テスト: テスト<81>.
* ビルド: ビルド<91>.
* Windows: Windows<79>.
* Tools/Demos: Tools/Demos<56>.

Python 3.5.1 final

* Core and Builtins: Core and Builtins<192>.
* Windows: Windows<80>.

Python 3.5.1 release candidate 1

* Core and Builtins: Core and Builtins<193>.
* ライブラリ: ライブラリ<195>.
* IDLE: IDLE<60>.
* ドキュメント: ドキュメント<81>.
* テスト: テスト<82>.
* ビルド: ビルド<92>.
* Windows: Windows<81>.
* Tools/Demos: Tools/Demos<57>.

Python 3.5.0 final

* ビルド: ビルド<93>.

Python 3.5.0 release candidate 4

* ライブラリ: ライブラリ<196>.
* ビルド: ビルド<94>.

Python 3.5.0 release candidate 3

* Core and Builtins: Core and Builtins<194>.
* ライブラリ: ライブラリ<197>.

Python 3.5.0 release candidate 2

* Core and Builtins: Core and Builtins<195>.
* ライブラリ: ライブラリ<198>.

Python 3.5.0 release candidate 1

* Core and Builtins: Core and Builtins<196>.
* ライブラリ: ライブラリ<199>.
* IDLE: IDLE<61>.
* ドキュメント: ドキュメント<82>.
* テスト: テスト<83>.

Python 3.5.0 beta 4

* Core and Builtins: Core and Builtins<197>.
* ライブラリ: ライブラリ<200>.
* ビルド: ビルド<95>.

Python 3.5.0 beta 3

* Core and Builtins: Core and Builtins<198>.
* ライブラリ: ライブラリ<201>.
* テスト: テスト<84>.
* ドキュメント: ドキュメント<83>.
* ビルド: ビルド<96>.

Python 3.5.0 beta 2

* Core and Builtins: Core and Builtins<199>.
* ライブラリ: ライブラリ<202>.

Python 3.5.0 beta 1

* Core and Builtins: Core and Builtins<200>.
* ライブラリ: ライブラリ<203>.
* IDLE: IDLE<62>.
* テスト: テスト<85>.
* ドキュメント: ドキュメント<84>.
* Tools/Demos: Tools/Demos<58>.

Python 3.5.0 alpha 4

* Core and Builtins: Core and Builtins<201>.
* ライブラリ: ライブラリ<204>.
* ビルド: ビルド<97>.
* テスト: テスト<86>.
* Tools/Demos: Tools/Demos<59>.
* C API: C API<77>.

Python 3.5.0 alpha 3

* Core and Builtins: Core and Builtins<202>.
* ライブラリ: ライブラリ<205>.
* ビルド: ビルド<98>.
* テスト: テスト<87>.
* Tools/Demos: Tools/Demos<60>.

Python 3.5.0 alpha 2

* Core and Builtins: Core and Builtins<203>.
* ライブラリ: ライブラリ<206>.
* ビルド: ビルド<99>.
* C API: C API<78>.
* Windows: Windows<82>.

Python 3.5.0 alpha 1

* Core and Builtins: Core and Builtins<204>.
* ライブラリ: ライブラリ<207>.
* IDLE: IDLE<63>.
* ビルド: ビルド<100>.
* C API: C API<79>.
* ドキュメント: ドキュメント<85>.
* テスト: テスト<88>.
* Tools/Demos: Tools/Demos<61>.
* Windows: Windows<83>.

Python チュートリアル

* やる気を高めよう::
* Python インタプリタを使う::
* 形式ばらない Python の紹介::
* その他の制御フローツール::
* データ構造::
* モジュール: モジュール<2>.
* 入力と出力::
* エラーと例外::
* クラス::
* 標準ライブラリミニツアー::
* 標準ライブラリミニツアー: 標準ライブラリミニツアー --- その 2. その 2
* 仮想環境とパッケージ::
* さあ何を？::
* 対話入力編集と履歴置換::
* 浮動小数点演算、その問題と制限::
* 付録::

Python インタプリタを使う

* インタプリタを起動する::
* インタプリタとその環境::

インタプリタを起動する

* 引数の受け渡し::
* 対話モード::

インタプリタとその環境

* ソースコードの文字コード::

形式ばらない Python の紹介

* Python を電卓として使う::
* プログラミングへの第一歩::

Python を電卓として使う

* 数::
* テキスト::
* リスト型 (list): リスト型 list.

その他の制御フローツール

* if 文::
* for 文::
* range() 関数: range 関数.
* break 文と continue 文::
* ループの else 節::
* pass 文::
* match 文::
* 関数を定義する::
* 関数定義についてもう少し::
* 間奏曲; コーディングスタイル: 間奏曲 コーディングスタイル.

関数定義についてもう少し

* デフォルトの引数値::
* キーワード引数::
* 特殊なパラメータ::
* 任意引数リスト::
* 引数リストのアンパック::
* ラムダ式::
* ドキュメンテーション文字列::
* 関数のアノテーション::

特殊なパラメータ

* 位置またはキーワード引数::
* 位置専用引数: 位置専用引数<2>.
* キーワード専用引数::
* 関数の例::
* 要約::

データ構造

* リスト型についてもう少し::
* del 文::
* タプルとシーケンス::
* 集合型::
* 辞書型 (dictionary): 辞書型 dictionary.
* ループのテクニック::
* 条件についてもう少し::
* シーケンスとその他の型の比較::

リスト型についてもう少し

* リストをスタックとして使う::
* リストをキューとして使う::
* リストの内包表記: リストの内包表記<2>.
* ネストしたリストの内包表記::

モジュール

* モジュールについてもうすこし::
* 標準モジュール::
* dir() 関数: dir 関数.
* パッケージ::

モジュールについてもうすこし

* モジュールをスクリプトとして実行する::
* モジュール検索パス::
* "コンパイル" された Python ファイル::

パッケージ

* パッケージから * を import する::
* パッケージ内参照::
* 複数ディレクトリ中のパッケージ::

入力と出力

* 出力を見やすくフォーマットする::
* ファイルを読み書きする::

出力を見やすくフォーマットする

* フォーマット済み文字列リテラル::
* 文字列の format() メソッド: 文字列の format メソッド.
* 文字列の手作業でのフォーマット::
* 古い文字列書式設定方法::

ファイルを読み書きする

* ファイルオブジェクトのメソッド::
* json による構造化されたデータの保存::

エラーと例外

* 構文エラー::
* 例外::
* 例外を処理する::
* 例外を送出する::
* 例外の連鎖::
* ユーザー定義例外::
* クリーンアップ動作を定義する::
* 定義済みクリーンアップ処理::
* 複数の関連しない例外の送出と処理::
* ノートによって例外を充実させる::

クラス

* 名前とオブジェクトについて::
* Python のスコープと名前空間::
* クラス初見::
* いろいろな注意点::
* 継承::
* プライベート変数::
* 残りのはしばし::
* イテレータ (iterator): イテレータ iterator.
* ジェネレータ (generator): ジェネレータ generator.
* ジェネレータ式::

Python のスコープと名前空間

* スコープと名前空間の例::

クラス初見

* クラス定義の構文::
* クラスオブジェクト::
* インスタンスオブジェクト::
* メソッドオブジェクト::
* クラスとインスタンス変数::

継承

* 多重継承::

標準ライブラリミニツアー

* OSへのインターフェース::
* ファイルのワイルドカード表記::
* コマンドライン引数::
* エラー出力のリダイレクトとプログラムの終了::
* 文字列のパターンマッチング::
* 数学::
* インターネットへのアクセス::
* 日付と時刻::
* データ圧縮::
* パフォーマンスの計測::
* 品質管理::
* バッテリー同梱::

標準ライブラリミニツアー -- その 2

* 出力のフォーマット::
* 文字列テンプレート::
* バイナリデータレコードの操作::
* マルチスレッディング: マルチスレッディング<2>.
* ログ記録::
* 弱参照::
* リスト操作のためのツール::
* 10 進浮動小数演算::

仮想環境とパッケージ

* はじめに: はじめに<4>.
* 仮想環境の作成::
* pip を使ったパッケージ管理::

対話入力編集と履歴置換

* タブ補完と履歴編集::
* 対話的インタープリタの代替::

浮動小数点演算、その問題と制限

* 表現エラー::

付録

* 対話モード: 対話モード<2>.

対話モード

* エラー処理::
* 実行可能な Python スクリプト::
* 対話モード用の起動時実行ファイル::
* カスタマイズ用モジュール::

Python のセットアップと利用

* コマンドラインと環境: コマンドラインと環境<2>.
* Unix プラットフォームで Python を使う::
* Python を構成する::
* Windows で Python を使う::
* macOS で Python を使う::
* Android で Python を使う::
* iOS で Python を使う::
* エディタと IDE::

コマンドラインと環境

* コマンドライン::
* 環境変数::

コマンドライン

* インターフェイスオプション::
* 一般オプション::
* その他のオプション::
* 色の制御::

環境変数

* デバッグモード変数::

Unix プラットフォームで Python を使う

* 最新バージョンの Python の取得とインストール::
* Python のビルド::
* Python に関係するパスとファイル::
* その他: その他<2>.
* カスタムの OpenSSL::

最新バージョンの Python の取得とインストール

* Linux::
* FreeBSD と OpenBSD::

Linux

* IDLE のインストール::

Python を構成する

* ビルド要件::
* 生成されるファイル::
* Configureオプション::
* Python ビルドシステム::
* Compiler and linker flags::

ビルド要件

* オプションのモジュールの要件::

生成されるファイル

* 構成スクリプト::

Configureオプション

* 一般的なオプション::
* C コンパイラのオプション::
* リンカのオプション::
* サードパーティ依存関係のオプション::
* WebAssembly オプション::
* インストールオプション::
* パフォーマンスに関するオプション::
* Python デバッグビルド::
* Debug options::
* リンカのオプション: リンカのオプション<2>.
* Libraries options::
* Security Options::
* macOS のオプション::
* iOS のオプション::
* クロスコンパイルのオプション::

Python ビルドシステム

* ビルドシステムの主要なファイル::
* 主要なビルドステップ::
* Main Makefile targets::
* C extensions::

Main Makefile targets

* make::
* make platform::
* make profile-opt::
* make clean::
* make distclean::
* make install::
* make test::
* make ci::
* make buildbottest::
* make regen-all::

Compiler and linker flags

* Preprocessor flags::
* Compiler flags::
* Linker flags::

Windows で Python を使う

* Python install manager::
* 埋め込み可能なパッケージ::
* nuget.org パッケージ: nuget org パッケージ.
* 別のバンドル::
* Supported Windows versions::
* Removing the MAX_PATH limitation::
* UTF-8 モード::
* モジュールの検索::
* 追加のモジュール::
* Windows 上で Python をコンパイルする::
* The full installer (deprecated): The full installer deprecated.
* Python launcher for Windows (deprecated): Python launcher for Windows deprecated.

Python install manager

* Installation::
* 基本的な使い方::
* Command help::
* Listing runtimes::
* Installing runtimes::
* Offline installs::
* Uninstalling runtimes::
* Configuration::
* Shebang lines::
* Advanced installation::
* Administrative configuration::
* Installing free-threaded binaries::
* Troubleshooting::

埋め込み可能なパッケージ

* Python application::
* Python の埋め込み::

nuget.org パッケージ

* フリースレッドパッケージ (Free-threaded packages): フリースレッドパッケージ Free-threaded packages.

追加のモジュール

* PyWin32::
* cx_Freeze::

The full installer (deprecated)

* インストール手順::
* Removing the MAX_PATH limitation: Removing the MAX_PATH limitation<2>.
* Installing without UI::
* Installing without downloading::
* インストール後の変更::
* Installing free-threaded binaries: Installing free-threaded binaries<2>.

Python launcher for Windows (deprecated)

* 最初に::
* Shebang lines: Shebang lines<2>.
* シェバン行の引数::
* カスタマイズ::
* 診断::
* Dry run::
* Install on demand::
* Return codes::

最初に

* コマンドラインから起動する::
* 仮想環境 (Virtual environments): 仮想環境 Virtual environments.
* スクリプトから起動する::
* ファイルの関連付けから起動する::

カスタマイズ

* INI ファイルによるカスタマイズ::
* デフォルトのPythonバージョンのカスタマイズ::

macOS で Python を使う

* Using Python for macOS from python.org: Using Python for macOS from python org.
* Alternative Distributions::
* 追加の Python パッケージのインストール::
* GUI プログラミング::
* 高度なトピック::
* 他のリソース::

Using Python for macOS from python.org

* インストール手順: インストール手順<2>.
* Python スクリプトの実行方法::

高度なトピック

* フリースレッドバイナリ (Free-threaded Binaries) のインストール: フリースレッドバイナリ Free-threaded Binaries のインストール.
* Installing using the command line::
* Python アプリケーションの配布::
* App Store コンプライアンス::

Android で Python を使う

* Android アプリに Python を追加する::
* Android 向けの Python パッケージをビルドする::

iOS で Python を使う

* iOS ランタイムでの Python::
* iOS での Python のインストール::
* App Store コンプライアンス: App Store コンプライアンス<2>.

iOS ランタイムでの Python

* iOS のバージョン互換性::
* プラットフォームの識別::
* 標準ライブラリの利用可能性::
* バイナリ拡張モジュール::
* コンパイラスタブバイナリ::

iOS での Python のインストール

* iOS アプリビルド用のツール::
* iOS プロジェクトに Python を追加する::
* Python パッケージのテスト::

App Store コンプライアンス

* 標準ライブラリ内の互換性のないコード::
* プライバシーマニフェスト::

エディタと IDE

* IDLE: IDLE --- Python のエディタとシェル. Python のエディタとシェル
* Other Editors and IDEs::

Python 言語リファレンス

* はじめに: はじめに<5>.
* 字句解析::
* データモデル::
* 実行モデル::
* インポートシステム::
* 式 (expression): 式 expression.
* 単純文 (simple statement): 単純文 simple statement.
* 複合文 (compound statement): 複合文 compound statement.
* トップレベル要素::
* 完全な文法仕様::

はじめに

* 別のPythonの実装::
* 本マニュアルにおける表記法::

本マニュアルにおける表記法

* Lexical and Syntactic definitions::

字句解析

* 行構造::
* その他のトークン::
* Names (identifiers and keywords): Names identifiers and keywords.
* リテラル::
* 文字列およびバイト列リテラル::
* 数値リテラル::
* Operators and delimiters::

行構造

* 論理行 (logical line): 論理行 logical line.
* 物理行 (physical line): 物理行 physical line.
* コメント (Comments): コメント Comments.
* エンコード宣言 (encoding declaration): エンコード宣言 encoding declaration.
* 明示的な行継続::
* 非明示的な行継続::
* 空行::
* インデント::
* トークン間の空白::
* End marker::

Names (identifiers and keywords)

* キーワード (keyword): キーワード keyword.
* ソフトキーワード::
* 予約済みの識別子種 (reserved classes of identifiers): 予約済みの識別子種 reserved classes of identifiers.
* Non-ASCII characters in names::

文字列およびバイト列リテラル

* Triple-quoted strings::
* String prefixes::
* Formal grammar::
* Escape sequences::
* Bytes literals::
* Raw string literals::
* f-strings::
* t-strings::
* Formal grammar for f-strings::

Escape sequences

* Ignored end of line::
* Escaped characters::
* Octal character::
* Hexadecimal character::
* Named Unicode character::
* Hexadecimal Unicode characters::
* Unrecognized escape sequences::

数値リテラル

* 整数リテラル::
* Floating-point literals::
* 虚数 (imaginary) リテラル: 虚数 imaginary リテラル.

データモデル

* オブジェクト、値、および型::
* 標準型の階層::
* 特殊メソッド名::
* コルーチン::

標準型の階層

* None::
* NotImplemented::
* Ellipsis::
* numbers.Number: numbers Number.
* シーケンス型 (sequence): シーケンス型 sequence.
* 集合型: 集合型<2>.
* マッピング型 (mapping): マッピング型 mapping.
* 呼び出し可能型 (callable type): 呼び出し可能型 callable type.
* モジュール: モジュール<3>.
* カスタムクラス型::
* クラスインスタンス (class instance): クラスインスタンス class instance.
* I/O オブジェクト (ファイルオブジェクトの別名): I/O オブジェクト ファイルオブジェクトの別名.
* 内部型 (internal type): 内部型 internal type.

numbers.Number

* numbers.Integral (整数): numbers Integral 整数.
* numbers.Real (float) (実数): numbers Real float 実数.
* numbers.Complex (complex): numbers Complex complex.

シーケンス型 (sequence)

* 変更不能なシーケンス (immutable sequence): 変更不能なシーケンス immutable sequence.
* 変更可能なシーケンス型 (mutable sequence): 変更可能なシーケンス型 mutable sequence.

マッピング型 (mapping)

* 辞書型 (dictionary): 辞書型 dictionary<2>.

呼び出し可能型 (callable type)

* ユーザ定義関数 (user-defined function): ユーザ定義関数 user-defined function.
* インスタンスメソッド::
* ジェネレータ関数 (generator function): ジェネレータ関数 generator function.
* コルーチン関数 (coroutine function): コルーチン関数 coroutine function.
* 非同期ジェネレータ関数 (asynchronous generator function): 非同期ジェネレータ関数 asynchronous generator function.
* 組み込み関数 (built-in function): 組み込み関数 built-in function.
* 組み込みメソッド (built-in method): 組み込みメソッド built-in method.
* クラス: クラス<2>.
* クラスのインスタンス::

ユーザ定義関数 (user-defined function)

* Special read-only attributes::
* Special writable attributes::

モジュール

* Import-related attributes on module objects::
* Other writable attributes on module objects::
* Module dictionaries::

カスタムクラス型

* Special attributes::
* Special methods::

クラスインスタンス (class instance)

* Special attributes: Special attributes<2>.

内部型 (internal type)

* コードオブジェクト::
* フレーム (frame) オブジェクト: フレーム frame オブジェクト.
* トレースバック (traceback) オブジェクト: トレースバック traceback オブジェクト.
* スライス (slice) オブジェクト: スライス slice オブジェクト.
* 静的メソッド (static method) オブジェクト: 静的メソッド static method オブジェクト.
* クラスメソッドオブジェクト::

コードオブジェクト

* Special read-only attributes: Special read-only attributes<2>.
* Methods on code objects::

フレーム (frame) オブジェクト

* Special read-only attributes: Special read-only attributes<3>.
* Special writable attributes: Special writable attributes<2>.
* Frame object methods::

特殊メソッド名

* 基本的なカスタマイズ::
* 属性値アクセスをカスタマイズする::
* クラス生成をカスタマイズする::
* インスタンスのカスタマイズとサブクラスチェック::
* ジェネリック型をエミュレートする::
* 呼び出し可能オブジェクトをエミュレートする::
* コンテナをエミュレートする::
* 数値型をエミュレートする::
* with文とコンテキストマネージャ::
* クラスパターンマッチの位置引数のカスタマイズ::
* Emulating buffer types::
* Annotations::
* 特殊メソッド検索::

属性値アクセスをカスタマイズする

* モジュールの属性値アクセスをカスタマイズする::
* デスクリプタ (descriptor) の実装: デスクリプタ descriptor の実装.
* デスクリプタの呼び出し::
* __slots__: __slots__<2>.

クラス生成をカスタマイズする

* メタクラス::
* MRO エントリの解決::
* 適切なメタクラスの決定::
* クラスの名前空間の準備::
* クラス本体の実行::
* クラスオブジェクトの作成::
* メタクラスの用途::

ジェネリック型をエミュレートする

* The purpose of __class_getitem__::
* __class_getitem__ versus __getitem__::

コルーチン

* 待機可能オブジェクト (Awaitable Object): 待機可能オブジェクト Awaitable Object.
* コルーチンオブジェクト::
* 非同期イテレータ (Asynchronous Iterator): 非同期イテレータ Asynchronous Iterator.
* 非同期コンテキストマネージャ (Asynchronous Context Manager): 非同期コンテキストマネージャ Asynchronous Context Manager.

実行モデル

* プログラムの構造::
* 名前づけと束縛 (naming and binding): 名前づけと束縛 naming and binding.
* 例外: 例外<2>.
* Runtime Components::

名前づけと束縛 (naming and binding)

* 名前の束縛::
* 名前解決::
* Annotation scopes::
* Lazy evaluation::
* 組み込みと制限付きの実行::
* 動的な機能とのやりとり::

Runtime Components

* General Computing Model::
* Python Runtime Model::

インポートシステム

* importlib: importlib<10>.
* パッケージ: パッケージ<2>.
* 検索::
* ロード::
* パスベース・ファインダー::
* 標準のインポートシステムを置き換える::
* Package Relative Imports::
* __main__ に対する特別な考慮::
* 参考資料::

パッケージ

* 通常のパッケージ::
* 名前空間パッケージ::

検索

* モジュールキャッシュ::
* ファインダーとローダー::
* インポートフック::
* メタパス::

ロード

* ローダー::
* サブモジュール::
* Module specs::
* __path__ attributes on modules::
* モジュールの repr::
* キャッシュされたバイトコードの無効化::

パスベース・ファインダー

* パスエントリ・ファインダー::
* パスエントリ・ファインダー・プロトコル::

__main__ に対する特別な考慮

* __main__.__spec__: __main__ __spec__.

式 (expression)

* 算術変換 (arithmetic conversion): 算術変換 arithmetic conversion.
* アトム、原子的要素 (atom): アトム、原子的要素 atom.
* プライマリ::
* Await 式::
* べき乗演算 (power operator): べき乗演算 power operator.
* 単項算術演算とビット単位演算 (unary arithmetic and bitwise operation): 単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
* 二項算術演算 (binary arithmetic operation): 二項算術演算 binary arithmetic operation.
* シフト演算 (shifting operation): シフト演算 shifting operation.
* ビット単位演算の二項演算 (binary bitwise operation): ビット単位演算の二項演算 binary bitwise operation.
* 比較::
* ブール演算 (boolean operation): ブール演算 boolean operation.
* 代入式: 代入式<2>.
* 条件式 (Conditional Expressions): 条件式 Conditional Expressions.
* ラムダ (lambda): ラムダ lambda.
* 式のリスト::
* 評価順序::
* 演算子の優先順位::

アトム、原子的要素 (atom)

* Built-in constants::
* 識別子 (identifier、または名前 (name)): 識別子 identifier、または名前 name.
* リテラル: リテラル<2>.
* 丸括弧形式 (parenthesized form): 丸括弧形式 parenthesized form.
* リスト、集合、辞書の表示::
* リスト表示::
* 集合表示::
* 辞書表示::
* ジェネレータ式: ジェネレータ式<2>.
* Yield 式::

識別子 (identifier、または名前 (name))

* Private name mangling::

リテラル

* Literals and object identity::
* 文字列リテラルの結合 (concatenation): 文字列リテラルの結合 concatenation.

Yield 式

* ジェネレータ-イテレータメソッド::
* 使用例::
* 非同期ジェネレータ関数 (asynchronous generator function): 非同期ジェネレータ関数 asynchronous generator function<2>.
* 非同期ジェネレータイテレータメソッド::

プライマリ

* 属性参照::
* Subscriptions and slicings::
* 呼び出し (call): 呼び出し call.

Subscriptions and slicings

* スライス表記 (slicing): スライス表記 slicing.
* Comma-separated subscripts::
* "Starred" subscriptions::
* Formal subscription grammar::

比較

* 値の比較::
* 所属検査演算::
* 同一性の比較::

単純文 (simple statement)

* 式文 (expression statement): 式文 expression statement.
* 代入文 (assignment statement): 代入文 assignment statement.
* assert 文::
* pass 文: pass 文<2>.
* del 文: del 文<2>.
* return 文::
* yield 文::
* raise 文::
* break 文::
* continue 文::
* import 文::
* global 文::
* nonlocal 文::
* The type statement::

代入文 (assignment statement)

* 累算代入文 (augmented assignment statement): 累算代入文 augmented assignment statement.
* 注釈付き代入文 (annotated assignment statements): 注釈付き代入文 annotated assignment statements.

import 文

* future 文 (future statement): future 文 future statement.

複合文 (compound statement)

* if 文: if 文<2>.
* while 文::
* for 文: for 文<2>.
* try 文::
* with 文::
* match 文: match 文<2>.
* 関数定義::
* クラス定義::
* コルーチン: コルーチン<2>.
* Type parameter lists::
* Annotations: Annotations<2>.

try 文

* except 節::
* except* 節::
* else 節::
* finally 節::

match 文

* 概要::
* ガード: ガード<2>.
* 論駁不可能なケースブロック::
* パターン::

パターン

* OR パターン::
* AS パターン::
* リテラルパターン::
* キャプチャパターン::
* ワイルドカードパターン::
* 値パターン::
* グループパターン::
* シーケンスパターン::
* マッピングパターン::
* クラスパターン::

コルーチン

* コルーチン関数定義::
* async for 文::
* async with 文::

Type parameter lists

* Generic functions::
* Generic classes::
* Generic type aliases::

トップレベル要素

* 完全な Python プログラム::
* ファイル入力::
* 対話的入力::
* 式入力::

Python 標準ライブラリ

* はじめに: はじめに<6>.
* 組み込み関数::
* 組み込み定数::
* 組み込み型::
* 組み込み例外::
* テキスト処理サービス::
* バイナリデータ処理::
* データ型::
* 数値と数学モジュール::
* 関数型プログラミング用モジュール::
* ファイルとディレクトリへのアクセス::
* データの永続化::
* データ圧縮とアーカイブ::
* ファイルフォーマット::
* 暗号関連のサービス::
* 汎用オペレーティングシステムサービス::
* コマンドラインインターフェースライブラリ::
* 並行実行::
* ネットワーク通信とプロセス間通信::
* インターネット上のデータの操作::
* 構造化マークアップツール::
* インターネットプロトコルとサポート::
* マルチメディアサービス::
* 国際化::
* Graphical user interfaces with Tk::
* 開発ツール::
* デバッグとプロファイル::
* ソフトウェア・パッケージと配布::
* Python ランタイムサービス::
* カスタム Python インタプリタ::
* モジュールのインポート::
* Python言語サービス::
* MS Windows 固有のサービス::
* Unix-specific services::
* モジュールのコマンドラインインターフェース (CLI): モジュールのコマンドラインインターフェース CLI.
* 取って代わられたモジュール群::
* 削除されたモジュール::
* セキュリティで考慮すべき点: セキュリティで考慮すべき点<6>.

はじめに

* 利用可能性について::

利用可能性について

* WebAssembly プラットフォーム::
* モバイルプラットフォーム::

組み込み定数

* site モジュールで追加される定数::

組み込み型

* 真理値判定::
* ブール演算: ブール演算 --- and or not. and, or, not
* 比較: 比較<2>.
* 数値型 int, float, complex: 数値型 int float complex.
* ブーリアン型 - bool::
* イテレータ型::
* シーケンス型: シーケンス型 --- list tuple range. list, tuple, range
* Text and Binary Sequence Type Methods Summary::
* テキストシーケンス型: テキストシーケンス型 --- str. str
* バイナリシーケンス型: バイナリシーケンス型 --- bytes bytearray memoryview. bytes, bytearray, memoryview
* set（集合）型: set（集合）型 --- set frozenset. set, frozenset
* マッピング型: マッピング型 --- dict. dict
* コンテキストマネージャ型::
* 型アノテーション型: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン. ジェネリックエイリアス 、 ユニオン
* その他の組み込み型::
* 特殊属性::
* 整数と文字列の変換での長さ制限::

数値型 int, float, complex

* 整数型におけるビット単位演算::
* 整数型における追加のメソッド::
* 浮動小数点数に対する追加のメソッド::
* 複素数に対する追加のメソッド::
* 数値型のハッシュ化::

イテレータ型

* ジェネレータ型::

シーケンス型 -- list, tuple, range

* 共通のシーケンス演算::
* イミュータブルなシーケンス型::
* ミュータブルなシーケンス型::
* リスト型 (list): リスト型 list<2>.
* タプル型 (tuple): タプル型 tuple.
* range::

テキストシーケンス型 -- str

* 文字列メソッド: 文字列メソッド<2>.
* Formatted String Literals (f-strings): Formatted String Literals f-strings.
* Template String Literals (t-strings): Template String Literals t-strings.
* printf 形式の文字列書式化::

Formatted String Literals (f-strings)

* Debug specifier::
* Conversion specifier::
* Format specifier::

バイナリシーケンス型 -- bytes, bytearray, memoryview

* バイトオブジェクト::
* bytearray オブジェクト::
* bytes と bytearray の操作::
* printf 形式での bytes の書式化::
* メモリビュー::

マッピング型 -- dict

* 辞書ビューオブジェクト::

型アノテーション型 -- ジェネリックエイリアス 、 ユニオン

* ジェネリックエイリアス型::
* Union 型::

ジェネリックエイリアス型

* 標準ジェネリッククラス::
* GenericAlias オブジェクトの特別な属性::

その他の組み込み型

* モジュール: モジュール<4>.
* クラスおよびクラスインスタンス::
* 関数::
* メソッド::
* コードオブジェクト: コードオブジェクト<2>.
* 型オブジェクト::
* ヌルオブジェクト::
* Ellipsis オブジェクト::
* NotImplemented オブジェクト::
* 内部オブジェクト::

整数と文字列の変換での長さ制限

* 影響のあるAPI::
* 上限値を設定する::
* 推奨設定::

組み込み例外

* 例外コンテキスト::
* 組み込み例外から継承する::
* 基底クラス::
* 具象例外::
* 警告::
* 例外グループ::
* 例外のクラス階層::

具象例外

* OS 例外::

テキスト処理サービス

* string: string --- 一般的な文字列操作. 一般的な文字列操作
* string.templatelib: string templatelib --- テンプレート文字列リテラルのサポート. テンプレート文字列リテラルのサポート
* re: re --- 正規表現操作. 正規表現操作
* difflib: difflib --- 差分の計算の補助. 差分の計算の補助
* textwrap: textwrap --- テキストの折り返しと詰め込み. テキストの折り返しと詰め込み
* unicodedata: unicodedata --- Unicode データベース. Unicode データベース
* stringprep: stringprep --- インターネットの文字列調製. インターネットの文字列調製
* readline: readline --- GNU readline のインターフェース. GNU readline のインターフェース
* rlcompleter: rlcompleter --- GNU readline の補完機能. GNU readline の補完機能

string -- 一般的な文字列操作

* 文字列定数::
* カスタムの文字列書式化::
* 書式指定文字列の文法::
* Template strings ($-strings): Template strings $-strings.
* ヘルパー関数::

書式指定文字列の文法

* 書式指定ミニ言語仕様::
* 書式指定例::

string.templatelib -- テンプレート文字列リテラルのサポート

* テンプレート文字列::
* 型::
* ヘルパー関数: ヘルパー関数<2>.

re -- 正規表現操作

* 正規表現のシンタックス::
* モジュールコンテンツ::
* 正規表現オブジェクト::
* マッチオブジェクト::
* 正規表現の例::

モジュールコンテンツ

* フラグ::
* 関数: 関数<2>.
* 例外: 例外<3>.

正規表現の例

* ペアの確認::
* scanf() をシミュレートする: scanf をシミュレートする.
* search() vs. match(): search vs match.
* 電話帳を作る::
* テキストの秘匿::
* 全ての副詞を見つける::
* 全ての副詞とその位置を見つける::
* Raw 文字列記法::
* トークナイザを書く::

difflib -- 差分の計算の補助

* SequenceMatcherオブジェクト::
* SequenceMatcher の例::
* Differ オブジェクト::
* Differ の例::
* difflib のコマンドラインインターフェース::
* ndiff example::

readline -- GNU readline のインターフェース

* 初期化ファイル::
* 行バッファ::
* 履歴ファイル::
* 履歴リスト::
* 開始フック::
* 補完::
* 使用例: 使用例<2>.

バイナリデータ処理

* struct: struct --- バイト列をパックされたバイナリデータとして解釈する. バイト列をパックされたバイナリデータとして解釈する
* codecs: codecs --- codec レジストリと基底クラス. codec レジストリと基底クラス

struct -- バイト列をパックされたバイナリデータとして解釈する

* 関数と例外::
* 書式文字列::
* アプリケーション::
* クラス: クラス<3>.

書式文字列

* バイトオーダ、サイズ、アラインメント::
* 書式指定文字::
* 使用例: 使用例<3>.

アプリケーション

* Native Formats::
* Standard Formats::

codecs -- codec レジストリと基底クラス

* Codec 基底クラス::
* エンコーディングと Unicode::
* 標準エンコーディング::
* Python 特有のエンコーディング::
* encodings: encodings --- Encodings package. Encodings package
* encodings.idna: encodings idna --- Internationalized Domain Names in Applications. Internationalized Domain Names in Applications
* encodings.mbcs: encodings mbcs --- Windows ANSI codepage. Windows ANSI codepage
* encodings.utf_8_sig: encodings utf_8_sig --- UTF-8 codec with BOM signature. UTF-8 codec with BOM signature

Codec 基底クラス

* エラーハンドラ::
* ステートレスなエンコードとデコード::
* インクリメンタルなエンコードとデコード::
* ストリームのエンコードとデコード::

インクリメンタルなエンコードとデコード

* IncrementalEncoder オブジェクト::
* IncrementalDecoder オブジェクト::

ストリームのエンコードとデコード

* StreamWriter オブジェクト::
* StreamReader オブジェクト::
* StreamReaderWriter オブジェクト::
* StreamRecoder オブジェクト::

Python 特有のエンコーディング

* テキストエンコーディング::
* バイナリ変換 (Binary Transforms): バイナリ変換 Binary Transforms.
* Standalone Codec Functions::
* テキスト変換 (Text Transforms): テキスト変換 Text Transforms.

データ型

* datetime: datetime --- 基本的な日付と時間の型. 基本的な日付と時間の型
* zoneinfo: zoneinfo --- IANA タイムゾーンのサポート. IANA タイムゾーンのサポート
* calendar: calendar --- 一般的なカレンダーに関係する機能群. 一般的なカレンダーに関係する機能群
* collections: collections --- コンテナデータ型. コンテナデータ型
* collections.abc: collections abc --- コンテナの抽象基底クラス. コンテナの抽象基底クラス
* heapq: heapq --- ヒープキューアルゴリズム. ヒープキューアルゴリズム
* bisect: bisect --- 配列二分法アルゴリズム. 配列二分法アルゴリズム
* array: array --- 効率的な数値配列. 効率的な数値配列
* weakref: weakref --- Weak references. Weak references
* types: types --- 動的な型生成と組み込み型の名前. 動的な型生成と組み込み型の名前
* copy: copy --- 浅いコピーおよび深いコピー操作. 浅いコピーおよび深いコピー操作
* pprint: pprint --- データの整形表示. データの整形表示
* reprlib: reprlib --- もう一つの repr の実装. もう一つの repr() の実装
* enum: enum --- 列挙型のサポート. 列挙型のサポート
* graphlib: graphlib --- グラフ構造を操作する機能. グラフ構造を操作する機能

datetime -- 基本的な日付と時間の型

* Aware and naive objects::
* 定数::
* Available types::
* timedelta objects::
* date objects::
* datetime objects::
* time objects::
* tzinfo objects::
* timezone objects::
* strftime() and strptime() behavior: strftime and strptime behavior.

Available types

* Common properties::
* Determining if an object is aware or naive::

timedelta objects

* Examples of usage; timedelta: Examples of usage timedelta.

date objects

* Examples of usage; date: Examples of usage date.

datetime objects

* Examples of usage; datetime: Examples of usage datetime.

time objects

* Examples of usage; time: Examples of usage time.

strftime() and strptime() behavior

* strftime() and strptime() format codes: strftime and strptime format codes.
* Technical detail::

zoneinfo -- IANA タイムゾーンのサポート

* ZoneInfo を使用する::
* データソース::
* ZoneInfo クラス::
* 関数: 関数<3>.
* Globals::
* 例外と警告::

データソース

* Configuring the data sources::

Configuring the data sources

* Compile-time configuration::
* Environment configuration::
* Runtime configuration::

ZoneInfo クラス

* 文字列表現::
* Pickle serialization::

calendar -- 一般的なカレンダーに関係する機能群

* コマンドラインでの使用::

collections -- コンテナデータ型

* ChainMap オブジェクト::
* Counter オブジェクト::
* deque オブジェクト::
* defaultdict オブジェクト::
* namedtuple() 名前付きフィールドを持つタプルのファクトリ関数: namedtuple 名前付きフィールドを持つタプルのファクトリ関数.
* OrderedDict オブジェクト::
* UserDict オブジェクト::
* UserList オブジェクト::
* UserString オブジェクト::

ChainMap オブジェクト

* ChainMap の例とレシピ::

deque オブジェクト

* deque のレシピ::

defaultdict オブジェクト

* defaultdict の使用例::

OrderedDict オブジェクト

* OrderedDict の例とレシピ::

collections.abc -- コンテナの抽象基底クラス

* コレクション抽象基底クラス::
* コレクションの抽象基底クラス: コレクションの抽象基底クラス -- 詳細な説明. 詳細な説明
* 例とレシピ::

heapq -- ヒープキューアルゴリズム

* 基本的な例::
* Other Applications::
* 優先度キュー実装の注釈::
* 理論::

bisect -- 配列二分法アルゴリズム

* パフォーマンスに関するメモ::
* ソート済みリストの探索::
* 使用例: 使用例<4>.

weakref -- Weak references

* 弱参照オブジェクト::
* 使用例: 使用例<5>.
* ファイナライザオブジェクト::
* Comparing finalizers with __del__() methods: Comparing finalizers with __del__ methods.

types -- 動的な型生成と組み込み型の名前

* 動的な型生成::
* 標準的なインタプリタ型::
* 追加のユーティリティクラスと関数::
* コルーチンユーティリティ関数::

pprint -- データの整形表示

* 関数: 関数<4>.
* PrettyPrinter オブジェクト::
* 使用例: 使用例<6>.

reprlib -- もう一つの repr() の実装

* Reprオブジェクト::
* Reprオブジェクトをサブクラス化する::

enum -- 列挙型のサポート

* モジュールコンテンツ: モジュールコンテンツ<2>.
* データ型: データ型<2>.
* ユーティリティとデコレータ::
* 注釈::

データ型

* __dunder__ 名のサポート::
* _sunder_ 名のサポート::

graphlib -- グラフ構造を操作する機能

* 例外: 例外<4>.

数値と数学モジュール

* numbers: numbers --- 数の抽象基底クラス. 数の抽象基底クラス
* math: math --- 数学関数. 数学関数
* cmath: cmath --- 複素数用の数学関数. 複素数用の数学関数
* decimal: decimal --- 10進固定小数点と浮動小数点の演算. 10進固定小数点と浮動小数点の演算
* fractions: fractions --- 有理数. 有理数
* random: random --- 疑似乱数を生成する. 疑似乱数を生成する
* statistics: statistics --- 数学的統計関数. 数学的統計関数

numbers -- 数の抽象基底クラス

* 数値塔::
* Notes for type implementers::

Notes for type implementers

* さらに数のABCを追加する::
* 算術演算の実装::

math -- 数学関数

* Number-theoretic functions::
* Floating point arithmetic::
* Floating point manipulation functions::
* Power, exponential and logarithmic functions: Power exponential and logarithmic functions.
* Summation and product functions::
* 角度変換::
* 三角関数::
* 双曲線関数::
* 特殊関数::
* 定数: 定数<2>.

cmath -- 複素数用の数学関数

* 極座標変換::
* 指数関数と対数関数::
* 三角関数: 三角関数<2>.
* 双曲線関数: 双曲線関数<2>.
* 類別関数::
* 定数: 定数<3>.

decimal -- 10進固定小数点と浮動小数点の演算

* Quick-start tutorial::
* Decimal オブジェクト::
* Context オブジェクト::
* 定数: 定数<4>.
* 丸めモード::
* シグナル::
* Floating-point notes::
* スレッドを使った処理::
* レシピ::
* Decimal FAQ::

Decimal オブジェクト

* 論理引数::

Floating-point notes

* 精度を上げて丸め誤差を抑制する::
* 特殊値::

random -- 疑似乱数を生成する

* 保守 (bookkeeping) 関数: 保守 bookkeeping 関数.
* バイト列用の関数::
* 整数用の関数::
* シーケンス用の関数::
* Discrete distributions::
* 実数分布::
* 他の生成器::
* 再現性について::
* 使用例: 使用例<7>.
* レシピ: レシピ<2>.
* コマンドラインでの使用: コマンドラインでの使用<2>.
* コマンドラインの例::

statistics -- 数学的統計関数

* 平均及び中心位置の測度::
* 分散の測度::
* 2入力間の関係の統計::
* 関数の詳細::
* 例外: 例外<5>.
* NormalDist オブジェクト::
* 例とレシピ: 例とレシピ<2>.

例とレシピ

* Classic probability problems::
* Monte Carlo inputs for simulations::
* Approximating binomial distributions::
* Naive bayesian classifier::

関数型プログラミング用モジュール

* itertools: itertools --- 効率的なループ用のイテレータ生成関数群. 効率的なループ用のイテレータ生成関数群
* functools: functools --- 高階関数と呼び出し可能オブジェクトの操作. 高階関数と呼び出し可能オブジェクトの操作
* operator: operator --- 関数形式の標準演算子. 関数形式の標準演算子

itertools -- 効率的なループ用のイテレータ生成関数群

* Itertool関数::
* Itertools レシピ::

functools -- 高階関数と呼び出し可能オブジェクトの操作

* partial オブジェクト::

operator -- 関数形式の標準演算子

* 演算子から関数への対応表::
* インプレース (in-place) 演算子: インプレース in-place 演算子.

ファイルとディレクトリへのアクセス

* pathlib: pathlib --- オブジェクト指向のファイルシステムパス. オブジェクト指向のファイルシステムパス
* os.path: os path --- 一般的なパス名操作. 一般的なパス名操作
* stat: stat --- stat の結果を解釈する. stat() の結果を解釈する
* filecmp: filecmp --- ファイルとディレクトリの比較. ファイルとディレクトリの比較
* tempfile: tempfile --- 一時ファイルやディレクトリの作成. 一時ファイルやディレクトリの作成
* glob: glob --- Unix 形式のパス名のパターン展開. Unix 形式のパス名のパターン展開
* fnmatch: fnmatch --- Unix のファイル名パターンマッチ. Unix のファイル名パターンマッチ
* linecache: linecache --- テキストラインへのランダムアクセス. テキストラインへのランダムアクセス
* shutil: shutil --- 高水準のファイル操作. 高水準のファイル操作

pathlib -- オブジェクト指向のファイルシステムパス

* 基本的な使い方: 基本的な使い方<2>.
* 例外: 例外<6>.
* 純粋パス::
* 具象パス::
* Pattern language::
* glob モジュールとの比較::
* os と os.path モジュールの比較: os と os path モジュールの比較.
* プロトコル::

純粋パス

* 全般的な性質::
* 演算子::
* 個別の構成要素へのアクセス::
* メソッドとプロパティ::

具象パス

* URIのパースと生成::
* パスの展開と解決::
* ファイルの種類とステータスを問い合わせる::
* ファイルを読み書きする: ファイルを読み書きする<2>.
* ディレクトリを読む::
* ファイルとディレクトリの作成::
* Copying, moving and deleting: Copying moving and deleting.
* パーミッションと所有者::

os と os.path モジュールの比較

* 対応するツール::

filecmp -- ファイルとディレクトリの比較

* dircmp クラス::

tempfile -- 一時ファイルやディレクトリの作成

* 使用例: 使用例<8>.
* 非推奨の関数と変数::

glob -- Unix 形式のパス名のパターン展開

* 使用例: 使用例<9>.

shutil -- 高水準のファイル操作

* ディレクトリとファイルの操作::
* アーカイブ化操作::
* 出力ターミナルのサイズの取得::

ディレクトリとファイルの操作

* プラットフォーム依存の効率的なコピー操作::
* copytree の例::
* rmtree の例::

アーカイブ化操作

* アーカイブ化の例::
* base_dir を使ったアーカイブ化の例::

データの永続化

* pickle: pickle --- Python オブジェクトの直列化. Python オブジェクトの直列化
* copyreg: copyreg --- pickle サポート関数を登録する. pickle サポート関数を登録する
* shelve: shelve --- Python オブジェクトの永続化. Python オブジェクトの永続化
* marshal: marshal --- 内部使用向けの Python オブジェクト直列化. 内部使用向けの Python オブジェクト直列化
* dbm: dbm --- Unix "データベース" へのインターフェース. Unix "データベース" へのインターフェース
* sqlite3: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース. SQLite データベース用の DB-API 2.0 インターフェース

pickle -- Python オブジェクトの直列化

* 他の Python モジュールとの関係::
* データストリームの形式::
* モジュールインターフェース::
* pickle 化、非 pickle 化できるもの::
* クラスインスタンスの pickle 化::
* 型、関数、その他のオブジェクトに対するリダクションのカスタマイズ::
* アウトオブバウンドバッファ::
* グローバル変数を制限する::
* 性能: 性能<2>.
* 使用例: 使用例<11>.
* コマンドライン・インターフェース::

他の Python モジュールとの関係

* marshal との比較::
* json との比較::

クラスインスタンスの pickle 化

* 外部オブジェクトの永続化::
* ディスパッチテーブル::
* 状態を持つオブジェクトの扱い::

アウトオブバウンドバッファ

* 生産者 API::
* 消費者 API::
* 使用例: 使用例<10>.

copyreg -- pickle サポート関数を登録する

* 使用例: 使用例<12>.

shelve -- Python オブジェクトの永続化

* 制限事項::
* 使用例: 使用例<13>.

dbm -- Unix "データベース" へのインターフェース

* dbm.sqlite3: dbm sqlite3 --- SQLite backend for dbm. SQLite backend for dbm
* dbm.gnu: dbm gnu --- GNU database manager. GNU database manager
* dbm.ndbm: dbm ndbm --- New Database Manager. New Database Manager
* dbm.dumb: dbm dumb --- Portable DBM implementation. Portable DBM implementation

sqlite3 -- SQLite データベース用の DB-API 2.0 インターフェース

* チュートリアル::
* リファレンス::
* ハウツー・ガイド::
* 説明::

リファレンス

* モジュール関数::
* モジュール定数::
* Connection オブジェクト::
* Cursor オブジェクト::
* Row オブジェクト::
* Blob オブジェクト::
* PrepareProtocol オブジェクト::
* 例外: 例外<7>.
* SQLite と Python の型::
* デフォルトの適合関数(adapters)とデフォルトの変換関数(converters)(非推奨): デフォルトの適合関数 adapters とデフォルトの変換関数 converters 非推奨.
* コマンドライン・インターフェース: コマンドライン・インターフェース<2>.

ハウツー・ガイド

* プレースホルダを使用して SQL クエリに値を結び付ける方法::
* カスタム Python 型を SQLite 値に適合させる方法::
* SQLite 値をカスタム Python 型に変換する方法::
* 適合関数と変換関数のレシピ集::
* 接続(connection)ショートカット・メソッドの使い方: 接続 connection ショートカット・メソッドの使い方.
* 接続(connection)コンテキストマネージャの使い方: 接続 connection コンテキストマネージャの使い方.
* SQLite URI の操作方法::
* 行工場(row factories)の作成方法と使用方法: 行工場 row factories の作成方法と使用方法.
* How to handle non-UTF-8 text encodings::

カスタム Python 型を SQLite 値に適合させる方法

* 適合可能オブジェクトの書き方::
* 適合用呼び出し可能オブジェクト(adapter callables)の登録方法: 適合用呼び出し可能オブジェクト adapter callables の登録方法.

説明

* トランザクション制御::

トランザクション制御

* autocommit 属性に依るトランザクション制御::
* isolation_level 属性に依るトランザクション制御::

データ圧縮とアーカイブ

* compression パッケージ::
* compression.zstd: compression zstd --- Compression compatible with the Zstandard format. Compression compatible with the Zstandard format
* zlib: zlib --- gzip 互換の圧縮. gzip 互換の圧縮
* gzip: gzip --- gzip ファイルのサポート. gzip ファイルのサポート
* bz2: bz2 --- bzip2 圧縮のサポート. bzip2 圧縮のサポート
* lzma: lzma --- LZMA アルゴリズムを使用した圧縮. LZMA アルゴリズムを使用した圧縮
* zipfile: zipfile --- ZIP アーカイブの処理. ZIP アーカイブの処理
* tarfile: tarfile --- tar アーカイブファイルの読み書き. tar アーカイブファイルの読み書き

compression.zstd -- Compression compatible with the Zstandard format

* 例外: 例外<8>.
* 圧縮ファイルへの読み書き::
* メモリ上での圧縮と展開::
* Zstandard dictionaries::
* Advanced parameter control::
* その他: その他<3>.
* 使用例: 使用例<14>.

gzip -- gzip ファイルのサポート

* 使い方の例::
* コマンドライン・インターフェース: コマンドライン・インターフェース<3>.

コマンドライン・インターフェース

* コマンドラインオプション::

bz2 -- bzip2 圧縮のサポート

* ファイルの圧縮/解凍::
* 逐次圧縮および展開::
* 一括圧縮/解凍::
* 使い方の例: 使い方の例<2>.

lzma -- LZMA アルゴリズムを使用した圧縮

* 圧縮ファイルへの読み書き: 圧縮ファイルへの読み書き<2>.
* メモリ上での圧縮と展開: メモリ上での圧縮と展開<2>.
* その他: その他<4>.
* カスタムフィルタチェインの指定::
* 使用例: 使用例<15>.

zipfile -- ZIP アーカイブの処理

* ZipFile objects::
* Path objects::
* PyZipFile objects::
* ZipInfo objects::
* コマンドライン・インターフェース: コマンドライン・インターフェース<4>.
* Decompression pitfalls::

コマンドライン・インターフェース

* コマンドラインオプション: コマンドラインオプション<2>.

Decompression pitfalls

* From file itself::
* File system limitations::
* Resources limitations::
* Interruption::
* Default behaviors of extraction::

tarfile -- tar アーカイブファイルの読み書き

* TarFile オブジェクト::
* TarInfo オブジェクト::
* Extraction filters::
* コマンドラインインターフェイス::
* 使用例: 使用例<16>.
* サポートしている tar フォーマット::
* Unicode に関する問題::

Extraction filters

* Default named filters::
* Filter errors::
* Hints for further verification::
* Supporting older Python versions::
* Stateful extraction filter example::

コマンドラインインターフェイス

* コマンドラインオプション: コマンドラインオプション<3>.

使用例

* Reading examples::
* Writing examples::

ファイルフォーマット

* csv: csv --- CSV ファイルの読み書き. CSV ファイルの読み書き
* configparser: configparser --- 設定ファイルのパーサー. 設定ファイルのパーサー
* tomllib: tomllib --- TOML ファイルの解析. TOML ファイルの解析
* netrc: netrc --- netrc ファイルの処理. netrc ファイルの処理
* plistlib: plistlib --- Apple plist ファイルを生成・解析する. Apple .plist ファイルを生成・解析する

csv -- CSV ファイルの読み書き

* モジュールコンテンツ: モジュールコンテンツ<3>.
* Dialect クラスと書式化パラメータ::
* reader オブジェクト::
* writer オブジェクト::
* 使用例: 使用例<17>.

configparser -- 設定ファイルのパーサー

* クイックスタート::
* サポートされるデータ型::
* 代替値::
* サポートするINI ファイルの構造::
* Unnamed Sections::
* 値の補間::
* マップ型プロトコルアクセス::
* パーサーの振る舞いをカスタマイズする::
* レガシーな API の例::
* ConfigParser オブジェクト::
* RawConfigParser オブジェクト::
* 例外: 例外<9>.

tomllib -- TOML ファイルの解析

* 使用例: 使用例<18>.
* 変換表::

netrc -- netrc ファイルの処理

* netrc オブジェクト::

plistlib -- Apple .plist ファイルを生成・解析する

* 使用例: 使用例<19>.

暗号関連のサービス

* hashlib: hashlib --- セキュアハッシュとメッセージダイジェスト. セキュアハッシュとメッセージダイジェスト
* hmac: hmac --- メッセージ認証のための鍵付きハッシュ化. メッセージ認証のための鍵付きハッシュ化
* secrets: secrets --- 機密を扱うために安全な乱数を生成する. 機密を扱うために安全な乱数を生成する

hashlib -- セキュアハッシュとメッセージダイジェスト

* ハッシュアルゴリズム::
* 使用法::
* コンストラクタ::
* 属性::
* Hash Objects::
* SHAKE 可変長ダイジェスト::
* ファイルのハッシュ化::
* 鍵導出::
* BLAKE2::

BLAKE2

* ハッシュオブジェクトの作成::
* 定数: 定数<5>.
* 使用例: 使用例<20>.
* クレジット;: クレジット.

使用例

* 簡単なハッシュ化::
* Using different digest sizes::
* Keyed hashing::
* Randomized hashing::
* Personalization::
* ツリーモード::

secrets -- 機密を扱うために安全な乱数を生成する

* 乱数::
* トークンの生成::
* その他の関数::
* レシピとベストプラクティス::

トークンの生成

* トークンは何バイト使うべきか？::

汎用オペレーティングシステムサービス

* os: os --- 雑多なオペレーティングシステムインターフェース. 雑多なオペレーティングシステムインターフェース
* io: io --- ストリームを扱うコアツール. ストリームを扱うコアツール
* time: time --- 時刻データへのアクセスと変換. 時刻データへのアクセスと変換
* logging: logging --- Python 用のログ記録手段. Python 用のログ記録手段
* logging.config: logging config --- ログ記録の環境設定. ログ記録の環境設定
* logging.handlers: logging handlers --- ログ記録ハンドラー. ログ記録ハンドラー
* platform: platform --- 実行中プラットフォームの固有情報を参照する. 実行中プラットフォームの固有情報を参照する
* errno: errno --- 標準の errno システムシンボル. 標準の errno システムシンボル
* ctypes: ctypes --- Python 用の外部関数ライブラリ. Python 用の外部関数ライブラリ

os -- 雑多なオペレーティングシステムインターフェース

* ファイル名、コマンドライン引数、および環境変数::
* Python UTF-8 Mode::
* プロセスのパラメーター::
* ファイルオブジェクトの生成::
* ファイル記述子の操作::
* ファイルとディレクトリ::
* プロセス管理::
* スケジューラーへのインターフェイス::
* 雑多なシステム情報::
* 乱数: 乱数<2>.

ファイル記述子の操作

* ターミナルのサイズの問い合わせ::
* ファイル記述子の継承::

ファイルとディレクトリ

* Timer File Descriptors::
* Linux 拡張属性::

io -- ストリームを扱うコアツール

* 概要: 概要<2>.
* Text Encoding::
* 高水準のモジュールインターフェイス::
* クラス階層::
* Static Typing::
* 性能: 性能<3>.

概要

* テキスト I/O::
* バイナリ I/O::
* Raw I/O::

Text Encoding

* Opt-in EncodingWarning::

クラス階層

* I/O 基底クラス::
* 生ファイルI/O::
* バッファ付きストリーム::
* テキスト I/O: テキスト I/O<2>.

性能

* バイナリ I/O: バイナリ I/O<2>.
* テキスト I/O: テキスト I/O<3>.
* マルチスレッディング: マルチスレッディング<3>.
* リエントラント性::

time -- 時刻データへのアクセスと変換

* 関数: 関数<5>.
* Clock ID Constants::
* Timezone Constants::

logging -- Python 用のログ記録手段

* ロガーオブジェクト::
* ロギングレベル::
* ハンドラオブジェクト::
* フォーマッタオブジェクト::
* フィルタオブジェクト::
* LogRecord オブジェクト::
* LogRecord 属性::
* LoggerAdapter オブジェクト::
* スレッドセーフ性::
* モジュールレベルの関数::
* モジュールレベル属性::
* warnings モジュールとの統合::

logging.config -- ログ記録の環境設定

* 環境設定のための関数::
* セキュリティで考慮すべき点::
* 環境設定辞書スキーマ::
* 環境設定ファイルの書式::

環境設定辞書スキーマ

* 辞書スキーマの詳細::
* 増分設定::
* オブジェクトの接続::
* ユーザ定義オブジェクト::
* ハンドラの設定順序::
* 外部オブジェクトへのアクセス::
* 内部オブジェクトへのアクセス::
* インポート解決とカスタムインポーター::
* Configuring QueueHandler and QueueListener::

logging.handlers -- ログ記録ハンドラー

* StreamHandler::
* FileHandler::
* NullHandler::
* WatchedFileHandler::
* BaseRotatingHandler::
* RotatingFileHandler::
* TimedRotatingFileHandler::
* SocketHandler::
* DatagramHandler::
* SysLogHandler::
* NTEventLogHandler::
* SMTPHandler::
* MemoryHandler::
* HTTPHandler::
* QueueHandler::
* QueueListener::

platform --  実行中プラットフォームの固有情報を参照する

* Cross platform::
* Java platform::
* Windows platform::
* macOS platform::
* iOS platform::
* Unix platforms::
* Linux platforms::
* Android platform::
* コマンドラインでの使用: コマンドラインでの使用<3>.

ctypes -- Python 用の外部関数ライブラリ

* ctypes チュートリアル::
* ctypesリファレンス::

ctypes チュートリアル

* 動的リンクライブラリをロードする::
* ロードしたdllから関数にアクセスする::
* 関数を呼び出す::
* 基本データ型::
* 続・関数を呼び出す::
* Calling variadic functions::
* 自作のデータ型とともに関数を呼び出す::
* 要求される引数の型を指定する (関数プロトタイプ): 要求される引数の型を指定する 関数プロトタイプ.
* 戻り値の型::
* ポインタを渡す(または、パラメータの参照渡し): ポインタを渡す または、パラメータの参照渡し.
* 構造体と共用体::
* Structure/union layout, alignment and byte order: Structure/union layout alignment and byte order.
* 構造体と共用体におけるビットフィールド::
* 配列: 配列<2>.
* ポインタ::
* Thread safety without the GIL::
* 型変換::
* 不完全型::
* コールバック関数::
* dllからエクスポートされた値へアクセスする::
* びっくり仰天::
* 可変サイズのデータ型::

ctypesリファレンス

* 共有ライブラリを見つける::
* Listing loaded shared libraries::
* 共有ライブラリをロードする::
* 外部関数::
* 関数プロトタイプ::
* ユーティリティー関数::
* データ型: データ型<3>.
* 基本データ型: 基本データ型<2>.
* 構造化データ型::
* 配列とポインタ::
* 例外: 例外<10>.

コマンドラインインターフェースライブラリ

* argparse: argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー. コマンドラインオプションや引数、サブコマンド向けのパーサー
* optparse: optparse --- Parser for command line options. Parser for command line options
* getpass: getpass --- 可搬性のあるパスワード入力機構. 可搬性のあるパスワード入力機構
* fileinput: fileinput --- 複数の入力ストリームをまたいだ行を反復する. 複数の入力ストリームをまたいだ行を反復する
* curses: curses --- 文字セル表示のターミナル処理. 文字セル表示のターミナル処理
* curses.textpad: curses textpad --- Text input widget for curses programs. Text input widget for curses programs
* curses.ascii: curses ascii --- ASCII 文字のユーティリティー. ASCII 文字のユーティリティー
* curses.panel: curses panel --- curses のためのパネルスタック拡張. curses のためのパネルスタック拡張
* cmd: cmd --- 行指向のコマンドインタープリターのサポート. 行指向のコマンドインタープリターのサポート

argparse -- コマンドラインオプションや引数、サブコマンド向けのパーサー

* ArgumentParser オブジェクト::
* add_argument() メソッド: add_argument メソッド.
* parse_args() メソッド: parse_args メソッド.
* その他のユーティリティ::
* 例外: 例外<11>.

ArgumentParser オブジェクト

* prog::
* usage::
* description::
* epilog::
* parents::
* formatter_class::
* prefix_chars::
* fromfile_prefix_chars::
* argument_default::
* allow_abbrev::
* conflict_handler::
* add_help::
* exit_on_error::
* suggest_on_error::
* color::

add_argument() メソッド

* name または flags::
* action::
* nargs::
* const::
* default::
* type::
* choices::
* required::
* help::
* metavar::
* dest::
* deprecated::
* Action クラス::

parse_args() メソッド

* オプション値の文法::
* 不正な引数::
* - を含む引数::
* 引数の短縮形 (先頭文字でのマッチング): 引数の短縮形 先頭文字でのマッチング.
* sys.argv 以外: sys argv 以外.
* Namespace オブジェクト::

その他のユーティリティ

* Subcommands::
* FileType オブジェクト::
* 引数グループ::
* 相互排他::
* パーサーのデフォルト値::
* ヘルプの表示::
* 部分解析::
* ファイル解析のカスタマイズ::
* 終了メソッド::
* 混在した引数の解析::
* Registering custom types or actions::

例外

* Argparse チュートリアル::
* Migrating optparse code to argparse::

Argparse チュートリアル

* コンセプト::
* 基礎::
* 位置引数の入門::
* Optional引数の導入::
* 位置引数とOptional引数の併用::
* もうちょっとだけ学ぶ::
* argparse の出力を翻訳するには::
* Custom type converters::
* 結び::

Optional引数の導入

* 短いオプション::

もうちょっとだけ学ぶ

* 多義性のある引数の指定::
* 競合するオプション::

optparse -- Parser for command line options

* Choosing an argument parsing library::
* はじめに: はじめに<7>.
* 背景::
* チュートリアル: チュートリアル<2>.
* リファレンスガイド::
* オプション処理コールバック::
* Extending optparse::
* 例外: 例外<12>.

背景

* 用語集::
* オプションとは何か::
* 位置引数とは何か::

チュートリアル

* オプション・アクションを理解する::
* store アクション::
* ブール値 (フラグ) オプションの処理: ブール値 フラグ オプションの処理.
* その他のアクション::
* デフォルト値::
* ヘルプの生成::
* バージョン番号の出力::
* How optparse handles errors::
* 全てをつなぎ合わせる::

ヘルプの生成

* オプションをグループ化する::

リファレンスガイド

* parserを作る::
* パーザへのオプション追加::
* オプションの定義::
* オプション属性::
* 標準的なオプション・アクション::
* 標準のオプション型::
* 引数を解析する::
* オプション解析器への問い合わせと操作::
* オプション間の衝突::
* クリーンアップ::
* その他のメソッド::

オプション処理コールバック

* callbackオプションの定義::
* コールバック関数はどのように呼び出されるか::
* コールバック中で例外を送出する::
* コールバックの例 1; ありふれたコールバック: コールバックの例 1 ありふれたコールバック.
* コールバックの例 2; オプションの順番をチェックする: コールバックの例 2 オプションの順番をチェックする.
* コールバックの例 3; オプションの順番をチェックする (汎用的): コールバックの例 3 オプションの順番をチェックする 汎用的.
* コールバックの例 4; 任意の条件をチェックする: コールバックの例 4 任意の条件をチェックする.
* コールバックの例5; 固定引数: コールバックの例5 固定引数.
* コールバックの例6; 可変個の引数: コールバックの例6 可変個の引数.

Extending optparse

* 新しい型の追加::
* 新しいアクションの追加::

curses -- 文字セル表示のターミナル処理

* 関数: 関数<6>.
* Window オブジェクト::
* 定数: 定数<6>.

curses.textpad -- Text input widget for curses programs

* Textbox オブジェクト::

curses.panel -- curses のためのパネルスタック拡張

* 関数: 関数<7>.
* Panel オブジェクト::

cmd -- 行指向のコマンドインタープリターのサポート

* Cmdオブジェクト::
* Cmd の例::

並行実行

* threading: threading --- スレッドベースの並列処理. スレッドベースの並列処理
* multiprocessing: multiprocessing --- プロセスベースの並列処理. プロセスベースの並列処理
* multiprocessing.shared_memory: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ. プロセス間で直接アクセス可能な共有メモリ
* concurrent パッケージ::
* concurrent.futures: concurrent futures --- 並列タスク実行. 並列タスク実行
* concurrent.interpreters: concurrent interpreters --- Multiple interpreters in the same process. Multiple interpreters in the same process
* subprocess: subprocess --- サブプロセス管理. サブプロセス管理
* sched: sched --- イベントスケジューラー. イベントスケジューラー
* queue: queue --- 同期キュークラス. 同期キュークラス
* contextvars: contextvars --- コンテキスト変数. コンテキスト変数
* _thread: _thread --- 低水準なスレッド API. 低水準なスレッド API

threading -- スレッドベースの並列処理

* はじめに: はじめに<8>.
* GIL and performance considerations::
* リファレンス: リファレンス<2>.
* with 文でのロック・条件変数・セマフォの使い方::

リファレンス

* Thread-local data::
* Thread objects::
* Lock objects::
* RLock objects::
* Condition objects::
* Semaphore objects::
* Semaphore example::
* Event objects::
* Timer objects::
* Barrier objects::

multiprocessing -- プロセスベースの並列処理

* はじめに: はじめに<9>.
* リファレンス: リファレンス<3>.
* プログラミングガイドライン::
* 使用例: 使用例<21>.

はじめに

* Process クラス::
* コンテキストと開始方式::
* プロセス間でのオブジェクト交換::
* プロセス間の同期::
* プロセス間での状態の共有::
* ワーカープロセスのプールを使用::

リファレンス

* Global start method::
* Process クラスと例外::
* パイプ (Pipe) とキュー (Queue): パイプ Pipe とキュー Queue.
* その他: その他<5>.
* Connection オブジェクト: Connection オブジェクト<2>.
* 同期プリミティブ::
* 共有 ctypes オブジェクト::
* マネージャー::
* Proxy オブジェクト::
* プロセスプール::
* リスナーとクライアント::
* 認証キー::
* ログ記録: ログ記録<2>.
* The multiprocessing.dummy module: The multiprocessing dummy module.

共有 ctypes オブジェクト

* The multiprocessing.sharedctypes module: The multiprocessing sharedctypes module.

マネージャー

* カスタマイズされたマネージャー::
* リモートマネージャーを使用する::

Proxy オブジェクト

* クリーンアップ: クリーンアップ<2>.

リスナーとクライアント

* アドレスフォーマット::

プログラミングガイドライン

* すべての開始方式について::
* 開始方式が spawn および forkserver の場合::

concurrent.futures -- 並列タスク実行

* Executor オブジェクト::
* ThreadPoolExecutor::
* InterpreterPoolExecutor::
* ProcessPoolExecutor::
* Future オブジェクト::
* モジュール関数: モジュール関数<2>.
* 例外クラス::

ThreadPoolExecutor

* ThreadPoolExecutor の例::

ProcessPoolExecutor

* ProcessPoolExecutor の例::

concurrent.interpreters -- Multiple interpreters in the same process

* Key details::
* はじめに: はじめに<10>.
* リファレンス: リファレンス<4>.
* 基本的な使い方: 基本的な使い方<3>.

はじめに

* Multiple Interpreters and Isolation::
* Running in an Interpreter::
* Concurrency and Parallelism::
* Communication Between Interpreters::
* "Sharing" Objects::

リファレンス

* Interpreter objects::
* 例外: 例外<13>.
* Communicating Between Interpreters::

subprocess -- サブプロセス管理

* Using the subprocess Module::
* セキュリティで考慮すべき点: セキュリティで考慮すべき点<2>.
* Popen オブジェクト::
* Windows Popen ヘルパー::
* 古い高水準 API::
* Replacing Older Functions with the subprocess Module::
* レガシーなシェル呼び出し関数::
* 注釈: 注釈<2>.

Using the subprocess Module

* よく使われる引数::
* Popen コンストラクター::
* 例外: 例外<14>.

Windows Popen ヘルパー

* Windows Constants::

Replacing Older Functions with the subprocess Module

* Replacing /bin/sh shell command substitution::
* シェルのパイプラインを置き換える::
* os.system() を置き換える: os system を置き換える.
* os.spawn 関数群を置き換える: os spawn 関数群を置き換える.
* Replacing os.popen(): Replacing os popen.

注釈

* Timeout Behavior::
* Windows における引数シーケンスから文字列への変換::
* Disable use of posix_spawn(): Disable use of posix_spawn.

sched -- イベントスケジューラー

* スケジューラオブジェクト::

queue -- 同期キュークラス

* キューオブジェクト::
* SimpleQueue オブジェクト::

キューオブジェクト

* Waiting for task completion::
* Terminating queues::

contextvars -- コンテキスト変数

* コンテキスト変数::
* マニュアルでのコンテキスト管理::
* asyncio サポート::

ネットワーク通信とプロセス間通信

* asyncio: asyncio --- 非同期 I/O. 非同期 I/O
* socket: socket --- 低水準ネットワークインターフェース. 低水準ネットワークインターフェース
* ssl: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー. ソケットオブジェクト用の TLS/SSL ラッパー
* select: select --- I/O 完了の待機. I/O 完了の待機
* selectors: selectors --- 高水準の I/O 多重化. 高水準の I/O 多重化
* signal: signal --- 非同期イベントにハンドラーを設定する. 非同期イベントにハンドラーを設定する
* mmap: mmap --- メモリマップファイルのサポート. メモリマップファイルのサポート

asyncio -- 非同期 I/O

* Runners::
* コルーチンと Task::
* ストリーム::
* 同期プリミティブ: 同期プリミティブ<2>.
* サブプロセス::
* キュー::
* 例外: 例外<16>.
* Call Graph Introspection::
* イベントループ::
* Future::
* トランスポートとプロトコル::
* ポリシー::
* プラットフォームでのサポート::
* Extending::
* 高水準の API インデックス::
* 低水準の API インデックス::
* asyncio での開発::

Runners

* 非同期プログラムの実行::
* Runner context manager::
* Handling Keyboard Interruption::

コルーチンと Task

* コルーチン: コルーチン<3>.
* Awaitable::
* Task の作成::
* タスクのキャンセル::
* Task Groups::
* スリープ::
* 並行な Task 実行::
* Eager Task Factory::
* キャンセルからの保護::
* タイムアウト::
* 要素の終了待機::
* スレッド内での実行::
* 外部スレッドからのスケジュール::
* イントロスペクション::
* Task オブジェクト::

Task Groups

* Terminating a Task Group::

ストリーム

* StreamReader::
* StreamWriter::
* 使用例: 使用例<22>.

使用例

* ストリームを使った TCP Echo クライアント::
* ストリームを使った TCP Echo サーバー::
* HTTP ヘッダーの取得::
* ストリームを使ってデータを待つオープンソケットの登録::

同期プリミティブ

* Lock::
* Event::
* Condition::
* Semaphore::
* BoundedSemaphore::
* Barrier::

サブプロセス

* サブプロセスの生成::
* 定数: 定数<7>.
* サブプロセスとやりとりする::

サブプロセスとやりとりする

* サブプロセスとスレッド::
* 使用例: 使用例<23>.

キュー

* Queue::
* 優先度付きのキュー::
* LIFO キュー::
* 例外: 例外<15>.
* 使用例: 使用例<24>.

Call Graph Introspection

* Low level utility functions::

イベントループ

* イベントループのメソッド::
* コールバックのハンドル::
* Serverオブジェクト::
* イベントループの実装::
* 使用例: 使用例<25>.

イベントループのメソッド

* ループの開始と停止::
* コールバックのスケジューリング::
* 遅延コールバックのスケジューリング::
* フューチャーとタスクの生成::
* ネットワーク接続の確立::
* ネットワークサーバの生成::
* ファイルの転送::
* TLS へのアップグレード::
* ファイル記述子の監視::
* ソケットオブジェクトと直接やりとりする::
* DNS::
* パイプとやりとりする::
* Unix シグナル::
* スレッドまたはプロセスプールでコードを実行する::
* エラーハンドリング API::
* デバッグモードの有効化::
* サブプロセスの実行::

使用例

* call_soon() を使った Hello World: call_soon を使った Hello World.
* call_later() で現在の日時を表示する: call_later で現在の日時を表示する.
* 読み込みイベント用ファイル記述子の監視::
* SIGINT および SIGTERM 用のシグナルハンドラーの設定::

Future

* Future の関数::
* Future オブジェクト: Future オブジェクト<2>.

トランスポートとプロトコル

* トランスポート::
* プロトコル: プロトコル<2>.
* 使用例: 使用例<26>.

トランスポート

* トランスポートのクラス階層構造::
* 基底トランスポート::
* 読み出し専用のトランスポート::
* 書き込み専用のトランスポート::
* データグラムトランスポート::
* サブプロセス化されたトランスポート::

プロトコル

* 基底プロトコル::
* 基底プロトコル: 基底プロトコル<2>.
* ストリーミングプロトコル::
* バッファリングされたストリーミングプロトコル::
* データグラムプロトコル::
* サブプロセスプロトコル::

使用例

* TCP エコーサーバー::
* TCP エコークライアント::
* UDP エコーサーバー::
* UDP エコークライアント::
* 既存のソケットへの接続::
* loop.subprocess_exec() と SubprocessProtocol: loop subprocess_exec と SubprocessProtocol.

ポリシー

* ポリシーの取得と設定::
* ポリシーオブジェクト::
* ポリシーのカスタマイズ::

プラットフォームでのサポート

* 全てのプラットホーム::
* Windows: Windows<84>.
* macOS: macOS<52>.

Windows

* Windows におけるサブプロセスのサポート::

Extending

* Writing a Custom Event Loop::
* Future and Task private constructors::
* Task lifetime support::

高水準の API インデックス

* Task::
* キュー: キュー<2>.
* サブプロセス: サブプロセス<2>.
* ストリーム: ストリーム<2>.
* 同期::
* 例外: 例外<17>.

低水準の API インデックス

* イベントループの取得::
* イベントループのメソッド: イベントループのメソッド<2>.
* トランスポート: トランスポート<2>.
* プロトコル: プロトコル<3>.
* イベントループのポリシー::

asyncio での開発

* デバッグモード::
* 並行処理とマルチスレッド処理::
* ブロッキングコードの実行::
* ログ記録: ログ記録<3>.
* 待ち受け処理を伴わないコルーチンの検出::
* 回収されない例外の検出::

socket -- 低水準ネットワークインターフェース

* ソケットファミリー::
* モジュールの内容::
* socket オブジェクト::
* ソケットタイムアウトの注意事項::
* 使用例: 使用例<27>.

モジュールの内容

* 例外: 例外<18>.
* 定数: 定数<8>.
* 関数: 関数<8>.

関数

* ソケットの作成::
* その他の関数: その他の関数<2>.

ソケットタイムアウトの注意事項

* タイムアウトと connect メソッド::
* タイムアウトと accept メソッド::

ssl -- ソケットオブジェクト用の TLS/SSL ラッパー

* 関数、定数、例外::
* SSL ソケット::
* SSL コンテキスト::
* 証明書::
* 使用例: 使用例<28>.
* ノンブロッキングソケットについての注意事項::
* メモリ BIO サポート: メモリ BIO サポート<2>.
* SSL セッション::
* セキュリティで考慮すべき点: セキュリティで考慮すべき点<3>.
* TLS 1.3: TLS 1 3.

関数、定数、例外

* ソケットの作成: ソケットの作成<2>.
* コンテキストの作成::
* 例外: 例外<19>.
* 乱数生成::
* 証明書の取り扱い::
* 定数: 定数<9>.

証明書

* 証明書チェイン::
* CA 証明書::
* 秘密鍵と証明書の組み合わせ::
* 自己署名証明書::

使用例

* SSLサポートをテストする::
* クライアントサイドの処理::
* サーバサイドの処理::

セキュリティで考慮すべき点

* 最善のデフォルト値::
* 手動での設定::
* マルチプロセス化::

手動での設定

* 証明書の検証::
* プロトコルのバージョン::
* 暗号の選択::

select -- I/O 完了の待機

* /dev/poll ポーリングオブジェクト::
* エッジおよびレベルトリガポーリング (epoll) オブジェクト: エッジおよびレベルトリガポーリング epoll オブジェクト.
* ポーリングオブジェクト::
* kqueue オブジェクト::
* kevent オブジェクト::

selectors -- 高水準の I/O 多重化

* はじめに: はじめに<11>.
* クラス: クラス<4>.
* 使用例: 使用例<29>.

signal -- 非同期イベントにハンドラーを設定する

* 一般的なルール::
* モジュールの内容: モジュールの内容<2>.
* 使用例: 使用例<30>.
* Note on SIGPIPE::
* Note on Signal Handlers and Exceptions::

一般的なルール

* Python のシグナルハンドラの実行::
* シグナルとスレッド::

mmap -- メモリマップファイルのサポート

* MADV_* 定数::
* MAP_* 定数::

インターネット上のデータの操作

* email: email --- 電子メールと MIME 処理のためのパッケージ. 電子メールと MIME 処理のためのパッケージ
* json: json --- JSON エンコーダーとデコーダー. JSON エンコーダーとデコーダー
* mailbox: mailbox --- 様々な形式のメールボックスを操作する. 様々な形式のメールボックスを操作する
* mimetypes: mimetypes --- ファイル名を MIME タイプへマップする. ファイル名を MIME タイプへマップする
* base64: base64 --- Base16 Base32 Base64 Base85 データのエンコード. Base16, Base32, Base64, Base85 データのエンコード
* binascii: binascii --- バイナリ と ASCII 間の変換. バイナリ と ASCII 間の変換
* quopri: quopri --- MIME quoted-printable データのエンコードとデコード. MIME quoted-printable データのエンコードとデコード

email -- 電子メールと MIME 処理のためのパッケージ

* email.message; Representing an email message: email message Representing an email message.
* email.parser; Parsing email messages: email parser Parsing email messages.
* email.generator; Generating MIME documents: email generator Generating MIME documents.
* email.policy; Policy Objects: email policy Policy Objects.
* email.errors; Exception and Defect classes: email errors Exception and Defect classes.
* email.headerregistry; Custom Header Objects: email headerregistry Custom Header Objects.
* email.contentmanager; Managing MIME Content: email contentmanager Managing MIME Content.
* email; 使用例: email 使用例.
* email.message.Message; compat32 API を使用した電子メールメッセージの表現: email message Message compat32 API を使用した電子メールメッセージの表現.
* email.mime; Creating email and MIME objects from scratch: email mime Creating email and MIME objects from scratch.
* email.header; 国際化されたヘッダー: email header 国際化されたヘッダー.
* email.charset; 文字集合の表現: email charset 文字集合の表現.
* email.encoders; エンコーダー: email encoders エンコーダー.
* email.utils; Miscellaneous utilities: email utils Miscellaneous utilities.
* email.iterators; イテレータ: email iterators イテレータ.

email.parser: Parsing email messages

* FeedParser API::
* Parser API::
* 追記事項::

email.contentmanager: Managing MIME Content

* Content Manager Instances::

json -- JSON エンコーダーとデコーダー

* 基本的な使い方: 基本的な使い方<4>.
* エンコーダとデコーダ::
* 例外: 例外<20>.
* 標準への準拠と互換性::
* コマンドライン・インターフェース: コマンドライン・インターフェース<5>.

標準への準拠と互換性

* 文字エンコーディング::
* 無限および NaN の数値::
* オブジェクト中に重複した名前の扱い::
* トップレベルの非オブジェクト、非配列の値の扱い::
* 実装の制限::

コマンドライン・インターフェース

* コマンドラインオプション: コマンドラインオプション<4>.

mailbox -- 様々な形式のメールボックスを操作する

* Mailbox オブジェクト::
* Message オブジェクト::
* 例外: 例外<21>.
* 使用例: 使用例<31>.

Mailbox オブジェクト

* Maildir オブジェクト::
* mbox オブジェクト::
* MH オブジェクト::
* Babyl オブジェクト::
* MMDF オブジェクト::

Message オブジェクト

* MaildirMessage オブジェクト::
* mboxMessage オブジェクト::
* MHMessage オブジェクト::
* BabylMessage オブジェクト::
* MMDFMessage オブジェクト::

mimetypes -- ファイル名を MIME タイプへマップする

* MimeTypes objects::
* コマンドラインでの使用: コマンドラインでの使用<4>.
* コマンドラインの例: コマンドラインの例<2>.

base64 -- Base16, Base32, Base64, Base85 データのエンコード

* RFC 4648 エンコーディング::
* Base85 エンコーディング::
* レガシーインターフェース::
* セキュリティで考慮すべき点: セキュリティで考慮すべき点<4>.

構造化マークアップツール

* html: html --- HyperText Markup Language のサポート. HyperText Markup Language のサポート
* html.parser: html parser --- HTML と XHTML のシンプルなパーサー. HTML と XHTML のシンプルなパーサー
* html.entities: html entities --- HTML 一般実体の定義. HTML 一般実体の定義
* XMLを扱うモジュール群::
* xml.etree.ElementTree: xml etree ElementTree --- ElementTree XML API. ElementTree XML API
* xml.dom: xml dom --- ドキュメントオブジェクトモデル API. ドキュメントオブジェクトモデル API
* xml.dom.minidom: xml dom minidom --- 最小限の DOM の実装. 最小限の DOM の実装
* xml.dom.pulldom: xml dom pulldom --- 部分的な DOM ツリー構築のサポート. 部分的な DOM ツリー構築のサポート
* xml.sax: xml sax --- SAX2 バーサーのサポート. SAX2 バーサーのサポート
* xml.sax.handler: xml sax handler --- SAX ハンドラーの基底クラス. SAX ハンドラーの基底クラス
* xml.sax.saxutils: xml sax saxutils --- SAX ユーティリティー. SAX ユーティリティー
* xml.sax.xmlreader: xml sax xmlreader --- XML パーサーのインターフェース. XML パーサーのインターフェース
* xml.parsers.expat: xml parsers expat --- Expat を使用した高速な XML 解析. Expat を使用した高速な XML 解析

html.parser -- HTML と XHTML のシンプルなパーサー

* HTML パーサーアプリケーションの例::
* HTMLParser メソッド::
* 使用例: 使用例<32>.

XMLを扱うモジュール群

* XML security::

xml.etree.ElementTree -- ElementTree XML API

* チュートリアル: チュートリアル<3>.
* XPath サポート::
* リファレンス: リファレンス<5>.
* XInclude サポート::
* リファレンス: リファレンス<6>.

チュートリアル

* XML 木構造と要素::
* XML の解析::
* 非ブロックパースのためのプル API::
* 関心ある要素の検索::
* XML ファイルの編集::
* XML 文書の構築::
* 名前空間のある XML の解析::

XPath サポート

* 使用例: 使用例<33>.
* サポートされている XPath 構文::

リファレンス

* 関数: 関数<9>.

XInclude サポート

* 使用例: 使用例<34>.

リファレンス

* 関数: 関数<10>.
* Element オブジェクト::
* ElementTree オブジェクト::
* QName オブジェクト::
* TreeBuilder オブジェクト::
* XMLParser オブジェクト::
* XMLPullParser オブジェクト::
* 例外: 例外<22>.

xml.dom -- ドキュメントオブジェクトモデル API

* モジュールコンテンツ: モジュールコンテンツ<4>.
* DOM 内のオブジェクト::
* 適合性::

DOM 内のオブジェクト

* DOMImplementation オブジェクト::
* Node オブジェクト::
* NodeList オブジェクト::
* DocumentType オブジェクト::
* Document オブジェクト::
* Element オブジェクト: Element オブジェクト<2>.
* Attr オブジェクト::
* NamedNodeMap Objects::
* Comment オブジェクト::
* Text オブジェクトおよび CDATASection オブジェクト::
* ProcessingInstruction オブジェクト::
* 例外: 例外<23>.

適合性

* 型の対応付け::
* アクセサメソッド::

xml.dom.minidom -- 最小限の DOM の実装

* DOM オブジェクト::
* DOM の例::
* minidom と DOM 標準::

xml.dom.pulldom -- 部分的な DOM ツリー構築のサポート

* DOMEventStream オブジェクト::

xml.sax -- SAX2 バーサーのサポート

* SAXException オブジェクト::

xml.sax.handler -- SAX ハンドラーの基底クラス

* ContentHandler オブジェクト::
* DTDHandler オブジェクト::
* EntityResolver オブジェクト::
* ErrorHandler オブジェクト::
* LexicalHandler Objects::

xml.sax.xmlreader -- XML パーサーのインターフェース

* XMLReader オブジェクト::
* IncrementalParser オブジェクト::
* Locator オブジェクト::
* InputSource オブジェクト::
* Attributes インターフェース::
* AttributesNS インターフェース::

xml.parsers.expat -- Expat を使用した高速な XML 解析

* XMLParser オブジェクト: XMLParser オブジェクト<2>.
* ExpatError 例外::
* 使用例: 使用例<35>.
* 内容モデルの記述::
* Expat エラー定数::

インターネットプロトコルとサポート

* webbrowser: webbrowser --- 便利なウェブブラウザコントローラー. 便利なウェブブラウザコントローラー
* wsgiref: wsgiref --- WSGI ユーティリティとリファレンス実装. WSGI ユーティリティとリファレンス実装
* urllib: urllib --- URL を扱うモジュール群. URL を扱うモジュール群
* urllib.request: urllib request --- URL を開くための大規模なライブラリ. URL を開くための大規模なライブラリ
* urllib.response: urllib response --- Response classes used by urllib. Response classes used by urllib
* urllib.parse: urllib parse --- URL を構成要素に解析する. URL を構成要素に解析する
* urllib.error: urllib error --- urllib request によって送出される例外クラス. urllib.request によって送出される例外クラス
* urllib.robotparser: urllib robotparser --- robots txt 用のパーサー. robots.txt 用のパーサー
* http: http --- HTTP モジュール群. HTTP モジュール群
* http.client: http client --- HTTP プロトコルクライアント. HTTP プロトコルクライアント
* ftplib: ftplib --- FTP プロトコルクライアント. FTP プロトコルクライアント
* poplib: poplib --- POP3 プロトコルクライアント. POP3 プロトコルクライアント
* imaplib: imaplib --- IMAP4 プロトコルクライアント. IMAP4 プロトコルクライアント
* smtplib: smtplib --- SMTP プロトコルクライアント. SMTP プロトコルクライアント
* uuid: uuid --- RFC 9562 に基づく UUID オブジェクト. RFC 9562 に基づく UUID オブジェクト
* socketserver: socketserver --- ネットワークサーバーのフレームワーク. ネットワークサーバーのフレームワーク
* http.server: http server --- HTTP サーバー. HTTP サーバー
* http.cookies: http cookies --- HTTP の状態管理. HTTP の状態管理
* http.cookiejar: http cookiejar --- HTTP クライアント用の Cookie 処理. HTTP クライアント用の Cookie 処理
* xmlrpc: xmlrpc --- XMLRPC サーバーとクライアントモジュール群. XMLRPC サーバーとクライアントモジュール群
* xmlrpc.client: xmlrpc client --- XML-RPC クライアントアクセス. XML-RPC クライアントアクセス
* xmlrpc.server: xmlrpc server --- 基本的な XML-RPC サーバー. 基本的な XML-RPC サーバー
* ipaddress: ipaddress --- IPv4/IPv6 操作ライブラリ. IPv4/IPv6 操作ライブラリ

webbrowser -- 便利なウェブブラウザコントローラー

* コマンドライン・インターフェース: コマンドライン・インターフェース<6>.
* Browser controller objects::

wsgiref -- WSGI ユーティリティとリファレンス実装

* wsgiref.util: wsgiref util -- WSGI environment utilities. WSGI environment utilities
* wsgiref.headers: wsgiref headers -- WSGI response header tools. WSGI response header tools
* wsgiref.simple_server: wsgiref simple_server -- a simple WSGI HTTP server. a simple WSGI HTTP server
* wsgiref.validate: wsgiref validate --- WSGI conformance checker. WSGI conformance checker
* wsgiref.handlers: wsgiref handlers -- server/gateway base classes. server/gateway base classes
* wsgiref.types: wsgiref types -- WSGI types for static type checking. WSGI types for static type checking
* 使用例: 使用例<36>.

urllib.request -- URL を開くための大規模なライブラリ

* Request オブジェクト::
* OpenerDirector オブジェクト::
* BaseHandler オブジェクト::
* HTTPRedirectHandler オブジェクト::
* HTTPCookieProcessor オブジェクト::
* ProxyHandler オブジェクト::
* HTTPPasswordMgr オブジェクト::
* HTTPPasswordMgrWithPriorAuth オブジェクト::
* AbstractBasicAuthHandler オブジェクト::
* HTTPBasicAuthHandler オブジェクト::
* ProxyBasicAuthHandler オブジェクト::
* AbstractDigestAuthHandler オブジェクト::
* HTTPDigestAuthHandler オブジェクト::
* ProxyDigestAuthHandler オブジェクト::
* HTTPHandler オブジェクト::
* HTTPSHandler オブジェクト::
* FileHandler オブジェクト::
* DataHandler オブジェクト::
* FTPHandler オブジェクト::
* CacheFTPHandler オブジェクト::
* UnknownHandler オブジェクト::
* HTTPErrorProcessor オブジェクト::
* 使用例: 使用例<37>.
* レガシーインターフェース: レガシーインターフェース<2>.
* urllib.request Restrictions: urllib request Restrictions.

urllib.parse -- URL を構成要素に解析する

* URL の解析::
* URL parsing security::
* ASCII エンコードバイト列の解析::
* 構造化された解析結果::
* URL のクオート::

http -- HTTP モジュール群

* HTTP ステータスコード::
* HTTP ステータスコードカテゴリ::
* HTTP メソッド::

http.client -- HTTP プロトコルクライアント

* HTTPConnection オブジェクト::
* HTTPResponse オブジェクト::
* 使用例: 使用例<38>.
* HTTPMessage オブジェクト::

ftplib -- FTP プロトコルクライアント

* リファレンス: リファレンス<7>.

リファレンス

* FTP オブジェクト::
* FTP_TLS オブジェクト::
* モジュール変数::

poplib -- POP3 プロトコルクライアント

* POP3 オブジェクト::
* POP3 の例::

imaplib -- IMAP4 プロトコルクライアント

* IMAP4 オブジェクト::
* IMAP4 の使用例::

smtplib -- SMTP プロトコルクライアント

* SMTP オブジェクト::
* SMTP 使用例::

uuid -- RFC 9562 に基づく UUID オブジェクト

* コマンドラインからの使用::
* 使用例: 使用例<39>.
* Command-Line Example::

socketserver -- ネットワークサーバーのフレームワーク

* サーバ生成に関するノート::
* Serverオブジェクト: Serverオブジェクト<2>.
* Request Handler Objects::
* 使用例: 使用例<40>.

使用例

* socketserver.TCPServer の例: socketserver TCPServer の例.
* socketserver.UDPServer の例: socketserver UDPServer の例.
* 非同期処理の Mix-in::

http.server -- HTTP サーバー

* コマンドライン・インターフェース: コマンドライン・インターフェース<7>.
* セキュリティで考慮すべき点: セキュリティで考慮すべき点<5>.

http.cookies -- HTTP の状態管理

* Cookieオブジェクト::
* Morselオブジェクト::
* 使用例: 使用例<41>.

http.cookiejar -- HTTP クライアント用の Cookie 処理

* CookieJar および FileCookieJar オブジェクト::
* FileCookieJar のサブクラスと web ブラウザとの連携::
* CookiePolicy オブジェクト::
* DefaultCookiePolicy オブジェクト::
* Cookieオブジェクト: Cookieオブジェクト<2>.
* 使用例: 使用例<42>.

xmlrpc.client -- XML-RPC クライアントアクセス

* ServerProxy オブジェクト::
* DateTime オブジェクト::
* Binary オブジェクト::
* Fault オブジェクト::
* ProtocolError オブジェクト::
* MultiCall オブジェクト::
* 補助関数::
* クライアントのサンプル::
* クライアントとサーバーの利用例::

xmlrpc.server -- 基本的な XML-RPC サーバー

* SimpleXMLRPCServer オブジェクト::
* CGIXMLRPCRequestHandler::
* XMLRPC サーバの文書化::
* DocXMLRPCServer オブジェクト::
* DocCGIXMLRPCRequestHandler::

SimpleXMLRPCServer オブジェクト

* SimpleXMLRPCServer の例::

ipaddress -- IPv4/IPv6 操作ライブラリ

* 便利なファクトリ関数::
* IP アドレス::
* IP ネットワーク定義::
* インターフェイスオブジェクト::
* その他のモジュールレベル関数::
* Custom Exceptions::

IP アドレス

* Address オブジェクト::
* 文字列と整数への変換::
* 演算子: 演算子<2>.

演算子

* 比較演算子::
* 算術演算::

IP ネットワーク定義

* プリフィックス, ネットマスク、ホストマスク: プリフィックス ネットマスク、ホストマスク.
* Network オブジェクト::
* 演算子: 演算子<3>.

演算子

* 論理演算子::
* イテレーション::
* アドレスのコンテナとしてのネットワーク::

インターフェイスオブジェクト

* 演算子: 演算子<4>.

演算子

* 論理演算子: 論理演算子<2>.

マルチメディアサービス

* wave: wave --- WAV ファイルの読み書き. WAV ファイルの読み書き
* colorsys: colorsys --- 色体系間の変換. 色体系間の変換

wave -- WAV ファイルの読み書き

* Wave_read オブジェクト::
* Wave_write オブジェクト::

国際化

* gettext: gettext --- 多言語国際化サービス. 多言語国際化サービス
* locale: locale --- 国際化サービス. 国際化サービス

gettext -- 多言語国際化サービス

* GNU gettext API::
* クラス形式の API::
* プログラムやモジュールを国際化する::
* 謝辞: 謝辞<9>.

クラス形式の API

* NullTranslations クラス::
* GNUTranslations クラス::
* Solaris メッセージカタログ機構のサポート::
* Catalog コンストラクタ::

プログラムやモジュールを国際化する

* モジュールを地域化する::
* アプリケーションを地域化する::
* 動作中 (on the fly) に言語を切り替える: 動作中 on the fly に言語を切り替える.
* 翻訳処理の遅延解決::

locale -- 国際化サービス

* ロケールの背景、詳細、ヒント、助言および補足説明::
* Locale names::
* Python 拡張の作者と、Python を埋め込むようなプログラムに関して::
* メッセージカタログへのアクセス::

Graphical user interfaces with Tk

* tkinter: tkinter --- Tcl/Tk の Python インターフェース. Tcl/Tk の Python インターフェース
* tkinter.colorchooser: tkinter colorchooser --- カラー選択ダイアログ. カラー選択ダイアログ
* tkinter.font: tkinter font --- Tkinter フォントラッパー. Tkinter フォントラッパー
* Tkinter ダイアログ::
* tkinter.messagebox: tkinter messagebox --- Tkinter メッセージプロンプト. Tkinter メッセージプロンプト
* tkinter.scrolledtext: tkinter scrolledtext --- スクロール可能なテキストウィジェット. スクロール可能なテキストウィジェット
* tkinter.dnd: tkinter dnd --- ドラッグアンドドロップのサポート. ドラッグアンドドロップのサポート
* tkinter.ttk: tkinter ttk --- Tk のテーマ付きウィジェット. Tk のテーマ付きウィジェット
* IDLE: IDLE --- Python のエディタとシェル<2>. Python のエディタとシェル
* turtle: turtle --- Turtle graphics. Turtle graphics

tkinter -- Tcl/Tk の Python インターフェース

* Architecture::
* Tkinter モジュール::
* Tkinter お助け手帳::
* Threading model::
* 簡単なリファレンス::
* ファイルハンドラ::

Tkinter お助け手帳

* A Hello World Program::
* Important Tk Concepts::
* Understanding How Tkinter Wraps Tcl/Tk::
* How do I...? What option does...?: How do I ? What option does ?.
* Navigating the Tcl/Tk Reference Manual::

簡単なリファレンス

* オプションの設定::
* Packer::
* Packer のオプション::
* ウィジェット変数を関連付ける::
* ウィンドウマネージャ::
* Tk オプションデータ型::
* バインドとイベント::
* index パラメータ::
* 画像::

Tkinter ダイアログ

* tkinter.simpledialog: tkinter simpledialog --- Standard Tkinter input dialogs. Standard Tkinter input dialogs
* tkinter.filedialog: tkinter filedialog --- File selection dialogs. File selection dialogs
* tkinter.commondialog: tkinter commondialog --- Dialog window templates. Dialog window templates

tkinter.filedialog -- File selection dialogs

* ネイティブの読み込み/保存ダイアログ::

tkinter.ttk -- Tk のテーマ付きウィジェット

* Ttk を使う::
* Ttk ウィジェット::
* ウィジェット::
* コンボボックス::
* Spinbox::
* ノートブック::
* プログレスバー::
* セパレータ::
* サイズグリップ::
* ツリービュー::
* Ttk スタイル::

ウィジェット

* 標準オプション::
* スクロール可能ウィジェットのオプション::
* ラベルオプション::
* 互換性オプション::
* ウィジェットの状態::
* ttk.Widget: ttk Widget.

コンボボックス

* オプション::
* 仮想イベント::
* ttk.Combobox: ttk Combobox.

Spinbox

* オプション: オプション<2>.
* 仮想イベント: 仮想イベント<2>.
* ttk.Spinbox: ttk Spinbox.

ノートブック

* オプション: オプション<3>.
* タブオプション::
* タブ識別子::
* 仮想イベント: 仮想イベント<3>.
* ttk.Notebook: ttk Notebook.

プログレスバー

* オプション: オプション<4>.
* ttk.Progressbar: ttk Progressbar.

セパレータ

* オプション: オプション<5>.

サイズグリップ

* プラットフォーム固有のメモ::
* バグ::

ツリービュー

* オプション: オプション<6>.
* 要素オプション::
* タグオプション::
* カラム識別子::
* 仮想イベント: 仮想イベント<4>.
* ttk.Treeview: ttk Treeview.

Ttk スタイル

* レイアウト::

IDLE -- Python のエディタとシェル

* メニュー::
* Editing and Navigation::
* Startup and Code Execution::
* Help and Preferences::
* idlelib: idlelib --- implementation of IDLE application. implementation of IDLE application

メニュー

* File メニュー (Shell ウィンドウ、Editor ウィンドウ): File メニュー Shell ウィンドウ、Editor ウィンドウ.
* Edit メニュー (Shell ウィンドウ、Editor ウィンドウ): Edit メニュー Shell ウィンドウ、Editor ウィンドウ.
* Format メニュー (Shell ウィンドウ、Editor ウィンドウ): Format メニュー Shell ウィンドウ、Editor ウィンドウ.
* Run メニュー (Editor ウィンドウのみ): Run メニュー Editor ウィンドウのみ.
* Shell メニュー (Shell ウィンドウのみ): Shell メニュー Shell ウィンドウのみ.
* Debug メニュー (Shell ウィンドウのみ): Debug メニュー Shell ウィンドウのみ.
* Options メニュー (Shell ウィンドウ、Editor ウィンドウ): Options メニュー Shell ウィンドウ、Editor ウィンドウ.
* Window メニュー (Shell ウィンドウ、Editor ウィンドウ): Window メニュー Shell ウィンドウ、Editor ウィンドウ.
* Help メニュー (Shell ウィンドウ、Editor ウィンドウ): Help メニュー Shell ウィンドウ、Editor ウィンドウ.
* Context menus::

Editing and Navigation

* Editor windows::
* Key bindings::
* 自動的な字下げ::
* 検索と置換::
* 補完 (Completions): 補完 Completions.
* 呼び出しヒント (Calltips): 呼び出しヒント Calltips.
* Format block::
* Code Context::
* Shell window::
* テキストの色::

Startup and Code Execution

* コマンドラインでの使用: コマンドラインでの使用<5>.
* Startup failure::
* Running user code::
* User output in Shell::
* Developing tkinter applications::
* サブプロセスを起こさずに起動する::

Help and Preferences

* Help sources::
* Setting preferences [お好み設定]::
* IDLE on macOS::
* Extensions [拡張]::

turtle -- Turtle graphics

* はじめに: はじめに<12>.
* Get started::
* チュートリアル: チュートリアル<4>.
* How to...: How to.
* Turtle graphics reference::
* RawTurtle/Turtle のメソッドと対応する関数::
* TurtleScreen/Screen のメソッドと対応する関数::
* Public classes::
* 説明: 説明<2>.
* ヘルプと設定::
* turtledemo: turtledemo --- Demo scripts. Demo scripts
* python 2.6からの変更点: python 2 6からの変更点.
* python 3.0からの変更点: python 3 0からの変更点.

チュートリアル

* Starting a turtle environment::
* Basic drawing::
* Making algorithmic patterns::

Basic drawing

* Pen の制御::
* The turtle's position::

How to...

* Get started as quickly as possible::
* Automatically begin and end filling::
* Use the turtle module namespace::
* Use turtle graphics in a script::
* Use object-oriented turtle graphics::

Turtle graphics reference

* Turtle のメソッド::
* TurtleScreen/Screen のメソッド::

RawTurtle/Turtle のメソッドと対応する関数

* Turtle の動き::
* Turtle の状態を知る::
* 設定と計測::
* Pen の制御: Pen の制御<2>.
* タートルの状態::
* イベントを利用する::
* 特別な Turtle のメソッド::
* Compound shapes::

Pen の制御

* 描画状態::
* 色の制御: 色の制御<2>.
* 塗りつぶし::
* さらなる描画の制御::

タートルの状態

* 可視性::
* 見た目::

TurtleScreen/Screen のメソッドと対応する関数

* ウィンドウの制御::
* アニメーションの制御::
* スクリーンイベントを利用する::
* 入力メソッド::
* 設定と特殊なメソッド::
* Screen 独自のメソッド、TurtleScreen から継承したもの以外::

ヘルプと設定

* ヘルプの使い方::
* ドキュメント文字列の翻訳::
* Screen および Turtle の設定方法::

開発ツール

* typing: typing --- Support for type hints. Support for type hints
* pydoc: pydoc --- ドキュメント生成とオンラインヘルプシステム. ドキュメント生成とオンラインヘルプシステム
* Python 開発モード::
* doctest: doctest --- 対話型の Python の例をテストする. 対話型の Python の例をテストする
* unittest: unittest --- ユニットテストフレームワーク. ユニットテストフレームワーク
* unittest.mock: unittest mock --- モックオブジェクトライブラリ. モックオブジェクトライブラリ
* unittest.mock: unittest mock --- 入門. 入門
* test: test --- Regression tests package for Python. Regression tests package for Python
* test.support: test support --- Utilities for the Python test suite. Utilities for the Python test suite
* test.support.socket_helper: test support socket_helper --- Utilities for socket tests. Utilities for socket tests
* test.support.script_helper: test support script_helper --- Utilities for the Python execution tests. Utilities for the Python execution tests
* test.support.bytecode_helper: test support bytecode_helper --- Support tools for testing correct bytecode generation. Support tools for testing correct bytecode
                                generation
* test.support.threading_helper: test support threading_helper --- Utilities for threading tests. Utilities for threading tests
* test.support.os_helper: test support os_helper --- Utilities for os tests. Utilities for os tests
* test.support.import_helper: test support import_helper --- Utilities for import tests. Utilities for import tests
* test.support.warnings_helper: test support warnings_helper --- Utilities for warnings tests. Utilities for warnings tests

typing -- Support for type hints

* Python 型システムの仕様::
* 型エイリアス::
* NewType::
* 呼び出し可能オブジェクトのアノテーション::
* ジェネリクス::
* タプルのアノテーション::
* クラスオブジェクトの型::
* Annotating generators and coroutines::
* ユーザー定義のジェネリック型::
* Any 型::
* 名前的部分型 vs 構造的部分型::
* モジュールの内容: モジュールの内容<3>.
* メジャーな機能の非推奨時系列::

モジュールの内容

* 特殊型付けプリミティブ::
* プロトコル: プロトコル<4>.
* ABCs and Protocols for working with I/O::
* Functions and decorators::
* Introspection helpers::
* 定数: 定数<10>.
* 非推奨のエイリアス::

特殊型付けプリミティブ

* 特殊型::
* 特殊形式::
* Building generic types and type aliases::
* Other special directives::

非推奨のエイリアス

* Aliases to built-in types::
* Aliases to types in collections::
* Aliases to other concrete types::
* Aliases to container ABCs in collections.abc: Aliases to container ABCs in collections abc.
* Aliases to asynchronous ABCs in collections.abc: Aliases to asynchronous ABCs in collections abc.
* Aliases to other ABCs in collections.abc: Aliases to other ABCs in collections abc.
* Aliases to contextlib ABCs::

Python 開発モード

* Python 開発モードの影響::
* ResourceWarning の例::
* Bad file descriptor error example::

doctest -- 対話型の Python の例をテストする

* 簡単な利用法; docstring 中の実行例をチェックする: 簡単な利用法 docstring 中の実行例をチェックする.
* 簡単な利用法; テキストファイル中の実行例をチェックする: 簡単な利用法 テキストファイル中の実行例をチェックする.
* コマンドラインでの使用: コマンドラインでの使用<6>.
* doctest のからくり::
* 基本 API::
* 単体テスト API::
* 拡張 API::
* デバッグ::
* アドバイス::

doctest のからくり

* どの docstring が検証されるのか?::
* docstring 内の実行例をどのように認識するのか?::
* 実行コンテキストとは何か?::
* 例外はどう扱えばよいか?::
* オプションフラグ::
* ディレクティブ (Directives): ディレクティブ Directives.
* 警告: 警告<2>.

拡張 API

* DocTest オブジェクト::
* Example オブジェクト::
* DocTestFinder オブジェクト::
* DocTestParser オブジェクト::
* TestResults objects::
* DocTestRunner オブジェクト::
* OutputChecker オブジェクト::

unittest -- ユニットテストフレームワーク

* 基本的な例: 基本的な例<2>.
* コマンドラインインターフェイス: コマンドラインインターフェイス<2>.
* テストディスカバリ::
* テストコードの構成::
* 既存テストコードの再利用::
* テストのスキップと予期された失敗::
* サブテストを利用して繰り返しテストの区別を付ける::
* クラスと関数::
* クラスとモジュールのフィクスチャ::
* シグナルハンドリング::

コマンドラインインターフェイス

* コマンドラインオプション: コマンドラインオプション<5>.

クラスと関数

* テストクラス::
* テストのグループ化::
* テストのロードと起動::

テストのロードと起動

* load_tests プロトコル::

クラスとモジュールのフィクスチャ

* setUpClass と tearDownClass::
* setUpModule と tearDownModule::

unittest.mock -- モックオブジェクトライブラリ

* クイックガイド::
* Mock クラス::
* patcher::
* MagicMock と magic method のサポート::
* ヘルパー::
* Order of precedence of side_effect, return_value and wraps: Order of precedence of side_effect return_value and wraps.

Mock クラス

* 呼び出し::
* 属性の削除::
* Mock の名前と name 属性::
* 属性として設定されるモック::

patcher

* patch::
* patch.object: patch object.
* patch.dict: patch dict.
* patch.multiple: patch multiple.
* patch のメソッド; start と stop: patch のメソッド start と stop.
* ビルトインをパッチする::
* TEST_PREFIX::
* patch デコレータをネストする::
* どこにパッチするか::
* デスクリプタやプロキシオブジェクトにパッチする::

MagicMock と magic method のサポート

* Magic Method をモックする::
* Magic Mock::

ヘルパー

* sentinel::
* DEFAULT::
* call::
* create_autospec::
* ANY::
* FILTER_DIR::
* mock_open::
* autospec を使う::
* Sealing mocks::

unittest.mock -- 入門

* Mock を使う::
* patch デコレータ::
* さらなる例::

Mock を使う

* Mock のパッチ用メソッド::
* オブジェクトのメソッド呼び出しに対するモック::
* クラスをモックする::
* モックに名前をつける::
* 全ての呼び出しのトラッキング::
* 戻り値や属性を設定する::
* モックから例外を発生させる::
* side_effect の関数と iterable::
* 非同期イテレータをモックする::
* 非同期コンテキストマネージャをモックする::
* 既存のオブジェクトから Mock を作る::
* Using side_effect to return per file content::

さらなる例

* chained call をモックする::
* 部分的なモック::
* ジェネレータメソッドをモックする::
* 同じパッチを全てのメソッドに適用する::
* Unboundメソッドをモックする::
* モックで複数回の呼び出しをチェックする::
* ミュータブルな引数に対処する::
* patch をネストする::
* MagicMock で辞書をモックする::
* Mock のサブクラスと属性::
* patch.dict で import をモックする: patch dict で import をモックする.
* Tracking order of calls and less verbose call assertions::
* More complex argument matching::

test -- Regression tests package for Python

* Writing Unit Tests for the test package::
* コマンドラインインターフェースを利用してテストを実行する::

デバッグとプロファイル

* 監査イベント表::
* bdb: bdb --- デバッガーフレームワーク. デバッガーフレームワーク
* faulthandler: faulthandler --- Python トレースバックをダンプする. Python トレースバックをダンプする
* pdb: pdb --- The Python Debugger. The Python Debugger
* Python プロファイラ::
* timeit: timeit --- 小さなコードスニペットの実行時間計測. 小さなコードスニペットの実行時間計測
* trace: trace --- Python 文実行のトレースと追跡. Python 文実行のトレースと追跡
* tracemalloc: tracemalloc --- メモリ割り当ての追跡. メモリ割り当ての追跡

faulthandler -- Python トレースバックをダンプする

* tracebackのダンプ::
* Dumping the C stack::
* フォールトハンドラの状態::
* タイムアウト後にtracebackをダンプする::
* ユーザシグナルに対してtracebackをダンプする::
* ファイル記述子の問題::
* 使用例: 使用例<43>.

Dumping the C stack

* C Stack Compatibility::

pdb -- The Python Debugger

* コマンドライン・インターフェース: コマンドライン・インターフェース<8>.
* Debugger commands::

Python プロファイラ

* プロファイラとは::
* かんたんユーザマニュアル::
* profile and cProfile Module Reference::
* Stats クラス::
* 決定論的プロファイリングとは::
* 制限事項: 制限事項<2>.
* キャリブレーション (補正): キャリブレーション 補正.
* カスタムな時刻取得用関数を使う::

timeit -- 小さなコードスニペットの実行時間計測

* 基本的な例: 基本的な例<3>.
* Python インターフェイス::
* コマンドラインインターフェイス: コマンドラインインターフェイス<3>.
* 使用例: 使用例<44>.

trace -- Python 文実行のトレースと追跡

* コマンドラインからの使用: コマンドラインからの使用<2>.
* プログラミングインターフェース::

コマンドラインからの使用

* 主要なオプション::
* 修飾的オプション::
* フィルターオプション::

tracemalloc -- メモリ割り当ての追跡

* 使用例: 使用例<45>.
* API::

使用例

* 上位10を表示する::
* 差を計算する::
* メモリブロックのトレースバックを取得する::
* top を整形化する::

top を整形化する

* Record the current and peak size of all traced memory blocks::

API

* 関数: 関数<11>.
* DomainFilter::
* Filter::
* Frame::
* Snapshot::
* Statistic::
* StatisticDiff::
* Trace::
* Traceback::

ソフトウェア・パッケージと配布

* ensurepip: ensurepip --- pip インストーラーのブートストラップ. pip インストーラーのブートストラップ
* venv: venv --- 仮想環境の作成. 仮想環境の作成
* zipapp: zipapp --- 実行可能な Python zip アーカイブを管理する. 実行可能な Python zip アーカイブを管理する

ensurepip -- pip インストーラーのブートストラップ

* コマンドライン・インターフェース: コマンドライン・インターフェース<9>.
* モジュール API::

venv -- 仮想環境の作成

* 仮想環境の作成: 仮想環境の作成<2>.
* 仮想環境のしくみ::
* API: API<2>.
* EnvBuilder を拡張する例::

zipapp -- 実行可能な Python zip アーカイブを管理する

* 基本的な例: 基本的な例<4>.
* コマンドラインインターフェイス: コマンドラインインターフェイス<4>.
* Python API::
* 使用例: 使用例<46>.
* インタープリタの指定::
* Creating Standalone Applications with zipapp::
* The Python Zip Application Archive Format::

Creating Standalone Applications with zipapp

* Caveats::

Python ランタイムサービス

* sys: sys --- システム固有のパラメーターと関数. システム固有のパラメーターと関数
* sys.monitoring: sys monitoring --- 実行イベントモニタリング. 実行イベントモニタリング
* sysconfig: sysconfig --- Python の構成情報へのアクセスを提供する. Python の構成情報へのアクセスを提供する
* builtins: builtins --- 組み込みオブジェクト. 組み込みオブジェクト
* __main__: __main__ --- トップレベルのコード環境. トップレベルのコード環境
* warnings: warnings --- 警告の制御. 警告の制御
* dataclasses: dataclasses --- データクラス. データクラス
* contextlib: contextlib --- with 文コンテキスト用ユーティリティ. with 文コンテキスト用ユーティリティ
* abc: abc --- 抽象基底クラス. 抽象基底クラス
* atexit: atexit --- 終了ハンドラー. 終了ハンドラー
* traceback: traceback --- スタックトレースの表示または取得. スタックトレースの表示または取得
* __future__: __future__ --- future 文の定義. future 文の定義
* gc: gc --- ガベージコレクターインターフェース. ガベージコレクターインターフェース
* inspect: inspect --- 活動中のオブジェクトを調査する. 活動中のオブジェクトを調査する
* annotationlib: annotationlib --- Functionality for introspecting annotations. Functionality for introspecting annotations
* site: site --- サイト固有の設定フック. サイト固有の設定フック

sys.monitoring -- 実行イベントモニタリング

* Tool identifiers::
* Events::
* Turning events on and off::
* Registering callback functions::

Tool identifiers

* Registering and using tools::

Events

* Local events::
* Deprecated event::
* Ancillary events::
* Other events::
* The STOP_ITERATION event::

Turning events on and off

* Setting events globally::
* Per code object events::
* Disabling events::

Registering callback functions

* Callback function arguments::

sysconfig -- Python の構成情報へのアクセスを提供する

* 構成変数::
* インストールパス::
* User scheme::
* Home scheme::
* Prefix scheme::
* Installation path functions::
* その他の関数: その他の関数<3>.
* コマンドラインでの使用: コマンドラインでの使用<7>.

User scheme

* posix_user::
* nt_user::
* osx_framework_user::

Home scheme

* posix_home::

Prefix scheme

* posix_prefix::
* nt::

__main__ -- トップレベルのコード環境

* __name__ == '__main__'::
* __main__.py in Python Packages: __main__ py in Python Packages.
* import __main__::

__name__ == '__main__'

* 「トップレベルのスクリプト環境」とは::
* 通常の使われ方::
* パッケージングで考慮すべき点::

__main__.py in Python Packages

* 通常の使われ方: 通常の使われ方<2>.

warnings -- 警告の制御

* 警告カテゴリ::
* 警告フィルタ::
* 一時的に警告を抑制する::
* 警告のテスト::
* Updating Code For New Versions of Dependencies::
* 利用可能な関数::
* 利用可能なコンテキストマネージャー::
* Concurrent safety of Context Managers::

警告フィルタ

* Repeated Warning Suppression Criteria::
* Describing Warning Filters::
* デフォルトの警告フィルタ::
* Overriding the default filter::

dataclasses -- データクラス

* モジュールの内容: モジュールの内容<4>.
* 初期化後の処理::
* クラス変数::
* 初期化限定変数::
* 凍結されたインスタンス::
* 継承: 継承<2>.
* Re-ordering of keyword-only parameters in __init__(): Re-ordering of keyword-only parameters in __init__.
* デフォルトファクトリ関数::
* 可変なデフォルト値::
* Descriptor-typed fields::

contextlib -- with 文コンテキスト用ユーティリティ

* ユーティリティ::
* 例とレシピ: 例とレシピ<3>.
* 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ::

例とレシピ

* 可変数個のコンテキストマネージャーをサポートする::
* __enter__ メソッドからの例外をキャッチする::
* __enter__ 実装内のクリーンアップ::
* try-finally + flag 変数パターンを置き換える::
* コンテキストマネージャーを関数デコレーターとして使う::

単回使用、再利用可能、およびリエントラントなコンテキストマネージャ

* リエントラントなコンテキストマネージャ::
* 再利用可能なコンテキストマネージャ::

atexit -- 終了ハンドラー

* atexit Example::

traceback -- スタックトレースの表示または取得

* モジュールレベルの関数: モジュールレベルの関数<2>.
* TracebackException オブジェクト::
* StackSummary オブジェクト::
* FrameSummary オブジェクト::
* Examples of Using the Module-Level Functions::
* Examples of Using TracebackException::

__future__ -- future 文の定義

* モジュールコンテンツ: モジュールコンテンツ<5>.

inspect -- 活動中のオブジェクトを調査する

* 型とメンバー::
* ソースコードの情報取得::
* Signature オブジェクトで呼び出し可能オブジェクトを内省する::
* クラスと関数: クラスと関数<2>.
* インタープリタスタック::
* 属性の静的なフェッチ::
* Current State of Generators, Coroutines, and Asynchronous Generators: Current State of Generators Coroutines and Asynchronous Generators.
* Code Objects Bit Flags::
* Buffer flags::
* コマンドライン・インターフェース: コマンドライン・インターフェース<10>.

annotationlib -- Functionality for introspecting annotations

* Annotation semantics::
* クラス: クラス<5>.
* 関数: 関数<12>.
* レシピ: レシピ<3>.
* Limitations of the STRING format::
* Limitations of the FORWARDREF format::
* Security implications of introspecting annotations::

レシピ

* Using annotations in a metaclass::

site -- サイト固有の設定フック

* sitecustomize::
* usercustomize::
* readline の設定::
* モジュールの内容: モジュールの内容<5>.
* コマンドライン・インターフェース: コマンドライン・インターフェース<11>.

カスタム Python インタプリタ

* code: code --- インタープリター基底クラス. インタープリター基底クラス
* codeop: codeop --- Python コードをコンパイルする. Python コードをコンパイルする

code -- インタープリター基底クラス

* 対話的なインタプリタオブジェクト::
* 対話的なコンソールオブジェクト::

モジュールのインポート

* zipimport: zipimport --- Zip アーカイブからモジュールをインポートする. Zip アーカイブからモジュールをインポートする
* pkgutil: pkgutil --- パッケージ拡張ユーティリティ. パッケージ拡張ユーティリティ
* modulefinder: modulefinder --- スクリプト中で使用されているモジュールの検索. スクリプト中で使用されているモジュールの検索
* runpy: runpy --- Python モジュールの位置特定と実行. Python モジュールの位置特定と実行
* importlib: importlib --- import の実装. import の実装
* importlib.resources: importlib resources -- パッケージリソースの読み取り、オープン、アクセス. パッケージリソースの読み取り、オープン、アクセス
* importlib.resources.abc: importlib resources abc -- リソースの抽象基底クラス. リソースの抽象基底クラス
* importlib.metadata: importlib metadata -- パッケージメタデータへのアクセス. パッケージメタデータへのアクセス
* sys.path モジュール検索パスの初期化: sys path モジュール検索パスの初期化.

zipimport -- Zip アーカイブからモジュールをインポートする

* zipimporter オブジェクト::
* 使用例: 使用例<47>.

modulefinder -- スクリプト中で使用されているモジュールの検索

* ModuleFinder の使用例::

importlib -- import の実装

* はじめに: はじめに<13>.
* 関数: 関数<13>.
* importlib.abc: importlib abc -- Abstract base classes related to import. Abstract base classes related to import
* importlib.machinery: importlib machinery -- Importers and path hooks. Importers and path hooks
* importlib.util: importlib util -- Utility code for importers. Utility code for importers
* 使用例: 使用例<48>.

使用例

* プログラムからのインポート::
* モジュールがインポートできるか確認する::
* ソースファイルから直接インポートする::
* Implementing lazy imports::
* インポーターのセットアップ::
* Approximating importlib.import_module(): Approximating importlib import_module.

importlib.resources - パッケージリソースの読み取り、オープン、アクセス

* 関数 API::

importlib.metadata - パッケージメタデータへのアクセス

* 概要: 概要<3>.
* 機能 API::
* Distributions::
* Distribution Discovery::
* Implementing Custom Providers::

機能 API

* エントリポイント::
* 配布物メタデータ::
* 配布物バージョン::
* 配布物ファイル::
* 配布物の要件::
* Mapping import to distribution packages::

Implementing Custom Providers

* 使用例: 使用例<49>.

sys.path モジュール検索パスの初期化

* Virtual Environments::
* _pth files::
* 埋め込みの Python::

Python言語サービス

* ast: ast --- Abstract syntax trees. Abstract syntax trees
* symtable: symtable --- コンパイラーの記号表へのアクセス. コンパイラーの記号表へのアクセス
* token: token --- Python 解析木で使われる定数. Python 解析木で使われる定数
* keyword: keyword --- Python キーワードのテスト. Python キーワードのテスト
* tokenize: tokenize --- Python ソース用のトークナイザー. Python ソース用のトークナイザー
* tabnanny: tabnanny --- あいまいなインデントの検出. あいまいなインデントの検出
* pyclbr: pyclbr --- Python モジュールブラウザーサポート. Python モジュールブラウザーサポート
* py_compile: py_compile --- Python ソースファイルをコンパイルする. Python ソースファイルをコンパイルする
* compileall: compileall --- Python ライブラリをバイトコンパイルする. Python ライブラリをバイトコンパイルする
* dis: dis --- Python バイトコードの逆アセンブラー. Python バイトコードの逆アセンブラー
* pickletools: pickletools --- pickle 開発者用のツール群. pickle 開発者用のツール群

ast -- Abstract syntax trees

* Abstract grammar::
* Node クラス::
* ast helpers::
* Compiler flags: Compiler flags<2>.
* コマンドラインでの使用: コマンドラインでの使用<8>.

Node クラス

* Root nodes::
* リテラル: リテラル<3>.
* 変数::
* 式 (expression): 式 expression<2>.
* 文 (Statements): 文 Statements.
* 制御フロー::
* Pattern matching::
* Type annotations::
* Type parameters::
* 関数およびクラス定義::
* async と await::

式 (expression)

* 配列要素の参照 (Subscripting): 配列要素の参照 Subscripting.
* 内包表記 (Comprehension): 内包表記 Comprehension.

文 (Statements)

* インポート::

symtable -- コンパイラーの記号表へのアクセス

* 記号表の生成::
* 記号表の検査::
* コマンドラインからの使用: コマンドラインからの使用<3>.

tokenize -- Python ソース用のトークナイザー

* 入力のトークナイズ::
* コマンドラインからの使用: コマンドラインからの使用<4>.
* 使用例: 使用例<50>.

pyclbr -- Python モジュールブラウザーサポート

* Function オブジェクト::
* クラスオブジェクト: クラスオブジェクト<2>.

py_compile -- Python ソースファイルをコンパイルする

* コマンドラインインターフェイス: コマンドラインインターフェイス<5>.

compileall -- Python ライブラリをバイトコンパイルする

* コマンドラインでの使用: コマンドラインでの使用<9>.
* パブリックな関数::

dis -- Python バイトコードの逆アセンブラー

* コマンドライン・インターフェース: コマンドライン・インターフェース<12>.
* バイトコード解析::
* 解析関数::
* Python バイトコード命令::
* 命令コードコレクション::

pickletools -- pickle 開発者用のツール群

* コマンドラインでの使用: コマンドラインでの使用<10>.
* Programmatic interface::

コマンドラインでの使用

* コマンドラインオプション: コマンドラインオプション<6>.

MS Windows 固有のサービス

* msvcrt: msvcrt --- MS VC++ ランタイムの有用なルーチン群. MS VC++ ランタイムの有用なルーチン群
* winreg: winreg --- Windows レジストリへのアクセス. Windows レジストリへのアクセス
* winsound: winsound --- Windows 用の音声再生インターフェース. Windows 用の音声再生インターフェース

msvcrt -- MS VC++ ランタイムの有用なルーチン群

* ファイル操作関連::
* コンソール I/O 関連::
* その多の関数::

winreg -- Windows レジストリへのアクセス

* 関数: 関数<14>.
* 定数: 定数<11>.
* レジストリハンドルオブジェクト::

定数

* HKEY_* 定数::
* アクセス権限::
* 値の型::

アクセス権限

* 64-bit 特有のアクセス権::

Unix-specific services

* shlex: shlex --- 単純な字句解析. 単純な字句解析
* posix: posix --- 最も一般的な POSIX システムコール群. 最も一般的な POSIX システムコール群
* pwd: pwd --- パスワードデータベース. パスワードデータベース
* grp: grp --- グループデータベース. グループデータベース
* termios: termios --- POSIX スタイルの端末制御. POSIX スタイルの端末制御
* tty: tty --- 端末制御用の関数群. 端末制御用の関数群
* pty: pty --- 擬似端末ユーティリティ. 擬似端末ユーティリティ
* fcntl: fcntl --- fcntl および ioctl システムコール. fcntl および ioctl システムコール
* resource: resource --- リソース使用情報. リソース使用情報
* syslog: syslog --- Unix syslog ライブラリルーチン群. Unix syslog ライブラリルーチン群

shlex -- 単純な字句解析

* shlex オブジェクト::
* 解析規則::
* Improved Compatibility with Shells::

posix -- 最も一般的な POSIX システムコール群

* ラージファイルのサポート::
* 注目すべきモジュールの内容::

termios -- POSIX スタイルの端末制御

* 使用例: 使用例<51>.

pty -- 擬似端末ユーティリティ

* 使用例: 使用例<52>.

resource -- リソース使用情報

* リソースの制限::
* リソースの使用状態::

syslog -- Unix syslog ライブラリルーチン群

* 使用例: 使用例<53>.

使用例

* シンプルな例::

取って代わられたモジュール群

* getopt: getopt --- C-style parser for command line options. C-style parser for command line options

削除されたモジュール

* aifc: aifc --- Read and write AIFF and AIFC files. Read and write AIFF and AIFC files
* asynchat: asynchat --- Asynchronous socket command/response handler. Asynchronous socket command/response handler
* asyncore: asyncore --- Asynchronous socket handler. Asynchronous socket handler
* audioop: audioop --- Manipulate raw audio data. Manipulate raw audio data
* cgi: cgi --- Common Gateway Interface のサポート. Common Gateway Interface のサポート
* cgitb: cgitb --- Traceback manager for CGI scripts. Traceback manager for CGI scripts
* chunk: chunk --- Read IFF chunked data. Read IFF chunked data
* crypt: crypt --- Function to check Unix passwords. Function to check Unix passwords
* distutils: distutils --- Building and installing Python modules. Building and installing Python modules
* imghdr: imghdr --- Determine the type of an image. Determine the type of an image
* imp: imp --- Access the import internals. Access the import internals
* mailcap: mailcap --- Mailcap file handling. Mailcap file handling
* msilib: msilib --- Read and write Microsoft Installer files. Read and write Microsoft Installer files
* nis: nis --- Interface to Sun’s NIS Yellow Pages. Interface to Sun’s NIS (Yellow Pages)
* nntplib: nntplib --- NNTP protocol client. NNTP protocol client
* ossaudiodev: ossaudiodev --- Access to OSS-compatible audio devices. Access to OSS-compatible audio devices
* pipes: pipes --- Interface to shell pipelines. Interface to shell pipelines
* smtpd: smtpd --- SMTP Server. SMTP Server
* sndhdr: sndhdr --- Determine type of sound file. Determine type of sound file
* spwd: spwd --- The shadow password database. The shadow password database
* sunau: sunau --- Read and write Sun AU files. Read and write Sun AU files
* telnetlib: telnetlib --- Telnet client. Telnet client
* uu: uu --- Encode and decode uuencode files. Encode and decode uuencode files
* xdrlib: xdrlib --- Encode and decode XDR data. Encode and decode XDR data

Python インタプリタの拡張と埋め込み

* おすすめのサードパーティツール::
* サードパーティツールなしで拡張を作る::
* 大規模なアプリケーションへの Python ランタイムの埋め込み::

サードパーティツールなしで拡張を作る

* C や C++ による Python の拡張::
* 拡張の型の定義; チュートリアル: 拡張の型の定義 チュートリアル.
* 拡張の型の定義; 雑多なトピック: 拡張の型の定義 雑多なトピック.
* C および C++ 拡張のビルド::
* Windows 上での C および C++ 拡張モジュールのビルド::

C や C++ による Python の拡張

* 簡単な例::
* 幕間小話; エラーと例外: 幕間小話 エラーと例外.
* 例に戻る::
* モジュールのメソッドテーブルと初期化関数::
* コンパイルとリンク::
* C から Python 関数を呼び出す::
* 拡張モジュール関数でのパラメタ展開::
* 拡張モジュール関数のキーワードパラメタ::
* 任意の値を構築する::
* 参照カウント法::
* C++での拡張モジュール作成::
* 拡張モジュールに C API を提供する::

参照カウント法

* Python における参照カウント法::
* 所有権にまつわる規則::
* 薄氷::
* NULL ポインタ::

拡張の型の定義: チュートリアル

* 基本的なこと::
* 基本のサンプルにデータとメソッドを追加する::
* データ属性をこまかく制御する::
* 循環ガベージコレクションをサポートする::
* 他の型のサブクラスを作る::

拡張の型の定義: 雑多なトピック

* ファイナライズとメモリ解放::
* オブジェクト表現::
* 属性を管理する::
* オブジェクトの比較::
* 抽象的なプロトコルのサポート::
* 弱参照(Weak Reference)のサポート: 弱参照 Weak Reference のサポート.
* その他いろいろ::

属性を管理する

* 総称的な属性を管理する::
* 特定の型に特化した属性の管理::

C および C++ 拡張のビルド

* setuptools による C および C++ 拡張のビルド::

Windows 上での C および C++ 拡張モジュールのビルド

* 型どおりのアプローチ::
* Unix と Windows の相違点::
* DLL 使用の実際::

大規模なアプリケーションへの Python ランタイムの埋め込み

* 他のアプリケーションへの Python の埋め込み::

他のアプリケーションへの Python の埋め込み

* 高水準の埋め込み::
* 超高水準の埋め込みから踏み出す; 概要: 超高水準の埋め込みから踏み出す 概要.
* 純粋な埋め込み::
* 埋め込まれた Python の拡張::
* C++による Python の埋め込み::
* Unix 系システムにおけるコンパイルとリンク::

Python/C API リファレンスマニュアル

* はじめに: はじめに<14>.
* C API の安定性::
* 超高水準レイヤ::
* 参照カウント::
* 例外処理::
* 拡張モジュールの定義::
* ユーティリティ: ユーティリティ<2>.
* 抽象オブジェクトレイヤ (Abstract Objects Layer): 抽象オブジェクトレイヤ Abstract Objects Layer.
* 具象オブジェクト (concrete object) レイヤ: 具象オブジェクト concrete object レイヤ.
* 初期化 (initialization)、終了処理 (finalization)、スレッド: 初期化 initialization 、終了処理 finalization 、スレッド.
* Python 初期化設定::
* メモリ管理::
* オブジェクト実装サポート (object implementation support): オブジェクト実装サポート object implementation support.
* API と ABI のバージョニング::
* Monitoring C API::
* Generating Execution Events::

はじめに

* 言語バージョン互換性::
* コーディング基準::
* インクルードファイル::
* 便利なマクロ::
* オブジェクト、型および参照カウント::
* 例外: 例外<24>.
* Python の埋め込み: Python の埋め込み<2>.
* デバッグ版ビルド (Debugging Builds): デバッグ版ビルド Debugging Builds.
* おすすめのサードパーティツール: おすすめのサードパーティツール<2>.

便利なマクロ

* Docstring macros::
* General utility macros::
* Declaration utilities::
* Outdated macros::

General utility macros

* Numeric utilities::
* Assertion utilities::
* Type size utilities::
* Macro definition utilities::

オブジェクト、型および参照カウント

* 参照カウント法: 参照カウント法<2>.
* 型: 型<2>.

参照カウント法

* 参照カウントの詳細::

C API の安定性

* Unstable C API::
* 安定 ABI (Stable Appliction Binary Interface): 安定 ABI Stable Appliction Binary Interface.
* プラットフォームで考慮すべき点::
* 限定版APIの内容::

安定 ABI (Stable Appliction Binary Interface)

* Limited C API::
* Stable ABI::
* APIスコープとパフォーマンスの制限::
* 制限付きAPIの注意点::

超高水準レイヤ

* Available start symbols::
* Stack Effects::

例外処理

* 出力とクリア::
* 例外の送出::
* 警告: 警告<3>.
* エラーインジケータの問い合わせ::
* シグナルハンドリング: シグナルハンドリング<2>.
* 例外クラス: 例外クラス<2>.
* 例外オブジェクト::
* Unicode 例外オブジェクト::
* 再帰の管理::
* Exception and warning types::
* Tracebacks::

Exception and warning types

* Exception types::
* OSError aliases::
* Warning types::

拡張モジュールの定義

* 複数のモジュールインスタンス::
* 初期化関数::
* 多段階初期化::
* 従来の一段階初期化::

ユーティリティ

* オペレーティングシステム関連のユーティリティ::
* システム関数::
* プロセス制御::
* モジュールのインポート: モジュールのインポート<2>.
* データ整列化 (data marshalling) のサポート: データ整列化 data marshalling のサポート.
* 引数の解釈と値の構築::
* 文字列の変換と書式化::
* Character classification and conversion::
* PyHash API::
* リフレクション::
* codec レジストリとサポート関数::
* PyTime C API::
* Support for Perf Maps::

引数の解釈と値の構築

* 引数を解析する: 引数を解析する<2>.
* 値の構築::

引数を解析する

* 文字列とバッファ::
* 数: 数<2>.
* その他のオブジェクト::
* API 関数::

codec レジストリとサポート関数

* コーデック検索API::
* Unicode エラーハンドラ用レジストリ API::
* Codec utility variables::

PyTime C API

* 型: 型<3>.
* Clock Functions::
* Raw Clock Functions::
* Conversion functions::

抽象オブジェクトレイヤ (Abstract Objects Layer)

* オブジェクトプロトコル (object protocol): オブジェクトプロトコル object protocol.
* Call プロトコル::
* 数値型プロトコル (number protocol): 数値型プロトコル number protocol.
* シーケンス型プロトコル (sequence protocol): シーケンス型プロトコル sequence protocol.
* マップ型プロトコル (mapping protocol): マップ型プロトコル mapping protocol.
* イテレータプロトコル (iterator protocol): イテレータプロトコル iterator protocol.
* バッファプロトコル (buffer Protocol): バッファプロトコル buffer Protocol.

Call プロトコル

* The tp_call Protocol::
* The Vectorcall Protocol::
* Object Calling API::
* Call Support API::

The Vectorcall Protocol

* 再帰の管理: 再帰の管理<2>.
* Vectorcall Support API::

バッファプロトコル (buffer Protocol)

* buffer 構造体::
* バッファリクエストのタイプ::
* 複雑な配列::
* バッファ関連の関数::

バッファリクエストのタイプ

* リクエストに依存しないフィールド::
* readonly, format: readonly format.
* shape, strides, suboffsets: shape strides suboffsets.
* 隣接性のリクエスト::
* 複合リクエスト::

複雑な配列

* NumPy スタイル; shape, strides: NumPy スタイル shape strides.
* PIL スタイル; shape, strides, suboffsets: PIL スタイル shape strides suboffsets.

具象オブジェクト (concrete object) レイヤ

* 基本オブジェクト (fundamental object): 基本オブジェクト fundamental object.
* 数値型オブジェクト (numeric object): 数値型オブジェクト numeric object.
* シーケンスオブジェクト (sequence object): シーケンスオブジェクト sequence object.
* Container オブジェクト::
* Function オブジェクト: Function オブジェクト<2>.
* その他のオブジェクト: その他のオブジェクト<2>.
* C API for extension modules::

基本オブジェクト (fundamental object)

* 型オブジェクト: 型オブジェクト<2>.
* None オブジェクト::

型オブジェクト

* Creating Heap-Allocated Types::

数値型オブジェクト (numeric object)

* 整数型オブジェクト (integer object): 整数型オブジェクト integer object.
* Boolean オブジェクト::
* Floating-Point Objects::
* 複素数オブジェクト::

整数型オブジェクト (integer object)

* Export API::
* PyLongWriter API::
* Deprecated API::

Floating-Point Objects

* Pack and Unpack functions::

Pack and Unpack functions

* Pack functions::
* Unpack functions::

複素数オブジェクト

* C 構造体としての複素数::
* Python オブジェクトとしての複素数型::

シーケンスオブジェクト (sequence object)

* バイトオブジェクト: バイトオブジェクト<2>.
* bytearray オブジェクト: bytearray オブジェクト<2>.
* Unicode オブジェクトと codec::
* タプルオブジェクト (tuple object): タプルオブジェクト tuple object.
* Struct Sequence オブジェクト::
* リストオブジェクト::

bytearray オブジェクト

* 型チェックマクロ::
* ダイレクト API 関数::
* マクロ::

Unicode オブジェクトと codec

* Unicode オブジェクト::
* 組み込み codec (built-in codec): 組み込み codec built-in codec.
* メソッドおよびスロット関数 (slot function): メソッドおよびスロット関数 slot function.
* PyUnicodeWriter::
* Deprecated API: Deprecated API<2>.

Unicode オブジェクト

* Unicode 型::
* Unicode 文字プロパティ::
* Unicode 文字列の生成とアクセス::
* ロケールエンコーディング::
* ファイルシステムエンコーディング::
* wchar_t サポート::

組み込み codec (built-in codec)

* 汎用 codec::
* UTF-8 Codecs::
* UTF-32 Codecs::
* UTF-16 Codecs::
* UTF-7 Codecs::
* Unicode-Escape Codecs::
* Raw-Unicode-Escape Codecs::
* Latin-1 Codecs::
* ASCII Codecs::
* Character Map Codecs::
* Windows 用の MBCS codec::

Container オブジェクト

* 辞書オブジェクト (dictionary object): 辞書オブジェクト dictionary object.
* Set オブジェクト::

辞書オブジェクト (dictionary object)

* Dictionary View Objects::
* Ordered Dictionaries::

Set オブジェクト

* Deprecated API: Deprecated API<3>.

Function オブジェクト

* Function オブジェクト: Function オブジェクト<3>.
* インスタンスメソッドオブジェクト(Instance Method Objects): インスタンスメソッドオブジェクト Instance Method Objects.
* メソッドオブジェクト: メソッドオブジェクト<2>.
* セルオブジェクト (cell object): セルオブジェクト cell object.
* コードオブジェクト: コードオブジェクト<3>.
* Code Object Flags::
* Extra information::

その他のオブジェクト

* ファイルオブジェクト::
* モジュールオブジェクト (module object): モジュールオブジェクト module object.
* Module definitions::
* Creating extension modules dynamically::
* サポート関数::
* イテレータオブジェクト (iterator object): イテレータオブジェクト iterator object.
* デスクリプタオブジェクト (descriptor object): デスクリプタオブジェクト descriptor object.
* スライスオブジェクト (slice object): スライスオブジェクト slice object.
* memoryview オブジェクト::
* Pickle buffer objects::
* 弱参照オブジェクト: 弱参照オブジェクト<2>.
* カプセル: カプセル<2>.
* フレーム (frame) オブジェクト: フレーム frame オブジェクト<2>.
* ジェネレータオブジェクト::
* コルーチンオブジェクト: コルーチンオブジェクト<2>.
* コンテキスト変数オブジェクト::
* 型ヒントのためのオブジェクト::

ファイルオブジェクト

* Deprecated API: Deprecated API<4>.

Module definitions

* Module slots::

サポート関数

* Module lookup (single-phase initialization): Module lookup single-phase initialization.

イテレータオブジェクト (iterator object)

* Range Objects::
* Builtin Iterator Types::
* Other Iterator Objects::

デスクリプタオブジェクト (descriptor object)

* Built-in descriptors::

スライスオブジェクト (slice object)

* Ellipsis オブジェクト: Ellipsis オブジェクト<2>.

フレーム (frame) オブジェクト

* Frame Locals Proxies::
* Legacy Local Variable APIs::
* Internal Frames::

ジェネレータオブジェクト

* Asynchronous Generator Objects::
* Deprecated API: Deprecated API<5>.

C API for extension modules

* Curses C API::
* Internal data::
* DateTime オブジェクト: DateTime オブジェクト<2>.
* Internal data: Internal data<2>.

初期化 (initialization)、終了処理 (finalization)、スレッド

* Python 初期化以前::
* グローバルな設定変数::
* インタープリタの初期化と終了処理::
* プロセスワイドのパラメータ::
* スレッド状態 (thread state) とグローバルインタプリタロック (global interpreter lock): スレッド状態 thread state とグローバルインタプリタロック global interpreter lock.
* サブインタプリタサポート::
* 非同期通知::
* プロファイルとトレース (profiling and tracing): プロファイルとトレース profiling and tracing.
* Reference tracing::
* 高度なデバッガサポート (advanced debugger support): 高度なデバッガサポート advanced debugger support.
* スレッドローカルストレージのサポート::
* 同期プリミティブ: 同期プリミティブ<3>.
* Operating System Thread APIs::

スレッド状態 (thread state) とグローバルインタプリタロック (global interpreter lock)

* Detaching the thread state from extension code::
* Python 以外で作られたスレッド::
* Supporting subinterpreters in non-Python threads::
* Cautions about fork(): Cautions about fork.
* Cautions regarding runtime finalization::
* 高レベルAPI::
* 低レベルAPI::

サブインタプリタサポート

* A Per-Interpreter GIL::
* バグと注意事項::

スレッドローカルストレージのサポート

* スレッド固有ストレージ (Thread Specific Storage, TSS) API: スレッド固有ストレージ Thread Specific Storage TSS API.
* スレッドローカルストレージ (TLS) API: スレッドローカルストレージ TLS API.

スレッド固有ストレージ (Thread Specific Storage, TSS) API

* 動的メモリ確保::
* メソッド: メソッド<2>.

同期プリミティブ

* Python Critical Section API::
* Legacy Locking APIs::

Python 初期化設定

* PyInitConfig C API::
* Configuration Options::
* Runtime Python configuration API::
* PyConfig C API::
* Py_GetArgcArgv(): Py_GetArgcArgv.
* Delaying main module execution::

PyInitConfig C API

* 使用例: 使用例<54>.
* 設定の作成::
* エラー処理: エラー処理<2>.
* Get Options::
* Set Options::
* Module::
* Initialize Python::

PyConfig C API

* 使用例: 使用例<55>.
* PyWideStringList::
* PyStatus::
* PyPreConfig::
* Preinitialize Python with PyPreConfig::
* PyConfig::
* Initialization with PyConfig::
* Isolated Configuration::
* Python Configuration::
* Python Path Configuration::

メモリ管理

* 概要: 概要<4>.
* Allocator Domains::
* 生メモリインターフェース::
* メモリインターフェース::
* オブジェクトアロケータ::
* Default Memory Allocators::
* メモリアロケータをカスタマイズする::
* Debug hooks on the Python memory allocators::
* pymalloc アロケータ::
* The mimalloc allocator::
* tracemalloc C API::
* 使用例: 使用例<56>.

メモリインターフェース

* 非推奨のエイリアス: 非推奨のエイリアス<2>.

pymalloc アロケータ

* pymalloc アリーナアロケータのカスタマイズ::

オブジェクト実装サポート (object implementation support)

* オブジェクトをヒープ上にメモリ確保する::
* Object Life Cycle::
* 共通のオブジェクト構造体 (common object structure): 共通のオブジェクト構造体 common object structure.
* Type Object Structures::
* 循環参照ガベージコレクションをサポートする::

オブジェクトをヒープ上にメモリ確保する

* 非推奨のエイリアス: 非推奨のエイリアス<3>.

Object Life Cycle

* Life Events::
* Cyclic Isolate Destruction::
* 関数: 関数<15>.

共通のオブジェクト構造体 (common object structure)

* Base object types and macros::
* Implementing functions and methods::
* Accessing attributes of extension types::

Accessing attributes of extension types

* Member flags::
* Member types::
* Defining Getters and Setters::

Type Object Structures

* クイックリファレンス::
* PyTypeObject 定義::
* PyObject スロット::
* PyVarObject スロット::
* PyTypeObject スロット::
* Static Types::
* Heap Types::
* 数値オブジェクト構造体::
* マップオブジェクト構造体::
* シーケンスオブジェクト構造体::
* バッファオブジェクト構造体 (buffer object structure): バッファオブジェクト構造体 buffer object structure.
* async オブジェクト構造体::
* Slot Type typedefs::
* 使用例: 使用例<57>.

クイックリファレンス

* tp スロット::
* sub-slots::
* スロットの定義型 (typedef): スロットの定義型 typedef.

循環参照ガベージコレクションをサポートする

* Controlling the Garbage Collector State::
* Querying Garbage Collector State::

API と ABI のバージョニング

* Build-time version constants::
* Run-time version::
* Bit-packing macros::

Generating Execution Events

* Managing the Monitoring State::

Python モジュールのインストール

* 重要用語集::
* 基本的な使い方: 基本的な使い方<5>.
* どうすればいいの...？: どうすればいいの ？.
* よくあるインストールに関する問題::

どうすればいいの...？

* ... pip を 3.4 より前のバージョンの Python でインストールするには？: pip を 3 4 より前のバージョンの Python でインストールするには？.
* ... パッケージを現在のユーザ用のみにインストールするには？: パッケージを現在のユーザ用のみにインストールするには？.
* ... 科学技術計算用の Python パッケージをインストールするには？: 科学技術計算用の Python パッケージをインストールするには？.
* ... インストールされた複数のバージョンの Python を並行して使うには？: インストールされた複数のバージョンの Python を並行して使うには？.

よくあるインストールに関する問題

* Linux で、システムの Python 内にインストールする::
* pip がインストールされていない::
* バイナリの拡張のインストール::

Python HOWTO

* A Conceptual Overview of asyncio::
* Python 3 への拡張モジュール移植::
* Python で Curses プログラミング::
* デスクリプタ ガイド::
* Debugging C API extensions and CPython Internals with GDB::
* 列挙型 HOWTO::
* 関数型プログラミング HOWTO::
* Logging HOWTO::
* Logging クックブック::
* 正規表現 HOWTO::
* ソケットプログラミング HOWTO::
* ソートのテクニック::
* Unicode HOWTO::
* urllib パッケージを使ってインターネット上のリソースを取得するには::
* ipaddressモジュールの紹介::
* DTrace と SystemTap で CPython を測定する::
* Python support for the Linux perf profiler::
* Annotations Best Practices::
* 拡張モジュールを分離する::
* timer file descriptor HOWTO::
* The Python 2.3 Method Resolution Order: The Python 2 3 Method Resolution Order.
* Python support for free threading::
* C API Extension Support for Free Threading::
* Remote debugging attachment protocol::
* Permission requirements::
* Locating the PyRuntime structure::
* Reading _Py_DebugOffsets::
* Locating the interpreter and thread state::
* Writing control information::
* Summary::

A Conceptual Overview of asyncio

* A conceptual overview part 1; the high-level: A conceptual overview part 1 the high-level.
* A conceptual overview part 2; the nuts and bolts: A conceptual overview part 2 the nuts and bolts.

A conceptual overview part 1: the high-level

* イベントループ: イベントループ<2>.
* Asynchronous functions and coroutines::
* Task: Task<2>.
* await::

A conceptual overview part 2: the nuts and bolts

* The inner workings of coroutines::
* Future: Future<2>.
* A homemade asyncio.sleep: A homemade asyncio sleep.

Python で Curses プログラミング

* curses ってなに?::
* curses アプリケーションの起動と終了::
* ウィンドウとパッド::
* テキストの表示::
* ユーザ入力::
* より多くの情報::

curses ってなに?

* Python の curses module::

テキストの表示

* 属性とカラー::

デスクリプタ ガイド

* 入門::
* 実践的なサンプル::
* 技術的なチュートリアル::
* ピュアPythonの等価実装::

入門

* シンプルな例; 定数を返すデスクリプタ: シンプルな例 定数を返すデスクリプタ.
* 動的なルックアップ::
* 管理された属性::
* 名前のカスタマイズ::
* まとめ::

実践的なサンプル

* バリデータクラス::
* カスタムバリデータ::
* 実践的なアプリケーション::

技術的なチュートリアル

* 概要: 概要<5>.
* 定義と導入::
* デスクリプタプロトコル::
* デスクリプタ呼び出しの概要::
* インスタンスからの呼び出し::
* クラスからの呼び出し::
* superからの呼び出し::
* 呼び出しロジックのまとめ::
* 自動的の名前の伝達::
* ORMのサンプル::

ピュアPythonの等価実装

* プロパティ::
* 関数とメソッド::
* メソッドの種類::
* 静的メソッド::
* クラスメソッド::
* メンバーオブジェクトと __slots__::

Debugging C API extensions and CPython Internals with GDB

* Prerequisites::
* Using the Debug build and Development mode::
* Using the python-gdb extension::
* Use with GDB commands::

Prerequisites

* Setup with Python built from source::
* Setup for Python from a Linux distro::

Using the python-gdb extension

* Pretty-printers::
* py-list::
* py-up and py-down::
* py-bt::
* py-print::
* py-locals::

列挙型 HOWTO

* 列挙型メンバーおよびそれらの属性へのプログラム的アクセス::
* 列挙型メンバーと値の重複::
* 番号付けの値が一意であることの確認::
* 値の自動設定を使う::
* イテレーション: イテレーション<2>.
* 比較: 比較<3>.
* 列挙型で許されるメンバーと属性::
* Enumのサブクラス化の制限::
* データクラスのサポート::
* Pickle 化::
* 関数 API: 関数 API<2>.
* 派生列挙型::
* When to use __new__() vs. __init__(): When to use __new__ vs __init__.
* EnumとFlagはどう違うのか？::
* Enum クックブック::
* EnumType のサブクラスを作る::

派生列挙型

* IntEnum::
* StrEnum::
* IntFlag::
* Flag::
* その他: その他<6>.

When to use __new__() vs. __init__()

* 細かい点::

細かい点

* __dunder__ 名のサポート: __dunder__ 名のサポート<2>.
* _sunder_ 名のサポート: _sunder_ 名のサポート<2>.
* _Private__names::
* Enum メンバー型::
* Creating members that are mixed with other data types::
* Enum クラスとメンバーの真偽値::
* メソッド付きの Enum クラス::
* Flag のメンバーの組み合わせ::
* Flag and IntFlag minutia::

EnumとFlagはどう違うのか？

* Enum クラス::
* Flag クラス::
* Enum メンバー (インスタンス): Enum メンバー インスタンス.
* Flag メンバー::

Enum クックブック

* 値の省略::
* OrderedEnum::
* DuplicateFreeEnum::
* MultiValueEnum::
* Planet::
* TimePeriod::

値の省略

* auto を使う::
* object を使う::
* 解説文字列を使う::
* Using a custom __new__(): Using a custom __new__.

関数型プログラミング HOWTO

* はじめに: はじめに<15>.
* イテレータ (iterator): イテレータ iterator<2>.
* ジェネレータ式とリスト内包表記::
* ジェネレータ (generator): ジェネレータ generator<2>.
* 組み込み関数 (built-in function): 組み込み関数 built-in function<2>.
* itertools モジュール::
* functools モジュール::
* 小さな関数とラムダ式::
* 更新履歴と謝辞::
* 参考資料: 参考資料<2>.

はじめに

* 形式的証明可能性::
* モジュラー性::
* デバッグやテストの簡単さ::
* 結合性::

イテレータ (iterator)

* イテレータ対応のデータ型::

ジェネレータ (generator)

* ジェネレータに値を渡す::

itertools モジュール

* 新しいイテレータを作る::
* 要素に対して関数を呼ぶ::
* 要素を選択する::
* 組合せ関数::
* 要素をグループ分けする::

functools モジュール

* operator モジュール::

参考資料

* 一般論::
* Python 特有の話::
* Python 文書::

Logging HOWTO

* 基本 logging チュートリアル::
* 上級ロギングチュートリアル::
* ロギングレベル: ロギングレベル<2>.
* 便利なハンドラ::
* ログ記録中に発生する例外::
* 任意のオブジェクトをメッセージに使用する::
* 最適化: 最適化<19>.
* その他のリソース::

基本 logging チュートリアル

* logging を使うとき::
* 簡単な例: 簡単な例<2>.
* ファイルへの logging::
* 変数データのロギング::
* 表示されるメッセージのフォーマットの変更::
* メッセージ内での日付と時刻の表示::
* 次のステップ::

上級ロギングチュートリアル

* Logging Flow::
* ロガー::
* ハンドラ::
* フォーマッタ::
* ロギングの環境設定::
* 環境設定が与えられないとどうなるか::
* ライブラリのためのロギングの設定::

ロギングレベル

* カスタムレベル::

Logging クックブック

* 複数のモジュールで logging を使う::
* 複数のスレッドからのロギング::
* 複数の handler と formatter::
* 複数の出力先にログを出力する::
* ログレベルのカスタム処理::
* 設定サーバの例::
* ブロックする handler を扱う::
* ネットワーク越しの logging イベントの送受信::
* コンテキスト情報をログ記録出力に付加する::
* contextvars の利用::
* ハンドラ内でのコンテキスト情報の付与::
* 複数のプロセスからの単一ファイルへのログ記録::
* ファイルをローテートする::
* 別の format スタイルを利用する::
* LogRecord のカスタマイズ::
* Subclassing QueueHandler and QueueListener- a ZeroMQ example::
* Subclassing QueueHandler and QueueListener- a pynng example::
* 辞書ベースで構成する例::
* rotator と namer を使ってログローテートをカスタマイズする::
* より手の込んだ multiprocessing の例::
* SysLogHandler に送るメッセージに BOM を挿入する::
* 構造化ログを実装する::
* handler を dictConfig() を使ってカスタマイズする: handler を dictConfig を使ってカスタマイズする.
* 固有の書式化スタイルをアプリケーション全体で使う::
* filter を dictConfig() を使ってカスタマイズする: filter を dictConfig を使ってカスタマイズする.
* 例外の書式化をカスタマイズする::
* ロギングメッセージを喋る::
* ロギングメッセージをバッファリングし、条件に従って出力する::
* バッファリングしながらロギングメッセージを email で送信する::
* 設定によって時刻を UTC(GMT) で書式化する: 設定によって時刻を UTC GMT で書式化する.
* ロギングの選択にコンテキストマネージャを使う::
* CLIアプリケーションスターターテンプレート::
* Qt GUIのログ出力::
* RFC5424 をサポートする syslog へのロギング::
* ロガーを出力ストリームのように取り扱う方法::
* How to uniformly handle newlines in logging output::
* 避けるべきパターン::
* その他のリソース: その他のリソース<2>.

ネットワーク越しの logging イベントの送受信

* 作成中のロギングソケットのリスナーを実行する::

コンテキスト情報をログ記録出力に付加する

* LoggerAdapter を使ったコンテキスト情報の伝達::
* Filter を使ったコンテキスト情報の伝達::

LoggerAdapter を使ったコンテキスト情報の伝達

* コンテキスト情報を渡すために dict 以外のオブジェクトを使う::

複数のプロセスからの単一ファイルへのログ記録

* concurrent.futures.ProcessPoolExecutorの利用: concurrent futures ProcessPoolExecutorの利用.
* Gunicorn と uWSGI を用いた Web アプリケーションのデプロイ::

Subclassing QueueHandler and QueueListener- a ZeroMQ example

* Subclass QueueHandler::
* Subclass QueueListener::

Subclassing QueueHandler and QueueListener- a pynng example

* Subclass QueueListener: Subclass QueueListener<2>.
* Subclass QueueHandler: Subclass QueueHandler<2>.

固有の書式化スタイルをアプリケーション全体で使う

* LogRecord ファクトリを使う::
* カスタムなメッセージオブジェクトを使う::

避けるべきパターン

* 同じログファイルを何度も開く::
* ロガーをクラスの属性にするか、パラメータで渡す::
* ライブラリ内でロガーに NullHandler 以外のハンドラーを追加する::
* 大量のロガーを作成する::

正規表現 HOWTO

* はじめに: はじめに<16>.
* 単純なパターン::
* 正規表現を使う::
* パターンの能力をさらに::
* 文字列を変更する::
* よくある問題::
* フィードバック::

単純なパターン

* 文字のマッチング::
* 繰り返し::

正規表現を使う

* 正規表現をコンパイルする::
* バックスラッシュ感染症::
* マッチの実行::
* モジュールレベルの関数: モジュールレベルの関数<3>.
* コンパイルフラグ::

パターンの能力をさらに

* さらなる特殊文字::
* グルーピング::
* 取り出さないグループと名前つきグループ::
* 先読みアサーション (Lookahead Assertions): 先読みアサーション Lookahead Assertions.

文字列を変更する

* 文字列の分割::
* 検索と置換: 検索と置換<2>.

よくある問題

* 文字列メソッドを利用する::
* match() 対 search(): match 対 search.
* 貪欲 (greedy) 対非貪欲 (non-greedy): 貪欲 greedy 対非貪欲 non-greedy.
* re.VERBOSE の利用: re VERBOSE の利用.

ソケットプログラミング HOWTO

* ソケット::
* ソケットの作成: ソケットの作成<3>.
* ソケットの利用::
* 切断::
* ノンブロッキングソケット::

ソケット

* 歴史::

ソケットの作成

* IPC::

ソケットの利用

* バイナリデータ::

切断

* ソケットが死ぬと::

ソートのテクニック

* ソートの基本::
* Key 関数::
* operator モジュールの関数や partial 関数による評価::
* 昇順と降順::
* ソートの安定性と複合的なソート::
* デコレート - ソート - アンデコレート (DSU): デコレート - ソート - アンデコレート DSU.
* 比較関数::
* Strategies For Unorderable Types and Values::
* 残りのはしばし: 残りのはしばし<2>.
* 部分的なソート::

Unicode HOWTO

* Unicode 入門::
* Python の Unicode サポート::
* Unicode データを読み書きする::
* 謝辞: 謝辞<10>.

Unicode 入門

* 定義::
* エンコーディング: エンコーディング<3>.
* 参考資料: 参考資料<3>.

Python の Unicode サポート

* 文字列型::
* バイト列への変換::
* Python ソースコード内の Unicode リテラル::
* Unicode プロパティ::
* Comparing Strings::
* Unicode 正規表現::
* 参考資料: 参考資料<4>.

Unicode データを読み書きする

* Unicode ファイル名::
* Unicode 対応のプログラムを書くための Tips::
* 参考資料: 参考資料<5>.

Unicode 対応のプログラムを書くための Tips

* ファイルエンコーディングの変換::
* 不明なエンコーディングのファイル::

urllib パッケージを使ってインターネット上のリソースを取得するには

* はじめに: はじめに<17>.
* URL を取得する::
* 例外を処理する: 例外を処理する<2>.
* info と geturl::
* Openers と Handlers::
* Basic 認証::
* プロキシ::
* ソケットとレイヤー::
* 脚注::

URL を取得する

* データ::
* ヘッダ::

例外を処理する

* URLError::
* HTTPError::
* エラーをラップする::

HTTPError

* エラーコード::

エラーをラップする

* その1::
* その2::

ipaddressモジュールの紹介

* アドレス/ネットワーク/インターフェースオブジェクトの作成::
* アドレス/ネットワーク/インターフェースオブジェクト::
* アドレスのリストとしてのネットワーク::
* 比較: 比較<4>.
* 他のモジュールでIPアドレスを使用する::
* インスタンスの生成に失敗した場合にさらに詳細を取得する::

アドレス/ネットワーク/インターフェースオブジェクトの作成

* IPバージョンについての注意::
* IPホストアドレス::
* ネットワークを定義する::
* ホストインターフェース::

DTrace と SystemTap で CPython を測定する

* 静的マーカーの有効化::
* 静的 DTrace プローブ::
* 静的 SystemTap マーカー::
* 利用可能な静的マーカー::
* SystemTap Tapset::
* 使用例: 使用例<58>.

Python support for the Linux perf profiler

* How to enable perf profiling support::
* How to obtain the best results::
* How to work without frame pointers::

Annotations Best Practices

* Accessing The Annotations Dict Of An Object In Python 3.10 And Newer: Accessing The Annotations Dict Of An Object In Python 3 10 And Newer.
* Accessing The Annotations Dict Of An Object In Python 3.9 And Older: Accessing The Annotations Dict Of An Object In Python 3 9 And Older.
* Manually Un-Stringizing Stringized Annotations::
* Best Practices For __annotations__ In Any Python Version::
* __annotations__ Quirks::

拡張モジュールを分離する

* Who should read this::
* 背景: 背景<2>.
* Making Modules Safe with Multiple Interpreters::
* Heap Types: Heap Types<2>.
* 取り掛かり中の問題::

背景

* Enter Per-Module State::
* Isolated Module Objects::
* Surprising Edge Cases::

Making Modules Safe with Multiple Interpreters

* Managing Global State::
* Managing Per-Module State::
* Opt-Out; Limiting to One Module Object per Process: Opt-Out Limiting to One Module Object per Process.
* Module State Access from Functions::

Heap Types

* Changing Static Types to Heap Types::
* Defining Heap Types::
* Garbage-Collection Protocol::
* Module State Access from Classes::
* Module State Access from Regular Methods::
* Module State Access from Slot Methods, Getters and Setters: Module State Access from Slot Methods Getters and Setters.
* Lifetime of the Module State::

Garbage-Collection Protocol

* tp_traverse in Python 3.8 and lower: tp_traverse in Python 3 8 and lower.
* Delegating tp_traverse::
* Defining tp_dealloc::
* Not overriding tp_free::
* Avoiding PyObject_New::

取り掛かり中の問題

* クラスごとのスコープ::
* Lossless Conversion to Heap Types::

timer file descriptor HOWTO

* 使用例: 使用例<59>.

The Python 2.3 Method Resolution Order

* The beginning::
* The C3 Method Resolution Order::
* 使用例: 使用例<60>.
* Bad Method Resolution Orders::
* The end::
* Resources::

Python support for free threading

* Installation: Installation<2>.
* Identifying free-threaded Python::
* The global interpreter lock in free-threaded Python::
* Thread safety::
* Known limitations::
* Behavioral changes::

Known limitations

* Immortalization::
* フレーム (frame) オブジェクト: フレーム frame オブジェクト<3>.
* イテレータ (iterator): イテレータ iterator<3>.
* Single-threaded performance::

Behavioral changes

* Context variables::
* Warning filters::

C API Extension Support for Free Threading

* Identifying the Free-Threaded Build in C::
* Module Initialization::
* General API Guidelines::
* Borrowed References::
* Memory Allocation APIs::
* Thread State and GIL APIs::
* Protecting Internal Extension State::
* Critical Sections::
* Building Extensions for the Free-Threaded Build::

Module Initialization

* Multi-Phase Initialization::
* Single-Phase Initialization::

General API Guidelines

* Container Thread Safety::

Container Thread Safety

* PyDict_Next::

Critical Sections

* What Are Critical Sections?::
* Using Critical Sections::
* How Critical Sections Work::
* Deadlock Avoidance::
* Important Considerations::

Building Extensions for the Free-Threaded Build

* Limited C API and Stable ABI::
* Windows: Windows<85>.

Remote debugging attachment protocol

* Disabling remote debugging::

Python よくある質問

* 一般 Python FAQ::
* プログラミング FAQ::
* デザインと歴史 FAQ::
* ライブラリと拡張 FAQ::
* 拡張と埋め込み FAQ::
* Windows 上の Python FAQ::
* グラフィックユーザインターフェース FAQ::
* "なぜ Python が私のコンピュータにインストールされているのですか？" FAQ::

一般 Python FAQ

* 一般情報::
* 現実世界での Python::

一般情報

* Python とは何ですか？::
* Python Software Foundation とは何ですか？::
* Python を使うのに著作権の制限はありますか？::
* そもそも Python は何故創られたのですか？::
* Python は何をするのに向いていますか？::
* Python のバージョン番号の仕組みはどうなっているのですか？::
* Python のソースのコピーはどこで手に入りますか？::
* Python のドキュメントはどこで手に入りますか？::
* プログラミングをしたことがないのですが、Python のチュートリアルはありますか？::
* Python のためのニュースグループやメーリングリストはありますか？::
* Python のベータテスト版はどこで手に入りますか？::
* Python のバグ報告やパッチを上げるにはどうしたら良いですか？::
* Python について発行された記事を何か参照できますか？::
* Python の本はありますか？::
* www.python.org は世界のどこにあるのですか？: www python org は世界のどこにあるのですか？.
* なぜ Python という名前なのですか？::
* 『空飛ぶモンティ・パイソン』を好きでなくてはいけませんか？::

現実世界での Python

* Python はどれくらい安定していますか？::
* どれくらいの人が Python を使っていますか？::
* Python で行われた大きなプロジェクトはありますか？::
* 将来 Python にどのような新しい開発が期待されますか？::
* Python の互換性を無くすような提案をしてもいいのですか？::
* Python は初心者プログラマに向いている言語ですか？::

プログラミング FAQ

* 一般的な質問::
* コア言語::
* 数と文字列::
* 性能: 性能<4>.
* シーケンス(タプル/リスト): シーケンス タプル/リスト.
* オブジェクト::
* モジュール: モジュール<5>.

一般的な質問

* ブレークポイントやシングルステップ実行などを備えたソースコードレベルデバッガはありますか？::
* バグの発見や静的解析に役立つツールはありますか？::
* どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？::
* Python プログラムのためのコーディングスタンダードやスタイルガイドはありますか？::

コア言語

* なぜ変数に値があるのに UnboundLocalError が出るのですか？::
* Python のローカルとグローバル変数のルールは何ですか？::
* ループの中で異なる値で定義されたラムダ式が、同じ値を返すのはなぜですか？::
* グローバル変数をモジュール間で共有するにはどうしたらいいですか？::
* モジュールで import を使う際の「ベストプラクティス」は何ですか？::
* なぜオブジェクト間でデフォルト値が共有されるのですか？::
* オプションパラメータやキーワードパラメータを関数から関数へ渡すにはどうしたらいいですか？::
* 実引数と仮引数の違いは何ですか?::
* なぜ list 'y' を変更すると list 'x' も変更されるのですか?::
* 出力引数のある関数 (参照渡し) はどのように書きますか？: 出力引数のある関数 参照渡し はどのように書きますか？.
* Python で高次関数はどのようにつくりますか？::
* Python のオブジェクトはどのようにコピーしますか？::
* オブジェクトのメソッドや属性はどのように見つけますか？::
* コードはどのようにオブジェクトの名前を見つけるのですか？::
* カンマ演算子はなぜ優先されるのですか？::
* C の "?;" 三項演算子と等価なものはありますか？: C の "? " 三項演算子と等価なものはありますか？.
* Python で解し難いワンライナーを書くことはできますか？::
* 関数の引数リストにあるスラッシュ (/) は何を意味しますか？: 関数の引数リストにあるスラッシュ / は何を意味しますか？.

数と文字列

* 十六進数や八進数を指定するにはどうしたらいいですか？::
* なぜ -22 // 10 は -3 を返すのですか？::
* どうすれば SyntaxError を起こさずに整数リテラルの属性を得られますか？::
* 文字列を数に変換するにはどうしたらいいですか？::
* 数を文字列に変換するにはどうしたらいいですか？::
* 文字列をインプレースに変更するにはどうしたらいいですか？::
* 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？::
* Is there an equivalent to Perl's chomp() for removing trailing newlines from strings?: Is there an equivalent to Perl's chomp for removing trailing newlines from strings?.
* Is there a scanf() or sscanf() equivalent?: Is there a scanf or sscanf equivalent?.
* What does UnicodeDecodeError or UnicodeEncodeError error mean?::
* raw string を奇数個のバックスラッシュで終えることはできますか？::

性能

* プログラムが遅すぎます。どうしたら速くなりますか？::
* 多くの文字列を結合するのに最も効率的な方法は何ですか？::

シーケンス(タプル/リスト)

* タプル、リスト間の変更はどのようにするのですか？::
* 負の添え字は何ですか？::
* シーケンスを逆順にイテレートするにはどうしたらいいですか？::
* リストから重複を取り除くにはどうしますか？::
* How do you remove multiple items from a list?::
* Python で配列を作るにはどうしますか？::
* 多次元のリストを作るにはどうしますか？::
* オブジェクトのシーケンスにメソッドや関数を適用するにはどうしますか？::
* なぜ加算はされるのに a_tuple[i] += ['item'] は例外を送出するのですか?::
* 複雑なソートがしたいのですが、Python でシュワルツ変換はできますか？::
* リストを別のリストの値によってソートするにはどうしますか？::

オブジェクト

* クラスとは何ですか？::
* メソッドとは何ですか？::
* self とは何ですか？::
* あるオブジェクトが、与えられたクラスやそのサブクラスのインスタンスであるかを調べるにはどうしますか？::
* 委譲とは何ですか？::
* 基底クラスで定義されたメソッドを、そのクラスを継承した派生クラスから呼び出すにはどうしますか？::
* 基底クラスの名前を変えやすいコードを書くにはどうしますか？::
* 静的なクラスデータや静的なクラスメソッドを作るにはどうしますか？::
* Python でコンストラクタ(やメソッド)をオーバーロードするにはどうしたらいいですか？: Python でコンストラクタ やメソッド をオーバーロードするにはどうしたらいいですか？.
* __spam を使おうとしたら _SomeClassName__spam からエラーがでました。::
* クラスに __del__ メソッドを定義しているのですが、オブジェクトを削除したときに呼ばれません。::
* 与えられたクラスのすべてのインスタンスのリストを得るにはどうしますか？::
* なぜ id() の結果は一意でないように見えるのですか?: なぜ id の結果は一意でないように見えるのですか?.
* いつ is 演算子での同一性テストが頼れますか？::
* どうすればサブクラスはイミュータブルなインスタンスに格納されたデータを制御できますか？::
* メソッド呼び出しをキャッシュするには どうしたらいいですか？::

モジュール

* .pyc ファイルを作るにはどうしますか？: pyc ファイルを作るにはどうしますか？.
* 現在のモジュール名を知るにはどうしますか？::
* 相互にインポートしあうモジュールを作るにはどうしたらいいですか？::
* __import__('x.y.z') は <module 'x'> を返しますが、z を得るためにはどうしますか？: __import__ 'x y z' は <module 'x'> を返しますが、z を得るためにはどうしますか？.
* インポートされたモジュールを編集してから再インポートしましたが、変化が現れません。なぜですか？::

デザインと歴史 FAQ

* Python はなぜ文のグループ化にインデントを使うのですか？::
* なぜ単純な算術演算が奇妙な結果になるのですか？::
* なぜ浮動小数点数の計算はこんなに不正確なんですか？::
* なぜ Python の文字列はイミュータブルなのですか？::
* なぜメソッドの定義や呼び出しにおいて 'self' を明示しなければならないのですか？::
* 式中で代入ができないのはなぜですか？::
* Python にメソッドを使う機能 (list.index() 等) と関数を使う機能 (len(list) 等) があるのはなぜですか？: Python にメソッドを使う機能 list index 等 と関数を使う機能 len list 等 があるのはなぜですか？.
* join() がリストやタプルのメソッドではなく文字列のメソッドなのはなぜですか？: join がリストやタプルのメソッドではなく文字列のメソッドなのはなぜですか？.
* 例外はどれくらい速いのですか？::
* Python に switch や case 文がないのはなぜですか？::
* OS 特有のスレッド実装に依らずにインタプリタでスレッドをエミュレートすることはできないのですか？::
* なぜラムダ式は文を含むことができないのですか?::
* Python は C やその他の言語のように機械語にコンパイルできますか？::
* Python はメモリをどのように管理するのですか？::
* CPython はなぜ伝統的なガベージコレクションスキームを使わないのですか？::
* なぜ CPython の終了時にすべてのメモリが解放されるわけではないのですか？::
* なぜタプルとリストという別のデータ型が用意されているのですか？::
* CPythonでリストはどのように実装されているのですか？::
* CPythonで辞書はどのように実装されていますか？::
* なぜ辞書のキーはイミュータブルでなくてはならないのですか？::
* なぜ list.sort() はソートされたリストを返さないのですか？: なぜ list sort はソートされたリストを返さないのですか？.
* Python ではどのようにインターフェース仕様を特定し適用するのですか？::
* なぜ goto が無いのですか？::
* なぜ raw 文字列 (r-strings) はバックスラッシュで終わってはいけないのですか？: なぜ raw 文字列 r-strings はバックスラッシュで終わってはいけないのですか？.
* 属性の代入に "with" 文が使えないのはなぜですか？::
* なぜジェネレータは with 文をサポートしないのですか？::
* if/while/def/class 文にコロンが必要なのはなぜですか？::
* なぜ Python ではリストやタプルの最後にカンマがあっても良いのですか？::

ライブラリと拡張 FAQ

* ライブラリ一般の質問::
* よくある作業::
* スレッド::
* 入力と出力: 入力と出力<2>.
* ネットワーク/インターネットプログラミング::
* データベース::
* 数学と数::

ライブラリ一般の質問

* 作業 X を行うためのモジュールやアプリケーションを探すにはどうしますか？::
* math.py (socket.py, regex.py, etc.) のソースファイルはどこにありますか？: math py socket py regex py etc のソースファイルはどこにありますか？.
* Python のスクリプトを Unix で実行可能にするにはどうしますか？::
* Python には curses/termcap パッケージはありますか？::
* Python には C の onexit() に相当するものはありますか？: Python には C の onexit に相当するものはありますか？.
* シグナルハンドラが動かないのですがなぜですか？::

よくある作業

* Python のプログラムやコンポーネントをテストするにはどうしますか？::
* Python のドキュメント文字列からドキュメントを生成するにはどうしますか？::
* 一度に一つの押鍵を取得するにはどうしますか？::

スレッド

* スレッドを使ったプログラムを書くにはどうしますか？::
* スレッドが一つも実行されていないようです。なぜですか？::
* たくさんのワーカースレッドに作業を割り振るにはどうしますか？::
* グローバルな値のどんな種類の変更がスレッドセーフになるのですか？::
* グローバルインタプリタロック (Global Interpreter Lock) を取り除くことはできないのですか？: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？.

入力と出力

* ファイルを削除するにはどうしますか？ (その他、ファイルに関する質問...): ファイルを削除するにはどうしますか？ その他、ファイルに関する質問.
* ファイルをコピーするにはどうしますか？::
* バイナリデータを読み書きするにはどうしますか？::
* os.popen() によって作られたパイプで os.read() が使われていないようです。なぜですか？: os popen によって作られたパイプで os read が使われていないようです。なぜですか？.
* シリアル (RS232) ポートにアクセスするにはどうしますか？: シリアル RS232 ポートにアクセスするにはどうしますか？.
* sys.stdout (stdin, stderr) を閉じようとしても実際に閉じられないのはなぜですか？: sys stdout stdin stderr を閉じようとしても実際に閉じられないのはなぜですか？.

ネットワーク/インターネットプログラミング

* Python の WWW ツールには何がありますか？::
* どのモジュールが HTML の生成の役に立ちますか？::
* Python のスクリプトからメールを送るにはどうしますか？::
* ソケットの connect() メソッドでブロッキングされなくするにはどうしますか？: ソケットの connect メソッドでブロッキングされなくするにはどうしますか？.

データベース

* Python にはデータベースパッケージへのインターフェースはありますか？::
* Python で永続的なオブジェクトを実装するにはどうしますか？::

数学と数

* Python で乱数を生成するにはどうしますか？::

拡張と埋め込み FAQ

* C で独自の関数を作ることはできますか？::
* C++ で独自の関数を作ることはできますか？::
* C を書くのは大変です。他の方法はありませんか？::
* C から任意の Python 文を実行するにはどうしますか？::
* C から任意の Python 式を評価するにはどうしますか？::
* Python オブジェクトから C の値を取り出すにはどうしますか？::
* Py_BuildValue() で任意長のタプルを作るにはどうしますか？: Py_BuildValue で任意長のタプルを作るにはどうしますか？.
* C からオブジェクトのメソッドを呼び出すにはどうしますか？::
* PyErr_Print() (その他 stdout/stderr に印字するもの) からの出力を受け取るにはどうしますか？: PyErr_Print その他 stdout/stderr に印字するもの からの出力を受け取るにはどうしますか？.
* C から Python で書かれたモジュールにアクセスするにはどうしますか？::
* Python から C++ へインターフェースするにはどうしますか？::
* セットアップファイルでモジュールを追加しようとしたらメイクに失敗しました。なぜですか？::
* 拡張をデバッグするにはどうしますか？::
* Linux システムで Python モジュールをコンパイルしたいのですが、見つからないファイルがあります。なぜですか？::
* "不完全 (incomplete) な入力" を "不適切 (invalid) な入力" から区別するにはどうしますか？: "不完全 incomplete な入力" を "不適切 invalid な入力" から区別するにはどうしますか？.
* 未定義の g++ シンボル __builtin_new や __pure_virtual を見つけるにはどうしますか？::
* メソッドのいくつかは C で、その他は Python で実装されたオブジェクトクラスを (継承などで) 作ることはできますか？: メソッドのいくつかは C で、その他は Python で実装されたオブジェクトクラスを 継承などで 作ることはできますか？.

Windows 上の Python FAQ

* Python プログラムを Windows で動かすにはどうしますか？::
* Python スクリプトを実行可能にするにはどうしますか？::
* Python の起動に時間がかかることがあるのはなぜですか？::
* どうすれば Python スクリプトを EXE に出来ますか?::
* *.pyd ファイルは DLL と同じですか？: * pyd ファイルは DLL と同じですか？.
* Python を Windows アプリケーションに埋め込むにはどうしたらいいですか？::
* エディタが Python ソースにタブを勝手に挿入しないようにするにはどうしますか？::
* ブロックすることなく押鍵を検出するにはどうしますか？::
* missing api-ms-win-crt-runtime-l1-1-0.dll エラーを解決するにはどうしますか？: missing api-ms-win-crt-runtime-l1-1-0 dll エラーを解決するにはどうしますか？.

グラフィックユーザインターフェース FAQ

* 一般的な GUI の質問::
* Python の GUI ツールキットには何がありますか？::
* Tkinter の質問::

Tkinter の質問

* Tkinter アプリケーションを凍結するにはどうしますか？::
* I/O を待つ間に扱われる Tk イベントを作れますか？::
* Tkinter で働くキーバインディングが得られません。なぜですか？::

"なぜ Python が私のコンピュータにインストールされているのですか？" FAQ

* Python とは何ですか？: Python とは何ですか？<2>.
* なぜ Python が私のマシンにインストールされているのですか？::
* Python を削除してもいいですか？::

非推奨

* Pending removal in Python 3.15: Pending removal in Python 3 15<7>.
* Pending removal in Python 3.16: Pending removal in Python 3 16<7>.
* Pending removal in Python 3.17: Pending removal in Python 3 17<4>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<5>.
* Pending removal in Python 3.19: Pending removal in Python 3 19<3>.
* Pending removal in future versions: Pending removal in future versions<7>.
* C API deprecations::

C API deprecations

* Pending removal in Python 3.15: Pending removal in Python 3 15<8>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<6>.
* Pending removal in future versions: Pending removal in future versions<8>.

このドキュメントについて

* Pythonドキュメントへの貢献者::

バグへの対処

* ドキュメントの不備::
* Python の課題管理システムを使う::
* Python への貢献をはじめる::

歴史とライセンス

* Python の歴史::
* Terms and conditions for accessing or otherwise using Python::
* Licenses and Acknowledgements for Incorporated Software::

Terms and conditions for accessing or otherwise using Python

* PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2::
* BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0: BEOPEN COM LICENSE AGREEMENT FOR PYTHON 2 0.
* CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1: CNRI LICENSE AGREEMENT FOR PYTHON 1 6 1.
* CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2: CWI LICENSE AGREEMENT FOR PYTHON 0 9 0 THROUGH 1 2.
* ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION::

Licenses and Acknowledgements for Incorporated Software

* Mersenne Twister::
* ソケット: ソケット<2>.
* Asynchronous socket services::
* Cookie management::
* Execution tracing::
* UUencode and UUdecode functions::
* XML Remote Procedure Calls::
* test_epoll::
* Select kqueue::
* SipHash24::
* strtod と dtoa::
* OpenSSL: OpenSSL<2>.
* expat::
* libffi::
* zlib: zlib<4>.
* cfuhash::
* libmpdec::
* W3C C14N test suite::
* mimalloc::
* asyncio: asyncio<15>.
* Global Unbounded Sequences (GUS): Global Unbounded Sequences GUS.
* Zstandard bindings::



File: python.info,  Node: What's New in Python,  Next: Python チュートリアル,  Prev: Top,  Up: Top

1 What's New in Python
**********************

この"What's New in Python"という一連の文書はPythonのメジャーバージョンに
おける最も重要な変更点を紹介します。新しくリリースされた後でも最新の状態
であり続けたい人にとって必読のものです。

* Menu:

* What's new in Python 3.14: What's new in Python 3 14.
* What's New In Python 3.13: What's New In Python 3 13.
* What's New In Python 3.12: What's New In Python 3 12.
* What's New In Python 3.11: What's New In Python 3 11.
* What's New In Python 3.10: What's New In Python 3 10.
* What's New In Python 3.9: What's New In Python 3 9.
* What's New In Python 3.8: What's New In Python 3 8.
* What's New In Python 3.7: What's New In Python 3 7.
* What's New In Python 3.6: What's New In Python 3 6.
* What's New In Python 3.5: What's New In Python 3 5.
* What's New In Python 3.4: What's New In Python 3 4.
* What's New In Python 3.3: What's New In Python 3 3.
* What's New In Python 3.2: What's New In Python 3 2.
* What's New In Python 3.1: What's New In Python 3 1.
* What's New In Python 3.0: What's New In Python 3 0.
* What's New in Python 2.7: What's New in Python 2 7.
* What's New in Python 2.6: What's New in Python 2 6.
* What's New in Python 2.5: What's New in Python 2 5.
* What's New in Python 2.4: What's New in Python 2 4.
* What's New in Python 2.3: What's New in Python 2 3.
* What's New in Python 2.2: What's New in Python 2 2.
* What's New in Python 2.1: What's New in Python 2 1.
* What's New in Python 2.0: What's New in Python 2 0.
* 変更履歴::


File: python.info,  Node: What's new in Python 3 14,  Next: What's New In Python 3 13,  Up: What's New in Python

1.1 What's new in Python 3.14
=============================


エディタ: Adam Turner と Hugo van Kemenade

この記事では Python 3.13 と比較した Python 3.14 の新機能を解説します。
Python 3.14 は2025年10月7日にリリースされました。全詳細については *note
変更履歴: 142. をご覧ください。

参考
....

PEP 745(1) - Python 3.14 リリーススケジュール

* Menu:

* 概要: 概要 -- リリースハイライト. リリースハイライト
* 新しい機能::
* Other language changes::
* 新しいモジュール::
* Improved modules::
* 最適化::
* 削除::
* 非推奨::
* CPython バイトコードの変更::
* C API changes::
* Build changes::
* Porting to Python 3.14: Porting to Python 3 14.
* Notable changes in 3.14.1: Notable changes in 3 14 1.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0745/


File: python.info,  Node: 概要 -- リリースハイライト,  Next: 新しい機能,  Up: What's new in Python 3 14

1.1.1 概要 - リリースハイライト
-------------------------------

Python 3.14 はプログラミング言語 Python の最新のリリースです。言語自体へ
の変更や、実装、標準ライブラリのアップデートが含まれます。一番大きな変更
点は、新しい *note テンプレート文字列リテラル: 144.、*note
アノテーションの遅延評価: 145.、標準ライブラリへの *note
subinterpreters: 146. の追加です。

ライブラリの変更内容には *note asyncio のイントロスペクション機能: 147.
の重要な改善、 新モジュール *note compression.zstd: 23. による *note
Zstandard のサポート: 148. 、 REPL における構文ハイライトが、通常の非推
奨化や削除、また利便性と正確性の向上に加えて含まれます。

本記事は、全ての新機能の仕様をを網羅的に説明する代わりに、分かりやすく概
要を説明するものとなっています。詳細については *note
ライブラリリファレンス: 149. や *note 言語レファレンス: 14a. などを参照
してください。各変更点の実装や設計の理由を網羅的に理解したい方は、該当の
PEP を参照してください。ただし、 PEP は機能が実装されたあとは Python の
最新バージョンに合わせて更新されないことが多いので注意してください。
Python を以前のバージョンからアップグレードする際の注意点は *note
Porting to Python 3.14: 14b. を参照してください。

__________________________________________________________________

インタプリタの改善:

   * PEP 649(1) と PEP 749(2): *note アノテーションの遅延評価: 145.

   * PEP 734(3): *note 標準ライブラリにおける複数インタープリタ: 146.

   * PEP 750(4): *note テンプレート文字列: 144.

   * PEP 758(5): *note 括弧を省略した except and except* 式を許可: 14c.

   * PEP 765(6): *note finally ブロック内の制御フロー: 14d.

   * PEP 768(7): *note CPython
     における安全な外部デバッガインターフェース: 14e.

   * *note 新型のインタープリタ: 14f.

   * *note フリースレッドモードの改善: 150.

   * *note エラーメッセージの改善: 151.

   * *note 漸進的なガベージコレクション: 152.

標準ライブラリーの顕著な改善

   * PEP 784(8): *note 標準ライブラリでの Zstandard のサポート: 148.

   * *note Asyncio introspection capabilities: 147.

   * *note Concurrent safe warnings control: 153.

   * *note デフォルトの対話シェルでのシンタックスハイライトSyntax
     highlighting in the default interactive shell: 154. と、複数の標準
     ライブラリのCLIでのカラー出力

C API の改善:

   * PEP 741(9): *note Python configuration C API: 155.

プラットフォームのサポート:

   * PEP 776(10): Emscripten が tier 3(11) として *note
     公式にサポートされるプラットフォーム: 156. となりました。

リリースの変更:

   * PEP 779(12): *note フリースレッドな Python
     は公式にサポートされました: 157.

   * PEP 761(13): *note 公式のリリースについて、PGP
     署名は廃止されました: 158.

   * *note Windows と macOS
     のバイナリリリースは、実験的なジャスト・イン・タイムコンパイラをサポートします:
     159.

   * *note Android のためのバイナリリリースが提供されるようになりました:
     156.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0649/

   (2) https://peps.python.org/pep-0749/

   (3) https://peps.python.org/pep-0734/

   (4) https://peps.python.org/pep-0750/

   (5) https://peps.python.org/pep-0758/

   (6) https://peps.python.org/pep-0765/

   (7) https://peps.python.org/pep-0768/

   (8) https://peps.python.org/pep-0784/

   (9) https://peps.python.org/pep-0741/

   (10) https://peps.python.org/pep-0776/

   (11) https://peps.python.org/pep-0011/#tier-3

   (12) https://peps.python.org/pep-0779/

   (13) https://peps.python.org/pep-0761/


File: python.info,  Node: 新しい機能,  Next: Other language changes,  Prev: 概要 -- リリースハイライト,  Up: What's new in Python 3 14

1.1.2 新しい機能
----------------

* Menu:

* PEP 649 と PEP 749; アノテーションの遅延評価: PEP 649 と PEP 749 アノテーションの遅延評価.
* PEP 734; Multiple interpreters in the standard library: PEP 734 Multiple interpreters in the standard library.
* PEP 750; テンプレート文字列リテラル: PEP 750 テンプレート文字列リテラル.
* PEP 768; Safe external debugger interface: PEP 768 Safe external debugger interface.
* A new type of interpreter::
* Free-threaded mode improvements::
* エラーメッセージの改善::
* PEP 784; Zstandard support in the standard library: PEP 784 Zstandard support in the standard library.
* Asyncio introspection capabilities::
* Concurrent safe warnings control::


File: python.info,  Node: PEP 649 と PEP 749 アノテーションの遅延評価,  Next: PEP 734 Multiple interpreters in the standard library,  Up: 新しい機能

'PEP 649' と 'PEP 749': アノテーションの遅延評価

The *note annotations: 15c. on functions, classes, and modules are no
longer evaluated eagerly.  Instead, annotations are stored in
special-purpose *note annotate functions: 15d. and evaluated only when
necessary (except if ‘from __future__ import annotations’ is used).

This change is designed to improve performance and usability of
annotations in Python in most circumstances.  The runtime cost for
defining annotations is minimized, but it remains possible to introspect
annotations at runtime.  It is no longer necessary to enclose
annotations in strings if they contain forward references.

The new *note annotationlib: 6. module provides tools for inspecting
deferred annotations.  Annotations may be evaluated in the *note VALUE:
15e. format (which evaluates annotations to runtime values, similar to
the behavior in earlier Python versions), the *note FORWARDREF: 15f.
format (which replaces undefined names with special markers), and the
*note STRING: 160. format (which returns annotations as strings).

This example shows how these formats behave:

     >>> from annotationlib import get_annotations, Format
     >>> def func(arg: Undefined):
     ...     pass
     >>> get_annotations(func, format=Format.VALUE)
     Traceback (most recent call last):
       ...
     NameError: name 'Undefined' is not defined
     >>> get_annotations(func, format=Format.FORWARDREF)
     {'arg': ForwardRef('Undefined', owner=<function func at 0x...>)}
     >>> get_annotations(func, format=Format.STRING)
     {'arg': 'Undefined'}

The *note porting: 161. section contains guidance on changes that may be
needed due to these changes, though in the majority of cases, code will
continue working as-is.

(Contributed by Jelle Zijlstra in PEP 749(1) and gh-119180(2); PEP
649(3) was written by Larry Hastings.)

参考
....

PEP 649(4)

     Deferred Evaluation Of Annotations Using Descriptors

PEP 749(5)

     Implementing PEP 649

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0749/

   (2) https://github.com/python/cpython/issues/119180

   (3) https://peps.python.org/pep-0649/

   (4) https://peps.python.org/pep-0649/

   (5) https://peps.python.org/pep-0749/


File: python.info,  Node: PEP 734 Multiple interpreters in the standard library,  Next: PEP 750 テンプレート文字列リテラル,  Prev: PEP 649 と PEP 749 アノテーションの遅延評価,  Up: 新しい機能

'PEP 734': Multiple interpreters in the standard library

The CPython runtime supports running multiple copies of Python in the
same process simultaneously and has done so for over 20 years.  Each of
these separate copies is called an 'interpreter'.  However, the feature
had been available only through the *note C-API: 163.

That limitation is removed in Python 3.14, with the new *note
concurrent.interpreters: 25. module.

There are at least two notable reasons why using multiple interpreters
has significant benefits:

   * they support a new (to Python), human-friendly concurrency model

   * true multi-core parallelism

For some use cases, concurrency in software improves efficiency and can
simplify design, at a high level.  At the same time, implementing and
maintaining all but the simplest concurrency is often a struggle for the
human brain.  That especially applies to plain threads (for example,
*note threading: f3.), where all memory is shared between all threads.

With multiple isolated interpreters, you can take advantage of a class
of concurrency models, like Communicating Sequential Processes (CSP) or
the actor model, that have found success in other programming languages,
like Smalltalk, Erlang, Haskell, and Go.  Think of multiple interpreters
as threads but with opt-in sharing.

Regarding multi-core parallelism: as of Python 3.12, interpreters are
now sufficiently isolated from one another to be used in parallel (see
PEP 684(1)).  This unlocks a variety of CPU-intensive use cases for
Python that were limited by the *note GIL: 164.

Using multiple interpreters is similar in many ways to *note
multiprocessing: 98, in that they both provide isolated logical
"processes" that can run in parallel, with no sharing by default.
However, when using multiple interpreters, an application will use fewer
system resources and will operate more efficiently (since it stays
within the same process).  Think of multiple interpreters as having the
isolation of processes with the efficiency of threads.

While the feature has been around for decades, multiple interpreters
have not been used widely, due to low awareness and the lack of a
standard library module.  Consequently, they currently have several
notable limitations, which are expected to improve significantly now
that the feature is going mainstream.

Current limitations:

   * starting each interpreter has not been optimized yet

   * each interpreter uses more memory than necessary (work continues on
     extensive internal sharing between interpreters)

   * there aren't many options 'yet' for truly sharing objects or other
     data between interpreters (other than *note memoryview: 165.)

   * many third-party extension modules on PyPI are not yet compatible
     with multiple interpreters (all standard library extension modules
     'are' compatible)

   * the approach to writing applications that use multiple isolated
     interpreters is mostly unfamiliar to Python users, for now

The impact of these limitations will depend on future CPython
improvements, how interpreters are used, and what the community solves
through PyPI packages.  Depending on the use case, the limitations may
not have much impact, so try it out!

Furthermore, future CPython releases will reduce or eliminate overhead
and provide utilities that are less appropriate on PyPI. In the
meantime, most of the limitations can also be addressed through
extension modules, meaning PyPI packages can fill any gap for 3.14, and
even back to 3.12 where interpreters were finally properly isolated and
stopped sharing the *note GIL: 164.  Likewise, libraries on PyPI are
expected to emerge for high-level abstractions on top of interpreters.

Regarding extension modules, work is in progress to update some PyPI
projects, as well as tools like Cython, pybind11, nanobind, and PyO3.
The steps for isolating an extension module are found at *note
拡張モジュールを分離する: 166.  Isolating a module has a lot of overlap
with what is required to support *note free-threading: 150, so the
ongoing work in the community in that area will help accelerate support
for multiple interpreters.

Also added in 3.14: *note concurrent.futures.InterpreterPoolExecutor:
167.

(Contributed by Eric Snow in gh-134939(2).)

参考
....

PEP 734(3)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0684/

   (2) https://github.com/python/cpython/issues/134939

   (3) https://peps.python.org/pep-0734/


File: python.info,  Node: PEP 750 テンプレート文字列リテラル,  Next: PEP 768 Safe external debugger interface,  Prev: PEP 734 Multiple interpreters in the standard library,  Up: 新しい機能

'PEP 750': テンプレート文字列リテラル

Template strings are a new mechanism for custom string processing.  They
share the familiar syntax of f-strings but, unlike f-strings, return an
object representing the static and interpolated parts of the string,
instead of a simple *note str: 169.

t-stringを書くには、プレフィックスとして ‘'f'’ の代わりに ‘'t'’ を使用し
ます:

     >>> variety = 'Stilton'
     >>> template = t'Try some {variety} cheese!'
     >>> type(template)
     <class 'string.templatelib.Template'>

*note Template: 16a. objects provide access to the static and
interpolated (in curly braces) parts of a string 'before' they are
combined.  Iterate over ‘Template’ instances to access their parts in
order:

     >>> list(template)
     ['Try some ', Interpolation('Stilton', 'variety', None, ''), ' cheese!']

It's easy to write (or call) code to process ‘Template’ instances.  For
example, here's a function that renders static parts lowercase and *note
Interpolation: 16b. instances uppercase:

     from string.templatelib import Interpolation

     def lower_upper(template):
         """固定の箇所は小文字に、interpolationsは大文字に変換する"""
         parts = []
         for part in template:
             if isinstance(part, Interpolation):
                 parts.append(str(part.value).upper())
             else:
                 parts.append(part.lower())
         return ''.join(parts)

     name = 'Wenslydale'
     template = t'Mister {name}'
     assert lower_upper(template) == 'mister WENSLYDALE'

Because ‘Template’ instances distinguish between static strings and
interpolations at runtime, they can be useful for sanitising user input.
Writing a ‘html()’ function that escapes user input in HTML is an
exercise left to the reader!  Template processing code can provide
improved flexibility.  For instance, a more advanced ‘html()’ function
could accept a ‘dict’ of HTML attributes directly in the template:

     attributes = {'src': 'limburger.jpg', 'alt': 'lovely cheese'}
     template = t'<img {attributes}>'
     assert html(template) == '<img src="limburger.jpg" alt="lovely cheese" />'

Of course, template processing code does not need to return a
string-like result.  An even 'more' advanced ‘html()’ could return a
custom type representing a DOM-like structure.

With t-strings in place, developers can write systems that sanitise SQL,
make safe shell operations, improve logging, tackle modern ideas in web
development (HTML, CSS, and so on), and implement lightweight custom
business DSLs.

(Contributed by Jim Baker, Guido van Rossum, Paul Everitt, Koudai Aono,
Lysandros Nikolaou, Dave Peck, Adam Turner, Jelle Zijlstra, Bénédikt
Tran, and Pablo Galindo Salgado in gh-132661(1).)

参考
....

PEP 750(2)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132661

   (2) https://peps.python.org/pep-0750/


File: python.info,  Node: PEP 768 Safe external debugger interface,  Next: A new type of interpreter,  Prev: PEP 750 テンプレート文字列リテラル,  Up: 新しい機能

'PEP 768': Safe external debugger interface

Python 3.14 introduces a zero-overhead debugging interface that allows
debuggers and profilers to safely attach to running Python processes
without stopping or restarting them.  This is a significant enhancement
to Python's debugging capabilities, meaning that unsafe alternatives are
no longer required.

The new interface provides safe execution points for attaching debugger
code without modifying the interpreter's normal execution path or adding
any overhead at runtime.  Due to this, tools can now inspect and
interact with Python applications in real-time, which is a crucial
capability for high-availability systems and production environments.

For convenience, this interface is implemented in the *note
sys.remote_exec(): 16d. function.  For example:

     import sys
     from tempfile import NamedTemporaryFile

     with NamedTemporaryFile(mode='w', suffix='.py', delete=False) as f:
         script_path = f.name
         f.write(f'import my_debugger; my_debugger.connect({os.getpid()})')

     # Execute in process with PID 1234
     print('Behold! An offering:')
     sys.remote_exec(1234, script_path)

This function allows sending Python code to be executed in a target
process at the next safe execution point.  However, tool authors can
also implement the protocol directly as described in the PEP, which
details the underlying mechanisms used to safely attach to running
processes.

The debugging interface has been carefully designed with security in
mind and includes several mechanisms to control access:

   * A *note PYTHON_DISABLE_REMOTE_DEBUG: 16e. environment variable.

   * A *note -X disable-remote-debug: 16f. command-line option.

   * A *note -without-remote-debug: 170. configure flag to completely
     disable the feature at build time.

(Contributed by Pablo Galindo Salgado, Matt Wozniski, and Ivona
Stojanovic in gh-131591(1).)

参考
....

PEP 768(2).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131591

   (2) https://peps.python.org/pep-0768/


File: python.info,  Node: A new type of interpreter,  Next: Free-threaded mode improvements,  Prev: PEP 768 Safe external debugger interface,  Up: 新しい機能

1.1.2.5 A new type of interpreter
.................................

A new type of interpreter has been added to CPython.  It uses tail calls
between small C functions that implement individual Python opcodes,
rather than one large C ‘case’ statement.  For certain newer compilers,
this interpreter provides significantly better performance.  Preliminary
benchmarks suggest a geometric mean of 3-5% faster on the standard
‘pyperformance’ benchmark suite, depending on platform and architecture.
The baseline is Python 3.14 built with Clang 19, without this new
interpreter.

This interpreter currently only works with Clang 19 and newer on x86-64
and AArch64 architectures.  However, a future release of GCC is expected
to support this as well.

This feature is opt-in for now.  Enabling profile-guided optimization is
highly recommendeded when using the new interpreter as it is the only
configuration that has been tested and validated for improved
performance.  For further information, see *note -with-tail-call-interp:
172.

     注釈: This is not to be confused with tail call optimization(1) of
     Python functions, which is currently not implemented in CPython.

     This new interpreter type is an internal implementation detail of
     the CPython interpreter.  It doesn't change the visible behavior of
     Python programs at all.  It can improve their performance, but
     doesn't change anything else.

(Contributed by Ken Jin in gh-128563(2), with ideas on how to implement
this in CPython by Mark Shannon, Garrett Gu, Haoran Xu, and Josh
Haberman.)

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Tail_call

   (2) https://github.com/python/cpython/issues/128563


File: python.info,  Node: Free-threaded mode improvements,  Next: エラーメッセージの改善,  Prev: A new type of interpreter,  Up: 新しい機能

1.1.2.6 Free-threaded mode improvements
.......................................

CPython's free-threaded mode ( PEP 703(1)), initially added in 3.13, has
been significantly improved in Python 3.14.  The implementation
described in PEP 703 has been finished, including C API changes, and
temporary workarounds in the interpreter were replaced with more
permanent solutions.  The specializing adaptive interpreter ( PEP
659(2)) is now enabled in free-threaded mode, which along with many
other optimizations greatly improves its performance.  The performance
penalty on single-threaded code in free-threaded mode is now roughly
5-10%, depending on the platform and C compiler used.

From Python 3.14, when compiling extension modules for the free-threaded
build of CPython on Windows, the preprocessor variable ‘Py_GIL_DISABLED’
now needs to be specified by the build backend, as it will no longer be
determined automatically by the C compiler.  For a running interpreter,
the setting that was used at compile time can be found using *note
sysconfig.get_config_var(): 174.

The new *note -X context_aware_warnings: 16f. flag controls if *note
concurrent safe warnings control: 153. is enabled.  The flag defaults to
true for the free-threaded build and false for the GIL-enabled build.

A new *note thread_inherit_context: 175. flag has been added, which if
enabled means that threads created with *note threading.Thread: 176.
start with a copy of the *note Context(): 177. of the caller of *note
start(): 178.  Most significantly, this makes the warning filtering
context established by *note catch_warnings: 179. be "inherited" by
threads (or asyncio tasks) started within that context.  It also affects
other modules that use context variables, such as the *note decimal: 3a.
context manager.  This flag defaults to true for the free-threaded build
and false for the GIL-enabled build.

(Contributed by Sam Gross, Matt Page, Neil Schemenauer, Thomas Wouters,
Donghee Na, Kirill Podoprigora, Ken Jin, Itamar Oren, Brett Simmers,
Dino Viehland, Nathan Goldbaum, Ralf Gommers, Lysandros Nikolaou, Kumar
Aditya, Edgar Margffoy, and many others.  Some of these contributors are
employed by Meta, which has continued to provide significant engineering
resources to support this project.)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0703/

   (2) https://peps.python.org/pep-0659/


File: python.info,  Node: エラーメッセージの改善,  Next: PEP 784 Zstandard support in the standard library,  Prev: Free-threaded mode improvements,  Up: 新しい機能

1.1.2.7 エラーメッセージの改善
..............................

   * The interpreter now provides helpful suggestions when it detects
     typos in Python keywords.  When a word that closely resembles a
     Python keyword is encountered, the interpreter will suggest the
     correct keyword in the error message.  This feature helps
     programmers quickly identify and fix common typing mistakes.  For
     example:

          >>> whille True:
          ...     pass
          Traceback (most recent call last):
            File "<stdin>", line 1
              whille True:
              ^^^^^^
          SyntaxError: invalid syntax. Did you mean 'while'?

     While the feature focuses on the most common cases, some variations
     of misspellings may still result in regular syntax errors.
     (Contributed by Pablo Galindo in gh-132449(1).)

   * *note elif: 17b. statements that follow an *note else: 17c. block
     now have a specific error message.  (Contributed by Steele
     Farnsworth in gh-129902(2).)

          >>> if who == "me":
          ...     print("It's me!")
          ... else:
          ...     print("It's not me!")
          ... elif who is None:
          ...     print("Who is it?")
          File "<stdin>", line 5
            elif who is None:
            ^^^^
          SyntaxError: 'elif' block follows an 'else' block

   * If a statement is passed to the *note 条件式 (Conditional
     Expressions): 17d. after *note else: 17c, or one of *note pass:
     17e, *note break: 17f, or *note continue: 180. is passed before
     *note if: 181, then the error message highlights where the *note
     expression: 182. is required.  (Contributed by Sergey Miryanov in
     gh-129515(3).)

          >>> x = 1 if True else pass
          Traceback (most recent call last):
            File "<string>", line 1
              x = 1 if True else pass
                                 ^^^^
          SyntaxError: expected expression after 'else', but statement is given

          >>> x = continue if True else break
          Traceback (most recent call last):
            File "<string>", line 1
              x = continue if True else break
                  ^^^^^^^^
          SyntaxError: expected expression before 'if', but statement is given

   * When incorrectly closed strings are detected, the error message
     suggests that the string may be intended to be part of the string.
     (Contributed by Pablo Galindo in gh-88535(4).)

          >>> "The interesting object "The important object" is very important"
          Traceback (most recent call last):
          SyntaxError: invalid syntax. Is this intended to be part of the string?

   * When strings have incompatible prefixes, the error now shows which
     prefixes are incompatible.  (Contributed by Nikita Sobolev in
     gh-133197(5).)

          >>> ub'abc'
            File "<python-input-0>", line 1
              ub'abc'
              ^^
          SyntaxError: 'u' and 'b' prefixes are incompatible

   * Improved error messages when using ‘as’ with incompatible targets
     in:

        - Imports: ‘import ... as ...’

        - From imports: ‘from ... import ... as ...’

        - Except handlers: ‘except ... as ...’

        - Pattern-match cases: ‘case ... as ...’

     (Contributed by Nikita Sobolev in gh-123539(6), gh-123562(7), and
     gh-123440(8).)

   * Improved error message when trying to add an instance of an
     unhashable type to a *note dict: 183. or *note set: 184.
     (Contributed by CF Bolz-Tereick and Victor Stinner in
     gh-132828(9).)

          >>> s = set()
          >>> s.add({'pages': 12, 'grade': 'A'})
          Traceback (most recent call last):
            File "<python-input-1>", line 1, in <module>
              s.add({'pages': 12, 'grade': 'A'})
              ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          TypeError: cannot use 'dict' as a set element (unhashable type: 'dict')
          >>> d = {}
          >>> l = [1, 2, 3]
          >>> d[l] = 12
          Traceback (most recent call last):
            File "<python-input-4>", line 1, in <module>
              d[l] = 12
              ~^^^
          TypeError: cannot use 'list' as a dict key (unhashable type: 'list')

   * Improved error message when an object supporting the synchronous
     context manager protocol is entered using *note async with: 185.
     instead of *note with: 186, and vice versa for the asynchronous
     context manager protocol.  (Contributed by Bénédikt Tran in
     gh-128398(10).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132449

   (2) https://github.com/python/cpython/issues/129902

   (3) https://github.com/python/cpython/issues/129515

   (4) https://github.com/python/cpython/issues/88535

   (5) https://github.com/python/cpython/issues/133197

   (6) https://github.com/python/cpython/issues/123539

   (7) https://github.com/python/cpython/issues/123562

   (8) https://github.com/python/cpython/issues/123440

   (9) https://github.com/python/cpython/issues/132828

   (10) https://github.com/python/cpython/issues/128398


File: python.info,  Node: PEP 784 Zstandard support in the standard library,  Next: Asyncio introspection capabilities,  Prev: エラーメッセージの改善,  Up: 新しい機能

'PEP 784': Zstandard support in the standard library

The new ‘compression’ package contains modules ‘compression.lzma’,
‘compression.bz2’, ‘compression.gzip’ and ‘compression.zlib’ which
re-export the *note lzma: 8e, *note bz2: 14, *note gzip: 6b. and *note
zlib: 139. modules respectively.  The new import names under
‘compression’ are the preferred names for importing these compression
modules from Python 3.14.  However, the existing modules names have not
been deprecated.  Any deprecation or removal of the existing compression
modules will occur no sooner than five years after the release of 3.14.

The new ‘compression.zstd’ module provides compression and decompression
APIs for the Zstandard format via bindings to Meta's zstd library(1).
Zstandard is a widely adopted, highly efficient, and fast compression
format.  In addition to the APIs introduced in ‘compression.zstd’,
support for reading and writing Zstandard compressed archives has been
added to the *note tarfile: e4, *note zipfile: 137, and *note shutil:
ca. modules.

Here's an example of using the new module to compress some data:

     from compression import zstd
     import math

     data = str(math.pi).encode() * 20
     compressed = zstd.compress(data)
     ratio = len(compressed) / len(data)
     print(f"Achieved compression ratio of {ratio}")

As can be seen, the API is similar to the APIs of the ‘lzma’ and ‘bz2’
modules.

(Contributed by Emma Harper Smith, Adam Turner, Gregory P. Smith, Tomas
Roun, Victor Stinner, and Rogdham in gh-132983(2).)

参考
....

PEP 784(3).

   ---------- Footnotes ----------

   (1) https://facebook.github.io/zstd/

   (2) https://github.com/python/cpython/issues/132983

   (3) https://peps.python.org/pep-0784/


File: python.info,  Node: Asyncio introspection capabilities,  Next: Concurrent safe warnings control,  Prev: PEP 784 Zstandard support in the standard library,  Up: 新しい機能

1.1.2.9 Asyncio introspection capabilities
..........................................

Added a new command-line interface to inspect running Python processes
using asynchronous tasks, available via ‘python -m asyncio ps PID’ or
‘python -m asyncio pstree PID’.

The ‘ps’ subcommand inspects the given process ID (PID) and displays
information about currently running asyncio tasks.  It outputs a task
table: a flat listing of all tasks, their names, their coroutine stacks,
and which tasks are awaiting them.

The ‘pstree’ subcommand fetches the same information, but instead
renders a visual async call tree, showing coroutine relationships in a
hierarchical format.  This command is particularly useful for debugging
long-running or stuck asynchronous programs.  It can help developers
quickly identify where a program is blocked, what tasks are pending, and
how coroutines are chained together.

For example given this code:

     import asyncio

     async def play_track(track):
         await asyncio.sleep(5)
         print(f'🎵 Finished: {track}')

     async def play_album(name, tracks):
         async with asyncio.TaskGroup() as tg:
             for track in tracks:
                 tg.create_task(play_track(track), name=track)

     async def main():
         async with asyncio.TaskGroup() as tg:
             tg.create_task(
               play_album('Sundowning', ['TNDNBTG', 'Levitate']),
               name='Sundowning')
             tg.create_task(
               play_album('TMBTE', ['DYWTYLM', 'Aqua Regia']),
               name='TMBTE')

     if __name__ == '__main__':
         asyncio.run(main())

Executing the new tool on the running process will yield a table like
this:

     python -m asyncio ps 12345

     tid        task id              task name            coroutine stack                                    awaiter chain                                      awaiter name    awaiter id
     ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     1935500    0x7fc930c18050       Task-1               TaskGroup._aexit -> TaskGroup.__aexit__ -> main                                                                       0x0
     1935500    0x7fc930c18230       Sundowning           TaskGroup._aexit -> TaskGroup.__aexit__ -> album   TaskGroup._aexit -> TaskGroup.__aexit__ -> main    Task-1          0x7fc930c18050
     1935500    0x7fc93173fa50       TMBTE                TaskGroup._aexit -> TaskGroup.__aexit__ -> album   TaskGroup._aexit -> TaskGroup.__aexit__ -> main    Task-1          0x7fc930c18050
     1935500    0x7fc93173fdf0       TNDNBTG              sleep -> play                                      TaskGroup._aexit -> TaskGroup.__aexit__ -> album   Sundowning      0x7fc930c18230
     1935500    0x7fc930d32510       Levitate             sleep -> play                                      TaskGroup._aexit -> TaskGroup.__aexit__ -> album   Sundowning      0x7fc930c18230
     1935500    0x7fc930d32890       DYWTYLM              sleep -> play                                      TaskGroup._aexit -> TaskGroup.__aexit__ -> album   TMBTE           0x7fc93173fa50
     1935500    0x7fc93161ec30       Aqua Regia           sleep -> play                                      TaskGroup._aexit -> TaskGroup.__aexit__ -> album   TMBTE           0x7fc93173fa50

or a tree like this:

     python -m asyncio pstree 12345

     └── (T) Task-1
         └──  main example.py:13
             └──  TaskGroup.__aexit__ Lib/asyncio/taskgroups.py:72
                 └──  TaskGroup._aexit Lib/asyncio/taskgroups.py:121
                     ├── (T) Sundowning
                     │   └──  album example.py:8
                     │       └──  TaskGroup.__aexit__ Lib/asyncio/taskgroups.py:72
                     │           └──  TaskGroup._aexit Lib/asyncio/taskgroups.py:121
                     │               ├── (T) TNDNBTG
                     │               │   └──  play example.py:4
                     │               │       └──  sleep Lib/asyncio/tasks.py:702
                     │               └── (T) Levitate
                     │                   └──  play example.py:4
                     │                       └──  sleep Lib/asyncio/tasks.py:702
                     └── (T) TMBTE
                         └──  album example.py:8
                             └──  TaskGroup.__aexit__ Lib/asyncio/taskgroups.py:72
                                 └──  TaskGroup._aexit Lib/asyncio/taskgroups.py:121
                                     ├── (T) DYWTYLM
                                     │   └──  play example.py:4
                                     │       └──  sleep Lib/asyncio/tasks.py:702
                                     └── (T) Aqua Regia
                                         └──  play example.py:4
                                             └──  sleep Lib/asyncio/tasks.py:702

If a cycle is detected in the async await graph (which could indicate a
programming issue), the tool raises an error and lists the cycle paths
that prevent tree construction:

     python -m asyncio pstree 12345

     ERROR: await-graph contains cycles - cannot print a tree!

     cycle: Task-2 → Task-3 → Task-2

(Contributed by Pablo Galindo, Łukasz Langa, Yury Selivanov, and Marta
Gomez Macias in gh-91048(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/91048


File: python.info,  Node: Concurrent safe warnings control,  Prev: Asyncio introspection capabilities,  Up: 新しい機能

1.1.2.10 Concurrent safe warnings control
.........................................

The *note warnings.catch_warnings: 179. context manager will now
optionally use a context variable for warning filters.  This is enabled
by setting the *note context_aware_warnings: 18a. flag, either with the
‘-X’ command-line option or an environment variable.  This gives
predictable warnings control when using *note catch_warnings: 179.
combined with multiple threads or asynchronous tasks.  The flag defaults
to true for the free-threaded build and false for the GIL-enabled build.

(Contributed by Neil Schemenauer and Kumar Aditya in gh-130010(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/130010


File: python.info,  Node: Other language changes,  Next: 新しいモジュール,  Prev: 新しい機能,  Up: What's new in Python 3 14

1.1.3 Other language changes
----------------------------

   * All Windows code pages are now supported as 'cpXXX' codecs on
     Windows.  (Contributed by Serhiy Storchaka in gh-123803(1).)

   * Implement mixed-mode arithmetic rules combining real and complex
     numbers as specified by the C standard since C99.  (Contributed by
     Sergey B Kirpichev in gh-69639(2).)

   * More syntax errors are now detected regardless of optimisation and
     the *note -O: 18c. command-line option.  This includes writes to
     ‘__debug__’, incorrect use of *note await: 18d, and asynchronous
     comprehensions outside asynchronous functions.  For example,
     ‘python -O -c 'assert (__debug__ := 1)'’ or ‘python -O -c 'assert
     await 1'’ now produce *note SyntaxError: 18e.s.  (Contributed by
     Irit Katriel and Jelle Zijlstra in gh-122245(3) & gh-121637(4).)

   * When subclassing a pure C type, the C slots for the new type are no
     longer replaced with a wrapped version on class creation if they
     are not explicitly overridden in the subclass.  (Contributed by
     Tomasz Pytel in gh-132284(5).)

* Menu:

* Built-ins::
* コマンドラインと環境::
* PEP 758; Allow except and except* expressions without brackets: PEP 758 Allow except and except* expressions without brackets.
* PEP 765; Control flow in finally blocks: PEP 765 Control flow in finally blocks.
* Incremental garbage collection::
* Default interactive shell::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/123803

   (2) https://github.com/python/cpython/issues/69639

   (3) https://github.com/python/cpython/issues/122245

   (4) https://github.com/python/cpython/issues/121637

   (5) https://github.com/python/cpython/issues/132284


File: python.info,  Node: Built-ins,  Next: コマンドラインと環境,  Up: Other language changes

1.1.3.1 Built-ins
.................

   * The *note bytes.fromhex(): 190. and *note bytearray.fromhex(): 191.
     methods now accept ASCII *note bytes: 192. and *note bytes-like
     objects: 193.  (Contributed by Daniel Pope in gh-129349(1).)

   * Add class methods *note float.from_number(): 194. and *note
     complex.from_number(): 195. to convert a number to *note float:
     196. or *note complex: 197. type correspondingly.  They raise a
     *note TypeError: 198. if the argument is not a real number.
     (Contributed by Serhiy Storchaka in gh-84978(2).)

   * Support underscore and comma as thousands separators in the
     fractional part for floating-point presentation types of the
     new-style string formatting (with *note format(): 199. or *note
     f-strings: 19a.).  (Contributed by Sergey B Kirpichev in
     gh-87790(3).)

   * The *note int(): 19b. function no longer delegates to *note
     __trunc__(): 19c.  Classes that want to support conversion to
     ‘int()’ must implement either *note __int__(): 19d. or *note
     __index__(): 19e.  (Contributed by Mark Dickinson in gh-119743(4).)

   * The *note map(): 19f. function now has an optional keyword-only
     'strict' flag like *note zip(): 1a0. to check that all the
     iterables are of equal length.  (Contributed by Wannes Boeykens in
     gh-119793(5).)

   * The *note memoryview: 165. type now supports subscription, making
     it a *note generic type: 1a1.  (Contributed by Brian Schubert in
     gh-126012(6).)

   * Using *note NotImplemented: 1a2. in a boolean context will now
     raise a *note TypeError: 198.  This has raised a *note
     DeprecationWarning: 1a3. since Python 3.9.  (Contributed by Jelle
     Zijlstra in gh-118767(7).)

   * Three-argument *note pow(): 1a4. now tries calling *note
     __rpow__(): 1a5. if necessary.  Previously it was only called in
     two-argument ‘pow()’ and the binary power operator.  (Contributed
     by Serhiy Storchaka in gh-130104(8).)

   * *note super: 1a6. objects are now *note copyable: 29. and *note
     pickleable: ab.  (Contributed by Serhiy Storchaka in gh-125767(9).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129349

   (2) https://github.com/python/cpython/issues/84978

   (3) https://github.com/python/cpython/issues/87790

   (4) https://github.com/python/cpython/issues/119743

   (5) https://github.com/python/cpython/issues/119793

   (6) https://github.com/python/cpython/issues/126012

   (7) https://github.com/python/cpython/issues/118767

   (8) https://github.com/python/cpython/issues/130104

   (9) https://github.com/python/cpython/issues/125767


File: python.info,  Node: コマンドラインと環境,  Next: PEP 758 Allow except and except* expressions without brackets,  Prev: Built-ins,  Up: Other language changes

1.1.3.2 コマンドラインと環境
............................

   * The import time flag can now track modules that are already loaded
     ('cached'), via the new *note -X importtime=2: 16f.  When such a
     module is imported, the ‘self’ and ‘cumulative’ times are replaced
     by the string ‘cached’.

     Values above ‘2’ for ‘-X importtime’ are now reserved for future
     use.

     (Contributed by Noah Kim and Adam Turner in gh-118655(1).)

   * The command-line option *note -c: 1a8. now automatically dedents
     its code argument before execution.  The auto-dedentation behavior
     mirrors *note textwrap.dedent(): 1a9.  (Contributed by Jon Crall
     and Steven Sun in gh-103998(2).)

   * ‘-J’ is no longer a reserved flag for Jython(3), and now has no
     special meaning.  (Contributed by Adam Turner in gh-133336(4).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118655

   (2) https://github.com/python/cpython/issues/103998

   (3) https://www.jython.org/

   (4) https://github.com/python/cpython/issues/133336


File: python.info,  Node: PEP 758 Allow except and except* expressions without brackets,  Next: PEP 765 Control flow in finally blocks,  Prev: コマンドラインと環境,  Up: Other language changes

1.1.3.3 PEP 758: Allow ‘except’ and ‘except*’ expressions without brackets
..........................................................................

The *note except: 1ab. and *note except*: 1ac. expressions now allow
brackets to be omitted when there are multiple exception types and the
‘as’ clause is not used.  For example:

     try:
         connect_to_server()
     except TimeoutError, ConnectionRefusedError:
         print('The network has ceased to be!')

(Contributed by Pablo Galindo and Brett Cannon in PEP 758(1) and
gh-131831(2).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0758/

   (2) https://github.com/python/cpython/issues/131831


File: python.info,  Node: PEP 765 Control flow in finally blocks,  Next: Incremental garbage collection,  Prev: PEP 758 Allow except and except* expressions without brackets,  Up: Other language changes

1.1.3.4 PEP 765: Control flow in ‘finally’ blocks
.................................................

The compiler now emits a *note SyntaxWarning: 1ae. when a *note return:
1af, *note break: 17f, or *note continue: 180. statement have the effect
of leaving a *note finally: 1b0. block.  This change is specified in PEP
765(1).

In situations where this change is inconvenient (such as those where the
warnings are redundant due to code linting), the *note warning filter:
1b1. can be used to turn off all syntax warnings by adding
‘ignore::SyntaxWarning’ as a filter.  This can be specified in
combination with a filter that converts other warnings to errors (for
example, passing ‘-Werror -Wignore::SyntaxWarning’ as CLI options, or
setting ‘PYTHONWARNINGS=error,ignore::SyntaxWarning’).

Note that applying such a filter at runtime using the *note warnings:
118. module will only suppress the warning in code that is compiled
'after' the filter is adjusted.  Code that is compiled prior to the
filter adjustment (for example, when a module is imported) will still
emit the syntax warning.

(Contributed by Irit Katriel in gh-130080(2).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0765/

   (2) https://github.com/python/cpython/issues/130080


File: python.info,  Node: Incremental garbage collection,  Next: Default interactive shell,  Prev: PEP 765 Control flow in finally blocks,  Up: Other language changes

1.1.3.5 Incremental garbage collection
......................................

The cycle garbage collector is now incremental.  This means that maximum
pause times are reduced by an order of magnitude or more for larger
heaps.

There are now only two generations: young and old.  When *note
gc.collect(): 1b3. is not called directly, the GC is invoked a little
less frequently.  When invoked, it collects the young generation and an
increment of the old generation, instead of collecting one or more
generations.

The behavior of ‘gc.collect()’ changes slightly:

   * ‘gc.collect(1)’: Performs an increment of garbage collection,
     rather than collecting generation 1.

   * Other calls to ‘gc.collect()’ are unchanged.

(Contributed by Mark Shannon in gh-108362(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/108362


File: python.info,  Node: Default interactive shell,  Prev: Incremental garbage collection,  Up: Other language changes

1.1.3.6 Default interactive shell
.................................

   * The default *note interactive: 1b5. shell now highlights Python
     syntax.  The feature is enabled by default, save if *note
     PYTHON_BASIC_REPL: 1b6. or any other environment variable that
     disables colour is set.  See *note 色の制御: 1b7. for details.

     The default color theme for syntax highlighting strives for good
     contrast and exclusively uses the 4-bit VGA standard ANSI color
     codes for maximum compatibility.  The theme can be customized using
     an experimental API ‘_colorize.set_theme()’.  This can be called
     interactively or in the *note PYTHONSTARTUP: 1b8. script.  Note
     that this function has no stability guarantees, and may change or
     be removed.

     (Contributed by Łukasz Langa in gh-131507(1).)

   * The default *note interactive: 1b5. shell now supports import
     auto-completion.  This means that typing ‘import co’ and pressing
     ‘<Tab>’ will suggest modules starting with ‘co’.  Similarly, typing
     ‘from concurrent import i’ will suggest submodules of ‘concurrent’
     starting with ‘i’.  Note that autocompletion of module attributes
     is not currently supported.  (Contributed by Tomas Roun in
     gh-69605(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131507

   (2) https://github.com/python/cpython/issues/69605


File: python.info,  Node: 新しいモジュール,  Next: Improved modules,  Prev: Other language changes,  Up: What's new in Python 3 14

1.1.4 新しいモジュール
----------------------

   * *note annotationlib: 6.: For introspecting *note annotations: 15c.
     See *note PEP 749: 145. for more details.  (Contributed by Jelle
     Zijlstra in gh-119180(1).)

   * *note compression: 22. (including *note compression.zstd: 23.): A
     package for compression-related modules, including a new module to
     support the Zstandard compression format.  See *note PEP 784: 148.
     for more details.  (Contributed by Emma Harper Smith, Adam Turner,
     Gregory P. Smith, Tomas Roun, Victor Stinner, and Rogdham in
     gh-132983(2).)

   * *note concurrent.interpreters: 25.: Support for multiple
     interpreters in the standard library.  See *note PEP 734: 146. for
     more details.  (Contributed by Eric Snow in gh-134939(3).)

   * *note string.templatelib: d9.: Support for template string literals
     (t-strings).  See *note PEP 750: 144. for more details.
     (Contributed by Jim Baker, Guido van Rossum, Paul Everitt, Koudai
     Aono, Lysandros Nikolaou, Dave Peck, Adam Turner, Jelle Zijlstra,
     Bénédikt Tran, and Pablo Galindo Salgado in gh-132661(4).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/119180

   (2) https://github.com/python/cpython/issues/132983

   (3) https://github.com/python/cpython/issues/134939

   (4) https://github.com/python/cpython/issues/132661


File: python.info,  Node: Improved modules,  Next: 最適化,  Prev: 新しいモジュール,  Up: What's new in Python 3 14

1.1.5 Improved modules
----------------------

* Menu:

* argparse::
* ast::
* asyncio::
* calendar::
* concurrent.futures: concurrent futures.
* configparser::
* contextvars::
* ctypes::
* curses::
* datetime::
* decimal::
* difflib::
* dis::
* errno::
* faulthandler::
* fnmatch::
* fractions::
* functools::
* getopt::
* getpass::
* graphlib::
* heapq::
* hmac::
* http::
* imaplib::
* inspect::
* io::
* json::
* linecache::
* logging.handlers: logging handlers.
* math::
* mimetypes::
* multiprocessing::
* operator::
* os::
* os.path: os path.
* pathlib::
* pdb::
* pickle::
* プラットフォーム::
* pydoc::
* re::
* socket::
* ssl::
* struct::
* symtable::
* sys::
* sys.monitoring: sys monitoring.
* sysconfig::
* tarfile::
* threading::
* tkinter::
* turtle::
* types::
* typing::
* unicodedata::
* unittest::
* urllib::
* uuid::
* webbrowser::
* zipfile::


File: python.info,  Node: argparse,  Next: ast,  Up: Improved modules

1.1.5.1 argparse
................

   * The default value of the *note program name: 1bc. for *note
     argparse.ArgumentParser: 1bd. now reflects the way the Python
     interpreter was instructed to find the ‘__main__’ module code.
     (Contributed by Serhiy Storchaka and Alyssa Coghlan in
     gh-66436(1).)

   * Introduced the optional 'suggest_on_error' parameter to *note
     argparse.ArgumentParser: 1bd, enabling suggestions for argument
     choices and subparser names if mistyped by the user.  (Contributed
     by Savannah Ostrowski in gh-124456(2).)

   * Enable color for help text, which can be disabled with the optional
     'color' parameter to *note argparse.ArgumentParser: 1bd.  This can
     also be controlled by *note environment variables: 1b7.
     (Contributed by Hugo van Kemenade in gh-130645(3).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/66436

   (2) https://github.com/python/cpython/issues/124456

   (3) https://github.com/python/cpython/issues/130645


File: python.info,  Node: ast,  Next: asyncio,  Prev: argparse,  Up: Improved modules

1.1.5.2 ast
...........

   * Add *note compare(): 1bf, a function for comparing two ASTs.
     (Contributed by Batuhan Taskaya and Jeremy Hylton in gh-60191(1).)

   * Add support for *note copy.replace(): 1c0. for AST nodes.
     (Contributed by Bénédikt Tran in gh-121141(2).)

   * Docstrings are now removed from an optimized AST in optimization
     level 2.  (Contributed by Irit Katriel in gh-123958(3).)

   * The *note repr(): 1c1. output for AST nodes now includes more
     information.  (Contributed by Tomas Roun in gh-116022(4).)

   * When called with an AST as input, the *note parse(): 1c2. function
     now always verifies that the root node type is appropriate.
     (Contributed by Irit Katriel in gh-130139(5).)

   * Add new options to the command-line interface: *note
     -feature-version: 1c3, *note -optimize: 1c4, and *note -show-empty:
     1c5.  (Contributed by Semyon Moroz in gh-133367(6).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/60191

   (2) https://github.com/python/cpython/issues/121141

   (3) https://github.com/python/cpython/issues/123958

   (4) https://github.com/python/cpython/issues/116022

   (5) https://github.com/python/cpython/issues/130139

   (6) https://github.com/python/cpython/issues/133367


File: python.info,  Node: asyncio,  Next: calendar,  Prev: ast,  Up: Improved modules

1.1.5.3 asyncio
...............

   * The function and methods named ‘create_task()’ now take an
     arbitrary list of keyword arguments.  All keyword arguments are
     passed to the *note Task: 1c7. constructor or the custom task
     factory.  (See *note set_task_factory(): 1c8. for details.)  The
     ‘name’ and ‘context’ keyword arguments are no longer special; the
     name should now be set using the ‘name’ keyword argument of the
     factory, and ‘context’ may be ‘None’.

     This affects the following function and methods: *note
     asyncio.create_task(): 1c9, *note asyncio.loop.create_task(): 1ca,
     *note asyncio.TaskGroup.create_task(): 1cb.

     (Contributed by Thomas Grainger in gh-128307(1).)

   * There are two new utility functions for introspecting and printing
     a program's call graph: *note capture_call_graph(): 1cc. and *note
     print_call_graph(): 1cd.  See *note Asyncio introspection
     capabilities: 147. for more details.  (Contributed by Yury
     Selivanov, Pablo Galindo Salgado, and Łukasz Langa in gh-91048(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128307

   (2) https://github.com/python/cpython/issues/91048


File: python.info,  Node: calendar,  Next: concurrent futures,  Prev: asyncio,  Up: Improved modules

1.1.5.4 calendar
................

   * By default, today's date is highlighted in color in *note calendar:
     15.'s *note command-line: 1d0. text output.  This can be controlled
     by *note environment variables: 1b7.  (Contributed by Hugo van
     Kemenade in gh-128317(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128317


File: python.info,  Node: concurrent futures,  Next: configparser,  Prev: calendar,  Up: Improved modules

1.1.5.5 concurrent.futures
..........................

   * Add a new executor class, *note InterpreterPoolExecutor: 1d2, which
     exposes multiple Python interpreters in the same process
     ('subinterpreters') to Python code.  This uses a pool of
     independent Python interpreters to execute calls asynchronously.

     This is separate from the new *note interpreters: 25. module
     introduced by *note PEP 734: 146.  (Contributed by Eric Snow in
     gh-124548(1).)

   * On Unix platforms other than macOS, *note 'forkserver': 1d4. is now
     the default *note start method: 1d5. for *note ProcessPoolExecutor:
     1d6. (replacing *note 'fork': 1d7.).  This change does not affect
     Windows or macOS, where *note 'spawn': 1d8. remains the default
     start method.

     If the threading incompatible 'fork' method is required, you must
     explicitly request it by supplying a multiprocessing context
     'mp_context' to *note ProcessPoolExecutor: 1d6.

     See *note forkserver restrictions: 1d9. for information and
     differences with the 'fork' method and how this change may affect
     existing code with mutable global shared variables and/or shared
     objects that can not be automatically *note pickled: ab.

     (Contributed by Gregory P. Smith in gh-84559(2).)

   * Add two new methods to *note ProcessPoolExecutor: 1d6, *note
     terminate_workers(): 1da. and *note kill_workers(): 1db, as ways to
     terminate or kill all living worker processes in the given pool.
     (Contributed by Charles Machalow in gh-130849(3).)

   * Add the optional 'buffersize' parameter to *note Executor.map: 1dc.
     to limit the number of submitted tasks whose results have not yet
     been yielded.  If the buffer is full, iteration over the
     'iterables' pauses until a result is yielded from the buffer.
     (Contributed by Enzo Bonnal and Josh Rosenberg in gh-74028(4).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/124548

   (2) https://github.com/python/cpython/issues/84559

   (3) https://github.com/python/cpython/issues/130849

   (4) https://github.com/python/cpython/issues/74028


File: python.info,  Node: configparser,  Next: contextvars,  Prev: concurrent futures,  Up: Improved modules

1.1.5.6 configparser
....................

   * ‘configparser’ will no longer write config files it cannot read, to
     improve security.  Attempting to *note write(): 1de. keys
     containing delimiters or beginning with the section header pattern
     will raise an *note InvalidWriteError: 1df.  (Contributed by Jacob
     Lincoln in gh-129270(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129270


File: python.info,  Node: contextvars,  Next: ctypes,  Prev: configparser,  Up: Improved modules

1.1.5.7 contextvars
...................

   * Support the *note context manager: 1e1. protocol for *note Token:
     1e2. objects.  (Contributed by Andrew Svetlov in gh-129889(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129889


File: python.info,  Node: ctypes,  Next: curses,  Prev: contextvars,  Up: Improved modules

1.1.5.8 ctypes
..............

   * The layout of *note bit fields: 1e4. in *note Structure: 1e5. and
     *note Union: 1e6. objects is now a closer match to platform
     defaults (GCC/Clang or MSVC). In particular, fields no longer
     overlap.  (Contributed by Matthias Görgens in gh-97702(1).)

   * The *note Structure._layout_: 1e7. class attribute can now be set
     to help match a non-default ABI. (Contributed by Petr Viktorin in
     gh-97702(2).)

   * The class of *note Structure: 1e5./*note Union: 1e6. field
     descriptors is now available as *note CField: 1e8, and has new
     attributes to aid debugging and introspection.  (Contributed by
     Petr Viktorin in gh-128715(3).)

   * On Windows, the *note COMError: 1e9. exception is now public.
     (Contributed by Jun Komoda in gh-126686(4).)

   * On Windows, the *note CopyComPointer(): 1ea. function is now
     public.  (Contributed by Jun Komoda in gh-127275(5).)

   * Add *note memoryview_at(): 1eb, a function to create a *note
     memoryview: 165. object that refers to the supplied pointer and
     length.  This works like *note ctypes.string_at(): 1ec. except it
     avoids a buffer copy, and is typically useful when implementing
     pure Python callback functions that are passed dynamically-sized
     buffers.  (Contributed by Rian Hunter in gh-112018(6).)

   * Complex types, *note c_float_complex: 1ed, *note c_double_complex:
     1ee, and *note c_longdouble_complex: 1ef, are now available if both
     the compiler and the ‘libffi’ library support complex C types.
     (Contributed by Sergey B Kirpichev in gh-61103(7).)

   * Add *note ctypes.util.dllist(): 1f0. for listing the shared
     libraries loaded by the current process.  (Contributed by Brian
     Ward in gh-119349(8).)

   * Move *note ctypes.POINTER(): 1f1. types cache from a global
     internal cache (‘_pointer_type_cache’) to the *note
     _CData.__pointer_type__: 1f2. attribute of the corresponding
     ‘ctypes’ types.  This will stop the cache from growing without
     limits in some situations.  (Contributed by Sergey Miryanov in
     gh-100926(9).)

   * The *note py_object: 1f3. type now supports subscription, making it
     a *note generic type: 1a1.  (Contributed by Brian Schubert in
     gh-132168(10).)

   * ‘ctypes’ now supports *note free-threading builds: 1f4.
     (Contributed by Kumar Aditya and Peter Bierma in gh-127945(11).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97702

   (2) https://github.com/python/cpython/issues/97702

   (3) https://github.com/python/cpython/issues/128715

   (4) https://github.com/python/cpython/issues/126686

   (5) https://github.com/python/cpython/issues/127275

   (6) https://github.com/python/cpython/issues/112018

   (7) https://github.com/python/cpython/issues/61103

   (8) https://github.com/python/cpython/issues/119349

   (9) https://github.com/python/cpython/issues/100926

   (10) https://github.com/python/cpython/issues/132168

   (11) https://github.com/python/cpython/issues/127945


File: python.info,  Node: curses,  Next: datetime,  Prev: ctypes,  Up: Improved modules

1.1.5.9 curses
..............

   * Add the *note assume_default_colors(): 1f6. function, a refinement
     of the *note use_default_colors(): 1f7. function which allows
     changing the color pair ‘0’.  (Contributed by Serhiy Storchaka in
     gh-133139(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/133139


File: python.info,  Node: datetime,  Next: decimal,  Prev: curses,  Up: Improved modules

1.1.5.10 datetime
.................

   * Add the *note strptime(): 1f9. method to the *note datetime.date:
     1fa. and *note datetime.time: 1fb. classes.  (Contributed by Wannes
     Boeykens in gh-41431(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/41431


File: python.info,  Node: decimal,  Next: difflib,  Prev: datetime,  Up: Improved modules

1.1.5.11 decimal
................

   * Add *note Decimal.from_number(): 1fd. as an alternative constructor
     for *note Decimal: 1fe.  (Contributed by Serhiy Storchaka in
     gh-121798(1).)

   * Expose *note IEEEContext(): 1ff. to support creation of contexts
     corresponding to the IEEE 754 (2008) decimal interchange formats.
     (Contributed by Sergey B Kirpichev in gh-53032(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/121798

   (2) https://github.com/python/cpython/issues/53032


File: python.info,  Node: difflib,  Next: dis,  Prev: decimal,  Up: Improved modules

1.1.5.12 difflib
................

   * Comparison pages with highlighted changes generated by the *note
     HtmlDiff: 201. class now support 'dark mode'.  (Contributed by
     Jiahao Li in gh-129939(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129939


File: python.info,  Node: dis,  Next: errno,  Prev: difflib,  Up: Improved modules

1.1.5.13 dis
............

   * Add support for rendering full source location information of *note
     instructions: 203, rather than only the line number.  This feature
     is added to the following interfaces via the 'show_positions'
     keyword argument:

        - *note dis.Bytecode: 204.

        - *note dis.dis(): 205.

        - *note dis.distb(): 206.

        - *note dis.disassemble(): 207.

     This feature is also exposed via *note dis -show-positions: 208.
     (Contributed by Bénédikt Tran in gh-123165(1).)

   * Add the *note dis -specialized: 209. command-line option to show
     specialized bytecode.  (Contributed by Bénédikt Tran in
     gh-127413(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/123165

   (2) https://github.com/python/cpython/issues/127413


File: python.info,  Node: errno,  Next: faulthandler,  Prev: dis,  Up: Improved modules

1.1.5.14 errno
..............

   * Add the *note EHWPOISON: 20b. error code constant.  (Contributed by
     James Roy in gh-126585(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126585


File: python.info,  Node: faulthandler,  Next: fnmatch,  Prev: errno,  Up: Improved modules

1.1.5.15 faulthandler
.....................

   * Add support for printing the C stack trace on systems that *note
     support it: 20d. via the new *note dump_c_stack(): 20e. function or
     via the 'c_stack' argument in *note faulthandler.enable(): 20f.
     (Contributed by Peter Bierma in gh-127604(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127604


File: python.info,  Node: fnmatch,  Next: fractions,  Prev: faulthandler,  Up: Improved modules

1.1.5.16 fnmatch
................

   * Add *note filterfalse(): 211, a function to reject names matching a
     given pattern.  (Contributed by Bénédikt Tran in gh-74598(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/74598


File: python.info,  Node: fractions,  Next: functools,  Prev: fnmatch,  Up: Improved modules

1.1.5.17 fractions
..................

   * A *note Fraction: 213. object may now be constructed from any
     object with the ‘as_integer_ratio()’ method.  (Contributed by
     Serhiy Storchaka in gh-82017(1).)

   * Add *note Fraction.from_number(): 214. as an alternative
     constructor for *note Fraction: 213.  (Contributed by Serhiy
     Storchaka in gh-121797(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/82017

   (2) https://github.com/python/cpython/issues/121797


File: python.info,  Node: functools,  Next: getopt,  Prev: fractions,  Up: Improved modules

1.1.5.18 functools
..................

   * Add the *note Placeholder: 216. sentinel.  This may be used with
     the *note partial(): 217. or *note partialmethod(): 218. functions
     to reserve a place for positional arguments in the returned *note
     partial object: 219.  (Contributed by Dominykas Grigonis in
     gh-119127(1).)

   * Allow the 'initial' parameter of *note reduce(): 21a. to be passed
     as a keyword argument.  (Contributed by Sayandip Dutta in
     gh-125916(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/119127

   (2) https://github.com/python/cpython/issues/125916


File: python.info,  Node: getopt,  Next: getpass,  Prev: functools,  Up: Improved modules

1.1.5.19 getopt
...............

   * Add support for options with optional arguments.  (Contributed by
     Serhiy Storchaka in gh-126374(1).)

   * Add support for returning intermixed options and non-option
     arguments in order.  (Contributed by Serhiy Storchaka in
     gh-126390(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126374

   (2) https://github.com/python/cpython/issues/126390


File: python.info,  Node: getpass,  Next: graphlib,  Prev: getopt,  Up: Improved modules

1.1.5.20 getpass
................

   * Support keyboard feedback in the *note getpass(): 21d. function via
     the keyword-only optional argument 'echo_char'.  Placeholder
     characters are rendered whenever a character is entered, and
     removed when a character is deleted.  (Contributed by Semyon Moroz
     in gh-77065(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/77065


File: python.info,  Node: graphlib,  Next: heapq,  Prev: getpass,  Up: Improved modules

1.1.5.21 graphlib
.................

   * Allow *note TopologicalSorter.prepare(): 21f. to be called more
     than once as long as sorting has not started.  (Contributed by
     Daniel Pope in gh-130914(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/130914


File: python.info,  Node: heapq,  Next: hmac,  Prev: graphlib,  Up: Improved modules

1.1.5.22 heapq
..............

   * The ‘heapq’ module has improved support for working with max-heaps,
     via the following new functions:

        * *note heapify_max(): 221.

        * *note heappush_max(): 222.

        * *note heappop_max(): 223.

        * *note heapreplace_max(): 224.

        * *note heappushpop_max(): 225.


File: python.info,  Node: hmac,  Next: http,  Prev: heapq,  Up: Improved modules

1.1.5.23 hmac
.............

   * Add a built-in implementation for HMAC ( RFC 2104(1)) using
     formally verified code from the HACL*(2) project.  This
     implementation is used as a fallback when the OpenSSL
     implementation of HMAC is not available.  (Contributed by Bénédikt
     Tran in gh-99108(3).)

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2104.html

   (2) https://github.com/hacl-star/hacl-star/

   (3) https://github.com/python/cpython/issues/99108


File: python.info,  Node: http,  Next: imaplib,  Prev: hmac,  Up: Improved modules

1.1.5.24 http
.............

   * Directory lists and error pages generated by the *note http.server:
     76. module allow the browser to apply its default dark mode.
     (Contributed by Yorik Hansen in gh-123430(1).)

   * The *note http.server: 76. module now supports serving over HTTPS
     using the *note http.server.HTTPSServer: 228. class.  This
     functionality is exposed by the command-line interface (‘python -m
     http.server’) through the following options:

        * *note -tls-cert <path>: 229.: Path to the TLS certificate
          file.

        * *note -tls-key <path>: 22a.: Optional path to the private key
          file.

        * *note -tls-password-file <path>: 22b.: Optional path to the
          password file for the private key.

     (Contributed by Semyon Moroz in gh-85162(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/123430

   (2) https://github.com/python/cpython/issues/85162


File: python.info,  Node: imaplib,  Next: inspect,  Prev: http,  Up: Improved modules

1.1.5.25 imaplib
................

   * Add *note IMAP4.idle(): 22d, implementing the IMAP4 ‘IDLE’ command
     as defined in RFC 2177(1).  (Contributed by Forest in gh-55454(2).)

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2177.html

   (2) https://github.com/python/cpython/issues/55454


File: python.info,  Node: inspect,  Next: io,  Prev: imaplib,  Up: Improved modules

1.1.5.26 inspect
................

   * *note signature(): 22f. takes a new argument 'annotation_format' to
     control the *note annotationlib.Format: 230. used for representing
     annotations.  (Contributed by Jelle Zijlstra in gh-101552(1).)

   * *note Signature.format(): 231. takes a new argument
     'unquote_annotations'.  If true, string *note annotations: 15c. are
     displayed without surrounding quotes.  (Contributed by Jelle
     Zijlstra in gh-101552(2).)

   * Add function *note ispackage(): 232. to determine whether an object
     is a *note package: 233. or not.  (Contributed by Zhikang Yan in
     gh-125634(3).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101552

   (2) https://github.com/python/cpython/issues/101552

   (3) https://github.com/python/cpython/issues/125634


File: python.info,  Node: io,  Next: json,  Prev: inspect,  Up: Improved modules

1.1.5.27 io
...........

   * Reading text from a non-blocking stream with ‘read’ may now raise a
     *note BlockingIOError: 235. if the operation cannot immediately
     return bytes.  (Contributed by Giovanni Siragusa in gh-109523(1).)

   * Add the *note Reader: 236. and *note Writer: 237. protocols as
     simpler alternatives to the pseudo-protocols *note typing.IO: 238,
     *note typing.TextIO: 239, and *note typing.BinaryIO: 23a.
     (Contributed by Sebastian Rittau in gh-127648(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/109523

   (2) https://github.com/python/cpython/issues/127648


File: python.info,  Node: json,  Next: linecache,  Prev: io,  Up: Improved modules

1.1.5.28 json
.............

   * Add exception notes for JSON serialization errors that allow
     identifying the source of the error.  (Contributed by Serhiy
     Storchaka in gh-122163(1).)

   * Allow using the *note json: 86. module as a script using the *note
     -m: 23c. switch: ‘python -m json’.  This is now preferred to
     ‘python -m json.tool’, which is *note soft deprecated: 23d.  See
     the *note JSON command-line interface: 23e. documentation.
     (Contributed by Trey Hunner in gh-122873(2).)

   * By default, the output of the *note JSON command-line interface:
     23e. is highlighted in color.  This can be controlled by *note
     environment variables: 1b7.  (Contributed by Tomas Roun in
     gh-131952(3).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/122163

   (2) https://github.com/python/cpython/issues/122873

   (3) https://github.com/python/cpython/issues/131952


File: python.info,  Node: linecache,  Next: logging handlers,  Prev: json,  Up: Improved modules

1.1.5.29 linecache
..................

   * *note getline(): 240. can now retrieve source code for frozen
     modules.  (Contributed by Tian Gao in gh-131638(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131638


File: python.info,  Node: logging handlers,  Next: math,  Prev: linecache,  Up: Improved modules

1.1.5.30 logging.handlers
.........................

   * *note QueueListener: 242. objects now support the *note context
     manager: 1e1. protocol.  (Contributed by Charles Machalow in
     gh-132106(1).)

   * *note QueueListener.start: 243. now raises a *note RuntimeError:
     244. if the listener is already started.  (Contributed by Charles
     Machalow in gh-132106(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132106

   (2) https://github.com/python/cpython/issues/132106


File: python.info,  Node: math,  Next: mimetypes,  Prev: logging handlers,  Up: Improved modules

1.1.5.31 math
.............

   * Added more detailed error messages for domain errors in the module.
     (Contributed by Charlie Zhao and Sergey B Kirpichev in
     gh-101410(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101410


File: python.info,  Node: mimetypes,  Next: multiprocessing,  Prev: math,  Up: Improved modules

1.1.5.32 mimetypes
..................

   * Add a public *note command-line: 247. for the module, invoked via
     ‘python -m mimetypes’.  (Contributed by Oleg Iarygin and Hugo van
     Kemenade in gh-93096(1).)

   * Add several new MIME types based on RFCs and common usage:

     Microsoft and
     .............

     RFC 8081(2) MIME types for fonts

        * Embedded OpenType: ‘application/vnd.ms-fontobject’

        * OpenType Layout (OTF) ‘font/otf’

        * TrueType: ‘font/ttf’

        * WOFF 1.0 ‘font/woff’

        * WOFF 2.0 ‘font/woff2’

     RFC 9559(3) MIME types for Matroska audiovisual data container
     structures

        * audio with no video: ‘audio/matroska’ (‘.mka’)

        * video: ‘video/matroska’ (‘.mkv’)

        * stereoscopic video: ‘video/matroska-3d’ (‘.mk3d’)

     Images with RFCs
     ................

        * RFC 1494(4): CCITT Group 3 (‘.g3’)

        * RFC 3362(5): Real-time Facsimile, T.38 (‘.t38’)

        * RFC 3745(6): JPEG 2000 (‘.jp2’), extension (‘.jpx’) and
          compound (‘.jpm’)

        * RFC 3950(7): Tag Image File Format Fax eXtended, TIFF-FX
          (‘.tfx’)

        * RFC 4047(8): Flexible Image Transport System (‘.fits’)

        * RFC 7903(9): Enhanced Metafile (‘.emf’) and Windows Metafile
          (‘.wmf’)

     Other MIME type additions and changes
     .....................................

        * RFC 2361(10): Change type for ‘.avi’ to ‘video/vnd.avi’ and
          for ‘.wav’ to ‘audio/vnd.wave’

        * RFC 4337(11): Add MPEG-4 ‘audio/mp4’ (‘.m4a’)

        * RFC 5334(12): Add Ogg media (‘.oga’, ‘.ogg’ and ‘.ogx’)

        * RFC 6713(13): Add gzip ‘application/gzip’ (‘.gz’)

        * RFC 9639(14): Add FLAC ‘audio/flac’ (‘.flac’)

        * RFC 9512(15) ‘application/yaml’ MIME type for YAML files
          (‘.yaml’ and ‘.yml’)

        * Add 7z ‘application/x-7z-compressed’ (‘.7z’)

        * Add Android Package ‘application/vnd.android.package-archive’
          (‘.apk’) when not strict

        * Add deb ‘application/x-debian-package’ (‘.deb’)

        * Add glTF binary ‘model/gltf-binary’ (‘.glb’)

        * Add glTF JSON/ASCII ‘model/gltf+json’ (‘.gltf’)

        * Add M4V ‘video/x-m4v’ (‘.m4v’)

        * Add PHP ‘application/x-httpd-php’ (‘.php’)

        * Add RAR ‘application/vnd.rar’ (‘.rar’)

        * Add RPM ‘application/x-rpm’ (‘.rpm’)

        * Add STL ‘model/stl’ (‘.stl’)

        * Add Windows Media Video ‘video/x-ms-wmv’ (‘.wmv’)

        * De facto: Add WebM ‘audio/webm’ (‘.weba’)

        * ECMA-376(16): Add ‘.docx’, ‘.pptx’ and ‘.xlsx’ types

        * OASIS(17): Add OpenDocument ‘.odg’, ‘.odp’, ‘.ods’ and ‘.odt’
          types

        * W3C(18): Add EPUB ‘application/epub+zip’ (‘.epub’)

     (Contributed by Sahil Prajapati and Hugo van Kemenade in
     gh-84852(19), by Sasha "Nelie" Chernykh and Hugo van Kemenade in
     gh-132056(20), and by Hugo van Kemenade in gh-89416(21),
     gh-85957(22), and gh-129965(23).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/93096

   (2) https://datatracker.ietf.org/doc/html/rfc8081.html

   (3) https://datatracker.ietf.org/doc/html/rfc9559.html

   (4) https://datatracker.ietf.org/doc/html/rfc1494.html

   (5) https://datatracker.ietf.org/doc/html/rfc3362.html

   (6) https://datatracker.ietf.org/doc/html/rfc3745.html

   (7) https://datatracker.ietf.org/doc/html/rfc3950.html

   (8) https://datatracker.ietf.org/doc/html/rfc4047.html

   (9) https://datatracker.ietf.org/doc/html/rfc7903.html

   (10) https://datatracker.ietf.org/doc/html/rfc2361.html

   (11) https://datatracker.ietf.org/doc/html/rfc4337.html

   (12) https://datatracker.ietf.org/doc/html/rfc5334.html

   (13) https://datatracker.ietf.org/doc/html/rfc6713.html

   (14) https://datatracker.ietf.org/doc/html/rfc9639.html

   (15) https://datatracker.ietf.org/doc/html/rfc9512.html

   (16) 
https://ecma-international.org/publications-and-standards/standards/ecma-376/

   (17) 
https://docs.oasis-open.org/office/v1.2/cs01/OpenDocument-v1.2-cs01-part1.html#Appendix_C

   (18) https://www.w3.org/TR/epub-33/#app-media-type

   (19) https://github.com/python/cpython/issues/84852

   (20) https://github.com/python/cpython/issues/132056

   (21) https://github.com/python/cpython/issues/89416

   (22) https://github.com/python/cpython/issues/85957

   (23) https://github.com/python/cpython/issues/129965


File: python.info,  Node: multiprocessing,  Next: operator,  Prev: mimetypes,  Up: Improved modules

1.1.5.33 multiprocessing
........................

   * On Unix platforms other than macOS, *note 'forkserver': 1d4. is now
     the default *note start method: 1d5. (replacing *note 'fork':
     1d7.).  This change does not affect Windows or macOS, where *note
     'spawn': 1d8. remains the default start method.

     If the threading incompatible 'fork' method is required, you must
     explicitly request it via a context from *note get_context(): 24a.
     (preferred) or change the default via *note set_start_method():
     24b.

     See *note forkserver restrictions: 1d9. for information and
     differences with the 'fork' method and how this change may affect
     existing code with mutable global shared variables and/or shared
     objects that can not be automatically *note pickled: ab.

     (Contributed by Gregory P. Smith in gh-84559(1).)

   * *note multiprocessing: 98.'s ‘'forkserver'’ start method now
     authenticates its control socket to avoid solely relying on
     filesystem permissions to restrict what other processes could cause
     the forkserver to spawn workers and run code.  (Contributed by
     Gregory P. Smith for gh-97514(2).)

   * The *note multiprocessing proxy objects: 24c. for 'list' and 'dict'
     types gain previously overlooked missing methods:

             * ‘clear()’ and ‘copy()’ for proxies of *note list: 24d.

             * *note fromkeys(): 24e, ‘reversed(d)’, ‘d | {}’, ‘{} | d’,
               ‘d |= {'b': 2}’ for proxies of *note dict: 183.

     (Contributed by Roy Hyunjin Han for gh-103134(3).)

   * Add support for shared *note set: 184. objects via *note
     SyncManager.set(): 24f.  The *note set(): 184. in *note Manager():
     250. method is now available.  (Contributed by Mingyu Park in
     gh-129949(4).)

   * Add the *note interrupt(): 251. to *note multiprocessing.Process:
     252. objects, which terminates the child process by sending *note
     SIGINT: 253.  This enables *note finally: 1b0. clauses to print a
     stack trace for the terminated process.  (Contributed by Artem
     Pulkin in gh-131913(5).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/84559

   (2) https://github.com/python/cpython/issues/97514

   (3) https://github.com/python/cpython/issues/103134

   (4) https://github.com/python/cpython/issues/129949

   (5) https://github.com/python/cpython/issues/131913


File: python.info,  Node: operator,  Next: os,  Prev: multiprocessing,  Up: Improved modules

1.1.5.34 operator
.................

   * Add *note is_none(): 255. and *note is_not_none(): 256. as a pair
     of functions, such that ‘operator.is_none(obj)’ is equivalent to
     ‘obj is None’ and ‘operator.is_not_none(obj)’ is equivalent to ‘obj
     is not None’.  (Contributed by Raymond Hettinger and Nico Mexis in
     gh-115808(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115808


File: python.info,  Node: os,  Next: os path,  Prev: operator,  Up: Improved modules

1.1.5.35 os
...........

   * Add the *note reload_environ(): 258. function to update *note
     os.environ: 259. and *note os.environb: 25a. with changes to the
     environment made by *note os.putenv(): 25b, by *note os.unsetenv():
     25c, or made outside Python in the same process.  (Contributed by
     Victor Stinner in gh-120057(1).)

   * Add the *note SCHED_DEADLINE: 25d. and *note SCHED_NORMAL: 25e.
     constants to the ‘os’ module.  (Contributed by James Roy in
     gh-127688(2).)

   * Add the *note readinto(): 25f. function to read into a *note buffer
     object: 260. from a file descriptor.  (Contributed by Cody Maloney
     in gh-129205(3).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/120057

   (2) https://github.com/python/cpython/issues/127688

   (3) https://github.com/python/cpython/issues/129205


File: python.info,  Node: os path,  Next: pathlib,  Prev: os,  Up: Improved modules

1.1.5.36 os.path
................

   * The 'strict' parameter to *note realpath(): 262. accepts a new
     value, *note ALLOW_MISSING: 263.  If used, errors other than *note
     FileNotFoundError: 264. will be re-raised; the resulting path can
     be missing but it will be free of symlinks.  (Contributed by Petr
     Viktorin for CVE 2025-4517(1).)

   ---------- Footnotes ----------

   (1) https://www.cve.org/CVERecord?id=CVE-2025-4517


File: python.info,  Node: pathlib,  Next: pdb,  Prev: os path,  Up: Improved modules

1.1.5.37 pathlib
................

   * Add methods to *note pathlib.Path: 266. to recursively copy or move
     files and directories:

        * *note copy(): 267. copies a file or directory tree to a
          destination.

        * *note copy_into(): 268. copies 'into' a destination directory.

        * *note move(): 269. moves a file or directory tree to a
          destination.

        * *note move_into(): 26a. moves 'into' a destination directory.

     (Contributed by Barney Gale in gh-73991(1).)

   * Add the *note info: 26b. attribute, which stores an object
     implementing the new *note pathlib.types.PathInfo: 26c. protocol.
     The object supports querying the file type and internally caching
     *note stat(): 26d. results.  Path objects generated by *note
     iterdir(): 26e. are initialized with file type information gleaned
     from scanning the parent directory.  (Contributed by Barney Gale in
     gh-125413(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/73991

   (2) https://github.com/python/cpython/issues/125413


File: python.info,  Node: pdb,  Next: pickle,  Prev: pathlib,  Up: Improved modules

1.1.5.38 pdb
............

   * The *note pdb: aa. module now supports remote attaching to a
     running Python process using a new *note -p PID: 270. command-line
     option:

          python -m pdb -p 1234

     This will connect to the Python process with the given PID and
     allow you to debug it interactively.  Notice that due to how the
     Python interpreter works attaching to a remote process that is
     blocked in a system call or waiting for I/O will only work once the
     next bytecode instruction is executed or when the process receives
     a signal.

     This feature uses *note PEP 768: 14e. and the new *note
     sys.remote_exec(): 16d. function to attach to the remote process
     and send the PDB commands to it.

     (Contributed by Matt Wozniski and Pablo Galindo in gh-131591(1).)

   * Hardcoded breakpoints (*note breakpoint(): 271. and *note
     set_trace(): 272.) now reuse the most recent *note Pdb: 273.
     instance that calls *note set_trace(): 274, instead of creating a
     new one each time.  As a result, all the instance specific data
     like *note display: 275. and *note commands: 276. are preserved
     across hardcoded breakpoints.  (Contributed by Tian Gao in
     gh-121450(2).)

   * Add a new argument 'mode' to *note pdb.Pdb: 273.  Disable the
     ‘restart’ command when *note pdb: aa. is in ‘inline’ mode.
     (Contributed by Tian Gao in gh-123757(3).)

   * A confirmation prompt will be shown when the user tries to quit
     *note pdb: aa. in ‘inline’ mode.  ‘y’, ‘Y’, ‘<Enter>’ or ‘EOF’ will
     confirm the quit and call *note sys.exit(): 277, instead of raising
     *note bdb.BdbQuit: 278.  (Contributed by Tian Gao in gh-124704(4).)

   * Inline breakpoints like *note breakpoint(): 271. or *note
     pdb.set_trace(): 272. will always stop the program at calling
     frame, ignoring the ‘skip’ pattern (if any).  (Contributed by Tian
     Gao in gh-130493(5).)

   * ‘<tab>’ at the beginning of the line in *note pdb: aa. multi-line
     input will fill in a 4-space indentation now, instead of inserting
     a ‘\t’ character.  (Contributed by Tian Gao in gh-130471(6).)

   * Auto-indent is introduced in *note pdb: aa. multi-line input.  It
     will either keep the indentation of the last line or insert a
     4-space indentation when it detects a new code block.  (Contributed
     by Tian Gao in gh-133350(7).)

   * ‘$_asynctask’ is added to access the current asyncio task if
     applicable.  (Contributed by Tian Gao in gh-124367(8).)

   * *note pdb.set_trace_async(): 279. is added to support debugging
     asyncio coroutines.  *note await: 18d. statements are supported
     with this function.  (Contributed by Tian Gao in gh-132576(9).)

   * Source code displayed in *note pdb: aa. will be syntax-highlighted.
     This feature can be controlled using the same methods as the
     default *note interactive: 1b5. shell, in addition to the newly
     added ‘colorize’ argument of *note pdb.Pdb: 273.  (Contributed by
     Tian Gao and Łukasz Langa in gh-133355(10).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131591

   (2) https://github.com/python/cpython/issues/121450

   (3) https://github.com/python/cpython/issues/123757

   (4) https://github.com/python/cpython/issues/124704

   (5) https://github.com/python/cpython/issues/130493

   (6) https://github.com/python/cpython/issues/130471

   (7) https://github.com/python/cpython/issues/133350

   (8) https://github.com/python/cpython/issues/124367

   (9) https://github.com/python/cpython/issues/132576

   (10) https://github.com/python/cpython/issues/133355


File: python.info,  Node: pickle,  Next: プラットフォーム,  Prev: pdb,  Up: Improved modules

1.1.5.39 pickle
...............

   * Set the default protocol version on the *note pickle: ab. module to
     5.  For more details, see *note pickle protocols: 27b.

   * Add exception notes for pickle serialization errors that allow
     identifying the source of the error.  (Contributed by Serhiy
     Storchaka in gh-122213(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/122213


File: python.info,  Node: プラットフォーム,  Next: pydoc,  Prev: pickle,  Up: Improved modules

1.1.5.40 プラットフォーム
.........................

   * Add *note invalidate_caches(): 27d, a function to invalidate cached
     results in the ‘platform’ module.  (Contributed by Bénédikt Tran in
     gh-122549(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/122549


File: python.info,  Node: pydoc,  Next: re,  Prev: プラットフォーム,  Up: Improved modules

1.1.5.41 pydoc
..............

   * *note Annotations: 15c. in help output are now usually displayed in
     a format closer to that in the original source.  (Contributed by
     Jelle Zijlstra in gh-101552(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101552


File: python.info,  Node: re,  Next: socket,  Prev: pydoc,  Up: Improved modules

1.1.5.42 re
...........

   * Support ‘\z’ as a synonym for ‘\Z’ in *note regular expressions:
     be.  It is interpreted unambiguously in many other regular
     expression engines, unlike ‘\Z’, which has subtly different
     behavior.  (Contributed by Serhiy Storchaka in gh-133306(1).)

   * ‘\B’ in *note regular expression: be. now matches the empty input
     string, meaning that it is now always the opposite of ‘\b’.
     (Contributed by Serhiy Storchaka in gh-124130(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/133306

   (2) https://github.com/python/cpython/issues/124130


File: python.info,  Node: socket,  Next: ssl,  Prev: re,  Up: Improved modules

1.1.5.43 socket
...............

   * Improve and fix support for Bluetooth sockets.

        * Fix support of Bluetooth sockets on NetBSD and DragonFly BSD.
          (Contributed by Serhiy Storchaka in gh-132429(1).)

        * Fix support for *note BTPROTO_HCI: 281. on FreeBSD.
          (Contributed by Victor Stinner in gh-111178(2).)

        * Add support for *note BTPROTO_SCO: 282. on FreeBSD.
          (Contributed by Serhiy Storchaka in gh-85302(3).)

        * Add support for 'cid' and 'bdaddr_type' in the address for
          *note BTPROTO_L2CAP: 283. on FreeBSD. (Contributed by Serhiy
          Storchaka in gh-132429(4).)

        * Add support for 'channel' in the address for *note
          BTPROTO_HCI: 281. on Linux.  (Contributed by Serhiy Storchaka
          in gh-70145(5).)

        * Accept an integer as the address for *note BTPROTO_HCI: 281.
          on Linux.  (Contributed by Serhiy Storchaka in gh-132099(6).)

        * Return 'cid' in *note getsockname(): 284. for *note
          BTPROTO_L2CAP: 283.  (Contributed by Serhiy Storchaka in
          gh-132429(7).)

        * Add many new constants.  (Contributed by Serhiy Storchaka in
          gh-132734(8).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132429

   (2) https://github.com/python/cpython/issues/111178

   (3) https://github.com/python/cpython/issues/85302

   (4) https://github.com/python/cpython/issues/132429

   (5) https://github.com/python/cpython/issues/70145

   (6) https://github.com/python/cpython/issues/132099

   (7) https://github.com/python/cpython/issues/132429

   (8) https://github.com/python/cpython/issues/132734


File: python.info,  Node: ssl,  Next: struct,  Prev: socket,  Up: Improved modules

1.1.5.44 ssl
............

   * Indicate through the *note HAS_PHA: 286. Boolean whether the ‘ssl’
     module supports TLSv1.3 post-handshake client authentication (PHA).
     (Contributed by Will Childs-Klein in gh-128036(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128036


File: python.info,  Node: struct,  Next: symtable,  Prev: ssl,  Up: Improved modules

1.1.5.45 struct
...............

   * Support the float complex and double complex C types in the *note
     struct: db. module (formatting characters ‘'F'’ and ‘'D'’
     respectively).  (Contributed by Sergey B Kirpichev in
     gh-121249(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/121249


File: python.info,  Node: symtable,  Next: sys,  Prev: struct,  Up: Improved modules

1.1.5.46 symtable
.................

   * Expose the following *note Symbol: 289. methods:

        * *note is_comp_cell(): 28a.

        * *note is_comp_iter(): 28b.

        * *note is_free_class(): 28c.

     (Contributed by Bénédikt Tran in gh-120029(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/120029


File: python.info,  Node: sys,  Next: sys monitoring,  Prev: symtable,  Up: Improved modules

1.1.5.47 sys
............

   * The previously undocumented special function *note
     sys.getobjects(): 28e, which only exists in specialized builds of
     Python, may now return objects from other interpreters than the one
     it's called in.  (Contributed by Eric Snow in gh-125286(1).)

   * Add *note sys._is_immortal(): 28f. for determining if an object is
     *note immortal: 290.  (Contributed by Peter Bierma in
     gh-128509(2).)

   * On FreeBSD, *note sys.platform: 291. no longer contains the major
     version number.  It is always ‘'freebsd'’, instead of ‘'freebsd13'’
     or ‘'freebsd14'’.  (Contributed by Michael Osipov in gh-129393(3).)

   * Raise *note DeprecationWarning: 1a3. for *note
     sys._clear_type_cache(): 292.  This function was deprecated in
     Python 3.13 but it didn't raise a runtime warning.

   * Add *note sys.remote_exec(): 16d. to implement the new external
     debugger interface.  See *note PEP 768: 14e. for details.
     (Contributed by Pablo Galindo Salgado, Matt Wozniski, and Ivona
     Stojanovic in gh-131591(4).)

   * Add the *note sys._jit: 293. namespace, containing utilities for
     introspecting just-in-time compilation.  (Contributed by Brandt
     Bucher in gh-133231(5).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/125286

   (2) https://github.com/python/cpython/issues/128509

   (3) https://github.com/python/cpython/issues/129393

   (4) https://github.com/python/cpython/issues/131591

   (5) https://github.com/python/cpython/issues/133231


File: python.info,  Node: sys monitoring,  Next: sysconfig,  Prev: sys,  Up: Improved modules

1.1.5.48 sys.monitoring
.......................

   * Add two new monitoring events, *note BRANCH_LEFT: 295. and *note
     BRANCH_RIGHT: 296.  These replace and deprecate the ‘BRANCH’ event.
     (Contributed by Mark Shannon in gh-122548(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/122548


File: python.info,  Node: sysconfig,  Next: tarfile,  Prev: sys monitoring,  Up: Improved modules

1.1.5.49 sysconfig
..................

   * Add ‘ABIFLAGS’ key to *note get_config_vars(): 298. on Windows.
     (Contributed by Xuehai Pan in gh-131799(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131799


File: python.info,  Node: tarfile,  Next: threading,  Prev: sysconfig,  Up: Improved modules

1.1.5.50 tarfile
................

   * *note data_filter(): 29a. now normalizes symbolic link targets in
     order to avoid path traversal attacks.  (Contributed by Petr
     Viktorin in gh-127987(1) and CVE 2025-4138(2).)

   * *note extractall(): 29b. now skips fixing up directory attributes
     when a directory was removed or replaced by another kind of file.
     (Contributed by Petr Viktorin in gh-127987(3) and CVE
     2024-12718(4).)

   * *note extract(): 29c. and *note extractall(): 29b. now (re-)apply
     the extraction filter when substituting a link (hard or symbolic)
     with a copy of another archive member, and when fixing up directory
     attributes.  The former raises a new exception, *note
     LinkFallbackError: 29d.  (Contributed by Petr Viktorin for CVE
     2025-4330(5) and CVE 2024-12718(6).)

   * *note extract(): 29c. and *note extractall(): 29b. no longer
     extract rejected members when *note errorlevel(): 29e. is zero.
     (Contributed by Matt Prodani and Petr Viktorin in gh-112887(7) and
     CVE 2025-4435(8).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127987

   (2) https://www.cve.org/CVERecord?id=CVE-2025-4138

   (3) https://github.com/python/cpython/issues/127987

   (4) https://www.cve.org/CVERecord?id=CVE-2024-12718

   (5) https://www.cve.org/CVERecord?id=CVE-2025-4330

   (6) https://www.cve.org/CVERecord?id=CVE-2024-12718

   (7) https://github.com/python/cpython/issues/112887

   (8) https://www.cve.org/CVERecord?id=CVE-2025-4435


File: python.info,  Node: threading,  Next: tkinter,  Prev: tarfile,  Up: Improved modules

1.1.5.51 threading
..................

   * *note threading.Thread.start(): 178. now sets the operating system
     thread name to *note threading.Thread.name: 2a0.  (Contributed by
     Victor Stinner in gh-59705(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/59705


File: python.info,  Node: tkinter,  Next: turtle,  Prev: threading,  Up: Improved modules

1.1.5.52 tkinter
................

   * Make *note tkinter: f6. widget methods ‘after()’ and ‘after_idle()’
     accept keyword arguments.  (Contributed by Zhikang Yan in
     gh-126899(1).)

   * Add ability to specify a name for ‘tkinter.OptionMenu’ and
     ‘tkinter.ttk.OptionMenu’.  (Contributed by Zhikang Yan in
     gh-130482(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126899

   (2) https://github.com/python/cpython/issues/130482


File: python.info,  Node: turtle,  Next: types,  Prev: tkinter,  Up: Improved modules

1.1.5.53 ‘turtle’
.................

   * Add context managers for *note turtle.fill(): 2a3, *note
     turtle.poly(): 2a4, and *note turtle.no_animation(): 2a5.
     (Contributed by Marie Roald and Yngve Mardal Moe in gh-126350(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126350


File: python.info,  Node: types,  Next: typing,  Prev: turtle,  Up: Improved modules

1.1.5.54 types
..............

   * *note types.UnionType: 2a7. is now an alias for *note typing.Union:
     2a8.  See *note below: 2a9. for more details.  (Contributed by
     Jelle Zijlstra in gh-105499(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/105499


File: python.info,  Node: typing,  Next: unicodedata,  Prev: types,  Up: Improved modules

1.1.5.55 typing
...............

   * The *note types.UnionType: 2a7. and *note typing.Union: 2a8. types
     are now aliases for each other, meaning that both old-style unions
     (created with ‘Union[int, str]’) and new-style unions (‘int | str’)
     now create instances of the same runtime type.  This unifies the
     behavior between the two syntaxes, but leads to some differences in
     behavior that may affect users who introspect types at runtime:

        - Both syntaxes for creating a union now produce the same string
          representation in *note repr(): 1c1.  For example,
          ‘repr(Union[int, str])’ is now ‘"int | str"’ instead of
          ‘"typing.Union[int, str]"’.

        - Unions created using the old syntax are no longer cached.
          Previously, running ‘Union[int, str]’ multiple times would
          return the same object (‘Union[int, str] is Union[int, str]’
          would be ‘True’), but now it will return two different
          objects.  Use ‘==’ to compare unions for equality, not ‘is’.
          New-style unions have never been cached this way.  This change
          could increase memory usage for some programs that use a large
          number of unions created by subscripting ‘typing.Union’.
          However, several factors offset this cost: unions used in
          annotations are no longer evaluated by default in Python 3.14
          because of PEP 649(1); an instance of *note types.UnionType:
          2a7. is itself much smaller than the object returned by
          ‘Union[]’ was on prior Python versions; and removing the cache
          also saves some space.  It is therefore unlikely that this
          change will cause a significant increase in memory usage for
          most users.

        - Previously, old-style unions were implemented using the
          private class ‘typing._UnionGenericAlias’.  This class is no
          longer needed for the implementation, but it has been retained
          for backward compatibility, with removal scheduled for Python
          3.17.  Users should use documented introspection helpers like
          *note get_origin(): 2ab. and *note typing.get_args(): 2ac.
          instead of relying on private implementation details.

        - It is now possible to use *note typing.Union: 2a8. itself in
          *note isinstance(): 2ad. checks.  For example, ‘isinstance(int
          | str, typing.Union)’ will return ‘True’; previously this
          raised *note TypeError: 198.

        - The ‘__args__’ attribute of *note typing.Union: 2a8. objects
          is no longer writable.

        - It is no longer possible to set any attributes on *note Union:
          2a8. objects.  This only ever worked for dunder attributes on
          previous versions, was never documented to work, and was
          subtly broken in many cases.

     (Contributed by Jelle Zijlstra in gh-105499(2).)

   * *note TypeAliasType: 2ae. now supports star unpacking.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0649/

   (2) https://github.com/python/cpython/issues/105499


File: python.info,  Node: unicodedata,  Next: unittest,  Prev: typing,  Up: Improved modules

1.1.5.56 unicodedata
....................

   * The Unicode database has been updated to Unicode 16.0.0.


File: python.info,  Node: unittest,  Next: urllib,  Prev: unicodedata,  Up: Improved modules

1.1.5.57 unittest
.................

   * *note unittest: 10c. output is now colored by default.  This can be
     controlled by *note environment variables: 1b7.  (Contributed by
     Hugo van Kemenade in gh-127221(1).)

   * unittest discovery supports *note namespace package: 2b2. as start
     directory again.  It was removed in Python 3.11.  (Contributed by
     Jacob Walls in gh-80958(2).)

   * A number of new methods were added in the *note TestCase: 2b3.
     class that provide more specialized tests.

        - *note assertHasAttr(): 2b4. and *note assertNotHasAttr(): 2b5.
          check whether the object has a particular attribute.

        - *note assertIsSubclass(): 2b6. and *note
          assertNotIsSubclass(): 2b7. check whether the object is a
          subclass of a particular class, or of one of a tuple of
          classes.

        - *note assertStartsWith(): 2b8, *note assertNotStartsWith():
          2b9, *note assertEndsWith(): 2ba. and *note
          assertNotEndsWith(): 2bb. check whether the Unicode or byte
          string starts or ends with particular strings.

     (Contributed by Serhiy Storchaka in gh-71339(3).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127221

   (2) https://github.com/python/cpython/issues/80958

   (3) https://github.com/python/cpython/issues/71339


File: python.info,  Node: urllib,  Next: uuid,  Prev: unittest,  Up: Improved modules

1.1.5.58 urllib
...............

   * Upgrade HTTP digest authentication algorithm for *note
     urllib.request: 111. by supporting SHA-256 digest authentication as
     specified in RFC 7616(1).  (Contributed by Calvin Bui in
     gh-128193(2).)

   * Improve ergonomics and standards compliance when parsing and
     emitting ‘file:’ URLs.

     In *note url2pathname(): 2bd.:

        - Accept a complete URL when the new 'require_scheme' argument
          is set to true.

        - Discard URL authority if it matches the local hostname.

        - Discard URL authority if it resolves to a local IP address
          when the new 'resolve_host' argument is set to true.

        - Discard URL query and fragment components.

        - Raise *note URLError: 2be. if a URL authority isn't local,
          except on Windows where we return a UNC path as before.

     In *note pathname2url(): 2bf.:

        - Return a complete URL when the new 'add_scheme' argument is
          set to true.

        - Include an empty URL authority when a path begins with a
          slash.  For example, the path ‘/etc/hosts’ is converted to the
          URL ‘///etc/hosts’.

     On Windows, drive letters are no longer converted to uppercase, and
     ‘:’ characters not following a drive letter no longer cause an
     *note OSError: 2c0. exception to be raised.

     (Contributed by Barney Gale in gh-125866(3).)

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc7616.html

   (2) https://github.com/python/cpython/issues/128193

   (3) https://github.com/python/cpython/issues/125866


File: python.info,  Node: uuid,  Next: webbrowser,  Prev: urllib,  Up: Improved modules

1.1.5.59 uuid
.............

   * Add support for UUID versions 6, 7, and 8 via *note uuid6(): 2c2,
     *note uuid7(): 2c3, and *note uuid8(): 2c4. respectively, as
     specified in RFC 9562(1).  (Contributed by Bénédikt Tran in
     gh-89083(2).)

   * *note NIL: 2c5. and *note MAX: 2c6. are now available to represent
     the Nil and Max UUID formats as defined by RFC 9562(3).
     (Contributed by Nick Pope in gh-128427(4).)

   * Allow generating multiple UUIDs simultaneously on the command-line
     via *note python -m uuid -count: 2c7.  (Contributed by Simon Legner
     in gh-131236(5).)

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc9562.html

   (2) https://github.com/python/cpython/issues/89083

   (3) https://datatracker.ietf.org/doc/html/rfc9562.html

   (4) https://github.com/python/cpython/issues/128427

   (5) https://github.com/python/cpython/issues/131236


File: python.info,  Node: webbrowser,  Next: zipfile,  Prev: uuid,  Up: Improved modules

1.1.5.60 webbrowser
...................

   * Names in the ‘BROWSER’ environment variable can now refer to
     already registered browsers for the *note webbrowser: 11b. module,
     instead of always generating a new browser command.

     This makes it possible to set ‘BROWSER’ to the value of one of the
     supported browsers on macOS.


File: python.info,  Node: zipfile,  Prev: webbrowser,  Up: Improved modules

1.1.5.61 zipfile
................

   * Added *note ZipInfo._for_archive: 2ca, a method to resolve suitable
     defaults for a *note ZipInfo: 2cb. object as used by *note
     ZipFile.writestr: 2cc.  (Contributed by Bénédikt Tran in
     gh-123424(1).)

   * *note ZipFile.writestr(): 2cc. now respects the ‘SOURCE_DATE_EPOCH’
     environment variable in order to better support reproducible
     builds.  (Contributed by Jiahao Li in gh-91279(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/123424

   (2) https://github.com/python/cpython/issues/91279


File: python.info,  Node: 最適化,  Next: 削除,  Prev: Improved modules,  Up: What's new in Python 3 14

1.1.6 最適化
------------

   * The import time for several standard library modules has been
     improved, including *note annotationlib: 6, *note ast: 9, *note
     asyncio: b, *note base64: f, *note cmd: 1a, *note csv: 2d, *note
     gettext: 67, *note importlib.util: 81, *note locale: 8a, *note
     mimetypes: 93, *note optparse: a4, *note pickle: ab, *note pprint:
     b3, *note pstats: b5, *note shlex: c9, *note socket: d1, *note
     string: d8, *note subprocess: dc, *note threading: f3, *note
     tomllib: 102, *note types: 109, and *note zipfile: 137.

     (Contributed by Adam Turner, Bénédikt Tran, Chris Markiewicz, Eli
     Schwartz, Hugo van Kemenade, Jelle Zijlstra, and others in
     gh-118761(1).)

   * The interpreter now avoids some reference count modifications
     internally when it's safe to do so.  This can lead to different
     values being returned from *note sys.getrefcount(): 2ce. and *note
     Py_REFCNT(): 2cf. compared to previous versions of Python.  See
     *note below: 2d0. for details.

* Menu:

* asyncio: asyncio<2>.
* base64::
* bdb::
* difflib: difflib<2>.
* gc::
* io: io<2>.
* pathlib: pathlib<2>.
* pdb: pdb<2>.
* textwrap::
* uuid: uuid<2>.
* zlib::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118761


File: python.info,  Node: asyncio<2>,  Next: base64,  Up: 最適化

1.1.6.1 asyncio
...............

   * Standard benchmark results have improved by 10-20% following the
     implementation of a new per-thread doubly linked list for *note
     native tasks: 1c7, also reducing memory usage.  This enables
     external introspection tools such as *note python -m asyncio
     pstree: 147. to introspect the call graph of asyncio tasks running
     in all threads.  (Contributed by Kumar Aditya in gh-107803(1).)

   * The module now has first class support for *note free-threading
     builds: 1f4.  This enables parallel execution of multiple event
     loops across different threads, scaling linearly with the number of
     threads.  (Contributed by Kumar Aditya in gh-128002(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/107803

   (2) https://github.com/python/cpython/issues/128002


File: python.info,  Node: base64,  Next: bdb,  Prev: asyncio<2>,  Up: 最適化

1.1.6.2 base64
..............

   * *note b16decode(): 2d3. is now up to six times faster.
     (Contributed by Bénédikt Tran, Chris Markiewicz, and Adam Turner in
     gh-118761(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118761


File: python.info,  Node: bdb,  Next: difflib<2>,  Prev: base64,  Up: 最適化

1.1.6.3 bdb
...........

   * The basic debugger now has a *note sys.monitoring: e0.-based
     backend, which can be selected via the passing ‘'monitoring'’ to
     the *note Bdb: 2d5. class's new 'backend' parameter.  (Contributed
     by Tian Gao in gh-124533(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/124533


File: python.info,  Node: difflib<2>,  Next: gc,  Prev: bdb,  Up: 最適化

1.1.6.4 difflib
...............

   * The *note IS_LINE_JUNK(): 2d7. function is now up to twice as fast.
     (Contributed by Adam Turner and Semyon Moroz in gh-130167(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/130167


File: python.info,  Node: gc,  Next: io<2>,  Prev: difflib<2>,  Up: 最適化

1.1.6.5 gc
..........

   * The new *note incremental garbage collector: 152. means that
     maximum pause times are reduced by an order of magnitude or more
     for larger heaps.

     Because of this optimization, the meaning of the results of *note
     get_threshold(): 2d9. and *note set_threshold(): 2da. have changed,
     along with *note get_count(): 2db. and *note get_stats(): 2dc.

        - For backwards compatibility, *note get_threshold(): 2d9.
          continues to return a three-item tuple.  The first value is
          the threshold for young collections, as before; the second
          value determines the rate at which the old collection is
          scanned (the default is 10, and higher values mean that the
          old collection is scanned more slowly).  The third value is
          now meaningless and is always zero.

        - *note set_threshold(): 2da. now ignores any items after the
          second.

        - *note get_count(): 2db. and *note get_stats(): 2dc. continue
          to return the same format of results.  The only difference is
          that instead of the results referring to the young, aging and
          old generations, the results refer to the young generation and
          the aging and collecting spaces of the old generation.

     In summary, code that attempted to manipulate the behavior of the
     cycle GC may not work exactly as intended, but it is very unlikely
     to be harmful.  All other code will work just fine.

     (Contributed by Mark Shannon in gh-108362(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/108362


File: python.info,  Node: io<2>,  Next: pathlib<2>,  Prev: gc,  Up: 最適化

1.1.6.6 io
..........

   * Opening and reading files now executes fewer system calls.  Reading
     a small operating system cached file in full is up to 15% faster.
     (Contributed by Cody Maloney and Victor Stinner in gh-120754(1) and
     gh-90102(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/120754

   (2) https://github.com/python/cpython/issues/90102


File: python.info,  Node: pathlib<2>,  Next: pdb<2>,  Prev: io<2>,  Up: 最適化

1.1.6.7 pathlib
...............

   * *note Path.read_bytes: 2df. now uses unbuffered mode to open files,
     which is between 9% and 17% faster to read in full.  (Contributed
     by Cody Maloney in gh-120754(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/120754


File: python.info,  Node: pdb<2>,  Next: textwrap,  Prev: pathlib<2>,  Up: 最適化

1.1.6.8 pdb
...........

   * *note pdb: aa. now supports two backends, based on either *note
     sys.settrace(): 2e1. or *note sys.monitoring: e0.  Using the *note
     pdb CLI: 2e2. or *note breakpoint(): 271. will always use the *note
     sys.monitoring: e0. backend.  Explicitly instantiating *note
     pdb.Pdb: 273. and its derived classes will use the *note
     sys.settrace(): 2e1. backend by default, which is configurable.
     (Contributed by Tian Gao in gh-124533(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/124533


File: python.info,  Node: textwrap,  Next: uuid<2>,  Prev: pdb<2>,  Up: 最適化

1.1.6.9 textwrap
................

   * Optimize the *note dedent(): 1a9. function, improving performance
     by an average of 2.4x, with larger improvements for bigger inputs,
     and fix a bug with incomplete normalization of blank lines with
     whitespace characters other than space and tab.


File: python.info,  Node: uuid<2>,  Next: zlib,  Prev: textwrap,  Up: 最適化

1.1.6.10 uuid
.............

   * *note uuid3(): 2e5. and *note uuid5(): 2e6. are now both roughly
     40% faster for 16-byte names and 20% faster for 1024-byte names.
     Performance for longer names remains unchanged.  (Contributed by
     Bénédikt Tran in gh-128150(1).)

   * *note uuid4(): 2e7. is now c.  30% faster.  (Contributed by
     Bénédikt Tran in gh-128150(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128150

   (2) https://github.com/python/cpython/issues/128150


File: python.info,  Node: zlib,  Prev: uuid<2>,  Up: 最適化

1.1.6.11 zlib
.............

   * On Windows, zlib-ng(1) is now used as the implementation of the
     *note zlib: 139. module in the default binaries.  There are no
     known incompatibilities between ‘zlib-ng’ and the previously-used
     ‘zlib’ implementation.  This should result in better performance at
     all compression levels.

     It is worth noting that ‘zlib.Z_BEST_SPEED’ (‘1’) may result in
     significantly less compression than the previous implementation,
     whilst also significantly reducing the time taken to compress.

     (Contributed by Steve Dower in gh-91349(2).)

   ---------- Footnotes ----------

   (1) https://github.com/zlib-ng/zlib-ng

   (2) https://github.com/python/cpython/issues/91349


File: python.info,  Node: 削除,  Next: 非推奨,  Prev: 最適化,  Up: What's new in Python 3 14

1.1.7 削除
----------

* Menu:

* argparse: argparse<2>.
* ast: ast<2>.
* asyncio: asyncio<3>.
* email::
* importlib.abc: importlib abc.
* itertools::
* pathlib: pathlib<3>.
* pkgutil::
* pty::
* sqlite3::
* urllib: urllib<2>.


File: python.info,  Node: argparse<2>,  Next: ast<2>,  Up: 削除

1.1.7.1 argparse
................

   * Remove the 'type', 'choices', and 'metavar' parameters of
     ‘BooleanOptionalAction’.  These have been deprecated since Python
     3.12.  (Contributed by Nikita Sobolev in gh-118805(1).)

   * Calling *note add_argument_group(): 2eb. on an argument group now
     raises a *note ValueError: 2ec.  Similarly, *note
     add_argument_group(): 2eb. or *note add_mutually_exclusive_group():
     2ed. on a mutually exclusive group now both raise *note ValueError:
     2ec.s.  This 'nesting' was never supported, often failed to work
     correctly, and was unintentionally exposed through inheritance.
     This functionality has been deprecated since Python 3.11.
     (Contributed by Savannah Ostrowski in gh-127186(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118805

   (2) https://github.com/python/cpython/issues/127186


File: python.info,  Node: ast<2>,  Next: asyncio<3>,  Prev: argparse<2>,  Up: 削除

1.1.7.2 ast
...........

   * Remove the following classes, which have been deprecated aliases of
     *note Constant: 2ef. since Python 3.8 and have emitted deprecation
     warnings since Python 3.12:

        * ‘Bytes’

        * ‘Ellipsis’

        * ‘NameConstant’

        * ‘Num’

        * ‘Str’

     As a consequence of these removals, user-defined ‘visit_Num’,
     ‘visit_Str’, ‘visit_Bytes’, ‘visit_NameConstant’ and
     ‘visit_Ellipsis’ methods on custom *note NodeVisitor: 2f0.
     subclasses will no longer be called when the ‘NodeVisitor’ subclass
     is visiting an AST. Define a ‘visit_Constant’ method instead.

     (Contributed by Alex Waygood in gh-119562(1).)

   * Remove the following deprecated properties on *note ast.Constant:
     2ef, which were present for compatibility with the now-removed AST
     classes:

        * ‘Constant.n’

        * ‘Constant.s’

     Use ‘Constant.value’ instead.  (Contributed by Alex Waygood in
     gh-119562(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/119562

   (2) https://github.com/python/cpython/issues/119562


File: python.info,  Node: asyncio<3>,  Next: email,  Prev: ast<2>,  Up: 削除

1.1.7.3 asyncio
...............

   * Remove the following classes, methods, and functions, which have
     been deprecated since Python 3.12:

        * ‘AbstractChildWatcher’

        * ‘FastChildWatcher’

        * ‘MultiLoopChildWatcher’

        * ‘PidfdChildWatcher’

        * ‘SafeChildWatcher’

        * ‘ThreadedChildWatcher’

        * ‘AbstractEventLoopPolicy.get_child_watcher()’

        * ‘AbstractEventLoopPolicy.set_child_watcher()’

        * ‘get_child_watcher()’

        * ‘set_child_watcher()’

     (Contributed by Kumar Aditya in gh-120804(1).)

   * *note asyncio.get_event_loop(): 2f2. now raises a *note
     RuntimeError: 244. if there is no current event loop, and no longer
     implicitly creates an event loop.

     (Contributed by Kumar Aditya in gh-126353(2).)

     There's a few patterns that use *note asyncio.get_event_loop():
     2f2, most of them can be replaced with *note asyncio.run(): 2f3.

     If you're running an async function, simply use *note
     asyncio.run(): 2f3.

     Before:

          async def main():
              ...


          loop = asyncio.get_event_loop()
          try:
              loop.run_until_complete(main())
          finally:
              loop.close()

     After:

          async def main():
              ...

          asyncio.run(main())

     If you need to start something, for example, a server listening on
     a socket and then run forever, use *note asyncio.run(): 2f3. and an
     *note asyncio.Event: 2f4.

     Before:

          def start_server(loop): ...

          loop = asyncio.get_event_loop()
          try:
              start_server(loop)
              loop.run_forever()
          finally:
              loop.close()

     After:

          def start_server(loop): ...

          async def main():
              start_server(asyncio.get_running_loop())
              await asyncio.Event().wait()

          asyncio.run(main())

     If you need to run something in an event loop, then run some
     blocking code around it, use *note asyncio.Runner: 2f5.

     Before:

          async def operation_one(): ...
          def blocking_code(): ...
          async def operation_two(): ...

          loop = asyncio.get_event_loop()
          try:
              loop.run_until_complete(operation_one())
              blocking_code()
              loop.run_until_complete(operation_two())
          finally:
              loop.close()

     After:

          async def operation_one(): ...
          def blocking_code(): ...
          async def operation_two(): ...

          with asyncio.Runner() as runner:
              runner.run(operation_one())
              blocking_code()
              runner.run(operation_two())

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/120804

   (2) https://github.com/python/cpython/issues/126353


File: python.info,  Node: email,  Next: importlib abc,  Prev: asyncio<3>,  Up: 削除

1.1.7.4 email
.............

   * Remove *note email.utils.localtime(): 2f7.'s 'isdst' parameter,
     which was deprecated in and has been ignored since Python 3.12.
     (Contributed by Hugo van Kemenade in gh-118798(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118798


File: python.info,  Node: importlib abc,  Next: itertools,  Prev: email,  Up: 削除

1.1.7.5 importlib.abc
.....................

   * Remove deprecated *note importlib.abc: 7c. classes:

        * ‘ResourceReader’ (use *note TraversableResources: 2f9.)

        * ‘Traversable’ (use *note Traversable: 2fa.)

        * ‘TraversableResources’ (use *note TraversableResources: 2f9.)

     (Contributed by Jason R. Coombs and Hugo van Kemenade in
     gh-93963(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/93963


File: python.info,  Node: itertools,  Next: pathlib<3>,  Prev: importlib abc,  Up: 削除

1.1.7.6 itertools
.................

   * Remove support for copy, deepcopy, and pickle operations from *note
     itertools: 85. iterators.  These have emitted a *note
     DeprecationWarning: 1a3. since Python 3.12.  (Contributed by
     Raymond Hettinger in gh-101588(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101588


File: python.info,  Node: pathlib<3>,  Next: pkgutil,  Prev: itertools,  Up: 削除

1.1.7.7 pathlib
...............

   * Remove support for passing additional keyword arguments to *note
     Path: 266.  In previous versions, any such arguments are ignored.
     (Contributed by Barney Gale in gh-74033(1).)

   * Remove support for passing additional positional arguments to *note
     PurePath.relative_to(): 2fd. and *note is_relative_to(): 2fe.  In
     previous versions, any such arguments are joined onto 'other'.
     (Contributed by Barney Gale in gh-78707(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/74033

   (2) https://github.com/python/cpython/issues/78707


File: python.info,  Node: pkgutil,  Next: pty,  Prev: pathlib<3>,  Up: 削除

1.1.7.8 pkgutil
...............

   * Remove the ‘get_loader()’ and ‘find_loader()’ functions, which have
     been deprecated since Python 3.12.  (Contributed by Bénédikt Tran
     in gh-97850(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97850


File: python.info,  Node: pty,  Next: sqlite3,  Prev: pkgutil,  Up: 削除

1.1.7.9 pty
...........

   * Remove the ‘master_open()’ and ‘slave_open()’ functions, which have
     been deprecated since Python 3.12.  Use *note pty.openpty(): 301.
     instead.  (Contributed by Nikita Sobolev in gh-118824(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118824


File: python.info,  Node: sqlite3,  Next: urllib<2>,  Prev: pty,  Up: 削除

1.1.7.10 sqlite3
................

   * Remove ‘version’ and ‘version_info’ from the *note sqlite3: d4.
     module; use *note sqlite_version: 303. and *note
     sqlite_version_info: 304. for the actual version number of the
     runtime SQLite library.  (Contributed by Hugo van Kemenade in
     gh-118924(1).)

   * Using a sequence of parameters with named placeholders now raises a
     *note ProgrammingError: 305, having been deprecated since Python
     3.12.  (Contributed by Erlend E. Aasland in gh-118928(2) and
     gh-101693(3).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118924

   (2) https://github.com/python/cpython/issues/118928

   (3) https://github.com/python/cpython/issues/101693


File: python.info,  Node: urllib<2>,  Prev: sqlite3,  Up: 削除

1.1.7.11 urllib
...............

   * Remove the ‘Quoter’ class from *note urllib.parse: 110, which has
     been deprecated since Python 3.11.  (Contributed by Nikita Sobolev
     in gh-118827(1).)

   * Remove the ‘URLopener’ and ‘FancyURLopener’ classes from *note
     urllib.request: 111, which have been deprecated since Python 3.3.

     ‘myopener.open()’ can be replaced with *note urlopen(): 307.
     ‘myopener.retrieve()’ can be replaced with *note urlretrieve():
     308.  Customisations to the opener classes can be replaced by
     passing customized handlers to *note build_opener(): 309.
     (Contributed by Barney Gale in gh-84850(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118827

   (2) https://github.com/python/cpython/issues/84850


File: python.info,  Node: 非推奨,  Next: CPython バイトコードの変更,  Prev: 削除,  Up: What's new in Python 3 14

1.1.8 非推奨
------------

* Menu:

* New deprecations::
* Pending removal in Python 3.15: Pending removal in Python 3 15.
* Pending removal in Python 3.16: Pending removal in Python 3 16.
* Pending removal in Python 3.17: Pending removal in Python 3 17.
* Pending removal in Python 3.18: Pending removal in Python 3 18.
* Pending removal in Python 3.19: Pending removal in Python 3 19.
* Pending removal in future versions::


File: python.info,  Node: New deprecations,  Next: Pending removal in Python 3 15,  Up: 非推奨

1.1.8.1 New deprecations
........................

   * Passing a complex number as the 'real' or 'imag' argument in the
     *note complex(): 197. constructor is now deprecated; complex
     numbers should only be passed as a single positional argument.
     (Contributed by Serhiy Storchaka in gh-109218(1).)

   * *note argparse: 7.:

        * Passing the undocumented keyword argument 'prefix_chars' to
          the *note add_argument_group(): 2eb. method is now deprecated.
          (Contributed by Savannah Ostrowski in gh-125563(2).)

        * Deprecated the *note argparse.FileType: 30c. type converter.
          Anything relating to resource management should be handled
          downstream, after the arguments have been parsed.
          (Contributed by Serhiy Storchaka in gh-58032(3).)

   * *note asyncio: b.:

        * The ‘asyncio.iscoroutinefunction()’ is now deprecated and will
          be removed in Python 3.16; use *note
          inspect.iscoroutinefunction(): 30d. instead.  (Contributed by
          Jiahao Li and Kumar Aditya in gh-122875(4).)

        * The *note asyncio: b. policy system is deprecated and will be
          removed in Python 3.16.  In particular, the following classes
          and functions are deprecated:

             * *note asyncio.AbstractEventLoopPolicy: 30e.

             * *note asyncio.DefaultEventLoopPolicy: 30f.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 310.

             * *note asyncio.WindowsProactorEventLoopPolicy: 311.

             * *note asyncio.get_event_loop_policy(): 312.

             * *note asyncio.set_event_loop_policy(): 313.

          Users should use *note asyncio.run(): 2f3. or *note
          asyncio.Runner: 2f5. with the 'loop_factory' argument to use
          the desired event loop implementation.

          For example, to use *note asyncio.SelectorEventLoop: 314. on
          Windows:

               import asyncio

               async def main():
                   ...

               asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)

          (Contributed by Kumar Aditya in gh-127949(5).)

   * *note codecs: 1c.: The *note codecs.open(): 315. function is now
     deprecated, and will be removed in a future version of Python.  Use
     *note open(): 316. instead.  (Contributed by Inada Naoki in
     gh-133036(6).)

   * *note ctypes: 2e.:

        * On non-Windows platforms, setting *note Structure._pack_: 317.
          to use a MSVC-compatible default memory layout is now
          deprecated in favor of setting *note Structure._layout_: 1e7.
          to ‘'ms'’, and will be removed in Python 3.19.  (Contributed
          by Petr Viktorin in gh-131747(7).)

        * Calling *note ctypes.POINTER(): 1f1. on a string is now
          deprecated.  Use *note incomplete types: 318. for
          self-referential structures.  Also, the internal
          ‘ctypes._pointer_type_cache’ is deprecated.  See *note
          ctypes.POINTER(): 1f1. for updated implementation details.
          (Contributed by Sergey Myrianov in gh-100926(8).)

   * *note functools: 63.: Calling the Python implementation of *note
     functools.reduce(): 21a. with 'function' or 'sequence' as keyword
     arguments is now deprecated; the parameters will be made
     positional-only in Python 3.16.  (Contributed by Kirill Podoprigora
     in gh-121676(9).)

   * *note logging: 8b.: Support for custom logging handlers with the
     'strm' argument is now deprecated and scheduled for removal in
     Python 3.16.  Define handlers with the 'stream' argument instead.
     (Contributed by Mariusz Felisiak in gh-115032(10).)

   * *note mimetypes: 93.: Valid extensions are either empty or must
     start with '.'  for *note mimetypes.MimeTypes.add_type(): 319.
     Undotted extensions are deprecated and will raise a *note
     ValueError: 2ec. in Python 3.16.  (Contributed by Hugo van Kemenade
     in gh-75223(11).)

   * ‘nturl2path’: This module is now deprecated.  Call *note
     urllib.request.url2pathname(): 2bd. and *note pathname2url(): 2bf.
     instead.  (Contributed by Barney Gale in gh-125866(12).)

   * *note os: a5.: The *note os.popen(): 31a. and *note os.spawn*: 31b.
     functions are now *note soft deprecated: 23d.  They should no
     longer be used to write new code.  The *note subprocess: dc. module
     is recommended instead.  (Contributed by Victor Stinner in
     gh-120743(13).)

   * *note pathlib: a8.: ‘pathlib.PurePath.as_uri()’ is now deprecated
     and scheduled for removal in Python 3.19.  Use *note
     pathlib.Path.as_uri(): 31c. instead.  (Contributed by Barney Gale
     in gh-123599(14).)

   * *note pdb: aa.: The undocumented ‘pdb.Pdb.curframe_locals’
     attribute is now a deprecated read-only property, which will be
     removed in a future version of Python.  The low overhead dynamic
     frame locals access added in Python 3.13 by PEP 667(15) means the
     frame locals cache reference previously stored in this attribute is
     no longer needed.  Derived debuggers should access
     ‘pdb.Pdb.curframe.f_locals’ directly in Python 3.13 and later
     versions.  (Contributed by Tian Gao in gh-124369(16) and
     gh-125951(17).)

   * *note symtable: de.: Deprecate *note symtable.Class.get_methods():
     31d. due to the lack of interest, scheduled for removal in Python
     3.16.  (Contributed by Bénédikt Tran in gh-119698(18).)

   * *note tkinter: f6.: The ‘tkinter.Variable’ methods
     ‘trace_variable()’, ‘trace_vdelete()’ and ‘trace_vinfo()’ are now
     deprecated.  Use ‘trace_add()’, ‘trace_remove()’ and ‘trace_info()’
     instead.  (Contributed by Serhiy Storchaka in gh-120220(19).)

   * *note urllib.parse: 110.: Accepting objects with false values (like
     ‘0’ and ‘[]’) except empty strings, bytes-like objects and ‘None’
     in *note parse_qsl(): 31e. and *note parse_qs(): 31f. is now
     deprecated.  (Contributed by Serhiy Storchaka in gh-116897(20).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/109218

   (2) https://github.com/python/cpython/issues/125563

   (3) https://github.com/python/cpython/issues/58032

   (4) https://github.com/python/cpython/issues/122875

   (5) https://github.com/python/cpython/issues/127949

   (6) https://github.com/python/cpython/issues/133036

   (7) https://github.com/python/cpython/issues/131747

   (8) https://github.com/python/cpython/issues/100926

   (9) https://github.com/python/cpython/issues/121676

   (10) https://github.com/python/cpython/issues/115032

   (11) https://github.com/python/cpython/issues/75223

   (12) https://github.com/python/cpython/issues/125866

   (13) https://github.com/python/cpython/issues/120743

   (14) https://github.com/python/cpython/issues/123599

   (15) https://peps.python.org/pep-0667/

   (16) https://github.com/python/cpython/issues/124369

   (17) https://github.com/python/cpython/issues/125951

   (18) https://github.com/python/cpython/issues/119698

   (19) https://github.com/python/cpython/issues/120220

   (20) https://github.com/python/cpython/issues/116897


File: python.info,  Node: Pending removal in Python 3 15,  Next: Pending removal in Python 3 16,  Prev: New deprecations,  Up: 非推奨

1.1.8.2 Pending removal in Python 3.15
......................................

   * The import system:

        * Setting *note __cached__: 321. on a module while failing to
          set *note __spec__.cached: 322. is deprecated.  In Python
          3.15, ‘__cached__’ will cease to be set or take into
          consideration by the import system or standard library.
          (gh-97879(1))

        * Setting *note __package__: 323. on a module while failing to
          set *note __spec__.parent: 324. is deprecated.  In Python
          3.15, ‘__package__’ will cease to be set or take into
          consideration by the import system or standard library.
          (gh-97879(2))

   * *note ctypes: 2e.:

        * The undocumented ‘ctypes.SetPointerType()’ function has been
          deprecated since Python 3.13.

   * *note http.server: 76.:

        * The obsolete and rarely used *note CGIHTTPRequestHandler: 325.
          has been deprecated since Python 3.13.  No direct replacement
          exists.  'Anything' is better than CGI to interface a web
          server with a request handler.

        * The ‘--cgi’ flag to the ‘python -m http.server’ command-line
          interface has been deprecated since Python 3.13.

   * *note importlib: 7b.:

        * ‘load_module()’ method: use ‘exec_module()’ instead.

   * *note locale: 8a.:

        * The *note getdefaultlocale(): 326. function has been
          deprecated since Python 3.11.  Its removal was originally
          planned for Python 3.13 (gh-90817(3)), but has been postponed
          to Python 3.15.  Use *note getlocale(): 327, *note
          setlocale(): 328, and *note getencoding(): 329. instead.
          (Contributed by Hugo van Kemenade in gh-111187(4).)

   * *note pathlib: a8.:

        * *note PurePath.is_reserved(): 32a. has been deprecated since
          Python 3.13.  Use *note os.path.isreserved(): 32b. to detect
          reserved paths on Windows.

   * *note platform: af.:

        * *note java_ver(): 32c. has been deprecated since Python 3.13.
          This function is only useful for Jython support, has a
          confusing API, and is largely untested.

   * *note sysconfig: e1.:

        * The 'check_home' argument of *note
          sysconfig.is_python_build(): 32d. has been deprecated since
          Python 3.12.

   * *note threading: f3.:

        * *note RLock(): 32e. will take no arguments in Python 3.15.
          Passing any arguments has been deprecated since Python 3.14,
          as the Python version does not permit any arguments, but the C
          version allows any number of positional or keyword arguments,
          ignoring every argument.

   * *note types: 109.:

        * *note types.CodeType: 32f.: Accessing *note co_lnotab: 330.
          was deprecated in PEP 626(5) since 3.10 and was planned to be
          removed in 3.12, but it only got a proper *note
          DeprecationWarning: 1a3. in 3.12.  May be removed in 3.15.
          (Contributed by Nikita Sobolev in gh-101866(6).)

   * *note typing: 10a.:

        * The undocumented keyword argument syntax for creating *note
          NamedTuple: 331. classes (for example, ‘Point =
          NamedTuple("Point", x=int, y=int)’) has been deprecated since
          Python 3.13.  Use the class-based syntax or the functional
          syntax instead.

        * When using the functional syntax of *note TypedDict: 332.s,
          failing to pass a value to the 'fields' parameter (‘TD =
          TypedDict("TD")’) or passing ‘None’ (‘TD = TypedDict("TD",
          None)’) has been deprecated since Python 3.13.  Use ‘class
          TD(TypedDict): pass’ or ‘TD = TypedDict("TD", {})’ to create a
          TypedDict with zero field.

        * The *note typing.no_type_check_decorator(): 333. decorator
          function has been deprecated since Python 3.13.  After eight
          years in the *note typing: 10a. module, it has yet to be
          supported by any major type checker.

   * *note wave: 119.:

        * The *note getmark(): 334, ‘setmark()’, and *note getmarkers():
          335. methods of the *note Wave_read: 336. and *note
          Wave_write: 337. classes have been deprecated since Python
          3.13.

   * *note zipimport: 138.:

        * *note load_module(): 338. has been deprecated since Python
          3.10.  Use *note exec_module(): 339. instead.  (Contributed by
          Jiahao Li in gh-125746(7).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97879

   (2) https://github.com/python/cpython/issues/97879

   (3) https://github.com/python/cpython/issues/90817

   (4) https://github.com/python/cpython/issues/111187

   (5) https://peps.python.org/pep-0626/

   (6) https://github.com/python/cpython/issues/101866

   (7) https://github.com/python/cpython/issues/125746


File: python.info,  Node: Pending removal in Python 3 16,  Next: Pending removal in Python 3 17,  Prev: Pending removal in Python 3 15,  Up: 非推奨

1.1.8.3 Pending removal in Python 3.16
......................................

   * The import system:

        * Setting *note __loader__: 33b. on a module while failing to
          set *note __spec__.loader: 33c. is deprecated.  In Python
          3.16, ‘__loader__’ will cease to be set or taken into
          consideration by the import system or the standard library.

   * *note array: 8.:

        * The ‘'u'’ format code (‘wchar_t’) has been deprecated in
          documentation since Python 3.3 and at runtime since Python
          3.13.  Use the ‘'w'’ format code (*note Py_UCS4: 33d.) for
          Unicode characters instead.

   * *note asyncio: b.:

        * ‘asyncio.iscoroutinefunction()’ is deprecated and will be
          removed in Python 3.16; use *note
          inspect.iscoroutinefunction(): 30d. instead.  (Contributed by
          Jiahao Li and Kumar Aditya in gh-122875(1).)

        * *note asyncio: b. policy system is deprecated and will be
          removed in Python 3.16.  In particular, the following classes
          and functions are deprecated:

             * *note asyncio.AbstractEventLoopPolicy: 30e.

             * *note asyncio.DefaultEventLoopPolicy: 30f.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 310.

             * *note asyncio.WindowsProactorEventLoopPolicy: 311.

             * *note asyncio.get_event_loop_policy(): 312.

             * *note asyncio.set_event_loop_policy(): 313.

          Users should use *note asyncio.run(): 2f3. or *note
          asyncio.Runner: 2f5. with 'loop_factory' to use the desired
          event loop implementation.

          For example, to use *note asyncio.SelectorEventLoop: 314. on
          Windows:

               import asyncio

               async def main():
                   ...

               asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)

          (Contributed by Kumar Aditya in gh-127949(2).)

   * *note builtins: 13.:

        * Bitwise inversion on boolean types, ‘~True’ or ‘~False’ has
          been deprecated since Python 3.12, as it produces surprising
          and unintuitive results (‘-2’ and ‘-1’).  Use ‘not x’ instead
          for the logical negation of a Boolean.  In the rare case that
          you need the bitwise inversion of the underlying integer,
          convert to ‘int’ explicitly (‘~int(x)’).

   * *note functools: 63.:

        * Calling the Python implementation of *note functools.reduce():
          21a. with 'function' or 'sequence' as keyword arguments has
          been deprecated since Python 3.14.

   * *note logging: 8b.:

     Support for custom logging handlers with the 'strm' argument is
     deprecated and scheduled for removal in Python 3.16.  Define
     handlers with the 'stream' argument instead.  (Contributed by
     Mariusz Felisiak in gh-115032(3).)

   * *note mimetypes: 93.:

        * Valid extensions start with a '.'  or are empty for *note
          mimetypes.MimeTypes.add_type(): 319.  Undotted extensions are
          deprecated and will raise a *note ValueError: 2ec. in Python
          3.16.  (Contributed by Hugo van Kemenade in gh-75223(4).)

   * *note shutil: ca.:

        * The ‘ExecError’ exception has been deprecated since Python
          3.14.  It has not been used by any function in ‘shutil’ since
          Python 3.4, and is now an alias of *note RuntimeError: 244.

   * *note symtable: de.:

        * The *note Class.get_methods: 31d. method has been deprecated
          since Python 3.14.

   * *note sys: df.:

        * The *note _enablelegacywindowsfsencoding(): 33e. function has
          been deprecated since Python 3.13.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 33f. environment variable
          instead.

   * *note sysconfig: e1.:

        * The ‘sysconfig.expand_makefile_vars()’ function has been
          deprecated since Python 3.14.  Use the ‘vars’ argument of
          *note sysconfig.get_paths(): 340. instead.

   * *note tarfile: e4.:

        * The undocumented and unused ‘TarFile.tarfile’ attribute has
          been deprecated since Python 3.13.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/122875

   (2) https://github.com/python/cpython/issues/127949

   (3) https://github.com/python/cpython/issues/115032

   (4) https://github.com/python/cpython/issues/75223


File: python.info,  Node: Pending removal in Python 3 17,  Next: Pending removal in Python 3 18,  Prev: Pending removal in Python 3 16,  Up: 非推奨

1.1.8.4 Pending removal in Python 3.17
......................................

   * *note collections.abc: 1f.:

        - *note collections.abc.ByteString: 342. is scheduled for
          removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 260. at runtime.  For
          use in type annotations, either use *note Buffer: 343. or a
          union that explicitly specifies the types your code supports
          (e.g., ‘bytes | bytearray | memoryview’).

          ‘ByteString’ was originally intended to be an abstract class
          that would serve as a supertype of both *note bytes: 192. and
          *note bytearray: 344.  However, since the ABC never had any
          methods, knowing that an object was an instance of
          ‘ByteString’ never actually told you anything useful about the
          object.  Other common buffer types such as *note memoryview:
          165. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(1) for more details.  (Contributed by Shantanu
          Jain in gh-91896(2).)

   * *note typing: 10a.:

        - Before Python 3.14, old-style unions were implemented using
          the private class ‘typing._UnionGenericAlias’.  This class is
          no longer needed for the implementation, but it has been
          retained for backward compatibility, with removal scheduled
          for Python 3.17.  Users should use documented introspection
          helpers like *note typing.get_origin(): 2ab. and *note
          typing.get_args(): 2ac. instead of relying on private
          implementation details.

        - *note typing.ByteString: 345, deprecated since Python 3.9, is
          scheduled for removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 260. at runtime.  For
          use in type annotations, either use *note Buffer: 343. or a
          union that explicitly specifies the types your code supports
          (e.g., ‘bytes | bytearray | memoryview’).

          ‘ByteString’ was originally intended to be an abstract class
          that would serve as a supertype of both *note bytes: 192. and
          *note bytearray: 344.  However, since the ABC never had any
          methods, knowing that an object was an instance of
          ‘ByteString’ never actually told you anything useful about the
          object.  Other common buffer types such as *note memoryview:
          165. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(3) for more details.  (Contributed by Shantanu
          Jain in gh-91896(4).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0688/#current-options

   (2) https://github.com/python/cpython/issues/91896

   (3) https://peps.python.org/pep-0688/#current-options

   (4) https://github.com/python/cpython/issues/91896


File: python.info,  Node: Pending removal in Python 3 18,  Next: Pending removal in Python 3 19,  Prev: Pending removal in Python 3 17,  Up: 非推奨

1.1.8.5 Pending removal in Python 3.18
......................................

   * *note decimal: 3a.:

        * The non-standard and undocumented *note Decimal: 1fe. format
          specifier ‘'N'’, which is only supported in the ‘decimal’
          module's C implementation, has been deprecated since Python
          3.13.  (Contributed by Serhiy Storchaka in gh-89902(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89902


File: python.info,  Node: Pending removal in Python 3 19,  Next: Pending removal in future versions,  Prev: Pending removal in Python 3 18,  Up: 非推奨

1.1.8.6 Pending removal in Python 3.19
......................................

   * *note ctypes: 2e.:

        * Implicitly switching to the MSVC-compatible struct layout by
          setting *note _pack_: 317. but not *note _layout_: 1e7. on
          non-Windows platforms.


File: python.info,  Node: Pending removal in future versions,  Prev: Pending removal in Python 3 19,  Up: 非推奨

1.1.8.7 Pending removal in future versions
..........................................

The following APIs will be removed in the future, although there is
currently no date scheduled for their removal.

   * *note argparse: 7.:

        * Nesting argument groups and nesting mutually exclusive groups
          are deprecated.

        * Passing the undocumented keyword argument 'prefix_chars' to
          *note add_argument_group(): 2eb. is now deprecated.

        * The *note argparse.FileType: 30c. type converter is
          deprecated.

   * *note builtins: 13.:

        * Generators: ‘throw(type, exc, tb)’ and ‘athrow(type, exc, tb)’
          signature is deprecated: use ‘throw(exc)’ and ‘athrow(exc)’
          instead, the single argument signature.

        * Currently Python accepts numeric literals immediately followed
          by keywords, for example ‘0in x’, ‘1or x’, ‘0if 1else 2’.  It
          allows confusing and ambiguous expressions like ‘[0x1for x in
          y]’ (which can be interpreted as ‘[0x1 for x in y]’ or ‘[0x1f
          or x in y]’).  A syntax warning is raised if the numeric
          literal is immediately followed by one of keywords *note and:
          349, *note else: 17c, *note for: 34a, *note if: 181, *note in:
          34b, *note is: 34c. and *note or: 34d.  In a future release it
          will be changed to a syntax error.  (gh-87999(1))

        * Support for ‘__index__()’ and ‘__int__()’ method returning
          non-int type: these methods will be required to return an
          instance of a strict subclass of *note int: 19b.

        * Support for ‘__float__()’ method returning a strict subclass
          of *note float: 196.: these methods will be required to return
          an instance of *note float: 196.

        * Support for ‘__complex__()’ method returning a strict subclass
          of *note complex: 197.: these methods will be required to
          return an instance of *note complex: 197.

        * Passing a complex number as the 'real' or 'imag' argument in
          the *note complex(): 197. constructor is now deprecated; it
          should only be passed as a single positional argument.
          (Contributed by Serhiy Storchaka in gh-109218(2).)

   * *note calendar: 15.: ‘calendar.January’ and ‘calendar.February’
     constants are deprecated and replaced by *note calendar.JANUARY:
     34e. and *note calendar.FEBRUARY: 34f.  (Contributed by Prince
     Roshan in gh-103636(3).)

   * *note codecs: 1c.: use *note open(): 316. instead of *note
     codecs.open(): 315.  (gh-133038(4))

   * *note codeobject.co_lnotab: 330.: use the *note
     codeobject.co_lines(): 350. method instead.

   * *note datetime: 34.:

        * *note utcnow(): 351.: use
          ‘datetime.datetime.now(tz=datetime.UTC)’.

        * *note utcfromtimestamp(): 352.: use
          ‘datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)’.

   * *note gettext: 67.: Plural value must be an integer.

   * *note importlib: 7b.:

        * *note cache_from_source(): 353. 'debug_override' parameter is
          deprecated: use the 'optimization' parameter instead.

   * *note importlib.metadata: 7e.:

        * ‘EntryPoints’ tuple interface.

        * Implicit ‘None’ on return values.

   * *note logging: 8b.: the ‘warn()’ method has been deprecated since
     Python 3.3, use *note warning(): 354. instead.

   * *note mailbox: 8f.: Use of StringIO input and text mode is
     deprecated, use BytesIO and binary mode instead.

   * *note os: a5.: Calling *note os.register_at_fork(): 355. in
     multi-threaded process.

   * ‘pydoc.ErrorDuringImport’: A tuple value for 'exc_info' parameter
     is deprecated, use an exception instance.

   * *note re: be.: More strict rules are now applied for numerical
     group references and group names in regular expressions.  Only
     sequence of ASCII digits is now accepted as a numerical reference.
     The group name in bytes patterns and replacement strings can now
     only contain ASCII letters and digits and underscore.  (Contributed
     by Serhiy Storchaka in gh-91760(5).)

   * ‘sre_compile’, ‘sre_constants’ and ‘sre_parse’ modules.

   * *note shutil: ca.: *note rmtree(): 356.'s 'onerror' parameter is
     deprecated in Python 3.12; use the 'onexc' parameter instead.

   * *note ssl: d5. options and protocols:

        * *note ssl.SSLContext: 357. without protocol argument is
          deprecated.

        * *note ssl.SSLContext: 357.: *note set_npn_protocols(): 358.
          and ‘selected_npn_protocol()’ are deprecated: use ALPN
          instead.

        * ‘ssl.OP_NO_SSL*’ options

        * ‘ssl.OP_NO_TLS*’ options

        * ‘ssl.PROTOCOL_SSLv3’

        * ‘ssl.PROTOCOL_TLS’

        * ‘ssl.PROTOCOL_TLSv1’

        * ‘ssl.PROTOCOL_TLSv1_1’

        * ‘ssl.PROTOCOL_TLSv1_2’

        * ‘ssl.TLSVersion.SSLv3’

        * ‘ssl.TLSVersion.TLSv1’

        * ‘ssl.TLSVersion.TLSv1_1’

   * *note threading: f3. methods:

        * ‘threading.Condition.notifyAll()’: use *note notify_all():
          359.

        * ‘threading.Event.isSet()’: use *note is_set(): 35a.

        * ‘threading.Thread.isDaemon()’, *note
          threading.Thread.setDaemon(): 35b.: use *note
          threading.Thread.daemon: 35c. attribute.

        * ‘threading.Thread.getName()’, *note
          threading.Thread.setName(): 35d.: use *note
          threading.Thread.name: 2a0. attribute.

        * ‘threading.currentThread()’: use *note
          threading.current_thread(): 35e.

        * ‘threading.activeCount()’: use *note threading.active_count():
          35f.

   * *note typing.Text: 360. (gh-92332(6)).

   * The internal class ‘typing._UnionGenericAlias’ is no longer used to
     implement *note typing.Union: 2a8.  To preserve compatibility with
     users using this private class, a compatibility shim will be
     provided until at least Python 3.17.  (Contributed by Jelle
     Zijlstra in gh-105499(7).)

   * *note unittest.IsolatedAsyncioTestCase: 361.: it is deprecated to
     return a value that is not ‘None’ from a test case.

   * *note urllib.parse: 110. deprecated functions: *note urlparse():
     362. instead

        * ‘splitattr()’

        * ‘splithost()’

        * ‘splitnport()’

        * ‘splitpasswd()’

        * ‘splitport()’

        * ‘splitquery()’

        * ‘splittag()’

        * ‘splittype()’

        * ‘splituser()’

        * ‘splitvalue()’

        * ‘to_bytes()’

   * *note wsgiref: 11e.: ‘SimpleHandler.stdout.write()’ should not do
     partial writes.

   * *note xml.etree.ElementTree: 12b.: Testing the truth value of an
     *note Element: 363. is deprecated.  In a future release it will
     always return ‘True’.  Prefer explicit ‘len(elem)’ or ‘elem is not
     None’ tests instead.

   * *note sys._clear_type_cache(): 292. is deprecated: use *note
     sys._clear_internal_caches(): 364. instead.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/87999

   (2) https://github.com/python/cpython/issues/109218

   (3) https://github.com/python/cpython/issues/103636

   (4) https://github.com/python/cpython/issues/133038

   (5) https://github.com/python/cpython/issues/91760

   (6) https://github.com/python/cpython/issues/92332

   (7) https://github.com/python/cpython/issues/105499


File: python.info,  Node: CPython バイトコードの変更,  Next: C API changes,  Prev: 非推奨,  Up: What's new in Python 3 14

1.1.9 CPython バイトコードの変更
--------------------------------

   * Replaced the opcode ‘BINARY_SUBSCR’ by the *note BINARY_OP: 366.
     opcode with the ‘NB_SUBSCR’ oparg.  (Contributed by Irit Katriel in
     gh-100239(1).)

   * Add the *note BUILD_INTERPOLATION: 367. and *note BUILD_TEMPLATE:
     368. opcodes to construct new *note Interpolation: 16b. and *note
     Template: 16a. instances, respectively.  (Contributed by Lysandros
     Nikolaou and others in gh-132661(2); see also *note PEP 750;
     Template strings: 144.).

   * Remove the ‘BUILD_CONST_KEY_MAP’ opcode.  Use *note BUILD_MAP: 369.
     instead.  (Contributed by Mark Shannon in gh-122160(3).)

   * Replace the ‘LOAD_ASSERTION_ERROR’ opcode with *note
     LOAD_COMMON_CONSTANT: 36a. and add support for loading *note
     NotImplementedError: 36b.

   * Add the *note LOAD_FAST_BORROW: 36c. and *note
     LOAD_FAST_BORROW_LOAD_FAST_BORROW: 36d. opcodes to reduce reference
     counting overhead when the interpreter can prove that the reference
     in the frame outlives the reference loaded onto the stack.
     (Contributed by Matt Page in gh-130704(4).)

   * Add the *note LOAD_SMALL_INT: 36e. opcode, which pushes a small
     integer equal to the ‘oparg’ to the stack.  The ‘RETURN_CONST’
     opcode is removed as it is no longer used.  (Contributed by Mark
     Shannon in gh-125837(5).)

   * Add the new *note LOAD_SPECIAL: 36f. instruction.  Generate code
     for *note with: 186. and *note async with: 185. statements using
     the new instruction.  Removed the ‘BEFORE_WITH’ and
     ‘BEFORE_ASYNC_WITH’ instructions.  (Contributed by Mark Shannon in
     gh-120507(6).)

   * Add the *note POP_ITER: 370. opcode to support 'virtual' iterators.
     (Contributed by Mark Shannon in gh-132554(7).)

* Menu:

* Pseudo-instructions::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100239

   (2) https://github.com/python/cpython/issues/132661

   (3) https://github.com/python/cpython/issues/122160

   (4) https://github.com/python/cpython/issues/130704

   (5) https://github.com/python/cpython/issues/125837

   (6) https://github.com/python/cpython/issues/120507

   (7) https://github.com/python/cpython/issues/132554


File: python.info,  Node: Pseudo-instructions,  Up: CPython バイトコードの変更

1.1.9.1 Pseudo-instructions
...........................

   * Add the ‘ANNOTATIONS_PLACEHOLDER’ pseudo instruction to support
     partially executed module-level annotations with *note deferred
     evaluation of annotations: 145.  (Contributed by Jelle Zijlstra in
     gh-130907(1).)

   * Add the ‘BINARY_OP_EXTEND’ pseudo instruction, which executes a
     pair of functions (guard and specialization functions) accessed
     from the inline cache.  (Contributed by Irit Katriel in
     gh-100239(2).)

   * Add three specializations for *note CALL_KW: 372.; ‘CALL_KW_PY’ for
     calls to Python functions, ‘CALL_KW_BOUND_METHOD’ for calls to
     bound methods, and ‘CALL_KW_NON_PY’ for all other calls.
     (Contributed by Mark Shannon in gh-118093(3).)

   * Add the *note JUMP_IF_TRUE: 373. and *note JUMP_IF_FALSE: 374.
     pseudo instructions, conditional jumps which do not impact the
     stack.  Replaced by the sequence ‘COPY 1’, ‘TO_BOOL’,
     ‘POP_JUMP_IF_TRUE/FALSE’.  (Contributed by Irit Katriel in
     gh-124285(4).)

   * Add the ‘LOAD_CONST_MORTAL’ pseudo instruction.  (Contributed by
     Mark Shannon in gh-128685(5).)

   * Add the *note LOAD_CONST_IMMORTAL: 375. pseudo instruction, which
     does the same as ‘LOAD_CONST’, but is more efficient for immortal
     objects.  (Contributed by Mark Shannon in gh-125837(6).)

   * Add the *note NOT_TAKEN: 376. pseudo instruction, used by *note
     sys.monitoring: e0. to record branch events (such as *note
     BRANCH_LEFT: 295.).  (Contributed by Mark Shannon in gh-122548(7).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/130907

   (2) https://github.com/python/cpython/issues/100239

   (3) https://github.com/python/cpython/issues/118093

   (4) https://github.com/python/cpython/issues/124285

   (5) https://github.com/python/cpython/issues/128685

   (6) https://github.com/python/cpython/issues/125837

   (7) https://github.com/python/cpython/issues/122548


File: python.info,  Node: C API changes,  Next: Build changes,  Prev: CPython バイトコードの変更,  Up: What's new in Python 3 14

1.1.10 C API changes
--------------------

* Menu:

* Python configuration C API::
* New features in the C API::
* Limited C API changes::
* Removed C APIs::
* Deprecated C APIs::


File: python.info,  Node: Python configuration C API,  Next: New features in the C API,  Up: C API changes

1.1.10.1 Python configuration C API
...................................

Add a *note PyInitConfig C API: 379. to configure the Python
initialization without relying on C structures and the ability to make
ABI-compatible changes in the future.

Complete the PEP 587(1) *note PyConfig C API: 37a. by adding *note
PyInitConfig_AddModule(): 37b. which can be used to add a built-in
extension module; a feature previously referred to as the "inittab".

Add *note PyConfig_Get(): 37c. and *note PyConfig_Set(): 37d. functions
to get and set the current runtime configuration.

PEP 587(2) 'Python Initialization Configuration' unified all the ways to
configure Python's initialization.  This PEP also unifies the
configuration of Python's preinitialization and initialization in a
single API. Moreover, this PEP only provides a single choice to embed
Python, instead of having two 'Python' and 'Isolated' choices (PEP 587),
to further simplify the API.

The lower level PEP 587 PyConfig API remains available for use cases
with an intentionally higher level of coupling to CPython implementation
details (such as emulating the full functionality of CPython's CLI,
including its configuration mechanisms).

(Contributed by Victor Stinner in gh-107954(3).)

参考
....

PEP 741(4) and PEP 587(5)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0587/

   (2) https://peps.python.org/pep-0587/

   (3) https://github.com/python/cpython/issues/107954

   (4) https://peps.python.org/pep-0741/

   (5) https://peps.python.org/pep-0587/


File: python.info,  Node: New features in the C API,  Next: Limited C API changes,  Prev: Python configuration C API,  Up: C API changes

1.1.10.2 New features in the C API
..................................

   * Add *note Py_PACK_VERSION(): 37f. and *note Py_PACK_FULL_VERSION():
     380, two new macros for bit-packing Python version numbers.  This
     is useful for comparisons with *note Py_Version: 381. or *note
     PY_VERSION_HEX: 382.  (Contributed by Petr Viktorin in
     gh-128629(1).)

   * Add *note PyBytes_Join(sep, iterable): 383. function, similar to
     ‘sep.join(iterable)’ in Python.  (Contributed by Victor Stinner in
     gh-121645(2).)

   * Add functions to manipulate the configuration of the current
     runtime Python interpreter (*note PEP 741; Python configuration C
     API: 155.):

        * *note PyConfig_Get(): 37c.

        * *note PyConfig_GetInt(): 384.

        * *note PyConfig_Set(): 37d.

        * *note PyConfig_Names(): 385.

     (Contributed by Victor Stinner in gh-107954(3).)

   * Add functions to configure Python initialization (*note PEP 741;
     Python configuration C API: 155.):

        * *note Py_InitializeFromInitConfig(): 386.

        * *note PyInitConfig_AddModule(): 37b.

        * *note PyInitConfig_Create(): 387.

        * *note PyInitConfig_Free(): 388.

        * *note PyInitConfig_FreeStrList(): 389.

        * *note PyInitConfig_GetError(): 38a.

        * *note PyInitConfig_GetExitCode(): 38b.

        * *note PyInitConfig_GetInt(): 38c.

        * *note PyInitConfig_GetStr(): 38d.

        * *note PyInitConfig_GetStrList(): 38e.

        * *note PyInitConfig_HasOption(): 38f.

        * *note PyInitConfig_SetInt(): 390.

        * *note PyInitConfig_SetStr(): 391.

        * *note PyInitConfig_SetStrList(): 392.

     (Contributed by Victor Stinner in gh-107954(4).)

   * Add *note Py_fopen(): 393. function to open a file.  This works
     similarly to the standard C ‘fopen()’ function, instead accepting a
     Python object for the 'path' parameter and setting an exception on
     error.  The corresponding new *note Py_fclose(): 394. function
     should be used to close a file.  (Contributed by Victor Stinner in
     gh-127350(5).)

   * Add *note Py_HashBuffer(): 395. to compute and return the hash
     value of a buffer.  (Contributed by Antoine Pitrou and Victor
     Stinner in gh-122854(6).)

   * Add *note PyImport_ImportModuleAttr(): 396. and *note
     PyImport_ImportModuleAttrString(): 397. helper functions to import
     a module and get an attribute of the module.  (Contributed by
     Victor Stinner in gh-128911(7).)

   * Add *note PyIter_NextItem(): 398. to replace *note PyIter_Next():
     399, which has an ambiguous return value.  (Contributed by Irit
     Katriel and Erlend Aasland in gh-105201(8).)

   * Add *note PyLong_GetSign(): 39a. function to get the sign of *note
     int: 19b. objects.  (Contributed by Sergey B Kirpichev in
     gh-116560(9).)

   * Add *note PyLong_IsPositive(): 39b, *note PyLong_IsNegative(): 39c.
     and *note PyLong_IsZero(): 39d. for checking if *note PyLongObject:
     39e. is positive, negative, or zero, respectively.  (Contributed by
     James Roy and Sergey B Kirpichev in gh-126061(10).)

   * Add new functions to convert C ‘<stdint.h>’ numbers to/from Python
     *note int: 19b. objects:

        * *note PyLong_AsInt32(): 39f.

        * *note PyLong_AsInt64(): 3a0.

        * *note PyLong_AsUInt32(): 3a1.

        * *note PyLong_AsUInt64(): 3a2.

        * *note PyLong_FromInt32(): 3a3.

        * *note PyLong_FromInt64(): 3a4.

        * *note PyLong_FromUInt32(): 3a5.

        * *note PyLong_FromUInt64(): 3a6.

     (Contributed by Victor Stinner in gh-120389(11).)

   * Add a new import and export API for Python *note int: 19b. objects
     ( PEP 757(12)):

        * *note PyLong_GetNativeLayout(): 3a7.

        * *note PyLong_Export(): 3a8.

        * *note PyLong_FreeExport(): 3a9.

        * *note PyLongWriter_Create(): 3aa.

        * *note PyLongWriter_Finish(): 3ab.

        * *note PyLongWriter_Discard(): 3ac.

     (Contributed by Sergey B Kirpichev and Victor Stinner in
     gh-102471(13).)

   * Add *note PyMonitoring_FireBranchLeftEvent(): 3ad. and *note
     PyMonitoring_FireBranchRightEvent(): 3ae. for generating *note
     BRANCH_LEFT: 295. and *note BRANCH_RIGHT: 296. events,
     respectively.  (Contributed by Mark Shannon in gh-122548(14).)

   * Add *note PyType_Freeze(): 3af. function to make a type immutable.
     (Contributed by Victor Stinner in gh-121654(15).)

   * Add *note PyType_GetBaseByToken(): 3b0. and *note Py_tp_token: 3b1.
     slot for easier superclass identification, which attempts to
     resolve the type checking issue mentioned in PEP 630(16).
     (Contributed in gh-124153(17).)

   * Add a new *note PyUnicode_Equal(): 3b2. function to test if two
     strings are equal.  The function is also added to the Limited C
     API.  (Contributed by Victor Stinner in gh-124502(18).)

   * Add a new *note PyUnicodeWriter: 3b3. API to create a Python *note
     str: 169. object, with the following functions:

        * *note PyUnicodeWriter_Create(): 3b4.

        * *note PyUnicodeWriter_DecodeUTF8Stateful(): 3b5.

        * *note PyUnicodeWriter_Discard(): 3b6.

        * *note PyUnicodeWriter_Finish(): 3b7.

        * *note PyUnicodeWriter_Format(): 3b8.

        * *note PyUnicodeWriter_WriteASCII(): 3b9.

        * *note PyUnicodeWriter_WriteChar(): 3ba.

        * *note PyUnicodeWriter_WriteRepr(): 3bb.

        * *note PyUnicodeWriter_WriteStr(): 3bc.

        * *note PyUnicodeWriter_WriteSubstring(): 3bd.

        * *note PyUnicodeWriter_WriteUCS4(): 3be.

        * *note PyUnicodeWriter_WriteUTF8(): 3bf.

        * *note PyUnicodeWriter_WriteWideChar(): 3c0.

     (Contributed by Victor Stinner in gh-119182(19).)

   * The ‘k’ and ‘K’ formats in *note PyArg_ParseTuple(): 3c1. and
     similar functions now use *note __index__(): 19e. if available,
     like all other integer formats.  (Contributed by Serhiy Storchaka
     in gh-112068(20).)

   * Add support for a new ‘p’ format unit in *note Py_BuildValue():
     3c2. that produces a Python *note bool: 3c3. object from a C
     integer.  (Contributed by Pablo Galindo in bpo-45325(21).)

   * Add *note PyUnstable_IsImmortal(): 3c4. for determining if an
     object is *note immortal: 290, for debugging purposes.
     (Contributed by Peter Bierma in gh-128509(22).)

   * Add *note PyUnstable_Object_EnableDeferredRefcount(): 3c5. for
     enabling deferred reference counting, as outlined in PEP 703(23).

   * Add *note PyUnstable_Object_IsUniquelyReferenced(): 3c6. as a
     replacement for ‘Py_REFCNT(op) == 1’ on *note free threaded: 1f4.
     builds.  (Contributed by Peter Bierma in gh-133140(24).)

   * Add *note PyUnstable_Object_IsUniqueReferencedTemporary(): 3c7. to
     determine if an object is a unique temporary object on the
     interpreter's operand stack.  This can be used in some cases as a
     replacement for checking if *note Py_REFCNT(): 2cf. is ‘1’ for
     Python objects passed as arguments to C API functions.
     (Contributed by Sam Gross in gh-133164(25).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128629

   (2) https://github.com/python/cpython/issues/121645

   (3) https://github.com/python/cpython/issues/107954

   (4) https://github.com/python/cpython/issues/107954

   (5) https://github.com/python/cpython/issues/127350

   (6) https://github.com/python/cpython/issues/122854

   (7) https://github.com/python/cpython/issues/128911

   (8) https://github.com/python/cpython/issues/105201

   (9) https://github.com/python/cpython/issues/116560

   (10) https://github.com/python/cpython/issues/126061

   (11) https://github.com/python/cpython/issues/120389

   (12) https://peps.python.org/pep-0757/

   (13) https://github.com/python/cpython/issues/102471

   (14) https://github.com/python/cpython/issues/122548

   (15) https://github.com/python/cpython/issues/121654

   (16) https://peps.python.org/pep-0630/#type-checking

   (17) https://github.com/python/cpython/issues/124153

   (18) https://github.com/python/cpython/issues/124502

   (19) https://github.com/python/cpython/issues/119182

   (20) https://github.com/python/cpython/issues/112068

   (21) https://bugs.python.org/issue?@action=redirect&bpo=45325

   (22) https://github.com/python/cpython/issues/128509

   (23) https://peps.python.org/pep-0703/

   (24) https://github.com/python/cpython/issues/133140

   (25) https://github.com/python/cpython/issues/133164


File: python.info,  Node: Limited C API changes,  Next: Removed C APIs,  Prev: New features in the C API,  Up: C API changes

1.1.10.3 Limited C API changes
..............................

   * In the limited C API version 3.14 and newer, *note Py_TYPE(): 3c9.
     and *note Py_REFCNT(): 2cf. are now implemented as an opaque
     function call to hide implementation details.  (Contributed by
     Victor Stinner in gh-120600(1) and gh-124127(2).)

   * Remove the *note PySequence_Fast_GET_SIZE: 3ca, *note
     PySequence_Fast_GET_ITEM: 3cb, and *note PySequence_Fast_ITEMS:
     3cc. macros from the limited C API, since they have always been
     broken in the limited C API. (Contributed by Victor Stinner in
     gh-91417(3).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/120600

   (2) https://github.com/python/cpython/issues/124127

   (3) https://github.com/python/cpython/issues/91417


File: python.info,  Node: Removed C APIs,  Next: Deprecated C APIs,  Prev: Limited C API changes,  Up: C API changes

1.1.10.4 Removed C APIs
.......................

   * Creating *note immutable types: 3cf. with mutable bases was
     deprecated in Python 3.12, and now raises a *note TypeError: 198.
     (Contributed by Nikita Sobolev in gh-119775(1).)

   * Remove ‘PyDictObject.ma_version_tag’ member, which was deprecated
     in Python 3.12.  Use the *note PyDict_AddWatcher(): 3d0. API
     instead.  (Contributed by Sam Gross in gh-124296(2).)

   * Remove the private ‘_Py_InitializeMain()’ function.  It was a *note
     provisional API: 3d1. added to Python 3.8 by PEP 587(3).
     (Contributed by Victor Stinner in gh-129033(4).)

   * Remove the undocumented APIs ‘Py_C_RECURSION_LIMIT’ and
     ‘PyThreadState.c_recursion_remaining’.  These were added in 3.13
     and have been removed without deprecation.  Use *note
     Py_EnterRecursiveCall(): 3d2. to guard against runaway recursion in
     C code.  (Removed by Petr Viktorin in gh-133079(5), see also
     gh-130396(6).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/119775

   (2) https://github.com/python/cpython/issues/124296

   (3) https://peps.python.org/pep-0587/

   (4) https://github.com/python/cpython/issues/129033

   (5) https://github.com/python/cpython/issues/133079

   (6) https://github.com/python/cpython/issues/130396


File: python.info,  Node: Deprecated C APIs,  Prev: Removed C APIs,  Up: C API changes

1.1.10.5 Deprecated C APIs
..........................

   * The ‘Py_HUGE_VAL’ macro is now *note soft deprecated: 23d.  Use
     ‘Py_INFINITY’ instead.  (Contributed by Sergey B Kirpichev in
     gh-120026(1).)

   * The ‘Py_IS_NAN’, ‘Py_IS_INFINITY’, and ‘Py_IS_FINITE’ macros are
     now *note soft deprecated: 23d.  Use ‘isnan’, ‘isinf’ and
     ‘isfinite’ instead, available from ‘math.h’ since C99.
     (Contributed by Sergey B Kirpichev in gh-119613(2).)

   * Non-tuple sequences are now deprecated as argument for the
     ‘(items)’ format unit in *note PyArg_ParseTuple(): 3c1. and other
     *note argument parsing: 3d5. functions if 'items' contains format
     units which store a *note borrowed buffer: 3d6. or a *note borrowed
     reference: 3d7.  (Contributed by Serhiy Storchaka in gh-50333(3).)

   * The ‘_PyMonitoring_FireBranchEvent’ function is now deprecated and
     should be replaced with calls to *note
     PyMonitoring_FireBranchLeftEvent(): 3ad. and *note
     PyMonitoring_FireBranchRightEvent(): 3ae.

   * The previously undocumented function *note PySequence_In(): 3d8. is
     now *note soft deprecated: 23d.  Use *note PySequence_Contains():
     3d9. instead.  (Contributed by Yuki Kobayashi in gh-127896(4).)

* Menu:

* Pending removal in Python 3.15: Pending removal in Python 3 15<2>.
* Pending removal in Python 3.16: Pending removal in Python 3 16<2>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<2>.
* Pending removal in future versions: Pending removal in future versions<2>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/120026

   (2) https://github.com/python/cpython/issues/119613

   (3) https://github.com/python/cpython/issues/50333

   (4) https://github.com/python/cpython/issues/127896


File: python.info,  Node: Pending removal in Python 3 15<2>,  Next: Pending removal in Python 3 16<2>,  Up: Deprecated C APIs

1.1.10.6 Pending removal in Python 3.15
.......................................

   * The *note PyImport_ImportModuleNoBlock(): 3db.: Use *note
     PyImport_ImportModule(): 3dc. instead.

   * *note PyWeakref_GetObject(): 3dd. and *note PyWeakref_GET_OBJECT():
     3de.: Use *note PyWeakref_GetRef(): 3df. instead.  The
     pythoncapi-compat project(1) can be used to get *note
     PyWeakref_GetRef(): 3df. on Python 3.12 and older.

   * *note Py_UNICODE: 3e0. type and the ‘Py_UNICODE_WIDE’ macro: Use
     ‘wchar_t’ instead.

   * ‘PyUnicode_AsDecodedObject()’: Use *note PyCodec_Decode(): 3e1.
     instead.

   * ‘PyUnicode_AsDecodedUnicode()’: Use *note PyCodec_Decode(): 3e1.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note str: 169, such as *note bytes: 192.

   * ‘PyUnicode_AsEncodedObject()’: Use *note PyCodec_Encode(): 3e2.
     instead.

   * ‘PyUnicode_AsEncodedUnicode()’: Use *note PyCodec_Encode(): 3e2.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note bytes: 192, such as *note str: 169.

   * Python initialization functions, deprecated in Python 3.13:

        * *note Py_GetPath(): 3e3.: Use *note
          PyConfig_Get("module_search_paths"): 37c. (*note sys.path:
          3e4.) instead.

        * *note Py_GetPrefix(): 3e5.: Use *note
          PyConfig_Get("base_prefix"): 37c. (*note sys.base_prefix:
          3e6.) instead.  Use *note PyConfig_Get("prefix"): 37c. (*note
          sys.prefix: 3e7.) if *note virtual environments: 3e8. need to
          be handled.

        * *note Py_GetExecPrefix(): 3e9.: Use *note
          PyConfig_Get("base_exec_prefix"): 37c. (*note
          sys.base_exec_prefix: 3ea.) instead.  Use *note
          PyConfig_Get("exec_prefix"): 37c. (*note sys.exec_prefix:
          3eb.) if *note virtual environments: 3e8. need to be handled.

        * *note Py_GetProgramFullPath(): 3ec.: Use *note
          PyConfig_Get("executable"): 37c. (*note sys.executable: 3ed.)
          instead.

        * *note Py_GetProgramName(): 3ee.: Use *note
          PyConfig_Get("executable"): 37c. (*note sys.executable: 3ed.)
          instead.

        * *note Py_GetPythonHome(): 3ef.: Use *note
          PyConfig_Get("home"): 37c. or the *note PYTHONHOME: 3f0.
          environment variable instead.

     The pythoncapi-compat project(2) can be used to get *note
     PyConfig_Get(): 37c. on Python 3.13 and older.

   * Functions to configure Python's initialization, deprecated in
     Python 3.11:

        * ‘PySys_SetArgvEx()’: Set *note PyConfig.argv: 3f1. instead.

        * ‘PySys_SetArgv()’: Set *note PyConfig.argv: 3f1. instead.

        * ‘Py_SetProgramName()’: Set *note PyConfig.program_name: 3f2.
          instead.

        * ‘Py_SetPythonHome()’: Set *note PyConfig.home: 3f3. instead.

        * *note PySys_ResetWarnOptions(): 3f4.: Clear *note
          sys.warnoptions: 3f5. and ‘warnings.filters’ instead.

     The *note Py_InitializeFromConfig(): 3f6. API should be used with
     *note PyConfig: 3f7. instead.

   * Global configuration variables:

        * *note Py_DebugFlag: 3f8.: Use *note PyConfig.parser_debug:
          3f9. or *note PyConfig_Get("parser_debug"): 37c. instead.

        * *note Py_VerboseFlag: 3fa.: Use *note PyConfig.verbose: 3fb.
          or *note PyConfig_Get("verbose"): 37c. instead.

        * *note Py_QuietFlag: 3fc.: Use *note PyConfig.quiet: 3fd. or
          *note PyConfig_Get("quiet"): 37c. instead.

        * *note Py_InteractiveFlag: 3fe.: Use *note
          PyConfig.interactive: 3ff. or *note
          PyConfig_Get("interactive"): 37c. instead.

        * *note Py_InspectFlag: 400.: Use *note PyConfig.inspect: 401.
          or *note PyConfig_Get("inspect"): 37c. instead.

        * *note Py_OptimizeFlag: 402.: Use *note
          PyConfig.optimization_level: 403. or *note
          PyConfig_Get("optimization_level"): 37c. instead.

        * *note Py_NoSiteFlag: 404.: Use *note PyConfig.site_import:
          405. or *note PyConfig_Get("site_import"): 37c. instead.

        * *note Py_BytesWarningFlag: 406.: Use *note
          PyConfig.bytes_warning: 407. or *note
          PyConfig_Get("bytes_warning"): 37c. instead.

        * *note Py_FrozenFlag: 408.: Use *note
          PyConfig.pathconfig_warnings: 409. or *note
          PyConfig_Get("pathconfig_warnings"): 37c. instead.

        * *note Py_IgnoreEnvironmentFlag: 40a.: Use *note
          PyConfig.use_environment: 40b. or *note
          PyConfig_Get("use_environment"): 37c. instead.

        * *note Py_DontWriteBytecodeFlag: 40c.: Use *note
          PyConfig.write_bytecode: 40d. or *note
          PyConfig_Get("write_bytecode"): 37c. instead.

        * *note Py_NoUserSiteDirectory: 40e.: Use *note
          PyConfig.user_site_directory: 40f. or *note
          PyConfig_Get("user_site_directory"): 37c. instead.

        * *note Py_UnbufferedStdioFlag: 410.: Use *note
          PyConfig.buffered_stdio: 411. or *note
          PyConfig_Get("buffered_stdio"): 37c. instead.

        * *note Py_HashRandomizationFlag: 412.: Use *note
          PyConfig.use_hash_seed: 413. and *note PyConfig.hash_seed:
          414. or *note PyConfig_Get("hash_seed"): 37c. instead.

        * *note Py_IsolatedFlag: 415.: Use *note PyConfig.isolated: 416.
          or *note PyConfig_Get("isolated"): 37c. instead.

        * *note Py_LegacyWindowsFSEncodingFlag: 417.: Use *note
          PyPreConfig.legacy_windows_fs_encoding: 418. or *note
          PyConfig_Get("legacy_windows_fs_encoding"): 37c. instead.

        * *note Py_LegacyWindowsStdioFlag: 419.: Use *note
          PyConfig.legacy_windows_stdio: 41a. or *note
          PyConfig_Get("legacy_windows_stdio"): 37c. instead.

        * ‘Py_FileSystemDefaultEncoding’,
          ‘Py_HasFileSystemDefaultEncoding’: Use *note
          PyConfig.filesystem_encoding: 41b. or *note
          PyConfig_Get("filesystem_encoding"): 37c. instead.

        * ‘Py_FileSystemDefaultEncodeErrors’: Use *note
          PyConfig.filesystem_errors: 41c. or *note
          PyConfig_Get("filesystem_errors"): 37c. instead.

        * ‘Py_UTF8Mode’: Use *note PyPreConfig.utf8_mode: 41d. or *note
          PyConfig_Get("utf8_mode"): 37c. instead.  (see *note
          Py_PreInitialize(): 41e.)

     The *note Py_InitializeFromConfig(): 3f6. API should be used with
     *note PyConfig: 3f7. to set these options.  Or *note
     PyConfig_Get(): 37c. can be used to get these options at runtime.

   ---------- Footnotes ----------

   (1) https://github.com/python/pythoncapi-compat/

   (2) https://github.com/python/pythoncapi-compat/


File: python.info,  Node: Pending removal in Python 3 16<2>,  Next: Pending removal in Python 3 18<2>,  Prev: Pending removal in Python 3 15<2>,  Up: Deprecated C APIs

1.1.10.7 Pending removal in Python 3.16
.......................................

   * The bundled copy of ‘libmpdec’.


File: python.info,  Node: Pending removal in Python 3 18<2>,  Next: Pending removal in future versions<2>,  Prev: Pending removal in Python 3 16<2>,  Up: Deprecated C APIs

1.1.10.8 Pending removal in Python 3.18
.......................................

   * The following private functions are deprecated and planned for
     removal in Python 3.18:

        * ‘_PyBytes_Join()’: use *note PyBytes_Join(): 383.

        * ‘_PyDict_GetItemStringWithError()’: use *note
          PyDict_GetItemStringRef(): 421.

        * ‘_PyDict_Pop()’: use *note PyDict_Pop(): 422.

        * ‘_PyLong_Sign()’: use *note PyLong_GetSign(): 39a.

        * ‘_PyLong_FromDigits()’ and ‘_PyLong_New()’: use *note
          PyLongWriter_Create(): 3aa.

        * ‘_PyThreadState_UncheckedGet()’: use *note
          PyThreadState_GetUnchecked(): 423.

        * ‘_PyUnicode_AsString()’: use *note PyUnicode_AsUTF8(): 424.

        * ‘_PyUnicodeWriter_Init()’: replace
          ‘_PyUnicodeWriter_Init(&writer)’ with *note writer =
          PyUnicodeWriter_Create(0): 3b4.

        * ‘_PyUnicodeWriter_Finish()’: replace
          ‘_PyUnicodeWriter_Finish(&writer)’ with *note
          PyUnicodeWriter_Finish(writer): 3b7.

        * ‘_PyUnicodeWriter_Dealloc()’: replace
          ‘_PyUnicodeWriter_Dealloc(&writer)’ with *note
          PyUnicodeWriter_Discard(writer): 3b6.

        * ‘_PyUnicodeWriter_WriteChar()’: replace
          ‘_PyUnicodeWriter_WriteChar(&writer, ch)’ with *note
          PyUnicodeWriter_WriteChar(writer, ch): 3ba.

        * ‘_PyUnicodeWriter_WriteStr()’: replace
          ‘_PyUnicodeWriter_WriteStr(&writer, str)’ with *note
          PyUnicodeWriter_WriteStr(writer, str): 3bc.

        * ‘_PyUnicodeWriter_WriteSubstring()’: replace
          ‘_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)’
          with *note PyUnicodeWriter_WriteSubstring(writer, str, start,
          end): 3bd.

        * ‘_PyUnicodeWriter_WriteASCIIString()’: replace
          ‘_PyUnicodeWriter_WriteASCIIString(&writer, str)’ with *note
          PyUnicodeWriter_WriteASCII(writer, str): 3b9.

        * ‘_PyUnicodeWriter_WriteLatin1String()’: replace
          ‘_PyUnicodeWriter_WriteLatin1String(&writer, str)’ with *note
          PyUnicodeWriter_WriteUTF8(writer, str): 3bf.

        * ‘_PyUnicodeWriter_Prepare()’: (no replacement).

        * ‘_PyUnicodeWriter_PrepareKind()’: (no replacement).

        * ‘_Py_HashPointer()’: use *note Py_HashPointer(): 425.

        * ‘_Py_fopen_obj()’: use *note Py_fopen(): 393.

     The pythoncapi-compat project(1) can be used to get these new
     public functions on Python 3.13 and older.  (Contributed by Victor
     Stinner in gh-128863(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/pythoncapi-compat/

   (2) https://github.com/python/cpython/issues/128863


File: python.info,  Node: Pending removal in future versions<2>,  Prev: Pending removal in Python 3 18<2>,  Up: Deprecated C APIs

1.1.10.9 Pending removal in future versions
...........................................

The following APIs are deprecated and will be removed, although there is
currently no date scheduled for their removal.

   * *note Py_TPFLAGS_HAVE_FINALIZE: 427.: Unneeded since Python 3.8.

   * *note PyErr_Fetch(): 428.: Use *note PyErr_GetRaisedException():
     429. instead.

   * *note PyErr_NormalizeException(): 42a.: Use *note
     PyErr_GetRaisedException(): 429. instead.

   * *note PyErr_Restore(): 42b.: Use *note PyErr_SetRaisedException():
     42c. instead.

   * *note PyModule_GetFilename(): 42d.: Use *note
     PyModule_GetFilenameObject(): 42e. instead.

   * *note PyOS_AfterFork(): 42f.: Use *note PyOS_AfterFork_Child():
     430. instead.

   * *note PySlice_GetIndicesEx(): 431.: Use *note PySlice_Unpack():
     432. and *note PySlice_AdjustIndices(): 433. instead.

   * *note PyUnicode_READY(): 434.: Unneeded since Python 3.12

   * ‘PyErr_Display()’: Use *note PyErr_DisplayException(): 435.
     instead.

   * ‘_PyErr_ChainExceptions()’: Use ‘_PyErr_ChainExceptions1()’
     instead.

   * ‘PyBytesObject.ob_shash’ member: call *note PyObject_Hash(): 436.
     instead.

   * Thread Local Storage (TLS) API:

        * *note PyThread_create_key(): 437.: Use *note
          PyThread_tss_alloc(): 438. instead.

        * *note PyThread_delete_key(): 439.: Use *note
          PyThread_tss_free(): 43a. instead.

        * *note PyThread_set_key_value(): 43b.: Use *note
          PyThread_tss_set(): 43c. instead.

        * *note PyThread_get_key_value(): 43d.: Use *note
          PyThread_tss_get(): 43e. instead.

        * *note PyThread_delete_key_value(): 43f.: Use *note
          PyThread_tss_delete(): 440. instead.

        * *note PyThread_ReInitTLS(): 441.: Unneeded since Python 3.7.


File: python.info,  Node: Build changes,  Next: Porting to Python 3 14,  Prev: C API changes,  Up: What's new in Python 3 14

1.1.11 Build changes
--------------------

   * PEP 776(1): Emscripten is now an officially supported platform at
     tier 3(2).  As a part of this effort, more than 25 bugs in
     Emscripten libc(3) were fixed.  Emscripten now includes support for
     *note ctypes: 2e, *note termios: e7, and *note fcntl: 5d, as well
     as experimental support for the new *note default interactive
     shell: 443.  (Contributed by R. Hood Chatham in gh-127146(4),
     gh-127683(5), and gh-136931(6).)

   * Official Android binary releases are now provided on python.org(7).

   * GNU Autoconf 2.72 is now required to generate ‘configure’.
     (Contributed by Erlend Aasland in gh-115765(8).)

   * ‘wasm32-unknown-emscripten’ is now a PEP 11(9) tier 3 platform.
     (Contributed by R. Hood Chatham in gh-127146(10), gh-127683(11),
     and gh-136931(12).)

   * ‘#pragma’-based linking with ‘python3*.lib’ can now be switched off
     with *note Py_NO_LINK_LIB: 444.  (Contributed by Jean-Christophe
     Fillion-Robin in gh-82909(13).)

   * CPython now enables a set of recommended compiler options by
     default for improved security.  Use the *note -disable-safety: 445.
     ‘configure’ option to disable them, or the *note
     -enable-slower-safety: 446. option for a larger set of compiler
     options, albeit with a performance cost.

   * The ‘WITH_FREELISTS’ macro and ‘--without-freelists’ ‘configure’
     option have been removed.

   * The new ‘configure’ option *note -with-tail-call-interp: 172. may
     be used to enable the experimental tail call interpreter.  See
     *note A new type of interpreter: 14f. for further details.

   * To disable the new remote debugging support, use the *note
     -without-remote-debug: 170. ‘configure’ option.  This may be useful
     for security reasons.

   * iOS and macOS apps can now be configured to redirect ‘stdout’ and
     ‘stderr’ content to the system log.  (Contributed by Russell
     Keith-Magee in gh-127592(14).)

   * The iOS testbed is now able to stream test output while the test is
     running.  The testbed can also be used to run the test suite of
     projects other than CPython itself.  (Contributed by Russell
     Keith-Magee in gh-127592(15).)

* Menu:

* build-details.json: build-details json.
* Discontinuation of PGP signatures::
* Free-threaded Python is officially supported::
* Binary releases for the experimental just-in-time compiler::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0776/

   (2) https://peps.python.org/pep-0011/#tier-3

   (3) 
https://emscripten.org/docs/porting/emscripten-runtime-environment.html

   (4) https://github.com/python/cpython/issues/127146

   (5) https://github.com/python/cpython/issues/127683

   (6) https://github.com/python/cpython/issues/136931

   (7) https://www.python.org/downloads/android/

   (8) https://github.com/python/cpython/issues/115765

   (9) https://peps.python.org/pep-0011/

   (10) https://github.com/python/cpython/issues/127146

   (11) https://github.com/python/cpython/issues/127683

   (12) https://github.com/python/cpython/issues/136931

   (13) https://github.com/python/cpython/issues/82909

   (14) https://github.com/python/cpython/issues/127592

   (15) https://github.com/python/cpython/issues/127592


File: python.info,  Node: build-details json,  Next: Discontinuation of PGP signatures,  Up: Build changes

1.1.11.1 ‘build-details.json’
.............................

Installations of Python now contain a new file, ‘build-details.json’.
This is a static JSON document containing build details for CPython, to
allow for introspection without needing to run code.  This is helpful
for use-cases such as Python launchers, cross-compilation, and so on.

‘build-details.json’ must be installed in the platform-independent
standard library directory.  This corresponds to the *note 'stdlib':
449. *note sysconfig: e1. installation path, which can be found by
running ‘sysconfig.get_path('stdlib')’.

参考
....

PEP 739(1) - ‘build-details.json’ 1.0 - a static description file for
Python build details

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0739/


File: python.info,  Node: Discontinuation of PGP signatures,  Next: Free-threaded Python is officially supported,  Prev: build-details json,  Up: Build changes

1.1.11.2 Discontinuation of PGP signatures
..........................................

PGP (Pretty Good Privacy) signatures will not be provided for releases
of Python 3.14 or future versions.  To verify CPython artifacts, users
must use Sigstore verification materials(1).  Releases have been signed
using Sigstore(2) since Python 3.11.

This change in release process was specified in PEP 761(3).

   ---------- Footnotes ----------

   (1) https://www.python.org/downloads/metadata/sigstore/

   (2) https://www.sigstore.dev/

   (3) https://peps.python.org/pep-0761/


File: python.info,  Node: Free-threaded Python is officially supported,  Next: Binary releases for the experimental just-in-time compiler,  Prev: Discontinuation of PGP signatures,  Up: Build changes

1.1.11.3 Free-threaded Python is officially supported
.....................................................

The free-threaded build of Python is now supported and no longer
experimental.  This is the start of phase II(1) where free-threaded
Python is officially supported but still optional.

The free-threading team are confident that the project is on the right
path, and appreciate the continued dedication from everyone working to
make free-threading ready for broader adoption across the Python
community.

With these recommendations and the acceptance of this PEP, the Python
developer community should broadly advertise that free-threading is a
supported Python build option now and into the future, and that it will
not be removed without a proper deprecation schedule.

Any decision to transition to phase III(2), with free-threading as the
default or sole build of Python is still undecided, and dependent on
many factors both within CPython itself and the community.  This
decision is for the future.

参考
....

PEP 779(3)

PEP 779's acceptance(4)

   ---------- Footnotes ----------

   (1) https://discuss.python.org/t/37075

   (2) https://discuss.python.org/t/37075

   (3) https://peps.python.org/pep-0779/

   (4) https://discuss.python.org/t/84319/123


File: python.info,  Node: Binary releases for the experimental just-in-time compiler,  Prev: Free-threaded Python is officially supported,  Up: Build changes

1.1.11.4 Binary releases for the experimental just-in-time compiler
...................................................................

The official macOS and Windows release binaries now include an
'experimental' just-in-time (JIT) compiler.  Although it is 'not'
recommended for production use, it can be tested by setting *note
PYTHON_JIT=1: 44d. as an environment variable.  Downstream source builds
and redistributors can use the *note -enable-experimental-jit=yes-off:
44e. configuration option for similar behavior.

The JIT is at an early stage and still in active development.  As such,
the typical performance impact of enabling it can range from 10% slower
to 20% faster, depending on workload.  To aid in testing and evaluation,
a set of introspection functions has been provided in the *note
sys._jit: 293. namespace.  *note sys._jit.is_available(): 44f. can be
used to determine if the current executable supports JIT compilation,
while *note sys._jit.is_enabled(): 450. can be used to tell if JIT
compilation has been enabled for the current process.

Currently, the most significant missing functionality is that native
debuggers and profilers like ‘gdb’ and ‘perf’ are unable to unwind
through JIT frames (Python debuggers and profilers, like *note pdb: aa.
or *note profile: b4, continue to work without modification).
Free-threaded builds do not support JIT compilation.

Please report any bugs or major performance regressions that you
encounter!

参考
....

PEP 744(1)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0744/


File: python.info,  Node: Porting to Python 3 14,  Next: Notable changes in 3 14 1,  Prev: Build changes,  Up: What's new in Python 3 14

1.1.12 Porting to Python 3.14
-----------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

* Menu:

* Python API の変更::
* Changes in annotations (PEP 649 and PEP 749): Changes in annotations PEP 649 and PEP 749.
* C API の変更::


File: python.info,  Node: Python API の変更,  Next: Changes in annotations PEP 649 and PEP 749,  Up: Porting to Python 3 14

1.1.12.1 Python API の変更
..........................

   * On Unix platforms other than macOS, 'forkserver' is now the default
     *note start method: 1d5. for *note multiprocessing: 98. and *note
     ProcessPoolExecutor: 1d6, instead of 'fork'.

     See *note (1): 1d3. and *note (2): 249. for details.

     If you encounter *note NameError: 452.s or pickling errors coming
     out of *note multiprocessing: 98. or *note concurrent.futures: 24,
     see the *note forkserver restrictions: 1d9.

     This change does not affect Windows or macOS, where *note 'spawn':
     1d8. remains the default start method.

   * *note functools.partial: 217. is now a method descriptor.  Wrap it
     in *note staticmethod(): 453. if you want to preserve the old
     behavior.  (Contributed by Serhiy Storchaka and Dominykas Grigonis
     in gh-121027(1).)

   * The *note garbage collector is now incremental: 152, which means
     that the behavior of *note gc.collect(): 1b3. changes slightly:

        * ‘gc.collect(1)’: Performs an increment of garbage collection,
          rather than collecting generation 1.

        * Other calls to ‘gc.collect()’ are unchanged.

   * The *note locale.nl_langinfo(): 454. function now temporarily sets
     the ‘LC_CTYPE’ locale in some cases.  This temporary change affects
     other threads.  (Contributed by Serhiy Storchaka in gh-69998(2).)

   * *note types.UnionType: 2a7. is now an alias for *note typing.Union:
     2a8, causing changes in some behaviors.  See *note above: 2a9. for
     more details.  (Contributed by Jelle Zijlstra in gh-105499(3).)

   * The runtime behavior of annotations has changed in various ways;
     see *note above: 145. for details.  While most code that interacts
     with annotations should continue to work, some undocumented details
     may behave differently.

   * As part of making the *note mimetypes: 93. CLI public, it now exits
     with ‘1’ on failure instead of ‘0’ and ‘2’ on incorrect
     command-line parameters instead of ‘1’.  Error messages are now
     printed to stderr.

   * The ‘\B’ pattern in regular expression now matches the empty string
     when given as the entire pattern, which may cause behavioural
     changes.

   * On FreeBSD, *note sys.platform: 291. no longer contains the major
     version number.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/121027

   (2) https://github.com/python/cpython/issues/69998

   (3) https://github.com/python/cpython/issues/105499


File: python.info,  Node: Changes in annotations PEP 649 and PEP 749,  Next: C API の変更,  Prev: Python API の変更,  Up: Porting to Python 3 14

1.1.12.2 Changes in annotations (
.................................

'PEP 649' and 'PEP 749')

This section contains guidance on changes that may be needed to
annotations or Python code that interacts with or introspects
annotations, due to the changes related to *note deferred evaluation of
annotations: 145.

In the majority of cases, working code from older versions of Python
will not require any changes.

* Menu:

* Implications for annotated code::
* Implications for readers of __annotations__::
* Related changes::
* from __future__ import annotations::


File: python.info,  Node: Implications for annotated code,  Next: Implications for readers of __annotations__,  Up: Changes in annotations PEP 649 and PEP 749

1.1.12.3 Implications for annotated code
........................................

If you define annotations in your code (for example, for use with a
static type checker), then this change probably does not affect you: you
can keep writing annotations the same way you did with previous versions
of Python.

You will likely be able to remove quoted strings in annotations, which
are frequently used for forward references.  Similarly, if you use ‘from
__future__ import annotations’ to avoid having to write strings in
annotations, you may well be able to remove that import once you support
only Python 3.14 and newer.  However, if you rely on third-party
libraries that read annotations, those libraries may need changes to
support unquoted annotations before they work as expected.


File: python.info,  Node: Implications for readers of __annotations__,  Next: Related changes,  Prev: Implications for annotated code,  Up: Changes in annotations PEP 649 and PEP 749

1.1.12.4 Implications for readers of ‘__annotations__’
......................................................

If your code reads the *note __annotations__: 458. attribute on objects,
you may want to make changes in order to support code that relies on
deferred evaluation of annotations.  For example, you may want to use
*note annotationlib.get_annotations(): 459. with the *note FORWARDREF:
15f. format, as the *note dataclasses: 33. module now does.

The external typing_extensions(1) package provides partial backports of
some of the functionality of the *note annotationlib: 6. module, such as
the *note Format: 230. enum and the *note get_annotations(): 459.
function.  These can be used to write cross-version code that takes
advantage of the new behavior in Python 3.14.

   ---------- Footnotes ----------

   (1) https://pypi.org/project/typing_extensions/


File: python.info,  Node: Related changes,  Next: from __future__ import annotations,  Prev: Implications for readers of __annotations__,  Up: Changes in annotations PEP 649 and PEP 749

1.1.12.5 Related changes
........................

The changes in Python 3.14 are designed to rework how ‘__annotations__’
works at runtime while minimizing breakage to code that contains
annotations in source code and to code that reads ‘__annotations__’.
However, if you rely on undocumented details of the annotation behavior
or on private functions in the standard library, there are many ways in
which your code may not work in Python 3.14.  To safeguard your code
against future changes, only use the documented functionality of the
*note annotationlib: 6. module.

In particular, do not read annotations directly from the namespace
dictionary attribute of type objects.  Use *note
annotationlib.get_annotate_from_class_namespace(): 45b. during class
construction and *note annotationlib.get_annotations(): 459. afterwards.

In previous releases, it was sometimes possible to access class
annotations from an instance of an annotated class.  This behavior was
undocumented and accidental, and will no longer work in Python 3.14.


File: python.info,  Node: from __future__ import annotations,  Prev: Related changes,  Up: Changes in annotations PEP 649 and PEP 749

1.1.12.6 ‘from __future__ import annotations’
.............................................

In Python 3.7, PEP 563(1) introduced the ‘from __future__ import
annotations’ *note future statement: 45d, which turns all annotations
into strings.

However, this statement is now deprecated and it is expected to be
removed in a future version of Python.  This removal will not happen
until after Python 3.13 reaches its end of life in 2029, being the last
version of Python without support for deferred evaluation of
annotations.

In Python 3.14, the behavior of code using ‘from __future__ import
annotations’ is unchanged.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0563/


File: python.info,  Node: C API の変更,  Prev: Changes in annotations PEP 649 and PEP 749,  Up: Porting to Python 3 14

1.1.12.7 C API の変更
.....................

   * *note Py_Finalize(): 45f. now deletes all interned strings.  This
     is backwards incompatible to any C extension that holds onto an
     interned string after a call to *note Py_Finalize(): 45f. and is
     then reused after a call to *note Py_Initialize(): 460.  Any issues
     arising from this behavior will normally result in crashes during
     the execution of the subsequent call to *note Py_Initialize(): 460.
     from accessing uninitialized memory.  To fix, use an address
     sanitizer to identify any use-after-free coming from an interned
     string and deallocate it during module shutdown.  (Contributed by
     Eddie Elizondo in gh-113601(1).)

   * The *note Unicode Exception Objects: 461. C API now raises a *note
     TypeError: 198. if its exception argument is not a *note
     UnicodeError: 462. object.  (Contributed by Bénédikt Tran in
     gh-127691(2).)

   * The interpreter internally avoids some reference count
     modifications when loading objects onto the operands stack by *note
     borrowing: 3d7. references when possible.  This can lead to smaller
     reference count values compared to previous Python versions.  C API
     extensions that checked *note Py_REFCNT(): 2cf. of ‘1’ to determine
     if an function argument is not referenced by any other code should
     instead use *note PyUnstable_Object_IsUniqueReferencedTemporary():
     3c7. as a safer replacement.

   * Private functions promoted to public C APIs:

        * ‘_PyBytes_Join()’: *note PyBytes_Join(): 383.

        * ‘_PyLong_IsNegative()’: *note PyLong_IsNegative(): 39c.

        * ‘_PyLong_IsPositive()’: *note PyLong_IsPositive(): 39b.

        * ‘_PyLong_IsZero()’: *note PyLong_IsZero(): 39d.

        * ‘_PyLong_Sign()’: *note PyLong_GetSign(): 39a.

        * ‘_PyUnicodeWriter_Dealloc()’: *note PyUnicodeWriter_Discard():
          3b6.

        * ‘_PyUnicodeWriter_Finish()’: *note PyUnicodeWriter_Finish():
          3b7.

        * ‘_PyUnicodeWriter_Init()’: use *note PyUnicodeWriter_Create():
          3b4.

        * ‘_PyUnicodeWriter_Prepare()’: (no replacement)

        * ‘_PyUnicodeWriter_PrepareKind()’: (no replacement)

        * ‘_PyUnicodeWriter_WriteChar()’: *note
          PyUnicodeWriter_WriteChar(): 3ba.

        * ‘_PyUnicodeWriter_WriteStr()’: *note
          PyUnicodeWriter_WriteStr(): 3bc.

        * ‘_PyUnicodeWriter_WriteSubstring()’: *note
          PyUnicodeWriter_WriteSubstring(): 3bd.

        * ‘_PyUnicode_EQ()’: *note PyUnicode_Equal(): 3b2.

        * ‘_PyUnicode_Equal()’: *note PyUnicode_Equal(): 3b2.

        * ‘_Py_GetConfig()’: *note PyConfig_Get(): 37c. and *note
          PyConfig_GetInt(): 384.

        * ‘_Py_HashBytes()’: *note Py_HashBuffer(): 395.

        * ‘_Py_fopen_obj()’: *note Py_fopen(): 393.

        * ‘PyMutex_IsLocked()’ : *note PyMutex_IsLocked(): 463.

     The pythoncapi-compat project(3) can be used to get most of these
     new functions on Python 3.13 and older.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/113601

   (2) https://github.com/python/cpython/issues/127691

   (3) https://github.com/python/pythoncapi-compat/


File: python.info,  Node: Notable changes in 3 14 1,  Prev: Porting to Python 3 14,  Up: What's new in Python 3 14

1.1.13 Notable changes in 3.14.1
--------------------------------

   * Add *note PyUnstable_ThreadState_SetStackProtection(): 466. and
     *note PyUnstable_ThreadState_ResetStackProtection(): 467. functions
     to set the stack protection base address and stack protection size
     of a Python thread state.  (Contributed by Victor Stinner in
     gh-139653(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/139653


File: python.info,  Node: What's New In Python 3 13,  Next: What's New In Python 3 12,  Prev: What's new in Python 3 14,  Up: What's New in Python

1.2 What's New In Python 3.13
=============================


エディタ: Adam Turner と Thomas Wouters

この記事では Python 3.12 と比較した Python 3.13 の新機能を解説します。
Python 3.13 は2024年10月7日にリリースされました。全詳細については *note
変更履歴: 142. をご覧ください。

参考
....

PEP 719(1) - Python 3.13 リリーススケジュール

* Menu:

* 概要: 概要 -- リリースハイライト<2>. リリースハイライト
* 新しい機能: 新しい機能<2>.
* その他の言語変更::
* 新たなモジュール::
* 改良されたモジュール::
* 最適化: 最適化<2>.
* Removed Modules And APIs::
* New Deprecations::
* CPython Bytecode Changes::
* C API の変更: C API の変更<2>.
* Build Changes::
* Porting to Python 3.13: Porting to Python 3 13.
* Regression Test Changes::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0719/


File: python.info,  Node: 概要 -- リリースハイライト<2>,  Next: 新しい機能<2>,  Up: What's New In Python 3 13

1.2.1 概要 - リリースハイライト
-------------------------------

Python 3.13 はプログラミング言語 Python の安定版のリリースです。言語自体
への変更や、実装、標準ライブラリのアップデートが含まれます。一番大きな変
更点は、新しい *note 対話型インタープリタ: 46c. 、 *note
フリースレッドモード: 46d. ( PEP 703(1)) 実行の実験的なサポート、 *note
Just-In-Time コンパイラ: 46e. ( PEP 744(2)) です。

エラーメッセージも引き続き改善され、トレースバックがデフォルトで色付き表
示になりました。また、組み込み関数 *note locals(): 46f. の戻り値のマッピ
ングに変更を加えた際の *note セマンティクスの定義: 470. が追加されました
。他にも、型引数がデフォルト値をサポートするようになりました。

ライブラリの変更点としては、非推奨 API ・モジュールの削除や、従来通り使
いやすさの改善・バグ修正も行いました。Python 3.11 の廃止に伴い、レガシー
標準ライブラリモジュールもいくつか *note 削除されました: 471. ( PEP
594(3)) 。

本記事は、全ての新機能の仕様をを網羅的に説明する代わりに、分かりやすく概
要を説明するものとなっています。詳細については *note
ライブラリリファレンス: 149. や *note 言語レファレンス: 14a. などを参照
してください。各変更点の実装や設計の理由を網羅的に理解したい方は、該当の
PEP を参照してください。ただし、 PEP は機能が実装されたあとは Python の
最新バージョンに合わせて更新されないことが多いので注意してください。
Python を以前のバージョンからアップグレードする際の注意点は *note
Porting to Python 3.13: 472. を参照してください。

__________________________________________________________________

インタープリタの改善点:

   * *note 対話的インタープリタ: 46c. の大幅改善と *note
     エラーメッセージの改善: 473. 。

   * PEP 667(4): 組み込み関数 *note locals(): 46f. の戻り値のマッピング
     に変更を加えた際の *note セマンティクスの定義: 470. が言語仕様に追
     加されました。これにより、Python デバッガーなどのツールが最適化され
     たスコープ内のローカル変数を更新する際、たとえ並行処理だとしても、
     確実に更新することができるようになります。

   * PEP 703(5): CPython 3.13 では *note global interpreter lock: 474. を
     無効化した状態で実行する機能が実験的に追加されています。詳細は
     *note フリースレッドの CPython: 46d. を参照してください。

   * PEP 744(6): 簡易的な *note JIT コンパイラ: 46e. が追加されました。
     現在、デフォルトでは無効になっています (が、今後有効になる可能性が
     あります)。これによるパフォーマンスの向上は軽度ですが、以降のリリー
     スで改善される見込みです。

   * 新しい *note 対話的インタープリタ: 46c. や *note トレースバック:
     473. 、 *note doctest: 475. の出力において色付き文字に対応しました
     。この機能は環境変数 *note PYTHON_COLORS: 476. または NO_COLOR(7) で
     無効化できます。

Python のデータモデルの改善点:

   * クラスのボディ内の関数で ‘self.X’ という形でアクセスされる属性がす
     べて *note __static_attributes__: 477. に格納されるようになりました
     。

   * クラス定義の最初の行の行番号が *note __firstlineno__: 478. に格納さ
     れるようになりました。

標準ライブラリーの顕著な改善点:

   * Python の *note 終了処理: 479. において処理がブロックされているとき
     に発生する新しい例外 *note PythonFinalizationError: 47a. が追加され
     ました。

   * *note argparse: 7. モジュールでコマンドラインオプションや位置引数、
     サブコマンドを非推奨として指定する機能が追加されました。

   * Z85 data(8) のエンコード・デコードを行う関数 *note
     base64.z85encode(): 47b. と *note base64.z85decode(): 47c. が追加さ
     れました。

   * 多くの組み込み型や *note __replace__(): 47d. メソッドを定義している
     任意のクラスに対して使用できる関数 *note copy.replace(): 1c0. が
     *note copy: 29. モジュールに追加されました。

   * *note dbm.sqlite3: 39. モジュールが追加され、 *note dbm: 35. のデフ
     ォルトのバックエンドがこれに変更されました。

   * Linux のタイマー通知機能をもつファイル記述子を扱うための *note
     様々な関数: 47e. が *note os: a5. モジュールに追加されました。

   * *note random: bd. モジュールが *note
     コマンドラインインターフェース: 47f. を持つようになりました。

セキュリティの改善点:

   * *note ssl.create_default_context(): 480. がデフォルトのフラグとして
     *note ssl.VERIFY_X509_PARTIAL_CHAIN: 481. と
     :data:‘ssl.VERIFY_X509_STRICT’ をセットするようになりました。

C API の改善点:

   * *note Py_mod_gil: 482. スロットは、拡張モジュールが *note GIL: 164.
     を無効化した状態での実行をサポート

   * *note PyTime C API: 483. が追加され、システムクロックへのアクセスが
     提供されるようになりました。

   * *note PyMutex: 484. は1バイトのみを占有する新しい軽量ミューテックス
     となりました。

   * 新しい *note 関数群: 485. が、C API において PEP 669(9) の監視イベ
     ントを生成するために追加されました。

新しい型ヒントの機能:

   * PEP 696(10): 型引数（*note typing.TypeVar: 486.、*note
     typing.ParamSpec: 487.、*note typing.TypeVarTuple: 488.）をデフォル
     トでサポートします。

   * PEP 702(11): 新たに追加された *note warnings.deprecated(): 489. デ
     コレータは、型システムおよび実行時における非推奨のマーク付けをサポ
     ートします。

   * PEP 705(12): *note typing.ReadOnly: 48a. は、型チェッカーに対して
     *note typing.TypedDict: 332. の項目を読み取り専用としてマークするた
     めに使用できます。

   * PEP 742(13): *note typing.TypeIs: 48b. は、*note typing.TypeGuard:
     48c. の代替として、より直感的な型の絞り込みの挙動を提供します。

プラットフォームのサポート:

   * PEP 730(14): Apple の iOS が tier 3(15) として *note
     公式にサポートされるプラットフォーム: 48d. となりました。

   * PEP 738(16) : Android が tier 3(17) として *note
     公式にサポートされるプラットフォーム: 48d. となりました。

   * ‘wasm32-wasi’ tier 2(18) プラットフォームとしてサポートされるように
     なりました。

   * ‘wasm32-emscripten’ が公式にサポートされるプラットフォームではなく
     なりました。

重要な削除

   * *note PEP 594: 471.: 残っていた 19 個の「不要なバッテリー」（旧式の
     標準ライブラリモジュール）が標準ライブラリから削除されました。削除
     されたモジュールは次のとおりです: ‘aifc’、‘audioop’、‘cgi’、
     ‘cgitb’、‘chunk’、‘crypt’、‘imghdr’、‘mailcap’、‘msilib’、‘nis’、
     ‘nntplib’、‘ossaudiodev’、‘pipes’、‘sndhdr’、‘spwd’、‘sunau’、
     ‘telnetlib’、‘uu’、‘xdrlib’。

   * ‘2to3’ ツールと ‘lib2to3’ モジュールが削除されました（ Python 3.11
     で非推奨となりました）

   * ‘tkinter.tix’ モジュールが削除されました（ Python 3.6 で非推奨でし
     た）

   * ‘locale.resetlocale()’ 機能が削除されました。

   * ‘typing.io’ と ‘typing.re’ 名前空間が削除されました。

   * 連鎖した *note classmethod: 48e. デスクリプタが削除されました。

リリーススケジュールの変更:

PEP 602(19) （「Python の年間リリースサイクル」）が更新され、新しいリリ
ースの完全サポート（バグ修正）期間が 2 年に延長されました。この更新され
たポリシーにより、次のような変更が適用されます:

   * Python 3.9-3.12 は1年半のフルサポート期間ののち、3年半のセキュリテ
     ィ修正期間となります。

   * Python 3.13 以降のバージョンでは2年間のフルサポート期間、その後3年
     間のセキュリティ修正期間となります。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0703/

   (2) https://peps.python.org/pep-0744/

   (3) https://peps.python.org/pep-0594/

   (4) https://peps.python.org/pep-0667/

   (5) https://peps.python.org/pep-0703/

   (6) https://peps.python.org/pep-0744/

   (7) https://no-color.org/

   (8) https://rfc.zeromq.org/spec/32/

   (9) https://peps.python.org/pep-0669/

   (10) https://peps.python.org/pep-0696/

   (11) https://peps.python.org/pep-0702/

   (12) https://peps.python.org/pep-0705/

   (13) https://peps.python.org/pep-0742/

   (14) https://peps.python.org/pep-0730/

   (15) https://peps.python.org/pep-0011/#tier-3

   (16) https://peps.python.org/pep-0738/

   (17) https://peps.python.org/pep-0011/#tier-3

   (18) https://peps.python.org/pep-0011/#tier-2

   (19) https://peps.python.org/pep-0602/


File: python.info,  Node: 新しい機能<2>,  Next: その他の言語変更,  Prev: 概要 -- リリースハイライト<2>,  Up: What's New In Python 3 13

1.2.2 新しい機能
----------------

* Menu:

* 改善された対話的インタープリタ::
* エラーメッセージの改善: エラーメッセージの改善<2>.
* フリースレッドの CPython::
* 実験的な Just-in-time (JIT) コンパイラ;: 実験的な Just-in-time JIT コンパイラ.
* Defined mutation semantics for locals(): Defined mutation semantics for locals.
* Support for mobile platforms::


File: python.info,  Node: 改善された対話的インタープリタ,  Next: エラーメッセージの改善<2>,  Up: 新しい機能<2>

1.2.2.1 改善された対話的インタープリタ
......................................

PyPy project(1) のコードをベースに作られた新しい Python *note
interactive: 1b5. シェルがデフォルトで使われるようになりました。これから
は、ターミナル上で *note REPL: 491. を起動すると、以下の機能が使えます:

   * 複数行の編集。履歴機能もサポート。

   * ‘help’ や ‘exit’ 、 ‘quit’ といったREPL 固有のコマンドが直接サポー
     トされるようになり、関数として呼び出す必要がなくなりました。

   * デフォルトでプロンプトやトレースバックが *note 色付きで表示: 1b7. さ
     れるようになりました。

   * インタラクティブなヘルプが ‘F1’ で閲覧できるようになり、REPLとは別
     にコマンド履歴が記録されるようになりました。

   * ‘F2’ で履歴を閲覧できるようになりました。出力や プロンプト内の
     *note >>>: 492. と *note ...: 493. は表示されません。

   * ‘F3’ で「ペーストモード」に切り替え、長いコードブロックをより簡単に
     貼り付けることができるようになりました (‘F3’ をもう一度押すことで通
     常のプロンプトに戻ることができます)。

新しいインタラクティブシェルを無効化するには、環境変数 *note
PYTHON_BASIC_REPL: 1b6. をセットします。インタラクティブモードの詳細につ
いては *note 対話モード: 494. を参照してください。

（gh-111201(2) の Pablo Galindo Salgado, Łukasz Langa, and Lysandros
Nikolaou らの PyPy プロジェクトのコードに基づく貢献。 Windows へのサポー
トは Dino Viehland, Anthony Shaw らによる貢献。）

   ---------- Footnotes ----------

   (1) https://pypy.org/

   (2) https://github.com/python/cpython/issues/111201


File: python.info,  Node: エラーメッセージの改善<2>,  Next: フリースレッドの CPython,  Prev: 改善された対話的インタープリタ,  Up: 新しい機能<2>

1.2.2.2 エラーメッセージの改善
..............................

   * インタープリタは、端末にトレースバックを表示する際に デフォルトでカ
     ラー表示を使用するようになりました。この機能は、新たに導入された
     *note PYTHON_COLORS: 476. 環境変数、および標準の NO_COLOR(1) と
     FORCE_COLOR(2) 環境変数を通じて *note 制御できます: 1b7.。（この機
     能は Pablo Galindo Salgado により、gh-112730(3) にて貢献されました
     。）

   * よくある間違いとして、標準ライブラリのモジュールと同じ名前のスクリ
     プトを作成してしまうことがあります。その結果エラーが発生した場合、
     Python はこれまでよりわかりやすいエラーメッセージを表示するようにな
     りました:

          $ python random.py
          Traceback (most recent call last):
            File "/home/me/random.py", line 1, in <module>
              import random
            File "/home/me/random.py", line 3, in <module>
              print(random.randint(5))
                    ^^^^^^^^^^^^^^
          AttributeError: module 'random' has no attribute 'randint' (consider renaming '/home/me/random.py' since it has the same name as the standard library module named 'random' and prevents importing that standard library module)

     同様に、スクリプトがインポートしようとするサードパーティ製モジュー
     ルと同じ名前を持ち、それによってエラーが発生した場合にも、Python は
     よりわかりやすいエラーメッセージを表示するようになりました:

          $ python numpy.py
          Traceback (most recent call last):
            File "/home/me/numpy.py", line 1, in <module>
              import numpy as np
            File "/home/me/numpy.py", line 3, in <module>
              np.array([1, 2, 3])
              ^^^^^^^^
          AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/home/me/numpy.py' if it has the same name as a library you intended to import)

     (Shantanu Jain による gh-95754(4) での貢献)

   * エラーメッセージは、関数に誤ったキーワード引数が渡された場合に、正
     しいキーワード引数を提案するようになりました:

          >>> "Better error messages!".split(max_split=1)
          Traceback (most recent call last):
            File "<python-input-0>", line 1, in <module>
              "Better error messages!".split(max_split=1)
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
          TypeError: split() got an unexpected keyword argument 'max_split'. Did you mean 'maxsplit'?

     (Pablo Galindo Salgado と Shantanu Jain による gh-107944(5) での貢
     献)

   ---------- Footnotes ----------

   (1) https://no-color.org/

   (2) https://force-color.org/

   (3) https://github.com/python/cpython/issues/112730

   (4) https://github.com/python/cpython/issues/95754

   (5) https://github.com/python/cpython/issues/107944


File: python.info,  Node: フリースレッドの CPython,  Next: 実験的な Just-in-time JIT コンパイラ,  Prev: エラーメッセージの改善<2>,  Up: 新しい機能<2>

1.2.2.3 フリースレッドの CPython
................................

*note global interpreter lock: 474. (GIL) を無効化するフリースレッドモー
ドで CPython を実行する機能が実験的に追加されました。これは実験的機能の
ため、デフォルトで有効にはなっていません。フリースレッドモードで実行する
には別の実行ファイルが必要で、通常 ‘python3.13t’ か ‘python3.13t.exe’ と
いう名前です。入手するには、公式の *note Windows: 497. 版・ *note macOS:
498. 版インストーラで 'フリースレッド' とラベルのついたビルド済みバイナ
リをインストールするか、もしくは CPython のソースコードを *note
-disable-gil: 499. オプション付きでビルドすることもできます。

フリースレッドで実行することで、CPU コアの上で並列にスレッドを実行できる
ため、使用可能な処理性能をフルに活かすことができます。フリースレッドモー
ドを使うだけでどのようなソフトウェアも恩恵を受けられるわけではないものの
、スレッドを活用するように設計されたプログラムであれば、マルチコアのハー
ドウェアでより高速に実行できることになります。ただし、 'フリースレッドモ
ードは実験的機能' であり、改善が行われている最中です。バグに遭遇したり、
シングルスレッドのパフォーマンスが大きく悪化する可能性があるので、注意し
てください。CPython のフリースレッド版ビルドでも、GIL を有効にした実行に
対応しており、環境変数 *note PYTHON_GIL: 49a. かコマンドラインオプション
*note -X gil=1: 16f. によって有効化できます。

使用しているインタープリタがフリースレッドに対応しているかどうかは、
*note python -VV: 49b. を実行するか、 *note sys.version: 49c. に 「
experimental free-threading build」が含まれているかどうかで確認できます
。新しく追加された ‘sys._is_gil_enabled()’ 関数により、 GIL が現在のプロ
セスで実際に有効になっているかを確認できます。

C-API 拡張モジュールは、フリースレッド用に別にビルドする必要があります。
*note GIL: 164. 無効状態での実行に対応している拡張モジュールは、 *note
Py_mod_gil: 482. を使用してください。一段階初期化を使用する C 拡張は
*note PyUnstable_Module_SetGIL(): 49d. を使用することで、 GIL 無効状態で
の実行に対応しているかどうかを指定してください。このような仕組みをいずれ
も使用しないモジュールがインポートされると、環境変数 *note PYTHON_GIL:
49a. か *note -X gil=0: 16f. オプションが指定されていない限り、GIL が有
効化されます。フリースレッド版の Python で C 拡張を含むパッケージをイン
ストールするには、pip のバージョン が 24.1 以上である必要があります。

この機能が実現に至ったのは、たくさんの個人開発者の方や組織のおかげです。
Python やサードパーティのプロジェクトに貢献する開発者の巨大なコミュニテ
ィが、フリースレッドへの対応やテストを行ってくださいました。特に大きな貢
献のあった方は以下です: Sam Gross、Ken Jin、Donghee Na、Itamar Oren、
Matt Page、Brett Simmers、Dino Viehland、Carl Meyer、Nathan Goldbaum、
Ralf Gommers、Lysandros Nikolaou、ほか多数。このうちの多くが Meta の従業
員であり、Meta はこのプロジェクトに多大な技術的な支援をしてくださいまし
た。

参考
....

PEP 703(1) "Making the Global Interpreter Lock Optional in CPython"
contains rationale and information surrounding this work.

Porting Extension Modules to Support Free-Threading(2): A
community-maintained porting guide for extension authors.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0703/

   (2) https://py-free-threading.github.io/porting/


File: python.info,  Node: 実験的な Just-in-time JIT コンパイラ,  Next: Defined mutation semantics for locals,  Prev: フリースレッドの CPython,  Up: 新しい機能<2>

1.2.2.4 実験的な Just-in-time (JIT) コンパイラ:
...............................................

CPython を ‘--enable-experimental-jit’ オプション付きで ‘configure’ して
からビルドすると、just-in-time (JIT) コンパイラが追加され、Python プログ
ラムの実行が速くなる可能性があります。Windows では ‘PCbuild/build.bat
--experimental-jit’ で JIT を有効化するか、
‘--experimental-jit-interpreter’ でティア2インタープリタを有効化してくだ
さい。ビルドの必要事項やその他の補足情報は ‘Tools/jit/README.md’ に掲載
されています(1) 。

The ‘--enable-experimental-jit’ option takes these (optional) values,
defaulting to ‘yes’ if ‘--enable-experimental-jit’ is present without
the optional value.

   * ‘no’: Disable the entire Tier 2 and JIT pipeline.

   * ‘yes’: Enable the JIT. To disable the JIT at runtime, pass the
     environment variable ‘PYTHON_JIT=0’.

   * ‘yes-off’: Build the JIT but disable it by default.  To enable the
     JIT at runtime, pass the environment variable ‘PYTHON_JIT=1’.

   * ‘interpreter’: Enable the Tier 2 interpreter but disable the JIT.
     The interpreter can be disabled by running with ‘PYTHON_JIT=0’.

The internal architecture is roughly as follows:

   * We start with specialized 'Tier 1 bytecode'.  See *note What's new
     in 3.11: 49f. for details.

   * When the Tier 1 bytecode gets hot enough, it gets translated to a
     new purely internal intermediate representation (IR), called the
     'Tier 2 IR', and sometimes referred to as micro-ops ("uops").

   * The Tier 2 IR uses the same stack-based virtual machine as Tier 1,
     but the instruction format is better suited to translation to
     machine code.

   * We have several optimization passes for Tier 2 IR, which are
     applied before it is interpreted or translated to machine code.

   * There is a Tier 2 interpreter, but it is mostly intended for
     debugging the earlier stages of the optimization pipeline.  The
     Tier 2 interpreter can be enabled by configuring Python with
     ‘--enable-experimental-jit=interpreter’.

   * When the JIT is enabled, the optimized Tier 2 IR is translated to
     machine code, which is then executed.

   * The machine code translation process uses a technique called
     'copy-and-patch'.  It has no runtime dependencies, but there is a
     new build-time dependency on LLVM.

参考
....

PEP 744(2)

(JIT by Brandt Bucher, inspired by a paper by Haoran Xu and Fredrik
Kjolstad.  Tier 2 IR by Mark Shannon and Guido van Rossum.  Tier 2
optimizer by Ken Jin.)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/blob/main/Tools/jit/README.md

   (2) https://peps.python.org/pep-0744/


File: python.info,  Node: Defined mutation semantics for locals,  Next: Support for mobile platforms,  Prev: 実験的な Just-in-time JIT コンパイラ,  Up: 新しい機能<2>

1.2.2.5 Defined mutation semantics for ‘locals()’
.................................................

Historically, the expected result of mutating the return value of *note
locals(): 46f. has been left to individual Python implementations to
define.  Starting from Python 3.13, PEP 667(1) standardises the
historical behavior of CPython for most code execution scopes, but
changes *note optimized scopes: 4a1. (functions, generators, coroutines,
comprehensions, and generator expressions) to explicitly return
independent snapshots of the currently assigned local variables,
including locally referenced nonlocal variables captured in closures.

This change to the semantics of *note locals(): 46f. in optimized scopes
also affects the default behavior of code execution functions that
implicitly target ‘locals()’ if no explicit namespace is provided (such
as *note exec(): 4a2. and *note eval(): 4a3.).  In previous versions,
whether or not changes could be accessed by calling ‘locals()’ after
calling the code execution function was implementation-dependent.  In
CPython specifically, such code would typically appear to work as
desired, but could sometimes fail in optimized scopes based on other
code (including debuggers and code execution tracing tools) potentially
resetting the shared snapshot in that scope.  Now, the code will always
run against an independent snapshot of the local variables in optimized
scopes, and hence the changes will never be visible in subsequent calls
to ‘locals()’.  To access the changes made in these cases, an explicit
namespace reference must now be passed to the relevant function.
Alternatively, it may make sense to update affected code to use a higher
level code execution API that returns the resulting code execution
namespace (e.g.  *note runpy.run_path(): 4a4. when executing Python
files from disk).

To ensure debuggers and similar tools can reliably update local
variables in scopes affected by this change, *note FrameType.f_locals:
4a5. now returns a write-through proxy to the frame's local and locally
referenced nonlocal variables in these scopes, rather than returning an
inconsistently updated shared ‘dict’ instance with undefined runtime
semantics.

See PEP 667(2) for more details, including related C API changes and
deprecations.  Porting notes are also provided below for the affected
*note Python APIs: 4a6. and *note C APIs: 4a7.

(PEP and implementation contributed by Mark Shannon and Tian Gao in
gh-74929(3).  Documentation updates provided by Guido van Rossum and
Alyssa Coghlan.)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0667/

   (2) https://peps.python.org/pep-0667/

   (3) https://github.com/python/cpython/issues/74929


File: python.info,  Node: Support for mobile platforms,  Prev: Defined mutation semantics for locals,  Up: 新しい機能<2>

1.2.2.6 Support for mobile platforms
....................................

PEP 730(1): iOS is now a PEP 11(2) supported platform, with the
‘arm64-apple-ios’ and ‘arm64-apple-ios-simulator’ targets at tier 3
(iPhone and iPad devices released after 2013 and the Xcode iOS simulator
running on Apple silicon hardware, respectively).
‘x86_64-apple-ios-simulator’ (the Xcode iOS simulator running on older
‘x86_64’ hardware) is not a tier 3 supported platform, but will have
best-effort support.  (PEP written and implementation contributed by
Russell Keith-Magee in gh-114099(3).)

PEP 738(4): Android is now a PEP 11(5) supported platform, with the
‘aarch64-linux-android’ and ‘x86_64-linux-android’ targets at tier 3.
The 32-bit targets ‘arm-linux-androideabi’ and ‘i686-linux-android’ are
not tier 3 supported platforms, but will have best-effort support.  (PEP
written and implementation contributed by Malcolm Smith in
gh-116622(6).)

参考
....

PEP 730(7), PEP 738(8)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0730/

   (2) https://peps.python.org/pep-0011/

   (3) https://github.com/python/cpython/issues/114099

   (4) https://peps.python.org/pep-0738/

   (5) https://peps.python.org/pep-0011/

   (6) https://github.com/python/cpython/issues/116622

   (7) https://peps.python.org/pep-0730/

   (8) https://peps.python.org/pep-0738/


File: python.info,  Node: その他の言語変更,  Next: 新たなモジュール,  Prev: 新しい機能<2>,  Up: What's New In Python 3 13

1.2.3 その他の言語変更
----------------------

   * The compiler now strips common leading whitespace from every line
     in a docstring.  This reduces the size of the *note bytecode cache:
     4aa. (such as ‘.pyc’ files), with reductions in file size of around
     5%, for example in ‘sqlalchemy.orm.session’ from SQLAlchemy 2.0.
     This change affects tools that use docstrings, such as *note
     doctest: 3e.

          >>> def spam():
          ...     """
          ...         This is a docstring with
          ...           leading whitespace.
          ...
          ...         It even has multiple paragraphs!
          ...     """
          ...
          >>> spam.__doc__
          '\nThis is a docstring with\n  leading whitespace.\n\nIt even has multiple paragraphs!\n'

     (Contributed by Inada Naoki in gh-81283(1).)

   * *note Annotation scopes: 4ab. within class scopes can now contain
     lambdas and comprehensions.  Comprehensions that are located within
     class scopes are not inlined into their parent scope.

          class C[T]:
              type Alias = lambda: T

     (Contributed by Jelle Zijlstra in gh-109118(2) and gh-118160(3).)

   * *note Future statements: 45d. are no longer triggered by relative
     imports of the *note __future__: 0. module, meaning that statements
     of the form ‘from .__future__ import ...’ are now simply standard
     relative imports, with no special features activated.  (Contributed
     by Jeremiah Gabriel Pascual in gh-118216(4).)

   * *note global: 4ac. declarations are now permitted in *note except:
     1ab. blocks when that global is used in the *note else: 17c. block.
     Previously this raised an erroneous *note SyntaxError: 18e.
     (Contributed by Irit Katriel in gh-111123(5).)

   * Add *note PYTHON_FROZEN_MODULES: 4ad, a new environment variable
     that determines whether frozen modules are ignored by the import
     machinery, equivalent to the *note -X frozen_modules: 16f.
     command-line option.  (Contributed by Yilei Yang in gh-111374(6).)

   * Add *note support for the perf profiler: 4ae. working without frame
     pointers(7) through the new environment variable *note
     PYTHON_PERF_JIT_SUPPORT: 4af. and command-line option *note -X
     perf_jit: 16f.  (Contributed by Pablo Galindo in gh-118518(8).)

   * The location of a ‘.python_history’ file can be changed via the new
     *note PYTHON_HISTORY: 4b0. environment variable.  (Contributed by
     Levi Sabah, Zackery Spytz and Hugo van Kemenade in gh-73965(9).)

   * Classes have a new *note __static_attributes__: 477. attribute.
     This is populated by the compiler with a tuple of the class's
     attribute names which are assigned through ‘self.<name>’ from any
     function in its body.  (Contributed by Irit Katriel in
     gh-115775(10).)

   * The compiler now creates a ‘__firstlineno__’ attribute on classes
     with the line number of the first line of the class definition.
     (Contributed by Serhiy Storchaka in gh-118465(11).)

   * The *note exec(): 4a2. and *note eval(): 4a3. builtins now accept
     the 'globals' and 'locals' arguments as keywords.  (Contributed by
     Raphael Gaschignard in gh-105879(12))

   * The *note compile(): 4b1. builtin now accepts a new flag,
     ‘ast.PyCF_OPTIMIZED_AST’, which is similar to ‘ast.PyCF_ONLY_AST’
     except that the returned AST is optimized according to the value of
     the 'optimize' argument.  (Contributed by Irit Katriel in
     gh-108113(13)).

   * Add a *note __name__: 4b2. attribute on *note property: 4b3.
     objects.  (Contributed by Eugene Toder in gh-101860(14).)

   * Add *note PythonFinalizationError: 47a, a new exception derived
     from *note RuntimeError: 244. and used to signal when operations
     are blocked during *note finalization: 479.  The following
     callables now raise ‘PythonFinalizationError’, instead of *note
     RuntimeError: 244.:

        * *note _thread.start_new_thread(): 4b4.

        * *note os.fork(): 4b5.

        * *note os.forkpty(): 4b6.

        * *note subprocess.Popen: 4b7.

     (Contributed by Victor Stinner in gh-114570(15).)

   * Allow the 'count' argument of *note str.replace(): 4b8. to be a
     keyword.  (Contributed by Hugo van Kemenade in gh-106487(16).)

   * Many functions now emit a warning if a boolean value is passed as a
     file descriptor argument.  This can help catch some errors earlier.
     (Contributed by Serhiy Storchaka in gh-82626(17).)

   * Added ‘name’ and ‘mode’ attributes for compressed and archived
     file-like objects in the *note bz2: 14, *note lzma: 8e, *note
     tarfile: e4, and *note zipfile: 137. modules.  (Contributed by
     Serhiy Storchaka in gh-115961(18).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/81283

   (2) https://github.com/python/cpython/issues/109118

   (3) https://github.com/python/cpython/issues/118160

   (4) https://github.com/python/cpython/issues/118216

   (5) https://github.com/python/cpython/issues/111123

   (6) https://github.com/python/cpython/issues/111374

   (7) https://en.wikipedia.org/wiki/Call_stack

   (8) https://github.com/python/cpython/issues/118518

   (9) https://github.com/python/cpython/issues/73965

   (10) https://github.com/python/cpython/issues/115775

   (11) https://github.com/python/cpython/issues/118465

   (12) https://github.com/python/cpython/issues/105879

   (13) https://github.com/python/cpython/issues/108113

   (14) https://github.com/python/cpython/issues/101860

   (15) https://github.com/python/cpython/issues/114570

   (16) https://github.com/python/cpython/issues/106487

   (17) https://github.com/python/cpython/issues/82626

   (18) https://github.com/python/cpython/issues/115961


File: python.info,  Node: 新たなモジュール,  Next: 改良されたモジュール,  Prev: その他の言語変更,  Up: What's New In Python 3 13

1.2.4 新たなモジュール
----------------------

   * *note dbm.sqlite3: 39.: An SQLite backend for *note dbm: 35.
     (Contributed by Raymond Hettinger and Erlend E. Aasland in
     gh-100414(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100414


File: python.info,  Node: 改良されたモジュール,  Next: 最適化<2>,  Prev: 新たなモジュール,  Up: What's New In Python 3 13

1.2.5 改良されたモジュール
--------------------------

* Menu:

* argparse: argparse<3>.
* 配列::
* ast: ast<3>.
* asyncio: asyncio<4>.
* base64: base64<2>.
* compileall::
* concurrent.futures: concurrent futures<2>.
* configparser: configparser<2>.
* copy::
* ctypes: ctypes<2>.
* dbm::
* dis: dis<2>.
* doctest::
* email: email<2>.
* enum::
* fractions: fractions<2>.
* glob::
* importlib::
* io: io<3>.
* ipaddress::
* itertools: itertools<2>.
* marshal::
* math: math<2>.
* mimetypes: mimetypes<2>.
* mmap::
* multiprocessing: multiprocessing<2>.
* os: os<2>.
* os.path: os path<2>.
* pathlib: pathlib<4>.
* pdb: pdb<3>.
* queue::
* random::
* re: re<2>.
* shutil::
* site::
* sqlite3: sqlite3<2>.
* ssl: ssl<2>.
* statistics::
* subprocess::
* sys: sys<2>.
* tempfile::
* time::
* tkinter: tkinter<2>.
* traceback::
* types: types<2>.
* typing: typing<2>.
* unicodedata: unicodedata<2>.
* venv::
* warnings::
* xml::
* zipimport::


File: python.info,  Node: argparse<3>,  Next: 配列,  Up: 改良されたモジュール

1.2.5.1 argparse
................

   * Add the 'deprecated' parameter to the *note add_argument(): 4bc.
     and ‘add_parser()’ methods, to enable deprecating command-line
     options, positional arguments, and subcommands.  (Contributed by
     Serhiy Storchaka in gh-83648(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/83648


File: python.info,  Node: 配列,  Next: ast<3>,  Prev: argparse<3>,  Up: 改良されたモジュール

1.2.5.2 配列
............

   * Add the ‘'w'’ type code (‘Py_UCS4’) for Unicode characters.  It
     should be used instead of the deprecated ‘'u'’ type code.
     (Contributed by Inada Naoki in gh-80480(1).)

   * Register *note array.array: 4be. as a *note MutableSequence: 4bf.
     by implementing the *note clear(): 4c0. method.  (Contributed by
     Mike Zimin in gh-114894(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/80480

   (2) https://github.com/python/cpython/issues/114894


File: python.info,  Node: ast<3>,  Next: asyncio<4>,  Prev: 配列,  Up: 改良されたモジュール

1.2.5.3 ast
...........

   * The constructors of node types in the *note ast: 9. module are now
     stricter in the arguments they accept, with more intuitive behavior
     when arguments are omitted.

     If an optional field on an AST node is not included as an argument
     when constructing an instance, the field will now be set to ‘None’.
     Similarly, if a list field is omitted, that field will now be set
     to an empty list, and if an ‘expr_context’ field is omitted, it
     defaults to *note Load(): 4c2.  (Previously, in all cases, the
     attribute would be missing on the newly constructed AST node
     instance.)

     In all other cases, where a required argument is omitted, the node
     constructor will emit a *note DeprecationWarning: 1a3.  This will
     raise an exception in Python 3.15.  Similarly, passing a keyword
     argument to the constructor that does not map to a field on the AST
     node is now deprecated, and will raise an exception in Python 3.15.

     These changes do not apply to user-defined subclasses of *note
     ast.AST: 4c3. unless the class opts in to the new behavior by
     defining the *note AST._field_types: 4c4. mapping.

     (Contributed by Jelle Zijlstra in gh-105858(1), gh-117486(2), and
     gh-118851(3).)

   * *note ast.parse(): 1c2. now accepts an optional argument 'optimize'
     which is passed on to *note compile(): 4b1.  This makes it possible
     to obtain an optimized AST. (Contributed by Irit Katriel in
     gh-108113(4).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/105858

   (2) https://github.com/python/cpython/issues/117486

   (3) https://github.com/python/cpython/issues/118851

   (4) https://github.com/python/cpython/issues/108113


File: python.info,  Node: asyncio<4>,  Next: base64<2>,  Prev: ast<3>,  Up: 改良されたモジュール

1.2.5.4 asyncio
...............

   * *note asyncio.as_completed(): 4c6. now returns an object that is
     both an *note asynchronous iterator: 4c7. and a plain *note
     iterator: 4c8. of *note awaitables: 4c9.  The awaitables yielded by
     asynchronous iteration include original task or future objects that
     were passed in, making it easier to associate results with the
     tasks being completed.  (Contributed by Justin Arthur in
     gh-77714(1).)

   * *note asyncio.loop.create_unix_server(): 4ca. will now
     automatically remove the Unix socket when the server is closed.
     (Contributed by Pierre Ossman in gh-111246(2).)

   * *note DatagramTransport.sendto(): 4cb. will now send zero-length
     datagrams if called with an empty bytes object.  The transport flow
     control also now accounts for the datagram header when calculating
     the buffer size.  (Contributed by Jamie Phan in gh-115199(3).)

   * Add *note Queue.shutdown: 4cc. and *note QueueShutDown: 4cd. to
     manage queue termination.  (Contributed by Laurie Opperman and Yves
     Duprat in gh-104228(4).)

   * Add the *note Server.close_clients(): 4ce. and *note
     Server.abort_clients(): 4cf. methods, which more forcefully close
     an asyncio server.  (Contributed by Pierre Ossman in gh-113538(5).)

   * Accept a tuple of separators in *note StreamReader.readuntil():
     4d0, stopping when any one of them is encountered.  (Contributed by
     Bruce Merry in gh-81322(6).)

   * Improve the behavior of *note TaskGroup: 4d1. when an external
     cancellation collides with an internal cancellation.  For example,
     when two task groups are nested and both experience an exception in
     a child task simultaneously, it was possible that the outer task
     group would hang, because its internal cancellation was swallowed
     by the inner task group.

     In the case where a task group is cancelled externally and also
     must raise an *note ExceptionGroup: 4d2, it will now call the
     parent task's *note cancel(): 4d3. method.  This ensures that a
     *note CancelledError: 4d4. will be raised at the next *note await:
     18d, so the cancellation is not lost.

     An added benefit of these changes is that task groups now preserve
     the cancellation count (*note cancelling(): 4d5.).

     In order to handle some corner cases, *note uncancel(): 4d6. may
     now reset the undocumented ‘_must_cancel’ flag when the
     cancellation count reaches zero.

     (Inspired by an issue reported by Arthur Tacca in gh-116720(7).)

   * When *note TaskGroup.create_task(): 1cb. is called on an inactive
     *note TaskGroup: 4d1, the given coroutine will be closed (which
     prevents a *note RuntimeWarning: 4d7. about the given coroutine
     being never awaited).  (Contributed by Arthur Tacca and Jason Zhang
     in gh-115957(8).)

   * The function and methods named ‘create_task’ have received a new
     ‘**kwargs’ argument that is passed through to the task constructor.
     This change was accidentally added in 3.13.3, and broke the API
     contract for custom task factories.  Several third-party task
     factories implemented workarounds for this.  In 3.13.4 and later
     releases the old factory contract is honored once again (until
     3.14).  To keep the workarounds working, the extra ‘**kwargs’
     argument still allows passing additional keyword arguments to *note
     Task: 1c7. and to custom task factories.

     This affects the following function and methods: *note
     asyncio.create_task(): 1c9, *note asyncio.loop.create_task(): 1ca,
     *note asyncio.TaskGroup.create_task(): 1cb.  (Contributed by Thomas
     Grainger in gh-128307(9).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/77714

   (2) https://github.com/python/cpython/issues/111246

   (3) https://github.com/python/cpython/issues/115199

   (4) https://github.com/python/cpython/issues/104228

   (5) https://github.com/python/cpython/issues/113538

   (6) https://github.com/python/cpython/issues/81322

   (7) https://github.com/python/cpython/issues/116720

   (8) https://github.com/python/cpython/issues/115957

   (9) https://github.com/python/cpython/issues/128307


File: python.info,  Node: base64<2>,  Next: compileall,  Prev: asyncio<4>,  Up: 改良されたモジュール

1.2.5.5 base64
..............

   * Add *note z85encode(): 47b. and *note z85decode(): 47c. functions
     for encoding *note bytes: 192. as Z85 data(1) and decoding
     Z85-encoded data to ‘bytes’.  (Contributed by Matan Perelman in
     gh-75299(2).)

   ---------- Footnotes ----------

   (1) https://rfc.zeromq.org/spec/32/

   (2) https://github.com/python/cpython/issues/75299


File: python.info,  Node: compileall,  Next: concurrent futures<2>,  Prev: base64<2>,  Up: 改良されたモジュール

1.2.5.6 compileall
..................

   * The default number of worker threads and processes is now selected
     using *note os.process_cpu_count(): 4da. instead of *note
     os.cpu_count(): 4db.  (Contributed by Victor Stinner in
     gh-109649(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/109649


File: python.info,  Node: concurrent futures<2>,  Next: configparser<2>,  Prev: compileall,  Up: 改良されたモジュール

1.2.5.7 concurrent.futures
..........................

   * The default number of worker threads and processes is now selected
     using *note os.process_cpu_count(): 4da. instead of *note
     os.cpu_count(): 4db.  (Contributed by Victor Stinner in
     gh-109649(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/109649


File: python.info,  Node: configparser<2>,  Next: copy,  Prev: concurrent futures<2>,  Up: 改良されたモジュール

1.2.5.8 configparser
....................

   * *note ConfigParser: 4de. now has support for unnamed sections,
     which allows for top-level key-value pairs.  This can be enabled
     with the new 'allow_unnamed_section' parameter.  (Contributed by
     Pedro Sousa Lacerda in gh-66449(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/66449


File: python.info,  Node: copy,  Next: ctypes<2>,  Prev: configparser<2>,  Up: 改良されたモジュール

1.2.5.9 copy
............

   * The new *note replace(): 1c0. function and the *note replace
     protocol: 47d. make creating modified copies of objects much
     simpler.  This is especially useful when working with immutable
     objects.  The following types support the *note replace(): 1c0.
     function and implement the replace protocol:

        * *note collections.namedtuple(): 4e0.

        * *note dataclasses.dataclass: 4e1.

        * *note datetime.datetime: 4e2, *note datetime.date: 1fa, *note
          datetime.time: 1fb.

        * *note inspect.Signature: 4e3, *note inspect.Parameter: 4e4.

        * *note types.SimpleNamespace: 4e5.

        * *note code objects: 4e6.

     Any user-defined class can also support *note copy.replace(): 1c0.
     by defining the *note __replace__(): 47d. method.  (Contributed by
     Serhiy Storchaka in gh-108751(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/108751


File: python.info,  Node: ctypes<2>,  Next: dbm,  Prev: copy,  Up: 改良されたモジュール

1.2.5.10 ctypes
...............

   * As a consequence of necessary internal refactoring, initialization
     of internal metaclasses now happens in ‘__init__’ rather than in
     ‘__new__’.  This affects projects that subclass these internal
     metaclasses to provide custom initialization.  Generally:

        - Custom logic that was done in ‘__new__’ after calling
          ‘super().__new__’ should be moved to ‘__init__’.

        - To create a class, call the metaclass, not only the
          metaclass's ‘__new__’ method.

     See gh-124520(1) for discussion and links to changes in some
     affected projects.

   * *note ctypes.Structure: 1e5. objects have a new *note _align_: 4e8.
     attribute which allows the alignment of the structure being packed
     to/from memory to be specified explicitly.  (Contributed by Matt
     Sanderson in gh-112433(2))

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/124520

   (2) https://github.com/python/cpython/issues/112433


File: python.info,  Node: dbm,  Next: dis<2>,  Prev: ctypes<2>,  Up: 改良されたモジュール

1.2.5.11 dbm
............

   * Add *note dbm.sqlite3: 39, a new module which implements an SQLite
     backend, and make it the default ‘dbm’ backend.  (Contributed by
     Raymond Hettinger and Erlend E. Aasland in gh-100414(1).)

   * Allow removing all items from the database through the new
     ‘clear()’ methods of the GDBM and NDBM database objects.
     (Contributed by Donghee Na in gh-107122(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100414

   (2) https://github.com/python/cpython/issues/107122


File: python.info,  Node: dis<2>,  Next: doctest,  Prev: dbm,  Up: 改良されたモジュール

1.2.5.12 dis
............

   * Change the output of *note dis: 3c. module functions to show
     logical labels for jump targets and exception handlers, rather than
     offsets.  The offsets can be added with the new *note -O: 4eb.
     command-line option or the 'show_offsets' argument.  (Contributed
     by Irit Katriel in gh-112137(1).)

   * *note get_instructions(): 4ec. no longer represents cache entries
     as separate instructions.  Instead, it returns them as part of the
     *note Instruction: 203, in the new 'cache_info' field.  The
     'show_caches' argument to *note get_instructions(): 4ec. is
     deprecated and no longer has any effect.  (Contributed by Irit
     Katriel in gh-112962(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/112137

   (2) https://github.com/python/cpython/issues/112962


File: python.info,  Node: doctest,  Next: email<2>,  Prev: dis<2>,  Up: 改良されたモジュール

1.2.5.13 doctest
................

   * *note doctest: 3e. output is now colored by default.  This can be
     controlled via the new *note PYTHON_COLORS: 476. environment
     variable as well as the canonical NO_COLOR(1) and FORCE_COLOR(2)
     environment variables.  See also *note 色の制御: 1b7.  (Contributed
     by Hugo van Kemenade in gh-117225(3).)

   * The *note DocTestRunner.run(): 4ee. method now counts the number of
     skipped tests.  Add the *note DocTestRunner.skips: 4ef. and *note
     TestResults.skipped: 4f0. attributes.  (Contributed by Victor
     Stinner in gh-108794(4).)

   ---------- Footnotes ----------

   (1) https://no-color.org/

   (2) https://force-color.org/

   (3) https://github.com/python/cpython/issues/117225

   (4) https://github.com/python/cpython/issues/108794


File: python.info,  Node: email<2>,  Next: enum,  Prev: doctest,  Up: 改良されたモジュール

1.2.5.14 email
..............

   * Headers with embedded newlines are now quoted on output.  The *note
     generator: 44. will now refuse to serialize (write) headers that
     are improperly folded or delimited, such that they would be parsed
     as multiple headers or joined with adjacent data.  If you need to
     turn this safety feature off, set *note verify_generated_headers:
     4f2.  (Contributed by Bas Bloemsaat and Petr Viktorin in
     gh-121650(1).)

   * *note getaddresses(): 4f3. and *note parseaddr(): 4f4. now return
     ‘('', '')’ pairs in more situations where invalid email addresses
     are encountered instead of potentially inaccurate values.  The two
     functions have a new optional 'strict' parameter (default ‘True’).
     To get the old behavior (accepting malformed input), use
     ‘strict=False’.  ‘getattr(email.utils, 'supports_strict_parsing',
     False)’ can be used to check if the 'strict' parameter is
     available.  (Contributed by Thomas Dwyer and Victor Stinner for
     gh-102988(2) to improve the CVE 2023-27043(3) fix.)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/121650

   (2) https://github.com/python/cpython/issues/102988

   (3) https://www.cve.org/CVERecord?id=CVE-2023-27043


File: python.info,  Node: enum,  Next: fractions<2>,  Prev: email<2>,  Up: 改良されたモジュール

1.2.5.15 enum
.............

   * *note EnumDict: 4f6. has been made public to better support
     subclassing *note EnumType: 4f7.


File: python.info,  Node: fractions<2>,  Next: glob,  Prev: enum,  Up: 改良されたモジュール

1.2.5.16 fractions
..................

   * *note Fraction: 213. objects now support the standard *note format
     specification mini-language: 4f9. rules for fill, alignment, sign
     handling, minimum width, and grouping.  (Contributed by Mark
     Dickinson in gh-111320(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/111320


File: python.info,  Node: glob,  Next: importlib,  Prev: fractions<2>,  Up: 改良されたモジュール

1.2.5.17 glob
.............

   * Add *note translate(): 4fb, a function to convert a path
     specification with shell-style wildcards to a regular expression.
     (Contributed by Barney Gale in gh-72904(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/72904


File: python.info,  Node: importlib,  Next: io<3>,  Prev: glob,  Up: 改良されたモジュール

1.2.5.18 importlib
..................

   * The following functions in *note importlib.resources: 7f. now allow
     accessing a directory (or tree) of resources, using multiple
     positional arguments (the 'encoding' and 'errors' arguments in the
     text-reading functions are now keyword-only):

        * *note is_resource(): 4fd.

        * *note open_binary(): 4fe.

        * *note open_text(): 4ff.

        * *note path(): 500.

        * *note read_binary(): 501.

        * *note read_text(): 502.

     These functions are no longer deprecated and are not scheduled for
     removal.  (Contributed by Petr Viktorin in gh-116608(1).)

   * *note contents(): 503. remains deprecated in favor of the
     fully-featured *note Traversable: 2fa. API. However, there is now
     no plan to remove it.  (Contributed by Petr Viktorin in
     gh-116608(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116608

   (2) https://github.com/python/cpython/issues/116608


File: python.info,  Node: io<3>,  Next: ipaddress,  Prev: importlib,  Up: 改良されたモジュール

1.2.5.19 io
...........

   * The *note IOBase: 505. finalizer now logs any errors raised by the
     *note close(): 506. method with *note sys.unraisablehook: 507.
     Previously, errors were ignored silently by default, and only
     logged in *note Python Development Mode: 508. or when using a *note
     Python debug build: 509.  (Contributed by Victor Stinner in
     gh-62948(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/62948


File: python.info,  Node: ipaddress,  Next: itertools<2>,  Prev: io<3>,  Up: 改良されたモジュール

1.2.5.20 ipaddress
..................

   * Add the *note IPv4Address.ipv6_mapped: 50b. property, which returns
     the IPv4-mapped IPv6 address.  (Contributed by Charles Machalow in
     gh-109466(1).)

   * Fix ‘is_global’ and ‘is_private’ behavior in *note IPv4Address:
     50c, *note IPv6Address: 50d, *note IPv4Network: 50e, and *note
     IPv6Network: 50f.  (Contributed by Jakub Stasiak in gh-113171(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/109466

   (2) https://github.com/python/cpython/issues/113171


File: python.info,  Node: itertools<2>,  Next: marshal,  Prev: ipaddress,  Up: 改良されたモジュール

1.2.5.21 itertools
..................

   * *note batched(): 511. has a new 'strict' parameter, which raises a
     *note ValueError: 2ec. if the final batch is shorter than the
     specified batch size.  (Contributed by Raymond Hettinger in
     gh-113202(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/113202


File: python.info,  Node: marshal,  Next: math<2>,  Prev: itertools<2>,  Up: 改良されたモジュール

1.2.5.22 marshal
................

   * Add the 'allow_code' parameter in module functions.  Passing
     ‘allow_code=False’ prevents serialization and de-serialization of
     code objects which are incompatible between Python versions.
     (Contributed by Serhiy Storchaka in gh-113626(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/113626


File: python.info,  Node: math<2>,  Next: mimetypes<2>,  Prev: marshal,  Up: 改良されたモジュール

1.2.5.23 math
.............

   * The new function *note fma(): 514. performs fused multiply-add
     operations.  This computes ‘x * y + z’ with only a single round,
     and so avoids any intermediate loss of precision.  It wraps the
     ‘fma()’ function provided by C99, and follows the specification of
     the IEEE 754 "fusedMultiplyAdd" operation for special cases.
     (Contributed by Mark Dickinson and Victor Stinner in gh-73468(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/73468


File: python.info,  Node: mimetypes<2>,  Next: mmap,  Prev: math<2>,  Up: 改良されたモジュール

1.2.5.24 mimetypes
..................

   * Add the *note guess_file_type(): 516. function to guess a MIME type
     from a filesystem path.  Using paths with *note guess_type(): 517.
     is now *note soft deprecated: 23d.  (Contributed by Serhiy
     Storchaka in gh-66543(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/66543


File: python.info,  Node: mmap,  Next: multiprocessing<2>,  Prev: mimetypes<2>,  Up: 改良されたモジュール

1.2.5.25 mmap
.............

   * *note mmap: 519. is now protected from crashing on Windows when the
     mapped memory is inaccessible due to file system errors or access
     violations.  (Contributed by Jannis Weigend in gh-118209(1).)

   * *note mmap: 519. has a new *note seekable(): 51a. method that can
     be used when a seekable file-like object is required.  The *note
     seek(): 51b. method now returns the new absolute position.
     (Contributed by Donghee Na and Sylvie Liberman in gh-111835(2).)

   * The new UNIX-only 'trackfd' parameter for *note mmap: 519. controls
     file descriptor duplication; if false, the file descriptor
     specified by 'fileno' will not be duplicated.  (Contributed by
     Zackery Spytz and Petr Viktorin in gh-78502(3).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118209

   (2) https://github.com/python/cpython/issues/111835

   (3) https://github.com/python/cpython/issues/78502


File: python.info,  Node: multiprocessing<2>,  Next: os<2>,  Prev: mmap,  Up: 改良されたモジュール

1.2.5.26 multiprocessing
........................

   * The default number of worker threads and processes is now selected
     using *note os.process_cpu_count(): 4da. instead of *note
     os.cpu_count(): 4db.  (Contributed by Victor Stinner in
     gh-109649(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/109649


File: python.info,  Node: os<2>,  Next: os path<2>,  Prev: multiprocessing<2>,  Up: 改良されたモジュール

1.2.5.27 os
...........

   * Add *note process_cpu_count(): 4da. function to get the number of
     logical CPU cores usable by the calling thread of the current
     process.  (Contributed by Victor Stinner in gh-109649(1).)

   * *note cpu_count(): 4db. and *note process_cpu_count(): 4da. can be
     overridden through the new environment variable *note
     PYTHON_CPU_COUNT: 51e. or the new command-line option *note -X
     cpu_count: 16f.  This option is useful for users who need to limit
     CPU resources of a container system without having to modify
     application code or the container itself.  (Contributed by Donghee
     Na in gh-109595(2).)

   * Add a *note low level interface: 47e. to Linux's ‘timer file
     descriptors(3)’ via *note timerfd_create(): 51f, *note
     timerfd_settime(): 520, *note timerfd_settime_ns(): 521, *note
     timerfd_gettime(): 522, *note timerfd_gettime_ns(): 523, *note
     TFD_NONBLOCK: 524, *note TFD_CLOEXEC: 525, *note TFD_TIMER_ABSTIME:
     526, and *note TFD_TIMER_CANCEL_ON_SET: 527. (Contributed by Masaru
     Tsuchiyama in gh-108277(4).)

   * *note lchmod(): 528. and the 'follow_symlinks' argument of *note
     chmod(): 529. are both now available on Windows.  Note that the
     default value of 'follow_symlinks' in ‘lchmod()’ is ‘False’ on
     Windows.  (Contributed by Serhiy Storchaka in gh-59616(5).)

   * *note fchmod(): 52a. and support for file descriptors in *note
     chmod(): 529. are both now available on Windows.  (Contributed by
     Serhiy Storchaka in gh-113191(6).)

   * On Windows, *note mkdir(): 52b. and *note makedirs(): 52c. now
     support passing a 'mode' value of ‘0o700’ to apply access control
     to the new directory.  This implicitly affects *note
     tempfile.mkdtemp(): 52d. and is a mitigation for CVE 2024-4030(7).
     Other values for 'mode' continue to be ignored.  (Contributed by
     Steve Dower in gh-118486(8).)

   * *note posix_spawn(): 52e. now accepts ‘None’ for the 'env'
     argument, which makes the newly spawned process use the current
     process environment.  (Contributed by Jakub Kulik in gh-113119(9).)

   * *note posix_spawn(): 52e. can now use the *note
     POSIX_SPAWN_CLOSEFROM: 52f. attribute in the 'file_actions'
     parameter on platforms that support
     ‘posix_spawn_file_actions_addclosefrom_np()’.  (Contributed by
     Jakub Kulik in gh-113117(10).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/109649

   (2) https://github.com/python/cpython/issues/109595

   (3) https://manpages.debian.org/timerfd_create(2)

   (4) https://github.com/python/cpython/issues/108277

   (5) https://github.com/python/cpython/issues/59616

   (6) https://github.com/python/cpython/issues/113191

   (7) https://www.cve.org/CVERecord?id=CVE-2024-4030

   (8) https://github.com/python/cpython/issues/118486

   (9) https://github.com/python/cpython/issues/113119

   (10) https://github.com/python/cpython/issues/113117


File: python.info,  Node: os path<2>,  Next: pathlib<4>,  Prev: os<2>,  Up: 改良されたモジュール

1.2.5.28 os.path
................

   * Add *note isreserved(): 32b. to check if a path is reserved on the
     current system.  This function is only available on Windows.
     (Contributed by Barney Gale in gh-88569(1).)

   * On Windows, *note isabs(): 531. no longer considers paths starting
     with exactly one slash (‘\’ or ‘/’) to be absolute.  (Contributed
     by Barney Gale and Jon Foster in gh-44626(2).)

   * *note realpath(): 262. now resolves MS-DOS style file names even if
     the file is not accessible.  (Contributed by Moonsik Park in
     gh-82367(3).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/88569

   (2) https://github.com/python/cpython/issues/44626

   (3) https://github.com/python/cpython/issues/82367


File: python.info,  Node: pathlib<4>,  Next: pdb<3>,  Prev: os path<2>,  Up: 改良されたモジュール

1.2.5.29 pathlib
................

   * Add *note UnsupportedOperation: 533, which is raised instead of
     *note NotImplementedError: 36b. when a path operation isn't
     supported.  (Contributed by Barney Gale in gh-89812(1).)

   * Add a new constructor for creating *note Path: 266. objects from
     'file' URIs (‘file:///’), *note Path.from_uri(): 534.  (Contributed
     by Barney Gale in gh-107465(2).)

   * Add *note PurePath.full_match(): 535. for matching paths with
     shell-style wildcards, including the recursive wildcard "‘**’".
     (Contributed by Barney Gale in gh-73435(3).)

   * Add the *note PurePath.parser: 536. class attribute to store the
     implementation of *note os.path: a6. used for low-level path
     parsing and joining.  This will be either ‘posixpath’ or ‘ntpath’.

   * Add 'recurse_symlinks' keyword-only argument to *note Path.glob():
     537. and *note rglob(): 538.  (Contributed by Barney Gale in
     gh-77609(4).)

   * *note Path.glob(): 537. and *note rglob(): 538. now return files
     and directories when given a pattern that ends with "‘**’".
     Previously, only directories were returned.  (Contributed by Barney
     Gale in gh-70303(5).)

   * Add the 'follow_symlinks' keyword-only argument to *note
     Path.is_file: 539, *note Path.is_dir: 53a, *note Path.owner(): 53b,
     and *note Path.group(): 53c.  (Contributed by Barney Gale in
     gh-105793(6) and Kamil Turek in gh-107962(7).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89812

   (2) https://github.com/python/cpython/issues/107465

   (3) https://github.com/python/cpython/issues/73435

   (4) https://github.com/python/cpython/issues/77609

   (5) https://github.com/python/cpython/issues/70303

   (6) https://github.com/python/cpython/issues/105793

   (7) https://github.com/python/cpython/issues/107962


File: python.info,  Node: pdb<3>,  Next: queue,  Prev: pathlib<4>,  Up: 改良されたモジュール

1.2.5.30 pdb
............

   * *note breakpoint(): 271. and *note set_trace(): 272. now enter the
     debugger immediately rather than on the next line of code to be
     executed.  This change prevents the debugger from breaking outside
     of the context when ‘breakpoint()’ is positioned at the end of the
     context.  (Contributed by Tian Gao in gh-118579(1).)

   * ‘sys.path[0]’ is no longer replaced by the directory of the script
     being debugged when *note sys.flags.safe_path: 53e. is set.
     (Contributed by Tian Gao and Christian Walther in gh-111762(2).)

   * *note zipapp: 136. is now supported as a debugging target.
     (Contributed by Tian Gao in gh-118501(3).)

   * Add ability to move between chained exceptions during post-mortem
     debugging in *note pm(): 53f. using the new *note exceptions
     [exc_number]: 540. command for Pdb.  (Contributed by Matthias
     Bussonnier in gh-106676(4).)

   * Expressions and statements whose prefix is a pdb command are now
     correctly identified and executed.  (Contributed by Tian Gao in
     gh-108464(5).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118579

   (2) https://github.com/python/cpython/issues/111762

   (3) https://github.com/python/cpython/issues/118501

   (4) https://github.com/python/cpython/issues/106676

   (5) https://github.com/python/cpython/issues/108464


File: python.info,  Node: queue,  Next: random,  Prev: pdb<3>,  Up: 改良されたモジュール

1.2.5.31 queue
..............

   * Add *note Queue.shutdown: 542. and *note ShutDown: 543. to manage
     queue termination.  (Contributed by Laurie Opperman and Yves Duprat
     in gh-104750(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104750


File: python.info,  Node: random,  Next: re<2>,  Prev: queue,  Up: 改良されたモジュール

1.2.5.32 random
...............

   * Add a *note command-line interface: 47f.  (Contributed by Hugo van
     Kemenade in gh-118131(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118131


File: python.info,  Node: re<2>,  Next: shutil,  Prev: random,  Up: 改良されたモジュール

1.2.5.33 re
...........

   * Rename ‘re.error’ to *note PatternError: 546. for improved clarity.
     ‘re.error’ is kept for backward compatibility.


File: python.info,  Node: shutil,  Next: site,  Prev: re<2>,  Up: 改良されたモジュール

1.2.5.34 shutil
...............

   * Support the 'dir_fd' and 'follow_symlinks' keyword arguments in
     *note chown(): 548.  (Contributed by Berker Peksag and Tahia K in
     gh-62308(1))

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/62308


File: python.info,  Node: site,  Next: sqlite3<2>,  Prev: shutil,  Up: 改良されたモジュール

1.2.5.35 site
.............

   * ‘.pth’ files are now decoded using UTF-8 first, and then with the
     *note locale encoding: 54a. if UTF-8 decoding fails.  (Contributed
     by Inada Naoki in gh-117802(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/117802


File: python.info,  Node: sqlite3<2>,  Next: ssl<2>,  Prev: site,  Up: 改良されたモジュール

1.2.5.36 sqlite3
................

   * A *note ResourceWarning: 54c. is now emitted if a *note Connection:
     54d. object is not *note closed: 54e. explicitly.  (Contributed by
     Erlend E. Aasland in gh-105539(1).)

   * Add the 'filter' keyword-only parameter to *note
     Connection.iterdump(): 54f. for filtering database objects to dump.
     (Contributed by Mariusz Felisiak in gh-91602(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/105539

   (2) https://github.com/python/cpython/issues/91602


File: python.info,  Node: ssl<2>,  Next: statistics,  Prev: sqlite3<2>,  Up: 改良されたモジュール

1.2.5.37 ssl
............

   * The *note create_default_context(): 480. API now includes *note
     VERIFY_X509_PARTIAL_CHAIN: 481. and *note VERIFY_X509_STRICT: 551.
     in its default flags.

          注釈: *note VERIFY_X509_STRICT: 551. may reject pre- RFC
          5280(1) or malformed certificates that the underlying OpenSSL
          implementation might otherwise accept.  Whilst disabling this
          is not recommended, you can do so using:

               import ssl

               ctx = ssl.create_default_context()
               ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT

     (Contributed by William Woodruff in gh-112389(2).)

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc5280.html

   (2) https://github.com/python/cpython/issues/112389


File: python.info,  Node: statistics,  Next: subprocess,  Prev: ssl<2>,  Up: 改良されたモジュール

1.2.5.38 statistics
...................

   * Add *note kde(): 553. for kernel density estimation.  This makes it
     possible to estimate a continuous probability density function from
     a fixed number of discrete samples.  (Contributed by Raymond
     Hettinger in gh-115863(1).)

   * Add *note kde_random(): 554. for sampling from an estimated
     probability density function created by *note kde(): 553.
     (Contributed by Raymond Hettinger in gh-115863(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115863

   (2) https://github.com/python/cpython/issues/115863


File: python.info,  Node: subprocess,  Next: sys<2>,  Prev: statistics,  Up: 改良されたモジュール

1.2.5.39 subprocess
...................

   * The *note subprocess: dc. module now uses the *note posix_spawn():
     52e. function in more situations.

     Notably, when 'close_fds' is ‘True’ (the default), *note
     posix_spawn(): 52e. will be used when the C library provides
     ‘posix_spawn_file_actions_addclosefrom_np()’, which includes recent
     versions of Linux, FreeBSD, and Solaris.  On Linux, this should
     perform similarly to the existing Linux ‘vfork()’ based code.

     A private control knob ‘subprocess._USE_POSIX_SPAWN’ can be set to
     ‘False’ if you need to force *note subprocess: dc. to never use
     *note posix_spawn(): 52e.  Please report your reason and platform
     details in the *note issue tracker: 557. if you set this so that we
     can improve our API selection logic for everyone.  (Contributed by
     Jakub Kulik in gh-113117(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/113117


File: python.info,  Node: sys<2>,  Next: tempfile,  Prev: subprocess,  Up: 改良されたモジュール

1.2.5.40 sys
............

   * Add the *note _is_interned(): 559. function to test if a string was
     interned.  This function is not guaranteed to exist in all
     implementations of Python.  (Contributed by Serhiy Storchaka in
     gh-78573(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/78573


File: python.info,  Node: tempfile,  Next: time,  Prev: sys<2>,  Up: 改良されたモジュール

1.2.5.41 tempfile
.................

   * On Windows, the default mode ‘0o700’ used by *note
     tempfile.mkdtemp(): 52d. now limits access to the new directory due
     to changes to *note os.mkdir(): 52b.  This is a mitigation for CVE
     2024-4030(1).  (Contributed by Steve Dower in gh-118486(2).)

   ---------- Footnotes ----------

   (1) https://www.cve.org/CVERecord?id=CVE-2024-4030

   (2) https://github.com/python/cpython/issues/118486


File: python.info,  Node: time,  Next: tkinter<2>,  Prev: tempfile,  Up: 改良されたモジュール

1.2.5.42 time
.............

   * On Windows, *note monotonic(): 55c. now uses the
     ‘QueryPerformanceCounter()’ clock for a resolution of 1
     microsecond, instead of the ‘GetTickCount64()’ clock which has a
     resolution of 15.6 milliseconds.  (Contributed by Victor Stinner in
     gh-88494(1).)

   * On Windows, *note time(): 55d. now uses the
     ‘GetSystemTimePreciseAsFileTime()’ clock for a resolution of 1
     microsecond, instead of the ‘GetSystemTimeAsFileTime()’ clock which
     has a resolution of 15.6 milliseconds.  (Contributed by Victor
     Stinner in gh-63207(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/88494

   (2) https://github.com/python/cpython/issues/63207


File: python.info,  Node: tkinter<2>,  Next: traceback,  Prev: time,  Up: 改良されたモジュール

1.2.5.43 tkinter
................

   * Add *note tkinter: f6. widget methods: ‘tk_busy_hold()’,
     ‘tk_busy_configure()’, ‘tk_busy_cget()’, ‘tk_busy_forget()’,
     ‘tk_busy_current()’, and ‘tk_busy_status()’.  (Contributed by
     Miguel, klappnase and Serhiy Storchaka in gh-72684(1).)

   * The *note tkinter: f6. widget method ‘wm_attributes()’ now accepts
     the attribute name without the minus prefix to get window
     attributes, for example ‘w.wm_attributes('alpha')’ and allows
     specifying attributes and values to set as keyword arguments, for
     example ‘w.wm_attributes(alpha=0.5)’.  (Contributed by Serhiy
     Storchaka in gh-43457(2).)

   * ‘wm_attributes()’ can now return attributes as a *note dict: 183,
     by using the new optional keyword-only parameter
     'return_python_dict'.  (Contributed by Serhiy Storchaka in
     gh-43457(3).)

   * ‘Text.count()’ can now return a simple *note int: 19b. when the new
     optional keyword-only parameter 'return_ints' is used.  Otherwise,
     the single count is returned as a 1-tuple or ‘None’.  (Contributed
     by Serhiy Storchaka in gh-97928(4).)

   * Support the "vsapi" element type in the *note element_create():
     55f. method of *note tkinter.ttk.Style: 560.  (Contributed by
     Serhiy Storchaka in gh-68166(5).)

   * Add the ‘after_info()’ method for Tkinter widgets.  (Contributed by
     Cheryl Sabella in gh-77020(6).)

   * Add a new ‘copy_replace()’ method to ‘PhotoImage’ to copy a region
     from one image to another, possibly with pixel zooming,
     subsampling, or both.  (Contributed by Serhiy Storchaka in
     gh-118225(7).)

   * Add 'from_coords' parameter to the ‘PhotoImage’ methods ‘copy()’,
     ‘zoom()’ and ‘subsample()’.  Add 'zoom' and 'subsample' parameters
     to the ‘PhotoImage’ method ‘copy()’.  (Contributed by Serhiy
     Storchaka in gh-118225(8).)

   * Add the ‘PhotoImage’ methods ‘read()’ to read an image from a file
     and ‘data()’ to get the image data.  Add 'background' and
     'grayscale' parameters to the ‘write()’ method.  (Contributed by
     Serhiy Storchaka in gh-118271(9).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/72684

   (2) https://github.com/python/cpython/issues/43457

   (3) https://github.com/python/cpython/issues/43457

   (4) https://github.com/python/cpython/issues/97928

   (5) https://github.com/python/cpython/issues/68166

   (6) https://github.com/python/cpython/issues/77020

   (7) https://github.com/python/cpython/issues/118225

   (8) https://github.com/python/cpython/issues/118225

   (9) https://github.com/python/cpython/issues/118271


File: python.info,  Node: traceback,  Next: types<2>,  Prev: tkinter<2>,  Up: 改良されたモジュール

1.2.5.44 traceback
..................

   * Add the *note exc_type_str: 562. attribute to *note
     TracebackException: 563, which holds a string display of the
     'exc_type'.  Deprecate the *note exc_type: 564. attribute, which
     holds the type object itself.  Add parameter 'save_exc_type'
     (default ‘True’) to indicate whether ‘exc_type’ should be saved.
     (Contributed by Irit Katriel in gh-112332(1).)

   * Add a new 'show_group' keyword-only parameter to *note
     TracebackException.format_exception_only(): 565. to (recursively)
     format the nested exceptions of a *note BaseExceptionGroup: 566.
     instance.  (Contributed by Irit Katriel in gh-105292(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/112332

   (2) https://github.com/python/cpython/issues/105292


File: python.info,  Node: types<2>,  Next: typing<2>,  Prev: traceback,  Up: 改良されたモジュール

1.2.5.45 types
..............

   * *note SimpleNamespace: 4e5. can now take a single positional
     argument to initialise the namespace's arguments.  This argument
     must either be a mapping or an iterable of key-value pairs.
     (Contributed by Serhiy Storchaka in gh-108191(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/108191


File: python.info,  Node: typing<2>,  Next: unicodedata<2>,  Prev: types<2>,  Up: 改良されたモジュール

1.2.5.46 typing
...............

   * PEP 705(1): Add *note ReadOnly: 48a, a special typing construct to
     mark a *note TypedDict: 332. item as read-only for type checkers.

   * PEP 742(2): Add *note TypeIs: 48b, a typing construct that can be
     used to instruct a type checker how to narrow a type.

   * Add *note NoDefault: 569, a sentinel object used to represent the
     defaults of some parameters in the *note typing: 10a. module.
     (Contributed by Jelle Zijlstra in gh-116126(3).)

   * Add *note get_protocol_members(): 56a. to return the set of members
     defining a *note typing.Protocol: 56b.  (Contributed by Jelle
     Zijlstra in gh-104873(4).)

   * Add *note is_protocol(): 56c. to check whether a class is a *note
     Protocol: 56b.  (Contributed by Jelle Zijlstra in gh-104873(5).)

   * *note ClassVar: 56d. can now be nested in *note Final: 56e, and
     vice versa.  (Contributed by Mehdi Drissi in gh-89547(6).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0705/

   (2) https://peps.python.org/pep-0742/

   (3) https://github.com/python/cpython/issues/116126

   (4) https://github.com/python/cpython/issues/104873

   (5) https://github.com/python/cpython/issues/104873

   (6) https://github.com/python/cpython/issues/89547


File: python.info,  Node: unicodedata<2>,  Next: venv,  Prev: typing<2>,  Up: 改良されたモジュール

1.2.5.47 unicodedata
....................

   * Update the Unicode database to version 15.1.0(1).  (Contributed by
     James Gerity in gh-109559(2).)

   ---------- Footnotes ----------

   (1) https://www.unicode.org/versions/Unicode15.1.0/

   (2) https://github.com/python/cpython/issues/109559


File: python.info,  Node: venv,  Next: warnings,  Prev: unicodedata<2>,  Up: 改良されたモジュール

1.2.5.48 venv
.............

   * Add support for creating source control management (SCM) ignore
     files in a virtual environment's directory.  By default, Git is
     supported.  This is implemented as opt-in via the API, which can be
     extended to support other SCMs (*note EnvBuilder: 571. and *note
     create(): 572.), and opt-out via the CLI, using
     ‘--without-scm-ignore-files’.  (Contributed by Brett Cannon in
     gh-108125(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/108125


File: python.info,  Node: warnings,  Next: xml,  Prev: venv,  Up: 改良されたモジュール

1.2.5.49 warnings
.................

   * PEP 702(1): The new *note warnings.deprecated(): 489. decorator
     provides a way to communicate deprecations to a *note static type
     checker: 574. and to warn on usage of deprecated classes and
     functions.  A *note DeprecationWarning: 1a3. may also be emitted
     when a decorated function or class is used at runtime.
     (Contributed by Jelle Zijlstra in gh-104003(2).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0702/

   (2) https://github.com/python/cpython/issues/104003


File: python.info,  Node: xml,  Next: zipimport,  Prev: warnings,  Up: 改良されたモジュール

1.2.5.50 xml
............

   * Allow controlling Expat >=2.6.0 reparse deferral ( CVE
     2023-52425(1)) by adding five new methods:

        * *note xml.etree.ElementTree.XMLParser.flush(): 576.

        * *note xml.etree.ElementTree.XMLPullParser.flush(): 577.

        * *note xml.parsers.expat.xmlparser.GetReparseDeferralEnabled():
          578.

        * *note xml.parsers.expat.xmlparser.SetReparseDeferralEnabled():
          579.

        * ‘xml.sax.expatreader.ExpatParser.flush()’

     (Contributed by Sebastian Pipping in gh-115623(2).)

   * Add the ‘close()’ method for the iterator returned by *note
     iterparse(): 57a. for explicit cleanup.  (Contributed by Serhiy
     Storchaka in gh-69893(3).)

   ---------- Footnotes ----------

   (1) https://www.cve.org/CVERecord?id=CVE-2023-52425

   (2) https://github.com/python/cpython/issues/115623

   (3) https://github.com/python/cpython/issues/69893


File: python.info,  Node: zipimport,  Prev: xml,  Up: 改良されたモジュール

1.2.5.51 zipimport
..................

   * Add support for ZIP64(1) format files.  Everybody loves huge data,
     right?  (Contributed by Tim Hatch in gh-94146(2).)

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Zip_(file_format)#ZIP64

   (2) https://github.com/python/cpython/issues/94146


File: python.info,  Node: 最適化<2>,  Next: Removed Modules And APIs,  Prev: 改良されたモジュール,  Up: What's New In Python 3 13

1.2.6 最適化
------------

   * Several standard library modules have had their import times
     significantly improved.  For example, the import time of the *note
     typing: 10a. module has been reduced by around a third by removing
     dependencies on *note re: be. and *note contextlib: 27.  Other
     modules to enjoy import-time speedups include *note email.utils:
     54, *note enum: 5a, *note functools: 63, *note importlib.metadata:
     7e, and *note threading: f3.  (Contributed by Alex Waygood,
     Shantanu Jain, Adam Turner, Daniel Hollas, and others in
     gh-109653(1).)

   * *note textwrap.indent(): 57d. is now around 30% faster than before
     for large input.  (Contributed by Inada Naoki in gh-107369(2).)

   * The *note subprocess: dc. module now uses the *note posix_spawn():
     52e. function in more situations, including when 'close_fds' is
     ‘True’ (the default) on many modern platforms.  This should provide
     a notable performance increase when launching processes on FreeBSD
     and Solaris.  See the *note subprocess: 556. section above for
     details.  (Contributed by Jakub Kulik in gh-113117(3).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/109653

   (2) https://github.com/python/cpython/issues/107369

   (3) https://github.com/python/cpython/issues/113117


File: python.info,  Node: Removed Modules And APIs,  Next: New Deprecations,  Prev: 最適化<2>,  Up: What's New In Python 3 13

1.2.7 Removed Modules And APIs
------------------------------

* Menu:

* PEP 594; Remove "dead batteries" from the standard library: PEP 594 Remove "dead batteries" from the standard library.
* 2to3::
* builtins::
* configparser: configparser<3>.
* importlib.metadata: importlib metadata.
* locale::
* opcode::
* optparse::
* pathlib: pathlib<5>.
* re: re<3>.
* tkinter.tix: tkinter tix.
* turtle: turtle<2>.
* typing: typing<3>.
* unittest: unittest<2>.
* urllib: urllib<3>.
* webbrowser: webbrowser<2>.


File: python.info,  Node: PEP 594 Remove "dead batteries" from the standard library,  Next: 2to3,  Up: Removed Modules And APIs

1.2.7.1 PEP 594: Remove "dead batteries" from the standard library
..................................................................

PEP 594(1) proposed removing 19 modules from the standard library,
colloquially referred to as 'dead batteries' due to their historic,
obsolete, or insecure status.  All of the following modules were
deprecated in Python 3.11, and are now removed:

   * ‘aifc’

        * standard-aifc(2): Use the redistribution of ‘aifc’ library
          from PyPI.

   * ‘audioop’

        * audioop-lts(3): Use ‘audioop-lts’ library from PyPI.

   * ‘chunk’

        * standard-chunk(4): Use the redistribution of ‘chunk’ library
          from PyPI.

   * ‘cgi’ and ‘cgitb’

        * ‘cgi.FieldStorage’ can typically be replaced with *note
          urllib.parse.parse_qsl(): 31e. for ‘GET’ and ‘HEAD’ requests,
          and the *note email.message: 48. module or the multipart(5)
          library for ‘POST’ and ‘PUT’ requests.

        * ‘cgi.parse()’ can be replaced by calling *note
          urllib.parse.parse_qs(): 31f. directly on the desired query
          string, unless the input is ‘multipart/form-data’, which
          should be replaced as described below for
          ‘cgi.parse_multipart()’.

        * ‘cgi.parse_header()’ can be replaced with the functionality in
          the *note email: 3f. package, which implements the same MIME
          RFCs.  For example, with *note email.message.EmailMessage:
          580.:

               from email.message import EmailMessage

               msg = EmailMessage()
               msg['content-type'] = 'application/json; charset="utf8"'
               main, params = msg.get_content_type(), msg['content-type'].params

        * ‘cgi.parse_multipart()’ can be replaced with the functionality
          in the *note email: 3f. package, which implements the same
          MIME RFCs, or with the multipart(6) library.  For example, the
          *note email.message.EmailMessage: 580. and *note
          email.message.Message: 581. classes.

        * standard-cgi(7): and standard-cgitb(8): Use the redistribution
          of ‘cgi’ and ‘cgitb’ library from PyPI.

   * ‘crypt’ and the private ‘_crypt’ extension.  The *note hashlib: 6c.
     module may be an appropriate replacement when simply hashing a
     value is required.  Otherwise, various third-party libraries on
     PyPI are available:

        * bcrypt(9): Modern password hashing for your software and your
          servers.

        * argon2-cffi(10): The secure Argon2 password hashing algorithm.

        * legacycrypt(11): *note ctypes: 2e. wrapper to the POSIX crypt
          library call and associated functionality.

        * crypt_r(12): Fork of the ‘crypt’ module, wrapper to the
          ‘crypt_r(3)(13)’ library call and associated functionality.

        * standard-crypt(14) and deprecated-crypt-alternative(15): Use
          the redistribution of ‘crypt’ and reimplementation of ‘_crypt’
          libraries from PyPI.

   * ‘imghdr’: The filetype(16), puremagic(17), or python-magic(18)
     libraries should be used as replacements.  For example, the
     ‘puremagic.what()’ function can be used to replace the
     ‘imghdr.what()’ function for all file formats that were supported
     by ‘imghdr’.

        * standard-imghdr(19): Use the redistribution of ‘imghdr’
          library from PyPI.

   * ‘mailcap’: Use the *note mimetypes: 93. module instead.

        * standard-mailcap(20): Use the redistribution of ‘mailcap’
          library from PyPI.

   * ‘msilib’

   * ‘nis’

   * ‘nntplib’: Use the pynntp(21) library from PyPI instead.

        * standard-nntplib(22): Use the redistribution of ‘nntplib’
          library from PyPI.

   * ‘ossaudiodev’: For audio playback, use the pygame(23) library from
     PyPI instead.

   * ‘pipes’: Use the *note subprocess: dc. module instead.  Use *note
     shlex.quote(): 582. to replace the undocumented ‘pipes.quote’
     function.

        * standard-pipes(24): Use the redistribution of ‘pipes’ library
          from PyPI.

   * ‘sndhdr’: The filetype(25), puremagic(26), or python-magic(27)
     libraries should be used as replacements.

        * standard-sndhdr(28): Use the redistribution of ‘sndhdr’
          library from PyPI.

   * ‘spwd’: Use the python-pam(29) library from PyPI instead.

   * ‘sunau’

        * standard-sunau(30): Use the redistribution of ‘sunau’ library
          from PyPI.

   * ‘telnetlib’, Use the telnetlib3(31) or Exscript(32) libraries from
     PyPI instead.

        * standard-telnetlib(33): Use the redistribution of ‘telnetlib’
          library from PyPI.

   * ‘uu’: Use the *note base64: f. module instead, as a modern
     alternative.

        * standard-uu(34): Use the redistribution of ‘uu’ library from
          PyPI.

   * ‘xdrlib’

        * standard-xdrlib(35): Use the redistribution of ‘xdrlib’
          library from PyPI.

(Contributed by Victor Stinner and Zachary Ware in gh-104773(36) and
gh-104780(37).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://pypi.org/project/standard-aifc/

   (3) https://pypi.org/project/audioop-lts/

   (4) https://pypi.org/project/standard-chunk/

   (5) https://pypi.org/project/multipart/

   (6) https://pypi.org/project/multipart/

   (7) https://pypi.org/project/standard-cgi/

   (8) https://pypi.org/project/standard-cgitb/

   (9) https://pypi.org/project/bcrypt/

   (10) https://pypi.org/project/argon2-cffi/

   (11) https://pypi.org/project/legacycrypt/

   (12) https://pypi.org/project/crypt_r/

   (13) https://manpages.debian.org/crypt_r(3)

   (14) https://pypi.org/project/standard-crypt/

   (15) https://pypi.org/project/deprecated-crypt-alternative/

   (16) https://pypi.org/project/filetype/

   (17) https://pypi.org/project/puremagic/

   (18) https://pypi.org/project/python-magic/

   (19) https://pypi.org/project/standard-imghdr/

   (20) https://pypi.org/project/standard-mailcap/

   (21) https://pypi.org/project/pynntp/

   (22) https://pypi.org/project/standard-nntplib/

   (23) https://pypi.org/project/pygame/

   (24) https://pypi.org/project/standard-pipes/

   (25) https://pypi.org/project/filetype/

   (26) https://pypi.org/project/puremagic/

   (27) https://pypi.org/project/python-magic/

   (28) https://pypi.org/project/standard-sndhdr/

   (29) https://pypi.org/project/python-pam/

   (30) https://pypi.org/project/standard-sunau/

   (31) https://pypi.org/project/telnetlib3/

   (32) https://pypi.org/project/Exscript/

   (33) https://pypi.org/project/standard-telnetlib/

   (34) https://pypi.org/project/standard-uu/

   (35) https://pypi.org/project/standard-xdrlib/

   (36) https://github.com/python/cpython/issues/104773

   (37) https://github.com/python/cpython/issues/104780


File: python.info,  Node: 2to3,  Next: builtins,  Prev: PEP 594 Remove "dead batteries" from the standard library,  Up: Removed Modules And APIs

1.2.7.2 2to3
............

   * Remove the ‘2to3’ program and the ‘lib2to3’ module, previously
     deprecated in Python 3.11.  (Contributed by Victor Stinner in
     gh-104780(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104780


File: python.info,  Node: builtins,  Next: configparser<3>,  Prev: 2to3,  Up: Removed Modules And APIs

1.2.7.3 builtins
................

   * Remove support for chained *note classmethod: 48e. descriptors
     (introduced in gh-63272(1)).  These can no longer be used to wrap
     other descriptors, such as *note property: 4b3.  The core design of
     this feature was flawed and led to several problems.  To
     "pass-through" a *note classmethod: 48e, consider using the
     ‘__wrapped__’ attribute that was added in Python 3.10.
     (Contributed by Raymond Hettinger in gh-89519(2).)

   * Raise a *note RuntimeError: 244. when calling *note frame.clear():
     585. on a suspended frame (as has always been the case for an
     executing frame).  (Contributed by Irit Katriel in gh-79932(3).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/63272

   (2) https://github.com/python/cpython/issues/89519

   (3) https://github.com/python/cpython/issues/79932


File: python.info,  Node: configparser<3>,  Next: importlib metadata,  Prev: builtins,  Up: Removed Modules And APIs

1.2.7.4 configparser
....................

   * Remove the undocumented ‘LegacyInterpolation’ class, deprecated in
     the docstring since Python 3.2, and at runtime since Python 3.11.
     (Contributed by Hugo van Kemenade in gh-104886(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104886


File: python.info,  Node: importlib metadata,  Next: locale,  Prev: configparser<3>,  Up: Removed Modules And APIs

1.2.7.5 importlib.metadata
..........................

   * Remove deprecated subscript (*note __getitem__(): 588.) access for
     *note EntryPoint: 589. objects.  (Contributed by Jason R. Coombs in
     gh-113175(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/113175


File: python.info,  Node: locale,  Next: opcode,  Prev: importlib metadata,  Up: Removed Modules And APIs

1.2.7.6 locale
..............

   * Remove the ‘locale.resetlocale()’ function, deprecated in Python
     3.11.  Use ‘locale.setlocale(locale.LC_ALL, "")’ instead.
     (Contributed by Victor Stinner in gh-104783(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104783


File: python.info,  Node: opcode,  Next: optparse,  Prev: locale,  Up: Removed Modules And APIs

1.2.7.7 opcode
..............

   * Move ‘opcode.ENABLE_SPECIALIZATION’ to
     ‘_opcode.ENABLE_SPECIALIZATION’.  This field was added in 3.12, it
     was never documented, and is not intended for external use.
     (Contributed by Irit Katriel in gh-105481(1).)

   * Remove ‘opcode.is_pseudo()’, ‘opcode.MIN_PSEUDO_OPCODE’, and
     ‘opcode.MAX_PSEUDO_OPCODE’, which were added in Python 3.12, but
     were neither documented nor exposed through *note dis: 3c, and were
     not intended to be used externally.  (Contributed by Irit Katriel
     in gh-105481(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/105481

   (2) https://github.com/python/cpython/issues/105481


File: python.info,  Node: optparse,  Next: pathlib<5>,  Prev: opcode,  Up: Removed Modules And APIs

1.2.7.8 optparse
................

   * This module is no longer considered *note soft deprecated: 23d.
     While *note argparse: 7. remains preferred for new projects that
     aren't using a third party command line argument processing
     library, there are aspects of the way ‘argparse’ works that mean
     the lower level ‘optparse’ module may provide a better foundation
     for 'writing' argument processing libraries, and for implementing
     command line applications which adhere more strictly than
     ‘argparse’ does to various Unix command line processing conventions
     that originate in the behaviour of the C ‘getopt()’ function .
     (Contributed by Alyssa Coghlan and Serhiy Storchaka in
     gh-126180(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126180


File: python.info,  Node: pathlib<5>,  Next: re<3>,  Prev: optparse,  Up: Removed Modules And APIs

1.2.7.9 pathlib
...............

   * Remove the ability to use *note Path: 266. objects as context
     managers.  This functionality was deprecated and has had no effect
     since Python 3.9.  (Contributed by Barney Gale in gh-83863(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/83863


File: python.info,  Node: re<3>,  Next: tkinter tix,  Prev: pathlib<5>,  Up: Removed Modules And APIs

1.2.7.10 re
...........

   * Remove the undocumented, deprecated, and broken ‘re.template()’
     function and ‘re.TEMPLATE’ / ‘re.T’ flag.  (Contributed by Serhiy
     Storchaka and Nikita Sobolev in gh-105687(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/105687


File: python.info,  Node: tkinter tix,  Next: turtle<2>,  Prev: re<3>,  Up: Removed Modules And APIs

1.2.7.11 tkinter.tix
....................

   * Remove the ‘tkinter.tix’ module, deprecated in Python 3.6.  The
     third-party Tix library which the module wrapped is unmaintained.
     (Contributed by Zachary Ware in gh-75552(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/75552


File: python.info,  Node: turtle<2>,  Next: typing<3>,  Prev: tkinter tix,  Up: Removed Modules And APIs

1.2.7.12 ‘turtle’
.................

   * Remove the ‘RawTurtle.settiltangle()’ method, deprecated in the
     documentation since Python 3.1 and at runtime since Python 3.11.
     (Contributed by Hugo van Kemenade in gh-104876(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104876


File: python.info,  Node: typing<3>,  Next: unittest<2>,  Prev: turtle<2>,  Up: Removed Modules And APIs

1.2.7.13 typing
...............

   * Remove the ‘typing.io’ and ‘typing.re’ namespaces, deprecated since
     Python 3.8.  The items in those namespaces can be imported directly
     from the *note typing: 10a. module.  (Contributed by Sebastian
     Rittau in gh-92871(1).)

   * Remove the keyword-argument method of creating *note TypedDict:
     332. types, deprecated in Python 3.11.  (Contributed by Tomas Roun
     in gh-104786(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/92871

   (2) https://github.com/python/cpython/issues/104786


File: python.info,  Node: unittest<2>,  Next: urllib<3>,  Prev: typing<3>,  Up: Removed Modules And APIs

1.2.7.14 unittest
.................

   * Remove the following *note unittest: 10c. functions, deprecated in
     Python 3.11:

        * ‘unittest.findTestCases()’

        * ‘unittest.makeSuite()’

        * ‘unittest.getTestCaseNames()’

     Use *note TestLoader: 593. methods instead:

        * *note loadTestsFromModule(): 594.

        * *note loadTestsFromTestCase(): 595.

        * *note getTestCaseNames(): 596.

     (Contributed by Hugo van Kemenade in gh-104835(1).)

   * Remove the untested and undocumented ‘TestProgram.usageExit()’
     method, deprecated in Python 3.11.  (Contributed by Hugo van
     Kemenade in gh-104992(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104835

   (2) https://github.com/python/cpython/issues/104992


File: python.info,  Node: urllib<3>,  Next: webbrowser<2>,  Prev: unittest<2>,  Up: Removed Modules And APIs

1.2.7.15 urllib
...............

   * Remove the 'cafile', 'capath', and 'cadefault' parameters of the
     *note urllib.request.urlopen(): 307. function, deprecated in Python
     3.6.  Use the 'context' parameter instead with an *note SSLContext:
     357. instance.  The *note ssl.SSLContext.load_cert_chain(): 598.
     function can be used to load specific certificates, or let *note
     ssl.create_default_context(): 480. select the operating system's
     trusted certificate authority (CA) certificates.  (Contributed by
     Victor Stinner in gh-105382(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/105382


File: python.info,  Node: webbrowser<2>,  Prev: urllib<3>,  Up: Removed Modules And APIs

1.2.7.16 webbrowser
...................

   * Remove the untested and undocumented ‘MacOSX’ class, deprecated in
     Python 3.11.  Use the ‘MacOSXOSAScript’ class (introduced in Python
     3.2) instead.  (Contributed by Hugo van Kemenade in gh-104804(1).)

   * Remove the deprecated ‘MacOSXOSAScript._name’ attribute.  Use the
     *note MacOSXOSAScript.name: 59a. attribute instead.  (Contributed
     by Nikita Sobolev in gh-105546(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104804

   (2) https://github.com/python/cpython/issues/105546


File: python.info,  Node: New Deprecations,  Next: CPython Bytecode Changes,  Prev: Removed Modules And APIs,  Up: What's New In Python 3 13

1.2.8 New Deprecations
----------------------

   * *note User-defined functions: 59c.:

        * Deprecate assignment to a function's *note __code__: 59d.
          attribute, where the new code object's type does not match the
          function's type.  The different types are: plain function,
          generator, async generator, and coroutine.  (Contributed by
          Irit Katriel in gh-81137(1).)

   * *note array: 8.:

        * Deprecate the ‘'u'’ format code (‘wchar_t’) at runtime.  This
          format code has been deprecated in documentation since Python
          3.3, and will be removed in Python 3.16.  Use the ‘'w'’ format
          code (*note Py_UCS4: 33d.) for Unicode characters instead.
          (Contributed by Hugo van Kemenade in gh-80480(2).)

   * *note ctypes: 2e.:

        * Deprecate the undocumented ‘SetPointerType()’ function, to be
          removed in Python 3.15.  (Contributed by Victor Stinner in
          gh-105733(3).)

        * *note Soft-deprecate: 23d. the *note ARRAY(): 59e. function in
          favour of ‘type * length’ multiplication.  (Contributed by
          Victor Stinner in gh-105733(4).)

   * *note decimal: 3a.:

        * Deprecate the non-standard and undocumented *note Decimal:
          1fe. format specifier ‘'N'’, which is only supported in the
          ‘decimal’ module's C implementation.  Scheduled to be removed
          in Python 3.18.  (Contributed by Serhiy Storchaka in
          gh-89902(5).)

   * *note dis: 3c.:

        * Deprecate the ‘HAVE_ARGUMENT’ separator.  Check membership in
          *note hasarg: 59f. instead.  (Contributed by Irit Katriel in
          gh-109319(6).)

   * *note gettext: 67.:

        * Deprecate non-integer numbers as arguments to functions and
          methods that consider plural forms in the ‘gettext’ module,
          even if no translation was found.  (Contributed by Serhiy
          Storchaka in gh-88434(7).)

   * *note glob: 68.:

        * Deprecate the undocumented ‘glob0()’ and ‘glob1()’ functions.
          Use *note glob(): 5a0. and pass a *note path-like object: 5a1.
          specifying the root directory to the 'root_dir' parameter
          instead.  (Contributed by Barney Gale in gh-117337(8).)

   * *note http.server: 76.:

        * Deprecate *note CGIHTTPRequestHandler: 325, to be removed in
          Python 3.15.  Process-based CGI HTTP servers have been out of
          favor for a very long time.  This code was outdated,
          unmaintained, and rarely used.  It has a high potential for
          both security and functionality bugs.  (Contributed by Gregory
          P. Smith in gh-109096(9).)

        * Deprecate the ‘--cgi’ flag to the ‘python -m http.server’
          command-line interface, to be removed in Python 3.15.
          (Contributed by Gregory P. Smith in gh-109096(10).)

   * *note mimetypes: 93.:

        * *note Soft-deprecate: 23d. file path arguments to *note
          guess_type(): 517, use *note guess_file_type(): 516. instead.
          (Contributed by Serhiy Storchaka in gh-66543(11).)

   * *note re: be.:

        * Deprecate passing the optional 'maxsplit', 'count', or 'flags'
          arguments as positional arguments to the module-level *note
          split(): 5a2, *note sub(): 5a3, and *note subn(): 5a4.
          functions.  These parameters will become *note keyword-only:
          5a5. in a future version of Python.  (Contributed by Serhiy
          Storchaka in gh-56166(12).)

   * *note pathlib: a8.:

        * Deprecate *note PurePath.is_reserved(): 32a, to be removed in
          Python 3.15.  Use *note os.path.isreserved(): 32b. to detect
          reserved paths on Windows.  (Contributed by Barney Gale in
          gh-88569(13).)

   * *note platform: af.:

        * Deprecate *note java_ver(): 32c, to be removed in Python 3.15.
          This function is only useful for Jython support, has a
          confusing API, and is largely untested.  (Contributed by
          Nikita Sobolev in gh-116349(14).)

   * *note pydoc: ba.:

        * Deprecate the undocumented ‘ispackage()’ function.
          (Contributed by Zackery Spytz in gh-64020(15).)

   * *note sqlite3: d4.:

        * Deprecate passing more than one positional argument to the
          *note connect(): 5a6. function and the *note Connection: 54d.
          constructor.  The remaining parameters will become
          keyword-only in Python 3.15.  (Contributed by Erlend E.
          Aasland in gh-107948(16).)

        * Deprecate passing name, number of arguments, and the callable
          as keyword arguments for *note Connection.create_function():
          5a7. and *note Connection.create_aggregate(): 5a8. These
          parameters will become positional-only in Python 3.15.
          (Contributed by Erlend E. Aasland in gh-108278(17).)

        * Deprecate passing the callback callable by keyword for the
          *note set_authorizer(): 5a9, *note set_progress_handler():
          5aa, and *note set_trace_callback(): 5ab. *note Connection:
          54d. methods.  The callback callables will become
          positional-only in Python 3.15.  (Contributed by Erlend E.
          Aasland in gh-108278(18).)

   * *note sys: df.:

        * Deprecate the *note _enablelegacywindowsfsencoding(): 33e.
          function, to be removed in Python 3.16.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 33f. environment variable
          instead.  (Contributed by Inada Naoki in gh-73427(19).)

   * *note tarfile: e4.:

        * Deprecate the undocumented and unused ‘TarFile.tarfile’
          attribute, to be removed in Python 3.16.  (Contributed in
          gh-115256(20).)

   * *note traceback: 104.:

        * Deprecate the *note TracebackException.exc_type: 564.
          attribute.  Use *note TracebackException.exc_type_str: 562.
          instead.  (Contributed by Irit Katriel in gh-112332(21).)

   * *note typing: 10a.:

        * Deprecate the undocumented keyword argument syntax for
          creating *note NamedTuple: 331. classes (e.g.  ‘Point =
          NamedTuple("Point", x=int, y=int)’), to be removed in Python
          3.15.  Use the class-based syntax or the functional syntax
          instead.  (Contributed by Alex Waygood in gh-105566(22).)

        * Deprecate omitting the 'fields' parameter when creating a
          *note NamedTuple: 331. or *note typing.TypedDict: 332. class,
          and deprecate passing ‘None’ to the 'fields' parameter of both
          types.  Python 3.15 will require a valid sequence for the
          'fields' parameter.  To create a NamedTuple class with zero
          fields, use ‘class NT(NamedTuple): pass’ or ‘NT =
          NamedTuple("NT", ())’.  To create a TypedDict class with zero
          fields, use ‘class TD(TypedDict): pass’ or ‘TD =
          TypedDict("TD", {})’.  (Contributed by Alex Waygood in
          gh-105566(23) and gh-105570(24).)

        * Deprecate the *note typing.no_type_check_decorator(): 333.
          decorator function, to be removed in Python 3.15.  After eight
          years in the *note typing: 10a. module, it has yet to be
          supported by any major type checker.  (Contributed by Alex
          Waygood in gh-106309(25).)

        * Deprecate *note typing.AnyStr: 5ac.  In Python 3.16, it will
          be removed from ‘typing.__all__’, and a *note
          DeprecationWarning: 1a3. will be emitted at runtime when it is
          imported or accessed.  It will be removed entirely in Python
          3.18.  Use the new *note type parameter syntax: 5ad. instead.
          (Contributed by Michael The in gh-107116(26).)

   * *note wave: 119.:

        * Deprecate the *note getmark(): 334, ‘setmark()’, and *note
          getmarkers(): 335. methods of the *note Wave_read: 336. and
          *note Wave_write: 337. classes, to be removed in Python 3.15.
          (Contributed by Victor Stinner in gh-105096(27).)

* Menu:

* Pending removal in Python 3.14: Pending removal in Python 3 14.
* Pending removal in Python 3.15: Pending removal in Python 3 15<3>.
* Pending removal in Python 3.16: Pending removal in Python 3 16<3>.
* Pending removal in Python 3.17: Pending removal in Python 3 17<2>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<3>.
* Pending removal in Python 3.19: Pending removal in Python 3 19<2>.
* Pending removal in future versions: Pending removal in future versions<3>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/81137

   (2) https://github.com/python/cpython/issues/80480

   (3) https://github.com/python/cpython/issues/105733

   (4) https://github.com/python/cpython/issues/105733

   (5) https://github.com/python/cpython/issues/89902

   (6) https://github.com/python/cpython/issues/109319

   (7) https://github.com/python/cpython/issues/88434

   (8) https://github.com/python/cpython/issues/117337

   (9) https://github.com/python/cpython/issues/109096

   (10) https://github.com/python/cpython/issues/109096

   (11) https://github.com/python/cpython/issues/66543

   (12) https://github.com/python/cpython/issues/56166

   (13) https://github.com/python/cpython/issues/88569

   (14) https://github.com/python/cpython/issues/116349

   (15) https://github.com/python/cpython/issues/64020

   (16) https://github.com/python/cpython/issues/107948

   (17) https://github.com/python/cpython/issues/108278

   (18) https://github.com/python/cpython/issues/108278

   (19) https://github.com/python/cpython/issues/73427

   (20) https://github.com/python/cpython/issues/115256

   (21) https://github.com/python/cpython/issues/112332

   (22) https://github.com/python/cpython/issues/105566

   (23) https://github.com/python/cpython/issues/105566

   (24) https://github.com/python/cpython/issues/105570

   (25) https://github.com/python/cpython/issues/106309

   (26) https://github.com/python/cpython/issues/107116

   (27) https://github.com/python/cpython/issues/105096


File: python.info,  Node: Pending removal in Python 3 14,  Next: Pending removal in Python 3 15<3>,  Up: New Deprecations

1.2.8.1 Pending removal in Python 3.14
......................................

   * *note argparse: 7.: The 'type', 'choices', and 'metavar' parameters
     of ‘argparse.BooleanOptionalAction’ are deprecated and will be
     removed in 3.14.  (Contributed by Nikita Sobolev in gh-92248(1).)

   * *note ast: 9.: The following features have been deprecated in
     documentation since Python 3.8, now cause a *note
     DeprecationWarning: 1a3. to be emitted at runtime when they are
     accessed or used, and will be removed in Python 3.14:

        * ‘ast.Num’

        * ‘ast.Str’

        * ‘ast.Bytes’

        * ‘ast.NameConstant’

        * ‘ast.Ellipsis’

     Use *note ast.Constant: 2ef. instead.  (Contributed by Serhiy
     Storchaka in gh-90953(2).)

   * *note asyncio: b.:

        * The child watcher classes ‘asyncio.MultiLoopChildWatcher’,
          ‘asyncio.FastChildWatcher’, ‘asyncio.AbstractChildWatcher’ and
          ‘asyncio.SafeChildWatcher’ are deprecated and will be removed
          in Python 3.14.  (Contributed by Kumar Aditya in gh-94597(3).)

        * ‘asyncio.set_child_watcher()’, ‘asyncio.get_child_watcher()’,
          ‘asyncio.AbstractEventLoopPolicy.set_child_watcher()’ and
          ‘asyncio.AbstractEventLoopPolicy.get_child_watcher()’ are
          deprecated and will be removed in Python 3.14.  (Contributed
          by Kumar Aditya in gh-94597(4).)

        * The *note get_event_loop(): 2f2. method of the default event
          loop policy now emits a *note DeprecationWarning: 1a3. if
          there is no current event loop set and it decides to create
          one.  (Contributed by Serhiy Storchaka and Guido van Rossum in
          gh-100160(5).)

   * *note email: 3f.: Deprecated the 'isdst' parameter in *note
     email.utils.localtime(): 2f7.  (Contributed by Alan Williams in
     gh-72346(6).)

   * *note importlib.abc: 7c. deprecated classes:

        * ‘importlib.abc.ResourceReader’

        * ‘importlib.abc.Traversable’

        * ‘importlib.abc.TraversableResources’

     Use *note importlib.resources.abc: 80. classes instead:

        * *note importlib.resources.abc.Traversable: 2fa.

        * *note importlib.resources.abc.TraversableResources: 2f9.

     (Contributed by Jason R. Coombs and Hugo van Kemenade in
     gh-93963(7).)

   * *note itertools: 85. had undocumented, inefficient, historically
     buggy, and inconsistent support for copy, deepcopy, and pickle
     operations.  This will be removed in 3.14 for a significant
     reduction in code volume and maintenance burden.  (Contributed by
     Raymond Hettinger in gh-101588(8).)

   * *note multiprocessing: 98.: The default start method will change to
     a safer one on Linux, BSDs, and other non-macOS POSIX platforms
     where ‘'fork'’ is currently the default (gh-84559(9)).  Adding a
     runtime warning about this was deemed too disruptive as the
     majority of code is not expected to care.  Use the *note
     get_context(): 24a. or *note set_start_method(): 24b. APIs to
     explicitly specify when your code 'requires' ‘'fork'’.  See *note
     コンテキストと開始方式: 1d5.

   * *note pathlib: a8.: *note is_relative_to(): 2fe. and *note
     relative_to(): 2fd.: passing additional arguments is deprecated.

   * *note pkgutil: ae.: ‘pkgutil.find_loader()’ and
     ‘pkgutil.get_loader()’ now raise *note DeprecationWarning: 1a3.;
     use *note importlib.util.find_spec(): 5af. instead.  (Contributed
     by Nikita Sobolev in gh-97850(10).)

   * *note pty: b6.:

        * ‘master_open()’: use *note pty.openpty(): 301.

        * ‘slave_open()’: use *note pty.openpty(): 301.

   * *note sqlite3: d4.:

        * ‘version’ and ‘version_info’.

        * *note execute(): 5b0. and *note executemany(): 5b1. if *note
          named placeholders: 5b2. are used and 'parameters' is a
          sequence instead of a *note dict: 183.

   * *note urllib: 10e.: ‘urllib.parse.Quoter’ is deprecated: it was not
     intended to be a public API. (Contributed by Gregory P. Smith in
     gh-88168(11).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/92248

   (2) https://github.com/python/cpython/issues/90953

   (3) https://github.com/python/cpython/issues/94597

   (4) https://github.com/python/cpython/issues/94597

   (5) https://github.com/python/cpython/issues/100160

   (6) https://github.com/python/cpython/issues/72346

   (7) https://github.com/python/cpython/issues/93963

   (8) https://github.com/python/cpython/issues/101588

   (9) https://github.com/python/cpython/issues/84559

   (10) https://github.com/python/cpython/issues/97850

   (11) https://github.com/python/cpython/issues/88168


File: python.info,  Node: Pending removal in Python 3 15<3>,  Next: Pending removal in Python 3 16<3>,  Prev: Pending removal in Python 3 14,  Up: New Deprecations

1.2.8.2 Pending removal in Python 3.15
......................................

   * The import system:

        * Setting *note __cached__: 321. on a module while failing to
          set *note __spec__.cached: 322. is deprecated.  In Python
          3.15, ‘__cached__’ will cease to be set or take into
          consideration by the import system or standard library.
          (gh-97879(1))

        * Setting *note __package__: 323. on a module while failing to
          set *note __spec__.parent: 324. is deprecated.  In Python
          3.15, ‘__package__’ will cease to be set or take into
          consideration by the import system or standard library.
          (gh-97879(2))

   * *note ctypes: 2e.:

        * The undocumented ‘ctypes.SetPointerType()’ function has been
          deprecated since Python 3.13.

   * *note http.server: 76.:

        * The obsolete and rarely used *note CGIHTTPRequestHandler: 325.
          has been deprecated since Python 3.13.  No direct replacement
          exists.  'Anything' is better than CGI to interface a web
          server with a request handler.

        * The ‘--cgi’ flag to the ‘python -m http.server’ command-line
          interface has been deprecated since Python 3.13.

   * *note importlib: 7b.:

        * ‘load_module()’ method: use ‘exec_module()’ instead.

   * *note locale: 8a.:

        * The *note getdefaultlocale(): 326. function has been
          deprecated since Python 3.11.  Its removal was originally
          planned for Python 3.13 (gh-90817(3)), but has been postponed
          to Python 3.15.  Use *note getlocale(): 327, *note
          setlocale(): 328, and *note getencoding(): 329. instead.
          (Contributed by Hugo van Kemenade in gh-111187(4).)

   * *note pathlib: a8.:

        * *note PurePath.is_reserved(): 32a. has been deprecated since
          Python 3.13.  Use *note os.path.isreserved(): 32b. to detect
          reserved paths on Windows.

   * *note platform: af.:

        * *note java_ver(): 32c. has been deprecated since Python 3.13.
          This function is only useful for Jython support, has a
          confusing API, and is largely untested.

   * *note sysconfig: e1.:

        * The 'check_home' argument of *note
          sysconfig.is_python_build(): 32d. has been deprecated since
          Python 3.12.

   * *note threading: f3.:

        * *note RLock(): 32e. will take no arguments in Python 3.15.
          Passing any arguments has been deprecated since Python 3.14,
          as the Python version does not permit any arguments, but the C
          version allows any number of positional or keyword arguments,
          ignoring every argument.

   * *note types: 109.:

        * *note types.CodeType: 32f.: Accessing *note co_lnotab: 330.
          was deprecated in PEP 626(5) since 3.10 and was planned to be
          removed in 3.12, but it only got a proper *note
          DeprecationWarning: 1a3. in 3.12.  May be removed in 3.15.
          (Contributed by Nikita Sobolev in gh-101866(6).)

   * *note typing: 10a.:

        * The undocumented keyword argument syntax for creating *note
          NamedTuple: 331. classes (for example, ‘Point =
          NamedTuple("Point", x=int, y=int)’) has been deprecated since
          Python 3.13.  Use the class-based syntax or the functional
          syntax instead.

        * When using the functional syntax of *note TypedDict: 332.s,
          failing to pass a value to the 'fields' parameter (‘TD =
          TypedDict("TD")’) or passing ‘None’ (‘TD = TypedDict("TD",
          None)’) has been deprecated since Python 3.13.  Use ‘class
          TD(TypedDict): pass’ or ‘TD = TypedDict("TD", {})’ to create a
          TypedDict with zero field.

        * The *note typing.no_type_check_decorator(): 333. decorator
          function has been deprecated since Python 3.13.  After eight
          years in the *note typing: 10a. module, it has yet to be
          supported by any major type checker.

   * *note wave: 119.:

        * The *note getmark(): 334, ‘setmark()’, and *note getmarkers():
          335. methods of the *note Wave_read: 336. and *note
          Wave_write: 337. classes have been deprecated since Python
          3.13.

   * *note zipimport: 138.:

        * *note load_module(): 338. has been deprecated since Python
          3.10.  Use *note exec_module(): 339. instead.  (Contributed by
          Jiahao Li in gh-125746(7).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97879

   (2) https://github.com/python/cpython/issues/97879

   (3) https://github.com/python/cpython/issues/90817

   (4) https://github.com/python/cpython/issues/111187

   (5) https://peps.python.org/pep-0626/

   (6) https://github.com/python/cpython/issues/101866

   (7) https://github.com/python/cpython/issues/125746


File: python.info,  Node: Pending removal in Python 3 16<3>,  Next: Pending removal in Python 3 17<2>,  Prev: Pending removal in Python 3 15<3>,  Up: New Deprecations

1.2.8.3 Pending removal in Python 3.16
......................................

   * The import system:

        * Setting *note __loader__: 33b. on a module while failing to
          set *note __spec__.loader: 33c. is deprecated.  In Python
          3.16, ‘__loader__’ will cease to be set or taken into
          consideration by the import system or the standard library.

   * *note array: 8.:

        * The ‘'u'’ format code (‘wchar_t’) has been deprecated in
          documentation since Python 3.3 and at runtime since Python
          3.13.  Use the ‘'w'’ format code (*note Py_UCS4: 33d.) for
          Unicode characters instead.

   * *note asyncio: b.:

        * ‘asyncio.iscoroutinefunction()’ is deprecated and will be
          removed in Python 3.16; use *note
          inspect.iscoroutinefunction(): 30d. instead.  (Contributed by
          Jiahao Li and Kumar Aditya in gh-122875(1).)

        * *note asyncio: b. policy system is deprecated and will be
          removed in Python 3.16.  In particular, the following classes
          and functions are deprecated:

             * *note asyncio.AbstractEventLoopPolicy: 30e.

             * *note asyncio.DefaultEventLoopPolicy: 30f.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 310.

             * *note asyncio.WindowsProactorEventLoopPolicy: 311.

             * *note asyncio.get_event_loop_policy(): 312.

             * *note asyncio.set_event_loop_policy(): 313.

          Users should use *note asyncio.run(): 2f3. or *note
          asyncio.Runner: 2f5. with 'loop_factory' to use the desired
          event loop implementation.

          For example, to use *note asyncio.SelectorEventLoop: 314. on
          Windows:

               import asyncio

               async def main():
                   ...

               asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)

          (Contributed by Kumar Aditya in gh-127949(2).)

   * *note builtins: 13.:

        * Bitwise inversion on boolean types, ‘~True’ or ‘~False’ has
          been deprecated since Python 3.12, as it produces surprising
          and unintuitive results (‘-2’ and ‘-1’).  Use ‘not x’ instead
          for the logical negation of a Boolean.  In the rare case that
          you need the bitwise inversion of the underlying integer,
          convert to ‘int’ explicitly (‘~int(x)’).

   * *note functools: 63.:

        * Calling the Python implementation of *note functools.reduce():
          21a. with 'function' or 'sequence' as keyword arguments has
          been deprecated since Python 3.14.

   * *note logging: 8b.:

     Support for custom logging handlers with the 'strm' argument is
     deprecated and scheduled for removal in Python 3.16.  Define
     handlers with the 'stream' argument instead.  (Contributed by
     Mariusz Felisiak in gh-115032(3).)

   * *note mimetypes: 93.:

        * Valid extensions start with a '.'  or are empty for *note
          mimetypes.MimeTypes.add_type(): 319.  Undotted extensions are
          deprecated and will raise a *note ValueError: 2ec. in Python
          3.16.  (Contributed by Hugo van Kemenade in gh-75223(4).)

   * *note shutil: ca.:

        * The ‘ExecError’ exception has been deprecated since Python
          3.14.  It has not been used by any function in ‘shutil’ since
          Python 3.4, and is now an alias of *note RuntimeError: 244.

   * *note symtable: de.:

        * The *note Class.get_methods: 31d. method has been deprecated
          since Python 3.14.

   * *note sys: df.:

        * The *note _enablelegacywindowsfsencoding(): 33e. function has
          been deprecated since Python 3.13.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 33f. environment variable
          instead.

   * *note sysconfig: e1.:

        * The ‘sysconfig.expand_makefile_vars()’ function has been
          deprecated since Python 3.14.  Use the ‘vars’ argument of
          *note sysconfig.get_paths(): 340. instead.

   * *note tarfile: e4.:

        * The undocumented and unused ‘TarFile.tarfile’ attribute has
          been deprecated since Python 3.13.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/122875

   (2) https://github.com/python/cpython/issues/127949

   (3) https://github.com/python/cpython/issues/115032

   (4) https://github.com/python/cpython/issues/75223


File: python.info,  Node: Pending removal in Python 3 17<2>,  Next: Pending removal in Python 3 18<3>,  Prev: Pending removal in Python 3 16<3>,  Up: New Deprecations

1.2.8.4 Pending removal in Python 3.17
......................................

   * *note collections.abc: 1f.:

        - *note collections.abc.ByteString: 342. is scheduled for
          removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 260. at runtime.  For
          use in type annotations, either use *note Buffer: 343. or a
          union that explicitly specifies the types your code supports
          (e.g., ‘bytes | bytearray | memoryview’).

          ‘ByteString’ was originally intended to be an abstract class
          that would serve as a supertype of both *note bytes: 192. and
          *note bytearray: 344.  However, since the ABC never had any
          methods, knowing that an object was an instance of
          ‘ByteString’ never actually told you anything useful about the
          object.  Other common buffer types such as *note memoryview:
          165. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(1) for more details.  (Contributed by Shantanu
          Jain in gh-91896(2).)

   * *note typing: 10a.:

        - Before Python 3.14, old-style unions were implemented using
          the private class ‘typing._UnionGenericAlias’.  This class is
          no longer needed for the implementation, but it has been
          retained for backward compatibility, with removal scheduled
          for Python 3.17.  Users should use documented introspection
          helpers like *note typing.get_origin(): 2ab. and *note
          typing.get_args(): 2ac. instead of relying on private
          implementation details.

        - *note typing.ByteString: 345, deprecated since Python 3.9, is
          scheduled for removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 260. at runtime.  For
          use in type annotations, either use *note Buffer: 343. or a
          union that explicitly specifies the types your code supports
          (e.g., ‘bytes | bytearray | memoryview’).

          ‘ByteString’ was originally intended to be an abstract class
          that would serve as a supertype of both *note bytes: 192. and
          *note bytearray: 344.  However, since the ABC never had any
          methods, knowing that an object was an instance of
          ‘ByteString’ never actually told you anything useful about the
          object.  Other common buffer types such as *note memoryview:
          165. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(3) for more details.  (Contributed by Shantanu
          Jain in gh-91896(4).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0688/#current-options

   (2) https://github.com/python/cpython/issues/91896

   (3) https://peps.python.org/pep-0688/#current-options

   (4) https://github.com/python/cpython/issues/91896


File: python.info,  Node: Pending removal in Python 3 18<3>,  Next: Pending removal in Python 3 19<2>,  Prev: Pending removal in Python 3 17<2>,  Up: New Deprecations

1.2.8.5 Pending removal in Python 3.18
......................................

   * *note decimal: 3a.:

        * The non-standard and undocumented *note Decimal: 1fe. format
          specifier ‘'N'’, which is only supported in the ‘decimal’
          module's C implementation, has been deprecated since Python
          3.13.  (Contributed by Serhiy Storchaka in gh-89902(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89902


File: python.info,  Node: Pending removal in Python 3 19<2>,  Next: Pending removal in future versions<3>,  Prev: Pending removal in Python 3 18<3>,  Up: New Deprecations

1.2.8.6 Pending removal in Python 3.19
......................................

   * *note ctypes: 2e.:

        * Implicitly switching to the MSVC-compatible struct layout by
          setting *note _pack_: 317. but not *note _layout_: 1e7. on
          non-Windows platforms.


File: python.info,  Node: Pending removal in future versions<3>,  Prev: Pending removal in Python 3 19<2>,  Up: New Deprecations

1.2.8.7 Pending removal in future versions
..........................................

The following APIs will be removed in the future, although there is
currently no date scheduled for their removal.

   * *note argparse: 7.:

        * Nesting argument groups and nesting mutually exclusive groups
          are deprecated.

        * Passing the undocumented keyword argument 'prefix_chars' to
          *note add_argument_group(): 2eb. is now deprecated.

        * The *note argparse.FileType: 30c. type converter is
          deprecated.

   * *note builtins: 13.:

        * Generators: ‘throw(type, exc, tb)’ and ‘athrow(type, exc, tb)’
          signature is deprecated: use ‘throw(exc)’ and ‘athrow(exc)’
          instead, the single argument signature.

        * Currently Python accepts numeric literals immediately followed
          by keywords, for example ‘0in x’, ‘1or x’, ‘0if 1else 2’.  It
          allows confusing and ambiguous expressions like ‘[0x1for x in
          y]’ (which can be interpreted as ‘[0x1 for x in y]’ or ‘[0x1f
          or x in y]’).  A syntax warning is raised if the numeric
          literal is immediately followed by one of keywords *note and:
          349, *note else: 17c, *note for: 34a, *note if: 181, *note in:
          34b, *note is: 34c. and *note or: 34d.  In a future release it
          will be changed to a syntax error.  (gh-87999(1))

        * Support for ‘__index__()’ and ‘__int__()’ method returning
          non-int type: these methods will be required to return an
          instance of a strict subclass of *note int: 19b.

        * Support for ‘__float__()’ method returning a strict subclass
          of *note float: 196.: these methods will be required to return
          an instance of *note float: 196.

        * Support for ‘__complex__()’ method returning a strict subclass
          of *note complex: 197.: these methods will be required to
          return an instance of *note complex: 197.

        * Passing a complex number as the 'real' or 'imag' argument in
          the *note complex(): 197. constructor is now deprecated; it
          should only be passed as a single positional argument.
          (Contributed by Serhiy Storchaka in gh-109218(2).)

   * *note calendar: 15.: ‘calendar.January’ and ‘calendar.February’
     constants are deprecated and replaced by *note calendar.JANUARY:
     34e. and *note calendar.FEBRUARY: 34f.  (Contributed by Prince
     Roshan in gh-103636(3).)

   * *note codecs: 1c.: use *note open(): 316. instead of *note
     codecs.open(): 315.  (gh-133038(4))

   * *note codeobject.co_lnotab: 330.: use the *note
     codeobject.co_lines(): 350. method instead.

   * *note datetime: 34.:

        * *note utcnow(): 351.: use
          ‘datetime.datetime.now(tz=datetime.UTC)’.

        * *note utcfromtimestamp(): 352.: use
          ‘datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)’.

   * *note gettext: 67.: Plural value must be an integer.

   * *note importlib: 7b.:

        * *note cache_from_source(): 353. 'debug_override' parameter is
          deprecated: use the 'optimization' parameter instead.

   * *note importlib.metadata: 7e.:

        * ‘EntryPoints’ tuple interface.

        * Implicit ‘None’ on return values.

   * *note logging: 8b.: the ‘warn()’ method has been deprecated since
     Python 3.3, use *note warning(): 354. instead.

   * *note mailbox: 8f.: Use of StringIO input and text mode is
     deprecated, use BytesIO and binary mode instead.

   * *note os: a5.: Calling *note os.register_at_fork(): 355. in
     multi-threaded process.

   * ‘pydoc.ErrorDuringImport’: A tuple value for 'exc_info' parameter
     is deprecated, use an exception instance.

   * *note re: be.: More strict rules are now applied for numerical
     group references and group names in regular expressions.  Only
     sequence of ASCII digits is now accepted as a numerical reference.
     The group name in bytes patterns and replacement strings can now
     only contain ASCII letters and digits and underscore.  (Contributed
     by Serhiy Storchaka in gh-91760(5).)

   * ‘sre_compile’, ‘sre_constants’ and ‘sre_parse’ modules.

   * *note shutil: ca.: *note rmtree(): 356.'s 'onerror' parameter is
     deprecated in Python 3.12; use the 'onexc' parameter instead.

   * *note ssl: d5. options and protocols:

        * *note ssl.SSLContext: 357. without protocol argument is
          deprecated.

        * *note ssl.SSLContext: 357.: *note set_npn_protocols(): 358.
          and ‘selected_npn_protocol()’ are deprecated: use ALPN
          instead.

        * ‘ssl.OP_NO_SSL*’ options

        * ‘ssl.OP_NO_TLS*’ options

        * ‘ssl.PROTOCOL_SSLv3’

        * ‘ssl.PROTOCOL_TLS’

        * ‘ssl.PROTOCOL_TLSv1’

        * ‘ssl.PROTOCOL_TLSv1_1’

        * ‘ssl.PROTOCOL_TLSv1_2’

        * ‘ssl.TLSVersion.SSLv3’

        * ‘ssl.TLSVersion.TLSv1’

        * ‘ssl.TLSVersion.TLSv1_1’

   * *note threading: f3. methods:

        * ‘threading.Condition.notifyAll()’: use *note notify_all():
          359.

        * ‘threading.Event.isSet()’: use *note is_set(): 35a.

        * ‘threading.Thread.isDaemon()’, *note
          threading.Thread.setDaemon(): 35b.: use *note
          threading.Thread.daemon: 35c. attribute.

        * ‘threading.Thread.getName()’, *note
          threading.Thread.setName(): 35d.: use *note
          threading.Thread.name: 2a0. attribute.

        * ‘threading.currentThread()’: use *note
          threading.current_thread(): 35e.

        * ‘threading.activeCount()’: use *note threading.active_count():
          35f.

   * *note typing.Text: 360. (gh-92332(6)).

   * The internal class ‘typing._UnionGenericAlias’ is no longer used to
     implement *note typing.Union: 2a8.  To preserve compatibility with
     users using this private class, a compatibility shim will be
     provided until at least Python 3.17.  (Contributed by Jelle
     Zijlstra in gh-105499(7).)

   * *note unittest.IsolatedAsyncioTestCase: 361.: it is deprecated to
     return a value that is not ‘None’ from a test case.

   * *note urllib.parse: 110. deprecated functions: *note urlparse():
     362. instead

        * ‘splitattr()’

        * ‘splithost()’

        * ‘splitnport()’

        * ‘splitpasswd()’

        * ‘splitport()’

        * ‘splitquery()’

        * ‘splittag()’

        * ‘splittype()’

        * ‘splituser()’

        * ‘splitvalue()’

        * ‘to_bytes()’

   * *note wsgiref: 11e.: ‘SimpleHandler.stdout.write()’ should not do
     partial writes.

   * *note xml.etree.ElementTree: 12b.: Testing the truth value of an
     *note Element: 363. is deprecated.  In a future release it will
     always return ‘True’.  Prefer explicit ‘len(elem)’ or ‘elem is not
     None’ tests instead.

   * *note sys._clear_type_cache(): 292. is deprecated: use *note
     sys._clear_internal_caches(): 364. instead.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/87999

   (2) https://github.com/python/cpython/issues/109218

   (3) https://github.com/python/cpython/issues/103636

   (4) https://github.com/python/cpython/issues/133038

   (5) https://github.com/python/cpython/issues/91760

   (6) https://github.com/python/cpython/issues/92332

   (7) https://github.com/python/cpython/issues/105499


File: python.info,  Node: CPython Bytecode Changes,  Next: C API の変更<2>,  Prev: New Deprecations,  Up: What's New In Python 3 13

1.2.9 CPython Bytecode Changes
------------------------------

   * The oparg of *note YIELD_VALUE: 5ba. is now ‘1’ if the yield is
     part of a yield-from or await, and ‘0’ otherwise.  The oparg of
     *note RESUME: 5bb. was changed to add a bit indicating if the
     except-depth is 1, which is needed to optimize closing of
     generators.  (Contributed by Irit Katriel in gh-111354(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/111354


File: python.info,  Node: C API の変更<2>,  Next: Build Changes,  Prev: CPython Bytecode Changes,  Up: What's New In Python 3 13

1.2.10 C API の変更
-------------------

* Menu:

* 新しい機能: 新しい機能<3>.
* Changed C APIs::
* Limited C API Changes::
* Removed C APIs: Removed C APIs<2>.
* Deprecated C APIs: Deprecated C APIs<2>.


File: python.info,  Node: 新しい機能<3>,  Next: Changed C APIs,  Up: C API の変更<2>

1.2.10.1 新しい機能
...................

   * Add the *note PyMonitoring C API: 485. for generating PEP 669(1)
     monitoring events:

        * *note PyMonitoringState: 5be.

        * *note PyMonitoring_FirePyStartEvent(): 5bf.

        * *note PyMonitoring_FirePyResumeEvent(): 5c0.

        * *note PyMonitoring_FirePyReturnEvent(): 5c1.

        * *note PyMonitoring_FirePyYieldEvent(): 5c2.

        * *note PyMonitoring_FireCallEvent(): 5c3.

        * *note PyMonitoring_FireLineEvent(): 5c4.

        * *note PyMonitoring_FireJumpEvent(): 5c5.

        * ‘PyMonitoring_FireBranchEvent’

        * *note PyMonitoring_FireCReturnEvent(): 5c6.

        * *note PyMonitoring_FirePyThrowEvent(): 5c7.

        * *note PyMonitoring_FireRaiseEvent(): 5c8.

        * *note PyMonitoring_FireCRaiseEvent(): 5c9.

        * *note PyMonitoring_FireReraiseEvent(): 5ca.

        * *note PyMonitoring_FireExceptionHandledEvent(): 5cb.

        * *note PyMonitoring_FirePyUnwindEvent(): 5cc.

        * *note PyMonitoring_FireStopIterationEvent(): 5cd.

        * *note PyMonitoring_EnterScope(): 5ce.

        * *note PyMonitoring_ExitScope(): 5cf.

     (Contributed by Irit Katriel in gh-111997(2)).

   * Add *note PyMutex: 484, a lightweight mutex that occupies a single
     byte, and the new *note PyMutex_Lock(): 5d0. and *note
     PyMutex_Unlock(): 5d1. functions.  ‘PyMutex_Lock()’ will release
     the *note GIL: 164. (if currently held) if the operation needs to
     block.  (Contributed by Sam Gross in gh-108724(3).)

   * Add the *note PyTime C API: 5d2. to provide access to system
     clocks:

        * *note PyTime_t: 5d3.

        * *note PyTime_MIN: 5d4. and *note PyTime_MAX: 5d5.

        * *note PyTime_AsSecondsDouble(): 5d6.

        * *note PyTime_Monotonic(): 5d7.

        * *note PyTime_MonotonicRaw(): 5d8.

        * *note PyTime_PerfCounter(): 5d9.

        * *note PyTime_PerfCounterRaw(): 5da.

        * *note PyTime_Time(): 5db.

        * *note PyTime_TimeRaw(): 5dc.

     (Contributed by Victor Stinner and Petr Viktorin in gh-110850(4).)

   * Add the *note PyDict_ContainsString(): 5dd. function with the same
     behavior as *note PyDict_Contains(): 5de, but 'key' is specified as
     a const char* UTF-8 encoded bytes string, rather than a *note
     PyObject: 5df.*.  (Contributed by Victor Stinner in gh-108314(5).)

   * Add the *note PyDict_GetItemRef(): 5e0. and *note
     PyDict_GetItemStringRef(): 421. functions, which behave similarly
     to *note PyDict_GetItemWithError(): 5e1, but return a *note strong
     reference: 5e2. instead of a *note borrowed reference: 3d7.
     Moreover, these functions return ‘-1’ on error, removing the need
     to check ‘PyErr_Occurred()’.  (Contributed by Victor Stinner in
     gh-106004(6).)

   * Add the *note PyDict_SetDefaultRef(): 5e3. function, which behaves
     similarly to *note PyDict_SetDefault(): 5e4, but returns a *note
     strong reference: 5e2. instead of a *note borrowed reference: 3d7.
     This function returns ‘-1’ on error, ‘0’ on insertion, and ‘1’ if
     the key was already present in the dictionary.  (Contributed by Sam
     Gross in gh-112066(7).)

   * Add the *note PyDict_Pop(): 422. and *note PyDict_PopString(): 5e5.
     functions to remove a key from a dictionary and optionally return
     the removed value.  This is similar to *note dict.pop(): 5e6,
     though there is no default value, and *note KeyError: 5e7. is not
     raised for missing keys.  (Contributed by Stefan Behnel and Victor
     Stinner in gh-111262(8).)

   * Add the *note PyMapping_GetOptionalItem(): 5e8. and *note
     PyMapping_GetOptionalItemString(): 5e9. functions as alternatives
     to *note PyObject_GetItem(): 5ea. and *note
     PyMapping_GetItemString(): 5eb. respectively.  The new functions do
     not raise *note KeyError: 5e7. if the requested key is missing from
     the mapping.  These variants are more convenient and faster if a
     missing key should not be treated as a failure.  (Contributed by
     Serhiy Storchaka in gh-106307(9).)

   * Add the *note PyObject_GetOptionalAttr(): 5ec. and *note
     PyObject_GetOptionalAttrString(): 5ed. functions as alternatives to
     *note PyObject_GetAttr(): 5ee. and *note PyObject_GetAttrString():
     5ef. respectively.  The new functions do not raise *note
     AttributeError: 5f0. if the requested attribute is not found on the
     object.  These variants are more convenient and faster if the
     missing attribute should not be treated as a failure.  (Contributed
     by Serhiy Storchaka in gh-106521(10).)

   * Add the *note PyErr_FormatUnraisable(): 5f1. function as an
     extension to *note PyErr_WriteUnraisable(): 5f2. that allows
     customizing the warning message.  (Contributed by Serhiy Storchaka
     in gh-108082(11).)

   * Add new functions that return a *note strong reference: 5e2.
     instead of a *note borrowed reference: 3d7. for frame locals,
     globals, and builtins, as part of *note PEP 667: 470.:

        * *note PyEval_GetFrameBuiltins(): 5f3. replaces *note
          PyEval_GetBuiltins(): 5f4.

        * *note PyEval_GetFrameGlobals(): 5f5. replaces *note
          PyEval_GetGlobals(): 5f6.

        * *note PyEval_GetFrameLocals(): 5f7. replaces *note
          PyEval_GetLocals(): 5f8.

     (Contributed by Mark Shannon and Tian Gao in gh-74929(12).)

   * Add the *note Py_GetConstant(): 5f9. and *note
     Py_GetConstantBorrowed(): 5fa. functions to get *note strong: 5e2.
     or *note borrowed: 3d7. references to constants.  For example,
     ‘Py_GetConstant(Py_CONSTANT_ZERO)’ returns a strong reference to
     the constant zero.  (Contributed by Victor Stinner in
     gh-115754(13).)

   * Add the *note PyImport_AddModuleRef(): 5fb. function as a
     replacement for *note PyImport_AddModule(): 5fc. that returns a
     *note strong reference: 5e2. instead of a *note borrowed reference:
     3d7.  (Contributed by Victor Stinner in gh-105922(14).)

   * Add the *note Py_IsFinalizing(): 5fd. function to check whether the
     main Python interpreter is *note shutting down: 479.  (Contributed
     by Victor Stinner in gh-108014(15).)

   * Add the *note PyList_GetItemRef(): 5fe. function as a replacement
     for *note PyList_GetItem(): 5ff. that returns a *note strong
     reference: 5e2. instead of a *note borrowed reference: 3d7.
     (Contributed by Sam Gross in gh-114329(16).)

   * Add the *note PyList_Extend(): 600. and *note PyList_Clear(): 601.
     functions, mirroring the Python *note list.extend(): 602. and *note
     list.clear(): 603. methods.  (Contributed by Victor Stinner in
     gh-111138(17).)

   * Add the *note PyLong_AsInt(): 604. function.  It behaves similarly
     to *note PyLong_AsLong(): 605, but stores the result in a C int
     instead of a C long.  (Contributed by Victor Stinner in
     gh-108014(18).)

   * Add the *note PyLong_AsNativeBytes(): 606, *note
     PyLong_FromNativeBytes(): 607, and *note
     PyLong_FromUnsignedNativeBytes(): 608. functions to simplify
     converting between native integer types and Python *note int: 19b.
     objects.  (Contributed by Steve Dower in gh-111140(19).)

   * Add *note PyModule_Add(): 609. function, which is similar to *note
     PyModule_AddObjectRef(): 60a. and *note PyModule_AddObject(): 60b,
     but always steals a reference to the value.  (Contributed by Serhiy
     Storchaka in gh-86493(20).)

   * Add the *note PyObject_GenericHash(): 60c. function that implements
     the default hashing function of a Python object.  (Contributed by
     Serhiy Storchaka in gh-113024(21).)

   * Add the *note Py_HashPointer(): 425. function to hash a raw
     pointer.  (Contributed by Victor Stinner in gh-111545(22).)

   * Add the *note PyObject_VisitManagedDict(): 60d. and *note
     PyObject_ClearManagedDict(): 60e. functions.  which must be called
     by the traverse and clear functions of a type using the *note
     Py_TPFLAGS_MANAGED_DICT: 60f. flag.  The pythoncapi-compat
     project(23) can be used to use these functions with Python 3.11 and
     3.12.  (Contributed by Victor Stinner in gh-107073(24).)

   * Add the *note PyRefTracer_SetTracer(): 610. and *note
     PyRefTracer_GetTracer(): 611. functions, which enable tracking
     object creation and destruction in the same way that the *note
     tracemalloc: 105. module does.  (Contributed by Pablo Galindo in
     gh-93502(25).)

   * Add the *note PySys_AuditTuple(): 612. function as an alternative
     to *note PySys_Audit(): 613. that takes event arguments as a Python
     *note tuple: 614. object.  (Contributed by Victor Stinner in
     gh-85283(26).)

   * Add the *note PyThreadState_GetUnchecked(): 423. function as an
     alternative to *note PyThreadState_Get(): 615. that doesn't kill
     the process with a fatal error if it is ‘NULL’.  The caller is
     responsible for checking if the result is ‘NULL’.  (Contributed by
     Victor Stinner in gh-108867(27).)

   * Add the *note PyType_GetFullyQualifiedName(): 616. function to get
     the type's fully qualified name.  The module name is prepended if
     *note type.__module__: 617. is a string and is not equal to either
     ‘'builtins'’ or ‘'__main__'’.  (Contributed by Victor Stinner in
     gh-111696(28).)

   * Add the *note PyType_GetModuleName(): 618. function to get the
     type's module name.  This is equivalent to getting the *note
     type.__module__: 617. attribute.  (Contributed by Eric Snow and
     Victor Stinner in gh-111696(29).)

   * Add the *note PyUnicode_EqualToUTF8AndSize(): 619. and *note
     PyUnicode_EqualToUTF8(): 61a. functions to compare a Unicode object
     with a const char* UTF-8 encoded string and ‘1’ if they are equal
     or ‘0’ otherwise.  These functions do not raise exceptions.
     (Contributed by Serhiy Storchaka in gh-110289(30).)

   * Add the *note PyWeakref_GetRef(): 3df. function as an alternative
     to *note PyWeakref_GetObject(): 3dd. that returns a *note strong
     reference: 5e2. or ‘NULL’ if the referent is no longer live.
     (Contributed by Victor Stinner in gh-105927(31).)

   * Add fixed variants of functions which silently ignore errors:

        * *note PyObject_HasAttrWithError(): 61b. replaces *note
          PyObject_HasAttr(): 61c.

        * *note PyObject_HasAttrStringWithError(): 61d. replaces *note
          PyObject_HasAttrString(): 61e.

        * *note PyMapping_HasKeyWithError(): 61f. replaces *note
          PyMapping_HasKey(): 620.

        * *note PyMapping_HasKeyStringWithError(): 621. replaces *note
          PyMapping_HasKeyString(): 622.

     The new functions return ‘-1’ for errors and the standard ‘1’ for
     true and ‘0’ for false.

     (Contributed by Serhiy Storchaka in gh-108511(32).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0669/

   (2) https://github.com/python/cpython/issues/111997

   (3) https://github.com/python/cpython/issues/108724

   (4) https://github.com/python/cpython/issues/110850

   (5) https://github.com/python/cpython/issues/108314

   (6) https://github.com/python/cpython/issues/106004

   (7) https://github.com/python/cpython/issues/112066

   (8) https://github.com/python/cpython/issues/111262

   (9) https://github.com/python/cpython/issues/106307

   (10) https://github.com/python/cpython/issues/106521

   (11) https://github.com/python/cpython/issues/108082

   (12) https://github.com/python/cpython/issues/74929

   (13) https://github.com/python/cpython/issues/115754

   (14) https://github.com/python/cpython/issues/105922

   (15) https://github.com/python/cpython/issues/108014

   (16) https://github.com/python/cpython/issues/114329

   (17) https://github.com/python/cpython/issues/111138

   (18) https://github.com/python/cpython/issues/108014

   (19) https://github.com/python/cpython/issues/111140

   (20) https://github.com/python/cpython/issues/86493

   (21) https://github.com/python/cpython/issues/113024

   (22) https://github.com/python/cpython/issues/111545

   (23) https://github.com/python/pythoncapi-compat/

   (24) https://github.com/python/cpython/issues/107073

   (25) https://github.com/python/cpython/issues/93502

   (26) https://github.com/python/cpython/issues/85283

   (27) https://github.com/python/cpython/issues/108867

   (28) https://github.com/python/cpython/issues/111696

   (29) https://github.com/python/cpython/issues/111696

   (30) https://github.com/python/cpython/issues/110289

   (31) https://github.com/python/cpython/issues/105927

   (32) https://github.com/python/cpython/issues/108511


File: python.info,  Node: Changed C APIs,  Next: Limited C API Changes,  Prev: 新しい機能<3>,  Up: C API の変更<2>

1.2.10.2 Changed C APIs
.......................

   * The 'keywords' parameter of *note PyArg_ParseTupleAndKeywords():
     624. and *note PyArg_VaParseTupleAndKeywords(): 625. now has type
     char *const* in C and const char *const* in C++, instead of char**.
     In C++, this makes these functions compatible with arguments of
     type const char *const*, const char**, or char *const* without an
     explicit type cast.  In C, the functions only support arguments of
     type char *const*.  This can be overridden with the *note
     PY_CXX_CONST: 626. macro.  (Contributed by Serhiy Storchaka in
     gh-65210(1).)

   * *note PyArg_ParseTupleAndKeywords(): 624. now supports non-ASCII
     keyword parameter names.  (Contributed by Serhiy Storchaka in
     gh-110815(2).)

   * The ‘PyCode_GetFirstFree()’ function is now unstable API and is now
     named *note PyUnstable_Code_GetFirstFree(): 627.  (Contributed by
     Bogdan Romanyuk in gh-115781(3).)

   * The *note PyDict_GetItem(): 628, *note PyDict_GetItemString(): 629,
     *note PyMapping_HasKey(): 620, *note PyMapping_HasKeyString(): 622,
     *note PyObject_HasAttr(): 61c, *note PyObject_HasAttrString(): 61e,
     and *note PySys_GetObject(): 62a. functions, each of which clears
     all errors which occurred when calling them now reports these
     errors using *note sys.unraisablehook(): 507.  You may replace them
     with other functions as recommended in the documentation.
     (Contributed by Serhiy Storchaka in gh-106672(4).)

   * Add support for the ‘%T’, ‘%#T’, ‘%N’ and ‘%#N’ formats to *note
     PyUnicode_FromFormat(): 62b.:

        * ‘%T’: Get the fully qualified name of an object type

        * ‘%#T’: As above, but use a colon as the separator

        * ‘%N’: Get the fully qualified name of a type

        * ‘%#N’: As above, but use a colon as the separator

     See PEP 737(5) for more information.  (Contributed by Victor
     Stinner in gh-111696(6).)

   * You no longer have to define the ‘PY_SSIZE_T_CLEAN’ macro before
     including ‘Python.h’ when using ‘#’ formats in *note format codes:
     62c.  APIs accepting the format codes always use ‘Py_ssize_t’ for
     ‘#’ formats.  (Contributed by Inada Naoki in gh-104922(7).)

   * If Python is built in *note debug mode: 509. or *note with
     assertions: 62d, *note PyTuple_SET_ITEM(): 62e. and *note
     PyList_SET_ITEM(): 62f. now check the index argument with an
     assertion.  (Contributed by Victor Stinner in gh-106168(8).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/65210

   (2) https://github.com/python/cpython/issues/110815

   (3) https://github.com/python/cpython/issues/115781

   (4) https://github.com/python/cpython/issues/106672

   (5) https://peps.python.org/pep-0737/

   (6) https://github.com/python/cpython/issues/111696

   (7) https://github.com/python/cpython/issues/104922

   (8) https://github.com/python/cpython/issues/106168


File: python.info,  Node: Limited C API Changes,  Next: Removed C APIs<2>,  Prev: Changed C APIs,  Up: C API の変更<2>

1.2.10.3 Limited C API Changes
..............................

   * The following functions are now included in the Limited C API:

        * *note PyMem_RawMalloc(): 631.

        * *note PyMem_RawCalloc(): 632.

        * *note PyMem_RawRealloc(): 633.

        * *note PyMem_RawFree(): 634.

        * *note PySys_Audit(): 613.

        * *note PySys_AuditTuple(): 612.

        * *note PyType_GetModuleByDef(): 635.

     (Contributed by Victor Stinner in gh-85283(1) and gh-116936(2).)

   * Python built with *note -with-trace-refs: 636. (tracing references)
     now supports the *note Limited API: 637.  (Contributed by Victor
     Stinner in gh-108634(3).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/85283

   (2) https://github.com/python/cpython/issues/116936

   (3) https://github.com/python/cpython/issues/108634


File: python.info,  Node: Removed C APIs<2>,  Next: Deprecated C APIs<2>,  Prev: Limited C API Changes,  Up: C API の変更<2>

1.2.10.4 Removed C APIs
.......................

   * Remove several functions, macros, variables, etc with names
     prefixed by ‘_Py’ or ‘_PY’ (which are considered private).  If your
     project is affected by one of these removals and you believe that
     the removed API should remain available, please *note open a new
     issue: 557. to request a public C API and add ‘cc: @vstinner’ to
     the issue to notify Victor Stinner.  (Contributed by Victor Stinner
     in gh-106320(1).)

   * Remove old buffer protocols deprecated in Python 3.0.  Use *note
     バッファプロトコル (buffer Protocol): 260. instead.

        * ‘PyObject_CheckReadBuffer()’: Use *note
          PyObject_CheckBuffer(): 639. to test whether the object
          supports the buffer protocol.  Note that *note
          PyObject_CheckBuffer(): 639. doesn't guarantee that *note
          PyObject_GetBuffer(): 63a. will succeed.  To test if the
          object is actually readable, see the next example of *note
          PyObject_GetBuffer(): 63a.

        * ‘PyObject_AsCharBuffer()’, ‘PyObject_AsReadBuffer()’: Use
          *note PyObject_GetBuffer(): 63a. and *note PyBuffer_Release():
          63b. instead:

               Py_buffer view;
               if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) < 0) {
                   return NULL;
               }
               // Use `view.buf` and `view.len` to read from the buffer.
               // You may need to cast buf as `(const char*)view.buf`.
               PyBuffer_Release(&view);

        * ‘PyObject_AsWriteBuffer()’: Use *note PyObject_GetBuffer():
          63a. and *note PyBuffer_Release(): 63b. instead:

               Py_buffer view;
               if (PyObject_GetBuffer(obj, &view, PyBUF_WRITABLE) < 0) {
                   return NULL;
               }
               // Use `view.buf` and `view.len` to write to the buffer.
               PyBuffer_Release(&view);

     (Contributed by Inada Naoki in gh-85275(2).)

   * Remove various functions deprecated in Python 3.9:

        * ‘PyEval_CallObject()’, ‘PyEval_CallObjectWithKeywords()’: Use
          *note PyObject_CallNoArgs(): 63c. or *note PyObject_Call():
          63d. instead.

               警告: In *note PyObject_Call(): 63d, positional arguments
               must be a *note tuple: 614. and must not be ‘NULL’, and
               keyword arguments must be a *note dict: 183. or ‘NULL’,
               whereas the removed functions checked argument types and
               accepted ‘NULL’ positional and keyword arguments.  To
               replace ‘PyEval_CallObjectWithKeywords(func, NULL,
               kwargs)’ with *note PyObject_Call(): 63d, pass an empty
               tuple as positional arguments using *note PyTuple_New(0):
               63e.

        * ‘PyEval_CallFunction()’: Use *note PyObject_CallFunction():
          63f. instead.

        * ‘PyEval_CallMethod()’: Use *note PyObject_CallMethod(): 640.
          instead.

        * ‘PyCFunction_Call()’: Use *note PyObject_Call(): 63d. instead.

     (Contributed by Victor Stinner in gh-105107(3).)

   * Remove the following old functions to configure the Python
     initialization, deprecated in Python 3.11:

        * ‘PySys_AddWarnOptionUnicode()’: Use *note
          PyConfig.warnoptions: 641. instead.

        * ‘PySys_AddWarnOption()’: Use *note PyConfig.warnoptions: 641.
          instead.

        * ‘PySys_AddXOption()’: Use *note PyConfig.xoptions: 642.
          instead.

        * ‘PySys_HasWarnOptions()’: Use *note PyConfig.xoptions: 642.
          instead.

        * ‘PySys_SetPath()’: Set *note PyConfig.module_search_paths:
          643. instead.

        * ‘Py_SetPath()’: Set *note PyConfig.module_search_paths: 643.
          instead.

        * ‘Py_SetStandardStreamEncoding()’: Set *note
          PyConfig.stdio_encoding: 644. instead, and set also maybe
          *note PyConfig.legacy_windows_stdio: 41a. (on Windows).

        * ‘_Py_SetProgramFullPath()’: Set *note PyConfig.executable:
          645. instead.

     Use the new *note PyConfig: 3f7. API of the *note Python
     Initialization Configuration: 646. instead ( PEP 587(4)), added to
     Python 3.8.  (Contributed by Victor Stinner in gh-105145(5).)

   * Remove ‘PyEval_AcquireLock()’ and ‘PyEval_ReleaseLock()’ functions,
     deprecated in Python 3.2.  They didn't update the current thread
     state.  They can be replaced with:

        * *note PyEval_SaveThread(): 647. and *note
          PyEval_RestoreThread(): 648.;

        * low-level *note PyEval_AcquireThread(): 649. and *note
          PyEval_RestoreThread(): 648.;

        * or *note PyGILState_Ensure(): 64a. and *note
          PyGILState_Release(): 64b.

     (Contributed by Victor Stinner in gh-105182(6).)

   * Remove the ‘PyEval_ThreadsInitialized()’ function, deprecated in
     Python 3.9.  Since Python 3.7, ‘Py_Initialize()’ always creates the
     GIL: calling ‘PyEval_InitThreads()’ does nothing and
     ‘PyEval_ThreadsInitialized()’ always returns non-zero.
     (Contributed by Victor Stinner in gh-105182(7).)

   * Remove the ‘_PyInterpreterState_Get()’ alias to *note
     PyInterpreterState_Get(): 64c. which was kept for backward
     compatibility with Python 3.8.  The pythoncapi-compat project(8)
     can be used to get *note PyInterpreterState_Get(): 64c. on Python
     3.8 and older.  (Contributed by Victor Stinner in gh-106320(9).)

   * Remove the private ‘_PyObject_FastCall()’ function: use
     ‘PyObject_Vectorcall()’ which is available since Python 3.8 ( PEP
     590(10)).  (Contributed by Victor Stinner in gh-106023(11).)

   * Remove the ‘cpython/pytime.h’ header file, which only contained
     private functions.  (Contributed by Victor Stinner in
     gh-106316(12).)

   * Remove the undocumented ‘PY_TIMEOUT_MAX’ constant from the limited
     C API. (Contributed by Victor Stinner in gh-110014(13).)

   * Remove the old trashcan macros ‘Py_TRASHCAN_SAFE_BEGIN’ and
     ‘Py_TRASHCAN_SAFE_END’.  Replace both with the new macros
     ‘Py_TRASHCAN_BEGIN’ and ‘Py_TRASHCAN_END’.  (Contributed by Irit
     Katriel in gh-105111(14).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/106320

   (2) https://github.com/python/cpython/issues/85275

   (3) https://github.com/python/cpython/issues/105107

   (4) https://peps.python.org/pep-0587/

   (5) https://github.com/python/cpython/issues/105145

   (6) https://github.com/python/cpython/issues/105182

   (7) https://github.com/python/cpython/issues/105182

   (8) https://github.com/python/pythoncapi-compat/

   (9) https://github.com/python/cpython/issues/106320

   (10) https://peps.python.org/pep-0590/

   (11) https://github.com/python/cpython/issues/106023

   (12) https://github.com/python/cpython/issues/106316

   (13) https://github.com/python/cpython/issues/110014

   (14) https://github.com/python/cpython/issues/105111


File: python.info,  Node: Deprecated C APIs<2>,  Prev: Removed C APIs<2>,  Up: C API の変更<2>

1.2.10.5 Deprecated C APIs
..........................

   * Deprecate old Python initialization functions:

        * *note PySys_ResetWarnOptions(): 3f4.: Clear *note
          sys.warnoptions: 3f5. and ‘warnings.filters’ instead.

        * *note Py_GetExecPrefix(): 3e9.: Get *note sys.exec_prefix:
          3eb. instead.

        * *note Py_GetPath(): 3e3.: Get *note sys.path: 3e4. instead.

        * *note Py_GetPrefix(): 3e5.: Get *note sys.prefix: 3e7.
          instead.

        * *note Py_GetProgramFullPath(): 3ec.: Get *note sys.executable:
          3ed. instead.

        * *note Py_GetProgramName(): 3ee.: Get *note sys.executable:
          3ed. instead.

        * *note Py_GetPythonHome(): 3ef.: Get *note PyConfig.home: 3f3.
          or the *note PYTHONHOME: 3f0. environment variable instead.

     (Contributed by Victor Stinner in gh-105145(1).)

   * *note Soft deprecate: 23d. the *note PyEval_GetBuiltins(): 5f4,
     *note PyEval_GetGlobals(): 5f6, and *note PyEval_GetLocals(): 5f8.
     functions, which return a *note borrowed reference: 3d7.  (Soft
     deprecated as part of PEP 667(2).)

   * Deprecate the *note PyImport_ImportModuleNoBlock(): 3db. function,
     which is just an alias to *note PyImport_ImportModule(): 3dc. since
     Python 3.3.  (Contributed by Victor Stinner in gh-105396(3).)

   * *note Soft deprecate: 23d. the *note PyModule_AddObject(): 60b.
     function.  It should be replaced with *note PyModule_Add(): 609. or
     *note PyModule_AddObjectRef(): 60a.  (Contributed by Serhiy
     Storchaka in gh-86493(4).)

   * Deprecate the old ‘Py_UNICODE’ and ‘PY_UNICODE_TYPE’ types and the
     ‘Py_UNICODE_WIDE’ define.  Use the ‘wchar_t’ type directly instead.
     Since Python 3.3, ‘Py_UNICODE’ and ‘PY_UNICODE_TYPE’ are just
     aliases to ‘wchar_t’.  (Contributed by Victor Stinner in
     gh-105156(5).)

   * Deprecate the *note PyWeakref_GetObject(): 3dd. and *note
     PyWeakref_GET_OBJECT(): 3de. functions, which return a *note
     borrowed reference: 3d7.  Replace them with the new *note
     PyWeakref_GetRef(): 3df. function, which returns a *note strong
     reference: 5e2.  The pythoncapi-compat project(6) can be used to
     get *note PyWeakref_GetRef(): 3df. on Python 3.12 and older.
     (Contributed by Victor Stinner in gh-105927(7).)

* Menu:

* Pending removal in Python 3.14: Pending removal in Python 3 14<2>.
* Pending removal in Python 3.15: Pending removal in Python 3 15<4>.
* Pending removal in Python 3.16: Pending removal in Python 3 16<4>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<4>.
* Pending removal in future versions: Pending removal in future versions<4>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/105145

   (2) https://peps.python.org/pep-0667/

   (3) https://github.com/python/cpython/issues/105396

   (4) https://github.com/python/cpython/issues/86493

   (5) https://github.com/python/cpython/issues/105156

   (6) https://github.com/python/pythoncapi-compat/

   (7) https://github.com/python/cpython/issues/105927


File: python.info,  Node: Pending removal in Python 3 14<2>,  Next: Pending removal in Python 3 15<4>,  Up: Deprecated C APIs<2>

1.2.10.6 Pending removal in Python 3.14
.......................................

   * The ‘ma_version_tag’ field in *note PyDictObject: 64f. for
     extension modules ( PEP 699(1); gh-101193(2)).

   * Creating *note immutable types: 3cf. with mutable bases
     (gh-95388(3)).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0699/

   (2) https://github.com/python/cpython/issues/101193

   (3) https://github.com/python/cpython/issues/95388


File: python.info,  Node: Pending removal in Python 3 15<4>,  Next: Pending removal in Python 3 16<4>,  Prev: Pending removal in Python 3 14<2>,  Up: Deprecated C APIs<2>

1.2.10.7 Pending removal in Python 3.15
.......................................

   * The *note PyImport_ImportModuleNoBlock(): 3db.: Use *note
     PyImport_ImportModule(): 3dc. instead.

   * *note PyWeakref_GetObject(): 3dd. and *note PyWeakref_GET_OBJECT():
     3de.: Use *note PyWeakref_GetRef(): 3df. instead.  The
     pythoncapi-compat project(1) can be used to get *note
     PyWeakref_GetRef(): 3df. on Python 3.12 and older.

   * *note Py_UNICODE: 3e0. type and the ‘Py_UNICODE_WIDE’ macro: Use
     ‘wchar_t’ instead.

   * ‘PyUnicode_AsDecodedObject()’: Use *note PyCodec_Decode(): 3e1.
     instead.

   * ‘PyUnicode_AsDecodedUnicode()’: Use *note PyCodec_Decode(): 3e1.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note str: 169, such as *note bytes: 192.

   * ‘PyUnicode_AsEncodedObject()’: Use *note PyCodec_Encode(): 3e2.
     instead.

   * ‘PyUnicode_AsEncodedUnicode()’: Use *note PyCodec_Encode(): 3e2.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note bytes: 192, such as *note str: 169.

   * Python initialization functions, deprecated in Python 3.13:

        * *note Py_GetPath(): 3e3.: Use *note
          PyConfig_Get("module_search_paths"): 37c. (*note sys.path:
          3e4.) instead.

        * *note Py_GetPrefix(): 3e5.: Use *note
          PyConfig_Get("base_prefix"): 37c. (*note sys.base_prefix:
          3e6.) instead.  Use *note PyConfig_Get("prefix"): 37c. (*note
          sys.prefix: 3e7.) if *note virtual environments: 3e8. need to
          be handled.

        * *note Py_GetExecPrefix(): 3e9.: Use *note
          PyConfig_Get("base_exec_prefix"): 37c. (*note
          sys.base_exec_prefix: 3ea.) instead.  Use *note
          PyConfig_Get("exec_prefix"): 37c. (*note sys.exec_prefix:
          3eb.) if *note virtual environments: 3e8. need to be handled.

        * *note Py_GetProgramFullPath(): 3ec.: Use *note
          PyConfig_Get("executable"): 37c. (*note sys.executable: 3ed.)
          instead.

        * *note Py_GetProgramName(): 3ee.: Use *note
          PyConfig_Get("executable"): 37c. (*note sys.executable: 3ed.)
          instead.

        * *note Py_GetPythonHome(): 3ef.: Use *note
          PyConfig_Get("home"): 37c. or the *note PYTHONHOME: 3f0.
          environment variable instead.

     The pythoncapi-compat project(2) can be used to get *note
     PyConfig_Get(): 37c. on Python 3.13 and older.

   * Functions to configure Python's initialization, deprecated in
     Python 3.11:

        * ‘PySys_SetArgvEx()’: Set *note PyConfig.argv: 3f1. instead.

        * ‘PySys_SetArgv()’: Set *note PyConfig.argv: 3f1. instead.

        * ‘Py_SetProgramName()’: Set *note PyConfig.program_name: 3f2.
          instead.

        * ‘Py_SetPythonHome()’: Set *note PyConfig.home: 3f3. instead.

        * *note PySys_ResetWarnOptions(): 3f4.: Clear *note
          sys.warnoptions: 3f5. and ‘warnings.filters’ instead.

     The *note Py_InitializeFromConfig(): 3f6. API should be used with
     *note PyConfig: 3f7. instead.

   * Global configuration variables:

        * *note Py_DebugFlag: 3f8.: Use *note PyConfig.parser_debug:
          3f9. or *note PyConfig_Get("parser_debug"): 37c. instead.

        * *note Py_VerboseFlag: 3fa.: Use *note PyConfig.verbose: 3fb.
          or *note PyConfig_Get("verbose"): 37c. instead.

        * *note Py_QuietFlag: 3fc.: Use *note PyConfig.quiet: 3fd. or
          *note PyConfig_Get("quiet"): 37c. instead.

        * *note Py_InteractiveFlag: 3fe.: Use *note
          PyConfig.interactive: 3ff. or *note
          PyConfig_Get("interactive"): 37c. instead.

        * *note Py_InspectFlag: 400.: Use *note PyConfig.inspect: 401.
          or *note PyConfig_Get("inspect"): 37c. instead.

        * *note Py_OptimizeFlag: 402.: Use *note
          PyConfig.optimization_level: 403. or *note
          PyConfig_Get("optimization_level"): 37c. instead.

        * *note Py_NoSiteFlag: 404.: Use *note PyConfig.site_import:
          405. or *note PyConfig_Get("site_import"): 37c. instead.

        * *note Py_BytesWarningFlag: 406.: Use *note
          PyConfig.bytes_warning: 407. or *note
          PyConfig_Get("bytes_warning"): 37c. instead.

        * *note Py_FrozenFlag: 408.: Use *note
          PyConfig.pathconfig_warnings: 409. or *note
          PyConfig_Get("pathconfig_warnings"): 37c. instead.

        * *note Py_IgnoreEnvironmentFlag: 40a.: Use *note
          PyConfig.use_environment: 40b. or *note
          PyConfig_Get("use_environment"): 37c. instead.

        * *note Py_DontWriteBytecodeFlag: 40c.: Use *note
          PyConfig.write_bytecode: 40d. or *note
          PyConfig_Get("write_bytecode"): 37c. instead.

        * *note Py_NoUserSiteDirectory: 40e.: Use *note
          PyConfig.user_site_directory: 40f. or *note
          PyConfig_Get("user_site_directory"): 37c. instead.

        * *note Py_UnbufferedStdioFlag: 410.: Use *note
          PyConfig.buffered_stdio: 411. or *note
          PyConfig_Get("buffered_stdio"): 37c. instead.

        * *note Py_HashRandomizationFlag: 412.: Use *note
          PyConfig.use_hash_seed: 413. and *note PyConfig.hash_seed:
          414. or *note PyConfig_Get("hash_seed"): 37c. instead.

        * *note Py_IsolatedFlag: 415.: Use *note PyConfig.isolated: 416.
          or *note PyConfig_Get("isolated"): 37c. instead.

        * *note Py_LegacyWindowsFSEncodingFlag: 417.: Use *note
          PyPreConfig.legacy_windows_fs_encoding: 418. or *note
          PyConfig_Get("legacy_windows_fs_encoding"): 37c. instead.

        * *note Py_LegacyWindowsStdioFlag: 419.: Use *note
          PyConfig.legacy_windows_stdio: 41a. or *note
          PyConfig_Get("legacy_windows_stdio"): 37c. instead.

        * ‘Py_FileSystemDefaultEncoding’,
          ‘Py_HasFileSystemDefaultEncoding’: Use *note
          PyConfig.filesystem_encoding: 41b. or *note
          PyConfig_Get("filesystem_encoding"): 37c. instead.

        * ‘Py_FileSystemDefaultEncodeErrors’: Use *note
          PyConfig.filesystem_errors: 41c. or *note
          PyConfig_Get("filesystem_errors"): 37c. instead.

        * ‘Py_UTF8Mode’: Use *note PyPreConfig.utf8_mode: 41d. or *note
          PyConfig_Get("utf8_mode"): 37c. instead.  (see *note
          Py_PreInitialize(): 41e.)

     The *note Py_InitializeFromConfig(): 3f6. API should be used with
     *note PyConfig: 3f7. to set these options.  Or *note
     PyConfig_Get(): 37c. can be used to get these options at runtime.

   ---------- Footnotes ----------

   (1) https://github.com/python/pythoncapi-compat/

   (2) https://github.com/python/pythoncapi-compat/


File: python.info,  Node: Pending removal in Python 3 16<4>,  Next: Pending removal in Python 3 18<4>,  Prev: Pending removal in Python 3 15<4>,  Up: Deprecated C APIs<2>

1.2.10.8 Pending removal in Python 3.16
.......................................

   * The bundled copy of ‘libmpdec’.


File: python.info,  Node: Pending removal in Python 3 18<4>,  Next: Pending removal in future versions<4>,  Prev: Pending removal in Python 3 16<4>,  Up: Deprecated C APIs<2>

1.2.10.9 Pending removal in Python 3.18
.......................................

   * The following private functions are deprecated and planned for
     removal in Python 3.18:

        * ‘_PyBytes_Join()’: use *note PyBytes_Join(): 383.

        * ‘_PyDict_GetItemStringWithError()’: use *note
          PyDict_GetItemStringRef(): 421.

        * ‘_PyDict_Pop()’: use *note PyDict_Pop(): 422.

        * ‘_PyLong_Sign()’: use *note PyLong_GetSign(): 39a.

        * ‘_PyLong_FromDigits()’ and ‘_PyLong_New()’: use *note
          PyLongWriter_Create(): 3aa.

        * ‘_PyThreadState_UncheckedGet()’: use *note
          PyThreadState_GetUnchecked(): 423.

        * ‘_PyUnicode_AsString()’: use *note PyUnicode_AsUTF8(): 424.

        * ‘_PyUnicodeWriter_Init()’: replace
          ‘_PyUnicodeWriter_Init(&writer)’ with *note writer =
          PyUnicodeWriter_Create(0): 3b4.

        * ‘_PyUnicodeWriter_Finish()’: replace
          ‘_PyUnicodeWriter_Finish(&writer)’ with *note
          PyUnicodeWriter_Finish(writer): 3b7.

        * ‘_PyUnicodeWriter_Dealloc()’: replace
          ‘_PyUnicodeWriter_Dealloc(&writer)’ with *note
          PyUnicodeWriter_Discard(writer): 3b6.

        * ‘_PyUnicodeWriter_WriteChar()’: replace
          ‘_PyUnicodeWriter_WriteChar(&writer, ch)’ with *note
          PyUnicodeWriter_WriteChar(writer, ch): 3ba.

        * ‘_PyUnicodeWriter_WriteStr()’: replace
          ‘_PyUnicodeWriter_WriteStr(&writer, str)’ with *note
          PyUnicodeWriter_WriteStr(writer, str): 3bc.

        * ‘_PyUnicodeWriter_WriteSubstring()’: replace
          ‘_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)’
          with *note PyUnicodeWriter_WriteSubstring(writer, str, start,
          end): 3bd.

        * ‘_PyUnicodeWriter_WriteASCIIString()’: replace
          ‘_PyUnicodeWriter_WriteASCIIString(&writer, str)’ with *note
          PyUnicodeWriter_WriteASCII(writer, str): 3b9.

        * ‘_PyUnicodeWriter_WriteLatin1String()’: replace
          ‘_PyUnicodeWriter_WriteLatin1String(&writer, str)’ with *note
          PyUnicodeWriter_WriteUTF8(writer, str): 3bf.

        * ‘_PyUnicodeWriter_Prepare()’: (no replacement).

        * ‘_PyUnicodeWriter_PrepareKind()’: (no replacement).

        * ‘_Py_HashPointer()’: use *note Py_HashPointer(): 425.

        * ‘_Py_fopen_obj()’: use *note Py_fopen(): 393.

     The pythoncapi-compat project(1) can be used to get these new
     public functions on Python 3.13 and older.  (Contributed by Victor
     Stinner in gh-128863(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/pythoncapi-compat/

   (2) https://github.com/python/cpython/issues/128863


File: python.info,  Node: Pending removal in future versions<4>,  Prev: Pending removal in Python 3 18<4>,  Up: Deprecated C APIs<2>

1.2.10.10 Pending removal in future versions
............................................

The following APIs are deprecated and will be removed, although there is
currently no date scheduled for their removal.

   * *note Py_TPFLAGS_HAVE_FINALIZE: 427.: Unneeded since Python 3.8.

   * *note PyErr_Fetch(): 428.: Use *note PyErr_GetRaisedException():
     429. instead.

   * *note PyErr_NormalizeException(): 42a.: Use *note
     PyErr_GetRaisedException(): 429. instead.

   * *note PyErr_Restore(): 42b.: Use *note PyErr_SetRaisedException():
     42c. instead.

   * *note PyModule_GetFilename(): 42d.: Use *note
     PyModule_GetFilenameObject(): 42e. instead.

   * *note PyOS_AfterFork(): 42f.: Use *note PyOS_AfterFork_Child():
     430. instead.

   * *note PySlice_GetIndicesEx(): 431.: Use *note PySlice_Unpack():
     432. and *note PySlice_AdjustIndices(): 433. instead.

   * *note PyUnicode_READY(): 434.: Unneeded since Python 3.12

   * ‘PyErr_Display()’: Use *note PyErr_DisplayException(): 435.
     instead.

   * ‘_PyErr_ChainExceptions()’: Use ‘_PyErr_ChainExceptions1()’
     instead.

   * ‘PyBytesObject.ob_shash’ member: call *note PyObject_Hash(): 436.
     instead.

   * Thread Local Storage (TLS) API:

        * *note PyThread_create_key(): 437.: Use *note
          PyThread_tss_alloc(): 438. instead.

        * *note PyThread_delete_key(): 439.: Use *note
          PyThread_tss_free(): 43a. instead.

        * *note PyThread_set_key_value(): 43b.: Use *note
          PyThread_tss_set(): 43c. instead.

        * *note PyThread_get_key_value(): 43d.: Use *note
          PyThread_tss_get(): 43e. instead.

        * *note PyThread_delete_key_value(): 43f.: Use *note
          PyThread_tss_delete(): 440. instead.

        * *note PyThread_ReInitTLS(): 441.: Unneeded since Python 3.7.


File: python.info,  Node: Build Changes,  Next: Porting to Python 3 13,  Prev: C API の変更<2>,  Up: What's New In Python 3 13

1.2.11 Build Changes
--------------------

   * ‘arm64-apple-ios’ and ‘arm64-apple-ios-simulator’ are both now PEP
     11(1) tier 3 platforms.  (*note PEP 730: 48d. written and
     implementation contributed by Russell Keith-Magee in gh-114099(2).)

   * ‘aarch64-linux-android’ and ‘x86_64-linux-android’ are both now PEP
     11(3) tier 3 platforms.  (*note PEP 738: 48d. written and
     implementation contributed by Malcolm Smith in gh-116622(4).)

   * ‘wasm32-wasi’ is now a PEP 11(5) tier 2 platform.  (Contributed by
     Brett Cannon in gh-115192(6).)

   * ‘wasm32-emscripten’ is no longer a PEP 11(7) supported platform.
     (Contributed by Brett Cannon in gh-115192(8).)

   * Building CPython now requires a compiler with support for the C11
     atomic library, GCC built-in atomic functions, or MSVC interlocked
     intrinsics.

   * Autoconf 2.71 and aclocal 1.16.5 are now required to regenerate the
     ‘configure’ script.  (Contributed by Christian Heimes in
     gh-89886(9) and by Victor Stinner in gh-112090(10).)

   * SQLite 3.15.2 or newer is required to build the *note sqlite3: d4.
     extension module.  (Contributed by Erlend Aasland in
     gh-105875(11).)

   * CPython now bundles the mimalloc library(12) by default.  It is
     licensed under the MIT license; see *note mimalloc license: 656.
     The bundled mimalloc has custom changes, see gh-113141(13) for
     details.  (Contributed by Dino Viehland in gh-109914(14).)

   * The ‘configure’ option *note -with-system-libmpdec: 657. now
     defaults to ‘yes’.  The bundled copy of ‘libmpdec’ will be removed
     in Python 3.16.

   * Python built with ‘configure’ *note -with-trace-refs: 636. (tracing
     references) is now ABI compatible with the Python release build and
     *note debug build: 509.  (Contributed by Victor Stinner in
     gh-108634(15).)

   * On POSIX systems, the pkg-config (‘.pc’) filenames now include the
     ABI flags.  For example, the free-threaded build generates
     ‘python-3.13t.pc’ and the debug build generates ‘python-3.13d.pc’.

   * The ‘errno’, ‘fcntl’, ‘grp’, ‘md5’, ‘pwd’, ‘resource’, ‘termios’,
     ‘winsound’, ‘_ctypes_test’, ‘_multiprocessing.posixshmem’,
     ‘_scproxy’, ‘_stat’, ‘_statistics’, ‘_testconsole’,
     ‘_testimportmultiple’ and ‘_uuid’ C extensions are now built with
     the *note limited C API: 637.  (Contributed by Victor Stinner in
     gh-85283(16).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0011/

   (2) https://github.com/python/cpython/issues/114099

   (3) https://peps.python.org/pep-0011/

   (4) https://github.com/python/cpython/issues/116622

   (5) https://peps.python.org/pep-0011/

   (6) https://github.com/python/cpython/issues/115192

   (7) https://peps.python.org/pep-0011/

   (8) https://github.com/python/cpython/issues/115192

   (9) https://github.com/python/cpython/issues/89886

   (10) https://github.com/python/cpython/issues/112090

   (11) https://github.com/python/cpython/issues/105875

   (12) https://github.com/microsoft/mimalloc/

   (13) https://github.com/python/cpython/issues/113141

   (14) https://github.com/python/cpython/issues/109914

   (15) https://github.com/python/cpython/issues/108634

   (16) https://github.com/python/cpython/issues/85283


File: python.info,  Node: Porting to Python 3 13,  Next: Regression Test Changes,  Prev: Build Changes,  Up: What's New In Python 3 13

1.2.12 Porting to Python 3.13
-----------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

* Menu:

* Python API の変更: Python API の変更<2>.
* C API の変更: C API の変更<3>.


File: python.info,  Node: Python API の変更<2>,  Next: C API の変更<3>,  Up: Porting to Python 3 13

1.2.12.1 Python API の変更
..........................

   * *note PEP 667: 470. introduces several changes to the semantics of
     *note locals(): 46f. and *note f_locals: 4a5.:

        * Calling *note locals(): 46f. in an *note optimized scope: 4a1.
          now produces an independent snapshot on each call, and hence
          no longer implicitly updates previously returned references.
          Obtaining the legacy CPython behavior now requires explicit
          calls to update the initially returned dictionary with the
          results of subsequent calls to ‘locals()’.  Code execution
          functions that implicitly target ‘locals()’ (such as ‘exec’
          and ‘eval’) must be passed an explicit namespace to access
          their results in an optimized scope.  (Changed as part of PEP
          667(1).)

        * Calling *note locals(): 46f. from a comprehension at module or
          class scope (including via ‘exec’ or ‘eval’) once more behaves
          as if the comprehension were running as an independent nested
          function (i.e.  the local variables from the containing scope
          are not included).  In Python 3.12, this had changed to
          include the local variables from the containing scope when
          implementing PEP 709(2).  (Changed as part of PEP 667(3).)

        * Accessing *note FrameType.f_locals: 4a5. in an *note optimized
          scope: 4a1. now returns a write-through proxy rather than a
          snapshot that gets updated at ill-specified times.  If a
          snapshot is desired, it must be created explicitly with ‘dict’
          or the proxy's ‘.copy()’ method.  (Changed as part of PEP
          667(4).)

   * *note functools.partial: 217. now emits a *note FutureWarning: 659.
     when used as a method.  The behavior will change in future Python
     versions.  Wrap it in *note staticmethod(): 453. if you want to
     preserve the old behavior.  (Contributed by Serhiy Storchaka in
     gh-121027(5).)

   * An *note OSError: 2c0. is now raised by *note getpass.getuser():
     65a. for any failure to retrieve a username, instead of *note
     ImportError: 65b. on non-Unix platforms or *note KeyError: 5e7. on
     Unix platforms where the password database is empty.

   * The value of the ‘mode’ attribute of *note gzip.GzipFile: 65c. is
     now a string (‘'rb'’ or ‘'wb'’) instead of an integer (‘1’ or ‘2’).
     The value of the ‘mode’ attribute of the readable file-like object
     returned by *note zipfile.ZipFile.open(): 65d. is now ‘'rb'’
     instead of ‘'r'’.  (Contributed by Serhiy Storchaka in
     gh-115961(6).)

   * *note mailbox.Maildir: 65e. now ignores files with a leading dot
     (‘.’).  (Contributed by Zackery Spytz in gh-65559(7).)

   * *note pathlib.Path.glob(): 537. and *note rglob(): 538. now return
     both files and directories if a pattern that ends with "‘**’" is
     given, rather than directories only.  Add a trailing slash to keep
     the previous behavior and only match directories.

   * The *note threading: f3. module now expects the ‘_thread’ module to
     have an ‘_is_main_interpreter()’ function.  This function takes no
     arguments and returns ‘True’ if the current interpreter is the main
     interpreter.

     Any library or application that provides a custom ‘_thread’ module
     must provide ‘_is_main_interpreter()’, just like the module's other
     "private" attributes.  (gh-112826(8).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0667/

   (2) https://peps.python.org/pep-0709/

   (3) https://peps.python.org/pep-0667/

   (4) https://peps.python.org/pep-0667/

   (5) https://github.com/python/cpython/issues/121027

   (6) https://github.com/python/cpython/issues/115961

   (7) https://github.com/python/cpython/issues/65559

   (8) https://github.com/python/cpython/issues/112826


File: python.info,  Node: C API の変更<3>,  Prev: Python API の変更<2>,  Up: Porting to Python 3 13

1.2.12.2 C API の変更
.....................

   * ‘Python.h’ no longer includes the ‘<ieeefp.h>’ standard header.  It
     was included for the ‘finite()’ function which is now provided by
     the ‘<math.h>’ header.  It should now be included explicitly if
     needed.  Remove also the ‘HAVE_IEEEFP_H’ macro.  (Contributed by
     Victor Stinner in gh-108765(1).)

   * ‘Python.h’ no longer includes these standard header files:
     ‘<time.h>’, ‘<sys/select.h>’ and ‘<sys/time.h>’.  If needed, they
     should now be included explicitly.  For example, ‘<time.h>’
     provides the ‘clock()’ and ‘gmtime()’ functions, ‘<sys/select.h>’
     provides the ‘select()’ function, and ‘<sys/time.h>’ provides the
     ‘futimes()’, ‘gettimeofday()’ and ‘setitimer()’ functions.
     (Contributed by Victor Stinner in gh-108765(2).)

   * On Windows, ‘Python.h’ no longer includes the ‘<stddef.h>’ standard
     header file.  If needed, it should now be included explicitly.  For
     example, it provides ‘offsetof()’ function, and ‘size_t’ and
     ‘ptrdiff_t’ types.  Including ‘<stddef.h>’ explicitly was already
     needed by all other platforms, the ‘HAVE_STDDEF_H’ macro is only
     defined on Windows.  (Contributed by Victor Stinner in
     gh-108765(3).)

   * If the *note Py_LIMITED_API: 660. macro is defined,
     ‘Py_BUILD_CORE’, ‘Py_BUILD_CORE_BUILTIN’ and ‘Py_BUILD_CORE_MODULE’
     macros are now undefined by ‘<Python.h>’.  (Contributed by Victor
     Stinner in gh-85283(4).)

   * The old trashcan macros ‘Py_TRASHCAN_SAFE_BEGIN’ and
     ‘Py_TRASHCAN_SAFE_END’ were removed.  They should be replaced by
     the new macros ‘Py_TRASHCAN_BEGIN’ and ‘Py_TRASHCAN_END’.

     A ‘tp_dealloc’ function that has the old macros, such as:

          static void
          mytype_dealloc(mytype *p)
          {
              PyObject_GC_UnTrack(p);
              Py_TRASHCAN_SAFE_BEGIN(p);
              ...
              Py_TRASHCAN_SAFE_END
          }

     should migrate to the new macros as follows:

          static void
          mytype_dealloc(mytype *p)
          {
              PyObject_GC_UnTrack(p);
              Py_TRASHCAN_BEGIN(p, mytype_dealloc)
              ...
              Py_TRASHCAN_END
          }

     Note that ‘Py_TRASHCAN_BEGIN’ has a second argument which should be
     the deallocation function it is in.  The new macros were added in
     Python 3.8 and the old macros were deprecated in Python 3.11.
     (Contributed by Irit Katriel in gh-105111(5).)

   * *note PEP 667: 470. introduces several changes to frame-related
     functions:

        * The effects of mutating the dictionary returned from *note
          PyEval_GetLocals(): 5f8. in an *note optimized scope: 4a1.
          have changed.  New dict entries added this way will now 'only'
          be visible to subsequent *note PyEval_GetLocals(): 5f8. calls
          in that frame, as *note PyFrame_GetLocals(): 661, *note
          locals(): 46f, and *note FrameType.f_locals: 4a5. no longer
          access the same underlying cached dictionary.  Changes made to
          entries for actual variable names and names added via the
          write-through proxy interfaces will be overwritten on
          subsequent calls to *note PyEval_GetLocals(): 5f8. in that
          frame.  The recommended code update depends on how the
          function was being used, so refer to the deprecation notice on
          the function for details.

        * Calling *note PyFrame_GetLocals(): 661. in an *note optimized
          scope: 4a1. now returns a write-through proxy rather than a
          snapshot that gets updated at ill-specified times.  If a
          snapshot is desired, it must be created explicitly (e.g.  with
          *note PyDict_Copy(): 662.), or by calling the new *note
          PyEval_GetFrameLocals(): 5f7. API.

        * ‘PyFrame_FastToLocals()’ and ‘PyFrame_FastToLocalsWithError()’
          no longer have any effect.  Calling these functions has been
          redundant since Python 3.11, when *note PyFrame_GetLocals():
          661. was first introduced.

        * ‘PyFrame_LocalsToFast()’ no longer has any effect.  Calling
          this function is redundant now that *note PyFrame_GetLocals():
          661. returns a write-through proxy for *note optimized scopes:
          4a1.

   * Python 3.13 removed many private functions.  Some of them can be
     replaced using these alternatives:

        * ‘_PyDict_Pop()’: *note PyDict_Pop(): 422. or *note
          PyDict_PopString(): 5e5.;

        * ‘_PyDict_GetItemWithError()’: *note PyDict_GetItemRef(): 5e0.;

        * ‘_PyErr_WriteUnraisableMsg()’: *note PyErr_FormatUnraisable():
          5f1.;

        * ‘_PyEval_SetTrace()’: *note PyEval_SetTrace(): 663. or *note
          PyEval_SetTraceAllThreads(): 664.;

        * ‘_PyList_Extend()’: *note PyList_Extend(): 600.;

        * ‘_PyLong_AsInt()’: *note PyLong_AsInt(): 604.;

        * ‘_PyMem_RawStrdup()’: ‘strdup()’;

        * ‘_PyMem_Strdup()’: ‘strdup()’;

        * ‘_PyObject_ClearManagedDict()’: *note
          PyObject_ClearManagedDict(): 60e.;

        * ‘_PyObject_VisitManagedDict()’: *note
          PyObject_VisitManagedDict(): 60d.;

        * ‘_PyThreadState_UncheckedGet()’: *note
          PyThreadState_GetUnchecked(): 423.;

        * ‘_PyTime_AsSecondsDouble()’: *note PyTime_AsSecondsDouble():
          5d6.;

        * ‘_PyTime_GetMonotonicClock()’: *note PyTime_Monotonic(): 5d7.
          or *note PyTime_MonotonicRaw(): 5d8.;

        * ‘_PyTime_GetPerfCounter()’: *note PyTime_PerfCounter(): 5d9.
          or *note PyTime_PerfCounterRaw(): 5da.;

        * ‘_PyTime_GetSystemClock()’: *note PyTime_Time(): 5db. or *note
          PyTime_TimeRaw(): 5dc.;

        * ‘_PyTime_MAX’: *note PyTime_MAX: 5d5.;

        * ‘_PyTime_MIN’: *note PyTime_MIN: 5d4.;

        * ‘_PyTime_t’: *note PyTime_t: 5d3.;

        * ‘_Py_HashPointer()’: *note Py_HashPointer(): 425.;

        * ‘_Py_IsFinalizing()’: *note Py_IsFinalizing(): 5fd.

     The pythoncapi-compat project(6) can be used to get most of these
     new functions on Python 3.12 and older.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/108765

   (2) https://github.com/python/cpython/issues/108765

   (3) https://github.com/python/cpython/issues/108765

   (4) https://github.com/python/cpython/issues/85283

   (5) https://github.com/python/cpython/issues/105111

   (6) https://github.com/python/pythoncapi-compat/


File: python.info,  Node: Regression Test Changes,  Prev: Porting to Python 3 13,  Up: What's New In Python 3 13

1.2.13 Regression Test Changes
------------------------------

   * Python built with ‘configure’ *note -with-pydebug: 666. now
     supports a *note -X presite=package.module: 16f. command-line
     option.  If used, it specifies a module that should be imported
     early in the lifecycle of the interpreter, before ‘site.py’ is
     executed.  (Contributed by Łukasz Langa in gh-110769(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/110769


File: python.info,  Node: What's New In Python 3 12,  Next: What's New In Python 3 11,  Prev: What's New In Python 3 13,  Up: What's New in Python

1.3 What's New In Python 3.12
=============================


編集者: Adam Turner

この記事では Python 3.11 と比較した Python 3.12 の新機能を解説します。
Python 3.12 は2023年10月2日にリリースされました。全詳細については *note
変更履歴: 142. をご覧ください。

参考
....

PEP 693(1) - Python 3.12 リリーススケジュール

* Menu:

* 概要: 概要 -- リリースハイライト<3>. リリースハイライト
* 新しい機能: 新しい機能<4>.
* 型ヒントに関連する新しい機能::
* その他の言語変更: その他の言語変更<2>.
* 新たなモジュール: 新たなモジュール<2>.
* 改良されたモジュール: 改良されたモジュール<2>.
* 最適化: 最適化<3>.
* CPython バイトコードの変更: CPython バイトコードの変更<2>.
* Demos and Tools::
* 非推奨: 非推奨<2>.
* 削除: 削除<2>.
* Python 3.12 への移植: Python 3 12 への移植.
* Build Changes: Build Changes<2>.
* C API の変更: C API の変更<4>.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0693/


File: python.info,  Node: 概要 -- リリースハイライト<3>,  Next: 新しい機能<4>,  Up: What's New In Python 3 12

1.3.1 概要 - リリースハイライト
-------------------------------

Python 3.12 is a stable release of the Python programming language, with
a mix of changes to the language and the standard library.  The library
changes focus on cleaning up deprecated APIs, usability, and
correctness.  Of note, the ‘distutils’ package has been removed from the
standard library.  Filesystem support in *note os: a5. and *note
pathlib: a8. has seen a number of improvements, and several modules have
better performance.

*note f-strings: 66b. は多くの制限が取り除かれ、 'Did you mean ...'  サ
ジェストも改善され続けています。新しい *note 型パラメータの構文: 66c. と
*note type: 66d. 文は、 *note ジェネリック: 1a1. と *note 型エイリアス:
66e. を静的型チェッカーで使用する際の人間工学を改善します。

この記事は全ての新機能の完全な仕様を提供しようとするものではなく、便利な
概要について説明をするものです。 全詳細については、 *note
ライブラリリファレンス: 149. や *note 言語リファレンス: 14a. などのドキ
ュメントを参照してください。 変更の実装や設計原理について完全に理解した
い場合は、特定の新機能の PEP を参照してください。 しかし、一旦機能が完全
に実装されると、普通 PEP は最新の状態に保たれないことに注意してください
。

__________________________________________________________________

新たな構文機能:

   * *note PEP 695: 66c, 型パラメータの構文と *note type: 66d. 文

新たな文法機能:

   * *note PEP 701: 66f, 文法の中の *note f-strings: 66b.

インタープリタの改善:

   * *note PEP 684: 670, インタープリタごとのユニークな *note GIL: 474.

   * *note PEP 669: 671, 低影響なモニタリング

   * *note NameError: 452, *note ImportError: 65b, *note SyntaxError:
     18e. 例外に対する *note 'Did you mean ...'  サジェストを改善: 672.
     しました

Python のデータモデルの改善:

   * *note PEP 688: 673, Python の *note バッファプロトコル: 260. を使用
     します

標準ライブラリーの顕著な改善

   * *note pathlib.Path: 266. クラスがサブクラス化をサポートするようにな
     りました

   * *note os: a5. モジュールは Windows サポートのためにいくつかの改良が
     加えられました

   * *note sqlite3: d4. モジュールに *note
     コマンドライン・インターフェース: 674. が追加されました

   * *note runtime-checkable プロトコル: 675. に対する *note
     isinstance(): 2ad. のチェックは、2倍～20倍のスピードアップを実現し
     ます

   * *note asyncio: b. パッケージは多くのパフォーマンスを向上させ、いく
     つかのベンチマークでは75%のスピードアップを示しました。

   * *note uuid: 116. モジュールに *note
     コマンドライン・インターフェース: 676. が追加されました

   * *note PEP 701: 66f. の変更により、 *note tokenize: 101. モジュール
     によるトークンの生成は最大で64%速くなりました。

セキュリティの改善:

   * 組み込みの *note hashlib: 6c. による SHA1, SHA3, SHA2-384,
     SHA2-512, MD5 の実装を、 HACL*(1) プロジェクトから正式に検証された
     コードに置き換えます。これらの組み込み実装は、 OpenSSL がそれらを提
     供しない場合にのみ使用されるフォールバックとして残ります。

C API の改善:

   * *note PEP 697: 677, 不安定な C API 層

   * *note PEP 683: 678, 不変オブジェクト

CPython の実装の改善:

   * *note PEP 709: 679, 内包表記のインライン化

   * Linux ‘perf’ プロファイラの *note CPython サポート: 4ae.

   * サポートされているプラットフォームでスタック・オーバーフロー保護を
     実装します

新しい型ヒントの機能:

   * *note PEP 692: 67a, *note TypedDict: 332. を使用して *note
     **kwargs: 67b. をアノテートします

   * *note PEP 698: 67c, *note typing.override(): 67d. デコレータ

重要な非推奨化、削除または制限:

   * PEP 623(2): Python の C API の Unicode オブジェクトから ‘wstr’ を削
     除し、全ての *note str: 169. オブジェクトのサイズを少なくとも 8 バ
     イト減らします

   * PEP 632(3): Remove the ‘distutils’ package.  See the migration
     guide(4) for advice replacing the APIs it provided.  The
     third-party Setuptools(5) package continues to provide ‘distutils’,
     if you still require it in Python 3.12 and beyond.

   * gh-95299(6): *note venv: 117. で作成された仮想環境には ‘setuptools’
     をプリインストールしません。これは ‘distutils’, ‘setuptools’,
     ‘pkg_resources’, ‘easy_install’ がデフォルトでは利用できなることを
     意味します。これらを利用するには、 *note 有効化された: 67e. 仮想環
     境で ‘pip install setuptools’ を実行してください。

   * ‘asynchat’, ‘asyncore’, ‘imp’ モジュールが、いくつかの *note
     unittest.TestCase: 2b3. *note メソッドのエイリアス: 67f. と共に削除
     されました。

   ---------- Footnotes ----------

   (1) https://github.com/hacl-star/hacl-star/

   (2) https://peps.python.org/pep-0623/

   (3) https://peps.python.org/pep-0632/

   (4) https://peps.python.org/pep-0632/#migration-advice

   (5) 
https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html

   (6) https://github.com/python/cpython/issues/95299


File: python.info,  Node: 新しい機能<4>,  Next: 型ヒントに関連する新しい機能,  Prev: 概要 -- リリースハイライト<3>,  Up: What's New In Python 3 12

1.3.2 新しい機能
----------------

* Menu:

* PEP 695; 型パラメータの構文: PEP 695 型パラメータの構文.
* PEP 701; f-strings の構文的な形式化: PEP 701 f-strings の構文的な形式化.
* PEP 684; インタープリタごとの GIL: PEP 684 インタープリタごとの GIL.
* PEP 669; CPython の低影響モニタリング: PEP 669 CPython の低影響モニタリング.
* PEP 688; バッファプロトコルを Python で利用可能にする: PEP 688 バッファプロトコルを Python で利用可能にする.
* PEP 709; 内包表記のインライン化: PEP 709 内包表記のインライン化.
* エラーメッセージの改善: エラーメッセージの改善<3>.


File: python.info,  Node: PEP 695 型パラメータの構文,  Next: PEP 701 f-strings の構文的な形式化,  Up: 新しい機能<4>

1.3.2.1 PEP 695: 型パラメータの構文
...................................

PEP 484(1) のジェネリッククラスと関数は、型パラメータのスコープが不明確
なまま冗長な構文を使用して宣言されており、差異の明示的な宣言が必要でした
。

PEP 695(2) は ジェネリッククラス と *note 関数: 682. を作成するための、
よりコンパクトで明示的な新しい方法を紹介します:

     def max[T](args: Iterable[T]) -> T:
         ...

     class list[T]:
         def __getitem__(self, index: int, /) -> T:
             ...

         def append(self, element: T) -> None:
             ...

さらに、 PEP では *note 型エイリアス: 683. を宣言する新しい方法が導入さ
れました。 *note type: 66d. 文を使用し、 *note TypeAliasType: 2ae. のイ
ンスタンスを作成します:

     type Point = tuple[float, float]

型エイリアスは *note ジェネリック: 684. とすることもできます:

     type Point[T] = tuple[T, T]

新しい構文では、 *note TypeVarTuple: 488. と *note ParamSpec: 487. パラ
メータ、および *note TypeVar: 486. パラメータに境界や制約を宣言すること
ができます:

     type IntFunc[**P] = Callable[P, int]  # ParamSpec
     type LabeledTuple[*Ts] = tuple[str, *Ts]  # TypeVarTuple
     type HashableSequence[T: Hashable] = Sequence[T]  # TypeVar with bound
     type IntOrStrSequence[T: (int, str)] = Sequence[T]  # TypeVar with constraints

この構文で作成された型エイリアスの値や型変数の境界や制約はオンデマンドで
評価されます (*note 遅延評価: 685. を参照してください)。つまり、型エイリ
アスはファイルの後半で定義された他の型を参照することができます。

型パラメータリストを通して宣言された型パラメータは、宣言のスコープと入れ
子になったスコープ内では表示されますが、外側のスコープでは表示されません
。例えば、ジェネリッククラスのメソッドの型アノテーションやクラス本体で使
用することができます。しかし、クラス定義後にモジュールスコープ内で使用す
ることはできません。型パラメータの実行時の解釈の問題に関する詳細な説明は
*note Type parameter lists: 5ad. を参照してください。

このようなスコープの解釈の問題をサポートするために、 *note
アノテーションスコープ: 4ab. という新しいスコープが導入されました。アノ
テーションスコープはほとんどの場合関数スコープと同じように動作しますが、
外側のクラススコープとは異なる方法で対話します。 Python 3.13 では、
*note アノテーション: 15c. もアノテーションスコープで評価されます。

より詳しくは PEP 695(3) を参照してください。

(PEP は Eric Traut によって作成されました。実装は Jelle Zijlstra, Eric
Traut らによって gh-103764(4) で行われました。)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/

   (2) https://peps.python.org/pep-0695/

   (3) https://peps.python.org/pep-0695/

   (4) https://github.com/python/cpython/issues/103764


File: python.info,  Node: PEP 701 f-strings の構文的な形式化,  Next: PEP 684 インタープリタごとの GIL,  Prev: PEP 695 型パラメータの構文,  Up: 新しい機能<4>

1.3.2.2 PEP 701: f-strings の構文的な形式化
...........................................

PEP 701(1) は *note f-strings: 66b. の使い方の制限をいくつか解除しました
。 f-string 内の式コンポーネントは有効な Python 式であれば何でも使用でき
るようになりました。これには、 f-string を含む文字列と同じ引用符を再利用
する文字列、複数行の式、コメント、バックスラッシュ、 Unicode エスケープ
シーケンスなどが含まれます。これらについて詳しく説明します:

   * クォートの再利用: Python 3.11 では、 f-string を囲むクォートと同じ
     クォートを再利用すると *note SyntaxError: 18e. が発生し、ユーザーは
     他の利用可能なクォート( f-string がシングルクォートを使用している場
     合に、ダブルクオートまたはトリプルクォートを使用するなど)を使用する
     必要があります。 Python 3.12 では次のようなことができるようになりま
     した:

          >>> songs = ['Take me back to Eden', 'Alkaline', 'Ascensionism']
          >>> f"This is the playlist: {", ".join(songs)}"
          'This is the playlist: Take me back to Eden, Alkaline, Ascensionism'

     この変更以前は、 f-string のネスト方法に明示的な制限はありませんで
     したが、 f-string の式コンポーネント内で文字列引用符を再利用できな
     いという事実により、 f-string を任意にネストすることが不可能になっ
     たことに注意してください。実際、これは記述できる中で最もネストされ
     た f-string です。

          >>> f"""{f'''{f'{f"{1+1}"}'}'''}"""
          '2'

     f-string には式コンポーネント内に任意の有効な Python 式を含めること
     ができるため、 f-string を任意にネストできるようになりました。

          >>> f"{f"{f"{f"{f"{f"{1+1}"}"}"}"}"}"
          '2'

   * 複数行の式とコメント: Python 3.11 では、 f-string 式は1行で定義され
     なければいけませんでした。たとえ f-string 式が複数行にまたがってい
     ても(リテラルリストが複数行にわたって定義されている場合など)、読み
     にくくなります。 Python 3.12 では、複数行にまたがる f-string を定義
     し、インラインコメントを追加できるようになりました:

          >>> f"This is the playlist: {", ".join([
          ...     'Take me back to Eden',  # My, my, those eyes like fire
          ...     'Alkaline',              # Not acid nor alkaline
          ...     'Ascensionism'           # Take to the broken skies at last
          ... ])}"
          'This is the playlist: Take me back to Eden, Alkaline, Ascensionism'

   * バックスラッシュと unicode 文字: Python 3.12 以前では f-string 式に
     ‘\’ 文字を含めることはできませんでした。これは、 unicode *note
     エスケープシーケンス: 687. ( ‘\N{snowman}’ など)にも影響しました。
     これは、 unicode のエスケープシーケンスにも影響し、これらは ‘\N’ の
     部分を含んでいたため、以前は f-string の式コンポーネントの一部とす
     ることができませんでした。このように式を定義することができます:

          >>> print(f"This is the playlist: {"\n".join(songs)}")
          This is the playlist: Take me back to Eden
          Alkaline
          Ascensionism
          >>> print(f"This is the playlist: {"\N{BLACK HEART SUIT}".join(songs)}")
          This is the playlist: Take me back to Eden♥Alkaline♥Ascensionism

より詳しくは PEP 701(2) を参照してください。

この機能が実装されたことによる良い副作用として( PEG パーサ(3) で
f-string を解析することにより)、 f-string のエラーメッセージがより正確に
なり、エラーの正確な位置が含まれるようになりました。例えば、 Python 3.11
では、以下の f-string は *note SyntaxError: 18e. をs送出させます:

     >>> my_string = f"{x z y}" + f"{1 + 1}"
       File "<stdin>", line 1
         (x z y)
          ^^^
     SyntaxError: f-string: invalid syntax. Perhaps you forgot a comma?

しかし、エラーメッセージは行内の正確なエラーの位置を含まず、また式が人為
的に括弧で囲まれています。 Python 3.12 では、 f-string は PEG パーサで解
析されるため、エラーメッセージはより正確になり、行全体が表示されます:

     >>> my_string = f"{x z y}" + f"{1 + 1}"
       File "<stdin>", line 1
         my_string = f"{x z y}" + f"{1 + 1}"
                        ^^^
     SyntaxError: invalid syntax. Perhaps you forgot a comma?

(Pablo Galindo, Batuhan Taskaya, Lysandros Nikolaou, Christian
Maureira-Fredes, および Marta Gomez によって、 gh-102856(4) で寄稿されま
した。PEP は Pablo Galindo, Batuhan Taskaya, Lysandros Nikolaou, および
Marta Gomez によって作成されました)。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0701/

   (2) https://peps.python.org/pep-0701/

   (3) https://peps.python.org/pep-0617/

   (4) https://github.com/python/cpython/issues/102856


File: python.info,  Node: PEP 684 インタープリタごとの GIL,  Next: PEP 669 CPython の低影響モニタリング,  Prev: PEP 701 f-strings の構文的な形式化,  Up: 新しい機能<4>

1.3.2.3 PEP 684: インタープリタごとの GIL
.........................................

PEP 684(1) ではインタープリタごとの *note GIL: 474. が導入され、インター
プリタごとの固有の GIL を使用してサブインタープリタを作成できるようにな
りました。これにより、 Python プログラムは複数の CPU コアを最大限に活用
できるようになります。これは現在 C-API を通じてのみ利用できますが、
Python API は 3.13(2) で利用可能になる予定です。

独自の GIL を持つインタープリタを作成するには、新しい *note
Py_NewInterpreterFromConfig(): 689. 関数を使います:

     PyInterpreterConfig config = {
         .check_multi_interp_extensions = 1,
         .gil = PyInterpreterConfig_OWN_GIL,
     };
     PyThreadState *tstate = NULL;
     PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);
     if (PyStatus_Exception(status)) {
         return -1;
     }
     /* The new interpreter is now active in the current thread. */

For further examples how to use the C-API for sub-interpreters with a
per-interpreter GIL, see ‘Modules/_xxsubinterpretersmodule.c’.

(寄稿: Eric Snow, gh-104210(3) ほか)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0684/

   (2) https://peps.python.org/pep-0554/

   (3) https://github.com/python/cpython/issues/104210


File: python.info,  Node: PEP 669 CPython の低影響モニタリング,  Next: PEP 688 バッファプロトコルを Python で利用可能にする,  Prev: PEP 684 インタープリタごとの GIL,  Up: 新しい機能<4>

1.3.2.4 PEP 669: CPython の低影響モニタリング
.............................................

PEP 669(1) は、 CPython でイベントを監視するためのプロファイラ、デバッガ
ー、およびその他のツール用の新しい *note API: e0. を定義します。呼び出し
、戻り値、行、例外、ジャンプなどを含む幅広いイベントをカバーします。つま
り、使用した分だけ料金を支払い、オーバーヘッドがほぼゼロのデバッガーとカ
バレッジツールのサポートを提供します。詳細については *note
sys.monitoring: e0. を参照してください。

(Mark Shannon による gh-103082(2) での貢献)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0669/

   (2) https://github.com/python/cpython/issues/103082


File: python.info,  Node: PEP 688 バッファプロトコルを Python で利用可能にする,  Next: PEP 709 内包表記のインライン化,  Prev: PEP 669 CPython の低影響モニタリング,  Up: 新しい機能<4>

1.3.2.5 PEP 688: バッファプロトコルを Python で利用可能にする
.............................................................

PEP 688(1) は Python のコードから *note バッファプロトコル: 260. を利用
する方法を導入します。 *note __buffer__(): 68c. メソッドを実装するクラス
は今やバッファ型として利用可能です。

新規追加された *note collections.abc.Buffer: 343. ABC は、例えば型注釈で
、バッファオブジェクトを表現する標準的な方法を提供します。新規追加された
*note inspect.BufferFlags: 68d. enum はバッファ生成を調整するフラグを表
現します。(Jelle Zijltra による gh-102500(2) での貢献。)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0688/

   (2) https://github.com/python/cpython/issues/102500


File: python.info,  Node: PEP 709 内包表記のインライン化,  Next: エラーメッセージの改善<3>,  Prev: PEP 688 バッファプロトコルを Python で利用可能にする,  Up: 新しい機能<4>

1.3.2.6 PEP 709: 内包表記のインライン化
.......................................

辞書、リスト、そして集合の内包表記は今やインライン化され、内包表記の毎回
の実行の度に一度しか使われない関数オブジェクトが新規作成されることはなく
なります。これにより内包表記の実行は最大２倍速くなります。詳しくは PEP
709(1) を参照してください。

Comprehension iteration variables remain isolated and don't overwrite a
variable of the same name in the outer scope, nor are they visible after
the comprehension.  Inlining does result in a few visible behavior
changes:

   * There is no longer a separate frame for the comprehension in
     tracebacks, and tracing/profiling no longer shows the comprehension
     as a function call.

   * The *note symtable: de. module will no longer produce child symbol
     tables for each comprehension; instead, the comprehension's locals
     will be included in the parent function's symbol table.

   * Calling *note locals(): 46f. inside a comprehension now includes
     variables from outside the comprehension, and no longer includes
     the synthetic ‘.0’ variable for the comprehension "argument".

   * A comprehension iterating directly over ‘locals()’ (e.g.  ‘[k for k
     in locals()]’) may see "RuntimeError: dictionary changed size
     during iteration" when run under tracing (e.g.  code coverage
     measurement).  This is the same behavior already seen in e.g.  ‘for
     k in locals():’.  To avoid the error, first create a list of keys
     to iterate over: ‘keys = list(locals()); [k for k in keys]’.

(Contributed by Carl Meyer and Vladimir Matveev in PEP 709(2).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0709/

   (2) https://peps.python.org/pep-0709/


File: python.info,  Node: エラーメッセージの改善<3>,  Prev: PEP 709 内包表記のインライン化,  Up: 新しい機能<4>

1.3.2.7 エラーメッセージの改善
..............................

   * Modules from the standard library are now potentially suggested as
     part of the error messages displayed by the interpreter when a
     *note NameError: 452. is raised to the top level.  (Contributed by
     Pablo Galindo in gh-98254(1).)

          >>> sys.version_info
          Traceback (most recent call last):
            File "<stdin>", line 1, in <module>
          NameError: name 'sys' is not defined. Did you forget to import 'sys'?

   * Improve the error suggestion for *note NameError: 452. exceptions
     for instances.  Now if a *note NameError: 452. is raised in a
     method and the instance has an attribute that's exactly equal to
     the name in the exception, the suggestion will include
     ‘self.<NAME>’ instead of the closest match in the method scope.
     (Contributed by Pablo Galindo in gh-99139(2).)

          >>> class A:
          ...    def __init__(self):
          ...        self.blech = 1
          ...
          ...    def foo(self):
          ...        somethin = blech
          ...
          >>> A().foo()
          Traceback (most recent call last):
            File "<stdin>", line 1
              somethin = blech
                         ^^^^^
          NameError: name 'blech' is not defined. Did you mean: 'self.blech'?

   * Improve the *note SyntaxError: 18e. error message when the user
     types ‘import x from y’ instead of ‘from y import x’.  (Contributed
     by Pablo Galindo in gh-98931(3).)

          >>> import a.y.z from b.y.z
          Traceback (most recent call last):
            File "<stdin>", line 1
              import a.y.z from b.y.z
              ^^^^^^^^^^^^^^^^^^^^^^^
          SyntaxError: Did you mean to use 'from ... import ...' instead?

   * *note ImportError: 65b. exceptions raised from failed ‘from
     <module> import <name>’ statements now include suggestions for the
     value of ‘<name>’ based on the available names in ‘<module>’.
     (Contributed by Pablo Galindo in gh-91058(4).)

          >>> from collections import chainmap
          Traceback (most recent call last):
            File "<stdin>", line 1, in <module>
          ImportError: cannot import name 'chainmap' from 'collections'. Did you mean: 'ChainMap'?

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98254

   (2) https://github.com/python/cpython/issues/99139

   (3) https://github.com/python/cpython/issues/98931

   (4) https://github.com/python/cpython/issues/91058


File: python.info,  Node: 型ヒントに関連する新しい機能,  Next: その他の言語変更<2>,  Prev: 新しい機能<4>,  Up: What's New In Python 3 12

1.3.3 型ヒントに関連する新しい機能
----------------------------------

This section covers major changes affecting type hints(1) and the *note
typing: 10a. module.

* Menu:

* PEP 692; Using TypedDict for more precise **kwargs typing: PEP 692 Using TypedDict for more precise **kwargs typing.
* PEP 698; Override Decorator for Static Typing: PEP 698 Override Decorator for Static Typing.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/


File: python.info,  Node: PEP 692 Using TypedDict for more precise **kwargs typing,  Next: PEP 698 Override Decorator for Static Typing,  Up: 型ヒントに関連する新しい機能

1.3.3.1 PEP 692: Using ‘TypedDict’ for more precise ‘**kwargs’ typing
.....................................................................

Typing ‘**kwargs’ in a function signature as introduced by PEP 484(1)
allowed for valid annotations only in cases where all of the ‘**kwargs’
were of the same type.

PEP 692(2) specifies a more precise way of typing ‘**kwargs’ by relying
on typed dictionaries:

     from typing import TypedDict, Unpack

     class Movie(TypedDict):
       name: str
       year: int

     def foo(**kwargs: Unpack[Movie]): ...

より詳しくは PEP 692(3) を参照してください。

(Contributed by Franek Magiera in gh-103629(4).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/

   (2) https://peps.python.org/pep-0692/

   (3) https://peps.python.org/pep-0692/

   (4) https://github.com/python/cpython/issues/103629


File: python.info,  Node: PEP 698 Override Decorator for Static Typing,  Prev: PEP 692 Using TypedDict for more precise **kwargs typing,  Up: 型ヒントに関連する新しい機能

1.3.3.2 PEP 698: Override Decorator for Static Typing
.....................................................

A new decorator *note typing.override(): 67d. has been added to the
*note typing: 10a. module.  It indicates to type checkers that the
method is intended to override a method in a superclass.  This allows
type checkers to catch mistakes where a method that is intended to
override something in a base class does not in fact do so.

以下はプログラム例です:

     from typing import override

     class Base:
       def get_color(self) -> str:
         return "blue"

     class GoodChild(Base):
       @override  # ok: overrides Base.get_color
       def get_color(self) -> str:
         return "yellow"

     class BadChild(Base):
       @override  # type checker error: does not override Base.get_color
       def get_colour(self) -> str:
         return "red"

See PEP 698(1) for more details.

(Contributed by Steven Troxler in gh-101561(2).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0698/

   (2) https://github.com/python/cpython/issues/101561


File: python.info,  Node: その他の言語変更<2>,  Next: 新たなモジュール<2>,  Prev: 型ヒントに関連する新しい機能,  Up: What's New In Python 3 12

1.3.4 その他の言語変更
----------------------

   * The parser now raises *note SyntaxError: 18e. when parsing source
     code containing null bytes.  (Contributed by Pablo Galindo in
     gh-96670(1).)

   * A backslash-character pair that is not a valid escape sequence now
     generates a *note SyntaxWarning: 1ae, instead of *note
     DeprecationWarning: 1a3.  For example, ‘re.compile("\d+\.\d+")’ now
     emits a *note SyntaxWarning: 1ae. (‘"\d"’ is an invalid escape
     sequence, use raw strings for regular expression:
     ‘re.compile(r"\d+\.\d+")’).  In a future Python version, *note
     SyntaxError: 18e. will eventually be raised, instead of *note
     SyntaxWarning: 1ae.  (Contributed by Victor Stinner in
     gh-98401(2).)

   * Octal escapes with value larger than ‘0o377’ (ex: ‘"\477"’),
     deprecated in Python 3.11, now produce a *note SyntaxWarning: 1ae,
     instead of *note DeprecationWarning: 1a3.  In a future Python
     version they will be eventually a *note SyntaxError: 18e.
     (Contributed by Victor Stinner in gh-98401(3).)

   * Variables used in the target part of comprehensions that are not
     stored to can now be used in assignment expressions (‘:=’).  For
     example, in ‘[(b := 1) for a, b.prop in some_iter]’, the assignment
     to ‘b’ is now allowed.  Note that assigning to variables stored to
     in the target part of comprehensions (like ‘a’) is still
     disallowed, as per PEP 572(4).  (Contributed by Nikita Sobolev in
     gh-100581(5).)

   * Exceptions raised in a class or type's ‘__set_name__’ method are no
     longer wrapped by a *note RuntimeError: 244.  Context information
     is added to the exception as a PEP 678(6) note.  (Contributed by
     Irit Katriel in gh-77757(7).)

   * When a ‘try-except*’ construct handles the entire *note
     ExceptionGroup: 4d2. and raises one other exception, that exception
     is no longer wrapped in an *note ExceptionGroup: 4d2.  Also changed
     in version 3.11.4.  (Contributed by Irit Katriel in gh-103590(8).)

   * The Garbage Collector now runs only on the eval breaker mechanism
     of the Python bytecode evaluation loop instead of object
     allocations.  The GC can also run when *note PyErr_CheckSignals():
     693. is called so C extensions that need to run for a long time
     without executing any Python code also have a chance to execute the
     GC periodically.  (Contributed by Pablo Galindo in gh-97922(9).)

   * All builtin and extension callables expecting boolean parameters
     now accept arguments of any type instead of just *note bool: 3c3.
     and *note int: 19b.  (Contributed by Serhiy Storchaka in
     gh-60203(10).)

   * *note memoryview: 165. now supports the half-float type (the "e"
     format code).  (Contributed by Donghee Na and Antoine Pitrou in
     gh-90751(11).)

   * *note slice: 694. objects are now hashable, allowing them to be
     used as dict keys and set items.  (Contributed by Will Bradshaw,
     Furkan Onder, and Raymond Hettinger in gh-101264(12).)

   * *note sum(): 695. now uses Neumaier summation to improve accuracy
     and commutativity when summing floats or mixed ints and floats.
     (Contributed by Raymond Hettinger in gh-100425(13).)

   * *note ast.parse(): 1c2. now raises *note SyntaxError: 18e. instead
     of *note ValueError: 2ec. when parsing source code containing null
     bytes.  (Contributed by Pablo Galindo in gh-96670(14).)

   * The extraction methods in *note tarfile: e4, and *note
     shutil.unpack_archive(): 696, have a new a 'filter' argument that
     allows limiting tar features than may be surprising or dangerous,
     such as creating files outside the destination directory.  See
     *note tarfile extraction filters: 697. for details.  In Python
     3.14, the default will switch to ‘'data'’.  (Contributed by Petr
     Viktorin in PEP 706(15).)

   * *note types.MappingProxyType: 698. instances are now hashable if
     the underlying mapping is hashable.  (Contributed by Serhiy
     Storchaka in gh-87995(16).)

   * Add *note support for the perf profiler: 4ae. through the new
     environment variable *note PYTHONPERFSUPPORT: 699. and command-line
     option *note -X perf: 16f, as well as the new *note
     sys.activate_stack_trampoline(): 69a, *note
     sys.deactivate_stack_trampoline(): 69b, and *note
     sys.is_stack_trampoline_active(): 69c. functions.  (Design by Pablo
     Galindo.  Contributed by Pablo Galindo and Christian Heimes with
     contributions from Gregory P. Smith [Google] and Mark Shannon in
     gh-96123(17).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/96670

   (2) https://github.com/python/cpython/issues/98401

   (3) https://github.com/python/cpython/issues/98401

   (4) https://peps.python.org/pep-0572/

   (5) https://github.com/python/cpython/issues/100581

   (6) https://peps.python.org/pep-0678/

   (7) https://github.com/python/cpython/issues/77757

   (8) https://github.com/python/cpython/issues/103590

   (9) https://github.com/python/cpython/issues/97922

   (10) https://github.com/python/cpython/issues/60203

   (11) https://github.com/python/cpython/issues/90751

   (12) https://github.com/python/cpython/issues/101264

   (13) https://github.com/python/cpython/issues/100425

   (14) https://github.com/python/cpython/issues/96670

   (15) https://peps.python.org/pep-0706/

   (16) https://github.com/python/cpython/issues/87995

   (17) https://github.com/python/cpython/issues/96123


File: python.info,  Node: 新たなモジュール<2>,  Next: 改良されたモジュール<2>,  Prev: その他の言語変更<2>,  Up: What's New In Python 3 12

1.3.5 新たなモジュール
----------------------

   * None.


File: python.info,  Node: 改良されたモジュール<2>,  Next: 最適化<3>,  Prev: 新たなモジュール<2>,  Up: What's New In Python 3 12

1.3.6 改良されたモジュール
--------------------------

* Menu:

* array::
* asyncio: asyncio<5>.
* calendar: calendar<2>.
* csv::
* dis: dis<3>.
* fractions: fractions<3>.
* importlib.resources: importlib resources.
* inspect: inspect<2>.
* itertools: itertools<3>.
* math: math<3>.
* os: os<3>.
* os.path: os path<3>.
* pathlib: pathlib<6>.
* プラットフォーム: プラットフォーム<2>.
* pdb: pdb<4>.
* random: random<2>.
* shutil: shutil<2>.
* sqlite3: sqlite3<3>.
* statistics: statistics<2>.
* sys: sys<3>.
* tempfile: tempfile<2>.
* threading: threading<2>.
* tkinter: tkinter<3>.
* tokenize::
* types: types<3>.
* typing: typing<4>.
* unicodedata: unicodedata<3>.
* unittest: unittest<3>.
* uuid: uuid<3>.


File: python.info,  Node: array,  Next: asyncio<5>,  Up: 改良されたモジュール<2>

1.3.6.1 array
.............

   * The *note array.array: 4be. class now supports subscripting, making
     it a *note generic type: 1a1.  (Contributed by Jelle Zijlstra in
     gh-98658(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98658


File: python.info,  Node: asyncio<5>,  Next: calendar<2>,  Prev: array,  Up: 改良されたモジュール<2>

1.3.6.2 asyncio
...............

   * The performance of writing to sockets in *note asyncio: b. has been
     significantly improved.  ‘asyncio’ now avoids unnecessary copying
     when writing to sockets and uses *note sendmsg(): 6a1. if the
     platform supports it.  (Contributed by Kumar Aditya in
     gh-91166(1).)

   * Add *note asyncio.eager_task_factory(): 6a2. and *note
     asyncio.create_eager_task_factory(): 6a3. functions to allow opting
     an event loop in to eager task execution, making some use-cases 2x
     to 5x faster.  (Contributed by Jacob Bower & Itamar Oren in
     gh-102853(2), gh-104140(3), and gh-104138(4))

   * On Linux, *note asyncio: b. uses ‘asyncio.PidfdChildWatcher’ by
     default if *note os.pidfd_open(): 6a4. is available and functional
     instead of ‘asyncio.ThreadedChildWatcher’.  (Contributed by Kumar
     Aditya in gh-98024(5).)

   * The event loop now uses the best available child watcher for each
     platform (‘asyncio.PidfdChildWatcher’ if supported and
     ‘asyncio.ThreadedChildWatcher’ otherwise), so manually configuring
     a child watcher is not recommended.  (Contributed by Kumar Aditya
     in gh-94597(6).)

   * Add 'loop_factory' parameter to *note asyncio.run(): 2f3. to allow
     specifying a custom event loop factory.  (Contributed by Kumar
     Aditya in gh-99388(7).)

   * Add C implementation of *note asyncio.current_task(): 6a5. for
     4x-6x speedup.  (Contributed by Itamar Oren and Pranav Thulasiram
     Bhat in gh-100344(8).)

   * *note asyncio.iscoroutine(): 6a6. now returns ‘False’ for
     generators as *note asyncio: b. does not support legacy
     generator-based coroutines.  (Contributed by Kumar Aditya in
     gh-102748(9).)

   * *note asyncio.wait(): 6a7. and *note asyncio.as_completed(): 4c6.
     now accepts generators yielding tasks.  (Contributed by Kumar
     Aditya in gh-78530(10).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/91166

   (2) https://github.com/python/cpython/issues/102853

   (3) https://github.com/python/cpython/issues/104140

   (4) https://github.com/python/cpython/issues/104138

   (5) https://github.com/python/cpython/issues/98024

   (6) https://github.com/python/cpython/issues/94597

   (7) https://github.com/python/cpython/issues/99388

   (8) https://github.com/python/cpython/issues/100344

   (9) https://github.com/python/cpython/issues/102748

   (10) https://github.com/python/cpython/issues/78530


File: python.info,  Node: calendar<2>,  Next: csv,  Prev: asyncio<5>,  Up: 改良されたモジュール<2>

1.3.6.3 calendar
................

   * Add enums *note calendar.Month: 6a9. and *note calendar.Day: 6aa.
     defining months of the year and days of the week.  (Contributed by
     Prince Roshan in gh-103636(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/103636


File: python.info,  Node: csv,  Next: dis<3>,  Prev: calendar<2>,  Up: 改良されたモジュール<2>

1.3.6.4 csv
...........

   * Add *note csv.QUOTE_NOTNULL: 6ac. and *note csv.QUOTE_STRINGS: 6ad.
     flags to provide finer grained control of ‘None’ and empty strings
     by *note reader: 6ae. and *note writer: 6af. objects.


File: python.info,  Node: dis<3>,  Next: fractions<3>,  Prev: csv,  Up: 改良されたモジュール<2>

1.3.6.5 dis
...........

   * Pseudo instruction opcodes (which are used by the compiler but do
     not appear in executable bytecode) are now exposed in the *note
     dis: 3c. module.  *note HAVE_ARGUMENT: 6b1. is still relevant to
     real opcodes, but it is not useful for pseudo instructions.  Use
     the new *note dis.hasarg: 59f. collection instead.  (Contributed by
     Irit Katriel in gh-94216(1).)

   * Add the *note dis.hasexc: 6b2. collection to signify instructions
     that set an exception handler.  (Contributed by Irit Katriel in
     gh-94216(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/94216

   (2) https://github.com/python/cpython/issues/94216


File: python.info,  Node: fractions<3>,  Next: importlib resources,  Prev: dis<3>,  Up: 改良されたモジュール<2>

1.3.6.6 fractions
.................

   * Objects of type *note fractions.Fraction: 213. now support
     float-style formatting.  (Contributed by Mark Dickinson in
     gh-100161(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100161


File: python.info,  Node: importlib resources,  Next: inspect<2>,  Prev: fractions<3>,  Up: 改良されたモジュール<2>

1.3.6.7 importlib.resources
...........................

   * *note importlib.resources.as_file(): 6b5. now supports resource
     directories.  (Contributed by Jason R. Coombs in gh-97930(1).)

   * Rename first parameter of *note importlib.resources.files(): 6b6.
     to 'anchor'.  (Contributed by Jason R. Coombs in gh-100598(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97930

   (2) https://github.com/python/cpython/issues/100598


File: python.info,  Node: inspect<2>,  Next: itertools<3>,  Prev: importlib resources,  Up: 改良されたモジュール<2>

1.3.6.8 inspect
...............

   * Add *note inspect.markcoroutinefunction(): 6b8. to mark sync
     functions that return a *note coroutine: 6b9. for use with *note
     inspect.iscoroutinefunction(): 30d.  (Contributed by Carlton Gibson
     in gh-99247(1).)

   * Add *note inspect.getasyncgenstate(): 6ba. and *note
     inspect.getasyncgenlocals(): 6bb. for determining the current state
     of asynchronous generators.  (Contributed by Thomas Krennwallner in
     gh-79940(2).)

   * The performance of *note inspect.getattr_static(): 6bc. has been
     considerably improved.  Most calls to the function should be at
     least 2x faster than they were in Python 3.11.  (Contributed by
     Alex Waygood in gh-103193(3).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99247

   (2) https://github.com/python/cpython/issues/79940

   (3) https://github.com/python/cpython/issues/103193


File: python.info,  Node: itertools<3>,  Next: math<3>,  Prev: inspect<2>,  Up: 改良されたモジュール<2>

1.3.6.9 itertools
.................

   * Add *note itertools.batched(): 511. for collecting into even-sized
     tuples where the last batch may be shorter than the rest.
     (Contributed by Raymond Hettinger in gh-98363(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98363


File: python.info,  Node: math<3>,  Next: os<3>,  Prev: itertools<3>,  Up: 改良されたモジュール<2>

1.3.6.10 math
.............

   * Add *note math.sumprod(): 6bf. for computing a sum of products.
     (Contributed by Raymond Hettinger in gh-100485(1).)

   * Extend *note math.nextafter(): 6c0. to include a 'steps' argument
     for moving up or down multiple steps at a time.  (Contributed by
     Matthias Goergens, Mark Dickinson, and Raymond Hettinger in
     gh-94906(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100485

   (2) https://github.com/python/cpython/issues/94906


File: python.info,  Node: os<3>,  Next: os path<3>,  Prev: math<3>,  Up: 改良されたモジュール<2>

1.3.6.11 os
...........

   * Add *note os.PIDFD_NONBLOCK: 6c2. to open a file descriptor for a
     process with *note os.pidfd_open(): 6a4. in non-blocking mode.
     (Contributed by Kumar Aditya in gh-93312(1).)

   * *note os.DirEntry: 6c3. now includes an *note
     os.DirEntry.is_junction(): 6c4. method to check if the entry is a
     junction.  (Contributed by Charles Machalow in gh-99547(2).)

   * Add *note os.listdrives(): 6c5, *note os.listvolumes(): 6c6. and
     *note os.listmounts(): 6c7. functions on Windows for enumerating
     drives, volumes and mount points.  (Contributed by Steve Dower in
     gh-102519(3).)

   * *note os.stat(): 26d. and *note os.lstat(): 6c8. are now more
     accurate on Windows.  The ‘st_birthtime’ field will now be filled
     with the creation time of the file, and ‘st_ctime’ is deprecated
     but still contains the creation time (but in the future will return
     the last metadata change, for consistency with other platforms).
     ‘st_dev’ may be up to 64 bits and ‘st_ino’ up to 128 bits depending
     on your file system, and ‘st_rdev’ is always set to zero rather
     than incorrect values.  Both functions may be significantly faster
     on newer releases of Windows.  (Contributed by Steve Dower in
     gh-99726(4).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/93312

   (2) https://github.com/python/cpython/issues/99547

   (3) https://github.com/python/cpython/issues/102519

   (4) https://github.com/python/cpython/issues/99726


File: python.info,  Node: os path<3>,  Next: pathlib<6>,  Prev: os<3>,  Up: 改良されたモジュール<2>

1.3.6.12 os.path
................

   * Add *note os.path.isjunction(): 6ca. to check if a given path is a
     junction.  (Contributed by Charles Machalow in gh-99547(1).)

   * Add *note os.path.splitroot(): 6cb. to split a path into a triad
     ‘(drive, root, tail)’.  (Contributed by Barney Gale in
     gh-101000(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99547

   (2) https://github.com/python/cpython/issues/101000


File: python.info,  Node: pathlib<6>,  Next: プラットフォーム<2>,  Prev: os path<3>,  Up: 改良されたモジュール<2>

1.3.6.13 pathlib
................

   * Add support for subclassing *note pathlib.PurePath: 6cd. and *note
     pathlib.Path: 266, plus their Posix- and Windows-specific variants.
     Subclasses may override the *note pathlib.PurePath.with_segments():
     6ce. method to pass information between path instances.

   * Add *note pathlib.Path.walk(): 6cf. for walking the directory trees
     and generating all file or directory names within them, similar to
     *note os.walk(): 6d0.  (Contributed by Stanislav Zmiev in
     gh-90385(1).)

   * Add 'walk_up' optional parameter to *note
     pathlib.PurePath.relative_to(): 2fd. to allow the insertion of ‘..’
     entries in the result; this behavior is more consistent with *note
     os.path.relpath(): 6d1.  (Contributed by Domenico Ragusa in
     gh-84538(2).)

   * Add *note pathlib.Path.is_junction(): 6d2. as a proxy to *note
     os.path.isjunction(): 6ca.  (Contributed by Charles Machalow in
     gh-99547(3).)

   * Add 'case_sensitive' optional parameter to *note
     pathlib.Path.glob(): 537, *note pathlib.Path.rglob(): 538. and
     *note pathlib.PurePath.match(): 6d3. for matching the path's case
     sensitivity, allowing for more precise control over the matching
     process.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/90385

   (2) https://github.com/python/cpython/issues/84538

   (3) https://github.com/python/cpython/issues/99547


File: python.info,  Node: プラットフォーム<2>,  Next: pdb<4>,  Prev: pathlib<6>,  Up: 改良されたモジュール<2>

1.3.6.14 プラットフォーム
.........................

   * Add support for detecting Windows 11 and Windows Server releases
     past 2012.  Previously, lookups on Windows Server platforms newer
     than Windows Server 2012 and on Windows 11 would return
     ‘Windows-10’.  (Contributed by Steve Dower in gh-89545(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89545


File: python.info,  Node: pdb<4>,  Next: random<2>,  Prev: プラットフォーム<2>,  Up: 改良されたモジュール<2>

1.3.6.15 pdb
............

   * Add convenience variables to hold values temporarily for debug
     session and provide quick access to values like the current frame
     or the return value.  (Contributed by Tian Gao in gh-103693(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/103693


File: python.info,  Node: random<2>,  Next: shutil<2>,  Prev: pdb<4>,  Up: 改良されたモジュール<2>

1.3.6.16 random
...............

   * Add *note random.binomialvariate(): 6d7.  (Contributed by Raymond
     Hettinger in gh-81620(1).)

   * Add a default of ‘lambd=1.0’ to *note random.expovariate(): 6d8.
     (Contributed by Raymond Hettinger in gh-100234(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/81620

   (2) https://github.com/python/cpython/issues/100234


File: python.info,  Node: shutil<2>,  Next: sqlite3<3>,  Prev: random<2>,  Up: 改良されたモジュール<2>

1.3.6.17 shutil
...............

   * *note shutil.make_archive(): 6da. now passes the 'root_dir'
     argument to custom archivers which support it.  In this case it no
     longer temporarily changes the current working directory of the
     process to 'root_dir' to perform archiving.  (Contributed by Serhiy
     Storchaka in gh-74696(1).)

   * *note shutil.rmtree(): 356. now accepts a new argument 'onexc'
     which is an error handler like 'onerror' but which expects an
     exception instance rather than a '(typ, val, tb)' triplet.
     'onerror' is deprecated.  (Contributed by Irit Katriel in
     gh-102828(2).)

   * *note shutil.which(): 6db. now consults the 'PATHEXT' environment
     variable to find matches within 'PATH' on Windows even when the
     given 'cmd' includes a directory component.  (Contributed by
     Charles Machalow in gh-103179(3).)

     *note shutil.which(): 6db. will call
     ‘NeedCurrentDirectoryForExePathW’ when querying for executables on
     Windows to determine if the current working directory should be
     prepended to the search path.  (Contributed by Charles Machalow in
     gh-103179(4).)

     *note shutil.which(): 6db. will return a path matching the 'cmd'
     with a component from ‘PATHEXT’ prior to a direct match elsewhere
     in the search path on Windows.  (Contributed by Charles Machalow in
     gh-103179(5).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/74696

   (2) https://github.com/python/cpython/issues/102828

   (3) https://github.com/python/cpython/issues/103179

   (4) https://github.com/python/cpython/issues/103179

   (5) https://github.com/python/cpython/issues/103179


File: python.info,  Node: sqlite3<3>,  Next: statistics<2>,  Prev: shutil<2>,  Up: 改良されたモジュール<2>

1.3.6.18 sqlite3
................

   * Add a *note command-line interface: 674.  (Contributed by Erlend E.
     Aasland in gh-77617(1).)

   * Add the *note sqlite3.Connection.autocommit: 6dd. attribute to
     *note sqlite3.Connection: 54d. and the 'autocommit' parameter to
     *note sqlite3.connect(): 5a6. to control PEP 249(2)-compliant *note
     transaction handling: 6de.  (Contributed by Erlend E. Aasland in
     gh-83638(3).)

   * Add 'entrypoint' keyword-only parameter to *note
     sqlite3.Connection.load_extension(): 6df, for overriding the SQLite
     extension entry point.  (Contributed by Erlend E. Aasland in
     gh-103015(4).)

   * Add *note sqlite3.Connection.getconfig(): 6e0. and *note
     sqlite3.Connection.setconfig(): 6e1. to *note sqlite3.Connection:
     54d. to make configuration changes to a database connection.
     (Contributed by Erlend E. Aasland in gh-103489(5).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/77617

   (2) https://peps.python.org/pep-0249/

   (3) https://github.com/python/cpython/issues/83638

   (4) https://github.com/python/cpython/issues/103015

   (5) https://github.com/python/cpython/issues/103489


File: python.info,  Node: statistics<2>,  Next: sys<3>,  Prev: sqlite3<3>,  Up: 改良されたモジュール<2>

1.3.6.19 statistics
...................

   * Extend *note statistics.correlation(): 6e3. to include as a
     ‘ranked’ method for computing the Spearman correlation of ranked
     data.  (Contributed by Raymond Hettinger in gh-95861(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/95861


File: python.info,  Node: sys<3>,  Next: tempfile<2>,  Prev: statistics<2>,  Up: 改良されたモジュール<2>

1.3.6.20 sys
............

   * Add the *note sys.monitoring: e0. namespace to expose the new *note
     PEP 669: 671. monitoring API. (Contributed by Mark Shannon in
     gh-103082(1).)

   * Add *note sys.activate_stack_trampoline(): 69a. and *note
     sys.deactivate_stack_trampoline(): 69b. for activating and
     deactivating stack profiler trampolines, and *note
     sys.is_stack_trampoline_active(): 69c. for querying if stack
     profiler trampolines are active.  (Contributed by Pablo Galindo and
     Christian Heimes with contributions from Gregory P. Smith [Google]
     and Mark Shannon in gh-96123(2).)

   * Add *note sys.last_exc: 6e5. which holds the last unhandled
     exception that was raised (for post-mortem debugging use cases).
     Deprecate the three fields that have the same information in its
     legacy form: *note sys.last_type: 6e6, *note sys.last_value: 6e7.
     and *note sys.last_traceback: 6e8.  (Contributed by Irit Katriel in
     gh-102778(3).)

   * *note sys._current_exceptions(): 6e9. now returns a mapping from
     thread-id to an exception instance, rather than to a ‘(typ, exc,
     tb)’ tuple.  (Contributed by Irit Katriel in gh-103176(4).)

   * *note sys.setrecursionlimit(): 6ea. and *note
     sys.getrecursionlimit(): 6eb.  The recursion limit now applies only
     to Python code.  Builtin functions do not use the recursion limit,
     but are protected by a different mechanism that prevents recursion
     from causing a virtual machine crash.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/103082

   (2) https://github.com/python/cpython/issues/96123

   (3) https://github.com/python/cpython/issues/102778

   (4) https://github.com/python/cpython/issues/103176


File: python.info,  Node: tempfile<2>,  Next: threading<2>,  Prev: sys<3>,  Up: 改良されたモジュール<2>

1.3.6.21 tempfile
.................

   * The *note tempfile.NamedTemporaryFile: 6ed. function has a new
     optional parameter 'delete_on_close' (Contributed by Evgeny Zorin
     in gh-58451(1).)

   * *note tempfile.mkdtemp(): 52d. now always returns an absolute path,
     even if the argument provided to the 'dir' parameter is a relative
     path.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/58451


File: python.info,  Node: threading<2>,  Next: tkinter<3>,  Prev: tempfile<2>,  Up: 改良されたモジュール<2>

1.3.6.22 threading
..................

   * Add *note threading.settrace_all_threads(): 6ef. and *note
     threading.setprofile_all_threads(): 6f0. that allow to set tracing
     and profiling functions in all running threads in addition to the
     calling one.  (Contributed by Pablo Galindo in gh-93503(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/93503


File: python.info,  Node: tkinter<3>,  Next: tokenize,  Prev: threading<2>,  Up: 改良されたモジュール<2>

1.3.6.23 tkinter
................

   * ‘tkinter.Canvas.coords()’ now flattens its arguments.  It now
     accepts not only coordinates as separate arguments (‘x1, y1, x2,
     y2, ...’) and a sequence of coordinates (‘[x1, y1, x2, y2, ...]’),
     but also coordinates grouped in pairs (‘(x1, y1), (x2, y2), ...’
     and ‘[(x1, y1), (x2, y2), ...]’), like ‘create_*()’ methods.
     (Contributed by Serhiy Storchaka in gh-94473(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/94473


File: python.info,  Node: tokenize,  Next: types<3>,  Prev: tkinter<3>,  Up: 改良されたモジュール<2>

1.3.6.24 tokenize
.................

   * The *note tokenize: 101. module includes the changes introduced in
     PEP 701(1).  (Contributed by Marta Gómez Macías and Pablo Galindo
     in gh-102856(2).)  See *note Python 3.12 への移植: 6f3. for more
     information on the changes to the *note tokenize: 101. module.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0701/

   (2) https://github.com/python/cpython/issues/102856


File: python.info,  Node: types<3>,  Next: typing<4>,  Prev: tokenize,  Up: 改良されたモジュール<2>

1.3.6.25 types
..............

   * Add *note types.get_original_bases(): 6f5. to allow for further
     introspection of *note ユーザー定義のジェネリック型: 6f6. when
     subclassed.  (Contributed by James Hilton-Balfe and Alex Waygood in
     gh-101827(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101827


File: python.info,  Node: typing<4>,  Next: unicodedata<3>,  Prev: types<3>,  Up: 改良されたモジュール<2>

1.3.6.26 typing
...............

   * *note isinstance(): 2ad. checks against *note runtime-checkable
     protocols: 675. now use *note inspect.getattr_static(): 6bc. rather
     than *note hasattr(): 6f9. to lookup whether attributes exist.
     This means that descriptors and *note __getattr__(): 6fa. methods
     are no longer unexpectedly evaluated during ‘isinstance()’ checks
     against runtime-checkable protocols.  However, it may also mean
     that some objects which used to be considered instances of a
     runtime-checkable protocol may no longer be considered instances of
     that protocol on Python 3.12+, and vice versa.  Most users are
     unlikely to be affected by this change.  (Contributed by Alex
     Waygood in gh-102433(1).)

   * The members of a runtime-checkable protocol are now considered
     "frozen" at runtime as soon as the class has been created.
     Monkey-patching attributes onto a runtime-checkable protocol will
     still work, but will have no impact on *note isinstance(): 2ad.
     checks comparing objects to the protocol.  For example:

          >>> from typing import Protocol, runtime_checkable
          >>> @runtime_checkable
          ... class HasX(Protocol):
          ...     x = 1
          ...
          >>> class Foo: ...
          ...
          >>> f = Foo()
          >>> isinstance(f, HasX)
          False
          >>> f.x = 1
          >>> isinstance(f, HasX)
          True
          >>> HasX.y = 2
          >>> isinstance(f, HasX)  # unchanged, even though HasX now also has a "y" attribute
          True

     This change was made in order to speed up ‘isinstance()’ checks
     against runtime-checkable protocols.

   * The performance profile of *note isinstance(): 2ad. checks against
     *note runtime-checkable protocols: 675. has changed significantly.
     Most ‘isinstance()’ checks against protocols with only a few
     members should be at least 2x faster than in 3.11, and some may be
     20x faster or more.  However, ‘isinstance()’ checks against
     protocols with many members may be slower than in Python 3.11.
     (Contributed by Alex Waygood in gh-74690(2) and gh-103193(3).)

   * All *note typing.TypedDict: 332. and *note typing.NamedTuple: 331.
     classes now have the ‘__orig_bases__’ attribute.  (Contributed by
     Adrian Garcia Badaracco in gh-103699(4).)

   * Add ‘frozen_default’ parameter to *note
     typing.dataclass_transform(): 6fb.  (Contributed by Erik De Bonte
     in gh-99957(5).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102433

   (2) https://github.com/python/cpython/issues/74690

   (3) https://github.com/python/cpython/issues/103193

   (4) https://github.com/python/cpython/issues/103699

   (5) https://github.com/python/cpython/issues/99957


File: python.info,  Node: unicodedata<3>,  Next: unittest<3>,  Prev: typing<4>,  Up: 改良されたモジュール<2>

1.3.6.27 unicodedata
....................

   * The Unicode database has been updated to version 15.0.0.
     (Contributed by Benjamin Peterson in gh-96734(1)).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/96734


File: python.info,  Node: unittest<3>,  Next: uuid<3>,  Prev: unicodedata<3>,  Up: 改良されたモジュール<2>

1.3.6.28 unittest
.................

Add a ‘--durations’ command line option, showing the N slowest test
cases:

     python3 -m unittest --durations=3 lib.tests.test_threading
     .....
     Slowest test durations
     ----------------------------------------------------------------------
     1.210s     test_timeout (Lib.test.test_threading.BarrierTests)
     1.003s     test_default_timeout (Lib.test.test_threading.BarrierTests)
     0.518s     test_timeout (Lib.test.test_threading.EventTests)

     (0.000 durations hidden.  Use -v to show these durations.)
     ----------------------------------------------------------------------
     Ran 158 tests in 9.869s

     OK (skipped=3)

(Contributed by Giampaolo Rodola in gh-48330(1))

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/48330


File: python.info,  Node: uuid<3>,  Prev: unittest<3>,  Up: 改良されたモジュール<2>

1.3.6.29 uuid
.............

   * Add a *note command-line interface: 676.  (Contributed by Adam
     Chhina in gh-88597(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/88597


File: python.info,  Node: 最適化<3>,  Next: CPython バイトコードの変更<2>,  Prev: 改良されたモジュール<2>,  Up: What's New In Python 3 12

1.3.7 最適化
------------

   * Remove ‘wstr’ and ‘wstr_length’ members from Unicode objects.  It
     reduces object size by 8 or 16 bytes on 64bit platform.  ( PEP
     623(1)) (Contributed by Inada Naoki in gh-92536(2).)

   * Add experimental support for using the BOLT binary optimizer in the
     build process, which improves performance by 1-5%.  (Contributed by
     Kevin Modzelewski in gh-90536(3) and tuned by Donghee Na in
     gh-101525(4))

   * Speed up the regular expression substitution (functions *note
     re.sub(): 5a3. and *note re.subn(): 5a4. and corresponding
     ‘re.Pattern’ methods) for replacement strings containing group
     references by 2-3 times.  (Contributed by Serhiy Storchaka in
     gh-91524(5).)

   * Speed up *note asyncio.Task: 1c7. creation by deferring expensive
     string formatting.  (Contributed by Itamar Oren in gh-103793(6).)

   * The *note tokenize.tokenize(): 700. and *note
     tokenize.generate_tokens(): 701. functions are up to 64% faster as
     a side effect of the changes required to cover PEP 701(7) in the
     *note tokenize: 101. module.  (Contributed by Marta Gómez Macías
     and Pablo Galindo in gh-102856(8).)

   * Speed up *note super(): 1a6. method calls and attribute loads via
     the new *note LOAD_SUPER_ATTR: 702. instruction.  (Contributed by
     Carl Meyer and Vladimir Matveev in gh-103497(9).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0623/

   (2) https://github.com/python/cpython/issues/92536

   (3) https://github.com/python/cpython/issues/90536

   (4) https://github.com/python/cpython/issues/101525

   (5) https://github.com/python/cpython/issues/91524

   (6) https://github.com/python/cpython/issues/103793

   (7) https://peps.python.org/pep-0701/

   (8) https://github.com/python/cpython/issues/102856

   (9) https://github.com/python/cpython/issues/103497


File: python.info,  Node: CPython バイトコードの変更<2>,  Next: Demos and Tools,  Prev: 最適化<3>,  Up: What's New In Python 3 12

1.3.8 CPython バイトコードの変更
--------------------------------

   * Remove the ‘LOAD_METHOD’ instruction.  It has been merged into
     *note LOAD_ATTR: 704.  *note LOAD_ATTR: 704. will now behave like
     the old ‘LOAD_METHOD’ instruction if the low bit of its oparg is
     set.  (Contributed by Ken Jin in gh-93429(1).)

   * Remove the ‘JUMP_IF_FALSE_OR_POP’ and ‘JUMP_IF_TRUE_OR_POP’
     instructions.  (Contributed by Irit Katriel in gh-102859(2).)

   * Remove the ‘PRECALL’ instruction.  (Contributed by Mark Shannon in
     gh-92925(3).)

   * Add the *note BINARY_SLICE: 705. and *note STORE_SLICE: 706.
     instructions.  (Contributed by Mark Shannon in gh-94163(4).)

   * Add the *note CALL_INTRINSIC_1: 707. instructions.  (Contributed by
     Mark Shannon in gh-99005(5).)

   * Add the *note CALL_INTRINSIC_2: 708. instruction.  (Contributed by
     Irit Katriel in gh-101799(6).)

   * Add the *note CLEANUP_THROW: 709. instruction.  (Contributed by
     Brandt Bucher in gh-90997(7).)

   * Add the ‘END_SEND’ instruction.  (Contributed by Mark Shannon in
     gh-103082(8).)

   * Add the *note LOAD_FAST_AND_CLEAR: 70a. instruction as part of the
     implementation of PEP 709(9).  (Contributed by Carl Meyer in
     gh-101441(10).)

   * Add the *note LOAD_FAST_CHECK: 70b. instruction.  (Contributed by
     Dennis Sweeney in gh-93143(11).)

   * Add the *note LOAD_FROM_DICT_OR_DEREF: 70c, *note
     LOAD_FROM_DICT_OR_GLOBALS: 70d, and *note LOAD_LOCALS: 70e. opcodes
     as part of the implementation of PEP 695(12).  Remove the
     ‘LOAD_CLASSDEREF’ opcode, which can be replaced with *note
     LOAD_LOCALS: 70e. plus *note LOAD_FROM_DICT_OR_DEREF: 70c.
     (Contributed by Jelle Zijlstra in gh-103764(13).)

   * Add the *note LOAD_SUPER_ATTR: 702. instruction.  (Contributed by
     Carl Meyer and Vladimir Matveev in gh-103497(14).)

   * Add the ‘RETURN_CONST’ instruction.  (Contributed by Wenyang Wang
     in gh-101632(15).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/93429

   (2) https://github.com/python/cpython/issues/102859

   (3) https://github.com/python/cpython/issues/92925

   (4) https://github.com/python/cpython/issues/94163

   (5) https://github.com/python/cpython/issues/99005

   (6) https://github.com/python/cpython/issues/101799

   (7) https://github.com/python/cpython/issues/90997

   (8) https://github.com/python/cpython/issues/103082

   (9) https://peps.python.org/pep-0709/

   (10) https://github.com/python/cpython/issues/101441

   (11) https://github.com/python/cpython/issues/93143

   (12) https://peps.python.org/pep-0695/

   (13) https://github.com/python/cpython/issues/103764

   (14) https://github.com/python/cpython/issues/103497

   (15) https://github.com/python/cpython/issues/101632


File: python.info,  Node: Demos and Tools,  Next: 非推奨<2>,  Prev: CPython バイトコードの変更<2>,  Up: What's New In Python 3 12

1.3.9 Demos and Tools
---------------------

   * Remove the ‘Tools/demo/’ directory which contained old demo
     scripts.  A copy can be found in the old-demos project(1).
     (Contributed by Victor Stinner in gh-97681(2).)

   * Remove outdated example scripts of the ‘Tools/scripts/’ directory.
     A copy can be found in the old-demos project(3).  (Contributed by
     Victor Stinner in gh-97669(4).)

   ---------- Footnotes ----------

   (1) https://github.com/gvanrossum/old-demos

   (2) https://github.com/python/cpython/issues/97681

   (3) https://github.com/gvanrossum/old-demos

   (4) https://github.com/python/cpython/issues/97669


File: python.info,  Node: 非推奨<2>,  Next: 削除<2>,  Prev: Demos and Tools,  Up: What's New In Python 3 12

1.3.10 非推奨
-------------

   * *note argparse: 7.: The 'type', 'choices', and 'metavar' parameters
     of ‘argparse.BooleanOptionalAction’ are deprecated and will be
     removed in 3.14.  (Contributed by Nikita Sobolev in gh-92248(1).)

   * *note ast: 9.: The following *note ast: 9. features have been
     deprecated in documentation since Python 3.8, now cause a *note
     DeprecationWarning: 1a3. to be emitted at runtime when they are
     accessed or used, and will be removed in Python 3.14:

        * ‘ast.Num’

        * ‘ast.Str’

        * ‘ast.Bytes’

        * ‘ast.NameConstant’

        * ‘ast.Ellipsis’

     Use *note ast.Constant: 2ef. instead.  (Contributed by Serhiy
     Storchaka in gh-90953(2).)

   * *note asyncio: b.:

        * The child watcher classes ‘asyncio.MultiLoopChildWatcher’,
          ‘asyncio.FastChildWatcher’, ‘asyncio.AbstractChildWatcher’ and
          ‘asyncio.SafeChildWatcher’ are deprecated and will be removed
          in Python 3.14.  (Contributed by Kumar Aditya in gh-94597(3).)

        * ‘asyncio.set_child_watcher()’, ‘asyncio.get_child_watcher()’,
          ‘asyncio.AbstractEventLoopPolicy.set_child_watcher()’ and
          ‘asyncio.AbstractEventLoopPolicy.get_child_watcher()’ are
          deprecated and will be removed in Python 3.14.  (Contributed
          by Kumar Aditya in gh-94597(4).)

        * The *note get_event_loop(): 2f2. method of the default event
          loop policy now emits a *note DeprecationWarning: 1a3. if
          there is no current event loop set and it decides to create
          one.  (Contributed by Serhiy Storchaka and Guido van Rossum in
          gh-100160(5).)

   * *note calendar: 15.: ‘calendar.January’ and ‘calendar.February’
     constants are deprecated and replaced by *note calendar.JANUARY:
     34e. and *note calendar.FEBRUARY: 34f.  (Contributed by Prince
     Roshan in gh-103636(6).)

   * *note collections.abc: 1f.: Deprecated *note
     collections.abc.ByteString: 342.

     Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
     implements the *note buffer protocol: 260. at runtime.  For use in
     type annotations, either use *note Buffer: 343. or a union that
     explicitly specifies the types your code supports (e.g., ‘bytes |
     bytearray | memoryview’).

     ‘ByteString’ was originally intended to be an abstract class that
     would serve as a supertype of both *note bytes: 192. and *note
     bytearray: 344.  However, since the ABC never had any methods,
     knowing that an object was an instance of ‘ByteString’ never
     actually told you anything useful about the object.  Other common
     buffer types such as *note memoryview: 165. were also never
     understood as subtypes of ‘ByteString’ (either at runtime or by
     static type checkers).

     See PEP 688(7) for more details.  (Contributed by Shantanu Jain in
     gh-91896(8).)

   * *note datetime: 34.: *note datetime.datetime: 4e2.'s *note
     utcnow(): 351. and *note utcfromtimestamp(): 352. are deprecated
     and will be removed in a future version.  Instead, use
     timezone-aware objects to represent datetimes in UTC: respectively,
     call *note now(): 711. and *note fromtimestamp(): 712. with the
     'tz' parameter set to *note datetime.UTC: 713.  (Contributed by
     Paul Ganssle in gh-103857(9).)

   * *note email: 3f.: Deprecate the 'isdst' parameter in *note
     email.utils.localtime(): 2f7.  (Contributed by Alan Williams in
     gh-72346(10).)

   * *note importlib.abc: 7c.: Deprecated the following classes,
     scheduled for removal in Python 3.14:

        * ‘importlib.abc.ResourceReader’

        * ‘importlib.abc.Traversable’

        * ‘importlib.abc.TraversableResources’

     Use *note importlib.resources.abc: 80. classes instead:

        * *note importlib.resources.abc.Traversable: 2fa.

        * *note importlib.resources.abc.TraversableResources: 2f9.

     (Contributed by Jason R. Coombs and Hugo van Kemenade in
     gh-93963(11).)

   * *note itertools: 85.: Deprecate the support for copy, deepcopy, and
     pickle operations, which is undocumented, inefficient, historically
     buggy, and inconsistent.  This will be removed in 3.14 for a
     significant reduction in code volume and maintenance burden.
     (Contributed by Raymond Hettinger in gh-101588(12).)

   * *note multiprocessing: 98.: In Python 3.14, the default *note
     multiprocessing: 98. start method will change to a safer one on
     Linux, BSDs, and other non-macOS POSIX platforms where ‘'fork'’ is
     currently the default (gh-84559(13)).  Adding a runtime warning
     about this was deemed too disruptive as the majority of code is not
     expected to care.  Use the *note get_context(): 24a. or *note
     set_start_method(): 24b. APIs to explicitly specify when your code
     'requires' ‘'fork'’.  See *note contexts and start methods: 1d5.

   * *note pkgutil: ae.: ‘pkgutil.find_loader()’ and
     ‘pkgutil.get_loader()’ are deprecated and will be removed in Python
     3.14; use *note importlib.util.find_spec(): 5af. instead.
     (Contributed by Nikita Sobolev in gh-97850(14).)

   * *note pty: b6.: The module has two undocumented ‘master_open()’ and
     ‘slave_open()’ functions that have been deprecated since Python 2
     but only gained a proper *note DeprecationWarning: 1a3. in 3.12.
     Remove them in 3.14.  (Contributed by Soumendra Ganguly and Gregory
     P. Smith in gh-85984(15).)

   * *note os: a5.:

        * The ‘st_ctime’ fields return by *note os.stat(): 26d. and
          *note os.lstat(): 6c8. on Windows are deprecated.  In a future
          release, they will contain the last metadata change time,
          consistent with other platforms.  For now, they still contain
          the creation time, which is also available in the new
          ‘st_birthtime’ field.  (Contributed by Steve Dower in
          gh-99726(16).)

        * On POSIX platforms, *note os.fork(): 4b5. can now raise a
          *note DeprecationWarning: 1a3. when it can detect being called
          from a multithreaded process.  There has always been a
          fundamental incompatibility with the POSIX platform when doing
          so.  Even if such code 'appeared' to work.  We added the
          warning to raise awareness as issues encountered by code doing
          this are becoming more frequent.  See the *note os.fork():
          4b5. documentation for more details along with this discussion
          on fork being incompatible with threads(17) for 'why' we're
          now surfacing this longstanding platform compatibility problem
          to developers.

     When this warning appears due to usage of *note multiprocessing:
     98. or *note concurrent.futures: 24. the fix is to use a different
     *note multiprocessing: 98. start method such as ‘"spawn"’ or
     ‘"forkserver"’.

   * *note shutil: ca.: The 'onerror' argument of *note shutil.rmtree():
     356. is deprecated; use 'onexc' instead.  (Contributed by Irit
     Katriel in gh-102828(18).)

   * *note sqlite3: d4.:

        * *note default adapters and converters: 714. are now
          deprecated.  Instead, use the *note
          適合関数と変換関数のレシピ集: 715. and tailor them to your
          needs.  (Contributed by Erlend E. Aasland in gh-90016(19).)

        * In *note execute(): 5b0, *note DeprecationWarning: 1a3. is now
          emitted when *note named placeholders: 5b2. are used together
          with parameters supplied as a *note sequence: 716. instead of
          as a *note dict: 183.  Starting from Python 3.14, using named
          placeholders with parameters supplied as a sequence will raise
          a *note ProgrammingError: 305.  (Contributed by Erlend E.
          Aasland in gh-101698(20).)

   * *note sys: df.: The *note sys.last_type: 6e6, *note sys.last_value:
     6e7. and *note sys.last_traceback: 6e8. fields are deprecated.  Use
     *note sys.last_exc: 6e5. instead.  (Contributed by Irit Katriel in
     gh-102778(21).)

   * *note tarfile: e4.: Extracting tar archives without specifying
     'filter' is deprecated until Python 3.14, when ‘'data'’ filter will
     become the default.  See *note Extraction filters: 697. for
     details.

   * *note typing: 10a.:

        * *note typing.Hashable: 717. and *note typing.Sized: 718,
          aliases for *note collections.abc.Hashable: 719. and *note
          collections.abc.Sized: 71a. respectively, are deprecated.
          (gh-94309(22).)

        * *note typing.ByteString: 345, deprecated since Python 3.9, now
          causes a *note DeprecationWarning: 1a3. to be emitted when it
          is used.  (Contributed by Alex Waygood in gh-91896(23).)

   * *note xml.etree.ElementTree: 12b.: The module now emits *note
     DeprecationWarning: 1a3. when testing the truth value of an *note
     xml.etree.ElementTree.Element: 363.  Before, the Python
     implementation emitted *note FutureWarning: 659, and the C
     implementation emitted nothing.  (Contributed by Jacob Walls in
     gh-83122(24).)

   * The 3-arg signatures (type, value, traceback) of *note coroutine
     throw(): 71b, *note generator throw(): 71c. and *note async
     generator throw(): 71d. are deprecated and may be removed in a
     future version of Python.  Use the single-arg versions of these
     functions instead.  (Contributed by Ofey Chan in gh-89874(25).)

   * *note DeprecationWarning: 1a3. is now raised when *note
     __package__: 323. on a module differs from *note __spec__.parent:
     324. (previously it was *note ImportWarning: 71e.).  (Contributed
     by Brett Cannon in gh-65961(26).)

   * Setting *note __package__: 323. or *note __cached__: 321. on a
     module is deprecated, and will cease to be set or taken into
     consideration by the import system in Python 3.14.  (Contributed by
     Brett Cannon in gh-65961(27).)

   * The bitwise inversion operator (‘~’) on bool is deprecated.  It
     will throw an error in Python 3.16.  Use ‘not’ for logical negation
     of bools instead.  In the rare case that you really need the
     bitwise inversion of the underlying ‘int’, convert to int
     explicitly: ‘~int(x)’.  (Contributed by Tim Hoffmann in
     gh-103487(28).)

   * Accessing *note co_lnotab: 330. on code objects was deprecated in
     Python 3.10 via PEP 626(29), but it only got a proper *note
     DeprecationWarning: 1a3. in 3.12.  May be removed in 3.15.
     (Contributed by Nikita Sobolev in gh-101866(30).)

* Menu:

* Pending removal in Python 3.13: Pending removal in Python 3 13.
* Pending removal in Python 3.14: Pending removal in Python 3 14<3>.
* Pending removal in Python 3.15: Pending removal in Python 3 15<5>.
* Pending removal in Python 3.16: Pending removal in Python 3 16<5>.
* Pending removal in Python 3.17: Pending removal in Python 3 17<3>.
* Pending removal in future versions: Pending removal in future versions<5>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/92248

   (2) https://github.com/python/cpython/issues/90953

   (3) https://github.com/python/cpython/issues/94597

   (4) https://github.com/python/cpython/issues/94597

   (5) https://github.com/python/cpython/issues/100160

   (6) https://github.com/python/cpython/issues/103636

   (7) https://peps.python.org/pep-0688/#current-options

   (8) https://github.com/python/cpython/issues/91896

   (9) https://github.com/python/cpython/issues/103857

   (10) https://github.com/python/cpython/issues/72346

   (11) https://github.com/python/cpython/issues/93963

   (12) https://github.com/python/cpython/issues/101588

   (13) https://github.com/python/cpython/issues/84559

   (14) https://github.com/python/cpython/issues/97850

   (15) https://github.com/python/cpython/issues/85984

   (16) https://github.com/python/cpython/issues/99726

   (17) 
https://discuss.python.org/t/concerns-regarding-deprecation-of-fork-with-alive-threads/33555

   (18) https://github.com/python/cpython/issues/102828

   (19) https://github.com/python/cpython/issues/90016

   (20) https://github.com/python/cpython/issues/101698

   (21) https://github.com/python/cpython/issues/102778

   (22) https://github.com/python/cpython/issues/94309

   (23) https://github.com/python/cpython/issues/91896

   (24) https://github.com/python/cpython/issues/83122

   (25) https://github.com/python/cpython/issues/89874

   (26) https://github.com/python/cpython/issues/65961

   (27) https://github.com/python/cpython/issues/65961

   (28) https://github.com/python/cpython/issues/103487

   (29) https://peps.python.org/pep-0626/

   (30) https://github.com/python/cpython/issues/101866


File: python.info,  Node: Pending removal in Python 3 13,  Next: Pending removal in Python 3 14<3>,  Up: 非推奨<2>

1.3.10.1 Pending removal in Python 3.13
.......................................

モジュール( PEP 594(1) を参照):

   * ‘aifc’

   * ‘audioop’

   * ‘cgi’

   * ‘cgitb’

   * ‘chunk’

   * ‘crypt’

   * ‘imghdr’

   * ‘mailcap’

   * ‘msilib’

   * ‘nis’

   * ‘nntplib’

   * ‘ossaudiodev’

   * ‘pipes’

   * ‘sndhdr’

   * ‘spwd’

   * ‘sunau’

   * ‘telnetlib’

   * ‘uu’

   * ‘xdrlib’

その他のモジュール:

   * ‘lib2to3’, and the ‘2to3’ program (gh-84540(2))

API

   * ‘configparser.LegacyInterpolation’ (gh-90765(3))

   * ‘locale.resetlocale()’ (gh-90817(4))

   * ‘turtle.RawTurtle.settiltangle()’ (gh-50096(5))

   * ‘unittest.findTestCases()’ (gh-50096(6))

   * ‘unittest.getTestCaseNames()’ (gh-50096(7))

   * ‘unittest.makeSuite()’ (gh-50096(8))

   * ‘unittest.TestProgram.usageExit()’ (gh-67048(9))

   * ‘webbrowser.MacOSX’ (gh-86421(10))

   * *note classmethod: 48e. descriptor chaining (gh-89519(11))

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://github.com/python/cpython/issues/84540

   (3) https://github.com/python/cpython/issues/90765

   (4) https://github.com/python/cpython/issues/90817

   (5) https://github.com/python/cpython/issues/50096

   (6) https://github.com/python/cpython/issues/50096

   (7) https://github.com/python/cpython/issues/50096

   (8) https://github.com/python/cpython/issues/50096

   (9) https://github.com/python/cpython/issues/67048

   (10) https://github.com/python/cpython/issues/86421

   (11) https://github.com/python/cpython/issues/89519


File: python.info,  Node: Pending removal in Python 3 14<3>,  Next: Pending removal in Python 3 15<5>,  Prev: Pending removal in Python 3 13,  Up: 非推奨<2>

1.3.10.2 Pending removal in Python 3.14
.......................................

   * *note argparse: 7.: The 'type', 'choices', and 'metavar' parameters
     of ‘argparse.BooleanOptionalAction’ are deprecated and will be
     removed in 3.14.  (Contributed by Nikita Sobolev in gh-92248(1).)

   * *note ast: 9.: The following features have been deprecated in
     documentation since Python 3.8, now cause a *note
     DeprecationWarning: 1a3. to be emitted at runtime when they are
     accessed or used, and will be removed in Python 3.14:

        * ‘ast.Num’

        * ‘ast.Str’

        * ‘ast.Bytes’

        * ‘ast.NameConstant’

        * ‘ast.Ellipsis’

     Use *note ast.Constant: 2ef. instead.  (Contributed by Serhiy
     Storchaka in gh-90953(2).)

   * *note asyncio: b.:

        * The child watcher classes ‘asyncio.MultiLoopChildWatcher’,
          ‘asyncio.FastChildWatcher’, ‘asyncio.AbstractChildWatcher’ and
          ‘asyncio.SafeChildWatcher’ are deprecated and will be removed
          in Python 3.14.  (Contributed by Kumar Aditya in gh-94597(3).)

        * ‘asyncio.set_child_watcher()’, ‘asyncio.get_child_watcher()’,
          ‘asyncio.AbstractEventLoopPolicy.set_child_watcher()’ and
          ‘asyncio.AbstractEventLoopPolicy.get_child_watcher()’ are
          deprecated and will be removed in Python 3.14.  (Contributed
          by Kumar Aditya in gh-94597(4).)

        * The *note get_event_loop(): 2f2. method of the default event
          loop policy now emits a *note DeprecationWarning: 1a3. if
          there is no current event loop set and it decides to create
          one.  (Contributed by Serhiy Storchaka and Guido van Rossum in
          gh-100160(5).)

   * *note email: 3f.: Deprecated the 'isdst' parameter in *note
     email.utils.localtime(): 2f7.  (Contributed by Alan Williams in
     gh-72346(6).)

   * *note importlib.abc: 7c. deprecated classes:

        * ‘importlib.abc.ResourceReader’

        * ‘importlib.abc.Traversable’

        * ‘importlib.abc.TraversableResources’

     Use *note importlib.resources.abc: 80. classes instead:

        * *note importlib.resources.abc.Traversable: 2fa.

        * *note importlib.resources.abc.TraversableResources: 2f9.

     (Contributed by Jason R. Coombs and Hugo van Kemenade in
     gh-93963(7).)

   * *note itertools: 85. had undocumented, inefficient, historically
     buggy, and inconsistent support for copy, deepcopy, and pickle
     operations.  This will be removed in 3.14 for a significant
     reduction in code volume and maintenance burden.  (Contributed by
     Raymond Hettinger in gh-101588(8).)

   * *note multiprocessing: 98.: The default start method will change to
     a safer one on Linux, BSDs, and other non-macOS POSIX platforms
     where ‘'fork'’ is currently the default (gh-84559(9)).  Adding a
     runtime warning about this was deemed too disruptive as the
     majority of code is not expected to care.  Use the *note
     get_context(): 24a. or *note set_start_method(): 24b. APIs to
     explicitly specify when your code 'requires' ‘'fork'’.  See *note
     コンテキストと開始方式: 1d5.

   * *note pathlib: a8.: *note is_relative_to(): 2fe. and *note
     relative_to(): 2fd.: passing additional arguments is deprecated.

   * *note pkgutil: ae.: ‘pkgutil.find_loader()’ and
     ‘pkgutil.get_loader()’ now raise *note DeprecationWarning: 1a3.;
     use *note importlib.util.find_spec(): 5af. instead.  (Contributed
     by Nikita Sobolev in gh-97850(10).)

   * *note pty: b6.:

        * ‘master_open()’: use *note pty.openpty(): 301.

        * ‘slave_open()’: use *note pty.openpty(): 301.

   * *note sqlite3: d4.:

        * ‘version’ and ‘version_info’.

        * *note execute(): 5b0. and *note executemany(): 5b1. if *note
          named placeholders: 5b2. are used and 'parameters' is a
          sequence instead of a *note dict: 183.

   * *note urllib: 10e.: ‘urllib.parse.Quoter’ is deprecated: it was not
     intended to be a public API. (Contributed by Gregory P. Smith in
     gh-88168(11).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/92248

   (2) https://github.com/python/cpython/issues/90953

   (3) https://github.com/python/cpython/issues/94597

   (4) https://github.com/python/cpython/issues/94597

   (5) https://github.com/python/cpython/issues/100160

   (6) https://github.com/python/cpython/issues/72346

   (7) https://github.com/python/cpython/issues/93963

   (8) https://github.com/python/cpython/issues/101588

   (9) https://github.com/python/cpython/issues/84559

   (10) https://github.com/python/cpython/issues/97850

   (11) https://github.com/python/cpython/issues/88168


File: python.info,  Node: Pending removal in Python 3 15<5>,  Next: Pending removal in Python 3 16<5>,  Prev: Pending removal in Python 3 14<3>,  Up: 非推奨<2>

1.3.10.3 Pending removal in Python 3.15
.......................................

   * The import system:

        * Setting *note __cached__: 321. on a module while failing to
          set *note __spec__.cached: 322. is deprecated.  In Python
          3.15, ‘__cached__’ will cease to be set or take into
          consideration by the import system or standard library.
          (gh-97879(1))

        * Setting *note __package__: 323. on a module while failing to
          set *note __spec__.parent: 324. is deprecated.  In Python
          3.15, ‘__package__’ will cease to be set or take into
          consideration by the import system or standard library.
          (gh-97879(2))

   * *note ctypes: 2e.:

        * The undocumented ‘ctypes.SetPointerType()’ function has been
          deprecated since Python 3.13.

   * *note http.server: 76.:

        * The obsolete and rarely used *note CGIHTTPRequestHandler: 325.
          has been deprecated since Python 3.13.  No direct replacement
          exists.  'Anything' is better than CGI to interface a web
          server with a request handler.

        * The ‘--cgi’ flag to the ‘python -m http.server’ command-line
          interface has been deprecated since Python 3.13.

   * *note importlib: 7b.:

        * ‘load_module()’ method: use ‘exec_module()’ instead.

   * *note locale: 8a.:

        * The *note getdefaultlocale(): 326. function has been
          deprecated since Python 3.11.  Its removal was originally
          planned for Python 3.13 (gh-90817(3)), but has been postponed
          to Python 3.15.  Use *note getlocale(): 327, *note
          setlocale(): 328, and *note getencoding(): 329. instead.
          (Contributed by Hugo van Kemenade in gh-111187(4).)

   * *note pathlib: a8.:

        * *note PurePath.is_reserved(): 32a. has been deprecated since
          Python 3.13.  Use *note os.path.isreserved(): 32b. to detect
          reserved paths on Windows.

   * *note platform: af.:

        * *note java_ver(): 32c. has been deprecated since Python 3.13.
          This function is only useful for Jython support, has a
          confusing API, and is largely untested.

   * *note sysconfig: e1.:

        * The 'check_home' argument of *note
          sysconfig.is_python_build(): 32d. has been deprecated since
          Python 3.12.

   * *note threading: f3.:

        * *note RLock(): 32e. will take no arguments in Python 3.15.
          Passing any arguments has been deprecated since Python 3.14,
          as the Python version does not permit any arguments, but the C
          version allows any number of positional or keyword arguments,
          ignoring every argument.

   * *note types: 109.:

        * *note types.CodeType: 32f.: Accessing *note co_lnotab: 330.
          was deprecated in PEP 626(5) since 3.10 and was planned to be
          removed in 3.12, but it only got a proper *note
          DeprecationWarning: 1a3. in 3.12.  May be removed in 3.15.
          (Contributed by Nikita Sobolev in gh-101866(6).)

   * *note typing: 10a.:

        * The undocumented keyword argument syntax for creating *note
          NamedTuple: 331. classes (for example, ‘Point =
          NamedTuple("Point", x=int, y=int)’) has been deprecated since
          Python 3.13.  Use the class-based syntax or the functional
          syntax instead.

        * When using the functional syntax of *note TypedDict: 332.s,
          failing to pass a value to the 'fields' parameter (‘TD =
          TypedDict("TD")’) or passing ‘None’ (‘TD = TypedDict("TD",
          None)’) has been deprecated since Python 3.13.  Use ‘class
          TD(TypedDict): pass’ or ‘TD = TypedDict("TD", {})’ to create a
          TypedDict with zero field.

        * The *note typing.no_type_check_decorator(): 333. decorator
          function has been deprecated since Python 3.13.  After eight
          years in the *note typing: 10a. module, it has yet to be
          supported by any major type checker.

   * *note wave: 119.:

        * The *note getmark(): 334, ‘setmark()’, and *note getmarkers():
          335. methods of the *note Wave_read: 336. and *note
          Wave_write: 337. classes have been deprecated since Python
          3.13.

   * *note zipimport: 138.:

        * *note load_module(): 338. has been deprecated since Python
          3.10.  Use *note exec_module(): 339. instead.  (Contributed by
          Jiahao Li in gh-125746(7).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97879

   (2) https://github.com/python/cpython/issues/97879

   (3) https://github.com/python/cpython/issues/90817

   (4) https://github.com/python/cpython/issues/111187

   (5) https://peps.python.org/pep-0626/

   (6) https://github.com/python/cpython/issues/101866

   (7) https://github.com/python/cpython/issues/125746


File: python.info,  Node: Pending removal in Python 3 16<5>,  Next: Pending removal in Python 3 17<3>,  Prev: Pending removal in Python 3 15<5>,  Up: 非推奨<2>

1.3.10.4 Pending removal in Python 3.16
.......................................

   * The import system:

        * Setting *note __loader__: 33b. on a module while failing to
          set *note __spec__.loader: 33c. is deprecated.  In Python
          3.16, ‘__loader__’ will cease to be set or taken into
          consideration by the import system or the standard library.

   * *note array: 8.:

        * The ‘'u'’ format code (‘wchar_t’) has been deprecated in
          documentation since Python 3.3 and at runtime since Python
          3.13.  Use the ‘'w'’ format code (*note Py_UCS4: 33d.) for
          Unicode characters instead.

   * *note asyncio: b.:

        * ‘asyncio.iscoroutinefunction()’ is deprecated and will be
          removed in Python 3.16; use *note
          inspect.iscoroutinefunction(): 30d. instead.  (Contributed by
          Jiahao Li and Kumar Aditya in gh-122875(1).)

        * *note asyncio: b. policy system is deprecated and will be
          removed in Python 3.16.  In particular, the following classes
          and functions are deprecated:

             * *note asyncio.AbstractEventLoopPolicy: 30e.

             * *note asyncio.DefaultEventLoopPolicy: 30f.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 310.

             * *note asyncio.WindowsProactorEventLoopPolicy: 311.

             * *note asyncio.get_event_loop_policy(): 312.

             * *note asyncio.set_event_loop_policy(): 313.

          Users should use *note asyncio.run(): 2f3. or *note
          asyncio.Runner: 2f5. with 'loop_factory' to use the desired
          event loop implementation.

          For example, to use *note asyncio.SelectorEventLoop: 314. on
          Windows:

               import asyncio

               async def main():
                   ...

               asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)

          (Contributed by Kumar Aditya in gh-127949(2).)

   * *note builtins: 13.:

        * Bitwise inversion on boolean types, ‘~True’ or ‘~False’ has
          been deprecated since Python 3.12, as it produces surprising
          and unintuitive results (‘-2’ and ‘-1’).  Use ‘not x’ instead
          for the logical negation of a Boolean.  In the rare case that
          you need the bitwise inversion of the underlying integer,
          convert to ‘int’ explicitly (‘~int(x)’).

   * *note functools: 63.:

        * Calling the Python implementation of *note functools.reduce():
          21a. with 'function' or 'sequence' as keyword arguments has
          been deprecated since Python 3.14.

   * *note logging: 8b.:

     Support for custom logging handlers with the 'strm' argument is
     deprecated and scheduled for removal in Python 3.16.  Define
     handlers with the 'stream' argument instead.  (Contributed by
     Mariusz Felisiak in gh-115032(3).)

   * *note mimetypes: 93.:

        * Valid extensions start with a '.'  or are empty for *note
          mimetypes.MimeTypes.add_type(): 319.  Undotted extensions are
          deprecated and will raise a *note ValueError: 2ec. in Python
          3.16.  (Contributed by Hugo van Kemenade in gh-75223(4).)

   * *note shutil: ca.:

        * The ‘ExecError’ exception has been deprecated since Python
          3.14.  It has not been used by any function in ‘shutil’ since
          Python 3.4, and is now an alias of *note RuntimeError: 244.

   * *note symtable: de.:

        * The *note Class.get_methods: 31d. method has been deprecated
          since Python 3.14.

   * *note sys: df.:

        * The *note _enablelegacywindowsfsencoding(): 33e. function has
          been deprecated since Python 3.13.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 33f. environment variable
          instead.

   * *note sysconfig: e1.:

        * The ‘sysconfig.expand_makefile_vars()’ function has been
          deprecated since Python 3.14.  Use the ‘vars’ argument of
          *note sysconfig.get_paths(): 340. instead.

   * *note tarfile: e4.:

        * The undocumented and unused ‘TarFile.tarfile’ attribute has
          been deprecated since Python 3.13.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/122875

   (2) https://github.com/python/cpython/issues/127949

   (3) https://github.com/python/cpython/issues/115032

   (4) https://github.com/python/cpython/issues/75223


File: python.info,  Node: Pending removal in Python 3 17<3>,  Next: Pending removal in future versions<5>,  Prev: Pending removal in Python 3 16<5>,  Up: 非推奨<2>

1.3.10.5 Pending removal in Python 3.17
.......................................

   * *note collections.abc: 1f.:

        - *note collections.abc.ByteString: 342. is scheduled for
          removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 260. at runtime.  For
          use in type annotations, either use *note Buffer: 343. or a
          union that explicitly specifies the types your code supports
          (e.g., ‘bytes | bytearray | memoryview’).

          ‘ByteString’ was originally intended to be an abstract class
          that would serve as a supertype of both *note bytes: 192. and
          *note bytearray: 344.  However, since the ABC never had any
          methods, knowing that an object was an instance of
          ‘ByteString’ never actually told you anything useful about the
          object.  Other common buffer types such as *note memoryview:
          165. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(1) for more details.  (Contributed by Shantanu
          Jain in gh-91896(2).)

   * *note typing: 10a.:

        - Before Python 3.14, old-style unions were implemented using
          the private class ‘typing._UnionGenericAlias’.  This class is
          no longer needed for the implementation, but it has been
          retained for backward compatibility, with removal scheduled
          for Python 3.17.  Users should use documented introspection
          helpers like *note typing.get_origin(): 2ab. and *note
          typing.get_args(): 2ac. instead of relying on private
          implementation details.

        - *note typing.ByteString: 345, deprecated since Python 3.9, is
          scheduled for removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 260. at runtime.  For
          use in type annotations, either use *note Buffer: 343. or a
          union that explicitly specifies the types your code supports
          (e.g., ‘bytes | bytearray | memoryview’).

          ‘ByteString’ was originally intended to be an abstract class
          that would serve as a supertype of both *note bytes: 192. and
          *note bytearray: 344.  However, since the ABC never had any
          methods, knowing that an object was an instance of
          ‘ByteString’ never actually told you anything useful about the
          object.  Other common buffer types such as *note memoryview:
          165. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(3) for more details.  (Contributed by Shantanu
          Jain in gh-91896(4).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0688/#current-options

   (2) https://github.com/python/cpython/issues/91896

   (3) https://peps.python.org/pep-0688/#current-options

   (4) https://github.com/python/cpython/issues/91896


File: python.info,  Node: Pending removal in future versions<5>,  Prev: Pending removal in Python 3 17<3>,  Up: 非推奨<2>

1.3.10.6 Pending removal in future versions
...........................................

The following APIs will be removed in the future, although there is
currently no date scheduled for their removal.

   * *note argparse: 7.:

        * Nesting argument groups and nesting mutually exclusive groups
          are deprecated.

        * Passing the undocumented keyword argument 'prefix_chars' to
          *note add_argument_group(): 2eb. is now deprecated.

        * The *note argparse.FileType: 30c. type converter is
          deprecated.

   * *note builtins: 13.:

        * Generators: ‘throw(type, exc, tb)’ and ‘athrow(type, exc, tb)’
          signature is deprecated: use ‘throw(exc)’ and ‘athrow(exc)’
          instead, the single argument signature.

        * Currently Python accepts numeric literals immediately followed
          by keywords, for example ‘0in x’, ‘1or x’, ‘0if 1else 2’.  It
          allows confusing and ambiguous expressions like ‘[0x1for x in
          y]’ (which can be interpreted as ‘[0x1 for x in y]’ or ‘[0x1f
          or x in y]’).  A syntax warning is raised if the numeric
          literal is immediately followed by one of keywords *note and:
          349, *note else: 17c, *note for: 34a, *note if: 181, *note in:
          34b, *note is: 34c. and *note or: 34d.  In a future release it
          will be changed to a syntax error.  (gh-87999(1))

        * Support for ‘__index__()’ and ‘__int__()’ method returning
          non-int type: these methods will be required to return an
          instance of a strict subclass of *note int: 19b.

        * Support for ‘__float__()’ method returning a strict subclass
          of *note float: 196.: these methods will be required to return
          an instance of *note float: 196.

        * Support for ‘__complex__()’ method returning a strict subclass
          of *note complex: 197.: these methods will be required to
          return an instance of *note complex: 197.

        * Passing a complex number as the 'real' or 'imag' argument in
          the *note complex(): 197. constructor is now deprecated; it
          should only be passed as a single positional argument.
          (Contributed by Serhiy Storchaka in gh-109218(2).)

   * *note calendar: 15.: ‘calendar.January’ and ‘calendar.February’
     constants are deprecated and replaced by *note calendar.JANUARY:
     34e. and *note calendar.FEBRUARY: 34f.  (Contributed by Prince
     Roshan in gh-103636(3).)

   * *note codecs: 1c.: use *note open(): 316. instead of *note
     codecs.open(): 315.  (gh-133038(4))

   * *note codeobject.co_lnotab: 330.: use the *note
     codeobject.co_lines(): 350. method instead.

   * *note datetime: 34.:

        * *note utcnow(): 351.: use
          ‘datetime.datetime.now(tz=datetime.UTC)’.

        * *note utcfromtimestamp(): 352.: use
          ‘datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)’.

   * *note gettext: 67.: Plural value must be an integer.

   * *note importlib: 7b.:

        * *note cache_from_source(): 353. 'debug_override' parameter is
          deprecated: use the 'optimization' parameter instead.

   * *note importlib.metadata: 7e.:

        * ‘EntryPoints’ tuple interface.

        * Implicit ‘None’ on return values.

   * *note logging: 8b.: the ‘warn()’ method has been deprecated since
     Python 3.3, use *note warning(): 354. instead.

   * *note mailbox: 8f.: Use of StringIO input and text mode is
     deprecated, use BytesIO and binary mode instead.

   * *note os: a5.: Calling *note os.register_at_fork(): 355. in
     multi-threaded process.

   * ‘pydoc.ErrorDuringImport’: A tuple value for 'exc_info' parameter
     is deprecated, use an exception instance.

   * *note re: be.: More strict rules are now applied for numerical
     group references and group names in regular expressions.  Only
     sequence of ASCII digits is now accepted as a numerical reference.
     The group name in bytes patterns and replacement strings can now
     only contain ASCII letters and digits and underscore.  (Contributed
     by Serhiy Storchaka in gh-91760(5).)

   * ‘sre_compile’, ‘sre_constants’ and ‘sre_parse’ modules.

   * *note shutil: ca.: *note rmtree(): 356.'s 'onerror' parameter is
     deprecated in Python 3.12; use the 'onexc' parameter instead.

   * *note ssl: d5. options and protocols:

        * *note ssl.SSLContext: 357. without protocol argument is
          deprecated.

        * *note ssl.SSLContext: 357.: *note set_npn_protocols(): 358.
          and ‘selected_npn_protocol()’ are deprecated: use ALPN
          instead.

        * ‘ssl.OP_NO_SSL*’ options

        * ‘ssl.OP_NO_TLS*’ options

        * ‘ssl.PROTOCOL_SSLv3’

        * ‘ssl.PROTOCOL_TLS’

        * ‘ssl.PROTOCOL_TLSv1’

        * ‘ssl.PROTOCOL_TLSv1_1’

        * ‘ssl.PROTOCOL_TLSv1_2’

        * ‘ssl.TLSVersion.SSLv3’

        * ‘ssl.TLSVersion.TLSv1’

        * ‘ssl.TLSVersion.TLSv1_1’

   * *note threading: f3. methods:

        * ‘threading.Condition.notifyAll()’: use *note notify_all():
          359.

        * ‘threading.Event.isSet()’: use *note is_set(): 35a.

        * ‘threading.Thread.isDaemon()’, *note
          threading.Thread.setDaemon(): 35b.: use *note
          threading.Thread.daemon: 35c. attribute.

        * ‘threading.Thread.getName()’, *note
          threading.Thread.setName(): 35d.: use *note
          threading.Thread.name: 2a0. attribute.

        * ‘threading.currentThread()’: use *note
          threading.current_thread(): 35e.

        * ‘threading.activeCount()’: use *note threading.active_count():
          35f.

   * *note typing.Text: 360. (gh-92332(6)).

   * The internal class ‘typing._UnionGenericAlias’ is no longer used to
     implement *note typing.Union: 2a8.  To preserve compatibility with
     users using this private class, a compatibility shim will be
     provided until at least Python 3.17.  (Contributed by Jelle
     Zijlstra in gh-105499(7).)

   * *note unittest.IsolatedAsyncioTestCase: 361.: it is deprecated to
     return a value that is not ‘None’ from a test case.

   * *note urllib.parse: 110. deprecated functions: *note urlparse():
     362. instead

        * ‘splitattr()’

        * ‘splithost()’

        * ‘splitnport()’

        * ‘splitpasswd()’

        * ‘splitport()’

        * ‘splitquery()’

        * ‘splittag()’

        * ‘splittype()’

        * ‘splituser()’

        * ‘splitvalue()’

        * ‘to_bytes()’

   * *note wsgiref: 11e.: ‘SimpleHandler.stdout.write()’ should not do
     partial writes.

   * *note xml.etree.ElementTree: 12b.: Testing the truth value of an
     *note Element: 363. is deprecated.  In a future release it will
     always return ‘True’.  Prefer explicit ‘len(elem)’ or ‘elem is not
     None’ tests instead.

   * *note sys._clear_type_cache(): 292. is deprecated: use *note
     sys._clear_internal_caches(): 364. instead.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/87999

   (2) https://github.com/python/cpython/issues/109218

   (3) https://github.com/python/cpython/issues/103636

   (4) https://github.com/python/cpython/issues/133038

   (5) https://github.com/python/cpython/issues/91760

   (6) https://github.com/python/cpython/issues/92332

   (7) https://github.com/python/cpython/issues/105499


File: python.info,  Node: 削除<2>,  Next: Python 3 12 への移植,  Prev: 非推奨<2>,  Up: What's New In Python 3 12

1.3.11 削除
-----------

* Menu:

* asynchat and asyncore::
* configparser: configparser<4>.
* distutils::
* ensurepip::
* enum: enum<2>.
* ftplib::
* gzip::
* hashlib::
* importlib: importlib<2>.
* imp::
* io: io<4>.
* locale: locale<2>.
* smtpd::
* sqlite3: sqlite3<4>.
* ssl: ssl<3>.
* unittest: unittest<4>.
* webbrowser: webbrowser<3>.
* xml.etree.ElementTree: xml etree ElementTree.
* zipimport: zipimport<2>.
* その他::


File: python.info,  Node: asynchat and asyncore,  Next: configparser<4>,  Up: 削除<2>

1.3.11.1 asynchat and asyncore
..............................

   * These two modules have been removed according to the schedule in
     PEP 594(1), having been deprecated in Python 3.6.  Use *note
     asyncio: b. instead.  (Contributed by Nikita Sobolev in
     gh-96580(2).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://github.com/python/cpython/issues/96580


File: python.info,  Node: configparser<4>,  Next: distutils,  Prev: asynchat and asyncore,  Up: 削除<2>

1.3.11.2 configparser
.....................

   * Several names deprecated in the *note configparser: 26. way back in
     3.2 have been removed per gh-89336(1):

        * *note configparser.ParsingError: 729. no longer has a
          ‘filename’ attribute or argument.  Use the ‘source’ attribute
          and argument instead.

        * *note configparser: 26. no longer has a ‘SafeConfigParser’
          class.  Use the shorter *note ConfigParser: 4de. name instead.

        * *note configparser.ConfigParser: 4de. no longer has a ‘readfp’
          method.  Use *note read_file(): 72a. instead.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89336


File: python.info,  Node: distutils,  Next: ensurepip,  Prev: configparser<4>,  Up: 削除<2>

1.3.11.3 distutils
..................

   * Remove the ‘distutils’ package.  It was deprecated in Python 3.10
     by PEP 632(1) "Deprecate distutils module".  For projects still
     using ‘distutils’ and cannot be updated to something else, the
     ‘setuptools’ project can be installed: it still provides
     ‘distutils’.  (Contributed by Victor Stinner in gh-92584(2).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0632/

   (2) https://github.com/python/cpython/issues/92584


File: python.info,  Node: ensurepip,  Next: enum<2>,  Prev: distutils,  Up: 削除<2>

1.3.11.4 ensurepip
..................

   * Remove the bundled setuptools wheel from *note ensurepip: 59, and
     stop installing setuptools in environments created by *note venv:
     117.

     ‘pip (>= 22.1)’ does not require setuptools to be installed in the
     environment.  ‘setuptools’-based (and ‘distutils’-based) packages
     can still be used with ‘pip install’, since pip will provide
     ‘setuptools’ in the build environment it uses for building a
     package.

     ‘easy_install’, ‘pkg_resources’, ‘setuptools’ and ‘distutils’ are
     no longer provided by default in environments created with ‘venv’
     or bootstrapped with ‘ensurepip’, since they are part of the
     ‘setuptools’ package.  For projects relying on these at runtime,
     the ‘setuptools’ project should be declared as a dependency and
     installed separately (typically, using pip).

     (Contributed by Pradyun Gedam in gh-95299(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/95299


File: python.info,  Node: enum<2>,  Next: ftplib,  Prev: ensurepip,  Up: 削除<2>

1.3.11.5 enum
.............

   * Remove *note enum: 5a.'s ‘EnumMeta.__getattr__’, which is no longer
     needed for enum attribute access.  (Contributed by Ethan Furman in
     gh-95083(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/95083


File: python.info,  Node: ftplib,  Next: gzip,  Prev: enum<2>,  Up: 削除<2>

1.3.11.6 ftplib
...............

   * Remove *note ftplib: 62.'s ‘FTP_TLS.ssl_version’ class attribute:
     use the 'context' parameter instead.  (Contributed by Victor
     Stinner in gh-94172(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/94172


File: python.info,  Node: gzip,  Next: hashlib,  Prev: ftplib,  Up: 削除<2>

1.3.11.7 gzip
.............

   * Remove the ‘filename’ attribute of *note gzip: 6b.'s *note
     gzip.GzipFile: 65c, deprecated since Python 2.6, use the *note
     name: 731. attribute instead.  In write mode, the ‘filename’
     attribute added ‘'.gz'’ file extension if it was not present.
     (Contributed by Victor Stinner in gh-94196(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/94196


File: python.info,  Node: hashlib,  Next: importlib<2>,  Prev: gzip,  Up: 削除<2>

1.3.11.8 hashlib
................

   * Remove the pure Python implementation of *note hashlib: 6c.'s *note
     hashlib.pbkdf2_hmac(): 733, deprecated in Python 3.10.  Python 3.10
     and newer requires OpenSSL 1.1.1 ( PEP 644(1)): this OpenSSL
     version provides a C implementation of *note pbkdf2_hmac(): 733.
     which is faster.  (Contributed by Victor Stinner in gh-94199(2).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0644/

   (2) https://github.com/python/cpython/issues/94199


File: python.info,  Node: importlib<2>,  Next: imp,  Prev: hashlib,  Up: 削除<2>

1.3.11.9 importlib
..................

   * Many previously deprecated cleanups in *note importlib: 7b. have
     now been completed:

        * References to, and support for ‘module_repr()’ has been
          removed.  (Contributed by Barry Warsaw in gh-97850(1).)

        * ‘importlib.util.set_package’, ‘importlib.util.set_loader’ and
          ‘importlib.util.module_for_loader’ have all been removed.
          (Contributed by Brett Cannon and Nikita Sobolev in gh-65961(2)
          and gh-97850(3).)

        * Support for ‘find_loader()’ and ‘find_module()’ APIs have been
          removed.  (Contributed by Barry Warsaw in gh-98040(4).)

        * ‘importlib.abc.Finder’, ‘pkgutil.ImpImporter’, and
          ‘pkgutil.ImpLoader’ have been removed.  (Contributed by Barry
          Warsaw in gh-98040(5).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97850

   (2) https://github.com/python/cpython/issues/65961

   (3) https://github.com/python/cpython/issues/97850

   (4) https://github.com/python/cpython/issues/98040

   (5) https://github.com/python/cpython/issues/98040


File: python.info,  Node: imp,  Next: io<4>,  Prev: importlib<2>,  Up: 削除<2>

1.3.11.10 imp
.............

   * The ‘imp’ module has been removed.  (Contributed by Barry Warsaw in
     gh-98040(1).)

     To migrate, consult the following correspondence table:

          imp                                   importlib
                                                
          --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                
          ‘imp.NullImporter’                    ‘sys.path_importer_cache’ に ‘None’ を挿入する
                                                
                                                
          ‘imp.cache_from_source()’             *note importlib.util.cache_from_source(): 353.
                                                
                                                
          ‘imp.find_module()’                   *note importlib.util.find_spec(): 5af.
                                                
                                                
          ‘imp.get_magic()’                     *note importlib.util.MAGIC_NUMBER: 737.
                                                
                                                
          ‘imp.get_suffixes()’                  *note importlib.machinery.SOURCE_SUFFIXES: 738, *note importlib.machinery.EXTENSION_SUFFIXES: 739, and
                                                *note importlib.machinery.BYTECODE_SUFFIXES: 73a.
                                                
                                                
          ‘imp.get_tag()’                       *note sys.implementation.cache_tag: 73b.
                                                
                                                
          ‘imp.load_module()’                   *note importlib.import_module(): 73c.
                                                
                                                
          ‘imp.new_module(name)’                ‘types.ModuleType(name)’
                                                
                                                
          ‘imp.reload()’                        *note importlib.reload(): 73d.
                                                
                                                
          ‘imp.source_from_cache()’             *note importlib.util.source_from_cache(): 73e.
                                                
                                                
          ‘imp.load_source()’                   'See below'
                                                

     Replace ‘imp.load_source()’ with:

          import importlib.util
          import importlib.machinery

          def load_source(modname, filename):
              loader = importlib.machinery.SourceFileLoader(modname, filename)
              spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
              module = importlib.util.module_from_spec(spec)
              # The module is always executed and not cached in sys.modules.
              # Uncomment the following line to cache the module.
              # sys.modules[module.__name__] = module
              loader.exec_module(module)
              return module

   * Remove ‘imp’ functions and attributes with no replacements:

        * ドキュメント化されていない関数:

             * ‘imp.init_builtin()’

             * ‘imp.load_compiled()’

             * ‘imp.load_dynamic()’

             * ‘imp.load_package()’

        * ‘imp.lock_held()’, ‘imp.acquire_lock()’, ‘imp.release_lock()’:
          the locking scheme has changed in Python 3.3 to per-module
          locks.

        * ‘imp.find_module()’ constants: ‘SEARCH_ERROR’, ‘PY_SOURCE’,
          ‘PY_COMPILED’, ‘C_EXTENSION’, ‘PY_RESOURCE’, ‘PKG_DIRECTORY’,
          ‘C_BUILTIN’, ‘PY_FROZEN’, ‘PY_CODERESOURCE’, ‘IMP_HOOK’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98040


File: python.info,  Node: io<4>,  Next: locale<2>,  Prev: imp,  Up: 削除<2>

1.3.11.11 io
............

   * Remove *note io: 83.'s ‘io.OpenWrapper’ and ‘_pyio.OpenWrapper’,
     deprecated in Python 3.10: just use *note open(): 316. instead.
     The *note open(): 316. (*note io.open(): 740.) function is a
     built-in function.  Since Python 3.10, ‘_pyio.open()’ is also a
     static method.  (Contributed by Victor Stinner in gh-94169(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/94169


File: python.info,  Node: locale<2>,  Next: smtpd,  Prev: io<4>,  Up: 削除<2>

1.3.11.12 locale
................

   * Remove *note locale: 8a.'s ‘locale.format()’ function, deprecated
     in Python 3.7: use *note locale.format_string(): 742. instead.
     (Contributed by Victor Stinner in gh-94226(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/94226


File: python.info,  Node: smtpd,  Next: sqlite3<4>,  Prev: locale<2>,  Up: 削除<2>

1.3.11.13 smtpd
...............

   * The ‘smtpd’ module has been removed according to the schedule in
     PEP 594(1), having been deprecated in Python 3.4.7 and 3.5.4.  Use
     the aiosmtpd(2) PyPI module or any other *note asyncio: b.-based
     server instead.  (Contributed by Oleg Iarygin in gh-93243(3).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://pypi.org/project/aiosmtpd/

   (3) https://github.com/python/cpython/issues/93243


File: python.info,  Node: sqlite3<4>,  Next: ssl<3>,  Prev: smtpd,  Up: 削除<2>

1.3.11.14 sqlite3
.................

   * The following undocumented *note sqlite3: d4. features, deprecated
     in Python 3.10, are now removed:

        * ‘sqlite3.enable_shared_cache()’

        * ‘sqlite3.OptimizedUnicode’

     If a shared cache must be used, open the database in URI mode using
     the ‘cache=shared’ query parameter.

     The ‘sqlite3.OptimizedUnicode’ text factory has been an alias for
     *note str: 169. since Python 3.3.  Code that previously set the
     text factory to ‘OptimizedUnicode’ can either use ‘str’ explicitly,
     or rely on the default value which is also ‘str’.

     (Contributed by Erlend E. Aasland in gh-92548(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/92548


File: python.info,  Node: ssl<3>,  Next: unittest<4>,  Prev: sqlite3<4>,  Up: 削除<2>

1.3.11.15 ssl
.............

   * Remove *note ssl: d5.'s ‘ssl.RAND_pseudo_bytes()’ function,
     deprecated in Python 3.6: use *note os.urandom(): 746. or *note
     ssl.RAND_bytes(): 747. instead.  (Contributed by Victor Stinner in
     gh-94199(1).)

   * Remove the ‘ssl.match_hostname()’ function.  It was deprecated in
     Python 3.7.  OpenSSL performs hostname matching since Python 3.7,
     Python no longer uses the ‘ssl.match_hostname()’ function.
     (Contributed by Victor Stinner in gh-94199(2).)

   * Remove the ‘ssl.wrap_socket()’ function, deprecated in Python 3.7:
     instead, create a *note ssl.SSLContext: 357. object and call its
     *note ssl.SSLContext.wrap_socket: 748. method.  Any package that
     still uses ‘ssl.wrap_socket()’ is broken and insecure.  The
     function neither sends a SNI TLS extension nor validates the server
     hostname.  Code is subject to CWE 295(3) (Improper Certificate
     Validation).  (Contributed by Victor Stinner in gh-94199(4).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/94199

   (2) https://github.com/python/cpython/issues/94199

   (3) https://cwe.mitre.org/data/definitions/295.html

   (4) https://github.com/python/cpython/issues/94199


File: python.info,  Node: unittest<4>,  Next: webbrowser<3>,  Prev: ssl<3>,  Up: 削除<2>

1.3.11.16 unittest
..................

   * Remove many long-deprecated *note unittest: 10c. features:

        * A number of *note TestCase: 2b3. method aliases:

          非推奨のエイリアス               メソッド名                          非推奨となるバー
                                                                               ジョン
                                                                               
          -----------------------------------------------------------------------------------------
                                                                               
          ‘failUnless’                     *note assertTrue(): 74a.            3.1
                                                                               
                                                                               
          ‘failIf’                         *note assertFalse(): 74b.           3.1
                                                                               
                                                                               
          ‘failUnlessEqual’                *note assertEqual(): 74c.           3.1
                                                                               
                                                                               
          ‘failIfEqual’                    *note assertNotEqual(): 74d.        3.1
                                                                               
                                                                               
          ‘failUnlessAlmostEqual’          *note assertAlmostEqual(): 74e.     3.1
                                                                               
                                                                               
          ‘failIfAlmostEqual’              *note assertNotAlmostEqual(): 74f.  3.1
                                                                               
                                                                               
          ‘failUnlessRaises’               *note assertRaises(): 750.          3.1
                                                                               
                                                                               
          ‘assert_’                        *note assertTrue(): 74a.            3.2
                                                                               
                                                                               
          ‘assertEquals’                   *note assertEqual(): 74c.           3.2
                                                                               
                                                                               
          ‘assertNotEquals’                *note assertNotEqual(): 74d.        3.2
                                                                               
                                                                               
          ‘assertAlmostEquals’             *note assertAlmostEqual(): 74e.     3.2
                                                                               
                                                                               
          ‘assertNotAlmostEquals’          *note assertNotAlmostEqual(): 74f.  3.2
                                                                               
                                                                               
          ‘assertRegexpMatches’            *note assertRegex(): 751.           3.2
                                                                               
                                                                               
          ‘assertRaisesRegexp’             *note assertRaisesRegex(): 752.     3.2
                                                                               
                                                                               
          ‘assertNotRegexpMatches’         *note assertNotRegex(): 753.        3.5
                                                                               

          You can use ‘https://github.com/isidentical/teyit’ to
          automatically modernise your unit tests.

        * Undocumented and broken *note TestCase: 2b3. method
          ‘assertDictContainsSubset’ (deprecated in Python 3.2).

        * Undocumented *note TestLoader.loadTestsFromModule: 594.
          parameter 'use_load_tests' (deprecated and ignored since
          Python 3.5).

        * An alias of the *note TextTestResult: 754. class:
          ‘_TextTestResult’ (deprecated in Python 3.2).

     (Contributed by Serhiy Storchaka in gh-89325(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89325


File: python.info,  Node: webbrowser<3>,  Next: xml etree ElementTree,  Prev: unittest<4>,  Up: 削除<2>

1.3.11.17 webbrowser
....................

   * Remove support for obsolete browsers from *note webbrowser: 11b.
     The removed browsers include: Grail, Mosaic, Netscape, Galeon,
     Skipstone, Iceape, Firebird, and Firefox versions 35 and below
     (gh-102871(1)).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102871


File: python.info,  Node: xml etree ElementTree,  Next: zipimport<2>,  Prev: webbrowser<3>,  Up: 削除<2>

1.3.11.18 xml.etree.ElementTree
...............................

   * Remove the ‘ElementTree.Element.copy()’ method of the pure Python
     implementation, deprecated in Python 3.10, use the *note
     copy.copy(): 757. function instead.  The C implementation of *note
     xml.etree.ElementTree: 12b. has no ‘copy()’ method, only a
     ‘__copy__()’ method.  (Contributed by Victor Stinner in
     gh-94383(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/94383


File: python.info,  Node: zipimport<2>,  Next: その他,  Prev: xml etree ElementTree,  Up: 削除<2>

1.3.11.19 zipimport
...................

   * Remove *note zipimport: 138.'s ‘find_loader()’ and ‘find_module()’
     methods, deprecated in Python 3.10: use the ‘find_spec()’ method
     instead.  See PEP 451(1) for the rationale.  (Contributed by Victor
     Stinner in gh-94379(2).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0451/

   (2) https://github.com/python/cpython/issues/94379


File: python.info,  Node: その他,  Prev: zipimport<2>,  Up: 削除<2>

1.3.11.20 その他
................

   * Remove the ‘suspicious’ rule from the documentation ‘Makefile’ and
     ‘Doc/tools/rstlint.py’, both in favor of sphinx-lint(1).
     (Contributed by Julien Palard in gh-98179(2).)

   * Remove the 'keyfile' and 'certfile' parameters from the *note
     ftplib: 62, *note imaplib: 78, *note poplib: b1. and *note smtplib:
     cf. modules, and the 'key_file', 'cert_file' and 'check_hostname'
     parameters from the *note http.client: 73. module, all deprecated
     since Python 3.6.  Use the 'context' parameter ('ssl_context' in
     *note imaplib: 78.) instead.  (Contributed by Victor Stinner in
     gh-94172(3).)

   * Remove ‘Jython’ compatibility hacks from several stdlib modules and
     tests.  (Contributed by Nikita Sobolev in gh-99482(4).)

   * Remove ‘_use_broken_old_ctypes_structure_semantics_’ flag from
     *note ctypes: 2e. module.  (Contributed by Nikita Sobolev in
     gh-99285(5).)

   ---------- Footnotes ----------

   (1) https://github.com/sphinx-contrib/sphinx-lint

   (2) https://github.com/python/cpython/issues/98179

   (3) https://github.com/python/cpython/issues/94172

   (4) https://github.com/python/cpython/issues/99482

   (5) https://github.com/python/cpython/issues/99285


File: python.info,  Node: Python 3 12 への移植,  Next: Build Changes<2>,  Prev: 削除<2>,  Up: What's New In Python 3 12

1.3.12 Python 3.12 への移植
---------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

* Menu:

* Python API の変更: Python API の変更<3>.


File: python.info,  Node: Python API の変更<3>,  Up: Python 3 12 への移植

1.3.12.1 Python API の変更
..........................

   * More strict rules are now applied for numerical group references
     and group names in regular expressions.  Only sequence of ASCII
     digits is now accepted as a numerical reference.  The group name in
     bytes patterns and replacement strings can now only contain ASCII
     letters and digits and underscore.  (Contributed by Serhiy
     Storchaka in gh-91760(1).)

   * Remove ‘randrange()’ functionality deprecated since Python 3.10.
     Formerly, ‘randrange(10.0)’ losslessly converted to
     ‘randrange(10)’.  Now, it raises a *note TypeError: 198.  Also, the
     exception raised for non-integer values such as ‘randrange(10.5)’
     or ‘randrange('10')’ has been changed from *note ValueError: 2ec.
     to *note TypeError: 198.  This also prevents bugs where
     ‘randrange(1e25)’ would silently select from a larger range than
     ‘randrange(10**25)’.  (Originally suggested by Serhiy Storchaka
     gh-86388(2).)

   * *note argparse.ArgumentParser: 1bd. changed encoding and error
     handler for reading arguments from file (e.g.
     ‘fromfile_prefix_chars’ option) from default text encoding (e.g.
     *note locale.getpreferredencoding(False): 75c.) to *note filesystem
     encoding and error handler: 75d.  Argument files should be encoded
     in UTF-8 instead of ANSI Codepage on Windows.

   * Remove the ‘asyncore’-based ‘smtpd’ module deprecated in Python
     3.4.7 and 3.5.4.  A recommended replacement is the *note asyncio:
     b.-based aiosmtpd(3) PyPI module.

   * *note shlex.split(): 75e.: Passing ‘None’ for 's' argument now
     raises an exception, rather than reading *note sys.stdin: 75f.  The
     feature was deprecated in Python 3.9.  (Contributed by Victor
     Stinner in gh-94352(4).)

   * The *note os: a5. module no longer accepts bytes-like paths, like
     *note bytearray: 344. and *note memoryview: 165. types: only the
     exact *note bytes: 192. type is accepted for bytes strings.
     (Contributed by Victor Stinner in gh-98393(5).)

   * *note syslog.openlog(): 760. and *note syslog.closelog(): 761. now
     fail if used in subinterpreters.  *note syslog.syslog(): 762. may
     still be used in subinterpreters, but now only if *note
     syslog.openlog(): 760. has already been called in the main
     interpreter.  These new restrictions do not apply to the main
     interpreter, so only a very small set of users might be affected.
     This change helps with interpreter isolation.  Furthermore, *note
     syslog: e2. is a wrapper around process-global resources, which are
     best managed from the main interpreter.  (Contributed by Donghee Na
     in gh-99127(6).)

   * The undocumented locking behavior of *note cached_property(): 763.
     is removed, because it locked across all instances of the class,
     leading to high lock contention.  This means that a cached property
     getter function could now run more than once for a single instance,
     if two threads race.  For most simple cached properties (e.g.
     those that are idempotent and simply calculate a value based on
     other attributes of the instance) this will be fine.  If
     synchronization is needed, implement locking within the cached
     property getter function or around multi-threaded access points.

   * *note sys._current_exceptions(): 6e9. now returns a mapping from
     thread-id to an exception instance, rather than to a ‘(typ, exc,
     tb)’ tuple.  (Contributed by Irit Katriel in gh-103176(7).)

   * When extracting tar files using *note tarfile: e4. or *note
     shutil.unpack_archive(): 696, pass the 'filter' argument to limit
     features that may be surprising or dangerous.  See *note Extraction
     filters: 697. for details.

   * The output of the *note tokenize.tokenize(): 700. and *note
     tokenize.generate_tokens(): 701. functions is now changed due to
     the changes introduced in PEP 701(8).  This means that ‘STRING’
     tokens are not emitted any more for f-strings and the tokens
     described in PEP 701(9) are now produced instead: ‘FSTRING_START’,
     ‘FSTRING_MIDDLE’ and ‘FSTRING_END’ are now emitted for f-string
     "string" parts in addition to the appropriate tokens for the
     tokenization in the expression components.  For example for the
     f-string ‘f"start {1+1} end"’ the old version of the tokenizer
     emitted:

          1,0-1,18:           STRING         'f"start {1+1} end"'

     while the new version emits:

          1,0-1,2:            FSTRING_START  'f"'
          1,2-1,8:            FSTRING_MIDDLE 'start '
          1,8-1,9:            OP             '{'
          1,9-1,10:           NUMBER         '1'
          1,10-1,11:          OP             '+'
          1,11-1,12:          NUMBER         '1'
          1,12-1,13:          OP             '}'
          1,13-1,17:          FSTRING_MIDDLE ' end'
          1,17-1,18:          FSTRING_END    '"'

     Additionally, there may be some minor behavioral changes as a
     consequence of the changes required to support PEP 701(10).  Some
     of these changes include:

        * The ‘type’ attribute of the tokens emitted when tokenizing
          some invalid Python characters such as ‘!’ has changed from
          ‘ERRORTOKEN’ to ‘OP’.

        * Incomplete single-line strings now also raise *note
          tokenize.TokenError: 764. as incomplete multiline strings do.

        * Some incomplete or invalid Python code now raises *note
          tokenize.TokenError: 764. instead of returning arbitrary
          ‘ERRORTOKEN’ tokens when tokenizing it.

        * Mixing tabs and spaces as indentation in the same file is not
          supported anymore and will raise a *note TabError: 765.

   * The *note threading: f3. module now expects the ‘_thread’ module to
     have an ‘_is_main_interpreter’ attribute.  It is a function with no
     arguments that returns ‘True’ if the current interpreter is the
     main interpreter.

     Any library or application that provides a custom ‘_thread’ module
     should provide ‘_is_main_interpreter()’.  (See gh-112826(11).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/91760

   (2) https://github.com/python/cpython/issues/86388

   (3) https://pypi.org/project/aiosmtpd/

   (4) https://github.com/python/cpython/issues/94352

   (5) https://github.com/python/cpython/issues/98393

   (6) https://github.com/python/cpython/issues/99127

   (7) https://github.com/python/cpython/issues/103176

   (8) https://peps.python.org/pep-0701/

   (9) https://peps.python.org/pep-0701/

   (10) https://peps.python.org/pep-0701/

   (11) https://github.com/python/cpython/issues/112826


File: python.info,  Node: Build Changes<2>,  Next: C API の変更<4>,  Prev: Python 3 12 への移植,  Up: What's New In Python 3 12

1.3.13 Build Changes
--------------------

   * Python no longer uses ‘setup.py’ to build shared C extension
     modules.  Build parameters like headers and libraries are detected
     in ‘configure’ script.  Extensions are built by ‘Makefile’.  Most
     extensions use ‘pkg-config’ and fall back to manual detection.
     (Contributed by Christian Heimes in gh-93939(1).)

   * ‘va_start()’ with two parameters, like ‘va_start(args, format),’ is
     now required to build Python.  ‘va_start()’ is no longer called
     with a single parameter.  (Contributed by Kumar Aditya in
     gh-93207(2).)

   * CPython now uses the ThinLTO option as the default link time
     optimization policy if the Clang compiler accepts the flag.
     (Contributed by Donghee Na in gh-89536(3).)

   * Add ‘COMPILEALL_OPTS’ variable in ‘Makefile’ to override *note
     compileall: 21. options (default: ‘-j0’) in ‘make install’.  Also
     merged the 3 ‘compileall’ commands into a single command to build
     .pyc files for all optimization levels (0, 1, 2) at once.
     (Contributed by Victor Stinner in gh-99289(4).)

   * Add platform triplets for 64-bit LoongArch:

        * loongarch64-linux-gnusf

        * loongarch64-linux-gnuf32

        * loongarch64-linux-gnu

     (Contributed by Zhang Na in gh-90656(5).)

   * ‘PYTHON_FOR_REGEN’ now require Python 3.10 or newer.

   * Autoconf 2.71 and aclocal 1.16.4 is now required to regenerate
     ‘configure’.  (Contributed by Christian Heimes in gh-89886(6).)

   * Windows builds and macOS installers from python.org now use OpenSSL
     3.0.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/93939

   (2) https://github.com/python/cpython/issues/93207

   (3) https://github.com/python/cpython/issues/89536

   (4) https://github.com/python/cpython/issues/99289

   (5) https://github.com/python/cpython/issues/90656

   (6) https://github.com/python/cpython/issues/89886


File: python.info,  Node: C API の変更<4>,  Prev: Build Changes<2>,  Up: What's New In Python 3 12

1.3.14 C API の変更
-------------------

* Menu:

* 新しい機能: 新しい機能<5>.
* Python 3.12 への移植: Python 3 12 への移植<2>.
* 非推奨: 非推奨<3>.
* 削除: 削除<3>.


File: python.info,  Node: 新しい機能<5>,  Next: Python 3 12 への移植<2>,  Up: C API の変更<4>

1.3.14.1 新しい機能
...................

   * PEP 697(1): Introduce the *note Unstable C API tier: 769, intended
     for low-level tools like debuggers and JIT compilers.  This API may
     change in each minor release of CPython without deprecation
     warnings.  Its contents are marked by the ‘PyUnstable_’ prefix in
     names.

     Code object constructors:

        - ‘PyUnstable_Code_New()’ (renamed from ‘PyCode_New’)

        - ‘PyUnstable_Code_NewWithPosOnlyArgs()’ (renamed from
          ‘PyCode_NewWithPosOnlyArgs’)

     Extra storage for code objects ( PEP 523(2)):

        - ‘PyUnstable_Eval_RequestCodeExtraIndex()’ (renamed from
          ‘_PyEval_RequestCodeExtraIndex’)

        - ‘PyUnstable_Code_GetExtra()’ (renamed from ‘_PyCode_GetExtra’)

        - ‘PyUnstable_Code_SetExtra()’ (renamed from ‘_PyCode_SetExtra’)

     The original names will continue to be available until the
     respective API changes.

     (Contributed by Petr Viktorin in gh-101101(3).)

   * PEP 697(4): Add an API for extending types whose instance memory
     layout is opaque:

        - *note PyType_Spec.basicsize: 76a. can be zero or negative to
          specify inheriting or extending the base class size.

        - *note PyObject_GetTypeData(): 76b. and *note
          PyType_GetTypeDataSize(): 76c. added to allow access to
          subclass-specific instance data.

        - *note Py_TPFLAGS_ITEMS_AT_END: 76d. and *note
          PyObject_GetItemData(): 76e. added to allow safely extending
          certain variable-sized types, including *note PyType_Type:
          76f.

        - *note Py_RELATIVE_OFFSET: 770. added to allow defining *note
          members: 771. in terms of a subclass-specific struct.

     (Contributed by Petr Viktorin in gh-103509(5).)

   * Add the new *note limited C API: 637. function *note
     PyType_FromMetaclass(): 772, which generalizes the existing *note
     PyType_FromModuleAndSpec(): 773. using an additional metaclass
     argument.  (Contributed by Wenzel Jakob in gh-93012(6).)

   * API for creating objects that can be called using *note the
     vectorcall protocol: 774. was added to the *note Limited API: 775.:

        * *note Py_TPFLAGS_HAVE_VECTORCALL: 776.

        * *note PyVectorcall_NARGS(): 777.

        * *note PyVectorcall_Call(): 778.

        * *note vectorcallfunc: 779.

     The *note Py_TPFLAGS_HAVE_VECTORCALL: 776. flag is now removed from
     a class when the class's *note __call__(): 77a. method is
     reassigned.  This makes vectorcall safe to use with mutable types
     (i.e.  heap types without the immutable flag, *note
     Py_TPFLAGS_IMMUTABLETYPE: 3cf.).  Mutable types that do not
     override *note tp_call: 77b. now inherit the
     ‘Py_TPFLAGS_HAVE_VECTORCALL’ flag.  (Contributed by Petr Viktorin
     in gh-93274(7).)

     The *note Py_TPFLAGS_MANAGED_DICT: 60f. and *note
     Py_TPFLAGS_MANAGED_WEAKREF: 77c. flags have been added.  This
     allows extensions classes to support object *note __dict__: 77d.
     and weakrefs with less bookkeeping, using less memory and with
     faster access.

   * API for performing calls using *note the vectorcall protocol: 774.
     was added to the *note Limited API: 775.:

        * *note PyObject_Vectorcall(): 77e.

        * *note PyObject_VectorcallMethod(): 77f.

        * *note PY_VECTORCALL_ARGUMENTS_OFFSET: 780.

     This means that both the incoming and outgoing ends of the vector
     call protocol are now available in the *note Limited API: 775.
     (Contributed by Wenzel Jakob in gh-98586(8).)

   * Add two new public functions, *note PyEval_SetProfileAllThreads():
     781. and *note PyEval_SetTraceAllThreads(): 664, that allow to set
     tracing and profiling functions in all running threads in addition
     to the calling one.  (Contributed by Pablo Galindo in gh-93503(9).)

   * Add new function *note PyFunction_SetVectorcall(): 782. to the C
     API which sets the vectorcall field of a given *note
     PyFunctionObject: 783.  (Contributed by Andrew Frost in
     gh-92257(10).)

   * The C API now permits registering callbacks via *note
     PyDict_AddWatcher(): 3d0, *note PyDict_Watch(): 784. and related
     APIs to be called whenever a dictionary is modified.  This is
     intended for use by optimizing interpreters, JIT compilers, or
     debuggers.  (Contributed by Carl Meyer in gh-91052(11).)

   * Add *note PyType_AddWatcher(): 785. and *note PyType_Watch(): 786.
     API to register callbacks to receive notification on changes to a
     type.  (Contributed by Carl Meyer in gh-91051(12).)

   * Add *note PyCode_AddWatcher(): 787. and *note
     PyCode_ClearWatcher(): 788. APIs to register callbacks to receive
     notification on creation and destruction of code objects.
     (Contributed by Itamar Oren in gh-91054(13).)

   * Add *note PyFrame_GetVar(): 789. and *note PyFrame_GetVarString():
     78a. functions to get a frame variable by its name.  (Contributed
     by Victor Stinner in gh-91248(14).)

   * Add *note PyErr_GetRaisedException(): 429. and *note
     PyErr_SetRaisedException(): 42c. for saving and restoring the
     current exception.  These functions return and accept a single
     exception object, rather than the triple arguments of the
     now-deprecated *note PyErr_Fetch(): 428. and *note PyErr_Restore():
     42b.  This is less error prone and a bit more efficient.
     (Contributed by Mark Shannon in gh-101578(15).)

   * Add ‘_PyErr_ChainExceptions1’, which takes an exception instance,
     to replace the legacy-API ‘_PyErr_ChainExceptions’, which is now
     deprecated.  (Contributed by Mark Shannon in gh-101578(16).)

   * Add *note PyException_GetArgs(): 78b. and *note
     PyException_SetArgs(): 78c. as convenience functions for retrieving
     and modifying the *note args: 78d. passed to the exception's
     constructor.  (Contributed by Mark Shannon in gh-101578(17).)

   * Add *note PyErr_DisplayException(): 435, which takes an exception
     instance, to replace the legacy-api ‘PyErr_Display()’.
     (Contributed by Irit Katriel in gh-102755(18)).

   * PEP 683(19): Introduce 'Immortal Objects', which allows objects to
     bypass reference counts, and related changes to the C-API:

        - 
          ‘_Py_IMMORTAL_REFCNT’: The reference count that defines an object

               as immortal.

        - ‘_Py_IsImmortal’ Checks if an object has the immortal
          reference count.

        - 
          ‘PyObject_HEAD_INIT’ This will now initialize reference count to

               ‘_Py_IMMORTAL_REFCNT’ when used with ‘Py_BUILD_CORE’.

        - 
          ‘SSTATE_INTERNED_IMMORTAL’ An identifier for interned unicode objects

               that are immortal.

        - 
          ‘SSTATE_INTERNED_IMMORTAL_STATIC’ An identifier for interned unicode

               objects that are immortal and static

        - 
          ‘sys.getunicodeinternedsize’ This returns the total number of unicode

               objects that have been interned.  This is now needed for
               ‘refleak.py’ to correctly track reference counts and
               allocated blocks

     (Contributed by Eddie Elizondo in gh-84436(20).)

   * PEP 684(21): Add the new *note Py_NewInterpreterFromConfig(): 689.
     function and *note PyInterpreterConfig: 78e, which may be used to
     create sub-interpreters with their own GILs.  (See *note PEP 684;
     インタープリタごとの GIL: 670. for more info.)  (Contributed by
     Eric Snow in gh-104110(22).)

   * In the limited C API version 3.12, *note Py_INCREF(): 78f. and
     *note Py_DECREF(): 790. functions are now implemented as opaque
     function calls to hide implementation details.  (Contributed by
     Victor Stinner in gh-105387(23).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0697/

   (2) https://peps.python.org/pep-0523/

   (3) https://github.com/python/cpython/issues/101101

   (4) https://peps.python.org/pep-0697/

   (5) https://github.com/python/cpython/issues/103509

   (6) https://github.com/python/cpython/issues/93012

   (7) https://github.com/python/cpython/issues/93274

   (8) https://github.com/python/cpython/issues/98586

   (9) https://github.com/python/cpython/issues/93503

   (10) https://github.com/python/cpython/issues/92257

   (11) https://github.com/python/cpython/issues/91052

   (12) https://github.com/python/cpython/issues/91051

   (13) https://github.com/python/cpython/issues/91054

   (14) https://github.com/python/cpython/issues/91248

   (15) https://github.com/python/cpython/issues/101578

   (16) https://github.com/python/cpython/issues/101578

   (17) https://github.com/python/cpython/issues/101578

   (18) https://github.com/python/cpython/issues/102755

   (19) https://peps.python.org/pep-0683/

   (20) https://github.com/python/cpython/issues/84436

   (21) https://peps.python.org/pep-0684/

   (22) https://github.com/python/cpython/issues/104110

   (23) https://github.com/python/cpython/issues/105387


File: python.info,  Node: Python 3 12 への移植<2>,  Next: 非推奨<3>,  Prev: 新しい機能<5>,  Up: C API の変更<4>

1.3.14.2 Python 3.12 への移植
.............................

   * Legacy Unicode APIs based on ‘Py_UNICODE*’ representation has been
     removed.  Please migrate to APIs based on UTF-8 or ‘wchar_t*’.

   * Argument parsing functions like *note PyArg_ParseTuple(): 3c1.
     doesn't support ‘Py_UNICODE*’ based format (e.g.  ‘u’, ‘Z’)
     anymore.  Please migrate to other formats for Unicode like ‘s’,
     ‘z’, ‘es’, and ‘U’.

   * ‘tp_weaklist’ for all static builtin types is always ‘NULL’.  This
     is an internal-only field on ‘PyTypeObject’ but we're pointing out
     the change in case someone happens to be accessing the field
     directly anyway.  To avoid breakage, consider using the existing
     public C-API instead, or, if necessary, the (internal-only)
     ‘_PyObject_GET_WEAKREFS_LISTPTR()’ macro.

   * This internal-only *note PyTypeObject.tp_subclasses: 792. may now
     not be a valid object pointer.  Its type was changed to void* to
     reflect this.  We mention this in case someone happens to be
     accessing the internal-only field directly.

     To get a list of subclasses, call the Python method *note
     __subclasses__(): 793. (using *note PyObject_CallMethod(): 640, for
     example).

   * Add support of more formatting options (left aligning, octals,
     uppercase hexadecimals, ‘intmax_t’, ‘ptrdiff_t’, ‘wchar_t’ C
     strings, variable width and precision) in *note
     PyUnicode_FromFormat(): 62b. and *note PyUnicode_FromFormatV():
     794.  (Contributed by Serhiy Storchaka in gh-98836(1).)

   * An unrecognized format character in *note PyUnicode_FromFormat():
     62b. and *note PyUnicode_FromFormatV(): 794. now sets a *note
     SystemError: 795.  In previous versions it caused all the rest of
     the format string to be copied as-is to the result string, and any
     extra arguments discarded.  (Contributed by Serhiy Storchaka in
     gh-95781(2).)

   * Fix wrong sign placement in *note PyUnicode_FromFormat(): 62b. and
     *note PyUnicode_FromFormatV(): 794.  (Contributed by Philip Georgi
     in gh-95504(3).)

   * Extension classes wanting to add a *note __dict__: 77d. or weak
     reference slot should use *note Py_TPFLAGS_MANAGED_DICT: 60f. and
     *note Py_TPFLAGS_MANAGED_WEAKREF: 77c. instead of ‘tp_dictoffset’
     and ‘tp_weaklistoffset’, respectively.  The use of ‘tp_dictoffset’
     and ‘tp_weaklistoffset’ is still supported, but does not fully
     support multiple inheritance (gh-95589(4)), and performance may be
     worse.  Classes declaring *note Py_TPFLAGS_MANAGED_DICT: 60f. must
     call ‘_PyObject_VisitManagedDict()’ and
     ‘_PyObject_ClearManagedDict()’ to traverse and clear their
     instance's dictionaries.  To clear weakrefs, call *note
     PyObject_ClearWeakRefs(): 796, as before.

   * The *note PyUnicode_FSDecoder(): 797. function no longer accepts
     bytes-like paths, like *note bytearray: 344. and *note memoryview:
     165. types: only the exact *note bytes: 192. type is accepted for
     bytes strings.  (Contributed by Victor Stinner in gh-98393(5).)

   * The *note Py_CLEAR: 798, *note Py_SETREF: 799. and *note
     Py_XSETREF: 79a. macros now only evaluate their arguments once.  If
     an argument has side effects, these side effects are no longer
     duplicated.  (Contributed by Victor Stinner in gh-98724(6).)

   * The interpreter's error indicator is now always normalized.  This
     means that *note PyErr_SetObject(): 79b, *note PyErr_SetString():
     79c. and the other functions that set the error indicator now
     normalize the exception before storing it.  (Contributed by Mark
     Shannon in gh-101578(7).)

   * ‘_Py_RefTotal’ is no longer authoritative and only kept around for
     ABI compatibility.  Note that it is an internal global and only
     available on debug builds.  If you happen to be using it then
     you'll need to start using ‘_Py_GetGlobalRefTotal()’.

   * The following functions now select an appropriate metaclass for the
     newly created type:

        * *note PyType_FromSpec(): 79d.

        * *note PyType_FromSpecWithBases(): 79e.

        * *note PyType_FromModuleAndSpec(): 773.

     Creating classes whose metaclass overrides *note tp_new: 79f. is
     deprecated, and in Python 3.14+ it will be disallowed.  Note that
     these functions ignore ‘tp_new’ of the metaclass, possibly allowing
     incomplete initialization.

     Note that *note PyType_FromMetaclass(): 772. (added in Python 3.12)
     already disallows creating classes whose metaclass overrides
     ‘tp_new’ (*note __new__(): 7a0. in Python).

     Since ‘tp_new’ overrides almost everything ‘PyType_From*’ functions
     do, the two are incompatible with each other.  The existing
     behavior - ignoring the metaclass for several steps of type
     creation - is unsafe in general, since (meta)classes assume that
     ‘tp_new’ was called.  There is no simple general workaround.  One
     of the following may work for you:

        - If you control the metaclass, avoid using ‘tp_new’ in it:

             - If initialization can be skipped, it can be done in *note
               tp_init: 7a1. instead.

             - If the metaclass doesn't need to be instantiated from
               Python, set its ‘tp_new’ to ‘NULL’ using the *note
               Py_TPFLAGS_DISALLOW_INSTANTIATION: 7a2. flag.  This makes
               it acceptable for ‘PyType_From*’ functions.

        - Avoid ‘PyType_From*’ functions: if you don't need C-specific
          features (slots or setting the instance size), create types by
          *note calling: 7a3. the metaclass.

        - If you 'know' the ‘tp_new’ can be skipped safely, filter the
          deprecation warning out using *note warnings.catch_warnings():
          179. from Python.

   * *note PyOS_InputHook: 7a4. and *note PyOS_ReadlineFunctionPointer:
     7a5. are no longer called in *note subinterpreters: 163.  This is
     because clients generally rely on process-wide global state (since
     these callbacks have no way of recovering extension module state).

     This also avoids situations where extensions may find themselves
     running in a subinterpreter that they don't support (or haven't yet
     been loaded in).  See gh-104668(8) for more info.

   * *note PyLongObject: 39e. has had its internals changed for better
     performance.  Although the internals of *note PyLongObject: 39e.
     are private, they are used by some extension modules.  The internal
     fields should no longer be accessed directly, instead the API
     functions beginning ‘PyLong_...’ should be used instead.  Two new
     'unstable' API functions are provided for efficient access to the
     value of *note PyLongObject: 39e.s which fit into a single machine
     word:

        * *note PyUnstable_Long_IsCompact(): 7a6.

        * *note PyUnstable_Long_CompactValue(): 7a7.

   * Custom allocators, set via *note PyMem_SetAllocator(): 7a8, are now
     required to be thread-safe, regardless of memory domain.
     Allocators that don't have their own state, including "hooks", are
     not affected.  If your custom allocator is not already thread-safe
     and you need guidance then please create a new GitHub issue and CC
     ‘@ericsnowcurrently’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98836

   (2) https://github.com/python/cpython/issues/95781

   (3) https://github.com/python/cpython/issues/95504

   (4) https://github.com/python/cpython/issues/95589

   (5) https://github.com/python/cpython/issues/98393

   (6) https://github.com/python/cpython/issues/98724

   (7) https://github.com/python/cpython/issues/101578

   (8) https://github.com/python/cpython/issues/104668


File: python.info,  Node: 非推奨<3>,  Next: 削除<3>,  Prev: Python 3 12 への移植<2>,  Up: C API の変更<4>

1.3.14.3 非推奨
...............

   * In accordance with PEP 699(1), the ‘ma_version_tag’ field in *note
     PyDictObject: 64f. is deprecated for extension modules.  Accessing
     this field will generate a compiler warning at compile time.  This
     field will be removed in Python 3.14.  (Contributed by Ramvikrams
     and Kumar Aditya in gh-101193(2).  PEP by Ken Jin.)

   * Deprecate global configuration variable:

        * *note Py_DebugFlag: 3f8.: use *note PyConfig.parser_debug:
          3f9.

        * *note Py_VerboseFlag: 3fa.: use *note PyConfig.verbose: 3fb.

        * *note Py_QuietFlag: 3fc.: use *note PyConfig.quiet: 3fd.

        * *note Py_InteractiveFlag: 3fe.: use *note
          PyConfig.interactive: 3ff.

        * *note Py_InspectFlag: 400.: use *note PyConfig.inspect: 401.

        * *note Py_OptimizeFlag: 402.: use *note
          PyConfig.optimization_level: 403.

        * *note Py_NoSiteFlag: 404.: use *note PyConfig.site_import:
          405.

        * *note Py_BytesWarningFlag: 406.: use *note
          PyConfig.bytes_warning: 407.

        * *note Py_FrozenFlag: 408.: use *note
          PyConfig.pathconfig_warnings: 409.

        * *note Py_IgnoreEnvironmentFlag: 40a.: use *note
          PyConfig.use_environment: 40b.

        * *note Py_DontWriteBytecodeFlag: 40c.: use *note
          PyConfig.write_bytecode: 40d.

        * *note Py_NoUserSiteDirectory: 40e.: use *note
          PyConfig.user_site_directory: 40f.

        * *note Py_UnbufferedStdioFlag: 410.: use *note
          PyConfig.buffered_stdio: 411.

        * *note Py_HashRandomizationFlag: 412.: use *note
          PyConfig.use_hash_seed: 413. and *note PyConfig.hash_seed:
          414.

        * *note Py_IsolatedFlag: 415.: use *note PyConfig.isolated: 416.

        * *note Py_LegacyWindowsFSEncodingFlag: 417.: use *note
          PyPreConfig.legacy_windows_fs_encoding: 418.

        * *note Py_LegacyWindowsStdioFlag: 419.: use *note
          PyConfig.legacy_windows_stdio: 41a.

        * ‘Py_FileSystemDefaultEncoding’: use *note
          PyConfig.filesystem_encoding: 41b.

        * ‘Py_HasFileSystemDefaultEncoding’: use *note
          PyConfig.filesystem_encoding: 41b.

        * ‘Py_FileSystemDefaultEncodeErrors’: use *note
          PyConfig.filesystem_errors: 41c.

        * ‘Py_UTF8Mode’: use *note PyPreConfig.utf8_mode: 41d. (see
          *note Py_PreInitialize(): 41e.)

     The *note Py_InitializeFromConfig(): 3f6. API should be used with
     *note PyConfig: 3f7. instead.  (Contributed by Victor Stinner in
     gh-77782(3).)

   * Creating *note immutable types: 3cf. with mutable bases is
     deprecated and will be disabled in Python 3.14.  (gh-95388(4))

   * The ‘structmember.h’ header is deprecated, though it continues to
     be available and there are no plans to remove it.

     Its contents are now available just by including ‘Python.h’, with a
     ‘Py’ prefix added if it was missing:

        - *note PyMemberDef: 771, *note PyMember_GetOne(): 7aa. and
          *note PyMember_SetOne(): 7ab.

        - Type macros like *note Py_T_INT: 7ac, *note Py_T_DOUBLE: 7ad,
          etc.  (previously ‘T_INT’, ‘T_DOUBLE’, etc.)

        - The flags *note Py_READONLY: 7ae. (previously ‘READONLY’) and
          *note Py_AUDIT_READ: 7af. (previously all uppercase)

     Several items are not exposed from ‘Python.h’:

        - *note T_OBJECT: 7b0. (use *note Py_T_OBJECT_EX: 7b1.)

        - *note T_NONE: 7b2. (previously undocumented, and pretty
          quirky)

        - The macro ‘WRITE_RESTRICTED’ which does nothing.

        - The macros ‘RESTRICTED’ and ‘READ_RESTRICTED’, equivalents of
          *note Py_AUDIT_READ: 7af.

        - In some configurations, ‘<stddef.h>’ is not included from
          ‘Python.h’.  It should be included manually when using
          ‘offsetof()’.

     The deprecated header continues to provide its original contents
     under the original names.  Your old code can stay unchanged, unless
     the extra include and non-namespaced macros bother you greatly.

     (Contributed in gh-47146(5) by Petr Viktorin, based on earlier work
     by Alexander Belopolsky and Matthias Braun.)

   * *note PyErr_Fetch(): 428. and *note PyErr_Restore(): 42b. are
     deprecated.  Use *note PyErr_GetRaisedException(): 429. and *note
     PyErr_SetRaisedException(): 42c. instead.  (Contributed by Mark
     Shannon in gh-101578(6).)

   * ‘PyErr_Display()’ is deprecated.  Use *note
     PyErr_DisplayException(): 435. instead.  (Contributed by Irit
     Katriel in gh-102755(7)).

   * ‘_PyErr_ChainExceptions’ is deprecated.  Use
     ‘_PyErr_ChainExceptions1’ instead.  (Contributed by Irit Katriel in
     gh-102192(8).)

   * Using *note PyType_FromSpec(): 79d, *note
     PyType_FromSpecWithBases(): 79e. or *note
     PyType_FromModuleAndSpec(): 773. to create a class whose metaclass
     overrides *note tp_new: 79f. is deprecated.  Call the metaclass
     instead.

* Menu:

* Pending removal in Python 3.14: Pending removal in Python 3 14<4>.
* Pending removal in Python 3.15: Pending removal in Python 3 15<6>.
* Pending removal in Python 3.16: Pending removal in Python 3 16<6>.
* Pending removal in future versions: Pending removal in future versions<6>.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0699/

   (2) https://github.com/python/cpython/issues/101193

   (3) https://github.com/python/cpython/issues/77782

   (4) https://github.com/python/cpython/issues/95388

   (5) https://github.com/python/cpython/issues/47146

   (6) https://github.com/python/cpython/issues/101578

   (7) https://github.com/python/cpython/issues/102755

   (8) https://github.com/python/cpython/issues/102192


File: python.info,  Node: Pending removal in Python 3 14<4>,  Next: Pending removal in Python 3 15<6>,  Up: 非推奨<3>

1.3.14.4 Pending removal in Python 3.14
.......................................

   * The ‘ma_version_tag’ field in *note PyDictObject: 64f. for
     extension modules ( PEP 699(1); gh-101193(2)).

   * Creating *note immutable types: 3cf. with mutable bases
     (gh-95388(3)).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0699/

   (2) https://github.com/python/cpython/issues/101193

   (3) https://github.com/python/cpython/issues/95388


File: python.info,  Node: Pending removal in Python 3 15<6>,  Next: Pending removal in Python 3 16<6>,  Prev: Pending removal in Python 3 14<4>,  Up: 非推奨<3>

1.3.14.5 Pending removal in Python 3.15
.......................................

   * The *note PyImport_ImportModuleNoBlock(): 3db.: Use *note
     PyImport_ImportModule(): 3dc. instead.

   * *note PyWeakref_GetObject(): 3dd. and *note PyWeakref_GET_OBJECT():
     3de.: Use *note PyWeakref_GetRef(): 3df. instead.  The
     pythoncapi-compat project(1) can be used to get *note
     PyWeakref_GetRef(): 3df. on Python 3.12 and older.

   * *note Py_UNICODE: 3e0. type and the ‘Py_UNICODE_WIDE’ macro: Use
     ‘wchar_t’ instead.

   * ‘PyUnicode_AsDecodedObject()’: Use *note PyCodec_Decode(): 3e1.
     instead.

   * ‘PyUnicode_AsDecodedUnicode()’: Use *note PyCodec_Decode(): 3e1.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note str: 169, such as *note bytes: 192.

   * ‘PyUnicode_AsEncodedObject()’: Use *note PyCodec_Encode(): 3e2.
     instead.

   * ‘PyUnicode_AsEncodedUnicode()’: Use *note PyCodec_Encode(): 3e2.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note bytes: 192, such as *note str: 169.

   * Python initialization functions, deprecated in Python 3.13:

        * *note Py_GetPath(): 3e3.: Use *note
          PyConfig_Get("module_search_paths"): 37c. (*note sys.path:
          3e4.) instead.

        * *note Py_GetPrefix(): 3e5.: Use *note
          PyConfig_Get("base_prefix"): 37c. (*note sys.base_prefix:
          3e6.) instead.  Use *note PyConfig_Get("prefix"): 37c. (*note
          sys.prefix: 3e7.) if *note virtual environments: 3e8. need to
          be handled.

        * *note Py_GetExecPrefix(): 3e9.: Use *note
          PyConfig_Get("base_exec_prefix"): 37c. (*note
          sys.base_exec_prefix: 3ea.) instead.  Use *note
          PyConfig_Get("exec_prefix"): 37c. (*note sys.exec_prefix:
          3eb.) if *note virtual environments: 3e8. need to be handled.

        * *note Py_GetProgramFullPath(): 3ec.: Use *note
          PyConfig_Get("executable"): 37c. (*note sys.executable: 3ed.)
          instead.

        * *note Py_GetProgramName(): 3ee.: Use *note
          PyConfig_Get("executable"): 37c. (*note sys.executable: 3ed.)
          instead.

        * *note Py_GetPythonHome(): 3ef.: Use *note
          PyConfig_Get("home"): 37c. or the *note PYTHONHOME: 3f0.
          environment variable instead.

     The pythoncapi-compat project(2) can be used to get *note
     PyConfig_Get(): 37c. on Python 3.13 and older.

   * Functions to configure Python's initialization, deprecated in
     Python 3.11:

        * ‘PySys_SetArgvEx()’: Set *note PyConfig.argv: 3f1. instead.

        * ‘PySys_SetArgv()’: Set *note PyConfig.argv: 3f1. instead.

        * ‘Py_SetProgramName()’: Set *note PyConfig.program_name: 3f2.
          instead.

        * ‘Py_SetPythonHome()’: Set *note PyConfig.home: 3f3. instead.

        * *note PySys_ResetWarnOptions(): 3f4.: Clear *note
          sys.warnoptions: 3f5. and ‘warnings.filters’ instead.

     The *note Py_InitializeFromConfig(): 3f6. API should be used with
     *note PyConfig: 3f7. instead.

   * Global configuration variables:

        * *note Py_DebugFlag: 3f8.: Use *note PyConfig.parser_debug:
          3f9. or *note PyConfig_Get("parser_debug"): 37c. instead.

        * *note Py_VerboseFlag: 3fa.: Use *note PyConfig.verbose: 3fb.
          or *note PyConfig_Get("verbose"): 37c. instead.

        * *note Py_QuietFlag: 3fc.: Use *note PyConfig.quiet: 3fd. or
          *note PyConfig_Get("quiet"): 37c. instead.

        * *note Py_InteractiveFlag: 3fe.: Use *note
          PyConfig.interactive: 3ff. or *note
          PyConfig_Get("interactive"): 37c. instead.

        * *note Py_InspectFlag: 400.: Use *note PyConfig.inspect: 401.
          or *note PyConfig_Get("inspect"): 37c. instead.

        * *note Py_OptimizeFlag: 402.: Use *note
          PyConfig.optimization_level: 403. or *note
          PyConfig_Get("optimization_level"): 37c. instead.

        * *note Py_NoSiteFlag: 404.: Use *note PyConfig.site_import:
          405. or *note PyConfig_Get("site_import"): 37c. instead.

        * *note Py_BytesWarningFlag: 406.: Use *note
          PyConfig.bytes_warning: 407. or *note
          PyConfig_Get("bytes_warning"): 37c. instead.

        * *note Py_FrozenFlag: 408.: Use *note
          PyConfig.pathconfig_warnings: 409. or *note
          PyConfig_Get("pathconfig_warnings"): 37c. instead.

        * *note Py_IgnoreEnvironmentFlag: 40a.: Use *note
          PyConfig.use_environment: 40b. or *note
          PyConfig_Get("use_environment"): 37c. instead.

        * *note Py_DontWriteBytecodeFlag: 40c.: Use *note
          PyConfig.write_bytecode: 40d. or *note
          PyConfig_Get("write_bytecode"): 37c. instead.

        * *note Py_NoUserSiteDirectory: 40e.: Use *note
          PyConfig.user_site_directory: 40f. or *note
          PyConfig_Get("user_site_directory"): 37c. instead.

        * *note Py_UnbufferedStdioFlag: 410.: Use *note
          PyConfig.buffered_stdio: 411. or *note
          PyConfig_Get("buffered_stdio"): 37c. instead.

        * *note Py_HashRandomizationFlag: 412.: Use *note
          PyConfig.use_hash_seed: 413. and *note PyConfig.hash_seed:
          414. or *note PyConfig_Get("hash_seed"): 37c. instead.

        * *note Py_IsolatedFlag: 415.: Use *note PyConfig.isolated: 416.
          or *note PyConfig_Get("isolated"): 37c. instead.

        * *note Py_LegacyWindowsFSEncodingFlag: 417.: Use *note
          PyPreConfig.legacy_windows_fs_encoding: 418. or *note
          PyConfig_Get("legacy_windows_fs_encoding"): 37c. instead.

        * *note Py_LegacyWindowsStdioFlag: 419.: Use *note
          PyConfig.legacy_windows_stdio: 41a. or *note
          PyConfig_Get("legacy_windows_stdio"): 37c. instead.

        * ‘Py_FileSystemDefaultEncoding’,
          ‘Py_HasFileSystemDefaultEncoding’: Use *note
          PyConfig.filesystem_encoding: 41b. or *note
          PyConfig_Get("filesystem_encoding"): 37c. instead.

        * ‘Py_FileSystemDefaultEncodeErrors’: Use *note
          PyConfig.filesystem_errors: 41c. or *note
          PyConfig_Get("filesystem_errors"): 37c. instead.

        * ‘Py_UTF8Mode’: Use *note PyPreConfig.utf8_mode: 41d. or *note
          PyConfig_Get("utf8_mode"): 37c. instead.  (see *note
          Py_PreInitialize(): 41e.)

     The *note Py_InitializeFromConfig(): 3f6. API should be used with
     *note PyConfig: 3f7. to set these options.  Or *note
     PyConfig_Get(): 37c. can be used to get these options at runtime.

   ---------- Footnotes ----------

   (1) https://github.com/python/pythoncapi-compat/

   (2) https://github.com/python/pythoncapi-compat/


File: python.info,  Node: Pending removal in Python 3 16<6>,  Next: Pending removal in future versions<6>,  Prev: Pending removal in Python 3 15<6>,  Up: 非推奨<3>

1.3.14.6 Pending removal in Python 3.16
.......................................

   * The bundled copy of ‘libmpdec’.


File: python.info,  Node: Pending removal in future versions<6>,  Prev: Pending removal in Python 3 16<6>,  Up: 非推奨<3>

1.3.14.7 Pending removal in future versions
...........................................

The following APIs are deprecated and will be removed, although there is
currently no date scheduled for their removal.

   * *note Py_TPFLAGS_HAVE_FINALIZE: 427.: Unneeded since Python 3.8.

   * *note PyErr_Fetch(): 428.: Use *note PyErr_GetRaisedException():
     429. instead.

   * *note PyErr_NormalizeException(): 42a.: Use *note
     PyErr_GetRaisedException(): 429. instead.

   * *note PyErr_Restore(): 42b.: Use *note PyErr_SetRaisedException():
     42c. instead.

   * *note PyModule_GetFilename(): 42d.: Use *note
     PyModule_GetFilenameObject(): 42e. instead.

   * *note PyOS_AfterFork(): 42f.: Use *note PyOS_AfterFork_Child():
     430. instead.

   * *note PySlice_GetIndicesEx(): 431.: Use *note PySlice_Unpack():
     432. and *note PySlice_AdjustIndices(): 433. instead.

   * *note PyUnicode_READY(): 434.: Unneeded since Python 3.12

   * ‘PyErr_Display()’: Use *note PyErr_DisplayException(): 435.
     instead.

   * ‘_PyErr_ChainExceptions()’: Use ‘_PyErr_ChainExceptions1()’
     instead.

   * ‘PyBytesObject.ob_shash’ member: call *note PyObject_Hash(): 436.
     instead.

   * Thread Local Storage (TLS) API:

        * *note PyThread_create_key(): 437.: Use *note
          PyThread_tss_alloc(): 438. instead.

        * *note PyThread_delete_key(): 439.: Use *note
          PyThread_tss_free(): 43a. instead.

        * *note PyThread_set_key_value(): 43b.: Use *note
          PyThread_tss_set(): 43c. instead.

        * *note PyThread_get_key_value(): 43d.: Use *note
          PyThread_tss_get(): 43e. instead.

        * *note PyThread_delete_key_value(): 43f.: Use *note
          PyThread_tss_delete(): 440. instead.

        * *note PyThread_ReInitTLS(): 441.: Unneeded since Python 3.7.


File: python.info,  Node: 削除<3>,  Prev: 非推奨<3>,  Up: C API の変更<4>

1.3.14.8 削除
.............

   * Remove the ‘token.h’ header file.  There was never any public
     tokenizer C API. The ‘token.h’ header file was only designed to be
     used by Python internals.  (Contributed by Victor Stinner in
     gh-92651(1).)

   * Legacy Unicode APIs have been removed.  See PEP 623(2) for detail.

        * ‘PyUnicode_WCHAR_KIND’

        * ‘PyUnicode_AS_UNICODE()’

        * ‘PyUnicode_AsUnicode()’

        * ‘PyUnicode_AsUnicodeAndSize()’

        * ‘PyUnicode_AS_DATA()’

        * ‘PyUnicode_FromUnicode()’

        * ‘PyUnicode_GET_SIZE()’

        * ‘PyUnicode_GetSize()’

        * ‘PyUnicode_GET_DATA_SIZE()’

   * Remove the ‘PyUnicode_InternImmortal()’ function macro.
     (Contributed by Victor Stinner in gh-85858(3).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/92651

   (2) https://peps.python.org/pep-0623/

   (3) https://github.com/python/cpython/issues/85858


File: python.info,  Node: What's New In Python 3 11,  Next: What's New In Python 3 10,  Prev: What's New In Python 3 12,  Up: What's New in Python

1.4 What's New In Python 3.11
=============================


編集者: Pablo Galindo Salgado

この記事では Python 3.10 と比較した Python 3.11 の新機能を解説します。
Python 3.11 は2022年10月24日にリリースされました。全詳細については *note
変更履歴: 142. をご覧ください。

* Menu:

* 概要: 概要 -- リリースハイライト<4>. リリースハイライト
* 新しい機能: 新しい機能<6>.
* 型ヒントに関連する新しい機能: 型ヒントに関連する新しい機能<2>.
* その他の言語変更: その他の言語変更<3>.
* その他の CPython の実装の変更::
* 新たなモジュール: 新たなモジュール<3>.
* 改良されたモジュール: 改良されたモジュール<3>.
* 最適化: 最適化<4>.
* Faster CPython::
* CPython バイトコードの変更: CPython バイトコードの変更<3>.
* 非推奨: 非推奨<4>.
* Pending Removal in Python 3.12: Pending Removal in Python 3 12.
* 削除: 削除<4>.
* Porting to Python 3.11: Porting to Python 3 11.
* Build Changes: Build Changes<3>.
* C API の変更: C API の変更<5>.
* Python 3.11.4での重要な変更点: Python 3 11 4での重要な変更点.
* Python 3.11.5での重要な変更点: Python 3 11 5での重要な変更点.


File: python.info,  Node: 概要 -- リリースハイライト<4>,  Next: 新しい機能<6>,  Up: What's New In Python 3 11

1.4.1 概要 - リリースハイライト
-------------------------------

   * Python 3.11 は Python 3.10 とくらべて 10-60% 高速です。平均的には、
     標準ベンチマークスイートでは 1.25倍の高速化を計測しました。詳細につ
     いては *note Faster CPython: 7bd. を見てください。

新たな文法機能:

   * *note PEP 654; 例外グループと except*: 7be.

新たな組み込み機能:

   * *note PEP 678; ノートによって例外を充実させる: 7bf.

新しい標準ライブラリのモジュール：

   * PEP 680(1): *note tomllib: 102. — TOML(2) のパースを標準ライブラリ
     でサポート

インタープリタの改善:

   * *note PEP 657; トレースバックのエラー位置の詳細化: 7c0.

   * 新しい *note -P: 7c1. コマンドライン引数と *note PYTHONSAFEPATH:
     7c2. 環境変数により、 *note 安全でない可能性のあるパス: 7c3. を
     *note sys.path: 3e4. に自動的に先頭に付加しないようにします。

新しい型ヒントの機能:

   * *note PEP 646; Variadic generics: 7c4.

   * *note PEP 655; Marking individual TypedDict items as required or
     not-required: 7c5.

   * *note PEP 673; Self 型: 7c6.

   * *note PEP 675; Arbitrary literal string type: 7c7.

   * *note PEP 681; Data class transforms: 7c8.

重要な非推奨化、削除と制限：

   * PEP 594(3): *note
     たくさんのレガシーの標準ライブラリのモジュールが非推奨になり: 7c9.
     Python 3.13 で削除されます

   * PEP 624(4): *note Py_UNICODE エンコーダー API は削除されました:
     7ca.

   * PEP 670(5): *note 静的インライン関数に変換されたマクロ: 7cb.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0680/

   (2) https://toml.io/

   (3) https://peps.python.org/pep-0594/

   (4) https://peps.python.org/pep-0624/

   (5) https://peps.python.org/pep-0670/


File: python.info,  Node: 新しい機能<6>,  Next: 型ヒントに関連する新しい機能<2>,  Prev: 概要 -- リリースハイライト<4>,  Up: What's New In Python 3 11

1.4.2 新しい機能
----------------

* Menu:

* PEP 657; トレースバックのエラー位置の詳細化: PEP 657 トレースバックのエラー位置の詳細化.
* PEP 654; 例外グループと except*: PEP 654 例外グループと except*.
* PEP 678; ノートによって例外を充実させる: PEP 678 ノートによって例外を充実させる.
* Windows py.exe ランチャーの改善: Windows py exe ランチャーの改善.


File: python.info,  Node: PEP 657 トレースバックのエラー位置の詳細化,  Next: PEP 654 例外グループと except*,  Up: 新しい機能<6>

1.4.2.1 PEP 657: トレースバックのエラー位置の詳細化
...................................................

トレースバックの出力時に、インタープリタはエラーを送出した行だけでなく正
確な式を指し示すようになりました。たとえば:

     Traceback (most recent call last):
       File "distance.py", line 11, in <module>
         print(manhattan_distance(p1, p2))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
       File "distance.py", line 6, in manhattan_distance
         return abs(point_1.x - point_2.x) + abs(point_1.y - point_2.y)
                                ^^^^^^^^^
     AttributeError: 'NoneType' object has no attribute 'x'

以前のバージョンのインタープリタはその行だけを指していたため、どのオブジ
ェクトが ‘None’ であるかが曖昧でした。これらの強化されたエラーは、深くネ
ストされた *note dict: 183. オブジェクトや複数の関数呼び出しを処理すると
きにも役立ちます:

     Traceback (most recent call last):
       File "query.py", line 37, in <module>
         magic_arithmetic('foo')
       File "query.py", line 18, in magic_arithmetic
         return add_counts(x) / 25
                ^^^^^^^^^^^^^
       File "query.py", line 24, in add_counts
         return 25 + query_user(user1) + query_user(user2)
                     ^^^^^^^^^^^^^^^^^
       File "query.py", line 32, in query_user
         return 1 + query_count(db, response['a']['b']['c']['user'], retry=True)
                                    ~~~~~~~~~~~~~~~~~~^^^^^
     TypeError: 'NoneType' object is not subscriptable

複雑な算術式と同様に:

     Traceback (most recent call last):
       File "calculation.py", line 54, in <module>
         result = (x / y / z) * (a / b / c)
                   ~~~~~~^~~
     ZeroDivisionError: division by zero

さらに、強化されたトレースバック機能で使用される情報は、一般的な API を
介して利用可能になり、 *note bytecode: 4aa. *note 命令: 7cf. とソースコ
ードの場所を関連付けるために使用できます。この情報は次を使用して取得でき
ます:

   - Python の *note codeobject.co_positions(): 7d0. メソッド。

   - C API の *note PyCode_Addr2Location(): 7d1. 関数。

詳細は PEP 657(1) を参照してください。(Pablo Galindo, Batuhan Taskaya,
Ammar Askar の貢献による bpo-43950(2))

     注釈: この機能は *note コードオブジェクト: 7d2. に列の位置を保存す
     る必要があり、その結果コンパイルされた Pthon ファイルのインタープリ
     タのメモリ使用量とディスク使用量がわずかに増加する可能性があります
     。余分な情報を保存せず、余分なトレースバック情報を表示しないように
     するには *note -X no_debug_ranges: 16f. コマンドライン引数または
     *note PYTHONNODEBUGRANGES: 7d3. 環境変数を使用してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0657/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43950


File: python.info,  Node: PEP 654 例外グループと except*,  Next: PEP 678 ノートによって例外を充実させる,  Prev: PEP 657 トレースバックのエラー位置の詳細化,  Up: 新しい機能<6>

1.4.2.2 PEP 654: 例外グループと ‘except*’
.........................................

PEP 654(1) では、プログラムが無関係な複数の例外を同時に送出させて処理で
きるようにする言語機能が導入されています。組み込み型 *note
ExceptionGroup: 4d2. と *note BaseExceptionGroup: 566. を使用すると、例
外をグループ化して一緒に送出することができます。また、新しい *note
except*: 1ac. 構文は、 *note except: 1ab. を例外グループのサブグループに
マッチするように一般化したものです。

より詳しくは PEP 654(2) を参照してください。

(Irit Katriel の貢献による bpo-45292(3)。PEP はIrit Katriel, Yury
Selivanov, Guido van Rossum によって作成されました。)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0654/

   (2) https://peps.python.org/pep-0654/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45292


File: python.info,  Node: PEP 678 ノートによって例外を充実させる,  Next: Windows py exe ランチャーの改善,  Prev: PEP 654 例外グループと except*,  Up: 新しい機能<6>

1.4.2.3 PEP 678: ノートによって例外を充実させる
...............................................

*note BaseException: 7d6. に *note add_note(): 7d7. メソッドが追加されま
した。これは例外が送出された時点では利用できないコンテキスト情報を例外に
付与するために使用できます。追加された注釈はデフォルトのトレースバックに
表示されます。

より詳しくは PEP 678(1) を参照してください。

(Irit Katriel の貢献による bpo-45607(2)。PEP は Zac Hatfield-Dodds によ
って作成されました。)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0678/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45607


File: python.info,  Node: Windows py exe ランチャーの改善,  Prev: PEP 678 ノートによって例外を充実させる,  Up: 新しい機能<6>

1.4.2.4 Windows ‘py.exe’ ランチャーの改善
.........................................

Python 3.11 に含まれる *note Python install manager: 7da. のコピーが大幅
に更新されました。 PEP 514(1) で定義されているように、制限付きの
‘-<MAJOR>.<MINOR>’ の代わりに ‘-V:<COMPANY>/<TAG>’ 引数を使用した
company/tag 構文をサポートするようになりました。これにより、
python.org(2) でホストされている ‘PythonCore’ 以外のディストリビューショ
ンを起動できるようになります。

When using ‘-V:’ selectors, either company or tag can be omitted, but
all installs will be searched.  For example, ‘-V:OtherPython/’ will
select the "best" tag registered for ‘OtherPython’, while ‘-V:3.11’ or
‘-V:/3.11’ will select the "best" distribution with tag ‘3.11’.

When using the legacy ‘-<MAJOR>’, ‘-<MAJOR>.<MINOR>’,
‘-<MAJOR>-<BITNESS>’ or ‘-<MAJOR>.<MINOR>-<BITNESS>’ arguments, all
existing behaviour should be preserved from past versions, and only
releases from ‘PythonCore’ will be selected.  However, the ‘-64’ suffix
now implies "not 32-bit" (not necessarily x86-64), as there are multiple
supported 64-bit platforms.  32-bit runtimes are detected by checking
the runtime's tag for a ‘-32’ suffix.  All releases of Python since 3.5
have included this in their 32-bit builds.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0514/

   (2) https://www.python.org


File: python.info,  Node: 型ヒントに関連する新しい機能<2>,  Next: その他の言語変更<3>,  Prev: 新しい機能<6>,  Up: What's New In Python 3 11

1.4.3 型ヒントに関連する新しい機能
----------------------------------

This section covers major changes affecting PEP 484(1) type hints and
the *note typing: 10a. module.

* Menu:

* PEP 646; Variadic generics: PEP 646 Variadic generics.
* PEP 655; Marking individual TypedDict items as required or not-required: PEP 655 Marking individual TypedDict items as required or not-required.
* PEP 673; Self 型: PEP 673 Self 型.
* PEP 675; Arbitrary literal string type: PEP 675 Arbitrary literal string type.
* PEP 681; Data class transforms: PEP 681 Data class transforms.
* PEP 563 may not be the future::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/


File: python.info,  Node: PEP 646 Variadic generics,  Next: PEP 655 Marking individual TypedDict items as required or not-required,  Up: 型ヒントに関連する新しい機能<2>

1.4.3.1 PEP 646: Variadic generics
..................................

PEP 484(1) previously introduced *note TypeVar: 486, enabling creation
of generics parameterised with a single type.  PEP 646(2) adds *note
TypeVarTuple: 488, enabling parameterisation with an 'arbitrary' number
of types.  In other words, a *note TypeVarTuple: 488. is a 'variadic'
type variable, enabling 'variadic' generics.

This enables a wide variety of use cases.  In particular, it allows the
type of array-like structures in numerical computing libraries such as
NumPy and TensorFlow to be parameterised with the array 'shape'.  Static
type checkers will now be able to catch shape-related bugs in code that
uses these libraries.

より詳しくは PEP 646(3) を参照してください。

(Contributed by Matthew Rahtz in bpo-43224(4), with contributions by
Serhiy Storchaka and Jelle Zijlstra.  PEP written by Mark Mendoza,
Matthew Rahtz, Pradeep Kumar Srinivasan, and Vincent Siles.)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/

   (2) https://peps.python.org/pep-0646/

   (3) https://peps.python.org/pep-0646/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43224


File: python.info,  Node: PEP 655 Marking individual TypedDict items as required or not-required,  Next: PEP 673 Self 型,  Prev: PEP 646 Variadic generics,  Up: 型ヒントに関連する新しい機能<2>

1.4.3.2 PEP 655: Marking individual ‘TypedDict’ items as required or not-required
.................................................................................

*note Required: 7e0. and *note NotRequired: 7e1. provide a
straightforward way to mark whether individual items in a *note
TypedDict: 332. must be present.  Previously, this was only possible
using inheritance.

All fields are still required by default, unless the 'total' parameter
is set to ‘False’, in which case all fields are still not-required by
default.  For example, the following specifies a ‘TypedDict’ with one
required and one not-required key:

     class Movie(TypedDict):
        title: str
        year: NotRequired[int]

     m1: Movie = {"title": "Black Panther", "year": 2018}  # OK
     m2: Movie = {"title": "Star Wars"}  # OK (year is not required)
     m3: Movie = {"year": 2022}  # ERROR (missing required field title)

The following definition is equivalent:

     class Movie(TypedDict, total=False):
        title: Required[str]
        year: int

より詳しくは PEP 655(1) を参照してください。

(Contributed by David Foster and Jelle Zijlstra in bpo-47087(2).  PEP
written by David Foster.)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0655/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=47087


File: python.info,  Node: PEP 673 Self 型,  Next: PEP 675 Arbitrary literal string type,  Prev: PEP 655 Marking individual TypedDict items as required or not-required,  Up: 型ヒントに関連する新しい機能<2>

1.4.3.3 PEP 673: ‘Self’ 型
..........................

The new *note Self: 7e3. annotation provides a simple and intuitive way
to annotate methods that return an instance of their class.  This
behaves the same as the *note TypeVar: 486.-based approach specified in
PEP 484(1), but is more concise and easier to follow.

Common use cases include alternative constructors provided as *note
classmethod: 48e.s, and *note __enter__(): 7e4. methods that return
‘self’:

     class MyLock:
         def __enter__(self) -> Self:
             self.lock()
             return self

         ...

     class MyInt:
         @classmethod
         def fromhex(cls, s: str) -> Self:
             return cls(int(s, 16))

         ...

*note Self: 7e3. can also be used to annotate method parameters or
attributes of the same type as their enclosing class.

より詳しくは PEP 673(2) を参照してください。

(Contributed by James Hilton-Balfe in bpo-46534(3).  PEP written by
Pradeep Kumar Srinivasan and James Hilton-Balfe.)

   ---------- Footnotes ----------

   (1) 
https://peps.python.org/pep-0484/#annotating-instance-and-class-methods

   (2) https://peps.python.org/pep-0673/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46534


File: python.info,  Node: PEP 675 Arbitrary literal string type,  Next: PEP 681 Data class transforms,  Prev: PEP 673 Self 型,  Up: 型ヒントに関連する新しい機能<2>

1.4.3.4 PEP 675: Arbitrary literal string type
..............................................

The new *note LiteralString: 7e6. annotation may be used to indicate
that a function parameter can be of any literal string type.  This
allows a function to accept arbitrary literal string types, as well as
strings created from other literal strings.  Type checkers can then
enforce that sensitive functions, such as those that execute SQL
statements or shell commands, are called only with static arguments,
providing protection against injection attacks.

For example, a SQL query function could be annotated as follows:

     def run_query(sql: LiteralString) -> ...
         ...

     def caller(
         arbitrary_string: str,
         query_string: LiteralString,
         table_name: LiteralString,
     ) -> None:
         run_query("SELECT * FROM students")       # ok
         run_query(query_string)                   # ok
         run_query("SELECT * FROM " + table_name)  # ok
         run_query(arbitrary_string)               # type checker error
         run_query(                                # type checker error
             f"SELECT * FROM students WHERE name = {arbitrary_string}"
         )

より詳しくは PEP 675(1) を参照してください。

(Contributed by Jelle Zijlstra in bpo-47088(2).  PEP written by Pradeep
Kumar Srinivasan and Graham Bleaney.)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0675/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=47088


File: python.info,  Node: PEP 681 Data class transforms,  Next: PEP 563 may not be the future,  Prev: PEP 675 Arbitrary literal string type,  Up: 型ヒントに関連する新しい機能<2>

1.4.3.5 PEP 681: Data class transforms
......................................

*note dataclass_transform: 6fb. may be used to decorate a class,
metaclass, or a function that is itself a decorator.  The presence of
‘@dataclass_transform()’ tells a static type checker that the decorated
object performs runtime "magic" that transforms a class, giving it *note
dataclass: 4e1.-like behaviors.

例えば:

     # The create_model decorator is defined by a library.
     @typing.dataclass_transform()
     def create_model(cls: Type[T]) -> Type[T]:
         cls.__init__ = ...
         cls.__eq__ = ...
         cls.__ne__ = ...
         return cls

     # The create_model decorator can now be used to create new model classes:
     @create_model
     class CustomerModel:
         id: int
         name: str

     c = CustomerModel(id=327, name="Eric Idle")

より詳しくは PEP 681(1) を参照してください。

(Contributed by Jelle Zijlstra in gh-91860(2).  PEP written by Erik De
Bonte and Eric Traut.)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0681/

   (2) https://github.com/python/cpython/issues/91860


File: python.info,  Node: PEP 563 may not be the future,  Prev: PEP 681 Data class transforms,  Up: 型ヒントに関連する新しい機能<2>

1.4.3.6 PEP 563 may not be the future
.....................................

PEP 563(1) Postponed Evaluation of Annotations (the ‘from __future__
import annotations’ *note future statement: 45d.) that was originally
planned for release in Python 3.10 has been put on hold indefinitely.
See this message from the Steering Council(2) for more information.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0563/

   (2) 
https://mail.python.org/archives/list/python-dev@python.org/message/VIZEBX5EYMSYIJNDBF6DMUMZOCWHARSO/


File: python.info,  Node: その他の言語変更<3>,  Next: その他の CPython の実装の変更,  Prev: 型ヒントに関連する新しい機能<2>,  Up: What's New In Python 3 11

1.4.4 その他の言語変更
----------------------

   * Starred unpacking expressions can now be used in *note for: 34a.
     statements.  (See bpo-46725(1) for more details.)

   * Asynchronous *note comprehensions: 7ec. are now allowed inside
     comprehensions in *note asynchronous functions: 7ed.  Outer
     comprehensions implicitly become asynchronous in this case.
     (Contributed by Serhiy Storchaka in bpo-33346(2).)

   * A *note TypeError: 198. is now raised instead of an *note
     AttributeError: 5f0. in *note with: 186. statements and *note
     contextlib.ExitStack.enter_context(): 7ee. for objects that do not
     support the *note context manager: 1e1. protocol, and in *note
     async with: 185. statements and *note
     contextlib.AsyncExitStack.enter_async_context(): 7ef. for objects
     not supporting the *note asynchronous context manager: 7f0.
     protocol.  (Contributed by Serhiy Storchaka in bpo-12022(3) and
     bpo-44471(4).)

   * Added *note object.__getstate__(): 7f1, which provides the default
     implementation of the ‘__getstate__()’ method.  *note copy: 29.ing
     and *note pickle: ab.ing instances of subclasses of builtin types
     *note bytearray: 344, *note set: 184, *note frozenset: 7f2, *note
     collections.OrderedDict: 7f3, *note collections.deque: 7f4, *note
     weakref.WeakSet: 7f5, and *note datetime.tzinfo: 7f6. now copies
     and pickles instance attributes implemented as *note slots: 7f7.
     This change has an unintended side effect: It trips up a small
     minority of existing Python projects not expecting *note
     object.__getstate__(): 7f1. to exist.  See the later comments on
     gh-70766(5) for discussions of what workarounds such code may need.
     (Contributed by Serhiy Storchaka in bpo-26579(6).)

   * Added a *note -P: 7c1. command line option and a *note
     PYTHONSAFEPATH: 7c2. environment variable, which disable the
     automatic prepending to *note sys.path: 3e4. of the script's
     directory when running a script, or the current directory when
     using *note -c: 1a8. and *note -m: 23c.  This ensures only stdlib
     and installed modules are picked up by *note import: 7f8, and
     avoids unintentionally or maliciously shadowing modules with those
     in a local (and typically user-writable) directory.  (Contributed
     by Victor Stinner in gh-57684(7).)

   * A ‘"z"’ option was added to the *note 書式指定ミニ言語仕様: 4f9.
     that coerces negative to positive zero after rounding to the format
     precision.  See PEP 682(8) for more details.  (Contributed by John
     Belmonte in gh-90153(9).)

   * Bytes are no longer accepted on *note sys.path: 3e4.  Support broke
     sometime between Python 3.2 and 3.6, with no one noticing until
     after Python 3.10.0 was released.  In addition, bringing back
     support would be problematic due to interactions between *note -b:
     7f9. and *note sys.path_importer_cache: 7fa. when there is a
     mixture of *note str: 169. and *note bytes: 192. keys.
     (Contributed by Thomas Grainger in gh-91181(10).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46725

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33346

   (3) https://bugs.python.org/issue?@action=redirect&bpo=12022

   (4) https://bugs.python.org/issue?@action=redirect&bpo=44471

   (5) https://github.com/python/cpython/issues/70766

   (6) https://bugs.python.org/issue?@action=redirect&bpo=26579

   (7) https://github.com/python/cpython/issues/57684

   (8) https://peps.python.org/pep-0682/

   (9) https://github.com/python/cpython/issues/90153

   (10) https://github.com/python/cpython/issues/91181


File: python.info,  Node: その他の CPython の実装の変更,  Next: 新たなモジュール<3>,  Prev: その他の言語変更<3>,  Up: What's New In Python 3 11

1.4.5 その他の CPython の実装の変更
-----------------------------------

   * The special methods *note __complex__(): 7fd. for *note complex:
     197. and *note __bytes__(): 7fe. for *note bytes: 192. are
     implemented to support the *note typing.SupportsComplex: 7ff. and
     *note typing.SupportsBytes: 800. protocols.  (Contributed by Mark
     Dickinson and Donghee Na in bpo-24234(1).)

   * ‘siphash13’ is added as a new internal hashing algorithm.  It has
     similar security properties as ‘siphash24’, but it is slightly
     faster for long inputs.  *note str: 169, *note bytes: 192, and some
     other types now use it as the default algorithm for *note hash():
     801.  PEP 552(2) *note hash-based .pyc files: 802. now use
     ‘siphash13’ too.  (Contributed by Inada Naoki in bpo-29410(3).)

   * When an active exception is re-raised by a *note raise: 803.
     statement with no parameters, the traceback attached to this
     exception is now always ‘sys.exc_info()[1].__traceback__’.  This
     means that changes made to the traceback in the current *note
     except: 1ab. clause are reflected in the re-raised exception.
     (Contributed by Irit Katriel in bpo-45711(4).)

   * The interpreter state's representation of handled exceptions (aka
     ‘exc_info’ or ‘_PyErr_StackItem’) now only has the ‘exc_value’
     field; ‘exc_type’ and ‘exc_traceback’ have been removed, as they
     can be derived from ‘exc_value’.  (Contributed by Irit Katriel in
     bpo-45711(5).)

   * A new *note command line option: 804, ‘AppendPath’, has been added
     for the Windows installer.  It behaves similarly to ‘PrependPath’,
     but appends the install and scripts directories instead of
     prepending them.  (Contributed by Bastian Neuburger in
     bpo-44934(6).)

   * The *note PyConfig.module_search_paths_set: 805. field must now be
     set to ‘1’ for initialization to use *note
     PyConfig.module_search_paths: 643. to initialize *note sys.path:
     3e4.  Otherwise, initialization will recalculate the path and
     replace any values added to ‘module_search_paths’.

   * The output of the *note -help: 806. option now fits in 50 lines/80
     columns.  Information about *note Python environment variables:
     807. and *note -X: 16f. options is now available using the
     respective *note -help-env: 808. and *note -help-xoptions: 809.
     flags, and with the new *note -help-all: 80a.  (Contributed by Éric
     Araujo in bpo-46142(7).)

   * Converting between *note int: 19b. and *note str: 169. in bases
     other than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such
     as base 10 (decimal) now raises a *note ValueError: 2ec. if the
     number of digits in string form is above a limit to avoid potential
     denial of service attacks due to the algorithmic complexity.  This
     is a mitigation for CVE 2020-10735(8).  This limit can be
     configured or disabled by environment variable, command line flag,
     or *note sys: df. APIs.  See the *note integer string conversion
     length limitation: 80b. documentation.  The default limit is 4300
     digits in string form.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24234

   (2) https://peps.python.org/pep-0552/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29410

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45711

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45711

   (6) https://bugs.python.org/issue?@action=redirect&bpo=44934

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46142

   (8) https://www.cve.org/CVERecord?id=CVE-2020-10735


File: python.info,  Node: 新たなモジュール<3>,  Next: 改良されたモジュール<3>,  Prev: その他の CPython の実装の変更,  Up: What's New In Python 3 11

1.4.6 新たなモジュール
----------------------

   * *note tomllib: 102.: For parsing TOML(1). See PEP 680(2) for more
     details.  (Contributed by Taneli Hukkinen in bpo-40059(3).)

   * *note wsgiref.types: 122.: WSGI(4)-specific types for static type
     checking.  (Contributed by Sebastian Rittau in bpo-42012(5).)

   ---------- Footnotes ----------

   (1) https://toml.io/

   (2) https://peps.python.org/pep-0680/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40059

   (4) https://peps.python.org/pep-3333/

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42012


File: python.info,  Node: 改良されたモジュール<3>,  Next: 最適化<4>,  Prev: 新たなモジュール<3>,  Up: What's New In Python 3 11

1.4.7 改良されたモジュール
--------------------------

* Menu:

* asyncio: asyncio<6>.
* contextlib::
* データクラス::
* datetime: datetime<2>.
* enum: enum<3>.
* fcntl::
* fractions: fractions<4>.
* functools: functools<2>.
* gzip: gzip<2>.
* hashlib: hashlib<2>.
* IDLE と idelelib::
* inspect: inspect<3>.
* locale: locale<3>.
* logging::
* math: math<4>.
* operator: operator<2>.
* os: os<4>.
* pathlib: pathlib<7>.
* re: re<4>.
* shutil: shutil<3>.
* socket: socket<2>.
* sqlite3: sqlite3<5>.
* string::
* sys: sys<4>.
* sysconfig: sysconfig<2>.
* tempfile: tempfile<3>.
* threading: threading<3>.
* time: time<2>.
* tkinter: tkinter<4>.
* traceback: traceback<2>.
* typing: typing<5>.
* unicodedata: unicodedata<4>.
* unittest: unittest<5>.
* venv: venv<2>.
* warnings: warnings<2>.
* zipfile: zipfile<2>.


File: python.info,  Node: asyncio<6>,  Next: contextlib,  Up: 改良されたモジュール<3>

1.4.7.1 asyncio
...............

   * Added the *note TaskGroup: 4d1. class, an *note asynchronous
     context manager: 812. holding a group of tasks that will wait for
     all of them upon exit.  For new code this is recommended over using
     *note create_task(): 1c9. and *note gather(): 813. directly.
     (Contributed by Yury Selivanov and others in gh-90908(1).)

   * Added *note timeout(): 814, an asynchronous context manager for
     setting a timeout on asynchronous operations.  For new code this is
     recommended over using *note wait_for(): 815. directly.
     (Contributed by Andrew Svetlov in gh-90927(2).)

   * Added the *note Runner: 2f5. class, which exposes the machinery
     used by *note run(): 2f3.  (Contributed by Andrew Svetlov in
     gh-91218(3).)

   * Added the *note Barrier: 816. class to the synchronization
     primitives in the asyncio library, and the related *note
     BrokenBarrierError: 817. exception.  (Contributed by Yves Duprat
     and Andrew Svetlov in gh-87518(4).)

   * Added keyword argument 'all_errors' to *note
     asyncio.loop.create_connection(): 818. so that multiple connection
     errors can be raised as an *note ExceptionGroup: 4d2.

   * Added the *note asyncio.StreamWriter.start_tls(): 819. method for
     upgrading existing stream-based connections to TLS. (Contributed by
     Ian Good in bpo-34975(5).)

   * Added raw datagram socket functions to the event loop: *note
     sock_sendto(): 81a, *note sock_recvfrom(): 81b. and *note
     sock_recvfrom_into(): 81c.  These have implementations in *note
     SelectorEventLoop: 314. and *note ProactorEventLoop: 81d.
     (Contributed by Alex Grönholm in bpo-46805(6).)

   * Added *note cancelling(): 4d5. and *note uncancel(): 4d6. methods
     to *note Task: 1c7.  These are primarily intended for internal use,
     notably by *note TaskGroup: 4d1.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/90908

   (2) https://github.com/python/cpython/issues/90927

   (3) https://github.com/python/cpython/issues/91218

   (4) https://github.com/python/cpython/issues/87518

   (5) https://bugs.python.org/issue?@action=redirect&bpo=34975

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46805


File: python.info,  Node: contextlib,  Next: データクラス,  Prev: asyncio<6>,  Up: 改良されたモジュール<3>

1.4.7.2 contextlib
..................

   * Added non parallel-safe *note chdir(): 820. context manager to
     change the current working directory and then restore it on exit.
     Simple wrapper around *note chdir(): 821.  (Contributed by Filipe
     Laíns in bpo-25625(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25625


File: python.info,  Node: データクラス,  Next: datetime<2>,  Prev: contextlib,  Up: 改良されたモジュール<3>

1.4.7.3 データクラス
....................

   * Change field default mutability check, allowing only defaults which
     are *note hashable: 824. instead of any object which is not an
     instance of *note dict: 183, *note list: 24d. or *note set: 184.
     (Contributed by Eric V. Smith in bpo-44674(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44674


File: python.info,  Node: datetime<2>,  Next: enum<3>,  Prev: データクラス,  Up: 改良されたモジュール<3>

1.4.7.4 datetime
................

   * Add *note datetime.UTC: 713, a convenience alias for *note
     datetime.timezone.utc: 827.  (Contributed by Kabir Kwatra in
     gh-91973(1).)

   * *note datetime.date.fromisoformat(): 828, *note
     datetime.time.fromisoformat(): 829. and *note
     datetime.datetime.fromisoformat(): 82a. can now be used to parse
     most ISO 8601 formats (barring only those that support fractional
     hours and minutes).  (Contributed by Paul Ganssle in gh-80010(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/91973

   (2) https://github.com/python/cpython/issues/80010


File: python.info,  Node: enum<3>,  Next: fcntl,  Prev: datetime<2>,  Up: 改良されたモジュール<3>

1.4.7.5 enum
............

   * Renamed ‘EnumMeta’ to *note EnumType: 4f7. (‘EnumMeta’ kept as an
     alias).

   * Added *note StrEnum: 82d, with members that can be used as (and
     must be) strings.

   * Added *note ReprEnum: 82e, which only modifies the *note
     __repr__(): 82f. of members while returning their literal values
     (rather than names) for *note __str__(): 830. and *note
     __format__(): 831. (used by *note str(): 169, *note format(): 199.
     and *note f-string: 66b.s).

   * Changed *note Enum.__format__(): 832. (the default for *note
     format(): 199, *note str.format(): 833. and *note f-string: 66b.s)
     to always produce the same result as *note Enum.__str__(): 834.:
     for enums inheriting from *note ReprEnum: 82e. it will be the
     member's value; for all other enums it will be the enum and member
     name (e.g.  ‘Color.RED’).

   * Added a new 'boundary' class parameter to *note Flag: 835. enums
     and the *note FlagBoundary: 836. enum with its options, to control
     how to handle out-of-range flag values.

   * Added the *note verify(): 837. enum decorator and the *note
     EnumCheck: 838. enum with its options, to check enum classes
     against several specific constraints.

   * Added the *note member(): 839. and *note nonmember(): 83a.
     decorators, to ensure the decorated object is/is not converted to
     an enum member.

   * Added the *note property(): 83b. decorator, which works like *note
     property(): 4b3. except for enums.  Use this instead of *note
     types.DynamicClassAttribute(): 83c.

   * Added the *note global_enum(): 83d. enum decorator, which adjusts
     *note __repr__(): 82f. and *note __str__(): 830. to show values as
     members of their module rather than the enum class.  For example,
     ‘'re.ASCII'’ for the *note ASCII: 83e. member of *note
     re.RegexFlag: 83f. rather than ‘'RegexFlag.ASCII'’.

   * Enhanced *note Flag: 835. to support *note len(): 840, iteration
     and *note in: 34b./*note not in: 841. on its members.  For example,
     the following now works: ‘len(AFlag(3)) == 2 and list(AFlag(3)) ==
     (AFlag.ONE, AFlag.TWO)’

   * Changed *note Enum: 842. and *note Flag: 835. so that members are
     now defined before *note __init_subclass__(): 843. is called; *note
     dir(): 844. now includes methods, etc., from mixed-in data types.

   * Changed *note Flag: 835. to only consider primary values (power of
     two) canonical while composite values (‘3’, ‘6’, ‘10’, etc.)  are
     considered aliases; inverted flags are coerced to their positive
     equivalent.


File: python.info,  Node: fcntl,  Next: fractions<4>,  Prev: enum<3>,  Up: 改良されたモジュール<3>

1.4.7.6 fcntl
.............

   * On FreeBSD, the ‘F_DUP2FD’ and ‘F_DUP2FD_CLOEXEC’ flags
     respectively are supported, the former equals to ‘dup2’ usage while
     the latter set the ‘FD_CLOEXEC’ flag in addition.


File: python.info,  Node: fractions<4>,  Next: functools<2>,  Prev: fcntl,  Up: 改良されたモジュール<3>

1.4.7.7 fractions
.................

   * Support PEP 515(1)-style initialization of *note Fraction: 213.
     from string.  (Contributed by Sergey B Kirpichev in bpo-44258(2).)

   * *note Fraction: 213. now implements an ‘__int__’ method, so that an
     ‘isinstance(some_fraction, typing.SupportsInt)’ check passes.
     (Contributed by Mark Dickinson in bpo-44547(3).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0515/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=44258

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44547


File: python.info,  Node: functools<2>,  Next: gzip<2>,  Prev: fractions<4>,  Up: 改良されたモジュール<3>

1.4.7.8 functools
.................

   * *note functools.singledispatch(): 84b. now supports *note
     types.UnionType: 2a7. and *note typing.Union: 2a8. as annotations
     to the dispatch argument.:

          >>> from functools import singledispatch
          >>> @singledispatch
          ... def fun(arg, verbose=False):
          ...     if verbose:
          ...         print("Let me just say,", end=" ")
          ...     print(arg)
          ...
          >>> @fun.register
          ... def _(arg: int | float, verbose=False):
          ...     if verbose:
          ...         print("Strength in numbers, eh?", end=" ")
          ...     print(arg)
          ...
          >>> from typing import Union
          >>> @fun.register
          ... def _(arg: Union[list, set], verbose=False):
          ...     if verbose:
          ...         print("Enumerate this:")
          ...     for i, elem in enumerate(arg):
          ...         print(i, elem)
          ...

     (Contributed by Yurii Karabas in bpo-46014(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46014


File: python.info,  Node: gzip<2>,  Next: hashlib<2>,  Prev: functools<2>,  Up: 改良されたモジュール<3>

1.4.7.9 gzip
............

   * The *note gzip.compress(): 84e. function is now faster when used
     with the 'mtime=0' argument as it delegates the compression
     entirely to a single *note zlib.compress(): 84f. operation.  There
     is one side effect of this change: The gzip file header contains an
     "OS" byte in its header.  That was traditionally always set to a
     value of 255 representing "unknown" by the *note gzip: 6b. module.
     Now, when using *note compress(): 84e. with 'mtime=0', it may be
     set to a different value by the underlying zlib C library Python
     was linked against.  (See gh-112346(1) for details on the side
     effect.)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/112346


File: python.info,  Node: hashlib<2>,  Next: IDLE と idelelib,  Prev: gzip<2>,  Up: 改良されたモジュール<3>

1.4.7.10 hashlib
................

   * *note hashlib.blake2b(): 852. and *note hashlib.blake2s(): 853. now
     prefer libb2(1) over Python's vendored copy.  (Contributed by
     Christian Heimes in bpo-47095(2).)

   * The internal ‘_sha3’ module with SHA3 and SHAKE algorithms now uses
     'tiny_sha3' instead of the 'Keccak Code Package' to reduce code and
     binary size.  The *note hashlib: 6c. module prefers optimized SHA3
     and SHAKE implementations from OpenSSL. The change affects only
     installations without OpenSSL support.  (Contributed by Christian
     Heimes in bpo-47098(3).)

   * Add *note hashlib.file_digest(): 854, a helper function for
     efficient hashing of files or file-like objects.  (Contributed by
     Christian Heimes in gh-89313(4).)

   ---------- Footnotes ----------

   (1) https://www.blake2.net/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=47095

   (3) https://bugs.python.org/issue?@action=redirect&bpo=47098

   (4) https://github.com/python/cpython/issues/89313


File: python.info,  Node: IDLE と idelelib,  Next: inspect<3>,  Prev: hashlib<2>,  Up: 改良されたモジュール<3>

1.4.7.11 IDLE と idelelib
.........................

   * Apply syntax highlighting to ‘.pyi’ files.  (Contributed by Alex
     Waygood and Terry Jan Reedy in bpo-45447(1).)

   * Include prompts when saving Shell with inputs and outputs.
     (Contributed by Terry Jan Reedy in gh-95191(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45447

   (2) https://github.com/python/cpython/issues/95191


File: python.info,  Node: inspect<3>,  Next: locale<3>,  Prev: IDLE と idelelib,  Up: 改良されたモジュール<3>

1.4.7.12 inspect
................

   * Add *note getmembers_static(): 859. to return all members without
     triggering dynamic lookup via the descriptor protocol.
     (Contributed by Weipeng Hong in bpo-30533(1).)

   * Add *note ismethodwrapper(): 85a. for checking if the type of an
     object is a *note MethodWrapperType: 85b.  (Contributed by Hakan
     Çelik in bpo-29418(2).)

   * Change the frame-related functions in the *note inspect: 82. module
     to return new *note FrameInfo: 85c. and *note Traceback: 85d. class
     instances (backwards compatible with the previous *note named
     tuple: 85e.-like interfaces) that includes the extended PEP 657(3)
     position information (end line number, column and end column).  The
     affected functions are:

        * *note inspect.getframeinfo(): 85f.

        * *note inspect.getouterframes(): 860.

        * *note inspect.getinnerframes(): 861,

        * *note inspect.stack(): 862.

        * *note inspect.trace(): 863.

     (Contributed by Pablo Galindo in gh-88116(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30533

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29418

   (3) https://peps.python.org/pep-0657/

   (4) https://github.com/python/cpython/issues/88116


File: python.info,  Node: locale<3>,  Next: logging,  Prev: inspect<3>,  Up: 改良されたモジュール<3>

1.4.7.13 locale
...............

   * Add *note locale.getencoding(): 329. to get the current locale
     encoding.  It is similar to ‘locale.getpreferredencoding(False)’
     but ignores the *note Python UTF-8 Mode: 866.


File: python.info,  Node: logging,  Next: math<4>,  Prev: locale<3>,  Up: 改良されたモジュール<3>

1.4.7.14 logging
................

   * Added *note getLevelNamesMapping(): 869. to return a mapping from
     logging level names (e.g.  ‘'CRITICAL'’) to the values of their
     corresponding *note ロギングレベル: 86a. (e.g.  ‘50’, by default).
     (Contributed by Andrei Kulakovin in gh-88024(1).)

   * Added a *note createSocket(): 86b. method to *note SysLogHandler:
     86c, to match *note SocketHandler.createSocket(): 86d.  It is
     called automatically during handler initialization and when
     emitting an event, if there is no active socket.  (Contributed by
     Kirill Pinchuk in gh-88457(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/88024

   (2) https://github.com/python/cpython/issues/88457


File: python.info,  Node: math<4>,  Next: operator<2>,  Prev: logging,  Up: 改良されたモジュール<3>

1.4.7.15 math
.............

   * Add *note math.exp2(): 870.: return 2 raised to the power of x.
     (Contributed by Gideon Mitchell in bpo-45917(1).)

   * Add *note math.cbrt(): 871.: return the cube root of x.
     (Contributed by Ajith Ramachandran in bpo-44357(2).)

   * The behaviour of two *note math.pow(): 872. corner cases was
     changed, for consistency with the IEEE 754 specification.  The
     operations ‘math.pow(0.0, -math.inf)’ and ‘math.pow(-0.0,
     -math.inf)’ now return ‘inf’.  Previously they raised *note
     ValueError: 2ec.  (Contributed by Mark Dickinson in bpo-44339(3).)

   * The *note math.nan: 873. value is now always available.
     (Contributed by Victor Stinner in bpo-46917(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45917

   (2) https://bugs.python.org/issue?@action=redirect&bpo=44357

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44339

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46917


File: python.info,  Node: operator<2>,  Next: os<4>,  Prev: math<4>,  Up: 改良されたモジュール<3>

1.4.7.16 operator
.................

   * A new function ‘operator.call’ has been added, such that
     ‘operator.call(obj, *args, **kwargs) == obj(*args, **kwargs)’.
     (Contributed by Antony Lee in bpo-44019(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44019


File: python.info,  Node: os<4>,  Next: pathlib<7>,  Prev: operator<2>,  Up: 改良されたモジュール<3>

1.4.7.17 os
...........

   * On Windows, *note os.urandom(): 746. now uses ‘BCryptGenRandom()’,
     instead of ‘CryptGenRandom()’ which is deprecated.  (Contributed by
     Donghee Na in bpo-44611(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44611


File: python.info,  Node: pathlib<7>,  Next: re<4>,  Prev: os<4>,  Up: 改良されたモジュール<3>

1.4.7.18 pathlib
................

   * *note glob(): 537. and *note rglob(): 538. return only directories
     if 'pattern' ends with a pathname components separator: *note sep:
     87a. or *note altsep: 87b.  (Contributed by Eisuke Kawasima in
     bpo-22276(1) and bpo-33392(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22276

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33392


File: python.info,  Node: re<4>,  Next: shutil<3>,  Prev: pathlib<7>,  Up: 改良されたモジュール<3>

1.4.7.19 re
...........

   * Atomic grouping (‘(?>...)’) and possessive quantifiers (‘*+’, ‘++’,
     ‘?+’, ‘{m,n}+’) are now supported in regular expressions.
     (Contributed by Jeffrey C. Jacobs and Serhiy Storchaka in
     bpo-433030(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=433030


File: python.info,  Node: shutil<3>,  Next: socket<2>,  Prev: re<4>,  Up: 改良されたモジュール<3>

1.4.7.20 shutil
...............

   * Add optional parameter 'dir_fd' in *note shutil.rmtree(): 356.
     (Contributed by Serhiy Storchaka in bpo-46245(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46245


File: python.info,  Node: socket<2>,  Next: sqlite3<5>,  Prev: shutil<3>,  Up: 改良されたモジュール<3>

1.4.7.21 socket
...............

   * Add CAN Socket support for NetBSD. (Contributed by Thomas Klausner
     in bpo-30512(1).)

   * *note create_connection(): 882. has an option to raise, in case of
     failure to connect, an *note ExceptionGroup: 4d2. containing all
     errors instead of only raising the last error.  (Contributed by
     Irit Katriel in bpo-29980(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30512

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29980


File: python.info,  Node: sqlite3<5>,  Next: string,  Prev: socket<2>,  Up: 改良されたモジュール<3>

1.4.7.22 sqlite3
................

   * You can now disable the authorizer by passing *note None: 885. to
     *note set_authorizer(): 5a9.  (Contributed by Erlend E. Aasland in
     bpo-44491(1).)

   * Collation name *note create_collation(): 886. can now contain any
     Unicode character.  Collation names with invalid characters now
     raise *note UnicodeEncodeError: 887. instead of *note
     sqlite3.ProgrammingError: 305.  (Contributed by Erlend E. Aasland
     in bpo-44688(2).)

   * *note sqlite3: d4. exceptions now include the SQLite extended error
     code as *note sqlite_errorcode: 888. and the SQLite error name as
     *note sqlite_errorname: 889.  (Contributed by Aviv Palivoda, Daniel
     Shahaf, and Erlend E. Aasland in bpo-16379(3) and bpo-24139(4).)

   * Add *note setlimit(): 88a. and *note getlimit(): 88b. to *note
     sqlite3.Connection: 54d. for setting and getting SQLite limits by
     connection basis.  (Contributed by Erlend E. Aasland in
     bpo-45243(5).)

   * *note sqlite3: d4. now sets *note sqlite3.threadsafety: 88c. based
     on the default threading mode the underlying SQLite library has
     been compiled with.  (Contributed by Erlend E. Aasland in
     bpo-45613(6).)

   * *note sqlite3: d4. C callbacks now use unraisable exceptions if
     callback tracebacks are enabled.  Users can now register an *note
     unraisable hook handler: 507. to improve their debug experience.
     (Contributed by Erlend E. Aasland in bpo-45828(7).)

   * Fetch across rollback no longer raises *note InterfaceError: 88d.
     Instead we leave it to the SQLite library to handle these cases.
     (Contributed by Erlend E. Aasland in bpo-44092(8).)

   * Add *note serialize(): 88e. and *note deserialize(): 88f. to *note
     sqlite3.Connection: 54d. for serializing and deserializing
     databases.  (Contributed by Erlend E. Aasland in bpo-41930(9).)

   * Add *note create_window_function(): 890. to *note
     sqlite3.Connection: 54d. for creating aggregate window functions.
     (Contributed by Erlend E. Aasland in bpo-34916(10).)

   * Add *note blobopen(): 891. to *note sqlite3.Connection: 54d.  *note
     sqlite3.Blob: 892. allows incremental I/O operations on blobs.
     (Contributed by Aviv Palivoda and Erlend E. Aasland in
     bpo-24905(11).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44491

   (2) https://bugs.python.org/issue?@action=redirect&bpo=44688

   (3) https://bugs.python.org/issue?@action=redirect&bpo=16379

   (4) https://bugs.python.org/issue?@action=redirect&bpo=24139

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45243

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45613

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45828

   (8) https://bugs.python.org/issue?@action=redirect&bpo=44092

   (9) https://bugs.python.org/issue?@action=redirect&bpo=41930

   (10) https://bugs.python.org/issue?@action=redirect&bpo=34916

   (11) https://bugs.python.org/issue?@action=redirect&bpo=24905


File: python.info,  Node: string,  Next: sys<4>,  Prev: sqlite3<5>,  Up: 改良されたモジュール<3>

1.4.7.23 string
...............

   * Add *note get_identifiers(): 895. and *note is_valid(): 896. to
     *note string.Template: 897, which respectively return all valid
     placeholders, and whether any invalid placeholders are present.
     (Contributed by Ben Kehoe in gh-90465(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/90465


File: python.info,  Node: sys<4>,  Next: sysconfig<2>,  Prev: string,  Up: 改良されたモジュール<3>

1.4.7.24 sys
............

   * *note sys.exc_info(): 89a. now derives the ‘type’ and ‘traceback’
     fields from the ‘value’ (the exception instance), so when an
     exception is modified while it is being handled, the changes are
     reflected in the results of subsequent calls to ‘exc_info()’.
     (Contributed by Irit Katriel in bpo-45711(1).)

   * Add *note sys.exception(): 89b. which returns the active exception
     instance (equivalent to ‘sys.exc_info()[1]’).  (Contributed by Irit
     Katriel in bpo-46328(2).)

   * Add the *note sys.flags.safe_path: 89c. flag.  (Contributed by
     Victor Stinner in gh-57684(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45711

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46328

   (3) https://github.com/python/cpython/issues/57684


File: python.info,  Node: sysconfig<2>,  Next: tempfile<3>,  Prev: sys<4>,  Up: 改良されたモジュール<3>

1.4.7.25 sysconfig
..................

   * Three new *note installation schemes: 449. ('posix_venv', 'nt_venv'
     and 'venv') were added and are used when Python creates new virtual
     environments or when it is running from a virtual environment.  The
     first two schemes ('posix_venv' and 'nt_venv') are OS-specific for
     non-Windows and Windows, the 'venv' is essentially an alias to one
     of them according to the OS Python runs on.  This is useful for
     downstream distributors who modify *note
     sysconfig.get_preferred_scheme(): 89f.  Third party code that
     creates new virtual environments should use the new 'venv'
     installation scheme to determine the paths, as does *note venv:
     117.  (Contributed by Miro Hrončok in bpo-45413(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45413


File: python.info,  Node: tempfile<3>,  Next: threading<3>,  Prev: sysconfig<2>,  Up: 改良されたモジュール<3>

1.4.7.26 tempfile
.................

   * *note SpooledTemporaryFile: 8a2. objects now fully implement the
     methods of *note io.BufferedIOBase: 8a3. or *note io.TextIOBase:
     8a4. (depending on file mode).  This lets them work correctly with
     APIs that expect file-like objects, such as compression modules.
     (Contributed by Carey Metcalfe in gh-70363(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/70363


File: python.info,  Node: threading<3>,  Next: time<2>,  Prev: tempfile<3>,  Up: 改良されたモジュール<3>

1.4.7.27 threading
..................

   * On Unix, if the ‘sem_clockwait()’ function is available in the C
     library (glibc 2.30 and newer), the *note threading.Lock.acquire():
     8a7. method now uses the monotonic clock (*note
     time.CLOCK_MONOTONIC: 8a8.) for the timeout, rather than using the
     system clock (*note time.CLOCK_REALTIME: 8a9.), to not be affected
     by system clock changes.  (Contributed by Victor Stinner in
     bpo-41710(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41710


File: python.info,  Node: time<2>,  Next: tkinter<4>,  Prev: threading<3>,  Up: 改良されたモジュール<3>

1.4.7.28 time
.............

   * On Unix, *note time.sleep(): 8ac. now uses the ‘clock_nanosleep()’
     or ‘nanosleep()’ function, if available, which has a resolution of
     1 nanosecond (10^-9 seconds), rather than using ‘select()’ which
     has a resolution of 1 microsecond (10^-6 seconds).  (Contributed by
     Benjamin Szőke and Victor Stinner in bpo-21302(1).)

   * On Windows 8.1 and newer, *note time.sleep(): 8ac. now uses a
     waitable timer based on high-resolution timers(2) which has a
     resolution of 100 nanoseconds (10^-7 seconds).  Previously, it had
     a resolution of 1 millisecond (10^-3 seconds).  (Contributed by
     Benjamin Szőke, Donghee Na, Eryk Sun and Victor Stinner in
     bpo-21302(3) and bpo-45429(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21302

   (2) 
https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/high-resolution-timers

   (3) https://bugs.python.org/issue?@action=redirect&bpo=21302

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45429


File: python.info,  Node: tkinter<4>,  Next: traceback<2>,  Prev: time<2>,  Up: 改良されたモジュール<3>

1.4.7.29 tkinter
................

   * Added method ‘info_patchlevel()’ which returns the exact version of
     the Tcl library as a named tuple similar to *note sys.version_info:
     8af.  (Contributed by Serhiy Storchaka in gh-91827(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/91827


File: python.info,  Node: traceback<2>,  Next: typing<5>,  Prev: tkinter<4>,  Up: 改良されたモジュール<3>

1.4.7.30 traceback
..................

   * Add *note traceback.StackSummary.format_frame_summary(): 8b2. to
     allow users to override which frames appear in the traceback, and
     how they are formatted.  (Contributed by Ammar Askar in
     bpo-44569(1).)

   * Add *note traceback.TracebackException.print(): 8b3, which prints
     the formatted *note TracebackException: 563. instance to a file.
     (Contributed by Irit Katriel in bpo-33809(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44569

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33809


File: python.info,  Node: typing<5>,  Next: unicodedata<4>,  Prev: traceback<2>,  Up: 改良されたモジュール<3>

1.4.7.31 typing
...............

For major changes, see *note 型ヒントに関連する新しい機能: 7db.

   * Add *note typing.assert_never(): 8b6. and *note typing.Never: 8b7.
     *note typing.assert_never(): 8b6. is useful for asking a type
     checker to confirm that a line of code is not reachable.  At
     runtime, it raises an *note AssertionError: 8b8.  (Contributed by
     Jelle Zijlstra in gh-90633(1).)

   * Add *note typing.reveal_type(): 8b9.  This is useful for asking a
     type checker what type it has inferred for a given expression.  At
     runtime it prints the type of the received value.  (Contributed by
     Jelle Zijlstra in gh-90572(2).)

   * Add *note typing.assert_type(): 8ba.  This is useful for asking a
     type checker to confirm that the type it has inferred for a given
     expression matches the given type.  At runtime it simply returns
     the received value.  (Contributed by Jelle Zijlstra in
     gh-90638(3).)

   * *note typing.TypedDict: 332. types can now be generic.
     (Contributed by Samodya Abeysiriwardane in gh-89026(4).)

   * *note NamedTuple: 331. types can now be generic.  (Contributed by
     Serhiy Storchaka in bpo-43923(5).)

   * Allow subclassing of *note typing.Any: 8bb.  This is useful for
     avoiding type checker errors related to highly dynamic class, such
     as mocks.  (Contributed by Shantanu Jain in gh-91154(6).)

   * The *note typing.final(): 8bc. decorator now sets the ‘__final__’
     attributed on the decorated object.  (Contributed by Jelle Zijlstra
     in gh-90500(7).)

   * The *note typing.get_overloads(): 8bd. function can be used for
     introspecting the overloads of a function.  *note
     typing.clear_overloads(): 8be. can be used to clear all registered
     overloads of a function.  (Contributed by Jelle Zijlstra in
     gh-89263(8).)

   * The *note __init__(): 8bf. method of *note Protocol: 56b.
     subclasses is now preserved.  (Contributed by Adrian Garcia
     Badarasco in gh-88970(9).)

   * The representation of empty tuple types (‘Tuple[()]’) is
     simplified.  This affects introspection, e.g.
     ‘get_args(Tuple[()])’ now evaluates to ‘()’ instead of ‘((),)’.
     (Contributed by Serhiy Storchaka in gh-91137(10).)

   * Loosen runtime requirements for type annotations by removing the
     callable check in the private ‘typing._type_check’ function.
     (Contributed by Gregory Beauregard in gh-90802(11).)

   * *note typing.get_type_hints(): 8c0. now supports evaluating strings
     as forward references in *note PEP 585 generic aliases: 8c1.
     (Contributed by Niklas Rosenstein in gh-85542(12).)

   * *note typing.get_type_hints(): 8c0. no longer adds *note Optional:
     8c2. to parameters with ‘None’ as a default.  (Contributed by
     Nikita Sobolev in gh-90353(13).)

   * *note typing.get_type_hints(): 8c0. now supports evaluating bare
     stringified *note ClassVar: 56d. annotations.  (Contributed by
     Gregory Beauregard in gh-90711(14).)

   * *note typing.no_type_check(): 8c3. no longer modifies external
     classes and functions.  It also now correctly marks classmethods as
     not to be type checked.  (Contributed by Nikita Sobolev in
     gh-90729(15).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/90633

   (2) https://github.com/python/cpython/issues/90572

   (3) https://github.com/python/cpython/issues/90638

   (4) https://github.com/python/cpython/issues/89026

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43923

   (6) https://github.com/python/cpython/issues/91154

   (7) https://github.com/python/cpython/issues/90500

   (8) https://github.com/python/cpython/issues/89263

   (9) https://github.com/python/cpython/issues/88970

   (10) https://github.com/python/cpython/issues/91137

   (11) https://github.com/python/cpython/issues/90802

   (12) https://github.com/python/cpython/issues/85542

   (13) https://github.com/python/cpython/issues/90353

   (14) https://github.com/python/cpython/issues/90711

   (15) https://github.com/python/cpython/issues/90729


File: python.info,  Node: unicodedata<4>,  Next: unittest<5>,  Prev: typing<5>,  Up: 改良されたモジュール<3>

1.4.7.32 unicodedata
....................

   * The Unicode database has been updated to version 14.0.0.
     (Contributed by Benjamin Peterson in bpo-45190(1)).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45190


File: python.info,  Node: unittest<5>,  Next: venv<2>,  Prev: unicodedata<4>,  Up: 改良されたモジュール<3>

1.4.7.33 unittest
.................

   * Added methods *note enterContext(): 8c8. and *note
     enterClassContext(): 8c9. of class *note TestCase: 2b3, method
     *note enterAsyncContext(): 8ca. of class *note
     IsolatedAsyncioTestCase: 361. and function *note
     unittest.enterModuleContext(): 8cb.  (Contributed by Serhiy
     Storchaka in bpo-45046(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45046


File: python.info,  Node: venv<2>,  Next: warnings<2>,  Prev: unittest<5>,  Up: 改良されたモジュール<3>

1.4.7.34 venv
.............

   * When new Python virtual environments are created, the 'venv' *note
     sysconfig installation scheme: 449. is used to determine the paths
     inside the environment.  When Python runs in a virtual environment,
     the same installation scheme is the default.  That means that
     downstream distributors can change the default sysconfig install
     scheme without changing behavior of virtual environments.  Third
     party code that also creates new virtual environments should do the
     same.  (Contributed by Miro Hrončok in bpo-45413(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45413


File: python.info,  Node: warnings<2>,  Next: zipfile<2>,  Prev: venv<2>,  Up: 改良されたモジュール<3>

1.4.7.35 warnings
.................

   * *note warnings.catch_warnings(): 179. now accepts arguments for
     *note warnings.simplefilter(): 8d0, providing a more concise way to
     locally ignore warnings or convert them to errors.  (Contributed by
     Zac Hatfield-Dodds in bpo-47074(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=47074


File: python.info,  Node: zipfile<2>,  Prev: warnings<2>,  Up: 改良されたモジュール<3>

1.4.7.36 zipfile
................

   * Added support for specifying member name encoding for reading
     metadata in a *note ZipFile: 8d3.'s directory and file headers.
     (Contributed by Stephen J. Turnbull and Serhiy Storchaka in
     bpo-28080(1).)

   * Added *note ZipFile.mkdir(): 8d4. for creating new directories
     inside ZIP archives.  (Contributed by Sam Ezeh in gh-49083(2).)

   * Added *note stem: 8d5, *note suffix: 8d6. and *note suffixes: 8d7.
     to *note zipfile.Path: 8d8.  (Contributed by Miguel Brito in
     gh-88261(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28080

   (2) https://github.com/python/cpython/issues/49083

   (3) https://github.com/python/cpython/issues/88261


File: python.info,  Node: 最適化<4>,  Next: Faster CPython,  Prev: 改良されたモジュール<3>,  Up: What's New In Python 3 11

1.4.8 最適化
------------

This section covers specific optimizations independent of the *note
Faster CPython: 7bd. project, which is covered in its own section.

   * The compiler now optimizes simple *note printf-style % formatting:
     8db. on string literals containing only the format codes ‘%s’, ‘%r’
     and ‘%a’ and makes it as fast as a corresponding *note f-string:
     66b. expression.  (Contributed by Serhiy Storchaka in
     bpo-28307(1).)

   * Integer division (‘//’) is better tuned for optimization by
     compilers.  It is now around 20% faster on x86-64 when dividing an
     *note int: 19b. by a value smaller than ‘2**30’.  (Contributed by
     Gregory P. Smith and Tim Peters in gh-90564(2).)

   * *note sum(): 695. is now nearly 30% faster for integers smaller
     than ‘2**30’.  (Contributed by Stefan Behnel in gh-68264(3).)

   * Resizing lists is streamlined for the common case, speeding up
     *note list.append(): 8dc. by ≈15% and simple *note list
     comprehension: 8dd.s by up to 20-30% (Contributed by Dennis Sweeney
     in gh-91165(4).)

   * Dictionaries don't store hash values when all keys are Unicode
     objects, decreasing *note dict: 183. size.  For example,
     ‘sys.getsizeof(dict.fromkeys("abcdefg"))’ is reduced from 352 bytes
     to 272 bytes (23% smaller) on 64-bit platforms.  (Contributed by
     Inada Naoki in bpo-46845(5).)

   * Using *note asyncio.DatagramProtocol: 8de. is now orders of
     magnitude faster when transferring large files over UDP, with
     speeds over 100 times higher for a ≈60 MiB file.  (Contributed by
     msoxzw in gh-91487(6).)

   * *note math: 92. functions *note comb(): 8df. and *note perm(): 8e0.
     are now ≈10 times faster for large arguments (with a larger speedup
     for larger 'k').  (Contributed by Serhiy Storchaka in
     bpo-37295(7).)

   * The *note statistics: d7. functions *note mean(): 8e1, *note
     variance(): 8e2. and *note stdev(): 8e3. now consume iterators in
     one pass rather than converting them to a *note list: 24d. first.
     This is twice as fast and can save substantial memory.
     (Contributed by Raymond Hettinger in gh-90415(8).)

   * *note unicodedata.normalize(): 8e4. now normalizes pure-ASCII
     strings in constant time.  (Contributed by Donghee Na in
     bpo-44987(9).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28307

   (2) https://github.com/python/cpython/issues/90564

   (3) https://github.com/python/cpython/issues/68264

   (4) https://github.com/python/cpython/issues/91165

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46845

   (6) https://github.com/python/cpython/issues/91487

   (7) https://bugs.python.org/issue?@action=redirect&bpo=37295

   (8) https://github.com/python/cpython/issues/90415

   (9) https://bugs.python.org/issue?@action=redirect&bpo=44987


File: python.info,  Node: Faster CPython,  Next: CPython バイトコードの変更<3>,  Prev: 最適化<4>,  Up: What's New In Python 3 11

1.4.9 Faster CPython
--------------------

CPython 3.11 is an average of 25% faster(1) than CPython 3.10 as
measured with the pyperformance(2) benchmark suite, when compiled with
GCC on Ubuntu Linux.  Depending on your workload, the overall speedup
could be 10-60%.

This project focuses on two major areas in Python: *note Faster Startup:
8e6. and *note Faster Runtime: 8e7.  Optimizations not covered by this
project are listed separately under *note 最適化: 8da.

* Menu:

* Faster Startup::
* Faster Runtime::
* Misc::
* FAQ::
* About::

   ---------- Footnotes ----------

   (1) https://github.com/faster-cpython/ideas#published-results

   (2) https://github.com/python/pyperformance


File: python.info,  Node: Faster Startup,  Next: Faster Runtime,  Up: Faster CPython

1.4.9.1 Faster Startup
......................

* Menu:

* Frozen imports / Static code objects::


File: python.info,  Node: Frozen imports / Static code objects,  Up: Faster Startup

1.4.9.2 Frozen imports / Static code objects
............................................

Python caches *note bytecode: 4aa. in the *note __pycache__: 8eb.
directory to speed up module loading.

Previously in 3.10, Python module execution looked like this:

     Read __pycache__ -> Unmarshal -> Heap allocated code object -> Evaluate

In Python 3.11, the core modules essential for Python startup are
"frozen".  This means that their *note コードオブジェクト: 7d2. (and
bytecode) are statically allocated by the interpreter.  This reduces the
steps in module execution process to:

     Statically allocated code object -> Evaluate

Interpreter startup is now 10-15% faster in Python 3.11.  This has a big
impact for short-running programs using Python.

(Contributed by Eric Snow, Guido van Rossum and Kumar Aditya in many
issues.)


File: python.info,  Node: Faster Runtime,  Next: Misc,  Prev: Faster Startup,  Up: Faster CPython

1.4.9.3 Faster Runtime
......................

* Menu:

* Cheaper, lazy Python frames: Cheaper lazy Python frames.
* Inlined Python function calls::
* PEP 659; Specializing Adaptive Interpreter: PEP 659 Specializing Adaptive Interpreter.


File: python.info,  Node: Cheaper lazy Python frames,  Next: Inlined Python function calls,  Up: Faster Runtime

1.4.9.4 Cheaper, lazy Python frames
...................................

Python frames, holding execution information, are created whenever
Python calls a Python function.  The following are new frame
optimizations:

   - Streamlined the frame creation process.

   - Avoided memory allocation by generously re-using frame space on the
     C stack.

   - Streamlined the internal frame struct to contain only essential
     information.  Frames previously held extra debugging and memory
     management information.

Old-style *note frame objects: 8ef. are now created only when requested
by debuggers or by Python introspection functions such as *note
sys._getframe(): 8f0. and *note inspect.currentframe(): 8f1.  For most
user code, no frame objects are created at all.  As a result, nearly all
Python functions calls have sped up significantly.  We measured a 3-7%
speedup in pyperformance.

(Contributed by Mark Shannon in bpo-44590(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44590


File: python.info,  Node: Inlined Python function calls,  Next: PEP 659 Specializing Adaptive Interpreter,  Prev: Cheaper lazy Python frames,  Up: Faster Runtime

1.4.9.5 Inlined Python function calls
.....................................

During a Python function call, Python will call an evaluating C function
to interpret that function's code.  This effectively limits pure Python
recursion to what's safe for the C stack.

In 3.11, when CPython detects Python code calling another Python
function, it sets up a new frame, and "jumps" to the new code inside the
new frame.  This avoids calling the C interpreting function altogether.

Most Python function calls now consume no C stack space, speeding them
up.  In simple recursive functions like fibonacci or factorial, we
observed a 1.7x speedup.  This also means recursive functions can
recurse significantly deeper (if the user increases the recursion limit
with *note sys.setrecursionlimit(): 6ea.).  We measured a 1-3%
improvement in pyperformance.

(Contributed by Pablo Galindo and Mark Shannon in bpo-45256(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45256


File: python.info,  Node: PEP 659 Specializing Adaptive Interpreter,  Prev: Inlined Python function calls,  Up: Faster Runtime

1.4.9.6 PEP 659: Specializing Adaptive Interpreter
..................................................

PEP 659(1) is one of the key parts of the Faster CPython project.  The
general idea is that while Python is a dynamic language, most code has
regions where objects and types rarely change.  This concept is known as
'type stability'.

At runtime, Python will try to look for common patterns and type
stability in the executing code.  Python will then replace the current
operation with a more specialized one.  This specialized operation uses
fast paths available only to those use cases/types, which generally
outperform their generic counterparts.  This also brings in another
concept called 'inline caching', where Python caches the results of
expensive operations directly in the *note bytecode: 4aa.

The specializer will also combine certain common instruction pairs into
one superinstruction, reducing the overhead during execution.

Python will only specialize when it sees code that is "hot" (executed
multiple times).  This prevents Python from wasting time on run-once
code.  Python can also de-specialize when code is too dynamic or when
the use changes.  Specialization is attempted periodically, and
specialization attempts are not too expensive, allowing specialization
to adapt to new circumstances.

(PEP written by Mark Shannon, with ideas inspired by Stefan Brunthaler.
See PEP 659(2) for more information.  Implementation by Mark Shannon and
Brandt Bucher, with additional help from Irit Katriel and Dennis
Sweeney.)

演算                形式                     Specialization                                              Operation speedup (up   Contributor(s)
                                                                                                         to)                     
                                                                                                         
---------------------------------------------------------------------------------------------------------------------------------------------------------
                                                                                                                                 
Binary operations   ‘x + x’                  Binary add, multiply and subtract for common types such     10%                     Mark Shannon, Donghee
                                             as *note int: 19b, *note float: 196. and *note str: 169.                            Na, Brandt Bucher,
                    ‘x - x’                  take custom fast paths for their underlying types.                                  Dennis Sweeney
                                                                                                                                 
                    ‘x * x’
                    
                                                                                                                                 
Subscript           ‘a[i]’                   Subscripting container types such as *note list: 24d,       10-25%                  Irit Katriel, Mark
                                             *note tuple: 614. and *note dict: 183. directly index the                           Shannon
                                             underlying data structures.                                                         
                                             
                                             Subscripting custom *note __getitem__(): 588. is also
                                             inlined similar to
                                             *note Inlined Python function calls: 8f2.
                                             
                                                                                                                                 
Store subscript     ‘a[i] = z’               Similar to subscripting specialization above.               10-25%                  Dennis Sweeney
                                                                                                                                 
                                                                                                                                 
呼び出し (call)     ‘f(arg)’                 Calls to common builtin (C) functions and types such as     20%                     Mark Shannon, Ken Jin
                                             *note len(): 840. and *note str: 169. directly call their                           
                    ‘C(arg)’                 underlying C version.  This avoids going through the
                                             internal calling convention.
                                             
                                                                                                                                 
Load global         ‘print’                  The object's index in the globals/builtins namespace is     (3)                     Mark Shannon
variable                                     cached.  Loading globals and builtins require zero                                  
                    ‘len’                    namespace lookups.
                                             
                                                                                                                                 
Load attribute      ‘o.attr’                 Similar to loading global variables.  The attribute's       (4)                     Mark Shannon
                                             index inside the class/object's namespace is cached.  In                            
                                             most cases, attribute loading will require zero namespace
                                             lookups.
                                             
                                                                                                                                 
Load methods for    ‘o.meth()’               The actual address of the method is cached.  Method         10-20%                  Ken Jin, Mark Shannon
call                                         loading now has no namespace lookups - even for classes                             
                                             with long inheritance chains.
                                             
                                                                                                                                 
Store attribute     ‘o.attr = z’             Similar to load attribute optimization.                     2% in pyperformance     Mark Shannon
                                                                                                                                 
                                                                                                                                 
Unpack Sequence     ‘*seq’                   Specialized for common containers such as                   8%                      Brandt Bucher
                                             *note list: 24d. and *note tuple: 614.  Avoids internal                             
                                             calling convention.
                                             

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0659/

   (2) https://peps.python.org/pep-0659/

   (3) A similar optimization already existed since Python 3.8.  3.11
specializes for more forms and reduces some overhead.

   (4) A similar optimization already existed since Python 3.10.  3.11
specializes for more forms.  Furthermore, all attribute loads should be
sped up by bpo-45947
(https://bugs.python.org/issue?@action=redirect&bpo=45947).


File: python.info,  Node: Misc,  Next: FAQ,  Prev: Faster Runtime,  Up: Faster CPython

1.4.9.7 Misc
............

   * Objects now require less memory due to lazily created object
     namespaces.  Their namespace dictionaries now also share keys more
     freely.  (Contributed Mark Shannon in bpo-45340(1) and
     bpo-40116(2).)

   * "Zero-cost" exceptions are implemented, eliminating the cost of
     *note try: 8f8. statements when no exception is raised.
     (Contributed by Mark Shannon in bpo-40222(3).)

   * A more concise representation of exceptions in the interpreter
     reduced the time required for catching an exception by about 10%.
     (Contributed by Irit Katriel in bpo-45711(4).)

   * *note re: be.'s regular expression matching engine has been
     partially refactored, and now uses computed gotos (or "threaded
     code") on supported platforms.  As a result, Python 3.11 executes
     the pyperformance regular expression benchmarks(5) up to 10% faster
     than Python 3.10.  (Contributed by Brandt Bucher in gh-91404(6).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45340

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40116

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40222

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45711

   (5) https://pyperformance.readthedocs.io/benchmarks.html#regex-dna

   (6) https://github.com/python/cpython/issues/91404


File: python.info,  Node: FAQ,  Next: About,  Prev: Misc,  Up: Faster CPython

1.4.9.8 FAQ
...........

* Menu:

* How should I write my code to utilize these speedups?::
* Will CPython 3.11 use more memory?: Will CPython 3 11 use more memory?.
* I don't see any speedups in my workload. Why?: I don't see any speedups in my workload Why?.
* Is there a JIT compiler?::


File: python.info,  Node: How should I write my code to utilize these speedups?,  Next: Will CPython 3 11 use more memory?,  Up: FAQ

1.4.9.9 How should I write my code to utilize these speedups?
.............................................................

Write Pythonic code that follows common best practices; you don't have
to change your code.  The Faster CPython project optimizes for common
code patterns we observe.


File: python.info,  Node: Will CPython 3 11 use more memory?,  Next: I don't see any speedups in my workload Why?,  Prev: How should I write my code to utilize these speedups?,  Up: FAQ

1.4.9.10 Will CPython 3.11 use more memory?
...........................................

Maybe not; we don't expect memory use to exceed 20% higher than 3.10.
This is offset by memory optimizations for frame objects and object
dictionaries as mentioned above.


File: python.info,  Node: I don't see any speedups in my workload Why?,  Next: Is there a JIT compiler?,  Prev: Will CPython 3 11 use more memory?,  Up: FAQ

1.4.9.11 I don't see any speedups in my workload. Why?
......................................................

Certain code won't have noticeable benefits.  If your code spends most
of its time on I/O operations, or already does most of its computation
in a C extension library like NumPy, there won't be significant
speedups.  This project currently benefits pure-Python workloads the
most.

Furthermore, the pyperformance figures are a geometric mean.  Even
within the pyperformance benchmarks, certain benchmarks have slowed down
slightly, while others have sped up by nearly 2x!


File: python.info,  Node: Is there a JIT compiler?,  Prev: I don't see any speedups in my workload Why?,  Up: FAQ

1.4.9.12 Is there a JIT compiler?
.................................

No.  We're still exploring other optimizations.


File: python.info,  Node: About,  Prev: FAQ,  Up: Faster CPython

1.4.9.13 About
..............

Faster CPython explores optimizations for *note CPython: 905.  The main
team is funded by Microsoft to work on this full-time.  Pablo Galindo
Salgado is also funded by Bloomberg LP to work on the project part-time.
Finally, many contributors are volunteers from the community.


File: python.info,  Node: CPython バイトコードの変更<3>,  Next: 非推奨<4>,  Prev: Faster CPython,  Up: What's New In Python 3 11

1.4.10 CPython バイトコードの変更
---------------------------------

The bytecode now contains inline cache entries, which take the form of
the newly-added *note CACHE: 908. instructions.  Many opcodes expect to
be followed by an exact number of caches, and instruct the interpreter
to skip over them at runtime.  Populated caches can look like arbitrary
instructions, so great care should be taken when reading or modifying
raw, adaptive bytecode containing quickened data.

* Menu:

* New opcodes::
* Replaced opcodes::
* Changed/removed opcodes::


File: python.info,  Node: New opcodes,  Next: Replaced opcodes,  Up: CPython バイトコードの変更<3>

1.4.10.1 New opcodes
....................

   * ‘ASYNC_GEN_WRAP’, *note RETURN_GENERATOR: 90b. and *note SEND: 90c,
     used in generators and co-routines.

   * *note COPY_FREE_VARS: 90d, which avoids needing special caller-side
     code for closures.

   * *note JUMP_BACKWARD_NO_INTERRUPT: 90e, for use in certain loops
     where handling interrupts is undesirable.

   * *note MAKE_CELL: 90f, to create *note セルオブジェクト (cell
     object): 910.

   * *note CHECK_EG_MATCH: 911. and ‘PREP_RERAISE_STAR’, to handle the
     *note new exception groups and except*: 7be. added in PEP 654(1).

   * *note PUSH_EXC_INFO: 912, for use in exception handlers.

   * *note RESUME: 5bb, a no-op, for internal tracing, debugging and
     optimization checks.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0654/


File: python.info,  Node: Replaced opcodes,  Next: Changed/removed opcodes,  Prev: New opcodes,  Up: CPython バイトコードの変更<3>

1.4.10.2 Replaced opcodes
.........................

Replaced Opcode(s)                       New Opcode(s)                            注釈
                                                                                  
--------------------------------------------------------------------------------------------------------------------------------
                                                                                  
     ‘BINARY_*’                          *note BINARY_OP: 366.                    Replaced all numeric binary/in-place
     ‘INPLACE_*’                                                                  opcodes with a single opcode
                                                                                  
                                                                                  
     ‘CALL_FUNCTION’                          *note CALL: 915.                    Decouples argument shifting for methods
     ‘CALL_FUNCTION_KW’                       ‘KW_NAMES’                          from handling of keyword arguments; allows
     ‘CALL_METHOD’                            ‘PRECALL’                           better specialization of calls
                                              *note PUSH_NULL: 916.               
                                         
                                                                                  
     ‘DUP_TOP’                                *note COPY: 917.                    Stack manipulation instructions
     ‘DUP_TOP_TWO’                            *note SWAP: 918.                    
     ‘ROT_TWO’                           
     ‘ROT_THREE’
     ‘ROT_FOUR’
     ‘ROT_N’

     ‘JUMP_IF_NOT_EXC_MATCH’                  *note CHECK_EXC_MATCH: 919.         Now performs check but doesn't jump
                                                                                  
                                                                                  
     ‘JUMP_ABSOLUTE’                          *note JUMP_BACKWARD: 91a.           See (1); ‘TRUE’, ‘FALSE’, ‘NONE’ and
     ‘POP_JUMP_IF_FALSE’                      ‘POP_JUMP_BACKWARD_IF_*’            ‘NOT_NONE’ variants for each direction
     ‘POP_JUMP_IF_TRUE’                       ‘POP_JUMP_FORWARD_IF_*’             
                                         
                                                                                  
     ‘SETUP_WITH’                        ‘BEFORE_WITH’                            *note with: 186. block setup
     ‘SETUP_ASYNC_WITH’                                                           

   ---------- Footnotes ----------

   (1) All jump opcodes are now relative, including the existing
‘JUMP_IF_TRUE_OR_POP’ and ‘JUMP_IF_FALSE_OR_POP’.  The argument is now
an offset from the current instruction rather than an absolute location.


File: python.info,  Node: Changed/removed opcodes,  Prev: Replaced opcodes,  Up: CPython バイトコードの変更<3>

1.4.10.3 Changed/removed opcodes
................................

   * Changed *note MATCH_CLASS: 91f. and *note MATCH_KEYS: 920. to no
     longer push an additional boolean value to indicate
     success/failure.  Instead, ‘None’ is pushed on failure in place of
     the tuple of extracted values.

   * Changed opcodes that work with exceptions to reflect them now being
     represented as one item on the stack instead of three (see
     gh-89874(1)).

   * Removed ‘COPY_DICT_WITHOUT_KEYS’, ‘GEN_START’, ‘POP_BLOCK’,
     ‘SETUP_FINALLY’ and ‘YIELD_FROM’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89874


File: python.info,  Node: 非推奨<4>,  Next: Pending Removal in Python 3 12,  Prev: CPython バイトコードの変更<3>,  Up: What's New In Python 3 11

1.4.11 非推奨
-------------

This section lists Python APIs that have been deprecated in Python 3.11.

Deprecated C APIs are *note listed separately: 924.
* Menu:

* Language/Builtins::
* モジュール::
* Standard Library::


File: python.info,  Node: Language/Builtins,  Next: モジュール,  Up: 非推奨<4>

1.4.11.1 Language/Builtins
..........................

   * Chaining *note classmethod: 48e. descriptors (introduced in
     bpo-19072(1)) is now deprecated.  It can no longer be used to wrap
     other descriptors such as *note property: 4b3.  The core design of
     this feature was flawed and caused a number of downstream problems.
     To "pass-through" a *note classmethod: 48e, consider using the
     ‘__wrapped__’ attribute that was added in Python 3.10.
     (Contributed by Raymond Hettinger in gh-89519(2).)

   * Octal escapes in string and bytes literals with values larger than
     ‘0o377’ (255 in decimal) now produce a *note DeprecationWarning:
     1a3.  In a future Python version, they will raise a *note
     SyntaxWarning: 1ae. and eventually a *note SyntaxError: 18e.
     (Contributed by Serhiy Storchaka in gh-81548(3).)

   * The delegation of *note int(): 19b. to *note __trunc__(): 19c. is
     now deprecated.  Calling ‘int(a)’ when ‘type(a)’ implements
     ‘__trunc__()’ but not *note __int__(): 19d. or *note __index__():
     19e. now raises a *note DeprecationWarning: 1a3.  (Contributed by
     Zackery Spytz in bpo-44977(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19072

   (2) https://github.com/python/cpython/issues/89519

   (3) https://github.com/python/cpython/issues/81548

   (4) https://bugs.python.org/issue?@action=redirect&bpo=44977


File: python.info,  Node: モジュール,  Next: Standard Library,  Prev: Language/Builtins,  Up: 非推奨<4>

1.4.11.2 モジュール
...................

   * PEP 594(1) led to the deprecations of the following modules slated
     for removal in Python 3.13:

     ‘aifc’                    ‘chunk’                   ‘msilib’                  ‘pipes’                   ‘telnetlib’
                                                                                                             
                                                                                                             
     ‘audioop’                 ‘crypt’                   ‘nis’                     ‘sndhdr’                  ‘uu’
                                                                                                             
                                                                                                             
     ‘cgi’                     ‘imghdr’                  ‘nntplib’                 ‘spwd’                    ‘xdrlib’
                                                                                                             
                                                                                                             
     ‘cgitb’                   ‘mailcap’                 ‘ossaudiodev’             ‘sunau’
                                                                                   

     (Contributed by Brett Cannon in bpo-47061(2) and Victor Stinner in
     gh-68966(3).)

   * The ‘asynchat’, ‘asyncore’ and ‘smtpd’ modules have been deprecated
     since at least Python 3.6.  Their documentation and deprecation
     warnings have now been updated to note they will be removed in
     Python 3.12.  (Contributed by Hugo van Kemenade in bpo-47022(4).)

   * The ‘lib2to3’ package and ‘2to3’ tool are now deprecated and may
     not be able to parse Python 3.10 or newer.  See PEP 617(5),
     introducing the new PEG parser, for details.  (Contributed by
     Victor Stinner in bpo-40360(6).)

   * Undocumented modules ‘sre_compile’, ‘sre_constants’ and ‘sre_parse’
     are now deprecated.  (Contributed by Serhiy Storchaka in
     bpo-47152(7).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=47061

   (3) https://github.com/python/cpython/issues/68966

   (4) https://bugs.python.org/issue?@action=redirect&bpo=47022

   (5) https://peps.python.org/pep-0617/

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40360

   (7) https://bugs.python.org/issue?@action=redirect&bpo=47152


File: python.info,  Node: Standard Library,  Prev: モジュール,  Up: 非推奨<4>

1.4.11.3 Standard Library
.........................

   * The following have been deprecated in *note configparser: 26. since
     Python 3.2.  Their deprecation warnings have now been updated to
     note they will be removed in Python 3.12:

        * the ‘configparser.SafeConfigParser’ class

        * the ‘configparser.ParsingError.filename’ property

        * the ‘configparser.RawConfigParser.readfp()’ method

     (Contributed by Hugo van Kemenade in bpo-45173(1).)

   * ‘configparser.LegacyInterpolation’ has been deprecated in the
     docstring since Python 3.2, and is not listed in the *note
     configparser: 26. documentation.  It now emits a *note
     DeprecationWarning: 1a3. and will be removed in Python 3.13.  Use
     *note configparser.BasicInterpolation: 92c. or *note
     configparser.ExtendedInterpolation: 92d. instead.  (Contributed by
     Hugo van Kemenade in bpo-46607(2).)

   * The older set of *note importlib.resources: 7f. functions were
     deprecated in favor of the replacements added in Python 3.9 and
     will be removed in a future Python version, due to not supporting
     resources located within package subdirectories:

        * ‘importlib.resources.contents()’

        * ‘importlib.resources.is_resource()’

        * ‘importlib.resources.open_binary()’

        * ‘importlib.resources.open_text()’

        * ‘importlib.resources.read_binary()’

        * ‘importlib.resources.read_text()’

        * ‘importlib.resources.path()’

   * The *note locale.getdefaultlocale(): 326. function is deprecated
     and will be removed in Python 3.15.  Use *note locale.setlocale():
     328, *note locale.getpreferredencoding(False): 75c. and *note
     locale.getlocale(): 327. functions instead.  (Contributed by Victor
     Stinner in gh-90817(3).)

   * The ‘locale.resetlocale()’ function is deprecated and will be
     removed in Python 3.13.  Use ‘locale.setlocale(locale.LC_ALL, "")’
     instead.  (Contributed by Victor Stinner in gh-90817(4).)

   * Stricter rules will now be applied for numerical group references
     and group names in *note regular expressions: 92e.  Only sequences
     of ASCII digits will now be accepted as a numerical reference, and
     the group name in *note bytes: 192. patterns and replacement
     strings can only contain ASCII letters, digits and underscores.
     For now, a deprecation warning is raised for syntax violating these
     rules.  (Contributed by Serhiy Storchaka in gh-91760(5).)

   * In the *note re: be. module, the ‘re.template()’ function and the
     corresponding ‘re.TEMPLATE’ and ‘re.T’ flags are deprecated, as
     they were undocumented and lacked an obvious purpose.  They will be
     removed in Python 3.13.  (Contributed by Serhiy Storchaka and Miro
     Hrončok in gh-92728(6).)

   * ‘turtle.settiltangle()’ has been deprecated since Python 3.1; it
     now emits a deprecation warning and will be removed in Python 3.13.
     Use *note turtle.tiltangle(): 92f. instead (it was earlier
     incorrectly marked as deprecated, and its docstring is now
     corrected).  (Contributed by Hugo van Kemenade in bpo-45837(7).)

   * *note typing.Text: 360, which exists solely to provide
     compatibility support between Python 2 and Python 3 code, is now
     deprecated.  Its removal is currently unplanned, but users are
     encouraged to use *note str: 169. instead wherever possible.
     (Contributed by Alex Waygood in gh-92332(8).)

   * The keyword argument syntax for constructing *note
     typing.TypedDict: 332. types is now deprecated.  Support will be
     removed in Python 3.13.  (Contributed by Jingchen Ye in
     gh-90224(9).)

   * ‘webbrowser.MacOSX’ is deprecated and will be removed in Python
     3.13.  It is untested, undocumented, and not used by *note
     webbrowser: 11b. itself.  (Contributed by Donghee Na in
     bpo-42255(10).)

   * The behavior of returning a value from a *note TestCase: 2b3. and
     *note IsolatedAsyncioTestCase: 361. test methods (other than the
     default ‘None’ value) is now deprecated.

   * Deprecated the following not-formally-documented *note unittest:
     10c. functions, scheduled for removal in Python 3.13:

        * ‘unittest.findTestCases()’

        * ‘unittest.makeSuite()’

        * ‘unittest.getTestCaseNames()’

     Use *note TestLoader: 593. methods instead:

        * *note unittest.TestLoader.loadTestsFromModule(): 594.

        * *note unittest.TestLoader.loadTestsFromTestCase(): 595.

        * *note unittest.TestLoader.getTestCaseNames(): 596.

     (Contributed by Erlend E. Aasland in bpo-5846(11).)

   * ‘unittest.TestProgram.usageExit()’ is marked deprecated, to be
     removed in 3.13.  (Contributed by Carlos Damázio in gh-67048(12).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45173

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46607

   (3) https://github.com/python/cpython/issues/90817

   (4) https://github.com/python/cpython/issues/90817

   (5) https://github.com/python/cpython/issues/91760

   (6) https://github.com/python/cpython/issues/92728

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45837

   (8) https://github.com/python/cpython/issues/92332

   (9) https://github.com/python/cpython/issues/90224

   (10) https://bugs.python.org/issue?@action=redirect&bpo=42255

   (11) https://bugs.python.org/issue?@action=redirect&bpo=5846

   (12) https://github.com/python/cpython/issues/67048


File: python.info,  Node: Pending Removal in Python 3 12,  Next: 削除<4>,  Prev: 非推奨<4>,  Up: What's New In Python 3 11

1.4.12 Pending Removal in Python 3.12
-------------------------------------

The following Python APIs have been deprecated in earlier Python
releases, and will be removed in Python 3.12.

C APIs pending removal are *note listed separately: 933.

   * The ‘asynchat’ module

   * The ‘asyncore’ module

   * The *note entire distutils package: 934.

   * The ‘imp’ module

   * The *note typing.io: 238. namespace

   * The *note typing.re: 935. namespace

   * ‘cgi.log()’

   * ‘importlib.find_loader()’

   * ‘importlib.abc.Loader.module_repr()’

   * ‘importlib.abc.MetaPathFinder.find_module()’

   * ‘importlib.abc.PathEntryFinder.find_loader()’

   * ‘importlib.abc.PathEntryFinder.find_module()’

   * ‘importlib.machinery.BuiltinImporter.find_module()’

   * ‘importlib.machinery.BuiltinLoader.module_repr()’

   * ‘importlib.machinery.FileFinder.find_loader()’

   * ‘importlib.machinery.FileFinder.find_module()’

   * ‘importlib.machinery.FrozenImporter.find_module()’

   * ‘importlib.machinery.FrozenLoader.module_repr()’

   * ‘importlib.machinery.PathFinder.find_module()’

   * ‘importlib.machinery.WindowsRegistryFinder.find_module()’

   * ‘importlib.util.module_for_loader()’

   * ‘importlib.util.set_loader_wrapper()’

   * ‘importlib.util.set_package_wrapper()’

   * ‘pkgutil.ImpImporter’

   * ‘pkgutil.ImpLoader’

   * ‘pathlib.Path.link_to()’

   * ‘sqlite3.enable_shared_cache()’

   * ‘sqlite3.OptimizedUnicode()’

   * ‘PYTHONTHREADDEBUG’ environment variable

   * The following deprecated aliases in *note unittest: 10c.:

          非推奨のエイリアス               メソッド名                          非推奨となるバー
                                                                               ジョン
                                                                               
          -----------------------------------------------------------------------------------------
                                                                               
          ‘failUnless’                     *note assertTrue(): 74a.            3.1
                                                                               
                                                                               
          ‘failIf’                         *note assertFalse(): 74b.           3.1
                                                                               
                                                                               
          ‘failUnlessEqual’                *note assertEqual(): 74c.           3.1
                                                                               
                                                                               
          ‘failIfEqual’                    *note assertNotEqual(): 74d.        3.1
                                                                               
                                                                               
          ‘failUnlessAlmostEqual’          *note assertAlmostEqual(): 74e.     3.1
                                                                               
                                                                               
          ‘failIfAlmostEqual’              *note assertNotAlmostEqual(): 74f.  3.1
                                                                               
                                                                               
          ‘failUnlessRaises’               *note assertRaises(): 750.          3.1
                                                                               
                                                                               
          ‘assert_’                        *note assertTrue(): 74a.            3.2
                                                                               
                                                                               
          ‘assertEquals’                   *note assertEqual(): 74c.           3.2
                                                                               
                                                                               
          ‘assertNotEquals’                *note assertNotEqual(): 74d.        3.2
                                                                               
                                                                               
          ‘assertAlmostEquals’             *note assertAlmostEqual(): 74e.     3.2
                                                                               
                                                                               
          ‘assertNotAlmostEquals’          *note assertNotAlmostEqual(): 74f.  3.2
                                                                               
                                                                               
          ‘assertRegexpMatches’            *note assertRegex(): 751.           3.2
                                                                               
                                                                               
          ‘assertRaisesRegexp’             *note assertRaisesRegex(): 752.     3.2
                                                                               
                                                                               
          ‘assertNotRegexpMatches’         *note assertNotRegex(): 753.        3.5
                                                                               


File: python.info,  Node: 削除<4>,  Next: Porting to Python 3 11,  Prev: Pending Removal in Python 3 12,  Up: What's New In Python 3 11

1.4.13 削除
-----------

This section lists Python APIs that have been removed in Python 3.11.

Removed C APIs are *note listed separately: 939.

   * Removed the ‘@asyncio.coroutine()’ *note decorator: 93a. enabling
     legacy generator-based coroutines to be compatible with *note
     async: 93b. / *note await: 18d. code.  The function has been
     deprecated since Python 3.8 and the removal was initially scheduled
     for Python 3.10.  Use *note async def: 7ed. instead.  (Contributed
     by Illia Volochii in bpo-43216(1).)

   * Removed ‘asyncio.coroutines.CoroWrapper’ used for wrapping legacy
     generator-based coroutine objects in the debug mode.  (Contributed
     by Illia Volochii in bpo-43216(2).)

   * Due to significant security concerns, the 'reuse_address' parameter
     of *note asyncio.loop.create_datagram_endpoint(): 93c, disabled in
     Python 3.9, is now entirely removed.  This is because of the
     behavior of the socket option ‘SO_REUSEADDR’ in UDP. (Contributed
     by Hugo van Kemenade in bpo-45129(3).)

   * Removed the ‘binhex’ module, deprecated in Python 3.9.  Also
     removed the related, similarly-deprecated *note binascii: 11.
     functions:

        * ‘binascii.a2b_hqx()’

        * ‘binascii.b2a_hqx()’

        * ‘binascii.rlecode_hqx()’

        * ‘binascii.rldecode_hqx()’

     The *note binascii.crc_hqx(): 93d. function remains available.

     (Contributed by Victor Stinner in bpo-45085(4).)

   * Removed the ‘distutils’ ‘bdist_msi’ command deprecated in Python
     3.9.  Use ‘bdist_wheel’ (wheel packages) instead.  (Contributed by
     Hugo van Kemenade in bpo-45124(5).)

   * Removed the *note __getitem__(): 588. methods of *note
     xml.dom.pulldom.DOMEventStream: 93e, *note
     wsgiref.util.FileWrapper: 93f. and *note fileinput.FileInput: 940,
     deprecated since Python 3.9.  (Contributed by Hugo van Kemenade in
     bpo-45132(6).)

   * Removed the deprecated *note gettext: 67. functions ‘lgettext()’,
     ‘ldgettext()’, ‘lngettext()’ and ‘ldngettext()’.  Also removed the
     ‘bind_textdomain_codeset()’ function, the
     ‘NullTranslations.output_charset()’ and
     ‘NullTranslations.set_output_charset()’ methods, and the 'codeset'
     parameter of ‘translation()’ and ‘install()’, since they are only
     used for the ‘l*gettext()’ functions.  (Contributed by Donghee Na
     and Serhiy Storchaka in bpo-44235(7).)

   * Removed from the *note inspect: 82. module:

        * The ‘getargspec()’ function, deprecated since Python 3.0; use
          *note inspect.signature(): 22f. or *note
          inspect.getfullargspec(): 941. instead.

        * The ‘formatargspec()’ function, deprecated since Python 3.5;
          use the *note inspect.signature(): 22f. function or the *note
          inspect.Signature: 4e3. object directly.

        * The undocumented ‘Signature.from_builtin()’ and
          ‘Signature.from_function()’ methods, deprecated since Python
          3.5; use the *note Signature.from_callable(): 942. method
          instead.

     (Contributed by Hugo van Kemenade in bpo-45320(8).)

   * Removed the *note __class_getitem__(): 943. method from *note
     pathlib.PurePath: 6cd, because it was not used and added by mistake
     in previous versions.  (Contributed by Nikita Sobolev in
     bpo-46483(9).)

   * Removed the ‘MailmanProxy’ class in the ‘smtpd’ module, as it is
     unusable without the external ‘mailman’ package.  (Contributed by
     Donghee Na in bpo-35800(10).)

   * Removed the deprecated ‘split()’ method of ‘_tkinter.TkappType’.
     (Contributed by Erlend E. Aasland in bpo-38371(11).)

   * Removed namespace package support from *note unittest: 10c.
     discovery.  It was introduced in Python 3.4 but has been broken
     since Python 3.7.  (Contributed by Inada Naoki in bpo-23882(12).)

   * Removed the undocumented private ‘float.__set_format__()’ method,
     previously known as ‘float.__setformat__()’ in Python 3.7.  Its
     docstring said: "You probably don't want to use this function.  It
     exists mainly to be used in Python's test suite."  (Contributed by
     Victor Stinner in bpo-46852(13).)

   * The ‘--experimental-isolated-subinterpreters’ configure flag (and
     corresponding ‘EXPERIMENTAL_ISOLATED_SUBINTERPRETERS’ macro) have
     been removed.

   * Pynche(14) -- The Pythonically Natural Color and Hue Editor -- has
     been moved out of ‘Tools/scripts’ and is being developed
     independently(15) from the Python source tree.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43216

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43216

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45129

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45085

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45124

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45132

   (7) https://bugs.python.org/issue?@action=redirect&bpo=44235

   (8) https://bugs.python.org/issue?@action=redirect&bpo=45320

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46483

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35800

   (11) https://bugs.python.org/issue?@action=redirect&bpo=38371

   (12) https://bugs.python.org/issue?@action=redirect&bpo=23882

   (13) https://bugs.python.org/issue?@action=redirect&bpo=46852

   (14) https://pypi.org/project/Pynche/

   (15) https://gitlab.com/warsaw/pynche/-/tree/main


File: python.info,  Node: Porting to Python 3 11,  Next: Build Changes<3>,  Prev: 削除<4>,  Up: What's New In Python 3 11

1.4.14 Porting to Python 3.11
-----------------------------

This section lists previously described changes and other bugfixes in
the Python API that may require changes to your Python code.

Porting notes for the C API are *note listed separately: 947.

   * *note open(): 316, *note io.open(): 740, *note codecs.open(): 315.
     and *note fileinput.FileInput: 940. no longer accept ‘'U'’
     ("universal newline") in the file mode.  In Python 3, "universal
     newline" mode is used by default whenever a file is opened in text
     mode, and the ‘'U'’ flag has been deprecated since Python 3.3.  The
     *note newline parameter: 948. to these functions controls how
     universal newlines work.  (Contributed by Victor Stinner in
     bpo-37330(1).)

   * *note ast.AST: 4c3. node positions are now validated when provided
     to *note compile(): 4b1. and other related functions.  If invalid
     positions are detected, a *note ValueError: 2ec. will be raised.
     (Contributed by Pablo Galindo in gh-93351(2))

   * Prohibited passing non-*note concurrent.futures.ThreadPoolExecutor:
     949. executors to *note asyncio.loop.set_default_executor(): 94a.
     following a deprecation in Python 3.8.  (Contributed by Illia
     Volochii in bpo-43234(3).)

   * *note calendar: 15.: The *note calendar.LocaleTextCalendar: 94b.
     and *note calendar.LocaleHTMLCalendar: 94c. classes now use *note
     locale.getlocale(): 327, instead of using *note
     locale.getdefaultlocale(): 326, if no locale is specified.
     (Contributed by Victor Stinner in bpo-46659(4).)

   * The *note pdb: aa. module now reads the ‘.pdbrc’ configuration file
     with the ‘'UTF-8'’ encoding.  (Contributed by Srinivas Reddy
     Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) in bpo-41137(5).)

   * The 'population' parameter of *note random.sample(): 94d. must be a
     sequence, and automatic conversion of *note set: 184.s to *note
     list: 24d.s is no longer supported.  Also, if the sample size is
     larger than the population size, a *note ValueError: 2ec. is
     raised.  (Contributed by Raymond Hettinger in bpo-40465(6).)

   * The 'random' optional parameter of *note random.shuffle(): 94e. was
     removed.  It was previously an arbitrary random function to use for
     the shuffle; now, *note random.random(): 94f. (its previous
     default) will always be used.

   * In *note re: be. *note 正規表現のシンタックス: 92e, global inline
     flags (e.g.  ‘(?i)’) can now only be used at the start of regular
     expressions.  Using them elsewhere has been deprecated since Python
     3.6.  (Contributed by Serhiy Storchaka in bpo-47066(7).)

   * In the *note re: be. module, several long-standing bugs where fixed
     that, in rare cases, could cause capture groups to get the wrong
     result.  Therefore, this could change the captured output in these
     cases.  (Contributed by Ma Lin in bpo-35859(8).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37330

   (2) https://github.com/python/cpython/issues/93351

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43234

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46659

   (5) https://bugs.python.org/issue?@action=redirect&bpo=41137

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40465

   (7) https://bugs.python.org/issue?@action=redirect&bpo=47066

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35859


File: python.info,  Node: Build Changes<3>,  Next: C API の変更<5>,  Prev: Porting to Python 3 11,  Up: What's New In Python 3 11

1.4.15 Build Changes
--------------------

   * CPython now has PEP 11(1) Tier 3 support(2) for cross compiling to
     the WebAssembly(3) platforms Emscripten(4)
     (‘wasm32-unknown-emscripten’, i.e.  Python in the browser) and
     WebAssembly System Interface (WASI)(5) (‘wasm32-unknown-wasi’).
     The effort is inspired by previous work like Pyodide(6).  These
     platforms provide a limited subset of POSIX APIs; Python standard
     libraries features and modules related to networking, processes,
     threading, signals, mmap, and users/groups are not available or
     don't work.  (Emscripten contributed by Christian Heimes and Ethan
     Smith in gh-84461(7) and WASI contributed by Christian Heimes in
     gh-90473(8); platforms promoted in gh-95085(9))

   * Building CPython now requires:

        * A C11(10) compiler and standard library.  Optional C11
          features(11) are not required.  (Contributed by Victor Stinner
          in bpo-46656(12), bpo-45440(13) and bpo-46640(14).)

        * Support for IEEE 754(15) floating-point numbers.  (Contributed
          by Victor Stinner in bpo-46917(16).)

   * The ‘Py_NO_NAN’ macro has been removed.  Since CPython now requires
     IEEE 754 floats, NaN values are always available.  (Contributed by
     Victor Stinner in bpo-46656(17).)

   * The *note tkinter: f6. package now requires Tcl/Tk(18) version
     8.5.12 or newer.  (Contributed by Serhiy Storchaka in
     bpo-46996(19).)

   * Build dependencies, compiler flags, and linker flags for most
     stdlib extension modules are now detected by ‘configure’.  libffi,
     libnsl, libsqlite3, zlib, bzip2, liblzma, libcrypt, Tcl/Tk, and
     uuid flags are detected by pkg-config(20) (when available).  *note
     tkinter: f6. now requires a pkg-config command to detect
     development settings for Tcl/Tk(21) headers and libraries.
     (Contributed by Christian Heimes and Erlend Egeberg Aasland in
     bpo-45847(22), bpo-45747(23), and bpo-45763(24).)

   * libpython is no longer linked against libcrypt.  (Contributed by
     Mike Gilbert in bpo-45433(25).)

   * CPython can now be built with the ThinLTO(26) option via passing
     ‘thin’ to *note -with-lto: 952, i.e.  ‘--with-lto=thin’.
     (Contributed by Donghee Na and Brett Holman in bpo-44340(27).)

   * Freelists for object structs can now be disabled.  A new
     ‘configure’ option ‘--without-freelists’ can be used to disable all
     freelists except empty tuple singleton.  (Contributed by Christian
     Heimes in bpo-45522(28).)

   * ‘Modules/Setup’ and ‘Modules/makesetup’ have been improved and tied
     up.  Extension modules can now be built through ‘makesetup’.  All
     except some test modules can be linked statically into a main
     binary or library.  (Contributed by Brett Cannon and Christian
     Heimes in bpo-45548(29), bpo-45570(30), bpo-45571(31), and
     bpo-43974(32).)

          注釈: Use the environment variables ‘TCLTK_CFLAGS’ and
          ‘TCLTK_LIBS’ to manually specify the location of Tcl/Tk
          headers and libraries.  The ‘configure’ options
          ‘--with-tcltk-includes’ and ‘--with-tcltk-libs’ have been
          removed.

          On RHEL 7 and CentOS 7 the development packages do not provide
          ‘tcl.pc’ and ‘tk.pc’; use ‘TCLTK_LIBS="-ltk8.5 -ltkstub8.5
          -ltcl8.5"’.  The directory ‘Misc/rhel7’ contains ‘.pc’ files
          and instructions on how to build Python with RHEL 7's and
          CentOS 7's Tcl/Tk and OpenSSL.

   * CPython will now use 30-bit digits by default for the Python *note
     int: 19b. implementation.  Previously, the default was to use
     30-bit digits on platforms with ‘SIZEOF_VOID_P >= 8’, and 15-bit
     digits otherwise.  It's still possible to explicitly request use of
     15-bit digits via either the *note -enable-big-digits: 953. option
     to the configure script or (for Windows) the ‘PYLONG_BITS_IN_DIGIT’
     variable in ‘PC/pyconfig.h’, but this option may be removed at some
     point in the future.  (Contributed by Mark Dickinson in
     bpo-45569(33).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0011/

   (2) https://peps.python.org/pep-0011/#tier-3

   (3) https://webassembly.org/

   (4) https://emscripten.org/

   (5) https://wasi.dev/

   (6) https://pyodide.org/

   (7) https://github.com/python/cpython/issues/84461

   (8) https://github.com/python/cpython/issues/90473

   (9) https://github.com/python/cpython/issues/95085

   (10) https://en.cppreference.com/w/c/11

   (11) 
https://en.wikipedia.org/wiki/C11_(C_standard_revision)#Optional_features

   (12) https://bugs.python.org/issue?@action=redirect&bpo=46656

   (13) https://bugs.python.org/issue?@action=redirect&bpo=45440

   (14) https://bugs.python.org/issue?@action=redirect&bpo=46640

   (15) https://en.wikipedia.org/wiki/IEEE_754

   (16) https://bugs.python.org/issue?@action=redirect&bpo=46917

   (17) https://bugs.python.org/issue?@action=redirect&bpo=46656

   (18) https://www.tcl.tk

   (19) https://bugs.python.org/issue?@action=redirect&bpo=46996

   (20) https://www.freedesktop.org/wiki/Software/pkg-config/

   (21) https://www.tcl.tk

   (22) https://bugs.python.org/issue?@action=redirect&bpo=45847

   (23) https://bugs.python.org/issue?@action=redirect&bpo=45747

   (24) https://bugs.python.org/issue?@action=redirect&bpo=45763

   (25) https://bugs.python.org/issue?@action=redirect&bpo=45433

   (26) https://clang.llvm.org/docs/ThinLTO.html

   (27) https://bugs.python.org/issue?@action=redirect&bpo=44340

   (28) https://bugs.python.org/issue?@action=redirect&bpo=45522

   (29) https://bugs.python.org/issue?@action=redirect&bpo=45548

   (30) https://bugs.python.org/issue?@action=redirect&bpo=45570

   (31) https://bugs.python.org/issue?@action=redirect&bpo=45571

   (32) https://bugs.python.org/issue?@action=redirect&bpo=43974

   (33) https://bugs.python.org/issue?@action=redirect&bpo=45569


File: python.info,  Node: C API の変更<5>,  Next: Python 3 11 4での重要な変更点,  Prev: Build Changes<3>,  Up: What's New In Python 3 11

1.4.16 C API の変更
-------------------

* Menu:

* 新しい機能: 新しい機能<7>.
* Porting to Python 3.11: Porting to Python 3 11<2>.
* 非推奨: 非推奨<5>.
* Pending Removal in Python 3.12: Pending Removal in Python 3 12<2>.
* 削除: 削除<5>.


File: python.info,  Node: 新しい機能<7>,  Next: Porting to Python 3 11<2>,  Up: C API の変更<5>

1.4.16.1 新しい機能
...................

   * Add a new *note PyType_GetName(): 958. function to get type's short
     name.  (Contributed by Hai Shi in bpo-42035(1).)

   * Add a new *note PyType_GetQualName(): 959. function to get type's
     qualified name.  (Contributed by Hai Shi in bpo-42035(2).)

   * Add new *note PyThreadState_EnterTracing(): 95a. and *note
     PyThreadState_LeaveTracing(): 95b. functions to the limited C API
     to suspend and resume tracing and profiling.  (Contributed by
     Victor Stinner in bpo-43760(3).)

   * Added the *note Py_Version: 381. constant which bears the same
     value as *note PY_VERSION_HEX: 382.  (Contributed by Gabriele N.
     Tornetta in bpo-43931(4).)

   * *note Py_buffer: 95c. and APIs are now part of the limited API and
     the stable ABI:

        * *note PyObject_CheckBuffer(): 639.

        * *note PyObject_GetBuffer(): 63a.

        * *note PyBuffer_GetPointer(): 95d.

        * *note PyBuffer_SizeFromFormat(): 95e.

        * *note PyBuffer_ToContiguous(): 95f.

        * *note PyBuffer_FromContiguous(): 960.

        * *note PyObject_CopyData(): 961.

        * *note PyBuffer_IsContiguous(): 962.

        * *note PyBuffer_FillContiguousStrides(): 963.

        * *note PyBuffer_FillInfo(): 964.

        * *note PyBuffer_Release(): 63b.

        * *note PyMemoryView_FromBuffer(): 965.

        * *note bf_getbuffer: 966. and *note bf_releasebuffer: 967. type
          slots

     (Contributed by Christian Heimes in bpo-45459(5).)

   * Added the *note PyType_GetModuleByDef(): 635. function, used to get
     the module in which a method was defined, in cases where this
     information is not available directly (via *note PyCMethod: 968.).
     (Contributed by Petr Viktorin in bpo-46613(6).)

   * Add new functions to pack and unpack C double (serialize and
     deserialize): *note PyFloat_Pack2(): 969, *note PyFloat_Pack4():
     96a, *note PyFloat_Pack8(): 96b, *note PyFloat_Unpack2(): 96c,
     *note PyFloat_Unpack4(): 96d. and *note PyFloat_Unpack8(): 96e.
     (Contributed by Victor Stinner in bpo-46906(7).)

   * Add new functions to get frame object attributes: *note
     PyFrame_GetBuiltins(): 96f, *note PyFrame_GetGenerator(): 970,
     *note PyFrame_GetGlobals(): 971, *note PyFrame_GetLasti(): 972.

   * Added two new functions to get and set the active exception
     instance: *note PyErr_GetHandledException(): 973. and *note
     PyErr_SetHandledException(): 974.  These are alternatives to *note
     PyErr_SetExcInfo(): 975. and *note PyErr_GetExcInfo(): 976. which
     work with the legacy 3-tuple representation of exceptions.
     (Contributed by Irit Katriel in bpo-46343(8).)

   * Added the *note PyConfig.safe_path: 977. member.  (Contributed by
     Victor Stinner in gh-57684(9).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42035

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42035

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43760

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43931

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45459

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46613

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46906

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46343

   (9) https://github.com/python/cpython/issues/57684


File: python.info,  Node: Porting to Python 3 11<2>,  Next: 非推奨<5>,  Prev: 新しい機能<7>,  Up: C API の変更<5>

1.4.16.2 Porting to Python 3.11
...............................

   * Some macros have been converted to static inline functions to avoid
     macro pitfalls(1).  The change should be mostly transparent to
     users, as the replacement functions will cast their arguments to
     the expected types to avoid compiler warnings due to static type
     checks.  However, when the limited C API is set to >=3.11, these
     casts are not done, and callers will need to cast arguments to
     their expected types.  See PEP 670(2) for more details.
     (Contributed by Victor Stinner and Erlend E. Aasland in
     gh-89653(3).)

   * *note PyErr_SetExcInfo(): 975. no longer uses the ‘type’ and
     ‘traceback’ arguments, the interpreter now derives those values
     from the exception instance (the ‘value’ argument).  The function
     still steals references of all three arguments.  (Contributed by
     Irit Katriel in bpo-45711(4).)

   * *note PyErr_GetExcInfo(): 976. now derives the ‘type’ and
     ‘traceback’ fields of the result from the exception instance (the
     ‘value’ field).  (Contributed by Irit Katriel in bpo-45711(5).)

   * *note _frozen: 979. has a new ‘is_package’ field to indicate
     whether or not the frozen module is a package.  Previously, a
     negative value in the ‘size’ field was the indicator.  Now only
     non-negative values be used for ‘size’.  (Contributed by Kumar
     Aditya in bpo-46608(6).)

   * *note _PyFrameEvalFunction(): 97a. now takes ‘_PyInterpreterFrame*’
     as its second parameter, instead of ‘PyFrameObject*’.  See PEP
     523(7) for more details of how to use this function pointer type.

   * ‘PyCode_New()’ and ‘PyCode_NewWithPosOnlyArgs()’ now take an
     additional ‘exception_table’ argument.  Using these functions
     should be avoided, if at all possible.  To get a custom code
     object: create a code object using the compiler, then get a
     modified version with the ‘replace’ method.

   * *note PyCodeObject: 97b. no longer has the ‘co_code’,
     ‘co_varnames’, ‘co_cellvars’ and ‘co_freevars’ fields.  Instead,
     use *note PyCode_GetCode(): 97c, *note PyCode_GetVarnames(): 97d,
     *note PyCode_GetCellvars(): 97e. and *note PyCode_GetFreevars():
     97f. respectively to access them via the C API. (Contributed by
     Brandt Bucher in bpo-46841(8) and Ken Jin in gh-92154(9) and
     gh-94936(10).)

   * The old trashcan macros
     (‘Py_TRASHCAN_SAFE_BEGIN’/‘Py_TRASHCAN_SAFE_END’) are now
     deprecated.  They should be replaced by the new macros
     ‘Py_TRASHCAN_BEGIN’ and ‘Py_TRASHCAN_END’.

     A tp_dealloc function that has the old macros, such as:

          static void
          mytype_dealloc(mytype *p)
          {
              PyObject_GC_UnTrack(p);
              Py_TRASHCAN_SAFE_BEGIN(p);
              ...
              Py_TRASHCAN_SAFE_END
          }

     should migrate to the new macros as follows:

          static void
          mytype_dealloc(mytype *p)
          {
              PyObject_GC_UnTrack(p);
              Py_TRASHCAN_BEGIN(p, mytype_dealloc)
              ...
              Py_TRASHCAN_END
          }

     Note that ‘Py_TRASHCAN_BEGIN’ has a second argument which should be
     the deallocation function it is in.

     To support older Python versions in the same codebase, you can
     define the following macros and use them throughout the code
     (credit: these were copied from the ‘mypy’ codebase):

          #if PY_VERSION_HEX >= 0x03080000
          #  define CPy_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_BEGIN(op, dealloc)
          #  define CPy_TRASHCAN_END(op) Py_TRASHCAN_END
          #else
          #  define CPy_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_SAFE_BEGIN(op)
          #  define CPy_TRASHCAN_END(op) Py_TRASHCAN_SAFE_END(op)
          #endif

   * The *note PyType_Ready(): 980. function now raises an error if a
     type is defined with the *note Py_TPFLAGS_HAVE_GC: 981. flag set
     but has no traverse function (*note PyTypeObject.tp_traverse:
     982.).  (Contributed by Victor Stinner in bpo-44263(11).)

   * Heap types with the *note Py_TPFLAGS_IMMUTABLETYPE: 3cf. flag can
     now inherit the PEP 590(12) vectorcall protocol.  Previously, this
     was only possible for *note static types: 983.  (Contributed by
     Erlend E. Aasland in bpo-43908(13))

   * Since *note Py_TYPE(): 3c9. is changed to a inline static function,
     ‘Py_TYPE(obj) = new_type’ must be replaced with ‘Py_SET_TYPE(obj,
     new_type)’: see the *note Py_SET_TYPE(): 984. function (available
     since Python 3.9).  For backward compatibility, this macro can be
     used:

          #if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_TYPE)
          static inline void _Py_SET_TYPE(PyObject *ob, PyTypeObject *type)
          { ob->ob_type = type; }
          #define Py_SET_TYPE(ob, type) _Py_SET_TYPE((PyObject*)(ob), type)
          #endif

     (Contributed by Victor Stinner in bpo-39573(14).)

   * Since *note Py_SIZE(): 985. is changed to a inline static function,
     ‘Py_SIZE(obj) = new_size’ must be replaced with ‘Py_SET_SIZE(obj,
     new_size)’: see the *note Py_SET_SIZE(): 986. function (available
     since Python 3.9).  For backward compatibility, this macro can be
     used:

          #if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_SIZE)
          static inline void _Py_SET_SIZE(PyVarObject *ob, Py_ssize_t size)
          { ob->ob_size = size; }
          #define Py_SET_SIZE(ob, size) _Py_SET_SIZE((PyVarObject*)(ob), size)
          #endif

     (Contributed by Victor Stinner in bpo-39573(15).)

   * ‘<Python.h>’ no longer includes the header files ‘<stdlib.h>’,
     ‘<stdio.h>’, ‘<errno.h>’ and ‘<string.h>’ when the ‘Py_LIMITED_API’
     macro is set to ‘0x030b0000’ (Python 3.11) or higher.  C extensions
     should explicitly include the header files after ‘#include
     <Python.h>’.  (Contributed by Victor Stinner in bpo-45434(16).)

   * The non-limited API files ‘cellobject.h’, ‘classobject.h’,
     ‘code.h’, ‘context.h’, ‘funcobject.h’, ‘genobject.h’ and
     ‘longintrepr.h’ have been moved to the ‘Include/cpython’ directory.
     Moreover, the ‘eval.h’ header file was removed.  These files must
     not be included directly, as they are already included in
     ‘Python.h’: *note Include Files: 987.  If they have been included
     directly, consider including ‘Python.h’ instead.  (Contributed by
     Victor Stinner in bpo-35134(17).)

   * The ‘PyUnicode_CHECK_INTERNED()’ macro has been excluded from the
     limited C API. It was never usable there, because it used internal
     structures which are not available in the limited C API.
     (Contributed by Victor Stinner in bpo-46007(18).)

   * The following frame functions and type are now directly available
     with ‘#include <Python.h>’, it's no longer needed to add ‘#include
     <frameobject.h>’:

        * *note PyFrame_Check(): 988.

        * *note PyFrame_GetBack(): 989.

        * *note PyFrame_GetBuiltins(): 96f.

        * *note PyFrame_GetGenerator(): 970.

        * *note PyFrame_GetGlobals(): 971.

        * *note PyFrame_GetLasti(): 972.

        * *note PyFrame_GetLocals(): 661.

        * *note PyFrame_Type: 98a.

     (Contributed by Victor Stinner in gh-93937(19).)

   * The *note PyFrameObject: 98c. structure members have been removed
     from the public C API.

     While the documentation notes that the *note PyFrameObject: 98c.
     fields are subject to change at any time, they have been stable for
     a long time and were used in several popular extensions.

     In Python 3.11, the frame struct was reorganized to allow
     performance optimizations.  Some fields were removed entirely, as
     they were details of the old implementation.

     *note PyFrameObject: 98c. fields:

        * ‘f_back’: use *note PyFrame_GetBack(): 989.

        * ‘f_blockstack’: removed.

        * ‘f_builtins’: use *note PyFrame_GetBuiltins(): 96f.

        * ‘f_code’: use *note PyFrame_GetCode(): 98d.

        * ‘f_gen’: use *note PyFrame_GetGenerator(): 970.

        * ‘f_globals’: use *note PyFrame_GetGlobals(): 971.

        * ‘f_iblock’: removed.

        * ‘f_lasti’: use *note PyFrame_GetLasti(): 972.  Code using
          ‘f_lasti’ with ‘PyCode_Addr2Line()’ should use *note
          PyFrame_GetLineNumber(): 98e. instead; it may be faster.

        * ‘f_lineno’: use *note PyFrame_GetLineNumber(): 98e.

        * ‘f_locals’: use *note PyFrame_GetLocals(): 661.

        * ‘f_stackdepth’: removed.

        * ‘f_state’: no public API (renamed to ‘f_frame.f_state’).

        * ‘f_trace’: no public API.

        * ‘f_trace_lines’: use ‘PyObject_GetAttrString((PyObject*)frame,
          "f_trace_lines")’.

        * ‘f_trace_opcodes’: use
          ‘PyObject_GetAttrString((PyObject*)frame, "f_trace_opcodes")’.

        * ‘f_localsplus’: no public API (renamed to
          ‘f_frame.localsplus’).

        * ‘f_valuestack’: removed.

     The Python frame object is now created lazily.  A side effect is
     that the *note f_back: 98f. member must not be accessed directly,
     since its value is now also computed lazily.  The *note
     PyFrame_GetBack(): 989. function must be called instead.

     Debuggers that accessed the *note f_locals: 4a5. directly 'must'
     call *note PyFrame_GetLocals(): 661. instead.  They no longer need
     to call ‘PyFrame_FastToLocalsWithError()’ or
     ‘PyFrame_LocalsToFast()’, in fact they should not call those
     functions.  The necessary updating of the frame is now managed by
     the virtual machine.

     Code defining ‘PyFrame_GetCode()’ on Python 3.8 and older:

          #if PY_VERSION_HEX < 0x030900B1
          static inline PyCodeObject* PyFrame_GetCode(PyFrameObject *frame)
          {
              Py_INCREF(frame->f_code);
              return frame->f_code;
          }
          #endif

     Code defining ‘PyFrame_GetBack()’ on Python 3.8 and older:

          #if PY_VERSION_HEX < 0x030900B1
          static inline PyFrameObject* PyFrame_GetBack(PyFrameObject *frame)
          {
              Py_XINCREF(frame->f_back);
              return frame->f_back;
          }
          #endif

     Or use the pythoncapi_compat project(20) to get these two functions
     on older Python versions.

   * Changes of the *note PyThreadState: 990. structure members:

        * ‘frame’: removed, use *note PyThreadState_GetFrame(): 991.
          (function added to Python 3.9 by bpo-40429(21)).  Warning: the
          function returns a *note strong reference: 5e2, need to call
          *note Py_XDECREF(): 992.

        * ‘tracing’: changed, use *note PyThreadState_EnterTracing():
          95a. and *note PyThreadState_LeaveTracing(): 95b. (functions
          added to Python 3.11 by bpo-43760(22)).

        * ‘recursion_depth’: removed, use ‘(tstate->recursion_limit -
          tstate->recursion_remaining)’ instead.

        * ‘stackcheck_counter’: removed.

     Code defining ‘PyThreadState_GetFrame()’ on Python 3.8 and older:

          #if PY_VERSION_HEX < 0x030900B1
          static inline PyFrameObject* PyThreadState_GetFrame(PyThreadState *tstate)
          {
              Py_XINCREF(tstate->frame);
              return tstate->frame;
          }
          #endif

     Code defining ‘PyThreadState_EnterTracing()’ and
     ‘PyThreadState_LeaveTracing()’ on Python 3.10 and older:

          #if PY_VERSION_HEX < 0x030B00A2
          static inline void PyThreadState_EnterTracing(PyThreadState *tstate)
          {
              tstate->tracing++;
          #if PY_VERSION_HEX >= 0x030A00A1
              tstate->cframe->use_tracing = 0;
          #else
              tstate->use_tracing = 0;
          #endif
          }

          static inline void PyThreadState_LeaveTracing(PyThreadState *tstate)
          {
              int use_tracing = (tstate->c_tracefunc != NULL || tstate->c_profilefunc != NULL);
              tstate->tracing--;
          #if PY_VERSION_HEX >= 0x030A00A1
              tstate->cframe->use_tracing = use_tracing;
          #else
              tstate->use_tracing = use_tracing;
          #endif
          }
          #endif

     Or use the pythoncapi-compat project(23) to get these functions on
     old Python functions.

   * Distributors are encouraged to build Python with the optimized
     Blake2 library libb2(24).

   * The *note PyConfig.module_search_paths_set: 805. field must now be
     set to 1 for initialization to use *note
     PyConfig.module_search_paths: 643. to initialize *note sys.path:
     3e4.  Otherwise, initialization will recalculate the path and
     replace any values added to ‘module_search_paths’.

   * *note PyConfig_Read(): 993. no longer calculates the initial search
     path, and will not fill any values into *note
     PyConfig.module_search_paths: 643.  To calculate default paths and
     then modify them, finish initialization and use *note
     PySys_GetObject(): 62a. to retrieve *note sys.path: 3e4. as a
     Python list object and modify it directly.

   ---------- Footnotes ----------

   (1) https://gcc.gnu.org/onlinedocs/cpp/Macro-Pitfalls.html

   (2) https://peps.python.org/pep-0670/

   (3) https://github.com/python/cpython/issues/89653

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45711

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45711

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46608

   (7) https://peps.python.org/pep-0523/

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (9) https://github.com/python/cpython/issues/92154

   (10) https://github.com/python/cpython/issues/94936

   (11) https://bugs.python.org/issue?@action=redirect&bpo=44263

   (12) https://peps.python.org/pep-0590/

   (13) https://bugs.python.org/issue?@action=redirect&bpo=43908

   (14) https://bugs.python.org/issue?@action=redirect&bpo=39573

   (15) https://bugs.python.org/issue?@action=redirect&bpo=39573

   (16) https://bugs.python.org/issue?@action=redirect&bpo=45434

   (17) https://bugs.python.org/issue?@action=redirect&bpo=35134

   (18) https://bugs.python.org/issue?@action=redirect&bpo=46007

   (19) https://github.com/python/cpython/issues/93937

   (20) https://github.com/python/pythoncapi-compat

   (21) https://bugs.python.org/issue?@action=redirect&bpo=40429

   (22) https://bugs.python.org/issue?@action=redirect&bpo=43760

   (23) https://github.com/python/pythoncapi-compat

   (24) https://www.blake2.net/


File: python.info,  Node: 非推奨<5>,  Next: Pending Removal in Python 3 12<2>,  Prev: Porting to Python 3 11<2>,  Up: C API の変更<5>

1.4.16.3 非推奨
...............

   * Deprecate the following functions to configure the Python
     initialization:

        * ‘PySys_AddWarnOptionUnicode()’

        * ‘PySys_AddWarnOption()’

        * ‘PySys_AddXOption()’

        * ‘PySys_HasWarnOptions()’

        * ‘PySys_SetArgvEx()’

        * ‘PySys_SetArgv()’

        * ‘PySys_SetPath()’

        * ‘Py_SetPath()’

        * ‘Py_SetProgramName()’

        * ‘Py_SetPythonHome()’

        * ‘Py_SetStandardStreamEncoding()’

        * ‘_Py_SetProgramFullPath()’

     Use the new *note PyConfig: 3f7. API of the *note Python
     Initialization Configuration: 646. instead ( PEP 587(1)).
     (Contributed by Victor Stinner in gh-88279(2).)

   * Deprecate the ‘ob_shash’ member of the *note PyBytesObject: 995.
     Use *note PyObject_Hash(): 436. instead.  (Contributed by Inada
     Naoki in bpo-46864(3).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0587/

   (2) https://github.com/python/cpython/issues/88279

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46864


File: python.info,  Node: Pending Removal in Python 3 12<2>,  Next: 削除<5>,  Prev: 非推奨<5>,  Up: C API の変更<5>

1.4.16.4 Pending Removal in Python 3.12
.......................................

The following C APIs have been deprecated in earlier Python releases,
and will be removed in Python 3.12.

   * ‘PyUnicode_AS_DATA()’

   * ‘PyUnicode_AS_UNICODE()’

   * ‘PyUnicode_AsUnicodeAndSize()’

   * ‘PyUnicode_AsUnicode()’

   * ‘PyUnicode_FromUnicode()’

   * ‘PyUnicode_GET_DATA_SIZE()’

   * ‘PyUnicode_GET_SIZE()’

   * ‘PyUnicode_GetSize()’

   * ‘PyUnicode_IS_COMPACT()’

   * ‘PyUnicode_IS_READY()’

   * *note PyUnicode_READY(): 434.

   * ‘PyUnicode_WSTR_LENGTH()’

   * ‘_PyUnicode_AsUnicode()’

   * ‘PyUnicode_WCHAR_KIND’

   * *note PyUnicodeObject: 997.

   * ‘PyUnicode_InternImmortal()’


File: python.info,  Node: 削除<5>,  Prev: Pending Removal in Python 3 12<2>,  Up: C API の変更<5>

1.4.16.5 削除
.............

   * ‘PyFrame_BlockSetup()’ and ‘PyFrame_BlockPop()’ have been removed.
     (Contributed by Mark Shannon in bpo-40222(1).)

   * Remove the following math macros using the ‘errno’ variable:

        * ‘Py_ADJUST_ERANGE1()’

        * ‘Py_ADJUST_ERANGE2()’

        * ‘Py_OVERFLOWED()’

        * ‘Py_SET_ERANGE_IF_OVERFLOW()’

        * ‘Py_SET_ERRNO_ON_MATH_ERROR()’

     (Victor Stinner の貢献による bpo-45412(2))

   * Remove ‘Py_UNICODE_COPY()’ and ‘Py_UNICODE_FILL()’ macros,
     deprecated since Python 3.3.  Use ‘PyUnicode_CopyCharacters()’ or
     ‘memcpy()’ (‘wchar_t*’ string), and ‘PyUnicode_Fill()’ functions
     instead.  (Contributed by Victor Stinner in bpo-41123(3).)

   * Remove the ‘pystrhex.h’ header file.  It only contains private
     functions.  C extensions should only include the main ‘<Python.h>’
     header file.  (Contributed by Victor Stinner in bpo-45434(4).)

   * Remove the ‘Py_FORCE_DOUBLE()’ macro.  It was used by the
     ‘Py_IS_INFINITY()’ macro.  (Contributed by Victor Stinner in
     bpo-45440(5).)

   * The following items are no longer available when *note
     Py_LIMITED_API: 660. is defined:

        * *note PyMarshal_WriteLongToFile(): 999.

        * *note PyMarshal_WriteObjectToFile(): 99a.

        * *note PyMarshal_ReadObjectFromString(): 99b.

        * *note PyMarshal_WriteObjectToString(): 99c.

        * ‘Py_MARSHAL_VERSION’ マクロ

     These are not part of the *note limited API: 99d.

     (Contributed by Victor Stinner in bpo-45474(6).)

   * Exclude *note PyWeakref_GET_OBJECT(): 3de. from the limited C API.
     It never worked since the ‘PyWeakReference’ structure is opaque in
     the limited C API. (Contributed by Victor Stinner in bpo-35134(7).)

   * Remove the ‘PyHeapType_GET_MEMBERS()’ macro.  It was exposed in the
     public C API by mistake, it must only be used by Python internally.
     Use the ‘PyTypeObject.tp_members’ member instead.  (Contributed by
     Victor Stinner in bpo-40170(8).)

   * Remove the ‘HAVE_PY_SET_53BIT_PRECISION’ macro (moved to the
     internal C API). (Contributed by Victor Stinner in bpo-45412(9).)

   * Remove the *note Py_UNICODE: 3e0. encoder APIs, as they have been
     deprecated since Python 3.3, are little used and are inefficient
     relative to the recommended alternatives.

     削除された関数は以下の通りです:

        * ‘PyUnicode_Encode()’

        * ‘PyUnicode_EncodeASCII()’

        * ‘PyUnicode_EncodeLatin1()’

        * ‘PyUnicode_EncodeUTF7()’

        * ‘PyUnicode_EncodeUTF8()’

        * ‘PyUnicode_EncodeUTF16()’

        * ‘PyUnicode_EncodeUTF32()’

        * ‘PyUnicode_EncodeUnicodeEscape()’

        * ‘PyUnicode_EncodeRawUnicodeEscape()’

        * ‘PyUnicode_EncodeCharmap()’

        * ‘PyUnicode_TranslateCharmap()’

        * ‘PyUnicode_EncodeDecimal()’

        * ‘PyUnicode_TransformDecimalToASCII()’

     See PEP 624(10) for details and migration guidance(11).
     (Contributed by Inada Naoki in bpo-44029(12).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40222

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45412

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41123

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45434

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45440

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45474

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35134

   (8) https://bugs.python.org/issue?@action=redirect&bpo=40170

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45412

   (10) https://peps.python.org/pep-0624/

   (11) https://peps.python.org/pep-0624/#alternative-apis

   (12) https://bugs.python.org/issue?@action=redirect&bpo=44029


File: python.info,  Node: Python 3 11 4での重要な変更点,  Next: Python 3 11 5での重要な変更点,  Prev: C API の変更<5>,  Up: What's New In Python 3 11

1.4.17 Python 3.11.4での重要な変更点
------------------------------------

* Menu:

* tarfile: tarfile<2>.


File: python.info,  Node: tarfile<2>,  Up: Python 3 11 4での重要な変更点

1.4.17.1 tarfile
................

   * The extraction methods in *note tarfile: e4, and *note
     shutil.unpack_archive(): 696, have a new a 'filter' argument that
     allows limiting tar features than may be surprising or dangerous,
     such as creating files outside the destination directory.  See
     *note Extraction filters: 697. for details.  In Python 3.12, use
     without the 'filter' argument will show a *note DeprecationWarning:
     1a3.  In Python 3.14, the default will switch to ‘'data'’.
     (Contributed by Petr Viktorin in PEP 706(1).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0706/


File: python.info,  Node: Python 3 11 5での重要な変更点,  Prev: Python 3 11 4での重要な変更点,  Up: What's New In Python 3 11

1.4.18 Python 3.11.5での重要な変更点
------------------------------------

* Menu:

* OpenSSL::


File: python.info,  Node: OpenSSL,  Up: Python 3 11 5での重要な変更点

1.4.18.1 OpenSSL
................

   * Windows builds and macOS installers from python.org now use OpenSSL
     3.0.


File: python.info,  Node: What's New In Python 3 10,  Next: What's New In Python 3 9,  Prev: What's New In Python 3 11,  Up: What's New in Python

1.5 What's New In Python 3.10
=============================


編集者: Pablo Galindo Salgado

この記事では Python 3.9 と比較した Python 3.10 の新機能を解説します。
Python 3.10 は2021年10月4日にリリースされました。全詳細については *note
変更履歴: 142. をご覧ください。

* Menu:

* 概要: 概要 -- リリースハイライト<5>. リリースハイライト
* 新しい機能: 新しい機能<8>.
* 型ヒントに関連する新しい機能: 型ヒントに関連する新しい機能<3>.
* その他の言語変更: その他の言語変更<4>.
* 新たなモジュール: 新たなモジュール<4>.
* 改良されたモジュール: 改良されたモジュール<4>.
* 最適化: 最適化<5>.
* 非推奨: 非推奨<6>.
* 削除: 削除<6>.
* Porting to Python 3.10: Porting to Python 3 10.
* CPython バイトコードの変更: CPython バイトコードの変更<4>.
* Build Changes: Build Changes<4>.
* C API の変更: C API の変更<7>.
* Notable security feature in 3.10.7: Notable security feature in 3 10 7.
* Notable security feature in 3.10.8: Notable security feature in 3 10 8.
* Notable changes in 3.10.12: Notable changes in 3 10 12.


File: python.info,  Node: 概要 -- リリースハイライト<5>,  Next: 新しい機能<8>,  Up: What's New In Python 3 10

1.5.1 概要 - リリースハイライト
-------------------------------

新たな文法機能:

   * PEP 634(1)、構造的パターンマッチ: 仕様

   * PEP 635(2)、構造的パターンマッチ: モチベーションと原理

   * PEP 636(3)、構造的パターンマッチ: チュートリアル

   * bpo-12782(4)、カッコ内のコンテキストマネージャーが正式にサポート

標準ライブラリの新機能:

   * PEP 618(5)、zipに長さチェックのオプション引数が追加

インタプリタの改善:

   * PEP 626(6), デバッグおよびその他のツール用の正確な行番号。

新しい型ヒントの機能:

   * PEP 604(7), Unionタイプの X | Y 形式での表示

   * PEP 612(8), パラメータ指定変数

   * PEP 613(9), 明示的型エイリアス

   * PEP 647(10), ユーザ定義型ガード

重要な非推奨化、削除または制限:

   * PEP 644(11), OpenSSL 1.1.1 以降の必須化

   * PEP 632(12), distutilsモジュールが非推奨に

   * PEP 623(13), PyUnicodeObject の wstr メンバーの非推奨・削除への準備

   * PEP 624(14), Py_UNICODE エンコーダAPIの削除

   * PEP 597(15), 任意のEncodingWarningを追加

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0634/

   (2) https://peps.python.org/pep-0635/

   (3) https://peps.python.org/pep-0636/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=12782

   (5) https://peps.python.org/pep-0618/

   (6) https://peps.python.org/pep-0626/

   (7) https://peps.python.org/pep-0604/

   (8) https://peps.python.org/pep-0612/

   (9) https://peps.python.org/pep-0613/

   (10) https://peps.python.org/pep-0647/

   (11) https://peps.python.org/pep-0644/

   (12) https://peps.python.org/pep-0632/

   (13) https://peps.python.org/pep-0623/

   (14) https://peps.python.org/pep-0624/

   (15) https://peps.python.org/pep-0597/


File: python.info,  Node: 新しい機能<8>,  Next: 型ヒントに関連する新しい機能<3>,  Prev: 概要 -- リリースハイライト<5>,  Up: What's New In Python 3 10

1.5.2 新しい機能
----------------

* Menu:

* カッコ内のコンテキストマネージャー::
* エラーメッセージの改善: エラーメッセージの改善<4>.
* PEP 626; デバッグおよびその他のツール用の正確な行番号。: PEP 626 デバッグおよびその他のツール用の正確な行番号。.
* PEP 634; 構造的パターンマッチ: PEP 634 構造的パターンマッチ.
* Optional EncodingWarning and encoding="locale" option::


File: python.info,  Node: カッコ内のコンテキストマネージャー,  Next: エラーメッセージの改善<4>,  Up: 新しい機能<8>

1.5.2.1 カッコ内のコンテキストマネージャー
..........................................

コンテキストマネージャーを複数行で継続して記述する場合に、カッコで囲むこ
とができるようになりました。複数行でたくさんのコンテキストマネージャーを
記述するときに、従来のimport文と同じようにフォーマットできます。たとえば
、以下のすべての例は有効です:

     with (CtxManager() as example):
         ...

     with (
         CtxManager1(),
         CtxManager2()
     ):
         ...

     with (CtxManager1() as example,
           CtxManager2()):
         ...

     with (CtxManager1(),
           CtxManager2() as example):
         ...

     with (
         CtxManager1() as example1,
         CtxManager2() as example2
     ):
         ...

カッコに囲まれたグループの最後の要素に対する、末尾のカンマも指定可能です
。

     with (
         CtxManager1() as example1,
         CtxManager2() as example2,
         CtxManager3() as example3,
     ):
         ...

この新しい構文は、新パーサーによるLL(1)以外の能力を使用しています。詳細
は PEP 617(1) を参照してください。

(Guido van Rossum、Pablo Galindo、Lysandros Nikolaou の貢献による
bpo-12782(2)、bpo-40334(3))

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0617/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=12782

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40334


File: python.info,  Node: エラーメッセージの改善<4>,  Next: PEP 626 デバッグおよびその他のツール用の正確な行番号。,  Prev: カッコ内のコンテキストマネージャー,  Up: 新しい機能<8>

1.5.2.2 エラーメッセージの改善
..............................

* Menu:

* SyntaxErrors::
* IndentationErrors::
* AttributeErrors::
* NameErrors::


File: python.info,  Node: SyntaxErrors,  Next: IndentationErrors,  Up: エラーメッセージの改善<4>

1.5.2.3 SyntaxErrors
....................

閉じられていない括弧やブラケットを含むコードを解析する際、インタープリタ
はこれまでのように 'SyntaxError: unexpected EOF while parsing' を表示し
たり、誤った位置を指したりするのではなく、未閉鎖の括弧やブラケットの位置
を示すようになりました。たとえば、次のコードを考えてみましょう（未閉鎖の
'{' に注目してください）:

     expected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,
                 38: 4, 39: 4, 45: 5, 46: 5, 47: 5, 48: 5, 49: 5, 54: 6,
     some_other_code = foo()

以前のバージョンのインタープリタは、構文エラーの位置として混乱する場所を
報告していました:

     File "example.py", line 3
         some_other_code = foo()
                         ^
     SyntaxError: invalid syntax

しかしPython 3.10ではより有益なエラーが出力されます:

     File "example.py", line 1
         expected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,
                    ^
     SyntaxError: '{' was never closed

同様に、閉じられていない文字列リテラル（シングルクォートおよびトリプルク
ォート）に関するエラーも、これまでのように EOF/EOL を報告するのではなく
、文字列の開始位置を指すようになりました。

これらの改善は PyPy インタプリタのこれまでの取組から着想を得ました。

(Pablo Galindoの貢献による bpo-42864(1)、Batuhan Taskayaの貢献による
bpo-40176(2))

インタープリタによって発生する:exc:‘SyntaxError’ 例外は、これまで問題が
検出された箇所のみを強調表示していましたが、今後は構文エラーを構成する式
全体の範囲を強調表示するようになりました。このため、（ Python 3.10 以前
で）次のように表示されていたものが、

     >>> foo(x, z for z in range(10), t, w)
       File "<stdin>", line 1
         foo(x, z for z in range(10), t, w)
                ^
     SyntaxError: Generator expression must be parenthesized

Python 3.10 では例外は次のように表示されるようになります:

     >>> foo(x, z for z in range(10), t, w)
       File "<stdin>", line 1
         foo(x, z for z in range(10), t, w)
                ^^^^^^^^^^^^^^^^^^^^
     SyntaxError: Generator expression must be parenthesized

この改善は Pablo Galindo の貢献で実現しました bpo-43914(3)。

多くの新しい種類の:exc:‘SyntaxError’ 例外に対して、より具体的でわかりや
すいエラーメッセージが追加されました。その中でも特に注目すべきものを以下
に示します。

   * ブロックの前の ‘:’ が存在しない:

          >>> if rocket.position > event_horizon
            File "<stdin>", line 1
              if rocket.position > event_horizon
                                                ^
          SyntaxError: expected ':'

     (Pablo Galindo の貢献による bpo-42997(4))

   * 内包表記のターゲットにカッコのないタプルを使用:

          >>> {x,y for x,y in zip('abcd', '1234')}
            File "<stdin>", line 1
              {x,y for x,y in zip('abcd', '1234')}
               ^
          SyntaxError: did you forget parentheses around the comprehension target?

     (Pablo Galindo の貢献による bpo-43017(5))

   * コレクションリテラルや式の間のカンマが存在しない:

          >>> items = {
          ... x: 1,
          ... y: 2
          ... z: 3,
            File "<stdin>", line 3
              y: 2
                 ^
          SyntaxError: invalid syntax. Perhaps you forgot a comma?

     (Pablo Galindo の貢献による bpo-43822(6))

   * 複数の例外の型をカッコで囲んでいない:

          >>> try:
          ...     build_dyson_sphere()
          ... except NotEnoughScienceError, NotEnoughResourcesError:
            File "<stdin>", line 3
              except NotEnoughScienceError, NotEnoughResourcesError:
                     ^
          SyntaxError: multiple exception types must be parenthesized

     (Pablo Galindo の貢献による bpo-43149(7))

   * 辞書のリテラルで ‘:’ と値が存在しない:

          >>> values = {
          ... x: 1,
          ... y: 2,
          ... z:
          ... }
            File "<stdin>", line 4
              z:
               ^
          SyntaxError: expression expected after dictionary key and ':'

          >>> values = {x:1, y:2, z w:3}
            File "<stdin>", line 1
              values = {x:1, y:2, z w:3}
                                  ^
          SyntaxError: ':' expected after dictionary key

     (Pablo Galindo の貢献による bpo-43823(8))

   * ‘try’ ブロックに ‘except’ または ‘finally’ ブロックが存在しない:

          >>> try:
          ...     x = 2
          ... something = 3
            File "<stdin>", line 3
              something  = 3
              ^^^^^^^^^
          SyntaxError: expected 'except' or 'finally' block

     (Pablo Galindo の貢献による bpo-44305(9))

   * 比較で ‘==’ の代わりに ‘=’ を使用している:

          >>> if rocket.position = event_horizon:
            File "<stdin>", line 1
              if rocket.position = event_horizon:
                                 ^
          SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='?

     (Pablo Galindo の貢献による bpo-43797(10))

   * f-stringで ‘*’ を使用している:

          >>> f"Black holes {*all_black_holes} and revelations"
            File "<stdin>", line 1
              (*all_black_holes)
               ^
          SyntaxError: f-string: cannot use starred expression here

     (Pablo Galindo の貢献による bpo-41064(11))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42864

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40176

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43914

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42997

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43017

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43822

   (7) https://bugs.python.org/issue?@action=redirect&bpo=43149

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43823

   (9) https://bugs.python.org/issue?@action=redirect&bpo=44305

   (10) https://bugs.python.org/issue?@action=redirect&bpo=43797

   (11) https://bugs.python.org/issue?@action=redirect&bpo=41064


File: python.info,  Node: IndentationErrors,  Next: AttributeErrors,  Prev: SyntaxErrors,  Up: エラーメッセージの改善<4>

1.5.2.4 IndentationErrors
.........................

多くの:exc:‘IndentationError’ 例外において、どの種類のブロックでインデン
トが期待されていたのか、その文の位置に関する情報が追加されるようになりま
した。

     >>> def foo():
     ...    if lel:
     ...    x = 2
       File "<stdin>", line 3
         x = 2
         ^
     IndentationError: expected an indented block after 'if' statement in line 2


File: python.info,  Node: AttributeErrors,  Next: NameErrors,  Prev: IndentationErrors,  Up: エラーメッセージの改善<4>

1.5.2.5 AttributeErrors
.......................

When printing *note AttributeError: 5f0, ‘PyErr_Display()’ will offer
suggestions of similar attribute names in the object that the exception
was raised from:

     >>> collections.namedtoplo
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     AttributeError: module 'collections' has no attribute 'namedtoplo'. Did you mean: namedtuple?

(Pablo Galindo の貢献による bpo-38530(1))

     警告: Notice this won't work if ‘PyErr_Display()’ is not called to
     display the error which can happen if some other custom error
     display function is used.  This is a common scenario in some REPLs
     like IPython.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38530


File: python.info,  Node: NameErrors,  Prev: AttributeErrors,  Up: エラーメッセージの改善<4>

1.5.2.6 NameErrors
..................

When printing *note NameError: 452. raised by the interpreter,
‘PyErr_Display()’ will offer suggestions of similar variable names in
the function that the exception was raised from:

     >>> schwarzschild_black_hole = None
     >>> schwarschild_black_hole
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     NameError: name 'schwarschild_black_hole' is not defined. Did you mean: schwarzschild_black_hole?

(Pablo Galindo の貢献による bpo-38530(1))

     警告: Notice this won't work if ‘PyErr_Display()’ is not called to
     display the error, which can happen if some other custom error
     display function is used.  This is a common scenario in some REPLs
     like IPython.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38530


File: python.info,  Node: PEP 626 デバッグおよびその他のツール用の正確な行番号。,  Next: PEP 634 構造的パターンマッチ,  Prev: エラーメッセージの改善<4>,  Up: 新しい機能<8>

1.5.2.7 PEP 626: デバッグおよびその他のツール用の正確な行番号。
...............................................................

PEP 626 brings more precise and reliable line numbers for debugging,
profiling and coverage tools.  Tracing events, with the correct line
number, are generated for all lines of code executed and only for lines
of code that are executed.

The *note f_lineno: 9af. attribute of frame objects will always contain
the expected line number.

The *note co_lnotab: 330. attribute of *note code objects: 4e6. is
deprecated and will be removed in 3.12.  Code that needs to convert from
offset to line number should use the new *note co_lines(): 350. method
instead.


File: python.info,  Node: PEP 634 構造的パターンマッチ,  Next: Optional EncodingWarning and encoding="locale" option,  Prev: PEP 626 デバッグおよびその他のツール用の正確な行番号。,  Up: 新しい機能<8>

1.5.2.8 PEP 634: 構造的パターンマッチ
.....................................

Structural pattern matching has been added in the form of a 'match
statement' and 'case statements' of patterns with associated actions.
Patterns consist of sequences, mappings, primitive data types as well as
class instances.  Pattern matching enables programs to extract
information from complex data types, branch on the structure of data,
and apply specific actions based on different forms of data.

* Menu:

* 構文と演算::
* 宣言的なアプローチ::
* 単純パターン; リテラルとのマッチ: 単純パターン リテラルとのマッチ.
* リテラルと変数を組み合わせたパターン::
* パターンとクラス::
* ネストしたパターン::
* 複雑なパターンとワイルドカード::
* ガード::
* その他の主要な機能::


File: python.info,  Node: 構文と演算,  Next: 宣言的なアプローチ,  Up: PEP 634 構造的パターンマッチ

1.5.2.9 構文と演算
..................

パターンマッチングの一般的な構文は次のとおりです:

     match subject:
         case <pattern_1>:
             <action_1>
         case <pattern_2>:
             <action_2>
         case <pattern_3>:
             <action_3>
         case _:
             <action_wildcard>

match 文は式を取り、その値を 1 つ以上の case ブロックで指定されたパター
ンと順に比較します。具体的には、パターンマッチングは次の手順で動作します
:

  1. 型と構造を持つデータ（‘subject’）を使用する

  2. ‘match’ 文内で ‘subject’ を評価する

  3. ‘case’ 文の各パターンと上から順に比較し、一致が確認されるまで進める

  4. 一致が確認されたパターンに関連付けられた処理を実行する

  5. 完全一致するパターンがない場合、最後にワイルドカード ‘_’ が指定され
     ていれば、それが一致ケースとして使用されます。完全一致もワイルドカ
     ードも存在しない場合、 match ブロック全体は何も実行されません（
     no-op となります）。


File: python.info,  Node: 宣言的なアプローチ,  Next: 単純パターン リテラルとのマッチ,  Prev: 構文と演算,  Up: PEP 634 構造的パターンマッチ

1.5.2.10 宣言的なアプローチ
...........................

読者の中には、C、Java、JavaScript（およびその他多くの言語）における
switch 文を通じて、対象（データオブジェクト）をリテラル（パターン）と照
合する単純な例として、パターンマッチングに馴染みがある方もいるでしょう。
多くの場合、 switch 文はオブジェクトや式を、リテラルを含む複数の case 文
と比較するために使用されます。

より強力なパターンマッチングの例は、Scala や Elixir のような言語で見られ
ます。構造的パターンマッチングでは、アプローチは「宣言的」であり、データ
が一致するための条件（パターン）を明示的に記述します。

これに対して、「命令的」なアプローチでは、入れ子になった if 文を用いて構
造的パターンマッチングと同様の処理を実現することも可能ですが、「宣言的」
な方法ほど明確ではありません。宣言的アプローチでは、一致のために満たすべ
き条件を明示的なパターンとして記述するため、より読みやすくなります。構造
的パターンマッチングは、最も単純な形では case 文で変数とリテラルを比較す
るものとして使用できますが、 Python における真の価値は、対象の型や構造を
扱える点にあります。


File: python.info,  Node: 単純パターン リテラルとのマッチ,  Next: リテラルと変数を組み合わせたパターン,  Prev: 宣言的なアプローチ,  Up: PEP 634 構造的パターンマッチ

1.5.2.11 単純パターン: リテラルとのマッチ
.........................................

最も基本的な形のパターンマッチングの例を見てみましょう。ここでは、値（＝
対象、subject）が複数のリテラル、すなわちパターンと照合されます。以下の
例では、‘status’ が match 文の対象です。 各 case 文のパターンは、リクエ
ストのステータスコードを表すリテラルです。一致が見つかると、その case に
対応する処理が実行されます。

     def http_error(status):
         match status:
             case 400:
                 return "Bad request"
             case 404:
                 return "Not found"
             case 418:
                 return "I'm a teapot"
             case _:
                 return "Something's wrong with the internet"

上記の関数に ‘status’ として 418 が渡された場合は、 "I'm a teapot" が返
されます。一方、 500 が渡された場合には、ワイルドカードとして機能する
‘_’ を使用した case 文が一致し、 "Something's wrong with the internet" が
返されます。ここで、最後のブロックに注目してください。変数名 ‘_’ はワイ
ルドカードとして機能し、対象と必ず一致することを保証します。なお、 ‘_’ の
使用は任意です。

複数のリテラルを ‘|’ ("or")を使用して組み合わせて1つのパターンにできます
。

     case 401 | 403 | 404:
         return "Not allowed"

* Menu:

* ワイルドカードがないときの振る舞い::


File: python.info,  Node: ワイルドカードがないときの振る舞い,  Up: 単純パターン リテラルとのマッチ

1.5.2.12 ワイルドカードがないときの振る舞い
...........................................

上記の例から最後の case ブロックを削除すると、次のようになります:

     def http_error(status):
         match status:
             case 400:
                 return "Bad request"
             case 404:
                 return "Not found"
             case 418:
                 return "I'm a teapot"

case 文で ‘_’ を使用しない場合、一致するパターンが存在しない可能性があり
ます。一致するパターンがない場合、その処理は何も実行されずスキップされま
す。たとえば、 ‘status’ に 500 が渡された場合、この例では何も起こりませ
ん。


File: python.info,  Node: リテラルと変数を組み合わせたパターン,  Next: パターンとクラス,  Prev: 単純パターン リテラルとのマッチ,  Up: PEP 634 構造的パターンマッチ

1.5.2.13 リテラルと変数を組み合わせたパターン
.............................................

パターンはアンパック代入のように記述することで、変数をバインドするために
使用することもできます。次の例では、データポイントを展開して、その x 座
標と y 座標を取得しています:

     # point は (x, y) のタプル
     match point:
         case (0, 0):
             print("Origin")
         case (0, y):
             print(f"Y={y}")
         case (x, 0):
             print(f"X={x}")
         case (x, y):
             print(f"X={x}, Y={y}")
         case _:
             raise ValueError("Not a point")

最初のパターン ‘(0, 0)’ は 2 つのリテラルから構成されており、上で示した
リテラルパターン拡張と考えることができます。次の 2 つのパターンでは、リ
テラルと変数が組み合わされており、変数は対象（‘point’）から値を取り出し
て変数にバインドします。4 番目のパターンは 2 つの値を同時に取得しており
、これはアンパック代入 ‘(x, y) = point’ と概念的に似ています。


File: python.info,  Node: パターンとクラス,  Next: ネストしたパターン,  Prev: リテラルと変数を組み合わせたパターン,  Up: PEP 634 構造的パターンマッチ

1.5.2.14 パターンとクラス
.........................

データを構造化するためにクラスを使用している場合は、クラス名の後ろにコン
ストラクタのように引数リストを指定することで、クラスをパターンとして使用
できます。このパターンでは、インスタンスの属性を変数にバインドすることが
可能です:

     class Point:
         def __init__(self, x, y):
             self.x = x
             self.y = y

     def location(point):
         match point:
             case Point(x=0, y=0):
                 print("原点")
             case Point(x=0, y=y):
                 print(f"Y座標は {y} で点はY軸上にある")
             case Point(x=x, y=0):
                 print(f"X座標は {x} で点はX軸上にある")
             case Point():
                 print("点は平面上のそれ以外のどこかにある")
             case _:
                 print("座標ではない")

* Menu:

* 位置パラメータを用いたパターン::


File: python.info,  Node: 位置パラメータを用いたパターン,  Up: パターンとクラス

1.5.2.15 位置パラメータを用いたパターン
.......................................

いくつかの組み込みクラスでは位置引数が使用でき、属性の順番を提供します
(例: データクラス)。クラスの ‘__match_args__’ 特殊属性でによって、パター
ンの中で属性の明確な位置を定義することもできます。("x", "y")が設定された
場合、以下のすべてのパターンは等価です(すべて属性 ‘y’ が ‘var’ 変数に関
連づけられます):

     Point(1, var)
     Point(1, y=var)
     Point(x=1, y=var)
     Point(y=var, x=1)


File: python.info,  Node: ネストしたパターン,  Next: 複雑なパターンとワイルドカード,  Prev: パターンとクラス,  Up: PEP 634 構造的パターンマッチ

1.5.2.16 ネストしたパターン
...........................

パターンは任意に入れ子にすることができます。たとえば、データが複数のポイ
ントを含む短いリストである場合、次のようにマッチさせることができます:

     match points:
         case []:
             print("リストに座標がない")
         case [Point(0, 0)]:
             print("リスト中には原点が1つのみある")
         case [Point(x, y)]:
             print(f"リスト中に {x}, {y} の点が1つある")
         case [Point(0, y1), Point(0, y2)]:
             print(f"リスト中にY軸上の2つの点 {y1}、{y2} がある")
         case _:
             print("リスト中にそれ以外のデータが見つかった")


File: python.info,  Node: 複雑なパターンとワイルドカード,  Next: ガード,  Prev: ネストしたパターン,  Up: PEP 634 構造的パターンマッチ

1.5.2.17 複雑なパターンとワイルドカード
.......................................

ここまでの例では、最後の case 文で ‘_’ を単独のワイルドカードとして使用
してきました。しかし、ワイルドカードはより複雑なパターン内でも使用できま
す。たとえば、 ‘('error', code, _)’ のように使用することができます。

     match test_variable:
         case ('warning', code, 40):
             print("警告を受け取った")
         case ('error', code, _):
             print(f"エラー {code} が発生した")

上記のケースでは、 ‘test_variable’ は ('error', code, 100) と ('error',
code, 800) にマッチします。


File: python.info,  Node: ガード,  Next: その他の主要な機能,  Prev: 複雑なパターンとワイルドカード,  Up: PEP 634 構造的パターンマッチ

1.5.2.18 ガード
...............

パターンに ‘if’ 節を追加できます。これは "ガード" と呼ばれます。ガードが
falseの場合、‘match’ は次のcaseブロックの処理に移動します。ガードを評価
する前に値が取り出されることに注意してください:

     match point:
         case Point(x, y) if x == y:
             print(f"座標は対角線 Y=X 上の {x} の位置にある")
         case Point(x, y):
             print(f"座標の位置は対角線上ではない")


File: python.info,  Node: その他の主要な機能,  Prev: ガード,  Up: PEP 634 構造的パターンマッチ

1.5.2.19 その他の主要な機能
...........................

その他のいくつかの主要な機能:

   - アンパック代入と同様に、タプルおよびリストのパターンはまったく同じ
     意味を持ち、任意のシーケンスにマッチします。技術的には、対象はシー
     ケンスである必要があります。そのため、重要な例外として、パターンは
     イテレータにはマッチしません。また、よくある誤りを防ぐために、シー
     ケンスパターンは文字列にもマッチしません。

   - シーケンスパターンではワイルドカードをサポートしています。たとえば
     、‘[x, y, *rest]’ や ‘(x, y, *rest)’ は、アンパック代入におけるワイ
     ルドカードと同様に動作します。‘*’ の後の名前を ‘_’ にすることもでき
     、‘(x, y, *_)’ は少なくとも 2 つの要素を持つシーケンスにマッチしま
     すが、残りの要素は変数に束縛されません。

   - マッピングパターン: ‘{"bandwidth": b, "latency": l}’ では、辞書から
     ‘"bandwidth"’ と ‘"latency"’ の値を取得します。シーケンスパターンと
     は異なり、余分なキーは無視されます。また、ワイルドカード ‘**rest’ も
     サポートされています。（ただし、‘**_’ は冗長になるため使用できませ
     ん。）

   - サブパターンでは ‘as’ キーワードを使用して値を取り込みます:

          case (Point(x1, y1), Point(x2, y2) as p2): ...

     このように書くと x1、y1、x2、y2 は ‘as’ 節を使わないときと同様に、
     さらにp2に対象の2番目の要素全体がバインドされます。

   - ほとんどのリテラルは同一性を比較します。しかし、シングルトンの
     ‘True’、‘False’、‘None’ では識別値を比較します。

   - 名前を付けた定数をパターンに使用できます。名前を付けた定数を、値を
     取り込む変数として解釈することを防ぐために、ドット付きの変数名にす
     る必要があります。

          from enum import Enum
          class Color(Enum):
              RED = 0
              GREEN = 1
              BLUE = 2

          color = Color.GREEN
          match color:
              case Color.RED:
                  print("I see red!")
              case Color.GREEN:
                  print("Grass is green")
              case Color.BLUE:
                  print("I'm feeling the blues :(")

完全な仕様については PEP 634(1) を参照してください。モチベーションと理論
的根拠は PEP 635(2) に、より詳細なチュートリアルは PEP 636(3) にあります
。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0634/

   (2) https://peps.python.org/pep-0635/

   (3) https://peps.python.org/pep-0636/


File: python.info,  Node: Optional EncodingWarning and encoding="locale" option,  Prev: PEP 634 構造的パターンマッチ,  Up: 新しい機能<8>

1.5.2.20 Optional ‘EncodingWarning’ and ‘encoding="locale"’ option
..................................................................

The default encoding of *note TextIOWrapper: 9be. and *note open(): 316.
is platform and locale dependent.  Since UTF-8 is used on most Unix
platforms, omitting ‘encoding’ option when opening UTF-8 files (e.g.
JSON, YAML, TOML, Markdown) is a very common bug.  For example:

     # BUG: "rb" mode or encoding="utf-8" should be used.
     with open("data.json") as f:
         data = json.load(f)

To find this type of bug, an optional ‘EncodingWarning’ is added.  It is
emitted when *note sys.flags.warn_default_encoding: 89c. is true and
locale-specific default encoding is used.

‘-X warn_default_encoding’ option and *note PYTHONWARNDEFAULTENCODING:
9bf. are added to enable the warning.

See *note Text Encoding: 9c0. for more information.


File: python.info,  Node: 型ヒントに関連する新しい機能<3>,  Next: その他の言語変更<4>,  Prev: 新しい機能<8>,  Up: What's New In Python 3 10

1.5.3 型ヒントに関連する新しい機能
----------------------------------

This section covers major changes affecting PEP 484(1) type hints and
the *note typing: 10a. module.

* Menu:

* PEP 604; New Type Union Operator: PEP 604 New Type Union Operator.
* PEP 612; Parameter Specification Variables: PEP 612 Parameter Specification Variables.
* PEP 613; TypeAlias: PEP 613 TypeAlias.
* PEP 647; User-Defined Type Guards: PEP 647 User-Defined Type Guards.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/


File: python.info,  Node: PEP 604 New Type Union Operator,  Next: PEP 612 Parameter Specification Variables,  Up: 型ヒントに関連する新しい機能<3>

1.5.3.1 PEP 604: New Type Union Operator
........................................

A new type union operator was introduced which enables the syntax ‘X |
Y’.  This provides a cleaner way of expressing 'either type X or type Y'
instead of using *note typing.Union: 2a8, especially in type hints.

In previous versions of Python, to apply a type hint for functions
accepting arguments of multiple types, *note typing.Union: 2a8. was
used:

     def square(number: Union[int, float]) -> Union[int, float]:
         return number ** 2

Type hints can now be written in a more succinct manner:

     def square(number: int | float) -> int | float:
         return number ** 2

This new syntax is also accepted as the second argument to *note
isinstance(): 2ad. and *note issubclass(): 9c4.:

     >>> isinstance(1, int | str)
     True

See *note Union 型: 9c5. and PEP 604(1) for more details.

(Contributed by Maggie Moss and Philippe Prados in bpo-41428(2), with
additions by Yurii Karabas and Serhiy Storchaka in bpo-44490(3).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0604/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41428

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44490


File: python.info,  Node: PEP 612 Parameter Specification Variables,  Next: PEP 613 TypeAlias,  Prev: PEP 604 New Type Union Operator,  Up: 型ヒントに関連する新しい機能<3>

1.5.3.2 PEP 612: Parameter Specification Variables
..................................................

Two new options to improve the information provided to static type
checkers for PEP 484(1)'s ‘Callable’ have been added to the *note
typing: 10a. module.

The first is the parameter specification variable.  They are used to
forward the parameter types of one callable to another callable - a
pattern commonly found in higher order functions and decorators.
Examples of usage can be found in *note typing.ParamSpec: 487.
Previously, there was no easy way to type annotate dependency of
parameter types in such a precise manner.

The second option is the new ‘Concatenate’ operator.  It's used in
conjunction with parameter specification variables to type annotate a
higher order callable which adds or removes parameters of another
callable.  Examples of usage can be found in *note typing.Concatenate:
9c7.

See *note typing.Callable: 9c8, *note typing.ParamSpec: 487, *note
typing.Concatenate: 9c7, *note typing.ParamSpecArgs: 9c9, *note
typing.ParamSpecKwargs: 9ca, and PEP 612(2) for more details.

(Contributed by Ken Jin in bpo-41559(3), with minor enhancements by
Jelle Zijlstra in bpo-43783(4).  PEP written by Mark Mendoza.)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/

   (2) https://peps.python.org/pep-0612/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41559

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43783


File: python.info,  Node: PEP 613 TypeAlias,  Next: PEP 647 User-Defined Type Guards,  Prev: PEP 612 Parameter Specification Variables,  Up: 型ヒントに関連する新しい機能<3>

1.5.3.3 PEP 613: TypeAlias
..........................

PEP 484(1) introduced the concept of type aliases, only requiring them
to be top-level unannotated assignments.  This simplicity sometimes made
it difficult for type checkers to distinguish between type aliases and
ordinary assignments, especially when forward references or invalid
types were involved.  Compare:

     StrCache = 'Cache[str]'  # a type alias
     LOG_PREFIX = 'LOG[DEBUG]'  # a module constant

Now the *note typing: 10a. module has a special value *note TypeAlias:
9cc. which lets you declare type aliases more explicitly:

     StrCache: TypeAlias = 'Cache[str]'  # a type alias
     LOG_PREFIX = 'LOG[DEBUG]'  # a module constant

より詳しくは、 PEP 613(2) をご覧ください。

(Contributed by Mikhail Golubev in bpo-41923(3).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/

   (2) https://peps.python.org/pep-0613/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41923


File: python.info,  Node: PEP 647 User-Defined Type Guards,  Prev: PEP 613 TypeAlias,  Up: 型ヒントに関連する新しい機能<3>

1.5.3.4 PEP 647: User-Defined Type Guards
.........................................

*note TypeGuard: 48c. has been added to the *note typing: 10a. module to
annotate type guard functions and improve information provided to static
type checkers during type narrowing.  For more information, please see
*note TypeGuard: 48c.'s documentation, and PEP 647(1).

(Contributed by Ken Jin and Guido van Rossum in bpo-43766(2).  PEP
written by Eric Traut.)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0647/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43766


File: python.info,  Node: その他の言語変更<4>,  Next: 新たなモジュール<4>,  Prev: 型ヒントに関連する新しい機能<3>,  Up: What's New In Python 3 10

1.5.4 その他の言語変更
----------------------

   * The *note int: 19b. type has a new method *note int.bit_count():
     9cf, returning the number of ones in the binary expansion of a
     given integer, also known as the population count.  (Contributed by
     Niklas Fiekas in bpo-29882(1).)

   * The views returned by *note dict.keys(): 9d0, *note dict.values():
     9d1. and *note dict.items(): 9d2. now all have a ‘mapping’
     attribute that gives a *note types.MappingProxyType: 698. object
     wrapping the original dictionary.  (Contributed by Dennis Sweeney
     in bpo-40890(2).)

   * PEP 618(3): The *note zip(): 1a0. function now has an optional
     ‘strict’ flag, used to require that all the iterables have an equal
     length.

   * Builtin and extension functions that take integer arguments no
     longer accept *note Decimal: 1fe.s, *note Fraction: 213.s and other
     objects that can be converted to integers only with a loss (e.g.
     that have the *note __int__(): 19d. method but do not have the
     *note __index__(): 19e. method).  (Contributed by Serhiy Storchaka
     in bpo-37999(4).)

   * If *note object.__ipow__(): 9d3. returns *note NotImplemented: 1a2,
     the operator will correctly fall back to *note object.__pow__():
     9d4. and *note object.__rpow__(): 1a5. as expected.  (Contributed
     by Alex Shkop in bpo-38302(5).)

   * Assignment expressions can now be used unparenthesized within set
     literals and set comprehensions, as well as in sequence indexes
     (but not slices).

   * Functions have a new ‘__builtins__’ attribute which is used to look
     for builtin symbols when a function is executed, instead of looking
     into ‘__globals__['__builtins__']’.  The attribute is initialized
     from ‘__globals__["__builtins__"]’ if it exists, else from the
     current builtins.  (Contributed by Mark Shannon in bpo-42990(6).)

   * Two new builtin functions - *note aiter(): 9d5. and *note anext():
     9d6. have been added to provide asynchronous counterparts to *note
     iter(): 9d7. and *note next(): 9d8, respectively.  (Contributed by
     Joshua Bronson, Daniel Pope, and Justin Wang in bpo-31861(7).)

   * Static methods (*note @staticmethod: 453.) and class methods (*note
     @classmethod: 48e.) now inherit the method attributes
     (‘__module__’, ‘__name__’, ‘__qualname__’, ‘__doc__’,
     ‘__annotations__’) and have a new ‘__wrapped__’ attribute.
     Moreover, static methods are now callable as regular functions.
     (Contributed by Victor Stinner in bpo-43682(8).)

   * Annotations for complex targets (everything beside ‘simple name’
     targets defined by PEP 526(9)) no longer cause any runtime effects
     with ‘from __future__ import annotations’.  (Contributed by Batuhan
     Taskaya in bpo-42737(10).)

   * Class and module objects now lazy-create empty annotations dicts on
     demand.  The annotations dicts are stored in the object’s
     ‘__dict__’ for backwards compatibility.  This improves the best
     practices for working with ‘__annotations__’; for more information,
     please see *note Annotations Best Practices: 9d9.  (Contributed by
     Larry Hastings in bpo-43901(11).)

   * Annotations consist of ‘yield’, ‘yield from’, ‘await’ or named
     expressions are now forbidden under ‘from __future__ import
     annotations’ due to their side effects.  (Contributed by Batuhan
     Taskaya in bpo-42725(12).)

   * Usage of unbound variables, ‘super()’ and other expressions that
     might alter the processing of symbol table as annotations are now
     rendered effectless under ‘from __future__ import annotations’.
     (Contributed by Batuhan Taskaya in bpo-42725(13).)

   * Hashes of NaN values of both *note float: 196. type and *note
     decimal.Decimal: 1fe. type now depend on object identity.
     Formerly, they always hashed to ‘0’ even though NaN values are not
     equal to one another.  This caused potentially quadratic runtime
     behavior due to excessive hash collisions when creating
     dictionaries and sets containing multiple NaNs.  (Contributed by
     Raymond Hettinger in bpo-43475(14).)

   * A *note SyntaxError: 18e. (instead of a *note NameError: 452.) will
     be raised when deleting the *note __debug__: 9da. constant.
     (Contributed by Donghee Na in bpo-45000(15).)

   * *note SyntaxError: 18e. exceptions now have ‘end_lineno’ and
     ‘end_offset’ attributes.  They will be ‘None’ if not determined.
     (Contributed by Pablo Galindo in bpo-43914(16).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29882

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40890

   (3) https://peps.python.org/pep-0618/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=37999

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38302

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42990

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31861

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43682

   (9) https://peps.python.org/pep-0526/

   (10) https://bugs.python.org/issue?@action=redirect&bpo=42737

   (11) https://bugs.python.org/issue?@action=redirect&bpo=43901

   (12) https://bugs.python.org/issue?@action=redirect&bpo=42725

   (13) https://bugs.python.org/issue?@action=redirect&bpo=42725

   (14) https://bugs.python.org/issue?@action=redirect&bpo=43475

   (15) https://bugs.python.org/issue?@action=redirect&bpo=45000

   (16) https://bugs.python.org/issue?@action=redirect&bpo=43914


File: python.info,  Node: 新たなモジュール<4>,  Next: 改良されたモジュール<4>,  Prev: その他の言語変更<4>,  Up: What's New In Python 3 10

1.5.5 新たなモジュール
----------------------

   * None.


File: python.info,  Node: 改良されたモジュール<4>,  Next: 最適化<5>,  Prev: 新たなモジュール<4>,  Up: What's New In Python 3 10

1.5.6 改良されたモジュール
--------------------------

* Menu:

* asyncio: asyncio<7>.
* argparse: argparse<4>.
* array: array<2>.
* asynchat, asyncore, smtpd: asynchat asyncore smtpd.
* base64: base64<3>.
* bdb: bdb<2>.
* bisect::
* codecs::
* collections.abc: collections abc.
* contextlib: contextlib<2>.
* curses: curses<2>.
* データクラス: データクラス<2>.
* distutils: distutils<2>.
* doctest: doctest<2>.
* エンコーディング::
* enum: enum<4>.
* fileinput::
* faulthandler: faulthandler<2>.
* gc: gc<2>.
* glob: glob<2>.
* hashlib: hashlib<3>.
* hmac: hmac<2>.
* IDLE と idelelib: IDLE と idelelib<2>.
* importlib.metadata: importlib metadata<2>.
* inspect: inspect<4>.
* itertools: itertools<4>.
* linecache: linecache<2>.
* os: os<5>.
* os.path: os path<4>.
* pathlib: pathlib<8>.
* プラットフォーム: プラットフォーム<3>.
* pprint::
* py_compile::
* pyclbr::
* shelve::
* statistics: statistics<3>.
* site: site<2>.
* socket: socket<3>.
* ssl: ssl<4>.
* sqlite3: sqlite3<6>.
* sys: sys<5>.
* _thread::
* threading: threading<4>.
* traceback: traceback<3>.
* types: types<4>.
* typing: typing<6>.
* unittest: unittest<6>.
* urllib.parse: urllib parse.
* xml: xml<2>.
* zipimport: zipimport<3>.


File: python.info,  Node: asyncio<7>,  Next: argparse<4>,  Up: 改良されたモジュール<4>

1.5.6.1 asyncio
...............

Add missing *note connect_accepted_socket(): 9de. method.  (Contributed
by Alex Grönholm in bpo-41332(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41332


File: python.info,  Node: argparse<4>,  Next: array<2>,  Prev: asyncio<7>,  Up: 改良されたモジュール<4>

1.5.6.2 argparse
................

Misleading phrase "optional arguments" was replaced with "options" in
argparse help.  Some tests might require adaptation if they rely on
exact output match.  (Contributed by Raymond Hettinger in bpo-9694(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9694


File: python.info,  Node: array<2>,  Next: asynchat asyncore smtpd,  Prev: argparse<4>,  Up: 改良されたモジュール<4>

1.5.6.3 array
.............

The *note index(): 9e1. method of *note array.array: 4be. now has
optional 'start' and 'stop' parameters.  (Contributed by Anders
Lorentsen and Zackery Spytz in bpo-31956(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31956


File: python.info,  Node: asynchat asyncore smtpd,  Next: base64<3>,  Prev: array<2>,  Up: 改良されたモジュール<4>

1.5.6.4 asynchat, asyncore, smtpd
.................................

These modules have been marked as deprecated in their module
documentation since Python 3.6.  An import-time *note
DeprecationWarning: 1a3. has now been added to all three of these
modules.


File: python.info,  Node: base64<3>,  Next: bdb<2>,  Prev: asynchat asyncore smtpd,  Up: 改良されたモジュール<4>

1.5.6.5 base64
..............

Add *note base64.b32hexencode(): 9e4. and *note base64.b32hexdecode():
9e5. to support the Base32 Encoding with Extended Hex Alphabet.


File: python.info,  Node: bdb<2>,  Next: bisect,  Prev: base64<3>,  Up: 改良されたモジュール<4>

1.5.6.6 bdb
...........

Add ‘clearBreakpoints()’ to reset all set breakpoints.  (Contributed by
Irit Katriel in bpo-24160(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24160


File: python.info,  Node: bisect,  Next: codecs,  Prev: bdb<2>,  Up: 改良されたモジュール<4>

1.5.6.7 bisect
..............

Added the possibility of providing a 'key' function to the APIs in the
*note bisect: 12. module.  (Contributed by Raymond Hettinger in
bpo-4356(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=4356


File: python.info,  Node: codecs,  Next: collections abc,  Prev: bisect,  Up: 改良されたモジュール<4>

1.5.6.8 codecs
..............

Add a *note codecs.unregister(): 9e9. function to unregister a codec
search function.  (Contributed by Hai Shi in bpo-41842(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41842


File: python.info,  Node: collections abc,  Next: contextlib<2>,  Prev: codecs,  Up: 改良されたモジュール<4>

1.5.6.9 collections.abc
.......................

The ‘__args__’ of the *note parameterized generic: 8c1. for *note
collections.abc.Callable: 9eb. are now consistent with *note
typing.Callable: 9c8.  *note collections.abc.Callable: 9eb. generic now
flattens type parameters, similar to what *note typing.Callable: 9c8.
currently does.  This means that ‘collections.abc.Callable[[int, str],
str]’ will have ‘__args__’ of ‘(int, str, str)’; previously this was
‘([int, str], str)’.  To allow this change, *note types.GenericAlias:
9ec. can now be subclassed, and a subclass will be returned when
subscripting the *note collections.abc.Callable: 9eb. type.  Note that a
*note TypeError: 198. may be raised for invalid forms of parameterizing
*note collections.abc.Callable: 9eb. which may have passed silently in
Python 3.9.  (Contributed by Ken Jin in bpo-42195(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42195


File: python.info,  Node: contextlib<2>,  Next: curses<2>,  Prev: collections abc,  Up: 改良されたモジュール<4>

1.5.6.10 contextlib
...................

Add a *note contextlib.aclosing(): 9ee. context manager to safely close
async generators and objects representing asynchronously released
resources.  (Contributed by Joongi Kim and John Belmonte in
bpo-41229(1).)

Add asynchronous context manager support to *note
contextlib.nullcontext(): 9ef.  (Contributed by Tom Gringauz in
bpo-41543(2).)

Add *note AsyncContextDecorator: 9f0, for supporting usage of async
context managers as decorators.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41229

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41543


File: python.info,  Node: curses<2>,  Next: データクラス<2>,  Prev: contextlib<2>,  Up: 改良されたモジュール<4>

1.5.6.11 curses
...............

The extended color functions added in ncurses 6.1 will be used
transparently by *note curses.color_content(): 9f2, *note
curses.init_color(): 9f3, *note curses.init_pair(): 9f4, and *note
curses.pair_content(): 9f5.  A new function, *note
curses.has_extended_color_support(): 9f6, indicates whether extended
color support is provided by the underlying ncurses library.
(Contributed by Jeffrey Kintscher and Hans Petter Jansson in
bpo-36982(1).)

The ‘BUTTON5_*’ constants are now exposed in the *note curses: 2f.
module if they are provided by the underlying curses library.
(Contributed by Zackery Spytz in bpo-39273(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36982

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39273


File: python.info,  Node: データクラス<2>,  Next: distutils<2>,  Prev: curses<2>,  Up: 改良されたモジュール<4>

1.5.6.12 データクラス
.....................

* Menu:

* __slots__::
* Keyword-only fields::


File: python.info,  Node: __slots__,  Next: Keyword-only fields,  Up: データクラス<2>

1.5.6.13 __slots__
..................

Added ‘slots’ parameter in *note dataclasses.dataclass(): 4e1.
decorator.  (Contributed by Yurii Karabas in bpo-42269(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42269


File: python.info,  Node: Keyword-only fields,  Prev: __slots__,  Up: データクラス<2>

1.5.6.14 Keyword-only fields
............................

dataclasses now supports fields that are keyword-only in the generated
__init__ method.  There are a number of ways of specifying keyword-only
fields.

You can say that every field is keyword-only:

     from dataclasses import dataclass

     @dataclass(kw_only=True)
     class Birthday:
         name: str
         birthday: datetime.date

Both ‘name’ and ‘birthday’ are keyword-only parameters to the generated
__init__ method.

You can specify keyword-only on a per-field basis:

     from dataclasses import dataclass, field

     @dataclass
     class Birthday:
         name: str
         birthday: datetime.date = field(kw_only=True)

Here only ‘birthday’ is keyword-only.  If you set ‘kw_only’ on
individual fields, be aware that there are rules about re-ordering
fields due to keyword-only fields needing to follow non-keyword-only
fields.  See the full dataclasses documentation for details.

You can also specify that all fields following a KW_ONLY marker are
keyword-only.  This will probably be the most common usage:

     from dataclasses import dataclass, KW_ONLY

     @dataclass
     class Point:
         x: float
         y: float
         _: KW_ONLY
         z: float = 0.0
         t: float = 0.0

Here, ‘z’ and ‘t’ are keyword-only parameters, while ‘x’ and ‘y’ are
not.  (Contributed by Eric V. Smith in bpo-43532(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43532


File: python.info,  Node: distutils<2>,  Next: doctest<2>,  Prev: データクラス<2>,  Up: 改良されたモジュール<4>

1.5.6.15 distutils
..................

The entire ‘distutils’ package is deprecated, to be removed in Python
3.12.  Its functionality for specifying package builds has already been
completely replaced by third-party packages ‘setuptools’ and
‘packaging’, and most other commonly used APIs are available elsewhere
in the standard library (such as *note platform: af, *note shutil: ca,
*note subprocess: dc. or *note sysconfig: e1.).  There are no plans to
migrate any other functionality from ‘distutils’, and applications that
are using other functions should plan to make private copies of the
code.  Refer to PEP 632(1) for discussion.

The ‘bdist_wininst’ command deprecated in Python 3.8 has been removed.
The ‘bdist_wheel’ command is now recommended to distribute binary
packages on Windows.  (Contributed by Victor Stinner in bpo-42802(2).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0632/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42802


File: python.info,  Node: doctest<2>,  Next: エンコーディング,  Prev: distutils<2>,  Up: 改良されたモジュール<4>

1.5.6.16 doctest
................

When a module does not define ‘__loader__’, fall back to
‘__spec__.loader’.  (Contributed by Brett Cannon in bpo-42133(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42133


File: python.info,  Node: エンコーディング,  Next: enum<4>,  Prev: doctest<2>,  Up: 改良されたモジュール<4>

1.5.6.17 エンコーディング
.........................

*note encodings.normalize_encoding(): 9fd. now ignores non-ASCII
characters.  (Contributed by Hai Shi in bpo-39337(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39337


File: python.info,  Node: enum<4>,  Next: fileinput,  Prev: エンコーディング,  Up: 改良されたモジュール<4>

1.5.6.18 enum
.............

*note Enum: 842. *note __repr__(): 82f. now returns
‘enum_name.member_name’ and *note __str__(): 830. now returns
‘member_name’.  Stdlib enums available as module constants have a *note
repr(): 1c1. of ‘module_name.member_name’.  (Contributed by Ethan Furman
in bpo-40066(1).)

Add *note enum.StrEnum: 82d. for enums where all members are strings.
(Contributed by Ethan Furman in bpo-41816(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40066

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41816


File: python.info,  Node: fileinput,  Next: faulthandler<2>,  Prev: enum<4>,  Up: 改良されたモジュール<4>

1.5.6.19 fileinput
..................

Add 'encoding' and 'errors' parameters in *note fileinput.input(): a00.
and *note fileinput.FileInput: 940.  (Contributed by Inada Naoki in
bpo-43712(1).)

*note fileinput.hook_compressed(): a01. now returns *note TextIOWrapper:
9be. object when 'mode' is "r" and file is compressed, like uncompressed
files.  (Contributed by Inada Naoki in bpo-5758(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43712

   (2) https://bugs.python.org/issue?@action=redirect&bpo=5758


File: python.info,  Node: faulthandler<2>,  Next: gc<2>,  Prev: fileinput,  Up: 改良されたモジュール<4>

1.5.6.20 faulthandler
.....................

The *note faulthandler: 5c. module now detects if a fatal error occurs
during a garbage collector collection.  (Contributed by Victor Stinner
in bpo-44466(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44466


File: python.info,  Node: gc<2>,  Next: glob<2>,  Prev: faulthandler<2>,  Up: 改良されたモジュール<4>

1.5.6.21 gc
...........

Add audit hooks for *note gc.get_objects(): a04, *note
gc.get_referrers(): a05. and *note gc.get_referents(): a06.
(Contributed by Pablo Galindo in bpo-43439(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43439


File: python.info,  Node: glob<2>,  Next: hashlib<3>,  Prev: gc<2>,  Up: 改良されたモジュール<4>

1.5.6.22 glob
.............

Add the 'root_dir' and 'dir_fd' parameters in *note glob(): 5a0. and
*note iglob(): a08. which allow to specify the root directory for
searching.  (Contributed by Serhiy Storchaka in bpo-38144(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38144


File: python.info,  Node: hashlib<3>,  Next: hmac<2>,  Prev: glob<2>,  Up: 改良されたモジュール<4>

1.5.6.23 hashlib
................

The hashlib module requires OpenSSL 1.1.1 or newer.  (Contributed by
Christian Heimes in PEP 644(1) and bpo-43669(2).)

The hashlib module has preliminary support for OpenSSL 3.0.0.
(Contributed by Christian Heimes in bpo-38820(3) and other issues.)

The pure-Python fallback of *note pbkdf2_hmac(): 733. is deprecated.  In
the future PBKDF2-HMAC will only be available when Python has been built
with OpenSSL support.  (Contributed by Christian Heimes in
bpo-43880(4).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0644/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43669

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38820

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43880


File: python.info,  Node: hmac<2>,  Next: IDLE と idelelib<2>,  Prev: hashlib<3>,  Up: 改良されたモジュール<4>

1.5.6.24 hmac
.............

The hmac module now uses OpenSSL's HMAC implementation internally.
(Contributed by Christian Heimes in bpo-40645(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40645


File: python.info,  Node: IDLE と idelelib<2>,  Next: importlib metadata<2>,  Prev: hmac<2>,  Up: 改良されたモジュール<4>

1.5.6.25 IDLE と idelelib
.........................

Make IDLE invoke *note sys.excepthook(): a0c. (when started without
'-n').  User hooks were previously ignored.  (Contributed by Ken Hilton
in bpo-43008(1).)

Rearrange the settings dialog.  Split the General tab into Windows and
Shell/Ed tabs.  Move help sources, which extend the Help menu, to the
Extensions tab.  Make space for new options and shorten the dialog.  The
latter makes the dialog better fit small screens.  (Contributed by Terry
Jan Reedy in bpo-40468(2).)  Move the indent space setting from the Font
tab to the new Windows tab.  (Contributed by Mark Roseman and Terry Jan
Reedy in bpo-33962(3).)

The changes above were backported to a 3.9 maintenance release.

Add a Shell sidebar.  Move the primary prompt ('>>>') to the sidebar.
Add secondary prompts ('...')  to the sidebar.  Left click and optional
drag selects one or more lines of text, as with the editor line number
sidebar.  Right click after selecting text lines displays a context menu
with 'copy with prompts'.  This zips together prompts from the sidebar
with lines from the selected text.  This option also appears on the
context menu for the text.  (Contributed by Tal Einat in bpo-37903(4).)

Use spaces instead of tabs to indent interactive code.  This makes
interactive code entries 'look right'.  Making this feasible was a major
motivation for adding the shell sidebar.  (Contributed by Terry Jan
Reedy in bpo-37892(5).)

Highlight the new *note soft keywords: a0d. *note match: a0e, *note
case: a0e, and *note _: a0f. in pattern-matching statements.  However,
this highlighting is not perfect and will be incorrect in some rare
cases, including some ‘_’-s in ‘case’ patterns.  (Contributed by Tal
Einat in bpo-44010(6).)

New in 3.10 maintenance releases.

Apply syntax highlighting to ‘.pyi’ files.  (Contributed by Alex Waygood
and Terry Jan Reedy in bpo-45447(7).)

Include prompts when saving Shell with inputs and outputs.  (Contributed
by Terry Jan Reedy in gh-95191(8).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43008

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40468

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33962

   (4) https://bugs.python.org/issue?@action=redirect&bpo=37903

   (5) https://bugs.python.org/issue?@action=redirect&bpo=37892

   (6) https://bugs.python.org/issue?@action=redirect&bpo=44010

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45447

   (8) https://github.com/python/cpython/issues/95191


File: python.info,  Node: importlib metadata<2>,  Next: inspect<4>,  Prev: IDLE と idelelib<2>,  Up: 改良されたモジュール<4>

1.5.6.26 importlib.metadata
...........................

Feature parity with ‘importlib_metadata’ 4.6 (history(1)).

*note importlib.metadata entry points: 589. now provide a nicer
experience for selecting entry points by group and name through a new
*note importlib.metadata.EntryPoints: 589. class.  See the Compatibility
Note in the docs for more info on the deprecation and usage.

Added *note importlib.metadata.packages_distributions(): a11. for
resolving top-level Python modules and packages to their *note
importlib.metadata.Distribution: a12.

   ---------- Footnotes ----------

   (1) https://importlib-metadata.readthedocs.io/en/latest/history.html


File: python.info,  Node: inspect<4>,  Next: itertools<4>,  Prev: importlib metadata<2>,  Up: 改良されたモジュール<4>

1.5.6.27 inspect
................

When a module does not define ‘__loader__’, fall back to
‘__spec__.loader’.  (Contributed by Brett Cannon in bpo-42133(1).)

Add *note inspect.get_annotations(): a14, which safely computes the
annotations defined on an object.  It works around the quirks of
accessing the annotations on various types of objects, and makes very
few assumptions about the object it examines.  *note
inspect.get_annotations(): a14. can also correctly un-stringize
stringized annotations.  *note inspect.get_annotations(): a14. is now
considered best practice for accessing the annotations dict defined on
any Python object; for more information on best practices for working
with annotations, please see *note Annotations Best Practices: 9d9.
Relatedly, *note inspect.signature(): 22f, *note
inspect.Signature.from_callable(): 942, and
‘inspect.Signature.from_function()’ now call *note
inspect.get_annotations(): a14. to retrieve annotations.  This means
*note inspect.signature(): 22f. and *note
inspect.Signature.from_callable(): 942. can also now un-stringize
stringized annotations.  (Contributed by Larry Hastings in
bpo-43817(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42133

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43817


File: python.info,  Node: itertools<4>,  Next: linecache<2>,  Prev: inspect<4>,  Up: 改良されたモジュール<4>

1.5.6.28 itertools
..................

Add *note itertools.pairwise(): a16.  (Contributed by Raymond Hettinger
in bpo-38200(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38200


File: python.info,  Node: linecache<2>,  Next: os<5>,  Prev: itertools<4>,  Up: 改良されたモジュール<4>

1.5.6.29 linecache
..................

When a module does not define ‘__loader__’, fall back to
‘__spec__.loader’.  (Contributed by Brett Cannon in bpo-42133(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42133


File: python.info,  Node: os<5>,  Next: os path<4>,  Prev: linecache<2>,  Up: 改良されたモジュール<4>

1.5.6.30 os
...........

Add *note os.cpu_count(): 4db. support for VxWorks RTOS. (Contributed by
Peixing Xin in bpo-41440(1).)

Add a new function *note os.eventfd(): a19. and related helpers to wrap
the ‘eventfd2’ syscall on Linux.  (Contributed by Christian Heimes in
bpo-41001(2).)

Add *note os.splice(): a1a. that allows to move data between two file
descriptors without copying between kernel address space and user
address space, where one of the file descriptors must refer to a pipe.
(Contributed by Pablo Galindo in bpo-41625(3).)

Add *note O_EVTONLY: a1b, *note O_FSYNC: a1c, *note O_SYMLINK: a1d. and
*note O_NOFOLLOW_ANY: a1e. for macOS. (Contributed by Donghee Na in
bpo-43106(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41440

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41001

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41625

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43106


File: python.info,  Node: os path<4>,  Next: pathlib<8>,  Prev: os<5>,  Up: 改良されたモジュール<4>

1.5.6.31 os.path
................

*note os.path.realpath(): 262. now accepts a 'strict' keyword-only
argument.  When set to ‘True’, *note OSError: 2c0. is raised if a path
doesn't exist or a symlink loop is encountered.  (Contributed by Barney
Gale in bpo-43757(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43757


File: python.info,  Node: pathlib<8>,  Next: プラットフォーム<3>,  Prev: os path<4>,  Up: 改良されたモジュール<4>

1.5.6.32 pathlib
................

Add slice support to *note PurePath.parents: a21.  (Contributed by
Joshua Cannon in bpo-35498(1).)

Add negative indexing support to *note PurePath.parents: a21.
(Contributed by Yaroslav Pankovych in bpo-21041(2).)

Add *note Path.hardlink_to: a22. method that supersedes ‘link_to()’.
The new method has the same argument order as *note symlink_to(): a23.
(Contributed by Barney Gale in bpo-39950(3).)

*note pathlib.Path.stat(): a24. and *note chmod(): a25. now accept a
'follow_symlinks' keyword-only argument for consistency with
corresponding functions in the *note os: a5. module.  (Contributed by
Barney Gale in bpo-39906(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35498

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21041

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39950

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39906


File: python.info,  Node: プラットフォーム<3>,  Next: pprint,  Prev: pathlib<8>,  Up: 改良されたモジュール<4>

1.5.6.33 プラットフォーム
.........................

Add *note platform.freedesktop_os_release(): a27. to retrieve operation
system identification from freedesktop.org os-release(1) standard file.
(Contributed by Christian Heimes in bpo-28468(2).)

   ---------- Footnotes ----------

   (1) https://www.freedesktop.org/software/systemd/man/os-release.html

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28468


File: python.info,  Node: pprint,  Next: py_compile,  Prev: プラットフォーム<3>,  Up: 改良されたモジュール<4>

1.5.6.34 pprint
...............

*note pprint.pprint(): a29. now accepts a new ‘underscore_numbers’
keyword argument.  (Contributed by sblondon in bpo-42914(1).)

*note pprint: b3. can now pretty-print *note dataclasses.dataclass: 4e1.
instances.  (Contributed by Lewis Gaul in bpo-43080(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42914

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43080


File: python.info,  Node: py_compile,  Next: pyclbr,  Prev: pprint,  Up: 改良されたモジュール<4>

1.5.6.35 py_compile
...................

Add ‘--quiet’ option to command-line interface of *note py_compile: b8.
(Contributed by Gregory Schevchenko in bpo-38731(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38731


File: python.info,  Node: pyclbr,  Next: shelve,  Prev: py_compile,  Up: 改良されたモジュール<4>

1.5.6.36 pyclbr
...............

Add an ‘end_lineno’ attribute to the ‘Function’ and ‘Class’ objects in
the tree returned by *note pyclbr.readmodule(): a2c. and *note
pyclbr.readmodule_ex(): a2d.  It matches the existing (start) ‘lineno’.
(Contributed by Aviral Srivastava in bpo-38307(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38307


File: python.info,  Node: shelve,  Next: statistics<3>,  Prev: pyclbr,  Up: 改良されたモジュール<4>

1.5.6.37 shelve
...............

The *note shelve: c8. module now uses *note pickle.DEFAULT_PROTOCOL:
a2f. by default instead of *note pickle: ab. protocol ‘3’ when creating
shelves.  (Contributed by Zackery Spytz in bpo-34204(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34204


File: python.info,  Node: statistics<3>,  Next: site<2>,  Prev: shelve,  Up: 改良されたモジュール<4>

1.5.6.38 statistics
...................

Add *note covariance(): a31, Pearson's *note correlation(): 6e3, and
simple *note linear_regression(): a32. functions.  (Contributed by
Tymoteusz Wołodźko in bpo-38490(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38490


File: python.info,  Node: site<2>,  Next: socket<3>,  Prev: statistics<3>,  Up: 改良されたモジュール<4>

1.5.6.39 site
.............

When a module does not define ‘__loader__’, fall back to
‘__spec__.loader’.  (Contributed by Brett Cannon in bpo-42133(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42133


File: python.info,  Node: socket<3>,  Next: ssl<4>,  Prev: site<2>,  Up: 改良されたモジュール<4>

1.5.6.40 socket
...............

The exception *note socket.timeout: a35. is now an alias of *note
TimeoutError: a36.  (Contributed by Christian Heimes in bpo-42413(1).)

Add option to create MPTCP sockets with ‘IPPROTO_MPTCP’ (Contributed by
Rui Cunha in bpo-43571(2).)

Add ‘IP_RECVTOS’ option to receive the type of service (ToS) or DSCP/ECN
fields (Contributed by Georg Sauthoff in bpo-44077(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42413

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43571

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44077


File: python.info,  Node: ssl<4>,  Next: sqlite3<6>,  Prev: socket<3>,  Up: 改良されたモジュール<4>

1.5.6.41 ssl
............

The ssl module requires OpenSSL 1.1.1 or newer.  (Contributed by
Christian Heimes in PEP 644(1) and bpo-43669(2).)

The ssl module has preliminary support for OpenSSL 3.0.0 and new option
*note OP_IGNORE_UNEXPECTED_EOF: a38.  (Contributed by Christian Heimes
in bpo-38820(3), bpo-43794(4), bpo-43788(5), bpo-43791(6), bpo-43799(7),
bpo-43920(8), bpo-43789(9), and bpo-43811(10).)

Deprecated function and use of deprecated constants now result in a
*note DeprecationWarning: 1a3.  *note ssl.SSLContext.options: a39. has
*note OP_NO_SSLv2: a3a. and *note OP_NO_SSLv3: a3b. set by default and
therefore cannot warn about setting the flag again.  The *note
deprecation section: a3c. has a list of deprecated features.
(Contributed by Christian Heimes in bpo-43880(11).)

The ssl module now has more secure default settings.  Ciphers without
forward secrecy or SHA-1 MAC are disabled by default.  Security level 2
prohibits weak RSA, DH, and ECC keys with less than 112 bits of
security.  *note SSLContext: 357. defaults to minimum protocol version
TLS 1.2.  Settings are based on Hynek Schlawack's research.
(Contributed by Christian Heimes in bpo-43998(12).)

The deprecated protocols SSL 3.0, TLS 1.0, and TLS 1.1 are no longer
officially supported.  Python does not block them actively.  However
OpenSSL build options, distro configurations, vendor patches, and cipher
suites may prevent a successful handshake.

Add a 'timeout' parameter to the *note ssl.get_server_certificate():
a3d. function.  (Contributed by Zackery Spytz in bpo-31870(13).)

The ssl module uses heap-types and multi-phase initialization.
(Contributed by Christian Heimes in bpo-42333(14).)

A new verify flag *note VERIFY_X509_PARTIAL_CHAIN: 481. has been added.
(Contributed by l0x in bpo-40849(15).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0644/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43669

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38820

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43794

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43788

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43791

   (7) https://bugs.python.org/issue?@action=redirect&bpo=43799

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43920

   (9) https://bugs.python.org/issue?@action=redirect&bpo=43789

   (10) https://bugs.python.org/issue?@action=redirect&bpo=43811

   (11) https://bugs.python.org/issue?@action=redirect&bpo=43880

   (12) https://bugs.python.org/issue?@action=redirect&bpo=43998

   (13) https://bugs.python.org/issue?@action=redirect&bpo=31870

   (14) https://bugs.python.org/issue?@action=redirect&bpo=42333

   (15) https://bugs.python.org/issue?@action=redirect&bpo=40849


File: python.info,  Node: sqlite3<6>,  Next: sys<5>,  Prev: ssl<4>,  Up: 改良されたモジュール<4>

1.5.6.42 sqlite3
................

Add audit events for *note connect(): 5a6, *note
enable_load_extension(): a3f, and *note load_extension(): 6df.
(Contributed by Erlend E. Aasland in bpo-43762(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43762


File: python.info,  Node: sys<5>,  Next: _thread,  Prev: sqlite3<6>,  Up: 改良されたモジュール<4>

1.5.6.43 sys
............

Add *note sys.orig_argv: a41. attribute: the list of the original
command line arguments passed to the Python executable.  (Contributed by
Victor Stinner in bpo-23427(1).)

Add *note sys.stdlib_module_names: a42, containing the list of the
standard library module names.  (Contributed by Victor Stinner in
bpo-42955(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23427

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42955


File: python.info,  Node: _thread,  Next: threading<4>,  Prev: sys<5>,  Up: 改良されたモジュール<4>

1.5.6.44 _thread
................

*note _thread.interrupt_main(): a44. now takes an optional signal number
to simulate (the default is still *note signal.SIGINT: 253.).
(Contributed by Antoine Pitrou in bpo-43356(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43356


File: python.info,  Node: threading<4>,  Next: traceback<3>,  Prev: _thread,  Up: 改良されたモジュール<4>

1.5.6.45 threading
..................

Add *note threading.gettrace(): a46. and *note threading.getprofile():
a47. to retrieve the functions set by *note threading.settrace(): a48.
and *note threading.setprofile(): a49. respectively.  (Contributed by
Mario Corchero in bpo-42251(1).)

Add *note threading.__excepthook__: a4a. to allow retrieving the
original value of *note threading.excepthook(): a4b. in case it is set
to a broken or a different value.  (Contributed by Mario Corchero in
bpo-42308(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42251

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42308


File: python.info,  Node: traceback<3>,  Next: types<4>,  Prev: threading<4>,  Up: 改良されたモジュール<4>

1.5.6.46 traceback
..................

The *note format_exception(): a4d, *note format_exception_only(): a4e,
and *note print_exception(): a4f. functions can now take an exception
object as a positional-only argument.  (Contributed by Zackery Spytz and
Matthias Bussonnier in bpo-26389(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26389


File: python.info,  Node: types<4>,  Next: typing<6>,  Prev: traceback<3>,  Up: 改良されたモジュール<4>

1.5.6.47 types
..............

Reintroduce the *note types.EllipsisType: a51, *note types.NoneType:
a52. and *note types.NotImplementedType: a53. classes, providing a new
set of types readily interpretable by type checkers.  (Contributed by
Bas van Beek in bpo-41810(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41810


File: python.info,  Node: typing<6>,  Next: unittest<6>,  Prev: types<4>,  Up: 改良されたモジュール<4>

1.5.6.48 typing
...............

For major changes, see *note 型ヒントに関連する新しい機能: 9c1.

The behavior of *note typing.Literal: a55. was changed to conform with
PEP 586(1) and to match the behavior of static type checkers specified
in the PEP.

  1. ‘Literal’ now de-duplicates parameters.

  2. Equality comparisons between ‘Literal’ objects are now order
     independent.

  3. ‘Literal’ comparisons now respect types.  For example, ‘Literal[0]
     == Literal[False]’ previously evaluated to ‘True’.  It is now
     ‘False’.  To support this change, the internally used type cache
     now supports differentiating types.

  4. ‘Literal’ objects will now raise a *note TypeError: 198. exception
     during equality comparisons if any of their parameters are not
     *note hashable: 824.  Note that declaring ‘Literal’ with unhashable
     parameters will not throw an error:

          >>> from typing import Literal
          >>> Literal[{0}]
          >>> Literal[{0}] == Literal[{False}]
          Traceback (most recent call last):
            File "<stdin>", line 1, in <module>
          TypeError: unhashable type: 'set'

(bpo-42345(2) でのYurii Karabasの貢献による)

Add new function *note typing.is_typeddict(): a56. to introspect if an
annotation is a *note typing.TypedDict: 332.  (Contributed by Patrick
Reader in bpo-41792(3).)

Subclasses of ‘typing.Protocol’ which only have data variables declared
will now raise a ‘TypeError’ when checked with ‘isinstance’ unless they
are decorated with *note runtime_checkable(): 675.  Previously, these
checks passed silently.  Users should decorate their subclasses with the
‘runtime_checkable()’ decorator if they want runtime protocols.
(Contributed by Yurii Karabas in bpo-38908(4).)

Importing from the ‘typing.io’ and ‘typing.re’ submodules will now emit
*note DeprecationWarning: 1a3.  These submodules have been deprecated
since Python 3.8 and will be removed in a future version of Python.
Anything belonging to those submodules should be imported directly from
*note typing: 10a. instead.  (Contributed by Sebastian Rittau in
bpo-38291(5).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0586/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42345

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41792

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38908

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38291


File: python.info,  Node: unittest<6>,  Next: urllib parse,  Prev: typing<6>,  Up: 改良されたモジュール<4>

1.5.6.49 unittest
.................

Add new method *note assertNoLogs(): a58. to complement the existing
*note assertLogs(): a59.  (Contributed by Kit Yan Choi in bpo-39385(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39385


File: python.info,  Node: urllib parse,  Next: xml<2>,  Prev: unittest<6>,  Up: 改良されたモジュール<4>

1.5.6.50 urllib.parse
.....................

Python versions earlier than Python 3.10 allowed using both ‘;’ and ‘&’
as query parameter separators in *note urllib.parse.parse_qs(): 31f. and
*note urllib.parse.parse_qsl(): 31e.  Due to security concerns, and to
conform with newer W3C recommendations, this has been changed to allow
only a single separator key, with ‘&’ as the default.  This change also
affects ‘cgi.parse()’ and ‘cgi.parse_multipart()’ as they use the
affected functions internally.  For more details, please see their
respective documentation.  (Contributed by Adam Goldschmidt, Senthil
Kumaran and Ken Jin in bpo-42967(1).)

The presence of newline or tab characters in parts of a URL allows for
some forms of attacks.  Following the WHATWG specification that updates
RFC 3986(2), ASCII newline ‘\n’, ‘\r’ and tab ‘\t’ characters are
stripped from the URL by the parser in *note urllib.parse: 110.
preventing such attacks.  The removal characters are controlled by a new
module level variable ‘urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE’.  (See
gh-88048(3))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42967

   (2) https://datatracker.ietf.org/doc/html/rfc3986.html

   (3) https://github.com/python/cpython/issues/88048


File: python.info,  Node: xml<2>,  Next: zipimport<3>,  Prev: urllib parse,  Up: 改良されたモジュール<4>

1.5.6.51 xml
............

Add a *note LexicalHandler: a5c. class to the *note xml.sax.handler:
130. module.  (Contributed by Jonathan Gossage and Zackery Spytz in
bpo-35018(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35018


File: python.info,  Node: zipimport<3>,  Prev: xml<2>,  Up: 改良されたモジュール<4>

1.5.6.52 zipimport
..................

Add methods related to PEP 451(1): *note find_spec(): a5e, *note
zipimport.zipimporter.create_module(): a5f, and *note
zipimport.zipimporter.exec_module(): 339.  (Contributed by Brett Cannon
in bpo-42131(2).)

Add *note invalidate_caches(): a60. method.  (Contributed by Desmond
Cheong in bpo-14678(3).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0451/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42131

   (3) https://bugs.python.org/issue?@action=redirect&bpo=14678


File: python.info,  Node: 最適化<5>,  Next: 非推奨<6>,  Prev: 改良されたモジュール<4>,  Up: What's New In Python 3 10

1.5.7 最適化
------------

   * Constructors *note str(): 169, *note bytes(): 192. and *note
     bytearray(): 344. are now faster (around 30-40% for small objects).
     (Contributed by Serhiy Storchaka in bpo-41334(1).)

   * The *note runpy: c3. module now imports fewer modules.  The
     ‘python3 -m module-name’ command startup time is 1.4x faster in
     average.  On Linux, ‘python3 -I -m module-name’ imports 69 modules
     on Python 3.9, whereas it only imports 51 modules (-18) on Python
     3.10.  (Contributed by Victor Stinner in bpo-41006(2) and
     bpo-41718(3).)

   * The ‘LOAD_ATTR’ instruction now uses new "per opcode cache"
     mechanism.  It is about 36% faster now for regular attributes and
     44% faster for slots.  (Contributed by Pablo Galindo and Yury
     Selivanov in bpo-42093(4) and Guido van Rossum in bpo-42927(5),
     based on ideas implemented originally in PyPy and MicroPython.)

   * When building Python with *note -enable-optimizations: a62. now
     ‘-fno-semantic-interposition’ is added to both the compile and link
     line.  This speeds builds of the Python interpreter created with
     *note -enable-shared: a63. with ‘gcc’ by up to 30%.  See this
     article(6) for more details.  (Contributed by Victor Stinner and
     Pablo Galindo in bpo-38980(7).)

   * Use a new output buffer management code for *note bz2: 14. / *note
     lzma: 8e. / *note zlib: 139. modules, and add ‘.readall()’ function
     to ‘_compression.DecompressReader’ class.  bz2 decompression is now
     1.09x ~ 1.17x faster, lzma decompression 1.20x ~ 1.32x faster,
     ‘GzipFile.read(-1)’ 1.11x ~ 1.18x faster.  (Contributed by Ma Lin,
     reviewed by Gregory P. Smith, in bpo-41486(8))

   * When using stringized annotations, annotations dicts for functions
     are no longer created when the function is created.  Instead, they
     are stored as a tuple of strings, and the function object lazily
     converts this into the annotations dict on demand.  This
     optimization cuts the CPU time needed to define an annotated
     function by half.  (Contributed by Yurii Karabas and Inada Naoki in
     bpo-42202(9).)

   * Substring search functions such as ‘str1 in str2’ and
     ‘str2.find(str1)’ now sometimes use Crochemore & Perrin's "Two-Way"
     string searching algorithm to avoid quadratic behavior on long
     strings.  (Contributed by Dennis Sweeney in bpo-41972(10))

   * Add micro-optimizations to ‘_PyType_Lookup()’ to improve type
     attribute cache lookup performance in the common case of cache
     hits.  This makes the interpreter 1.04 times faster on average.
     (Contributed by Dino Viehland in bpo-43452(11).)

   * The following built-in functions now support the faster PEP 590(12)
     vectorcall calling convention: *note map(): 19f, *note filter():
     a64, *note reversed(): a65, *note bool(): 3c3. and *note float():
     196.  (Contributed by Donghee Na and Jeroen Demeyer in
     bpo-43575(13), bpo-43287(14), bpo-41922(15), bpo-41873(16) and
     bpo-41870(17).)

   * *note BZ2File: a66. performance is improved by removing internal
     ‘RLock’.  This makes ‘BZ2File’ thread unsafe in the face of
     multiple simultaneous readers or writers, just like its equivalent
     classes in *note gzip: 6b. and *note lzma: 8e. have always been.
     (Contributed by Inada Naoki in bpo-43785(18).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41334

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41006

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41718

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42093

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42927

   (6) 
https://developers.redhat.com/blog/2020/06/25/red-hat-enterprise-linux-8-2-brings-faster-python-3-8-run-speeds/

   (7) https://bugs.python.org/issue?@action=redirect&bpo=38980

   (8) https://bugs.python.org/issue?@action=redirect&bpo=41486

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42202

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41972

   (11) https://bugs.python.org/issue?@action=redirect&bpo=43452

   (12) https://peps.python.org/pep-0590/

   (13) https://bugs.python.org/issue?@action=redirect&bpo=43575

   (14) https://bugs.python.org/issue?@action=redirect&bpo=43287

   (15) https://bugs.python.org/issue?@action=redirect&bpo=41922

   (16) https://bugs.python.org/issue?@action=redirect&bpo=41873

   (17) https://bugs.python.org/issue?@action=redirect&bpo=41870

   (18) https://bugs.python.org/issue?@action=redirect&bpo=43785


File: python.info,  Node: 非推奨<6>,  Next: 削除<6>,  Prev: 最適化<5>,  Up: What's New In Python 3 10

1.5.8 非推奨
------------

   * Currently Python accepts numeric literals immediately followed by
     keywords, for example ‘0in x’, ‘1or x’, ‘0if 1else 2’.  It allows
     confusing and ambiguous expressions like ‘[0x1for x in y]’ (which
     can be interpreted as ‘[0x1 for x in y]’ or ‘[0x1f or x in y]’).
     Starting in this release, a deprecation warning is raised if the
     numeric literal is immediately followed by one of keywords *note
     and: 349, *note else: 17c, *note for: 34a, *note if: 181, *note in:
     34b, *note is: 34c. and *note or: 34d.  In future releases it will
     be changed to syntax warning, and finally to syntax error.
     (Contributed by Serhiy Storchaka in bpo-43833(1).)

   * Starting in this release, there will be a concerted effort to begin
     cleaning up old import semantics that were kept for Python 2.7
     compatibility.  Specifically, ‘find_loader()’/‘find_module()’
     (superseded by *note find_spec(): a68.), *note load_module(): a69.
     (superseded by *note exec_module(): a6a.), ‘module_repr()’ (which
     the import system takes care of for you), the ‘__package__’
     attribute (superseded by ‘__spec__.parent’), the ‘__loader__’
     attribute (superseded by ‘__spec__.loader’), and the ‘__cached__’
     attribute (superseded by ‘__spec__.cached’) will slowly be removed
     (as well as other classes and methods in *note importlib: 7b.).
     *note ImportWarning: 71e. and/or *note DeprecationWarning: 1a3.
     will be raised as appropriate to help identify code which needs
     updating during this transition.

   * The entire ‘distutils’ namespace is deprecated, to be removed in
     Python 3.12.  Refer to the *note module changes: 934. section for
     more information.

   * Non-integer arguments to *note random.randrange(): a6b. are
     deprecated.  The *note ValueError: 2ec. is deprecated in favor of a
     *note TypeError: 198.  (Contributed by Serhiy Storchaka and Raymond
     Hettinger in bpo-37319(2).)

   * The various ‘load_module()’ methods of *note importlib: 7b. have
     been documented as deprecated since Python 3.6, but will now also
     trigger a *note DeprecationWarning: 1a3.  Use *note exec_module():
     a6a. instead.  (Contributed by Brett Cannon in bpo-26131(3).)

   * ‘zimport.zipimporter.load_module()’ has been deprecated in
     preference for *note exec_module(): 339.  (Contributed by Brett
     Cannon in bpo-26131(4).)

   * The use of *note load_module(): a69. by the import system now
     triggers an *note ImportWarning: 71e. as *note exec_module(): a6a.
     is preferred.  (Contributed by Brett Cannon in bpo-26131(5).)

   * The use of ‘importlib.abc.MetaPathFinder.find_module()’ and
     ‘importlib.abc.PathEntryFinder.find_module()’ by the import system
     now trigger an *note ImportWarning: 71e. as *note
     importlib.abc.MetaPathFinder.find_spec(): a68. and *note
     importlib.abc.PathEntryFinder.find_spec(): a6c. are preferred,
     respectively.  You can use *note importlib.util.spec_from_loader():
     a6d. to help in porting.  (Contributed by Brett Cannon in
     bpo-42134(6).)

   * The use of ‘importlib.abc.PathEntryFinder.find_loader()’ by the
     import system now triggers an *note ImportWarning: 71e. as *note
     importlib.abc.PathEntryFinder.find_spec(): a6c. is preferred.  You
     can use *note importlib.util.spec_from_loader(): a6d. to help in
     porting.  (Contributed by Brett Cannon in bpo-43672(7).)

   * The various implementations of
     ‘importlib.abc.MetaPathFinder.find_module()’ (
     ‘importlib.machinery.BuiltinImporter.find_module()’,
     ‘importlib.machinery.FrozenImporter.find_module()’,
     ‘importlib.machinery.WindowsRegistryFinder.find_module()’,
     ‘importlib.machinery.PathFinder.find_module()’,
     ‘importlib.abc.MetaPathFinder.find_module()’ ),
     ‘importlib.abc.PathEntryFinder.find_module()’ (
     ‘importlib.machinery.FileFinder.find_module()’ ), and
     ‘importlib.abc.PathEntryFinder.find_loader()’ (
     ‘importlib.machinery.FileFinder.find_loader()’ ) now raise *note
     DeprecationWarning: 1a3. and are slated for removal in Python 3.12
     (previously they were documented as deprecated in Python 3.4).
     (Contributed by Brett Cannon in bpo-42135(8).)

   * ‘importlib.abc.Finder’ is deprecated (including its sole method,
     ‘find_module()’).  Both *note importlib.abc.MetaPathFinder: a6e.
     and *note importlib.abc.PathEntryFinder: a6f. no longer inherit
     from the class.  Users should inherit from one of these two classes
     as appropriate instead.  (Contributed by Brett Cannon in
     bpo-42135(9).)

   * The deprecations of ‘imp’, ‘importlib.find_loader()’,
     ‘importlib.util.set_package_wrapper()’,
     ‘importlib.util.set_loader_wrapper()’,
     ‘importlib.util.module_for_loader()’, ‘pkgutil.ImpImporter’, and
     ‘pkgutil.ImpLoader’ have all been updated to list Python 3.12 as
     the slated version of removal (they began raising *note
     DeprecationWarning: 1a3. in previous versions of Python).
     (Contributed by Brett Cannon in bpo-43720(10).)

   * The import system now uses the ‘__spec__’ attribute on modules
     before falling back on ‘module_repr()’ for a module's ‘__repr__()’
     method.  Removal of the use of ‘module_repr()’ is scheduled for
     Python 3.12.  (Contributed by Brett Cannon in bpo-42137(11).)

   * ‘importlib.abc.Loader.module_repr()’,
     ‘importlib.machinery.FrozenLoader.module_repr()’, and
     ‘importlib.machinery.BuiltinLoader.module_repr()’ are deprecated
     and slated for removal in Python 3.12.  (Contributed by Brett
     Cannon in bpo-42136(12).)

   * ‘sqlite3.OptimizedUnicode’ has been undocumented and obsolete since
     Python 3.3, when it was made an alias to *note str: 169.  It is now
     deprecated, scheduled for removal in Python 3.12.  (Contributed by
     Erlend E. Aasland in bpo-42264(13).)

   * The undocumented built-in function ‘sqlite3.enable_shared_cache’ is
     now deprecated, scheduled for removal in Python 3.12.  Its use is
     strongly discouraged by the SQLite3 documentation.  See the SQLite3
     docs(14) for more details.  If a shared cache must be used, open
     the database in URI mode using the ‘cache=shared’ query parameter.
     (Contributed by Erlend E. Aasland in bpo-24464(15).)

   * 以下の ‘threading’ メソッドは非推奨になりました：

        * ‘threading.currentThread’ => *note threading.current_thread():
          35e.

        * ‘threading.activeCount’ => *note threading.active_count():
          35f.

        * ‘threading.Condition.notifyAll’ => *note
          threading.Condition.notify_all(): 359.

        * ‘threading.Event.isSet’ => *note threading.Event.is_set():
          35a.

        * ‘threading.Thread.setName’ => *note threading.Thread.name:
          2a0.

        * ‘threading.thread.getName’ => *note threading.Thread.name:
          2a0.

        * ‘threading.Thread.isDaemon’ => *note threading.Thread.daemon:
          35c.

        * ‘threading.Thread.setDaemon’ => *note threading.Thread.daemon:
          35c.

     (Contributed by Jelle Zijlstra in gh-87889(16).)

   * ‘pathlib.Path.link_to()’ is deprecated and slated for removal in
     Python 3.12.  Use *note pathlib.Path.hardlink_to(): a22. instead.
     (Contributed by Barney Gale in bpo-39950(17).)

   * ‘cgi.log()’ is deprecated and slated for removal in Python 3.12.
     (Contributed by Inada Naoki in bpo-41139(18).)

   * The following *note ssl: d5. features have been deprecated since
     Python 3.6, Python 3.7, or OpenSSL 1.1.0 and will be removed in
     3.11:

        * ‘OP_NO_SSLv2’, ‘OP_NO_SSLv3’, ‘OP_NO_TLSv1’, ‘OP_NO_TLSv1_1’,
          ‘OP_NO_TLSv1_2’, and ‘OP_NO_TLSv1_3’ are replaced by *note
          minimum_version: a70. and *note maximum_version: a71.

        * ‘PROTOCOL_SSLv2’, ‘PROTOCOL_SSLv3’, ‘PROTOCOL_SSLv23’,
          ‘PROTOCOL_TLSv1’, ‘PROTOCOL_TLSv1_1’, ‘PROTOCOL_TLSv1_2’, and
          ‘PROTOCOL_TLS’ are deprecated in favor of *note
          PROTOCOL_TLS_CLIENT: a72. and *note PROTOCOL_TLS_SERVER: a73.

        * ‘wrap_socket()’ is replaced by *note
          ssl.SSLContext.wrap_socket(): 748.

        * ‘match_hostname()’

        * ‘RAND_pseudo_bytes()’, ‘RAND_egd()’

        * NPN features like *note ssl.SSLSocket.selected_npn_protocol():
          a74. and *note ssl.SSLContext.set_npn_protocols(): 358. are
          replaced by ALPN.

   * The threading debug (‘PYTHONTHREADDEBUG’ environment variable) is
     deprecated in Python 3.10 and will be removed in Python 3.12.  This
     feature requires a *note debug build of Python: 509.  (Contributed
     by Victor Stinner in bpo-44584(19).)

   * Importing from the ‘typing.io’ and ‘typing.re’ submodules will now
     emit *note DeprecationWarning: 1a3.  These submodules will be
     removed in a future version of Python.  Anything belonging to these
     submodules should be imported directly from *note typing: 10a.
     instead.  (Contributed by Sebastian Rittau in bpo-38291(20).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43833

   (2) https://bugs.python.org/issue?@action=redirect&bpo=37319

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26131

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26131

   (5) https://bugs.python.org/issue?@action=redirect&bpo=26131

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42134

   (7) https://bugs.python.org/issue?@action=redirect&bpo=43672

   (8) https://bugs.python.org/issue?@action=redirect&bpo=42135

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42135

   (10) https://bugs.python.org/issue?@action=redirect&bpo=43720

   (11) https://bugs.python.org/issue?@action=redirect&bpo=42137

   (12) https://bugs.python.org/issue?@action=redirect&bpo=42136

   (13) https://bugs.python.org/issue?@action=redirect&bpo=42264

   (14) https://sqlite.org/c3ref/enable_shared_cache.html

   (15) https://bugs.python.org/issue?@action=redirect&bpo=24464

   (16) https://github.com/python/cpython/issues/87889

   (17) https://bugs.python.org/issue?@action=redirect&bpo=39950

   (18) https://bugs.python.org/issue?@action=redirect&bpo=41139

   (19) https://bugs.python.org/issue?@action=redirect&bpo=44584

   (20) https://bugs.python.org/issue?@action=redirect&bpo=38291


File: python.info,  Node: 削除<6>,  Next: Porting to Python 3 10,  Prev: 非推奨<6>,  Up: What's New In Python 3 10

1.5.9 削除
----------

   * Removed special methods ‘__int__’, ‘__float__’, ‘__floordiv__’,
     ‘__mod__’, ‘__divmod__’, ‘__rfloordiv__’, ‘__rmod__’ and
     ‘__rdivmod__’ of the *note complex: 197. class.  They always raised
     a *note TypeError: 198.  (Contributed by Serhiy Storchaka in
     bpo-41974(1).)

   * The ‘ParserBase.error()’ method from the private and undocumented
     ‘_markupbase’ module has been removed.  *note
     html.parser.HTMLParser: a77. is the only subclass of ‘ParserBase’
     and its ‘error()’ implementation was already removed in Python 3.5.
     (Contributed by Berker Peksag in bpo-31844(2).)

   * Removed the ‘unicodedata.ucnhash_CAPI’ attribute which was an
     internal PyCapsule object.  The related private
     ‘_PyUnicode_Name_CAPI’ structure was moved to the internal C API.
     (Contributed by Victor Stinner in bpo-42157(3).)

   * Removed the ‘parser’ module, which was deprecated in 3.9 due to the
     switch to the new PEG parser, as well as all the C source and
     header files that were only being used by the old parser, including
     ‘node.h’, ‘parser.h’, ‘graminit.h’ and ‘grammar.h’.

   * Removed the Public C API functions
     ‘PyParser_SimpleParseStringFlags’,
     ‘PyParser_SimpleParseStringFlagsFilename’,
     ‘PyParser_SimpleParseFileFlags’ and ‘PyNode_Compile’ that were
     deprecated in 3.9 due to the switch to the new PEG parser.

   * Removed the ‘formatter’ module, which was deprecated in Python 3.4.
     It is somewhat obsolete, little used, and not tested.  It was
     originally scheduled to be removed in Python 3.6, but such removals
     were delayed until after Python 2.7 EOL. Existing users should copy
     whatever classes they use into their code.  (Contributed by Donghee
     Na and Terry J. Reedy in bpo-42299(4).)

   * Removed the ‘PyModule_GetWarningsModule()’ function that was
     useless now due to the ‘_warnings’ module was converted to a
     builtin module in 2.6.  (Contributed by Hai Shi in bpo-42599(5).)

   * Remove deprecated aliases to *note コレクション抽象基底クラス: a78.
     from the *note collections: 1e. module.  (Contributed by Victor
     Stinner in bpo-37324(6).)

   * The ‘loop’ parameter has been removed from most of *note asyncio:
     b.'s *note high-level API: a79. following deprecation in Python
     3.8.  The motivation behind this change is multifold:

       1. This simplifies the high-level API.

       2. The functions in the high-level API have been implicitly
          getting the current thread's running event loop since Python
          3.7.  There isn't a need to pass the event loop to the API in
          most normal use cases.

       3. Event loop passing is error-prone especially when dealing with
          loops running in different threads.

     Note that the low-level API will still accept ‘loop’.  See *note
     Python API の変更: a7a. for examples of how to replace existing
     code.

     (Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and
     Kyle Stanley in bpo-42392(7).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41974

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31844

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42157

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42299

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42599

   (6) https://bugs.python.org/issue?@action=redirect&bpo=37324

   (7) https://bugs.python.org/issue?@action=redirect&bpo=42392


File: python.info,  Node: Porting to Python 3 10,  Next: CPython バイトコードの変更<4>,  Prev: 削除<6>,  Up: What's New In Python 3 10

1.5.10 Porting to Python 3.10
-----------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

* Menu:

* Changes in the Python syntax::
* Python API の変更: Python API の変更<4>.
* C API の変更: C API の変更<6>.


File: python.info,  Node: Changes in the Python syntax,  Next: Python API の変更<4>,  Up: Porting to Python 3 10

1.5.10.1 Changes in the Python syntax
.....................................

   * Deprecation warning is now emitted when compiling previously valid
     syntax if the numeric literal is immediately followed by a keyword
     (like in ‘0in x’).  In future releases it will be changed to syntax
     warning, and finally to a syntax error.  To get rid of the warning
     and make the code compatible with future releases just add a space
     between the numeric literal and the following keyword.
     (Contributed by Serhiy Storchaka in bpo-43833(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43833


File: python.info,  Node: Python API の変更<4>,  Next: C API の変更<6>,  Prev: Changes in the Python syntax,  Up: Porting to Python 3 10

1.5.10.2 Python API の変更
..........................

   * The 'etype' parameters of the *note format_exception(): a4d, *note
     format_exception_only(): a4e, and *note print_exception(): a4f.
     functions in the *note traceback: 104. module have been renamed to
     'exc'.  (Contributed by Zackery Spytz and Matthias Bussonnier in
     bpo-26389(1).)

   * *note atexit: d.: At Python exit, if a callback registered with
     *note atexit.register(): a7e. fails, its exception is now logged.
     Previously, only some exceptions were logged, and the last
     exception was always silently ignored.  (Contributed by Victor
     Stinner in bpo-42639(2).)

   * *note collections.abc.Callable: 9eb. generic now flattens type
     parameters, similar to what *note typing.Callable: 9c8. currently
     does.  This means that ‘collections.abc.Callable[[int, str], str]’
     will have ‘__args__’ of ‘(int, str, str)’; previously this was
     ‘([int, str], str)’.  Code which accesses the arguments via *note
     typing.get_args(): 2ac. or ‘__args__’ need to account for this
     change.  Furthermore, *note TypeError: 198. may be raised for
     invalid forms of parameterizing *note collections.abc.Callable:
     9eb. which may have passed silently in Python 3.9.  (Contributed by
     Ken Jin in bpo-42195(3).)

   * *note socket.htons(): a7f. and *note socket.ntohs(): a80. now raise
     *note OverflowError: a81. instead of *note DeprecationWarning: 1a3.
     if the given parameter will not fit in a 16-bit unsigned integer.
     (Contributed by Erlend E. Aasland in bpo-42393(4).)

   * The ‘loop’ parameter has been removed from most of *note asyncio:
     b.'s *note high-level API: a79. following deprecation in Python
     3.8.

     A coroutine that currently looks like this:

          async def foo(loop):
              await asyncio.sleep(1, loop=loop)

     Should be replaced with this:

          async def foo():
              await asyncio.sleep(1)

     If ‘foo()’ was specifically designed 'not' to run in the current
     thread's running event loop (e.g.  running in another thread's
     event loop), consider using *note
     asyncio.run_coroutine_threadsafe(): a82. instead.

     (Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and
     Kyle Stanley in bpo-42392(5).)

   * The *note types.FunctionType: a83. constructor now inherits the
     current builtins if the 'globals' dictionary has no
     ‘"__builtins__"’ key, rather than using ‘{"None": None}’ as
     builtins: same behavior as *note eval(): 4a3. and *note exec():
     4a2. functions.  Defining a function with ‘def function(...): ...’
     in Python is not affected, globals cannot be overridden with this
     syntax: it also inherits the current builtins.  (Contributed by
     Victor Stinner in bpo-42990(6).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26389

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42639

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42195

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42393

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42392

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42990


File: python.info,  Node: C API の変更<6>,  Prev: Python API の変更<4>,  Up: Porting to Python 3 10

1.5.10.3 C API の変更
.....................

   * The C API functions ‘PyParser_SimpleParseStringFlags’,
     ‘PyParser_SimpleParseStringFlagsFilename’,
     ‘PyParser_SimpleParseFileFlags’, ‘PyNode_Compile’ and the type used
     by these functions, ‘struct _node’, were removed due to the switch
     to the new PEG parser.

     Source should be now be compiled directly to a code object using,
     for example, *note Py_CompileString(): a85.  The resulting code
     object can then be evaluated using, for example, *note
     PyEval_EvalCode(): a86.

     Specifically:

        * A call to ‘PyParser_SimpleParseStringFlags’ followed by
          ‘PyNode_Compile’ can be replaced by calling *note
          Py_CompileString(): a85.

        * There is no direct replacement for
          ‘PyParser_SimpleParseFileFlags’.  To compile code from a ‘FILE
          *’ argument, you will need to read the file in C and pass the
          resulting buffer to *note Py_CompileString(): a85.

        * To compile a file given a ‘char *’ filename, explicitly open
          the file, read it and compile the result.  One way to do this
          is using the *note io: 83. module with *note
          PyImport_ImportModule(): 3dc, *note PyObject_CallMethod():
          640, *note PyBytes_AsString(): a87. and *note
          Py_CompileString(): a85, as sketched below.  (Declarations and
          error handling are omitted.)

               io_module = Import_ImportModule("io");
               fileobject = PyObject_CallMethod(io_module, "open", "ss", filename, "rb");
               source_bytes_object = PyObject_CallMethod(fileobject, "read", "");
               result = PyObject_CallMethod(fileobject, "close", "");
               source_buf = PyBytes_AsString(source_bytes_object);
               code = Py_CompileString(source_buf, filename, Py_file_input);

        * For ‘FrameObject’ objects, the *note f_lasti: a88. member now
          represents a wordcode offset instead of a simple offset into
          the bytecode string.  This means that this number needs to be
          multiplied by 2 to be used with APIs that expect a byte offset
          instead (like *note PyCode_Addr2Line(): a89. for example).
          Notice as well that the ‘f_lasti’ member of ‘FrameObject’
          objects is not considered stable: please use *note
          PyFrame_GetLineNumber(): 98e. instead.


File: python.info,  Node: CPython バイトコードの変更<4>,  Next: Build Changes<4>,  Prev: Porting to Python 3 10,  Up: What's New In Python 3 10

1.5.11 CPython バイトコードの変更
---------------------------------

   * The ‘MAKE_FUNCTION’ instruction now accepts either a dict or a
     tuple of strings as the function's annotations.  (Contributed by
     Yurii Karabas and Inada Naoki in bpo-42202(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42202


File: python.info,  Node: Build Changes<4>,  Next: C API の変更<7>,  Prev: CPython バイトコードの変更<4>,  Up: What's New In Python 3 10

1.5.12 Build Changes
--------------------

   * PEP 644(1): Python now requires OpenSSL 1.1.1 or newer.  OpenSSL
     1.0.2 is no longer supported.  (Contributed by Christian Heimes in
     bpo-43669(2).)

   * The C99 functions ‘snprintf()’ and ‘vsnprintf()’ are now required
     to build Python.  (Contributed by Victor Stinner in bpo-36020(3).)

   * *note sqlite3: d4. requires SQLite 3.7.15 or higher.  (Contributed
     by Sergey Fedoseev and Erlend E. Aasland in bpo-40744(4) and
     bpo-40810(5).)

   * The *note atexit: d. module must now always be built as a built-in
     module.  (Contributed by Victor Stinner in bpo-42639(6).)

   * Add *note -disable-test-modules: a8c. option to the ‘configure’
     script: don't build nor install test modules.  (Contributed by
     Xavier de Gaye, Thomas Petazzoni and Peixing Xin in bpo-27640(7).)

   * Add *note -with-wheel-pkg-dir=PATH option: a8d. to the
     ‘./configure’ script.  If specified, the *note ensurepip: 59.
     module looks for ‘setuptools’ and ‘pip’ wheel packages in this
     directory: if both are present, these wheel packages are used
     instead of ensurepip bundled wheel packages.

     Some Linux distribution packaging policies recommend against
     bundling dependencies.  For example, Fedora installs wheel packages
     in the ‘/usr/share/python-wheels/’ directory and don't install the
     ‘ensurepip._bundled’ package.

     (Contributed by Victor Stinner in bpo-42856(8).)

   * Add a new *note configure -without-static-libpython option: a8e. to
     not build the ‘libpythonMAJOR.MINOR.a’ static library and not
     install the ‘python.o’ object file.

     (Contributed by Victor Stinner in bpo-43103(9).)

   * The ‘configure’ script now uses the ‘pkg-config’ utility, if
     available, to detect the location of Tcl/Tk headers and libraries.
     As before, those locations can be explicitly specified with the
     ‘--with-tcltk-includes’ and ‘--with-tcltk-libs’ configuration
     options.  (Contributed by Manolis Stamatogiannakis in
     bpo-42603(10).)

   * Add *note -with-openssl-rpath: a8f. option to ‘configure’ script.
     The option simplifies building Python with a custom OpenSSL
     installation, e.g.  ‘./configure --with-openssl=/path/to/openssl
     --with-openssl-rpath=auto’.  (Contributed by Christian Heimes in
     bpo-43466(11).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0644/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43669

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36020

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40744

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40810

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42639

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27640

   (8) https://bugs.python.org/issue?@action=redirect&bpo=42856

   (9) https://bugs.python.org/issue?@action=redirect&bpo=43103

   (10) https://bugs.python.org/issue?@action=redirect&bpo=42603

   (11) https://bugs.python.org/issue?@action=redirect&bpo=43466


File: python.info,  Node: C API の変更<7>,  Next: Notable security feature in 3 10 7,  Prev: Build Changes<4>,  Up: What's New In Python 3 10

1.5.13 C API の変更
-------------------

* Menu:

* PEP 652; Maintaining the Stable ABI: PEP 652 Maintaining the Stable ABI.
* 新しい機能: 新しい機能<9>.
* Porting to Python 3.10: Porting to Python 3 10<2>.
* 非推奨: 非推奨<7>.
* 削除: 削除<7>.


File: python.info,  Node: PEP 652 Maintaining the Stable ABI,  Next: 新しい機能<9>,  Up: C API の変更<7>

1.5.13.1 PEP 652: Maintaining the Stable ABI
............................................

The Stable ABI (Application Binary Interface) for extension modules or
embedding Python is now explicitly defined.  *note C API の安定性: 775.
describes C API and ABI stability guarantees along with best practices
for using the Stable ABI.

(Contributed by Petr Viktorin in PEP 652(1) and bpo-43795(2).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0652/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43795


File: python.info,  Node: 新しい機能<9>,  Next: Porting to Python 3 10<2>,  Prev: PEP 652 Maintaining the Stable ABI,  Up: C API の変更<7>

1.5.13.2 新しい機能
...................

   * The result of *note PyNumber_Index(): a93. now always has exact
     type *note int: 19b.  Previously, the result could have been an
     instance of a subclass of ‘int’.  (Contributed by Serhiy Storchaka
     in bpo-40792(1).)

   * Add a new *note orig_argv: a94. member to the *note PyConfig: 3f7.
     structure: the list of the original command line arguments passed
     to the Python executable.  (Contributed by Victor Stinner in
     bpo-23427(2).)

   * The *note PyDateTime_DATE_GET_TZINFO(): a95. and *note
     PyDateTime_TIME_GET_TZINFO(): a96. macros have been added for
     accessing the ‘tzinfo’ attributes of *note datetime.datetime: 4e2.
     and *note datetime.time: 1fb. objects.  (Contributed by Zackery
     Spytz in bpo-30155(3).)

   * Add a *note PyCodec_Unregister(): a97. function to unregister a
     codec search function.  (Contributed by Hai Shi in bpo-41842(4).)

   * The *note PyIter_Send(): a98. function was added to allow sending
     value into iterator without raising ‘StopIteration’ exception.
     (Contributed by Vladimir Matveev in bpo-41756(5).)

   * Add *note PyUnicode_AsUTF8AndSize(): a99. to the limited C API.
     (Contributed by Alex Gaynor in bpo-41784(6).)

   * Add *note PyModule_AddObjectRef(): 60a. function: similar to *note
     PyModule_AddObject(): 60b. but don't steal a reference to the value
     on success.  (Contributed by Victor Stinner in bpo-1635741(7).)

   * Add *note Py_NewRef(): a9a. and *note Py_XNewRef(): a9b. functions
     to increment the reference count of an object and return the
     object.  (Contributed by Victor Stinner in bpo-42262(8).)

   * The *note PyType_FromSpecWithBases(): 79e. and *note
     PyType_FromModuleAndSpec(): 773. functions now accept a single
     class as the 'bases' argument.  (Contributed by Serhiy Storchaka in
     bpo-42423(9).)

   * The *note PyType_FromModuleAndSpec(): 773. function now accepts
     NULL ‘tp_doc’ slot.  (Contributed by Hai Shi in bpo-41832(10).)

   * The *note PyType_GetSlot(): a9c. function can accept *note static
     types: 983.  (Contributed by Hai Shi and Petr Viktorin in
     bpo-41073(11).)

   * Add a new *note PySet_CheckExact(): a9d. function to the C-API to
     check if an object is an instance of *note set: 184. but not an
     instance of a subtype.  (Contributed by Pablo Galindo in
     bpo-43277(12).)

   * Add *note PyErr_SetInterruptEx(): a9e. which allows passing a
     signal number to simulate.  (Contributed by Antoine Pitrou in
     bpo-43356(13).)

   * The limited C API is now supported if *note Python is built in
     debug mode: 509. (if the ‘Py_DEBUG’ macro is defined).  In the
     limited C API, the *note Py_INCREF(): 78f. and *note Py_DECREF():
     790. functions are now implemented as opaque function calls, rather
     than accessing directly the *note PyObject.ob_refcnt: a9f. member,
     if Python is built in debug mode and the ‘Py_LIMITED_API’ macro
     targets Python 3.10 or newer.  It became possible to support the
     limited C API in debug mode because the *note PyObject: 5df.
     structure is the same in release and debug mode since Python 3.8
     (see bpo-36465(14)).

     The limited C API is still not supported in the *note
     -with-trace-refs: 636. special build (‘Py_TRACE_REFS’ macro).
     (Contributed by Victor Stinner in bpo-43688(15).)

   * Add the *note Py_Is(x, y): aa0. function to test if the 'x' object
     is the 'y' object, the same as ‘x is y’ in Python.  Add also the
     *note Py_IsNone(): aa1, *note Py_IsTrue(): aa2, *note Py_IsFalse():
     aa3. functions to test if an object is, respectively, the ‘None’
     singleton, the ‘True’ singleton or the ‘False’ singleton.
     (Contributed by Victor Stinner in bpo-43753(16).)

   * Add new functions to control the garbage collector from C code:
     *note PyGC_Enable(): aa4, *note PyGC_Disable(): aa5, *note
     PyGC_IsEnabled(): aa6.  These functions allow to activate,
     deactivate and query the state of the garbage collector from C code
     without having to import the *note gc: 64. module.

   * Add a new *note Py_TPFLAGS_DISALLOW_INSTANTIATION: 7a2. type flag
     to disallow creating type instances.  (Contributed by Victor
     Stinner in bpo-43916(17).)

   * Add a new *note Py_TPFLAGS_IMMUTABLETYPE: 3cf. type flag for
     creating immutable type objects: type attributes cannot be set nor
     deleted.  (Contributed by Victor Stinner and Erlend E. Aasland in
     bpo-43908(18).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40792

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23427

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30155

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41842

   (5) https://bugs.python.org/issue?@action=redirect&bpo=41756

   (6) https://bugs.python.org/issue?@action=redirect&bpo=41784

   (7) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (8) https://bugs.python.org/issue?@action=redirect&bpo=42262

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42423

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41832

   (11) https://bugs.python.org/issue?@action=redirect&bpo=41073

   (12) https://bugs.python.org/issue?@action=redirect&bpo=43277

   (13) https://bugs.python.org/issue?@action=redirect&bpo=43356

   (14) https://bugs.python.org/issue?@action=redirect&bpo=36465

   (15) https://bugs.python.org/issue?@action=redirect&bpo=43688

   (16) https://bugs.python.org/issue?@action=redirect&bpo=43753

   (17) https://bugs.python.org/issue?@action=redirect&bpo=43916

   (18) https://bugs.python.org/issue?@action=redirect&bpo=43908


File: python.info,  Node: Porting to Python 3 10<2>,  Next: 非推奨<7>,  Prev: 新しい機能<9>,  Up: C API の変更<7>

1.5.13.3 Porting to Python 3.10
...............................

   * The ‘PY_SSIZE_T_CLEAN’ macro must now be defined to use *note
     PyArg_ParseTuple(): 3c1. and *note Py_BuildValue(): 3c2. formats
     which use ‘#’: ‘es#’, ‘et#’, ‘s#’, ‘u#’, ‘y#’, ‘z#’, ‘U#’ and ‘Z#’.
     See *note 引数の解釈と値の構築: 3d5. and PEP 353(1).  (Contributed
     by Victor Stinner in bpo-40943(2).)

   * Since *note Py_REFCNT(): 2cf. is changed to the inline static
     function, ‘Py_REFCNT(obj) = new_refcnt’ must be replaced with
     ‘Py_SET_REFCNT(obj, new_refcnt)’: see *note Py_SET_REFCNT(): aa8.
     (available since Python 3.9).  For backward compatibility, this
     macro can be used:

          #if PY_VERSION_HEX < 0x030900A4
          #  define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0)
          #endif

     (Contributed by Victor Stinner in bpo-39573(3).)

   * Calling *note PyDict_GetItem(): 628. without *note GIL: 164. held
     had been allowed for historical reason.  It is no longer allowed.
     (Contributed by Victor Stinner in bpo-40839(4).)

   * ‘PyUnicode_FromUnicode(NULL, size)’ and
     ‘PyUnicode_FromStringAndSize(NULL, size)’ raise
     ‘DeprecationWarning’ now.  Use *note PyUnicode_New(): aa9. to
     allocate Unicode object without initial data.  (Contributed by
     Inada Naoki in bpo-36346(5).)

   * The private ‘_PyUnicode_Name_CAPI’ structure of the PyCapsule API
     ‘unicodedata.ucnhash_CAPI’ has been moved to the internal C API.
     (Contributed by Victor Stinner in bpo-42157(6).)

   * *note Py_GetPath(): 3e3, *note Py_GetPrefix(): 3e5, *note
     Py_GetExecPrefix(): 3e9, *note Py_GetProgramFullPath(): 3ec, *note
     Py_GetPythonHome(): 3ef. and *note Py_GetProgramName(): 3ee.
     functions now return ‘NULL’ if called before *note Py_Initialize():
     460. (before Python is initialized).  Use the new *note Python
     初期化設定: 646. API to get the *note Python Path Configuration:
     aaa.  (Contributed by Victor Stinner in bpo-42260(7).)

   * *note PyList_SET_ITEM(): 62f, *note PyTuple_SET_ITEM(): 62e. and
     *note PyCell_SET(): aab. macros can no longer be used as l-value or
     r-value.  For example, ‘x = PyList_SET_ITEM(a, b, c)’ and
     ‘PyList_SET_ITEM(a, b, c) = x’ now fail with a compiler error.  It
     prevents bugs like ‘if (PyList_SET_ITEM (a, b, c) < 0) ...’ test.
     (Contributed by Zackery Spytz and Victor Stinner in bpo-30459(8).)

   * The non-limited API files ‘odictobject.h’, ‘parser_interface.h’,
     ‘picklebufobject.h’, ‘pyarena.h’, ‘pyctype.h’, ‘pydebug.h’,
     ‘pyfpe.h’, and ‘pytime.h’ have been moved to the ‘Include/cpython’
     directory.  These files must not be included directly, as they are
     already included in ‘Python.h’; see *note インクルードファイル:
     987.  If they have been included directly, consider including
     ‘Python.h’ instead.  (Contributed by Nicholas Sim in bpo-35134(9).)

   * Use the *note Py_TPFLAGS_IMMUTABLETYPE: 3cf. type flag to create
     immutable type objects.  Do not rely on *note Py_TPFLAGS_HEAPTYPE:
     aac. to decide if a type object is mutable or not; check if *note
     Py_TPFLAGS_IMMUTABLETYPE: 3cf. is set instead.  (Contributed by
     Victor Stinner and Erlend E. Aasland in bpo-43908(10).)

   * The undocumented function ‘Py_FrozenMain’ has been removed from the
     limited API. The function is mainly useful for custom builds of
     Python.  (Contributed by Petr Viktorin in bpo-26241(11).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0353/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40943

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39573

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40839

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36346

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42157

   (7) https://bugs.python.org/issue?@action=redirect&bpo=42260

   (8) https://bugs.python.org/issue?@action=redirect&bpo=30459

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35134

   (10) https://bugs.python.org/issue?@action=redirect&bpo=43908

   (11) https://bugs.python.org/issue?@action=redirect&bpo=26241


File: python.info,  Node: 非推奨<7>,  Next: 削除<7>,  Prev: Porting to Python 3 10<2>,  Up: C API の変更<7>

1.5.13.4 非推奨
...............

   * The ‘PyUnicode_InternImmortal()’ function is now deprecated and
     will be removed in Python 3.12: use *note
     PyUnicode_InternInPlace(): aae. instead.  (Contributed by Victor
     Stinner in bpo-41692(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41692


File: python.info,  Node: 削除<7>,  Prev: 非推奨<7>,  Up: C API の変更<7>

1.5.13.5 削除
.............

   * Removed ‘Py_UNICODE_str*’ functions manipulating ‘Py_UNICODE*’
     strings.  (Contributed by Inada Naoki in bpo-41123(1).)

        * ‘Py_UNICODE_strlen’: use *note PyUnicode_GetLength(): ab0. or
          *note PyUnicode_GET_LENGTH: ab1.

        * ‘Py_UNICODE_strcat’: use *note PyUnicode_CopyCharacters():
          ab2. or *note PyUnicode_FromFormat(): 62b.

        * ‘Py_UNICODE_strcpy’, ‘Py_UNICODE_strncpy’: use *note
          PyUnicode_CopyCharacters(): ab2. or *note
          PyUnicode_Substring(): ab3.

        * ‘Py_UNICODE_strcmp’: use *note PyUnicode_Compare(): ab4.

        * ‘Py_UNICODE_strncmp’: use *note PyUnicode_Tailmatch(): ab5.

        * ‘Py_UNICODE_strchr’, ‘Py_UNICODE_strrchr’: use *note
          PyUnicode_FindChar(): ab6.

   * Removed ‘PyUnicode_GetMax()’.  Please migrate to new ( PEP 393(2))
     APIs.  (Contributed by Inada Naoki in bpo-41103(3).)

   * Removed ‘PyLong_FromUnicode()’.  Please migrate to *note
     PyLong_FromUnicodeObject(): ab7.  (Contributed by Inada Naoki in
     bpo-41103(4).)

   * Removed ‘PyUnicode_AsUnicodeCopy()’.  Please use *note
     PyUnicode_AsUCS4Copy(): ab8. or *note PyUnicode_AsWideCharString():
     ab9. (Contributed by Inada Naoki in bpo-41103(5).)

   * Removed ‘_Py_CheckRecursionLimit’ variable: it has been replaced by
     ‘ceval.recursion_limit’ of the *note PyInterpreterState: aba.
     structure.  (Contributed by Victor Stinner in bpo-41834(6).)

   * Removed undocumented macros ‘Py_ALLOW_RECURSION’ and
     ‘Py_END_ALLOW_RECURSION’ and the ‘recursion_critical’ field of the
     *note PyInterpreterState: aba. structure.  (Contributed by Serhiy
     Storchaka in bpo-41936(7).)

   * Removed the undocumented ‘PyOS_InitInterrupts()’ function.
     Initializing Python already implicitly installs signal handlers:
     see *note PyConfig.install_signal_handlers: abb.  (Contributed by
     Victor Stinner in bpo-41713(8).)

   * Remove the ‘PyAST_Validate()’ function.  It is no longer possible
     to build a AST object (‘mod_ty’ type) with the public C API. The
     function was already excluded from the limited C API ( PEP 384(9)).
     (Contributed by Victor Stinner in bpo-43244(10).)

   * Remove the ‘symtable.h’ header file and the undocumented functions:

        * ‘PyST_GetScope()’

        * ‘PySymtable_Build()’

        * ‘PySymtable_BuildObject()’

        * ‘PySymtable_Free()’

        * ‘Py_SymtableString()’

        * ‘Py_SymtableStringObject()’

     The ‘Py_SymtableString()’ function was part the stable ABI by
     mistake but it could not be used, because the ‘symtable.h’ header
     file was excluded from the limited C API.

     Use Python *note symtable: de. module instead.  (Contributed by
     Victor Stinner in bpo-43244(11).)

   * Remove *note PyOS_ReadlineFunctionPointer(): 7a5. from the limited
     C API headers and from ‘python3.dll’, the library that provides the
     stable ABI on Windows.  Since the function takes a ‘FILE*’
     argument, its ABI stability cannot be guaranteed.  (Contributed by
     Petr Viktorin in bpo-43868(12).)

   * Remove ‘ast.h’, ‘asdl.h’, and ‘Python-ast.h’ header files.  These
     functions were undocumented and excluded from the limited C API.
     Most names defined by these header files were not prefixed by ‘Py’
     and so could create names conflicts.  For example, ‘Python-ast.h’
     defined a ‘Yield’ macro which was conflict with the ‘Yield’ name
     used by the Windows ‘<winbase.h>’ header.  Use the Python *note
     ast: 9. module instead.  (Contributed by Victor Stinner in
     bpo-43244(13).)

   * Remove the compiler and parser functions using ‘struct _mod’ type,
     because the public AST C API was removed:

        * ‘PyAST_Compile()’

        * ‘PyAST_CompileEx()’

        * ‘PyAST_CompileObject()’

        * ‘PyFuture_FromAST()’

        * ‘PyFuture_FromASTObject()’

        * ‘PyParser_ASTFromFile()’

        * ‘PyParser_ASTFromFileObject()’

        * ‘PyParser_ASTFromFilename()’

        * ‘PyParser_ASTFromString()’

        * ‘PyParser_ASTFromStringObject()’

     These functions were undocumented and excluded from the limited C
     API. (Contributed by Victor Stinner in bpo-43244(14).)

   * Remove the ‘pyarena.h’ header file with functions:

        * ‘PyArena_New()’

        * ‘PyArena_Free()’

        * ‘PyArena_Malloc()’

        * ‘PyArena_AddPyObject()’

     These functions were undocumented, excluded from the limited C API,
     and were only used internally by the compiler.  (Contributed by
     Victor Stinner in bpo-43244(15).)

   * The ‘PyThreadState.use_tracing’ member has been removed to optimize
     Python.  (Contributed by Mark Shannon in bpo-43760(16).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41123

   (2) https://peps.python.org/pep-0393/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41103

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41103

   (5) https://bugs.python.org/issue?@action=redirect&bpo=41103

   (6) https://bugs.python.org/issue?@action=redirect&bpo=41834

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41936

   (8) https://bugs.python.org/issue?@action=redirect&bpo=41713

   (9) https://peps.python.org/pep-0384/

   (10) https://bugs.python.org/issue?@action=redirect&bpo=43244

   (11) https://bugs.python.org/issue?@action=redirect&bpo=43244

   (12) https://bugs.python.org/issue?@action=redirect&bpo=43868

   (13) https://bugs.python.org/issue?@action=redirect&bpo=43244

   (14) https://bugs.python.org/issue?@action=redirect&bpo=43244

   (15) https://bugs.python.org/issue?@action=redirect&bpo=43244

   (16) https://bugs.python.org/issue?@action=redirect&bpo=43760


File: python.info,  Node: Notable security feature in 3 10 7,  Next: Notable security feature in 3 10 8,  Prev: C API の変更<7>,  Up: What's New In Python 3 10

1.5.14 Notable security feature in 3.10.7
-----------------------------------------

Converting between *note int: 19b. and *note str: 169. in bases other
than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10
(decimal) now raises a *note ValueError: 2ec. if the number of digits in
string form is above a limit to avoid potential denial of service
attacks due to the algorithmic complexity.  This is a mitigation for CVE
2020-10735(1).  This limit can be configured or disabled by environment
variable, command line flag, or *note sys: df. APIs.  See the *note
integer string conversion length limitation: 80b. documentation.  The
default limit is 4300 digits in string form.

   ---------- Footnotes ----------

   (1) https://www.cve.org/CVERecord?id=CVE-2020-10735


File: python.info,  Node: Notable security feature in 3 10 8,  Next: Notable changes in 3 10 12,  Prev: Notable security feature in 3 10 7,  Up: What's New In Python 3 10

1.5.15 Notable security feature in 3.10.8
-----------------------------------------

The deprecated ‘mailcap’ module now refuses to inject unsafe text
(filenames, MIME types, parameters) into shell commands.  Instead of
using such text, it will warn and act as if a match was not found (or
for test commands, as if the test failed).  (Contributed by Petr
Viktorin in gh-98966(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98966


File: python.info,  Node: Notable changes in 3 10 12,  Prev: Notable security feature in 3 10 8,  Up: What's New In Python 3 10

1.5.16 Notable changes in 3.10.12
---------------------------------

* Menu:

* tarfile: tarfile<3>.


File: python.info,  Node: tarfile<3>,  Up: Notable changes in 3 10 12

1.5.16.1 tarfile
................

   * The extraction methods in *note tarfile: e4, and *note
     shutil.unpack_archive(): 696, have a new a 'filter' argument that
     allows limiting tar features than may be surprising or dangerous,
     such as creating files outside the destination directory.  See
     *note Extraction filters: 697. for details.  In Python 3.12, use
     without the 'filter' argument will show a *note DeprecationWarning:
     1a3.  In Python 3.14, the default will switch to ‘'data'’.
     (Contributed by Petr Viktorin in PEP 706(1).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0706/


File: python.info,  Node: What's New In Python 3 9,  Next: What's New In Python 3 8,  Prev: What's New In Python 3 10,  Up: What's New in Python

1.6 What's New In Python 3.9
============================


編集者: Łukasz Langa

This article explains the new features in Python 3.9, compared to 3.8.
Python 3.9 was released on October 5, 2020.  For full details, see the
*note changelog: 142.

参考
....

PEP 596(1) - Python 3.9 リリーススケジュール

* Menu:

* 概要: 概要 -- リリースハイライト<6>. リリースハイライト
* コード中の非推奨警告(DeprecationWarning)をチェックして下さい: コード中の非推奨警告 DeprecationWarning をチェックして下さい.
* 新しい機能: 新しい機能<10>.
* その他の言語変更: その他の言語変更<5>.
* 新たなモジュール: 新たなモジュール<5>.
* 改良されたモジュール: 改良されたモジュール<5>.
* 最適化: 最適化<6>.
* 非推奨: 非推奨<8>.
* 削除: 削除<8>.
* Python 3.9への移植: Python 3 9への移植.
* Build Changes: Build Changes<5>.
* C API の変更: C API の変更<9>.
* Python 3.9.1 での重要な変更点: Python 3 9 1 での重要な変更点.
* Python 3.9.2 での重要な変更点: Python 3 9 2 での重要な変更点.
* Python 3.9.3 での重要な変更点: Python 3 9 3 での重要な変更点.
* Python 3.9.5での重要な変更点: Python 3 9 5での重要な変更点.
* Notable security feature in 3.9.14: Notable security feature in 3 9 14.
* Notable changes in 3.9.17: Notable changes in 3 9 17.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0596/


File: python.info,  Node: 概要 -- リリースハイライト<6>,  Next: コード中の非推奨警告 DeprecationWarning をチェックして下さい,  Up: What's New In Python 3 9

1.6.1 概要 - リリースハイライト
-------------------------------

新たな文法機能:

   * PEP 584(1)、 ‘dict’ に和集合の演算子が追加されました。

   * PEP 585(2)、標準コレクション型の型ヒントにおける総称型 (generics) の
     使用。

   * PEP 614(3)、デコレータの適用における文法的制約の緩和。

新たな組み込み機能:

   * PEP 616(4)、prefixとsuffixを削除する文字列メソッド。

標準ライブラリの新機能:

   * PEP 593(5)、より柔軟な変数・関数アノテーション (訳注: ‘Annotated’ の
     導入)。

   * *note os.pidfd_open(): 6a4. が追加され、レースやシグナルを使わずに
     プロセス管理ができるようになりました。

インタプリタの改善:

   * PEP 573(6), fast access to module state from methods of C extension
     types;

   * PEP 617(7)、CPython における PEG (Parser Expression Grammar) ベース
     の新しい構文解析器の使用。

   * いくつかのPythonの組み込み型（range, tuple, set, frozenset, list,
     dict） を PEP 590(8) vectorcall を用いて高速化しました。

   * garbage collection does not block on resurrected objects;

   * a number of Python modules (‘_abc’, ‘audioop’, ‘_bz2’, ‘_codecs’,
     ‘_contextvars’, ‘_crypt’, ‘_functools’, ‘_json’, ‘_locale’, *note
     math: 92, *note operator: a3, *note resource: c1, *note time: f4,
     ‘_weakref’) now use multiphase initialization as defined by PEP
     489;

   * a number of standard library modules (‘audioop’, *note ast: 9,
     *note grp: 6a, ‘_hashlib’, *note pwd: b7, ‘_posixsubprocess’, *note
     random: bd, *note select: c6, *note struct: db, *note termios: e7,
     *note zlib: 139.) are now using the stable ABI defined by PEP 384.

新たなライブラリモジュール:

   * PEP 615(9)、IANAのTime Zone Databaseが標準ライブラリの *note
     zoneinfo: 13a. モジュールで提供されるようになりました。

   * an implementation of a topological sort of a graph is now provided
     in the new *note graphlib: 69. module.

リリースプロセスの変更:

   * PEP 602(10)、CPythonは年次のリリースサイクルを採用します。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0584/

   (2) https://peps.python.org/pep-0585/

   (3) https://peps.python.org/pep-0614/

   (4) https://peps.python.org/pep-0616/

   (5) https://peps.python.org/pep-0593/

   (6) https://peps.python.org/pep-0573/

   (7) https://peps.python.org/pep-0617/

   (8) https://peps.python.org/pep-0590/

   (9) https://peps.python.org/pep-0615/

   (10) https://peps.python.org/pep-0602/


File: python.info,  Node: コード中の非推奨警告 DeprecationWarning をチェックして下さい,  Next: 新しい機能<10>,  Prev: 概要 -- リリースハイライト<6>,  Up: What's New In Python 3 9

1.6.2 コード中の非推奨警告(DeprecationWarning)をチェックして下さい
------------------------------------------------------------------

Python 2.7がまだサポートされていた期間、Python 3の多くの機能はPython
2.7との後方互換性を保っていました。Python 2サポートの終了とともに、この
後方互換性レイヤは除去されたか、間もなく除去されます。ここ数年で、それら
の多くは警告 *note DeprecationWarning: 1a3. を出すようになりました。例え
ば、2012年にリリースされたPython 3.3以降、‘collections.abc.Mapping’ の代
りに ‘collections.Mapping’ を使うと、警告 *note DeprecationWarning: 1a3.
が出ます。

警告 *note DeprecationWarning: 1a3. および *note
PendingDeprecationWarning: ac5. を確認するために、 *note -W: ac6.
‘default’ コマンドラインオプションを付けて、あなたのアプリケーションをテ
ストして下さい。あるいは、*note -W: ac6. ‘error’ で警告をエラーとして扱
うこともできます。サードパーティによるコードの警告を無視するには、*note
Warnings Filter: 1b1. を使うことができます。

Python 3.9は、Python 2後方互換性レイヤを提供する最後のバージョンです。こ
のレイヤは、Pythonプロジェクトの保守管理者に、Python 2サポートを止めて
Python 3.9サポートを追加する時間的な余裕を与えるためのものです。

Aliases to *note Abstract Base Classes: a78. in the *note collections:
1e. module, like ‘collections.Mapping’ alias to *note
collections.abc.Mapping: ac7, are kept for one last release for backward
compatibility.  They will be removed from Python 3.10.

より一般的には、あなたのコードが次のバージョンのPythonと互換性を保てるよ
う、*note Python Development Mode: 508. でテストするようにしてください。

注釈: Pythonのこのバージョンで、既存の多くの非推奨機能が削除されました。
詳しくは *note 削除: ac8. を見て下さい。


File: python.info,  Node: 新しい機能<10>,  Next: その他の言語変更<5>,  Prev: コード中の非推奨警告 DeprecationWarning をチェックして下さい,  Up: What's New In Python 3 9

1.6.3 新しい機能
----------------

* Menu:

* 辞書のマージと更新演算子::
* prefixとsuffixを削除する新しい文字列メソッド::
* 標準コレクション型の型ヒントにおける総称型 (generics) の使用: 標準コレクション型の型ヒントにおける総称型 generics の使用.
* 新しいパーサー::


File: python.info,  Node: 辞書のマージと更新演算子,  Next: prefixとsuffixを削除する新しい文字列メソッド,  Up: 新しい機能<10>

1.6.3.1 辞書のマージと更新演算子
................................

組み込みの *note dict: 183. クラスにマージ(‘|’)と更新(‘|=’)演算子が追加
されました。この演算子は、辞書をマージする既存の方法 ‘dict.update’ と
‘{**d1, **d2}’ を補完します。

以下はプログラム例です:

     >>> x = {"key1": "value1 from x", "key2": "value2 from x"}
     >>> y = {"key2": "value2 from y", "key3": "value3 from y"}
     >>> x | y
     {'key1': 'value1 from x', 'key2': 'value2 from y', 'key3': 'value3 from y'}
     >>> y | x
     {'key2': 'value2 from x', 'key3': 'value3 from y', 'key1': 'value1 from x'}

詳細は PEP 584(1) を参照してください。(Brandt Bucher の貢献による
bpo-36144(2))

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0584/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36144


File: python.info,  Node: prefixとsuffixを削除する新しい文字列メソッド,  Next: 標準コレクション型の型ヒントにおける総称型 generics の使用,  Prev: 辞書のマージと更新演算子,  Up: 新しい機能<10>

1.6.3.2 prefixとsuffixを削除する新しい文字列メソッド
....................................................

文字列から不要な prefix や suffix を簡単に削除する *note
str.removeprefix(prefix): acc. と *note str.removesuffix(suffix): acd. が
追加されました。 ‘bytes’, ‘bytearray’, ‘collections.UserString’ にも同様
のメソッドが追加されました。詳細は PEP 616(1) を参照してください。
(Dennis Sweeney の貢献による bpo-39939(2))

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0616/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39939


File: python.info,  Node: 標準コレクション型の型ヒントにおける総称型 generics の使用,  Next: 新しいパーサー,  Prev: prefixとsuffixを削除する新しい文字列メソッド,  Up: 新しい機能<10>

1.6.3.3 標準コレクション型の型ヒントにおける総称型 (generics) の使用
....................................................................

型アノテーションで、‘typing’ モジュールからインポートしていた大文字の型
（‘List’ や ‘Dict’）の代わりに、総称型（generics）で ‘list’ や ‘dict’ と
いった標準コレクション型が使用できるようになりました。いくつかの他の標準
ライブラリの型（‘queue.Queue’ など）も総称型として使用できます。

例:

     def greet_all(names: list[str]) -> None:
         for name in names:
             print("Hello", name)

詳細は PEP 585(1) を参照してください。(Guido van Rossum、Ethan Smith、
Batuhan Taşkaya の貢献による bpo-39481(2))

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0585/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39481


File: python.info,  Node: 新しいパーサー,  Prev: 標準コレクション型の型ヒントにおける総称型 generics の使用,  Up: 新しい機能<10>

1.6.3.4 新しいパーサー
......................

Python 3.9は、 LL(1)(1) に代えて PEG(2) に基づく新しいパーサーを採用して
います。新しいパーサーのパフォーマンスは古いパーサーとほぼ同程度ですが、
新しい言語の機能を設計する際に、PEGの形式主義はより柔軟です。我々は、こ
の柔軟性をPython 3.10以降に使い始める予定です。

*note ast: 9. モジュールは、新しいパーサーを使って古いパーサーと同じ
ASTを生成します。

In Python 3.10, the old parser will be deleted and so will all
functionality that depends on it (primarily the ‘parser’ module, which
has long been deprecated).  In Python 3.9 'only', you can switch back to
the LL(1) parser using a command line switch (‘-X oldparser’) or an
environment variable (‘PYTHONOLDPARSER=1’).

詳細は PEP 617(3) を参照してください。(Guido van Rossum,、Pablo Galindo、
およびLysandros Nikolaouの貢献による bpo-40334(4))

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/LL_parser

   (2) https://en.wikipedia.org/wiki/Parsing_expression_grammar

   (3) https://peps.python.org/pep-0617/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40334


File: python.info,  Node: その他の言語変更<5>,  Next: 新たなモジュール<5>,  Prev: 新しい機能<10>,  Up: What's New In Python 3 9

1.6.4 その他の言語変更
----------------------

   * *note __import__(): ad1. now raises *note ImportError: 65b. instead
     of *note ValueError: 2ec, which used to occur when a relative
     import went past its top-level package.  (Contributed by Ngalim
     Siregar in bpo-37444(1).)

   * Python now gets the absolute path of the script filename specified
     on the command line (ex: ‘python3 script.py’): the ‘__file__’
     attribute of the *note __main__: 1. module became an absolute path,
     rather than a relative path.  These paths now remain valid after
     the current directory is changed by *note os.chdir(): 821.  As a
     side effect, the traceback also displays the absolute path for
     *note __main__: 1. module frames in this case.  (Contributed by
     Victor Stinner in bpo-20443(2).)

   * In the *note Python Development Mode: 508. and in *note debug
     build: 509, the 'encoding' and 'errors' arguments are now checked
     for string encoding and decoding operations.  Examples: *note
     open(): 316, *note str.encode(): ad2. and *note bytes.decode():
     ad3.

     By default, for best performance, the 'errors' argument is only
     checked at the first encoding/decoding error and the 'encoding'
     argument is sometimes ignored for empty strings.  (Contributed by
     Victor Stinner in bpo-37388(3).)

   * ‘"".replace("", s, n)’ now returns ‘s’ instead of an empty string
     for all non-zero ‘n’.  It is now consistent with ‘"".replace("",
     s)’.  There are similar changes for *note bytes: 192. and *note
     bytearray: 344. objects.  (Contributed by Serhiy Storchaka in
     bpo-28029(4).)

   * Any valid expression can now be used as a *note decorator: 93a.
     Previously, the grammar was much more restrictive.  See PEP 614(5)
     for details.  (Contributed by Brandt Bucher in bpo-39702(6).)

   * Improved help for the *note typing: 10a. module.  Docstrings are
     now shown for all special forms and special generic aliases (like
     ‘Union’ and ‘List’).  Using *note help(): ad4. with generic alias
     like ‘List[int]’ will show the help for the correspondent concrete
     type (‘list’ in this case).  (Contributed by Serhiy Storchaka in
     bpo-40257(7).)

   * Parallel running of *note aclose(): ad5. / *note asend(): ad6. /
     *note athrow(): 71d. is now prohibited, and ‘ag_running’ now
     reflects the actual running status of the async generator.
     (Contributed by Yury Selivanov in bpo-30773(8).)

   * Unexpected errors in calling the ‘__iter__’ method are no longer
     masked by ‘TypeError’ in the *note in: 34b. operator and functions
     *note contains(): ad7, *note indexOf(): ad8. and *note countOf():
     ad9. of the *note operator: a3. module.  (Contributed by Serhiy
     Storchaka in bpo-40824(9).)

   * Unparenthesized lambda expressions can no longer be the expression
     part in an ‘if’ clause in comprehensions and generator expressions.
     See bpo-41848(10) and bpo-43755(11) for details.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37444

   (2) https://bugs.python.org/issue?@action=redirect&bpo=20443

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37388

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28029

   (5) https://peps.python.org/pep-0614/

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39702

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40257

   (8) https://bugs.python.org/issue?@action=redirect&bpo=30773

   (9) https://bugs.python.org/issue?@action=redirect&bpo=40824

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41848

   (11) https://bugs.python.org/issue?@action=redirect&bpo=43755


File: python.info,  Node: 新たなモジュール<5>,  Next: 改良されたモジュール<5>,  Prev: その他の言語変更<5>,  Up: What's New In Python 3 9

1.6.5 新たなモジュール
----------------------

* Menu:

* zoneinfo::
* graphlib: graphlib<2>.


File: python.info,  Node: zoneinfo,  Next: graphlib<2>,  Up: 新たなモジュール<5>

1.6.5.1 zoneinfo
................

*note zoneinfo: 13a. モジュールにより標準ライブラリにIANAのタイムゾーン
データベースへのサポートを導入されます。*note zoneinfo.ZoneInfo: adc. と
いう、システムのタイムゾーンデータを背景とした具体的な *note
datetime.tzinfo: 7f6. の実装が追加されます。

以下はプログラム例です:

     >>> from zoneinfo import ZoneInfo
     >>> from datetime import datetime, timedelta

     >>> # Daylight saving time
     >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
     >>> print(dt)
     2020-10-31 12:00:00-07:00
     >>> dt.tzname()
     'PDT'

     >>> # Standard time
     >>> dt += timedelta(days=7)
     >>> print(dt)
     2020-11-07 12:00:00-08:00
     >>> print(dt.tzname())
     PST

As a fall-back source of data for platforms that don't ship the IANA
database, the tzdata(1) module was released as a first-party package -
distributed via PyPI and maintained by the CPython core team.

参考
....

PEP 615(2) - Support for the IANA Time Zone Database in the Standard Library

     PEP作成と実装は Paul Ganssle による。

   ---------- Footnotes ----------

   (1) https://pypi.org/project/tzdata/

   (2) https://peps.python.org/pep-0615/


File: python.info,  Node: graphlib<2>,  Prev: zoneinfo,  Up: 新たなモジュール<5>

1.6.5.2 graphlib
................

A new module, *note graphlib: 69, was added that contains the *note
graphlib.TopologicalSorter: ade. class to offer functionality to perform
topological sorting of graphs.  (Contributed by Pablo Galindo, Tim
Peters and Larry Hastings in bpo-17005(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17005


File: python.info,  Node: 改良されたモジュール<5>,  Next: 最適化<6>,  Prev: 新たなモジュール<5>,  Up: What's New In Python 3 9

1.6.6 改良されたモジュール
--------------------------

* Menu:

* ast: ast<4>.
* asyncio: asyncio<8>.
* compileall: compileall<2>.
* concurrent.futures: concurrent futures<3>.
* curses: curses<3>.
* datetime: datetime<3>.
* distutils: distutils<3>.
* fcntl: fcntl<2>.
* ftplib: ftplib<2>.
* gc: gc<3>.
* hashlib: hashlib<4>.
* http: http<2>.
* IDLE と idelelib: IDLE と idelelib<3>.
* imaplib: imaplib<2>.
* importlib: importlib<3>.
* inspect: inspect<5>.
* ipaddress: ipaddress<2>.
* math: math<5>.
* multiprocessing: multiprocessing<3>.
* nntplib::
* os: os<6>.
* pathlib: pathlib<9>.
* pdb: pdb<5>.
* poplib::
* pprint: pprint<2>.
* pydoc: pydoc<2>.
* random: random<3>.
* signal::
* smtplib::
* socket: socket<4>.
* time: time<3>.
* sys: sys<6>.
* tracemalloc::
* typing: typing<7>.
* unicodedata: unicodedata<5>.
* venv: venv<3>.
* xml: xml<3>.


File: python.info,  Node: ast<4>,  Next: asyncio<8>,  Up: 改良されたモジュール<5>

1.6.6.1 ast
...........

Added the 'indent' option to *note dump(): ae1. which allows it to
produce a multiline indented output.  (Contributed by Serhiy Storchaka
in bpo-37995(1).)

Added *note ast.unparse(): ae2. as a function in the *note ast: 9.
module that can be used to unparse an *note ast.AST: 4c3. object and
produce a string with code that would produce an equivalent *note
ast.AST: 4c3. object when parsed.  (Contributed by Pablo Galindo and
Batuhan Taskaya in bpo-38870(2).)

Added docstrings to AST nodes that contains the ASDL signature used to
construct that node.  (Contributed by Batuhan Taskaya in bpo-39638(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37995

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38870

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39638


File: python.info,  Node: asyncio<8>,  Next: compileall<2>,  Prev: ast<4>,  Up: 改良されたモジュール<5>

1.6.6.2 asyncio
...............

セキュリティ上の重大な懸念により、*note
asyncio.loop.create_datagram_endpoint(): 93c. での 'reuse_address' 引数
は無効になりました。これはソケットオプション ‘SO_REUSEADDR'’ のUDP にお
ける挙動が原因です。詳しくは、‘loop.create_datagram_endpoint()’ のドキュ
メントを参照してください。(Kyle Stanley, Antoine Pitrou, Yury Selivanov
による貢献 bpo-37228(1))

Added a new *note coroutine: 6b9. *note shutdown_default_executor():
ae4. that schedules a shutdown for the default executor that waits on
the *note ThreadPoolExecutor: 949. to finish closing.  Also, *note
asyncio.run(): 2f3. has been updated to use the new *note coroutine:
6b9.  (Contributed by Kyle Stanley in bpo-34037(2).)

Added ‘asyncio.PidfdChildWatcher’, a Linux-specific child watcher
implementation that polls process file descriptors.  (bpo-38692(3))

Added a new *note coroutine: 6b9. *note asyncio.to_thread(): ae5.  It is
mainly used for running IO-bound functions in a separate thread to avoid
blocking the event loop, and essentially works as a high-level version
of *note run_in_executor(): ae6. that can directly take keyword
arguments.  (Contributed by Kyle Stanley and Yury Selivanov in
bpo-32309(4).)

When cancelling the task due to a timeout, *note asyncio.wait_for():
815. will now wait until the cancellation is complete also in the case
when 'timeout' is <= 0, like it does with positive timeouts.
(Contributed by Elvis Pranskevichus in bpo-32751(5).)

*note asyncio: b. now raises *note TypeError: 198. when calling
incompatible methods with an *note ssl.SSLSocket: ae7. socket.
(Contributed by Ido Michael in bpo-37404(6).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37228

   (2) https://bugs.python.org/issue?@action=redirect&bpo=34037

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38692

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32309

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32751

   (6) https://bugs.python.org/issue?@action=redirect&bpo=37404


File: python.info,  Node: compileall<2>,  Next: concurrent futures<3>,  Prev: asyncio<8>,  Up: 改良されたモジュール<5>

1.6.6.3 compileall
..................

Added new possibility to use hardlinks for duplicated ‘.pyc’ files:
'hardlink_dupes' parameter and -hardlink-dupes command line option.
(Contributed by Lumír 'Frenzy' Balhar in bpo-40495(1).)

Added new options for path manipulation in resulting ‘.pyc’ files:
'stripdir', 'prependdir', 'limit_sl_dest' parameters and -s, -p, -e
command line options.  Added the possibility to specify the option for
an optimization level multiple times.  (Contributed by Lumír 'Frenzy'
Balhar in bpo-38112(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40495

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38112


File: python.info,  Node: concurrent futures<3>,  Next: curses<3>,  Prev: compileall<2>,  Up: 改良されたモジュール<5>

1.6.6.4 concurrent.futures
..........................

Added a new 'cancel_futures' parameter to *note
concurrent.futures.Executor.shutdown(): aea. that cancels all pending
futures which have not started running, instead of waiting for them to
complete before shutting down the executor.  (Contributed by Kyle
Stanley in bpo-39349(1).)

Removed daemon threads from *note ThreadPoolExecutor: 949. and *note
ProcessPoolExecutor: 1d6.  This improves compatibility with
subinterpreters and predictability in their shutdown processes.
(Contributed by Kyle Stanley in bpo-39812(2).)

Workers in *note ProcessPoolExecutor: 1d6. are now spawned on demand,
only when there are no available idle workers to reuse.  This optimizes
startup overhead and reduces the amount of lost CPU time to idle
workers.  (Contributed by Kyle Stanley in bpo-39207(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39349

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39812

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39207


File: python.info,  Node: curses<3>,  Next: datetime<3>,  Prev: concurrent futures<3>,  Up: 改良されたモジュール<5>

1.6.6.5 curses
..............

*note curses.get_escdelay(): aec, *note curses.set_escdelay(): aed,
*note curses.get_tabsize(): aee, *note curses.set_tabsize(): aef. の関数
が追加されました。(Anthony Sottileによる bpo-38312(1) でのコントリビュー
ト。)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38312


File: python.info,  Node: datetime<3>,  Next: distutils<3>,  Prev: curses<3>,  Up: 改良されたモジュール<5>

1.6.6.6 datetime
................

The *note isocalendar(): af1. of *note datetime.date: 1fa. and *note
isocalendar(): af2. of *note datetime.datetime: 4e2. methods now returns
a *note namedtuple(): 4e0. instead of a *note tuple: 614.  (Contributed
by Donghee Na in bpo-24416(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24416


File: python.info,  Node: distutils<3>,  Next: fcntl<2>,  Prev: datetime<3>,  Up: 改良されたモジュール<5>

1.6.6.7 distutils
.................

The ‘upload’ command now creates SHA2-256 and Blake2b-256 hash digests.
It skips MD5 on platforms that block MD5 digest.  (Contributed by
Christian Heimes in bpo-40698(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40698


File: python.info,  Node: fcntl<2>,  Next: ftplib<2>,  Prev: distutils<3>,  Up: 改良されたモジュール<5>

1.6.6.8 fcntl
.............

Added constants ‘fcntl.F_OFD_GETLK’, ‘fcntl.F_OFD_SETLK’ and
‘fcntl.F_OFD_SETLKW’.  (Contributed by Donghee Na in bpo-38602(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38602


File: python.info,  Node: ftplib<2>,  Next: gc<3>,  Prev: fcntl<2>,  Up: 改良されたモジュール<5>

1.6.6.9 ftplib
..............

*note FTP: af6. and *note FTP_TLS: af7. now raise a *note ValueError:
2ec. if the given timeout for their constructor is zero to prevent the
creation of a non-blocking socket.  (Contributed by Donghee Na in
bpo-39259(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39259


File: python.info,  Node: gc<3>,  Next: hashlib<4>,  Prev: ftplib<2>,  Up: 改良されたモジュール<5>

1.6.6.10 gc
...........

When the garbage collector makes a collection in which some objects
resurrect (they are reachable from outside the isolated cycles after the
finalizers have been executed), do not block the collection of all
objects that are still unreachable.  (Contributed by Pablo Galindo and
Tim Peters in bpo-38379(1).)

Added a new function *note gc.is_finalized(): af9. to check if an object
has been finalized by the garbage collector.  (Contributed by Pablo
Galindo in bpo-39322(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38379

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39322


File: python.info,  Node: hashlib<4>,  Next: http<2>,  Prev: gc<3>,  Up: 改良されたモジュール<5>

1.6.6.11 hashlib
................

The *note hashlib: 6c. module can now use SHA3 hashes and SHAKE XOF from
OpenSSL when available.  (Contributed by Christian Heimes in
bpo-37630(1).)

Builtin hash modules can now be disabled with ‘./configure
--without-builtin-hashlib-hashes’ or selectively enabled with e.g.
‘./configure --with-builtin-hashlib-hashes=sha3,blake2’ to force use of
OpenSSL based implementation.  (Contributed by Christian Heimes in
bpo-40479(2))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37630

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40479


File: python.info,  Node: http<2>,  Next: IDLE と idelelib<3>,  Prev: hashlib<4>,  Up: 改良されたモジュール<5>

1.6.6.12 http
.............

HTTP status codes ‘103 EARLY_HINTS’, ‘418 IM_A_TEAPOT’ and ‘425
TOO_EARLY’ are added to *note http.HTTPStatus: afc.  (Contributed by
Donghee Na in bpo-39509(1) and Ross Rhodes in bpo-39507(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39509

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39507


File: python.info,  Node: IDLE と idelelib<3>,  Next: imaplib<2>,  Prev: http<2>,  Up: 改良されたモジュール<5>

1.6.6.13 IDLE と idelelib
.........................

Added option to toggle cursor blink off.  (Contributed by Zackery Spytz
in bpo-4603(1).)

Escape key now closes IDLE completion windows.  (Contributed by Johnny
Najera in bpo-38944(2).)

Added keywords to module name completion list.  (Contributed by Terry J.
Reedy in bpo-37765(3).)

New in 3.9 maintenance releases

Make IDLE invoke *note sys.excepthook(): a0c. (when started without
'-n').  User hooks were previously ignored.  (Contributed by Ken Hilton
in bpo-43008(4).)

The changes above have been backported to 3.8 maintenance releases.

Rearrange the settings dialog.  Split the General tab into Windows and
Shell/Ed tabs.  Move help sources, which extend the Help menu, to the
Extensions tab.  Make space for new options and shorten the dialog.  The
latter makes the dialog better fit small screens.  (Contributed by Terry
Jan Reedy in bpo-40468(5).)  Move the indent space setting from the Font
tab to the new Windows tab.  (Contributed by Mark Roseman and Terry Jan
Reedy in bpo-33962(6).)

Apply syntax highlighting to ‘.pyi’ files.  (Contributed by Alex Waygood
and Terry Jan Reedy in bpo-45447(7).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=4603

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38944

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37765

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43008

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40468

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33962

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45447


File: python.info,  Node: imaplib<2>,  Next: importlib<3>,  Prev: IDLE と idelelib<3>,  Up: 改良されたモジュール<5>

1.6.6.14 imaplib
................

*note IMAP4: aff. and *note IMAP4_SSL: b00. now have an optional
'timeout' parameter for their constructors.  Also, the *note open():
b01. method now has an optional 'timeout' parameter with this change.
The overridden methods of *note IMAP4_SSL: b00. and *note IMAP4_stream:
b02. were applied to this change.  (Contributed by Donghee Na in
bpo-38615(1).)

*note imaplib.IMAP4.unselect(): b03. is added.  *note
imaplib.IMAP4.unselect(): b03. frees server's resources associated with
the selected mailbox and returns the server to the authenticated state.
This command performs the same actions as *note imaplib.IMAP4.close():
b04, except that no messages are permanently removed from the currently
selected mailbox.  (Contributed by Donghee Na in bpo-40375(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38615

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40375


File: python.info,  Node: importlib<3>,  Next: inspect<5>,  Prev: imaplib<2>,  Up: 改良されたモジュール<5>

1.6.6.15 importlib
..................

To improve consistency with import statements, *note
importlib.util.resolve_name(): b06. now raises *note ImportError: 65b.
instead of *note ValueError: 2ec. for invalid relative import attempts.
(Contributed by Ngalim Siregar in bpo-37444(1).)

Import loaders which publish immutable module objects can now publish
immutable packages in addition to individual modules.  (Contributed by
Dino Viehland in bpo-39336(2).)

Added *note importlib.resources.files(): 6b6. function with support for
subdirectories in package data, matching backport in
‘importlib_resources’ version 1.5.  (Contributed by Jason R. Coombs in
bpo-39791(3).)

Refreshed ‘importlib.metadata’ from ‘importlib_metadata’ version 1.6.1.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37444

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39336

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39791


File: python.info,  Node: inspect<5>,  Next: ipaddress<2>,  Prev: importlib<3>,  Up: 改良されたモジュール<5>

1.6.6.16 inspect
................

*note inspect.BoundArguments.arguments: b08. は ‘OrderedDict’ から標準の
dictに変更されました。(Inada Naoki の貢献による bpo-36350(1),
bpo-39775(2))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36350

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39775


File: python.info,  Node: ipaddress<2>,  Next: math<5>,  Prev: inspect<5>,  Up: 改良されたモジュール<5>

1.6.6.17 ipaddress
..................

*note ipaddress: 84. now supports IPv6 Scoped Addresses (IPv6 address
with suffix ‘%<scope_id>’).

Scoped IPv6 addresses can be parsed using *note ipaddress.IPv6Address:
50d.  If present, scope zone ID is available through the *note scope_id:
b0a. attribute.  (Contributed by Oleksandr Pavliuk in bpo-34788(1).)

Starting with Python 3.9.5 the *note ipaddress: 84. module no longer
accepts any leading zeros in IPv4 address strings.  (Contributed by
Christian Heimes in bpo-36384(2)).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34788

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36384


File: python.info,  Node: math<5>,  Next: multiprocessing<3>,  Prev: ipaddress<2>,  Up: 改良されたモジュール<5>

1.6.6.18 math
.............

Expanded the *note math.gcd(): b0c. function to handle multiple
arguments.  Formerly, it only supported two arguments.  (Contributed by
Serhiy Storchaka in bpo-39648(1).)

Added *note math.lcm(): b0d.: return the least common multiple of
specified arguments.  (Contributed by Mark Dickinson, Ananthakrishnan
and Serhiy Storchaka in bpo-39479(2) and bpo-39648(3).)

Added *note math.nextafter(): 6c0.: return the next floating-point value
after 'x' towards 'y'.  (Contributed by Victor Stinner in bpo-39288(4).)

Added *note math.ulp(): b0e.: return the value of the least significant
bit of a float.  (Contributed by Victor Stinner in bpo-39310(5).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39648

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39479

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39648

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39288

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39310


File: python.info,  Node: multiprocessing<3>,  Next: nntplib,  Prev: math<5>,  Up: 改良されたモジュール<5>

1.6.6.19 multiprocessing
........................

The *note multiprocessing.SimpleQueue: b10. class has a new *note
close(): b11. method to explicitly close the queue.  (Contributed by
Victor Stinner in bpo-30966(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30966


File: python.info,  Node: nntplib,  Next: os<6>,  Prev: multiprocessing<3>,  Up: 改良されたモジュール<5>

1.6.6.20 nntplib
................

‘NNTP’ and ‘NNTP_SSL’ now raise a *note ValueError: 2ec. if the given
timeout for their constructor is zero to prevent the creation of a
non-blocking socket.  (Contributed by Donghee Na in bpo-39259(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39259


File: python.info,  Node: os<6>,  Next: pathlib<9>,  Prev: nntplib,  Up: 改良されたモジュール<5>

1.6.6.21 os
...........

Added *note CLD_KILLED: b14. and *note CLD_STOPPED: b15. for ‘si_code’.
(Contributed by Donghee Na in bpo-38493(1).)

Exposed the Linux-specific *note os.pidfd_open(): 6a4. (bpo-38692(2))
and *note os.P_PIDFD: b16. (bpo-38713(3)) for process management with
file descriptors.

*note os.unsetenv(): 25c. 関数が、Windowsでも使えるようになりました。
(bpo-39413(4) におけるVictor Stinnerの貢献による)

*note os.putenv(): 25b. と *note os.unsetenv(): 25c. 関数が、常に利用で
きるようになりました。(bpo-39395(5) におけるVictor Stinnerの貢献による)

Added *note os.waitstatus_to_exitcode(): b17. function: convert a wait
status to an exit code.  (Contributed by Victor Stinner in
bpo-40094(6).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38493

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38692

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38713

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39413

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39395

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40094


File: python.info,  Node: pathlib<9>,  Next: pdb<5>,  Prev: os<6>,  Up: 改良されたモジュール<5>

1.6.6.22 pathlib
................

Added *note pathlib.Path.readlink(): b19. which acts similarly to *note
os.readlink(): b1a.  (Contributed by Girts Folkmanis in bpo-30618(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30618


File: python.info,  Node: pdb<5>,  Next: poplib,  Prev: pathlib<9>,  Up: 改良されたモジュール<5>

1.6.6.23 pdb
............

On Windows now *note Pdb: 273. supports ‘~/.pdbrc’.  (Contributed by Tim
Hopper and Dan Lidral-Porter in bpo-20523(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20523


File: python.info,  Node: poplib,  Next: pprint<2>,  Prev: pdb<5>,  Up: 改良されたモジュール<5>

1.6.6.24 poplib
...............

*note POP3: b1d. and *note POP3_SSL: b1e. now raise a *note ValueError:
2ec. if the given timeout for their constructor is zero to prevent the
creation of a non-blocking socket.  (Contributed by Donghee Na in
bpo-39259(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39259


File: python.info,  Node: pprint<2>,  Next: pydoc<2>,  Prev: poplib,  Up: 改良されたモジュール<5>

1.6.6.25 pprint
...............

*note pprint: b3. can now pretty-print *note types.SimpleNamespace: 4e5.
(Contributed by Carl Bordum Hansen in bpo-37376(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37376


File: python.info,  Node: pydoc<2>,  Next: random<3>,  Prev: pprint<2>,  Up: 改良されたモジュール<5>

1.6.6.26 pydoc
..............

The documentation string is now shown not only for class, function,
method etc, but for any object that has its own *note __doc__: b21.
attribute.  (Contributed by Serhiy Storchaka in bpo-40257(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40257


File: python.info,  Node: random<3>,  Next: signal,  Prev: pydoc<2>,  Up: 改良されたモジュール<5>

1.6.6.27 random
...............

Added a new *note random.Random.randbytes(): b23. method: generate
random bytes.  (Contributed by Victor Stinner in bpo-40286(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40286


File: python.info,  Node: signal,  Next: smtplib,  Prev: random<3>,  Up: 改良されたモジュール<5>

1.6.6.28 signal
...............

Exposed the Linux-specific *note signal.pidfd_send_signal(): b25. for
sending to signals to a process using a file descriptor instead of a
pid.  (bpo-38712(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38712


File: python.info,  Node: smtplib,  Next: socket<4>,  Prev: signal,  Up: 改良されたモジュール<5>

1.6.6.29 smtplib
................

*note SMTP: b27. and *note SMTP_SSL: b28. now raise a *note ValueError:
2ec. if the given timeout for their constructor is zero to prevent the
creation of a non-blocking socket.  (Contributed by Donghee Na in
bpo-39259(1).)

*note LMTP: b29. constructor now has an optional 'timeout' parameter.
(Contributed by Donghee Na in bpo-39329(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39259

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39329


File: python.info,  Node: socket<4>,  Next: time<3>,  Prev: smtplib,  Up: 改良されたモジュール<5>

1.6.6.30 socket
...............

The *note socket: d1. module now exports the *note CAN_RAW_JOIN_FILTERS:
b2b. constant on Linux 4.1 and greater.  (Contributed by Stefan
Tatschner and Zackery Spytz in bpo-25780(1).)

The socket module now supports the *note CAN_J1939: b2c. protocol on
platforms that support it.  (Contributed by Karl Ding in bpo-40291(2).)

The socket module now has the *note socket.send_fds(): b2d. and *note
socket.recv_fds(): b2e. functions.  (Contributed by Joannah Nanjekye,
Shinya Okano and Victor Stinner in bpo-28724(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25780

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40291

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28724


File: python.info,  Node: time<3>,  Next: sys<6>,  Prev: socket<4>,  Up: 改良されたモジュール<5>

1.6.6.31 time
.............

On AIX, *note thread_time(): b30. is now implemented with
‘thread_cputime()’ which has nanosecond resolution, rather than
‘clock_gettime(CLOCK_THREAD_CPUTIME_ID)’ which has a resolution of 10
milliseconds.  (Contributed by Batuhan Taskaya in bpo-40192(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40192


File: python.info,  Node: sys<6>,  Next: tracemalloc,  Prev: time<3>,  Up: 改良されたモジュール<5>

1.6.6.32 sys
............

Added a new *note sys.platlibdir: b32. attribute: name of the
platform-specific library directory.  It is used to build the path of
standard library and the paths of installed extension modules.  It is
equal to ‘"lib"’ on most platforms.  On Fedora and SuSE, it is equal to
‘"lib64"’ on 64-bit platforms.  (Contributed by Jan Matějek, Matěj Cepl,
Charalampos Stratakis and Victor Stinner in bpo-1294959(1).)

Previously, *note sys.stderr: b33. was block-buffered when
non-interactive.  Now ‘stderr’ defaults to always being line-buffered.
(Contributed by Jendrik Seipp in bpo-13601(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1294959

   (2) https://bugs.python.org/issue?@action=redirect&bpo=13601


File: python.info,  Node: tracemalloc,  Next: typing<7>,  Prev: sys<6>,  Up: 改良されたモジュール<5>

1.6.6.33 tracemalloc
....................

Added *note tracemalloc.reset_peak(): b35. to set the peak size of
traced memory blocks to the current size, to measure the peak of
specific pieces of code.  (Contributed by Huon Wilson in bpo-40630(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40630


File: python.info,  Node: typing<7>,  Next: unicodedata<5>,  Prev: tracemalloc,  Up: 改良されたモジュール<5>

1.6.6.34 typing
...............

PEP 593(1) introduced an *note typing.Annotated: b37. type to decorate
existing types with context-specific metadata and new ‘include_extras’
parameter to *note typing.get_type_hints(): 8c0. to access the metadata
at runtime.  (Contributed by Till Varoquaux and Konstantin Kashin.)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0593/


File: python.info,  Node: unicodedata<5>,  Next: venv<3>,  Prev: typing<7>,  Up: 改良されたモジュール<5>

1.6.6.35 unicodedata
....................

Unicode データベースが、バージョン 13.0.0 に更新されました。
(bpo-39926(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39926


File: python.info,  Node: venv<3>,  Next: xml<3>,  Prev: unicodedata<5>,  Up: 改良されたモジュール<5>

1.6.6.36 venv
.............

The activation scripts provided by *note venv: 117. now all specify
their prompt customization consistently by always using the value
specified by ‘__VENV_PROMPT__’.  Previously some scripts unconditionally
used ‘__VENV_PROMPT__’, others only if it happened to be set (which was
the default case), and one used ‘__VENV_NAME__’ instead.  (Contributed
by Brett Cannon in bpo-37663(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37663


File: python.info,  Node: xml<3>,  Prev: venv<3>,  Up: 改良されたモジュール<5>

1.6.6.37 xml
............

White space characters within attributes are now preserved when
serializing *note xml.etree.ElementTree: 12b. to XML file.  EOLNs are no
longer normalized to "n".  This is the result of discussion about how to
interpret section 2.11 of XML spec.  (Contributed by Mefistotelis in
bpo-39011(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39011


File: python.info,  Node: 最適化<6>,  Next: 非推奨<8>,  Prev: 改良されたモジュール<5>,  Up: What's New In Python 3 9

1.6.7 最適化
------------

   * Optimized the idiom for assignment a temporary variable in
     comprehensions.  Now ‘for y in [expr]’ in comprehensions is as fast
     as a simple assignment ‘y = expr’.  For example:

          sums = [s for s in [0] for x in data for s in [s + x]]

     Unlike the ‘:=’ operator this idiom does not leak a variable to the
     outer scope.

     (Contributed by Serhiy Storchaka in bpo-32856(1).)

   * Optimized signal handling in multithreaded applications.  If a
     thread different than the main thread gets a signal, the bytecode
     evaluation loop is no longer interrupted at each bytecode
     instruction to check for pending signals which cannot be handled.
     Only the main thread of the main interpreter can handle signals.

     Previously, the bytecode evaluation loop was interrupted at each
     instruction until the main thread handles signals.  (Contributed by
     Victor Stinner in bpo-40010(2).)

   * Optimized the *note subprocess: dc. module on FreeBSD using
     ‘closefrom()’.  (Contributed by Ed Maste, Conrad Meyer, Kyle Evans,
     Kubilay Kocak and Victor Stinner in bpo-38061(3).)

   * *note PyLong_FromDouble(): b3c. is now up to 1.87x faster for
     values that fit into long.  (Contributed by Sergey Fedoseev in
     bpo-37986(4).)

   * A number of Python builtins (*note range: b3d, *note tuple: 614,
     *note set: 184, *note frozenset: 7f2, *note list: 24d, *note dict:
     183.) are now sped up by using PEP 590(5) vectorcall protocol.
     (Contributed by Donghee Na, Mark Shannon, Jeroen Demeyer and Petr
     Viktorin in bpo-37207(6).)

   * Optimized ‘set.difference_update()’ for the case when the other set
     is much larger than the base set.  (Suggested by Evgeny Kapun with
     code contributed by Michele Orrù in bpo-8425(7).)

   * Python's small object allocator (‘obmalloc.c’) now allows (no more
     than) one empty arena to remain available for immediate reuse,
     without returning it to the OS. This prevents thrashing in simple
     loops where an arena could be created and destroyed anew on each
     iteration.  (Contributed by Tim Peters in bpo-37257(8).)

   * *note floor division: b3e. of float operation now has a better
     performance.  Also the message of *note ZeroDivisionError: b3f. for
     this operation is updated.  (Contributed by Donghee Na in
     bpo-39434(9).)

   * Decoding short ASCII strings with UTF-8 and ascii codecs is now
     about 15% faster.  (Contributed by Inada Naoki in bpo-37348(10).)

Here's a summary of performance improvements from Python 3.4 through
Python 3.9:

     Python version                       3.4     3.5     3.6     3.7     3.8    3.9
     --------------                       ---     ---     ---     ---     ---    ---

     Variable and attribute read access:
         read_local                       7.1     7.1     5.4     5.1     3.9    3.9
         read_nonlocal                    7.1     8.1     5.8     5.4     4.4    4.5
         read_global                     15.5    19.0    14.3    13.6     7.6    7.8
         read_builtin                    21.1    21.6    18.5    19.0     7.5    7.8
         read_classvar_from_class        25.6    26.5    20.7    19.5    18.4   17.9
         read_classvar_from_instance     22.8    23.5    18.8    17.1    16.4   16.9
         read_instancevar                32.4    33.1    28.0    26.3    25.4   25.3
         read_instancevar_slots          27.8    31.3    20.8    20.8    20.2   20.5
         read_namedtuple                 73.8    57.5    45.0    46.8    18.4   18.7
         read_boundmethod                37.6    37.9    29.6    26.9    27.7   41.1

     Variable and attribute write access:
         write_local                      8.7     9.3     5.5     5.3     4.3    4.3
         write_nonlocal                  10.5    11.1     5.6     5.5     4.7    4.8
         write_global                    19.7    21.2    18.0    18.0    15.8   16.7
         write_classvar                  92.9    96.0   104.6   102.1    39.2   39.8
         write_instancevar               44.6    45.8    40.0    38.9    35.5   37.4
         write_instancevar_slots         35.6    36.1    27.3    26.6    25.7   25.8

     Data structure read access:
         read_list                       24.2    24.5    20.8    20.8    19.0   19.5
         read_deque                      24.7    25.5    20.2    20.6    19.8   20.2
         read_dict                       24.3    25.7    22.3    23.0    21.0   22.4
         read_strdict                    22.6    24.3    19.5    21.2    18.9   21.5

     Data structure write access:
         write_list                      27.1    28.5    22.5    21.6    20.0   20.0
         write_deque                     28.7    30.1    22.7    21.8    23.5   21.7
         write_dict                      31.4    33.3    29.3    29.2    24.7   25.4
         write_strdict                   28.4    29.9    27.5    25.2    23.1   24.5

     Stack (or queue) operations:
         list_append_pop                 93.4   112.7    75.4    74.2    50.8   50.6
         deque_append_pop                43.5    57.0    49.4    49.2    42.5   44.2
         deque_append_popleft            43.7    57.3    49.7    49.7    42.8   46.4

     Timing loop:
         loop_overhead                    0.5     0.6     0.4     0.3     0.3    0.3

These results were generated from the variable access benchmark script
at: ‘Tools/scripts/var_access_benchmark.py’.  The benchmark script
displays timings in nanoseconds.  The benchmarks were measured on an
Intel® Core™ i7-4960HQ processor(11) running the macOS 64-bit builds
found at python.org(12).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32856

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40010

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38061

   (4) https://bugs.python.org/issue?@action=redirect&bpo=37986

   (5) https://peps.python.org/pep-0590/

   (6) https://bugs.python.org/issue?@action=redirect&bpo=37207

   (7) https://bugs.python.org/issue?@action=redirect&bpo=8425

   (8) https://bugs.python.org/issue?@action=redirect&bpo=37257

   (9) https://bugs.python.org/issue?@action=redirect&bpo=39434

   (10) https://bugs.python.org/issue?@action=redirect&bpo=37348

   (11) 
https://ark.intel.com/content/www/us/en/ark/products/76088/intel-core-i7-4960hq-processor-6m-cache-up-to-3-80-ghz.html

   (12) https://www.python.org/downloads/macos/


File: python.info,  Node: 非推奨<8>,  Next: 削除<8>,  Prev: 最適化<6>,  Up: What's New In Python 3 9

1.6.8 非推奨
------------

   * distutilsの ‘bdist_msi’ コマンドは、現在非推奨です。代わりに、
     ‘bdist_wheel’ (wheelパッケージ)を使って下さい。 ( bpo-39586(1) での
     Hugo van Kemenadeによる貢献による)

   * Currently *note math.factorial(): b41. accepts *note float: 196.
     instances with non-negative integer values (like ‘5.0’).  It raises
     a *note ValueError: 2ec. for non-integral and negative floats.  It
     is now deprecated.  In future Python versions it will raise a *note
     TypeError: 198. for all floats.  (Contributed by Serhiy Storchaka
     in bpo-37315(2).)

   * The ‘parser’ and ‘symbol’ modules are deprecated and will be
     removed in future versions of Python.  For the majority of use
     cases, users can leverage the Abstract Syntax Tree (AST) generation
     and compilation stage, using the *note ast: 9. module.

   * The Public C API functions ‘PyParser_SimpleParseStringFlags()’,
     ‘PyParser_SimpleParseStringFlagsFilename()’,
     ‘PyParser_SimpleParseFileFlags()’ and ‘PyNode_Compile()’ are
     deprecated and will be removed in Python 3.10 together with the old
     parser.

   * Using *note NotImplemented: 1a2. in a boolean context has been
     deprecated, as it is almost exclusively the result of incorrect
     rich comparator implementations.  It will be made a *note
     TypeError: 198. in a future version of Python.  (Contributed by
     Josh Rosenberg in bpo-35712(3).)

   * The *note random: bd. module currently accepts any hashable type as
     a possible seed value.  Unfortunately, some of those types are not
     guaranteed to have a deterministic hash value.  After Python 3.9,
     the module will restrict its seeds to *note None: 885, *note int:
     19b, *note float: 196, *note str: 169, *note bytes: 192, and *note
     bytearray: 344.

   * Opening the *note GzipFile: 65c. file for writing without
     specifying the 'mode' argument is deprecated.  In future Python
     versions it will always be opened for reading by default.  Specify
     the 'mode' argument for opening it for writing and silencing a
     warning.  (Contributed by Serhiy Storchaka in bpo-28286(4).)

   * Deprecated the ‘split()’ method of ‘_tkinter.TkappType’ in favour
     of the ‘splitlist()’ method which has more consistent and
     predictable behavior.  (Contributed by Serhiy Storchaka in
     bpo-38371(5).)

   * The explicit passing of coroutine objects to *note asyncio.wait():
     6a7. has been deprecated and will be removed in version 3.11.
     (Contributed by Yury Selivanov and Kyle Stanley in bpo-34790(6).)

   * binhex4 and hexbin4 standards are now deprecated.  The ‘binhex’
     module and the following *note binascii: 11. functions are now
     deprecated:

        * ‘b2a_hqx()’, ‘a2b_hqx()’

        * ‘rlecode_hqx()’, ‘rledecode_hqx()’

     (Contributed by Victor Stinner in bpo-39353(7).)

   * *note ast: 9. classes ‘slice’, ‘Index’ and ‘ExtSlice’ are
     considered deprecated and will be removed in future Python
     versions.  ‘value’ itself should be used instead of ‘Index(value)’.
     ‘Tuple(slices, Load())’ should be used instead of
     ‘ExtSlice(slices)’.  (Contributed by Serhiy Storchaka in
     bpo-34822(8).)

   * *note ast: 9. classes ‘Suite’, ‘Param’, ‘AugLoad’ and ‘AugStore’
     are considered deprecated and will be removed in future Python
     versions.  They were not generated by the parser and not accepted
     by the code generator in Python 3.  (Contributed by Batuhan Taskaya
     in bpo-39639(9) and bpo-39969(10) and Serhiy Storchaka in
     bpo-39988(11).)

   * The ‘PyEval_InitThreads()’ and ‘PyEval_ThreadsInitialized()’
     functions are now deprecated and will be removed in Python 3.11.
     Calling ‘PyEval_InitThreads()’ now does nothing.  The *note GIL:
     164. is initialized by *note Py_Initialize(): 460. since Python
     3.7.  (Contributed by Victor Stinner in bpo-39877(12).)

   * Passing ‘None’ as the first argument to the *note shlex.split():
     75e. function has been deprecated.  (Contributed by Zackery Spytz
     in bpo-33262(13).)

   * ‘smtpd.MailmanProxy()’ is now deprecated as it is unusable without
     an external module, ‘mailman’.  (Contributed by Samuel Colvin in
     bpo-35800(14).)

   * The ‘lib2to3’ module now emits a *note PendingDeprecationWarning:
     ac5.  Python 3.9 switched to a PEG parser (see PEP 617(15)), and
     Python 3.10 may include new language syntax that is not parsable by
     lib2to3's LL(1) parser.  The ‘lib2to3’ module may be removed from
     the standard library in a future Python version.  Consider
     third-party alternatives such as LibCST(16) or parso(17).
     (Contributed by Carl Meyer in bpo-40360(18).)

   * *note random.shuffle(): 94e. の*random* パラメータは非推奨になりま
     した。(Raymond Hettingerの貢献による bpo-40465(19))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39586

   (2) https://bugs.python.org/issue?@action=redirect&bpo=37315

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35712

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28286

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38371

   (6) https://bugs.python.org/issue?@action=redirect&bpo=34790

   (7) https://bugs.python.org/issue?@action=redirect&bpo=39353

   (8) https://bugs.python.org/issue?@action=redirect&bpo=34822

   (9) https://bugs.python.org/issue?@action=redirect&bpo=39639

   (10) https://bugs.python.org/issue?@action=redirect&bpo=39969

   (11) https://bugs.python.org/issue?@action=redirect&bpo=39988

   (12) https://bugs.python.org/issue?@action=redirect&bpo=39877

   (13) https://bugs.python.org/issue?@action=redirect&bpo=33262

   (14) https://bugs.python.org/issue?@action=redirect&bpo=35800

   (15) https://peps.python.org/pep-0617/

   (16) https://libcst.readthedocs.io/

   (17) https://parso.readthedocs.io/

   (18) https://bugs.python.org/issue?@action=redirect&bpo=40360

   (19) https://bugs.python.org/issue?@action=redirect&bpo=40465


File: python.info,  Node: 削除<8>,  Next: Python 3 9への移植,  Prev: 非推奨<8>,  Up: What's New In Python 3 9

1.6.9 削除
----------

   * The erroneous version at ‘unittest.mock.__version__’ has been
     removed.

   * ‘nntplib.NNTP’: ‘xpath()’ and ‘xgtitle()’ methods have been
     removed.  These methods are deprecated since Python 3.3.
     Generally, these extensions are not supported or not enabled by
     NNTP server administrators.  For ‘xgtitle()’, please use
     ‘nntplib.NNTP.descriptions()’ or ‘nntplib.NNTP.description()’
     instead.  (Contributed by Donghee Na in bpo-39366(1).)

   * *note array.array: 4be.: ‘tostring()’ and ‘fromstring()’ methods
     have been removed.  They were aliases to ‘tobytes()’ and
     ‘frombytes()’, deprecated since Python 3.2.  (Contributed by Victor
     Stinner in bpo-38916(2).)

   * The undocumented ‘sys.callstats()’ function has been removed.
     Since Python 3.7, it was deprecated and always returned *note None:
     885.  It required a special build option ‘CALL_PROFILE’ which was
     already removed in Python 3.7.  (Contributed by Victor Stinner in
     bpo-37414(3).)

   * The ‘sys.getcheckinterval()’ and ‘sys.setcheckinterval()’ functions
     have been removed.  They were deprecated since Python 3.2.  Use
     *note sys.getswitchinterval(): b43. and *note
     sys.setswitchinterval(): b44. instead.  (Contributed by Victor
     Stinner in bpo-37392(4).)

   * The C function ‘PyImport_Cleanup()’ has been removed.  It was
     documented as: "Empty the module table.  For internal use only."
     (Contributed by Victor Stinner in bpo-36710(5).)

   * ‘_dummy_thread’ and ‘dummy_threading’ modules have been removed.
     These modules were deprecated since Python 3.7 which requires
     threading support.  (Contributed by Victor Stinner in
     bpo-37312(6).)

   * ‘aifc.openfp()’ alias to ‘aifc.open()’, ‘sunau.openfp()’ alias to
     ‘sunau.open()’, and ‘wave.openfp()’ alias to *note wave.open():
     b45. have been removed.  They were deprecated since Python 3.7.
     (Contributed by Victor Stinner in bpo-37320(7).)

   * The ‘isAlive()’ method of *note threading.Thread: 176. has been
     removed.  It was deprecated since Python 3.8.  Use *note
     is_alive(): b46. instead.  (Contributed by Donghee Na in
     bpo-37804(8).)

   * Methods ‘getchildren()’ and ‘getiterator()’ of classes *note
     ElementTree: b47. and *note Element: 363. in the *note ElementTree:
     12b. module have been removed.  They were deprecated in Python 3.2.
     Use ‘iter(x)’ or ‘list(x)’ instead of ‘x.getchildren()’ and
     ‘x.iter()’ or ‘list(x.iter())’ instead of ‘x.getiterator()’.
     (Contributed by Serhiy Storchaka in bpo-36543(9).)

   * The old *note plistlib: b0. API has been removed, it was deprecated
     since Python 3.4.  Use the *note load(): b48, *note loads(): b49,
     *note dump(): b4a, and *note dumps(): b4b. functions.
     Additionally, the 'use_builtin_types' parameter was removed,
     standard *note bytes: 192. objects are always used instead.
     (Contributed by Jon Janzen in bpo-36409(10).)

   * The C function ‘PyGen_NeedsFinalizing’ has been removed.  It was
     not documented, tested, or used anywhere within CPython after the
     implementation of PEP 442(11).  Patch by Joannah Nanjekye.
     (Contributed by Joannah Nanjekye in bpo-15088(12))

   * ‘base64.encodestring()’ and ‘base64.decodestring()’, aliases
     deprecated since Python 3.1, have been removed: use *note
     base64.encodebytes(): b4c. and *note base64.decodebytes(): b4d.
     instead.  (Contributed by Victor Stinner in bpo-39351(13).)

   * ‘fractions.gcd()’ function has been removed, it was deprecated
     since Python 3.5 (bpo-22486(14)): use *note math.gcd(): b0c.
     instead.  (Contributed by Victor Stinner in bpo-39350(15).)

   * The 'buffering' parameter of *note bz2.BZ2File: a66. has been
     removed.  Since Python 3.0, it was ignored and using it emitted a
     *note DeprecationWarning: 1a3.  Pass an open file object to control
     how the file is opened.  (Contributed by Victor Stinner in
     bpo-39357(16).)

   * The 'encoding' parameter of *note json.loads(): b4e. has been
     removed.  As of Python 3.1, it was deprecated and ignored; using it
     has emitted a *note DeprecationWarning: 1a3. since Python 3.8.
     (Contributed by Inada Naoki in bpo-39377(17))

   * ‘with (await asyncio.lock):’ and ‘with (yield from asyncio.lock):’
     statements are not longer supported, use ‘async with lock’ instead.
     The same is correct for ‘asyncio.Condition’ and
     ‘asyncio.Semaphore’.  (Contributed by Andrew Svetlov in
     bpo-34793(18).)

   * The ‘sys.getcounts()’ function, the ‘-X showalloccount’ command
     line option and the ‘show_alloc_count’ field of the C structure
     *note PyConfig: 3f7. have been removed.  They required a special
     Python build by defining ‘COUNT_ALLOCS’ macro.  (Contributed by
     Victor Stinner in bpo-39489(19).)

   * The ‘_field_types’ attribute of the *note typing.NamedTuple: 331.
     class has been removed.  It was deprecated since Python 3.8.  Use
     the ‘__annotations__’ attribute instead.  (Contributed by Serhiy
     Storchaka in bpo-40182(20).)

   * The ‘symtable.SymbolTable.has_exec()’ method has been removed.  It
     was deprecated since 2006, and only returning ‘False’ when it's
     called.  (Contributed by Batuhan Taskaya in bpo-40208(21))

   * The ‘asyncio.Task.current_task()’ and ‘asyncio.Task.all_tasks()’
     have been removed.  They were deprecated since Python 3.7 and you
     can use *note asyncio.current_task(): 6a5. and *note
     asyncio.all_tasks(): b4f. instead.  (Contributed by Rémi Lapeyre in
     bpo-40967(22))

   * The ‘unescape()’ method in the *note html.parser.HTMLParser: a77.
     class has been removed (it was deprecated since Python 3.4).  *note
     html.unescape(): b50. should be used for converting character
     references to the corresponding unicode characters.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39366

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38916

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37414

   (4) https://bugs.python.org/issue?@action=redirect&bpo=37392

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36710

   (6) https://bugs.python.org/issue?@action=redirect&bpo=37312

   (7) https://bugs.python.org/issue?@action=redirect&bpo=37320

   (8) https://bugs.python.org/issue?@action=redirect&bpo=37804

   (9) https://bugs.python.org/issue?@action=redirect&bpo=36543

   (10) https://bugs.python.org/issue?@action=redirect&bpo=36409

   (11) https://peps.python.org/pep-0442/

   (12) https://bugs.python.org/issue?@action=redirect&bpo=15088

   (13) https://bugs.python.org/issue?@action=redirect&bpo=39351

   (14) https://bugs.python.org/issue?@action=redirect&bpo=22486

   (15) https://bugs.python.org/issue?@action=redirect&bpo=39350

   (16) https://bugs.python.org/issue?@action=redirect&bpo=39357

   (17) https://bugs.python.org/issue?@action=redirect&bpo=39377

   (18) https://bugs.python.org/issue?@action=redirect&bpo=34793

   (19) https://bugs.python.org/issue?@action=redirect&bpo=39489

   (20) https://bugs.python.org/issue?@action=redirect&bpo=40182

   (21) https://bugs.python.org/issue?@action=redirect&bpo=40208

   (22) https://bugs.python.org/issue?@action=redirect&bpo=40967


File: python.info,  Node: Python 3 9への移植,  Next: Build Changes<5>,  Prev: 削除<8>,  Up: What's New In Python 3 9

1.6.10 Python 3.9への移植
-------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

* Menu:

* Python API の変更: Python API の変更<5>.
* C API の変更: C API の変更<8>.
* CPython バイトコードの変更: CPython バイトコードの変更<5>.


File: python.info,  Node: Python API の変更<5>,  Next: C API の変更<8>,  Up: Python 3 9への移植

1.6.10.1 Python API の変更
..........................

   * *note __import__(): ad1. and *note importlib.util.resolve_name():
     b06. now raise *note ImportError: 65b. where it previously raised
     *note ValueError: 2ec.  Callers catching the specific exception
     type and supporting both Python 3.9 and earlier versions will need
     to catch both using ‘except (ImportError, ValueError):’.

   * The *note venv: 117. activation scripts no longer special-case when
     ‘__VENV_PROMPT__’ is set to ‘""’.

   * The *note select.epoll.unregister(): b53. method no longer ignores
     the *note EBADF: b54. error.  (Contributed by Victor Stinner in
     bpo-39239(1).)

   * The 'compresslevel' parameter of *note bz2.BZ2File: a66. became
     keyword-only, since the 'buffering' parameter has been removed.
     (Contributed by Victor Stinner in bpo-39357(2).)

   * Simplified AST for subscription.  Simple indices will be
     represented by their value, extended slices will be represented as
     tuples.  ‘Index(value)’ will return a ‘value’ itself,
     ‘ExtSlice(slices)’ will return ‘Tuple(slices, Load())’.
     (Contributed by Serhiy Storchaka in bpo-34822(3).)

   * The *note importlib: 7b. module now ignores the *note PYTHONCASEOK:
     b55. environment variable when the *note -E: b56. or *note -I: b57.
     command line options are being used.

   * The 'encoding' parameter has been added to the classes *note
     ftplib.FTP: af6. and *note ftplib.FTP_TLS: af7. as a keyword-only
     parameter, and the default encoding is changed from Latin-1 to
     UTF-8 to follow RFC 2640(4).

   * *note asyncio.loop.shutdown_default_executor(): ae4. has been added
     to *note AbstractEventLoop: b58, meaning alternative event loops
     that inherit from it should have this method defined.  (Contributed
     by Kyle Stanley in bpo-34037(5).)

   * The constant values of future flags in the *note __future__: 0.
     module is updated in order to prevent collision with compiler
     flags.  Previously ‘PyCF_ALLOW_TOP_LEVEL_AWAIT’ was clashing with
     ‘CO_FUTURE_DIVISION’.  (Contributed by Batuhan Taskaya in
     bpo-39562(6))

   * ‘array('u')’ now uses ‘wchar_t’ as C type instead of ‘Py_UNICODE’.
     This change doesn't affect to its behavior because ‘Py_UNICODE’ is
     alias of ‘wchar_t’ since Python 3.3.  (Contributed by Inada Naoki
     in bpo-34538(7).)

   * The *note logging.getLogger(): b59. API now returns the root logger
     when passed the name ‘'root'’, whereas previously it returned a
     non-root logger named ‘'root'’.  This could affect cases where user
     code explicitly wants a non-root logger named ‘'root'’, or
     instantiates a logger using ‘logging.getLogger(__name__)’ in some
     top-level module called ‘'root.py'’.  (Contributed by Vinay Sajip
     in bpo-37742(8).)

   * Division handling of *note PurePath: 6cd. now returns *note
     NotImplemented: 1a2. instead of raising a *note TypeError: 198.
     when passed something other than an instance of ‘str’ or *note
     PurePath: 6cd.  This allows creating compatible classes that don't
     inherit from those mentioned types.  (Contributed by Roger Aiudi in
     bpo-34775(9)).

   * Starting with Python 3.9.5 the *note ipaddress: 84. module no
     longer accepts any leading zeros in IPv4 address strings.  Leading
     zeros are ambiguous and interpreted as octal notation by some
     libraries.  For example the legacy function *note
     socket.inet_aton(): b5a. treats leading zeros as octal notatation.
     glibc implementation of modern *note inet_pton(): b5b. does not
     accept any leading zeros.  (Contributed by Christian Heimes in
     bpo-36384(10)).

   * *note codecs.lookup(): b5c. now normalizes the encoding name the
     same way as *note encodings.normalize_encoding(): 9fd, except that
     *note codecs.lookup(): b5c. also converts the name to lower case.
     For example, ‘"latex+latin1"’ encoding name is now normalized to
     ‘"latex_latin1"’.  (Contributed by Jordon Xu in bpo-37751(11).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39239

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39357

   (3) https://bugs.python.org/issue?@action=redirect&bpo=34822

   (4) https://datatracker.ietf.org/doc/html/rfc2640.html

   (5) https://bugs.python.org/issue?@action=redirect&bpo=34037

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39562

   (7) https://bugs.python.org/issue?@action=redirect&bpo=34538

   (8) https://bugs.python.org/issue?@action=redirect&bpo=37742

   (9) https://bugs.python.org/issue?@action=redirect&bpo=34775

   (10) https://bugs.python.org/issue?@action=redirect&bpo=36384

   (11) https://bugs.python.org/issue?@action=redirect&bpo=37751


File: python.info,  Node: C API の変更<8>,  Next: CPython バイトコードの変更<5>,  Prev: Python API の変更<5>,  Up: Python 3 9への移植

1.6.10.2 C API の変更
.....................

   * Instances of *note heap-allocated types: b5e. (such as those
     created with *note PyType_FromSpec(): 79d. and similar APIs) hold a
     reference to their type object since Python 3.8.  As indicated in
     the "Changes in the C API" of Python 3.8, for the vast majority of
     cases, there should be no side effect but for types that have a
     custom *note tp_traverse: 982. function, ensure that all custom
     ‘tp_traverse’ functions of heap-allocated types visit the object's
     type.

          例:

               int
               foo_traverse(PyObject *self, visitproc visit, void *arg)
               {
               // Rest of the traverse function
               #if PY_VERSION_HEX >= 0x03090000
                   // This was not needed before Python 3.9 (Python issue 35810 and 40217)
                   Py_VISIT(Py_TYPE(self));
               #endif
               }

     If your traverse function delegates to ‘tp_traverse’ of its base
     class (or another type), ensure that ‘Py_TYPE(self)’ is visited
     only once.  Note that only *note heap type: b5e. are expected to
     visit the type in ‘tp_traverse’.

          For example, if your ‘tp_traverse’ function includes:

               base->tp_traverse(self, visit, arg)

          then add:

               #if PY_VERSION_HEX >= 0x03090000
                   // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)
                   if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
                       // a heap type's tp_traverse already visited Py_TYPE(self)
                   } else {
                       Py_VISIT(Py_TYPE(self));
                   }
               #else

     (See bpo-35810(1) and bpo-40217(2) for more information.)

   * The functions ‘PyEval_CallObject’, ‘PyEval_CallFunction’,
     ‘PyEval_CallMethod’ and ‘PyEval_CallObjectWithKeywords’ are
     deprecated.  Use *note PyObject_Call(): 63d. and its variants
     instead.  (See more details in bpo-29548(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35810

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40217

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29548


File: python.info,  Node: CPython バイトコードの変更<5>,  Prev: C API の変更<8>,  Up: Python 3 9への移植

1.6.10.3 CPython バイトコードの変更
...................................

   * The ‘LOAD_ASSERTION_ERROR’ opcode was added for handling the *note
     assert: b60. statement.  Previously, the assert statement would not
     work correctly if the *note AssertionError: 8b8. exception was
     being shadowed.  (Contributed by Zackery Spytz in bpo-34880(1).)

   * The *note COMPARE_OP: b61. opcode was split into four distinct
     instructions:

        * ‘COMPARE_OP’ for rich comparisons

        * ‘IS_OP’ for 'is' and 'is not' tests

        * ‘CONTAINS_OP’ for 'in' and 'not in' tests

        * ‘JUMP_IF_NOT_EXC_MATCH’ for checking exceptions in
          'try-except' statements.

     (Contributed by Mark Shannon in bpo-39156(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34880

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39156


File: python.info,  Node: Build Changes<5>,  Next: C API の変更<9>,  Prev: Python 3 9への移植,  Up: What's New In Python 3 9

1.6.11 Build Changes
--------------------

   * Added ‘--with-platlibdir’ option to the ‘configure’ script: name of
     the platform-specific library directory, stored in the new *note
     sys.platlibdir: b32. attribute.  See *note sys.platlibdir: b32.
     attribute for more information.  (Contributed by Jan Matějek, Matěj
     Cepl, Charalampos Stratakis and Victor Stinner in bpo-1294959(1).)

   * The ‘COUNT_ALLOCS’ special build macro has been removed.
     (Contributed by Victor Stinner in bpo-39489(2).)

   * On non-Windows platforms, the ‘setenv()’ and ‘unsetenv()’ functions
     are now required to build Python.  (Contributed by Victor Stinner
     in bpo-39395(3).)

   * On non-Windows platforms, creating ‘bdist_wininst’ installers is
     now officially unsupported.  (See bpo-10945(4) for more details.)

   * When building Python on macOS from source, ‘_tkinter’ now links
     with non-system Tcl and Tk frameworks if they are installed in
     ‘/Library/Frameworks’, as had been the case on older releases of
     macOS. If a macOS SDK is explicitly configured, by using *note
     -enable-universalsdk: b63. or ‘-isysroot’, only the SDK itself is
     searched.  The default behavior can still be overridden with
     ‘--with-tcltk-includes’ and ‘--with-tcltk-libs’.  (Contributed by
     Ned Deily in bpo-34956(5).)

   * Python can now be built for Windows 10 ARM64.  (Contributed by
     Steve Dower in bpo-33125(6).)

   * Some individual tests are now skipped when ‘--pgo’ is used.  The
     tests in question increased the PGO task time significantly and
     likely didn't help improve optimization of the final executable.
     This speeds up the task by a factor of about 15x.  Running the full
     unit test suite is slow.  This change may result in a slightly less
     optimized build since not as many code branches will be executed.
     If you are willing to wait for the much slower build, the old
     behavior can be restored using ‘./configure [..] PROFILE_TASK="-m
     test --pgo-extended"’.  We make no guarantees as to which PGO task
     set produces a faster build.  Users who care should run their own
     relevant benchmarks as results can depend on the environment,
     workload, and compiler tool chain.  (See bpo-36044(7) and
     bpo-37707(8) for more details.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1294959

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39489

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39395

   (4) https://bugs.python.org/issue?@action=redirect&bpo=10945

   (5) https://bugs.python.org/issue?@action=redirect&bpo=34956

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33125

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36044

   (8) https://bugs.python.org/issue?@action=redirect&bpo=37707


File: python.info,  Node: C API の変更<9>,  Next: Python 3 9 1 での重要な変更点,  Prev: Build Changes<5>,  Up: What's New In Python 3 9

1.6.12 C API の変更
-------------------

* Menu:

* 新しい機能: 新しい機能<11>.
* Python 3.9への移植: Python 3 9への移植<2>.
* 削除: 削除<9>.


File: python.info,  Node: 新しい機能<11>,  Next: Python 3 9への移植<2>,  Up: C API の変更<9>

1.6.12.1 新しい機能
...................

   * PEP 573(1): Added *note PyType_FromModuleAndSpec(): 773. to
     associate a module with a class; *note PyType_GetModule(): b66. and
     *note PyType_GetModuleState(): b67. to retrieve the module and its
     state; and *note PyCMethod: 968. and *note METH_METHOD: b68. to
     allow a method to access the class it was defined in.  (Contributed
     by Marcel Plch and Petr Viktorin in bpo-38787(2).)

   * Added *note PyFrame_GetCode(): 98d. function: get a frame code.
     Added *note PyFrame_GetBack(): 989. function: get the frame next
     outer frame.  (Contributed by Victor Stinner in bpo-40421(3).)

   * Added *note PyFrame_GetLineNumber(): 98e. to the limited C API.
     (Contributed by Victor Stinner in bpo-40421(4).)

   * Added *note PyThreadState_GetInterpreter(): b69. and *note
     PyInterpreterState_Get(): 64c. functions to get the interpreter.
     Added *note PyThreadState_GetFrame(): 991. function to get the
     current frame of a Python thread state.  Added *note
     PyThreadState_GetID(): b6a. function: get the unique identifier of
     a Python thread state.  (Contributed by Victor Stinner in
     bpo-39947(5).)

   * Added a new public *note PyObject_CallNoArgs(): 63c. function to
     the C API, which calls a callable Python object without any
     arguments.  It is the most efficient way to call a callable Python
     object without any argument.  (Contributed by Victor Stinner in
     bpo-37194(6).)

   * Changes in the limited C API (if ‘Py_LIMITED_API’ macro is
     defined):

        * Provide *note Py_EnterRecursiveCall(): 3d2. and *note
          Py_LeaveRecursiveCall(): b6b. as regular functions for the
          limited API. Previously, there were defined as macros, but
          these macros didn't compile with the limited C API which
          cannot access ‘PyThreadState.recursion_depth’ field (the
          structure is opaque in the limited C API).

        * ‘PyObject_INIT()’ and ‘PyObject_INIT_VAR()’ become regular
          "opaque" function to hide implementation details.

     (Contributed by Victor Stinner in bpo-38644(7) and bpo-39542(8).)

   * The *note PyModule_AddType(): b6c. function is added to help adding
     a type to a module.  (Contributed by Donghee Na in bpo-40024(9).)

   * Added the functions *note PyObject_GC_IsTracked(): b6d. and *note
     PyObject_GC_IsFinalized(): b6e. to the public API to allow to query
     if Python objects are being currently tracked or have been already
     finalized by the garbage collector respectively.  (Contributed by
     Pablo Galindo Salgado in bpo-40241(10).)

   * Added ‘_PyObject_FunctionStr()’ to get a user-friendly string
     representation of a function-like object.  (Patch by Jeroen Demeyer
     in bpo-37645(11).)

   * Added *note PyObject_CallOneArg(): b6f. for calling an object with
     one positional argument (Patch by Jeroen Demeyer in bpo-37483(12).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0573/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38787

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40421

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40421

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39947

   (6) https://bugs.python.org/issue?@action=redirect&bpo=37194

   (7) https://bugs.python.org/issue?@action=redirect&bpo=38644

   (8) https://bugs.python.org/issue?@action=redirect&bpo=39542

   (9) https://bugs.python.org/issue?@action=redirect&bpo=40024

   (10) https://bugs.python.org/issue?@action=redirect&bpo=40241

   (11) https://bugs.python.org/issue?@action=redirect&bpo=37645

   (12) https://bugs.python.org/issue?@action=redirect&bpo=37483


File: python.info,  Node: Python 3 9への移植<2>,  Next: 削除<9>,  Prev: 新しい機能<11>,  Up: C API の変更<9>

1.6.12.2 Python 3.9への移植
...........................

   * ‘PyInterpreterState.eval_frame’ ( PEP 523(1)) now requires a new
     mandatory 'tstate' parameter (‘PyThreadState*’).  (Contributed by
     Victor Stinner in bpo-38500(2).)

   * Extension modules: *note m_traverse: b71, *note m_clear: b72. and
     *note m_free: b73. functions of *note PyModuleDef: b74. are no
     longer called if the module state was requested but is not
     allocated yet.  This is the case immediately after the module is
     created and before the module is executed (*note Py_mod_exec: b75.
     function).  More precisely, these functions are not called if *note
     m_size: b76. is greater than 0 and the module state (as returned by
     *note PyModule_GetState(): b77.) is ‘NULL’.

     Extension modules without module state (‘m_size <= 0’) are not
     affected.

   * If *note Py_AddPendingCall(): b78. is called in a subinterpreter,
     the function is now scheduled to be called from the subinterpreter,
     rather than being called from the main interpreter.  Each
     subinterpreter now has its own list of scheduled calls.
     (Contributed by Victor Stinner in bpo-39984(3).)

   * The Windows registry is no longer used to initialize *note
     sys.path: 3e4. when the ‘-E’ option is used (if *note
     PyConfig.use_environment: 40b. is set to ‘0’).  This is significant
     when embedding Python on Windows.  (Contributed by Zackery Spytz in
     bpo-8901(4).)

   * The global variable *note PyStructSequence_UnnamedField: b79. is
     now a constant and refers to a constant string.  (Contributed by
     Serhiy Storchaka in bpo-38650(5).)

   * The ‘PyGC_Head’ structure is now opaque.  It is only defined in the
     internal C API (‘pycore_gc.h’).  (Contributed by Victor Stinner in
     bpo-40241(6).)

   * The ‘Py_UNICODE_COPY’, ‘Py_UNICODE_FILL’, ‘PyUnicode_WSTR_LENGTH’,
     ‘PyUnicode_FromUnicode()’, ‘PyUnicode_AsUnicode()’,
     ‘_PyUnicode_AsUnicode’, and ‘PyUnicode_AsUnicodeAndSize()’ are
     marked as deprecated in C. They have been deprecated by PEP 393(7)
     since Python 3.3.  (Contributed by Inada Naoki in bpo-36346(8).)

   * The *note Py_FatalError(): b7a. function is replaced with a macro
     which logs automatically the name of the current function, unless
     the ‘Py_LIMITED_API’ macro is defined.  (Contributed by Victor
     Stinner in bpo-39882(9).)

   * The vectorcall protocol now requires that the caller passes only
     strings as keyword names.  (See bpo-37540(10) for more
     information.)

   * Implementation details of a number of macros and functions are now
     hidden:

        * *note PyObject_IS_GC(): b7b. macro was converted to a
          function.

        * The ‘PyObject_NEW()’ macro becomes an alias to the *note
          PyObject_New: b7c. macro, and the ‘PyObject_NEW_VAR()’ macro
          becomes an alias to the *note PyObject_NewVar: b7d. macro.
          They no longer access directly the *note
          PyTypeObject.tp_basicsize: b7e. member.

        * ‘PyObject_GET_WEAKREFS_LISTPTR()’ macro was converted to a
          function: the macro accessed directly the *note
          PyTypeObject.tp_weaklistoffset: b7f. member.

        * *note PyObject_CheckBuffer(): 639. macro was converted to a
          function: the macro accessed directly the *note
          PyTypeObject.tp_as_buffer: b80. member.

        * *note PyIndex_Check(): b81. is now always declared as an
          opaque function to hide implementation details: removed the
          ‘PyIndex_Check()’ macro.  The macro accessed directly the
          *note PyTypeObject.tp_as_number: b82. member.

     (See bpo-40170(11) for more details.)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0523/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38500

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39984

   (4) https://bugs.python.org/issue?@action=redirect&bpo=8901

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38650

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40241

   (7) https://peps.python.org/pep-0393/

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36346

   (9) https://bugs.python.org/issue?@action=redirect&bpo=39882

   (10) https://bugs.python.org/issue?@action=redirect&bpo=37540

   (11) https://bugs.python.org/issue?@action=redirect&bpo=40170


File: python.info,  Node: 削除<9>,  Prev: Python 3 9への移植<2>,  Up: C API の変更<9>

1.6.12.3 削除
.............

   * Excluded ‘PyFPE_START_PROTECT()’ and ‘PyFPE_END_PROTECT()’ macros
     of ‘pyfpe.h’ from the limited C API. (Contributed by Victor Stinner
     in bpo-38835(1).)

   * The ‘tp_print’ slot of *note PyTypeObject: b84. has been removed.
     It was used for printing objects to files in Python 2.7 and before.
     Since Python 3.0, it has been ignored and unused.  (Contributed by
     Jeroen Demeyer in bpo-36974(2).)

   * Changes in the limited C API (if ‘Py_LIMITED_API’ macro is
     defined):

        * Excluded the following functions from the limited C API:

             * ‘PyThreadState_DeleteCurrent()’ (Contributed by Joannah
               Nanjekye in bpo-37878(3).)

             * ‘_Py_CheckRecursionLimit’

             * ‘_Py_NewReference()’

             * ‘_Py_ForgetReference()’

             * ‘_PyTraceMalloc_NewReference()’

             * ‘_Py_GetRefTotal()’

             * The trashcan mechanism which never worked in the limited
               C API.

             * ‘PyTrash_UNWIND_LEVEL’

             * ‘Py_TRASHCAN_BEGIN_CONDITION’

             * ‘Py_TRASHCAN_BEGIN’

             * ‘Py_TRASHCAN_END’

             * ‘Py_TRASHCAN_SAFE_BEGIN’

             * ‘Py_TRASHCAN_SAFE_END’

        * Moved following functions and definitions to the internal C
          API:

             * ‘_PyDebug_PrintTotalRefs()’

             * ‘_Py_PrintReferences()’

             * ‘_Py_PrintReferenceAddresses()’

             * ‘_Py_tracemalloc_config’

             * ‘_Py_AddToAllObjects()’ (specific to ‘Py_TRACE_REFS’
               build)

     (Contributed by Victor Stinner in bpo-38644(4) and bpo-39542(5).)

   * Removed ‘_PyRuntime.getframe’ hook and removed
     ‘_PyThreadState_GetFrame’ macro which was an alias to
     ‘_PyRuntime.getframe’.  They were only exposed by the internal C
     API. Removed also ‘PyThreadFrameGetter’ type.  (Contributed by
     Victor Stinner in bpo-39946(6).)

   * Removed the following functions from the C API. Call *note
     PyGC_Collect(): b85. explicitly to clear all free lists.
     (Contributed by Inada Naoki and Victor Stinner in bpo-37340(7),
     bpo-38896(8) and bpo-40428(9).)

        * ‘PyAsyncGen_ClearFreeLists()’

        * ‘PyContext_ClearFreeList()’

        * ‘PyDict_ClearFreeList()’

        * ‘PyFloat_ClearFreeList()’

        * ‘PyFrame_ClearFreeList()’

        * ‘PyList_ClearFreeList()’

        * ‘PyMethod_ClearFreeList()’ and ‘PyCFunction_ClearFreeList()’:
          the free lists of bound method objects have been removed.

        * ‘PySet_ClearFreeList()’: the set free list has been removed in
          Python 3.4.

        * ‘PyTuple_ClearFreeList()’

        * ‘PyUnicode_ClearFreeList()’: the Unicode free list has been
          removed in Python 3.3.

   * Removed ‘_PyUnicode_ClearStaticStrings()’ function.  (Contributed
     by Victor Stinner in bpo-39465(10).)

   * Removed ‘Py_UNICODE_MATCH’.  It has been deprecated by PEP 393(11),
     and broken since Python 3.3.  The *note PyUnicode_Tailmatch(): ab5.
     function can be used instead.  (Contributed by Inada Naoki in
     bpo-36346(12).)

   * Cleaned header files of interfaces defined but with no
     implementation.  The public API symbols being removed are:
     ‘_PyBytes_InsertThousandsGroupingLocale’,
     ‘_PyBytes_InsertThousandsGrouping’, ‘_Py_InitializeFromArgs’,
     ‘_Py_InitializeFromWideArgs’, ‘_PyFloat_Repr’, ‘_PyFloat_Digits’,
     ‘_PyFloat_DigitsInit’, ‘PyFrame_ExtendStack’,
     ‘_PyAIterWrapper_Type’, ‘PyNullImporter_Type’, ‘PyCmpWrapper_Type’,
     ‘PySortWrapper_Type’, ‘PyNoArgsFunction’.  (Contributed by Pablo
     Galindo Salgado in bpo-39372(13).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38835

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36974

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37878

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38644

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39542

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39946

   (7) https://bugs.python.org/issue?@action=redirect&bpo=37340

   (8) https://bugs.python.org/issue?@action=redirect&bpo=38896

   (9) https://bugs.python.org/issue?@action=redirect&bpo=40428

   (10) https://bugs.python.org/issue?@action=redirect&bpo=39465

   (11) https://peps.python.org/pep-0393/

   (12) https://bugs.python.org/issue?@action=redirect&bpo=36346

   (13) https://bugs.python.org/issue?@action=redirect&bpo=39372


File: python.info,  Node: Python 3 9 1 での重要な変更点,  Next: Python 3 9 2 での重要な変更点,  Prev: C API の変更<9>,  Up: What's New In Python 3 9

1.6.13 Python 3.9.1 での重要な変更点
------------------------------------

* Menu:

* typing: typing<8>.
* macOS 11.0 (Big Sur) と Appleシリコンの Mac のサポート: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート.


File: python.info,  Node: typing<8>,  Next: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート,  Up: Python 3 9 1 での重要な変更点

1.6.13.1 typing
...............

The behavior of *note typing.Literal: a55. was changed to conform with
PEP 586(1) and to match the behavior of static type checkers specified
in the PEP.

  1. ‘Literal’ now de-duplicates parameters.

  2. Equality comparisons between ‘Literal’ objects are now order
     independent.

  3. ‘Literal’ comparisons now respect types.  For example, ‘Literal[0]
     == Literal[False]’ previously evaluated to ‘True’.  It is now
     ‘False’.  To support this change, the internally used type cache
     now supports differentiating types.

  4. ‘Literal’ objects will now raise a *note TypeError: 198. exception
     during equality comparisons if any of their parameters are not
     *note hashable: 824.  Note that declaring ‘Literal’ with mutable
     parameters will not throw an error:

          >>> from typing import Literal
          >>> Literal[{0}]
          >>> Literal[{0}] == Literal[{False}]
          Traceback (most recent call last):
            File "<stdin>", line 1, in <module>
          TypeError: unhashable type: 'set'

(bpo-42345(2) でのYurii Karabasの貢献による)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0586/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42345


File: python.info,  Node: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート,  Prev: typing<8>,  Up: Python 3 9 1 での重要な変更点

1.6.13.2 macOS 11.0 (Big Sur) と Appleシリコンの Mac のサポート
...............................................................

As of 3.9.1, Python now fully supports building and running on macOS
11.0 (Big Sur) and on Apple Silicon Macs (based on the ‘ARM64’
architecture).  A new universal build variant, ‘universal2’, is now
available to natively support both ‘ARM64’ and ‘Intel 64’ in one set of
executables.  Binaries can also now be built on current versions of
macOS to be deployed on a range of older macOS versions (tested to 10.9)
while making some newer OS functions and options conditionally available
based on the operating system version in use at runtime ("weaklinking").

(bpo-41100(1) でのRonald OussorenとLawrence D'Annaの貢献による)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41100


File: python.info,  Node: Python 3 9 2 での重要な変更点,  Next: Python 3 9 3 での重要な変更点,  Prev: Python 3 9 1 での重要な変更点,  Up: What's New In Python 3 9

1.6.14 Python 3.9.2 での重要な変更点
------------------------------------

* Menu:

* collections.abc: collections abc<2>.
* urllib.parse: urllib parse<2>.


File: python.info,  Node: collections abc<2>,  Next: urllib parse<2>,  Up: Python 3 9 2 での重要な変更点

1.6.14.1 collections.abc
........................

*note collections.abc.Callable: 9eb. generic now flattens type
parameters, similar to what *note typing.Callable: 9c8. currently does.
This means that ‘collections.abc.Callable[[int, str], str]’ will have
‘__args__’ of ‘(int, str, str)’; previously this was ‘([int, str],
str)’.  To allow this change, *note types.GenericAlias: 9ec. can now be
subclassed, and a subclass will be returned when subscripting the *note
collections.abc.Callable: 9eb. type.  Code which accesses the arguments
via *note typing.get_args(): 2ac. or ‘__args__’ need to account for this
change.  A *note DeprecationWarning: 1a3. may be emitted for invalid
forms of parameterizing *note collections.abc.Callable: 9eb. which may
have passed silently in Python 3.9.1.  This *note DeprecationWarning:
1a3. will become a *note TypeError: 198. in Python 3.10.  (Contributed
by Ken Jin in bpo-42195(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42195


File: python.info,  Node: urllib parse<2>,  Prev: collections abc<2>,  Up: Python 3 9 2 での重要な変更点

1.6.14.2 urllib.parse
.....................

Earlier Python versions allowed using both ‘;’ and ‘&’ as query
parameter separators in *note urllib.parse.parse_qs(): 31f. and *note
urllib.parse.parse_qsl(): 31e.  Due to security concerns, and to conform
with newer W3C recommendations, this has been changed to allow only a
single separator key, with ‘&’ as the default.  This change also affects
‘cgi.parse()’ and ‘cgi.parse_multipart()’ as they use the affected
functions internally.  For more details, please see their respective
documentation.  (Contributed by Adam Goldschmidt, Senthil Kumaran and
Ken Jin in bpo-42967(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42967


File: python.info,  Node: Python 3 9 3 での重要な変更点,  Next: Python 3 9 5での重要な変更点,  Prev: Python 3 9 2 での重要な変更点,  Up: What's New In Python 3 9

1.6.15 Python 3.9.3 での重要な変更点
------------------------------------

A security fix alters the *note ftplib.FTP: af6. behavior to not trust
the IPv4 address sent from the remote server when setting up a passive
data channel.  We reuse the ftp server IP address instead.  For unusual
code requiring the old behavior, set a ‘trust_server_pasv_ipv4_address’
attribute on your FTP instance to ‘True’.  (See gh-87451(1))

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/87451


File: python.info,  Node: Python 3 9 5での重要な変更点,  Next: Notable security feature in 3 9 14,  Prev: Python 3 9 3 での重要な変更点,  Up: What's New In Python 3 9

1.6.16 Python 3.9.5での重要な変更点
-----------------------------------

* Menu:

* urllib.parse: urllib parse<3>.


File: python.info,  Node: urllib parse<3>,  Up: Python 3 9 5での重要な変更点

1.6.16.1 urllib.parse
.....................

The presence of newline or tab characters in parts of a URL allows for
some forms of attacks.  Following the WHATWG specification that updates
RFC 3986(1), ASCII newline ‘\n’, ‘\r’ and tab ‘\t’ characters are
stripped from the URL by the parser in *note urllib.parse: 110.
preventing such attacks.  The removal characters are controlled by a new
module level variable ‘urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE’.  (See
gh-88048(2))

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc3986.html

   (2) https://github.com/python/cpython/issues/88048


File: python.info,  Node: Notable security feature in 3 9 14,  Next: Notable changes in 3 9 17,  Prev: Python 3 9 5での重要な変更点,  Up: What's New In Python 3 9

1.6.17 Notable security feature in 3.9.14
-----------------------------------------

Converting between *note int: 19b. and *note str: 169. in bases other
than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10
(decimal) now raises a *note ValueError: 2ec. if the number of digits in
string form is above a limit to avoid potential denial of service
attacks due to the algorithmic complexity.  This is a mitigation for CVE
2020-10735(1).  This limit can be configured or disabled by environment
variable, command line flag, or *note sys: df. APIs.  See the *note
integer string conversion length limitation: 80b. documentation.  The
default limit is 4300 digits in string form.

   ---------- Footnotes ----------

   (1) https://www.cve.org/CVERecord?id=CVE-2020-10735


File: python.info,  Node: Notable changes in 3 9 17,  Prev: Notable security feature in 3 9 14,  Up: What's New In Python 3 9

1.6.18 Notable changes in 3.9.17
--------------------------------

* Menu:

* tarfile: tarfile<4>.


File: python.info,  Node: tarfile<4>,  Up: Notable changes in 3 9 17

1.6.18.1 tarfile
................

   * The extraction methods in *note tarfile: e4, and *note
     shutil.unpack_archive(): 696, have a new a 'filter' argument that
     allows limiting tar features than may be surprising or dangerous,
     such as creating files outside the destination directory.  See
     *note Extraction filters: 697. for details.  In Python 3.12, use
     without the 'filter' argument will show a *note DeprecationWarning:
     1a3.  In Python 3.14, the default will switch to ‘'data'’.
     (Contributed by Petr Viktorin in PEP 706(1).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0706/


File: python.info,  Node: What's New In Python 3 8,  Next: What's New In Python 3 7,  Prev: What's New In Python 3 9,  Up: What's New in Python

1.7 What's New In Python 3.8
============================


編集者: Raymond Hettinger

This article explains the new features in Python 3.8, compared to 3.7.
Python 3.8 was released on October 14, 2019.  For full details, see the
*note changelog: 142.

* Menu:

* 概要: 概要 -- リリースハイライト<7>. リリースハイライト
* 新しい機能: 新しい機能<12>.
* その他の言語変更: その他の言語変更<6>.
* 新たなモジュール: 新たなモジュール<6>.
* 改良されたモジュール: 改良されたモジュール<6>.
* 最適化: 最適化<7>.
* ビルドならびに C API の変更::
* 非推奨: 非推奨<9>.
* API と機能の削除::
* Python 3.8 への移植: Python 3 8 への移植.
* Python3.8.1 での重要な変更点: Python3 8 1 での重要な変更点.
* Python3.8.2 での重要な変更点: Python3 8 2 での重要な変更点.
* Notable changes in Python 3.8.3: Notable changes in Python 3 8 3.
* Python3.8.8 での重要な変更点: Python3 8 8 での重要な変更点.
* Notable changes in Python 3.8.9: Notable changes in Python 3 8 9.
* Notable changes in Python 3.8.10: Notable changes in Python 3 8 10.
* Notable changes in Python 3.8.10: Notable changes in Python 3 8 10<2>.
* Notable changes in Python 3.8.12: Notable changes in Python 3 8 12.
* Notable security feature in 3.8.14: Notable security feature in 3 8 14.
* Notable changes in 3.8.17: Notable changes in 3 8 17.


File: python.info,  Node: 概要 -- リリースハイライト<7>,  Next: 新しい機能<12>,  Up: What's New In Python 3 8

1.7.1 概要 - リリースハイライト
-------------------------------


File: python.info,  Node: 新しい機能<12>,  Next: その他の言語変更<6>,  Prev: 概要 -- リリースハイライト<7>,  Up: What's New In Python 3 8

1.7.2 新しい機能
----------------

* Menu:

* 代入式::
* 位置専用引数::
* コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム::
* デバッグビルドとリリースビルドのABI 共通化::
* f-string での = を用いたオブジェクトの表現::
* PEP 578; Pythonランタイムの監査フック: PEP 578 Pythonランタイムの監査フック.
* PEP 587; Python 初期化設定: PEP 587 Python 初期化設定.
* PEP 590; Vectorcall; a fast calling protocol for CPython: PEP 590 Vectorcall a fast calling protocol for CPython.
* Pickle プロトコルバージョン 5 による帯域外データバッファ::


File: python.info,  Node: 代入式,  Next: 位置専用引数,  Up: 新しい機能<12>

1.7.2.1 代入式
..............

大きな構文の一部として、変数に値を割り当てる新しい構文 ‘:=’ が追加されま
した。 この構文は セイウチの目と牙(1) に似ているため、「セイウチ演算子」
の愛称で知られています。

以下の例では、代入式により *note len(): 840. 関数を二重に呼びだすことを
回避しています:

     if (n := len(a)) > 10:
         print(f"List is too long ({n} elements, expected <= 10)")

同様の利点が、マッチがしたかどうかの判定とサブグループの取得とで2回マッ
チオブジェクトが必要になる、正規表現によるマッチでも、発揮されます:

     discount = 0.0
     if (mo := re.search(r'(\d+)% discount', advertisement)):
         discount = float(mo.group(1)) / 100.0

この演算子は、生成した値をループ終了の判定とループ本体の両方で使用するよ
うな while 文においても、有用です:

     # Loop over fixed length blocks
     while (block := f.read(256)) != '':
         process(block)

動機となったもう 1 つのユースケースは、リスト内包表記においてフィルター
条件の中で計算した値が式の本体でも必要になるところから出てきます:

     [clean_name.title() for name in names
      if (clean_name := normalize('NFC', name)) in allowed_names]

セイウチ演算子の使用は、複雑さを減らしたり可読性を向上させる綺麗なケース
に限るよう努めてください。

完全な説明は PEP 572(2) を参照してください。

(Emily Morehouse の貢献による bpo-35224(3))

   ---------- Footnotes ----------

   (1) 
https://en.wikipedia.org/wiki/Walrus#/media/File:Pacific_Walrus_-_Bull_(8247646168).jpg

   (2) https://peps.python.org/pep-0572/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35224


File: python.info,  Node: 位置専用引数,  Next: コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム,  Prev: 代入式,  Up: 新しい機能<12>

1.7.2.2 位置専用引数
....................

There is a new function parameter syntax ‘/’ to indicate that some
function parameters must be specified positionally and cannot be used as
keyword arguments.  This is the same notation shown by ‘help()’ for C
functions annotated with Larry Hastings' Argument Clinic(1) tool.

以下の例では、引数 'a' と 'b' が位置専用、 'c' と 'd' が位置引数でもキー
ワード引数でも可、'e' と 'f' はキーワード引数専用です:

     def f(a, b, /, c, d, *, e, f):
         print(a, b, c, d, e, f)

以下は正しい関数呼び出しです:

     f(10, 20, 30, d=40, e=50, f=60)

一方、以下は不正です:

     f(10, b=20, c=30, d=40, e=50, f=60)   # b cannot be a keyword argument
     f(10, 20, 30, 40, 50, f=60)           # e must be a keyword argument

One use case for this notation is that it allows pure Python functions
to fully emulate behaviors of existing C coded functions.  For example,
the built-in *note divmod(): b99. function does not accept keyword
arguments:

     def divmod(a, b, /):
         "Emulate the built in divmod() function"
         return (a // b, a % b)

もう一つのユースケースは、引数名が有用ではない場合にキーワード引数として
の利用を排除することです。例えば組み込み関数 *note len(): 840. は
‘len(obj, /)’ というシグニチャです。これにより、以下のようなぎこちない呼
び出しが排除されます:

     len(obj='hello')  # The "obj" keyword argument impairs readability

引数を位置専用とすることは、のちに引数名を変更する際に呼び出し側のコード
を壊してしまう心配がないという利点があります。例えば、*note statistics:
d7. モジュールでは、'dist' という引数名が将来変更される可能性があります
。これは、関数が以下のような定義だからこそ可能なことです:

     def quantiles(dist, /, *, n=4, method='exclusive')
         ...

Since the parameters to the left of ‘/’ are not exposed as possible
keywords, the parameters names remain available for use in ‘**kwargs’:

     >>> def f(a, b, /, **kwargs):
     ...     print(a, b, kwargs)
     ...
     >>> f(10, 20, a=1, b=2, c=3)         # a and b are used in two ways
     10 20 {'a': 1, 'b': 2, 'c': 3}

これにより、任意のキーワード引数を受け取る関数やメソッドを定義するのが、
ぐんとシンプルになります。例えば、これは *note collections: 1e. モジュー
ルから抜き出したコードです：

     class Counter(dict):

         def __init__(self, iterable=None, /, **kwds):
             # Note "iterable" is a possible keyword argument

詳細は PEP 570(2) を参照してください。

(Pablo Galindo の貢献による bpo-36540(3)。)

   ---------- Footnotes ----------

   (1) https://devguide.python.org/development-tools/clinic/

   (2) https://peps.python.org/pep-0570/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36540


File: python.info,  Node: コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム,  Next: デバッグビルドとリリースビルドのABI 共通化,  Prev: 位置専用引数,  Up: 新しい機能<12>

1.7.2.3 コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム
....................................................................................

暗黙のバイトコードキャッシュは、デフォルトでは各ソースコードのディレクト
リ内の ‘__pycache__’ サブディレクトリを使用しますが、新たに追加された環
境変数 *note PYTHONPYCACHEPREFIX: b9b. （またはコマンドラインオプション
*note -X: 16f. ‘pycache_prefix’) を指定すると、ソースコードと分離された
ディレクトリツリーに格納されるようになります。

キャッシュの場所は *note sys.pycache_prefix: b9c. で参照できます（
‘__pycache__’ を使用する場合は *note None: 885. になります）。

（Carl Meyer の貢献による bpo-33499(1)）

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33499


File: python.info,  Node: デバッグビルドとリリースビルドのABI 共通化,  Next: f-string での = を用いたオブジェクトの表現,  Prev: コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム,  Up: 新しい機能<12>

1.7.2.4 デバッグビルドとリリースビルドのABI 共通化
..................................................

Python はリリースモード、デバッグモード両方のビルドにおいて、同じABI を
用いるようになりました。Unix において、Python がデバッグモードでビルドさ
れている場合、リリースモードで、あるいは安定ABI を用いて、ビルドされた
C拡張モジュールを読み込むことができます。

Release builds and *note debug builds: 509. are now ABI compatible:
defining the ‘Py_DEBUG’ macro no longer implies the ‘Py_TRACE_REFS’
macro, which introduces the only ABI incompatibility.  The
‘Py_TRACE_REFS’ macro, which adds the *note sys.getobjects(): 28e.
function and the *note PYTHONDUMPREFS: b9e. environment variable, can be
set using the new *note ./configure -with-trace-refs: 636. build option.
(Contributed by Victor Stinner in bpo-36465(1).)

Unix においては、Android とCygwin を除き、C拡張モジュールはlibpython に
リンクされなくなりました。静的リンクされたPython は、Python 共有ライブラ
リを用いてビルドされたC拡張モジュールを読み込めます。(Victor Stinner の
貢献による bpo-21536(2).)

Unix において、Python がデバッグモードでビルドされている場合、インポート
は、リリースモードで、あるいは安定ABI を用いて、ビルドされたC拡張モジュ
ールを探すようになりました。(Victor Stinner の貢献による bpo-36722(3).)

Python をアプリケーション内に組み込むためには、新しい ‘--embed’ オプショ
ンを有効にして ‘python3-config --libs --embed’ とすると、 ‘-lpython3.8’
を有効にできます。(アプリケーションがlibpython にリンクされます)
Python3.8 以前との互換性を保つためには、 ‘python3-config --libs --embed’
をまず試みてから、失敗した場合 ‘python3-config --libs’ (‘--embed’ なし)
にフォールバックしてください。

Python をアプリケーションに組み込むために、‘python-3.8-embed’ pkg-config
モジュールが追加されました: ‘pkg-config python-3.8-embed --libs’ の出力
は、‘-lpython3.8’ を含みます。 Python3.8 以前との互換性を保つためには、
‘pkg-config python-X.Y-embed --libs’ をまず試みてから、失敗した場合
‘pkg-config python-X.Y --libs’ (‘--embed’ なし) にフォールバックしてくだ
さい。(‘X.Y’ を使用するPython のバージョンに置き換えてください)

一方で、‘pkg-config python3.8 --libs’ は出力に ‘-lpython3.8’ を含まなく
なりました。C拡張モジュールは、libpython にリンクされるべきではありませ
ん。 (スクリプトによって処理される、Android とCygwin を除く) この変更で
は、意図的に後方互換性をなくしています。(Victor Stinner の貢献による
bpo-36721(4))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36465

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21536

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36722

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36721


File: python.info,  Node: f-string での = を用いたオブジェクトの表現,  Next: PEP 578 Pythonランタイムの監査フック,  Prev: デバッグビルドとリリースビルドのABI 共通化,  Up: 新しい機能<12>

1.7.2.5 'f-string' での ‘=’ を用いたオブジェクトの表現
......................................................

フォーマット済み文字列リテラル(*note f-string: 66b.) において ‘=’ 指定子
が有効になりました。‘f'{expr=}'’ のようなf-string は、f-string に書かれ
た式、イコール記号、式を評価されたものの文字列表現、の順で表示されます。
例えば:

     >>> user = 'eric_idle'
     >>> member_since = date(1975, 7, 31)
     >>> f'{user=} {member_since=}'
     "user='eric_idle' member_since=datetime.date(1975, 7, 31)"

通常の *note f-string 書式指定子: 19a. を用いると、より柔軟に式の結果の
表示方法を変えられます:

     >>> delta = date.today() - member_since
     >>> f'{user=!s}  {delta.days=:,d}'
     'user=eric_idle  delta.days=16,075'

‘=’ 指定子は式すべてを表示するので、次のような計算も表示できます:

     >>> print(f'{theta=}  {cos(radians(theta))=:.3f}')
     theta=30  cos(radians(theta))=0.866

(Eric V. Smith, Larry Hastings の貢献による bpo-36817(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36817


File: python.info,  Node: PEP 578 Pythonランタイムの監査フック,  Next: PEP 587 Python 初期化設定,  Prev: f-string での = を用いたオブジェクトの表現,  Up: 新しい機能<12>

1.7.2.6 PEP 578: Pythonランタイムの監査フック
.............................................

このPEP は、監査用フックと信頼された Open のためのフックを追加します。こ
れらは Python およびネイティブコードから利用できます。純粋に Python で書
かれたフレームワークやアプリケーションはコードに関する追加情報を得ること
ができ、システム管理者や埋め込みでの利用者は Python のビルドを常に監査が
有効な状態で利用できます。

詳細は PEP 578(1) を参照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0578/


File: python.info,  Node: PEP 587 Python 初期化設定,  Next: PEP 590 Vectorcall a fast calling protocol for CPython,  Prev: PEP 578 Pythonランタイムの監査フック,  Up: 新しい機能<12>

1.7.2.7 PEP 587: Python 初期化設定
..................................

PEP 587(1) による C API の改善により、Python 初期化時に、すべての初期化
設定に対するより良い制御と改善されたエラー報告が得られます。

新たな構造体:

   * *note PyConfig: 3f7.

   * *note PyPreConfig: ba3.

   * *note PyStatus: ba4.

   * *note PyWideStringList: ba5.

新たな関数:

   * *note PyConfig_Clear(): ba6.

   * *note PyConfig_InitIsolatedConfig(): ba7.

   * *note PyConfig_InitPythonConfig(): ba8.

   * *note PyConfig_Read(): 993.

   * *note PyConfig_SetArgv(): ba9.

   * *note PyConfig_SetBytesArgv(): baa.

   * *note PyConfig_SetBytesString(): bab.

   * *note PyConfig_SetString(): bac.

   * *note PyPreConfig_InitIsolatedConfig(): bad.

   * *note PyPreConfig_InitPythonConfig(): bae.

   * *note PyStatus_Error(): baf.

   * *note PyStatus_Exception(): bb0.

   * *note PyStatus_Exit(): bb1.

   * *note PyStatus_IsError(): bb2.

   * *note PyStatus_IsExit(): bb3.

   * *note PyStatus_NoMemory(): bb4.

   * *note PyStatus_Ok(): bb5.

   * *note PyWideStringList_Append(): bb6.

   * *note PyWideStringList_Insert(): bb7.

   * *note Py_BytesMain(): bb8.

   * *note Py_ExitStatusException(): bb9.

   * *note Py_InitializeFromConfig(): 3f6.

   * *note Py_PreInitialize(): 41e.

   * *note Py_PreInitializeFromArgs(): bba.

   * *note Py_PreInitializeFromBytesArgs(): bbb.

   * *note Py_RunMain(): bbc.

このPEP は、‘_PyRuntimeState.preconfig’ (*note PyPreConfig: ba3. 型) と
‘PyInterpreterState.config’ (*note PyConfig: 3f7. 型) を内部構造体に加え
ます。‘PyInterpreterState.config’ は新たな参照設定となり、グローバル設定
や他の内部変数を置き換えます。

*note Python 初期化設定: 646. も参照してください。

詳細は PEP 587(2) を参照してください。

(Victor Stinner の貢献による bpo-36763(3))

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0587/

   (2) https://peps.python.org/pep-0587/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36763


File: python.info,  Node: PEP 590 Vectorcall a fast calling protocol for CPython,  Next: Pickle プロトコルバージョン 5 による帯域外データバッファ,  Prev: PEP 587 Python 初期化設定,  Up: 新しい機能<12>

1.7.2.8 PEP 590: Vectorcall: a fast calling protocol for CPython
................................................................

*note The Vectorcall Protocol: 774. is added to the Python/C API. It is
meant to formalize existing optimizations which were already done for
various classes.  Any *note static type: 983. implementing a callable
can use this protocol.

これは現在、暫定版です。Python3.9 から公開で使われることを目ざしています
。

詳細は PEP 590(1) を参照してください。

(Contributed by Jeroen Demeyer, Mark Shannon and Petr Viktorin in
bpo-36974(2).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0590/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36974


File: python.info,  Node: Pickle プロトコルバージョン 5 による帯域外データバッファ,  Prev: PEP 590 Vectorcall a fast calling protocol for CPython,  Up: 新しい機能<12>

1.7.2.9 Pickle プロトコルバージョン 5 による帯域外データバッファ
................................................................

*note pickle: ab. モジュールが Python のプロセス間での大容量データ転送で
マルチコアないしマルチマシンでの利点を得るためには、メモリコピーの削減の
ほか、データ種別に応じた圧縮などの個別に合わせた最適化が重要です。

*note pickle: ab. プロトコルバージョン5 は、 PEP 3118(1) 互換であるよう
なデータが、メインのpickle ストリームとは別の独立した通信レイヤで転送さ
れるような、帯域外バッファを提供します。

詳細は PEP 574(2) を参照してください。

(Antoine Pitrou の貢献による bpo-36785(3))

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3118/

   (2) https://peps.python.org/pep-0574/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36785


File: python.info,  Node: その他の言語変更<6>,  Next: 新たなモジュール<6>,  Prev: 新しい機能<12>,  Up: What's New In Python 3 8

1.7.3 その他の言語変更
----------------------

   * 実装上の問題により、*note finally: 1b0. 節での *note continue: 180.
     文は不正でした。Python3.8 では、この制限は取り除かれています。
     (Serhiy Storchaka の貢献による bpo-32489(1))

   * *note bool: 3c3, *note int: 19b, *note fractions.Fraction: 213. タ
     イプは、*note float: 196. や *note decimal.Decimal: 1fe. と同様の
     *note as_integer_ratio(): bc0. メソッドを持つようになりました。この
     API の拡張によって、‘numerator, denominator = x.as_integer_ratio()’
     のようなコードがより多くの数値型で動作します。 (Lisa Roach の貢献に
     よる bpo-33073(2) および Raymond Hettinger の貢献による
     bpo-37819(3))

   * *note int: 19b, *note float: 196, *note complex: 197. のコンストラ
     クタは、可能ならば *note __index__(): 19e. 特殊メソッドを利用し、そ
     の場合は対応する *note __int__(): 19d, *note __float__(): bc1. や
     *note __complex__(): 7fd. は使用できません。(Serhiy Storchaka の貢
     献による bpo-20092(4))

   * Added support of ‘\N{NAME}’ escapes in *note regular expressions:
     be.:

          >>> notice = 'Copyright © 2019'
          >>> copyright_year_pattern = re.compile(r'\N{copyright sign}\s*(\d{4})')
          >>> int(copyright_year_pattern.search(notice).group(1))
          2019

     (Jonathan Eunice, Serhiy Storchaka の貢献による bpo-30688(5))

   * dict と dictview は、*note reversed(): a65. を使って逆順でイテレー
     トすることが可能になりました。(Rémi Lapeyre の貢献による
     bpo-33462(6))

   * 関数内でのキーワード名に関する構文の制限が強化されました。具体的に
     は、‘f((keyword)=arg)’ の表現が許容されなくなりました。キーワード引
     数への代入の際、左側にキーワードそのまま以外の表現を許可する意図は
     、以前からありませんでした。 (Benjamin Peterson の貢献による
     bpo-34641(7))

   * *note yield: bc2. 文と *note return: 1af. 文における一般化されたイ
     テラブルへの展開のために、全体を覆うかっこが不要になりました。これ
     は 'yield' と 'return' の表現を、一般の展開と同様のわかりやすい形式
     にします:

          >>> def parse(family):
          ...     lastname, *members = family.split()
          ...     return lastname.upper(), *members
          ...
          >>> parse('simpsons homer marge bart lisa maggie')
          ('SIMPSONS', 'homer', 'marge', 'bart', 'lisa', 'maggie')

     (David Cuthbert, Jordan Chapman の貢献による bpo-32117(8))

   * ‘[(10, 20) (30, 40)]’ のようなコードでコンマが無い場合、コンパイラ
     は *note SyntaxWarning: 1ae. を、分かりやすい形式で表示します。これ
     で、最初のタプルが呼び出し可能ではないことを *note TypeError: 198.
     で表示するよりもわかりやすくなります。(Serhiy Storchaka の貢献によ
     る bpo-15248(9))

   * *note datetime.date: 1fa, *note datetime.datetime: 4e2, *note
     datetime.timedelta: bc3. オブジェクトのサブクラス間の算術演算は、基
     底クラスではなくサブクラスのインスタンスを返すようになりました。こ
     の変更は、*note astimezone(): bc4. のような、*note
     datetime.timedelta: bc3. に対する算術演算を直接ないし間接的に使用す
     る実装の戻り値の型に影響します。(Paul Ganssle の貢献による
     bpo-32417(10))

   * Python インタープリタがCtrl-C (SIGINT) によって中断され、*note
     KeyboardInterrupt: bc5. 例外の結果が捕捉されなかった場合、Python プ
     ロセスはSIGINT シグナルか、呼び出したプロセスが、Ctrl-C によって終
     了したことを判別できるような適切な終了コードで終了するようになりま
     した。　POSIX とWindows 上のシェルは、非対話セッション内でスクリプ
     トの終了処理を適切に行うために、これを利用できます。(Gregory P.
     Smith を通してGoogle の貢献による bpo-1054041(11))

   * 先進的なプログラミングにおいて、既存の関数の *note types.CodeType:
     32f. オブジェクトを更新する必要が生じます。code オブジェクトはイミ
     ュータブルなので、既存のオブジェクトがあるにもかかわらず、新しい
     code オブジェクトを生成する必要がありました。パラメータが19もあるの
     で、一から作成するのは非合理的です。新しい ‘replace()’ メソッドを使
     えば、更新すべきパラメータを書くだけで、新しいクローンを作成するこ
     とができます。

     ここでは、*note statistics.mean(): 8e1. 関数がキーワード引数として
     'data' を使えないように変更する例を見てみましょう:

          >>> from statistics import mean
          >>> mean(data=[10, 20, 90])
          40
          >>> mean.__code__ = mean.__code__.replace(co_posonlyargcount=1)
          >>> mean(data=[10, 20, 90])
          Traceback (most recent call last):
            ...
          TypeError: mean() got some positional-only arguments passed as keyword arguments: 'data'

     (Victor Stinner の貢献による bpo-37032(12))

   * For integers, the three-argument form of the *note pow(): 1a4.
     function now permits the exponent to be negative in the case where
     the base is relatively prime to the modulus.  It then computes a
     modular inverse to the base when the exponent is ‘-1’, and a
     suitable power of that inverse for other negative exponents.  For
     example, to compute the modular multiplicative inverse(13) of 38
     modulo 137, write:

          >>> pow(38, -1, 137)
          119
          >>> 119 * 38 % 137
          1

     Modular inverses arise in the solution of linear Diophantine
     equations(14).  For example, to find integer solutions for ‘4258𝑥 +
     147𝑦 = 369’, first rewrite as ‘4258𝑥 ≡ 369 (mod 147)’ then solve:

          >>> x = 369 * pow(4258, -1, 147) % 147
          >>> y = (4258 * x - 369) // -147
          >>> 4258 * x + 147 * y
          369

     (Mark Dickinson の貢献による bpo-36027(15))

   * 辞書内包表現は辞書リテラルと同期されたため、まずキーが解釈され、次
     に値が解釈されます:

          >>> # Dict comprehension
          >>> cast = {input('role? '): input('actor? ') for i in range(2)}
          role? King Arthur
          actor? Chapman
          role? Black Knight
          actor? Cleese

          >>> # Dict literal
          >>> cast = {input('role? '): input('actor? ')}
          role? Sir Robin
          actor? Eric Idle

     この実行順の保証は代入式の役に立ち、キーの表現で代入されたものは、
     値の表現で使用することができます:

          >>> names = ['Martin von Löwis', 'Łukasz Langa', 'Walter Dörwald']
          >>> {(n := normalize('NFC', name)).casefold() : n for name in names}
          {'martin von löwis': 'Martin von Löwis',
           'łukasz langa': 'Łukasz Langa',
           'walter dörwald': 'Walter Dörwald'}

     (Jörn Heissler の貢献による bpo-35224(16))

   * The *note object.__reduce__(): bc6. method can now return a tuple
     from two to six elements long.  Formerly, five was the limit.  The
     new, optional sixth element is a callable with a ‘(obj, state)’
     signature.  This allows the direct control over the state-updating
     behavior of a specific object.  If not 'None', this callable will
     have priority over the object's *note __setstate__(): bc7. method.
     (Contributed by Pierre Glaser and Olivier Grisel in bpo-35900(17).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32489

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33073

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37819

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20092

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30688

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33462

   (7) https://bugs.python.org/issue?@action=redirect&bpo=34641

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32117

   (9) https://bugs.python.org/issue?@action=redirect&bpo=15248

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32417

   (11) https://bugs.python.org/issue?@action=redirect&bpo=1054041

   (12) https://bugs.python.org/issue?@action=redirect&bpo=37032

   (13) https://en.wikipedia.org/wiki/Modular_multiplicative_inverse

   (14) https://en.wikipedia.org/wiki/Diophantine_equation

   (15) https://bugs.python.org/issue?@action=redirect&bpo=36027

   (16) https://bugs.python.org/issue?@action=redirect&bpo=35224

   (17) https://bugs.python.org/issue?@action=redirect&bpo=35900


File: python.info,  Node: 新たなモジュール<6>,  Next: 改良されたモジュール<6>,  Prev: その他の言語変更<6>,  Up: What's New In Python 3 8

1.7.4 新たなモジュール
----------------------

   * 新しい *note importlib.metadata: 7e. モジュールは、サードパーティパ
     ッケージからのメタデータ読み込みをサポートします。これは暫定版です
     。例えば、インストールされたパッケージのバージョンを得たり、エント
     リーポイントの一覧を得たりできます:

          >>> # Note following example requires that the popular "requests"
          >>> # package has been installed.
          >>>
          >>> from importlib.metadata import version, requires, files
          >>> version('requests')
          '2.22.0'
          >>> list(requires('requests'))
          ['chardet (<3.1.0,>=3.0.2)']
          >>> list(files('requests'))[:5]
          [PackagePath('requests-2.22.0.dist-info/INSTALLER'),
           PackagePath('requests-2.22.0.dist-info/LICENSE'),
           PackagePath('requests-2.22.0.dist-info/METADATA'),
           PackagePath('requests-2.22.0.dist-info/RECORD'),
           PackagePath('requests-2.22.0.dist-info/WHEEL')]

     (Barry Warsaw, Jason R. Coombs の貢献による bpo-34632(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34632


File: python.info,  Node: 改良されたモジュール<6>,  Next: 最適化<7>,  Prev: 新たなモジュール<6>,  Up: What's New In Python 3 8

1.7.5 改良されたモジュール
--------------------------

* Menu:

* ast: ast<5>.
* asyncio: asyncio<9>.
* builtins: builtins<2>.
* collections::
* cProfile::
* csv: csv<2>.
* curses: curses<4>.
* ctypes: ctypes<3>.
* datetime: datetime<4>.
* functools: functools<3>.
* gc: gc<4>.
* gettext::
* gzip: gzip<3>.
* IDLE と idelelib: IDLE と idelelib<4>.
* inspect: inspect<6>.
* io: io<5>.
* itertools: itertools<5>.
* json.tool: json tool.
* logging: logging<2>.
* math: math<6>.
* mmap: mmap<2>.
* multiprocessing: multiprocessing<4>.
* os: os<7>.
* os.path: os path<5>.
* pathlib: pathlib<10>.
* pickle: pickle<2>.
* plistlib::
* pprint: pprint<3>.
* py_compile: py_compile<2>.
* shlex::
* shutil: shutil<4>.
* socket: socket<5>.
* ssl: ssl<5>.
* statistics: statistics<4>.
* sys: sys<7>.
* tarfile: tarfile<5>.
* threading: threading<5>.
* tokenize: tokenize<2>.
* tkinter: tkinter<5>.
* time: time<4>.
* typing: typing<9>.
* unicodedata: unicodedata<6>.
* unittest: unittest<7>.
* venv: venv<4>.
* weakref::
* xml: xml<4>.
* xmlrpc::


File: python.info,  Node: ast<5>,  Next: asyncio<9>,  Up: 改良されたモジュール<6>

1.7.5.1 ast
...........

AST ノードは ‘end_lineno’ と ‘end_col_offset’ の属性を持つようになりまし
た。これは、正確なノードの終端位置を提供します。(これは、‘lineno’ と
‘col_offset’ の属性を持つノードにのみ有効です)

新しい *note ast.get_source_segment(): bcb. 関数は、特定の AST ノードの
ソースコードを返します。

(Ivan Levkivskyi の貢献による bpo-33416(1))

*note ast.parse(): 1c2. 関数の新しいフラグが有効になりました:

   * ‘type_comments=True’ は、そのAST ノードに関連する、 PEP 484(2) と
     PEP 526(3) に規定されるような型コメントを返します;

   * ‘mode='func_type'’ can be used to parse PEP 484(4) "signature type
     comments" (returned for function definition AST nodes);

   * ‘feature_version=(3, N)’ を使うと、以前の Python 3 バージョンを指定
     できます。例えば、‘feature_version=(3, 4)’ とすると、*note async:
     93b. と *note await: 18d. キーワードは、予約語ではないとして扱われ
     ます。

(Guido van Rossum の貢献による bpo-35766(5))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33416

   (2) https://peps.python.org/pep-0484/

   (3) https://peps.python.org/pep-0526/

   (4) https://peps.python.org/pep-0484/

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35766


File: python.info,  Node: asyncio<9>,  Next: builtins<2>,  Prev: ast<5>,  Up: 改良されたモジュール<6>

1.7.5.2 asyncio
...............

*note asyncio.run(): 2f3. は暫定から安定API に移動しました。この関数は
*note coroutine: 6b9. の実行と、イベントループを管理しながら自動的に結果
を返すことに使用できます。例えば:

     import asyncio

     async def main():
         await asyncio.sleep(0)
         return 42

     asyncio.run(main())

これは、だいたい次と等価です

     import asyncio

     async def main():
         await asyncio.sleep(0)
         return 42

     loop = asyncio.new_event_loop()
     asyncio.set_event_loop(loop)
     try:
         loop.run_until_complete(main())
     finally:
         asyncio.set_event_loop(None)
         loop.close()

実装はこれよりもずっと複雑なものになっています。ですが、 *note
asyncio.run(): 2f3. は非同期IOプログラムを動かす際にまず選ぶべき選択肢で
す。

(Yury Selivanov の貢献による bpo-32314(1))

‘python -m asyncio’ を実行すると、ネイティブ async 対話型インタプリタが
起動します。高水準キーワード *note await: 18d. を使うコードの試験を簡単
に行えます。すべての呼び出しに対して新しいイベントループを作る
‘asyncio.run()’ を呼び出す必要はありません:

     $ python -m asyncio
     asyncio REPL 3.8.0
     Use "await" directly instead of "asyncio.run()".
     Type "help", "copyright", "credits" or "license" for more information.
     >>> import asyncio
     >>> await asyncio.sleep(10, result='hello')
     hello

(Yury Selivanov の貢献による bpo-37028(2))

The exception *note asyncio.CancelledError: 4d4. now inherits from *note
BaseException: 7d6. rather than *note Exception: bcd. and no longer
inherits from *note concurrent.futures.CancelledError: bce.
(Contributed by Yury Selivanov in bpo-32528(3).)

Windows では、イベントループのデフォルトが *note ProactorEventLoop: 81d.
になりました。(Victor Stinner の貢献による bpo-34687(4))

*note ProactorEventLoop: 81d. はUDP もサポートするようになりました。
(Adam Meily, Andrew Svetlov の貢献による bpo-29883(5))

*note ProactorEventLoop: 81d. は *note KeyboardInterrupt: bc5.
("CTRL+C") によって中断できるようになりました。(Vladimir Matveev の貢献
による bpo-23057(6))

*note asyncio.Task: 1c7. 内で、内包されたコルーチンを得られる *note
asyncio.Task.get_coro(): bcf. メソッドが追加されました。(Alex Grönholm の
貢献による bpo-36999(7))

*note asyncio.create_task(): 1c9. 関数か *note create_task(): 1ca. の
‘name’ 引数を指定するか、もしくはタスクに対して *note set_name(): bd0. メ
ソッドを呼ぶことによって、asyncio タスクに名前をつけることができます。タ
スクの名前は、*note asyncio.Task: 1c7. の ‘repr()’ 出力で、または *note
get_name(): bd1. メソッドで確認することができます。(Alex Grönholm の貢献
による bpo-34270(8))

*note asyncio.loop.create_connection(): 818. は、Happy Eyeballs(9) をサ
ポートするようになりました。挙動を定義するため、2つの新しいパラメータ:
'happy_eyeballs_delay' と 'interleave' が加えられます。Happy Eyeballs ア
ルゴリズムは、アプリケーションが IPv4 と IPv6 をサポートする場合、その両
方を使って接続を保つことによって、アプリケーションの応答性を向上させます
。(twisteroid ambassador の貢献による bpo-33530(10))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32314

   (2) https://bugs.python.org/issue?@action=redirect&bpo=37028

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32528

   (4) https://bugs.python.org/issue?@action=redirect&bpo=34687

   (5) https://bugs.python.org/issue?@action=redirect&bpo=29883

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23057

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36999

   (8) https://bugs.python.org/issue?@action=redirect&bpo=34270

   (9) https://en.wikipedia.org/wiki/Happy_Eyeballs

   (10) https://bugs.python.org/issue?@action=redirect&bpo=33530


File: python.info,  Node: builtins<2>,  Next: collections,  Prev: asyncio<9>,  Up: 改良されたモジュール<6>

1.7.5.3 builtins
................

組み込み関数 *note compile(): 4b1. が、‘ast.PyCF_ALLOW_TOP_LEVEL_AWAIT’
フラグを受け取るようになりました。このフラグが有効である場合、*note
compile(): 4b1. は、一般には有効な公文ではない、トップレベルの ‘await’,
‘async for’, ‘async with’ 構文が有効になります。この場合、‘CO_COROUTINE’
フラグを持つ非同期コードオブジェクトが返されるでしょう。(Matthias
Bussonnier の貢献による bpo-34616(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34616


File: python.info,  Node: collections,  Next: cProfile,  Prev: builtins<2>,  Up: 改良されたモジュール<6>

1.7.5.4 collections
...................

*note collections.namedtuple(): 4e0. の *note _asdict(): bd4. メソッドは
、*note collections.OrderedDict: 7f3. ではなく *note dict: 183. を返すよ
うになりました。Python 3.7 からは一般に辞書の順番が保証されるため、この
ような変更が可能です。‘OrderedDict’ 特有の機能を使いたい場合は、結果を
‘OrderedDict(nt._asdict())’ 型にキャストして使用することを推奨します。
(Raymond Hettinger の貢献による bpo-35864(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35864


File: python.info,  Node: cProfile,  Next: csv<2>,  Prev: collections,  Up: 改良されたモジュール<6>

1.7.5.5 cProfile
................

*note cProfile.Profile: bd6. クラスは、コンテキストマネージャとして使用
できるようになりました。このようにしてコードブロックをプロファイルします
:

     import cProfile

     with cProfile.Profile() as profiler:
           # code to be profiled
           ...

(Scott Sanderson の貢献による bpo-29235(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29235


File: python.info,  Node: csv<2>,  Next: curses<4>,  Prev: cProfile,  Up: 改良されたモジュール<6>

1.7.5.6 csv
...........

*note csv.DictReader: bd8. は、*note collections.OrderedDict: 7f3. では
なく *note dict: 183. のインスタンスを返すようになりました。この変更によ
って、順序を保ちながら、より高速にかつメモリの使用量を減らして実行できま
す。(Michael Selik の貢献による bpo-34003(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34003


File: python.info,  Node: curses<4>,  Next: ctypes<3>,  Prev: csv<2>,  Up: 改良されたモジュール<6>

1.7.5.7 curses
..............

ncurses ライブラリの、構造化されたバージョン情報を保持する変数を追加しま
した: *note ncurses_version: bda.　 (Serhiy Storchaka の貢献による
bpo-31680(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31680


File: python.info,  Node: ctypes<3>,  Next: datetime<4>,  Prev: curses<4>,  Up: 改良されたモジュール<6>

1.7.5.8 ctypes
..............

Windows では、*note CDLL: bdc. とそのサブクラスが 'winmode' 引数を受け取
り、根底の ‘LoadLibraryEx’ 呼び出しのフラグを指定できるようになりました
。デフォルトでは、フラグは (フルパスか部分パスが初期DLL を読み込むのに使
われていた場合) そのDLL が保存されている場所を含んだ信頼済みの場所と、
*note add_dll_directory(): bdd. によって加えられた場所からのみ、DLL を読
み込むようになっています。(Steve Dower の貢献による bpo-36085(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36085


File: python.info,  Node: datetime<4>,  Next: functools<3>,  Prev: ctypes<3>,  Up: 改良されたモジュール<6>

1.7.5.9 datetime
................

Added new alternate constructors *note datetime.date.fromisocalendar():
bdf. and *note datetime.datetime.fromisocalendar(): be0, which construct
*note date: 1fa. and *note datetime: 4e2. objects respectively from ISO
year, week number, and weekday; these are the inverse of each class's
‘isocalendar’ method.  (Contributed by Paul Ganssle in bpo-36004(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36004


File: python.info,  Node: functools<3>,  Next: gc<4>,  Prev: datetime<4>,  Up: 改良されたモジュール<6>

1.7.5.10 functools
..................

*note functools.lru_cache(): be2. は、デコレータを返す関数としての使い方
に加えて、デコレータそのものとしても使えるようになりました。両方の使い方
ができます:

     @lru_cache
     def f(x):
         ...

     @lru_cache(maxsize=256)
     def f(x):
         ...

(Raymond Hettinger の貢献による bpo-36772(1))

インスタンスが存在する間、計算型プロパティをキャッシュする *note
functools.cached_property(): 763. デコレータが追加されました:

     import functools
     import statistics

     class Dataset:
        def __init__(self, sequence_of_numbers):
           self.data = sequence_of_numbers

        @functools.cached_property
        def variance(self):
           return statistics.variance(self.data)

(Carl Meyer の貢献による bpo-21145(2))

*note single dispatch: be3. を利用して、メソッドを *note
ジェネリック関数: be4. に変換する *note
functools.singledispatchmethod(): be5. デコレータが追加されました:

     from functools import singledispatchmethod
     from contextlib import suppress

     class TaskManager:

         def __init__(self, tasks):
             self.tasks = list(tasks)

         @singledispatchmethod
         def discard(self, value):
             with suppress(ValueError):
                 self.tasks.remove(value)

         @discard.register(list)
         def _(self, tasks):
             targets = set(tasks)
             self.tasks = [x for x in self.tasks if x not in targets]

(Ethan Smith の貢献による bpo-32380(3))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36772

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21145

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32380


File: python.info,  Node: gc<4>,  Next: gettext,  Prev: functools<3>,  Up: 改良されたモジュール<6>

1.7.5.11 gc
...........

*note get_objects(): a04. は、オブジェクトを得る世代を指定するオプション
のパラメータ引数 'generation' を受け取るようになりました。(Pablo Galindo
の貢献による bpo-36016(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36016


File: python.info,  Node: gettext,  Next: gzip<3>,  Prev: gc<4>,  Up: 改良されたモジュール<6>

1.7.5.12 gettext
................

*note pgettext(): be8. を含む、類似のいくつかの関数が追加されました。
(Franz Glasner, Éric Araujo, Cheryl Sabella の貢献による bpo-2504(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=2504


File: python.info,  Node: gzip<3>,  Next: IDLE と idelelib<4>,  Prev: gettext,  Up: 改良されたモジュール<6>

1.7.5.13 gzip
.............

出力の再現性のために、*note gzip.compress(): 84e. に 'mtime' パラメータ
が追加されました。 (Guo Ci Teo の貢献による bpo-34898(1))

不正な、あるいは破損した gzip ファイルのうち、所定の種類のものについて、
*note OSError: 2c0. にかわって *note BadGzipFile: bea. 例外が送出される
ようになりました。(Filip Gruszczyński, Michele Orrù, Zackery Spytz の貢
献による bpo-6584(2))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34898

   (2) https://bugs.python.org/issue?@action=redirect&bpo=6584


File: python.info,  Node: IDLE と idelelib<4>,  Next: inspect<6>,  Prev: gzip<3>,  Up: 改良されたモジュール<6>

1.7.5.14 IDLE と idelelib
.........................

Output over N lines (50 by default) is squeezed down to a button.  N can
be changed in the PyShell section of the General page of the Settings
dialog.  Fewer, but possibly extra long, lines can be squeezed by right
clicking on the output.  Squeezed output can be expanded in place by
double-clicking the button or into the clipboard or a separate window by
right-clicking the button.  (Contributed by Tal Einat in
bpo-1529353(1).)

Add "Run Customized" to the Run menu to run a module with customized
settings.  Any command line arguments entered are added to sys.argv.
They also re-appear in the box for the next customized run.  One can
also suppress the normal Shell main module restart.  (Contributed by
Cheryl Sabella, Terry Jan Reedy, and others in bpo-5680(2) and
bpo-37627(3).)

Added optional line numbers for IDLE editor windows.  Windows open
without line numbers unless set otherwise in the General tab of the
configuration dialog.  Line numbers for an existing window are shown and
hidden in the Options menu.  (Contributed by Tal Einat and Saimadhav
Heblikar in bpo-17535(4).)

OS native encoding is now used for converting between Python strings and
Tcl objects.  This allows IDLE to work with emoji and other non-BMP
characters.  These characters can be displayed or copied and pasted to
or from the clipboard.  Converting strings from Tcl to Python and back
now never fails.  (Many people worked on this for eight years but the
problem was finally solved by Serhiy Storchaka in bpo-13153(5).)

New in 3.8.1:

Add option to toggle cursor blink off.  (Contributed by Zackery Spytz in
bpo-4603(6).)

Escape key now closes IDLE completion windows.  (Contributed by Johnny
Najera in bpo-38944(7).)

上で挙げた変更は 3.7 のメンテナンスリリースにバックポートされました。

Add keywords to module name completion list.  (Contributed by Terry J.
Reedy in bpo-37765(8).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1529353

   (2) https://bugs.python.org/issue?@action=redirect&bpo=5680

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37627

   (4) https://bugs.python.org/issue?@action=redirect&bpo=17535

   (5) https://bugs.python.org/issue?@action=redirect&bpo=13153

   (6) https://bugs.python.org/issue?@action=redirect&bpo=4603

   (7) https://bugs.python.org/issue?@action=redirect&bpo=38944

   (8) https://bugs.python.org/issue?@action=redirect&bpo=37765


File: python.info,  Node: inspect<6>,  Next: io<5>,  Prev: IDLE と idelelib<4>,  Up: 改良されたモジュール<6>

1.7.5.15 inspect
................

*note inspect.getdoc(): bed. 関数は、‘__slots__’ 属性に値が docstrings で
あるような *note dict: 183. がある場合、docstrings の内容を探索できるよ
うになりました。これは、既に *note property(): 4b3.、*note
classmethod(): 48e.、*note staticmethod(): 453. に現在あるような、ドキュ
メント生成の選択肢を提供します:

     class AudioClip:
         __slots__ = {'bit_rate': 'expressed in kilohertz to one decimal place',
                      'duration': 'in seconds, rounded up to an integer'}
         def __init__(self, bit_rate, duration):
             self.bit_rate = round(bit_rate / 1000.0, 1)
             self.duration = ceil(duration)

(Raymond Hettinger の貢献による bpo-36326(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36326


File: python.info,  Node: io<5>,  Next: itertools<5>,  Prev: inspect<6>,  Up: 改良されたモジュール<6>

1.7.5.16 io
...........

In development mode (*note -X: 16f. ‘env’) and in *note debug build:
509, the *note io.IOBase: 505. finalizer now logs the exception if the
‘close()’ method fails.  The exception is ignored silently by default in
release build.  (Contributed by Victor Stinner in bpo-18748(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18748


File: python.info,  Node: itertools<5>,  Next: json tool,  Prev: io<5>,  Up: 改良されたモジュール<6>

1.7.5.17 itertools
..................

*note itertools.accumulate(): bf0. 関数に、初期値を定める、オプションの
'initial' キーワード引数が追加されました:

     >>> from itertools import accumulate
     >>> list(accumulate([10, 5, 30, 15], initial=1000))
     [1000, 1010, 1015, 1045, 1060]

(Lisa Roach の貢献による bpo-34659(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34659


File: python.info,  Node: json tool,  Next: logging<2>,  Prev: itertools<5>,  Up: 改良されたモジュール<6>

1.7.5.18 json.tool
..................

一行ごとに別々の JSON オブジェクトへ解析をする ‘--json-lines’ オプション
が追加されました。(Weipeng Hong の貢献による bpo-31553(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31553


File: python.info,  Node: logging<2>,  Next: math<6>,  Prev: json tool,  Up: 改良されたモジュール<6>

1.7.5.19 logging
................

Added a 'force' keyword argument to *note logging.basicConfig(): bf3.
When set to true, any existing handlers attached to the root logger are
removed and closed before carrying out the configuration specified by
the other arguments.

This solves a long-standing problem.  Once a logger or 'basicConfig()'
had been called, subsequent calls to 'basicConfig()' were silently
ignored.  This made it difficult to update, experiment with, or teach
the various logging configuration options using the interactive prompt
or a Jupyter notebook.

(Suggested by Raymond Hettinger, implemented by Donghee Na, and reviewed
by Vinay Sajip in bpo-33897(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33897


File: python.info,  Node: math<6>,  Next: mmap<2>,  Prev: logging<2>,  Up: 改良されたモジュール<6>

1.7.5.20 math
.............

二点間のユークリッド距離を計算する *note math.dist(): bf5. 関数が追加さ
れました。(Raymond Hettinger の貢献による bpo-33089(1))

*note math.hypot(): bf6. 関数は、3次元以上を扱えるように拡張されました。
以前は、二次元の場合のみに対応していました。(Raymond Hettinger の貢献に
よる bpo-33089(2))

*note sum(): 695. に類似する関数として、初期値(デフォルトは1) に対してイ
テレート可能なオブジェクトの数を掛けていく *note math.prod(): bf7. 関数
が追加されました:

     >>> prior = 0.8
     >>> likelihoods = [0.625, 0.84, 0.30]
     >>> math.prod(likelihoods, start=prior)
     0.126

(Pablo Galindo の貢献による bpo-35606(3))

2つの組み合わせの関数 *note math.perm(): 8e0. と *note math.comb(): 8df.
が追加されました:

     >>> math.perm(10, 3)    # Permutations of 10 things taken 3 at a time
     720
     >>> math.comb(10, 3)    # Combinations of 10 things taken 3 at a time
     120

(Yash Aggarwal, Keller Fuchs, Serhiy Storchaka, Raymond Hettinger の貢献
による bpo-37128(4), bpo-37178(5), bpo-35431(6))

浮動小数点数を介することなく、正確な整数の二乗根を計算する関数 *note
math.isqrt(): bf8. が追加されました。この関数は、巨大な整数にも使用でき
ます。‘floor(sqrt(n))’ より高速ですが、*note math.sqrt(): bf9. より少し
遅いです:

     >>> r = 650320427
     >>> s = r ** 2
     >>> isqrt(s - 1)         # correct
     650320426
     >>> floor(sqrt(s - 1))   # incorrect
     650320427

(Mark Dickinson の貢献による bpo-36887(7))

*note math.factorial(): b41. 関数は、引数に int、またはそれに類似するも
の以外を受け取らなくなりました。(Pablo Galindo の貢献による
bpo-33083(8))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33089

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33089

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35606

   (4) https://bugs.python.org/issue?@action=redirect&bpo=37128

   (5) https://bugs.python.org/issue?@action=redirect&bpo=37178

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35431

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36887

   (8) https://bugs.python.org/issue?@action=redirect&bpo=33083


File: python.info,  Node: mmap<2>,  Next: multiprocessing<4>,  Prev: math<6>,  Up: 改良されたモジュール<6>

1.7.5.21 mmap
.............

The *note mmap.mmap: 519. class now has an *note madvise(): bfb. method
to access the ‘madvise()’ system call.  (Contributed by Zackery Spytz in
bpo-32941(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32941


File: python.info,  Node: multiprocessing<4>,  Next: os<7>,  Prev: mmap<2>,  Up: 改良されたモジュール<6>

1.7.5.22 multiprocessing
........................

Added new *note multiprocessing.shared_memory: 9d. module.  (Contributed
by Davin Potts in bpo-35813(1).)

On macOS, the 'spawn' start method is now used by default.  (Contributed
by Victor Stinner in bpo-33725(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35813

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33725


File: python.info,  Node: os<7>,  Next: os path<5>,  Prev: multiprocessing<4>,  Up: 改良されたモジュール<6>

1.7.5.23 os
...........

Added new function *note add_dll_directory(): bdd. on Windows for
providing additional search paths for native dependencies when importing
extension modules or loading DLLs using *note ctypes: 2e.  (Contributed
by Steve Dower in bpo-36085(1).)

A new *note os.memfd_create(): bfe. function was added to wrap the
‘memfd_create()’ syscall.  (Contributed by Zackery Spytz and Christian
Heimes in bpo-26836(2).)

On Windows, much of the manual logic for handling reparse points
(including symlinks and directory junctions) has been delegated to the
operating system.  Specifically, *note os.stat(): 26d. will now traverse
anything supported by the operating system, while *note os.lstat(): 6c8.
will only open reparse points that identify as "name surrogates" while
others are opened as for *note os.stat(): 26d.  In all cases, *note
os.stat_result.st_mode: bff. will only have ‘S_IFLNK’ set for symbolic
links and not other kinds of reparse points.  To identify other kinds of
reparse point, check the new *note os.stat_result.st_reparse_tag: c00.
attribute.

On Windows, *note os.readlink(): b1a. is now able to read directory
junctions.  Note that *note islink(): c01. will return ‘False’ for
directory junctions, and so code that checks ‘islink’ first will
continue to treat junctions as directories, while code that handles
errors from *note os.readlink(): b1a. may now treat junctions as links.

(Contributed by Steve Dower in bpo-37834(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36085

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26836

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37834


File: python.info,  Node: os path<5>,  Next: pathlib<10>,  Prev: os<7>,  Up: 改良されたモジュール<6>

1.7.5.24 os.path
................

*note os.path: a6. functions that return a boolean result like *note
exists(): c03, *note lexists(): c04, *note isdir(): c05, *note isfile():
c06, *note islink(): c01, and *note ismount(): c07. now return ‘False’
instead of raising *note ValueError: 2ec. or its subclasses *note
UnicodeEncodeError: 887. and *note UnicodeDecodeError: c08. for paths
that contain characters or bytes unrepresentable at the OS level.
(Contributed by Serhiy Storchaka in bpo-33721(1).)

*note expanduser(): c09. on Windows now prefers the ‘USERPROFILE’
environment variable and does not use ‘HOME’, which is not normally set
for regular user accounts.  (Contributed by Anthony Sottile in
bpo-36264(2).)

*note isdir(): c05. on Windows no longer returns ‘True’ for a link to a
non-existent directory.

*note realpath(): 262. on Windows now resolves reparse points, including
symlinks and directory junctions.

(Contributed by Steve Dower in bpo-37834(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33721

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36264

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37834


File: python.info,  Node: pathlib<10>,  Next: pickle<2>,  Prev: os path<5>,  Up: 改良されたモジュール<6>

1.7.5.25 pathlib
................

*note pathlib.Path: 266. methods that return a boolean result like *note
exists(): c0b, *note is_dir(): 53a, *note is_file(): 539, *note
is_mount(): c0c, *note is_symlink(): c0d, *note is_block_device(): c0e,
*note is_char_device(): c0f, *note is_fifo(): c10, *note is_socket():
c11. now return ‘False’ instead of raising *note ValueError: 2ec. or its
subclass *note UnicodeEncodeError: 887. for paths that contain
characters unrepresentable at the OS level.  (Contributed by Serhiy
Storchaka in bpo-33721(1).)

Added ‘pathlib.Path.link_to()’ which creates a hard link pointing to a
path.  (Contributed by Joannah Nanjekye in bpo-26978(2)) Note that
‘link_to’ was deprecated in 3.10 and removed in 3.12 in favor of a
‘hardlink_to’ method added in 3.10 which matches the semantics of the
existing ‘symlink_to’ method.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33721

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26978


File: python.info,  Node: pickle<2>,  Next: plistlib,  Prev: pathlib<10>,  Up: 改良されたモジュール<6>

1.7.5.26 pickle
...............

*note pickle: ab. extensions subclassing the C-optimized *note Pickler:
c13. can now override the pickling logic of functions and classes by
defining the special *note reducer_override(): c14. method.
(Contributed by Pierre Glaser and Olivier Grisel in bpo-35900(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35900


File: python.info,  Node: plistlib,  Next: pprint<3>,  Prev: pickle<2>,  Up: 改良されたモジュール<6>

1.7.5.27 plistlib
.................

Added new *note plistlib.UID: c16. and enabled support for reading and
writing NSKeyedArchiver-encoded binary plists.  (Contributed by Jon
Janzen in bpo-26707(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26707


File: python.info,  Node: pprint<3>,  Next: py_compile<2>,  Prev: plistlib,  Up: 改良されたモジュール<6>

1.7.5.28 pprint
...............

The *note pprint: b3. module added a 'sort_dicts' parameter to several
functions.  By default, those functions continue to sort dictionaries
before rendering or printing.  However, if 'sort_dicts' is set to false,
the dictionaries retain the order that keys were inserted.  This can be
useful for comparison to JSON inputs during debugging.

In addition, there is a convenience new function, *note pprint.pp():
c18. that is like *note pprint.pprint(): a29. but with 'sort_dicts'
defaulting to ‘False’:

     >>> from pprint import pprint, pp
     >>> d = dict(source='input.txt', operation='filter', destination='output.txt')
     >>> pp(d, width=40)                  # Original order
     {'source': 'input.txt',
      'operation': 'filter',
      'destination': 'output.txt'}
     >>> pprint(d, width=40)              # Keys sorted alphabetically
     {'destination': 'output.txt',
      'operation': 'filter',
      'source': 'input.txt'}

(Contributed by Rémi Lapeyre in bpo-30670(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30670


File: python.info,  Node: py_compile<2>,  Next: shlex,  Prev: pprint<3>,  Up: 改良されたモジュール<6>

1.7.5.29 py_compile
...................

*note py_compile.compile(): c1a. now supports silent mode.  (Contributed
by Joannah Nanjekye in bpo-22640(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22640


File: python.info,  Node: shlex,  Next: shutil<4>,  Prev: py_compile<2>,  Up: 改良されたモジュール<6>

1.7.5.30 shlex
..............

The new *note shlex.join(): c1c. function acts as the inverse of *note
shlex.split(): 75e.  (Contributed by Bo Bayles in bpo-32102(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32102


File: python.info,  Node: shutil<4>,  Next: socket<5>,  Prev: shlex,  Up: 改良されたモジュール<6>

1.7.5.31 shutil
...............

*note shutil.copytree(): c1e. now accepts a new ‘dirs_exist_ok’ keyword
argument.  (Contributed by Josh Bronson in bpo-20849(1).)

*note shutil.make_archive(): 6da. now defaults to the modern pax
(POSIX.1-2001) format for new archives to improve portability and
standards conformance, inherited from the corresponding change to the
*note tarfile: e4. module.  (Contributed by C.A.M. Gerlach in
bpo-30661(2).)

*note shutil.rmtree(): 356. on Windows now removes directory junctions
without recursively removing their contents first.  (Contributed by
Steve Dower in bpo-37834(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20849

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30661

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37834


File: python.info,  Node: socket<5>,  Next: ssl<5>,  Prev: shutil<4>,  Up: 改良されたモジュール<6>

1.7.5.32 socket
...............

Added *note create_server(): c20. and *note has_dualstack_ipv6(): c21.
convenience functions to automate the necessary tasks usually involved
when creating a server socket, including accepting both IPv4 and IPv6
connections on the same socket.  (Contributed by Giampaolo Rodolà in
bpo-17561(1).)

The *note socket.if_nameindex(): c22, *note socket.if_nametoindex():
c23, and *note socket.if_indextoname(): c24. functions have been
implemented on Windows.  (Contributed by Zackery Spytz in bpo-37007(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17561

   (2) https://bugs.python.org/issue?@action=redirect&bpo=37007


File: python.info,  Node: ssl<5>,  Next: statistics<4>,  Prev: socket<5>,  Up: 改良されたモジュール<6>

1.7.5.33 ssl
............

Added *note post_handshake_auth: c26. to enable and *note
verify_client_post_handshake(): c27. to initiate TLS 1.3 post-handshake
authentication.  (Contributed by Christian Heimes in bpo-34670(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34670


File: python.info,  Node: statistics<4>,  Next: sys<7>,  Prev: ssl<5>,  Up: 改良されたモジュール<6>

1.7.5.34 statistics
...................

Added *note statistics.fmean(): c29. as a faster, floating-point variant
of *note statistics.mean(): 8e1.  (Contributed by Raymond Hettinger and
Steven D'Aprano in bpo-35904(1).)

Added *note statistics.geometric_mean(): c2a. (Contributed by Raymond
Hettinger in bpo-27181(2).)

Added *note statistics.multimode(): c2b. that returns a list of the most
common values.  (Contributed by Raymond Hettinger in bpo-35892(3).)

Added *note statistics.quantiles(): c2c. that divides data or a
distribution in to equiprobable intervals (e.g.  quartiles, deciles, or
percentiles).  (Contributed by Raymond Hettinger in bpo-36546(4).)

Added *note statistics.NormalDist: c2d, a tool for creating and
manipulating normal distributions of a random variable.  (Contributed by
Raymond Hettinger in bpo-36018(5).)

     >>> temperature_feb = NormalDist.from_samples([4, 12, -3, 2, 7, 14])
     >>> temperature_feb.mean
     6.0
     >>> temperature_feb.stdev
     6.356099432828281

     >>> temperature_feb.cdf(3)            # Chance of being under 3 degrees
     0.3184678262814532
     >>> # Relative chance of being 7 degrees versus 10 degrees
     >>> temperature_feb.pdf(7) / temperature_feb.pdf(10)
     1.2039930378537762

     >>> el_niño = NormalDist(4, 2.5)
     >>> temperature_feb += el_niño        # Add in a climate effect
     >>> temperature_feb
     NormalDist(mu=10.0, sigma=6.830080526611674)

     >>> temperature_feb * (9/5) + 32      # Convert to Fahrenheit
     NormalDist(mu=50.0, sigma=12.294144947901014)
     >>> temperature_feb.samples(3)        # Generate random samples
     [7.672102882379219, 12.000027119750287, 4.647488369766392]

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35904

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27181

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35892

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36546

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36018


File: python.info,  Node: sys<7>,  Next: tarfile<5>,  Prev: statistics<4>,  Up: 改良されたモジュール<6>

1.7.5.35 sys
............

Add new *note sys.unraisablehook(): 507. function which can be
overridden to control how "unraisable exceptions" are handled.  It is
called when an exception has occurred but there is no way for Python to
handle it.  For example, when a destructor raises an exception or during
garbage collection (*note gc.collect(): 1b3.).  (Contributed by Victor
Stinner in bpo-36829(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36829


File: python.info,  Node: tarfile<5>,  Next: threading<5>,  Prev: sys<7>,  Up: 改良されたモジュール<6>

1.7.5.36 tarfile
................

The *note tarfile: e4. module now defaults to the modern pax
(POSIX.1-2001) format for new archives, instead of the previous
GNU-specific one.  This improves cross-platform portability with a
consistent encoding (UTF-8) in a standardized and extensible format, and
offers several other benefits.  (Contributed by C.A.M. Gerlach in
bpo-36268(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36268


File: python.info,  Node: threading<5>,  Next: tokenize<2>,  Prev: tarfile<5>,  Up: 改良されたモジュール<6>

1.7.5.37 threading
..................

Add a new *note threading.excepthook(): a4b. function which handles
uncaught *note threading.Thread.run(): c31. exception.  It can be
overridden to control how uncaught *note threading.Thread.run(): c31.
exceptions are handled.  (Contributed by Victor Stinner in
bpo-1230540(1).)

Add a new *note threading.get_native_id(): c32. function and a *note
native_id: c33. attribute to the *note threading.Thread: 176. class.
These return the native integral Thread ID of the current thread
assigned by the kernel.  This feature is only available on certain
platforms, see *note get_native_id: c32. for more information.
(Contributed by Jake Tesler in bpo-36084(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1230540

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36084


File: python.info,  Node: tokenize<2>,  Next: tkinter<5>,  Prev: threading<5>,  Up: 改良されたモジュール<6>

1.7.5.38 tokenize
.................

The *note tokenize: 101. module now implicitly emits a ‘NEWLINE’ token
when provided with input that does not have a trailing new line.  This
behavior now matches what the C tokenizer does internally.  (Contributed
by Ammar Askar in bpo-33899(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33899


File: python.info,  Node: tkinter<5>,  Next: time<4>,  Prev: tokenize<2>,  Up: 改良されたモジュール<6>

1.7.5.39 tkinter
................

Added methods ‘selection_from()’, ‘selection_present()’,
‘selection_range()’ and ‘selection_to()’ in the ‘tkinter.Spinbox’ class.
(Contributed by Juliette Monsel in bpo-34829(1).)

Added method ‘moveto()’ in the ‘tkinter.Canvas’ class.  (Contributed by
Juliette Monsel in bpo-23831(2).)

The ‘tkinter.PhotoImage’ class now has ‘transparency_get()’ and
‘transparency_set()’ methods.  (Contributed by Zackery Spytz in
bpo-25451(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34829

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23831

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25451


File: python.info,  Node: time<4>,  Next: typing<9>,  Prev: tkinter<5>,  Up: 改良されたモジュール<6>

1.7.5.40 time
.............

Added new clock *note CLOCK_UPTIME_RAW: c37. for macOS 10.12.
(Contributed by Joannah Nanjekye in bpo-35702(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35702


File: python.info,  Node: typing<9>,  Next: unicodedata<6>,  Prev: time<4>,  Up: 改良されたモジュール<6>

1.7.5.41 typing
...............

The *note typing: 10a. module incorporates several new features:

   * A dictionary type with per-key types.  See PEP 589(1) and *note
     typing.TypedDict: 332.  TypedDict uses only string keys.  By
     default, every key is required to be present.  Specify
     "total=False" to allow keys to be optional:

          class Location(TypedDict, total=False):
              lat_long: tuple
              grid_square: str
              xy_coordinate: tuple

   * Literal types.  See PEP 586(2) and *note typing.Literal: a55.
     Literal types indicate that a parameter or return value is
     constrained to one or more specific literal values:

          def get_status(port: int) -> Literal['connected', 'disconnected']:
              ...

   * "Final" variables, functions, methods and classes.  See PEP 591(3),
     *note typing.Final: 56e. and *note typing.final(): 8bc.  The final
     qualifier instructs a static type checker to restrict subclassing,
     overriding, or reassignment:

          pi: Final[float] = 3.1415926536

   * Protocol definitions.  See PEP 544(4), *note typing.Protocol: 56b.
     and *note typing.runtime_checkable(): 675.  Simple ABCs like *note
     typing.SupportsInt: c39. are now ‘Protocol’ subclasses.

   * New protocol class *note typing.SupportsIndex: c3a.

   * New functions *note typing.get_origin(): 2ab. and *note
     typing.get_args(): 2ac.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0589/

   (2) https://peps.python.org/pep-0586/

   (3) https://peps.python.org/pep-0591/

   (4) https://peps.python.org/pep-0544/


File: python.info,  Node: unicodedata<6>,  Next: unittest<7>,  Prev: typing<9>,  Up: 改良されたモジュール<6>

1.7.5.42 unicodedata
....................

The *note unicodedata: 10b. module has been upgraded to use the Unicode
12.1.0(1) release.

New function *note is_normalized(): c3c. can be used to verify a string
is in a specific normal form, often much faster than by actually
normalizing the string.  (Contributed by Max Belanger, David Euresti,
and Greg Price in bpo-32285(2) and bpo-37966(3)).

   ---------- Footnotes ----------

   (1) https://blog.unicode.org/2019/05/unicode-12-1-en.html

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32285

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37966


File: python.info,  Node: unittest<7>,  Next: venv<4>,  Prev: unicodedata<6>,  Up: 改良されたモジュール<6>

1.7.5.43 unittest
.................

Added *note AsyncMock: c3e. to support an asynchronous version of *note
Mock: c3f.  Appropriate new assert functions for testing have been added
as well.  (Contributed by Lisa Roach in bpo-26467(1)).

Added *note addModuleCleanup(): c40. and *note addClassCleanup(): c41.
to unittest to support cleanups for *note setUpModule(): c42. and *note
setUpClass(): c43.  (Contributed by Lisa Roach in bpo-24412(2).)

Several mock assert functions now also print a list of actual calls upon
failure.  (Contributed by Petter Strandmark in bpo-35047(3).)

*note unittest: 10c. module gained support for coroutines to be used as
test cases with *note unittest.IsolatedAsyncioTestCase: 361.
(Contributed by Andrew Svetlov in bpo-32972(4).)

以下はプログラム例です:

     import unittest


     class TestRequest(unittest.IsolatedAsyncioTestCase):

         async def asyncSetUp(self):
             self.connection = await AsyncConnection()

         async def test_get(self):
             response = await self.connection.get("https://example.com")
             self.assertEqual(response.status_code, 200)

         async def asyncTearDown(self):
             await self.connection.close()


     if __name__ == "__main__":
         unittest.main()

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26467

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24412

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35047

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32972


File: python.info,  Node: venv<4>,  Next: weakref,  Prev: unittest<7>,  Up: 改良されたモジュール<6>

1.7.5.44 venv
.............

*note venv: 117. now includes an ‘Activate.ps1’ script on all platforms
for activating virtual environments under PowerShell Core 6.1.
(Contributed by Brett Cannon in bpo-32718(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32718


File: python.info,  Node: weakref,  Next: xml<4>,  Prev: venv<4>,  Up: 改良されたモジュール<6>

1.7.5.45 weakref
................

The proxy objects returned by *note weakref.proxy(): c46. now support
the matrix multiplication operators ‘@’ and ‘@=’ in addition to the
other numeric operators.  (Contributed by Mark Dickinson in
bpo-36669(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36669


File: python.info,  Node: xml<4>,  Next: xmlrpc,  Prev: weakref,  Up: 改良されたモジュール<6>

1.7.5.46 xml
............

As mitigation against DTD and external entity retrieval, the *note
xml.dom.minidom: 128. and *note xml.sax: 12f. modules no longer process
external entities by default.  (Contributed by Christian Heimes in
bpo-17239(1).)

The ‘.find*()’ methods in the *note xml.etree.ElementTree: 12b. module
support wildcard searches like ‘{*}tag’ which ignores the namespace and
‘{namespace}*’ which returns all tags in the given namespace.
(Contributed by Stefan Behnel in bpo-28238(2).)

The *note xml.etree.ElementTree: 12b. module provides a new function
*note canonicalize(): c48. that implements C14N 2.0.  (Contributed by
Stefan Behnel in bpo-13611(3).)

The target object of *note xml.etree.ElementTree.XMLParser: c49. can
receive namespace declaration events through the new callback methods
‘start_ns()’ and ‘end_ns()’.  Additionally, the *note
xml.etree.ElementTree.TreeBuilder: c4a. target can be configured to
process events about comments and processing instructions to include
them in the generated tree.  (Contributed by Stefan Behnel in
bpo-36676(4) and bpo-36673(5).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17239

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28238

   (3) https://bugs.python.org/issue?@action=redirect&bpo=13611

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36676

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36673


File: python.info,  Node: xmlrpc,  Prev: xml<4>,  Up: 改良されたモジュール<6>

1.7.5.47 xmlrpc
...............

*note xmlrpc.client.ServerProxy: c4c. now supports an optional 'headers'
keyword argument for a sequence of HTTP headers to be sent with each
request.  Among other things, this makes it possible to upgrade from
default basic authentication to faster session authentication.
(Contributed by Cédric Krier in bpo-35153(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35153


File: python.info,  Node: 最適化<7>,  Next: ビルドならびに C API の変更,  Prev: 改良されたモジュール<6>,  Up: What's New In Python 3 8

1.7.6 最適化
------------

   * The *note subprocess: dc. module can now use the *note
     os.posix_spawn(): 52e. function in some cases for better
     performance.  Currently, it is only used on macOS and Linux (using
     glibc 2.24 or newer) if all these conditions are met:

        * 'close_fds' is false;

        * 'preexec_fn', 'pass_fds', 'cwd' and 'start_new_session'
          parameters are not set;

        * the 'executable' path contains a directory.

     (Contributed by Joannah Nanjekye and Victor Stinner in
     bpo-35537(1).)

   * *note shutil.copyfile(): c4e, *note shutil.copy(): c4f, *note
     shutil.copy2(): c50, *note shutil.copytree(): c1e. and *note
     shutil.move(): c51. use platform-specific "fast-copy" syscalls on
     Linux and macOS in order to copy the file more efficiently.
     "fast-copy" means that the copying operation occurs within the
     kernel, avoiding the use of userspace buffers in Python as in
     "‘outfd.write(infd.read())’".  On Windows *note shutil.copyfile():
     c4e. uses a bigger default buffer size (1 MiB instead of 16 KiB)
     and a *note memoryview(): 165.-based variant of *note
     shutil.copyfileobj(): c52. is used.  The speedup for copying a 512
     MiB file within the same partition is about +26% on Linux, +50% on
     macOS and +40% on Windows.  Also, much less CPU cycles are
     consumed.  See *note プラットフォーム依存の効率的なコピー操作: c53.
     section.  (Contributed by Giampaolo Rodolà in bpo-33671(2).)

   * *note shutil.copytree(): c1e. uses *note os.scandir(): c54.
     function and all copy functions depending from it use cached *note
     os.stat(): 26d. values.  The speedup for copying a directory with
     8000 files is around +9% on Linux, +20% on Windows and +30% on a
     Windows SMB share.  Also the number of *note os.stat(): 26d.
     syscalls is reduced by 38% making *note shutil.copytree(): c1e.
     especially faster on network filesystems.  (Contributed by
     Giampaolo Rodolà in bpo-33695(3).)

   * The default protocol in the *note pickle: ab. module is now
     Protocol 4, first introduced in Python 3.4.  It offers better
     performance and smaller size compared to Protocol 3 available since
     Python 3.0.

   * Removed one *note Py_ssize_t: c55. member from ‘PyGC_Head’.  All GC
     tracked objects (e.g.  tuple, list, dict) size is reduced 4 or 8
     bytes.  (Contributed by Inada Naoki in bpo-33597(4).)

   * *note uuid.UUID: c56. now uses ‘__slots__’ to reduce its memory
     footprint.  (Contributed by Wouter Bolsterlee and Tal Einat in
     bpo-30977(5))

   * Improved performance of *note operator.itemgetter(): c57. by 33%.
     Optimized argument handling and added a fast path for the common
     case of a single non-negative integer index into a tuple (which is
     the typical use case in the standard library).  (Contributed by
     Raymond Hettinger in bpo-35664(6).)

   * Sped-up field lookups in *note collections.namedtuple(): 4e0.  They
     are now more than two times faster, making them the fastest form of
     instance variable lookup in Python.  (Contributed by Raymond
     Hettinger, Pablo Galindo, and Joe Jevnik, Serhiy Storchaka in
     bpo-32492(7).)

   * The *note list: 24d. constructor does not overallocate the internal
     item buffer if the input iterable has a known length (the input
     implements ‘__len__’).  This makes the created list 12% smaller on
     average.  (Contributed by Raymond Hettinger and Pablo Galindo in
     bpo-33234(8).)

   * Doubled the speed of class variable writes.  When a non-dunder
     attribute was updated, there was an unnecessary call to update
     slots.  (Contributed by Stefan Behnel, Pablo Galindo Salgado,
     Raymond Hettinger, Neil Schemenauer, and Serhiy Storchaka in
     bpo-36012(9).)

   * Reduced an overhead of converting arguments passed to many builtin
     functions and methods.  This sped up calling some simple builtin
     functions and methods up to 20-50%.  (Contributed by Serhiy
     Storchaka in bpo-23867(10), bpo-35582(11) and bpo-36127(12).)

   * ‘LOAD_GLOBAL’ instruction now uses new "per opcode cache"
     mechanism.  It is about 40% faster now.  (Contributed by Yury
     Selivanov and Inada Naoki in bpo-26219(13).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35537

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33671

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33695

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33597

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30977

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35664

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32492

   (8) https://bugs.python.org/issue?@action=redirect&bpo=33234

   (9) https://bugs.python.org/issue?@action=redirect&bpo=36012

   (10) https://bugs.python.org/issue?@action=redirect&bpo=23867

   (11) https://bugs.python.org/issue?@action=redirect&bpo=35582

   (12) https://bugs.python.org/issue?@action=redirect&bpo=36127

   (13) https://bugs.python.org/issue?@action=redirect&bpo=26219


File: python.info,  Node: ビルドならびに C API の変更,  Next: 非推奨<9>,  Prev: 最適化<7>,  Up: What's New In Python 3 8

1.7.7 ビルドならびに C API の変更
---------------------------------

   * Default *note sys.abiflags: c59. became an empty string: the ‘m’
     flag for pymalloc became useless (builds with and without pymalloc
     are ABI compatible) and so has been removed.  (Contributed by
     Victor Stinner in bpo-36707(1).)

     Example of changes:

        * Only ‘python3.8’ program is installed, ‘python3.8m’ program is
          gone.

        * Only ‘python3.8-config’ script is installed,
          ‘python3.8m-config’ script is gone.

        * The ‘m’ flag has been removed from the suffix of dynamic
          library filenames: extension modules in the standard library
          as well as those produced and installed by third-party
          packages, like those downloaded from PyPI. On Linux, for
          example, the Python 3.7 suffix
          ‘.cpython-37m-x86_64-linux-gnu.so’ became
          ‘.cpython-38-x86_64-linux-gnu.so’ in Python 3.8.

   * The header files have been reorganized to better separate the
     different kinds of APIs:

        * ‘Include/*.h’ should be the portable public stable C API.

        * ‘Include/cpython/*.h’ should be the unstable C API specific to
          CPython; public API, with some private API prefixed by ‘_Py’
          or ‘_PY’.

        * ‘Include/internal/*.h’ is the private internal C API very
          specific to CPython.  This API comes with no backward
          compatibility warranty and should not be used outside CPython.
          It is only exposed for very specific needs like debuggers and
          profiles which has to access to CPython internals without
          calling functions.  This API is now installed by ‘make
          install’.

     (Contributed by Victor Stinner in bpo-35134(2) and bpo-35081(3),
     work initiated by Eric Snow in Python 3.7.)

   * Some macros have been converted to static inline functions:
     parameter types and return type are well defined, they don't have
     issues specific to macros, variables have a local scopes.
     Examples:

        * *note Py_INCREF(): 78f, *note Py_DECREF(): 790.

        * *note Py_XINCREF(): c5a, *note Py_XDECREF(): 992.

        * ‘PyObject_INIT’, ‘PyObject_INIT_VAR’

        * Private functions: ‘_PyObject_GC_TRACK()’,
          ‘_PyObject_GC_UNTRACK()’, ‘_Py_Dealloc()’

     (Contributed by Victor Stinner in bpo-35059(4).)

   * The ‘PyByteArray_Init()’ and ‘PyByteArray_Fini()’ functions have
     been removed.  They did nothing since Python 2.7.4 and Python
     3.2.0, were excluded from the limited API (stable ABI), and were
     not documented.  (Contributed by Victor Stinner in bpo-35713(5).)

   * The result of *note PyExceptionClass_Name(): c5b. is now of type
     ‘const char *’ rather of ‘char *’.  (Contributed by Serhiy
     Storchaka in bpo-33818(6).)

   * The duality of ‘Modules/Setup.dist’ and ‘Modules/Setup’ has been
     removed.  Previously, when updating the CPython source tree, one
     had to manually copy ‘Modules/Setup.dist’ (inside the source tree)
     to ‘Modules/Setup’ (inside the build tree) in order to reflect any
     changes upstream.  This was of a small benefit to packagers at the
     expense of a frequent annoyance to developers following CPython
     development, as forgetting to copy the file could produce build
     failures.

     Now the build system always reads from ‘Modules/Setup’ inside the
     source tree.  People who want to customize that file are encouraged
     to maintain their changes in a git fork of CPython or as patch
     files, as they would do for any other change to the source tree.

     (Contributed by Antoine Pitrou in bpo-32430(7).)

   * Functions that convert Python number to C integer like *note
     PyLong_AsLong(): 605. and argument parsing functions like *note
     PyArg_ParseTuple(): 3c1. with integer converting format units like
     ‘'i'’ will now use the *note __index__(): 19e. special method
     instead of *note __int__(): 19d, if available.  The deprecation
     warning will be emitted for objects with the ‘__int__()’ method but
     without the ‘__index__()’ method (like *note Decimal: 1fe. and
     *note Fraction: 213.).  *note PyNumber_Check(): c5c. will now
     return ‘1’ for objects implementing ‘__index__()’.  *note
     PyNumber_Long(): c5d, *note PyNumber_Float(): c5e. and *note
     PyFloat_AsDouble(): c5f. also now use the ‘__index__()’ method if
     available.  (Contributed by Serhiy Storchaka in bpo-36048(8) and
     bpo-20092(9).)

   * Heap-allocated type objects will now increase their reference count
     in *note PyObject_Init(): c60. (and its parallel macro
     ‘PyObject_INIT’) instead of in *note PyType_GenericAlloc(): c61.
     Types that modify instance allocation or deallocation may need to
     be adjusted.  (Contributed by Eddie Elizondo in bpo-35810(10).)

   * The new function ‘PyCode_NewWithPosOnlyArgs()’ allows to create
     code objects like ‘PyCode_New()’, but with an extra
     'posonlyargcount' parameter for indicating the number of
     positional-only arguments.  (Contributed by Pablo Galindo in
     bpo-37221(11).)

   * ‘Py_SetPath()’ now sets *note sys.executable: 3ed. to the program
     full path (*note Py_GetProgramFullPath(): 3ec.) rather than to the
     program name (*note Py_GetProgramName(): 3ee.).  (Contributed by
     Victor Stinner in bpo-38234(12).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36707

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35134

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35081

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35059

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35713

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33818

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32430

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36048

   (9) https://bugs.python.org/issue?@action=redirect&bpo=20092

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35810

   (11) https://bugs.python.org/issue?@action=redirect&bpo=37221

   (12) https://bugs.python.org/issue?@action=redirect&bpo=38234


File: python.info,  Node: 非推奨<9>,  Next: API と機能の削除,  Prev: ビルドならびに C API の変更,  Up: What's New In Python 3 8

1.7.8 非推奨
------------

   * The distutils ‘bdist_wininst’ command is now deprecated, use
     ‘bdist_wheel’ (wheel packages) instead.  (Contributed by Victor
     Stinner in bpo-37481(1).)

   * Deprecated methods ‘getchildren()’ and ‘getiterator()’ in the *note
     ElementTree: 12b. module now emit a *note DeprecationWarning: 1a3.
     instead of *note PendingDeprecationWarning: ac5.  They will be
     removed in Python 3.9.  (Contributed by Serhiy Storchaka in
     bpo-29209(2).)

   * Passing an object that is not an instance of *note
     concurrent.futures.ThreadPoolExecutor: 949. to *note
     loop.set_default_executor(): 94a. is deprecated and will be
     prohibited in Python 3.9.  (Contributed by Elvis Pranskevichus in
     bpo-34075(3).)

   * The *note __getitem__(): 588. methods of *note
     xml.dom.pulldom.DOMEventStream: 93e, *note
     wsgiref.util.FileWrapper: 93f. and *note fileinput.FileInput: 940.
     have been deprecated.

     Implementations of these methods have been ignoring their 'index'
     parameter, and returning the next item instead.  (Contributed by
     Berker Peksag in bpo-9372(4).)

   * The *note typing.NamedTuple: 331. class has deprecated the
     ‘_field_types’ attribute in favor of the ‘__annotations__’
     attribute which has the same information.  (Contributed by Raymond
     Hettinger in bpo-36320(5).)

   * *note ast: 9. classes ‘Num’, ‘Str’, ‘Bytes’, ‘NameConstant’ and
     ‘Ellipsis’ are considered deprecated and will be removed in future
     Python versions.  *note Constant: 2ef. should be used instead.
     (Contributed by Serhiy Storchaka in bpo-32892(6).)

   * *note ast.NodeVisitor: 2f0. methods ‘visit_Num()’, ‘visit_Str()’,
     ‘visit_Bytes()’, ‘visit_NameConstant()’ and ‘visit_Ellipsis()’ are
     deprecated now and will not be called in future Python versions.
     Add the *note visit_Constant(): c63. method to handle all constant
     nodes.  (Contributed by Serhiy Storchaka in bpo-36917(7).)

   * The ‘@asyncio.coroutine’ *note decorator: 93a. is deprecated and
     will be removed in version 3.10.  Instead of ‘@asyncio.coroutine’,
     use *note async def: 7ed. instead.  (Contributed by Andrew Svetlov
     in bpo-36921(8).)

   * In *note asyncio: b, the explicit passing of a 'loop' argument has
     been deprecated and will be removed in version 3.10 for the
     following: *note asyncio.sleep(): c64, *note asyncio.gather(): 813,
     *note asyncio.shield(): c65, *note asyncio.wait_for(): 815, *note
     asyncio.wait(): 6a7, *note asyncio.as_completed(): 4c6, *note
     asyncio.Task: 1c7, *note asyncio.Lock: c66, *note asyncio.Event:
     2f4, *note asyncio.Condition: c67, *note asyncio.Semaphore: c68,
     *note asyncio.BoundedSemaphore: c69, *note asyncio.Queue: c6a,
     *note asyncio.create_subprocess_exec(): c6b, and *note
     asyncio.create_subprocess_shell(): c6c.

   * The explicit passing of coroutine objects to *note asyncio.wait():
     6a7. has been deprecated and will be removed in version 3.11.
     (Contributed by Yury Selivanov in bpo-34790(9).)

   * The following functions and methods are deprecated in the *note
     gettext: 67. module: ‘lgettext()’, ‘ldgettext()’, ‘lngettext()’ and
     ‘ldngettext()’.  They return encoded bytes, and it's possible that
     you will get unexpected Unicode-related exceptions if there are
     encoding problems with the translated strings.  It's much better to
     use alternatives which return Unicode strings in Python 3.  These
     functions have been broken for a long time.

     Function ‘bind_textdomain_codeset()’, methods
     ‘NullTranslations.output_charset()’ and
     ‘NullTranslations.set_output_charset()’, and the 'codeset'
     parameter of functions *note translation(): c6d. and *note
     install(): c6e. are also deprecated, since they are only used for
     the ‘l*gettext()’ functions.  (Contributed by Serhiy Storchaka in
     bpo-33710(10).)

   * The ‘isAlive()’ method of *note threading.Thread: 176. has been
     deprecated.  (Contributed by Donghee Na in bpo-35283(11).)

   * Many builtin and extension functions that take integer arguments
     will now emit a deprecation warning for *note Decimal: 1fe.s, *note
     Fraction: 213.s and any other objects that can be converted to
     integers only with a loss (e.g.  that have the *note __int__():
     19d. method but do not have the *note __index__(): 19e. method).
     In future version they will be errors.  (Contributed by Serhiy
     Storchaka in bpo-36048(12).)

   * Deprecated passing the following arguments as keyword arguments:

        - 'func' in *note functools.partialmethod(): 218, *note
          weakref.finalize(): c6f, *note profile.Profile.runcall(): c70,
          ‘cProfile.Profile.runcall()’, *note bdb.Bdb.runcall(): c71,
          *note trace.Trace.runfunc(): c72. and *note curses.wrapper():
          c73.

        - 'function' in *note unittest.TestCase.addCleanup(): c74.

        - 'fn' in the *note submit(): c75. method of *note
          concurrent.futures.ThreadPoolExecutor: 949. and *note
          concurrent.futures.ProcessPoolExecutor: 1d6.

        - 'callback' in *note contextlib.ExitStack.callback(): c76,
          ‘contextlib.AsyncExitStack.callback()’ and *note
          contextlib.AsyncExitStack.push_async_callback(): c77.

        - 'c' and 'typeid' in the ‘create()’ method of
          ‘multiprocessing.managers.Server’ and
          ‘multiprocessing.managers.SharedMemoryServer’.

        - 'obj' in *note weakref.finalize(): c6f.

     In future releases of Python, they will be *note positional-only:
     c78.  (Contributed by Serhiy Storchaka in bpo-36492(13).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37481

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29209

   (3) https://bugs.python.org/issue?@action=redirect&bpo=34075

   (4) https://bugs.python.org/issue?@action=redirect&bpo=9372

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36320

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32892

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36917

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36921

   (9) https://bugs.python.org/issue?@action=redirect&bpo=34790

   (10) https://bugs.python.org/issue?@action=redirect&bpo=33710

   (11) https://bugs.python.org/issue?@action=redirect&bpo=35283

   (12) https://bugs.python.org/issue?@action=redirect&bpo=36048

   (13) https://bugs.python.org/issue?@action=redirect&bpo=36492


File: python.info,  Node: API と機能の削除,  Next: Python 3 8 への移植,  Prev: 非推奨<9>,  Up: What's New In Python 3 8

1.7.9 API と機能の削除
----------------------

The following features and APIs have been removed from Python 3.8:

   * Starting with Python 3.3, importing ABCs from *note collections:
     1e. was deprecated, and importing should be done from *note
     collections.abc: 1f.  Being able to import from collections was
     marked for removal in 3.8, but has been delayed to 3.9.  (See
     gh-81134(1).)

   * The ‘macpath’ module, deprecated in Python 3.7, has been removed.
     (Contributed by Victor Stinner in bpo-35471(2).)

   * The function ‘platform.popen()’ has been removed, after having been
     deprecated since Python 3.3: use *note os.popen(): 31a. instead.
     (Contributed by Victor Stinner in bpo-35345(3).)

   * The function ‘time.clock()’ has been removed, after having been
     deprecated since Python 3.3: use *note time.perf_counter(): c7a. or
     *note time.process_time(): c7b. instead, depending on your
     requirements, to have well-defined behavior.  (Contributed by
     Matthias Bussonnier in bpo-36895(4).)

   * The ‘pyvenv’ script has been removed in favor of ‘python3.8 -m
     venv’ to help eliminate confusion as to what Python interpreter the
     ‘pyvenv’ script is tied to.  (Contributed by Brett Cannon in
     bpo-25427(5).)

   * ‘parse_qs’, ‘parse_qsl’, and ‘escape’ are removed from the ‘cgi’
     module.  They are deprecated in Python 3.2 or older.  They should
     be imported from the ‘urllib.parse’ and ‘html’ modules instead.

   * ‘filemode’ function is removed from the *note tarfile: e4. module.
     It is not documented and deprecated since Python 3.3.

   * The *note XMLParser: c49. constructor no longer accepts the 'html'
     argument.  It never had an effect and was deprecated in Python 3.4.
     All other parameters are now *note keyword-only: 5a5.  (Contributed
     by Serhiy Storchaka in bpo-29209(6).)

   * Removed the ‘doctype()’ method of *note XMLParser: c49.
     (Contributed by Serhiy Storchaka in bpo-29209(7).)

   * "unicode_internal" codec is removed.  (Contributed by Inada Naoki
     in bpo-36297(8).)

   * The ‘Cache’ and ‘Statement’ objects of the *note sqlite3: d4.
     module are not exposed to the user.  (Contributed by Aviv Palivoda
     in bpo-30262(9).)

   * The ‘bufsize’ keyword argument of *note fileinput.input(): a00. and
     *note fileinput.FileInput(): 940. which was ignored and deprecated
     since Python 3.6 has been removed.  bpo-36952(10) (Contributed by
     Matthias Bussonnier.)

   * The functions ‘sys.set_coroutine_wrapper()’ and
     ‘sys.get_coroutine_wrapper()’ deprecated in Python 3.7 have been
     removed; bpo-36933(11) (Contributed by Matthias Bussonnier.)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/81134

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35471

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35345

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36895

   (5) https://bugs.python.org/issue?@action=redirect&bpo=25427

   (6) https://bugs.python.org/issue?@action=redirect&bpo=29209

   (7) https://bugs.python.org/issue?@action=redirect&bpo=29209

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36297

   (9) https://bugs.python.org/issue?@action=redirect&bpo=30262

   (10) https://bugs.python.org/issue?@action=redirect&bpo=36952

   (11) https://bugs.python.org/issue?@action=redirect&bpo=36933


File: python.info,  Node: Python 3 8 への移植,  Next: Python3 8 1 での重要な変更点,  Prev: API と機能の削除,  Up: What's New In Python 3 8

1.7.10 Python 3.8 への移植
--------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

* Menu:

* Python の挙動の変更::
* Python API の変更: Python API の変更<6>.
* C API の変更: C API の変更<10>.
* CPython バイトコードの変更: CPython バイトコードの変更<6>.
* Demos and Tools: Demos and Tools<2>.


File: python.info,  Node: Python の挙動の変更,  Next: Python API の変更<6>,  Up: Python 3 8 への移植

1.7.10.1 Python の挙動の変更
............................

   * Yield expressions (both ‘yield’ and ‘yield from’ clauses) are now
     disallowed in comprehensions and generator expressions (aside from
     the iterable expression in the leftmost ‘for’ clause).
     (Contributed by Serhiy Storchaka in bpo-10544(1).)

   * The compiler now produces a *note SyntaxWarning: 1ae. when identity
     checks (‘is’ and ‘is not’) are used with certain types of literals
     (e.g.  strings, numbers).  These can often work by accident in
     CPython, but are not guaranteed by the language spec.  The warning
     advises users to use equality tests (‘==’ and ‘!=’) instead.
     (Contributed by Serhiy Storchaka in bpo-34850(2).)

   * The CPython interpreter can swallow exceptions in some
     circumstances.  In Python 3.8 this happens in fewer cases.  In
     particular, exceptions raised when getting the attribute from the
     type dictionary are no longer ignored.  (Contributed by Serhiy
     Storchaka in bpo-35459(3).)

   * Removed ‘__str__’ implementations from builtin types *note bool:
     3c3, *note int: 19b, *note float: 196, *note complex: 197. and few
     classes from the standard library.  They now inherit ‘__str__()’
     from *note object: c7e.  As result, defining the ‘__repr__()’
     method in the subclass of these classes will affect their string
     representation.  (Contributed by Serhiy Storchaka in bpo-36793(4).)

   * On AIX, *note sys.platform: 291. doesn't contain the major version
     anymore.  It is always ‘'aix'’, instead of ‘'aix3'’ ..  ‘'aix7'’.
     Since older Python versions include the version number, so it is
     recommended to always use ‘sys.platform.startswith('aix')’.
     (Contributed by M. Felt in bpo-36588(5).)

   * ‘PyEval_AcquireLock()’ and ‘PyEval_AcquireThread()’ now terminate
     the current thread if called while the interpreter is finalizing,
     making them consistent with *note PyEval_RestoreThread(): 648,
     *note Py_END_ALLOW_THREADS(): c7f, and *note PyGILState_Ensure():
     64a.  If this behavior is not desired, guard the call by checking
     ‘_Py_IsFinalizing()’ or *note sys.is_finalizing(): c80.
     (Contributed by Joannah Nanjekye in bpo-36475(6).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10544

   (2) https://bugs.python.org/issue?@action=redirect&bpo=34850

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35459

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36793

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36588

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36475


File: python.info,  Node: Python API の変更<6>,  Next: C API の変更<10>,  Prev: Python の挙動の変更,  Up: Python 3 8 への移植

1.7.10.2 Python API の変更
..........................

   * The *note os.getcwdb(): c82. function now uses the UTF-8 encoding
     on Windows, rather than the ANSI code page: see PEP 529(1) for the
     rationale.  The function is no longer deprecated on Windows.
     (Contributed by Victor Stinner in bpo-37412(2).)

   * *note subprocess.Popen: 4b7. can now use *note os.posix_spawn():
     52e. in some cases for better performance.  On Windows Subsystem
     for Linux and QEMU User Emulation, the *note Popen: 4b7.
     constructor using *note os.posix_spawn(): 52e. no longer raises an
     exception on errors like "missing program".  Instead the child
     process fails with a non-zero *note returncode: c83.  (Contributed
     by Joannah Nanjekye and Victor Stinner in bpo-35537(3).)

   * The 'preexec_fn' argument of * *note subprocess.Popen: 4b7. is no
     longer compatible with subinterpreters.  The use of the parameter
     in a subinterpreter now raises *note RuntimeError: 244.
     (Contributed by Eric Snow in bpo-34651(4), modified by Christian
     Heimes in bpo-37951(5).)

   * The *note imaplib.IMAP4.logout(): c84. method no longer silently
     ignores arbitrary exceptions.  (Contributed by Victor Stinner in
     bpo-36348(6).)

   * The function ‘platform.popen()’ has been removed, after having been
     deprecated since Python 3.3: use *note os.popen(): 31a. instead.
     (Contributed by Victor Stinner in bpo-35345(7).)

   * The *note statistics.mode(): c85. function no longer raises an
     exception when given multimodal data.  Instead, it returns the
     first mode encountered in the input data.  (Contributed by Raymond
     Hettinger in bpo-35892(8).)

   * The *note selection(): c86. method of the *note
     tkinter.ttk.Treeview: c87. class no longer takes arguments.  Using
     it with arguments for changing the selection was deprecated in
     Python 3.6.  Use specialized methods like *note selection_set():
     c88. for changing the selection.  (Contributed by Serhiy Storchaka
     in bpo-31508(9).)

   * The *note writexml(): c89, *note toxml(): c8a. and *note
     toprettyxml(): c8b. methods of *note xml.dom.minidom: 128. and the
     *note write(): c8c. method of *note xml.etree.ElementTree: 12b. now
     preserve the attribute order specified by the user.  (Contributed
     by Diego Rojas and Raymond Hettinger in bpo-34160(10).)

   * A *note dbm.dumb: 36. database opened with flags ‘'r'’ is now
     read-only.  *note dbm.dumb.open(): c8d. with flags ‘'r'’ and ‘'w'’
     no longer creates a database if it does not exist.  (Contributed by
     Serhiy Storchaka in bpo-32749(11).)

   * The ‘doctype()’ method defined in a subclass of *note XMLParser:
     c49. will no longer be called and will emit a *note RuntimeWarning:
     4d7. instead of a *note DeprecationWarning: 1a3.  Define the *note
     doctype(): c8e. method on a target for handling an XML doctype
     declaration.  (Contributed by Serhiy Storchaka in bpo-29209(12).)

   * A *note RuntimeError: 244. is now raised when the custom metaclass
     doesn't provide the ‘__classcell__’ entry in the namespace passed
     to ‘type.__new__’.  A *note DeprecationWarning: 1a3. was emitted in
     Python 3.6-3.7.  (Contributed by Serhiy Storchaka in
     bpo-23722(13).)

   * The *note cProfile.Profile: bd6. class can now be used as a context
     manager.  (Contributed by Scott Sanderson in bpo-29235(14).)

   * *note shutil.copyfile(): c4e, *note shutil.copy(): c4f, *note
     shutil.copy2(): c50, *note shutil.copytree(): c1e. and *note
     shutil.move(): c51. use platform-specific "fast-copy" syscalls (see
     *note プラットフォーム依存の効率的なコピー操作: c53. section).

   * *note shutil.copyfile(): c4e. default buffer size on Windows was
     changed from 16 KiB to 1 MiB.

   * The ‘PyGC_Head’ struct has changed completely.  All code that
     touched the struct member should be rewritten.  (See
     bpo-33597(15).)

   * The *note PyInterpreterState: aba. struct has been moved into the
     "internal" header files (specifically
     Include/internal/pycore_pystate.h).  An opaque ‘PyInterpreterState’
     is still available as part of the public API (and stable ABI). The
     docs indicate that none of the struct's fields are public, so we
     hope no one has been using them.  However, if you do rely on one or
     more of those private fields and have no alternative then please
     open a BPO issue.  We'll work on helping you adjust (possibly
     including adding accessor functions to the public API). (See
     bpo-35886(16).)

   * The *note mmap.flush(): c8f. method now returns ‘None’ on success
     and raises an exception on error under all platforms.  Previously,
     its behavior was platform-dependent: a nonzero value was returned
     on success; zero was returned on error under Windows.  A zero value
     was returned on success; an exception was raised on error under
     Unix.  (Contributed by Berker Peksag in bpo-2122(17).)

   * *note xml.dom.minidom: 128. and *note xml.sax: 12f. modules no
     longer process external entities by default.  (Contributed by
     Christian Heimes in bpo-17239(18).)

   * Deleting a key from a read-only *note dbm: 35. database (*note
     dbm.dumb: 36, *note dbm.gnu: 37. or *note dbm.ndbm: 38.) raises
     ‘error’ (*note dbm.dumb.error: c90, *note dbm.gnu.error: c91. or
     *note dbm.ndbm.error: c92.) instead of *note KeyError: 5e7.
     (Contributed by Xiang Zhang in bpo-33106(19).)

   * Simplified AST for literals.  All constants will be represented as
     *note ast.Constant: 2ef. instances.  Instantiating old classes
     ‘Num’, ‘Str’, ‘Bytes’, ‘NameConstant’ and ‘Ellipsis’ will return an
     instance of ‘Constant’.  (Contributed by Serhiy Storchaka in
     bpo-32892(20).)

   * *note expanduser(): c09. on Windows now prefers the ‘USERPROFILE’
     environment variable and does not use ‘HOME’, which is not normally
     set for regular user accounts.  (Contributed by Anthony Sottile in
     bpo-36264(21).)

   * The exception *note asyncio.CancelledError: 4d4. now inherits from
     *note BaseException: 7d6. rather than *note Exception: bcd. and no
     longer inherits from *note concurrent.futures.CancelledError: bce.
     (Contributed by Yury Selivanov in bpo-32528(22).)

   * The function *note asyncio.wait_for(): 815. now correctly waits for
     cancellation when using an instance of *note asyncio.Task: 1c7.
     Previously, upon reaching 'timeout', it was cancelled and
     immediately returned.  (Contributed by Elvis Pranskevichus in
     bpo-32751(23).)

   * The function *note asyncio.BaseTransport.get_extra_info(): c93. now
     returns a safe to use socket object when 'socket' is passed to the
     'name' parameter.  (Contributed by Yury Selivanov in
     bpo-37027(24).)

   * *note asyncio.BufferedProtocol: c94. has graduated to the stable
     API.

   * DLL dependencies for extension modules and DLLs loaded with *note
     ctypes: 2e. on Windows are now resolved more securely.  Only the
     system paths, the directory containing the DLL or PYD file, and
     directories added with *note add_dll_directory(): bdd. are searched
     for load-time dependencies.  Specifically, ‘PATH’ and the current
     working directory are no longer used, and modifications to these
     will no longer have any effect on normal DLL resolution.  If your
     application relies on these mechanisms, you should check for *note
     add_dll_directory(): bdd. and if it exists, use it to add your DLLs
     directory while loading your library.  Note that Windows 7 users
     will need to ensure that Windows Update KB2533623 has been
     installed (this is also verified by the installer).  (Contributed
     by Steve Dower in bpo-36085(25).)

   * The header files and functions related to pgen have been removed
     after its replacement by a pure Python implementation.
     (Contributed by Pablo Galindo in bpo-36623(26).)

   * *note types.CodeType: 32f. has a new parameter in the second
     position of the constructor ('posonlyargcount') to support
     positional-only arguments defined in PEP 570(27).  The first
     argument ('argcount') now represents the total number of positional
     arguments (including positional-only arguments).  The new
     ‘replace()’ method of *note types.CodeType: 32f. can be used to
     make the code future-proof.

   * The parameter ‘digestmod’ for *note hmac.new(): c96. no longer uses
     the MD5 digest by default.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0529/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=37412

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35537

   (4) https://bugs.python.org/issue?@action=redirect&bpo=34651

   (5) https://bugs.python.org/issue?@action=redirect&bpo=37951

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36348

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35345

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35892

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31508

   (10) https://bugs.python.org/issue?@action=redirect&bpo=34160

   (11) https://bugs.python.org/issue?@action=redirect&bpo=32749

   (12) https://bugs.python.org/issue?@action=redirect&bpo=29209

   (13) https://bugs.python.org/issue?@action=redirect&bpo=23722

   (14) https://bugs.python.org/issue?@action=redirect&bpo=29235

   (15) https://bugs.python.org/issue?@action=redirect&bpo=33597

   (16) https://bugs.python.org/issue?@action=redirect&bpo=35886

   (17) https://bugs.python.org/issue?@action=redirect&bpo=2122

   (18) https://bugs.python.org/issue?@action=redirect&bpo=17239

   (19) https://bugs.python.org/issue?@action=redirect&bpo=33106

   (20) https://bugs.python.org/issue?@action=redirect&bpo=32892

   (21) https://bugs.python.org/issue?@action=redirect&bpo=36264

   (22) https://bugs.python.org/issue?@action=redirect&bpo=32528

   (23) https://bugs.python.org/issue?@action=redirect&bpo=32751

   (24) https://bugs.python.org/issue?@action=redirect&bpo=37027

   (25) https://bugs.python.org/issue?@action=redirect&bpo=36085

   (26) https://bugs.python.org/issue?@action=redirect&bpo=36623

   (27) https://peps.python.org/pep-0570/


File: python.info,  Node: C API の変更<10>,  Next: CPython バイトコードの変更<6>,  Prev: Python API の変更<6>,  Up: Python 3 8 への移植

1.7.10.3 C API の変更
.....................

   * The *note PyCompilerFlags: c98. structure got a new
     'cf_feature_version' field.  It should be initialized to
     ‘PY_MINOR_VERSION’.  The field is ignored by default, and is used
     if and only if ‘PyCF_ONLY_AST’ flag is set in 'cf_flags'.
     (Contributed by Guido van Rossum in bpo-35766(1).)

   * The ‘PyEval_ReInitThreads()’ function has been removed from the C
     API. It should not be called explicitly: use *note
     PyOS_AfterFork_Child(): 430. instead.  (Contributed by Victor
     Stinner in bpo-36728(2).)

   * On Unix, C extensions are no longer linked to libpython except on
     Android and Cygwin.  When Python is embedded, ‘libpython’ must not
     be loaded with ‘RTLD_LOCAL’, but ‘RTLD_GLOBAL’ instead.
     Previously, using ‘RTLD_LOCAL’, it was already not possible to load
     C extensions which were not linked to ‘libpython’, like C
     extensions of the standard library built by the ‘*shared*’ section
     of ‘Modules/Setup’.  (Contributed by Victor Stinner in
     bpo-21536(3).)

   * Use of ‘#’ variants of formats in parsing or building value (e.g.
     *note PyArg_ParseTuple(): 3c1, *note Py_BuildValue(): 3c2, *note
     PyObject_CallFunction(): 63f, etc.)  without ‘PY_SSIZE_T_CLEAN’
     defined raises ‘DeprecationWarning’ now.  It will be removed in
     3.10 or 4.0.  Read *note 引数の解釈と値の構築: 3d5. for detail.
     (Contributed by Inada Naoki in bpo-36381(4).)

   * Instances of heap-allocated types (such as those created with *note
     PyType_FromSpec(): 79d.) hold a reference to their type object.
     Increasing the reference count of these type objects has been moved
     from *note PyType_GenericAlloc(): c61. to the more low-level
     functions, *note PyObject_Init(): c60. and ‘PyObject_INIT’.  This
     makes types created through *note PyType_FromSpec(): 79d. behave
     like other classes in managed code.

     *note Statically allocated types: 983. are not affected.

     For the vast majority of cases, there should be no side effect.
     However, types that manually increase the reference count after
     allocating an instance (perhaps to work around the bug) may now
     become immortal.  To avoid this, these classes need to call
     Py_DECREF on the type object during instance deallocation.

     To correctly port these types into 3.8, please apply the following
     changes:

        * Remove *note Py_INCREF: 78f. on the type object after
          allocating an instance - if any.  This may happen after
          calling *note PyObject_New: b7c, *note PyObject_NewVar: b7d,
          *note PyObject_GC_New(): c99, *note PyObject_GC_NewVar(): c9a,
          or any other custom allocator that uses *note PyObject_Init():
          c60. or ‘PyObject_INIT’.

          例:

               static foo_struct *
               foo_new(PyObject *type) {
                   foo_struct *foo = PyObject_GC_New(foo_struct, (PyTypeObject *) type);
                   if (foo == NULL)
                       return NULL;
               #if PY_VERSION_HEX < 0x03080000
                   // Workaround for Python issue 35810; no longer necessary in Python 3.8
                   PY_INCREF(type)
               #endif
                   return foo;
               }

        * Ensure that all custom ‘tp_dealloc’ functions of
          heap-allocated types decrease the type's reference count.

          例:

               static void
               foo_dealloc(foo_struct *instance) {
                   PyObject *type = Py_TYPE(instance);
                   PyObject_GC_Del(instance);
               #if PY_VERSION_HEX >= 0x03080000
                   // This was not needed before Python 3.8 (Python issue 35810)
                   Py_DECREF(type);
               #endif
               }

     (Contributed by Eddie Elizondo in bpo-35810(5).)

   * The *note Py_DEPRECATED(): c9b. macro has been implemented for
     MSVC.  The macro now must be placed before the symbol name.

     例:

          Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);

     (Contributed by Zackery Spytz in bpo-33407(6).)

   * The interpreter does not pretend to support binary compatibility of
     extension types across feature releases, anymore.  A *note
     PyTypeObject: c9c. exported by a third-party extension module is
     supposed to have all the slots expected in the current Python
     version, including *note tp_finalize: c9d. (*note
     Py_TPFLAGS_HAVE_FINALIZE: 427. is not checked anymore before
     reading *note tp_finalize: c9d.).

     (Contributed by Antoine Pitrou in bpo-32388(7).)

   * The functions ‘PyNode_AddChild()’ and ‘PyParser_AddToken()’ now
     accept two additional ‘int’ arguments 'end_lineno' and
     'end_col_offset'.

   * The ‘libpython38.a’ file to allow MinGW tools to link directly
     against ‘python38.dll’ is no longer included in the regular Windows
     distribution.  If you require this file, it may be generated with
     the ‘gendef’ and ‘dlltool’ tools, which are part of the MinGW
     binutils package:

          gendef - python38.dll > tmp.def
          dlltool --dllname python38.dll --def tmp.def --output-lib libpython38.a

     The location of an installed ‘pythonXY.dll’ will depend on the
     installation options and the version and language of Windows.  See
     *note Windows で Python を使う: c9e. for more information.  The
     resulting library should be placed in the same directory as
     ‘pythonXY.lib’, which is generally the ‘libs’ directory under your
     Python installation.

     (Contributed by Steve Dower in bpo-37351(8).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35766

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36728

   (3) https://bugs.python.org/issue?@action=redirect&bpo=21536

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36381

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35810

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33407

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32388

   (8) https://bugs.python.org/issue?@action=redirect&bpo=37351


File: python.info,  Node: CPython バイトコードの変更<6>,  Next: Demos and Tools<2>,  Prev: C API の変更<10>,  Up: Python 3 8 への移植

1.7.10.4 CPython バイトコードの変更
...................................

   * The interpreter loop has been simplified by moving the logic of
     unrolling the stack of blocks into the compiler.  The compiler
     emits now explicit instructions for adjusting the stack of values
     and calling the cleaning-up code for *note break: 17f, *note
     continue: 180. and *note return: 1af.

     Removed opcodes ‘BREAK_LOOP’, ‘CONTINUE_LOOP’, ‘SETUP_LOOP’ and
     ‘SETUP_EXCEPT’.  Added new opcodes ‘ROT_FOUR’, ‘BEGIN_FINALLY’,
     ‘CALL_FINALLY’ and ‘POP_FINALLY’.  Changed the behavior of
     ‘END_FINALLY’ and ‘WITH_CLEANUP_START’.

     (Contributed by Mark Shannon, Antoine Pitrou and Serhiy Storchaka
     in bpo-17611(1).)

   * Added new opcode *note END_ASYNC_FOR: ca0. for handling exceptions
     raised when awaiting a next item in an *note async for: ca1. loop.
     (Contributed by Serhiy Storchaka in bpo-33041(2).)

   * The *note MAP_ADD: ca2. now expects the value as the first element
     in the stack and the key as the second element.  This change was
     made so the key is always evaluated before the value in dictionary
     comprehensions, as proposed by PEP 572(3).  (Contributed by Jörn
     Heissler in bpo-35224(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17611

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33041

   (3) https://peps.python.org/pep-0572/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35224


File: python.info,  Node: Demos and Tools<2>,  Prev: CPython バイトコードの変更<6>,  Up: Python 3 8 への移植

1.7.10.5 Demos and Tools
........................

Added a benchmark script for timing various ways to access variables:
‘Tools/scripts/var_access_benchmark.py’.  (Contributed by Raymond
Hettinger in bpo-35884(1).)

Here's a summary of performance improvements since Python 3.3:

     Python version                       3.3     3.4     3.5     3.6     3.7     3.8
     --------------                       ---     ---     ---     ---     ---     ---

     Variable and attribute read access:
         read_local                       4.0     7.1     7.1     5.4     5.1     3.9
         read_nonlocal                    5.3     7.1     8.1     5.8     5.4     4.4
         read_global                     13.3    15.5    19.0    14.3    13.6     7.6
         read_builtin                    20.0    21.1    21.6    18.5    19.0     7.5
         read_classvar_from_class        20.5    25.6    26.5    20.7    19.5    18.4
         read_classvar_from_instance     18.5    22.8    23.5    18.8    17.1    16.4
         read_instancevar                26.8    32.4    33.1    28.0    26.3    25.4
         read_instancevar_slots          23.7    27.8    31.3    20.8    20.8    20.2
         read_namedtuple                 68.5    73.8    57.5    45.0    46.8    18.4
         read_boundmethod                29.8    37.6    37.9    29.6    26.9    27.7

     Variable and attribute write access:
         write_local                      4.6     8.7     9.3     5.5     5.3     4.3
         write_nonlocal                   7.3    10.5    11.1     5.6     5.5     4.7
         write_global                    15.9    19.7    21.2    18.0    18.0    15.8
         write_classvar                  81.9    92.9    96.0   104.6   102.1    39.2
         write_instancevar               36.4    44.6    45.8    40.0    38.9    35.5
         write_instancevar_slots         28.7    35.6    36.1    27.3    26.6    25.7

     Data structure read access:
         read_list                       19.2    24.2    24.5    20.8    20.8    19.0
         read_deque                      19.9    24.7    25.5    20.2    20.6    19.8
         read_dict                       19.7    24.3    25.7    22.3    23.0    21.0
         read_strdict                    17.9    22.6    24.3    19.5    21.2    18.9

     Data structure write access:
         write_list                      21.2    27.1    28.5    22.5    21.6    20.0
         write_deque                     23.8    28.7    30.1    22.7    21.8    23.5
         write_dict                      25.9    31.4    33.3    29.3    29.2    24.7
         write_strdict                   22.9    28.4    29.9    27.5    25.2    23.1

     Stack (or queue) operations:
         list_append_pop                144.2    93.4   112.7    75.4    74.2    50.8
         deque_append_pop                30.4    43.5    57.0    49.4    49.2    42.5
         deque_append_popleft            30.8    43.7    57.3    49.7    49.7    42.8

     Timing loop:
         loop_overhead                    0.3     0.5     0.6     0.4     0.3     0.3

The benchmarks were measured on an Intel® Core™ i7-4960HQ processor(2)
running the macOS 64-bit builds found at python.org(3).  The benchmark
script displays timings in nanoseconds.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35884

   (2) 
https://ark.intel.com/content/www/us/en/ark/products/76088/intel-core-i7-4960hq-processor-6m-cache-up-to-3-80-ghz.html

   (3) https://www.python.org/downloads/macos/


File: python.info,  Node: Python3 8 1 での重要な変更点,  Next: Python3 8 2 での重要な変更点,  Prev: Python 3 8 への移植,  Up: What's New In Python 3 8

1.7.11 Python3.8.1 での重要な変更点
-----------------------------------

セキュリティ上の重大な懸念により、*note
asyncio.loop.create_datagram_endpoint(): 93c. での 'reuse_address' 引数
は無効になりました。これはソケットオプション ‘SO_REUSEADDR'’ のUDP にお
ける挙動が原因です。詳しくは、‘loop.create_datagram_endpoint()’ のドキュ
メントを参照してください。(Kyle Stanley, Antoine Pitrou, Yury Selivanov
による貢献 bpo-37228(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37228


File: python.info,  Node: Python3 8 2 での重要な変更点,  Next: Notable changes in Python 3 8 3,  Prev: Python3 8 1 での重要な変更点,  Up: What's New In Python 3 8

1.7.12 Python3.8.2 での重要な変更点
-----------------------------------

Fixed a regression with the ‘ignore’ callback of *note
shutil.copytree(): c1e.  The argument types are now str and List[str]
again.  (Contributed by Manuel Barkhau and Giampaolo Rodola in
gh-83571(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/83571


File: python.info,  Node: Notable changes in Python 3 8 3,  Next: Python3 8 8 での重要な変更点,  Prev: Python3 8 2 での重要な変更点,  Up: What's New In Python 3 8

1.7.13 Notable changes in Python 3.8.3
--------------------------------------

The constant values of future flags in the *note __future__: 0. module
are updated in order to prevent collision with compiler flags.
Previously ‘PyCF_ALLOW_TOP_LEVEL_AWAIT’ was clashing with
‘CO_FUTURE_DIVISION’.  (Contributed by Batuhan Taskaya in gh-83743(1))

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/83743


File: python.info,  Node: Python3 8 8 での重要な変更点,  Next: Notable changes in Python 3 8 9,  Prev: Notable changes in Python 3 8 3,  Up: What's New In Python 3 8

1.7.14 Python3.8.8 での重要な変更点
-----------------------------------

Earlier Python versions allowed using both ‘;’ and ‘&’ as query
parameter separators in *note urllib.parse.parse_qs(): 31f. and *note
urllib.parse.parse_qsl(): 31e.  Due to security concerns, and to conform
with newer W3C recommendations, this has been changed to allow only a
single separator key, with ‘&’ as the default.  This change also affects
‘cgi.parse()’ and ‘cgi.parse_multipart()’ as they use the affected
functions internally.  For more details, please see their respective
documentation.  (Contributed by Adam Goldschmidt, Senthil Kumaran and
Ken Jin in bpo-42967(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42967


File: python.info,  Node: Notable changes in Python 3 8 9,  Next: Notable changes in Python 3 8 10,  Prev: Python3 8 8 での重要な変更点,  Up: What's New In Python 3 8

1.7.15 Notable changes in Python 3.8.9
--------------------------------------

A security fix alters the *note ftplib.FTP: af6. behavior to not trust
the IPv4 address sent from the remote server when setting up a passive
data channel.  We reuse the ftp server IP address instead.  For unusual
code requiring the old behavior, set a ‘trust_server_pasv_ipv4_address’
attribute on your FTP instance to ‘True’.  (See gh-87451(1))

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/87451


File: python.info,  Node: Notable changes in Python 3 8 10,  Next: Notable changes in Python 3 8 10<2>,  Prev: Notable changes in Python 3 8 9,  Up: What's New In Python 3 8

1.7.16 Notable changes in Python 3.8.10
---------------------------------------

* Menu:

* macOS 11.0 (Big Sur) と Appleシリコンの Mac のサポート: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート<2>.


File: python.info,  Node: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート<2>,  Up: Notable changes in Python 3 8 10

1.7.16.1 macOS 11.0 (Big Sur) と Appleシリコンの Mac のサポート
...............................................................

As of 3.8.10, Python now supports building and running on macOS 11 (Big
Sur) and on Apple Silicon Macs (based on the ‘ARM64’ architecture).  A
new universal build variant, ‘universal2’, is now available to natively
support both ‘ARM64’ and ‘Intel 64’ in one set of executables.  Note
that support for "weaklinking", building binaries targeted for newer
versions of macOS that will also run correctly on older versions by
testing at runtime for missing features, is not included in this
backport from Python 3.9; to support a range of macOS versions, continue
to target for and build on the oldest version in the range.

(Originally contributed by Ronald Oussoren and Lawrence D'Anna in
gh-85272(1), with fixes by FX Coudert and Eli Rykoff, and backported to
3.8 by Maxime Bélanger and Ned Deily)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/85272


File: python.info,  Node: Notable changes in Python 3 8 10<2>,  Next: Notable changes in Python 3 8 12,  Prev: Notable changes in Python 3 8 10,  Up: What's New In Python 3 8

1.7.17 Notable changes in Python 3.8.10
---------------------------------------

* Menu:

* urllib.parse: urllib parse<4>.


File: python.info,  Node: urllib parse<4>,  Up: Notable changes in Python 3 8 10<2>

1.7.17.1 urllib.parse
.....................

The presence of newline or tab characters in parts of a URL allows for
some forms of attacks.  Following the WHATWG specification that updates
RFC 3986(1), ASCII newline ‘\n’, ‘\r’ and tab ‘\t’ characters are
stripped from the URL by the parser in *note urllib.parse: 110.
preventing such attacks.  The removal characters are controlled by a new
module level variable ‘urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE’.  (See
bpo-43882(2))

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc3986.html

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43882


File: python.info,  Node: Notable changes in Python 3 8 12,  Next: Notable security feature in 3 8 14,  Prev: Notable changes in Python 3 8 10<2>,  Up: What's New In Python 3 8

1.7.18 Notable changes in Python 3.8.12
---------------------------------------

* Menu:

* Python API の変更: Python API の変更<7>.


File: python.info,  Node: Python API の変更<7>,  Up: Notable changes in Python 3 8 12

1.7.18.1 Python API の変更
..........................

Starting with Python 3.8.12 the *note ipaddress: 84. module no longer
accepts any leading zeros in IPv4 address strings.  Leading zeros are
ambiguous and interpreted as octal notation by some libraries.  For
example the legacy function *note socket.inet_aton(): b5a. treats
leading zeros as octal notation.  glibc implementation of modern *note
inet_pton(): b5b. does not accept any leading zeros.

(Originally contributed by Christian Heimes in bpo-36384(1), and
backported to 3.8 by Achraf Merzouki.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36384


File: python.info,  Node: Notable security feature in 3 8 14,  Next: Notable changes in 3 8 17,  Prev: Notable changes in Python 3 8 12,  Up: What's New In Python 3 8

1.7.19 Notable security feature in 3.8.14
-----------------------------------------

Converting between *note int: 19b. and *note str: 169. in bases other
than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10
(decimal) now raises a *note ValueError: 2ec. if the number of digits in
string form is above a limit to avoid potential denial of service
attacks due to the algorithmic complexity.  This is a mitigation for CVE
2020-10735(1).  This limit can be configured or disabled by environment
variable, command line flag, or *note sys: df. APIs.  See the *note
integer string conversion length limitation: 80b. documentation.  The
default limit is 4300 digits in string form.

   ---------- Footnotes ----------

   (1) https://www.cve.org/CVERecord?id=CVE-2020-10735


File: python.info,  Node: Notable changes in 3 8 17,  Prev: Notable security feature in 3 8 14,  Up: What's New In Python 3 8

1.7.20 Notable changes in 3.8.17
--------------------------------

* Menu:

* tarfile: tarfile<6>.


File: python.info,  Node: tarfile<6>,  Up: Notable changes in 3 8 17

1.7.20.1 tarfile
................

   * The extraction methods in *note tarfile: e4, and *note
     shutil.unpack_archive(): 696, have a new a 'filter' argument that
     allows limiting tar features than may be surprising or dangerous,
     such as creating files outside the destination directory.  See
     *note Extraction filters: 697. for details.  In Python 3.12, use
     without the 'filter' argument will show a *note DeprecationWarning:
     1a3.  In Python 3.14, the default will switch to ‘'data'’.
     (Contributed by Petr Viktorin in PEP 706(1).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0706/


File: python.info,  Node: What's New In Python 3 7,  Next: What's New In Python 3 6,  Prev: What's New In Python 3 8,  Up: What's New in Python

1.8 What's New In Python 3.7
============================


編集者: Elvis Pranskevichus <<elvis@magic.io>>

この記事では Python 3.6 と比較した Python 3.7 の新機能を解説します。
Python 3.7 は2018年6月27日にリリースされました。全詳細については *note
変更履歴: 142. をご覧ください。

* Menu:

* 概要: 概要 -- リリースハイライト<8>. リリースハイライト
* 新しい機能: 新しい機能<13>.
* その他の言語変更: その他の言語変更<7>.
* 新たなモジュール: 新たなモジュール<7>.
* 改良されたモジュール: 改良されたモジュール<7>.
* C API の変更: C API の変更<11>.
* Build Changes: Build Changes<6>.
* 最適化: 最適化<8>.
* その他の CPython の実装の変更: その他の CPython の実装の変更<2>.
* 非推奨の Python の挙動::
* 非推奨の Python モジュール、関数、メソッド::
* C API の非推奨の関数ならびに型::
* サポート対象プラットフォームからの除外::
* API と機能の削除: API と機能の削除<2>.
* Module Removals::
* Windows-only Changes::
* Python 3.7 への移植: Python 3 7 への移植.
* Python 3.7.1 での重要な変更点: Python 3 7 1 での重要な変更点.
* Python 3.7.2 での重要な変更点: Python 3 7 2 での重要な変更点.
* Python 3.7.6 での重要な変更点: Python 3 7 6 での重要な変更点.
* Python 3.7.10 での重要な変更点: Python 3 7 10 での重要な変更点.
* Notable changes in Python 3.7.11: Notable changes in Python 3 7 11.
* Notable security feature in 3.7.14: Notable security feature in 3 7 14.


File: python.info,  Node: 概要 -- リリースハイライト<8>,  Next: 新しい機能<13>,  Up: What's New In Python 3 7

1.8.1 概要 - リリースハイライト
-------------------------------

新たな文法機能:

   * *note PEP 563: cb6. 、型アノテーションの評価の遅延。

後方非互換な文法の変更:

   * *note async: 93b. と *note await: 18d. は予約されたキーワードになり
     ました。

新たなライブラリモジュール:

   * *note contextvars: 28.: *note PEP 567 - コンテキスト変数: cb7.

   * *note dataclasses: 33.: *note PEP 557 - データクラス: cb8.

   * *note importlib.resources: cb9.

新たな組み込み機能:

   * *note PEP 553: cba. 、新しい *note breakpoint(): 271. 関数。

Python のデータモデルの改善:

   * *note PEP 562: cbb. 、モジュール属性へのアクセスのカスタマイズ。

   * *note PEP 560: cbc. 、typing モジュールとジェネリック型に対する言語
     コアによるサポート。

   * *note dict: cbd. オブジェクトの挿入順序を保存するという性質が、公式
     に Python 言語仕様の一部であると 宣言されました(1) 。

標準ライブラリーの顕著な改善

   * *note asyncio: b. モジュールに新しい機能が加わりました。 顕著な
     *note 使い勝手とパフォーマンスの改善: cbe. です。

   * *note time: f4. モジュールが *note ナノ秒単位の分解能を持つ関数:
     cbf. をサポートするようになりました。

CPython の実装の改善:

   * デフォルトのテキストエンコーディングとして ASCII を使わなくなりまし
     た:

        * *note PEP 538: cc0. 、レガシーな C ロケールの抑圧

        * *note PEP 540: cc1, UTF-8 実行時モードの強制

   * *note PEP 552: cc2. 、決定論的な .pyc

   * *note New Python Development Mode: cc3.

   * *note PEP 565: cc4. 、 *note DeprecationWarning: 1a3. の取り扱いの
     改善

C API の改善:

   * *note PEP 539: cc5. 、スレッドローカルなストレージのための新しい C
     API

ドキュメントの改善:

   * *note PEP 545: cc6. 、 Python ドキュメント翻訳

   * 新しいドキュメント翻訳: 日本語(2) 、 フランス語(3) 、 韓国語(4) 。

このリリースの特色は、多くの領域での特筆すべきパフォーマンスの改善です。
*note 最適化: cc7. 節に詳細な一覧があります。

1つ前にリリースされた Python との互換性に影響を持つ変更の一覧については
、 *note Python 3.7 への移植: cc8. 節を参照してください。

   ---------- Footnotes ----------

   (1) hasbeendeclared

   (2) https://docs.python.org/ja/

   (3) https://docs.python.org/fr/

   (4) https://docs.python.org/ko/


File: python.info,  Node: 新しい機能<13>,  Next: その他の言語変更<7>,  Prev: 概要 -- リリースハイライト<8>,  Up: What's New In Python 3 7

1.8.2 新しい機能
----------------

* Menu:

* PEP 563; アノテーションの遅延評価: PEP 563 アノテーションの遅延評価.
* PEP 538; レガシーな C ロケールの抑圧: PEP 538 レガシーな C ロケールの抑圧.
* PEP 540; 強制 UTF-8 実行モード: PEP 540 強制 UTF-8 実行モード.
* PEP 553; 組み込みの breakpoint(): PEP 553 組み込みの breakpoint.
* PEP 539; スレッドローカルストレージのための新しい C API: PEP 539 スレッドローカルストレージのための新しい C API.
* PEP 562; モジュール属性へのアクセスのカスタマイズ: PEP 562 モジュール属性へのアクセスのカスタマイズ.
* PEP 564; ナノ秒単位の分解能を持つ新しい時間関数: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数.
* PEP 565; Show DeprecationWarning in __main__: PEP 565 Show DeprecationWarning in __main__.
* PEP 560; typing モジュールとジェネリック型に対する言語コアによるサポート: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート.
* PEP 552; Hash-based .pyc Files: PEP 552 Hash-based pyc Files.
* PEP 545; Python Documentation Translations: PEP 545 Python Documentation Translations.
* Python Development Mode (-X dev): Python Development Mode -X dev.


File: python.info,  Node: PEP 563 アノテーションの遅延評価,  Next: PEP 538 レガシーな C ロケールの抑圧,  Up: 新しい機能<13>

1.8.2.1 PEP 563: アノテーションの遅延評価
.........................................

Python における型ヒントの到来により、 PEP 3107(1) で追加され PEP 526(2)
でさらに改善されたアノテーションの機能について、使い勝手に関する 2 つの
明白な問題が明らかになりました:

   * アノテーションには現在のスコープで既に使える状態になっている名前し
     か使えない。言い換えれば、どんな種類の前方参照もサポートしない。

   * ソースコードに注釈を付けるのは Python プログラムの起動時間に好まし
     くない影響がある。

これらの問題はどちらもアノテーションの評価を遅延することで解決します。 ア
ノテーションの定義時に、アノテーションに含まれる式を評価するコードをコン
パイルする代わりに、コンパイラは当該の式の AST と同等な文字列形式でアノ
テーションを保存します。 必要であれば、 *note typing.get_type_hints():
8c0. を使って実行時にアノテーションを解決できます。 たいていのケースでは
その必要は無く、(短い文字列はインタプリタによって格納されるので) アノテ
ーションを保存するコストはより安くなり、起動時間がより速くなります。

使い勝手の点では、アノテーションは前方参照をサポートするようになり、次の
文法が妥当なものになりました:

     class C:
         @classmethod
         def from_string(cls, source: str) -> C:
             ...

         def validate_b(self, obj: B) -> bool:
             ...

     class B:
         ...

この変更は後方互換性を壊してしまうので、新しい振る舞いは Python 3.7 では
*note __future__: 0. インポートを使いモジュールごとに有効化する必要があ
ります:

     from __future__ import annotations

この振る舞いは Python 3.10 でデフォルトになります。

参考
....

PEP 563(3) - アノテーションの遅延評価

     PEP written and implemented by Łukasz Langa.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3107/

   (2) https://peps.python.org/pep-0526/

   (3) https://peps.python.org/pep-0563/


File: python.info,  Node: PEP 538 レガシーな C ロケールの抑圧,  Next: PEP 540 強制 UTF-8 実行モード,  Prev: PEP 563 アノテーションの遅延評価,  Up: 新しい機能<13>

1.8.2.2 PEP 538: レガシーな C ロケールの抑圧
............................................

Python 3 シリーズにおける継続中の課題の一つは、非 Windows プラットフォー
ムではデフォルトの C ロケールつまり POSIX ロケールの使用から現在のところ
必然的に導かれてしまう "7-bit ASCII" テキストエンコーディングの仮定を取
り扱う賢明なデフォルトの方針を決定することです。

PEP 538(1) はインタープリタのデフォルトのコマンドラインインターフェース
を更新し、新しく加わった *note PYTHONCOERCECLOCALE: ccc. 環境変数のドキ
ュメントにある通り、自動的にロケールを UTF-8 に基づいた利用可能なロケー
ルへ強制します。 この方法で ‘LC_CTYPE’ を自動的に設定すると、コアのイン
タープリタと (*note readline: bf. などの) ロケールを考慮する C 拡張はデ
フォルトのテキストエンコーディングとして ASCII ではなく UTF-8 を使うこと
になります。

PEP 11(2) にあるプラットフォームのサポート定義も、適切に設定された非
ASCII に基づくロケールだけにテキスト処理の完全なサポートを制限するよう更
新されました。

この変更の一部として、強制対象として定義されたのロケール (現時点では
‘C.UTF-8’, ‘C.utf8’, ‘UTF-8’) を使っているときの *note stdin: 75f. と
*note stdout: ccd. のデフォルトのエラーハンドラは (‘strict’ ではなく)
‘surrogateescape’ になります。 *note stderr: b33. のデフォルトのエラーハ
ンドラは、ロケールに関係無く引き続き ‘backslashreplace’ です。

デフォルトではロケールの強制は暗黙に行われますが、ロケールが関係する結合
における問題のデバッグを支援するために、 ‘PYTHONCOERCECLOCALE=warn’ を設
定することで (*note stderr: b33. に直接出力される) 明示的な警告を要求で
きます。 この設定を有効にしていると、コアのインタプリタの初期化時にレガ
シーな C ロケールが有効なままの場合、 Python 実行器が警告を出力します。

PEP 538(3) のロケール強制には、(非 Python アプリケーションや古いバージョ
ンの Python で動くのも含めた) 子プロセスに加え (GNU ‘readline’ などの) 影
響を受ける拡張モジュールにも利益がある一方、適切な対象ロケールが実行する
システムに存在することを要求するという負の面もあります。 (例えば、
RHEL/CentOS 7 で起きているように) 適切な対象ロケールで利用可能なものが無
いケースにきちんと対処するために、 Python 3.7 には *note PEP 540; 強制
UTF-8 実行モード: cc1. も実装されています。

参考
....

PEP 538(4) - レガシーな C ロケールから UTF-8 ベースのロケールへの強制

     PEP written and implemented by Nick Coghlan.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0538/

   (2) https://peps.python.org/pep-0011/

   (3) https://peps.python.org/pep-0538/

   (4) https://peps.python.org/pep-0538/


File: python.info,  Node: PEP 540 強制 UTF-8 実行モード,  Next: PEP 553 組み込みの breakpoint,  Prev: PEP 538 レガシーな C ロケールの抑圧,  Up: 新しい機能<13>

1.8.2.3 PEP 540: 強制 UTF-8 実行モード
......................................

The new *note -X: 16f. ‘utf8’ command line option and *note PYTHONUTF8:
ccf. environment variable can be used to enable the *note Python UTF-8
Mode: 866.

When in UTF-8 mode, CPython ignores the locale settings, and uses the
UTF-8 encoding by default.  The error handlers for *note sys.stdin: 75f.
and *note sys.stdout: ccd. streams are set to ‘surrogateescape’.

The forced UTF-8 mode can be used to change the text handling behavior
in an embedded Python interpreter without changing the locale settings
of an embedding application.

While PEP 540(1)'s UTF-8 mode has the benefit of working regardless of
which locales are available on the running system, it has the downside
of having no effect on extension modules (such as GNU ‘readline’), child
processes running non-Python applications, and child processes running
older versions of Python.  To reduce the risk of corrupting text data
when communicating with such components, Python 3.7 also implements
*note PEP 540; 強制 UTF-8 実行モード: cc1.).

The UTF-8 mode is enabled by default when the locale is ‘C’ or ‘POSIX’,
and the PEP 538(2) locale coercion feature fails to change it to a UTF-8
based alternative (whether that failure is due to
‘PYTHONCOERCECLOCALE=0’ being set, ‘LC_ALL’ being set, or the lack of a
suitable target locale).

参考
....

PEP 540(3) - 新しい UTF-8 モードの追加

     PEP written and implemented by Victor Stinner

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0540/

   (2) https://peps.python.org/pep-0538/

   (3) https://peps.python.org/pep-0540/


File: python.info,  Node: PEP 553 組み込みの breakpoint,  Next: PEP 539 スレッドローカルストレージのための新しい C API,  Prev: PEP 540 強制 UTF-8 実行モード,  Up: 新しい機能<13>

1.8.2.4 PEP 553: 組み込みの ‘breakpoint()’
..........................................

Python 3.7 には、 Python デバッガへ入って行くための簡単で一貫した手段で
ある、新しい組み込みの *note breakpoint(): 271. 関数があります。

Built-in ‘breakpoint()’ calls *note sys.breakpointhook(): cd1.  By
default, the latter imports *note pdb: aa. and then calls
‘pdb.set_trace()’, but by binding ‘sys.breakpointhook()’ to the function
of your choosing, ‘breakpoint()’ can enter any debugger.  Additionally,
the environment variable *note PYTHONBREAKPOINT: cd2. can be set to the
callable of your debugger of choice.  Set ‘PYTHONBREAKPOINT=0’ to
completely disable built-in ‘breakpoint()’.

参考
....

PEP 553(1) - 組み込みの breakpoint()

     PEP written and implemented by Barry Warsaw

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0553/


File: python.info,  Node: PEP 539 スレッドローカルストレージのための新しい C API,  Next: PEP 562 モジュール属性へのアクセスのカスタマイズ,  Prev: PEP 553 組み込みの breakpoint,  Up: 新しい機能<13>

1.8.2.5 PEP 539: スレッドローカルストレージのための新しい C API
...............................................................

While Python provides a C API for thread-local storage support; the
existing *note Thread Local Storage (TLS) API: cd4. has used int to
represent TLS keys across all platforms.  This has not generally been a
problem for officially support platforms, but that is neither
POSIX-compliant, nor portable in any practical sense.

PEP 539(1) changes this by providing a new *note Thread Specific Storage
(TSS) API: cd5. to CPython which supersedes use of the existing TLS API
within the CPython interpreter, while deprecating the existing API. The
TSS API uses a new type *note Py_tss_t: cd6. instead of int to represent
TSS keys-an opaque type the definition of which may depend on the
underlying TLS implementation.  Therefore, this will allow to build
CPython on platforms where the native TLS key is defined in a way that
cannot be safely cast to int.

Note that on platforms where the native TLS key is defined in a way that
cannot be safely cast to int, all functions of the existing TLS API will
be no-op and immediately return failure.  This indicates clearly that
the old API is not supported on platforms where it cannot be used
reliably, and that no effort will be made to add such support.

参考
....

PEP 539(2) - A New C-API for Thread-Local Storage in CPython

     PEP written by Erik M. Bray; implementation by Masayuki Yamamoto.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0539/

   (2) https://peps.python.org/pep-0539/


File: python.info,  Node: PEP 562 モジュール属性へのアクセスのカスタマイズ,  Next: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数,  Prev: PEP 539 スレッドローカルストレージのための新しい C API,  Up: 新しい機能<13>

1.8.2.6 PEP 562: モジュール属性へのアクセスのカスタマイズ
.........................................................

Python 3.7 allows defining *note __getattr__(): cd8. on modules and will
call it whenever a module attribute is otherwise not found.  Defining
*note __dir__(): cd9. on modules is now also allowed.

この機能が役に立つ典型的な実例はモジュール属性の非推奨化と遅延読み込みで
す。

参考
....

PEP 562(1) - モジュールの ‘__getattr__’ と ‘__dir__’

     PEP written and implemented by Ivan Levkivskyi

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0562/


File: python.info,  Node: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数,  Next: PEP 565 Show DeprecationWarning in __main__,  Prev: PEP 562 モジュール属性へのアクセスのカスタマイズ,  Up: 新しい機能<13>

1.8.2.7 PEP 564: ナノ秒単位の分解能を持つ新しい時間関数
.......................................................

The resolution of clocks in modern systems can exceed the limited
precision of a floating-point number returned by the *note time.time():
55d. function and its variants.  To avoid loss of precision, PEP 564(1)
adds six new "nanosecond" variants of the existing timer functions to
the *note time: f4. module:

   * *note time.clock_gettime_ns(): cdb.

   * *note time.clock_settime_ns(): cdc.

   * *note time.monotonic_ns(): cdd.

   * *note time.perf_counter_ns(): cde.

   * *note time.process_time_ns(): cdf.

   * *note time.time_ns(): ce0.

新しい関数は、整数値としてナノ秒単位の数値を返します。

Measurements(2) show that on Linux and Windows the resolution of *note
time.time_ns(): ce0. is approximately 3 times better than that of *note
time.time(): 55d.

参考
....

PEP 564(3) - ナノ秒単位の分解能を持つ新しい時間関数の追加

     PEP written and implemented by Victor Stinner

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0564/

   (2) 
https://peps.python.org/pep-0564/#annex-clocks-resolution-in-python

   (3) https://peps.python.org/pep-0564/


File: python.info,  Node: PEP 565 Show DeprecationWarning in __main__,  Next: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート,  Prev: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数,  Up: 新しい機能<13>

1.8.2.8 PEP 565: Show DeprecationWarning in ‘__main__’
......................................................

The default handling of *note DeprecationWarning: 1a3. has been changed
such that these warnings are once more shown by default, but only when
the code triggering them is running directly in the *note __main__: 1.
module.  As a result, developers of single file scripts and those using
Python interactively should once again start seeing deprecation warnings
for the APIs they use, but deprecation warnings triggered by imported
application, library and framework modules will continue to be hidden by
default.

As a result of this change, the standard library now allows developers
to choose between three different deprecation warning behaviours:

   * *note FutureWarning: 659.: always displayed by default, recommended
     for warnings intended to be seen by application end users (e.g.
     for deprecated application configuration settings).

   * *note DeprecationWarning: 1a3.: displayed by default only in *note
     __main__: 1. and when running tests, recommended for warnings
     intended to be seen by other Python developers where a version
     upgrade may result in changed behaviour or an error.

   * *note PendingDeprecationWarning: ac5.: displayed by default only
     when running tests, intended for cases where a future version
     upgrade will change the warning category to *note
     DeprecationWarning: 1a3. or *note FutureWarning: 659.

Previously both *note DeprecationWarning: 1a3. and *note
PendingDeprecationWarning: ac5. were only visible when running tests,
which meant that developers primarily writing single file scripts or
using Python interactively could be surprised by breaking changes in the
APIs they used.

参考
....

PEP 565(1) - Show DeprecationWarning in ‘__main__’

     PEP written and implemented by Nick Coghlan

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0565/


File: python.info,  Node: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート,  Next: PEP 552 Hash-based pyc Files,  Prev: PEP 565 Show DeprecationWarning in __main__,  Up: 新しい機能<13>

1.8.2.9 PEP 560: ‘typing’ モジュールとジェネリック型に対する言語コアによるサポート
..................................................................................

Initially PEP 484(1) was designed in such way that it would not
introduce 'any' changes to the core CPython interpreter.  Now type hints
and the *note typing: 10a. module are extensively used by the community,
so this restriction is removed.  The PEP introduces two special methods
*note __class_getitem__(): 943. and *note __mro_entries__(): ce3, these
methods are now used by most classes and special constructs in *note
typing: 10a.  As a result, the speed of various operations with types
increased up to 7 times, the generic types can be used without metaclass
conflicts, and several long standing bugs in *note typing: 10a. module
are fixed.

参考
....

PEP 560(2) - typing モジュールとジェネリック型に対する言語コアによるサポート

     PEP written and implemented by Ivan Levkivskyi

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/

   (2) https://peps.python.org/pep-0560/


File: python.info,  Node: PEP 552 Hash-based pyc Files,  Next: PEP 545 Python Documentation Translations,  Prev: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート,  Up: 新しい機能<13>

1.8.2.10 PEP 552: Hash-based .pyc Files
.......................................

Python has traditionally checked the up-to-dateness of bytecode cache
files (i.e., ‘.pyc’ files) by comparing the source metadata
(last-modified timestamp and size) with source metadata saved in the
cache file header when it was generated.  While effective, this
invalidation method has its drawbacks.  When filesystem timestamps are
too coarse, Python can miss source updates, leading to user confusion.
Additionally, having a timestamp in the cache file is problematic for
build reproducibility(1) and content-based build systems.

PEP 552(2) extends the pyc format to allow the hash of the source file
to be used for invalidation instead of the source timestamp.  Such
‘.pyc’ files are called "hash-based".  By default, Python still uses
timestamp-based invalidation and does not generate hash-based ‘.pyc’
files at runtime.  Hash-based ‘.pyc’ files may be generated with *note
py_compile: b8. or *note compileall: 21.

Hash-based ‘.pyc’ files come in two variants: checked and unchecked.
Python validates checked hash-based ‘.pyc’ files against the
corresponding source files at runtime but doesn't do so for unchecked
hash-based pycs.  Unchecked hash-based ‘.pyc’ files are a useful
performance optimization for environments where a system external to
Python (e.g., the build system) is responsible for keeping ‘.pyc’ files
up-to-date.

See *note キャッシュされたバイトコードの無効化: 802. for more
information.

参考
....

PEP 552(3) - Deterministic pycs

     PEP written and implemented by Benjamin Peterson

   ---------- Footnotes ----------

   (1) https://reproducible-builds.org/

   (2) https://peps.python.org/pep-0552/

   (3) https://peps.python.org/pep-0552/


File: python.info,  Node: PEP 545 Python Documentation Translations,  Next: Python Development Mode -X dev,  Prev: PEP 552 Hash-based pyc Files,  Up: 新しい機能<13>

1.8.2.11 PEP 545: Python Documentation Translations
...................................................

PEP 545(1) describes the process of creating and maintaining Python
documentation translations.

Three new translations have been added:

   - 日本語: ‘https://docs.python.org/ja/’

   - フランス語: ‘https://docs.python.org/fr/’

   - 韓国語: ‘https://docs.python.org/ko/’

参考
....

PEP 545(2) - Python ドキュメント翻訳

     PEP written and implemented by Julien Palard, Inada Naoki, and
     Victor Stinner.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0545/

   (2) https://peps.python.org/pep-0545/


File: python.info,  Node: Python Development Mode -X dev,  Prev: PEP 545 Python Documentation Translations,  Up: 新しい機能<13>

1.8.2.12 Python Development Mode (-X dev)
.........................................

The new *note -X: 16f. ‘dev’ command line option or the new *note
PYTHONDEVMODE: ce7. environment variable can be used to enable *note
Python Development Mode: 508.  When in development mode, Python performs
additional runtime checks that are too expensive to be enabled by
default.  See *note Python Development Mode: 508. documentation for the
full description.


File: python.info,  Node: その他の言語変更<7>,  Next: 新たなモジュール<7>,  Prev: 新しい機能<13>,  Up: What's New In Python 3 7

1.8.3 その他の言語変更
----------------------

   * An *note await: 18d. expression and comprehensions containing an
     *note async for: ca1. clause were illegal in the expressions in
     *note formatted string literals: 19a. due to a problem with the
     implementation.  In Python 3.7 this restriction was lifted.

   * More than 255 arguments can now be passed to a function, and a
     function can now have more than 255 parameters.  (Contributed by
     Serhiy Storchaka in bpo-12844(1) and bpo-18896(2).)

   * *note bytes.fromhex(): 190. and *note bytearray.fromhex(): 191. now
     ignore all ASCII whitespace, not only spaces.  (Contributed by
     Robert Xiao in bpo-28927(3).)

   * *note str: 169, *note bytes: 192, and *note bytearray: 344. gained
     support for the new *note isascii(): ce9. method, which can be used
     to test if a string or bytes contain only the ASCII characters.
     (Contributed by INADA Naoki in bpo-32677(4).)

   * *note ImportError: 65b. now displays module name and module
     ‘__file__’ path when ‘from ... import ...’ fails.  (Contributed by
     Matthias Bussonnier in bpo-29546(5).)

   * Circular imports involving absolute imports with binding a
     submodule to a name are now supported.  (Contributed by Serhiy
     Storchaka in bpo-30024(6).)

   * ‘object.__format__(x, '')’ is now equivalent to ‘str(x)’ rather
     than ‘format(str(self), '')’.  (Contributed by Serhiy Storchaka in
     bpo-28974(7).)

   * In order to better support dynamic creation of stack traces, *note
     types.TracebackType: cea. can now be instantiated from Python code,
     and the *note tb_next: ceb. attribute on *note tracebacks: cec. is
     now writable.  (Contributed by Nathaniel J. Smith in bpo-30579(8).)

   * When using the *note -m: 23c. switch, ‘sys.path[0]’ is now eagerly
     expanded to the full starting directory path, rather than being
     left as the empty directory (which allows imports from the
     'current' working directory at the time when an import occurs)
     (Contributed by Nick Coghlan in bpo-33053(9).)

   * The new *note -X: 16f. ‘importtime’ option or the *note
     PYTHONPROFILEIMPORTTIME: ced. environment variable can be used to
     show the timing of each module import.  (Contributed by Inada Naoki
     in bpo-31415(10).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12844

   (2) https://bugs.python.org/issue?@action=redirect&bpo=18896

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28927

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32677

   (5) https://bugs.python.org/issue?@action=redirect&bpo=29546

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30024

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28974

   (8) https://bugs.python.org/issue?@action=redirect&bpo=30579

   (9) https://bugs.python.org/issue?@action=redirect&bpo=33053

   (10) https://bugs.python.org/issue?@action=redirect&bpo=31415


File: python.info,  Node: 新たなモジュール<7>,  Next: 改良されたモジュール<7>,  Prev: その他の言語変更<7>,  Up: What's New In Python 3 7

1.8.4 新たなモジュール
----------------------

* Menu:

* contextvars: contextvars<2>.
* データクラス: データクラス<3>.
* importlib.resources: importlib resources<2>.


File: python.info,  Node: contextvars<2>,  Next: データクラス<3>,  Up: 新たなモジュール<7>

1.8.4.1 contextvars
...................

The new *note contextvars: 28. module and a set of *note new C APIs:
cf0. introduce support for 'context variables'.  Context variables are
conceptually similar to thread-local variables.  Unlike TLS, context
variables support asynchronous code correctly.

The *note asyncio: b. and *note decimal: 3a. modules have been updated
to use and support context variables out of the box.  Particularly the
active decimal context is now stored in a context variable, which allows
decimal operations to work with the correct context in asynchronous
code.

参考
....

PEP 567(1) - コンテキスト変数

     PEP written and implemented by Yury Selivanov

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0567/


File: python.info,  Node: データクラス<3>,  Next: importlib resources<2>,  Prev: contextvars<2>,  Up: 新たなモジュール<7>

1.8.4.2 データクラス
....................

新しい *note dataclass(): 4e1. デコレータにより 'データクラス' を宣言す
る方法が提供されます。 データクラスは属性を記述するのに、クラス変数アノ
テーションを使います。 コンストラクタや他の *note __repr__(): 82f, *note
__eq__(): cf2, *note __hash__(): cf3. などのマジックメソッドは自動で生成
されます。

以下はプログラム例です:

     @dataclass
     class Point:
         x: float
         y: float
         z: float = 0.0

     p = Point(1.5, 2.5)
     print(p)   # produces "Point(x=1.5, y=2.5, z=0.0)"

参考
....

PEP 557(1) - データクラス

     PEP written and implemented by Eric V. Smith

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0557/


File: python.info,  Node: importlib resources<2>,  Prev: データクラス<3>,  Up: 新たなモジュール<7>

1.8.4.3 importlib.resources
...........................

The new *note importlib.resources: 7f. module provides several new APIs
and one new ABC for access to, opening, and reading 'resources' inside
packages.  Resources are roughly similar to files inside packages, but
they needn't be actual files on the physical file system.  Module
loaders can provide a ‘get_resource_reader()’ function which returns a
‘importlib.abc.ResourceReader’ instance to support this new API.
Built-in file path loaders and zip file loaders both support this.

Contributed by Barry Warsaw and Brett Cannon in bpo-32248(1).

参考
....

importlib_resources(2) - a PyPI backport for earlier Python versions.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32248

   (2) https://importlib-resources.readthedocs.io/en/latest/


File: python.info,  Node: 改良されたモジュール<7>,  Next: C API の変更<11>,  Prev: 新たなモジュール<7>,  Up: What's New In Python 3 7

1.8.5 改良されたモジュール
--------------------------

* Menu:

* argparse: argparse<5>.
* asyncio: asyncio<10>.
* binascii::
* calendar: calendar<3>.
* collections: collections<2>.
* compileall: compileall<3>.
* concurrent.futures: concurrent futures<4>.
* contextlib: contextlib<3>.
* cProfile: cProfile<2>.
* crypt::
* datetime: datetime<5>.
* dbm: dbm<2>.
* decimal: decimal<2>.
* dis: dis<4>.
* distutils: distutils<4>.
* enum: enum<5>.
* functools: functools<4>.
* gc: gc<5>.
* hmac: hmac<3>.
* http.client: http client.
* http.server: http server.
* idlelib と IDLE::
* importlib: importlib<4>.
* io: io<6>.
* ipaddress: ipaddress<3>.
* itertools: itertools<6>.
* locale: locale<4>.
* logging: logging<3>.
* math: math<7>.
* mimetypes: mimetypes<3>.
* msilib::
* multiprocessing: multiprocessing<5>.
* os: os<8>.
* pathlib: pathlib<11>.
* pdb: pdb<6>.
* py_compile: py_compile<3>.
* pydoc: pydoc<3>.
* queue: queue<2>.
* re: re<5>.
* signal: signal<2>.
* socket: socket<6>.
* socketserver::
* sqlite3: sqlite3<7>.
* ssl: ssl<6>.
* string: string<2>.
* subprocess: subprocess<2>.
* sys: sys<8>.
* time: time<5>.
* tkinter: tkinter<6>.
* tracemalloc: tracemalloc<2>.
* types: types<5>.
* unicodedata: unicodedata<7>.
* unittest: unittest<8>.
* unittest.mock: unittest mock.
* urllib.parse: urllib parse<5>.
* uu::
* uuid: uuid<4>.
* warnings: warnings<3>.
* xml: xml<5>.
* xml.etree: xml etree.
* xmlrpc.server: xmlrpc server.
* zipapp::
* zipfile: zipfile<3>.


File: python.info,  Node: argparse<5>,  Next: asyncio<10>,  Up: 改良されたモジュール<7>

1.8.5.1 argparse
................

The new *note ArgumentParser.parse_intermixed_args(): cf7. method allows
intermixing options and positional arguments.  (Contributed by paul.j3
in bpo-14191(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14191


File: python.info,  Node: asyncio<10>,  Next: binascii,  Prev: argparse<5>,  Up: 改良されたモジュール<7>

1.8.5.2 asyncio
...............

The *note asyncio: b. module has received many new features, usability
and *note performance improvements: cf9.  Notable changes include:

   * The new *note provisional: 3d1. *note asyncio.run(): 2f3. function
     can be used to run a coroutine from synchronous code by
     automatically creating and destroying the event loop.  (Contributed
     by Yury Selivanov in bpo-32314(1).)

   * asyncio gained support for *note contextvars: 28.  *note
     loop.call_soon(): cfa, *note loop.call_soon_threadsafe(): cfb,
     *note loop.call_later(): cfc, *note loop.call_at(): cfd, and *note
     Future.add_done_callback(): cfe. have a new optional keyword-only
     'context' parameter.  *note Tasks: 1c7. now track their context
     automatically.  See PEP 567(2) for more details.  (Contributed by
     Yury Selivanov in bpo-32436(3).)

   * The new *note asyncio.create_task(): 1c9. function has been added
     as a shortcut to ‘asyncio.get_event_loop().create_task()’.
     (Contributed by Andrew Svetlov in bpo-32311(4).)

   * The new *note loop.start_tls(): cff. method can be used to upgrade
     an existing connection to TLS. (Contributed by Yury Selivanov in
     bpo-23749(5).)

   * The new *note loop.sock_recv_into(): d00. method allows reading
     data from a socket directly into a provided buffer making it
     possible to reduce data copies.  (Contributed by Antoine Pitrou in
     bpo-31819(6).)

   * The new *note asyncio.current_task(): 6a5. function returns the
     currently running *note Task: 1c7. instance, and the new *note
     asyncio.all_tasks(): b4f. function returns a set of all existing
     ‘Task’ instances in a given loop.  The ‘Task.current_task()’ and
     ‘Task.all_tasks()’ methods have been deprecated.  (Contributed by
     Andrew Svetlov in bpo-32250(7).)

   * The new 'provisional' *note BufferedProtocol: c94. class allows
     implementing streaming protocols with manual control over the
     receive buffer.  (Contributed by Yury Selivanov in bpo-32251(8).)

   * The new *note asyncio.get_running_loop(): d01. function returns the
     currently running loop, and raises a *note RuntimeError: 244. if no
     loop is running.  This is in contrast with *note
     asyncio.get_event_loop(): 2f2, which will 'create' a new event loop
     if none is running.  (Contributed by Yury Selivanov in
     bpo-32269(9).)

   * The new *note StreamWriter.wait_closed(): d02. coroutine method
     allows waiting until the stream writer is closed.  The new *note
     StreamWriter.is_closing(): d03. method can be used to determine if
     the writer is closing.  (Contributed by Andrew Svetlov in
     bpo-32391(10).)

   * The new *note loop.sock_sendfile(): d04. coroutine method allows
     sending files using *note os.sendfile: d05. when possible.
     (Contributed by Andrew Svetlov in bpo-32410(11).)

   * The new *note Future.get_loop(): d06. and ‘Task.get_loop()’ methods
     return the instance of the loop on which a task or a future were
     created.  *note Server.get_loop(): d07. allows doing the same for
     *note asyncio.Server: d08. objects.  (Contributed by Yury Selivanov
     in bpo-32415(12) and Srinivas Reddy Thatiparthy in bpo-32418(13).)

   * It is now possible to control how instances of *note
     asyncio.Server: d08. begin serving.  Previously, the server would
     start serving immediately when created.  The new 'start_serving'
     keyword argument to *note loop.create_server(): d09. and *note
     loop.create_unix_server(): 4ca, as well as *note
     Server.start_serving(): d0a, and *note Server.serve_forever(): d0b.
     can be used to decouple server instantiation and serving.  The new
     *note Server.is_serving(): d0c. method returns ‘True’ if the server
     is serving.  *note Server: d08. objects are now asynchronous
     context managers:

          srv = await loop.create_server(...)

          async with srv:
              # some code

          # At this point, srv is closed and no longer accepts new connections.

     (Contributed by Yury Selivanov in bpo-32662(14).)

   * Callback objects returned by *note loop.call_later(): cfc. gained
     the new *note when(): d0d. method which returns an absolute
     scheduled callback timestamp.  (Contributed by Andrew Svetlov in
     bpo-32741(15).)

   * The *note loop.create_datagram_endpoint(): 93c. method gained
     support for Unix sockets.  (Contributed by Quentin Dawans in
     bpo-31245(16).)

   * The *note asyncio.open_connection(): d0e, *note
     asyncio.start_server(): d0f. functions, *note
     loop.create_connection(): 818, *note loop.create_server(): d09,
     *note loop.create_accepted_socket(): 9de. methods and their
     corresponding UNIX socket variants now accept the
     'ssl_handshake_timeout' keyword argument.  (Contributed by Neil
     Aspinall in bpo-29970(17).)

   * The new *note Handle.cancelled(): d10. method returns ‘True’ if the
     callback was cancelled.  (Contributed by Marat Sharafutdinov in
     bpo-31943(18).)

   * The asyncio source has been converted to use the *note async:
     93b./*note await: 18d. syntax.  (Contributed by Andrew Svetlov in
     bpo-32193(19).)

   * The new *note ReadTransport.is_reading(): d11. method can be used
     to determine the reading state of the transport.  Additionally,
     calls to *note ReadTransport.resume_reading(): d12. and *note
     ReadTransport.pause_reading(): d13. are now idempotent.
     (Contributed by Yury Selivanov in bpo-32356(20).)

   * Loop methods which accept socket paths now support passing *note
     path-like objects: 5a1.  (Contributed by Yury Selivanov in
     bpo-32066(21).)

   * In *note asyncio: b. TCP sockets on Linux are now created with
     ‘TCP_NODELAY’ flag set by default.  (Contributed by Yury Selivanov
     and Victor Stinner in bpo-27456(22).)

   * Exceptions occurring in cancelled tasks are no longer logged.
     (Contributed by Yury Selivanov in bpo-30508(23).)

   * New ‘WindowsSelectorEventLoopPolicy’ and
     ‘WindowsProactorEventLoopPolicy’ classes.  (Contributed by Yury
     Selivanov in bpo-33792(24).)

Several ‘asyncio’ APIs have been *note deprecated: d14.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32314

   (2) https://peps.python.org/pep-0567/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32436

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32311

   (5) https://bugs.python.org/issue?@action=redirect&bpo=23749

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31819

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32250

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32251

   (9) https://bugs.python.org/issue?@action=redirect&bpo=32269

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32391

   (11) https://bugs.python.org/issue?@action=redirect&bpo=32410

   (12) https://bugs.python.org/issue?@action=redirect&bpo=32415

   (13) https://bugs.python.org/issue?@action=redirect&bpo=32418

   (14) https://bugs.python.org/issue?@action=redirect&bpo=32662

   (15) https://bugs.python.org/issue?@action=redirect&bpo=32741

   (16) https://bugs.python.org/issue?@action=redirect&bpo=31245

   (17) https://bugs.python.org/issue?@action=redirect&bpo=29970

   (18) https://bugs.python.org/issue?@action=redirect&bpo=31943

   (19) https://bugs.python.org/issue?@action=redirect&bpo=32193

   (20) https://bugs.python.org/issue?@action=redirect&bpo=32356

   (21) https://bugs.python.org/issue?@action=redirect&bpo=32066

   (22) https://bugs.python.org/issue?@action=redirect&bpo=27456

   (23) https://bugs.python.org/issue?@action=redirect&bpo=30508

   (24) https://bugs.python.org/issue?@action=redirect&bpo=33792


File: python.info,  Node: binascii,  Next: calendar<3>,  Prev: asyncio<10>,  Up: 改良されたモジュール<7>

1.8.5.3 binascii
................

The *note b2a_uu(): d16. function now accepts an optional 'backtick'
keyword argument.  When it's true, zeros are represented by ‘'`'’
instead of spaces.  (Contributed by Xiang Zhang in bpo-30103(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30103


File: python.info,  Node: calendar<3>,  Next: collections<2>,  Prev: binascii,  Up: 改良されたモジュール<7>

1.8.5.4 calendar
................

*note HTMLCalendar: d18. クラスに、作成された HTML カレンダーの CSS クラ
スのカスタマイズを容易にするクラス属性が新しく加わりました。
(Contributed by Oz Tiram in bpo-30095(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30095


File: python.info,  Node: collections<2>,  Next: compileall<3>,  Prev: calendar<3>,  Up: 改良されたモジュール<7>

1.8.5.5 collections
...................

‘collections.namedtuple()’ がデフォルト値をサポートするようになりました
。 (Contributed by Raymond Hettinger in bpo-32320(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32320


File: python.info,  Node: compileall<3>,  Next: concurrent futures<4>,  Prev: collections<2>,  Up: 改良されたモジュール<7>

1.8.5.6 compileall
..................

*note compileall.compile_dir(): d1b. learned the new 'invalidation_mode'
parameter, which can be used to enable *note hash-based .pyc
invalidation: cc2.  The invalidation mode can also be specified on the
command line using the new ‘--invalidation-mode’ argument.  (Contributed
by Benjamin Peterson in bpo-31650(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31650


File: python.info,  Node: concurrent futures<4>,  Next: contextlib<3>,  Prev: compileall<3>,  Up: 改良されたモジュール<7>

1.8.5.7 concurrent.futures
..........................

*note ProcessPoolExecutor: 1d6. と *note ThreadPoolExecutor: 949. が新し
いコンストラクタ引数 'initializer' と 'initargs' をサポートするようにな
りました。 (Contributed by Antoine Pitrou in bpo-21423(1).)

*note ProcessPoolExecutor: 1d6. が新しい 'mp_context' 引数を通して
multiprocessing の context を受け取れるようになりました。 (Contributed
by Thomas Moreau in bpo-31540(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21423

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31540


File: python.info,  Node: contextlib<3>,  Next: cProfile<2>,  Prev: concurrent futures<4>,  Up: 改良されたモジュール<7>

1.8.5.8 contextlib
..................

The new *note nullcontext(): 9ef. is a simpler and faster no-op context
manager than *note ExitStack: d1e.  (Contributed by Jesse-Bakker in
bpo-10049(1).)

The new *note asynccontextmanager(): d1f, *note
AbstractAsyncContextManager: d20, and *note AsyncExitStack: d21. have
been added to complement their synchronous counterparts.  (Contributed
by Jelle Zijlstra in bpo-29679(2) and bpo-30241(3), and by Alexander
Mohr and Ilya Kulakov in bpo-29302(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10049

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29679

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30241

   (4) https://bugs.python.org/issue?@action=redirect&bpo=29302


File: python.info,  Node: cProfile<2>,  Next: crypt,  Prev: contextlib<3>,  Up: 改良されたモジュール<7>

1.8.5.9 cProfile
................

The *note cProfile: 2b. command line now accepts ‘-m module_name’ as an
alternative to script path.  (Contributed by Sanyam Khurana in
bpo-21862(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21862


File: python.info,  Node: crypt,  Next: datetime<5>,  Prev: cProfile<2>,  Up: 改良されたモジュール<7>

1.8.5.10 crypt
..............

The ‘crypt’ module now supports the Blowfish hashing method.
(Contributed by Serhiy Storchaka in bpo-31664(1).)

The ‘mksalt()’ function now allows specifying the number of rounds for
hashing.  (Contributed by Serhiy Storchaka in bpo-31702(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31664

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31702


File: python.info,  Node: datetime<5>,  Next: dbm<2>,  Prev: crypt,  Up: 改良されたモジュール<7>

1.8.5.11 datetime
.................

The new *note datetime.fromisoformat(): 82a. method constructs a *note
datetime: 4e2. object from a string in one of the formats output by
*note datetime.isoformat(): d25.  (Contributed by Paul Ganssle in
bpo-15873(1).)

The *note tzinfo: 7f6. class now supports sub-minute offsets.
(Contributed by Alexander Belopolsky in bpo-5288(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15873

   (2) https://bugs.python.org/issue?@action=redirect&bpo=5288


File: python.info,  Node: dbm<2>,  Next: decimal<2>,  Prev: datetime<5>,  Up: 改良されたモジュール<7>

1.8.5.12 dbm
............

*note dbm.dumb: 36. now supports reading read-only files and no longer
writes the index file when it is not changed.


File: python.info,  Node: decimal<2>,  Next: dis<4>,  Prev: dbm<2>,  Up: 改良されたモジュール<7>

1.8.5.13 decimal
................

The *note decimal: 3a. module now uses *note context variables: cb7. to
store the decimal context.  (Contributed by Yury Selivanov in
bpo-32630(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32630


File: python.info,  Node: dis<4>,  Next: distutils<4>,  Prev: decimal<2>,  Up: 改良されたモジュール<7>

1.8.5.14 dis
............

The *note dis(): 205. function is now able to disassemble nested code
objects (the code of comprehensions, generator expressions and nested
functions, and the code used for building nested classes).  The maximum
depth of disassembly recursion is controlled by the new 'depth'
parameter.  (Contributed by Serhiy Storchaka in bpo-11822(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11822


File: python.info,  Node: distutils<4>,  Next: enum<5>,  Prev: dis<4>,  Up: 改良されたモジュール<7>

1.8.5.15 distutils
..................

‘README.rst’ is now included in the list of distutils standard READMEs
and therefore included in source distributions.  (Contributed by Ryan
Gonzalez in bpo-11913(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11913


File: python.info,  Node: enum<5>,  Next: functools<4>,  Prev: distutils<4>,  Up: 改良されたモジュール<7>

1.8.5.16 enum
.............

The *note Enum: 842. learned the new ‘_ignore_’ class property, which
allows listing the names of properties which should not become enum
members.  (Contributed by Ethan Furman in bpo-31801(1).)

In Python 3.8, attempting to check for non-Enum objects in *note Enum:
842. classes will raise a *note TypeError: 198. (e.g.  ‘1 in Color’);
similarly, attempting to check for non-Flag objects in a *note Flag:
835. member will raise *note TypeError: 198. (e.g.  ‘1 in Perm.RW’);
currently, both operations return *note False: d2b. instead and are
deprecated.  (Contributed by Ethan Furman in bpo-33217(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31801

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33217


File: python.info,  Node: functools<4>,  Next: gc<5>,  Prev: enum<5>,  Up: 改良されたモジュール<7>

1.8.5.17 functools
..................

*note functools.singledispatch(): 84b. now supports registering
implementations using type annotations.  (Contributed by Łukasz Langa in
bpo-32227(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32227


File: python.info,  Node: gc<5>,  Next: hmac<3>,  Prev: functools<4>,  Up: 改良されたモジュール<7>

1.8.5.18 gc
...........

The new *note gc.freeze(): d2e. function allows freezing all objects
tracked by the garbage collector and excluding them from future
collections.  This can be used before a POSIX ‘fork()’ call to make the
GC copy-on-write friendly or to speed up collection.  The new *note
gc.unfreeze(): d2f. functions reverses this operation.  Additionally,
*note gc.get_freeze_count(): d30. can be used to obtain the number of
frozen objects.  (Contributed by Li Zekun in bpo-31558(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31558


File: python.info,  Node: hmac<3>,  Next: http client,  Prev: gc<5>,  Up: 改良されたモジュール<7>

1.8.5.19 hmac
.............

The *note hmac: 6e. module now has an optimized one-shot *note digest():
d32. function, which is up to three times faster than *note HMAC(): d33.
(Contributed by Christian Heimes in bpo-32433(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32433


File: python.info,  Node: http client,  Next: http server,  Prev: hmac<3>,  Up: 改良されたモジュール<7>

1.8.5.20 http.client
....................

*note HTTPConnection: d35. and *note HTTPSConnection: d36. now support
the new 'blocksize' argument for improved upload throughput.
(Contributed by Nir Soffer in bpo-31945(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31945


File: python.info,  Node: http server,  Next: idlelib と IDLE,  Prev: http client,  Up: 改良されたモジュール<7>

1.8.5.21 http.server
....................

*note SimpleHTTPRequestHandler: d38. now supports the HTTP
‘If-Modified-Since’ header.  The server returns the 304 response status
if the target file was not modified after the time specified in the
header.  (Contributed by Pierre Quentel in bpo-29654(1).)

*note SimpleHTTPRequestHandler: d38. accepts the new 'directory'
argument, in addition to the new ‘--directory’ command line argument.
With this parameter, the server serves the specified directory, by
default it uses the current working directory.  (Contributed by Stéphane
Wirtel and Julien Palard in bpo-28707(2).)

The new *note ThreadingHTTPServer: d39. class uses threads to handle
requests using *note ThreadingMixIn: d3a.  It is used when ‘http.server’
is run with ‘-m’.  (Contributed by Julien Palard in bpo-31639(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29654

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28707

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31639


File: python.info,  Node: idlelib と IDLE,  Next: importlib<4>,  Prev: http server,  Up: 改良されたモジュール<7>

1.8.5.22 idlelib と IDLE
........................

自動補完におけるいくつもの修正。 (Contributed by Louie Lu in
bpo-15786(1).)

Module Browser (on the File menu, formerly called Class Browser), now
displays nested functions and classes in addition to top-level functions
and classes.  (Contributed by Guilherme Polo, Cheryl Sabella, and Terry
Jan Reedy in bpo-1612262(2).)

The Settings dialog (Options, Configure IDLE) has been partly rewritten
to improve both appearance and function.  (Contributed by Cheryl Sabella
and Terry Jan Reedy in multiple issues.)

The font sample now includes a selection of non-Latin characters so that
users can better see the effect of selecting a particular font.
(Contributed by Terry Jan Reedy in bpo-13802(3).)  The sample can be
edited to include other characters.  (Contributed by Serhiy Storchaka in
bpo-31860(4).)

The IDLE features formerly implemented as extensions have been
reimplemented as normal features.  Their settings have been moved from
the Extensions tab to other dialog tabs.  (Contributed by Charles
Wohlganger and Terry Jan Reedy in bpo-27099(5).)

Editor code context option revised.  Box displays all context lines up
to maxlines.  Clicking on a context line jumps the editor to that line.
Context colors for custom themes is added to Highlights tab of Settings
dialog.  (Contributed by Cheryl Sabella and Terry Jan Reedy in
bpo-33642(6), bpo-33768(7), and bpo-33679(8).)

On Windows, a new API call tells Windows that tk scales for DPI. On
Windows 8.1+ or 10, with DPI compatibility properties of the Python
binary unchanged, and a monitor resolution greater than 96 DPI, this
should make text and lines sharper.  It should otherwise have no effect.
(Contributed by Terry Jan Reedy in bpo-33656(9).)

New in 3.7.1:

Output over N lines (50 by default) is squeezed down to a button.  N can
be changed in the PyShell section of the General page of the Settings
dialog.  Fewer, but possibly extra long, lines can be squeezed by right
clicking on the output.  Squeezed output can be expanded in place by
double-clicking the button or into the clipboard or a separate window by
right-clicking the button.  (Contributed by Tal Einat in
bpo-1529353(10).)

上で挙げた変更は 3.6 のメンテナンスリリースにバックポートされました。

NEW in 3.7.4:

Add "Run Customized" to the Run menu to run a module with customized
settings.  Any command line arguments entered are added to sys.argv.
They re-appear in the box for the next customized run.  One can also
suppress the normal Shell main module restart.  (Contributed by Cheryl
Sabella, Terry Jan Reedy, and others in bpo-5680(11) and bpo-37627(12).)

New in 3.7.5:

Add optional line numbers for IDLE editor windows.  Windows open without
line numbers unless set otherwise in the General tab of the
configuration dialog.  Line numbers for an existing window are shown and
hidden in the Options menu.  (Contributed by Tal Einat and Saimadhav
Heblikar in bpo-17535(13).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15786

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1612262

   (3) https://bugs.python.org/issue?@action=redirect&bpo=13802

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31860

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27099

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33642

   (7) https://bugs.python.org/issue?@action=redirect&bpo=33768

   (8) https://bugs.python.org/issue?@action=redirect&bpo=33679

   (9) https://bugs.python.org/issue?@action=redirect&bpo=33656

   (10) https://bugs.python.org/issue?@action=redirect&bpo=1529353

   (11) https://bugs.python.org/issue?@action=redirect&bpo=5680

   (12) https://bugs.python.org/issue?@action=redirect&bpo=37627

   (13) https://bugs.python.org/issue?@action=redirect&bpo=17535


File: python.info,  Node: importlib<4>,  Next: io<6>,  Prev: idlelib と IDLE,  Up: 改良されたモジュール<7>

1.8.5.23 importlib
..................

The ‘importlib.abc.ResourceReader’ ABC was introduced to support the
loading of resources from packages.  See also *note importlib.resources:
cb9.  (Contributed by Barry Warsaw, Brett Cannon in bpo-32248(1).)

*note importlib.reload(): 73d. now raises *note ModuleNotFoundError:
d3d. if the module lacks a spec.  (Contributed by Garvit Khatri in
bpo-29851(2).)

*note importlib.util.find_spec(): 5af. now raises *note
ModuleNotFoundError: d3d. instead of *note AttributeError: 5f0. if the
specified parent module is not a package (i.e.  lacks a ‘__path__’
attribute).  (Contributed by Milan Oberkirch in bpo-30436(3).)

The new *note importlib.util.source_hash(): d3e. can be used to compute
the hash of the passed source.  A *note hash-based .pyc file: cc2.
embeds the value returned by this function.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32248

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29851

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30436


File: python.info,  Node: io<6>,  Next: ipaddress<3>,  Prev: importlib<4>,  Up: 改良されたモジュール<7>

1.8.5.24 io
...........

The new *note TextIOWrapper.reconfigure(): d40. method can be used to
reconfigure the text stream with the new settings.  (Contributed by
Antoine Pitrou in bpo-30526(1) and INADA Naoki in bpo-15216(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30526

   (2) https://bugs.python.org/issue?@action=redirect&bpo=15216


File: python.info,  Node: ipaddress<3>,  Next: itertools<6>,  Prev: io<6>,  Up: 改良されたモジュール<7>

1.8.5.25 ipaddress
..................

The new ‘subnet_of()’ and ‘supernet_of()’ methods of *note
ipaddress.IPv6Network: 50f. and *note ipaddress.IPv4Network: 50e. can be
used for network containment tests.  (Contributed by Michel Albert and
Cheryl Sabella in bpo-20825(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20825


File: python.info,  Node: itertools<6>,  Next: locale<4>,  Prev: ipaddress<3>,  Up: 改良されたモジュール<7>

1.8.5.26 itertools
..................

*note itertools.islice(): d43. now accepts *note integer-like objects:
19e. as start, stop, and slice arguments.  (Contributed by Will Roberts
in bpo-30537(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30537


File: python.info,  Node: locale<4>,  Next: logging<3>,  Prev: itertools<6>,  Up: 改良されたモジュール<7>

1.8.5.27 locale
...............

The new 'monetary' argument to *note locale.format_string(): 742. can be
used to make the conversion use monetary thousands separators and
grouping strings.  (Contributed by Garvit in bpo-10379(1).)

The *note locale.getpreferredencoding(): 75c. function now always
returns ‘'UTF-8'’ on Android or when in the *note forced UTF-8 mode:
cc1.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10379


File: python.info,  Node: logging<3>,  Next: math<7>,  Prev: locale<4>,  Up: 改良されたモジュール<7>

1.8.5.28 logging
................

*note Logger: d46. インスタンスが pickle 化できるようになりました。
(Contributed by Vinay Sajip in bpo-30520(1).)

The new *note StreamHandler.setStream(): d47. method can be used to
replace the logger stream after handler creation.  (Contributed by Vinay
Sajip in bpo-30522(2).)

It is now possible to specify keyword arguments to handler constructors
in configuration passed to *note logging.config.fileConfig(): d48.
(Contributed by Preston Landers in bpo-31080(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30520

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30522

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31080


File: python.info,  Node: math<7>,  Next: mimetypes<3>,  Prev: logging<3>,  Up: 改良されたモジュール<7>

1.8.5.29 math
.............

新しい *note math.remainder(): d4a. 関数が IEEE 754 方式の剰余演算で実装
されています。 Contributed by Mark Dickinson in bpo-29962(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29962


File: python.info,  Node: mimetypes<3>,  Next: msilib,  Prev: math<7>,  Up: 改良されたモジュール<7>

1.8.5.30 mimetypes
..................

The MIME type of .bmp has been changed from ‘'image/x-ms-bmp'’ to
‘'image/bmp'’.  (Contributed by Nitish Chandra in bpo-22589(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22589


File: python.info,  Node: msilib,  Next: multiprocessing<5>,  Prev: mimetypes<3>,  Up: 改良されたモジュール<7>

1.8.5.31 msilib
...............

The new ‘Database.Close()’ method can be used to close the MSI database.
(Contributed by Berker Peksag in bpo-20486(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20486


File: python.info,  Node: multiprocessing<5>,  Next: os<8>,  Prev: msilib,  Up: 改良されたモジュール<7>

1.8.5.32 multiprocessing
........................

The new *note Process.close(): d4e. method explicitly closes the process
object and releases all resources associated with it.  *note ValueError:
2ec. is raised if the underlying process is still running.  (Contributed
by Antoine Pitrou in bpo-30596(1).)

The new *note Process.kill(): d4f. method can be used to terminate the
process using the *note SIGKILL: d50. signal on Unix.  (Contributed by
Vitor Pereira in bpo-30794(2).)

Non-daemonic threads created by *note Process: 252. are now joined on
process exit.  (Contributed by Antoine Pitrou in bpo-18966(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30596

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30794

   (3) https://bugs.python.org/issue?@action=redirect&bpo=18966


File: python.info,  Node: os<8>,  Next: pathlib<11>,  Prev: multiprocessing<5>,  Up: 改良されたモジュール<7>

1.8.5.33 os
...........

*note os.fwalk(): d52. now accepts the 'path' argument as *note bytes:
192.  (Contributed by Serhiy Storchaka in bpo-28682(1).)

*note os.scandir(): c54. gained support for *note file descriptors: d53.
(Contributed by Serhiy Storchaka in bpo-25996(2).)

The new *note register_at_fork(): 355. function allows registering
Python callbacks to be executed at process fork.  (Contributed by
Antoine Pitrou in bpo-16500(3).)

Added *note os.preadv(): d54. (combine the functionality of *note
os.readv(): d55. and *note os.pread(): d56.) and *note os.pwritev():
d57. functions (combine the functionality of *note os.writev(): d58. and
*note os.pwrite(): d59.).  (Contributed by Pablo Galindo in
bpo-31368(4).)

The mode argument of *note os.makedirs(): 52c. no longer affects the
file permission bits of newly created intermediate-level directories.
(Contributed by Serhiy Storchaka in bpo-19930(5).)

*note os.dup2(): d5a. now returns the new file descriptor.  Previously,
‘None’ was always returned.  (Contributed by Benjamin Peterson in
bpo-32441(6).)

The structure returned by *note os.stat(): 26d. now contains the *note
st_fstype: d5b. attribute on Solaris and its derivatives.  (Contributed
by Jesús Cea Avión in bpo-32659(7).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28682

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25996

   (3) https://bugs.python.org/issue?@action=redirect&bpo=16500

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31368

   (5) https://bugs.python.org/issue?@action=redirect&bpo=19930

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32441

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32659


File: python.info,  Node: pathlib<11>,  Next: pdb<6>,  Prev: os<8>,  Up: 改良されたモジュール<7>

1.8.5.34 pathlib
................

The new *note Path.is_mount(): c0c. method is now available on POSIX
systems and can be used to determine whether a path is a mount point.
(Contributed by Cooper Ry Lees in bpo-30897(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30897


File: python.info,  Node: pdb<6>,  Next: py_compile<3>,  Prev: pathlib<11>,  Up: 改良されたモジュール<7>

1.8.5.35 pdb
............

*note pdb.set_trace(): 272. now takes an optional 'header' keyword-only
argument.  If given, it is printed to the console just before debugging
begins.  (Contributed by Barry Warsaw in bpo-31389(1).)

*note pdb: aa. command line now accepts ‘-m module_name’ as an
alternative to script file.  (Contributed by Mario Corchero in
bpo-32206(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31389

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32206


File: python.info,  Node: py_compile<3>,  Next: pydoc<3>,  Prev: pdb<6>,  Up: 改良されたモジュール<7>

1.8.5.36 py_compile
...................

*note py_compile.compile(): c1a. - and by extension, *note compileall:
21. - now respects the ‘SOURCE_DATE_EPOCH’ environment variable by
unconditionally creating ‘.pyc’ files for hash-based validation.  This
allows for guaranteeing reproducible builds(1) of ‘.pyc’ files when they
are created eagerly.  (Contributed by Bernhard M. Wiedemann in
bpo-29708(2).)

   ---------- Footnotes ----------

   (1) https://reproducible-builds.org/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29708


File: python.info,  Node: pydoc<3>,  Next: queue<2>,  Prev: py_compile<3>,  Up: 改良されたモジュール<7>

1.8.5.37 pydoc
..............

The pydoc server can now bind to an arbitrary hostname specified by the
new ‘-n’ command-line argument.  (Contributed by Feanil Patel in
bpo-31128(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31128


File: python.info,  Node: queue<2>,  Next: re<5>,  Prev: pydoc<3>,  Up: 改良されたモジュール<7>

1.8.5.38 queue
..............

The new *note SimpleQueue: d61. class is an unbounded FIFO queue.
(Contributed by Antoine Pitrou in bpo-14976(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14976


File: python.info,  Node: re<5>,  Next: signal<2>,  Prev: queue<2>,  Up: 改良されたモジュール<7>

1.8.5.39 re
...........

The flags *note re.ASCII: 83e, *note re.LOCALE: d63. and *note
re.UNICODE: d64. can be set within the scope of a group.  (Contributed
by Serhiy Storchaka in bpo-31690(1).)

*note re.split(): 5a2. now supports splitting on a pattern like ‘r'\b'’,
‘'^$'’ or ‘(?=-)’ that matches an empty string.  (Contributed by Serhiy
Storchaka in bpo-25054(2).)

Regular expressions compiled with the *note re.LOCALE: d63. flag no
longer depend on the locale at compile time.  Locale settings are
applied only when the compiled regular expression is used.  (Contributed
by Serhiy Storchaka in bpo-30215(3).)

*note FutureWarning: 659. is now emitted if a regular expression
contains character set constructs that will change semantically in the
future, such as nested sets and set operations.  (Contributed by Serhiy
Storchaka in bpo-30349(4).)

Compiled regular expression and match objects can now be copied using
*note copy.copy(): 757. and *note copy.deepcopy(): d65.  (Contributed by
Serhiy Storchaka in bpo-10076(5).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31690

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25054

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30215

   (4) https://bugs.python.org/issue?@action=redirect&bpo=30349

   (5) https://bugs.python.org/issue?@action=redirect&bpo=10076


File: python.info,  Node: signal<2>,  Next: socket<6>,  Prev: re<5>,  Up: 改良されたモジュール<7>

1.8.5.40 signal
...............

The new 'warn_on_full_buffer' argument to the *note
signal.set_wakeup_fd(): d67. function makes it possible to specify
whether Python prints a warning on stderr when the wakeup buffer
overflows.  (Contributed by Nathaniel J. Smith in bpo-30050(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30050


File: python.info,  Node: socket<6>,  Next: socketserver,  Prev: signal<2>,  Up: 改良されたモジュール<7>

1.8.5.41 socket
...............

The new *note socket.getblocking(): d69. method returns ‘True’ if the
socket is in blocking mode and ‘False’ otherwise.  (Contributed by Yury
Selivanov in bpo-32373(1).)

The new *note socket.close(): d6a. function closes the passed socket
file descriptor.  This function should be used instead of *note
os.close(): d6b. for better compatibility across platforms.
(Contributed by Christian Heimes in bpo-32454(2).)

The *note socket: d1. module now exposes the *note
socket.TCP_CONGESTION: d6c. (Linux 2.6.13), *note
socket.TCP_USER_TIMEOUT: d6c. (Linux 2.6.37), and *note
socket.TCP_NOTSENT_LOWAT: d6c. (Linux 3.12) constants.  (Contributed by
Omar Sandoval in bpo-26273(3) and Nathaniel J. Smith in bpo-29728(4).)

Support for *note socket.AF_VSOCK: d6d. sockets has been added to allow
communication between virtual machines and their hosts.  (Contributed by
Cathy Avery in bpo-27584(5).)

Sockets now auto-detect family, type and protocol from file descriptor
by default.  (Contributed by Christian Heimes in bpo-28134(6).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32373

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32454

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26273

   (4) https://bugs.python.org/issue?@action=redirect&bpo=29728

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27584

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28134


File: python.info,  Node: socketserver,  Next: sqlite3<7>,  Prev: socket<6>,  Up: 改良されたモジュール<7>

1.8.5.42 socketserver
.....................

*note socketserver.ThreadingMixIn.server_close: d6f. now waits until all
non-daemon threads complete.  *note
socketserver.ForkingMixIn.server_close: d6f. now waits until all child
processes complete.

Add a new *note socketserver.ForkingMixIn.block_on_close: d70. class
attribute to *note socketserver.ForkingMixIn: d71. and *note
socketserver.ThreadingMixIn: d3a. classes.  Set the class attribute to
‘False’ to get the pre-3.7 behaviour.


File: python.info,  Node: sqlite3<7>,  Next: ssl<6>,  Prev: socketserver,  Up: 改良されたモジュール<7>

1.8.5.43 sqlite3
................

*note sqlite3.Connection: 54d. now exposes the *note backup(): d73.
method when the underlying SQLite library is at version 3.6.11 or
higher.  (Contributed by Lele Gaifax in bpo-27645(1).)

The 'database' argument of *note sqlite3.connect(): 5a6. now accepts any
*note path-like object: 5a1, instead of just a string.  (Contributed by
Anders Lorentsen in bpo-31843(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27645

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31843


File: python.info,  Node: ssl<6>,  Next: string<2>,  Prev: sqlite3<7>,  Up: 改良されたモジュール<7>

1.8.5.44 ssl
............

The *note ssl: d5. module now uses OpenSSL's builtin API instead of
‘match_hostname()’ to check a host name or an IP address.  Values are
validated during TLS handshake.  Any certificate validation error
including failing the host name check now raises *note
SSLCertVerificationError: d75. and aborts the handshake with a proper
TLS Alert message.  The new exception contains additional information.
Host name validation can be customized with *note
SSLContext.hostname_checks_common_name: d76.  (Contributed by Christian
Heimes in bpo-31399(1).)

     注釈: The improved host name check requires a 'libssl'
     implementation compatible with OpenSSL 1.0.2 or 1.1.  Consequently,
     OpenSSL 0.9.8 and 1.0.1 are no longer supported (see *note
     サポート対象プラットフォームからの除外: d77. for more details).
     The ssl module is mostly compatible with LibreSSL 2.7.2 and newer.

The ‘ssl’ module no longer sends IP addresses in SNI TLS extension.
(Contributed by Christian Heimes in bpo-32185(2).)

‘match_hostname()’ no longer supports partial wildcards like
‘www*.example.org’.  (Contributed by Mandeep Singh in bpo-23033(3) and
Christian Heimes in bpo-31399(4).)

The default cipher suite selection of the ‘ssl’ module now uses a
blacklist approach rather than a hard-coded whitelist.  Python no longer
re-enables ciphers that have been blocked by OpenSSL security updates.
Default cipher suite selection can be configured at compile time.
(Contributed by Christian Heimes in bpo-31429(5).)

Validation of server certificates containing internationalized domain
names (IDNs) is now supported.  As part of this change, the *note
SSLSocket.server_hostname: d78. attribute now stores the expected
hostname in A-label form (‘"xn--pythn-mua.org"’), rather than the
U-label form (‘"pythön.org"’).  (Contributed by Nathaniel J. Smith and
Christian Heimes in bpo-28414(6).)

The ‘ssl’ module has preliminary and experimental support for TLS 1.3
and OpenSSL 1.1.1.  At the time of Python 3.7.0 release, OpenSSL 1.1.1
is still under development and TLS 1.3 hasn't been finalized yet.  The
TLS 1.3 handshake and protocol behaves slightly differently than TLS 1.2
and earlier, see *note TLS 1.3: d79.  (Contributed by Christian Heimes
in bpo-32947(7), bpo-20995(8), bpo-29136(9), bpo-30622(10) and
bpo-33618(11))

*note SSLSocket: ae7. and *note SSLObject: d7a. no longer have a public
constructor.  Direct instantiation was never a documented and supported
feature.  Instances must be created with *note SSLContext: 357. methods
*note wrap_socket(): 748. and *note wrap_bio(): d7b.  (Contributed by
Christian Heimes in bpo-32951(12))

OpenSSL 1.1 APIs for setting the minimum and maximum TLS protocol
version are available as *note SSLContext.minimum_version: a70. and
*note SSLContext.maximum_version: a71.  Supported protocols are
indicated by several new flags, such as *note HAS_TLSv1_1: d7c.
(Contributed by Christian Heimes in bpo-32609(13).)

Added *note ssl.SSLContext.post_handshake_auth: c26. to enable and *note
ssl.SSLSocket.verify_client_post_handshake(): c27. to initiate TLS 1.3
post-handshake authentication.  (Contributed by Christian Heimes in
gh-78851(14).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31399

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32185

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23033

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31399

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31429

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28414

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32947

   (8) https://bugs.python.org/issue?@action=redirect&bpo=20995

   (9) https://bugs.python.org/issue?@action=redirect&bpo=29136

   (10) https://bugs.python.org/issue?@action=redirect&bpo=30622

   (11) https://bugs.python.org/issue?@action=redirect&bpo=33618

   (12) https://bugs.python.org/issue?@action=redirect&bpo=32951

   (13) https://bugs.python.org/issue?@action=redirect&bpo=32609

   (14) https://github.com/python/cpython/issues/78851


File: python.info,  Node: string<2>,  Next: subprocess<2>,  Prev: ssl<6>,  Up: 改良されたモジュール<7>

1.8.5.45 string
...............

*note string.Template: 897. now lets you to optionally modify the
regular expression pattern for braced placeholders and non-braced
placeholders separately.  (Contributed by Barry Warsaw in
bpo-1198569(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1198569


File: python.info,  Node: subprocess<2>,  Next: sys<8>,  Prev: string<2>,  Up: 改良されたモジュール<7>

1.8.5.46 subprocess
...................

The *note subprocess.run(): d7f. function accepts the new
'capture_output' keyword argument.  When true, stdout and stderr will be
captured.  This is equivalent to passing *note subprocess.PIPE: d80. as
'stdout' and 'stderr' arguments.  (Contributed by Bo Bayles in
bpo-32102(1).)

The ‘subprocess.run’ function and the *note subprocess.Popen: 4b7.
constructor now accept the 'text' keyword argument as an alias to
'universal_newlines'.  (Contributed by Andrew Clegg in bpo-31756(2).)

On Windows the default for 'close_fds' was changed from ‘False’ to
‘True’ when redirecting the standard handles.  It's now possible to set
'close_fds' to true when redirecting the standard handles.  See *note
subprocess.Popen: 4b7.  This means that 'close_fds' now defaults to
‘True’ on all supported platforms.  (Contributed by Segev Finer in
bpo-19764(3).)

The subprocess module is now more graceful when handling *note
KeyboardInterrupt: bc5. during *note subprocess.call(): d81, *note
subprocess.run(): d7f, or in a *note Popen: 4b7. context manager.  It
now waits a short amount of time for the child to exit, before
continuing the handling of the ‘KeyboardInterrupt’ exception.
(Contributed by Gregory P. Smith in bpo-25942(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32102

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31756

   (3) https://bugs.python.org/issue?@action=redirect&bpo=19764

   (4) https://bugs.python.org/issue?@action=redirect&bpo=25942


File: python.info,  Node: sys<8>,  Next: time<5>,  Prev: subprocess<2>,  Up: 改良されたモジュール<7>

1.8.5.47 sys
............

The new *note sys.breakpointhook(): cd1. hook function is called by the
built-in *note breakpoint(): 271.  (Contributed by Barry Warsaw in
bpo-31353(1).)

On Android, the new *note sys.getandroidapilevel(): d83. returns the
build-time Android API version.  (Contributed by Victor Stinner in
bpo-28740(2).)

The new *note sys.get_coroutine_origin_tracking_depth(): d84. function
returns the current coroutine origin tracking depth, as set by the new
*note sys.set_coroutine_origin_tracking_depth(): d85.  *note asyncio: b.
has been converted to use this new API instead of the deprecated
‘sys.set_coroutine_wrapper()’.  (Contributed by Nathaniel J. Smith in
bpo-32591(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31353

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28740

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32591


File: python.info,  Node: time<5>,  Next: tkinter<6>,  Prev: sys<8>,  Up: 改良されたモジュール<7>

1.8.5.48 time
.............

PEP 564(1) adds six new functions with nanosecond resolution to the
*note time: f4. module:

   * *note time.clock_gettime_ns(): cdb.

   * *note time.clock_settime_ns(): cdc.

   * *note time.monotonic_ns(): cdd.

   * *note time.perf_counter_ns(): cde.

   * *note time.process_time_ns(): cdf.

   * *note time.time_ns(): ce0.

New clock identifiers have been added:

   * *note time.CLOCK_BOOTTIME: d87. (Linux): Identical to *note
     time.CLOCK_MONOTONIC: 8a8, except it also includes any time that
     the system is suspended.

   * *note time.CLOCK_PROF: d88. (FreeBSD, NetBSD and OpenBSD):
     High-resolution per-process CPU timer.

   * *note time.CLOCK_UPTIME: d89. (FreeBSD, OpenBSD): Time whose
     absolute value is the time the system has been running and not
     suspended, providing accurate uptime measurement.

The new *note time.thread_time(): b30. and *note time.thread_time_ns():
d8a. functions can be used to get per-thread CPU time measurements.
(Contributed by Antoine Pitrou in bpo-32025(2).)

The new *note time.pthread_getcpuclockid(): d8b. function returns the
clock ID of the thread-specific CPU-time clock.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0564/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32025


File: python.info,  Node: tkinter<6>,  Next: tracemalloc<2>,  Prev: time<5>,  Up: 改良されたモジュール<7>

1.8.5.49 tkinter
................

The new *note tkinter.ttk.Spinbox: d8d. class is now available.
(Contributed by Alan Moore in bpo-32585(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32585


File: python.info,  Node: tracemalloc<2>,  Next: types<5>,  Prev: tkinter<6>,  Up: 改良されたモジュール<7>

1.8.5.50 tracemalloc
....................

*note tracemalloc.Traceback: d8f. behaves more like regular tracebacks,
sorting the frames from oldest to most recent.  *note
Traceback.format(): d90. now accepts negative 'limit', truncating the
result to the ‘abs(limit)’ oldest frames.  To get the old behaviour, use
the new 'most_recent_first' argument to ‘Traceback.format()’.
(Contributed by Jesse Bakker in bpo-32121(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32121


File: python.info,  Node: types<5>,  Next: unicodedata<7>,  Prev: tracemalloc<2>,  Up: 改良されたモジュール<7>

1.8.5.51 types
..............

The new *note WrapperDescriptorType: d92, *note MethodWrapperType: 85b,
*note MethodDescriptorType: d93, and *note ClassMethodDescriptorType:
d94. classes are now available.  (Contributed by Manuel Krebber and
Guido van Rossum in bpo-29377(1), and Serhiy Storchaka in bpo-32265(2).)

The new *note types.resolve_bases(): d95. function resolves MRO entries
dynamically as specified by PEP 560(3).  (Contributed by Ivan Levkivskyi
in bpo-32717(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29377

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32265

   (3) https://peps.python.org/pep-0560/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32717


File: python.info,  Node: unicodedata<7>,  Next: unittest<8>,  Prev: types<5>,  Up: 改良されたモジュール<7>

1.8.5.52 unicodedata
....................

The internal *note unicodedata: 10b. database has been upgraded to use
Unicode 11(1).  (Contributed by Benjamin Peterson.)

   ---------- Footnotes ----------

   (1) https://www.unicode.org/versions/Unicode11.0.0/


File: python.info,  Node: unittest<8>,  Next: unittest mock,  Prev: unicodedata<7>,  Up: 改良されたモジュール<7>

1.8.5.53 unittest
.................

The new ‘-k’ command-line option allows filtering tests by a name
substring or a Unix shell-like pattern.  For example, ‘python -m
unittest -k foo’ runs ‘foo_tests.SomeTest.test_something’,
‘bar_tests.SomeTest.test_foo’, but not
‘bar_tests.FooTest.test_something’.  (Contributed by Jonas Haag in
bpo-32071(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32071


File: python.info,  Node: unittest mock,  Next: urllib parse<5>,  Prev: unittest<8>,  Up: 改良されたモジュール<7>

1.8.5.54 unittest.mock
......................

The *note sentinel: d99. attributes now preserve their identity when
they are *note copied: 29. or *note pickled: ab.  (Contributed by Serhiy
Storchaka in bpo-20804(1).)

The new *note seal(): d9a. function allows sealing *note Mock: c3f.
instances, which will disallow further creation of attribute mocks.  The
seal is applied recursively to all attributes that are themselves mocks.
(Contributed by Mario Corchero in bpo-30541(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20804

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30541


File: python.info,  Node: urllib parse<5>,  Next: uu,  Prev: unittest mock,  Up: 改良されたモジュール<7>

1.8.5.55 urllib.parse
.....................

*note urllib.parse.quote(): d9c. has been updated from RFC 2396(1) to
RFC 3986(2), adding ‘~’ to the set of characters that are never quoted
by default.  (Contributed by Christian Theune and Ratnadeep Debnath in
bpo-16285(3).)

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2396.html

   (2) https://datatracker.ietf.org/doc/html/rfc3986.html

   (3) https://bugs.python.org/issue?@action=redirect&bpo=16285


File: python.info,  Node: uu,  Next: uuid<4>,  Prev: urllib parse<5>,  Up: 改良されたモジュール<7>

1.8.5.56 uu
...........

The ‘uu.encode()’ function now accepts an optional 'backtick' keyword
argument.  When it's true, zeros are represented by ‘'`'’ instead of
spaces.  (Contributed by Xiang Zhang in bpo-30103(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30103


File: python.info,  Node: uuid<4>,  Next: warnings<3>,  Prev: uu,  Up: 改良されたモジュール<7>

1.8.5.57 uuid
.............

The new *note UUID.is_safe: d9f. attribute relays information from the
platform about whether generated UUIDs are generated with a
multiprocessing-safe method.  (Contributed by Barry Warsaw in
bpo-22807(1).)

*note uuid.getnode(): da0. now prefers universally administered MAC
addresses over locally administered MAC addresses.  This makes a better
guarantee for global uniqueness of UUIDs returned from *note
uuid.uuid1(): da1.  If only locally administered MAC addresses are
available, the first such one found is returned.  (Contributed by Barry
Warsaw in bpo-32107(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22807

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32107


File: python.info,  Node: warnings<3>,  Next: xml<5>,  Prev: uuid<4>,  Up: 改良されたモジュール<7>

1.8.5.58 warnings
.................

The initialization of the default warnings filters has changed as
follows:

   * warnings enabled via command line options (including those for
     *note -b: 7f9. and the new CPython-specific *note -X: 16f. ‘dev’
     option) are always passed to the warnings machinery via the *note
     sys.warnoptions: 3f5. attribute.

   * warnings filters enabled via the command line or the environment
     now have the following order of precedence:

        * the ‘BytesWarning’ filter for *note -b: 7f9. (or ‘-bb’)

        * any filters specified with the *note -W: ac6. option

        * any filters specified with the *note PYTHONWARNINGS: da3.
          environment variable

        * any other CPython specific filters (e.g.  the ‘default’ filter
          added for the new ‘-X dev’ mode)

        * any implicit filters defined directly by the warnings
          machinery

   * in *note CPython debug builds: 509, all warnings are now displayed
     by default (the implicit filter list is empty)

(Contributed by Nick Coghlan and Victor Stinner in bpo-20361(1),
bpo-32043(2), and bpo-32230(3).)

Deprecation warnings are once again shown by default in single-file
scripts and at the interactive prompt.  See *note PEP 565; Show
DeprecationWarning in __main__: cc4. for details.  (Contributed by Nick
Coghlan in bpo-31975(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20361

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32043

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32230

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31975


File: python.info,  Node: xml<5>,  Next: xml etree,  Prev: warnings<3>,  Up: 改良されたモジュール<7>

1.8.5.59 xml
............

As mitigation against DTD and external entity retrieval, the *note
xml.dom.minidom: 128. and *note xml.sax: 12f. modules no longer process
external entities by default.  (Contributed by Christian Heimes in
gh-61441(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/61441


File: python.info,  Node: xml etree,  Next: xmlrpc server,  Prev: xml<5>,  Up: 改良されたモジュール<7>

1.8.5.60 xml.etree
..................

*note ElementPath: da6. predicates in the ‘find()’ methods can now
compare text of the current node with ‘[. = "text"]’, not only text in
children.  Predicates also allow adding spaces for better readability.
(Contributed by Stefan Behnel in bpo-31648(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31648


File: python.info,  Node: xmlrpc server,  Next: zipapp,  Prev: xml etree,  Up: 改良されたモジュール<7>

1.8.5.61 xmlrpc.server
......................

‘SimpleXMLRPCDispatcher.register_function()’ can now be used as a
decorator.  (Contributed by Xiang Zhang in bpo-7769(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=7769


File: python.info,  Node: zipapp,  Next: zipfile<3>,  Prev: xmlrpc server,  Up: 改良されたモジュール<7>

1.8.5.62 zipapp
...............

Function *note create_archive(): da9. now accepts an optional 'filter'
argument to allow the user to select which files should be included in
the archive.  (Contributed by Irmen de Jong in bpo-31072(1).)

Function *note create_archive(): da9. now accepts an optional
'compressed' argument to generate a compressed archive.  A command line
option ‘--compress’ has also been added to support compression.
(Contributed by Zhiming Wang in bpo-31638(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31072

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31638


File: python.info,  Node: zipfile<3>,  Prev: zipapp,  Up: 改良されたモジュール<7>

1.8.5.63 zipfile
................

*note ZipFile: 8d3. now accepts the new 'compresslevel' parameter to
control the compression level.  (Contributed by Bo Bayles in
bpo-21417(1).)

Subdirectories in archives created by ‘ZipFile’ are now stored in
alphabetical order.  (Contributed by Bernhard M. Wiedemann in
bpo-30693(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21417

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30693


File: python.info,  Node: C API の変更<11>,  Next: Build Changes<6>,  Prev: 改良されたモジュール<7>,  Up: What's New In Python 3 7

1.8.6 C API の変更
------------------

A new API for thread-local storage has been implemented.  See *note PEP
539; スレッドローカルストレージのための新しい C API: cc5. for an
overview and *note スレッド固有ストレージ (Thread Specific Storage, TSS)
API: cd5. for a complete reference.  (Contributed by Masayuki Yamamoto
in bpo-25658(1).)

The new *note context variables: cb7. functionality exposes a number of
*note new C APIs: cf0.

The new *note PyImport_GetModule(): dac. function returns the previously
imported module with the given name.  (Contributed by Eric Snow in
bpo-28411(2).)

The new *note Py_RETURN_RICHCOMPARE: dad. macro eases writing rich
comparison functions.  (Contributed by Petr Victorin in bpo-23699(3).)

The new *note Py_UNREACHABLE: dae. macro can be used to mark unreachable
code paths.  (Contributed by Barry Warsaw in bpo-31338(4).)

The *note tracemalloc: 105. now exposes a C API through the new *note
PyTraceMalloc_Track(): daf. and *note PyTraceMalloc_Untrack(): db0.
functions.  (Contributed by Victor Stinner in bpo-30054(5).)

The new *note import__find__load__start: db1. and *note
import__find__load__done: db1. static markers can be used to trace
module imports.  (Contributed by Christian Heimes in bpo-31574(6).)

The fields ‘name’ and ‘doc’ of structures *note PyMemberDef: 771, *note
PyGetSetDef: db2, *note PyStructSequence_Field: db3, *note
PyStructSequence_Desc: db4, and ‘wrapperbase’ are now of type ‘const
char *’ rather of ‘char *’.  (Contributed by Serhiy Storchaka in
bpo-28761(7).)

The result of *note PyUnicode_AsUTF8AndSize(): a99. and *note
PyUnicode_AsUTF8(): 424. is now of type ‘const char *’ rather of ‘char
*’.  (Contributed by Serhiy Storchaka in bpo-28769(8).)

The result of *note PyMapping_Keys(): db5, *note PyMapping_Values():
db6. and *note PyMapping_Items(): db7. is now always a list, rather than
a list or a tuple.  (Contributed by Oren Milman in bpo-28280(9).)

Added functions *note PySlice_Unpack(): 432. and *note
PySlice_AdjustIndices(): 433.  (Contributed by Serhiy Storchaka in
bpo-27867(10).)

*note PyOS_AfterFork(): 42f. is deprecated in favour of the new
functions *note PyOS_BeforeFork(): db8, *note PyOS_AfterFork_Parent():
db9. and *note PyOS_AfterFork_Child(): 430.  (Contributed by Antoine
Pitrou in bpo-16500(11).)

The ‘PyExc_RecursionErrorInst’ singleton that was part of the public API
has been removed as its members being never cleared may cause a segfault
during finalization of the interpreter.  Contributed by Xavier de Gaye
in bpo-22898(12) and bpo-30697(13).

Added C API support for timezones with timezone constructors *note
PyTimeZone_FromOffset(): dba. and *note PyTimeZone_FromOffsetAndName():
dbb, and access to the UTC singleton with *note PyDateTime_TimeZone_UTC:
dbc.  Contributed by Paul Ganssle in bpo-10381(14).

The type of results of ‘PyThread_start_new_thread()’ and
‘PyThread_get_thread_ident()’, and the 'id' parameter of *note
PyThreadState_SetAsyncExc(): dbd. changed from long to unsigned long.
(Contributed by Serhiy Storchaka in bpo-6532(15).)

*note PyUnicode_AsWideCharString(): ab9. now raises a *note ValueError:
2ec. if the second argument is ‘NULL’ and the wchar_t* string contains
null characters.  (Contributed by Serhiy Storchaka in bpo-30708(16).)

Changes to the startup sequence and the management of dynamic memory
allocators mean that the long documented requirement to call *note
Py_Initialize(): 460. before calling most C API functions is now relied
on more heavily, and failing to abide by it may lead to segfaults in
embedding applications.  See the *note Python 3.7 への移植: cc8. section
in this document and the *note Python 初期化以前: dbe. section in the C
API documentation for more details.

The new *note PyInterpreterState_GetID(): dbf. returns the unique ID for
a given interpreter.  (Contributed by Eric Snow in bpo-29102(17).)

*note Py_DecodeLocale(): dc0, *note Py_EncodeLocale(): dc1. now use the
UTF-8 encoding when the *note UTF-8 mode: cc1. is enabled.  (Contributed
by Victor Stinner in bpo-29240(18).)

*note PyUnicode_DecodeLocaleAndSize(): dc2. and *note
PyUnicode_EncodeLocale(): dc3. now use the current locale encoding for
‘surrogateescape’ error handler.  (Contributed by Victor Stinner in
bpo-29240(19).)

The 'start' and 'end' parameters of *note PyUnicode_FindChar(): ab6. are
now adjusted to behave like string slices.  (Contributed by Xiang Zhang
in bpo-28822(20).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25658

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28411

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23699

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31338

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30054

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31574

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28761

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28769

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28280

   (10) https://bugs.python.org/issue?@action=redirect&bpo=27867

   (11) https://bugs.python.org/issue?@action=redirect&bpo=16500

   (12) https://bugs.python.org/issue?@action=redirect&bpo=22898

   (13) https://bugs.python.org/issue?@action=redirect&bpo=30697

   (14) https://bugs.python.org/issue?@action=redirect&bpo=10381

   (15) https://bugs.python.org/issue?@action=redirect&bpo=6532

   (16) https://bugs.python.org/issue?@action=redirect&bpo=30708

   (17) https://bugs.python.org/issue?@action=redirect&bpo=29102

   (18) https://bugs.python.org/issue?@action=redirect&bpo=29240

   (19) https://bugs.python.org/issue?@action=redirect&bpo=29240

   (20) https://bugs.python.org/issue?@action=redirect&bpo=28822


File: python.info,  Node: Build Changes<6>,  Next: 最適化<8>,  Prev: C API の変更<11>,  Up: What's New In Python 3 7

1.8.7 Build Changes
-------------------

Support for building ‘--without-threads’ has been removed.  The *note
threading: f3. module is now always available.  (Contributed by Antoine
Pitrou in bpo-31370(1).).

A full copy of libffi is no longer bundled for use when building the
*note _ctypes: 2e. module on non-OSX UNIX platforms.  An installed copy
of libffi is now required when building ‘_ctypes’ on such platforms.
(Contributed by Zachary Ware in bpo-27979(2).)

The Windows build process no longer depends on Subversion to pull in
external sources, a Python script is used to download zipfiles from
GitHub instead.  If Python 3.6 is not found on the system (via ‘py
-3.6’), NuGet is used to download a copy of 32-bit Python for this
purpose.  (Contributed by Zachary Ware in bpo-30450(3).)

The *note ssl: d5. module requires OpenSSL 1.0.2 or 1.1 compatible
libssl.  OpenSSL 1.0.1 has reached end of lifetime on 2016-12-31 and is
no longer supported.  LibreSSL is temporarily not supported as well.
LibreSSL releases up to version 2.6.4 are missing required OpenSSL 1.0.2
APIs.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31370

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27979

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30450


File: python.info,  Node: 最適化<8>,  Next: その他の CPython の実装の変更<2>,  Prev: Build Changes<6>,  Up: What's New In Python 3 7

1.8.8 最適化
------------

The overhead of calling many methods of various standard library classes
implemented in C has been significantly reduced by porting more code to
use the ‘METH_FASTCALL’ convention.  (Contributed by Victor Stinner in
bpo-29300(1), bpo-29507(2), bpo-29452(3), and bpo-29286(4).)

Various optimizations have reduced Python startup time by 10% on Linux
and up to 30% on macOS. (Contributed by Victor Stinner, INADA Naoki in
bpo-29585(5), and Ivan Levkivskyi in bpo-31333(6).)

Method calls are now up to 20% faster due to the bytecode changes which
avoid creating bound method instances.  (Contributed by Yury Selivanov
and INADA Naoki in bpo-26110(7).)  The *note asyncio: b. module received
a number of notable optimizations for commonly used functions:

   * The *note asyncio.get_event_loop(): 2f2. function has been
     reimplemented in C to make it up to 15 times faster.  (Contributed
     by Yury Selivanov in bpo-32296(8).)

   * *note asyncio.Future: dc6. callback management has been optimized.
     (Contributed by Yury Selivanov in bpo-32348(9).)

   * *note asyncio.gather(): 813. is now up to 15% faster.  (Contributed
     by Yury Selivanov in bpo-32355(10).)

   * *note asyncio.sleep(): c64. is now up to 2 times faster when the
     'delay' argument is zero or negative.  (Contributed by Andrew
     Svetlov in bpo-32351(11).)

   * The performance overhead of asyncio debug mode has been reduced.
     (Contributed by Antoine Pitrou in bpo-31970(12).)

As a result of *note PEP 560 work: cbc, the import time of *note typing:
10a. has been reduced by a factor of 7, and many typing operations are
now faster.  (Contributed by Ivan Levkivskyi in bpo-32226(13).)

*note sorted(): dc7. and *note list.sort(): dc8. have been optimized for
common cases to be up to 40-75% faster.  (Contributed by Elliot
Gorokhovsky in bpo-28685(14).)

*note dict.copy(): dc9. is now up to 5.5 times faster.  (Contributed by
Yury Selivanov in bpo-31179(15).)

*note hasattr(): 6f9. and *note getattr(): dca. are now about 4 times
faster when 'name' is not found and 'obj' does not override *note
object.__getattr__(): 6fa. or *note object.__getattribute__(): dcb.
(Contributed by INADA Naoki in bpo-32544(16).)

Searching for certain Unicode characters (like Ukrainian capital "Є") in
a string was up to 25 times slower than searching for other characters.
It is now only 3 times slower in the worst case.  (Contributed by Serhiy
Storchaka in bpo-24821(17).)

The *note collections.namedtuple(): 4e0. factory has been reimplemented
to make the creation of named tuples 4 to 6 times faster.  (Contributed
by Jelle Zijlstra with further improvements by INADA Naoki, Serhiy
Storchaka, and Raymond Hettinger in bpo-28638(18).)

*note datetime.date.fromordinal(): dcc. and *note
datetime.date.fromtimestamp(): dcd. are now up to 30% faster in the
common case.  (Contributed by Paul Ganssle in bpo-32403(19).)

The *note os.fwalk(): d52. function is now up to 2 times faster thanks
to the use of *note os.scandir(): c54.  (Contributed by Serhiy Storchaka
in bpo-25996(20).)

The speed of the *note shutil.rmtree(): 356. function has been improved
by 20-40% thanks to the use of the *note os.scandir(): c54. function.
(Contributed by Serhiy Storchaka in bpo-28564(21).)

Optimized case-insensitive matching and searching of *note regular
expressions: be.  Searching some patterns can now be up to 20 times
faster.  (Contributed by Serhiy Storchaka in bpo-30285(22).)

*note re.compile(): dce. now converts ‘flags’ parameter to int object if
it is ‘RegexFlag’.  It is now as fast as Python 3.5, and faster than
Python 3.6 by about 10% depending on the pattern.  (Contributed by INADA
Naoki in bpo-31671(23).)

The *note modify(): dcf. methods of classes *note
selectors.EpollSelector: dd0, *note selectors.PollSelector: dd1. and
*note selectors.DevpollSelector: dd2. may be around 10% faster under
heavy loads.  (Contributed by Giampaolo Rodola' in bpo-30014(24))

Constant folding has been moved from the peephole optimizer to the new
AST optimizer, which is able perform optimizations more consistently.
(Contributed by Eugene Toder and INADA Naoki in bpo-29469(25) and
bpo-11549(26).)

Most functions and methods in *note abc: 4. have been rewritten in C.
This makes creation of abstract base classes, and calling *note
isinstance(): 2ad. and *note issubclass(): 9c4. on them 1.5x faster.
This also reduces Python start-up time by up to 10%.  (Contributed by
Ivan Levkivskyi and INADA Naoki in bpo-31333(27))

Significant speed improvements to alternate constructors for *note
datetime.date: 1fa. and *note datetime.datetime: 4e2. by using fast-path
constructors when not constructing subclasses.  (Contributed by Paul
Ganssle in bpo-32403(28))

The speed of comparison of *note array.array: 4be. instances has been
improved considerably in certain cases.  It is now from 10x to 70x
faster when comparing arrays holding values of the same integer type.
(Contributed by Adrian Wielgosik in bpo-24700(29).)

The *note math.erf(): dd3. and *note math.erfc(): dd4. functions now use
the (faster) C library implementation on most platforms.  (Contributed
by Serhiy Storchaka in bpo-26121(30).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29300

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29507

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29452

   (4) https://bugs.python.org/issue?@action=redirect&bpo=29286

   (5) https://bugs.python.org/issue?@action=redirect&bpo=29585

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31333

   (7) https://bugs.python.org/issue?@action=redirect&bpo=26110

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32296

   (9) https://bugs.python.org/issue?@action=redirect&bpo=32348

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32355

   (11) https://bugs.python.org/issue?@action=redirect&bpo=32351

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31970

   (13) https://bugs.python.org/issue?@action=redirect&bpo=32226

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28685

   (15) https://bugs.python.org/issue?@action=redirect&bpo=31179

   (16) https://bugs.python.org/issue?@action=redirect&bpo=32544

   (17) https://bugs.python.org/issue?@action=redirect&bpo=24821

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28638

   (19) https://bugs.python.org/issue?@action=redirect&bpo=32403

   (20) https://bugs.python.org/issue?@action=redirect&bpo=25996

   (21) https://bugs.python.org/issue?@action=redirect&bpo=28564

   (22) https://bugs.python.org/issue?@action=redirect&bpo=30285

   (23) https://bugs.python.org/issue?@action=redirect&bpo=31671

   (24) https://bugs.python.org/issue?@action=redirect&bpo=30014

   (25) https://bugs.python.org/issue?@action=redirect&bpo=29469

   (26) https://bugs.python.org/issue?@action=redirect&bpo=11549

   (27) https://bugs.python.org/issue?@action=redirect&bpo=31333

   (28) https://bugs.python.org/issue?@action=redirect&bpo=32403

   (29) https://bugs.python.org/issue?@action=redirect&bpo=24700

   (30) https://bugs.python.org/issue?@action=redirect&bpo=26121


File: python.info,  Node: その他の CPython の実装の変更<2>,  Next: 非推奨の Python の挙動,  Prev: 最適化<8>,  Up: What's New In Python 3 7

1.8.9 その他の CPython の実装の変更
-----------------------------------

   * Trace hooks may now opt out of receiving the ‘line’ and opt into
     receiving the ‘opcode’ events from the interpreter by setting the
     corresponding new *note f_trace_lines: dd6. and *note
     f_trace_opcodes: dd7. attributes on the frame being traced.
     (Contributed by Nick Coghlan in bpo-31344(1).)

   * Fixed some consistency problems with namespace package module
     attributes.  Namespace module objects now have an ‘__file__’ that
     is set to ‘None’ (previously unset), and their ‘__spec__.origin’ is
     also set to ‘None’ (previously the string ‘"namespace"’).  See
     bpo-32305(2).  Also, the namespace module object's
     ‘__spec__.loader’ is set to the same value as ‘__loader__’
     (previously, the former was set to ‘None’).  See bpo-32303(3).

   * The *note locals(): 46f. dictionary now displays in the lexical
     order that variables were defined.  Previously, the order was
     undefined.  (Contributed by Raymond Hettinger in bpo-32690(4).)

   * The ‘distutils’ ‘upload’ command no longer tries to change CR
     end-of-line characters to CRLF. This fixes a corruption issue with
     sdists that ended with a byte equivalent to CR. (Contributed by Bo
     Bayles in bpo-32304(5).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31344

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32305

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32303

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32690

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32304


File: python.info,  Node: 非推奨の Python の挙動,  Next: 非推奨の Python モジュール、関数、メソッド,  Prev: その他の CPython の実装の変更<2>,  Up: What's New In Python 3 7

1.8.10 非推奨の Python の挙動
-----------------------------

Yield expressions (both ‘yield’ and ‘yield from’ clauses) are now
deprecated in comprehensions and generator expressions (aside from the
iterable expression in the leftmost ‘for’ clause).  This ensures that
comprehensions always immediately return a container of the appropriate
type (rather than potentially returning a *note generator iterator: dd9.
object), while generator expressions won't attempt to interleave their
implicit output with the output from any explicit yield expressions.  In
Python 3.7, such expressions emit *note DeprecationWarning: 1a3. when
compiled, in Python 3.8 this will be a *note SyntaxError: 18e.
(Contributed by Serhiy Storchaka in bpo-10544(1).)

Returning a subclass of *note complex: 197. from *note
object.__complex__(): 7fd. is deprecated and will be an error in future
Python versions.  This makes ‘__complex__()’ consistent with *note
object.__int__(): 19d. and *note object.__float__(): bc1.  (Contributed
by Serhiy Storchaka in bpo-28894(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10544

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28894


File: python.info,  Node: 非推奨の Python モジュール、関数、メソッド,  Next: C API の非推奨の関数ならびに型,  Prev: 非推奨の Python の挙動,  Up: What's New In Python 3 7

1.8.11 非推奨の Python モジュール、関数、メソッド
-------------------------------------------------

* Menu:

* aifc::
* asyncio: asyncio<11>.
* collections: collections<3>.
* dbm: dbm<3>.
* enum: enum<6>.
* gettext: gettext<2>.
* importlib: importlib<5>.
* locale: locale<5>.
* macpath::
* threading: threading<6>.
* socket: socket<7>.
* ssl: ssl<7>.
* sunau::
* sys: sys<9>.
* wave::


File: python.info,  Node: aifc,  Next: asyncio<11>,  Up: 非推奨の Python モジュール、関数、メソッド

1.8.11.1 aifc
.............

‘aifc.openfp()’ has been deprecated and will be removed in Python 3.9.
Use ‘aifc.open()’ instead.  (Contributed by Brian Curtin in
bpo-31985(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31985


File: python.info,  Node: asyncio<11>,  Next: collections<3>,  Prev: aifc,  Up: 非推奨の Python モジュール、関数、メソッド

1.8.11.2 asyncio
................

Support for directly ‘await’-ing instances of *note asyncio.Lock: c66.
and other asyncio synchronization primitives has been deprecated.  An
asynchronous context manager must be used in order to acquire and
release the synchronization resource.  (Contributed by Andrew Svetlov in
bpo-32253(1).)

The ‘asyncio.Task.current_task()’ and ‘asyncio.Task.all_tasks()’ methods
have been deprecated.  (Contributed by Andrew Svetlov in bpo-32250(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32253

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32250


File: python.info,  Node: collections<3>,  Next: dbm<3>,  Prev: asyncio<11>,  Up: 非推奨の Python モジュール、関数、メソッド

1.8.11.3 collections
....................

In Python 3.8, the abstract base classes in *note collections.abc: 1f.
will no longer be exposed in the regular *note collections: 1e. module.
This will help create a clearer distinction between the concrete classes
and the abstract base classes.  (Contributed by Serhiy Storchaka in
bpo-25988(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25988


File: python.info,  Node: dbm<3>,  Next: enum<6>,  Prev: collections<3>,  Up: 非推奨の Python モジュール、関数、メソッド

1.8.11.4 dbm
............

*note dbm.dumb: 36. now supports reading read-only files and no longer
writes the index file when it is not changed.  A deprecation warning is
now emitted if the index file is missing and recreated in the ‘'r'’ and
‘'w'’ modes (this will be an error in future Python releases).
(Contributed by Serhiy Storchaka in bpo-28847(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28847


File: python.info,  Node: enum<6>,  Next: gettext<2>,  Prev: dbm<3>,  Up: 非推奨の Python モジュール、関数、メソッド

1.8.11.5 enum
.............

In Python 3.8, attempting to check for non-Enum objects in *note Enum:
842. classes will raise a *note TypeError: 198. (e.g.  ‘1 in Color’);
similarly, attempting to check for non-Flag objects in a *note Flag:
835. member will raise *note TypeError: 198. (e.g.  ‘1 in Perm.RW’);
currently, both operations return *note False: d2b. instead.
(Contributed by Ethan Furman in bpo-33217(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33217


File: python.info,  Node: gettext<2>,  Next: importlib<5>,  Prev: enum<6>,  Up: 非推奨の Python モジュール、関数、メソッド

1.8.11.6 gettext
................

Using non-integer value for selecting a plural form in *note gettext:
67. is now deprecated.  It never correctly worked.  (Contributed by
Serhiy Storchaka in bpo-28692(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28692


File: python.info,  Node: importlib<5>,  Next: locale<5>,  Prev: gettext<2>,  Up: 非推奨の Python モジュール、関数、メソッド

1.8.11.7 importlib
..................

Methods ‘MetaPathFinder.find_module()’ (replaced by *note
MetaPathFinder.find_spec(): a68.) and ‘PathEntryFinder.find_loader()’
(replaced by *note PathEntryFinder.find_spec(): a6c.) both deprecated in
Python 3.4 now emit *note DeprecationWarning: 1a3.  (Contributed by
Matthias Bussonnier in bpo-29576(1).)

The *note importlib.abc.ResourceLoader: de2. ABC has been deprecated in
favour of ‘importlib.abc.ResourceReader’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29576


File: python.info,  Node: locale<5>,  Next: macpath,  Prev: importlib<5>,  Up: 非推奨の Python モジュール、関数、メソッド

1.8.11.8 locale
...............

‘locale.format()’ has been deprecated, use *note locale.format_string():
742. instead.  (Contributed by Garvit in bpo-10379(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10379


File: python.info,  Node: macpath,  Next: threading<6>,  Prev: locale<5>,  Up: 非推奨の Python モジュール、関数、メソッド

1.8.11.9 macpath
................

The ‘macpath’ is now deprecated and will be removed in Python 3.8.
(Contributed by Chi Hsuan Yen in bpo-9850(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9850


File: python.info,  Node: threading<6>,  Next: socket<7>,  Prev: macpath,  Up: 非推奨の Python モジュール、関数、メソッド

1.8.11.10 threading
...................

‘dummy_threading’ and ‘_dummy_thread’ have been deprecated.  It is no
longer possible to build Python with threading disabled.  Use *note
threading: f3. instead.  (Contributed by Antoine Pitrou in
bpo-31370(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31370


File: python.info,  Node: socket<7>,  Next: ssl<7>,  Prev: threading<6>,  Up: 非推奨の Python モジュール、関数、メソッド

1.8.11.11 socket
................

The silent argument value truncation in *note socket.htons(): a7f. and
*note socket.ntohs(): a80. has been deprecated.  In future versions of
Python, if the passed argument is larger than 16 bits, an exception will
be raised.  (Contributed by Oren Milman in bpo-28332(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28332


File: python.info,  Node: ssl<7>,  Next: sunau,  Prev: socket<7>,  Up: 非推奨の Python モジュール、関数、メソッド

1.8.11.12 ssl
.............

‘ssl.wrap_socket()’ is deprecated.  Use *note
ssl.SSLContext.wrap_socket(): 748. instead.  (Contributed by Christian
Heimes in bpo-28124(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28124


File: python.info,  Node: sunau,  Next: sys<9>,  Prev: ssl<7>,  Up: 非推奨の Python モジュール、関数、メソッド

1.8.11.13 sunau
...............

‘sunau.openfp()’ has been deprecated and will be removed in Python 3.9.
Use ‘sunau.open()’ instead.  (Contributed by Brian Curtin in
bpo-31985(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31985


File: python.info,  Node: sys<9>,  Next: wave,  Prev: sunau,  Up: 非推奨の Python モジュール、関数、メソッド

1.8.11.14 sys
.............

Deprecated ‘sys.set_coroutine_wrapper()’ and
‘sys.get_coroutine_wrapper()’.

The undocumented ‘sys.callstats()’ function has been deprecated and will
be removed in a future Python version.  (Contributed by Victor Stinner
in bpo-28799(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28799


File: python.info,  Node: wave,  Prev: sys<9>,  Up: 非推奨の Python モジュール、関数、メソッド

1.8.11.15 wave
..............

‘wave.openfp()’ has been deprecated and will be removed in Python 3.9.
Use *note wave.open(): b45. instead.  (Contributed by Brian Curtin in
bpo-31985(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31985


File: python.info,  Node: C API の非推奨の関数ならびに型,  Next: サポート対象プラットフォームからの除外,  Prev: 非推奨の Python モジュール、関数、メソッド,  Up: What's New In Python 3 7

1.8.12 C API の非推奨の関数ならびに型
-------------------------------------

Function *note PySlice_GetIndicesEx(): 431. is deprecated and replaced
with a macro if ‘Py_LIMITED_API’ is not set or set to a value in the
range between ‘0x03050400’ and ‘0x03060000’ (not inclusive), or is
‘0x03060100’ or higher.  (Contributed by Serhiy Storchaka in
bpo-27867(1).)

*note PyOS_AfterFork(): 42f. has been deprecated.  Use *note
PyOS_BeforeFork(): db8, *note PyOS_AfterFork_Parent(): db9. or *note
PyOS_AfterFork_Child(): 430. instead.  (Contributed by Antoine Pitrou in
bpo-16500(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27867

   (2) https://bugs.python.org/issue?@action=redirect&bpo=16500


File: python.info,  Node: サポート対象プラットフォームからの除外,  Next: API と機能の削除<2>,  Prev: C API の非推奨の関数ならびに型,  Up: What's New In Python 3 7

1.8.13 サポート対象プラットフォームからの除外
---------------------------------------------

   * FreeBSD 9 とそれ以前のバージョンは公式にはサポートされなくなりまし
     た。

   * For full Unicode support, including within extension modules, *nix
     platforms are now expected to provide at least one of ‘C.UTF-8’
     (full locale), ‘C.utf8’ (full locale) or ‘UTF-8’ (‘LC_CTYPE’-only
     locale) as an alternative to the legacy ‘ASCII’-based ‘C’ locale.

   * OpenSSL 0.9.8 and 1.0.1 are no longer supported, which means
     building CPython 3.7 with SSL/TLS support on older platforms still
     using these versions requires custom build options that link to a
     more recent version of OpenSSL.

     Notably, this issue affects the Debian 8 (aka "jessie") and Ubuntu
     14.04 (aka "Trusty") LTS Linux distributions, as they still use
     OpenSSL 1.0.1 by default.

     Debian 9 ("stretch") and Ubuntu 16.04 ("xenial"), as well as recent
     releases of other LTS Linux releases (e.g.  RHEL/CentOS 7.5, SLES
     12-SP3), use OpenSSL 1.0.2 or later, and remain supported in the
     default build configuration.

     CPython's own CI configuration file(1) provides an example of using
     the SSL compatibility testing infrastructure(2) in CPython's test
     suite to build and link against OpenSSL 1.1.0 rather than an
     outdated system provided OpenSSL.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/blob/v3.7.13/.travis.yml

   (2) 
https://github.com/python/cpython/tree/3.14/Tools/ssl/multissltests.py


File: python.info,  Node: API と機能の削除<2>,  Next: Module Removals,  Prev: サポート対象プラットフォームからの除外,  Up: What's New In Python 3 7

1.8.14 API と機能の削除
-----------------------

The following features and APIs have been removed from Python 3.7:

   * The ‘os.stat_float_times()’ function has been removed.  It was
     introduced in Python 2.3 for backward compatibility with Python
     2.2, and was deprecated since Python 3.1.

   * Unknown escapes consisting of ‘'\'’ and an ASCII letter in
     replacement templates for *note re.sub(): 5a3. were deprecated in
     Python 3.5, and will now cause an error.

   * Removed support of the 'exclude' argument in *note
     tarfile.TarFile.add(): dee.  It was deprecated in Python 2.7 and
     3.2.  Use the 'filter' argument instead.

   * The ‘ntpath.splitunc()’ function was deprecated in Python 3.1, and
     has now been removed.  Use *note splitdrive(): def. instead.

   * *note collections.namedtuple(): 4e0. no longer supports the
     'verbose' parameter or ‘_source’ attribute which showed the
     generated source code for the named tuple class.  This was part of
     an optimization designed to speed-up class creation.  (Contributed
     by Jelle Zijlstra with further improvements by INADA Naoki, Serhiy
     Storchaka, and Raymond Hettinger in bpo-28638(1).)

   * Functions *note bool(): 3c3, *note float(): 196, *note list(): 24d.
     and *note tuple(): 614. no longer take keyword arguments.  The
     first argument of *note int(): 19b. can now be passed only as
     positional argument.

   * Removed previously deprecated in Python 2.4 classes ‘Plist’, ‘Dict’
     and ‘_InternalDict’ in the *note plistlib: b0. module.  Dict values
     in the result of functions ‘readPlist()’ and ‘readPlistFromBytes()’
     are now normal dicts.  You no longer can use attribute access to
     access items of these dictionaries.

   * The ‘asyncio.windows_utils.socketpair()’ function has been removed.
     Use the *note socket.socketpair(): df0. function instead, it is
     available on all platforms since Python 3.5.
     ‘asyncio.windows_utils.socketpair’ was just an alias to
     ‘socket.socketpair’ on Python 3.5 and newer.

   * *note asyncio: b. no longer exports the *note selectors: c7. and
     ‘_overlapped’ modules as ‘asyncio.selectors’ and
     ‘asyncio._overlapped’.  Replace ‘from asyncio import selectors’
     with ‘import selectors’.

   * Direct instantiation of *note ssl.SSLSocket: ae7. and *note
     ssl.SSLObject: d7a. objects is now prohibited.  The constructors
     were never documented, tested, or designed as public constructors.
     Users were supposed to use ‘ssl.wrap_socket()’ or *note
     ssl.SSLContext: 357.  (Contributed by Christian Heimes in
     bpo-32951(2).)

   * The unused ‘distutils’ ‘install_misc’ command has been removed.
     (Contributed by Eric N. Vander Weele in bpo-29218(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28638

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32951

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29218


File: python.info,  Node: Module Removals,  Next: Windows-only Changes,  Prev: API と機能の削除<2>,  Up: What's New In Python 3 7

1.8.15 Module Removals
----------------------

The ‘fpectl’ module has been removed.  It was never enabled by default,
never worked correctly on x86-64, and it changed the Python ABI in ways
that caused unexpected breakage of C extensions.  (Contributed by
Nathaniel J. Smith in bpo-29137(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29137


File: python.info,  Node: Windows-only Changes,  Next: Python 3 7 への移植,  Prev: Module Removals,  Up: What's New In Python 3 7

1.8.16 Windows-only Changes
---------------------------

The python launcher, (py.exe), can accept 32 & 64 bit specifiers
'without' having to specify a minor version as well.  So ‘py -3-32’ and
‘py -3-64’ become valid as well as ‘py -3.7-32’, also the -'m'-64 and
-'m.n'-64 forms are now accepted to force 64 bit python even if 32 bit
would have otherwise been used.  If the specified version is not
available py.exe will error exit.  (Contributed by Steve Barnes in
bpo-30291(1).)

The launcher can be run as ‘py -0’ to produce a list of the installed
pythons, 'with default marked with an asterisk'.  Running ‘py -0p’ will
include the paths.  If py is run with a version specifier that cannot be
matched it will also print the 'short form' list of available
specifiers.  (Contributed by Steve Barnes in bpo-30362(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30291

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30362


File: python.info,  Node: Python 3 7 への移植,  Next: Python 3 7 1 での重要な変更点,  Prev: Windows-only Changes,  Up: What's New In Python 3 7

1.8.17 Python 3.7 への移植
--------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

* Menu:

* Python の挙動の変更: Python の挙動の変更<2>.
* Python API の変更: Python API の変更<8>.
* C API の変更: C API の変更<12>.
* CPython バイトコードの変更: CPython バイトコードの変更<7>.
* Windows-only Changes: Windows-only Changes<2>.
* その他の CPython の実装の変更: その他の CPython の実装の変更<3>.


File: python.info,  Node: Python の挙動の変更<2>,  Next: Python API の変更<8>,  Up: Python 3 7 への移植

1.8.17.1 Python の挙動の変更
............................

   * *note async: 93b. and *note await: 18d. names are now reserved
     keywords.  Code using these names as identifiers will now raise a
     *note SyntaxError: 18e.  (Contributed by Jelle Zijlstra in
     bpo-30406(1).)

   * PEP 479(2) is enabled for all code in Python 3.7, meaning that
     *note StopIteration: df5. exceptions raised directly or indirectly
     in coroutines and generators are transformed into *note
     RuntimeError: 244. exceptions.  (Contributed by Yury Selivanov in
     bpo-32670(3).)

   * *note object.__aiter__(): df6. methods can no longer be declared as
     asynchronous.  (Contributed by Yury Selivanov in bpo-31709(4).)

   * 以前のバージョンの Python で、誤って以下の構文を許容してしまってい
     ました:

          f(1 for x in [1],)

          class C(1 for x in [1]):
              pass

     Python 3.7 now correctly raises a *note SyntaxError: 18e, as a
     generator expression always needs to be directly inside a set of
     parentheses and cannot have a comma on either side, and the
     duplication of the parentheses can be omitted only on calls.
     (Contributed by Serhiy Storchaka in bpo-32012(5) and bpo-32023(6).)

   * When using the *note -m: 23c. switch, the initial working directory
     is now added to *note sys.path: 3e4, rather than an empty string
     (which dynamically denoted the current working directory at the
     time of each import).  Any programs that are checking for the empty
     string, or otherwise relying on the previous behaviour, will need
     to be updated accordingly (e.g.  by also checking for ‘os.getcwd()’
     or ‘os.path.dirname(__main__.__file__)’, depending on why the code
     was checking for the empty string in the first place).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30406

   (2) https://peps.python.org/pep-0479/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32670

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31709

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32012

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32023


File: python.info,  Node: Python API の変更<8>,  Next: C API の変更<12>,  Prev: Python の挙動の変更<2>,  Up: Python 3 7 への移植

1.8.17.2 Python API の変更
..........................

   * *note socketserver.ThreadingMixIn.server_close: d6f. now waits
     until all non-daemon threads complete.  Set the new *note
     socketserver.ThreadingMixIn.block_on_close: d70. class attribute to
     ‘False’ to get the pre-3.7 behaviour.  (Contributed by Victor
     Stinner in bpo-31233(1) and bpo-33540(2).)

   * *note socketserver.ForkingMixIn.server_close: d6f. now waits until
     all child processes complete.  Set the new *note
     socketserver.ForkingMixIn.block_on_close: d70. class attribute to
     ‘False’ to get the pre-3.7 behaviour.  (Contributed by Victor
     Stinner in bpo-31151(3) and bpo-33540(4).)

   * The *note locale.localeconv(): df8. function now temporarily sets
     the ‘LC_CTYPE’ locale to the value of ‘LC_NUMERIC’ in some cases.
     (Contributed by Victor Stinner in bpo-31900(5).)

   * *note pkgutil.walk_packages(): df9. now raises a *note ValueError:
     2ec. if 'path' is a string.  Previously an empty list was returned.
     (Contributed by Sanyam Khurana in bpo-24744(6).)

   * A format string argument for *note string.Formatter.format(): dfa.
     is now *note positional-only: c78.  Passing it as a keyword
     argument was deprecated in Python 3.5.  (Contributed by Serhiy
     Storchaka in bpo-29193(7).)

   * Attributes *note key: dfb, *note value: dfc. and *note coded_value:
     dfd. of class *note http.cookies.Morsel: dfe. are now read-only.
     Assigning to them was deprecated in Python 3.5.  Use the *note
     set(): dff. method for setting them.  (Contributed by Serhiy
     Storchaka in bpo-29192(8).)

   * The 'mode' argument of *note os.makedirs(): 52c. no longer affects
     the file permission bits of newly created intermediate-level
     directories.  To set their file permission bits you can set the
     umask before invoking ‘makedirs()’.  (Contributed by Serhiy
     Storchaka in bpo-19930(9).)

   * The *note struct.Struct.format: e00. type is now *note str: 169.
     instead of *note bytes: 192.  (Contributed by Victor Stinner in
     bpo-21071(10).)

   * ‘cgi.parse_multipart()’ now accepts the 'encoding' and 'errors'
     arguments and returns the same results as ‘FieldStorage’: for
     non-file fields, the value associated to a key is a list of
     strings, not bytes.  (Contributed by Pierre Quentel in
     bpo-29979(11).)

   * Due to internal changes in *note socket: d1, calling *note
     socket.fromshare(): e01. on a socket created by *note socket.share:
     e02. in older Python versions is not supported.

   * ‘repr’ for *note BaseException: 7d6. has changed to not include the
     trailing comma.  Most exceptions are affected by this change.
     (Contributed by Serhiy Storchaka in bpo-30399(12).)

   * ‘repr’ for *note datetime.timedelta: bc3. has changed to include
     the keyword arguments in the output.  (Contributed by Utkarsh
     Upadhyay in bpo-30302(13).)

   * Because *note shutil.rmtree(): 356. is now implemented using the
     *note os.scandir(): c54. function, the user specified handler
     'onerror' is now called with the first argument ‘os.scandir’
     instead of ‘os.listdir’ when listing the directory is failed.

   * Support for nested sets and set operations in regular expressions
     as in Unicode Technical Standard #18(14) might be added in the
     future.  This would change the syntax.  To facilitate this future
     change a *note FutureWarning: 659. will be raised in ambiguous
     cases for the time being.  That include sets starting with a
     literal ‘'['’ or containing literal character sequences ‘'--'’,
     ‘'&&'’, ‘'~~'’, and ‘'||'’.  To avoid a warning, escape them with a
     backslash.  (Contributed by Serhiy Storchaka in bpo-30349(15).)

   * The result of splitting a string on a *note regular expression: be.
     that could match an empty string has been changed.  For example
     splitting on ‘r'\s*'’ will now split not only on whitespaces as it
     did previously, but also on empty strings before all non-whitespace
     characters and just before the end of the string.  The previous
     behavior can be restored by changing the pattern to ‘r'\s+'’.  A
     *note FutureWarning: 659. was emitted for such patterns since
     Python 3.5.

     For patterns that match both empty and non-empty strings, the
     result of searching for all matches may also be changed in other
     cases.  For example in the string ‘'a\n\n'’, the pattern
     ‘r'(?m)^\s*?$'’ will not only match empty strings at positions 2
     and 3, but also the string ‘'\n'’ at positions 2-3.  To match only
     blank lines, the pattern should be rewritten as
     ‘r'(?m)^[^\S\n]*$'’.

     *note re.sub(): 5a3. now replaces empty matches adjacent to a
     previous non-empty match.  For example ‘re.sub('x*', '-', 'abxd')’
     returns now ‘'-a-b--d-'’ instead of ‘'-a-b-d-'’ (the first minus
     between 'b' and 'd' replaces 'x', and the second minus replaces an
     empty string between 'x' and 'd').

     (Contributed by Serhiy Storchaka in bpo-25054(16) and
     bpo-32308(17).)

   * Change *note re.escape(): e03. to only escape regex special
     characters instead of escaping all characters other than ASCII
     letters, numbers, and ‘'_'’.  (Contributed by Serhiy Storchaka in
     bpo-29995(18).)

   * *note tracemalloc.Traceback: d8f. frames are now sorted from oldest
     to most recent to be more consistent with *note traceback: 104.
     (Contributed by Jesse Bakker in bpo-32121(19).)

   * On OSes that support *note socket.SOCK_NONBLOCK: e04. or *note
     socket.SOCK_CLOEXEC: e05. bit flags, the *note socket.type: e06. no
     longer has them applied.  Therefore, checks like ‘if sock.type ==
     socket.SOCK_STREAM’ work as expected on all platforms.
     (Contributed by Yury Selivanov in bpo-32331(20).)

   * On Windows the default for the 'close_fds' argument of *note
     subprocess.Popen: 4b7. was changed from *note False: d2b. to *note
     True: e07. when redirecting the standard handles.  If you
     previously depended on handles being inherited when using *note
     subprocess.Popen: 4b7. with standard io redirection, you will have
     to pass ‘close_fds=False’ to preserve the previous behaviour, or
     use *note STARTUPINFO.lpAttributeList: e08.

   * *note importlib.machinery.PathFinder.invalidate_caches(): e09. -
     which implicitly affects *note importlib.invalidate_caches(): e0a.
     - now deletes entries in *note sys.path_importer_cache: 7fa. which
     are set to ‘None’.  (Contributed by Brett Cannon in bpo-33169(21).)

   * In *note asyncio: b, *note loop.sock_recv(): e0b, *note
     loop.sock_sendall(): e0c, *note loop.sock_accept(): e0d, *note
     loop.getaddrinfo(): e0e, *note loop.getnameinfo(): e0f. have been
     changed to be proper coroutine methods to match their
     documentation.  Previously, these methods returned *note
     asyncio.Future: dc6. instances.  (Contributed by Yury Selivanov in
     bpo-32327(22).)

   * *note asyncio.Server.sockets: e10. now returns a copy of the
     internal list of server sockets, instead of returning it directly.
     (Contributed by Yury Selivanov in bpo-32662(23).)

   * *note Struct.format: e00. is now a *note str: 169. instance instead
     of a *note bytes: 192. instance.  (Contributed by Victor Stinner in
     bpo-21071(24).)

   * *note argparse: 7. subparsers can now be made mandatory by passing
     ‘required=True’ to *note ArgumentParser.add_subparsers(): e11.
     (Contributed by Anthony Sottile in bpo-26510(25).)

   * *note ast.literal_eval(): e12. is now stricter.  Addition and
     subtraction of arbitrary numbers are no longer allowed.
     (Contributed by Serhiy Storchaka in bpo-31778(26).)

   * *note Calendar.itermonthdates: e13. will now consistently raise an
     exception when a date falls outside of the ‘0001-01-01’ through
     ‘9999-12-31’ range.  To support applications that cannot tolerate
     such exceptions, the new *note Calendar.itermonthdays3: e14. and
     *note Calendar.itermonthdays4: e15. can be used.  The new methods
     return tuples and are not restricted by the range supported by
     *note datetime.date: 1fa.  (Contributed by Alexander Belopolsky in
     bpo-28292(27).)

   * *note collections.ChainMap: e16. now preserves the order of the
     underlying mappings.  (Contributed by Raymond Hettinger in
     bpo-32792(28).)

   * The ‘submit()’ method of *note
     concurrent.futures.ThreadPoolExecutor: 949. and *note
     concurrent.futures.ProcessPoolExecutor: 1d6. now raises a *note
     RuntimeError: 244. if called during interpreter shutdown.
     (Contributed by Mark Nemec in bpo-33097(29).)

   * The *note configparser.ConfigParser: 4de. constructor now uses
     ‘read_dict()’ to process the default values, making its behavior
     consistent with the rest of the parser.  Non-string keys and values
     in the defaults dictionary are now being implicitly converted to
     strings.  (Contributed by James Tocknell in bpo-23835(30).)

   * Several undocumented internal imports were removed.  One example is
     that ‘os.errno’ is no longer available; use ‘import errno’ directly
     instead.  Note that such undocumented internal imports may be
     removed any time without notice, even in micro version releases.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31233

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33540

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31151

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33540

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31900

   (6) https://bugs.python.org/issue?@action=redirect&bpo=24744

   (7) https://bugs.python.org/issue?@action=redirect&bpo=29193

   (8) https://bugs.python.org/issue?@action=redirect&bpo=29192

   (9) https://bugs.python.org/issue?@action=redirect&bpo=19930

   (10) https://bugs.python.org/issue?@action=redirect&bpo=21071

   (11) https://bugs.python.org/issue?@action=redirect&bpo=29979

   (12) https://bugs.python.org/issue?@action=redirect&bpo=30399

   (13) https://bugs.python.org/issue?@action=redirect&bpo=30302

   (14) https://unicode.org/reports/tr18/

   (15) https://bugs.python.org/issue?@action=redirect&bpo=30349

   (16) https://bugs.python.org/issue?@action=redirect&bpo=25054

   (17) https://bugs.python.org/issue?@action=redirect&bpo=32308

   (18) https://bugs.python.org/issue?@action=redirect&bpo=29995

   (19) https://bugs.python.org/issue?@action=redirect&bpo=32121

   (20) https://bugs.python.org/issue?@action=redirect&bpo=32331

   (21) https://bugs.python.org/issue?@action=redirect&bpo=33169

   (22) https://bugs.python.org/issue?@action=redirect&bpo=32327

   (23) https://bugs.python.org/issue?@action=redirect&bpo=32662

   (24) https://bugs.python.org/issue?@action=redirect&bpo=21071

   (25) https://bugs.python.org/issue?@action=redirect&bpo=26510

   (26) https://bugs.python.org/issue?@action=redirect&bpo=31778

   (27) https://bugs.python.org/issue?@action=redirect&bpo=28292

   (28) https://bugs.python.org/issue?@action=redirect&bpo=32792

   (29) https://bugs.python.org/issue?@action=redirect&bpo=33097

   (30) https://bugs.python.org/issue?@action=redirect&bpo=23835


File: python.info,  Node: C API の変更<12>,  Next: CPython バイトコードの変更<7>,  Prev: Python API の変更<8>,  Up: Python 3 7 への移植

1.8.17.3 C API の変更
.....................

The function *note PySlice_GetIndicesEx(): 431. is considered unsafe for
resizable sequences.  If the slice indices are not instances of *note
int: 19b, but objects that implement the ‘__index__()’ method, the
sequence can be resized after passing its length to
‘PySlice_GetIndicesEx()’.  This can lead to returning indices out of the
length of the sequence.  For avoiding possible problems use new
functions *note PySlice_Unpack(): 432. and *note
PySlice_AdjustIndices(): 433.  (Contributed by Serhiy Storchaka in
bpo-27867(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27867


File: python.info,  Node: CPython バイトコードの変更<7>,  Next: Windows-only Changes<2>,  Prev: C API の変更<12>,  Up: Python 3 7 への移植

1.8.17.4 CPython バイトコードの変更
...................................

There are two new opcodes: ‘LOAD_METHOD’ and ‘CALL_METHOD’.
(Contributed by Yury Selivanov and INADA Naoki in bpo-26110(1).)

The ‘STORE_ANNOTATION’ opcode has been removed.  (Contributed by Mark
Shannon in bpo-32550(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26110

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32550


File: python.info,  Node: Windows-only Changes<2>,  Next: その他の CPython の実装の変更<3>,  Prev: CPython バイトコードの変更<7>,  Up: Python 3 7 への移植

1.8.17.5 Windows-only Changes
.............................

The file used to override *note sys.path: 3e4. is now called
‘<python-executable>._pth’ instead of ‘'sys.path'’.  See *note
モジュールの検索: e1a. for more information.  (Contributed by Steve
Dower in bpo-28137(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28137


File: python.info,  Node: その他の CPython の実装の変更<3>,  Prev: Windows-only Changes<2>,  Up: Python 3 7 への移植

1.8.17.6 その他の CPython の実装の変更
......................................

In preparation for potential future changes to the public CPython
runtime initialization API (see PEP 432(1) for an initial, but somewhat
outdated, draft), CPython's internal startup and configuration
management logic has been significantly refactored.  While these updates
are intended to be entirely transparent to both embedding applications
and users of the regular CPython CLI, they're being mentioned here as
the refactoring changes the internal order of various operations during
interpreter startup, and hence may uncover previously latent defects,
either in embedding applications, or in CPython itself.  (Initially
contributed by Nick Coghlan and Eric Snow as part of bpo-22257(2), and
further updated by Nick, Eric, and Victor Stinner in a number of other
issues).  Some known details affected:

   * ‘PySys_AddWarnOptionUnicode()’ is not currently usable by embedding
     applications due to the requirement to create a Unicode object
     prior to calling ‘Py_Initialize’.  Use ‘PySys_AddWarnOption()’
     instead.

   * warnings filters added by an embedding application with
     ‘PySys_AddWarnOption()’ should now more consistently take
     precedence over the default filters set by the interpreter

Due to changes in the way the default warnings filters are configured,
setting *note Py_BytesWarningFlag: 406. to a value greater than one is
no longer sufficient to both emit *note BytesWarning: e1c. messages and
have them converted to exceptions.  Instead, the flag must be set (to
cause the warnings to be emitted in the first place), and an explicit
‘error::BytesWarning’ warnings filter added to convert them to
exceptions.

Due to a change in the way docstrings are handled by the compiler, the
implicit ‘return None’ in a function body consisting solely of a
docstring is now marked as occurring on the same line as the docstring,
not on the function's header line.

The current exception state has been moved from the frame object to the
co-routine.  This simplified the interpreter and fixed a couple of
obscure bugs caused by having swap exception state when entering or
exiting a generator.  (Contributed by Mark Shannon in bpo-25612(3).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0432/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22257

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25612


File: python.info,  Node: Python 3 7 1 での重要な変更点,  Next: Python 3 7 2 での重要な変更点,  Prev: Python 3 7 への移植,  Up: What's New In Python 3 7

1.8.18 Python 3.7.1 での重要な変更点
------------------------------------

Starting in 3.7.1, *note Py_Initialize(): 460. now consistently reads
and respects all of the same environment settings as *note Py_Main():
e1e. (in earlier Python versions, it respected an ill-defined subset of
those environment variables, while in Python 3.7.0 it didn't read any of
them due to bpo-34247(1)).  If this behavior is unwanted, set *note
Py_IgnoreEnvironmentFlag: 40a. to 1 before calling *note
Py_Initialize(): 460.

In 3.7.1 the C API for Context Variables *note was updated: e1f. to use
*note PyObject: 5df. pointers.  See also bpo-34762(2).

In 3.7.1 the *note tokenize: 101. module now implicitly emits a
‘NEWLINE’ token when provided with input that does not have a trailing
new line.  This behavior now matches what the C tokenizer does
internally.  (Contributed by Ammar Askar in bpo-33899(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34247

   (2) https://bugs.python.org/issue?@action=redirect&bpo=34762

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33899


File: python.info,  Node: Python 3 7 2 での重要な変更点,  Next: Python 3 7 6 での重要な変更点,  Prev: Python 3 7 1 での重要な変更点,  Up: What's New In Python 3 7

1.8.19 Python 3.7.2 での重要な変更点
------------------------------------

In 3.7.2, *note venv: 117. on Windows no longer copies the original
binaries, but creates redirector scripts named ‘python.exe’ and
‘pythonw.exe’ instead.  This resolves a long standing issue where all
virtual environments would have to be upgraded or recreated with each
Python update.  However, note that this release will still require
recreation of virtual environments in order to get the new scripts.


File: python.info,  Node: Python 3 7 6 での重要な変更点,  Next: Python 3 7 10 での重要な変更点,  Prev: Python 3 7 2 での重要な変更点,  Up: What's New In Python 3 7

1.8.20 Python 3.7.6 での重要な変更点
------------------------------------

セキュリティ上の重大な懸念により、*note
asyncio.loop.create_datagram_endpoint(): 93c. での 'reuse_address' 引数
は無効になりました。これはソケットオプション ‘SO_REUSEADDR'’ のUDP にお
ける挙動が原因です。詳しくは、‘loop.create_datagram_endpoint()’ のドキュ
メントを参照してください。(Kyle Stanley, Antoine Pitrou, Yury Selivanov
による貢献 bpo-37228(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37228


File: python.info,  Node: Python 3 7 10 での重要な変更点,  Next: Notable changes in Python 3 7 11,  Prev: Python 3 7 6 での重要な変更点,  Up: What's New In Python 3 7

1.8.21 Python 3.7.10 での重要な変更点
-------------------------------------

Earlier Python versions allowed using both ‘;’ and ‘&’ as query
parameter separators in *note urllib.parse.parse_qs(): 31f. and *note
urllib.parse.parse_qsl(): 31e.  Due to security concerns, and to conform
with newer W3C recommendations, this has been changed to allow only a
single separator key, with ‘&’ as the default.  This change also affects
‘cgi.parse()’ and ‘cgi.parse_multipart()’ as they use the affected
functions internally.  For more details, please see their respective
documentation.  (Contributed by Adam Goldschmidt, Senthil Kumaran and
Ken Jin in bpo-42967(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42967


File: python.info,  Node: Notable changes in Python 3 7 11,  Next: Notable security feature in 3 7 14,  Prev: Python 3 7 10 での重要な変更点,  Up: What's New In Python 3 7

1.8.22 Notable changes in Python 3.7.11
---------------------------------------

A security fix alters the *note ftplib.FTP: af6. behavior to not trust
the IPv4 address sent from the remote server when setting up a passive
data channel.  We reuse the ftp server IP address instead.  For unusual
code requiring the old behavior, set a ‘trust_server_pasv_ipv4_address’
attribute on your FTP instance to ‘True’.  (See gh-87451(1))

The presence of newline or tab characters in parts of a URL allows for
some forms of attacks.  Following the WHATWG specification that updates
RFC 3986, ASCII newline ‘\n’, ‘\r’ and tab ‘\t’ characters are stripped
from the URL by the parser *note urllib.parse(): 110. preventing such
attacks.  The removal characters are controlled by a new module level
variable ‘urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE’.  (See gh-88048(2))

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/87451

   (2) https://github.com/python/cpython/issues/88048


File: python.info,  Node: Notable security feature in 3 7 14,  Prev: Notable changes in Python 3 7 11,  Up: What's New In Python 3 7

1.8.23 Notable security feature in 3.7.14
-----------------------------------------

Converting between *note int: 19b. and *note str: 169. in bases other
than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10
(decimal) now raises a *note ValueError: 2ec. if the number of digits in
string form is above a limit to avoid potential denial of service
attacks due to the algorithmic complexity.  This is a mitigation for CVE
2020-10735(1).  This limit can be configured or disabled by environment
variable, command line flag, or *note sys: df. APIs.  See the *note
integer string conversion length limitation: 80b. documentation.  The
default limit is 4300 digits in string form.

   ---------- Footnotes ----------

   (1) https://www.cve.org/CVERecord?id=CVE-2020-10735


File: python.info,  Node: What's New In Python 3 6,  Next: What's New In Python 3 5,  Prev: What's New In Python 3 7,  Up: What's New in Python

1.9 What's New In Python 3.6
============================


エディタ: Elvis Pranskevichus <<elvis@magic.io>>, Yury Selivanov
<<yury@magic.io>>

This article explains the new features in Python 3.6, compared to 3.5.
Python 3.6 was released on December 23, 2016.  See the changelog(1) for
a full list of changes.

参考
....

PEP 494(2) - Python 3.6 リリーススケジュール

* Menu:

* 概要: 概要 -- リリースハイライト<9>. リリースハイライト
* 新しい機能: 新しい機能<14>.
* その他の言語変更: その他の言語変更<8>.
* 新たなモジュール: 新たなモジュール<8>.
* 改良されたモジュール: 改良されたモジュール<8>.
* 最適化: 最適化<9>.
* ビルドならびに C API の変更: ビルドならびに C API の変更<2>.
* その他の改善::
* 非推奨: 非推奨<10>.
* 削除: 削除<10>.
* Python 3.6 への移植: Python 3 6 への移植.
* Notable changes in Python 3.6.2: Notable changes in Python 3 6 2.
* Notable changes in Python 3.6.4: Notable changes in Python 3 6 4.
* Notable changes in Python 3.6.5: Notable changes in Python 3 6 5.
* Notable changes in Python 3.6.7: Notable changes in Python 3 6 7.
* Notable changes in Python 3.6.10: Notable changes in Python 3 6 10.
* Notable changes in Python 3.6.13: Notable changes in Python 3 6 13.
* Notable changes in Python 3.6.14: Notable changes in Python 3 6 14.

   ---------- Footnotes ----------

   (1) https://docs.python.org/3.6/whatsnew/changelog.html

   (2) https://peps.python.org/pep-0494/


File: python.info,  Node: 概要 -- リリースハイライト<9>,  Next: 新しい機能<14>,  Up: What's New In Python 3 6

1.9.1 概要 - リリースハイライト
-------------------------------

新たな文法機能:

   * *note PEP 498: e29.、フォーマット済み文字列リテラル。

   * *note PEP 515: e2a.、数値リテラル内のアンダースコア。

   * *note PEP 526: e2b.、変数アノテーションの文法。

   * *note PEP 525: e2c.、非同期ジェネレータ。

   * *note PEP 530: e2d.: 非同期内包表記

新たなライブラリモジュール:

   * *note secrets: c5.: *note PEP 506 - 標準ライブラリーに Secrets
     モジュールを追加: e2e.

CPython の実装の改善:

   * *note dict: cbd. 型は、 Raymond Hettinger(1) の提案に基づき、 PyPy
     dict implementation(2) と同様の *note よりコンパクトな表現: e2f. を
     使うように再実装されました。 その結果、 Python 3.5 と比較して辞書が
     使うメモリ 20% から 25% 減少しました。

   * *note 新しいプロトコル: e30. により、クラス生成のカスタマイズがより
     簡単になりました。

   * クラス属性の定義の順番が *note 保持されるようになりました: e31.。

   * ‘**kwargs’ の要素の順序が、キーワード引数が関数に渡されたときの
     *note 順序に一致した: e32. ものになりました。

   * DTrace と SystemTap の *note プローブのサポート: e33. が追加されま
     した。

   * 新しい *note PYTHONMALLOC: e34.  環境変数が、インタープリタのメモリ
     確保とメモリアクセスエラーのデバッグに使えるようになりました。

標準ライブラリーの顕著な改善

   * The *note asyncio: b. module has received new features, significant
     usability and performance improvements, and a fair amount of bug
     fixes.  Starting with Python 3.6 the ‘asyncio’ module is no longer
     provisional and its API is considered stable.

   * A new *note file system path protocol: e35. has been implemented to
     support *note path-like objects: 5a1.  All standard library
     functions operating on paths have been updated to work with the new
     protocol.

   * *note datetime: 34. モジュールで *note 地域時間の曖昧さ回避: e36. が
     サポートされました。

   * *note typing: 10a. モジュールに数多くの *note 改善: e37. がなされま
     した。

   * *note tracemalloc: 105. モジュールが大幅に書き直され、改善されたメ
     モリ割り当てエラーの診断プログラムの提供だけでなく、 *note
     ResourceWarning: 54c. の出力メッセージも改善されています。 より詳し
     いことは *note PYTHONMALLOC 節: e34. を参照してください。

セキュリティの改善:

   * The new *note secrets: c5. module has been added to simplify the
     generation of cryptographically strong pseudo-random numbers
     suitable for managing secrets such as account authentication,
     tokens, and similar.

   * On Linux, *note os.urandom(): 746. now blocks until the system
     urandom entropy pool is initialized to increase the security.  See
     the PEP 524(3) for the rationale.

   * *note hashlib: 6c. および *note ssl: d5. モジュールは OpenSSL 1.1.0
     をサポートしました。

   * *note ssl: d5. モジュールのデフォルトの設定と機能群が改善されました
     。

   * *note hashlib: 6c. モジュールで BLAKE2, SHA-3, SHAKE ハッシュアルゴ
     リズムと *note scrypt(): e38. キー導出関数がサポートされるようにな
     りました。

Windows の改善:

   * *note PEP 528: e39. および *note PEP 529: e3a.、 Windows のファイル
     システムとコンソールのエンコーディングを UTF-8 に変更しました。

   * ‘py.exe’ ランチャーを対話的に使うときに、 (コマンドライン引数や設定
     ファイルで) バージョンを指定しないと Python 3 よりも Python 2 を選
     択するということはなくなりました。 シェバン行の扱いは以前のままで、
     "python" とあった場合は Python 2 を指しています。

   * ‘python.exe’ and ‘pythonw.exe’ have been marked as long-path aware,
     which means that the 260 character path limit may no longer apply.
     See *note removing the MAX_PATH limitation: e3b. for details.

   * A ‘._pth’ file can be added to force isolated mode and fully
     specify all search paths to avoid registry and environment lookup.
     See *note the documentation: e1a. for more information.

   * A ‘python36.zip’ file now works as a landmark to infer *note
     PYTHONHOME: 3f0.  See *note the documentation: e1a. for more
     information.

   ---------- Footnotes ----------

   (1) 
https://mail.python.org/pipermail/python-dev/2012-December/123028.html

   (2) 
https://morepypy.blogspot.com/2015/01/faster-more-memory-efficient-and-more.html

   (3) https://peps.python.org/pep-0524/


File: python.info,  Node: 新しい機能<14>,  Next: その他の言語変更<8>,  Prev: 概要 -- リリースハイライト<9>,  Up: What's New In Python 3 6

1.9.2 新しい機能
----------------

* Menu:

* PEP 498; フォーマット済み文字列リテラル: PEP 498 フォーマット済み文字列リテラル.
* PEP 526; 変数アノテーションの文法: PEP 526 変数アノテーションの文法.
* PEP 515; 数値リテラル内のアンダースコア: PEP 515 数値リテラル内のアンダースコア.
* PEP 525; 非同期ジェネレータ: PEP 525 非同期ジェネレータ.
* PEP 530; 非同期内包表記: PEP 530 非同期内包表記.
* PEP 487; Simpler customization of class creation: PEP 487 Simpler customization of class creation.
* PEP 487; 記述子プロトコルの改善: PEP 487 記述子プロトコルの改善.
* PEP 519; ファイルシステムパスプロトコルの追加: PEP 519 ファイルシステムパスプロトコルの追加.
* PEP 495; 地域時間の曖昧さ回避: PEP 495 地域時間の曖昧さ回避.
* PEP 529; Windows ファイルシステムのエンコーディングを UTF-8 に変更: PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更.
* PEP 528; Windows コンソールのエンコーディングを UTF-8 に変更: PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更.
* PEP 520; クラス属性の定義の順番を保持: PEP 520 クラス属性の定義の順番を保持.
* PEP 468; キーワード引数の順番の保持: PEP 468 キーワード引数の順番の保持.
* 新たな dict 実装::
* PEP 523; CPython にフレーム評価 API を追加: PEP 523 CPython にフレーム評価 API を追加.
* PYTHONMALLOC 環境変数::
* DTrace and SystemTap probing support::


File: python.info,  Node: PEP 498 フォーマット済み文字列リテラル,  Next: PEP 526 変数アノテーションの文法,  Up: 新しい機能<14>

1.9.2.1 PEP 498: フォーマット済み文字列リテラル
...............................................

PEP 498(1) は新たな種類の文字列リテラル、すなわち 'f-strings'、 *note
フォーマット済み文字列リテラル: 19a. を導入しました。

フォーマット済み文字列リテラルはプレフィックスに ‘'f'’ をとり *note
str.format(): 833. による書式文字列に似ています。これらには中括弧で囲ま
れた置換フィールドがあります。置換フィールドは実行時に評価される式で、
*note format(): 199. プロトコルによってフォーマットされます:

     >>> name = "Fred"
     >>> f"He said his name is {name}."
     'He said his name is Fred.'
     >>> width = 10
     >>> precision = 4
     >>> value = decimal.Decimal("12.34567")
     >>> f"result: {value:{width}.{precision}}"  # nested fields
     'result:      12.35'

参考
....

PEP 498(2) - Literal String Interpolation.

     PEP written and implemented by Eric V. Smith.

*note Feature documentation: 19a.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0498/

   (2) https://peps.python.org/pep-0498/


File: python.info,  Node: PEP 526 変数アノテーションの文法,  Next: PEP 515 数値リテラル内のアンダースコア,  Prev: PEP 498 フォーマット済み文字列リテラル,  Up: 新しい機能<14>

1.9.2.2 PEP 526: 変数アノテーションの文法
.........................................

PEP 484(1) は関数の仮引数の型アノテーションの標準(別名型ヒント)を導入し
ました。この PEP は Python に、クラス変数およびインスタンス変数を含む変
数の型アノテーションの構文を追加しました:

     primes: List[int] = []

     captain: str  # Note: no initial value!

     class Starship:
         stats: Dict[str, int] = {}

関数アノテーションと同様に、Python インタープリタは変数アノテーションに
特定の意味を付加せず、クラスやモジュールの ‘__annotations__’ 属性に保存
するだけです。

静的型付け言語の変数定義とは対照的に、アノテーションシンタックスの目的は
抽象構文木および ‘__annotations__’ 属性を通じて、サードパーティツールや
ライブラリーに型の構造化されたメタデータを指定する簡単な方法を提供するこ
とです。

参考
....

PEP 526(2) - Syntax for variable annotations

     PEP written by Ryan Gonzalez, Philip House, Ivan Levkivskyi, Lisa
     Roach, and Guido van Rossum.  Implemented by Ivan Levkivskyi.

新構文を使用あるいは使用予定のツール: mypy(3), pytype(4), PyCharm などな
ど。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/

   (2) https://peps.python.org/pep-0526/

   (3) https://www.mypy-lang.org/

   (4) https://github.com/google/pytype


File: python.info,  Node: PEP 515 数値リテラル内のアンダースコア,  Next: PEP 525 非同期ジェネレータ,  Prev: PEP 526 変数アノテーションの文法,  Up: 新しい機能<14>

1.9.2.3 PEP 515: 数値リテラル内のアンダースコア
...............................................

PEP 515(1) により、可読性向上のために数値リテラル内でアンダースコアを使
えるようになりました。例えば:

     >>> 1_000_000_000_000_000
     1000000000000000
     >>> 0x_FF_FF_FF_FF
     4294967295

単一のアンダースコアは数字の間と基数指定子の後で許されます。先頭、末尾、
あるいは複数のアンダースコアを列内で使用することはできません。

The *note string formatting: 4f9. language also now has support for the
‘'_'’ option to signal the use of an underscore for a thousands
separator for floating-point presentation types and for integer
presentation type ‘'d'’.  For integer presentation types ‘'b'’, ‘'o'’,
‘'x'’, and ‘'X'’, underscores will be inserted every 4 digits:

     >>> '{:_}'.format(1000000)
     '1_000_000'
     >>> '{:_x}'.format(0xFFFFFFFF)
     'ffff_ffff'

参考
....

PEP 515(2) - 数値リテラル内のアンダースコア

     PEP written by Georg Brandl and Serhiy Storchaka.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0515/

   (2) https://peps.python.org/pep-0515/


File: python.info,  Node: PEP 525 非同期ジェネレータ,  Next: PEP 530 非同期内包表記,  Prev: PEP 515 数値リテラル内のアンダースコア,  Up: 新しい機能<14>

1.9.2.4 PEP 525: 非同期ジェネレータ
...................................

PEP 492(1) で Python 3.5 はネイティブなコルーチンならびに ‘async’ /
‘await’ 構文をサポートしました。Python 3.5 実装における大きな制約は同一
の関数実体内で ‘await’ と ‘yield’ を使えないことでした。Python 3.6 では
この制約はなくなり、 '非同期ジェネレータ' を定義できるようになりました:

     async def ticker(delay, to):
         """Yield numbers from 0 to *to* every *delay* seconds."""
         for i in range(to):
             yield i
             await asyncio.sleep(delay)

新たな構文のおかげでより速く、より簡潔にコードを書くことができます。

参考
....

PEP 525(2) - 非同期ジェネレータ

     PEP written and implemented by Yury Selivanov.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0492/

   (2) https://peps.python.org/pep-0525/


File: python.info,  Node: PEP 530 非同期内包表記,  Next: PEP 487 Simpler customization of class creation,  Prev: PEP 525 非同期ジェネレータ,  Up: 新しい機能<14>

1.9.2.5 PEP 530: 非同期内包表記
...............................

PEP 530(1) によりリスト、セット、辞書内包表記ならびにジェネレータ式内で
の ‘async for’ の使用がサポートされました:

     result = [i async for i in aiter() if i % 2]

加えて、 ‘await’ 式が全ての内包表記でサポートされました:

     result = [await fun() for fun in funcs if await condition()]

参考
....

PEP 530(2) - 非同期内包表記

     PEP written and implemented by Yury Selivanov.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0530/

   (2) https://peps.python.org/pep-0530/


File: python.info,  Node: PEP 487 Simpler customization of class creation,  Next: PEP 487 記述子プロトコルの改善,  Prev: PEP 530 非同期内包表記,  Up: 新しい機能<14>

1.9.2.6 PEP 487: Simpler customization of class creation
........................................................

It is now possible to customize subclass creation without using a
metaclass.  The new ‘__init_subclass__’ classmethod will be called on
the base class whenever a new subclass is created:

     class PluginBase:
         subclasses = []

         def __init_subclass__(cls, **kwargs):
             super().__init_subclass__(**kwargs)
             cls.subclasses.append(cls)

     class Plugin1(PluginBase):
         pass

     class Plugin2(PluginBase):
         pass

In order to allow zero-argument *note super(): 1a6. calls to work
correctly from *note __init_subclass__(): 843. implementations, custom
metaclasses must ensure that the new ‘__classcell__’ namespace entry is
propagated to ‘type.__new__’ (as described in *note
クラスオブジェクトの作成: e44.).

参考
....

PEP 487(1) - Simpler customization of class creation

     PEP 著と実装 Martin Teichmann.

*note Feature documentation: e45.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0487/


File: python.info,  Node: PEP 487 記述子プロトコルの改善,  Next: PEP 519 ファイルシステムパスプロトコルの追加,  Prev: PEP 487 Simpler customization of class creation,  Up: 新しい機能<14>

1.9.2.7 PEP 487: 記述子プロトコルの改善
.......................................

PEP 487(1) extends the descriptor protocol to include the new optional
*note __set_name__(): e48. method.  Whenever a new class is defined, the
new method will be called on all descriptors included in the definition,
providing them with a reference to the class being defined and the name
given to the descriptor within the class namespace.  In other words,
instances of descriptors can now know the attribute name of the
descriptor in the owner class:

     class IntField:
         def __get__(self, instance, owner):
             return instance.__dict__[self.name]

         def __set__(self, instance, value):
             if not isinstance(value, int):
                 raise ValueError(f'expecting integer in {self.name}')
             instance.__dict__[self.name] = value

         # this is the new initializer:
         def __set_name__(self, owner, name):
             self.name = name

     class Model:
         int_field = IntField()

参考
....

PEP 487(2) - Simpler customization of class creation

     PEP 著と実装 Martin Teichmann.

*note Feature documentation: e49.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0487/

   (2) https://peps.python.org/pep-0487/


File: python.info,  Node: PEP 519 ファイルシステムパスプロトコルの追加,  Next: PEP 495 地域時間の曖昧さ回避,  Prev: PEP 487 記述子プロトコルの改善,  Up: 新しい機能<14>

1.9.2.8 PEP 519: ファイルシステムパスプロトコルの追加
.....................................................

File system paths have historically been represented as *note str: 169.
or *note bytes: 192. objects.  This has led to people who write code
which operate on file system paths to assume that such objects are only
one of those two types (an *note int: 19b. representing a file
descriptor does not count as that is not a file path).  Unfortunately
that assumption prevents alternative object representations of file
system paths like *note pathlib: a8. from working with pre-existing
code, including Python's standard library.

To fix this situation, a new interface represented by *note os.PathLike:
e4b. has been defined.  By implementing the *note __fspath__(): e4c.
method, an object signals that it represents a path.  An object can then
provide a low-level representation of a file system path as a *note str:
169. or *note bytes: 192. object.  This means an object is considered
*note path-like: 5a1. if it implements *note os.PathLike: e4b. or is a
*note str: 169. or *note bytes: 192. object which represents a file
system path.  Code can use *note os.fspath(): e4d, *note os.fsdecode():
e4e, or *note os.fsencode(): e4f. to explicitly get a *note str: 169.
and/or *note bytes: 192. representation of a path-like object.

The built-in *note open(): 316. function has been updated to accept
*note os.PathLike: e4b. objects, as have all relevant functions in the
*note os: a5. and *note os.path: a6. modules, and most other functions
and classes in the standard library.  The *note os.DirEntry: 6c3. class
and relevant classes in *note pathlib: a8. have also been updated to
implement *note os.PathLike: e4b.

The hope is that updating the fundamental functions for operating on
file system paths will lead to third-party code to implicitly support
all *note path-like objects: 5a1. without any code changes, or at least
very minimal ones (e.g.  calling *note os.fspath(): e4d. at the
beginning of code before operating on a path-like object).

Here are some examples of how the new interface allows for *note
pathlib.Path: 266. to be used more easily and transparently with
pre-existing code:

     >>> import pathlib
     >>> with open(pathlib.Path("README")) as f:
     ...     contents = f.read()
     ...
     >>> import os.path
     >>> os.path.splitext(pathlib.Path("some_file.txt"))
     ('some_file', '.txt')
     >>> os.path.join("/a/b", pathlib.Path("c"))
     '/a/b/c'
     >>> import os
     >>> os.fspath(pathlib.Path("some_file.txt"))
     'some_file.txt'

(Implemented by Brett Cannon, Ethan Furman, Dusty Phillips, and Jelle
Zijlstra.)

参考
....

PEP 519(1) - ファイルシステムパスプロトコルの追加

     PEP written by Brett Cannon and Koos Zevenhoven.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0519/


File: python.info,  Node: PEP 495 地域時間の曖昧さ回避,  Next: PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更,  Prev: PEP 519 ファイルシステムパスプロトコルの追加,  Up: 新しい機能<14>

1.9.2.9 PEP 495: 地域時間の曖昧さ回避
.....................................

世界の大抵の場所で、地域時計が1日繰り下げられることがこれまでありました
し、これからもあるでしょう。そういった時に、同じ日に同じ時間を指す区間が
あります。そういった状況では地域時計が表示する (あるいは Python の
datetime インスタンスが格納する) 情報では、時間内の特定の瞬間を識別する
ことはできません。

PEP 495(1) は時間内の地域時間が同じ二つの瞬間を区別するために、新たな
'fold' 属性を *note datetime.datetime: 4e2. インスタンスならびに *note
datetime.time: 1fb. クラスに追加しました。

     >>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)
     >>> for i in range(4):
     ...     u = u0 + i*HOUR
     ...     t = u.astimezone(Eastern)
     ...     print(u.time(), 'UTC =', t.time(), t.tzname(), t.fold)
     ...
     04:00:00 UTC = 00:00:00 EDT 0
     05:00:00 UTC = 01:00:00 EDT 0
     06:00:00 UTC = 01:00:00 EST 1
     07:00:00 UTC = 02:00:00 EST 0

*note fold: e51. 属性の値は、曖昧な場合に時間内の二番目の (年代的) 瞬間
を表しているものを除く全てのインスタンスで ‘0’ です。

参考
....

PEP 495(2) - 地域時間の曖昧さ回避

     PEP written by Alexander Belopolsky and Tim Peters, implementation
     by Alexander Belopolsky.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0495/

   (2) https://peps.python.org/pep-0495/


File: python.info,  Node: PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更,  Next: PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更,  Prev: PEP 495 地域時間の曖昧さ回避,  Up: 新しい機能<14>

1.9.2.10 PEP 529: Windows ファイルシステムのエンコーディングを UTF-8 に変更
...........................................................................

Representing filesystem paths is best performed with str (Unicode)
rather than bytes.  However, there are some situations where using bytes
is sufficient and correct.

Prior to Python 3.6, data loss could result when using bytes paths on
Windows.  With this change, using bytes to represent paths is now
supported on Windows, provided those bytes are encoded with the encoding
returned by *note sys.getfilesystemencoding(): e53, which now defaults
to ‘'utf-8'’.

Applications that do not use str to represent paths should use *note
os.fsencode(): e4f. and *note os.fsdecode(): e4e. to ensure their bytes
are correctly encoded.  To revert to the previous behaviour, set *note
PYTHONLEGACYWINDOWSFSENCODING: 33f. or call *note
sys._enablelegacywindowsfsencoding(): 33e.

See PEP 529(1) for more information and discussion of code modifications
that may be required.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0529/


File: python.info,  Node: PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更,  Next: PEP 520 クラス属性の定義の順番を保持,  Prev: PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更,  Up: 新しい機能<14>

1.9.2.11 PEP 528: Windows コンソールのエンコーディングを UTF-8 に変更
.....................................................................

The default console on Windows will now accept all Unicode characters
and provide correctly read str objects to Python code.  ‘sys.stdin’,
‘sys.stdout’ and ‘sys.stderr’ now default to utf-8 encoding.

This change only applies when using an interactive console, and not when
redirecting files or pipes.  To revert to the previous behaviour for
interactive console use, set *note PYTHONLEGACYWINDOWSSTDIO: e55.

参考
....

PEP 528(1) - Windows コンソールのエンコーディングを UTF-8 に変更

     PEP written and implemented by Steve Dower.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0528/


File: python.info,  Node: PEP 520 クラス属性の定義の順番を保持,  Next: PEP 468 キーワード引数の順番の保持,  Prev: PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更,  Up: 新しい機能<14>

1.9.2.12 PEP 520: クラス属性の定義の順番を保持
..............................................

Attributes in a class definition body have a natural ordering: the same
order in which the names appear in the source.  This order is now
preserved in the new class's *note __dict__: e57. attribute.

Also, the effective default class 'execution' namespace (returned from
*note type.__prepare__(): e58.) is now an insertion-order-preserving
mapping.

参考
....

PEP 520(1) - クラス属性の定義の順番を保持

     PEP written and implemented by Eric Snow.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0520/


File: python.info,  Node: PEP 468 キーワード引数の順番の保持,  Next: 新たな dict 実装,  Prev: PEP 520 クラス属性の定義の順番を保持,  Up: 新しい機能<14>

1.9.2.13 PEP 468: キーワード引数の順番の保持
............................................

関数シグニチャにおける ‘**kwargs’ は挿入順序を保存するマッピングであるこ
とが保証されるようになりました。

参考
....

PEP 468(1) - キーワード引数の順番の保持

     PEP written and implemented by Eric Snow.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0468/


File: python.info,  Node: 新たな dict 実装,  Next: PEP 523 CPython にフレーム評価 API を追加,  Prev: PEP 468 キーワード引数の順番の保持,  Up: 新しい機能<14>

1.9.2.14 新たな dict 実装
.........................

The *note dict: cbd. type now uses a "compact" representation based on a
proposal by Raymond Hettinger(1) which was first implemented by PyPy(2).
The memory usage of the new *note dict(): 183. is between 20% and 25%
smaller compared to Python 3.5.

The order-preserving aspect of this new implementation is considered an
implementation detail and should not be relied upon (this may change in
the future, but it is desired to have this new dict implementation in
the language for a few releases before changing the language spec to
mandate order-preserving semantics for all current and future Python
implementations; this also helps preserve backwards-compatibility with
older versions of the language where random iteration order is still in
effect, e.g.  Python 3.5).

(Contributed by INADA Naoki in bpo-27350(3).  Idea originally suggested
by Raymond Hettinger(4).)

   ---------- Footnotes ----------

   (1) 
https://mail.python.org/pipermail/python-dev/2012-December/123028.html

   (2) 
https://morepypy.blogspot.com/2015/01/faster-more-memory-efficient-and-more.html

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27350

   (4) 
https://mail.python.org/pipermail/python-dev/2012-December/123028.html


File: python.info,  Node: PEP 523 CPython にフレーム評価 API を追加,  Next: PYTHONMALLOC 環境変数,  Prev: 新たな dict 実装,  Up: 新しい機能<14>

1.9.2.15 PEP 523: CPython にフレーム評価 API を追加
...................................................

While Python provides extensive support to customize how code executes,
one place it has not done so is in the evaluation of frame objects.  If
you wanted some way to intercept frame evaluation in Python there really
wasn't any way without directly manipulating function pointers for
defined functions.

PEP 523(1) changes this by providing an API to make frame evaluation
pluggable at the C level.  This will allow for tools such as debuggers
and JITs to intercept frame evaluation before the execution of Python
code begins.  This enables the use of alternative evaluation
implementations for Python code, tracking frame evaluation, etc.

This API is not part of the limited C API and is marked as private to
signal that usage of this API is expected to be limited and only
applicable to very select, low-level use-cases.  Semantics of the API
will change with Python as necessary.

参考
....

PEP 523(2) - Adding a frame evaluation API to CPython

     PEP written by Brett Cannon and Dino Viehland.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0523/

   (2) https://peps.python.org/pep-0523/


File: python.info,  Node: PYTHONMALLOC 環境変数,  Next: DTrace and SystemTap probing support,  Prev: PEP 523 CPython にフレーム評価 API を追加,  Up: 新しい機能<14>

1.9.2.16 PYTHONMALLOC 環境変数
..............................

新たな環境変数 *note PYTHONMALLOC: e5e. により Python メモリアロケータの
設定とデバッグフックの導入ができます。

‘PYTHONMALLOC=debug’ を使用してリリースモードでコンパイルされた Python で
、Python メモリアロケータにデバッグフックを導入できるようになりました。
デバッグフックの効果は:

   * 新たに割り当てられたメモリを ‘0xCB’ バイトで埋めます

   * 解放されたメモリを ‘0xDB’ バイトで埋めます

   * Python メモリアロケータ API の違反を検知します。例えば *note
     PyMem_Malloc(): e5f. で割り当てられたメモリブロックに *note
     PyObject_Free(): e60. を呼ぶこと。

   * バッファ開始前の書き込み (バッファアンダーフロー) を検知します

   * バッファ終端後の書き込み (バッファオーバーフロー) を検知します

   * Check that the *note GIL: 474. is held when allocator functions of
     *note PYMEM_DOMAIN_OBJ: e61. (ex: *note PyObject_Malloc(): e62.)
     and *note PYMEM_DOMAIN_MEM: e63. (ex: *note PyMem_Malloc(): e5f.)
     domains are called.

Checking if the GIL is held is also a new feature of Python 3.6.

See the *note PyMem_SetupDebugHooks(): e64. function for debug hooks on
Python memory allocators.

It is now also possible to force the usage of the ‘malloc()’ allocator
of the C library for all Python memory allocations using
‘PYTHONMALLOC=malloc’.  This is helpful when using external memory
debuggers like Valgrind on a Python compiled in release mode.

On error, the debug hooks on Python memory allocators now use the *note
tracemalloc: 105. module to get the traceback where a memory block was
allocated.

Example of fatal error on buffer overflow using ‘python3.6 -X
tracemalloc=5’ (store 5 frames in traces):

     Debug memory block at address p=0x7fbcd41666f8: API 'o'
         4 bytes originally requested
         The 7 pad bytes at p-7 are FORBIDDENBYTE, as expected.
         The 8 pad bytes at tail=0x7fbcd41666fc are not all FORBIDDENBYTE (0xfb):
             at tail+0: 0x02 *** OUCH
             at tail+1: 0xfb
             at tail+2: 0xfb
             at tail+3: 0xfb
             at tail+4: 0xfb
             at tail+5: 0xfb
             at tail+6: 0xfb
             at tail+7: 0xfb
         The block was made by call #1233329 to debug malloc/realloc.
         Data at p: 1a 2b 30 00

     Memory block allocated at (most recent call first):
       File "test/test_bytes.py", line 323
       File "unittest/case.py", line 600
       File "unittest/case.py", line 648
       File "unittest/suite.py", line 122
       File "unittest/suite.py", line 84

     Fatal Python error: bad trailing pad byte

     Current thread 0x00007fbcdbd32700 (most recent call first):
       File "test/test_bytes.py", line 323 in test_hex
       File "unittest/case.py", line 600 in run
       File "unittest/case.py", line 648 in __call__
       File "unittest/suite.py", line 122 in run
       File "unittest/suite.py", line 84 in __call__
       File "unittest/suite.py", line 122 in run
       File "unittest/suite.py", line 84 in __call__
       ...

(Contributed by Victor Stinner in bpo-26516(1) and bpo-26564(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26516

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26564


File: python.info,  Node: DTrace and SystemTap probing support,  Prev: PYTHONMALLOC 環境変数,  Up: 新しい機能<14>

1.9.2.17 DTrace and SystemTap probing support
.............................................

Python can now be built ‘--with-dtrace’ which enables static markers for
the following events in the interpreter:

   * 関数の呼び出し/復帰

   * ガベージコレクションの開始/終了

   * 実行されたコードの行。

This can be used to instrument running interpreters in production,
without the need to recompile specific *note debug builds: 509. or
providing application-specific profiling/debugging code.

詳細については *note DTrace と SystemTap で CPython を測定する: e66. を
参照してください。

The current implementation is tested on Linux and macOS. Additional
markers may be added in the future.

(Contributed by Łukasz Langa in bpo-21590(1), based on patches by Jesús
Cea Avión, David Malcolm, and Nikhil Benesch.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21590


File: python.info,  Node: その他の言語変更<8>,  Next: 新たなモジュール<8>,  Prev: 新しい機能<14>,  Up: What's New In Python 3 6

1.9.3 その他の言語変更
----------------------

Python 言語コアに小さな変更がいくつか行われました:

   * A ‘global’ or ‘nonlocal’ statement must now textually appear before
     the first use of the affected name in the same scope.  Previously
     this was a *note SyntaxWarning: 1ae.

   * It is now possible to set a *note special method: e68. to ‘None’ to
     indicate that the corresponding operation is not available.  For
     example, if a class sets *note __iter__(): e69. to ‘None’, the
     class is not iterable.  (Contributed by Andrew Barnert and Ivan
     Levkivskyi in bpo-25958(1).)

   * Long sequences of repeated traceback lines are now abbreviated as
     ‘"[Previous line repeated {count} more times]"’ (see *note
     traceback: e6a. for an example).  (Contributed by Emanuel Barry in
     bpo-26823(2).)

   * Import now raises the new exception *note ModuleNotFoundError: d3d.
     (subclass of *note ImportError: 65b.) when it cannot find a module.
     Code that currently checks for ImportError (in try-except) will
     still work.  (Contributed by Eric Snow in bpo-15767(3).)

   * Class methods relying on zero-argument ‘super()’ will now work
     correctly when called from metaclass methods during class creation.
     (Contributed by Martin Teichmann in bpo-23722(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25958

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26823

   (3) https://bugs.python.org/issue?@action=redirect&bpo=15767

   (4) https://bugs.python.org/issue?@action=redirect&bpo=23722


File: python.info,  Node: 新たなモジュール<8>,  Next: 改良されたモジュール<8>,  Prev: その他の言語変更<8>,  Up: What's New In Python 3 6

1.9.4 新たなモジュール
----------------------

* Menu:

* secrets::


File: python.info,  Node: secrets,  Up: 新たなモジュール<8>

1.9.4.1 secrets
...............

The main purpose of the new *note secrets: c5. module is to provide an
obvious way to reliably generate cryptographically strong pseudo-random
values suitable for managing secrets, such as account authentication,
tokens, and similar.

     警告: Note that the pseudo-random generators in the *note random:
     bd. module should 'NOT' be used for security purposes.  Use *note
     secrets: c5. on Python 3.6+ and *note os.urandom(): 746. on Python
     3.5 and earlier.

参考
....

PEP 506(1) - Adding A Secrets Module To The Standard Library

     PEP written and implemented by Steven D'Aprano.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0506/


File: python.info,  Node: 改良されたモジュール<8>,  Next: 最適化<9>,  Prev: 新たなモジュール<8>,  Up: What's New In Python 3 6

1.9.5 改良されたモジュール
--------------------------

* Menu:

* array: array<3>.
* ast: ast<6>.
* asyncio: asyncio<12>.
* binascii: binascii<2>.
* cmath::
* collections: collections<4>.
* concurrent.futures: concurrent futures<5>.
* contextlib: contextlib<4>.
* datetime: datetime<6>.
* decimal: decimal<3>.
* distutils: distutils<5>.
* email: email<3>.
* エンコーディング: エンコーディング<2>.
* enum: enum<7>.
* faulthandler: faulthandler<3>.
* fileinput: fileinput<2>.
* hashlib: hashlib<5>.
* http.client: http client<2>.
* idlelib と IDLE: idlelib と IDLE<2>.
* importlib: importlib<6>.
* inspect: inspect<7>.
* json: json<2>.
* logging: logging<4>.
* math: math<8>.
* multiprocessing: multiprocessing<6>.
* os: os<9>.
* pathlib: pathlib<12>.
* pdb: pdb<7>.
* pickle: pickle<3>.
* pickletools::
* pydoc: pydoc<4>.
* random: random<4>.
* re: re<6>.
* readline::
* rlcompleter::
* shlex: shlex<2>.
* site: site<3>.
* sqlite3: sqlite3<8>.
* socket: socket<8>.
* socketserver: socketserver<2>.
* ssl: ssl<8>.
* statistics: statistics<5>.
* struct: struct<2>.
* subprocess: subprocess<3>.
* sys: sys<10>.
* telnetlib::
* time: time<6>.
* timeit::
* tkinter: tkinter<7>.
* traceback: traceback<4>.
* tracemalloc: tracemalloc<3>.
* typing: typing<10>.
* unicodedata: unicodedata<8>.
* unittest.mock: unittest mock<2>.
* urllib.request: urllib request.
* urllib.robotparser: urllib robotparser.
* venv: venv<5>.
* warnings: warnings<4>.
* winreg::
* winsound::
* xmlrpc.client: xmlrpc client.
* zipfile: zipfile<4>.
* zlib: zlib<2>.


File: python.info,  Node: array<3>,  Next: ast<6>,  Up: 改良されたモジュール<8>

1.9.5.1 array
.............

Exhausted iterators of *note array.array: 4be. will now stay exhausted
even if the iterated array is extended.  This is consistent with the
behavior of other mutable sequences.

Contributed by Serhiy Storchaka in bpo-26492(1).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26492


File: python.info,  Node: ast<6>,  Next: asyncio<12>,  Prev: array<3>,  Up: 改良されたモジュール<8>

1.9.5.2 ast
...........

The new *note ast.Constant: 2ef. AST node has been added.  It can be
used by external AST optimizers for the purposes of constant folding.

Contributed by Victor Stinner in bpo-26146(1).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26146


File: python.info,  Node: asyncio<12>,  Next: binascii<2>,  Prev: ast<6>,  Up: 改良されたモジュール<8>

1.9.5.3 asyncio
...............

Starting with Python 3.6 the ‘asyncio’ module is no longer provisional
and its API is considered stable.

Notable changes in the *note asyncio: b. module since Python 3.5.0 (all
backported to 3.5.x due to the provisional status):

   * The *note get_event_loop(): 2f2. function has been changed to
     always return the currently running loop when called from
     coroutines and callbacks.  (Contributed by Yury Selivanov in
     bpo-28613(1).)

   * The *note ensure_future(): e71. function and all functions that use
     it, such as *note loop.run_until_complete(): e72, now accept all
     kinds of *note awaitable objects: 4c9.  (Contributed by Yury
     Selivanov.)

   * 他のスレッドからコルーチンをイベントループに送信するための新たな
     *note run_coroutine_threadsafe(): a82. 関数。 (Contributed by
     Vincent Michel.)

   * New *note Transport.is_closing(): e73. method to check if the
     transport is closing or closed.  (Contributed by Yury Selivanov.)

   * The *note loop.create_server(): d09. method can now accept a list
     of hosts.  (Contributed by Yann Sionneau.)

   * New *note loop.create_future(): e74. method to create Future
     objects.  This allows alternative event loop implementations, such
     as uvloop(2), to provide a faster *note asyncio.Future: dc6.
     implementation.  (Contributed by Yury Selivanov in bpo-27041(3).)

   * New *note loop.get_exception_handler(): e75. method to get the
     current exception handler.  (Contributed by Yury Selivanov in
     bpo-27040(4).)

   * 新しい *note StreamReader.readuntil(): 4d0. メソッドで、区切りとな
     るバイトの並びが出てくるまでストリームからデータを読み取れるように
     なりました。 (Contributed by Mark Korenberg.)

   * The performance of *note StreamReader.readexactly(): e76. has been
     improved.  (Contributed by Mark Korenberg in bpo-28370(5).)

   * The *note loop.getaddrinfo(): e0e. method is optimized to avoid
     calling the system ‘getaddrinfo’ function if the address is already
     resolved.  (Contributed by A. Jesse Jiryu Davis.)

   * The *note loop.stop(): e77. method has been changed to stop the
     loop immediately after the current iteration.  Any new callbacks
     scheduled as a result of the last iteration will be discarded.
     (Contributed by Guido van Rossum in bpo-25593(6).)

   * *note Future.set_exception: e78. will now raise *note TypeError:
     198. when passed an instance of the *note StopIteration: df5.
     exception.  (Contributed by Chris Angelico in bpo-26221(7).)

   * New *note loop.connect_accepted_socket(): 9de. method to be used by
     servers that accept connections outside of asyncio, but that use
     asyncio to handle them.  (Contributed by Jim Fulton in
     bpo-27392(8).)

   * ‘TCP_NODELAY’ flag is now set for all TCP transports by default.
     (Contributed by Yury Selivanov in bpo-27456(9).)

   * New *note loop.shutdown_asyncgens(): e79. to properly close pending
     asynchronous generators before closing the loop.  (Contributed by
     Yury Selivanov in bpo-28003(10).)

   * *note Future: dc6. and *note Task: 1c7. classes now have an
     optimized C implementation which makes asyncio code up to 30%
     faster.  (Contributed by Yury Selivanov and INADA Naoki in
     bpo-26081(11) and bpo-28544(12).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28613

   (2) https://github.com/MagicStack/uvloop

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27041

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27040

   (5) https://bugs.python.org/issue?@action=redirect&bpo=28370

   (6) https://bugs.python.org/issue?@action=redirect&bpo=25593

   (7) https://bugs.python.org/issue?@action=redirect&bpo=26221

   (8) https://bugs.python.org/issue?@action=redirect&bpo=27392

   (9) https://bugs.python.org/issue?@action=redirect&bpo=27456

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28003

   (11) https://bugs.python.org/issue?@action=redirect&bpo=26081

   (12) https://bugs.python.org/issue?@action=redirect&bpo=28544


File: python.info,  Node: binascii<2>,  Next: cmath,  Prev: asyncio<12>,  Up: 改良されたモジュール<8>

1.9.5.4 binascii
................

The *note b2a_base64(): e7b. function now accepts an optional 'newline'
keyword argument to control whether the newline character is appended to
the return value.  (Contributed by Victor Stinner in bpo-25357(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25357


File: python.info,  Node: cmath,  Next: collections<4>,  Prev: binascii<2>,  Up: 改良されたモジュール<8>

1.9.5.5 cmath
.............

The new *note cmath.tau: e7d. ('τ') constant has been added.
(Contributed by Lisa Roach in bpo-12345(1), see PEP 628(2) for details.)

新たに定数が追加されました。 *note math.inf: e7e. と *note math.nan:
873. に対応する *note cmath.inf: e7f. と *note cmath.nan: e80.。複素数の
repr が使用する書式に対応する *note cmath.infj: e81. と *note
cmath.nanj: e82.。 (Contributed by Mark Dickinson in bpo-23229(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12345

   (2) https://peps.python.org/pep-0628/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23229


File: python.info,  Node: collections<4>,  Next: concurrent futures<5>,  Prev: cmath,  Up: 改良されたモジュール<8>

1.9.5.6 collections
...................

The new *note Collection: e84. abstract base class has been added to
represent sized iterable container classes.  (Contributed by Ivan
Levkivskyi, docs by Neil Girdhar in bpo-27598(1).)

The new *note Reversible: e85. abstract base class represents iterable
classes that also provide the *note __reversed__(): e86. method.
(Contributed by Ivan Levkivskyi in bpo-25987(2).)

The new *note AsyncGenerator: e87. abstract base class represents
asynchronous generators.  (Contributed by Yury Selivanov in
bpo-28720(3).)

The *note namedtuple(): 4e0. function now accepts an optional keyword
argument 'module', which, when specified, is used for the *note
__module__: 617. attribute of the returned named tuple class.
(Contributed by Raymond Hettinger in bpo-17941(4).)

The 'verbose' and 'rename' arguments for *note namedtuple(): 4e0. are
now keyword-only.  (Contributed by Raymond Hettinger in bpo-25628(5).)

Recursive *note collections.deque: 7f4. instances can now be pickled.
(Contributed by Serhiy Storchaka in bpo-26482(6).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27598

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25987

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28720

   (4) https://bugs.python.org/issue?@action=redirect&bpo=17941

   (5) https://bugs.python.org/issue?@action=redirect&bpo=25628

   (6) https://bugs.python.org/issue?@action=redirect&bpo=26482


File: python.info,  Node: concurrent futures<5>,  Next: contextlib<4>,  Prev: collections<4>,  Up: 改良されたモジュール<8>

1.9.5.7 concurrent.futures
..........................

The *note ThreadPoolExecutor: 949. class constructor now accepts an
optional 'thread_name_prefix' argument to make it possible to customize
the names of the threads created by the pool.  (Contributed by Gregory
P.  Smith in bpo-27664(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27664


File: python.info,  Node: contextlib<4>,  Next: datetime<6>,  Prev: concurrent futures<5>,  Up: 改良されたモジュール<8>

1.9.5.8 contextlib
..................

The *note contextlib.AbstractContextManager: e8a. class has been added
to provide an abstract base class for context managers.  It provides a
sensible default implementation for ‘__enter__()’ which returns ‘self’
and leaves ‘__exit__()’ an abstract method.  A matching class has been
added to the *note typing: 10a. module as *note typing.ContextManager:
e8b.  (Contributed by Brett Cannon in bpo-25609(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25609


File: python.info,  Node: datetime<6>,  Next: decimal<3>,  Prev: contextlib<4>,  Up: 改良されたモジュール<8>

1.9.5.9 datetime
................

The *note datetime: 4e2. and *note time: 1fb. classes have the new *note
fold: e8d. attribute used to disambiguate local time when necessary.
Many functions in the *note datetime: 34. have been updated to support
local time disambiguation.  See *note Local Time Disambiguation: e36.
section for more information.  (Contributed by Alexander Belopolsky in
bpo-24773(1).)

The *note datetime.strftime(): e8e. and *note date.strftime(): e8f.
methods now support ISO 8601 date directives ‘%G’, ‘%u’ and ‘%V’.
(Contributed by Ashley Anderson in bpo-12006(2).)

The *note datetime.isoformat(): d25. function now accepts an optional
'timespec' argument that specifies the number of additional components
of the time value to include.  (Contributed by Alessandro Cucci and
Alexander Belopolsky in bpo-19475(3).)

The *note datetime.combine(): e90. now accepts an optional 'tzinfo'
argument.  (Contributed by Alexander Belopolsky in bpo-27661(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24773

   (2) https://bugs.python.org/issue?@action=redirect&bpo=12006

   (3) https://bugs.python.org/issue?@action=redirect&bpo=19475

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27661


File: python.info,  Node: decimal<3>,  Next: distutils<5>,  Prev: datetime<6>,  Up: 改良されたモジュール<8>

1.9.5.10 decimal
................

New *note Decimal.as_integer_ratio(): e92. method that returns a pair
‘(n, d)’ of integers that represent the given *note Decimal: 1fe.
instance as a fraction, in lowest terms and with a positive denominator:

     >>> Decimal('-3.14').as_integer_ratio()
     (-157, 50)

(Contributed by Stefan Krah amd Mark Dickinson in bpo-25928(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25928


File: python.info,  Node: distutils<5>,  Next: email<3>,  Prev: decimal<3>,  Up: 改良されたモジュール<8>

1.9.5.11 distutils
..................

The ‘default_format’ attribute has been removed from
‘distutils.command.sdist.sdist’ and the ‘formats’ attribute defaults to
‘['gztar']’.  Although not anticipated, any code relying on the presence
of ‘default_format’ may need to be adapted.  See bpo-27819(1) for more
details.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27819


File: python.info,  Node: email<3>,  Next: エンコーディング<2>,  Prev: distutils<5>,  Up: 改良されたモジュール<8>

1.9.5.12 email
..............

The new email API, enabled via the 'policy' keyword to various
constructors, is no longer provisional.  The *note email: 3f.
documentation has been reorganized and rewritten to focus on the new
API, while retaining the old documentation for the legacy API.
(Contributed by R. David Murray in bpo-24277(1).)

The *note email.mime: 49. classes now all accept an optional 'policy'
keyword.  (Contributed by Berker Peksag in bpo-27331(2).)

The *note DecodedGenerator: e95. now supports the 'policy' keyword.

There is a new *note policy: 53. attribute, *note message_factory: e96,
that controls what class is used by default when the parser creates new
message objects.  For the *note email.policy.compat32: e97. policy this
is *note Message: 581, for the new policies it is *note EmailMessage:
580.  (Contributed by R. David Murray in bpo-20476(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24277

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27331

   (3) https://bugs.python.org/issue?@action=redirect&bpo=20476


File: python.info,  Node: エンコーディング<2>,  Next: enum<7>,  Prev: email<3>,  Up: 改良されたモジュール<8>

1.9.5.13 エンコーディング
.........................

On Windows, added the ‘'oem'’ encoding to use ‘CP_OEMCP’, and the
‘'ansi'’ alias for the existing ‘'mbcs'’ encoding, which uses the
‘CP_ACP’ code page.  (Contributed by Steve Dower in bpo-27959(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27959


File: python.info,  Node: enum<7>,  Next: faulthandler<3>,  Prev: エンコーディング<2>,  Up: 改良されたモジュール<8>

1.9.5.14 enum
.............

Two new enumeration base classes have been added to the *note enum: 5a.
module: *note Flag: 835. and *note IntFlag: e9a.  Both are used to
define constants that can be combined using the bitwise operators.
(Contributed by Ethan Furman in bpo-23591(1).)

Many standard library modules have been updated to use the *note
IntFlag: e9a. class for their constants.

The new *note enum.auto: e9b. value can be used to assign values to enum
members automatically:

     >>> from enum import Enum, auto
     >>> class Color(Enum):
     ...     red = auto()
     ...     blue = auto()
     ...     green = auto()
     ...
     >>> list(Color)
     [<Color.red: 1>, <Color.blue: 2>, <Color.green: 3>]

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23591


File: python.info,  Node: faulthandler<3>,  Next: fileinput<2>,  Prev: enum<7>,  Up: 改良されたモジュール<8>

1.9.5.15 faulthandler
.....................

On Windows, the *note faulthandler: 5c. module now installs a handler
for Windows exceptions: see *note faulthandler.enable(): 20f.
(Contributed by Victor Stinner in bpo-23848(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23848


File: python.info,  Node: fileinput<2>,  Next: hashlib<5>,  Prev: faulthandler<3>,  Up: 改良されたモジュール<8>

1.9.5.16 fileinput
..................

*note hook_encoded(): e9e. now supports the 'errors' argument.
(Contributed by Joseph Hackman in bpo-25788(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25788


File: python.info,  Node: hashlib<5>,  Next: http client<2>,  Prev: fileinput<2>,  Up: 改良されたモジュール<8>

1.9.5.17 hashlib
................

*note hashlib: 6c. supports OpenSSL 1.1.0.  The minimum recommend
version is 1.0.2.  (Contributed by Christian Heimes in bpo-26470(1).)

BLAKE2 hash functions were added to the module.  *note blake2b(): 852.
and *note blake2s(): 853. are always available and support the full
feature set of BLAKE2.  (Contributed by Christian Heimes in bpo-26798(2)
based on code by Dmitry Chestnykh and Samuel Neves.  Documentation
written by Dmitry Chestnykh.)

The SHA-3 hash functions *note sha3_224(): ea0, *note sha3_256(): ea1,
*note sha3_384(): ea2, *note sha3_512(): ea3, and SHAKE hash functions
*note shake_128(): ea4. and *note shake_256(): ea5. were added.
(Contributed by Christian Heimes in bpo-16113(3).  Keccak Code Package
by Guido Bertoni, Joan Daemen, Michaël Peeters, Gilles Van Assche, and
Ronny Van Keer.)

The password-based key derivation function *note scrypt(): e38. is now
available with OpenSSL 1.1.0 and newer.  (Contributed by Christian
Heimes in bpo-27928(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26470

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26798

   (3) https://bugs.python.org/issue?@action=redirect&bpo=16113

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27928


File: python.info,  Node: http client<2>,  Next: idlelib と IDLE<2>,  Prev: hashlib<5>,  Up: 改良されたモジュール<8>

1.9.5.18 http.client
....................

*note HTTPConnection.request(): ea7. and *note endheaders(): ea8. both
now support chunked encoding request bodies.  (Contributed by Demian
Brecht and Rolf Krahl in bpo-12319(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12319


File: python.info,  Node: idlelib と IDLE<2>,  Next: importlib<6>,  Prev: http client<2>,  Up: 改良されたモジュール<8>

1.9.5.19 idlelib と IDLE
........................

The idlelib package is being modernized and refactored to make IDLE look
and work better and to make the code easier to understand, test, and
improve.  Part of making IDLE look better, especially on Linux and Mac,
is using ttk widgets, mostly in the dialogs.  As a result, IDLE no
longer runs with tcl/tk 8.4.  It now requires tcl/tk 8.5 or 8.6.  We
recommend running the latest release of either.

'Modernizing' includes renaming and consolidation of idlelib modules.
The renaming of files with partial uppercase names is similar to the
renaming of, for instance, Tkinter and TkFont to tkinter and
tkinter.font in 3.0.  As a result, imports of idlelib files that worked
in 3.5 will usually not work in 3.6.  At least a module name change will
be needed (see idlelib/README.txt), sometimes more.  (Name changes
contributed by Al Swiegart and Terry Reedy in bpo-24225(1).  Most
idlelib patches since have been and will be part of the process.)

In compensation, the eventual result with be that some idlelib classes
will be easier to use, with better APIs and docstrings explaining them.
Additional useful information will be added to idlelib when available.

New in 3.6.2:

自動補完におけるいくつもの修正。 (Contributed by Louie Lu in
bpo-15786(2).)

New in 3.6.3:

Module Browser (on the File menu, formerly called Class Browser), now
displays nested functions and classes in addition to top-level functions
and classes.  (Contributed by Guilherme Polo, Cheryl Sabella, and Terry
Jan Reedy in bpo-1612262(3).)

The IDLE features formerly implemented as extensions have been
reimplemented as normal features.  Their settings have been moved from
the Extensions tab to other dialog tabs.  (Contributed by Charles
Wohlganger and Terry Jan Reedy in bpo-27099(4).)

The Settings dialog (Options, Configure IDLE) has been partly rewritten
to improve both appearance and function.  (Contributed by Cheryl Sabella
and Terry Jan Reedy in multiple issues.)

New in 3.6.4:

The font sample now includes a selection of non-Latin characters so that
users can better see the effect of selecting a particular font.
(Contributed by Terry Jan Reedy in bpo-13802(5).)  The sample can be
edited to include other characters.  (Contributed by Serhiy Storchaka in
bpo-31860(6).)

New in 3.6.6:

Editor code context option revised.  Box displays all context lines up
to maxlines.  Clicking on a context line jumps the editor to that line.
Context colors for custom themes is added to Highlights tab of Settings
dialog.  (Contributed by Cheryl Sabella and Terry Jan Reedy in
bpo-33642(7), bpo-33768(8), and bpo-33679(9).)

On Windows, a new API call tells Windows that tk scales for DPI. On
Windows 8.1+ or 10, with DPI compatibility properties of the Python
binary unchanged, and a monitor resolution greater than 96 DPI, this
should make text and lines sharper.  It should otherwise have no effect.
(Contributed by Terry Jan Reedy in bpo-33656(10).)

New in 3.6.7:

Output over N lines (50 by default) is squeezed down to a button.  N can
be changed in the PyShell section of the General page of the Settings
dialog.  Fewer, but possibly extra long, lines can be squeezed by right
clicking on the output.  Squeezed output can be expanded in place by
double-clicking the button or into the clipboard or a separate window by
right-clicking the button.  (Contributed by Tal Einat in
bpo-1529353(11).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24225

   (2) https://bugs.python.org/issue?@action=redirect&bpo=15786

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1612262

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27099

   (5) https://bugs.python.org/issue?@action=redirect&bpo=13802

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31860

   (7) https://bugs.python.org/issue?@action=redirect&bpo=33642

   (8) https://bugs.python.org/issue?@action=redirect&bpo=33768

   (9) https://bugs.python.org/issue?@action=redirect&bpo=33679

   (10) https://bugs.python.org/issue?@action=redirect&bpo=33656

   (11) https://bugs.python.org/issue?@action=redirect&bpo=1529353


File: python.info,  Node: importlib<6>,  Next: inspect<7>,  Prev: idlelib と IDLE<2>,  Up: 改良されたモジュール<8>

1.9.5.20 importlib
..................

Import now raises the new exception *note ModuleNotFoundError: d3d.
(subclass of *note ImportError: 65b.) when it cannot find a module.
Code that current checks for ‘ImportError’ (in try-except) will still
work.  (Contributed by Eric Snow in bpo-15767(1).)

*note importlib.util.LazyLoader: eab. now calls *note create_module():
eac. on the wrapped loader, removing the restriction that *note
importlib.machinery.BuiltinImporter: ead. and *note
importlib.machinery.ExtensionFileLoader: eae. couldn't be used with
*note importlib.util.LazyLoader: eab.

*note importlib.util.cache_from_source(): 353, *note
importlib.util.source_from_cache(): 73e, and *note
importlib.util.spec_from_file_location(): eaf. now accept a *note
path-like object: 5a1.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15767


File: python.info,  Node: inspect<7>,  Next: json<2>,  Prev: importlib<6>,  Up: 改良されたモジュール<8>

1.9.5.21 inspect
................

The *note inspect.signature(): 22f. function now reports the implicit
‘.0’ parameters generated by the compiler for comprehension and
generator expression scopes as if they were positional-only parameters
called ‘implicit0’.  (Contributed by Jelle Zijlstra in bpo-19611(1).)

To reduce code churn when upgrading from Python 2.7 and the legacy
‘inspect.getargspec()’ API, the previously documented deprecation of
*note inspect.getfullargspec(): 941. has been reversed.  While this
function is convenient for single/source Python 2/3 code bases, the
richer *note inspect.signature(): 22f. interface remains the recommended
approach for new code.  (Contributed by Nick Coghlan in bpo-27172(2))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19611

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27172


File: python.info,  Node: json<2>,  Next: logging<4>,  Prev: inspect<7>,  Up: 改良されたモジュール<8>

1.9.5.22 json
.............

*note json.load(): eb2. と *note json.loads(): b4e. は、バイナリ入力をサ
ポートしました。エンコード済みのJSON は、 UTF-8, UTF-16, UTF-32のいずれ
かを返すべきです。 (Contributed by Serhiy Storchaka in bpo-17909(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17909


File: python.info,  Node: logging<4>,  Next: math<8>,  Prev: json<2>,  Up: 改良されたモジュール<8>

1.9.5.23 logging
................

新しく *note WatchedFileHandler.reopenIfNeeded(): eb4. メソッドが追加さ
れ、ログファイルを再オープンする必要があるかどうかをチェックする機能が追
加れました。(Contributed by Marian Horban in bpo-24884(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24884


File: python.info,  Node: math<8>,  Next: multiprocessing<6>,  Prev: logging<4>,  Up: 改良されたモジュール<8>

1.9.5.24 math
.............

The tau ('τ') constant has been added to the *note math: 92. and *note
cmath: 19. modules.  (Contributed by Lisa Roach in bpo-12345(1), see PEP
628(2) for details.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12345

   (2) https://peps.python.org/pep-0628/


File: python.info,  Node: multiprocessing<6>,  Next: os<9>,  Prev: math<8>,  Up: 改良されたモジュール<8>

1.9.5.25 multiprocessing
........................

*note Proxy Objects: 24c. returned by *note multiprocessing.Manager():
250. can now be nested.  (Contributed by Davin Potts in bpo-6766(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=6766


File: python.info,  Node: os<9>,  Next: pathlib<12>,  Prev: multiprocessing<6>,  Up: 改良されたモジュール<8>

1.9.5.26 os
...........

See the summary of *note PEP 519: e35. for details on how the *note os:
a5. and *note os.path: a6. modules now support *note path-like objects:
5a1.

*note scandir(): c54. now supports *note bytes: 192. paths on Windows.

A new *note close(): eb8. method allows explicitly closing a *note
scandir(): c54. iterator.  The *note scandir(): c54. iterator now
supports the *note context manager: 1e1. protocol.  If a ‘scandir()’
iterator is neither exhausted nor explicitly closed a *note
ResourceWarning: 54c. will be emitted in its destructor.  (Contributed
by Serhiy Storchaka in bpo-25994(1).)

On Linux, *note os.urandom(): 746. now blocks until the system urandom
entropy pool is initialized to increase the security.  See the PEP
524(2) for the rationale.

The Linux ‘getrandom()’ syscall (get random bytes) is now exposed as the
new *note os.getrandom(): eb9. function.  (Contributed by Victor
Stinner, part of the PEP 524(3))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25994

   (2) https://peps.python.org/pep-0524/

   (3) https://peps.python.org/pep-0524/


File: python.info,  Node: pathlib<12>,  Next: pdb<7>,  Prev: os<9>,  Up: 改良されたモジュール<8>

1.9.5.27 pathlib
................

*note pathlib: a8. は *note path-like objects: 5a1. をサポートしました。
(Contributed by Brett Cannon in bpo-27186(1).)

詳細は、 *note PEP 519: e35. の要約を参照してください。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27186


File: python.info,  Node: pdb<7>,  Next: pickle<3>,  Prev: pathlib<12>,  Up: 改良されたモジュール<8>

1.9.5.28 pdb
............

*note Pdb: 273. クラスのコンストラクタに、新しくオプション引数 'readrc'
が増えました。この引数は、 ‘.pdbrc’ ファイルを読み込むかどうかを指定しま
す。


File: python.info,  Node: pickle<3>,  Next: pickletools,  Prev: pdb<7>,  Up: 改良されたモジュール<8>

1.9.5.29 pickle
...............

Objects that need ‘__new__’ called with keyword arguments can now be
pickled using *note pickle protocols: 27b. older than protocol version
4.  Protocol version 4 already supports this case.  (Contributed by
Serhiy Storchaka in bpo-24164(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24164


File: python.info,  Node: pickletools,  Next: pydoc<4>,  Prev: pickle<3>,  Up: 改良されたモジュール<8>

1.9.5.30 pickletools
....................

*note pickletools.dis(): ebe. now outputs the implicit memo index for
the ‘MEMOIZE’ opcode.  (Contributed by Serhiy Storchaka in
bpo-25382(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25382


File: python.info,  Node: pydoc<4>,  Next: random<4>,  Prev: pickletools,  Up: 改良されたモジュール<8>

1.9.5.31 pydoc
..............

The *note pydoc: ba. module has learned to respect the ‘MANPAGER’
environment variable.  (Contributed by Matthias Klose in bpo-8637(1).)

*note help(): ad4. and *note pydoc: ba. can now list named tuple fields
in the order they were defined rather than alphabetically.  (Contributed
by Raymond Hettinger in bpo-24879(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=8637

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24879


File: python.info,  Node: random<4>,  Next: re<6>,  Prev: pydoc<4>,  Up: 改良されたモジュール<8>

1.9.5.32 random
...............

The new *note choices(): ec1. function returns a list of elements of
specified size from the given population with optional weights.
(Contributed by Raymond Hettinger in bpo-18844(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18844


File: python.info,  Node: re<6>,  Next: readline,  Prev: random<4>,  Up: 改良されたモジュール<8>

1.9.5.33 re
...........

Added support of modifier spans in regular expressions.  Examples:
‘'(?i:p)ython'’ matches ‘'python'’ and ‘'Python'’, but not ‘'PYTHON'’;
‘'(?i)g(?-i:v)r'’ matches ‘'GvR'’ and ‘'gvr'’, but not ‘'GVR'’.
(Contributed by Serhiy Storchaka in bpo-433028(1).)

Match object groups can be accessed by ‘__getitem__’, which is
equivalent to ‘group()’.  So ‘mo['name']’ is now equivalent to
‘mo.group('name')’.  (Contributed by Eric Smith in bpo-24454(2).)

*note Match: ec3. objects now support *note index-like objects: 19e. as
group indices.  (Contributed by Jeroen Demeyer and Xiang Zhang in
bpo-27177(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=433028

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24454

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27177


File: python.info,  Node: readline,  Next: rlcompleter,  Prev: re<6>,  Up: 改良されたモジュール<8>

1.9.5.34 readline
.................

Added *note set_auto_history(): ec5. to enable or disable automatic
addition of input to the history list.  (Contributed by Tyler Crompton
in bpo-26870(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26870


File: python.info,  Node: rlcompleter,  Next: shlex<2>,  Prev: readline,  Up: 改良されたモジュール<8>

1.9.5.35 rlcompleter
....................

Private and special attribute names now are omitted unless the prefix
starts with underscores.  A space or a colon is added after some
completed keywords.  (Contributed by Serhiy Storchaka in bpo-25011(1)
and bpo-25209(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25011

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25209


File: python.info,  Node: shlex<2>,  Next: site<3>,  Prev: rlcompleter,  Up: 改良されたモジュール<8>

1.9.5.36 shlex
..............

The *note shlex: ec8. has much *note improved shell compatibility: ec9.
through the new 'punctuation_chars' argument to control which characters
are treated as punctuation.  (Contributed by Vinay Sajip in
bpo-1521950(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1521950


File: python.info,  Node: site<3>,  Next: sqlite3<8>,  Prev: shlex<2>,  Up: 改良されたモジュール<8>

1.9.5.37 site
.............

When specifying paths to add to *note sys.path: 3e4. in a ‘.pth’ file,
you may now specify file paths on top of directories (e.g.  zip files).
(Contributed by Wolfgang Langner in bpo-26587(1)).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26587


File: python.info,  Node: sqlite3<8>,  Next: socket<8>,  Prev: site<3>,  Up: 改良されたモジュール<8>

1.9.5.38 sqlite3
................

*note sqlite3.Cursor.lastrowid: ecc. は、 ‘REPLACE’ 文をサポートしました
。 (Contributed by Alex LordThorsen in bpo-16864(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16864


File: python.info,  Node: socket<8>,  Next: socketserver<2>,  Prev: sqlite3<8>,  Up: 改良されたモジュール<8>

1.9.5.39 socket
...............

The *note ioctl(): ece. function now supports the *note
SIO_LOOPBACK_FAST_PATH: ecf. control code.  (Contributed by Daniel
Stokes in bpo-26536(1).)

The *note getsockopt(): ed0. constants ‘SO_DOMAIN’, ‘SO_PROTOCOL’,
‘SO_PEERSEC’, and ‘SO_PASSSEC’ are now supported.  (Contributed by
Christian Heimes in bpo-26907(2).)

The *note setsockopt(): ed1. now supports the ‘setsockopt(level,
optname, None, optlen: int)’ form.  (Contributed by Christian Heimes in
bpo-27744(3).)

The socket module now supports the address family *note AF_ALG: ed2. to
interface with Linux Kernel crypto API. ‘ALG_*’, ‘SOL_ALG’ and *note
sendmsg_afalg(): ed3. were added.  (Contributed by Christian Heimes in
bpo-27744(4) with support from Victor Stinner.)

New Linux constants ‘TCP_USER_TIMEOUT’ and ‘TCP_CONGESTION’ were added.
(Contributed by Omar Sandoval, bpo-26273(5)).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26536

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26907

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27744

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27744

   (5) https://bugs.python.org/issue?@action=redirect&bpo=26273


File: python.info,  Node: socketserver<2>,  Next: ssl<8>,  Prev: socket<8>,  Up: 改良されたモジュール<8>

1.9.5.40 socketserver
.....................

Servers based on the *note socketserver: d2. module, including those
defined in *note http.server: 76, *note xmlrpc.server: 135. and *note
wsgiref.simple_server: 121, now support the *note context manager: 1e1.
protocol.  (Contributed by Aviv Palivoda in bpo-26404(1).)

The *note wfile: ed5. attribute of *note StreamRequestHandler: ed6.
classes now implements the *note io.BufferedIOBase: 8a3. writable
interface.  In particular, calling *note write(): ed7. is now guaranteed
to send the data in full.  (Contributed by Martin Panter in
bpo-26721(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26404

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26721


File: python.info,  Node: ssl<8>,  Next: statistics<5>,  Prev: socketserver<2>,  Up: 改良されたモジュール<8>

1.9.5.41 ssl
............

*note ssl: d5. supports OpenSSL 1.1.0.  The minimum recommend version is
1.0.2.  (Contributed by Christian Heimes in bpo-26470(1).)

3DES has been removed from the default cipher suites and ChaCha20
Poly1305 cipher suites have been added.  (Contributed by Christian
Heimes in bpo-27850(2) and bpo-27766(3).)

*note SSLContext: 357. has better default configuration for options and
ciphers.  (Contributed by Christian Heimes in bpo-28043(4).)

SSL session can be copied from one client-side connection to another
with the new *note SSLSession: ed9. class.  TLS session resumption can
speed up the initial handshake, reduce latency and improve performance
(Contributed by Christian Heimes in bpo-19500(5) based on a draft by
Alex Warhawk.)

The new *note get_ciphers(): eda. method can be used to get a list of
enabled ciphers in order of cipher priority.

All constants and flags have been converted to *note IntEnum: edb. and
*note IntFlag: e9a.  (Contributed by Christian Heimes in bpo-28025(6).)

Server and client-side specific TLS protocols for *note SSLContext: 357.
were added.  (Contributed by Christian Heimes in bpo-28085(7).)

Added *note ssl.SSLContext.post_handshake_auth: c26. to enable and *note
ssl.SSLSocket.verify_client_post_handshake(): c27. to initiate TLS 1.3
post-handshake authentication.  (Contributed by Christian Heimes in
gh-78851(8).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26470

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27850

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27766

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28043

   (5) https://bugs.python.org/issue?@action=redirect&bpo=19500

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28025

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28085

   (8) https://github.com/python/cpython/issues/78851


File: python.info,  Node: statistics<5>,  Next: struct<2>,  Prev: ssl<8>,  Up: 改良されたモジュール<8>

1.9.5.42 statistics
...................

A new *note harmonic_mean(): edd. function has been added.  (Contributed
by Steven D'Aprano in bpo-27181(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27181


File: python.info,  Node: struct<2>,  Next: subprocess<3>,  Prev: statistics<5>,  Up: 改良されたモジュール<8>

1.9.5.43 struct
...............

*note struct: db. now supports IEEE 754 half-precision floats via the
‘'e'’ format specifier.  (Contributed by Eli Stevens, Mark Dickinson in
bpo-11734(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11734


File: python.info,  Node: subprocess<3>,  Next: sys<10>,  Prev: struct<2>,  Up: 改良されたモジュール<8>

1.9.5.44 subprocess
...................

*note subprocess.Popen: 4b7. destructor now emits a *note
ResourceWarning: 54c. warning if the child process is still running.
Use the context manager protocol (‘with proc: ...’) or explicitly call
the *note wait(): ee0. method to read the exit status of the child
process.  (Contributed by Victor Stinner in bpo-26741(1).)

The *note subprocess.Popen: 4b7. constructor and all functions that pass
arguments through to it now accept 'encoding' and 'errors' arguments.
Specifying either of these will enable text mode for the 'stdin',
'stdout' and 'stderr' streams.  (Contributed by Steve Dower in
bpo-6135(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26741

   (2) https://bugs.python.org/issue?@action=redirect&bpo=6135


File: python.info,  Node: sys<10>,  Next: telnetlib,  Prev: subprocess<3>,  Up: 改良されたモジュール<8>

1.9.5.45 sys
............

The new *note getfilesystemencodeerrors(): ee2. function returns the
name of the error mode used to convert between Unicode filenames and
bytes filenames.  (Contributed by Steve Dower in bpo-27781(1).)

On Windows the return value of the *note getwindowsversion(): ee3.
function now includes the 'platform_version' field which contains the
accurate major version, minor version and build number of the current
operating system, rather than the version that is being emulated for the
process (Contributed by Steve Dower in bpo-27932(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27781

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27932


File: python.info,  Node: telnetlib,  Next: time<6>,  Prev: sys<10>,  Up: 改良されたモジュール<8>

1.9.5.46 telnetlib
..................

‘telnetlib.Telnet’ is now a context manager (contributed by Stéphane
Wirtel in bpo-25485(1)).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25485


File: python.info,  Node: time<6>,  Next: timeit,  Prev: telnetlib,  Up: 改良されたモジュール<8>

1.9.5.47 time
.............

The *note struct_time: ee6. attributes ‘tm_gmtoff’ and ‘tm_zone’ are now
available on all platforms.


File: python.info,  Node: timeit,  Next: tkinter<7>,  Prev: time<6>,  Up: 改良されたモジュール<8>

1.9.5.48 timeit
...............

The new *note Timer.autorange(): ee8. convenience method has been added
to call *note Timer.timeit(): ee9. repeatedly so that the total run time
is greater or equal to 200 milliseconds.  (Contributed by Steven
D'Aprano in bpo-6422(1).)

*note timeit: f5. now warns when there is substantial (4x) variance
between best and worst times.  (Contributed by Serhiy Storchaka in
bpo-23552(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=6422

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23552


File: python.info,  Node: tkinter<7>,  Next: traceback<4>,  Prev: timeit,  Up: 改良されたモジュール<8>

1.9.5.49 tkinter
................

Added methods ‘Variable.trace_add()’, ‘Variable.trace_remove()’ and
‘trace_info()’ in the ‘tkinter.Variable’ class.  They replace old
methods ‘trace_variable()’, ‘trace()’, ‘trace_vdelete()’ and
‘trace_vinfo()’ that use obsolete Tcl commands and might not work in
future versions of Tcl.  (Contributed by Serhiy Storchaka in
bpo-22115(1)).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22115


File: python.info,  Node: traceback<4>,  Next: tracemalloc<3>,  Prev: tkinter<7>,  Up: 改良されたモジュール<8>

1.9.5.50 traceback
..................

Both the traceback module and the interpreter's builtin exception
display now abbreviate long sequences of repeated lines in tracebacks as
shown in the following example:

     >>> def f(): f()
     ...
     >>> f()
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
       File "<stdin>", line 1, in f
       File "<stdin>", line 1, in f
       File "<stdin>", line 1, in f
       [Previous line repeated 995 more times]
     RecursionError: maximum recursion depth exceeded

(Contributed by Emanuel Barry in bpo-26823(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26823


File: python.info,  Node: tracemalloc<3>,  Next: typing<10>,  Prev: traceback<4>,  Up: 改良されたモジュール<8>

1.9.5.51 tracemalloc
....................

The *note tracemalloc: 105. module now supports tracing memory
allocations in multiple different address spaces.

The new *note DomainFilter: eed. filter class has been added to filter
block traces by their address space (domain).

(Contributed by Victor Stinner in bpo-26588(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26588


File: python.info,  Node: typing<10>,  Next: unicodedata<8>,  Prev: tracemalloc<3>,  Up: 改良されたモジュール<8>

1.9.5.52 typing
...............

Since the *note typing: 10a. module is *note provisional: 3d1, all
changes introduced in Python 3.6 have also been backported to Python
3.5.x.

The *note typing: 10a. module has a much improved support for generic
type aliases.  For example ‘Dict[str, Tuple[S, T]]’ is now a valid type
annotation.  (Contributed by Guido van Rossum in Github #195(1).)

The *note typing.ContextManager: e8b. class has been added for
representing *note contextlib.AbstractContextManager: e8a.  (Contributed
by Brett Cannon in bpo-25609(2).)

The *note typing.Collection: eef. class has been added for representing
*note collections.abc.Collection: e84.  (Contributed by Ivan Levkivskyi
in bpo-27598(3).)

The *note typing.ClassVar: 56d. type construct has been added to mark
class variables.  As introduced in PEP 526(4), a variable annotation
wrapped in ClassVar indicates that a given attribute is intended to be
used as a class variable and should not be set on instances of that
class.  (Contributed by Ivan Levkivskyi in Github #280(5).)

A new *note TYPE_CHECKING: ef0. constant that is assumed to be ‘True’ by
the static type checkers, but is ‘False’ at runtime.  (Contributed by
Guido van Rossum in Github #230(6).)

A new *note NewType(): ef1. helper function has been added to create
lightweight distinct types for annotations:

     from typing import NewType

     UserId = NewType('UserId', int)
     some_id = UserId(524313)

The static type checker will treat the new type as if it were a subclass
of the original type.  (Contributed by Ivan Levkivskyi in Github
#189(7).)

   ---------- Footnotes ----------

   (1) https://github.com/python/typing/pull/195

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25609

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27598

   (4) https://peps.python.org/pep-0526/

   (5) https://github.com/python/typing/pull/280

   (6) https://github.com/python/typing/issues/230

   (7) https://github.com/python/typing/issues/189


File: python.info,  Node: unicodedata<8>,  Next: unittest mock<2>,  Prev: typing<10>,  Up: 改良されたモジュール<8>

1.9.5.53 unicodedata
....................

The *note unicodedata: 10b. module now uses data from Unicode 9.0.0(1).
(Contributed by Benjamin Peterson.)

   ---------- Footnotes ----------

   (1) https://unicode.org/versions/Unicode9.0.0/


File: python.info,  Node: unittest mock<2>,  Next: urllib request,  Prev: unicodedata<8>,  Up: 改良されたモジュール<8>

1.9.5.54 unittest.mock
......................

*note Mock: c3f. クラスは、次の改善が行われました。

   * *note Mock.assert_called(): ef4. と *note
     Mock.assert_called_once(): ef5. は、mockオブジェクトが呼ばれたかど
     うかを確認します。 (Contributed by Amit Saha in bpo-26323(1).)

   * The *note Mock.reset_mock(): ef6. method now has two optional
     keyword only arguments: 'return_value' and 'side_effect'.
     (Contributed by Kushal Das in bpo-21271(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26323

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21271


File: python.info,  Node: urllib request,  Next: urllib robotparser,  Prev: unittest mock<2>,  Up: 改良されたモジュール<8>

1.9.5.55 urllib.request
.......................

If a HTTP request has a file or iterable body (other than a bytes
object) but no ‘Content-Length’ header, rather than throwing an error,
*note AbstractHTTPHandler: ef8. now falls back to use chunked transfer
encoding.  (Contributed by Demian Brecht and Rolf Krahl in
bpo-12319(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12319


File: python.info,  Node: urllib robotparser,  Next: venv<5>,  Prev: urllib request,  Up: 改良されたモジュール<8>

1.9.5.56 urllib.robotparser
...........................

*note RobotFileParser: efa. now supports the ‘Crawl-delay’ and
‘Request-rate’ extensions.  (Contributed by Nikolay Bogoychev in
bpo-16099(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16099


File: python.info,  Node: venv<5>,  Next: warnings<4>,  Prev: urllib robotparser,  Up: 改良されたモジュール<8>

1.9.5.57 venv
.............

‘venv は、新しいパラメータ `’-prompt'' を受け入れました。このパラメータ
は、 仮想環境を表すプリフィックスを指定します。 (Proposed by Łukasz
Balcerzak and ported to 3.6 by Stéphane Wirtel in bpo-22829(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22829


File: python.info,  Node: warnings<4>,  Next: winreg,  Prev: venv<5>,  Up: 改良されたモジュール<8>

1.9.5.58 warnings
.................

A new optional 'source' parameter has been added to the *note
warnings.warn_explicit(): efd. function: the destroyed object which
emitted a *note ResourceWarning: 54c.  A 'source' attribute has also
been added to ‘warnings.WarningMessage’ (contributed by Victor Stinner
in bpo-26568(1) and bpo-26567(2)).

When a *note ResourceWarning: 54c. warning is logged, the *note
tracemalloc: 105. module is now used to try to retrieve the traceback
where the destroyed object was allocated.

スクリプト ‘example.py’ での例:

     import warnings

     def func():
         return open(__file__)

     f = func()
     f = None

Output of the command ‘python3.6 -Wd -X tracemalloc=5 example.py’:

     example.py:7: ResourceWarning: unclosed file <_io.TextIOWrapper name='example.py' mode='r' encoding='UTF-8'>
       f = None
     Object allocated at (most recent call first):
       File "example.py", lineno 4
         return open(__file__)
       File "example.py", lineno 6
         f = func()

The "Object allocated at" traceback is new and is only displayed if
*note tracemalloc: 105. is tracing Python memory allocations and if the
*note warnings: 118. module was already imported.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26568

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26567


File: python.info,  Node: winreg,  Next: winsound,  Prev: warnings<4>,  Up: 改良されたモジュール<8>

1.9.5.59 winreg
...............

Added the 64-bit integer type *note REG_QWORD: eff.  (Contributed by
Clement Rouault in bpo-23026(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23026


File: python.info,  Node: winsound,  Next: xmlrpc client,  Prev: winreg,  Up: 改良されたモジュール<8>

1.9.5.60 winsound
.................

Allowed keyword arguments to be passed to *note Beep: f01, *note
MessageBeep: f02, and *note PlaySound: f03. (bpo-27982(1)).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27982


File: python.info,  Node: xmlrpc client,  Next: zipfile<4>,  Prev: winsound,  Up: 改良されたモジュール<8>

1.9.5.61 xmlrpc.client
......................

The *note xmlrpc.client: 134. module now supports unmarshalling
additional data types used by the Apache XML-RPC implementation for
numerics and ‘None’.  (Contributed by Serhiy Storchaka in bpo-26885(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26885


File: python.info,  Node: zipfile<4>,  Next: zlib<2>,  Prev: xmlrpc client,  Up: 改良されたモジュール<8>

1.9.5.62 zipfile
................

A new *note ZipInfo.from_file(): f06. class method allows making a *note
ZipInfo: 2cb. instance from a filesystem file.  A new *note
ZipInfo.is_dir(): f07. method can be used to check if the *note ZipInfo:
2cb. instance represents a directory.  (Contributed by Thomas Kluyver in
bpo-26039(1).)

The *note ZipFile.open(): 65d. method can now be used to write data into
a ZIP file, as well as for extracting data.  (Contributed by Thomas
Kluyver in bpo-26039(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26039

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26039


File: python.info,  Node: zlib<2>,  Prev: zipfile<4>,  Up: 改良されたモジュール<8>

1.9.5.63 zlib
.............

The *note compress(): 84f. and *note decompress(): f09. functions now
accept keyword arguments.  (Contributed by Aviv Palivoda in bpo-26243(1)
and Xiang Zhang in bpo-16764(2) respectively.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26243

   (2) https://bugs.python.org/issue?@action=redirect&bpo=16764


File: python.info,  Node: 最適化<9>,  Next: ビルドならびに C API の変更<2>,  Prev: 改良されたモジュール<8>,  Up: What's New In Python 3 6

1.9.6 最適化
------------

   * The Python interpreter now uses a 16-bit wordcode instead of
     bytecode which made a number of opcode optimizations possible.
     (Contributed by Demur Rumed with input and reviews from Serhiy
     Storchaka and Victor Stinner in bpo-26647(1) and bpo-28050(2).)

   * The *note asyncio.Future: dc6. class now has an optimized C
     implementation.  (Contributed by Yury Selivanov and INADA Naoki in
     bpo-26081(3).)

   * The *note asyncio.Task: 1c7. class now has an optimized C
     implementation.  (Contributed by Yury Selivanov in bpo-28544(4).)

   * Various implementation improvements in the *note typing: 10a.
     module (such as caching of generic types) allow up to 30 times
     performance improvements and reduced memory footprint.

   * The ASCII decoder is now up to 60 times as fast for error handlers
     ‘surrogateescape’, ‘ignore’ and ‘replace’ (Contributed by Victor
     Stinner in bpo-24870(5)).

   * The ASCII and the Latin1 encoders are now up to 3 times as fast for
     the error handler ‘surrogateescape’ (Contributed by Victor Stinner
     in bpo-25227(6)).

   * The UTF-8 encoder is now up to 75 times as fast for error handlers
     ‘ignore’, ‘replace’, ‘surrogateescape’, ‘surrogatepass’
     (Contributed by Victor Stinner in bpo-25267(7)).

   * The UTF-8 decoder is now up to 15 times as fast for error handlers
     ‘ignore’, ‘replace’ and ‘surrogateescape’ (Contributed by Victor
     Stinner in bpo-25301(8)).

   * ‘bytes % args’ is now up to 2 times faster.  (Contributed by Victor
     Stinner in bpo-25349(9)).

   * ‘bytearray % args’ is now between 2.5 and 5 times faster.
     (Contributed by Victor Stinner in bpo-25399(10)).

   * Optimize *note bytes.fromhex(): 190. and *note bytearray.fromhex():
     191.: they are now between 2x and 3.5x faster.  (Contributed by
     Victor Stinner in bpo-25401(11)).

   * Optimize ‘bytes.replace(b'', b'.')’ and ‘bytearray.replace(b'',
     b'.')’: up to 80% faster.  (Contributed by Josh Snider in
     bpo-26574(12)).

   * Allocator functions of the *note PyMem_Malloc(): e5f. domain (*note
     PYMEM_DOMAIN_MEM: e63.) now use the *note pymalloc memory
     allocator: f0b. instead of ‘malloc()’ function of the C library.
     The pymalloc allocator is optimized for objects smaller or equal to
     512 bytes with a short lifetime, and use ‘malloc()’ for larger
     memory blocks.  (Contributed by Victor Stinner in bpo-26249(13)).

   * *note pickle.load(): f0c. and *note pickle.loads(): f0d. are now up
     to 10% faster when deserializing many small objects (Contributed by
     Victor Stinner in bpo-27056(14)).

   * Passing *note keyword arguments: f0e. to a function has an overhead
     in comparison with passing *note positional arguments: f0f.  Now in
     extension functions implemented with using Argument Clinic this
     overhead is significantly decreased.  (Contributed by Serhiy
     Storchaka in bpo-27574(15)).

   * Optimized *note glob(): 5a0. and *note iglob(): a08. functions in
     the *note glob: 68. module; they are now about 3-6 times faster.
     (Contributed by Serhiy Storchaka in bpo-25596(16)).

   * Optimized globbing in *note pathlib: a8. by using *note
     os.scandir(): c54.; it is now about 1.5-4 times faster.
     (Contributed by Serhiy Storchaka in bpo-26032(17)).

   * *note xml.etree.ElementTree: 12b. parsing, iteration and deepcopy
     performance has been significantly improved.  (Contributed by
     Serhiy Storchaka in bpo-25638(18), bpo-25873(19), and
     bpo-25869(20).)

   * Creation of *note fractions.Fraction: 213. instances from floats
     and decimals is now 2 to 3 times faster.  (Contributed by Serhiy
     Storchaka in bpo-25971(21).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26647

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28050

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26081

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28544

   (5) https://bugs.python.org/issue?@action=redirect&bpo=24870

   (6) https://bugs.python.org/issue?@action=redirect&bpo=25227

   (7) https://bugs.python.org/issue?@action=redirect&bpo=25267

   (8) https://bugs.python.org/issue?@action=redirect&bpo=25301

   (9) https://bugs.python.org/issue?@action=redirect&bpo=25349

   (10) https://bugs.python.org/issue?@action=redirect&bpo=25399

   (11) https://bugs.python.org/issue?@action=redirect&bpo=25401

   (12) https://bugs.python.org/issue?@action=redirect&bpo=26574

   (13) https://bugs.python.org/issue?@action=redirect&bpo=26249

   (14) https://bugs.python.org/issue?@action=redirect&bpo=27056

   (15) https://bugs.python.org/issue?@action=redirect&bpo=27574

   (16) https://bugs.python.org/issue?@action=redirect&bpo=25596

   (17) https://bugs.python.org/issue?@action=redirect&bpo=26032

   (18) https://bugs.python.org/issue?@action=redirect&bpo=25638

   (19) https://bugs.python.org/issue?@action=redirect&bpo=25873

   (20) https://bugs.python.org/issue?@action=redirect&bpo=25869

   (21) https://bugs.python.org/issue?@action=redirect&bpo=25971


File: python.info,  Node: ビルドならびに C API の変更<2>,  Next: その他の改善,  Prev: 最適化<9>,  Up: What's New In Python 3 6

1.9.7 ビルドならびに C API の変更
---------------------------------

   * Python now requires some C99 support in the toolchain to build.
     Most notably, Python now uses standard integer types and macros in
     place of custom macros like ‘PY_LONG_LONG’.  For more information,
     see PEP 7(1) and bpo-17884(2).

   * Cross-compiling CPython with the Android NDK and the Android API
     level set to 21 (Android 5.0 Lollipop) or greater runs
     successfully.  While Android is not yet a supported platform, the
     Python test suite runs on the Android emulator with only about 16
     tests failures.  See the Android meta-issue bpo-26865(3).

   * The ‘--enable-optimizations’ configure flag has been added.
     Turning it on will activate expensive optimizations like PGO.
     (Original patch by Alecsandru Patrascu of Intel in bpo-26359(4).)

   * The *note GIL: 474. must now be held when allocator functions of
     *note PYMEM_DOMAIN_OBJ: e61. (ex: *note PyObject_Malloc(): e62.)
     and *note PYMEM_DOMAIN_MEM: e63. (ex: *note PyMem_Malloc(): e5f.)
     domains are called.

   * New *note Py_FinalizeEx(): f11. API which indicates if flushing
     buffered data failed.  (Contributed by Martin Panter in
     bpo-5319(5).)

   * *note PyArg_ParseTupleAndKeywords(): 624. now supports *note
     positional-only parameters: c78.  Positional-only parameters are
     defined by empty names.  (Contributed by Serhiy Storchaka in
     bpo-26282(6)).

   * ‘PyTraceback_Print’ method now abbreviates long sequences of
     repeated lines as ‘"[Previous line repeated {count} more times]"’.
     (Contributed by Emanuel Barry in bpo-26823(7).)

   * The new *note PyErr_SetImportErrorSubclass(): f12. function allows
     for specifying a subclass of *note ImportError: 65b. to raise.
     (Contributed by Eric Snow in bpo-15767(8).)

   * The new *note PyErr_ResourceWarning(): f13. function can be used to
     generate a *note ResourceWarning: 54c. providing the source of the
     resource allocation.  (Contributed by Victor Stinner in
     bpo-26567(9).)

   * The new *note PyOS_FSPath(): f14. function returns the file system
     representation of a *note path-like object: 5a1.  (Contributed by
     Brett Cannon in bpo-27186(10).)

   * The *note PyUnicode_FSConverter(): f15. and *note
     PyUnicode_FSDecoder(): 797. functions will now accept *note
     path-like objects: 5a1.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0007/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17884

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26865

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26359

   (5) https://bugs.python.org/issue?@action=redirect&bpo=5319

   (6) https://bugs.python.org/issue?@action=redirect&bpo=26282

   (7) https://bugs.python.org/issue?@action=redirect&bpo=26823

   (8) https://bugs.python.org/issue?@action=redirect&bpo=15767

   (9) https://bugs.python.org/issue?@action=redirect&bpo=26567

   (10) https://bugs.python.org/issue?@action=redirect&bpo=27186


File: python.info,  Node: その他の改善,  Next: 非推奨<10>,  Prev: ビルドならびに C API の変更<2>,  Up: What's New In Python 3 6

1.9.8 その他の改善
------------------

   * *note -version: f17. (短縮系: *note -V: 49b.) が2回与えられた場合、
     Python は *note sys.version: 49c. で詳細な情報を出力します。

          $ ./python -VV
          Python 3.6.0b4+ (3.6:223967b49e49+, Nov 21 2016, 20:55:04)
          [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]


File: python.info,  Node: 非推奨<10>,  Next: 削除<10>,  Prev: その他の改善,  Up: What's New In Python 3 6

1.9.9 非推奨
------------

* Menu:

* 新たなキーワード::
* 非推奨の Python 挙動::
* 非推奨の Python モジュール、関数、メソッド: 非推奨の Python モジュール、関数、メソッド<2>.
* xml: xml<6>.
* C API の非推奨の関数ならびに型: C API の非推奨の関数ならびに型<2>.
* 非推奨のビルドオプション::


File: python.info,  Node: 新たなキーワード,  Next: 非推奨の Python 挙動,  Up: 非推奨<10>

1.9.9.1 新たなキーワード
........................

‘async’ および ‘await’ を変数、クラス、関数、モジュール名として使用する
ことは推奨されません。‘async’ と ‘await’ は Python 3.5 で PEP 492(1) に
より導入され、Python 3.7 で正式にキーワードとなります。Python 3.6 から
‘async’ や ‘await’ を変数名に使用すると *note DeprecationWarning: 1a3. が
出ます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0492/


File: python.info,  Node: 非推奨の Python 挙動,  Next: 非推奨の Python モジュール、関数、メソッド<2>,  Prev: 新たなキーワード,  Up: 非推奨<10>

1.9.9.2 非推奨の Python 挙動
............................

Raising the *note StopIteration: df5. exception inside a generator will
now generate a *note DeprecationWarning: 1a3, and will trigger a *note
RuntimeError: 244. in Python 3.7.  See *note PEP 479; ジェネレータ内の
StopIteration の処理の変更: f1b. for details.

The *note __aiter__(): df6. method is now expected to return an
asynchronous iterator directly instead of returning an awaitable as
previously.  Doing the former will trigger a *note DeprecationWarning:
1a3.  Backward compatibility will be removed in Python 3.7.
(Contributed by Yury Selivanov in bpo-27243(1).)

A backslash-character pair that is not a valid escape sequence now
generates a *note DeprecationWarning: 1a3.  Although this will
eventually become a *note SyntaxError: 18e, that will not be for several
Python releases.  (Contributed by Emanuel Barry in bpo-27364(2).)

When performing a relative import, falling back on ‘__name__’ and
‘__path__’ from the calling module when ‘__spec__’ or ‘__package__’ are
not defined now raises an *note ImportWarning: 71e.  (Contributed by
Rose Ames in bpo-25791(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27243

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27364

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25791


File: python.info,  Node: 非推奨の Python モジュール、関数、メソッド<2>,  Next: xml<6>,  Prev: 非推奨の Python 挙動,  Up: 非推奨<10>

1.9.9.3 非推奨の Python モジュール、関数、メソッド
..................................................

* Menu:

* asynchat::
* asyncore::
* dbm: dbm<4>.
* distutils: distutils<6>.
* grp::
* importlib: importlib<7>.
* os: os<10>.
* re: re<7>.
* ssl: ssl<9>.
* tkinter: tkinter<8>.
* venv: venv<6>.


File: python.info,  Node: asynchat,  Next: asyncore,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.9.9.4 asynchat
................

The ‘asynchat’ has been deprecated in favor of *note asyncio: b.
(Contributed by Mariatta in bpo-25002(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25002


File: python.info,  Node: asyncore,  Next: dbm<4>,  Prev: asynchat,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.9.9.5 asyncore
................

The ‘asyncore’ has been deprecated in favor of *note asyncio: b.
(Contributed by Mariatta in bpo-25002(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25002


File: python.info,  Node: dbm<4>,  Next: distutils<6>,  Prev: asyncore,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.9.9.6 dbm
...........

Unlike other *note dbm: 35. implementations, the *note dbm.dumb: 36.
module creates databases with the ‘'rw'’ mode and allows modifying the
database opened with the ‘'r'’ mode.  This behavior is now deprecated
and will be removed in 3.8.  (Contributed by Serhiy Storchaka in
bpo-21708(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21708


File: python.info,  Node: distutils<6>,  Next: grp,  Prev: dbm<4>,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.9.9.7 distutils
.................

The undocumented ‘extra_path’ argument to the ‘distutils.Distribution’
constructor is now considered deprecated and will raise a warning if
set.  Support for this parameter will be removed in a future Python
release.  See bpo-27919(1) for details.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27919


File: python.info,  Node: grp,  Next: importlib<7>,  Prev: distutils<6>,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.9.9.8 grp
...........

*note getgrgid(): f22. の非整数の引数のサポートは非推奨になりました。
(Contributed by Serhiy Storchaka in bpo-26129(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26129


File: python.info,  Node: importlib<7>,  Next: os<10>,  Prev: grp,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.9.9.9 importlib
.................

The *note importlib.machinery.SourceFileLoader.load_module(): f24. and
*note importlib.machinery.SourcelessFileLoader.load_module(): f25.
methods are now deprecated.  They were the only remaining
implementations of *note importlib.abc.Loader.load_module(): a69. in
*note importlib: 7b. that had not been deprecated in previous versions
of Python in favour of *note importlib.abc.Loader.exec_module(): a6a.

The *note importlib.machinery.WindowsRegistryFinder: f26. class is now
deprecated.  As of 3.6.0, it is still added to *note sys.meta_path: f27.
by default (on Windows), but this may change in future releases.


File: python.info,  Node: os<10>,  Next: re<7>,  Prev: importlib<7>,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.9.9.10 os
...........

Undocumented support of general *note bytes-like objects: 193. as paths
in *note os: a5. functions, *note compile(): 4b1. and similar functions
is now deprecated.  (Contributed by Serhiy Storchaka in bpo-25791(1) and
bpo-26754(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25791

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26754


File: python.info,  Node: re<7>,  Next: ssl<9>,  Prev: os<10>,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.9.9.11 re
...........

Support for inline flags ‘(?letters)’ in the middle of the regular
expression has been deprecated and will be removed in a future Python
version.  Flags at the start of a regular expression are still allowed.
(Contributed by Serhiy Storchaka in bpo-22493(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22493


File: python.info,  Node: ssl<9>,  Next: tkinter<8>,  Prev: re<7>,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.9.9.12 ssl
............

OpenSSLの0.9.8, 1.0.0 ,1.0.1 は非推奨となっており、長い間サポートされて
いません。将来的に *note ssl: d5. モジュールは、OpenSSLの1.0.2 もしくは
1.1.0が必須になります。

SSL-related arguments like ‘certfile’, ‘keyfile’ and ‘check_hostname’ in
*note ftplib: 62, *note http.client: 73, *note imaplib: 78, *note
poplib: b1, and *note smtplib: cf. have been deprecated in favor of
‘context’.  (Contributed by Christian Heimes in bpo-28022(1).)

A couple of protocols and functions of the *note ssl: d5. module are now
deprecated.  Some features will no longer be available in future
versions of OpenSSL. Other features are deprecated in favor of a
different API. (Contributed by Christian Heimes in bpo-28022(2) and
bpo-26470(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28022

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28022

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26470


File: python.info,  Node: tkinter<8>,  Next: venv<6>,  Prev: ssl<9>,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.9.9.13 tkinter
................

The ‘tkinter.tix’ module is now deprecated.  *note tkinter: f6. users
should use *note tkinter.ttk: ff. instead.


File: python.info,  Node: venv<6>,  Prev: tkinter<8>,  Up: 非推奨の Python モジュール、関数、メソッド<2>

1.9.9.14 venv
.............

The ‘pyvenv’ script has been deprecated in favour of ‘python3 -m venv’.
This prevents confusion as to what Python interpreter ‘pyvenv’ is
connected to and thus what Python interpreter will be used by the
virtual environment.  (Contributed by Brett Cannon in bpo-25154(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25154


File: python.info,  Node: xml<6>,  Next: C API の非推奨の関数ならびに型<2>,  Prev: 非推奨の Python モジュール、関数、メソッド<2>,  Up: 非推奨<10>

1.9.9.15 xml
............

   * As mitigation against DTD and external entity retrieval, the *note
     xml.dom.minidom: 128. and *note xml.sax: 12f. modules no longer
     process external entities by default.  (Contributed by Christian
     Heimes in gh-61441(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/61441


File: python.info,  Node: C API の非推奨の関数ならびに型<2>,  Next: 非推奨のビルドオプション,  Prev: xml<6>,  Up: 非推奨<10>

1.9.9.16 C API の非推奨の関数ならびに型
.......................................

Undocumented functions ‘PyUnicode_AsEncodedObject()’,
‘PyUnicode_AsDecodedObject()’, ‘PyUnicode_AsEncodedUnicode()’ and
‘PyUnicode_AsDecodedUnicode()’ are deprecated now.  Use the *note
generic codec based API: f30. instead.


File: python.info,  Node: 非推奨のビルドオプション,  Prev: C API の非推奨の関数ならびに型<2>,  Up: 非推奨<10>

1.9.9.17 非推奨のビルドオプション
.................................

The ‘--with-system-ffi’ configure flag is now on by default on non-macOS
UNIX platforms.  It may be disabled by using ‘--without-system-ffi’, but
using the flag is deprecated and will not be accepted in Python 3.7.
macOS is unaffected by this change.  Note that many OS distributors
already use the ‘--with-system-ffi’ flag when building their system
Python.


File: python.info,  Node: 削除<10>,  Next: Python 3 6 への移植,  Prev: 非推奨<10>,  Up: What's New In Python 3 6

1.9.10 削除
-----------

* Menu:

* API と機能の削除: API と機能の削除<3>.


File: python.info,  Node: API と機能の削除<3>,  Up: 削除<10>

1.9.10.1 API と機能の削除
.........................

   * Unknown escapes consisting of ‘'\'’ and an ASCII letter in regular
     expressions will now cause an error.  In replacement templates for
     *note re.sub(): 5a3. they are still allowed, but deprecated.  The
     *note re.LOCALE: d63. flag can now only be used with binary
     patterns.

   * ‘inspect.getmoduleinfo()’ was removed (was deprecated since CPython
     3.3).  *note inspect.getmodulename(): f34. should be used for
     obtaining the module name for a given path.  (Contributed by Yury
     Selivanov in bpo-13248(1).)

   * ‘traceback.Ignore’ class and ‘traceback.usage’,
     ‘traceback.modname’, ‘traceback.fullmodname’,
     ‘traceback.find_lines_from_code’, ‘traceback.find_lines’,
     ‘traceback.find_strings’, ‘traceback.find_executable_lines’ methods
     were removed from the *note traceback: 104. module.  They were
     undocumented methods deprecated since Python 3.2 and equivalent
     functionality is available from private methods.

   * The ‘tk_menuBar()’ and ‘tk_bindForTraversal()’ dummy methods in
     *note tkinter: f6. widget classes were removed (corresponding Tk
     commands were obsolete since Tk 4.0).

   * The *note open(): 65d. method of the *note zipfile.ZipFile: 8d3.
     class no longer supports the ‘'U'’ mode (was deprecated since
     Python 3.4).  Use *note io.TextIOWrapper: 9be. for reading
     compressed text files in *note universal newlines: f35. mode.

   * The undocumented ‘IN’, ‘CDROM’, ‘DLFCN’, ‘TYPES’, ‘CDIO’, and
     ‘STROPTS’ modules have been removed.  They had been available in
     the platform specific ‘Lib/plat-*/’ directories, but were
     chronically out of date, inconsistently available across platforms,
     and unmaintained.  The script that created these modules is still
     available in the source distribution at Tools/scripts/h2py.py(2).

   * 非推奨の ‘asynchat.fifo’ クラスは削除されました。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13248

   (2) 
https://github.com/python/cpython/blob/v3.6.15/Tools/scripts/h2py.py


File: python.info,  Node: Python 3 6 への移植,  Next: Notable changes in Python 3 6 2,  Prev: 削除<10>,  Up: What's New In Python 3 6

1.9.11 Python 3.6 への移植
--------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

* Menu:

* 'python' コマンドの挙動の変更::
* Python API の変更: Python API の変更<9>.
* C API の変更: C API の変更<13>.
* CPython バイトコードの変更: CPython バイトコードの変更<8>.


File: python.info,  Node: 'python' コマンドの挙動の変更,  Next: Python API の変更<9>,  Up: Python 3 6 への移植

1.9.11.1 'python' コマンドの挙動の変更
......................................

   * The output of a special Python build with defined ‘COUNT_ALLOCS’,
     ‘SHOW_ALLOC_COUNT’ or ‘SHOW_TRACK_COUNT’ macros is now off by
     default.  It can be re-enabled using the ‘-X showalloccount’
     option.  It now outputs to ‘stderr’ instead of ‘stdout’.
     (Contributed by Serhiy Storchaka in bpo-23034(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23034


File: python.info,  Node: Python API の変更<9>,  Next: C API の変更<13>,  Prev: 'python' コマンドの挙動の変更,  Up: Python 3 6 への移植

1.9.11.2 Python API の変更
..........................

   * *note open(): 316. will no longer allow combining the ‘'U'’ mode
     flag with ‘'+'’.  (Contributed by Jeff Balogh and John O'Connor in
     bpo-2091(1).)

   * *note sqlite3: d4. no longer implicitly commits an open transaction
     before DDL statements.

   * On Linux, *note os.urandom(): 746. now blocks until the system
     urandom entropy pool is initialized to increase the security.

   * When *note importlib.abc.Loader.exec_module(): a6a. is defined,
     *note importlib.abc.Loader.create_module(): eac. must also be
     defined.

   * *note PyErr_SetImportError(): f39. now sets *note TypeError: 198.
     when its 'msg' argument is not set.  Previously only ‘NULL’ was
     returned.

   * The format of the *note co_lnotab: 330. attribute of code objects
     changed to support a negative line number delta.  By default,
     Python does not emit bytecode with a negative line number delta.
     Functions using *note frame.f_lineno: 9af,
     ‘PyFrame_GetLineNumber()’ or ‘PyCode_Addr2Line()’ are not affected.
     Functions directly decoding ‘co_lnotab’ should be updated to use a
     signed 8-bit integer type for the line number delta, but this is
     only required to support applications using a negative line number
     delta.  See ‘Objects/lnotab_notes.txt’ for the ‘co_lnotab’ format
     and how to decode it, and see the PEP 511(2) for the rationale.

   * The functions in the *note compileall: 21. module now return
     booleans instead of ‘1’ or ‘0’ to represent success or failure,
     respectively.  Thanks to booleans being a subclass of integers,
     this should only be an issue if you were doing identity checks for
     ‘1’ or ‘0’.  See bpo-25768(3).

   * Reading the ‘port’ attribute of *note urllib.parse.urlsplit(): f3a.
     and *note urlparse(): 362. results now raises *note ValueError:
     2ec. for out-of-range values, rather than returning *note None:
     885.  See bpo-20059(4).

   * The ‘imp’ module now raises a *note DeprecationWarning: 1a3.
     instead of *note PendingDeprecationWarning: ac5.

   * The following modules have had missing APIs added to their *note
     __all__: f3b. attributes to match the documented APIs: *note
     calendar: 15, ‘cgi’, *note csv: 2d, *note ElementTree: 12b, *note
     enum: 5a, *note fileinput: 5f, *note ftplib: 62, *note logging: 8b,
     *note mailbox: 8f, *note mimetypes: 93, *note optparse: a4, *note
     plistlib: b0, ‘smtpd’, *note subprocess: dc, *note tarfile: e4,
     *note threading: f3. and *note wave: 119.  This means they will
     export new symbols when ‘import *’ is used.  (Contributed by Joel
     Taddei and Jacek Kołodziej in bpo-23883(5).)

   * When performing a relative import, if ‘__package__’ does not
     compare equal to ‘__spec__.parent’ then *note ImportWarning: 71e.
     is raised.  (Contributed by Brett Cannon in bpo-25791(6).)

   * When a relative import is performed and no parent package is known,
     then *note ImportError: 65b. will be raised.  Previously, *note
     SystemError: 795. could be raised.  (Contributed by Brett Cannon in
     bpo-18018(7).)

   * Servers based on the *note socketserver: d2. module, including
     those defined in *note http.server: 76, *note xmlrpc.server: 135.
     and *note wsgiref.simple_server: 121, now only catch exceptions
     derived from *note Exception: bcd.  Therefore if a request handler
     raises an exception like *note SystemExit: f3c. or *note
     KeyboardInterrupt: bc5, *note handle_error(): f3d. is no longer
     called, and the exception will stop a single-threaded server.
     (Contributed by Martin Panter in bpo-23430(8).)

   * ‘spwd.getspnam()’ now raises a *note PermissionError: f3e. instead
     of *note KeyError: 5e7. if the user doesn't have privileges.

   * The *note socket.socket.close(): f3f. method now raises an
     exception if an error (e.g.  ‘EBADF’) was reported by the
     underlying system call.  (Contributed by Martin Panter in
     bpo-26685(9).)

   * The 'decode_data' argument for the ‘smtpd.SMTPChannel’ and
     ‘smtpd.SMTPServer’ constructors is now ‘False’ by default.  This
     means that the argument passed to ‘process_message()’ is now a
     bytes object by default, and ‘process_message()’ will be passed
     keyword arguments.  Code that has already been updated in
     accordance with the deprecation warning generated by 3.5 will not
     be affected.

   * All optional arguments of the *note dump(): f40, *note dumps():
     f41, *note load(): eb2. and *note loads(): b4e. functions and *note
     JSONEncoder: f42. and *note JSONDecoder: f43. class constructors in
     the *note json: 86. module are now *note keyword-only: 5a5.
     (Contributed by Serhiy Storchaka in bpo-18726(10).)

   * ‘type.__new__’ をオーバーライドしていない *note type: f44. のサブク
     ラスは、オブジェクトの型を得るのに１引数形式を利用することができま
     せん。

   * As part of PEP 487(11), the handling of keyword arguments passed to
     *note type: f44. (other than the metaclass hint, ‘metaclass’) is
     now consistently delegated to *note object.__init_subclass__():
     843.  This means that *note type.__new__: 7a0. and *note
     type.__init__: 8bf. both now accept arbitrary keyword arguments,
     but *note object.__init_subclass__(): 843. (which is called from
     *note type.__new__: 7a0.) will reject them by default.  Custom
     metaclasses accepting additional keyword arguments will need to
     adjust their calls to *note type.__new__: 7a0. (whether direct or
     via *note super: 1a6.) accordingly.

   * In ‘distutils.command.sdist.sdist’, the ‘default_format’ attribute
     has been removed and is no longer honored.  Instead, the gzipped
     tarfile format is the default on all platforms and no
     platform-specific selection is made.  In environments where
     distributions are built on Windows and zip distributions are
     required, configure the project with a ‘setup.cfg’ file containing
     the following:

          [sdist]
          formats=zip

     この挙動は Setuptools 26.0.0 により以前の Python バージョンにバック
     ポートされました。

   * In the *note urllib.request: 111. module and the *note
     http.client.HTTPConnection.request(): ea7. method, if no
     Content-Length header field has been specified and the request body
     is a file object, it is now sent with HTTP 1.1 chunked encoding.
     If a file object has to be sent to a HTTP 1.0 server, the
     Content-Length value now has to be specified by the caller.
     (Contributed by Demian Brecht and Rolf Krahl with tweaks from
     Martin Panter in bpo-12319(12).)

   * The *note DictReader: bd8. now returns rows of type *note
     OrderedDict: 7f3.  (Contributed by Steve Holden in bpo-27842(13).)

   * The ‘crypt.METHOD_CRYPT’ will no longer be added to ‘crypt.methods’
     if unsupported by the platform.  (Contributed by Victor Stinner in
     bpo-25287(14).)

   * The 'verbose' and 'rename' arguments for *note namedtuple(): 4e0.
     are now keyword-only.  (Contributed by Raymond Hettinger in
     bpo-25628(15).)

   * On Linux, *note ctypes.util.find_library(): f45. now looks in
     ‘LD_LIBRARY_PATH’ for shared libraries.  (Contributed by Vinay
     Sajip in bpo-9998(16).)

   * The *note imaplib.IMAP4: aff. class now handles flags containing
     the ‘']'’ character in messages sent from the server to improve
     real-world compatibility.  (Contributed by Lita Cho in
     bpo-21815(17).)

   * The *note mmap.mmap.write(): f46. function now returns the number
     of bytes written like other write methods.  (Contributed by Jakub
     Stasiak in bpo-26335(18).)

   * The *note pkgutil.iter_modules(): f47. and *note
     pkgutil.walk_packages(): df9. functions now return *note
     ModuleInfo: f48. named tuples.  (Contributed by Ramchandra Apte in
     bpo-17211(19).)

   * *note re.sub(): 5a3. now raises an error for invalid numerical
     group references in replacement templates even if the pattern is
     not found in the string.  The error message for invalid group
     references now includes the group index and the position of the
     reference.  (Contributed by SilentGhost, Serhiy Storchaka in
     bpo-25953(20).)

   * *note zipfile.ZipFile: 8d3. will now raise *note
     NotImplementedError: 36b. for unrecognized compression values.
     Previously a plain *note RuntimeError: 244. was raised.
     Additionally, calling *note ZipFile: 8d3. methods on a closed
     ZipFile or calling the *note write(): f49. method on a ZipFile
     created with mode ‘'r'’ will raise a *note ValueError: 2ec.
     Previously, a *note RuntimeError: 244. was raised in those
     scenarios.

   * when custom metaclasses are combined with zero-argument *note
     super(): 1a6. or direct references from methods to the implicit
     ‘__class__’ closure variable, the implicit ‘__classcell__’
     namespace entry must now be passed up to ‘type.__new__’ for
     initialisation.  Failing to do so will result in a *note
     DeprecationWarning: 1a3. in Python 3.6 and a *note RuntimeError:
     244. in Python 3.8.

   * With the introduction of *note ModuleNotFoundError: d3d, import
     system consumers may start expecting import system replacements to
     raise that more specific exception when appropriate, rather than
     the less-specific *note ImportError: 65b.  To provide future
     compatibility with such consumers, implementers of alternative
     import systems that completely replace *note __import__(): ad1.
     will need to update their implementations to raise the new subclass
     when a module can't be found at all.  Implementers of compliant
     plugins to the default import system shouldn't need to make any
     changes, as the default import system will raise the new subclass
     when appropriate.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=2091

   (2) https://peps.python.org/pep-0511/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25768

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20059

   (5) https://bugs.python.org/issue?@action=redirect&bpo=23883

   (6) https://bugs.python.org/issue?@action=redirect&bpo=25791

   (7) https://bugs.python.org/issue?@action=redirect&bpo=18018

   (8) https://bugs.python.org/issue?@action=redirect&bpo=23430

   (9) https://bugs.python.org/issue?@action=redirect&bpo=26685

   (10) https://bugs.python.org/issue?@action=redirect&bpo=18726

   (11) https://peps.python.org/pep-0487/

   (12) https://bugs.python.org/issue?@action=redirect&bpo=12319

   (13) https://bugs.python.org/issue?@action=redirect&bpo=27842

   (14) https://bugs.python.org/issue?@action=redirect&bpo=25287

   (15) https://bugs.python.org/issue?@action=redirect&bpo=25628

   (16) https://bugs.python.org/issue?@action=redirect&bpo=9998

   (17) https://bugs.python.org/issue?@action=redirect&bpo=21815

   (18) https://bugs.python.org/issue?@action=redirect&bpo=26335

   (19) https://bugs.python.org/issue?@action=redirect&bpo=17211

   (20) https://bugs.python.org/issue?@action=redirect&bpo=25953


File: python.info,  Node: C API の変更<13>,  Next: CPython バイトコードの変更<8>,  Prev: Python API の変更<9>,  Up: Python 3 6 への移植

1.9.11.3 C API の変更
.....................

   * The *note PyMem_Malloc(): e5f. allocator family now uses the *note
     pymalloc allocator: f0b. rather than the system ‘malloc()’.
     Applications calling *note PyMem_Malloc(): e5f. without holding the
     GIL can now crash.  Set the *note PYTHONMALLOC: e5e. environment
     variable to ‘debug’ to validate the usage of memory allocators in
     your application.  See bpo-26249(1).

   * *note Py_Exit(): f4b. (and the main interpreter) now override the
     exit status with 120 if flushing buffered data failed.  See
     bpo-5319(2).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26249

   (2) https://bugs.python.org/issue?@action=redirect&bpo=5319


File: python.info,  Node: CPython バイトコードの変更<8>,  Prev: C API の変更<13>,  Up: Python 3 6 への移植

1.9.11.4 CPython バイトコードの変更
...................................

There have been several major changes to the *note bytecode: 4aa. in
Python 3.6.

   * The Python interpreter now uses a 16-bit wordcode instead of
     bytecode.  (Contributed by Demur Rumed with input and reviews from
     Serhiy Storchaka and Victor Stinner in bpo-26647(1) and
     bpo-28050(2).)

   * The new ‘FORMAT_VALUE’ and *note BUILD_STRING: f4d. opcodes as part
     of the *note formatted string literal: e29. implementation.
     (Contributed by Eric Smith in bpo-25483(3) and Serhiy Storchaka in
     bpo-27078(4).)

   * The new ‘BUILD_CONST_KEY_MAP’ opcode to optimize the creation of
     dictionaries with constant keys.  (Contributed by Serhiy Storchaka
     in bpo-27140(5).)

   * The function call opcodes have been heavily reworked for better
     performance and simpler implementation.  The *note MAKE_FUNCTION:
     f4e, ‘CALL_FUNCTION’, ‘CALL_FUNCTION_KW’ and
     ‘BUILD_MAP_UNPACK_WITH_CALL’ opcodes have been modified, the new
     *note CALL_FUNCTION_EX: f4f. and ‘BUILD_TUPLE_UNPACK_WITH_CALL’
     have been added, and ‘CALL_FUNCTION_VAR’, ‘CALL_FUNCTION_VAR_KW’
     and ‘MAKE_CLOSURE’ opcodes have been removed.  (Contributed by
     Demur Rumed in bpo-27095(6), and Serhiy Storchaka in bpo-27213(7),
     bpo-28257(8).)

   * The new *note SETUP_ANNOTATIONS: f50. and ‘STORE_ANNOTATION’
     opcodes have been added to support the new *note variable
     annotation: f51. syntax.  (Contributed by Ivan Levkivskyi in
     bpo-27985(9).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26647

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28050

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25483

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27078

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27140

   (6) https://bugs.python.org/issue?@action=redirect&bpo=27095

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27213

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28257

   (9) https://bugs.python.org/issue?@action=redirect&bpo=27985


File: python.info,  Node: Notable changes in Python 3 6 2,  Next: Notable changes in Python 3 6 4,  Prev: Python 3 6 への移植,  Up: What's New In Python 3 6

1.9.12 Notable changes in Python 3.6.2
--------------------------------------

* Menu:

* New make regen-all build target::
* Removal of make touch build target::


File: python.info,  Node: New make regen-all build target,  Next: Removal of make touch build target,  Up: Notable changes in Python 3 6 2

1.9.12.1 New ‘make regen-all’ build target
..........................................

To simplify cross-compilation, and to ensure that CPython can reliably
be compiled without requiring an existing version of Python to already
be available, the autotools-based build system no longer attempts to
implicitly recompile generated files based on file modification times.

Instead, a new ‘make regen-all’ command has been added to force
regeneration of these files when desired (e.g.  after an initial version
of Python has already been built based on the pregenerated versions).

More selective regeneration targets are also defined - see
Makefile.pre.in(1) for details.

(Victor Stinner の貢献による bpo-23404(2))

Added in version 3.6.2.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Makefile.pre.in

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23404


File: python.info,  Node: Removal of make touch build target,  Prev: New make regen-all build target,  Up: Notable changes in Python 3 6 2

1.9.12.2 Removal of ‘make touch’ build target
.............................................

The ‘make touch’ build target previously used to request implicit
regeneration of generated files by updating their modification times has
been removed.

It has been replaced by the new ‘make regen-all’ target.

(Victor Stinner の貢献による bpo-23404(1))

バージョン 3.6.2 で変更.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23404


File: python.info,  Node: Notable changes in Python 3 6 4,  Next: Notable changes in Python 3 6 5,  Prev: Notable changes in Python 3 6 2,  Up: What's New In Python 3 6

1.9.13 Notable changes in Python 3.6.4
--------------------------------------

The ‘PyExc_RecursionErrorInst’ singleton that was part of the public API
has been removed as its members being never cleared may cause a segfault
during finalization of the interpreter.  (Contributed by Xavier de Gaye
in bpo-22898(1) and bpo-30697(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22898

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30697


File: python.info,  Node: Notable changes in Python 3 6 5,  Next: Notable changes in Python 3 6 7,  Prev: Notable changes in Python 3 6 4,  Up: What's New In Python 3 6

1.9.14 Notable changes in Python 3.6.5
--------------------------------------

The *note locale.localeconv(): df8. function now sets temporarily the
‘LC_CTYPE’ locale to the ‘LC_NUMERIC’ locale in some cases.
(Contributed by Victor Stinner in bpo-31900(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31900


File: python.info,  Node: Notable changes in Python 3 6 7,  Next: Notable changes in Python 3 6 10,  Prev: Notable changes in Python 3 6 5,  Up: What's New In Python 3 6

1.9.15 Notable changes in Python 3.6.7
--------------------------------------

*note xml.dom.minidom: 128. and *note xml.sax: 12f. modules no longer
process external entities by default.  See also gh-61441(1).

In 3.6.7 the *note tokenize: 101. module now implicitly emits a
‘NEWLINE’ token when provided with input that does not have a trailing
new line.  This behavior now matches what the C tokenizer does
internally.  (Contributed by Ammar Askar in bpo-33899(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/61441

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33899


File: python.info,  Node: Notable changes in Python 3 6 10,  Next: Notable changes in Python 3 6 13,  Prev: Notable changes in Python 3 6 7,  Up: What's New In Python 3 6

1.9.16 Notable changes in Python 3.6.10
---------------------------------------

セキュリティ上の重大な懸念により、*note
asyncio.loop.create_datagram_endpoint(): 93c. での 'reuse_address' 引数
は無効になりました。これはソケットオプション ‘SO_REUSEADDR'’ のUDP にお
ける挙動が原因です。詳しくは、‘loop.create_datagram_endpoint()’ のドキュ
メントを参照してください。(Kyle Stanley, Antoine Pitrou, Yury Selivanov
による貢献 bpo-37228(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37228


File: python.info,  Node: Notable changes in Python 3 6 13,  Next: Notable changes in Python 3 6 14,  Prev: Notable changes in Python 3 6 10,  Up: What's New In Python 3 6

1.9.17 Notable changes in Python 3.6.13
---------------------------------------

Earlier Python versions allowed using both ‘;’ and ‘&’ as query
parameter separators in *note urllib.parse.parse_qs(): 31f. and *note
urllib.parse.parse_qsl(): 31e.  Due to security concerns, and to conform
with newer W3C recommendations, this has been changed to allow only a
single separator key, with ‘&’ as the default.  This change also affects
‘cgi.parse()’ and ‘cgi.parse_multipart()’ as they use the affected
functions internally.  For more details, please see their respective
documentation.  (Contributed by Adam Goldschmidt, Senthil Kumaran and
Ken Jin in bpo-42967(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42967


File: python.info,  Node: Notable changes in Python 3 6 14,  Prev: Notable changes in Python 3 6 13,  Up: What's New In Python 3 6

1.9.18 Notable changes in Python 3.6.14
---------------------------------------

A security fix alters the *note ftplib.FTP: af6. behavior to not trust
the IPv4 address sent from the remote server when setting up a passive
data channel.  We reuse the ftp server IP address instead.  For unusual
code requiring the old behavior, set a ‘trust_server_pasv_ipv4_address’
attribute on your FTP instance to ‘True’.  (See gh-87451(1))

The presence of newline or tab characters in parts of a URL allows for
some forms of attacks.  Following the WHATWG specification that updates
RFC 3986, ASCII newline ‘\n’, ‘\r’ and tab ‘\t’ characters are stripped
from the URL by the parser *note urllib.parse(): 110. preventing such
attacks.  The removal characters are controlled by a new module level
variable ‘urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE’.  (See gh-88048(2))

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/87451

   (2) https://github.com/python/cpython/issues/88048


File: python.info,  Node: What's New In Python 3 5,  Next: What's New In Python 3 4,  Prev: What's New In Python 3 6,  Up: What's New in Python

1.10 What's New In Python 3.5
=============================


エディタ: Elvis Pranskevichus <<elvis@magic.io>>, Yury Selivanov
<<yury@magic.io>>

This article explains the new features in Python 3.5, compared to 3.4.
Python 3.5 was released on September 13, 2015.  See the changelog(1) for
a full list of changes.

参考
....

PEP 478(2) - Python 3.5 リリーススケジュール

* Menu:

* 概要: 概要 -- リリースハイライト<10>. リリースハイライト
* 新しい機能: 新しい機能<15>.
* その他の言語変更: その他の言語変更<9>.
* 新たなモジュール: 新たなモジュール<9>.
* 改良されたモジュール: 改良されたモジュール<9>.
* その他のモジュールレベルの変更::
* 最適化: 最適化<10>.
* ビルドならびに C API の変更: ビルドならびに C API の変更<3>.
* 非推奨: 非推奨<11>.
* 削除: 削除<11>.
* Python 3.5 への移植: Python 3 5 への移植.
* Notable changes in Python 3.5.4: Notable changes in Python 3 5 4.

   ---------- Footnotes ----------

   (1) https://docs.python.org/3.5/whatsnew/changelog.html

   (2) https://peps.python.org/pep-0478/


File: python.info,  Node: 概要 -- リリースハイライト<10>,  Next: 新しい機能<15>,  Up: What's New In Python 3 5

1.10.1 概要 - リリースハイライト
--------------------------------

新たな文法機能:

   * *note PEP 492: f5f.、コルーチン、async 構文と await 構文。

   * *note PEP 465: f60.、新たな行列乗算演算子 ‘a @ b’。

   * *note PEP 448: f61.、追加可能なアンパックへの一般化。

新たなライブラリモジュール:

   * *note typing: 10a.: *note PEP 484 - 型ヒント: f62.。

   * *note zipapp: 136.: *note PEP 441 Python ZIP
     アプリケーションのサポートの改善: f63.。

新たな組み込み機能:

   * ‘bytes % args’, ‘bytearray % args’: *note PEP 461: f64. - bytes と
     bytearray に ‘%’ 書式化を追加。

   * 新たな *note bytes.hex(): f65, *note bytearray.hex(): f66. *note
     memoryview.hex(): f67. メソッド。 (Contributed by Arnon Yaari in
     bpo-9951(1).)

   * *note memoryview: 165. クラスが、(複数次元の場合を含んだ) タプルの
     添字をサポートするようになりました。 (bpo-23632(2) におけるAntoine
     Pitrouによる貢献です。)

   * ジェネレータに ‘gi_yieldfrom’ 属性が新しく追加され、これは ‘yield
     from’ 式で反復処理されるオブジェクトを返します。 (Contributed by
     Benno Leslie and Yury Selivanov in bpo-24450(3).)

   * 新たな例外 *note RecursionError: f68. が最長再帰深度に到達した際に
     送出されるようになりました。 (Contributed by Georg Brandl in
     bpo-19235(4).)

CPython の実装の改善:

   * ‘LC_TYPE’ ロケールが POSIX ロケール (‘C’ ロケール) のとき、 *note
     sys.stdin: 75f. および *note sys.stdout: ccd. は ‘strict’ エラーハ
     ンドラではなく ‘surrogateescape’ を使うようになりました。
     (Contributed by Victor Stinner in bpo-19977(5).)

   * ‘.pyo’ ファイルは使われなくなり、‘.pyc’ ファイル名に最適化レベルが
     明示される、より柔軟な仕組みに置き換えられました。(*note PEP 488
     の概要: f69. を参照してください。)

   * 組み込みおよび拡張モジュールが多段階で初期化されるようになりました
     。これは Python モジュールのロード方法と同じです。 (*note PEP 489
     の概要: f6a. を参照してください。)

標準ライブラリーの顕著な改善

   * *note collections.OrderedDict: 7f3. が *note C で実装されました:
     f6b.。 これにより 4 倍から 100 倍高速になりました。

   * *note ssl: d5. モジュールに *note メモリ BIO サポート: f6c. が追加
     されました。これにより SSL プロトコルの処理と ネットワーク IO が分
     離されました。

   * 新たな関数 *note os.scandir(): c54. はディレクトリー走査の *note
     改良され非常に速い方法: f6d. を提供します。

   * *note functools.lru_cache(): be2. の大部分が *note C で再実装: f6e.
     され、性能が大幅に向上しました。

   * 新たな関数 *note subprocess.run(): d7f. は *note
     サブプロセスを実行する合理的な方法: f6f. を提供します。

   * *note traceback: 104. モジュールは性能と開発者の利便性が向上し、大
     いに *note 強化され: f70. ました。

セキュリティの改善:

   * SSLv3 が標準ライブラリ全体を通じて無効化されました。ただし *note
     ssl.SSLContext: 357. を手動でインスタンス化することによってなら今で
     も有効には出来ます。 (詳細に関しては bpo-22638(6) を参照してくださ
     い。この変更は CPython 3.4 と 2.7 にもバックポートされました。)

   * 潜在的なインジェクション攻撃からの防御のために、HTTP クッキーの解析
     がより厳密に行われるようになりました。 (Contributed by Antoine
     Pitrou in bpo-22796(7).)

Windows の改善:

   * Windows のインストーラが新しくなり古い MSI を置き換えました。さらに
     詳しい情報は *note Windows で Python を使う: c9e. をご覧ください。

   * Windows のビルドに Microsoft Visual C++ 14.0 を使うようになっていま
     す。拡張モジュールも同じものを使うべきです。

以降は、たくさんのほかの小さな改善、CPython での最適化、非推奨リスト、潜
在的な移植性問題を含む、ユーザ向けの変更の包括的なリストになっています。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9951

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23632

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24450

   (4) https://bugs.python.org/issue?@action=redirect&bpo=19235

   (5) https://bugs.python.org/issue?@action=redirect&bpo=19977

   (6) https://bugs.python.org/issue?@action=redirect&bpo=22638

   (7) https://bugs.python.org/issue?@action=redirect&bpo=22796


File: python.info,  Node: 新しい機能<15>,  Next: その他の言語変更<9>,  Prev: 概要 -- リリースハイライト<10>,  Up: What's New In Python 3 5

1.10.2 新しい機能
-----------------

* Menu:

* PEP 492 - コルーチン、 async と await 構文::
* PEP 465 - 行列の乗算専用の中置演算子::
* PEP 448 - 追加可能なアンパックへの一般化::
* PEP 461 - bytes および bytearray のパーセント書式化サポート::
* PEP 484 - 型ヒント::
* PEP 471 - os.scandir() 関数: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ. より良く、速いディレクトリイテレータ
* PEP 475; EINTR で失敗したシステムコールの再試行: PEP 475 EINTR で失敗したシステムコールの再試行.
* PEP 479; ジェネレータ内の StopIteration の処理の変更: PEP 479 ジェネレータ内の StopIteration の処理の変更.
* PEP 485; 近似的に等しいことを調べる関数: PEP 485 近似的に等しいことを調べる関数.
* PEP 486; Python ランチャーが仮想環境を認識する: PEP 486 Python ランチャーが仮想環境を認識する.
* PEP 488; PYO ファイルの廃止: PEP 488 PYO ファイルの廃止.
* PEP 489; 拡張モジュールの多段階初期化: PEP 489 拡張モジュールの多段階初期化.


File: python.info,  Node: PEP 492 - コルーチン、 async と await 構文,  Next: PEP 465 - 行列の乗算専用の中置演算子,  Up: 新しい機能<15>

1.10.2.1 PEP 492 - コルーチン、 async と await 構文
...................................................

PEP 492(1) で *note 待機可能オブジェクト: 4c9.、*note コルーチン関数:
f73.、*note 非同期イテレーション: f74.、*note
非同期コンテキストマネージャ: 7f0. が追加され、Python における非同期プロ
グラミングを大幅に向上しました。

コルーチン関数は新たな構文 *note async def: 7ed. を用いて定義されます:

     >>> async def coro():
     ...     return 'spam'

Inside a coroutine function, the new *note await: 18d. expression can be
used to suspend coroutine execution until the result is available.  Any
object can be 'awaited', as long as it implements the *note awaitable:
4c9. protocol by defining the *note __await__(): f75. method.

PEP 492 により *note async for: ca1. 文も追加されました。非同期イテラブ
ルを反復するのに便利です。

新たな構文を用いた初歩的な HTTP クライアントの例です:

     import asyncio

     async def http_get(domain):
         reader, writer = await asyncio.open_connection(domain, 80)

         writer.write(b'\r\n'.join([
             b'GET / HTTP/1.1',
             b'Host: %b' % domain.encode('latin-1'),
             b'Connection: close',
             b'', b''
         ]))

         async for line in reader:
             print('>>>', line)

         writer.close()

     loop = asyncio.get_event_loop()
     try:
         loop.run_until_complete(http_get('example.com'))
     finally:
         loop.close()

非同期イテレーションと同様に、非同期なコンテキストマネージャの新たな構文
があります。以下のスクリプト:

     import asyncio

     async def coro(name, lock):
         print('coro {}: waiting for lock'.format(name))
         async with lock:
             print('coro {}: holding the lock'.format(name))
             await asyncio.sleep(1)
             print('coro {}: releasing the lock'.format(name))

     loop = asyncio.get_event_loop()
     lock = asyncio.Lock()
     coros = asyncio.gather(coro(1, lock), coro(2, lock))
     try:
         loop.run_until_complete(coros)
     finally:
         loop.close()

の出力は:

     coro 2: waiting for lock
     coro 2: holding the lock
     coro 1: waiting for lock
     coro 2: releasing the lock
     coro 1: holding the lock
     coro 1: releasing the lock

*note async for: ca1. と *note async with: 185. は両方とも、 *note async
def: 7ed. で宣言されたコルーチン関数内でのみ使えることに注意してください
。

コルーチン関数は *note asyncio loop: f76. のような適したイベントループ内
で実行させるためのものです。

     注釈: 
     バージョン 3.5.2 で変更: CPython 3.5.2 以降では、 ‘__aiter__’ は
     *note 非同期イテレータ: 4c7. を直接返せます。 *note awaitable: 4c9.
     オブジェクトを返すと *note PendingDeprecationWarning: ac5. が送出さ
     れます。

     より詳細なことはドキュメントの *note 非同期イテレータ (Asynchronous
     Iterator): f77. 節を参照してください。

参考
....

PEP 492(2) - コルーチン、 async 構文と await 構文

     PEP written and implemented by Yury Selivanov.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0492/

   (2) https://peps.python.org/pep-0492/


File: python.info,  Node: PEP 465 - 行列の乗算専用の中置演算子,  Next: PEP 448 - 追加可能なアンパックへの一般化,  Prev: PEP 492 - コルーチン、 async と await 構文,  Up: 新しい機能<15>

1.10.2.2 PEP 465 - 行列の乗算専用の中置演算子
.............................................

PEP 465(1) adds the ‘@’ infix operator for matrix multiplication.
Currently, no builtin Python types implement the new operator, however,
it can be implemented by defining *note __matmul__(): f79, *note
__rmatmul__(): f7a, and *note __imatmul__(): f7b. for regular,
reflected, and in-place matrix multiplication.  The semantics of these
methods is similar to that of methods defining other infix arithmetic
operators.

行列の乗算は数学、科学、工学の多くの分野では非常に一般的です。 ‘@’ の追
加によりコードをより綺麗に書くことが出来ます:

     S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r)

これはたとえば NumPy を使っても、以下のように書く必要がありました:

     S = dot((dot(H, beta) - r).T,
             dot(inv(dot(dot(H, V), H.T)), dot(H, beta) - r))

NumPy 1.10 はこの新たな演算子をサポートしています:

     >>> import numpy

     >>> x = numpy.ones(3)
     >>> x
     array([ 1., 1., 1.])

     >>> m = numpy.eye(3)
     >>> m
     array([[ 1., 0., 0.],
            [ 0., 1., 0.],
            [ 0., 0., 1.]])

     >>> x @ m
     array([ 1., 1., 1.])

参考
....

PEP 465(2) - 行列乗算専用の中置演算子

     PEP written by Nathaniel J. Smith; implemented by Benjamin
     Peterson.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0465/

   (2) https://peps.python.org/pep-0465/


File: python.info,  Node: PEP 448 - 追加可能なアンパックへの一般化,  Next: PEP 461 - bytes および bytearray のパーセント書式化サポート,  Prev: PEP 465 - 行列の乗算専用の中置演算子,  Up: 新しい機能<15>

1.10.2.3 PEP 448 - 追加可能なアンパックへの一般化
.................................................

PEP 448(1) によって、 ‘*’ イテラブルアンパック演算子と ‘**’ 辞書アンパッ
ク演算子の利用方法が拡張されました。 *note 関数呼び出し: f7d. で任意の数
のアンパックで使えるようになりました:

     >>> print(*[1], *[2], 3, *[4, 5])
     1 2 3 4 5

     >>> def fn(a, b, c, d):
     ...     print(a, b, c, d)
     ...

     >>> fn(**{'a': 1, 'c': 3}, **{'b': 2, 'd': 4})
     1 2 3 4

同様に、タプル、リスト、集合、辞書表現でも複数のアンパックが使えます
(*note 式のリスト: f7e. および *note 辞書表示: f7f. を参照してください):

     >>> *range(4), 4
     (0, 1, 2, 3, 4)

     >>> [*range(4), 4]
     [0, 1, 2, 3, 4]

     >>> {*range(4), 4, *(5, 6, 7)}
     {0, 1, 2, 3, 4, 5, 6, 7}

     >>> {'x': 1, **{'y': 2}}
     {'x': 1, 'y': 2}

参考
....

PEP 448(2) - 追加可能なアンパックへの一般化

     PEP written by Joshua Landau; implemented by Neil Girdhar, Thomas
     Wouters, and Joshua Landau.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0448/

   (2) https://peps.python.org/pep-0448/


File: python.info,  Node: PEP 461 - bytes および bytearray のパーセント書式化サポート,  Next: PEP 484 - 型ヒント,  Prev: PEP 448 - 追加可能なアンパックへの一般化,  Up: 新しい機能<15>

1.10.2.4 PEP 461 - bytes および bytearray のパーセント書式化サポート
....................................................................

PEP 461(1) によって、 *note bytes: 192. と *note bytearray: 344. に ‘%’
*note 補間演算子: f81. のサポートが追加されます。

補間は通常は文字列演算だと考えられていますが、 ‘bytes’ や ‘bytearrays’ 上
の補間が意味を持つ場合もあって、この機能が無いと余計な作業が必要になりコ
ードの全体の可読性が損なわれます。 この問題は特にワイヤフォーマットプロ
トコルの取り扱いにおいて重要で、バイナリとASCII互換のテキストが入り交じ
ったものがよく出てきます。

例:

     >>> b'Hello %b!' % b'World'
     b'Hello World!'

     >>> b'x=%i y=%f' % (1, 2.5)
     b'x=1 y=2.500000'

Unicode に対して ‘%b’ は使えませんが、 ‘%a’ であれば使えます
(‘repr(obj).encode('ascii', 'backslashreplace')’ と同等):

     >>> b'Hello %b!' % 'World'
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: %b requires bytes, or an object that implements __bytes__, not 'str'

     >>> b'price: %a' % '10€'
     b"price: '10\\u20ac'"

‘%s’ および ‘%r’ 変換型はサポートはされますが、 Python 2 との互換性を持
たせる必要のあるコードベースでのみ使われるべきだということに注意してくだ
さい。

参考
....

PEP 461(2) - bytes と bytearray への % 書式化の追加

     PEP written by Ethan Furman; implemented by Neil Schemenauer and
     Ethan Furman.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0461/

   (2) https://peps.python.org/pep-0461/


File: python.info,  Node: PEP 484 - 型ヒント,  Next: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ,  Prev: PEP 461 - bytes および bytearray のパーセント書式化サポート,  Up: 新しい機能<15>

1.10.2.5 PEP 484 - 型ヒント
...........................

関数アノテーション構文はバージョン 3.0 ( PEP 3107(1)) から Python の仕様
になりましたが、アノテーションのセマンティクスは未定義のままでした。

経験的に、関数アノテーションの使用の大半は関数の引数と返り値の型ヒントを
提供するためのものです。 標準ライブラリーが型アノテーションの基本的な定
義とツールを持てば、Python ユーザに有益であることは明白となりました。

PEP 484(2) introduces a *note provisional module: 3d1. to provide these
standard definitions and tools, along with some conventions for
situations where annotations are not available.

例えば、こちらは引数と返り値の型がアノテーションで定義されている簡単な関
数です:

     def greeting(name: str) -> str:
         return 'Hello ' + name

While these annotations are available at runtime through the usual *note
__annotations__: 458. attribute, 'no automatic type checking happens at
runtime'.  Instead, it is assumed that a separate off-line type checker
(e.g.  mypy(3)) will be used for on-demand source code analysis.

型システムはユニオン、一般型、そして *note Any: 8bb. という全ての型と互
換な (すなわち代入可能) 特殊型をサポートしています。

参考
....

   * *note typing: 10a. モジュールのドキュメント

   * 
     PEP 484(4) - 型ヒント

          PEP 著 Guido van Rossum, Jukka Lehtosalo, Łukasz Langa; 実装
          Guido van Rossum。

   * 
     PEP 483(5) - 型ヒントの理論

          PEP written by Guido van Rossum

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3107/

   (2) https://peps.python.org/pep-0484/

   (3) https://mypy-lang.org

   (4) https://peps.python.org/pep-0484/

   (5) https://peps.python.org/pep-0483/


File: python.info,  Node: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ,  Next: PEP 475 EINTR で失敗したシステムコールの再試行,  Prev: PEP 484 - 型ヒント,  Up: 新しい機能<15>

1.10.2.6 PEP 471 - os.scandir() 関数 - より良く、速いディレクトリイテレータ
...........................................................................

PEP 471(1) により新しいディレクトリ反復関数 *note os.scandir(): c54. が
標準ライブラリへ追加されました。 さらに、 ‘scandir’ を使い *note
os.walk(): 6d0. が実装され、 POSIX システムで3倍から5倍、 Windows システ
ムで7倍から20倍高速になりました。 これは主に、ディレクトリツリーを走査す
るのに必要な *note os.stat(): 26d. の呼び出し回数をかなり減らしたことに
よるものです。

これの他にも、 ‘scandir’ ファイル名のリストではなくイテレータを返すよう
になり、非常に大きなディレクトリ群の走査をするときのメモリ効率が改善され
ました。

次の例では、 *note os.scandir(): c54. を使用して、与えられた 'path' 内の
先頭が ‘'.'’ でないすべてのファイル (ディレクトリを除く) を表示します。
*note entry.is_file(): f84. を呼び出しても、通常は追加のシステムコールは
行われません:

     for entry in os.scandir(path):
         if not entry.name.startswith('.') and entry.is_file():
             print(entry.name)

参考
....

PEP 471(2) - os.scandir() 関数 - より良く、速いディレクトリイテレータ

     PEP 著・実装 Ben Hoyt 補佐 Victor Stinner。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0471/

   (2) https://peps.python.org/pep-0471/


File: python.info,  Node: PEP 475 EINTR で失敗したシステムコールの再試行,  Next: PEP 479 ジェネレータ内の StopIteration の処理の変更,  Prev: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ,  Up: 新しい機能<15>

1.10.2.7 PEP 475: EINTR で失敗したシステムコールの再試行
........................................................

An *note errno.EINTR: f87. error code is returned whenever a system
call, that is waiting for I/O, is interrupted by a signal.  Previously,
Python would raise *note InterruptedError: f88. in such cases.  This
meant that, when writing a Python application, the developer had two
choices:

  1. ‘InterruptedError’ を無視する。

  2. 呼び出し箇所の全てで ‘InterruptedError’ を処理し、中断されたシステ
     ムコールの再開を試みる。

最初の選択肢では、アプリケーションは断続的に失敗します。 二つ目の選択肢
では、定型処理を大量に追加せねばならず、コードの可読性が著しく下がります
。 次の2つを比べてみてください:

     print("Hello World")

および:

     while True:
         try:
             print("Hello World")
             break
         except InterruptedError:
             continue

PEP 475(1) は ‘EINTR’ を受けた場合のシステムコールの自動再試行を実装して
います。 これはほとんどの場合ユーザコードでの ‘EINTR’ や *note
InterruptedError: f88. を扱う負担をなくし、標準ライブラリを含む Python プ
ログラムをより堅牢にします。 シグナルハンドラが例外を投げない場合にのみ
システムコールを再試行することに注意してください。

下記は、シグナルで中断された際に再試行をするようになった関数のリストです
:

   * *note open(): 316. および *note io.open(): 740.;

   * *note faulthandler: 5c. モジュールの関数;

   * *note os: a5. モジュールの関数: *note fchdir(): f89, *note
     fchmod(): 52a, *note fchown(): f8a, *note fdatasync(): f8b, *note
     fstat(): f8c, *note fstatvfs(): f8d, *note fsync(): f8e, *note
     ftruncate(): f8f, *note mkfifo(): f90, *note mknod(): f91, *note
     open(): f92, *note posix_fadvise(): f93, *note posix_fallocate():
     f94, *note pread(): d56, *note pwrite(): d59, *note read(): f95,
     *note readv(): d55, *note sendfile(): d05, *note wait3(): f96,
     *note wait4(): f97, *note wait(): f98, *note waitid(): f99, *note
     waitpid(): f9a, *note write(): f9b, *note writev(): d58.;

   * special cases: *note os.close(): d6b. and *note os.dup2(): d5a. now
     ignore *note EINTR: f87. errors; the syscall is not retried (see
     the PEP for the rationale);

   * *note select: c6. モジュール関数: *note devpoll.poll(): f9c, *note
     epoll.poll(): f9d, *note kqueue.control(): f9e, *note poll.poll():
     f9f, *note select(): fa0.;

   * *note socket: fa1. クラスのメソッド: *note accept(): fa2, *note
     connect(): fa3. (ノンブロッキングソケットを除く), *note recv():
     fa4, *note recvfrom(): fa5, *note recvmsg(): fa6, *note send():
     fa7, *note sendall(): fa8, *note sendmsg(): 6a1, *note sendto():
     fa9.;

   * *note signal.sigtimedwait(): faa. および *note
     signal.sigwaitinfo(): fab.;

   * *note time.sleep(): 8ac.

参考
....

PEP 475(2) - EINTR で失敗したシステムコールの再試行

     Antoine Pitrou の協力のもと、 PEP および実装は Charles-François
     Natali と Victor Stinner によって書かれました (『フレンチ・コネクシ
     ョン』)。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/

   (2) https://peps.python.org/pep-0475/


File: python.info,  Node: PEP 479 ジェネレータ内の StopIteration の処理の変更,  Next: PEP 485 近似的に等しいことを調べる関数,  Prev: PEP 475 EINTR で失敗したシステムコールの再試行,  Up: 新しい機能<15>

1.10.2.8 PEP 479: ジェネレータ内の StopIteration の処理の変更
.............................................................

Python 3.4 以前では、ジェネレータと *note StopIteration: df5. の組み合わ
せが驚くような動作をし、分かりづらいバグを隠すことがありました。 以前は
、ジェネレータ関数内でうっかり ‘StopIteration’ が送出されると、そのジェ
ネレータの反復処理をしているループ構造が終端に達したと解釈されていました
。

PEP 479(1) によってジェネレータのこの振る舞いが変更されました: ジェネレ
ータ内部で ‘StopIteration’ 例外が送出されたときは、ジェネレータのフレー
ムを抜ける前に *note RuntimeError: 244. に置き換えられます。 この変更の
一番の目的は、保護されていない *note next(): 9d8. の呼び出しが
‘StopIteration’ を送出し、ジェネレータを回している反復処理が黙って終了し
てしまうような状況で、デバッグをしやすくすることです。 これは ‘yield
from’ 構造と組み合わさったとき特に有害になります。

これは後方互換性の無い変更ですので、この新しい振る舞いを有効にするには
*note __future__: fad. のインポートが必要です:

     >>> from __future__ import generator_stop

     >>> def gen():
     ...     next(iter([]))
     ...     yield
     ...
     >>> next(gen())
     Traceback (most recent call last):
       File "<stdin>", line 2, in gen
     StopIteration

     The above exception was the direct cause of the following exception:

     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     RuntimeError: generator raised StopIteration

‘__future__’ をインポートしておらず、ジェネレータの内部で *note
StopIteration: df5. 例外が送出されたときには *note
PendingDeprecationWarning: ac5. が送出されます。

参考
....

PEP 479(2) - ジェネレータ内の StopIteration の処理の変更

     PEP written by Chris Angelico and Guido van Rossum.  Implemented by
     Chris Angelico, Yury Selivanov and Nick Coghlan.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0479/

   (2) https://peps.python.org/pep-0479/


File: python.info,  Node: PEP 485 近似的に等しいことを調べる関数,  Next: PEP 486 Python ランチャーが仮想環境を認識する,  Prev: PEP 479 ジェネレータ内の StopIteration の処理の変更,  Up: 新しい機能<15>

1.10.2.9 PEP 485: 近似的に等しいことを調べる関数
................................................

PEP 485(1) により、2値が互いに近似的に等しいか "近い" ことを調べる関数
*note math.isclose(): fb0. 及び *note cmath.isclose(): fb1. が追加されま
した。 2値が近いと判断されるかどうかは与えられた絶対及び相対許容差で決ま
ります。 相対許容差は ‘isclose’ 引数間で許される、絶対値の大きい方に対す
る最大の差です:

     >>> import math
     >>> a = 5.0
     >>> b = 4.99998
     >>> math.isclose(a, b, rel_tol=1e-5)
     True
     >>> math.isclose(a, b, rel_tol=1e-6)
     False

2値を絶対許容差で比較することも出来ます。絶対許容差は非負数でなければな
りません:

     >>> import math
     >>> a = 5.0
     >>> b = 4.99998
     >>> math.isclose(a, b, abs_tol=0.00003)
     True
     >>> math.isclose(a, b, abs_tol=0.00001)
     False

参考
....

PEP 485(2) - A function for testing approximate equality

     PEP written by Christopher Barker; implemented by Chris Barker and
     Tal Einat.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0485/

   (2) https://peps.python.org/pep-0485/


File: python.info,  Node: PEP 486 Python ランチャーが仮想環境を認識する,  Next: PEP 488 PYO ファイルの廃止,  Prev: PEP 485 近似的に等しいことを調べる関数,  Up: 新しい機能<15>

1.10.2.10 PEP 486: Python ランチャーが仮想環境を認識する
........................................................

PEP 486(1) により、 Windows ランチャー ( PEP 397(2) を参照してください)
が有効になっている仮想環境を認識するようになりました。 デフォルトのイン
タプリタを使っていて、 ‘VIRTUAL_ENV’ 環境変数が設定されているときは、仮
想環境のインタプリタが使われます。

参考
....

PEP 486(3) - Python ランチャーが仮想環境を認識する

     PEP written and implemented by Paul Moore.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0486/

   (2) https://peps.python.org/pep-0397/

   (3) https://peps.python.org/pep-0486/


File: python.info,  Node: PEP 488 PYO ファイルの廃止,  Next: PEP 489 拡張モジュールの多段階初期化,  Prev: PEP 486 Python ランチャーが仮想環境を認識する,  Up: 新しい機能<15>

1.10.2.11 PEP 488: PYO ファイルの廃止
.....................................

PEP 488(1) は ‘.pyo’ ファイルという概念を廃止しました。 つまり、‘.pyc’ フ
ァイルは最適化されていないバイトコードと最適化されたバイトコードの両方を
指すということです。 バイトコードファイルを何度も再生成する必要がないよ
う、バイトコードが最適化されたときは ‘.pyc’ ファイルは任意の ‘opt-’ タグ
を名前に持つようになりました。 この副作用で、*note -O: 18c. と *note
-OO: fb5. のいずれかで実行した場合でも、バイトコードのファイル名が衝突し
ないようになりました。 それにより、*note -O: 18c. および *note -OO: fb5.
で生成したバイトコードは同時に存在できるようになりました。 *note
importlib.util.cache_from_source(): 353. にの API は更新され、この変更に
役立ちます。

参考
....

PEP 488(2) - PYO ファイルの廃止

     PEP written and implemented by Brett Cannon.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0488/

   (2) https://peps.python.org/pep-0488/


File: python.info,  Node: PEP 489 拡張モジュールの多段階初期化,  Prev: PEP 488 PYO ファイルの廃止,  Up: 新しい機能<15>

1.10.2.12 PEP 489: 拡張モジュールの多段階初期化
...............................................

PEP 489(1) により拡張モジュールの初期化方式が更新され、 Python 3.4 で
PEP 451(2) によって導入された2段階でモジュールを読み込む仕組みが活用でき
るようになりました。

この変更によって、新しい仕組みを使うことを選択した拡張モジュールのインポ
ートの動作が、 Python のソースコードやバイトコードでできたモジュールにか
なり近くなり、これまで ASCII に制限されていたモジュール名に任意の識別子
が使えるようになりました。

参考
....

PEP 489(3) - 拡張モジュールの多段階初期化

     PEP 著 Petr Viktorin, Stefan Behnel, Nick Coghlan; 実装 Petr
     Viktorin.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0489/

   (2) https://peps.python.org/pep-0451/

   (3) https://peps.python.org/pep-0489/


File: python.info,  Node: その他の言語変更<9>,  Next: 新たなモジュール<9>,  Prev: 新しい機能<15>,  Up: What's New In Python 3 5

1.10.3 その他の言語変更
-----------------------

Python 言語コアに小さな変更がいくつか行われました:

   * ‘"namereplace"’ エラーハンドラが追加されました。
     ‘"backslashreplace"’ エラーハンドラはデコードと変換で動くようになり
     ました。 (Contributed by Serhiy Storchaka in bpo-19676(1) and
     bpo-22286(2).)

   * *note -b: 7f9. オプションが *note bytes: 192. と *note int: 19b. の
     比較に影響するようになりました。 (Contributed by Serhiy Storchaka
     in bpo-23681(3).)

   * 新たなカザフ語 ‘kz1048’ 及びタジク語 ‘koi8_t’ *note コーデックス:
     fb8.。 (Contributed by Serhiy Storchaka in bpo-22682(4) and
     bpo-22681(5).)

   * プロパティのドキュメンテーション文字列が書き込み可能になりました。
     これは特に *note collections.namedtuple(): 4e0. のドキュメンテーシ
     ョン文字列で有用です。 (Contributed by Berker Peksag in
     bpo-24064(6).)

   * 相対インポートに関する循環インポートがサポートされました。
     (Contributed by Brett Cannon and Antoine Pitrou in bpo-17636(7).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19676

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22286

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23681

   (4) https://bugs.python.org/issue?@action=redirect&bpo=22682

   (5) https://bugs.python.org/issue?@action=redirect&bpo=22681

   (6) https://bugs.python.org/issue?@action=redirect&bpo=24064

   (7) https://bugs.python.org/issue?@action=redirect&bpo=17636


File: python.info,  Node: 新たなモジュール<9>,  Next: 改良されたモジュール<9>,  Prev: その他の言語変更<9>,  Up: What's New In Python 3 5

1.10.4 新たなモジュール
-----------------------

* Menu:

* typing: typing<11>.
* zipapp: zipapp<2>.


File: python.info,  Node: typing<11>,  Next: zipapp<2>,  Up: 新たなモジュール<9>

1.10.4.1 typing
...............

The new *note typing: 10a. *note provisional: 3d1. module provides
standard definitions and tools for function type annotations.  See *note
Type Hints: f62. for more information.


File: python.info,  Node: zipapp<2>,  Prev: typing<11>,  Up: 新たなモジュール<9>

1.10.4.2 zipapp
...............

新たな *note zipapp: 136. モジュール ( PEP 441(1) で仕様定義) は実行可能
な Python Zip アプリケーションを作成するための API とコマンドラインツー
ルを提供します。 Python Zip アプリケーションは Python 2.6 の
bpo-1739468(2) で導入されましたが、それ以降もあまり知られていませんでし
た。

この新しいモジュールを使ったアプリケーションのバンドル方法は単純で、
‘__main__.py’ ファイルを含む全てのファイルをディレクトリ ‘myapp’ に置き
、次のように実行します:

     $ python -m zipapp myapp
     $ python myapp.pyz

モジュールの実装は bpo-23491(3) の Paul Moore による貢献です。

参考
....

PEP 441(4) - Python ZIP アプリケーションのサポートの改善
<whatsnew-zipapp>'

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0441/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1739468

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23491

   (4) https://peps.python.org/pep-0441/


File: python.info,  Node: 改良されたモジュール<9>,  Next: その他のモジュールレベルの変更,  Prev: 新たなモジュール<9>,  Up: What's New In Python 3 5

1.10.5 改良されたモジュール
---------------------------

* Menu:

* argparse: argparse<6>.
* asyncio: asyncio<13>.
* bz2::
* cgi::
* cmath: cmath<2>.
* コード::
* collections: collections<5>.
* collections.abc: collections abc<3>.
* compileall: compileall<4>.
* concurrent.futures: concurrent futures<6>.
* configparser: configparser<5>.
* contextlib: contextlib<5>.
* csv: csv<3>.
* curses: curses<5>.
* dbm: dbm<5>.
* difflib: difflib<3>.
* distutils: distutils<7>.
* doctest: doctest<3>.
* email: email<4>.
* enum: enum<8>.
* faulthandler: faulthandler<4>.
* functools: functools<5>.
* glob: glob<3>.
* gzip: gzip<4>.
* heapq: heapq<2>.
* http: http<3>.
* http.client: http client<3>.
* idlelib と IDLE: idlelib と IDLE<3>.
* imaplib: imaplib<3>.
* imghdr::
* importlib: importlib<8>.
* inspect: inspect<8>.
* io: io<7>.
* ipaddress: ipaddress<4>.
* json: json<3>.
* linecache: linecache<3>.
* locale: locale<6>.
* logging: logging<5>.
* lzma::
* math: math<9>.
* multiprocessing: multiprocessing<7>.
* operator: operator<3>.
* os: os<11>.
* pathlib: pathlib<13>.
* pickle: pickle<4>.
* poplib: poplib<2>.
* re: re<8>.
* readline: readline<2>.
* selectors::
* shutil: shutil<5>.
* signal: signal<3>.
* smtpd: smtpd<2>.
* smtplib: smtplib<2>.
* sndhdr::
* socket: socket<9>.
* ssl: ssl<10>.
* sqlite3: sqlite3<9>.
* subprocess: subprocess<4>.
* sys: sys<11>.
* sysconfig: sysconfig<3>.
* tarfile: tarfile<7>.
* threading: threading<7>.
* time: time<7>.
* timeit: timeit<2>.
* tkinter: tkinter<9>.
* traceback: traceback<5>.
* types: types<6>.
* unicodedata: unicodedata<9>.
* unittest: unittest<9>.
* unittest.mock: unittest mock<3>.
* urllib: urllib<4>.
* wsgiref::
* xmlrpc: xmlrpc<2>.
* xml.sax: xml sax.
* zipfile: zipfile<5>.


File: python.info,  Node: argparse<6>,  Next: asyncio<13>,  Up: 改良されたモジュール<9>

1.10.5.1 argparse
.................

*note ArgumentParser: 1bd. クラスは、*note allow_abbrev: fbe. を ‘False’
に設定することでロングオプションの *note 短縮使用: fbf. を無効化できるよ
うになりました。 (Contributed by Jonathan Paugh, Steven Bethard, paul j3
and Daniel Eriksson in bpo-14910(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14910


File: python.info,  Node: asyncio<13>,  Next: bz2,  Prev: argparse<6>,  Up: 改良されたモジュール<9>

1.10.5.2 asyncio
................

Since the *note asyncio: b. module is *note provisional: 3d1, all
changes introduced in Python 3.5 have also been backported to Python
3.4.x.

Python 3.4.0 以後の *note asyncio: b. モジュールの重要な変更点:

   * 新たなデバッグ API: *note loop.set_debug(): fc1. と *note
     loop.get_debug(): fc2. メソッド。 (Contributed by Victor Stinner.)

   * proactor イベントループが SSL をサポートしました。 (Contributed by
     Antoine Pitrou and Victor Stinner in bpo-22560(1).)

   * イベントループが閉じているかどうか調べる新たな *note
     loop.is_closed(): fc3. メソッド。 (Contributed by Victor Stinner in
     bpo-21326(2).)

   * コルーチンの新しい *note Task: 1c7. を便利に作成しスケジュールする
     ための新たな *note loop.create_task(): 1ca.。 ‘create_task’ メソッ
     ドは コルーチンをタスクにラップする全ての asyncio 関数、たとえば
     *note asyncio.wait(): 6a7, *note asyncio.gather(): 813.、にも使われ
     ます。 (Contributed by Victor Stinner.)

   * A new *note transport.get_write_buffer_limits(): fc4. method to
     inquire for 'high-' and 'low-' water limits of the flow control.
     (Contributed by Victor Stinner.)

   * The ‘async()’ function is deprecated in favor of *note
     ensure_future(): e71.  (Contributed by Yury Selivanov.)

   * *note loop.create_task(): 1ca. メソッドが使うタスクファクトリーをカ
     スタマイズするための新たな *note loop.set_task_factory(): 1c8. メソ
     ッドと *note loop.get_task_factory(): fc5. メソッド。 (Yury
     Selivanovによる貢献。)

   * 新たな *note Queue.join(): fc6. および *note Queue.task_done():
     fc7. キューメソッド。(Contributed by Victor Stinner.)

   * ‘JoinableQueue’ クラスは *note asyncio.Queue: c6a. クラスにより削除
     されました。 (Contributed by Victor Stinner.)

3.5.1 での変更:

   * The *note ensure_future(): e71. function and all functions that use
     it, such as *note loop.run_until_complete(): e72, now accept all
     kinds of *note awaitable objects: 4c9.  (Contributed by Yury
     Selivanov.)

   * 他のスレッドからコルーチンをイベントループに送信するための新たな
     *note run_coroutine_threadsafe(): a82. 関数。 (Contributed by
     Vincent Michel.)

   * New *note Transport.is_closing(): e73. method to check if the
     transport is closing or closed.  (Contributed by Yury Selivanov.)

   * The *note loop.create_server(): d09. method can now accept a list
     of hosts.  (Contributed by Yann Sionneau.)

3.5.2 での変更:

   * New *note loop.create_future(): e74. method to create Future
     objects.  This allows alternative event loop implementations, such
     as uvloop(3), to provide a faster *note asyncio.Future: dc6.
     implementation.  (Contributed by Yury Selivanov.)

   * New *note loop.get_exception_handler(): e75. method to get the
     current exception handler.  (Contributed by Yury Selivanov.)

   * 新しい *note StreamReader.readuntil(): 4d0. メソッドで、区切りとな
     るバイトの並びが出てくるまでストリームからデータを読み取れるように
     なりました。 (Contributed by Mark Korenberg.)

   * The *note loop.create_connection(): 818. and *note
     loop.create_server(): d09. methods are optimized to avoid calling
     the system ‘getaddrinfo’ function if the address is already
     resolved.  (Contributed by A. Jesse Jiryu Davis.)

   * The *note loop.sock_connect(sock, address): fc8. no longer requires
     the 'address' to be resolved prior to the call.  (Contributed by A.
     Jesse Jiryu Davis.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22560

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21326

   (3) https://github.com/MagicStack/uvloop


File: python.info,  Node: bz2,  Next: cgi,  Prev: asyncio<13>,  Up: 改良されたモジュール<9>

1.10.5.3 bz2
............

*note BZ2Decompressor.decompress: fca. メソッドがオプション引数
'max_length' を取れるようになり、展開されたデータの最大サイズが制限でき
るようになりました。 (Contributed by Nikolaus Rath in bpo-15955(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15955


File: python.info,  Node: cgi,  Next: cmath<2>,  Prev: bz2,  Up: 改良されたモジュール<9>

1.10.5.4 cgi
............

The ‘FieldStorage’ class now supports the *note context manager: 1e1.
protocol.  (Contributed by Berker Peksag in bpo-20289(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20289


File: python.info,  Node: cmath<2>,  Next: コード,  Prev: cgi,  Up: 改良されたモジュール<9>

1.10.5.5 cmath
..............

新たな関数 *note isclose(): fb1. は近似的に等しいかどうかを判断する方法
を提供します。 (Contributed by Chris Barker and Tal Einat in
bpo-24270(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24270


File: python.info,  Node: コード,  Next: collections<5>,  Prev: cmath<2>,  Up: 改良されたモジュール<9>

1.10.5.6 コード
...............

*note InteractiveInterpreter.showtraceback(): fce. メソッドが、対話的イ
ンタープリタのように連なったスタックトレース全体を表示するようになりまし
た。 (Contributed by Claudiu Popa in bpo-17442(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17442


File: python.info,  Node: collections<5>,  Next: collections abc<3>,  Prev: コード,  Up: 改良されたモジュール<9>

1.10.5.7 collections
....................

*note collections.OrderedDict: 7f3. が C で実装されました。 これにより
4倍 から 100 倍高速になりました。 (Contributed by Eric Snow in
bpo-16991(1).)

‘OrderedDict.items()’, ‘OrderedDict.keys()’, and ‘OrderedDict.values()’
views now support *note reversed(): a65. iteration.  (Contributed by
Serhiy Storchaka in bpo-19505(2).)

*note deque: 7f4. クラスが *note index(): fd0.、 *note insert(): fd1.、
*note copy(): fd2. を定義し、‘+’ と ‘*’ 演算をサポートしました。 これに
より deque インスタンスは *note MutableSequence: 4bf. と認識され、list と
の代替性が向上しました。 (Contributed by Raymond Hettinger in
bpo-23704(3).)

*note namedtuple(): 4e0. で生成されたドキュメンテーション文字列が更新可
能となりました:

     Point = namedtuple('Point', ['x', 'y'])
     Point.__doc__ += ': Cartesian coordinate'
     Point.x.__doc__ = 'abscissa'
     Point.y.__doc__ = 'ordinate'

(Contributed by Berker Peksag in bpo-24064(4).)

The *note UserString: fd3. class now implements the *note
__getnewargs__(): fd4, *note __rmod__(): fd5, *note casefold(): fd6,
*note format_map(): fd7, *note isprintable(): fd8, and *note
maketrans(): fd9. methods to match the corresponding methods of *note
str: 169.  (Contributed by Joe Jevnik in bpo-22189(5).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16991

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19505

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23704

   (4) https://bugs.python.org/issue?@action=redirect&bpo=24064

   (5) https://bugs.python.org/issue?@action=redirect&bpo=22189


File: python.info,  Node: collections abc<3>,  Next: compileall<4>,  Prev: collections<5>,  Up: 改良されたモジュール<9>

1.10.5.8 collections.abc
........................

The ‘Sequence.index()’ method now accepts 'start' and 'stop' arguments
to match the corresponding methods of *note tuple: 614, *note list: 24d,
etc.  (Contributed by Devin Jeanpierre in bpo-23086(1).)

新たに *note Generator: fdb. 抽象基底クラスが追加されました。
(Contributed by Stefan Behnel in bpo-24018(2).)

新たに *note Awaitable: fdc, *note Coroutine: fdd, *note AsyncIterator:
fde, *note AsyncIterable: fdf. 抽象基底クラスが追加されました。
(Contributed by Yury Selivanov in bpo-24184(3).)

For earlier Python versions, a backport of the new ABCs is available in
an external PyPI package(4).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23086

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24018

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24184

   (4) https://pypi.org/project/backports_abc/


File: python.info,  Node: compileall<4>,  Next: concurrent futures<6>,  Prev: collections abc<3>,  Up: 改良されたモジュール<9>

1.10.5.9 compileall
...................

A new *note compileall: 21. option, ‘-j N’, allows running 'N' workers
simultaneously to perform parallel bytecode compilation.  The *note
compile_dir(): d1b. function has a corresponding ‘workers’ parameter.
(Contributed by Claudiu Popa in bpo-16104(1).)

Another new option, ‘-r’, allows controlling the maximum recursion level
for subdirectories.  (Contributed by Claudiu Popa in bpo-19628(2).)

The ‘-q’ command line option can now be specified more than once, in
which case all output, including errors, will be suppressed.  The
corresponding ‘quiet’ parameter in *note compile_dir(): d1b, *note
compile_file(): fe1, and *note compile_path(): fe2. can now accept an
integer value indicating the level of output suppression.  (Contributed
by Thomas Kluyver in bpo-21338(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16104

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19628

   (3) https://bugs.python.org/issue?@action=redirect&bpo=21338


File: python.info,  Node: concurrent futures<6>,  Next: configparser<5>,  Prev: compileall<4>,  Up: 改良されたモジュール<9>

1.10.5.10 concurrent.futures
............................

The *note Executor.map(): 1dc. method now accepts a 'chunksize' argument
to allow batching of tasks to improve performance when *note
ProcessPoolExecutor(): 1d6. is used.  (Contributed by Dan O'Reilly in
bpo-11271(1).)

The number of workers in the *note ThreadPoolExecutor: 949. constructor
is optional now.  The default value is 5 times the number of CPUs.
(Contributed by Claudiu Popa in bpo-21527(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11271

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21527


File: python.info,  Node: configparser<5>,  Next: contextlib<5>,  Prev: concurrent futures<6>,  Up: 改良されたモジュール<9>

1.10.5.11 configparser
......................

*note configparser: 26. now provides a way to customize the conversion
of values by specifying a dictionary of converters in the *note
ConfigParser: 4de. constructor, or by defining them as methods in
‘ConfigParser’ subclasses.  Converters defined in a parser instance are
inherited by its section proxies.

以下はプログラム例です:

     >>> import configparser
     >>> conv = {}
     >>> conv['list'] = lambda v: [e.strip() for e in v.split() if e.strip()]
     >>> cfg = configparser.ConfigParser(converters=conv)
     >>> cfg.read_string("""
     ... [s]
     ... list = a b c d e f g
     ... """)
     >>> cfg.get('s', 'list')
     'a b c d e f g'
     >>> cfg.getlist('s', 'list')
     ['a', 'b', 'c', 'd', 'e', 'f', 'g']
     >>> section = cfg['s']
     >>> section.getlist('list')
     ['a', 'b', 'c', 'd', 'e', 'f', 'g']

(Contributed by Łukasz Langa in bpo-18159(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18159


File: python.info,  Node: contextlib<5>,  Next: csv<3>,  Prev: configparser<5>,  Up: 改良されたモジュール<9>

1.10.5.12 contextlib
....................

新規 *note context manager: 1e1. の *note contextlib.redirect_stderr():
fe6. は、ユーティリティスクリプトにて、その出力を *note sys.stderr: b33.
に書き出す一方でその向き先を変えれない頑固な API の扱いを簡単にしてくれ
ます (*note redirect_stdout(): fe7. と対となるものです)。:

     >>> import contextlib, io, logging
     >>> f = io.StringIO()
     >>> with contextlib.redirect_stderr(f):
     ...     logging.warning('warning')
     ...
     >>> f.getvalue()
     'WARNING:root:warning\n'

(Contributed by Berker Peksag in bpo-22389(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22389


File: python.info,  Node: csv<3>,  Next: curses<5>,  Prev: contextlib<5>,  Up: 改良されたモジュール<9>

1.10.5.13 csv
.............

*note writerow(): fe9. メソッドは、シーケンスだけでなく、 任意のイテラブ
ルをサポートしました。(Contributed by Serhiy Storchaka in bpo-23171(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23171


File: python.info,  Node: curses<5>,  Next: dbm<5>,  Prev: csv<3>,  Up: 改良されたモジュール<9>

1.10.5.14 curses
................

The new *note update_lines_cols(): feb. function updates the *note
LINES: fec. and *note COLS: fed. module variables.  This is useful for
detecting manual screen resizing.  (Contributed by Arnon Yaari in
bpo-4254(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=4254


File: python.info,  Node: dbm<5>,  Next: difflib<3>,  Prev: curses<5>,  Up: 改良されたモジュール<9>

1.10.5.15 dbm
.............

*note dumb.open: c8d. always creates a new database when the flag has
the value ‘"n"’.  (Contributed by Claudiu Popa in bpo-18039(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18039


File: python.info,  Node: difflib<3>,  Next: distutils<7>,  Prev: dbm<5>,  Up: 改良されたモジュール<9>

1.10.5.16 difflib
.................

The charset of HTML documents generated by *note HtmlDiff.make_file():
ff0. can now be customized by using a new 'charset' keyword-only
argument.  The default charset of HTML document changed from
‘"ISO-8859-1"’ to ‘"utf-8"’.  (Contributed by Berker Peksag in
bpo-2052(1).)

The *note diff_bytes(): ff1. function can now compare lists of byte
strings.  This fixes a regression from Python 2.  (Contributed by Terry
J. Reedy and Greg Ward in bpo-17445(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=2052

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17445


File: python.info,  Node: distutils<7>,  Next: doctest<3>,  Prev: difflib<3>,  Up: 改良されたモジュール<9>

1.10.5.17 distutils
...................

Both the ‘build’ and ‘build_ext’ commands now accept a ‘-j’ option to
enable parallel building of extension modules.  (Contributed by Antoine
Pitrou in bpo-5309(1).)

The ‘distutils’ module now supports ‘xz’ compression, and can be enabled
by passing ‘xztar’ as an argument to ‘bdist --format’.  (Contributed by
Serhiy Storchaka in bpo-16314(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5309

   (2) https://bugs.python.org/issue?@action=redirect&bpo=16314


File: python.info,  Node: doctest<3>,  Next: email<4>,  Prev: distutils<7>,  Up: 改良されたモジュール<9>

1.10.5.18 doctest
.................

*note DocTestSuite(): ff4. 関数が、 'module' がドキュメンテーション文字
列(docstrings)を含まない場合に *note ValueError: 2ec. を送出するのではな
く空の *note unittest.TestSuite: ff5. を返すようになりました。
(Contributed by Glenn Jones in bpo-15916(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15916


File: python.info,  Node: email<4>,  Next: enum<8>,  Prev: doctest<3>,  Up: 改良されたモジュール<9>

1.10.5.19 email
...............

A new policy option *note Policy.mangle_from_: ff7. controls whether or
not lines that start with ‘"From "’ in email bodies are prefixed with a
‘">"’ character by generators.  The default is ‘True’ for *note
compat32: e97. and ‘False’ for all other policies.  (Contributed by
Milan Oberkirch in bpo-20098(1).)

A new *note Message.get_content_disposition(): ff8. method provides easy
access to a canonical value for the ‘Content-Disposition’ header.
(Contributed by Abhilash Raj in bpo-21083(2).)

A new policy option *note EmailPolicy.utf8: ff9. can be set to ‘True’ to
encode email headers using the UTF-8 charset instead of using encoded
words.  This allows ‘Messages’ to be formatted according to RFC 6532(3)
and used with an SMTP server that supports the RFC 6531(4) ‘SMTPUTF8’
extension.  (Contributed by R. David Murray in bpo-24211(5).)

The *note mime.text.MIMEText: ffa. constructor now accepts a *note
charset.Charset: ffb. instance.  (Contributed by Claude Paroz and Berker
Peksag in bpo-16324(6).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20098

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21083

   (3) https://datatracker.ietf.org/doc/html/rfc6532.html

   (4) https://datatracker.ietf.org/doc/html/rfc6531.html

   (5) https://bugs.python.org/issue?@action=redirect&bpo=24211

   (6) https://bugs.python.org/issue?@action=redirect&bpo=16324


File: python.info,  Node: enum<8>,  Next: faulthandler<4>,  Prev: email<4>,  Up: 改良されたモジュール<9>

1.10.5.20 enum
..............

*note Enum: 842. 呼び出し可能オブジェクトは、'names' のみが与えられた場
合に enum 値の初期値を指定する新たな引数 'start' を持ちます:

     >>> Animal = enum.Enum('Animal', 'cat dog', start=10)
     >>> Animal.cat
     <Animal.cat: 10>
     >>> Animal.dog
     <Animal.dog: 11>

(Contributed by Ethan Furman in bpo-21706(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21706


File: python.info,  Node: faulthandler<4>,  Next: functools<5>,  Prev: enum<8>,  Up: 改良されたモジュール<9>

1.10.5.21 faulthandler
......................

関数 *note enable(): 20f, *note register(): ffe, *note dump_traceback():
fff, *note dump_traceback_later(): 1000. が、ファイル様オブジェクトだけ
でなくファイル記述子を受け取るようになりました。 (Contributed by Wei Wu
in bpo-23566(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23566


File: python.info,  Node: functools<5>,  Next: glob<3>,  Prev: faulthandler<4>,  Up: 改良されたモジュール<9>

1.10.5.22 functools
...................

*note lru_cache(): be2. 機構の多くが C で実装されました。これにより速度
が大幅に向上しました。 (Contributed by Matt Joiner, Alexey Kachayev, and
Serhiy Storchaka in bpo-14373(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14373


File: python.info,  Node: glob<3>,  Next: gzip<4>,  Prev: functools<5>,  Up: 改良されたモジュール<9>

1.10.5.23 glob
..............

*note iglob(): a08. 関数と *note glob(): 5a0. 関数は、 ‘"**"’ パターンを
使ったサブディレクトリの再帰的な検索をサポートしました。(Contributed by
Serhiy Storchaka in bpo-13968(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13968


File: python.info,  Node: gzip<4>,  Next: heapq<2>,  Prev: glob<3>,  Up: 改良されたモジュール<9>

1.10.5.24 gzip
..............

*note GzipFile: 65c. コンストラクタの 'mode' 引数が排他的作成を要求する
‘"x"’ を受け取るようになりました。 (Contributed by Tim Heaney in
bpo-19222(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19222


File: python.info,  Node: heapq<2>,  Next: http<3>,  Prev: gzip<4>,  Up: 改良されたモジュール<9>

1.10.5.25 heapq
...............

Element comparison in *note merge(): 1005. can now be customized by
passing a *note key function: 1006. in a new optional 'key' keyword
argument, and a new optional 'reverse' keyword argument can be used to
reverse element comparison:

     >>> import heapq
     >>> a = ['9', '777', '55555']
     >>> b = ['88', '6666']
     >>> list(heapq.merge(a, b, key=len))
     ['9', '88', '777', '6666', '55555']
     >>> list(heapq.merge(reversed(a), reversed(b), key=len, reverse=True))
     ['55555', '6666', '777', '88', '9']

(Contributed by Raymond Hettinger in bpo-13742(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13742


File: python.info,  Node: http<3>,  Next: http client<3>,  Prev: heapq<2>,  Up: 改良されたモジュール<9>

1.10.5.26 http
..............

新しい *note HTTPStatus: afc. のenum は、HTTPステータスコードのセットで
、その理由句と詳細な説明は、英語で記載されています。(Contributed by
Demian Brecht in bpo-21793(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21793


File: python.info,  Node: http client<3>,  Next: idlelib と IDLE<3>,  Prev: http<3>,  Up: 改良されたモジュール<9>

1.10.5.27 http.client
.....................

*note HTTPConnection.getresponse(): 1009. now raises a *note
RemoteDisconnected: 100a. exception when a remote server connection is
closed unexpectedly.  Additionally, if a *note ConnectionError: 100b.
(of which ‘RemoteDisconnected’ is a subclass) is raised, the client
socket is now closed automatically, and will reconnect on the next
request:

     import http.client
     conn = http.client.HTTPConnection('www.python.org')
     for retries in range(3):
         try:
             conn.request('GET', '/')
             resp = conn.getresponse()
         except http.client.RemoteDisconnected:
             pass

(Contributed by Martin Panter in bpo-3566(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=3566


File: python.info,  Node: idlelib と IDLE<3>,  Next: imaplib<3>,  Prev: http client<3>,  Up: 改良されたモジュール<9>

1.10.5.28 idlelib と IDLE
.........................

idlelib は IDLE シェルとエディタを実装するものであってほかのプログラムか
らインポートされることを意図してはいないので、改善は毎度のリリースごとに
行われます。3.4.0 から始まり、また将来の 3.5.x リリースになされる累積的
な変更リストは ‘Lib/idlelib/NEWS.txt’ で読むことが出来ます。このファイル
は IDLE で Help ‣ About IDLE からも辿り着けます。


File: python.info,  Node: imaplib<3>,  Next: imghdr,  Prev: idlelib と IDLE<3>,  Up: 改良されたモジュール<9>

1.10.5.29 imaplib
.................

*note IMAP4: aff. クラスが *note context manager: 1e1. プロトコルをサポ
ートするようになりました。 *note with: 186. 文とともに使うと、 IMAP4
‘LOGOUT’ コマンドがブロックの終了時に自動的に呼び出されます。
(Contributed by Tarek Ziadé and Serhiy Storchaka in bpo-4972(1).)

The *note imaplib: 78. module now supports RFC 5161(2) (ENABLE
Extension) and RFC 6855(3) (UTF-8 Support) via the *note IMAP4.enable():
100e. method.  A new *note IMAP4.utf8_enabled: 100f. attribute tracks
whether or not RFC 6855(4) support is enabled.  (Contributed by Milan
Oberkirch, R. David Murray, and Maciej Szulik in bpo-21800(5).)

The *note imaplib: 78. module now automatically encodes non-ASCII string
usernames and passwords using UTF-8, as recommended by the RFCs.
(Contributed by Milan Oberkirch in bpo-21800(6).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=4972

   (2) https://datatracker.ietf.org/doc/html/rfc5161.html

   (3) https://datatracker.ietf.org/doc/html/rfc6855.html

   (4) https://datatracker.ietf.org/doc/html/rfc6855.html

   (5) https://bugs.python.org/issue?@action=redirect&bpo=21800

   (6) https://bugs.python.org/issue?@action=redirect&bpo=21800


File: python.info,  Node: imghdr,  Next: importlib<8>,  Prev: imaplib<3>,  Up: 改良されたモジュール<9>

1.10.5.30 imghdr
................

The ‘what()’ function now recognizes the OpenEXR(1) format (contributed
by Martin Vignali and Claudiu Popa in bpo-20295(2)), and the WebP(3)
format (contributed by Fabrice Aneche and Claudiu Popa in bpo-20197(4).)

   ---------- Footnotes ----------

   (1) https://www.openexr.com

   (2) https://bugs.python.org/issue?@action=redirect&bpo=20295

   (3) https://en.wikipedia.org/wiki/WebP

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20197


File: python.info,  Node: importlib<8>,  Next: inspect<8>,  Prev: imghdr,  Up: 改良されたモジュール<9>

1.10.5.31 importlib
...................

The *note util.LazyLoader: eab. class allows for lazy loading of modules
in applications where startup time is important.  (Contributed by Brett
Cannon in bpo-17621(1).)

The *note abc.InspectLoader.source_to_code(): 1012. method is now a
static method.  This makes it easier to initialize a module object with
code compiled from a string by running ‘exec(code, module.__dict__)’.
(Contributed by Brett Cannon in bpo-21156(2).)

The new *note util.module_from_spec(): 1013. function is now the
preferred way to create a new module.  As opposed to creating a *note
types.ModuleType: 1014. instance directly, this new function will set
the various import-controlled attributes based on the passed-in spec
object.  (Contributed by Brett Cannon in bpo-20383(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17621

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21156

   (3) https://bugs.python.org/issue?@action=redirect&bpo=20383


File: python.info,  Node: inspect<8>,  Next: io<7>,  Prev: importlib<8>,  Up: 改良されたモジュール<9>

1.10.5.32 inspect
.................

Both the *note Signature: 4e3. and *note Parameter: 4e4. classes are now
picklable and hashable.  (Contributed by Yury Selivanov in bpo-20726(1)
and bpo-20334(2).)

A new *note BoundArguments.apply_defaults(): 1016. method provides a way
to set default values for missing arguments:

     >>> def foo(a, b='ham', *args): pass
     >>> ba = inspect.signature(foo).bind('spam')
     >>> ba.apply_defaults()
     >>> ba.arguments
     OrderedDict([('a', 'spam'), ('b', 'ham'), ('args', ())])

(Contributed by Yury Selivanov in bpo-24190(3).)

A new class method *note Signature.from_callable(): 942. makes
subclassing of *note Signature: 4e3. easier.  (Contributed by Yury
Selivanov and Eric Snow in bpo-17373(4).)

The *note signature(): 22f. function now accepts a 'follow_wrapped'
optional keyword argument, which, when set to ‘False’, disables
automatic following of ‘__wrapped__’ links.  (Contributed by Yury
Selivanov in bpo-20691(5).)

A set of new functions to inspect *note coroutine functions: f73. and
*note coroutine objects: 6b9. has been added: *note iscoroutine(): 1017,
*note iscoroutinefunction(): 30d, *note isawaitable(): 1018, *note
getcoroutinelocals(): 1019, and *note getcoroutinestate(): 101a.
(Contributed by Yury Selivanov in bpo-24017(6) and bpo-24400(7).)

The *note stack(): 862, *note trace(): 863, *note getouterframes(): 860,
and *note getinnerframes(): 861. functions now return a list of named
tuples.  (Contributed by Daniel Shahaf in bpo-16808(8).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20726

   (2) https://bugs.python.org/issue?@action=redirect&bpo=20334

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24190

   (4) https://bugs.python.org/issue?@action=redirect&bpo=17373

   (5) https://bugs.python.org/issue?@action=redirect&bpo=20691

   (6) https://bugs.python.org/issue?@action=redirect&bpo=24017

   (7) https://bugs.python.org/issue?@action=redirect&bpo=24400

   (8) https://bugs.python.org/issue?@action=redirect&bpo=16808


File: python.info,  Node: io<7>,  Next: ipaddress<4>,  Prev: inspect<8>,  Up: 改良されたモジュール<9>

1.10.5.33 io
............

A new *note BufferedIOBase.readinto1(): 101c. method, that uses at most
one call to the underlying raw stream's *note RawIOBase.read(): 101d. or
*note RawIOBase.readinto(): 101e. methods.  (Contributed by Nikolaus
Rath in bpo-20578(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20578


File: python.info,  Node: ipaddress<4>,  Next: json<3>,  Prev: io<7>,  Up: 改良されたモジュール<9>

1.10.5.34 ipaddress
...................

Both the *note IPv4Network: 50e. and *note IPv6Network: 50f. classes now
accept an ‘(address, netmask)’ tuple argument, so as to easily construct
network objects from existing addresses:

     >>> import ipaddress
     >>> ipaddress.IPv4Network(('127.0.0.0', 8))
     IPv4Network('127.0.0.0/8')
     >>> ipaddress.IPv4Network(('127.0.0.0', '255.0.0.0'))
     IPv4Network('127.0.0.0/8')

(Contributed by Peter Moody and Antoine Pitrou in bpo-16531(1).)

A new *note reverse_pointer: 1020. attribute for the *note IPv4Address:
50c. and *note IPv6Address: 50d. classes returns the name of the reverse
DNS PTR record:

     >>> import ipaddress
     >>> addr = ipaddress.IPv4Address('127.0.0.1')
     >>> addr.reverse_pointer
     '1.0.0.127.in-addr.arpa'
     >>> addr6 = ipaddress.IPv6Address('::1')
     >>> addr6.reverse_pointer
     '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa'

(Contributed by Leon Weber in bpo-20480(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16531

   (2) https://bugs.python.org/issue?@action=redirect&bpo=20480


File: python.info,  Node: json<3>,  Next: linecache<3>,  Prev: ipaddress<4>,  Up: 改良されたモジュール<9>

1.10.5.35 json
..............

The *note json.tool: 87. command line interface now preserves the order
of keys in JSON objects passed in input.  The new ‘--sort-keys’ option
can be used to sort the keys alphabetically.  (Contributed by Berker
Peksag in bpo-21650(1).)

JSON decoder now raises *note JSONDecodeError: 1022. instead of *note
ValueError: 2ec. to provide better context information about the error.
(Contributed by Serhiy Storchaka in bpo-19361(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21650

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19361


File: python.info,  Node: linecache<3>,  Next: locale<6>,  Prev: json<3>,  Up: 改良されたモジュール<9>

1.10.5.36 linecache
...................

A new *note lazycache(): 1024. function can be used to capture
information about a non-file-based module to permit getting its lines
later via *note getline(): 240.  This avoids doing I/O until a line is
actually needed, without having to carry the module globals around
indefinitely.  (Contributed by Robert Collins in bpo-17911(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17911


File: python.info,  Node: locale<6>,  Next: logging<5>,  Prev: linecache<3>,  Up: 改良されたモジュール<9>

1.10.5.37 locale
................

A new *note delocalize(): 1026. function can be used to convert a string
into a normalized number string, taking the ‘LC_NUMERIC’ settings into
account:

     >>> import locale
     >>> locale.setlocale(locale.LC_NUMERIC, 'de_DE.UTF-8')
     'de_DE.UTF-8'
     >>> locale.delocalize('1.234,56')
     '1234.56'
     >>> locale.setlocale(locale.LC_NUMERIC, 'en_US.UTF-8')
     'en_US.UTF-8'
     >>> locale.delocalize('1,234.56')
     '1234.56'

(Contributed by Cédric Krier in bpo-13918(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13918


File: python.info,  Node: logging<5>,  Next: lzma,  Prev: locale<6>,  Up: 改良されたモジュール<9>

1.10.5.38 logging
.................

All logging methods (*note Logger: d46. *note log(): 1028, *note
exception(): 1029, *note critical(): 102a, *note debug(): 102b, etc.),
now accept exception instances as an 'exc_info' argument, in addition to
boolean values and exception tuples:

     >>> import logging
     >>> try:
     ...     1/0
     ... except ZeroDivisionError as ex:
     ...     logging.error('exception', exc_info=ex)
     ERROR:root:exception

(Contributed by Yury Selivanov in bpo-20537(1).)

The *note handlers.HTTPHandler: 102c. class now accepts an optional
*note ssl.SSLContext: 357. instance to configure SSL settings used in an
HTTP connection.  (Contributed by Alex Gaynor in bpo-22788(2).)

The *note handlers.QueueListener: 242. class now takes a
'respect_handler_level' keyword argument which, if set to ‘True’, will
pass messages to handlers taking handler levels into account.
(Contributed by Vinay Sajip.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20537

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22788


File: python.info,  Node: lzma,  Next: math<9>,  Prev: logging<5>,  Up: 改良されたモジュール<9>

1.10.5.39 lzma
..............

The *note LZMADecompressor.decompress(): 102e. method now accepts an
optional 'max_length' argument to limit the maximum size of decompressed
data.  (Contributed by Martin Panter in bpo-15955(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15955


File: python.info,  Node: math<9>,  Next: multiprocessing<7>,  Prev: lzma,  Up: 改良されたモジュール<9>

1.10.5.40 math
..............

*note math: 92. モジュールに定数 *note inf: e7e. および *note nan: 873.
が追加されました。 (Contributed by Mark Dickinson in bpo-23185(1).)

新たな関数 *note isclose(): fb0. は近似的に等しいことを調べる方法を提供
します。 (Contributed by Chris Barker and Tal Einat in bpo-24270(2).)

A new *note gcd(): b0c. function has been added.  The ‘fractions.gcd()’
function is now deprecated.  (Contributed by Mark Dickinson and Serhiy
Storchaka in bpo-22486(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23185

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24270

   (3) https://bugs.python.org/issue?@action=redirect&bpo=22486


File: python.info,  Node: multiprocessing<7>,  Next: operator<3>,  Prev: math<9>,  Up: 改良されたモジュール<9>

1.10.5.41 multiprocessing
.........................

*note sharedctypes.synchronized(): 1031. オブジェクトが *note
コンテキストマネージャ: 1e1. プロトコルをサポートするようになりました。
(Contributed by Charles-François Natali in bpo-21565(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21565


File: python.info,  Node: operator<3>,  Next: os<11>,  Prev: multiprocessing<7>,  Up: 改良されたモジュール<9>

1.10.5.42 operator
..................

*note attrgetter(): 1033, *note itemgetter(): c57, and *note
methodcaller(): 1034. objects now support pickling.  (Contributed by
Josh Rosenberg and Serhiy Storchaka in bpo-22955(1).)

行列乗算を行う *note matmul(): 1035. 関数と *note imatmul(): 1036. 関数
が新しく追加されました。 (Contributed by Benjamin Peterson in
bpo-21176(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22955

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21176


File: python.info,  Node: os<11>,  Next: pathlib<13>,  Prev: operator<3>,  Up: 改良されたモジュール<9>

1.10.5.43 os
............

The new *note scandir(): c54. function returning an iterator of *note
DirEntry: 6c3. objects has been added.  If possible, *note scandir():
c54. extracts file attributes while scanning a directory, removing the
need to perform subsequent system calls to determine file type or
attributes, which may significantly improve performance.  (Contributed
by Ben Hoyt with the help of Victor Stinner in bpo-22524(1).)

Windows において、新たに *note stat_result.st_file_attributes: 1038. 属
性が利用可能です。これは Windows API の ‘GetFileInformationByHandle()’ か
ら返る ‘BY_HANDLE_FILE_INFORMATION’ 構造体のメンバ ‘dwFileAttributes’ に
対応します。 (Contributed by Ben Hoyt in bpo-21719(2).)

*note urandom(): 746. 関数が、Linux 3.17 以降ではシステムコール
‘getrandom()’ を、OpenBSD 5.6 以降ではシステムコール ‘getentropy()’ を使
うようになりました。これは ‘/dev/urandom’ を使う必要性をなくし、潜在的に
は起こり得たファイル記述子を使い果たすことによる失敗を避けることに繋がり
ます。 (Contributed by Victor Stinner in bpo-22181(3).)

New *note get_blocking(): 1039. and *note set_blocking(): 103a.
functions allow getting and setting a file descriptor's blocking mode
(*note O_NONBLOCK: 103b.)  (Contributed by Victor Stinner in
bpo-22054(4).)

*note truncate(): 103c. と *note ftruncate(): f8f. が Windows でサポート
されるようになりました。 (Contributed by Steve Dower in bpo-23668(5).)

There is a new *note os.path.commonpath(): 103d. function returning the
longest common sub-path of each passed pathname.  Unlike the *note
os.path.commonprefix(): 103e. function, it always returns a valid path:

     >>> os.path.commonprefix(['/usr/lib', '/usr/local/lib'])
     '/usr/l'

     >>> os.path.commonpath(['/usr/lib', '/usr/local/lib'])
     '/usr'

(Contributed by Rafik Draoui and Serhiy Storchaka in bpo-10395(6).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22524

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21719

   (3) https://bugs.python.org/issue?@action=redirect&bpo=22181

   (4) https://bugs.python.org/issue?@action=redirect&bpo=22054

   (5) https://bugs.python.org/issue?@action=redirect&bpo=23668

   (6) https://bugs.python.org/issue?@action=redirect&bpo=10395


File: python.info,  Node: pathlib<13>,  Next: pickle<4>,  Prev: os<11>,  Up: 改良されたモジュール<9>

1.10.5.44 pathlib
.................

The new *note Path.samefile(): 1040. method can be used to check whether
the path points to the same file as another path, which can be either
another *note Path: 266. object, or a string:

     >>> import pathlib
     >>> p1 = pathlib.Path('/etc/hosts')
     >>> p2 = pathlib.Path('/etc/../etc/hosts')
     >>> p1.samefile(p2)
     True

(Contributed by Vajrasky Kok and Antoine Pitrou in bpo-19775(1).)

The *note Path.mkdir(): 1041. method now accepts a new optional
'exist_ok' argument to match ‘mkdir -p’ and *note os.makedirs(): 52c.
functionality.  (Contributed by Berker Peksag in bpo-21539(2).)

There is a new *note Path.expanduser(): 1042. method to expand ‘~’ and
‘~user’ prefixes.  (Contributed by Serhiy Storchaka and Claudiu Popa in
bpo-19776(3).)

A new *note Path.home(): 1043. class method can be used to get a *note
Path: 266. instance representing the user’s home directory.
(Contributed by Victor Salgado and Mayank Tripathi in bpo-19777(4).)

New *note Path.write_text(): 1044, *note Path.read_text(): 1045, *note
Path.write_bytes(): 1046, *note Path.read_bytes(): 2df. methods to
simplify read/write operations on files.

The following code snippet will create or rewrite existing file
‘~/spam42’:

     >>> import pathlib
     >>> p = pathlib.Path('~/spam42')
     >>> p.expanduser().write_text('ham')
     3

(Contributed by Christopher Welborn in bpo-20218(5).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19775

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21539

   (3) https://bugs.python.org/issue?@action=redirect&bpo=19776

   (4) https://bugs.python.org/issue?@action=redirect&bpo=19777

   (5) https://bugs.python.org/issue?@action=redirect&bpo=20218


File: python.info,  Node: pickle<4>,  Next: poplib<2>,  Prev: pathlib<13>,  Up: 改良されたモジュール<9>

1.10.5.45 pickle
................

Nested objects, such as unbound methods or nested classes, can now be
pickled using *note pickle protocols: 27b. older than protocol version
4.  Protocol version 4 already supports these cases.  (Contributed by
Serhiy Storchaka in bpo-23611(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23611


File: python.info,  Node: poplib<2>,  Next: re<8>,  Prev: pickle<4>,  Up: 改良されたモジュール<9>

1.10.5.46 poplib
................

A new *note POP3.utf8(): 1049. command enables RFC 6856(1)
(Internationalized Email) support, if a POP server supports it.
(Contributed by Milan OberKirch in bpo-21804(2).)

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc6856.html

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21804


File: python.info,  Node: re<8>,  Next: readline<2>,  Prev: poplib<2>,  Up: 改良されたモジュール<9>

1.10.5.47 re
............

References and conditional references to groups with fixed length are
now allowed in lookbehind assertions:

     >>> import re
     >>> pat = re.compile(r'(a|b).(?<=\1)c')
     >>> pat.match('aac')
     <_sre.SRE_Match object; span=(0, 3), match='aac'>
     >>> pat.match('bbc')
     <_sre.SRE_Match object; span=(0, 3), match='bbc'>

(Contributed by Serhiy Storchaka in bpo-9179(1).)

The number of capturing groups in regular expressions is no longer
limited to 100.  (Contributed by Serhiy Storchaka in bpo-22437(2).)

The *note sub(): 5a3. and *note subn(): 5a4. functions now replace
unmatched groups with empty strings instead of raising an exception.
(Contributed by Serhiy Storchaka in bpo-1519638(3).)

The *note re.error: 546. exceptions have new attributes, *note msg:
104b, *note pattern: 104c, *note pos: 104d, *note lineno: 104e, and
*note colno: 104f, that provide better context information about the
error:

     >>> re.compile("""
     ...     (?x)
     ...     .++
     ... """)
     Traceback (most recent call last):
        ...
     sre_constants.error: multiple repeat at position 16 (line 3, column 7)

(Contributed by Serhiy Storchaka in bpo-22578(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9179

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22437

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1519638

   (4) https://bugs.python.org/issue?@action=redirect&bpo=22578


File: python.info,  Node: readline<2>,  Next: selectors,  Prev: re<8>,  Up: 改良されたモジュール<9>

1.10.5.48 readline
..................

A new *note append_history_file(): 1051. function can be used to append
the specified number of trailing elements in history to the given file.
(Contributed by Bruno Cauet in bpo-22940(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22940


File: python.info,  Node: selectors,  Next: shutil<5>,  Prev: readline<2>,  Up: 改良されたモジュール<9>

1.10.5.49 selectors
...................

The new *note DevpollSelector: dd2. supports efficient ‘/dev/poll’
polling on Solaris.  (Contributed by Giampaolo Rodola' in bpo-18931(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18931


File: python.info,  Node: shutil<5>,  Next: signal<3>,  Prev: selectors,  Up: 改良されたモジュール<9>

1.10.5.50 shutil
................

The *note move(): c51. function now accepts a 'copy_function' argument,
allowing, for example, the *note copy(): c4f. function to be used
instead of the default *note copy2(): c50. if there is a need to ignore
file metadata when moving.  (Contributed by Claudiu Popa in
bpo-19840(1).)

The *note make_archive(): 6da. function now supports the 'xztar' format.
(Contributed by Serhiy Storchaka in bpo-5411(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19840

   (2) https://bugs.python.org/issue?@action=redirect&bpo=5411


File: python.info,  Node: signal<3>,  Next: smtpd<2>,  Prev: shutil<5>,  Up: 改良されたモジュール<9>

1.10.5.51 signal
................

Windows において、 *note set_wakeup_fd(): d67. 関数がソケットハンドルも
サポートするようになりました。 (Contributed by Victor Stinner in
bpo-22018(1).)

Various ‘SIG*’ constants in the *note signal: cb. module have been
converted into *note Enums: 5a.  This allows meaningful names to be
printed during debugging, instead of integer "magic numbers".
(Contributed by Giampaolo Rodola' in bpo-21076(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22018

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21076


File: python.info,  Node: smtpd<2>,  Next: smtplib<2>,  Prev: signal<3>,  Up: 改良されたモジュール<9>

1.10.5.52 smtpd
...............

Both the ‘SMTPServer’ and ‘SMTPChannel’ classes now accept a
'decode_data' keyword argument to determine if the ‘DATA’ portion of the
SMTP transaction is decoded using the ‘"utf-8"’ codec or is instead
provided to the ‘SMTPServer.process_message()’ method as a byte string.
The default is ‘True’ for backward compatibility reasons, but will
change to ‘False’ in Python 3.6.  If 'decode_data' is set to ‘False’,
the ‘process_message’ method must be prepared to accept keyword
arguments.  (Contributed by Maciej Szulik in bpo-19662(1).)

The ‘SMTPServer’ class now advertises the ‘8BITMIME’ extension ( RFC
6152(2)) if 'decode_data' has been set ‘True’.  If the client specifies
‘BODY=8BITMIME’ on the ‘MAIL’ command, it is passed to
‘SMTPServer.process_message()’ via the 'mail_options' keyword.
(Contributed by Milan Oberkirch and R. David Murray in bpo-21795(3).)

The ‘SMTPServer’ class now also supports the ‘SMTPUTF8’ extension ( RFC
6531(4): Internationalized Email).  If the client specified ‘SMTPUTF8
BODY=8BITMIME’ on the ‘MAIL’ command, they are passed to
‘SMTPServer.process_message()’ via the 'mail_options' keyword.  It is
the responsibility of the ‘process_message’ method to correctly handle
the ‘SMTPUTF8’ data.  (Contributed by Milan Oberkirch in bpo-21725(5).)

It is now possible to provide, directly or via name resolution, IPv6
addresses in the ‘SMTPServer’ constructor, and have it successfully
connect.  (Contributed by Milan Oberkirch in bpo-14758(6).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19662

   (2) https://datatracker.ietf.org/doc/html/rfc6152.html

   (3) https://bugs.python.org/issue?@action=redirect&bpo=21795

   (4) https://datatracker.ietf.org/doc/html/rfc6531.html

   (5) https://bugs.python.org/issue?@action=redirect&bpo=21725

   (6) https://bugs.python.org/issue?@action=redirect&bpo=14758


File: python.info,  Node: smtplib<2>,  Next: sndhdr,  Prev: smtpd<2>,  Up: 改良されたモジュール<9>

1.10.5.53 smtplib
.................

A new *note SMTP.auth(): 1057. method provides a convenient way to
implement custom authentication mechanisms.  (Contributed by Milan
Oberkirch in bpo-15014(1).)

The *note SMTP.set_debuglevel(): 1058. method now accepts an additional
debuglevel (2), which enables timestamps in debug messages.
(Contributed by Gavin Chappell and Maciej Szulik in bpo-16914(2).)

Both the *note SMTP.sendmail(): 1059. and *note SMTP.send_message():
105a. methods now support RFC 6531(3) (SMTPUTF8).  (Contributed by Milan
Oberkirch and R. David Murray in bpo-22027(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15014

   (2) https://bugs.python.org/issue?@action=redirect&bpo=16914

   (3) https://datatracker.ietf.org/doc/html/rfc6531.html

   (4) https://bugs.python.org/issue?@action=redirect&bpo=22027


File: python.info,  Node: sndhdr,  Next: socket<9>,  Prev: smtplib<2>,  Up: 改良されたモジュール<9>

1.10.5.54 sndhdr
................

The ‘what()’ and ‘whathdr()’ functions now return a *note namedtuple():
4e0.  (Contributed by Claudiu Popa in bpo-18615(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18615


File: python.info,  Node: socket<9>,  Next: ssl<10>,  Prev: sndhdr,  Up: 改良されたモジュール<9>

1.10.5.55 socket
................

Functions with timeouts now use a monotonic clock, instead of a system
clock.  (Contributed by Victor Stinner in bpo-22043(1).)

A new *note socket.sendfile(): 105d. method allows sending a file over a
socket by using the high-performance *note os.sendfile(): d05. function
on UNIX, resulting in uploads being from 2 to 3 times faster than when
using plain *note socket.send(): fa7.  (Contributed by Giampaolo Rodola'
in bpo-17552(2).)

The *note socket.sendall(): fa8. method no longer resets the socket
timeout every time bytes are received or sent.  The socket timeout is
now the maximum total duration to send all data.  (Contributed by Victor
Stinner in bpo-23853(3).)

The 'backlog' argument of the *note socket.listen(): 105e. method is now
optional.  By default it is set to *note SOMAXCONN: 105f. or to ‘128’,
whichever is less.  (Contributed by Charles-François Natali in
bpo-21455(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22043

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17552

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23853

   (4) https://bugs.python.org/issue?@action=redirect&bpo=21455


File: python.info,  Node: ssl<10>,  Next: sqlite3<9>,  Prev: socket<9>,  Up: 改良されたモジュール<9>

1.10.5.56 ssl
.............

* Menu:

* メモリ BIO サポート::
* Application-Layer Protocol Negotiation Support::
* その他の変更::


File: python.info,  Node: メモリ BIO サポート,  Next: Application-Layer Protocol Negotiation Support,  Up: ssl<10>

1.10.5.57 メモリ BIO サポート
.............................

(Contributed by Geert Jansen in bpo-21965(1).)

The new *note SSLObject: d7a. class has been added to provide SSL
protocol support for cases when the network I/O capabilities of *note
SSLSocket: ae7. are not necessary or are suboptimal.  ‘SSLObject’
represents an SSL protocol instance, but does not implement any network
I/O methods, and instead provides a memory buffer interface.  The new
*note MemoryBIO: 1062. class can be used to pass data between Python and
an SSL protocol instance.

The memory BIO SSL support is primarily intended to be used in
frameworks implementing asynchronous I/O for which *note SSLSocket:
ae7.'s readiness model ("select/poll") is inefficient.

A new *note SSLContext.wrap_bio(): d7b. method can be used to create a
new ‘SSLObject’ instance.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21965


File: python.info,  Node: Application-Layer Protocol Negotiation Support,  Next: その他の変更,  Prev: メモリ BIO サポート,  Up: ssl<10>

1.10.5.58 Application-Layer Protocol Negotiation Support
........................................................

(Contributed by Benjamin Peterson in bpo-20188(1).)

Where OpenSSL support is present, the *note ssl: d5. module now
implements the 'Application-Layer Protocol Negotiation' TLS extension as
described in RFC 7301(2).

The new *note SSLContext.set_alpn_protocols(): 1064. can be used to
specify which protocols a socket should advertise during the TLS
handshake.

The new *note SSLSocket.selected_alpn_protocol(): 1065. returns the
protocol that was selected during the TLS handshake.  The *note
HAS_ALPN: 1066. flag indicates whether ALPN support is present.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20188

   (2) https://datatracker.ietf.org/doc/html/rfc7301.html


File: python.info,  Node: その他の変更,  Prev: Application-Layer Protocol Negotiation Support,  Up: ssl<10>

1.10.5.59 その他の変更
......................

There is a new *note SSLSocket.version(): 1068. method to query the
actual protocol version in use.  (Contributed by Antoine Pitrou in
bpo-20421(1).)

The *note SSLSocket: ae7. class now implements a ‘SSLSocket.sendfile()’
method.  (Contributed by Giampaolo Rodola' in bpo-17552(2).)

The ‘SSLSocket.send()’ method now raises either the *note
ssl.SSLWantReadError: 1069. or *note ssl.SSLWantWriteError: 106a.
exception on a non-blocking socket if the operation would block.
Previously, it would return ‘0’.  (Contributed by Nikolaus Rath in
bpo-20951(3).)

The *note cert_time_to_seconds(): 106b. function now interprets the
input time as UTC and not as local time, per RFC 5280(4).  Additionally,
the return value is always an *note int: 19b.  (Contributed by Akira Li
in bpo-19940(5).)

New ‘SSLObject.shared_ciphers()’ and *note SSLSocket.shared_ciphers():
106c. methods return the list of ciphers sent by the client during the
handshake.  (Contributed by Benjamin Peterson in bpo-23186(6).)

The *note SSLSocket.do_handshake(): 106d, *note SSLSocket.read(): 106e,
‘SSLSocket.shutdown()’, and *note SSLSocket.write(): 106f. methods of
the *note SSLSocket: ae7. class no longer reset the socket timeout every
time bytes are received or sent.  The socket timeout is now the maximum
total duration of the method.  (Contributed by Victor Stinner in
bpo-23853(7).)

The ‘match_hostname()’ function now supports matching of IP addresses.
(Contributed by Antoine Pitrou in bpo-23239(8).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20421

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17552

   (3) https://bugs.python.org/issue?@action=redirect&bpo=20951

   (4) https://datatracker.ietf.org/doc/html/rfc5280.html

   (5) https://bugs.python.org/issue?@action=redirect&bpo=19940

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23186

   (7) https://bugs.python.org/issue?@action=redirect&bpo=23853

   (8) https://bugs.python.org/issue?@action=redirect&bpo=23239


File: python.info,  Node: sqlite3<9>,  Next: subprocess<4>,  Prev: ssl<10>,  Up: 改良されたモジュール<9>

1.10.5.60 sqlite3
.................

The *note Row: 1071. class now fully supports the sequence protocol, in
particular *note reversed(): a65. iteration and slice indexing.
(Contributed by Claudiu Popa in bpo-10203(1); by Lucas Sinclair, Jessica
McKellar, and Serhiy Storchaka in bpo-13583(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10203

   (2) https://bugs.python.org/issue?@action=redirect&bpo=13583


File: python.info,  Node: subprocess<4>,  Next: sys<11>,  Prev: sqlite3<9>,  Up: 改良されたモジュール<9>

1.10.5.61 subprocess
....................

新たに *note run(): d7f. 関数が追加されました。 これは指定されたコマンド
を実行し *note CompletedProcess: 1073. オブジェクトを返します。 オブジェ
クトは終了したプロセスを記述します。 新たな API はより一貫的で、古いバー
ジョンとの互換性を必要としない Python コードでサブプロセスを起動するのに
推奨される方法です。 (Contributed by Thomas Kluyver in bpo-23342(1).)

例:

     >>> subprocess.run(["ls", "-l"])  # doesn't capture output
     CompletedProcess(args=['ls', '-l'], returncode=0)

     >>> subprocess.run("exit 1", shell=True, check=True)
     Traceback (most recent call last):
       ...
     subprocess.CalledProcessError: Command 'exit 1' returned non-zero exit status 1

     >>> subprocess.run(["ls", "-l", "/dev/null"], stdout=subprocess.PIPE)
     CompletedProcess(args=['ls', '-l', '/dev/null'], returncode=0,
     stdout=b'crw-rw-rw- 1 root root 1, 3 Jan 23 16:23 /dev/null\n')

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23342


File: python.info,  Node: sys<11>,  Next: sysconfig<3>,  Prev: subprocess<4>,  Up: 改良されたモジュール<9>

1.10.5.62 sys
.............

A new ‘set_coroutine_wrapper()’ function allows setting a global hook
that will be called whenever a *note coroutine object: 6b9. is created
by an *note async def: 7ed. function.  A corresponding
‘get_coroutine_wrapper()’ can be used to obtain a currently set wrapper.
Both functions are *note provisional: 3d1, and are intended for
debugging purposes only.  (Contributed by Yury Selivanov in
bpo-24017(1).)

A new *note is_finalizing(): c80. function can be used to check if the
Python interpreter is *note shutting down: 479.  (Contributed by Antoine
Pitrou in bpo-22696(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24017

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22696


File: python.info,  Node: sysconfig<3>,  Next: tarfile<7>,  Prev: sys<11>,  Up: 改良されたモジュール<9>

1.10.5.63 sysconfig
...................

The name of the user scripts directory on Windows now includes the first
two components of the Python version.  (Contributed by Paul Moore in
bpo-23437(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23437


File: python.info,  Node: tarfile<7>,  Next: threading<7>,  Prev: sysconfig<3>,  Up: 改良されたモジュール<9>

1.10.5.64 tarfile
.................

*note open(): 1077. 関数の 'mode' 引数が排他的作成を要求する ‘"x"’ を受
け取るようになりました。 (Contributed by Berker Peksag in bpo-21717(1).)

The *note TarFile.extractall(): 29b. and *note TarFile.extract(): 29c.
methods now take a keyword argument 'numeric_owner'.  If set to ‘True’,
the extracted files and directories will be owned by the numeric ‘uid’
and ‘gid’ from the tarfile.  If set to ‘False’ (the default, and the
behavior in versions prior to 3.5), they will be owned by the named user
and group in the tarfile.  (Contributed by Michael Vogt and Eric Smith
in bpo-23193(2).)

The *note TarFile.list(): 1078. now accepts an optional 'members'
keyword argument that can be set to a subset of the list returned by
*note TarFile.getmembers(): 1079.  (Contributed by Serhiy Storchaka in
bpo-21549(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21717

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23193

   (3) https://bugs.python.org/issue?@action=redirect&bpo=21549


File: python.info,  Node: threading<7>,  Next: time<7>,  Prev: tarfile<7>,  Up: 改良されたモジュール<9>

1.10.5.65 threading
...................

*note Lock.acquire(): 8a7. と *note RLock.acquire(): 107b. の両メソッド
がタイムアウトの管理に単調時計を使用するようになりました。 (Contributed
by Victor Stinner in bpo-22043(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22043


File: python.info,  Node: time<7>,  Next: timeit<2>,  Prev: threading<7>,  Up: 改良されたモジュール<9>

1.10.5.66 time
..............

*note monotonic(): 55c. 関数が常に利用出来るようになりました。
(Contributed by Victor Stinner in bpo-22043(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22043


File: python.info,  Node: timeit<2>,  Next: tkinter<9>,  Prev: time<7>,  Up: 改良されたモジュール<9>

1.10.5.67 timeit
................

新たなコマンドラインオプション ‘-u’ 又は ‘--unit=U’ を使用してタイマーの
出力の単位を指定できます。 サポートされたオプションは ‘usec’, ‘msec’,
‘sec’ です。 (Contributed by Julian Gindi in bpo-18983(1).)

*note timeit(): 107e. 関数に引数 'globals' が追加されました。 これにより
コードが実行される名前空間を指定します。 (Contributed by Ben Roberts in
bpo-2527(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18983

   (2) https://bugs.python.org/issue?@action=redirect&bpo=2527


File: python.info,  Node: tkinter<9>,  Next: traceback<5>,  Prev: timeit<2>,  Up: 改良されたモジュール<9>

1.10.5.68 tkinter
.................

The ‘tkinter._fix’ module used for setting up the Tcl/Tk environment on
Windows has been replaced by a private function in the ‘_tkinter’ module
which makes no permanent changes to environment variables.  (Contributed
by Zachary Ware in bpo-20035(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20035


File: python.info,  Node: traceback<5>,  Next: types<6>,  Prev: tkinter<9>,  Up: 改良されたモジュール<9>

1.10.5.69 traceback
...................

New *note walk_stack(): 1081. and *note walk_tb(): 1082. functions to
conveniently traverse frame and *note traceback objects: cec.
(Contributed by Robert Collins in bpo-17911(1).)

New lightweight classes: *note TracebackException: 563, *note
StackSummary: 1083, and *note FrameSummary: 1084.  (Contributed by
Robert Collins in bpo-17911(2).)

Both the *note print_tb(): 1085. and *note print_stack(): 1086.
functions now support negative values for the 'limit' argument.
(Contributed by Dmitry Kazakov in bpo-22619(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17911

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17911

   (3) https://bugs.python.org/issue?@action=redirect&bpo=22619


File: python.info,  Node: types<6>,  Next: unicodedata<9>,  Prev: traceback<5>,  Up: 改良されたモジュール<9>

1.10.5.70 types
...............

新たに *note coroutine(): 1088. 関数が追加されました。 *note
ジェネレータ: dd9. と *note ジェネレータ様: fdb. オブジェクトを *note
awaitable: 4c9. に変換します。 (Contributed by Yury Selivanov in
bpo-24017(1).)

新たに型 *note CoroutineType: 1089. が追加されました。 *note async def:
7ed. 関数で作られた *note coroutine: 6b9. オブジェクトに使われます。
(Contributed by Yury Selivanov in bpo-24400(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24017

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24400


File: python.info,  Node: unicodedata<9>,  Next: unittest<9>,  Prev: types<6>,  Up: 改良されたモジュール<9>

1.10.5.71 unicodedata
.....................

The *note unicodedata: 10b. module now uses data from Unicode 8.0.0(1).

   ---------- Footnotes ----------

   (1) https://unicode.org/versions/Unicode8.0.0/


File: python.info,  Node: unittest<9>,  Next: unittest mock<3>,  Prev: unicodedata<9>,  Up: 改良されたモジュール<9>

1.10.5.72 unittest
..................

The *note TestLoader.loadTestsFromModule(): 594. method now accepts a
keyword-only argument 'pattern' which is passed to ‘load_tests’ as the
third argument.  Found packages are now checked for ‘load_tests’
regardless of whether their path matches 'pattern', because it is
impossible for a package name to match the default pattern.
(Contributed by Robert Collins and Barry A. Warsaw in bpo-16662(1).)

Unittest discovery errors now are exposed in the *note
TestLoader.errors: 108c. attribute of the *note TestLoader: 593.
instance.  (Contributed by Robert Collins in bpo-19746(2).)

A new command line option ‘--locals’ to show local variables in
tracebacks.  (Contributed by Robert Collins in bpo-22936(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16662

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19746

   (3) https://bugs.python.org/issue?@action=redirect&bpo=22936


File: python.info,  Node: unittest mock<3>,  Next: urllib<4>,  Prev: unittest<9>,  Up: 改良されたモジュール<9>

1.10.5.73 unittest.mock
.......................

*note Mock: c3f. クラスは、次の改善が行われました。

   * The class constructor has a new 'unsafe' parameter, which causes
     mock objects to raise *note AttributeError: 5f0. on attribute names
     starting with ‘"assert"’.  (Contributed by Kushal Das in
     bpo-21238(1).)

   * A new *note Mock.assert_not_called(): 108e. method to check if the
     mock object was called.  (Contributed by Kushal Das in
     bpo-21262(2).)

The *note MagicMock: 108f. class now supports *note __truediv__(): 1090,
*note __divmod__(): 1091. and *note __matmul__(): f79. operators.
(Contributed by Johannes Baiter in bpo-20968(3), and Håkan Lövdahl in
bpo-23581(4) and bpo-23568(5).)

It is no longer necessary to explicitly pass ‘create=True’ to the *note
patch(): 1092. function when patching builtin names.  (Contributed by
Kushal Das in bpo-17660(6).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21238

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21262

   (3) https://bugs.python.org/issue?@action=redirect&bpo=20968

   (4) https://bugs.python.org/issue?@action=redirect&bpo=23581

   (5) https://bugs.python.org/issue?@action=redirect&bpo=23568

   (6) https://bugs.python.org/issue?@action=redirect&bpo=17660


File: python.info,  Node: urllib<4>,  Next: wsgiref,  Prev: unittest mock<3>,  Up: 改良されたモジュール<9>

1.10.5.74 urllib
................

A new *note request.HTTPPasswordMgrWithPriorAuth: 1094. class allows
HTTP Basic Authentication credentials to be managed so as to eliminate
unnecessary ‘401’ response handling, or to unconditionally send
credentials on the first request in order to communicate with servers
that return a ‘404’ response instead of a ‘401’ if the ‘Authorization’
header is not sent.  (Contributed by Matej Cepl in bpo-19494(1) and
Akshit Khurana in bpo-7159(2).)

A new 'quote_via' argument for the *note parse.urlencode(): 1095.
function provides a way to control the encoding of query parts if
needed.  (Contributed by Samwyse and Arnon Yaari in bpo-13866(3).)

The *note request.urlopen(): 307. function accepts an *note
ssl.SSLContext: 357. object as a 'context' argument, which will be used
for the HTTPS connection.  (Contributed by Alex Gaynor in bpo-22366(4).)

The *note parse.urljoin(): 1096. was updated to use the RFC 3986(5)
semantics for the resolution of relative URLs, rather than RFC 1808(6)
and RFC 2396(7).  (Contributed by Demian Brecht and Senthil Kumaran in
bpo-22118(8).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19494

   (2) https://bugs.python.org/issue?@action=redirect&bpo=7159

   (3) https://bugs.python.org/issue?@action=redirect&bpo=13866

   (4) https://bugs.python.org/issue?@action=redirect&bpo=22366

   (5) https://datatracker.ietf.org/doc/html/rfc3986.html

   (6) https://datatracker.ietf.org/doc/html/rfc1808.html

   (7) https://datatracker.ietf.org/doc/html/rfc2396.html

   (8) https://bugs.python.org/issue?@action=redirect&bpo=22118


File: python.info,  Node: wsgiref,  Next: xmlrpc<2>,  Prev: urllib<4>,  Up: 改良されたモジュール<9>

1.10.5.75 wsgiref
.................

The 'headers' argument of the *note headers.Headers: 1098. class
constructor is now optional.  (Contributed by Pablo Torres Navarrete and
SilentGhost in bpo-5800(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5800


File: python.info,  Node: xmlrpc<2>,  Next: xml sax,  Prev: wsgiref,  Up: 改良されたモジュール<9>

1.10.5.76 xmlrpc
................

*note client.ServerProxy: c4c. クラスが *note コンテキストマネージャ:
1e1. プロトコルをサポートするようになりました。 (Contributed by Claudiu
Popa in bpo-20627(1).)

*note client.ServerProxy: c4c. コンストラクタは任意の *note
ssl.SSLContext: 357. インスタンスを受け取るようになりました。
(Contributed by Alex Gaynor in bpo-22960(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20627

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22960


File: python.info,  Node: xml sax,  Next: zipfile<5>,  Prev: xmlrpc<2>,  Up: 改良されたモジュール<9>

1.10.5.77 xml.sax
.................

SAX パーサは *note xmlreader.InputSource: 109b. オブジェクトの文字ストリ
ームをサポートしました。 (Contributed by Serhiy Storchaka in
bpo-2175(1).)

*note parseString(): 109c. が *note str: 169. インスタンスを受け取るよう
になりました。 (Contributed by Serhiy Storchaka in bpo-10590(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=2175

   (2) https://bugs.python.org/issue?@action=redirect&bpo=10590


File: python.info,  Node: zipfile<5>,  Prev: xml sax,  Up: 改良されたモジュール<9>

1.10.5.78 zipfile
.................

ZIP output can now be written to unseekable streams.  (Contributed by
Serhiy Storchaka in bpo-23252(1).)

*note ZipFile.open(): 65d. メソッドの 'mode' 引数が排他的作成を要求する
‘"x"’ を受け取るようになりました。 (Contributed by Serhiy Storchaka in
bpo-21717(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23252

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21717


File: python.info,  Node: その他のモジュールレベルの変更,  Next: 最適化<10>,  Prev: 改良されたモジュール<9>,  Up: What's New In Python 3 5

1.10.6 その他のモジュールレベルの変更
-------------------------------------

Many functions in the *note mmap: 94, ‘ossaudiodev’, *note socket: d1,
*note ssl: d5, and *note codecs: 1c. modules now accept writable *note
bytes-like objects: 193.  (Contributed by Serhiy Storchaka in
bpo-23001(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23001


File: python.info,  Node: 最適化<10>,  Next: ビルドならびに C API の変更<3>,  Prev: その他のモジュールレベルの変更,  Up: What's New In Python 3 5

1.10.7 最適化
-------------

The *note os.walk(): 6d0. function has been sped up by 3 to 5 times on
POSIX systems, and by 7 to 20 times on Windows.  This was done using the
new *note os.scandir(): c54. function, which exposes file information
from the underlying ‘readdir’ or ‘FindFirstFile’/‘FindNextFile’ system
calls.  (Contributed by Ben Hoyt with help from Victor Stinner in
bpo-23605(1).)

Construction of ‘bytes(int)’ (filled by zero bytes) is faster and uses
less memory for large objects.  ‘calloc()’ is used instead of ‘malloc()’
to allocate memory for these objects.  (Contributed by Victor Stinner in
bpo-21233(2).)

Some operations on *note ipaddress: 84. *note IPv4Network: 50e. and
*note IPv6Network: 50f. have been massively sped up, such as *note
subnets(): 10a0, *note supernet(): 10a1, *note
summarize_address_range(): 10a2, *note collapse_addresses(): 10a3.  The
speed up can range from 3 to 15 times.  (Contributed by Antoine Pitrou,
Michel Albert, and Markus in bpo-21486(3), bpo-21487(4), bpo-20826(5),
bpo-23266(6).)

Pickling of *note ipaddress: 84. objects was optimized to produce
significantly smaller output.  (Contributed by Serhiy Storchaka in
bpo-23133(7).)

*note io.BytesIO: 10a4. の多くの操作が 50% から 100% 速くなりました。
(Contributed by Serhiy Storchaka in bpo-15381(8) and David Wilson in
bpo-22003(9).)

The *note marshal.dumps(): 10a5. function is now faster: 65-85% with
versions 3 and 4, 20-25% with versions 0 to 2 on typical data, and up to
5 times in best cases.  (Contributed by Serhiy Storchaka in
bpo-20416(10) and bpo-23344(11).)

UTF-32 エンコーダが 3 から 7 倍速くなりました。 (Contributed by Serhiy
Storchaka in bpo-15027(12).)

正規表現のパースが最高で 10% 速くなりました。 (Contributed by Serhiy
Storchaka in bpo-19380(13).)

The *note json.dumps(): f41. function was optimized to run with
‘ensure_ascii=False’ as fast as with ‘ensure_ascii=True’.  (Contributed
by Naoki Inada in bpo-23206(14).)

The *note PyObject_IsInstance(): 10a6. and *note PyObject_IsSubclass():
10a7. functions have been sped up in the common case that the second
argument has *note type: f44. as its metaclass.  (Contributed Georg
Brandl by in bpo-22540(15).)

メソッドのキャッシュが少し改良されました。ベンチマークによっては性能が最
高で 5% 向上しました。 (Contributed by Antoine Pitrou in bpo-22847(16).)

*note random: bd. モジュールのオブジェクトのメモリ使用量が 64-bit ビルド
で 50% 減少しました。 (Contributed by Serhiy Storchaka in
bpo-23488(17).)

*note property(): 4b3. ゲッタの呼び出しが最高で 25% 速くなりました。
(Contributed by Joe Jevnik in bpo-23910(18).)

*note fractions.Fraction: 213. のインスタンス化が最高で 30% 速くなりまし
た。 (Contributed by Stefan Behnel in bpo-22464(19).)

String methods *note find(): 10a8, *note rfind(): 10a9, *note split():
10aa, *note partition(): 10ab. and the *note in: 34b. string operator
are now significantly faster for searching 1-character substrings.
(Contributed by Serhiy Storchaka in bpo-23573(20).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23605

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21233

   (3) https://bugs.python.org/issue?@action=redirect&bpo=21486

   (4) https://bugs.python.org/issue?@action=redirect&bpo=21487

   (5) https://bugs.python.org/issue?@action=redirect&bpo=20826

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23266

   (7) https://bugs.python.org/issue?@action=redirect&bpo=23133

   (8) https://bugs.python.org/issue?@action=redirect&bpo=15381

   (9) https://bugs.python.org/issue?@action=redirect&bpo=22003

   (10) https://bugs.python.org/issue?@action=redirect&bpo=20416

   (11) https://bugs.python.org/issue?@action=redirect&bpo=23344

   (12) https://bugs.python.org/issue?@action=redirect&bpo=15027

   (13) https://bugs.python.org/issue?@action=redirect&bpo=19380

   (14) https://bugs.python.org/issue?@action=redirect&bpo=23206

   (15) https://bugs.python.org/issue?@action=redirect&bpo=22540

   (16) https://bugs.python.org/issue?@action=redirect&bpo=22847

   (17) https://bugs.python.org/issue?@action=redirect&bpo=23488

   (18) https://bugs.python.org/issue?@action=redirect&bpo=23910

   (19) https://bugs.python.org/issue?@action=redirect&bpo=22464

   (20) https://bugs.python.org/issue?@action=redirect&bpo=23573


File: python.info,  Node: ビルドならびに C API の変更<3>,  Next: 非推奨<11>,  Prev: 最適化<10>,  Up: What's New In Python 3 5

1.10.8 ビルドならびに C API の変更
----------------------------------

新たな ‘calloc’ 関数が追加されました:

   * *note PyMem_RawCalloc(): 632,

   * *note PyMem_Calloc(): 10ad,

   * *note PyObject_Calloc(): 10ae.

(Contributed by Victor Stinner in bpo-21233(1).)

新たなエンコーディング/デコーディングヘルパ関数:

   * *note Py_DecodeLocale(): dc0. (‘_Py_char2wchar()’ の代わり),

   * *note Py_EncodeLocale(): dc1. (‘_Py_wchar2char()’ の代わり).

(Contributed by Victor Stinner in bpo-18395(2).)

A new *note PyCodec_NameReplaceErrors(): 10af. function to replace the
unicode encode error with ‘\N{...}’ escapes.  (Contributed by Serhiy
Storchaka in bpo-19676(3).)

A new *note PyErr_FormatV(): 10b0. function similar to *note
PyErr_Format(): 10b1, but accepts a ‘va_list’ argument.  (Contributed by
Antoine Pitrou in bpo-18711(4).)

A new *note PyExc_RecursionError: 10b2. exception.  (Contributed by
Georg Brandl in bpo-19235(5).)

New *note PyModule_FromDefAndSpec(): 10b3, *note
PyModule_FromDefAndSpec2(): 10b4, and *note PyModule_ExecDef(): 10b5.
functions introduced by PEP 489(6) - multi-phase extension module
initialization.  (Contributed by Petr Viktorin in bpo-24268(7).)

New *note PyNumber_MatrixMultiply(): 10b6. and *note
PyNumber_InPlaceMatrixMultiply(): 10b7. functions to perform matrix
multiplication.  (Contributed by Benjamin Peterson in bpo-21176(8).  See
also PEP 465(9) for details.)

The *note PyTypeObject.tp_finalize: c9d. slot is now part of the stable
ABI.

Windows builds now require Microsoft Visual C++ 14.0, which is available
as part of Visual Studio 2015(10).

いくつかのプラットフォームにおいて、拡張モジュールのファイル名にプラット
フォームについての情報をタグとして含むようになりました (タグはオプショナ
ルであり、CPython は、タグが含まれていて実行しようとしているプラットフォ
ームとミスマッチな場合にその拡張をロードしようとしない一方で、拡張をそれ
が含まれていなくてもインポートします):

   * Linux では拡張モジュールのファイル名は
     ‘.cpython-<major><minor>m-<architecture>-<os>.pyd’ で終わります:

        * ‘<major>’ は Python バージョンのメジャー番号です。Python 3.5 で
          は ‘3’ です。

        * ‘<minor>’ は Python バージョンのマイナー番号です。Python 3.5 で
          は ‘5’ です。

        * ‘<architecture>’ は拡張モジュールがどのハードウェアアーキテク
          チャ向けに動作するようビルドされたのかを表します。32-bit Intel
          プラットフォーム向けの ‘i386’ か 64-bit Intel (及び AMD) プラ
          ットフォーム向けの ‘x86_64’ がもっとも一般的です。

        * ‘<os>’ は原則として ‘linux-gnu’ ですが、64-bit プラットフォー
          ムにおいて 32-bit ABI で動作するようビルドされた拡張モジュール
          の場合は ‘linux-gnu32’ になります (この場合 ‘<architecture>’ は
          ‘x86_64’ となるでしょう)。

   * Windows では拡張モジュールのファイル名は
     ‘<debug>.cp<major><minor>-<platform>.pyd’ で終わります:

        * ‘<major>’ は Python バージョンのメジャー番号です。Python 3.5 で
          は ‘3’ です。

        * ‘<minor>’ は Python バージョンのマイナー番号です。Python 3.5 で
          は ‘5’ です。

        * ‘<platform>’ は拡張モジュールがどのプラットフォーム向けにビル
          ドされたものなのかを表し、 Win32 用の ‘win32’ , Win64 用の
          ‘win_amd64’ , Windows Itanium 64 用の ‘win_ia64’ , Windows on
          ARM 用の ‘win_arm’ のいずれかです。

        * デバッグモードでビルドされた場合は ‘<debug>’ は ‘_d’ となり、
          それ以外の場合はブランクです。

   * OS X プラットフォームでは拡張モジュールのファイル名は ‘-darwin.so’
     で終わります。

   * 他のすべてのプラットフォームでは、拡張モジュールのファイル名は
     Python 3.4 でのものと同じです。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21233

   (2) https://bugs.python.org/issue?@action=redirect&bpo=18395

   (3) https://bugs.python.org/issue?@action=redirect&bpo=19676

   (4) https://bugs.python.org/issue?@action=redirect&bpo=18711

   (5) https://bugs.python.org/issue?@action=redirect&bpo=19235

   (6) https://peps.python.org/pep-0489/

   (7) https://bugs.python.org/issue?@action=redirect&bpo=24268

   (8) https://bugs.python.org/issue?@action=redirect&bpo=21176

   (9) https://peps.python.org/pep-0465/

   (10) 
https://visualstudio.microsoft.com/en/vs/older-downloads/#visual-studio-2015-and-other-products


File: python.info,  Node: 非推奨<11>,  Next: 削除<11>,  Prev: ビルドならびに C API の変更<3>,  Up: What's New In Python 3 5

1.10.9 非推奨
-------------

* Menu:

* 新たなキーワード: 新たなキーワード<2>.
* 非推奨の Python の挙動: 非推奨の Python の挙動<2>.
* サポートされないオペレーティングシステム::
* 非推奨の Python モジュール、関数、メソッド: 非推奨の Python モジュール、関数、メソッド<3>.


File: python.info,  Node: 新たなキーワード<2>,  Next: 非推奨の Python の挙動<2>,  Up: 非推奨<11>

1.10.9.1 新たなキーワード
.........................

‘async’ および ‘await’ を変数、クラス、関数、ならびにモジュールの名前に
使用することは推奨されません。 それらは Python 3.5 で PEP 492(1) により
導入され、Python 3.7 で正式にキーワードになります。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0492/


File: python.info,  Node: 非推奨の Python の挙動<2>,  Next: サポートされないオペレーティングシステム,  Prev: 新たなキーワード<2>,  Up: 非推奨<11>

1.10.9.2 非推奨の Python の挙動
...............................

ジェネレータ内で *note StopIteration: df5. 例外を送出すると現在は静かな
*note PendingDeprecationWarning: ac5. が発生します。 これは、Python 3.6
では静かでない非推奨の警告となり、Python 3.7 では *note RuntimeError:
244. を起こします。 詳細は *note PEP 479; Change StopIteration handling
inside generators: f1b. を参照してください。


File: python.info,  Node: サポートされないオペレーティングシステム,  Next: 非推奨の Python モジュール、関数、メソッド<3>,  Prev: 非推奨の Python の挙動<2>,  Up: 非推奨<11>

1.10.9.3 サポートされないオペレーティングシステム
.................................................

Windows XP は Microsoft によって既にサポートされていません。このため PEP
11(1) により、CPython 3.5 ではこの OS をもはや公式にはサポートしません。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0011/


File: python.info,  Node: 非推奨の Python モジュール、関数、メソッド<3>,  Prev: サポートされないオペレーティングシステム,  Up: 非推奨<11>

1.10.9.4 非推奨の Python モジュール、関数、メソッド
...................................................

The ‘formatter’ module has now graduated to full deprecation and is
still slated for removal in Python 3.6.

The ‘asyncio.async()’ function is deprecated in favor of *note
ensure_future(): e71.

The ‘smtpd’ module has in the past always decoded the DATA portion of
email messages using the ‘utf-8’ codec.  This can now be controlled by
the new 'decode_data' keyword to ‘SMTPServer’.  The default value is
‘True’, but this default is deprecated.  Specify the 'decode_data'
keyword with an appropriate value to avoid the deprecation warning.

*note http.cookies.Morsel: dfe. オブジェクトの *note key: dfb, *note
value: dfc, *note coded_value: dfd. に対して直接代入することは非推奨です
。 *note set(): dff. メソッドを使うようにしてください。また、 *note
set(): dff. のドキュメントされていなかった 'LegalChars' パラメータは非推
奨となり、無視されます。

*note string.Formatter: 10bd. クラスの *note format(): dfa. メソッドに対
し、キーワード引数 'format_string' としてフォーマット文字列を渡すことは
非推奨となりました。 (Contributed by Serhiy Storchaka in bpo-23671(1).)

The ‘platform.dist()’ and ‘platform.linux_distribution()’ functions are
now deprecated.  Linux distributions use too many different ways of
describing themselves, so the functionality is left to a package.
(Contributed by Vajrasky Kok and Berker Peksag in bpo-1322(2).)

*note inspect.Signature: 4e3. の、以前からドキュメントされていなかったメ
ソッド ‘from_function’ と ‘from_builtin’ は非推奨です。新しい *note
Signature.from_callable(): 942. を代わりに使ってください。 (Contributed
by Yury Selivanov in bpo-24248(3).)

The ‘inspect.getargspec()’ function is deprecated and scheduled to be
removed in Python 3.6.  (See bpo-20438(4) for details.)

The *note inspect: 82. *note getfullargspec(): 941, *note getcallargs():
10be, and ‘formatargspec()’ functions are deprecated in favor of the
*note inspect.signature(): 22f. API. (Contributed by Yury Selivanov in
bpo-20438(5).)

*note getargvalues(): 10bf. and *note formatargvalues(): 10c0. functions
were inadvertently marked as deprecated with the release of Python
3.5.0.

str のパターンとともに *note re.LOCALE: d63. や *note re.ASCII: 83e. フ
ラグを使用することは非推奨となりました。 (Contributed by Serhiy
Storchaka in bpo-22407(6).)

‘'\'’ と ASCII 文字からなる認識出来ない特殊シーケンスが正規表現内と置き
換えパターン内で使われた場合に、非推奨警告を出すようになりました。Python
3.6 では禁止されるようになります。 (Contributed by Serhiy Storchaka in
bpo-23622(7).)

*note unittest.TestLoader.loadTestsFromModule(): 594. メソッドのドキュメ
ントされておらず非公式の 'use_load_tests' デフォルト引数は非推奨となり、
無視されます。 (Contributed by Robert Collins and Barry A. Warsaw in
bpo-16662(8).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23671

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1322

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24248

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20438

   (5) https://bugs.python.org/issue?@action=redirect&bpo=20438

   (6) https://bugs.python.org/issue?@action=redirect&bpo=22407

   (7) https://bugs.python.org/issue?@action=redirect&bpo=23622

   (8) https://bugs.python.org/issue?@action=redirect&bpo=16662


File: python.info,  Node: 削除<11>,  Next: Python 3 5 への移植,  Prev: 非推奨<11>,  Up: What's New In Python 3 5

1.10.10 削除
------------

* Menu:

* API と機能の削除: API と機能の削除<4>.


File: python.info,  Node: API と機能の削除<4>,  Up: 削除<11>

1.10.10.1 API と機能の削除
..........................

時代遅れとなり、以前に既に非推奨となった以下の API と機能が削除されまし
た:

   * email パッケージの ‘__version__’ 属性は削除されました。email パッケ
     ージが標準ライブラリとは別々にリリースされていたのは遥か昔の話であ
     り、ここのところ何回かのリリースにいたっては ‘__version__’ 文字列が
     更新されていませんでした。

   * 3.4 で非推奨となっていた *note ftplib: 62. モジュール内の内部クラス
     ‘Netrc’ が削除されました。 (Contributed by Matt Chaput in
     bpo-6623(1).)

   * ‘.pyo’ ファイルのコンセプトは削除されました。

   * 暫定 *note asyncio: b. モジュールで 3.4.4 で非推奨となった
     JoinableQueue は削除されました。 (Contributed by A. Jesse Jiryu
     Davis in bpo-23464(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=6623

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23464


File: python.info,  Node: Python 3 5 への移植,  Next: Notable changes in Python 3 5 4,  Prev: 削除<11>,  Up: What's New In Python 3 5

1.10.11 Python 3.5 への移植
---------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

* Menu:

* Python の挙動の変更: Python の挙動の変更<3>.
* Python API の変更: Python API の変更<10>.
* C API の変更: C API の変更<14>.


File: python.info,  Node: Python の挙動の変更<3>,  Next: Python API の変更<10>,  Up: Python 3 5 への移植

1.10.11.1 Python の挙動の変更
.............................

   * 以前のバージョンの Python で、誤って以下の構文を許容してしまってい
     ました:

          f(1 for x in [1], *args)
          f(1 for x in [1], **kwargs)

     Python 3.5 は正しく *note SyntaxError: 18e. を投げます。ジェネレー
     タ式は関数への唯一の引数でない場合には、括弧で囲まなければならない
     のです。(--訳注: 一応。3.5 以前も ‘ff(str(i) for i in range(5),
     "5")’ は SyntaxError です。上の例の通り ‘gg(str(i) for i in
     range(5), *["1", "2"])’ や ‘hh(str(i) for i in range(5), **{"k1":
     "1", "k2": "2"})’ が SytaxError ではなかった、という話です。--)


File: python.info,  Node: Python API の変更<10>,  Next: C API の変更<14>,  Prev: Python の挙動の変更<3>,  Up: Python 3 5 への移植

1.10.11.2 Python API の変更
...........................

   * PEP 475(1): Python シグナルハンドラが例外を送出しなければ、システム
     コールがシグナルに中断された場合に、 *note InterruptedError: f88. を
     送出せずにシステムコールを再試行するようになりました。

   * Python 3.5 以前は、 *note time: 1fb. オブジェクトは UTC で深夜を表
     すときに偽とみなされていました。 この挙動は分かりにくく、エラーの元
     となると考えられ、Python 3.5 で削除されました。 全詳細については
     bpo-13936(2) を参照してください。

   * The ‘ssl.SSLSocket.send()’ method now raises either *note
     ssl.SSLWantReadError: 1069. or *note ssl.SSLWantWriteError: 106a.
     on a non-blocking socket if the operation would block.  Previously,
     it would return ‘0’.  (Contributed by Nikolaus Rath in
     bpo-20951(3).)

   * ジェネレータの ‘__name__’ 属性の値として、以前は code オブジェクト
     の名前から取っていましたが、関数名からセットされるようになりました
     。code の方が所望の場合は ‘gen.gi_code.co_name’ から取得してくださ
     い。ジェネレータは新たに ‘__qualname__’ 属性も持つようになりました
     。これはジェネレータの正規名であり、ジェネレータの表現をする際
     (‘repr(gen)’) にこれを用いるようになりました。 (Contributed by
     Victor Stinner in bpo-21205(4).)

   * The deprecated "strict" mode and argument of *note HTMLParser: a77,
     ‘HTMLParser.error()’, and the ‘HTMLParserError’ exception have been
     removed.  (Contributed by Ezio Melotti in bpo-15114(5).)  The
     'convert_charrefs' argument of *note HTMLParser: a77. is now ‘True’
     by default.  (Contributed by Berker Peksag in bpo-21047(6).)

   * API の公式な部分とは言えないものの、移植性への考慮のために (つまり
     テストの修正) に、エラーメッセージの変更に注意を払っておいてくださ
     い。かつて "'sometype' does not support the buffer protocol" の形だ
     ったものが、いまでは "a *note bytes-like object: 193. is required,
     not 'sometype'" の形になっています。 (Contributed by Ezio Melotti
     in bpo-16518(7).)

   * 既に存在していないディレクトリをカレントディレクトリとして指してい
     た場合に、 *note find_spec(): 10c6. は以前は *note
     FileNotFoundError: 264. 例外を送出していましたが、そうではなく
     ‘None’ を返却するようになりました。この際 *note
     sys.path_importer_cache: 7fa. に ‘None’ を 'キャッシュはしません' 。
     これは典型的なケースとは違います(訳注: msg231477(8))。
     (bpo-22834(9))

   * *note http.client: 73. モジュールと *note http.server: 76. モジュー
     ルに散らばっていた HTTP ステータスコードと対応するメッセージを、共
     通の *note HTTPStatus: afc. enum としてまとめ直しました。*note
     http.client: 73. 、 *note http.server: 76. にあったもとの値も後方互
     換性のために残してあります。 (Contributed by Demian Brecht in
     bpo-21793(10).)

   * When an import loader defines *note exec_module(): a6a. it is now
     expected to also define *note create_module(): eac. (raises a *note
     DeprecationWarning: 1a3. now, will be an error in Python 3.6).  If
     the loader inherits from *note importlib.abc.Loader: 10c7. then
     there is nothing to do, else simply define *note create_module():
     eac. to return ‘None’.  (Contributed by Brett Cannon in
     bpo-23014(11).)

   * *note re.split(): 5a2. 関数は常に空のパターンマッチを無視してきまし
     た。ですからパターン ‘"x*"’ はパターン ‘"x+"’ と同じように動作し、
     パターン ‘"\b"’ は決して動作しませんでした。今後は *note
     re.split(): 5a2. はパターンが空文字列に合致しうる場合に警告を出しま
     す。互換性のためには空文字列とはマッチしえないパターンを使ってくだ
     さい(たとえば ‘"x*"’ ではなく ‘"x+"’ を使ってください)。空文字列と
     しかマッチしえないパターン(例えば ‘"\b"’)はエラーとなります。
     (Contributed by Serhiy Storchaka in bpo-22818(12).)

   * *note http.cookies.Morsel: dfe. 辞書風インターフェイスのそれ自身で
     の一貫性を持たせるようにしました: morsel の比較に *note key: dfb. と
     *note value: dfc. を考慮するようにし、 *note copy(): 10c8. は *note
     dict: 183. を返さずに *note Morsel: dfe. インスタンスを返すようにし
     、 *note update(): 10c9. は更新する辞書内のいずれかのキーが不正(訳
     注: RFC 2109(13) として不正なキーのことで、update 以外のインターフ
     ェイスでは変更前も拒絶される)であれば例外を投げるようにしています。
     加えて、ドキュメントされていない *note set(): dff. の 'LegalChars'
     パラメータは非推奨となり、また指定しても無視されます。 (Contributed
     by Demian Brecht in bpo-2211(14).)

   * PEP 488(15) has removed ‘.pyo’ files from Python and introduced the
     optional ‘opt-’ tag in ‘.pyc’ file names.  The *note
     importlib.util.cache_from_source(): 353. has gained an
     'optimization' parameter to help control the ‘opt-’ tag.  Because
     of this, the 'debug_override' parameter of the function is now
     deprecated.  ‘.pyo’ files are also no longer supported as a file
     argument to the Python interpreter and thus serve no purpose when
     distributed on their own (i.e.  sourceless code distribution).  Due
     to the fact that the magic number for bytecode has changed in
     Python 3.5, all old ‘.pyo’ files from previous versions of Python
     are invalid regardless of this PEP.

   * The *note socket: d1. module now exports the *note
     CAN_RAW_FD_FRAMES: 10ca. constant on linux 3.6 and greater.

   * RFC 5280(16) に基づき、 *note ssl.cert_time_to_seconds(): 106b. 関
     数が入力の時刻をローカル時刻ではなく UTC として解釈するようになりま
     した。また、戻り値は常に *note int: 19b. となります。 (Contributed
     by Akira Li in bpo-19940(17).)

   * ‘pygettext.py’ ツールが POT-Creation-Date ヘッダ内のタイムゾーン形
     式として、標準の +NNNN 形式を使うようになりました。

   * The *note smtplib: cf. module now uses *note sys.stderr: b33.
     instead of the previous module-level ‘stderr’ variable for debug
     output.  If your (test) program depends on patching the
     module-level variable to capture the debug output, you will need to
     update it to capture sys.stderr instead.

   * *note str.startswith(): 10cb. と *note str.endswith(): 10cc. メソッ
     ドは空文字列を見つけた場合と完全に範囲外のインデクスが渡された場合
     に ‘True’ を返すことはしなくなりました。 (Contributed by Serhiy
     Storchaka in bpo-24284(18).)

   * *note inspect.getdoc(): bed. 関数が基底クラスから継承したドキュメン
     テーション文字列を返すようになりました。その継承したドキュメンテー
     ション文字列が相応しいのであれば、もはやそれを繰り返して記述する必
     要はありません。継承されたそれを抑制するには、空の文字列を記述しな
     ければなりません(もしくは然るべきドキュメンテーションを埋めれば良い
     です)。この変更は *note pydoc: ba. モジュールと *note help(): ad4.
     関数の出力に影響します。 (Contributed by Serhiy Storchaka in
     bpo-15582(19).)

   * ネストされた *note functools.partial(): 217. 呼び出しは平坦化される
     ようになりました。以前の振る舞いに依存していたのであれば *note
     functools.partial(): 217. オブジェクトに属性を追加するか、または
     *note functools.partial(): 217. をサブクラス化することで出来ます。
     (-訳注: 後半が意味がある内容を言ってるようには思えません。「以前の
     振る舞い」とはおそらく ‘partial’ オブジェクトの ‘func’ 属性が
     functools.partial そのものになることを指していて、「似たことをした
     ければ ‘partial’ オブジェクトに別の属性を付ければりゃいんじゃね?」
     程度の無責任な代替案を言ってるだけのような気がします。そもそも後者
     の「サブクラス化」は出来ないと思いますし。 -) (Contributed by
     Alexander Belopolsky in bpo-7830(20).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=13936

   (3) https://bugs.python.org/issue?@action=redirect&bpo=20951

   (4) https://bugs.python.org/issue?@action=redirect&bpo=21205

   (5) https://bugs.python.org/issue?@action=redirect&bpo=15114

   (6) https://bugs.python.org/issue?@action=redirect&bpo=21047

   (7) https://bugs.python.org/issue?@action=redirect&bpo=16518

   (8) https://bugs.python.org/issue22834#msg231477

   (9) https://bugs.python.org/issue?@action=redirect&bpo=22834

   (10) https://bugs.python.org/issue?@action=redirect&bpo=21793

   (11) https://bugs.python.org/issue?@action=redirect&bpo=23014

   (12) https://bugs.python.org/issue?@action=redirect&bpo=22818

   (13) https://datatracker.ietf.org/doc/html/rfc2109.html

   (14) https://bugs.python.org/issue?@action=redirect&bpo=2211

   (15) https://peps.python.org/pep-0488/

   (16) https://datatracker.ietf.org/doc/html/rfc5280.html

   (17) https://bugs.python.org/issue?@action=redirect&bpo=19940

   (18) https://bugs.python.org/issue?@action=redirect&bpo=24284

   (19) https://bugs.python.org/issue?@action=redirect&bpo=15582

   (20) https://bugs.python.org/issue?@action=redirect&bpo=7830


File: python.info,  Node: C API の変更<14>,  Prev: Python API の変更<10>,  Up: Python 3 5 への移植

1.10.11.3 C API の変更
......................

   * The undocumented ‘format’ member of the (non-public)
     ‘PyMemoryViewObject’ structure has been removed.  All extensions
     relying on the relevant parts in ‘memoryobject.h’ must be rebuilt.

   * The ‘PyMemAllocator’ structure was renamed to *note
     PyMemAllocatorEx: 10ce. and a new ‘calloc’ field was added.

   * Removed non-documented macro ‘PyObject_REPR()’ which leaked
     references.  Use format character ‘%R’ in *note
     PyUnicode_FromFormat(): 62b.-like functions to format the *note
     repr(): 1c1. of the object.  (Contributed by Serhiy Storchaka in
     bpo-22453(1).)

   * Because the lack of the *note __module__: 617. attribute breaks
     pickling and introspection, a deprecation warning is now raised for
     builtin types without the *note __module__: 617. attribute.  This
     will be an *note AttributeError: 5f0. in the future.  (Contributed
     by Serhiy Storchaka in bpo-20204(2).)

   * As part of the PEP 492(3) implementation, the ‘tp_reserved’ slot of
     *note PyTypeObject: c9c. was replaced with a *note tp_as_async:
     10cf. slot.  Refer to *note コルーチンオブジェクト: 10d0. for new
     types, structures and functions.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22453

   (2) https://bugs.python.org/issue?@action=redirect&bpo=20204

   (3) https://peps.python.org/pep-0492/


File: python.info,  Node: Notable changes in Python 3 5 4,  Prev: Python 3 5 への移植,  Up: What's New In Python 3 5

1.10.12 Notable changes in Python 3.5.4
---------------------------------------

* Menu:

* New make regen-all build target: New make regen-all build target<2>.
* Removal of make touch build target: Removal of make touch build target<2>.


File: python.info,  Node: New make regen-all build target<2>,  Next: Removal of make touch build target<2>,  Up: Notable changes in Python 3 5 4

1.10.12.1 New ‘make regen-all’ build target
...........................................

To simplify cross-compilation, and to ensure that CPython can reliably
be compiled without requiring an existing version of Python to already
be available, the autotools-based build system no longer attempts to
implicitly recompile generated files based on file modification times.

Instead, a new ‘make regen-all’ command has been added to force
regeneration of these files when desired (e.g.  after an initial version
of Python has already been built based on the pregenerated versions).

More selective regeneration targets are also defined - see
Makefile.pre.in(1) for details.

(Victor Stinner の貢献による bpo-23404(2))

Added in version 3.5.4.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Makefile.pre.in

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23404


File: python.info,  Node: Removal of make touch build target<2>,  Prev: New make regen-all build target<2>,  Up: Notable changes in Python 3 5 4

1.10.12.2 Removal of ‘make touch’ build target
..............................................

The ‘make touch’ build target previously used to request implicit
regeneration of generated files by updating their modification times has
been removed.

It has been replaced by the new ‘make regen-all’ target.

(Victor Stinner の貢献による bpo-23404(1))

バージョン 3.5.4 で変更.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23404


File: python.info,  Node: What's New In Python 3 4,  Next: What's New In Python 3 3,  Prev: What's New In Python 3 5,  Up: What's New in Python

1.11 What's New In Python 3.4
=============================


著者: R. David Murray <<rdmurray@bitdance.com>> (Editor)

この記事では 3.3 と比較した Python 3.4 の新機能を解説します。 Python 3.4
は2014年3月16日にリリースされました。全詳細については 変更履歴(1) をご覧
ください。

参考
....

PEP 429(2) - Python 3.4 リリーススケジュール

* Menu:

* 概要: 概要 -- リリースハイライト<11>. リリースハイライト
* 新しい機能: 新しい機能<16>.
* 新たなモジュール: 新たなモジュール<10>.
* 改良されたモジュール: 改良されたモジュール<10>.
* CPython の実装の変更::
* 非推奨: 非推奨<12>.
* 削除: 削除<12>.
* Python 3.4 への移植: Python 3 4 への移植.
* 3.4.3 の変更: 3 4 3 の変更.

   ---------- Footnotes ----------

   (1) https://docs.python.jp/3.4/whatsnew/changelog.html

   (2) https://peps.python.org/pep-0429/


File: python.info,  Node: 概要 -- リリースハイライト<11>,  Next: 新しい機能<16>,  Up: What's New In Python 3 4

1.11.1 概要 - リリースハイライト
--------------------------------

新たな文法機能:

   * Python 3.4 に追加された新しい文法機能はありません。

その他の新しい機能:

   * *note pip が常に利用可能であることが保障されるようになりました:
     10d8. ( PEP 453(1))。

   * *note 新しく作成されたファイル記述子が継承不可能 （non-inheritable）
     になりました: 10d9. ( PEP 446(2))。

   * *note 隔離モード (isolated mode): 10da. の為のコマンドラインオプシ
     ョン (bpo-16499(3))。

   * 非テキストエンコーディングでの *note Codec 処理の改良: 10db. (複数
     の issue に関係).

   * インポートシステムのための *note ModuleSpec 型: 10dc. ( PEP
     451(4)).  (インポーターの作者に影響します)

   * *note marshal: 91. フォーマットが *note よりコンパクトで効率的に:
     10dd. なりました (bpo-16475(5))。

新たなライブラリモジュール:

   * *note asyncio: b.: *note 非同期 IO のための新たな暫定 API: 10de. (
     PEP 3156(6))。

   * *note ensurepip: 59.: *note pip インストーラのブートストラップ:
     10df. ( PEP 453(7))。

   * *note enum: 5a.: *note 列挙型のサポート: 10e0. ( PEP 435(8))。

   * *note pathlib: a8.: *note オブジェクト指向のファイルシステムパス:
     10e1. ( PEP 428(9))。

   * *note selectors: c7.: *note 高水準で効率的な I/O の多重化: 10e2.、
     *note select: c6. モジュールプリミティブを基にしています ( PEP
     3156(10) の一部)。

   * *note statistics: d7.: 基礎的な *note 数値的に安定な統計ライブラリ:
     10e3. ( PEP 450(11))。

   * *note tracemalloc: 105.: *note Python のメモリ割り当てのトレース:
     10e4. ( PEP 454(12))。

大幅に改善されたライブラリモジュール:

   * *note functools: 63. の *note シングルディスパッチジェネリック関数:
     10e5. ( PEP 443(13))。

   * *note pickle: ab. の新しい *note プロトコル 4: 10e6. ( PEP
     3154(14)).

   * *note multiprocessing: 98. が *note Unix で os.fork
     の使用を避けるオプションを持つようになりました: 10e7.
     (bpo-8713(15))。

   * *note email: 3f. has a new submodule, *note contentmanager: 41, and
     a new *note Message: 581. subclass (*note EmailMessage: 580.) that
     *note simplify MIME handling: 10e8. (bpo-18891(16)).

   * *note inspect: 82. と *note pydoc: ba. が以前よりも遥かに幅広い種類
     の callable オブジェクトを正しくイントロスペクション出来るようにな
     り、これは Python *note help(): ad4. システムを改善することになりま
     した。

   * *note ipaddress: 84. モジュール API は安定だと宣言されました。

セキュリティの改善:

   * *note 安全で取り替え可能なハッシュアルゴリズム: 10e9. ( PEP
     456(17))。

   * ファイル記述子が子プロセスにリークするのを防ぐために *note
     新しく作成されたファイル記述子が継承不可になりました: 10d9. ( PEP
     446(18))。

   * *note 隔離モード (isolated mode): 10da. のための新たなコマンドライ
     ンオプション (bpo-16499(19))。

   * *note multiprocessing: 98. が *note Unix で os.fork
     の使用を避けるオプション: 10e7. を持つようになりました。 子プロセス
     とのデータ共有を避けるため 'spawn' と 'forkserver' はより安全です。

   * Windows での *note multiprocessing: 98. 子プロセスはもはや、必要な
     ものを除いて親の継承可能なハンドルを継承しません。

   * 新たな関数 *note hashlib.pbkdf2_hmac(): 733. は PKCS#5 パスワードベ
     ースの鍵導出関数２(20) を提供します。

   * *note ssl: d5. での *note TLSv1.1、 TLSv1.2 サポート: 10ea. の追加
     。

   * *note ssl: d5. での *note Windows
     のシステム証明書ストアよりの証明書抽出サポート: 10eb. の追加。

   * *note ssl: d5. での *note サーバサイド SNI (Server Name Indication)
     サポート: 10ec. の追加。

   * *note ssl.SSLContext: 357. クラスに *note 多数の改善: 10ed. がなさ
     れました。

   * All modules in the standard library that support SSL now support
     server certificate verification, including hostname matching
     (‘ssl.match_hostname()’) and CRLs (Certificate Revocation lists,
     see *note ssl.SSLContext.load_verify_locations(): 10ee.).

CPython の実装の改善:

   * *note オブジェクトの安全なファイナライゼーション: 10ef. ( PEP
     442(21))。

   * PEP 442(22) を活用することで、ほとんどのケースで *note
     モジュールのグローバルがファイナライゼーション中に None
     がセットされることはなくなりました: 10ef. (bpo-18214(23))。

   * *note 設定可能なメモリアロケータ: 10f0. ( PEP 445(24))。

   * *note Argument Clinic: 10f1. ( PEP 436(25))。

以降は、たくさんのほかの小さな改善、CPython での最適化、非推奨リスト、潜
在的な移植性問題を含む、ユーザ向けの変更の包括的なリストになっています。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0453/

   (2) https://peps.python.org/pep-0446/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=16499

   (4) https://peps.python.org/pep-0451/

   (5) https://bugs.python.org/issue?@action=redirect&bpo=16475

   (6) https://peps.python.org/pep-3156/

   (7) https://peps.python.org/pep-0453/

   (8) https://peps.python.org/pep-0435/

   (9) https://peps.python.org/pep-0428/

   (10) https://peps.python.org/pep-3156/

   (11) https://peps.python.org/pep-0450/

   (12) https://peps.python.org/pep-0454/

   (13) https://peps.python.org/pep-0443/

   (14) https://peps.python.org/pep-3154/

   (15) https://bugs.python.org/issue?@action=redirect&bpo=8713

   (16) https://bugs.python.org/issue?@action=redirect&bpo=18891

   (17) https://peps.python.org/pep-0456/

   (18) https://peps.python.org/pep-0446/

   (19) https://bugs.python.org/issue?@action=redirect&bpo=16499

   (20) https://en.wikipedia.org/wiki/PBKDF2

   (21) https://peps.python.org/pep-0442/

   (22) https://peps.python.org/pep-0442/

   (23) https://bugs.python.org/issue?@action=redirect&bpo=18214

   (24) https://peps.python.org/pep-0445/

   (25) https://peps.python.org/pep-0436/


File: python.info,  Node: 新しい機能<16>,  Next: 新たなモジュール<10>,  Prev: 概要 -- リリースハイライト<11>,  Up: What's New In Python 3 4

1.11.2 新しい機能
-----------------

* Menu:

* PEP 453; Python インストール時の PIP の明示的なブートストラッピング: PEP 453 Python インストール時の PIP の明示的なブートストラッピング.
* PEP 446; 新規作成されたファイル記述子は継承不可: PEP 446 新規作成されたファイル記述子は継承不可.
* Codec 処理の改良::
* PEP 451; インポートシステムのための ModuleSpec 型: PEP 451 インポートシステムのための ModuleSpec 型.
* その他の言語変更: その他の言語変更<10>.


File: python.info,  Node: PEP 453 Python インストール時の PIP の明示的なブートストラッピング,  Next: PEP 446 新規作成されたファイル記述子は継承不可,  Up: 新しい機能<16>

1.11.2.1 PEP 453: Python インストール時の PIP の明示的なブートストラッピング
............................................................................

* Menu:

* デフォルトでの pip のブートストラッピング::
* ドキュメントの変更::


File: python.info,  Node: デフォルトでの pip のブートストラッピング,  Next: ドキュメントの変更,  Up: PEP 453 Python インストール時の PIP の明示的なブートストラッピング

1.11.2.2 デフォルトでの pip のブートストラッピング
..................................................

新しい *note ensurepip: 59. モジュール( PEP 453(1) で定義されています)は
標準のクロスプラットフォームのメカニズムで、Python インストールと仮想環
境に pip インストーラをブートストラップします。Python 3.4.0 に含まれる
‘pip’ のバージョンは ‘pip’ 1.5.4 で、将来の 3.4.x メンテナンスリリースで
は Python のリリース候補の作成時点で入手出来る最新バージョンの ‘pip’ が
バンドルされる予定です。

デフォルトでは ‘pipX’ , ‘pipX.Y’ コマンドが全てのプラットフォームに、
Python パッケージ ‘pip’ とその依存物とともにインストールされます(X. Y は
インストールされる Python のバージョン)。Windows 実環境と全てのプラット
フォームの仮想環境には、バージョンが名前に付与されない ‘pip’ コマンドも
インストールされます。ほかのプラットフォームでは、システムワイドでバージ
ョンが名前に付与されない ‘pip’ コマンドは、典型的には Python 2 を別途イ
ンストールした際のものを指しています。

‘pyvenv’ コマンドラインユーティリティと *note venv: 117. モジュールは、
仮想環境で ‘pip’ が使えるようにするために *note ensurepip: 59. モジュー
ルを使います。 コマンドラインユーティリティを使う際は ‘pip’ はデフォルト
でインストールされます。 *note venv: 117. モジュールの *note API: 10f5.
を使う際は、 ‘pip’ のインストールは明示的に要求しなければなりません。

CPython の *note source builds on POSIX systems: 10f6. では ‘make
install’, ‘make altinstall’ コマンドはデフォルトで ‘pip’ ブートストラッ
プを行います。この振る舞いは configure のオプションを変更して Makefile を
作ることで変更できます。

Windows と Mac OS X では CPython インストーラはそれ自身と一緒に ‘pip’ を
デフォルトでインストールするようになっています(ユーザはインストールプロ
セスで除外するかもしれませんが)。Windows ユーザは ‘pip’ がコマンドライン
からデフォルトで利用可能なように ‘PATH’ の自動修正するかの選択を求められ
ます。そうしない場合でも Windows のための Python ランチャで ‘py -m pip’
のようにすれば良いです。

As discussed in the PEP(2) platform packagers may choose not to install
these commands by default, as long as, when invoked, they provide clear
and simple directions on how to install them on that platform (usually
using the system package manager).

     注釈: Python 2 と Python 3 の共存インストールでの衝突を避けるために
     、 ‘ensurepip’ を直接呼び出した場合のデフォルトでは、バージョン付け
     された ‘pip3’, ‘pip3.4’ コマンドだけがインストールされます。バージ
     ョン付けのない ‘pip’ コマンドもインストールしたければ、
     ‘--default-pip’ オプションが必要です。 ‘pyvenv’ と Windows インスト
     ーラは修飾のない ‘pip’ コマンドがそれら環境で利用可能となるように保
     障しますし、また、複数の Python がインストールされたシステムで曖昧
     さを避けようと直接コマンドを呼び出す代わりに、 ‘pip’ は ‘-m’ スイッ
     チ経由でいつでも呼び出せます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0453/

   (2) 
https://peps.python.org/pep-0453/#recommendations-for-downstream-distributors


File: python.info,  Node: ドキュメントの変更,  Prev: デフォルトでの pip のブートストラッピング,  Up: PEP 453 Python インストール時の PIP の明示的なブートストラッピング

1.11.2.3 ドキュメントの変更
...........................

この変更の一部は、 *note Python モジュールのインストール: 10f8. と
distributing-index セクションがより手短な始め方として完全にデザインし直
されたことと、FAQ ドキュメントです。ほとんどのパッケージングについてのド
キュメンテーションは Python Packaging User Guide(1) が保守している
Python Packaging Authority に移動されて、独立したプロジェクトのドキュメ
ンテーションになっています。

However, as this migration is currently still incomplete, the legacy
versions of those guides remaining available as *note setuptools による
C および C++ 拡張のビルド: 10f9. and *note setuptools による C および
C++ 拡張のビルド: 10fa.

参考
....

PEP 453(2) - Python インストールの際の明示的なpipのブートストラッピング

     PEP は Donald Stufft と Nick Coghlan によって書かれ、Donald Stufft,
     Nick Coghlan, Martin von Löwis, Ned Deily により実装されました。

   ---------- Footnotes ----------

   (1) https://packaging.python.org

   (2) https://peps.python.org/pep-0453/


File: python.info,  Node: PEP 446 新規作成されたファイル記述子は継承不可,  Next: Codec 処理の改良,  Prev: PEP 453 Python インストール時の PIP の明示的なブートストラッピング,  Up: 新しい機能<16>

1.11.2.4 PEP 446: 新規作成されたファイル記述子は継承不可
........................................................

PEP 446(1) により、新規作成するファイル記述子は *note 継承不可
(non-inheritable): 10fc. となります。一般的にはこれこそがアプリケーショ
ンが望む振る舞いです。新たにプロセスを生成する際に、現在開いているファイ
ルを起こした子プロセスでも開くことは、検出が困難なあらゆるバグや潜在的な
セキュリティ問題を引き起こしかねません。

そうはいっても継承することが望ましい場合もあります。それらのケースをサポ
ートするために、以下の新規関数とメソッドが利用出来ます:

   * *note os.get_inheritable(): 10fd, *note os.set_inheritable(): 10fe.

   * *note os.get_handle_inheritable(): 10ff, *note
     os.set_handle_inheritable(): 1100.

   * *note socket.socket.get_inheritable(): 1101, *note
     socket.socket.set_inheritable(): 1102.

参考
....

PEP 446(2) - 新規作成されたファイル記述子を継承不可にする

     PEP written and implemented by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0446/

   (2) https://peps.python.org/pep-0446/


File: python.info,  Node: Codec 処理の改良,  Next: PEP 451 インポートシステムのための ModuleSpec 型,  Prev: PEP 446 新規作成されたファイル記述子は継承不可,  Up: 新しい機能<16>

1.11.2.5 Codec 処理の改良
.........................

その最初の導入からずっと、 *note codecs: 1c. モジュールとはいつなんどき
も、型に中立で動的なエンコーディング・デコーディングシステムとして働くも
のであったのです。そうなのですがその Python テキストモデルとの密接な結合
、特に組み込み型 *note str: 169, *note bytes: 192, *note bytearray: 344.
にある型に制限があるコンビニエンスメソッドのおかげで、歴史的にその本来の
意図を曖昧にしてきたのでした。

そんな状況を清く正しくするための重要な一歩として、今ではコンビニエンス関
数 *note codecs.encode(): 1104, *note codecs.decode(): 1105. が Python
2.7、3.3、3.4 で適切にドキュメントされました。これら関数は *note codecs:
1c. モジュールに Python 2.4 からずっと存在している (うえに回帰テストスイ
ートでもずっと網羅してきた) のですが、以前はドキュメントされていなかった
わけなので、実行時イントロスペクションでようやく見つけられるというものだ
ったわけです。

*note str: 169, *note bytes: 192, *note bytearray: 344. でのコンビニエン
スメソッドが Python 3 では Unicode テキストエンコーディングに制限され、
Python 2 では ‘basestring’ <-> ‘basestring’ 変換に制限されるのとは違うの
です。 *note codecs: 1c. のコンビニエンス関数は Python 2 と Python 3 の
両方で任意のコーデックをサポートするのです。

Python 3.4 では、インタプリタは標準ライブラリで提供している非テキストエ
ンコーディングについて知っています。そして以下のように適宜、それら汎用目
的のコンビニエンス関数へユーザを誘導します:

     >>> b"abcdef".decode("hex")
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     LookupError: 'hex' is not a text encoding; use codecs.decode() to handle arbitrary codecs

     >>> "hello".encode("rot13")
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     LookupError: 'rot13' is not a text encoding; use codecs.encode() to handle arbitrary codecs

     >>> open("foo.txt", encoding="hex")
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     LookupError: 'hex' is not a text encoding; use codecs.open() to handle arbitrary codecs

関連する変更で、後方互換性を壊すことなくそれが相応しい場合にはいつでも、
エンコーディング・デコーディング操作中に起こる例外は、同じ例外型でありエ
ラーを発生させることになった原因コーデックの名前に言及する連鎖例外内に包
まれます:

     >>> import codecs

     >>> codecs.decode(b"abcdefgh", "hex")
     Traceback (most recent call last):
       File "/usr/lib/python3.4/encodings/hex_codec.py", line 20, in hex_decode
         return (binascii.a2b_hex(input), len(input))
     binascii.Error: Non-hexadecimal digit found

     The above exception was the direct cause of the following exception:

     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     binascii.Error: decoding with 'hex' codec failed (Error: Non-hexadecimal digit found)

     >>> codecs.encode("hello", "bz2")
     Traceback (most recent call last):
       File "/usr/lib/python3.4/encodings/bz2_codec.py", line 17, in bz2_encode
         return (bz2.compress(input), len(input))
       File "/usr/lib/python3.4/bz2.py", line 498, in compress
         return comp.compress(data) + comp.flush()
     TypeError: 'str' does not support the buffer interface

     The above exception was the direct cause of the following exception:

     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: encoding with 'bz2' codec failed (TypeError: 'str' does not support the buffer interface)

そしてついに、ここまで実例で見てきたような的確な誘導による改善が、それ自
体は Python 3.2 で復活していた非 Unicode コーデックへのコンビニエンスの
エイリアスの復活を可能にしました。(--訳注: Python 3.0 で一度非 Unicode エ
ンコーディングは消滅し、3.2 でそれらコーデックそのものは復活したものの、
Lib/encodings/aliases.py(1) のマッピングからは除外されたままだった。--)
つまり、バイナリデータの 16 進表現エンコードとそのデコード (たとえば、で
す) は、今ではこう書けるということです:

     >>> from codecs import encode, decode
     >>> encode(b"hello", "hex")
     b'68656c6c6f'
     >>> decode(b"68656c6c6f", "hex")
     b'hello'

標準ライブラリで提供されるバイナリ変換とテキスト変換は、 *note
バイナリ変換 (Binary Transforms): 1106. と *note テキスト変換 (Text
Transforms): 1107. に詳細記述されました。

(Contributed by Nick Coghlan in bpo-7475(2), bpo-17827(3), bpo-17828(4)
and bpo-19619(5).)

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/encodings/aliases.py

   (2) https://bugs.python.org/issue?@action=redirect&bpo=7475

   (3) https://bugs.python.org/issue?@action=redirect&bpo=17827

   (4) https://bugs.python.org/issue?@action=redirect&bpo=17828

   (5) https://bugs.python.org/issue?@action=redirect&bpo=19619


File: python.info,  Node: PEP 451 インポートシステムのための ModuleSpec 型,  Next: その他の言語変更<10>,  Prev: Codec 処理の改良,  Up: 新しい機能<16>

1.11.2.6 PEP 451: インポートシステムのための ModuleSpec 型
..........................................................

PEP 451(1) は、インポート機構がロードに使うモジュールに関する情報 (つま
りモジュールの仕様) のカプセル化を提供します。これはインポートの実装とイ
ンポート関連 API の両方を単純化するのに役立ちます。この変更は、 いくつか
の将来のインポート関連の改善(2) の足掛かりでもあります。

この PEP による公な側面での変化は完全に後方互換です。さらにそれらは、イ
ンポーターの作者以外にとっては透過的であるはずです。鍵となるファインダと
ローダのメソッドはまだ動作し続けますが非推奨となりました。新しいインポー
タは PEP に記述された新メソッドを使うべきです。既存のインポータは新メソ
ッドを実装するように更新すべきです。置き換えられるべきメソッドとその代わ
りとなるメソッドのリストについては *note 非推奨: 1109. を参照してくださ
い。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0451/

   (2) 
https://mail.python.org/pipermail/python-dev/2013-November/130111.html


File: python.info,  Node: その他の言語変更<10>,  Prev: PEP 451 インポートシステムのための ModuleSpec 型,  Up: 新しい機能<16>

1.11.2.7 その他の言語変更
.........................

Python 言語コアに小さな変更がいくつか行われました:

   * Unicode データベースを UCD バージョン 6.3 にアップグレードしました
     。

   * *note min(): 110b. と *note max(): 110c. にキーワード専用引数
     'default' が追加されました。これにはイテラブルが要素なしであると評
     価される場合に返す値を指定出来ます。 (Contributed by Julian Berman
     in bpo-18111(1).)

   * Module objects are now *note weakly referenceable: 110d.

   * モジュールの ‘__file__’ 属性 (と関連する値) にはデフォルトでは常に
     絶対パスを含むようになりました。ただし、スクリプトがコマンドライン
     から相対パスを使って直接実行された際の ‘__main__.__file__’ は唯一の
     例外です。 (Contributed by Brett Cannon in bpo-18416(2).)

   * UTF-16 デコーダ (妥当なサロゲートペアを受け付ける) と UTF-16 エンコ
     ーダ (非 BMP 文字のエンコードでサロゲートペアを生成) 以外の、(UTF-7
     を除く) 全ての UTF-* コーデックが、エラーハンドラ ‘surrogatepass’ を
     使わない限りはエンコーディングとデコーディングの両方でサロゲートペ
     アを拒絶するようになりました。(Contributed by Victor Stinner,
     Kang-Hao (Kenny) Lu and Serhiy Storchaka in bpo-12892(3).)

   * 新規ドイツ語 EBCDIC *note codec: fb8. ‘cp273’.  (Contributed by
     Michael Bierenfeld and Andrew Kuchling in bpo-1097797(4).)

   * 新規ウクライナ語 *note codec: fb8. ‘cp1125’.  (Contributed by
     Serhiy Storchaka in bpo-19668(5).)

   * *note bytes: 192.join() と *note bytearray: 344.join() が引数として
     任意のバッファオブジェクトを受け取れるようになりました。
     (Contributed by Antoine Pitrou in bpo-15958(6).)

   * *note int: 19b. コンストラクタの 'base' 引数に、 ‘__index__’ メソッ
     ドを持つ任意のオブジェクトを渡せるようになりました。(Contributed by
     Mark Dickinson in bpo-16772(7).)  (--訳注: *note Python API の変更:
     110e. に同じ bpo-16772(8) を発端とする変更が書かれているのでそちら
     も参照して下さい。 --)

   * フレームオブジェクトに、ローカル変数への全ての参照をフレームからク
     リアするメソッド *note clear(): 585. が追加されました。(Contributed
     by Antoine Pitrou in bpo-17934(9).)

   * *note memoryview: 165. が *note Sequence: 1f. として登録され、また
     、組み込み関数 *note reversed(): a65. をサポートするようになりまし
     た。 (Contributed by Nick Coghlan and Claudiu Popa in bpo-18690(10)
     and bpo-19078(11).)

   * Argument Clinic の導入、 *note inspect: 82. と *note pydoc: ba. に
     なされた他の変更の結果、多くの場合で *note help(): ad4. が報告する
     シグニチャが修正・改善されました。

   * *note __length_hint__(): 110f. が、公式な言語仕様の一部になりました
     (see PEP 424(12))。 (Contributed by Armin Ronacher in
     bpo-16148(13).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18111

   (2) https://bugs.python.org/issue?@action=redirect&bpo=18416

   (3) https://bugs.python.org/issue?@action=redirect&bpo=12892

   (4) https://bugs.python.org/issue?@action=redirect&bpo=1097797

   (5) https://bugs.python.org/issue?@action=redirect&bpo=19668

   (6) https://bugs.python.org/issue?@action=redirect&bpo=15958

   (7) https://bugs.python.org/issue?@action=redirect&bpo=16772

   (8) https://bugs.python.org/issue?@action=redirect&bpo=16772

   (9) https://bugs.python.org/issue?@action=redirect&bpo=17934

   (10) https://bugs.python.org/issue?@action=redirect&bpo=18690

   (11) https://bugs.python.org/issue?@action=redirect&bpo=19078

   (12) https://peps.python.org/pep-0424/

   (13) https://bugs.python.org/issue?@action=redirect&bpo=16148


File: python.info,  Node: 新たなモジュール<10>,  Next: 改良されたモジュール<10>,  Prev: 新しい機能<16>,  Up: What's New In Python 3 4

1.11.3 新たなモジュール
-----------------------

* Menu:

* asyncio: asyncio<14>.
* ensurepip: ensurepip<2>.
* enum: enum<9>.
* pathlib: pathlib<14>.
* selectors: selectors<2>.
* statistics: statistics<6>.
* tracemalloc: tracemalloc<4>.


File: python.info,  Node: asyncio<14>,  Next: ensurepip<2>,  Up: 新たなモジュール<10>

1.11.3.1 asyncio
................

*note asyncio: b. モジュールが追加されました ( PEP 3156(1) で定義されて
います)。これは Python のための標準的で抜き挿し可能なイベントループモデ
ルを、標準ライブラリに信頼出来る非同期 I/O サポートを追加することで提供
し、また、ほかのイベントループ実装を標準ライブラリと相互運用することを容
易にします。

Python 3.4 では、このモジュールは *note 暫定 API: 3d1. であるとみなされ
ています。

参考
....

PEP 3156(2) - 非同期 IO サポートの再起動: "asyncio" モジュール

     PEP written and implementation led by Guido van Rossum.  (訳注: PEP
     タイトルの「Asynchronous IO Support Rebooted: the "asyncio" Module」
     は PEP 3153(3) の焼き直しのため。)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3156/

   (2) https://peps.python.org/pep-3156/

   (3) https://peps.python.org/pep-3153/


File: python.info,  Node: ensurepip<2>,  Next: enum<9>,  Prev: asyncio<14>,  Up: 新たなモジュール<10>

1.11.3.2 ensurepip
..................

新規の *note ensurepip: 59. モジュールは PEP 453(1) 実装のための本質的な
基盤です。通常はエンドユーザはこのモジュールを弄ぶ必要はありません。です
が、 ‘pip’ のインストレーションや仮想環境に対する自動ブートストラップを
拒否していた場合には、手動でそれをブートストラップするのに使えます。

*note ensurepip: 59. は ‘pip’ のバンドルされたコピーを含んでいて、これは
CPython リリースの最初のリリース候補時点での最新です (このことはメンテナ
ンスリリース、feature リリースの両方に適用されます)。 ‘ensurepip’ 自身は
インターネットアクセスしません。依存パッケージ解決のためのインターネット
アクセスを要するならばそれは ‘ensurepip’ 実行の後の ‘pip’ で行いますし、
‘pip’ そのもののアップグレードも ‘pip’ 自身で行います。(そのようなアップ
グレード版 ‘pip’ は個別のインストールパッケージとみなされて、Python がア
ンインストールされても削除されないことを付記しておきます。)

このモジュールが「 'ensure (保障する)' 」を名前に冠するのは、 ‘pip’ がイ
ンストール済みならば何もしないからです。このモジュールは ‘--upgrade’ オ
プションを持ちますが、これは既存のインストール版 ‘pip’ がこのモジュール
にバンドルされたコピーよりも古い場合に、バンドルされたコピー版 ‘pip’ を
インストールします。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0453/


File: python.info,  Node: enum<9>,  Next: pathlib<14>,  Prev: ensurepip<2>,  Up: 新たなモジュール<10>

1.11.3.3 enum
.............

*note enum: 5a. モジュール ( PEP 435(1) にて定義) は標準の列挙型実装を提
供します。これにより (*note socket: d1. のような) ほかのモジュールが、不
透明な整数定数を後方互換を保ったまま列挙値に置き換えることによって、より
情報に富むエラーメッセージを提供したり、より良いデバッグサポートを行える
ようになります。

参考
....

PEP 435(2) - Python 標準ライブラリに enum 型を追加

     PEP written by Barry Warsaw, Eli Bendersky and Ethan Furman,
     implemented by Ethan Furman.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0435/

   (2) https://peps.python.org/pep-0435/


File: python.info,  Node: pathlib<14>,  Next: selectors<2>,  Prev: enum<9>,  Up: 新たなモジュール<10>

1.11.3.4 pathlib
................

新規モジュール *note pathlib: a8. は、異なるオペレーティングシステムごと
に適切な意味付けでファイルシステムパスを表現するクラス群を提供しています
。パスのクラス群は '純粋パス' と '具象パス' に分離されています。前者は
I/O を伴わない純粋なパス計算操作を提供するもので、後者は純粋パスを派生し
ますが I/O 操作も提供します。

Python 3.4 では、このモジュールは *note 暫定 API: 3d1. であるとみなされ
ています。

参考
....

PEP 428(1) - pathlib モジュール - オブジェクト指向のファイルシステムパス

     PEP written and implemented by Antoine Pitrou.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0428/


File: python.info,  Node: selectors<2>,  Next: statistics<6>,  Prev: pathlib<14>,  Up: 新たなモジュール<10>

1.11.3.5 selectors
..................

新規モジュール *note selectors: c7. ( PEP 3156(1) の一部として作成されま
した)　は、高水準で効率的な I/O の多重化を行います。これは *note select:
c6. モジュールプリミティブに基いています。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3156/


File: python.info,  Node: statistics<6>,  Next: tracemalloc<4>,  Prev: selectors<2>,  Up: 新たなモジュール<10>

1.11.3.6 statistics
...................

新規モジュール *note statistics: d7. ( PEP 450(1) で定義) は統計を扱う中
核機能のいくつかを標準ライブラリで直接提供します。このモジュールはデータ
系列の平均、中央値、最頻値、分散、標準偏差の計算をサポートします。

参考
....

PEP 450(2) - 標準ライブラリに統計モジュールを追加

     PEP written and implemented by Steven D'Aprano

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0450/

   (2) https://peps.python.org/pep-0450/


File: python.info,  Node: tracemalloc<4>,  Prev: statistics<6>,  Up: 新たなモジュール<10>

1.11.3.7 tracemalloc
....................

新たな *note tracemalloc: 105. モジュール ( PEP 454(1) で定義) は Python
が割り当てたメモリブロックをトレースするためのデバッグツールです。 以下
の情報を提供します:

   * オブジェクトが割り当てられた場所をトレースする

   * ファイル名ごと、及び行ごとに割り当てられたメモリブロックの以下の統
     計を取ります：総サイズ、ブロック数、割り当てられたブロックの平均サ
     イズ

   * メモリリークを検出するために2つのスナップショットの差を計算します。

参考
....

PEP 454(2) - Python メモリ割り当てをトレースするための tracemalloc モジュールの追加

     PEP written and implemented by Victor Stinner

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0454/

   (2) https://peps.python.org/pep-0454/


File: python.info,  Node: 改良されたモジュール<10>,  Next: CPython の実装の変更,  Prev: 新たなモジュール<10>,  Up: What's New In Python 3 4

1.11.4 改良されたモジュール
---------------------------

* Menu:

* abc::
* aifc: aifc<2>.
* argparse: argparse<7>.
* audioop::
* base64: base64<4>.
* collections: collections<6>.
* colorsys::
* contextlib: contextlib<6>.
* dbm: dbm<6>.
* dis: dis<5>.
* doctest: doctest<4>.
* email: email<5>.
* filecmp::
* functools: functools<6>.
* gc: gc<6>.
* glob: glob<4>.
* hashlib: hashlib<6>.
* hmac: hmac<4>.
* html::
* http: http<4>.
* idlelib と IDLE: idlelib と IDLE<4>.
* importlib: importlib<9>.
* inspect: inspect<9>.
* ipaddress: ipaddress<5>.
* logging: logging<6>.
* marshal: marshal<2>.
* mmap: mmap<3>.
* multiprocessing: multiprocessing<8>.
* operator: operator<4>.
* os: os<12>.
* pdb: pdb<8>.
* pickle: pickle<5>.
* plistlib: plistlib<2>.
* poplib: poplib<3>.
* pprint: pprint<4>.
* pty: pty<2>.
* pydoc: pydoc<5>.
* re: re<9>.
* resource::
* select::
* shelve: shelve<2>.
* shutil: shutil<6>.
* smtpd: smtpd<3>.
* smtplib: smtplib<3>.
* socket: socket<10>.
* sqlite3: sqlite3<10>.
* ssl: ssl<11>.
* stat::
* struct: struct<3>.
* subprocess: subprocess<5>.
* sunau: sunau<2>.
* sys: sys<12>.
* tarfile: tarfile<8>.
* textwrap: textwrap<2>.
* threading: threading<8>.
* traceback: traceback<6>.
* types: types<7>.
* urllib: urllib<5>.
* unittest: unittest<10>.
* venv: venv<7>.
* wave: wave<2>.
* weakref: weakref<2>.
* xml.etree: xml etree<2>.
* zipfile: zipfile<6>.


File: python.info,  Node: abc,  Next: aifc<2>,  Up: 改良されたモジュール<10>

1.11.4.1 abc
............

新規関数 *note abc.get_cache_token(): 111a. は、オブジェクトグラフ内での
変化の影響を受けるキャッシュをいつ無効化すれば良いかを知るために使えます
。 (Contributed by Łukasz Langa in bpo-16832(1).)

新規クラス *note ABC: 111b. はそのメタクラスとして *note ABCMeta: 111c.
を持ちます。この ‘ABC’ を基底クラスとして使うことは
‘metaclass=abc.ABCMeta’ を指定するのと本質的に同じ効果を持ちますが、少な
いタイプ数で単純に書ける上に読みやすいものになります。(Contributed by
Bruno Dupuis in bpo-16049(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16832

   (2) https://bugs.python.org/issue?@action=redirect&bpo=16049


File: python.info,  Node: aifc<2>,  Next: argparse<7>,  Prev: abc,  Up: 改良されたモジュール<10>

1.11.4.2 aifc
.............

The ‘getparams()’ method now returns a namedtuple rather than a plain
tuple.  (Contributed by Claudiu Popa in bpo-17818(1).)

‘aifc.open()’ now supports the context management protocol: when used in
a *note with: 186. block, the ‘close()’ method of the returned object
will be called automatically at the end of the block.  (Contributed by
Serhiy Storchacha in bpo-16486(2).)

The ‘writeframesraw()’ and ‘writeframes()’ methods now accept any *note
bytes-like object: 193.  (Contributed by Serhiy Storchaka in
bpo-8311(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17818

   (2) https://bugs.python.org/issue?@action=redirect&bpo=16486

   (3) https://bugs.python.org/issue?@action=redirect&bpo=8311


File: python.info,  Node: argparse<7>,  Next: audioop,  Prev: aifc<2>,  Up: 改良されたモジュール<10>

1.11.4.3 argparse
.................

*note FileType: 30c. クラスが 'encoding' 引数、 'errors' 引数を受け付け
るようになりました。これは *note open(): 316. にそのまま渡されます。
(Contributed by Lucas Maystre in bpo-11175(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11175


File: python.info,  Node: audioop,  Next: base64<4>,  Prev: argparse<7>,  Up: 改良されたモジュール<10>

1.11.4.4 audioop
................

‘audioop’ now supports 24-bit samples.  (Contributed by Serhiy Storchaka
in bpo-12866(1).)

New ‘byteswap()’ function converts big-endian samples to little-endian
and vice versa.  (Contributed by Serhiy Storchaka in bpo-19641(2).)

All ‘audioop’ functions now accept any *note bytes-like object: 193.
Strings are not accepted: they didn't work before, now they raise an
error right away.  (Contributed by Serhiy Storchaka in bpo-16685(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12866

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19641

   (3) https://bugs.python.org/issue?@action=redirect&bpo=16685


File: python.info,  Node: base64<4>,  Next: collections<6>,  Prev: audioop,  Up: 改良されたモジュール<10>

1.11.4.5 base64
...............

*note base64: f. のエンコード・デコード関数が任意の *note bytes-like
object: 193. オブジェクトを受け取れるようになりました。以前は *note
bytes: 192. または *note bytearray: 344. インスタンスである必要がありま
した。 (Contributed by Nick Coghlan in bpo-17839(1).)

新規関数 *note a85encode(): 1121, *note a85decode(): 1122. は ‘Ascii85’
フォーマットの、 *note b85encode(): 1123, *note b85decode(): 1124. は
git/mercurial の ‘Base85’ フォーマットの、バイナリデータのエンコード・バ
イナリデータへのデコードを提供します。 ‘a85’ 関数は、Abobe 方言を含む
‘Ascii85’ エンコーディングの変種と互換性を持たせるためのオプションを持っ
ています。(Contributed by Martin Morrison, the Mercurial project, Serhiy
Storchaka, and Antoine Pitrou in bpo-17618(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17839

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17618


File: python.info,  Node: collections<6>,  Next: colorsys,  Prev: base64<4>,  Up: 改良されたモジュール<10>

1.11.4.6 collections
....................

*note ChainMap.new_child(): 1126. メソッドが、チェーンに追加する子マップ
を指定する 'm' 引数を取るようになりました。これにより、以前は組み込み辞
書が必ず maps の先頭になっていましたが、カスタムマッピング型も使えるよう
になります。(Contributed by Vinay Sajip in bpo-16613(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16613


File: python.info,  Node: colorsys,  Next: contextlib<6>,  Prev: collections<6>,  Up: 改良されたモジュール<10>

1.11.4.7 colorsys
.................

RGB -- YIQ 変換の係数の桁数が FCC NTSC version(1) に合うように広げられま
した。結果としての変化は 1% 未満のはずで、また、ほかの処理系での結果とよ
り合致するでしょう。 (Contributed by Brian Landers and Serhiy Storchaka
in bpo-14323(2).)

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/YIQ#FCC_version_of_NTSC_standard

   (2) https://bugs.python.org/issue?@action=redirect&bpo=14323


File: python.info,  Node: contextlib<6>,  Next: dbm<6>,  Prev: colorsys,  Up: 改良されたモジュール<10>

1.11.4.8 contextlib
...................

新規コンテキストマネージャ *note contextlib.suppress: 1129. によって、意
図して単独ステートメントからの例外を抑制しているというコードの意図をはっ
きりと読み手に伝えることが出来ます。 (Contributed by Raymond Hettinger
in bpo-15806(1) and Zero Piraeus in bpo-19266(2).)

新規コンテキストマネージャ *note contextlib.redirect_stdout(): fe7. は、
ユーティリティスクリプトにて、その出力を *note sys.stdout: ccd. に書き出
す一方でその向き先を変えれない頑固な API の扱いを簡単にしてくれます。こ
れを使うと、 *note sys.stdout: ccd. 出力をなにかほかのストリームに振り替
えたり、あるいは *note io.StringIO: 112a. と組み合わせて文字列化したり出
来ます。後者などは特に便利で、たとえば元々はコマンドラインインターフェイ
スとして実装された関数からの出力を取り込む、などということが出来ます。こ
のコンテキストマネージャはユーティリティスクリプト以外では使わない方が肝
要です。というのもこれは *note sys.stdout: ccd. の大域的な状態に影響を与
えてしまうからです。 (Contributed by Raymond Hettinger in bpo-15805(3).)

*note contextlib: 27. ドキュメントにも改善が行われ、コンテキストマネージ
ャを単独で使うのと再利用したり再入可能(リエントラント)するのとの違いにつ
いての *note 議論: 112b. が追加されました。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15806

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19266

   (3) https://bugs.python.org/issue?@action=redirect&bpo=15805


File: python.info,  Node: dbm<6>,  Next: dis<5>,  Prev: contextlib<6>,  Up: 改良されたモジュール<10>

1.11.4.9 dbm
............

*note dbm.open(): 112d. がコンテキスト管理プロトコルをサポートするように
なりました: *note with: 186. ブロックで使うとデータベースオブジェクトの
‘close’ メソッドがブロックの終了時に自動的に呼び出されます。
(Contributed by Claudiu Popa and Nick Coghlan in bpo-19282(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19282


File: python.info,  Node: dis<5>,  Next: doctest<4>,  Prev: dbm<6>,  Up: 改良されたモジュール<10>

1.11.4.10 dis
.............

関数 *note show_code(): 112f, *note dis(): 205, *note distb(): 206,
*note disassemble(): 207. が新たにキーワード専用引数 'file' を受け取りま
す。これは出力先を制御します。

*note dis: 3c. モジュールはいまでは *note Instruction: 203. クラスを中心
に据えて構築されています。これは個々のバイトコード操作の詳細に対し、オブ
ジェクト指向的なアクセスを提供するクラスです。

新規メソッド *note get_instructions(): 4ec. が、与えた Python コード片に
ついての命令 (インストラクション) ストリームを発行するイテレータを提供し
ます。これを使えば、*note dis: 3c. モジュール自身が提供しているのとは違
った方法で、バイトコードオブジェクトを調べたり加工するようなプログラムを
書くことが出来ます。例えばこのように書けます:

     >>> import dis
     >>> for instr in dis.get_instructions(lambda x: x + 1):
     ...     print(instr.opname)
     LOAD_FAST
     LOAD_CONST
     BINARY_ADD
     RETURN_VALUE

*note dis: 3c. モジュールにある色々な表示ツールが、これらの新しい構成要
素でもって書き直されました。

In addition, a new application-friendly class *note Bytecode: 204.
provides an object-oriented API for inspecting bytecode in both in
human-readable form and for iterating over instructions.  The *note
Bytecode: 204. constructor takes the same arguments that *note
get_instructions(): 4ec. does (plus an optional 'current_offset'), and
the resulting object can be iterated to produce *note Instruction: 203.
objects.  But it also has a *note dis: 1130. method, equivalent to
calling *note dis: 205. on the constructor argument, but returned as a
multi-line string:

     >>> bytecode = dis.Bytecode(lambda x: x + 1, current_offset=3)
     >>> for instr in bytecode:
     ...     print('{} ({})'.format(instr.opname, instr.opcode))
     LOAD_FAST (124)
     LOAD_CONST (100)
     BINARY_ADD (23)
     RETURN_VALUE (83)
     >>> bytecode.dis().splitlines()
     ['  1           0 LOAD_FAST                0 (x)',
      '      -->     3 LOAD_CONST               1 (1)',
      '              6 BINARY_ADD',
      '              7 RETURN_VALUE']

*note Bytecode: 204. にはクラスメソッド *note from_traceback(): 1131. も
あります。トレースバックから *note Bytecode: 204. を構築します。
(‘print(Bytecode.from_traceback(tb).dis())’ は *note distb(): 206. を使
って ‘distb(tb)’ とするのと同じです。)

(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in
bpo-11816(1) and Claudiu Popa in bpo-17916(2).)

新規関数 *note stack_effect(): 1132. は与えられた opcode (命令コード) と
引数の Python スタックへの effect を計算します。この情報は他からは得られ
ません。 (Contributed by Larry Hastings in bpo-19722(3).)  (--訳注:
‘PyCompile_OpcodeStackEffect’ として C API として曝した上で Python から
アクセス出来るようにしたものらしいです。 stackdepth_walk での使用箇所(4)
参照。--)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11816

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17916

   (3) https://bugs.python.org/issue?@action=redirect&bpo=19722

   (4) 
https://hg.python.org/cpython/file/5fe72b9ed48e/Python/compile.c#l3838


File: python.info,  Node: doctest<4>,  Next: email<5>,  Prev: dis<5>,  Up: 改良されたモジュール<10>

1.11.4.11 doctest
.................

A new *note option flag: 1134, *note FAIL_FAST: 1135, halts test running
as soon as the first failure is detected.  (Contributed by R. David
Murray and Daniel Urban in bpo-16522(1).)

*note doctest: 3e. コマンドラインインターフェイスは *note argparse: 7. を
使うようになりました。2 つの新オプション ‘-o’ と ‘-f’ が追加されています
。 ‘-o’ によりコマンドラインから *note doctest オプション: 1134. を指定
することが出来ます。 ‘-f’ は ‘-o FAIL_FAST’ の速記法です (*note
unittest: 10c. CLI でサポートされる似たオプション *note
サポートされる同じオプション: 1136. に似せるためです)。 (Contributed by
R. David Murray in bpo-11390(2).)

*note doctest: 3e. はいまや、拡張モジュールの ‘__doc__’ 文字列から
doctest を見つけることが出来ます。 (Contributed by Zachary Ware in
bpo-3158(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16522

   (2) https://bugs.python.org/issue?@action=redirect&bpo=11390

   (3) https://bugs.python.org/issue?@action=redirect&bpo=3158


File: python.info,  Node: email<5>,  Next: filecmp,  Prev: doctest<4>,  Up: 改良されたモジュール<10>

1.11.4.12 email
...............

*note as_string(): 1138. メソッドが、その文字列表現を生成するのに使うデ
フォルトポリシーを上書き出来る 'policy' 引数を取るようになりました。つま
り *note Message: 581. を作り直したり ‘flattern’ メソッドの書式化パラメ
ータのためだけに *note generator: 44. を使うことなしに、 ‘as_string’ を
より多くの状況で使えるということになります。(Contributed by R. David
Murray in bpo-18600(1).)

*note as_bytes(): 1139. メソッドが追加されました。これは ‘as_string’ が
文字列表現を生成するのと似たやり方で、メッセージの bytes 表現を生成しま
す。これは 'maxheaderlen' 引数を取りませんが、 'unixfrom' 引数と
'policy' 引数を取ります。 *note Message: 581. の *note __bytes__():
113a. がこれを呼び出すようにしたので、 ‘bytes(mymsg)’ は今や直感に反しな
い結果、つまり完全にフォーマットされたメッセージを生成します。
(Contributed by R. David Murray in bpo-18600(2).)

*note Message.set_param(): 113b. メソッドにキーワード引数 'replace' が追
加されました。真を渡すとヘッダリスト内のその位置を変更せずに関連ヘッダを
更新します。後方互換のためにデフォルトは ‘False’ です。 (Contributed by
R. David Murray in bpo-18891(3).)  サブモジュール *note contentmanager:
41. と *note policy: 53. 属性の *note content_manager: 113c. の追加と併
せて、 *note Message: 581. の対となる二つのサブクラス (*note
EmailMessage: 580. と *note MIMEPart: 113d.) が追加されました。 全てのド
キュメントは、 email の新規 *note 暫定 API: 3d1. の構成要素として追加さ
れたこの新しいモジュールにあります。 これらのクラスは、 email メッセージ
からの内容抽出や挿入を遥かに簡単に行える、数多くの新規メソッドを提供して
います。 詳細は *note contentmanager: 41. のドキュメントと *note email;
使用例: 113e. を参照してください。 これらの API の追加作業により email6
プロジェクトの一部として計画されていた作業は、その大部分が完了しました。
現在のところ、暫定 API 状態は Python 3.5 で最後となる予定です (可能性と
してはエラー処理あたりのゾーンでは少々の些細な追加は残るかもしれません
)。 (Contributed by R. David Murray in bpo-18891(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18600

   (2) https://bugs.python.org/issue?@action=redirect&bpo=18600

   (3) https://bugs.python.org/issue?@action=redirect&bpo=18891

   (4) https://bugs.python.org/issue?@action=redirect&bpo=18891


File: python.info,  Node: filecmp,  Next: functools<6>,  Prev: email<5>,  Up: 改良されたモジュール<10>

1.11.4.13 filecmp
.................

*note clear_cache(): 1140. 関数が追加されました。 *note filecmp: 5e. は
*note os.stat(): 26d. 情報をキャッシュして最後の比較時点からのファイルの
変化をみていますが、このキャッシュをクリアします。これはたとえば、ファイ
ルシステムのタイムスタンプフィールドの解像度未満の時間差で再比較したい場
合に使えるでしょう。(Contributed by Mark Levitt in bpo-18149(1).)

New module attribute *note DEFAULT_IGNORES: 1141. provides the list of
directories that are used as the default value for the 'ignore'
parameter of the *note dircmp(): 1142. function.  (Contributed by Eli
Bendersky in bpo-15442(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18149

   (2) https://bugs.python.org/issue?@action=redirect&bpo=15442


File: python.info,  Node: functools<6>,  Next: gc<6>,  Prev: filecmp,  Up: 改良されたモジュール<10>

1.11.4.14 functools
...................

新たな *note partialmethod(): 218. デスクリプタは、ちょうど普通の
callable に対して *note partial(): 217. がするように、デスクリプタへの引
数部分適用を可能にします。この新しいデスクリプタをクラス定義内で使うと、
簡単に (*note partial(): 217. インスタンスを含む) 任意の callable を普通
のインスタンスメソッドのように振舞わせることも出来ます。(Contributed by
Alon Horev and Nick Coghlan in bpo-4331(1).)  新たな *note
singledispatch(): 84b. デコレータは、Python 標準ライブラリにシングルディ
スパッチのジェネリック関数のサポートを追加します。オブジェクト指向プログ
ラミングは共通データ集合についての複数操作をまとめあげてクラスに押し込め
ようとしますが、ジェネリック関数は '異なった' 種類のデータに対して動作さ
せたい操作の複数実装をひとつにまとめあげる考え方です。(--訳注: ここで「
ジェネリック関数」と呼んでいるものを他の言語との類推で理解しようとすると
、「呼び出す側目線」では同じで、「呼び出される側」目線では違うかもしれま
せん。例えば C++ ユーザは「template の特殊化」もしくは「型ごとのオーバロ
ード」との類推で理解してください。--)

参考
....

PEP 443(2) - シングルディスパッチのジェネリック関数

     PEP written and implemented by Łukasz Langa.

*note total_ordering(): 1144. now supports a return value of *note
NotImplemented: 1a2. from the underlying comparison function.
(Contributed by Katie Miller in bpo-10042(3).)

*note partial(): 217. 関数のピュア Python 版が標準ライブラリに追加されま
した。CPython の場合は C による高速版で置き換えられますが、ほかの Python
実装で利用出来ます。 (Contributed by Brian Thorne in bpo-12428(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=4331

   (2) https://peps.python.org/pep-0443/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=10042

   (4) https://bugs.python.org/issue?@action=redirect&bpo=12428


File: python.info,  Node: gc<6>,  Next: glob<4>,  Prev: functools<6>,  Up: 改良されたモジュール<10>

1.11.4.15 gc
............

新規関数 *note get_stats(): 2dc. は、インタプリタが開始してからの、世代
ごと回収統計を持つ辞書の、3 世代ぶんのリストを返します。(Contributed by
Antoine Pitrou in bpo-16351(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16351


File: python.info,  Node: glob<4>,  Next: hashlib<6>,  Prev: gc<6>,  Up: 改良されたモジュール<10>

1.11.4.16 glob
..............

新規関数 *note escape(): 1147. は、glob 的な展開がなされないようにして字
句通りの合致をするように、ファイル名に含まれる特殊文字をエスケープする手
段となります。(Contributed by Serhiy Storchaka in bpo-8402(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=8402


File: python.info,  Node: hashlib<6>,  Next: hmac<4>,  Prev: glob<4>,  Up: 改良されたモジュール<10>

1.11.4.17 hashlib
.................

新たな関数 *note hashlib.pbkdf2_hmac(): 733. は PKCS#5 パスワードベース
の鍵導出関数２(1) を提供します。 (Contributed by Christian Heimes in
bpo-18582(2).)

*note hashlib: 6c. のハッシュオブジェクトの *note name: 1149. 属性が、公
式にサポートされるインターフェイスになりました。これは CPython の *note
hashlib: 6c. には以前から存在していました (ただしサポートされるハッシュ
の名前を必ずしも小文字で返してはいませんでした) が、公開インターフェイス
としていなかったために、ほかのいくつかの Python 実装では以前はサポートさ
れていませんでした。(Contributed by Jason R. Coombs in bpo-18532(3).)

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/PBKDF2

   (2) https://bugs.python.org/issue?@action=redirect&bpo=18582

   (3) https://bugs.python.org/issue?@action=redirect&bpo=18532


File: python.info,  Node: hmac<4>,  Next: html,  Prev: hashlib<6>,  Up: 改良されたモジュール<10>

1.11.4.18 hmac
..............

*note hmac: 6e. は、 *note new(): c96. の 'key' 引数として ‘bytearray’ と
‘bytes’ を許容するようになり、また、 *note new(): c96. 関数と *note
update(): 114b. メソッドの両方への 'msg' パラメータとして、 *note
hashlib: 6c. モジュールがサポートする任意の型を許容するようになりました
。(Contributed by Jonas Borgström in bpo-18240(1).)

*note hmac.new(): c96. 関数への 'digestmod' 引数には、*note hashlib: 6c.
が認識する任意のハッシュダイジェスト名を渡せるようになりました。これとと
もに、 'digestmod' のデフォルトとして ‘MD5’ を使う現在の振る舞いは非推奨
です。将来のバージョンの Python ではこれのデフォルト値はなくなり、指定が
必須になります。 (Contributed by Christian Heimes in bpo-17276(2).)

*note block_size: 114c. 属性と *note name: 114d. 属性 (と *note
digest_size: 114e. 属性の公式ドキュメント) の追加をもって、 *note hmac:
6e. モジュールは完全に PEP 247(3) API を遵守するものとなりました。
(Contributed by Christian Heimes in bpo-18775(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18240

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17276

   (3) https://peps.python.org/pep-0247/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=18775


File: python.info,  Node: html,  Next: http<4>,  Prev: hmac<4>,  Up: 改良されたモジュール<10>

1.11.4.19 html
..............

新規関数 *note unescape(): b50. は HTML5 文字参照を対応する Unicode 文字
に変換します。 (Contributed by Ezio Melotti in bpo-2927(1).)

*note HTMLParser: a77. が新規キーワード引数 'convert_charrefs' を受け取
ります。これが ‘True’ の場合に、全ての文字参照が自動的に変換されます。後
方互換性の問題から今はこのデフォルトを ‘False’ にしてありますが、将来バ
ージョンの Python でこれを ‘True’ に変えます。ですから値は明示的にセット
してこの新しい機能を使うように更新しておくと良いです。(Contributed by
Ezio Melotti in bpo-13633(2).)

*note HTMLParser: a77. の 'strict' 引数が非推奨となりました。
(Contributed by Ezio Melotti in bpo-15114(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=2927

   (2) https://bugs.python.org/issue?@action=redirect&bpo=13633

   (3) https://bugs.python.org/issue?@action=redirect&bpo=15114


File: python.info,  Node: http<4>,  Next: idlelib と IDLE<4>,  Prev: html,  Up: 改良されたモジュール<10>

1.11.4.20 http
..............

*note send_error(): 1151. now accepts an optional additional 'explain'
parameter which can be used to provide an extended error description,
overriding the hardcoded default if there is one.  This extended error
description will be formatted using the *note error_message_format:
1152. attribute and sent as the body of the error response.
(Contributed by Karl Cow in bpo-12921(1).)

*note http.server: 76. の *note コマンドラインインターフェイス: 1153. に
‘-b/--bind’ オプションが追加されました。これは特定のアドレスで listen す
ることを指示します。 (Contributed by Malte Swart in bpo-17764(2).)  (--訳
注: ネットワークプログラミングに詳しい人ほど混乱しそうなので一応。
‘--bind’ というオプション名が示すとおり、より正確に表現するなら「ユーザ
指定のネットワークインターフェイスに bind」。コミットログの表現「Expose
-bind argument for http.server, enable http.server to bind to a user
specified network interface.」の方がわかりやすいかと。 --)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12921

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17764


File: python.info,  Node: idlelib と IDLE<4>,  Next: importlib<9>,  Prev: http<4>,  Up: 改良されたモジュール<10>

1.11.4.21 idlelib と IDLE
.........................

idlelib は IDLE シェルとエディタを実装するものであってほかのプログラムか
らインポートされることを意図してはいないので、改善は毎度のリリースごとに
行われます。3.3.0 から始まり、また将来の 3.4.x リリースになされる累積的
な変更リストは ‘Lib/idlelib/NEWS.txt’ で読むことが出来ます。このファイル
は IDLE で Help ‣ About IDLE からも辿り着けます。


File: python.info,  Node: importlib<9>,  Next: inspect<9>,  Prev: idlelib と IDLE<4>,  Up: 改良されたモジュール<10>

1.11.4.22 importlib
...................

*note InspectLoader: 1156. ABC に新規メソッド *note source_to_code():
1012. が追加されました。ソースデータとパスを受け取り、コードオブジェクト
を返します。これのデフォルト実装は ‘compile(data, path, 'exec',
dont_inherit=True)’ と同じです。 (Contributed by Eric Snow and Brett
Cannon in bpo-15627(1).)

*note InspectLoader: 1156. では *note get_code(): 1157. メソッドへのデフ
ォルト実装追加も行われました。とはいえ性能面の理由より、通常はデフォルト
実装をオーバライドすることが望ましいです。 (Contributed by Brett Cannon
in bpo-18072(2).)

The *note reload(): 73d. function has been moved from ‘imp’ to *note
importlib: 7b. as part of the ‘imp’ module deprecation.  (Contributed by
Berker Peksag in bpo-18193(3).)

*note importlib.util: 81. now has a *note MAGIC_NUMBER: 737. attribute
providing access to the bytecode version number.  This replaces the
‘get_magic()’ function in the deprecated ‘imp’ module.  (Contributed by
Brett Cannon in bpo-18192(4).)

New *note importlib.util: 81. functions *note cache_from_source(): 353.
and *note source_from_cache(): 73e. replace the same-named functions in
the deprecated ‘imp’ module.  (Contributed by Brett Cannon in
bpo-18194(5).)

*note importlib: 7b. ブートストラップ *note NamespaceLoader: 1158. が
*note InspectLoader: 1156. ABC に従うようになりました。つまりこれにより
‘runpy’ と ‘python -m’ が名前空間パッケージに対して使えるようになりまし
た。(Contributed by Brett Cannon in bpo-18058(6).)  (訳注: 3.3 以降の名
前空間パッケージについては What's New In Python 3.3 ( PEP 420(7)) 参照。
)

*note importlib.util: 81. に *note decode_source(): 1159. 関数が追加され
ました。 *note universal newlines: f35. 処理を使って bytes からソースを
デコードします。 *note InspectLoader.get_source(): 115a. メソッドを実装
するのに便利です。

*note importlib.machinery.ExtensionFileLoader: eae. に *note
get_filename(): 115b. メソッドが追加されました。これは本来実装されるべき
ものでしたが見落とされていました。(Contributed by Eric Snow in
bpo-19152(8).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15627

   (2) https://bugs.python.org/issue?@action=redirect&bpo=18072

   (3) https://bugs.python.org/issue?@action=redirect&bpo=18193

   (4) https://bugs.python.org/issue?@action=redirect&bpo=18192

   (5) https://bugs.python.org/issue?@action=redirect&bpo=18194

   (6) https://bugs.python.org/issue?@action=redirect&bpo=18058

   (7) https://peps.python.org/pep-0420/

   (8) https://bugs.python.org/issue?@action=redirect&bpo=19152


File: python.info,  Node: inspect<9>,  Next: ipaddress<5>,  Prev: importlib<9>,  Up: 改良されたモジュール<10>

1.11.4.23 inspect
.................

*note inspect: 82. モジュールに、ソースコードおよびモジュール・クラス・
関数についてのその他情報を手早く表示するための、基礎的な *note
コマンドラインインターフェイス: 115d. が追加されました。 (Contributed by
Claudiu Popa and Nick Coghlan in bpo-18626(1).)

新規の *note unwrap(): 115e. で、 *note functools.wraps(): 115f. (やラッ
パー関数に ‘__wrapped__’ 属性をセットするその他 API) で作られたラッパー
関数のチェインを、簡単にほどくことが出来ます。 (Contributed by Daniel
Urban, Aaron Iles and Nick Coghlan in bpo-13266(2).)  (--訳注: 「簡単に
」の意味するところについて、 *note Python API の変更: 110e. に記述されて
いる ‘functools.update_wrapper()’ と ‘functools.wraps()’ の変更も参照し
て下さい。--)

新規 *note enum: 5a. モジュールが実装されたことを受け *note inspect: 82.
モジュールは、カスタム ‘__dir__’ メソッドに対する、またメタクラスを介し
て提供される動的クラス属性に対する、ずっと良いサポートを提供出来るように
なりました。 (Contributed by Ethan Furman in bpo-18929(3) and
bpo-19030(4).)

*note getfullargspec(): 941. and ‘getargspec()’ now use the *note
signature(): 22f. API. This allows them to support a much broader range
of callables, including those with ‘__signature__’ attributes, those
with metadata provided by argument clinic, *note functools.partial():
217. objects and more.  Note that, unlike *note signature(): 22f, these
functions still ignore ‘__wrapped__’ attributes, and report the already
bound first argument for bound methods, so it is still necessary to
update your code to use *note signature(): 22f. directly if those
features are desired.  (Contributed by Yury Selivanov in bpo-17481(5).)

*note signature(): 22f. が CPython 関数のダックタイプをサポートするよう
になりました。これは Cython でコンパイルされた関数をサポートすることにな
ります。 (Contributed by Stefan Behnel and Yury Selivanov in
bpo-17159(6).)  (--訳注: duck type はここでは「 ‘types.FunctionType’ で
あることを要求しない」の意味。 _signature_is_functionlike(7) 参照。 --)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18626

   (2) https://bugs.python.org/issue?@action=redirect&bpo=13266

   (3) https://bugs.python.org/issue?@action=redirect&bpo=18929

   (4) https://bugs.python.org/issue?@action=redirect&bpo=19030

   (5) https://bugs.python.org/issue?@action=redirect&bpo=17481

   (6) https://bugs.python.org/issue?@action=redirect&bpo=17159

   (7) 
https://hg.python.org/cpython/file/32a660a52aae/Lib/inspect.py#l1604


File: python.info,  Node: ipaddress<5>,  Next: logging<6>,  Prev: inspect<9>,  Up: 改良されたモジュール<10>

1.11.4.24 ipaddress
...................

*note ipaddress: 84. は Python 3.3 で標準ライブラリに *note 暫定 API:
3d1. として追加されました。Python 3.4 リリースで、この但し書きは削除され
ました: *note ipaddress: 84. は今や安定 API とみなされ、今後は通常の標準
ライブラリの後方互換性維持要件に従います。

新規のプロパティ *note is_global: 1161. は、アドレスが routeable である
場合に ‘True’ を返します。 (Contributed by Peter Moody in bpo-17400(1).)
(--訳注: リファレンスマニュアルでは routeable という表現ではなく「アドレ
スがパブリックネットワークに割り当てられている場合」。--)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17400


File: python.info,  Node: logging<6>,  Next: marshal<2>,  Prev: ipaddress<5>,  Up: 改良されたモジュール<10>

1.11.4.25 logging
.................

*note TimedRotatingFileHandler: 1163. に 'atTime' パラメータが追加されま
した。ロールオーバ対象となる日付での時刻を指定します。 (Contributed by
Ronald Oussoren in bpo-9556(1).)

*note SocketHandler: 1164. と *note DatagramHandler: 1165. が Unix ドメ
インソケットをサポートするようになりました ('port' に ‘None’ をセットす
ることで)。 (Contributed by Vinay Sajip in commit ce46195b56a9(2) .)

*note fileConfig(): d48. が 'fname' パラメータとして *note
configparser.RawConfigParser: 1166. のサブクラスを許容するようになりまし
た。これはロギングの設定がアプリケーション全体の設定の一部に過ぎない場合
や、 *note fileConfig(): d48. に渡す前にアプリケーションが設定を修正する
ような場合でも設定ファイルを使用することを容易にします。(Contributed by
Vinay Sajip in bpo-16110(3).)

*note logging.config.listen(): 1167. 関数経由でソケットから受信したロギ
ング設定データを、処理前に検証出来るようになりました。新規のキーワード引
数 'verify' に検証関数を渡すことで可能です。(Contributed by Vinay Sajip
in bpo-15452(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9556

   (2) https://hg.python.org/cpython/rev/ce46195b56a9

   (3) https://bugs.python.org/issue?@action=redirect&bpo=16110

   (4) https://bugs.python.org/issue?@action=redirect&bpo=15452


File: python.info,  Node: marshal<2>,  Next: mmap<3>,  Prev: logging<6>,  Up: 改良されたモジュール<10>

1.11.4.26 marshal
.................

*note marshal: 91. のバージョンが 3 に上げられました。新バージョンを実装
しているコードは、intern された文字列をただ一つのコピーだけ記録しておき
デシリアライズでその intern を維持するという Python 2 での振舞いを復活さ
せつつ、「ただ一つのコピー」を文字列型のみならず任意のオブジェクト型に
(再帰参照の処理も含め) 拡張しています。これは ‘.pyc’ ファイルのサイズを
削減し、また、 ‘.pyc’ (または ‘.pyo’) ファイルからロードされる際にモジュ
ールが占めるメモリ量を削減します。(Contributed by Kristján Valur Jónsson
in bpo-16475(1), with additional speedups by Antoine Pitrou in
bpo-19219(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16475

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19219


File: python.info,  Node: mmap<3>,  Next: multiprocessing<8>,  Prev: marshal<2>,  Up: 改良されたモジュール<10>

1.11.4.27 mmap
..............

mmap objects are now *note weakly referenceable: 110d.  (Contributed by
Valerie Lambert in bpo-4885(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=4885


File: python.info,  Node: multiprocessing<8>,  Next: operator<4>,  Prev: mmap<3>,  Up: 改良されたモジュール<10>

1.11.4.28 multiprocessing
.........................

*note multiprocessing: 98. を使ってプロセスを開始する *note 開始方式:
1d5. として、Unix において 2 つ、 ‘spawn’ と ‘forkserver’ が追加されまし
た。これらはスレッドとプロセスのミックスをより堅牢にし、また、 ‘spawn’ は
multiprocessing が以前から常に Windows で使ってきたセマンティクスと一致
します。新規関数の、 *note get_all_start_methods(): 116b. はプラットフォ
ームで利用出来るすべての開始方式を報告し、 *note get_start_method():
116c. は現在設定されている開始方式を報告し、 *note set_start_method():
24b. は開始方式を設定します。(Contributed by Richard Oudkerk in
bpo-8713(1).)

*note multiprocessing: 98. には、子プロセスがどのように作られるかを決定
する ‘context’ のコンセプトが追加されています。新規関数 *note
get_context(): 24a. は指定した開始方式を使うコンテキストを返します。コン
テキストは *note multiprocessing: 98. モジュール自身と同じ API を持って
いるので、コンテキスト内で操作する *note Pool: 116d. や他のオブジェクト
を、それを使って作成することが出来ます。コンテキストによって、フレームワ
ークとアプリケーションあるいは同じアプリケーションの別の部分が相互に干渉
しあわないようにして multiprocessing を使うことが出来ます。(Contributed
by Richard Oudkerk in bpo-18999(2).)

昔からの 'fork' 開始方式を除き、子プロセスはもはや必要のないハンドル・フ
ァイル記述子をその親から継承しません。 (part of bpo-8713(3)).

*note multiprocessing: 98. が開始方式に ‘spawn’ または ‘forkserver’ を使
う場合に、子プロセスで適切に ‘__main__’ を初期化するために *note runpy:
c3. (これが ‘-m’ スイッチを実装しています) に頼るようになりました。これ
は、 multiprocessing と ‘-m’ コマンドラインスイッチ・明示的な相対インポ
ートを組み合わせると子プロセスが不可解に失敗していたような、いくつかの際
どい問題を解決します。 (Contributed by Nick Coghlan in bpo-19946(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=8713

   (2) https://bugs.python.org/issue?@action=redirect&bpo=18999

   (3) https://bugs.python.org/issue?@action=redirect&bpo=8713

   (4) https://bugs.python.org/issue?@action=redirect&bpo=19946


File: python.info,  Node: operator<4>,  Next: os<12>,  Prev: multiprocessing<8>,  Up: 改良されたモジュール<10>

1.11.4.29 operator
..................

新規関数 *note length_hint(): 116f. は、言語仕様となった特殊メソッド
*note __length_hint__(): 110f. の PEP 424(1) 公式仕様の一環として、それ
がどのように使われるのかについて詳述する実装を提供します。(Contributed
by Armin Ronacher in bpo-16148(2).)

参照実装として、また Python 実装の代替として用いることが出来る、 *note
operator: a3. モジュールのピュア Python 版が書かれました。 (Contributed
by Zachary Ware in bpo-16694(3).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0424/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=16148

   (3) https://bugs.python.org/issue?@action=redirect&bpo=16694


File: python.info,  Node: os<12>,  Next: pdb<8>,  Prev: operator<4>,  Up: 改良されたモジュール<10>

1.11.4.30 os
............

新規関数により *note 継承可能フラグ: 10fc. を制御出来るようになりました
。ファイル記述子には *note os.get_inheritable(): 10fd, *note
os.set_inheritable(): 10fe. を、Windows のハンドルには *note
os.get_handle_inheritable(): 10ff, *note os.set_handle_inheritable():
1100. を使います。

関数 *note cpu_count(): 4db. が追加されました。これは Python を実行して
いるプラットフォームで利用可能な CPU 数を返します (決定できない場合は
‘None’ を返します)。既存の *note multiprocessing.cpu_count(): 1171. はこ
の関数の値を返すようになりました。(Contributed by Trent Nelson, Yogesh
Chaudhari, Victor Stinner, and Charles-François Natali in bpo-17914(1).)

*note os.path.samestat(): 1172. が Windows プラットフォームでも動作する
ようになりました (また、 *note os.path.samefile(): 1173. の実装は Unix と
Windows で共有されました)。 (Contributed by Brian Curtin in
bpo-11939(2).)

*note os.path.ismount(): c07. が Windows において、ドライブルートよりも
下にあるマウントポイントを認識するようになりました。 (Contributed by Tim
Golden in bpo-9035(3).)

*note os.open(): f92. supports two new flags on platforms that provide
them, *note O_PATH: 1174. (un-opened file descriptor), and *note
O_TMPFILE: 1175. (unnamed temporary file; as of 3.4.0 release available
only on Linux systems with a kernel version of 3.11 or newer that have
uapi headers).  (Contributed by Christian Heimes in bpo-18673(4) and
Benjamin Peterson, respectively.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17914

   (2) https://bugs.python.org/issue?@action=redirect&bpo=11939

   (3) https://bugs.python.org/issue?@action=redirect&bpo=9035

   (4) https://bugs.python.org/issue?@action=redirect&bpo=18673


File: python.info,  Node: pdb<8>,  Next: pickle<5>,  Prev: os<12>,  Up: 改良されたモジュール<10>

1.11.4.31 pdb
.............

*note pdb: aa. が、ジェネレータ、 *note yield: bc2. 、 ‘yield from’ をよ
り価値ある方法で処理するように強化されました。これは *note asyncio: b. ベ
ースのプログラムをデバッグする際にとりわけ助けとなります。 (Contributed
by Andrew Svetlov and Xavier de Gaye in bpo-16596(1).)

*note pdb: aa. から ‘print’ コマンドは削除され、pdb コマンドラインからの
Python *note print(): 1177. 関数へのアクセスを取り戻しました。 Python 2
の ‘pdb’ には ‘print’ コマンドはなく ‘print’ の入力は Python 2 の
‘print’ 文を実行していました。 Python 3 で pdb の *note p: 1178. コマン
ドへのエイリアスとして ‘print’ を作ったのが間違いでした。 ‘p’ はその引数
の ‘repr’ を表示するのであって、Python 2 での ‘print’ コマンドがしていた
‘str’ を表示するのではありません。さらに悪いことに、Python 3 の ‘pdb
print’ コマンドは Python 3 の ‘print’ 関数を隠してしまい、 ‘pdb’ プロン
プトからのアクセスを出来なくしていたのでした。 (Contributed by Connor
Osborn in bpo-18764(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16596

   (2) https://bugs.python.org/issue?@action=redirect&bpo=18764


File: python.info,  Node: pickle<5>,  Next: plistlib<2>,  Prev: pdb<8>,  Up: 改良されたモジュール<10>

1.11.4.32 pickle
................

*note pickle: ab. now supports (but does not use by default) a new
pickle protocol, protocol 4.  This new protocol addresses a number of
issues that were present in previous protocols, such as the
serialization of nested classes, very large strings and containers, and
classes whose *note __new__(): 7a0. method takes keyword-only arguments.
It also provides some efficiency improvements.

参考
....

PEP 3154(1) - Pickle プロトコル 4

     PEP written by Antoine Pitrou and implemented by Alexandre
     Vassalotti.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3154/


File: python.info,  Node: plistlib<2>,  Next: poplib<3>,  Prev: pickle<5>,  Up: 改良されたモジュール<10>

1.11.4.33 plistlib
..................

*note plistlib: b0. now has an API that is similar to the standard
pattern for stdlib serialization protocols, with new *note load(): b48,
*note dump(): b4a, *note loads(): b49, and *note dumps(): b4b.
functions.  (The older API is now deprecated.)  In addition to the
already supported XML plist format (*note FMT_XML: 117b.), it also now
supports the binary plist format (*note FMT_BINARY: 117c.).
(Contributed by Ronald Oussoren and others in bpo-14455(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14455


File: python.info,  Node: poplib<3>,  Next: pprint<4>,  Prev: plistlib<2>,  Up: 改良されたモジュール<10>

1.11.4.34 poplib
................

*note poplib: b1. に 2 つの新規メソッドが追加されました。 *note capa():
117e. は POP サーバにより公表された機能リストを返します。 *note stls():
117f. は平文 POP3 セッションを、POP サーバがサポートしていれば暗号化され
た POP3 セッションに切り替えます。 (Contributed by Lorenzo Catucci in
bpo-4473(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=4473


File: python.info,  Node: pprint<4>,  Next: pty<2>,  Prev: poplib<3>,  Up: 改良されたモジュール<10>

1.11.4.35 pprint
................

*note pprint: b3. モジュールの、 *note PrettyPrinter: 1181. クラス、
*note pformat(): 1182. 関数、 *note pprint(): a29. 関数に、新規オプショ
ン 'compact' が追加されました。これは出力方法を制御するもので、今のとこ
ろのこれの ‘True’ での振舞いは、個々の (インデントされた) 行を 'width' 幅
で出来るだけ多くのシーケンスの要素が収まるように出力します。
(Contributed by Serhiy Storchaka in bpo-19132(1).)

長い文字列が Python の普通の行継続構文で折り返されるようになりました。
(Contributed by Antoine Pitrou in bpo-17150(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19132

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17150


File: python.info,  Node: pty<2>,  Next: pydoc<5>,  Prev: pprint<4>,  Up: 改良されたモジュール<10>

1.11.4.36 pty
.............

*note pty.spawn(): 1184. が ‘None’ ではなく *note os.waitpid(): f9a. か
らの戻り値から取ったステータス値を返すようになりました。 (Contributed by
Gregory P. Smith.)


File: python.info,  Node: pydoc<5>,  Next: re<9>,  Prev: pty<2>,  Up: 改良されたモジュール<10>

1.11.4.37 pydoc
...............

*note pydoc: ba. モジュールがイントロスペクション API *note
inspect.signature(): 22f. に直接基くようになりました。これによりより幅広
く callable オブジェクトのシグニチャ情報を提供出来るようになりました。こ
の変更は、ヘルプ情報表示の際に ‘__wrapped__’ 属性も考慮に入れられること
も意味しています。(Contributed by Larry Hastings in bpo-19674(1).)

*note pydoc: ba. モジュールはもはや既に束縛済みのメソッドでは ‘self’ パ
ラメータを表示しません。それよりも、与えられた callable の正確な現在のシ
グニチャを常に表示しようとします。 (Contributed by Larry Hastings in
bpo-20710(2).)

*note pydoc: ba. に直接なされた変更に加え、背後の *note inspect: 82. モ
ジュールの改善が、カスタム ‘__dir__’ メソッドやさまざまなデスクリプタの
扱いについての振る舞いの大幅な改善に寄与しました。

組み込み *note help(): ad4. は *note pydoc: ba. モジュールに基いているの
で、上記変更は *note help(): ad4. の振る舞いにも影響します。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19674

   (2) https://bugs.python.org/issue?@action=redirect&bpo=20710


File: python.info,  Node: re<9>,  Next: resource,  Prev: pydoc<5>,  Up: 改良されたモジュール<10>

1.11.4.38 re
............

New *note fullmatch(): 1187. function and *note Pattern.fullmatch():
1188. method anchor the pattern at both ends of the string to match.
This provides a way to be explicit about the goal of the match, which
avoids a class of subtle bugs where ‘$’ characters get lost during code
changes or the addition of alternatives to an existing regular
expression.  (Contributed by Matthew Barnett in bpo-16203(1).)

*note 正規表現オブジェクト: 1189. の repr にパターンとフラグを含めるよう
になりました。 *note match オブジェクト: 118a. の repr に start、end と
合致した部分文字列を含むようになりました。 (Contributed by Hugo Lopes
Tavares and Serhiy Storchaka in bpo-13592(2) and bpo-17087(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16203

   (2) https://bugs.python.org/issue?@action=redirect&bpo=13592

   (3) https://bugs.python.org/issue?@action=redirect&bpo=17087


File: python.info,  Node: resource,  Next: select,  Prev: re<9>,  Up: 改良されたモジュール<10>

1.11.4.39 resource
..................

新規関数 *note prlimit(): 118c. は、指定プロセスのリソースリミットの問い
合わせとセットを、一度の呼び出しで行えます。カーネルバージョン 2.6.36 以
降で glibc 2.13 以降の Linux プラットフォームで利用可能です。
(Contributed by Christian Heimes in bpo-16595(1).)

On Linux kernel version 2.6.36 or later, there are also some new Linux
specific constants: *note RLIMIT_MSGQUEUE: 118d, *note RLIMIT_NICE:
118e, *note RLIMIT_RTPRIO: 118f, *note RLIMIT_RTTIME: 1190, and *note
RLIMIT_SIGPENDING: 1191.  (Contributed by Christian Heimes in
bpo-19324(2).)

On FreeBSD version 9 and later, there some new FreeBSD specific
constants: *note RLIMIT_SBSIZE: 1192, *note RLIMIT_SWAP: 1193, and *note
RLIMIT_NPTS: 1194.  (Contributed by Claudiu Popa in bpo-19343(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16595

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19324

   (3) https://bugs.python.org/issue?@action=redirect&bpo=19343


File: python.info,  Node: select,  Next: shelve<2>,  Prev: resource,  Up: 改良されたモジュール<10>

1.11.4.40 select
................

*note epoll: 1196. がコンテキスト管理プロトコルをサポートするようになり
ました: *note with: 186. ブロックで使うと *note close(): 1197. メソッド
がブロックの終了時に自動的に呼び出されます。 (Contributed by Serhiy
Storchaka in bpo-16488(1).)

*note devpoll: 1198. オブジェクトに、メソッド *note fileno(): 1199. とメ
ソッド *note close(): 119a. 、それに属性 *note closed: 119b. が追加され
ました。 (Contributed by Victor Stinner in bpo-18794(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16488

   (2) https://bugs.python.org/issue?@action=redirect&bpo=18794


File: python.info,  Node: shelve<2>,  Next: shutil<6>,  Prev: select,  Up: 改良されたモジュール<10>

1.11.4.41 shelve
................

*note Shelf: 119d. がコンテキスト管理プロトコルをサポートするようになり
ました: ‘with’ ブロックで使うとブロックの終了時に自動的にクローズされま
す。 (Contributed by Filip Gruszczyński in bpo-13896(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13896


File: python.info,  Node: shutil<6>,  Next: smtpd<3>,  Prev: shelve<2>,  Up: 改良されたモジュール<10>

1.11.4.42 shutil
................

*note copyfile(): c4e. が、コピー元とコピー先が同じファイルの場合に
*note Error: 119f. の限定されたサブクラスである *note SameFileError:
11a0. を投げるようになりました。これにより、アプリケーションはこの特定の
エラーでそれに相応しいアクションを取れます。 (Contributed by Atsuo
Ishimoto and Hynek Schlawack in bpo-1492704(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1492704


File: python.info,  Node: smtpd<3>,  Next: smtplib<3>,  Prev: shutil<6>,  Up: 改良されたモジュール<10>

1.11.4.43 smtpd
...............

The ‘SMTPServer’ and ‘SMTPChannel’ classes now accept a 'map' keyword
argument which, if specified, is passed in to ‘asynchat.async_chat’ as
its 'map' argument.  This allows an application to avoid affecting the
global socket map.  (Contributed by Vinay Sajip in bpo-11959(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11959


File: python.info,  Node: smtplib<3>,  Next: socket<10>,  Prev: smtpd<3>,  Up: 改良されたモジュール<10>

1.11.4.44 smtplib
.................

*note SMTPException: 11a3. が *note OSError: 2c0. のサブクラスになりまし
た。これによって、とにかくエラーが起こったのだということにしか関心がない
コードが、ソケット階層でのエラーと SMTP プロトコル階層の両エラーを一撃の
try/except 文で捕捉出来るようになりました。 (Contributed by Ned Jackson
Lovely in bpo-2118(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=2118


File: python.info,  Node: socket<10>,  Next: sqlite3<10>,  Prev: smtplib<3>,  Up: 改良されたモジュール<10>

1.11.4.45 socket
................

The socket module now supports the *note CAN_BCM: 11a5. protocol on
platforms that support it.  (Contributed by Brian Thorne in
bpo-15359(1).)

ソケットオブジェクトで *note 継承可能フラグ: 10fc. を制御出来るようにな
りました。 *note get_inheritable(): 1101. で取得し、 *note
set_inheritable(): 1102. でセットします。

定数値の ‘socket.AF_*’ と ‘socket.SOCK_*’ が、新規の *note enum: 5a. モ
ジュールを使った列挙値になりました。つまりデバッグなどで魑魅魍魎な整数で
はなく徳高い名前で表示されるということです。

The *note AF_LINK: 11a6. constant is now available on BSD and OSX.

*note inet_pton(): b5b. と *note inet_ntop(): 11a7. が Windows でサポー
トされるようになりました。 (Contributed by Atsuo Ishimoto in
bpo-7171(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15359

   (2) https://bugs.python.org/issue?@action=redirect&bpo=7171


File: python.info,  Node: sqlite3<10>,  Next: ssl<11>,  Prev: socket<10>,  Up: 改良されたモジュール<10>

1.11.4.46 sqlite3
.................

*note connect(): 5a6. 関数に新規の真偽値パラメータ 'uri' が追加されまし
た。これを真にセットすると 'database' パラメータを URI として解釈させる
ことが出来ます。 (SQLite の URI のドキュメント(1) を参照してください)。
(Contributed by poq in bpo-13773(2).)

   ---------- Footnotes ----------

   (1) https://www.sqlite.org/uri.html

   (2) https://bugs.python.org/issue?@action=redirect&bpo=13773


File: python.info,  Node: ssl<11>,  Next: stat,  Prev: sqlite3<10>,  Up: 改良されたモジュール<10>

1.11.4.47 ssl
.............

*note PROTOCOL_TLSv1_1: 11aa. と *note PROTOCOL_TLSv1_2: 11ab. (TLSv1.1
と TLSv1.2 のサポート) が追加されました。これらプロトコルのサポートは
Python が OpenSSL 1.0.1 以降とリンクしている場合にのみ利用可能です。
(Contributed by Michele Orrù and Antoine Pitrou in bpo-16692(1).)  新規
関数 *note create_default_context(): 480. は、互換性とセキュリティの間の
程よいバランスとなるよう調整された *note SSLContext: 357. を得るための標
準手段として追加されました。それらの設定は *note SSLContext: 357. コンス
トラクタが与えるデフォルトよりも厳しく、そして将来的にセキュリティにおけ
るベストプラクティスによる要請が変化すれば、事前予告なしで調整されるかも
しれません。SSL をサポートする標準ライブラリの使用においての新しいベスト
プラクティスとして、 *note SSLContext: 357. を得るのには *note
create_default_context(): 480. を使うことが推奨です。必要に応じ、対応す
る標準ライブラリ API の 'context' 引数に渡すためにそれを使うよう修正して
ください。(Contributed by Christian Heimes in bpo-19689(2).)

*note SSLContext: 357. のメソッド *note load_verify_locations(): 10ee. に
オプショナル引数 'cadata' が追加されました。これには PEM あるいは DER エ
ンコードの証明書を直接指定できます。前者の場合は文字列で、後者では *note
bytes-like object: 193. で指定します。(Contributed by Christian Heimes
in bpo-18138(3).)

関数 *note get_default_verify_paths(): 11ac. が追加されました。これは
*note set_default_verify_paths(): 11ad. メソッドが OpenSSL デフォルトの
‘cafile’ と ‘capath’ をセットするのに使うパスと環境変数から成る名前付き
タプルを返します。デフォルトの検証にまつわる問題をデバッグするのに使える
でしょう。(Contributed by Christian Heimes in bpo-18143(4).)

*note SSLContext: 357. の新規メソッド *note cert_store_stats(): 11ae. は
ロードされた ‘X.509’ 証明書、 ‘X.509 CA’ 証明書、証明書失効リスト
(‘crl’) を報告し、また、新規メソッド *note get_ca_certs(): 11af. はロー
ドされた ‘CA’ 証明書のリストを返します。(Contributed by Christian Heimes
in bpo-18147(5).)

If OpenSSL 0.9.8 or later is available, *note SSLContext: 357. has a new
attribute *note verify_flags: 11b0. that can be used to control the
certificate verification process by setting it to some combination of
the new constants *note VERIFY_DEFAULT: 11b1, *note
VERIFY_CRL_CHECK_LEAF: 11b2, *note VERIFY_CRL_CHECK_CHAIN: 11b3, or
*note VERIFY_X509_STRICT: 551.  OpenSSL does not do any CRL verification
by default.  (Contributed by Christien Heimes in bpo-8813(6).)

*note SSLContext: 357. の新規メソッド *note load_default_certs(): 11b4.
は、プラットフォームによって異なるデフォルトの場所から “認証局”
(CA=certification authority) 証明書ファイル一式をロードします。クライア
ントがサーバを検証するための TLS web サーバ証明の証明書をロード
(‘purpose=’*note SERVER_AUTH: 11b5.) することも、サーバがクライアント証
明書を検証するのに用いる証明書をロード (‘purpose=’*note CLIENT_AUTH:
11b6.) することも出来ます。(Contributed by Christian Heimes in
bpo-19292(7).)  Windows だけで利用出来る関数が 2 つ追加されました。
*note enum_certificates(): 11b7. と *note enum_crls(): 11b8. で Windows
のシステム証明書ストアから、証明書、証明書の情報、CRLs (certification
revocation=証明書失効リスト) を抽出出来ます。(Contributed by Christian
Heimes in bpo-17134(8).)  新規メソッド *note
ssl.SSLContext.set_servername_callback(): 11b9. によるサーバサイド SNI
(Server Name Indication) サポートが追加されました。 (Contributed by
Daniel Black in bpo-8109(9).)

*note SSLSocket.getpeercert(): 11ba. が返す辞書に ‘X509v3’ 拡張アイテム
を含むようになりました: ‘crlDistributionPoints’, ‘caIssuers’, ‘OCSP’
URI。 (Contributed by Christian Heimes in bpo-18379(10).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16692

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19689

   (3) https://bugs.python.org/issue?@action=redirect&bpo=18138

   (4) https://bugs.python.org/issue?@action=redirect&bpo=18143

   (5) https://bugs.python.org/issue?@action=redirect&bpo=18147

   (6) https://bugs.python.org/issue?@action=redirect&bpo=8813

   (7) https://bugs.python.org/issue?@action=redirect&bpo=19292

   (8) https://bugs.python.org/issue?@action=redirect&bpo=17134

   (9) https://bugs.python.org/issue?@action=redirect&bpo=8109

   (10) https://bugs.python.org/issue?@action=redirect&bpo=18379


File: python.info,  Node: stat,  Next: struct<3>,  Prev: ssl<11>,  Up: 改良されたモジュール<10>

1.11.4.48 stat
..............

The *note stat: d6. module is now backed by a C implementation in
‘_stat’.  A C implementation is required as most of the values aren't
standardized and are platform-dependent.  (Contributed by Christian
Heimes in bpo-11016(1).)

The module supports new *note ST_MODE: 11bc. flags, *note S_IFDOOR:
11bd, *note S_IFPORT: 11be, and *note S_IFWHT: 11bf.  (Contributed by
Christian Hiemes in bpo-11016(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11016

   (2) https://bugs.python.org/issue?@action=redirect&bpo=11016


File: python.info,  Node: struct<3>,  Next: subprocess<5>,  Prev: stat,  Up: 改良されたモジュール<10>

1.11.4.49 struct
................

関数 *note iter_unpack: 11c1. と、コンパイル済フォーマットでのメソッド
*note struct.Struct.iter_unpack(): 11c2. が追加されました。これは、与え
られたデータフォーマットの繰り返しインスタンスを含むバッファを逐次的にア
ンパックします。 (Contributed by Antoine Pitrou in bpo-17804(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17804


File: python.info,  Node: subprocess<5>,  Next: sunau<2>,  Prev: struct<3>,  Up: 改良されたモジュール<10>

1.11.4.50 subprocess
....................

*note check_output(): 11c4. が 'input' 引数を受け付けるようになりました
。これは実行するコマンドにとっての ‘stdin’ を供給するのに使われます (訳
注: *note run(): d7f. のドキュメント参照)。 (Contributed by Zack
Weinberg in bpo-16624(1).)

*note getoutput(): 11c5. and *note getstatusoutput(): 11c6. now work on
Windows.  This change was actually inadvertently made in 3.3.4.
(Contributed by Tim Golden in bpo-10197(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16624

   (2) https://bugs.python.org/issue?@action=redirect&bpo=10197


File: python.info,  Node: sunau<2>,  Next: sys<12>,  Prev: subprocess<5>,  Up: 改良されたモジュール<10>

1.11.4.51 sunau
...............

The ‘getparams()’ method now returns a namedtuple rather than a plain
tuple.  (Contributed by Claudiu Popa in bpo-18901(1).)

‘sunau.open()’ now supports the context management protocol: when used
in a *note with: 186. block, the ‘close’ method of the returned object
will be called automatically at the end of the block.  (Contributed by
Serhiy Storchaka in bpo-18878(2).)

‘AU_write.setsampwidth()’ now supports 24 bit samples, thus adding
support for writing 24 sample using the module.  (Contributed by Serhiy
Storchaka in bpo-19261(3).)

The ‘writeframesraw()’ and ‘writeframes()’ methods now accept any *note
bytes-like object: 193.  (Contributed by Serhiy Storchaka in
bpo-8311(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18901

   (2) https://bugs.python.org/issue?@action=redirect&bpo=18878

   (3) https://bugs.python.org/issue?@action=redirect&bpo=19261

   (4) https://bugs.python.org/issue?@action=redirect&bpo=8311


File: python.info,  Node: sys<12>,  Next: tarfile<8>,  Prev: sunau<2>,  Up: 改良されたモジュール<10>

1.11.4.52 sys
.............

新規関数 *note sys.getallocatedblocks(): 11c9. は、現在インタプリタによ
りアロケートされているブロック数を返します (デフォルトの
‘--with-pymalloc’ 設定での CPython では、これは *note PyObject_Malloc():
e62. API によるアロケーションです)。これはメモリリークの追跡に、とりわけ
テストスイートで自動化されている場合はなおさら有用です。 (Contributed by
Antoine Pitrou in bpo-13390(1).)

Python インタプリタが *note 対話モード: 443. で開始する際に *note sys:
df. モジュールの属性 *note __interactivehook__: 11ca. をチェックするよう
になりました。この属性があると、対話モード開始直前にその設定値が引数なし
で呼び出されます。このチェックは *note PYTHONSTARTUP: 1b8. ファイルが読
み込まれたあとで行われるので、そのファイル内でセット出来ます。 *note
site: cc. モジュールは *note readline: bf. をサポートするプラットフォー
ムではタブ補完と (‘~/.python-history’ への) 履歴保存を有効にする関数を
*note __interactivehook__ にセットします: 11cb. 。この (新たな) 振る舞い
がお気に召さなければ、 *note PYTHONSTARTUP: 1b8, *note sitecustomize:
cd, *note usercustomize: 114. のいずれかで *note sys: df. からこの属性を
削除 (あるいはほかのなにか callable をセット) してください。
(Contributed by Éric Araujo and Antoine Pitrou in bpo-5845(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13390

   (2) https://bugs.python.org/issue?@action=redirect&bpo=5845


File: python.info,  Node: tarfile<8>,  Next: textwrap<2>,  Prev: sys<12>,  Up: 改良されたモジュール<10>

1.11.4.53 tarfile
.................

*note tarfile: e4. モジュールはスクリプトや直接 ‘-m’ で呼ばれた場合、簡
単な *note コマンドラインインターフェイス: 11cd. をサポートするようにな
りました。 これにより tar ファイルアーカイブの作成や解凍が可能です。
(Contributed by Berker Peksag in bpo-13477(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13477


File: python.info,  Node: textwrap<2>,  Next: threading<8>,  Prev: tarfile<8>,  Up: 改良されたモジュール<10>

1.11.4.54 textwrap
..................

*note TextWrapper: 11cf. に 2 つ新しい制御変数が追加されていて、これらは
属性値であり、コンストラクタ引数に渡せます。それぞれ *note max_lines:
11d0. が最大出力行数、 *note placeholder: 11d1. が 'max_lines' により切
り詰める場合に出力の最終行に置くテキストです。これら機能を使った新規のコ
ンビニエンス関数 *note shorten(): 11d2. が追加されています。これは入力に
含まれる全ての空白文字を単一の空白に置き換え、また幅 'width' に収めて、
切り詰める場合は末尾を 'placeholder' (デフォルトで ‘[...]’) で置き換えて
、単一行で返します。(Contributed by Antoine Pitrou and Serhiy Storchaka
in bpo-18585(1) and bpo-18725(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18585

   (2) https://bugs.python.org/issue?@action=redirect&bpo=18725


File: python.info,  Node: threading<8>,  Next: traceback<6>,  Prev: textwrap<2>,  Up: 改良されたモジュール<10>

1.11.4.55 threading
...................

メインスレッドを表現する *note Thread: 176. オブジェクトを、新規関数
*note main_thread(): 11d4. で得られるようになりました。通常の条件であれ
ばこれは Python インタプリタを開始したスレッドになります。 (Contributed
by Andrew Svetlov in bpo-18882(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18882


File: python.info,  Node: traceback<6>,  Next: types<7>,  Prev: threading<8>,  Up: 改良されたモジュール<10>

1.11.4.56 traceback
...................

新規関数 *note traceback.clear_frames(): 11d6. は、トレースバックオブジ
ェクトを受け取って、それが参照している全てのフレーム内のローカル変数をク
リアすることで、メモリ消費量を削減します。 (Contributed by Andrew
Kuchling in bpo-1565525(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1565525


File: python.info,  Node: types<7>,  Next: urllib<5>,  Prev: traceback<6>,  Up: 改良されたモジュール<10>

1.11.4.57 types
...............

A new *note DynamicClassAttribute(): 83c. descriptor provides a way to
define an attribute that acts normally when looked up through an
instance object, but which is routed to the 'class' ‘__getattr__’ when
looked up through the class.  This allows one to have properties active
on a class, and have virtual attributes on the class with the same name
(see *note enum: 5a. for an example).  (Contributed by Ethan Furman in
bpo-19030(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19030


File: python.info,  Node: urllib<5>,  Next: unittest<10>,  Prev: types<7>,  Up: 改良されたモジュール<10>

1.11.4.58 urllib
................

*note urllib.request: 111. が新規クラス *note DataHandler: 11d9. を介し
て ‘data:’ URL をサポートするようになりました。 (Contributed by Mathias
Panzenböck in bpo-16423(1).)

*note Request: 11da. クラスで使われる HTTP メソッドを、サブクラスで
*note method: 11db. 属性をセットすることにより指定出来るようになりました
。 (Contributed by Jason R Coombs in bpo-18978(2).)  (--訳注: *note
method: 11db. は 3.3 で追加されたが、コンストラクタに渡されたものが設定
されるだけだった。--)

*note Request: 11da. オブジェクトは今では再利用可能です: *note full_url:
11dc. あるいは *note data: 11dd. 属性などが変更されると、関連する全ての
内部プロパティが更新されます。このことによって今や、例えば、 *note
Request: 11da. オブジェクトを、異なる 'data' 引数での *note
OpenerDirector.open(): 11de. の複数回呼び出し内で使ったり、あるいは、ま
っさらから作り直すのではなく *note Request: 11da. の ‘url’ を書き換えて
使ったり出来ます。新たに *note remove_header(): 11df. メソッドも追加され
ていて、これは *note Request: 11da. からヘッダを取り除きます。
(Contributed by Alexey Kachayev in bpo-16464(3), Daniel Wozniak in
bpo-17485(4), and Damien Brecht and Senthil Kumaran in bpo-17272(5).)

*note HTTPError: 11e0. オブジェクトに、エラーに関係する HTTP レスポンス
ヘッダへのアクセスを提供する *note headers: 11e1. 属性が追加されました。
(Contributed by Berker Peksag in bpo-15701(6).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16423

   (2) https://bugs.python.org/issue?@action=redirect&bpo=18978

   (3) https://bugs.python.org/issue?@action=redirect&bpo=16464

   (4) https://bugs.python.org/issue?@action=redirect&bpo=17485

   (5) https://bugs.python.org/issue?@action=redirect&bpo=17272

   (6) https://bugs.python.org/issue?@action=redirect&bpo=15701


File: python.info,  Node: unittest<10>,  Next: venv<7>,  Prev: urllib<5>,  Up: 改良されたモジュール<10>

1.11.4.59 unittest
..................

The *note TestCase: 2b3. class has a new method, *note subTest(): 11e3,
that produces a context manager whose *note with: 186. block becomes a
"sub-test".  This context manager allows a test method to dynamically
generate subtests by, say, calling the ‘subTest’ context manager inside
a loop.  A single test method can thereby produce an indefinite number
of separately identified and separately counted tests, all of which will
run even if one or more of them fail.  For example:

     class NumbersTest(unittest.TestCase):
         def test_even(self):
             for i in range(6):
                 with self.subTest(i=i):
                     self.assertEqual(i % 2, 0)

これは 6 つのサブテストとなり、それぞれは unittest 内の冗長出力において
、変数名 ‘i’ とその変数への個々の値 (‘i=0’, ‘i=1’, など) からなるラベル
で識別されます。この例の完全なバージョンが *note
サブテストを利用して繰り返しテストの区別を付ける: 11e4. にあります。
(Contributed by Antoine Pitrou in bpo-16997(1).)

*note unittest.main(): 11e5. の 'defaultTest' に、テスト名からなるイテラ
ブルを渡せるようになりました。以前は文字列で単一のテスト名を渡せるだけで
した。 (Contributed by Jyrki Pulliainen in bpo-15132(2).)

テストディスカバリ最中に発生する *note SkipTest: 11e6. (これはテストファ
イル内のモジュールレベルで起こせます) を、エラーとしてではなくスキップと
して報告するようになりました。 (Contributed by Zach Ware in
bpo-16935(3).)

*note discover(): 11e7. が発見したファイルをソートするようになったので、
一貫したテスト順でテスト出来ます。 (Contributed by Martin Melin and Jeff
Ramnani in bpo-16709(4).)

*note TestSuite: ff5. がその実行完了次第すぐに、テスト成功していれば、テ
ストへの参照を取り除くようになりました。ガーベージコレクションを行う
Python インタプリタ上ではこの振る舞いによって、テストへの参照を保持して
いるものが他にない場合のテストのガーベージコレクトを可能にします。この振
る舞いは *note TestSuite: ff5. をサブクラス化して何もしない
‘_removeTestAtIndex’ を定義することで上書き出来ます。 (Contributed by
Tom Wardill, Matt McClure, and Andrew Svetlov in bpo-11798(5).)

テストアサーションの新規コンテキストマネージャ *note assertLogs(): a59.
が追加されました。これはコードブロックが *note logging: 8b. を使ってログ
メッセージを発行しているか確認します。デフォルトでは任意のロガーからの
‘INFO’ 以上のプライオリティを持つメッセージを取れますが、ロガー名と最小
プライオリティの両方とも指定可能です。コンテキストマネージャからの戻りオ
ブジェクトに対して、ログされた *note LogRecord: 11e8. とフォーマットされ
たメッセージの両方あるいはどちらかを問い合わせることが出来ます。
(Contributed by Antoine Pitrou in bpo-18937(6).)

テストディスカバリが名前空間パッケージで動作するようになりました。
(Contributed by Claudiu Popa in bpo-17457(7).)

*note unittest.mock: 10d. オブジェクトが、呼び出しが合致する際に仕様とし
てのシグニチャを検査するようになりました。これはつまり、以前は位置引数だ
けの合致だったものが、位置引数と名前の両方で合致できるようになったという
ことです。(Contributed by Antoine Pitrou in bpo-17015(8).)

*note mock_open(): 11e9. objects now have ‘readline’ and ‘readlines’
methods.  (Contributed by Toshio Kuratomi in bpo-17467(9).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16997

   (2) https://bugs.python.org/issue?@action=redirect&bpo=15132

   (3) https://bugs.python.org/issue?@action=redirect&bpo=16935

   (4) https://bugs.python.org/issue?@action=redirect&bpo=16709

   (5) https://bugs.python.org/issue?@action=redirect&bpo=11798

   (6) https://bugs.python.org/issue?@action=redirect&bpo=18937

   (7) https://bugs.python.org/issue?@action=redirect&bpo=17457

   (8) https://bugs.python.org/issue?@action=redirect&bpo=17015

   (9) https://bugs.python.org/issue?@action=redirect&bpo=17467


File: python.info,  Node: venv<7>,  Next: wave<2>,  Prev: unittest<10>,  Up: 改良されたモジュール<10>

1.11.4.60 venv
..............

*note venv: 117. に ‘csh’ と ‘fish’ シェルの有効化スクリプトが追加されま
した。 (Contributed by Andrew Svetlov in bpo-15417(1).)

*note EnvBuilder: 571. クラスとコンビニエンス関数 *note create(): 572. が
新規キーワード引数 'with_pip' を取るようになりました。デフォルトは
‘False’ です。これは *note EnvBuilder: 571. が仮想環境に ‘pip’ がインス
トールされていることを保証するかどうかを制御します。(Contributed by Nick
Coghlan in bpo-19552(2) as part of the PEP 453(3) implementation.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15417

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19552

   (3) https://peps.python.org/pep-0453/


File: python.info,  Node: wave<2>,  Next: weakref<2>,  Prev: venv<7>,  Up: 改良されたモジュール<10>

1.11.4.61 wave
..............

The *note getparams(): 11ec. method now returns a namedtuple rather than
a plain tuple.  (Contributed by Claudiu Popa in bpo-17487(1).)

*note wave.open(): b45. がコンテキスト管理プロトコルをサポートするように
なりました。 (Contributed by Claudiu Popa in bpo-17616(2).)

*note wave: 119. は *note
シーク不能なファイルへの書き出しが出来るように: 11ed. なりました。
(Contributed by David Jones, Guilherme Polo, and Serhiy Storchaka in
bpo-5202(3).)

*note writeframesraw(): 11ee. メソッドと *note writeframes(): 11ef. メソ
ッドが *note bytes-like object: 193. を受け付けるようになりました。
(Contributed by Serhiy Storchaka in bpo-8311(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17487

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17616

   (3) https://bugs.python.org/issue?@action=redirect&bpo=5202

   (4) https://bugs.python.org/issue?@action=redirect&bpo=8311


File: python.info,  Node: weakref<2>,  Next: xml etree<2>,  Prev: wave<2>,  Up: 改良されたモジュール<10>

1.11.4.62 weakref
.................

新規 *note WeakMethod: 11f1. クラスは、インスタンスメソッドへの弱参照を
シミュレートします。 (Contributed by Antoine Pitrou in bpo-14631(1).)

新規クラス *note finalize: c6f. は、弱参照自身のライフサイクルを注意深く
管理する必要性なしに、オブジェクトがガーベージコレクトされる際に呼び出さ
れるコールバックを登録することを可能にします。 (Contributed by Richard
Oudkerk in bpo-15528(2).)

*note ref: 11f2. に関連付いたコールバック (あれば) を、新規属性 *note
__callback__: 11f3. で取得出来るようになりました。(Contributed by Mark
Dickinson in bpo-17643(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14631

   (2) https://bugs.python.org/issue?@action=redirect&bpo=15528

   (3) https://bugs.python.org/issue?@action=redirect&bpo=17643


File: python.info,  Node: xml etree<2>,  Next: zipfile<6>,  Prev: weakref<2>,  Up: 改良されたモジュール<10>

1.11.4.63 xml.etree
...................

ノンブロッキングなアプリケーションでの XML ドキュメントの解析に、新規パ
ーサ *note XMLPullParser: 11f5. を利用出来ます。実例は *note
非ブロックパースのためのプル API: 11f6. をみてください。 (Contributed by
Antoine Pitrou in bpo-17741(1).)

*note xml.etree.ElementTree: 12b. の関数 *note tostring(): 11f7. 、*note
tostringlist(): 11f8. と、 *note ElementTree: b47. クラスの *note
write(): c8c. メソッドに、 *note キーワード専用引数: 5a5. の
'short_empty_elements' が追加されました。これはコンテンツを持たない要素
を省略形 (‘<tag />’) で書き出すか展開された形 (‘<tag></tag>’) で書き出す
かを制御します。(Contributed by Ariel Poliak and Serhiy Storchaka in
bpo-14377(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17741

   (2) https://bugs.python.org/issue?@action=redirect&bpo=14377


File: python.info,  Node: zipfile<6>,  Prev: xml etree<2>,  Up: 改良されたモジュール<10>

1.11.4.64 zipfile
.................

*note PyZipFile: 11fa. クラスの *note writepy(): 11fb. メソッドに
'filterfunc' オプションが追加されました。これはアーカイブにどのディレク
トリ・ファイルを加えるのかをコントロールするのに使うことが出来ます。例え
ばテスト用ファイルをアーカイブから除外する、などということが出来ます。
(Contributed by Christian Tismer in bpo-19274(1).)

The 'allowZip64' parameter to *note ZipFile: 8d3. and *note PyZipFile:
11fa. is now ‘True’ by default.  (Contributed by William Mallard in
bpo-17201(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19274

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17201


File: python.info,  Node: CPython の実装の変更,  Next: 非推奨<12>,  Prev: 改良されたモジュール<10>,  Up: What's New In Python 3 4

1.11.5 CPython の実装の変更
---------------------------

* Menu:

* PEP 445; CPython のメモリアロケータのカスタマイズ: PEP 445 CPython のメモリアロケータのカスタマイズ.
* PEP 442; オブジェクトの安全なファイナライゼーション: PEP 442 オブジェクトの安全なファイナライゼーション.
* PEP 456; 安全で取り換え可能なハッシュアルゴリズム: PEP 456 安全で取り換え可能なハッシュアルゴリズム.
* PEP 436; Argument Clinic: PEP 436 Argument Clinic.
* その他のビルド並びに C API の変更::
* その他の改善: その他の改善<2>.
* 大幅な最適化::


File: python.info,  Node: PEP 445 CPython のメモリアロケータのカスタマイズ,  Next: PEP 442 オブジェクトの安全なファイナライゼーション,  Up: CPython の実装の変更

1.11.5.1 PEP 445: CPython のメモリアロケータのカスタマイズ
..........................................................

PEP 445(1) は、CPython インタープリタのメモリ割り当てをカスタマイズする
ために新たな C 水準のインターフェイスを追加しました。

参考
....

PEP 445(2) - Python メモリアロケータをカスタマイズするための新 API 追加

     PEP written and implemented by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0445/

   (2) https://peps.python.org/pep-0445/


File: python.info,  Node: PEP 442 オブジェクトの安全なファイナライゼーション,  Next: PEP 456 安全で取り換え可能なハッシュアルゴリズム,  Prev: PEP 445 CPython のメモリアロケータのカスタマイズ,  Up: CPython の実装の変更

1.11.5.2 PEP 442: オブジェクトの安全なファイナライゼーション
............................................................

PEP 442(1) removes the current limitations and quirks of object
finalization in CPython.  With it, objects with *note __del__(): 11ff.
methods, as well as generators with *note finally: 1b0. clauses, can be
finalized when they are part of a reference cycle.

この変更の一環で、モジュールのグローバルは、ほとんどのケースではインタプ
リタのシャットダウン中に強制的に *note None: 885. がセットされることはな
くなり、代わりに循環ガーベージコレクタの通常のオペレーションに委ねます。
このことは、循環 GC が最初に導入されて以来悩みの種だった、普通 ‘__del__’
メソッドを巻き込んだ「インタプリタシャットダウン時エラーの類」全体を回避
します。(--訳注: bpo-18214(2) (superseder for bpo-812369(3)), changeset
84936:79e2f5bbc30c(4) --)

参考
....

PEP 442(5) - オブジェクトの安全なファイナライゼーション

     PEP written and implemented by Antoine Pitrou.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0442/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=18214

   (3) https://bugs.python.org/issue?@action=redirect&bpo=812369

   (4) https://hg.python.org/cpython/rev/79e2f5bbc30c/

   (5) https://peps.python.org/pep-0442/


File: python.info,  Node: PEP 456 安全で取り換え可能なハッシュアルゴリズム,  Next: PEP 436 Argument Clinic,  Prev: PEP 442 オブジェクトの安全なファイナライゼーション,  Up: CPython の実装の変更

1.11.5.3 PEP 456: 安全で取り換え可能なハッシュアルゴリズム
..........................................................

PEP 456(1) は、Python のハッシュアルゴリズムで行われた以前のセキュリティ
修正作業 -- これは公に曝されている辞書検索に裏打ちされた API が標的にな
るかもしれない、特定の DOS 攻撃に対処するものです -- に追従するものです
(この改善の現在ラウンドの事の起こりについては bpo-14621(2) を見てくださ
い)。この PEP では、 CPython のハッシュのコードをパッケージャが異なるハ
ッシュアルゴリズムへの差し替えを容易にするために一元化し、そして Python
のデフォルト実装としては 64 ビットデータ型を持つプラットフォームで
SipHash に乗り換えます。以前の FNV アルゴリズムと比較したどんなパフォー
マンスの差異も、些細なものです。

The PEP adds additional fields to the *note sys.hash_info: 1201. named
tuple to describe the hash algorithm in use by the currently executing
binary.  Otherwise, the PEP does not alter any existing CPython APIs.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0456/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=14621


File: python.info,  Node: PEP 436 Argument Clinic,  Next: その他のビルド並びに C API の変更,  Prev: PEP 456 安全で取り換え可能なハッシュアルゴリズム,  Up: CPython の実装の変更

1.11.5.4 PEP 436: Argument Clinic
.................................

「Argument Clinic」( PEP 436(1)) は CPython ビルドプロセスの新たな鍋の具
です。ビルトインと標準ライブラリの拡張モジュールが C で実装されるにあた
って、正確なシグニチャを定義し保守管理するプロセスを単純化するのに使えま
す。

Python 3.4 では既にいくつかの標準ライブラリ拡張モジュールが Argument
Clinic を使うように変換されていて、またこれの結果として *note pydoc: ba.
と *note inspect: 82. が更新されました。

Python 3.4 メンテナンスリリースでの更新の一部として C で実装されている
callable に対して、プログラム的なイントロスペクションのためのシグニチャ
メタデータの追加が、さらに追加で行われることが期待されています。

     注釈: Argument Clinic の PEP は、実装されている状態に対して完全には
     最新のものとはなっていません。Argument Clinic は Python 3.4 ではサ
     ードパーティに向けた公開 API として利用可能とする予定ではないので、
     このケースではリリース管理者とコア開発チームによって許容出来るとみ
     なされました。

参考
....

PEP 436(2) - The Argument Clinic DSL (訳注: DSL=Domain-Specific Language)

     PEP written and implemented by Larry Hastings.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0436/

   (2) https://peps.python.org/pep-0436/


File: python.info,  Node: その他のビルド並びに C API の変更,  Next: その他の改善<2>,  Prev: PEP 436 Argument Clinic,  Up: CPython の実装の変更

1.11.5.5 その他のビルド並びに C API の変更
..........................................

   * *note PyType_GetSlot(): a9c. 関数が、安定 ABI に追加されました。こ
     れにより、制限 API を使う際に名前の付いた型のスロットから関数ポイン
     タを取り出すことが出来ます。(Contributed by Martin von Löwis in
     bpo-17162(1).)  (--訳注: 安定 ABI, 制限 API については What's New
     In Python 3.2 ( PEP 384(2)) を参照。--)

   * The new ‘Py_SetStandardStreamEncoding()’ pre-initialization API
     allows applications embedding the CPython interpreter to reliably
     force a particular encoding and error handler for the standard
     streams.  (Contributed by Bastien Montagne and Nick Coghlan in
     bpo-16129(3).)

   * 文字列引数を変更することのない Python C API のほとんどが、 ‘char *’
     ではなく適切に ‘const char *’ として宣言されました。 (Contributed
     by Serhiy Storchaka in bpo-1772673(4).)

   * Python インタプリタが利用出来ない場合 (例えばクロスコンパイルのシナ
     リオ) であっても使える、シェルで書き直したバージョンの
     ‘python-config’ が追加されました。

   * *note PyUnicode_FromFormat(): 62b. が ‘%s’, ‘%A’, ‘%U’, ‘%V’, ‘%S’,
     ‘%R’ についての幅と精度の指定をサポートするようになりました。
     (Contributed by Ysj Ray and Victor Stinner in bpo-7330(5).)

   * 既存の *note PyStructSequence_InitType(): 1204. 関数を補うものとし
     て、 *note PyStructSequence_InitType2(): 1205. が追加されました。違
     いは、これは成功時に ‘0’ 、失敗時に ‘-1’ を返すことです。

   * CPython のソースを、最近の GCC と clang のアドレスサニティチェック
     機能を使ってコンパイル出来るようにしました: 小さなオブジェクト用ア
     ロケータで起こっていた偽の警報を黙らせました。 (Contributed by
     Dhiru Kholia in bpo-18596(6).)

   * Windows ビルドに アドレス空間配置のランダム化(7) と データ実行防止
     (8) を使うようにしました。 (Contributed by Christian Heimes in
     bpo-16632(9).)

   * *note operator.length_hint(): 116f. と等価な C API 関数 *note
     PyObject_LengthHint(): 1206. が追加されました。 (Contributed by
     Armin Ronacher in bpo-16148(10).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17162

   (2) https://peps.python.org/pep-0384/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=16129

   (4) https://bugs.python.org/issue?@action=redirect&bpo=1772673

   (5) https://bugs.python.org/issue?@action=redirect&bpo=7330

   (6) https://bugs.python.org/issue?@action=redirect&bpo=18596

   (7) https://en.wikipedia.org/wiki/Address_space_layout_randomization

   (8) https://en.wikipedia.org/wiki/Data_Execution_Prevention

   (9) https://bugs.python.org/issue?@action=redirect&bpo=16632

   (10) https://bugs.python.org/issue?@action=redirect&bpo=16148


File: python.info,  Node: その他の改善<2>,  Next: 大幅な最適化,  Prev: その他のビルド並びに C API の変更,  Up: CPython の実装の変更

1.11.5.6 その他の改善
.....................

   * The *note python: 1209. command has a new *note option: 120a, ‘-I’,
     which causes it to run in "isolated mode", which means that *note
     sys.path: 3e4. contains neither the script's directory nor the
     user's ‘site-packages’ directory, and all ‘PYTHON*’ environment
     variables are ignored (it implies both ‘-s’ and ‘-E’).  Other
     restrictions may also be applied in the future, with the goal being
     to isolate the execution of a script from the user's environment.
     This is appropriate, for example, when Python is used to run a
     system script.  On most POSIX systems it can and should be used in
     the ‘#!’ line of system scripts.  (Contributed by Christian Heimes
     in bpo-16499(1).)

   * *note readline: bf. をサポートするプラットフォームで、対話インタプ
     リタでの ‘Tab’ キーでの補完がデフォルトで有効になりました。履歴もデ
     フォルトで有効となり、 ‘~/.python-history’ に書き込まれ (そしてそこ
     から読み込まれ) ます。 (Contributed by Antoine Pitrou and Éric
     Araujo in bpo-5845(2).)

   * Python インタプリタの ‘--version’ での起動時、標準エラーではなく標
     準出力にバージョン情報を出力するようになりました (bpo-18338(3))。同
     じ変更は *note argparse: 7. モジュールに対して (bpo-18920(4))、また
     、スクリプトとして呼び出せる機能を持つモジュールに対して
     (bpo-18922(5)) も行われました。

   * CPython の Windows インストーラが、拡張子を登録する際に ‘PATHEXT’ に
     ‘.py’ を追加するようになりました。これをするとユーザは、 Windows コ
     マンドプロンプトから Python スクリプトを、 ‘.py’ 拡張子なしでその名
     前だけタイプして実行出来ます。 (Contributed by Paul Moore in
     bpo-18569(6).)

   * A new ‘make’ target coverage-report(7) will build python, run the
     test suite, and generate an HTML coverage report for the C codebase
     using ‘gcov’ and lcov(8).

   * The ‘-R’ option to the *note python regression test suite: 120b.
     now also checks for memory allocation leaks, using *note
     sys.getallocatedblocks(): 11c9.  (Contributed by Antoine Pitrou in
     bpo-13390(9).)

   * ‘python -m’ が名前空間パッケージで動くようになりました。

   * *note stat: d6. モジュールが C で実装されました。これは以前問題であ
     った Python モジュール内で値をハードコードすることなく、定数を C ヘ
     ッダファイルから取りこめることを意味しています。(--訳注:
     bpo-11016(10) 、特に msg127114(11) 以降参照。--)

   * 単一の OS モジュール (POSIX の ‘.so’ と Windows の ‘.dll’) からの複
     数 Python モジュールのロードを正しく行えるようになりました (以前は
     黙ってファイル内の最初のモジュールだけが返されていました)。
     (Contributed by Václav Šmilauer in bpo-16421(12).)

   * A new opcode, ‘LOAD_CLASSDEREF’, has been added to fix a bug in the
     loading of free variables in class bodies that could be triggered
     by certain uses of *note __prepare__: e58.  (Contributed by
     Benjamin Peterson in bpo-17853(13).)

   * Victor Stinner が、彼の PEP 445(14) ベースの ‘pyfailmalloc’ ツール
     を用いて数多くのメモリエラー関連のクラッシュを特定し、そして修正し
     ました。 (bpo-18408(15), bpo-18520(16))

   * ‘pyvenv’ コマンドに、シンボリックリンクがデフォルトのシステムでもそ
     うせずにコピーを使うようにするための ‘--copies’ オプションが追加さ
     れました。 (Contributed by Vinay Sajip in bpo-18807(17).)

   * ‘pyvenv’ コマンドにはさらに、そうしなければ自動的に仮想環境に pip が
     ブートストラップされてしまうのを抑制するための、 ‘--without-pip’ オ
     プションが追加されました。(Contributed by Nick Coghlan in
     bpo-19552(18) as part of the PEP 453(19) implementation.)

   * 環境変数 *note PYTHONIOENCODING: 120c. の値内で、エンコーディング名
     を省略出来るようになりました。つまり、デフォルトエンコーディングを
     変更することなしにエラーハンドラだけをセット出来ます。 (Contributed
     by Serhiy Storchaka in bpo-18818(20).)

   * *note bz2: 14.、*note lzma: 8e.、*note gzip: 6b. モジュールの
     ‘open’ 関数が ‘x’ (排他的作成) モードをサポートするようになりました
     。 (Contributed by Tim Heaney and Vajrasky Kok in bpo-19201(21),
     bpo-19222(22), and bpo-19223(23).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16499

   (2) https://bugs.python.org/issue?@action=redirect&bpo=5845

   (3) https://bugs.python.org/issue?@action=redirect&bpo=18338

   (4) https://bugs.python.org/issue?@action=redirect&bpo=18920

   (5) https://bugs.python.org/issue?@action=redirect&bpo=18922

   (6) https://bugs.python.org/issue?@action=redirect&bpo=18569

   (7) 
https://devguide.python.org/coverage/#measuring-coverage-of-c-code-with-gcov-and-lcov

   (8) https://github.com/linux-test-project/lcov

   (9) https://bugs.python.org/issue?@action=redirect&bpo=13390

   (10) https://bugs.python.org/issue?@action=redirect&bpo=11016

   (11) https://bugs.python.org/issue11016#msg127114

   (12) https://bugs.python.org/issue?@action=redirect&bpo=16421

   (13) https://bugs.python.org/issue?@action=redirect&bpo=17853

   (14) https://peps.python.org/pep-0445/

   (15) https://bugs.python.org/issue?@action=redirect&bpo=18408

   (16) https://bugs.python.org/issue?@action=redirect&bpo=18520

   (17) https://bugs.python.org/issue?@action=redirect&bpo=18807

   (18) https://bugs.python.org/issue?@action=redirect&bpo=19552

   (19) https://peps.python.org/pep-0453/

   (20) https://bugs.python.org/issue?@action=redirect&bpo=18818

   (21) https://bugs.python.org/issue?@action=redirect&bpo=19201

   (22) https://bugs.python.org/issue?@action=redirect&bpo=19222

   (23) https://bugs.python.org/issue?@action=redirect&bpo=19223


File: python.info,  Node: 大幅な最適化,  Prev: その他の改善<2>,  Up: CPython の実装の変更

1.11.5.7 大幅な最適化
.....................

   * UTF-32 デコーダが3-4倍速くなりました。 (Contributed by Serhiy
     Storchaka in bpo-14625(1).)

   * 集合に対するハッシュ衝突のコストが削減されました。ハッシュテーブル
     の個々の検査 (probe) で、ハッシュテーブル全体を通したランダムな検査
     を行う前に、連続する隣接したキー/ハッシュペアをチェックするようにな
     りました。これは、キャッシュ局所性を利用して衝突解決のコストを減ら
     します。この衝突解決戦略は、リニア検査とオープンアドレッシング法の
     ハイブリッドとして説明できます。追加的なリニア検査の数はデフォルト
     では 9 です。この値は、コンパイル時に LINEAR_PROBES を定義すること
     で任意の値に変更できます。リニア検査を完全に無効にするには
     LINEAR_PROBES=0 を設定してください。 (Contributed by Raymond
     Hettinger in bpo-18771(2).)

   * インタプリタの起動が約 30% 高速化されました。この速度向上は、いくつ
     かの手段によってもたらされました。インタプリタは起動時により少数の
     モジュールをロードするようになりました。例えば *note re: be, *note
     collections: 1e, *note locale: 8a. モジュール、およびそれらの依存モ
     ジュールは、デフォルトではインポートされません。 marshal モジュール
     は、コンパイルされた Python コードをより高速にロードできるように改
     善されました。 (Contributed by Antoine Pitrou, Christian Heimes and
     Victor Stinner in bpo-19219(3), bpo-19218(4), bpo-19209(5),
     bpo-19205(6) and bpo-9548(7).)

   * *note bz2.BZ2File: a66. が大半の場合 Python2 のバージョン以上に速く
     なりました。*note lzma.LZMAFile: 120e. も最適化されました。
     (Contributed by Serhiy Storchaka and Nadeem Vawda in bpo-16034(8).)

   * *note random.getrandbits(): 120f. が (通常使用される) 小さな整数に
     対して20%-40% 早くなりました。 (Contributed by Serhiy Storchaka in
     bpo-16674(9).)

   * 文字列のストレージ形式を変更したことにより、文字列のピックル化は非
     常に速くなりました。(Contributed by Victor Stinner and Antoine
     Pitrou in bpo-15596(10).)

   * A performance issue in ‘io.FileIO.readall()’ has been solved.  This
     particularly affects Windows, and significantly speeds up the case
     of piping significant amounts of data through *note subprocess: dc.
     (Contributed by Richard Oudkerk in bpo-15758(11).)

   * *note html.escape(): 1210. が10倍速くなりました。(Contributed by
     Matt Bryant in bpo-18020(12).)

   * Windows において、 ‘obmalloc’ で CRT の ‘malloc’ の代わりにネイティ
     ブの ‘VirtualAlloc’ を使うようになりました。人工的なベンチマーク結
     果は、メモリー消費が 3% 減ったことを示しています。

   * *note os.urandom(): 746. now uses a lazily opened persistent file
     descriptor so as to avoid using many file descriptors when run in
     parallel from multiple threads.  (Contributed by Antoine Pitrou in
     bpo-18756(13).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14625

   (2) https://bugs.python.org/issue?@action=redirect&bpo=18771

   (3) https://bugs.python.org/issue?@action=redirect&bpo=19219

   (4) https://bugs.python.org/issue?@action=redirect&bpo=19218

   (5) https://bugs.python.org/issue?@action=redirect&bpo=19209

   (6) https://bugs.python.org/issue?@action=redirect&bpo=19205

   (7) https://bugs.python.org/issue?@action=redirect&bpo=9548

   (8) https://bugs.python.org/issue?@action=redirect&bpo=16034

   (9) https://bugs.python.org/issue?@action=redirect&bpo=16674

   (10) https://bugs.python.org/issue?@action=redirect&bpo=15596

   (11) https://bugs.python.org/issue?@action=redirect&bpo=15758

   (12) https://bugs.python.org/issue?@action=redirect&bpo=18020

   (13) https://bugs.python.org/issue?@action=redirect&bpo=18756


File: python.info,  Node: 非推奨<12>,  Next: 削除<12>,  Prev: CPython の実装の変更,  Up: What's New In Python 3 4

1.11.6 非推奨
-------------

このセクションでは、Python 3.4 で非推奨となり Python 3.5 以降で削除予定
となる、様々な API とその他機能性についてをカバーします。(全てではありま
せんが) ほとんどのケースで、非推奨に対する警告を (たとえば ‘-Wd’ を使っ
て) 有効にしたインタプリタ起動時、非推奨 API を使うと *note
DeprecationWarning: 1a3. を励起します。

* Menu:

* Python API の非推奨項目::
* 非推奨の機能::


File: python.info,  Node: Python API の非推奨項目,  Next: 非推奨の機能,  Up: 非推奨<12>

1.11.6.1 Python API の非推奨項目
................................

   * As mentioned in *note PEP 451; インポートシステムのための
     ModuleSpec 型: 10dc, a number of *note importlib: 7b. methods and
     functions are deprecated: ‘importlib.find_loader()’ is replaced by
     *note importlib.util.find_spec(): 5af.;
     ‘importlib.machinery.PathFinder.find_module()’ is replaced by *note
     importlib.machinery.PathFinder.find_spec(): 1213.;
     ‘importlib.abc.MetaPathFinder.find_module()’ is replaced by *note
     importlib.abc.MetaPathFinder.find_spec(): a68.;
     ‘importlib.abc.PathEntryFinder.find_loader()’ and ‘find_module()’
     are replaced by *note importlib.abc.PathEntryFinder.find_spec():
     a6c.; all of the ‘XXXLoader’ ABC ‘load_module’ methods
     (‘importlib.abc.Loader.load_module()’,
     ‘importlib.abc.InspectLoader.load_module()’,
     ‘importlib.abc.FileLoader.load_module()’,
     ‘importlib.abc.SourceLoader.load_module()’) should no longer be
     implemented, instead loaders should implement an ‘exec_module’
     method (*note importlib.abc.Loader.exec_module(): a6a, *note
     importlib.abc.InspectLoader.exec_module(): 1214. *note
     importlib.abc.SourceLoader.exec_module(): 1215.) and let the import
     system take care of the rest; and
     ‘importlib.abc.Loader.module_repr()’,
     ‘importlib.util.module_for_loader()’,
     ‘importlib.util.set_loader()’, and ‘importlib.util.set_package()’
     are no longer needed because their functions are now handled
     automatically by the import system.

   * The ‘imp’ module is pending deprecation.  To keep compatibility
     with Python 2/3 code bases, the module's removal is currently not
     scheduled.

   * The ‘formatter’ module is pending deprecation and is slated for
     removal in Python 3.6.

   * *note hmac.new(): c96. 関数の 'digestmod' がデフォルトで暗黙に
     ‘MD5’ を使う仕様は撤廃されます。Python 3.6 では 'digestmod' 引数に
     は明示的にダイジェスト名かコンストラクタを渡すことが求められます。

   * *note ftplib: 62. モジュール内の内部クラス ‘Netrc’ はずっと長いこと
     そのドキュメンテーション文字列内で非推奨であることを謳ってきました
     。これは今や *note DeprecationWarning: 1a3. を発行します。Python
     3.5 ではこのクラスは完全に削除されます。

   * *note subprocess.Popen.wait(): ee0. の文書化されていない引数
     'endtime' は本来曝してはいけないものでしたので、使用されていないこ
     とを願っています。これは非推奨ですし、確実に Python 3.5 では削除さ
     れるのではないでしょうか。(--訳注: 3.5 では削除はされませんでしたが
     、もちろん使用しないでください。これは内部用です。--)

   * *note HTMLParser: a77. の 'strict' 引数は非推奨です。

   * The *note plistlib: b0. ‘readPlist()’, ‘writePlist()’,
     ‘readPlistFromBytes()’, and ‘writePlistToBytes()’ functions are
     deprecated in favor of the corresponding new functions *note
     load(): b48, *note dump(): b4a, *note loads(): b49, and *note
     dumps(): b4b.  ‘Data()’ is deprecated in favor of just using the
     *note bytes: 192. constructor.

   * *note sysconfig: e1. のキー ‘SO’ は非推奨です。これは ‘EXT_SUFFIX’
     に取って代わられました。

   * 種々の ‘open’ 関数で受け付けられていた ‘U’ モードは非推奨となりまし
     た。Python 3 ではこれは何も役に立つことはしません。 *note
     io.TextIOWrapper: 9be. (必要ならば)、 'newline' 引数を適切に使うこ
     とによって置き換えられるはずです。

   * *note xml.etree.ElementTree.iterparse(): 57a. の 'parser' 引数と
     *note XMLParser(): c49. の 'html' 引数が非推奨となりました。後者は
     (訳注: 第一引数のため) 削除に備えて ‘XMLParser’ への全ての引数はキ
     ーワード引数として渡すようにしてください。


File: python.info,  Node: 非推奨の機能,  Prev: Python API の非推奨項目,  Up: 非推奨<12>

1.11.6.2 非推奨の機能
.....................

   * *note IDLE -- Python のエディタとシェル: 1217. の ‘-n’ フラグでの実
     行 (サブプロセスを起こさない) は非推奨となりました。ただし、この機
     能は bpo-18823(1) が解決するまでは削除はされません。

   * *note site: cc. モジュールは "site-python" ディレクトリが存在すれば
     これを sys.path に加えていましたが、これは非推奨となりました。
     (bpo-19375(2))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18823

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19375


File: python.info,  Node: 削除<12>,  Next: Python 3 4 への移植,  Prev: 非推奨<12>,  Up: What's New In Python 3 4

1.11.7 削除
-----------

* Menu:

* サポートされなくなったオペレーティングシステム::
* API と機能の削除: API と機能の削除<5>.
* コードの整理::


File: python.info,  Node: サポートされなくなったオペレーティングシステム,  Next: API と機能の削除<5>,  Up: 削除<12>

1.11.7.1 サポートされなくなったオペレーティングシステム
.......................................................

以下の OS 向けのソースとビルドツールは削除されました。

   * OS/2 (bpo-16135(1))。

   * Windows 2000 (changeset e52df05b496a(2))。

   * ‘COMSPEC’ が ‘command.com’ を指している Windows システム
     (bpo-14470(3)).

   * VMS (bpo-16136(4))。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16135

   (2) https://hg.python.org/cpython/rev/e52df05b496a

   (3) https://bugs.python.org/issue?@action=redirect&bpo=14470

   (4) https://bugs.python.org/issue?@action=redirect&bpo=16136


File: python.info,  Node: API と機能の削除<5>,  Next: コードの整理,  Prev: サポートされなくなったオペレーティングシステム,  Up: 削除<12>

1.11.7.2 API と機能の削除
.........................

時代遅れとなり、以前に既に非推奨となった以下の API と機能が削除されまし
た:

   * 保守されていなかった ‘Misc/TextMate’ と ‘Misc/vim’ ディレクトリは削
     除されました (代わりに何が使えるかの提案は devguide(1) をみてくださ
     い -- 訳注: おそらく Additional Resources(2) に挙げられている
     wiki(3) を指している --)。

   * makefile のマクロ ‘SO’ は削除されました (これは ‘SHLIB_SUFFIX’ マク
     ロと ‘EXT_SUFFIX’ マクロで置き換えられました) (bpo-16754(4))。

   * ‘PyThreadState.tick_counter’ フィールドは削除されました。これは
     Python 3.2 で「新しい GIL」が導入された際に意味をなくしていました。
     (bpo-19199(5)).

   * ‘PyLoader’ と ‘PyPycLoader’ が *note importlib: 7b. から削除されま
     した。 (Contributed by Taras Lyapun in bpo-15641(6).)

   * *note HTTPConnection: d35. と *note HTTPSConnection: d36. の
     'strict' 引数は削除されました。 HTTP 0.9 スタイルの 「Simple
     Responses」はもはやサポートされません。

   * *note urllib.request.Request: 11da. の非推奨となっていた
     getter/setter メソッドの ‘add_data’, ‘has_data’, ‘get_data’,
     ‘get_type’, ‘get_host’, ‘get_selector’, ‘set_proxy’,
     ‘get_origin_req_host’, ‘is_unverifiable’ は削除されました (代わりに
     属性アクセスを直接使ってください)。

   * 非推奨の ‘TYPE_INT64’ ロードのサポートが *note marshal: 91. から削
     除されました。 (Contributed by Dan Riti in bpo-15480(7).)

   * *note inspect.Signature: 4e3.: 位置専用パラメータを示すのに今では正
     当な名前が必要です。

   * object 自身の *note object.__format__(): 831. はもはや空でないフォ
     ーマット文字列を受け付けず、 *note TypeError: 198. を投げます。空で
     ない文字列を渡すことは既に Python 3.2 で非推奨となっていました。こ
     の変更は以前は動作した (そして正しくない) コードが、オブジェクトが
     __format__ メソッドを得ることで処理に失敗し始めていた状況を防ぐ目的
     でなされました。この変更が意味することはあなたのコードにとって、そ
     れを処理する __format__ メソッドを持たないオブジェクトに ‘s’ フォー
     マットコードを使うと *note TypeError: 198. を起こしうるようになった
     、ということです。背景については bpo-7994(8) を参照して下さい。
     (--訳注: このパラグラフの中盤が非常にわかりにくい表現で訳者も意味を
     取りきれていませんが、おそらく Python 2.6/3.0 で動作していた例えば
     ‘format(1+1j, '10s')’ が Python 2.7/3.1 で動作しなくなったことを指
     しているのだと思います。問題にされているのは動作しなくなったことで
     はなくてむしろ動作していたことで、そして object.__format__ が
     return str(self).__format__(fmt) で実現されていること。このコードで
     は fmt は何らの意味も持っていませんので、これは一貫性に欠ける要因で
     ある、とのことで、「わかりやすく拒絶する」ことが真意であるようです
     --)

   * ‘difflib.SequenceMatcher.isbjunk()’ and
     ‘difflib.SequenceMatcher.isbpopular()’ were deprecated in 3.2, and
     have now been removed: use ‘x in sm.bjunk’ and ‘x in sm.bpopular’,
     where 'sm' is a *note SequenceMatcher: 121b. object (bpo-13248(9)).

   ---------- Footnotes ----------

   (1) https://devguide.python.org

   (2) https://devguide.python.org/#additional-resources

   (3) https://wiki.python.org/moin/PythonEditors

   (4) https://bugs.python.org/issue?@action=redirect&bpo=16754

   (5) https://bugs.python.org/issue?@action=redirect&bpo=19199

   (6) https://bugs.python.org/issue?@action=redirect&bpo=15641

   (7) https://bugs.python.org/issue?@action=redirect&bpo=15480

   (8) https://bugs.python.org/issue?@action=redirect&bpo=7994

   (9) https://bugs.python.org/issue?@action=redirect&bpo=13248


File: python.info,  Node: コードの整理,  Prev: API と機能の削除<5>,  Up: 削除<12>

1.11.7.3 コードの整理
.....................

   * *note pydoc: ba. モジュールで、使用されておらず文書化もされていなか
     った内部的な ‘Scanner’ クラスが削除されました。

   * ひどく壊れていた OSX システムで呼ばれる可能性があるのみだった *note
     platform: af. モジュールの非公開関数 ‘_mac_ver_lookup’,
     ‘_mac_ver_gstalt’, ‘_bcd2str’ とあわせて、非公開かつ実質的に未使用
     だった ‘_gestalt’ モジュールが削除されました。 (see bpo-18393(1))

   * *note tarfile: e4. モジュールの名前空間内に *note stat: d6. 定数群
     がハードコードでコピーされていましたが、これは削除されました。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18393


File: python.info,  Node: Python 3 4 への移植,  Next: 3 4 3 の変更,  Prev: 削除<12>,  Up: What's New In Python 3 4

1.11.8 Python 3.4 への移植
--------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

* Menu:

* 'python' コマンドの挙動の変更: 'python' コマンドの挙動の変更<2>.
* Python API の変更: Python API の変更<11>.
* C API の変更: C API の変更<15>.


File: python.info,  Node: 'python' コマンドの挙動の変更<2>,  Next: Python API の変更<11>,  Up: Python 3 4 への移植

1.11.8.1 'python' コマンドの挙動の変更
......................................

   * POSIX シェルでは、環境変数 ‘PATH’ に空の値をセットすることは、何も
     セットしないことと同じです。ところが *note PYTHONPATH: 121f. に空の
     値をセットすることは、何もセットしないことと 'まったく同じではあり
     ませんでした': *note PYTHONPATH: 121f. に空の値をセットすると、 ‘.’
     をセットしたのと同じ意味になっていて、これは ‘PATH’ での振舞いから
     類推しようとすると混乱を招くものでした。この振る舞いは ‘PATH’ での
     POSIX の慣習に従うように改められました。

   * CPython インタプリタのデバッグビルド (‘--with-pydebug’) での出力 [X
     refs, Y blocks] がデフォルトではオフになりました。 ‘-X
     showrefcount’ オプション起動で再度有効に出来ます。 (Contributed by
     Ezio Melotti in bpo-17323(1).)

   * ‘python’ コマンドとほとんどの標準ライブラリスクリプト (また *note
     argparse: 7. も) において、 ‘--version’ が情報出力を ‘stderr’ では
     なく ‘stdout’ に行うようになりました (issue へのリンクは *note
     その他の改善: 1208. セクション内参照)。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17323


File: python.info,  Node: Python API の変更<11>,  Next: C API の変更<15>,  Prev: 'python' コマンドの挙動の変更<2>,  Up: Python 3 4 への移植

1.11.8.2 Python API の変更
..........................

   * *note importlib.abc: 7c. 内に定義されている ABC は、無分別に *note
     NotImplementedError: 36b. を投げるのではなく、相応しい例外を投げる
     かデフォルト値を返すかのどちらかになりました。このことは *note
     super(): 1a6. を呼び出して ABC がするがままに任せているコードにのみ
     影響します。互換性のために、必要であれば *note NotImplementedError:
     36b. とその投げられる新たな例外の両方を捕捉してください。

   * The module type now initializes the *note __package__: 323. and
     *note __loader__: 33b. attributes to ‘None’ by default.  To
     determine if these attributes were set in a backwards-compatible
     fashion, use e.g.  ‘getattr(module, '__loader__', None) is not
     None’.  (bpo-17115(1).)

   * ‘importlib.util.module_for_loader()’ now sets ‘__loader__’ and
     ‘__package__’ unconditionally to properly support reloading.  If
     this is not desired then you will need to set these attributes
     manually.  You can use ‘importlib.util.module_to_load()’ for module
     management.

   * インポートがリロードの際に無条件に関連属性 (例えば ‘__name__’,
     ‘__loader__’, ‘__package__’, ‘__file__’, ‘__cached__’) をリセットす
     るようになりました。これは、3.3 以前のリロードの際にモジュールを再
     発見する振る舞いと同じものを復元するものであるということを注記して
     おきます。 (bpo-19413(2))

   * 凍結パッケージ (frozen package) はもはや ‘__path__’ にパッケージ名
     を含むリストをセットせず、空リストをセットします。この以前の振る舞
     いは、凍結パッケージと同じ名前を持つディレクトリが存在する場合のサ
     ブモジュールのインポートで、インポートシステムが間違ったことを起こ
     しうるものでした。モジュールがパッケージなのかそうでないのかを決め
     る正しい方法は、 ‘hasattr(module, '__path__')’ を使うことです。
     (bpo-18065(3))

   * Frozen modules no longer define a ‘__file__’ attribute.  It's
     semantically incorrect for frozen modules to set the attribute as
     they are not loaded from any explicit location.  If you must know
     that a module comes from frozen code then you can see if the
     module's ‘__spec__.location’ is set to ‘'frozen'’, check if the
     loader is a subclass of *note importlib.machinery.FrozenImporter:
     1220, or if Python 2 compatibility is necessary you can use
     ‘imp.is_frozen()’.

   * *note py_compile.compile(): c1a. が書き込み先ファイルパスがシンボリ
     ックリンクか非レギュラーファイルの場合に *note FileExistsError:
     1221. を投げるようになりました。これは、警告の役割を果たすためです
     、インポートがファイルパスの元のファイルタイプが何かによらずに、そ
     れらファイルをレギュラーファイルで上書きすることの。

   * ソースコードをロードしようとして *note SyntaxError: 18e. かもしくは
     *note UnicodeDecodeError: c08. を引き起こした場合に、 *note
     importlib.abc.SourceLoader.get_source(): 1222. はそれを *note
     ImportError: 65b. に読み替えて投げることをしなくなりました。 *note
     ImportError: 65b. はそうあるべきなのに見つからない場合にのみ投げら
     れるべきなので、ソースコードが見つかったけれども正しくない構造であ
     る場合の意味にまで及ぶのは、手を伸ばし過ぎで過負荷です。ImportError
     を捕捉していたコードで今後とも構文エラーとデコーディングの問題を無
     視したいと望むならば、これら 3 つ全ての例外を捕捉するようにしてくだ
     さい。 (訳注: changeset 84172:e353f64dfd95(4) )

   * *note functools.update_wrapper(): 1223. と *note functools.wraps():
     115f. が、たとえその関数も ‘__wrapped__’ を持っていたとしても正しく
     その関数が包まれるように ‘__wrapped__’ 属性値をセットするようになり
     ました。つまり ‘__wrapped__’ 属性は、以前のようにチェイン内の全ての
     ‘__wrapped__’ 属性が最も内側の関数を参照するのではなく、デコレート
     された関数の積み上げを正しくリンクするようになったということです。
     以前の振る舞いが意図されたものであると思い込んでいたイントロスペク
     ションライブラリの作者は、チェインの中の最初の関数 (‘__wrapped__’ 属
     性を持たない) にアクセスするのに *note inspect.unwrap(): 115e. を使
     えます。(--訳注: bpo-17482(5).  わかりにくいので実例で。中で適切に
     @wrap を使うデコレータ @deco1、@deco2 があるとして、my_func をこの
     両方でデコレートするとします。この場合に、Python 3.3 までは
     ‘my_func.__wrapped__.__wrapped__’ が AttributeError になります。今
     回のこの修正で ‘my_func.__wrapped__.__wrapped__’ は期待通りに振舞い
     ます。 --)

   * *note inspect.getfullargspec(): 941. は、 *note
     inspect.signature(): 22f. を前提とした再実装がなされました。これに
     より、かつて扱えていたよりも遥かに広い種類の呼び出し可能 (callable)
     を扱うようになりました (訳注: 例えば *note open(): 316. などは
     Python 3.3 までは扱えなかった)。Python 3.4 系列の経過のなかで、追加
     で組み込みや拡張モジュールの callable がシグニチャのメタデータを持
     つことが期待されています。 *note inspect.getfullargspec(): 941. が
     非 Python callable で失敗することを前提としたコードは、適宜調整の必
     要があるかもしれません。

   * *note importlib.machinery.PathFinder: 1224. は *note
     sys.path_hooks: 1225. 内のオブジェクトに、空文字列の場合は現在作業
     ディレクトリを渡すようになりました。結果の *note
     sys.path_importer_cache: 7fa. が決して ‘''’ を含まないことになるの
     で、 *note sys.path: 3e4. に基いて *note sys.path_importer_cache:
     7fa. を巡回しても全てのキーを見つけられません。インタプリタを ‘-m’
     で起動した場合も含め、現在作業ディレクトリ内でインポートされた際の
     モジュールの ‘__file__’ も絶対パスで持つようになりました (ただしス
     クリプトがコマンドラインから相対パスを使って直接実行された際の
     ‘__main__.__file__’ を除きます (Contributed by Brett Cannon in
     bpo-18416(6)))。 (bpo-18416(7))

   * *note HTTPConnection: d35. と *note HTTPSConnection: d36. から
     'strict' 引数が削除されたことは、残りの引数をキーワード引数としてで
     はなく位置引数として使っていたなら意味が変わってしまいます。非推奨
     警告に注意を払ってきたのであれば、あなたのコードは既に全てのオプシ
     ョナル引数をキーワードで渡しているはずです。

   * ‘from __future__ import ...’ ステートメントの間に文字列が含まれる場
     合に '常に' *note SyntaxError: 18e. となるようになりました。以前は
     モジュールの docstring が先頭にある場合とない場合で振る舞いが違って
     いて、ない場合にこのエラーが意図せず無視される場合がありました。こ
     の修正は CPython を言語仕様に準拠させるものです。Jython と PyPy で
     は既にこれが行われています。 (bpo-17434(8))

   * *note ssl.SSLSocket.getpeercert(): 11ba. と *note
     ssl.SSLSocket.do_handshake(): 106d. は、 ‘SSLSocket’ が未接続時に以
     前は *note AttributeError: 5f0. を投げていましたが、 ‘ENOTCONN’ を
     持った *note OSError: 2c0. を投げるように改められました。加えて
     *note getpeercert(): 11ba. はハンドシェイクが未実施の場合に *note
     ValueError: 2ec. を投げるようになりました。

   * *note base64.b32decode(): 1226. が入力文字列が非 b32 文字を含む場合
     に *note TypeError: 198. ではなく *note binascii.Error: 1227. を投
     げるようになりました。今回のこの *note TypeError: 198. はほか (訳注
     : if the input is incorrectly padded のとき) の *note TypeError:
     198. が置き換えられた際に置き換え忘れられたものでした。
     (Contributed by Serhiy Storchaka in bpo-18011(9).)  注意: この修正
     は後方互換性を保てないので本来メンテナンスリリースの Python 3.3 に
     は入るべきではなかったのですが、不注意で Python 3.3.3 にも行われて
     しまいました。

   * The ‘file’ attribute is now automatically closed when the creating
     ‘cgi.FieldStorage’ instance is garbage collected.  If you were
     pulling the file object out separately from the ‘cgi.FieldStorage’
     instance and not keeping the instance alive, then you should either
     store the entire ‘cgi.FieldStorage’ instance or read the contents
     of the file before the ‘cgi.FieldStorage’ instance is garbage
     collected.

   * クローズ済みの SSL ソケットに対する ‘read’ や ‘write’ 呼び出しで、
     以前のようなミステリアスな *note AttributeError: 5f0. ではなく、役
     に立つ *note ValueError: 2ec. を投げるようになりました。
     (bpo-9177(10))

   * *note slice.indices(): 1228. が巨大な値で *note OverflowError: a81.
     を起こすことはなくなりました。この修正からの流れで *note
     slice.indices(): 1228. は負の値に対して *note ValueError: 2ec. を投
     げるようになっています。以前はこれは馬鹿げた値を返していました。
     (bpo-14794(11))

   * 特殊メソッド ‘__complex__’ が複素数ではなく *note float: 196. を返
     す実装をしているオブジェクトを渡すと *note cmath: 19. 関数ではエラ
     ーとなり、 *note complex: 197. コンストラクタでは受け容れられていま
     したが、これはいずれも *note TypeError: 198. となるように改められま
     した。(bpo-16290(12).)

   * 3.2 と 3.3 での *note int: 19b. コンストラクタが 'base' パラメータ
     として誤って *note float: 196. を許容してしまっていました。それをわ
     ざわざやっているとも思えないですが、そうしていたなら今後は *note
     TypeError: 198. になります。 (bpo-16772(13))

   * キーワード専用引数へのデフォルト値が、通常のキーワード引数へのデフ
     ォルト値評価の 'あとで' 評価されるようになりました。前ではなく。望
     むらくは誰一人以前のバギーな振る舞いに頼っちゃうおバカなコードを書
     いていませんように。願います。 (bpo-16967(14))

   * 古いスレッド状態が *note fork(): 4b5. 後にクリアされるようになりま
     した。これにより、以前は不適切に永遠に生き残ってしまっていたいくつ
     かのシステムリソース (たとえば、スレッドローカル記憶内に維持された
     データベース接続) が解放されるようになります。 (bpo-17094(15).)

   * Parameter names in ‘__annotations__’ dicts are now mangled
     properly, similarly to *note __kwdefaults__: 1229.  (Contributed by
     Yury Selivanov in bpo-20625(16).)

   * *note hashlib.hash.name: 1149. が識別子を常に小文字で返すようになり
     ました。以前はいくつかの組み込みハッシュが大文字名を持っていました
     が、公式インターフェイスであることから、命名に一貫性を持たせるよう
     にしました。 (bpo-18532(17))

   * Because *note unittest.TestSuite: ff5. now drops references to
     tests after they are run, test harnesses that reuse a *note
     TestSuite: ff5. to re-run a set of tests may fail.  Test suites
     should not be re-used in this fashion since it means state is
     retained between test runs, breaking the test isolation that *note
     unittest: 10c. is designed to provide.  However, if the lack of
     isolation is considered acceptable, the old behavior can be
     restored by creating a *note TestSuite: ff5. subclass that defines
     a ‘_removeTestAtIndex’ method that does nothing (see *note
     TestSuite.__iter__(): 122a.) (bpo-11798(18)).

   * *note unittest: 10c. がコマンドライン解析に *note argparse: 7. を使
     うようになりました。このことで、以前は動作していた不当なコマンド形
     式で許されなくなったものがあります。理屈から言えばこれは後方互換性
     の問題ではないはずです。許されなくなったコマンド形式は意味をなして
     いなかったものですから、使われていたとは思えません。

   * The *note re.split(): 5a2, *note re.findall(): 122b, and *note
     re.sub(): 5a3. functions, and the *note group(): 122c. and *note
     groups(): 122d. methods of ‘match’ objects now always return a
     'bytes' object when the string to be matched is a *note bytes-like
     object: 193.  Previously the return type matched the input type, so
     if your code was depending on the return value being, say, a
     ‘bytearray’, you will need to change your code.

   * ‘audioop’ functions now raise an error immediately if passed string
     input, instead of failing randomly later on (bpo-16685(19)).

   * *note HTMLParser: a77. の新規引数 'convert_charrefs' は現在は後方互
     換性維持のために ‘False’ をデフォルトとしていますが、最終的には
     ‘True’ がデフォルトになります。あなたのコードでは *note HTMLParser:
     a77. の全ての呼び出しでこれをキーワード引数として明示することをお勧
     めします。 (bpo-13633(20))

   * *note hmac.new(): c96. 関数の 'digestmod' 引数からデフォルト値が消
     える予定です。ので、 *note hmac.new(): c96. 呼び出しは常に
     'digestmod' を明示するように修正すべきです。 (bpo-17276(21))

   * *note sysconfig.get_config_var(): 174. にキー ‘SO’ を渡すことと
     *note sysconfig.get_config_vars(): 298. の呼び出し結果から ‘SO’ キ
     ーを探すことは非推奨です。このキーは文脈依存の ‘EXT_SUFFIX’ または
     ‘SHLIB_SUFFIX’ で置き換えられるべきです。 (bpo-19555(22))

   * ‘open’ 系関数にモード ‘U’ を使っていたコードは修正すべきです。 ‘U’
     は Python 3 では無力であり、いずれはこれの使用は例外を投げるように
     なる予定です。使う関数に依存しますが、 'newline' 引数を使うか、ある
     いは必要であればストリームを *note TextIOWrapper: 9be. でラップして
     その 'newline' 引数を使うことで、その古い Python 2 の振る舞いと同等
     なものを実現出来ます。 (bpo-15204(23))

   * スクリプト内から ‘pyvenv’ を使っていて、pip がインストール 'されな
     い' ことを望むならば、コマンド呼び出しに ‘--without-pip’ を追加しな
     ければなりません。

   * indent を明示した場合の *note json.dump(): f40. と *note
     json.dumps(): f41. のデフォルトの振る舞いが変更されました。要素を区
     切るカンマが行末に来る場合の後ろに、空白を追加しなくなりました。こ
     れはその出力のテストを空白に繊細な比較をすることで行っている場合に
     だけ問題になります。 (bpo-16333(24))

   * *note doctest: 3e. が拡張モジュールの ‘__doc__’ 文字列から doctest
     を見つけるようになったので、doctest のテストディスカバリが拡張モジ
     ュールを含んでいてその中で doctest のようにみえるものが含まれている
     と、テスト実行時にこれまで見かけたことのないテスト失敗を目にするか
     もしれません。 (bpo-3158(25))

   * *note collections.abc: 1f. モジュールが、Python スタートアップの改
     善の一環で少々リファクタリングが行われました。これの結果として
     *note collections: 1e. は自動で *note collections.abc: 1f. をインポ
     ートしなくなりました。もしもこの (文書化されていなかった) 暗黙での
     インポートに依存していたのであれば、 ‘import collections.abc’ とし
     て明示的にインポートを追加する必要があります。 (bpo-20784(26))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17115

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19413

   (3) https://bugs.python.org/issue?@action=redirect&bpo=18065

   (4) https://hg.python.org/cpython/rev/e353f64dfd95

   (5) https://bugs.python.org/issue?@action=redirect&bpo=17482

   (6) https://bugs.python.org/issue?@action=redirect&bpo=18416

   (7) https://bugs.python.org/issue?@action=redirect&bpo=18416

   (8) https://bugs.python.org/issue?@action=redirect&bpo=17434

   (9) https://bugs.python.org/issue?@action=redirect&bpo=18011

   (10) https://bugs.python.org/issue?@action=redirect&bpo=9177

   (11) https://bugs.python.org/issue?@action=redirect&bpo=14794

   (12) https://bugs.python.org/issue?@action=redirect&bpo=16290

   (13) https://bugs.python.org/issue?@action=redirect&bpo=16772

   (14) https://bugs.python.org/issue?@action=redirect&bpo=16967

   (15) https://bugs.python.org/issue?@action=redirect&bpo=17094

   (16) https://bugs.python.org/issue?@action=redirect&bpo=20625

   (17) https://bugs.python.org/issue?@action=redirect&bpo=18532

   (18) https://bugs.python.org/issue?@action=redirect&bpo=11798

   (19) https://bugs.python.org/issue?@action=redirect&bpo=16685

   (20) https://bugs.python.org/issue?@action=redirect&bpo=13633

   (21) https://bugs.python.org/issue?@action=redirect&bpo=17276

   (22) https://bugs.python.org/issue?@action=redirect&bpo=19555

   (23) https://bugs.python.org/issue?@action=redirect&bpo=15204

   (24) https://bugs.python.org/issue?@action=redirect&bpo=16333

   (25) https://bugs.python.org/issue?@action=redirect&bpo=3158

   (26) https://bugs.python.org/issue?@action=redirect&bpo=20784


File: python.info,  Node: C API の変更<15>,  Prev: Python API の変更<11>,  Up: Python 3 4 への移植

1.11.8.3 C API の変更
.....................

   * いくつかの内部 C API とともに *note PyEval_EvalFrameEx(): 122f,
     *note PyObject_Repr(): 1230, *note PyObject_Str(): 1231. に、現在ア
     クティブな例外を黙殺する状況で使われていないことを確かにするための
     デバッグアサーションが仕込まれました。アクティブな例外を捨てること
     が期待されて望ましいケース (たとえば、既にローカルに *note
     PyErr_Fetch(): 428. で保存済みであるとか、異なる例外に置き換えるこ
     とが意図である場合) は、アサーション有効でコンパイルされている
     Python バージョンで実行して、(直接的・間接的によらず) それら操作呼
     び出しがそのアサーションを発行するのを、明示的に *note
     PyErr_Clear(): 1232. 呼び出しをすることで潰してください。

   * *note PyErr_SetImportError(): f39. が 'msg' がセットされていない場
     合に *note TypeError: 198. をセットするようになりました。以前は例外
     をセットすることなく ‘NULL’ を返すだけでした。

   * *note PyOS_ReadlineFunctionPointer: 7a5. コールバックは、エラー時に
     ‘NULL’ を返すか *note PyMem_RawMalloc(): 631. または *note
     PyMem_RawRealloc(): 633. でアロケートした文字列を返さなければなりま
     せん。 *note PyMem_Malloc(): e5f. や *note PyMem_Realloc(): 1233. で
     アロケートした文字列はダメです。 (bpo-16742(1))

   * *note PyThread_set_key_value(): 43b. が必ず値をセットするようになり
     ました。Python 3.3 ではこの関数はキーが既存 (で現在値が ‘NULL’ ポイ
     ンタでない) の場合には何もしませんでした。

   * *note PyFrameObject: 98c. 構造体のフィールド ‘f_tstate’ (thread
     state) が、バグをフィックスするために削除されました: 論拠については
     bpo-14432(2) を参照してください。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16742

   (2) https://bugs.python.org/issue?@action=redirect&bpo=14432


File: python.info,  Node: 3 4 3 の変更,  Prev: Python 3 4 への移植,  Up: What's New In Python 3 4

1.11.9 3.4.3 の変更
-------------------

* Menu:

* PEP 476; stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化.


File: python.info,  Node: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化,  Up: 3 4 3 の変更

1.11.9.1 PEP 476: stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化
....................................................................................

*note http.client: 73. とこのモジュールを使っている例えば *note
urllib.request: 111. や *note xmlrpc.client: 134. が、サーバをプラットフ
ォームが持つ信頼ストアにある CA により署名された証明書で検証し、そのホス
ト名がリクエストされたホスト名かどうかのチェックをデフォルトで行うように
なりました。これは多くのアプリケーションにとって大幅なセキュリティ改善に
なります。

以前の古い振る舞いが必要なアプリケーションでは、代わりとなるコンテキスト
を渡せます:

     import urllib.request
     import ssl

     # This disables all verification
     context = ssl._create_unverified_context()

     # This allows using a specific certificate for the host, which doesn't need
     # to be in the trust store
     context = ssl.create_default_context(cafile="/path/to/file.crt")

     urllib.request.urlopen("https://invalid-cert", context=context)


File: python.info,  Node: What's New In Python 3 3,  Next: What's New In Python 3 2,  Prev: What's New In Python 3 4,  Up: What's New in Python

1.12 What's New In Python 3.3
=============================

この記事では 3.2 と比較した Python 3.3 の新機能を解説します。 Python 3.3
は2012年9月29日にリリースされました。全詳細については 変更履歴(1) をご覧
ください。

参考
....

PEP 398(2) - Python 3.3 リリーススケジュール

* Menu:

* 概要: 概要 -- リリースハイライト<12>. リリースハイライト
* PEP 405; 仮想環境: PEP 405 仮想環境.
* PEP 420; 暗黙的な名前空間パッケージ: PEP 420 暗黙的な名前空間パッケージ.
* PEP 3118; 新たなメモリビューの実装とバッファプロトコルのドキュメント: PEP 3118 新たなメモリビューの実装とバッファプロトコルのドキュメント.
* PEP 393; 文字列の柔軟な表現: PEP 393 文字列の柔軟な表現.
* PEP 397; Windows の Python ランチャ: PEP 397 Windows の Python ランチャ.
* PEP 3151; OS および IO 例外階層の手直し: PEP 3151 OS および IO 例外階層の手直し.
* PEP 380; サブジェネレータへの委譲構文: PEP 380 サブジェネレータへの委譲構文.
* PEP 409; 例外コンテキストの抑制: PEP 409 例外コンテキストの抑制.
* PEP 414; 明示的なユニコードリテラル: PEP 414 明示的なユニコードリテラル.
* PEP 3155; クラスと関数の正規名: PEP 3155 クラスと関数の正規名.
* PEP 412; キー共有辞書: PEP 412 キー共有辞書.
* PEP 362; 関数シグニチャオブジェクト: PEP 362 関数シグニチャオブジェクト.
* PEP 421; sys.implementation の追加: PEP 421 sys implementation の追加.
* インポート実装としての importlib の使用::
* その他の言語変更: その他の言語変更<11>.
* 細粒度のインポートロック::
* 組み込みの関数と型::
* 新たなモジュール: 新たなモジュール<11>.
* 改良されたモジュール: 改良されたモジュール<11>.
* 最適化: 最適化<11>.
* ビルドならびに C API の変更: ビルドならびに C API の変更<4>.
* 非推奨: 非推奨<13>.
* Python 3.3 への移植: Python 3 3 への移植.

   ---------- Footnotes ----------

   (1) https://docs.python.jp/3.3/whatsnew/changelog.html

   (2) https://peps.python.org/pep-0398/


File: python.info,  Node: 概要 -- リリースハイライト<12>,  Next: PEP 405 仮想環境,  Up: What's New In Python 3 3

1.12.1 概要 - リリースハイライト
--------------------------------

新たな文法機能:

   * *note ジェネレータの委譲: 123b.  のための新しい ‘yield from’ 式

   * *note str: 169. オブジェクト向けの ‘u'unicode'’ 文法の再適用

新たなライブラリモジュール:

   * *note faulthandler: 5c. (低水準のクラッシュのデバッグを補助する)

   * *note ipaddress: 84. (IPアドレスとマスクを表す高水準オブジェクト)

   * *note lzma: 8e. (XZ / LZMA アルゴリズムを使用したデータ圧縮)

   * *note unittest.mock: 10d. (テスト向けにシステムの一部をモックオブジ
     ェクトで置き換える)

   * *note venv: 117. (人気の ‘virtualenv’ パッケージのような、Python
     *note virtual environments: 123c.)

新たな組み込み機能:

   * *note I/O 例外階層: 123d. の手直し

実装の改善:

   * *note インポート機構: 123e. を、 *note importlib: 7b. を元に書き換
     え

   * よりコンパクトな *note ユニコード文字列: 123f.

   * よりコンパクトな *note 属性辞書: 1240.

ライブラリモジュールの大幅な改善:

   * *note decimal: 1241. モジュールのCによる高速化

   * *note email: 1242. モジュールでのより良いユニコード処理 (*note
     暫定版: 1243.)

セキュリティの改善:

   * ハッシュのランダム化がデフォルトで有効になりました。

以降はユーザ向けの変更の包括的なリストになっています。


File: python.info,  Node: PEP 405 仮想環境,  Next: PEP 420 暗黙的な名前空間パッケージ,  Prev: 概要 -- リリースハイライト<12>,  Up: What's New In Python 3 3

1.12.2 PEP 405: 仮想環境
------------------------

仮想環境 (virtual environment) は隔離されたPython環境を作成する手助けを
します。 一方で保守を容易にするために、システム全体のインストールを共有
します。 仮想環境はそれ自身の site packages (つまりローカルにインストー
ルされたライブラリ) を持ちつつ、任意でシステム全体の site packages と分
離できます。 このコンセプトと実装は、人気のサードパーティパッケージであ
る ‘virtualenv’ を元にしていますが、インタプリタコアとの統合による恩恵を
受けています。

この PEP はプログラムからのアクセス用の *note venv: 117. モジュールと、
コマンドラインからのアクセスと管理向けの ‘pyvenv’ スクリプトを追加します
。Pythonインタプリタは仮想環境のディレクトリツリーの存在を示す
‘pyvenv.cfg’ をチェックします。

参考
....

PEP 405(1) - Python Virtual Environments

     PEP written by Carl Meyer; implementation by Carl Meyer and Vinay
     Sajip

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0405/


File: python.info,  Node: PEP 420 暗黙的な名前空間パッケージ,  Next: PEP 3118 新たなメモリビューの実装とバッファプロトコルのドキュメント,  Prev: PEP 405 仮想環境,  Up: What's New In Python 3 3

1.12.3 PEP 420: 暗黙的な名前空間パッケージ
------------------------------------------

‘__init__.py’ マーカーファイルを必要としないパッケージディレクトリと、複
数のモジュールパスをネイティブでサポートします( PEP 420(1) に記載された
様々なサードパーティでの名前空間のアプローチに影響されています)

参考
....

PEP 420(2) - Implicit Namespace Packages

     PEP written by Eric V. Smith; implementation by Eric V. Smith and
     Barry Warsaw

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0420/

   (2) https://peps.python.org/pep-0420/


File: python.info,  Node: PEP 3118 新たなメモリビューの実装とバッファプロトコルのドキュメント,  Next: PEP 393 文字列の柔軟な表現,  Prev: PEP 420 暗黙的な名前空間パッケージ,  Up: What's New In Python 3 3

1.12.4 PEP 3118: 新たなメモリビューの実装とバッファプロトコルのドキュメント
---------------------------------------------------------------------------

PEP 3118(1) の実装が大幅に改善されました。

新しい memoryview 実装が、Py_buffer 構造体内にフィールドを動的にアロケー
トする際に多数のクラッシュの報告をもたらしていた全ての所有権問題、ライフ
タイム問題を包括的に解決しました。加えて、不連続もしくは多次元の入力に対
してクラッシュしたり誤った結果を返していた多数の関数が修正されました。

memoryview オブジェクトに、 PEP-3118 準拠の getbufferproc() が追加されて
います (訳注: *note バッファオブジェクト構造体 (buffer object
structure): 1248. 参照)。これはコンシューマの要求型をチェックします。多
くの新機能が追加されており、これらのほとんどが不連続配列とサブオフセット
を持つ配列に完全な一般化をもたらすものです。

*note ドキュメント: 260. が更新され、エキスポータ(提供側)とコンシューマ
(利用側)両方についての責務をより明確に詳細化しています。 *note
バッファ要求のフラグ: 1249. が、基本フラグと組合せフラグでグループ分けさ
れています。不連続配列と多次元の NumPy スタイル行列のメモリレイアウトに
ついて説明されています。

* Menu:

* フィーチャー::
* API の変更::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3118/


File: python.info,  Node: フィーチャー,  Next: API の変更,  Up: PEP 3118 新たなメモリビューの実装とバッファプロトコルのドキュメント

1.12.4.1 フィーチャー
.....................

   * struct モジュールの構文の全ての native *note 書式指定文字: 124b. を
     サポートするようになりました ('@' プレフィクスが付いていても良いで
     す)。 (訳注: *note format: 124c. 参照。)

   * いくつかの制限はありますが、 *note cast(): 124d. メソッドでフォーマ
     ット変更と C-*note contiguous: 124e. 配列の形状 (shape) の変更を行
     うことが出来ます。

   * 任意の配列型で多次元のリスト表現がサポートされるようになっています
     。

   * 任意の配列型で多次元の比較がサポートされるようになっています。

   * 'B', 'b', 'c' いずれかのフォーマットの *note hashable: 824. な (読
     み出し専用の) 型の1次元メモリビューもまた、 hashable です。
     (Contributed by Antoine Pitrou in bpo-13411(1).)

   * Arbitrary slicing of any 1-D arrays type is supported.  For
     example, it is now possible to reverse a memoryview in 'O'(1) by
     using a negative step.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13411


File: python.info,  Node: API の変更,  Prev: フィーチャー,  Up: PEP 3118 新たなメモリビューの実装とバッファプロトコルのドキュメント

1.12.4.2 API の変更
...................

   * 最大 *note 次元: 1250. は公式に 64 に制限されています。

   * 空の *note shape: 1251, 空の *note strides: 1252, 空の *note
     suboffsets: 1253. を表現するのに以前は ‘None’ を用いていましたが今
     ではこれは空のタプルです。

   * フォーマット 'B' (unsigned bytes) での memoryview 要素へのアクセス
     は整数を返すようになりました (struct モジュールでの構文に従っていま
     す)。bytes オブジェクトが欲しければまずビューを 'c' で *note
     cast(): 124d. しなければなりません。

   * memoryview どうしの比較は被演算対象の論理構造を使って行うようになり
     、また、全ての配列要素は値で比較されます。struct モジュールの構文の
     全てのフォーマット文字でサポートされます。認識出来ないフォーマット
     文字でのビューは今でも許されていますが、ビューの指す中身によらずこ
     れは常に等しくないとされます。

   * ほかの変更については、 *note ビルドならびに C API の変更: 1254. と
     *note C コードの移植: 1255. を参照してください。

(Contributed by Stefan Krah in bpo-10181(1).)

参考
....

PEP 3118(2) - Revising the Buffer Protocol

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10181

   (2) https://peps.python.org/pep-3118/


File: python.info,  Node: PEP 393 文字列の柔軟な表現,  Next: PEP 397 Windows の Python ランチャ,  Prev: PEP 3118 新たなメモリビューの実装とバッファプロトコルのドキュメント,  Up: What's New In Python 3 3

1.12.5 PEP 393: 文字列の柔軟な表現
----------------------------------

Unicode 文字列型が、複数の内部表現 (1、2 または 4 バイトで表現される
Unicode 序数(ordinal) の最大値依存) を、表現される文字列内でサポートする
ように変更されました (訳注: 以前までは Python のビルド時に固定で決めてい
ました)。このことは全てのシステムにおいて、一般のケースでは空間効率の良
い表現をしながらも UCS-4 へのフルアクセスを与えます。既存の API との互換
性のために複数の表現が並行で存在することになりますが、徐々にこの互換性は
なくされていくはずです。

Python 側にはこの変更による不都合は何もないはずです。

C API 側では PEP 393(1) は完全に後方互換です。レガシーな API は最低 5 年
は残されるはずです。レガシー API を使うアプリケーションはメモリ削減の効
能が完全には得られないか、あるいは最悪の場合には少し余計なメモリを使うか
もしれません。これは Python がそれぞれの文字列の二つのバージョン (レガシ
ーなフォーマットと新しい効率的な格納方法) を維持する必要があるかもしれな
いからです

* Menu:

* 機能性::
* 性能およびリソース使用量::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0393/


File: python.info,  Node: 機能性,  Next: 性能およびリソース使用量,  Up: PEP 393 文字列の柔軟な表現

1.12.5.1 機能性
...............

PEP 393(1) でなされた変更は以下の通りです:

   * Python は今や非 BMP 面の文字を含む Unicode コードポイントの完全な範
     囲 (つまり ‘U+0000’ から ‘U+10FFFF’ まで) を常にサポートします。
     narrow ビルド / wide ビルドという区別は今では存在していないため、
     Python は今ではいつでもかつての wide ビルドのように振る舞い、
     Windows でもこれは例外ではありません。

   * narrow ビルドとの決別は、それに付き物だった問題も解決しました。例え
     ば:

        * *note len(): 840. は今では非 BMP 面文字について必ず 1 を返しま
          す。つまり ‘len('\U0010FFFF') == 1’ です;

        * サロゲートペアが文字列リテラル内で再結合されることはありません
          。つまり ‘'\uDBFF\uDFFF' != '\U0010FFFF'’ です;

        * 非 BMP 面文字を指すインデクスやスライスは期待通りの値を返しま
          す。つまり ‘'\U0010FFFF'[0]’ は今では ‘'\uDBFF'’ ではなく
          ‘'\U0010FFFF'’ を返します;

        * ほかの全ての標準ライブラリ関数が今では正しく非 BMP コードポイ
          ントを処理します。

   * *note sys.maxunicode: 1258. の値は今やいつでも ‘1114111’ (十六進で
     ‘0x10FFFF’) です。後方互換性のために C API の ‘PyUnicode_GetMax()’
     関数は今でも ‘0xFFFF’ か ‘0x10FFFF’ のどちらかを返すようになっては
     いますが、新しい Unicode API とともには使ってはいけません (see
     bpo-13054(2))。

   * ‘./configure’ スクリプトのフラグ ‘--with-wide-unicode’ は削除されま
     した。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0393/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=13054


File: python.info,  Node: 性能およびリソース使用量,  Prev: 機能性,  Up: PEP 393 文字列の柔軟な表現

1.12.5.2 性能およびリソース使用量
.................................

Unicode 文字列の記憶域サイズが文字列内のコードポイント最大値に依存するよ
うになったということです:

   * 純粋な ASCII と Latin1 文字列 (‘U+0000-U+00FF’) はコードポイントご
     とに 1 バイトを占めます;

   * BMP 文字列 (‘U+0000-U+FFFF’) はコードポイントごとに 2 バイトを占め
     ます;

   * 非 BMP 文字列 (‘U+10000-U+10FFFF’) はコードポイントごとに 4 バイト
     を占めます。

結局のところほとんどのアプリケーションにとってのこれの効能は、文字列記憶
のためのメモリ使用量が激減することで、これは以前の wide unicode ビルドと
比較して顕著です。これは多くの場合、インターナショナルな文脈であってもな
お純粋な ASCII が使われるであろうことに関係があります。(というのも多くの
文字列が人間向けでない言語として格納されるからです。例えば XML フラグメ
ンツや HTTP ヘッダ、JSON エンコードされたデータ、などなど。)同じ理由から
、大きなアプリケーションで CPU キャッシュ活用効率を高めるであろうことも
期待出来ます。Python 3.3 のメモリ使用は Python 3.2 の 2 倍から 3 倍小さ
く、また、Python 2.7 よりも少し良いことが Django ベンチマークでわかって
います (詳細は PEP をみてください)。

参考
....

PEP 393(1) - 文字列の柔軟な表現 (Flexible String Representation)

     PEP written by Martin von Löwis; implementation by Torsten Becker
     and Martin von Löwis.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0393/


File: python.info,  Node: PEP 397 Windows の Python ランチャ,  Next: PEP 3151 OS および IO 例外階層の手直し,  Prev: PEP 393 文字列の柔軟な表現,  Up: What's New In Python 3 3

1.12.6 PEP 397: Windows の Python ランチャ
------------------------------------------

Python 3.3 の Windows インストーラが、ランチャアプリケーションの ‘py’ を
インストールするようになりました。これは Python をバージョンに依存しない
方法で起動するのに使われます。

ランチャは ‘*.py’ ファイルをダブルクリックすると暗黙のうちに呼び出されま
す。システムにインストールされているのが単一の Python バージョンであれば
、そのバージョンがファイルの実行に使われます。複数バージョンがインストー
ルされていればデフォルトでは最新バージョンが使われますが、Python スクリ
プト内で Unix スタイルの「shebang 行 ( ‘#!’ )」を含めることでオーバライ
ド出来ます。

ランチャは明示的にコマンドラインから ‘py’ アプリケーションとして使うこと
も出来ます。 ‘py’ の実行は暗黙にスクリプトを起動するバージョン選択のルー
ルに従いますが、与えるコマンドライン引数により狙ったバージョンを選択出来
ます (たとえば ‘-3’ は Python 2 もインストールされている際に Python 3 を
要求し、 ‘-2.6’ はもっと新しいバージョンがインストールされている場合に特
定の古いバージョンを要求します)。

ランチャに加え、Windows インストーラには新しくインストールする Python を
システムの PATH に追加するオプションが含まれるようになりました。
(Contributed by Brian Curtin in bpo-3561(1).)

参考
....

PEP 397(2) - Python Launcher for Windows

     PEP written by Mark Hammond and Martin v.  Löwis; implementation by
     Vinay Sajip.

ランチャのドキュメント: *note Python install manager: 7da.

インストーラ PATH の調整: *note Python install manager: 125c.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=3561

   (2) https://peps.python.org/pep-0397/


File: python.info,  Node: PEP 3151 OS および IO 例外階層の手直し,  Next: PEP 380 サブジェネレータへの委譲構文,  Prev: PEP 397 Windows の Python ランチャ,  Up: What's New In Python 3 3

1.12.7 PEP 3151: OS および IO 例外階層の手直し
----------------------------------------------

OS エラーが送出する例外の階層が単純化され、粒度が下げられました。

You don't have to worry anymore about choosing the appropriate exception
type between *note OSError: 2c0, *note IOError: 125e, *note
EnvironmentError: 125f, *note WindowsError: 1260, ‘mmap.error’, *note
socket.error: 1261. or *note select.error: 1262.  All these exception
types are now only one: *note OSError: 2c0.  The other names are kept as
aliases for compatibility reasons.

また、特定のエラー条件を捕捉するのが容易になりました。 ‘errno’ 属性 (ま
たは ‘args[0]’) の特定の定数を *note errno: 5b. モジュールから調べる代わ
りに、適切な *note OSError: 2c0. 派生クラスを捕捉することが出来ます。 利
用可能な派生クラスは以下の通りです:

   * *note BlockingIOError: 235.

   * *note ChildProcessError: 1263.

   * *note ConnectionError: 100b.

   * *note FileExistsError: 1221.

   * *note FileNotFoundError: 264.

   * *note InterruptedError: f88.

   * *note IsADirectoryError: 1264.

   * *note NotADirectoryError: 1265.

   * *note PermissionError: f3e.

   * *note ProcessLookupError: 1266.

   * *note TimeoutError: a36.

*note ConnectionError: 100b. 自身には細かな派生クラスがあります:

   * *note BrokenPipeError: 1267.

   * *note ConnectionAbortedError: 1268.

   * *note ConnectionRefusedError: 1269.

   * *note ConnectionResetError: 126a.

新たな例外のおかげで *note errno: 5b. の一般的な使い方を避けることが出来
ます。 例えば、Python 3.2 向けに書かれた以下のコード:

     from errno import ENOENT, EACCES, EPERM

     try:
         with open("document.txt") as f:
             content = f.read()
     except IOError as err:
         if err.errno == ENOENT:
             print("document.txt file is missing")
         elif err.errno in (EACCES, EPERM):
             print("You are not allowed to read document.txt")
         else:
             raise

は *note errno: 5b. をインポートしたり手動で例外属性を調べたりせずに書く
ことが出来ます:

     try:
         with open("document.txt") as f:
             content = f.read()
     except FileNotFoundError:
         print("document.txt file is missing")
     except PermissionError:
         print("You are not allowed to read document.txt")

参考
....

PEP 3151(1) - Reworking the OS and IO Exception Hierarchy

     PEP written and implemented by Antoine Pitrou

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3151/


File: python.info,  Node: PEP 380 サブジェネレータへの委譲構文,  Next: PEP 409 例外コンテキストの抑制,  Prev: PEP 3151 OS および IO 例外階層の手直し,  Up: What's New In Python 3 3

1.12.8 PEP 380: サブジェネレータへの委譲構文
--------------------------------------------

PEP 380 は ‘yield from’ 式を追加します。これは *note ジェネレータ: 126c.
に、その操作の一部をほかのジェネレータに委譲するための式です。これによっ
て *note yield: bc2. を含んでいるコードのセクションをほかのジェネレータ
に移動出来るでしょう。加えてサブジェネレータは値を伴って戻ることが出来、
その戻り値は委譲した側のジェネレータで使えます。

‘yield from’ 式がデザインされた主たる動機はサブジェネレータへの委譲とし
て使うことではありますが、実際には任意のサブイテレータに委譲することも出
来ます。

単純なイテレータに対して、 ‘yield from iterable’ は本質的には ‘for item
in iterable: yield item’ への単なる速記法です:

     >>> def g(x):
     ...     yield from range(x, 0, -1)
     ...     yield from range(x)
     ...
     >>> list(g(5))
     [5, 4, 3, 2, 1, 0, 1, 2, 3, 4]

ですが普通のループとは違って ‘yield from’ ではサブジェネレータは、呼び出
し側スコープから *note send(): 126d. されたり *note throw(): 71c. された
値を直接受け取ることができ、また、外側のジェネレータに最終的な値を返せま
す:

     >>> def accumulate():
     ...     tally = 0
     ...     while 1:
     ...         next = yield
     ...         if next is None:
     ...             return tally
     ...         tally += next
     ...
     >>> def gather_tallies(tallies):
     ...     while 1:
     ...         tally = yield from accumulate()
     ...         tallies.append(tally)
     ...
     >>> tallies = []
     >>> acc = gather_tallies(tallies)
     >>> next(acc)  # Ensure the accumulator is ready to accept values
     >>> for i in range(4):
     ...     acc.send(i)
     ...
     >>> acc.send(None)  # Finish the first tally
     >>> for i in range(5):
     ...     acc.send(i)
     ...
     >>> acc.send(None)  # Finish the second tally
     >>> tallies
     [6, 10]

この変更を推し進める一番本質にあったものは、たとえ ‘send’ メソッドや
‘throw’ メソッドとともに使われることを前提に設計されたジェネレータであっ
ても、大きな関数を複数のサブ関数に分割するのと同じくらいに、ジェネレータ
を簡単に複数のサブジェネレータに分割出来るようにすることでした。

参考
....

PEP 380(1) - サブジェネレータへの委譲構文

     PEP written by Greg Ewing; implementation by Greg Ewing, integrated
     into 3.3 by Renaud Blanch, Ryan Kelly and Nick Coghlan;
     documentation by Zbigniew Jędrzejewski-Szmek and Nick Coghlan

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0380/


File: python.info,  Node: PEP 409 例外コンテキストの抑制,  Next: PEP 414 明示的なユニコードリテラル,  Prev: PEP 380 サブジェネレータへの委譲構文,  Up: What's New In Python 3 3

1.12.9 PEP 409: 例外コンテキストの抑制
--------------------------------------

PEP 409 は、チェインされた例外コンテキストの表示を無効にするための新構文
を導入します。これを使えば例外翻訳して投げ直すようなアプリケーションで、
エラーメッセージをわかりやすくすることが出来ます:

     >>> class D:
     ...     def __init__(self, extra):
     ...         self._extra_attributes = extra
     ...     def __getattr__(self, attr):
     ...         try:
     ...             return self._extra_attributes[attr]
     ...         except KeyError:
     ...             raise AttributeError(attr) from None
     ...
     >>> D({}).x
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
       File "<stdin>", line 8, in __getattr__
     AttributeError: x

元となる要因例外を抑制する ‘from None’ を後置しなければ、もとの例外はデ
フォルトで表示されます:

     >>> class C:
     ...     def __init__(self, extra):
     ...         self._extra_attributes = extra
     ...     def __getattr__(self, attr):
     ...         try:
     ...             return self._extra_attributes[attr]
     ...         except KeyError:
     ...             raise AttributeError(attr)
     ...
     >>> C({}).x
     Traceback (most recent call last):
       File "<stdin>", line 6, in __getattr__
     KeyError: 'x'

     During handling of the above exception, another exception occurred:

     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
       File "<stdin>", line 8, in __getattr__
     AttributeError: x

抑制することでデバッグ能力が失われるというわけではなくて、元々の例外コン
テキストは利用可能なままです。(例えば介在するライブラリが有益な背後の詳
細を不適切に隠してしまっているなど、必要な場合はあるでしょう。)

     >>> try:
     ...     D({}).x
     ... except AttributeError as exc:
     ...     print(repr(exc.__context__))
     ...
     KeyError('x',)

参考
....

PEP 409(1) - 例外コンテキストの抑制

     PEP written by Ethan Furman; implemented by Ethan Furman and Nick
     Coghlan.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0409/


File: python.info,  Node: PEP 414 明示的なユニコードリテラル,  Next: PEP 3155 クラスと関数の正規名,  Prev: PEP 409 例外コンテキストの抑制,  Up: What's New In Python 3 3

1.12.10 PEP 414: 明示的なユニコードリテラル
-------------------------------------------

Unicode を意識する Python アプリケーションが Python 2 で Unicode リテラ
ルを多用しているとしても Python 3 への移行を容易にするために、Python 3.3
では文字列リテラルへの "‘u’" 前置を再びサポートすることにしました。この
前置は Python 3 自身では何らの意味も持ちはせず、Python 3 への移行におい
て純粋な機械的変更を要する事項を単に減らすためだけのために提供されます。
開発者はもっと重要な意味的変更 (たとえばバイナリとテキストの厳密な区別)
に集中すべきなのです。

参考
....

PEP 414(1) - 明示的なユニコードリテラル

     PEP written by Armin Ronacher.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0414/


File: python.info,  Node: PEP 3155 クラスと関数の正規名,  Next: PEP 412 キー共有辞書,  Prev: PEP 414 明示的なユニコードリテラル,  Up: What's New In Python 3 3

1.12.11 PEP 3155: クラスと関数の正規名
--------------------------------------

Functions and class objects have a new *note __qualname__: 1271.
attribute representing the "path" from the module top-level to their
definition.  For global functions and classes, this is the same as *note
__name__: 1272.  For other functions and classes, it provides better
information about where they were actually defined, and how they might
be accessible from the global scope.

(束縛されていない) メソッドでの例:

     >>> class C:
     ...     def meth(self):
     ...         pass
     ...
     >>> C.meth.__name__
     'meth'
     >>> C.meth.__qualname__
     'C.meth'

入れ子のクラスでの例:

     >>> class C:
     ...     class D:
     ...         def meth(self):
     ...             pass
     ...
     >>> C.D.__name__
     'D'
     >>> C.D.__qualname__
     'C.D'
     >>> C.D.meth.__name__
     'meth'
     >>> C.D.meth.__qualname__
     'C.D.meth'

入れ子の関数の例:

     >>> def outer():
     ...     def inner():
     ...         pass
     ...     return inner
     ...
     >>> outer().__name__
     'inner'
     >>> outer().__qualname__
     'outer.<locals>.inner'

それらオブジェクトの文字列表現も、この新しくてより正確な情報を含むように
変更されています:

     >>> str(C.D)
     "<class '__main__.C.D'>"
     >>> str(C.D.meth)
     '<function C.D.meth at 0x7f46b9fe31e0>'

参考
....

PEP 3155(1) - クラスと関数の正規名 (qualified name)

     PEP written and implemented by Antoine Pitrou.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3155/


File: python.info,  Node: PEP 412 キー共有辞書,  Next: PEP 362 関数シグニチャオブジェクト,  Prev: PEP 3155 クラスと関数の正規名,  Up: What's New In Python 3 3

1.12.12 PEP 412: キー共有辞書
-----------------------------

オブジェクト属性を記憶するのに使われる辞書が、内部記憶域の一部 (キーとそ
れに対応するハッシュ値) を互いに共有出来るようになりました。これにより、
組み込みでない型のインスタンスをたくさん作るプログラムのメモリ消費が少な
くなります。

参考
....

PEP 412(1) - キー共有辞書

     PEP written and implemented by Mark Shannon.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0412/


File: python.info,  Node: PEP 362 関数シグニチャオブジェクト,  Next: PEP 421 sys implementation の追加,  Prev: PEP 412 キー共有辞書,  Up: What's New In Python 3 3

1.12.13 PEP 362: 関数シグニチャオブジェクト
-------------------------------------------

新たに追加された関数 *note inspect.signature(): 22f. は、Python 呼び出し
可能オブジェクト (callable) を調べることを簡単で直接的なものにしてくれま
す。幅広い callable をサポートしています:デコレートされているかどうかに
よらず関数、クラス、 *note functools.partial(): 217. オブジェクト。新た
に追加されたクラス群 *note inspect.Signature: 4e3, *note
inspect.Parameter: 4e4, *note inspect.BoundArguments: 1275. は、アノテー
ション、デフォルト値、パラメータの種類、束縛されている引数などのような呼
び出しシグニチャについての情報を保持し、これによって、デコレータを書いた
りあるいは呼び出しシグニチャや引数を検証したり改訂したりするコードを書く
ことが、非常に単純になります。

参考
....

PEP 362(1): - 関数シグニチャオブジェクト

     PEP written by Brett Cannon, Yury Selivanov, Larry Hastings, Jiwon
     Seo; implemented by Yury Selivanov.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0362/


File: python.info,  Node: PEP 421 sys implementation の追加,  Next: インポート実装としての importlib の使用,  Prev: PEP 362 関数シグニチャオブジェクト,  Up: What's New In Python 3 3

1.12.14 PEP 421: sys.implementation の追加
------------------------------------------

*note sys: df. モジュールに新規属性が追加され、これは現在動作中のインタ
ープリタ実装に固有の詳細を公開します。その *note sys.implementation:
73b. 属性の手始めの集合として、 ‘name’, ‘version’, ‘hexversion’,
‘cache_tag’ が定義されています。

‘sys.implementation’ の真意は、標準ライブラリによって利用される実装固有
の情報を一つの名前空間で一元管理することにあります。このことにより異なる
Python 実装が単一の標準ライブラリのコードベースを共有することが、もっと
ずっと簡単になります。今時点での初期状態では ‘sys.implementation’ は実装
固有データのごく一部を保持しているだけです。標準ライブラリの移植性がもっ
と高くなるように、徐々にこの比率が変わっていくでしょう。

標準ライブラリの移植性を改善した一例が ‘cache_tag’ です。Python 3.3 以降
は ‘sys.implementation.cache_tag’ が PEP 3147(1) をサポートするために
*note importlib: 7b. により使われます。組み込みのインポートシステムのた
めに ‘importlib’ を使う全ての Python 実装が、モジュールのキャッシュの振
る舞いを制御するのに ‘cache_tag’ を利用できます。

* Menu:

* SimpleNamespace::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3147/


File: python.info,  Node: SimpleNamespace,  Up: PEP 421 sys implementation の追加

1.12.14.1 SimpleNamespace
.........................

‘sys.implementation’ の実現に伴って Python に新たな型 *note
types.SimpleNamespace: 4e5. が導入されることとなりました。 *note dict:
183. のようなマッピングベースの名前空間とは対照的に、 ‘SimpleNamespace’
は *note object: c7e. のような属性ベースです。ですが ‘object’ とは違って
‘SimpleNamespace’ インスタンスは書き込み可能です。つまり普通の属性アクセ
スを通じて名前空間に追加したり削除したり修正したりできます。

参考
....

PEP 421(1) - sys.implementation の追加

     PEP written and implemented by Eric Snow.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0421/


File: python.info,  Node: インポート実装としての importlib の使用,  Next: その他の言語変更<11>,  Prev: PEP 421 sys implementation の追加,  Up: What's New In Python 3 3

1.12.15 インポート実装としての importlib の使用
-----------------------------------------------

bpo-2377(1) - Replace __import__ w/ importlib.__import__ bpo-13959(2) -
Re-implement parts of ‘imp’ in pure Python bpo-14605(3) - Make import
machinery explicit bpo-14646(4) - Require loaders set __loader__ and
__package__

*note __import__(): ad1. 関数を *note importlib.__import__(): 1279. によ
って実現するようにしました。これは PEP 302(5) の「第二段階」を完了させる
ものです。この変更には複数の恩恵があります。まず最初にこれはインポートの
機構を、C コードの奥深くで暗黙に秘密裏に行うのではなく、より透明化します
。このことで、Python 3.3 をサポートする全ての Python VM で単一の実装を用
いることが出来るようになり、インポートのセマンティクスにおける VM 固有の
逸脱と決別する助けともなります。そしてこれはインポート機構の保守をより容
易とし、将来起こりうる進化を促します。

一般のユーザにとっては、セマンティクスにおいて目に見える変化はないはずで
す。今時点でインポートを操作したりインポート呼び出しをプログラム的に行っ
ている場合は、このドキュメントの *note Python コードの移植: 127a. でカバ
ーしているコードの修正が必要になるかもしれません。

* Menu:

* 新たな API::
* 目に見える変化::

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=2377

   (2) https://bugs.python.org/issue?@action=redirect&bpo=13959

   (3) https://bugs.python.org/issue?@action=redirect&bpo=14605

   (4) https://bugs.python.org/issue?@action=redirect&bpo=14646

   (5) https://peps.python.org/pep-0302/


File: python.info,  Node: 新たな API,  Next: 目に見える変化,  Up: インポート実装としての importlib の使用

1.12.15.1 新たな API
....................

この変更による一番大きな恩恵の一つは、インポート文の動作に何が介在するの
かについて露になったことです。つまりかつては様々なインポータが暗黙で行っ
ていたことが、今では完全に *note importlib: 7b. パッケージの一部として公
開されています。

The abstract base classes defined in *note importlib.abc: 7c. have been
expanded to properly delineate between *note meta path finders: 127c.
and *note path entry finders: 127d. by introducing *note
importlib.abc.MetaPathFinder: a6e. and *note
importlib.abc.PathEntryFinder: a6f, respectively.  The old ABC of
‘importlib.abc.Finder’ is now only provided for backwards-compatibility
and does not enforce any method requirements.

In terms of finders, *note importlib.machinery.FileFinder: 127e. exposes
the mechanism used to search for source and bytecode files of a module.
Previously this class was an implicit member of *note sys.path_hooks:
1225.

ローダ (loader) については、新規の抽象基底クラス *note
importlib.abc.FileLoader: 127f. が、モジュールのコードを格納する機構とし
てのファイルシステムを使うローダを書く助けとなります。ソースファイルのロ
ーダ (*note importlib.machinery.SourceFileLoader: 1280.)、ソースを持たな
いバイトコードのためのローダ (*note
importlib.machinery.SourcelessFileLoader: 1281.)、そして拡張モジュールの
ためのローダ (*note importlib.machinery.ExtensionFileLoader: eae.) が今
では直接的に利用出来ます。

*note ImportError: 65b. には属性 ‘name’ と ‘path’ が追加されて、これには
提供すべき関連データがある場合にセットされます。インポート失敗時のメッセ
ージも、これまでのようにモジュール名の末尾だけを与えるのではなく、モジュ
ールの完全名を提供するようになりました。

The *note importlib.invalidate_caches(): e0a. function will now call the
method with the same name on all finders cached in *note
sys.path_importer_cache: 7fa. to help clean up any stored state as
necessary.


File: python.info,  Node: 目に見える変化,  Prev: 新たな API,  Up: インポート実装としての importlib の使用

1.12.15.2 目に見える変化
........................

潜在的に必要となるかもしれないコード修正については、 *note Python
コードの移植: 127a. セクションを参照してください。

*note importlib: 7b. によって公開されるものが拡がったことによる、インポ
ートについてのほかの目に見える変化があります。最大の変化は *note
sys.meta_path: f27. と *note sys.path_hooks: 1225. が、インポートで使わ
れる meta path finder と path entry hook の全てを格納するようになったこ
とです。以前はファインダは直接的に公開されるのではなく、インポートの C コ
ード内に暗黙のものとして隠されていました。このことによって、今では望めば
要件に合うようファインダを取り除いたり順序を変えたりといったことが簡単に
行えるようになっています。

もう一つの変化は、モジュール生成時に使われたローダを格納する
‘__loader__’ 属性を、全てのモジュールが持つようになったことです。 PEP
302(1) はローダの実装においてこの属性をセットすることを必須とするよう更
新されました。ですので今後サードパーティのローダが更新されれば、この属性
の存在に依存出来るようになります。ですがそのときが来るまでは、インポート
処理がモジュールのロードの後処理としてセットします。

さらにローダが PEP 366(2) よりの ‘__package__’ 属性を設定することも期待
出来るようになりました。繰り返しになりますがインポート処理自身が既にこれ
を全てのローダで *note importlib: 7b. より行っていて、また、インポート処
理自身がこの属性をロードの後処理としてセットしています。

‘None’ is now inserted into *note sys.path_importer_cache: 7fa. when no
finder can be found on *note sys.path_hooks: 1225.  Since
‘imp.NullImporter’ is not directly exposed on *note sys.path_hooks:
1225. it could no longer be relied upon to always be available to use as
a value representing no finder found.

全てのほかの変更は、Python 3.3 へのコードの更新の際に考慮すべきセマンテ
ィクスの変更に関係しています。ですのでそららについて、このドキュメントの
*note Python コードの移植: 127a. セクションを読むべきです。

(Implementation by Brett Cannon)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0302/

   (2) https://peps.python.org/pep-0366/


File: python.info,  Node: その他の言語変更<11>,  Next: 細粒度のインポートロック,  Prev: インポート実装としての importlib の使用,  Up: What's New In Python 3 3

1.12.16 その他の言語変更
------------------------

Python 言語コアに小さな変更がいくつか行われました:

   * Added support for Unicode name aliases and named sequences.  Both
     *note unicodedata.lookup(): 1284. and ‘'\N{...}'’ now resolve name
     aliases, and *note unicodedata.lookup(): 1284. resolves named
     sequences too.

     (Contributed by Ezio Melotti in bpo-12753(1).)

   * Unicode データベースを UCD バージョン 6.1.0 にアップグレードしまし
     た。

   * *note range(): b3d. オブジェクトどうしの等値性比較が、それぞれの
     range オブジェクトによって生成されるシーケンスの等値性を反映して行
     われるようになりました (bpo-13201(2))。

   * *note bytes: 192. と *note bytearray: 344. オブジェクトのメソッド
     ‘count()’, ‘find()’, ‘rfind()’, ‘index()’, ‘rindex()’ が、第一引数
     に 0 から 255 の整数を受け付けるようになりました。

     (Contributed by Petri Lehtinen in bpo-12170(3).)

   * *note bytes: 192. と *note bytearray: 344. オブジェクトのメソッド
     ‘rjust()’, ‘ljust()’, ‘center()’ が、 ‘fill’ 引数として *note
     bytearray: 344. を受け付けるようになりました (Contributed by Petri
     Lehtinen in bpo-12380(4).)。

   * New methods have been added to *note list: 24d. and *note
     bytearray: 344.: ‘copy()’ and ‘clear()’ (bpo-10516(5)).
     Consequently, *note MutableSequence: 4bf. now also defines a
     ‘clear()’ method (bpo-11388(6)).

   * raw bytes リテラルとして ‘br"..."’ だけでなく ‘rb"..."’ とも書ける
     ようになりました。

     (Contributed by Antoine Pitrou in bpo-13748(7).)

   * *note dict.setdefault(): 1285. が与えられたキーのルックアップを一度
     しか行わないようになったので、組み込み型でのこれの使用はアトミック
     になります。(訳注: 外部観察可能な変化で説明すると、以前はこの呼び出
     しが、キーの2回の __hash__、__eq__ 呼び出しを引き起こしていたものが
     、1回になった。)

     (Contributed by Filip Gruszczyński in bpo-13521(8).)

   * 関数呼び出しが関数シグニチャに合致しない場合のエラーメッセージがか
     なり改善されました。

     (Contributed by Benjamin Peterson.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12753

   (2) https://bugs.python.org/issue?@action=redirect&bpo=13201

   (3) https://bugs.python.org/issue?@action=redirect&bpo=12170

   (4) https://bugs.python.org/issue?@action=redirect&bpo=12380

   (5) https://bugs.python.org/issue?@action=redirect&bpo=10516

   (6) https://bugs.python.org/issue?@action=redirect&bpo=11388

   (7) https://bugs.python.org/issue?@action=redirect&bpo=13748

   (8) https://bugs.python.org/issue?@action=redirect&bpo=13521


File: python.info,  Node: 細粒度のインポートロック,  Next: 組み込みの関数と型,  Prev: その他の言語変更<11>,  Up: What's New In Python 3 3

1.12.17 細粒度のインポートロック
--------------------------------

以前のバージョンの CPython では、常に大域的なインポートロックを当てにし
ていました。このことは意図せず頭痛の種を持ち込むこと繋がっていました。た
とえば、モジュールをインポートすることで副作用として異なるスレッドでのコ
ード実行を引き起こす際に起こる、デッドロックといったことです。不恰好な回
避策がときどき採用されてきました。C API 関数 *note
PyImport_ImportModuleNoBlock(): 3db. などです。

Python 3.3 ではモジュールのインポートでは、モジュール単位でのロックを採
用しています。このことによって複数スレッドからの指定モジュールのインポー
トは (モジュールが不完全な初期化のまま曝されるのを防いで) 正しく直列化さ
れて、前述の頭痛の種は取り除かれています。

(Contributed by Antoine Pitrou in bpo-9260(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9260


File: python.info,  Node: 組み込みの関数と型,  Next: 新たなモジュール<11>,  Prev: 細粒度のインポートロック,  Up: What's New In Python 3 3

1.12.18 組み込みの関数と型
--------------------------

   * *note open(): 316. gets a new 'opener' parameter: the underlying
     file descriptor for the file object is then obtained by calling
     'opener' with ('file', 'flags').  It can be used to use custom
     flags like *note os.O_CLOEXEC: 1288. for example.  The ‘'x'’ mode
     was added: open for exclusive creation, failing if the file already
     exists.

   * *note print(): 1177.: 'flush' キーワード引数が追加されました。
     'flush' キーワード引数が真の場合ストリームは強制的にフラッシュされ
     ます。

   * *note hash(): 801.: ハッシュのランダム化がデフォルトで有効になりま
     した。 *note object.__hash__(): cf3. と環境変数 *note
     PYTHONHASHSEED: 1289. を参照してください。

   * *note str: 169. 型に *note casefold(): fd6. メソッドが追加されまし
     た。文字列の casefold されたコピーを返します。casefold された文字列
     は、大文字小文字に関係ないマッチに使えます。例えば ‘'ß'.casefold()’
     は ‘'ss'’ を返します。

   * シーケンスについてのドキュメントを大幅に書き換えました。バイナリの
     シーケンスとテキストのシーケンスについての区別についてより良い説明
     を加え、また、個々の組み込みシーケンスに関して個別のドキュメントを
     提供しています (bpo-4966(1))。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=4966


File: python.info,  Node: 新たなモジュール<11>,  Next: 改良されたモジュール<11>,  Prev: 組み込みの関数と型,  Up: What's New In Python 3 3

1.12.19 新たなモジュール
------------------------

* Menu:

* faulthandler: faulthandler<5>.
* ipaddress: ipaddress<6>.
* lzma: lzma<2>.


File: python.info,  Node: faulthandler<5>,  Next: ipaddress<6>,  Up: 新たなモジュール<11>

1.12.19.1 faulthandler
......................

This new debug module *note faulthandler: 5c. contains functions to dump
Python tracebacks explicitly, on a fault (a crash like a segmentation
fault), after a timeout, or on a user signal.  Call *note
faulthandler.enable(): 20f. to install fault handlers for the *note
SIGSEGV: 128c, *note SIGFPE: 128d, *note SIGABRT: 128e, *note SIGBUS:
128f, and *note SIGILL: 1290. signals.  You can also enable them at
startup by setting the *note PYTHONFAULTHANDLER: 1291. environment
variable or by using *note -X: 16f. ‘faulthandler’ command line option.

Linuxでのセグメンテーションフォールト時の例:

     $ python -q -X faulthandler
     >>> import ctypes
     >>> ctypes.string_at(0)
     Fatal Python error: Segmentation fault

     Current thread 0x00007fb899f39700:
       File "/home/python/cpython/Lib/ctypes/__init__.py", line 486 in string_at
       File "<stdin>", line 1 in <module>
     Segmentation fault


File: python.info,  Node: ipaddress<6>,  Next: lzma<2>,  Prev: faulthandler<5>,  Up: 新たなモジュール<11>

1.12.19.2 ipaddress
...................

新規モジュール *note ipaddress: 84. は、IPv4/IPv6 アドレス、ネットワーク
、インターフェース (すなわち固有の IP サブネットで関連付けられる IP アド
レス) を表現するオブジェクトを生成したり加工したりするための道具立てを提
供します。

(Contributed by Google and Peter Moody in PEP 3144(1).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3144/


File: python.info,  Node: lzma<2>,  Prev: ipaddress<6>,  Up: 新たなモジュール<11>

1.12.19.3 lzma
..............

The newly added *note lzma: 8e. module provides data compression and
decompression using the LZMA algorithm, including support for the ‘.xz’
and ‘.lzma’ file formats.

(Contributed by Nadeem Vawda and Per Øyvind Karlsen in bpo-6715(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=6715


File: python.info,  Node: 改良されたモジュール<11>,  Next: 最適化<11>,  Prev: 新たなモジュール<11>,  Up: What's New In Python 3 3

1.12.20 改良されたモジュール
----------------------------

* Menu:

* abc: abc<2>.
* array: array<4>.
* base64: base64<5>.
* binascii: binascii<3>.
* bz2: bz2<2>.
* codecs: codecs<2>.
* collections: collections<7>.
* contextlib: contextlib<7>.
* crypt: crypt<2>.
* curses: curses<6>.
* datetime: datetime<7>.
* decimal: decimal<4>.
* email: email<6>.
* ftplib: ftplib<3>.
* functools: functools<7>.
* gc: gc<7>.
* hmac: hmac<5>.
* http: http<5>.
* html: html<2>.
* imaplib: imaplib<4>.
* inspect: inspect<10>.
* io: io<8>.
* itertools: itertools<7>.
* logging: logging<7>.
* math: math<10>.
* mmap: mmap<4>.
* multiprocessing: multiprocessing<9>.
* nntplib: nntplib<2>.
* os: os<13>.
* pdb: pdb<9>.
* pickle: pickle<6>.
* pydoc: pydoc<6>.
* re: re<10>.
* sched::
* select: select<2>.
* shlex: shlex<3>.
* shutil: shutil<7>.
* signal: signal<4>.
* smtpd: smtpd<4>.
* smtplib: smtplib<4>.
* socket: socket<11>.
* socketserver: socketserver<3>.
* sqlite3: sqlite3<11>.
* ssl: ssl<12>.
* stat: stat<2>.
* struct: struct<4>.
* subprocess: subprocess<6>.
* sys: sys<13>.
* tarfile: tarfile<9>.
* tempfile: tempfile<4>.
* textwrap: textwrap<3>.
* threading: threading<9>.
* time: time<8>.
* types: types<8>.
* unittest: unittest<11>.
* urllib: urllib<6>.
* webbrowser: webbrowser<4>.
* xml.etree.ElementTree: xml etree ElementTree<2>.
* zlib: zlib<3>.


File: python.info,  Node: abc<2>,  Next: array<4>,  Up: 改良されたモジュール<11>

1.12.20.1 abc
.............

Improved support for abstract base classes containing descriptors
composed with abstract methods.  The recommended approach to declaring
abstract descriptors is now to provide ‘__isabstractmethod__’ as a
dynamically updated property.  The built-in descriptors have been
updated accordingly.

   * *note abc.abstractproperty: 1296. は非推奨となりました。代わりに
     *note abc.abstractmethod(): 1297. に *note property: 4b3. を渡して
     使ってください。

   * *note abc.abstractclassmethod: 1298. は非推奨となりました。代わりに
     *note abc.abstractmethod(): 1297. に *note classmethod: 48e. を渡し
     て使ってください。

   * *note abc.abstractstaticmethod: 1299. は非推奨となりました。代わり
     に *note abc.abstractmethod(): 1297. に *note staticmethod: 453. を
     渡して使ってください。

(Contributed by Darren Dale in bpo-11610(1).)

*note abc.ABCMeta.register(): 129a. が登録されたサブクラスを返すようにな
りました。つまりクラスデコレータとして使うことができるようになったという
ことです (bpo-10868(2))。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11610

   (2) https://bugs.python.org/issue?@action=redirect&bpo=10868


File: python.info,  Node: array<4>,  Next: base64<5>,  Prev: abc<2>,  Up: 改良されたモジュール<11>

1.12.20.2 array
...............

The *note array: 8. module supports the long long type using ‘q’ and ‘Q’
type codes.

(Contributed by Oren Tirosh and Hirokazu Yamamoto in bpo-1172711(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1172711


File: python.info,  Node: base64<5>,  Next: binascii<3>,  Prev: array<4>,  Up: 改良されたモジュール<11>

1.12.20.3 base64
................

*note base64: f. モジュールのモダンなインターフェイスのほうのデコード関
数が、ASCII 文字のみで構成された Unicode 文字列を受け付けるようになりま
した。たとえば ‘base64.b64decode('YWJj')’ は ‘b'abc'’ を返します。
(Contributed by Catalin Iacob in bpo-13641(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13641


File: python.info,  Node: binascii<3>,  Next: bz2<2>,  Prev: base64<5>,  Up: 改良されたモジュール<11>

1.12.20.4 binascii
..................

‘a2b_’ 関数が、バイナリオブジェクトだけでなく ASCII 文字のみで構成された
Unicode 文字列を入力として受け付けるようになりました。 (Contributed by
Antoine Pitrou in bpo-13637(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13637


File: python.info,  Node: bz2<2>,  Next: codecs<2>,  Prev: binascii<3>,  Up: 改良されたモジュール<11>

1.12.20.5 bz2
.............

*note bz2: 14. モジュールが最初から書き直されました。その過程で新機能が
いくつか追加されました。

   * 新たな *note bz2.open(): 129f. 関数: bzip2 で圧縮されたファイルをバ
     イナリかテキストモードで開きます。

   * *note bz2.BZ2File: a66. が、コンストラクタの 'fileobj' 引数で、任意
     のファイル様オブジェクトの読み書きが出来るようになりました。

     (Contributed by Nadeem Vawda in bpo-5863(1).)

   * *note bz2.BZ2File: a66. と *note bz2.decompress(): 12a0. が
     (‘pbzip2’ ツールで生成されたような) マルチストリームの入力を展開出
     来るようになりました。同時に *note bz2.BZ2File: a66. は、 ‘'a'’ (追
     記) モードを使ってこのタイプの圧縮ファイルを作るのに使えるようにな
     りました。

     (Contributed by Nir Aides in bpo-1625(2).)

   * *note bz2.BZ2File: a66. now implements all of the *note
     io.BufferedIOBase: 8a3. API, except for the ‘detach()’ and
     ‘truncate()’ methods.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5863

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1625


File: python.info,  Node: codecs<2>,  Next: collections<7>,  Prev: bz2<2>,  Up: 改良されたモジュール<11>

1.12.20.6 codecs
................

*note mbcs: 57. コーデックが、全ての Windows バージョンでエラーハンドラ
‘replace’ と ‘ignore’ を正しく処理するように書き換えられました。 *note
mbcs: 57. コーデックは以前は、エンコードでは ‘replace’ のみ、デコードで
は ‘ignore’ のみでしたが、これにより全てのエラーハンドラがサポートされま
す。

新たに Windows のみ用のコーデック ‘cp65001’ が追加されました
(bpo-13216(1))。これは Windows コードページ 65001 (Windows UTF-8,
‘CP_UTF8’) です。例えばこれはコンソール出力のコードページが (例えば
‘chcp 65001’ コマンドを使って) cp65001 にセットされている場合に
‘sys.stdout’ で使われます。

マルチバイト CJK デコーダの再同期が高速になりました。これは不正なバイト
シーケンスが最初のバイトであれば無視するだけです。例えば
‘b'\xff\n'.decode('gb2312', 'replace')’ は文字置き換えののちに ‘\n’ を返
すようになっています。

(bpo-12016(2))

漸増的 CJK コーデックのエンコーダは以前は encode() メソッド呼び出しのた
びにリセットしていましたが、リセットしなくなりました。例えば:

     >>> import codecs
     >>> encoder = codecs.getincrementalencoder('hz')('strict')
     >>> b''.join(encoder.encode(x) for x in '\u52ff\u65bd\u65bc\u4eba\u3002 Bye.')
     b'~{NpJ)l6HK!#~} Bye.'

この例の場合は以前の Python では ‘b'~{Np~}~{J)~}~{l6~}~{HK~}~{!#~}
Bye.'’ となっていました。

(bpo-12100(3))

‘unicode_internal’ コーデックは非推奨となりました。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13216

   (2) https://bugs.python.org/issue?@action=redirect&bpo=12016

   (3) https://bugs.python.org/issue?@action=redirect&bpo=12100


File: python.info,  Node: collections<7>,  Next: contextlib<7>,  Prev: codecs<2>,  Up: 改良されたモジュール<11>

1.12.20.7 collections
.....................

新たに追加されたクラス *note ChainMap: e16. は、複数のマッピングをひとま
とまりに扱えるようにします。 (Written by Raymond Hettinger for
bpo-11089(1), made public in bpo-11297(2).)

抽象基底クラス群は新しいモジュール *note collections.abc: 1f. に移動しま
した。抽象コレクションと具象コレクションを識別しやすくするためです。これ
をインポートしている既存のコードを維持するために、 ABC の別名群が *note
collections: 1e. モジュール内に残されています。 (bpo-11085(3))

*note Counter: 12a3. クラスが、単項 ‘+’ 演算子、単項 ‘-’ 演算子、インプ
レイス演算子の ‘+=’, ‘-=’, ‘|=’, ‘&=’ をサポートするようになりました。
(Contributed by Raymond Hettinger in bpo-13121(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11089

   (2) https://bugs.python.org/issue?@action=redirect&bpo=11297

   (3) https://bugs.python.org/issue?@action=redirect&bpo=11085

   (4) https://bugs.python.org/issue?@action=redirect&bpo=13121


File: python.info,  Node: contextlib<7>,  Next: crypt<2>,  Prev: collections<7>,  Up: 改良されたモジュール<11>

1.12.20.8 contextlib
....................

コンテキストマネージャをプログラム的に操作することと、これと類似のクリー
ンアップの機能性について、*note ExitStack: d1e. が今後は確かな基礎を提供
します。かつての (非推奨となり削除された) ‘contextlib.nested’ API とは違
って、この新しい API は、コンテキストマネージャがリソースを (たとえばフ
ァイルオブジェクトなどを) ‘__init__’ メソッドで獲得したのか、あるいは (た
とえば *note threading: f3. モジュールからの同期オブジェクトを)
‘__enter__’ メソッドで獲得したのかとは無関係に正しく動作するように設計さ
れました。

(bpo-13585(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13585


File: python.info,  Node: crypt<2>,  Next: curses<6>,  Prev: contextlib<7>,  Up: 改良されたモジュール<11>

1.12.20.9 crypt
...............

Addition of salt and modular crypt format (hashing method) and the
‘mksalt()’ function to the ‘crypt’ module.

(bpo-10924(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10924


File: python.info,  Node: curses<6>,  Next: datetime<7>,  Prev: crypt<2>,  Up: 改良されたモジュール<11>

1.12.20.10 curses
.................

   * If the *note curses: 2f. module is linked to the ncursesw library,
     use Unicode functions when Unicode strings or characters are passed
     (e.g.  ‘waddwstr()’), and bytes functions otherwise (e.g.
     ‘waddstr()’).

   * Unicode 文字列をエンコードするのに ‘utf-8’ ではなく locale のエンコ
     ーディングを使うようになりました。(--訳注: bpo-12567(1) に対応した
     説明と思います。とすればこれは 'ワイド文字を受け取らない C 関数に渡
     す' 際に Unicode をエンコードする際の話。このときに以前は暗黙で
     ‘utf-8’ でエンコードしていたのは「誤りである」ということのようです
     。 --)

   * *note curses.window: 12a7. クラスに属性 *note
     curses.window.encoding: 12a8. が追加されました。

   * *note curses.window: 12a7. クラスに *note get_wch(): 12a9. メソッド
     が追加されました。これはワイド文字を一つ取得します。

   * *note curses: 2f. モジュールに関数 *note unget_wch(): 12aa. が追加
     されました。これはワイド文字をプッシュし、次に *note get_wch():
     12a9. を呼び出した時にその値が返るようにします。

(Contributed by Iñigo Serna in bpo-6755(2).)  (--訳注: 最初の2つはおそら
く bpo-12567(3) -)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12567

   (2) https://bugs.python.org/issue?@action=redirect&bpo=6755

   (3) https://bugs.python.org/issue?@action=redirect&bpo=12567


File: python.info,  Node: datetime<7>,  Next: decimal<4>,  Prev: curses<6>,  Up: 改良されたモジュール<11>

1.12.20.11 datetime
...................

   * naive な *note datetime: 4e2. インスタンスと aware な *note
     datetime: 4e2. インスタンスの等価比較で、 *note TypeError: 198. を
     投げずに *note False: d2b. を返すようになりました。 (bpo-15006(1)).

   * 新規メソッド *note datetime.datetime.timestamp(): 12ac.: *note
     datetime: 4e2. インスタンスに対応する POSIX タイムスタンプを返しま
     す。

   * *note datetime.datetime.strftime(): e8e. メソッドが 1000 年よりも前
     の書式化をサポートしました。(--訳注: What's New in Python 3.2 での
     変更も参照してみてください。--)

   * *note datetime.datetime.astimezone(): bc4. メソッドを引数なしで呼び
     出せるようになりました。これは datetime インスタンスをシステムのタ
     イムゾーンに変換します。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15006


File: python.info,  Node: decimal<4>,  Next: email<6>,  Prev: datetime<7>,  Up: 改良されたモジュール<11>

1.12.20.12 decimal
..................

bpo-7652(1) - decimal 算術演算の、高速なネイティブ 実装の統合

     C-module and libmpdec written by Stefan Krah.

The new C version of the decimal module integrates the high speed
libmpdec library for arbitrary precision correctly rounded decimal
floating-point arithmetic.  libmpdec conforms to IBM's General Decimal
Arithmetic Specification.

Performance gains range from 10x for database applications to 100x for
numerically intensive applications.  These numbers are expected gains
for standard precisions used in decimal floating-point arithmetic.
Since the precision is user configurable, the exact figures may vary.
For example, in integer bignum arithmetic the differences can be
significantly higher.

The following table is meant as an illustration.  Benchmarks are
available at ‘https://www.bytereef.org/mpdecimal/quickstart.html’.

                   decimal.py        _decimal           speedup
                                                        
     ---------------------------------------------------------------------
                                                        
     pi            42.02s            0.345s             120x
                                                        
                                                        
     telco         172.19s           5.68s              30x
                                                        
                                                        
     psycopg       3.57s             0.29s              12x
                                                        

* Menu:

* フィーチャー: フィーチャー<2>.
* API の変更: API の変更<2>.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=7652


File: python.info,  Node: フィーチャー<2>,  Next: API の変更<2>,  Up: decimal<4>

1.12.20.13 フィーチャー
.......................

   * *note FloatOperation: 12af. *note シグナル: 12b0. により、float と
     Decimal の混合の厳密なセマンティクスを有効に出来ます。(--訳注: 使用
     例が *note Quick-start tutorial: 12b1. にあります。--)

   * If Python is compiled without threads, the C version automatically
     disables the expensive thread local context machinery.  In this
     case, the variable *note HAVE_THREADS: 12b2. is set to ‘False’.


File: python.info,  Node: API の変更<2>,  Prev: フィーチャー<2>,  Up: decimal<4>

1.12.20.14 API の変更
.....................

   * C モジュールはマシンアーキテクチャに依存する以下のコンテキストの制
     限を持ちます:

                                           32-bit               64-bit
                                                                
          ------------------------------------------------------------------------------------
                                                                
          *note MAX_PREC: 12b4.            ‘425000000’          ‘999999999999999999’
                                                                
                                                                
          *note MAX_EMAX: 12b5.            ‘425000000’          ‘999999999999999999’
                                                                
                                                                
          *note MIN_EMIN: 12b6.            ‘-425000000’         ‘-999999999999999999’
                                                                

   * In the context templates (*note DefaultContext: 12b7, *note
     BasicContext: 12b8. and *note ExtendedContext: 12b9.) the magnitude
     of *note Emax: 12ba. and *note Emin: 12bb. has changed to ‘999999’.

   * decimal.py の *note Decimal: 1fe. コンストラクタは上記のコンテキス
     ト制限に無知で、任意の指数や精度で正確に変換しようとします。C 版は
     内部の制限を持っていますので、次の規則が使われます: 可能ならば値は
     正確に変換され、そうでない場合 *note InvalidOperation: 12bc. が送出
     されて結果が NaN となります。後者のケースは丸めあるいは不正確な値を
     得るために *note create_decimal(): 12bd. を使うことでいつでも可能で
     す。(--訳注: わかりにくい表現ですがコンテキストで InvalidOperation
     をトラップしていれば結果が NaN で受け取れて(そうでなければ
     InvalidOperation が投げられて)、その制御は create_decimal で明示的
     に行える、ということを言っています。--)

   * The power function in decimal.py is always correctly rounded.  In
     the C version, it is defined in terms of the correctly rounded
     *note exp(): 12be. and *note ln(): 12bf. functions, but the final
     result is only "almost always correctly rounded".

   * C 版ではシグナルを含む辞書は *note MutableMapping: 12c0. です。速度
     的な理由により *note flags: 12c1. と *note traps: 12c2. はコンテキ
     ストが初期化された時点での *note MutableMapping: 12c0. を参照し続け
     ます。新たなシグナル辞書を *note flags: 12c1. に *note traps: 12c2.
     割り当てれば新しい値で更新はされるものの、コンテキストはそれら右辺
     の辞書を参照しません。

   * *note Context: 12c3. を pickle 化するとこれまでとは異なる出力をしま
     す。これは Python 版と C 版で共通の交換フォーマットを実現するためで
     す。

   * *note Context: 12c3. コンストタクタの引数順が *note repr(): 1c1. で
     の表示順に合うように改められました。

   * *note quantize(): 12c4. メソッドの ‘watchexp’ パラメータが非推奨と
     なりました。


File: python.info,  Node: email<6>,  Next: ftplib<3>,  Prev: decimal<4>,  Up: 改良されたモジュール<11>

1.12.20.15 email
................

* Menu:

* ポリシーフレームワーク::
* 新規ヘッダ API を伴った暫定ポリシー::
* その他のAPIの変更::


File: python.info,  Node: ポリシーフレームワーク,  Next: 新規ヘッダ API を伴った暫定ポリシー,  Up: email<6>

1.12.20.16 ポリシーフレームワーク
.................................

email パッケージに *note policy: 53. フレームワークが追加されました。
*note Policy: 12c7. は、 email パッケージがどのように振舞うのかを制御す
るための多数のメソッドとプロパティを持つオブジェクトです。Python 3.3 の
ための最初のポリシーは *note Compat32: 12c8. で、これは Python 3.2 の
email パッケージとの後方互換性を提供します。 ‘policy’ は、 *note parser:
52. によって email メッセージが解析される際、あるいは *note Message:
581. オブジェクトを生成する際、あるいは *note generator: 44. を用いて
email がシリアライズする際に指定出来ます。オーバライドしない限りは、
‘parser’ に渡されたポリシーは全ての ‘Message’ オブジェクトと ‘parser’ が
生成したサブオブジェクトに引き継がれます。デフォルトでは ‘generator’ は
、シリアライズしようとする ‘Message’ オブジェクトのポリシーを使います。
デフォルトのポリシーは *note compat32: e97. です。

すべての ‘policy’ オブジェクトで実装される制御の最小限のセットは以下です
:

max_line_length     ‘Message’ がシリアライズされる際に各行が持ちうる、linesep
                    文字(列)を含まない最大の行幅です。デフォルトでは 78 です
                    。
                    
                    
linesep             ‘Message’ がシリアライズされる際に各行を分割するのに使わ
                    れる文字です。デフォルトは ‘\n’ です。
                    
                    
cte_type            ‘7bit’ または ‘8bit’ 。 ‘8bit’ は ‘Bytes’ ‘generator’ に
                    対してのみ適用され、プロトコルが許す場所 (あるいはオリジ
                    ナルの入力に含まれる場所) には非 ASCII が使われうることを
                    示します。
                    
                    
raise_on_defect     ‘parser’ が異常を検出した場合に、 ‘Message’ オブジェクト
                    の ‘defects’ リストに追加するのではなく例外を送出するよう
                    にします。
                    

新たな設定値を持つ新しいポリシーインスタンスは、ポリシーオブジェクトの
*note clone(): 12c9. メソッドを使って作られます。 ‘clone’ は任意の上記制
御値をキーワード引数として受け取ります。この呼び出しで指定されない制御は
デフォルトのまま残されます。ですので linesep 文字列として ‘\r\n’ を使う
ポリシーをこのようにして作れます:

     mypolicy = compat32.clone(linesep='\r\n')

ポリシーは、あなたのアプリケーションが必要とするフォーマットでメッセージ
を生成するのを簡単にしてくれます。 ‘generator’ を呼び出す全ての場所で
‘linesep='\r\n'’ を指定するのを忘れないようにする代わりに、あなたのプロ
グラムが ‘Message’ オブジェクトを作成するために使う ‘parser’ あるいは
‘Message’ がポリシーを要求する一箇所だけで指定すれば良いのです。もちろん
一方ではメッセージを複数の形式で生成する必要があれば、 ‘generator’ 呼び
出しのたびにパラメータで指定する必要があります。もしくは、あなた固有のケ
ースのためにカスタムなポリシーを作って、 ‘generator’ 作成の際にそれを渡
すことも出来ます。


File: python.info,  Node: 新規ヘッダ API を伴った暫定ポリシー,  Next: その他のAPIの変更,  Prev: ポリシーフレームワーク,  Up: email<6>

1.12.20.17 新規ヘッダ API を伴った暫定ポリシー
..............................................

ポリシーフレームワーク単品でもまったくもって価値があるものではありますが
、その導入の主たる動機は、それを使わないコードに対しての後方互換を壊さな
いやり方で、email パッケージに新機能を実現する新しいポリシーを作れるよう
にすることでした。その新しいポリシーは新規 API を導入するものなので、私
たちはそれらを Python 3.3 での *note 暫定ポリシー: 1243. としてリリース
しました。コア開発者が必要と判断すれば、後方互換性を破壊する (コードの破
棄さえも含む) 変更が起こりえます。

その新規ポリシーは *note EmailPolicy: 12cb. のインスタンス (訳注: *note
email.policy.default: 12cc. や *note email.policy.SMTP: 12cd. など) です
。これには以下の制御が追加されています:

refold_source       *note parser: 52. により解析されたヘッダを、
                    *note generator: 44. が折り返しし直す (refold) かどうかを
                    制御します。 ‘none’, ‘long’, ‘all’ のいずれかを指定します
                    。デフォルトは ‘long’ で、ソースのヘッダで
                    ‘max_line_length’ よりも長い行を refold します。 ‘none’ は
                    どの行も refold しません。 ‘all’ は全ての行を refold しま
                    す。
                    
                    
header_factory      ‘name’ と ‘value’ を引数に取り、カスタムなヘッダオブジェ
                    クトを生成する呼び出し可能 (callable) です。
                    

‘header_factory’ が、この新規ポリシーにより提供される新機能の要です。こ
の新規ポリシーの一つが使われると、 ‘Message’ オブジェクトから抽出された
すべてのヘッダは ‘header_factory’ で生成されるオブジェクトであり、また、
‘Message’ にヘッダをセットする場合のいつでも、それは ‘header_factory’ で
生成されるオブジェクトになります。すべてのその種のヘッダオブジェクトは、
ヘッダ名と同名の ‘name’ 属性を持ちます。アドレスヘッダと日付ヘッダは、ヘ
ッダの解析済み日付にアクセス出来るよう、追加の属性群を持ちます。以下のよ
うに使えます:

     >>> m = Message(policy=SMTP)
     >>> m['To'] = 'Éric <foo@example.com>'
     >>> m['to']
     'Éric <foo@example.com>'
     >>> m['to'].addresses
     (Address(display_name='Éric', username='foo', domain='example.com'),)
     >>> m['to'].addresses[0].username
     'foo'
     >>> m['to'].addresses[0].display_name
     'Éric'
     >>> m['Date'] = email.utils.localtime()
     >>> m['Date'].datetime
     datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, tzinfo=datetime.timezone(datetime.timedelta(-1, 72000), 'EDT'))
     >>> m['Date']
     'Fri, 25 May 2012 21:44:27 -0400'
     >>> print(m)
     To: =?utf-8?q?=C3=89ric?= <foo@example.com>
     Date: Fri, 25 May 2012 21:44:27 -0400

Unicode の display name が、メッセージがシリアライズされる際に自動的に
‘utf-8’ (訳注: 実行例の場合は「の MIME ヘッダエンコード」) でエンコード
され、ヘッダに直接アクセスすると Unicode で返ることに気付くと思います。
つまり *note email.header: 45. の *note decode_header(): 12ce. 関数や
*note make_header(): 12cf. 関数を取り扱う必要性を取り除いてくれています
。

アドレスを部品から組み立てることも出来ます:

     >>> m['cc'] = [Group('pals', [Address('Bob', 'bob', 'example.com'),
     ...                           Address('Sally', 'sally', 'example.com')]),
     ...            Address('Bonzo', addr_spec='bonz@laugh.com')]
     >>> print(m)
     To: =?utf-8?q?=C3=89ric?= <foo@example.com>
     Date: Fri, 25 May 2012 21:44:27 -0400
     cc: pals: Bob <bob@example.com>, Sally <sally@example.com>;, Bonzo <bonz@laugh.com>

Unicode へデコードするのは自動で行われます:

     >>> m2 = message_from_string(str(m))
     >>> m2['to']
     'Éric <foo@example.com>'

メッセージ解析の際、グループと個々のアドレスにアクセスするのにヘッダオブ
ジェクトの ‘addresses’ 属性と ‘groups’ 属性を使えます:

     >>> m2['cc'].addresses
     (Address(display_name='Bob', username='bob', domain='example.com'), Address(display_name='Sally', username='sally', domain='example.com'), Address(display_name='Bonzo', username='bonz', domain='laugh.com'))
     >>> m2['cc'].groups
     (Group(display_name='pals', addresses=(Address(display_name='Bob', username='bob', domain='example.com'), Address(display_name='Sally', username='sally', domain='example.com')), Group(display_name=None, addresses=(Address(display_name='Bonzo', username='bonz', domain='laugh.com'),))

要するに新規ポリシーのどれか一つを使うことは、ヘッダ操作をこのようなもの
にしてくれるということです: あなたのアプリケーションは Unicode 文字列で
お仕事をし、email パッケージは Unicode のエンコード/デコードを透過的に行
って RFC 標準 Content Transfer Encoding との相互変換をやってのける、と。


File: python.info,  Node: その他のAPIの変更,  Prev: 新規ヘッダ API を伴った暫定ポリシー,  Up: email<6>

1.12.20.18 その他のAPIの変更
............................

*note BytesHeaderParser: 12d1. が *note parser: 52. モジュールに追加され
ました。これは *note HeaderParser: 12d2. を補足するものであり、また、
bytes API を完全にする (訳注: What's New in Python 3.2 での email の変更
内容参照) ものです。

新しいユーティリティ関数:

   * *note format_datetime(): 12d3.: *note datetime: 4e2. を与えると
     email ヘッダで使われる書式でフォーマットした文字列を生成します。

   * *note parsedate_to_datetime(): 12d4.: email ヘッダからの日付文字列
     を渡すと、 aware な、または naive な *note datetime: 4e2. に変換し
     ます。オフセットが ‘-0000’ の場合に naive で返します。

   * *note localtime(): 2f7.: 引数なしで呼び出すと、ローカル *note
     timezone: 12d5. を使った aware な *note datetime: 4e2. として現在ロ
     ーカル時間を返します。aware な *note datetime: 4e2. を渡して呼び出
     すと、ローカル *note timezone: 12d5. を使った aware な *note
     datetime: 4e2. に変換します。


File: python.info,  Node: ftplib<3>,  Next: functools<7>,  Prev: email<6>,  Up: 改良されたモジュール<11>

1.12.20.19 ftplib
.................

   * *note ftplib.FTP: af6. に新しいキーワード引数 ‘source_address’ が追
     加されました。 ‘(host, port)’ の形で指定し、これは外に向かうソケッ
     トを作成する際に *note bind(): 12d7. 呼び出し内でのソースアドレスと
     して用いられます。 (Contributed by Giampaolo Rodolà in
     bpo-8594(1).)

   * *note FTP_TLS: af7. クラスに、制御チャネルを平文に戻すための *note
     ccc(): 12d8. 関数が追加されました。これは、固定ポートで開くことなく
     非セキュア FTP で NAT を処理する方法を知っているファイアウォールを
     利用するのに有用となりえます。(Contributed by Giampaolo Rodolà in
     bpo-12139(2).)

   * 新規メソッド *note ftplib.FTP.mlsd(): 12d9. は機械で読めるディレク
     トリリスティングのフォーマットを提供し、 *note ftplib.FTP.nlst():
     12da. と *note ftplib.FTP.dir(): 12db. に取って代わるものとなりまし
     た。(Contributed by Giampaolo Rodolà in bpo-11072(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=8594

   (2) https://bugs.python.org/issue?@action=redirect&bpo=12139

   (3) https://bugs.python.org/issue?@action=redirect&bpo=11072


File: python.info,  Node: functools<7>,  Next: gc<7>,  Prev: ftplib<3>,  Up: 改良されたモジュール<11>

1.12.20.20 functools
....................

*note functools.lru_cache(): be2. デコレータにキーワード引数 ‘typed’ を
指定出来るようになりました (デフォルトは ‘False’ です)。これは異なった型
の等値比較のキャッシュ値を別々のキャッシュスロットに置くかどうかを決めま
す。(Contributed by Raymond Hettinger in bpo-13227(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13227


File: python.info,  Node: gc<7>,  Next: hmac<5>,  Prev: functools<7>,  Up: 改良されたモジュール<11>

1.12.20.21 gc
.............

ガーベージコレクタが回収前後に呼び出すコールバックを登録出来るようになり
ました。新規属性 *note callbacks: 12de. リストに登録します。


File: python.info,  Node: hmac<5>,  Next: http<5>,  Prev: gc<7>,  Up: 改良されたモジュール<11>

1.12.20.22 hmac
...............

タイミング解析によるダイジェストに対する サイドチャンネル攻撃(1) からの
防御のために、 *note compare_digest(): 12e0. 関数が追加されました。
(Contributed by Nick Coghlan and Christian Heimes in bpo-15061(2).)

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Side-channel_attack

   (2) https://bugs.python.org/issue?@action=redirect&bpo=15061


File: python.info,  Node: http<5>,  Next: html<2>,  Prev: hmac<5>,  Up: 改良されたモジュール<11>

1.12.20.23 http
...............

*note http.server.BaseHTTPRequestHandler: 12e2. がヘッダをバッファするよ
うになり、 *note end_headers(): 12e3. 呼び出し時に一度に全てをまとめて書
き出すようになりました。新規のメソッド *note flush_headers(): 12e4. は、
集積したヘッダを送信する場合の管理に直接使うことが出来ます。(Contributed
by Andrew Schaaf in bpo-3709(1).)

*note http.server: 76. が正当な ‘HTML 4.01 strict’ 出力を生成するように
なりました。 (Contributed by Ezio Melotti in bpo-13295(2).)

*note http.client.HTTPResponse: 12e5. にメソッド *note readinto(): 12e6.
が追加されました。つまりこのクラスを *note io.RawIOBase: 12e7. のように
扱えるということです。 (Contributed by John Kuhn in bpo-13464(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=3709

   (2) https://bugs.python.org/issue?@action=redirect&bpo=13295

   (3) https://bugs.python.org/issue?@action=redirect&bpo=13464


File: python.info,  Node: html<2>,  Next: imaplib<4>,  Prev: http<5>,  Up: 改良されたモジュール<11>

1.12.20.24 html
...............

*note html.parser.HTMLParser: a77. is now able to parse broken markup
without raising errors, therefore the 'strict' argument of the
constructor and the ‘HTMLParseError’ exception are now deprecated.  The
ability to parse broken markup is the result of a number of bug fixes
that are also available on the latest bug fix releases of Python
2.7/3.2.  (Contributed by Ezio Melotti in bpo-15114(1), and
bpo-14538(2), bpo-13993(3), bpo-13960(4), bpo-13358(5), bpo-1745761(6),
bpo-755670(7), bpo-13357(8), bpo-12629(9), bpo-1200313(10),
bpo-670664(11), bpo-13273(12), bpo-12888(13), bpo-7311(14).)

*note html.entities: 70. モジュールに、HTML5 名前付き文字参照と Unicode
文字(列) とを対応付ける *note html5: 12e9. 辞書が追加されました (例:
‘html5['gt;'] == '>'’)。この辞書は既に *note HTMLParser: a77. が使ってい
ます。 (Contributed by Ezio Melotti in bpo-11113(15) and bpo-15156(16).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15114

   (2) https://bugs.python.org/issue?@action=redirect&bpo=14538

   (3) https://bugs.python.org/issue?@action=redirect&bpo=13993

   (4) https://bugs.python.org/issue?@action=redirect&bpo=13960

   (5) https://bugs.python.org/issue?@action=redirect&bpo=13358

   (6) https://bugs.python.org/issue?@action=redirect&bpo=1745761

   (7) https://bugs.python.org/issue?@action=redirect&bpo=755670

   (8) https://bugs.python.org/issue?@action=redirect&bpo=13357

   (9) https://bugs.python.org/issue?@action=redirect&bpo=12629

   (10) https://bugs.python.org/issue?@action=redirect&bpo=1200313

   (11) https://bugs.python.org/issue?@action=redirect&bpo=670664

   (12) https://bugs.python.org/issue?@action=redirect&bpo=13273

   (13) https://bugs.python.org/issue?@action=redirect&bpo=12888

   (14) https://bugs.python.org/issue?@action=redirect&bpo=7311

   (15) https://bugs.python.org/issue?@action=redirect&bpo=11113

   (16) https://bugs.python.org/issue?@action=redirect&bpo=15156


File: python.info,  Node: imaplib<4>,  Next: inspect<10>,  Prev: html<2>,  Up: 改良されたモジュール<11>

1.12.20.25 imaplib
..................

*note IMAP4_SSL: b00. コンストラクタが SSLContext パラメータを受け取るよ
うになりました。これはセキュアなチャネルのパラメータを制御します。

(Contributed by Sijin Joseph in bpo-8808(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=8808


File: python.info,  Node: inspect<10>,  Next: io<8>,  Prev: imaplib<4>,  Up: 改良されたモジュール<11>

1.12.20.26 inspect
..................

*note getclosurevars(): 12ec. 関数が追加されました。この関数は、指定した
関数の関数本体から参照されている現在束縛されている全ての名前と、それら名
前が解決された場所 (訳注: globals, builtins など) を報告します。これによ
り、ステートフルなクロージャに依存するコードをテストするのに、正しい内部
状態を検証するのが容易になります。

(Contributed by Meador Inge and Nick Coghlan in bpo-13062(1).)

*note getgeneratorlocals(): 12ed. 関数が追加されました。この関数は、指定
したジェネレータのスタックフレーム内のローカル変数の、現在束縛されている
ものを報告します。これにより、ジェネレータをテストするのに、正しい内部状
態を検証するのが容易になります。

(Contributed by Meador Inge in bpo-15153(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13062

   (2) https://bugs.python.org/issue?@action=redirect&bpo=15153


File: python.info,  Node: io<8>,  Next: itertools<7>,  Prev: inspect<10>,  Up: 改良されたモジュール<11>

1.12.20.27 io
.............

*note open(): 740. 関数に排他的作成に使用する新たな ‘'x'’ モードが追加さ
れました。ファイルが既に存在する場合は *note FileExistsError: 1221. を送
出します。 C11 fopen() の 'x' モードに基づいています。

(Contributed by David Townshend in bpo-12760(1).)

The constructor of the *note TextIOWrapper: 9be. class has a new
'write_through' optional argument.  If 'write_through' is ‘True’, calls
to ‘write()’ are guaranteed not to be buffered: any data written on the
*note TextIOWrapper: 9be. object is immediately handled to its
underlying binary buffer.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12760


File: python.info,  Node: itertools<7>,  Next: logging<7>,  Prev: io<8>,  Up: 改良されたモジュール<11>

1.12.20.28 itertools
....................

*note accumulate(): bf0. がユーザ提供二項関数を渡すためのオプショナル引
数 ‘func’ を受け付けるようになりました。


File: python.info,  Node: logging<7>,  Next: math<10>,  Prev: itertools<7>,  Up: 改良されたモジュール<11>

1.12.20.29 logging
..................

*note basicConfig(): bf3. 関数がオプショナルな ‘handlers’ 引数をサポート
するようになりました。これはルートロガーに追加するハンドラ群の *note
イテラブル: 12f1. です。

A class level attribute ‘append_nul’ has been added to *note
SysLogHandler: 86c. to allow control of the appending of the ‘NUL’
(‘\000’) byte to syslog records, since for some daemons it is required
while for others it is passed through to the log.


File: python.info,  Node: math<10>,  Next: mmap<4>,  Prev: logging<7>,  Up: 改良されたモジュール<11>

1.12.20.30 math
...............

*note math: 92. モジュールに新たな関数 *note log2(): 12f3. が追加されま
した。'x' の 2 を底とする対数を返します。

(Written by Mark Dickinson in bpo-11888(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11888


File: python.info,  Node: mmap<4>,  Next: multiprocessing<9>,  Prev: math<10>,  Up: 改良されたモジュール<11>

1.12.20.31 mmap
...............

*note read(): 12f5. メソッドの他のファイルライクなオブジェクトとの互換性
が増しました。引数が省略されるか ‘None’ の場合に、ファイルの現在位置から
マッピングの末尾までのバイト列を返すようになっています。(Contributed by
Petri Lehtinen in bpo-12021(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12021


File: python.info,  Node: multiprocessing<9>,  Next: nntplib<2>,  Prev: mmap<4>,  Up: 改良されたモジュール<11>

1.12.20.32 multiprocessing
..........................

関数 *note multiprocessing.connection.wait(): 12f7. が追加されました。こ
れは複数の (接続やソケット、パイプのような) オブジェクトをタイムアウト付
きでポーリングします。(Contributed by Richard Oudkerk in bpo-12328(1).)

*note multiprocessing.connection.Connection: 12f8. objects can now be
transferred over multiprocessing connections.  (Contributed by Richard
Oudkerk in bpo-4892(2).)

*note multiprocessing.Process: 252. がキーワード引数 ‘daemon’ を取るよう
になりました。これは親プロセスから ‘daemon’ フラグを継承するデフォルトの
振る舞いをオーバライドします (bpo-6064(3))。

属性 *note multiprocessing.Process.sentinel: 12f9. が追加されました。こ
れを用いることで、ふさわしい OS プリミティブ (例えば POSIX システムでの
*note select: c6.) を使った一括での複数 *note Process: 252. オブジェクト
待ちが可能です。

*note map(): 19f. と *note itertools.starmap(): 12fa. との関係と同じ、既
存の *note multiprocessing.pool.Pool.map(): 12fb. と *note map_async():
12fc. に対応する *note multiprocessing.pool.Pool.starmap(): 12fd. と
*note starmap_async(): 12fe. が追加されました。 (Contributed by Hynek
Schlawack in bpo-12708(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12328

   (2) https://bugs.python.org/issue?@action=redirect&bpo=4892

   (3) https://bugs.python.org/issue?@action=redirect&bpo=6064

   (4) https://bugs.python.org/issue?@action=redirect&bpo=12708


File: python.info,  Node: nntplib<2>,  Next: os<13>,  Prev: multiprocessing<9>,  Up: 改良されたモジュール<11>

1.12.20.33 nntplib
..................

The ‘nntplib.NNTP’ class now supports the context management protocol to
unconditionally consume *note socket.error: 1261. exceptions and to
close the NNTP connection when done:

     >>> from nntplib import NNTP
     >>> with NNTP('news.gmane.org') as n:
     ...     n.group('gmane.comp.python.committers')
     ...
     ('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, 'gmane.comp.python.committers')
     >>>

(Contributed by Giampaolo Rodolà in bpo-9795(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9795


File: python.info,  Node: os<13>,  Next: pdb<9>,  Prev: nntplib<2>,  Up: 改良されたモジュール<11>

1.12.20.34 os
.............

   * The *note os: a5. module has a new *note pipe2(): 1301. function
     that makes it possible to create a pipe with *note O_CLOEXEC: 1288.
     or *note O_NONBLOCK: 103b. flags set atomically.  This is
     especially useful to avoid race conditions in multi-threaded
     programs.

   * *note os: a5. モジュールに *note sendfile(): d05. 関数が追加されま
     した。これはあるファイル (またはソケット) 記述子からのコピーを、効
     率的な「ゼロコピー」で行います。「ゼロコピー」という言い回しは、こ
     れは二つの記述子間でのデータのコピー全てが完全にカーネルによって行
     われる、という事実について指しています。データコピーにユーザ空間の
     バッファは使われません。 *note sendfile(): d05. は例えばファイルの
     ダウンロードのような、ディスク上のファイルとネットワークソケット間
     での効率的なデータコピーに使うことが出来ます。

     (Patch submitted by Ross Lagerwall and Giampaolo Rodolà in
     bpo-10882(1).)

   * シンボリックリンク攻撃や一時ファイル、一時ディレクトリにまつわる問
     題のような競合状態を避けるには、ファイル名の代わりにファイル記述子
     を操作することがより信頼出来ます (そして高速でもあります)。 Python
     3.3 はファイル記述子で動作するよう既存関数の強化と新規関数の追加を
     行ないました。 (bpo-4761(2), bpo-10755(3) and bpo-14626(4))

        - *note os: a5. モジュールの新規関数 *note fwalk(): d52. は
          *note walk(): 6d0. と似ていますが、これは訪問するディレクトリ
          を指すファイル記述子も yield します。これは特にシンボリックリ
          ンクの競合を避けるために有用です。

        - The following functions get new optional 'dir_fd' (*note paths
          relative to directory descriptors: 1302.) and/or
          'follow_symlinks' (*note not following symlinks: 1303.): *note
          access(): 1304, *note chflags(): 1305, *note chmod(): 529,
          *note chown(): 1306, *note link(): 1307, *note lstat(): 6c8,
          *note mkdir(): 52b, *note mkfifo(): f90, *note mknod(): f91,
          *note open(): f92, *note readlink(): b1a, *note remove():
          1308, *note rename(): 1309, *note replace(): 130a, *note
          rmdir(): 130b, *note stat(): 26d, *note symlink(): 130c, *note
          unlink(): 130d, *note utime(): 130e.  Platform support for
          using these parameters can be checked via the sets *note
          os.supports_dir_fd: 130f. and *note
          os.supports_follow_symlinks: 1310.

        - 関数 *note chdir(): 821, *note chmod(): 529, *note chown():
          1306, *note execve(): 1311, *note listdir(): 1312, *note
          pathconf(): 1313, *note exists(): c03, *note stat(): 26d,
          *note statvfs(): 1314, *note utime(): 130e. が、パス引数として
          ファイル記述子をサポートするようになりました。これをプラットフ
          ォームがサポートするかどうかは *note os.supports_fd: 1315. を
          調べることでわかります。

   * *note access(): 1304. がキーワード引数 ‘effective_ids’ を受け取るよ
     うになりました。これは実 uid/gid の代わりに実効 uid/gid を使ってア
     クセスチェックを行うように振る舞いを変更します。これをプラットフォ
     ームがサポートするかどうかは *note supports_effective_ids: 1316. を
     調べることでわかります。

   * *note os: a5. モジュールに 2 つの関数が追加されました。 *note
     getpriority(): 1317. と *note setpriority(): 1318. です。これらはプ
     ロセスのナイス値/優先度 (niceness/priority) を *note os.nice():
     1319. と似た方法で取得・設定しますが、現在プロセスだけのものだけで
     はなく全てのプロセスに対して使えるよう拡張されています。

     (Patch submitted by Giampaolo Rodolà in bpo-10784(5).)

   * 新規関数 *note os.replace(): 130a. は変更先の上書きにおいてクロスプ
     ラットフォームな方法でファイル名変更を行えます。既存の *note
     os.rename(): 1309. では、変更先が既存のファイルの場合に POSIX では
     上書き、Windows ではエラーとなります。(Contributed by Antoine
     Pitrou in bpo-8828(6).)

   * stat 系関数 (*note stat(): 26d, *note fstat(): f8c, *note lstat():
     6c8.) がファイルのタイムスタンプのナノ秒精度を読み取れるようになり
     ました。これと対となる *note utime(): 130e. もファイルのタイムスタ
     ンプをナノ秒精度で書き出せるようになりました。 (Contributed by
     Larry Hastings in bpo-14127(7).)

   * 新規関数 *note os.get_terminal_size(): 131a. はファイル記述子が接続
     しているターミナルウィンドウのサイズを取得します。 *note
     shutil.get_terminal_size(): 131b. も参照して下さい。 (Contributed
     by Zbigniew Jędrzejewski-Szmek in bpo-13609(8).)

   * Linux 拡張属性をサポートするための新たな関数 (bpo-12720(9)): *note
     getxattr(): 131c, *note listxattr(): 131d, *note removexattr():
     131e, *note setxattr(): 131f.

   * スケジューラに対する新たなインターフェイス。これら関数はプロセスに
     対する OS による CPU 時間割り当てを制御します。新規関数: *note
     sched_get_priority_max(): 1320, *note sched_get_priority_min():
     1321, *note sched_getaffinity(): 1322, *note sched_getparam():
     1323, *note sched_getscheduler(): 1324, *note
     sched_rr_get_interval(): 1325, *note sched_setaffinity(): 1326,
     *note sched_setparam(): 1327, *note sched_setscheduler(): 1328,
     *note sched_yield(): 1329,

   * ファイルシステムを制御する新たな関数:

        * *note posix_fadvise(): f93.: データへアクセスする意思を、パタ
          ーンを指定して宣言します。これによりカーネルが最適化を行えるよ
          うになります。

        * *note posix_fallocate(): f94.: ファイルを割り当てるに十分なデ
          ィスクスペースを確保します。

        * *note sync(): 132a.: ディスクへの全ての書き込みを強制します。

   * 追加された新たな POSIX 関数:

        * *note lockf(): 132b.: オープンされたファイル記述子に対して、
          POSIX ロックの適用、テスト、解除を行います。

        * *note pread(): d56.: ファイル記述子の指定オフセット位置から読
          み込みます。ファイルオフセットは変化しません。

        * *note pwrite(): d59.: ファイル記述子に対し、指定オフセット位置
          から書き出します。ファイルオフセットは変化しません。

        * *note readv(): d55.: ファイル記述子からデータを読みこんで複数
          の書き込み可能なバッファに書き込みます。

        * *note truncate(): 103c.: 'path' に対応するファイルを、サイズが
          最大で 'length' バイトになるよう切り詰めます。

        * *note waitid(): f99.: 一つ以上の子プロセスの完了を待ちます。

        * *note writev(): d58.: 'buffers' の内容をファイル記述子へ書き出
          します。 'buffer' は任意のバッファのシーケンスです。

        * *note getgrouplist(): 132c. (bpo-9344(10)): 指定したユーザが属
          するグループ ID のリストを返します。

   * *note times(): 132d. および *note uname(): 132e.: 戻り値の型がタプ
     ルから属性名のついたタプルライクオブジェクトに変更されました。

   * いくつかのプラットフォームにおいて、 *note lseek(): 132f. 関数で使
     う追加の定数をサポートするようになりました。 ‘os.SEEK_HOLE’ や
     ‘os.SEEK_DATA’ などです。

   * New constants *note RTLD_LAZY: 1330, *note RTLD_NOW: 1331, *note
     RTLD_GLOBAL: 1332, *note RTLD_LOCAL: 1333, *note RTLD_NODELETE:
     1334, *note RTLD_NOLOAD: 1335, and *note RTLD_DEEPBIND: 1336. are
     available on platforms that support them.  These are for use with
     the *note sys.setdlopenflags(): 1337. function, and supersede the
     similar constants defined in *note ctypes: 2e. and ‘DLFCN’.
     (Contributed by Victor Stinner in bpo-13226(11).)

   * クロスプラットフォームのサポートを簡単にするために、非 Windows 環境
     でも *note os.symlink(): 130c. がキーワード引数
     ‘target_is_directory’ を受け付けるようになりました (単に無視します
     )。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10882

   (2) https://bugs.python.org/issue?@action=redirect&bpo=4761

   (3) https://bugs.python.org/issue?@action=redirect&bpo=10755

   (4) https://bugs.python.org/issue?@action=redirect&bpo=14626

   (5) https://bugs.python.org/issue?@action=redirect&bpo=10784

   (6) https://bugs.python.org/issue?@action=redirect&bpo=8828

   (7) https://bugs.python.org/issue?@action=redirect&bpo=14127

   (8) https://bugs.python.org/issue?@action=redirect&bpo=13609

   (9) https://bugs.python.org/issue?@action=redirect&bpo=12720

   (10) https://bugs.python.org/issue?@action=redirect&bpo=9344

   (11) https://bugs.python.org/issue?@action=redirect&bpo=13226


File: python.info,  Node: pdb<9>,  Next: pickle<6>,  Prev: os<13>,  Up: 改良されたモジュール<11>

1.12.20.35 pdb
..............

‘Tab’ キーでの補完がコマンド名だけでなくその引数に対しても使えるようにな
りました。例えば ‘break’ コマンドに対しては、関数、ファイル名が補完され
ます。

(Contributed by Georg Brandl in bpo-14210(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14210


File: python.info,  Node: pickle<6>,  Next: pydoc<6>,  Prev: pdb<9>,  Up: 改良されたモジュール<11>

1.12.20.36 pickle
.................

*note pickle.Pickler: c13. オブジェクトに pickler ごとのリダクション関数
を設定する、オプショナルな *note dispatch_table: 133a. 属性が追加されま
した。

(Contributed by Richard Oudkerk in bpo-14166(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14166


File: python.info,  Node: pydoc<6>,  Next: re<10>,  Prev: pickle<6>,  Up: 改良されたモジュール<11>

1.12.20.37 pydoc
................

The Tk GUI and the ‘serve()’ function have been removed from the *note
pydoc: ba. module: ‘pydoc -g’ and ‘serve()’ have been deprecated in
Python 3.2.


File: python.info,  Node: re<10>,  Next: sched,  Prev: pydoc<6>,  Up: 改良されたモジュール<11>

1.12.20.38 re
.............

*note str: 169. 正規表現が ‘\u’ および ‘\U’ エスケープをサポートしました
。

(Contributed by Serhiy Storchaka in bpo-3665(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=3665


File: python.info,  Node: sched,  Next: select<2>,  Prev: re<10>,  Up: 改良されたモジュール<11>

1.12.20.39 sched
................

   * *note run(): 133e. が 'blocking' パラメータを取るようになりました。
     これを偽にセットすると、このメソッドは既に実行予定時間になっている
     イベント (もしあれば) を実行してすぐに戻ります。 これは *note
     scheduler: 133f. を非ブロッキングなアプリケーションで使いたい場合に
     有用です。 (Contributed by Giampaolo Rodolà in bpo-13449(1).)  (--訳
     注: 原文の表現がわかりにくいですが、これは ‘blocking=False’ 時はス
     ケジュールされた時間になっているタスクがあれば通常は 'delayfunc' を
     呼び出すところをそうせずに、一番早く次の予定時間に達するタスクの予
     定時間までの時間差を返します。--)

   * *note scheduler: 133f. クラスをマルチスレッド環境で安全に使えるよう
     になりました。 (Contributed by Josiah Carlson and Giampaolo Rodolà
     in bpo-8684(2).)

   * *note scheduler: 133f. クラスのコンストラクタでのパラメータ
     'timefunc' と 'delayfunc' が省略可能になりました。それぞれデフォル
     トで順に *note time.time(): 55d, *note time.sleep(): 8ac. が使われ
     ます。 (Contributed by Chris Clark in bpo-13245(3).)

   * *note enter(): 1340. と *note enterabs(): 1341. の 'argument' パラ
     メータが省略可能になりました。 (Contributed by Chris Clark in
     bpo-13245(4).)

   * *note enter(): 1340. と *note enterabs(): 1341. が 'kwargs' パラメ
     ータを受け付けるようになりました。 (Contributed by Chris Clark in
     bpo-13245(5).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13449

   (2) https://bugs.python.org/issue?@action=redirect&bpo=8684

   (3) https://bugs.python.org/issue?@action=redirect&bpo=13245

   (4) https://bugs.python.org/issue?@action=redirect&bpo=13245

   (5) https://bugs.python.org/issue?@action=redirect&bpo=13245


File: python.info,  Node: select<2>,  Next: shlex<3>,  Prev: sched,  Up: 改良されたモジュール<11>

1.12.20.40 select
.................

Solaris とその派生プラットフォームにおいて、新規クラス *note
select.devpoll: 1198. が追加されました。これはハイパフォーマンスな非同期
ソケットを ‘/dev/poll’ 経由で提供するものです。 (Contributed by Jesús
Cea Avión in bpo-6397(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=6397


File: python.info,  Node: shlex<3>,  Next: shutil<7>,  Prev: select<2>,  Up: 改良されたモジュール<11>

1.12.20.41 shlex
................

The previously undocumented helper function ‘quote’ from the ‘pipes’
modules has been moved to the *note shlex: c9. module and documented.
*note quote(): 582. properly escapes all characters in a string that
might be otherwise given special meaning by the shell.


File: python.info,  Node: shutil<7>,  Next: signal<4>,  Prev: shlex<3>,  Up: 改良されたモジュール<11>

1.12.20.42 shutil
.................

   * 新たな関数:

        * *note disk_usage(): 1345.: ディスクの利用状況について、トータ
          ル、使用中、空きの容量を返します。 (Contributed by Giampaolo
          Rodolà in bpo-12442(1).)

        * *note chown(): 548.: 指定された path のユーザ、グループの両方
          あるいは一方を変更します。ユーザ、グループは名前もしくは数値で
          の ID (uid, gid) で指定します。(Contributed by Sandro Tosi in
          bpo-12191(2).)

        * *note shutil.get_terminal_size(): 131b.: インタプリタが接続し
          ているターミナルウィンドウのサイズを取得します。 (Contributed
          by Zbigniew Jędrzejewski-Szmek in bpo-13609(3).)

   * *note copy2(): c50. と *note copystat(): 1346. がファイルのタイムス
     タンプを、それをサポートするプラットフォームではナノ秒精度も維持す
     るようになりました。また、Linux ではこれらは「拡張属性 (extended
     attributes)」もコピーするようになりました。 (Contributed by Larry
     Hastings in bpo-14127(4) and bpo-15238(5).)

   * いくつかの関数がオプショナルな ‘symlinks’ 引数を取るようになりまし
     た。これが真の場合、シンボリックリンクの指す先を解決するのではなく
     シンボリックそのものに対しての操作をします (そうすることが必要であ
     ればシンボリックリンク作成もします)。(Contributed by Hynek
     Schlawack in bpo-12715(6).)

   * ファイルシステムをまたがったファイルのコピーの際に、 *note move():
     c51. がシンボリックリンクを POSIX の ‘move’ コマンドが行うのと同じ
     やり方で扱うようになりました。つまりターゲットのファイルの中身をコ
     ピーするのではなくシンボリックリンクを再作成します。(Contributed by
     Jonathan Niehof in bpo-9993(7).)  また、 *note move(): c51. は
     ‘dst’ 引数を戻り値として返すようになりました。

   * *note os.open(): f92. と *note os.unlink(): 130d. が新パラメータ
     ‘dir_fd’ をサポートしているプラットフォームでは、 *note rmtree():
     356. は今では シンボリックリンク攻撃に耐性を持ちます。 (Contributed
     by Martin von Löwis and Hynek Schlawack in bpo-4489(8).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12442

   (2) https://bugs.python.org/issue?@action=redirect&bpo=12191

   (3) https://bugs.python.org/issue?@action=redirect&bpo=13609

   (4) https://bugs.python.org/issue?@action=redirect&bpo=14127

   (5) https://bugs.python.org/issue?@action=redirect&bpo=15238

   (6) https://bugs.python.org/issue?@action=redirect&bpo=12715

   (7) https://bugs.python.org/issue?@action=redirect&bpo=9993

   (8) https://bugs.python.org/issue?@action=redirect&bpo=4489


File: python.info,  Node: signal<4>,  Next: smtpd<4>,  Prev: shutil<7>,  Up: 改良されたモジュール<11>

1.12.20.43 signal
.................

   * *note signal: cb. モジュールに新規関数が追加されました:

        * *note pthread_sigmask(): 1348.: これを呼び出すスレッドにセット
          されているシグナルマスクを取り出したり変更したりします
          (Contributed by Jean-Paul Calderone in bpo-8407(1));

        * *note pthread_kill(): 1349.: スレッドにシグナルを送ります;

        * *note sigpending(): 134a.: 保留中のシグナルを調べます;

        * *note sigwait(): 134b.: シグナルを待ちます;

        * *note sigwaitinfo(): fab.: シグナルを待ちますが、それについて
          の詳細情報を返します;

        * *note sigtimedwait(): faa.: *note sigwaitinfo(): fab. と似てい
          ますがタイムアウト指定できます。

   * シグナルハンドラは wakeup ファイル記述子に以前は ‘\0’ を書き込んで
     いましたが、シグナル番号を 1 バイト整数として書き込むようにしました
     。これにより、一つ以上のシグナルを待った上でどのシグナルが発生した
     のかあとから調べるといったことが出来ます。

   * *note signal.signal(): 134c. と *note signal.siginterrupt(): 134d.
     は RuntimeError ではなく *note OSError: 2c0. を投げるようになりまし
     た: OSError は errno 属性を持っています。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=8407


File: python.info,  Node: smtpd<4>,  Next: smtplib<4>,  Prev: signal<4>,  Up: 改良されたモジュール<11>

1.12.20.44 smtpd
................

The ‘smtpd’ module now supports RFC 5321(1) (extended SMTP) and RFC
1870(2) (size extension).  Per the standard, these extensions are
enabled if and only if the client initiates the session with an ‘EHLO’
command.

(Initial ‘ELHO’ support by Alberto Trevino.  Size extension by Juhana
Jauhiainen.  Substantial additional work on the patch contributed by
Michele Orrù and Dan Boswell.  bpo-8739(3))

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc5321.html

   (2) https://datatracker.ietf.org/doc/html/rfc1870.html

   (3) https://bugs.python.org/issue?@action=redirect&bpo=8739


File: python.info,  Node: smtplib<4>,  Next: socket<11>,  Prev: smtpd<4>,  Up: 改良されたモジュール<11>

1.12.20.45 smtplib
..................

クラス *note SMTP: b27, *note SMTP_SSL: b28, *note LMTP: b29. に新しいキ
ーワード引数 ‘source_address’ が追加されました。 ‘(host, port)’ の形で指
定し、これは外に向かうソケットを作成する際に *note bind(): 12d7. 呼び出
し内でのソースアドレスとして用いられます。(Contributed by Paulo Scardine
in bpo-11281(1).)

*note SMTP: b27. がコンテキスト管理プロトコルをサポートするようになった
ので ‘SMTP’ のインスタンスを ‘with’ 文で使えます。 (Contributed by
Giampaolo Rodolà in bpo-11289(2).)

*note SMTP_SSL: b28. コンストラクタと *note starttls(): 1350. メソッドが
SSLContext パラメータを受け取るようになりました。これはセキュアなチャネ
ルのパラメータを制御します。 (Contributed by Kasun Herath in
bpo-8809(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11281

   (2) https://bugs.python.org/issue?@action=redirect&bpo=11289

   (3) https://bugs.python.org/issue?@action=redirect&bpo=8809


File: python.info,  Node: socket<11>,  Next: socketserver<3>,  Prev: smtplib<4>,  Up: 改良されたモジュール<11>

1.12.20.46 socket
.................

   * *note socket: fa1. クラスが、前提となるプラットフォームがサポートし
     ていれば従属的なデータを処理する追加のメソッドを公開しました:

        * *note sendmsg(): 6a1.

        * *note recvmsg(): fa6.

        * *note recvmsg_into(): 1352.

     (Contributed by David Watson in bpo-6560(1), based on an earlier
     patch by Heiko Wundram)

   * *note socket: fa1. クラスが Linux で
     (‘https://lwn.net/Articles/253425’) PF_CAN プロトコルファミリ
     (‘https://en.wikipedia.org/wiki/Socketcan’) をサポートしました。

     (Contributed by Matthias Fuchs, updated by Tiago Gonçalves in
     bpo-10141(2).)

   * The *note socket: fa1. class now supports the PF_RDS protocol
     family (‘https://en.wikipedia.org/wiki/Reliable_Datagram_Sockets’
     and https://oss.oracle.com/projects/rds(3)).

   * *note socket: fa1. クラスが OS X で ‘PF_SYSTEM’ プロトコルファミリ
     をサポートするようになりました。 (Contributed by Michael Goderbauer
     in bpo-13777(4).)

   * New function *note sethostname(): 1353. allows the hostname to be
     set on Unix systems if the calling process has sufficient
     privileges.  (Contributed by Ross Lagerwall in bpo-10866(5).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=6560

   (2) https://bugs.python.org/issue?@action=redirect&bpo=10141

   (3) 
https://web.archive.org/web/20130115155505/https://oss.oracle.com/projects/rds/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=13777

   (5) https://bugs.python.org/issue?@action=redirect&bpo=10866


File: python.info,  Node: socketserver<3>,  Next: sqlite3<11>,  Prev: socket<11>,  Up: 改良されたモジュール<11>

1.12.20.47 socketserver
.......................

*note BaseServer: 1355. がオーバライド可能な *note service_actions():
1356. メソッドを持つようになり、これは *note serve_forever(): 1357. によ
りサービスループ内で呼び出されます。 *note ForkingMixIn: d71. がこれをゾ
ンビ化した子プロセスのクリーンアップに使っています。 (Contributed by
Justin Warkentin in bpo-11109(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11109


File: python.info,  Node: sqlite3<11>,  Next: ssl<12>,  Prev: socketserver<3>,  Up: 改良されたモジュール<11>

1.12.20.48 sqlite3
..................

*note sqlite3.Connection: 54d. の新規のメソッド *note
set_trace_callback(): 5ab. を使うと sqlite3 により処理されるすべての sql
コマンドの足跡 (トレース) をキャプチャ出来ます。(Contributed by Torsten
Landschoff in bpo-11688(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11688


File: python.info,  Node: ssl<12>,  Next: stat<2>,  Prev: sqlite3<11>,  Up: 改良されたモジュール<11>

1.12.20.49 ssl
..............

   * *note ssl: d5. モジュールに新たに 2 つの乱数生成関数が追加されまし
     た:

        * *note RAND_bytes(): 747.: 暗号学的に強固な擬似乱数バイト列を生
          成します。

        * ‘RAND_pseudo_bytes()’: generate pseudo-random bytes.

     (Contributed by Victor Stinner in bpo-12049(1).)

   * *note ssl: d5. モジュールがより粒度の細かい例外階層を公開するように
     なり、これにより様々な種類のエラーを調べることが容易になります。
     (Contributed by Antoine Pitrou in bpo-11183(2).)

   * *note load_cert_chain(): 598. が 'password' 引数を受け付けるように
     なりました。これは秘密鍵が暗号化されている場合に使われます。
     (Contributed by Adam Simpkins in bpo-12803(3).)

   * ディフィー・ヘルマン鍵共有の、通常のものと楕円曲線ベースのもの両方
     が *note load_dh_params(): 135a. メソッドと *note set_ecdh_curve():
     135b. メソッドを通じてサポートされるようになりました。(Contributed
     by Antoine Pitrou in bpo-13626(4) and bpo-13627(5).)

   * SSL ソケットに新規メソッド *note get_channel_binding(): 135c. が追
     加されました。これは SCRAM-SHA-1-PLUS (訳注: RFC 5802(6) など参照)
     のようなある種の認証メカニズムの実装で拡張されることを想定したもの
     です。(Contributed by Jacek Konieczny in bpo-12551(7).)

   * You can query the SSL compression algorithm used by an SSL socket,
     thanks to its new *note compression(): 135d. method.  The new
     attribute *note OP_NO_COMPRESSION: 135e. can be used to disable
     compression.  (Contributed by Antoine Pitrou in bpo-13634(8).)

   * *note ssl.SSLContext.set_npn_protocols(): 358. による Next Protocol
     Negotiation 拡張のサポートが追加されました。 (Contributed by Colin
     Marc in bpo-14204(9).)

   * 属性 *note library: 135f. と *note reason: 1360. が追加されたので、
     SSL のエラーは以前よりもっと簡単に調べることが出来るようになりまし
     た。(Contributed by Antoine Pitrou in bpo-14837(10).)

   * *note get_server_certificate(): a3d. 関数が IPv6 をサポートするよう
     になりました。 (Contributed by Charles-François Natali in
     bpo-11811(11).)

   * New attribute *note OP_CIPHER_SERVER_PREFERENCE: 1361. allows
     setting SSLv3 server sockets to use the server's cipher ordering
     preference rather than the client's (bpo-13635(12)).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12049

   (2) https://bugs.python.org/issue?@action=redirect&bpo=11183

   (3) https://bugs.python.org/issue?@action=redirect&bpo=12803

   (4) https://bugs.python.org/issue?@action=redirect&bpo=13626

   (5) https://bugs.python.org/issue?@action=redirect&bpo=13627

   (6) https://datatracker.ietf.org/doc/html/rfc5802.html

   (7) https://bugs.python.org/issue?@action=redirect&bpo=12551

   (8) https://bugs.python.org/issue?@action=redirect&bpo=13634

   (9) https://bugs.python.org/issue?@action=redirect&bpo=14204

   (10) https://bugs.python.org/issue?@action=redirect&bpo=14837

   (11) https://bugs.python.org/issue?@action=redirect&bpo=11811

   (12) https://bugs.python.org/issue?@action=redirect&bpo=13635


File: python.info,  Node: stat<2>,  Next: struct<4>,  Prev: ssl<12>,  Up: 改良されたモジュール<11>

1.12.20.50 stat
...............

ドキュメントされていなかった ‘tarfile.filemode’ 関数が *note
stat.filemode(): 1363. に移動されました。これはファイルモードを
'-rwxrwxrwx' 形式の文字列に変換するのに使えます。

(Contributed by Giampaolo Rodolà in bpo-14807(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14807


File: python.info,  Node: struct<4>,  Next: subprocess<6>,  Prev: stat<2>,  Up: 改良されたモジュール<11>

1.12.20.51 struct
.................

The *note struct: db. module now supports ‘ssize_t’ and ‘size_t’ via the
new codes ‘n’ and ‘N’, respectively.  (Contributed by Antoine Pitrou in
bpo-3163(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=3163


File: python.info,  Node: subprocess<6>,  Next: sys<13>,  Prev: struct<4>,  Up: 改良されたモジュール<11>

1.12.20.52 subprocess
.....................

POSIX プラットフォームにおいて、コマンド文字列として bytes オブジェクト
を渡せるようになりました。 (Contributed by Victor Stinner in
bpo-8513(1).)

A new constant *note DEVNULL: 1366. allows suppressing output in a
platform-independent fashion.  (Contributed by Ross Lagerwall in
bpo-5870(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=8513

   (2) https://bugs.python.org/issue?@action=redirect&bpo=5870


File: python.info,  Node: sys<13>,  Next: tarfile<9>,  Prev: subprocess<6>,  Up: 改良されたモジュール<11>

1.12.20.53 sys
..............

*note sys: df. モジュールに、スレッドの実装に関する情報が格納された
*note 名前付きタプル: 85e. を保持する *note thread_info: 1368. が追加さ
れました。 (bpo-11223(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=11223


File: python.info,  Node: tarfile<9>,  Next: tempfile<4>,  Prev: sys<13>,  Up: 改良されたモジュール<11>

1.12.20.54 tarfile
..................

*note tarfile: e4. が *note lzma: 8e. モジュールにより ‘lzma’ エンコーデ
ィングをサポートするようになりました (Contributed by Lars Gustäbel in
bpo-5689(1).)。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5689


File: python.info,  Node: tempfile<4>,  Next: textwrap<3>,  Prev: tarfile<9>,  Up: 改良されたモジュール<11>

1.12.20.55 tempfile
...................

*note tempfile.SpooledTemporaryFile: 8a2.'s ‘truncate()’ method now
accepts a ‘size’ parameter.  (Contributed by Ryan Kelly in bpo-9957(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9957


File: python.info,  Node: textwrap<3>,  Next: threading<9>,  Prev: tempfile<4>,  Up: 改良されたモジュール<11>

1.12.20.56 textwrap
...................

*note textwrap: f2. モジュールに *note indent(): 57d. が追加されました。
これはテキストのブロック内の選択行に共通のプレフィクスを追加する簡単な方
法になります。(bpo-13857(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13857


File: python.info,  Node: threading<9>,  Next: time<8>,  Prev: textwrap<3>,  Up: 改良されたモジュール<11>

1.12.20.57 threading
....................

いずれもかつてインスタンスを返すファクトリ関数であった *note
threading.Condition: 136d, *note threading.Semaphore: 136e, *note
threading.BoundedSemaphore: 136f, *note threading.Event: 1370, *note
threading.Timer: 1371. がクラスになったので、サブクラス化出来るようにな
りました。 (Contributed by Éric Araujo in bpo-10968(1).)

*note threading.Thread: 176. コンストラクタがキーワード引数 ‘daemon’ を
取るようになりました。これは親スレッドから ‘daemon’ フラグを継承するデフ
ォルトの振る舞いをオーバライドします (bpo-6064(2))。

かつての非公開関数 ‘_thread.get_ident’ が公開関数 *note
threading.get_ident(): 1372. として利用可能となっています。これは標準ラ
イブラリにおいて多数の ‘_thread’ モジュールへの直接アクセスを取り除く結
果になりました。 ‘_thread.get_ident’ を使っているサードパーティのコード
も同じように、新しく公開化されたインターフェイスに乗り換えるべきです。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10968

   (2) https://bugs.python.org/issue?@action=redirect&bpo=6064


File: python.info,  Node: time<8>,  Next: types<8>,  Prev: threading<9>,  Up: 改良されたモジュール<11>

1.12.20.58 time
...............

PEP 418(1) が *note time: f4. モジュールに新たな関数を追加しました:

   * *note get_clock_info(): 1374.: クロックの情報を取得します。

   * *note monotonic(): 55c.: 単調なクロック (逆行しない)、システムクロ
     ックの更新の影響を受けません。

   * *note perf_counter(): c7a.: 短期間の計測のために利用可能な最高の解
     像度を持つパフォーマンスカウンタです。

   * *note process_time(): c7b.: 現在のプロセスの system と user CPU 時
     間の和です。

その他の新たな関数:

   * *note clock_getres(): 1375, *note clock_gettime(): 1376. and *note
     clock_settime(): 1377. functions with ‘CLOCK_XXX’ constants.
     (Contributed by Victor Stinner in bpo-10278(2).)

クロスプラットフォーム間での一貫性を改善するために、 *note sleep(): 8ac.
が負の値を渡すと *note ValueError: 2ec. を投げるように変更されています。
以前から POSIX システムではエラーでしたが、Windows の場合に無限に sleep
していました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0418/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=10278


File: python.info,  Node: types<8>,  Next: unittest<11>,  Prev: time<8>,  Up: 改良されたモジュール<11>

1.12.20.59 types
................

新規クラス *note types.MappingProxyType: 698. の追加: 読み出し専用のマッ
ピングのプロキシです。 (bpo-14386(1))

新規関数 *note types.new_class(): 1379. と *note types.prepare_class():
137a. は PEP 3115(2) 準拠の動的な型の生成サポートを提供します。
(bpo-14588(3))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14386

   (2) https://peps.python.org/pep-3115/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=14588


File: python.info,  Node: unittest<11>,  Next: urllib<6>,  Prev: types<8>,  Up: 改良されたモジュール<11>

1.12.20.60 unittest
...................

メソッド *note assertRaises(): 750, *note assertRaisesRegex(): 752,
*note assertWarns(): 137c, *note assertWarnsRegex(): 137d. が、コンテキ
ストマネージャとして使われる際にキーワード引数 'msg' を受け付けるように
なりました。 (Contributed by Ezio Melotti and Winston Ewert in
bpo-10775(1).)

*note unittest.TestCase.run(): 137e. が *note TestResult: 137f. オブジェ
クトを返すようになりました。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10775


File: python.info,  Node: urllib<6>,  Next: webbrowser<4>,  Prev: unittest<11>,  Up: 改良されたモジュール<11>

1.12.20.61 urllib
.................

*note Request: 11da. クラスが *note get_method(): 1381. で使われる
'method' 引数を受け付けるようになりました。これはどの HTTP メソッドが使
われるべきかを指定します。例えば以下は ‘'HEAD'’ リクエストを送信します:

     >>> urlopen(Request('https://www.python.org', method='HEAD'))

(bpo-1673007(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1673007


File: python.info,  Node: webbrowser<4>,  Next: xml etree ElementTree<2>,  Prev: urllib<6>,  Up: 改良されたモジュール<11>

1.12.20.62 webbrowser
.....................

*note webbrowser: 11b. モジュールがさらに多くの "browsers" をサポートし
ました: Google Chrome (バージョンと OS 依存で名前が ‘chrome’,
‘chromium’, ‘chrome-browser’, あるいは ‘chromium-browser’) と、汎用のラ
ンチャ ‘xdg-open’ (FreeDesktop.org プロジェクトのもの) と ‘gvfs-open’
(GNOME 3 のデフォルト URI ハンドラ)。 (The former contributed by Arnaud
Calmettes in bpo-13620(1), the latter by Matthias Klose in
bpo-14493(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13620

   (2) https://bugs.python.org/issue?@action=redirect&bpo=14493


File: python.info,  Node: xml etree ElementTree<2>,  Next: zlib<3>,  Prev: webbrowser<4>,  Up: 改良されたモジュール<11>

1.12.20.63 xml.etree.ElementTree
................................

The *note xml.etree.ElementTree: 12b. module now imports its C
accelerator by default; there is no longer a need to explicitly import
‘xml.etree.cElementTree’ (this module stays for backwards compatibility,
but is now deprecated).  In addition, the ‘iter’ family of methods of
*note Element: 363. has been optimized (rewritten in C). The module's
documentation has also been greatly improved with added examples and a
more detailed reference.


File: python.info,  Node: zlib<3>,  Prev: xml etree ElementTree<2>,  Up: 改良されたモジュール<11>

1.12.20.64 zlib
...............

New attribute *note zlib.Decompress.eof: 1385. makes it possible to
distinguish between a properly formed compressed stream and an
incomplete or truncated one.  (Contributed by Nadeem Vawda in
bpo-12646(1).)

New attribute *note zlib.ZLIB_RUNTIME_VERSION: 1386. reports the version
string of the underlying ‘zlib’ library that is loaded at runtime.
(Contributed by Torsten Landschoff in bpo-12306(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12646

   (2) https://bugs.python.org/issue?@action=redirect&bpo=12306


File: python.info,  Node: 最適化<11>,  Next: ビルドならびに C API の変更<4>,  Prev: 改良されたモジュール<11>,  Up: What's New In Python 3 3

1.12.21 最適化
--------------

大きな性能向上がありました:

   * PEP 393(1) により、Unicode 文字列に対する操作が最適化されました:

        * メモリフットプリントはテキストに依存して 1/2 から 1/4 になりま
          した

        * ASCII 文字列を UTF-8 にエンコードするのに文字をエンコードする
          必要はなくなりました、UTF-8 表現は ASCII 表現と共有されます

        * UTF-8 エンコーダが最適化されました

        * 単一の ASCII 文字を繰り返して ASCII 文字列の部分列を得るのは 4
          倍速くなりました

   * UTF-8 が2倍から4倍速くなりました。UTF-16 のエンコーディングが最大で
     10倍速くなりました。

     (Contributed by Serhiy Storchaka, bpo-14624(2), bpo-14738(3) and
     bpo-15026(4).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0393/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=14624

   (3) https://bugs.python.org/issue?@action=redirect&bpo=14738

   (4) https://bugs.python.org/issue?@action=redirect&bpo=15026


File: python.info,  Node: ビルドならびに C API の変更<4>,  Next: 非推奨<13>,  Prev: 最適化<11>,  Up: What's New In Python 3 3

1.12.22 ビルドならびに C API の変更
-----------------------------------

Python のビルド過程と C API の変更は以下の通りです:

   * 新しい PEP 3118(1) 関連の関数:

        * *note PyMemoryView_FromMemory(): 1388.

   * PEP 393(2) により追加された新たな Unicode 型、マクロ、関数:

        * 高水準 API:

             * *note PyUnicode_CopyCharacters(): ab2.

             * *note PyUnicode_FindChar(): ab6.

             * *note PyUnicode_GetLength(): ab0, *note
               PyUnicode_GET_LENGTH: ab1.

             * *note PyUnicode_New(): aa9.

             * *note PyUnicode_Substring(): ab3.

             * *note PyUnicode_ReadChar(): 1389, *note
               PyUnicode_WriteChar(): 138a.

        * 低水準 API:

             * 型 *note Py_UCS1: 138b, *note Py_UCS2: 138c, *note
               Py_UCS4: 33d.

             * 構造体 *note PyASCIIObject: 138d. と *note
               PyCompactUnicodeObject: 138e.

             * *note PyUnicode_READY: 434.

             * *note PyUnicode_FromKindAndData(): 138f.

             * *note PyUnicode_AsUCS4(): 1390, *note
               PyUnicode_AsUCS4Copy(): ab8.

             * *note PyUnicode_DATA: 1391, *note PyUnicode_1BYTE_DATA:
               1392, *note PyUnicode_2BYTE_DATA: 1393, *note
               PyUnicode_4BYTE_DATA: 1394.

             * *note PyUnicode_KIND: 1395. with ‘PyUnicode_Kind’ enum:
               ‘PyUnicode_WCHAR_KIND’, *note PyUnicode_1BYTE_KIND: 1396,
               *note PyUnicode_2BYTE_KIND: 1397, *note
               PyUnicode_4BYTE_KIND: 1398.

             * *note PyUnicode_READ: 1399, *note PyUnicode_READ_CHAR:
               139a, *note PyUnicode_WRITE: 139b.

             * *note PyUnicode_MAX_CHAR_VALUE: 139c.

   * *note PyArg_ParseTuple: 3c1. が ‘c’ フォーマットとして *note
     bytearray: 344. を許容するようになりました (bpo-12380(3))。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3118/

   (2) https://peps.python.org/pep-0393/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=12380


File: python.info,  Node: 非推奨<13>,  Next: Python 3 3 への移植,  Prev: ビルドならびに C API の変更<4>,  Up: What's New In Python 3 3

1.12.23 非推奨
--------------

* Menu:

* サポートされないオペレーティングシステム: サポートされないオペレーティングシステム<2>.
* 非推奨の Python モジュール、関数、メソッド: 非推奨の Python モジュール、関数、メソッド<4>.
* C API の非推奨の関数ならびに型: C API の非推奨の関数ならびに型<3>.
* 非推奨の機能: 非推奨の機能<2>.


File: python.info,  Node: サポートされないオペレーティングシステム<2>,  Next: 非推奨の Python モジュール、関数、メソッド<4>,  Up: 非推奨<13>

1.12.23.1 サポートされないオペレーティングシステム
..................................................

保守する者がいないため OS/2 ならびに VMS はもはやサポートされません。

保守の負担のため WIndows 2000 および ‘COMSPEC’ を ‘command.com’ に設定し
ている Windows プラットフォームはもはやサポートされません。

3.2 で非推奨だった OSF のサポートが完全に削除されました。


File: python.info,  Node: 非推奨の Python モジュール、関数、メソッド<4>,  Next: C API の非推奨の関数ならびに型<3>,  Prev: サポートされないオペレーティングシステム<2>,  Up: 非推奨<13>

1.12.23.2 非推奨の Python モジュール、関数、メソッド
....................................................

   * object 型そのものの ‘object.__format__()’ に空でない文字列が渡すこ
     とは非推奨となりました。Python 3.4 ではこれは *note TypeError: 198.
     となります (bpo-9856(1))。

   * PEP 393(2) により、 ‘unicode_internal’ コーデックは非推奨となりまし
     た。UTF-8, UTF-16 (‘utf-16-le’ または ‘utf-16-be’), あるいは UTF-32
     (‘utf-32-le’ または ‘utf-32-be’) を使ってください。

   * *note ftplib.FTP.nlst(): 12da. および *note ftplib.FTP.dir():
     12db.: *note ftplib.FTP.mlsd(): 12d9. を使ってください

   * ‘platform.popen()’: use the *note subprocess: dc. module.  Check
     especially the *note Replacing Older Functions with the subprocess
     Module: 13a0. section (bpo-11377(3)).

   * bpo-13374(4): *note os: a5. モジュールにある Windows のバイト列 API
     は非推奨となりました。ANSI コードページに依存しないようにしてあらゆ
     るファイル名をサポートするために、バイト列文字列のファイル名ではな
     く Unicode ファイル名を使ってください。

   * bpo-13988(5): The ‘xml.etree.cElementTree’ module is deprecated.
     The accelerator is used automatically whenever available.

   * The behaviour of ‘time.clock()’ depends on the platform: use the
     new *note time.perf_counter(): c7a. or *note time.process_time():
     c7b. function instead, depending on your requirements, to have a
     well defined behaviour.

   * The ‘os.stat_float_times()’ function is deprecated.

   * *note abc: 4. モジュール:

        * *note abc.abstractproperty: 1296. は非推奨となりました。代わり
          に *note abc.abstractmethod(): 1297. に *note property: 4b3. を
          渡して使ってください。

        * *note abc.abstractclassmethod: 1298. は非推奨となりました。代
          わりに *note abc.abstractmethod(): 1297. に *note classmethod:
          48e. を渡して使ってください。

        * *note abc.abstractstaticmethod: 1299. は非推奨となりました。代
          わりに *note abc.abstractmethod(): 1297. に *note
          staticmethod: 453. を渡して使ってください。

   * *note importlib: 7b. パッケージ:

        * バイトコードファイルとしての *note
          importlib.abc.SourceLoader.path_stats(): 13a1. によりコンパイ
          ル時点の修正時刻とソースファイルサイズの両方を格納するようにな
          ったので、 *note importlib.abc.SourceLoader.path_mtime():
          13a2. は非推奨となりました。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9856

   (2) https://peps.python.org/pep-0393/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=11377

   (4) https://bugs.python.org/issue?@action=redirect&bpo=13374

   (5) https://bugs.python.org/issue?@action=redirect&bpo=13988


File: python.info,  Node: C API の非推奨の関数ならびに型<3>,  Next: 非推奨の機能<2>,  Prev: 非推奨の Python モジュール、関数、メソッド<4>,  Up: 非推奨<13>

1.12.23.3 C API の非推奨の関数ならびに型
........................................

PEP 393(1) で *note Py_UNICODE: 3e0. は非推奨になり、Python 4 で削除され
ます。この型を使用している全ての関数は非推奨です。

Unicode functions and methods using *note Py_UNICODE: 3e0. and *note
Py_UNICODE: 3e0.* types:

   * ‘PyUnicode_FromUnicode’: use *note PyUnicode_FromWideChar(): 13a4.
     or *note PyUnicode_FromKindAndData(): 138f.

   * ‘PyUnicode_AS_UNICODE’, ‘PyUnicode_AsUnicode()’,
     ‘PyUnicode_AsUnicodeAndSize()’: use *note
     PyUnicode_AsWideCharString(): ab9.

   * ‘PyUnicode_AS_DATA’: use *note PyUnicode_DATA: 1391. with *note
     PyUnicode_READ: 1399. and *note PyUnicode_WRITE: 139b.

   * ‘PyUnicode_GET_SIZE’, ‘PyUnicode_GetSize()’: use *note
     PyUnicode_GET_LENGTH: ab1. or *note PyUnicode_GetLength(): ab0.

   * ‘PyUnicode_GET_DATA_SIZE’: use ‘PyUnicode_GET_LENGTH(str) *
     PyUnicode_KIND(str)’ (only work on ready strings)

   * ‘PyUnicode_AsUnicodeCopy()’: use *note PyUnicode_AsUCS4Copy(): ab8.
     or *note PyUnicode_AsWideCharString(): ab9.

   * ‘PyUnicode_GetMax()’

Py_UNICODE* 文字列を操作する関数ならびにマクロ:

   * ‘Py_UNICODE_strlen()’: use *note PyUnicode_GetLength(): ab0. or
     *note PyUnicode_GET_LENGTH: ab1.

   * ‘Py_UNICODE_strcat()’: use *note PyUnicode_CopyCharacters(): ab2.
     or *note PyUnicode_FromFormat(): 62b.

   * ‘Py_UNICODE_strcpy()’, ‘Py_UNICODE_strncpy()’, ‘Py_UNICODE_COPY()’:
     use *note PyUnicode_CopyCharacters(): ab2. or *note
     PyUnicode_Substring(): ab3.

   * ‘Py_UNICODE_strcmp()’: use *note PyUnicode_Compare(): ab4.

   * ‘Py_UNICODE_strncmp()’: use *note PyUnicode_Tailmatch(): ab5.

   * ‘Py_UNICODE_strchr()’, ‘Py_UNICODE_strrchr()’: use *note
     PyUnicode_FindChar(): ab6.

   * ‘Py_UNICODE_FILL()’: use *note PyUnicode_Fill(): 13a5.

   * ‘Py_UNICODE_MATCH’

エンコーダ:

   * ‘PyUnicode_Encode()’: use ‘PyUnicode_AsEncodedObject()’

   * ‘PyUnicode_EncodeUTF7()’

   * ‘PyUnicode_EncodeUTF8()’: use *note PyUnicode_AsUTF8(): 424. or
     *note PyUnicode_AsUTF8String(): 13a6.

   * ‘PyUnicode_EncodeUTF32()’

   * ‘PyUnicode_EncodeUTF16()’

   * ‘PyUnicode_EncodeUnicodeEscape()’ use *note
     PyUnicode_AsUnicodeEscapeString(): 13a7.

   * ‘PyUnicode_EncodeRawUnicodeEscape()’ use *note
     PyUnicode_AsRawUnicodeEscapeString(): 13a8.

   * ‘PyUnicode_EncodeLatin1()’: use *note PyUnicode_AsLatin1String():
     13a9.

   * ‘PyUnicode_EncodeASCII()’: use *note PyUnicode_AsASCIIString():
     13aa.

   * ‘PyUnicode_EncodeCharmap()’

   * ‘PyUnicode_TranslateCharmap()’

   * ‘PyUnicode_EncodeMBCS()’: use *note PyUnicode_AsMBCSString(): 13ab.
     or *note PyUnicode_EncodeCodePage(): 13ac. (with ‘CP_ACP’
     code_page)

   * ‘PyUnicode_EncodeDecimal()’, ‘PyUnicode_TransformDecimalToASCII()’

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0393/


File: python.info,  Node: 非推奨の機能<2>,  Prev: C API の非推奨の関数ならびに型<3>,  Up: 非推奨<13>

1.12.23.4 非推奨の機能
......................

*note array: 8. モジュールの ‘'u'’ 書式化コードは非推奨となりました。
Python 4 ではほかの (*note Py_UNICODE: 3e0.) API と一緒に削除されるでし
ょう。


File: python.info,  Node: Python 3 3 への移植,  Prev: 非推奨<13>,  Up: What's New In Python 3 3

1.12.24 Python 3.3 への移植
---------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

* Menu:

* Python コードの移植::
* C コードの移植::
* C 拡張のビルド::
* コマンドラインスイッチの変更::


File: python.info,  Node: Python コードの移植,  Next: C コードの移植,  Up: Python 3 3 への移植

1.12.24.1 Python コードの移植
.............................

   * ハッシュのランダム化がデフォルトで有効になりました。これを無効にす
     るには環境変数 *note PYTHONHASHSEED: 1289. を ‘0’ にセットして下さ
     い。 *note object.__hash__(): cf3. メソッドも参照して下さい。

   * bpo-12326(1): Linux では、 *note sys.platform: 291. はもはやメジャ
     ーバージョン番号を含みません。 これは今では常に 'linux' です。以前
     はこれは Python のビルドに使われた Linux バージョンに依存した
     ‘'linux2'’ や ‘'linux3'’ でした。 ‘sys.platform == 'linux2'’ などと
     するのではなく、 ‘sys.platform.startswith('linux')’ とするか、古い
     Python バージョンのサポートが不要であれば直接的に ‘sys.platform ==
     'linux'’ として下さい。

   * bpo-13847(2), bpo-14180(3): *note time: f4. および *note datetime:
     34.: タイムスタンプが範囲外の場合に、 *note ValueError: 2ec. ではな
     く *note OverflowError: a81. を送出するようになりました。また、C 関
     数の ‘gmtime()’ あるいは ‘localtime()’ が失敗した場合には *note
     OSError: 2c0. を送出するようになりました。

   * インポートで使われるデフォルトのファインダが、特定のディレクトリに
     何が含まれるのかについてのキャッシュを利用するようになっています。
     実行中に Python ソースファイルやバイトコードファイルを作ったら、キ
     ャッシュをクリアしてファインダが新しく作られたファイルに気付けるよ
     うに、 *note importlib.invalidate_caches(): e0a. を呼ぶ必要があるこ
     とに注意してください。

   * *note ImportError: 65b. がインポートを試みたモジュール名として完全
     名を使うようになっています。ImportError のメッセージをチェックする
     doctest は、モジュール名をその末尾の名前ではなく完全な名前を使うよ
     うに更新する必要があります。

   * *note __import__(): ad1. の引数 'index' のデフォルトが -1 ではなく
     0 となり、また、もはや負の値はサポートされません。デフォルト値が -1
     で残されたのは(訳注: つまり絶対、相対インポートの両方を試みるように
     したのは) PEP 328(4) を実装した際の過失でした。絶対インポートに先立
     って相対インポートを実行する振る舞いがまだ必要なのであれば、index を
     1 にして相対インポートを実行して、その後で index 0 のインポートをす
     るようにしてください。そうなのですが、 *note __import__(): ad1. を
     直接呼び出すのではなく、 *note importlib.import_module(): 73c. を使
     うことが望ましいやり方です。

   * *note __import__(): ad1. の index に、トップレベルモジュールに対し
     て 0 でなく 1 を与えることは今では許されません。例えば
     ‘__import__('sys', level=1)’ はエラーです。

   * Because *note sys.meta_path: f27. and *note sys.path_hooks: 1225.
     now have finders on them by default, you will most likely want to
     use *note list.insert(): 13b0. instead of *note list.append(): 8dc.
     to add to those lists.

   * Because ‘None’ is now inserted into *note sys.path_importer_cache:
     7fa, if you are clearing out entries in the dictionary of paths
     that do not have a finder, you will need to remove keys paired with
     values of ‘None’ 'and' ‘imp.NullImporter’ to be
     backwards-compatible.  This will lead to extra overhead on older
     versions of Python that re-insert ‘None’ into *note
     sys.path_importer_cache: 7fa. where it represents the use of
     implicit finders, but semantically it should not change anything.

   * ‘importlib.abc.Finder’ no longer specifies a ‘find_module()’
     abstract method that must be implemented.  If you were relying on
     subclasses to implement that method, make sure to check for the
     method's existence first.  You will probably want to check for
     ‘find_loader()’ first, though, in the case of working with *note
     path entry finders: 127d.

   * *note pkgutil: ae. は、内部的に *note importlib: 7b. を使うように変
     更されました。このことは、 PEP 302(5) インポートエミュレーションの
     古い振る舞いが本物のインポートシステムの振る舞いに合わせるのに失敗
     していた数多くの特殊ケースの問題を取り除きます。インポートエミュレ
     ーションそのものはまだ存在しますが、今では非推奨です。 *note
     pkgutil.iter_importers(): 13b1. 関数と *note
     pkgutil.walk_packages(): df9. 関数は標準インポートフックを特別に扱
     うので、ファインダの ‘iter_modules()’ メソッドは標準ではないにも関
     わらず、まだサポートされます。

   * *note email.header.decode_header(): 12ce. によってなされる解析に長
     い間存在していた RFC 非準拠のバグ (bpo-1079(6)) が修正されました。
     エンコードされたヘッダを Unicode に変換するための標準的なイディオム
     (‘str(make_header(decode_header(h))’) を使うコードからは変化はみえ
     ません。ですが、 decode_header から返される個々のタプル要素を見てい
     るコードでは、 ‘ASCII’ セクションの前後の空白が ‘ASCII’ 内に含まれ
     るようになったことがわかります。 ‘make_header’ は入力文字列に既に存
     在していなければ ‘ASCII’ 非 ‘ASCII’ セクション間に以前と同じく空白
     を追加するので、 ‘make_header’ を使ってヘッダを構築するコードは変更
     なしで動作するはずです。

   * *note email.utils.formataddr(): 13b2. は非 ASCII の display name に
     対し正しい content transfer encoding の扱いをするようになっています
     。かつての、フォーマット後文字列内に非 ASCII Unicode を維持してしま
     う誤った振る舞いに依存するすべてのコードは、変更の必要があります。
     (bpo-1690608(7))

   * *note poplib.POP3.quit(): 13b3. メソッドもほかの全ての ‘poplib’ の
     メソッドと同じく、今ではプロトコルエラーを送出し得ます。 ‘quit’ が
     *note poplib.error_proto: 13b4. エラーを送出しないことをあてにして
     いたコードは、 ‘quit’ でのエラーが特定のアプリケーションにとって問
     題となるようであれば、修正の必要があるかもしれません
     (bpo-11291(8))。

   * Python 2.4 から非推奨となっていた、 *note email.parser.Parser:
     13b5. への ‘strict’ 引数はついに削除されました。

   * 非推奨となっていたメソッド ‘unittest.TestCase.assertSameElements’ は
     削除されました。

   * 非推奨となっていた変数 ‘time.accept2dyear’ は削除されました。

   * 非推奨となっていた ‘Context._clamp’ 属性が *note decimal: 3a. モジ
     ュールから削除されました。以前に既にこれは公開属性 *note clamp:
     13b6. に置き換えられていました (bpo-8540(9) 参照)。

   * 文書化されていなかった内部ヘルパクラス ‘SSLFakeFile’ が *note
     smtplib: cf. モジュールより削除されました。この機能はずっと以前から
     *note socket.socket.makefile(): 13b7. によって直接的に提供されてい
     ます。

   * Windows では *note time.sleep(): 8ac. に負値を与えた場合に無限に眠
     っていましたが、今ではこれは例外を送出します。POSIX ではこれは以前
     より常に例外です。

   * The ‘ast.__version__’ constant has been removed.  If you need to
     make decisions affected by the AST version, use *note
     sys.version_info: 8af. to make the decision.

   * *note threading: f3. モジュールの、非公開クラスをサブクラス化するフ
     ァクトリ関数を迂回していたコードは、今では公開クラスになったので修
     正の必要があります。

   * threading モジュール内の文書化されていなかったデバッグ機構を削除し
     てコードを単純化しました。このことが製品コードに影響することがあっ
     てはなりませんが、これと連携していたアプリケーションデバッグフレー
     ムワークのケースがありうるので、言及しておきます (bpo-13550(10))。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=12326

   (2) https://bugs.python.org/issue?@action=redirect&bpo=13847

   (3) https://bugs.python.org/issue?@action=redirect&bpo=14180

   (4) https://peps.python.org/pep-0328/

   (5) https://peps.python.org/pep-0302/

   (6) https://bugs.python.org/issue?@action=redirect&bpo=1079

   (7) https://bugs.python.org/issue?@action=redirect&bpo=1690608

   (8) https://bugs.python.org/issue?@action=redirect&bpo=11291

   (9) https://bugs.python.org/issue?@action=redirect&bpo=8540

   (10) https://bugs.python.org/issue?@action=redirect&bpo=13550


File: python.info,  Node: C コードの移植,  Next: C 拡張のビルド,  Prev: Python コードの移植,  Up: Python 3 3 への移植

1.12.24.2 C コードの移植
........................

   * In the course of changes to the buffer API the undocumented
     ‘smalltable’ member of the *note Py_buffer: 95c. structure has been
     removed and the layout of the ‘PyMemoryViewObject’ has changed.

     ‘memoryobject.h’ あるいは ‘object.h’ での関係する部分に依存する全て
     の拡張は、再ビルドが必要です。

   * *note PEP 393: 123f. により、 *note Py_UNICODE: 3e0. 型とこの型を使
     う全ての関数は非推奨となりました (ただし最低 5 年は利用可能なまま保
     たれます)。Unicode オブジェクトの構築とアクセスに低水準 Unicode API
     をこれまで使っていて、 PEP 393(1) によって提供されるメモリフットプ
     リント削減の恩恵を受けたければ、新しい *note Unicode API: 13b8. に
     乗り換える必要があります。

     一方で *note PyUnicode_Concat(): 13b9. 、 *note PyUnicode_Join():
     13ba. あるいは *note PyUnicode_FromFormat(): 62b. といった高水準関
     数のみを使ってきたのであれば、あなたのコードは自動的に新しい
     Unicode 表現に便乗できます。

   * *note PyImport_GetMagicNumber(): 13bb. は失敗時に ‘-1’ を返すように
     なりました。

   * *note __import__(): ad1. の 'level' 引数に負値を渡すことはもはや有
     効ではないので、対応する *note PyImport_ImportModuleLevel(): 13bc.
     でも同じです。このことは *note PyImport_ImportModuleEx(): 13bd. に
     使われる 'level' の値が ‘-1’ ではなく ‘0’ を使うようになったことも
     意味しています。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0393/


File: python.info,  Node: C 拡張のビルド,  Next: コマンドラインスイッチの変更,  Prev: C コードの移植,  Up: Python 3 3 への移植

1.12.24.3 C 拡張のビルド
........................

   * C 拡張のファイル名として認められる範囲が狭められました。滅多に使わ
     れてこなかった命名は取りやめられました: POSIX では、
     ‘xxxmodule.so’, ‘xxxmodule.abi3.so’, ‘xxxmodule.cpython-*.so’ 命名
     は今後 ‘xxx’ モジュールの実装とは認識されません。これまでそのような
     ファイルを作ってきたのであれば、別の命名に乗り換えてください (つま
     り ‘module’ 文字列をファイル名から取り除いてください)。

     (implemented in bpo-14040(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14040


File: python.info,  Node: コマンドラインスイッチの変更,  Prev: C 拡張のビルド,  Up: Python 3 3 への移植

1.12.24.4 コマンドラインスイッチの変更
......................................

   * ‘-Q’ コマンドラインスイッチとそれに関係するものは削除されました。
     ‘sys.flags.division_warning’ をチェックしているコードは修正する必要
     があります。

     (bpo-10998(1), contributed by Éric Araujo.)

   * *note -S: 13c0. スイッチ付きで ‘python’ を開始すると、 ‘import
     site’ がモジュール検索パスにサイト固有のパスを追加しなくなります。
     以前のバージョンではそれをしていました。

     (bpo-11591(2), contributed by Carl Meyer with editions by Éric
     Araujo.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10998

   (2) https://bugs.python.org/issue?@action=redirect&bpo=11591


File: python.info,  Node: What's New In Python 3 2,  Next: What's New In Python 3 1,  Prev: What's New In Python 3 3,  Up: What's New in Python

1.13 What's New In Python 3.2
=============================


著者: Raymond Hettinger

This article explains the new features in Python 3.2 as compared to 3.1.
Python 3.2 was released on February 20, 2011.  It focuses on a few
highlights and gives a few examples.  For full details, see the
Misc/NEWS(1) file.

参考
....

PEP 392(2) - Python 3.2 リリーススケジュール

* Menu:

* PEP 384; 安定 ABI の定義: PEP 384 安定 ABI の定義.
* PEP 389; argparse コマンドライン解析モジュール: PEP 389 argparse コマンドライン解析モジュール.
* PEP 391; logging の辞書ベースの設定: PEP 391 logging の辞書ベースの設定.
* PEP 3148; concurrent.futures モジュール: PEP 3148 concurrent futures モジュール.
* PEP 3147; PYC リポジトリーディレクトリ: PEP 3147 PYC リポジトリーディレクトリ.
* PEP 3149; ABI バージョンでタグ付けされた .so ファイル: PEP 3149 ABI バージョンでタグ付けされた so ファイル.
* PEP 3333; Python Web Server Gateway Interface v1.0.1: PEP 3333 Python Web Server Gateway Interface v1 0 1.
* その他の言語変更: その他の言語変更<12>.
* 新たなモジュール、改良されたモジュール、非推奨のモジュール::
* マルチスレッディング::
* 最適化: 最適化<12>.
* Unicode 文字列型::
* Codecs::
* ドキュメント::
* IDLE::
* コードリポジトリ::
* ビルドならびに C API の変更: ビルドならびに C API の変更<5>.
* Python 3.2 への移植: Python 3 2 への移植.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/blob/076ca6c3c8df3030307e548d9be792ce3c1c6eea/Misc/NEWS

   (2) https://peps.python.org/pep-0392/


File: python.info,  Node: PEP 384 安定 ABI の定義,  Next: PEP 389 argparse コマンドライン解析モジュール,  Up: What's New In Python 3 2

1.13.1 PEP 384: 安定 ABI の定義
-------------------------------

かつて、ある Python バージョンでビルドされた拡張モジュールは、ほかの
Python バージョンでは使えないことがありました。特に Windows では、全ての
Python 公式リリースごとに、使いたい全ての拡張モジュールを再ビルドする必
要がありました。これは、拡張モジュールが Python インタプリタの内部実装に
自由にアクセス出来たことからの結果でした。

Python 3.2 より、このことに関する別のアプローチが利用可能になりました。
(*note Py_LIMITED_API: 660. を定義することで) 制限された API のみ使うよ
うにする拡張モジュールは、数多くの内部実装を利用出来ない代わりに将来のい
くつものリリースで安定であることを約束された API 集合だけ使うことになり
ます。結果として、このモードで 3.2 のためにビルドされた拡張モジュールは
3.3、3.4、…でも動作するでしょう。なお、メモリ構造の詳細を曝すような拡張
モジュールでは、相変わらず全ての Python 公式リリースごとに再ビルドする必
要があるでしょう。

参考
....

PEP 384(1) - 安定 ABI の定義

     PEP written by Martin von Löwis.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0384/


File: python.info,  Node: PEP 389 argparse コマンドライン解析モジュール,  Next: PEP 391 logging の辞書ベースの設定,  Prev: PEP 384 安定 ABI の定義,  Up: What's New In Python 3 2

1.13.2 PEP 389: argparse コマンドライン解析モジュール
-----------------------------------------------------

コマンドライン解析のために、新たに *note argparse: 7. モジュールが *note
optparse: a4. の制限を克服するものとして導入されました。optparse には (オ
プションだけでなく) 位置引数のサポートはなく、サブコマンドも作れず、必須
のオプションやその他オプション指定と検証に共通するパターンについてのサポ
ートもありませんでした。

このモジュールはコミュニティにおいて既に広く行き渡っていたサードパーティ
のモジュールでした。その先駆者たちよりももっと完全な機能性を持ったことで
、 *note argparse: 7. モジュールは今ではコマンドライン解析での推奨モジュ
ールとなりました。古いモジュールは、それに依存しているレガシーなコードが
大量にあるため、今後も利用可能なまま保たれます。

以下に注釈付きで示したパーサは、有限個の選択肢から選ばせ、 'metavar' で
ヘルプ表示を指定し、一つ以上の位置引数があるかを検証し、必須オプションを
設けている実例になっています:

     import argparse
     parser = argparse.ArgumentParser(
                 description = 'Manage servers',         # main description for help
                 epilog = 'Tested on Solaris and Linux') # displayed after help
     parser.add_argument('action',                       # argument name
                 choices = ['deploy', 'start', 'stop'],  # three allowed values
                 help = 'action on each target')         # help msg
     parser.add_argument('targets',
                 metavar = 'HOSTNAME',                   # var name used in help msg
                 nargs = '+',                            # require one or more targets
                 help = 'url for target machines')       # help msg explanation
     parser.add_argument('-u', '--user',                 # -u or --user option
                 required = True,                        # make it a required argument
                 help = 'login as user')

コマンド文字列とともにこのパーサを呼び出してみます:

     >>> cmd = 'deploy sneezy.example.com sleepy.example.com -u skycaptain'
     >>> result = parser.parse_args(cmd.split())
     >>> result.action
     'deploy'
     >>> result.targets
     ['sneezy.example.com', 'sleepy.example.com']
     >>> result.user
     'skycaptain'

このパーサが自動的に作り出したヘルプはこのようになります:

     >>> parser.parse_args('-h'.split())

     usage: manage_cloud.py [-h] -u USER
                            {deploy,start,stop} HOSTNAME [HOSTNAME ...]

     Manage servers

     positional arguments:
       {deploy,start,stop}   action on each target
       HOSTNAME              url for target machines

     optional arguments:
       -h, --help            show this help message and exit
       -u USER, --user USER  login as user

     Tested on Solaris and Linux

*note argparse: 7. 機能でとりわけ素晴らしいのはサブパーサを定義出来るこ
とです。それらはそれぞれ自身固有の引数パターンを持ち、ヘルプ表示をします
:

     import argparse
     parser = argparse.ArgumentParser(prog='HELM')
     subparsers = parser.add_subparsers()

     parser_l = subparsers.add_parser('launch', help='Launch Control')   # first subgroup
     parser_l.add_argument('-m', '--missiles', action='store_true')
     parser_l.add_argument('-t', '--torpedos', action='store_true')

     parser_m = subparsers.add_parser('move', help='Move Vessel',        # second subgroup
                                      aliases=('steer', 'turn'))         # equivalent names
     parser_m.add_argument('-c', '--course', type=int, required=True)
     parser_m.add_argument('-s', '--speed', type=int, default=0)

     $ ./helm.py --help                         # top level help (launch and move)
     $ ./helm.py launch --help                  # help for launch options
     $ ./helm.py launch --missiles              # set missiles=True and torpedos=False
     $ ./helm.py steer --course 180 --speed 5   # set movement parameters

参考
....

PEP 389(1) - 新しいコマンドライン解析モジュール

     PEP written by Steven Bethard.

*note Migrating optparse code to argparse: 13c6. に *note optparse: a4.
との違いが詳しく書かれています。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0389/


File: python.info,  Node: PEP 391 logging の辞書ベースの設定,  Next: PEP 3148 concurrent futures モジュール,  Prev: PEP 389 argparse コマンドライン解析モジュール,  Up: What's New In Python 3 2

1.13.3 PEP 391: logging の辞書ベースの設定
------------------------------------------

The *note logging: 8b. module provided two kinds of configuration, one
style with function calls for each option or another style driven by an
external file saved in a *note configparser: 26. format.  Those options
did not provide the flexibility to create configurations from JSON or
YAML files, nor did they support incremental configuration, which is
needed for specifying logger options from a command line.

もっと柔軟な設定をサポートするために、新たに *note
logging.config.dictConfig(): 13c8. が追加されました。これはロギングの設
定を通常の Python 辞書で指定します。設定オプションにはフォーマッタ、ハン
ドラ、フィルタ、そしてロガーが含まれます。以下は設定辞書の動作する実例で
す:

     {"version": 1,
      "formatters": {"brief": {"format": "%(levelname)-8s: %(name)-15s: %(message)s"},
                     "full": {"format": "%(asctime)s %(name)-15s %(levelname)-8s %(message)s"}
                     },
      "handlers": {"console": {
                        "class": "logging.StreamHandler",
                        "formatter": "brief",
                        "level": "INFO",
                        "stream": "ext://sys.stdout"},
                   "console_priority": {
                        "class": "logging.StreamHandler",
                        "formatter": "full",
                        "level": "ERROR",
                        "stream": "ext://sys.stderr"}
                   },
      "root": {"level": "DEBUG", "handlers": ["console", "console_priority"]}}

その辞書が ‘conf.json’ ファイルに格納されているのであれば、コードからこ
のように呼び出してロード出来ます:

     >>> import json, logging.config
     >>> with open('conf.json') as f:
     ...     conf = json.load(f)
     ...
     >>> logging.config.dictConfig(conf)
     >>> logging.info("Transaction completed normally")
     INFO    : root           : Transaction completed normally
     >>> logging.critical("Abnormal termination")
     2011-02-17 11:14:36,694 root            CRITICAL Abnormal termination

参考
....

PEP 391(1) - logging の辞書ベースの設定

     PEP written by Vinay Sajip.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0391/


File: python.info,  Node: PEP 3148 concurrent futures モジュール,  Next: PEP 3147 PYC リポジトリーディレクトリ,  Prev: PEP 391 logging の辞書ベースの設定,  Up: What's New In Python 3 2

1.13.4 PEP 3148: ‘concurrent.futures’ モジュール
------------------------------------------------

同時並行性 (concurrency) を生成・管理するコードはトップレベルの新しい名
前空間 'concurrent' に集められることになりました。その最初のメンバーが
'futures' パッケージです。これはスレッドとプロセス管理の統一的な高水準イ
ンターフェイスを提供します。

*note concurrent.futures: 24. の設計は Java の 'java.util.concurrent' パ
ッケージに触発されました。そのモデルでは、実行する呼び出しとその結果は
*note Future: 13ca. オブジェクトで表現され、これはスレッド、プロセス、遠
隔手続呼び出しの共通的な側面を抽象化しています。そのオブジェクトはステー
タスのチェック (実行中あるいは完了かどうか)、タイムアウト、キャンセル、
コールバックの追加、そして結果や例外へのアクセスをサポートします。

この新モジュールで提供される最も基本となるのが、呼び出しの実行と管理のた
めの 2 つの executor クラスです。これら executor の目標は、これまでにも
あった道具立てでの並列呼び出しを、もっと簡単にすることです。リソースプー
ルをお膳立てしたり呼び出しを実行したり、結果のキューを作ったり、あるいは
タイムアウトのハンドラを追加したり、スレッドやプロセスや遠隔手続呼び出し
の総数を制限したり、といったことを、これらを使えば、その労力を小さく出来
ます。

理想的にはそれぞれのアプリケーションは、プロセスとスレッドの制限が確実に
管理されるように、複数コンポーネントをまたがって単一の executor を共有す
べきです。そうしておけば、個々のコンポーネントがリソース管理についての競
合する戦略を持つ場合に起こる設計の難題は解決出来ます。

どちらの executor クラスとも 3 つのメソッドを持つ共通インターフェイスを
持ちます。 *note submit(): c75. メソッドは呼び出し可能オブジェクトをスケ
ジュールし、 *note Future: 13ca. オブジェクトを返します。 *note map():
1dc. メソッドは一気に複数の非同期呼び出しをスケジュールします。 *note
shutdown(): aea. メソッドはリソースを解放します。これらクラスは *note
context manager: 1e1. なので *note with: 186. 文とともに使うことが出来、
現時点で保留中の future が実行を終えた際にリソースが自動的に解放されるこ
とを保障出来ます。

以下はファイルコピーを行う 4 つの並列スレッドを実行する、 *note
ThreadPoolExecutor: 949. の単純な使用例です:

     import concurrent.futures, shutil
     with concurrent.futures.ThreadPoolExecutor(max_workers=4) as e:
         e.submit(shutil.copy, 'src1.txt', 'dest1.txt')
         e.submit(shutil.copy, 'src2.txt', 'dest2.txt')
         e.submit(shutil.copy, 'src3.txt', 'dest3.txt')
         e.submit(shutil.copy, 'src3.txt', 'dest4.txt')

参考
....

PEP 3148(1) - Futures - 計算の非同期な実行

     PEP written by Brian Quinlan.

*note ThreadPoolExecutor の例: 13cb. はスレッド並列でウェブページを取得
する実例コードです。

*note ProcessPoolExecutor: 1d6. の実例を *note
並列で素数計算するコード例: 13cc. として挙げています。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3148/


File: python.info,  Node: PEP 3147 PYC リポジトリーディレクトリ,  Next: PEP 3149 ABI バージョンでタグ付けされた so ファイル,  Prev: PEP 3148 concurrent futures モジュール,  Up: What's New In Python 3 2

1.13.5 PEP 3147: PYC リポジトリーディレクトリ
---------------------------------------------

バイトコードを '.pyc' ファイルとしてキャッシュする Python の方法は、複数
の Python インタプリタ環境ではうまく働きませんでした。一つのインタプリタ
がもう一つのインタプリタによって作られたキャッシュファイルに出会うと、そ
のインタプリタはソースを再コンパイルしてキャッシュファイルを上書きするわ
けですから、これではキャッシュの価値は台無しです。

「pyc ファイト」問題は、複数バージョンの Python を載せる Linux ディスト
リビューションにありふれたこととなったよりももっと表立って来ました。これ
ら衝突は Unladen Swallow(1) のような CPython 以外の実装でも起こります。

この問題を解決するために、Python のインポート機構はそれぞれのインタプリ
タごとに区別された名前を使うように拡張されました。Python 3.2、Python
3.3、 Unladen Swallow でそれぞれ競合するファイル名 "mymodule.pyc" を使う
のではなく、それぞれ "mymodule.cpython-32.pyc",
"mymodule.cpython-33.pyc", "mymodule.unladen10.pyc" を使うようになりまし
た。同時にこれらの新しいファイルがソースディレクトリを散らかすのを防ぐた
めに、 'pyc' ファイルはパッケージディレクトリの下の "__pycache__" ディレ
クトリに収集するようになりました。

ファイル名と格納先ディレクトリは別にして、この新方式にはプログラマ目線で
の目に見える変化が少しあります:

   * Imported modules now have a *note __cached__: 321. attribute which
     stores the name of the actual file that was imported:

          >>> import collections
          >>> collections.__cached__
          'c:/py32/lib/__pycache__/collections.cpython-32.pyc'

   * The tag that is unique to each interpreter is accessible from the
     ‘imp’ module:

          >>> import imp
          >>> imp.get_tag()
          'cpython-32'

   * Scripts that try to deduce source filename from the imported file
     now need to be smarter.  It is no longer sufficient to simply strip
     the "c" from a ".pyc" filename.  Instead, use the new functions in
     the ‘imp’ module:

          >>> imp.source_from_cache('c:/py32/lib/__pycache__/collections.cpython-32.pyc')
          'c:/py32/lib/collections.py'
          >>> imp.cache_from_source('c:/py32/lib/collections.py')
          'c:/py32/lib/__pycache__/collections.cpython-32.pyc'

   * *note py_compile: b8. と *note compileall: 21. モジュールはこの新命
     名規則とターゲットディレクトリを反映するよう更新されました。
     'compileall' のコマンドラインからの起動には新しいオプションが追加さ
     れました。 ‘-i’ はコンパイルするファイルとディレクトリのリストを指
     定します。 ‘-b’ はバイトコードファイルを '__pycache__' ではなく伝統
     的な場所に書き出します。

   * The *note importlib.abc: 7c. module has been updated with new *note
     abstract base classes: 13ce. for loading bytecode files.  The
     obsolete ABCs, ‘PyLoader’ and ‘PyPycLoader’, have been deprecated
     (instructions on how to stay Python 3.1 compatible are included
     with the documentation).

参考
....

PEP 3147(2) - PYC リポジトリーディレクトリー

     PEP written by Barry Warsaw.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Unladen_Swallow#Project_activity

   (2) https://peps.python.org/pep-3147/


File: python.info,  Node: PEP 3149 ABI バージョンでタグ付けされた so ファイル,  Next: PEP 3333 Python Web Server Gateway Interface v1 0 1,  Prev: PEP 3147 PYC リポジトリーディレクトリ,  Up: What's New In Python 3 2

1.13.6 PEP 3149: ABI バージョンでタグ付けされた .so ファイル
------------------------------------------------------------

PYC レポジトリーディレクトリでは複数バイトコードのキャッシュファイルを共
存できます。この PEP は共有オブジェクトについての同じようなメカニズムを
実装します。それには共通のディレクトリを使い、個々のバージョンごとの名前
の区別をします。

共通ディレクトリは "pyshared" です。また、ファイル名は Python 実装 (例え
ば CPython、PyPy、Jython など)、メジャー・マイナーバージョン番号やオプシ
ョナルなビルドフラグ (例えばデバッグビルドでの "d"、 pymalloc ビルドの
"m"、ワイド幅 Unicode の "u") を特定することで区別するように命名されます
。任意のパッケージ "foo" について、配布パッケージがインストールされると
これらファイルは例えばこのような具合でしょう:

     /usr/share/pyshared/foo.cpython-32m.so
     /usr/share/pyshared/foo.cpython-33md.so

Python 自身からこのタグに、 *note sysconfig: e1. モジュールにある関数で
アクセス出来ます:

     >>> import sysconfig
     >>> sysconfig.get_config_var('SOABI')       # find the version tag
     'cpython-32mu'
     >>> sysconfig.get_config_var('EXT_SUFFIX')  # find the full filename extension
     '.cpython-32mu.so'

参考
....

PEP 3149(1) - ABI バージョンでタグ付けされた .so ファイル

     PEP written by Barry Warsaw.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3149/


File: python.info,  Node: PEP 3333 Python Web Server Gateway Interface v1 0 1,  Next: その他の言語変更<12>,  Prev: PEP 3149 ABI バージョンでタグ付けされた so ファイル,  Up: What's New In Python 3 2

1.13.7 PEP 3333: Python Web Server Gateway Interface v1.0.1
-----------------------------------------------------------

この情報 PEP は、 WSGI プロトコルによってどのようにバイト列/テキストの問
題が処理されるべきかを明確化しています。HTTP プロトコルそのものはバイト
列指向であっても、Python 3 にあってほとんど *note str: 169. 型で便利に文
字列処理出来るようにすることが挑戦でした。

この PEP では、リクエスト/レスポンスヘッダとメタデータに使われるいわゆる
'ネイティブ文字列(native strings)' と、リクエストとレスポンスのボディに
使われる 'バイト列文字列(byte strings)' を区別します。

The 'native strings' are always of type *note str: 169. but are
restricted to code points between 'U+0000' through 'U+00FF' which are
translatable to bytes using 'Latin-1' encoding.  These strings are used
for the keys and values in the environment dictionary and for response
headers and statuses in the ‘start_response()’ function.  They must
follow RFC 2616(1) with respect to encoding.  That is, they must either
be 'ISO-8859-1' characters or use RFC 2047(2) MIME encoding.

WSGI アプリケーションを Python 2 から移植する開発者は、とりわけ以下に注
意してください:

   * Python 2 でヘッダとしてネイティブ文字列を既に使っているアプリケーシ
     ョンは変更の必要はありません。(--訳注: 原文は「If the app already
     used strings for headers ...」。native strings としないと意味が通り
     ません。 --)

   * そうではなくアプリケーションが出力ヘッダをエンコードしていたり、入
     力ヘッダをデコードしていたのであれば、ヘッダは Latin-1 に再エンコー
     ドする必要があります。たとえば ‘h.encode('utf-8')’ により utf-8 で
     エンコードされた出力ヘッダは、バイト列からネイティブ文字列に
     ‘h.encode('utf-8').decode('latin-1')’ で変換する必要があります。
     (--訳注: この原文は h が元々 latin-1 で表現出来る文字セットであるこ
     とを暗黙で仮定しているようです。--)

   * Values yielded by an application or sent using the ‘write()’ method
     must be byte strings.  The ‘start_response()’ function and environ
     must use native strings.  The two cannot be mixed.

For server implementers writing CGI-to-WSGI pathways or other CGI-style
protocols, the users must to be able access the environment using native
strings even though the underlying platform may have a different
convention.  To bridge this gap, the *note wsgiref: 11e. module has a
new function, *note wsgiref.handlers.read_environ(): 13d1. for
transcoding CGI variables from *note os.environ: 259. into native
strings and returning a new dictionary.

参考
....

PEP 3333(3) - Python Web Server Gateway Interface v1.0.1

     PEP written by Phillip Eby.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2616.html

   (2) https://datatracker.ietf.org/doc/html/rfc2047.html

   (3) https://peps.python.org/pep-3333/


File: python.info,  Node: その他の言語変更<12>,  Next: 新たなモジュール、改良されたモジュール、非推奨のモジュール,  Prev: PEP 3333 Python Web Server Gateway Interface v1 0 1,  Up: What's New In Python 3 2

1.13.8 その他の言語変更
-----------------------

Python 言語コアに小さな変更がいくつか行われました:

   * *note format(): 199. と *note str.format(): 833. のフォーマット文字
     '#' が拡張されました。以前から二進、八進、十六進整数に対して順にそ
     れぞれ '0b', '0o', '0x' を冠する出力をしていましたが、これは浮動小
     数点数、複素数、 Decimal に対しても処理するようになり、これはあとに
     続く桁がなくても必ず小数点を出力します。

          >>> format(20, '#o')
          '0o24'
          >>> format(12.34, '#5.0f')
          '  12.'

     (Suggested by Mark Dickinson and implemented by Eric Smith in
     bpo-7094(1).)

   * There is also a new *note str.format_map(): fd7. method that
     extends the capabilities of the existing *note str.format(): 833.
     method by accepting arbitrary *note mapping: 13d3. objects.  This
     new method makes it possible to use string formatting with any of
     Python's many dictionary-like objects such as *note defaultdict:
     13d4, *note Shelf: 119d, *note ConfigParser: 4de, or *note dbm: 35.
     It is also useful with custom *note dict: 183. subclasses that
     normalize keys before look-up or that supply a *note __missing__():
     13d5. method for unknown keys:

          >>> import shelve
          >>> d = shelve.open('tmp.shl')
          >>> 'The {project_name} status is {status} as of {date}'.format_map(d)
          'The testing project status is green as of February 15, 2011'

          >>> class LowerCasedDict(dict):
          ...     def __getitem__(self, key):
          ...         return dict.__getitem__(self, key.lower())
          ...
          >>> lcd = LowerCasedDict(part='widgets', quantity=10)
          >>> 'There are {QUANTITY} {Part} in stock'.format_map(lcd)
          'There are 10 widgets in stock'

          >>> class PlaceholderDict(dict):
          ...     def __missing__(self, key):
          ...         return '<{}>'.format(key)
          ...
          >>> 'Hello {name}, welcome to {location}'.format_map(PlaceholderDict())
          'Hello <name>, welcome to <location>'

     (Suggested by Raymond Hettinger and implemented by Eric Smith in
     bpo-6081(2).)

   * The interpreter can now be started with a quiet option, ‘-q’, to
     prevent the copyright and version information from being displayed
     in the interactive mode.  The option can be introspected using the
     *note sys.flags: 89c. attribute:

          $ python -q
          >>> sys.flags
          sys.flags(debug=0, division_warning=0, inspect=0, interactive=0,
          optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0,
          ignore_environment=0, verbose=0, bytes_warning=0, quiet=1)

     (Contributed by Marcin Wojdyr in bpo-1772833(3)).

   * The *note hasattr(): 6f9. function works by calling *note
     getattr(): dca. and detecting whether an exception is raised.  This
     technique allows it to detect methods created dynamically by *note
     __getattr__(): 6fa. or *note __getattribute__(): dcb. which would
     otherwise be absent from the class dictionary.  Formerly, 'hasattr'
     would catch any exception, possibly masking genuine errors.  Now,
     'hasattr' has been tightened to only catch *note AttributeError:
     5f0. and let other exceptions pass through:

          >>> class A:
          ...     @property
          ...     def f(self):
          ...         return 1 // 0
          ...
          >>> a = A()
          >>> hasattr(a, 'f')
          Traceback (most recent call last):
            ...
          ZeroDivisionError: integer division or modulo by zero

     (Discovered by Yury Selivanov and fixed by Benjamin Peterson;
     bpo-9666(4).)

   * 浮動小数点数または複素数に対する *note str(): 169. は *note repr():
     1c1. 表現と同じになりました。以前は *note str(): 169. 形式のほうが
     短い表現になっていましたがこれは単に困惑させるものでした。 *note
     repr(): 1c1. がデフォルトで可能ななかでの一番短い表現をするようにな
     ったので、 *note str(): 169. があえて短い表現を取ろうとする必要性が
     なくなりました。

          >>> import math
          >>> repr(math.pi)
          '3.141592653589793'
          >>> str(math.pi)
          '3.141592653589793'

     (Proposed and implemented by Mark Dickinson; bpo-9337(5).)

   * *note memoryview: 165. objects now have a *note release(): 13d6.
     method and they also now support the context management protocol.
     This allows timely release of any resources that were acquired when
     requesting a buffer from the original object.

          >>> with memoryview(b'abcdefgh') as v:
          ...     print(v.tolist())
          [97, 98, 99, 100, 101, 102, 103, 104]

     (Added by Antoine Pitrou; bpo-9757(6).)

   * 以前は、入れ子になったブロック内である名前が自由変数として現れる場
     合、局所名前空間からその名前を削除することは不正でした。

          def outer(x):
              def inner():
                  return x
              inner()
              del x

     これは可能になりました。 *note except: 1ab. 節の対象が消去されるこ
     とを思い出せば、 Python 2.6 では動き、Python 3.1 では *note
     SyntaxError: 18e. を送出するこのコードは再び動きます:

          def f():
              def print_error():
                  print(e)
              try:
                  something
              except Exception as e:
                  print_error()
                  # implicit "del e" here

     (bpo-4617(7) を参照してください。)

   * *note Struct sequence types: 13d7. are now subclasses of tuple.
     This means that C structures like those returned by *note
     os.stat(): 26d, *note time.gmtime(): 13d8, and *note
     sys.version_info: 8af. now work like a *note named tuple: 85e. and
     now work with functions and methods that expect a tuple as an
     argument.  This is a big step forward in making the C structures as
     flexible as their pure Python counterparts:

          >>> import sys
          >>> isinstance(sys.version_info, tuple)
          True
          >>> 'Version %d.%d.%d %s(%d)' % sys.version_info
          'Version 3.2.0 final(0)'

     (Suggested by Arfrever Frehtes Taifersar Arahesis and implemented
     by Benjamin Peterson in bpo-8413(8).)

   * 警告の制御を以前より簡単に出来るようになりました。環境変数 *note
     PYTHONWARNINGS: da3. を使えば、コマンドラインで ‘-W’ を使うより簡単
     です:

          $ export PYTHONWARNINGS='ignore::RuntimeWarning::,once::UnicodeWarning::'

     (Suggested by Barry Warsaw and implemented by Philip Jenvey in
     bpo-7301(9).)

   * 新たな警告カテゴリ *note ResourceWarning: 54c. が追加されました。こ
     れはリソース消費やクリーンアップについての潜在的な問題が検出される
     と発行されます。これは通常のリリースビルドではデフォルトでは黙殺し
     ますが、 *note warnings: 118. モジュールで意味付けを変更 (訳注:
     *note 警告フィルタ: 1b1. 参照) するかコマンドラインオプションで有効
     に出来ます。

     A *note ResourceWarning: 54c. is issued at interpreter shutdown if
     the *note gc.garbage: 13d9. list isn't empty, and if *note
     gc.DEBUG_UNCOLLECTABLE: 13da. is set, all uncollectable objects are
     printed.  This is meant to make the programmer aware that their
     code contains object finalization issues.

     *note ResourceWarning: 54c. は明示的にクローズされなかった *note
     file object: 13db. が破壊される際にも発行されます。そのようなオブジ
     ェクトのデアロケータは背後の OS リソース (大抵はファイル記述子) を
     閉じることを保障はしますが、オブジェクトのデアロケートの遅れは様々
     な問題を産み落とし、とりわけ Windows でこれは顕著です。コマンドライ
     ンからこの警告を有効にするには例えばこのようにします:

          $ python -q -Wdefault
          >>> f = open("foo", "wb")
          >>> del f
          __main__:1: ResourceWarning: unclosed file <_io.BufferedWriter name='foo'>

     (Added by Antoine Pitrou and Georg Brandl in bpo-10093(10) and
     bpo-477863(11).)

   * *note range: b3d. objects now support 'index' and 'count' methods.
     This is part of an effort to make more objects fully implement the
     *note collections.Sequence: 13dc. *note abstract base class: 13ce.
     As a result, the language will have a more uniform API. In
     addition, *note range: b3d. objects now support slicing and
     negative indices, even with values larger than *note sys.maxsize:
     13dd.  This makes 'range' more interoperable with lists:

          >>> range(0, 100, 2).count(10)
          1
          >>> range(0, 100, 2).index(10)
          5
          >>> range(0, 100, 2)[5]
          10
          >>> range(0, 100, 2)[0:5]
          range(0, 10, 2)

     (Contributed by Daniel Stutzbach in bpo-9213(12), by Alexander
     Belopolsky in bpo-2690(13), and by Nick Coghlan in bpo-10889(14).)

   * Py2.x から *note callable(): 13de. 組み込み関数が復活しました。 こ
     の関数は ‘isinstance(x, collections.Callable)’ のように式内で *note
     抽象基底クラス: 13ce. を使用するよりも、簡潔で可読性の高い手段を提
     供します:

          >>> callable(max)
          True
          >>> callable(20)
          False

     (bpo-10518(15) を参照してください。)

   * Python のインポート機構が、パス名に非 ASCII 文字を含むディレクトリ
     にインストールされたモジュールをロードできるようになりました。これ
     はユーザ名に非 ASCII 文字を含むユーザにとっての、ホームディレクトリ
     にまつわる腹立たしい問題を解決しました。

     (Required extensive work by Victor Stinner in bpo-9425(16).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=7094

   (2) https://bugs.python.org/issue?@action=redirect&bpo=6081

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1772833

   (4) https://bugs.python.org/issue?@action=redirect&bpo=9666

   (5) https://bugs.python.org/issue?@action=redirect&bpo=9337

   (6) https://bugs.python.org/issue?@action=redirect&bpo=9757

   (7) https://bugs.python.org/issue?@action=redirect&bpo=4617

   (8) https://bugs.python.org/issue?@action=redirect&bpo=8413

   (9) https://bugs.python.org/issue?@action=redirect&bpo=7301

   (10) https://bugs.python.org/issue?@action=redirect&bpo=10093

   (11) https://bugs.python.org/issue?@action=redirect&bpo=477863

   (12) https://bugs.python.org/issue?@action=redirect&bpo=9213

   (13) https://bugs.python.org/issue?@action=redirect&bpo=2690

   (14) https://bugs.python.org/issue?@action=redirect&bpo=10889

   (15) https://bugs.python.org/issue?@action=redirect&bpo=10518

   (16) https://bugs.python.org/issue?@action=redirect&bpo=9425


File: python.info,  Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール,  Next: マルチスレッディング,  Prev: その他の言語変更<12>,  Up: What's New In Python 3 2

1.13.9 新たなモジュール、改良されたモジュール、非推奨のモジュール
-----------------------------------------------------------------

Python の標準ライブラリは保守の努力と質の向上を大きく受けています。

The biggest news for Python 3.2 is that the *note email: 3f. package,
*note mailbox: 8f. module, and ‘nntplib’ modules now work correctly with
the bytes/text model in Python 3.  For the first time, there is correct
handling of messages with mixed encodings.

標準ライブラリ全体を通じて、エンコーディング問題とテキスト対バイト列問題
に関してより注意深い配慮がなされました。とりわけオペレーティングシステム
との連携では、Windows の MBCS エンコーディングやロケールに配慮するエンコ
ーディング、あるいは UTF-8 を使う非 ASCII のデータ交換はより良く行えるよ
うになりました。

もうひとつの目覚しい勝利は、 'SSL' 接続とセキュリティ証明書サポートの大
幅な改善です。

さらに、以前よりももっと多くのクラスが今では *note context manager: 1e1.
を実装し、 *note with: 186. 文を使った便利で信頼出来るリソースのクリーン
アップをサポートしています。

* Menu:

* email: email<7>.
* elementtree::
* functools: functools<8>.
* itertools: itertools<8>.
* collections: collections<8>.
* threading: threading<10>.
* datetime と time::
* math: math<11>.
* abc: abc<3>.
* io: io<9>.
* reprlib::
* logging: logging<8>.
* csv: csv<4>.
* contextlib: contextlib<8>.
* decimal と fractions::
* ftp::
* popen::
* select: select<3>.
* gzip と zipfile::
* tarfile: tarfile<10>.
* hashlib: hashlib<7>.
* ast: ast<7>.
* os: os<14>.
* shutil: shutil<8>.
* sqlite3: sqlite3<12>.
* html: html<3>.
* socket: socket<12>.
* ssl: ssl<13>.
* nntp::
* certificates::
* imaplib: imaplib<5>.
* http.client: http client<4>.
* unittest: unittest<12>.
* random: random<5>.
* poplib: poplib<4>.
* asyncore: asyncore<2>.
* tempfile: tempfile<5>.
* inspect: inspect<11>.
* pydoc: pydoc<7>.
* dis: dis<6>.
* dbm: dbm<7>.
* ctypes: ctypes<4>.
* site: site<4>.
* sysconfig: sysconfig<4>.
* pdb: pdb<10>.
* configparser: configparser<6>.
* urllib.parse: urllib parse<6>.
* mailbox::
* turtledemo::


File: python.info,  Node: email<7>,  Next: elementtree,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.1 email
..............

The usability of the *note email: 3f. package in Python 3 has been
mostly fixed by the extensive efforts of R. David Murray.  The problem
was that emails are typically read and stored in the form of *note
bytes: 192. rather than *note str: 169. text, and they may contain
multiple encodings within a single email.  So, the email package had to
be extended to parse and generate email messages in bytes format.

   * 新規関数 *note message_from_bytes(): 13e1, *note
     message_from_binary_file(): 13e2. 、それに新規クラス *note
     BytesFeedParser: 13e3, *note BytesParser: 13e4. が、バイナリメッセ
     ージデータをパースしてモデルオブジェクトに読み込みます。

   * bytes の入力をモデルに与えると *note get_payload(): 13e5. は、デフ
     ォルトでは '8 ビット' の ‘Content-Transfer-Encoding’ MIME ヘッダを
     もったメッセージボディをそのヘッダで指定された文字セットを使い、デ
     コードして結果文字列を返します。

   * bytes の入力をモデルに与えると *note Generator: 13e6. は、 '8 ビッ
     ト' の ‘Content-Transfer-Encoding’ MIME ヘッダをもったメッセージボ
     ディを、 '7 ビット' の ‘Content-Transfer-Encoding’ を持つものに変換
     します。

     エンコードされていない非 ASCII バイト列を持つヘッダは '未知の 8 ビ
     ット' 文字セットを使った RFC 2047(1) エンコードであると見做されます
     。

   * 新規クラス *note BytesGenerator: 13e7. は出力としてバイト列を生成し
     ます。これはモデルを構築するのに使った入力にあった非 ASCII データを
     そのままにし、 '8ビットの' ‘Content-Transfer-Encoding’ を持つメッセ
     ージボディに含めます。

   * *note smtplib: cf. モジュールの *note SMTP: b27. クラスが *note
     sendmail(): 1059. メソッドの 'msg' 引数としてバイト列文字列を受け付
     けるようになりました。新しく追加されたメソッド *note
     send_message(): 105a. は 'msg' 引数に *note Message: 581. オブジェ
     クトを受け付けます。このメソッドは 'msg' にあたえたオブジェクトから
     'from_addr' アドレスと 'to_addrs' アドレスを直接取ることが出来ます
     。

(Proposed and implemented by R. David Murray, bpo-4661(2) and
bpo-10321(3).)

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2047.html

   (2) https://bugs.python.org/issue?@action=redirect&bpo=4661

   (3) https://bugs.python.org/issue?@action=redirect&bpo=10321


File: python.info,  Node: elementtree,  Next: functools<8>,  Prev: email<7>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.2 elementtree
....................

The *note xml.etree.ElementTree: 12b. package and its
‘xml.etree.cElementTree’ counterpart have been updated to version 1.3.

有用な関数とメソッドが幾つか新たに追加されました:

   * *note xml.etree.ElementTree.fromstringlist(): 13e9.、断片のシーケン
     スから XML 文書を組み立てます

   * *note xml.etree.ElementTree.register_namespace(): 13ea.、大域名前空
     間接頭辞を登録するのに使用します

   * *note xml.etree.ElementTree.tostringlist(): 11f8.、全サブリストを含
     めた文字列表記に使用します

   * *note xml.etree.ElementTree.Element.extend(): 13eb.、ゼロ以上の要素
     のシークエンスを追加するのに使用します

   * *note xml.etree.ElementTree.Element.iterfind(): 13ec.、要素と子要素
     を検索します

   * *note xml.etree.ElementTree.Element.itertext(): 13ed.、要素と子要素
     を走るテキストイテレータを作成します

   * *note xml.etree.ElementTree.TreeBuilder.end(): 13ee.、現在の要素を
     閉じます

   * *note xml.etree.ElementTree.TreeBuilder.doctype(): c8e.、doctype 定
     義を処理します

2つのメソッドが非推奨になりました:

   * ‘xml.etree.ElementTree.getchildren()’ use ‘list(elem)’ instead.

   * ‘xml.etree.ElementTree.getiterator()’ use ‘Element.iter’ instead.

For details of the update, see Introducing ElementTree(1) on Fredrik
Lundh's website.

(Contributed by Florent Xicluna and Fredrik Lundh, bpo-6472(2).)

   ---------- Footnotes ----------

   (1) 
https://web.archive.org/web/20200703234532/http://effbot.org/zone/elementtree-13-intro.htm

   (2) https://bugs.python.org/issue?@action=redirect&bpo=6472


File: python.info,  Node: functools<8>,  Next: itertools<8>,  Prev: elementtree,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.3 functools
..................

   * *note functools: 63. モジュールに関数呼び出しをキャッシュするデコレ
     ータが追加されています。 *note functools.lru_cache(): be2. を使うと
     、同じ結果が期待される場合の外部リソースへの問い合わせ繰り返しを防
     ぐことができます。

     たとえばデータベース問い合わせ関数をキャッシュするデコレータで修飾
     すれば、人気の検索のデータベースアクセスを省けます:

          >>> import functools
          >>> @functools.lru_cache(maxsize=300)
          ... def get_phone_number(name):
          ...     c = conn.cursor()
          ...     c.execute('SELECT phonenumber FROM phonelist WHERE name=?', (name,))
          ...     return c.fetchone()[0]

          >>> for name in user_requests:
          ...     get_phone_number(name)        # cached lookup

     効果的なキャッシュサイズを選択する助けとなるよう、ラップされた関数
     はキャッシュの統計を追跡する道具にもなっています:

          >>> get_phone_number.cache_info()
          CacheInfo(hits=4805, misses=980, maxsize=300, currsize=300)

     テーブル phonelist が更新されたのであれば、内容が古くなったキャッシ
     ュをクリアできます:

          >>> get_phone_number.cache_clear()

     (Contributed by Raymond Hettinger and incorporating design ideas
     from Jim Baker, Miki Tebeka, and Nick Coghlan; see recipe
     498245(1), recipe 577479(2), bpo-10586(3), and bpo-10593(4).)

   * The *note functools.wraps(): 115f. decorator now adds a
     ‘__wrapped__’ attribute pointing to the original callable function.
     This allows wrapped functions to be introspected.  It also copies
     *note __annotations__: 13f0. if defined.  And now it also
     gracefully skips over missing attributes such as *note __doc__:
     13f1. which might not be defined for the wrapped callable.

     上の例の場合、キャッシュは元の関数を復元することで削除できます:

          >>> get_phone_number = get_phone_number.__wrapped__    # uncached function

     (By Nick Coghlan and Terrence Cole; bpo-9567(5), bpo-3445(6), and
     bpo-8814(7).)

   * 拡張比較 (rich comparison) メソッドを持つクラスを書く助けとなるよう
     、新たなデコレータ *note functools.total_ordering(): 1144. が追加さ
     れました。これは既存の等式と不等式メソッドを使って残りのメソッドを
     埋めます。

     例えば '__eq__' と '__lt__' を与えると、 *note total_ordering():
     1144. は '__le__', '__gt__', '__ge__' を補います:

          @total_ordering
          class Student:
              def __eq__(self, other):
                  return ((self.lastname.lower(), self.firstname.lower()) ==
                          (other.lastname.lower(), other.firstname.lower()))

              def __lt__(self, other):
                  return ((self.lastname.lower(), self.firstname.lower()) <
                          (other.lastname.lower(), other.firstname.lower()))

     'total_ordering' デコレータが残りの比較メソッドを自動的に補います。

     (Contributed by Raymond Hettinger.)

   * Python 2 からのプログラムの移植のために使える、 *note
     functools.cmp_to_key(): 13f2. 関数が追加されました。これは旧式の比
     較関数をモダンな *note key function: 1006. に変換します:

          >>> # locale-aware sort order
          >>> sorted(iterable, key=cmp_to_key(locale.strcoll))

     ソートの例と簡単なチュートリアルは *note ソートのテクニック: 13f3.
     を参照して下さい。

     (Contributed by Raymond Hettinger.)

   ---------- Footnotes ----------

   (1) 
https://code.activestate.com/recipes/498245-lru-and-lfu-cache-decorators/

   (2) 
https://code.activestate.com/recipes/577479-simple-caching-decorator/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=10586

   (4) https://bugs.python.org/issue?@action=redirect&bpo=10593

   (5) https://bugs.python.org/issue?@action=redirect&bpo=9567

   (6) https://bugs.python.org/issue?@action=redirect&bpo=3445

   (7) https://bugs.python.org/issue?@action=redirect&bpo=8814


File: python.info,  Node: itertools<8>,  Next: collections<8>,  Prev: functools<8>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.4 itertools
..................

   * *note itertools: 85. モジュールに、 APL(1) の 'scan' 演算子や
     NumPy(2) の 'accumulate' 関数をモデルにした *note accumulate():
     bf0. が新しく追加されました:

          >>> from itertools import accumulate
          >>> list(accumulate([8, 2, 50]))
          [8, 10, 60]

          >>> prob_dist = [0.1, 0.4, 0.2, 0.3]
          >>> list(accumulate(prob_dist))      # cumulative probability distribution
          [0.1, 0.5, 0.7, 1.0]

     *note accumulate(): bf0. の使用例が *note examples for the random
     module: 13f5. にあります。

     (Contributed by Raymond Hettinger and incorporating design
     suggestions from Mark Dickinson.)

   ---------- Footnotes ----------

   (1) https://ja.wikipedia.org/wiki/APL

   (2) http://www.numpy.org/


File: python.info,  Node: collections<8>,  Next: threading<10>,  Prev: itertools<8>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.5 collections
....................

   * *note collections.Counter: 12a3. クラスに 2 つの形式のインプレイス
     減算が追加されました。 saturating subtraction(1) (訳注: 結果を
     [min, max] に収める演算) を行う既存の '-=' 演算子に加え、新しく追加
     された *note subtract(): 13f7. メソッドは通常の減算を行います。前者
     は要素数に正しか持たない 多重集合(2) に用いるのに適していて、後者は
     要素数に負を許容するユースケースにより適しています。

          >>> from collections import Counter
          >>> tally = Counter(dogs=5, cats=3)
          >>> tally -= Counter(dogs=2, cats=8)    # saturating subtraction
          >>> tally
          Counter({'dogs': 3})

          >>> tally = Counter(dogs=5, cats=3)
          >>> tally.subtract(dogs=2, cats=8)      # regular subtraction
          >>> tally
          Counter({'dogs': 3, 'cats': -5})

     (Contributed by Raymond Hettinger.)

   * *note collections.OrderedDict: 7f3. クラスに *note move_to_end():
     13f8. メソッド (訳注: 「end」は「端」) が追加されました。これは既存
     のキーを受け取って、順序付けされたシーケンスの最初の位置か最後の位
     置に移動します。

     デフォルトでは要素は最後の位置に移動します。これはエントリを ‘od[k]
     = od.pop(k)’ で入れ替えるのと同じです。

     高速な端への移動操作はエントリの並べなおしに便利です。例えば、最も
     最近使った順序でエントリを年齢付けすることによってアクセス順を追跡
     するのに、順序付けされた辞書を使えます。

          >>> from collections import OrderedDict
          >>> d = OrderedDict.fromkeys(['a', 'b', 'X', 'd', 'e'])
          >>> list(d)
          ['a', 'b', 'X', 'd', 'e']
          >>> d.move_to_end('X')
          >>> list(d)
          ['a', 'b', 'd', 'e', 'X']

     (Contributed by Raymond Hettinger.)

   * *note collections.deque: 7f4. クラスに 2 つのメソッド *note
     count(): 13f9. と *note reverse(): 13fa. が追加されました。これでさ
     らに *note list: 24d. との置換可能性が増しました:

          >>> from collections import deque
          >>> d = deque('simsalabim')
          >>> d.count('s')
          2
          >>> d.reverse()
          >>> d
          deque(['m', 'i', 'b', 'a', 'l', 'a', 's', 'm', 'i', 's'])

     (Contributed by Raymond Hettinger.)

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Saturation_arithmetic

   (2) 
https://ja.wikipedia.org/wiki/%E5%A4%9A%E9%87%8D%E9%9B%86%E5%90%88


File: python.info,  Node: threading<10>,  Next: datetime と time,  Prev: collections<8>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.6 threading
..................

*note threading: f3. モジュールに新たに同期クラス *note Barrier: 13fc. が
追加されました。これは多重のスレッドに、それら全てが共通のバリアポイント
に到達するまで待たせます。バリアは、複数の事前条件を持ったタスクを、その
前任タスクの全てが完了するまで走らせたくない場合に有用です。

バリアは任意の数のスレッドに対して使えます。これは Rendezvous(1) を一般
化したもので、それは 2 つのスレッドに対してのみに定義されていました。

二段階の周期バリアとしての実装なので、 *note Barrier: 13fc. オブジェクト
はループ内での利用に適しています。分けられた 'filling (満杯にする)' 段階
と 'draining (排出する)' 段階は、スレッドのどれか一つが元に戻ってバリア
に再び入る前に、全てのスレッドが解放 (排出) されることを保障します。バリ
アはそれぞれの周期のあとに完全にリセットされます。

バリアは例えばこのように使います:

     from threading import Barrier, Thread

     def get_votes(site):
         ballots = conduct_election(site)
         all_polls_closed.wait()        # do not count until all polls are closed
         totals = summarize(ballots)
         publish(site, totals)

     all_polls_closed = Barrier(len(sites))
     for site in sites:
         Thread(target=get_votes, args=(site,)).start()

この例ではバリアは、全ての投票所が閉じるまではどの投票サイトでも得票を数
えないルールを強制しています。バリアを使ったソリューションが *note
threading.Thread.join(): 13fd. でのそれといかに似ているか気付くと思いま
す。ですがバリアポイントを通過した後に、スレッドは生き続けて (投票を集計
する (summarizing ballots) という) 仕事を続けます。

いずれかの前任タスクがハングしたり遅延したりしうるのであれば、バリアを
'timeout' 付きで作ることができます。全ての前任タスクがバリアポイントに到
達する前にタイムアウトの期間が経過すると、全ての待機スレッドは解放されて
*note BrokenBarrierError: 13fe. 例外が発生します:

     def get_votes(site):
         ballots = conduct_election(site)
         try:
             all_polls_closed.wait(timeout=midnight - time.now())
         except BrokenBarrierError:
             lockbox = seal_ballots(ballots)
             queue.put(lockbox)
         else:
             totals = summarize(ballots)
             publish(site, totals)

この例ではバリアは、もっと手堅いルールを強制しています。選挙サイトのどれ
かが午前零時前に終了しなかった場合バリアがタイムアウトし、投票用紙は密封
されて後の処理のためのキューに預けられます。

See Barrier Synchronization Patterns(2) for more examples of how
barriers can be used in parallel computing.  Also, there is a simple but
thorough explanation of barriers in The Little Book of Semaphores(3),
'section 3.6'.

(Contributed by Kristján Valur Jónsson with an API review by Jeffrey
Yasskin in bpo-8777(4).)

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Synchronous_rendezvous

   (2) 
https://osl.cs.illinois.edu/media/papers/karmani-2009-barrier_synchronization_pattern.pdf

   (3) https://greenteapress.com/semaphores/LittleBookOfSemaphores.pdf

   (4) https://bugs.python.org/issue?@action=redirect&bpo=8777


File: python.info,  Node: datetime と time,  Next: math<11>,  Prev: threading<10>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.7 datetime と time
.........................

   * *note datetime: 34. モジュールに新たに *note timezone: 12d5. 型が追
     加されています。これは *note tzinfo: 7f6. インターフェイスを実装し
     、UTC からの固定オフセットとタイムゾーン名を返します。これによりタ
     イムゾーンを意識する (timezone-aware な) datetime オブジェクトを容
     易に作れます:

          >>> from datetime import datetime, timezone

          >>> datetime.now(timezone.utc)
          datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, tzinfo=datetime.timezone.utc)

          >>> datetime.strptime("01/01/2000 12:00 +0000", "%m/%d/%Y %H:%M %z")
          datetime.datetime(2000, 1, 1, 12, 0, tzinfo=datetime.timezone.utc)

   * さらに、 *note timedelta: bc3. オブジェクトは今では *note float:
     196. を掛けることができ、 *note float: 196. や *note int: 19b. で割
     ることができます。また、 *note timedelta: bc3. オブジェクトは別の
     *note timedelta: bc3. で割ることが出来ます。

   * *note datetime.date.strftime(): e8f. メソッドにはもう 1900 年以降と
     いう制限はありません。新しくサポートされる年の範囲は 1000 以上 9999
     以下です。

   * Whenever a two-digit year is used in a time tuple, the
     interpretation has been governed by ‘time.accept2dyear’.  The
     default is ‘True’ which means that for a two-digit year, the
     century is guessed according to the POSIX rules governing the ‘%y’
     strptime format.

     Starting with Py3.2, use of the century guessing heuristic will
     emit a *note DeprecationWarning: 1a3.  Instead, it is recommended
     that ‘time.accept2dyear’ be set to ‘False’ so that large date
     ranges can be used without guesswork:

          >>> import time, warnings
          >>> warnings.resetwarnings()      # remove the default warning filters

          >>> time.accept2dyear = True      # guess whether 11 means 11 or 2011
          >>> time.asctime((11, 1, 1, 12, 34, 56, 4, 1, 0))
          Warning (from warnings module):
            ...
          DeprecationWarning: Century info guessed for a 2-digit year.
          'Fri Jan  1 12:34:56 2011'

          >>> time.accept2dyear = False     # use the full range of allowable dates
          >>> time.asctime((11, 1, 1, 12, 34, 56, 4, 1, 0))
          'Fri Jan  1 12:34:56 11'

     Several functions now have significantly expanded date ranges.
     When ‘time.accept2dyear’ is false, the *note time.asctime(): 1400.
     function will accept any year that fits in a C int, while the *note
     time.mktime(): 1401. and *note time.strftime(): 1402. functions
     will accept the full range supported by the corresponding operating
     system functions.

(Contributed by Alexander Belopolsky and Victor Stinner in
bpo-1289118(1), bpo-5094(2), bpo-6641(3), bpo-2706(4), bpo-1777412(5),
bpo-8013(6), and bpo-10827(7).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1289118

   (2) https://bugs.python.org/issue?@action=redirect&bpo=5094

   (3) https://bugs.python.org/issue?@action=redirect&bpo=6641

   (4) https://bugs.python.org/issue?@action=redirect&bpo=2706

   (5) https://bugs.python.org/issue?@action=redirect&bpo=1777412

   (6) https://bugs.python.org/issue?@action=redirect&bpo=8013

   (7) https://bugs.python.org/issue?@action=redirect&bpo=10827


File: python.info,  Node: math<11>,  Next: abc<3>,  Prev: datetime と time,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.8 math
.............

*note math: 92. モジュールがアップデートされ、C99 標準に触発されて6つの
新たな関数が追加されました。

*note isfinite(): 1404. 関数は特殊値を確実に、かつ高速に検出する方法を提
供します。通常の数には ‘True’ を、'Nan' や 'Infinity' には ‘False’ を返
します:

     >>> from math import isfinite
     >>> [isfinite(x) for x in (123, 4.56, float('Nan'), float('Inf'))]
     [True, True, False, False]

*note expm1(): 1405. 関数は小さな 'x' に対しても精度を失うこと (訳注: 桁
落ち) なく ‘e**x-1’ を計算します。 通常、桁落ちは非常に近い数の引き算で
起こります。

     >>> from math import expm1
     >>> expm1(0.013671875)   # more accurate way to compute e**x-1 for a small x
     0.013765762467652909

*note erf(): dd3. 関数は確率積分、すなわち 誤差関数(1) を返します。 相補
誤差関数 *note erfc(): dd4. は ‘1 - erf(x)’ です:

     >>> from math import erf, erfc, sqrt
     >>> erf(1.0/sqrt(2.0))   # portion of normal distribution within 1 standard deviation
     0.682689492137086
     >>> erfc(1.0/sqrt(2.0))  # portion of normal distribution outside 1 standard deviation
     0.31731050786291404
     >>> erf(1.0/sqrt(2.0)) + erfc(1.0/sqrt(2.0))
     1.0

*note gamma(): 1406. 関数は階乗を連続的に拡張したものです。詳細は ガンマ
関数(2) を参照してください。ガンマ関数は階乗に関係しているため、小さな
'x' でも大きくなります。そのため、ガンマ関数の自然対数を計算する *note
lgamma(): 1407. 関数があります。

     >>> from math import gamma, lgamma
     >>> gamma(7.0)           # six factorial
     720.0
     >>> lgamma(801.0)        # log(800 factorial)
     4551.950730698041

(Contributed by Mark Dickinson.)

   ---------- Footnotes ----------

   (1) 
https://ja.wikipedia.org/wiki/%E8%AA%A4%E5%B7%AE%E9%96%A2%E6%95%B0

   (2) 
https://ja.wikipedia.org/wiki/%E3%82%AC%E3%83%B3%E3%83%9E%E9%96%A2%E6%95%B0


File: python.info,  Node: abc<3>,  Next: io<9>,  Prev: math<11>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.9 abc
............

*note abc: 4. モジュールは *note abstractclassmethod(): 1298. と *note
abstractstaticmethod(): 1299. をサポートしました。

これらのツールによって特定の *note classmethod(): 48e. や *note
staticmethod(): 453. を実装する必要のある *note 抽象基底クラス: 13ce. を
定義することが出来ます。

     class Temperature(metaclass=abc.ABCMeta):
         @abc.abstractclassmethod
         def from_fahrenheit(cls, t):
             ...
         @abc.abstractclassmethod
         def from_celsius(cls, t):
             ...

(Patch submitted by Daniel Urban; bpo-5867(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5867


File: python.info,  Node: io<9>,  Next: reprlib,  Prev: abc<3>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.10 io
............

*note io.BytesIO: 10a4. に *note memoryview(): 165. と同様の機能を提供す
る新たなメソッド *note getbuffer(): 140a. が追加されました。 このメソッ
ドはコピーせずにデータの編集可能なビューを作成します。 バッファのランダ
ムアクセスとスライス記法のサポートはインプレースな編集に適しています:

     >>> REC_LEN, LOC_START, LOC_LEN = 34, 7, 11

     >>> def change_location(buffer, record_number, location):
     ...     start = record_number * REC_LEN + LOC_START
     ...     buffer[start: start+LOC_LEN] = location

     >>> import io

     >>> byte_stream = io.BytesIO(
     ...     b'G3805  storeroom  Main chassis    '
     ...     b'X7899  shipping   Reserve cog     '
     ...     b'L6988  receiving  Primary sprocket'
     ... )
     >>> buffer = byte_stream.getbuffer()
     >>> change_location(buffer, 1, b'warehouse  ')
     >>> change_location(buffer, 0, b'showroom   ')
     >>> print(byte_stream.getvalue())
     b'G3805  showroom   Main chassis    '
     b'X7899  warehouse  Reserve cog     '
     b'L6988  receiving  Primary sprocket'

(Contributed by Antoine Pitrou in bpo-5506(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5506


File: python.info,  Node: reprlib,  Next: logging<8>,  Prev: io<9>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.11 reprlib
.................

When writing a *note __repr__(): 82f. method for a custom container, it
is easy to forget to handle the case where a member refers back to the
container itself.  Python's builtin objects such as *note list: 24d. and
*note set: 184. handle self-reference by displaying "..."  in the
recursive part of the representation string.

To help write such *note __repr__(): 82f. methods, the *note reprlib:
c0. module has a new decorator, *note recursive_repr(): 140c, for
detecting recursive calls to ‘__repr__()’ and substituting a placeholder
string instead:

     >>> class MyList(list):
     ...     @recursive_repr()
     ...     def __repr__(self):
     ...         return '<' + '|'.join(map(repr, self)) + '>'
     ...
     >>> m = MyList('abc')
     >>> m.append(m)
     >>> m.append('x')
     >>> print(m)
     <'a'|'b'|'c'|...|'x'>

(Contributed by Raymond Hettinger in bpo-9826(1) and bpo-9840(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9826

   (2) https://bugs.python.org/issue?@action=redirect&bpo=9840


File: python.info,  Node: logging<8>,  Next: csv<4>,  Prev: reprlib,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.12 logging
.................

上記の辞書ベースの設定に加え、*note logging: 8b. パッケージには他にも多
くの改良があります。

ロギングのドキュメントは *note 基本チュートリアル: 140e. 、 *note
上級チュートリアル: 140f. 、 *note クックブック: 1410. により増強されて
きました。ロギングについて学習するにはこれらのドキュメントが最速の方法で
す。

セットアップ関数 *note logging.basicConfig(): bf3. に 'style' 引数が追加
され、これにより異なる 3 つのタイプの文字列書式化がサポートされます。デ
フォルトは伝統的な % 書式化を使う "%" で、 *note str.format(): 833. スタ
イルの "{" 、 *note string.Template: 897. で提供されるシェルスタイルの
"$" をセット出来ます。以下の 3 つの設定は等価です:

     >>> from logging import basicConfig
     >>> basicConfig(style='%', format="%(name)s -> %(levelname)s: %(message)s")
     >>> basicConfig(style='{', format="{name} -> {levelname} {message}")
     >>> basicConfig(style='$', format="$name -> $levelname: $message")

If no configuration is set-up before a logging event occurs, there is
now a default configuration using a *note StreamHandler: 1411. directed
to *note sys.stderr: b33. for events of ‘WARNING’ level or higher.
Formerly, an event occurring before a configuration was set-up would
either raise an exception or silently drop the event depending on the
value of *note logging.raiseExceptions: 1412.  The new default handler
is stored in *note logging.lastResort: 1413.

フィルタの利用は単純になりました。 *note Filter: 1414. オブジェクトを作
る代わりに、 ‘True’ か ‘False’ を返す任意の Python 呼び出し可能オブジェ
クトを述語 (predicate) として利用出来ます。

ほかにも柔軟性を高め、設定を単純化する数多くの改善がありました。Python
3.2 での全ての変更についてはモジュールのドキュメントを参照してください。


File: python.info,  Node: csv<4>,  Next: contextlib<8>,  Prev: logging<8>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.13 csv
.............

*note csv: 2d. モジュールは新たな方言 *note unix_dialect: 1416. をサポー
トしました。 この方言は全フィールドをクォートし、行末を伝統的な Unix 形
式の ‘'\n'’ にします。 登録された方言名は ‘unix’ です。

*note csv.DictWriter: 1417. に新たなメソッド *note writeheader(): 1418.
が追加されました。 最初の列をドキュメントのフィールド名に書き出すのに使
用します:

     >>> import csv, sys
     >>> w = csv.DictWriter(sys.stdout, ['name', 'dept'], dialect='unix')
     >>> w.writeheader()
     "name","dept"
     >>> w.writerows([
     ...     {'name': 'tom', 'dept': 'accounting'},
     ...     {'name': 'susan', 'dept': 'Salesl'}])
     "tom","accounting"
     "susan","sales"

(New dialect suggested by Jay Talbot in bpo-5975(1), and the new method
suggested by Ed Abraham in bpo-1537721(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5975

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1537721


File: python.info,  Node: contextlib<8>,  Next: decimal と fractions,  Prev: csv<4>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.14 contextlib
....................

新しく追加され、そして少しばかりハートを揺さぶるツール *note
ContextDecorator: 141a. は、関数デコレータとしての任務も果たす *note
context manager: 1e1. を作るのに役立つものです。

利便性のためにこの新機能は *note contextmanager(): 141b. で使われている
ので、両方の役割をサポートするのにことさら労力は要しません。

基本的なアイディアは、コンテキストマネージャも関数デコレータも、ともに事
前アクション・事後アクションラッパーとして使うことが出来るというものです
。コンテキストマネージャは *note with: 186. 文を使ったステートメント (文
) のグループを包みますし、関数デコレータは関数に取り囲まれたステートメン
トのグループを包みます。そうです、どちらかの役割で使える事前アクションあ
るいは事後アクションラッパーを書く必要性は、しばしば起こることです。

たとえば関数やステートメントのグループをロガーで包んで、開始時刻と終了時
刻を追跡できるようにするとしばしば便利です。このタスクをこなすために関数
デコレータとコンテキストマネージャの両方を書く代わりに、 *note
contextmanager(): 141b. が単一の定義に両方の能力をもたらしてくれます:

     from contextlib import contextmanager
     import logging

     logging.basicConfig(level=logging.INFO)

     @contextmanager
     def track_entry_and_exit(name):
         logging.info('Entering: %s', name)
         yield
         logging.info('Exiting: %s', name)

ContextDecorator が使われる前の 3.1 までの *note contextmanager(): 141b.
では、これはコンテキストマネージャとして使えるだけでした:

     with track_entry_and_exit('widget loader'):
         print('Some time consuming activity goes here')
         load_widget()

今ではこれはデコレータとしても使えます:

     @track_entry_and_exit('widget loader')
     def activity():
         print('Some time consuming activity goes here')
         load_widget()

一つの場所に二重の責務を持たせることには普通ある種の制約を持ち込みます。
コンテキストマネージャには普通は *note with: 186. 文で使える値を返せる柔
軟性を持ちますが、関数デコレータにはそれに匹敵するものはありません。

上の例の場合は、'track_entry_and_exit' コンテキストマネージャが、取り囲
まれたステートメント本体で使えるロギングのインスタンスを返す綺麗な方法は
ありません。

(Contributed by Michael Foord in bpo-9110(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9110


File: python.info,  Node: decimal と fractions,  Next: ftp,  Prev: contextlib<8>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.15 decimal と fractions
..............................

Mark Dickinson は、異なる数値データの型が実際の値が等しい場合は常に同じ
ハッシュ値を持つことを保証する、エレガントで効率的なスキームを作り上げま
した (bpo-8188(1)):

     assert hash(Fraction(3, 2)) == hash(1.5) == \
            hash(Decimal("1.5")) == hash(complex(1.5, 0))

Some of the hashing details are exposed through a new attribute, *note
sys.hash_info: 1201, which describes the bit width of the hash value,
the prime modulus, the hash values for 'infinity' and 'nan', and the
multiplier used for the imaginary part of a number:

     >>> sys.hash_info
     sys.hash_info(width=64, modulus=2305843009213693951, inf=314159, nan=0, imag=1000003)

An early decision to limit the interoperability of various numeric types
has been relaxed.  It is still unsupported (and ill-advised) to have
implicit mixing in arithmetic expressions such as ‘Decimal('1.1') +
float('1.1')’ because the latter loses information in the process of
constructing the binary float.  However, since existing floating-point
value can be converted losslessly to either a decimal or rational
representation, it makes sense to add them to the constructor and to
support mixed-type comparisons.

   * *note decimal.Decimal: 1fe. コンストラクタに *note float: 196. オブ
     ジェクトを直接渡せるようになりました。これにより *note
     from_float(): 141d. メソッドを使う必要はなくなりました
     (bpo-8257(2))。

   * 型違いの比較はいまでは完全にサポートされたので、 *note Decimal:
     1fe. オブジェクトを直接 *note float: 196. や *note
     fractions.Fraction: 213. と比較出来ます (bpo-2531(3) and
     bpo-8188(4))。

Similar changes were made to *note fractions.Fraction: 213. so that the
*note from_float(): 141e. and *note from_decimal(): 141f. methods are no
longer needed (bpo-8294(5)):

     >>> from decimal import Decimal
     >>> from fractions import Fraction
     >>> Decimal(1.1)
     Decimal('1.100000000000000088817841970012523233890533447265625')
     >>> Fraction(1.1)
     Fraction(2476979795053773, 2251799813685248)

Another useful change for the *note decimal: 3a. module is that the
*note Context.clamp: 13b6. attribute is now public.  This is useful in
creating contexts that correspond to the decimal interchange formats
specified in IEEE 754 (see bpo-8540(6)).

(Contributed by Mark Dickinson and Raymond Hettinger.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=8188

   (2) https://bugs.python.org/issue?@action=redirect&bpo=8257

   (3) https://bugs.python.org/issue?@action=redirect&bpo=2531

   (4) https://bugs.python.org/issue?@action=redirect&bpo=8188

   (5) https://bugs.python.org/issue?@action=redirect&bpo=8294

   (6) https://bugs.python.org/issue?@action=redirect&bpo=8540


File: python.info,  Node: ftp,  Next: popen,  Prev: decimal と fractions,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.16 ftp
.............

*note ftplib.FTP: af6. クラスがコンテキスト管理プロトコルをサポートする
ようになりました。with ブロックを抜ける際に無条件に FTP 接続をクローズし
ます (クローズ処理で発生する *note socket.error: 1261. は無視されます)。
:

     >>> from ftplib import FTP
     >>> with FTP("ftp1.at.proftpd.org") as ftp:
             ftp.login()
             ftp.dir()

     '230 Anonymous login ok, restrictions apply.'
     dr-xr-xr-x   9 ftp      ftp           154 May  6 10:43 .
     dr-xr-xr-x   9 ftp      ftp           154 May  6 10:43 ..
     dr-xr-xr-x   5 ftp      ftp          4096 May  6 10:43 CentOS
     dr-xr-xr-x   3 ftp      ftp            18 Jul 10  2008 Fedora

ちなみに *note mmap.mmap: 519. や *note fileinput.input(): a00. のような
ほかのファイルライクなオブジェクトも自動クローズするコンテキスト管理プロ
トコルをサポートするようになっていたりします:

     with fileinput.input(files=('log1.txt', 'log2.txt')) as f:
         for line in f:
             process(line)

(Contributed by Tarek Ziadé and Giampaolo Rodolà in bpo-4972(1), and by
Georg Brandl in bpo-8046(2) and bpo-1286(3).)

*note FTP_TLS: af7. クラスが 'context' パラメータを受け取れるようになり
ました。これには *note ssl.SSLContext: 357. オブジェクトを渡します。これ
は SSL コンフィグレーションオプション、証明書、秘密鍵を単一の (たぶん長
生きの) 構造にまとめあげてくれるものです。

(Contributed by Giampaolo Rodolà; bpo-8806(4).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=4972

   (2) https://bugs.python.org/issue?@action=redirect&bpo=8046

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1286

   (4) https://bugs.python.org/issue?@action=redirect&bpo=8806


File: python.info,  Node: popen,  Next: select<3>,  Prev: ftp,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.17 popen
...............

*note os.popen(): 31a. ならびに *note subprocess.Popen(): 4b7. 関数が自
動的にファイル記述子を閉じる *note with: 186. 文をサポートしました。

(Contributed by Antoine Pitrou and Brian Curtin in bpo-7461(1) and
bpo-10554(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=7461

   (2) https://bugs.python.org/issue?@action=redirect&bpo=10554


File: python.info,  Node: select<3>,  Next: gzip と zipfile,  Prev: popen,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.18 select
................

The *note select: c6. module now exposes a new, constant attribute,
*note PIPE_BUF: 1423, which gives the minimum number of bytes which are
guaranteed not to block when *note select.select(): fa0. says a pipe is
ready for writing.

     >>> import select
     >>> select.PIPE_BUF
     512

(Available on Unix systems.  Patch by Sébastien Sablé in bpo-9862(1))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9862


File: python.info,  Node: gzip と zipfile,  Next: tarfile<10>,  Prev: select<3>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.19 gzip と zipfile
.........................

*note gzip.GzipFile: 65c. が *note io.BufferedIOBase: 8a3. *note
抽象基底クラス: 13ce. を継承しました (‘truncate()’ をのぞく)。 *note
peek(): 1425. メソッドが追加され、シーク不能なファイルオブジェクトならび
にゼロ埋めされたファイルオブジェクトをサポートしました。

また、*note gzip: 6b. モジュールにより簡便でインメモリな圧縮および解凍を
行う *note compress(): 84e. ならびに *note decompress(): 1426. 関数が追
加されました。 圧縮や解凍の前に *note bytes: 192. としてエンコードしなけ
ればならない点に注意してください:

     >>> import gzip
     >>> s = 'Three shall be the number thou shalt count, '
     >>> s += 'and the number of the counting shall be three'
     >>> b = s.encode()                        # convert to utf-8
     >>> len(b)
     89
     >>> c = gzip.compress(b)
     >>> len(c)
     77
     >>> gzip.decompress(c).decode()[:42]      # decompress and convert to text
     'Three shall be the number thou shalt count'

(Contributed by Anand B. Pillai in bpo-3488(1); and by Antoine Pitrou,
Nir Aides and Brian Curtin in bpo-9962(2), bpo-1675951(3), bpo-7471(4)
and bpo-2846(5).)

Also, the *note zipfile.ZipExtFile: 65d. class was reworked internally
to represent files stored inside an archive.  The new implementation is
significantly faster and can be wrapped in an *note io.BufferedReader:
1427. object for more speedups.  It also solves an issue where
interleaved calls to 'read' and 'readline' gave the wrong results.

(Patch submitted by Nir Aides in bpo-7610(6).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=3488

   (2) https://bugs.python.org/issue?@action=redirect&bpo=9962

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1675951

   (4) https://bugs.python.org/issue?@action=redirect&bpo=7471

   (5) https://bugs.python.org/issue?@action=redirect&bpo=2846

   (6) https://bugs.python.org/issue?@action=redirect&bpo=7610


File: python.info,  Node: tarfile<10>,  Next: hashlib<7>,  Prev: gzip と zipfile,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.20 tarfile
.................

*note TarFile: 1429. クラスは今ではコンテキストマネージャとして使えます
。加えて、その *note add(): dee. メソッドに新しいオプション 'filter' が
追加されました。これはファイルをアーカイブに追加するかどうかを制御し、ま
た、ファイルのメタデータを編集するのにも使えます。

'filter' オプションは古くて柔軟性に欠ける 'exclude' パラメータを置き換え
るものであり、 'exclude' は非推奨となりました。 'filter' を指定する場合
は *note keyword argument: f0e. として渡さなければなりません。ユーザ指定
の filter 関数は *note TarInfo: 142a. オブジェクトを受け取り、更新した
*note TarInfo: 142a. オブジェクトを返すか、あるいはアーカイブから除外し
たければ ‘None’ を返してください。

     >>> import tarfile, glob

     >>> def myfilter(tarinfo):
     ...     if tarinfo.isfile():             # only save real files
     ...         tarinfo.uname = 'monty'      # redact the user name
     ...         return tarinfo

     >>> with tarfile.open(name='myarchive.tar.gz', mode='w:gz') as tf:
     ...     for filename in glob.glob('*.txt'):
     ...         tf.add(filename, filter=myfilter)
     ...     tf.list()
     -rw-r--r-- monty/501        902 2011-01-26 17:59:11 annotations.txt
     -rw-r--r-- monty/501        123 2011-01-26 17:59:11 general_questions.txt
     -rw-r--r-- monty/501       3514 2011-01-26 17:59:11 prion.txt
     -rw-r--r-- monty/501        124 2011-01-26 17:59:11 py_todo.txt
     -rw-r--r-- monty/501       1399 2011-01-26 17:59:11 semaphore_notes.txt

(Proposed by Tarek Ziadé and implemented by Lars Gustäbel in
bpo-6856(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=6856


File: python.info,  Node: hashlib<7>,  Next: ast<7>,  Prev: tarfile<10>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.21 hashlib
.................

*note hashlib: 6c. モジュールに、2 つの定数属性が追加されました。全ての
実装で利用可能であることが保障されているハッシュアルゴリズムのリストと、
現在の実装で利用可能なそれらリストの 2 つです:

     >>> import hashlib

     >>> hashlib.algorithms_guaranteed
     {'sha1', 'sha224', 'sha384', 'sha256', 'sha512', 'md5'}

     >>> hashlib.algorithms_available
     {'md2', 'SHA256', 'SHA512', 'dsaWithSHA', 'mdc2', 'SHA224', 'MD4', 'sha256',
     'sha512', 'ripemd160', 'SHA1', 'MDC2', 'SHA', 'SHA384', 'MD2',
     'ecdsa-with-SHA1','md4', 'md5', 'sha1', 'DSA-SHA', 'sha224',
     'dsaEncryption', 'DSA', 'RIPEMD160', 'sha', 'MD5', 'sha384'}

(Suggested by Carl Chenet in bpo-7418(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=7418


File: python.info,  Node: ast<7>,  Next: os<14>,  Prev: hashlib<7>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.22 ast
.............

*note ast: 9. モジュールには、Python リテラル構文を使った式文字列を安全
に評価できる、汎用目的の素晴らしい道具が含まれています。その *note
ast.literal_eval(): e12. 関数は、悪用されやすい組み込み関数 *note
eval(): 4a3. の安全な代替品として働いてくれます。Python 3.2 はこれのサポ
ート型に *note bytes: 192. と *note set: 184. を加えました。結果サポート
する型は全部でこれらになりました: 文字列型、バイト列文字列型、数値型、タ
プル型、リスト型、辞書型、集合型、真偽値型、‘None’。

     >>> from ast import literal_eval

     >>> request = "{'req': 3, 'func': 'pow', 'args': (2, 0.5)}"
     >>> literal_eval(request)
     {'args': (2, 0.5), 'req': 3, 'func': 'pow'}

     >>> request = "os.system('do something harmful')"
     >>> literal_eval(request)
     Traceback (most recent call last):
       ...
     ValueError: malformed node or string: <_ast.Call object at 0x101739a10>

(Implemented by Benjamin Peterson and Georg Brandl.)


File: python.info,  Node: os<14>,  Next: shutil<8>,  Prev: ast<7>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.23 os
............

ファイル名と環境変数に使われるエンコーディングは OS ごとに様々です。
*note os: a5. モジュールは新たに 2 つの関数 *note fsencode(): e4f. と
*note fsdecode(): e4e. を追加しました。それぞれファイル名のエンコード、
デコードを行います:

     >>> import os
     >>> filename = 'Sehenswürdigkeiten'
     >>> os.fsencode(filename)
     b'Sehensw\xc3\xbcrdigkeiten'

Some operating systems allow direct access to encoded bytes in the
environment.  If so, the *note os.supports_bytes_environ: 142e. constant
will be true.

エンコードされた環境変数への直接アクセス (可能な場合) には、新規関数
*note os.getenvb(): 142f. または *note os.environb: 25a. を使ってくださ
い。これは *note os.environ: 259. のバイト列バージョンです。

(Contributed by Victor Stinner.)


File: python.info,  Node: shutil<8>,  Next: sqlite3<12>,  Prev: os<14>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.24 shutil
................

*note shutil.copytree(): c1e. 関数に新たに 2 つのオプションが追加されま
した:

   * 'ignore_dangling_symlinks': ‘symlinks=False’ とするとこの関数は、フ
     ァイルがシンボリックリンクだった場合にリンクそのものではなくそれが
     指しているファイルをコピーします。 'ignore_dangling_symlinks' を真
     にすると、そのファイルが存在しない場合のエラーを無視します。

   * 'copy_function': これはファイルをコピーするのに使われる呼び出し可能
     オブジェクトです。デフォルトでは *note shutil.copy2(): c50. が使わ
     れます。

(Contributed by Tarek Ziadé.)

これらに加え、 *note shutil: ca. モジュールは ZIP ファイル、未圧縮の tar
ファイル、gzip 圧縮の tar、 bzip 圧縮の tar のための *note archiving
operations: 1431. を新たにサポートします。また、追加のアーカイブファイル
フォーマットを登録する関数もあります (例えば xz 圧縮の tar やカスタムフ
ォーマット)。

そのメインとなるのが *note make_archive(): 6da. と *note
unpack_archive(): 696. です。デフォルトではカレントディレクトリ (*note
os.chdir(): 821. で変えれます) とそのサブディレクトリの両方を処理します
。アーカイブファイル名はフルパス名で指定しなければなりません(訳注: これ
の真偽不明。リファレンスに対応する記述なし)。アーカイブするステップは非
破壊的です (つまりオリジナルのファイルは変更されずにそのままにされます
)。

     >>> import shutil, pprint

     >>> os.chdir('mydata')  # change to the source directory
     >>> f = shutil.make_archive('/var/backup/mydata',
     ...                         'zip')      # archive the current directory
     >>> f                                   # show the name of archive
     '/var/backup/mydata.zip'
     >>> os.chdir('tmp')                     # change to an unpacking
     >>> shutil.unpack_archive('/var/backup/mydata.zip')  # recover the data

     >>> pprint.pprint(shutil.get_archive_formats())  # display known formats
     [('bztar', "bzip2'ed tar-file"),
      ('gztar', "gzip'ed tar-file"),
      ('tar', 'uncompressed tar file'),
      ('zip', 'ZIP file')]

     >>> shutil.register_archive_format(     # register a new archive format
     ...     name='xz',
     ...     function=xz.compress,           # callable archiving function
     ...     extra_args=[('level', 8)],      # arguments to the function
     ...     description='xz compression'
     ... )

(Contributed by Tarek Ziadé.)


File: python.info,  Node: sqlite3<12>,  Next: html<3>,  Prev: shutil<8>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.25 sqlite3
.................

*note sqlite3: d4. モジュールが pysqlite バージョン 2.6.0 に更新されまし
た。これには 2 つの新機能があります。

   * The ‘sqlite3.Connection.in_transit’ attribute is true if there is
     an active transaction for uncommitted changes.

   * *note sqlite3.Connection.enable_load_extension(): a3f. メソッドと
     *note sqlite3.Connection.load_extension(): 6df. メソッドにより
     ".so" ファイルから SQLite 拡張をロードできます。良く知られた拡張の
     一つとして、SQLite と一緒に配布されている全文検索拡張があります。

(Contributed by R. David Murray and Shashwat Anand; bpo-8845(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=8845


File: python.info,  Node: html<3>,  Next: socket<12>,  Prev: sqlite3<12>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.26 html
..............

ただ一つの関数 *note escape(): 1210. が提供される、新しい *note html:
6f. モジュールが導入されました。これは HTML マークアップから予約されてい
る文字をエスケープするのに使います:

     >>> import html
     >>> html.escape('x > 2 && x < 7')
     'x &gt; 2 &amp;&amp; x &lt; 7'


File: python.info,  Node: socket<12>,  Next: ssl<13>,  Prev: html<3>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.27 socket
................

*note socket: d1. モジュールに新たに二つの改善がありました。

   * Socket objects now have a *note detach(): 1435. method which puts
     the socket into closed state without actually closing the
     underlying file descriptor.  The latter can then be reused for
     other purposes.  (Added by Antoine Pitrou; bpo-8524(1).)

   * *note socket.create_connection(): 882. がコンテキスト管理プロトコル
     をサポートするようになりました。with ブロックを抜ける際に無条件にソ
     ケットをクローズします (クローズ処理で発生する *note socket.error:
     1261. は無視されます)。 (Contributed by Giampaolo Rodolà;
     bpo-9794(2).)  (--訳注: リファレンスもそうなのですが、「 *note
     socket.create_connection(): 882. が with をサポート」というのは実態
     とは違うんじゃないかと思います(この関数のユーザからは同じにみえたと
     しても)。実際には *note socket.socket: fa1. がコンテキストマネージ
     ャをサポートしています。 socket.py(3) 参照。-)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=8524

   (2) https://bugs.python.org/issue?@action=redirect&bpo=9794

   (3) https://hg.python.org/cpython/file/3.2/Lib/socket.py


File: python.info,  Node: ssl<13>,  Next: nntp,  Prev: socket<12>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.28 ssl
.............

*note ssl: d5. モジュールは、セキュアな (暗号化され、認証された) インタ
ーネット接続のために共通の要求を満足するための数多くの機能を追加していま
す:

   * 新規クラス *note SSLContext: 357. は、プロトコル設定や証明書、秘密
     鍵やそのた色々なオプションのような、永続的 SSL データの容器として働
     きます。その中のメソッド *note wrap_socket(): 748. を使うと、 SSL コ
     ンテキストから SSL ソケットを作れます。

   * A new function, ‘ssl.match_hostname()’, supports server identity
     verification for higher-level protocols by implementing the rules
     of HTTPS (from RFC 2818(1)) which are also suitable for other
     protocols.

   * The *note ssl.wrap_socket(): 748. constructor function now takes a
     'ciphers' argument.  The 'ciphers' string lists the allowed
     encryption algorithms using the format described in the OpenSSL
     documentation(2).

   * 最新版の OpenSSL にリンクしていれば、 *note ssl: d5. モジュールは
     TLS プロトコルに対する Server Name Indication 拡張 (訳注: SNI, RFC
     4366(3)) をサポートします。これは単一の IP ポートで異なった証明書を
     使った複数「バーチャルホスト」をもたらすものです。この拡張はクライ
     アントモードでのみサポートされ、 *note
     ssl.SSLContext.wrap_socket(): 748. の 'server_hostname' を渡すこと
     で活性化されます。

   * *note ssl: d5. モジュールに色々オプションが追加されました。例えば
     *note OP_NO_SSLv2: a3a. は安全でなく時代遅れの SSLv2 を無効にします
     。

   * 拡張はOpenSSL の全ての暗号とメッセージダイジェストアルゴリズムをロ
     ードします。SSL 証明書の中に検証できないものがある場合、"unknown
     algorithm" エラーを報告します。

   * The version of OpenSSL being used is now accessible using the
     module attributes *note ssl.OPENSSL_VERSION: 1437. (a string),
     *note ssl.OPENSSL_VERSION_INFO: 1438. (a 5-tuple), and *note
     ssl.OPENSSL_VERSION_NUMBER: 1439. (an integer).

(Contributed by Antoine Pitrou in bpo-8850(4), bpo-1589(5), bpo-8322(6),
bpo-5639(7), bpo-4870(8), bpo-8484(9), and bpo-8321(10).)

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2818.html

   (2) https://docs.openssl.org/1.0.2/man1/ciphers/#cipher-list-format

   (3) https://datatracker.ietf.org/doc/html/rfc4366.html

   (4) https://bugs.python.org/issue?@action=redirect&bpo=8850

   (5) https://bugs.python.org/issue?@action=redirect&bpo=1589

   (6) https://bugs.python.org/issue?@action=redirect&bpo=8322

   (7) https://bugs.python.org/issue?@action=redirect&bpo=5639

   (8) https://bugs.python.org/issue?@action=redirect&bpo=4870

   (9) https://bugs.python.org/issue?@action=redirect&bpo=8484

   (10) https://bugs.python.org/issue?@action=redirect&bpo=8321


File: python.info,  Node: nntp,  Next: certificates,  Prev: ssl<13>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.29 nntp
..............

The ‘nntplib’ module has a revamped implementation with better bytes and
text semantics as well as more practical APIs.  These improvements break
compatibility with the nntplib version in Python 3.1, which was partly
dysfunctional in itself.

Support for secure connections through both implicit (using
‘nntplib.NNTP_SSL’) and explicit (using ‘nntplib.NNTP.starttls()’) TLS
has also been added.

(Contributed by Antoine Pitrou in bpo-9360(1) and Andrew Vant in
bpo-1926(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9360

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1926


File: python.info,  Node: certificates,  Next: imaplib<5>,  Prev: nntp,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.30 certificates
......................

*note http.client.HTTPSConnection: d36, *note
urllib.request.HTTPSHandler: 143c. *note urllib.request.urlopen(): 307.
はサーバ証明書を証明書認証局 (Certification Authority (CA)) セットと照合
するためのオプショナル引数を取るようになりました。これは HTTPS の公共利
用で推奨されるものです。(--訳注: これは 'check_hostname' パラメータのこ
とを指していますが、3.4.3 でこれの扱いが変わっているのでリファレンスを注
意深く読んで下さい。-)

(Added by Antoine Pitrou, bpo-9003(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9003


File: python.info,  Node: imaplib<5>,  Next: http client<4>,  Prev: certificates,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.31 imaplib
.................

標準 IMAP4 接続での明示的な TLS 使用を新規メソッド *note
imaplib.IMAP4.starttls: 143e. で出来るようになりました。

(Contributed by Lorenzo M. Catucci and Antoine Pitrou, bpo-4471(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=4471


File: python.info,  Node: http client<4>,  Next: unittest<12>,  Prev: imaplib<5>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.32 http.client
.....................

*note http.client: 73. モジュールに数多くの小さな API 改善がなされていま
す。旧式 HTTP 0.9 の単純な応答 (HTTP 0.9 simple responses) はもうサポー
トされず、また、 'strict' パラメータは全てのクラスで非推奨となりました。

*note HTTPConnection: d35. クラスと *note HTTPSConnection: d36. クラスが
'source_address' パラメータを取るようになりました。これには HTTP(S) 接続
の接続元を表す (host, port) のタプルを渡します。

*note HTTPSConnection: d36. に、証明書検証と HTTPS バーチャルホストのサ
ポートが追加されました。

接続オブジェクトの *note request(): ea7. メソッドのオプショナルな 'body'
引数には、リクエストのコンテンツを与えるために *note file object: 13db.
を渡すことが出来ました。便利のためにこれに *note iterable: 12f1. も渡す
ことが出来るようになりました。ただしこの場合は明示的に ‘Content-Length’
ヘッダを加えなければなりません。この拡張されたインターフェイスは以前より
も遥かに柔軟です。

プロキシサーバ経由で HTTPS 接続を確立するために、新規メソッド *note
set_tunnel(): 1440. が追加されています。これにより HTTP 接続トンネリング
のためのホストとポートをセットします。

*note http.server: 76. の振る舞いと合わせ、HTTP クライアントライブラリも
ヘッダを ISO-8859-1 (Latin-1) エンコーディングでエンコードするようになり
ました。これは既に incoming (外から来る方) ヘッダに対して行われています
が、今ではこの振る舞いは incoming、outgoing (外へ向かう方) トラフィック
の両方で一貫しています (bpo-10980(1) 内の Armin Ronacher による仕事を参
照)。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10980


File: python.info,  Node: unittest<12>,  Next: random<5>,  Prev: http client<4>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.33 unittest
..................

unittest モジュールに数多くの改善がありました。パッケージに対する test
discovery のサポートが追加され、対話プロンプトから実験しやすくなり、新し
いメソッドが追加され、テスト失敗時の診断メッセージが改善され、そしてメソ
ッド名がより良いものになりました。

   * The command-line call ‘python -m unittest’ can now accept file
     paths instead of module names for running specific tests
     (bpo-10620(1)).  The new test discovery can find tests within
     packages, locating any test importable from the top-level
     directory.  The top-level directory can be specified with the ‘-t’
     option, a pattern for matching files with ‘-p’, and a directory to
     start discovery with ‘-s’:

          $ python -m unittest discover -s my_proj_dir -p _test.py

     (Contributed by Michael Foord.)

   * Experimentation at the interactive prompt is now easier because the
     *note unittest.TestCase: 2b3. class can now be instantiated without
     arguments:

          >>> from unittest import TestCase
          >>> TestCase().assertEqual(pow(2, 3), 8)

     (Contributed by Michael Foord.)

   * *note unittest: 10c. モジュールは 2 つの新メソッド *note
     assertWarns(): 137c. と *note assertWarnsRegex(): 137d. を持ちます
     。これらはテストのもとでコードによって所与の警告が発行されるかどう
     かを検証します:

          with self.assertWarns(DeprecationWarning):
              legacy_function('XYZ')

     (Contributed by Antoine Pitrou, bpo-9754(2).)

     もう一つの新メソッド *note assertCountEqual(): 1442. は 2 つのイテ
     ラブルを比較して、要素の出現回数が同じか (順序に関わらず同じ要素が
     同じ数だけ出現するかどうか) をテストします:

          def test_anagram(self):
              self.assertCountEqual('algorithm', 'logarithm')

     (Contributed by Raymond Hettinger.)

   * unittest モジュールの大事な特長は、テスト失敗時の有意義な診断を生成
     するよう腐心してくれることです。可能ならば失敗は期待値と実際の出力
     との差分と一緒に記録されます。これは失敗したテスト実行の解析に特に
     役に立ちますが、差分は時々とてつもなく大きくもなりますので、新たに
     追加した属性 *note maxDiff: 1443. に差分の最大長をセットすることで
     表示を制御できるようになりました。

   * さらにモジュールのメソッド名に数多くのクリーンアップを行いました。

     For example, *note assertRegex(): 751. is the new name for
     ‘assertRegexpMatches()’ which was misnamed because the test uses
     *note re.search(): 1444, not *note re.match(): 1445.  Other methods
     using regular expressions are now named using short form "Regex" in
     preference to "Regexp" - this matches the names used in other
     unittest implementations, matches Python's old name for the *note
     re: be. module, and it has unambiguous camel-casing.

     (Contributed by Raymond Hettinger and implemented by Ezio Melotti.)

   * 一貫性を向上させるために、長年使用されたメソッドエイリアスが推奨名
     に対し非推奨になりました:

          以前の名前                          推奨名
                                              
          -----------------------------------------------------------------------
                                              
          ‘assert_()’                         *note assertTrue(): 74a.
                                              
                                              
          ‘assertEquals()’                    *note assertEqual(): 74c.
                                              
                                              
          ‘assertNotEquals()’                 *note assertNotEqual(): 74d.
                                              
                                              
          ‘assertAlmostEquals()’              *note assertAlmostEqual(): 74e.
                                              
                                              
          ‘assertNotAlmostEquals()’           *note assertNotAlmostEqual(): 74f.
                                              

     Likewise, the ‘TestCase.fail*’ methods deprecated in Python 3.1 are
     expected to be removed in Python 3.3.

     (Contributed by Ezio Melotti; bpo-9424(3).)

   * The ‘assertDictContainsSubset()’ method was deprecated because it
     was misimplemented with the arguments in the wrong order.  This
     created hard-to-debug optical illusions where tests like
     ‘TestCase().assertDictContainsSubset({'a':1, 'b':2}, {'a':1})’
     would fail.

     (Contributed by Raymond Hettinger.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10620

   (2) https://bugs.python.org/issue?@action=redirect&bpo=9754

   (3) https://bugs.python.org/issue?@action=redirect&bpo=9424


File: python.info,  Node: random<5>,  Next: poplib<4>,  Prev: unittest<12>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.34 random
................

*note random: bd. モジュールの整数メソッドの一様分布の生成が改善されまし
た。 以前は ‘int(n*random())’ を計算していました。 この方法では 'n' が
2の冪乗でない限り僅かにバイアスがあります。 現在の方法では次の2の冪乗の
範囲まで複数の選択肢を作成し、‘0 <= x < n’ の範囲に入ったもののみを保持
します。 影響を受ける関数やメソッドは *note randrange(): a6b.、*note
randint(): 1447.、*note choice(): 1448.、*note shuffle(): 94e. ならびに
*note sample(): 94d. です。

(Contributed by Raymond Hettinger; bpo-9025(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9025


File: python.info,  Node: poplib<4>,  Next: asyncore<2>,  Prev: random<5>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.35 poplib
................

*note POP3_SSL: b1e. クラスが 'context' パラメータを受け取れるようになり
ました。これには *note ssl.SSLContext: 357. オブジェクトを渡します。これ
は SSL コンフィグレーションオプション、証明書、秘密鍵を単一の (たぶん長
生きの) 構造にまとめあげてくれるものです。

(Contributed by Giampaolo Rodolà; bpo-8807(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=8807


File: python.info,  Node: asyncore<2>,  Next: tempfile<5>,  Prev: poplib<4>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.36 asyncore
..................

‘asyncore.dispatcher’ now provides a ‘handle_accepted()’ method
returning a ‘(sock, addr)’ pair which is called when a connection has
actually been established with a new remote endpoint.  This is supposed
to be used as a replacement for old ‘handle_accept()’ and avoids the
user to call ‘accept()’ directly.

(Contributed by Giampaolo Rodolà; bpo-6706(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=6706


File: python.info,  Node: tempfile<5>,  Next: inspect<11>,  Prev: asyncore<2>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.37 tempfile
..................

*note tempfile: e6. モジュールに新たなコンテキストマネージャ *note
TemporaryDirectory: 144c. が追加されました。一時ディレクトリの確実な後片
付けを容易に行えます:

     with tempfile.TemporaryDirectory() as tmpdirname:
         print('created temporary dir:', tmpdirname)

(Contributed by Neil Schemenauer and Nick Coghlan; bpo-5178(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5178


File: python.info,  Node: inspect<11>,  Next: pydoc<7>,  Prev: tempfile<5>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.38 inspect
.................

   * *note inspect: 82. モジュールに新たな関数 *note
     getgeneratorstate(): 144e. が追加されました。これで簡単にジェネレー
     タイテレータの現在状態を識別出来ます (--訳注: generator-iterator と
     いう用語を使っている箇所は Python ドキュメント全体通して多くはない
     のですが 2.x の *note yield 文: bc2. 説明中に登場します。ジェネレー
     タと同じ意味です。なお getgeneratorstate はジェネレータでないイテレ
     ータには使えません。--):

          >>> from inspect import getgeneratorstate
          >>> def gen():
          ...     yield 'demo'
          ...
          >>> g = gen()
          >>> getgeneratorstate(g)
          'GEN_CREATED'
          >>> next(g)
          'demo'
          >>> getgeneratorstate(g)
          'GEN_SUSPENDED'
          >>> next(g, None)
          >>> getgeneratorstate(g)
          'GEN_CLOSED'

     (Contributed by Rodolpho Eckhardt and Nick Coghlan, bpo-10220(1).)

   * 動的な属性を活性化することなく検索するのをサポートするために、
     *note inspect: 82. モジュールに *note getattr_static(): 6bc. 関数が
     追加されました。 *note hasattr(): 6f9. とは違ってこれは本当に読み出
     しのみの検索であり、検索中に状態変更しないことが保障されています:

          >>> class A:
          ...     @property
          ...     def f(self):
          ...         print('Running')
          ...         return 10
          ...
          >>> a = A()
          >>> getattr(a, 'f')
          Running
          10
          >>> inspect.getattr_static(a, 'f')
          <property object at 0x1022bd788>

     (Contributed by Michael Foord.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10220


File: python.info,  Node: pydoc<7>,  Next: dis<6>,  Prev: inspect<11>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.39 pydoc
...............

The *note pydoc: ba. module now provides a much-improved web server
interface, as well as a new command-line option ‘-b’ to automatically
open a browser window to display that server:

     $ pydoc3.2 -b

(Contributed by Ron Adam; bpo-2001(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=2001


File: python.info,  Node: dis<6>,  Next: dbm<7>,  Prev: pydoc<7>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.40 dis
.............

*note dis: 3c. モジュールに、コードを調べるための 2 つの新しい関数 *note
code_info(): 1451. と *note show_code(): 112f. が追加されました。ともに
、与えられた関数、メソッド、ソースコード文字列、コードオブジェクトについ
ての詳細なコードオブジェクト情報を提供します。前者はそれを文字列で返し、
後者は印字します:

     >>> import dis, random
     >>> dis.show_code(random.choice)
     Name:              choice
     Filename:          /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/random.py
     Argument count:    2
     Kw-only arguments: 0
     Number of locals:  3
     Stack size:        11
     Flags:             OPTIMIZED, NEWLOCALS, NOFREE
     Constants:
        0: 'Choose a random element from a non-empty sequence.'
        1: 'Cannot choose from an empty sequence'
     Names:
        0: _randbelow
        1: len
        2: ValueError
        3: IndexError
     Variable names:
        0: self
        1: seq
        2: i

また、 *note dis(): 205. 関数が文字列引数を取れるようになり、これによっ
て、よくあるイディオム ‘dis(compile(s, '', 'eval'))’ は ‘dis(s)’ で一撃
です:

     >>> dis('3*x+1 if x%2==1 else x//2')
       1           0 LOAD_NAME                0 (x)
                   3 LOAD_CONST               0 (2)
                   6 BINARY_MODULO
                   7 LOAD_CONST               1 (1)
                  10 COMPARE_OP               2 (==)
                  13 POP_JUMP_IF_FALSE       28
                  16 LOAD_CONST               2 (3)
                  19 LOAD_NAME                0 (x)
                  22 BINARY_MULTIPLY
                  23 LOAD_CONST               1 (1)
                  26 BINARY_ADD
                  27 RETURN_VALUE
             >>   28 LOAD_NAME                0 (x)
                  31 LOAD_CONST               0 (2)
                  34 BINARY_FLOOR_DIVIDE
                  35 RETURN_VALUE

要はこれらによって、CPython がどう実装されているか探索してみたり、言語構
文が裏方で何をするのか見てみたりすることがより簡単になったということです
。

(Contributed by Nick Coghlan in bpo-9147(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9147


File: python.info,  Node: dbm<7>,  Next: ctypes<4>,  Prev: dis<6>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.41 dbm
.............

All database modules now support the ‘get()’ and ‘setdefault()’ methods.

(Suggested by Ray Allen in bpo-9523(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9523


File: python.info,  Node: ctypes<4>,  Next: site<4>,  Prev: dbm<7>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.42 ctypes
................

C ‘ssize_t’ データ型を表現する新たな型 *note ctypes.c_ssize_t: 1454. が
追加されました。


File: python.info,  Node: site<4>,  Next: sysconfig<4>,  Prev: ctypes<4>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.43 site
..............

*note site: cc. モジュールに、Python インストレーションの詳細を報告する
のに有益な3つの新たな関数が追加されました。

   * *note getsitepackages(): 1456. は全てのグローバルな site-packages デ
     ィレクトリを一覧します。

   * *note getuserbase(): 1457. は、ユーザのデータを格納できるベースディ
     レクトリを報告します。

   * *note getusersitepackages(): 1458. はユーザ固有の site-packages デ
     ィレクトリのパスを明らかにします。

     >>> import site
     >>> site.getsitepackages()
     ['/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages',
      '/Library/Frameworks/Python.framework/Versions/3.2/lib/site-python',
      '/Library/Python/3.2/site-packages']
     >>> site.getuserbase()
     '/Users/raymondhettinger/Library/Python/3.2'
     >>> site.getusersitepackages()
     '/Users/raymondhettinger/Library/Python/3.2/lib/python/site-packages'

便宜のために、いくつかの site の機能はコマンドラインから直接アクセス可能
です:

     $ python -m site --user-base
     /Users/raymondhettinger/.local
     $ python -m site --user-site
     /Users/raymondhettinger/.local/lib/python3.2/site-packages

(Contributed by Tarek Ziadé in bpo-6693(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=6693


File: python.info,  Node: sysconfig<4>,  Next: pdb<10>,  Prev: site<4>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.44 sysconfig
...................

新しい *note sysconfig: e1. モジュールは、プラットフォームやインストレー
ションごとに変わるインストールパスや環境設定変数への、直接的なアクセスを
提供します。

このモジュールはプラットフォームとバージョンの情報へのシンプルなアクセス
関数を持っています:

   * *note get_platform(): 145a. は 'linux-i586' や 'macosx-10.6-ppc' と
     いった値を返します。

   * *note get_python_version(): 145b. は Python バージョンを文字列で
     "3.2" のように返します。

It also provides access to the paths and variables corresponding to one
of seven named schemes used by ‘distutils’.  Those include
'posix_prefix', 'posix_home', 'posix_user', 'nt', 'nt_user', 'os2',
'os2_home':

   * *note get_paths(): 340. は現在のインストールスキームに関するインス
     トールパスを含むディレクトリ名を作ります。

   * *note get_config_vars(): 298. はプラットフォーム依存変数の辞書を返
     します。

便利なコマンドラインインターフェースもあります:

     C:\Python32>python -m sysconfig
     Platform: "win32"
     Python version: "3.2"
     Current installation scheme: "nt"

     Paths:
             data = "C:\Python32"
             include = "C:\Python32\Include"
             platinclude = "C:\Python32\Include"
             platlib = "C:\Python32\Lib\site-packages"
             platstdlib = "C:\Python32\Lib"
             purelib = "C:\Python32\Lib\site-packages"
             scripts = "C:\Python32\Scripts"
             stdlib = "C:\Python32\Lib"

     Variables:
             BINDIR = "C:\Python32"
             BINLIBDEST = "C:\Python32\Lib"
             EXE = ".exe"
             INCLUDEPY = "C:\Python32\Include"
             LIBDEST = "C:\Python32\Lib"
             SO = ".pyd"
             VERSION = "32"
             abiflags = ""
             base = "C:\Python32"
             exec_prefix = "C:\Python32"
             platbase = "C:\Python32"
             prefix = "C:\Python32"
             projectbase = "C:\Python32"
             py_version = "3.2"
             py_version_nodot = "32"
             py_version_short = "3.2"
             srcdir = "C:\Python32"
             userbase = "C:\Documents and Settings\Raymond\Application Data\Python"

(Moved out of Distutils by Tarek Ziadé.)


File: python.info,  Node: pdb<10>,  Next: configparser<6>,  Prev: sysconfig<4>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.45 pdb
.............

*note pdb: aa. デバッガモジュールに数多くのユーザビリティの改善がなされ
ました:

   * ‘pdb.py’ は ‘-c’ オプションで指定した ‘.pdbrc’ スクリプトファイルを
     実行できるようになっています。

   * ‘.pdbrc’ スクリプトファイルにはデバッグを継続する ‘continue’ コマン
     ドと ‘next’ コマンドを含むことができます。

   * The *note Pdb: 273. class constructor now accepts a 'nosigint'
     argument.

   * 新コマンド: ‘l(list)’, ‘ll(long list)’, ‘source’ はソースコードを出
     力します。

   * 新コマンド: ‘display’, ‘undisplay’ は、変更があった場合の式の値の表
     示/非表示を切り替えます。

   * 新コマンド: ‘interact’ は現在のスコープで見つかったグローバルおよび
     ローカル名を含む対話型インタプリタを開始します。

   * ブレイクポイントをブレイクポイント番号指定でクリア出来ます。

(Contributed by Georg Brandl, Antonio Cuni and Ilya Sandler.)


File: python.info,  Node: configparser<6>,  Next: urllib parse<6>,  Prev: pdb<10>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.46 configparser
......................

The *note configparser: 26. module was modified to improve usability and
predictability of the default parser and its supported INI syntax.  The
old ‘ConfigParser’ class was removed in favor of ‘SafeConfigParser’
which has in turn been renamed to *note ConfigParser: 4de.  Support for
inline comments is now turned off by default and section or option
duplicates are not allowed in a single configuration source.

Config parsers はマッピングプロトコルにもとづく新しい API を獲得しました
:

     >>> parser = ConfigParser()
     >>> parser.read_string("""
     ... [DEFAULT]
     ... location = upper left
     ... visible = yes
     ... editable = no
     ... color = blue
     ...
     ... [main]
     ... title = Main Menu
     ... color = green
     ...
     ... [options]
     ... title = Options
     ... """)
     >>> parser['main']['color']
     'green'
     >>> parser['main']['editable']
     'no'
     >>> section = parser['options']
     >>> section['title']
     'Options'
     >>> section['title'] = 'Options (editable: %(editable)s)'
     >>> section['title']
     'Options (editable: no)'

新しい API は旧式 API の上に実装されているので、カスタムなパーサーサブク
ラスは変更なしで使えるはずです。

config parser によって受け付けられる INI ファイルの構造は今ではカスタマ
イズ出来ます。ユーザは、オプションと値を区切る代替のデリミタやコメントの
プレフィクスを指定でき、 'DEFAULT' セクションの名前を変えることができ、
あるいは補間の構文を切り替えられます。

抜き挿し可能 (pluggable) な補間サポートがあって、これには追加の補間ハン
ドラ *note ExtendedInterpolation: 92d. が含まれています:

     >>> parser = ConfigParser(interpolation=ExtendedInterpolation())
     >>> parser.read_dict({'buildout': {'directory': '/home/ambv/zope9'},
     ...                   'custom': {'prefix': '/usr/local'}})
     >>> parser.read_string("""
     ... [buildout]
     ... parts =
     ...   zope9
     ...   instance
     ... find-links =
     ...   ${buildout:directory}/downloads/dist
     ...
     ... [zope9]
     ... recipe = plone.recipe.zope9install
     ... location = /opt/zope
     ...
     ... [instance]
     ... recipe = plone.recipe.zope9instance
     ... zope9-location = ${zope9:location}
     ... zope-conf = ${custom:prefix}/etc/zope.conf
     ... """)
     >>> parser['buildout']['find-links']
     '\n/home/ambv/zope9/downloads/dist'
     >>> parser['instance']['zope-conf']
     '/usr/local/etc/zope.conf'
     >>> instance = parser['instance']
     >>> instance['zope-conf']
     '/usr/local/etc/zope.conf'
     >>> instance['zope9-location']
     '/opt/zope'

小さな機能もたくさん導入されています。例えば読み込み操作内でのエンコーデ
ィング指定のサポート、取得関数でのフォールバック値の指定、あるいは辞書や
文字列から直接的に読むことなどです。

(All changes contributed by Łukasz Langa.)


File: python.info,  Node: urllib parse<6>,  Next: mailbox,  Prev: configparser<6>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.47 urllib.parse
......................

数多くのユーザビリティーの改善が *note urllib.parse: 110. モジュールにな
されました。

*note urlparse(): 362. 関数が RFC 2732(1) にて記述されている IPv6(2) ア
ドレスをサポートするようになりました:

     >>> import urllib.parse
     >>> urllib.parse.urlparse('http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]/foo/')
     ParseResult(scheme='http',
                 netloc='[dead:beef:cafe:5417:affe:8FA3:deaf:feed]',
                 path='/foo/',
                 params='',
                 query='',
                 fragment='')

*note urldefrag(): 145f. 関数は、今や *note named tuple: 85e. を返します
:

     >>> r = urllib.parse.urldefrag('http://python.org/about/#target')
     >>> r
     DefragResult(url='http://python.org/about/', fragment='target')
     >>> r[0]
     'http://python.org/about/'
     >>> r.fragment
     'target'

また、 *note urlencode(): 1095. 関数はさらに柔軟になり、 'query' 引数と
しては文字列とバイト列のどちらも受け付けます。文字列で渡した場合、パラメ
ータ 'safe', 'encoding', 'error' がエンコードのために *note
quote_plus(): 1460. に送られます:

     >>> urllib.parse.urlencode([
     ...      ('type', 'telenovela'),
     ...      ('name', '¿Dónde Está Elisa?')],
     ...      encoding='latin-1')
     'type=telenovela&name=%BFD%F3nde+Est%E1+Elisa%3F'

*note ASCII エンコードバイト列の解析: 1461. に詳細に書きましたが、全ての
*note urllib.parse: 110. 関数は今では ASCII エンコードされたバイト文字列
を (通常の文字列と混ぜない限り) 入力として受け付けます。ASCII エンコード
されたバイト文字列がパラメータとして与えられると、戻り値の型も ASCII エ
ンコードされたバイト文字列になります:

     >>> urllib.parse.urlparse(b'http://www.python.org:80/about/')
     ParseResultBytes(scheme=b'http', netloc=b'www.python.org:80',
                      path=b'/about/', params=b'', query=b'', fragment=b'')

(Work by Nick Coghlan, Dan Mahn, and Senthil Kumaran in bpo-2987(3),
bpo-5468(4), and bpo-9873(5).)

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2732.html

   (2) https://ja.wikipedia.org/wiki/IPv6

   (3) https://bugs.python.org/issue?@action=redirect&bpo=2987

   (4) https://bugs.python.org/issue?@action=redirect&bpo=5468

   (5) https://bugs.python.org/issue?@action=redirect&bpo=9873


File: python.info,  Node: mailbox,  Next: turtledemo,  Prev: urllib parse<6>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.48 mailbox
.................

Thanks to a concerted effort by R. David Murray, the *note mailbox: 8f.
module has been fixed for Python 3.2.  The challenge was that mailbox
had been originally designed with a text interface, but email messages
are best represented with *note bytes: 192. because various parts of a
message may have different encodings.

解決のためには任意の email メッセージをパースするために、 *note email:
3f. パッケージのバイナリサポートが利用されました (--訳注: *note
BytesGenerator: 13e7. や *note message_from_bytes(): 13e1. など)。また、
API の変更も必要となりました。

*note mailbox.Mailbox: 1463. オブジェクトの *note add(): 1464. メソッド
は、今や期待通りにバイナリ入力を受け付けます。

*note StringIO: 112a. とテキストファイルでの入力は非推奨となりました。ま
た、文字列での入力は、非 ASCII 文字が使用されていると早々に失敗します。
以前は後のほうのステップで email が処理される際にようやく失敗していまし
た。

バイナリ出力のサポートもあります。 *note get_file(): 1465. メソッドは今
ではバイナリモードのファイルを返します (これまでは不適切にテキストモード
が使われていました)。また、新しい *note get_bytes(): 1466. メソッドは、
指定した 'key' に対応するメッセージの *note bytes: 192. 表現を返します。

今でも古い API の *note get_string(): 1467. を使って非バイナリ出力は可能
ですが、そのアプローチはあまり役に立ちません。そうではなく *note
Message: 1468. オブジェクトからメッセージを抽出するか、それらをバイナリ
入力からロードするのが最善です。

(Contributed by R. David Murray, with efforts from Steffen Daode
Nurpmeso and an initial patch by Victor Stinner in bpo-9124(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=9124


File: python.info,  Node: turtledemo,  Prev: mailbox,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール

1.13.9.49 turtledemo
....................

The demonstration code for the *note turtle: 107. module was moved from
the 'Demo' directory to main library.  It includes over a dozen sample
scripts with lively displays.  Being on *note sys.path: 3e4, it can now
be run directly from the command-line:

     $ python -m turtledemo

(Moved from the Demo directory by Alexander Belopolsky in bpo-10199(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10199


File: python.info,  Node: マルチスレッディング,  Next: 最適化<12>,  Prev: 新たなモジュール、改良されたモジュール、非推奨のモジュール,  Up: What's New In Python 3 2

1.13.10 マルチスレッディング
----------------------------

   * The mechanism for serializing execution of concurrently running
     Python threads (generally known as the *note GIL: 164. or Global
     Interpreter Lock) has been rewritten.  Among the objectives were
     more predictable switching intervals and reduced overhead due to
     lock contention and the number of ensuing system calls.  The notion
     of a "check interval" to allow thread switches has been abandoned
     and replaced by an absolute duration expressed in seconds.  This
     parameter is tunable through *note sys.setswitchinterval(): b44.
     It currently defaults to 5 milliseconds.

     この実装に関するさらなる詳細は python-dev mailing-list message(1) で
     読むことが出来ます (ただしこのメッセージで言っている "priority
     requests" は含められませんでした)。

     (Contributed by Antoine Pitrou.)

   * 通常のロックと再帰的なロックが、*note acquire(): 8a7. メソッドでオ
     プションで 'timeout' 引数を受け取るようになりました。 (Contributed
     by Antoine Pitrou; bpo-7316(2).)

   * 同様に、*note threading.Semaphore.acquire(): 146b. にも 'timeout' 引
     数が追加されました。 (Contributed by Torsten Landschoff;
     bpo-850728(3).)

   * 通常のロックと再帰的なロックの獲得に、 Pthreads を使用するプラット
     フォームでシグナルが割り込めるようになりました。これでロック獲得時
     にデッドロックしていた Python プログラムは、プロセスに SIGINT (ほと
     んどのシェルでは ‘Ctrl’+‘C’ で) を繰り返し送ることで殺せます。
     (Contributed by Reid Kleckner; bpo-8844(4).)

   ---------- Footnotes ----------

   (1) 
https://mail.python.org/pipermail/python-dev/2009-October/093321.html

   (2) https://bugs.python.org/issue?@action=redirect&bpo=7316

   (3) https://bugs.python.org/issue?@action=redirect&bpo=850728

   (4) https://bugs.python.org/issue?@action=redirect&bpo=8844


File: python.info,  Node: 最適化<12>,  Next: Unicode 文字列型,  Prev: マルチスレッディング,  Up: What's New In Python 3 2

1.13.11 最適化
--------------

小さな性能向上が多く追加されました:

   * Python's peephole optimizer now recognizes patterns such ‘x in {1,
     2, 3}’ as being a test for membership in a set of constants.  The
     optimizer recasts the *note set: 184. as a *note frozenset: 7f2.
     and stores the pre-built constant.

     Now that the speed penalty is gone, it is practical to start
     writing membership tests using set-notation.  This style is both
     semantically clear and operationally fast:

          extension = name.rpartition('.')[2]
          if extension in {'xml', 'html', 'xhtml', 'css'}:
              handle(name)

     (Patch and additional tests contributed by Dave Malcolm;
     bpo-6690(1)).

   * *note pickle: ab. モジュールを用いたデータのシリアライズ・デシリア
     ライズが数倍速くなりました。

     (Contributed by Alexandre Vassalotti, Antoine Pitrou and the
     Unladen Swallow team in bpo-9410(2) and bpo-3873(3).)

   * The Timsort algorithm(4) used in *note list.sort(): dc8. and *note
     sorted(): dc7. now runs faster and uses less memory when called
     with a *note key function: 1006.  Previously, every element of a
     list was wrapped with a temporary object that remembered the key
     value associated with each element.  Now, two arrays of keys and
     values are sorted in parallel.  This saves the memory consumed by
     the sort wrappers, and it saves time lost to delegating
     comparisons.

     (Patch by Daniel Stutzbach in bpo-9915(5).)

   * JSON decoding performance is improved and memory consumption is
     reduced whenever the same string is repeated for multiple keys.
     Also, JSON encoding now uses the C speedups when the ‘sort_keys’
     argument is true.

     (Contributed by Antoine Pitrou in bpo-7451(6) and by Raymond
     Hettinger and Antoine Pitrou in bpo-10314(7).)

   * 再帰的ロック (*note threading.RLock(): 32e. API により生成) は C で
     実装されたことにより、以前の純粋な Python 実装より10から15倍速くな
     り、通常のロックと同じくらいになりました。

     (Contributed by Antoine Pitrou; bpo-3001(8).)

   * The fast-search algorithm in stringlib is now used by the *note
     split(): 10aa, *note rsplit(): 146d, *note splitlines(): 146e. and
     *note replace(): 4b8. methods on *note bytes: 192, *note bytearray:
     344. and *note str: 169. objects.  Likewise, the algorithm is also
     used by *note rfind(): 10a9, *note rindex(): 146f, *note rsplit():
     146d. and *note rpartition(): 1470.

     (Patch by Florent Xicluna in bpo-7622(9) and bpo-7462(10).)

   * Integer to string conversions now work two "digits" at a time,
     reducing the number of division and modulo operations.

     (bpo-6713(11) by Gawain Bolton, Mark Dickinson, and Victor
     Stinner.)

There were several other minor optimizations.  Set differencing now runs
faster when one operand is much larger than the other (patch by Andress
Bennetts in bpo-8685(12)).  The ‘array.repeat()’ method has a faster
implementation (bpo-1569291(13) by Alexander Belopolsky).  The *note
BaseHTTPRequestHandler: 12e2. has more efficient buffering (bpo-3709(14)
by Andrew Schaaf).  The *note operator.attrgetter(): 1033. function has
been sped-up (bpo-10160(15) by Christos Georgiou).  And *note
ConfigParser: 4de. loads multi-line arguments a bit faster (bpo-7113(16)
by Łukasz Langa).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=6690

   (2) https://bugs.python.org/issue?@action=redirect&bpo=9410

   (3) https://bugs.python.org/issue?@action=redirect&bpo=3873

   (4) https://en.wikipedia.org/wiki/Timsort

   (5) https://bugs.python.org/issue?@action=redirect&bpo=9915

   (6) https://bugs.python.org/issue?@action=redirect&bpo=7451

   (7) https://bugs.python.org/issue?@action=redirect&bpo=10314

   (8) https://bugs.python.org/issue?@action=redirect&bpo=3001

   (9) https://bugs.python.org/issue?@action=redirect&bpo=7622

   (10) https://bugs.python.org/issue?@action=redirect&bpo=7462

   (11) https://bugs.python.org/issue?@action=redirect&bpo=6713

   (12) https://bugs.python.org/issue?@action=redirect&bpo=8685

   (13) https://bugs.python.org/issue?@action=redirect&bpo=1569291

   (14) https://bugs.python.org/issue?@action=redirect&bpo=3709

   (15) https://bugs.python.org/issue?@action=redirect&bpo=10160

   (16) https://bugs.python.org/issue?@action=redirect&bpo=7113


File: python.info,  Node: Unicode 文字列型,  Next: Codecs,  Prev: 最適化<12>,  Up: What's New In Python 3 2

1.13.12 Unicode 文字列型
------------------------

Python has been updated to Unicode 6.0.0(1).  The update to the standard
adds over 2,000 new characters including emoji(2) symbols which are
important for mobile phones.

In addition, the updated standard has altered the character properties
for two Kannada characters (U+0CF1, U+0CF2) and one New Tai Lue numeric
character (U+19DA), making the former eligible for use in identifiers
while disqualifying the latter.  For more information, see Unicode
Character Database Changes(3).

   ---------- Footnotes ----------

   (1) https://unicode.org/versions/Unicode6.0.0/

   (2) https://en.wikipedia.org/wiki/Emoji

   (3) https://www.unicode.org/versions/Unicode6.0.0/#Database_Changes


File: python.info,  Node: Codecs,  Next: ドキュメント,  Prev: Unicode 文字列型,  Up: What's New In Python 3 2

1.13.13 Codecs
--------------

'cp720' アラビア DOS エンコードがサポートされました (bpo-1616979(1))。

MBCS エンコーディングはもうエラーハンドラ引数を無視することはありません
。デフォルトの strict モードでは、デコード出来ないバイト列に対して *note
UnicodeDecodeError: c08. を、エンコードできない文字に対して *note
UnicodeEncodeError: 887. を投げます。

MBCS コーデックはエラーハンドラとして、デコードでの ‘'strict'’ と
‘'ignore'’ 、エンコードでの ‘'strict'’ と ‘'replace'’ をサポートします。

Python 3.1 での MBCS エンコーディングを模擬したければデコードでは
‘'ignore'’ ハンドラを、エンコードでは ‘'replace'’ ハンドラを選んでくださ
い。

Mac OS X では Python は、コマンドライン引数をロケールのエンコーディング
ではなく ‘'utf-8'’ でデコードします。

*note tarfile: e4. はデフォルトで、Windows では (‘'mbcs'’ ではなく)
‘'utf-8'’ エンコーディングを使い、また、全ての OS でエラーハンドラ
‘'surrogateescape'’ を使います。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1616979


File: python.info,  Node: ドキュメント,  Next: IDLE,  Prev: Codecs,  Up: What's New In Python 3 2

1.13.14 ドキュメント
--------------------

ドキュメントの改善が引き続き行われています。

   * *note 組み込み関数: 1474. のような長大なセクションには先頭にクイッ
     クリンクの表が追加されました。 *note itertools: 85. のようなケース
     では cheatsheet(1) スタイルの表からリンクが張られていて、これで要約
     がわかりますし、ドキュメント全体を読む必要なく記憶を呼び覚ますこと
     が出来ます。

   * ある種のケースではピュア Python のソースコードが文書化の助手として
     便利に働いてくれますので、今では多くのモジュールがソースコードの最
     新バージョンへのクイックリンクを客演させています。例えば *note
     functools: 63. モジュールのドキュメントは先頭にこのようにクイックリ
     ンクを置いています:

          'ソースコード' Lib/functools.py(2).

     (Contributed by Raymond Hettinger; see rationale(3).)

   * ドキュメントには今ではもっと実例とレシピが含まれています。特に
     *note re: be. モジュールのものには大掛かりなセクション *note
     正規表現の例: 1475. があります。同じように *note itertools: 85. で
     は新しい *note Itertools レシピ: 1476. で更新され続けます。

   * *note datetime: 34. モジュールは今ではピュア Python による補助実装
     を持っています。機能に違いはありません。これは読みやすい代替の実装
     を提供するだけのものです。

     (Contributed by Alexander Belopolsky in bpo-9528(4).)

   * 保守されていなかった ‘Demo’ ディレクトリは削除されました。いくつか
     のデモはドキュメントに統合され、いくつかは ‘Tools/demo’ ディレクト
     リに移動し、ほかのものは一緒に削除されました。

     (Contributed by Georg Brandl in bpo-7962(5).)

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Cheat_sheet

   (2) https://github.com/python/cpython/tree/3.14/Lib/functools.py

   (3) 
https://rhettinger.wordpress.com/2011/01/28/open-your-source-more/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=9528

   (5) https://bugs.python.org/issue?@action=redirect&bpo=7962


File: python.info,  Node: IDLE,  Next: コードリポジトリ,  Prev: ドキュメント,  Up: What's New In Python 3 2

1.13.15 IDLE
------------

   * IDLE のフォーマットメニューに、ソースコードから末尾の空白を取り除く
     ことが出来るオプションが追加されました。

     (Contributed by Raymond Hettinger; bpo-5150(1).)

   * Mac OS X 上の IDLE が Carbon AquaTk と Cocoa AquaTk の両方で動くよ
     うになりました。

     (Contributed by Kevin Walzer, Ned Deily, and Ronald Oussoren;
     bpo-6075(2).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5150

   (2) https://bugs.python.org/issue?@action=redirect&bpo=6075


File: python.info,  Node: コードリポジトリ,  Next: ビルドならびに C API の変更<5>,  Prev: IDLE,  Up: What's New In Python 3 2

1.13.16 コードリポジトリ
------------------------

In addition to the existing Subversion code repository at
‘https://svn.python.org’ there is now a Mercurial(1) repository at
‘https://hg.python.org/’.

3.2 のリリース後に、主要なリポジトリを Mercurial に移行する計画がありま
す。 この分散バージョン管理システムによってコミュニティメンバが容易に外
部 changeset を作成したり共有したりすることが出来ます。 詳細は PEP
385(2) を参照してください。

To learn to use the new version control system, see the Quick Start(3)
or the Guide to Mercurial Workflows(4).

   ---------- Footnotes ----------

   (1) https://www.mercurial-scm.org/

   (2) https://peps.python.org/pep-0385/

   (3) https://www.mercurial-scm.org/wiki/QuickStart

   (4) https://www.mercurial-scm.org/guide


File: python.info,  Node: ビルドならびに C API の変更<5>,  Next: Python 3 2 への移植,  Prev: コードリポジトリ,  Up: What's New In Python 3 2

1.13.17 ビルドならびに C API の変更
-----------------------------------

Python のビルド過程と C API の変更は以下の通りです:

   * スクリプト 'idle', 'pydoc', '2to3' が ‘make altinstall’ 時にバージ
     ョン固有のサフィックスを付けてインストールされるようになりました
     (bpo-10679(1))。

   * Unicode データベースにアクセスする関数 (Py_UNICODE_TOLOWER,
     Py_UNICODE_ISDECIMAL, ほか) が、たとえ narrow Unicode ビルドであっ
     ても full Unicode 範囲を受け付け、返すようになりました。Python から
     目に見える違いとしては、大きなコードポイントについて *note
     unicodedata.numeric(): 147a. が正しい値を返し、 *note repr(): 1c1.
     はより多くの文字を表示可能と考えるようになりました。

     (Reported by Bupjoe Lee and fixed by Amaury Forgeot D'Arc;
     bpo-5127(2).)

   * Computed gotos are now enabled by default on supported compilers
     (which are detected by the configure script).  They can still be
     disabled selectively by specifying ‘--without-computed-gotos’.

     (Contributed by Antoine Pitrou; bpo-9203(3).)

   * オプション ‘--with-wctype-functions’ は削除されました。今では組み込
     みの Unicode データベースが全ての関数のために使われます。

     (Contributed by Amaury Forgeot D'Arc; bpo-9210(4).)

   * ハッシュ値として新しい型 *note Py_hash_t: 147b. を使うようになりま
     した。これはポインタと同じサイズになるように定義されています。以前
     は long 型を使っていましたが、これはいくつかの 64 ビット OS でも 32
     ビット長のままでした。この修正の結果、64 ビットポインタでビルドすれ
     ば *note set: 184. と *note dict: 183. が ‘2**32’ 以上のエントリを
     持てるようになりました (以前もそのサイズを入れることは出来ましたが
     、悲劇的なパフォーマンス低下を起こしていました)。

     (Suggested by Raymond Hettinger and implemented by Benjamin
     Peterson; bpo-9778(5).)

   * A new macro ‘Py_VA_COPY’ copies the state of the variable argument
     list.  It is equivalent to C99 'va_copy' but available on all
     Python platforms (bpo-2443(6)).

   * A new C API function ‘PySys_SetArgvEx()’ allows an embedded
     interpreter to set *note sys.argv: 147c. without also modifying
     *note sys.path: 3e4. (bpo-5753(7)).

   * ‘PyEval_CallObject()’ is now only available in macro form.  The
     function declaration, which was kept for backwards compatibility
     reasons, is now removed - the macro was introduced in 1997
     (bpo-8276(8)).

   * *note PyLong_AsLongAndOverflow(): 147d. の姉妹品の *note
     PyLong_AsLongLongAndOverflow(): 147e. 関数が追加されました。両方と
     も Python *note int: 19b. を C ネイティブの固定幅型に変換しますが、
     変換が幅に合わないことを検出します (bpo-7767(9))。

   * *note PyUnicode_CompareWithASCIIString(): 147f. 関数が、Python 文字
     列が 'NUL' 終端である場合に「 '等しくない' 」を返すようになりました
     。

   * 新しい関数 *note PyErr_NewExceptionWithDoc(): 1480. は *note
     PyErr_NewException(): 1481. と似ていますが、ドキュメンテーション文
     字列を受け付けます。これは C 拡張に、対応するピュア Python と同じ自
     己文書化 (self-documenting) 能力を与えます (bpo-7033(10))。

   * ‘--with-valgrind’ オプションとともにコンパイル時、 Valgrind のもと
     での実行時に自動的に pymalloc アロケータが無効になるようになりまし
     た。ほかの状況では pymalloc は有利ですが、Valgrind 配下での実行時の
     メモリリーク検出では無効化したほうが良い結果が得られます
     (bpo-2422(11))。

   * 'PyArg_Parse' 関数から書式文字列 ‘O?’ が削除されました。これはもう
     使われていませんし、今まで一度も文書化されたことはありません
     (bpo-8837(12))。

There were a number of other small changes to the C-API. See the
Misc/NEWS(13) file for a complete list.

Also, there were a number of updates to the Mac OS X build, see
Mac/BuildScript/README.txt(14) for details.  For users running a
32/64-bit build, there is a known problem with the default Tcl/Tk on Mac
OS X 10.6.  Accordingly, we recommend installing an updated alternative
such as ActiveState Tcl/Tk 8.5.9(15).  See
‘https://www.python.org/download/mac/tcltk/’ for additional details.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10679

   (2) https://bugs.python.org/issue?@action=redirect&bpo=5127

   (3) https://bugs.python.org/issue?@action=redirect&bpo=9203

   (4) https://bugs.python.org/issue?@action=redirect&bpo=9210

   (5) https://bugs.python.org/issue?@action=redirect&bpo=9778

   (6) https://bugs.python.org/issue?@action=redirect&bpo=2443

   (7) https://bugs.python.org/issue?@action=redirect&bpo=5753

   (8) https://bugs.python.org/issue?@action=redirect&bpo=8276

   (9) https://bugs.python.org/issue?@action=redirect&bpo=7767

   (10) https://bugs.python.org/issue?@action=redirect&bpo=7033

   (11) https://bugs.python.org/issue?@action=redirect&bpo=2422

   (12) https://bugs.python.org/issue?@action=redirect&bpo=8837

   (13) https://github.com/python/cpython/blob/v3.2.6/Misc/NEWS

   (14) 
https://github.com/python/cpython/blob/v3.2.6/Mac/BuildScript/README.txt

   (15) 
https://web.archive.org/web/20101208191259/https://www.activestate.com/activetcl/downloads


File: python.info,  Node: Python 3 2 への移植,  Prev: ビルドならびに C API の変更<5>,  Up: What's New In Python 3 2

1.13.18 Python 3.2 への移植
---------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

   * The *note configparser: 26. module has a number of clean-ups.  The
     major change is to replace the old ‘ConfigParser’ class with
     long-standing preferred alternative ‘SafeConfigParser’.  In
     addition there are a number of smaller incompatibilities:

        * 補間 (interpolation) の構文は今では *note get(): 1483. と
          *note set(): 1484. の操作で検証されます。デフォルトの補間スキ
          ームでは、パーセント記号を使ったただ二つのトークンのみが正当で
          す: ‘%(name)s’ と ‘%%’ 、後者はエスケープされたパーセント記号
          自身。

        * *note set(): 1484. メソッドと *note add_section(): 1485. メソ
          ッドは今ではその値が実際に文字列かどうかを検証します。以前はサ
          ポートされない型が意図せず持ち込まれる可能性がありました。

        * 単一ソースからのセクションまたはオプションの複製 (重複) に対し
          、今では *note DuplicateSectionError: 1486. もしくは *note
          DuplicateOptionError: 1487. を投げます。以前は重複は黙って以前
          のエントリを上書きしていました。

        * インラインコメントは今ではデフォルトで無効なので、 ';' 文字を
          安全に値のなかで使えます。

        * コメントを字下げ出来るようになっています。このことにより、値が
          継続行となる場合の後続行の字下げ開始位置に ';' または '#' を置
          くには、補間を使う必要があります。こうすればコメントのプレフィ
          クス文字が値内に現れて誤ってコメントと解釈されるのを防げます。

        * ‘""’ は今では合法な値なので、もはや自動的に空文字列に変換され
          ることはありません。空文字列のためには行内で ‘"option ="’ と書
          いてください。

   * The ‘nntplib’ module was reworked extensively, meaning that its
     APIs are often incompatible with the 3.1 APIs.

   * *note bytearray: 344. オブジェクトはもうファイル名には使えません。
     代わりに *note bytes: 192. に変換しなければいけません。

   * The ‘array.tostring()’ and ‘array.fromstring()’ have been renamed
     to *note array.tobytes(): 1488. and *note array.frombytes(): 1489.
     for clarity.  The old names have been deprecated.  (See
     bpo-8990(1).)

   * ‘PyArg_Parse*()’ 系関数:

        * 書式文字列 "t#" の削除: 代わりに "s#" もしくは "s*" を使ってく
          ださい。

        * 書式文字列 "w" および "w#" の削除: 代わりに "w*" を使ってくだ
          さい。

   * The ‘PyCObject’ type, deprecated in 3.1, has been removed.  To wrap
     opaque C pointers in Python objects, the *note PyCapsule: 148a. API
     should be used instead; the new type has a well-defined interface
     for passing typing safety information and a less complicated
     signature for calling a destructor.

   * The ‘sys.setfilesystemencoding()’ function was removed because it
     had a flawed design.

   * *note random.seed(): 148b. 関数とメソッドが、salt に文字列やバイト
     列を与えた場合に内部で sha512 ハッシュ関数を使うようになりました。
     Python 3.1 シーケンスを再現するのに以前のバージョンの 'seed' が必要
     であれば、 'version' 引数を '1' にしてください。 ‘random.seed(s,
     version=1)’ のように。

   * The previously deprecated ‘string.maketrans()’ function has been
     removed in favor of the static methods *note bytes.maketrans():
     148c. and *note bytearray.maketrans(): 148d.  This change solves
     the confusion around which types were supported by the *note
     string: d8. module.  Now, *note str: 169, *note bytes: 192, and
     *note bytearray: 344. each have their own 'maketrans' and
     'translate' methods with intermediate translation tables of the
     appropriate type.

     (Contributed by Georg Brandl; bpo-5675(2).)

   * The previously deprecated ‘contextlib.nested()’ function has been
     removed in favor of a plain *note with: 186. statement which can
     accept multiple context managers.  The latter technique is faster
     (because it is built-in), and it does a better job finalizing
     multiple context managers when one of them raises an exception:

          with open('mylog.txt') as infile, open('a.out', 'w') as outfile:
              for line in infile:
                  if '<critical>' in line:
                      outfile.write(line)

     (Georg Brandl と Mattias Brändström の貢献; appspot issue
     53094(3).)

   * *note struct.pack(): 148e. は、文字列パックコード ‘s’ で bytes のみ
     を許容するようになりました。以前はテキスト引数を受け取って暗黙に
     UTF-8 でエンコードして bytes に変換していました。特定のエンコーディ
     ングを前提にするのは間違っていますし、可変長のエンコーディングは構
     造体の固定長セグメントへの書き込みで失敗しうるので、これは問題でし
     た。

     例えば ‘struct.pack('<6sHHBBB', 'GIF87a', x, y)’ としているならば、
     テキストではなく bytes を使うように ‘struct.pack('<6sHHBBB',
     b'GIF87a', x, y)’ と書き換えなければなりません。

     (Discovered by David Beazley and fixed by Victor Stinner;
     bpo-10783(4).)

   * パース失敗時に *note xml.etree.ElementTree: 12b. クラスが *note
     xml.etree.ElementTree.ParseError: 148f. を投げるようになりました。
     以前は *note xml.parsers.expat.ExpatError: 1490. を投げていました。

   * 浮動小数点数と複素数に対する *note str(): 169. が以前より長い表現を
     するようになったことで、古いフォーマットに依存する doctest は壊れる
     かもしれません。

   * *note subprocess.Popen: 4b7. の 'close_fds' のデフォルトが、Unix で
     は ‘True’ になりました。Windows では 3 つの標準ストリームに ‘None’
     がセットされている場合には ‘True’ 、以外の場合は ‘False’ になりまし
     た。以前は 'close_fds' のデフォルトはいつでも ‘False’ でした。これ
     は開いているファイル記述子が子プロセスに漏れた場合に解決が難しいバ
     グや競合状態を生み出していました。

   * レガシーな HTTP 0.9 のサポートが *note urllib.request: 111. と
     *note http.client: 73. から削除されました。このサポートはサーバサイ
     ドではまだ健在です (*note http.server: 76. 内)。

     (Contributed by Antoine Pitrou, bpo-10711(5).)

   * タイムアウトモード時の SSL ソケットでタイムアウトした場合に、汎用の
     *note SSLError: 1491. ではなく *note socket.timeout: a35. を投げる
     ようになりました。

     (Contributed by Antoine Pitrou, bpo-10272(6).)

   * The misleading functions ‘PyEval_AcquireLock()’ and
     ‘PyEval_ReleaseLock()’ have been officially deprecated.  The
     thread-state aware APIs (such as *note PyEval_SaveThread(): 647.
     and *note PyEval_RestoreThread(): 648.) should be used instead.

   * Due to security risks, ‘asyncore.handle_accept()’ has been
     deprecated, and a new function, ‘asyncore.handle_accepted()’, was
     added to replace it.

     (Contributed by Giampaolo Rodola in bpo-6706(7).)

   * Due to the new *note GIL: 164. implementation,
     ‘PyEval_InitThreads()’ cannot be called before *note
     Py_Initialize(): 460. anymore.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=8990

   (2) https://bugs.python.org/issue?@action=redirect&bpo=5675

   (3) https://codereview.appspot.com/53094

   (4) https://bugs.python.org/issue?@action=redirect&bpo=10783

   (5) https://bugs.python.org/issue?@action=redirect&bpo=10711

   (6) https://bugs.python.org/issue?@action=redirect&bpo=10272

   (7) https://bugs.python.org/issue?@action=redirect&bpo=6706


File: python.info,  Node: What's New In Python 3 1,  Next: What's New In Python 3 0,  Prev: What's New In Python 3 2,  Up: What's New in Python

1.14 What's New In Python 3.1
=============================


著者: Raymond Hettinger

This article explains the new features in Python 3.1, compared to 3.0.
Python 3.1 was released on June 27, 2009.

* Menu:

* PEP 372; 順序付き辞書: PEP 372 順序付き辞書.
* PEP 378; 1000区切りのための書式指定子: PEP 378 1000区切りのための書式指定子.
* その他の言語変更: その他の言語変更<13>.
* 新たなモジュール、改良されたモジュール、非推奨のモジュール: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>.
* 最適化: 最適化<13>.
* IDLE: IDLE<2>.
* ビルドならびに C API の変更: ビルドならびに C API の変更<6>.
* Python 3.1 への移植: Python 3 1 への移植.


File: python.info,  Node: PEP 372 順序付き辞書,  Next: PEP 378 1000区切りのための書式指定子,  Up: What's New In Python 3 1

1.14.1 PEP 372: 順序付き辞書
----------------------------

通常の Python 辞書は、 key/value ペアを不定の順序でイテレートします。何
年にもわたり、いろいろな人が key の挿入順を保存する辞書の別実装を書いて
きました。その経験に基づき、新しい *note OrderedDict: 7f3. クラスが導入
されました。

OrderedDict API は通常の辞書と同じインターフェースを提供していますが、
key/value をイテレートするときに key が最初に挿入された順番になることが
保証されています。新しいエントリが既存のエントリを上書きした場合は、元の
挿入順序が保持されます。エントリを削除して再挿入すると、順序は一番最後に
移動します。

標準ライブラリのいくつかのモジュールで、順序付き辞書の利用がサポートされ
ています。*note configparser: 26. モジュールはデフォルトで順序付き辞書を
使います。設定ファイルを読み込み、編集した後、元の順序で書きなおすことが
できます。*note collections.namedtuple(): 4e0. の '_asdict()' メソッドは
、タプルの順序と同じ順序の順序付き辞書を返すようになりました。*note
json: 86. モジュールのデコーダーが OrderedDict をビルドするのをサポート
するために、 *note JSONDecoder: f43. クラスのコンストラクタに
'object_pairs_hook' 引数が追加されました。 PyYAML(1) などの外部のライブ
ラリでもサポートされています。

参考
....

PEP 372(2) - 順序付き辞書

     PEP written by Armin Ronacher and Raymond Hettinger.
     Implementation written by Raymond Hettinger.

順序付き辞書は挿入順序を記憶するので、ソートと組み合わせて使うことで、ソ
ートされた辞書を作れます:

     >>> # regular unsorted dictionary
     >>> d = {'banana': 3, 'apple':4, 'pear': 1, 'orange': 2}

     >>> # dictionary sorted by key
     >>> OrderedDict(sorted(d.items(), key=lambda t: t[0]))
     OrderedDict([('apple', 4), ('banana', 3), ('orange', 2), ('pear', 1)])

     >>> # dictionary sorted by value
     >>> OrderedDict(sorted(d.items(), key=lambda t: t[1]))
     OrderedDict([('pear', 1), ('orange', 2), ('banana', 3), ('apple', 4)])

     >>> # dictionary sorted by length of the key string
     >>> OrderedDict(sorted(d.items(), key=lambda t: len(t[0])))
     OrderedDict([('pear', 1), ('apple', 4), ('orange', 2), ('banana', 3)])

この新しい順序付き辞書は、項目が削除されてもソートされた順序を保持します
。しかし、キーが追加されるとき、そのキーは最後に追加され、ソートは保持さ
れません。

   ---------- Footnotes ----------

   (1) https://pyyaml.org/

   (2) https://peps.python.org/pep-0372/


File: python.info,  Node: PEP 378 1000区切りのための書式指定子,  Next: その他の言語変更<13>,  Prev: PEP 372 順序付き辞書,  Up: What's New In Python 3 1

1.14.2 PEP 378: 1000区切りのための書式指定子
--------------------------------------------

組み込みの *note format(): 199. 関数と *note str.format(): 833. メソッド
が使うミニ言語に、単純でロケールに依存しない 1000 区切りカンマの書式化が
追加されました。これによって簡単にプログラムの出力を、その玄人ちっくな見
た目を改善してひとさまにとって読みやすいものに出来ます:

     >>> format(1234567, ',d')
     '1,234,567'
     >>> format(1234567.89, ',.2f')
     '1,234,567.89'
     >>> format(12345.6 + 8901234.12j, ',f')
     '12,345.600000+8,901,234.120000j'
     >>> format(Decimal('1234567.89'), ',f')
     '1,234,567.89'

これをサポートする型は *note int: 19b, *note float: 196, *note complex:
197. , *note decimal.Decimal: 1fe. です。

ドットやら空白やらアポストロフィやらあるいはアンダースコアなどの他のセパ
レータをどうやって指定するかの議論は水面下にありますが、ロケールに従う必
要があるアプリケーションは、1000区切りセパレータについていくつかのサポー
トを既に持っている既存の 'n' 指定子を使うべきです。

参考
....

PEP 378(1) - 1000区切りのための書式指定子

     PEP written by Raymond Hettinger and implemented by Eric Smith and
     Mark Dickinson.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0378/


File: python.info,  Node: その他の言語変更<13>,  Next: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>,  Prev: PEP 378 1000区切りのための書式指定子,  Up: What's New In Python 3 1

1.14.3 その他の言語変更
-----------------------

Python 言語コアに小さな変更がいくつか行われました:

   * ‘__main__.py’ を含むディレクトと zip アーカイブを、その名前をインタ
     プリタに渡すことで直接実行出来るようになりました。そのディレクトリ
     と zip ファイルは自動的に sys.path エントリの先頭に挿入されます。
     (Suggestion and initial patch by Andy Chu; revised patch by Phillip
     J. Eby and Nick Coghlan; bpo-1739468(1).)

   * *note int(): 19b. 型に ‘bit_length’ メソッドが追加されました。 この
     メソッドはその値を二進数で表現するのに必要なビット数を返します:

          >>> n = 37
          >>> bin(37)
          '0b100101'
          >>> n.bit_length()
          6
          >>> n = 2**123-1
          >>> n.bit_length()
          123
          >>> (n+1).bit_length()
          124

     (Contributed by Fredrik Johansson, Victor Stinner, Raymond
     Hettinger, and Mark Dickinson; bpo-3439(2).)

   * *note format(): 199. 文字列のフィールドに自動的に番号が振られるよう
     になりました:

          >>> 'Sir {} of {}'.format('Gallahad', 'Camelot')
          'Sir Gallahad of Camelot'

     以前は、文字列は ‘'Sir {0} of {1}'’ のようにフィールドに番号を振ら
     なければなりませんでした。

     (Contributed by Eric Smith; bpo-5237(3).)

   * The ‘string.maketrans()’ function is deprecated and is replaced by
     new static methods, *note bytes.maketrans(): 148c. and *note
     bytearray.maketrans(): 148d.  This change solves the confusion
     around which types were supported by the *note string: d8. module.
     Now, *note str: 169, *note bytes: 192, and *note bytearray: 344.
     each have their own 'maketrans' and 'translate' methods with
     intermediate translation tables of the appropriate type.

     (Contributed by Georg Brandl; bpo-5675(4).)

   * *note with: 186. 文のシンタックスは一つの文で複数のコンテキストマネ
     ージャを使えるようになりました:

          >>> with open('mylog.txt') as infile, open('a.out', 'w') as outfile:
          ...     for line in infile:
          ...         if '<critical>' in line:
          ...             outfile.write(line)

     With the new syntax, the ‘contextlib.nested()’ function is no
     longer needed and is now deprecated.

     (Georg Brandl と Mattias Brändström の貢献; appspot issue
     53094(5).)

   * ‘round(x, n)’ は 'x' が整数の場合、整数を返すようになりました。以前
     は浮動小数点を返していました:

          >>> round(1123, -2)
          1100

     (Contributed by Mark Dickinson; bpo-4707(6).)

   * Python now uses David Gay's algorithm for finding the shortest
     floating-point representation that doesn't change its value.  This
     should help mitigate some of the confusion surrounding binary
     floating-point numbers.

     The significance is easily seen with a number like ‘1.1’ which does
     not have an exact equivalent in binary floating point.  Since there
     is no exact equivalent, an expression like ‘float('1.1')’ evaluates
     to the nearest representable value which is ‘0x1.199999999999ap+0’
     in hex or ‘1.100000000000000088817841970012523233890533447265625’
     in decimal.  That nearest value was and still is used in subsequent
     floating-point calculations.

     What is new is how the number gets displayed.  Formerly, Python
     used a simple approach.  The value of ‘repr(1.1)’ was computed as
     ‘format(1.1, '.17g')’ which evaluated to ‘'1.1000000000000001'’.
     The advantage of using 17 digits was that it relied on IEEE-754
     guarantees to assure that ‘eval(repr(1.1))’ would round-trip
     exactly to its original value.  The disadvantage is that many
     people found the output to be confusing (mistaking intrinsic
     limitations of binary floating-point representation as being a
     problem with Python itself).

     新しいアルゴリズムでは ‘repr(1.1)’ はより賢明で ‘'1.1'’ を返します
     。実際的には、これは全ての等価な文字列表現 (前提となる同じ浮動小数
     点数に戻るもの) を探し、そして一番短い表現を返します。

     新アルゴリズムは、可能な限りよりわかりやすい表現を生み出す傾向があ
     りますが、元の値を変更しません。ですから ‘1.1 + 2.2 != 3.3’ は表示
     がどうであれ、今でも問題です。

     The new algorithm depends on certain features in the underlying
     floating-point implementation.  If the required features are not
     found, the old algorithm will continue to be used.  Also, the text
     pickle protocols assure cross-platform portability by using the old
     algorithm.

     (Contributed by Eric Smith and Mark Dickinson; bpo-1580(7))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1739468

   (2) https://bugs.python.org/issue?@action=redirect&bpo=3439

   (3) https://bugs.python.org/issue?@action=redirect&bpo=5237

   (4) https://bugs.python.org/issue?@action=redirect&bpo=5675

   (5) https://codereview.appspot.com/53094

   (6) https://bugs.python.org/issue?@action=redirect&bpo=4707

   (7) https://bugs.python.org/issue?@action=redirect&bpo=1580


File: python.info,  Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>,  Next: 最適化<13>,  Prev: その他の言語変更<13>,  Up: What's New In Python 3 1

1.14.4 新たなモジュール、改良されたモジュール、非推奨のモジュール
-----------------------------------------------------------------

   * シーケンスまたはイテラブル内にある一意な要素を数え上げるのに便利な
     *note collections.Counter: 12a3. クラスが追加されました:

          >>> Counter(['red', 'blue', 'red', 'green', 'blue', 'blue'])
          Counter({'blue': 3, 'red': 2, 'green': 1})

     (Contributed by Raymond Hettinger; bpo-1696199(1).)

   * Tk のテーマ付きウィジェットへのアクセスを提供する、新しい *note
     tkinter.ttk: ff. モジュールが追加されました。 *note tkinter.ttk:
     ff. の基本的なアイディアは、拡張可能性のためにウィジェットの動作を
     実装するコードと見た目を記述するコードを分離することです。

     (Contributed by Guilherme Polo; bpo-2983(2).)

   * *note gzip.GzipFile: 65c. と *note bz2.BZ2File: a66. クラスはコンテ
     キストマネジメントプロトコルをサポートするようになりました:

          >>> # Automatically close file after writing
          >>> with gzip.GzipFile(filename, "wb") as f:
          ...     f.write(b"xxx")

     (Contributed by Antoine Pitrou.)

   * *note decimal: 3a. モジュールが二進 *note float: 196. から decimal
     オブジェクトを生成するメソッドをサポートしました。 変換は正確ですが
     時に意外なことがあります:

          >>> Decimal.from_float(1.1)
          Decimal('1.100000000000000088817841970012523233890533447265625')

     長い十進の結果が、 '1.1' を記憶するための現実の二進での端数を表して
     います。 '1.1' は二進数で正確に表現出来ないので、端数は十進表現でと
     ても多くの桁数になっています。

     (Contributed by Raymond Hettinger and Mark Dickinson.)

   * *note itertools: 85. に 2 つの関数が追加されました。 *note
     itertools.combinations_with_replacement(): 1499. 関数は、置換 (順列
     , permutation) や直積 (Cartesian product) を含む組合せ論の 4 つの生
     成関数のうちの 1 つです。 *note itertools.compress(): 149a. 関数は
     APL(3) の同名機能の模倣品です。また、既存の *note
     itertools.count(): 149b. 関数は新たにオプショナルな 'step' 引数を取
     るようになり、そして数え方に *note fractions.Fraction: 213. や
     *note decimal.Decimal: 1fe. を含む任意の数値型を使えるようになりま
     した。

          >>> [p+q for p,q in combinations_with_replacement('LOVE', 2)]
          ['LL', 'LO', 'LV', 'LE', 'OO', 'OV', 'OE', 'VV', 'VE', 'EE']

          >>> list(compress(data=range(10), selectors=[0,0,1,1,0,1,0,1,0,0]))
          [2, 3, 5, 7]

          >>> c = count(start=Fraction(1,2), step=Fraction(1,6))
          >>> [next(c), next(c), next(c), next(c)]
          [Fraction(1, 2), Fraction(2, 3), Fraction(5, 6), Fraction(1, 1)]

     (Contributed by Raymond Hettinger.)

   * *note collections.namedtuple(): 4e0. が新たにキーワード引数
     'rename' をサポートし、これにより不正なフィールド名を自動で _0, _1,
     ...  といった位置による名前に変換することが出来ます。これはフィール
     ド名が何か外部ソースに基いて作られる場合に有用です。例えば CSV のヘ
     ッダ、SQL のフィールドリスト、あるいはユーザ入力などです:

          >>> query = input()
          SELECT region, dept, count(*) FROM main GROUPBY region, dept

          >>> cursor.execute(query)
          >>> query_fields = [desc[0] for desc in cursor.description]
          >>> UserQuery = namedtuple('UserQuery', query_fields, rename=True)
          >>> pprint.pprint([UserQuery(*row) for row in cursor])
          [UserQuery(region='South', dept='Shipping', _2=185),
           UserQuery(region='North', dept='Accounting', _2=37),
           UserQuery(region='West', dept='Sales', _2=419)]

     (Contributed by Raymond Hettinger; bpo-1818(4).)

   * *note re.sub(): 5a3.、*note re.subn(): 5a4. および *note
     re.split(): 5a2. 関数は flags 引数を受け取るようになりました。

     (Contributed by Gregory Smith.)

   * logging を自身では使わずとも使用ライブラリがそうしているようなアプ
     リケーションのために、 *note logging: 8b. モジュールが単純な *note
     logging.NullHandler: 149c. を実装しました。null ハンドラをセットア
     ップすることは、 "No handlers could be found for logger foo" のよう
     な警告を抑制します。

          >>> h = logging.NullHandler()
          >>> logging.getLogger("foo").addHandler(h)

     (Contributed by Vinay Sajip; bpo-4384(5)).

   * コマンドラインスイッチ ‘-m’ をサポートしている *note runpy: c3. が
     パッケージの実行をサポートするようになりました。パッケージ名が与え
     られると ‘__main__’ サブモジュールを探し出して実行します。

     (Contributed by Andi Vajda; bpo-4195(6).)

   * *note pdb: aa. モジュールが *note zipimport: 138. (あるいはなにかほ
     かの PEP 302(7) 準拠ローダ) でロードされたモジュールのソースコード
     にアクセスでき、表示できるようになりました。

     (Contributed by Alexander Belopolsky; bpo-4201(8).)

   * *note functools.partial: 217. オブジェクトが pickle 化出来るように
     なりました。

     (Suggested by Antoine Pitrou and Jesse Noller.  Implemented by Jack
     Diederich; bpo-5228(9).)

   * シンボルのための *note pydoc: ba. ヘルプトピックが追加されました。
     これで対話環境で ‘help('@')’ などが期待通りの働きをします (--訳注:
     実装としては pydoc_data パッケージのこと。 ‘pydoc_data/topics.py’ に
     docstring からは生成出来ない、シンボルについてのドキュメントが収め
     られています --)。

     (Contributed by David Laban; bpo-4739(10).)

   * *note unittest: 10c. に特定のテストメソッドやテストクラス全体をスキ
     ップする仕組みのサポートが追加されました。さらに、この機能はテスト
     結果を「意図的な失敗」とすることができ、テストが失敗しても
     ‘TestResult’ の失敗数にはカウントされなくなります:

          class TestGizmo(unittest.TestCase):

              @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
              def test_gizmo_on_windows(self):
                  ...

              @unittest.expectedFailure
              def test_gimzo_without_required_library(self):
                  ...

     また例外についてのテストが、 *note with: 186. 文で使えるコンテキス
     トマネージャとして増強されました:

          def test_division_by_zero(self):
              with self.assertRaises(ZeroDivisionError):
                  x / 0

     In addition, several new assertion methods were added including
     *note assertSetEqual(): 149d, *note assertDictEqual(): 149e,
     ‘assertDictContainsSubset()’, *note assertListEqual(): 149f, *note
     assertTupleEqual(): 14a0, *note assertSequenceEqual(): 14a1, *note
     assertRaisesRegexp(): 752, *note assertIsNone(): 14a2, and *note
     assertIsNotNone(): 14a3.

     (Contributed by Benjamin Peterson and Antoine Pitrou.)

   * The *note io: 83. module has three new constants for the *note
     seek(): 14a4. method: *note SEEK_SET: 14a5, *note SEEK_CUR: 14a6,
     and *note SEEK_END: 14a7.

   * *note sys.version_info: 8af. タプルが名前付きタプルになりました。

          >>> sys.version_info
          sys.version_info(major=3, minor=1, micro=0, releaselevel='alpha', serial=2)

     (Contributed by Ross Light; bpo-4285(11).)

   * The ‘nntplib’ and *note imaplib: 78. modules now support IPv6.

     (Contributed by Derek Morr; bpo-1655(12) and bpo-1664(13).)

   * *note pickle: ab. を、プロトコル 2 以下を使う際に Python 2.x との相
     互運用に順応するようにしました。標準ライブラリの再編成はたくさんの
     オブジェクトへの公式な参照を変えました。例えば Python 2 の
     ‘__builtin__.set’ は Python 3 では ‘builtins.set’ です。この変化は
     異なる Python バージョン間でのデータ共有の取り組みを複雑にしました
     。ですが今回のこの修正により、プロトコル 2 以下を選んだ場合は
     pickler は自動的にロード時もダンプ時も古い Python 2 命名を使うよう
     になります。この再マッピングはデフォルトで有効になりますが、
     'fix_imports' オプションで無効に出来ます:

          >>> s = {1, 2, 3}
          >>> pickle.dumps(s, protocol=0)
          b'c__builtin__\nset\np0\n((lp1\nL1L\naL2L\naL3L\natp2\nRp3\n.'
          >>> pickle.dumps(s, protocol=0, fix_imports=False)
          b'cbuiltins\nset\np0\n((lp1\nL1L\naL2L\naL3L\natp2\nRp3\n.'

     不幸にも、そして避けられないこの変更による副作用は、Python 3.1 によ
     って生成されたプロトコル 2 pickle が Python 3.0 で読めなくなるであ
     ろうことです。Python 2.x との互換性を維持するつもりがないのであれば
     、Python 3.x 実装間でのデータ移行では最新 pickle プロトコルバージョ
     ン 3 を使うべきです。

     (Contributed by Alexandre Vassalotti and Antoine Pitrou,
     bpo-6137(14).)

   * 新規モジュール *note importlib: 7b. が追加されました。 *note
     import: 7f8. 文とその相棒の *note __import__(): ad1. 関数の、完全で
     移植性が高いピュア Python 参照実装を提供しています。これはインポー
     トで行う動作の文書化と定義における、確かな前進です。

     (Contributed by Brett Cannon.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1696199

   (2) https://bugs.python.org/issue?@action=redirect&bpo=2983

   (3) https://ja.wikipedia.org/wiki/APL

   (4) https://bugs.python.org/issue?@action=redirect&bpo=1818

   (5) https://bugs.python.org/issue?@action=redirect&bpo=4384

   (6) https://bugs.python.org/issue?@action=redirect&bpo=4195

   (7) https://peps.python.org/pep-0302/

   (8) https://bugs.python.org/issue?@action=redirect&bpo=4201

   (9) https://bugs.python.org/issue?@action=redirect&bpo=5228

   (10) https://bugs.python.org/issue?@action=redirect&bpo=4739

   (11) https://bugs.python.org/issue?@action=redirect&bpo=4285

   (12) https://bugs.python.org/issue?@action=redirect&bpo=1655

   (13) https://bugs.python.org/issue?@action=redirect&bpo=1664

   (14) https://bugs.python.org/issue?@action=redirect&bpo=6137


File: python.info,  Node: 最適化<13>,  Next: IDLE<2>,  Prev: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>,  Up: What's New In Python 3 1

1.14.5 最適化
-------------

大きな性能向上がありました:

   * The new I/O library (as defined in PEP 3116(1)) was mostly written
     in Python and quickly proved to be a problematic bottleneck in
     Python 3.0.  In Python 3.1, the I/O library has been entirely
     rewritten in C and is 2 to 20 times faster depending on the task at
     hand.  The pure Python version is still available for
     experimentation purposes through the ‘_pyio’ module.

     (Contributed by Amaury Forgeot d'Arc and Antoine Pitrou.)

   * Added a heuristic so that tuples and dicts containing only
     untrackable objects are not tracked by the garbage collector.  This
     can reduce the size of collections and therefore the garbage
     collection overhead on long-running programs, depending on their
     particular use of datatypes.

     (Contributed by Antoine Pitrou, bpo-4688(2).)

   * Enabling a configure option named ‘--with-computed-gotos’ on
     compilers that support it (notably: gcc, SunPro, icc), the bytecode
     evaluation loop is compiled with a new dispatch mechanism which
     gives speedups of up to 20%, depending on the system, the compiler,
     and the benchmark.

     (Contributed by Antoine Pitrou along with a number of other
     participants, bpo-4753(3)).

   * UTF-8, UTF-16 ならびに LATIN-1 のデコーディングが2から4倍速くなりま
     した。

     (Antoine Pitrou と Amaury Forgeot d'Arc の貢献, bpo-4868(4).)

   * The *note json: 86. module now has a C extension to substantially
     improve its performance.  In addition, the API was modified so that
     json works only with *note str: 169, not with *note bytes: 192.
     That change makes the module closely match the JSON
     specification(5) which is defined in terms of Unicode.

     (Contributed by Bob Ippolito and converted to Py3.1 by Antoine
     Pitrou and Benjamin Peterson; bpo-4136(6).)

   * Unpickling now interns the attribute names of pickled objects.
     This saves memory and allows pickles to be smaller.

     (Contributed by Jake McGuire and Antoine Pitrou; bpo-5084(7).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3116/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=4688

   (3) https://bugs.python.org/issue?@action=redirect&bpo=4753

   (4) https://bugs.python.org/issue?@action=redirect&bpo=4868

   (5) https://json.org/

   (6) https://bugs.python.org/issue?@action=redirect&bpo=4136

   (7) https://bugs.python.org/issue?@action=redirect&bpo=5084


File: python.info,  Node: IDLE<2>,  Next: ビルドならびに C API の変更<6>,  Prev: 最適化<13>,  Up: What's New In Python 3 1

1.14.6 IDLE
-----------

   * IDLE のフォーマットメニューに、ソースコードから末尾の空白を取り除く
     ことが出来るオプションが追加されました。

     (Contributed by Roger D. Serwy; bpo-5150(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5150


File: python.info,  Node: ビルドならびに C API の変更<6>,  Next: Python 3 1 への移植,  Prev: IDLE<2>,  Up: What's New In Python 3 1

1.14.7 ビルドならびに C API の変更
----------------------------------

Python のビルド過程と C API の変更は以下の通りです:

   * 整数の内部格納方式が ‘2**15’ ベースと ‘2**30’ ベースのいずれかにな
     りました。 これはビルド時に決定されます。 以前は常に ‘2**15’ ベース
     で格納されていました。 ‘2**30’ ベースにすると 64 bit マシンでは性能
     が有意に向上しますが、 32 bit マシンでのベンチマーク結果には向上も
     低下もあります。 そのため、デフォルトでは 64 bit マシンで ‘2**30’ ベ
     ースを、 32 bit マシンで ‘2**15’ ベースを使用します。 Unix では新た
     な configure オプション ‘--enable-big-digits’ が追加されました。 こ
     れにより上記のデフォルトを上書き出来ます。

     この変更は性能向上以外ではエンドユーザには分からないはずですが、例
     外が1つあります。 テストおよびデバッグ目的で内部形式の情報を提供す
     る *note sys.int_info: 14ab. が追加されましたが、これにより数字あた
     りのビット数と各数字の格納に使われる C の型のバイトサイズが分かりま
     す:

          >>> import sys
          >>> sys.int_info
          sys.int_info(bits_per_digit=30, sizeof_digit=4)

     (Contributed by Mark Dickinson; bpo-4258(1).)

   * *note PyLong_AsUnsignedLongLong(): 14ac. 関数は負の 'pylong' に対し
     *note TypeError: 198. ではなく *note OverflowError: a81. を送出する
     ようになりました。

     (Contributed by Mark Dickinson and Lisandro Dalcrin; bpo-5175(2).)

   * ‘PyNumber_Int()’ が非推奨になりました。代わりに *note
     PyNumber_Long(): c5d. を使用してください。

     (Contributed by Mark Dickinson; bpo-4910(3).)

   * 非推奨の関数 ‘PyOS_ascii_strtod()’ および ‘PyOS_ascii_atof()’ を置
     き換えるために新しく *note PyOS_string_to_double(): 14ad. 関数が追
     加されました。

     (Contributed by Mark Dickinson; bpo-5914(4).)

   * ‘PyCObject’ API を置き換えるものとして、 *note PyCapsule: 148a. が
     追加されました。主な違いとしては、新しい型は、型安全に情報を渡すた
     めの良く定義されたインターフェースを持ち、また、デストラクタの呼び
     出しのシグネチャの複雑さが小さくなっています。古い型は問題のある
     API で、今では非推奨です。

     (Contributed by Larry Hastings; bpo-5630(5).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=4258

   (2) https://bugs.python.org/issue?@action=redirect&bpo=5175

   (3) https://bugs.python.org/issue?@action=redirect&bpo=4910

   (4) https://bugs.python.org/issue?@action=redirect&bpo=5914

   (5) https://bugs.python.org/issue?@action=redirect&bpo=5630


File: python.info,  Node: Python 3 1 への移植,  Prev: ビルドならびに C API の変更<6>,  Up: What's New In Python 3 1

1.14.8 Python 3.1 への移植
--------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

   * The new floating-point string representations can break existing
     doctests.  For example:

          def e():
              '''Compute the base of natural logarithms.

              >>> e()
              2.7182818284590451

              '''
              return sum(1/math.factorial(x) for x in reversed(range(30)))

          doctest.testmod()

          **********************************************************************
          Failed example:
              e()
          Expected:
              2.7182818284590451
          Got:
              2.718281828459045
          **********************************************************************

   * pickle モジュールがプロトコルバージョン 2 以下で自動的に名前の再対
     応付けを行うので、Python 3.1 で pickle 化すると Python 3.0 で読めな
     くなります。一つの解決策はプロトコル 3 を使うことです。もう一つは
     'fix_imports' オプションを ‘False’ にセットすることです。上述の議論
     を参照してください。


File: python.info,  Node: What's New In Python 3 0,  Next: What's New in Python 2 7,  Prev: What's New In Python 3 1,  Up: What's New in Python

1.15 What's New In Python 3.0
=============================


著者: Guido van Rossum

この記事では 2.6 と比較した Python 3.0 での新機能を解説します。 Python
3.0、あるいは "Python 3000"、 "Py3K" は初めて '意図的に後方非互換にした'
Python のリリースです。 Python 3.0 は2008年12月3日にリリースされました。
通常のリリースよりも多くの変更があり、全ての Python ユーザにとって重要で
す。 しかし、変更について理解したら Python に実際にはそれほど変更がない
ことが分かるでしょう。 全体的に見れば、よく知られた悩みの種が概ね解決さ
れ、昔の粗雑なものが取り除かれています。

この記事は全ての新機能を完璧な仕様を示そうとはしませんが、便利な概要につ
いては説明しようとしています。 全詳細については Python 3.0 のドキュメン
トや、本編で引かれている多くの PEP を参照してください。 特定の機能の実装
や設計原理について完全に理解したいなら、通常のドキュメントよりも詳しいこ
とが書いてある PEP を見るとよいでしょう。 しかし、一旦機能が完全に実装さ
れると、普通 PEP は最新の状態に保たれないことに注意してください。

この文書で全項目に触れるべきなのですが、時間の制約のためそうではありませ
ん。 いつもの新リリースのように、 ソース配布の ‘Misc/NEWS’ には些細な変
更についても詳細な情報があります。

* Menu:

* よくある悩みの種::
* 構文の変更の概要::
* Python 2.6 で既にあった変更: Python 2 6 で既にあった変更.
* ライブラリの変更::
* PEP 3101; 文字列整形の新たなアプローチ: PEP 3101 文字列整形の新たなアプローチ.
* 例外に関する変更::
* その他の変更: その他の変更<2>.
* ビルドならびに C API の変更: ビルドならびに C API の変更<7>.
* 性能::
* Python 3.0 への移植: Python 3 0 への移植.


File: python.info,  Node: よくある悩みの種,  Next: 構文の変更の概要,  Up: What's New In Python 3 0

1.15.1 よくある悩みの種
-----------------------

このセクションは Python 2.5 に慣れていたら躓いてしまいそうな少数の変更の
一覧です。

* Menu:

* print関数::
* リストからビューおよびイテレータへ::
* 順序比較::
* 整数::
* Unicode 対 8 ビット、ではなく、テキスト対データに::


File: python.info,  Node: print関数,  Next: リストからビューおよびイテレータへ,  Up: よくある悩みの種

1.15.1.1 print関数
..................

‘print’ 文は *note print(): 1177. 関数に置き換えられ、古い ‘print’ 文の
特殊な文法の殆どがキーワード引数で置き換えられています ( PEP 3105(1))。
例:

     Old: print "The answer is", 2*2
     New: print("The answer is", 2*2)

     Old: print x,           # Trailing comma suppresses newline
     New: print(x, end=" ")  # Appends a space instead of a newline

     Old: print              # Prints a newline
     New: print()            # You must call the function!

     Old: print >>sys.stderr, "fatal error"
     New: print("fatal error", file=sys.stderr)

     Old: print (x, y)       # prints repr((x, y))
     New: print((x, y))      # Not the same as print(x, y)!

項目間の区切りをカスタマイズすることもできます。例:

     print("There are <", 2**32, "> possibilities!", sep="")

これは以下を出力します :

     There are <4294967296> possibilities!

注釈:

   * *note print(): 1177. 関数は、古い ‘print’ 文の "ソフトスペース" 機
     能をサポートしません。例えば Python 2.x では、 ‘print "A\n", "B"’ は
     ‘"A\nB\n"’ を出力していましたが、 Python 3.0 では、 ‘print("A\n",
     "B")’ は ‘"A\n B\n"’ を出力します。

   * 最初は、対話モードで古い ‘print x’ を何回もタイプしてしまうでしょう
     。代わりに ‘print(x)’ とタイプするよう再教育してください。

   * ‘2to3’ ソース変換ツールを使うと、すべての ‘print’ 文が *note
     print(): 1177. 関数呼び出しに自動的に置換されるので、大きなプロジェ
     クトでもさほど問題にならないでしょう。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3105/


File: python.info,  Node: リストからビューおよびイテレータへ,  Next: 順序比較,  Prev: print関数,  Up: よくある悩みの種

1.15.1.2 リストからビューおよびイテレータへ
...........................................

いくつかの良く使われている API はもはやリストを返しません:

   * *note dict: 183. の *note dict.keys(): 9d0, *note dict.items():
     9d2. そして *note dict.values(): 9d1. メソッドはリストの代わりに
     "views" を返します。 例えば: ‘k = d.keys(); k.sort()’ は上手く動き
     ません。 代わりに ‘k = sorted(d)’ を使ってください (これは Python
     2.5 でも動作し、効率的です)。

   * Also, the ‘dict.iterkeys()’, ‘dict.iteritems()’ and
     ‘dict.itervalues()’ methods are no longer supported.

   * *note map(): 19f. と *note filter(): a64. はイテレータを返します。
     もしも本物のリストが必要で、全ての入力シーケンスが同じ長さの場合で
     あれば、簡単に直すなら *note map(): 19f. を *note list(): 24d. で包
     みます。例えば ‘list(map(...))’ という具合。ですがより良いのは、大
     抵はリスト内包を使うことです (特に元々のコードが *note lambda:
     14b5. を使っている場合)。あるいはコードを、リストを全く必要としない
     ように書き換えましょう。とりわけトリッキーなのは、関数に副作用を起
     こさせるために呼び出される *note map(): 19f. です; この場合確実な変
     換は普通に *note for: 34a. ループを使うことです (そもそもリストを作
     ること自体が無駄遣いでしょう)。

     入力シーケンスの長さが同じとは限らないならば、 *note map(): 19f. は
     最も短いシーケンスが消費されつくすと処理をやめます。Python 2.x での
     *note map(): 19f. 用法と全く互換にするにはシーケンスを *note
     itertools.zip_longest(): 14b6. で包んでください。例えば ‘map(func,
     *sequences)’ を ‘list(map(func,
     itertools.zip_longest(*sequences)))’ とします。

   * *note range(): b3d. now behaves like ‘xrange()’ used to behave,
     except it works with values of arbitrary size.  The latter no
     longer exists.

   * *note zip(): 1a0. はイテレータを返します。


File: python.info,  Node: 順序比較,  Next: 整数,  Prev: リストからビューおよびイテレータへ,  Up: よくある悩みの種

1.15.1.3 順序比較
.................

Python 3.0 で順序比較のルールが簡単になりました。

   * 順序比較演算子 (‘<’, ‘<=’, ‘>=’, ‘>’) は、そのオペランドが自然な順
     序づけを持たない場合 TypeError 例外を送出します。 ‘1 < ''’, ‘0 >
     None’ または ‘len <= len’ のような式は無効になり、 ‘None < None’ は
     ‘False’ を返す代わりに *note TypeError: 198. を送出します。その結果
     、 不均一なリスト（訳注：比較不能な型からなる要素が混在するリスト）
     のソートは意味がなくなりました。 - 全ての要素は互いに比較できなけれ
     ばなりません。これは ‘==’ と ‘!=’ 演算子には適用されないことに注意
     してください: 別々の比較不可能な型のオブジェクトを比較すると常に、
     互いに等しくないと評価されます。

   * *note sorted(): dc7. and *note list.sort(): dc8. no longer accept
     the 'cmp' argument providing a comparison function.  Use the 'key'
     argument instead.  N.B. the 'key' and 'reverse' arguments are now
     "keyword-only".

   * The ‘cmp()’ function should be treated as gone, and the ‘__cmp__()’
     special method is no longer supported.  Use *note __lt__(): 14b8.
     for sorting, *note __eq__(): cf2. with *note __hash__(): cf3, and
     other rich comparisons as needed.  (If you really need the ‘cmp()’
     functionality, you could use the expression ‘(a > b) - (a < b)’ as
     the equivalent for ‘cmp(a, b)’.)


File: python.info,  Node: 整数,  Next: Unicode 対 8 ビット、ではなく、テキスト対データに,  Prev: 順序比較,  Up: よくある悩みの種

1.15.1.4 整数
.............

   * PEP 237(1): Essentially, ‘long’ renamed to *note int: 19b.  That
     is, there is only one built-in integral type, named *note int:
     19b.; but it behaves mostly like the old ‘long’ type.

   * PEP 238(2): An expression like ‘1/2’ returns a float.  Use ‘1//2’
     to get the truncating behavior.  (The latter syntax has existed for
     years, at least since Python 2.2.)

   * The ‘sys.maxint’ constant was removed, since there is no longer a
     limit to the value of integers.  However, *note sys.maxsize: 13dd.
     can be used as an integer larger than any practical list or string
     index.  It conforms to the implementation's "natural" integer size
     and is typically the same as ‘sys.maxint’ in previous releases on
     the same platform (assuming the same build options).

   * long 整数の *note repr(): 1c1. はもはや末尾に ‘L’ を持ちません。そ
     のため、無条件に "L" を取り除くコードは代わりに最後の数字を取り除い
     てしまうでしょう。 (代わりに *note str(): 169. を使用してください。
     )

   * 8進数リテラルが ‘0720’ の形でなくなりました。代わりに ‘0o720’ を使
     ってください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0237/

   (2) https://peps.python.org/pep-0238/


File: python.info,  Node: Unicode 対 8 ビット、ではなく、テキスト対データに,  Prev: 整数,  Up: よくある悩みの種

1.15.1.5 Unicode 対 8 ビット、ではなく、テキスト対データに
..........................................................

バイナリと Unicode について知っていると思っている全てが変わりました。

   * Python 3.0 でのコンセプトは、Unicode 文字列と 8 ビット文字列、とい
     う対比ではなくて、 'テキスト' と (バイナリ) 'データ' の違いと考える
     、というものです。全てのテキストは Unicode です; 一方で 'エンコード
     された' Unicode はバイナリデータとして表現されます。テキストを保持
     するのに使われる型は *note str: 169. で、データには *note bytes:
     192. を使います。2.x での状況との最大の違いは、Python 3.0 でテキス
     トとデータを混ぜようとすれば *note TypeError: 198. となることです。
     Python 2.x では Unicode と 8 ビット文字列を混ぜたとすれば、8 ビット
     文字列がたまたま 7 ビット (ASCII) バイトだけから出来ていれば動くし
     非 ASCII バイトがあれば *note UnicodeDecodeError: c08. となっていた
     でしょう。この、データ値に依存した振る舞いが、何年にも渡って夥しい
     数の悲劇を生み出していました。

   * As a consequence of this change in philosophy, pretty much all code
     that uses Unicode, encodings or binary data most likely has to
     change.  The change is for the better, as in the 2.x world there
     were numerous bugs having to do with mixing encoded and unencoded
     text.  To be prepared in Python 2.x, start using ‘unicode’ for all
     unencoded text, and *note str: 169. for binary or encoded data
     only.  Then the ‘2to3’ tool will do most of the work for you.

   * Unicode テキストのリテラルに ‘u"..."’ を使うことはもはやできません
     。しかし、バイナリーデータのリテラルには ‘b"..."’ を使わなければな
     りません。(--訳注: この ‘u"..."’ は Python 3.3 で再び使えるようにな
     りました。 --)

   * *note str: 169. 型と *note bytes: 192. 型を混ぜて使うことは出来ませ
     んから、それらはいつでも明示的に変換しなければいけません。 *note
     str: 169. から *note bytes: 192. にするには *note str.encode():
     ad2. を使ってください。そして *note bytes: 192. から *note str:
     169. にするには *note bytes.decode(): ad3. を使います。それぞれ
     ‘bytes(s, encoding=...)’ 、 ‘str(b, encoding=...)’ を使うことも出来
     ます。

   * Like *note str: 169, the *note bytes: 192. type is immutable.
     There is a separate 'mutable' type to hold buffered binary data,
     *note bytearray: 344.  Nearly all APIs that accept *note bytes:
     192. also accept *note bytearray: 344.  The mutable API is based on
     *note collections.MutableSequence: 4bf.

   * raw 文字列リテラル内にある全てのバックスラッシュが「字句通り」に解
     釈されます。つまり ‘'\U'’ も ‘'\u'’ も、 raw 文字列内にあっては何ら
     特別に扱われないということです。例えば ‘r'\u20ac'’ は Python 3.0 で
     は 6 文字の文字列です。Python 2.x では ‘ur'\u20ac'’ が単一の「ユー
     ロ」文字であったのにです。(無論この変更は raw 文字列リテラルについ
     てだけのもので、ユーロ文字は Python 3.0 で ‘'\u20ac'’ です。)

   * The built-in ‘basestring’ abstract type was removed.  Use *note
     str: 169. instead.  The *note str: 169. and *note bytes: 192. types
     don't have functionality enough in common to warrant a shared base
     class.  The ‘2to3’ tool (see below) replaces every occurrence of
     ‘basestring’ with *note str: 169.

   * テキストファイルとして開かれたファイル (これは従来どおり *note
     open(): 316. でのデフォルトのモード) は、 (メモリ内の) 文字列と (デ
     ィスクでの) バイト列との写像をするのに、常にエンコーディングを使い
     ます。バイナリファイル (モードに ‘b’ を付けて開いたもの) はメモリ内
     では常にバイト列を使います。このことで、もしもファイルが誤ったモー
     ドやエンコーディングで開かれようとすると、I/O はきっと口やかましく
     失敗します。こっそり正しくないデータを生み出すのではなく。それに加
     えて、ファイルを開く際には Unix ユーザでさえもこれからは、 (テキス
     トかバイナリかの) 正しいモードを選択する必要があるということです。
     プラットフォームにはそれ特有のデフォルトエンコーディングがあります
     。Unix 的プラットフォームではこれは環境変数 ‘LANG’ にセットされてい
     るかもしれません (あるいは時々ほかのプラットフォーム特有の、ロケー
     ルに関係した環境変数にもセットされています)。全てとは言いませんが多
     くの場合は、システムのデフォルトは UTF-8 です; ですが決してこのデフ
     ォルトを当てにすべきではありません。純粋な ASCII テキスト以上のもの
     を読み書きするどんなアプリケーションも、きっとエンコーディングをオ
     ーバライド出来る手段を持つべきです。 *note codecs: 1c. 内にあるエン
     コーディングを熟知したストリームを使うことは、今ではもう必要なくな
     りました。

   * *note sys.stdin: 75f, *note sys.stdout: ccd, *note sys.stderr: b33.
     の初期値はいまでは Unicode のみのテキストファイルです (つまりそれら
     は *note io.TextIOBase: 8a4. のインスタンスです)。バイト列データを
     それらのストリームで読み書きするには、 *note io.TextIOBase.buffer:
     14bb. 属性を使う必要があります。

   * ファイル名は、API へは (Unicode) 文字列を渡し、 (Unicode) 文字列が
     返ります。これにはプラットフォーム特有の問題があるかもしれません。
     というのも、いくつかのプラットフォームではファイル名は任意のバイト
     文字列だからです。(他方では、Windows ではファイル名はネイティブに
     Unicode で格納されています。) 次善策として、ほとんどの API (たとえ
     ば *note open(): 316. と *note os: a5. モジュール内の多くの関数) は
     ファイル名として、文字列だけでなく *note bytes: 192. を受け付け、そ
     して少しの API は *note bytes: 192. を返すかどうかを要求出来る手段
     を持っています。それゆえに *note os.listdir(): 1312. は引数が *note
     bytes: 192. インスタンスであれば *note bytes: 192. のリストで返し、
     *note os.getcwdb(): c82. はカレントディレクトリを *note bytes: 192.
     で返します。 *note os.listdir(): 1312. が文字列のリストで返す際、適
     切にデコード出来ないファイル名は *note UnicodeError: 462. とはせず
     に無視されることにご注意ください。

   * *note os.environ: 259. や *note sys.argv: 147c. のようないくつかの
     システム API にも問題がありえます。システムにより利用可能とされるべ
     きバイト列がデフォルトエンコーディングで解釈不能な場合です。環境変
     数 ‘LANG’ をセットしてプログラムを再実行することが、おそらく最善の
     アプローチです。

   * PEP 3138(1): 文字列への *note repr(): 1c1. はもう非 ASCII 文字をエ
     スケープしません。ただし、制御文字、Unicode 標準で印字不可状態のコ
     ードポイントは今でもエスケープされます。

   * PEP 3120(2): ソースのエンコードのデフォルトが UTF-8 になりました。

   * PEP 3131(3): 非 ASCII 文字を識別子として使用することが出来るように
     なりました。 (そうはいっても標準ライブラリは、コメント内での貢献者
     の名前以外では ASCII だけのままです。)

   * ‘StringIO’ および ‘cStringIO’ モジュールは廃止されました。その代わ
     り *note io: 83. モジュールをインポートして、テキストやデータには
     *note io.StringIO: 112a. や *note io.BytesIO: 10a4. を使用してくだ
     さい。

   * *note Unicode HOWTO: 14bc. を参照してください。Python 3.0 向けに更
     新されました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3138/

   (2) https://peps.python.org/pep-3120/

   (3) https://peps.python.org/pep-3131/


File: python.info,  Node: 構文の変更の概要,  Next: Python 2 6 で既にあった変更,  Prev: よくある悩みの種,  Up: What's New In Python 3 0

1.15.2 構文の変更の概要
-----------------------

このセクションは Python 3.0 における全ての '構文の' 変更についての簡単な
概要です。

* Menu:

* 新たな構文::
* 変更された構文::
* 削除された操作::


File: python.info,  Node: 新たな構文,  Next: 変更された構文,  Up: 構文の変更の概要

1.15.2.1 新たな構文
...................

   * PEP 3107(1): Function argument and return value annotations.  This
     provides a standardized way of annotating a function's parameters
     and return value.  There are no semantics attached to such
     annotations except that they can be introspected at runtime using
     the *note __annotations__: 458. attribute.  The intent is to
     encourage experimentation through metaclasses, decorators or
     frameworks.

   * PEP 3102(2): キーワード専用引数。 パラメータリスト中で ‘*args’ のあ
     とに現れる名前付きパラメータは、呼び出す際には '必ず' キーワード引
     数の構文を使う必要があります (--訳注: ‘def fun(*a, kw):’ という定義
     で ‘fun(1, 2, 3)’ は NG で ‘fun(1, 2, kw=3)’ としなければならない。
     ここまでは 2.x と同じ --)。 この PEP により、可変引数リストを受け取
     らずにキーワード専用引数だけを許したい場合にそれを主張するために剥
     き出しの ‘*’ をパラメータリスト内に書けるようになりました (--訳注:
     ‘def fun(*, kw):’ と定義出来る。この定義では ‘fun(kw=1)’ としてしか
     呼び出せない。 ‘fun(1)’ はダメ。--)。

   * クラス定義内で、基底クラスのリストのあとでキーワード引数が許される
     ようになりました。これは metaclass を指定するための新しい規約 (次セ
     クション参照) に使われるものですが、 metaclass サポートだけのためだ
     けでなく他の目的に使うことも出来ます。

   * PEP 3104(3): *note nonlocal: 14bf. 文。 ‘nonlocal x’ を使うと外側の
     (ただしグローバルでない) スコープから、直接変数を代入することが出来
     るようになります。 ‘nonlocal’ は新しく予約語になりました。

   * PEP 3132(4): 拡張されたイテレータのアンパック。 ‘a, b, *rest =
     some_sequence’ のようなことを書けるようになりました。 ‘*rest, a =
     stuff’ も出来ます。 ‘rest’ オブジェクトは常に (空かもしれなくても)
     リストです; 右辺には任意のイテラブルを置けます。例えば:

          (a, *rest, b) = range(5)

     これは 'a' に ‘0’ を、 'b' に ‘4’ を、そして 'rest' に ‘[1, 2, 3]’
     をセットします。

   * 辞書内包表記: ‘{k: v for k, v in stuff}’ は ‘dict(stuff)’ と同じ意
     味ですが、より柔軟です。 (これは PEP 274(5) で支持されています。)

   * セットリテラル、例えば ‘{1, 2}’。‘{}’ は空の辞書であることに注意し
     てください。空のセットには ‘set()’ を使用してください。セットの内包
     表記もサポートされました。例えば ‘{x for x in stuff}’ は
     ‘set(stuff)’ と同じ意味ですが、より柔軟です。

   * 新たな8進数リテラル、e.g.  ‘0o720’ (2.6 で既にありました)。古い8進
     数リテラル (‘0720’) は廃止されました。

   * 新たなバイナリリテラル、e.g.  ‘0b1010’ (2.6 で既にありました) と、
     関連する新しい組み込み関数 *note bin(): 14c0. が導入されました。

   * ‘b’ または ‘B’ で始まるバイトリテラルと、関連する新しい組み込み関数
     *note bytes(): 192. が導入されました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3107/

   (2) https://peps.python.org/pep-3102/

   (3) https://peps.python.org/pep-3104/

   (4) https://peps.python.org/pep-3132/

   (5) https://peps.python.org/pep-0274/


File: python.info,  Node: 変更された構文,  Next: 削除された操作,  Prev: 新たな構文,  Up: 構文の変更の概要

1.15.2.2 変更された構文
.......................

   * PEP 3109(1) と PEP 3134(2): 新たな *note raise: 803. 文のシンタック
     ス: ‘raise [EXPR [from EXPR]]’。以下を参照してください。

   * ‘as’ と *note with: 186. は予約語になりました。 (実際には 2.6 から)

   * ‘True’、‘False’、および ‘None’ が予約語になりました。(2.6 では既に
     ‘None’ が部分的に制限されていました)

   * Change from *note except: 1ab. 'exc', 'var' to ‘except’ 'exc' ‘as’
     'var'.  See PEP 3110(3).

   * PEP 3115(4): 新たなメタクラスのシンタックス．以下の;

          class C:
              __metaclass__ = M
              ...

     代わりに次のようにしてください:

          class C(metaclass=M):
              ...

     The module-global ‘__metaclass__’ variable is no longer supported.
     (It was a crutch to make it easier to default to new-style classes
     without deriving every class from *note object: c7e.)

   * リスト内包表記はもう ‘[... for VAR in ITEM1, ITEM2, ...]’ という構
     文形をサポートしません。代わりに ‘[... for VAR in (ITEM1, ITEM2,
     ...)]’ を使用してください。また、リスト内包表記は異なるセマンティク
     スを持つことに注意してください。リスト内包表記は *note list(): 24d.
     コンストラクタ内のジェネレータ式の糖衣構文に近く、特にループの制御
     変数はスコープ外ではもう使用することができません。

   * 'ellipsis' (‘...’) はどこででも原子的な式として使うことが出来ます。
     (以前はスライス内でのみ許されていました。) また、‘...’ と書かなけれ
     ば 'ならなく' なりました。 (以前は文法の些細な偶然により ‘. . .’ と
     書くことも出来ました。)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3109/

   (2) https://peps.python.org/pep-3134/

   (3) https://peps.python.org/pep-3110/

   (4) https://peps.python.org/pep-3115/


File: python.info,  Node: 削除された操作,  Prev: 変更された構文,  Up: 構文の変更の概要

1.15.2.3 削除された操作
.......................

   * PEP 3113(1): タプル引数のアンパックが削除されました.  ‘def foo(a,
     (b, c)): ...’ のように書くことはできません。かわりに ‘def foo(a,
     b_c): b, c = b_c’ を使用してください。

   * バッククオートが削除されました (代わりに *note repr(): 1c1. を使用
     してください)。

   * ‘<>’ が削除されました (代わりに ‘!=’ を使用してください)。

   * 削除されたキーワード: *note exec(): 4a2. はキーワードでなくなりまし
     たが、関数として残りました。 (幸運にも関数のシンタックスは 2.x でも
     許容されています。) また、 *note exec(): 4a2. はストリーム引数を受
     け取らなくなりました。‘exec(f)’ の代わりに ‘exec(f.read())’ を使う
     ことができます。

   * ‘l’ または ‘L’ で終わる整数リテラルはサポートされません。

   * ‘u’ or ‘U’ で始まる文字列リテラルはサポートされません。(--訳注: こ
     の ‘u"..."’ は Python 3.3 で再び使えるようになりました。 --)

   * *note from: 14c3. 'module' *note import: 7f8. ‘*’ はモジュールレベ
     ルでのみ許され、関数内での使用は許されません。

   * 相対インポートに許される構文は ‘from .[MODULE] import NAME’ のみで
     す。 ‘.’ で始まらない形の全ての *note import: 7f8. は絶対インポート
     と解釈されます。 ( PEP 328(2))

   * 古い形式のクラスはサポートされません。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3113/

   (2) https://peps.python.org/pep-0328/


File: python.info,  Node: Python 2 6 で既にあった変更,  Next: ライブラリの変更,  Prev: 構文の変更の概要,  Up: What's New In Python 3 0

1.15.3 Python 2.6 で既にあった変更
----------------------------------

おそらく多くのユーザが一足飛びに Python 2.5 から Python 3.0 に移行しよう
とするでしょうから、このセクションでは、もともとは Python 3.0 のためにデ
ザインされたものの Python 2.6 にバックポートされた新機能について、読者に
思い出してもらいましょう。 *note What's New in Python 2.6: 14c5. 内の対
応するセクションにはもっと長い説明が書かれています。

   * *note PEP 343; "with" ステートメント: 14c6.  *note with: 186. 文は
     今では標準機能となったので、 *note __future__: 0. からインポートす
     る必要はもうありません。 *note コンテキストマネージャを書く: 14c7.
     と *note contextlib モジュール: 14c8. も見てください。

   * *note PEP 366; メインモジュールからの明示的相対インポート: 14c9.
     *note -m: 23c. オプションの有用性を強化します。パッケージ内にあるモ
     ジュールを参照している際に関係します。

   * *note PEP 370; ユーザごとの site-packages ディレクトリ: 14ca.

   * *note PEP 371; multiprocessing パッケージ: 14cb.

   * *note PEP 3101; 進化版文字列フォーマッティング: 14cc.  注意: 2.6 の
     記述では *note format(): 199. メソッドが 8 ビット文字列と Unicode 文
     字列両方について述べていますが、3.0 では *note str: 169. 型
     (Unicode サポートを持ったテキスト文字列) だけがこのメソッドをサポー
     トしています。 *note bytes: 192. 型にはありません。計画では最終的に
     はこれだけが唯一の文字列フォーマットの API になり、Python 3.1 では
     ‘%’ 演算子は非推奨扱いを開始する予定です。(-- 訳注: ‘%’ 演算子の撤
     廃は影響が大き過ぎるからか、現実には (ドキュメントでの軽い記述を除
     き) 実行時に特別に非推奨扱いされることは 3.5 になってさえもいまだあ
     りません。 --)

   * *note PEP 3105; print を関数にする: 14cd.  これはもはや標準機能とな
     ったので、 *note __future__: 0. からインポートする必要はありません
     。詳細はこのドキュメントの上の方に書いてあります。

   * *note PEP 3110; 例外処理の変更: 14ce.  The *note except: 1ab. 'exc'
     ‘as’ 'var' syntax is now standard and ‘except’ 'exc', 'var' is no
     longer supported.  (Of course, the ‘as’ 'var' part is still
     optional.)

   * *note PEP 3112; バイトリテラル: 14cf.  文字列リテラル ‘b"..."’ 表記
     (とそのお仲間 ‘b'...'’, ‘b"""..."""’, ‘br"..."’ など) は今では
     *note bytes: 192. 型です。

   * *note PEP 3116; 新しい I/O ライブラリ: 14d0.  The *note io: 83.
     module is now the standard way of doing file I/O. The built-in
     *note open(): 316. function is now an alias for *note io.open():
     740. and has additional keyword arguments 'encoding', 'errors',
     'newline' and 'closefd'.  Also note that an invalid 'mode' argument
     now raises *note ValueError: 2ec, not *note IOError: 125e.  The
     binary file object underlying a text file object can be accessed as
     ‘f.buffer’ (but beware that the text object maintains a buffer of
     itself in order to speed up the encoding and decoding operations).

   * *note PEP 3118; 改訂版バッファプロトコル: 14d1.  The old builtin
     ‘buffer()’ is now really gone; the new builtin *note memoryview():
     165. provides (mostly) similar functionality.

   * *note PEP 3119; 抽象基底クラス: 14d2.  The *note abc: 4. module and
     the ABCs defined in the *note collections: 1e. module plays a
     somewhat more prominent role in the language now, and built-in
     collection types like *note dict: 183. and *note list: 24d. conform
     to the *note collections.MutableMapping: 12c0. and *note
     collections.MutableSequence: 4bf. ABCs, respectively.

   * *note PEP 3127; 整数リテラルのサポートと文法: 14d3.  上述のとおり、
     新しい 8 進数リテラル表現だけが唯一の 8 進数リテラル表現となり、ま
     た、バイナリリテラルが追加されました。

   * *note PEP 3129; クラスデコレータ: 14d4.

   * *note PEP 3141; 数値の型階層: 14d5.  *note numbers: a2. が、もう一
     つの新しく ABC を使うモジュールで、Python の「数値塔 (numeric
     tower)」を定義しています。新しい *note fractions: 61. モジュールが
     *note numbers.Rational: 14d6. を実装していることにも注目してくださ
     い。


File: python.info,  Node: ライブラリの変更,  Next: PEP 3101 文字列整形の新たなアプローチ,  Prev: Python 2 6 で既にあった変更,  Up: What's New In Python 3 0

1.15.4 ライブラリの変更
-----------------------

時間の制約により、この文書は標準ライブラリの非常に幅広い変更について徹底
的に取り上げてはいません。 ライブラリの大きな変更については PEP 3108(1)
を参照してください。 ここでは要約を示します:

   * 多くの古いモジュールは削除されました。 ‘gopherlib’ (もう使われませ
     ん) や ‘md5’ (*note hashlib: 6c. に代替されました) 等のいくつかのモ
     ジュールは PEP 4(2) で既に廃止予定でした。 他のモジュールは、Irix、
     BeOS ならびに Mac OS 9 等のプラットフォームでのサポートが打ち切られ
     た ( PEP 11(3) 参照) ために削除されました。 いくつかのモジュールは
     使われなかったり、より良い代用品があるため Python 3.0 で削除されま
     した 網羅的なリストは PEP 3108(4) を参照してください。

   * The ‘bsddb3’ package was removed because its presence in the core
     standard library has proved over time to be a particular burden for
     the core developers due to testing instability and Berkeley DB's
     release schedule.  However, the package is alive and well,
     externally maintained at
     ‘https://www.jcea.es/programacion/pybsddb.htm’.

   * いくつかのモジュールは PEP 8(5) に従っていないか、その他の理由によ
     り名前が変更されました:

     以前の名前                  新しい名前
                                 
     --------------------------------------------------------
                                 
     _winreg                     winreg
                                 
                                 
     ConfigParser                configparser
                                 
                                 
     copy_reg                    copyreg
                                 
                                 
     Queue                       queue
                                 
                                 
     SocketServer                socketserver
                                 
                                 
     markupbase                  _markupbase
                                 
                                 
     repr                        reprlib
                                 
                                 
     test.test_support           test.support
                                 

   * A common pattern in Python 2.x is to have one version of a module
     implemented in pure Python, with an optional accelerated version
     implemented as a C extension; for example, *note pickle: ab. and
     ‘cPickle’.  This places the burden of importing the accelerated
     version and falling back on the pure Python version on each user of
     these modules.  In Python 3.0, the accelerated versions are
     considered implementation details of the pure Python versions.
     Users should always import the standard version, which attempts to
     import the accelerated version and falls back to the pure Python
     version.  The *note pickle: ab. / ‘cPickle’ pair received this
     treatment.  The *note profile: b4. module is on the list for 3.1.
     The ‘StringIO’ module has been turned into a class in the *note io:
     83. module.

   * 関連のあるモジュールのいくつかはパッケージにまとめられ、ふつうサブ
     モジュール名は単純化されました。結果として以下のようなパッケージが
     出来ました:

        * *note dbm: 35. (‘anydbm’, ‘dbhash’, ‘dbm’, ‘dumbdbm’, ‘gdbm’,
          ‘whichdb’).

        * *note html: 6f. (‘HTMLParser’, ‘htmlentitydefs’).

        * *note http: 72. (‘httplib’, ‘BaseHTTPServer’, ‘CGIHTTPServer’,
          ‘SimpleHTTPServer’, ‘Cookie’, ‘cookielib’).

        * *note tkinter: f6. (all ‘Tkinter’-related modules except *note
          turtle: 107.).  The target audience of *note turtle: 107.
          doesn't really care about *note tkinter: f6.  Also note that
          as of Python 2.6, the functionality of *note turtle: 107. has
          been greatly enhanced.

        * *note urllib: 10e. (‘urllib’, ‘urllib2’, ‘urlparse’,
          ‘robotparse’).

        * *note xmlrpc: 133. (‘xmlrpclib’, ‘DocXMLRPCServer’,
          ‘SimpleXMLRPCServer’).

PEP 3108(6) で取り上げられていない標準ライブラリーの他の変更:

   * Killed ‘sets’.  Use the built-in *note set(): 184. class.

   * Cleanup of the *note sys: df. module: removed ‘sys.exitfunc()’,
     ‘sys.exc_clear()’, ‘sys.exc_type’, ‘sys.exc_value’,
     ‘sys.exc_traceback’.  (Note that *note sys.last_type: 6e6. etc.
     remain.)

   * Cleanup of the *note array.array: 4be. type: the ‘read()’ and
     ‘write()’ methods are gone; use *note fromfile(): 14d8. and *note
     tofile(): 14d9. instead.  Also, the ‘'c'’ typecode for array is
     gone - use either ‘'b'’ for bytes or ‘'u'’ for Unicode characters.

   * Cleanup of the *note operator: a3. module: removed
     ‘sequenceIncludes()’ and ‘isCallable()’.

   * Cleanup of the ‘thread’ module: ‘acquire_lock()’ and
     ‘release_lock()’ are gone; use *note acquire(): 8a7. and *note
     release(): 14da. instead.

   * Cleanup of the *note random: bd. module: removed the ‘jumpahead()’
     API.

   * The ‘new’ module is gone.

   * The functions ‘os.tmpnam()’, ‘os.tempnam()’ and ‘os.tmpfile()’ have
     been removed in favor of the *note tempfile: e6. module.

   * *note tokenize: 101. モジュールはバイトでも機能するように変更されま
     した。メインのエントリポイントは generate_tokens から *note
     tokenize.tokenize(): 700. になりました。

   * ‘string.letters’ and its friends (‘string.lowercase’ and
     ‘string.uppercase’) are gone.  Use *note string.ascii_letters:
     14db. etc.  instead.  (The reason for the removal is that
     ‘string.letters’ and friends had locale-specific behavior, which is
     a bad idea for such attractively named global "constants".)

   * Renamed module ‘__builtin__’ to *note builtins: 13. (removing the
     underscores, adding an 's').  The ‘__builtins__’ variable found in
     most global namespaces is unchanged.  To modify a builtin, you
     should use *note builtins: 13, not ‘__builtins__’!

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3108/

   (2) https://peps.python.org/pep-0004/

   (3) https://peps.python.org/pep-0011/

   (4) https://peps.python.org/pep-3108/

   (5) https://peps.python.org/pep-0008/

   (6) https://peps.python.org/pep-3108/


File: python.info,  Node: PEP 3101 文字列整形の新たなアプローチ,  Next: 例外に関する変更,  Prev: ライブラリの変更,  Up: What's New In Python 3 0

'PEP 3101': 文字列整形の新たなアプローチ

   * 組み込みの新しい文字列書式化操作で、文字列の ‘%’ 演算子を置き換える
     ものです。(しかしながら ‘%’ 演算子はまだサポートされます; Python
     3.1 で非推奨となり、将来のいつかの時点で削除されます。) 完全な詳細
     は PEP 3101(1) をお読み下さい。 (-- 訳注: *note Python 2.6
     で既にあった変更: 14c4. での対応する記述に書いた訳注を参照。--)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3101/


File: python.info,  Node: 例外に関する変更,  Next: その他の変更<2>,  Prev: PEP 3101 文字列整形の新たなアプローチ,  Up: What's New In Python 3 0

1.15.6 例外に関する変更
-----------------------

例外の送出や捕捉を行う API は整理され、 強力な新機能が追加されました:

   * PEP 352(1): 全ての例外は (直接的にまたは間接的に) *note
     BaseException: 7d6. を継承しなければなりません。 *note
     BaseException: 7d6. は例外階層の根です。 これは勧告としては新しくあ
     りませんが、*note BaseException: 7d6. 継承の '要求' は新しいです。
     (Python 2.6 は依然として昔のクラスを送出するのを許容しており、捕捉
     するものについての制限はありません。) 結果として文字列例外は終に本
     当の意味で、完全になくなりました。

   * ほとんど全ての例外は、実際は *note Exception: bcd. を継承すべきです
     。 *note BaseException: 7d6. は最上位で扱われるべき例外、例えば
     *note SystemExit: f3c. や *note KeyboardInterrupt: bc5. の基底クラ
     スとしてのみ使われるべきでしす。上記カテゴリーを除く全ての例外を処
     理するのに推奨されるイディオムは *note except: 1ab. *note
     Exception: bcd. です。

   * ‘StandardError’ was removed.

   * Exceptions no longer behave as sequences.  Use the *note args: 78d.
     attribute instead.

   * PEP 3109(2): Raising exceptions.  You must now use ‘raise
     EXCEPTION(ARGS)’ instead of ‘raise EXCEPTION, ARGS’.  Additionally,
     you can no longer explicitly specify a traceback; instead, if you
     'have' to do this, you can assign directly to the *note
     __traceback__: 14de. attribute (see below).

   * PEP 3110(3): 例外の捕捉。 ‘except SOMEEXCEPTION, VARIABLE’ ではなく
     ‘except SOMEEXCEPTION as VARIABLE’ としなければなりません。 その上
     *note except: 1ab. ブロックがある場合 'variable' は明示的に削除され
     ます。

   * PEP 3134(4): Exception chaining.  There are two cases: implicit
     chaining and explicit chaining.  Implicit chaining happens when an
     exception is raised in an *note except: 1ab. or *note finally: 1b0.
     handler block.  This usually happens due to a bug in the handler
     block; we call this a 'secondary' exception.  In this case, the
     original exception (that was being handled) is saved as the *note
     __context__: 14df. attribute of the secondary exception.  Explicit
     chaining is invoked with this syntax:

          raise SecondaryException() from primary_exception

     (where 'primary_exception' is any expression that produces an
     exception object, probably an exception that was previously
     caught).  In this case, the primary exception is stored on the
     *note __cause__: 14e0. attribute of the secondary exception.  The
     traceback printed when an unhandled exception occurs walks the
     chain of ‘__cause__’ and *note __context__: 14df. attributes and
     prints a separate traceback for each component of the chain, with
     the primary exception at the top.  (Java users may recognize this
     behavior.)

   * PEP 3134(5): Exception objects now store their traceback as the
     *note __traceback__: 14de. attribute.  This means that an exception
     object now contains all the information pertaining to an exception,
     and there are fewer reasons to use *note sys.exc_info(): 89a.
     (though the latter is not removed).

   * Windows が拡張モジュールのロードに失敗したときの例外メッセージが少
     し改善しました。 例えば、‘error code 193’ は ‘%1 is not a valid
     Win32 application’ になりました。 文字列は英語でないロケールを扱え
     るようになりました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0352/

   (2) https://peps.python.org/pep-3109/

   (3) https://peps.python.org/pep-3110/

   (4) https://peps.python.org/pep-3134/

   (5) https://peps.python.org/pep-3134/


File: python.info,  Node: その他の変更<2>,  Next: ビルドならびに C API の変更<7>,  Prev: 例外に関する変更,  Up: What's New In Python 3 0

1.15.7 その他の変更
-------------------

* Menu:

* 演算子と特殊メソッド::
* 組み込み::


File: python.info,  Node: 演算子と特殊メソッド,  Next: 組み込み,  Up: その他の変更<2>

1.15.7.1 演算子と特殊メソッド
.............................

   * ‘!=’ は ‘==’ と逆の結果をかえします（‘==’ が *note NotImplemented:
     1a2. を返さなければ）。

   * 「非束縛メソッド (unbound methods)」という概念は言語から削除されま
     した。クラス属性としてのメソッドを参照しても今では普通の関数オブジ
     ェクトが得られます。

   * ‘__getslice__()’, ‘__setslice__()’ and ‘__delslice__()’ were
     killed.  The syntax ‘a[i:j]’ now translates to
     ‘a.__getitem__(slice(i, j))’ (or *note __setitem__(): 14e3. or
     *note __delitem__(): 14e4, when used as an assignment or deletion
     target, respectively).

   * PEP 3114(1): *note next(): 9d8. 標準メソッドは *note __next__():
     14e5. に改名されました。

   * The ‘__oct__()’ and ‘__hex__()’ special methods are removed - *note
     oct(): 14e6. and *note hex(): 14e7. use *note __index__(): 19e. now
     to convert the argument to an integer.

   * Removed support for ‘__members__’ and ‘__methods__’.

   * The function attributes named ‘func_X’ have been renamed to use the
     ‘__X__’ form, freeing up these names in the function attribute
     namespace for user-defined attributes.  To wit, ‘func_closure’,
     ‘func_code’, ‘func_defaults’, ‘func_dict’, ‘func_doc’,
     ‘func_globals’, ‘func_name’ were renamed to *note __closure__:
     14e8, *note __code__: 59d, *note __defaults__: 14e9, *note
     __dict__: 14ea, *note __doc__: 13f1, *note __globals__: 14eb, *note
     __name__: 14ec, respectively.

   * ‘__nonzero__()’ is now *note __bool__(): 14ed.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3114/


File: python.info,  Node: 組み込み,  Prev: 演算子と特殊メソッド,  Up: その他の変更<2>

1.15.7.2 組み込み
.................

   * PEP 3135(1): 新しくなった *note super(): 1a6. 。今では *note
     super(): 1a6. は引数なしで呼び出せます。(これが *note class: 14ef.
     内で定義される通常のインスタンスメソッド内であると仮定して) 正しい
     クラスとインスタンスが自動的に選択されます。引数ありの場合の *note
     super(): 1a6. の振る舞いには変更はありません。

   * PEP 3111(2): ‘raw_input()’ was renamed to *note input(): 14f0.
     That is, the new *note input(): 14f0. function reads a line from
     *note sys.stdin: 75f. and returns it with the trailing newline
     stripped.  It raises *note EOFError: 14f1. if the input is
     terminated prematurely.  To get the old behavior of *note input():
     14f0, use ‘eval(input())’.

   * 新しい組み込み関数 *note next(): 9d8. が追加されました。 オブジェク
     トの *note __next__(): 14e5. メソッドを呼び出します。

   * *note round(): 14f2. 関数の丸めの戦略と戻り値の型が変更されました。
     ど真ん中の場合に、四捨五入ではなく最近接偶数への丸めをするようにな
     りました。(例えば ‘round(2.5)’ は今では ‘2’ を返します。 ‘3’ ではな
     く。) (--訳注: 丸めモードについては Wikipedia(3) 参照。--)
     ‘round(x[, n])’ は常に浮動小数点数の結果を返す代わりに、
     ‘x.__round__([n])’ に処理を委譲するようになりました。これは一般的に
     、単一引数で呼ばれた際に整数を返し、二つの引数で呼ばれた場合は ‘x’
     と同じ型の値として返します。

   * Moved ‘intern()’ to *note sys.intern(): 14f3.

   * Removed: ‘apply()’.  Instead of ‘apply(f, args)’ use ‘f(*args)’.

   * Removed *note callable(): 13de.  Instead of ‘callable(f)’ you can
     use ‘isinstance(f, collections.Callable)’.  The
     ‘operator.isCallable()’ function is also gone.

   * Removed ‘coerce()’.  This function no longer serves a purpose now
     that classic classes are gone.

   * Removed ‘execfile()’.  Instead of ‘execfile(fn)’ use
     ‘exec(open(fn).read())’.

   * Removed the ‘file’ type.  Use *note open(): 316.  There are now
     several different kinds of streams that open can return in the
     *note io: 83. module.

   * Removed ‘reduce()’.  Use *note functools.reduce(): 21a. if you
     really need it; however, 99 percent of the time an explicit *note
     for: 34a. loop is more readable.

   * Removed ‘reload()’.  Use ‘imp.reload()’.

   * Removed.  ‘dict.has_key()’ - use the *note in: 34b. operator
     instead.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3135/

   (2) https://peps.python.org/pep-3111/

   (3) https://en.wikipedia.org/wiki/Rounding#Tie-breaking


File: python.info,  Node: ビルドならびに C API の変更<7>,  Next: 性能,  Prev: その他の変更<2>,  Up: What's New In Python 3 0

1.15.8 ビルドならびに C API の変更
----------------------------------

時間がないため、以下のC APIへの変更点のリストは 'かなり' 不完全です。

   * Mac OS 9, BeOS, RISCOS, Irix, Tru64 に限らず、いくつものプラットフ
     ォームのサポートが打ち切られました。

   * PEP 3118(1): 新たなバッファ API。

   * PEP 3121(2): 例外モジュールの初期化と最終化

   * PEP 3123(3): *note PyObject_HEAD: 14f5. を標準的な C に一致。

   * 制限付き実行 の C API サポートはこれ以上されません。

   * ‘PyNumber_Coerce()’, ‘PyNumber_CoerceEx()’, ‘PyMember_Get()’, and
     ‘PyMember_Set()’ C APIs are removed.

   * 新たな C API *note PyImport_ImportModuleNoBlock(): 3db.、*note
     PyImport_ImportModule(): 3dc. のように動きますが、インポートロック
     でブロックしません (代わりにエラーを返します)。

   * ブール変換の C 水準のスロットとメソッドがリネームされました:
     ‘nb_nonzero’ が ‘nb_bool’ になりました。

   * Removed ‘METH_OLDARGS’ and ‘WITH_CYCLE_GC’ from the C API.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3118/

   (2) https://peps.python.org/pep-3121/

   (3) https://peps.python.org/pep-3123/


File: python.info,  Node: 性能,  Next: Python 3 0 への移植,  Prev: ビルドならびに C API の変更<7>,  Up: What's New In Python 3 0

1.15.9 性能
-----------

3.0 の可搬化 (generalization) による正味の結果は、Python 3.0 を pystone
ベンチマークすると Python 2.5 より 10% 遅くなる、というものでした。これ
はどうやら小さい整数についての特殊処理を削除したことに一番大きな要因があ
るようです。これには改善の余地がありますが、それは 3.0 リリース以降でし
ょう!


File: python.info,  Node: Python 3 0 への移植,  Prev: 性能,  Up: What's New In Python 3 0

1.15.10 Python 3.0 への移植
---------------------------

(--訳注: 今では独立したクックブック pyporting-howto があるのでそちらをご
覧下さい。--) 既存の Python 2.5 や 2.6 のソースコードを Python 3.0 に移
植する最良の策は以下の通りです:

  0. (必須:) 優秀なテストカバレッジから始めてください。

  1. Python 2.6 に移植します。Python 2.x を Python 2.(x+1) に移植する普
     通の作業以上のことをしてはいけません。確実に全てのテストを通してく
     ださい。

  2. (まだ 2.6 を使います:) コマンドラインに ‘-3’ オプションを渡します。
     これは 3.0 で削除された (または変更された) 機能についての警告発行を
     有効にします。再びテストスイートを実行して、そして警告が出たコード
     をそれがなくなるまで修正し、全てのテストをパスさせます。

  3. Run the ‘2to3’ source-to-source translator over your source code
     tree.  Run the result of the translation under Python 3.0.
     Manually fix up any remaining issues, fixing problems until all
     tests pass again.

Python 2.6 と 3.0 両方で変更なしに動作するコードを書こうとすることはお奨
め出来ません; それをするととても捻じ曲がったコーディングスタイルを使う必
要があるでしょう。例えば ‘print’ やメタクラスを避けたりとかそんな。
Python 2.6 と 3.0 両バージョンともに対するサポートを必要とするライブラリ
を保守しているのであれば、最良のアプローチは上記スリーステップを修正して
、2.6 版のソースコードを編集して ‘2to3’ する、を繰り返すことです。これは
3.0 版のソースコードを編集するより良いです。(--訳注: ここで言っているこ
とは正論なのですが、 ‘2to3’ は「Python 3 では動くが Python 2 では動かな
い (かもしれない)」ものを生成します。2016 時点でも Python 2.7 はかなり元
気 (予定では 2020 年までは公式にサポートされる) ですので両バージョン (た
だし今だと 2.7 と 3.2 以降) で変更なしで動作するものを必要とすることは、
残念ながらまだ多いでしょう (あなたが作っているのがライブラリであるならば
)。これについては pyporting-howto に少し書かれています。 --)

C 拡張を Python 3.0 に移植するには、 *note Python 3
への拡張モジュール移植: 14f8. を参照してください。


File: python.info,  Node: What's New in Python 2 7,  Next: What's New in Python 2 6,  Prev: What's New In Python 3 0,  Up: What's New in Python

1.16 What's New in Python 2.7
=============================


著者: A.M. Kuchling (amk at amk.ca)

この文書は Python 2.7 の新機能について解説します。Python 2.7 は 2010 年
7 月 3 日にリリースされました。

数値周りの扱いが、浮動小数点数でも *note Decimal: 1fe. クラスでもいろい
ろな点で改良されました、標準ライブラリにいくつかの有用な追加が行われまし
た。 *note unittest: 10c. モジュールが大幅に改良され、コマンドラインオプ
ション解析の *note argparse: 7. モジュールが追加され、 *note
collections: 1e. モジュールに便利な *note OrderedDict: 7f3. と *note
Counter: 12a3. が追加され、他にもたくさんの改良が行われています。

Python 2.7 は 2.x の最終リリースになることが予定されているので、私たちは
このリリースを長期にわたって良いものになるように努力してきました。Python
3 への移植を助けるため、いくつかの新機能が Python 3.x から Python 2.7 に
取り込まれています。

このドキュメントは新機能の完全な詳細を提供するのではなくて、簡易な概要を
提供することを目的にしています。完全な詳細が知りたければ、
‘https://docs.python.org’ の Python 2.7 のドキュメントを参照してください
。設計と実装の根拠を理解したい場合は、新機能に関する PEP を参照するか、
‘https://bugs.python.org’ に議論したい機能について登録してください。可能
な限り、 "What's New in Python" は各変更の bug や patch に対してリンクし
ています。

* Menu:

* Python 2.x の今後: Python 2 x の今後.
* Deprecation Warnings の扱いの変更::
* Python 3.1 の機能: Python 3 1 の機能.
* PEP 372; collections に順序付き辞書を追加: PEP 372 collections に順序付き辞書を追加.
* PEP 378; 1000区切りのための書式指定子: PEP 378 1000区切りのための書式指定子<2>.
* PEP 389; コマンドライン解析のための argparse モジュール: PEP 389 コマンドライン解析のための argparse モジュール.
* PEP 391; logging の辞書ベースの設定: PEP 391 logging の辞書ベースの設定<2>.
* PEP 3106; 辞書 View: PEP 3106 辞書 View.
* PEP 3137; memoryview オブジェクト: PEP 3137 memoryview オブジェクト.
* その他の言語変更: その他の言語変更<14>.
* 新しいモジュールと改良されたモジュール::
* ビルドならびに C API の変更: ビルドならびに C API の変更<8>.
* その他の変更と修正::
* Python 2.7 への移植: Python 2 7 への移植.
* Python 2.7 メンテナンスリリースで追加された新機能: Python 2 7 メンテナンスリリースで追加された新機能.
* 謝辞::


File: python.info,  Node: Python 2 x の今後,  Next: Deprecation Warnings の扱いの変更,  Up: What's New in Python 2 7

1.16.1 Python 2.x の今後
------------------------

Python 2.7 は 2.x シリーズの最後のメジャーリリースになります。Python の
メンテナは既に Python 3.x シリーズへの新機能の開発に焦点をシフトしていま
す。Python 2 は今後もバグフィックスを受け容れ、新しいハードウェアやサポ
ートしている OS のバージョンでのビルドが出来るように保つ一方で、言語や標
準ライブラリの新しい完全な機能のリリースは行いません。

しかしながら、Python 2.7 と Python 3 の間の共通の大きなサブセットがあっ
て、その共通サブセットあるいは直接的に Python 3 のものへの移行に伴う多く
の変更が安全に自動的に行える一方で、その他の変更(Unicode の扱いに関係す
るものに顕著ですが)入念な検討を必要とし、移行を有効に行うためには堅牢な
回帰テストスイートが望まれることでしょう。

これは Python 2.7 が長期間に渡って依然として有効であり、安定性と、Python
3 がいまだに移植されていないような製品システムのベースプラットフォームの
サポートを提供し続けることを意味しています。Python 2.7 シリーズに望まれ
ているライフサイクルについての完全な詳細は、 PEP 373(1) に記述されていま
す。

2.7 が長期的に重要なリリースになるので、いくつかの結論があります:

   * 上述のように、 2.7 リリースは以前の 2.x バージョンに較べて遥かに長
     期間のメンテナンスとなります。Python 2.7 は現在では、最低でも 2020
     年までコア開発チームによって(セキュリティアップデートやほかのバグフ
     ィックスの)サポートがなされ続けることが求められています(最初のリリ
     ースから 10 年後です。普通であれば 18-24 ヶ月なのに)。

   * Python 2.7 標準ライブラリが年老いていくに従い、(直接であれ再配布で
     あれ) Python Package Index の効果的な利用が Python 2 ユーザにとって
     ますます重要になっています。さまざまなタスクをこなすありとあらゆる
     サードパーティパッケージに加え、Python 2 互換の、Python 3 標準ライ
     ブラリからバックポートした新しいモジュールや機能を含むパッケージ、
     Python 3 への移行を容易にするための様々なツールやライブラリが入手出
     来ます。Python Packaging User Guide(2) は Python Package Index から
     ソフトウェアをダウンロード・インストールする際のガイダンスです。

   * Python 2 を拡張するための望ましいアプローチは現在では Python
     Package Index に新しいパッケージを公開することである一方で、このア
     プローチが全てのケースで求められるわけではありません。特にそれがネ
     ットワークセキュリティに関係している場合には。PyPI に新規もしくは更
     新パッケージを公開することでは十分ではない例外的なケースにおいては
     、Python 2 標準ライブラリに直接新機能を追加するために Python
     Enhancement Proposal プロセスが使われるでしょう。そのような追加の全
     てと、それらが追加されたメンテナンスリリースは、下の方の *note
     Python 2.7 メンテナンスリリースで追加された新機能: 14fe. セクション
     で言及されます。

Python 2 から Python 3 へ乗り換えたいと望むプロジェクトあるいはPython 2
と Python 3 両方のユーザをサポートしたいと願うライブラリやフレームワーク
の開発者向けに、さまざまなツールやガイドがあります。これらは、相応しいア
プローチを決めたりある種複雑な技術的詳細の管理をする手助けとなるでしょう
。まず手始めには pyporting-howto HOWTO ガイドをご覧になることをお奨めし
ます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0373/

   (2) https://packaging.python.org


File: python.info,  Node: Deprecation Warnings の扱いの変更,  Next: Python 3 1 の機能,  Prev: Python 2 x の今後,  Up: What's New in Python 2 7

1.16.2 Deprecation Warnings の扱いの変更
----------------------------------------

Python 2.7 では開発者向けの警告をデフォルトで抑止するポリシーが取られま
した。 *note DeprecationWarning: 1a3. とそれを継承した警告は、指定されな
い限りは無視され、アプリケーションのユーザーがその警告を見ないですむよう
になりました。この変更は Python 3.2 ブランチにも適用されました。
(stdlib-sig で討議され、 bpo-7319(1) になりました)

以前のリリースでは、 *note DeprecationWarning: 1a3. メッセージはデフォル
トで有効になっており、 Python 開発者に、将来のバージョンの Python でその
コードのどこが動かなくなるかを明確に知らせていました。

しかし、 Python で開発されたアプリケーションの利用者であって開発には携わ
っていない人がどんどん増えてきました。 *note DeprecationWarning: 1a3. メ
ッセージはそれらのユーザーには無関係で、彼らをアプリケーションが本当に正
しく動いているのか不安にさせ、ユーザーの質問に応えるための開発者の負担も
増やしていました。

*note DeprecationWarning: 1a3. メッセージの表示を有効にするには、 *note
-Wdefault: ac6. (短い形式: *note -Wd: ac6.) スイッチか、Python を実行す
る前に *note PYTHONWARNINGS: da3. 環境変数を ‘"default"’ (か、 ‘"d"’)に
設定します。 Python コードから有効にする場合は
‘warnings.simplefilter('default')’ とします。

‘unittest’ モジュールもテスト実行時に自動的に deprecation warnings を有
効にします。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=7319


File: python.info,  Node: Python 3 1 の機能,  Next: PEP 372 collections に順序付き辞書を追加,  Prev: Deprecation Warnings の扱いの変更,  Up: What's New in Python 2 7

1.16.3 Python 3.1 の機能
------------------------

Python 2.6 は Python 3.0 から多くの機能を取り込み、Python 2.7 は Python
3.1 の新しい機能のいくつかを取り込みました。2.x シリーズは 3.x シリーズ
への移行のためのツールを提供し続けています。

Python 2.7 に取り込まれた 3.1 の機能の不完全なリスト:

   * 集合のリテラル文法 (‘{1,2,3}’ は mutable set になります)

   * 辞書と集合の内包表記 (‘{i: i*2 for i in range(3)}’).

   * 1つの *note with: 186. 文で複数のコンテキストマネージャを扱えるよう
     に。

   * *note io: 83. ライブラリの新バージョン。パフォーマンスのためにC言語
     で描き直されています。

   * *note PEP 372; collections に順序付き辞書を追加: 1501. で解説されて
     いる順序付き辞書

   * *note PEP 378; 1000区切りのための書式指定子: 1502. で解説されている
     新しい ‘","’ フォーマット指定子

   * *note memoryview: 165. オブジェクト

   * *note importlib: 7b. モジュールの小さいサブセット。 *note
     下に説明があります: 1503.

   * float ‘x’ の *note repr(): 1c1. が多くの場合に短くなりました。これ
     は ‘x’ に戻せることが保証される最小の10進文字列です。以前のバージョ
     ンの Python では、 ‘float(repr(x))’ が ‘x’ になることだけが保証され
     ていました。

   * float から文字列、文字列から float への変換が正しく丸められるように
     なりました。 *note round(): 14f2. 関数も正しく丸めるようになりまし
     た。

   * 拡張モジュールが C API を提供するための、 *note PyCapsule: 148a. 型

   * *note PyLong_AsLongAndOverflow(): 147d. C API 関数

新しい Python3 モード Warning:

   * ‘operator.isCallable()’ と ‘operator.sequenceIncludes()’ は 3.x で
     はサポートされず、警告が表示されます。

   * ‘-3’ スイッチは、整数または長整数での古い除算方式を使用した場合に警
     告を出力するようになる ‘-Qwarn’ スイッチを有効にするようになりまし
     た。


File: python.info,  Node: PEP 372 collections に順序付き辞書を追加,  Next: PEP 378 1000区切りのための書式指定子<2>,  Prev: Python 3 1 の機能,  Up: What's New in Python 2 7

1.16.4 PEP 372: collections に順序付き辞書を追加
------------------------------------------------

通常の Python 辞書は、 key/value ペアを不定の順序でイテレートします。何
年にもわたり、いろいろな人が key の挿入順を保存する辞書の別実装を書いて
きました。その経験に基づき、 2.7 は *note collections: 1e. モジュールに
新しい *note OrderedDict: 7f3. クラスを追加しました。

*note OrderedDict: 7f3. API は通常の辞書と同じインターフェースを提供して
いますが、 key/value をイテレートするときに key が最初に挿入された順番に
なることが保証されています。

     >>> from collections import OrderedDict
     >>> d = OrderedDict([('first', 1),
     ...                  ('second', 2),
     ...                  ('third', 3)])
     >>> d.items()
     [('first', 1), ('second', 2), ('third', 3)]

新しいエントリが既存のエントリを上書きした場合は、元の挿入順序が保持され
ます。:

     >>> d['second'] = 4
     >>> d.items()
     [('first', 1), ('second', 4), ('third', 3)]

エントリを削除して再挿入すると、順序は一番最後に移動します。:

     >>> del d['second']
     >>> d['second'] = 5
     >>> d.items()
     [('first', 1), ('third', 3), ('second', 5)]

*note popitem(): 1505. メソッドは、オプションの 'last' 引数を持ち、でフ
ォルトで ‘True’ になっています。 'last' が真の場合、一番最近に追加された
key が返され、削除されます。偽の場合、最も古い key が選ばれます:

     >>> od = OrderedDict([(x,0) for x in range(20)])
     >>> od.popitem()
     (19, 0)
     >>> od.popitem()
     (18, 0)
     >>> od.popitem(last=False)
     (0, 0)
     >>> od.popitem(last=False)
     (1, 0)

2つの順序付き辞書を比較するときは、key/value だけでなく、挿入順も比較さ
れます。:

     >>> od1 = OrderedDict([('first', 1),
     ...                    ('second', 2),
     ...                    ('third', 3)])
     >>> od2 = OrderedDict([('third', 3),
     ...                    ('first', 1),
     ...                    ('second', 2)])
     >>> od1 == od2
     False
     >>> # Move 'third' key to the end
     >>> del od2['third']; od2['third'] = 3
     >>> od1 == od2
     True

*note OrderedDict: 7f3. を通常の辞書と比較すると、挿入順は無視されて単に
key/value だけが比較されます。

How does the *note OrderedDict: 7f3. work?  It maintains a doubly linked
list of keys, appending new keys to the list as they're inserted.  A
secondary dictionary maps keys to their corresponding list node, so
deletion doesn't have to traverse the entire linked list and therefore
remains 'O'(1).

標準ライブラリのいくつかのモジュールで、順序付き辞書の利用がサポートされ
ています。

   * The *note ConfigParser: 26. module uses them by default, meaning
     that configuration files can now be read, modified, and then
     written back in their original order.

   * The *note _asdict(): bd4. method for *note
     collections.namedtuple(): 4e0. now returns an ordered dictionary
     with the values appearing in the same order as the underlying tuple
     indices.

   * The *note json: 86. module's *note JSONDecoder: f43. class
     constructor was extended with an 'object_pairs_hook' parameter to
     allow ‘OrderedDict’ instances to be built by the decoder.  Support
     was also added for third-party tools like PyYAML(1).

参考
....

PEP 372(2) - collections に順序付き辞書を追加

     PEP written by Armin Ronacher and Raymond Hettinger; implemented by
     Raymond Hettinger.

   ---------- Footnotes ----------

   (1) https://pyyaml.org/

   (2) https://peps.python.org/pep-0372/


File: python.info,  Node: PEP 378 1000区切りのための書式指定子<2>,  Next: PEP 389 コマンドライン解析のための argparse モジュール,  Prev: PEP 372 collections に順序付き辞書を追加,  Up: What's New in Python 2 7

1.16.5 PEP 378: 1000区切りのための書式指定子
--------------------------------------------

大きい数値に区切り文字を追加して、18446744073709551616 の代わりに
18,446,744,073,709,551,616 と出力すると、プログラムの出力を読みやすくで
きます。

これを行う一般的な方法は *note locale: 8a. モジュールを使うことで、複数
の区切り文字 (北米では "," で、ヨーロッパでは ".")  を使ったり、複数のグ
ループの大きさを使うことができます。しかし、 *note locale: 8a. の利用方
法は複雑ですし、スレッドごとに異なるロケールの出力を行うプログラムでは利
用することができません。

そのため、シンプルなカンマによるグループ化機構が *note str.format():
833. メソッドのミニ言語に追加されました。浮動小数点数をフォーマットする
場合、シンプルにカンマを幅と精度の間に置きます。

     >>> '{:20,.2f}'.format(18446744073709551616.0)
     '18,446,744,073,709,551,616.00'

整数をフォーマットする場合は、幅の後にカンマを追加します。

     >>> '{:20,d}'.format(18446744073709551616)
     '18,446,744,073,709,551,616'

この機構は全く柔軟性を持っていません。区切り文字は常にカンマですし、グル
ープは常に数字3つになります。カンマ書式機構は *note locale: 8a. ほど汎用
ではありませんが、手軽に使うことができます。

参考
....

PEP 378(1) - 1000区切りのための書式指定子

     PEP written by Raymond Hettinger; implemented by Eric Smith.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0378/


File: python.info,  Node: PEP 389 コマンドライン解析のための argparse モジュール,  Next: PEP 391 logging の辞書ベースの設定<2>,  Prev: PEP 378 1000区切りのための書式指定子<2>,  Up: What's New in Python 2 7

1.16.6 PEP 389: コマンドライン解析のための argparse モジュール
--------------------------------------------------------------

コマンドライン引数の解析のための *note argparse: 7. モジュールが、 *note
optparse: a4. モジュールのより強力な代替として追加されました。

This means Python now supports three different modules for parsing
command-line arguments: *note getopt: 65, *note optparse: a4, and *note
argparse: 7.  The *note getopt: 65. module closely resembles the C
library's ‘getopt()’ function, so it remains useful if you're writing a
Python prototype that will eventually be rewritten in C. *note optparse:
a4. becomes redundant, but there are no plans to remove it because there
are many scripts still using it, and there's no automated way to update
these scripts.  (Making the *note argparse: 7. API consistent with *note
optparse: a4.'s interface was discussed but rejected as too messy and
difficult.)

古いバージョンの Python との互換性を気にすること無く新しいスクリプトを書
く時は、 *note optparse: a4. の代わりに *note argparse: 7. を使ってくだ
さい。

以下はこの使用例です:

     import argparse

     parser = argparse.ArgumentParser(description='Command-line example.')

     # Add optional switches
     parser.add_argument('-v', action='store_true', dest='is_verbose',
                         help='produce verbose output')
     parser.add_argument('-o', action='store', dest='output',
                         metavar='FILE',
                         help='direct output to FILE instead of stdout')
     parser.add_argument('-C', action='store', type=int, dest='context',
                         metavar='NUM', default=0,
                         help='display NUM lines of added context')

     # Allow any number of additional arguments.
     parser.add_argument(nargs='*', action='store', dest='inputs',
                         help='input filenames (default is stdin)')

     args = parser.parse_args()
     print args.__dict__

オーバーライドしない限り、 ‘-h’ と ‘--help’ スイッチが自動的に追加され、
綺麗にフォーマットした出力を生成します。

     -> ./python.exe argparse-example.py --help
     usage: argparse-example.py [-h] [-v] [-o FILE] [-C NUM] [inputs [inputs ...]]

     Command-line example.

     positional arguments:
       inputs      input filenames (default is stdin)

     optional arguments:
       -h, --help  show this help message and exit
       -v          produce verbose output
       -o FILE     direct output to FILE instead of stdout
       -C NUM      display NUM lines of added context

*note optparse: a4. と同じく、コマンドラインスイッチと引数は、 'dest' 引
数の名前の属性をもったオブジェクトとして返されます。

     -> ./python.exe argparse-example.py -v
     {'output': None,
      'is_verbose': True,
      'context': 0,
      'inputs': []}

     -> ./python.exe argparse-example.py -v -o /tmp/output -C 4 file1 file2
     {'output': '/tmp/output',
      'is_verbose': True,
      'context': 4,
      'inputs': ['file1', 'file2']}

*note argparse: 7. は *note optparse: a4. よりも多くの便利なバリデーショ
ンを持っています。引数の正確な数を整数で指定したり、 ‘'*'’ で0以上の数を
指定したり、 ‘'+'’ で1以上の数を指定したり、 ‘'?'’ でオプションにしたり
できます。トップレベルのパーサーはサブパーサーを持つことができ、 ‘svn
commit’, ‘svn checkout’ のように異なるオプションを持ったサブコマンドを定
義できます。引数のタイプに *note FileType: 30c. を指定することで、自動で
ファイルを開き、 ‘'-'’ が指定されたときに標準入出力だと判断することがで
きます。

参考
....

*note argparse: 7. のドキュメント

     argparse モジュールのドキュメント

*note Migrating optparse code to argparse: 13c6.

     *note optparse: a4. を使うコードを変換する方法を説明した Python の
     ドキュメントの一部

PEP 389(1) - argparse コマンドライン解析モジュール

     PEP written and implemented by Steven Bethard.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0389/


File: python.info,  Node: PEP 391 logging の辞書ベースの設定<2>,  Next: PEP 3106 辞書 View,  Prev: PEP 389 コマンドライン解析のための argparse モジュール,  Up: What's New in Python 2 7

1.16.7 PEP 391: logging の辞書ベースの設定
------------------------------------------

*note logging: 8b. モジュールは非常に柔軟です。アプリケーションは
logging のサブシステムのツリーを定義できます。このツリーの各ロガーはいく
つかのメッセージをフィルターし、異なるフォーマットを行い、メッセージを沢
山の種類のハンドラーに渡します。

All this flexibility can require a lot of configuration.  You can write
Python statements to create objects and set their properties, but a
complex set-up requires verbose but boring code.  *note logging: 8b.
also supports a *note fileConfig(): d48. function that parses a file,
but the file format doesn't support configuring filters, and it's
messier to generate programmatically.

Python 2.7 adds a *note dictConfig(): 13c8. function that uses a
dictionary to configure logging.  There are many ways to produce a
dictionary from different sources: construct one with code; parse a file
containing JSON; or use a YAML parsing library if one is installed.  For
more information see *note 環境設定のための関数: 1509.

以下は、2つのロガー、 root logger と "network" という名前の logger を設
定する例です。root logger に送られたメッセージは syslog プロトコルを利用
してシステムログに送られ、 "network" logger に送られたメッセージは 1 MB
ごとにローテートされる ‘network.log’ ファイルに書きこまれます。

     import logging
     import logging.config

     configdict = {
      'version': 1,    # Configuration schema in use; must be 1 for now
      'formatters': {
          'standard': {
              'format': ('%(asctime)s %(name)-15s '
                         '%(levelname)-8s %(message)s')}},

      'handlers': {'netlog': {'backupCount': 10,
                          'class': 'logging.handlers.RotatingFileHandler',
                          'filename': '/logs/network.log',
                          'formatter': 'standard',
                          'level': 'INFO',
                          'maxBytes': 1000000},
                   'syslog': {'class': 'logging.handlers.SysLogHandler',
                              'formatter': 'standard',
                              'level': 'ERROR'}},

      # Specify all the subordinate loggers
      'loggers': {
                  'network': {
                              'handlers': ['netlog']
                  }
      },
      # Specify properties of the root logger
      'root': {
               'handlers': ['syslog']
      },
     }

     # Set up configuration
     logging.config.dictConfig(configdict)

     # As an example, log two error messages
     logger = logging.getLogger('/')
     logger.error('Database not found')

     netlogger = logging.getLogger('network')
     netlogger.error('Connection failed')

他にも、 *note logging: 8b. モジュールには Vinary Sajip によって実装され
た 3 つの改良があります。

   * *note SysLogHandler: 86c. クラスは TCP 経由の syslog をサポートしま
     す。コンストラクタの 'socktype' 引数は使用するソケットの種類として
     、 UDP を使う *note socket.SOCK_DGRAM: 150a. と TCP を使う *note
     socket.SOCK_STREAM: 150b. のどちらかを取ります。デフォルトはUDPのま
     まです。

   * *note Logger: d46. インスタンスに *note getChild(): 150c. メソッド
     が追加されました。これは、相対パスで下位の logger を返します。 例え
     ば、 ‘log = getLogger('app')’ として logger を取得した後、
     ‘log.getChild('network.listen')’ は
     ‘getLogger('app.network.listen')’ と同じになります。

   * The *note LoggerAdapter: 150d. class gained an *note
     isEnabledFor(): 150e. method that takes a 'level' and returns
     whether the underlying logger would process a message of that level
     of importance.

参考
....

PEP 391(1) - logging の辞書ベースの設定

     PEP written and implemented by Vinay Sajip.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0391/


File: python.info,  Node: PEP 3106 辞書 View,  Next: PEP 3137 memoryview オブジェクト,  Prev: PEP 391 logging の辞書ベースの設定<2>,  Up: What's New in Python 2 7

1.16.8 PEP 3106: 辞書 View
--------------------------

辞書の *note keys(): 9d0, *note values(): 9d1, *note items(): 9d2. メソ
ッドは Python 3.x では動作が代わり、完全に実体化されたリストの代わりに、
'view' と呼ばれるオブジェクトを返すようになりました。

It's not possible to change the return values of *note keys(): 9d0,
*note values(): 9d1, and *note items(): 9d2. in Python 2.7 because too
much code would break.  Instead the 3.x versions were added under the
new names ‘viewkeys()’, ‘viewvalues()’, and ‘viewitems()’.

     >>> d = dict((i*10, chr(65+i)) for i in range(26))
     >>> d
     {0: 'A', 130: 'N', 10: 'B', 140: 'O', 20: ..., 250: 'Z'}
     >>> d.viewkeys()
     dict_keys([0, 130, 10, 140, 20, 150, 30, ..., 250])

View はイテレートするだけでなく、set と似た利用をすることもできます。‘&’
演算子で共通部分集合を、‘|’ 演算子で話集合を取ることができます。

     >>> d1 = dict((i*10, chr(65+i)) for i in range(26))
     >>> d2 = dict((i**.5, i) for i in range(1000))
     >>> d1.viewkeys() & d2.viewkeys()
     set([0.0, 10.0, 20.0, 30.0])
     >>> d1.viewkeys() | range(0, 30)
     set([0, 1, 130, 3, 4, 5, 6, ..., 120, 250])

view は辞書とその辞書の変化に追随しています。:

     >>> vk = d.viewkeys()
     >>> vk
     dict_keys([0, 130, 10, ..., 250])
     >>> d[260] = '&'
     >>> vk
     dict_keys([0, 130, 260, 10, ..., 250])

ただし、view をイテレートしている間に key の追加や削除ができないことに気
を付けてください。:

     >>> for k in vk:
     ...     d[k*2] = k
     ...
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     RuntimeError: dictionary changed size during iteration

Python 2.x で view メソッドを利用すると、 2to3 が自動的にそれを通常の
*note keys(): 9d0, *note values(): 9d1, *note items(): 9d2. メソッドに書
き換えてくれます。

参考
....

PEP 3106(1) - Revamping dict.keys(), .values() and .items()

     PEP written by Guido van Rossum.  Backported to 2.7 by Alexandre
     Vassalotti; bpo-1967(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3106/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1967


File: python.info,  Node: PEP 3137 memoryview オブジェクト,  Next: その他の言語変更<14>,  Prev: PEP 3106 辞書 View,  Up: What's New in Python 2 7

1.16.9 PEP 3137: memoryview オブジェクト
----------------------------------------

*note memoryview: 165. オブジェクトは、他のオブジェクトのメモリの内容に
対する *note bytes: 192. 型のインターフェースに合わせた view を提供しま
す。

     >>> import string
     >>> m = memoryview(string.letters)
     >>> m
     <memory at 0x37f850>
     >>> len(m)           # Returns length of underlying object
     52
     >>> m[0], m[25], m[26]   # Indexing returns one byte
     ('a', 'z', 'A')
     >>> m2 = m[0:26]         # Slicing returns another memoryview
     >>> m2
     <memory at 0x37f080>

view の内容は bytes 型の文字列か整数のリストに変換することができます。

     >>> m2.tobytes()
     'abcdefghijklmnopqrstuvwxyz'
     >>> m2.tolist()
     [97, 98, 99, 100, 101, 102, 103, ... 121, 122]
     >>>

*note memoryview: 165. オブジェクトは、対象となる背後のオブジェクトが変
更可能 (mutable) な場合は、その変更を許可しています。

     >>> m2[0] = 75
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: cannot modify read-only memory
     >>> b = bytearray(string.letters)  # Creating a mutable object
     >>> b
     bytearray(b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
     >>> mb = memoryview(b)
     >>> mb[0] = '*'         # Assign to view, changing the bytearray.
     >>> b[0:5]              # The bytearray has been changed.
     bytearray(b'*bcde')
     >>>

参考
....

PEP 3137(1) - Immutable Bytes and Mutable Buffer

     PEP written by Guido van Rossum.  Implemented by Travis Oliphant,
     Antoine Pitrou and others.  Backported to 2.7 by Antoine Pitrou;
     bpo-2396(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3137/

   (2) https://bugs.python.org/issue?@action=redirect&bpo=2396


File: python.info,  Node: その他の言語変更<14>,  Next: 新しいモジュールと改良されたモジュール,  Prev: PEP 3137 memoryview オブジェクト,  Up: What's New in Python 2 7

1.16.10 その他の言語変更
------------------------

Python 言語コアに小さな変更がいくつか行われました:

   * set リテラルのためのシンタックスが Python 3.x からバックポートされ
     ました。内容を波括弧で囲うと mutable set になります。dict リテラル
     との区別は、コロンと value が存在しないことで行われます。なので、
     ‘{}’ は引き続き空の dict になります。空の set を作るときには
     ‘set()’ を使ってください。

          >>> {1, 2, 3, 4, 5}
          set([1, 2, 3, 4, 5])
          >>> set() # empty set
          set([])
          >>> {}    # empty dict
          {}

     Backported by Alexandre Vassalotti; bpo-2335(1).

   * dict と set の内包表記も Python 3.x からバックポートされました。
     list と generator の内包表記を set と dict にも使えるように一般化さ
     せています。

          >>> {x: x*x for x in range(6)}
          {0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
          >>> {('a'*x) for x in range(6)}
          set(['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa'])

     Backported by Alexandre Vassalotti; bpo-2333(2).

   * *note with: 186. 文が1つの文で複数のコンテキストマネージャーを使え
     るようになりました。コンテキストマネージャーは左から右へ処理され、
     それぞれが新しい ‘with’ 文の開始となるように扱われます。つまり:

          with A() as a, B() as b:
              ... suite of statements ...

     は、以下と同じです

          with A() as a:
              with B() as b:
                  ... suite of statements ...

     The ‘contextlib.nested()’ function provides a very similar
     function, so it's no longer necessary and has been deprecated.

     (Proposed in ‘https://codereview.appspot.com/53094’; implemented by
     Georg Brandl.)

   * 浮動小数点数と文字列の間の変換がほとんどのプラットフォームで正しく
     丸められるようになりました。この変換はいろいろな場面で発生します:
     float 型や complex 型に対する *note str(): 169. 関数の適用、 *note
     float: 196. や *note complex: 197. コンストラクタ、数値フォーマット
     、 *note marshal: 91, *note pickle: ab, *note json: 86. モジュール
     を使ってのシリアライズとデシリアライズ、 Python コード中の float や
     imaginary リテラルの解析、 *note Decimal: 1fe. から float への変換
     などです。

     これに関連して、浮動小数点数 'x' の *note repr(): 1c1. は、
     (round-half-to-even 丸めモードで)正しく丸め処理をした場合に元の 'x'
     に戻せる最小の 10進文字列になりました。以前は 'x' を17桁の10進文字
     列に丸めていました。

     丸めライブラリが、この改善が Windows や gcc, icc, suncc を使った
     Unix 環境で動かす役目をおっています。このライブラリの正確な動作が保
     証できない少しの環境があるので、そういったシステムではこのライブラ
     リは利用されません。 *note sys.float_repr_style: 1512. が ‘short’ な
     ら新しいコードが利用されていて、 ‘legacy’ なら利用されていません。

     Implemented by Eric Smith and Mark Dickinson, using David Gay's
     ‘dtoa.c’ library; bpo-7117(3).

   * 多倍長整数や通常の整数から浮動小数点への変換でも丸め処理が変更され
     、元の数に一番近い浮動小数点値が返されるようになりました。これは浮
     動小数点へ完全に変換できる小さい整数では問題になりませんが、桁数に
     対して精度がどうしても足りない場合に関係します。Python 2.7 はより正
     確に近似するようになりました。例えば、Python 2.6 では次のように計算
     されていました:

          >>> n = 295147905179352891391
          >>> float(n)
          2.9514790517935283e+20
          >>> n - long(float(n))
          65535L

     Python 2.7 の浮動小数点への変換結果は元の数値より大きくなりますが、
     元の値により近くなっています:

          >>> n = 295147905179352891391
          >>> float(n)
          2.9514790517935289e+20
          >>> n - long(float(n))
          -1L

     (Implemented by Mark Dickinson; bpo-3166(4).)

     この丸めの動作により、整数同士の true division (‘from __future__
     import division’) の結果もより正確になりました。 (Also implemented
     by Mark Dickinson; bpo-1811(5).)

   * Implicit coercion for complex numbers has been removed; the
     interpreter will no longer ever attempt to call a ‘__coerce__()’
     method on complex objects.  (Removed by Meador Inge and Mark
     Dickinson; bpo-5211(6).)

   * *note str.format(): 833. メソッドは置換フィールドに対する自動ナンバ
     リングをサポートするようになりました。これにより *note
     str.format(): 833. をより ‘%s’ と同じように使えるようになりました。

          >>> '{}:{}:{}'.format(2009, 04, 'Sunday')
          '2009:4:Sunday'
          >>> '{}:{}:{day}'.format(2009, 4, day='Sunday')
          '2009:4:Sunday'

     自動ナンバリングは左のフィールドから右のフィールドへと行われるので
     、最初の ‘{...}’ 指定は *note str.format(): 833. メソッドの最初の引
     数を利用し、次の指定は次の引数を利用します。自動ナンバリングと明示
     的なナンバリングを混ぜて使うことはできず、全ての置換指定に手動でナ
     ンバリングするか、全てを自動ナンバリングに任せなければなりません。
     ただし、上の例の2つめのように、自動ナンバリングと名前フィールドを混
     ぜて使うことは可能です。 (Contributed by Eric Smith; bpo-5237(7).)

     複素数が *note format(): 199. をサポートするようになりました。デフ
     ォルトでは右寄せになります。精度やカンマ区切りの指定は、実部と虚部
     のそれぞれに対して適用されます。アラインの指定は ‘1.5+3j’ のような
     複素数全体に対して適用されます。 (Contributed by Eric Smith;
     bpo-1588(8) and bpo-7988(9).)

     'F' 書式符号は常に大文字を使って出力するようになり、 'INF' や 'NAN'
     が出力されるようになりました。 (Contributed by Eric Smith;
     bpo-3382(10).)

     A low-level change: the *note object.__format__(): 831. method now
     triggers a *note PendingDeprecationWarning: ac5. if it's passed a
     format string, because the ‘__format__()’ method for *note object:
     c7e. converts the object to a string representation and formats
     that.  Previously the method silently applied the format string to
     the string representation, but that could hide mistakes in Python
     code.  If you're supplying formatting information such as an
     alignment or precision, presumably you're expecting the formatting
     to be applied in some object-specific way.  (Fixed by Eric Smith;
     bpo-7994(11).)

   * The *note int(): 19b. and ‘long()’ types gained a ‘bit_length’
     method that returns the number of bits necessary to represent its
     argument in binary:

          >>> n = 37
          >>> bin(n)
          '0b100101'
          >>> n.bit_length()
          6
          >>> n = 2**123-1
          >>> n.bit_length()
          123
          >>> (n+1).bit_length()
          124

     (Contributed by Fredrik Johansson and Victor Stinner;
     bpo-3439(12).)

   * *note import: 7f8. 文が、絶対インポート (例: ‘from .os import
     sep’)が失敗したときに相対インポートを試さなくなりました。これはバグ
     修正ですが、いままでたまたま動いていただけの ‘import’ 文を動かなく
     してしまう可能性があります。(Fixed by Meador Inge; bpo-7902(13).)

   * It's now possible for a subclass of the built-in ‘unicode’ type to
     override the ‘__unicode__()’ method.  (Implemented by Victor
     Stinner; bpo-1583863(14).)

   * *note bytearray: 344. 型の *note translate(): 1513. メソッドが第一
     引数に ‘None’ を受け入れるようになりました。 (Fixed by Georg
     Brandl; bpo-4759(15).)

   * When using *note @classmethod: 48e. and *note @staticmethod: 453.
     to wrap methods as class or static methods, the wrapper object now
     exposes the wrapped function as their *note __func__: 1514.
     attribute.  (Contributed by Amaury Forgeot d'Arc, after a
     suggestion by George Sakkis; bpo-5982(16).)

   * ‘__slots__’ を利用して属性を制限した場合に、設定されていない属性を
     del したときに *note AttributeError: 5f0. にならなかったのを修正し
     ました。 (Fixed by Benjamin Peterson; bpo-7604(17).)

   * 2つの新しいエンコーディングが追加されました: "cp720" は主にアラビア
     文字に使われます。 "cp858" は cp850 の一種ですが、ユーロ記号を追加
     しています。 (CP720 contributed by Alexander Belchenko and Amaury
     Forgeot d'Arc in bpo-1616979(18); CP858 contributed by Tim Hatch in
     bpo-8016(19).)

   * The ‘file’ object will now set the ‘filename’ attribute on the
     *note IOError: 125e. exception when trying to open a directory on
     POSIX platforms (noted by Jan Kaliszewski; bpo-4764(20)), and now
     explicitly checks for and forbids writing to read-only file objects
     instead of trusting the C library to catch and report the error
     (fixed by Stefan Krah; bpo-5677(21)).

   * Python の字句解析機は改行をそれ自身に変換するようになりました。それ
     により、組み込みの *note compile(): 4b1. 関数がどの改行コードを利用
     したコードでも受け付けるようになりました。また、コードの終端の改行
     も不要になりました。

   * 関数宣言中の余分な丸括弧は Python 3.x では不正になりました。つまり
     、 ‘def f((x)): pass’ はsyntax errorになります。 Python3 警告モード
     では、 Python 2.7 はこの利用方法について警告を出すようになりました
     。 (Noted by James Lingard; bpo-7362(22).)

   * 古いスタイルのクラスのオブジェクトに対して弱参照を作れるようになり
     ました。新スタイルクラスには以前から弱参照を利用できます。(Fixed by
     Antoine Pitrou; bpo-8268(23).)

   * モジュールオブジェクトがGCされたとき、モジュールの辞書は、他にその
     辞書への参照を持っているものがない場合にのみクリアされるようになり
     ました。(bpo-7140(24)).

* Menu:

* インタプリタの変更::
* 最適化: 最適化<14>.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=2335

   (2) https://bugs.python.org/issue?@action=redirect&bpo=2333

   (3) https://bugs.python.org/issue?@action=redirect&bpo=7117

   (4) https://bugs.python.org/issue?@action=redirect&bpo=3166

   (5) https://bugs.python.org/issue?@action=redirect&bpo=1811

   (6) https://bugs.python.org/issue?@action=redirect&bpo=5211

   (7) https://bugs.python.org/issue?@action=redirect&bpo=5237

   (8) https://bugs.python.org/issue?@action=redirect&bpo=1588

   (9) https://bugs.python.org/issue?@action=redirect&bpo=7988

   (10) https://bugs.python.org/issue?@action=redirect&bpo=3382

   (11) https://bugs.python.org/issue?@action=redirect&bpo=7994

   (12) https://bugs.python.org/issue?@action=redirect&bpo=3439

   (13) https://bugs.python.org/issue?@action=redirect&bpo=7902

   (14) https://bugs.python.org/issue?@action=redirect&bpo=1583863

   (15) https://bugs.python.org/issue?@action=redirect&bpo=4759

   (16) https://bugs.python.org/issue?@action=redirect&bpo=5982

   (17) https://bugs.python.org/issue?@action=redirect&bpo=7604

   (18) https://bugs.python.org/issue?@action=redirect&bpo=1616979

   (19) https://bugs.python.org/issue?@action=redirect&bpo=8016

   (20) https://bugs.python.org/issue?@action=redirect&bpo=4764

   (21) https://bugs.python.org/issue?@action=redirect&bpo=5677

   (22) https://bugs.python.org/issue?@action=redirect&bpo=7362

   (23) https://bugs.python.org/issue?@action=redirect&bpo=8268

   (24) https://bugs.python.org/issue?@action=redirect&bpo=7140


File: python.info,  Node: インタプリタの変更,  Next: 最適化<14>,  Up: その他の言語変更<14>

1.16.10.1 インタプリタの変更
............................

新しい環境変数 *note PYTHONWARNINGS: da3. を使って警告を制御できるように
なりました。この環境変数には、 *note -W: ac6. スイッチに使われる警告の設
定を、カンマ区切りの文字列として指定します。 (Contributed by Brian
Curtin; bpo-7301(1).)

For example, the following setting will print warnings every time they
occur, but turn warnings from the *note Cookie: 75. module into an
error.  (The exact syntax for setting an environment variable varies
across operating systems and shells.)

     export PYTHONWARNINGS=all,error:::Cookie:0

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=7301


File: python.info,  Node: 最適化<14>,  Prev: インタプリタの変更,  Up: その他の言語変更<14>

1.16.10.2 最適化
................

いくつかの場面でパフォーマンスが向上しています。

   * A new opcode was added to perform the initial setup for *note with:
     186. statements, looking up the *note __enter__(): 7e4. and *note
     __exit__(): 1518. methods.  (Contributed by Benjamin Peterson.)

   * たくさんのオブジェクトを開放せずに確保していくという、よくある使い
     方の 1つにおいて、GCのパフォーマンスが向上しました。以前はこの場合
     にGCにかかる時間はオブジェクトの数の2乗に比例していました。現在はフ
     ルGCの数は増えたヒープ上のオブジェクトの数に比例しています。新しい
     方式では、3世代中2世代目に対するGCが10回実行されたうえで、 2世代目
     から3世代目に移ったオブジェクトの数が3世代目のオブジェクトの数の
     10%を超えたときにフルGCが発生します。(Suggested by Martin von Löwis
     and implemented by Antoine Pitrou; bpo-4074(1).)

   * GCが循環参照になりえないシンプルなコンテナ型の追跡を避けるようにな
     りました。 Python 2.7 では、アトミックな型(整数、文字列など)のみを
     含むタプルと辞書は追跡されません。推移的に、アトミックな型のみを含
     むタプルを含む辞書も、同じく追跡されません。これにより、GCによって
     巡回されチェックされるオブジェクトの数が減るので、 GCのコストを減ら
     すことができます。 (Contributed by Antoine Pitrou; bpo-4688(2).)

   * Long integers are now stored internally either in base ‘2**15’ or
     in base ‘2**30’, the base being determined at build time.
     Previously, they were always stored in base ‘2**15’.  Using base
     ‘2**30’ gives significant performance improvements on 64-bit
     machines, but benchmark results on 32-bit machines have been mixed.
     Therefore, the default is to use base ‘2**30’ on 64-bit machines
     and base ‘2**15’ on 32-bit machines; on Unix, there's a new
     configure option ‘--enable-big-digits’ that can be used to override
     this default.

     Apart from the performance improvements this change should be
     invisible to end users, with one exception: for testing and
     debugging purposes there's a new structseq ‘sys.long_info’ that
     provides information about the internal format, giving the number
     of bits per digit and the size in bytes of the C type used to store
     each digit:

          >>> import sys
          >>> sys.long_info
          sys.long_info(bits_per_digit=30, sizeof_digit=4)

     (Contributed by Mark Dickinson; bpo-4258(3).)

     その他の変更により、多倍長整数オブジェクトのサイズは数バイト小さく
     なりました。 32bit システムでは 2byte, 64bit システムでは 6byte 小
     さくなりました。 (Contributed by Mark Dickinson; bpo-5260(4).)

   * 多倍長整数の除算アルゴリズムが、内部のループの軽量化や乗算からシフ
     ト演算への置き換え、不要なイテレーションの削除により高速化されまし
     た。いくつかのベンチマークによると、多倍長整数の剰余演算は 50% から
     150% 高速化されています。 (Contributed by Mark Dickinson;
     bpo-5512(5).)  ビット演算も高速化されています。(initial patch by
     Gregory Smith; bpo-1087418(6))

   * ‘%’ の実装が、左側のオペランドが文字列型かどうかをチェックしてその
     場合の処理を特殊化しました。これにより文字列に対して ‘%’ を頻繁に使
     う、テンプレートライブラリなどのアプリケーションのパフォーマンスが
     1-3%向上します。 (Implemented by Collin Winter; bpo-5176(7).)

   * ‘if’ 条件付きのリスト内包表記がより高速なバイトコードにコンパイルさ
     れるようになりました。(Patch by Antoine Pitrou, back-ported to 2.7
     by Jeffrey Yasskin; bpo-4715(8).)

   * 整数や多倍長整数から10進文字列への変換を、任意の基数をサポートした
     汎用の変換関数を使う代わりに10進数に特殊化した処理を行うことで高速
     化しました。 (Patch by Gawain Bolton; bpo-6713(9).)

   * The ‘split()’, ‘replace()’, ‘rindex()’, ‘rpartition()’, and
     ‘rsplit()’ methods of string-like types (strings, Unicode strings,
     and *note bytearray: 344. objects) now use a fast reverse-search
     algorithm instead of a character-by-character scan.  This is
     sometimes faster by a factor of 10.  (Added by Florent Xicluna;
     bpo-7462(10) and bpo-7622(11).)

   * The *note pickle: ab. and ‘cPickle’ modules now automatically
     intern the strings used for attribute names, reducing memory usage
     of the objects resulting from unpickling.  (Contributed by Jake
     McGuire; bpo-5084(12).)

   * The ‘cPickle’ module now special-cases dictionaries, nearly halving
     the time required to pickle them.  (Contributed by Collin Winter;
     bpo-5670(13).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=4074

   (2) https://bugs.python.org/issue?@action=redirect&bpo=4688

   (3) https://bugs.python.org/issue?@action=redirect&bpo=4258

   (4) https://bugs.python.org/issue?@action=redirect&bpo=5260

   (5) https://bugs.python.org/issue?@action=redirect&bpo=5512

   (6) https://bugs.python.org/issue?@action=redirect&bpo=1087418

   (7) https://bugs.python.org/issue?@action=redirect&bpo=5176

   (8) https://bugs.python.org/issue?@action=redirect&bpo=4715

   (9) https://bugs.python.org/issue?@action=redirect&bpo=6713

   (10) https://bugs.python.org/issue?@action=redirect&bpo=7462

   (11) https://bugs.python.org/issue?@action=redirect&bpo=7622

   (12) https://bugs.python.org/issue?@action=redirect&bpo=5084

   (13) https://bugs.python.org/issue?@action=redirect&bpo=5670


File: python.info,  Node: 新しいモジュールと改良されたモジュール,  Next: ビルドならびに C API の変更<8>,  Prev: その他の言語変更<14>,  Up: What's New in Python 2 7

1.16.11 新しいモジュールと改良されたモジュール
----------------------------------------------

全てのリリースに置いて、 Python の標準ライブラリはたくさんの改良とバグ修
正がされてきました。ここでは一部の注目に値する変更を、モジュール名で辞書
順ソートしてリストアップしています。もっと完全な変更リストが見たければ、
ソースツリー内の ‘Misc/NEWS’ ファイルか、全ての完全な詳細が入っている
Subversion のログを参照してください。

   * *note bdb: 10. モジュールの基底デバッガクラス *note Bdb: 2d5. に、
     モジュールをスキップする機能が追加されました。コンストラクタは
     ‘django.*’ のような glob スタイルのパターンをもった iterable を引数
     として受け取ります。デバッガはパターンのどれかにマッチするスタック
     フレームにステップインしません。 (Contributed by Maru Newby after a
     suggestion by Senthil Kumaran; bpo-5142(1).)

   * *note binascii: 11. モジュールが buffer API をサポートするようにな
     り、 *note memoryview: 165. インスタンスやその他のバッファオブジェ
     クトともに利用できるようになりました。 (Backported from 3.x by
     Florent Xicluna; bpo-7703(2).)

   * Updated module: the ‘bsddb’ module has been updated from
     4.7.2devel9 to version 4.8.4 of the pybsddb package(3).  The new
     version features better Python 3.x compatibility, various bug
     fixes, and adds several new BerkeleyDB flags and methods.  (Updated
     by Jesús Cea Avión; bpo-8156(4).  The pybsddb changelog can be read
     at ‘https://hg.jcea.es/pybsddb/file/tip/ChangeLog’.)

   * *note bz2: 14. モジュールの *note BZ2File: a66. がコンテキストマネ
     ージャープロトコルをサポートするようになりました。これにより、
     ‘with bz2.BZ2File(...) as f:’ といった書き方ができます。
     (Contributed by Hagen Fürstenau; bpo-3860(5).)

   * *note collections: 1e. モジュールの新しい *note Counter: 12a3. クラ
     スは、データの数え上げをするときに便利です。 *note Counter: 12a3. イ
     ンスタンスは辞書のように振る舞いますが、キーが存在しなかったときに
     *note KeyError: 5e7. 例外を発生させる代わりに 0 を返します。

          >>> from collections import Counter
          >>> c = Counter()
          >>> for letter in 'here is a sample of english text':
          ...   c[letter] += 1
          ...
          >>> c
          Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2,
          'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1,
          'p': 1, 'r': 1, 'x': 1})
          >>> c['e']
          5
          >>> c['z']
          0

     *note Counter: 12a3. には追加の3つのメソッドがあります。 *note
     most_common(): 151a. はカウントが最も多い N 要素とそのカウントを返
     します。 *note elements(): 151b. はカウントしている要素を、そのカウ
     ント数だけ繰り返すイテレータを返します。 *note subtract(): 13f7. は
     イテレート可能型を受け取り、その各要素を足すのではなく引いて行きま
     す。引数が辞書か他の ‘Counter’ だった場合は、そのカウントが引かれま
     す。

          >>> c.most_common(5)
          [(' ', 6), ('e', 5), ('s', 3), ('a', 2), ('i', 2)]
          >>> c.elements() ->
             'a', 'a', ' ', ' ', ' ', ' ', ' ', ' ',
             'e', 'e', 'e', 'e', 'e', 'g', 'f', 'i', 'i',
             'h', 'h', 'm', 'l', 'l', 'o', 'n', 'p', 's',
             's', 's', 'r', 't', 't', 'x'
          >>> c['e']
          5
          >>> c.subtract('very heavy on the letter e')
          >>> c['e']    # Count is now lower
          -1

     Contributed by Raymond Hettinger; bpo-1696199(6).

     新しいクラス *note OrderedDict: 7f3. はすでに *note PEP 372;
     collections に順序付き辞書を追加: 1501. で紹介しました。

     メソッドが追加されました。*note deque: 7f4. データ型の *note
     count(): 13f9. メソッドは、引数で指定された 'x' と等しい要素が何個
     入っているかを返します。 *note reverse(): 13fa. メソッドは deque 内
     の要素をインプレースで逆順にします。 *note deque: 7f4. はまた、最大
     長を返す読み出し専用の属性 *note maxlen: 151c. を持ちます。 (Both
     features added by Raymond Hettinger.)

     *note namedtuple: 4e0. クラスにオプションの 'rename' 引数が追加され
     ました。 'rename' が真のとき、複数回現れたり Python の識別子として
     許可されないために無効なフィールド名があったとき、フィールドのリス
     ト内での場所に基づく有効なフィールド名に置き換えられます。

          >>> from collections import namedtuple
          >>> T = namedtuple('T', ['field1', '$illegal', 'for', 'field2'], rename=True)
          >>> T._fields
          ('field1', '_1', '_2', 'field2')

     (Added by Raymond Hettinger; bpo-1818(7).)

     Finally, the *note Mapping: ac7. abstract base class now returns
     *note NotImplemented: 1a2. if a mapping is compared to another type
     that isn't a ‘Mapping’.  (Fixed by Daniel Stutzbach; bpo-8729(8).)

   * Constructors for the parsing classes in the *note ConfigParser: 26.
     module now take an 'allow_no_value' parameter, defaulting to false;
     if true, options without values will be allowed.  For example:

          >>> import ConfigParser, StringIO
          >>> sample_config = """
          ... [mysqld]
          ... user = mysql
          ... pid-file = /var/run/mysqld/mysqld.pid
          ... skip-bdb
          ... """
          >>> config = ConfigParser.RawConfigParser(allow_no_value=True)
          >>> config.readfp(StringIO.StringIO(sample_config))
          >>> config.get('mysqld', 'user')
          'mysql'
          >>> print config.get('mysqld', 'skip-bdb')
          None
          >>> print config.get('mysqld', 'unknown')
          Traceback (most recent call last):
            ...
          NoOptionError: No option 'unknown' in section: 'mysqld'

     (Contributed by Mats Kindahl; bpo-7005(9).)

   * Deprecated function: ‘contextlib.nested()’, which allows handling
     more than one context manager with a single *note with: 186.
     statement, has been deprecated, because the ‘with’ statement now
     supports multiple context managers.

   * The *note cookielib: 74. module now ignores cookies that have an
     invalid version field, one that doesn't contain an integer value.
     (Fixed by John J. Lee; bpo-3924(10).)

   * *note copy: 29. モジュールの *note deepcopy(): d65. 関数が、束縛ず
     みインスタンスメソッドを正しくコピーするようになりました。
     (Implemented by Robert Collins; bpo-1515(11).)

   * *note ctypes: 2e. モジュールが、ポインタとして宣言された引数に対し
     て ‘None’ が渡された場合常に C の ‘NULL’ ポインタに変換するようにな
     りました。(Changed by Thomas Heller; bpo-4606(12).)  根底の、
     libffi ライブラリ(13) がバージョン 3.0.9 にアップデートされ、いくつ
     かのプラットフォームにおけるいろいろな問題が修正されました。
     (Updated by Matthias Klose; bpo-8142(14).)

   * 新しいメソッド: *note datetime: 34. モジュールの *note timedelta:
     bc3. クラスに *note total_seconds(): 151d. メソッドが追加されました
     。これはその期間の秒数を返します。(Contributed by Brian Quinlan;
     bpo-5788(15).)

   * New method: the *note Decimal: 1fe. class gained a *note
     from_float(): 141d. class method that performs an exact conversion
     of a floating-point number to a ‘Decimal’.  This exact conversion
     strives for the closest decimal approximation to the floating-point
     representation's value; the resulting decimal value will therefore
     still include the inaccuracy, if any.  For example,
     ‘Decimal.from_float(0.1)’ returns
     ‘Decimal('0.1000000000000000055511151231257827021181583404541015625')’.
     (Implemented by Raymond Hettinger; bpo-4796(16).)

     Comparing instances of *note Decimal: 1fe. with floating-point
     numbers now produces sensible results based on the numeric values
     of the operands.  Previously such comparisons would fall back to
     Python's default rules for comparing objects, which produced
     arbitrary results based on their type.  Note that you still cannot
     combine ‘Decimal’ and floating point in other operations such as
     addition, since you should be explicitly choosing how to convert
     between float and ‘Decimal’.  (Fixed by Mark Dickinson;
     bpo-2531(17).)

     *note Decimal: 1fe. のコンストラクタが浮動小数点数を受け入れるよう
     になりました。 (added by Raymond Hettinger; bpo-8257(18)) また、ア
     ラビア・インド数字などの、ヨーロッパ以外の Unicode 文字も受け入れる
     ようになりました。 (contributed by Mark Dickinson; bpo-6595(19)).

     *note Context: 12c3. クラスのほとんどのメソッドが *note Decimal:
     1fe. インスタンスと同じく整数を受け入れるようになりました。例外は
     *note canonical(): 151e. と *note is_canonical(): 151f. メソッドだ
     けです。 (Patch by Juan José Conti; bpo-7633(20).)

     *note Decimal: 1fe. インスタンスを文字列の *note format(): 833. メ
     ソッドで利用した場合、デフォルトのアライメントが左揃えから、数値型
     に適した右揃えに変更されました。 (Changed by Mark Dickinson;
     bpo-6857(21).)

     signaling NaN (あるいは ‘sNAN’) との比較は、暗黙に比較演算に応じて
     真偽値を返すのではなく、 *note InvalidOperation: 12bc. 例外を発生さ
     せるようになりました。 Quiet NaN (あるいは ‘NAN’) はハッシュ可能に
     なりました。 (Fixed by Mark Dickinson; bpo-7279(22).)

   * *note difflib: 3b. モジュールの出力が、ファイル名を含むヘッダのセパ
     レータにスペースではなくタブ文字を使うようになり、最近の
     ‘diff’/‘patch’ ツールとの互換性が高くなりました。(Fixed by Anatoly
     Techtonik; bpo-7585(23).)

   * Distutils ‘sdist’ コマンドが、 ‘MANIFEST.in’ や ‘setup.py’ ファイル
     が変更されていなくても、ユーザーが作成したかもしれない新しいファイ
     ルが含まれるようにするために、毎回 ‘MANIFEST’ ファイルを再生成する
     ようになりました。 (Fixed by Tarek Ziadé; bpo-8688(24).)

   * The *note doctest: 3e. module's *note IGNORE_EXCEPTION_DETAIL:
     1520. flag will now ignore the name of the module containing the
     exception being tested.  (Patch by Lennart Regebro; bpo-7490(25).)

   * The *note email: 3f. module's *note Message: 581. class will now
     accept a Unicode-valued payload, automatically converting the
     payload to the encoding specified by ‘output_charset’.  (Added by
     R.  David Murray; bpo-1368247(26).)

   * *note Fraction: 213. クラスが、コンストラクタの引数として、 1つの
     float 値、 *note Decimal: 1fe. インスタンス、 2つの有理数を受け入れ
     るようになりました。(Implemented by Mark Dickinson; rationals added
     in bpo-5812(27), and float/decimal in bpo-8294(28).)

     fraction と complex 数の間の順序比較演算 (‘<’, ‘<=’, ‘>’, ‘>=’)が
     *note TypeError: 198. 例外を発生させるようになりました。これは過失
     を修正し、 *note Fraction: 213. を他の数値型とマッチさせます。

   * 新しいクラス: *note FTP_TLS: af7. が *note ftplib: 62. に追加されま
     した。認証とその後の制御・データ転送をTLSカプセル化することでセキュ
     アなFTP接続を提供します。 (Contributed by Giampaolo Rodola;
     bpo-2054(29).)

     バイナリデータのアップロードを行う *note storbinary(): 1521. に
     'rest' 引数が追加され、アップロードのリスタートができるようになりま
     した。 (patch by Pablo Mouzo; bpo-6845(30).)

   * New class decorator: *note total_ordering(): 1144. in the *note
     functools: 63. module takes a class that defines an *note __eq__():
     cf2. method and one of *note __lt__(): 14b8, *note __le__(): 1522,
     *note __gt__(): 1523, or *note __ge__(): 1524, and generates the
     missing comparison methods.  Since the ‘__cmp__()’ method is being
     deprecated in Python 3.x, this decorator makes it easier to define
     ordered classes.  (Added by Raymond Hettinger; bpo-5479(31).)

     新しい関数: *note cmp_to_key(): 13f2. 関数は、古いスタイルの2引数を
     受け取る比較関数を受け取り、 *note sorted(): dc7, *note min():
     110b, *note max(): 110c. などの 'key' 引数に利用できる呼び出し可能
     オブジェクトを返します。この関数の主な目的は、古いコードを Python
     3.x へ対応させるのを手助けすることです。(Added by Raymond
     Hettinger.)

   * 新しい関数: *note gc: 64. モジュールに *note is_tracked(): 1525. 関
     数が追加されました。渡されたオブジェクトがGCに追跡されている場合に
     True を、そうでない場合に False を返します。 (Contributed by
     Antoine Pitrou; bpo-4688(32).)

   * *note gzip: 6b. モジュールの *note GzipFile: 65c. がコンテキストマ
     ネージャープロトコルをサポートしました。 ‘with gzip.GzipFile(...)
     as f:’ と書くことができます。(contributed by Hagen Fürstenau;
     bpo-3860(33) また、 *note io.BufferedIOBase: 8a3. ABC を実装してい
     ます。なので、より高速な処理のために *note io.BufferedReader: 1427.
     でラップすることができます。 (contributed by Nir Aides;
     bpo-7471(34)).  さらに、コンストラクタにオプションのタイムスタンプ
     を指定することで、 gzip ファイル内の変更時間レコードをオーバーライ
     ドすることができるようになりました。 (Contributed by Jacques
     Frechet; bpo-4272(35).)

     gzip ファイルフォーマットのファイルは最後にゼロバイトによるパディン
     グができるようになりました。 *note gzip: 6b. モジュールは末尾のゼロ
     バイトを消費します。(Fixed by Tadek Pietraszek and Brian Curtin;
     bpo-2846(36).)

   * New attribute: the *note hashlib: 6c. module now has an
     ‘algorithms’ attribute containing a tuple naming the supported
     algorithms.  In Python 2.7, ‘hashlib.algorithms’ contains ‘('md5',
     'sha1', 'sha224', 'sha256', 'sha384', 'sha512')’.  (Contributed by
     Carl Chenet; bpo-7418(37).)

   * The default *note HTTPResponse: 12e5. class used by the *note
     httplib: 72. module now supports buffering, resulting in much
     faster reading of HTTP responses.  (Contributed by Kristján Valur
     Jónsson; bpo-4879(38).)

     The *note HTTPConnection: d35. and *note HTTPSConnection: d36.
     classes now support a 'source_address' parameter, a ‘(host, port)’
     2-tuple giving the source address that will be used for the
     connection.  (Contributed by Eldon Ziegler; bpo-3972(39).)

   * The ‘ihooks’ module now supports relative imports.  Note that
     ‘ihooks’ is an older module for customizing imports, superseded by
     the ‘imputil’ module added in Python 2.0.  (Relative import support
     added by Neil Schemenauer.)

   * *note imaplib: 78. モジュールが IPv6 アドレスをサポートするようにな
     りました。 (Contributed by Derek Morr; bpo-1655(40).)

   * *note inspect: 82. モジュールに *note getcallargs(): 10be. 関数が追
     加されました。 callable とその位置引数、キーワード引数を受け取り、
     callable のどの仮引数がどの実引数を受け取るかを計算し、引数名から値
     へマップする辞書を返します。例えば:

          >>> from inspect import getcallargs
          >>> def f(a, b=1, *pos, **named):
          ...     pass
          ...
          >>> getcallargs(f, 1, 2, 3)
          {'a': 1, 'b': 2, 'pos': (3,), 'named': {}}
          >>> getcallargs(f, a=2, x=4)
          {'a': 2, 'b': 1, 'pos': (), 'named': {'x': 4}}
          >>> getcallargs(f)
          Traceback (most recent call last):
          ...
          TypeError: f() takes at least 1 argument (0 given)

     Contributed by George Sakkis; bpo-3135(41).

   * Updated module: The *note io: 83. library has been upgraded to the
     version shipped with Python 3.1.  For 3.1, the I/O library was
     entirely rewritten in C and is 2 to 20 times faster depending on
     the task being performed.  The original Python version was renamed
     to the ‘_pyio’ module.

     One minor resulting change: the *note io.TextIOBase: 8a4. class now
     has an *note errors: 1526. attribute giving the error setting used
     for encoding and decoding errors (one of ‘'strict'’, ‘'replace'’,
     ‘'ignore'’).

     *note io.FileIO: 1527. クラスは、無効なファイルディスクリプタを渡さ
     れたときに *note OSError: 2c0. を送出するようになりました。
     (Implemented by Benjamin Peterson; bpo-4991(42).)  *note
     truncate(): 1528. メソッドは、ファイル位置を保存するようになりまし
     た。以前は、ファイル位置を新しいファイルの末尾に変更しました。
     (Fixed by Pascal Chambon; bpo-6939(43).)

   * 新しい関数: ‘itertools.compress(data, selectors)’ は、2 つのイテレ
     ータを取ります。'data' の要素は、'selectors' の対応する値が真であれ
     ば返されます:

          itertools.compress('ABCDEF', [1,0,1,0,1,1]) =>
            A, C, E, F

     新しい関数: ‘itertools.combinations_with_replacement(iter, r)’ は、
     'iter' から、すべての可能な長さ 'r' の要素の組合せを返します。
     *note combinations(): 1529. とは異なり、生成された組合せに個別の要
     素が繰り返し出現できます:

          itertools.combinations_with_replacement('abc', 2) =>
            ('a', 'a'), ('a', 'b'), ('a', 'c'),
            ('b', 'b'), ('b', 'c'), ('c', 'c')

     なお要素は、実際の値ではなく、その入力内での位置に依って一意である
     とみなされます。

     *note itertools.count(): 149b. 関数は、1 以外の値を増分できるように
     、 'step' 引数を追加しました。 *note count(): 149b. はまた、キーワ
     ード引数に対応し、さらに浮動小数点数や *note Decimal: 1fe. インスタ
     ンスのような、非整数の値を使えるようになりました。(Implemented by
     Raymond Hettinger; bpo-5032(44).)

     *note itertools.combinations(): 1529. および *note
     itertools.product(): 152a. は、以前は入力のイテレート可能オブジェク
     トより大きい 'r' に *note ValueError: 2ec. を返していました。これは
     仕様エラーと認められ、空のイテレータを返すようになりました。(Fixed
     by Raymond Hettinger; bpo-4816(45).)

   * 更新されたモジュール: *note json: 86. モジュールが、エンコーディン
     グやデコーディングを高速化する C 拡張を含んだ、 simplejson パッケー
     ジのバージョン 2.0.9 にアップグレードされました。 (Contributed by
     Bob Ippolito; bpo-4136(46).)

     新しい *note collections.OrderedDict: 7f3. 型をサポートするために、
     *note json.load(): eb2. はオプションとして、任意のオブジェクトリテ
     ラルに対して呼び出され、ペアのリストにデコードする
     'object_pairs_hook' パラメタを追加しました。(Contributed by Raymond
     Hettinger; bpo-5381(47).)

   * *note mailbox: 8f. モジュールの *note Maildir: 65e. クラスは、読み
     込むディレクトリのタイムスタンプを記録し、その後に更新時刻が変わっ
     た場合にのみ再読み込みするようになりました。これは不必要なディレク
     トリ走査を避けることでパフォーマンスを向上させます。(Fixed by A.M.
     Kuchling and Antoine Pitrou; bpo-1607951(48), bpo-6896(49).)

   * 新しい関数: *note math: 92. モジュールは、誤差関数と相補誤差関数
     *note erf(): dd3. および *note erfc(): dd4. 、 ‘e**x - 1’ を *note
     exp(): 152b. から 1 を引くのよりも高い精度で計算する *note expm1():
     1405. 、ガンマ関数 *note gamma(): 1406. 、そしてガンマ関数の自然対
     数 *note lgamma(): 1407. を追加しました。 (Contributed by Mark
     Dickinson and nirinA raseliarison; bpo-3366(50).)

   * The *note multiprocessing: 98. module's ‘Manager*’ classes can now
     be passed a callable that will be called whenever a subprocess is
     started, along with a set of arguments that will be passed to the
     callable.  (Contributed by lekma; bpo-5585(51).)

     The *note Pool: 116d. class, which controls a pool of worker
     processes, now has an optional 'maxtasksperchild' parameter.
     Worker processes will perform the specified number of tasks and
     then exit, causing the ‘Pool’ to start a new worker.  This is
     useful if tasks may leak memory or other resources, or if some
     tasks will cause the worker to become very large.  (Contributed by
     Charles Cazabon; bpo-6963(52).)

   * The ‘nntplib’ module now supports IPv6 addresses.  (Contributed by
     Derek Morr; bpo-1664(53).)

   * 新しい関数: *note os: a5. モジュールは、以下の POSIX システムコール
     をラップします: real, effective, および saved GID と UID を返す、
     *note getresgid(): 152c. と *note getresuid(): 152d. 、 real,
     effective, および saved GID と UID を新しく設定する、 *note
     setresgid(): 152e. と *note setresuid(): 152f. 、現在のプロセスにグ
     ループアクセスリストを初期化する *note initgroups(): 1530. 。
     (GID/UID functions contributed by Travis H.; bpo-6508(54).  Support
     for initgroups added by Jean-Paul Calderone; bpo-7333(55).)

     *note os.fork(): 4b5. 関数は、子プロセス中で import ロックを再初期
     化するようになりました。これは、Solaris における *note fork(): 4b5.
     がスレッドから呼び出された時の問題を修正します。(Fixed by Zsolt
     Cserna; bpo-7242(56).)

   * *note os.path: a6. モジュールの、 *note normpath(): 1531. および
     *note abspath(): 1532. 関数は、Unicode を保存するようになりました。
     入力パスが Unicode なら、戻り値も Unicode 文字列になります。 (*note
     normpath(): 1531. fixed by Matt Giuca in bpo-5827(57); *note
     abspath(): 1532. fixed by Ezio Melotti in bpo-3426(58).)

   * *note pydoc: ba. モジュールは、Python が使う様々なシンボルのヘルプ
     を追加しました。例えば、 ‘help('<<')’ や ‘help('@')’ とできるように
     なりました。(Contributed by David Laban; bpo-4739(59).)

   * *note re: be. モジュールの *note split(): 5a2, *note sub(): 5a3, お
     よび *note subn(): 5a4. は、モジュールの他の関数との一貫性のため、
     オプションの 'flags' 引数を受け付けるようになりました。 (Added by
     Gregory P. Smith.)

   * 新しい関数: *note runpy: c3. モジュールの *note run_path(): 4a4. は
     、与えられた 'path' 引数のコードを実行します。 'path' は Python ソ
     ースファイルのパス (‘example.py’)、コンパイル済みバイトコードファイ
     ル (‘example.pyc’)、ディレクトリ (‘./package/’)、または zip アーカ
     イブ (‘example.zip’) にできます。ディレクトリか zip パスが与えられ
     ると、それが ‘sys.path’ の最初に加えられ、モジュール *note
     __main__: 1. が import されます。これは、ディレクトリや zip が
     ‘__main__.py’ を含むことを期待します。なければ、他の ‘__main__.py’
     が ‘sys.path’ の後の部分から import されることがあります。これによ
     り、Python のコマンドラインが明示的なパス名を処理する方法を真似たい
     ようなスクリプトに、 *note runpy: c3. のより多くの機構が利用できる
     ようになります。 (Added by Nick Coghlan; bpo-6816(60).)

   * 新しい関数: *note shutil: ca. モジュールの *note make_archive():
     6da. は、ファイル名、アーカイブ型 (zip または tar-format)、およびデ
     ィレクトリパスを取って、そのディレクトリの内容を含むアーカイブを生
     成します。(Added by Tarek Ziadé.)

     *note shutil: ca. の *note copyfile(): c4e. および *note
     copytree(): c1e. 関数は、名前付きパイプのコピーを求められたときに
     *note SpecialFileError: 1533. 例外を送出する様になりました。以前は
     、コードは、名前付きパイプを、通常のファイルのように読み込み用に開
     いて扱い、いつまでもブロックしていました。 (Fixed by Antoine
     Pitrou; bpo-3002(61).)

   * *note signal: cb. モジュールは、シグナルハンドラを本当に必要でない
     限り再インストールしなくなりました。これで、EINTR シグナルを確実に
     捕えられないバグが修正されました。(Fixed by Charles-Francois
     Natali; bpo-8354(62).)

   * 新しい関数: *note site: cc. モジュールの、新しい関数群は様々なサイ
     トおよびユーザに特有のパスを返します。 *note getsitepackages():
     1456. は、全てのグローバル site-packages ディレクトリを含むリストを
     返します。 *note getusersitepackages(): 1458. は、ユーザの
     site-packages ディレクトリのパスを返します。そして、 *note
     getuserbase(): 1457. は、データの保存に使えるディレクトリへのパスを
     与える、 *note USER_BASE: 1534. 環境変数の値を返します。
     (Contributed by Tarek Ziadé; bpo-6693(63).)

     *note site: cc. モジュールは *note sitecustomize: cd. モジュールが
     import されたときに例外を報告するようになり、 *note
     KeyboardInterrupt: bc5. 例外が捕捉されて飲み込まれることはなくなり
     ました。 (Fixed by Victor Stinner; bpo-3137(64).)

   * *note create_connection(): 882. 関数は、接続に使われるソースアドレ
     スを与える ‘(host, port)’ の 2-タプル、 'source_address' パラメタを
     追加しました。 (Contributed by Eldon Ziegler; bpo-3972(65).)

     *note recv_into(): 1535. および *note recvfrom_into(): 1536. メソッ
     ドは、バッファ API をサポートするオブジェクト、最も便利なのは *note
     bytearray: 344. や *note memoryview: 165. 、に書きこむようになりま
     した。 (Implemented by Antoine Pitrou; bpo-8104(66).)

   * The *note SocketServer: d2. module's *note TCPServer: 1537. class
     now supports socket timeouts and disabling the Nagle algorithm.
     The ‘disable_nagle_algorithm’ class attribute defaults to ‘False’;
     if overridden to be true, new request connections will have the
     TCP_NODELAY option set to prevent buffering many small sends into a
     single TCP packet.  The *note timeout: 1538. class attribute can
     hold a timeout in seconds that will be applied to the request
     socket; if no request is received within that time, *note
     handle_timeout(): 1539. will be called and *note handle_request():
     153a. will return.  (Contributed by Kristján Valur Jónsson;
     bpo-6192(67) and bpo-6267(68).)

   * 更新されたモジュール: *note sqlite3: d4. モジュールが pysqlite パッ
     ケージ(69) のバージョン 2.6.0 にアップデートされました。バージョン
     2.6.0 はいくつかのバグ修正を含み、共有ライブラリから SQLite 拡張を
     ロードできるようになりました。拡張を有効にするには
     ‘enable_load_extension(True)’ メソッドを呼び出し、そして特定の共有
     ライブラリをロードするには *note load_extension(): 6df. を呼び出し
     てください。 (Updated by Gerhard Häring.)

   * The *note ssl: d5. module's *note SSLSocket: ae7. objects now
     support the buffer API, which fixed a test suite failure (fix by
     Antoine Pitrou; bpo-7133(70)) and automatically set OpenSSL's
     ‘SSL_MODE_AUTO_RETRY’, which will prevent an error code being
     returned from ‘recv()’ operations that trigger an SSL renegotiation
     (fix by Antoine Pitrou; bpo-8222(71)).

     The *note wrap_socket(): 748. constructor function now takes a
     'ciphers' argument that's a string listing the encryption
     algorithms to be allowed; the format of the string is described in
     the OpenSSL documentation(72).  (Added by Antoine Pitrou;
     bpo-8322(73).)

     その他の変更により、拡張はOpenSSL の全ての暗号とメッセージダイジェ
     ストアルゴリズムをロードし、それらすべてが利用できるようにします。
     SSL 証明書の中には検証できないものもあり、"unknown algorithm" エラ
     ーを報告します。 (Reported by Beda Kosata, and fixed by Antoine
     Pitrou; bpo-8484(74).)

     The version of OpenSSL being used is now available as the module
     attributes *note ssl.OPENSSL_VERSION: 1437. (a string), *note
     ssl.OPENSSL_VERSION_INFO: 1438. (a 5-tuple), and *note
     ssl.OPENSSL_VERSION_NUMBER: 1439. (an integer).  (Added by Antoine
     Pitrou; bpo-8321(75).)

   * The *note struct: db. module will no longer silently ignore
     overflow errors when a value is too large for a particular integer
     format code (one of ‘bBhHiIlLqQ’); it now always raises a *note
     struct.error: 153b. exception.  (Changed by Mark Dickinson;
     bpo-1523(76).)  The *note pack(): 148e. function will also attempt
     to use *note __index__(): 19e. to convert and pack non-integers
     before trying the *note __int__(): 19d. method or reporting an
     error.  (Changed by Mark Dickinson; bpo-8300(77).)

   * 新しい関数: *note subprocess: dc. モジュールの *note
     check_output(): 11c4. は、指定された引数群でコマンドを実行し、コマ
     ンドがエラーを起こさずに実行したらコマンドの出力を文字列として返し
     、そうでなければ *note CalledProcessError: 153c. 例外を送出します。

          >>> subprocess.check_output(['df', '-h', '.'])
          'Filesystem     Size   Used  Avail Capacity  Mounted on\n
          /dev/disk0s2    52G    49G   3.0G    94%    /\n'

          >>> subprocess.check_output(['df', '-h', '/bogus'])
            ...
          subprocess.CalledProcessError: Command '['df', '-h', '/bogus']' returned non-zero exit status 1

     (Contributed by Gregory P. Smith.)

     The *note subprocess: dc. module will now retry its internal system
     calls on receiving an *note EINTR: f87. signal.  (Reported by
     several people; final patch by Gregory P. Smith in
     bpo-1068268(78).)

   * 新しい関数: *note symtable: de. モジュールの *note
     is_declared_global(): 153d. は、明示的に global と宣言された引数に
     は真、暗示的に global である引数には偽を返します。(Contributed by
     Jeremy Hylton.)

   * *note syslog: e2. モジュールは、識別子として、以前デフォルトであっ
     た ‘'python'’ の値ではなく、 ‘sys.argv[0]’ の値を使うようになりまし
     た。 (Changed by Sean Reifschneider; bpo-8451(79).)

   * The *note sys.version_info: 8af. value is now a named tuple, with
     attributes named ‘major’, ‘minor’, ‘micro’, ‘releaselevel’, and
     ‘serial’.  (Contributed by Ross Light; bpo-4285(80).)

     *note sys.getwindowsversion(): ee3. also returns a named tuple,
     with attributes named ‘major’, ‘minor’, ‘build’, ‘platform’,
     ‘service_pack’, ‘service_pack_major’, ‘service_pack_minor’,
     ‘suite_mask’, and ‘product_type’.  (Contributed by Brian Curtin;
     bpo-7766(81).)

   * *note tarfile: e4. モジュールのデフォルトエラー処理が変更され、致命
     的なエラーを抑制しないようになりました。デフォルトのエラーレベルは
     以前は 0 で、エラーはメッセージとしてデバッグログに書き込まれるだけ
     でしたが、デバッグログはデフォルトでは活性化されていないため、エラ
     ーは顧みられませんでした。デフォルトのエラーレベルは 1 になり、エラ
     ーがあれば例外が送出されます。 (Changed by Lars Gustäbel;
     bpo-7357(82).)

     *note tarfile: e4. は、tar ファイルに追加される *note TarInfo:
     142a. オブジェクトのフィルタリングをサポートするようになりました。
     *note add(): dee. を呼び出したとき、オプションの呼び出し可能オブジ
     ェクトである 'filter' 引数を与えることができます。 'filter' オブジ
     ェクトには、ファイルが追加される度に *note TarInfo: 142a. を渡され
     、これを変形して返せます。このオブジェクトが ‘None’ を返したら、そ
     のファイルは結果のアーカイブから除かれます。これは既存の 'exclude'
     引数より強力で、それゆえこれは非推奨となります。(Added by Lars
     Gustäbel; bpo-6856(83).)  *note TarFile: 1429. クラスはまた、コンテ
     キストマネージャプロトコルもサポートするようになりました。(Added by
     Lars Gustäbel; bpo-7232(84).)

   * *note threading.Event: 1370. クラスの *note wait(): 153e. メソッド
     は、終了時に内部フラグを返すようになりました。 *note wait(): 153e.
     は内部フラグが真になるまでブロックすることを想定されているため、こ
     の関数は通常真を返すことになります。この戻り値は、タイムアウトが与
     えられ、オペレーションがタイムアウトした時のみ偽になります。
     (Contributed by Tim Lesher; bpo-1674032(85).)

   * *note unicodedata: 10b. モジュールに提供される Unicode データベース
     は、どの文字が数字や空白文字か、または改行を表すかを決定するために
     、内部で使われるようになりました。このデータベースはまた、
     ‘Unihan.txt’ データファイルからの情報も含みます (patch by Anders
     Chrigström and Amaury Forgeot d'Arc; bpo-1571184(86))。また、バージ
     ョン 5.2.0 にアップデートされました (updated by Florent Xicluna;
     bpo-8024(87))。

   * The *note urlparse: 110. module's *note urlsplit(): f3a. now
     handles unknown URL schemes in a fashion compliant with RFC
     3986(88): if the URL is of the form ‘"<something>://..."’, the text
     before the ‘://’ is treated as the scheme, even if it's a made-up
     scheme that the module doesn't know about.  This change may break
     code that worked around the old behaviour.  For example, Python
     2.6.4 or 2.5 will return the following:

          >>> import urlparse
          >>> urlparse.urlsplit('invented://host/filename?query')
          ('invented', '', '//host/filename?query', '', '')

     Python 2.7 (や Python 2.6.5) は以下を返します:

          >>> import urlparse
          >>> urlparse.urlsplit('invented://host/filename?query')
          ('invented', 'host', '/filename?query', '', '')

     (Python 2.7 では、これは普通のタプルではなく名前付きタプルを返すの
     で、実際は微妙に異なる出力をします。)

     The *note urlparse: 110. module also supports IPv6 literal
     addresses as defined by RFC 2732(89) (contributed by Senthil
     Kumaran; bpo-2987(90)).

          >>> urlparse.urlparse('http://[1080::8:800:200C:417A]/foo')
          ParseResult(scheme='http', netloc='[1080::8:800:200C:417A]',
                      path='/foo', params='', query='', fragment='')

   * 新しいクラス: *note weakref: 11a. モジュールの *note WeakSet: 7f5.
     クラスは、その要素の弱参照だけを保持する集合です。要素は、それを指
     す参照がなくなり次第除去されます。 (Originally implemented in
     Python 3.x by Raymond Hettinger, and backported to 2.7 by Michael
     Foord.)

   * The *note xml.etree.ElementTree: 12b. library, no longer escapes
     ampersands and angle brackets when outputting an XML processing
     instruction (which looks like ‘<?xml-stylesheet href="#style1"?>’)
     or comment (which looks like ‘<!-- comment -->’).  (Patch by Neil
     Muller; bpo-2746(91).)

   * The XML-RPC client and server, provided by the *note xmlrpclib:
     134. and *note SimpleXMLRPCServer: 135. modules, have improved
     performance by supporting HTTP/1.1 keep-alive and by optionally
     using gzip encoding to compress the XML being exchanged.  The gzip
     compression is controlled by the ‘encode_threshold’ attribute of
     *note SimpleXMLRPCRequestHandler: 153f, which contains a size in
     bytes; responses larger than this will be compressed.  (Contributed
     by Kristján Valur Jónsson; bpo-6267(92).)

   * *note zipfile: 137. モジュールの *note ZipFile: 8d3. は、コンテキス
     トマネジメントプロトコルをサポートし、 ‘with zipfile.ZipFile(...)
     as f:’ と書けるようになりました。 (Contributed by Brian Curtin;
     bpo-5511(93).)

     *note zipfile: 137. now also supports archiving empty directories
     and extracts them correctly.  (Fixed by Kuba Wieczorek;
     bpo-4710(94).)  Reading files out of an archive is faster, and
     interleaving *note read(): 1540. and *note readline(): 1541. now
     works correctly.  (Contributed by Nir Aides; bpo-7610(95).)

     *note is_zipfile(): 1542. 関数は、以前受け付けられていたパス名に加
     え、ファイルオブジェクトも受け付けるようになりました。 (Contributed
     by Gabriel Genellina; bpo-4756(96).)

     *note writestr(): 2cc. メソッドは、 *note ZipFile: 8d3. コンストラ
     クタで指定されたデフォルトの圧縮メソッドをオーバライドする、オプシ
     ョンの 'compress_type' パラメタを追加しました。 (Contributed by
     Ronald Oussoren; bpo-6003(97).)

* Menu:

* 新しいモジュール; importlib: 新しいモジュール importlib.
* 新しいモジュール; sysconfig: 新しいモジュール sysconfig.
* ttk; Tk のテーマ付きウィジェット: ttk Tk のテーマ付きウィジェット.
* 更新されたモジュール; unittest: 更新されたモジュール unittest.
* 更新されたモジュール; ElementTree 1.3: 更新されたモジュール ElementTree 1 3.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5142

   (2) https://bugs.python.org/issue?@action=redirect&bpo=7703

   (3) https://www.jcea.es/programacion/pybsddb.htm

   (4) https://bugs.python.org/issue?@action=redirect&bpo=8156

   (5) https://bugs.python.org/issue?@action=redirect&bpo=3860

   (6) https://bugs.python.org/issue?@action=redirect&bpo=1696199

   (7) https://bugs.python.org/issue?@action=redirect&bpo=1818

   (8) https://bugs.python.org/issue?@action=redirect&bpo=8729

   (9) https://bugs.python.org/issue?@action=redirect&bpo=7005

   (10) https://bugs.python.org/issue?@action=redirect&bpo=3924

   (11) https://bugs.python.org/issue?@action=redirect&bpo=1515

   (12) https://bugs.python.org/issue?@action=redirect&bpo=4606

   (13) https://sourceware.org/libffi/

   (14) https://bugs.python.org/issue?@action=redirect&bpo=8142

   (15) https://bugs.python.org/issue?@action=redirect&bpo=5788

   (16) https://bugs.python.org/issue?@action=redirect&bpo=4796

   (17) https://bugs.python.org/issue?@action=redirect&bpo=2531

   (18) https://bugs.python.org/issue?@action=redirect&bpo=8257

   (19) https://bugs.python.org/issue?@action=redirect&bpo=6595

   (20) https://bugs.python.org/issue?@action=redirect&bpo=7633

   (21) https://bugs.python.org/issue?@action=redirect&bpo=6857

   (22) https://bugs.python.org/issue?@action=redirect&bpo=7279

   (23) https://bugs.python.org/issue?@action=redirect&bpo=7585

   (24) https://bugs.python.org/issue?@action=redirect&bpo=8688

   (25) https://bugs.python.org/issue?@action=redirect&bpo=7490

   (26) https://bugs.python.org/issue?@action=redirect&bpo=1368247

   (27) https://bugs.python.org/issue?@action=redirect&bpo=5812

   (28) https://bugs.python.org/issue?@action=redirect&bpo=8294

   (29) https://bugs.python.org/issue?@action=redirect&bpo=2054

   (30) https://bugs.python.org/issue?@action=redirect&bpo=6845

   (31) https://bugs.python.org/issue?@action=redirect&bpo=5479

   (32) https://bugs.python.org/issue?@action=redirect&bpo=4688

   (33) https://bugs.python.org/issue?@action=redirect&bpo=3860

   (34) https://bugs.python.org/issue?@action=redirect&bpo=7471

   (35) https://bugs.python.org/issue?@action=redirect&bpo=4272

   (36) https://bugs.python.org/issue?@action=redirect&bpo=2846

   (37) https://bugs.python.org/issue?@action=redirect&bpo=7418

   (38) https://bugs.python.org/issue?@action=redirect&bpo=4879

   (39) https://bugs.python.org/issue?@action=redirect&bpo=3972

   (40) https://bugs.python.org/issue?@action=redirect&bpo=1655

   (41) https://bugs.python.org/issue?@action=redirect&bpo=3135

   (42) https://bugs.python.org/issue?@action=redirect&bpo=4991

   (43) https://bugs.python.org/issue?@action=redirect&bpo=6939

   (44) https://bugs.python.org/issue?@action=redirect&bpo=5032

   (45) https://bugs.python.org/issue?@action=redirect&bpo=4816

   (46) https://bugs.python.org/issue?@action=redirect&bpo=4136

   (47) https://bugs.python.org/issue?@action=redirect&bpo=5381

   (48) https://bugs.python.org/issue?@action=redirect&bpo=1607951

   (49) https://bugs.python.org/issue?@action=redirect&bpo=6896

   (50) https://bugs.python.org/issue?@action=redirect&bpo=3366

   (51) https://bugs.python.org/issue?@action=redirect&bpo=5585

   (52) https://bugs.python.org/issue?@action=redirect&bpo=6963

   (53) https://bugs.python.org/issue?@action=redirect&bpo=1664

   (54) https://bugs.python.org/issue?@action=redirect&bpo=6508

   (55) https://bugs.python.org/issue?@action=redirect&bpo=7333

   (56) https://bugs.python.org/issue?@action=redirect&bpo=7242

   (57) https://bugs.python.org/issue?@action=redirect&bpo=5827

   (58) https://bugs.python.org/issue?@action=redirect&bpo=3426

   (59) https://bugs.python.org/issue?@action=redirect&bpo=4739

   (60) https://bugs.python.org/issue?@action=redirect&bpo=6816

   (61) https://bugs.python.org/issue?@action=redirect&bpo=3002

   (62) https://bugs.python.org/issue?@action=redirect&bpo=8354

   (63) https://bugs.python.org/issue?@action=redirect&bpo=6693

   (64) https://bugs.python.org/issue?@action=redirect&bpo=3137

   (65) https://bugs.python.org/issue?@action=redirect&bpo=3972

   (66) https://bugs.python.org/issue?@action=redirect&bpo=8104

   (67) https://bugs.python.org/issue?@action=redirect&bpo=6192

   (68) https://bugs.python.org/issue?@action=redirect&bpo=6267

   (69) https://github.com/ghaering/pysqlite

   (70) https://bugs.python.org/issue?@action=redirect&bpo=7133

   (71) https://bugs.python.org/issue?@action=redirect&bpo=8222

   (72) https://docs.openssl.org/1.0.2/man1/ciphers/

   (73) https://bugs.python.org/issue?@action=redirect&bpo=8322

   (74) https://bugs.python.org/issue?@action=redirect&bpo=8484

   (75) https://bugs.python.org/issue?@action=redirect&bpo=8321

   (76) https://bugs.python.org/issue?@action=redirect&bpo=1523

   (77) https://bugs.python.org/issue?@action=redirect&bpo=8300

   (78) https://bugs.python.org/issue?@action=redirect&bpo=1068268

   (79) https://bugs.python.org/issue?@action=redirect&bpo=8451

   (80) https://bugs.python.org/issue?@action=redirect&bpo=4285

   (81) https://bugs.python.org/issue?@action=redirect&bpo=7766

   (82) https://bugs.python.org/issue?@action=redirect&bpo=7357

   (83) https://bugs.python.org/issue?@action=redirect&bpo=6856

   (84) https://bugs.python.org/issue?@action=redirect&bpo=7232

   (85) https://bugs.python.org/issue?@action=redirect&bpo=1674032

   (86) https://bugs.python.org/issue?@action=redirect&bpo=1571184

   (87) https://bugs.python.org/issue?@action=redirect&bpo=8024

   (88) https://datatracker.ietf.org/doc/html/rfc3986.html

   (89) https://datatracker.ietf.org/doc/html/rfc2732.html

   (90) https://bugs.python.org/issue?@action=redirect&bpo=2987

   (91) https://bugs.python.org/issue?@action=redirect&bpo=2746

   (92) https://bugs.python.org/issue?@action=redirect&bpo=6267

   (93) https://bugs.python.org/issue?@action=redirect&bpo=5511

   (94) https://bugs.python.org/issue?@action=redirect&bpo=4710

   (95) https://bugs.python.org/issue?@action=redirect&bpo=7610

   (96) https://bugs.python.org/issue?@action=redirect&bpo=4756

   (97) https://bugs.python.org/issue?@action=redirect&bpo=6003


File: python.info,  Node: 新しいモジュール importlib,  Next: 新しいモジュール sysconfig,  Up: 新しいモジュールと改良されたモジュール

1.16.11.1 新しいモジュール: importlib
.....................................

Python 3.1 includes the *note importlib: 7b. package, a
re-implementation of the logic underlying Python's *note import: 7f8.
statement.  *note importlib: 7b. is useful for implementers of Python
interpreters and to users who wish to write new importers that can
participate in the import process.  Python 2.7 doesn't contain the
complete *note importlib: 7b. package, but instead has a tiny subset
that contains a single function, *note import_module(): 73c.

‘import_module(name, package=None)’ はモジュールを import します。
'name' はモジュールまたはパッケージの名前を含む文字列です。
‘..utils.errors’ のように ‘.’ 文字で始まる文字列を与えることで、相対
import も可能です。相対 import では、 'package' 引数は必ず与えられなけれ
ばならず、相対 import のアンカーとして使われるパッケージの名前でなければ
なりません。 *note import_module(): 73c. は、 import されたモジュールを
‘sys.modules’ に挿入し、モジュールオブジェクトを返すこともします。

ここに例があります:

     >>> from importlib import import_module
     >>> anydbm = import_module('anydbm')  # Standard absolute import
     >>> anydbm
     <module 'anydbm' from '/p/python/Lib/anydbm.py'>
     >>> # Relative import
     >>> file_util = import_module('..file_util', 'distutils.command')
     >>> file_util
     <module 'distutils.file_util' from '/python/Lib/distutils/file_util.pyc'>

*note importlib: 7b. は、Brett Cannon によって実装され、 Python 3.1 に導
入されました。


File: python.info,  Node: 新しいモジュール sysconfig,  Next: ttk Tk のテーマ付きウィジェット,  Prev: 新しいモジュール importlib,  Up: 新しいモジュールと改良されたモジュール

1.16.11.2 新しいモジュール: sysconfig
.....................................

*note sysconfig: e1. モジュールが Distutils パッケージから引き抜かれ、新
しいトップレベルモジュールになりました。 *note sysconfig: e1. は、Python
のビルドプロセスについての以下の情報を得るための関数群を提供しています。
コンパイラスイッチ、インストレーションパス、プラットフォーム名、そして
Python がソースディレクトリから実行されているかどうかです。

モジュールの関数のいくつかを紹介すると:

   * *note get_config_var(): 174. は、Python の Makefile と ‘pyconfig.h’
     ファイルから変数を返します。

   * *note get_config_vars(): 298. は、すべての環境設定変数を含む辞書を
     返します。

   * *note get_path(): 1545. は、特定のタイプのモジュール、つまり標準ラ
     イブラリ、サイト特有のモジュール、プラットフォーム特有のライブフラ
     リなど、への設定されたパスを返します。

   * *note is_python_build(): 32d. は、Python ソースツリーからバイナリを
     起動していれば真を、そうでなければ偽を返します。

詳細と関数の完全な一覧は *note sysconfig: e1. ドキュメントを参照してくだ
さい。

Distutils パッケージと *note sysconfig: e1. は Tarek Ziadé によってメン
テナンスされていて、彼は Distutils の新世代版を開発するために Distutils2
パッケージ (source repository at ‘https://hg.python.org/distutils2/’) も
開始しました。


File: python.info,  Node: ttk Tk のテーマ付きウィジェット,  Next: 更新されたモジュール unittest,  Prev: 新しいモジュール sysconfig,  Up: 新しいモジュールと改良されたモジュール

1.16.11.3 ttk: Tk のテーマ付きウィジェット
..........................................

Tcl/Tk 8.5 は、基本的な Tk ウィジェットを最実装しながらより自由な外観の
カスタマイズが広がり、よりネイティブなプラットフォームのウィジェットに似
たテーマ付きウィジェット群を含みます。このウィジェット群は、元は Tile と
呼ばれていましたが、Tcl/Tck リリース 8.5 への追加の際に ("themed Tk" を
略して) Ttk に改名されました。

To learn more, read the *note ttk: ff. module documentation.  You may
also wish to read the Tcl/Tk manual page describing the Ttk theme
engine, available at
‘https://www.tcl.tk/man/tcl8.5/TkCmd/ttk_intro.html’.  Some screenshots
of the Python/Ttk code in use are at
‘https://code.google.com/archive/p/python-ttk/wikis/Screenshots.wiki’.

The *note tkinter.ttk: ff. module was written by Guilherme Polo and
added in bpo-2983(1).  An alternate version called ‘Tile.py’, written by
Martin Franklin and maintained by Kevin Walzer, was proposed for
inclusion in bpo-2618(2), but the authors argued that Guilherme Polo's
work was more comprehensive.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=2983

   (2) https://bugs.python.org/issue?@action=redirect&bpo=2618


File: python.info,  Node: 更新されたモジュール unittest,  Next: 更新されたモジュール ElementTree 1 3,  Prev: ttk Tk のテーマ付きウィジェット,  Up: 新しいモジュールと改良されたモジュール

1.16.11.4 更新されたモジュール: unittest
........................................

The *note unittest: 10c. module was greatly enhanced; many new features
were added.  Most of these features were implemented by Michael Foord,
unless otherwise noted.  The enhanced version of the module is
downloadable separately for use with Python versions 2.4 to 2.6,
packaged as the ‘unittest2’ package, from unittest2(1).

When used from the command line, the module can automatically discover
tests.  It's not as fancy as py.test(2) or nose(3), but provides a
simple way to run tests kept within a set of package directories.  For
example, the following command will search the ‘test/’ subdirectory for
any importable test files named ‘test*.py’:

     python -m unittest discover -s test

詳細は、 *note unittest: 10c. モジュールのドキュメントを参照してください
。 (Developed in bpo-6001(4).)

*note main(): 11e5. 関数は、その他幾つかの新しいオプションを提供します:

   * *note -b: 1549. や ‘--buffer’ は、標準出力や標準エラーストリームを
     それぞれのテストの間バッファに入れます。テストが通れば、結果の出力
     は全て捨てられます。失敗したら、バッファに入れられた出力が表示され
     ます。

   * *note -c: 154a. や ‘--catch’ は、control-C による中断をより上品にし
     ます。テストプロセスを即座に中断するのではなく、現在実行中のテスト
     は完了させ、中断までの部分的な結果は報告されます。待ちきれなければ
     、control-C をもう一度押せば、即座に中断されます。

     この control-C ハンドラは、コードがテストされているときや、実行され
     ているテストが独自のシグナルハンドラを定義したとき、シグナルハンド
     ラがすでに設定されていてそして呼び出されたということを知らせること
     で、問題を起こさないようにします。これがまずいなら、 *note
     removeHandler(): 154b. デコレータを使って、テストが control-C ハン
     ドリングを無効にするべきであると示せます。

   * *note -f: 154c. や ‘--failfast’ は、テストが失敗したとき、他のテス
     トを続けるのではなく、テストの実行を即座に停止します。 (Suggested
     by Cliff Dyer and implemented by Michael Foord; bpo-8074(5).)

進捗メッセージは、verbose モードで実行したとき、期待された失敗に 'x' を
、期待されない成功に 'u' を表示するようになりました。(Contributed by
Benjamin Peterson.)

テストケースは、テストをスキップするために *note SkipTest: 11e6. 例外を
送出します。(bpo-1034053(6)).

*note assertEqual(): 74c, *note assertTrue(): 74a, および *note
assertFalse(): 74b. 失敗のメッセージは、提供する情報量が増えました。
*note TestCase: 2b3. クラスの *note longMessage: 154d. 属性を真に設定す
ると、失敗時に、標準のエラーメッセージと追加して提供したメッセージの両方
が表示されます。(Added by Michael Foord; bpo-5663(7).)

*note assertRaises(): 750. メソッドは、実行する呼び出し可能オブジェクト
を与えずに呼び出されたとき、コンテキストハンドラを返すようになりました。
例えば、こう書くことができます:

     with self.assertRaises(KeyError):
         {}['foo']

(Implemented by Antoine Pitrou; bpo-4444(8).)

モジュールレベルおよびクラスレベルの設定と、ティアダウンフィクスチャがサ
ポートされました。モジュールは、 *note setUpModule(): c42. および *note
tearDownModule(): 154e. 関数を含むことができます。クラスは *note
setUpClass(): c43. および *note tearDownClass(): 154f. メソッドを含むこ
とができ、これらは (‘@classmethod’ や透過なものを使って) クラスメソッド
として定義しなければなりません。これらの関数とメソッドは、テストランナー
が別のモジュールやクラスのテストケースに切り替えるときに呼び出されます。

メソッド *note addCleanup(): c74. および *note doCleanups(): 1550. が追
加されました。 *note addCleanup(): c74. で、無条件に呼び出されるクリーン
アップ関数を (*note setUp(): 1551. が失敗したら *note setUp(): 1551. の
後に、そうでなければ *note tearDown(): 1552. の後に) 追加できるようにし
ます。これにより、テスト中のリソースの配置と解放が簡潔になります。
(bpo-5679(9)).

より特化したテストを提供するメソッドがいくつか追加されました。これらのメ
ソッドの多くは、Google のエンジニアたちによってそのテストスイートのため
に書かれました。Gregory P. Smith, Michael Foord, and GvR が、これを
*note unittest: 10c. の Python 版にマージしました。

   * *note assertIsNone(): 14a2. および *note assertIsNotNone(): 14a3. は
     ひとつの式を取り、その結果が ‘None’ であるか、またはないかを確かめ
     ます。

   * *note assertIs(): 1553. および *note assertIsNot(): 1554. は、2 つ
     の値を取り、その評価が同一のオブジェクトであるか、またはないかを確
     かめます。 (Added by Michael Foord; bpo-2578(10).)

   * *note assertIsInstance(): 1555. および *note assertNotIsInstance():
     1556. は、結果のオブジェクトが特定のクラス、またはタプルにあるクラ
     スのいずれかのインスタンスであるかを調べます。(Added by Georg
     Brandl; bpo-7031(11).)

   * *note assertGreater(): 1557, *note assertGreaterEqual(): 1558,
     *note assertLess(): 1559, および *note assertLessEqual(): 155a. は
     、二つの量を比較します。

   * *note assertMultiLineEqual(): 155b. は 2 つの文字列を比較し、等しく
     なければ、2 文字列の差分をハイライトする有益な比較を表示します。こ
     の比較は、Unicode 文字列が *note assertEqual(): 74c. で比較されると
     きのデフォルトに使われるようになりました。

   * *note assertRegexpMatches(): 751. and *note
     assertNotRegexpMatches(): 753. checks whether the first argument is
     a string matching or not matching the regular expression provided
     as the second argument (bpo-8038(12)).

   * *note assertRaisesRegexp(): 752. checks whether a particular
     exception is raised, and then also checks that the string
     representation of the exception matches the provided regular
     expression.

   * *note assertIn(): 155c. および *note assertNotIn(): 155d. は、
     'first' が 'second' に属するか、または属さないかを調べます。

   * *note assertItemsEqual(): 1442. tests whether two provided
     sequences contain the same elements.

   * *note assertSetEqual(): 149d. は、2 つの集合が等しいか比較し、エラ
     ーの場合のみ、集合間の差分を報告します。

   * 同様に、 *note assertListEqual(): 149f. および *note
     assertTupleEqual(): 14a0. は、指定された型を比較し、差分を説明しま
     すが、完全な値を表示するとはかぎりません。これらのメソッドは、リス
     トやタプルを *note assertEqual(): 74c. で比較するときにデフォルトで
     使われるようになりました。より一般的には、 *note
     assertSequenceEqual(): 14a1. は 2 つのシーケンスを比較し、必要なら
     両方のシーケンスが特定の型であるかを調べます。

   * *note assertDictEqual(): 149e. compares two dictionaries and
     reports the differences; it's now used by default when you compare
     two dictionaries using *note assertEqual(): 74c.
     ‘assertDictContainsSubset()’ checks whether all of the key/value
     pairs in 'first' are found in 'second'.

   * *note assertAlmostEqual(): 74e. and *note assertNotAlmostEqual():
     74f. test whether 'first' and 'second' are approximately equal.
     This method can either round their difference to an optionally
     specified number of 'places' (the default is 7) and compare it to
     zero, or require the difference to be smaller than a supplied
     'delta' value.

   * *note loadTestsFromName(): 155e. は、 *note TestLoader: 593. の
     *note suiteClass: 155f. 属性を適切に受け入れます。(Fixed by Mark
     Roddy; bpo-6866(13).)

   * 新しいフックにより、 *note assertEqual(): 74c. メソッドを拡張して新
     しいデータ型を扱わせられます。 *note addTypeEqualityFunc(): 1560. メ
     ソッドは型オブジェクトと関数を取ります。この関数は、比較される両方
     のオブジェクトが特定の型であるときに使われます。この関数は、2 つの
     オブジェクトを比較し、マッチしなければ例外を送出するべきです。この
     関数が、新しいシーケンス比較メソッドがするように、2 つのオブジェク
     トがなぜマッチしないのかについて追加の情報を提供するのがいいアイデ
     アです。

*note unittest.main(): 11e5. はオプションの ‘exit’ 引数を取るようになり
ました。偽の場合、 *note main(): 11e5. は *note sys.exit(): 277. を呼び
出さず、これにより対話型インタプリタから *note main(): 11e5. が使えるよ
うになります。(Contributed by J. Pablo Fernández; bpo-3379(14).)

*note TestResult: 137f. に、テストランの直前と直後に呼び出される *note
startTestRun(): 1561. および *note stopTestRun(): 1562. が追加されました
。 (Contributed by Robert Collins; bpo-5728(15).)

これら一連の変更により、 ‘unittest.py’ は無様に大きくなったので、モジュ
ールはパッケージとなり、コードは複数のファイルに分割されました (by
Benjamin Peterson)。これは、モジュールをインポートして使う方法には影響し
ません。

参考
....

‘https://web.archive.org/web/20210619163128/http://www.voidspace.org.uk/python/articles/unittest2.shtml’

     Describes the new features, how to use them, and the rationale for
     various design decisions.  (By Michael Foord.)

   ---------- Footnotes ----------

   (1) https://pypi.org/project/unittest2/

   (2) https://pytest.org

   (3) https://nose.readthedocs.io/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=6001

   (5) https://bugs.python.org/issue?@action=redirect&bpo=8074

   (6) https://bugs.python.org/issue?@action=redirect&bpo=1034053

   (7) https://bugs.python.org/issue?@action=redirect&bpo=5663

   (8) https://bugs.python.org/issue?@action=redirect&bpo=4444

   (9) https://bugs.python.org/issue?@action=redirect&bpo=5679

   (10) https://bugs.python.org/issue?@action=redirect&bpo=2578

   (11) https://bugs.python.org/issue?@action=redirect&bpo=7031

   (12) https://bugs.python.org/issue?@action=redirect&bpo=8038

   (13) https://bugs.python.org/issue?@action=redirect&bpo=6866

   (14) https://bugs.python.org/issue?@action=redirect&bpo=3379

   (15) https://bugs.python.org/issue?@action=redirect&bpo=5728


File: python.info,  Node: 更新されたモジュール ElementTree 1 3,  Prev: 更新されたモジュール unittest,  Up: 新しいモジュールと改良されたモジュール

1.16.11.5 更新されたモジュール: ElementTree 1.3
...............................................

Python に同梱される ElementTree ライブラリのバージョンが、バージョン 1.3
にアップデートされました。新機能の一部は:

   * 様々な解析関数が、使われる *note XMLParser: c49. インスタンスを与え
     る 'parser' キーワード引数を取るようになりました。これにより、ファ
     イルの内部エンコーディングをオーバーライドできるようになりました:

          p = ET.XMLParser(encoding='utf-8')
          t = ET.XML("""<root/>""", parser=p)

     Errors in parsing XML now raise a *note ParseError: 148f.
     exception, whose instances have a ‘position’ attribute containing a
     ('line', 'column') tuple giving the location of the problem.

   * ElementTree's code for converting trees to a string has been
     significantly reworked, making it roughly twice as fast in many
     cases.  The *note ElementTree.write(): c8c. and ‘Element.write()’
     methods now have a 'method' parameter that can be "xml" (the
     default), "html", or "text".  HTML mode will output empty elements
     as ‘<empty></empty>’ instead of ‘<empty/>’, and text mode will skip
     over elements and only output the text chunks.  If you set the
     *note tag: 1565. attribute of an element to ‘None’ but leave its
     children in place, the element will be omitted when the tree is
     written out, so you don't need to do more extensive rearrangement
     to remove a single element.

     Namespace handling has also been improved.  All ‘xmlns:<whatever>’
     declarations are now output on the root element, not scattered
     throughout the resulting XML. You can set the default namespace for
     a tree by setting the ‘default_namespace’ attribute and can
     register new prefixes with *note register_namespace(): 13ea.  In
     XML mode, you can use the true/false 'xml_declaration' parameter to
     suppress the XML declaration.

   * 新しい *note Element: 363. メソッド: *note extend(): 13eb. はシーケ
     ンスから項目の子に要素を追加します。要素それ自体はシーケンスのよう
     に振る舞うので、子をある要素から別の要素に移すのが簡単です:

          from xml.etree import ElementTree as ET

          t = ET.XML("""<list>
            <item>1</item> <item>2</item>  <item>3</item>
          </list>""")
          new = ET.XML('<root/>')
          new.extend(t)

          # Outputs <root><item>1</item>...</root>
          print ET.tostring(new)

   * New *note Element: 363. method: *note iter(): 1566. yields the
     children of the element as a generator.  It's also possible to
     write ‘for child in elem:’ to loop over an element's children.  The
     existing method ‘getiterator()’ is now deprecated, as is
     ‘getchildren()’ which constructs and returns a list of children.

   * New *note Element: 363. method: *note itertext(): 13ed. yields all
     chunks of text that are descendants of the element.  For example:

          t = ET.XML("""<list>
            <item>1</item> <item>2</item>  <item>3</item>
          </list>""")

          # Outputs ['\n  ', '1', ' ', '2', '  ', '3', '\n']
          print list(t.itertext())

   * 非推奨: 要素をブール値として使う (すなわち、 ‘if elem:’) と、要素が
     子を持てば真を、子を持たなければ偽を返します。この振る舞いは紛らわ
     しいです - ‘None’ は偽、では子を持たない要素は?  - ですから、 *note
     FutureWarning: 659. を引き起こすようになりました。コードでは、明示
     するべきです。子の数に興味があるなら ‘len(elem) != 0’ と、または
     ‘elem is not None’ と書いてください。

Fredrik Lundh develops ElementTree and produced the 1.3 version; you can
read his article describing 1.3 at
‘https://web.archive.org/web/20200703234532/http://effbot.org/zone/elementtree-13-intro.htm’.
Florent Xicluna updated the version included with Python, after
discussions on python-dev and in bpo-6472(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=6472


File: python.info,  Node: ビルドならびに C API の変更<8>,  Next: その他の変更と修正,  Prev: 新しいモジュールと改良されたモジュール,  Up: What's New in Python 2 7

1.16.12 ビルドならびに C API の変更
-----------------------------------

Python のビルド過程と C API の変更は以下の通りです:

   * The latest release of the GNU Debugger, GDB 7, can be scripted
     using Python(1).  When you begin debugging an executable program P,
     GDB will look for a file named ‘P-gdb.py’ and automatically read
     it.  Dave Malcolm contributed a ‘python-gdb.py’ that adds a number
     of commands useful when debugging Python itself.  For example,
     ‘py-up’ and ‘py-down’ go up or down one Python stack frame, which
     usually corresponds to several C stack frames.  ‘py-print’ prints
     the value of a Python variable, and ‘py-bt’ prints the Python stack
     trace.  (Added as a result of bpo-8032(2).)

   * Python に備え付けの ‘.gdbinit’ ファイルを使うと、デバッグされている
     スレッドが GIL をほじしていないとき、2.7 バージョンの "pyo" マクロ
     が正常に動くようになりました。このマクロは、表示の前にこれを取得す
     るようになりました。 (Contributed by Victor Stinner; bpo-3632(3).)

   * *note Py_AddPendingCall(): b78. はスレッドセーフになり、ワーカスレ
     ッドがメイン Python スレッドに通知を投入することができるようになり
     ました。これは特に、非同時性の IO 処理に便利です。(Contributed by
     Kristján Valur Jónsson; bpo-4293(4).)

   * New function: *note PyCode_NewEmpty(): 1568. creates an empty code
     object; only the filename, function name, and first line number are
     required.  This is useful for extension modules that are attempting
     to construct a more useful traceback stack.  Previously such
     extensions needed to call ‘PyCode_New()’, which had many more
     arguments.  (Added by Jeffrey Yasskin.)

   * 新しい関数: *note PyErr_NewExceptionWithDoc(): 1480. は、既存の
     *note PyErr_NewException(): 1481. と同じように新しい例外クラスを生
     成しますが、新しい例外クラスの docstring を含む、追加の ‘char *’ 引
     数を取ります。(Added by 'lekma' on the Python bug tracker;
     bpo-7033(5).)

   * 新しい関数: *note PyFrame_GetLineNumber(): 98e. はフレームオブジェ
     クトを取り、そのフレームが現在実行している行番号を返します。以前は
     、コードは現在実行しているバイトコード命令のインデクスを得て、それ
     からそのアドレスに対応する行番号を探索する必要がありました。(Added
     by Jeffrey Yasskin.)

   * New functions: *note PyLong_AsLongAndOverflow(): 147d. and *note
     PyLong_AsLongLongAndOverflow(): 147e. approximates a Python long
     integer as a C long or long long.  If the number is too large to
     fit into the output type, an 'overflow' flag is set and returned to
     the caller.  (Contributed by Case Van Horsen; bpo-7528(6) and
     bpo-7767(7).)

   * New function: stemming from the rewrite of string-to-float
     conversion, a new *note PyOS_string_to_double(): 14ad. function was
     added.  The old ‘PyOS_ascii_strtod()’ and ‘PyOS_ascii_atof()’
     functions are now deprecated.

   * New function: ‘PySys_SetArgvEx()’ sets the value of ‘sys.argv’ and
     can optionally update ‘sys.path’ to include the directory
     containing the script named by ‘sys.argv[0]’ depending on the value
     of an 'updatepath' parameter.

     This function was added to close a security hole for applications
     that embed Python.  The old function, ‘PySys_SetArgv()’, would
     always update ‘sys.path’, and sometimes it would add the current
     directory.  This meant that, if you ran an application embedding
     Python in a directory controlled by someone else, attackers could
     put a Trojan-horse module in the directory (say, a file named
     ‘os.py’) that your application would then import and run.

     If you maintain a C/C++ application that embeds Python, check
     whether you're calling ‘PySys_SetArgv()’ and carefully consider
     whether the application should be using ‘PySys_SetArgvEx()’ with
     'updatepath' set to false.

     Security issue reported as CVE 2008-5983(8); discussed in
     bpo-5753(9), and fixed by Antoine Pitrou.

   * 新しいマクロ: Python ヘッダファイルは、以下のマクロを定義しました:
     *note Py_ISALNUM: 1569, *note Py_ISALPHA: 156a, *note Py_ISDIGIT:
     156b, *note Py_ISLOWER: 156c, *note Py_ISSPACE: 156d, *note
     Py_ISUPPER: 156e, *note Py_ISXDIGIT: 156f, *note Py_TOLOWER: 1570,
     および *note Py_TOUPPER: 1571. 。これらすべての関数は、文字を分類す
     る C の標準マクロと類似ですが、Python は文字をロケールに依らず文字
     を分析したいときがあるため、現在のロケール設定を無視します。(Added
     by Eric Smith; bpo-5793(10).)

   * Removed function: ‘PyEval_CallObject()’ is now only available as a
     macro.  A function version was being kept around to preserve ABI
     linking compatibility, but that was in 1997; it can certainly be
     deleted by now.  (Removed by Antoine Pitrou; bpo-8276(11).)

   * New format codes: the ‘PyString_FromFormat()’,
     ‘PyString_FromFormatV()’, and *note PyErr_Format(): 10b1. functions
     now accept ‘%lld’ and ‘%llu’ format codes for displaying C's long
     long types.  (Contributed by Mark Dickinson; bpo-7228(12).)

   * スレッドとプロセスのフォークの間の複雑な相互関係が変更されました。
     以前は、 *note os.fork(): 4b5. によって生成された子プロセスは失敗し
     ていました。これは、子は動作しているスレッド 1 つだけで生成され、そ
     のスレッドが *note os.fork(): 4b5. を処理するからです。他のスレッド
     が、Python のインポートロックのような、ロックを保持していたら、フォ
     ークが実行されたとき、ロックは新しいプロセスでも "held" としてマー
     クされたままです。しかし、子プロセスでは、他のスレッドは複製されな
     いため、ロックを解放するものは何もないので、子プロセスは import の
     実行を続けることができません。

     Python 2.7 は、 *note os.fork(): 4b5. を実行する前に import ロック
     を取得し、また *note threading: f3. モジュールを使って生成された全
     てのロックをクリーンアップします。内部ロックを持っていたり、自身で
     ‘fork()’ を呼び出したりするような C 拡張モジュールは、このクリーン
     アップの恩恵を受けません。

     (Fixed by Thomas Wouters; bpo-1590864(13).)

   * The *note Py_Finalize(): 45f. function now calls the internal
     ‘threading._shutdown()’ function; this prevents some exceptions
     from being raised when an interpreter shuts down.  (Patch by Adam
     Olsen; bpo-1722344(14).)

   * When using the *note PyMemberDef: 771. structure to define
     attributes of a type, Python will no longer let you try to delete
     or set a ‘T_STRING_INPLACE’ attribute.

   * *note ctypes: 2e. によって定義されたグローバルシンボルには、 ‘Py’ ま
     たは ‘_ctypes’ が接頭されるようになりました。(Implemented by Thomas
     Heller; bpo-3102(15).)

   * New configure option: the ‘--with-system-expat’ switch allows
     building the *note pyexpat: 12c. module to use the system Expat
     library.  (Contributed by Arfrever Frehtes Taifersar Arahesis;
     bpo-7609(16).)

   * 新しい設定オプション: ‘--with-valgrind’ オプションは、 Valgrind メ
     モリエラー検出器が正しく分析するのが難しい pymalloc アロケータを無
     効にするようになりました。ですから Valgrind は、メモリリークやオー
     バーランをより検出できます。 (Contributed by James Henstridge;
     bpo-2422(17).)

   * 新しい設定オプション: ‘--with-dbmliborder=’ に空の文字列を与えて様
     々な DBM モジュールを全て無効にできます。 (Added by Arfrever
     Frehtes Taifersar Arahesis; bpo-6491(18).)

   * The ‘configure’ script now checks for floating-point rounding bugs
     on certain 32-bit Intel chips and defines a ‘X87_DOUBLE_ROUNDING’
     preprocessor definition.  No code currently uses this definition,
     but it's available if anyone wishes to use it.  (Added by Mark
     Dickinson; bpo-2937(19).)

     ‘configure’ also now sets a ‘LDCXXSHARED’ Makefile variable for
     supporting C++ linking.  (Contributed by Arfrever Frehtes Taifersar
     Arahesis; bpo-1222585(20).)

   * ビルドプロセスは、pkg-config サポートに必要なファイルを生成するよう
     になりました。(Contributed by Clinton Roy; bpo-3585(21).)

   * ビルドプロセスは、Subversion 1.7 をサポートするようになりました。
     (Contributed by Arfrever Frehtes Taifersar Arahesis; bpo-6094(22).)

* Menu:

* カプセル::
* ポート特有の変更; Windows: ポート特有の変更 Windows.
* ポート特有の変更; Mac OS X: ポート特有の変更 Mac OS X.
* ポート特有の変更; FreeBSD: ポート特有の変更 FreeBSD.

   ---------- Footnotes ----------

   (1) 
https://web.archive.org/web/20110715084810/http://sourceware.org/gdb/current/onlinedocs/gdb/Python.html

   (2) https://bugs.python.org/issue?@action=redirect&bpo=8032

   (3) https://bugs.python.org/issue?@action=redirect&bpo=3632

   (4) https://bugs.python.org/issue?@action=redirect&bpo=4293

   (5) https://bugs.python.org/issue?@action=redirect&bpo=7033

   (6) https://bugs.python.org/issue?@action=redirect&bpo=7528

   (7) https://bugs.python.org/issue?@action=redirect&bpo=7767

   (8) https://www.cve.org/CVERecord?id=CVE-2008-5983

   (9) https://bugs.python.org/issue?@action=redirect&bpo=5753

   (10) https://bugs.python.org/issue?@action=redirect&bpo=5793

   (11) https://bugs.python.org/issue?@action=redirect&bpo=8276

   (12) https://bugs.python.org/issue?@action=redirect&bpo=7228

   (13) https://bugs.python.org/issue?@action=redirect&bpo=1590864

   (14) https://bugs.python.org/issue?@action=redirect&bpo=1722344

   (15) https://bugs.python.org/issue?@action=redirect&bpo=3102

   (16) https://bugs.python.org/issue?@action=redirect&bpo=7609

   (17) https://bugs.python.org/issue?@action=redirect&bpo=2422

   (18) https://bugs.python.org/issue?@action=redirect&bpo=6491

   (19) https://bugs.python.org/issue?@action=redirect&bpo=2937

   (20) https://bugs.python.org/issue?@action=redirect&bpo=1222585

   (21) https://bugs.python.org/issue?@action=redirect&bpo=3585

   (22) https://bugs.python.org/issue?@action=redirect&bpo=6094


File: python.info,  Node: カプセル,  Next: ポート特有の変更 Windows,  Up: ビルドならびに C API の変更<8>

1.16.12.1 カプセル
..................

Python 3.1 は、拡張モジュールに C API を提供する新しい C データ型 *note
PyCapsule: 148a. を追加しました。カプセルは、本質的には C の ‘void *’ ポ
インタのホルダであり、モジュール属性として利用できるようになります。例え
ば、 *note socket: d1. モジュールの API は ‘socket.CAPI’ として公開され
ていて、 *note unicodedata: 10b. は ‘ucnhash_CAPI’ を公開しています。そ
の他の拡張はモジュールを import し、辞書にアクセスしてカプセルオブジェク
トを取得し、そしてモジュールの様々な API 関数へのポインタの配列を指す
‘void *’ ポインタを取得できます。

There is an existing data type already used for this, ‘PyCObject’, but
it doesn't provide type safety.  Evil code written in pure Python could
cause a segmentation fault by taking a ‘PyCObject’ from module A and
somehow substituting it for the ‘PyCObject’ in module B. Capsules know
their own name, and getting the pointer requires providing the name:

     void *vtable;

     if (!PyCapsule_IsValid(capsule, "mymodule.CAPI") {
             PyErr_SetString(PyExc_ValueError, "argument type invalid");
             return NULL;
     }

     vtable = PyCapsule_GetPointer(capsule, "mymodule.CAPI");

‘vtable’ が期待どおりのものを指すことが保証されます。異なるカプセルが渡
されたら、 *note PyCapsule_IsValid(): 1574. は不適合な名前を検知し、偽を
返します。これらのオブジェクトの使用について、より詳しい情報は、 *note
拡張モジュールに C API を提供する: 1575. を参照してください。

Python 2.7 now uses capsules internally to provide various
extension-module APIs, but the ‘PyCObject_AsVoidPtr()’ was modified to
handle capsules, preserving compile-time compatibility with the
‘PyCObject’ interface.  Use of ‘PyCObject_AsVoidPtr()’ will signal a
*note PendingDeprecationWarning: ac5, which is silent by default.

Implemented in Python 3.1 and backported to 2.7 by Larry Hastings;
discussed in bpo-5630(1).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5630


File: python.info,  Node: ポート特有の変更 Windows,  Next: ポート特有の変更 Mac OS X,  Prev: カプセル,  Up: ビルドならびに C API の変更<8>

1.16.12.2 ポート特有の変更: Windows
...................................

   * The *note msvcrt: 97. module now contains some constants from the
     ‘crtassem.h’ header file: *note CRT_ASSEMBLY_VERSION: 1577, *note
     VC_ASSEMBLY_PUBLICKEYTOKEN: 1578, and *note
     LIBRARIES_ASSEMBLY_NAME_PREFIX: 1579.  (Contributed by David
     Cournapeau; bpo-4365(1).)

   * The *note _winreg: 11c. module for accessing the registry now
     implements the *note CreateKeyEx(): 157a. and *note DeleteKeyEx():
     157b. functions, extended versions of previously supported
     functions that take several extra arguments.  The *note
     DisableReflectionKey(): 157c, *note EnableReflectionKey(): 157d,
     and *note QueryReflectionKey(): 157e. were also tested and
     documented.  (Implemented by Brian Curtin: bpo-7347(2).)

   * The new ‘_beginthreadex()’ API is used to start threads, and the
     native thread-local storage functions are now used.  (Contributed
     by Kristján Valur Jónsson; bpo-3582(3).)

   * The *note os.kill(): 157f. function now works on Windows.  The
     signal value can be the constants *note CTRL_C_EVENT: 1580, *note
     CTRL_BREAK_EVENT: 1581, or any integer.  The first two constants
     will send ‘Control’-‘C’ and ‘Control’-‘Break’ keystroke events to
     subprocesses; any other value will use the ‘TerminateProcess()’
     API.  (Contributed by Miki Tebeka; bpo-1220212(4).)

   * *note os.listdir(): 1312. 関数は、空のパスに対してちゃんと失敗する
     ようになりました。 (Fixed by Hirokazu Yamamoto; bpo-5913(5).)

   * The *note mimetypes: 93. module will now read the MIME database
     from the Windows registry when initializing.  (Patch by Gabriel
     Genellina; bpo-4969(6).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=4365

   (2) https://bugs.python.org/issue?@action=redirect&bpo=7347

   (3) https://bugs.python.org/issue?@action=redirect&bpo=3582

   (4) https://bugs.python.org/issue?@action=redirect&bpo=1220212

   (5) https://bugs.python.org/issue?@action=redirect&bpo=5913

   (6) https://bugs.python.org/issue?@action=redirect&bpo=4969


File: python.info,  Node: ポート特有の変更 Mac OS X,  Next: ポート特有の変更 FreeBSD,  Prev: ポート特有の変更 Windows,  Up: ビルドならびに C API の変更<8>

1.16.12.3 ポート特有の変更: Mac OS X
....................................

   * 追加されたパッケージを、システムインストレーションとユーザがインス
     トールした同じバージョンのコピーで共有するために、 ‘sys.path’ に
     ‘/Library/Python/2.7/site-packages’ が追加されました。 (Changed by
     Ronald Oussoren; bpo-4865(1).)

     バージョン 2.7.13 で変更: As of 2.7.13, this change was removed.
     ‘/Library/Python/2.7/site-packages’, the site-packages directory
     used by the Apple-supplied system Python 2.7 is no longer appended
     to ‘sys.path’ for user-installed Pythons such as from the
     python.org installers.  As of macOS 10.12, Apple changed how the
     system site-packages directory is configured, which could cause
     installation of pip components, like setuptools, to fail.  Packages
     installed for the system Python will no longer be shared with
     user-installed Pythons.  (bpo-28440(2))

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=4865

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28440


File: python.info,  Node: ポート特有の変更 FreeBSD,  Prev: ポート特有の変更 Mac OS X,  Up: ビルドならびに C API の変更<8>

1.16.12.4 ポート特有の変更: FreeBSD
...................................

   * FreeBSD 7.1's ‘SO_SETFIB’ constant, used with the *note socket():
     fa1. methods *note getsockopt(): ed0./*note setsockopt(): ed1. to
     select an alternate routing table, is now available in the *note
     socket: d1. module.  (Added by Kyle VanderBeek; bpo-8235(1).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=8235


File: python.info,  Node: その他の変更と修正,  Next: Python 2 7 への移植,  Prev: ビルドならびに C API の変更<8>,  Up: What's New in Python 2 7

1.16.13 その他の変更と修正
--------------------------

   * ベンチマークスクリプトの 2 つ、 ‘iobench’ および ‘ccbench’, が
     ‘Tools’ ディレクトリに追加されました。 ‘iobench’ は、様々な演算を実
     行している間 *note open(): 316. によって返された組み込みファイル
     I/O オブジェクトの速度を計測し、 ‘ccbench’ は、変化する数のスレッド
     を使っていくつかのタスクを処理するときの計算スループット、スレッド
     切り替えレイテンシ、IO 処理バンド幅の計測を試みる同時実行ベンチマー
     クです。

   * ‘Tools/i18n/msgfmt.py’ スクリプトは、複数の形式の ‘.po’ ファイルを
     理解できるようになりました。(Fixed by Martin von Löwis;
     bpo-5464(1).)

   * When importing a module from a ‘.pyc’ or ‘.pyo’ file with an
     existing ‘.py’ counterpart, the *note co_filename: 1585. attributes
     of the resulting code objects are overwritten when the original
     filename is obsolete.  This can happen if the file has been
     renamed, moved, or is accessed through different paths.  (Patch by
     Ziga Seilnacht and Jean-Paul Calderone; bpo-1180193(2).)

   * ‘regrtest.py’ スクリプトは、テストを乱順に実行する ‘-r’ オプション
     の、ランダムシードに使われる整数を取る ‘--randseed=’ スイッチを取る
     ようになりました。 ‘-r’ オプションは、使われたシードも報告します。
     (Added by Collin Winter.)

   * もう一つの ‘regrtest.py’ スイッチは ‘-j’ で、いくつのテストを並行し
     て実行するかを指定する整数です。これにより、マルチコア機での合計実
     行時間を短縮できます。このオプションは、実行時間を長くすることで知
     られている ‘-R’ スイッチなど、いくつかの他のオプションと互換です。
     (Added by Antoine Pitrou, bpo-6152(3).)  これはまた、選ばれたテスト
     を失敗するまでループして実行する ‘-F’ スイッチとも同時に使えます。
     (Added by Antoine Pitrou; bpo-7312(4).)

   * スクリプトとして実行されるとき、 ‘py_compile.py’ モジュールは標準入
     力を読み込んでコンパイルするファイル名のリストとする ‘'-'’ を引数と
     して受け付けるようになりました。(Contributed by Piotr Ożarowski;
     bpo-8233(5).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5464

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1180193

   (3) https://bugs.python.org/issue?@action=redirect&bpo=6152

   (4) https://bugs.python.org/issue?@action=redirect&bpo=7312

   (5) https://bugs.python.org/issue?@action=redirect&bpo=8233


File: python.info,  Node: Python 2 7 への移植,  Next: Python 2 7 メンテナンスリリースで追加された新機能,  Prev: その他の変更と修正,  Up: What's New in Python 2 7

1.16.14 Python 2.7 への移植
---------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

   * The *note range(): b3d. function processes its arguments more
     consistently; it will now call *note __int__(): 19d. on non-float,
     non-integer arguments that are supplied to it.  (Fixed by Alexander
     Belopolsky; bpo-1533(1).)

   * 文字列 *note format(): 199. メソッドは浮動小数点数および複素数に使
     われるデフォルトの精度を、 *note str(): 169. で使われる精度に合わせ
     、小数第 6 位から 12 位に変更しました。 (Changed by Eric Smith;
     bpo-5920(2).)

   * Because of an optimization for the *note with: 186. statement, the
     special methods *note __enter__(): 7e4. and *note __exit__(): 1518.
     must belong to the object's type, and cannot be directly attached
     to the object's instance.  This affects new-style classes (derived
     from *note object: c7e.) and C extension types.  (bpo-6101(3).)

   * Due to a bug in Python 2.6, the 'exc_value' parameter to *note
     __exit__(): 1518. methods was often the string representation of
     the exception, not an instance.  This was fixed in 2.7, so
     'exc_value' will be an instance as expected.  (Fixed by Florent
     Xicluna; bpo-7853(4).)

   * ‘__slots__’ を利用して属性を制限した場合に、設定されていない属性を
     del したときに *note AttributeError: 5f0. にならなかったのを修正し
     ました。 (Fixed by Benjamin Peterson; bpo-7604(5).)

標準ライブラリでは:

   * 年がサポートされている範囲外にはみ出るような *note datetime: 4e2. イ
     ンスタンスの演算が、 *note OverflowError: a81. を送出しないことがあ
     りました。このようなエラーはより注意深く調べられ、例外を送出するよ
     うになりました。(Reported by Mark Leander, patch by Anand B. Pillai
     and Alexander Belopolsky; bpo-7150(6).)

   * *note Decimal: 1fe. インスタンスを文字列の *note format(): 199. メ
     ソッドに使うとき、デフォルトの揃えは以前は左揃えでした。これは右揃
     えに変更され、プログラムの出力が変わるかもしれません。(Changed by
     Mark Dickinson; bpo-6857(7).)

     signaling NaN (あるいは ‘sNAN’) との比較は、暗黙に比較演算に応じて
     真偽値を返すのではなく、 *note InvalidOperation: 12bc. 例外を発生さ
     せるようになりました。 Quiet NaN (あるいは ‘NAN’) はハッシュ可能に
     なりました。 (Fixed by Mark Dickinson; bpo-7279(8).)

   * The *note xml.etree.ElementTree: 12b. library no longer escapes
     ampersands and angle brackets when outputting an XML processing
     instruction (which looks like ‘<?xml-stylesheet href="#style1"?>’)
     or comment (which looks like ‘<!-- comment -->’).  (Patch by Neil
     Muller; bpo-2746(9).)

   * The ‘readline()’ method of *note StringIO: 112a. objects now does
     nothing when a negative length is requested, as other file-like
     objects do.  (bpo-7348(10)).

   * *note syslog: e2. モジュールは、識別子として、以前デフォルトであっ
     た ‘'python'’ の値ではなく、 ‘sys.argv[0]’ の値を使うようになりまし
     た。 (Changed by Sean Reifschneider; bpo-8451(11).)

   * *note tarfile: e4. モジュールのデフォルトエラー処理が変更され、致命
     的なエラーを抑制しないようになりました。デフォルトのエラーレベルは
     以前は 0 で、エラーはメッセージとしてデバッグログに書き込まれるだけ
     でしたが、デバッグログはデフォルトでは活性化されていないため、エラ
     ーは顧みられませんでした。デフォルトのエラーレベルは 1 になり、エラ
     ーがあれば例外が送出されます。 (Changed by Lars Gustäbel;
     bpo-7357(12).)

   * The *note urlparse: 110. module's *note urlsplit(): f3a. now
     handles unknown URL schemes in a fashion compliant with RFC
     3986(13): if the URL is of the form ‘"<something>://..."’, the text
     before the ‘://’ is treated as the scheme, even if it's a made-up
     scheme that the module doesn't know about.  This change may break
     code that worked around the old behaviour.  For example, Python
     2.6.4 or 2.5 will return the following:

          >>> import urlparse
          >>> urlparse.urlsplit('invented://host/filename?query')
          ('invented', '', '//host/filename?query', '', '')

     Python 2.7 (や Python 2.6.5) は以下を返します:

          >>> import urlparse
          >>> urlparse.urlsplit('invented://host/filename?query')
          ('invented', 'host', '/filename?query', '', '')

     (Python 2.7 では、これは普通のタプルではなく名前付きタプルを返すの
     で、実際は微妙に異なる出力をします。)

C 拡張では:

   * ‘PyArg_Parse*’ 系統の関数で整数フォーマットコードを使う C 拡張は、
     *note DeprecationWarning: 1a3. を引き起こすのではなく、 *note
     TypeError: 198. 例外を送出するようになりました。(bpo-5080(14))

   * Use the new *note PyOS_string_to_double(): 14ad. function instead
     of the old ‘PyOS_ascii_strtod()’ and ‘PyOS_ascii_atof()’ functions,
     which are now deprecated.

Python を埋め込んだアプリケーションでは:

   * The ‘PySys_SetArgvEx()’ function was added, letting applications
     close a security hole when the existing ‘PySys_SetArgv()’ function
     was used.  Check whether you're calling ‘PySys_SetArgv()’ and
     carefully consider whether the application should be using
     ‘PySys_SetArgvEx()’ with 'updatepath' set to false.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1533

   (2) https://bugs.python.org/issue?@action=redirect&bpo=5920

   (3) https://bugs.python.org/issue?@action=redirect&bpo=6101

   (4) https://bugs.python.org/issue?@action=redirect&bpo=7853

   (5) https://bugs.python.org/issue?@action=redirect&bpo=7604

   (6) https://bugs.python.org/issue?@action=redirect&bpo=7150

   (7) https://bugs.python.org/issue?@action=redirect&bpo=6857

   (8) https://bugs.python.org/issue?@action=redirect&bpo=7279

   (9) https://bugs.python.org/issue?@action=redirect&bpo=2746

   (10) https://bugs.python.org/issue?@action=redirect&bpo=7348

   (11) https://bugs.python.org/issue?@action=redirect&bpo=8451

   (12) https://bugs.python.org/issue?@action=redirect&bpo=7357

   (13) https://datatracker.ietf.org/doc/html/rfc3986.html

   (14) https://bugs.python.org/issue?@action=redirect&bpo=5080


File: python.info,  Node: Python 2 7 メンテナンスリリースで追加された新機能,  Next: 謝辞,  Prev: Python 2 7 への移植,  Up: What's New in Python 2 7

1.16.15 Python 2.7 メンテナンスリリースで追加された新機能
---------------------------------------------------------

Python 2.7 メンテナンスリリースでは、正真正銘それが求められる状況では、
新しい機能が追加される場合があります。そのような追加のどんなものでも
Python Enhancement Proposal プロセスを通過しなければなりません。Python 3
だけに新しい機能を追加することによっても Python Package Index に公開する
ことによってもいずれでも十分ではないと言えるだけのやむにやまれない理由付
けが必要です。

個別の提案は以下にリストしますが、全ての Python 2.7 メンテナンスリリース
に追加される新しい ‘-3’ 警告は除いています。

* Menu:

* デバッグモード用の2つの新しい環境変数::
* PEP 434; IDLE 拡張についての全てのブランチにおける例外的な扱い: PEP 434 IDLE 拡張についての全てのブランチにおける例外的な扱い.
* PEP 466; Python 2.7 のためのネットワークセキュリティ拡張: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張.
* PEP 477; Python 2.7 への ensurepip (PEP 453) バックポート: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート.
* PEP 476; stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化<2>.
* PEP 493; HTTPS verification migration tools for Python 2.7: PEP 493 HTTPS verification migration tools for Python 2 7.
* New make regen-all build target: New make regen-all build target<3>.
* Removal of make touch build target: Removal of make touch build target<3>.


File: python.info,  Node: デバッグモード用の2つの新しい環境変数,  Next: PEP 434 IDLE 拡張についての全てのブランチにおける例外的な扱い,  Up: Python 2 7 メンテナンスリリースで追加された新機能

1.16.15.1 デバッグモード用の2つの新しい環境変数
...............................................

In debug mode, the ‘[xxx refs]’ statistic is not written by default, the
‘PYTHONSHOWREFCOUNT’ environment variable now must also be set.
(Contributed by Victor Stinner; bpo-31733(1).)

When Python is compiled with ‘COUNT_ALLOC’ defined, allocation counts
are no longer dumped by default anymore: the ‘PYTHONSHOWALLOCCOUNT’
environment variable must now also be set.  Moreover, allocation counts
are now dumped into stderr, rather than stdout.  (Contributed by Victor
Stinner; bpo-31692(2).)

Added in version 2.7.15.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31733

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31692


File: python.info,  Node: PEP 434 IDLE 拡張についての全てのブランチにおける例外的な扱い,  Next: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張,  Prev: デバッグモード用の2つの新しい環境変数,  Up: Python 2 7 メンテナンスリリースで追加された新機能

1.16.15.2 PEP 434: IDLE 拡張についての全てのブランチにおける例外的な扱い
........................................................................

PEP 434(1) は、Pythonと一緒に出荷されるIDLE開発環境に変更を加えるための
一般的な免除事項を説明します。これは、IDLE の開発者 が Python 2 と 3 の
すべてのサポートされているバージョン間でより一貫したユーザーエクスペリエ
ンスを提供するためのものです。

全ての IDLE の変更についての詳細は、個別のリリースについてのNEWS ファイ
ルを参照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0434/


File: python.info,  Node: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張,  Next: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート,  Prev: PEP 434 IDLE 拡張についての全てのブランチにおける例外的な扱い,  Up: Python 2 7 メンテナンスリリースで追加された新機能

1.16.15.3 PEP 466: Python 2.7 のためのネットワークセキュリティ拡張
..................................................................

PEP 466(1) は、 Python 2.7 メンテナンスリリースに含めることを認められた
数多くのネットワークセキュリティ強化についての提案を記述しています。それ
ら変更の最初のものは Python 2.7.7 に初めて登場しました。

Python 2.7.7 に PEP 466(2) 関連で追加された機能:

   * *note hmac.compare_digest(): 12e0. が Python 3 からバックポートされ
     ました。これにより Python 2 アプリケーションで timing attack
     resistant comparison operation が利用可能になります (Contributed by
     Alex Gaynor; bpo-21306(3).)

   * python.org で公開される公式 Windows インストーラのビルドに使う
     OpenSSL が 1.0.1g にアップグレードされました .  (Contributed by
     Zachary Ware; bpo-21462(4).)

Python 2.7.8 に PEP 466(5) 関連で追加された機能:

   * *note hashlib.pbkdf2_hmac(): 733. が Python 3 からバックポートされ
     ました。これにより Python 2 アプリケーションでも、安全なパスワード
     格納に広範に使うのに相応しいハッシュアルゴリズムが利用できます
     (Contributed by Alex Gaynor; bpo-21304(6).)

   * OpenSSL 1.0.1h was upgraded for the official Windows installers
     published on python.org.  (Contributed by Zachary Ware in
     bpo-21671(7) for CVE 2014-0224(8).)

Python 2.7.9 に PEP 466(9) 関連で追加された機能:

   * Python 3.4 の *note ssl: d5. モジュールのほとんどがバックポートされ
     ました。つまり *note ssl: d5. は今や、Server Name Indication,
     TLS1.x 設定, platform certificate store へのアクセス, *note
     SSLContext: 357. クラス, その他機能が使えます (Contributed by Alex
     Gaynor and David Reid; bpo-21308(10).)

     個別の詳細については、モジュールのドキュメンテーション内の "バージ
     ョン 2.7.9 で追加" の注釈を参照してください。

   * *note os.urandom(): 746. は、呼び出しのたびに ‘/dev/urandom’ を開き
     なおす代わりに ‘/dev/urandom’ のファイル記述子をキャッシュするよう
     に変更されました。(Contributed by Alex Gaynor; bpo-21305(11).)

   * *note hashlib.algorithms_guaranteed: 158b. と *note
     hashlib.algorithms_available: 158c. が Python 3 からバックポートさ
     れました。これにより Python 2 アプリケーションが可能な限り最強のハ
     ッシュアルゴリズムを選択するのが容易になります (Contributed by Alex
     Gaynor in bpo-21307(12))

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0466/

   (2) https://peps.python.org/pep-0466/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=21306

   (4) https://bugs.python.org/issue?@action=redirect&bpo=21462

   (5) https://peps.python.org/pep-0466/

   (6) https://bugs.python.org/issue?@action=redirect&bpo=21304

   (7) https://bugs.python.org/issue?@action=redirect&bpo=21671

   (8) https://www.cve.org/CVERecord?id=CVE-2014-0224

   (9) https://peps.python.org/pep-0466/

   (10) https://bugs.python.org/issue?@action=redirect&bpo=21308

   (11) https://bugs.python.org/issue?@action=redirect&bpo=21305

   (12) https://bugs.python.org/issue?@action=redirect&bpo=21307


File: python.info,  Node: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート,  Next: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化<2>,  Prev: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張,  Up: Python 2 7 メンテナンスリリースで追加された新機能

1.16.15.4 PEP 477: Python 2.7 への ensurepip (PEP 453) バックポート
...................................................................

PEP 477(1) が Python 2.7 メンテナンスリリースに PEP 453(2) ensurepip モ
ジュール, それによって可能になるドキュメンテーションの改善を含めることを
認め、Python 2.7.9 リリースではじめてお披露目されました。

* Menu:

* デフォルトでの pip のブートストラッピング: デフォルトでの pip のブートストラッピング<2>.
* ドキュメントの変更: ドキュメントの変更<2>.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0477/

   (2) https://peps.python.org/pep-0453/


File: python.info,  Node: デフォルトでの pip のブートストラッピング<2>,  Next: ドキュメントの変更<2>,  Up: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート

1.16.15.5 デフォルトでの pip のブートストラッピング
...................................................

新しい *note ensurepip: 59. モジュール( PEP 453(1) で定義されています)は
標準のクロスプラットフォームのメカニズムで、Python インストールに pip イ
ンストーラをブートストラップします。Python 2.7.9 に含まれる ‘pip’ のバー
ジョンは ‘pip’ 1.5.6 で、将来の 2.7.x メンテナンスリリースでは Python の
リリース候補の作成時点で入手出来る最新バージョンの ‘pip’ がバンドルされ
る予定です。

デフォルトでは ‘pip’ , ‘pipX’ , ‘pipX.Y’ コマンドが全てのプラットフォー
ムに、Python パッケージ ‘pip’ とその依存物とともにインストールされます
(X.  Y はインストールされる Python のバージョン)。

CPython の *note source builds on POSIX systems: 10f6. では ‘make
install’, ‘make altinstall’ コマンドはデフォルトでは ‘pip’ ブートストラ
ップを行いません。この振る舞いは configure のオプションを変更して
Makefile を作ることで変更できます。

Windows と Mac OS X では CPython インストーラはそれ自身と一緒に ‘pip’ を
デフォルトでインストールするようになっています(ユーザはインストールプロ
セスで除外するかもしれませんが)。Windows ユーザは ‘pip’ がコマンドライン
からデフォルトで利用可能なように ‘PATH’ の自動修正するかの選択を求められ
ます。そうしない場合でも Windows のための Python ランチャで ‘py -m pip’
のようにすれば良いです。

As discussed in the PEP(2), platform packagers may choose not to install
these commands by default, as long as, when invoked, they provide clear
and simple directions on how to install them on that platform (usually
using the system package manager).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0453/

   (2) 
https://peps.python.org/pep-0477/#disabling-ensurepip-by-downstream-distributors


File: python.info,  Node: ドキュメントの変更<2>,  Prev: デフォルトでの pip のブートストラッピング<2>,  Up: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート

1.16.15.6 ドキュメントの変更
............................

この変更の一部は、 *note Python モジュールのインストール: 10f8. と
distributing-index セクションがより手短な始め方として完全にデザインし直
されたことと、FAQ ドキュメントです。ほとんどのパッケージングについてのド
キュメンテーションは Python Packaging User Guide(1) が保守している
Python Packaging Authority に移動されて、独立したプロジェクトのドキュメ
ンテーションになっています。

However, as this migration is currently still incomplete, the legacy
versions of those guides remaining available as *note setuptools による
C および C++ 拡張のビルド: 10f9. and *note setuptools による C および
C++ 拡張のビルド: 10fa.

参考
....

PEP 453(2) - Python インストールの際の明示的なpipのブートストラッピング

     PEP は Donald Stufft と Nick Coghlan によって書かれ、Donald Stufft,
     Nick Coghlan, Martin von Löwis, Ned Deily により実装されました。

   ---------- Footnotes ----------

   (1) https://packaging.python.org

   (2) https://peps.python.org/pep-0453/


File: python.info,  Node: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化<2>,  Next: PEP 493 HTTPS verification migration tools for Python 2 7,  Prev: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート,  Up: Python 2 7 メンテナンスリリースで追加された新機能

1.16.15.7 PEP 476: stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化
.....................................................................................

PEP 476(1) updated *note httplib: 72. and modules which use it, such as
*note urllib2: 111. and *note xmlrpclib: 134, to now verify that the
server presents a certificate which is signed by a Certificate Authority
in the platform trust store and whose hostname matches the hostname
being requested by default, significantly improving security for many
applications.  This change was made in the Python 2.7.9 release.

以前の古い振る舞いが必要なアプリケーションでは、代わりとなるコンテキスト
を渡せます:

     import urllib2
     import ssl

     # This disables all verification
     context = ssl._create_unverified_context()

     # This allows using a specific certificate for the host, which doesn't need
     # to be in the trust store
     context = ssl.create_default_context(cafile="/path/to/file.crt")

     urllib2.urlopen("https://invalid-cert", context=context)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0476/


File: python.info,  Node: PEP 493 HTTPS verification migration tools for Python 2 7,  Next: New make regen-all build target<3>,  Prev: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化<2>,  Up: Python 2 7 メンテナンスリリースで追加された新機能

1.16.15.8 PEP 493: HTTPS verification migration tools for Python 2.7
....................................................................

PEP 493(1) provides additional migration tools to support a more
incremental infrastructure upgrade process for environments containing
applications and services relying on the historically permissive
processing of server certificates when establishing client HTTPS
connections.  These additions were made in the Python 2.7.12 release.

These tools are intended for use in cases where affected applications
and services can't be modified to explicitly pass a more permissive SSL
context when establishing the connection.

For applications and services which can't be modified at all, the new
‘PYTHONHTTPSVERIFY’ environment variable may be set to ‘0’ to revert an
entire Python process back to the default permissive behaviour of Python
2.7.8 and earlier.

For cases where the connection establishment code can't be modified, but
the overall application can be, the new
‘ssl._https_verify_certificates()’ function can be used to adjust the
default behaviour at runtime.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0493/


File: python.info,  Node: New make regen-all build target<3>,  Next: Removal of make touch build target<3>,  Prev: PEP 493 HTTPS verification migration tools for Python 2 7,  Up: Python 2 7 メンテナンスリリースで追加された新機能

1.16.15.9 New ‘make regen-all’ build target
...........................................

To simplify cross-compilation, and to ensure that CPython can reliably
be compiled without requiring an existing version of Python to already
be available, the autotools-based build system no longer attempts to
implicitly recompile generated files based on file modification times.

Instead, a new ‘make regen-all’ command has been added to force
regeneration of these files when desired (e.g.  after an initial version
of Python has already been built based on the pregenerated versions).

More selective regeneration targets are also defined - see
Makefile.pre.in(1) for details.

(Victor Stinner の貢献による bpo-23404(2))

Added in version 2.7.14.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Makefile.pre.in

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23404


File: python.info,  Node: Removal of make touch build target<3>,  Prev: New make regen-all build target<3>,  Up: Python 2 7 メンテナンスリリースで追加された新機能

1.16.15.10 Removal of ‘make touch’ build target
...............................................

The ‘make touch’ build target previously used to request implicit
regeneration of generated files by updating their modification times has
been removed.

It has been replaced by the new ‘make regen-all’ target.

(Victor Stinner の貢献による bpo-23404(1))

バージョン 2.7.14 で変更.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23404


File: python.info,  Node: 謝辞,  Prev: Python 2 7 メンテナンスリリースで追加された新機能,  Up: What's New in Python 2 7

1.16.16 謝辞
------------

著者は、以下の方々がこの記事の多くの草稿に提案、修正、そして助力を差し伸
べてくださったことに感謝の意を表したいと思います: Nick Coghlan, Philip
Jenvey, Ryan Lovett, R. David Murray, Hugh Secker-Walker.


File: python.info,  Node: What's New in Python 2 6,  Next: What's New in Python 2 5,  Prev: What's New in Python 2 7,  Up: What's New in Python

1.17 What's New in Python 2.6
=============================


著者: A.M. Kuchling (amk at amk.ca)

This article explains the new features in Python 2.6, released on
October 1, 2008.  The release schedule is described in PEP 361(1).

The major theme of Python 2.6 is preparing the migration path to Python
3.0, a major redesign of the language.  Whenever possible, Python 2.6
incorporates new features and syntax from 3.0 while remaining compatible
with existing code by not removing older features or syntax.  When it's
not possible to do that, Python 2.6 tries to do what it can, adding
compatibility functions in a ‘future_builtins’ module and a ‘-3’ switch
to warn about usages that will become unsupported in 3.0.

*note multiprocessing: 98. や *note json: 86. といった、いくつか重要な新
しいパッケージが標準ライブラリに追加されましたが、Python 3.0 に何らかも
関係しない新機能はあまり多くはありません。

Python 2.6 ではさらに、たくさんの改善とバグフィックスがソースコードのあ
りとあらゆる場所に見られます。Python 2.5 から 2.6 の変更ログを手繰ってみ
ると、低く見積もっても、適用されたパッチは 259、フィックスされたバグは
612 にのぼります。

このドキュメントは新機能の完全な詳細を提供するのではなくて、簡易な概要を
提供することを目的にしています。完全な詳細が知りたければ、 Python 2.6 の
ドキュメントを参照してください。設計と実装の根拠を理解したい場合は、新機
能に関する PEP を参照してください。可能な限り、 "What’s New in Python" は
各変更の bug や patch に対してリンクしています。

* Menu:

* Python 3.0: Python 3 0.
* 開発プロセスに関する変更::
* PEP 343; "with" ステートメント: PEP 343 "with" ステートメント.
* PEP 366; メインモジュールからの明示的相対インポート: PEP 366 メインモジュールからの明示的相対インポート.
* PEP 370; ユーザごとの site-packages ディレクトリ: PEP 370 ユーザごとの site-packages ディレクトリ.
* PEP 371; multiprocessing パッケージ: PEP 371 multiprocessing パッケージ.
* PEP 3101; 進化版文字列フォーマッティング: PEP 3101 進化版文字列フォーマッティング.
* PEP 3105; print を関数にする: PEP 3105 print を関数にする.
* PEP 3110; 例外処理の変更: PEP 3110 例外処理の変更.
* PEP 3112; バイトリテラル: PEP 3112 バイトリテラル.
* PEP 3116; 新しい I/O ライブラリ: PEP 3116 新しい I/O ライブラリ.
* PEP 3118; 改訂版バッファプロトコル: PEP 3118 改訂版バッファプロトコル.
* PEP 3119; 抽象基底クラス: PEP 3119 抽象基底クラス.
* PEP 3127; 整数リテラルのサポートと文法: PEP 3127 整数リテラルのサポートと文法.
* PEP 3129; クラスデコレータ: PEP 3129 クラスデコレータ.
* PEP 3141; 数値の型階層: PEP 3141 数値の型階層.
* その他の言語変更: その他の言語変更<15>.
* 新しいモジュールと改良されたモジュール: 新しいモジュールと改良されたモジュール<2>.
* 非推奨と削除::
* ビルドならびに C API の変更: ビルドならびに C API の変更<9>.
* Python 2.6 への移植: Python 2 6 への移植.
* 謝辞: 謝辞<2>.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0361/


File: python.info,  Node: Python 3 0,  Next: 開発プロセスに関する変更,  Up: What's New in Python 2 6

1.17.1 Python 3.0
-----------------

Python 2.6 と 3.0 の開発サイクルは同期していました。両バージョンのアルフ
ァ、ベータリリースは同じ日にリリースされています。3.0 の開発は 2.6 の多
くの機能に影響を与えました。

Python 3.0 は、2.x シリーズとの互換性を破壊する、広範囲な再設計です。こ
れは、Python 3.0 で動作させるためには既存のコードに何らかの変換が必要な
ことを意味しています。しかしながら、必ずしも全ての 3.0 での変更が互換性
を破壊するわけではありません。新機能が既存のコードの破壊を引き起こさない
ケースにおいては、それらは 2.6 にバックポートされました。これらについて
はこのドキュメントの適切な場所に記載しています。3.0 由来の機能の一部とし
ては以下があります:

   * オブジェクトを複素数(虚数)に変換する ‘__complex__()’ メソッド。

   * 例外の捕捉の、これまでとは別の文法の追加: ‘except TypeError as exc’
     。

   * 組み込み関数 ‘reduce()’ への別名としての *note functools.reduce():
     21a. の追加。

Python 3.0 adds several new built-in functions and changes the semantics
of some existing builtins.  Functions that are new in 3.0 such as *note
bin(): 14c0. have simply been added to Python 2.6, but existing builtins
haven't been changed; instead, the ‘future_builtins’ module has versions
with the new 3.0 semantics.  Code written to be compatible with 3.0 can
do ‘from future_builtins import hex, map’ as necessary.

A new command-line switch, ‘-3’, enables warnings about features that
will be removed in Python 3.0.  You can run code with this switch to see
how much work will be necessary to port code to 3.0.  The value of this
switch is available to Python code as the boolean variable
‘sys.py3kwarning’, and to C extension code as ‘Py_Py3kWarningFlag’.

参考
....

The 3'xxx' series of PEPs, which contains proposals for Python 3.0.  PEP
3000(1) describes the development process for Python 3.0.  Start with
PEP 3100(2) that describes the general goals for Python 3.0, and then
explore the higher-numbered PEPs that propose specific features.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3000/

   (2) https://peps.python.org/pep-3100/


File: python.info,  Node: 開発プロセスに関する変更,  Next: PEP 343 "with" ステートメント,  Prev: Python 3 0,  Up: What's New in Python 2 6

1.17.2 開発プロセスに関する変更
-------------------------------

2.6 の開発の間で、Python 開発プロセスは 2 つの重要な変更を経験しました:
SourceForge の課題トラッカーから、カスタイマイズした Roundup インストレ
ーションに乗り換えました。また、ドキュメントは LaTeX から
reStructuredText に変換しました。

* Menu:

* 新しい課題トラッカー; Roundup: 新しい課題トラッカー Roundup.
* 新しいドキュメンテーションフォーマット; Sphinx を使っての reStructuredText: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText.


File: python.info,  Node: 新しい課題トラッカー Roundup,  Next: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText,  Up: 開発プロセスに関する変更

1.17.2.1 新しい課題トラッカー: Roundup
......................................

もう随分長いこと Python 開発者たちは、SourceForge のバグトラッカーにイラ
イラを高め続けてきました。SourceForge がホストするソリューションには全く
カスタマイズの余地がなく、たとえば課題のライフサイクルをカスタマイズ出来
ませんでした。

The infrastructure committee of the Python Software Foundation therefore
posted a call for issue trackers, asking volunteers to set up different
products and import some of the bugs and patches from SourceForge.  Four
different trackers were examined: Jira(1), Launchpad(2), Roundup(3), and
Trac(4).  The committee eventually settled on Jira and Roundup as the
two candidates.  Jira is a commercial product that offers no-cost hosted
instances to free-software projects; Roundup is an open-source project
that requires volunteers to administer it and a server to host it.

ボランティアへの呼び掛けののち、新しい Roundup インストレーションが
‘https://bugs.python.org’ にセットアップされました。Roundup の一つのイン
ストレーションは複数のトラッカーをホスト出来るため、このサーバは今では
Jython と Python ウェブサイトのための課題トラッカーもホストしています。
間違いなく将来はほかのものもホストするでしょう。可能な場所では、"What's
New in Python" のこのエディションでは、それぞれの変更についてのバグ/パッ
チの Roundup アイテムにリンクします。

Hosting of the Python bug tracker is kindly provided by Upfront
Systems(5) of Stellenbosch, South Africa.  Martin von Löwis put a lot of
effort into importing existing bugs and patches from SourceForge; his
scripts for this import operation are at
‘https://svn.python.org/view/tracker/importer/’ and may be useful to
other projects wishing to move from SourceForge to Roundup.

参考
....

‘https://bugs.python.org’

     Python のバグトラッカー。

‘https://bugs.jython.org’:

     Jython のバグトラッカー。

‘https://roundup.sourceforge.io/’

     Roundup のダウンロードとドキュメント。

‘https://svn.python.org/view/tracker/importer/’

     Martin von Löwis の変換スクリプト。

   ---------- Footnotes ----------

   (1) https://www.atlassian.com/software/jira/

   (2) https://launchpad.net/

   (3) https://roundup.sourceforge.io/

   (4) https://trac.edgewall.org/

   (5) https://upfrontsoftware.co.za


File: python.info,  Node: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText,  Prev: 新しい課題トラッカー Roundup,  Up: 開発プロセスに関する変更

1.17.2.2 新しいドキュメンテーションフォーマット: Sphinx を使っての reStructuredText
...................................................................................

Python のドキュメンテーションは、そのプロジェクトの開始した 1989 年頃よ
り LaTeX を使って書かれてきました。1980 年代と 1990 年代初期は、ほとんど
のドキュメンテーションはあとで学習するために印刷されるもので、オンライン
で見るものではありませんでした。LaTeX はとても魅惑的な印刷をしてくれるも
のですから、非常に大変広く広く使われていましたが、一方では、学んだマーク
アップの基礎的なルールで直裁的に、書いたらそれっきり、というものでもあり
ました。

こんにちにおいてもなお、印刷を命題とする出版において LaTeX は健在といえ
ど、プログラミングの道具立ての風景は変わりました。わたしたちはもはやドキ
ュメンテーションの紙束をプリントアウトはしません。代わりにオンラインでブ
ラウズします。ですから HTML は、サポートすべき最も重要なフォーマットにな
りました。悲しいかな、 LaTeX から HTML への変換は気が狂うほどに複雑で、
Fred L. Drake Jr.、彼は長らく Python ドキュメンテーションのエディターを
務めていますが、彼はその変換処理の保守に多大な時間を浪費していたのです。
ときおり人々はドキュメンテーションを SGML に変換して、それから XML にす
ればいいでしょ、と持ちかけるのですが、良い変換を達成することにとらわれて
、誰一人として仕事を完遂させようと時間を捧げることはしませんでした。

During the 2.6 development cycle, Georg Brandl put a lot of effort into
building a new toolchain for processing the documentation.  The
resulting package is called Sphinx, and is available from
‘https://www.sphinx-doc.org/’.

Sphinx は HTML 出力に集中し、人を惹きつけるスタイルでモダンな HTML を生
成します。印刷出力は LaTeX への変換を経由することで健在です。入力のフォ
ーマットは reStructuredText です。これはカスタムな拡張とディレクティブを
サポートしているマークアップ文法で、Python コミュニティでは広く使われて
います。

Sphinx は執筆に使えるスタンドアロンのパッケージです。そして 2 ダースに届
かんばかりのプロジェクト (Sphinx ウェブサイトのリスト(1)) が Sphinx をド
キュメンテーションツールとして採用しました。

参考
....

Documenting Python(2)

     Python ドキュメントの書き方について書いています。

Sphinx(3)

     Sphinx ツールチェインのドキュメントとコードです。

Docutils(4)

     縁の下の力持ちになっている reStructuredText のパーサとツールセット
     です。

   ---------- Footnotes ----------

   (1) https://www.sphinx-doc.org/en/master/examples.html

   (2) https://devguide.python.org/documenting/

   (3) https://www.sphinx-doc.org/

   (4) https://docutils.sourceforge.io


File: python.info,  Node: PEP 343 "with" ステートメント,  Next: PEP 366 メインモジュールからの明示的相対インポート,  Prev: 開発プロセスに関する変更,  Up: What's New in Python 2 6

1.17.3 PEP 343: "with" ステートメント
-------------------------------------

Python 2.5 では、 '*note with: 186.' 文が ‘from __future__ import
with_statement’ ディレクティブで有効に出来るオプションの機能として追加さ
れました。2.6 では '‘with’' 文は特別に有効化する必要なく、もういつでもそ
こにあります。このセクションの残りの部分は "What's New in Python 2.5" の
対応するセクションからの丸々コピーですので、2.5 で '‘with’' 文に馴染んで
いるなら読み飛ばしてもらって結構です。

'*note with: 186.' ステートメントは、以前なら後片付けが実行されるのを確
実にするために ‘try...finally’ ブロックを使ったであろうようなコードを、
より単純明快にします。このセクションでは、このステートメントの普通の使い
方を説明します。続くセクションでは実装の詳細を調べ、このステートメントと
ともに使うためにオブジェクトをどうやって書けば良いかをお見せします。

'*note with: 186.' ステートメントは基本構造が以下となる制御フロー構造で
す:

     with expression [as variable]:
         with-block

The expression is evaluated, and it should result in an object that
supports the context management protocol (that is, has *note
__enter__(): 7e4. and *note __exit__(): 1518. methods).

The object's *note __enter__(): 7e4. is called before 'with-block' is
executed and therefore can run set-up code.  It also may return a value
that is bound to the name 'variable', if given.  (Note carefully that
'variable' is 'not' assigned the result of 'expression'.)

After execution of the 'with-block' is finished, the object's *note
__exit__(): 1518. method is called, even if the block raised an
exception, and can therefore run clean-up code.

いくつかの Python 標準オブジェクトが既にコンテキスト管理プロトコルをサポ
ートしていて、 '*note with: 186.' とともに使えます。ファイルオブジェクト
がその一例です:

     with open('/etc/passwd', 'r') as f:
         for line in f:
             print line
             ... more processing code ...

このステートメントが実行し終わったあかつきには、 'f' のファイルオブジェ
クトは、たとえ *note for: 34a. ループが道半ばにして例外と成り果てても、
自動的にクローズされます。

     注釈: In this case, 'f' is the same object created by *note open():
     316, because *note __enter__(): 7e4. returns 'self'.

*note threading: f3. モジュールのロック・条件変数でも '*note with: 186.'
ステートメントの恩恵にあずかれます:

     lock = threading.Lock()
     with lock:
         # Critical section of code
         ...

ブロックが実行される前にロックが獲得されて、ブロックが完了するやいなや必
ず解放されます。

The *note localcontext(): 159e. function in the *note decimal: 3a.
module makes it easy to save and restore the current decimal context,
which encapsulates the desired precision and rounding characteristics
for computations:

     from decimal import Decimal, Context, localcontext

     # Displays with default precision of 28 digits
     v = Decimal('578')
     print v.sqrt()

     with localcontext(Context(prec=16)):
         # All code in this block uses a precision of 16 digits.
         # The original context is restored on exiting the block.
         print v.sqrt()

* Menu:

* コンテキストマネージャを書く::
* contextlib モジュール::


File: python.info,  Node: コンテキストマネージャを書く,  Next: contextlib モジュール,  Up: PEP 343 "with" ステートメント

1.17.3.1 コンテキストマネージャを書く
.....................................

中身を紐解いてみれば、 '*note with: 186.' ステートメントはけっこう入り組
んでいます。ほとんどの人にとっては、既存のオブジェクトを '‘with’' ととも
に使うだけのことでその詳細を知る必要は無いので、それで良いならこのセクシ
ョンの残りの部分は読み飛ばして結構です。新しいオブジェクトの作者は基礎と
なる実装の詳細について知る必要があるので、このまま読み進めるべきです。

コンテキスト管理プロトコルの高度な説明はこんなです:

   * The expression is evaluated and should result in an object called a
     "context manager".  The context manager must have *note
     __enter__(): 7e4. and *note __exit__(): 1518. methods.

   * The context manager's *note __enter__(): 7e4. method is called.
     The value returned is assigned to 'VAR'. If no ‘as VAR’ clause is
     present, the value is simply discarded.

   * 'BLOCK' 内のコードが実行されます。

   * If 'BLOCK' raises an exception, the context manager's *note
     __exit__(): 1518. method is called with three arguments, the
     exception details (‘type, value, traceback’, the same values
     returned by *note sys.exc_info(): 89a, which can also be ‘None’ if
     no exception occurred).  The method's return value controls whether
     an exception is re-raised: any false value re-raises the exception,
     and ‘True’ will result in suppressing it.  You'll only rarely want
     to suppress the exception, because if you do the author of the code
     containing the '*note with: 186.' statement will never realize
     anything went wrong.

   * If 'BLOCK' didn't raise an exception, the *note __exit__(): 1518.
     method is still called, but 'type', 'value', and 'traceback' are
     all ‘None’.

例を通じて考えましょう。枝葉末節を含んだ完璧なコードを提示しようとは思い
ませんが、データベースのためにトランザクションをサポートするのに必要とな
るメソッドの書き方についてスケッチしてみようと思います。

(データベース用語に不慣れな方へ:データベースへの変更のセットは、トランザ
クションという単位でグループ化されています。トランザクションは「コミット
」される、その意味は、全ての変更がデータベースに書き込まれることです、も
しくは「ロールバック」される、この場合全ての変更が捨てられてデータベース
が変更されません、この 2 つのいずれかになりえます。詳しくはなにかデータ
ベースの著述を読んで下さい。)

データベース接続を表現するオブジェクトがあると仮定しましょう。私たちの目
標は、そのオブジェクトのユーザがこのように書けるようになることです:

     db_connection = DatabaseConnection()
     with db_connection as cursor:
         cursor.execute('insert into ...')
         cursor.execute('delete from ...')
         # ... more operations ...

The transaction should be committed if the code in the block runs
flawlessly or rolled back if there's an exception.  Here's the basic
interface for ‘DatabaseConnection’ that I'll assume:

     class DatabaseConnection:
         # Database interface
         def cursor(self):
             "Returns a cursor object and starts a new transaction"
         def commit(self):
             "Commits current transaction"
         def rollback(self):
             "Rolls back current transaction"

The *note __enter__(): 7e4. method is pretty easy, having only to start
a new transaction.  For this application the resulting cursor object
would be a useful result, so the method will return it.  The user can
then add ‘as cursor’ to their '*note with: 186.' statement to bind the
cursor to a variable name.

     class DatabaseConnection:
         ...
         def __enter__(self):
             # Code to start a new transaction
             cursor = self.cursor()
             return cursor

The *note __exit__(): 1518. method is the most complicated because it's
where most of the work has to be done.  The method has to check if an
exception occurred.  If there was no exception, the transaction is
committed.  The transaction is rolled back if there was an exception.

下記のコード内では実行がメソッドの末尾まで落ちていって、なのでデフォルト
の ‘None’ 返却になります。 ‘None’ は偽なので、例外は自動的に再送出されま
す。望むならもっと明示的に、コメントでマークした部分で *note return:
1af. 文を書いてもよろしいです:

     class DatabaseConnection:
         ...
         def __exit__(self, type, value, tb):
             if tb is None:
                 # No exception, so commit
                 self.commit()
             else:
                 # Exception occurred, so rollback.
                 self.rollback()
                 # return False


File: python.info,  Node: contextlib モジュール,  Prev: コンテキストマネージャを書く,  Up: PEP 343 "with" ステートメント

1.17.3.2 contextlib モジュール
..............................

*note contextlib: 27. モジュールは、 '*note with: 186.' ステートメントで
使えるオブジェクトを書く際に便利ないくつかの関数とデコレータを提供してい
ます。

The decorator is called *note contextmanager(): 141b, and lets you write
a single generator function instead of defining a new class.  The
generator should yield exactly one value.  The code up to the *note
yield: bc2. will be executed as the *note __enter__(): 7e4. method, and
the value yielded will be the method's return value that will get bound
to the variable in the '*note with: 186.' statement's ‘as’ clause, if
any.  The code after the ‘yield’ will be executed in the *note
__exit__(): 1518. method.  Any exception raised in the block will be
raised by the ‘yield’ statement.

このデコレータを使って、前セクションの私たちのデータベースの例はこのよう
に書けます:

     from contextlib import contextmanager

     @contextmanager
     def db_transaction(connection):
         cursor = connection.cursor()
         try:
             yield cursor
         except:
             connection.rollback()
             raise
         else:
             connection.commit()

     db = DatabaseConnection()
     with db_transaction(db) as cursor:
         ...

*note contextlib: 27. モジュールには ‘nested(mgr1, mgr2, ...)’ 関数もあ
り、この関数はたくさんのコンテキストマネージャを組み合わせることができて
、入れ子の '*note with: 186.' を書く必要性をなくしてくれます。この例では
、単一の '‘with’' でデータベーストランザクション開始とスレッドのロック獲
得の両方をやってのけています:

     lock = threading.Lock()
     with nested (db_transaction(db), lock) as (cursor, locked):
         ...

Finally, the *note closing(): 15a1. function returns its argument so
that it can be bound to a variable, and calls the argument's ‘.close()’
method at the end of the block.

     import urllib, sys
     from contextlib import closing

     with closing(urllib.urlopen('http://www.yahoo.com')) as f:
         for line in f:
             sys.stdout.write(line)

参考
....

PEP 343(1) - "with" ステートメント

     PEP は Guido van Rossum と Nick Coghlan によって書かれ、Mike Bland、
     Guido van Rossum、Neal Norwitz により実装されました。この PEP は
     '*note with: 186.' ステートメントによって生成されるコードを見せてく
     れるので、このステートメントがどうやって動作するのかを知るのに役立
     ちます。

*note contextlib: 27. モジュールについてのドキュメント。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0343/


File: python.info,  Node: PEP 366 メインモジュールからの明示的相対インポート,  Next: PEP 370 ユーザごとの site-packages ディレクトリ,  Prev: PEP 343 "with" ステートメント,  Up: What's New in Python 2 6

1.17.4 PEP 366: メインモジュールからの明示的相対インポート
----------------------------------------------------------

Python のオプション *note -m: 23c. で、モジュールをスクリプトとして実行
出来ます。パッケージ内のモジュールを実行する際に、相対インポートが正しく
動作していませんでした。

The fix for Python 2.6 adds a *note module.__package__: 323. attribute.
When this attribute is present, relative imports will be relative to the
value of this attribute instead of the *note __name__: 15a3. attribute.

PEP 302-style importers can then set *note __package__: 323. as
necessary.  The *note runpy: c3. module that implements the *note -m:
23c. switch now does this, so relative imports will now work correctly
in scripts running from inside a package.


File: python.info,  Node: PEP 370 ユーザごとの site-packages ディレクトリ,  Next: PEP 371 multiprocessing パッケージ,  Prev: PEP 366 メインモジュールからの明示的相対インポート,  Up: What's New in Python 2 6

1.17.5 PEP 370: ユーザごとの ‘site-packages’ ディレクトリ
---------------------------------------------------------

When you run Python, the module search path ‘sys.path’ usually includes
a directory whose path ends in ‘"site-packages"’.  This directory is
intended to hold locally installed packages available to all users using
a machine or a particular site installation.

Python 2.6 ではユーザ固有のサイトディレクトリのための決まりを導入しまし
た。ディレクトリはプラットフォームに依存して変わります。

   * Unix と Mac OS X: ‘~/.local/’

   * Windows: ‘%APPDATA%/Python’

このディレクトリ内にはバージョン固有のサブディレクトリが入ります。
Unix/Mac OS では ‘lib/python2.6/site-packages’ のように、Windows では
‘Python26/site-packages’ のように。

If you don't like the default directory, it can be overridden by an
environment variable.  *note PYTHONUSERBASE: 15a5. sets the root
directory used for all Python versions supporting this feature.  On
Windows, the directory for application-specific data can be changed by
setting the ‘APPDATA’ environment variable.  You can also modify the
‘site.py’ file for your Python installation.

この機能は Python 起動時に *note -s: 15a6. オプションを付けるか、環境変
数 *note PYTHONNOUSERSITE: 15a7. をセットすることで完全に無効に出来ます
。

参考
....

PEP 370(1) - ユーザごとの ‘site-packages’ ディレクトリ

     PEP 著と実装 Christian Heimes.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0370/


File: python.info,  Node: PEP 371 multiprocessing パッケージ,  Next: PEP 3101 進化版文字列フォーマッティング,  Prev: PEP 370 ユーザごとの site-packages ディレクトリ,  Up: What's New in Python 2 6

1.17.6 PEP 371: ‘multiprocessing’ パッケージ
--------------------------------------------

新しい *note multiprocessing: 98. により、Python プログラムが新たなプロ
セスを作成して何か計算を実行させて結果を返させることが出来ます。親と子の
プロセスはキューとパイプを使って通信し、ロックとセマフォを使って同期し、
単純なデータの配列を共有出来ます。

The *note multiprocessing: 98. module started out as an exact emulation
of the *note threading: f3. module using processes instead of threads.
That goal was discarded along the path to Python 2.6, but the general
approach of the module is still similar.  The fundamental class is the
*note Process: 252, which is passed a callable object and a collection
of arguments.  The *note start(): 15a9. method sets the callable running
in a subprocess, after which you can call the *note is_alive(): 15aa.
method to check whether the subprocess is still running and the *note
join(): 15ab. method to wait for the process to exit.

ここに、サブプロセスが階乗を計算する例を示します。その計算をする関数はヘ
ンテコリンに書かれていて、入力が 4 の倍数だととっても時間がかかるように
仕組んであります。

     import time
     from multiprocessing import Process, Queue


     def factorial(queue, N):
         "Compute a factorial."
         # If N is a multiple of 4, this function will take much longer.
         if (N % 4) == 0:
             time.sleep(.05 * N/4)

         # Calculate the result
         fact = 1L
         for i in range(1, N+1):
             fact = fact * i

         # Put the result on the queue
         queue.put(fact)

     if __name__ == '__main__':
         queue = Queue()

         N = 5

         p = Process(target=factorial, args=(queue, N))
         p.start()
         p.join()

         result = queue.get()
         print 'Factorial', N, '=', result

*note Queue: 15ac. が factorial の結果を通信して返すのに使われています。
*note Queue: 15ac. オブジェクトはグローバル変数に格納されています。子プ
ロセスは、子プロセスが作成された時点のその変数の値を使うことになります;
*note Queue: 15ac. なので、親子はそのオブジェクトを通信のために使うこと
が出来ます。(プロセス作成後に親がグローバル変数 queue を差し替えても、子
の値は左右されませんし、逆もしかりです。)

Two other classes, *note Pool: 116d. and *note Manager: 250, provide
higher-level interfaces.  *note Pool: 116d. will create a fixed number
of worker processes, and requests can then be distributed to the workers
by calling *note apply(): 15ad. or *note apply_async(): 15ae. to add a
single request, and *note map(): 12fb. or *note map_async(): 12fc. to
add a number of requests.  The following code uses a *note Pool: 116d.
to spread requests across 5 worker processes and retrieve a list of
results:

     from multiprocessing import Pool

     def factorial(N, dictionary):
         "Compute a factorial."
         ...
     p = Pool(5)
     result = p.map(factorial, range(1, 1000, 10))
     for v in result:
         print v

これは以下のような出力をします:

     1
     39916800
     51090942171709440000
     8222838654177922817725562880000000
     33452526613163807108170062053440751665152000000000
     ...

The other high-level interface, the *note Manager: 250. class, creates a
separate server process that can hold master copies of Python data
structures.  Other processes can then access and modify these data
structures using proxy objects.  The following example creates a shared
dictionary by calling the *note dict(): 183. method; the worker
processes then insert values into the dictionary.  (Locking is not done
for you automatically, which doesn't matter in this example.  *note
Manager: 250.'s methods also include *note Lock(): 15af, *note RLock():
15b0, and *note Semaphore(): 15b1. to create shared locks.)

     import time
     from multiprocessing import Pool, Manager

     def factorial(N, dictionary):
         "Compute a factorial."
         # Calculate the result
         fact = 1L
         for i in range(1, N+1):
             fact = fact * i

         # Store result in dictionary
         dictionary[N] = fact

     if __name__ == '__main__':
         p = Pool(5)
         mgr = Manager()
         d = mgr.dict()         # Create shared dictionary

         # Run tasks using the pool
         for N in range(1, 1000, 10):
             p.apply_async(factorial, (N, d))

         # Mark pool as closed -- no more tasks can be added.
         p.close()

         # Wait for tasks to exit
         p.join()

         # Output results
         for k, v in sorted(d.items()):
             print k, v

これはこんな出力をするでしょう:

     1 1
     11 39916800
     21 51090942171709440000
     31 8222838654177922817725562880000000
     41 33452526613163807108170062053440751665152000000000
     51 15511187532873822802242430164693032110632597200169861120000...

参考
....

*note multiprocessing: 98. モジュールについてのドキュメント。

PEP 371(1) - multiprocessing パッケージの追加

     PEP 著 Jesse Noller と Richard Oudkerk; 実装 Richard Oudkerk と
     Jesse Noller.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0371/


File: python.info,  Node: PEP 3101 進化版文字列フォーマッティング,  Next: PEP 3105 print を関数にする,  Prev: PEP 371 multiprocessing パッケージ,  Up: What's New in Python 2 6

'PEP 3101': 進化版文字列フォーマッティング

In Python 3.0, the ‘%’ operator is supplemented by a more powerful
string formatting method, *note format(): 199.  Support for the *note
str.format(): 833. method has been backported to Python 2.6.

In 2.6, both 8-bit and Unicode strings have a ‘.format()’ method that
treats the string as a template and takes the arguments to be formatted.
The formatting template uses curly brackets (‘{’, ‘}’) as special
characters:

     >>> # Substitute positional argument 0 into the string.
     >>> "User ID: {0}".format("root")
     'User ID: root'
     >>> # Use the named keyword arguments
     >>> "User ID: {uid}   Last seen: {last_login}".format(
     ...    uid="root",
     ...    last_login = "5 Mar 2008 07:20")
     'User ID: root   Last seen: 5 Mar 2008 07:20'

波括弧自身は二重に書くことでエスケープ出来ます:

     >>> "Empty dict: {{}}".format()
     "Empty dict: {}"

フィールド名は、位置引数に対応する整数による ‘{0}’, ‘{1}’, …、またはキー
ワード引数に対応する名前です。属性を読み出したり辞書のキーにアクセスする
ような合成フィールド名(compound field names)も与えることが出来ます:

     >>> import sys
     >>> print 'Platform: {0.platform}\nPython version: {0.version}'.format(sys)
     Platform: darwin
     Python version: 2.6a1+ (trunk:61261M, Mar  5 2008, 20:29:41)
     [GCC 4.0.1 (Apple Computer, Inc. build 5367)]'

     >>> import mimetypes
     >>> 'Content-type: {0[.mp4]}'.format(mimetypes.types_map)
     'Content-type: video/mp4'

‘[.mp4]’ のように辞書スタイルの記法を使う際は文字列の周りを引用符で囲む
必要はありません; ‘.mp4’ をキーに値のルックアップされます。数値で始まる
文字列は整数に変換されます。フォーマット文字列内でこれ以上複雑な表現は書
けません。

ここまでは、結果文字列に置き換えられるフィールドを指定する方法について見
てきました。フォーマッティングではさらに、コロンに続けて書式指定子を追加
することでコントロール可能です。例えば:

     >>> # Field 0: left justify, pad to 15 characters
     >>> # Field 1: right justify, pad to 6 characters
     >>> fmt = '{0:15} ${1:>6}'
     >>> fmt.format('Registration', 35)
     'Registration    $    35'
     >>> fmt.format('Tutorial', 50)
     'Tutorial        $    50'
     >>> fmt.format('Banquet', 125)
     'Banquet         $   125'

書式指定子として、ネストによる他フィールド参照が使えます:

     >>> fmt = '{0:{1}}'
     >>> width = 15
     >>> fmt.format('Invoice #1234', width)
     'Invoice #1234  '
     >>> width = 35
     >>> fmt.format('Invoice #1234', width)
     'Invoice #1234                      '

望みの幅内でのフィールドの整列を指定可能です:

文字                 効果
                     
----------------------------------------------------------------------
                     
< (デフォルト)       左寄せ
                     
                     
>                    右寄せ
                     
                     
^                    中央寄せ
                     
                     
=                    (数値型についてのみ) 符号のあとにパディング
                     

書式指定子には体裁のタイプも含めることが出来ます。値をどのようにフォーマ
ットするかです。たとえば浮動小数点数は普通の数値に、あるいは指数形式でフ
ォーマット出来ます:

     >>> '{0:g}'.format(3.75)
     '3.75'
     >>> '{0:e}'.format(3.75)
     '3.750000e+00'

たくさんの体裁のタイプを利用出来ます。2.6 ドキュメントの *note complete
list: 15b3. を調べてみてください。以下はその一部です:

‘b’       2進数。出力される数値は2を基数とします。
          
          
‘c’       文字。数値を対応するユニコード文字に変換します。
          
          
‘d’       10進数。出力される数値は10を基数とします。
          
          
‘o’       8進数。出力される数値は8を基数とします。
          
          
‘x’       16進数。出力される数値は16を基数とします。 10進で9を超える数字には小文字が
          使われます。
          
          
‘e’       指数表現です。指数を示す 'e' を使った科学的記数法で表示します。
          
          
‘g’       汎用フォーマット。数値が大き過ぎない限りは固定小数点表現をしますが、大きい
          値では 'e' 指数表現に切り替えます。
          
          
‘n’       数値です。現在のロケールに合わせて、数値分割文字が挿入されることを除き、
          ‘'g'’ (浮動小数点数の場合) または 'd' (整数の場合) と同じです。
          
          
‘%’       パーセンテージです。数値は 100 倍され、固定小数点数フォーマット (‘'f'’) で
          パーセント記号付きで表示されます。
          

Classes and types can define a *note __format__(): 831. method to
control how they're formatted.  It receives a single argument, the
format specifier:

     def __format__(self, format_spec):
         if isinstance(format_spec, unicode):
             return unicode(str(self))
         else:
             return str(self)

There's also a *note format(): 199. builtin that will format a single
value.  It calls the type's *note __format__(): 831. method with the
provided specifier:

     >>> format(75.6564, '.2f')
     '75.66'

参考
....

*note 書式指定文字列の文法: 15b3.

     リファレンスドキュメント。

PEP 3101(1): 進化版文字列フォーマッティング

     PEP 著 Talin; 実装 Eric Smith。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3101/


File: python.info,  Node: PEP 3105 print を関数にする,  Next: PEP 3110 例外処理の変更,  Prev: PEP 3101 進化版文字列フォーマッティング,  Up: What's New in Python 2 6

1.17.8 PEP 3105: ‘print’ を関数にする
-------------------------------------

‘print’ 文は Python 3.0 では *note print(): 1177. 関数になります。 *note
print(): 1177. が関数になることで、 ‘def print(...)’ やなにかほかの場所
からの新しい関数をインポートするなどの方法で置き換え可能になります。

Python 2.6 では ‘__future__’ インポートで 言語構文としての ‘print’ を取
り除き、関数形式のものを代わりに使えるように出来ます。たとえば:

     >>> from __future__ import print_function
     >>> print('# of entries', len(dictionary), file=sys.stderr)

この新しい関数のシグネチャは以下の通りです:

     def print(*args, sep=' ', end='\n', file=None)

パラメータは以下のとおりです:

   * 'args': 出力される値を指定する位置引数リスト。

   * 'sep': 引数リスト 'args' を出力するのに使われる区切り文字。

   * 'end': 引数リスト 'args' を全て出力したあとに出力するテキスト。

   * 'file': 出力が送られるファイルオブジェクト。

参考
....

PEP 3105(1) - print を関数にする

     Georg Brandl 著の PEP。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3105/


File: python.info,  Node: PEP 3110 例外処理の変更,  Next: PEP 3112 バイトリテラル,  Prev: PEP 3105 print を関数にする,  Up: What's New in Python 2 6

1.17.9 PEP 3110: 例外処理の変更
-------------------------------

Python プログラマが時折やらかしてしまう誤りの一つにこんなのがあります:

     try:
         ...
     except TypeError, ValueError:  # Wrong!
         ...

このコードの作者はきっと *note TypeError: 198. 例外と *note ValueError:
2ec. 例外の両方とっつかまえてやろうと思ったのでしょうが、このコードは実
際にはちょっと違ったことをします: *note TypeError: 198. を捕捉したらこれ
を ‘"ValueError"’ というローカル名の例外オブジェクトに束縛します…。
*note ValueError: 2ec. 例外は決して捕捉されません。正しくは、例外のタプ
ルで指定します:

     try:
         ...
     except (TypeError, ValueError):
         ...

こんなことが起こってしまうのは、ここではカンマの使用が曖昧だからです: そ
れ、解析木内で 2 つのノードを示すのかな、タプルな単一ノードかしら?

Python 3.0 はカンマからワード "as" に置き換えてこの曖昧さをなくします。
例外を捕捉して例外オブジェクトを ‘exc’ に記憶するには、こう書かなければ
なりません:

     try:
         ...
     except TypeError as exc:
         ...

Python 3.0 は "as" の使用のみをサポートするようになるので、最初の例は 2
つの異なる例外を捕捉するものとして翻訳されます。Python 2.6 ではカンマも
"as" もサポートするので、既存のコードはそのまま動作します。新たに 2.6 で
実行される Python コードを書くならば、 "as" の使用を勧めます。

参考
....

PEP 3110(1) - Python 3000 での例外の捕捉

     PEP 著と実装 Collin Winter.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3110/


File: python.info,  Node: PEP 3112 バイトリテラル,  Next: PEP 3116 新しい I/O ライブラリ,  Prev: PEP 3110 例外処理の変更,  Up: What's New in Python 2 6

1.17.10 PEP 3112: バイトリテラル
--------------------------------

Python 3.0 は Unicode を言語の基本文字列型として採用し、8 ビットリテラル
は異なった記法で指示します。それには ‘b'string'’ とするか、 *note bytes:
192. のコンストラクタを用います。前方互換のために、Python 2.6 は *note
str: 169. 型に対する別名として *note bytes: 192. を追加のうえで、 ‘b''’
記法もサポートします。

2.6 の *note str: 169. 型は 3.0 の *note bytes: 192. 型とは色んな意味で
違います; 一番顕著なのは、コンストラクタがまったく異なることです。3.0 で
の ‘bytes([65, 66, 67])’ は 3 つのバイトで ‘ABC’ を構築しますが、2.6 で
の ‘bytes([65, 66, 67])’ は引数のリストを *note str(): 169. で文字列化し
た 12 バイト文字列を返します。

2.6 での *note bytes: 192. の主な使いみちはオブジェクトの型のテストに
‘isinstance(x, bytes)’ とすることでしょう。またこれは、 2.x コードが文字
列として ASCII 文字と 8 ビットバイトのどちらを意図しているのか知ることが
出来ない 2to3 コンバータの助けになります; あなたは今や *note bytes: 192.
と *note str: 169. の区別を、あなたの意図を正確に表現するのに使えます。
そして結果のコードは Python 3.0 で正しいものに修正されるでしょう。

全ての文字列リテラルを Unicode 文字列としてしまう ‘__future__’ インポー
トもあります。これは Unicode 文字を含むのに ‘\u’ エスケープシーケンスを
使えることを意味します。

     from __future__ import unicode_literals

     s = ('\u751f\u3080\u304e\u3000\u751f\u3054'
          '\u3081\u3000\u751f\u305f\u307e\u3054')

     print len(s)               # 12 Unicode characters

At the C level, Python 3.0 will rename the existing 8-bit string type,
called ‘PyStringObject’ in Python 2.x, to *note PyBytesObject: 995.
Python 2.6 uses ‘#define’ to support using the names *note
PyBytesObject(): 995, *note PyBytes_Check(): 15b7, *note
PyBytes_FromStringAndSize(): 15b8, and all the other functions and
macros used with strings.

*note bytes: 192. 型のインスタンスは単に文字列と同じで *note immutable:
15b9. です。 *note bytearray: 344. 型が、バイト列を *note mutable: 15ba.
シーケンスとして格納するものとして新しく追加されました:

     >>> bytearray([65, 66, 67])
     bytearray(b'ABC')
     >>> b = bytearray(u'\u21ef\u3244', 'utf-8')
     >>> b
     bytearray(b'\xe2\x87\xaf\xe3\x89\x84')
     >>> b[0] = '\xe3'
     >>> b
     bytearray(b'\xe3\x87\xaf\xe3\x89\x84')
     >>> unicode(str(b), 'utf-8')
     u'\u31ef \u3244'

Byte arrays support most of the methods of string types, such as *note
startswith(): 15bb./*note endswith(): 15bc, *note find(): 15bd./*note
rfind(): 15be, and some of the methods of lists, such as *note append():
15bf, *note pop(): 15c0, and *note reverse(): 15c1.

     >>> b = bytearray('ABC')
     >>> b.append('d')
     >>> b.append(ord('e'))
     >>> b
     bytearray(b'ABCde')

対応する C API もあります。 *note PyByteArray_FromObject(): 15c2, *note
PyByteArray_FromStringAndSize(): 15c3. や色々その他関数です。

参考
....

PEP 3112(1) - Python 3000 でのバイトリテラル

     PEP 著 Jason Orendorff; 2.6 へのバックポート Christian Heimes.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3112/


File: python.info,  Node: PEP 3116 新しい I/O ライブラリ,  Next: PEP 3118 改訂版バッファプロトコル,  Prev: PEP 3112 バイトリテラル,  Up: What's New in Python 2 6

1.17.11 PEP 3116: 新しい I/O ライブラリ
---------------------------------------

Python's built-in file objects support a number of methods, but
file-like objects don't necessarily support all of them.  Objects that
imitate files usually support ‘read()’ and ‘write()’, but they may not
support ‘readline()’, for example.  Python 3.0 introduces a layered I/O
library in the *note io: 83. module that separates buffering and
text-handling features from the fundamental read and write operations.

*note io: 83. モジュールによって提供される抽象基底クラスには 3 つのレベ
ルがあります:

   * *note RawIOBase: 12e7. defines raw I/O operations: *note read():
     101d, *note readinto(): 101e, *note write(): 15c5, *note seek():
     14a4, *note tell(): 15c6, *note truncate(): 1528, and *note
     close(): 506.  Most of the methods of this class will often map to
     a single system call.  There are also *note readable(): 15c7, *note
     writable(): 15c8, and *note seekable(): 15c9. methods for
     determining what operations a given object will allow.

     Python 3.0 はこのクラスのファイルとソケットに対する具象実装を持って
     いますが、Python 2.6 はファイル、ソケットオブジェクトのこの方法での
     再構築はしていません。

   * *note BufferedIOBase: 8a3. is an abstract base class that buffers
     data in memory to reduce the number of system calls used, making
     I/O processing more efficient.  It supports all of the methods of
     *note RawIOBase: 12e7, and adds a *note raw: 15ca. attribute
     holding the underlying raw object.

     There are five concrete classes implementing this ABC. *note
     BufferedWriter: 15cb. and *note BufferedReader: 1427. are for
     objects that support write-only or read-only usage that have a
     *note seek(): 14a4. method for random access.  *note
     BufferedRandom: 15cc. objects support read and write access upon
     the same underlying stream, and *note BufferedRWPair: 15cd. is for
     objects such as TTYs that have both read and write operations
     acting upon unconnected streams of data.  The *note BytesIO: 10a4.
     class supports reading, writing, and seeking over an in-memory
     buffer.

   * *note TextIOBase: 8a4.: Provides functions for reading and writing
     strings (remember, strings will be Unicode in Python 3.0), and
     supporting *note universal newlines: f35.  *note TextIOBase: 8a4.
     defines the *note readline(): bf. method and supports iteration
     upon objects.

     There are two concrete implementations.  *note TextIOWrapper: 9be.
     wraps a buffered I/O object, supporting all of the methods for text
     I/O and adding a *note buffer: 14bb. attribute for access to the
     underlying object.  *note StringIO: 112a. simply buffers everything
     in memory without ever writing anything to disk.

     (In Python 2.6, *note io.StringIO: 112a. is implemented in pure
     Python, so it's pretty slow.  You should therefore stick with the
     existing ‘StringIO’ module or ‘cStringIO’ for now.  At some point
     Python 3.0's *note io: 83. module will be rewritten into C for
     speed, and perhaps the C implementation will be backported to the
     2.x releases.)

Python 2.6 では根底にある実装が *note io: 83. モジュールのクラスの上に組
み立てられるようには再構築されていません (訳注: Python HowTo の移植ガイ
ドにも触れられている通り、2.7 も同じです)。このモジュールは 3.0 への前方
互換のコードを書くのを容易にするために、また、開発者たちがバッファリング
I/O とテキスト I/O を自身で書く労力を省くために提供されています。

参考
....

PEP 3116(1) - 新しい I/O

     PEP 著: Daniel Stutzbach, Mike Verdone, Guido van Rossum.  実装:
     Guido van Rossum, Georg Brandl, Walter Doerwald, Jeremy Hylton,
     Martin von Loewis, Tony Löwis, ほか.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3116/


File: python.info,  Node: PEP 3118 改訂版バッファプロトコル,  Next: PEP 3119 抽象基底クラス,  Prev: PEP 3116 新しい I/O ライブラリ,  Up: What's New in Python 2 6

1.17.12 PEP 3118: 改訂版バッファプロトコル
------------------------------------------

バッファプロトコルは Python 型にその内部表現へのポインタをやりとりさせる
、C レベル API です。例えば、メモリマップドファイルは文字のバッファとし
て見ることが出来ます。そしてこれは *note re: be. のようなほかのモジュー
ルが、それを文字列として扱って検索するようなことを許します。

バッファプロトコルの主なユーザは NumPy のような数値演算パッケージで、そ
れらは呼び出し元がより遅い API を経由することなく直接的に行列にデータを
書き込むことが出来るように、行列の内部表現を曝しています。この PEP は
NumPy 開発の経験を踏まえてバッファプロトコルを更新するもので、行列の形状
を表明したり、メモリ領域をロックしたりするような多数の新機能を追加します
。

最重要の新規 C API 関数は ‘PyObject_GetBuffer(PyObject *obj, Py_buffer
*view, int flags)’ で、これはオブジェクトを受け取って、フラグをセットし
、 ‘Py_buffer’ 構造体にオブジェクトのメモリ表現についての情報を埋めます
。オブジェクトはこの操作を、外部の呼び出し元がその内容を修正している間所
定のメモリをロックするのに使えます。ですので対応する操作
‘PyBuffer_Release(Py_buffer *view)’ があり、これで外部呼出し元が処理を終
えたことを表明します。

*note PyObject_GetBuffer(): 63a. への 'flags' 引数は返されるメモリについ
ての制約条件を指定します。いくつかの例として:

   * *note PyBUF_WRITABLE: 15cf. indicates that the memory must be
     writable.

   * ‘PyBUF_LOCK’ requests a read-only or exclusive lock on the memory.

   * *note PyBUF_C_CONTIGUOUS: 15d0. and *note PyBUF_F_CONTIGUOUS: 15d1.
     requests a C-contiguous (last dimension varies the fastest) or
     Fortran-contiguous (first dimension varies the fastest) array
     layout.

*note PyArg_ParseTuple(): 3c1. のための 2 つの新しい書式化コード ‘s*’ と
‘z*’ は、パラメータとしてロックされたバッファオブジェクトを返します。

参考
....

PEP 3118(1) - 改訂版バッファプロトコル

     PEP 著: Travis Oliphant, Carl Banks; 実装: Travis Oliphant.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3118/


File: python.info,  Node: PEP 3119 抽象基底クラス,  Next: PEP 3127 整数リテラルのサポートと文法,  Prev: PEP 3118 改訂版バッファプロトコル,  Up: What's New in Python 2 6

1.17.13 PEP 3119: 抽象基底クラス
--------------------------------

Some object-oriented languages such as Java support interfaces,
declaring that a class has a given set of methods or supports a given
access protocol.  Abstract Base Classes (or ABCs) are an equivalent
feature for Python.  The ABC support consists of an *note abc: 4. module
containing a metaclass called *note ABCMeta: 111c, special handling of
this metaclass by the *note isinstance(): 2ad. and *note issubclass():
9c4. builtins, and a collection of basic ABCs that the Python developers
think will be widely useful.  Future versions of Python will probably
add more ABCs.

Let's say you have a particular class and wish to know whether it
supports dictionary-style access.  The phrase "dictionary-style" is
vague, however.  It probably means that accessing items with ‘obj[1]’
works.  Does it imply that setting items with ‘obj[2] = value’ works?
Or that the object will have ‘keys()’, ‘values()’, and ‘items()’
methods?  What about the iterative variants such as ‘iterkeys()’?
‘copy`and :meth:()’!update'?  Iterating over the object with ‘iter()’?

The Python 2.6 *note collections: 1e. module includes a number of
different ABCs that represent these distinctions.  ‘Iterable’ indicates
that a class defines *note __iter__(): e69, and ‘Container’ means the
class defines a *note __contains__(): 15d3. method and therefore
supports ‘x in y’ expressions.  The basic dictionary interface of
getting items, setting items, and ‘keys()’, ‘values()’, and ‘items()’,
is defined by the ‘MutableMapping’ ABC.

あなた自身のクラスを特定の ABC から派生して、ABC のインターフェイスをサ
ポートすることを示せます:

     import collections

     class Storage(collections.MutableMapping):
         ...

Alternatively, you could write the class without deriving from the
desired ABC and instead register the class by calling the ABC's *note
register(): 129a. method:

     import collections

     class Storage:
         ...

     collections.MutableMapping.register(Storage)

For classes that you write, deriving from the ABC is probably clearer.
The *note register(): 129a. method is useful when you've written a new
ABC that can describe an existing type or class, or if you want to
declare that some third-party class implements an ABC. For example, if
you defined a ‘PrintableType’ ABC, it's legal to do:

     # Register Python's types
     PrintableType.register(int)
     PrintableType.register(float)
     PrintableType.register(str)

クラスは ABC が規定するセマンティクスに従うべきですが、Python はそれをチ
ェックは出来ません；その ABC の要求を理解してコードを適切に実装するのは
クラスの作者任せです。

オブジェクトが特定のインターフェイスをサポートするかどうかをチェックする
のには、今やこう書けます:

     def func(d):
         if not isinstance(d, collections.MutableMapping):
             raise ValueError("Mapping object expected, not %r" % d)

これからはたくさんのこのようなチェックをしなければならないのだ、この例の
ように、などとは思わないように。Python は至極ダックタイピングな流儀なの
であって明示的な型チェックは決してされませんし、コードは単純にオブジェク
トのメソッドを、それらメソッドがそこにあるはずで、なければ例外になるのを
信じて呼ぶだけです。ABC についてのチェックには分別を持ち、それが絶対的に
必要な場合にだけそうするようにしましょう。

あなた自身の ABCs を書くには、クラス定義内のメタクラスとして
‘abc.ABCMeta’ を使います:

     from abc import ABCMeta, abstractmethod

     class Drawable():
         __metaclass__ = ABCMeta

         @abstractmethod
         def draw(self, x, y, scale=1.0):
             pass

         def draw_doubled(self, x, y):
             self.draw(x, y, scale=2.0)


     class Square(Drawable):
         def draw(self, x, y, scale):
             ...

In the ‘Drawable’ ABC above, the ‘draw_doubled()’ method renders the
object at twice its size and can be implemented in terms of other
methods described in ‘Drawable’.  Classes implementing this ABC
therefore don't need to provide their own implementation of
‘draw_doubled()’, though they can do so.  An implementation of ‘draw()’
is necessary, though; the ABC can't provide a useful generic
implementation.

You can apply the *note @~abc.abstractmethod: 1297. decorator to methods
such as ‘draw()’ that must be implemented; Python will then raise an
exception for classes that don't define the method.  Note that the
exception is only raised when you actually try to create an instance of
a subclass lacking the method:

     >>> class Circle(Drawable):
     ...     pass
     ...
     >>> c = Circle()
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: Can't instantiate abstract class Circle with abstract methods draw
     >>>

抽象データ属性を ‘@abstractproperty’ を使って宣言出来ます:

     from abc import abstractproperty
     ...

     @abstractproperty
     def readonly(self):
        return self._x

Subclasses must then define a ‘readonly’ property.

参考
....

PEP 3119(1) - 抽象基底クラスの導入

     PEP は Guido van Rossum と Talin によって著され、Guido van Rossum に
     より実装されています。Python 2.6 へのバックポートは Benjamin
     Aranguren と Alex Martelli により行われました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3119/


File: python.info,  Node: PEP 3127 整数リテラルのサポートと文法,  Next: PEP 3129 クラスデコレータ,  Prev: PEP 3119 抽象基底クラス,  Up: What's New in Python 2 6

1.17.14 PEP 3127: 整数リテラルのサポートと文法
----------------------------------------------

Python 3.0 は octal (基数 8: 8 進数) 整数リテラルの構文を変更し、先行す
るゼロの代わりに "0o" または "0O" (「ゼロオー」)としています。また、
binary (基数 2: 2 進数) 整数リテラルのサポートを追加し、これは "0b" また
は "0B" で指示します。

Python 2.6 は先行するゼロの形式での 8 進数サポートをやめませんが、 "0o"
と "0b" は追加サポートします:

     >>> 0o21, 2*8 + 1
     (17, 17)
     >>> 0b101111
     47

ビルトイン関数 *note oct(): 14e6. はまだ先行ゼロ形式での表現を返します。
新しいビルトイン関数 *note bin(): 14c0. は数値の 2 進数表現を返します:

     >>> oct(42)
     '052'
     >>> future_builtins.oct(42)
     '0o52'
     >>> bin(173)
     '0b10101101'

ビルトイン *note int(): 19b, ‘long()’ が、基数 8 か 0 を要求された場合の
"0o" プレフィクス、基数 2 か 0 を要求された場合の "0b" プレフィクスをそ
れぞれ許容するようになりました(基数 'base' = 0 は文字列から基数を決める
べきであることを指示します):

     >>> int ('0o52', 0)
     42
     >>> int('1101', 2)
     13
     >>> int('0b1101', 2)
     13
     >>> int('0b1101', 0)
     13

参考
....

PEP 3127(1) - 整数リテラルのサポートと文法

     PEP 著 Patrick Maupin、2.6 へのバックポートは Eric Smith による。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3127/


File: python.info,  Node: PEP 3129 クラスデコレータ,  Next: PEP 3141 数値の型階層,  Prev: PEP 3127 整数リテラルのサポートと文法,  Up: What's New in Python 2 6

1.17.15 PEP 3129: クラスデコレータ
----------------------------------

デコレータが拡張されて関数だけでなクラスにも使えるようになりました。今や
このように書くのは合法です:

     @foo
     @bar
     class A:
       pass

これは次と等価です:

     class A:
       pass

     A = foo(bar(A))

参考
....

PEP 3129(1) - クラスデコレータ

     PEP 著 Collin Winter.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3129/


File: python.info,  Node: PEP 3141 数値の型階層,  Next: その他の言語変更<15>,  Prev: PEP 3129 クラスデコレータ,  Up: What's New in Python 2 6

1.17.16 PEP 3141: 数値の型階層
------------------------------

Python 3.0 では Scheme の numeric tower に触発された、いくつかの数値型の
ための抽象基底クラスを追加しています。これらのクラスは *note numbers:
a2. モジュール として 2.6 にバックポートされています。

一番てっぺんの汎用 ABC が ‘Number’ です。これには何の演算も含まれず、オ
ブジェクトがなんらか数値であることをチェックするためだけにあります。
‘isinstance(obj, Number)’ として使えます。

‘Complex’ は ‘Number’ のサブクラスです。複素数は基礎的な追加の演算の加算
、減算、積算、除算、累乗に耐えるとともに、実数部と虚数部の抽出と共役数の
取得が出来ます。Python のビルトインの complex 型は ‘Complex’ を実装して
います。

‘Real’ は ‘Complex’ から更に派生し、実数のみで動作する演算を追加していま
す: ‘floor()’, ‘trunc()’, 丸め, divmod, floor division, 比較、です。

‘Rational’ 数は ‘Real’ からの派生で、プロパティ ‘numerator’,
‘denominator’ を持ち、浮動小数点数への変換が出来ます。Python 2.6 は単純
な有理数クラス ‘Fraction’ を *note fractions: 61. モジュールに追加してい
ます。(‘Rational’ ではなく ‘Fraction’ なのは、 *note numbers.Rational:
14d6. と名前が衝突するのを避けるためです。)

‘Integral’ 数は ‘Rational’ からの派生で、シフト演算 ‘<<’, ‘>>’ が出来て
、 ‘&’ や ‘|’ のようなビット演算で混ぜ合わせることができて、また、配列の
インデクスとスライスの境界として使えます。

Python 3.0 では、その PEP は少し既存のビルトイン *note round(): 14f2,
*note math.floor(): 15d7, *note math.ceil(): 15d8. を再定義していて、ま
た、Python 2.6 にバックポートされている新しい *note math.trunc(): 15d9.
を追加しています。 *note math.trunc(): 15d9. はゼロに向かう方向の丸めで
、引数とゼロの間で一番近い ‘Integral’ を返します。

参考
....

PEP 3141(1) - 数値の型階層

     PEP 著: Jeffrey Yasskin.

Guile マニュアルの Scheme's numerical tower(2) 。

Scheme's number datatypes(3) from the R5RS Scheme specification.

* Menu:

* fractions モジュール::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3141/

   (2) 
https://www.gnu.org/software/guile/manual/html_node/Numerical-Tower.html#Numerical-Tower

   (3) 
https://conservatory.scheme.org/schemers/Documents/Standards/R5RS/HTML/r5rs-Z-H-9.html#%_sec_6.2


File: python.info,  Node: fractions モジュール,  Up: PEP 3141 数値の型階層

1.17.16.1 ‘fractions’ モジュール
................................

数値型階層を埋めるべく、 *note fractions: 61. モジュールが有理数クラスを
提供しています。有理数は分子(numerator)と分母(denominator)で構成される分
数としてその値を格納し、浮動小数点数では近似しか出来ない ‘2/3’ のような
数を正確に表現出来ます。

‘Fraction’ のコンストラクタは 2 つの ‘Integral’ 値を取り、それらはそれぞ
れ結果の分数の分子と分母になります。:

     >>> from fractions import Fraction
     >>> a = Fraction(2, 3)
     >>> b = Fraction(2, 5)
     >>> float(a), float(b)
     (0.66666666666666663, 0.40000000000000002)
     >>> a+b
     Fraction(16, 15)
     >>> a/b
     Fraction(5, 3)

For converting floating-point numbers to rationals, the float type now
has an ‘as_integer_ratio()’ method that returns the numerator and
denominator for a fraction that evaluates to the same floating-point
value:

     >>> (2.5) .as_integer_ratio()
     (5, 2)
     >>> (3.1415) .as_integer_ratio()
     (7074029114692207L, 2251799813685248L)
     >>> (1./3) .as_integer_ratio()
     (6004799503160661L, 18014398509481984L)

1./3 のような浮動小数点数で近似にしかならない値は、近似して単純化された
りはしないことに注意してください; その分数は浮動小数点数に '正確に' 合う
ように試みられます。

*note fractions: 61. モジュールは、ずっと長い間 Python の
‘Demo/classes/’ ディレクトリにいた Sjoerd Mullender による実装に基いてい
ます。この実装が Jeffrey Yasskin によって大幅に更新されました。


File: python.info,  Node: その他の言語変更<15>,  Next: 新しいモジュールと改良されたモジュール<2>,  Prev: PEP 3141 数値の型階層,  Up: What's New in Python 2 6

1.17.17 その他の言語変更
------------------------

Python 言語コアに小さな変更がいくつか行われました:

   * ‘__main__.py’ を含んだディレクトリ名と zip アーカイブ名をインタプリ
     タに渡して直接実行出来るようになりました。そのディレクトリと zip ア
     ーカイブは自動的に sys.path エントリの先頭に追加されます。
     (Suggestion and initial patch by Andy Chu, subsequently revised by
     Phillip J. Eby and Nick Coghlan; bpo-1739468(1).)

   * *note hasattr(): 6f9. 関数は ‘__getattr__()’ メソッドが例外を起こす
     と何か失敗したのだと仮定して、全て捕捉して無視して ‘False’ を返して
     いました。ですがそのロジックは *note KeyboardInterrupt: bc5. と
     *note SystemExit: f3c. まで捕まえるべきではなかったのです。Python
     2.6 では *note hasattr(): 6f9. はもはやそれら例外に出会ってもそれを
     捨てません。 (Fixed by Benjamin Peterson; bpo-2196(2).)

   * ‘**’ 構文を使ってキーワード引数を許容する関数を呼び出すのに、もう
     Python 辞書を使う必要はありません; 任意のマッピングプロトコルをサポ
     ートするオブジェクトで今では動作します:

          >>> def f(**kw):
          ...    print sorted(kw)
          ...
          >>> ud=UserDict.UserDict()
          >>> ud['a'] = 1
          >>> ud['b'] = 'string'
          >>> f(**ud)
          ['a', 'b']

     (Contributed by Alexander Belopolsky; bpo-1686487(3).)

     同時に、 ‘*args’ 引数のあとでキーワード引数を与える関数呼び出しも今
     では合法です。:

          >>> def f(*args, **kw):
          ...     print args, kw
          ...
          >>> f(1,2,3, *(4,5,6), keyword=13)
          (1, 2, 3, 4, 5, 6) {'keyword': 13}

     以前はこれは構文エラーになっていました。 (Contributed by Amaury
     Forgeot d'Arc; bpo-3473(4).)

   * 新しいビルトイン ‘next(iterator, [default])’ は指定したイテレータよ
     り次のアイテムを返します。 'iterator' が使い果たされている場合、
     'default' 引数が与えられていれがこれを、そうでなければ *note
     StopIteration: df5. 例外を起こします。 (Backported in bpo-2719(5).)

   * Tuples now have *note index(): 15dc. and *note count(): 15dd.
     methods matching the list type's *note index(): 15de. and *note
     count(): 15df. methods:

          >>> t = (0,1,2,3,4,0,1,2)
          >>> t.index(3)
          3
          >>> t.count(0)
          2

     (Contributed by Raymond Hettinger)

   * ビルトイン型が拡張スライス構文をサポートするために改善されています
     。色々な ‘(start, stop, step)’ 組み合わせを受け付けます。以前はこれ
     のサポートは限定的で、ものによっては動作しませんでした。
     (Implemented by Thomas Wouters.)

   * property に ‘getter’, ‘setter’, ‘deleter’ が追加されています。取得
     関数(getter)、設定関数(setter)、削除関数(deleter)を既存のプロパティ
     に追加するための便利なショートカットとして使えるデコレータです。こ
     れらはこのように使えます:

          class C(object):
              @property
              def x(self):
                  return self._x

              @x.setter
              def x(self, value):
                  self._x = value

              @x.deleter
              def x(self):
                  del self._x

          class D(C):
              @C.x.getter
              def x(self):
                  return self._x * 2

              @x.setter
              def x(self, value):
                  self._x = value / 2

   * ビルトインの set 型のいくつかのメソッドが複数イテラブルを受け付ける
     ようになっています: ‘intersection()’, ‘intersection_update()’,
     ‘union()’, ‘update()’, ‘difference()’, ‘difference_update()’ です。

          >>> s=set('1234567890')
          >>> s.intersection('abc123', 'cdf246')  # Intersection between all inputs
          set(['2'])
          >>> s.difference('246', '789')
          set(['1', '0', '3', '5'])

     (Contributed by Raymond Hettinger.)

   * たくさんの浮動小数点数機能が追加されました。 *note float(): 196. 関
     数は文字列 ‘nan’ を IEEE 754 非数 (Not A Number) 値に変換し、
     ‘+inf’ と ‘-inf’ は正あるいは負の無限大に変換します。これは IEEE
     754 セマンティクスのあらゆるプラットフォームで動作します。
     (Contributed by Christian Heimes; bpo-1635(6).)

     ほか *note math: 92. モジュールに ‘isinf()’ と ‘isnan()’ が追加され
     ています; 浮動小数点数が、前者は無限大ならば、後者は非数ならばそれ
     ぞれ真を返します。 (bpo-1640(7))

     浮動小数点数を 16 進表記文字列に変換する変換関数が追加されています
     (bpo-3008(8))。これら関数は 10 進と 2 進との間の変換で起こる丸め誤
     差を持ち込まずに浮動小数点数と文字列表現の相互変換をします。浮動小
     数点数は文字列表現を返す *note hex(): 14e7. メソッドを持ち、また、
     ‘float.fromhex()’ メソッドが文字列から浮動小数点数に戻します:

          >>> a = 3.75
          >>> a.hex()
          '0x1.e000000000000p+1'
          >>> float.fromhex('0x1.e000000000000p+1')
          3.75
          >>> b=1./3
          >>> b.hex()
          '0x1.5555555555555p-2'

   * 数に関する繊細さ: 符号付ゼロ (-0 と +0) をサポートするシステムで 2
     つの浮動小数点数から複素数を作る際に、 *note complex(): 197. コンス
     トラクタがゼロの符号を維持するようになりました。 (Fixed by Mark T.
     Dickinson; bpo-1507(9).)

   * ‘__hash__()’ メソッドを親クラスから継承するクラスは、ハッシュ出来な
     いことを示すのに ‘__hash__ = None’ をセット出来ます。これにより
     ‘hash(obj)’ は *note TypeError: 198. を起こし、そのクラスは
     ‘Hashable’ ABC を実装していないことを示します。

     ‘__cmp__()’ か ‘__eq__()’ を定義するのにその比較にオブジェクトの身
     元ではなくその値を使ったならば、あなたはこれをすべきです。全てのオ
     ブジェクトはその値として ‘id(obj)’ を使うデフォルトのハッシュ化メソ
     ッドを持っています。親クラスから継承した ‘__hash__()’ を削除する整
     理された方法はありません。ですのでオーバライドとしての ‘None’ の代
     入が実装されました。 C API のレベルでは、拡張は ‘tp_hash’ に *note
     PyObject_HashNotImplemented(): 15e0. をセット出来ます。 (Fixed by
     Nick Coghlan and Amaury Forgeot d'Arc; bpo-2235(10).)

   * *note GeneratorExit: 15e1. 例外が *note Exception: bcd. ではなく
     *note BaseException: 7d6. のサブクラスになっています。 ‘except
     Exception:’ をする例外ハンドラが意図せず *note GeneratorExit: 15e1.
     捕捉してしまうことがなくなります。 (Contributed by Chad Austin;
     bpo-1537(11).)

   * ジェネレータオブジェクトが、そのジェネレータを返すオリジナルのコー
     ドオブジェクトを参照する ‘gi_code’ 属性を持つようになりました。
     (Contributed by Collin Winter; bpo-1473257(12).)

   * ビルトイン関数 *note compile(): 4b1. が位置引数だけでなくキーワード
     引数も受け付けるようになりました。 (Contributed by Thomas Wouters;
     bpo-1444529(13).)

   * *note complex(): 197. コンストラクタが括弧で囲まれた複素数表現文字
     列を受け付けるようになっています。 ‘complex(repr(cplx))’ で元に戻せ
     るということです。例えば ‘complex('(3+4j)')’ は今では値 ‘(3+4j)’ を
     返します。 (bpo-1491866(14))

   * 文字列の ‘translate()’ メソッドが変形テーブルパラメータとして
     ‘None’ を受け付けるようになりました。そのまま同じものを返す変形とし
     て扱われます。これにより文字を削除する操作を実行するのが簡単になり
     ます。 (Contributed by Bengt Richter and implemented by Raymond
     Hettinger; bpo-1193128(15).)

   * ビルトインの *note dir(): 844. 関数が、受け取ったオブジェクトの
     ‘__dir__()’ メソッドをチェックするようになりました。このメソッドは
     そのオブジェクトで妥当な属性名を含む文字列のリストを返さなければな
     りません。これにより *note dir(): 844. が生成する値を制御出来ます。
     ‘__getattr__()’ や ‘__getattribute__()’ メソッドを使うオブジェクト
     はこれを使うことで、約束するつもりの擬似属性を公表出来ます。
     (bpo-1591665(16))

   * Instance method objects have new attributes for the object and
     function comprising the method; the new synonym for ‘im_self’ is
     *note __self__: 15e2, and ‘im_func’ is also available as *note
     __func__: 1514.  The old names are still supported in Python 2.6,
     but are gone in 3.0.

   * 目立たない変更: *note locals(): 46f. 関数を *note class: 14ef. ステ
     ートメント内で使う際、結果の辞書はもはや自由変数を返しません。(この
     場合、自由変数は ‘class’ ステートメント内で参照される変数で、クラス
     の属性ではありません。)

* Menu:

* 最適化: 最適化<15>.
* インタプリタの変更: インタプリタの変更<2>.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1739468

   (2) https://bugs.python.org/issue?@action=redirect&bpo=2196

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1686487

   (4) https://bugs.python.org/issue?@action=redirect&bpo=3473

   (5) https://bugs.python.org/issue?@action=redirect&bpo=2719

   (6) https://bugs.python.org/issue?@action=redirect&bpo=1635

   (7) https://bugs.python.org/issue?@action=redirect&bpo=1640

   (8) https://bugs.python.org/issue?@action=redirect&bpo=3008

   (9) https://bugs.python.org/issue?@action=redirect&bpo=1507

   (10) https://bugs.python.org/issue?@action=redirect&bpo=2235

   (11) https://bugs.python.org/issue?@action=redirect&bpo=1537

   (12) https://bugs.python.org/issue?@action=redirect&bpo=1473257

   (13) https://bugs.python.org/issue?@action=redirect&bpo=1444529

   (14) https://bugs.python.org/issue?@action=redirect&bpo=1491866

   (15) https://bugs.python.org/issue?@action=redirect&bpo=1193128

   (16) https://bugs.python.org/issue?@action=redirect&bpo=1591665


File: python.info,  Node: 最適化<15>,  Next: インタプリタの変更<2>,  Up: その他の言語変更<15>

1.17.17.1 最適化
................

   * *note warnings: 118. モジュールが C で書き直されました。これにより
     警告をパーサから発行出来、また、インタプリタの起動が高速化していま
     す。 (Contributed by Neal Norwitz and Brett Cannon;
     bpo-1631171(1).)

   * 型オブジェクトがメソッドのキャッシュを持つようになっています。これ
     は個別のクラスについての正しいメソッド実装を見つけるのに必要な仕事
     を減らします。いったんキャッシュされれば、インタプリタは呼び出さな
     ければならない正しいメソッドを知るために基底クラス群を横断しなくて
     もよくなります。基底クラスやクラス自身が修正されれば、Python の動的
     な振る舞いの面においても正しくあり続けなければならないので、キャッ
     シュはクリアされます。 (Original optimization implemented by Armin
     Rigo, updated for Python 2.6 by Kevin Jacobs; bpo-1700288(2).)

     デフォルトではこの変更は、Python コアに含まれる型のみに適用されます
     。拡張モジュールは必ずしもこのキャッシュに互換ではなく、拡張モジュ
     ールはメソッドキャッシュを有効にするために、モジュールの ‘tp_flags’
     フィールドに明示的に ‘Py_TPFLAGS_HAVE_VERSION_TAG’ を追加しなければ
     なりません。(このメソッドキャッシュに対して互換であるためには、拡張
     モジュールのコードは、それが実装するどんな型についても ‘tp_dict’ メ
     ンバに直接アクセスしたり修正したりしてはなりません。ほとんどのモジ
     ュールはこれをしていませんが、Python インタプリタがそれを検知するこ
     とは出来ません。 bpo-1878(3) にいくらかの議論がありますので参照して
     ください。)

   * キーワード引数を使う関数呼び出しが、素早くポインタで比較することで
     顕著に高速化しています。これは常に文字列丸ごとを比較する時間を省き
     ます。 (Contributed by Raymond Hettinger, after an initial
     implementation by Antoine Pitrou; bpo-1819(4).)

   * *note struct: db. モジュールの全ての関数が C で書き換えられました。
     「Need For Speed スプリント」での作業の成果です。 (Contributed by
     Raymond Hettinger.)

   * いくつかの標準ビルトイン型が、その型オブジェクトにビットをセットす
     るようになりました。これは、オブジェクトがそれら型のサブクラスの一
     つであるかどうかのチェックするのを高速化します。 (Contributed by
     Neal Norwitz.)

   * Unicode 文字列が、空白文字と改行を検出するためのコードにより高速な
     実装を使うようになりました; ‘split()’ メソッドでおよそ 25% の速度向
     上、 ‘splitlines()’ メソッドでは 35% です。(Contributed by Antoine
     Pitrou.)  Unicode 文字列データのために pymalloc を使うことでメモリ
     使用が減りました。

   * The ‘with’ statement now stores the *note __exit__(): 1518. method
     on the stack, producing a small speedup.  (Implemented by Jeffrey
     Yasskin.)

   * メモリ使用を減らすために、一番作られたオブジェクトをガーベージコレ
     クトする際に、ガーベージコレクタが内部のフリーリストをクリアするよ
     うになりました。これはオペレーティングシステムにすぐに返されます。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1631171

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1700288

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1878

   (4) https://bugs.python.org/issue?@action=redirect&bpo=1819


File: python.info,  Node: インタプリタの変更<2>,  Prev: 最適化<15>,  Up: その他の言語変更<15>

1.17.17.2 インタプリタの変更
............................

Two command-line options have been reserved for use by other Python
implementations.  The ‘-J’ switch has been reserved for use by Jython
for Jython-specific options, such as switches that are passed to the
underlying JVM. *note -X: 16f. has been reserved for options specific to
a particular implementation of Python such as CPython, Jython, or
IronPython.  If either option is used with Python 2.6, the interpreter
will report that the option isn't currently used.

Python インタプリタに *note -B: 15e6. スイッチを渡すか、インタプリタ実行
前に環境変数 *note PYTHONDONTWRITEBYTECODE: 15e7. をセットするかのどちら
かで、 ‘.pyc’ や ‘.pyo’ が作られないようにすることが出来るようになりまし
た。この設定は Python プログラムから ‘sys.dont_write_bytecode’ 変数とし
て利用可能で、Python コードはこの変数を変更してインタプリタの振る舞いを
変えることが出来ます。 (Contributed by Neal Norwitz and Georg Brandl.)

標準入力、標準出力、標準エラー出力に使うエンコーディングを、インタプリタ
起動前に環境変数 *note PYTHONIOENCODING: 120c. を設定することで指定出来
るようになりました。値は ‘<encoding>’ または ‘<encoding>:<errorhandler>’
形式の文字列でなければなりません。 'encoding' 部分はエンコーディングの名
前で、例えば ‘utf-8’ や ‘latin-1’ です; 省略可能な 'errorhandler' 部分は
エンコーディングによって処理出来ない文字に対して何をするのかを指定するも
ので、 "error", "ignore", "replace" のどれかです。 (Contributed by
Martin von Löwis.)


File: python.info,  Node: 新しいモジュールと改良されたモジュール<2>,  Next: 非推奨と削除,  Prev: その他の言語変更<15>,  Up: What's New in Python 2 6

1.17.18 新しいモジュールと改良されたモジュール
----------------------------------------------

全てのリリースに置いて、 Python の標準ライブラリはたくさんの改良とバグ修
正がされてきました。ここでは一部の注目に値する変更を、モジュール名で辞書
順ソートしてリストアップしています。もっと完全な変更リストが見たければ、
ソースツリー内の ‘Misc/NEWS’ ファイルか、全ての完全な詳細が入っている
Subversion のログを参照してください。

   * The ‘asyncore’ and ‘asynchat’ modules are being actively maintained
     again, and a number of patches and bugfixes were applied.
     (Maintained by Josiah Carlson; see bpo-1736190(1) for one patch.)

   * ‘bsddb’ モジュールは新しいメンテナ Jesús Cea Avión を得て、パッケー
     ジは今ではスタンドアロンのパッケージとして入手可能です。パッケージ
     のウェブページは www.jcea.es/programacion/pybsddb.htm(2) です。この
     モジュールは Python 3.0 では標準ライブラリからは削除される予定です
     。というのも、これの更新ペースは Python のそれよりも遥かに頻繁だか
     らです。

     ‘bsddb.dbshelve’ モジュールは pickle 化で、プロトコル 1 に制限する
     のではなく利用出来る一番高いプロトコルバージョンを使うようになりま
     した。(Contributed by W. Barnes.)

   * The ‘cgi’ module will now read variables from the query string of
     an HTTP POST request.  This makes it possible to use form actions
     with URLs that include query strings such as
     "/cgi-bin/add.py?category=1".  (Contributed by Alexandre Fiori and
     Nubis; bpo-1817(3).)

     The ‘parse_qs()’ and ‘parse_qsl()’ functions have been relocated
     from the ‘cgi’ module to the *note urlparse: 110. module.  The
     versions still available in the ‘cgi’ module will trigger *note
     PendingDeprecationWarning: ac5. messages in 2.6 (bpo-600362(4)).

   * *note cmath: 19. モジュールに大掛かりな改訂が行われました。Mark
     Dickinson と Christian Heimes による貢献です。5 つの新しい関数が追
     加されました:

        * ‘polar()’ は複素数を極形式 (polar form) に変換し、複素数の絶対
          値 (modulus) と偏角 (argument) を返します。

        * ‘rect()’ はその逆で、絶対値と偏角から対応する複素数に戻します
          。

        * ‘phase()’ は複素数の偏角 (angle とも呼ばれています) を返します
          。

        * ‘isnan()’ はその引数の実数部か虚数部のどちらかが NaN であれば
          真を返します。

        * ‘isinf()’ はその引数の実数部か虚数部のどちらかが無限大であれば
          真を返します。

     その改訂では、 *note cmath: 19. モジュールの数値的安定性も改善され
     ました。全ての関数で、結果の実数部、虚数部は最小精度単位で少しの範
     囲内で、可能な限り正確です。詳細は bpo-1381(5) を見てください。
     ‘asinh()’, ‘atanh()’:, ‘atan()’ に対する分岐截線 (branch cut) も修
     正されています。(-- 訳注: units of least precision に対する枯れた訳
     語はないようなので最小精度単位としていますが仮数部の最下位ビットの
     ことです。ので、within a few ulps は下位数ビットという意味。分岐截
     線 (branch cut) は一般的な訳語かどうかはわかりませんが、wikipedia か
     ら採りました。--)

     そのモジュールのテストは大変拡大しました; およそ 2000 の新たなテス
     トケースが数学関数群を鍛え上げます。

     IEEE 754 プラットフォームでは *note cmath: 19. モジュールは、IEEE
     754 の特殊値と浮動小数点例外を、C99 標準の付録 'G' での一貫性のある
     方法で処理するようになりました。

   * A new data type in the *note collections: 1e. module:
     ‘namedtuple(typename, fieldnames)’ is a factory function that
     creates subclasses of the standard tuple whose fields are
     accessible by name as well as index.  For example:

          >>> var_type = collections.namedtuple('variable',
          ...             'id name type size')
          >>> # Names are separated by spaces or commas.
          >>> # 'id, name, type, size' would also work.
          >>> var_type._fields
          ('id', 'name', 'type', 'size')

          >>> var = var_type(1, 'frequency', 'int', 4)
          >>> print var[0], var.id    # Equivalent
          1 1
          >>> print var[2], var.type  # Equivalent
          int int
          >>> var._asdict()
          {'size': 4, 'type': 'int', 'id': 1, 'name': 'frequency'}
          >>> v2 = var._replace(name='amplitude')
          >>> v2
          variable(id=1, name='amplitude', type='int', size=4)

     Several places in the standard library that returned tuples have
     been modified to return ‘namedtuple()’ instances.  For example, the
     ‘Decimal.as_tuple()’ method now returns a named tuple with ‘sign’,
     ‘digits’, and ‘exponent’ fields.

     (Contributed by Raymond Hettinger.)

   * *note collections: 1e. モジュールのもう一つの変更は、 ‘deque’ 型が
     省略可能な 'maxlen' パラメータをサポートするようになったことです; 与
     えられると、 deque のサイズが要素数 'maxlen' を超えないように制限さ
     れます。お腹いっぱいの deque にさらに要素を追加すると、古いものから
     捨てられます。

          >>> from collections import deque
          >>> dq=deque(maxlen=3)
          >>> dq
          deque([], maxlen=3)
          >>> dq.append(1); dq.append(2); dq.append(3)
          >>> dq
          deque([1, 2, 3], maxlen=3)
          >>> dq.append(4)
          >>> dq
          deque([2, 3, 4], maxlen=3)

     (Contributed by Raymond Hettinger.)

   * The *note Cookie: 75. module's *note Morsel: dfe. objects now
     support an *note httponly: 15e9. attribute.  In some browsers.
     cookies with this attribute set cannot be accessed or manipulated
     by JavaScript code.  (Contributed by Arvin Schnell;
     bpo-1638033(6).)

   * *note curses: 2f. モジュールの新しい window メソッド ‘chgat()’ は、
     一行での指定数ぶん文字の表示属性を変更します。 (Contributed by
     Fabian Kreutz.)

          # Boldface text starting at y=0,x=21
          # and affecting the rest of the line.
          stdscr.chgat(0, 21, curses.A_BOLD)

     *note curses.textpad: 32. モジュールの ‘Textbox’ クラスが上書きモー
     ドのほかに挿入モード編集をサポートするようになりました。挿入モード
     は ‘Textbox’ インスタンス構築時に 'insert_mode' パラメータを真にす
     ることで有効になります。

   * *note datetime: 34. モジュールの ‘strftime()’ メソッドが ‘%f’ 書式
     化コードをサポートするようになりました。これはオブジェクトのマイク
     ロ秒をミリ秒としてゼロ埋めで 6 桁で展開します。 (--訳注: 言葉だけだ
     とどうしても伝わりにくいですが、フィールドとしてミリ秒を持たずにマ
     イクロ秒を持っている datetime で「秒.ミリ秒」という表記をするのにマ
     イクロ秒精度まで表示するのが目的です。ですので 654 ミリ秒が「
     654000」と書式化されますし、32 ミリ秒は「032000」です。--)
     (Contributed by Skip Montanaro; bpo-1158(7).)

   * The *note decimal: 3a. module was updated to version 1.66 of the
     General Decimal Specification(8).  New features include some
     methods for some basic mathematical functions such as ‘exp()’ and
     ‘log10()’:

          >>> Decimal(1).exp()
          Decimal("2.718281828459045235360287471")
          >>> Decimal("2.7182818").ln()
          Decimal("0.9999999895305022877376682436")
          >>> Decimal(1000).log10()
          Decimal("3")

     ‘Decimal’ クラスの ‘as_tuple()’ メソッドが ‘sign’, ‘digits’,
     ‘exponent’ フィールドを持った名前付きタプルを返すようになりました。

     (Implemented by Facundo Batista and Mark Dickinson.  Named tuple
     support added by Raymond Hettinger.)

   * *note difflib: 3b. モジュールの ‘SequenceMatcher’ クラスが、マッチ
     を ‘a’, ‘b’, ‘size’ 属性を持つ名前付きタプルで返すようになりました
     。 (Contributed by Raymond Hettinger.)

   * *note ftplib.FTP: af6. クラスのコンストラクタと ‘connect()’ メソッ
     ドに省略可能 ‘timeout’ パラメータが追加されました。タイムアウトを秒
     で指定します。(Added by Facundo Batista.)  また、 ‘FTP’ クラスの
     ‘storbinary()’ と ‘storlines()’ メソッドが 'callback' パラメータを
     新たに受け取ります。これはデータが送信されたあとでデータの各ブロッ
     クごとに呼び出されます。 (Contributed by Phil Schwartz;
     bpo-1221598(9).)

   * ビルトイン関数の ‘reduce()’ が *note functools: 63. モジュールでも
     利用可能です。Python 3.0 ではビルトイン関数は削除されて *note
     functools: 63. のものだけが使えます; 現在のところ 2.x シリーズでビ
     ルトイン版を削除する計画はありません。 (Patched by Christian
     Heimes; bpo-1739906(10).)  (--訳注: 2.7 でも削除されていません。使
     用を検出するには ‘-3’ オプションなどで警告をチェックしてください。
     --)

   * 可能な場合には、 *note getpass: 66. モジュールはプロンプトメッセー
     ジ出力とパスワードの読み取りに ‘/dev/tty’ を使うようになりました。
     利用出来ない場合は標準エラー出力と標準入力が使われます。端末に入力
     パスワードがエコーされるかもしれない場合、プロンプト表示の前に警告
     が出力されます。 (Contributed by Gregory P. Smith.)

   * *note glob.glob(): 5a0. 関数が、Unicode パスが使われるかディレクト
     リ内に Unicode ファイル名がマッチすると Unicode ファイル名を返すよ
     うになりました。 (bpo-1001604(11))

   * *note heapq: 6d. モジュールの新しい関数 ‘merge(iter1, iter2, ...)’
     は、任意の数のソートされたデータを返すイテラブルを取り、全てのイテ
     ラブルの内容をソートされた順に返す新しいジェネレータを返します (--訳
     注: 誤解を招く表現なので補足しておきますが、入力のイテレータはソー
     ト済みであることを「仮定」し、出力のジェネレータは「入力が主張して
     いる」順序に従うだけです。入力がソートされていなくても並べ替えられ
     るわけではありません。リファレンスにはここはきちんと書かれています
     。--)。例えば:

          >>> list(heapq.merge([1, 3, 5, 9], [2, 8, 16]))
          [1, 2, 3, 5, 8, 9, 16]

     もう一つの新たな関数 ‘heappushpop(heap, item)’ は、 'item' を
     'heap' に push した後、pop を行って 'heap' から最初の要素を返します
     。この一続きの動作を ‘heappush()’ に引き続いて ‘heappop()’ を別々に
     呼び出すよりも効率的に実行します。

     *note heapq: 6d. は以前使っていた「以下(‘<=’)」比較ではなく「より小
     さい(‘<’)」比較だけを使って実装されています。これにより *note
     heapq: 6d. に格納する型の要件が *note list.sort(): dc8. メソッドに
     合致します。 (Contributed by Raymond Hettinger.)

   * An optional ‘timeout’ parameter, specifying a timeout measured in
     seconds, was added to the *note httplib.HTTPConnection: d35. and
     *note HTTPSConnection: d36. class constructors.  (Added by Facundo
     Batista.)

   * ‘getmoduleinfo()’ や ‘getargs()’ のようなほとんどの *note inspect:
     82. モジュール関数が、名前付きタプルを返すようになりました。タプル
     のように振る舞うだけでなく、属性でアクセスすることも出来ます。
     (Contributed by Raymond Hettinger.)

     モジュールには ‘isgenerator()’, ‘isgeneratorfunction()’,
     ‘isabstract()’ を含むいくつかの新しい関数が追加されています。

   * *note itertools: 85. モジュールにいくつかの関数が追加されています。

     ‘izip_longest(iter1, iter2, ...[, fillvalue])’ はそれぞれの要素群か
     らタプルを生成します; イテラブルの要素数がほかのものより短ければ欠
     落値として 'fillvalue' が埋められます。例えば:

          >>> tuple(itertools.izip_longest([1,2,3], [1,2,3,4,5]))
          ((1, 1), (2, 2), (3, 3), (None, 4), (None, 5))

     ‘product(iter1, iter2, ..., [repeat=N])’ は与えたイテラブルの直積
     (Cartesian product)、つまりそれぞれのイテラブルから返るその要素たち
     の全てのありうる組み合わせを含むタプルの集合を返します。:

          >>> list(itertools.product([1,2,3], [4,5,6]))
          [(1, 4), (1, 5), (1, 6),
           (2, 4), (2, 5), (2, 6),
           (3, 4), (3, 5), (3, 6)]

     省略可能 'repeat' キーワード引数が与えられると、イテラブルが一つで
     あればこれが 'N' 個、複数あればそのセットが 'N' 回与えられたとみな
     します。単一のイテラブルに対しては 'N' 要素タプルのリストで返ります
     :

          >>> list(itertools.product([1,2], repeat=3))
          [(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2),
           (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)]

     2 つのイテラブルであれば '2N' 要素タプルのリストで返ります:

          >>> list(itertools.product([1,2], [3,4], repeat=2))
          [(1, 3, 1, 3), (1, 3, 1, 4), (1, 3, 2, 3), (1, 3, 2, 4),
           (1, 4, 1, 3), (1, 4, 1, 4), (1, 4, 2, 3), (1, 4, 2, 4),
           (2, 3, 1, 3), (2, 3, 1, 4), (2, 3, 2, 3), (2, 3, 2, 4),
           (2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4)]

     ‘combinations(iterable, r)’ は、入力 'iterable' の要素からなる長さ
     'r' の部分列を返します (--訳注: 数学の初等組み合わせ論の「組合せ
     (combination)」 --):

          >>> list(itertools.combinations('123', 2))
          [('1', '2'), ('1', '3'), ('2', '3')]
          >>> list(itertools.combinations('123', 3))
          [('1', '2', '3')]
          >>> list(itertools.combinations('1234', 3))
          [('1', '2', '3'), ('1', '2', '4'),
           ('1', '3', '4'), ('2', '3', '4')]

     ‘permutations(iter[, r])’ は入力 'iterable' の長さ 'r' の順列を返し
     ます。 'r' が指定されなければ、イテラブルが生成する全要素数がデフォ
     ルトで使われます (--訳注: 数学の初等組み合わせ論の「順列 (sequence
     without repetition)」または群論や組合せ論の「置換 (permutation)」。
     リファレンスでは訳出で置換も順列も両方出てきていますが、高校教育で
     習う用語で「順列」が伝わりやすいのでここでは「順列」としています。
     --):

          >>> list(itertools.permutations([1,2,3,4], 2))
          [(1, 2), (1, 3), (1, 4),
           (2, 1), (2, 3), (2, 4),
           (3, 1), (3, 2), (3, 4),
           (4, 1), (4, 2), (4, 3)]

     ‘itertools.chain(*iterables)’ は *note itertools: 85. に元々いたも
     のですが、新しい構築方法が出来ました。Python 2.6 では、
     ‘itertools.chain.from_iterable(iterable)’ でほかのイテラブルを返す
     単一のイテラブルを取り、 ‘chain()’ は、最初のイテラブルからの全要素
     、次のイテラブルからの全要素、…、のように返します:

          >>> list(itertools.chain.from_iterable([[1,2,3], [4,5,6]]))
          [1, 2, 3, 4, 5, 6]

     (All contributed by Raymond Hettinger.)

   * *note logging: 8b. モジュールの ‘FileHandler’ クラスとそのサブクラ
     スの ‘WatchedFileHandler’, ‘RotatingFileHandler’,
     ‘TimedRotatingFileHandler’ がそのコンストラクタで省略可能 'delay' パ
     ラメータを受け取るようになりました。 'delay' が真の場合、ログファイ
     ルのオープンは最初の ‘emit()’ が呼び出されるまで延期されます。
     (Contributed by Vinay Sajip.)

     ‘TimedRotatingFileHandler’ ではコンストラクタに 'utc' パラメータも
     取るようになっています。これが真の場合、 ‘when='midnight'’ などの切
     り替え時刻判定とその生成ファイル名に UTC が使われます。

   * いくつかの新しい関数が *note math: 92. モジュールに追加されました:

        * *note isinf(): 15ea. と *note isnan(): 15eb. は与えられた浮動
          小数点数が、順に、(正または負の) 無限大であるかどうか、非数
          (NaN=Not a Number) であるかどうかを返します。

        * *note copysign(): 15ec. は IEEE 754 数の符号ビットをコピーしま
          す。 'x' の絶対値と 'y' の符号ビットを組み合わせたものを返しま
          す。例えば ‘math.copysign(1, -0.0)’ は -1.0 を返します。
          (Contributed by Christian Heimes.)

        * *note factorial(): b41. は階乗を計算します。 (Contributed by
          Raymond Hettinger; bpo-2138(12).)

        * *note fsum(): 15ed. はイテラブルからの数列を、部分和の計算を通
          じて精度の損失を避けながら積み上げた合計の計算をします。
          (Contributed by Jean Brouwers, Raymond Hettinger, and Mark
          Dickinson; bpo-2819(13).)

        * *note acosh(): 15ee, *note asinh(): 15ef, *note atanh(): 15f0.
          は逆双曲線関数を計算します。

        * *note log1p(): 15f1. は '1+x' の自然対数 (底 'e' の対数) を返
          します。

        * ‘trunc()’ はゼロに向かう方向に丸めを行い、与えられた引数とゼロ
          に最も近い ‘Integral’ を返します。これは *note PEP 3141;
          数値の型階層: 14d5. のバックポートの一部として追加されました。

   * *note math: 92. モジュールは、特に浮動小数点例外と IEEE 754 の特殊
     値の処理において、プラットフォーム間に渡る振る舞いの一貫性をさらに
     高めるように改善されました。

     可能な場合にはいつでもこのモジュールは 754 の特殊値について、C99 標
     準の勧告に従います。例えば、 ‘sqrt(-1.)’ は今ではほとんど全てのプラ
     ットフォームで *note ValueError: 2ec. となるはずで、
     ‘sqrt(float('NaN'))’ は全ての IEEE 754 プラットフォームで NaN を返
     すはずです。C99 標準の付録 'F' で 'divide-by-zero' または 'invalid'
     を伝えることを勧告している箇所では Python は *note ValueError: 2ec.
     を投げます。C99 標準の付録 'F' で 'overflow' を伝えることを勧告して
     いる箇所では Python は *note OverflowError: a81. を投げます。 (See
     bpo-711019(14) and bpo-1640(15).)

     (Contributed by Christian Heimes and Mark Dickinson.)

   * *note mmap: 519. オブジェクトに ‘rfind()’ メソッドが追加されていま
     す。部分文字列の検索を、末尾から後ろ向きに検索します。 ‘find()’ に
     は新しい引数 'end' パラメータが追加されていて、検索対象の終了位置を
     指定することが出来ます。 (Contributed by John Lenton.)

   * *note operator: a3. モジュールに ‘methodcaller()’ 関数が追加されて
     います。名前と省略可能な引数を与えると、渡したその任意の引数でその
     名前の関数を呼び出す呼び出し可能オブジェクトを返します。例えば:

          >>> # Equivalent to lambda s: s.replace('old', 'new')
          >>> replacer = operator.methodcaller('replace', 'old', 'new')
          >>> replacer('old wine in old bottles')
          'new wine in new bottles'

     (Contributed by Georg Brandl, after a suggestion by Gregory
     Petrosyan.)

     ‘attrgetter()’ 関数がドット付きの名前を受け付け、対応する属性ルック
     アップをするようになりました:

          >>> inst_name = operator.attrgetter(
          ...        '__class__.__name__')
          >>> inst_name('')
          'str'
          >>> inst_name(help)
          '_Helper'

     (Contributed by Georg Brandl, after a suggestion by Barry Warsaw.)

   * *note os: a5. モジュールがいくつか新しくシステムコールをラップして
     います。開いたファイルについて、 ‘fchmod(fd, mode)’ はモードを変更
     し、 ‘fchown(fd, uid, gid)’ は所有権を変更し、 ‘lchmod(path, mode)’
     はシンボリックリンクのモードを変更します。 (Contributed by Georg
     Brandl and Christian Heimes.)

     ‘chflags()’ と ‘lchflags()’ は対応するシステムコール (利用可能であ
     れば) へのラッパーで、ファイルのフラグを変更します。そのフラグ値に
     ついての定数が *note stat: d6. モジュールに定義されています; いくつ
     かの取りうる値には、ファイルが変更されるべきではないことを伝える
     ‘UF_IMMUTABLE’ 、ファイルにはデータの追記のみが可能であることを伝え
     る ‘UF_APPEND’ 、があります。 (Contributed by M. Levinson.)

     ‘os.closerange(low, high)’ は効率よく全ての 'low' から 'high' のフ
     ァイルデスクリプタをクローズします。全てのエラーは無視されます。そ
     れと 'high' はクローズ対象ではないです。この関数は既に *note
     subprocess: dc. モジュールがプロセスを開始するのを高速化するために
     使われています。 (Contributed by Georg Brandl; bpo-1663329(16).)

   * ‘os.environ’ オブジェクトの ‘clear()’ メソッドが、オブジェクトのキ
     ーから取り除くだけでなく *note os.unsetenv(): 25c. を使って環境変数
     を未設定にするようになりました。 (Contributed by Martin Horcicka;
     bpo-1181(17).)

   * *note os.walk(): 6d0. 関数に ‘followlinks’ パラメータが追加されてい
     ます。これを真にすると、シンボリックリンクが指す相手のディレクトリ
     を渡り歩くようになります。後方互換のためにこのパラメータのデフォル
     トは偽です。なお、親ディレクトリを指すシンボリックリンクなど参照が
     循環していると、無限再帰に陥りますので注意してください。
     (bpo-1273829(18))

   * *note os.path: a6. モジュールの ‘splitext()’ 関数が、先行するピリオ
     ドで分割しないように変更されています。これにより Unix のドットファ
     イルの処理結果がよくなります。例えば ‘os.path.splitext('.ipython')’
     は ‘('', '.ipython')’ ではなく ‘('.ipython', '')’ を返すようになっ
     ています。 (bpo-1115886(19))

     新規関数 ‘os.path.relpath(path, start='.')’ は、与えられれば
     ‘start’ からの、与えられなければカレントディレクトリからの、目的地
     ‘path’ への相対パスを返します。 (Contributed by Richard Barran;
     bpo-1339796(20).)

     Windows において、 *note os.path.expandvars(): 15f2. が "%var%" 形
     式の記述に環境変数を展開し、 "~user" にユーザのホームディレクトリの
     パスを展開するようになりました。 (Contributed by Josiah Carlson;
     bpo-957650(21).)  (--訳注: "~user" は実在した仕様かわかりません。
     2.7 に該当する実装もコメントも docstring もリファレンスもありません
     し、当然この振る舞いは現在実在していません。--)

   * *note pdb: aa. モジュールで提供される Python デバッガに新たなコマン
     ドが追加されました: "run" はデバッグ対象の Python プログラムを再起
     動します。またオプションとして、対象プログラムに与えるコマンドライ
     ン引数を渡せます。 (Contributed by Rocky Bernstein;
     bpo-1393667(22).)

   * トレースバックのデバッグを開始するのに使われる *note
     pdb.post_mortem(): 15f3. が、トレースバックが与えられない場合に
     *note sys.exc_info(): 89a. からの戻り値のトレースバックを使うように
     なりました。 (Contributed by Facundo Batista; bpo-1106316(23).)

   * *note pickletools: ac. モジュールに ‘optimize()’ 関数が追加されまし
     た。これは pickle を含んだ文字列を受け取って、未使用 opcode を削除
     の上で同じデータ構造を含んだより小さい pickle を返します。
     (Contributed by Raymond Hettinger.)

   * *note pkgutil: ae. モジュールに ‘get_data()’ 関数が追加されました。
     これはインストールされている Python パッケージに含まれるリソースフ
     ァイルの内容を返します。例えば:

          >>> import pkgutil
          >>> print pkgutil.get_data('test', 'exception_hierarchy.txt')
          BaseException
           +-- SystemExit
           +-- KeyboardInterrupt
           +-- GeneratorExit
           +-- Exception
                +-- StopIteration
                +-- StandardError
           ...

     (Contributed by Paul Moore; bpo-2439(24).)

   * ‘pyexpat’ モジュールの ‘Parser’ オブジェクトで、 ‘buffer_size’ 属性
     の設定により文字データの保持に使うバッファのサイズを変更出来るよう
     になりました。 (Contributed by Achim Gaedke; bpo-1137(25).)

   * ‘Queue’ モジュールが、エントリを違った順序で取り出すような queue の
     変種をサポートするようになっています。 ‘PriorityQueue’ クラスはキュ
     ーアイテムをヒープで格納し、それを優先順で取り出します。
     ‘LifoQueue’ クラスは、最後にエントリに追加されたものを最初に取り出
     します。つまり stack のように振舞うということです。 (Contributed by
     Raymond Hettinger.)

   * *note random: bd. モジュールの ‘Random’ が、今では 32 ビットシステ
     ムで pickle 出来、64 ビットシステムで unpickle 出来、逆も出来ます。
     残念ながらこの変更は Python 2.6 の ‘Random’ オブジェクトを以前の
     Python で正しく unpickle 出来ないことを意味します。 (Contributed by
     Shawn Ligocki; bpo-1727780(26).)

     新たな ‘triangular(low, high, mode)’ は、三角分布 (triangular
     distribution) に従う乱数を生成します。 'mode' は分布内の最頻値で、
     返却値は 'high' を含まない 'low' と 'high' の間です。 (Contributed
     by Wladmir van der Laan and Raymond Hettinger; bpo-1681432(27).)

   * *note re: be. モジュールによって実行される長い正規表現検索が届けら
     れるシグナルをチェックするようになり、これにより多大な時間を要する
     検索を中断出来るようになります。 (Contributed by Josh Hoyt and Ralf
     Schmitt; bpo-846388(28).)  (--訳注: 原文を忠実に訳すとわかりにくい
     ですが、単に C のレベルでシグナルハンドラを仕掛けたので Python が割
     り込める、というのがここで言っていることです。本質的には「長い」や
     「時間のかかる」はあまり関係ないです。--)

     正規表現モジュールは、小さな正規表現固有仮想マシン用のバイトコード
     をコンパイルすることで実装されています。信頼出来ないコードにより、
     悪意あるバイトコード文字列を直接作って破滅させることが出来ます。で
     すので、2.6 では正規表現バイトコードの検証をするようにしてあります
     。(Contributed by Guido van Rossum from work for Google App Engine;
     bpo-3487(29).)

   * The *note rlcompleter: c2. module's ‘Completer.complete()’ method
     will now ignore exceptions triggered while evaluating a name.
     (Fixed by Lorenz Quack; bpo-2250(30).)

   * *note sched: c4. モジュールの ‘scheduler’ インスタンスが読み出し専
     用の *note queue: bb. 属性を持つようになりました。これはスケジュー
     ラのキュー内容を名前付きタプル ‘(time, priority, action, argument)’
     で返します。 (Contributed by Raymond Hettinger; bpo-1861(31).)

   * The *note select: c6. module now has wrapper functions for the
     Linux ‘epoll()’ and BSD ‘kqueue()’ system calls.  ‘modify()’ method
     was added to the existing ‘poll’ objects; ‘pollobj.modify(fd,
     eventmask)’ takes a file descriptor or file object and an event
     mask, modifying the recorded event mask for that file.
     (Contributed by Christian Heimes; bpo-1657(32).)

   * *note shutil.copytree(): c1e. が省略可能引数 'ignore' を取るように
     なっています。呼び出し可能オブジェクトを渡します。この呼び出し可能
     オブジェクトはそれぞれのディレクトリパスとその内容リストを受け取っ
     て、コピーせずに無視したい名前のリストを返します。

     *note shutil: ca. モジュールでは同時に、この新たなパラメータのため
     に使える ‘ignore_patterns()’ も提供しています。 ‘ignore_patterns()’
     は任意の数の glob スタイルのパターンを取り、これらパターンに合致す
     る任意のファイルとディレクトリを無視する呼び出し可能オブジェクトを
     返します。以下は、 ‘.svn’ ディレクトリと '~' で終わるファイル名を持
     つ Emacs のバックアップファイルをスキップしてディレクトリコピーをす
     る例です:

          shutil.copytree('Doc/library', '/tmp/library',
                          ignore=shutil.ignore_patterns('*~', '.svn'))

     (Contributed by Tarek Ziadé; bpo-2663(33).)

   * Tkinter や GTK+ などのような場所で、シグナルハンドリングと GUI 処理
     のイベントループを組み合わせることは、長い間悩みの種でした; ほとん
     どのソフトウェアはポーリングを行って、わずかばかりの時間で起き上が
     っては GUI イベントが起きていないかチェックするハメになっています。
     *note signal: cb. モジュールが、これをより効率的に行えるようにしま
     した。 ‘signal.set_wakeup_fd(fd)’ でファイルデスクリプタをセットす
     ると、イベント受信時にファイルデスクリプタにバイトが書き込まれます
     。 C レベルの関数 *note PySignal_SetWakeupFd(): 15f4. もあります。
     同じくファイルデスクリプタを渡します。

     Event loops will use this by opening a pipe to create two
     descriptors, one for reading and one for writing.  The writable
     descriptor will be passed to ‘set_wakeup_fd()’, and the readable
     descriptor will be added to the list of descriptors monitored by
     the event loop via ‘select()’ or ‘poll()’.  On receiving a signal,
     a byte will be written and the main event loop will be woken up,
     avoiding the need to poll.

     (Contributed by Adam Olsen; bpo-1583(34).)

     ‘siginterrupt()’ 関数が Python コードから利用可能になりました。対象
     シグナルがシステムコールを中断出来るかどうかを変更出来ます。
     (Contributed by Ralf Schmitt.)

     ‘setitimer()’, ‘getitimer()’ 関数も追加されています (利用可能であれ
     ば)。 ‘setitimer()’ は、指定時間経過後に処理にシグナルを届けます。
     時間は「壁時計時間 (wall-clock time)」(訳注: リファレンスでは「実時
     間」と表現している)、「プロセスの実行時間 (consumed process time)」
     、またはプロセス + システム時間の組合せで指定します。(Contributed
     by Guilherme Polo; bpo-2240(35).)

   * *note smtplib: cf. モジュールが、 ‘SMTP_SSL’ クラスの追加によって
     SMTP over SSL をサポートするようになっています。このクラスは既存の
     ‘SMTP’ と同じインターフェイスです。(Contributed by Monty Taylor.)  両
     方のクラスのコンストラクタでは新たに省略可能な ‘timeout’ パラメータ
     を取ります。最初に接続を試みる際のタイムアウト値を秒で指定します。
     (Contributed by Facundo Batista.)

     LMTP プロトコル ( RFC 2033(36)) 実装もモジュールに追加されています
     。LMTP はメールキューを管理しないエージェント間で e-mail を転送する
     際に、SMTP の代わりに使われます。(LMTP implemented by Leif
     Hedstrom; bpo-957003(37).)

     ‘SMTP.starttls()’ は今や RFC 3207(38) 遵守であり、TLS ネゴシエーシ
     ョン自身で得たのでないサーバから得られるいかなる知識も記憶しません
     。(Patch contributed by Bill Fenner; bpo-829951(39).)

   * The *note socket: d1. module now supports TIPC
     (‘https://tipc.sourceforge.net/’), a high-performance non-IP-based
     protocol designed for use in clustered environments.  TIPC
     addresses are 4- or 5-tuples.  (Contributed by Alberto Bertogli;
     bpo-1646(40).)

     新規の ‘create_connection()’ 関数はアドレスを取り、省略可能なタイム
     アウト値を使って接続を行い、接続されたソケットオブジェクトを返しま
     す。この関数は同時に、アドレスのタイプを調べて IPv4 と IPv6 の相応
     しい方を使って接続します。あなたのコードが ‘socket(socket.AF_INET,
     ...)’ を使う代わりに ‘create_connection()’ に乗り換えることは、それ
     が IPv6 対応で必要なこと全て、となるでしょう。

   * The base classes in the *note SocketServer: d2. module now support
     calling a *note handle_timeout(): 1539. method after a span of
     inactivity specified by the server's *note timeout: 1538.
     attribute.  (Contributed by Michael Pomraning.)  The *note
     serve_forever(): 1357. method now takes an optional poll interval
     measured in seconds, controlling how often the server will check
     for a shutdown request.  (Contributed by Pedro Werneck and Jeffrey
     Yasskin; bpo-742598(41), bpo-1193577(42).)

   * Gerhard Häring により保守されている *note sqlite3: d4. モジュールが
     、Python 2.5 時のバージョン 2.3.2 からバージョン 2.4.1 に更新されま
     した。

   * The *note struct: db. module now supports the C99 _Bool type, using
     the format character ‘'?'’.  (Contributed by David Remahl.)

   * The *note Popen: 4b7. objects provided by the *note subprocess: dc.
     module now have *note terminate(): 15f5, *note kill(): 15f6, and
     *note send_signal(): 15f7. methods.  On Windows, ‘send_signal()’
     only supports the *note SIGTERM: 15f8. signal, and all these
     methods are aliases for the Win32 API function
     ‘TerminateProcess()’.  (Contributed by Christian Heimes.)

   * *note sys: df. モジュールに新たに追加された変数 ‘float_info’ は、
     ‘float.h’ に由来するプラットフォームの浮動小数点数サポートについて
     の情報を含んだオブジェクトです。このオブジェクトの属性としては、
     ‘mant_dig’ (仮数部の桁数)、 ‘epsilon’ (1.0 と、それより大きい表現可
     能な最小値との差)などがあります。 (Contributed by Christian Heimes;
     bpo-1534(43).)

     もう一つの新たな変数 ‘dont_write_bytecode’ は Python がモジュールイ
     ンポート時に ‘.pyc’ や ‘.pyo’ を作るかどうかを制御します。この変数
     が真ならば、コンパイル済みファイルは作られません。この変数は Python
     インタプリタを *note -B: 15e6. スイッチ付きで起動するか環境変数
     *note PYTHONDONTWRITEBYTECODE: 15e7. をセットすることで初期設定され
     ます。Python コードはこのあとでこの変数の値を変更することで、バイト
     コードファイルを作るかどうかを制御出来ます。 (Contributed by Neal
     Norwitz and Georg Brandl.)

     Python インタプリタに与えられたコマンドライン引数についての情報を、
     ‘sys.flags’ として利用可能な名前付きタプルで知ることが出来ます。例
     えば Python が冗長モードで起動された場合は ‘verbose’ 属性は真となり
     、デバッグモードでは ‘debug’ 属性が真、などです。これら属性は全て読
     み出し専用です。 (Contributed by Christian Heimes.)

     新しい関数 ‘getsizeof()’ が追加されました。 Python オブジェクトを受
     け取り、そのオブジェクトが利用しているメモリサイズをバイト単位で返
     します。 ビルトインオブジェクトは正確な結果を返しますが、サードパー
     ティの拡張は正確な値を返さないかもしれません。 その場合
     ‘__sizeof__()’ メソッドを定義してオブジェクトのサイズを返すことがで
     きます。 (Robert Schuppenies による貢献.  bpo-2898(44))

     現在動作中のプロファイラとトレーサーを、 *note sys.getprofile():
     15f9. と *note sys.gettrace(): 15fa. で知ることが出来るようになりま
     した。 (Contributed by Georg Brandl; bpo-1648(45).)

   * *note tarfile: e4. モジュールが、既にサポートされている
     POSIX.1-1988 (ustar) と GNU tar フォーマットに加えて、POSIX.1-2001
     (pax) をサポートするようになりました。デフォルトは GNU tar です; こ
     れと違うフォーマットでファイルを開くには ‘format’ パラメータで指定
     します:

          tar = tarfile.open("output.tar", "w",
                             format=tarfile.PAX_FORMAT)

     新しい ‘encoding’ と ‘errors’ パラメータはエンコーディングと文字変
     換のエラー処理方法を指定します。 ‘'strict'’, ‘'ignore'’,
     ‘'replace'’ は Python の 3 つの標準エラー処理です; ‘'utf-8'’ は特殊
     で、不正な文字を、それの UTF-8 表現に置き換えます。(文字変換は、PAX
     フォーマットが Unicode ファイル名をサポートするために現れ、デフォル
     トは UTF-8 エンコーディングです。)

     The ‘TarFile.add()’ method now accepts an ‘exclude’ argument that's
     a function that can be used to exclude certain filenames from an
     archive.  The function must take a filename and return true if the
     file should be excluded or false if it should be archived.  The
     function is applied to both the name initially passed to ‘add()’
     and to the names of files in recursively added directories.

     (All changes contributed by Lars Gustäbel).

   * An optional ‘timeout’ parameter was added to the ‘telnetlib.Telnet’
     class constructor, specifying a timeout measured in seconds.
     (Added by Facundo Batista.)

   * *note tempfile.NamedTemporaryFile: 6ed. クラスは普通はこれが作った
     一時ファイルを、ファイルクローズ時に削除します。この振る舞いを、コ
     ンストラクタのパラメータに ‘delete=False’ を渡すことで変更出来るよ
     うになりました。 (Contributed by Damien Miller; bpo-1537850(46).)

     新しいクラス ‘SpooledTemporaryFile’ は一時ファイルのように振舞いま
     すが、そのデータは最大サイズを超えるまではメモリ内に格納されます。
     その制限を超えると、その内容がディスク上の一時ファイルに書き込まれ
     ます。 (Contributed by Dustin J. Mitchell.)

     ‘NamedTemporaryFile’ と ‘SpooledTemporaryFile’ のともにコンテキスト
     マネージャとして動作しますので、 ‘with
     tempfile.NamedTemporaryFile() as tmp: ...’ のように書くことが出来ま
     す。 (Contributed by Alexander Belopolsky; bpo-2021(47).)

   * The *note test.test_support: ea. module gained a number of context
     managers useful for writing tests.  *note EnvironmentVarGuard():
     15fb. is a context manager that temporarily changes environment
     variables and automatically restores them to their old values.

     もう一つのコンテキストマネージャ ‘TransientResource’ は、利用出来る
     かもしれないし出来ないかもしれないリソースの呼び出しを包むことが出
     来ます; 指定した例外リストを捕捉して無視します(--訳注: この紹介、良
     くないと思うのと、多分著者が誤解してます。確かに属性名/属性値を特定
     してこれに一致する場合にだけ例外を受け取るためのものなので、一致し
     ないものは無視、という事実には反しませんが、「狙った例外は受け取る
     (ResourceDenied)」でもあるはずです。「期待した例外が発生する」こと
     をテストしたいでしょう、「期待しない例外はテストには関係ない」であ
     るとともに。それとリファレンスと docstring によれば「指定した例外と
     属性に合致する場合に ResourceDenied」と言っているので、やはり事実と
     は反しています。--)。例えば、ネットワークのテストでは外部のウェブサ
     イトとの接続時の特定の失敗を無視するでしょう:

          with test_support.TransientResource(IOError,
                                          errno=errno.ETIMEDOUT):
              f = urllib.urlopen('https://sf.net')
              ...

     最後に、 ‘check_warnings()’ は ‘warning’ モジュールの警告フィルタを
     リセットして、全ての引き起こされる警告メッセージを記録するオブジェ
     クトを返します (bpo-3781(48)):

          with test_support.check_warnings() as wrec:
              warnings.simplefilter("always")
              # ... code that triggers a warning ...
              assert str(wrec.message) == "function is outdated"
              assert len(wrec.warnings) == 1, "Multiple warnings raised"

     (Contributed by Brett Cannon.)

   * The *note textwrap: f2. module can now preserve existing whitespace
     at the beginnings and ends of the newly created lines by specifying
     ‘drop_whitespace=False’ as an argument:

          >>> S = """This  sentence  has a bunch   of
          ...   extra   whitespace."""
          >>> print textwrap.fill(S, width=15)
          This  sentence
          has a bunch
          of    extra
          whitespace.
          >>> print textwrap.fill(S, drop_whitespace=False, width=15)
          This  sentence
            has a bunch
             of    extra
             whitespace.
          >>>

     (Contributed by Dwayne Bailey; bpo-1581073(49).)

   * *note threading: f3. モジュールの API が、 ‘setDaemon()’,
     ‘isDaemon()’ メソッドではなく ‘daemon’ のようにプロパティを使うよう
     に変更中です。また、いくつかのメソッドはキャメルケースではなくアン
     ダースコアスタイルに名前変更されています; 例えば ‘activeCount()’ メ
     ソッドは ‘active_count()’ にリネームされます。2.6 と 3.0 の両バージ
     ョンのモジュールは同じプロパティとリネームされたメソッドをサポート
     しますが、古いメソッドは削除されません。古い API が Python 3.x で撤
     廃するのがいつになるのかは未定です; 2.x バージョンでは削除されない
     でしょう。 (Carried out by several people, most notably Benjamin
     Peterson.)  (-- 訳注: 3.5 でもこの状態は続いたままです。今でもキャ
     メルケーススタイルのメソッドが使えます。ですが、もちろん新しい名前
     を使うべきです。--)

     *note threading: f3. モジュールの ‘Thread’ オブジェクトに ‘ident’ プ
     ロパティが追加されています。スレッドの識別子を非ゼロの整数で返しま
     す。 (Contributed by Gregory P. Smith; bpo-2871(50).)

   * *note timeit: f5. モジュールが、計測されるステートメントとセットア
     ップコードとして、文字列だけでなく呼び出し可能オブジェクトを渡せる
     ようになりました。 ‘Timer’ インスタンスを作成する 2 つの便利関数が
     追加されています: ‘repeat(stmt, setup, time, repeat, number)’ と
     ‘timeit(stmt, setup, time, number)’ で、インスタンスを作成して対応
     するメソッドを呼びます。 (Contributed by Erik Demaine;
     bpo-1533909(51).)

   * ‘Tkinter’ モジュールが、オプションとしてリストとタプルを受け付ける
     ようになっています。Tcl/Tk へは空白区切りの文字列にして渡されます。
     (Contributed by Guilherme Polo; bpo-2906(52).)

   * タートルグラフィックスのための *note turtle: 107. モジュールが
     Gregor Lingl により大幅に拡張されました。 モジュールの新しい機能は
     次の通りです:

        * 亀の移動と回転のアニメーションの改善。

        * 新しい ‘delay()’ メソッド、 ‘tracer()’ メソッド、 ‘speed()’ メ
          ソッドを使って亀の動きをコントロールできるようになりました。

        * 亀に新しい姿を設定できたり、新しい座標系を定義できるようになり
          ました。

        * Turtles now have an ‘undo()’ method that can roll back
          actions.

        * マウスやキーボードからの入力イベントに反応するための簡易なサポ
          ートが入り、簡単なゲームを書けるようになりました。

        * ‘turtle.cfg’ を使って、turtle の画面の起動時の見た目をカスタマ
          イズできるようになりました。

        * モジュールの docstring が、他の言語に翻訳された docstring に置
          き換えられるようになりました。

     (bpo-1513695(53))

   * An optional ‘timeout’ parameter was added to the *note
     urllib.urlopen: 307. function and the ‘urllib.ftpwrapper’ class
     constructor, as well as the *note urllib2.urlopen: 307. function.
     The parameter specifies a timeout measured in seconds.  For
     example:

          >>> u = urllib2.urlopen("http://slow.example.com",
                                  timeout=3)
          Traceback (most recent call last):
            ...
          urllib2.URLError: <urlopen error timed out>
          >>>

     (Added by Facundo Batista.)

   * *note unicodedata: 10b. モジュールで提供される Unicode データベース
     が、バージョン 5.1.0 に更新されました。 (Updated by Martin von
     Löwis; bpo-3811(54).)

   * *note warnings: 118. モジュールの ‘formatwarning()’ と
     ‘showwarning()’ に省略可能な 'line' 引数が追加されました。ソースコ
     ードの行番号を与えることが出来ます。 (Added as part of
     bpo-1631171(55), which re-implemented part of the *note warnings:
     118. module in C code.)

     新しい関数 ‘catch_warnings()’ はコンテキストマネージャで、テスト目
     的で警告フィルタを一時的に変更して元に戻すのに使えます。
     (bpo-3781(56)).

   * The XML-RPC *note SimpleXMLRPCServer: 135. and *note
     DocXMLRPCServer: 135. classes can now be prevented from immediately
     opening and binding to their socket by passing ‘False’ as the
     'bind_and_activate' constructor parameter.  This can be used to
     modify the instance's ‘allow_reuse_address’ attribute before
     calling the ‘server_bind()’ and ‘server_activate()’ methods to open
     the socket and begin listening for connections.  (Contributed by
     Peter Parente; bpo-1599845(57).)

     ‘SimpleXMLRPCServer’ はさらに ‘_send_traceback_header’ 属性を持つよ
     うになりました。真の場合、例外とフォーマットされたトレースバックが
     HTTP ヘッダ "X-Exception" と "X-Traceback" として返ります。この機能
     はデバッグのみに使い、製品のサーバには使ってはなりません。トレース
     バックには剥き出しのパスワードが含まれるかもしれず、あるいはほかの
     何か企業秘密だったり国家秘密だったりするような繊細な情報満載かもし
     れないのです。 (Contributed by Alan McIntyre as part of his project
     for Google's Summer of Code 2007.)

   * The *note xmlrpclib: 134. module no longer automatically converts
     *note datetime.date: 1fa. and *note datetime.time: 1fb. to the
     *note xmlrpclib.DateTime: 15fc. type; the conversion semantics were
     not necessarily correct for all applications.  Code using
     ‘xmlrpclib’ should convert ‘date’ and *note time: 1fb. instances.
     (bpo-1330538(58)) The code can also handle dates before 1900
     (contributed by Ralf Schmitt; bpo-2014(59)) and 64-bit integers
     represented by using ‘<i8>’ in XML-RPC responses (contributed by
     Riku Lindblad; bpo-2985(60)).

   * *note zipfile: 137. モジュールの ‘ZipFile’ クラスに ‘extract()’ メ
     ソッドと ‘extractall()’ メソッドが追加されました。アーカイブ内の、
     それぞれ単一ファイル、全てのファイルを、カレントディレクトリか指定
     のディレクトリに展開します:

          z = zipfile.ZipFile('python-251.zip')

          # Unpack a single file, writing it relative
          # to the /tmp directory.
          z.extract('Python/sysmodule.c', '/tmp')

          # Unpack all the files in the archive.
          z.extractall()

     (Contributed by Alan McIntyre; bpo-467924(61).)

     *note open(): 316, ‘read()’, ‘extract()’ メソッドはファイル名か
     ‘ZipInfo’ オブジェクトのどちらかを受け取れるようになっています。こ
     れは誤って重複したファイル名を含んでいるアーカイブで有用でしょう。
     (Contributed by Graham Horler; bpo-1775025(62).)

     最後に、 *note zipfile: 137. がアーカイブするファイルのファイル名と
     して Unicode の使用をサポートするようになりました。 (Contributed by
     Alexey Borzenkov; bpo-1734346(63).)  (--訳注: リファレンスに注意事
     項として書かれていますが、zip ファイルのファイル名標準は存在しない
     のでこれは問題を起こすことがあります。--)

* Menu:

* ast モジュール::
* The future_builtins module::
* json モジュール; JavaScript オブジェクト記法: json モジュール JavaScript オブジェクト記法.
* plistlib モジュール; プロパティリストパーサ: plistlib モジュール プロパティリストパーサ.
* ctypes の強化::
* SSL サポートの改善::

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1736190

   (2) https://www.jcea.es/programacion/pybsddb.htm

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1817

   (4) https://bugs.python.org/issue?@action=redirect&bpo=600362

   (5) https://bugs.python.org/issue?@action=redirect&bpo=1381

   (6) https://bugs.python.org/issue?@action=redirect&bpo=1638033

   (7) https://bugs.python.org/issue?@action=redirect&bpo=1158

   (8) https://speleotrove.com/decimal/decarith.html

   (9) https://bugs.python.org/issue?@action=redirect&bpo=1221598

   (10) https://bugs.python.org/issue?@action=redirect&bpo=1739906

   (11) https://bugs.python.org/issue?@action=redirect&bpo=1001604

   (12) https://bugs.python.org/issue?@action=redirect&bpo=2138

   (13) https://bugs.python.org/issue?@action=redirect&bpo=2819

   (14) https://bugs.python.org/issue?@action=redirect&bpo=711019

   (15) https://bugs.python.org/issue?@action=redirect&bpo=1640

   (16) https://bugs.python.org/issue?@action=redirect&bpo=1663329

   (17) https://bugs.python.org/issue?@action=redirect&bpo=1181

   (18) https://bugs.python.org/issue?@action=redirect&bpo=1273829

   (19) https://bugs.python.org/issue?@action=redirect&bpo=1115886

   (20) https://bugs.python.org/issue?@action=redirect&bpo=1339796

   (21) https://bugs.python.org/issue?@action=redirect&bpo=957650

   (22) https://bugs.python.org/issue?@action=redirect&bpo=1393667

   (23) https://bugs.python.org/issue?@action=redirect&bpo=1106316

   (24) https://bugs.python.org/issue?@action=redirect&bpo=2439

   (25) https://bugs.python.org/issue?@action=redirect&bpo=1137

   (26) https://bugs.python.org/issue?@action=redirect&bpo=1727780

   (27) https://bugs.python.org/issue?@action=redirect&bpo=1681432

   (28) https://bugs.python.org/issue?@action=redirect&bpo=846388

   (29) https://bugs.python.org/issue?@action=redirect&bpo=3487

   (30) https://bugs.python.org/issue?@action=redirect&bpo=2250

   (31) https://bugs.python.org/issue?@action=redirect&bpo=1861

   (32) https://bugs.python.org/issue?@action=redirect&bpo=1657

   (33) https://bugs.python.org/issue?@action=redirect&bpo=2663

   (34) https://bugs.python.org/issue?@action=redirect&bpo=1583

   (35) https://bugs.python.org/issue?@action=redirect&bpo=2240

   (36) https://datatracker.ietf.org/doc/html/rfc2033.html

   (37) https://bugs.python.org/issue?@action=redirect&bpo=957003

   (38) https://datatracker.ietf.org/doc/html/rfc3207.html

   (39) https://bugs.python.org/issue?@action=redirect&bpo=829951

   (40) https://bugs.python.org/issue?@action=redirect&bpo=1646

   (41) https://bugs.python.org/issue?@action=redirect&bpo=742598

   (42) https://bugs.python.org/issue?@action=redirect&bpo=1193577

   (43) https://bugs.python.org/issue?@action=redirect&bpo=1534

   (44) https://bugs.python.org/issue?@action=redirect&bpo=2898

   (45) https://bugs.python.org/issue?@action=redirect&bpo=1648

   (46) https://bugs.python.org/issue?@action=redirect&bpo=1537850

   (47) https://bugs.python.org/issue?@action=redirect&bpo=2021

   (48) https://bugs.python.org/issue?@action=redirect&bpo=3781

   (49) https://bugs.python.org/issue?@action=redirect&bpo=1581073

   (50) https://bugs.python.org/issue?@action=redirect&bpo=2871

   (51) https://bugs.python.org/issue?@action=redirect&bpo=1533909

   (52) https://bugs.python.org/issue?@action=redirect&bpo=2906

   (53) https://bugs.python.org/issue?@action=redirect&bpo=1513695

   (54) https://bugs.python.org/issue?@action=redirect&bpo=3811

   (55) https://bugs.python.org/issue?@action=redirect&bpo=1631171

   (56) https://bugs.python.org/issue?@action=redirect&bpo=3781

   (57) https://bugs.python.org/issue?@action=redirect&bpo=1599845

   (58) https://bugs.python.org/issue?@action=redirect&bpo=1330538

   (59) https://bugs.python.org/issue?@action=redirect&bpo=2014

   (60) https://bugs.python.org/issue?@action=redirect&bpo=2985

   (61) https://bugs.python.org/issue?@action=redirect&bpo=467924

   (62) https://bugs.python.org/issue?@action=redirect&bpo=1775025

   (63) https://bugs.python.org/issue?@action=redirect&bpo=1734346


File: python.info,  Node: ast モジュール,  Next: The future_builtins module,  Up: 新しいモジュールと改良されたモジュール<2>

1.17.18.1 ‘ast’ モジュール
..........................

*note ast: 9. モジュールは Python コードの抽象構文木 (Abstract Syntax
Tree) 表現を提供します。また、Armin Ronacher は共通タスクを実行するさま
ざまなヘルパー関数を寄稿しました。これらは HTML テンプレートパッケージで
あるとか、コードアナライザ、などなどの、Python コードを処理するツールで
有用となるでしょう。

‘parse()’ 関数は式を受け取り AST を返します。 ‘dump()’ 関数はツリー表現
をデバッギングに相応しい出力をします:

     import ast

     t = ast.parse("""
     d = {}
     for i in 'abcdefghijklm':
         d[i + i] = ord(i) - ord('a') + 1
     print d
     """)
     print ast.dump(t)

これの出力は深くネストされたツリーです:

     Module(body=[
       Assign(targets=[
         Name(id='d', ctx=Store())
        ], value=Dict(keys=[], values=[]))
       For(target=Name(id='i', ctx=Store()),
           iter=Str(s='abcdefghijklm'), body=[
         Assign(targets=[
           Subscript(value=
             Name(id='d', ctx=Load()),
               slice=
               Index(value=
                 BinOp(left=Name(id='i', ctx=Load()), op=Add(),
                  right=Name(id='i', ctx=Load()))), ctx=Store())
          ], value=
          BinOp(left=
           BinOp(left=
            Call(func=
             Name(id='ord', ctx=Load()), args=[
               Name(id='i', ctx=Load())
              ], keywords=[], starargs=None, kwargs=None),
            op=Sub(), right=Call(func=
             Name(id='ord', ctx=Load()), args=[
               Str(s='a')
              ], keywords=[], starargs=None, kwargs=None)),
            op=Add(), right=Num(n=1)))
         ], orelse=[])
        Print(dest=None, values=[
          Name(id='d', ctx=Load())
        ], nl=True)
      ])

‘literal_eval()’ メソッドは、文字列またはリテラル式を表現する AST を受け
取り解析と評価を行い、結果の値を返します。リテラル式は、文字列、数値、辞
書などのみを含む Python 式で、文や関数呼び出しを含みません。もしもあなた
に式を評価する必要があって、だけれども *note eval(): 4a3. を呼び出すこと
によるセキュリティリスクを許容出来ないということであれば、
‘literal_eval()’ がそれを安全に処理してくれます:

     >>> literal = '("a", "b", {2:4, 3:8, 1:2})'
     >>> print ast.literal_eval(literal)
     ('a', 'b', {1: 2, 2: 4, 3: 8})
     >>> print ast.literal_eval('"a" + "b"')
     Traceback (most recent call last):
       ...
     ValueError: malformed string

モジュールには、AST を横断し、修正するための ‘NodeVisitor’ と
‘NodeTransformer’ クラス、例えば行番号の変更などの共通的な変形を行う関数
群が含まれています。


File: python.info,  Node: The future_builtins module,  Next: json モジュール JavaScript オブジェクト記法,  Prev: ast モジュール,  Up: 新しいモジュールと改良されたモジュール<2>

1.17.18.2 The ‘future_builtins’ module
......................................

Python 3.0 makes many changes to the repertoire of built-in functions,
and most of the changes can't be introduced in the Python 2.x series
because they would break compatibility.  The ‘future_builtins’ module
provides versions of these built-in functions that can be imported when
writing 3.0-compatible code.

このモジュールに今のところ含まれるのは:

   * ‘ascii(obj)’: 2.x の *note repr(): 1c1. と同じことをします。Python
     3.0 では *note repr(): 1c1. は Unicode 文字列を返すようになっていて
     、一方 *note ascii(): 15ff. は純粋な ASCII バイト文字列を返します。

   * ‘filter(predicate, iterable)’, ‘map(func, iterable1, ...)’: 3.0 と
     同じようにイテレータを返し、これは 2.x のビルトインがリストで返すの
     とは違っています。

   * ‘hex(value)’, ‘oct(value)’: ‘__hex__()’ と ‘__oct__()’ メソッドを呼
     び出すのではなく、 ‘__index__()’ メソッドを呼び出した結果を
     hexadecimal または octal に変換します。こちらのバージョンの *note
     oct(): 14e6. は新しい ‘0o’ 記法で返却します。


File: python.info,  Node: json モジュール JavaScript オブジェクト記法,  Next: plistlib モジュール プロパティリストパーサ,  Prev: The future_builtins module,  Up: 新しいモジュールと改良されたモジュール<2>

1.17.18.3 ‘json’ モジュール: JavaScript オブジェクト記法
........................................................

新しい *note json: 86. モジュールは、JSON (Javascript Object Notation) と
Python 型のエンコーディング、デコーディングをサポートします。JSON は軽量
なデータ交換フォーマットで、頻繁にウェブアプリケーションで使われます。
JSON の詳細情報は ‘http://www.json.org’ にあります。

*note json: 86. モジュールはほとんどのビルトイン型のデコーディングとエン
コーディングサポートを備えています。以下の例は辞書のエンコードとデコード
をしています:

     >>> import json
     >>> data = {"spam": "foo", "parrot": 42}
     >>> in_json = json.dumps(data) # Encode the data
     >>> in_json
     '{"parrot": 42, "spam": "foo"}'
     >>> json.loads(in_json) # Decode into a Python object
     {"spam": "foo", "parrot": 42}

ほかの何か型をサポートするのに独自のエンコーダ、デコーダを書くことも出来
ます。JSON 文字列の pretty-printing もサポートされています。

*note json: 86. (もともと simplejson と呼ばれていました) は Bob Ippolito
によって書かれました。


File: python.info,  Node: plistlib モジュール プロパティリストパーサ,  Next: ctypes の強化,  Prev: json モジュール JavaScript オブジェクト記法,  Up: 新しいモジュールと改良されたモジュール<2>

1.17.18.4 ‘plistlib’ モジュール: プロパティリストパーサ
.......................................................

‘.plist’ フォーマットは Mac OS X で一般的に使われ、基本的なデータ型(数値
、文字列、リスト、辞書)を XML ベースのフォーマットにシリアライズして格納
します。データ型の XML-RPC シリアライズに似ています。

Mac OS X で主に使われるとはいえ、そのフォーマットはまったく Mac 固有では
なくその Python 実装は Python がサポートするあらゆるプラットフォームで動
作するので、*note plistlib: b0. は標準ライブラリに昇格しました。

モジュールを使うのは単純です:

     import sys
     import plistlib
     import datetime

     # Create data structure
     data_struct = dict(lastAccessed=datetime.datetime.now(),
                        version=1,
                        categories=('Personal','Shared','Private'))

     # Create string containing XML.
     plist_str = plistlib.writePlistToString(data_struct)
     new_struct = plistlib.readPlistFromString(plist_str)
     print data_struct
     print new_struct

     # Write data structure to a file and read it back.
     plistlib.writePlist(data_struct, '/tmp/customizations.plist')
     new_struct = plistlib.readPlist('/tmp/customizations.plist')

     # read/writePlist accepts file-like objects as well as paths.
     plistlib.writePlist(data_struct, sys.stdout)


File: python.info,  Node: ctypes の強化,  Next: SSL サポートの改善,  Prev: plistlib モジュール プロパティリストパーサ,  Up: 新しいモジュールと改良されたモジュール<2>

1.17.18.5 ctypes の強化
.......................

Thomas Heller は *note ctypes: 2e. モジュールの保守と拡張を続けました。

*note ctypes: 2e. は今では C99 ‘bool’ 型を表す ‘c_bool’ データ型をサポー
トします。 (Contributed by David Remahl; bpo-1649190(1).)

*note ctypes: 2e. の string, buffer, array 型が拡張スライスインデクス構
文をサポートするように改善され、 ‘(start, stop, step)’ の色々な組み合わ
せが使えます。 (Implemented by Thomas Wouters.)

全ての *note ctypes: 2e. データ型が ‘from_buffer()’,
‘from_buffer_copy()’ メソッドをサポートするようになりました。これは与え
られた buffer オブジェクトに基く ctypes インスタンスを作ります。
‘from_buffer_copy()’ はそのオブジェクトの内容をコピーし、
‘from_buffer()’ はその同じメモリ領域を共有します。

新しい呼び出しの慣例は、 *note ctypes: 2e. にそれぞれのラップされた呼び
出しの発生時に ‘errno’ あるいは Win32 LastError 変数をクリアすることを伝
えることです。 (Implemented by Thomas Heller; bpo-1798(2).)

Unix ‘errno’ 変数を関数呼び出し後に抽出できるようになっています。ラップ
された関数を作る際、 ‘use_errno=True’ を ‘DLL()’ 関数へのキーワード引数
として渡すことが出来、それによりモジュールレベル関数の ‘set_errno()’ と
‘get_errno()’ を、 errno 値を設定・取得するのに呼び出せます。

Win32 LastError は ‘DLL()’, ‘OleDLL()’, ‘WinDLL()’ 関数で同じようにサポ
ートされています。同じように ‘use_last_error=True’ を与え、モジュールレ
ベル関数 ‘set_last_error()’ と ‘get_last_error()’ を使います。

ctypes インスタンスへのポインタを抽出にするのに使われる ‘byref()’ 関数が
、省略可能な 'offset' パラメータを受け取るようになりました。これは返され
るポインタに追加されるバイト数です。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1649190

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1798


File: python.info,  Node: SSL サポートの改善,  Prev: ctypes の強化,  Up: 新しいモジュールと改良されたモジュール<2>

1.17.18.6 SSL サポートの改善
............................

Bill Janssen は Python 2.6 の Secure Sockets Layer サポートを大掛かりに
改善しました。行われたのは新モジュール *note ssl: d5. の追加です。これは
OpenSSL(1) ライブラリの上に構築されています。この新しいモジュールはプロ
トコルのネゴシエイトのさらなる制御、X.509 証明書の使用、そして SSL サー
バ (クライアントの対語としての) を Python で書くためのより良いサポートを
提供しています。既存の *note socket: d1. モジュールにある SSL サポートは
削除されずにそのまま使えますが、Python 3.0 では削除されます。

この新たなモジュールを使うには、まず最初にいつものやり方で TCP コネクシ
ョンを作らなければなりません。そしてその上でそれを ‘ssl.wrap_socket()’ 関
数に渡します (--訳注: 2.7.9 ではさらに進化した ‘SSLContext.wrap_socket’
が使えます --)。証明書が必要かどうかを指定することが出来、証明書の情報を
‘getpeercert()’ メソッドで取得することも出来ます。

参考
....

*note ssl: d5. モジュールについてのドキュメント。

   ---------- Footnotes ----------

   (1) https://www.openssl.org/


File: python.info,  Node: 非推奨と削除,  Next: ビルドならびに C API の変更<9>,  Prev: 新しいモジュールと改良されたモジュール<2>,  Up: What's New in Python 2 6

1.17.19 非推奨と削除
--------------------

   * 文字列を例外として送出することは出来なくなりました。これをすると
     *note TypeError: 198. を起こします。

   * Changes to the *note Exception: bcd. interface as dictated by PEP
     352(1) continue to be made.  For 2.6, the ‘message’ attribute is
     being deprecated in favor of the *note args: 78d. attribute.

   * (3.0 警告モード) Python 3.0 はたくさんの時代遅れのモジュールを削除
     し、ほかのものも名前変更するような標準ライブラリの再編成が特色とな
     ります。Python 2.6 を 3.0 警告モードで動かすと、それらがインポート
     される際に警告が励起されます。

     The list of deprecated modules is: ‘audiodev’, ‘bgenlocations’,
     ‘buildtools’, ‘bundlebuilder’, ‘Canvas’, ‘compiler’, ‘dircache’,
     ‘dl’, ‘fpformat’, ‘gensuitemodule’, ‘ihooks’, ‘imageop’, ‘imgfile’,
     ‘linuxaudiodev’, ‘mhlib’, ‘mimetools’, ‘multifile’, ‘new’, ‘pure’,
     ‘statvfs’, ‘sunaudiodev’, ‘test.testall’, and ‘toaiff’.

   * The ‘gopherlib’ module has been removed.

   * The ‘MimeWriter’ module and ‘mimify’ module have been deprecated;
     use the *note email: 3f. package instead.

   * The ‘md5’ module has been deprecated; use the *note hashlib: 6c.
     module instead.

   * The ‘posixfile’ module has been deprecated; *note fcntl.lockf():
     1605. provides better locking.

   * The ‘popen2’ module has been deprecated; use the *note subprocess:
     dc. module.

   * The ‘rgbimg’ module has been removed.

   * The ‘sets’ module has been deprecated; it's better to use the
     built-in *note set: 184. and *note frozenset: 7f2. types.

   * The ‘sha’ module has been deprecated; use the *note hashlib: 6c.
     module instead.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0352/


File: python.info,  Node: ビルドならびに C API の変更<9>,  Next: Python 2 6 への移植,  Prev: 非推奨と削除,  Up: What's New in Python 2 6

1.17.20 ビルドならびに C API の変更
-----------------------------------

Python のビルド過程と C API の変更は以下の通りです:

   * Python now must be compiled with C89 compilers (after 19 years!).
     This means that the Python source tree has dropped its own
     implementations of ‘memmove()’ and ‘strerror()’, which are in the
     C89 standard library.

   * Python 2.6 は Microsoft Visual Studio 2008 (version 9.0) でビルド出
     来ます。そしてこれが新しいデフォルトコンパイラです。 ‘PCbuild’ ディ
     レクトリのビルドファイルを参照して下さい。 (Implemented by
     Christian Heimes.)

   * Mac OS X では、Python 2.6 は 4 種類のユニバーサルビルドでコンパイル
     出来ます。 ‘configure’ スクリプトは
     ‘--with-universal-archs=[32-bit|64-bit|all]’ スイッチを取って、
     32-bit アーキテクチャ (x86, PowerPC), 64-bit (x86-64 and PPC-64), あ
     るいは両方のバイナリをビルド出来ます。 (Contributed by Ronald
     Oussoren.)

   * A new function added in Python 2.6.6, ‘PySys_SetArgvEx()’, sets the
     value of ‘sys.argv’ and can optionally update ‘sys.path’ to include
     the directory containing the script named by ‘sys.argv[0]’
     depending on the value of an 'updatepath' parameter.

     This function was added to close a security hole for applications
     that embed Python.  The old function, ‘PySys_SetArgv()’, would
     always update ‘sys.path’, and sometimes it would add the current
     directory.  This meant that, if you ran an application embedding
     Python in a directory controlled by someone else, attackers could
     put a Trojan-horse module in the directory (say, a file named
     ‘os.py’) that your application would then import and run.

     If you maintain a C/C++ application that embeds Python, check
     whether you're calling ‘PySys_SetArgv()’ and carefully consider
     whether the application should be using ‘PySys_SetArgvEx()’ with
     'updatepath' set to false.  Note that using this function will
     break compatibility with Python versions 2.6.5 and earlier; if you
     have to continue working with earlier versions, you can leave the
     call to ‘PySys_SetArgv()’ alone and call
     ‘PyRun_SimpleString("sys.path.pop(0)\n")’ afterwards to discard the
     first ‘sys.path’ component.

     Security issue reported as CVE 2008-5983(1); discussed in
     gh-50003(2), and fixed by Antoine Pitrou.

   * BerkeleyDB モジュールが C API オブジェクトを公開しています。
     ‘bsddb.db.api’ として利用可能です。このモジュールは ‘bsddb’ モジュ
     ールを自身の独自の目的で使いたいほかの C 拡張で使えます。
     (Contributed by Duncan Grisby.)

   * *note PEP 3118 改訂版バッファプロトコル: 15ce. で前述の新しいバッフ
     ァインターフェイスのために、 *note PyObject_GetBuffer(): 63a. と
     *note PyBuffer_Release(): 63b. とほか少しの関数が追加されました。

   * Python's use of the C stdio library is now thread-safe, or at least
     as thread-safe as the underlying library is.  A long-standing
     potential bug occurred if one thread closed a file object while
     another thread was reading from or writing to the object.  In 2.6
     file objects have a reference count, manipulated by the
     ‘PyFile_IncUseCount()’ and ‘PyFile_DecUseCount()’ functions.  File
     objects can't be closed unless the reference count is zero.
     ‘PyFile_IncUseCount()’ should be called while the GIL is still
     held, before carrying out an I/O operation using the ‘FILE *’
     pointer, and ‘PyFile_DecUseCount()’ should be called immediately
     after the GIL is re-acquired.  (Contributed by Antoine Pitrou and
     Gregory P. Smith.)

   * 異なるスレッドから同時にモジュールをインポートすることでデッドロッ
     クが発生することはなくなりました; 今では *note ImportError: 65b. に
     なります。新たな API 関数 *note PyImport_ImportModuleNoBlock():
     3db. は最初に ‘sys.modules’ を探し、インポートロック獲得後にインポ
     ートしようと試みます。インポートロックが他のスレッドにより獲得され
     ていれば *note ImportError: 65b. が発生します。(Contributed by
     Christian Heimes.)

   * Several functions return information about the platform's
     floating-point support.  *note PyFloat_GetMax(): 1607. returns the
     maximum representable floating-point value, and *note
     PyFloat_GetMin(): 1608. returns the minimum positive value.  *note
     PyFloat_GetInfo(): 1609. returns an object containing more
     information from the ‘float.h’ file, such as ‘"mant_dig"’ (number
     of digits in the mantissa), ‘"epsilon"’ (smallest difference
     between 1.0 and the next largest value representable), and several
     others.  (Contributed by Christian Heimes; bpo-1534(3).)

   * *note PyComplex_AsCComplex(): 160a. を使う C 関数とメソッドが
     ‘__complex__()’ メソッドを持つ引数を受け付けるようになっています。
     特に、 *note cmath: 19. モジュールにある関数は、このメソッドを持つ
     オブジェクトを受け付けます。これは Python 3.0 での変更のバックポー
     トです。 (Contributed by Mark Dickinson; bpo-1675423(4).)

   * Python C API に 2 つの大文字小文字を区別しない文字列比較関数
     ‘PyOS_stricmp(char*, char*)’ と ‘PyOS_strnicmp(char*, char*,
     Py_ssize_t)’ が追加されました。 (Contributed by Christian Heimes;
     bpo-1635(5).)

   * 多くの C 拡張が、 ‘init*’ 関数内でモジュール辞書に整数と文字列定数
     を追加するために独自の小さなマクロを定義しています。 Python 2.6 で
     はついにモジュールに値を追加する標準マクロを定義しました。 *note
     PyModule_AddStringMacro: 160b. と *note PyModule_AddIntMacro():
     160c. です。 (Contributed by Christian Heimes.)

   * Some macros were renamed in both 3.0 and 2.6 to make it clearer
     that they are macros, not functions.  ‘Py_Size()’ became *note
     Py_SIZE(): 985, ‘Py_Type()’ became *note Py_TYPE(): 3c9, and
     ‘Py_Refcnt()’ became *note Py_REFCNT(): 2cf.  The mixed-case macros
     are still available in Python 2.6 for backward compatibility.
     (bpo-1629(6))

   * Distutils は C 拡張を、デバッグバージョンの Python 実行時に別のディ
     レクトリにビルドするようになりました。 (Contributed by Collin
     Winter; bpo-1530959(7).)

   * いくつかの基本データ型、例えば数値や文字列型は、あとで再利用される
     オブジェクトのフリーリスト(--訳注: メモリ管理での alloc/free の
     free。--)を内部的に管理しています。それらデータ構造はこのフリーリス
     トに関して、命名規約に従うようにしました; その変数名は常に
     ‘free_list’ 、カウンタは常に ‘numfree’ 、そしてマクロ
     ‘Py<typename>_MAXFREELIST’ が必ず定義されます。

   * 新たに追加された Makefile のターゲット "make patchcheck" は、Python
     ソースツリーに対してパッチを作る準備をします: 修正された ‘.py’ ファ
     イル全てに含まれる末尾の余分な空白を取り除き、ドキュメンテーション
     が変更されているかをチェックし、そして ‘Misc/ACKS’ と ‘Misc/NEWS’ が
     更新されているかどうかを報告します。 (Contributed by Brett Cannon.)

     もう一つの新しいターゲット "make profile-opt" は、GCC の
     profile-guided 最適化を使った Python バイナリをビルドします。これは
     Python をプロファイリングを有効にしてビルドし、プロファイル結果のセ
     ットを得るためのテストスイートを実施し、そして最適化のためにそれら
     結果を使ってビルドします。 (Contributed by Gregory P. Smith.)

* Menu:

* ポート特有の変更; Windows: ポート特有の変更 Windows<2>.
* ポート特有の変更; Mac OS X: ポート特有の変更 Mac OS X<2>.
* ポート特有の変更; IRIX: ポート特有の変更 IRIX.

   ---------- Footnotes ----------

   (1) https://www.cve.org/CVERecord?id=CVE-2008-5983

   (2) https://github.com/python/cpython/issues/50003

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1534

   (4) https://bugs.python.org/issue?@action=redirect&bpo=1675423

   (5) https://bugs.python.org/issue?@action=redirect&bpo=1635

   (6) https://bugs.python.org/issue?@action=redirect&bpo=1629

   (7) https://bugs.python.org/issue?@action=redirect&bpo=1530959


File: python.info,  Node: ポート特有の変更 Windows<2>,  Next: ポート特有の変更 Mac OS X<2>,  Up: ビルドならびに C API の変更<9>

1.17.20.1 ポート特有の変更: Windows
...................................

   * Windows 95, 98, ME, NT4 のサポートはとりやめられました。 Python 2.6
     は最低でも Windows 2000 SP4 が必要です。

   * Windows での新しいデフォルトコンパイラが Visual Studio 2008
     (version 9.0) になっています。Visual Studio 2003 (version 7.1) と
     2005 (version 8.0) のビルドディレクトリは PC/ に移動しました。新し
     い ‘PCbuild’ ディレクトリは X64, デバッグビルド、Profile Guided
     Optimization (PGO) をサポートしています。PGO ビルドは通常ビルドに較
     べておよそ 10% 高速化になります。 (Contributed by Christian Heimes
     with help from Amaury Forgeot d'Arc and Martin von Löwis.)

   * The *note msvcrt: 97. module now supports both the normal and wide
     char variants of the console I/O API. The *note getwch(): 160e.
     function reads a keypress and returns a Unicode value, as does the
     *note getwche(): 160f. function.  The *note putwch(): 1610.
     function takes a Unicode character and writes it to the console.
     (Contributed by Christian Heimes.)

   * *note os.path.expandvars(): 15f2. は "%var%" 形式を環境変数で置換し
     、 "~user" をユーザのホームディレクトリパスに置換します(--訳注: 上
     のほうの訳注参照。--)。 (Contributed by Josiah Carlson;
     bpo-957650(1).)

   * The *note socket: d1. module's socket objects now have an *note
     ioctl(): ece. method that provides a limited interface to the
     ‘WSAIoctl()’ system interface.

   * The *note _winreg: 11c. module now has a function, *note
     ExpandEnvironmentStrings(): 1611, that expands environment variable
     references such as ‘%NAME%’ in an input string.  The handle objects
     provided by this module now support the context protocol, so they
     can be used in *note with: 186. statements.  (Contributed by
     Christian Heimes.)

     *note _winreg: 11c. also has better support for x64 systems,
     exposing the *note DisableReflectionKey(): 157c, *note
     EnableReflectionKey(): 157d, and *note QueryReflectionKey(): 157e.
     functions, which enable and disable registry reflection for 32-bit
     processes running on 64-bit systems.  (bpo-1753245(2))

   * The ‘msilib’ module's ‘Record’ object gained ‘GetInteger()’ and
     ‘GetString()’ methods that return field values as an integer or a
     string.  (Contributed by Floris Bruynooghe; bpo-2125(3).)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=957650

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1753245

   (3) https://bugs.python.org/issue?@action=redirect&bpo=2125


File: python.info,  Node: ポート特有の変更 Mac OS X<2>,  Next: ポート特有の変更 IRIX,  Prev: ポート特有の変更 Windows<2>,  Up: ビルドならびに C API の変更<9>

1.17.20.2 ポート特有の変更: Mac OS X
....................................

   * Python をフレームワークビルドでコンパイルする際に、 ‘configure’ ス
     クリプトに ‘--with-framework-name’ オプションでフレームワーク名を指
     定出来るようになりました。

   * The ‘macfs’ module has been removed.  This in turn required the
     ‘macostools.touched()’ function to be removed because it depended
     on the ‘macfs’ module.  (bpo-1490190(1))

   * Many other Mac OS modules have been deprecated and will be removed
     in Python 3.0: ‘_builtinSuites’, ‘aepack’, ‘aetools’, ‘aetypes’,
     ‘applesingle’, ‘appletrawmain’, ‘appletrunner’, ‘argvemulator’,
     ‘Audio_mac’, ‘autoGIL’, ‘Carbon’, ‘cfmfile’, ‘CodeWarrior’,
     ‘ColorPicker’, ‘EasyDialogs’, ‘Explorer’, ‘Finder’, ‘FrameWork’,
     ‘findertools’, ‘ic’, ‘icglue’, ‘icopen’, ‘macerrors’, ‘MacOS’,
     ‘macfs’, ‘macostools’, ‘macresource’, ‘MiniAEFrame’, ‘Nav’,
     ‘Netscape’, ‘OSATerminology’, ‘pimp’, ‘PixMapWrapper’, ‘StdSuites’,
     ‘SystemEvents’, ‘Terminal’, and ‘terminalcommand’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1490190


File: python.info,  Node: ポート特有の変更 IRIX,  Prev: ポート特有の変更 Mac OS X<2>,  Up: ビルドならびに C API の変更<9>

1.17.20.3 ポート特有の変更: IRIX
................................

A number of old IRIX-specific modules were deprecated and will be
removed in Python 3.0: ‘al’ and ‘AL’, ‘cd’, ‘cddb’, ‘cdplayer’, ‘CL’ and
‘cl’, ‘DEVICE’, ‘ERRNO’, ‘FILE’, ‘FL’ and ‘fl’, ‘flp’, ‘fm’, ‘GET’,
‘GLWS’, ‘GL’ and ‘gl’, ‘IN’, ‘IOCTL’, ‘jpeg’, ‘panelparser’, ‘readcd’,
‘SV’ and ‘sv’, ‘torgb’, ‘videoreader’, and ‘WAIT’.


File: python.info,  Node: Python 2 6 への移植,  Next: 謝辞<2>,  Prev: ビルドならびに C API の変更<9>,  Up: What's New in Python 2 6

1.17.21 Python 2.6 への移植
---------------------------

このセクションでは前述の変更とバグフィックスにより必要となるかもしれない
コードの変更を列挙します:

   * ハッシュ化をサポートしないクラスはその定義内でその事実を示すために
     、 ‘__hash__ = None’ をセットすべきです。

   * 文字列を例外として送出することは出来なくなりました。これをすると
     *note TypeError: 198. を起こします。

   * *note collections.deque: 7f4. の ‘__init__()’ メソッドが、イテラブ
     ルから要素を追加する前に全ての deque の既存の内容をクリアするように
     なっています。この変更は ‘list.__init__()’ の振る舞いと一致します
     (--訳注: 当たり前のことにしか思えないのですが詳細がわかりません。こ
     れ以前のバージョンでは deque はシングルトンのように振舞っていたので
     しょうか。--)。

   * *note object.__init__(): 8bf. は以前は任意の引数とキーワード引数を
     受け取り、そして無視していました。Python 2.6 ではもうこれは許されま
     せん。 *note TypeError: 198. を起こします。これは結果的に *note
     object: c7e. の対応するメソッドを呼ぶ(おそらく *note super(): 1a6.
     を介して) ‘__init__()’ メソッドに影響します。 bpo-1683368(1) の議論
     を参照して下さい。

   * ‘Decimal’ のコンストラクタは今では先頭と末尾の空白が含まれる文字列
     を許容します。以前は ‘InvalidOperation’ となっていました。他方で、
     ‘Context’ オブジェクトの ‘create_decimal()’ メソッドは余分な空白を
     明示的に拒絶するようになり、 ‘ConversionSyntax’ を投げます。

   * 実装上の誤り(事故)で、ビルトインの *note __import__(): ad1. 関数に
     ファイルパスを渡すと指定したファイルをインポート出来ていました。し
     かしながらこれは決して意図した振る舞いではありませんでした。実装は
     今ではこのケースを明示的にチェックし、 *note ImportError: 65b. を起
     こします。

   * C API: *note PyImport_Import(): 1615. と *note
     PyImport_ImportModule(): 3dc. 関数がデフォルトで、相対インポートで
     はなく絶対インポートをするようになっています。これはほかのモジュー
     ルをインポートする C 拡張に影響します。

   * C API: ハッシュされるべきではない拡張データ型は、 ‘tp_hash’ スロッ
     トを *note PyObject_HashNotImplemented(): 15e0. と定義すべきです。

   * *note socket: d1. モジュールの例外 *note socket.error: 1261. が
     *note IOError: 125e. 派生になっています。以前は ‘StandardError’ の
     サブクラスではありませんでしたが今は *note IOError: 125e. を通じて
     それのサブクラスです。 (Implemented by Gregory P. Smith;
     bpo-1706815(2).)

   * The *note xmlrpclib: 134. module no longer automatically converts
     *note datetime.date: 1fa. and *note datetime.time: 1fb. to the
     *note xmlrpclib.DateTime: 15fc. type; the conversion semantics were
     not necessarily correct for all applications.  Code using
     ‘xmlrpclib’ should convert ‘date’ and *note time: 1fb. instances.
     (bpo-1330538(3))

   * (3.0 警告モード) *note Exception: bcd. クラスはスライスやインデクス
     アクセスで警告を出します; *note Exception: bcd. のタプルのような振
     る舞いはのちに取り除かれます。

   * (3.0 警告モード) 2 つの辞書や 2 つの比較メソッドを実装しないオブジ
     ェクトの不等号比較は警告されます。 ‘dict1 == dict2’ はまだ動作しま
     すが、 ‘dict1 < dict2’ はのちに取り除かれます。

     Python のスコープルールの実装の詳細であるセル間の比較も、警告を引き
     起こします。なぜならこれは、3.0 ではそのような比較は完全に禁止され
     ているからです。

Python を埋め込んだアプリケーションでは:

   * The ‘PySys_SetArgvEx()’ function was added in Python 2.6.6, letting
     applications close a security hole when the existing
     ‘PySys_SetArgv()’ function was used.  Check whether you're calling
     ‘PySys_SetArgv()’ and carefully consider whether the application
     should be using ‘PySys_SetArgvEx()’ with 'updatepath' set to false.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1683368

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1706815

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1330538


File: python.info,  Node: 謝辞<2>,  Prev: Python 2 6 への移植,  Up: What's New in Python 2 6

1.17.22 謝辞
------------

著者は提案の申し出や修正、様々なこの記事の草稿の助けをしてくれた以下の人
々に感謝します: Georg Brandl, Steve Brown, Nick Coghlan, Ralph Corderoy,
Jim Jewett, Kent Johnson, Chris Lambacher, Martin Michlmayr, Antoine
Pitrou, Brian Warner.


File: python.info,  Node: What's New in Python 2 5,  Next: What's New in Python 2 4,  Prev: What's New in Python 2 6,  Up: What's New in Python

1.18 What's New in Python 2.5
=============================


著者: A.M. Kuchling

This article explains the new features in Python 2.5.  The final release
of Python 2.5 is scheduled for August 2006; PEP 356(1) describes the
planned release schedule.  Python 2.5 was released on September 19,
2006.

The changes in Python 2.5 are an interesting mix of language and library
improvements.  The library enhancements will be more important to
Python's user community, I think, because several widely useful packages
were added.  New modules include ElementTree for XML processing
(‘xml.etree’), the SQLite database module (‘sqlite’), and the *note
ctypes: 2e. module for calling C functions.

言語の変更の意義は、中程度のものです。いくつかの心地よい機能が入りました
が、そのほとんどの機能は毎日使うというものでもありません。条件式
(conditional expressions)がついに言語に追加されました。ちょっと変わった
文法です。 *note PEP 308; 条件式 (Conditional Expressions): 161b. のセク
ションを参照してください。新しい '*note with: 186.' 文は後始末のコードを
書くのを簡単にします(*note PEP 343; "with" ステートメント: 161c. セクシ
ョン)。ジェネレータに値を返すことが出来るようになりました(*note PEP 342;
ジェネレータの新機能: 161d. セクション)。インポートが、絶対パス、相対パ
スのどちらかで可視に出来るようになりました(*note PEP 328;
絶対インポート、相対インポート: 161e. セクション)。例外ハンドリングのい
くつかの境界のケースで、より良いハンドリングを行えるようになりました
(*note PEP 341; try/except/finally の一体化: 161f. セクション)。これらの
どの改善も価値が高いですが、それらは言語機能を限定的に改善するものであっ
て、いずれも Python のセマンティクスを広範に修正するものではありません。

言語とライブラリの追加と同様に、ほかの改善とバグフィックスもソースツリー
全体に渡っています。SVN 変更ログを検索すると、Python 2.4 から 2.5 の間で
適用されたパッチは 353、フィックスされたバグは 458 ありました(ともに少な
く見積もってです)。

このドキュメントは新機能の完全な詳細を提供するのではなくて、変更について
、役に立つ実例を使った簡易な概要を提供することを目的にしています。完全な
詳細が知りたければ常に、 ‘https://docs.python.org’ の Python 2.6 のドキ
ュメントを参照すべきです。設計と実装の根拠を理解したい場合は、新機能に関
する PEP を参照してください。可能な限り、 "What’s New in Python" は各変
更の bug や patch に対してリンクしています。

このドキュメントについてのコメント、提案と誤りの報告は歓迎です。著者に電
子メールを送るか、または Python バグトラッカーにバグをあげてください。

* Menu:

* PEP 308; 条件式 (Conditional Expressions): PEP 308 条件式 Conditional Expressions.
* PEP 309; 関数の部分適用: PEP 309 関数の部分適用.
* PEP 314; Metadata for Python Software Packages v1.1: PEP 314 Metadata for Python Software Packages v1 1.
* PEP 328; 絶対インポート、相対インポート: PEP 328 絶対インポート、相対インポート.
* PEP 338 - モジュールをスクリプトとして実行する::
* PEP 341; try/except/finally の一体化: PEP 341 try/except/finally の一体化.
* PEP 342; ジェネレータの新機能: PEP 342 ジェネレータの新機能.
* PEP 343; "with" ステートメント: PEP 343 "with" ステートメント<2>.
* PEP 352; 例外の新スタイルクラス化: PEP 352 例外の新スタイルクラス化.
* PEP 353; 添え字型に ssize_t を使う: PEP 353 添え字型に ssize_t を使う.
* PEP 357; '__index__' メソッド: PEP 357 '__index__' メソッド.
* その他の言語変更: その他の言語変更<16>.
* 新たなモジュール、改良されたモジュール、削除されたモジュール::
* ビルドならびに C API の変更: ビルドならびに C API の変更<10>.
* Python 2.5 への移植: Python 2 5 への移植.
* 謝辞: 謝辞<3>.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0356/


File: python.info,  Node: PEP 308 条件式 Conditional Expressions,  Next: PEP 309 関数の部分適用,  Up: What's New in Python 2 5

1.18.1 PEP 308: 条件式 (Conditional Expressions)
------------------------------------------------

もう長いことずっと、人々は条件式を書くための手段を要望し続けてきました。
それは Boolean 値が真か偽かによって値 A または B を返す式です。条件式に
より以下と同じ効果を持つ単一行代入式を書くことが出来ます:

     if condition:
         x = true_value
     else:
         x = false_value

構文についての退屈で終わりのない議論が python-dev と comp.lang.python の
両方で続いてきました。投票では、大半は何らかの形で条件式を望んでいること
を示していましたが、明らかな過半数によって支持される構文はありませんでし
た。候補には C の ‘cond ? true_v : false_v’ や ‘if cond then true_v else
false_v’ を含む、ほか 16 のバリエーションがありました。

Guido van Rossum は結果として意外な構文を選択しました:

     x = true_value if condition else false_value

評価はこれでも既存の Boolean 式のように遅延的であり、評価順は少々前後し
ます。真ん中の 'condition' はまさに最初に評価されるのであって、
'true_value' 式はその 'condition' が真の場合にのみ評価されます。同じよう
に 'false_value' は 'condition' が偽の場合にのみ評価されるのです。

この構文は奇妙で退行しているようにも思えます; どうして condition が '真
ん中' にあって C の ‘c ? x : y’ のように前にないのでしょう?  この決定は
、標準ライブラリ内のモジュールにその新構文を適用し、結果のコードをどう読
むかを見ることでチェックされました。条件式が使われる多くの場合で、一つの
値はどうやら「一般の場合」で一つの値は「例外的な場合」のようで、条件を満
たさないことが稀な場合にのみ使われていました。条件の構文はこのパターンで
少しばかり明快さを増します:

     contents = ((doc + '\n') if doc else '')

私には上記ステートメントはこう読めます。「 'contents' は普通は
‘doc+'\n'’ の値に代入される。ただし時々 'doc' が空になる。その特別な場合
には空の値が代入されるのだ」。私は普通と普通でないのが明らかでない場合に
頻繁に条件式を使うとは思いません。

言語が条件式に括弧を必要とすべきかどうかに関していくつか議論がありました
。決定は Python 言語文法として括弧は '必要ない' とされましたが、スタイル
の問題としては私は常に括弧を付けるべきと思います。以下 2 つの例を考えて
みてください:

     # First version -- no parens
     level = 1 if logging else 0

     # Second version -- with parens
     level = (1 if logging else 0)

最初の版の場合、私は読者の目はおそらくステートメントを「level = 1」「if
logging」「else 0」にグループ化すると思います。そして condition は
'level' への代入が行われるのかどうかを決めるのだ、と考えるであろうと。後
者の版は読みやすいです、少なくとも私の意見では。代入はいつでも行われるこ
とも、選択が 2 つの値の間で起こることもはっきりしますから。

括弧を含めるもう一つの理由があります: 少し奇妙なリスト内包とラムダの組合
せが、不完全な条件式になることがあります。 PEP 308(1) にいくつかの例があ
るので見てください。条件式の周りをいつでも括弧で囲むなら、このケースにぶ
ち当たることもありません。

参考
....

PEP 308(2) - 条件式 (Conditional Expressions)

     PEP 著 Guido van Rossum と Raymond D. Hettinger; 実装 Thomas
     Wouters.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0308/

   (2) https://peps.python.org/pep-0308/


File: python.info,  Node: PEP 309 関数の部分適用,  Next: PEP 314 Metadata for Python Software Packages v1 1,  Prev: PEP 308 条件式 Conditional Expressions,  Up: What's New in Python 2 5

1.18.2 PEP 309: 関数の部分適用
------------------------------

*note functools: 63. モジュールは、関数型スタイルのプログラミングのため
のツールを含むことを意図したものです。

このモジュールには一つの有用なツールとして、 ‘partial()’ 関数があります
。関数型スタイルでプログラムを書くのに、あなたはときおり、いくつかのパラ
メータを持つ関数に一部パラメータを埋めたものを作りたくなります。Python 関
数 ‘f(a, b, c)’ を考えてみましょう; ‘f(1, b, c)’ と等価な ‘g(b, c)’ を作
れたら、と思うわけです。これは「関数の部分適用」と呼ばれています。

‘partial()’ は ‘(function, arg1, arg2, ... kwarg1=value1,
kwarg2=value2)’ という引数を取ります。できあがったオブジェクトは呼び出し
可能オブジェクトですので、それを呼べば、引数の埋まった 'function' を実行
したのと同じことになります。

以下にあるのは、小さいけれども現実的な一つの例です:

     import functools

     def log (message, subsystem):
         "Write the contents of 'message' to the specified subsystem."
         print '%s: %s' % (subsystem, message)
         ...

     server_log = functools.partial(log, subsystem='server')
     server_log('Unable to open socket')

もうひとつ、PyGTK を使うプログラムからの例をみてみましょう。いま、「コン
テキスト依存」のポップアップメニューを動的に構築しようとしています。その
メニューオプションから提供されるコールバックは、 ‘open_item()’ メソッド
の部分適用版で、その最初の引数が適用済みです:

     ...
     class Application:
         def open_item(self, path):
            ...
         def init (self):
             open_func = functools.partial(self.open_item, item_path)
             popup_menu.append( ("Open", open_func, 1) )

*note functools: 63. モジュールのもう一つの関数は
‘update_wrapper(wrapper, wrapped)’ で、より良く振舞うデコレータを書くの
に役立ちます。 ‘update_wrapper()’ は包まれるほうの名前、モジュール、ドキ
ュメンテーション文字列属性をラッパー関数にコピーすることで、トレースバッ
クを理解しやすくします。たとえばこう書けます:

     def my_decorator(f):
         def wrapper(*args, **kwds):
             print 'Calling decorated function'
             return f(*args, **kwds)
         functools.update_wrapper(wrapper, f)
         return wrapper

‘wraps()’ は、ラップされる関数についての情報をコピーするために、あなた自
身のデコレータ内で使えるデコレータです。先の例はこのようにも書けます:

     def my_decorator(f):
         @functools.wraps(f)
         def wrapper(*args, **kwds):
             print 'Calling decorated function'
             return f(*args, **kwds)
         return wrapper

参考
....

PEP 309(1) - 関数の部分適用

     PEP の提案と著: Peter Harris; 実装: Hye-Shik Chang と Nick Coghlan,
     また、適応物が Raymond Hettinger により。 (--訳注: この PEP のタイ
     トルに違和感を憶える人は多いと思います。functools のテリトリが「関
     数型スタイルのサポート」にあるのに。部分引数サポートのためのパッチ
     が最終的に関数型スタイルに行き着いた (正確には、「partial のような
     高階関数を置く場所として functools という場所を使いましょう、
     partial から始めましょう」というのが提案の趣旨)、という経緯がこのタ
     イトルに反映しています。--)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0309/


File: python.info,  Node: PEP 314 Metadata for Python Software Packages v1 1,  Next: PEP 328 絶対インポート、相対インポート,  Prev: PEP 309 関数の部分適用,  Up: What's New in Python 2 5

1.18.3 PEP 314: Metadata for Python Software Packages v1.1
----------------------------------------------------------

Distutils にいくつかの単純な依存性解決サポートが追加されました。
‘setup()’ 関数に ‘requires’, ‘provides’, ‘obsoletes’ キーワードパラメー
タが追加されています。 ‘sdist’ コマンドでソース配布物をビルドする際に、
依存性についての情報が ‘PKG-INFO’ ファイルに記録されます。

もう一つ追加されたキーワードパラメータ ‘download_url’ は、パッケージのソ
ースコードの URL をセットします。これによりパッケージインデクス内のエン
トリを探し出すことが出来、パッケージの依存性を決めることが出来、必要パッ
ケージをダウンロード出来ます:

     VERSION = '1.0'
     setup(name='PyPackage',
           version=VERSION,
           requires=['numarray', 'zlib (>=1.1.4)'],
           obsoletes=['OldPackage']
           download_url=('http://www.example.com/pypackage/dist/pkg-%s.tar.gz'
                         % VERSION),
          )

Python Package Index (‘https://pypi.org’) へのもう一つの新たな拡張は、パ
ッケージについてのソースコードとバイナリアーカイブの保存についてです。新
たな Distutils コマンド ‘upload’ は、レポジトリへパッケージをアップロー
ドします。

パッケージがアップロードされる前には、Distutils ‘sdist’ コマンドを使って
配布物をビルド可能でなければなりません。それさえ出来ていれば、 ‘python
setup.py upload’ がパッケージを PyPI アーカイブに追加してくれます。追加
で、パッケージに GPG 署名出来ます。これには ‘--sign’ オプションと
‘--identity’ オプションを使います。

パッケージのアップロードは Martin von Löwis と Richard Jones により実装
されました。

参考
....

PEP 314(1) - Metadata for Python Software Packages v1.1

     PEP 提案と著 A.M. Kuchling、 Richard Jones、 Fred Drake; 実装
     Richard Jones と Fred Drake.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0314/


File: python.info,  Node: PEP 328 絶対インポート、相対インポート,  Next: PEP 338 - モジュールをスクリプトとして実行する,  Prev: PEP 314 Metadata for Python Software Packages v1 1,  Up: What's New in Python 2 5

1.18.4 PEP 328: 絶対インポート、相対インポート
----------------------------------------------

The simpler part of PEP 328(1) was implemented in Python 2.4:
parentheses could now be used to enclose the names imported from a
module using the ‘from ... import ...’ statement, making it easier to
import many different names.

より複雑なほうは Python 2.5 で実装されました: モジュールのインポートにお
いて、それが絶対インポートなのかパッケージ相対のインポートなのかを指定出
来るようにする、というものです。将来のバージョンの Python では絶対インポ
ートをデフォルトにする方向に向かう予定です。

いま、あなたは以下のようなパッケージディレクトリを持っているとします:

     pkg/
     pkg/__init__.py
     pkg/main.py
     pkg/string.py

‘pkg’ パッケージがモジュール ‘pkg.main’ とサブモジュール ‘pkg.string’ を
持っています。

‘main.py’ のなかの人、になってみましょう。 ‘import string’ 文を実行する
と、何が起こるでしょうか?  Python 2.4 とそれ以前のバージョンでは、相対イ
ンポートとして実行するためにパッケージのディレクトリ内のものを最初に探し
、 ‘pkg/string.py’ を発見してそのファイル内容を ‘pkg.string’ モジュール
であるとしてインポートし、そのモジュールは ‘pkg.main’ モジュール内の名前
空間で、名前 ‘string’ に束縛されます。

よろしいでしょう。欲しいものが ‘pkg.string’ であるならば。ですが欲しいの
は Python 標準ライブラリモジュールの *note string: d8. なのだとしたら?
‘pkg.string’ を無視して標準モジュールを探す綺麗な方法はありません; 一般
的に、 ‘sys.modules’ の中身から探す必要がありました。これはちょっとばか
り美しくありません。Holger Krekel の ‘py.std’ パッケージは標準ライブラリ
からモジュールをインポートするのに ‘import py; py.std.string.join()’ と
、よりこぎれいな方法を与えてくれますが、そのパッケージは全ての Python イ
ンストレーションでの利用が可能にはなっていません。

相対インポートに頼ったコードを読むことは、より不明瞭でもあります。読者は
*note string: d8. と ‘pkg.string’ のどちらを使おうとしているのかについて
、混乱するだろうからです。Python ユーザはすぐに、彼らのパッケージのサブ
モジュール名が標準ライブラリモジュールの名前と被らないようにすることを学
びますが、あなたのサブモジュール名が将来のバージョンの Python に追加され
る新しいモジュールで使われる名前にならないようにすることは出来ません。

Python 2.5 では *note import: 7f8. の振る舞いを、 ‘from __future__
import absolute_import’ ディレクティブを使うことによって絶対インポートに
切り替えられます。この絶対インポートの振る舞いは将来バージョンの Python
でデフォルトになります(おそらく Python 2.7 で)。(訳注: ご承知のとおり
Python 2.7 でもこれはデフォルトとはなっていません。Python 3.x への移行の
ためにも 2.5 - 2.7 では ‘from __future__ import absolute_import’ を使う
べきです。) 絶対インポートをデフォルトにしてしまえば、 ‘import string’ は
いつでも標準ライブラリ版を見つけます。ユーザは可能な限り絶対インポートを
使い始めるべきで、あなたのコードでは ‘from pkg import string’ と書き始め
ることが望まれます。

相対インポートは、 ‘from ... import’ 形式を使う際にモジュール名の前にピ
リオドを付ければまだ可能です:

     # Import names from pkg.string
     from .string import name1, name2
     # Import pkg.string
     from . import string

これは現在のパッケージからの相対で *note string: d8. モジュールをインポ
ートしますので、 ‘pkg.main’ 内ではこれは、 'name1' と 'name2' を
‘pkg.string’ からインポートするでしょう。加えて、先行する複数ピリオドは
、現在のパッケージの親からの相対インポートを実行します。例えば、 ‘A.B.C’
モジュール内のコードはこのように出来ます:

     from . import D                 # Imports A.B.D
     from .. import E                # Imports A.E
     from ..F import G               # Imports A.F.G

このピリオドによる書き方は ‘import modname’ 形式のインポート文では使えず
、 ‘from ... import’ 形式でのみ使えます。

参考
....

PEP 328(2) - マルチラインインポートと、絶対/相対インポート

     PEP 著 Aahz; 実装 Thomas Wouters。

‘https://pylib.readthedocs.io/’

     Holger Krekel による py ライブラリで、 ‘py.std’ パッケージを含みま
     す。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0328/

   (2) https://peps.python.org/pep-0328/


File: python.info,  Node: PEP 338 - モジュールをスクリプトとして実行する,  Next: PEP 341 try/except/finally の一体化,  Prev: PEP 328 絶対インポート、相対インポート,  Up: What's New in Python 2 5

1.18.5 PEP 338 - モジュールをスクリプトとして実行する
-----------------------------------------------------

Python 2.4 で追加されたモジュールをスクリプトとして実行するための *note
-m: 23c. スイッチが、少し能力を高めました。Python インタプリタ内での C 実
装に代わり、これの実現には新しいモジュール *note runpy: c3. を使うように
なっています。

*note runpy: c3. モジュールはインポートのメカニズムをより洗練された方法
で実装しているので、今では ‘pychecker.checker’ のようにパッケージ内のモ
ジュールも実行出来ます。このモジュールは異なるインポートメカニズム、例え
ば *note zipimport: 138. モジュールもサポートします。このことにより、
‘sys.path’ に .zip アーカイブのパスを追加して、 *note -m: 23c. スイッチ
でアーカイブ内のコードを実行する、といったことも出来ます。

参考
....

PEP 338(1) - モジュールをスクリプトとして実行する

     PEP 著と実装 Nick Coghlan.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0338/


File: python.info,  Node: PEP 341 try/except/finally の一体化,  Next: PEP 342 ジェネレータの新機能,  Prev: PEP 338 - モジュールをスクリプトとして実行する,  Up: What's New in Python 2 5

1.18.6 PEP 341: try/except/finally の一体化
-------------------------------------------

Until Python 2.5, the *note try: 8f8. statement came in two flavours.
You could use a *note finally: 1b0. block to ensure that code is always
executed, or one or more *note except: 1ab. blocks to catch specific
exceptions.  You couldn't combine both ‘except’ blocks and a ‘finally’
block, because generating the right bytecode for the combined version
was complicated and it wasn't clear what the semantics of the combined
statement should be.

Guido van Rossum はいくらかの時間 Java での作業に時間を割きました。それ
は *note except: 1ab. ブロックと *note finally: 1b0. ブロックを組み合わ
せるのと等価なものをサポートしています。そしてこの作業が、このステートメ
ントがどういう意味であるべきかを明らかにしたのです。Python 2.5 では、あ
なたは今ではこう書くことが出来ます:

     try:
         block-1 ...
     except Exception1:
         handler-1 ...
     except Exception2:
         handler-2 ...
     else:
         else-block
     finally:
         final-block

'block-1' 内のコードが実行されます。そのコードが例外を投げた場合、個々の
*note except: 1ab. ブロックがテストされます: その例外が ‘Exception1’ ク
ラスであれば、 'handler-1' が実行されます; そうでない場合で ‘Exception2’
クラスであれば、 'handler-2' が実行されます、以下同文。例外が起こらなけ
れば、 'else-block' が実行されます。

以前に何が起こったのかに拠らず、コードブロック完了時やどれかの例外が処理
されれば 'final-block' が実行されます。例外ハンドラ内や 'else-block' で
エラーが起こったり、 新しく例外を投げる場合でさえ、 'final-block' 内のコ
ードはそれでも実行されます。

参考
....

PEP 341(1) - try-except と try-finally を一体化する

     PEP 著 Georg Brandl; 実装 Thomas Lee。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0341/


File: python.info,  Node: PEP 342 ジェネレータの新機能,  Next: PEP 343 "with" ステートメント<2>,  Prev: PEP 341 try/except/finally の一体化,  Up: What's New in Python 2 5

1.18.7 PEP 342: ジェネレータの新機能
------------------------------------

Python 2.5 は、ジェネレータ 'に向けて' 値を渡すための単純な手段を追加し
ました。Python 2.3 でジェネレータが導入された時点ではジェネレータが出来
たのは出力だけでした。いったんジェネレータのコードが呼び出されてイテレー
タが作られたあとは、新しい情報をそのジェネレータ関数の再開位置に渡す手段
はありませんでした。ヤクザな解決法としては、ジェネレータがグローバル変数
を見るようにしたり、ミュータブルなオブジェクトを渡しておいて呼び出し元で
あとからそれを変更したり、といったものがありました。

基本的なジェネレータについて思い出してもらいましょう、単純な例はこんなで
す:

     def counter (maximum):
         i = 0
         while i < maximum:
             yield i
             i += 1

When you call ‘counter(10)’, the result is an iterator that returns the
values from 0 up to 9.  On encountering the *note yield: bc2. statement,
the iterator returns the provided value and suspends the function's
execution, preserving the local variables.  Execution resumes on the
following call to the iterator's *note next(): 9d8. method, picking up
after the ‘yield’ statement.

In Python 2.3, *note yield: bc2. was a statement; it didn't return any
value.  In 2.5, ‘yield’ is now an expression, returning a value that can
be assigned to a variable or otherwise operated on:

     val = (yield i)

戻り値に何かする際は、 *note yield: bc2. 式の周りには括弧は付けておいた
ほうがいいと思います、この例でのように。括弧はべつに必要はないのですが、
どんな場合に必要かを憶えるよりは、いつでも付けるのが簡単でしょう。

( PEP 342(1) がその規則を正確に説明していますが、それによると *note
yield: bc2. 式は、代入式で右辺のトップレベルにあるとき以外はいつも括弧を
付ける必要があります。つまり ‘val = yield i’ とは書けますが、 ‘val =
(yield i) + 12’ のように演算子があるときは括弧を使わなくてはいけません。
)

Values are sent into a generator by calling its ‘send(value)’ method.
The generator's code is then resumed and the *note yield: bc2.
expression returns the specified 'value'.  If the regular *note next():
9d8. method is called, the ‘yield’ returns *note None: 885.

以下は前のと同じ例ですが、内部カウンタの値の変更を許す修正をしました:

     def counter (maximum):
         i = 0
         while i < maximum:
             val = (yield i)
             # If value provided, change counter
             if val is not None:
                 i = val
             else:
                 i += 1

そしてカウンタ変更の例がこちらです:

     >>> it = counter(10)
     >>> print it.next()
     0
     >>> print it.next()
     1
     >>> print it.send(8)
     8
     >>> print it.next()
     9
     >>> print it.next()
     Traceback (most recent call last):
       File "t.py", line 15, in ?
         print it.next()
     StopIteration

*note yield: bc2. が *note None: 885. を返すことはよくあるのですから、そ
うなっていないかどうか必ずチェックしておくべきです。ジェネレータ関数を再
開するために使うメソッドが ‘send()’ しかないのだと確信してるのでない限り
、式の値をそのまま使ってはいけません。

ジェネレータには、 ‘send()’ のほかにも新しいメソッドが二つあります

   * ‘throw(type, value=None, traceback=None)’ はジェネレータ内で例外を
     投げるために使います; その例外はジェネレータの実行が停止したところ
     の *note yield: bc2. 式によって投げられます。

   * ‘close()’ はジェネレータ内で *note GeneratorExit: 15e1. 例外を投げ
     てイテレートを終了させます。この例外を受け取ったジェネレータのコー
     ドは *note GeneratorExit: 15e1. か *note StopIteration: df5. を投げ
     なくてはいけません; この例外を捕捉して何かほかのことをしようとする
     のは規則違反であり、 *note RuntimeError: 244. を引き起こします; 関
     数が何かほかの例外を投げると、その例外は呼び出し元に伝播します。
     ‘close()’ はジェネレータのガーベージコレクトによっても呼ばれます。

     *note GeneratorExit: 15e1. が起こったときにクリーンアップ作業をする
     必要があるなら、 *note GeneratorExit: 15e1. を捕捉するのではなく
     ‘try: ... finaly:’ するようお勧めします。

これらの変更の合わせ技で、ジェネレータは情報の一方的な生産者から、生産者
かつ消費者という存在に変貌を遂げたのです。

ジェネレータは 'コルーチン' という、より一般化された形式のサブルーチンに
もなります。サブルーチンは一カ所 (関数の冒頭) から入って別の一カ所
(*note return: 1af. 文) から出るだけですが、コルーチンはいろいろな場所
(*note yield: bc2. 文) から入ったり出たり再開したりできるのです。わたし
たちは Python でコルーチンを効果的に使うためのパターンを理解する必要があ
ります。

The addition of the ‘close()’ method has one side effect that isn't
obvious.  ‘close()’ is called when a generator is garbage-collected, so
this means the generator's code gets one last chance to run before the
generator is destroyed.  This last chance means that ‘try...finally’
statements in generators can now be guaranteed to work; the *note
finally: 1b0. clause will now always get a chance to run.  The syntactic
restriction that you couldn't mix *note yield: bc2. statements with a
‘try...finally’ suite has therefore been removed.  This seems like a
minor bit of language trivia, but using generators and ‘try...finally’
is actually necessary in order to implement the *note with: 186.
statement described by PEP 343(2).  I'll look at this new statement in
the following section.

もう一つさらに深遠なこの変更の効果: 以前はジェネレータの ‘gi_frame’ 属性
は常にフレームオブジェクトでした。今では ‘gi_frame’ は、ジェネレータが使
い果たされた場合に ‘None’ になります。

参考
....

PEP 342(3) - 拡張されたジェネレータを用いたコルーチン

     PEP は Guido van Rossum と Phillip J. Eby によって書かれ、Phillip
     J.  Eby によって実装されました。コルーチンとしてのジェネレータの用
     法のいくつかの手が込んだ例が含まれています。

     この機能の初期バージョンは Raymond Hettinger による PEP 288(4) と
     Samuele Pedroni による PEP 325(5) で提案されました。

‘https://en.wikipedia.org/wiki/Coroutine’

     コルーチンに関する WikiPedia エントリ。

‘https://web.archive.org/web/20160321211320/http://www.sidhe.org/~dan/blog/archives/000178.html’

     Dan Sugalski による、Perl の視点からみたコルーチンの説明です。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0342/

   (2) https://peps.python.org/pep-0343/

   (3) https://peps.python.org/pep-0342/

   (4) https://peps.python.org/pep-0288/

   (5) https://peps.python.org/pep-0325/


File: python.info,  Node: PEP 343 "with" ステートメント<2>,  Next: PEP 352 例外の新スタイルクラス化,  Prev: PEP 342 ジェネレータの新機能,  Up: What's New in Python 2 5

1.18.8 PEP 343: "with" ステートメント
-------------------------------------

'*note with: 186.' ステートメントは、以前なら後片付けが実行されるのを確
実にするために ‘try...finally’ ブロックを使ったであろうようなコードを、
より単純明快にします。このセクションでは、このステートメントの普通の使い
方を説明します。続くセクションでは実装の詳細を調べ、このステートメントと
ともに使うためにオブジェクトをどうやって書けば良いかをお見せします。

'*note with: 186.' ステートメントは基本構造が以下となる新しい制御フロー
構造です:

     with expression [as variable]:
         with-block

The expression is evaluated, and it should result in an object that
supports the context management protocol (that is, has *note
__enter__(): 7e4. and *note __exit__(): 1518. methods.

The object's *note __enter__(): 7e4. is called before 'with-block' is
executed and therefore can run set-up code.  It also may return a value
that is bound to the name 'variable', if given.  (Note carefully that
'variable' is 'not' assigned the result of 'expression'.)

After execution of the 'with-block' is finished, the object's *note
__exit__(): 1518. method is called, even if the block raised an
exception, and can therefore run clean-up code.

Python 2.5 でこのステートメントを有効にするには、以下のディレクティブを
あなたのモジュールに追加する必要があります:

     from __future__ import with_statement

Python 2.6 ではこれは常に有効になります。

いくつかの Python 標準オブジェクトが既にコンテキスト管理プロトコルをサポ
ートしていて、 '*note with: 186.' とともに使えます。ファイルオブジェクト
がその一例です:

     with open('/etc/passwd', 'r') as f:
         for line in f:
             print line
             ... more processing code ...

このステートメントが実行し終わったあかつきには、 'f' のファイルオブジェ
クトは、たとえ *note for: 34a. ループが道半ばにして例外と成り果てても、
自動的にクローズされます。

     注釈: In this case, 'f' is the same object created by *note open():
     316, because *note __enter__(): 7e4. returns 'self'.

*note threading: f3. モジュールのロック・条件変数でも '*note with: 186.'
ステートメントの恩恵にあずかれます:

     lock = threading.Lock()
     with lock:
         # Critical section of code
         ...

ブロックが実行される前にロックが獲得されて、ブロックが完了するやいなや必
ず解放されます。

*note decimal: 3a. モジュール内の新しい ‘localcontext()’ 関数は現在の
decimal のコンテキスト (計算の望みの精度と丸め特性をカプセル化しています
) を保存しておいてあとで元に戻すのを簡単にしてくれます:

     from decimal import Decimal, Context, localcontext

     # Displays with default precision of 28 digits
     v = Decimal('578')
     print v.sqrt()

     with localcontext(Context(prec=16)):
         # All code in this block uses a precision of 16 digits.
         # The original context is restored on exiting the block.
         print v.sqrt()

* Menu:

* コンテキストマネージャを書く: コンテキストマネージャを書く<2>.
* contextlib モジュール: contextlib モジュール<2>.


File: python.info,  Node: コンテキストマネージャを書く<2>,  Next: contextlib モジュール<2>,  Up: PEP 343 "with" ステートメント<2>

1.18.8.1 コンテキストマネージャを書く
.....................................

中身を紐解いてみれば、 '*note with: 186.' ステートメントはけっこう入り組
んでいます。ほとんどの人にとっては、既存のオブジェクトを '‘with’' ととも
に使うだけのことでその詳細を知る必要は無いので、それで良いならこのセクシ
ョンの残りの部分は読み飛ばして結構です。新しいオブジェクトの作者は基礎と
なる実装の詳細について知る必要があるので、このまま読み進めるべきです。

コンテキスト管理プロトコルの高度な説明はこんなです:

   * The expression is evaluated and should result in an object called a
     "context manager".  The context manager must have *note
     __enter__(): 7e4. and *note __exit__(): 1518. methods.

   * The context manager's *note __enter__(): 7e4. method is called.
     The value returned is assigned to 'VAR'. If no ‘'as VAR'’ clause is
     present, the value is simply discarded.

   * 'BLOCK' 内のコードが実行されます。

   * 'BLOCK' が例外を起こした場合、コンテキストマネージャの ‘__exit__’ メ
     ソッドが 3 つの引数とともに呼び出されます。これは例外の詳細です
     (‘type, value, traceback’, これは *note sys.exc_info(): 89a. が返す
     値と同じで、例外が起こらなければ ‘None’ です)。そのメソッドの戻り値
     は例外を再送出するかどうかを制御します: 全ての偽の値ではその例外が
     再送出され、 ‘True’ では揉み消します。例外を揉み消すなど滅多なこと
     では欲しいと思わないでしょう。もしそうしてしまったら、 '*note with:
     186.' ステートメントを含んだコードの作者は何か間違ったことが起こっ
     たことに決して気付かないですから。

   * If 'BLOCK' didn't raise an exception, the *note __exit__(): 1518.
     method is still called, but 'type', 'value', and 'traceback' are
     all ‘None’.

例を通じて考えましょう。枝葉末節を含んだ完璧なコードを提示しようとは思い
ませんが、データベースのためにトランザクションをサポートするのに必要とな
るメソッドの書き方についてスケッチしてみようと思います。

(データベース用語に不慣れな方へ:データベースへの変更のセットは、トランザ
クションという単位でグループ化されています。トランザクションは「コミット
」される、その意味は、全ての変更がデータベースに書き込まれることです、も
しくは「ロールバック」される、この場合全ての変更が捨てられてデータベース
が変更されません、この 2 つのいずれかになりえます。詳しくはなにかデータ
ベースの著述を読んで下さい。)

データベース接続を表現するオブジェクトがあると仮定しましょう。私たちの目
標は、そのオブジェクトのユーザがこのように書けるようになることです:

     db_connection = DatabaseConnection()
     with db_connection as cursor:
         cursor.execute('insert into ...')
         cursor.execute('delete from ...')
         # ... more operations ...

トランザクションはブロック内のコードがつつがなく終了すればコミットし、例
外が発生すればロールバックすべきです。私が思い描いている
‘DatabaseConnection’ の基本的なインターフェイスはこんなです:

     class DatabaseConnection:
         # Database interface
         def cursor (self):
             "Returns a cursor object and starts a new transaction"
         def commit (self):
             "Commits current transaction"
         def rollback (self):
             "Rolls back current transaction"

The *note __enter__(): 7e4. method is pretty easy, having only to start
a new transaction.  For this application the resulting cursor object
would be a useful result, so the method will return it.  The user can
then add ‘as cursor’ to their '*note with: 186.' statement to bind the
cursor to a variable name.

     class DatabaseConnection:
         ...
         def __enter__ (self):
             # Code to start a new transaction
             cursor = self.cursor()
             return cursor

The *note __exit__(): 1518. method is the most complicated because it's
where most of the work has to be done.  The method has to check if an
exception occurred.  If there was no exception, the transaction is
committed.  The transaction is rolled back if there was an exception.

下記のコード内では実行がメソッドの末尾まで落ちていって、なのでデフォルト
の ‘None’ 返却になります。 ‘None’ は偽なので、例外は自動的に再送出されま
す。望むならもっと明示的に、コメントでマークした部分で *note return:
1af. 文を書いてもよろしいです:

     class DatabaseConnection:
         ...
         def __exit__ (self, type, value, tb):
             if tb is None:
                 # No exception, so commit
                 self.commit()
             else:
                 # Exception occurred, so rollback.
                 self.rollback()
                 # return False


File: python.info,  Node: contextlib モジュール<2>,  Prev: コンテキストマネージャを書く<2>,  Up: PEP 343 "with" ステートメント<2>

1.18.8.2 contextlib モジュール
..............................

新しい *note contextlib: 27. モジュールは、 '*note with: 186.' ステート
メントで使えるオブジェクトを書く際に便利ないくつかの関数とデコレータを提
供しています。

The decorator is called ‘contextmanager()’, and lets you write a single
generator function instead of defining a new class.  The generator
should yield exactly one value.  The code up to the *note yield: bc2.
will be executed as the *note __enter__(): 7e4. method, and the value
yielded will be the method's return value that will get bound to the
variable in the '*note with: 186.' statement's ‘as’ clause, if any.  The
code after the *note yield: bc2. will be executed in the *note
__exit__(): 1518. method.  Any exception raised in the block will be
raised by the ‘yield’ statement.

このデコレータを使って、前セクションの私たちのデータベースの例はこのよう
に書けます:

     from contextlib import contextmanager

     @contextmanager
     def db_transaction (connection):
         cursor = connection.cursor()
         try:
             yield cursor
         except:
             connection.rollback()
             raise
         else:
             connection.commit()

     db = DatabaseConnection()
     with db_transaction(db) as cursor:
         ...

*note contextlib: 27. モジュールには ‘nested(mgr1, mgr2, ...)’ 関数もあ
り、この関数はたくさんのコンテキストマネージャを組み合わせることができて
、入れ子の '*note with: 186.' を書く必要性をなくしてくれます。この例では
、単一の '‘with’' でデータベーストランザクション開始とスレッドのロック獲
得の両方をやってのけています:

     lock = threading.Lock()
     with nested (db_transaction(db), lock) as (cursor, locked):
         ...

最後になりますが、 ‘closing(object)’ 関数は 'object' をそのまま返して変
数に束縛出来るようにし、かつブロックの終了で、与えた引数が持つ
‘object.close’ を呼び出します:

     import urllib, sys
     from contextlib import closing

     with closing(urllib.urlopen('http://www.yahoo.com')) as f:
         for line in f:
             sys.stdout.write(line)

参考
....

PEP 343(1) - "with" ステートメント

     PEP は Guido van Rossum と Nick Coghlan によって書かれ、Mike Bland、
     Guido van Rossum、Neal Norwitz により実装されました。この PEP は
     '*note with: 186.' ステートメントによって生成されるコードを見せてく
     れるので、このステートメントがどうやって動作するのかを知るのに役立
     ちます。

*note contextlib: 27. モジュールについてのドキュメント。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0343/


File: python.info,  Node: PEP 352 例外の新スタイルクラス化,  Next: PEP 353 添え字型に ssize_t を使う,  Prev: PEP 343 "with" ステートメント<2>,  Up: What's New in Python 2 5

1.18.9 PEP 352: 例外の新スタイルクラス化
----------------------------------------

例外クラスは、今では旧スタイルクラスだけではなく新スタイルクラスになれま
す。組み込みの *note Exception: bcd. クラスと全ての標準組み込み例外
(*note NameError: 452, *note ValueError: 2ec, など) が今では新スタイルク
ラスです。

例外の継承階層が少し再編成されました。2.5 では継承関係はこのようになって
います (--訳注: 2.6 ではさらに GeneratorExit が Exception ではなく
BaseExceotion の直接の子になり、これは 3.x でも引き継がれています。--):

     BaseException       # New in Python 2.5
     |- KeyboardInterrupt
     |- SystemExit
     |- Exception
        |- (all other current built-in exceptions)

この再編成が行われたのは、人々がしばしばプログラムのエラーを示す例外すべ
てを捕捉したがるからです。 *note KeyboardInterrupt: bc5. と *note
SystemExit: f3c. はエラーではありませんが、普通は ‘Control’-‘C’ をユーザ
が叩いたか、コードが *note sys.exit(): 277. を呼び出したかのような明示的
なアクションを表します。剥き出しの ‘except:’ はまさに全ての例外を捕捉し
ますから、一般に、再送出のために *note KeyboardInterrupt: bc5. と *note
SystemExit: f3c. はリストする必要があります。お決まりのパターンはこんな
です:

     try:
         ...
     except (KeyboardInterrupt, SystemExit):
         raise
     except:
         # Log error...
         # Continue running program...

Python 2.5 では同じ結果を得るのにもう ‘except Exception’ と書いても良い
です。これは普通はエラーを示す例外全てを捕捉しつつも *note
KeyboardInterrupt: bc5. と *note SystemExit: f3c. は置き去りにします。無
論かつてまでのバージョン同様、剥き身の ‘except:’ は全例外を捕捉します。

Python 3.0 での目標は、例外として raise される全てのクラスが *note
BaseException: 7d6. からの、もしくは *note BaseException: 7d6. のある子
孫であることを要求することであり、Python 2.x シリーズの将来のリリースに
おいてはこの制約の強制を始めるかもしれません。ですからあなたの全ての例外
は、今からすぐに *note Exception: bcd. 派生にするのが肝要です。捕捉例外
を特定しない ‘except:’ は Python 3.0 から取り除かれるべきであることが提
案されていますが、Guido van Rossum はこれをどうするかまだ決めていません
。 (--訳注: 2.7 では raise は「新スタイルクラスであれば」 *note
BaseException: 7d6. 派生であることを要求されますが、旧スタイルクラスであ
ればなんでも許されてしまう点ではあまり変わっていません。これについての警
告は ‘-3’ などで受けることが出来ます。Python 3.0 でようやく全ての例外が
*note BaseException: 7d6. 派生であることが強制されるようになりました。 ま
た、 ‘except:’ は 3.4 でも残っています。--)

例外として文字列を ‘raise "Error occurred"’ として raise することは
Python 2.5 では非推奨であり警告を引き起こします。その目的は、あと少しの
リリースで文字列例外を削除することです。 (--訳注: 2.6 以降の What's New
では明示的に書かれてはいませんが、2.7 では警告ではなくエラーです。--)

参考
....

PEP 352(1) - 例外のためのスーパークラス

     PEP 著: Brett Cannon と Guido van Rossum; 実装: Brett Cannon.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0352/


File: python.info,  Node: PEP 353 添え字型に ssize_t を使う,  Next: PEP 357 '__index__' メソッド,  Prev: PEP 352 例外の新スタイルクラス化,  Up: What's New in Python 2 5

1.18.10 PEP 353: 添え字型に ssize_t を使う
------------------------------------------

A wide-ranging change to Python's C API, using a new *note Py_ssize_t:
c55. type definition instead of int, will permit the interpreter to
handle more data on 64-bit platforms.  This change doesn't affect
Python's capacity on 32-bit platforms.

Various pieces of the Python interpreter used C's int type to store
sizes or counts; for example, the number of items in a list or tuple
were stored in an int.  The C compilers for most 64-bit platforms still
define int as a 32-bit type, so that meant that lists could only hold up
to ‘2**31 - 1’ = 2147483647 items.  (There are actually a few different
programming models that 64-bit C compilers can use - see
‘https://unix.org/version2/whatsnew/lp64_wp.html’ for a discussion - but
the most commonly available model leaves int as 32 bits.)

2147483647 に要素数が制限されることは 32 ビットプラットフォームではあま
り重大でもありません。その長さ制限を喰らう前にメモリを使い果たすでしょう
から。それぞれのリストアイテムは、ポインタのための領域 (4 バイト) をアイ
テムを表現する *note PyObject: 5df. に余分に必要とします。2147483647*4 は
既に 32 ビットのアドレス空間が含められるバイト数を超えています。(--訳注:
意味不明。何か誤解があるような…?  4 バイトは 2147483647 (符号付きとして
2^31 - 1) でしょう。4 を掛ける説明なんかここでまったくされていない。なぜ
掛ける?  それと要素のインデクシングとアイテムの必要領域は議論には無関係
なのでは?--)

It's possible to address that much memory on a 64-bit platform, however.
The pointers for a list that size would only require 16 GiB of space, so
it's not unreasonable that Python programmers might construct lists that
large.  Therefore, the Python interpreter had to be changed to use some
type other than int, and this will be a 64-bit type on 64-bit platforms.
The change will cause incompatibilities on 64-bit machines, so it was
deemed worth making the transition now, while the number of 64-bit users
is still relatively small.  (In 5 or 10 years, we may 'all' be on 64-bit
machines, and the transition would be more painful then.)

この変更は C 拡張モジュールの著者に大変大きく影響します。Python 文字列と
リストやタプルのようなコンテナ型は、そのサイズを表すのに *note
Py_ssize_t: c55. を使うようになっています。 *note PyList_Size(): 1633. の
ような関数は *note Py_ssize_t: c55. を返します。拡張モジュール内のコード
では、ですので、ある程度の変数の *note Py_ssize_t: c55. への変更が必要で
しょう。

The *note PyArg_ParseTuple(): 3c1. and *note Py_BuildValue(): 3c2.
functions have a new conversion code, ‘n’, for *note Py_ssize_t: c55.
*note PyArg_ParseTuple(): 3c1.'s ‘s#’ and ‘t#’ still output int by
default, but you can define the macro ‘PY_SSIZE_T_CLEAN’ before
including ‘Python.h’ to make them return *note Py_ssize_t: c55.

PEP 353(1) には、拡張の著者が読んで学ぶべき 64 ビットプラットフォームサ
ポートについてのセクションがあります。

参考
....

PEP 353(2) - 添え字型に ssize_t を使う

     PEP 著と実装 Martin von Löwis.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0353/

   (2) https://peps.python.org/pep-0353/


File: python.info,  Node: PEP 357 '__index__' メソッド,  Next: その他の言語変更<16>,  Prev: PEP 353 添え字型に ssize_t を使う,  Up: What's New in Python 2 5

1.18.11 PEP 357: '__index__' メソッド
-------------------------------------

NumPy 開発者たちは、新しい特殊メソッド、 ‘__index__()’ を追加することに
よってしか解決できない問題を抱えていました。スライスの表現
‘[start:stop:step]’ を使う際、 'start', 'stop', 'step' は全て整数か長整
数でなければなりません。NumPy は様々な特殊化された整数型を持っていて、符
号なし、符号付きの 8、16、32、64 ビットに対応していますが、それらをスラ
イスの添え字に使う手段はありませんでした。

スライシングに既存の ‘__int__()’ メソッドをそのまま使うことは出来ません
。それらは整数への型変換を実装するのにも使われるからです。スライシングが
‘__int__()’ を使ったとすれば、浮動小数点数でさえスライスの添え字として使
うことが合法になりますが、それは明らかに望む振る舞いではありません。

その代わりに新しい特殊メソッド ‘__index__()’ が追加されました。これは引
数を取らずに、スライスの添え字として使われる整数を返します。例えば:

     class C:
         def __index__ (self):
             return self.value

戻り値は Python 整数または長整数でなければなりません。インタプリタは戻り
値が正しいかどうかをチェックし、要求に合わない場合に *note TypeError:
198. を送出します。

A corresponding *note nb_index: 1636. slot was added to the C-level
*note PyNumberMethods: 1637. structure to let C extensions implement
this protocol.  ‘PyNumber_Index(obj)’ can be used in extension code to
call the ‘__index__()’ function and retrieve its result.

参考
....

PEP 357(1) - スライシングのために任意のオブジェクトを使えるようにする

     PEP 著と実装 Travis Oliphant.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0357/


File: python.info,  Node: その他の言語変更<16>,  Next: 新たなモジュール、改良されたモジュール、削除されたモジュール,  Prev: PEP 357 '__index__' メソッド,  Up: What's New in Python 2 5

1.18.12 その他の言語変更
------------------------

以下が、Python 2.5 言語コアに加えられた全ての変更点です。

   * *note dict: 183. 型に新たなフックが追加されています。サブクラスが、
     辞書に含まれないキーに対してデフォルトを提供出来るようにするもので
     す。キーが見つからない場合、辞書の ‘__missing__(key)’ メソッドが呼
     ばれます。このフックは *note collections: 1e. モジュール内の新しい
     クラス ‘defaultdict’ で使われています。続く例は存在しないキーに対し
     てゼロを返す辞書を定義しています:

          class zerodict (dict):
              def __missing__ (self, key):
                  return 0

          d = zerodict({1:1, 2:2})
          print d[1], d[2]   # Prints 1, 2
          print d[3], d[4]   # Prints 0, 0

   * 8 ビット文字列、Unicode ともに、ありがちなユースケースを単純化する
     ‘partition(sep)’ と ‘rpartition(sep)’ が追加されました。

     文字列のスライスに使うために ‘find(S)’ メソッドを使ってインデクスを
     得るのだけれども、やりたいのはそのセパレータ(S)の前後の部分文字列を
     得ることだ、といったことはしょっちゅう必要になります。
     ‘partition(sep)’ はこのパターンのコードを、一撃、に圧縮してくれます
     。これはセパレータ前の部分文字列、セパレータ自身、セパレータ後の部
     分文字列の 3 要素タプルを返します。セパレータが含まれない場合は、返
     却値の最初の要素に文字列全体が、残り2つは空文字列で返ります。
     ‘rpartition(sep)’ もほぼ同じことをしますがセパレータの検索をお尻か
     ら始めます。 ‘r’ は逆順('reverse')を表します。

     いくつかの例です:

          >>> ('http://www.python.org').partition('://')
          ('http', '://', 'www.python.org')
          >>> ('file:/usr/share/doc/index.html').partition('://')
          ('file:/usr/share/doc/index.html', '', '')
          >>> (u'Subject: a quick question').partition(':')
          (u'Subject', u':', u' a quick question')
          >>> 'www.python.org'.rpartition('.')
          ('www.python', '.', 'org')
          >>> 'www.python.org'.rpartition(':')
          ('', '', 'www.python.org')

     (Implemented by Fredrik Lundh following a suggestion by Raymond
     Hettinger.)

   * 文字列型の ‘startswith()’ と ‘endswith()’ メソッドが、チェックされ
     る文字列のタプルを受け容れるようになりました:

          def is_image_file (filename):
              return filename.endswith(('.gif', '.jpg', '.tiff'))

     (Implemented by Georg Brandl following a suggestion by Tom Lynn.)

   * ビルトイン関数 *note min(): 110b. と *note max(): 110c. に、
     ‘sort()’ における ‘key’ に似たキーワード引数 ‘key’ が追加されました
     。このパラメータには関数を与えます。これは一つの引数を取り、リスト
     内の全ての値に対して呼び出されます; *note min(): 110b./*note max():
     110c. はこの関数を全要素に適用したもののなかでの最小値/最大値を返し
     ます。例えば、リスト中の最長の文字列を探すにはこのように出来ます:

          L = ['medium', 'longest', 'short']
          # Prints 'longest'
          print max(L, key=len)
          # Prints 'short', because lexicographically 'short' has the largest value
          print max(L)

     (Contributed by Steven Bethard and Raymond Hettinger.)

   * 2 つの新たなビルトイン関数 *note any(): 163a. と *note all(): 163b.
     は、イテレータがいくつか真を含むかどうかを評価します。 *note any():
     163a. はイテレータのいずれかが返す値が真と評価される場合に *note
     True: e07. を返し、そうでなければ *note False: d2b. を返します。
     *note all(): 163b. はイテレータが返す値の評価が真のみの場合に *note
     True: e07. を返します。 (Suggested by Guido van Rossum, and
     implemented by Raymond Hettinger.)

   * クラスの ‘__hash__()’ メソッドが返す値として、長整数と整数のどちら
     でも良くなりました。長整数が返されれば、その値のハッシュから取られ
     ます。以前のバージョンではこれは普通の整数であることが要求されてい
     ましたが、2.5 ではビルトイン関数 *note id(): 163c. が変更されて常に
     非負数が返り、ユーザはしばしば ‘__hash__()’ 内で ‘id(self)’ を使う
     ようです (これはお奨めしませんが)。 (--訳注: 不思議な論法で意味がわ
     かりません。id が非負を返すとなぜユーザは __hash__ の実装に使おうと
     するのか?  ユーザがそれをしてしまうのは単にデフォルト実装がそうだか
     ら、というだけではないかと思います。__cmp__, __eq__ が「身元」以外
     の意味を使って比較を行うならば、 __cmp__ で id を使うのはシンプルに
     「ダメ」でしょう。-)

   * モジュールのデフォルトエンコーディングが ASCII になりました(訳注:
     Python 3 からはデフォルトは utf-8 (PEP 3120))。8 ビット文字を含んで
     いるのにエンコーディング宣言がないモジュールが構文エラーになるよう
     になりました。Python 2.4 では構文エラーとはならず警告でした。モジュ
     ールのエンコーディングをする方法については PEP 263(1) を参照してく
     ださい; 例えば、ソースコードの先頭付近にこのような行を追加すること
     で出来ます:

          # -*- coding: latin1 -*-

   * Unicode 文字列とデフォルトの ASCII エンコーディングで Unicode に変
     換出来ない 8 ビット文字列との比較を試みると、新しい警告 *note
     UnicodeWarning: 163d. が引き起こされるようになっています。比較結果
     は偽です:

          >>> chr(128) == unichr(128)   # Can't convert chr(128) to Unicode
          __main__:1: UnicodeWarning: Unicode equal comparison failed
            to convert both arguments to Unicode - interpreting them
            as being unequal
          False
          >>> chr(127) == unichr(127)   # chr(127) can be converted
          True

     以前はこれは *note UnicodeDecodeError: c08. を起こしていましたので
     、2.5 でのこれは辞書のアクセス時に悩ましい問題をもたらしました。キ
     ーとして使われている ‘unichr(128)’ や ‘chr(128)’ を探そうとすると
     *note UnicodeDecodeError: c08. 例外が起こっていたでしょう。2.5 での
     、 辞書を実装している ‘dictobject.c’ のほかの変更により、これは揉み
     消すのではなく、引き続き例外を起こします(訳注: 原文では this
     exception といっているので *note UnicodeDecodeError: c08. が起こる
     ように読めるのですが、2.5 時点での振る舞いは確認出来ていませんが
     2.7 では *note UnicodeWarning: 163d. とともに *note KeyError: 5e7.
     が発生する、のようになるはずです。2.6 以降の What's New でのこれに
     関する言及はありませんが変更があったのかもしれません)。

     この種の比較で例外を起こすのは完全に正しいことではあるものの、その
     変更はコードを破壊するかもしれないので、必要に応じて警告に出来るよ
     う導入されたのが *note UnicodeWarning: 163d. です。

     (Implemented by Marc-André Lemburg.)

   * Python プログラマがよくしでかす間違いとして、パッケージディレクトリ
     に ‘__init__.py’ を入れ忘れる、というものがあります。この間違いのデ
     バッグはややこしく、大抵 Python を *note -v: 163e. スイッチ付きで起
     動して、パス検索全てをログ出力するハメになります。Python 2.5 ではパ
     ッケージディレクトリに ‘__init__.py’ がないことが検出されると新たに
     *note ImportWarning: 71e. 警告を出すようになりました。デフォルトで
     はこの警告は黙って無視されます; これを出したければ、 *note -Wd:
     ac6. スイッチをつけて Python を起動してください。(Implemented by
     Thomas Wouters.)

   * クラス定義において、基底クラスのリストを空リストに出来るようになっ
     ています(訳注: object を派生しないので結果として旧スタイルクラスに
     なります)。例えば以下は今や合法です:

          class C():
              pass

     (Implemented by Brett Cannon.)

* Menu:

* 対話的なインタプリタの変更::
* 最適化: 最適化<16>.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0263/


File: python.info,  Node: 対話的なインタプリタの変更,  Next: 最適化<16>,  Up: その他の言語変更<16>

1.18.12.1 対話的なインタプリタの変更
....................................

対話的なインタプリタ内では、 ‘quit’ と ‘exit’ はずっと、立ち去ろうと
(quit しようと)試みてそうタイプしてしまうユーザにとってある種有用な文字
列になっていました:

     >>> quit
     'Use Ctrl-D (i.e. EOF) to exit.'

Python 2.5 でも ‘quit’ と ‘exit’ はそれ自身そのような文字列を生成はしま
すが、同時に「呼び出す」ことが出来るオブジェクトになっています。初心者が
思わず ‘quit()’ や ‘exit()’ してしまった場合、今では彼らが期待する通りに
インタプリタが終了します。 (Implemented by Georg Brandl.)

Python 実行形式ファイルが標準的な長い形式の *note -help: 806. と *note
-version: f17. を受け付けるようになりました。Windows の場合はヘルプメッ
セージを出力するのに *note /?: 1641. オプションも受け付けます。
(Implemented by Georg Brandl.)


File: python.info,  Node: 最適化<16>,  Prev: 対話的なインタプリタの変更,  Up: その他の言語変更<16>

1.18.12.2 最適化
................

この最適化のいくつかは、2006年5月21日から28日にかけてアイスランドのレイ
キャビクで開催されたイベント、NeedForSpeed sprintで開発されました。この
スプリントはCPythonの実装のスピードアップに焦点を当て、EWT LLCが資金を提
供し、CCP Gamesが現地でサポートしました。 このスプリントで追加された最適
化については、以下のリストで特別にマークしています。

   * Python 2.4 が導入されたとき、組み込みの *note set: 184. と *note
     frozenset: 7f2. 型は Python の辞書型の上に構築されたものでした。
     Python 2.5 では、内部データ構造がセットを実装するためにカスタマイズ
     され、その結果、セットのメモリ使用量は3分の1になり、多少高速化され
     ました。(Raymond Hettinger による実装。)

   * 部分文字列の検索、文字列の分割、文字マップのエンコードとデコードな
     ど、いくつかの Unicode 操作の速度が改善されました。 (部分文字列の検
     索と分割は、NeedForSpeed スプリントで Fredrik Lundh と Andrew Dalke
     が追加しました。部分文字列の検索と分割の改良は、NeedForSpeed
     sprintでFredrik LundhとAndrew Dalkeによって追加されました。文字マッ
     プは Walter Dörwald と Martin von Löwis によって改善されました。)

   * The ‘long(str, base)’ function is now faster on long digit strings
     because fewer intermediate results are calculated.  The peak is for
     strings of around 800-1000 digits where the function is 6 times
     faster.  (Contributed by Alan McIntyre and committed at the
     NeedForSpeed sprint.)

   * It's now illegal to mix iterating over a file with ‘for line in
     file’ and calling the file object's ‘read()’/*note readline():
     bf./‘readlines()’ methods.  Iteration uses an internal buffer and
     the ‘read*()’ methods don't use that buffer.  Instead they would
     return the data following the buffer, causing the data to appear
     out of order.  Mixing iteration and these methods will now trigger
     a *note ValueError: 2ec. from the ‘read*()’ method.  (Implemented
     by Thomas Wouters.)

   * The *note struct: db. module now compiles structure format strings
     into an internal representation and caches this representation,
     yielding a 20% speedup.  (Contributed by Bob Ippolito at the
     NeedForSpeed sprint.)

   * *note re: be. モジュールは、システムの ‘malloc()’ と ‘free()’ の代
     わりに Python のアロケータ関数に切り替えることで、1～2%のスピードア
     ップを達成しました。(NeedForSpeed sprintにてJack Diederichによるコ
     ントリビュート)

   * コードジェネレータの peephole オプティマイザは式の中で簡単な定数の
     折りたたみを実行するようになりました。 ‘a = 2+3’ のように書くと、コ
     ードジェネレータは算術演算を行い、 ‘a = 5’ に対応するコードを生成し
     ます。 (Raymond Hettinger による提案と実装。)

   * Function calls are now faster because code objects now keep the
     most recently finished frame (a "zombie frame") in an internal
     field of the code object, reusing it the next time the code object
     is invoked.  (Original patch by Michael Hudson, modified by Armin
     Rigo and Richard Jones; committed at the NeedForSpeed sprint.)
     Frame objects are also slightly smaller, which may improve cache
     locality and reduce memory usage a bit.  (Contributed by Neal
     Norwitz.)

   * Python's built-in exceptions are now new-style classes, a change
     that speeds up instantiation considerably.  Exception handling in
     Python 2.5 is therefore about 30% faster than in 2.4.  (Contributed
     by Richard Jones, Georg Brandl and Sean Reifschneider at the
     NeedForSpeed sprint.)

   * Importing now caches the paths tried, recording whether they exist
     or not so that the interpreter makes fewer ‘open()’ and ‘stat()’
     calls on startup.  (Contributed by Martin von Löwis and Georg
     Brandl.)


File: python.info,  Node: 新たなモジュール、改良されたモジュール、削除されたモジュール,  Next: ビルドならびに C API の変更<10>,  Prev: その他の言語変更<16>,  Up: What's New in Python 2 5

1.18.13 新たなモジュール、改良されたモジュール、削除されたモジュール
--------------------------------------------------------------------

標準ライブラリは Python 2.5 で数多くの拡張とバグフィックスを行っています
。ここでは注目に値する変更をモジュール名の辞書順で列挙します。変更につい
てのもっと完全なリストが見たければソースツリーの ‘Misc/NEWS’ を調べるか
、全ての詳細について SVN ログに目を通してみてください。

   * The ‘audioop’ module now supports the a-LAW encoding, and the code
     for u-LAW encoding has been improved.  (Contributed by Lars
     Immisch.)

   * *note codecs: 1c. モジュールに漸増的コーデックのサポートが追加され
     ています。 ‘codec.lookup()’ 関数がタプルではなく ‘CodecInfo’ を返す
     ようになっています。 ‘CodecInfo’ のインスタンスは後方互換性を維持す
     るために 4 要素タプルのように振舞うだけでなく、属性 ‘encode’,
     ‘decode’, ‘incrementalencoder’, ‘incrementaldecoder’,
     ‘streamwriter’, ‘streamreader’ を持ちます。漸増的コーデックは入力を
     受け取って出力するのを複数チャンクに分けて行えます; 出力は非漸増的
     コーデックに一回で入力全体を渡したものと同じになります。詳細は
     *note codecs: 1c. モジュールのドキュメントを参照して下さい。
     (Designed and implemented by Walter Dörwald.)

   * *note collections: 1e. モジュールに新たに追加された ‘defaultdict’ 型
     は、標準 *note dict: 183. のサブクラスです。この新しい型はほとんど
     辞書と同じに振る舞い、ただし、キーを要求された際にそのキーが存在し
     ていなかった場合に、自動的に辞書にデフォルト値を追加します。

     ‘defaultdict’ のコンストラクタの最初の引数は、キーが要求されて存在
     しない場合に呼び出されるファクトリ関数です。ファクトリ関数は引数を
     取りません。つまりこれに該当する *note list(): 24d. や *note int():
     19b. のようなビルトイン型のコンストラクタも使えます。例えば、その頭
     文字を基準に語の索引をこのように作ることが出来ます:

          words = """Nel mezzo del cammin di nostra vita
          mi ritrovai per una selva oscura
          che la diritta via era smarrita""".lower().split()

          index = defaultdict(list)

          for w in words:
              init_letter = w[0]
              index[init_letter].append(w)

     ‘index’ を出力するとこんな具合です:

          defaultdict(<type 'list'>, {'c': ['cammin', 'che'], 'e': ['era'],
                  'd': ['del', 'di', 'diritta'], 'm': ['mezzo', 'mi'],
                  'l': ['la'], 'o': ['oscura'], 'n': ['nel', 'nostra'],
                  'p': ['per'], 's': ['selva', 'smarrita'],
                  'r': ['ritrovai'], 'u': ['una'], 'v': ['vita', 'via']}

     (Contributed by Guido van Rossum.)

   * *note collections: 1e. モジュールで提供されている両端キュー
     (double-ended queue) 型 ‘deque’ に、キュー内で最初に現れる 'value'
     を削除するメソッド ‘remove(value)’ メソッドが追加されています。
     'value' が見つからなければ *note ValueError: 2ec. が送出されます。
     (Contributed by Raymond Hettinger.)

   * 新規モジュール: *note contextlib: 27. モジュールには '*note with:
     186.' ステートメントで使えるヘルパ関数が含まれています。詳細は
     *note contextlib モジュール: 162d. をみてください。

   * 新規モジュール: *note cProfile: 2b. モジュールは既存の *note
     profile: b4. モジュールの C 実装で、遥かに小さなオーバヘッドで実行
     出来ます。モジュールのインターフェイスは *note profile: b4. と同じ
     です: 関数をプロファイルするのには ‘cProfile.run('main()')’ と実行
     し、プロファイル結果をファイルに書き出すなど出来ます。これは
     Hotshot プロファイラとして知られるものではないですが (これも C で書
     かれてますが *note profile: b4. モジュールのインターフェイスとは別
     物です)、将来バージョンの Python で保守が続けられる予定です。
     (Contributed by Armin Rigo.)

     また、プロファイラによる計測データの解析のための *note pstats: b5.
     モジュールが、 ‘Stats’ コンストラクタの 'stream' 引数による直接ファ
     イル出力に対応しました。 (Contributed by Skip Montanaro.)

   * The *note csv: 2d. module, which parses files in comma-separated
     value format, received several enhancements and a number of
     bugfixes.  You can now set the maximum size in bytes of a field by
     calling the ‘csv.field_size_limit(new_limit)’ function; omitting
     the 'new_limit' argument will return the currently set limit.  The
     ‘reader’ class now has a ‘line_num’ attribute that counts the
     number of physical lines read from the source; records can span
     multiple physical lines, so ‘line_num’ is not the same as the
     number of records read.

     CSV パーサは引用符内のマルチラインをより厳密に扱うようになっていま
     す。以前は、引用符で囲まれたフィールドが改行文字(newline)で終了する
     ことなく終端すると、改行文字が返却フィールドに追加されていました。
     この振る舞いはフィールドに復帰文字(carriage return)を含んだファイル
     を読み込む際に問題だったため、改行文字を挿入することなくフィールド
     を返すように変更されました。このことにより、フィールド内に埋め込ま
     れた改行文字が重要な場合、入力は改行文字が保存される方法で行分割さ
     れるはずです。(--訳注: リファレンスも含めこの説明の表現がわかりにく
     いです。行指向で読み込む場合改行コードのモード(NL, CR NL, CR)依存で
     「物理行が終了した」とみなされるわけですが、このモード依存(CR 時)の
     振る舞いがなくなった、ということです。--)

     (Contributed by Skip Montanaro and Andrew McNamara.)

   * The *note datetime: 4e2. class in the *note datetime: 34. module
     now has a ‘strptime(string, format)’ method for parsing date
     strings, contributed by Josh Spoerri.  It uses the same format
     characters as *note time.strptime(): 1646. and *note
     time.strftime(): 1402.:

          from datetime import datetime

          ts = datetime.strptime('10:13:15 2006-03-07',
                                 '%H:%M:%S %Y-%m-%d')

   * *note difflib: 3b. モジュールのメソッド
     ‘SequenceMatcher.get_matching_blocks()’ が、合致するサブシーケンス
     を記述するブロックについて、最小範囲リストを返すよう保障するように
     なりました。以前は時折 2 つのリストエントリに合致要素ブロックが分割
     されることがありました。(Enhancement by Tim Peters.)

   * *note doctest: 3e. モジュールに、実行されるべきものから例を守る
     ‘SKIP’ オプションが追加されています。これは、読者のための使用例とし
     て意図しているけれども実際のテストケースとして意図していないような
     コードスニペットのために用意されました。

     ‘testfile()’ 関数と ‘DocFileSuite’ にファイルのエンコーディングを指
     定するための 'encoding' パラメータが追加されました。これにより
     docstring 内に非 ASCII 文字列を含むテストが簡単になります。
     (Contributed by Bjorn Tillenius.)

   * *note email: 3f. パッケージがバージョン 4.0 にアップデートされまし
     た (Contributed by Barry Warsaw.)

   * The *note fileinput: 5f. module was made more flexible.  Unicode
     filenames are now supported, and a 'mode' parameter that defaults
     to ‘"r"’ was added to the *note input(): 14f0. function to allow
     opening files in binary or *note universal newlines: f35. mode.
     Another new parameter, 'openhook', lets you use a function other
     than *note open(): 316. to open the input files.  Once you're
     iterating over the set of files, the ‘FileInput’ object's new *note
     fileno(): 1647. returns the file descriptor for the currently
     opened file.  (Contributed by Georg Brandl.)

   * *note gc: 64. モジュールに、新しい関数 ‘get_count()’ が追加されてい
     ます。これは GC 3 世代についての現在の検出を含む 3 要素タプルを返し
     ます。これはガーベージコレクタの決算情報です; これらの数が指定され
     た閾値に到達すると、ガーベージコレクトのスイープが起こります。既存
     の *note gc.collect(): 1b3. 関数は省略可能な 'generation' 引数を取
     るようになっていて、これはどの世代を検出するかを指定する 0、1、2 で
     す。 (Contributed by Barry Warsaw.)

   * *note heapq: 6d. モジュールの ‘nsmallest()’ 関数と ‘nlargest()’ 関
     数がキーワードパラメータ ‘key’ をサポートするようになっています。こ
     れは *note min(): 110b./*note max(): 110c. 関数と ‘sort()’ メソッド
     で提供されているものと似たものです。例えば:

          >>> import heapq
          >>> L = ["short", 'medium', 'longest', 'longer still']
          >>> heapq.nsmallest(2, L)  # Return two lowest elements, lexicographically
          ['longer still', 'longest']
          >>> heapq.nsmallest(2, L, key=len)   # Return two shortest elements
          ['short', 'medium']

     (Contributed by Raymond Hettinger.)

   * *note itertools.islice(): d43. 関数が start と step として ‘None’ を
     受け付けるようになっています。これは slice オブジェクトとの互換性を
     高めるもので、つまり以下のように書くことが出来ます:

          s = slice(5)     # Create slice object
          itertools.islice(iterable, s.start, s.stop, s.step)

     (Contributed by Raymond Hettinger.)

   * *note locale: 8a. モジュールの *note format(): 199. 関数が更新され
     、2 つの関数 ‘format_string()’ と ‘currency()’ が追加されました。

     *note format(): 199. 関数の 'val' パラメータは以前は一つ以上の %文
     字指定子が現れる文字列が許されていました; 今はこのパラメータは正確
     に一つの %文字指定子を含む、周りに囲むテキストのない文字列でなけれ
     ばなりません。省略可能な 'monetary' パラメータも追加されています。
     これが ‘True’ の場合、通貨の書式化の 3 桁ごとに区切るセパレータに、
     ロケールのルールを使います。

     複数 %文字指定子を含む文字列をフォーマットするには、 *note
     format(): 199. のように働き、任意のテキストと %文字指定子を混ぜた文
     字列をサポートする新しい ‘format_string()’ 関数を使ってください。

     現在ロケール設定に関連した数字を書式化する ‘currency()’ 関数も追加
     されています。

     (Contributed by Georg Brandl.)

   * *note mailbox: 8f. モジュールでは、メールボックスについてそれを読む
     ことに加えて修正出来る能力を追加するための、大々的な書き換えが行わ
     れています。 ‘mbox’, ‘MH’, ‘Maildir’ を含む新しいクラス群はメールボ
     ックス読み込みに使われますが、メッセージ追加のための ‘add(message)’
     、削除の ‘remove(key)’ 、ロック/アンロックのための
     ‘lock()’/‘unlock()’ も持っています。続く例は maildir 形式から mbox
     形式に変換する例です:

          import mailbox

          # 'factory=None' uses email.Message.Message as the class representing
          # individual messages.
          src = mailbox.Maildir('maildir', factory=None)
          dest = mailbox.mbox('/tmp/mbox')

          for msg in src:
              dest.add(msg)

     (Contributed by Gregory K. Johnson.  Funding was provided by
     Google's 2005 Summer of Code.)

   * New module: the ‘msilib’ module allows creating Microsoft Installer
     ‘.msi’ files and CAB files.  Some support for reading the ‘.msi’
     database is also included.  (Contributed by Martin von Löwis.)

   * The ‘nis’ module now supports accessing domains other than the
     system default domain by supplying a 'domain' argument to the
     ‘nis.match()’ and ‘nis.maps()’ functions.  (Contributed by Ben
     Bell.)

   * *note operator: a3. モジュールの ‘itemgetter()’ 関数と
     ‘attrgetter()’ 関数が複数フィールドをサポートするようになりました。
     ‘operator.attrgetter('a', 'b')’ のように呼び出すと、 ‘a’ と ‘b’ 属
     性を取り出す関数を返します。この新機能と ‘sort()’ メソッドの ‘key’
     パラメータを組み合わせると、複数フィールドでのリストのソートが簡単
     になります。

   * *note optparse: a4. モジュールが Optik ライブラリのバージョン 1.5.1
     に更新されました。 ‘OptionParser’ クラスに ‘epilog’ 属性と
     ‘destroy()’ メソッドが追加されています。前者はヘルプメッセージのあ
     とに出力される文字列です。後者はオブジェクトによって作られた循環参
     照を破棄します。 (Contributed by Greg Ward.)

   * *note os: a5. モジュールに多数の変更がありました。
     ‘stat_float_times’ 値のデフォルトが真となっていて、これはつまり
     *note os.stat(): 26d. が時刻の値を浮動小数点数で返すということです
     。(ただし必ずしも *note os.stat(): 26d. が秒の端数が正確な値を返す
     という意味ではありません; 全てのシステムがそのような精度をサポート
     してはいません。)

     Constants named *note os.SEEK_SET: 14a5, *note os.SEEK_CUR: 14a6,
     and *note os.SEEK_END: 14a7. have been added; these are the
     parameters to the *note os.lseek(): 132f. function.  Two new
     constants for locking are *note os.O_SHLOCK: 1648. and *note
     os.O_EXLOCK: 1649.

     2 つの新しい関数 ‘wait3()’ と ‘wait4()’ が追加されています。これら
     は ‘waitpid()’ 関数に似ています。これは子プロセスが終了するのを待っ
     てプロセス ID とその終了コードを返しますが、 ‘wait3()’ と ‘wait4()’
     は追加の情報を返します。 ‘wait3()’ はプロセス ID を入力に取りません
     ので任意の子プロセス終了を待ち、 *note resource.getrusage(): 164a.
     関数から返る 'process-id', 'exit-status', 'resource-usage' の 3 要
     素タプルを返します。 ‘wait4(pid)’ はプロセス ID を取ります。
     (Contributed by Chad J. Schroeder.)

     FreeBSD では、 *note os.stat(): 26d. 関数がナノ秒精度の時刻を返し、
     また、返却オブジェクトが ‘st_gen’ と ‘st_birthtime’ を持つようにな
     っています。 ‘st_flags’ 属性も、プラットフォームがサポートされてい
     る場合には利用可能です。 (Contributed by Antti Louko and Diego
     Pettenò.)

   * *note pdb: aa. モジュールで提供される Python デバッガが、ブレイクポ
     イントに到達して実行が停止する際に実行するコマンドのリストを記憶す
     るようになりました。ブレイクポイント #1 を作ったら、 ‘commands 1’ を
     入力し、実行するコマンド群を入力し、 ‘end’ でリストを終えます。コマ
     ンドリストには ‘continue’ や ‘next’ のような実行再開コマンドを含め
     ることが出来ます。 (Contributed by Grégoire Dooms.)

   * The *note pickle: ab. and ‘cPickle’ modules no longer accept a
     return value of ‘None’ from the *note __reduce__(): bc6. method;
     the method must return a tuple of arguments instead.  The ability
     to return ‘None’ was deprecated in Python 2.4, so this completes
     the removal of the feature.

   * The *note pkgutil: ae. module, containing various utility functions
     for finding packages, was enhanced to support PEP 302(1)'s import
     hooks and now also works for packages stored in ZIP-format
     archives.  (Contributed by Phillip J. Eby.)

   * Marc-André Lemburg による pybench ベンチマークスイートが
     ‘Tools/pybench’ ディレクトリに含まれるようになりました。pybench ス
     イートは、広く使われている ‘pystone.py’ プログラムの改善版で、イン
     タプリタの速度についてのより詳しい計測を行います。 ‘pystone.py’ の
     ように多くの異なる演算を実行したり単独の数字に縮退する代わりに、こ
     れは関数コール、タプルのスライス、メソッドの検索、数値演算のような
     特定の演算を計測します。 (--訳注: Tools についての言及すべてに共通
     することですが、原則として Tools は「全て」を入手する手段はソースコ
     ード配布を利用することだけです。インストールされるものはプラットフ
     ォーム依存や linux であればディストリビュータによっても変わります。
     顕著なのは Windows で、Tools 配下のものはごく限られたものだけがイン
     ストールされます。pybench もソースコード配布物にのみ含まれ、Windows
     公式インストーラではインストールされません。なお、 ‘pystone.py’ は
     Lib/test 内にあります。--)

   * ‘pyexpat’ モジュールが使う Expat パーサをバージョン 2.0 にしました
     。 (Contributed by Trent Mick.)

   * The *note Queue: 15ac. class provided by the ‘Queue’ module gained
     two new methods.  ‘join()’ blocks until all items in the queue have
     been retrieved and all processing work on the items have been
     completed.  Worker threads call the other new method,
     ‘task_done()’, to signal that processing for an item has been
     completed.  (Contributed by Raymond Hettinger.)

   * 古い ‘regex’, ‘regsub’ モジュール、これは Python 2.0 からずっと非推
     奨になっていましたが、ついに削除されました。ほかにも、 ‘statcache’,
     ‘tzparse’, ‘whrandom’ が削除されています。

   * ‘dircmp’ や ‘ni’ といった石器時代のモジュールを大事にしまっていた
     ‘lib-old’ ディレクトリも削除されました。 ‘lib-old’ がデフォルトで
     ‘sys.path’ に含まれることはなかったので、あなたが明示的にそれを
     ‘sys.path’ に入れてこなかった限り、この削除はあなたには関係ないでし
     ょう。

   * *note rlcompleter: c2. モジュールが *note readline: bf. モジュール
     のインポートに依存しないようになりました。これにより非 Unix プラッ
     トフォームで動作するようになりました。 (Patch from Robert Kiendl.)

   * The *note SimpleXMLRPCServer: 135. and *note DocXMLRPCServer: 135.
     classes now have a ‘rpc_paths’ attribute that constrains XML-RPC
     operations to a limited set of URL paths; the default is to allow
     only ‘'/'’ and ‘'/RPC2'’.  Setting ‘rpc_paths’ to ‘None’ or an
     empty tuple disables this path checking.

   * The *note socket: d1. module now supports ‘AF_NETLINK’ sockets on
     Linux, thanks to a patch from Philippe Biondi.  Netlink sockets are
     a Linux-specific mechanism for communications between a user-space
     process and kernel code; an introductory article about them is at
     ‘https://www.linuxjournal.com/article/7356’.  In Python code,
     netlink addresses are represented as a tuple of 2 integers, ‘(pid,
     group_mask)’.

     ソケットオブジェクトの 2 つの新たなメソッド、 ‘recv_into(buffer)’,
     ‘recvfrom_into(buffer)’ は、受信データを、文字列データとして返す代
     わりにバッファプロトコルをサポートするオブジェクトに書き込みます。
     このことにより、受信データを直接 array やメモリマップドファイルに置
     けます。

     ソケットオブジェクトには ‘getfamily()’, ‘gettype()’, ‘getproto()’ ア
     クセッサメソッドも追加されています。それぞれソケットについてのアド
     レスファミリ、タイプ、プロトコルを取得します。

   * New module: the ‘spwd’ module provides functions for accessing the
     shadow password database on systems that support shadow passwords.

   * ‘pack()’, ‘unpack()’ メソッドでフォーマット文字列を ‘Struct’ オブジ
     ェクトにコンパイルすることで、 *note struct: db. がより高速になって
     います。これは *note re: be. モジュールでコンパイル済み正規表現オブ
     ジェクトを作れるのに似ています。モジュールレベルの ‘pack()’,
     ‘unpack()’ 関数もそのまま使えます; それらは ‘Struct’ オブジェクトを
     作ってキャッシュします。あるいは ‘Struct’ インスタンスを直接使えま
     す:

          s = struct.Struct('ih3s')

          data = s.pack(1972, 187, 'abc')
          year, number, name = s.unpack(data)

     You can also pack and unpack data to and from buffer objects
     directly using the ‘pack_into(buffer, offset, v1, v2, ...)’ and
     ‘unpack_from(buffer, offset)’ methods.  This lets you store data
     directly into an array or a memory-mapped file.

     (‘Struct’ objects were implemented by Bob Ippolito at the
     NeedForSpeed sprint.  Support for buffer objects was added by
     Martin Blais, also at the NeedForSpeed sprint.)

   * Python デベロッパは 2.5 開発プロセスの間で CVS から Subversion に移
     行しました。ビルドバージョンについての正確な情報は ‘sys.subversion’
     により取得可能で、これは 3 要素タプル ‘(interpreter-name,
     branch-name, revision-range)’ です。例えば執筆時点では 2.5 で
     ‘('CPython', 'trunk', '45313:45315')’ を返します。 (--訳注: Python
     3.2 から 3.3 にかけて、開発が Mercurial に移行していて、これは 2.7
     メンテナンスリリースの間にあたります。今(3.6 dev 時点)では全て
     Mercurial に移行しており、 ‘sys.subversion’ は今では意味のある値は
     返しません。3.3 からは既に ‘sys.subversion’ は削除されています。--)

     この情報は C 拡張から *note Py_GetBuildInfo(): 164b. 関数を使っても
     得ることが出来ます。これはビルド情報についての文字列を返し、例えば
     ‘"trunk:45355:45356M, Apr 13 2006, 07:42:19"’ のような値です。
     (Contributed by Barry Warsaw.)

   * もう一つの新規関数 *note sys._current_frames(): 164c. は、実行スレ
     ッドについての現在スタックフレームを、各スレッドの識別子がキーの辞
     書として返します。辞書の値は、関数が呼ばれた時点のそのスレッドで現
     在アクティブになっているスタックフレームの一番上です。(Contributed
     by Tim Peters.)

   * *note tarfile: e4. モジュールの ‘TarFile’ クラスに ‘extractall()’ メ
     ソッドが追加されました。アーカイブから全てのメンバをカレントディレ
     クトリに抽出します。抽出ターゲットとして別のディレクトリも指定でき
     ますし、アーカイブメンバのサブセットのみ解凍することも出来ます。

     ストリームモードで開く tarfile に使われる圧縮を、モード ‘'r|*'’ を
     使って自動で検出出来るようになっています。 (Contributed by Lars
     Gustäbel.)

   * *note threading: f3. モジュールで、新しいスレッドを作る際に使われる
     スタックサイズを設定出来るようになりました。 ‘stack_size([*size*])’
     関数は現在構成されているスタックサイズを返し、省略可能引数 'size' パ
     ラメータを与えると新しい値を設定します。全てのプラットフォームがス
     タックサイズ変更をサポートしているわけではなく、Windows、POSIX スレ
     ッド、OS/2 で可能です。 (Contributed by Andrew MacIntyre.)

   * The *note unicodedata: 10b. module has been updated to use version
     4.1.0 of the Unicode character database.  Version 3.2.0 is required
     by some specifications, so it's still available as *note
     unicodedata.ucd_3_2_0: 164d.

   * 新モジュール: *note uuid: 116. モジュールは RFC 4122(2) による UUID
     (universally unique identifiers) を生成します。その RFC ではいくつ
     かの異なる UUID のバージョンを定義しており、文字列から生成するもの
     、システム特性から生成するもの、純粋に乱数から生成するものがありま
     す。このモジュールでは ‘UUID’ クラスと ‘uuid1()’, ‘uuid3()’,
     ‘uuid4()’, ‘uuid5()’ 関数を持っていて、それら異なったバージョンの
     UUID を生成します。(UUID バージョン 2 は RFC 4122(3) にありませんの
     でこのモジュールにもないです)

          >>> import uuid
          >>> # make a UUID based on the host ID and current time
          >>> uuid.uuid1()
          UUID('a8098c1a-f86e-11da-bd1a-00112444be1e')

          >>> # make a UUID using an MD5 hash of a namespace UUID and a name
          >>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')
          UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')

          >>> # make a random UUID
          >>> uuid.uuid4()
          UUID('16fd2706-8baf-433b-82eb-8c7fada847da')

          >>> # make a UUID using a SHA-1 hash of a namespace UUID and a name
          >>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')
          UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')

     (Contributed by Ka-Ping Yee.)

   * *note weakref: 11a. モジュールの ‘WeakKeyDictionary’ 型と
     ‘WeakValueDictionary’ 型に、辞書内に含まれる弱参照を巡回する新たな
     メソッドが追加されています。 ‘iterkeyrefs()’ と ‘keyrefs()’ が
     ‘WeakKeyDictionary’ に追加され、 ‘itervaluerefs()’ と ‘valuerefs()’
     が ‘WeakValueDictionary’ に追加されました。(Contributed by Fred L.
     Drake, Jr.)

   * The *note webbrowser: 11b. module received a number of
     enhancements.  It's now usable as a script with ‘python -m
     webbrowser’, taking a URL as the argument; there are a number of
     switches to control the behaviour (‘-n’ for a new browser window,
     ‘-t’ for a new tab).  New module-level functions, ‘open_new()’ and
     ‘open_new_tab()’, were added to support this.  The module's *note
     open(): 316. function supports an additional feature, an
     'autoraise' parameter that signals whether to raise the open window
     when possible.  A number of additional browsers were added to the
     supported list such as Firefox, Opera, Konqueror, and elinks.
     (Contributed by Oleg Broytmann and Georg Brandl.)

   * The *note xmlrpclib: 134. module now supports returning *note
     datetime: 4e2. objects for the XML-RPC date type.  Supply
     ‘use_datetime=True’ to the *note loads(): 164e. function or the
     ‘Unmarshaller’ class to enable this feature.  (Contributed by Skip
     Montanaro.)

   * *note zipfile: 137. モジュールが ZIP64 バージョンのフォーマットをサ
     ポートしました。これで 4GiB を超える zip 書庫を作れ、4GiB を超える
     ファイルを書庫に含めることが出来ます。 (Contributed by Ronald
     Oussoren.)

   * *note zlib: 139. モジュールの ‘Compress’ , ‘Decompress’ オブジェク
     トが *note copy(): 29. メソッドをサポートするようになりました。オブ
     ジェクトの内部状態を複製して新しい ‘Compress’ あるいは ‘Decompress’
     オブジェクトを返します。 (Contributed by Chris AtLee.)

* Menu:

* ctypes パッケージ::
* ElementTree パッケージ::
* hashlib パッケージ::
* sqlite3 パッケージ::
* wsgiref パッケージ::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0302/

   (2) https://datatracker.ietf.org/doc/html/rfc4122.html

   (3) https://datatracker.ietf.org/doc/html/rfc4122.html


File: python.info,  Node: ctypes パッケージ,  Next: ElementTree パッケージ,  Up: 新たなモジュール、改良されたモジュール、削除されたモジュール

1.18.13.1 ctypes パッケージ
...........................

The *note ctypes: 2e. package, written by Thomas Heller, has been added
to the standard library.  *note ctypes: 2e. lets you call arbitrary
functions in shared libraries or DLLs.  Long-time users may remember the
‘dl’ module, which provides functions for loading shared libraries and
calling functions in them.  The *note ctypes: 2e. package is much
fancier.

シェアドライブラリや DLL をロードするには、 ‘CDLL’ クラスのインスタンス
を、その名前かパスを渡して構築します。構築したら、 ‘CDLL’ オブジェクトの
属性にアクセスすることで任意の関数呼び出しが出来ます:

     import ctypes

     libc = ctypes.CDLL('libc.so.6')
     result = libc.printf("Line of output\n")

Type constructors for the various C types are provided: ‘c_int()’,
‘c_float()’, ‘c_double()’, ‘c_char_p()’ (equivalent to char*), and so
forth.  Unlike Python's types, the C versions are all mutable; you can
assign to their ‘value’ attribute to change the wrapped value.  Python
integers and strings will be automatically converted to the
corresponding C types, but for other types you must call the correct
type constructor.  (And I mean 'must'; getting it wrong will often
result in the interpreter crashing with a segmentation fault.)

C 関数がメモリ領域を更新するものである場合、Python 文字列に ‘c_char_p()’
を使うべきではありません。 Python 文字列は *note immutable: 15b9. である
ことを前提としているからです; この規則を犯すことは頭を掻き毟るバグを引き
起こすでしょう。更新可能なメモリ領域が必要な場合は
‘create_string_buffer()’ を使います:

     s = "this is a string"
     buf = ctypes.create_string_buffer(s)
     libc.strfry(buf)

C 関数はデフォルトでは整数を返すと仮定されますが、関数オブジェクトの
‘restype’ 属性をセットすることでこれを変更出来ます:

     >>> libc.atof('2.71828')
     -1783957616
     >>> libc.atof.restype = ctypes.c_double
     >>> libc.atof('2.71828')
     2.71828

*note ctypes: 2e. also provides a wrapper for Python's C API as the
‘ctypes.pythonapi’ object.  This object does 'not' release the global
interpreter lock before calling a function, because the lock must be
held when calling into the interpreter's code.  There's a *note
py_object: 1f3. type constructor that will create a *note PyObject:
5df.* pointer.  A simple usage:

     import ctypes

     d = {}
     ctypes.pythonapi.PyObject_SetItem(ctypes.py_object(d),
               ctypes.py_object("abc"),  ctypes.py_object(1))
     # d is now {'abc', 1}.

Don't forget to use *note py_object(): 1f3.; if it's omitted you end up
with a segmentation fault.

*note ctypes: 2e. が周辺ライブラリとして登場してしばらく経ちますが、
*note ctypes: 2e. が存在していることに依存できないとなれば人々はまだハー
ドコードされた拡張モジュールを書いて配布します。 *note ctypes: 2e. が
Python 中核に含められた今、おそらく開発者たちは、拡張モジュールの代わり
に *note ctypes: 2e. を介してアクセスするライブラリの上に Python ラッパ
ーを書き始めるでしょう,

参考
....

‘https://web.archive.org/web/20180410025338/http://starship.python.net/crew/theller/ctypes/’

     The pre-stdlib ctypes web page, with a tutorial, reference, and
     FAQ.

*note ctypes: 2e. モジュールについてのドキュメント。


File: python.info,  Node: ElementTree パッケージ,  Next: hashlib パッケージ,  Prev: ctypes パッケージ,  Up: 新たなモジュール、改良されたモジュール、削除されたモジュール

1.18.13.2 ElementTree パッケージ
................................

XML 処理のための、Fredrik Lundh の ElementTree ライブラリのサブセットが
、標準ライブラリに ‘xml.etree’ として追加されました。利用可能なモジュー
ルは ElementTree 1.2.6 よりの ‘ElementTree’, ‘ElementPath’,
‘ElementInclude’ です。 C 実装 ‘cElementTree’ モジュールも含まれています
。

The rest of this section will provide a brief overview of using
ElementTree.  Full documentation for ElementTree is available at
‘https://web.archive.org/web/20201124024954/http://effbot.org/zone/element-index.htm’.

ElementTree は XML ドキュメントを、要素ノードのツリーとして表現します。
ドキュメントのテキストコンテントは ‘text’ 属性と ‘tail’ 属性に格納されま
す (これが ElementTree と Document Object Model (DOM) との一番大きな違い
です; DOM 内ではノードの数多くの型があります。 ‘TextNode’ はその一つです
。)

最も一般的に使う解析関数は ‘parse()’ です。これは (ファイル名が含まれる
とみなされる) 文字列またはファイルのようなオブジェクトを受け取って、
‘ElementTree’ インスタンスを返します:

     from xml.etree import ElementTree as ET

     tree = ET.parse('ex-1.xml')

     feed = urllib.urlopen(
               'http://planet.python.org/rss10.xml')
     tree = ET.parse(feed)

‘ElementTree’ インスタンスを手にしてしまえば、あとはルートの ‘Element’ ノ
ードを得るために ‘getroot()’ を呼び出せます。

文字列リテラルを受け取って (‘ElementTree’ ではなく) ‘Element’ ノードを返
す ‘XML()’ 関数 もあります。この関数を使えば、簡単に XML リテラルを使っ
て XML 断片からツリーを組み上げることが綺麗に出来ます:

     svg = ET.XML("""<svg width="10px" version="1.0">
                  </svg>""")
     svg.set('height', '320px')
     svg.append(elem1)

個々の XML 要素はいくつかの辞書のような、いくつかのリストのようなメソッ
ドをサポートしています。辞書的な操作は属性値のアクセスに使い、リスト的な
操作は子ノードのアクセスに使います。

演算                                結果
                                    
-------------------------------------------------------------------------------------
                                    
‘elem[n]’                           n 番目の子要素を返す。
                                    
                                    
‘elem[m:n]’                         m 番目から n 番目までの子要素を返す(--訳注: n
                                    は含まない--)。
                                    
                                    
‘len(elem)’                         子要素数を返す。
                                    
                                    
‘list(elem)’                        子要素のリストを返す。
                                    
                                    
‘elem.append(elem2)’                'elem2' を子として追加する。
                                    
                                    
‘elem.insert(index, elem2)’         指定された位置に 'elem2' を挿入する。
                                    
                                    
‘del elem[n]’                       n 番目の子要素を削除する。
                                    
                                    
‘elem.keys()’                       属性名のリストを返す。
                                    
                                    
‘elem.get(name)’                    属性 'name' の値を返す。
                                    
                                    
‘elem.set(name, value)’             属性 'name' に新しい値をセットする。
                                    
                                    
‘elem.attrib’                       属性を含んだ辞書を取り出す。
                                    
                                    
‘del elem.attrib[name]’             属性 'name' を削除する。
                                    

コメントと処理命令 (processing instruction=PI) も、 ‘Element’ ノードで表
現されます。ノードがコメントあるいは処理命令であるかをチェックするにはこ
のようにします:

     if elem.tag is ET.Comment:
         ...
     elif elem.tag is ET.ProcessingInstruction:
         ...

XML 出力を生成するには ‘ElementTree.write()’ メソッドを呼び出す必要があ
ります。 ‘parse()’ のように、文字列もしくはファイルのようなオブジェクト
を渡せます:

     # Encoding is US-ASCII
     tree.write('output.xml')

     # Encoding is UTF-8
     f = open('output.xml', 'w')
     tree.write(f, encoding='utf-8')

(警告: 出力に使われるデフォルトエンコーディングは ASCII です。一般的な
XML での作業では要素名に任意の Unicode 文字を含められるので、ASCII エン
コーディングはあまり役に立ちません。要素名に 127 より大きなどんな文字が
含まれても例外となりますので。ですから任意の Unicode 文字を扱うために
UTF-8 のようなエンコーディングを指定するのが吉です。)

このセクションでは ElementTree インターフェイスのほんの一部しか記載して
いません。さらに詳しい情報については、パッケージの公式ドキュメントを参照
して下さい。

参考
....

‘https://web.archive.org/web/20201124024954/http://effbot.org/zone/element-index.htm’

     ElementTree の公式ドキュメント


File: python.info,  Node: hashlib パッケージ,  Next: sqlite3 パッケージ,  Prev: ElementTree パッケージ,  Up: 新たなモジュール、改良されたモジュール、削除されたモジュール

1.18.13.3 hashlib パッケージ
............................

A new *note hashlib: 6c. module, written by Gregory P. Smith, has been
added to replace the ‘md5’ and ‘sha’ modules.  *note hashlib: 6c. adds
support for additional secure hashes (SHA-224, SHA-256, SHA-384, and
SHA-512).  When available, the module uses OpenSSL for fast platform
optimized implementations of algorithms.

The old ‘md5’ and ‘sha’ modules still exist as wrappers around hashlib
to preserve backwards compatibility.  The new module's interface is very
close to that of the old modules, but not identical.  The most
significant difference is that the constructor functions for creating
new hashing objects are named differently.

     # Old versions
     h = md5.md5()
     h = md5.new()

     # New version
     h = hashlib.md5()

     # Old versions
     h = sha.sha()
     h = sha.new()

     # New version
     h = hashlib.sha1()

     # Hash that weren't previously available
     h = hashlib.sha224()
     h = hashlib.sha256()
     h = hashlib.sha384()
     h = hashlib.sha512()

     # Alternative form
     h = hashlib.new('md5')          # Provide algorithm as a string

ハッシュオブジェクトを作ってしまえばあとはそのメソッドは以前と同じです:
‘update(string)’ は指定された文字列を現在のダイジェスト状態にハッシュ更
新し、 ‘digest()’ と ‘hexdigest()’ は結果のダイジェスト値をバイナリ文字
列・16進数表記文字列として返し、 *note copy(): 29. はダイジェスト状態を
複製して新たなハッシュオブジェクトを作ります。

参考
....

*note hashlib: 6c. モジュールについてのドキュメント。


File: python.info,  Node: sqlite3 パッケージ,  Next: wsgiref パッケージ,  Prev: hashlib パッケージ,  Up: 新たなモジュール、改良されたモジュール、削除されたモジュール

1.18.13.4 sqlite3 パッケージ
............................

The pysqlite module (‘https://www.pysqlite.org’), a wrapper for the
SQLite embedded database, has been added to the standard library under
the package name *note sqlite3: d4.

SQLite は、軽量なディスク上のデータベースを提供する C ライブラリです。別
のサーバプロセスを用意する必要なく、 SQL クエリー言語の非標準的な一種を
使用してデータベースにアクセスできます。一部のアプリケーションは内部デー
タ保存に SQLite を使えます。また、SQLite を使ってアプリケーションのプロ
トタイプを作り、その後そのコードを PostgreSQL や Oracle のような大規模デ
ータベースに移植するということも可能です。

pysqlite は Gerhard Häring によって書かれ、 PEP 249(1) に記述された
DB-API 2.0 仕様に準拠した SQL インターフェースを提供するものです。

ソースコードから Python をビルドする場合は注意してください。Python ソー
スツリーは SQLite コードを含まずラッパーモジュールのみを含んでいます。
Python ビルド前に SQLite ライブラリとヘッダをインストールする必要があり
ます。必要ヘッダが利用可能となっていればモジュールはビルドされます。

このモジュールを使うには、最初にデータベースを表す ‘Connection’ オブジェ
クトを作ります。ここではデータはファイル ‘/tmp/example’ に格納されている
ものとします。

     conn = sqlite3.connect('/tmp/example')

特別な名前である ‘:memory:’ を使うと RAM 上にデータベースを作ることもで
きます。

‘Connection’ があれば、 ‘Cursor’ オブジェクトを作りその ‘execute()’ メソ
ッドを呼んで SQL コマンドを実行することができます:

     c = conn.cursor()

     # Create table
     c.execute('''create table stocks
     (date text, trans text, symbol text,
      qty real, price real)''')

     # Insert a row of data
     c.execute("""insert into stocks
               values ('2006-01-05','BUY','RHAT',100,35.14)""")

たいてい、SQL 操作は Python 変数の値を使う必要があります。この時、クエリ
ーを Python の文字列操作を使って構築することは、安全とは言えないので、す
べきではありません。そのようなことをするとプログラムが SQL インジェクシ
ョン攻撃に対し脆弱になりかねません。

代わりに、DB-API のパラメータ割り当てを使います。 ‘?’ を変数の値を使いた
いところに埋めておきます。その上で、値のタプルをカーソルの ‘execute()’ メ
ソッドの第2引数として引き渡します。(他のデータベースモジュールでは変数の
場所を示すのに ‘%s’ や ‘:1’ などの異なった表記を用いることがあります。)
例を示します:

     # Never do this -- insecure!
     symbol = 'IBM'
     c.execute("... where symbol = '%s'" % symbol)

     # Do this instead
     t = (symbol,)
     c.execute('select * from stocks where symbol=?', t)

     # Larger example
     for t in (('2006-03-28', 'BUY', 'IBM', 1000, 45.00),
               ('2006-04-05', 'BUY', 'MSOFT', 1000, 72.00),
               ('2006-04-06', 'SELL', 'IBM', 500, 53.00),
              ):
         c.execute('insert into stocks values (?,?,?,?,?)', t)

SELECT 文を実行した後データを取得する方法は3つありどれを使っても構いませ
ん。一つはカーソルをイテレータ (*note iterator: 4c8.) として扱う、一つは
カーソルの ‘fetchone()’ メソッドを呼んで一致した内の一行を取得する、もう
一つは ‘fetchall()’ メソッドを呼んで一致した全ての行のリストとして受け取
る、という3つです。

以下の例ではイテレータの形を使います:

     >>> c = conn.cursor()
     >>> c.execute('select * from stocks order by price')
     >>> for row in c:
     ...    print row
     ...
     (u'2006-01-05', u'BUY', u'RHAT', 100, 35.140000000000001)
     (u'2006-03-28', u'BUY', u'IBM', 1000, 45.0)
     (u'2006-04-06', u'SELL', u'IBM', 500, 53.0)
     (u'2006-04-05', u'BUY', u'MSOFT', 1000, 72.0)
     >>>

SQLite でサポートされる SQL 方言についてもっと詳しく知りたければ、
‘http://www.sqlite.org’ を参照して下さい。

参考
....

‘https://www.pysqlite.org’

     pysqlite のウェブページ。

‘https://www.sqlite.org’

     SQLite のウェブページ。ここの文書ではサポートされる SQL 方言の文法
     と使えるデータ型を説明しています。

*note sqlite3: d4. モジュールについてのドキュメント。

PEP 249(2) - Database API Specification 2.0

     Marc-Andre Lemburg により書かれた PEP。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0249/

   (2) https://peps.python.org/pep-0249/


File: python.info,  Node: wsgiref パッケージ,  Prev: sqlite3 パッケージ,  Up: 新たなモジュール、改良されたモジュール、削除されたモジュール

1.18.13.5 wsgiref パッケージ
............................

Web Server Gateway Interface (WSGI) v1.0 は、 Web サーバと Python で記述
された Web アプリケーションとの標準インターフェースであり、 PEP 333(1) で
定義されています。 *note wsgiref: 11e. パッケージは WSGI 仕様のリファレ
ンス実装です。

パッケージには WSGI アプリケーションとして動作する基礎的な HTTP サーバが
含まれています; このサーバは製品ユースではないデバッグ目的に有用です。サ
ーバをセットアップするには僅か数行で済みます:

     from wsgiref import simple_server

     wsgi_app = ...

     host = ''
     port = 8000
     httpd = simple_server.make_server(host, port, wsgi_app)
     httpd.serve_forever()

参考
....

‘https://web.archive.org/web/20160331090247/http://wsgi.readthedocs.org/en/latest/’

     WSGI 関連のリソースについて集約しているウェブサイト。

PEP 333(2) - Python Web Server Gateway Interface v1.0

     PEP 著 Phillip J. Eby.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0333/

   (2) https://peps.python.org/pep-0333/


File: python.info,  Node: ビルドならびに C API の変更<10>,  Next: Python 2 5 への移植,  Prev: 新たなモジュール、改良されたモジュール、削除されたモジュール,  Up: What's New in Python 2 5

1.18.14 ビルドならびに C API の変更
-----------------------------------

Python のビルド過程と C API の変更は以下の通りです:

   * Python ソースツリーは CVS から Subversion に変換されました。この複
     雑な移行手続きは Martin von Löwis によって指揮されつつがなく遂行さ
     れました。この手続きは PEP 347(1) にて開発されました。

   * Coverity, a company that markets a source code analysis tool called
     Prevent, provided the results of their examination of the Python
     source code.  The analysis found about 60 bugs that were quickly
     fixed.  Many of the bugs were refcounting problems, often occurring
     in error-handling code.  See ‘https://scan.coverity.com’ for the
     statistics.

   * The largest change to the C API came from PEP 353(2), which
     modifies the interpreter to use a *note Py_ssize_t: c55. type
     definition instead of int.  See the earlier section *note PEP 353;
     添え字型に ssize_t を使う: 1631. for a discussion of this change.

   * The design of the bytecode compiler has changed a great deal, no
     longer generating bytecode by traversing the parse tree.  Instead
     the parse tree is converted to an abstract syntax tree (or AST),
     and it is the abstract syntax tree that's traversed to produce the
     bytecode.

     It's possible for Python code to obtain AST objects by using the
     *note compile(): 4b1. built-in and specifying ‘_ast.PyCF_ONLY_AST’
     as the value of the 'flags' parameter:

          from _ast import PyCF_ONLY_AST
          ast = compile("""a=0
          for i in range(10):
              a += i
          """, "<string>", 'exec', PyCF_ONLY_AST)

          assignment = ast.body[0]
          for_loop = ast.body[1]

     No official documentation has been written for the AST code yet,
     but PEP 339(3) discusses the design.  To start learning about the
     code, read the definition of the various AST nodes in
     ‘Parser/Python.asdl’.  A Python script reads this file and
     generates a set of C structure definitions in
     ‘Include/Python-ast.h’.  The ‘PyParser_ASTFromString()’ and
     ‘PyParser_ASTFromFile()’, defined in ‘Include/pythonrun.h’, take
     Python source as input and return the root of an AST representing
     the contents.  This AST can then be turned into a code object by
     ‘PyAST_Compile()’.  For more information, read the source code, and
     then ask questions on python-dev.

     The AST code was developed under Jeremy Hylton's management, and
     implemented by (in alphabetical order) Brett Cannon, Nick Coghlan,
     Grant Edwards, John Ehresman, Kurt Kaiser, Neal Norwitz, Tim
     Peters, Armin Rigo, and Neil Schemenauer, plus the participants in
     a number of AST sprints at conferences such as PyCon.

   * Evan Jones's patch to obmalloc, first described in a talk at PyCon
     DC 2005, was applied.  Python 2.4 allocated small objects in
     256K-sized arenas, but never freed arenas.  With this patch, Python
     will free arenas when they're empty.  The net effect is that on
     some platforms, when you allocate many objects, Python's memory
     usage may actually drop when you delete them and the memory may be
     returned to the operating system.  (Implemented by Evan Jones, and
     reworked by Tim Peters.)

     Note that this change means extension modules must be more careful
     when allocating memory.  Python's API has many different functions
     for allocating memory that are grouped into families.  For example,
     *note PyMem_Malloc(): e5f, *note PyMem_Realloc(): 1233, and *note
     PyMem_Free(): 165b. are one family that allocates raw memory, while
     *note PyObject_Malloc(): e62, *note PyObject_Realloc(): 165c, and
     *note PyObject_Free(): e60. are another family that's supposed to
     be used for creating Python objects.

     Previously these different families all reduced to the platform's
     ‘malloc()’ and ‘free()’ functions.  This meant it didn't matter if
     you got things wrong and allocated memory with the ‘PyMem’ function
     but freed it with the ‘PyObject’ function.  With 2.5's changes to
     obmalloc, these families now do different things and mismatches
     will probably result in a segfault.  You should carefully test your
     C extension modules with Python 2.5.

   * ビルトインの集合型のために公式の C API が作られました。新しく作るの
     には *note PySet_New(): 165d. か *note PyFrozenSet_New(): 165e. を
     、要素の追加には *note PySet_Add(): 165f. 、削除には *note
     PySet_Discard(): 1660. 、 *note PySet_Contains(): 1661. と *note
     PySet_Size(): 1662. で集合オブジェクトの状態を調べます。
     (Contributed by Raymond Hettinger.)

   * C コードから Python インタプリタの正確なリビジョンについての情報を
     取得出来るようになりました。 *note Py_GetBuildInfo(): 164b. 関数を
     呼び出すことでビルド情報についての文字列が ‘"trunk:45355:45356M,
     Apr 13 2006, 07:42:19"’ のように返ります。 (Contributed by Barry
     Warsaw.)

   * Two new macros can be used to indicate C functions that are local
     to the current file so that a faster calling convention can be
     used.  *note Py_LOCAL: 1663. declares the function as returning a
     value of the specified 'type' and uses a fast-calling qualifier.
     *note Py_LOCAL_INLINE: 1664. does the same thing and also requests
     the function be inlined.  If macro ‘PY_LOCAL_AGGRESSIVE’ is defined
     before ‘python.h’ is included, a set of more aggressive
     optimizations are enabled for the module; you should benchmark the
     results to find out if these optimizations actually make the code
     faster.  (Contributed by Fredrik Lundh at the NeedForSpeed sprint.)

   * ‘PyErr_NewException(name, base, dict)’ が 'base' 引数としてベースク
     ラスのタプルを受け付けるようになりました。 (Contributed by Georg
     Brandl.)

   * The ‘PyErr_Warn()’ function for issuing warnings is now deprecated
     in favour of ‘PyErr_WarnEx(category, message, stacklevel)’ which
     lets you specify the number of stack frames separating this
     function and the caller.  A 'stacklevel' of 1 is the function
     calling *note PyErr_WarnEx(): 1665, 2 is the function above that,
     and so forth.  (Added by Neal Norwitz.)

   * CPython は今でも C で書かれていますが、コードは C++ コンパイラでも
     エラーなしでコンパイル出来るようになりました。 (Implemented by
     Anthony Baxter, Martin von Löwis, Skip Montanaro.)

   * The ‘PyRange_New()’ function was removed.  It was never documented,
     never used in the core code, and had dangerously lax error
     checking.  In the unlikely case that your extensions were using it,
     you can replace it by something like the following:

          range = PyObject_CallFunction((PyObject*) &PyRange_Type, "lll",
                                        start, stop, step);

* Menu:

* ポート特有の変更::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0347/

   (2) https://peps.python.org/pep-0353/

   (3) https://peps.python.org/pep-0339/


File: python.info,  Node: ポート特有の変更,  Up: ビルドならびに C API の変更<10>

1.18.14.1 ポート特有の変更
..........................

   * MacOS X (10.3 以上): モジュールの動的ロードに、MacOS 固有の関数では
     なく ‘dlopen()’ 関数を使うようになりました。

   * MacOS X: an ‘--enable-universalsdk’ switch was added to the
     ‘configure’ script that compiles the interpreter as a universal
     binary able to run on both PowerPC and Intel processors.
     (Contributed by Ronald Oussoren; bpo-2573(1).)

   * Windows: ‘.dll’ はもはや拡張モジュールのファイル拡張子としてはサポ
     ートされません。これからは ‘.pyd’ だけが拡張モジュールとして検索さ
     れるファイル拡張子です。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=2573


File: python.info,  Node: Python 2 5 への移植,  Next: 謝辞<3>,  Prev: ビルドならびに C API の変更<10>,  Up: What's New in Python 2 5

1.18.15 Python 2.5 への移植
---------------------------

このセクションでは前述の変更により必要となるかもしれないコードの変更を列
挙します:

   * ASCII がモジュールのデフォルトエンコーディングになっています(訳注:
     Python 3 からはデフォルトは utf-8 (PEP 3120))。8 ビット文字を含んで
     いるのにエンコーディング宣言がないモジュールが構文エラーになるよう
     になりました。Python 2.4 では構文エラーとはならず警告でした。

   * 以前はジェネレータの ‘gi_frame’ 属性は常にフレームオブジェクトでし
     たが、 *note PEP 342; ジェネレータの新機能: 161d. で説明した PEP
     342(1) での変更により、 ‘gi_frame’ は ‘None’ になりえます。

   * Unicode 文字列とデフォルトの ASCII エンコーディングで Unicode に変
     換出来ない 8 ビット文字列との比較を試みると、新しい警告 *note
     UnicodeWarning: 163d. が引き起こされるようになっています。以前はそ
     のような比較では *note UnicodeDecodeError: c08. 例外を起こしていま
     した。

   * ライブラリ: *note csv: 2d. モジュールは引用符内のマルチラインをより
     厳密に扱うようになっています。フィールド内に改行を埋め込んでいるフ
     ァイルがある場合は、その入力は改行文字を残すやり方で行分解されるは
     ずです。

   * ライブラリ: *note locale: 8a. モジュールの *note format(): 199. 関
     数は、以前は %文字指定子が一つを超えてさえいなければ任意の文字列を
     受け付けていたかもしれませんが、Python 2.5 からは正確に一つの、ほか
     に周りをテキストで囲まれていない %文字指定子でなければなりません。

   * Library: The *note pickle: ab. and ‘cPickle’ modules no longer
     accept a return value of ‘None’ from the *note __reduce__(): bc6.
     method; the method must return a tuple of arguments instead.  The
     modules also no longer accept the deprecated 'bin' keyword
     parameter.

   * Library: The *note SimpleXMLRPCServer: 135. and *note
     DocXMLRPCServer: 135. classes now have a ‘rpc_paths’ attribute that
     constrains XML-RPC operations to a limited set of URL paths; the
     default is to allow only ‘'/'’ and ‘'/RPC2'’.  Setting ‘rpc_paths’
     to ‘None’ or an empty tuple disables this path checking.

   * C API: Many functions now use *note Py_ssize_t: c55. instead of int
     to allow processing more data on 64-bit machines.  Extension code
     may need to make the same change to avoid warnings and to support
     64-bit machines.  See the earlier section *note PEP 353; 添え字型に
     ssize_t を使う: 1631. for a discussion of this change.

   * C API: The obmalloc changes mean that you must be careful to not
     mix usage of the ‘PyMem_*’ and ‘PyObject_*’ families of functions.
     Memory allocated with one family's ‘*_Malloc’ must be freed with
     the corresponding family's ‘*_Free’ function.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0342/


File: python.info,  Node: 謝辞<3>,  Prev: Python 2 5 への移植,  Up: What's New in Python 2 5

1.18.16 謝辞
------------

The author would like to thank the following people for offering
suggestions, corrections and assistance with various drafts of this
article: Georg Brandl, Nick Coghlan, Phillip J. Eby, Lars Gustäbel,
Raymond Hettinger, Ralf W. Grosse-Kunstleve, Kent Johnson, Iain Lowe,
Martin von Löwis, Fredrik Lundh, Andrew McNamara, Skip Montanaro,
Gustavo Niemeyer, Paul Prescod, James Pryor, Mike Rovner, Scott Weikart,
Barry Warsaw, Thomas Wouters.


File: python.info,  Node: What's New in Python 2 4,  Next: What's New in Python 2 3,  Prev: What's New in Python 2 5,  Up: What's New in Python

1.19 What's New in Python 2.4
=============================


著者: A.M. Kuchling

この文書は 2005 年 3 月 30 日にリリースされた Python 2.4.1 の新機能につ
いて解説します。

Python 2.4 は、真ん中サイズ、のリリースです。急進的だった Python 2.2 ほ
どには多くの変更をしていませんが、保守的だった 2.3 よりは多くの機能を導
入しています。新しい言語機能で最も重要なのが、関数デコレータとジェネレー
タ式です。ほかのほとんどの変更は標準ライブラリに対するものです。

Python 2.3 から 2.4 の CVS 変更ログによれば、適用されたパッチは 481、フ
ィックスされたバグは 502 ありました。ともに、少なく見積もって、です。

このドキュメントは個々の新機能の完全な詳細を提供するのではなくて、簡易な
概要を提供することを目的にしています。完全な詳細が知りたければ、 Python
ライブラリリファレンス、Python リファレンスマニュアルのような Python 2.4
のドキュメントを参照してください。多くの場合個別の新機能についての実装の
説明やデザインの根拠については PEP に託されています。

* Menu:

* PEP 218; ビルトインの集合オブジェクト: PEP 218 ビルトインの集合オブジェクト.
* PEP 237; 長整数と整数を一体化していく: PEP 237 長整数と整数を一体化していく.
* PEP 289; ジェネレータ式: PEP 289 ジェネレータ式.
* PEP 292; より単純な文字列置換 (string substitution): PEP 292 より単純な文字列置換 string substitution.
* PEP 318; 関数とメソッドのためのデコレータ: PEP 318 関数とメソッドのためのデコレータ.
* PEP 322; 逆順のイテレーション: PEP 322 逆順のイテレーション.
* PEP 324; 新しい subprocess モジュール: PEP 324 新しい subprocess モジュール.
* PEP 327; Decimal データ型: PEP 327 Decimal データ型.
* PEP 328; マルチラインインポート: PEP 328 マルチラインインポート.
* PEP 331; Locale に依存しない Float/String 変換: PEP 331 Locale に依存しない Float/String 変換.
* その他の言語変更: その他の言語変更<17>.
* 新たなモジュール、改良されたモジュール、非推奨のモジュール: 新たなモジュール、改良されたモジュール、非推奨のモジュール<3>.
* ビルドならびに C API の変更: ビルドならびに C API の変更<11>.
* Python 2.4 への移植: Python 2 4 への移植.
* 謝辞: 謝辞<4>.


File: python.info,  Node: PEP 218 ビルトインの集合オブジェクト,  Next: PEP 237 長整数と整数を一体化していく,  Up: What's New in Python 2 4

1.19.1 PEP 218: ビルトインの集合オブジェクト
--------------------------------------------

Python 2.3 では ‘sets’ モジュールを導入しました。集合データ型の C 実装が
Python コアに新たに、2 つの新しいビルトイン型 ‘set(iterable)’ と
‘frozenset(iterable)’ として追加されています。これらは要素が集合に属して
いるかのメンバシップテスト、シーケンスからの重複の削除、それに和集合
(union)、共通集合 (intersection)、 差 (difference)、対称差 (symmetric
difference) といった数学演算を高速に行います:

     >>> a = set('abracadabra')              # form a set from a string
     >>> 'z' in a                            # fast membership testing
     False
     >>> a                                   # unique letters in a
     set(['a', 'r', 'b', 'c', 'd'])
     >>> ''.join(a)                          # convert back into a string
     'arbcd'

     >>> b = set('alacazam')                 # form a second set
     >>> a - b                               # letters in a but not in b
     set(['r', 'd', 'b'])
     >>> a | b                               # letters in either a or b
     set(['a', 'c', 'r', 'd', 'b', 'm', 'z', 'l'])
     >>> a & b                               # letters in both a and b
     set(['a', 'c'])
     >>> a ^ b                               # letters in a or b but not both
     set(['r', 'd', 'b', 'm', 'z', 'l'])

     >>> a.add('z')                          # add a new element
     >>> a.update('wxy')                     # add multiple new elements
     >>> a
     set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'x', 'z'])
     >>> a.remove('x')                       # take one element out
     >>> a
     set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'z'])

*note frozenset(): 7f2. 型は *note set(): 184. の *note immutable: 15b9.
版です。 immutable かつハッシュ可能なので、辞書のキーやほかの set のメン
バとして使えるでしょう。

2.3 で追加された ‘sets’ モジュールは標準ライブラリに残されていて、 ‘Set’
や ‘ImmutableSet’ をサブクラス化したければ便利かもしれません。今のところ
これを撤廃する予定はありません。(--訳注: ‘sets’ モジュールは 2.6 で非推
奨となっています。--)

参考
....

PEP 218(1) - 集合オブジェクト型をビルトインに追加する

     元々は Greg Wilson によって提案され、完全な実装は Raymond Hettinger
     によってなされました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0218/


File: python.info,  Node: PEP 237 長整数と整数を一体化していく,  Next: PEP 289 ジェネレータ式,  Prev: PEP 218 ビルトインの集合オブジェクト,  Up: What's New in Python 2 4

1.19.2 PEP 237: 長整数と整数を一体化していく
--------------------------------------------

この PEP の非常に長期に渡る移行は Python 2.2 に始まり、Python 2.4 でさら
にもう一歩前進しています。2.3 では int/long の一体化後に異なる振る舞いを
する整数演算をすると *note FutureWarning: 659. 警告を出して、結果の値は
(プラットフォーム依存で) 32 ビットまたは 64 ビットに制限していました。
2.4 ではこれらの式はもう警告は出さず、代わりにいつでも(2.3 とは違った)長
整数となる結果をはじき出します。

問題を起こしうる式は主として左シフトで、そして長い 16 進リテラルと 8 進
リテラルです。例えば ‘2 << 32’ は 2.3 では警告とともに 32 ビットプラット
フォームでは結果は 0 になります。Python 2.4 ではこの式は正しい答えの
8589934592 になります。

参考
....

PEP 237(1) - 長整数と整数を一体化していく

     オリジナルの PEP は Moshe Zadka と GvR (Guido van Rossum) によって
     書かれました。.2.4 での変更については Kalle Svensson によって実装さ
     れました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0237/


File: python.info,  Node: PEP 289 ジェネレータ式,  Next: PEP 292 より単純な文字列置換 string substitution,  Prev: PEP 237 長整数と整数を一体化していく,  Up: What's New in Python 2 4

1.19.3 PEP 289: ジェネレータ式
------------------------------

The iterator feature introduced in Python 2.2 and the *note itertools:
85. module make it easier to write programs that loop through large data
sets without having the entire data set in memory at one time.  List
comprehensions don't fit into this picture very well because they
produce a Python list object containing all of the items.  This
unavoidably pulls all of the objects into memory, which can be a problem
if your data set is very large.  When trying to write a functionally
styled program, it would be natural to write something like:

     links = [link for link in get_all_links() if not link.followed]
     for link in links:
         ...

こうではなく

     for link in get_all_links():
         if link.followed:
             continue
         ...

最初の形の方が簡潔でおそらく読みやすいですが、扱っているのがとても多くの
リンクオブジェクトであるならば、全てのリンクオブジェクトが一気にメモリに
載らないように二つ目の形で書く必要がありました。

ジェネレータ式はリスト内包と似た動作をしますが、リスト全体を実体化しませ
ん; 代わりにそれは、要素を一つずつ返すジェネレータを返します。上述の例は
こう書けます:

     links = (link for link in get_all_links() if not link.followed)
     for link in links:
         ...

上の例でのように、ジェネレータ式は常に括弧の中に書かなければなりません。
関数呼び出しを囲む括弧もそれに含まれるので、関数にそのまま渡すイテレータ
を作りたければこれで良いです:

     print sum(obj.count for obj in list_all_objects())

ジェネレータ式はリスト内包とは色々小さい点で違います。最も顕著なのはルー
プ変数 (上の例での 'obj') がジェネレータ式の外からアクセス不能なことです
。リスト内包はループの制御変数が最後に代入された値で残ります; 将来のバー
ジョンの Python では、この振る舞いはリスト内包がこの点でジェネレータ式と
同じになるように変更されます。 (--訳注: Python 2.7 でもリスト内包のこの
振る舞いは変わっておらず、警告ともなりません。制御変数が内包のスコープ外
で可視でなくなったのは Python 3.0 からです。--)

参考
....

PEP 289(1) - ジェネレータ式

     Raymond Hettinger によって提案され、Hye-Shik Chang に導かれた早期の
     尽力によって Jiwon Seo により実装されました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0289/


File: python.info,  Node: PEP 292 より単純な文字列置換 string substitution,  Next: PEP 318 関数とメソッドのためのデコレータ,  Prev: PEP 289 ジェネレータ式,  Up: What's New in Python 2 4

1.19.4 PEP 292: より単純な文字列置換 (string substitution)
----------------------------------------------------------

標準ライブラリに、文字列を変数で置換するための代替メカニズムをもたらす新
しいくつかのクラスが追加されました; この置換のスタイルは、訓練されていな
いユーザがテンプレートを編集する必要があるようなアプリケーションにとって
、より良いものでしょう。

変数置換を名前で行うためのいつもの方法は ‘%’ 演算子です:

     >>> '%(page)i: %(title)s' % {'page':2, 'title': 'The Best of Times'}
     '2: The Best of Times'

テンプレート文字列を書くのに、閉じ括弧のあとの ‘i’ や ‘s’ を忘れやすいで
す。これはそのテンプレートが Python モジュール内にあるなら大問題でもあり
ません。コードを実行し、「サポートされないフォーマット文字 (unsupported
format character)」な *note ValueError: 2ec. を喰らい、問題を直すだけの
ことです。ですが、例えば Mailman のようなアプリケーションを考えてみてく
ださい。テンプレート文字列や翻訳は、Python 言語について承知していないユ
ーザが編集するのです。フォーマット文字列の構文はそのようなユーザに説明す
るには複雑で、彼らが間違いをやらかした場合には、親切なフィードバックを彼
らに与えるのは難しいのです。

PEP 292 は *note string: d8. モジュールに ‘Template’ クラスを追加します
。これは置換を指示するのに ‘$’ を使います:

     >>> import string
     >>> t = string.Template('$page: $title')
     >>> t.substitute({'page':2, 'title': 'The Best of Times'})
     '2: The Best of Times'

辞書にキーが見つからない場合、 ‘substitute()’ メソッドは *note KeyError:
5e7. を送出します。 ‘safe_substitute()’ メソッドもあり、これはキー不在を
無視します:

     >>> t = string.Template('$page: $title')
     >>> t.safe_substitute({'page':3})
     '3: $title'

参考
....

PEP 292(1) - より単純な文字列置換 (string substitution)

     Barry Warsaw 著、実装

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0292/


File: python.info,  Node: PEP 318 関数とメソッドのためのデコレータ,  Next: PEP 322 逆順のイテレーション,  Prev: PEP 292 より単純な文字列置換 string substitution,  Up: What's New in Python 2 4

1.19.5 PEP 318: 関数とメソッドのためのデコレータ
------------------------------------------------

Python 2.2 は Python オブジェクトモデルを静的メソッド、クラスメソッドを
追加することで拡張はしましたが、それらを定義する新たな手段を提供するよう
な Python 構文の拡張はしませんでした。このため、 *note def: 1673. でメソ
ッドは普通に書いたのち、新型メソッドとしての関数へ仕立て上げる *note
staticmethod(): 453. または *note classmethod(): 48e. にその結果のメソッ
ドを渡す、という手順を取る必要がありました。このような具合でした:

     class C:
        def meth (cls):
            ...

        meth = classmethod(meth)   # Rebind name to wrapped-up class method

メソッドがとても長かったりすると、関数のボディの後ろの *note
classmethod(): 48e. 呼び出しは見失ったり忘れたりしやすいものでした。

そのような定義をもっと読みやすくするために何か構文を追加する、という意図
は常にありましたが、2.2 のリリース時点では良い構文は明らかではありません
でした。本日時点でさえ 'いまだ' 明らかとは言えませんが、ユーザは静的メソ
ッドとクラスメソッドを簡単に手にする手段を注文し続けています; 新たな構文
的機能はこの要求に合うように追加されました。

この新たな機能は「関数デコレータ (function decorators)」と呼ばれます。こ
の名前は *note classmethod(): 48e, *note staticmethod(): 453, とその仲間
たちが関数オブジェクトに追加的な情報を保存することから着想を得たものです
; それらは関数をより多くの詳細で 'デコレート (修飾) している' というわけ
です。

記法は Java より拝借して ‘'@'’ 文字を指示子として使います。この新たな構
文を使うと、上記の例はこのように書けます:

     class C:

        @classmethod
        def meth (cls):
            ...

‘@classmethod’ は ‘meth=classmethod(meth)’ 代入の速記法です。より一般的
には、このように書けば…:

     @A
     @B
     @C
     def f ():
         ...

これはデコレータ前史の以下コードと等価です:

     def f(): ...
     f = A(B(C(f)))

デコレータは関数定義の前になければなりません。一行ごとに一つのデコレータ
です。 def ステートメントと同じ行にあってはダメです。つまり ‘@A def f():
...’ は不正です。モジュールレベルかクラス内の関数定義のみをデコレート出
来ます; クラス定義はデコレート出来ません。(-- 訳注: クラス定義のデコレー
タは Python 2.6 で追加されました (PEP 3129) 。--)

デコレータはただの関数です。引数としてデコレートされる関数を取り、同じ関
数か何か新しいオブジェクトを返すだけの。結果がほかのデコレータ適用される
の出ない限りは、デコレータの戻り値は呼び出し可能である必要はありません
(普通はそうですが)。あなた自身のデコレータを書くのは簡単です。続く単純な
例は、関数オブジェクトに単に属性をセットするだけのものです:

     >>> def deco(func):
     ...    func.attr = 'decorated'
     ...    return func
     ...
     >>> @deco
     ... def f(): pass
     ...
     >>> f
     <function f at 0x402ef0d4>
     >>> f.attr
     'decorated'
     >>>

もう少しだけ現実的な例として、続く例ではデコレータに、与えられた引数が整
数かどうかチェックさせてみます:

     def require_int (func):
         def wrapper (arg):
             assert isinstance(arg, int)
             return func(arg)

         return wrapper

     @require_int
     def p1 (arg):
         print arg

     @require_int
     def p2(arg):
         print arg*2

PEP 318(1) にある例はこのアイディアのもっと凝った版が含まれていて、それ
は要求型の指定と戻り値のチェックの両方が出来ます。

デコレータ関数は引数を取ることが出来ます。引数が与えられた場合、あなたの
デコレータ関数はそれら引数のみで呼び出され、そして新しいデコレータを返さ
なければなりません; この関数は単一の関数を取らなければならず、前述のよう
に関数を返さなければなりません。言い換えると、 ‘@A @B @C(args)’ はこうな
ります:

     def f(): ...
     _deco = C(args)
     f = A(B(_deco(f)))

これが正しいと理解するには少しばかり頭をひねる必要がありますが、難しすぎ
ることはありません。

A small related change makes the *note func_name: 14ec. attribute of
functions writable.  This attribute is used to display function names in
tracebacks, so decorators should change the name of any new function
that's constructed and returned.

参考
....

PEP 318(2) - 関数、メソッド、クラスのためのデコレータ

     Kevin D. Smith, Jim Jewett, Skip Montanaro により著されました。数多
     くの人々が関数デコレータ実装のパッチを書きましたが、実際にチェック
     インされたものは Mark Russell が書いた #979728 でした。

‘https://wiki.python.org/moin/PythonDecoratorLibrary’

     数多くのデコレータ例を含む Wiki ページ。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0318/

   (2) https://peps.python.org/pep-0318/


File: python.info,  Node: PEP 322 逆順のイテレーション,  Next: PEP 324 新しい subprocess モジュール,  Prev: PEP 318 関数とメソッドのためのデコレータ,  Up: What's New in Python 2 4

1.19.6 PEP 322: 逆順のイテレーション
------------------------------------

新しいビルトイン関数 ‘reversed(seq)’ は、シーケンスを受け取って、シーケ
ンスの要素を逆順にループするイテレータを返します:

     >>> for i in reversed(xrange(1,4)):
     ...    print i
     ...
     3
     2
     1

‘range(1,4)[::-1]’ のようにする拡張スライスでのやり方に比較して *note
reversed(): a65. は読みやすく、実行が高速で、大体の場合はメモリ使用が少
なく済みます。

*note reversed(): a65. は任意のイテレータは受け付けず、シーケンスのみ受
け付けることに注意してください。イテレータを逆順にしたければ、最初に
*note list(): 24d. でリストに変換してください:

     >>> input = open('/etc/passwd', 'r')
     >>> for line in reversed(list(input)):
     ...   print line
     ...
     root:*:0:0:System Administrator:/var/root:/bin/tcsh
       ...

参考
....

PEP 322(1) - 逆順のイテレーション

     Raymond Hettinger 著、実装.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0322/


File: python.info,  Node: PEP 324 新しい subprocess モジュール,  Next: PEP 327 Decimal データ型,  Prev: PEP 322 逆順のイテレーション,  Up: What's New in Python 2 4

1.19.7 PEP 324: 新しい subprocess モジュール
--------------------------------------------

The standard library provides a number of ways to execute a subprocess,
offering different features and different levels of complexity.
‘os.system(command)’ is easy to use, but slow (it runs a shell process
which executes the command) and dangerous (you have to be careful about
escaping the shell's metacharacters).  The ‘popen2’ module offers
classes that can capture standard output and standard error from the
subprocess, but the naming is confusing.  The *note subprocess: dc.
module cleans this up, providing a unified interface that offers all the
features you might need.

Instead of ‘popen2’'s collection of classes, *note subprocess: dc.
contains a single class called *note subprocess.Popen: 4b7. whose
constructor supports a number of different keyword arguments.

     class Popen(args, bufsize=0, executable=None,
                 stdin=None, stdout=None, stderr=None,
                 preexec_fn=None, close_fds=False, shell=False,
                 cwd=None, env=None, universal_newlines=False,
                 startupinfo=None, creationflags=0):

'args' は普通は文字列のシーケンスで、サブプロセスとして実行するプログラ
ムへの引数群となります。 ('shell' 引数が真の場合は 'args' はシェルに解釈
を任せるために渡す文字列に出来、つまりこの場合 *note os.system(): 1676.
と同じことをします。)

'stdin', 'stdout', 'stderr' はサブプロセスの入力・出力・エラーのストリー
ムを指定します。ファイルオブジェクトかファイル記述子を渡すことが出来ます
。あるいは定数 ‘subprocess.PIPE’ を渡してサブプロセスと親とのパイプを作
成することが出来ます。

コンストラクタには多くの便利なオプションがあります:

   * 'close_fds' はサブプロセス実行前に全てのファイル記述子をクローズす
     ることを要求します。

   * 'cwd' はサブプロセスを実行する作業ディレクトリを指定します (デフォ
     ルトは親の作業ディレクトリです)。

   * 'env' は環境変数を指定する辞書です。

   * 'preexec_fn' は子が開始する前に呼び出される関数です。

   * 'universal_newlines' で、子の入出力を、Python の *note universal
     newlines: f35. 機能で開きます。

‘Popen’ インスタンスを作ってしまえば、あとはサブプロセスが終了するまで停
止するために ‘wait()’ メソッド呼び出すことが出来、停止することなく終了を
チェックするのに ‘poll()’ メソッドを呼び出すことが出来、あるいは
‘communicate(data)’ を呼び出して、子の標準入力に 'data' を送信することが
出来ます。 ‘communicate(data)’ はサブプロセスが送信する標準出力と標準エ
ラー出力を読み込み、タプル ‘(stdout_data, stderr_data)’ を返します。

‘call()’ は ‘Popen’ コンストラクタにその引数を流し込むショートカットで、
コマンドが終了するまで待ち、サブプロセスの終了コードを返します。これは
*note os.system(): 1676. に対する安全な置き換えとなりえます:

     sts = subprocess.call(['dpkg', '-i', '/tmp/new-package.deb'])
     if sts == 0:
         # Success
         ...
     else:
         # dpkg returned an error
         ...

コマンドはシェルを使うことなく呼び出されます。もしシェルを本当に使いたい
のであればキーワード引数として ‘shell=True’ を与えた上でシーケンスの代わ
りに文字列を与えることが出来ます:

     sts = subprocess.call('dpkg -i /tmp/new-package.deb', shell=True)

PEP にはシェルと Python コードの様々な例が採られていて、シェルスクリプト
をいかにして *note subprocess: dc. を用いて Python コードに変換するかを
示しています。PEP のこのセクションを読むことを強くお勧めします。

参考
....

PEP 324(1) - subprocess - プロセスのための新たなモジュール

     Fredrik Lundh 他によるサポートによって、Peter Åstrand により PEP 著
     と実装が行われました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0324/


File: python.info,  Node: PEP 327 Decimal データ型,  Next: PEP 328 マルチラインインポート,  Prev: PEP 324 新しい subprocess モジュール,  Up: What's New in Python 2 4

1.19.8 PEP 327: Decimal データ型
--------------------------------

Python has always supported floating-point (FP) numbers, based on the
underlying C double type, as a data type.  However, while most
programming languages provide a floating-point type, many people (even
programmers) are unaware that floating-point numbers don't represent
certain decimal fractions accurately.  The new ‘Decimal’ type can
represent these fractions accurately, up to a user-specified precision
limit.

* Menu:

* なぜ Decimal が必要なのか?::
* Decimal 型::
* Context 型::


File: python.info,  Node: なぜ Decimal が必要なのか?,  Next: Decimal 型,  Up: PEP 327 Decimal データ型

1.19.8.1 なぜ Decimal が必要なのか?
...................................

浮動小数点数が使う表現方法に起因する制約があります。浮動小数点数は 3 つ
の構成要素から成ります:

   * 符号(sign)。正または負。

   * 仮数部(mantissa)。一桁の 2 進値に端数部が続きます。例えば 2 進数で
     ‘1.01’ は ‘1 + 0/2 + 1/4’ で 10 進表記で 1.25 です。

   * 指数部(exponent)。小数点がその数値のどこに位置するかを表します。

例えば 1.25 は、正の符号を持ち、仮数部の値は (2 進数で) 1.01 で、指数部
は 0 です (小数点は移動の必要がありません)。5 は同じ符号と仮数部を持ち、
指数部は、仮数部が 4 倍なので 2 (2 を底とする 2 の 冪乗) です; 1.25 * 4
は 5 です。

Modern systems usually provide floating-point support that conforms to a
standard called IEEE 754.  C's double type is usually implemented as a
64-bit IEEE 754 number, which uses 52 bits of space for the mantissa.
This means that numbers can only be specified to 52 bits of precision.
If you're trying to represent numbers whose expansion repeats endlessly,
the expansion is cut off after 52 bits.  Unfortunately, most software
needs to produce output in base 10, and common fractions in base 10 are
often repeating decimals in binary.  For example, 1.1 decimal is binary
‘1.0001100110011 ...’; .1 = 1/16 + 1/32 + 1/256 plus an infinite number
of additional terms.  IEEE 754 has to chop off that infinitely repeated
decimal after 52 digits, so the representation is slightly inaccurate.

ときどきあなたはこの不正確さを、数値を表示する際に目にするでしょう:

     >>> 1.1
     1.1000000000000001

この不正確さは数値を表示する際にいつでも目に見えるわけではありません。浮
動小数点数から文字列への変換が C ライブラリによって提供されていて、C ラ
イブラリのほとんどが賢明な出力を生成しようと頑張っているからです。それが
表示されないにしても、不正確さはそれでも存在していて、後続の計算への誤差
が大きくなりえます。

多くのアプリケーションではこれは重要ではありません。モニタにプロットして
表示するのに 1.1 と 1.1000000000000001 の差は小さすぎて見えません。大抵
は出力を一定の桁位置までに制限して出力するものですし、2 やら 3 やら 8 桁
などの位置で丸めたりすれば誤差は決して露わにはなりません。ですがそれが重
要なアプリケーションにとっては、あなた自身のカスタム数学ルーチンのための
実装作業は膨大になります。

こうして ‘Decimal’ 型が作られました。


File: python.info,  Node: Decimal 型,  Next: Context 型,  Prev: なぜ Decimal が必要なのか?,  Up: PEP 327 Decimal データ型

1.19.8.2 ‘Decimal’ 型
.....................

新しいモジュール *note decimal: 3a. が Python 標準ライブラリに追加されま
した。これには 2 つのクラス ‘Decimal’, ‘Context’ を含みます。 ‘Decimal’
インスタンスは数値を表現し、 ‘Context’ インスタンスは、精度やデフォルト
の丸めモードなどのさまざまな設定をまとめるのに使われます。

‘Decimal’ のインスタンスは普通の Python 整数や浮動小数点数のように *note
immutable: 15b9. です。 ‘Decimal’ のインスタンスは整数や文字列から構築出
来ます:

     >>> import decimal
     >>> decimal.Decimal(1972)
     Decimal("1972")
     >>> decimal.Decimal("1.1")
     Decimal("1.1")

符号(sign)、10進数値のタプルで表した仮数部(mantissa)、指数部(exponent)を
含んだタプルを渡すことも出来ます:

     >>> decimal.Decimal((1, (1, 4, 7, 5), -2))
     Decimal("-14.75")

注意: 符号ビットは負符号の有無なので、 0 が正、1 が負です。

浮動小数点数からの変換は少々問題です: 1.1 を表現する浮動小数点数は 10 進
数値の正確な 1.1 に変換すべきでしょうか、それとも 1.1 が持つどんな不正確
さもそのまま持ち込むべきでしょうか?  決定は、問題をはぐらかして、その種
の変換を API の範疇外とする、というものでした。代わりにあなたは浮動小数
点数を望みの精度で文字列に変換して、その文字列を ‘Decimal’ コンストラク
タに渡す必要があります:

     >>> f = 1.1
     >>> decimal.Decimal(str(f))
     Decimal("1.1")
     >>> decimal.Decimal('%.12f' % f)
     Decimal("1.100000000000")

いったん ‘Decimal’ を手にしてしまえばあとは普通の数学演算が使えます。制
約の一つ: べき乗には整数の指数しか使えません:

     >>> a = decimal.Decimal('35.72')
     >>> b = decimal.Decimal('1.73')
     >>> a+b
     Decimal("37.45")
     >>> a-b
     Decimal("33.99")
     >>> a*b
     Decimal("61.7956")
     >>> a/b
     Decimal("20.64739884393063583815028902")
     >>> a ** 2
     Decimal("1275.9184")
     >>> a**b
     Traceback (most recent call last):
       ...
     decimal.InvalidOperation: x ** (non-integer)

‘Decimal’ インスタンスと整数は混ぜて使えますが、浮動小数点数とは出来ませ
ん:

     >>> a + 4
     Decimal("39.72")
     >>> a + 4.5
     Traceback (most recent call last):
       ...
     TypeError: You can interact Decimal only with int, long or Decimal data types.
     >>>

‘Decimal’ 数を *note math: 92, *note cmath: 19. モジュールで使うことは出
来ますが、演算実行前にその場で浮動小数点数に変換されて、結果精度と正確性
を失う可能性があります。戻り値は普通の浮動小数点数であって ‘Decimal’ で
はありません:

     >>> import math, cmath
     >>> d = decimal.Decimal('123456789012.345')
     >>> math.sqrt(d)
     351364.18288201344
     >>> cmath.sqrt(-d)
     351364.18288201344j

‘Decimal’ インスタンスは ‘Decimal’ インスタンスを返す ‘sqrt()’ メソッド
を持っていますが、三角関数のようななにかほかのことが必要な場合は、それら
を実装する必要があるでしょう。:

     >>> d.sqrt()
     Decimal("351364.1828820134592177245001")


File: python.info,  Node: Context 型,  Prev: Decimal 型,  Up: PEP 327 Decimal データ型

1.19.8.3 ‘Context’ 型
.....................

‘Context’ クラスのインスタンスは decimal 演算についてのいくつかの設定を
カプセル化しています:

   * ‘prec’ は精度で、小数桁数です。

   * ‘rounding’ は丸めのモードを指定します。 *note decimal: 3a. にはこの
     値に渡せる定数が定義されています: ‘ROUND_DOWN’, ‘ROUND_CEILING’,
     ‘ROUND_HALF_EVEN’, それに色々。

   * ‘traps’ は特定のエラー状態に出会った場合に何が起こるべきかを指定す
     る辞書です: 例外を発生させるか値を返すかどちらかです。いくつかのエ
     ラー状態の例としては、ゼロ除算、精度損失、オーバーフローがあります
     。

スレッドローカルなデフォルトのコンテキストを、 ‘getcontext()’ を呼び出す
ことで利用出来ます; デフォルトの精度、丸めモード、トラップ処理に代えてこ
のコンテキストのプロパティを変更出来ます。続く例はデフォルトコンテキスト
の精度を変更する効果についてお見せします:

     >>> decimal.getcontext().prec
     28
     >>> decimal.Decimal(1) / decimal.Decimal(7)
     Decimal("0.1428571428571428571428571429")
     >>> decimal.getcontext().prec = 9
     >>> decimal.Decimal(1) / decimal.Decimal(7)
     Decimal("0.142857143")

エラー状態の場合のデフォルトアクションを選択出来ます; モジュールは無限大
(infinity)あるいは非数(not-a-number: NaN)を返すか、例外を投げるかです:

     >>> decimal.Decimal(1) / decimal.Decimal(0)
     Traceback (most recent call last):
       ...
     decimal.DivisionByZero: x / 0
     >>> decimal.getcontext().traps[decimal.DivisionByZero] = False
     >>> decimal.Decimal(1) / decimal.Decimal(0)
     Decimal("Infinity")
     >>>

‘Context’ インスタンスは ‘to_eng_string()’, ‘to_sci_string()’ のような、
数値の書式化のための色々なメソッドも持っています。

さらに詳しく知りたければ *note decimal: 3a. モジュールのドキュメントを読
んで下さい。これには簡単に始められるチュートリアルとリファレンスが入って
います。

参考
....

PEP 327(1) - Decimal データ型

     Facundo Batista によって著され、Facundo Batista, Eric Price,
     Raymond Hettinger, Aahz, Tim Peters らによって実装されました。

http://www.lahey.com/float.htm(2)

     この記事は浮動小数点数の不正確さが起こりうるたくさんの問題について
     、Fortran コードを使って解説しています。

‘https://speleotrove.com/decimal/’

     10 進数ベースの表現についての記述です(訳注: decimal-based は小数ベ
     ースとも 10 進数ベースとも取れるのですが、後者にしておきました)。こ
     の表現方法は標準として提案されていて、この Python の decimal 型の基
     礎になっています。この題材の多くが Rexx 言語設計者である Mike
     Cowlishaw によって著されました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0327/

   (2) 
https://web.archive.org/web/20230604072523/http://www.lahey.com/float.htm


File: python.info,  Node: PEP 328 マルチラインインポート,  Next: PEP 331 Locale に依存しない Float/String 変換,  Prev: PEP 327 Decimal データ型,  Up: What's New in Python 2 4

1.19.9 PEP 328: マルチラインインポート
--------------------------------------

言語の変更の一つは小さな文法的な微調整で、モジュールからたくさんの名前を
インポートするのを簡単にするためのものです。 ‘from module import names’
文において、 'names' はカンマ区切りのシーケンスです。シーケンスがとても
長くなった場合、同じモジュールからのインポート文を何度も書くか、行末をバ
ックスラッシュでエスケープするかするでしょう、このように:

     from SimpleXMLRPCServer import SimpleXMLRPCServer,\
                 SimpleXMLRPCRequestHandler,\
                 CGIXMLRPCRequestHandler,\
                 resolve_dotted_attribute

Python 2.4 での文法的な変更は、単純に names を丸括弧で囲んでも良い、とす
るだけのものです。Python は丸括弧内の改行を無視しますので、バックスラッ
シュはもう必要ありません:

     from SimpleXMLRPCServer import (SimpleXMLRPCServer,
                                     SimpleXMLRPCRequestHandler,
                                     CGIXMLRPCRequestHandler,
                                     resolve_dotted_attribute)

その PEP は、全ての *note import: 7f8. 文が絶対インポートであること、相
対インポートであることを示すには ‘.’ 文字で開始すること、の提案もしてい
ます。PEP のこの部分は Python 2.4 では実装されていませんが、 Python 2.5
向けには完了しています。

参考
....

PEP 328(1) - マルチラインインポートと、絶対/相対インポート

     Aahz 著.  Multi-line imports は Dima Dorfman により実装。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0328/


File: python.info,  Node: PEP 331 Locale に依存しない Float/String 変換,  Next: その他の言語変更<17>,  Prev: PEP 328 マルチラインインポート,  Up: What's New in Python 2 4

1.19.10 PEP 331: Locale に依存しない Float/String 変換
------------------------------------------------------

*note locale: 8a. モジュールにより、Python ソフトウェアは特定の国や言語
の地域化をする色々な変換や表示の変換を選択出来ます。ところがこのモジュー
ルは、数値ロケールを変更しないように気を配らなければなりませんでした。と
いうのも Python 内の色んな関数実装が、数値ロケールが ‘'C'’ ロケールにセ
ットされたままであることを必要としていたからです。しばしばこれは、コード
が C ライブラリの ‘atof()’ 関数を使っていることに原因がありました。

Not setting the numeric locale caused trouble for extensions that used
third-party C libraries, however, because they wouldn't have the correct
locale set.  The motivating example was GTK+, whose user interface
widgets weren't displaying numbers in the current locale.

この PEP に記述された解法は、ロケール設定を無視して ASCII のみの変換を実
施する 3 つの新しい Python API 関数を追加することです:

   * ‘PyOS_ascii_strtod(str, ptr)’ and ‘PyOS_ascii_atof(str, ptr)’ both
     convert a string to a C double.

   * ‘PyOS_ascii_formatd(buffer, buf_len, format, d)’ converts a double
     to an ASCII string.

The code for these functions came from the GLib library
(https://developer-old.gnome.org/glib/2.26/(1)), whose developers kindly
relicensed the relevant functions and donated them to the Python
Software Foundation.  The *note locale: 8a. module can now change the
numeric locale, letting extensions such as GTK+ produce the correct
results.

参考
....

PEP 331(2) - Locale に依存しない Float/String 変換

     Christian R. Reis 著, 実装 Gustavo Carneiro.

   ---------- Footnotes ----------

   (1) 
http://web.archive.org/web/20210306104320/https://developer.gnome.org/glib/2.26/

   (2) https://peps.python.org/pep-0331/


File: python.info,  Node: その他の言語変更<17>,  Next: 新たなモジュール、改良されたモジュール、非推奨のモジュール<3>,  Prev: PEP 331 Locale に依存しない Float/String 変換,  Up: What's New in Python 2 4

1.19.11 その他の言語変更
------------------------

以下が、Python 2.4 言語コアに加えられた全ての変更点です。

   * 関数とメソッドのためのデコレータが追加されました。 ( PEP 318(1)).

   * ビルトインの *note set(): 184. 型と *note frozenset(): 7f2. 型が追
     加されました ( PEP 218(2))。ほか新たなビルトイン関数
     ‘reversed(seq)’ 関数が追加されました ( PEP 322(3))。

   * ジェネレータ式が追加されました ( PEP 289(4)).

   * いくらかの数値式は、もう 32 ビットや 64 ビットに制限されません (
     PEP 237(5)).

   * ‘from module import names’ ステートメントにおいて、 'names' を括弧
     で囲むことが出来るようになりました ( PEP 328(6)).

   * *note dict.update(): 167e. メソッドが *note dict: 183. コンストラク
     タと同じ形式の引数を取れるようになりました。これには任意のマッピン
     グ、キー/値ペアのイテラブルとキーワード引数を含みます。
     (Contributed by Raymond Hettinger.)

   * 文字列の ‘ljust()’, ‘rjust()’, ‘center()’ メソッドで空白以外の埋め
     文字を省略可能引数で指定出来るようになりました。 (Contributed by
     Raymond Hettinger.)

   * ほかに、文字列には ‘rsplit()’ メソッドも追加されています。これは
     ‘split()’ メソッドと似た動きをしますが、後ろから順に分割します
     (Contributed by Sean Reifschneider.)

          >>> 'www.python.org'.split('.', 1)
          ['www', 'python.org']
          'www.python.org'.rsplit('.', 1)
          ['www.python', 'org']

   * リストの ‘sort()’ メソッドに 3 つのキーワード引数 'cmp', 'key',
     'reverse' が追加されています。これらパラメータは ‘sort()’ のある種
     の用法を単純にします。これらは全て省略可能です。

     'cmp' パラメータには比較関数を渡します。これは 2 つのパラメータを取
     り、パラメータの比較結果に応じて -1, 0, +1 のいずれかを返します。こ
     の関数はリストのソートに使われます。これまでの ‘sort()’ に唯一許さ
     れていたのがこの 'cmp' パラメータでした。

     'key' には単一パラメータ関数を渡します。これはリスト要素を受け取り
     、要素の比較キーを返す関数です。リストはその比較キーを使ってソート
     されます。続く例はリストを大文字小文字区別なく並び替えます:

          >>> L = ['A', 'b', 'c', 'D']
          >>> L.sort()                 # Case-sensitive sort
          >>> L
          ['A', 'D', 'b', 'c']
          >>> # Using 'key' parameter to sort list
          >>> L.sort(key=lambda x: x.lower())
          >>> L
          ['A', 'b', 'c', 'D']
          >>> # Old-fashioned way
          >>> L.sort(cmp=lambda x,y: cmp(x.lower(), y.lower()))
          >>> L
          ['A', 'b', 'c', 'D']

     例の最後のものは 'cmp' パラメータを使っています。これが大文字小文字
     区別のない並び替えの昔ながらの方法です。むろん動きます。が、 'key'
     パラメータでのやり方より遅いです。 'cmp' では ‘lower()’ メソッド呼
     び出しが比較ごとなので要素ごとに 2 回呼び出すことになりますが、
     'key' だと呼び出しはそれぞれの要素ごとに ‘lower()’ 呼び出しを一回だ
     けで済ませられます。

     単純なキー関数や比較関数には、しばしば *note lambda: 14b5. 関数を避
     けて非束縛メソッドを使えます。例えば上記の大文字小文字によらない並
     べ替えはこのように書くのが最善です:

          >>> L.sort(key=str.lower)
          >>> L
          ['A', 'b', 'c', 'D']

     最後の 'reverse' パラメータはブーリアン値を取ります。真ならばリスト
     は逆順にソートされます。 ‘L.sort(); L.reverse()’ と書く代わりにこれ
     からは ‘L.sort(reverse=True)’ と書けます。

     ソートの結果がステーブル(安定)であることが保障されるようになりまし
     た。つまり 2 つの要素が同列である場合、入力と同じ順序が保たれます。
     例えば人物リストを名前でソートしたのちに年齢でソートすると結果は、
     年齢でソートされていますが同年齢の人物は名前順です。

     (All changes to ‘sort()’ contributed by Raymond Hettinger.)

   * 新たに追加されたビルトイン関数 ‘sorted(iterable)’ はインプレイスな
     メソッド *note list.sort(): dc8. と似た振る舞いをしますが、式内で使
     えます。違いは:

   * 入力には任意のイテラブルを取れます;

   * 新しく構築されたコピーをソートし、オリジナルは無傷のままにします; そ
     して

   * 式として新しいソート済みコピーを返します。

          >>> L = [9,7,8,3,2,4,1,6,5]
          >>> [10+i for i in sorted(L)]       # usable in a list comprehension
          [11, 12, 13, 14, 15, 16, 17, 18, 19]
          >>> L                               # original is left unchanged
          [9,7,8,3,2,4,1,6,5]
          >>> sorted('Monty Python')          # any iterable may be an input
          [' ', 'M', 'P', 'h', 'n', 'n', 'o', 'o', 't', 't', 'y', 'y']

          >>> # List the contents of a dict sorted by key values
          >>> colormap = dict(red=1, blue=2, green=3, black=4, yellow=5)
          >>> for k, v in sorted(colormap.iteritems()):
          ...     print k, v
          ...
          black 4
          blue 2
          green 3
          red 1
          yellow 5

     (Contributed by Raymond Hettinger.)

   * 整数演算はもはや ‘OverflowWarning’ は引き起こしません。
     ‘OverflowWarning’ 警告は Python 2.5 で撤廃されます。

   * インタプリタに新たに *note -m: 23c. スイッチが加わりました。これは
     名前を取り、 ‘sys.path’ にある対応するモジュールを検索し、そしてそ
     のモジュールをスクリプトとして実行します。たとえば Python プロファ
     イラを ‘python -m profile’ で起動することが出来るようになりました。
     (Contributed by Nick Coghlan.)

   * ‘eval(expr, globals, locals)’ 関数と ‘execfile(filename, globals,
     locals)’ 関数、 ‘exec’ 文が 'locals' パラメータに任意のマッピング型
     を受け取れるようになりました。以前は正規の Python 辞書である必要が
     ありました。 (Contributed by Raymond Hettinger.)

   * ビルトイン関数の *note zip(): 1a0. と ‘itertools.izip()’ が引数なし
     で呼ばれた場合に空リストを返すようになりました。以前は *note
     TypeError: 198. 例外でした。これにより可変引数リストをこなしやすく
     なります:

          >>> def transpose(array):
          ...    return zip(*array)
          ...
          >>> transpose([(1,2,3), (4,5,6)])
          [(1, 4), (2, 5), (3, 6)]
          >>> transpose([])
          []

     (Contributed by Raymond Hettinger.)

   * Encountering a failure while importing a module no longer leaves a
     partially initialized module object in ‘sys.modules’.  The
     incomplete module object left behind would fool further imports of
     the same module into succeeding, leading to confusing errors.
     (Fixed by Tim Peters.)

   * *note None: 885. が定数になっています。 ‘None’ という名前に新しい値
     を割り当てようとするコードは、今では構文エラーになります。
     (Contributed by Raymond Hettinger.)

* Menu:

* 最適化: 最適化<17>.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0318/

   (2) https://peps.python.org/pep-0218/

   (3) https://peps.python.org/pep-0322/

   (4) https://peps.python.org/pep-0289/

   (5) https://peps.python.org/pep-0237/

   (6) https://peps.python.org/pep-0328/


File: python.info,  Node: 最適化<17>,  Up: その他の言語変更<17>

1.19.11.1 最適化
................

   * The inner loops for list and tuple slicing were optimized and now
     run about one-third faster.  The inner loops for dictionaries were
     also optimized, resulting in performance boosts for ‘keys()’,
     ‘values()’, ‘items()’, ‘iterkeys()’, ‘itervalues()’, and
     ‘iteritems()’.  (Contributed by Raymond Hettinger.)

   * The machinery for growing and shrinking lists was optimized for
     speed and for space efficiency.  Appending and popping from lists
     now runs faster due to more efficient code paths and less frequent
     use of the underlying system ‘realloc()’.  List comprehensions also
     benefit.  *note list.extend(): 602. was also optimized and no
     longer converts its argument into a temporary list before extending
     the base list.  (Contributed by Raymond Hettinger.)

   * *note list(): 24d, *note tuple(): 614, *note map(): 19f, *note
     filter(): a64, and *note zip(): 1a0. now run several times faster
     with non-sequence arguments that supply a ‘__len__()’ method.
     (Contributed by Raymond Hettinger.)

   * The methods ‘list.__getitem__()’, ‘dict.__getitem__()’, and
     ‘dict.__contains__()’ are now implemented as ‘method_descriptor’
     objects rather than ‘wrapper_descriptor’ objects.  This form of
     access doubles their performance and makes them more suitable for
     use as arguments to functionals: ‘map(mydict.__getitem__,
     keylist)’.  (Contributed by Raymond Hettinger.)

   * Added a new opcode, ‘LIST_APPEND’, that simplifies the generated
     bytecode for list comprehensions and speeds them up by about a
     third.  (Contributed by Raymond Hettinger.)

   * The peephole bytecode optimizer has been improved to produce
     shorter, faster bytecode; remarkably, the resulting bytecode is
     more readable.  (Enhanced by Raymond Hettinger.)

   * String concatenations in statements of the form ‘s = s + "abc"’ and
     ‘s += "abc"’ are now performed more efficiently in certain
     circumstances.  This optimization won't be present in other Python
     implementations such as Jython, so you shouldn't rely on it; using
     the ‘join()’ method of strings is still recommended when you want
     to efficiently glue a large number of strings together.
     (Contributed by Armin Rigo.)

The net result of the 2.4 optimizations is that Python 2.4 runs the
pystone benchmark around 5% faster than Python 2.3 and 35% faster than
Python 2.2.  (pystone is not a particularly good benchmark, but it's the
most commonly used measurement of Python's performance.  Your own
applications may show greater or smaller benefits from Python 2.4.)


File: python.info,  Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール<3>,  Next: ビルドならびに C API の変更<11>,  Prev: その他の言語変更<17>,  Up: What's New in Python 2 4

1.19.12 新たなモジュール、改良されたモジュール、非推奨のモジュール
------------------------------------------------------------------

いつものように、Python の標準ライブラリには数多くの拡張とバグ修正があり
ました。ここでは最も注目に値する変更について、モジュールの辞書順に列挙し
ます。変更の完全なリストについてはソースツリーの ‘Misc/NEWS’ を調べるか
、あるいは全ての詳細について CVS ログに目を通してみてください。

   * The ‘asyncore’ module's ‘loop()’ function now has a 'count'
     parameter that lets you perform a limited number of passes through
     the polling loop.  The default is still to loop forever.

   * The *note base64: f. module now has more complete RFC 3548(1)
     support for Base64, Base32, and Base16 encoding and decoding,
     including optional case folding and optional alternative alphabets.
     (Contributed by Barry Warsaw.)

   * *note bisect: 12. モジュールが性能改善のために C 実装を使うようにな
     りました。 (Contributed by Dmitry Vasiliev.)

   * Hye-Shik Chang によって保守されている東アジアのコーデックの
     CJKCodecs コレクションが Python 2.4 に統合されました。新たなエンコ
     ーディングは:

   * Chinese (PRC): gb2312, gbk, gb18030, big5hkscs, hz

   * Chinese (ROC): big5, cp950

   * 
     Japanese: cp932, euc-jis-2004, euc-jp, euc-jisx0213, iso-2022-jp,

          iso-2022-jp-1, iso-2022-jp-2, iso-2022-jp-3, iso-2022-jp-ext,
          iso-2022-jp-2004, shift-jis, shift-jisx0213, shift-jis-2004

   * Korean: cp949, euc-kr, johab, iso-2022-kr

   * ほか、新たなエンコーディングが追加されています: HP Roman8,
     ISO_8859-11, ISO_8859-16, PCTP-154, TIS-620.

   * UTF-8, UTF-16 コーデックが部分的な入力を受け取った場合により上手に
     処理するようになりました。以前は ‘StreamReader’ クラスは不足データ
     を読み出そうと試みるために、それがストリームからデコード処理を再開
     することを不可能にしていました。 ‘read()’ メソッドは今ではそのとき
     読めているデータを返し、次の呼び出しで以前の読み残しのデコード処理
     から再開します。(Implemented by Walter Dörwald.)

   * There is a new *note collections: 1e. module for various
     specialized collection datatypes.  Currently it contains just one
     type, ‘deque’, a double-ended queue that supports efficiently
     adding and removing elements from either end:

          >>> from collections import deque
          >>> d = deque('ghi')        # make a new deque with three items
          >>> d.append('j')           # add a new entry to the right side
          >>> d.appendleft('f')       # add a new entry to the left side
          >>> d                       # show the representation of the deque
          deque(['f', 'g', 'h', 'i', 'j'])
          >>> d.pop()                 # return and remove the rightmost item
          'j'
          >>> d.popleft()             # return and remove the leftmost item
          'f'
          >>> list(d)                 # list the contents of the deque
          ['g', 'h', 'i']
          >>> 'h' in d                # search the deque
          True

     ‘Queue’ や *note threading: f3. のようないくつかのモジュールで、
     *note collections.deque: 7f4. を生かして性能改善を成し遂げています
     。 (Contributed by Raymond Hettinger.)

   * The *note ConfigParser: 26. classes have been enhanced slightly.
     The *note read(): 1681. method now returns a list of the files that
     were successfully parsed, and the *note set(): 1484. method raises
     *note TypeError: 198. if passed a 'value' argument that isn't a
     string.  (Contributed by John Belmonte and David Goodger.)

   * *note curses: 2f. モジュールが ncurses 拡張の
     ‘use_default_colors()’ をサポートするようになりました。透明性をサポ
     ートするターミナルを持つプラットフォームならば、このことで透明背景
     に出来ます。 (Contributed by Jörg Lehmann.)

   * *note difflib: 3b. モジュールに ‘HtmlDiff’ クラスが追加されています
     。これは対象テキストをサイドバイサイドで視覚化する HTML テーブルを
     作ります。 (Contributed by Dan Gass.)

   * *note email: 3f. パッケージがバージョン 3.0 に更新されています。多
     くの非推奨だった API が削除され、Python 2.3 以前のバージョンへのサ
     ポートが削除されています。パッケージのバージョン 3.0 は MIME メッセ
     ージについての漸増的な新パーサを使います。これは ‘email.FeedParser’
     モジュールで利用可能です。この新パーサはメモリ内に全てのメッセージ
     を読み込んでおく必要がなく、メッセージが不正であっても例外は投げま
     せん; 代わりにメッセージの全ての問題についてを ‘defect’ 属性に記録
     します。 (Developed by Anthony Baxter, Barry Warsaw, Thomas
     Wouters, and others.)

   * *note heapq: 6d. モジュールは C に変換されました。性能改善は 10 倍
     となり、モジュールはより大きなデータを扱うのに相応しいものになりま
     した。加えて、モジュールには新しく 2 つの関数が追加されました。それ
     は ‘nlargest()’ と ‘nsmallest()’ で、データセット内の大きいものから
     N 番目まで、小さいものから N 番目までを、高価な完全なソートを要する
     ことなく取り出すのに使います。(Contributed by Raymond Hettinger.)

   * The *note httplib: 72. module now contains constants for HTTP
     status codes defined in various HTTP-related RFC documents.
     Constants have names such as ‘OK’, ‘CREATED’, ‘CONTINUE’, and
     ‘MOVED_PERMANENTLY’; use pydoc to get a full list.  (Contributed by
     Andrew Eland.)

   * *note imaplib: 78. モジュールが IMAP の THREAD コマンドをサポートす
     るようになりました。 (contributed by Yves Dionne) また、
     ‘deleteacl()’ メソッドと ‘myrights()’ メソッドが追加されました。
     (contributed by Arnaud Mazin).

   * *note itertools: 85. モジュールに ‘groupby(iterable[, *func*])’ 関
     数が追加されました。 'iterable' は何か要素のストリームを返すものを
     イテレート出来るもので、省略可能な 'func' パラメータは要素を取って
     キー値を返す関数です。省略されればキーは要素自身です。 ‘groupby()’
     は要素群をキー値の合致ごとサブシーケンスにグループ化して、キー値と
     サブシーケンスに対するイテレータを組とする 2 要素タプルのシリーズを
     返します。

     例をお見せするのが早いでしょう。ここでは 'key' 関数は単に数値が偶数
     か奇数かを返すだけです。 ‘groupby()’ の結果は偶数または奇数の一連の
     流れを返します:

          >>> import itertools
          >>> L = [2, 4, 6, 7, 8, 9, 11, 12, 14]
          >>> for key_val, it in itertools.groupby(L, lambda x: x % 2):
          ...    print key_val, list(it)
          ...
          0 [2, 4, 6]
          1 [7]
          0 [8]
          1 [9, 11]
          0 [12, 14]
          >>>

     ‘groupby()’ は典型的にはソート済み入力に使います。 ‘groupby()’ のロ
     ジックは除外、数え上げ、重複要素の特定を手軽に行う Unix の ‘uniq’ フ
     ィルタに似ています:

          >>> word = 'abracadabra'
          >>> letters = sorted(word)   # Turn string into a sorted list of letters
          >>> letters
          ['a', 'a', 'a', 'a', 'a', 'b', 'b', 'c', 'd', 'r', 'r']
          >>> for k, g in itertools.groupby(letters):
          ...    print k, list(g)
          ...
          a ['a', 'a', 'a', 'a', 'a']
          b ['b', 'b']
          c ['c']
          d ['d']
          r ['r', 'r']
          >>> # List unique letters
          >>> [k for k, g in groupby(letters)]
          ['a', 'b', 'c', 'd', 'r']
          >>> # Count letter occurrences
          >>> [(k, len(list(g))) for k, g in groupby(letters)]
          [('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)]

     (Contributed by Hye-Shik Chang.)

   * *note itertools: 85. には ‘tee(iterator, N)’ という新たな関数も追加
     されています。これは 'iterator' の、独立した 'N' 個の複製イテレータ
     を返します。 'N' は省略されればデフォルトは 2 です。:

          >>> L = [1,2,3]
          >>> i1, i2 = itertools.tee(L)
          >>> i1,i2
          (<itertools.tee object at 0x402c2080>, <itertools.tee object at 0x402c2090>)
          >>> list(i1)               # Run the first iterator to exhaustion
          [1, 2, 3]
          >>> list(i2)               # Run the second iterator to exhaustion
          [1, 2, 3]

     ‘tee()’ がイテレータから返される値のコピーを維持する必要があること
     に注意してください。最悪の場合はそれら全てを維持する必要があるかも
     しれません。ですのでこれは長丁場の入力に対して、先行するイテレータ
     が後続のイテレータの遥か先を突っ走れる場合には注意深く使わなければ
     なりません。その分断が大きいようであれば、 *note list(): 24d. を代
     わりに使うほうが良いかもしれません。イテレータたちが相互に近い場所
     を追跡する場合は ‘tee()’ は理想的です。ブックマーク、ウィンドウ処理
     、あるいは先読みイテレータといったものに適用出来るのではないでしょ
     うか。 (Contributed by Raymond Hettinger.)

   * A number of functions were added to the *note locale: 8a. module,
     such as ‘bind_textdomain_codeset()’ to specify a particular
     encoding and a family of ‘l*gettext()’ functions that return
     messages in the chosen encoding.  (Contributed by Gustavo
     Niemeyer.)

   * *note logging: 8b. パッケージの ‘basicConfig()’ 関数に、ログ設定を
     簡単にするいくつかのキーワード引数が追加されました。デフォルトの振
     る舞いはログメッセージを標準エラー出力に出力することですが、様々な
     キーワード引数でログを特定のファイルに書いたり、ログのフォーマット
     を変えたり、ロギングのレベルを変えたり出来ます。例えば:

          import logging
          logging.basicConfig(filename='/var/log/application.log',
              level=0,  # Log all messages
              format='%(levelname):%(process):%(thread):%(message)')

     ほかの *note logging: 8b. パッケージへの追加としては、 便利メソッド
     ‘log(level, msg)’ や、ログファイルを時間間隔でローテートするクラス
     ‘TimedRotatingFileHandler’ などがあります。モジュールには元々
     ‘RotatingFileHandler’ が含まれており、こちらはファイルが特定のサイ
     ズを超過した場合にローテートするものです。両クラスとも新しく導出さ
     れた ‘BaseRotatingHandler’ 基底クラスから派生していて、これはまた別
     のローテートするハンドラを実装するのに使えます。

     (Changes implemented by Vinay Sajip.)

   * *note marshal: 91. モジュールが、データ構造のアンパックで内部化した
     文字列を共有するようになりました。これはある種の pickle 文字列のサ
     イズを切り詰めるでしょうが、主要な効能は ‘.pyc’ ファイルが顕著に小
     さくなることです。(Contributed by Martin von Löwis.)

   * The ‘nntplib’ module's ‘NNTP’ class gained ‘description()’ and
     ‘descriptions()’ methods to retrieve newsgroup descriptions for a
     single group or for a range of groups.  (Contributed by Jürgen A.
     Erhard.)

   * *note operator: a3. モジュールに 2 つの関数 ‘attrgetter(attr)’ と
     ‘itemgetter(index)’ が追加されています。両関数ともに、単一引数を取
     ってそれに対応する属性かアイテムを返す呼び出し可能オブジェクトを返
     します。これら呼び出し可能オブジェクトは *note map(): 19f. や *note
     sorted(): dc7. とともに使う際の優れたデータ抽出器になります。例えば
     :

          >>> L = [('c', 2), ('d', 1), ('a', 4), ('b', 3)]
          >>> map(operator.itemgetter(0), L)
          ['c', 'd', 'a', 'b']
          >>> map(operator.itemgetter(1), L)
          [2, 1, 4, 3]
          >>> sorted(L, key=operator.itemgetter(1)) # Sort list by second tuple item
          [('d', 1), ('c', 2), ('b', 3), ('a', 4)]

     (Contributed by Raymond Hettinger.)

   * *note optparse: a4. モジュールが色々更新されました。モジュールはメ
     ッセージを *note gettext.gettext(): 1682. を通して Optik のヘルプと
     エラーメッセージを国際化するのを可能にしています。オプションのヘル
     プメッセージは文字列 ‘'%default'’ を含めることが出来るようになって
     おり、これはオプションのデフォルト値に置換されます。(Contributed by
     Greg Ward.)

   * The long-term plan is to deprecate the ‘rfc822’ module in some
     future Python release in favor of the *note email: 3f. package.  To
     this end, the *note email.Utils.formatdate: 1683. function has been
     changed to make it usable as a replacement for
     ‘rfc822.formatdate()’.  You may want to write new e-mail processing
     code with this in mind.  (Change implemented by Anthony Baxter.)

   * *note os: a5. モジュールに ‘urandom(n)’ が追加されました。これは
     'n' バイトの乱数データを含む文字列を返します。この関数はプラットフ
     ォーム固有の乱数発生源にアクセスします。例えば Linux での
     ‘/dev/urandom’ や Windows での CryptoAPI です。 (Contributed by
     Trevor Perrin.)

   * もう一つの新規関数 ‘os.path.lexists(path)’ は 'path' によって指定さ
     れたファイルがそれがシンボリックリンクかどうかによらず、存在してい
     る場合に真を返します。これは、既存の ‘os.path.exists(path)’ 関数が
     'path' がシンボリックリンクでその指し先が存在しない場合に偽を返すの
     とは異なります。 (Contributed by Beni Cherniavsky.)

   * *note os: a5. モジュールの下層にある *note posix: b2. モジュールに
     ‘getsid()’ 関数が追加されました。 (Contributed by J. Raynor.)

   * *note poplib: b1. モジュールが POP over SSL をサポートするようにな
     りました.  (Contributed by Hector Urtubia.)

   * *note profile: b4. モジュールが C 拡張の関数をプロファイル出来るよ
     うになりました。 (Contributed by Nick Bastin.)

   * *note random: bd. モジュールに、 ‘getrandbits(N)’ 関数が追加されま
     した。 'N' ビット長の長整数を返します。既存の ‘randrange()’ メソッ
     ドは ‘getrandbits()’ を適切な場所で使うようになり、任意の大きな乱数
     値生成をより効果的にしています。 (Contributed by Raymond
     Hettinger.)

   * *note re: be. モジュールの正規表現言語が拡張されて、単純な条件式
     ‘(?(group)A|B)’ を書けるようになっています。 'group' は数値グループ
     ID か正規表現内で ‘(?P<group>...)’ で定義したグループ名のどちらかで
     す。指定したグループが合致した場合は、正規表現パターン 'A' が文字列
     に対してテストされ、そうでなければパターン 'B' が代わりに試されます
     。(Contributed by Gustavo Niemeyer.)

   * *note re: be. モジュールはもう再帰をすることはありません。Gustavo
     Niemeyer による膨大な量の仕事のおかげです。再帰する正規表現エンジン
     では、ある種のパターンでは大量の C スタック空間を消費し、スタックの
     オーバーフローを起こすことがありました。例えば表現 ‘(a|b)+’ が文字
     ‘a’ から成る 3 万バイトの文字列に対してマッチすると、一文字ごとに一
     つのスタックフレームを消費していました。Python 2.3 ではスタックオー
     バーフローのチェックを試みて *note RuntimeError: 244. を投げようと
     しましたが、ある種のパターンではチェックをすり抜けてしまって、運が
     悪いとセグメンテーション違反を起こしていました。Python 2.4 の正規表
     現エンジンではこのパターンと問題を起こすことなくマッチ出来ます。

   * *note signal: cb. モジュールで、 *note signal.signal(): 134c. への
     パラメータのエラーチェックを厳しくしています。例えば ‘SIGKILL’ シグ
     ナルへのハンドラはセット出来ません。以前のバージョンの Python では
     これを黙って受け容れていましたが、2.4 では *note RuntimeError: 244.
     を投げます。

   * *note socket: d1. モジュールに 2 つ新しい関数が追加されています。
     ‘socketpair()’ 関数は接続したソケットのペアを返し、
     ‘getservbyport(port)’ は与えたポート番号からサービス名を探して返し
     ます。(Contributed by Dave Cole and Barry Warsaw.)

   * ‘sys.exitfunc()’ 関数は非推奨となりました。コードは既存の *note
     atexit: d. モジュールを使うべきです。これは複数の終了関数呼び出しを
     正しく処理出来ます。結果的には ‘sys.exitfunc()’ は純粋に *note
     atexit: d. のみから使われる内部インターフェイスとなるでしょう。

   * *note tarfile: e4. モジュールがデフォルトで GNU フォーマットを生成
     するようになっています。 (Contributed by Lars Gustäbel.)

   * *note threading: f3. モジュールで、スレッドローカルなデータのサポー
     トについて、品の良い単純な方法でサポート出来ました。モジュールは
     ‘local’ クラスを持っており、その属性値は異なるスレッドごとにローカ
     ルになります:

          import threading

          data = threading.local()
          data.number = 42
          data.url = ('www.python.org', 80)

     この場合他のスレッドは ‘number’ 属性、 ‘url’ 属性に自身の値を代入、
     抽出出来ます。 ‘local’ クラスは属性初期化であるとかメソッドの追加の
     ためにサブクラス化することも出来ます。 (Contributed by Jim Fulton.)

   * *note timeit: f5. モジュールはループを計測中は周期的なガーベージコ
     レクションを自動で無効化するようになりました。この変更により、繰り
     返しの計測の比較がやりやすくなります。 (Contributed by Raymond
     Hettinger.)

   * *note weakref: 11a. モジュールがサポートするオブジェクトが非常に幅
     広くなりました。これには Python 関数、クラスインスタンス, set,
     frozenset, deque, array と正規表現パターンオブジェクトが含まれます
     。(Contributed by Raymond Hettinger.)

   * The *note xmlrpclib: 134. module now supports a multi-call
     extension for transmitting multiple XML-RPC calls in a single HTTP
     operation.  (Contributed by Brian Quinlan.)

   * ‘mpz’, ‘rotor’, ‘xreadlines’ モジュールは削除されました。

* Menu:

* cookielib::
* doctest: doctest<5>.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc3548.html


File: python.info,  Node: cookielib,  Next: doctest<5>,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール<3>

1.19.12.1 cookielib
...................

The *note cookielib: 74. library supports client-side handling for HTTP
cookies, mirroring the *note Cookie: 75. module's server-side cookie
support.  Cookies are stored in cookie jars; the library transparently
stores cookies offered by the web server in the cookie jar, and fetches
the cookie from the jar when connecting to the server.  As in web
browsers, policy objects control whether cookies are accepted or not.

セッションを跨いでクッキーを記憶するために、2 つのクッキー瓶実装が提供さ
れています。一つは Netscape フォーマットでクッキーを記憶するのでアプリケ
ーションは Mozilla か Lynx のクッキーファイルを使え、もう一つは Perl の
libwww ライブラリと同じフォーマットでクッキーを記憶します。

*note urllib2: 111. has been changed to interact with *note cookielib:
74.: ‘HTTPCookieProcessor’ manages a cookie jar that is used when
accessing URLs.

このモジュールは John J. Lee により寄稿されました。


File: python.info,  Node: doctest<5>,  Prev: cookielib,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール<3>

1.19.12.2 doctest
.................

Edward Loper と Tim Peters のおかげにより、 *note doctest: 3e. モジュー
ルに注目に値するリファクタリングが入りました。テストはこれまで通り単純に
*note doctest.testmod(): 1686. を実行するすることで行えますが、リファク
タリングはモジュールの操作をカスタマイズする色々な手段を提供してくれます
。

新規クラス ‘DocTestFinder’ は指定したオブジェクトの docstring からテスト
を抽出します:

     def f (x, y):
         """>>> f(2,2)
     4
     >>> f(3,2)
     6
         """
         return x*y

     finder = doctest.DocTestFinder()

     # Get list of DocTest instances
     tests = finder.find(f)

新規クラス ‘DocTestRunner’ はテストを個々に実行し、結果の要約を生成出来
ます:

     runner = doctest.DocTestRunner()
     for t in tests:
         tried, failed = runner.run(t)

     runner.summarize(verbose=1)

上の例はこのような出力を生成します:

     1 items passed all tests:
        2 tests in f
     2 tests in 1 items.
     2 passed and 0 failed.
     Test passed.

‘DocTestRunner’ は実際の出力と結果の期待値の比較に、 ‘OutputChecker’ の
インスタンスを使います。このクラスはその振る舞いをカスタマイズする色々な
フラグを取ります。意欲的なユーザであれば ‘OutputChecker’ の完全な新しい
サブクラスも書けます。

デフォルトの出力チェッカーは多くのお手軽機能を持っています。例えば *note
doctest.ELLIPSIS: 1687. オプションフラグは、出力の期待値内での省略記号
(‘...’) と任意文字列を一致するとみなし、瑣末な部分が変化するような出力に
簡単に適合するように出来ます:

     def o (n):
         """>>> o(1)
     <__main__.C instance at 0x...>
     >>>
     """

もう一つの特殊文字列 ‘<BLANKLINE>’ は空行に合致します:

     def p (n):
         """>>> p(1)
     <BLANKLINE>
     >>>
     """

もう一つの新機能は出力の diff スタイル出力で、オプションフラグに *note
doctest.REPORT_UDIFF: 1688. (unified diffs), *note doctest.REPORT_CDIFF:
1689. (context diffs), *note doctest.REPORT_NDIFF: 168a. (delta-style) を
指定することで利用出来ます。例えば以下があるとして:

     def g (n):
         """>>> g(4)
     here
     is
     a
     lengthy
     >>>"""
         L = 'here is a rather lengthy list of words'.split()
         for word in L[:n]:
             print word

Running the above function's tests with *note doctest.REPORT_UDIFF:
1688. specified, you get the following output:

     **********************************************************************
     File "t.py", line 15, in g
     Failed example:
         g(4)
     Differences (unified diff with -expected +actual):
         @@ -2,3 +2,3 @@
          is
          a
         -lengthy
         +rather
     **********************************************************************


File: python.info,  Node: ビルドならびに C API の変更<11>,  Next: Python 2 4 への移植,  Prev: 新たなモジュール、改良されたモジュール、非推奨のモジュール<3>,  Up: What's New in Python 2 4

1.19.13 ビルドならびに C API の変更
-----------------------------------

Python のビルド過程と C API の変更は以下の通りです:

   * 拡張関数からの戻り値として一般的に使うための 3 つの便利なマクロが追
     加されています: *note Py_RETURN_NONE: 168c, *note Py_RETURN_TRUE:
     168d, *note Py_RETURN_FALSE: 168e. (Contributed by Brett Cannon.)

   * Another new macro, *note Py_CLEAR: 798, decreases the reference
     count of 'obj' and sets 'obj' to the null pointer.  (Contributed by
     Jim Fulton.)

   * 新規関数 ‘PyTuple_Pack(N, obj1, obj2, ..., objN)’ は Python オブジ
     ェクトの可変長引数リストからタプルを構築します。 (Contributed by
     Raymond Hettinger.)

   * 新規関数 ‘PyDict_Contains(d, k)’ は、処理内で起こる例外のマスキング
     なしでの高速なルックアップを実装しています。 (Contributed by
     Raymond Hettinger.)

   * The *note Py_IS_NAN: 168f.(X) macro returns 1 if its float or
     double argument 'X' is a NaN. (Contributed by Tim Peters.)

   * C code can avoid unnecessary locking by using the new
     ‘PyEval_ThreadsInitialized()’ function to tell if any thread
     operations have been performed.  If this function returns false, no
     lock operations are needed.  (Contributed by Nick Coghlan.)

   * 新規関数 *note PyArg_VaParseTupleAndKeywords(): 625. は *note
     PyArg_ParseTupleAndKeywords(): 624. と同じですが、たくさんの引数の
     代わりに ‘va_list’ を取ることだけが違います。(Contributed by Greg
     Chapman.)

   * A new method flag, *note METH_COEXIST: 1690, allows a function
     defined in slots to co-exist with a *note PyCFunction: 1691. having
     the same name.  This can halve the access time for a method such as
     ‘set.__contains__()’.  (Contributed by Raymond Hettinger.)

   * Python can now be built with additional profiling for the
     interpreter itself, intended as an aid to people developing the
     Python core.  Providing ‘--enable-profiling’ to the ‘configure’
     script will let you profile the interpreter with ‘gprof’, and
     providing the ‘--with-tsc’ switch enables profiling using the
     Pentium's Time-Stamp-Counter register.  Note that the ‘--with-tsc’
     switch is slightly misnamed, because the profiling feature also
     works on the PowerPC platform, though that processor architecture
     doesn't call that register "the TSC register".  (Contributed by
     Jeremy Hylton.)

   * The ‘tracebackobject’ type has been renamed to ‘PyTracebackObject’.

* Menu:

* ポート特有の変更: ポート特有の変更<2>.


File: python.info,  Node: ポート特有の変更<2>,  Up: ビルドならびに C API の変更<11>

1.19.13.1 ポート特有の変更
..........................

   * Windows ポートは MSVC++ 6 と 7.1 でビルド出来ます。 (Contributed by
     Martin von Löwis.)


File: python.info,  Node: Python 2 4 への移植,  Next: 謝辞<4>,  Prev: ビルドならびに C API の変更<11>,  Up: What's New in Python 2 4

1.19.14 Python 2.4 への移植
---------------------------

このセクションでは前述の変更により必要となるかもしれないコードの変更を列
挙します:

   * 大き過ぎる値を持つ左シフトと 16 進/ 8 進定数が *note FutureWarning:
     659. を引き起こした上で 32 ビットまたは 64 ビットに制限される、とい
     う振る舞いはもうしません。代わりに長整数を返します。

   * 整数演算はもはや ‘OverflowWarning’ は引き起こしません。
     ‘OverflowWarning’ 警告は Python 2.5 で撤廃されます。

   * ビルトイン関数の *note zip(): 1a0. と ‘itertools.izip()’ が引数なし
     で呼ばれた場合に、 *note TypeError: 198. 例外を起こすのではなく空リ
     ストを返すようになりました。

   * You can no longer compare the ‘date’ and *note datetime: 4e2.
     instances provided by the *note datetime: 34. module.  Two
     instances of different classes will now always be unequal, and
     relative comparisons (‘<’, ‘>’) will raise a *note TypeError: 198.

   * ‘dircache.listdir()’ now passes exceptions to the caller instead of
     returning empty lists.

   * ‘LexicalHandler.startDTD()’ はパブリックでシステムの ID を間違った
     順序で受け取っていました。これは修正されました; この間違った順序に
     依存したアプリケーションは修正しなければなりません。

   * *note fcntl.ioctl(): 1694. は 'mutate_flag' 引数が省略されて問題に
     関係がある場合は警告を出します。

   * *note tarfile: e4. モジュールがデフォルトで GNU フォーマットを生成
     するようになっています。

   * Encountering a failure while importing a module no longer leaves a
     partially initialized module object in ‘sys.modules’.

   * *note None: 885. が定数になっています。 ‘None’ という名前に新しい値
     を割り当てようとするコードは、今では構文エラーになります。

   * ‘signals.signal()’ 関数は、ある種の不正な値では *note RuntimeError:
     244. を投げるようになっています。以前はこれらエラーは黙って通してい
     ました。例えばもう ‘SIGKILL’ へはハンドラは渡せません。


File: python.info,  Node: 謝辞<4>,  Prev: Python 2 4 への移植,  Up: What's New in Python 2 4

1.19.15 謝辞
------------

著者は提案の申し出や修正、様々なこの記事の草稿の助けをしてくれた以下の人
々に感謝します: Koray Can, Hye-Shik Chang, Michael Dyck, Raymond
Hettinger, Brian Hurt, Hamish Lawson, Fredrik Lundh, Sean Reifschneider,
Sadruddin Rejeb.


File: python.info,  Node: What's New in Python 2 3,  Next: What's New in Python 2 2,  Prev: What's New in Python 2 4,  Up: What's New in Python

1.20 What's New in Python 2.3
=============================


著者: A.M. Kuchling

この文書は Python 2.3 の新機能について解説します。Python 2.3 は 2003 年
7 月 29 日にリリースされました。

Python 2.3 の主要なテーマは、2.2 で追加されたいくつかの機能を磨くこと、
言語中核に小さいながらも有用な種々の拡張をすること、そして標準ライブラリ
の拡充です。ひとつ前のバージョンで導入された新しいオブジェクトモデルは、
18 ヶ月に渡るバグフィックスと新スタイルクラスの性能改善をもたらした最適
化の努力の恩恵を受けました。 *note sum(): 695, *note enumerate(): 169a.
のような、新たなビルトイン関数が少し追加されました。 *note in: 34b. 演算
子がサブストリングの検索に使えるようになりました (例えば ‘"ab" in "abc"’
は *note True: e07. を返します)。

たくさんのライブラリ新機能…、Boolean、 set、 heap、 日付/時刻データ型、
ZIP 形式アーカイブからのモジュールインポート、待ち望まれていた Python カ
タログのためのメタデータサポート、更新されたバージョンの IDLE、ロギング
メッセージのためのモジュール、テキストの折り返し、CSV ファイルの解析、コ
マンドラインオプションの処理、BerkeleyDB データベースの使用…、新機能、強
化機能のリストは長大になります。

このドキュメントは個々の新機能の完全な詳細を提供するのではなくて、簡易な
概要を提供することを目的にしています。完全な詳細が知りたければ、 Python
ライブラリリファレンス、Python リファレンスマニュアルのような Python 2.4
のドキュメントを参照してください。設計と実装の根拠を理解したい場合は、新
機能に関する PEP を参照してください。

* Menu:

* PEP 218; 標準の集合データ型: PEP 218 標準の集合データ型.
* PEP 255; 単純なジェネレータ: PEP 255 単純なジェネレータ.
* PEP 263; ソースコードのエンコーディング: PEP 263 ソースコードのエンコーディング.
* PEP 273; Zip アーカイブからモジュールをインポートする: PEP 273 Zip アーカイブからモジュールをインポートする.
* PEP 277; Windows NT での Unicode ファイル名サポート: PEP 277 Windows NT での Unicode ファイル名サポート.
* PEP 278; Universal Newline サポート: PEP 278 Universal Newline サポート.
* PEP 279; enumerate(): PEP 279 enumerate.
* PEP 282; ロギングパッケージ: PEP 282 ロギングパッケージ.
* PEP 285; Boolean 型: PEP 285 Boolean 型.
* PEP 293; コーデックエラーを処理するコールバック: PEP 293 コーデックエラーを処理するコールバック.
* PEP 301; パッケージインデクスと、 Distutils のためのメタデータ: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ.
* PEP 302; 新たなインポートフック: PEP 302 新たなインポートフック.
* PEP 305; カンマ区切り形式ファイル: PEP 305 カンマ区切り形式ファイル.
* PEP 307; Pickle の機能拡張: PEP 307 Pickle の機能拡張.
* 拡張スライス::
* その他の言語変更: その他の言語変更<18>.
* 新たなモジュール、改良されたモジュール、非推奨のモジュール: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>.
* Pymalloc; 特殊化されたオブジェクトアロケータ: Pymalloc 特殊化されたオブジェクトアロケータ.
* ビルドならびに C API の変更: ビルドならびに C API の変更<12>.
* その他の変更と修正: その他の変更と修正<2>.
* Python 2.3 への移植: Python 2 3 への移植.
* 謝辞: 謝辞<5>.


File: python.info,  Node: PEP 218 標準の集合データ型,  Next: PEP 255 単純なジェネレータ,  Up: What's New in Python 2 3

1.20.1 PEP 218: 標準の集合データ型
----------------------------------

(--訳注: イキナリですが、あなたが今これを「Python の歴史を知る」もしくは
「初登場時の熱量高い紹介」を読みたくて読んでいるのでない限りは、もしくは
本当に今 2.3 を使う必要があれば別ですが、このモジュールは 2.4 で既にビル
トインで置き換えられ、2.6 では非推奨となり、3.0 では削除されています。の
で、集合型について知りたければここよりも 2.4 のビルトインの方から読んだ
方が良いです。--) -- 新しいモジュール ‘sets’ には、集合データ型の実装が
含まれています。 ‘Set’ クラスは *note mutable: 15ba. の集合のためのクラ
スで、メンバの追加と削除が出来ます。 ‘ImmutableSet’ は変更できない集合の
ためのクラスなので、‘ImmutableSet’ のインスタンスを辞書のキーとして利用
出来ます。集合型は辞書の上に構築されているので、集合内の要素はハッシュ可
能でなければなりません。

単純な使用例です:

     >>> import sets
     >>> S = sets.Set([1,2,3])
     >>> S
     Set([1, 2, 3])
     >>> 1 in S
     True
     >>> 0 in S
     False
     >>> S.add(5)
     >>> S.remove(3)
     >>> S
     Set([1, 2, 5])
     >>>

The union and intersection of sets can be computed with the *note
union(): 169c. and *note intersection(): 169d. methods; an alternative
notation uses the bitwise operators ‘&’ and ‘|’.  Mutable sets also have
in-place versions of these methods, ‘union_update()’ and *note
intersection_update(): 169e.

     >>> S1 = sets.Set([1,2,3])
     >>> S2 = sets.Set([4,5,6])
     >>> S1.union(S2)
     Set([1, 2, 3, 4, 5, 6])
     >>> S1 | S2                  # Alternative notation
     Set([1, 2, 3, 4, 5, 6])
     >>> S1.intersection(S2)
     Set([])
     >>> S1 & S2                  # Alternative notation
     Set([])
     >>> S1.union_update(S2)
     >>> S1
     Set([1, 2, 3, 4, 5, 6])
     >>>

It's also possible to take the symmetric difference of two sets.  This
is the set of all elements in the union that aren't in the intersection.
Another way of putting it is that the symmetric difference contains all
elements that are in exactly one set.  Again, there's an alternative
notation (‘^’), and an in-place version with the ungainly name *note
symmetric_difference_update(): 169f.

     >>> S1 = sets.Set([1,2,3,4])
     >>> S2 = sets.Set([3,4,5,6])
     >>> S1.symmetric_difference(S2)
     Set([1, 2, 5, 6])
     >>> S1 ^ S2
     Set([1, 2, 5, 6])
     >>>

‘issubset()’ と ‘issuperset()’ メソッドも使えます。これはある集合が部分
集合、上位集合であるかとうかをチェックします:

     >>> S1 = sets.Set([1,2,3])
     >>> S2 = sets.Set([2,3])
     >>> S2.issubset(S1)
     True
     >>> S1.issubset(S2)
     False
     >>> S1.issuperset(S2)
     True
     >>>

参考
....

PEP 218(1) - 集合オブジェクト型をビルトインに追加する

     PEP 著 Greg V. Wilson.  実装: Greg V. Wilson, Alex Martelli, GvR.
     (--訳注: PEPそのものは 2.4 のビルトイン型 set, frozenset の追加と同
     じものですが、2.3 ではモジュールとして追加され、2.4 でビルトイン版
     が追加され、2.6 でモジュール版が非推奨となった、という流れです。--)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0218/


File: python.info,  Node: PEP 255 単純なジェネレータ,  Next: PEP 263 ソースコードのエンコーディング,  Prev: PEP 218 標準の集合データ型,  Up: What's New in Python 2 3

1.20.2 PEP 255: 単純なジェネレータ
----------------------------------

Python 2.2 では、ジェネレータが ‘from __future__ import generators’ ディ
レクティブで有効に出来るオプションの機能として追加されました。2.3 ではジ
ェネレータは特別に有効化する必要なく、もうキーワード *note yield: bc2. と
して、いつでもそこにあります。このセクションの残りの部分は "What's New
in Python 2.2" のジェネレータの記述からの丸々コピーですので、2.2 のとき
に読んだなら読み飛ばしてもらって結構です。

Python や C の標準的な関数コールについては、よくご存じに違いありません。
関数を呼ぶと、ローカル変数を作るプライベートな名前空間ができますね。その
関数が *note return: 1af. 文まで来ると、ローカル変数が破壊されてから、返
り値が呼び出し元に返ります。次に同じ関数をもう一度呼ぶと、新しいプライベ
ート名前空間に新規のローカル変数が作られるのです。しかし、関数を出るとき
にローカル変数を捨てなければどうなるでしょうか。その出ていったところから
関数を続行できたとしたら、どうでしょう。これこそジェネレータが提供する機
能です; すなわち、ジェネレータは続行できる関数と考えることができます。

ジェネレータ関数の最も単純な例です:

     def generate_ints(N):
         for i in range(N):
             yield i

新しいキーワード *note yield: bc2. がジェネレータのために導入されました
。 ‘yield’ ステートメントを含むどんな関数もジェネレータ関数です; Python
バイトコードコンパイラはこれを検知し、関数が特別に扱われるように翻訳しま
す。 (--訳注: Python 2.5 の PEP 342 も参照して下さい。この 2.2 で導入時
点の ‘yield’ はステートメントではなく式に変更されています。--)

ジェネレータ関数を呼び出すと、単一の値の代わりにイテレータプロトコルに対
応したオブジェクトを返します。上の例で ‘yield’ を実行したとき、ジェネレ
ータは ‘return’ 文のようにして ‘i’ の値を生成します。 ‘yield’ と
‘return’ 文の大きな違いは、 ‘yield’ に到達した段階でジェネレータの実行状
態が一時停止になって、ローカル変数が保存される点です。次回そのジェネレー
タの ‘.next()’ メソッドを呼ぶと、 ‘yield’ の直後から関数が実行を再開しま
す。(複雑な理由により、 ‘yield’ は ‘try’...*note finally: 1b0. の ‘try’
ブロック内に含めることは許されていません; PEP 255(1) に ‘yield’ と例外の
相互作用についての詳細説明がありますので参照して下さい。) -- (--訳注:
Python 2.5 の PEP 342 で *note try: 8f8...*note finally: 1b0. 内に置けな
いという制約はなくなりました。また、 *note try: 8f8...*note finally:
1b0. の *note try: 8f8. 、とここであえて特定しているのは、同じく 2.5 の
PEP 341 によって try/except/finally の一体化されるまでは、 ‘finally’ の
‘try’ と ‘except’ の ‘try’ が別物だったからです。--)

上記の ‘generate_ints()’ ジェネレータはこんな具合に使います:

     >>> gen = generate_ints(3)
     >>> gen
     <generator object at 0x8117f90>
     >>> gen.next()
     0
     >>> gen.next()
     1
     >>> gen.next()
     2
     >>> gen.next()
     Traceback (most recent call last):
       File "stdin", line 1, in ?
       File "stdin", line 2, in generate_ints
     StopIteration

同じく ‘for i in generate_ints(5)’ や ‘a,b,c = generate_ints(3)’ といっ
た書き方もできます。

ジェネレータ関数内で *note return: 1af. 文は、引数を付けずに、処理の終わ
りを知らせるためにだけ使うことができます; ‘return’ を実行したあとは、も
うそのジェネレータが値を返すことはできません。ジェネレータ関数の中では、
‘return 5’ などと値を付けた ‘return’ は構文エラーです。ジェネレータの出
力が終わったことを示すには、ほかにも、手動で *note StopIteration: df5. を
投げてもいいですし、関数の最後まで実行するだけでも同じことになります。
(--訳注: Python 2.7 まではジェネレータ内での戻り値のある ‘return 5’ は構
文エラーになりますが、少なくとも Python 3.4 で構文エラーとはなりません。
単に無視されます。リファレンスに言及されていない振舞いなので、何かの事故
かもしれません。いずれにせよジェネレータ内では Python 3 でも ‘return’ で
値は戻せません。--)

自分でクラスを書いて、ジェネレータで言うところのローカル変数をインスタン
ス変数として全部保管しておけば、同じ効果を得ることは可能です。たとえば整
数のリストを返すのは、 ‘self.count’ を 0 にして、 *note next(): 9d8. メ
ソッドが ‘self.count’ をインクリメントして返すようにすればできます。しか
しながら、ある程度複雑なジェネレータになってくると、同じことをするクラス
を書くのは格段にややこしいことになります。 ‘Lib/test/test_generators.py’
にはもっと面白い例がたくさん含まれています。一番単純な一つは、ジェネレー
タを再帰的に使ってツリーを順繰りに横断する実装をするこれです (--訳注: ジ
ェネレータは現在の最新 3.5 までの間に 2 度大きな機能強化が行われているの
ですが、一つが 2.5 での PEP 342 でこれは yield 「に」値を戻せるようにす
るものです。もう一つが 3.3 での PEP 380 で、これはサブジェネレータへの委
譲 ‘yield from <subgen>’ の追加でした。ですのでこの 3.3 からの ‘yield
from’ を使うと下記例はもっとスッキリ書けます。--):

     # A recursive generator that generates Tree leaves in in-order.
     def inorder(t):
         if t:
             for x in inorder(t.left):
                 yield x
             yield t.label
             for x in inorder(t.right):
                 yield x

ほかにも ‘Lib/test/test_generators.py’ には、N-Queens 問題 (N×N コマのチ
ェス盤に、互いに攻撃できないような配置で N 個のクイーンを置く) やナイト
・ツアー (N×N 盤の全コマをナイトが一度ずつ通るような経路を探す) の解を出
す例が入っています。

ジェネレータの発想はほかのプログラミング言語、特に Icon
(‘https://www2.cs.arizona.edu/icon/’) から着想しています。Icon ではジェ
ネレータが言語の中枢になっています。Icon では、あらゆる式と関数がジェネ
レータのように振舞います。
‘https://www2.cs.arizona.edu/icon/docs/ipd266.htm’ の "Icon プログラミン
グ言語の概要" の一つの例が、これがどのようなものであるのかを教えてくれま
す:

     sentence := "Store it in the neighboring harbor"
     if (i := find("or", sentence)) > 5 then write(i)

Icon では ‘find()’ 関数は部分文字列 "or" が見つかる位置 3, 23, 33 を返し
ます。 *note if: 181. 文内では ‘i’ には最初 3 が代入されますが、これは 3
より小さいので比較は失敗し、Icon は次の値 23 を取り出します。 23 は 5 よ
り大きいので比較は成功し、コードは 23 をスクリーンに表示します。

Python では Icon がそうするほどにはジェネレータを中心的概念に置きません
。ジェネレータは Python 言語中核の新たな一面ではありますが、それらを学ぶ
のも使うのも誰しも行うべきだというものでもなく、そしてこれで解決できない
何か問題があれば、忘れてしまっても良いものです。Icon と比較した特筆すべ
き Python インターフェイスの機能はジェネレータの状態が具象オブジェクト
(イテレータ) で表現されることであり、それは他の関数に渡せますし、データ
構造に記憶しておくことも出来ます。(--訳注: ジェネレータについてかなり控
えめなのは、この時点で著者は将来の拡張を既に見据えていたから?  かもしれ
ませんね。PEP 342 と PEP 380 により今やジェネレータはこの頃より遥かに高
機能になっており、今ではきっと「こんなものなくても困らない」なんて
Python 使いはいないでしょう。--)

参考
....

PEP 255(2) - 単純なジェネレータ

     Neil Schemenauer, Tim Peters, Magnus Lie Hetland により著されました
     。実装のほとんどは Neil Schemenauer と Tim Peters により行われ、
     Python Labs クルーにより他の修正が行われました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0255/

   (2) https://peps.python.org/pep-0255/


File: python.info,  Node: PEP 263 ソースコードのエンコーディング,  Next: PEP 273 Zip アーカイブからモジュールをインポートする,  Prev: PEP 255 単純なジェネレータ,  Up: What's New in Python 2 3

1.20.3 PEP 263: ソースコードのエンコーディング
----------------------------------------------

Python ソースファイルで、異なる文字セットエンコーディングを宣言出来るよ
うになりました。エンコーディングはソースコードの 1 行目か 2 行目に特殊形
式のコメントを含めることで宣言出来ます。 UTF-8 ファイルであればこのよう
に宣言出来ます:

     #!/usr/bin/env python
     # -*- coding: UTF-8 -*-

このエンコーディング宣言がなければ、デフォルトの 7 ビット ASCII エンコー
ディングが使われます(訳注: Python 3 からはデフォルトは utf-8 (PEP
3120))。8 ビット文字を含んでいるのにエンコーディング宣言がないモジュール
の実行やインポートを行うと、 Python 2.3 では *note DeprecationWarning:
1a3. を引き起こします; 2.4 ではこれは構文エラーになる予定です(訳注: 実際
には 2.4 ではこれは実現せず、2.5 から)。

エンコーディング宣言は Unicode 文字列リテラルにのみ影響します。それらは
指定したエンコーディングで Unicode 文字列に変換されます。Python 識別子は
今でも ASCII 文字列に制限されていることに注意してください。ですから普通
の英数字範囲外の文字を変数名に使うことは出来ません。

参考
....

PEP 263(1) - Python ソースコードのエンコーディングを定義する

     Marc-André Lemburg、 Martin von Löwis 著; Suzuki Hisao、 Martin von
     Löwis 実装.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0263/


File: python.info,  Node: PEP 273 Zip アーカイブからモジュールをインポートする,  Next: PEP 277 Windows NT での Unicode ファイル名サポート,  Prev: PEP 263 ソースコードのエンコーディング,  Up: What's New in Python 2 3

1.20.4 PEP 273: Zip アーカイブからモジュールをインポートする
------------------------------------------------------------

新たなモジュール *note zipimport: 138. が、ZIP フォーマットの書庫からモ
ジュールのインポートをサポートします。 *note zipimport: 138. を明示的に
インポートする必要はありません; ‘sys.path’ に ZIP 形式書庫が追加されると
それは自動的にインポートされます。例えば:

     amk@nyman:~/src/python$ unzip -l /tmp/example.zip
     Archive:  /tmp/example.zip
       Length     Date   Time    Name
      --------    ----   ----    ----
          8467  11-26-02 22:30   jwzthreading.py
      --------                   -------
          8467                   1 file
     amk@nyman:~/src/python$ ./python
     Python 2.3 (#1, Aug 1 2003, 19:54:32)
     >>> import sys
     >>> sys.path.insert(0, '/tmp/example.zip')  # Add .zip file to front of path
     >>> import jwzthreading
     >>> jwzthreading.__file__
     '/tmp/example.zip/jwzthreading.py'
     >>>

‘sys.path’ には今や ZIP 書庫のファイル名も入れることが出来ます。ZIP アー
カイブ内にはどんなファイルを置いてもかまいませんが、import できるのは
‘*.py’, ‘*.pyc’, ‘*.pyo’ だけです。書庫に ‘*.py’ だけが含まれる場合には
、Python は書庫を修正して対応する ‘*.pyc’ を作るなどということはしないの
で、 ‘*.pyc’ ファイルを含まない ZIP 書庫からのインポートはやや遅いかもし
れません。

書庫内のパスをサブディレクトリ以下のみインポートするように指定出来ます;
例えば、パス ‘/tmp/example.zip/lib/’ はその書庫内の ‘lib/’ サブディレク
トリだけからインポートします。

参考
....

PEP 273(1) - Zip アーカイブからモジュールをインポートする

     このモジュールの実装も行った、James C. Ahlstrom による PEP です。
     Python 2.3 は PEP 273(2) の仕様に従っていますが、 Just van Rossum の
     書いた、 PEP 302(3) に記述されているインポートフックによる実装を使
     っています。その新しいインポートフックについては *note PEP 302;
     新たなインポートフック: 16a5. をみてください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0273/

   (2) https://peps.python.org/pep-0273/

   (3) https://peps.python.org/pep-0302/


File: python.info,  Node: PEP 277 Windows NT での Unicode ファイル名サポート,  Next: PEP 278 Universal Newline サポート,  Prev: PEP 273 Zip アーカイブからモジュールをインポートする,  Up: What's New in Python 2 3

1.20.5 PEP 277: Windows NT での Unicode ファイル名サポート
----------------------------------------------------------

Windows NT, 2000, XP では、ファイルシステムはファイル名として Unicode 文
字列を使います。伝統的に Python はファイル名をバイト文字列として表現して
きましたが、それはアクセス出来ないファイル名を表してしまう場合があって、
不十分でした。

Python はいまや (ファイルシステムの制約の範囲内での) 任意の Unicode 文字
列を *note open(): 316. 組み込み関数をはじめとするファイル名が期待される
全ての関数で許容します。 *note os.listdir(): 1312. に Unicode 文字列が渡
されれば、Python は今では Unicode 文字列のリストを返します。新しい関数
‘os.getcwdu()’ は Unicode 文字列でカレントディレクトリを返します(訳注: ち
なみに Python 3 での Unicode 周りの大改造に伴いこの関数はなくなり、代わ
りに「あえてバイト列のほうを返す」 が追加されています(‘os.getcwdu()’ が
もはや Unicode を返すので)。)。

ファイル名のバイト文字列はいまでも動きます。Windows 版 Python は透過的に
それらを Unicode に ‘mbcs’ エンコーディングを使って変換します。

Other systems also allow Unicode strings as file names but convert them
to byte strings before passing them to the system, which can cause a
*note UnicodeError: 462. to be raised.  Applications can test whether
arbitrary Unicode strings are supported as file names by checking *note
os.path.supports_unicode_filenames: 16a7, a Boolean value.

MacOS では、 *note os.listdir(): 1312. は Unicode ファイル名を返すように
なっているでしょう。

参考
....

PEP 277(1) - Windows NT での Unicode ファイル名サポート

     Neil Hodgson 著; 実装 Neil Hodgson, Martin von Löwis, Mark Hammond。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0277/


File: python.info,  Node: PEP 278 Universal Newline サポート,  Next: PEP 279 enumerate,  Prev: PEP 277 Windows NT での Unicode ファイル名サポート,  Up: What's New in Python 2 3

1.20.6 PEP 278: Universal Newline サポート
------------------------------------------

今日では 3 つの主要なオペレーティングシステムが使われています。
Microsoft Windows, Apple の Macintosh OS, さまざまな Unix 派生系です。テ
キストファイルの行終端マークに使う文字がこれら 3 つ全てでそれぞれ違って
いることが、クロスプラットフォームのための仕事における小さな苛立ちです。
Unix が使うのはラインフィード (ASCII 文字 10), MacOS が使うのはキャリッ
ジリターン (ASCII 文字 13), Windows に至ってはキャリッジリターンとライン
フィード 2 文字のシーケンスを使います。

Python のファイルオブジェクトが、動作しているプラットフォームに従わない
行終端変換をサポートするようになりました。ファイルのオープンにモード
‘'U'’ や ‘'rU'’ を使うと、 *note universal newlines: f35. モードを使った
読み込みとしてファイルを開きます。これで ‘read()’, ‘readline()’ などのフ
ァイルメソッドが、 3 つどの行終端でも ‘'\n'’ という文字列に翻訳して返す
ようになります。

universal newline サポートはモジュールのインポートと ‘execfile()’ 関数で
のファイル実行にも使われます。これで 3 つ全てのオペレーティングシステム
間で行終端変換の必要なく Python モジュールを共有出来ます。

この機能は Python をソースからビルドする際に ‘configure’ スクリプトに
‘--without-universal-newlines’ スイッチ を付けることで無効に出来ます。

参考
....

PEP 278(1) : Universal Newline サポート

     Jack Jansen 著、実装

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0278/


File: python.info,  Node: PEP 279 enumerate,  Next: PEP 282 ロギングパッケージ,  Prev: PEP 278 Universal Newline サポート,  Up: What's New in Python 2 3

1.20.7 PEP 279: enumerate()
---------------------------

新たな組み込み関数 *note enumerate(): 169a. はある種のループ処理を少し簡
潔にするものです。 'thing' がイテレータかシーケンスだとして、
‘enumerate(thing)’ は ‘(0, thing[0])’, ‘(1, thing[1])’, ‘(2, thing[2])’,
… を生成するイテレータを返します。

リストの全てを変更するためのよくあるイディオムはこのようなものでしょう:

     for i in range(len(L)):
         item = L[i]
         # ... compute some result based on item ...
         L[i] = result

これは *note enumerate(): 169a. を使ってこのように書き換えることが出来ま
す:

     for i, item in enumerate(L):
         # ... compute some result based on item ...
         L[i] = result

参考
....

PEP 279(1) - 組み込み関数 enumerate()

     Raymond D. Hettinger 著、実装.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0279/


File: python.info,  Node: PEP 282 ロギングパッケージ,  Next: PEP 285 Boolean 型,  Prev: PEP 279 enumerate,  Up: What's New in Python 2 3

1.20.8 PEP 282: ロギングパッケージ
----------------------------------

ログ記録のための標準パッケージ *note logging: 8b. が Python 2.3 に追加さ
れています。それはログ出力生成の強力で柔軟なメカニズムを提供し、フィルタ
と加工を色々な方法で行えます。標準フォーマットで書く設定ファイルで、プロ
グラムのロギングの振る舞いを制御出来ます。ログレコードを標準エラー出力や
ファイルやソケット、システムログへの送信、あるいは e-mail 送信するような
ハンドラが Python に含まれています。もちろん、あなた自身のハンドラクラス
を書くことも出来ます。

*note Logger: d46. が最も重要なクラスです。ほとんどのアプリケーションコ
ードは一つかそれ以上の *note Logger: d46. オブジェクトを扱い、それぞれ一
つはそのアプリケーションの特定のサブシステムで使われるでしょう。それぞれ
の *note Logger: d46. は名前で識別され、名前は ‘.’ をコンポーネントのセ
パレータとして使う階層で体系化されます。例えば、 ‘server’,
‘server.auth’, ‘server.network’ といった名前の *note Logger: d46. インス
タンスを持つといった具合です。この例の後ろ 2 つは階層で ‘server’ の下に
あります。 ‘server’ への冗長性を見つけた場合や ‘server’ メッセージを直接
異なるハンドラに向けた場合、変更は ‘server.auth’ と ‘server.network’ へ
のログ記録にも適用されるということです。全てのほかのロガーの親となる、ル
ート *note Logger: d46. もあります。

単純な用法のために、 *note logging: 8b. パッケージはいくつかの便利関数を
含んでいて、これは常にルートログを使います:

     import logging

     logging.debug('Debugging information')
     logging.info('Informational message')
     logging.warning('Warning:config file %s not found', 'server.conf')
     logging.error('Error occurred')
     logging.critical('Critical error -- shutting down')

これは以下のような出力をします:

     WARNING:root:Warning:config file server.conf not found
     ERROR:root:Error occurred
     CRITICAL:root:Critical error -- shutting down

In the default configuration, informational and debugging messages are
suppressed and the output is sent to standard error.  You can enable the
display of informational and debugging messages by calling the *note
setLevel(): 16ac. method on the root logger.

Notice the *note warning(): 354. call's use of string formatting
operators; all of the functions for logging messages take the arguments
‘(msg, arg1, arg2, ...)’ and log the string resulting from ‘msg % (arg1,
arg2, ...)’.

There's also an *note exception(): 16ad. function that records the most
recent traceback.  Any of the other functions will also record the
traceback if you specify a true value for the keyword argument
'exc_info'.

     def f():
         try:    1/0
         except: logging.exception('Problem recorded')

     f()

これは以下のような出力をします:

     ERROR:root:Problem recorded
     Traceback (most recent call last):
       File "t.py", line 6, in f
         1/0
     ZeroDivisionError: integer division or modulo by zero

多少なりとも高度なプログラムでは、ルートロガー以上のロガーを使うでしょう
。 ‘getLogger(name)’ 関数は特定のロガーを取得するのに使います。その時点
で存在していなければ、作成されます。 ‘getLogger(None)’ はルートロガーを
返します。:

     log = logging.getLogger('server')
      ...
     log.info('Listening on port %i', port)
      ...
     log.critical('Disk full')
      ...

Log records are usually propagated up the hierarchy, so a message logged
to ‘server.auth’ is also seen by ‘server’ and ‘root’, but a *note
Logger: d46. can prevent this by setting its *note propagate: 16ae.
attribute to *note False: d2b.

There are more classes provided by the *note logging: 8b. package that
can be customized.  When a *note Logger: d46. instance is told to log a
message, it creates a *note LogRecord: 11e8. instance that is sent to
any number of different *note Handler: 16af. instances.  Loggers and
handlers can also have an attached list of filters, and each filter can
cause the *note LogRecord: 11e8. to be ignored or can modify the record
before passing it along.  When they're finally output, *note LogRecord:
11e8. instances are converted to text by a *note Formatter: 16b0. class.
All of these classes can be replaced by your own specially written
classes.

これら全ての機能で *note logging: 8b. パッケージは最も複雑なアプリケーシ
ョンでさえ、十分な柔軟性を提供しているはずです。ここではそれら機能の不完
全な概要しか示しませんでしたので、全ての詳細はパッケージのドキュメントを
参照してください。 PEP 282(1) を読むことも助けになるでしょう。(--訳注: 今
ではクックブックもあるのでそちらもどうぞ。--)

参考
....

PEP 282(2) - ログシステム

     PEP 著: Vinay Sajip と Trent Mick; 実装: Vinay Sajip.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0282/

   (2) https://peps.python.org/pep-0282/


File: python.info,  Node: PEP 285 Boolean 型,  Next: PEP 293 コーデックエラーを処理するコールバック,  Prev: PEP 282 ロギングパッケージ,  Up: What's New in Python 2 3

1.20.9 PEP 285: Boolean 型
--------------------------

A Boolean type was added to Python 2.3.  Two new constants were added to
the ‘__builtin__’ module, *note True: e07. and *note False: d2b.  (*note
True: e07. and *note False: d2b. constants were added to the built-ins
in Python 2.2.1, but the 2.2.1 versions are simply set to integer values
of 1 and 0 and aren't a different type.)

この新しい型の型オブジェクトの名前は *note bool: 3c3. です; これのコンス
トラクタは任意の Python 値を取り、 *note True: e07. または *note False:
d2b. に変換します:

     >>> bool(1)
     True
     >>> bool(0)
     False
     >>> bool([])
     False
     >>> bool( (1,) )
     True

標準ライブラリモジュールとビルトイン関数のほとんどが、そうすべきときには
Boolean を返すように変更されました:

     >>> obj = []
     >>> hasattr(obj, 'append')
     True
     >>> isinstance(obj, list)
     True
     >>> isinstance(obj, tuple)
     False

Python の Boolean はコードを明快にすることを主たる目標として追加されまし
た。例えばあなたがコードを読んでいて ‘return 1’ に出くわした場合、あなた
は考えるはずです。この ‘1’ は、真偽としての真値なのであろうか、それとも
インデクスだろうか、はたまた何かほかの数量に掛ける係数だろうか、と。
‘return True’ であればその意味するところはかなり明らかです。

Python の Boolean は、厳格な型チェックを目的として追加された 'のではあり
ません' 。Pascal のようなとても厳格な言語では、Boolean の数学演算も阻む
でしょうし、 *note if: 181. ステートメントの式が必ず Boolean の結果に評
価されなければならないことを要求するでしょう。 Python はこの厳しさを今持
ちませんし、 PEP 285(1) が名言するように、未来永劫持つことはありません。
このことは、 ‘if’ ステートメントにこれからも任意の式を書けることを意味し
ますし、リストやらタプルやら何かほかのデタラメなオブジェクトに評価される
ものでも良いことを意味します。Boolean 型は *note int: 19b. クラスのサブ
クラスであって、Boolean の算術演算はこれからも動作します:

     >>> True + 1
     2
     >>> False + 1
     1
     >>> False * 75
     0
     >>> True * 75
     75

*note True: e07. と *note False: d2b. はぶっちゃけて言えば…: これらは整
数値 1 と 0 の別名だけれども唯一異なるのは *note str(): 169. と *note
repr(): 1c1. が ‘'1'’ と ‘'0'’ ではなく ‘'True'’ と ‘'False'’ を返すこと
だけである。

参考
....

PEP 285(2) - 真偽値型の追加

     Guido van Rossum 著、実装

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0285/

   (2) https://peps.python.org/pep-0285/


File: python.info,  Node: PEP 293 コーデックエラーを処理するコールバック,  Next: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ,  Prev: PEP 285 Boolean 型,  Up: What's New in Python 2 3

1.20.10 PEP 293: コーデックエラーを処理するコールバック
-------------------------------------------------------

Unicode 文字列をバイト文字列にエンコードする際には、エンコード出来ない文
字に出会うことがあります。いまのところ Python は、そのエラー処理として
"strict" (*note UnicodeError: 462. を発生させる)、 "ignore" (その文字を
スキップする)、 "replace" (出力文字列ではクエッションマークに置換する)、
のいずれか一つを指定出来て、 "strict" がデフォルトの振る舞いになっていま
す。その種のエラーのために、ほかの代わりとなる処理が望ましいかもしれませ
ん。例えば XML や HTML の実体参照に置き換えるなどの。

Python は今や、異なる処理戦略を追加する柔軟なフレームワークを手にしまし
た。新しいエラーハンドラを *note codecs.register_error(): 16b4. で追加出
来、コーデックは *note codecs.lookup_error(): 16b5. を使ってそのエラーハ
ンドラにアクセス出来ます。等価な C API も C で書かれたコーデックのために
追加されています。エラーハンドラは、変換すべき文字列、そのエラーが検出さ
れたその文字列内での位置、ターゲットエンコーディングのような必要な状態情
報を受け取ります。ハンドラは例外を投げるか、置換文字列を返せます。

このフレームワークを使って 2 つのエラーハンドラが実装されました:
"backslashreplace" はエンコード出来ない文字をバックスラッシュで引用し、
"xmlcharrefreplace" は XML 文字参照を発行します。

参考
....

PEP 293(1) - コーデックエラーを処理するコールバック

     Walter Dörwald 著、実装

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0293/


File: python.info,  Node: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ,  Next: PEP 302 新たなインポートフック,  Prev: PEP 293 コーデックエラーを処理するコールバック,  Up: What's New in Python 2 3

1.20.11 PEP 301: パッケージインデクスと、 Distutils のためのメタデータ
----------------------------------------------------------------------

長い間要望されてきた Python カタログのサポートが 2.3 で初登場です。

カタログの心臓部は Distutils の新コマンド ‘register’ です。 ‘python
setup.py register’ を実行すると、名前、バージョン、メンテナ、説明、ライ
センスのようなパッケージ記述のメタデータを収集して、中央カタログサーバに
送信します。結果のカタログは ‘https://pypi.org’ で利用可能です。

To make the catalog a bit more useful, a new optional 'classifiers'
keyword argument has been added to the Distutils ‘setup()’ function.  A
list of Trove(1)-style strings can be supplied to help classify the
software.

以下は ‘setup.py’ に分類指定子 (classifier) を記述する例です。 Distutils
の古いバージョンと互換になるように書いています。:

     from distutils import core
     kw = {'name': "Quixote",
           'version': "0.5.1",
           'description': "A highly Pythonic Web application framework",
           # ...
           }

     if (hasattr(core, 'setup_keywords') and
         'classifiers' in core.setup_keywords):
         kw['classifiers'] = \
             ['Topic :: Internet :: WWW/HTTP :: Dynamic Content',
              'Environment :: No Input/Output (Daemon)',
              'Intended Audience :: Developers'],

     core.setup(**kw)

classifier の完全なリストは ‘python setup.py register
--list-classifiers’ と実行することで得ることが出来ます。

参考
....

PEP 301(2) - パッケージインデクスと、 Distutils のためのメタデータ

     Richard Jones 著、実装

   ---------- Footnotes ----------

   (1) http://catb.org/~esr/trove/

   (2) https://peps.python.org/pep-0301/


File: python.info,  Node: PEP 302 新たなインポートフック,  Next: PEP 305 カンマ区切り形式ファイル,  Prev: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ,  Up: What's New in Python 2 3

1.20.12 PEP 302: 新たなインポートフック
---------------------------------------

カスタムなインポートフックを書くことは、Python 1.3 で ‘ihooks’ モジュー
ルが導入されたその日からずっと可能でした。それでも本当のところそれで幸せ
になった人は誰一人いません。それで新しいインポートフックを書くのが難しく
てとっ散らかっていたからです。 ‘imputil’ と ‘iu’ モジュール のような代わ
りとなる色々な提案がありましたが、そのいずれも多くの賛同を得ることが出来
たものはありませんし、そのいずれもが簡単に C コードから使うことが出来ま
せんでした。

PEP 302(1) はその先駆者、特に Gordon McMillan の ‘iu’ モジュールからアイ
ディアを借りています。3 つの新たなアイテムが *note sys: df. モジュールに
追加されています:

   * ‘sys.path_hooks’ は呼び出し可能オブジェクトのリストです。ほとんどの
     場合クラスになるでしょう。それぞれの呼び出し可能オブジェクトは、パ
     スを含む文字列を受け取って、このパスからインポートを処理するインポ
     ーターオブジェクトを返すか、このパスを処理出来なければ *note
     ImportError: 65b. を送出します。

   * ‘sys.path_importer_cache’ はそれぞれのパスごとのインポーターオブジ
     ェクトをキャッシュしますので、 ‘sys.path_hooks’ は個々のパスを一回
     だけ横断すれば良いことになります。

   * ‘sys.meta_path’ は ‘sys.path’ がチェックされる前に横断させるインポ
     ーターオブジェクトのリストです(訳注: ここだけ読むとわかりにくいです
     がライブラリリファレンスを読めばわかります)。このリストは初期状態で
     空ですが、ユーザコードがオブジェクトをそれに追加出来ます。追加のビ
     ルトインと凍結モジュールを、このリストにオブジェクトを追加すること
     によってインポートさせることが出来ます。

インポーターオブジェクトは一つのメソッド ‘find_module(fullname,
path=None)’ を持たなければなりません。 'fullname' はモジュールかパッケー
ジの名前です。例えば ‘string’ や ‘distutils.core’ です。 ‘find_module()’
メソッドは一つのメソッド ‘load_module(fullname)’ を持つローダーオブジェ
クトを返さなければなりません。 ‘load_module(fullname)’ では対応するモジ
ュールオブジェクトを生成して返します。

Python の新しいインポートのロジックは、なので、擬似コードで示すとだいた
いこんな感じです (少し単純化しています; 完全な詳細は PEP 302(2) 参照):

     for mp in sys.meta_path:
         loader = mp(fullname)
         if loader is not None:
             <module> = loader.load_module(fullname)

     for path in sys.path:
         for hook in sys.path_hooks:
             try:
                 importer = hook(path)
             except ImportError:
                 # ImportError, so try the other path hooks
                 pass
             else:
                 loader = importer.find_module(fullname)
                 <module> = loader.load_module(fullname)

     # Not found!
     raise ImportError

参考
....

PEP 302(3) - 新たなインポートフック

     Just van Rossum、Paul Moore 著、実装 Just van Rossum。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0302/

   (2) https://peps.python.org/pep-0302/

   (3) https://peps.python.org/pep-0302/


File: python.info,  Node: PEP 305 カンマ区切り形式ファイル,  Next: PEP 307 Pickle の機能拡張,  Prev: PEP 302 新たなインポートフック,  Up: What's New in Python 2 3

1.20.13 PEP 305: カンマ区切り形式ファイル
-----------------------------------------

カンマ区切りファイルは、データベースやスプレッドシートからのエキスポート
のために頻繁に使われるフォーマットです。Python 2.3 はカンマ区切りファイ
ルのパーサを追加しました。

カンマ区切りフォーマットは、ぱっと見で、簡単そうに見えます:

     Costs,150,200,3.95

行を読んで ‘line.split(',')’: これほどに簡単なものはあるだろうか、って?
ですが、文字列データ内にカンマを含んだりすると、コトは複雑になります:

     "Costs",150,200,3.95,"Includes taxes, shipping, and sundry items"

デカくて醜い正規表現でこれをパース出来るでしょうが、新登場の *note csv:
2d. を使えば遥かに単純になります:

     import csv

     input = open('datafile', 'rb')
     reader = csv.reader(input)
     for line in reader:
         print line

The *note reader(): 6ae. function takes a number of different options.
The field separator isn't limited to the comma and can be changed to any
character, and so can the quoting and line-ending characters.

カンマ区切りファイルの異なった方言を定義して登録出来ます。今のところ 2 つ
の方言があって、両者とも Microsoft Excel で使われるものです。独立してい
る *note csv.writer: 6af. はタプルやリストの連続から、デリミタを含む文字
列は引用符で囲みつつカンマ区切りファイルを生成します。

参考
....

PEP 305(1) - CSV File API

     PEP 著と実装: Kevin Altis, Dave Cole, Andrew McNamara, Skip
     Montanaro, Cliff Wells.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0305/


File: python.info,  Node: PEP 307 Pickle の機能拡張,  Next: 拡張スライス,  Prev: PEP 305 カンマ区切り形式ファイル,  Up: What's New in Python 2 3

1.20.14 PEP 307: Pickle の機能拡張
----------------------------------

The *note pickle: ab. and ‘cPickle’ modules received some attention
during the 2.3 development cycle.  In 2.2, new-style classes could be
pickled without difficulty, but they weren't pickled very compactly; PEP
307(1) quotes a trivial example where a new-style class results in a
pickled string three times longer than that for a classic class.

解決方法として、新しい pickle プロトコルが発明されました。 *note
pickle.dumps(): 16bd. 関数はずっと長い間、テキストとするのかバイナリとす
るのかについてはサポートしていました。2.3 ではこのフラグは Boolean から
整数に再定義されました: 0 は旧式のテキストモード pickle フォーマット、1
が同じく旧式のバイナリフォーマット、そして 2 が今回の 2.3 から特有のフォ
ーマットです。新しく追加された定数 *note pickle.HIGHEST_PROTOCOL: 16be.
を指定すると、最も望ましいものが選択されます。

Unpickling is no longer considered a safe operation.  2.2's *note
pickle: ab. provided hooks for trying to prevent unsafe classes from
being unpickled (specifically, a ‘__safe_for_unpickling__’ attribute),
but none of this code was ever audited and therefore it's all been
ripped out in 2.3.  You should not unpickle untrusted data in any
version of Python.

To reduce the pickling overhead for new-style classes, a new interface
for customizing pickling was added using three special methods: *note
__getstate__(): 7f1, *note __setstate__(): bc7, and *note
__getnewargs__(): fd4.  Consult PEP 307(2) for the full semantics of
these methods.

pickle をもっとさらに圧縮する方法として、pickle されるクラスの身元特定の
ために長い文字列を使う代わりに整数コードを使えるようになっています。
Python Software Foundation は標準コードのリストを保守しています; プライ
ベート使用のためのコード範囲もあります。現在のところ指定されているコード
はありません。

参考
....

PEP 307(3) - pickle プロトコルの拡張

     著、実装: Guido van Rossum と Tim Peters

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0307/

   (2) https://peps.python.org/pep-0307/

   (3) https://peps.python.org/pep-0307/


File: python.info,  Node: 拡張スライス,  Next: その他の言語変更<18>,  Prev: PEP 307 Pickle の機能拡張,  Up: What's New in Python 2 3

1.20.15 拡張スライス
--------------------

Python 1.4 以来ずっと、スライシングの構文は省略可能な 3 つ目の引数
"step" またの名を "stride" 、をサポートしていたのです。例えばこれらは全
て合法な Python 構文です: ‘L[1:10:2]’, ‘L[:-1:1]’, ‘L[::-1]’ 。これはこ
の 3 つ目の引数を大々的に使う Numerical Python 開発者によって要望された
ことで Python に追加されたものですが、Python ビルトインのリスト、タプル
、文字列といったシーケンス型がこの機能をサポートすることはなく、これを試
みると *note TypeError: 198. を起こしていました。Michael Hudson がこの不
徹底を修正するパッチを寄稿しました。

例えば、今やリストの偶数番目要素を簡単に取り出せます:

     >>> L = range(10)
     >>> L[::2]
     [0, 2, 4, 6, 8]

負の値では、同じリストの逆順コピーを作るように動作します:

     >>> L[::-1]
     [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]

これはタプル、配列、文字列に対しても使えます:

     >>> s='abcd'
     >>> s[::2]
     'ac'
     >>> s[::-1]
     'dcba'

リストや配列のような *note mutable: 15ba. なシーケンスに対して、拡張スラ
イスを代入や削除に使えますが、拡張スライスと普通のスライスではいくつかの
違いがあります。普通のスライスで代入を行えば、シーケンスの長さを変更出来
ます (--訳注: 念のため。Python 3 の range は list を直接返す関数ではなく
ジェネレータなので、以下例は ‘a = list(range(3))’ などとしないと動作しま
せん。続く例でも同じです。--):

     >>> a = range(3)
     >>> a
     [0, 1, 2]
     >>> a[1:3] = [4, 5, 6]
     >>> a
     [0, 4, 5, 6]

拡張スライスにはこの柔軟性はありません。拡張スライスを代入に使う際は、ス
テートメントの右辺のリストは、置換されるスライスとしての要素数と同数でな
ければなりません:

     >>> a = range(4)
     >>> a
     [0, 1, 2, 3]
     >>> a[::2]
     [0, 2]
     >>> a[::2] = [0, -1]
     >>> a
     [0, 1, -1, 3]
     >>> a[::2] = [0,1,2]
     Traceback (most recent call last):
       File "<stdin>", line 1, in ?
     ValueError: attempt to assign sequence of size 3 to extended slice of size 2

削除はもっと素直です:

     >>> a = range(4)
     >>> a
     [0, 1, 2, 3]
     >>> a[::2]
     [0, 2]
     >>> del a[::2]
     >>> a
     [1, 3]

One can also now pass slice objects to the *note __getitem__(): 588.
methods of the built-in sequences:

     >>> range(10).__getitem__(slice(0, 5, 2))
     [0, 2, 4]

あるいは直接 slice オブジェクトを添え字に使えます:

     >>> range(10)[slice(0, 5, 2)]
     [0, 2, 4]

To simplify implementing sequences that support extended slicing, slice
objects now have a method ‘indices(length)’ which, given the length of a
sequence, returns a ‘(start, stop, step)’ tuple that can be passed
directly to *note range(): b3d.  ‘indices()’ handles omitted and
out-of-bounds indices in a manner consistent with regular slices (and
this innocuous phrase hides a welter of confusing details!).  The method
is intended to be used like this:

     class FakeSeq:
         ...
         def calc_item(self, i):
             ...
         def __getitem__(self, item):
             if isinstance(item, slice):
                 indices = item.indices(len(self))
                 return FakeSeq([self.calc_item(i) for i in range(*indices)])
             else:
                 return self.calc_item(i)

ところでこの例からは、ビルトインの *note slice: 694. オブジェクトが今で
は slice 型という型オブジェクトで、もう関数ではないことがわかるでしょう
。これは、Python 2.2 で *note int: 19b, *note str: 169. などに対して行わ
れた同じ目的の修正と一貫しています。


File: python.info,  Node: その他の言語変更<18>,  Next: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>,  Prev: 拡張スライス,  Up: What's New in Python 2 3

1.20.16 その他の言語変更
------------------------

以下が、Python 2.3 言語コアに加えられた全ての変更点です。

   * *note yield: bc2. 文がこのドキュメントの *note PEP 255;
     単純なジェネレータ: 16a1. で述べた通り、キーワードになっています。

   * 新たな組み込み関数 *note enumerate(): 169a. が追加されました。この
     ドキュメントの *note PEP 279; enumerate(): 16aa. で述べた通りです。

   * 新たな定数 *note True: e07, *note False: d2b. がビルトイン *note
     bool: 3c3. 型の追加に伴い追加されました。このドキュメントの *note
     PEP 285; Boolean 型: 16b2. で述べた通りです。

   * *note int(): 19b. 型コンストラクタは、文字列や浮動小数点数を整数に
     収める際、それがとても大き場合に *note OverflowError: a81. を投げる
     のではなく長整数を返すようになっています。これは
     ‘isinstance(int(expression), int)’ が偽を返すかもしれないという逆説
     的な結果をもたらし得ますが、これが実際に問題を起こすとはあまり思え
     ません。

   * ビルトイン型が拡張スライス構文をサポートするようになりました。この
     ドキュメントの *note 拡張スライス: 16c0. で述べた通りです。

   * 新規組み込み関数 ‘sum(iterable, start=0)’ はイテラブル オブジェクト
     内の数値アイテムを足し込んで総和を返します。 *note sum(): 695. は数
     値しか受け付けませんので、文字列群を連結するのには使えません。
     (Contributed by Alex Martelli.)

   * ‘list.insert(pos, value)’ で 'value' を先頭に追加するのに 'pos' に
     負数が使われてきました。この振る舞いはスライスのインデクシングとの
     一貫性のために変更されました。つまり 'pos' が -1 の場合は最終要素の
     前への追加、などとなります。

   * ‘list.index(value)’ はリスト内から 'value' を探してそのインデクスを
     返しますが、オプショナルな 'start' と 'stop' 引数を取って、リストの
     部分列からの検索が可能になりました。

   * 辞書の新たなメソッド ‘pop(key[, *default*])’ は、 'key' に対応する
     値を返して辞書からそのキー/値ペアを取り除きます。辞書内にそのキーが
     不在であれば、 'default' が指定されていればそれを、そうでなければ
     *note KeyError: 5e7. を投げます。:

          >>> d = {1:2}
          >>> d
          {1: 2}
          >>> d.pop(4)
          Traceback (most recent call last):
            File "stdin", line 1, in ?
          KeyError: 4
          >>> d.pop(1)
          2
          >>> d.pop(1)
          Traceback (most recent call last):
            File "stdin", line 1, in ?
          KeyError: 'pop(): dictionary is empty'
          >>> d
          {}
          >>>

     また、新しいメソッド ‘dict.fromkeys(iterable, value)’ は、与えられ
     たイテレータ 'iterable' からキーを取り出しつつ全ての値を 'value' に
     セットすることで構築します。 'value' のデフォルトは ‘None’ です。

     (Patches contributed by Raymond Hettinger.)

     また、 *note dict(): 183. コンストラクタは小さな辞書を簡単に構築出
     来るよう、キーワード引数を受け付けるようになりました:

          >>> dict(red=1, blue=2, green=3, black=4)
          {'blue': 2, 'black': 4, 'green': 3, 'red': 1}

     (Contributed by Just van Rossum.)

   * *note assert: b60. ステートメントが ‘__debug__’ フラグをチェックす
     ることはもうありません。このため、 ‘__debug__’ に代入することによっ
     てアサーションを無効にすることは出来ません。Python を *note -O:
     18c. スイッチで起動により全てのアサーションが実行されない点は、以前
     と変わりません。

   * ほとんどの型オブジェクトが今では呼び出し可能であり、なので関数、ク
     ラス、モジュールのようなオブジェクトを新たに構築するのにそれを使え
     ます。 (‘new’ モジュールはこれにより将来のバージョンの Python で撤
     廃される可能性があります。 *note types: 109. モジュール内の型オブジ
     ェクトが使えるからです。 --訳注: 2.6 で実際に撤廃されています。--)
     例えば、新規モジュールオブジェクトは以下コードで構築出来ます:

          >>> import types
          >>> m = types.ModuleType('abc','docstring')
          >>> m
          <module 'abc' (built-in)>
          >>> m.__doc__
          'docstring'

   * 新たな警告 *note PendingDeprecationWarning: ac5. が、将来廃止される
     予定のある機能であることを示すために追加されました。この警告はデフ
     ォルトで '出力されません' 。将来において廃止される予定の機能の使用
     をチェックするにはコマンドラインから *note
     -Walways;;PendingDeprecationWarning;;: ac6. を与えるか、 *note
     warnings.filterwarnings(): 16c2. を使います。

   * 文字列ベースの例外、例えば ‘raise "Error occurred"’ のようなもの、
     これは廃止のための過程を開始しています。文字列を例外として投げると
     *note PendingDeprecationWarning: ac5. が発行されます。

   * ‘None’ を変数名に使うと *note SyntaxWarning: 1ae. 警告を出すように
     なっています。将来バージョンの Python では ‘None’ はキーワードにな
     ります。

   * The ‘xreadlines()’ method of file objects, introduced in Python
     2.1, is no longer necessary because files now behave as their own
     iterator.  ‘xreadlines()’ was originally introduced as a faster way
     to loop over all the lines in a file, but now you can simply write
     ‘for line in file_obj’.  File objects also have a new read-only
     ‘encoding’ attribute that gives the encoding used by the file;
     Unicode strings written to the file will be automatically converted
     to bytes using the given encoding.

   * The method resolution order used by new-style classes has changed,
     though you'll only notice the difference if you have a really
     complicated inheritance hierarchy.  Classic classes are unaffected
     by this change.  Python 2.2 originally used a topological sort of a
     class's ancestors, but 2.3 now uses the C3 algorithm as described
     in the paper "A Monotonic Superclass Linearization for Dylan"(1).
     To understand the motivation for this change, read Michele
     Simionato's article *note The Python 2.3 Method Resolution Order:
     16c3, or read the thread on python-dev starting with the message at
     ‘https://mail.python.org/pipermail/python-dev/2002-October/029035.html’.
     Samuele Pedroni first pointed out the problem and also implemented
     the fix by coding the C3 algorithm.

   * Python runs multithreaded programs by switching between threads
     after executing N bytecodes.  The default value for N has been
     increased from 10 to 100 bytecodes, speeding up single-threaded
     applications by reducing the switching overhead.  Some
     multithreaded applications may suffer slower response time, but
     that's easily fixed by setting the limit back to a lower number
     using ‘sys.setcheckinterval(N)’.  The limit can be retrieved with
     the new ‘sys.getcheckinterval()’ function.

   * マイナーですが広範囲に渡る変更として、拡張型の名前の変更があります
     。Python と一緒に含まれるモジュールで定義される拡張型の名前が、モジ
     ュール名と ‘'.'’ が型名に前置されるようになりました。例えば、Python
     2.2 ではソケットオブジェクトを作って ‘__class__’ を出力すると、この
     ような出力だったでしょう:

          >>> s = socket.socket()
          >>> s.__class__
          <type 'socket'>

     2.3 ではこうなります:

          >>> s.__class__
          <type '_socket.socket'>

   * One of the noted incompatibilities between old- and new-style
     classes has been removed: you can now assign to the *note __name__:
     16c4. and *note __bases__: 16c5. attributes of new-style classes.
     There are some restrictions on what can be assigned to ‘__bases__’
     along the lines of those relating to assigning to an instance's
     *note __class__: 16c6. attribute.

* Menu:

* 文字列に関する変更::
* 最適化: 最適化<18>.

   ---------- Footnotes ----------

   (1) https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.19.3910


File: python.info,  Node: 文字列に関する変更,  Next: 最適化<18>,  Up: その他の言語変更<18>

1.20.16.1 文字列に関する変更
............................

   * *note in: 34b. 演算子が文字列に対して違った振る舞いをするようになり
     ました。以前は 'X' と 'Y' が文字列の場合の ‘X in Y’ は、 'X' は単一
     文字でなければなりませんでした。これが 'X' はどんな長さでも良くなり
     、 ‘X in Y’ は 'X' が 'Y' のサブストリングであれば *note True: e07.
     を返すように変更されました。 'X' が空文字列の場合は結果は常に *note
     True: e07. になります。

          >>> 'ab' in 'abcd'
          True
          >>> 'ad' in 'abcd'
          False
          >>> '' in 'abcd'
          True

     これはサブストリングの開始位置を教えてくれるわけではないので、その
     情報が必要であれば *note find(): 10a8. 文字列メソッドを使ってくださ
     い。

   * *note strip(): 16c8, *note lstrip(): 16c9, *note rstrip(): 16ca. に
     、剥ぎ取る文字を指定する省略可能な引数が追加されています。デフォル
     トは従来通り全ての空白文字を削除します。:

          >>> '   abc '.strip()
          'abc'
          >>> '><><abc<><><>'.strip('<>')
          'abc'
          >>> '><><abc<><><>\n'.strip('<>')
          'abc<><><>\n'
          >>> u'\u4000\u4001abc\u4000'.strip(u'\u4000')
          u'\u4001abc'
          >>>

     (Suggested by Simon Brunning and implemented by Walter Dörwald.)

   * The *note startswith(): 10cb. and *note endswith(): 10cc. string
     methods now accept negative numbers for the 'start' and 'end'
     parameters.

   * Another new string method is *note zfill(): 16cb, originally a
     function in the *note string: d8. module.  *note zfill(): 16cb.
     pads a numeric string with zeros on the left until it's the
     specified width.  Note that the ‘%’ operator is still more flexible
     and powerful than *note zfill(): 16cb.

          >>> '45'.zfill(4)
          '0045'
          >>> '12345'.zfill(4)
          '12345'
          >>> 'goofy'.zfill(6)
          '0goofy'

     (Contributed by Walter Dörwald.)

   * A new type object, ‘basestring’, has been added.  Both 8-bit
     strings and Unicode strings inherit from this type, so
     ‘isinstance(obj, basestring)’ will return *note True: e07. for
     either kind of string.  It's a completely abstract type, so you
     can't create ‘basestring’ instances.

   * 内部化した文字列はもう不死身ではないので、内部辞書からの参照が、参
     照している唯一のものとなれば、普通にガーベージコレクト対象となりま
     す。 (Implemented by Oren Tirosh.)


File: python.info,  Node: 最適化<18>,  Prev: 文字列に関する変更,  Up: その他の言語変更<18>

1.20.16.2 最適化
................

   * The creation of new-style class instances has been made much
     faster; they're now faster than classic classes!

   * The *note sort(): dc8. method of list objects has been extensively
     rewritten by Tim Peters, and the implementation is significantly
     faster.

   * Multiplication of large long integers is now much faster thanks to
     an implementation of Karatsuba multiplication, an algorithm that
     scales better than the 'O'('n'^2) required for the grade-school
     multiplication algorithm.  (Original patch by Christopher A. Craig,
     and significantly reworked by Tim Peters.)

   * The ‘SET_LINENO’ opcode is now gone.  This may provide a small
     speed increase, depending on your compiler's idiosyncrasies.  See
     section *note その他の変更と修正: 16cd. for a longer explanation.
     (Removed by Michael Hudson.)

   * ‘xrange()’ objects now have their own iterator, making ‘for i in
     xrange(n)’ slightly faster than ‘for i in range(n)’.  (Patch by
     Raymond Hettinger.)

   * A number of small rearrangements have been made in various hotspots
     to improve performance, such as inlining a function or removing
     some code.  (Implemented mostly by GvR, but lots of people have
     contributed single changes.)

The net result of the 2.3 optimizations is that Python 2.3 runs the
pystone benchmark around 25% faster than Python 2.2.


File: python.info,  Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>,  Next: Pymalloc 特殊化されたオブジェクトアロケータ,  Prev: その他の言語変更<18>,  Up: What's New in Python 2 3

1.20.17 新たなモジュール、改良されたモジュール、非推奨のモジュール
------------------------------------------------------------------

いつものように、Python の標準ライブラリには数多くの拡張とバグ修正があり
ました。ここでは最も注目に値する変更について、モジュールの辞書順に列挙し
ます。変更の完全なリストについてはソースツリーの ‘Misc/NEWS’ を調べるか
、あるいは全ての詳細について CVS ログに目を通してみてください。

   * *note array: 8. モジュールが ‘'u'’ フォーマット文字を使った Unicode
     文字の配列をサポートするようになっています。配列はまた、 ‘+=’ 代入
     演算子を使ってほかの配列内容を加算すること、 ‘*=’ 演算子を使って配
     列を繰り返すことが可能になっています。(Contributed by Jason
     Orendorff.)

   * ‘bsddb’ モジュールが PyBSDDB(1) バージョン 4.1.6 によって置き換えら
     れています。これは BerkeleyDB のトランザクションの機能へのより完全
     なインターフェースを提供します。

     古いバージョンのモジュールは ‘bsddb185’ にリネームされて、自動的に
     はビルドされません。有効にするには ‘Modules/Setup’ を編集する必要が
     あります。新しい ‘bsddb’ パッケージは古いモジュールと互換となるよう
     に意図されていますので、何か非互換を見つけたらファイルのバグを確認
     してください。Python 2.3 へのアップグレードの際、前提となる
     BerkeleyDB ライブラリの新バージョンでインタープリタがコンパイルされ
     るならば、ほぼ確実にあなたのデータベースは新バージョンに変換しなけ
     ればならないでしょう。ソース配布物の ‘Tools/scripts’ ディレクトリの
     ‘db2pickle.py’ と ‘pickle2db.py’ スクリプトを使って、これをかなり簡
     単に行うことが出来ます。もし既に PyBSDDB パッケージを使っていて
     ‘bsddb3’ としてインポートしているならば、 ‘bsddb’ をインポートする
     ように ‘import’ 文を変更する必要があります。

   * 新規の *note bz2: 14. モジュールは bz2 データ圧縮ライブラリへのイン
     ターフェイスです。bz2 圧縮データは普通 *note zlib: 139. 圧縮データ
     よりも小さくなります。 (Contributed by Gustavo Niemeyer.)

   * 標準の日付時刻型が *note datetime: 34. モジュールとして追加されてい
     ます。詳細はこのドキュメントの下の方に記述してありますのでそちらを
     参照して下さい。

   * The Distutils ‘Extension’ class now supports an extra constructor
     argument named 'depends' for listing additional source files that
     an extension depends on.  This lets Distutils recompile the module
     if any of the dependency files are modified.  For example, if
     ‘sampmodule.c’ includes the header file ‘sample.h’, you would
     create the ‘Extension’ object like this:

          ext = Extension("samp",
                          sources=["sampmodule.c"],
                          depends=["sample.h"])

     ‘sample.h’ を修正するとモジュールは再コンパイルされます。
     (Contributed by Jeremy Hylton.)

   * Other minor changes to Distutils: it now checks for the *note CC:
     16cf, *note CFLAGS: 16d0, ‘CPP’, *note LDFLAGS: 16d1, and *note
     CPPFLAGS: 16d2. environment variables, using them to override the
     settings in Python's configuration (contributed by Robert Weber).

   * Previously the *note doctest: 3e. module would only search the
     docstrings of public methods and functions for test cases, but it
     now also examines private ones as well.  The *note DocTestSuite():
     ff4. function creates a *note unittest.TestSuite: ff5. object from
     a set of *note doctest: 3e. tests.

   * 新しい関数 ‘gc.get_referents(object)’ は 'object' により参照されて
     いる全てのオブジェクトのリストを返します。

   * The *note getopt: 65. module gained a new function, *note
     gnu_getopt(): 16d3, that supports the same arguments as the
     existing *note getopt(): 16d4. function but uses GNU-style scanning
     mode.  The existing *note getopt(): 16d4. stops processing options
     as soon as a non-option argument is encountered, but in GNU-style
     mode processing continues, meaning that options and arguments can
     be mixed.  For example:

          >>> getopt.getopt(['-f', 'filename', 'output', '-v'], 'f:v')
          ([('-f', 'filename')], ['output', '-v'])
          >>> getopt.gnu_getopt(['-f', 'filename', 'output', '-v'], 'f:v')
          ([('-f', 'filename'), ('-v', '')], ['output'])

     (Contributed by Peter Åstrand.)

   * モジュール *note grp: 6a, *note pwd: b7, *note resource: c1. では拡
     張されたタプルを返すようになりました:

          >>> import grp
          >>> g = grp.getgrnam('amk')
          >>> g.gr_name, g.gr_gid
          ('amk', 500)

   * *note gzip: 6b. モジュールが 2 GiB を超えるファイルを扱えるようにな
     っています。

   * The new *note heapq: 6d. module contains an implementation of a
     heap queue algorithm.  A heap is an array-like data structure that
     keeps items in a partially sorted order such that, for every index
     'k', ‘heap[k] <= heap[2*k+1]’ and ‘heap[k] <= heap[2*k+2]’.  This
     makes it quick to remove the smallest item, and inserting a new
     item while maintaining the heap property is 'O'(log 'n').  (See
     ‘https://xlinux.nist.gov/dads//HTML/priorityque.html’ for more
     information about the priority queue data structure.)

     The *note heapq: 6d. module provides *note heappush(): 16d5. and
     *note heappop(): 16d6. functions for adding and removing items
     while maintaining the heap property on top of some other mutable
     Python sequence type.  Here's an example that uses a Python list:

          >>> import heapq
          >>> heap = []
          >>> for item in [3, 7, 5, 11, 1]:
          ...    heapq.heappush(heap, item)
          ...
          >>> heap
          [1, 3, 5, 11, 7]
          >>> heapq.heappop(heap)
          1
          >>> heapq.heappop(heap)
          3
          >>> heap
          [5, 7, 11]

     (Contributed by Kevin O'Connor.)

   * The IDLE integrated development environment has been updated using
     the code from the IDLEfork project
     (‘https://idlefork.sourceforge.net’).  The most notable feature is
     that the code being developed is now executed in a subprocess,
     meaning that there's no longer any need for manual ‘reload()’
     operations.  IDLE's core code has been incorporated into the
     standard library as the *note idlelib: 77. package.

   * *note imaplib: 78. モジュールが IMAP over SSL をサポートするように
     なりました.  (Contributed by Piers Lauder and Tino Lange.)

   * The *note itertools: 85. contains a number of useful functions for
     use with iterators, inspired by various functions provided by the
     ML and Haskell languages.  For example,
     ‘itertools.ifilter(predicate, iterator)’ returns all elements in
     the iterator for which the function ‘predicate()’ returns *note
     True: e07, and ‘itertools.repeat(obj, N)’ returns ‘obj’ 'N' times.
     There are a number of other functions in the module; see the
     package's reference documentation for details.  (Contributed by
     Raymond Hettinger.)

   * *note math: 92. module の 2 つの新規関数 ‘degrees(rads)’ と
     ‘radians(degs)’ は、ラジアンと度の間の変換を行います。 *note math:
     92. モジュールの *note math.sin(): 16d7. や *note math.cos(): 16d8.
     などは常にラジアンでの入力が必要です。 *note math.log(): 16d9. 関数
     には底を指定するオプショナルの 'base' 引数が追加されていて、 ‘e’ と
     ‘10’ でない底の対数を計算するのが簡単になりました。 (Contributed by
     Raymond Hettinger.)

   * Several new POSIX functions (‘getpgid()’, ‘killpg()’, ‘lchown()’,
     ‘loadavg()’, ‘major()’, ‘makedev()’, ‘minor()’, and ‘mknod()’) were
     added to the *note posix: b2. module that underlies the *note os:
     a5. module.  (Contributed by Gustavo Niemeyer, Geert Jansen, and
     Denis S. Otkidach.)

   * In the *note os: a5. module, the ‘*stat()’ family of functions can
     now report fractions of a second in a timestamp.  Such time stamps
     are represented as floats, similar to the value returned by *note
     time.time(): 55d.

     During testing, it was found that some applications will break if
     time stamps are floats.  For compatibility, when using the tuple
     interface of the *note stat_result: 16da. time stamps will be
     represented as integers.  When using named fields (a feature first
     introduced in Python 2.2), time stamps are still represented as
     integers, unless ‘os.stat_float_times()’ is invoked to enable float
     return values:

          >>> os.stat("/tmp").st_mtime
          1034791200
          >>> os.stat_float_times(True)
          >>> os.stat("/tmp").st_mtime
          1034791200.6335014

     Python 2.4 では、浮動小数点数を返すのがデフォルトとなります。

     Application developers should enable this feature only if all their
     libraries work properly when confronted with floating-point time
     stamps, or if they use the tuple API. If used, the feature should
     be activated on an application level instead of trying to enable it
     on a per-use basis.

   * *note optparse: a4. モジュールに新たなコマンドライン引数パーサが追
     加されました。これはオプション値を特定の Python 型に変換することが
     出来、また、自動的に使用例メッセージを生成します。詳細はこのドキュ
     メントの続くセクションを参照して下さい。

   * The old and never-documented ‘linuxaudiodev’ module has been
     deprecated, and a new version named ‘ossaudiodev’ has been added.
     The module was renamed because the OSS sound drivers can be used on
     platforms other than Linux, and the interface has also been tidied
     and brought up to date in various ways.  (Contributed by Greg Ward
     and Nicholas FitzRoy-Dale.)

   * 実行中のプラットフォームについての色々な特性を決定する数多くの関数
     を含む、新規 *note platform: af. モジュールが追加されました。アーキ
     テクチャ、CPU タイプ、Windows の OS バージョンや Linux ディストリビ
     ューションのバージョンなどを取得できます。(Contributed by
     Marc-André Lemburg.)

   * The parser objects provided by the *note pyexpat: 12c. module can
     now optionally buffer character data, resulting in fewer calls to
     your character data handler and therefore faster performance.
     Setting the parser object's *note buffer_text: 16db. attribute to
     *note True: e07. will enable buffering.

   * The ‘sample(population, k)’ function was added to the *note random:
     bd. module.  'population' is a sequence or ‘xrange’ object
     containing the elements of a population, and *note sample(): 94d.
     chooses 'k' elements from the population without replacing chosen
     elements.  'k' can be any value up to ‘len(population)’.  For
     example:

          >>> days = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'St', 'Sn']
          >>> random.sample(days, 3)      # Choose 3 elements
          ['St', 'Sn', 'Th']
          >>> random.sample(days, 7)      # Choose 7 elements
          ['Tu', 'Th', 'Mo', 'We', 'St', 'Fr', 'Sn']
          >>> random.sample(days, 7)      # Choose 7 again
          ['We', 'Mo', 'Sn', 'Fr', 'Tu', 'St', 'Th']
          >>> random.sample(days, 8)      # Can't choose eight
          Traceback (most recent call last):
            File "<stdin>", line 1, in ?
            File "random.py", line 414, in sample
                raise ValueError, "sample larger than population"
          ValueError: sample larger than population
          >>> random.sample(xrange(1,10000,2), 10)   # Choose ten odd nos. under 10000
          [3407, 3805, 1505, 7023, 2401, 2267, 9733, 3151, 8083, 9195]

     *note random: bd. が C で実装された新しいアルゴリズムのメルセンヌ・
     ツイスタを使うようになりました。これは以前のアルゴリズムよりも高速
     で、より広く研究されています。

     (All changes contributed by Raymond Hettinger.)

   * The *note readline: bf. module also gained a number of new
     functions: *note get_history_item(): 16dc, *note
     get_current_history_length(): 16dd, and *note redisplay(): 16de.

   * The ‘rexec’ and ‘Bastion’ modules have been declared dead, and
     attempts to import them will fail with a *note RuntimeError: 244.
     New-style classes provide new ways to break out of the restricted
     execution environment provided by ‘rexec’, and no one has interest
     in fixing them or time to do so.  If you have applications using
     ‘rexec’, rewrite them to use something else.

     (Sticking with Python 2.2 or 2.1 will not make your applications
     any safer because there are known bugs in the ‘rexec’ module in
     those versions.  To repeat: if you're using ‘rexec’, stop using it
     immediately.)

   * The ‘rotor’ module has been deprecated because the algorithm it
     uses for encryption is not believed to be secure.  If you need
     encryption, use one of the several AES Python modules that are
     available separately.

   * *note shutil: ca. モジュールに ‘move(src, dest)’ が追加されており、
     これはファイルまたはディレクトリを新しい場所へ再帰的に移動します。

   * Support for more advanced POSIX signal handling was added to the
     *note signal: cb. but then removed again as it proved impossible to
     make it work reliably across platforms.

   * *note socket: d1. モジュールがタイムアウトをサポートするようになり
     ました。ソケットオブジェクトの ‘settimeout(t)’ メソッドに 't' 秒を
     与えることで行えます。これに続くソケット操作が 't' 秒を超えて完了し
     ない場合には操作は中断し、 *note socket.timeout: a35. 例外を投げま
     す。

     オリジナルのタイムアウト実装は Tim O'Malley によりなされました。
     Michael Gilfix がこれを Python *note socket: d1. モジュールに統合し
     、長い長いレビューに導きました。コードがチェックインされたのち、
     Guido van Rossum はそれを部分的に書き換えました。(これは協調的開発
     プロセスの好例です。)

   * Windows での *note socket: d1. モジュールの Secure Sockets Layer
     (SSL) サポートが始まりました。

   * The value of the C ‘PYTHON_API_VERSION’ macro is now exposed at the
     Python level as ‘sys.api_version’.  The current exception can be
     cleared by calling the new ‘sys.exc_clear()’ function.

   * 新モジュール *note tarfile: e4. で ‘tar’ 形式のアーカイブファイルの
     読み書きが出来ます。 (Contributed by Lars Gustäbel.)

   * The new *note textwrap: f2. module contains functions for wrapping
     strings containing paragraphs of text.  The ‘wrap(text, width)’
     function takes a string and returns a list containing the text
     split into lines of no more than the chosen width.  The ‘fill(text,
     width)’ function returns a single string, reformatted to fit into
     lines no longer than the chosen width.  (As you can guess, *note
     fill(): 16df. is built on top of *note wrap(): 16e0.  For example:

          >>> import textwrap
          >>> paragraph = "Not a whit, we defy augury: ... more text ..."
          >>> textwrap.wrap(paragraph, 60)
          ["Not a whit, we defy augury: there's a special providence in",
           "the fall of a sparrow. If it be now, 'tis not to come; if it",
           ...]
          >>> print textwrap.fill(paragraph, 35)
          Not a whit, we defy augury: there's
          a special providence in the fall of
          a sparrow. If it be now, 'tis not
          to come; if it be not to come, it
          will be now; if it be not now, yet
          it will come: the readiness is all.
          >>>

     The module also contains a *note TextWrapper: 11cf. class that
     actually implements the text wrapping strategy.  Both the *note
     TextWrapper: 11cf. class and the *note wrap(): 16e0. and *note
     fill(): 16df. functions support a number of additional keyword
     arguments for fine-tuning the formatting; consult the module's
     documentation for details.  (Contributed by Greg Ward.)

   * The ‘thread’ and *note threading: f3. modules now have companion
     modules, ‘dummy_thread’ and ‘dummy_threading’, that provide a
     do-nothing implementation of the ‘thread’ module's interface for
     platforms where threads are not supported.  The intention is to
     simplify thread-aware modules (ones that 'don't' rely on threads to
     run) by putting the following code at the top:

          try:
              import threading as _threading
          except ImportError:
              import dummy_threading as _threading

     In this example, ‘_threading’ is used as the module name to make it
     clear that the module being used is not necessarily the actual
     *note threading: f3. module.  Code can call functions and use
     classes in ‘_threading’ whether or not threads are supported,
     avoiding an *note if: 181. statement and making the code slightly
     clearer.  This module will not magically make multithreaded code
     run without threads; code that waits for another thread to return
     or to do something will simply hang forever.

   * *note time: f4. モジュールの *note strptime(): 1646. 関数は長いこと
     混乱の元でした。それがプラットフォームの C 関数 *note strptime():
     1646. を使い、異なったプラットフォームごとに時折おかしなバグを持っ
     ていたからです。Brett Cannon は pure Python で、全てのプラットフォ
     ームで全く同じに振舞うように書き直した実装を寄稿しました。

   * 新規モジュール *note timeit: f5. は、Python コードの断片 (スニペッ
     ト) を実行するのにかかる時間を計測します。ファイル ‘timeit.py’ は直
     接コマンドラインから実行出来ますし、モジュールの *note Timer: 16e1.
     クラスをインポートして直接使うことも出来ます。以下に、空の Unicode
     文字列を追加することによって 8 ビット文字列を Unicode に変換するの
     と ‘unicode()’ 関数を使うのとでいずれが高速なのかを把握するための短
     い例をお見せします:

          import timeit

          timer1 = timeit.Timer('unicode("abc")')
          timer2 = timeit.Timer('"abc" + u""')

          # Run three trials
          print timer1.repeat(repeat=3, number=100000)
          print timer2.repeat(repeat=3, number=100000)

          # On my laptop this outputs:
          # [0.36831796169281006, 0.37441694736480713, 0.35304892063140869]
          # [0.17574405670166016, 0.18193507194519043, 0.17565798759460449]

   * ‘Tix’ モジュールに色々バグ修正がなされ、Tix パッケージの現在バージ
     ョンに更新されました。

   * ‘Tkinter’ モジュールがスレッドを有効化した Tcl で動作するようになり
     ました。Tcl のスレッドモデルは、ウィジットはそれが作られたスレッド
     からのみアクセスされることを必要とします。ほかのスレッドからのアク
     セスは Tcl を混乱させます。ある特定の Tcl インターフェイスでは、
     ‘Tkinter’ はウィジットがコマンドの纏め上げによって異なるスレッドか
     らアクセスされる際に、正しいスレッドに向けて結果を待つことで自動的
     にこれを避けるようになりました。それ以外のインターフェイスでは自動
     で処理は出来ませんが、 ‘Tkinter’ はそのようなアクセス時に最低でもそ
     れが問題とわかるよう例外を送出するようになっています。この変更につ
     いての詳細な説明は
     ‘https://mail.python.org/pipermail/python-dev/2002-December/031107.html’
     をみてください。(Implemented by Martin von Löwis.)

   * ‘_tkinter’ を介した Tcl メソッド呼び出しは今では文字列だけを返すの
     ではありません。代わりに Tcl は対応する Python の等価なオブジェクト
     に変換されたオブジェクトを返します。Python に等価なものがなければ
     ‘_tkinter.Tcl_Obj’ で包んで返します。この振る舞いは ‘tkapp’ オブジ
     ェクトの ‘wantobjects()’ メソッドで制御出来ます。

     (ほとんどの Tkinter アプリケーションがそうするように) ‘Tkinter’ モ
     ジュールを通して ‘_tkinter’ を使う際、この機能は常に有効になります
     。これは互換性の問題を引き起こさないはずです。 Tkinter は可能な場合
     には文字列を Python 型に常に変換していたからです。

     何か非互換性を見つけたら古い振る舞いに戻せます。最初の ‘tkapp’ オブ
     ジェクトを生成する前に ‘Tkinter’ モジュールの ‘wantobjects’ 変数に
     偽をセットしてください:

          import Tkinter
          Tkinter.wantobjects = 0

     ここで説明した変更によって何かアプリケーションの破壊があれば、バグ
     として報告してください。

   * ‘UserDict’ モジュールに新しく ‘DictMixin’ クラスが追加されました。
     既に最小限のマッピングインターフェースを持っているクラスのために、
     全ての辞書メソッドを定義します。これは、 *note shelve: c8. モジュー
     ル内のクラスのような、辞書に置換可能である必要があるクラスの記述を
     大幅に単純化します。

     クラスがメソッド *note __getitem__(): 588, *note __setitem__():
     14e3, *note __delitem__(): 14e4, ‘keys()’ を定義している場合にはい
     つでも、スーパークラスとして mix-in を追加すると完全な辞書インター
     フェースになります。例えば:

          >>> import UserDict
          >>> class SeqDict(UserDict.DictMixin):
          ...     """Dictionary lookalike implemented with lists."""
          ...     def __init__(self):
          ...         self.keylist = []
          ...         self.valuelist = []
          ...     def __getitem__(self, key):
          ...         try:
          ...             i = self.keylist.index(key)
          ...         except ValueError:
          ...             raise KeyError
          ...         return self.valuelist[i]
          ...     def __setitem__(self, key, value):
          ...         try:
          ...             i = self.keylist.index(key)
          ...             self.valuelist[i] = value
          ...         except ValueError:
          ...             self.keylist.append(key)
          ...             self.valuelist.append(value)
          ...     def __delitem__(self, key):
          ...         try:
          ...             i = self.keylist.index(key)
          ...         except ValueError:
          ...             raise KeyError
          ...         self.keylist.pop(i)
          ...         self.valuelist.pop(i)
          ...     def keys(self):
          ...         return list(self.keylist)
          ...
          >>> s = SeqDict()
          >>> dir(s)      # See that other dictionary methods are implemented
          ['__cmp__', '__contains__', '__delitem__', '__doc__', '__getitem__',
           '__init__', '__iter__', '__len__', '__module__', '__repr__',
           '__setitem__', 'clear', 'get', 'has_key', 'items', 'iteritems',
           'iterkeys', 'itervalues', 'keylist', 'keys', 'pop', 'popitem',
           'setdefault', 'update', 'valuelist', 'values']

     (Contributed by Raymond Hettinger.)

   * The DOM implementation in *note xml.dom.minidom: 128. can now
     generate XML output in a particular encoding by providing an
     optional encoding argument to the *note toxml(): c8a. and *note
     toprettyxml(): c8b. methods of DOM nodes.

   * ‘xmlrpclib’ モジュールが、 Python の ‘None’ のような nil データを処
     理するための XML-RPC 拡張をサポートするようになりました。 nil 値は
     XML-RPC 応答のアンマーシャルでいつでもサポートされます。 ‘None’ を
     含んだリクエストを生成するためには、 ‘Marshaller’ のインスタンスを
     生成する際に 'allow_none' パラメータに真を与えなければなりません。

   * 新規モジュール ‘DocXMLRPCServer’ は、セルフ-ドキュメンティング
     XML-RPC サーバを書くのに使えます。実際のところをみるためにはデモモ
     ード (つまりプログラムとして) 実行してみてください。ウェブブラウザ
     を RPC サーバに向ければ pydoc スタイルのドキュメントを生成します。
     xmlrpclib をサーバに向ければ実際のメソッドを呼び出せます。
     (Contributed by Brian Quinlan.)

   * internationalized domain names (RFC 3454, 3490, 3491, 3492) のサポ
     ートが追加されました。Unicode ドメイン名とその名前の ASCII 互換エン
     コーディング (ACE=ASCII-compatible encoding) の間の変換をするのに
     "idna" エンコーディングを使用出来ます:

          >{}>{}> u"www.Alliancefrançaise.nu".encode("idna")
          'www.xn--alliancefranaise-npb.nu'

     *note socket: d1. モジュールも、C ライブラリに渡す前に Unicode ホス
     ト名を ACE バージョンに透過的に変換するように拡張されています。
     ‘httplib’ や *note ftplib: 62. のようなホスト名を扱うモジュールも
     Unicode ホスト名をサポートしています; ‘httplib’ は HTTP ‘Host’ ヘッ
     ダをドメイン名の ACE 版を使って送信します。 *note urllib: 10e. は
     URL の ‘path’ 部分が ASCII のみである限り、非 ASCII ホスト名を持つ
     Unicode URL をサポートします

     この変更の実装のために、 *note stringprep: da. モジュール、
     ‘mkstringprep’ ツール、 ‘punycode’ エンコーディングが追加されました
     。

* Menu:

* 日付時刻型::
* optparse モジュール::

   ---------- Footnotes ----------

   (1) https://pybsddb.sourceforge.net


File: python.info,  Node: 日付時刻型,  Next: optparse モジュール,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>

1.20.17.1 日付時刻型
....................

タイムスタンプとして使うのに相応しい日付と時刻の型が *note datetime: 34.
モジュールとして追加されました。これら型は異なるカレンダであるとか多くの
洒落た機能をサポートはせずに、時刻表現の基礎だけに集中するものです。

3 つの基礎となるクラスがあり、 *note date: 1fa. は年・月・日を表現し、
*note time: 1fb. は時・分・秒を、 *note datetime: 4e2. が *note date:
1fa. と *note time: 1fb. の両方の属性すべてを持ちます。また、 *note
timedelta: bc3. は 2 つの時刻の差を表現し、タイムゾーンのロジックは抽象
クラス *note tzinfo: 7f6. から派生したクラスにより実装されます。

You can create instances of *note date: 1fa. and *note time: 1fb. by
either supplying keyword arguments to the appropriate constructor, e.g.
‘datetime.date(year=1972, month=10, day=15)’, or by using one of a
number of class methods.  For example, the *note today(): 16e3. class
method returns the current local date.

構築後の日付時刻クラスのインスタンスは全て *note immutable: 15b9. です。
オブジェクトから書式文字列を生成する数多くのメソッドがあります:

     >>> import datetime
     >>> now = datetime.datetime.now()
     >>> now.isoformat()
     '2002-12-30T21:27:03.994956'
     >>> now.ctime()  # Only available on date, datetime
     'Mon Dec 30 21:27:03 2002'
     >>> now.strftime('%Y %d %b')
     '2002 30 Dec'

The *note replace(): 16e4. method allows modifying one or more fields of
a *note date: 1fa. or *note datetime: 4e2. instance, returning a new
instance:

     >>> d = datetime.datetime.now()
     >>> d
     datetime.datetime(2002, 12, 30, 22, 15, 38, 827738)
     >>> d.replace(year=2001, hour = 12)
     datetime.datetime(2001, 12, 30, 12, 15, 38, 827738)
     >>>

インスタンスは比較可能で、ハッシュ出来、文字列に変換出来ます (結果は
*note isoformat(): d25. メソッドのものと同じです)。 と *note datetime:
4e2. はお互いに減算演算が可能で、 *note timedelta: bc3. インスタンスを加
算することも出来ます。最も大きな不足機能としては、文字列を解析して *note
date: 1fa. や *note datetime: 4e2. へ戻すための標準ライブラリサポートは
ありません。(--訳注: 2 点。「比較可能」の意味は 2.3 から 2.4 で意味が変
わっています。2.4 で *note date: 1fa. と *note datetime: 4e2. の比較は出
来なくなりました。2.3 では出来ていました。文字列からの *note datetime:
4e2. 構築は 2.5 で ‘strptime()’ が追加されています。--)

さらに詳しい情報については、モジュールのリファレンスドキュメントを参照し
てください。 (Contributed by Tim Peters.)


File: python.info,  Node: optparse モジュール,  Prev: 日付時刻型,  Up: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>

1.20.17.2 optparse モジュール
.............................

*note getopt: 65. モジュールはコマンドライン引数の単純な解析を提供してい
ます。新規に追加された *note optparse: a4. モジュール (元々 Optik と呼ば
れていたものです) は Unix の慣習に従ったもっと念入りなコマンドライン解析
を行い、自動的に ‘--help’ のための出力をし、異なったオプションに対して異
なったアクションを実行出来ます。 (--訳注: 2.7 以降は *note optparse: a4.
よりも新しい *note argparse: 7. を使ってください。--)

*note OptionParser: 16e6. インスタンスを作ることから始め、プログラムのオ
プションがどんなであるかそれに対して教えてやります:

     import sys
     from optparse import OptionParser

     op = OptionParser()
     op.add_option('-i', '--input',
                   action='store', type='string', dest='input',
                   help='set input filename')
     op.add_option('-l', '--length',
                   action='store', type='int', dest='length',
                   help='set maximum length of output')

コマンドラインの解析は *note parse_args(): 16e7. メソッドを呼び出すこと
で行います

     options, args = op.parse_args(sys.argv[1:])
     print options
     print args

これは、全てのオプションの値を含んだオブジェクトと残った引数を含む文字列
リストを返します。

色々な引数でこのスクリプトを実行すれば、あなたの期待するように動きます。
この例での 'length' 引数が自動的に整数に変換されることに注目してください
。

     $ ./python opt.py -i data arg1
     <Values at 0x400cad4c: {'input': 'data', 'length': None}>
     ['arg1']
     $ ./python opt.py --input=data --length=4
     <Values at 0x400cad2c: {'input': 'data', 'length': 4}>
     []
     $

ヘルプメッセージはあなたのために自動生成されます:

     $ ./python opt.py --help
     usage: opt.py [options]

     options:
       -h, --help            show this help message and exit
       -iINPUT, --input=INPUT
                             set input filename
       -lLENGTH, --length=LENGTH
                             set maximum length of output
     $

さらに詳しいことはモジュールのドキュメントを参照して下さい。

Optik は Getopt SIG の読者からの示唆を受けてGreg Ward により書かれました
。


File: python.info,  Node: Pymalloc 特殊化されたオブジェクトアロケータ,  Next: ビルドならびに C API の変更<12>,  Prev: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>,  Up: What's New in Python 2 3

1.20.18 Pymalloc: 特殊化されたオブジェクトアロケータ
----------------------------------------------------

Pymalloc は Vladimir Marangozov により書かれ Python 2.1 で追加された、特
殊化されたオブジェクトアロケータです。Pymalloc は典型的な Python プログ
ラムでのアロケーションのパターンにおいて、システムの ‘malloc()’ よりも高
速で省メモリであることを意図したものです。このアロケータは C の
‘malloc()’ 関数を大きなメモリプールを得るのに使い、それより小さなメモリ
要求はこれらプールで実現しています。

2.1 と 2.2 ではこの機能は実験的な位置付けでありデフォルトでは有効ではあ
りませんでした。これを有効にするには Python コンパイル時に ‘configure’ ス
クリプトに ‘--with-pymalloc’ オプションを明示的に与える必要がありました
。2.3 では pymalloc はさらに拡張され、また、デフォルトで有効になりました
。逆にこれを無効にするのに ‘--without-pymalloc’ を与える必要があります。

この変更は Python で書いたコードからは見えませんが、 pymalloc は C 拡張
内のバグを露にするかもしれません。C 拡張の著者は pymalloc を有効にしてテ
ストすべきです。というのも、ある種の正しくないコードが実行時にコアダンプ
しうるからです。

問題を起こすとりわけ一般的な誤りが一つあります。Python の C API 内には数
多くのメモリアロケーション関数がありますが、これは以前は単に C ライブラ
リの ‘malloc()’ と ‘free()’ への別名であり、何かの間違いでミスマッチな関
数呼び出しをしても、誤りは気付かれないものでした。今回のこのオブジェクト
アロケータを有効化すると、これら関数は ‘malloc()’ と ‘free()’ への別名で
はまったくなくて、メモリ解放に誤った関数を呼び出すとコアダンプし得ます。
例えば *note PyObject_Malloc(): e62. を使って獲得したメモリは ‘free()’ で
はなく *note PyObject_Free(): e60. を使って解放する必要があります。
Python に含まれるいくつかのモジュールがまさにこれに抵触し、修正の必要が
ありました。間違いなく多くのサードパーティモジュールが同じ問題を抱えてい
るでしょう。

この変更の一環として、メモリアロケーションのためのこんがらかった複数イン
ターフェイスが統合されて 2 つの API ファミリになりました。一方のファミリ
で獲得されたメモリは他方の関数で操作されることは許されません。一方のファ
ミリはメモリの塊を獲得するためのもので、もう一方は Python オブジェクトの
獲得に特殊化されたものです。

   * 何某かの区別のないメモリの塊を獲得・解放するのには「生メモリ」ファ
     ミリを使います: *note PyMem_Malloc(): e5f, *note PyMem_Realloc():
     1233, *note PyMem_Free(): 165b.

   * 「オブジェクトメモリ」ファミリは上述の pymalloc 機構へのインターフ
     ェイスであり、多数の「小さな」獲得をするための特化がされています:
     *note PyObject_Malloc(): e62, *note PyObject_Realloc(): 165c, *note
     PyObject_Free(): e60.

   * Python オブジェクトの獲得と解放には「オブジェクト」ファミリ *note
     PyObject_New: b7c, *note PyObject_NewVar: b7d, *note
     PyObject_Del(): 16ea. を使います。

Tim Peters による多大な仕事のおかげで、 2.3 の pymalloc はデバッグ機能も
提供しています。これはメモリの上書き、二重解放に関して、拡張モジュールと
インタプリタ自身について検出出来ます。このサポートを有効にするには
‘configure’ スクリプトにオプション ‘--with-pydebug’ を与えて Python イン
タプリタをデバッグバージョンとしてコンパイルしてください。

拡張の著者のために、Python 2.3 のソースとともにヘッダファイル
‘Misc/pymemcompat.h’ が配布されています。これは Python 拡張に 2.3 インタ
ーフェイスでのメモリ獲得を使えるようにするもので、1.5.2 以降の全てのバー
ジョンに対してコンパイル可能です。Python のソース配布物からファイルをコ
ピーして、あなたの拡張ソースにバンドル出来ます。

参考
....

‘https://hg.python.org/cpython/file/default/Objects/obmalloc.c’

     pymalloc 実装に関する完全な詳細については Python ソースコード内の
     ‘Objects/obmalloc.c’ ファイルの先頭のコメントを参照してください。上
     のファイルへのリンクは python.org の SVN ブラウザを指しています。


File: python.info,  Node: ビルドならびに C API の変更<12>,  Next: その他の変更と修正<2>,  Prev: Pymalloc 特殊化されたオブジェクトアロケータ,  Up: What's New in Python 2 3

1.20.19 ビルドならびに C API の変更
-----------------------------------

Python のビルド過程と C API の変更は以下の通りです:

   * ガーベージコレクションで使われている循環の検出実装が安定であること
     がわかったため、必須とすることになりました。Python をこれなしでコン
     パイルすることはもう出来ません。 ‘configure’ スクリプトの
     ‘--with-cycle-gc’ スイッチは削除されました。

   * Python がオプショナルでシェアドライブラリ (‘libpython2.3.so’) とし
     てビルド可能になりました。Python の ‘configure’ スクリプトに
     ‘--enable-shared’ オプションを与えることで可能です。 (Contributed
     by Ondrej Palkovsky.)

   * マクロ ‘DL_EXPORT’ と ‘DL_IMPORT’ が非推奨となっています。Python コ
     アが一般的にマクロ ‘PyAPI_FUNC’ と ‘PyAPI_DATA’ を使うのに対し、
     Python 拡張モジュールの初期化関数が新規マクロ *note PyMODINIT_FUNC:
     16ec. を使って宣言されなければならなくなりました。

   * ‘configure’ スクリプトに ‘--without-doc-strings’ オプションを与える
     ことで、ビルトイン関数とモジュールが docstring を持たないインタプリ
     タとしてコンパイル出来るようになりました。これは Python の実行形式
     ファイルを 10% 小さくしますが、もちろん Python ビルトインのヘルプが
     取得できないことにもなります。 (Contributed by Gustavo Niemeyer.)

   * ‘PyArg_NoArgs()’ マクロが非推奨となったので、これを使っているコード
     は修正しなければなりません。Python 2.2 以降ではメソッド定義テーブル
     では引数を持たず、引数チェックを省けることを示すのに *note
     METH_NOARGS: 16ed. フラグが使えます。2.2 以前の Python バージョンと
     の互換性が重要な場合には ‘PyArg_ParseTuple(args, "")’ を代わりに使
     えますが、 *note METH_NOARGS: 16ed. を使うより遅いです。

   * *note PyArg_ParseTuple(): 3c1. に符号なし整数の色々なサイズのための
     フォーマット文字が追加されました: unsigned char のための ‘B’,
     unsigned short int のための ‘H’, unsigned int のための ‘I’,
     unsigned long long のための ‘K’。

   * 新規関数 ‘PyObject_DelItemString(mapping, char *key)’ が
     ‘PyObject_DelItem(mapping, PyString_New(key))’ の速記法として追加さ
     れました。

   * ファイルオブジェクトの内部文字列バッファの管理が変更されて、必要な
     場合には指数関数的に増やすようになりました。
     ‘Lib/test/test_bufio.py’ 内のベンチマークテストの結果での速度向上は
     大幅なものです (ある一つの計測では 57 秒から 1.7 秒になりました)。

   * It's now possible to define class and static methods for a C
     extension type by setting either the *note METH_CLASS: 16ee. or
     *note METH_STATIC: 16ef. flags in a method's *note PyMethodDef:
     16f0. structure.

   * Python は Expat XML パーサのソースコードのコピーを丸抱えするように
     なり、これにより Expat のシステムのバージョンやローカルにインストー
     ルされたものへの依存がなくなっています。

   * If you dynamically allocate type objects in your extension, you
     should be aware of a change in the rules relating to the *note
     __module__: 617. and *note __name__: 16c4. attributes.  In summary,
     you will want to ensure the type's dictionary contains a
     ‘'__module__'’ key; making the module name the part of the type
     name leading up to the final period will no longer have the desired
     effect.  For more detail, read the API reference documentation or
     the source.

* Menu:

* ポート特有の変更: ポート特有の変更<3>.


File: python.info,  Node: ポート特有の変更<3>,  Up: ビルドならびに C API の変更<12>

1.20.19.1 ポート特有の変更
..........................

Support for a port to IBM's OS/2 using the EMX runtime environment was
merged into the main Python source tree.  EMX is a POSIX emulation layer
over the OS/2 system APIs.  The Python port for EMX tries to support all
the POSIX-like capability exposed by the EMX runtime, and mostly
succeeds; ‘fork()’ and *note fcntl(): 5d. are restricted by the
limitations of the underlying emulation layer.  The standard OS/2 port,
which uses IBM's Visual Age compiler, also gained support for
case-sensitive import semantics as part of the integration of the EMX
port into CVS. (Contributed by Andrew MacIntyre.)

On MacOS, most toolbox modules have been weaklinked to improve backward
compatibility.  This means that modules will no longer fail to load if a
single routine is missing on the current OS version.  Instead calling
the missing routine will raise an exception.  (Contributed by Jack
Jansen.)

The RPM spec files, found in the ‘Misc/RPM/’ directory in the Python
source distribution, were updated for 2.3.  (Contributed by Sean
Reifschneider.)

Other new platforms now supported by Python include AtheOS
(‘http://www.atheos.cx/’), GNU/Hurd, and OpenVMS.


File: python.info,  Node: その他の変更と修正<2>,  Next: Python 2 3 への移植,  Prev: ビルドならびに C API の変更<12>,  Up: What's New in Python 2 3

1.20.20 その他の変更と修正
--------------------------

いつものように、たくさんのほかの改善とバグフィックスがソースツリー全体に
渡って散らばっています。CVS 変更ログを検索すると、Python 2.2 から 2.3 に
かけて適用されたパッチは 523、バグ修正は 514 ありました。いずれも少なく
見積もって、です。

ほかの、さらに特筆すべき変更のいくつかを挙げます:

   * 環境変数 *note PYTHONINSPECT: 16f3. をセットしておくと、Python イン
     タプリタが Python プログラム実行後に対話モードに入ります。これは
     Python を *note -i: 16f4. で起動するのと同じです。環境変数は Python
     インタプリタ実行前にセットするか、Python プログラムのその実行の一部
     としてセットすることが出来ます。

   * ‘regrtest.py’ スクリプトで「'foo' を除く全てのリソース」とする手段
     が出来ました。 ‘-u’ オプションにリソース名を渡すのにハイフン
     (‘'-'’) を前置すると「このリソースを除く」ことを意味します。例えば
     '‘-uall,-bsddb’' は ‘bsddb’ を除く全てのリソースを有効にするのに使
     えます。

   * ドキュメントのビルドに使われるツールは今では Unix 同様に Cygwin で
     も動作します。

   * ‘SET_LINENO’ 命令コード (opcode) は削除されました。彼方の昔に戻れば
     、この命令コードはトレースバック内で行番号を生成し、トレース関数を
     サポートするのに必要でした (例えば *note pdb: aa. のために)。Python
     1.5 より、トレースバック内の行番号は "python -O" で働くための異なっ
     たメカニズムを用いて計算で求められてきました。2.3 のためには
     Michael Hudson がトレース関数を呼ぶのに決定する似た方法を実装しまし
     たので、 ‘SET_LINENO’ の必要性は完全になくなりました。

     Python コードから何か異なる結果を見つけるのは、 *note -O: 18c. なし
     で Python を実行する際のわずかなスピードアップを別とすれば、困難か
     もしれません。

     フレームオブジェクトの *note f_lineno: 9af. フィールドにアクセスし
     ている C 拡張は、代わりに ‘PyCode_Addr2Line(f->f_code, f->f_lasti)’
     を呼び出すべきです。これは以前の Python バージョンでも "python -O"
     のもとでコードが動作するのにも望ましい効果を持つでしょう。

     気の利いた新機能としては、トレース関数は、今ではフレームオブジェク
     トの *note f_lineno: 9af. 属性を、次に実行される行に変更してセット
     します。 *note pdb: aa. デバッガにはこの新機能の恩恵を受けて ‘jump’
     コマンドが追加されています。 (Implemented by Richie Hindle.)


File: python.info,  Node: Python 2 3 への移植,  Next: 謝辞<5>,  Prev: その他の変更と修正<2>,  Up: What's New in Python 2 3

1.20.21 Python 2.3 への移植
---------------------------

このセクションでは前述の変更により必要となるかもしれないコードの変更を列
挙します:

   * *note yield: bc2. は今では常にキーワードです。変数名として使ってい
     たならば、別の名前を選ぶ必要があります。

   * 文字列 'X' と 'Y' について、 ‘X in Y’ は 'X' が一文字以上の場合でも
     動作するようになりました。

   * *note int(): 19b. 型コンストラクタは、文字列や浮動小数点数を整数に
     収める際、それがとても大き場合に *note OverflowError: a81. を投げる
     のではなく長整数を返すようになっています。

   * 8 ビット文字を含んだ Unicode 文字列をソースコードに埋め込む場合、フ
     ァイルのエンコーディング (UTF-8, Latin-1, あるいはほか何か) を、フ
     ァイルの先頭のコメントに宣言しなければなりません。 *note PEP 263;
     ソースコードのエンコーディング: 16a3. を参照してください。

   * ‘_tkinter’ を介した Tcl メソッド呼び出しは今では文字列だけを返すの
     ではありません。代わりに Tcl は対応する Python の等価なオブジェクト
     に変換されたオブジェクトを返します。Python に等価なものがなければ
     ‘_tkinter.Tcl_Obj’ で包んで返します。

   * ‘0xffffffff’ のような大きな値の 8 進、16 進リテラルで *note
     FutureWarning: 659. が発行されます。2.3 ではこれは 32 ビットの値に
     格納されて結果は負の値になりますが、Python 2.4 ではこれは正の長整数
     になります。

     この警告の修正をする方法が少しだけあります。本当に正の値が欲しいの
     であれば ‘L’ をリテラルの最後に付けて下さい。32 ビット分だけの下位
     ビットセットで 32 ビット整数を取り出したいのであれば、また、 ‘~(1
     << 31)’ のような式を使ってきたのであれば、おそらく全ビットをセット
     することから始めて上位ビットをクリアするのが最も簡明です。例えば最
     上位ビット (ビット 31) を単にクリアするには ‘0xffffffffL
     &~(1L<<31)’ と書けます。(--訳注: 2 点。Python 3 サポートを検討する
     ならば ‘L’ は付けないように。2.4 以降は警告もなしに長整数になります
     し。もう一点はこのパラグラフ全体について。根本的に警告への対処の話
     をしてるようで後半はほとんど本質でない話をしているので意味不明な文
     章になっています。本当に 2.3 を使わなければならないのでない限り、こ
     の文章を真面目に理解しようとしなくとも良いと思います(本質的な措置は
     ‘L’ を付けることしかない、2.3 では)。--)

   * ‘__debug__’ に代入することでアサーションを無効にすることは出来なく
     なりました。

   * Distutils の ‘setup()’ 関数に 'depends' のような色々な新しいキーワ
     ード引数が追加されています。Distutils の古いバージョンでは未知のキ
     ーワードを渡すと処理を中断してしまいます。新旧で動作させなければな
     らないのであれば、 ‘setup.py’ 内で ‘get_distutil_options()’ 関数の
     有無をチェックし、それらをサポートするバージョンの Distutils でのみ
     新しいキーワード引数を使うようにしてください:

          from distutils import core

          kw = {'sources': 'foo.c', ...}
          if hasattr(core, 'get_distutil_options'):
              kw['depends'] = ['foo.h']
          ext = Extension(**kw)

   * ‘None’ を変数名に使うと *note SyntaxWarning: 1ae. 警告を出すように
     なっています。

   * Python と一緒に含まれるモジュールで定義される拡張型の名前にモジュー
     ル名と ‘'.'’ が型名の頭に付くようになっています。


File: python.info,  Node: 謝辞<5>,  Prev: Python 2 3 への移植,  Up: What's New in Python 2 3

1.20.22 謝辞
------------

著者は提案の申し出や修正、様々なこの記事の草稿の助けをしてくれた以下の人
々に感謝します: Jeff Bauer, Simon Brunning, Brett Cannon, Michael
Chermside, Andrew Dalke, Scott David Daniels, Fred L. Drake, Jr., David
Fraser, Kelly Gerber, Raymond Hettinger, Michael Hudson, Chris Lambert,
Detlef Lannert, Martin von Löwis, Andrew MacIntyre, Lalo Martins, Chad
Netzer, Gustavo Niemeyer, Neal Norwitz, Hans Nowak, Chris Reedy,
Francesco Ricciardi, Vinay Sajip, Neil Schemenauer, Roman Suzi, Jason
Tishler, Just van Rossum.


File: python.info,  Node: What's New in Python 2 2,  Next: What's New in Python 2 1,  Prev: What's New in Python 2 3,  Up: What's New in Python

1.21 What's New in Python 2.2
=============================


著者: A.M. Kuchling

* Menu:

* はじめに::
* PEP 252 と PEP 253; 型とクラスについての変更: PEP 252 と PEP 253 型とクラスについての変更.
* PEP 234; イテレータ: PEP 234 イテレータ.
* PEP 255; 単純なジェネレータ: PEP 255 単純なジェネレータ<2>.
* PEP 237; 長整数と整数を一体化していく: PEP 237 長整数と整数を一体化していく<2>.
* PEP 238; 除算演算子を変更していく: PEP 238 除算演算子を変更していく.
* Unicode の変更::
* PEP 227; 入れ子状のスコープ: PEP 227 入れ子状のスコープ.
* 新しいモジュールと改良されたモジュール: 新しいモジュールと改良されたモジュール<3>.
* インタプリタの変更と修正::
* その他の変更と修正: その他の変更と修正<3>.
* 謝辞: 謝辞<6>.


File: python.info,  Node: はじめに,  Next: PEP 252 と PEP 253 型とクラスについての変更,  Up: What's New in Python 2 2

1.21.1 はじめに
---------------

この文書は 2002 年 10 月 14 日にリリースされた Python 2.2.2 の新機能につ
いて解説します。Python 2.2.2 は 2001 年 12 月 21 日にリリースされた
Python 2.2 のバグフィックスリリースです。

Python 2.2 は「クリーンアップリリース」と考えることが出来ます。ジェネレ
ータやイテレータのように、完全に書き直されたいくつかの機能があります。ほ
とんどのその変更は著しくて以前とはかけ離れたものとなりましたが、これは言
語設計の不品行と暗黒面を綺麗に掃除することを目的としています。

このドキュメントは個々の新機能の完全な詳細を提供するのではなくて、簡易な
概要を提供することを目的にしています。完全な詳細が知りたければ、Python ラ
イブラリリファレンス(1) 、Python リファレンスマニュアル(2) のような
Python 2.2 のドキュメントを参照すべきです。設計と実装の根拠を理解したい
場合は、新機能に関する PEP を参照してください。

   ---------- Footnotes ----------

   (1) https://docs.python.org/2.2/lib/lib.html

   (2) https://docs.python.org/2.2/ref/ref.html


File: python.info,  Node: PEP 252 と PEP 253 型とクラスについての変更,  Next: PEP 234 イテレータ,  Prev: はじめに,  Up: What's New in Python 2 2

1.21.2 PEP 252 と PEP 253: 型とクラスについての変更
---------------------------------------------------

最大にして広範に影響が及ぶ Python 2.2 の変更は、 オブジェクトとクラスの
Python モデルについてのものです。変更は後方互換であるはずなので、あなた
のコードは変更なしで動きそうです。ですがその変更は、いくつかの素晴らしい
能力を発揮させます。この、本記事中において最も長くて複雑なセクションにつ
いて始める前に、変更の概要を提供し、いくつかの所感を提示しておこうと思い
ます。

A long time ago I wrote a web page listing flaws in Python's design.
One of the most significant flaws was that it's impossible to subclass
Python types implemented in C. In particular, it's not possible to
subclass built-in types, so you can't just subclass, say, lists in order
to add a single useful method to them.  The ‘UserList’ module provides a
class that supports all of the methods of lists and that can be
subclassed further, but there's lots of C code that expects a regular
Python list and won't accept a *note UserList: 16fd. instance.

Python 2.2 はこれを修正し、また、その過程においていくつかの心躍る新機能
を追加しました。簡単に要約します:

   * あなたはリストのような組み込み型をサブクラス化出来ます。整数でさえ
     出来ます。そしてあなたのサブクラスは、元の型を要求している全ての場
     所で動作します。

   * 以前より使えたインスタンスメソッド加え、静的メソッド、クラスメソッ
     ドを今や定義出来ます。

   * It's also possible to automatically call methods on accessing or
     setting an instance attribute by using a new mechanism called
     'properties'.  Many uses of *note __getattr__(): 6fa. can be
     rewritten to use properties instead, making the resulting code
     simpler and faster.  As a small side benefit, attributes can now
     have docstrings, too.

   * 'slots' を使って、インスタンスの適正な属性を特定の集合に制限できま
     す。これはタイプミスに対する安全装置にも出来ますし、将来のバージョ
     ンの Python では今よりも最適化される可能性があります。

一部のユーザはこれら全ての変更に懸念を表明しました。そうだね、彼らは言い
ます、新しい機能はかっこいいし昔の Python では出来なかった全ての芸当の役
に立つさ、だけどさ、それって言語をより複雑にするよなぁ。一部の人々はずっ
と常に、Python が単純さを保つことを提言してきました。そして彼らはその単
純さが失われると感じたのです。

個人的に私は、それらは心配には及ばない、と思っています。多くのそれら新機
能は随分と秘伝的で、あなたはそれらに気付く必要もないままたくさんの
Python コードを書けます。単純なクラスを書くことはかつてよりも難しいとい
うことはなく、実際にそれを必要としない限りは、秘伝をわざわざ学習すること
も教育することも必要ありません。以前ならば C 言語からでしか可能でなかっ
たようなある種の複雑なタスクは、いまやピュアな python から出来て、私には
何もかもが良い方向に思えます。

この記事では全てのショーケースの品を陳列しようとはしませんし、将来の拡張
のために必要な小さな変更は説明しません。代わりにこのセクションではおおま
かなアウトラインを描きます。Python 2.2 の新しいオブジェクトモデルの追加
的な情報源については、 *note 関連リンク: 16fe. を参照してください。

* Menu:

* 旧と新クラス::
* デスクリプタ::
* 多重継承; ダイヤモンドルール: 多重継承 ダイヤモンドルール.
* 属性アクセス::
* 関連リンク::


File: python.info,  Node: 旧と新クラス,  Next: デスクリプタ,  Up: PEP 252 と PEP 253 型とクラスについての変更

1.21.2.1 旧と新クラス
.....................

まず、 Python 2.2 は本当に 2 種類のクラスを持っているのだ、ということを
知る必要があります: クラシック、あるいは旧スタイルクラス、と、新スタイル
クラスです。旧スタイルクラスのモデルは、以前のバージョンのクラスモデルと
完全に同じものです。このセクションに記述する全ての新機能は、全て新スタイ
ルクラスだけに適用されるものです。この逸脱が未来永劫続くことは望まれてい
ません; 最終的には旧スタイルクラスは撤廃されます。たぶん Python 3.0 で。

では、新スタイルクラスは、どうやって定義すればいいのでしょう?  答えは、
既存の新スタイルクラスをサブクラス化することです。たとえば整数、リスト、
辞書やファイルでさえも、ほとんどの Python 組み込み型は今では新スタイルク
ラスです。 *note object: c7e. という名の新スタイルクラスは全ての組み込み
型の基底クラスとして既に追加されていて、相応しい組み込み型がなければ単に
*note object: c7e. をサブクラス化すれば良いです:

     class C(object):
         def __init__ (self):
             ...
         ...

This means that *note class: 14ef. statements that don't have any base
classes are always classic classes in Python 2.2.  (Actually you can
also change this by setting a module-level variable named
‘__metaclass__’ -- see PEP 253(1) for the details -- but it's easier to
just subclass *note object: c7e.)

組み込み型(ビルトイン型)のための型オブジェクトは、クレバーなトリックを使
って名付けられた組み込み(ビルトイン)として利用可能です。Python は既に組
み込み関数 *note int(): 19b, *note float(): 196, *note str(): 169. を持
っていました。2.2 にはその関数はなくなり、型オブジェクトは呼び出されると
ファクトリとして振舞います:

     >>> int
     <type 'int'>
     >>> int('123')
     123

To make the set of types complete, new type objects such as *note
dict(): 183. and ‘file()’ have been added.  Here's a more interesting
example, adding a ‘lock()’ method to file objects:

     class LockableFile(file):
         def lock (self, operation, length=0, start=0, whence=0):
             import fcntl
             return fcntl.lockf(self.fileno(), operation,
                                length, start, whence)

The now-obsolete ‘posixfile’ module contained a class that emulated all
of a file object's methods and also added a ‘lock()’ method, but this
class couldn't be passed to internal functions that expected a built-in
file, something which is possible with our new ‘LockableFile’.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0253/


File: python.info,  Node: デスクリプタ,  Next: 多重継承 ダイヤモンドルール,  Prev: 旧と新クラス,  Up: PEP 252 と PEP 253 型とクラスについての変更

1.21.2.2 デスクリプタ
.....................

In previous versions of Python, there was no consistent way to discover
what attributes and methods were supported by an object.  There were
some informal conventions, such as defining ‘__members__’ and
‘__methods__’ attributes that were lists of names, but often the author
of an extension type or a class wouldn't bother to define them.  You
could fall back on inspecting the *note __dict__: 77d. of an object, but
when class inheritance or an arbitrary ‘__getattr__()’ hook were in use
this could still be inaccurate.

その新しいクラスモデルの根底にあったひとつの大きな着想は、 'descriptors'
を使ったオブジェクトの属性を記述する API を正式なものにしてしまうことで
す。デスクリプタは属性の値を記述し、それがメソッドなのかフィールドなのか
を伝えます。デスククリプタ API によって、静的メソッドとクラスメソッドが
、より風変わりなコンストラクタとともに可能となりました。

属性デスクリプタはクラスオブジェクト内部に棲息するオブジェクトで、それ自
身のいくつかの属性を持っています:

   * *note __name__: 1272. は属性の名前です。

   * *note __doc__: b21. is the attribute's docstring.

   * ‘__get__(object)’ は 'object' から属性値を取り出すメソッドです。

   * ‘__set__(object, value)’ は 'object' の属性に 'value' をセットする
     メソッドです。

   * ‘__delete__(object, value)’ は 'object' の 'value' 属性を削除します
     。

例えば、あなたが ‘obj.x’ と書いたときに Python が実際に行うことは以下で
す:

     descriptor = obj.__class__.x
     descriptor.__get__(obj)

For methods, *note descriptor.__get__: 1701. returns a temporary object
that's callable, and wraps up the instance and the method to be called
on it.  This is also why static methods and class methods are now
possible; they have descriptors that wrap up just the method, or the
method and the class.  As a brief explanation of these new kinds of
methods, static methods aren't passed the instance, and therefore
resemble regular functions.  Class methods are passed the class of the
object, but not the object itself.  Static and class methods are defined
like this:

     class C(object):
         def f(arg1, arg2):
             ...
         f = staticmethod(f)

         def g(cls, arg1, arg2):
             ...
         g = classmethod(g)

The *note staticmethod(): 453. function takes the function ‘f()’, and
returns it wrapped up in a descriptor so it can be stored in the class
object.  You might expect there to be special syntax for creating such
methods (‘def static f’, ‘defstatic f()’, or something like that) but no
such syntax has been defined yet; that's been left for future versions
of Python.

スロットとプロパティのような新機能がさらに新種のデスクリプタとして実装さ
れ、また、何か奇抜なデスクリプタクラスを書くことは難しくはありません。例
えば、Eiffel 言語スタイルのメソッドに対する事前条件・事後条件を書くこと
を可能とするデスクリプタクラスを書けるかもしれません。それを使ったクラス
はきっとこう定義出来るでしょう:

     from eiffel import eiffelmethod

     class C(object):
         def f(self, arg1, arg2):
             # The actual function
             ...
         def pre_f(self):
             # Check preconditions
             ...
         def post_f(self):
             # Check postconditions
             ...

         f = eiffelmethod(f, pre_f, post_f)

Note that a person using the new ‘eiffelmethod()’ doesn't have to
understand anything about descriptors.  This is why I think the new
features don't increase the basic complexity of the language.  There
will be a few wizards who need to know about it in order to write
‘eiffelmethod()’ or the ZODB or whatever, but most users will just write
code on top of the resulting libraries and ignore the implementation
details.


File: python.info,  Node: 多重継承 ダイヤモンドルール,  Next: 属性アクセス,  Prev: デスクリプタ,  Up: PEP 252 と PEP 253 型とクラスについての変更

1.21.2.3 多重継承: ダイヤモンドルール
.....................................

多重継承は名前解決のルールの変更を経てより有用なものになっています。クラ
スのこのようなセットを考えてみましょう (ダイアグラムは Guido van Rossum
による PEP 253(1) より):

           class A:
             ^ ^  def save(self): ...
            /   \
           /     \
          /       \
         /         \
     class B     class C:
         ^         ^  def save(self): ...
          \       /
           \     /
            \   /
             \ /
           class D

The lookup rule for classic classes is simple but not very smart; the
base classes are searched depth-first, going from left to right.  A
reference to ‘D.save()’ will search the classes ‘D’, ‘B’, and then ‘A’,
where ‘save()’ would be found and returned.  ‘C.save()’ would never be
found at all.  This is bad, because if ‘C’'s ‘save()’ method is saving
some internal state specific to ‘C’, not calling it will result in that
state never getting saved.

新スタイルクラスはちょっと説明するのに複雑な違ったアルゴリズムを使い、こ
の状況では正しいことをします(Python 2.3 ではこのアルゴリズムはさらに変更
されて、ほとんどのケースで同じ結果となり、本当に複雑な継承グラフの場合に
もっと有用な結果となりました)。

  1. List all the base classes, following the classic lookup rule and
     include a class multiple times if it's visited repeatedly.  In the
     above example, the list of visited classes is [‘D’, ‘B’, ‘A’, ‘C’,
     ‘A’].

  2. Scan the list for duplicated classes.  If any are found, remove all
     but one occurrence, leaving the 'last' one in the list.  In the
     above example, the list becomes [‘D’, ‘B’, ‘C’, ‘A’] after dropping
     duplicates.

Following this rule, referring to ‘D.save()’ will return ‘C.save()’,
which is the behaviour we're after.  This lookup rule is the same as the
one followed by Common Lisp.  A new built-in function, *note super():
1a6, provides a way to get at a class's superclasses without having to
reimplement Python's algorithm.  The most commonly used form will be
‘super(class, obj)’, which returns a bound superclass object (not the
actual class object).  This form will be used in methods to call a
method in the superclass; for example, ‘D’'s ‘save()’ method would look
like this:

     class D (B,C):
         def save (self):
             # Call superclass .save()
             super(D, self).save()
             # Save D's private information here
             ...

*note super(): 1a6. は ‘super(class)’ や ‘super(class1, class2)’ のよう
に呼ばれれば非束縛のスーパークラスオブジェクトも返せますが、これはあまり
役には立たないでしょう。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0253/


File: python.info,  Node: 属性アクセス,  Next: 関連リンク,  Prev: 多重継承 ダイヤモンドルール,  Up: PEP 252 と PEP 253 型とクラスについての変更

1.21.2.4 属性アクセス
.....................

A fair number of sophisticated Python classes define hooks for attribute
access using *note __getattr__(): 6fa.; most commonly this is done for
convenience, to make code more readable by automatically mapping an
attribute access such as ‘obj.parent’ into a method call such as
‘obj.get_parent’.  Python 2.2 adds some new ways of controlling
attribute access.

まず、 ‘__getattr__(attr_name)’ は新スタイルクラスにおいてもなおサポート
され、変更はありません。これまで同様に、 ‘obj.foo’ アクセスが試みられて
、インスタンスの辞書に ‘foo’ 名の属性が見つからなければ呼び出されます。

New-style classes also support a new method,
‘__getattribute__(attr_name)’.  The difference between the two methods
is that *note __getattribute__(): dcb. is 'always' called whenever any
attribute is accessed, while the old *note __getattr__(): 6fa. is only
called if ‘foo’ isn't found in the instance's dictionary.

However, Python 2.2's support for 'properties' will often be a simpler
way to trap attribute references.  Writing a ‘__getattr__()’ method is
complicated because to avoid recursion you can't use regular attribute
accesses inside them, and instead have to mess around with the contents
of *note __dict__: 77d.  *note __getattr__(): 6fa. methods also end up
being called by Python when it checks for other methods such as *note
__repr__(): 82f. or ‘__coerce__()’, and so have to be written with this
in mind.  Finally, calling a function on every attribute access results
in a sizable performance loss.

*note property: 4b3. is a new built-in type that packages up three
functions that get, set, or delete an attribute, and a docstring.  For
example, if you want to define a ‘size’ attribute that's computed, but
also settable, you could write:

     class C(object):
         def get_size (self):
             result = ... computation ...
             return result
         def set_size (self, size):
             ... compute something based on the size
             and set internal state appropriately ...

         # Define a property.  The 'delete this attribute'
         # method is defined as None, so the attribute
         # can't be deleted.
         size = property(get_size, set_size,
                         None,
                         "Storage size of this instance")

That is certainly clearer and easier to write than a pair of
‘__getattr__()’/‘__setattr__()’ methods that check for the ‘size’
attribute and handle it specially while retrieving all other attributes
from the instance's *note __dict__: 77d.  Accesses to ‘size’ are also
the only ones which have to perform the work of calling a function, so
references to other attributes run at their usual speed.

もう一つ最後、新しいクラス属性 *note __slots__: 1704. を使うと、オブジェ
クトで参照出来る属性リストを制約することが出来ます。Python オブジェクト
は普通非常に動的で、どんなときにもインスタンスに対して単に
‘obj.new_attr=1’ とするだけで新しい属性を定義出来ます。新スタイルクラス
は *note __slots__: 1704. という名前のクラス属性を定義出来、これにより適
正な属性名集合を特定の集合に制限出来ます。実例をみるのが早いです:

     >>> class C(object):
     ...     __slots__ = ('template', 'name')
     ...
     >>> obj = C()
     >>> print obj.template
     None
     >>> obj.template = 'Test'
     >>> print obj.template
     Test
     >>> obj.newattr = None
     Traceback (most recent call last):
       File "<stdin>", line 1, in ?
     AttributeError: 'C' object has no attribute 'newattr'

*note __slots__: 1704. リストに含めなかった属性への代入を試みて *note
AttributeError: 5f0. になっていることに注目してください。


File: python.info,  Node: 関連リンク,  Prev: 属性アクセス,  Up: PEP 252 と PEP 253 型とクラスについての変更

1.21.2.5 関連リンク
...................

このセクションは新機能について、あなたがプログラミングを始める説明として
は十分な簡単な概要だけ示しました。ですが、多くの詳細は、単純化したり無視
しています。もっと完全な光景を眺めたければ、どこに行けば良いでしょうか?

The *note デスクリプタ ガイド: 1706. is a lengthy tutorial introduction
to the descriptor features, written by Guido van Rossum.  If my
description has whetted your appetite, go read this tutorial next,
because it goes into much more detail about the new features while still
remaining quite easy to read.

次です。2 つの関連する PEP、 PEP 252(1), PEP 253(2) があります。 PEP
252(3) は "型をもっとクラスに似せる(Making Types Look More Like
Classes)" というタイトルで、デスクリプタ API についてカバーしています。
PEP 253(4) は "組み込み型のサブタイプ化(Subtyping Built-in Types)" とい
うタイトルで、組み込み型のサブタイプを可能とするための型オブジェクトの変
更について記述しています。 PEP 253(5) は 252 よりも複雑な PEP で、型とメ
タ型で必要な説明のいくつかのポイントでは、あなたの脳味噌は爆発するかもし
れないです。どちらの PEP も、著・実装ともに、Zope Corp.  チームの残りの
メンバーからのかなりの支援を受けて、Guido van Rossum によって書かれまし
た。

最後ですが、究極の権威があります: ソースコードです。型ハンドリングのほと
んどの機構は ‘Objects/typeobject.c’ 内にあります。ただしこれに頼るのは、
python-list や python-dev へ質問を投稿することを含むほかの全ての手段を使
い果たしたのちの最後の手段にしてください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0252/

   (2) https://peps.python.org/pep-0253/

   (3) https://peps.python.org/pep-0252/

   (4) https://peps.python.org/pep-0253/

   (5) https://peps.python.org/pep-0253/


File: python.info,  Node: PEP 234 イテレータ,  Next: PEP 255 単純なジェネレータ<2>,  Prev: PEP 252 と PEP 253 型とクラスについての変更,  Up: What's New in Python 2 2

1.21.3 PEP 234: イテレータ
--------------------------

2.2 でのもう一つの重要な追加は、C と Python レベル両方に対するイテレーシ
ョンインターフェイスです。オブジェクトが呼び出し元からどのように反復され
るのか定義出来ます。

In Python versions up to 2.1, the usual way to make ‘for item in obj’
work is to define a *note __getitem__(): 588. method that looks
something like this:

     def __getitem__(self, index):
         return <next item>

*note __getitem__(): 588. is more properly used to define an indexing
operation on an object so that you can write ‘obj[5]’ to retrieve the
sixth element.  It's a bit misleading when you're using this only to
support *note for: 34a. loops.  Consider some file-like object that
wants to be looped over; the 'index' parameter is essentially
meaningless, as the class probably assumes that a series of *note
__getitem__(): 588. calls will be made with 'index' incrementing by one
each time.  In other words, the presence of the *note __getitem__():
588. method doesn't mean that using ‘file[5]’ to randomly access the
sixth element will work, though it really should.

In Python 2.2, iteration can be implemented separately, and *note
__getitem__(): 588. methods can be limited to classes that really do
support random access.  The basic idea of iterators is simple.  A new
built-in function, ‘iter(obj)’ or ‘iter(C, sentinel)’, is used to get an
iterator.  ‘iter(obj)’ returns an iterator for the object 'obj', while
‘iter(C, sentinel)’ returns an iterator that will invoke the callable
object 'C' until it returns 'sentinel' to signal that the iterator is
done.

Python classes can define an ‘__iter__()’ method, which should create
and return a new iterator for the object; if the object is its own
iterator, this method can just return ‘self’.  In particular, iterators
will usually be their own iterators.  Extension types implemented in C
can implement a *note tp_iter: 1708. function in order to return an
iterator, and extension types that want to behave as iterators can
define a *note tp_iternext: 1709. function.

それでは、結局のところイテレータは実際どんなでしょうか?  これに必要なメ
ソッドは一つ、 *note next(): 9d8. です (--訳注: Python 3 で ‘__next__’ に
変更されています--)。これは引数を取らず、次の値を返します。返すべき値が
なくなったら、 *note next(): 9d8. 呼び出しは *note StopIteration: df5. 例
外を送出しなければなりません:

     >>> L = [1,2,3]
     >>> i = iter(L)
     >>> print i
     <iterator object at 0x8116870>
     >>> i.next()
     1
     >>> i.next()
     2
     >>> i.next()
     3
     >>> i.next()
     Traceback (most recent call last):
       File "<stdin>", line 1, in ?
     StopIteration
     >>>

In 2.2, Python's *note for: 34a. statement no longer expects a sequence;
it expects something for which *note iter(): 9d7. will return an
iterator.  For backward compatibility and convenience, an iterator is
automatically constructed for sequences that don't implement
‘__iter__()’ or a *note tp_iter: 1708. slot, so ‘for i in [1,2,3]’ will
still work.  Wherever the Python interpreter loops over a sequence, it's
been changed to use the iterator protocol.  This means you can do things
like this:

     >>> L = [1,2,3]
     >>> i = iter(L)
     >>> a,b,c = i
     >>> a,b,c
     (1, 2, 3)

いくつかの Python の基礎型には既にイテレータのサポートが追加されています
。辞書に対して *note iter(): 9d7. を呼び出すと、キーの反復をするイテレー
タが返ります:

     >>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,
     ...      'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}
     >>> for key in m: print key, m[key]
     ...
     Mar 3
     Feb 2
     Aug 8
     Sep 9
     May 5
     Jun 6
     Jul 7
     Jan 1
     Apr 4
     Nov 11
     Dec 12
     Oct 10

That's just the default behaviour.  If you want to iterate over keys,
values, or key/value pairs, you can explicitly call the ‘iterkeys()’,
‘itervalues()’, or ‘iteritems()’ methods to get an appropriate iterator.
In a minor related change, the *note in: 34b. operator now works on
dictionaries, so ‘key in dict’ is now equivalent to ‘dict.has_key(key)’.

ファイルもイテレータを提供しています。これはファイルに読むべき行がなくな
るまで *note readline(): bf. を呼び出すもので、つまりファイルを行ごとに
読み出すのにこのように書けるわけです:

     for line in file:
         # do something for each line
         ...

イテレータは前進しか出来ないことに注意してください; 前の要素を取り出す手
段もなければ、イテレータをリセットしたりコピーしたりといったことも出来ま
せん。イテレータオブジェクトにそのような追加の能力を持たせることは出来ま
すが、イテレータプロトコルが規定するのは *note next(): 9d8. メソッドのみ
です。

参考
....

PEP 234(1): イテレータ

     著: Ka-Ping Yee と GvR (Guido van Rossum); 実装: Python Labs クルー
     , 主に GvR と Tim Peters.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0234/


File: python.info,  Node: PEP 255 単純なジェネレータ<2>,  Next: PEP 237 長整数と整数を一体化していく<2>,  Prev: PEP 234 イテレータ,  Up: What's New in Python 2 2

1.21.4 PEP 255: 単純なジェネレータ
----------------------------------

ジェネレータはもう一つの新機能で、これはイテレータの導入と連携するもので
す。

Python や C の標準的な関数コールについては、よくご存じに違いありません。
関数を呼ぶと、ローカル変数を作るプライベートな名前空間ができますね。その
関数が *note return: 1af. 文まで来ると、ローカル変数が破壊されてから、返
り値が呼び出し元に返ります。次に同じ関数をもう一度呼ぶと、新しいプライベ
ート名前空間に新規のローカル変数が作られるのです。しかし、関数を出るとき
にローカル変数を捨てなければどうなるでしょうか。その出ていったところから
関数を続行できたとしたら、どうでしょう。これこそジェネレータが提供する機
能です; すなわち、ジェネレータは続行できる関数と考えることができます。

ジェネレータ関数の最も単純な例です:

     def generate_ints(N):
         for i in range(N):
             yield i

新しいキーワード *note yield: bc2. がジェネレータのために導入されました
。 ‘yield’ ステートメントを含むどんな関数もジェネレータ関数です; Python
バイトコードコンパイラはこれを検知し、関数が特別に扱われるように翻訳しま
す。新たなキーワードの導入なので、ジェネレータを使えるようにするには
‘from __future__ import generators’ ステートメントをモジュールソースコー
ドの先頭付近に含めなければなりません。Python 2.3 ではこのステートメント
は不要になります。(--訳注: Python 2.5 の PEP 342 も参照して下さい。この
2.2 で導入時点の ‘yield’ はステートメントではなく式に変更されています。
--)

ジェネレータ関数を呼び出すと、単一の値の代わりにイテレータプロトコルに対
応したオブジェクトを返します。上の例で ‘yield’ を実行したとき、ジェネレ
ータは ‘return’ 文のようにして ‘i’ の値を生成します。 ‘yield’ と
‘return’ 文の大きな違いは、 ‘yield’ に到達した段階でジェネレータの実行状
態が一時停止になって、ローカル変数が保存される点です。次回そのジェネレー
タの ‘.next()’ メソッドを呼ぶと、 ‘yield’ の直後から関数が実行を再開しま
す。(複雑な理由により、 ‘yield’ は ‘try’...*note finally: 1b0. の ‘try’
ブロック内に含めることは許されていません; PEP 255(1) に ‘yield’ と例外の
相互作用についての詳細説明がありますので参照して下さい。) -- (--訳注:
Python 2.5 の PEP 342 で *note try: 8f8...*note finally: 1b0. 内に置けな
いという制約はなくなりました。また、 *note try: 8f8...*note finally:
1b0. の *note try: 8f8. 、とここであえて特定しているのは、同じく 2.5 の
PEP 341 によって try/except/finally の一体化されるまでは、 ‘finally’ の
‘try’ と ‘except’ の ‘try’ が別物だったからです。--)

上記の ‘generate_ints()’ ジェネレータはこんな具合に使います:

     >>> gen = generate_ints(3)
     >>> gen
     <generator object at 0x8117f90>
     >>> gen.next()
     0
     >>> gen.next()
     1
     >>> gen.next()
     2
     >>> gen.next()
     Traceback (most recent call last):
       File "<stdin>", line 1, in ?
       File "<stdin>", line 2, in generate_ints
     StopIteration

同じく ‘for i in generate_ints(5)’ や ‘a,b,c = generate_ints(3)’ といっ
た書き方もできます。

ジェネレータ関数内で *note return: 1af. 文は、引数を付けずに、処理の終わ
りを知らせるためにだけ使うことができます; ‘return’ を実行したあとは、も
うそのジェネレータが値を返すことはできません。ジェネレータ関数の中では、
‘return 5’ などと値を付けた ‘return’ は構文エラーです。ジェネレータの出
力が終わったことを示すには、ほかにも、手動で *note StopIteration: df5. を
投げてもいいですし、関数の最後まで実行するだけでも同じことになります。
(--訳注: Python 2.7 まではジェネレータ内での戻り値のある ‘return 5’ は構
文エラーになりますが、少なくとも Python 3.4 で構文エラーとはなりません。
単に無視されます。リファレンスに言及されていない振舞いなので、何かの事故
かもしれません。いずれにせよジェネレータ内では Python 3 でも ‘return’ で
値は戻せません。--)

自分でクラスを書いて、ジェネレータで言うところのローカル変数をインスタン
ス変数として全部保管しておけば、同じ効果を得ることは可能です。たとえば整
数のリストを返すのは、 ‘self.count’ を 0 にして、 *note next(): 9d8. メ
ソッドが ‘self.count’ をインクリメントして返すようにすればできます。しか
しながら、ある程度複雑なジェネレータになってくると、同じことをするクラス
を書くのは格段にややこしいことになります。 ‘Lib/test/test_generators.py’
にはもっと面白い例がたくさん含まれています。一番単純な一つは、ジェネレー
タを再帰的に使ってツリーを順繰りに横断する実装をするこれです (--訳注: ジ
ェネレータは現在の最新 3.5 までの間に 2 度大きな機能強化が行われているの
ですが、一つが 2.5 での PEP 342 でこれは yield 「に」値を戻せるようにす
るものです。もう一つが 3.3 での PEP 380 で、これはサブジェネレータへの委
譲 ‘yield from <subgen>’ の追加でした。ですのでこの 3.3 からの ‘yield
from’ を使うと下記例はもっとスッキリ書けます。--):

     # A recursive generator that generates Tree leaves in in-order.
     def inorder(t):
         if t:
             for x in inorder(t.left):
                 yield x
             yield t.label
             for x in inorder(t.right):
                 yield x

ほかにも ‘Lib/test/test_generators.py’ には、N-Queens 問題 (N×N コマのチ
ェス盤に、互いに攻撃できないような配置で N 個のクイーンを置く) やナイト
・ツアー (N×N 盤の全コマをナイトが一度ずつ通るような経路を探す) の解を出
す例が入っています。

ジェネレータの発想はほかのプログラミング言語、特に Icon
(‘https://www2.cs.arizona.edu/icon/’) から着想しています。Icon ではジェ
ネレータが言語の中枢になっています。Icon では、あらゆる式と関数がジェネ
レータのように振舞います。
‘https://www2.cs.arizona.edu/icon/docs/ipd266.htm’ の "Icon プログラミン
グ言語の概要" の一つの例が、これがどのようなものであるのかを教えてくれま
す:

     sentence := "Store it in the neighboring harbor"
     if (i := find("or", sentence)) > 5 then write(i)

Icon では ‘find()’ 関数は部分文字列 "or" が見つかる位置 3, 23, 33 を返し
ます。 *note if: 181. 文内では ‘i’ には最初 3 が代入されますが、これは 3
より小さいので比較は失敗し、Icon は次の値 23 を取り出します。 23 は 5 よ
り大きいので比較は成功し、コードは 23 をスクリーンに表示します。

Python では Icon がそうするほどにはジェネレータを中心的概念に置きません
。ジェネレータは Python 言語中核の新たな一面ではありますが、それらを学ぶ
のも使うのも誰しも行うべきだというものでもなく、そしてこれで解決できない
何か問題があれば、忘れてしまっても良いものです。Icon と比較した特筆すべ
き Python インターフェイスの機能はジェネレータの状態が具象オブジェクト
(イテレータ) で表現されることであり、それは他の関数に渡せますし、データ
構造に記憶しておくことも出来ます。(--訳注: ジェネレータについてかなり控
えめなのは、この時点で著者は将来の拡張を既に見据えていたから?  かもしれ
ませんね。PEP 342 と PEP 380 により今やジェネレータはこの頃より遥かに高
機能になっており、今ではきっと「こんなものなくても困らない」なんて
Python 使いはいないでしょう。--)

参考
....

PEP 255(2) - 単純なジェネレータ

     Neil Schemenauer, Tim Peters, Magnus Lie Hetland により著されました
     。実装のほとんどは Neil Schemenauer と Tim Peters により行われ、
     Python Labs クルーにより他の修正が行われました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0255/

   (2) https://peps.python.org/pep-0255/


File: python.info,  Node: PEP 237 長整数と整数を一体化していく<2>,  Next: PEP 238 除算演算子を変更していく,  Prev: PEP 255 単純なジェネレータ<2>,  Up: What's New in Python 2 2

1.21.5 PEP 237: 長整数と整数を一体化していく
--------------------------------------------

In recent versions, the distinction between regular integers, which are
32-bit values on most machines, and long integers, which can be of
arbitrary size, was becoming an annoyance.  For example, on platforms
that support files larger than ‘2**32’ bytes, the ‘tell()’ method of
file objects has to return a long integer.  However, there were various
bits of Python that expected plain integers and would raise an error if
a long integer was provided instead.  For example, in Python 1.5, only
regular integers could be used as a slice index, and ‘'abc'[1L:]’ would
raise a *note TypeError: 198. exception with the message 'slice index
must be int'.

Python 2.2 は必要に応じて short 整数を長整数に値をシフトします。 'L' サ
フィックスは長整数リテラルを示すのにはもはや不要です。今ではコンパイラは
相応しい型を選べます。('L' サフィックスは将来の Python 2.x では非推奨と
なり、Python 2.4 では警告となり、おそらく Python 3.0 では削除されます。
-- 訳注: Python 3 で 'L' が廃止されて、付けると構文エラーになるようにな
ったのは事実です。ですが少なくとも Python 2.7 では ‘-3’ でも ‘-Qwarnall’
でも警告とならないので注意してください。Python 2 系を使っていて Python 3
との互換性を持ちたいならば、 2.2 以降では 'L' は付けるべきではありません
。 -- ) かつて *note OverflowError: a81. となっていたような多くの演算が
、今ではその結果として長整数を返します。例えば:

     >>> 1234567890123
     1234567890123L
     >>> 2 ** 64
     18446744073709551616L

ほとんどのケースで、今や整数と長整数は同じものとして扱われるでしょう。
*note type(): f44. ビルトインで今でも区別出来ますが、ほとんど必要ないで
しょう (-- 訳注: Python 3 では本当にこの2つの区別がなくなったので、当然
区別出来ません。Python 3 系への移行を考えている Python 2 コードは、両者
の区別に頼らないようにするべきです。 --)。

参考
....

PEP 237(1) - 長整数と整数を一体化していく

     Moshe Zadka と Guido van Rossum 著、実装 (ほぼ) Guido van Rossum.。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0237/


File: python.info,  Node: PEP 238 除算演算子を変更していく,  Next: Unicode の変更,  Prev: PEP 237 長整数と整数を一体化していく<2>,  Up: What's New in Python 2 2

1.21.6 PEP 238: 除算演算子を変更していく
----------------------------------------

Python 2.2 の変更で最も物議を醸すものが、Python 誕生時からずっとそうであ
り続けた古い設計の欠陥、これを修正するための取り組み開始の予兆です。現在
の Python の除算演算子 ‘/’ は 2 つの整数引数に対して C 言語の除算演算子
のように振舞います: 端数部があれば切り捨てて整数を結果として返します。例
えば ‘3/2’ は 1.5 ではなく 1 で、 ‘(-1)/2’ は -0.5 ではなく -1 です。
Python の動的型付けにより演算対象の型がなんなのかを容易には決定できない
くせに 2 つの演算対象の型に依存するので、除算の結果は予想に反したものと
なりうるのです。

(議論の的となるのはこれが '本当の' 設計の欠陥なのかどうかと、果たしてこ
れを修正することで既存のコードを破壊する価値はあるのかどうかです。それは
python-dev での終わりのない議論を巻き起こし、2001 年 7 月には
‘comp.lang.python’ への辛辣な投稿の嵐に突入しました。私はここではどちら
かの側に立って説きつけるつもりはなく、Python 2.2 で何が実現したのかを記
述することだけに専念します。 PEP 238(1) にはその主張と反対意見の要約が書
かれていますので、そちらをお読みください。)

この変更がコードを破壊しうるために、導入は大変ゆっくり少しずつ進められて
いきます。Python 2.2 が移行を始めますが、切り替えは Python 3.0 になるま
で達成させられることはありません。

まず最初に、いくつか PEP 238(2) から用語を借りることにします。 "真の除算
(True division)" とは、プログラマでない人々が一番馴染みのある除算です。
3/2 は 1.5、1/4 は 0.25、などなど。 "切り捨て除算 (Floor division)" は、
整数の被演算子が与えられたときの Python の ‘/’ 演算子が現在やっているこ
とで、結果は真の除算の結果の値の小数点以下を小さくなる方向へ丸めたもので
す。 "クラシック除算 (Classic division)" は現在の ‘/’ の混合した振る舞い
を指します。演算対象が整数同士であれば切り捨て除算の結果となり、一方が浮
動小数点数であれば真の除算の結果となる振る舞いです。

以下が 2.2 で導入される変更です:

   * 新しい演算子 ‘//’ が floor division の演算子です。(いえーい、これっ
     て C++ コメントのシンボルに似てるね、なんてことは私たちは知っていま
     す。) ‘//’ は演算対象の型がなんであれ 'いつでも' floor division を
     実行しますので、 ‘1 // 2’ は 0、 ‘1.0 // 2.0’ も 0.0 です。

     ‘//’ は Python 2.2 でいつでも使えます; ‘__future__’ を使って有効化
     するなんてことは必要ないです。

   * ‘from __future__ import division’ をモジュールに import することで
     、 ‘/’ 演算子が真の除算 (true division) の結果を返すように変更され
     るので、 ‘1/2’ は 0.5 になります。 ‘__future__’ 文なしでは ‘/’ はク
     ラシック除算 (classic division) のままです。 ‘/’ が持つデフォルトの
     意味は Python 3.0 になるまで変更されません。

   * Classes can define methods called *note __truediv__(): 1090. and
     *note __floordiv__(): 170d. to overload the two division operators.
     At the C level, there are also slots in the *note PyNumberMethods:
     1637. structure so extension types can define the two operators.

   * Python 2.2 は、コードが変更後の除算セマンティクスで動作するかどうか
     をテストするコマンドライン引数をサポートします。 ‘-Q warn’ で
     python を実行すると、除算が二つの整数に適用されている箇所全てで警告
     します。除算の意味変更の影響を受ける箇所の特定と修正に使えるでしょ
     う。デフォルトでは、Python 2.2 は警告なしで単純に classic division
     を実行します; その警告がデフォルトになるのは Python 2.3 からです。

参考
....

PEP 238(3) - 除算演算子を変更していく

     Moshe Zadka と Guido van Rossum 著、実装 Guido van Rossum.。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0238/

   (2) https://peps.python.org/pep-0238/

   (3) https://peps.python.org/pep-0238/


File: python.info,  Node: Unicode の変更,  Next: PEP 227 入れ子状のスコープ,  Prev: PEP 238 除算演算子を変更していく,  Up: What's New in Python 2 2

1.21.7 Unicode の変更
---------------------

Python の Unicode サポートが 2.2 で少し拡張されています。Unicode 文字列
は普通は 16 ビット符号なし整数としての UCS-2 で格納されます。Python 2.2
は内部エンコーディングとして 32 ビット符号なし整数の UCS-4 を使うように
もコンパイル出来ます。これは ‘configure’ スクリプトに
‘--enable-unicode=ucs4’ オプションを与えることで行います。
(‘--disable-unicode’ を与えることで完全に Unicode サポートを無効にするこ
とも出来ます。)

When built to use UCS-4 (a "wide Python"), the interpreter can natively
handle Unicode characters from U+000000 to U+110000, so the range of
legal values for the ‘unichr()’ function is expanded accordingly.  Using
an interpreter compiled to use UCS-2 (a "narrow Python"), values greater
than 65535 will still cause ‘unichr()’ to raise a *note ValueError: 2ec.
exception.  This is all described in PEP 261(1), "Support for 'wide'
Unicode characters"; consult it for further details.

Another change is simpler to explain.  Since their introduction, Unicode
strings have supported an ‘encode()’ method to convert the string to a
selected encoding such as UTF-8 or Latin-1.  A symmetric
‘decode([*encoding*])’ method has been added to 8-bit strings (though
not to Unicode strings) in 2.2.  ‘decode()’ assumes that the string is
in the specified encoding and decodes it, returning whatever is returned
by the codec.

この新たなインターフェイスに相乗りする形で、 Unicode には無関係のタスク
のためのコーデックが追加されました。例えば uu エンコーディング、 MIME の
base64 エンコーディング、 *note zlib: 139. モジュールでの圧縮のためのエ
ンコーディングが追加されています:

     >>> s = """Here is a lengthy piece of redundant, overly verbose,
     ... and repetitive text.
     ... """
     >>> data = s.encode('zlib')
     >>> data
     'x\x9c\r\xc9\xc1\r\x80 \x10\x04\xc0?Ul...'
     >>> data.decode('zlib')
     'Here is a lengthy piece of redundant, overly verbose,\nand repetitive text.\n'
     >>> print s.encode('uu')
     begin 666 <data>
     M2&5R92!I<R!A(&QE;F=T:'D@<&EE8V4@;V8@<F5D=6YD86YT+"!O=F5R;'D@
     >=F5R8F]S92P*86YD(')E<&5T:71I=F4@=&5X="X*

     end
     >>> "sheesh".encode('rot-13')
     'furrfu'

To convert a class instance to Unicode, a ‘__unicode__()’ method can be
defined by a class, analogous to ‘__str__()’.

‘encode()’, ‘decode()’, and ‘__unicode__()’ were implemented by
Marc-André Lemburg.  The changes to support using UCS-4 internally were
implemented by Fredrik Lundh and Martin von Löwis.

参考
....

PEP 261(2) - 'wide' Unicode 文字のサポート

     Paul Prescod 著。 (--訳注: この What's New セクションと PEP 内容は
     2.x ではずっと有効ですが、3.x で大幅に変わっていて逐一補足出来ない
     ほど大きく違っています。変更の概要についてはクックブックの「Python
     2 から Python 3 への移植」がわかりやすいと思います。--)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0261/

   (2) https://peps.python.org/pep-0261/


File: python.info,  Node: PEP 227 入れ子状のスコープ,  Next: 新しいモジュールと改良されたモジュール<3>,  Prev: Unicode の変更,  Up: What's New in Python 2 2

1.21.8 PEP 227: 入れ子状のスコープ
----------------------------------

Python 2.1 では、静的にネストされたスコープが ‘from __future__ import
nested_scopes’ ディレクティブで有効に出来るオプションの機能として追加さ
れました。2.2 では入れ子のスコープには特別に有効化する必要なく、もういつ
でもそこにあります。このセクションの残りの部分は "What's New in Python
2.1" の入れ子のスコープの記述からの丸々コピーですので、2.1 のときに読ん
だなら読み飛ばしてもらって結構です。

Python2.1 で導入され、2.2 で完成した最も大きな変更点は Python のスコープ
ルールです。Python2.0では、ある指定された時点である変数の名前を検索する
ために多くても3つの名前空間、つまりローカル、モジュールレベル、ビルトイ
ン名前空間しか使われませんでした。このことは直感的な期待と一致せずしばし
ば人々を驚かせました。例えば、入れ子になった再帰関数の定義は動きません:

     def f():
         ...
         def g(value):
             ...
             return g(value-1) + 1
         ...

The function ‘g()’ will always raise a *note NameError: 452. exception,
because the binding of the name ‘g’ isn't in either its local namespace
or in the module-level namespace.  This isn't much of a problem in
practice (how often do you recursively define interior functions like
this?), but this also made using the *note lambda: 14b5. expression
clumsier, and this was a problem in practice.  In code which uses
‘lambda’ you can often find local variables being copied by passing them
as the default values of arguments.

     def find(self, name):
         "Return list of any entries equal to 'name'"
         L = filter(lambda x, name=name: x == name,
                    self.list_attribute)
         return L

過度な関数型スタイルで書かれた Python コードの可読性は、結果的にはひどく
苦痛を感じるものですね。

Python 2.2 の最も重要な変更点は、この問題を解決するために静的なスコープ
が追加されたことです。最初の効果として、 ‘name=name’ という例ではデフォ
ルトの引数は必要ありません。簡単に言えば、指定された引数名が関数内の値に
割り当てられない場合(*note def: 1673. 、 *note class: 14ef. または *note
import: 7f8. ステートメントの割り当てによって)、変数の参照は外側のスコー
プのローカル名前空間で検索されます。ルールや実装の詳細は PEP で参照でき
ます。

この変更は、同じ変数名がモジュールレベルと関数の定義が含まれている関数内
のローカルの両方で変数名として使用されているコードで、互換性の問題を引き
起こす可能性があります。ですがむしろ気にしなくてよいでしょう。そのような
コードはそもそも最初から相当こんがらかっているので。

この変更の副作用の一つは、 ‘from module import *’ と ‘exec’ の両ステート
メントが特定の条件下の関数スコープ内で不正となることです。 Python のリフ
ァレンスマニュアルははじめからずっと ‘from module import *’ はトップレベ
ルモジュールでのみ合法であると言ってきましたが、以前の CPython インタプ
リタはこれを一度も強制していませんでした。入れ子になったスコープ実装の一
環として、Python のソースをバイトコードに変換するコンパイラは、内包され
たスコープ内の変数にアクセスするために別のコードを生成する必要があります
。 ‘from module import *’, ‘exec’ はコンパイラにこれを理解することを不可
能にしてしまいます。なぜならそれらはコンパイル時にはわからないローカル名
前空間に名前を追加するからです。それゆえ、もし関数が関数定義を含んだり自
由な変数に *note lambda: 14b5. の語句を含んだりする場合、コンパイラは
*note SyntaxError: 18e. 例外を上げて知らせます。

前述した説明を少し明確にするため、例を挙げます:

     x = 1
     def f():
         # The next line is a syntax error
         exec 'x=2'
         def g():
             return x

Line 4 containing the ‘exec’ statement is a syntax error, since ‘exec’
would define a new local variable named ‘x’ whose value should be
accessed by ‘g()’.

これは実際には大した制約でもないはずです。 ‘exec’ が Python コードで使わ
れるのは稀です(使われているとしたら大抵どこか貧弱な設計であることの証)。

参考
....

PEP 227(1) - 静的に入れ子になったスコープ

     Jeremy Hylton著、実装

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0227/


File: python.info,  Node: 新しいモジュールと改良されたモジュール<3>,  Next: インタプリタの変更と修正,  Prev: PEP 227 入れ子状のスコープ,  Up: What's New in Python 2 2

1.21.9 新しいモジュールと改良されたモジュール
---------------------------------------------

   * The *note xmlrpclib: 134. module was contributed to the standard
     library by Fredrik Lundh, providing support for writing XML-RPC
     clients.  XML-RPC is a simple remote procedure call protocol built
     on top of HTTP and XML. For example, the following snippet
     retrieves a list of RSS channels from the O'Reilly Network, and
     then lists the recent headlines for one channel:

          import xmlrpclib
          s = xmlrpclib.Server(
                'http://www.oreillynet.com/meerkat/xml-rpc/server.php')
          channels = s.meerkat.getChannels()
          # channels is a list of dictionaries, like this:
          # [{'id': 4, 'title': 'Freshmeat Daily News'}
          #  {'id': 190, 'title': '32Bits Online'},
          #  {'id': 4549, 'title': '3DGamers'}, ... ]

          # Get the items for one channel
          items = s.meerkat.getItems( {'channel': 4} )

          # 'items' is another list of dictionaries, like this:
          # [{'link': 'http://freshmeat.net/releases/52719/',
          #   'description': 'A utility which converts HTML to XSL FO.',
          #   'title': 'html2fo 0.3 (Default)'}, ... ]

     The *note SimpleXMLRPCServer: 135. module makes it easy to create
     straightforward XML-RPC servers.  See
     ‘http://xmlrpc.scripting.com/’ for more information about XML-RPC.

   * 新しい *note hmac: 6e. モジュールは、 RFC 2104(1) で記述される HMAC
     アルゴリズムを実装します 。 (Contributed by Gerhard Häring.)

   * Several functions that originally returned lengthy tuples now
     return pseudo-sequences that still behave like tuples but also have
     mnemonic attributes such as ‘memberst_mtime’ or *note tm_year:
     1711.  The enhanced functions include *note stat(): 26d, *note
     fstat(): f8c, *note statvfs(): 1314, and *note fstatvfs(): f8d. in
     the *note os: a5. module, and *note localtime(): 1712, *note
     gmtime(): 13d8, and *note strptime(): 1646. in the *note time: f4.
     module.

     例えば旧式のタプルでファイルサイズを得るには ‘file_size =
     os.stat(filename)[stat.ST_SIZE]’ のように書くしかありませんでしたが
     、今ではもっとわかりやすい ‘file_size = os.stat(filename).st_size’
     のように書くことが出来ます。

     この機能のオリジナルのパッチは Nick Mathewson により寄稿されました
     。

   * Python プロファイラが大幅に改造されて、出力の色々な間違いが修正され
     ました。 (Contributed by Fred L. Drake, Jr.  and Tim Peters.)

   * *note socket: d1. モジュールを IPv6 サポート付きでコンパイル可能に
     なりました。Python の ‘configure’ スクリプトに ‘--enable-ipv6’ オプ
     ションを与えてください。(Contributed by Jun-ichiro "itojun"
     Hagino.)

   * Two new format characters were added to the *note struct: db.
     module for 64-bit integers on platforms that support the C long
     long type.  ‘q’ is for a signed 64-bit integer, and ‘Q’ is for an
     unsigned one.  The value is returned in Python's long integer type.
     (Contributed by Tim Peters.)

   * インタプリタの対話モードに新たに *note help(): ad4. ビルトインが追
     加されています。これは Python 2.1 で導入された *note pydoc: ba. モ
     ジュールを用いて対話的なヘルプを提供します。 ‘help(object)’ で
     'object' について手に入る任意のヘルプを表示します。 *note help():
     ad4. を引数なしで起動するとオンラインのヘルプユーティリティに入りま
     す。ここから関数名やクラス名、モジュール名をタイプすることで、それ
     らのヘルプテキストを読むことが出来ます。 (Contributed by Guido van
     Rossum, using Ka-Ping Yee's *note pydoc: ba. module.)

   * Various bugfixes and performance improvements have been made to the
     SRE engine underlying the *note re: be. module.  For example, the
     *note re.sub(): 5a3. and *note re.split(): 5a2. functions have been
     rewritten in C. Another contributed patch speeds up certain Unicode
     character ranges by a factor of two, and a new *note finditer():
     1713. method that returns an iterator over all the non-overlapping
     matches in a given string.  (SRE is maintained by Fredrik Lundh.
     The BIGCHARSET patch was contributed by Martin von Löwis.)

   * *note smtplib: cf. モジュールに RFC 2487(2) 「Secure SMTP over TLS」
     のサポートが追加されました。これにより Python プログラムとメール転
     送エージェント間でのメッセージの暗号化された SMTP トラフィックが可
     能になりました。 *note smtplib: cf. は SMTP 認証もサポートしていま
     す。 (Contributed by Gerhard Häring.)

   * Piers Lauder によって保守されている *note imaplib: 78. モジュールに
     新たに多くの拡張のサポートが追加されました: RFC 2342(3) で定義され
     ている NAMESPACE 拡張、 SORT、 GETACL、 SETACL。(Contributed by
     Anthony Baxter and Michel Pelletier.)

   * The ‘rfc822’ module's parsing of email addresses is now compliant
     with RFC 2822(4), an update to RFC 822(5).  (The module's name is
     'not' going to be changed to ‘rfc2822’.)  A new package, *note
     email: 3f, has also been added for parsing and generating e-mail
     messages.  (Contributed by Barry Warsaw, and arising out of his
     work on Mailman.)

   * The *note difflib: 3b. module now contains a new ‘Differ’ class for
     producing human-readable lists of changes (a "delta") between two
     sequences of lines of text.  There are also two generator
     functions, ‘ndiff()’ and ‘restore()’, which respectively return a
     delta from two sequences, or one of the original sequences from a
     delta.  (Grunt work contributed by David Goodger, from ndiff.py
     code by Tim Peters who then did the generatorization.)

   * New constants ‘ascii_letters’, ‘ascii_lowercase’, and
     ‘ascii_uppercase’ were added to the *note string: d8. module.
     There were several modules in the standard library that used
     ‘string.letters’ to mean the ranges A-Za-z, but that assumption is
     incorrect when locales are in use, because ‘string.letters’ varies
     depending on the set of legal characters defined by the current
     locale.  The buggy modules have all been fixed to use
     ‘ascii_letters’ instead.  (Reported by an unknown person; fixed by
     Fred L. Drake, Jr.)

   * The *note mimetypes: 93. module now makes it easier to use
     alternative MIME-type databases by the addition of a *note
     MimeTypes: 1714. class, which takes a list of filenames to be
     parsed.  (Contributed by Fred L. Drake, Jr.)

   * A *note Timer: 1371. class was added to the *note threading: f3.
     module that allows scheduling an activity to happen at some future
     time.  (Contributed by Itamar Shtull-Trauring.)

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2104.html

   (2) https://datatracker.ietf.org/doc/html/rfc2487.html

   (3) https://datatracker.ietf.org/doc/html/rfc2342.html

   (4) https://datatracker.ietf.org/doc/html/rfc2822.html

   (5) https://datatracker.ietf.org/doc/html/rfc822.html


File: python.info,  Node: インタプリタの変更と修正,  Next: その他の変更と修正<3>,  Prev: 新しいモジュールと改良されたモジュール<3>,  Up: What's New in Python 2 2

1.21.10 インタプリタの変更と修正
--------------------------------

Python 拡張モジュールを書いたり、インタプリタの埋め込みをしたり、あるい
は単にインタプリタそのものをハックしたりするために C レベルでインタプリ
タを扱う人々以外には影響しないいくつかの変更があります。Python コードを
書くだけであればここに記述する変更は、あなたに関係するものは全くありませ
ん。

   * プロファイルとトレースの関数が C で実装されました。Python ベースの
     ものと比較して圧倒的に高速に操作出来、プロファイルとトレースのオー
     バヘッドを削減するはずです。これは Python の開発環境の著者に朗報で
     しょう。2 つの C 関数、 *note PyEval_SetProfile(): 1716. と *note
     PyEval_SetTrace(): 663. が Python API に追加されました。既存の
     *note sys.setprofile(): 1717. 関数、 *note sys.settrace(): 2e1. 関
     数はそのまま存在し、単純に新規 C レベル関数を使うように修正されまし
     た。 (Contributed by Fred L. Drake, Jr.)

   * Another low-level API, primarily of interest to implementers of
     Python debuggers and development tools, was added.  *note
     PyInterpreterState_Head(): 1718. and *note
     PyInterpreterState_Next(): 1719. let a caller walk through all the
     existing interpreter objects; *note
     PyInterpreterState_ThreadHead(): 171a. and *note
     PyThreadState_Next(): 171b. allow looping over all the thread
     states for a given interpreter.  (Contributed by David Beazley.)

   * ガーベージコレクタの C レベルインターフェイスが変更されています。こ
     れはガーベージコレクションをサポートする拡張型を書いたり、関数の利
     用誤りのデバッグをするのを簡単にします。多数の関数が少々これまでと
     は異なったセマンティクスを持つので、関数群がリネームされました。旧
     API を使う拡張はこれまで通りコンパイルは出来ますが、ガーベージコレ
     クションには参加 '出来ません' 。このため 2.2 のためにはかなり高優先
     度で更新を検討すべきです。

     拡張モジュールを新 API でアップグレードするには、以下のステップを実
     施してください:

   * Rename ‘Py_TPFLAGS_GC’ to *note Py_TPFLAGS_HAVE_GC: 981.

   * 
     オブジェクトのアロケートには *note PyObject_GC_New(): c99. または *note PyObject_GC_NewVar(): c9a. を使ってください。

          そしてオブジェクトのデアロケートには *note PyObject_GC_Del():
          171c. を使ってください。

   * Rename ‘PyObject_GC_Init()’ to *note PyObject_GC_Track(): 171d. and
     ‘PyObject_GC_Fini()’ to *note PyObject_GC_UnTrack(): 171e.

   * Remove ‘PyGC_HEAD_SIZE’ from object size calculations.

   * Remove calls to ‘PyObject_AS_GC()’ and ‘PyObject_FROM_GC()’.

   * *note PyArg_ParseTuple(): 3c1. に新たな書式化シーケンス ‘et’ が追加
     されました。 ‘et’ はパラメータとエンコーディング名の両方を取りパラ
     メータを与えられたエンコーディングで変換しますが、パラメータが
     Unicode である場合には変換し、8 ビット文字列である場合にはこれが既
     に望みのものであることと仮定してそのままにします。このことは ‘es’ 書
     式化文字が 8 ビット文字列は Python デフォルトの ASCII エンコーディ
     ングであると仮定して新たに与えられたエンコーディングで変換するのと
     は違っています。 (Contributed by M.-A. Lemburg, and used for the
     MBCS support on Windows described in the following section.)

   * A different argument parsing function, *note PyArg_UnpackTuple():
     171f, has been added that's simpler and presumably faster.  Instead
     of specifying a format string, the caller simply gives the minimum
     and maximum number of arguments expected, and a set of pointers to
     *note PyObject: 5df.* variables that will be filled in with
     argument values.

   * Two new flags *note METH_NOARGS: 16ed. and *note METH_O: 1720. are
     available in method definition tables to simplify implementation of
     methods with no arguments or a single untyped argument.  Calling
     such methods is more efficient than calling a corresponding method
     that uses *note METH_VARARGS: 1721.  Also, the old ‘METH_OLDARGS’
     style of writing C methods is now officially deprecated.

   * Two new wrapper functions, *note PyOS_snprintf(): 1722. and *note
     PyOS_vsnprintf(): 1723. were added to provide cross-platform
     implementations for the relatively new ‘snprintf()’ and
     ‘vsnprintf()’ C lib APIs.  In contrast to the standard ‘sprintf()’
     and ‘vsprintf()’ functions, the Python versions check the bounds of
     the buffer used to protect against buffer overruns.  (Contributed
     by M.-A. Lemburg.)

   * *note _PyTuple_Resize(): 1724. 関数の未使用パラメータを取り除いたの
     で、今後は 3 つではなく 2 つのパラメータを取ります。3 つ目の引数は
     一度も使われることはなかったため、Python 2.2 以前のコードからの移植
     時には単純に捨てることが出来ます。


File: python.info,  Node: その他の変更と修正<3>,  Next: 謝辞<6>,  Prev: インタプリタの変更と修正,  Up: What's New in Python 2 2

1.21.11 その他の変更と修正
--------------------------

いつものように、たくさんのほかの改善とバグフィックスがソースツリー全体に
渡って散らばっています。CVS 変更ログを検索すると、Python 2.1 から 2.2 に
かけて適用されたパッチは 527、バグ修正は 683、2.2.1 で適用されたパッチは
139、バグ修正は 143、2.2.2 で適用されたパッチは 106、バグ修正は 82。いず
れも少なく見積もって、です。

ほかの、さらに特筆すべき変更のいくつかを挙げます:

   * The code for the MacOS port for Python, maintained by Jack Jansen,
     is now kept in the main Python CVS tree, and many changes have been
     made to support MacOS X.

     The most significant change is the ability to build Python as a
     framework, enabled by supplying the ‘--enable-framework’ option to
     the configure script when compiling Python.  According to Jack
     Jansen, "This installs a self-contained Python installation plus
     the OS X framework "glue" into
     ‘/Library/Frameworks/Python.framework’ (or another location of
     choice).  For now there is little immediate added benefit to this
     (actually, there is the disadvantage that you have to change your
     PATH to be able to find Python), but it is the basis for creating a
     full-blown Python application, porting the MacPython IDE, possibly
     using Python as a standard OSA scripting language and much more."

     Most of the MacPython toolbox modules, which interface to MacOS
     APIs such as windowing, QuickTime, scripting, etc.  have been
     ported to OS X, but they've been left commented out in ‘setup.py’.
     People who want to experiment with these modules can uncomment them
     manually.

   * キーワード引数を取らないビルトイン関数にそれを渡すと、メッセージ
     "'function' takes no keyword arguments" を伴う *note TypeError:
     198. 例外を励起するようになりました。

   * Python 2.1 で拡張モジュールとして追加された弱参照は、今では Python
     中核の一部です。これは新スタイルクラスの実装のために使われるからで
     す。このため *note weakref: 11a. モジュールにいた *note
     ReferenceError: 1726. 例外をビルトイン例外に移動しました。

   * Tim Peters による新しいスクリプト ‘Tools/scripts/cleanfuture.py’ は
     、Python ソースコードから自動的に廃止された ‘__future__’ 文を削除し
     ます。

   * ビルトイン関数 *note compile(): 4b1. に 'flags' 引数が追加され、こ
     れにより ‘__future__’ ステートメントの振る舞いが、IDLE 内やほかの開
     発環境内にある模擬的なシェル内で正しく準拠するようになりました。こ
     の変更は PEP 264(1) に記述されています。 (Contributed by Michael
     Hudson.)

   * Python 1.6 で導入された新ライセンスは GPL 互換ではありませんでした
     。2.2 ライセンスのためにいくつか小さな字句的修正によりこれをフィッ
     クスし、GPL プログラム内に Python を埋め込むことが再び合法になりま
     した。Python そのものは GPL ではなく、かつても今後も BSD ライセンス
     に本質的に等価なものであることに注意してください。このライセンスの
     変更は Python 2.0.1 リリース、2.1.1 リリースにも適用されました。

   * Windows において Unicode ファイル名がある場合に、Python はそれを
     Microsoft ファイル API を使うことで MBCS 文字列に変換するようになり
     ました。MBCS はそのファイル API によって明示的に使われるので、デフ
     ォルトのエンコーディングとして Python が ASCII を選択するのは苛立た
     しいことがわかりました。Unix においては
     ‘locale.nl_langinfo(CODESET)’ が利用可能であればロケールの文字セッ
     トが使われます。 (Windows support was contributed by Mark Hammond
     with assistance from Marc-André Lemburg.  Unix support was added by
     Martin von Löwis.)

   * Windows でのラージファイルのサポートが有効になりました。
     (Contributed by Tim Peters.)

   * ‘Tools/scripts/ftpmirror.py’ スクリプトが、もしあれば、 ‘.netrc’ フ
     ァイルを読むようになりました。 (Contributed by Mike Romberg.)

   * Some features of the object returned by the ‘xrange()’ function are
     now deprecated, and trigger warnings when they're accessed; they'll
     disappear in Python 2.3.  ‘xrange’ objects tried to pretend they
     were full sequence types by supporting slicing, sequence
     multiplication, and the *note in: 34b. operator, but these features
     were rarely used and therefore buggy.  The ‘tolist()’ method and
     the ‘start’, ‘stop’, and ‘step’ attributes are also being
     deprecated.  At the C level, the fourth argument to the
     ‘PyRange_New()’ function, ‘repeat’, has also been deprecated.

   * 辞書実装に対するパッチの束がありました。ほとんどが、辞書にこっそり
     とそのハッシュ値を変更するオブジェクトを含んでいたり、それが含まれ
     る辞書を変更する場合に潜在的にコアダンプしていたことに対する修正で
     す。Michael Hudson がコアダンプするケースを見つけて python-dev に穏
     やかなリズムで報告している間に Tim Peters がバグをフィックスし、
     Michael がまた別のケースを見つけ、ということを繰り返しました。

   * On Windows, Python can now be compiled with Borland C thanks to a
     number of patches contributed by Stephen Hansen, though the result
     isn't fully functional yet.  (But this 'is' progress...)

   * Another Windows enhancement: Wise Solutions generously offered
     PythonLabs use of their InstallerMaster 8.1 system.  Earlier
     PythonLabs Windows installers used Wise 5.0a, which was beginning
     to show its age.  (Packaged up by Tim Peters.)

   * ファイル名が ‘.pyw’ で終わるものが Windows でインポート出来るように
     なりました。 ‘.pyw’ は Windows のみのものであり、スクリプトが
     PYTHON.EXE ではなく PYTHONW.EXE を使って実行されることを示すのに使
     われます。これは出力のために DOS コンソールがポップアップしてしまう
     のを避けるのに使われます。このパッチはそのようなスクリプトを、それ
     がモジュールとしても利用可能であるケースでインポート出来るようにし
     ます。 (Implemented by David Bolen.)

   * Python が C の ‘dlopen()’ 関数を拡張モジュールのロードに用いるプラ
     ットフォームにおいて、 ‘dlopen()’ で使われるフラグを *note
     sys.getdlopenflags(): 1727. 関数と *note sys.setdlopenflags():
     1337. 関数でセット出来るようになりました。 (Contributed by Bram
     Stolk.)

   * The *note pow(): 1a4. built-in function no longer supports 3
     arguments when floating-point numbers are supplied.  ‘pow(x, y, z)’
     returns ‘(x**y) % z’, but this is never useful for floating-point
     numbers, and the final result varies unpredictably depending on the
     platform.  A call such as ‘pow(2.0, 8.0, 7.0)’ will now raise a
     *note TypeError: 198. exception.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0264/


File: python.info,  Node: 謝辞<6>,  Prev: その他の変更と修正<3>,  Up: What's New in Python 2 2

1.21.12 謝辞
------------

著者は提案の申し出や修正、様々なこの記事の草稿の助けをしてくれた以下の人
々に感謝します: Fred Bremmer, Keith Briggs, Andrew Dalke, Fred L. Drake,
Jr., Carel Fellinger, David Goodger, Mark Hammond, Stephen Hansen,
Michael Hudson, Jack Jansen, Marc-André Lemburg, Martin von Löwis,
Fredrik Lundh, Michael McLay, Nick Mathewson, Paul Moore, Gustavo
Niemeyer, Don O'Donnell, Joonas Paalasma, Tim Peters, Jens Quade, Tom
Reinhardt, Neil Schemenauer, Guido van Rossum, Greg Ward, Edward
Welbourne.


File: python.info,  Node: What's New in Python 2 1,  Next: What's New in Python 2 0,  Prev: What's New in Python 2 2,  Up: What's New in Python

1.22 What's New in Python 2.1
=============================


著者: A.M. Kuchling

* Menu:

* はじめに: はじめに<2>.
* PEP 227; 入れ子状のスコープ: PEP 227 入れ子状のスコープ<2>.
* PEP 236; __future__ 指示文: PEP 236 __future__ 指示文.
* PEP 207; 拡張比較: PEP 207 拡張比較.
* PEP 230; 警告フレームワーク: PEP 230 警告フレームワーク.
* PEP 229; 新しいビルドシステム: PEP 229 新しいビルドシステム.
* PEP 205; 弱参照: PEP 205 弱参照.
* PEP 232; 関数の属性: PEP 232 関数の属性.
* PEP 235; 大文字小文字を区別しないプラットフォームでのモジュールの読み込み: PEP 235 大文字小文字を区別しないプラットフォームでのモジュールの読み込み.
* PEP 217; 対話モード用 Display Hook: PEP 217 対話モード用 Display Hook.
* PEP 208; 新しい型強制モデル: PEP 208 新しい型強制モデル.
* PEP 241; Pythonソフトウェアパッケージのためのメタデータ: PEP 241 Pythonソフトウェアパッケージのためのメタデータ.
* 新しいモジュールと改良されたモジュール: 新しいモジュールと改良されたモジュール<4>.
* その他の変更と修正: その他の変更と修正<4>.
* 謝辞: 謝辞<7>.


File: python.info,  Node: はじめに<2>,  Next: PEP 227 入れ子状のスコープ<2>,  Up: What's New in Python 2 1

1.22.1 はじめに
---------------

この記事はPython 2.1の新機能について説明します。Python 2.1には Python
2.0ほど多くの変更点はありませんが、楽しい驚きがあります。2.1はPythonの拡
張計画（PEP）を使い動かす最初のリリースであり、大きい変更点のほとんどは
、より詳細なドキュメントや変更のための設計原理を提供するPEPに付随してい
ます。この記事は新機能について網羅していませんが、Pythonプログラマのため
の新機能について概要を示します。特に興味のある任意の新機能の詳細について
は、Python 2.1ドキュメントか特定のPEPを参照してください。

Python開発チームの最近の目標の一つとして新しいリリースのペースを上げてお
り、一つのリリースにつき6～9ヶ月ごとにリリースしています。2.1はこの速い
ペースになって出てきた最初のリリースで、初のアルファ版は、2.0の最終版が
リリースされた3ヶ月後の1月に登場しました。

Python 2.1の最終版は2001年4月17日に作成されました。


File: python.info,  Node: PEP 227 入れ子状のスコープ<2>,  Next: PEP 236 __future__ 指示文,  Prev: はじめに<2>,  Up: What's New in Python 2 1

1.22.2 PEP 227: 入れ子状のスコープ
----------------------------------

Python2.1における最も大きな変更点はPythonのスコープルールです。
Python2.0では、ある指定された時点である変数の名前を検索するために多くて
も3つの名前空間、つまりローカル、モジュールレベル、ビルトイン名前空間し
か使われませんでした。このことは直感的な期待と一致せずしばしば人々を驚か
せました。例えば、入れ子になった再帰関数の定義は動きません:

     def f():
         ...
         def g(value):
             ...
             return g(value-1) + 1
         ...

The function ‘g()’ will always raise a *note NameError: 452. exception,
because the binding of the name ‘g’ isn't in either its local namespace
or in the module-level namespace.  This isn't much of a problem in
practice (how often do you recursively define interior functions like
this?), but this also made using the *note lambda: 14b5. expression
clumsier, and this was a problem in practice.  In code which uses *note
lambda: 14b5. you can often find local variables being copied by passing
them as the default values of arguments.

     def find(self, name):
         "Return list of any entries equal to 'name'"
         L = filter(lambda x, name=name: x == name,
                    self.list_attribute)
         return L

過度な関数型スタイルで書かれた Python コードの可読性は、結果的にはひどく
苦痛を感じるものですね。

Python 2.1の最も重要な変更点は、この問題を解決するために静的なスコープが
追加されたことです。最初の効果として、‘name=name’ という例ではデフォルト
の引数は必要ありません。簡単に言えば、指定された引数名が関数内の値に割り
当てられない場合(*note def: 1673.、*note class: 14ef. または *note
import: 7f8. ステートメントの割り当てによって)、変数の参照は外側のスコー
プのローカル名前空間で検索されます。ルールや実装の詳細はPEPで参照できま
す。

この変更は、同じ変数名がモジュールレベルと関数の定義が含まれている関数内
のローカルの両方で変数名として使用されているコードで、互換性の問題を引き
起こす可能性があります。ですがむしろ気にしなくてよいでしょう。そのような
コードはそもそも最初から相当こんがらかっているので。

この変更の副作用の一つは、 ‘from module import *’ と ‘exec’ の両ステート
メントが特定の条件下の関数スコープ内で不正となることです。 Python のリフ
ァレンスマニュアルははじめからずっと ‘from module import *’ はトップレベ
ルモジュールでのみ合法であると言ってきましたが、以前の CPython インタプ
リタはこれを一度も強制していませんでした。入れ子になったスコープ実装の一
環として、Python のソースをバイトコードに変換するコンパイラは、内包され
たスコープ内の変数にアクセスするために別のコードを生成する必要があります
。 ‘from module import *’, ‘exec’ はコンパイラにこれを理解することを不可
能にしてしまいます。なぜならそれらはコンパイル時にはわからないローカル名
前空間に名前を追加するからです。それゆえ、もし関数が関数定義を含んだり自
由な変数に *note lambda: 14b5. の語句を含んだりする場合、コンパイラは
*note SyntaxError: 18e. 例外を上げて知らせます。

前述した説明を少し明確にするため、例を挙げます:

     x = 1
     def f():
         # The next line is a syntax error
         exec 'x=2'
         def g():
             return x

Line 4 containing the ‘exec’ statement is a syntax error, since ‘exec’
would define a new local variable named ‘x’ whose value should be
accessed by ‘g()’.

これは実際には大した制約でもないはずです。 ‘exec’ が Python コードで使わ
れるのは稀です(使われているとしたら大抵どこか貧弱な設計であることの証)。

互換性の問題が考慮されて、入れ子のスコープは段階的導入につながりました;
Python 2.1 ではそれらはデフォルトで有効になっていませんが、 PEP 236(1) に
記載されているように、future 文を使用してモジュール内でオンにすることが
できます。( PEP 236(2) の更なる議論について、続くセクションを参照してく
ださい。) Python 2.2では入れ子になったスコープがデフォルトになり、それを
オフにする方法はありませんが、ユーザは 2.1 の全ライフタイムを通して、導
入の結果起きるあらゆる破損を修正し続けるでしょう。

参考
....

PEP 227(3) - 静的に入れ子になったスコープ

     Jeremy Hylton著、実装

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0236/

   (2) https://peps.python.org/pep-0236/

   (3) https://peps.python.org/pep-0227/


File: python.info,  Node: PEP 236 __future__ 指示文,  Next: PEP 207 拡張比較,  Prev: PEP 227 入れ子状のスコープ<2>,  Up: What's New in Python 2 1

1.22.3 PEP 236: __future__ 指示文
---------------------------------

ネストされたスコープへのこの対応は、リリース 2.1 ではコードを壊すことの
危険性について広く懸念されており、 Pythoneer 達に保守的なアプローチを選
ばせるには十分でした。このアプローチは、必須とするリリース N+1 に対する
、 リリース N でのオプション機能として有効化という序奏、というものです。

この構文は *note __future__: 0. という名の予約モジュールを使う
‘from...import’ ステートメントを使用します。ネストしたスコープは以下のス
テートメントで有効にできます。

     from __future__ import nested_scopes

普通 の *note import: 7f8. ステートメントに見えますが、実は違います; こ
のような未来のステートメントが置かれる場所には厳格なルールがあります。こ
れらはモジュールの冒頭にしか置けませんし、必ず何らかのPythonコードや正規
の ‘import’ ステートメントの前になければなりません。それと言うのもこのよ
うなステートメントは、Pythonのバイトコードコンパイラがコードを解析し、バ
イトコードを生成する方法に影響しますので、生成されるバイトコードとなるス
テートメントの前になくてはならないのです。

参考
....

PEP 236(1) - バック・トゥ・ザ・ *note __future__: 0.

     Tim Peter著、Jeremy Hylton主実装

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0236/


File: python.info,  Node: PEP 207 拡張比較,  Next: PEP 230 警告フレームワーク,  Prev: PEP 236 __future__ 指示文,  Up: What's New in Python 2 1

1.22.4 PEP 207: 拡張比較
------------------------

In earlier versions, Python's support for implementing comparisons on
user-defined classes and extension types was quite simple.  Classes
could implement a ‘__cmp__()’ method that was given two instances of a
class, and could only return 0 if they were equal or +1 or -1 if they
weren't; the method couldn't raise an exception or return anything other
than a Boolean value.  Users of Numeric Python often found this model
too weak and restrictive, because in the number-crunching programs that
numeric Python is used for, it would be more useful to be able to
perform elementwise comparisons of two matrices, returning a matrix
containing the results of a given comparison for each element.  If the
two matrices are of different sizes, then the compare has to be able to
raise an exception to signal the error.

Python2.1で、このニーズを満たすために拡張比較が追加されました。Pythonの
クラスは、‘<’、‘<=’、‘>’、‘>=’、‘==’、‘!=’ の各演算を個別にオーバーロー
ドできます。この新しい特殊メソッドの名前は:

演算            メソッド名
                
---------------------------------------------
                
‘<’             *note __lt__(): 14b8.
                
                
‘<=’            *note __le__(): 1522.
                
                
‘>’             *note __gt__(): 1523.
                
                
‘>=’            *note __ge__(): 1524.
                
                
‘==’            *note __eq__(): cf2.
                
                
‘!=’            *note __ne__(): 1730.
                

(特殊メソッドはFortranの ‘.LT.’ や ‘.LE.’ 等々の演算子にちなんで命名され
ています。プログラマはほぼ確実にこれらの名前を熟知していますので、覚えや
すいでしょう。)

これらの特殊メソッドは ‘method(self, other)’ の形式になっており、‘self’
が演算子の左辺、‘other’ が右辺のオブジェクトになります。例えば、式 ‘A <
B’ は ‘A.__lt__(B)’ を呼び出します。

これらの特殊メソッドは何でも、つまり真偽値や行列、リストや他のPython オ
ブジェクトを返せます。もし比較が不可能であったり、矛盾していたり、意味が
ない場合は、代わりに例外を上げることができます。

The built-in ‘cmp(A,B)’ function can use the rich comparison machinery,
and now accepts an optional argument specifying which comparison
operation to use; this is given as one of the strings ‘"<"’, ‘"<="’,
‘">"’, ‘">="’, ‘"=="’, or ‘"!="’.  If called without the optional third
argument, ‘cmp()’ will only return -1, 0, or +1 as in previous versions
of Python; otherwise it will call the appropriate method and can return
any Python object.

C プログラマにとって興味深い関連する変更があります。型オブジェクトに新し
い ‘tp_richcmp’ スロットと、この拡張された比較を行うAPIが追加されました
。ここではC APIについて言及しませんが、あながた関連する関数のリストを見
たければ、 PEP 207(1) かバージョン2.1のC APIドキュメントを参照してくださ
い。

参考
....

PEP 207(2): 拡張比較

     David Ascher によるかつての仕事に大きく拠りますが Guido van Rossum
     によって著され、実装されました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0207/

   (2) https://peps.python.org/pep-0207/


File: python.info,  Node: PEP 230 警告フレームワーク,  Next: PEP 229 新しいビルドシステム,  Prev: PEP 207 拡張比較,  Up: What's New in Python 2 1

1.22.5 PEP 230: 警告フレームワーク
----------------------------------

10 年の間に、Python は途中で廃止されたモジュールと機能の特定の番号を蓄積
してきました。どれだけのコードが活用されているか知る術はないので、機能を
削除して問題ないか把握することは困難です。その機能に依存するプログラムは
一つもないかもしれませんし、たくさんあるかもしれません。より構造化された
方法で古い機能を削除できるようにするために、警告のフレームワークが追加さ
れました。Python の開発者がある機能を取り除きたいときは、まずは Python の
次のバージョンで警告を引き起こします。続く Python バージョンで開発者はそ
の機能を削除出来、ユーザは古い機能の使用を取り除くために Python リリース
サイクル一つ丸々使えます。

Python 2.1 はこのスキームで使われる警告フレームワークを追加します。また
、警告の表示機能や表示させたくない警告を除外する機能を提供する、 *note
warnings: 118. モジュールを追加します。サードパーティーのモジュールはま
た、彼らがサポート対象外にしたい古い機能を非推奨と知らしめるのにこのフレ
ームワークを利用できます。

For example, in Python 2.1 the ‘regex’ module is deprecated, so
importing it causes a warning to be printed:

     >>> import regex
     __main__:1: DeprecationWarning: the regex module
              is deprecated; please use the re module
     >>>

警告は *note warnings.warn(): 1732. 関数を呼び出すことで発行できます:

     warnings.warn("feature X no longer supported")

最初のパラメータは警告メッセージです。任意追加のパラメータは、特定の警告
カテゴリを指定するために利用することができます。

Filters can be added to disable certain warnings; a regular expression
pattern can be applied to the message or to the module name in order to
suppress a warning.  For example, you may have a program that uses the
‘regex’ module and not want to spare the time to convert it to use the
*note re: be. module right now.  The warning can be suppressed by
calling

     import warnings
     warnings.filterwarnings(action = 'ignore',
                             message='.*regex module is deprecated',
                             category=DeprecationWarning,
                             module = '__main__')

This adds a filter that will apply only to warnings of the class *note
DeprecationWarning: 1a3. triggered in the *note __main__: 1. module, and
applies a regular expression to only match the message about the ‘regex’
module being deprecated, and will cause such warnings to be ignored.
Warnings can also be printed only once, printed every time the offending
code is executed, or turned into exceptions that will cause the program
to stop (unless the exceptions are caught in the usual way, of course).

関数は、警告を発行するための Python の C API にも追加されました。詳細に
ついては PEP 230 または Python の API ドキュメントを参照してください。

参考
....

PEP 5(1) - 言語の進化のためのガイドライン

     Python から古い機能を削除する時に従うべき手順を示すため、 Paul
     Prescod により書かれました。当 PEP に記載された方針は正式に採用され
     ていませんが、最終的な方針も Prescod の提案とおそらくさほど違いはな
     いでしょう。

PEP 230(2) - 警告フレームワーク

     Guido van Rossum 著、実装

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0005/

   (2) https://peps.python.org/pep-0230/


File: python.info,  Node: PEP 229 新しいビルドシステム,  Next: PEP 205 弱参照,  Prev: PEP 230 警告フレームワーク,  Up: What's New in Python 2 1

1.22.6 PEP 229: 新しいビルドシステム
------------------------------------

Python のコンパイル時、ユーザはソースツリーの中に入って、様々な追加モジ
ュールを有効にするために ‘Modules/Setup’ ファイルを編集しなければなりま
せんでした; デフォルトのセットは比較的小さくて、ほとんどの Unix プラット
フォームで、コンパイルするモジュールを制限しています。これは、特に Linux
に顕著ですが、たくさんの追加機能を持った Unix プラットフォームでは、
Python インストレーションはしばしば、そう出来るのに有用なモジュールを全
く含まない、といったことが起こることを意味しています。

Python 2.0 は、配布と拡張のインストールをするためのモジュールのセットで
ある Distutils を追加しました。Python 2.1 では Distutils を、たくさんの
拡張モジュールの標準ライブラリを、サポートする機器かどうかを自動検出して
コンパイルするのに使っています。これが Python インストレーションをより簡
単に、より機能的とするものであることが期待されています。

モジュールを有効化するために ‘Modules/Setup’ を編集する必要性の代わりに
、Python ソースツリーのトップレベルディレクトリにある ‘setup.py’ スクリ
プトがビルド時に実行され、システムのモジュールとヘッダファイルを調べるこ
とによって、どのモジュールが有効に出来るのかを検出しようと試みます。モジ
ュールが ‘Modules/Setup’ 内でそう構成されていれば、 ‘setup.py’ スクリプ
トはそのモジュールをコンパイルしようとはせずに ‘Modules/Setup’ ファイル
内容に従います。これは特定のプラットフォームで必要となるヘンチクリンなコ
マンドラインフラグやライブラリフラグを特定する手段も与えてくれます。

もう一つの大きなビルド機構の変更点は Neil Schemenauer による再構成で、今
や Python は、トップディレクトリと ‘Python/’, ‘Parser/’, ‘Objects/’,
‘Modules/’ サブディレクトリにあった別々の Makefile が再帰的にビルドする
代わりに、再帰をしないトップレベルの単一 makefile を使うようになっていま
す。このことで Python のビルドは速くなり、 Makefile をもてあそぶのが単純
明快になっています。

参考
....

PEP 229(1) - Distutils を使った Python のビルド

     A.M. Kuchling 著、実装

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0229/


File: python.info,  Node: PEP 205 弱参照,  Next: PEP 232 関数の属性,  Prev: PEP 229 新しいビルドシステム,  Up: What's New in Python 2 1

1.22.7 PEP 205: 弱参照
----------------------

*note weakref: 11a. モジュールを通して利用出来る弱参照(weak references)は
、ささやかですが有用な、Python プログラマの道具箱に新たに加わったデータ
型です。

オブジェクトへの参照(辞書内やリスト内を思い浮かべてください)を記憶してお
くということは、オブジェクトを生き永らえさせるという副作用を持っています
。少しばかりの、この振る舞いが望ましくない特殊なケースがあります。オブジ
ェクトのキャッシュがその最もありがちな一つで、もう一つはツリーのようなデ
ータ構造での循環参照です。

例えば、他の関数 ‘f(x)’ の結果を、その関数の引数と結果を辞書に格納するこ
とでキャッシュするメモライジング関数を考えてみましょう。

     _cache = {}
     def memoize(x):
         if _cache.has_key(x):
             return _cache[x]

         retval = f(x)

         # Cache the returned object
         _cache[x] = retval

         return retval

This version works for simple things such as integers, but it has a side
effect; the ‘_cache’ dictionary holds a reference to the return values,
so they'll never be deallocated until the Python process exits and
cleans up.  This isn't very noticeable for integers, but if ‘f()’
returns an object, or a data structure that takes up a lot of memory,
this can be a problem.

弱参照は、オブジェクトをその時間を超えて生き永らえさせたくないキャッシュ
の実装のための手段を提供します。オブジェクトがアクセス出来るのが弱参照か
らのみである場合、そのオブジェクトは解放されて、その弱参照は参照している
そのオブジェクトがもはや存在しないことを表明します。オブジェクト 'obj' へ
の弱参照を作るには、 ‘wr = weakref.ref(obj)’ とします。参照されているオ
ブジェクトは、それがあたかも関数であったかのように弱参照を「コール」する
ことで得ます: ‘wr()’ 。それは参照されたオブジェクトを返すか、もう存在し
ていないのであれば ‘None’ を返します。

This makes it possible to write a ‘memoize()’ function whose cache
doesn't keep objects alive, by storing weak references in the cache.

     _cache = {}
     def memoize(x):
         if _cache.has_key(x):
             obj = _cache[x]()
             # If weak reference object still exists,
             # return it
             if obj is not None: return obj

         retval = f(x)

         # Cache a weak reference
         _cache[x] = weakref.ref(retval)

         return retval

The *note weakref: 11a. module also allows creating proxy objects which
behave like weak references -- an object referenced only by proxy
objects is deallocated - but instead of requiring an explicit call to
retrieve the object, the proxy transparently forwards all operations to
the object as long as the object still exists.  If the object is
deallocated, attempting to use a proxy will cause a
‘weakref.ReferenceError’ exception to be raised.

     proxy = weakref.proxy(obj)
     proxy.attr   # Equivalent to obj.attr
     proxy.meth() # Equivalent to obj.meth()
     del obj
     proxy.attr   # raises weakref.ReferenceError

参考
....

PEP 205(1) - 弱参照

     Fred L. Drake, Jr.  著、実装

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0205/


File: python.info,  Node: PEP 232 関数の属性,  Next: PEP 235 大文字小文字を区別しないプラットフォームでのモジュールの読み込み,  Prev: PEP 205 弱参照,  Up: What's New in Python 2 1

1.22.8 PEP 232: 関数の属性
--------------------------

In Python 2.1, functions can now have arbitrary information attached to
them.  People were often using docstrings to hold information about
functions and methods, because the *note __doc__: 13f1. attribute was
the only way of attaching any information to a function.  For example,
in the Zope web application server, functions are marked as safe for
public access by having a docstring, and in John Aycock's SPARK parsing
framework, docstrings hold parts of the BNF grammar to be parsed.  This
overloading is unfortunate, since docstrings are really intended to hold
a function's documentation; for example, it means you can't properly
document functions intended for private use in Zope.

ついに関数に、任意の属性をセットし、取り出すことが出来るようになりました
。普通の Python 構文で出来ます:

     def f(): pass

     f.publish = 1
     f.secure = 1
     f.grammar = "A ::= B (C D)*"

The dictionary containing attributes can be accessed as the function's
*note __dict__: 14ea.  Unlike the *note __dict__: e57. attribute of
class instances, in functions you can actually assign a new dictionary
to *note __dict__: 14ea, though the new value is restricted to a regular
Python dictionary; you 'can't' be tricky and set it to a ‘UserDict’
instance, or any other random object that behaves like a mapping.

参考
....

PEP 232(1) - 関数の属性

     Barry Warsaw 著、実装

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0232/


File: python.info,  Node: PEP 235 大文字小文字を区別しないプラットフォームでのモジュールの読み込み,  Next: PEP 217 対話モード用 Display Hook,  Prev: PEP 232 関数の属性,  Up: What's New in Python 2 1

1.22.9 PEP 235: 大文字小文字を区別しないプラットフォームでのモジュールの読み込み
--------------------------------------------------------------------------------

いくつかのオペレーティングシステムは、大小文字区別に無関心なファイルシス
テムを持っています。MacOS と Windows がその代表例です。それらシステムに
おいてはファイル名 ‘FILE.PY’ と ‘file.py’ の区別が出来ません。たとえそれ
が元のファイル名を尊重して格納出来たとしてもです(それらは大小文字維持、
でもあります)。

Python 2.1 では *note import: 7f8. 文が、case-insensitive (大小文字に無
関心)なプラットフォームで case-sensitivity (大小文字への繊細さ)をシミュ
レートして動作します。Python は今や、まずはデフォルトで case-sensitive な
マッチによる検索をし、それで見つからなければ *note ImportError: 65b. を
投げます。ですから ‘import file’ は ‘FILE.PY’ をインポートしません。
case-insensitive マッチングは Python インタプリタ開始前に環境変数 *note
PYTHONCASEOK: b55. をセットすることで要求出来ます。


File: python.info,  Node: PEP 217 対話モード用 Display Hook,  Next: PEP 208 新しい型強制モデル,  Prev: PEP 235 大文字小文字を区別しないプラットフォームでのモジュールの読み込み,  Up: What's New in Python 2 1

1.22.10 PEP 217: 対話モード用 Display Hook
------------------------------------------

Python インタプリタを対話的に使う際には、コマンドの出力結果表示にはビル
トインの *note repr(): 1c1. 関数が使われます。Python 2.1 ではこの *note
repr(): 1c1. の代わりに呼び出される呼び出し可能オブジェクトを、 *note
sys.displayhook(): 1738. 変数にセット出来ます。たとえば特別な pretty-
printing 関数をセット出来ます:

     >>> # Create a recursive data structure
     ... L = [1,2,3]
     >>> L.append(L)
     >>> L # Show Python's default output
     [1, 2, 3, [...]]
     >>> # Use pprint.pprint() as the display function
     ... import sys, pprint
     >>> sys.displayhook = pprint.pprint
     >>> L
     [1, 2, 3,  <Recursion on list with id=135143996>]
     >>>

参考
....

PEP 217(1) - Display Hook の対話的な使用

     Moshe Zadka 著、実装

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0217/


File: python.info,  Node: PEP 208 新しい型強制モデル,  Next: PEP 241 Pythonソフトウェアパッケージのためのメタデータ,  Prev: PEP 217 対話モード用 Display Hook,  Up: What's New in Python 2 1

1.22.11 PEP 208: 新しい型強制モデル
-----------------------------------

数値強制が C レベルでどのようになされるかについての修正は、とても大きな
ものでした。これは Python の C 拡張の著者にのみ影響し、数値操作をサポー
トする拡張型を書くのをより柔軟にするものです。

拡張型はその ‘PyTypeObject’ 構造体に、新しい型強制モデルをサポートするこ
とを示すために ‘Py_TPFLAGS_CHECKTYPES’ フラグをセット出来るようになりま
した。そのような拡張型内では、数値的スロット関数は 2 つの引数が同じ型で
あることを仮定しなくなります。代わりに、2 つの引数が異なる型を渡せて、内
部的に型変換を実行出来ます。スロット関数にそれが処理出来ない型が渡された
場合は、それが失敗であることを表すために ‘Py_NotImplemented’ シングルト
ン値への参照を返せます。この場合他の数値関数が試されて、おそらく操作を実
行出来ます。それでも ‘Py_NotImplemented’ を返すなら *note TypeError:
198. が送出されます。Python で書かれた数値メソッドも ‘Py_NotImplemented’
を返せます。この場合インタプリタはメソッドが存在しないものとして振舞いま
す。 (おそらく *note TypeError: 198. が投げられたり、オブジェクトのほか
の数値メソッドが試されます。)

参考
....

PEP 208(1) - 型強制モデルの手直し

     Neil Schemenauer により著され、実装されましたが、大変多くを
     Marc-André Lemburg による以前の仕事に拠っています。C レベルで今では
     数値操作がどのように処理されるようになったかの細かい点を理解したけ
     れば、これを読んで下さい。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0208/


File: python.info,  Node: PEP 241 Pythonソフトウェアパッケージのためのメタデータ,  Next: 新しいモジュールと改良されたモジュール<4>,  Prev: PEP 208 新しい型強制モデル,  Up: What's New in Python 2 1

1.22.12 PEP 241: Pythonソフトウェアパッケージのためのメタデータ
---------------------------------------------------------------

Python ユーザーからのよくある苦情としては、存在するすべての Python モジ
ュールの一覧がないということです。T. Middleton's の
‘www.vex.net/parnassus/’ にあった Vaults of Parnassus (2009年2月に停止、
Internet Archive Wayback Machine
<‘https://web.archive.org/web/20090130140102/http://www.vex.net/parnassus/’>'_
で閲覧可) が最大のものでしたが、ソフトウェアの登録は任意だったため、多く
の人は登録しませんでした。

この問題をどうにかするための最初の小さな一歩として、Distutils の ‘sdist’
コマンドを使ってパッケージ化する Python ソフトウェアに ‘PKG-INFO’ と名付
けられたファイルを含むようにしました。これには名前、バージョン、著者 (カ
タログ化の用語ではメタデータ) のような情報を含んでいます。 PEP 241(1) が
‘PKG-INFO’ ファイルに持てるフィールドの完全なリストを記述しています。
Python 2.1 を使ったソフトウェアをパッケージ化し始めた人々によってパッケ
ージがどんどんメタデータを含み、自動的なカタログ化システムを構築し、それ
を実験することが出来るようになります。その結果の経験により、おそらく本当
に良いカタログを設計出来、Python 2.2 でそのサポートを構築出来るでしょう
。例えば Distutils の ‘sdist’ コマンドと ‘bdist_*’ コマンド群はあなたの
パッケージをカタログサーバに自動的にアップロードする ‘upload’ オプション
をサポート出来るでしょう。

‘PKG-INFO’ を含んだパッケージの作成は Python 2.1 を使っていなくても開始
することが出来ます。Distutils の新しいリリースが以前のバージョンの
Python ユーザ向けにも作られているからです。Distutils のバージョン 1.0.2
が、多数のバグフィックスや拡張とともに、 PEP 241(2) の変更を含んでいます
。これは ‘https://www.python.org/community/sigs/current/distutils-sig/’
にある Distutils SIG から入手可能です。

参考
....

PEP 241(3) - Pythonソフトウェアパッケージのためのメタデータ

     A.M. Kuchling 著、実装

PEP 243(4) - レポジトリアップロードモジュールのメカニズム

     Sean Reifschneider により著されました。このドラフト PEP は中央サー
     バに Python パッケージをアップロードする機構について提案しています
     。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0241/

   (2) https://peps.python.org/pep-0241/

   (3) https://peps.python.org/pep-0241/

   (4) https://peps.python.org/pep-0243/


File: python.info,  Node: 新しいモジュールと改良されたモジュール<4>,  Next: その他の変更と修正<4>,  Prev: PEP 241 Pythonソフトウェアパッケージのためのメタデータ,  Up: What's New in Python 2 1

1.22.13 新しいモジュールと改良されたモジュール
----------------------------------------------

   * Ka-Ping Yee contributed two new modules: ‘inspect.py’, a module for
     getting information about live Python code, and ‘pydoc.py’, a
     module for interactively converting docstrings to HTML or text.  As
     a bonus, ‘Tools/scripts/pydoc’, which is now automatically
     installed, uses ‘pydoc.py’ to display documentation given a Python
     module, package, or class name.  For example, ‘pydoc xml.dom’
     displays the following:

          Python Library Documentation: package xml.dom in xml

          NAME
              xml.dom - W3C Document Object Model implementation for Python.

          FILE
              /usr/local/lib/python2.1/xml/dom/__init__.pyc

          DESCRIPTION
              The Python mapping of the Document Object Model is documented in the
              Python Library Reference in the section on the xml.dom package.

              This package contains the following modules:
                ...

     ‘pydoc’ には TK ベースの対話的ヘルプブラウザも含まれています。
     ‘pydoc’ はすぐに病みつきになります。お試しあれ。

   * Two different modules for unit testing were added to the standard
     library.  The *note doctest: 3e. module, contributed by Tim Peters,
     provides a testing framework based on running embedded examples in
     docstrings and comparing the results against the expected output.
     PyUnit, contributed by Steve Purcell, is a unit testing framework
     inspired by JUnit, which was in turn an adaptation of Kent Beck's
     Smalltalk testing framework.  See ‘https://pyunit.sourceforge.net/’
     for more information about PyUnit.

   * The *note difflib: 3b. module contains a class, *note
     SequenceMatcher: 121b, which compares two sequences and computes
     the changes required to transform one sequence into the other.  For
     example, this module can be used to write a tool similar to the
     Unix ‘diff’ program, and in fact the sample program
     ‘Tools/scripts/ndiff.py’ demonstrates how to write such a script.

   * *note curses.panel: 31. はパネルライブラリへのラッパーであり、
     ncurses と SYSV curses の一部であり、 Thomas Gellekum により寄稿さ
     れました。パネルライブラリは深さ(depth)の追加機能を持つウィンドウを
     提供しています。ウィンドウは深さ順での高い方、低い方に移動出来、パ
     ネルライブラリはパネルがどこで重なるか、区域のどちらが可視かを理解
     します。

   * The PyXML package has gone through a few releases since Python 2.0,
     and Python 2.1 includes an updated version of the *note xml: 126.
     package.  Some of the noteworthy changes include support for Expat
     1.2 and later versions, the ability for Expat parsers to handle
     files in any encoding supported by Python, and various bugfixes for
     SAX, DOM, and the ‘minidom’ module.

   * Ka-Ping Yee は未捕捉の例外を処理するもうひとつのフックも寄稿しまし
     た。 *note sys.excepthook(): a0c. には呼び出し可能オブジェクトをセ
     ット出来ます。例外がどの *note try: 8f8...*note except: 1ab. にも捕
     捉されない場合に、例外は *note sys.excepthook(): a0c. に通されて、
     そこで好きなことを何でも出来ます。9 回目の Python カンファレンスに
     おいて、Ping はこのフックを使ったアプリケーションのデモを行いました
     。そこでは、スタックフレームを列挙するだけでなくそれぞれのフレーム
     での関数の引数とローカル変数の列挙も行う拡張トレースバックの表示を
     していました。

   * Various functions in the *note time: f4. module, such as *note
     asctime(): 1400. and *note localtime(): 1712, require a
     floating-point argument containing the time in seconds since the
     epoch.  The most common use of these functions is to work with the
     current time, so the floating-point argument has been made
     optional; when a value isn't provided, the current time will be
     used.  For example, log file entries usually need a string
     containing the current time; in Python 2.1, ‘time.asctime()’ can be
     used, instead of the lengthier
     ‘time.asctime(time.localtime(time.time()))’ that was previously
     required.

     この変更は Thomas Wouters により提案され、実装されました。

   * *note ftplib: 62. モジュールがデフォルトでパッシブモードでファイル
     を取得するようになりました。これはパッシブモードがファイアウォール
     配下ではより良く動作するようだからです。この要望は Debian のバグト
     ラッキングシステムから起こりました。ほかの Debian パッケージがファ
     イル取得に *note ftplib: 62. を使い、ファイアウォールの元で動作しな
     かったのです。このことが誰かの問題になるとは思えません。Netscape の
     デフォルトがパッシブモードですし、苦情を言う人々も稀でした。ですが
     もしもパッシブモードがあなたのアプリケーションやネットワーク構成に
     とって不適切である場合には、FTP オブジェクトの ‘set_pasv(0)’ を呼び
     出して、パッシブモードを無効にしてください。

   * *note socket: d1. モジュールに、Grant Edwards により寄稿された、生
     のソケットへのアクセスのサポートが追加されました。

   * *note pstats: b5. モジュールに、Python プログラムの時間計測プロファ
     イルを表示する単純な対話的統計ブラウザが含まれるようになり、これは
     モジュールがスクリプトとして実行された場合に呼び出されます。Eric S.
     Raymond によって寄稿されました。

   * 実装依存の関数ですが ‘sys._getframe([depth])’ が、現在の呼び出しス
     タックより、指定したフレームオブジェクトを返すものとして追加されま
     した。 *note sys._getframe(): 8f0. は呼び出しスタックの一番上のフレ
     ームを返します。オプショナルな整数引数 'depth' を与えると、関数はス
     タックの一番上から下 'depth' ぶんの呼び出しのフレームを返します。例
     えば ‘sys._getframe(1)’ は呼び出し元のフレームオブジェクトを返しま
     す。

     この関数は CPython のみに含まれ、 Jython や .NET 実装にはありません
     。デバッグのためだけに用い、製品コード内にこれを書いてしまう誘惑に
     打ち克ってください。


File: python.info,  Node: その他の変更と修正<4>,  Next: 謝辞<7>,  Prev: 新しいモジュールと改良されたモジュール<4>,  Up: What's New in Python 2 1

1.22.14 その他の変更と修正
--------------------------

短めのリリースサイクルだったため Python 2.1 では比較的少ない変更でした。
CVS 変更ログの検索では 117 のパッチ適用と 136 のバグフィックスが見つかり
ます。ともに少なく見積もっています。いくつかの注目に値する変更を紹介しま
す:

   * A specialized object allocator is now optionally available, that
     should be faster than the system ‘malloc()’ and have less memory
     overhead.  The allocator uses C's ‘malloc()’ function to get large
     pools of memory, and then fulfills smaller memory requests from
     these pools.  It can be enabled by providing the ‘--with-pymalloc’
     option to the ‘configure’ script; see ‘Objects/obmalloc.c’ for the
     implementation details.

     Authors of C extension modules should test their code with the
     object allocator enabled, because some incorrect code may break,
     causing core dumps at runtime.  There are a bunch of memory
     allocation functions in Python's C API that have previously been
     just aliases for the C library's ‘malloc()’ and ‘free()’, meaning
     that if you accidentally called mismatched functions, the error
     wouldn't be noticeable.  When the object allocator is enabled,
     these functions aren't aliases of ‘malloc()’ and ‘free()’ any more,
     and calling the wrong function to free memory will get you a core
     dump.  For example, if memory was allocated using *note PyMem_New:
     173d, it has to be freed using *note PyMem_Del(): 173e, not
     ‘free()’.  A few modules included with Python fell afoul of this
     and had to be fixed; doubtless there are more third-party modules
     that will have the same problem.

     オブジェクトアロケータは Vladimir Marangozov により寄稿されました。

   * The speed of line-oriented file I/O has been improved because
     people often complain about its lack of speed, and because it's
     often been used as a naïve benchmark.  The *note readline(): bf.
     method of file objects has therefore been rewritten to be much
     faster.  The exact amount of the speedup will vary from platform to
     platform depending on how slow the C library's ‘getc()’ was, but is
     around 66%, and potentially much faster on some particular
     operating systems.  Tim Peters did much of the benchmarking and
     coding for this change, motivated by a discussion in
     comp.lang.python.

     A new module and method for file objects was also added,
     contributed by Jeff Epler.  The new method, ‘xreadlines()’, is
     similar to the existing ‘xrange()’ built-in.  ‘xreadlines()’
     returns an opaque sequence object that only supports being iterated
     over, reading a line on every iteration but not reading the entire
     file into memory as the existing ‘readlines()’ method does.  You'd
     use it like this:

          for line in sys.stdin.xreadlines():
              # ... do something for each line ...
              ...

     ライン I/O の変更についての詳しい説明は、
     ‘https://mail.python.org/pipermail/python-dev/2001-January/’ にある
     2001 年 1 月 1-15 日の python-dev のまとめをご覧ください。

   * A new method, *note popitem(): 173f, was added to dictionaries to
     enable destructively iterating through the contents of a
     dictionary; this can be faster for large dictionaries because
     there's no need to construct a list containing all the keys or
     values.  ‘D.popitem()’ removes a random ‘(key, value)’ pair from
     the dictionary ‘D’ and returns it as a 2-tuple.  This was
     implemented mostly by Tim Peters and Guido van Rossum, after a
     suggestion and preliminary patch by Moshe Zadka.

   * ‘from module import *’ を使ってインポートする際にインポートされる名
     前を制御出来るようになりました。インポートされるべき名前のリストを
     含む ‘__all__’ 属性を定義することでこれを行えます。一つのよくある不
     平が、 *note sys: df. や *note string: d8. のように、ほかのモジュー
     ルをモジュールがインポートする場合に、 ‘from module import *’ がイ
     ンポートしているモジュールの名前空間内にそれらを追加することです。
     これをフィックスするには、 ‘__all__’ に公開名を単に列挙します:

          # List public names
          __all__ = ['Database', 'open']

     このパッチのより厳密な版が最初に示唆されて Ben Wolfson により実装さ
     れましたが、python-dev でのいくつかの議論を経てからより弱い最終版が
     チェックインされました。

   * 文字列に *note repr(): 1c1. を適用するとこれまでは表示出来ない文字
     について、8 進エスケープが使われていました。例えば改行コードは
     ‘'\012'’ でした。これは Python の起源である C に追従した名残ですが
     、こんにちでは普段使いで 8 進エスケープが使われることは非常に少なく
     なりました。Ka-Ping Yee が 8 進の代わりに 16 進を使いつつ相応の文字
     には ‘\n’, ‘\t’, ‘\r’ などのエスケープを使うよう示唆し、この新しい
     書式化を実装しました。

   * コンパイル時点で検出される構文エラーがエラーとなったファイル名と行
     番号を含む例外を送出できるようになり、またこれによりコンパイラの再
     編成という喜ばしい副作用がありました。Jeremy Hylton により達成され
     ました。

   * C extensions which import other modules have been changed to use
     *note PyImport_ImportModule(): 3dc, which means that they will use
     any import hooks that have been installed.  This is also encouraged
     for third-party extensions that need to import some other module
     from C code.

   * Unicode 文字データベースのサイズが Fredrik Lundh のおかげでさらに
     340K だけ小さくなりました。

   * いくつかの新たなポートの寄与: MacOS X (by Steven Majewski), Cygwin
     (by Jason Tishler); RISCOS (by Dietmar Schwertberger); Unixware 7
     (by Billy G. Allie).

そしてよくあるマイナーなバグフィックス、マイナーなメモリリーク、ドキュメ
ンテーション文字列の編集やほかの微調整があり、全てを列挙するには長過ぎま
す。もし見たいのであれば、CVS ログで完全な詳細を読んで下さい。


File: python.info,  Node: 謝辞<7>,  Prev: その他の変更と修正<4>,  Up: What's New in Python 2 1

1.22.15 謝辞
------------

著者は提案の申し出や修正、様々なこの記事の草稿の助けをしてくれた以下の人
々に感謝します: Graeme Cross, David Goodger, Jay Graves, Michael Hudson,
Marc-André Lemburg, Fredrik Lundh, Neil Schemenauer, Thomas Wouters.


File: python.info,  Node: What's New in Python 2 0,  Next: 変更履歴,  Prev: What's New in Python 2 1,  Up: What's New in Python

1.23 What's New in Python 2.0
=============================


著者: A.M. Kuchling and Moshe Zadka

* Menu:

* はじめに: はじめに<3>.
* Python 1.6 はいかがですか?: Python 1 6 はいかがですか?.
* 新しい開発プロセス::
* Unicode 文字列型: Unicode 文字列型<2>.
* リストの内包表記::
* 累算代入 (Augmented Assignment): 累算代入 Augmented Assignment.
* 文字列メソッド::
* 循環参照のガベージコレクション::
* その他の言語コアの変更::
* Python 2.0 への移植: Python 2 0 への移植.
* 拡張と埋め込みについての変更::
* Distutils; モジュールの簡単インストール: Distutils モジュールの簡単インストール.
* XML モジュール::
* 更新されたモジュール::
* 新しいモジュール: 新しいモジュール<2>.
* IDLE の改善::
* 削除されたモジュール、非推奨となったモジュール::
* 謝辞: 謝辞<8>.


File: python.info,  Node: はじめに<3>,  Next: Python 1 6 はいかがですか?,  Up: What's New in Python 2 0

1.23.1 はじめに
---------------

新 Python リリース、バージョン 2.0 は、2000 年 10 月 16 日にリリースされ
ました。この記事では 2.0 のエキサイティングな新機能をカバーし、いくつか
の有用な変更点をハイライトし、少しの、コードの書き換えを要する互換性のな
い変更点について指摘します。

Python の開発は、リリースとリリースの間で止まることはなく、バグフィック
スと改善はとめどなく、日夜提出されます。多くのマイナーフィックス、少しの
最適化、ドキュメンテーション文字列の追加、より良いエラーメッセージが 2.0
に仲間入りしました。これら全てを列挙するのは不可能ですが、それは確かに大
事でしょう、全てのリストを見たければ、公に入手可能な CVS ログを調べてく
ださい。この前進は、今やバグ修正に日々を費やすことで報酬を受け取って
PythonLabs のために働く 5 人の開発者、それと SourceForge に移行した結果
改善されたコミュニケーションのおかげです。


File: python.info,  Node: Python 1 6 はいかがですか?,  Next: 新しい開発プロセス,  Prev: はじめに<3>,  Up: What's New in Python 2 0

1.23.2 Python 1.6 はいかがですか?
---------------------------------

Python 1.6 は「推定的義務」の Python リリースと考えることが出来ます。
2000 年 5 月にコア開発チームが CNRI を離れたあと、CNRI は Python にかか
る作業全てが CNRI で実施されることを含む 1.6 リリースが作成されることを
リクエストしました。それゆえ Python 1.6 は、最も重要な新機能としての
Unicode サポートを含む、2000 年 5 月の CVS ツリーの状態と同等です。開発
はもちろん 5 月以降も継続されましたので、1.6 ツリーは Python 2.0 との前
方互換を保障するために少しの修正を受け取りました。1.6 はですから、Python
の進化の一部であり、側枝ではありません。

では、あなたは Python 1.6 に興味を示すべきでしょうか?  おそらく答えはノ
ーです。1.6final と 2.0beta1 のリリースは同じ日に行われ (2000 年 9 月 5
日)、Python 2.0 のファイナライズはその一ヶ月かそこらで行われるよう計画さ
れました。もしあなたが保守すべきアプリケーションを持っているならば、1.6
への移行には少しばかりコードの破壊を伴うようです。つまりその修正を行い、
一ヶ月の間に 2.0 への移行による別の破壊ラウンドがやってきます。直接 2.0
に移行したほうが良いでしょう。このドキュメントに記載する、ほとんどの面白
い機能は 2.0 のみのものであり、なぜならほとんどの作業は、5 月から 9 月の
間に行われたからなのです。


File: python.info,  Node: 新しい開発プロセス,  Next: Unicode 文字列型<2>,  Prev: Python 1 6 はいかがですか?,  Up: What's New in Python 2 0

1.23.3 新しい開発プロセス
-------------------------

Python 2.0 における最も重要な変化はコードに対するものではまったくなくて
、Python がどのように開発されるのかについてでしょう: 2000 年 5 月に
Python 開発者たちは、ソースコード格納、バグ報告の追跡、パッチ提出の待ち
行列管理のための SourceForge によって利用出来るようになったツールの使用
を始めました。Python 2.0 ではバグ報告やパッチの提出には、Python プロジェ
クトページで利用可能なバグトラッキングとパッチ管理ツールを使ってください
。 ‘https://sourceforge.net/projects/python/’ にあります(訳注: 2015 年現
在の状況は What's New in Python 2.6 参照)。

SourceForge で現在ホストされているサービスの中で最も重要なのは Python
CVS ツリーで、Python のソースコードを含む、バージョンコントロールされた
レポジトリです。以前までは、CVS ツリーへの書き込み許可を持つ人々が 7 人
ほどいて、全てのパッチはその中の一人が精査とチェックをする必要がありまし
た。明らかにこれはスケーラブルではありませんでした。CVS ツリーを
SourceForge に移動することで、より多くの人々に書き込み許可を与えることが
可能になりました; 2000 年 9 月時点で、27 人の人々が変更をチェックイン出
来るようになっていました。これは 4 倍の増加です。これは大規模な変更、こ
れまでであれば小さなコア開発グループによるフィルタを経由しなければならな
いために試みられなかったような、大規模な変更を可能にしています。例えばあ
る日 Peter Schneider-Kamp は K&R C 互換を落としてしまうことを思い立ち、
Python の C ソースを ANSI C に変換しました。python-dev メーリングリスト
での承認を得たのち、彼は立て続けにチェックインを開始しておよそ一週間ほど
で終わらせ、ほかの開発者たちも手助けに参加し、そして作業は完了しました。
書き込み許可が 5 人だけだったならば、おそらくそのタスクはこう見做された
でしょう:「素晴らしい。けれども時間と労力に見合わない」。そして決して実
現することはなかったことでしょう。

SourceForge のサービスを使うことへのシフトは、開発の目覚しいスピードアッ
プをもたらしました。パッチはいまや、提出され、コメントされ、提出者以外の
別人によって改定されて戻ってきて、などなどが、パッチがチェックインの価値
があると判断されるまで行われています。バグは唯一つの中央保管庫で追跡され
、修正には特定の誰かを割り当てることが出来、そして私たちはオープンバグを
進捗の指標として考えることが出来ます。これは代償なしでは達成しませんでし
た; 開発者には今や以前よりもたくさんの処理すべき電子メールがあり、より多
くメーリングリストに追従しなければならず、そして新しい環境のための特別な
ツールを要しました。例えば、SourceForge はデフォルトでパッチ提出とバグ報
告を電子メールで通知しますが、これは全く助けにならないもので、Ka-Ping
Yee はもっと有用なメッセージを送信するための HTML スクリーンスクレイパを
書きました。

簡単にコードを追加出来るようになったことは、当初少し苦痛を大きくしました
。例えばコードが不十分なままだったり、開発グループからのはっきりとした承
諾のないままチェックインされたりするといったことです。浮上してきた承認プ
ロセスは、Apache グループが使っているようなものにいくらか似たものです。
開発者たちは +1, +0, -0, -1 というふうにパッチに投票できます; +1 と -1 は
承諾、却下を表し、+0 と -0 は、開発者は変更にほとんど興味がないけれども
やや肯定、否定の傾向であることを意味します。Apache モデルからの最も大き
な違いは、投票行為は本質的に助言であって、優しい終身独裁者 Guido van
Rossum 侯に大衆の民意を伝えるものであることです。彼は投票結果をそれでも
無視出来ますし、コミュニティが異論を唱えようが変更を承認したり却下したり
出来ます。

実際のパッチの作成は新機能の追加での最後のステップであり、通常、良いデザ
インを工面する前のタスクと容易に比較出来ます。一方で新機能についての議論
はしばしばメーリングリストでの長大なスレッドを巻き起こし、議論に追いつく
のが大変になり、そして誰も python-dev の投稿全てを読めません。それゆえに
、Python 拡張提案 (Python Enhancement Proposals: PEPs)を書く、相対的に形
式ばったプロセスが、始動しました。インターネットの RFC をモデルにしたも
のです。PEPs は新機能提案を記述した草案文書であり、コミュニティの合意と
して提案が承認されるか却下されるまで継続的に改定されます。 PEP 1(1) の導
入部、"PEP の目的とガイドライン" から引用します:

     PEP は Python Enhancement Proposal を意味します。PEP は、Python コ
     ミュニティに対して情報を提供する、あるいは Python の新機能について
     記述する設計文書です。PEP は、機能についての技術的な仕様とその機能
     の論拠(理論)を簡潔に伝えるべきです。

     私たちは PEP が新機能提案にかかる、コミュニティによる問題提起の集積
     と Python になされる設計決断の文書化のための最上位の機構となること
     を意図しています。PEP の著者にはコミュニティ内の合意形成を行うこと
     、反対意見を文書化することの責務があります。

PEP の編集に関するプロセス、様式、体裁についての詳細が PEP 1(2) の残りの
部分に書かれています。PEPs は SourceForge 上の Python CVS ツリーで営まれ
ますが Python 2.0 配布物の一部ではなく、 ‘https://peps.python.org/’ で
HTML 形式で利用可能です。2000 年 9 月時点で PEP 201(3) の "Lockstep
Iteration" から PEP 225 の "Elementwise/Objectwise Operators" までの 25
の PEP があります。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0001/

   (2) https://peps.python.org/pep-0001/

   (3) https://peps.python.org/pep-0201/


File: python.info,  Node: Unicode 文字列型<2>,  Next: リストの内包表記,  Prev: 新しい開発プロセス,  Up: What's New in Python 2 0

1.23.4 Unicode 文字列型
-----------------------

Python 2.0 での最大の新機能は新しい基礎データ型、Unicode 文字列です。
Unicode は文字を表現するのに ASCII で使用される 8 ビット数の代わりに 16
ビットを使います。これによって 65,536 の個別の文字がサポート出来ます。
(--訳注: Unicode の扱いはまず Python 2.2 で UCS4 が使えるように拡張され
(つまり 32 ビットに拡張)、Python 3 では Unicode が唯一の文字列型に変更さ
れています。後者の変更点は非常に大きいですが、クックブックの「Python 2 か
ら Python 3 への移植」に比較的よくまとめられています。--)

最終的な Unicode サポートに関するインターフェイスは、python-dev メーリン
グリストにおける数え切れない、時として嵐のような議論を経て、Fredrik
Lundh によって実装された Unicode 文字列型に基づいて、ほとんどが
Marc-André Lemburg によって実装されました。インターフェイスについての詳
細な説明は PEP 100(1) 「Python Unicode の統合」に記述されました。今ここ
では、Unicode インターフェイスについて、一番重要な点を単純にカバーするだ
けにしましょう。

Python ソースコード内では Unicode 文字列は ‘u"string"’ のように書きます
。任意の Unicode 文字は新しく追加されたエスケープシーケンスで書きます。
‘\uHHHH’ のように書き、 'HHHH' は 0000 から FFFF までの 4 桁の 16 進表記
数です。以前からあるエスケープシーケンス ‘\xHH’ も使えますし、8 進表記も
、 ‘\777’ で表現される U+01FF までの文字に使えます。

Unicode 文字列は普通の文字列と全く似ていて、 *note immutable: 15b9. なシ
ーケンス型です。添え字でアクセス出来、スライス出来ますが、インプレイスに
変更することは出来ません。Unicode 文字列は ‘encode( [encoding] )’ メソッ
ドを持っていて、これは望みのエンコーディングでエンコードした 8 ビット文
字列を返します。エンコーディングは文字列で名前付けられていて、例えば
‘'ascii'’, ‘'utf-8'’, ‘'iso-8859-1'’ のようなものです。コーデック API は
、新しいエンコーディングを実装し、Python プログラム全体を通して利用可能
となるよう登録するために定義されています。エンコーディングが指定されない
場合はデフォルトのエンコーディングは普通 7 ビット ASCII ですが、Python イ
ンストレーションにおいて、 ‘site.py’ のカスタマイズ版内で
‘sys.setdefaultencoding(encoding)’ を呼び出すことで変更出来ます。

8 ビット文字列と Unicode 文字列を結合すると常に、デフォルトの ASCII エン
コーディングを使って Unicode に型変換されます。 ‘'a' + u'bc'’ の結果は
‘u'abc'’ になります。

新たなビルトイン関数が追加され、既存のビルトイン関数も Unicode サポート
のために修正されました:

   * ‘unichr(ch)’ は Unicode におけるコードが整数 'ch' になるような文字
     1 文字からなる Unicode 文字列を返します。

   * 'u' が 1 文字の通常文字あるいは Unicode 文字として、 ‘ord(u)’ はコ
     ードを整数で返します。

   * ‘unicode(string [, encoding] [, errors] )’ は、8 ビット文字列から
     Unicode 文字列を作ります。 ‘encoding’ は使用するエンコーディング名
     の文字列です。 ‘errors’ パラメータは、現在エンコーディングにおいて
     不正な文字の扱いを指示します; これに値として ‘'strict'’ を渡すと全
     てのエンコーディングエラーに対し、例外を引き起こします。 ‘'ignore'’
     を渡すとエラーは黙って無視されます。 ‘'replace'’ を渡すと、全ての問
     題ケースで、公式な置き換え文字である U+FFFD に置き換えます。

   * ‘exec’ 文や　‘eval()’, ‘getattr()’, ‘setattr()’ のような色々なビル
     トインも、普通の文字列同様に Unicode 文字列を受け付けるようになりま
     した。(この修正をするプロセスをいくつかのビルトインで忘れている可能
     性もあります。文字列を受け取るものが Unicode を全く受け取らないビル
     トインを見つけたら、バグとして報告してください。)

新規モジュール *note unicodedata: 10b. は、Unicode 文字の特性へのインタ
ーフェイスを提供します。例えば ‘unicodedata.category(u'A')’ は 2 文字の
文字列 'Lu' を返しますが、これは、 'L' が letter を、 'u' が uppercase を
表します。 ‘unicodedata.bidirectional(u'\u0660')’ は 'AN' を返し、これは
U+0660 が Arabic Number であることを表します。

*note codecs: 1c. モジュールには、既存のエンコーディングをルックアップす
る関数、新しいエンコーディングを登録する関数が含まれます。新しいエンコー
ディングを実装したいと思うのでない限りは、一番使うことになるのは
‘codecs.lookup(encoding)’ でしょう。これは 4 要素のタプルを返します:
‘(encode_func, decode_func, stream_reader, stream_writer)’ 。

   * 'encode_func' は、Unicode 文字列を受け取って 2 要素タプル ‘(string,
     length)’ を返す関数です。 'string' は、与えられたエンコーディングで
     Unicode 文字列を変換した部分 (おそらく全体) を含む 8 ビット文字列で
     、 'length' は何文字の Unicode 文字列が変換されたかを伝えます。

   * 'decode_func' は 'encode_func' の対となる関数で、8 ビット文字列を受
     け取って、2 要素のタプル ‘(ustring, length)’ を返します。 'ustring'
     が結果の Unicode 文字列で、整数 'length' が、8 ビット文字列何文字が
     消費されたかを表します。

   * 'stream_reader' is a class that supports decoding input from a
     stream.  'stream_reader(file_obj)' returns an object that supports
     the ‘read()’, ‘readline()’, and ‘readlines()’ methods.  These
     methods will all translate from the given encoding and return
     Unicode strings.

   * 'stream_writer', similarly, is a class that supports encoding
     output to a stream.  'stream_writer(file_obj)' returns an object
     that supports the ‘write()’ and ‘writelines()’ methods.  These
     methods expect Unicode strings, translating them to the given
     encoding on output.

例えば以下のコードは Unicode 文字列を UTF-8 でエンコーディングしてファイ
ルに書きます:

     import codecs

     unistr = u'\u0660\u2000ab ...'

     (UTF8_encode, UTF8_decode,
      UTF8_streamreader, UTF8_streamwriter) = codecs.lookup('UTF-8')

     output = UTF8_streamwriter( open( '/tmp/output', 'wb') )
     output.write( unistr )
     output.close()

そして以下コードではファイルから UTF-8 で読めます:

     input = UTF8_streamreader( open( '/tmp/output', 'rb') )
     print repr(input.read())
     input.close()

*note re: be. モジュールでは Unicode 対応した正規表現が利用可能で、これ
は新しい根底となる SRE なる実装から成り、Secret Labs AB の Fredrik Lundh
によって書かれました。

Python コンパイラに全ての文字列リテラルを Unicode 文字列として解釈させる
ための ‘-U’ コマンドラインオプションが追加されました。これはあなたの
Python コードのテストと将来の保障を意図しています。というのも、将来の
Python バージョンでは 8 ビット文字列のサポートがなくなって、Unicode 文字
列だけとなる予定だからです。 (--訳注: ここで言っている将来バージョンとは
、結果的には Python 3 になりました。What's New での明記はないのですが
‘-U’ オプションは Python 2.7 時点では存在していません。ですが同じことは
2.6 以降では ‘from __future__ import unicode_literals’ で出来ます。 --)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0100/


File: python.info,  Node: リストの内包表記,  Next: 累算代入 Augmented Assignment,  Prev: Unicode 文字列型<2>,  Up: What's New in Python 2 0

1.23.5 リストの内包表記
-----------------------

リストというのは Python の主要なデータ型で、多くのプログラムがリストをい
つかは操るものです。リストの操作での 2 つのよくある操作は、それらについ
てループし、あるいは特定の基準に合致したものを取り出すか個々の要素にある
関数を適用するかする、といったものです。例えば文字列のリストが与えられた
場合、特定の部分文字列を含む全ての文字列を引き抜いたり、あるいは各行から
末尾の空白を取り除いたりしたいでしょう。

既にあった *note map(): 19f. 関数、 *note filter(): a64. 関数がこの目的
のためには使えますが、それらにはその引数の一つに関数が必要です。何か既存
のビルトイン関数で直接渡せるものがあればよいのですが、これがない場合その
必要とされる仕事をする小さな関数を作る必要があって、また、Python のスコ
ープ規則によって、その小さな関数が何かほかの情報を必要とする場合に醜いも
のになります。前パラグラフでの最初の例を考えましょう。指定の部分文字列を
含む文字列リストから全てを探す例です。このように書けるでしょう:

     # Given the list L, make a list of all strings
     # containing the substring S.
     sublist = filter( lambda s, substring=S:
                          string.find(s, substring) != -1,
                       L)

Python のスコープ規則のために、 *note lambda: 14b5. 式で作っている匿名関
数にデフォルト引数を使い、これに検索対象の部分文字列を渡しています。リス
ト内包表記はこれを明快にします:

     sublist = [ s for s in L if string.find(s, S) != -1 ]

リスト内包表記は以下の形式を持ちます:

     [ expression for expr in sequence1
                  for expr2 in sequence2 ...
                  for exprN in sequenceN
                  if condition ]

‘for’...‘in’ 節はイテレートするシーケンスを含みます。シーケンス群は同じ
長さである必要はありません。それらは並列でイテレートされる 'のではなく'
左から右の順で周ります。続くパラグラフでもっとわかりやすく説明します。生
成されるリストの要素は一連の 'expression' の値となります。最後の *note
if: 181. 節はオプショナルです。これがあれば 'expression' は 'condition'
が真の場合にのみ評価・追加されます。

セマンティクスについてとてもわかりやすく説明しておきましょう。リスト内包
は以下の Python コードと等価です:

     for expr1 in sequence1:
         for expr2 in sequence2:
         ...
             for exprN in sequenceN:
                  if (condition):
                       # Append the value of
                       # the expression to the
                       # resulting list.

つまり、複数の ‘for’...‘in’ 節があって ‘if’ がないときの最終出力は、長さ
が各シーケンス長の積に等しくなるということです。長さ 3 のリスト二つなら
、出力リストの長さは 9 要素です:

     seq1 = 'abc'
     seq2 = (1,2,3)
     >>> [ (x,y) for x in seq1 for y in seq2]
     [('a', 1), ('a', 2), ('a', 3), ('b', 1), ('b', 2), ('b', 3), ('c', 1),
     ('c', 2), ('c', 3)]

Python の文法に曖昧さを紛れ込ませないように、'expression' でタプルを作る
なら括弧で囲わなくてはなりません。下にあるリスト内包表記で、最初のは構文
エラーですが、二番目は有効です:

     # Syntax error
     [ x,y for x in seq1 for y in seq2]
     # Correct
     [ (x,y) for x in seq1 for y in seq2]

リスト内包表記のアイディアは、もともとは関数型プログラミング言語 Haskell
(‘https://www.haskell.org’) に由来しています。Greg Ewing が Python にこ
れを追加することを最も実際的に主張し、彼が最初のリスト内包のパッチを書き
ました。それは傍目には終わりのない議論が python-dev メーリングリストにて
続き、Skip Montanaro によって最新に保たれました。


File: python.info,  Node: 累算代入 Augmented Assignment,  Next: 文字列メソッド,  Prev: リストの内包表記,  Up: What's New in Python 2 0

1.23.6 累算代入 (Augmented Assignment)
--------------------------------------

累算代入はもう一つの長らく待ち望まれた機能であり、Python 2.0 に追加され
ました。累算代入演算子には ‘+=’, ‘-=’, ‘*=’ などがあります。例えばステー
トメント ‘a += 2’ は変数 ‘a’ に 2 を加算し、これはちょっとだけ長い記述
‘a = a + 2’ と同じです。

The full list of supported assignment operators is ‘+=’, ‘-=’, ‘*=’,
‘/=’, ‘%=’, ‘**=’, ‘&=’, ‘|=’, ‘^=’, ‘>>=’, and ‘<<=’.  Python classes
can override the augmented assignment operators by defining methods
named ‘__iadd__()’, ‘__isub__()’, etc.  For example, the following
‘Number’ class stores a number and supports using += to create a new
instance with an incremented value.

     class Number:
         def __init__(self, value):
             self.value = value
         def __iadd__(self, increment):
             return Number( self.value + increment)

     n = Number(5)
     n += 3
     print n.value

The ‘__iadd__()’ special method is called with the value of the
increment, and should return a new instance with an appropriately
modified value; this return value is bound as the new value of the
variable on the left-hand side.

累算代入演算子は最初に C 言語で導入されて、 ‘awk’, C++, Java, Perl, PHP
といった C から派生した言語のほとんどでサポートされています。累算代入の
パッチは Thomas Wouters により実装されました。


File: python.info,  Node: 文字列メソッド,  Next: 循環参照のガベージコレクション,  Prev: 累算代入 Augmented Assignment,  Up: What's New in Python 2 0

1.23.7 文字列メソッド
---------------------

Until now string-manipulation functionality was in the *note string: d8.
module, which was usually a front-end for the ‘strop’ module written in
C. The addition of Unicode posed a difficulty for the ‘strop’ module,
because the functions would all need to be rewritten in order to accept
either 8-bit or Unicode strings.  For functions such as
‘string.replace()’, which takes 3 string arguments, that means eight
possible permutations, and correspondingly complicated code.

代わりに、Python 2.0 は問題を文字列型に押し込み、文字列操作機能が 8 ビッ
ト文字列と Unicode 文字列の両方のメソッドを通じて利用可能としました。

     >>> 'andrew'.capitalize()
     'Andrew'
     >>> 'hostname'.replace('os', 'linux')
     'hlinuxtname'
     >>> 'moshe'.find('sh')
     2

変わらない一つのこと、華やかなエイプリルフールのジョークではありませんが
、それは Python 文字列が *note immutable: 15b9. だということです。ですの
で文字列メソッドは新しい文字列を返し、それが操作する文字列を変更しません
。

古い *note string: d8. モジュールはまだ後方互換性のために残されますが、
それはほとんど新たな文字列メソッドへのフロントエンドとして振舞います。

Two methods which have no parallel in pre-2.0 versions, although they
did exist in JPython for quite some time, are ‘startswith()’ and
‘endswith()’.  ‘s.startswith(t)’ is equivalent to ‘s[:len(t)] == t’,
while ‘s.endswith(t)’ is equivalent to ‘s[-len(t):] == t’.

One other method which deserves special mention is ‘join()’.  The
‘join()’ method of a string receives one parameter, a sequence of
strings, and is equivalent to the ‘string.join()’ function from the old
*note string: d8. module, with the arguments reversed.  In other words,
‘s.join(seq)’ is equivalent to the old ‘string.join(seq, s)’.


File: python.info,  Node: 循環参照のガベージコレクション,  Next: その他の言語コアの変更,  Prev: 文字列メソッド,  Up: What's New in Python 2 0

1.23.8 循環参照のガベージコレクション
-------------------------------------

Python の C 実装は、ガーベージコレクションの実装に参照カウントを使ってい
ます。全ての Python オブジェクトは自身を参照している数を維持していて、参
照が作成されたり破壊されたりするカウントを調整しています。参照カウントが
ゼロになればそのオブジェクトにはもはや到達可能ではありません。あなたはそ
れにアクセスするためのオブジェクトへの参照を持つ必要がありますが、カウン
トがゼロならば参照はもはや存在しないということです。

参照カウントはある種望ましい特徴を持っています。それは理解しやすく、実装
しやすく、結果としての実装の移植性は高く、かなり高速であり、そして、独自
のメモリ処理方式を実装しているようなほかのライブラリと共にでも良く振舞い
ます。参照カウントの主要な問題点は、それが時々、オブジェクトにはもう到達
不能であることに気付かないので、結果としてメモリリークを引き起こすことで
す。これは参照の循環がある場合に発生します。

最も単純な循環について考えてみます。クラスインスタンスが自身への参照を持
つ場合です:

     instance = SomeClass()
     instance.myself = instance

上の例の 2 行のコードが実行された後では、 ‘instance’ の参照カウントは 2
です。参照の一つ目は ‘'instance'’ と名付けられた変数からのもので、もう一
つの参照は、インスタンスの ‘myself’ 属性から来るものです。

このあとに続くコードが ‘del instance’ だとしたら、何が起こるでしょうか?
‘instance’ の参照カウントは 1 減るので参照カウントは 1 になります。
‘myself’ 属性内の参照はいまだ存在します。けれどもインスタンスはもう
Python コードからは到達不能ですから、本来削除出来るはずです。お互いを参
照しあうならばいくつものオブジェクトが循環に参加しえるので、結果それら全
てのオブジェクトはリークしてしまいます。

Python 2.0 はこの問題を、循環検出アルゴリズムを周期的に実行することによ
りフィックスします。そのアルゴリズムは、到達不能な循環を探して関係するオ
ブジェクトを削除します。新しく追加された *note gc: 64. モジュールは、ガ
ーベージコレクションを実行する関数、デバッグのための統計情報を取得する関
数、コレクタのパラメータを調整する関数を提供します。

循環検出アルゴリズムの実行はいくらかの時間がかかるので、結果として多少の
追加的なオーバヘッドがかかるでしょう。2.0 を使って循環のコレクションの経
験を積んだのちに、 Python 2.1 では注意深い調整によりオーバヘッドを最小に
出来ることが望まれています。今のところパフォーマンスの損失がいかほどなの
かは明らかではありません。これはこれのベンチマークがトリッキーであり、プ
ログラムがどれだけの頻度でオブジェクトを構築・破棄するのかに大きく依存す
るからです。循環の検出は Python コンパイル時に無効に出来ます。もしもあな
たが小さな速度のペナルティでさえも許容出来ないであるとか、あるいは循環の
コレクションがバギーであることを疑うのであれば、 ‘configure’ スクリプト
実行時に ‘--without-cycle-gc’ スイッチを与えることでそうすることが出来ま
す。 (--訳注: Python 2.3 でこの循環参照の GC は必須となり、
‘--without-cycle-gc’ 、 ‘--with-cycle-gc’ での有無効化は撤廃されました。
--)

何人かの人々がこの問題に体当たりで取り組み、解決に対する貢献をしました。
循環検出アプローチの初期の実装は、Toby Kelsey により書かれました。現在の
アルゴリズムは CNRI を訪れている間に Eric Tiedemann によって提案されて、
Guido van Rossum と Neil Schemenauer が別々の 2 つの実装を書いて、あとで
Neil によって統合されたものです。そこに至るまでにもほかの数多くの人々に
よって提案がなされました。python-dev メーリングリストの 2000 年 3 月のア
ーカイブに、これに関するほとんどの議論が含まれています。特にタイトルが
"Reference cycle collection for Python" と "Finalization again" のスレッ
ドです。


File: python.info,  Node: その他の言語コアの変更,  Next: Python 2 0 への移植,  Prev: 循環参照のガベージコレクション,  Up: What's New in Python 2 0

1.23.9 その他の言語コアの変更
-----------------------------

Python 文法とビルトイン関数について、色々マイナーな変更がなされました。
影響が広範囲に及ぶものは一つもありませんが、手軽で便利なものです。

* Menu:

* 言語のマイナー変更::
* ビルトイン関数の変更::


File: python.info,  Node: 言語のマイナー変更,  Next: ビルトイン関数の変更,  Up: その他の言語コアの変更

1.23.9.1 言語のマイナー変更
...........................

A new syntax makes it more convenient to call a given function with a
tuple of arguments and/or a dictionary of keyword arguments.  In Python
1.5 and earlier, you'd use the ‘apply()’ built-in function: ‘apply(f,
args, kw)’ calls the function ‘f()’ with the argument tuple 'args' and
the keyword arguments in the dictionary 'kw'.  ‘apply()’ is the same in
2.0, but thanks to a patch from Greg Ewing, ‘f(*args, **kw)’ is a
shorter and clearer way to achieve the same effect.  This syntax is
symmetrical with the syntax for defining functions:

     def f(*args, **kw):
         # args is a tuple of positional args,
         # kw is a dictionary of keyword args
         ...

The ‘print’ statement can now have its output directed to a file-like
object by following the ‘print’ with ‘>> file’, similar to the
redirection operator in Unix shells.  Previously you'd either have to
use the ‘write()’ method of the file-like object, which lacks the
convenience and simplicity of ‘print’, or you could assign a new value
to ‘sys.stdout’ and then restore the old value.  For sending output to
standard error, it's much easier to write this:

     print >> sys.stderr, "Warning: action field not supplied"

‘import module as name’ または ‘from module import name as othername’ と
いう構文を使って、インポートするモジュールの名前をリネーム出来るようにな
りました。パッチは Thomas Wouters が投稿しました。

‘%’ 演算子を使う際に新しい書式化スタイルが利用可能です; '%r' はその引数
の *note repr(): 1c1. を挿入します。これは対称性の検討からも考えられまし
た。今の場合は既存の '%s' が引数の *note str(): 169. を挿入することに呼
応するものです。例えば ‘'%r %s' % ('abc', 'abc')’ は文字列 ‘'abc' abc’ を
返します。

Previously there was no way to implement a class that overrode Python's
built-in *note in: 34b. operator and implemented a custom version.  ‘obj
in seq’ returns true if 'obj' is present in the sequence 'seq'; Python
computes this by simply trying every index of the sequence until either
'obj' is found or an *note IndexError: 174e. is encountered.  Moshe
Zadka contributed a patch which adds a ‘__contains__()’ magic method for
providing a custom implementation for ‘in’.  Additionally, new built-in
objects written in C can define what ‘in’ means for them via a new slot
in the sequence protocol.

以前のバージョンの Python では、オブジェクトの削除に再帰するアルゴリズム
を使っていました。データ構造が深くネストしている場合、インタプリタが C の
スタックを使い果たしてクラッシュしていました。Christian Tismer はこの問
題をフィックスする削除ロジックに書き直しました。これに関係する注目すべき
ものとしては、再帰するオブジェクトの比較が無限再帰してクラッシュしていた
のを、Jeremy Hylton が書き直してクラッシュしないようにして、有用な結果を
生成するようにしたことです。例えば以下コード:

     a = []
     b = []
     a.append(a)
     b.append(b)

The comparison ‘a==b’ returns true, because the two recursive data
structures are isomorphic.  See the thread "trashcan and PR#7" in the
April 2000 archives of the python-dev mailing list for the discussion
leading up to this implementation, and some useful relevant links.  Note
that comparisons can now also raise exceptions.  In earlier versions of
Python, a comparison operation such as ‘cmp(a,b)’ would always produce
an answer, even if a user-defined ‘__cmp__()’ method encountered an
error, since the resulting exception would simply be silently swallowed.

Work has been done on porting Python to 64-bit Windows on the Itanium
processor, mostly by Trent Mick of ActiveState.  (Confusingly,
‘sys.platform’ is still ‘'win32'’ on Win64 because it seems that for
ease of porting, MS Visual C++ treats code as 32 bit on Itanium.)
PythonWin also supports Windows CE; see the Python CE page at
‘https://pythonce.sourceforge.net/’ for more information.

Another new platform is Darwin/MacOS X; initial support for it is in
Python 2.0.  Dynamic loading works, if you specify "configure -with-dyld
-with-suffix=.x".  Consult the README in the Python source distribution
for more instructions.

変数に値が割り当てられる前にローカル変数を参照するコードにおいて、 *note
NameError: 452. 例外はよく混乱するものであり、この欠点を軽減する試みがな
されました。例えば下に挙げるコードは ‘print’ 文で 1.5.2 と 2.0 の両方で
例外が発生しますが、1.5.2 は *note NameError: 452. 例外が、2.0 では新規
の例外 *note UnboundLocalError: 174f. が投げられます。 *note
UnboundLocalError: 174f. は *note NameError: 452. のサブクラスですので
*note NameError: 452. が投げられることを想定する既存のコードはそのまま動
作するはずです。:

     def f():
         print "i=",i
         i = i + 1
     f()

2 つの新規例外 *note TabError: 765. と *note IndentationError: 1750. が
導入されました。これらはともに *note SyntaxError: 18e. のサブクラスで、
Python コードに不適切なインデントが見つかると送出されます。


File: python.info,  Node: ビルトイン関数の変更,  Prev: 言語のマイナー変更,  Up: その他の言語コアの変更

1.23.9.2 ビルトイン関数の変更
.............................

新しいビルトイン関数 ‘zip(seq1, seq2, ...)’ が追加されました。 *note
zip(): 1a0. はタプルのリストを返します。それぞれは、引数のシーケンスのそ
れぞれの i 番目要素たちを含むタプルです。 *note zip(): 1a0. と
‘map(None, seq1, seq2)’ の違いは、 *note map(): 19f. はシーケンスが同じ
長さを持たない場合に ‘None’ が埋められるのに対し、 *note zip(): 1a0. は
返すリストの長さを、引数のシーケンスの最も短い長さに切り詰めます。

The *note int(): 19b. and ‘long()’ functions now accept an optional
"base" parameter when the first argument is a string.  ‘int('123', 10)’
returns 123, while ‘int('123', 16)’ returns 291.  ‘int(123, 16)’ raises
a *note TypeError: 198. exception with the message "can't convert
non-string with explicit base".

*note sys: df. モジュールに、これまでより詳細なバージョン情報を持つ変数
が追加されました。 ‘sys.version_info’ はタプル ‘(major, minor, micro,
level, serial)’ です。例えば仮に 2.0.1beta1 というバージョンだったとすれ
ば、 ‘sys.version_info’ は ‘(2, 0, 1, 'beta', 1)’ となるでしょう。
'level' は ‘"alpha"’ や ‘"beta"’ といった文字列で、最終リリースでは
‘"final"’ です。(--訳注: Python 2.7 で名前付きタプルになっています。また
、その属性名では level ではなく releaselevel です。--)

Dictionaries have an odd new method, ‘setdefault(key, default)’, which
behaves similarly to the existing ‘get()’ method.  However, if the key
is missing, ‘setdefault()’ both returns the value of 'default' as
‘get()’ would do, and also inserts it into the dictionary as the value
for 'key'.  Thus, the following lines of code:

     if dict.has_key( key ): return dict[key]
     else:
         dict[key] = []
         return dict[key]

は、単一の ‘return dict.setdefault(key, [])’ ステートメントだけで書けま
す。

再帰の暴走を C のスタックが埋め尽くされてコアダンプしたり GPF (訳注:
General Protection Fault) する前に捕捉するために、インタプリタは最大の再
帰の深さをセットします。以前まではこの制限は Python コンパイル時点で決め
てしまっていましたが、2.0 では最大の再帰の深さは *note
sys.getrecursionlimit(): 6eb. と *note sys.setrecursionlimit(): 6ea. を
使って読み取れ、修正出来ます。このデフォルトは 1000 です。また、当該プラ
ットフォームでのおよその最大値は、新たに追加されたスクリプト
‘Misc/find_recursionlimit.py’ を実行することで知ることが出来ます。


File: python.info,  Node: Python 2 0 への移植,  Next: 拡張と埋め込みについての変更,  Prev: その他の言語コアの変更,  Up: What's New in Python 2 0

1.23.10 Python 2.0 への移植
---------------------------

新しい Python リリースは以前のリリースとの互換性を保つために苦心していま
すし、その記録はかなり良くなされてきました。ですがいくつかの変更に関して
は、大抵は大きな誤りであると判明した初期デザインを修正するという理由で、
後方互換性を破壊することを必ずしも回避せずに有用性が検討されています。こ
のセクションでは Python 2.0 において、古い Python コードを破壊するかもし
れない変更点について列挙します。

The change which will probably break the most code is tightening up the
arguments accepted by some methods.  Some methods would take multiple
arguments and treat them as a tuple, particularly various list methods
such as *note append(): 8dc. and *note insert(): 13b0.  In earlier
versions of Python, if ‘L’ is a list, ‘L.append( 1,2 )’ appends the
tuple ‘(1,2)’ to the list.  In Python 2.0 this causes a *note TypeError:
198. exception to be raised, with the message: 'append requires exactly
1 argument; 2 given'.  The fix is to simply add an extra set of
parentheses to pass both values as a tuple: ‘L.append( (1,2) )’.

The earlier versions of these methods were more forgiving because they
used an old function in Python's C interface to parse their arguments;
2.0 modernizes them to use *note PyArg_ParseTuple(): 3c1, the current
argument parsing function, which provides more helpful error messages
and treats multi-argument calls as errors.  If you absolutely must use
2.0 but can't fix your code, you can edit ‘Objects/listobject.c’ and
define the preprocessor symbol ‘NO_STRICT_LIST_APPEND’ to preserve the
old behaviour; this isn't recommended.

*note socket: d1. モジュールのいくつかの関数についてはまだこの方法が許さ
れています。例えば、 ‘socket.connect( ('hostname', 25) )’ が正しい形式な
のですが、 ‘socket.connect('hostname', 25)’ も動作します。*note
socket.connect_ex: 1753. と *note socket.bind: 12d7. も同じようにおおら
かです。2.0alpha1 がそれら関数を厳しくしたのですが、ドキュメントが実際に
は複数引数を取る形式で誤って書かれたために、多くの人々がその厳しくなった
チェックに違反してしまうコードを書いてしまいました。GvR はその変更を、市
民たちの反応を受けて元に戻し、 *note socket: d1. モジュールについてはド
キュメントは修正されて、複数引数形式は非推奨としてマークするに留められま
した。将来バージョンの Python においてこれはもう一度厳しく 'なります' 。
(--訳注: What's New からは読み取れませんが少なくとも 2.7 では単一引数で
しか渡せません。つまり明示的にタプルにして渡す必要があります。--)

文字列リテラル内の ‘\x’ エスケープは、正確に 2 桁の 16 進表記文字になり
ました。以前は 'x' に続く 16 進表記文字全てを消費して最後の 8 ビットを使
っていたため、 ‘\x123456’ は ‘\x56’ と同じでした。

例外 *note AttributeError: 5f0. と *note NameError: 452. がよりフレンド
リなエラーメッセージを持つようになっています。それらのテキストは ‘'Spam'
instance has no attribute 'eggs'’ や ‘name 'eggs' is not defined’ のよう
なものになります。以前まではエラーメッセージは存在しない属性名 ‘eggs’ だ
けでしたので、この事実に便乗して書かれたコードは 2.0 では壊れます。

Some work has been done to make integers and long integers a bit more
interchangeable.  In 1.5.2, large-file support was added for Solaris, to
allow reading files larger than 2 GiB; this made the ‘tell()’ method of
file objects return a long integer instead of a regular integer.  Some
code would subtract two file offsets and attempt to use the result to
multiply a sequence or slice a string, but this raised a *note
TypeError: 198.  In 2.0, long integers can be used to multiply or slice
a sequence, and it'll behave as you'd intuitively expect it to; ‘3L *
'abc'’ produces 'abcabcabc', and ‘(0,1,2,3)[2L:4L]’ produces (2,3).
Long integers can also be used in various contexts where previously only
integers were accepted, such as in the ‘seek()’ method of file objects,
and in the formats supported by the ‘%’ operator (‘%d’, ‘%i’, ‘%x’,
etc.).  For example, ‘"%d" % 2L**64’ will produce the string
‘18446744073709551616’.

一番微妙な長整数についての変更は、長整数を *note str(): 169. してももは
や末尾の 'L' 文字が付かないことです。 *note repr(): 1c1. では今でも付く
のにも関わらずです。 'L' は長整数を普通の整数と全く同じように印字したい
多くの人々を悩ませてきました。それを各々自分なりの手段で取り除く必要があ
ったからです。これはもう 2.0 では問題でなくなりましたが、 'L' が付くこと
をあてにして ‘str(longval)[:-1]’ とするコードが今度は数値の最後の桁を失
ってしまいます。

Taking the *note repr(): 1c1. of a float now uses a different formatting
precision than *note str(): 169.  *note repr(): 1c1. uses ‘%.17g’ format
string for C's ‘sprintf()’, while *note str(): 169. uses ‘%.12g’ as
before.  The effect is that *note repr(): 1c1. may occasionally show
more decimal places than *note str(): 169, for certain numbers.  For
example, the number 8.1 can't be represented exactly in binary, so
‘repr(8.1)’ is ‘'8.0999999999999996'’, while str(8.1) is ‘'8.1'’.

The ‘-X’ command-line option, which turned all standard exceptions into
strings instead of classes, has been removed; the standard exceptions
will now always be classes.  The ‘exceptions’ module containing the
standard exceptions was translated from Python to a built-in C module,
written by Barry Warsaw and Fredrik Lundh.


File: python.info,  Node: 拡張と埋め込みについての変更,  Next: Distutils モジュールの簡単インストール,  Prev: Python 2 0 への移植,  Up: What's New in Python 2 0

1.23.11 拡張と埋め込みについての変更
------------------------------------

いくつかの変更点については覆いが被されていて、C 拡張モジュールや大きなア
プリケーションでの Python インタプリタの埋め込みを書く人々からしか見えな
いものです。Python C API を扱う必要がないのであれば、このセクションは読
み飛ばして差し支えありません。

Python C API のバージョン番号がインクリメントされたので、1.5.2 でコンパ
イルされた C 拡張は 2.0 で動作させるために再コンパイルしなければなりませ
ん。Windows では Python 1.5.x でビルドされたサードパーティ拡張を Python
2.0 でインポートすることは、Windows の DLL の仕組みのために、出来ません
。その場合 Python は例外を投げ、インポートは失敗します。(--訳注: この文
章、おかしなことを言っているので一応…。おそらく「Windows の一般市民は C
コンパイラを持っていない」ことが著者の頭にあって、手が滑っているのだと思
います。DLL の動作の仕組みが問題となるのは事実ですが、本質的には Windows
云々はあまり関係ないです。API が変わるか ABI が変わるならプラットフォー
ムに関係なくリコンパイルは常に必要です。 --)

Users of Jim Fulton's ExtensionClass module will be pleased to find out
that hooks have been added so that ExtensionClasses are now supported by
*note isinstance(): 2ad. and *note issubclass(): 9c4.  This means you no
longer have to remember to write code such as ‘if type(obj) ==
myExtensionClass’, but can use the more natural ‘if isinstance(obj,
myExtensionClass)’.

‘Python/importdl.c’ ファイルが多くの異なるプラットフォームの動的ロードを
サポートするのに大量の #ifdef だらけになっていたのを、Greg Stein が掃除
して再編成しました。 ‘importdl.c’ は今ではとても小さくなり、プラットフォ
ーム依存のコードは ‘Python/dynload_*.c’ ファイル群の束にそれぞれ移動しま
した。もう一つの掃除。include/ ディレクトリ内で色々な移植性のためのハッ
クを施すためのたくさんの ‘my*.h’ ファイルたちが、単一の
‘Include/pyport.h’ にマージされました。

Vladimir Marangozov の手による、待ち望まれた malloc の再編成が完了しまし
た。これは Python インタプリタが C 標準の ‘malloc()’ の代わりにカスタム
アロケータを使うことを容易にするものです。ドキュメントについては
‘Include/pymem.h’ と ‘Include/objimpl.h’ のコメントを読んで下さい。イン
ターフェイスが決着するまでの間の長い長い議論については python.org の
'patches' と 'python-dev' リストのウェブアーカイブをみてください。(--訳
注: この件についての続きの話が What's New in Python 2.3 に Pymalloc とし
て少しわかりやすく記述されています。--)

MacOS の GUSI 開発環境の最近のバージョンは POSIX スレッドをサポートして
います。ですので Python の POSIX スレッディングのサポートは今では
Macintosh で動作します。ユーザ空間での GNU ‘pth’ ライブラリを使ったスレ
ッディングサポートも寄稿されました。

Windows でのスレッディングサポートも拡張されました。Windows は、競合があ
るケースでのみカーネルオブジェクトを使うスレッドロックをサポートしていま
す。競合がない普通のケースではそれらはより単純な関数を使い、これは段違い
に高速です。NT での Python 1.5.2 版でスレッド化すると、非スレッド版の 2
倍遅くなりますが、2.0 に変えるとその差はたった 10% です。これらの改善は
Yakov Markovitch の貢献によるものです。

Python 2.0 のソースが ANSI C プロトタイプだけを使うようになったので、
Python のコンパイルには ANSI C コンパイラが必須になりました。K&R C しか
サポートしないコンパイラではもうコンパイル出来ません。

Previously the Python virtual machine used 16-bit numbers in its
bytecode, limiting the size of source files.  In particular, this
affected the maximum size of literal lists and dictionaries in Python
source; occasionally people who are generating Python code would run
into this limit.  A patch by Charles G. Waldman raises the limit from
‘2**16’ to ‘2**32’.

Three new convenience functions intended for adding constants to a
module's dictionary at module initialization time were added: *note
PyModule_AddObject(): 60b, *note PyModule_AddIntConstant(): 1755, and
*note PyModule_AddStringConstant(): 1756.  Each of these functions takes
a module object, a null-terminated C string containing the name to be
added, and a third argument for the value to be assigned to the name.
This third argument is, respectively, a Python object, a C long, or a C
string.

Unix スタイルのシグナルハンドラへのラッパーAPIが追加されました。 *note
PyOS_getsig(): 1757. でシグナルハンドラを取得し、 *note PyOS_setsig():
1758. で新しいハンドラをセットします。


File: python.info,  Node: Distutils モジュールの簡単インストール,  Next: XML モジュール,  Prev: 拡張と埋め込みについての変更,  Up: What's New in Python 2 0

1.23.12 Distutils: モジュールの簡単インストール
-----------------------------------------------

Python 2.0 以前は、モジュールのインストールは退屈な作業でした - Python が
どこにインストールされているかや拡張モジュールのコンパイルに必要なオプシ
ョンを自動的に知る方法はありませんでした。ソフトウェアの作者は Makefile
と設定ファイル群の編集という大変な労力を要する儀式を通過しなければならな
いのに、それは実際には Unix だけのためであって Windows と MacOS のサポー
トを置き去りにするものでした。Python ユーザは全く異なったインストール命
令に直面していました。それは拡張パッケージごとに異なり、Python インスト
ールをある種つまらない作業としていました。

The SIG for distribution utilities, shepherded by Greg Ward, has created
the Distutils, a system to make package installation much easier.  They
form the ‘distutils’ package, a new part of Python's standard library.
In the best case, installing a Python module from source will require
the same steps: first you simply mean unpack the tarball or zip archive,
and the run "‘python setup.py install’".  The platform will be
automatically detected, the compiler will be recognized, C extension
modules will be compiled, and the distribution installed into the proper
directory.  Optional command-line arguments provide more control over
the installation process, the distutils package offers many places to
override defaults - separating the build from the install, building or
installing in non-default directories, and more.

Distutils を使うには ‘setup.py’ スクリプトを書く必要があります。単純なケ
ースでは、ソフトウェアが .py ファイルだけを含む場合、最小限の ‘setup.py’
は数行足らずで書けます:

     from distutils.core import setup
     setup (name = "foo", version = "1.0",
            py_modules = ["module1", "module2"])

‘setup.py’ ファイルは、ソフトウェアが少しのパッケージで構成される場合は
これより大きく複雑になることはありません:

     from distutils.core import setup
     setup (name = "foo", version = "1.0",
            packages = ["package", "package.subpackage"])

C 拡張が最も複雑なケースになりえます。以下は PyXML パッケージからもって
きた例です:

     from distutils.core import setup, Extension

     expat_extension = Extension('xml.parsers.pyexpat',
          define_macros = [('XML_NS', None)],
          include_dirs = [ 'extensions/expat/xmltok',
                           'extensions/expat/xmlparse' ],
          sources = [ 'extensions/pyexpat.c',
                      'extensions/expat/xmltok/xmltok.c',
                      'extensions/expat/xmltok/xmlrole.c', ]
            )
     setup (name = "PyXML", version = "0.5.4",
            ext_modules =[ expat_extension ] )

Distutils ではソース配布物、バイナリ配布物の作成の面倒もみてくれます。
"sdist" コマンドは "‘python setup.py sdist’" を実行することで起動し、こ
れは ‘foo-1.0.tar.gz’ のようなソース配布物を作ります。新しいコマンドを作
るのは難しくありません。コマンド "bdist_rpm" と "bdist_wininst" が既に寄
稿されていて、各々 RPM 配布物の作成、Windows インストーラの作成を行いま
す。Debian パッケージや Solaris の ‘.pkg’ のようなほかの配布フォーマット
を作成するコマンドについての開発ステージは様々です。

これら全ては、 Python ドキュメントの基本的なセットとして追加されたマニュ
アル 'Python モジュールの配布' にドキュメントされています。


File: python.info,  Node: XML モジュール,  Next: 更新されたモジュール,  Prev: Distutils モジュールの簡単インストール,  Up: What's New in Python 2 0

1.23.13 XML モジュール
----------------------

Python 1.5.2 included a simple XML parser in the form of the ‘xmllib’
module, contributed by Sjoerd Mullender.  Since 1.5.2's release, two
different interfaces for processing XML have become common: SAX2
(version 2 of the Simple API for XML) provides an event-driven interface
with some similarities to ‘xmllib’, and the DOM (Document Object Model)
provides a tree-based interface, transforming an XML document into a
tree of nodes that can be traversed and modified.  Python 2.0 includes a
SAX2 interface and a stripped-down DOM interface as part of the *note
xml: 126. package.  Here we will give a brief overview of these new
interfaces; consult the Python documentation or the source code for
complete details.  The Python XML SIG is also working on improved
documentation.

* Menu:

* SAX2 サポート::
* DOM サポート::
* PyXML との関係::


File: python.info,  Node: SAX2 サポート,  Next: DOM サポート,  Up: XML モジュール

1.23.13.1 SAX2 サポート
.......................

SAX defines an event-driven interface for parsing XML. To use SAX, you
must write a SAX handler class.  Handler classes inherit from various
classes provided by SAX, and override various methods that will then be
called by the XML parser.  For example, the *note startElement(): 175c.
and *note endElement(): 175d. methods are called for every starting and
end tag encountered by the parser, the *note characters(): 175e. method
is called for every chunk of character data, and so forth.

イベントドリブンのアプローチはドキュメント全体をいっときにメモリに持たな
くて良い点で有利であり、ドキュメントが本当に巨大であるものを処理する際に
はこれは重要です。ですが SAX ハンドラクラスを記述することは、ドキュメン
ト構造を変更しようとする場合にはある種入り組んだものとなって、とても複雑
になりえます。

以下の小さな実例プログラムでは、全ての開始・終了タグでメッセージを印字す
るハンドラを定義して、ファイル ‘hamlet.xml’ をそのハンドラを使ってパース
しています:

     from xml import sax

     class SimpleHandler(sax.ContentHandler):
         def startElement(self, name, attrs):
             print 'Start of element:', name, attrs.keys()

         def endElement(self, name):
             print 'End of element:', name

     # Create a parser object
     parser = sax.make_parser()

     # Tell it what handler to use
     handler = SimpleHandler()
     parser.setContentHandler( handler )

     # Parse a file!
     parser.parse( 'hamlet.xml' )

For more information, consult the Python documentation, or the XML HOWTO
at ‘https://pyxml.sourceforge.net/topics/howto/xml-howto.html’.


File: python.info,  Node: DOM サポート,  Next: PyXML との関係,  Prev: SAX2 サポート,  Up: XML モジュール

1.23.13.2 DOM サポート
......................

The Document Object Model is a tree-based representation for an XML
document.  A top-level ‘Document’ instance is the root of the tree, and
has a single child which is the top-level ‘Element’ instance.  This
‘Element’ has children nodes representing character data and any
sub-elements, which may have further children of their own, and so
forth.  Using the DOM you can traverse the resulting tree any way you
like, access element and attribute values, insert and delete nodes, and
convert the tree back into XML.

DOM は XML ドキュメントを修正するのに有用です。というのも DOM ツリーは作
成出来、新規ノードを追加したりサブツリーを再編成したりすることで修正出来
、出力として新たな XML ドキュメントを生成出来るからです。DOM ツリーを手
動で構築して XML に変換することも出来ます。これにより単純に
‘<tag1>’...‘</tag1>’ をファイルに書くよりも柔軟性の高い方法で XML 出力を
生成出来ます。

The DOM implementation included with Python lives in the *note
xml.dom.minidom: 128. module.  It's a lightweight implementation of the
Level 1 DOM with support for XML namespaces.  The ‘parse()’ and
‘parseString()’ convenience functions are provided for generating a DOM
tree:

     from xml.dom import minidom
     doc = minidom.parse('hamlet.xml')

‘doc’ is a ‘Document’ instance.  ‘Document’, like all the other DOM
classes such as ‘Element’ and ‘Text’, is a subclass of the ‘Node’ base
class.  All the nodes in a DOM tree therefore support certain common
methods, such as ‘toxml()’ which returns a string containing the XML
representation of the node and its children.  Each class also has
special methods of its own; for example, ‘Element’ and ‘Document’
instances have a method to find all child elements with a given tag
name.  Continuing from the previous 2-line example:

     perslist = doc.getElementsByTagName( 'PERSONA' )
     print perslist[0].toxml()
     print perslist[1].toxml()

'Hamlet' XML ファイルに対して上の例は以下のような出力をします:

     <PERSONA>CLAUDIUS, king of Denmark. </PERSONA>
     <PERSONA>HAMLET, son to the late, and nephew to the present king.</PERSONA>

ドキュメントのルートエレメントは ‘doc.documentElement’ として取得出来、
その子は簡単に、ノードを削除したり追加したりすることで修正出来ます:

     root = doc.documentElement

     # Remove the first child
     root.removeChild( root.childNodes[0] )

     # Move the new first child to the end
     root.appendChild( root.childNodes[0] )

     # Insert the new first child (originally,
     # the third child) before the 20th child.
     root.insertBefore( root.childNodes[0], root.childNodes[20] )

Again, I will refer you to the Python documentation for a complete
listing of the different ‘Node’ classes and their various methods.


File: python.info,  Node: PyXML との関係,  Prev: DOM サポート,  Up: XML モジュール

1.23.13.3 PyXML との関係
........................

The XML Special Interest Group has been working on XML-related Python
code for a while.  Its code distribution, called PyXML, is available
from the SIG's web pages at
‘https://www.python.org/community/sigs/current/xml-sig’.  The PyXML
distribution also used the package name ‘xml’.  If you've written
programs that used PyXML, you're probably wondering about its
compatibility with the 2.0 *note xml: 126. package.

結論として、Python 2.0 の *note xml: 126. パッケージは PyXML と互換性が
ありません。ですが、直近バージョンの PyXML をインストールすることで互換
性を持たせることができます。 多くのアプリケーションは Python 2.0 に含ま
れる XML サポートで十分ですが、より複雑なアプリケーションは完全なPyXML パ
ッケージをインストールする必要があります。 インストールされた PyXML バー
ジョン 0.6.0 以上は、Python に同梱されている *note xml: 126. パッケージ
を置き換え、標準パッケージの厳密なスーパーセットとなり、多くの追加機能が
追加されます。 PyXML の追加機能には次のようなものがあります。

   * 4DOM, a full DOM implementation from FourThought, Inc.

   * The xmlproc validating parser, written by Lars Marius Garshol.

   * The ‘sgmlop’ parser accelerator module, written by Fredrik Lundh.


File: python.info,  Node: 更新されたモジュール,  Next: 新しいモジュール<2>,  Prev: XML モジュール,  Up: What's New in Python 2 0

1.23.14 更新されたモジュール
----------------------------

Lots of improvements and bugfixes were made to Python's extensive
standard library; some of the affected modules include *note readline:
bf, *note ConfigParser: 26, ‘cgi’, *note calendar: 15, *note posix: b2,
*note readline: bf, ‘xmllib’, ‘aifc’, ‘chunk’, *note wave: 119, *note
random: bd, *note shelve: c8, and ‘nntplib’.  Consult the CVS logs for
the exact patch-by-patch details.

Brian Gallew contributed OpenSSL support for the *note socket: d1.
module.  OpenSSL is an implementation of the Secure Socket Layer, which
encrypts the data being sent over a socket.  When compiling Python, you
can edit ‘Modules/Setup’ to include SSL support, which adds an
additional function to the *note socket: d1. module: ‘socket.ssl(socket,
keyfile, certfile)’, which takes a socket object and returns an SSL
socket.  The *note httplib: 72. and *note urllib: 10e. modules were also
changed to support ‘https://’ URLs, though no one has implemented FTP or
SMTP over SSL.

The *note httplib: 72. module has been rewritten by Greg Stein to
support HTTP/1.1.

Backward compatibility with the 1.5 version of ‘httplib’ is provided,
though using HTTP/1.1 features such as pipelining will require rewriting
code to use a different set of interfaces.

The ‘Tkinter’ module now supports Tcl/Tk version 8.1, 8.2, or 8.3, and
support for the older 7.x versions has been dropped.  The Tkinter module
now supports displaying Unicode strings in Tk widgets.  Also, Fredrik
Lundh contributed an optimization which makes operations like
‘create_line’ and ‘create_polygon’ much faster, especially when using
lots of coordinates.

*note curses: 2f. モジュールが、Oliver Andrich による拡張版をもとに大規
模に拡張され、ncurses と SYSV curses からの多くの追加機能、例えば色付き
の表示、別の文字集合サポート、パッド、マウスサポートなどをサポートするよ
うになりました。このことは、モジュールが BSD curses だけしか持っていない
OS とは互換性が無いことを意味しますが、現在メンテナンスされている OS で
そういう類のものは無さそうです。

2.0 の Unicode サポートについて前述したように、 *note re: be. モジュール
で提供される正規表現の根底となる実装が変更されました。SRE は新しい正規表
現エンジンで、Fredrik Lundh によって書かれ、部分的に Hewlett Packard 社
により寄贈されました。これは 8 ビット文字列と Unicode 文字列両方に合致す
るようサポートされています。


File: python.info,  Node: 新しいモジュール<2>,  Next: IDLE の改善,  Prev: 更新されたモジュール,  Up: What's New in Python 2 0

1.23.15 新しいモジュール
------------------------

数多くのモジュールが新しく追加されました。ここではそれらを短い説明ととも
に列挙するだけにします。特定のモジュールの詳細は 2.0 のドキュメントを調
べてください。

   * *note atexit: d.: Python インタプリタが終了する前に呼び出す関数を登
     録します。これまで ‘sys.exitfunc’ に直接セットしてきたコードは
     *note atexit: d. モジュールを代わりに用いるように修正してください。
     *note atexit: d. をインポートし、 *note atexit.register(): a7e. で
     終了時に呼び出す関数を登録します。(Contributed by Skip Montanaro.)

   * *note codecs: 1c, ‘encodings’, *note unicodedata: 10b.: Added as
     part of the new Unicode support.

   * *note filecmp: 5e.: Supersedes the old ‘cmp’, ‘cmpcache’ and
     ‘dircmp’ modules, which have now become deprecated.  (Contributed
     by Gordon MacMillan and Moshe Zadka.)

   * *note gettext: 67.: このモジュールは Python プログラムに、GNU
     gettext メッセージカタログライブラリへのインターフェイスを提供する
     ことで国際化 (I18N=internationalization) と地域化
     (L10N=localization) サポートをもたらします。 (Integrated by Barry
     Warsaw, from separate contributions by Martin von Löwis, Peter
     Funk, and James Henstridge.)

   * ‘linuxaudiodev’: Support for the ‘/dev/audio’ device on Linux, a
     twin to the existing ‘sunaudiodev’ module.  (Contributed by Peter
     Bosch, with fixes by Jeremy Hylton.)

   * *note mmap: 94.: Windows、Unix 両方でのメモリマップドファイルへのイ
     ンターフェイスです。ファイル内容をメモリに直接マッピング出来、それ
     は *note mutable: 15ba. な文字列であるかのように振る舞い、これによ
     り読み書き出来ます。それらは例えば *note re: be. モジュールのような
     普通は文字列を期待するような関数にさえも渡せます。(Contributed by
     Sam Rushing, with some extensions by A.M. Kuchling.)

   * ‘pyexpat’: An interface to the Expat XML parser.  (Contributed by
     Paul Prescod.)

   * *note robotparser: 113.: Parse a ‘robots.txt’ file, which is used
     for writing web spiders that politely avoid certain areas of a web
     site.  The parser accepts the contents of a ‘robots.txt’ file,
     builds a set of rules from it, and can then answer questions about
     the fetchability of a given URL. (Contributed by Skip Montanaro.)

   * *note tabnanny: e3.: Python ソースコードが曖昧なインデントになって
     いないかをチェックするモジュール/スクリプトです。 (Contributed by
     Tim Peters.)

   * ‘UserString’: A base class useful for deriving objects that behave
     like strings.

   * *note webbrowser: 11b.: 指定した URL で、プラットフォームに依存しな
     い方法でウェブブラウザを起動するモジュールです。個々のプラットフォ
     ームにおいて様々なブラウザが特定の順序で試されます。ユーザはどのブ
     ラウザを起動するかを環境変数 'BROWSER' をセットすることで変更出来ま
     す。(元々は Eric S. Raymond による *note urllib: 10e. への、同じ機
     能追加をするパッチに触発されましたが、最終的なモジュールは Fred
     Drake が元々 ‘Tools/idle/BrowserControl.py’ として実装したものに由
     来し、Fred が標準ライブラリに適合させました。)

   * *note _winreg: 11c.: An interface to the Windows registry.
     ‘_winreg’ is an adaptation of functions that have been part of
     PythonWin since 1995, but has now been added to the core
     distribution, and enhanced to support Unicode.  ‘_winreg’ was
     written by Bill Tutt and Mark Hammond.

   * *note zipfile: 137.: ZIP 形式アーカイブの読み書きのためのモジュール
     です。DOS/Windows での ‘PKZIP’ や Unix での ‘zip’ により生成される
     アーカイブで、 ‘gzip’ 形式とは混同しないで下さい (こちらは *note
     gzip: 6b. モジュールによってサポートされています)。(Contributed by
     James C. Ahlstrom.)

   * ‘imputil’: A module that provides a simpler way for writing
     customized import hooks, in comparison to the existing ‘ihooks’
     module.  (Implemented by Greg Stein, with much discussion on
     python-dev along the way.)


File: python.info,  Node: IDLE の改善,  Next: 削除されたモジュール、非推奨となったモジュール,  Prev: 新しいモジュール<2>,  Up: What's New in Python 2 0

1.23.16 IDLE の改善
-------------------

IDLE は公式の Python のクロスプラットフォームな IDE で、 Tkinter を使っ
て書かれています。Python 2.0 では IDLE 0.6 を含めました。これは多くの新
機能追加と改善がなされています。以下はその一部です:

   * UI の、特にシンタックスハイライトと自動インデントの領域において、改
     善と最適化がなされました。

   * クラスブラウザで、例えばモジュール内のトップレベル関数のような、よ
     り多くの情報をみることが出来るようになりました。

   * タブ幅をユーザ制御出来るようになりました。既存の Python ファイルを
     操作する際には、IDLE は自動的にインデントの慣習を検知してそれに合わ
     せます。

   * 色々なプラットフォームでブラウザの呼び出しがサポートされています。
     これを使って、ブラウザで Python ドキュメントを開きます。

   * IDLE がコマンドラインを持つようになりました。これは普通の Python イ
     ンタプリタに大きく似せてあります。

   * 色々な場所でコンテキストヘルプが出るようになっています。

   * IDLE は今ではパッケージとしてインストール出来ます。

   * エディタウィンドウ内では、下部に行/桁を表示するようになっています。

   * 新たな 3 つのキーストロークコマンド: モジュールのチェック
     (‘Alt’-‘F5’)、モジュールのインポート (‘F5’)、スクリプト実行
     (‘Ctrl’-‘F5’).


File: python.info,  Node: 削除されたモジュール、非推奨となったモジュール,  Next: 謝辞<8>,  Prev: IDLE の改善,  Up: What's New in Python 2 0

1.23.17 削除されたモジュール、非推奨となったモジュール
------------------------------------------------------

A few modules have been dropped because they're obsolete, or because
there are now better ways to do the same thing.  The ‘stdwin’ module is
gone; it was for a platform-independent windowing toolkit that's no
longer developed.

A number of modules have been moved to the ‘lib-old’ subdirectory:
‘cmp’, ‘cmpcache’, ‘dircmp’, ‘dump’, ‘find’, ‘grep’, ‘packmail’, ‘poly’,
‘util’, ‘whatsound’, ‘zmod’.  If you have code which relies on a module
that's been moved to ‘lib-old’, you can simply add that directory to
‘sys.path’ to get them back, but you're encouraged to update any code
that uses these modules.


File: python.info,  Node: 謝辞<8>,  Prev: 削除されたモジュール、非推奨となったモジュール,  Up: What's New in Python 2 0

1.23.18 謝辞
------------

著者は提案の申し出や修正、様々なこの記事の草稿の助けをしてくれた以下の人
々に感謝します: David Bolen, Mark Hammond, Gregg Hauser, Jeremy Hylton,
Fredrik Lundh, Detlef Lannert, Aahz Maruch, Skip Montanaro, Vladimir
Marangozov, Tobias Polzin, Guido van Rossum, Neil Schemenauer, and Russ
Schmidt.

"変更履歴" は、 Misc/NEWS.d(1) ディレクトリ以下の内容から ビルドされたフ
ァイル(2) の HTML 版で、現在のバージョンの Python への 'すべての' 重要な
変更が載っています。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Misc/NEWS.d

   (2) https://pypi.org/project/blurb/


File: python.info,  Node: 変更履歴,  Prev: What's New in Python 2 0,  Up: What's New in Python

1.24 変更履歴
=============

* Menu:

* Python next::
* Python 3.14.3 final: Python 3 14 3 final.
* Python 3.14.2 final: Python 3 14 2 final.
* Python 3.14.1 final: Python 3 14 1 final.
* Python 3.14.0 final: Python 3 14 0 final.
* Python 3.14.0 release candidate 3: Python 3 14 0 release candidate 3.
* Python 3.14.0 release candidate 2: Python 3 14 0 release candidate 2.
* Python 3.14.0 release candidate 1: Python 3 14 0 release candidate 1.
* Python 3.14.0 beta 4: Python 3 14 0 beta 4.
* Python 3.14.0 beta 3: Python 3 14 0 beta 3.
* Python 3.14.0 beta 2: Python 3 14 0 beta 2.
* Python 3.14.0 beta 1: Python 3 14 0 beta 1.
* Python 3.14.0 alpha 7: Python 3 14 0 alpha 7.
* Python 3.14.0 alpha 6: Python 3 14 0 alpha 6.
* Python 3.14.0 alpha 5: Python 3 14 0 alpha 5.
* Python 3.14.0 alpha 4: Python 3 14 0 alpha 4.
* Python 3.14.0 alpha 3: Python 3 14 0 alpha 3.
* Python 3.14.0 alpha 2: Python 3 14 0 alpha 2.
* Python 3.14.0 alpha 1: Python 3 14 0 alpha 1.
* Python 3.13.0 beta 1: Python 3 13 0 beta 1.
* Python 3.13.0 alpha 6: Python 3 13 0 alpha 6.
* Python 3.13.0 alpha 5: Python 3 13 0 alpha 5.
* Python 3.13.0 alpha 4: Python 3 13 0 alpha 4.
* Python 3.13.0 alpha 3: Python 3 13 0 alpha 3.
* Python 3.13.0 alpha 2: Python 3 13 0 alpha 2.
* Python 3.13.0 alpha 1: Python 3 13 0 alpha 1.
* Python 3.12.0 beta 1: Python 3 12 0 beta 1.
* Python 3.12.0 alpha 7: Python 3 12 0 alpha 7.
* Python 3.12.0 alpha 6: Python 3 12 0 alpha 6.
* Python 3.12.0 alpha 5: Python 3 12 0 alpha 5.
* Python 3.12.0 alpha 4: Python 3 12 0 alpha 4.
* Python 3.12.0 alpha 3: Python 3 12 0 alpha 3.
* Python 3.12.0 alpha 2: Python 3 12 0 alpha 2.
* Python 3.12.0 alpha 1: Python 3 12 0 alpha 1.
* Python 3.11.0 beta 1: Python 3 11 0 beta 1.
* Python 3.11.0 alpha 7: Python 3 11 0 alpha 7.
* Python 3.11.0 alpha 6: Python 3 11 0 alpha 6.
* Python 3.11.0 alpha 5: Python 3 11 0 alpha 5.
* Python 3.11.0 alpha 4: Python 3 11 0 alpha 4.
* Python 3.11.0 alpha 3: Python 3 11 0 alpha 3.
* Python 3.11.0 alpha 2: Python 3 11 0 alpha 2.
* Python 3.11.0 alpha 1: Python 3 11 0 alpha 1.
* Python 3.10.0 beta 1: Python 3 10 0 beta 1.
* Python 3.10.0 alpha 7: Python 3 10 0 alpha 7.
* Python 3.10.0 alpha 6: Python 3 10 0 alpha 6.
* Python 3.10.0 alpha 5: Python 3 10 0 alpha 5.
* Python 3.10.0 alpha 4: Python 3 10 0 alpha 4.
* Python 3.10.0 alpha 3: Python 3 10 0 alpha 3.
* Python 3.10.0 alpha 2: Python 3 10 0 alpha 2.
* Python 3.10.0 alpha 1: Python 3 10 0 alpha 1.
* Python 3.9.0 beta 1: Python 3 9 0 beta 1.
* Python 3.9.0 alpha 6: Python 3 9 0 alpha 6.
* Python 3.9.0 alpha 5: Python 3 9 0 alpha 5.
* Python 3.9.0 alpha 4: Python 3 9 0 alpha 4.
* Python 3.9.0 alpha 3: Python 3 9 0 alpha 3.
* Python 3.9.0 alpha 2: Python 3 9 0 alpha 2.
* Python 3.9.0 alpha 1: Python 3 9 0 alpha 1.
* Python 3.8.0 beta 1: Python 3 8 0 beta 1.
* Python 3.8.0 alpha 4: Python 3 8 0 alpha 4.
* Python 3.8.0 alpha 3: Python 3 8 0 alpha 3.
* Python 3.8.0 alpha 2: Python 3 8 0 alpha 2.
* Python 3.8.0 alpha 1: Python 3 8 0 alpha 1.
* Python 3.7.0 final: Python 3 7 0 final.
* Python 3.7.0 release candidate 1: Python 3 7 0 release candidate 1.
* Python 3.7.0 beta 5: Python 3 7 0 beta 5.
* Python 3.7.0 beta 4: Python 3 7 0 beta 4.
* Python 3.7.0 beta 3: Python 3 7 0 beta 3.
* Python 3.7.0 beta 2: Python 3 7 0 beta 2.
* Python 3.7.0 beta 1: Python 3 7 0 beta 1.
* Python 3.7.0 alpha 4: Python 3 7 0 alpha 4.
* Python 3.7.0 alpha 3: Python 3 7 0 alpha 3.
* Python 3.7.0 alpha 2: Python 3 7 0 alpha 2.
* Python 3.7.0 alpha 1: Python 3 7 0 alpha 1.
* Python 3.6.6 final: Python 3 6 6 final.
* Python 3.6.6 release candidate 1: Python 3 6 6 release candidate 1.
* Python 3.6.5 final: Python 3 6 5 final.
* Python 3.6.5 release candidate 1: Python 3 6 5 release candidate 1.
* Python 3.6.4 final: Python 3 6 4 final.
* Python 3.6.4 release candidate 1: Python 3 6 4 release candidate 1.
* Python 3.6.3 final: Python 3 6 3 final.
* Python 3.6.3 release candidate 1: Python 3 6 3 release candidate 1.
* Python 3.6.2 final: Python 3 6 2 final.
* Python 3.6.2 release candidate 2: Python 3 6 2 release candidate 2.
* Python 3.6.2 release candidate 1: Python 3 6 2 release candidate 1.
* Python 3.6.1 final: Python 3 6 1 final.
* Python 3.6.1 release candidate 1: Python 3 6 1 release candidate 1.
* Python 3.6.0 final: Python 3 6 0 final.
* Python 3.6.0 release candidate 2: Python 3 6 0 release candidate 2.
* Python 3.6.0 release candidate 1: Python 3 6 0 release candidate 1.
* Python 3.6.0 beta 4: Python 3 6 0 beta 4.
* Python 3.6.0 beta 3: Python 3 6 0 beta 3.
* Python 3.6.0 beta 2: Python 3 6 0 beta 2.
* Python 3.6.0 beta 1: Python 3 6 0 beta 1.
* Python 3.6.0 alpha 4: Python 3 6 0 alpha 4.
* Python 3.6.0 alpha 3: Python 3 6 0 alpha 3.
* Python 3.6.0 alpha 2: Python 3 6 0 alpha 2.
* Python 3.6.0 alpha 1: Python 3 6 0 alpha 1.
* Python 3.5.5 final: Python 3 5 5 final.
* Python 3.5.5 release candidate 1: Python 3 5 5 release candidate 1.
* Python 3.5.4 final: Python 3 5 4 final.
* Python 3.5.4 release candidate 1: Python 3 5 4 release candidate 1.
* Python 3.5.3 final: Python 3 5 3 final.
* Python 3.5.3 release candidate 1: Python 3 5 3 release candidate 1.
* Python 3.5.2 final: Python 3 5 2 final.
* Python 3.5.2 release candidate 1: Python 3 5 2 release candidate 1.
* Python 3.5.1 final: Python 3 5 1 final.
* Python 3.5.1 release candidate 1: Python 3 5 1 release candidate 1.
* Python 3.5.0 final: Python 3 5 0 final.
* Python 3.5.0 release candidate 4: Python 3 5 0 release candidate 4.
* Python 3.5.0 release candidate 3: Python 3 5 0 release candidate 3.
* Python 3.5.0 release candidate 2: Python 3 5 0 release candidate 2.
* Python 3.5.0 release candidate 1: Python 3 5 0 release candidate 1.
* Python 3.5.0 beta 4: Python 3 5 0 beta 4.
* Python 3.5.0 beta 3: Python 3 5 0 beta 3.
* Python 3.5.0 beta 2: Python 3 5 0 beta 2.
* Python 3.5.0 beta 1: Python 3 5 0 beta 1.
* Python 3.5.0 alpha 4: Python 3 5 0 alpha 4.
* Python 3.5.0 alpha 3: Python 3 5 0 alpha 3.
* Python 3.5.0 alpha 2: Python 3 5 0 alpha 2.
* Python 3.5.0 alpha 1: Python 3 5 0 alpha 1.


File: python.info,  Node: Python next,  Next: Python 3 14 3 final,  Up: 変更履歴

1.24.1 Python next
------------------

'Release date: XXXX-XX-XX'

* Menu:

* macOS::
* Windows::
* ライブラリ::
* ドキュメント: ドキュメント<2>.
* Core and Builtins::


File: python.info,  Node: macOS,  Next: Windows,  Up: Python next

1.24.1.1 macOS
..............

   - gh-144551(1): Update macOS installer to use OpenSSL 3.0.19.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144551


File: python.info,  Node: Windows,  Next: ライブラリ,  Prev: macOS,  Up: Python next

1.24.1.2 Windows
................

   - gh-144551(1): Updated bundled version of OpenSSL to 3.0.19.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144551


File: python.info,  Node: ライブラリ,  Next: ドキュメント<2>,  Prev: Windows,  Up: Python next

1.24.1.3 ライブラリ
...................

   - gh-144833(1): Fixed a use-after-free in *note ssl: d5. when
     ‘SSL_new()’ returns NULL in ‘newPySSLSocket()’.  The error was
     reported via a dangling pointer after the object had already been
     freed.

   - gh-144782(2): Fix *note argparse.ArgumentParser: 1bd. to be *note
     pickleable: ab.

   - gh-144538(3): Bump the version of pip bundled in ensurepip to
     version 26.0.1

   - gh-144494(4): Fix performance regression in *note
     asyncio.all_tasks(): b4f. on *note free-threaded builds: 176d.
     Patch by Kumar Aditya.

   - gh-144363(5): Update bundled libexpat(6) to 2.7.4

   - gh-143637(7): Fixed a crash in socket.sendmsg() that could occur if
     ancillary data is mutated re-entrantly during argument parsing.

   - gh-143543(8): Fix a crash in itertools.groupby that could occur
     when a user-defined *note __eq__(): cf2. method re-enters the
     iterator during key comparison.

   - gh-140652(9): Fix a crash in ‘_interpchannels.list_all()’ after
     closing a channel.

   - gh-80667(10): Support lookup for Tangut Ideographs in *note
     unicodedata: 10b.

   - bpo-40243(11): Fix ‘unicodedata.ucd_3_2_0.numeric()’ for
     non-decimal values.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144833

   (2) https://github.com/python/cpython/issues/144782

   (3) https://github.com/python/cpython/issues/144538

   (4) https://github.com/python/cpython/issues/144494

   (5) https://github.com/python/cpython/issues/144363

   (6) https://libexpat.github.io/

   (7) https://github.com/python/cpython/issues/143637

   (8) https://github.com/python/cpython/issues/143543

   (9) https://github.com/python/cpython/issues/140652

   (10) https://github.com/python/cpython/issues/80667

   (11) https://bugs.python.org/issue?@action=redirect&bpo=40243


File: python.info,  Node: ドキュメント<2>,  Next: Core and Builtins,  Prev: ライブラリ,  Up: Python next

1.24.1.4 ドキュメント
.....................

   - gh-136246(1): A new "Improve this page" link is available in the
     left-hand sidebar of the docs, offering links to create GitHub
     issues, discussion forum posts, or pull requests.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/136246


File: python.info,  Node: Core and Builtins,  Prev: ドキュメント<2>,  Up: Python next

1.24.1.5 Core and Builtins
..........................

   - gh-144766(1): Fix a crash in fork child process when perf support
     is enabled.

   - gh-144759(2): Fix undefined behavior in the lexer when ‘start’ and
     ‘multi_line_start’ pointers are ‘NULL’ in
     ‘_PyLexer_remember_fstring_buffers()’ and
     ‘_PyLexer_restore_fstring_buffers()’.  The ‘NULL’ pointer
     arithmetic (‘NULL - valid_pointer’) is now guarded with explicit
     ‘NULL’ checks.

   - gh-144563(3): Fix interaction of the Tachyon profiler and *note
     ctypes: 2e. and other modules that load the Python shared library
     (if present) in an independent map as this was causing the
     mechanism that loads the binary information to be confused.  Patch
     by Pablo Galindo

   - gh-144601(4): Fix crash when importing a module whose ‘PyInit’
     function raises an exception from a subinterpreter.

   - gh-144446(5): Fix data races in the free-threaded build when
     reading frame object attributes while another thread is executing
     the frame.

   - gh-143650(6): Fix race condition in *note importlib: 7b. where a
     thread could receive a stale module reference when another thread's
     import fails.

   - gh-80667(7): Literals using the ‘\N{name}’ escape syntax can now
     construct CJK ideographs and Hangul syllables using
     case-insensitive names.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144766

   (2) https://github.com/python/cpython/issues/144759

   (3) https://github.com/python/cpython/issues/144563

   (4) https://github.com/python/cpython/issues/144601

   (5) https://github.com/python/cpython/issues/144446

   (6) https://github.com/python/cpython/issues/143650

   (7) https://github.com/python/cpython/issues/80667


File: python.info,  Node: Python 3 14 3 final,  Next: Python 3 14 2 final,  Prev: Python next,  Up: 変更履歴

1.24.2 Python 3.14.3 final
--------------------------

'Release date: 2026-02-03'

* Menu:

* Windows: Windows<2>.
* Tools/Demos::
* テスト::
* セキュリティ::
* ライブラリ: ライブラリ<2>.
* IDLE: IDLE<3>.
* ドキュメント: ドキュメント<3>.
* Core and Builtins: Core and Builtins<2>.
* C API::
* ビルド::


File: python.info,  Node: Windows<2>,  Next: Tools/Demos,  Up: Python 3 14 3 final

1.24.2.1 Windows
................

   - gh-128067(1): Fix a bug in PyREPL on Windows where output without a
     trailing newline was overwritten by the next prompt.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128067


File: python.info,  Node: Tools/Demos,  Next: テスト,  Prev: Windows<2>,  Up: Python 3 14 3 final

1.24.2.2 Tools/Demos
....................

   - gh-142095(1): Make gdb 'py-bt' command use frame from thread local
     state when available.  Patch by Sam Gross and Victor Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142095


File: python.info,  Node: テスト,  Next: セキュリティ,  Prev: Tools/Demos,  Up: Python 3 14 3 final

1.24.2.3 テスト
...............

   - gh-144415(1): The Android testbed now distinguishes between
     stdout/stderr messages which were triggered by a newline, and those
     triggered by a manual call to ‘flush’.  This fixes logging of
     progress indicators and similar content.

   - gh-143460(2): Skip tests relying on infinite recusion if stack size
     is unlimited.

   - gh-65784(3): Add support for parametrized resource ‘wantobjects’ in
     regrtests, which allows to run Tkinter tests with the specified
     value of ‘tkinter.wantobjects’, for example ‘-u wantobjects=0’.

   - gh-143553(4): Add support for parametrized resources, such as ‘-u
     xpickle=2.7’.

   - gh-142836(5): Accommodated Solaris in
     ‘test_pdb.test_script_target_anonymous_pipe’.

   - bpo-31391(6): Forward-port test_xpickle from Python 2 to Python 3
     and add the resource back to test's command line.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144415

   (2) https://github.com/python/cpython/issues/143460

   (3) https://github.com/python/cpython/issues/65784

   (4) https://github.com/python/cpython/issues/143553

   (5) https://github.com/python/cpython/issues/142836

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31391


File: python.info,  Node: セキュリティ,  Next: ライブラリ<2>,  Prev: テスト,  Up: Python 3 14 3 final

1.24.2.4 セキュリティ
.....................

   - gh-144125(1): *note BytesGenerator: 13e7. will now refuse to
     serialize (write) headers that are unsafely folded or delimited;
     see *note verify_generated_headers: 4f2.  (Contributed by Bas
     Bloemsaat and Petr Viktorin in gh-121650(2)).

   - gh-143935(3): Fixed a bug in the folding of comments when
     flattening an email message using a modern email policy.  Comments
     consisting of a very long sequence of non-foldable characters could
     trigger a forced line wrap that omitted the required leading space
     on the continuation line, causing the remainder of the comment to
     be interpreted as a new header field.  This enabled header
     injection with carefully crafted inputs.

   - gh-143925(4): Reject control characters in ‘data:’ URL media types.

   - gh-143919(5): Reject control characters in *note
     http.cookies.Morsel: dfe. fields and values.

   - gh-143916(6): Reject C0 control characters within
     wsgiref.headers.Headers fields, values, and parameters.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144125

   (2) https://github.com/python/cpython/issues/121650

   (3) https://github.com/python/cpython/issues/143935

   (4) https://github.com/python/cpython/issues/143925

   (5) https://github.com/python/cpython/issues/143919

   (6) https://github.com/python/cpython/issues/143916


File: python.info,  Node: ライブラリ<2>,  Next: IDLE<3>,  Prev: セキュリティ,  Up: Python 3 14 3 final

1.24.2.5 ライブラリ
...................

   - gh-144380(1): Improve performance of *note io.BufferedReader: 1427.
     line iteration by ~49%.

   - gh-144169(2): Fix three crashes when non-string keyword arguments
     are supplied to objects in the *note ast: 9. module.

   - gh-144100(3): Fixed a crash in ctypes when using a deprecated
     ‘POINTER(str)’ type in ‘argtypes’.  Instead of aborting, ctypes now
     raises a proper Python exception when the pointer target type is
     unresolved.

   - gh-144050(4): Fix *note stat.filemode(): 1363. in the pure-Python
     implementation to avoid misclassifying invalid mode values as block
     devices.

   - gh-144023(5): Fixed validation of file descriptor 0 in posix
     functions when used with follow_symlinks parameter.

   - gh-143999(6): Fix an issue where *note inspect.getgeneratorstate():
     144e. and *note inspect.getcoroutinestate(): 101a. could fail for
     generators wrapped by *note types.coroutine(): 1088. in the
     suspended state.

   - gh-143831(7): *note annotationlib.ForwardRef: 1776. objects are now
     hashable when created from annotation scopes with closures.
     Previously, hashing such objects would throw an exception.  Patch
     by Bartosz Sławecki.

   - gh-143874(8): Fixed a bug in *note pdb: aa. where expression
     results were not sent back to remote client.

   - gh-143880(9): Fix data race in *note functools.partial(): 217. in
     the *note free threading: 1f4. build.

   - gh-143706(10): Fix *note multiprocessing: 98. forkserver so that
     *note sys.argv: 147c. is correctly set before ‘__main__’ is
     preloaded.  Previously, *note sys.argv: 147c. was empty during main
     module import in forkserver child processes.  This fixes a
     regression introduced in 3.13.8 and 3.14.1.  Root caused by Aaron
     Wieczorek, test provided by Thomas Watson, thanks!

   - gh-143638(11): Forbid reentrant calls of the *note pickle.Pickler:
     c13. and *note pickle.Unpickler: 1777. methods for the C
     implementation.  Previously, this could cause crash or data
     corruption, now concurrent calls of methods of the same object
     raise *note RuntimeError: 244.

   - gh-78724(12): Raise *note RuntimeError: 244.'s when user attempts
     to call methods on half-initialized *note Struct: 1778. objects,
     For example, created by ‘Struct.__new__(Struct)’.  Patch by Sergey
     B Kirpichev.

   - gh-143196(13): Fix crash when the internal encoder object returned
     by undocumented function ‘json.encoder.c_make_encoder()’ was called
     with non-zero second ('_current_indent_level') argument.

   - gh-143191(14): *note _thread.stack_size(): 1779. now raises *note
     ValueError: 2ec. if the stack size is too small.  Patch by Victor
     Stinner.

   - gh-143602(15): Fix a inconsistency issue in *note write(): 15c5.
     that leads to unexpected buffer overwrite by deduplicating the
     buffer exports.

   - gh-143547(16): Fix *note sys.unraisablehook(): 507. when the hook
     raises an exception and changes *note sys.unraisablehook(): 507.:
     hold a strong reference to the old hook.  Patch by Victor Stinner.

   - gh-143517(17): *note annotationlib.get_annotations(): 459. no
     longer raises a *note SyntaxError: 18e. when evaluating a
     stringified starred annotation that starts with one or more
     whitespace characters followed by a ‘*’.  Patch by Bartosz
     Sławecki.

   - gh-143378(18): Fix use-after-free crashes when a *note BytesIO:
     10a4. object is concurrently mutated during *note write(): 15c5. or
     *note writelines(): 177a.

   - gh-143346(19): Fix incorrect wrapping of the Base64 data in
     ‘plistlib._PlistWriter’ when the indent contains a mix of tabs and
     spaces.

   - gh-143310(20): *note tkinter: f6.: fix a crash when a Python *note
     list: 24d. is mutated during the conversion to a Tcl object (e.g.,
     when setting a Tcl variable).  Patch by Bénédikt Tran.

   - gh-143309(21): Fix a crash in *note os.execve(): 1311. on
     non-Windows platforms when given a custom environment mapping which
     is then mutated during parsing.  Patch by Bénédikt Tran.

   - gh-143308(22): *note pickle: ab.: fix use-after-free crashes when a
     *note PickleBuffer: 177b. is concurrently mutated by a custom
     buffer callback during pickling.  Patch by Bénédikt Tran and Aaron
     Wieczorek.

   - gh-143237(23): Fix support of named pipes in the rotating *note
     logging: 8b. handlers.

   - gh-143249(24): Fix possible buffer leaks in Windows overlapped I/O
     on error handling.

   - gh-143241(25): *note zoneinfo: 13a.: fix infinite loop in *note
     ZoneInfo.from_file: 177c. when parsing a malformed TZif file.
     Patch by Fatih Celik.

   - gh-142830(26): *note sqlite3: d4.: fix use-after-free crashes when
     the connection's callbacks are mutated during a callback execution.
     Patch by Bénédikt Tran.

   - gh-143200(27): *note xml.etree.ElementTree: 12b.: fix
     use-after-free crashes in *note __getitem__(): 588. and *note
     __setitem__(): 14e3. methods of *note Element: 363. when the
     element is concurrently mutated.  Patch by Bénédikt Tran.

   - gh-142195(28): Updated timeout evaluation logic in *note
     subprocess: dc. to be compatible with deterministic environments
     like Shadow where time moves exactly as requested.

   - gh-142164(29): Fix the ctypes bitfield overflow error message to
     report the correct offset and size calculation.

   - gh-143145(30): Fixed a possible reference leak in ctypes when
     constructing results with multiple output parameters on error.

   - gh-122431(31): Corrected the error message in *note
     readline.append_history_file(): 1051. to state that ‘nelements’
     must be non-negative instead of positive.

   - gh-143004(32): Fix a potential use-after-free in *note
     collections.Counter.update(): 177d. when user code mutates the
     Counter during an update.

   - gh-143046(33): The *note asyncio: b. REPL no longer prints
     copyright and version messages in the quiet mode (*note -q: 177e.).
     Patch by Bartosz Sławecki.

   - gh-140648(34): The *note asyncio: b. REPL now respects the *note
     -I: b57. flag (isolated mode).  Previously, it would load and
     execute *note PYTHONSTARTUP: 1b8. even if the flag was set.
     Contributed by Bartosz Sławecki.

   - gh-142991(35): Fixed socket operations such as recvfrom() and
     sendto() for FreeBSD divert(4) socket.

   - gh-143010(36): Fixed a bug in *note mailbox: 8f. where the precise
     timing of an external event could result in the library opening an
     existing file instead of a file it expected to create.

   - gh-142881(37): Fix concurrent and reentrant call of *note
     atexit.unregister(): 177f.

   - gh-112127(38): Fix possible use-after-free in *note
     atexit.unregister(): 177f. when the callback is unregistered during
     comparison.

   - gh-142783(39): Fix zoneinfo use-after-free with descriptor
     _weak_cache.  a descriptor as _weak_cache could cause crashes
     during object creation.  The fix ensures proper reference counting
     for descriptor-provided objects.

   - gh-142754(40): Add the 'ownerDocument' attribute to *note
     xml.dom.minidom: 128. elements and attributes created by directly
     instantiating the ‘Element’ or ‘Attr’ class.  Note that this way of
     creating nodes is not supported; creator functions like *note
     xml.dom.Document.documentElement(): 1780. should be used instead.

   - gh-142784(41): The *note asyncio: b. REPL now properly closes the
     loop upon the end of interactive session.  Previously, it could
     cause surprising warnings.  Contributed by Bartosz Sławecki.

   - gh-142555(42): *note array: 8.: fix a crash in ‘a[i] = v’ when
     converting 'i' to an index via *note i.__index__: 19e. or *note
     i.__float__: bc1. mutates the array.

   - gh-142594(43): Fix crash in ‘TextIOWrapper.close()’ when the
     underlying buffer's ‘closed’ property calls *note detach(): 1781.

   - gh-142451(44): *note hmac: 6e.: Ensure that the *note
     HMAC.block_size: 114c. attribute is correctly copied by *note
     HMAC.copy: 1782.  Patch by Bénédikt Tran.

   - gh-142495(45): *note collections.defaultdict: 13d4. now prioritizes
     *note __setitem__(): 14e3. when inserting default values from
     ‘default_factory’.  This prevents race conditions where a default
     value would overwrite a value set before ‘default_factory’ returns.

   - gh-142651(46): *note unittest.mock: 10d.: fix a thread safety issue
     where *note Mock.call_count: 1783. may return inaccurate values
     when the mock is called concurrently from multiple threads.

   - gh-142595(47): Added type check during initialization of the *note
     decimal: 3a. module to prevent a crash in case of broken stdlib.
     Patch by Sergey B Kirpichev.

   - gh-142556(48): Fix crash when a task gets re-registered during
     finalization in *note asyncio: b.  Patch by Kumar Aditya.

   - gh-123241(49): Avoid reference count operations in garbage
     collection of *note ctypes: 2e. objects.

   - gh-142517(50): The non-‘compat32’ *note email: 3f. policies now
     correctly handle refolding encoded words that contain bytes that
     can not be decoded in their specified character set.  Previously
     this resulted in an encoding exception during folding.

   - gh-112527(51): The help text for required options in *note
     argparse: 7. no longer extended with " (default: None)".

   - gh-142346(52): Fix usage formatting for mutually exclusive groups
     in *note argparse: 7. when they are preceded by positional
     arguments or followed or intermixed with other optional arguments.

   - gh-142315(53): Pdb can now run scripts from anonymous pipes used in
     process substitution.  Patch by Bartosz Sławecki.

   - gh-142332(54): Fix usage formatting for positional arguments in
     mutually exclusive groups in *note argparse: 7.  in *note argparse:
     7.

   - gh-142282(55): Fix *note winreg.QueryValueEx(): 1784. to not
     accidentally read garbage buffer under race condition.

   - gh-75949(56): Fix *note argparse: 7. to preserve ‘|’ separators in
     mutually exclusive groups when the usage line wraps due to length.

   - gh-142267(57): Improve *note argparse: 7. performance by caching
     the formatter used for argument validation.

   - gh-68552(58): ‘MisplacedEnvelopeHeaderDefect’ and ‘Missing header
     name’ defects are now correctly passed to the ‘handle_defect’
     method of ‘policy’ in *note FeedParser: 1785.

   - gh-142006(59): Fix a bug in the *note email.policy.default: 12cc.
     folding algorithm which incorrectly resulted in a doubled newline
     when a line ending at exactly max_line_length was followed by an
     unfoldable token.

   - gh-105836(60): Fix *note asyncio.run_coroutine_threadsafe(): a82.
     leaving underlying cancelled asyncio task running.

   - gh-139971(61): *note pydoc: ba.: Ensure that the link to the online
     documentation of a *note stdlib: 1786. module is correct.

   - gh-139262(62): Some keystrokes can be swallowed in the new ‘PyREPL’
     on Windows, especially when used together with the ALT key.  Fix by
     Chris Eibl.

   - gh-138897(63): Improved *note license: 1787./*note copyright:
     1788./*note credits: 1789. display in the *note REPL: 491.: now
     uses a pager.

   - gh-79986(64): Add parsing for ‘References’ and ‘In-Reply-To’
     headers to the *note email: 3f. library that parses the header
     content as lists of message id tokens.  This prevents them from
     being folded incorrectly.

   - gh-136282(65): Add support for *note UNNAMED_SECTION: 178a. when
     creating a section via the mapping protocol access

   - gh-109263(66): Starting a process from spawn context in *note
     multiprocessing: 98. no longer sets the start method globally.

   - gh-133253(67): Fix thread-safety issues in *note linecache: 89.

   - gh-132715(68): Skip writing objects during marshalling once a
     failure has occurred.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144380

   (2) https://github.com/python/cpython/issues/144169

   (3) https://github.com/python/cpython/issues/144100

   (4) https://github.com/python/cpython/issues/144050

   (5) https://github.com/python/cpython/issues/144023

   (6) https://github.com/python/cpython/issues/143999

   (7) https://github.com/python/cpython/issues/143831

   (8) https://github.com/python/cpython/issues/143874

   (9) https://github.com/python/cpython/issues/143880

   (10) https://github.com/python/cpython/issues/143706

   (11) https://github.com/python/cpython/issues/143638

   (12) https://github.com/python/cpython/issues/78724

   (13) https://github.com/python/cpython/issues/143196

   (14) https://github.com/python/cpython/issues/143191

   (15) https://github.com/python/cpython/issues/143602

   (16) https://github.com/python/cpython/issues/143547

   (17) https://github.com/python/cpython/issues/143517

   (18) https://github.com/python/cpython/issues/143378

   (19) https://github.com/python/cpython/issues/143346

   (20) https://github.com/python/cpython/issues/143310

   (21) https://github.com/python/cpython/issues/143309

   (22) https://github.com/python/cpython/issues/143308

   (23) https://github.com/python/cpython/issues/143237

   (24) https://github.com/python/cpython/issues/143249

   (25) https://github.com/python/cpython/issues/143241

   (26) https://github.com/python/cpython/issues/142830

   (27) https://github.com/python/cpython/issues/143200

   (28) https://github.com/python/cpython/issues/142195

   (29) https://github.com/python/cpython/issues/142164

   (30) https://github.com/python/cpython/issues/143145

   (31) https://github.com/python/cpython/issues/122431

   (32) https://github.com/python/cpython/issues/143004

   (33) https://github.com/python/cpython/issues/143046

   (34) https://github.com/python/cpython/issues/140648

   (35) https://github.com/python/cpython/issues/142991

   (36) https://github.com/python/cpython/issues/143010

   (37) https://github.com/python/cpython/issues/142881

   (38) https://github.com/python/cpython/issues/112127

   (39) https://github.com/python/cpython/issues/142783

   (40) https://github.com/python/cpython/issues/142754

   (41) https://github.com/python/cpython/issues/142784

   (42) https://github.com/python/cpython/issues/142555

   (43) https://github.com/python/cpython/issues/142594

   (44) https://github.com/python/cpython/issues/142451

   (45) https://github.com/python/cpython/issues/142495

   (46) https://github.com/python/cpython/issues/142651

   (47) https://github.com/python/cpython/issues/142595

   (48) https://github.com/python/cpython/issues/142556

   (49) https://github.com/python/cpython/issues/123241

   (50) https://github.com/python/cpython/issues/142517

   (51) https://github.com/python/cpython/issues/112527

   (52) https://github.com/python/cpython/issues/142346

   (53) https://github.com/python/cpython/issues/142315

   (54) https://github.com/python/cpython/issues/142332

   (55) https://github.com/python/cpython/issues/142282

   (56) https://github.com/python/cpython/issues/75949

   (57) https://github.com/python/cpython/issues/142267

   (58) https://github.com/python/cpython/issues/68552

   (59) https://github.com/python/cpython/issues/142006

   (60) https://github.com/python/cpython/issues/105836

   (61) https://github.com/python/cpython/issues/139971

   (62) https://github.com/python/cpython/issues/139262

   (63) https://github.com/python/cpython/issues/138897

   (64) https://github.com/python/cpython/issues/79986

   (65) https://github.com/python/cpython/issues/136282

   (66) https://github.com/python/cpython/issues/109263

   (67) https://github.com/python/cpython/issues/133253

   (68) https://github.com/python/cpython/issues/132715


File: python.info,  Node: IDLE<3>,  Next: ドキュメント<3>,  Prev: ライブラリ<2>,  Up: Python 3 14 3 final

1.24.2.6 IDLE
.............

   - gh-143774(1): Better explain the operation of Format / Format
     Paragraph.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/143774


File: python.info,  Node: ドキュメント<3>,  Next: Core and Builtins<2>,  Prev: IDLE<3>,  Up: Python 3 14 3 final

1.24.2.7 ドキュメント
.....................

   - gh-140806(1): Add documentation for *note enum.bin(): 178d.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140806


File: python.info,  Node: Core and Builtins<2>,  Next: C API,  Prev: ドキュメント<3>,  Up: Python 3 14 3 final

1.24.2.8 Core and Builtins
..........................

   - gh-144307(1): Prevent a reference leak in module teardown at
     interpreter finalization.

   - gh-144194(2): Fix error handling in perf jitdump initialization on
     memory allocation failure.

   - gh-144012(3): Check if the result is ‘NULL’ in ‘BINARY_OP_EXTENT’
     opcode.

   - gh-141805(4): Fix crash in *note set: 184. when objects with the
     same hash are concurrently added to the set after removing an
     element with the same hash while the set still contains elements
     with the same hash.

   - gh-143670(5): Fixes a crash in ‘ga_repr_items_list’ function.

   - gh-143377(6): Fix a crash in ‘_interpreters.capture_exception()’
     when the exception is incorrectly formatted.  Patch by Bénédikt
     Tran.

   - gh-136924(7): The interactive help mode in the *note REPL: 491. no
     longer incorrectly syntax highlights text input as Python code.
     Contributed by Olga Matoula.

   - gh-143189(8): Fix crash when inserting a non-*note str: 169. key
     into a split table dictionary when the key matches an existing key
     in the split table but has no corresponding value in the dict.

   - gh-143228(9): Fix use-after-free in perf trampoline when toggling
     profiling while threads are running or during interpreter
     finalization with daemon threads active.  The fix uses reference
     counting to ensure trampolines are not freed while any code object
     could still reference them.  Pach by Pablo Galindo

   - gh-142664(10): Fix a use-after-free crash in *note
     memoryview.__hash__: cf3. when the ‘__hash__’ method of the
     referenced object mutates that object or the view.  Patch by
     Bénédikt Tran.

   - gh-142557(11): Fix a use-after-free crash in *note
     bytearray.__mod__: f81. when the ‘bytearray’ is mutated while
     formatting the ‘%’-style arguments.  Patch by Bénédikt Tran.

   - gh-143195(12): Fix use-after-free crashes in *note bytearray.hex():
     f66. and *note memoryview.hex(): f67. when the separator's *note
     __len__(): 178f. mutates the original object.  Patch by Bénédikt
     Tran.

   - gh-142975(13): Fix crash after unfreezing all objects tracked by
     the garbage collector on the *note free threaded: 1f4. build.

   - gh-143135(14): Set *note sys.flags.inspect: 1790. to ‘1’ when *note
     PYTHONINSPECT: 16f3. is ‘0’.  Previously, it was set to ‘0’ in this
     case.

   - gh-143003(15): Fix an overflow of the shared empty buffer in *note
     bytearray.extend(): 1791. when ‘__length_hint__()’ returns 0 for
     non-empty iterator.

   - gh-143006(16): Fix a possible assertion error when comparing
     negative non-integer ‘float’ and ‘int’ with the same number of bits
     in the integer part.

   - gh-143057(17): Avoid locking in *note PyTraceMalloc_Track(): daf.
     and *note PyTraceMalloc_Untrack(): db0. when *note tracemalloc:
     105. is not enabled.

   - gh-142776(18): Fix a file descriptor leak in import.c

   - gh-142829(19): Fix a use-after-free crash in *note
     contextvars.Context: 177. comparison when a custom ‘__eq__’ method
     modifies the context via *note set(): 1792.

   - gh-142766(20): Clear the frame of a generator when *note
     generator.close(): 1793. is called.

   - gh-142737(21): Tracebacks will be displayed in fallback mode even
     if *note io.open(): 740. is lost.  Previously, this would crash the
     interpreter.  Patch by Bartosz Sławecki.

   - gh-142554(22): Fix a crash in *note divmod(): b99. when
     ‘_pylong.int_divmod()’ does not return a tuple of length two
     exactly.  Patch by Bénédikt Tran.

   - gh-142560(23): Fix use-after-free in *note bytearray: 344.
     search-like methods (*note find(): 15bd, *note count(): 1794, *note
     index(): 1795, *note rindex(): 1796, and *note rfind(): 15be.) by
     marking the storage as exported which causes reallocation attempts
     to raise *note BufferError: 1797.  For *note contains(): ad7, *note
     split(): 1798, and *note rsplit(): 1799. the *note buffer protocol:
     260. is used for this.

   - gh-142531(24): Fix a free-threaded GC performance regression.  If
     there are many untracked tuples, the GC will run too often,
     resulting in poor performance.  The fix is to include untracked
     tuples in the "long lived" object count.  The number of frozen
     objects is also now included since the free-threaded GC must scan
     those too.

   - gh-142402(25): Fix reference counting when adjacent literal parts
     are merged while constructing *note string.templatelib.Template:
     16a, preventing the displaced string object from leaking.

   - gh-133932(26): Fix crash in the free threading build when clearing
     frames that hold tagged integers.

   - gh-142343(27): Fix SIGILL crash on m68k due to incorrect assembly
     constraint.

   - gh-100964(28): Fix reference cycle in exhausted generator frames.
     Patch by Savannah Ostrowski.

   - gh-69605(29): Fix edge-cases around already imported modules in the
     *note REPL: 491. auto-completion of imports.

   - gh-138568(30): Adjusted the built-in *note help(): ad4. function so
     that empty inputs are ignored in interactive mode.

   - gh-137007(31): Fix a bug during JIT compilation failure which
     caused garbage collection debug assertions to fail.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/144307

   (2) https://github.com/python/cpython/issues/144194

   (3) https://github.com/python/cpython/issues/144012

   (4) https://github.com/python/cpython/issues/141805

   (5) https://github.com/python/cpython/issues/143670

   (6) https://github.com/python/cpython/issues/143377

   (7) https://github.com/python/cpython/issues/136924

   (8) https://github.com/python/cpython/issues/143189

   (9) https://github.com/python/cpython/issues/143228

   (10) https://github.com/python/cpython/issues/142664

   (11) https://github.com/python/cpython/issues/142557

   (12) https://github.com/python/cpython/issues/143195

   (13) https://github.com/python/cpython/issues/142975

   (14) https://github.com/python/cpython/issues/143135

   (15) https://github.com/python/cpython/issues/143003

   (16) https://github.com/python/cpython/issues/143006

   (17) https://github.com/python/cpython/issues/143057

   (18) https://github.com/python/cpython/issues/142776

   (19) https://github.com/python/cpython/issues/142829

   (20) https://github.com/python/cpython/issues/142766

   (21) https://github.com/python/cpython/issues/142737

   (22) https://github.com/python/cpython/issues/142554

   (23) https://github.com/python/cpython/issues/142560

   (24) https://github.com/python/cpython/issues/142531

   (25) https://github.com/python/cpython/issues/142402

   (26) https://github.com/python/cpython/issues/133932

   (27) https://github.com/python/cpython/issues/142343

   (28) https://github.com/python/cpython/issues/100964

   (29) https://github.com/python/cpython/issues/69605

   (30) https://github.com/python/cpython/issues/138568

   (31) https://github.com/python/cpython/issues/137007


File: python.info,  Node: C API,  Next: ビルド,  Prev: Core and Builtins<2>,  Up: Python 3 14 3 final

1.24.2.9 C API
..............

   - gh-142589(1): Fix *note
     PyUnstable_Object_IsUniqueReferencedTemporary(): 3c7. handling of
     tagged ints on the interpreter stack.

   - gh-142571(2): ‘PyUnstable_CopyPerfMapFile()’ now checks that
     opening the file succeeded before flushing.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142589

   (2) https://github.com/python/cpython/issues/142571


File: python.info,  Node: ビルド,  Prev: C API,  Up: Python 3 14 3 final

1.24.2.10 ビルド
................

   - gh-142454(1): When calculating the digest of the JIT stencils
     input, sort the hashed files by filenames before adding their
     content to the hasher.  This ensures deterministic hash input and
     hence deterministic hash, independent on filesystem order.

   - gh-141808(2): When running ‘make clean-retain-profile’, keep the
     generated JIT stencils.  That way, the stencils are not generated
     twice when Profile-guided optimization (PGO) is used.  It also
     allows distributors to supply their own pre-built JIT stencils.

   - gh-138061(3): Ensure reproducible builds by making JIT stencil
     header generation deterministic.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142454

   (2) https://github.com/python/cpython/issues/141808

   (3) https://github.com/python/cpython/issues/138061


File: python.info,  Node: Python 3 14 2 final,  Next: Python 3 14 1 final,  Prev: Python 3 14 3 final,  Up: 変更履歴

1.24.3 Python 3.14.2 final
--------------------------

'Release date: 2025-12-05'

* Menu:

* セキュリティ: セキュリティ<2>.
* ライブラリ: ライブラリ<3>.
* Core and Builtins: Core and Builtins<3>.
* ライブラリ: ライブラリ<4>.


File: python.info,  Node: セキュリティ<2>,  Next: ライブラリ<3>,  Up: Python 3 14 2 final

1.24.3.1 セキュリティ
.....................

   - gh-142145(1): Remove quadratic behavior in ‘xml.minidom’ node ID
     cache clearing.

   - gh-119452(2): Fix a potential memory denial of service in the *note
     http.server: 76. module.  When a malicious user is connected to the
     CGI server on Windows, it could cause an arbitrary amount of memory
     to be allocated.  This could have led to symptoms including a *note
     MemoryError: 179e, swapping, out of memory (OOM) killed processes
     or containers, or even system crashes.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142145

   (2) https://github.com/python/cpython/issues/119452


File: python.info,  Node: ライブラリ<3>,  Next: Core and Builtins<3>,  Prev: セキュリティ<2>,  Up: Python 3 14 2 final

1.24.3.2 ライブラリ
...................

   - gh-140797(1): Revert changes to the undocumented ‘re.Scanner’
     class.  Capturing groups are still allowed for backward
     compatibility, although using them can lead to incorrect result.
     They will be forbidden in future Python versions.

   - gh-142206(2): The resource tracker in the *note multiprocessing:
     98. module now uses the original communication protocol, as in
     Python 3.14.0 and below, by default.  This avoids issues with
     upgrading Python while it is running.  (Note that such 'in-place'
     upgrades are not tested.)  The tracker remains compatible with
     subprocesses that use new protocol (that is, subprocesses using
     Python 3.13.10, 3.14.1 and 3.15).

   - gh-142214(3): Fix two regressions in *note dataclasses: 33. in
     Python 3.14.1 related to annotations.

        * An exception is no longer raised if ‘slots=True’ is used and
          the ‘__init__’ method does not have an ‘__annotate__’
          attribute (likely because ‘init=False’ was used).

        * An exception is no longer raised if annotations are requested
          on the ‘__init__’ method and one of the fields is not present
          in the class annotations.  This can occur in certain dynamic
          scenarios.

     Patch by Jelle Zijlstra.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140797

   (2) https://github.com/python/cpython/issues/142206

   (3) https://github.com/python/cpython/issues/142214


File: python.info,  Node: Core and Builtins<3>,  Next: ライブラリ<4>,  Prev: ライブラリ<3>,  Up: Python 3 14 2 final

1.24.3.3 Core and Builtins
..........................

   - gh-142218(1): Fix crash when inserting into a split table
     dictionary with a non *note str: 169. key that matches an existing
     key.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142218


File: python.info,  Node: ライブラリ<4>,  Prev: Core and Builtins<3>,  Up: Python 3 14 2 final

1.24.3.4 ライブラリ
...................

   - gh-116738(1): Fix *note cmath: 19. data race when initializing
     trigonometric tables with subinterpreters.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738


File: python.info,  Node: Python 3 14 1 final,  Next: Python 3 14 0 final,  Prev: Python 3 14 2 final,  Up: 変更履歴

1.24.4 Python 3.14.1 final
--------------------------

'Release date: 2025-12-02'

* Menu:

* Windows: Windows<3>.
* Tools/Demos: Tools/Demos<2>.
* テスト: テスト<2>.
* セキュリティ: セキュリティ<3>.
* ライブラリ: ライブラリ<5>.
* IDLE: IDLE<4>.
* ドキュメント: ドキュメント<4>.
* Core and Builtins: Core and Builtins<4>.
* ライブラリ: ライブラリ<6>.
* Core and Builtins: Core and Builtins<5>.
* ライブラリ: ライブラリ<7>.
* Core and Builtins: Core and Builtins<6>.
* ライブラリ: ライブラリ<8>.
* Core and Builtins: Core and Builtins<7>.
* ライブラリ: ライブラリ<9>.
* Core and Builtins: Core and Builtins<8>.
* ライブラリ: ライブラリ<10>.
* Core and Builtins: Core and Builtins<9>.
* ライブラリ: ライブラリ<11>.
* Core and Builtins: Core and Builtins<10>.
* C API: C API<2>.
* ビルド: ビルド<2>.


File: python.info,  Node: Windows<3>,  Next: Tools/Demos<2>,  Up: Python 3 14 1 final

1.24.4.1 Windows
................

   - gh-139810(1): Installing with ‘py install 3[.x]-dev’ will now
     select final versions as well as prereleases.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/139810


File: python.info,  Node: Tools/Demos<2>,  Next: テスト<2>,  Prev: Windows<3>,  Up: Python 3 14 1 final

1.24.4.2 Tools/Demos
....................

   - gh-141692(1): Each slice of an iOS XCframework now contains a ‘lib’
     folder that contains a symlink to the libpython dylib.  This allows
     binary modules to be compiled for iOS using dynamic libreary
     linking, rather than Framework linking.

   - gh-141442(2): The iOS testbed now correctly handles test arguments
     that contain spaces.

   - gh-140702(3): The iOS testbed app will now expose the
     ‘GITHUB_ACTIONS’ environment variable to iOS apps being tested.

   - gh-137484(4): Have ‘Tools/wasm/wasi’ put the build Python into a
     directory named after the build triple instead of "build".

   - gh-137248(5): Add a ‘--logdir’ option to ‘Tools/wasm/wasi’ for
     specifying where to write log files.

   - gh-137243(6): Have Tools/wasm/wasi detect a WASI SDK install in
     /opt when it was directly extracted from a release tarball.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/141692

   (2) https://github.com/python/cpython/issues/141442

   (3) https://github.com/python/cpython/issues/140702

   (4) https://github.com/python/cpython/issues/137484

   (5) https://github.com/python/cpython/issues/137248

   (6) https://github.com/python/cpython/issues/137243


File: python.info,  Node: テスト<2>,  Next: セキュリティ<3>,  Prev: Tools/Demos<2>,  Up: Python 3 14 1 final

1.24.4.3 テスト
...............

   - gh-140482(1): Preserve and restore the state of ‘stty echo’ as part
     of the test environment.

   - gh-140082(2): Update ‘python -m test’ to set ‘FORCE_COLOR=1’ when
     being run with color enabled so that *note unittest: 10c. which is
     run by it with redirected output will output in color.

   - gh-139208(3): Fix regrtest ‘--fast-ci --verbose’: don't ignore the
     ‘--verbose’ option anymore.  Patch by Victor Stinner.

   - gh-136442(4): Use exitcode ‘1’ instead of ‘5’ if *note
     unittest.TestCase.setUpClass(): c43. raises an exception

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140482

   (2) https://github.com/python/cpython/issues/140082

   (3) https://github.com/python/cpython/issues/139208

   (4) https://github.com/python/cpython/issues/136442


File: python.info,  Node: セキュリティ<3>,  Next: ライブラリ<5>,  Prev: テスト<2>,  Up: Python 3 14 1 final

1.24.4.4 セキュリティ
.....................

   - gh-139700(1): Check consistency of the zip64 end of central
     directory record.  Support records with "zip64 extensible data" if
     there are no bytes prepended to the ZIP file.

   - gh-139283(2): *note sqlite3: d4.: correctly handle maximum number
     of rows to fetch in *note Cursor.fetchmany: 17a7. and reject
     negative values for *note Cursor.arraysize: 17a8.  Patch by
     Bénédikt Tran.

   - gh-137836(3): Add support of the "plaintext" element, RAWTEXT
     elements "xmp", "iframe", "noembed" and "noframes", and optionally
     RAWTEXT element "noscript" in *note html.parser.HTMLParser: a77.

   - gh-136063(4): *note email.message: 48.: ensure linear complexity
     for legacy HTTP parameters parsing.  Patch by Bénédikt Tran.

   - gh-136065(5): Fix quadratic complexity in *note
     os.path.expandvars(): 15f2.

   - gh-119451(6): Fix a potential memory denial of service in the *note
     http.client: 73. module.  When connecting to a malicious server, it
     could cause an arbitrary amount of memory to be allocated.  This
     could have led to symptoms including a *note MemoryError: 179e,
     swapping, out of memory (OOM) killed processes or containers, or
     even system crashes.

   - gh-119342(7): Fix a potential memory denial of service in the *note
     plistlib: b0. module.  When reading a Plist file received from
     untrusted source, it could cause an arbitrary amount of memory to
     be allocated.  This could have led to symptoms including a *note
     MemoryError: 179e, swapping, out of memory (OOM) killed processes
     or containers, or even system crashes.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/139700

   (2) https://github.com/python/cpython/issues/139283

   (3) https://github.com/python/cpython/issues/137836

   (4) https://github.com/python/cpython/issues/136063

   (5) https://github.com/python/cpython/issues/136065

   (6) https://github.com/python/cpython/issues/119451

   (7) https://github.com/python/cpython/issues/119342


File: python.info,  Node: ライブラリ<5>,  Next: IDLE<4>,  Prev: セキュリティ<3>,  Up: Python 3 14 1 final

1.24.4.5 ライブラリ
...................

   - gh-74389(1): When the stdin being used by a *note subprocess.Popen:
     4b7. instance is closed, this is now ignored in *note
     subprocess.Popen.communicate(): 17aa. instead of leaving the class
     in an inconsistent state.

   - gh-87512(2): Fix *note subprocess.Popen.communicate(): 17aa.
     timeout handling on Windows when writing large input.  Previously,
     the timeout was ignored during stdin writing, causing the method to
     block indefinitely if the child process did not consume input
     quickly.  The stdin write is now performed in a background thread,
     allowing the timeout to be properly enforced.

   - gh-141473(3): When *note subprocess.Popen.communicate(): 17aa. was
     called with 'input' and a 'timeout' and is called for a second time
     after a *note TimeoutExpired: 17ab. exception before the process
     has died, it should no longer hang.

   - gh-59000(4): Fix *note pdb: aa. breakpoint resolution for class
     methods when the module defining the class is not imported.

   - gh-141570(5): Support *note file-like object: 17ac. raising *note
     OSError: 2c0. from *note fileno(): 17ad. in color detection
     (‘_colorize.can_colorize()’).  This can occur when ‘sys.stdout’ is
     redirected.

   - gh-141659(6): Fix bad file descriptor errors from
     ‘_posixsubprocess’ on AIX.

   - gh-141600(7): Fix musl version detection on Void Linux.

   - gh-141497(8): *note ipaddress: 84.: ensure that the methods *note
     IPv4Network.hosts(): 17ae. and *note IPv6Network.hosts(): 17af.
     always return an iterator.

   - gh-140938(9): The *note statistics.stdev(): 8e3. and *note
     statistics.pstdev(): 17b0. functions now raise a *note ValueError:
     2ec. when the input contains an infinity or a NaN.

   - gh-124111(10): Updated Tcl threading configuration in *note
     _tkinter: 3. to assume that threads are always available in Tcl 9
     and later.

   - gh-137109(11): The *note os.fork: 4b5. and related forking APIs
     will no longer warn in the common case where Linux or macOS
     platform APIs return the number of threads in a process and find
     the answer to be 1 even when a *note os.register_at_fork(): 355.
     ‘after_in_parent=’ callback (re)starts a thread.

   - gh-141314(12): Fix assertion failure in *note
     io.TextIOWrapper.tell(): 17b1. when reading files with standalone
     carriage return (‘\r’) line endings.

   - gh-141311(13): Fix assertion failure in ‘io.BytesIO.readinto()’ and
     undefined behavior arising when read position is above capcity in
     *note io.BytesIO: 10a4.

   - gh-141141(14): Fix a thread safety issue with *note
     base64.b85decode(): 1124.  Contributed by Benel Tayar.

   - gh-137969(15): Fix *note annotationlib.ForwardRef.evaluate(): 17b2.
     returning *note ForwardRef: 1776. objects which don't update with
     new globals.

   - gh-140911(16): *note collections: 1e.: Ensure that the methods
     ‘UserString.rindex()’ and ‘UserString.index()’ accept *note
     collections.UserString: fd3. instances as the sub argument.

   - gh-140797(17): The undocumented ‘re.Scanner’ class now forbids
     regular expressions containing capturing groups in its lexicon
     patterns.  Patterns using capturing groups could previously lead to
     crashes with segmentation fault.  Use non-capturing groups (?:...)
     instead.

   - gh-125115(18): Refactor the *note pdb: aa. parsing issue so
     positional arguments can pass through intuitively.

   - gh-140815(19): *note faulthandler: 5c. now detects if a frame or a
     code object is invalid or freed.  Patch by Victor Stinner.

   - gh-100218(20): Correctly set *note errno: 17b3. when *note
     socket.if_nametoindex(): c23. or *note socket.if_indextoname():
     c24. raise an *note OSError: 2c0.  Patch by Bénédikt Tran.

   - gh-140875(21): Fix handling of unclosed character references (named
     and numerical) followed by the end of file in *note
     html.parser.HTMLParser: a77. with ‘convert_charrefs=False’.

   - gh-140734(22): *note multiprocessing: 98.: fix off-by-one error
     when checking the length of a temporary socket file path.  Patch by
     Bénédikt Tran.

   - gh-140874(23): Bump the version of pip bundled in ensurepip to
     version 25.3

   - gh-140691(24): In *note urllib.request: 111, when opening a FTP URL
     fails because a data connection cannot be made, the control
     connection's socket is now closed to avoid a *note ResourceWarning:
     54c.

   - gh-103847(25): Fix hang when cancelling process created by *note
     asyncio.create_subprocess_exec(): c6b. or *note
     asyncio.create_subprocess_shell(): c6c.  Patch by Kumar Aditya.

   - gh-120057(26): Add *note os.reload_environ(): 258. to ‘os.__all__’.

   - gh-140228(27): Avoid making unnecessary filesystem calls for frozen
     modules in *note linecache: 89. when the global module cache is not
     present.

   - gh-140590(28): Fix arguments checking for the
     ‘functools.partial.__setstate__()’ that may lead to internal state
     corruption and crash.  Patch by Sergey Miryanov.

   - gh-125434(29): Display thread name in *note faulthandler: 5c. on
     Windows.  Patch by Victor Stinner.

   - gh-140634(30): Fix a reference counting bug in
     ‘os.sched_param.__reduce__()’.

   - gh-140633(31): Ignore *note AttributeError: 5f0. when setting a
     module's ‘__file__’ attribute when loading an extension module
     packaged as Apple Framework.

   - gh-140593(32): *note xml.parsers.expat: 12c.: Fix a memory leak
     that could affect users with *note ElementDeclHandler(): 17b4. set
     to a custom element declaration handler.  Patch by Sebastian
     Pipping.

   - gh-140607(33): Inside *note io.RawIOBase.read(): 101d, validate
     that the count of bytes returned by *note io.RawIOBase.readinto():
     101e. is valid (inside the provided buffer).

   - gh-138162(34): Fix *note logging.LoggerAdapter: 150d. with
     ‘merge_extra=True’ and without the 'extra' argument.

   - gh-138774(35): *note ast.unparse(): ae2. now generates full source
     code when handling *note ast.Interpolation: 17b5. nodes that do not
     have a specified source.

   - gh-140474(36): Fix memory leak in *note array.array: 4be. when
     creating arrays from an empty *note str: 169. and the ‘u’ type
     code.

   - gh-137530(37): *note dataclasses: 33. Fix annotations for generated
     ‘__init__’ methods by replacing the annotations that were in-line
     in the generated source code with ‘__annotate__’ functions attached
     to the methods.

   - gh-140348(38): Fix regression in Python 3.14.0 where using the ‘|’
     operator on a *note typing.Union: 2a8. object combined with an
     object that is not a type would raise an error.

   - gh-140272(39): Fix memory leak in the ‘clear()’ method of the *note
     dbm.gnu: 37. database.

   - gh-140041(40): Fix import of *note ctypes: 2e. on Android and
     Cygwin when ABI flags are present.

   - gh-140120(41): Fixed a memory leak in *note hmac: 6e. when it was
     using the hacl-star backend.  Discovered by ‘@ashm-dev’ using
     AddressSanitizer.

   - gh-139905(42): Add suggestion to error message for *note
     typing.Generic: 17b6. subclasses when ‘cls.__parameters__’ is
     missing due to a parent class failing to call *note
     super().__init_subclass__(): 843. in its ‘__init_subclass__’.

   - gh-139894(43): Fix incorrect sharing of current task with the child
     process while forking in *note asyncio: b.  Patch by Kumar Aditya.

   - gh-139845(44): Fix to not print KeyboardInterrupt twice in default
     asyncio REPL.

   - gh-139783(45): Fix *note inspect.getsourcelines(): 17b7. for the
     case when a decorator is followed by a comment or an empty line.

   - gh-139809(46): Prevent premature colorization of subparser ‘prog’
     in *note argparse.ArgumentParser.add_subparsers(): e11. to respect
     color environment variable changes after parser creation.

   - gh-139736(47): Fix excessive indentation in the default *note
     argparse: 7. ‘HelpFormatter’.  Patch by Alexander Edland.

   - gh-70765(48): *note http.server: 76.: fix default handling of
     HTTP/0.9 requests in *note BaseHTTPRequestHandler: 12e2.
     Previously, ‘BaseHTTPRequestHandler.parse_request()’ incorrectly
     waited for headers in the request although those are not supported
     in HTTP/0.9.  Patch by Bénédikt Tran.

   - gh-63161(49): Fix *note tokenize.detect_encoding(): 17b8.  Support
     non-UTF-8 shebang and comments if non-UTF-8 encoding is specified.
     Detect decoding error for non-UTF-8 encoding.  Detect null bytes in
     source code.

   - gh-139391(50): Fix an issue when, on non-Windows platforms, it was
     not possible to gracefully exit a ‘python -m asyncio’ process
     suspended by Ctrl+Z and later resumed by ‘fg(51)’ other than with
     ‘kill(52)’.

   - gh-101828(53): Fix ‘'shift_jisx0213'’, ‘'shift_jis_2004'’,
     ‘'euc_jisx0213'’ and ‘'euc_jis_2004'’ codecs truncating null chars
     as they were treated as part of multi-character sequences.

   - gh-139289(54): Do a real lazy-import on *note rlcompleter: c2. in
     *note pdb: aa. and restore the existing completer after importing
     *note rlcompleter: c2.

   - gh-139246(55): fix: paste zero-width in default repl width is
     wrong.

   - gh-90949(56): Add *note SetAllocTrackerActivationThreshold(): 17b9.
     and *note SetAllocTrackerMaximumAmplification(): 17ba. to *note
     xmlparser: 17bb. objects to prevent use of disproportional amounts
     of dynamic memory from within an Expat parser.  Patch by Bénédikt
     Tran.

   - gh-139210(57): Fix use-after-free when reporting unknown event in
     *note xml.etree.ElementTree.iterparse(): 57a.  Patch by Ken Jin.

   - gh-138860(58): Lazy import *note rlcompleter: c2. in *note pdb: aa.
     to avoid deadlock in subprocess.

   - gh-112729(59): Fix crash when calling *note
     concurrent.interpreters.create(): 17bc. when the process is out of
     memory.

   - gh-135729(60): Fix unraisable exception during finalization when
     using *note concurrent.interpreters: 25. in the REPL.

   - gh-139076(61): Fix a bug in the *note pydoc: ba. module that was
     hiding functions in a Python module if they were implemented in an
     extension module and the module did not have ‘__all__’.

   - gh-139065(62): Fix trailing space before a wrapped long word if the
     line length is exactly 'width' in *note textwrap: f2.

   - gh-139001(63): Fix race condition in *note pathlib.Path: 266. on
     the internal ‘_raw_paths’ field.

   - gh-138813(64): ‘multiprocessing.BaseProcess’ defaults ‘kwargs’ to
     ‘None’ instead of a shared dictionary.

   - gh-138993(65): Dedent *note credits: 1789. text.

   - gh-138891(66): Fix ‘SyntaxError’ when ‘inspect.get_annotations(f,
     eval_str=True)’ is called on a function annotated with a PEP
     646(67) ‘star_expression’

   - gh-130567(68): Fix possible crash in *note locale.strxfrm(): 17bd.
     due to a platform bug on macOS.

   - gh-138859(69): Fix generic type parameterization raising a *note
     TypeError: 198. when omitting a ‘ParamSpec’ that has a default
     which is not a list of types.

   - gh-138764(70): Prevent *note
     annotationlib.call_annotate_function(): 17be. from calling
     ‘__annotate__’ functions that don't support
     ‘VALUE_WITH_FAKE_GLOBALS’ in a fake globals namespace with empty
     globals.

     Make ‘FORWARDREF’ and ‘STRING’ annotations fall back to using
     ‘VALUE’ annotations in the case that neither their own format, nor
     ‘VALUE_WITH_FAKE_GLOBALS’ are supported.

   - gh-138775(71): Use of ‘python -m’ with *note base64: f. has been
     fixed to detect input from a terminal so that it properly notices
     EOF.

   - gh-138779(72): Support device numbers larger than ‘2**63-1’ for the
     *note st_rdev: 17bf. field of the *note os.stat_result: 16da.
     structure.

   - gh-137706(73): Fix the partial evaluation of annotations that use
     ‘typing.Annotated[T, x]’ where ‘T’ is a forward reference.

   - gh-88375(74): Fix normalization of the ‘robots.txt’ rules and URLs
     in the *note urllib.robotparser: 113. module.  No longer ignore
     trailing ‘?’.  Distinguish raw special characters ‘?’, ‘=’ and ‘&’
     from the percent-encoded ones.

   - gh-111788(75): Fix parsing errors in the *note urllib.robotparser:
     113. module.  Don't fail trying to parse weird paths.  Don't fail
     trying to decode non-UTF-8 ‘robots.txt’ files.

   - gh-98896(76): Fix a failure in multiprocessing resource_tracker
     when SharedMemory names contain colons.  Patch by Rani Pinchuk.

   - gh-138425(77): Fix partial evaluation of *note
     annotationlib.ForwardRef: 1776. objects which rely on names defined
     as globals.

   - gh-138432(78): *note zoneinfo.reset_tzpath(): 17c0. will now
     convert any *note os.PathLike: e4b. objects it receives into
     strings before adding them to ‘TZPATH’.  It will raise ‘TypeError’
     if anything other than a string is found after this conversion.  If
     given an *note os.PathLike: e4b. object that represents a relative
     path, it will now raise ‘ValueError’ instead of ‘TypeError’, and
     present a more informative error message.

   - gh-138008(79): Fix segmentation faults in the *note ctypes: 2e.
     module due to invalid *note argtypes: 17c1.  Patch by Dung Nguyen.

   - gh-60462(80): Fix *note locale.strxfrm(): 17bd. on Solaris (and
     possibly other platforms).

   - gh-138239(81): The REPL now highlights *note type: 66d. as a soft
     keyword in *note type statements: 66d.

   - gh-138204(82): Forbid expansion of shared anonymous *note memory
     maps: 94. on Linux, which caused a bus error.

   - gh-138010(83): Fix an issue where defining a class with an *note
     @warnings.deprecated: 489.-decorated base class may not invoke the
     correct *note __init_subclass__(): 843. method in cases involving
     multiple inheritance.  Patch by Brian Schubert.

   - gh-138151(84): In *note annotationlib: 6, improve evaluation of
     forward references to nonlocal variables that are not yet defined
     when the annotations are initially evaluated.

   - gh-137317(85): *note inspect.signature(): 22f. now correctly
     handles classes that use a descriptor on a wrapped ‘__init__()’ or
     ‘__new__()’ method.  Contributed by Yongyu Yan.

   - gh-137754(86): Fix import of the *note zoneinfo: 13a. module if the
     C implementation of the *note datetime: 34. module is not
     available.

   - gh-137490(87): Handle *note ECANCELED: 17c2. in the same way as
     *note EINTR: f87. in *note signal.sigwaitinfo(): fab. on NetBSD.

   - gh-137477(88): Fix ‘inspect.getblock()’, *note
     inspect.getsourcelines(): 17b7. and *note inspect.getsource():
     17c3. for generator expressions.

   - gh-137044(89): Return large limit values as positive integers
     instead of negative integers in *note resource.getrlimit(): 17c4.
     Accept large values and reject negative values (except *note
     RLIM_INFINITY: 17c5.) for limits in *note resource.setrlimit():
     17c6.

   - gh-75989(90): *note tarfile.TarFile.extractall(): 29b. and *note
     tarfile.TarFile.extract(): 29c. now overwrite symlinks when
     extracting hardlinks.  (Contributed by Alexander Enrique Urieles
     Nieto in gh-75989(91).)

   - gh-137017(92): Fix *note threading.Thread.is_alive: b46. to remain
     ‘True’ until the underlying OS thread is fully cleaned up.  This
     avoids false negatives in edge cases involving thread monitoring or
     premature *note threading.Thread.is_alive: b46. calls.

   - gh-137273(93): Fix debug assertion failure in *note
     locale.setlocale(): 328. on Windows.

   - gh-137239(94): *note heapq: 6d.: Update ‘heapq.__all__’ with
     ‘*_max’ functions.

   - gh-81325(95): *note tarfile.TarFile: 1429. now accepts a *note
     path-like: 5a1. when working on a tar archive.  (Contributed by
     Alexander Enrique Urieles Nieto in gh-81325(96).)

   - gh-137185(97): Fix a potential async-signal-safety issue in *note
     faulthandler: 5c. when printing C stack traces.

   - gh-136914(98): Fix retrieval of *note doctest.DocTest.lineno: 17c7.
     for objects decorated with *note functools.cache(): 17c8. or *note
     functools.cached_property: 763.

   - gh-136912(99): *note hmac.digest(): d32. now properly handles large
     keys and messages by falling back to the pure Python implementation
     when necessary.  Patch by Bénédikt Tran.

   - gh-83424(100): Allows creating a *note ctypes.CDLL: bdc. without
     name when passing a handle as an argument.

   - gh-136234(101): Fix *note asyncio.WriteTransport.writelines():
     17c9. to be robust to connection failure, by using the same
     behavior as *note write(): 17ca.

   - gh-136507(102): Fix mimetypes CLI to handle multiple file
     parameters.

   - gh-136057(103): Fixed the bug in *note pdb: aa. and *note bdb: 10.
     where ‘next’ and ‘step’ can't go over the line if a loop exists in
     the line.

   - gh-135386(104): Fix opening a *note dbm.sqlite3: 39. database for
     reading from read-only file or directory.

   - gh-135444(105): Fix *note asyncio.DatagramTransport.sendto(): 4cb.
     to account for datagram header size when data cannot be sent.

   - gh-126631(106): Fix *note multiprocessing: 98. ‘forkserver’ bug
     which prevented ‘__main__’ from being preloaded.

   - gh-135307(107): *note email: 3f.: Fix exception in ‘set_content()’
     when encoding text and max_line_length is set to ‘0’ or ‘None’
     (unlimited).

   - gh-134453(108): Fixed *note subprocess.Popen.communicate(): 17aa.
     ‘input=’ handling of *note memoryview: 165. instances that were
     non-byte shaped on POSIX platforms.  Those are now properly cast to
     a byte shaped view instead of truncating the input.  Windows
     platforms did not have this bug.

   - gh-134698(109): Fix a crash when calling methods of *note
     ssl.SSLContext: 357. or *note ssl.SSLSocket: ae7. across multiple
     threads.

   - gh-125996(110): Fix thread safety of *note collections.OrderedDict:
     7f3.  Patch by Kumar Aditya.

   - gh-133789(111): Fix unpickling of *note pathlib: a8. objects that
     were pickled in Python 3.13.

   - gh-127081(112): Fix libc thread safety issues with *note dbm: 35.
     by performing stateful operations in critical sections.

   - gh-132551(113): Make *note io.BytesIO: 10a4. safe in *note
     free-threaded: 1f4. build.

   - gh-131788(114): Make ‘ResourceTracker.send’ from *note
     multiprocessing: 98. re-entrant safe

   - gh-118981(115): Fix potential hang in
     ‘multiprocessing.popen_spawn_posix’ that can happen when the child
     proc dies early by closing the child fds right away.

   - gh-102431(116): Clarify constraints for "logical" arguments in
     methods of *note decimal.Context: 12c3.

   - gh-78319(117): UTF8 support for the IMAP APPEND command has been
     made RFC compliant.

   - bpo-38735(118): Fix failure when importing a module from the root
     directory on unix-like platforms with sys.pycache_prefix set.

   - bpo-41839(119): Allow negative priority values from *note
     os.sched_get_priority_min(): 1321. and *note
     os.sched_get_priority_max(): 1320. functions.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/74389

   (2) https://github.com/python/cpython/issues/87512

   (3) https://github.com/python/cpython/issues/141473

   (4) https://github.com/python/cpython/issues/59000

   (5) https://github.com/python/cpython/issues/141570

   (6) https://github.com/python/cpython/issues/141659

   (7) https://github.com/python/cpython/issues/141600

   (8) https://github.com/python/cpython/issues/141497

   (9) https://github.com/python/cpython/issues/140938

   (10) https://github.com/python/cpython/issues/124111

   (11) https://github.com/python/cpython/issues/137109

   (12) https://github.com/python/cpython/issues/141314

   (13) https://github.com/python/cpython/issues/141311

   (14) https://github.com/python/cpython/issues/141141

   (15) https://github.com/python/cpython/issues/137969

   (16) https://github.com/python/cpython/issues/140911

   (17) https://github.com/python/cpython/issues/140797

   (18) https://github.com/python/cpython/issues/125115

   (19) https://github.com/python/cpython/issues/140815

   (20) https://github.com/python/cpython/issues/100218

   (21) https://github.com/python/cpython/issues/140875

   (22) https://github.com/python/cpython/issues/140734

   (23) https://github.com/python/cpython/issues/140874

   (24) https://github.com/python/cpython/issues/140691

   (25) https://github.com/python/cpython/issues/103847

   (26) https://github.com/python/cpython/issues/120057

   (27) https://github.com/python/cpython/issues/140228

   (28) https://github.com/python/cpython/issues/140590

   (29) https://github.com/python/cpython/issues/125434

   (30) https://github.com/python/cpython/issues/140634

   (31) https://github.com/python/cpython/issues/140633

   (32) https://github.com/python/cpython/issues/140593

   (33) https://github.com/python/cpython/issues/140607

   (34) https://github.com/python/cpython/issues/138162

   (35) https://github.com/python/cpython/issues/138774

   (36) https://github.com/python/cpython/issues/140474

   (37) https://github.com/python/cpython/issues/137530

   (38) https://github.com/python/cpython/issues/140348

   (39) https://github.com/python/cpython/issues/140272

   (40) https://github.com/python/cpython/issues/140041

   (41) https://github.com/python/cpython/issues/140120

   (42) https://github.com/python/cpython/issues/139905

   (43) https://github.com/python/cpython/issues/139894

   (44) https://github.com/python/cpython/issues/139845

   (45) https://github.com/python/cpython/issues/139783

   (46) https://github.com/python/cpython/issues/139809

   (47) https://github.com/python/cpython/issues/139736

   (48) https://github.com/python/cpython/issues/70765

   (49) https://github.com/python/cpython/issues/63161

   (50) https://github.com/python/cpython/issues/139391

   (51) https://manpages.debian.org/fg

   (52) https://manpages.debian.org/kill

   (53) https://github.com/python/cpython/issues/101828

   (54) https://github.com/python/cpython/issues/139289

   (55) https://github.com/python/cpython/issues/139246

   (56) https://github.com/python/cpython/issues/90949

   (57) https://github.com/python/cpython/issues/139210

   (58) https://github.com/python/cpython/issues/138860

   (59) https://github.com/python/cpython/issues/112729

   (60) https://github.com/python/cpython/issues/135729

   (61) https://github.com/python/cpython/issues/139076

   (62) https://github.com/python/cpython/issues/139065

   (63) https://github.com/python/cpython/issues/139001

   (64) https://github.com/python/cpython/issues/138813

   (65) https://github.com/python/cpython/issues/138993

   (66) https://github.com/python/cpython/issues/138891

   (67) https://peps.python.org/pep-0646/

   (68) https://github.com/python/cpython/issues/130567

   (69) https://github.com/python/cpython/issues/138859

   (70) https://github.com/python/cpython/issues/138764

   (71) https://github.com/python/cpython/issues/138775

   (72) https://github.com/python/cpython/issues/138779

   (73) https://github.com/python/cpython/issues/137706

   (74) https://github.com/python/cpython/issues/88375

   (75) https://github.com/python/cpython/issues/111788

   (76) https://github.com/python/cpython/issues/98896

   (77) https://github.com/python/cpython/issues/138425

   (78) https://github.com/python/cpython/issues/138432

   (79) https://github.com/python/cpython/issues/138008

   (80) https://github.com/python/cpython/issues/60462

   (81) https://github.com/python/cpython/issues/138239

   (82) https://github.com/python/cpython/issues/138204

   (83) https://github.com/python/cpython/issues/138010

   (84) https://github.com/python/cpython/issues/138151

   (85) https://github.com/python/cpython/issues/137317

   (86) https://github.com/python/cpython/issues/137754

   (87) https://github.com/python/cpython/issues/137490

   (88) https://github.com/python/cpython/issues/137477

   (89) https://github.com/python/cpython/issues/137044

   (90) https://github.com/python/cpython/issues/75989

   (91) https://github.com/python/cpython/issues/75989

   (92) https://github.com/python/cpython/issues/137017

   (93) https://github.com/python/cpython/issues/137273

   (94) https://github.com/python/cpython/issues/137239

   (95) https://github.com/python/cpython/issues/81325

   (96) https://github.com/python/cpython/issues/81325

   (97) https://github.com/python/cpython/issues/137185

   (98) https://github.com/python/cpython/issues/136914

   (99) https://github.com/python/cpython/issues/136912

   (100) https://github.com/python/cpython/issues/83424

   (101) https://github.com/python/cpython/issues/136234

   (102) https://github.com/python/cpython/issues/136507

   (103) https://github.com/python/cpython/issues/136057

   (104) https://github.com/python/cpython/issues/135386

   (105) https://github.com/python/cpython/issues/135444

   (106) https://github.com/python/cpython/issues/126631

   (107) https://github.com/python/cpython/issues/135307

   (108) https://github.com/python/cpython/issues/134453

   (109) https://github.com/python/cpython/issues/134698

   (110) https://github.com/python/cpython/issues/125996

   (111) https://github.com/python/cpython/issues/133789

   (112) https://github.com/python/cpython/issues/127081

   (113) https://github.com/python/cpython/issues/132551

   (114) https://github.com/python/cpython/issues/131788

   (115) https://github.com/python/cpython/issues/118981

   (116) https://github.com/python/cpython/issues/102431

   (117) https://github.com/python/cpython/issues/78319

   (118) https://bugs.python.org/issue?@action=redirect&bpo=38735

   (119) https://bugs.python.org/issue?@action=redirect&bpo=41839


File: python.info,  Node: IDLE<4>,  Next: ドキュメント<4>,  Prev: ライブラリ<5>,  Up: Python 3 14 1 final

1.24.4.6 IDLE
.............

   - gh-96491(1): Deduplicate version number in IDLE shell title bar
     after saving to a file.

   - gh-139742(2): Colorize t-string prefixes for template strings in
     IDLE, as done for f-string prefixes.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/96491

   (2) https://github.com/python/cpython/issues/139742


File: python.info,  Node: ドキュメント<4>,  Next: Core and Builtins<4>,  Prev: IDLE<4>,  Up: Python 3 14 1 final

1.24.4.7 ドキュメント
.....................

   - gh-141994(1): *note xml.sax.handler: 130.: Make Documentation of
     *note xml.sax.handler.feature_external_ges: 17cd. warn of opening
     up to external entity attacks(2).  Patch by Sebastian Pipping.

   - gh-140578(3): Remove outdated sencence in the documentation for
     *note multiprocessing: 98, that implied that *note
     concurrent.futures.ThreadPoolExecutor: 949. did not exist.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/141994

   (2) https://en.wikipedia.org/wiki/XML_external_entity_attack

   (3) https://github.com/python/cpython/issues/140578


File: python.info,  Node: Core and Builtins<4>,  Next: ライブラリ<6>,  Prev: ドキュメント<4>,  Up: Python 3 14 1 final

1.24.4.8 Core and Builtins
..........................

   - gh-142048(1): Fix quadratically increasing garbage collection
     delays in free-threaded build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/142048


File: python.info,  Node: ライブラリ<6>,  Next: Core and Builtins<5>,  Prev: Core and Builtins<4>,  Up: Python 3 14 1 final

1.24.4.9 ライブラリ
...................

   - gh-116738(1): Fix thread safety issue with *note re: be. scanner
     objects in free-threaded builds.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738


File: python.info,  Node: Core and Builtins<5>,  Next: ライブラリ<7>,  Prev: ライブラリ<6>,  Up: Python 3 14 1 final

1.24.4.10 Core and Builtins
...........................

   - gh-141930(1): When importing a module, use Python's regular file
     object to ensure that writes to ‘.pyc’ files are complete or an
     appropriate error is raised.

   - gh-120158(2): Fix inconsistent state when enabling or disabling
     monitoring events too many times.

   - gh-139653(3): Only raise a ‘RecursionError’ or trigger a fatal
     error if the stack pointer is both below the limit pointer 'and'
     above the stack base.  If outside of these bounds assume that it is
     OK. This prevents false positives when user-space threads swap
     stacks.

   - gh-139103(4): Improve multithreaded scaling of dataclasses on the
     free-threaded build.

   - gh-141579(5): Fix *note sys.activate_stack_trampoline(): 69a. to
     properly support the ‘perf_jit’ backend.  Patch by Pablo Galindo.

   - gh-114203(6): Skip locking if object is already locked by two-mutex
     critical section.

   - gh-141528(7): Suggest using *note
     concurrent.interpreters.Interpreter.close(): 17d1. instead of the
     private ‘_interpreters.destroy’ function when warning about
     remaining subinterpreters.  Patch by Sergey Miryanov.

   - gh-141312(8): Fix the assertion failure in the ‘__setstate__’
     method of the range iterator when a non-integer argument is passed.
     Patch by Sergey Miryanov.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/141930

   (2) https://github.com/python/cpython/issues/120158

   (3) https://github.com/python/cpython/issues/139653

   (4) https://github.com/python/cpython/issues/139103

   (5) https://github.com/python/cpython/issues/141579

   (6) https://github.com/python/cpython/issues/114203

   (7) https://github.com/python/cpython/issues/141528

   (8) https://github.com/python/cpython/issues/141312


File: python.info,  Node: ライブラリ<7>,  Next: Core and Builtins<6>,  Prev: Core and Builtins<5>,  Up: Python 3 14 1 final

1.24.4.11 ライブラリ
....................

   - gh-116738(1): Make csv module thread-safe on the *note free
     threaded: 1f4. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738


File: python.info,  Node: Core and Builtins<6>,  Next: ライブラリ<8>,  Prev: ライブラリ<7>,  Up: Python 3 14 1 final

1.24.4.12 Core and Builtins
...........................

   - gh-140939(1): Fix memory leak when *note bytearray: 344. or *note
     bytes: 192. is formated with the ‘%*b’ format with a large width
     that results in a *note MemoryError: 179e.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140939


File: python.info,  Node: ライブラリ<8>,  Next: Core and Builtins<7>,  Prev: Core and Builtins<6>,  Up: Python 3 14 1 final

1.24.4.13 ライブラリ
....................

   - gh-140260(1): Fix *note struct: db. data race in endian table
     initialization with subinterpreters.  Patch by Shamil Abdulaev.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140260


File: python.info,  Node: Core and Builtins<7>,  Next: ライブラリ<9>,  Prev: ライブラリ<8>,  Up: Python 3 14 1 final

1.24.4.14 Core and Builtins
...........................

   - gh-140530(1): Fix a reference leak when ‘raise exc from cause’
     fails.  Patch by Bénédikt Tran.

   - gh-140373(2): Correctly emit ‘PY_UNWIND’ event when generator
     object is closed.  Patch by Mikhail Efimov.

   - gh-140576(3): Fixed crash in *note tokenize.generate_tokens(): 701.
     in case of specific incorrect input.  Patch by Mikhail Efimov.

   - gh-140551(4): Fixed crash in *note dict: 183. if *note
     dict.clear(): 17d6. is called at the lookup stage.  Patch by
     Mikhail Efimov and Inada Naoki.

   - gh-140517(5): Fixed a reference leak when iterating over the result
     of *note map(): 19f. with ‘strict=True’ when the input iterables
     have different lengths.  Patch by Mikhail Efimov.

   - gh-140471(6): Fix potential buffer overflow in *note ast.AST: 4c3.
     node initialization when encountering malformed *note _fields:
     17d7. containing non-*note str: 169.

   - gh-140431(7): Fix a crash in Python's *note garbage collector:
     17d8. due to partially initialized *note coroutine: 6b9. objects
     when coroutine origin tracking depth is enabled (*note
     sys.set_coroutine_origin_tracking_depth(): d85.).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140530

   (2) https://github.com/python/cpython/issues/140373

   (3) https://github.com/python/cpython/issues/140576

   (4) https://github.com/python/cpython/issues/140551

   (5) https://github.com/python/cpython/issues/140517

   (6) https://github.com/python/cpython/issues/140471

   (7) https://github.com/python/cpython/issues/140431


File: python.info,  Node: ライブラリ<9>,  Next: Core and Builtins<8>,  Prev: Core and Builtins<7>,  Up: Python 3 14 1 final

1.24.4.15 ライブラリ
....................

   - gh-140398(1): Fix memory leaks in *note readline: bf. functions
     *note read_init_file(): 17da, *note read_history_file(): 17db,
     *note write_history_file(): 17dc, and *note append_history_file():
     1051. when *note PySys_Audit(): 613. fails.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140398


File: python.info,  Node: Core and Builtins<8>,  Next: ライブラリ<10>,  Prev: ライブラリ<9>,  Up: Python 3 14 1 final

1.24.4.16 Core and Builtins
...........................

   - gh-140406(1): Fix memory leak when an object's *note __hash__():
     cf3. method returns an object that isn't an *note int: 19b.

   - gh-140358(2): Restore elapsed time and unreachable object count in
     GC debug output.  These were inadvertently removed during a
     refactor of ‘gc.c’.  The debug log now again reports elapsed
     collection time and the number of unreachable objects.  Contributed
     by Pål Grønås Drange.

   - gh-140306(3): Fix memory leaks in cross-interpreter channel
     operations and shared namespace handling.

   - gh-140301(4): Fix memory leak of ‘PyConfig’ in subinterpreters.

   - gh-140257(5): Fix data race between interpreter_clear() and
     take_gil() on eval_breaker during finalization with daemon threads.

   - gh-139951(6): Fixes a regression in GC performance for a growing
     heap composed mostly of small tuples.

        * Counts number of actually tracked objects, instead of
          trackable objects.  This ensures that untracking tuples has
          the desired effect of reducing GC overhead.

        * Does not track most untrackable tuples during creation.  This
          prevents large numbers of small tuples causing excessive GCs.

   - gh-140104(7): Fix a bug with exception handling in the JIT. Patch
     by Ken Jin.  Bug reported by Daniel Diniz.

   - gh-140061(8): Fixing the checking of whether an object is uniquely
     referenced to ensure free-threaded compatibility.  Patch by Sergey
     Miryanov.

   - gh-140067(9): Fix memory leak in sub-interpreter creation.

   - gh-140000(10): Fix potential memory leak when a reference cycle
     exists between an instance of *note typing.TypeAliasType: 2ae,
     *note typing.TypeVar: 486, *note typing.ParamSpec: 487, or *note
     typing.TypeVarTuple: 488. and its ‘__name__’ attribute.  Patch by
     Mikhail Efimov.

   - gh-139914(11): Restore support for HP PA-RISC, which has an
     upwards-growing stack.

   - gh-139988(12): Fix a memory leak when failing to create a *note
     Union: 2a8. type.  Patch by Bénédikt Tran.

   - gh-139748(13): Fix reference leaks in error branches of functions
     accepting path strings or bytes such as *note compile(): 4b1. and
     *note os.system(): 1676.  Patch by Bénédikt Tran.

   - gh-139516(14): Fix lambda colon erroneously start format spec in
     f-string in tokenizer.

   - gh-139640(15): *note ast.parse(): 1c2. no longer emits syntax
     warnings for ‘return’/‘break’/‘continue’ in ‘finally’ (see PEP
     765(16)) - they are only emitted during compilation.

   - gh-139640(17): Fix swallowing some syntax warnings in different
     modules if they accidentally have the same message and are emitted
     from the same line.  Fix duplicated warnings in the ‘finally’
     block.

   - gh-63161(18): Support non-UTF-8 shebang and comments in Python
     source files if non-UTF-8 encoding is specified.  Detect decoding
     error in comments for default (UTF-8) encoding.  Show the line and
     position of decoding error for default encoding in a traceback.
     Show the line containing the coding cookie when it conflicts with
     the BOM in a traceback.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/140406

   (2) https://github.com/python/cpython/issues/140358

   (3) https://github.com/python/cpython/issues/140306

   (4) https://github.com/python/cpython/issues/140301

   (5) https://github.com/python/cpython/issues/140257

   (6) https://github.com/python/cpython/issues/139951

   (7) https://github.com/python/cpython/issues/140104

   (8) https://github.com/python/cpython/issues/140061

   (9) https://github.com/python/cpython/issues/140067

   (10) https://github.com/python/cpython/issues/140000

   (11) https://github.com/python/cpython/issues/139914

   (12) https://github.com/python/cpython/issues/139988

   (13) https://github.com/python/cpython/issues/139748

   (14) https://github.com/python/cpython/issues/139516

   (15) https://github.com/python/cpython/issues/139640

   (16) https://peps.python.org/pep-0765/

   (17) https://github.com/python/cpython/issues/139640

   (18) https://github.com/python/cpython/issues/63161


File: python.info,  Node: ライブラリ<10>,  Next: Core and Builtins<9>,  Prev: Core and Builtins<8>,  Up: Python 3 14 1 final

1.24.4.17 ライブラリ
....................

   - gh-116738(1): Make *note mmap: 94. thread-safe on the *note free
     threaded: 1f4. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738


File: python.info,  Node: Core and Builtins<9>,  Next: ライブラリ<11>,  Prev: ライブラリ<10>,  Up: Python 3 14 1 final

1.24.4.18 Core and Builtins
...........................

   - gh-138558(1): Fix handling of unusual t-string annotations in
     annotationlib.  Patch by Dave Peck.

   - gh-134466(2): Don't run PyREPL in a degraded environment where
     setting termios attributes is not allowed.

   - gh-138944(3): Fix *note SyntaxError: 18e. message when invalid
     syntax appears on the same line as a valid ‘import ... as ...’ or
     ‘from ... import ... as ...’ statement.  Patch by Brian Schubert.

   - gh-105487(4): Remove non-existent *note __copy__(): 17e0, *note
     __deepcopy__(): 17e1, and *note __bases__: 16c5. from the *note
     __dir__(): 17e2. entries of *note types.GenericAlias: 9ec.

   - gh-69605(5): Fix some standard library submodules missing from the
     *note REPL: 491. auto-completion of imports.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/138558

   (2) https://github.com/python/cpython/issues/134466

   (3) https://github.com/python/cpython/issues/138944

   (4) https://github.com/python/cpython/issues/105487

   (5) https://github.com/python/cpython/issues/69605


File: python.info,  Node: ライブラリ<11>,  Next: Core and Builtins<10>,  Prev: Core and Builtins<9>,  Up: Python 3 14 1 final

1.24.4.19 ライブラリ
....................

   - gh-116738(1): Make *note cProfile: 2b. thread-safe on the *note
     free threaded: 1f4. build.

   - gh-138004(2): On Solaris/Illumos platforms, thread names are now
     encoded as ASCII to avoid errors on systems (e.g.  OpenIndiana)
     that don't support non-ASCII names.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738

   (2) https://github.com/python/cpython/issues/138004


File: python.info,  Node: Core and Builtins<10>,  Next: C API<2>,  Prev: ライブラリ<11>,  Up: Python 3 14 1 final

1.24.4.20 Core and Builtins
...........................

   - gh-137433(1): Fix a potential deadlock in the *note free threading:
     1f4. build when daemon threads enable or disable profiling or
     tracing while the main thread is shutting down the interpreter.

   - gh-137400(2): Fix a crash in the *note free threading: 1f4. build
     when disabling profiling or tracing across all threads with *note
     PyEval_SetProfileAllThreads(): 781. or *note
     PyEval_SetTraceAllThreads(): 664. or their Python equivalents *note
     threading.settrace_all_threads(): 6ef. and *note
     threading.setprofile_all_threads(): 6f0.

   - gh-58124(3): Fix name of the Python encoding in Unicode errors of
     the code page codec: use "cp65000" and "cp65001" instead of
     "CP_UTF7" and "CP_UTF8" which are not valid Python code names.
     Patch by Victor Stinner.

   - gh-132657(4): Improve performance of *note frozenset: 7f2. by
     removing locks in the free-threading build.

   - gh-133400(5): Fixed Ctrl+D (^D) behavior in _pyrepl module to match
     old pre-3.13 REPL behavior.

   - gh-128640(6): Fix a crash when using threads inside of a
     subinterpreter.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/137433

   (2) https://github.com/python/cpython/issues/137400

   (3) https://github.com/python/cpython/issues/58124

   (4) https://github.com/python/cpython/issues/132657

   (5) https://github.com/python/cpython/issues/133400

   (6) https://github.com/python/cpython/issues/128640


File: python.info,  Node: C API<2>,  Next: ビルド<2>,  Prev: Core and Builtins<10>,  Up: Python 3 14 1 final

1.24.4.21 C API
...............

   - gh-137422(1): Fix *note free threading: 1f4. race condition in
     *note PyImport_AddModuleRef(): 5fb.  It was previously possible for
     two calls to the function return two different objects, only one of
     which was stored in *note sys.modules: 17e6.

   - gh-140042(2): Removed the sqlite3_shutdown call that could cause
     closing connections for sqlite when used with multiple sub
     interpreters.

   - gh-141042(3): Make qNaN in *note PyFloat_Pack2(): 969. and *note
     PyFloat_Pack4(): 96a, if while conversion to a narrower precision
     floating-point format -- the remaining after truncation payload
     will be zero.  Patch by Sergey B Kirpichev.

   - gh-140487(4): Fix *note Py_RETURN_NOTIMPLEMENTED: 17e7. in limited
     C API 3.11 and older: don't treat ‘Py_NotImplemented’ as immortal.
     Patch by Victor Stinner.

   - gh-140153(5): Fix *note Py_REFCNT(): 2cf. definition on limited C
     API 3.11-3.13.  Patch by Victor Stinner.

   - gh-139653(6): Add *note
     PyUnstable_ThreadState_SetStackProtection(): 466. and *note
     PyUnstable_ThreadState_ResetStackProtection(): 467. functions to
     set the stack protection base address and stack protection size of
     a Python thread state.  Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/137422

   (2) https://github.com/python/cpython/issues/140042

   (3) https://github.com/python/cpython/issues/141042

   (4) https://github.com/python/cpython/issues/140487

   (5) https://github.com/python/cpython/issues/140153

   (6) https://github.com/python/cpython/issues/139653


File: python.info,  Node: ビルド<2>,  Prev: C API<2>,  Up: Python 3 14 1 final

1.24.4.22 ビルド
................

   - gh-141808(1): Do not generate the jit stencils twice in case of PGO
     builds on Windows.

   - gh-141784(2): Fix ‘_remote_debugging_module.c’ compilation on
     32-bit Linux.  Include Python.h before system headers to make sure
     that ‘_remote_debugging_module.c’ uses the same types (ABI) than
     Python.  Patch by Victor Stinner.

   - gh-140768(3): Warn when the WASI SDK version doesn't match what's
     supported.

   - gh-140513(4): Generate a clear compilation error when
     ‘_Py_TAIL_CALL_INTERP’ is enabled but either ‘preserve_none’ or
     ‘musttail’ is not supported.

   - gh-140189(5): iOS builds were added to CI.

   - gh-138489(6): When cross-compiling for WASI by ‘build_wasm’ or
     ‘build_emscripten’, the ‘build-details.json’ step is now included
     in the build process, just like with native builds.

     This fixes the ‘libinstall’ task which requires the
     ‘build-details.json’ file during the process.

   - gh-137618(7): ‘PYTHON_FOR_REGEN’ now requires Python 3.10 to Python
     3.15.  Patch by Adam Turner.

   - gh-123681(8): Check the ‘strftime()’ behavior at runtime instead of
     at the compile time to support cross-compiling.  Remove the
     internal macro ‘_Py_NORMALIZE_CENTURY’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/141808

   (2) https://github.com/python/cpython/issues/141784

   (3) https://github.com/python/cpython/issues/140768

   (4) https://github.com/python/cpython/issues/140513

   (5) https://github.com/python/cpython/issues/140189

   (6) https://github.com/python/cpython/issues/138489

   (7) https://github.com/python/cpython/issues/137618

   (8) https://github.com/python/cpython/issues/123681


File: python.info,  Node: Python 3 14 0 final,  Next: Python 3 14 0 release candidate 3,  Prev: Python 3 14 1 final,  Up: 変更履歴

1.24.5 Python 3.14.0 final
--------------------------

'Release date: 2025-10-07'

* Menu:

* macOS: macOS<2>.
* Windows: Windows<4>.
* Tools/Demos: Tools/Demos<3>.
* セキュリティ: セキュリティ<4>.
* ライブラリ: ライブラリ<12>.


File: python.info,  Node: macOS<2>,  Next: Windows<4>,  Up: Python 3 14 0 final

1.24.5.1 macOS
..............

   - gh-124111(1): Update macOS installer to use Tcl/Tk 8.6.17.

   - gh-139573(2): Updated bundled version of OpenSSL to 3.0.18.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/124111

   (2) https://github.com/python/cpython/issues/139573


File: python.info,  Node: Windows<4>,  Next: Tools/Demos<3>,  Prev: macOS<2>,  Up: Python 3 14 0 final

1.24.5.2 Windows
................

   - gh-139573(1): Updated bundled version of OpenSSL to 3.0.18.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/139573


File: python.info,  Node: Tools/Demos<3>,  Next: セキュリティ<4>,  Prev: Windows<4>,  Up: Python 3 14 0 final

1.24.5.3 Tools/Demos
....................

   - gh-139330(1): SBOM generation tool didn't cross-check the version
     and checksum values against the ‘Modules/expat/refresh.sh’ script,
     leading to the values becoming out-of-date during routine updates.

   - gh-132006(2): XCframeworks now include privacy manifests to satisfy
     Apple App Store submission requirements.

   - gh-138171(3): A script for building an iOS XCframework was added.
     As part of this change, the top level ‘iOS’ folder has been moved
     to be a subdirectory of the ‘Apple’ folder.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/139330

   (2) https://github.com/python/cpython/issues/132006

   (3) https://github.com/python/cpython/issues/138171


File: python.info,  Node: セキュリティ<4>,  Next: ライブラリ<12>,  Prev: Tools/Demos<3>,  Up: Python 3 14 0 final

1.24.5.4 セキュリティ
.....................

   - gh-139400(1): *note xml.parsers.expat: 12c.: Make sure that parent
     Expat parsers are only garbage-collected once they are no longer
     referenced by subparsers created by *note
     ExternalEntityParserCreate(): 17ee.  Patch by Sebastian Pipping.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/139400


File: python.info,  Node: ライブラリ<12>,  Prev: セキュリティ<4>,  Up: Python 3 14 0 final

1.24.5.5 ライブラリ
...................

   - gh-139312(1): Upgrade bundled libexpat to 2.7.3

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/139312


File: python.info,  Node: Python 3 14 0 release candidate 3,  Next: Python 3 14 0 release candidate 2,  Prev: Python 3 14 0 final,  Up: 変更履歴

1.24.6 Python 3.14.0 release candidate 3
----------------------------------------

'Release date: 2025-09-18'

* Menu:

* Windows: Windows<5>.
* Tools/Demos: Tools/Demos<4>.
* セキュリティ: セキュリティ<5>.
* ライブラリ: ライブラリ<13>.
* Core and Builtins: Core and Builtins<11>.


File: python.info,  Node: Windows<5>,  Next: Tools/Demos<4>,  Up: Python 3 14 0 release candidate 3

1.24.6.1 Windows
................

   - gh-138896(1): Fix error installing C runtime on non-updated Windows
     machines

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/138896


File: python.info,  Node: Tools/Demos<4>,  Next: セキュリティ<5>,  Prev: Windows<5>,  Up: Python 3 14 0 release candidate 3

1.24.6.2 Tools/Demos
....................

   - gh-137873(1): The iOS test runner has been simplified, resolving
     some issues that have been observed using the runner in GitHub
     Actions and Azure Pipelines test environments.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/137873


File: python.info,  Node: セキュリティ<5>,  Next: ライブラリ<13>,  Prev: Tools/Demos<4>,  Up: Python 3 14 0 release candidate 3

1.24.6.3 セキュリティ
.....................

   - gh-135661(1): Fix CDATA section parsing in *note
     html.parser.HTMLParser: a77. according to the HTML5 standard: ‘]
     ]>’ and ‘]] >’ no longer end the CDATA section.  Add private method
     ‘_set_support_cdata()’ which can be used to specify how to parse
     ‘<[CDATA[’ -- as a CDATA section in foreign content (SVG or MathML)
     or as a bogus comment in the HTML namespace.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/135661


File: python.info,  Node: ライブラリ<13>,  Next: Core and Builtins<11>,  Prev: セキュリティ<5>,  Up: Python 3 14 0 release candidate 3

1.24.6.4 ライブラリ
...................

   - gh-138998(1): Update bundled libexpat to 2.7.2

   - gh-118803(2): Add back *note collections.abc.ByteString: 342. and
     *note typing.ByteString: 345.  Both had been removed in prior
     alpha, beta and release candidates for Python 3.14, but their
     removal has now been postponed to Python 3.17.

   - gh-137226(3): Fix *note typing.get_type_hints(): 8c0. calls on
     generic *note typing.TypedDict: 332. classes defined with string
     annotations.

   - gh-138804(4): Raise *note TypeError: 198. instead of *note
     AttributeError: 5f0. when an argument of incorrect type is passed
     to *note shlex.quote(): 582.  This restores the behavior of the
     function prior to 3.14.

   - gh-128636(5): Fix crash in PyREPL when os.environ is overwritten
     with an invalid value for mac

   - gh-138514(6): Raise *note ValueError: 2ec. when a multi-character
     string is passed to the 'echo_char' parameter of *note
     getpass.getpass(): 21d.  Patch by Benjamin Johnson.

   - gh-138515(7): *note email: 3f. is added to Emscripten build.

   - gh-99948(8): *note ctypes.util.find_library(): f45. now works in
     Emscripten build.

   - gh-138253(9): Add the 'block' parameter in the ‘put()’ and ‘get()’
     methods of the *note concurrent.interpreters: 25. queues for
     compatibility with the *note queue.Queue: 15ac. interface.

   - gh-138133(10): Prevent infinite traceback loop when sending CTRL^C
     to Python through ‘strace’.

   - gh-134869(11): Fix an issue where pressing Ctrl+C during tab
     completion in the REPL would leave the autocompletion menu in a
     corrupted state.

   - gh-90548(12): Fix ‘musl’ detection for *note platform.libc_ver():
     17f5. on Alpine Linux if compiled with -strip-all.

   - gh-136134(13): ‘SMTP.auth_cram_md5()’ now raises an *note
     SMTPException: 11a3. instead of a *note ValueError: 2ec. if Python
     has been built without MD5 support.  In particular, *note SMTP:
     b27. clients will not attempt to use this method even if the remote
     server is assumed to support it.  Patch by Bénédikt Tran.

   - gh-136134(14): *note IMAP4.login_cram_md5: 17f6. now raises an
     *note IMAP4.error: 17f7. if CRAM-MD5 authentication is not
     supported.  Patch by Bénédikt Tran.

   - gh-134953(15): Expand ‘_colorize’ theme with ‘keyword_constant’ and
     implement in *note repl: 491.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/138998

   (2) https://github.com/python/cpython/issues/118803

   (3) https://github.com/python/cpython/issues/137226

   (4) https://github.com/python/cpython/issues/138804

   (5) https://github.com/python/cpython/issues/128636

   (6) https://github.com/python/cpython/issues/138514

   (7) https://github.com/python/cpython/issues/138515

   (8) https://github.com/python/cpython/issues/99948

   (9) https://github.com/python/cpython/issues/138253

   (10) https://github.com/python/cpython/issues/138133

   (11) https://github.com/python/cpython/issues/134869

   (12) https://github.com/python/cpython/issues/90548

   (13) https://github.com/python/cpython/issues/136134

   (14) https://github.com/python/cpython/issues/136134

   (15) https://github.com/python/cpython/issues/134953


File: python.info,  Node: Core and Builtins<11>,  Prev: ライブラリ<13>,  Up: Python 3 14 0 release candidate 3

1.24.6.5 Core and Builtins
..........................

   - gh-71810(1): Raise *note OverflowError: a81. for ‘(-1).to_bytes()’
     for signed conversions when bytes count is zero.  Patch by Sergey B
     Kirpichev.

   - gh-138192(2): Fix *note contextvars: 28. initialization so that all
     subinterpreters are assigned the *note MISSING: 17f9. value.

   - gh-138479(3): Fix a crash when a generic object's
     ‘__typing_subst__’ returns an object that isn't a *note tuple: 614.

   - gh-138372(4): Fix *note SyntaxWarning: 1ae. emitted for erroneous
     subscript expressions involving *note template string literals:
     17fa.  Patch by Brian Schubert.

   - gh-138318(5): The default REPL now avoids highlighting built-in
     names (for instance *note set: 184. or *note format(): 199.) when
     they are used as attribute names (for instance in ‘value.set’ or
     ‘text.format’).

   - gh-138349(6): Fix crash in certain cases where a module contains
     both a module-level annotation and a comprehension.

   - gh-137384(7): Fix a crash when using the *note warnings: 118.
     module in a finalizer at shutdown.  Patch by Kumar Aditya.

   - gh-137883(8): Fix runaway recursion when calling a function with
     keyword arguments.

   - gh-137079(9): Fix keyword typo recognition when parsing files.
     Patch by Pablo Galindo.

   - gh-137728(10): Fix the JIT's handling of many local variables.
     This previously caused a segfault.

   - gh-137576(11): Fix for incorrect source code being shown in
     tracebacks from the Basic REPL when *note PYTHONSTARTUP: 1b8. is
     given.  Patch by Adam Hartz.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/71810

   (2) https://github.com/python/cpython/issues/138192

   (3) https://github.com/python/cpython/issues/138479

   (4) https://github.com/python/cpython/issues/138372

   (5) https://github.com/python/cpython/issues/138318

   (6) https://github.com/python/cpython/issues/138349

   (7) https://github.com/python/cpython/issues/137384

   (8) https://github.com/python/cpython/issues/137883

   (9) https://github.com/python/cpython/issues/137079

   (10) https://github.com/python/cpython/issues/137728

   (11) https://github.com/python/cpython/issues/137576


File: python.info,  Node: Python 3 14 0 release candidate 2,  Next: Python 3 14 0 release candidate 1,  Prev: Python 3 14 0 release candidate 3,  Up: 変更履歴

1.24.7 Python 3.14.0 release candidate 2
----------------------------------------

'Release date: 2025-08-14'

* Menu:

* macOS: macOS<3>.
* Windows: Windows<6>.
* ライブラリ: ライブラリ<14>.
* ドキュメント: ドキュメント<5>.
* Core and Builtins: Core and Builtins<12>.
* C API: C API<3>.
* ビルド: ビルド<3>.


File: python.info,  Node: macOS<3>,  Next: Windows<6>,  Up: Python 3 14 0 release candidate 2

1.24.7.1 macOS
..............

   - gh-137450(1): macOS installer shell path management improvements:
     separate the installer ‘Shell profile updater’ postinstall script
     from the ‘Update Shell Profile.command’ to enable more robust error
     handling.

   - gh-137134(2): Update macOS installer to ship with SQLite version
     3.50.4.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/137450

   (2) https://github.com/python/cpython/issues/137134


File: python.info,  Node: Windows<6>,  Next: ライブラリ<14>,  Prev: macOS<3>,  Up: Python 3 14 0 release candidate 2

1.24.7.2 Windows
................

   - gh-137134(1): Update Windows installer to ship with SQLite 3.50.4.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/137134


File: python.info,  Node: ライブラリ<14>,  Next: ドキュメント<5>,  Prev: Windows<6>,  Up: Python 3 14 0 release candidate 2

1.24.7.3 ライブラリ
...................

   - gh-137426(1): Remove the code deprecation of
     ‘importlib.abc.ResourceLoader’.  It is documented as deprecated,
     but left for backwards compatibility with other classes in
     ‘importlib.abc’.

   - gh-137282(2): Fix tab completion and *note dir(): 844. on *note
     concurrent.futures: 24.

   - gh-137257(3): Bump the version of pip bundled in ensurepip to
     version 25.2

   - gh-137226(4): Fix behavior of *note
     annotationlib.ForwardRef.evaluate(): 17b2. when the 'type_params'
     parameter is passed and the name of a type param is also present in
     an enclosing scope.

   - gh-130522(5): Fix unraisable *note TypeError: 198. raised during
     *note interpreter shutdown: 479. in the *note threading: f3.
     module.

   - gh-137059(6): Fix handling of file URLs with a Windows drive letter
     in the URL authority by *note urllib.request.url2pathname(): 2bd.
     This fixes a regression in earlier pre-releases of Python 3.14.

   - gh-130577(7): *note tarfile: e4. now validates archives to ensure
     member offsets are non-negative.  (Contributed by Alexander Enrique
     Urieles Nieto in gh-130577(8).)

   - gh-135228(9): When *note dataclasses: 33. replaces a class with a
     slotted dataclass, the original class can now be garbage collected
     again.  Earlier changes in Python 3.14 caused this class to always
     remain in existence together with the replacement class synthesized
     by *note dataclasses: 33.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/137426

   (2) https://github.com/python/cpython/issues/137282

   (3) https://github.com/python/cpython/issues/137257

   (4) https://github.com/python/cpython/issues/137226

   (5) https://github.com/python/cpython/issues/130522

   (6) https://github.com/python/cpython/issues/137059

   (7) https://github.com/python/cpython/issues/130577

   (8) https://github.com/python/cpython/issues/130577

   (9) https://github.com/python/cpython/issues/135228


File: python.info,  Node: ドキュメント<5>,  Next: Core and Builtins<12>,  Prev: ライブラリ<14>,  Up: Python 3 14 0 release candidate 2

1.24.7.4 ドキュメント
.....................

   - gh-136155(1): We are now checking for fatal errors in EPUB builds
     in CI.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/136155


File: python.info,  Node: Core and Builtins<12>,  Next: C API<3>,  Prev: ドキュメント<5>,  Up: Python 3 14 0 release candidate 2

1.24.7.5 Core and Builtins
..........................

   - gh-137400(1): Fix a crash in the *note free threading: 1f4. build
     when disabling profiling or tracing across all threads with *note
     PyEval_SetProfileAllThreads(): 781. or *note
     PyEval_SetTraceAllThreads(): 664. or their Python equivalents *note
     threading.settrace_all_threads(): 6ef. and *note
     threading.setprofile_all_threads(): 6f0.

   - gh-137314(2): Fixed a regression where raw f-strings incorrectly
     interpreted escape sequences in format specifications.  Raw
     f-strings now properly preserve literal backslashes in format
     specs, matching the behavior from Python 3.11.  For example,
     ‘rf"{obj:\xFF}"’ now correctly produces ‘'\\xFF'’ instead of ‘'ÿ'’.
     Patch by Pablo Galindo.

   - gh-137308(3): A standalone docstring in a node body is optimized as
     a *note pass: 17e. statement to ensure that the node's body is
     never empty.  There was a *note ValueError: 2ec. in *note
     compile(): 4b1. otherwise.

   - gh-137288(4): Fix bug where some bytecode instructions of a boolean
     expression are not associated with the correct exception handler.

   - gh-134291(5): Remove some newer macOS API usage from the JIT
     compiler in order to restore compatibility with older OSX 10.15
     deployment targets.

   - gh-131338(6): Disable computed stack limit checks on non-glibc
     linux platforms to fix crashes on deep recursion.

   - gh-136870(7): Fix data races while de-instrumenting bytecode of
     code objects running concurrently in threads.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/137400

   (2) https://github.com/python/cpython/issues/137314

   (3) https://github.com/python/cpython/issues/137308

   (4) https://github.com/python/cpython/issues/137288

   (5) https://github.com/python/cpython/issues/134291

   (6) https://github.com/python/cpython/issues/131338

   (7) https://github.com/python/cpython/issues/136870


File: python.info,  Node: C API<3>,  Next: ビルド<3>,  Prev: Core and Builtins<12>,  Up: Python 3 14 0 release candidate 2

1.24.7.6 C API
..............

   - gh-137573(1): Mark ‘_PyOptimizer_Optimize’ as *note Py_NO_INLINE:
     1802. to prevent stack overflow crashes on macOS.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/137573


File: python.info,  Node: ビルド<3>,  Prev: C API<3>,  Up: Python 3 14 0 release candidate 2

1.24.7.7 ビルド
...............

   - gh-132339(1): Add support for OpenSSL 3.5.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132339


File: python.info,  Node: Python 3 14 0 release candidate 1,  Next: Python 3 14 0 beta 4,  Prev: Python 3 14 0 release candidate 2,  Up: 変更履歴

1.24.8 Python 3.14.0 release candidate 1
----------------------------------------

'Release date: 2025-07-22'

* Menu:

* Tools/Demos: Tools/Demos<5>.
* セキュリティ: セキュリティ<6>.
* ライブラリ: ライブラリ<15>.
* Core and Builtins: Core and Builtins<13>.
* ライブラリ: ライブラリ<16>.
* Core and Builtins: Core and Builtins<14>.
* ライブラリ: ライブラリ<17>.
* Core and Builtins: Core and Builtins<15>.
* C API: C API<4>.
* ビルド: ビルド<4>.


File: python.info,  Node: Tools/Demos<5>,  Next: セキュリティ<6>,  Up: Python 3 14 0 release candidate 1

1.24.8.1 Tools/Demos
....................

   - gh-136251(1): Fixes and usability improvements for
     ‘Tools/wasm/emscripten/web_example’

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/136251


File: python.info,  Node: セキュリティ<6>,  Next: ライブラリ<15>,  Prev: Tools/Demos<5>,  Up: Python 3 14 0 release candidate 1

1.24.8.2 セキュリティ
.....................

   - gh-135661(1): Fix parsing attributes with whitespaces around the
     ‘=’ separator in *note html.parser.HTMLParser: a77. according to
     the HTML5 standard.

   - gh-118350(2): Fix support of escapable raw text mode (elements
     "textarea" and "title") in *note html.parser.HTMLParser: a77.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/135661

   (2) https://github.com/python/cpython/issues/118350


File: python.info,  Node: ライブラリ<15>,  Next: Core and Builtins<13>,  Prev: セキュリティ<6>,  Up: Python 3 14 0 release candidate 1

1.24.8.3 ライブラリ
...................

   - gh-136170(1): Removed the unreleased ‘zipfile.ZipFile.data_offset’
     property added in 3.14.0a7 as it wasn't fully clear which behavior
     it should have in some situations so the result was not always what
     a user might expect.

   - gh-124621(2): pyrepl now works in Emscripten.

   - gh-136874(3): Discard URL query and fragment in *note
     urllib.request.url2pathname(): 2bd.

   - gh-130645(4): Enable color help by default in *note argparse: 7.

   - gh-136549(5): Fix signature of *note threading.excepthook(): a4b.

   - gh-136523(6): Fix *note wave.Wave_write: 337. emitting an
     unraisable when open raises.

   - gh-52876(7): Add missing ‘keepends’ (default ‘True’) parameter to
     ‘codecs.StreamReaderWriter.readline()’ and
     ‘codecs.StreamReaderWriter.readlines()’.

   - gh-136470(8): Correct *note
     concurrent.futures.InterpreterPoolExecutor: 1d2.'s default thread
     name.

   - gh-136476(9): Fix a bug that was causing the
     ‘get_async_stack_trace’ function to miss some frames in the stack
     trace.

   - gh-136434(10): Fix docs generation of ‘UnboundItem’ in *note
     concurrent.interpreters: 25. when running with *note -OO: fb5.

   - gh-136380(11): Raises *note AttributeError: 5f0. when accessing
     *note concurrent.futures.InterpreterPoolExecutor: 1d2. and
     subinterpreters are not available.

   - gh-134759(12): Fix *note UnboundLocalError: 174f. in *note
     email.message.Message.get_payload(): 13e5. when the payload to
     decode is a *note bytes: 192. object.  Patch by Kliment Lamonov.

   - gh-134657(13): *note asyncio: b.: Remove some private names from
     ‘asyncio.__all__’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/136170

   (2) https://github.com/python/cpython/issues/124621

   (3) https://github.com/python/cpython/issues/136874

   (4) https://github.com/python/cpython/issues/130645

   (5) https://github.com/python/cpython/issues/136549

   (6) https://github.com/python/cpython/issues/136523

   (7) https://github.com/python/cpython/issues/52876

   (8) https://github.com/python/cpython/issues/136470

   (9) https://github.com/python/cpython/issues/136476

   (10) https://github.com/python/cpython/issues/136434

   (11) https://github.com/python/cpython/issues/136380

   (12) https://github.com/python/cpython/issues/134759

   (13) https://github.com/python/cpython/issues/134657


File: python.info,  Node: Core and Builtins<13>,  Next: ライブラリ<16>,  Prev: ライブラリ<15>,  Up: Python 3 14 0 release candidate 1

1.24.8.4 Core and Builtins
..........................

   - gh-136801(1): Fix PyREPL syntax highlighting on match cases after
     multi-line case.  Contributed by Olga Matoula.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/136801


File: python.info,  Node: ライブラリ<16>,  Next: Core and Builtins<14>,  Prev: Core and Builtins<13>,  Up: Python 3 14 0 release candidate 1

1.24.8.5 ライブラリ
...................

   - gh-136421(1): Fix crash when initializing *note datetime: 34.
     concurrently.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/136421


File: python.info,  Node: Core and Builtins<14>,  Next: ライブラリ<17>,  Prev: ライブラリ<16>,  Up: Python 3 14 0 release candidate 1

1.24.8.6 Core and Builtins
..........................

   - gh-136541(1): Fix some issues with the perf trampolines on x86-64
     and aarch64.  The trampolines were not being generated correctly
     for some cases, which could lead to the perf integration not
     working correctly.  Patch by Pablo Galindo.

   - gh-136517(2): Fixed a typo that prevented printing of uncollectable
     objects when the *note gc.DEBUG_UNCOLLECTABLE: 13da. mode was set.

   - gh-136525(3): Fix issue where per-thread bytecode was not
     instrumented for newly created threads.

   - gh-132661(4): ‘Interpolation.expression’ now has a default, the
     empty string.

   - gh-132661(5): Reflect recent PEP 750(6) change.

     Disallow concatenation of ‘string.templatelib.Template’ and *note
     str: 169.  Also, disallow implicit concatenation of t-string
     literals with string or f-string literals.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/136541

   (2) https://github.com/python/cpython/issues/136517

   (3) https://github.com/python/cpython/issues/136525

   (4) https://github.com/python/cpython/issues/132661

   (5) https://github.com/python/cpython/issues/132661

   (6) https://peps.python.org/pep-0750/


File: python.info,  Node: ライブラリ<17>,  Next: Core and Builtins<15>,  Prev: Core and Builtins<14>,  Up: Python 3 14 0 release candidate 1

1.24.8.7 ライブラリ
...................

   - gh-116738(1): Make functions in *note grp: 6a. thread-safe on the
     *note free threaded: 1f4. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738


File: python.info,  Node: Core and Builtins<15>,  Next: C API<4>,  Prev: ライブラリ<17>,  Up: Python 3 14 0 release candidate 1

1.24.8.8 Core and Builtins
..........................

   - gh-135148(1): Fixed a bug where f-string debug expressions (using
     =) would incorrectly strip out parts of strings containing escaped
     quotes and # characters.  Patch by Pablo Galindo.

   - gh-133136(2): Limit excess memory usage in the *note free
     threading: 1f4. build when a large dictionary or list is resized
     and accessed by multiple threads.

   - gh-91153(3): Fix a crash when a *note bytearray: 344. is
     concurrently mutated during item assignment.

   - gh-127971(4): Fix off-by-one read beyond the end of a string in
     string search.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/135148

   (2) https://github.com/python/cpython/issues/133136

   (3) https://github.com/python/cpython/issues/91153

   (4) https://github.com/python/cpython/issues/127971


File: python.info,  Node: C API<4>,  Next: ビルド<4>,  Prev: Core and Builtins<15>,  Up: Python 3 14 0 release candidate 1

1.24.8.9 C API
..............

   - gh-112068(1): Revert support of nullable arguments in *note
     PyArg_Parse(): 180e.

   - gh-133296(2): New variants for the critical section API that accept
     one or two *note PyMutex: 484. pointers rather than *note PyObject:
     5df. instances are now public in the non-limited C API.

   - gh-134009(3): Expose *note PyMutex_IsLocked(): 463. as part of the
     public C API.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/112068

   (2) https://github.com/python/cpython/issues/133296

   (3) https://github.com/python/cpython/issues/134009


File: python.info,  Node: ビルド<4>,  Prev: C API<4>,  Up: Python 3 14 0 release candidate 1

1.24.8.10 ビルド
................

   - gh-135621(1): PyREPL no longer depends on the *note curses: 2f.
     standard library.  Contributed by Łukasz Langa.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/135621


File: python.info,  Node: Python 3 14 0 beta 4,  Next: Python 3 14 0 beta 3,  Prev: Python 3 14 0 release candidate 1,  Up: 変更履歴

1.24.9 Python 3.14.0 beta 4
---------------------------

'Release date: 2025-07-08'

* Menu:

* Tools/Demos: Tools/Demos<6>.
* テスト: テスト<3>.
* セキュリティ: セキュリティ<7>.
* ライブラリ: ライブラリ<18>.
* ドキュメント: ドキュメント<6>.
* Core and Builtins: Core and Builtins<16>.
* C API: C API<5>.
* ビルド: ビルド<5>.


File: python.info,  Node: Tools/Demos<6>,  Next: テスト<3>,  Up: Python 3 14 0 beta 4

1.24.9.1 Tools/Demos
....................

   - gh-135968(1): Stubs for ‘strip’ are now provided as part of an iOS
     install.

   - gh-133600(2): Backport file reorganization for Tools/wasm/wasi.

     This should make backporting future code changes easier.  It also
     simplifies instructions around how to do WASI builds in the
     devguide.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/135968

   (2) https://github.com/python/cpython/issues/133600


File: python.info,  Node: テスト<3>,  Next: セキュリティ<7>,  Prev: Tools/Demos<6>,  Up: Python 3 14 0 beta 4

1.24.9.2 テスト
...............

   - gh-135966(1): The iOS testbed now handles the ‘app_packages’ folder
     as a site directory.

   - gh-135494(2): Fix regrtest to support excluding tests from ‘--pgo’
     tests.  Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/135966

   (2) https://github.com/python/cpython/issues/135494


File: python.info,  Node: セキュリティ<7>,  Next: ライブラリ<18>,  Prev: テスト<3>,  Up: Python 3 14 0 beta 4

1.24.9.3 セキュリティ
.....................

   - gh-136053(1): *note marshal: 91.: fix a possible crash when
     deserializing *note slice: 694. objects.

   - gh-135661(2): Fix parsing start and end tags in *note
     html.parser.HTMLParser: a77. according to the HTML5 standard.

        * Whitespaces no longer accepted between ‘</’ and the tag name.
          E.g.  ‘</ script>’ does not end the script section.

        * Vertical tabulation (‘\v’) and non-ASCII whitespaces no longer
          recognized as whitespaces.  The only whitespaces are
          ‘\t\n\r\f’ and space.

        * Null character (U+0000) no longer ends the tag name.

        * Attributes and slashes after the tag name in end tags are now
          ignored, instead of terminating after the first ‘>’ in quoted
          attribute value.  E.g.  ‘</script/foo=">"/>’.

        * Multiple slashes and whitespaces between the last attribute
          and closing ‘>’ are now ignored in both start and end tags.
          E.g.  ‘<a foo=bar/ //>’.

        * Multiple ‘=’ between attribute name and value are no longer
          collapsed.  E.g.  ‘<a foo==bar>’ produces attribute "foo" with
          value "=bar".

        * [Reverted in gh-136927(3)] Whitespaces between the ‘=’
          separator and attribute name or value are no longer ignored.
          E.g.  ‘<a foo =bar>’ produces two attributes "foo" and "=bar",
          both with value None; ‘<a foo= bar>’ produces two attributes:
          "foo" with value "" and "bar" with value None.

   - gh-102555(4): Fix comment parsing in *note html.parser.HTMLParser:
     a77. according to the HTML5 standard.  ‘--!>’ now ends the comment.
     ‘-- >’ no longer ends the comment.  Support abnormally ended empty
     comments ‘<-->’ and ‘<--->’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/136053

   (2) https://github.com/python/cpython/issues/135661

   (3) https://github.com/python/cpython/issues/136927

   (4) https://github.com/python/cpython/issues/102555


File: python.info,  Node: ライブラリ<18>,  Next: ドキュメント<6>,  Prev: セキュリティ<7>,  Up: Python 3 14 0 beta 4

1.24.9.4 ライブラリ
...................

   - gh-136286(1): Fix pickling failures for protocols 0 and 1 for many
     objects realted to subinterpreters.

   - gh-136316(2): Improve support for evaluating nested forward
     references in *note typing.evaluate_forward_ref(): 1815.

   - gh-85702(3): If ‘zoneinfo._common.load_tzdata’ is given a package
     without a resource a *note zoneinfo.ZoneInfoNotFoundError: 1816. is
     raised rather than a *note PermissionError: f3e.  Patch by Victor
     Stinner.

   - gh-136028(4): Fix parsing month names containing "İ" (U+0130, LATIN
     CAPITAL LETTER I WITH DOT ABOVE) in *note time.strptime(): 1646.
     This affects locales az_AZ, ber_DZ, ber_MA and crh_UA.

   - gh-135995(5): In the palmos encoding, make byte ‘0x9b’ decode to
     ‘›’ (U+203A - SINGLE RIGHT-POINTING ANGLE QUOTATION MARK).

   - gh-53203(6): Fix *note time.strptime(): 1646. for ‘%c’ and ‘%x’
     formats on locales byn_ER, wal_ET and lzh_TW, and for ‘%X’ format
     on locales ar_SA, bg_BG and lzh_TW.

   - gh-91555(7): An earlier change, which was introduced in 3.14.0b2,
     has been reverted.  It disabled logging for a logger during
     handling of log messages for that logger.  Since the reversion, the
     behaviour should be as it was before 3.14.0b2.

   - gh-135878(8): Fixes a crash of *note types.SimpleNamespace: 4e5. on
     *note free threading: 1f4. builds, when several threads were
     calling its *note __repr__(): 82f. method at the same time.

   - gh-135836(9): Fix *note IndexError: 174e. in *note
     asyncio.loop.create_connection(): 818. that could occur when
     non-*note OSError: 2c0. exception is raised during connection and
     socket's ‘close()’ raises ‘OSError’.

   - gh-135836(10): Fix *note IndexError: 174e. in *note
     asyncio.loop.create_connection(): 818. that could occur when the
     Happy Eyeballs algorithm resulted in an empty exceptions list
     during connection attempts.

   - gh-135855(11): Raise *note TypeError: 198. instead of *note
     SystemError: 795. when ‘_interpreters.set___main___attrs()’ is
     passed a non-dict object.  Patch by Brian Schubert.

   - gh-135815(12): *note netrc: 9f.: skip security checks if *note
     os.getuid(): 1817. is missing.  Patch by Bénédikt Tran.

   - gh-135640(13): Address bug where it was possible to call *note
     xml.etree.ElementTree.ElementTree.write(): c8c. on an ElementTree
     object with an invalid root element.  This behavior blanked the
     file passed to ‘write’ if it already existed.

   - gh-135645(14): Added ‘supports_isolated_interpreters’ field to
     *note sys.implementation: 73b.

   - gh-135646(15): Raise consistent *note NameError: 452. exceptions in
     *note annotationlib.ForwardRef.evaluate(): 17b2.

   - gh-135557(16): Fix races on *note heapq: 6d. updates and *note
     list: 24d. reads on the *note free threaded: 1f4. build.

   - gh-119180(17): Only fetch globals and locals if necessary in *note
     annotationlib.get_annotations(): 459.

   - gh-135561(18): Fix a crash on DEBUG builds when an HACL* HMAC
     routine fails.  Patch by Bénédikt Tran.

   - gh-135487(19): Fix ‘reprlib.Repr.repr_int()’ when given integers
     with more than *note sys.get_int_max_str_digits(): 1818. digits.
     Patch by Bénédikt Tran.

   - gh-135335(20): *note multiprocessing: 98.: Flush ‘stdout’ and
     ‘stderr’ after preloading modules in the ‘forkserver’.

   - gh-135069(21): Fix the "Invalid error handling" exception in
     ‘encodings.idna.IncrementalDecoder’ to correctly replace the
     'errors' parameter.

   - gh-130662(22): +Accept leading zeros in precision and width fields
     for +:class:*note Decimal: 1fe. formatting, for example
     ‘format(Decimal(1.25), '.016f')’.

   - gh-130662(23): Accept leading zeros in precision and width fields
     for *note Fraction: 213. formatting, for example
     ‘format(Fraction(1, 3), '.016f')’.

   - gh-87790(24): Support underscore and comma as thousands separators
     in the fractional part for *note Fraction: 213.'s formatting.
     Patch by Sergey B Kirpichev.

   - gh-87790(25): Support underscore and comma as thousands separators
     in the fractional part for *note Decimal: 1fe.'s formatting.  Patch
     by Sergey B Kirpichev.

   - gh-130664(26): Handle corner-case for *note Fraction: 213.'s
     formatting: treat zero-padding (preceding the width field by a zero
     (‘'0'’) character) as an equivalent to a fill character of ‘'0'’
     with an alignment type of ‘'='’, just as in case of *note float:
     196.'s.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/136286

   (2) https://github.com/python/cpython/issues/136316

   (3) https://github.com/python/cpython/issues/85702

   (4) https://github.com/python/cpython/issues/136028

   (5) https://github.com/python/cpython/issues/135995

   (6) https://github.com/python/cpython/issues/53203

   (7) https://github.com/python/cpython/issues/91555

   (8) https://github.com/python/cpython/issues/135878

   (9) https://github.com/python/cpython/issues/135836

   (10) https://github.com/python/cpython/issues/135836

   (11) https://github.com/python/cpython/issues/135855

   (12) https://github.com/python/cpython/issues/135815

   (13) https://github.com/python/cpython/issues/135640

   (14) https://github.com/python/cpython/issues/135645

   (15) https://github.com/python/cpython/issues/135646

   (16) https://github.com/python/cpython/issues/135557

   (17) https://github.com/python/cpython/issues/119180

   (18) https://github.com/python/cpython/issues/135561

   (19) https://github.com/python/cpython/issues/135487

   (20) https://github.com/python/cpython/issues/135335

   (21) https://github.com/python/cpython/issues/135069

   (22) https://github.com/python/cpython/issues/130662

   (23) https://github.com/python/cpython/issues/130662

   (24) https://github.com/python/cpython/issues/87790

   (25) https://github.com/python/cpython/issues/87790

   (26) https://github.com/python/cpython/issues/130664


File: python.info,  Node: ドキュメント<6>,  Next: Core and Builtins<16>,  Prev: ライブラリ<18>,  Up: Python 3 14 0 beta 4

1.24.9.5 ドキュメント
.....................

   - gh-136155(1): EPUB builds are fixed by excluding
     non-XHTML-compatible tags.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/136155


File: python.info,  Node: Core and Builtins<16>,  Next: C API<5>,  Prev: ドキュメント<6>,  Up: Python 3 14 0 beta 4

1.24.9.6 Core and Builtins
..........................

   - gh-109700(1): Fix memory error handling in *note
     PyDict_SetDefault(): 5e4.

   - gh-78465(2): Fix error message for ‘cls.__new__(cls, ...)’ where
     ‘cls’ is not instantiable builtin or extension type (with ‘tp_new’
     set to ‘NULL’).

   - gh-129958(3): Differentiate between t-strings and f-strings in
     syntax error for newlines in format specifiers of single-quoted
     interpolated strings.

   - gh-135871(4): Non-blocking mutex lock attempts now return
     immediately when the lock is busy instead of briefly spinning in
     the *note free threading: 1f4. build.

   - gh-135106(5): Restrict the trashcan mechanism to GC'ed objects and
     untrack them while in the trashcan to prevent the GC and trashcan
     mechanisms conflicting.

   - gh-135607(6): Fix potential *note weakref: 11a. races in an
     object's destructor on the *note free threaded: 1f4. build.

   - gh-135608(7): Fix a crash in the JIT involving attributes of
     modules.

   - gh-135543(8): Emit ‘sys.remote_exec’ audit event when *note
     sys.remote_exec(): 16d. is called and migrate
     ‘remote_debugger_script’ to ‘cpython.remote_debugger_script’.

   - gh-134280(9): Disable constant folding for ‘~’ with a boolean
     argument.  This moves the deprecation warning from compile time to
     runtime.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/109700

   (2) https://github.com/python/cpython/issues/78465

   (3) https://github.com/python/cpython/issues/129958

   (4) https://github.com/python/cpython/issues/135871

   (5) https://github.com/python/cpython/issues/135106

   (6) https://github.com/python/cpython/issues/135607

   (7) https://github.com/python/cpython/issues/135608

   (8) https://github.com/python/cpython/issues/135543

   (9) https://github.com/python/cpython/issues/134280


File: python.info,  Node: C API<5>,  Next: ビルド<5>,  Prev: Core and Builtins<16>,  Up: Python 3 14 0 beta 4

1.24.9.7 C API
..............

   - gh-135906(1): Fix compilation errors when compiling the internal
     headers with a C++ compiler.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/135906


File: python.info,  Node: ビルド<5>,  Prev: C API<5>,  Up: Python 3 14 0 beta 4

1.24.9.8 ビルド
...............

   - gh-134273(1): Add support for configuring compiler flags for the
     JIT with ‘CFLAGS_JIT’

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/134273


File: python.info,  Node: Python 3 14 0 beta 3,  Next: Python 3 14 0 beta 2,  Prev: Python 3 14 0 beta 4,  Up: 変更履歴

1.24.10 Python 3.14.0 beta 3
----------------------------

'Release date: 2025-06-17'

* Menu:

* Windows: Windows<7>.
* テスト: テスト<4>.
* セキュリティ: セキュリティ<8>.
* ライブラリ: ライブラリ<19>.
* ドキュメント: ドキュメント<7>.
* Core and Builtins: Core and Builtins<17>.
* ライブラリ: ライブラリ<20>.
* Core and Builtins: Core and Builtins<18>.
* ライブラリ: ライブラリ<21>.
* Core and Builtins: Core and Builtins<19>.
* ライブラリ: ライブラリ<22>.
* Core and Builtins: Core and Builtins<20>.
* C API: C API<6>.
* ビルド: ビルド<6>.


File: python.info,  Node: Windows<7>,  Next: テスト<4>,  Up: Python 3 14 0 beta 3

1.24.10.1 Windows
.................

   - gh-135099(1): Fix a crash that could occur on Windows when a
     background thread waits on a *note PyMutex: 484. while the main
     thread is shutting down the interpreter.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/135099


File: python.info,  Node: テスト<4>,  Next: セキュリティ<8>,  Prev: Windows<7>,  Up: Python 3 14 0 beta 3

1.24.10.2 テスト
................

   - gh-132815(1): Fix test__opcode: add ‘JUMP_BACKWARD’ to
     specialization stats.

   - gh-135489(2): Show verbose output for failing tests during PGO
     profiling step with -enable-optimizations.

   - gh-135120(3): Add ‘test.support.subTests()’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132815

   (2) https://github.com/python/cpython/issues/135489

   (3) https://github.com/python/cpython/issues/135120


File: python.info,  Node: セキュリティ<8>,  Next: ライブラリ<19>,  Prev: テスト<4>,  Up: Python 3 14 0 beta 3

1.24.10.3 セキュリティ
......................

   - gh-135462(1): Fix quadratic complexity in processing specially
     crafted input in *note html.parser.HTMLParser: a77.  End-of-file
     errors are now handled according to the HTML5 specs - comments and
     declarations are automatically closed, tags are ignored.

   - gh-135034(2): Fixes multiple issues that allowed ‘tarfile’
     extraction filters (‘filter="data"’ and ‘filter="tar"’) to be
     bypassed using crafted symlinks and hard links.

     Addresses CVE 2024-12718(3), CVE 2025-4138(4), CVE 2025-4330(5),
     and CVE 2025-4517(6).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/135462

   (2) https://github.com/python/cpython/issues/135034

   (3) https://www.cve.org/CVERecord?id=CVE-2024-12718

   (4) https://www.cve.org/CVERecord?id=CVE-2025-4138

   (5) https://www.cve.org/CVERecord?id=CVE-2025-4330

   (6) https://www.cve.org/CVERecord?id=CVE-2025-4517


File: python.info,  Node: ライブラリ<19>,  Next: ドキュメント<7>,  Prev: セキュリティ<8>,  Up: Python 3 14 0 beta 3

1.24.10.4 ライブラリ
....................

   - gh-65697(1): *note configparser: 26.'s error message when
     attempting to write an invalid key is now more helpful.

   - gh-135497(2): Fix *note os.getlogin(): 1822. failing for longer
     usernames on BSD-based platforms.

   - gh-135429(3): Fix the argument mismatch in ‘_lsprof’ for ‘PY_THROW’
     event.

   - gh-135368(4): Fix *note unittest.mock.Mock: c3f. generation on
     *note dataclasses.dataclass(): 4e1. objects.  Now all special
     attributes are set as it was before gh-124429(5).

   - gh-133967(6): Do not normalize *note locale: 8a. name 'C.UTF-8' to
     'en_US.UTF-8'.

   - gh-135321(7): Raise a correct exception for values greater than
     0x7fffffff for the ‘BINSTRING’ opcode in the C implementation of
     *note pickle: ab.

   - gh-135276(8): Backported bugfixes in zipfile.Path from zipp 3.23.
     Fixed ‘.name’, ‘.stem’ and other basename-based properties on
     Windows when working with a zipfile on disk.

   - gh-135244(9): *note uuid: 116.: when the MAC address cannot be
     determined, the 48-bit node ID is now generated with a
     cryptographically-secure pseudo-random number generator (CSPRNG) as
     per RFC 9562, §6.10.3(10).  This affects *note uuid1(): da1. and
     *note uuid6(): 2c2.

   - gh-134970(11): Fix the "unknown action" exception in *note
     argparse.ArgumentParser.add_argument_group(): 2eb. to correctly
     replace the action class.

   - gh-134718(12): *note ast.dump(): ae1. now only omits ‘None’ and
     ‘[]’ values if they are default values.

   - gh-134939(13): Add the *note concurrent.interpreters: 25. module.
     See PEP 734(14).

   - gh-134885(15): Fix possible crash in the *note compression.zstd:
     23. module related to setting parameter types.  Patch by Jelle
     Zijlstra.

   - gh-134857(16): Improve error report for *note doctest: 3e.s run
     with *note unittest: 10c.  Remove ‘doctest’ module frames from
     tracebacks and redundant newline character from a failure message.

   - gh-128840(17): Fix parsing long IPv6 addresses with embedded IPv4
     address.

   - gh-134637(18): Fix performance regression in calling a *note
     ctypes: 2e. function pointer in *note free threading: 1f4.

   - gh-134696(19): Built-in HACL* and OpenSSL implementations of hash
     function constructors now correctly accept the same 'documented'
     named arguments.  For instance, *note md5(): 1823. could be
     previously invoked as ‘md5(data=data)’ or ‘md5(string=string)’
     depending on the underlying implementation but these calls were not
     compatible.  Patch by Bénédikt Tran.

   - gh-134151(20): *note email: 3f.: Fix *note TypeError: 198. in *note
     email.utils.decode_params(): 1824. when sorting RFC 2231(21)
     continuations that contain an unnumbered section.

   - gh-134210(22): *note curses.window.getch(): 1825. now correctly
     handles signals.  Patch by Bénédikt Tran.

   - gh-134152(23): *note email: 3f.: Fix parsing of email message ID
     with invalid domain.

   - gh-133489(24): *note random.getrandbits(): 120f. can now generate
     more that 2^31 bits.  *note random.randbytes(): 1826. can now
     generate more that 256 MiB.

   - gh-132813(25): Improve error messages for incorrect types and
     values of *note csv.Dialect: 1827. attributes.

   - gh-132969(26): Prevent the *note ProcessPoolExecutor: 1d6. executor
     thread, which remains running when *note shutdown(wait=False): aea,
     from attempting to adjust the pool's worker processes after the
     object state has already been reset during shutdown.  A combination
     of conditions, including a worker process having terminated
     abormally, resulted in an exception and a potential hang when the
     still-running executor thread attempted to replace dead workers
     within the pool.

   - gh-127081(27): Fix libc thread safety issues with *note os: a5. by
     replacing ‘getlogin’ with ‘getlogin_r’ re-entrant version.

   - gh-131884(28): Fix formatting issues in *note json.dump(): f40.
     when both 'indent' and 'skipkeys' are used.

   - gh-130999(29): Avoid exiting the new REPL and offer suggestions
     even if there are non-string candidates when errors occur.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/65697

   (2) https://github.com/python/cpython/issues/135497

   (3) https://github.com/python/cpython/issues/135429

   (4) https://github.com/python/cpython/issues/135368

   (5) https://github.com/python/cpython/issues/124429

   (6) https://github.com/python/cpython/issues/133967

   (7) https://github.com/python/cpython/issues/135321

   (8) https://github.com/python/cpython/issues/135276

   (9) https://github.com/python/cpython/issues/135244

   (10) 
https://datatracker.ietf.org/doc/html/rfc9562.html#section-6.10-3

   (11) https://github.com/python/cpython/issues/134970

   (12) https://github.com/python/cpython/issues/134718

   (13) https://github.com/python/cpython/issues/134939

   (14) https://peps.python.org/pep-0734/

   (15) https://github.com/python/cpython/issues/134885

   (16) https://github.com/python/cpython/issues/134857

   (17) https://github.com/python/cpython/issues/128840

   (18) https://github.com/python/cpython/issues/134637

   (19) https://github.com/python/cpython/issues/134696

   (20) https://github.com/python/cpython/issues/134151

   (21) https://datatracker.ietf.org/doc/html/rfc2231.html

   (22) https://github.com/python/cpython/issues/134210

   (23) https://github.com/python/cpython/issues/134152

   (24) https://github.com/python/cpython/issues/133489

   (25) https://github.com/python/cpython/issues/132813

   (26) https://github.com/python/cpython/issues/132969

   (27) https://github.com/python/cpython/issues/127081

   (28) https://github.com/python/cpython/issues/131884

   (29) https://github.com/python/cpython/issues/130999


File: python.info,  Node: ドキュメント<7>,  Next: Core and Builtins<17>,  Prev: ライブラリ<19>,  Up: Python 3 14 0 beta 3

1.24.10.5 ドキュメント
......................

   - gh-135171(1): Document that the *note iterator: 4c8. for the
     leftmost ‘for’ clause in the generator expression is created
     immediately.

   - bpo-45210(2): Document that error indicator may be set in
     tp_dealloc, and how to avoid clobbering it.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/135171

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45210


File: python.info,  Node: Core and Builtins<17>,  Next: ライブラリ<20>,  Prev: ドキュメント<7>,  Up: Python 3 14 0 beta 3

1.24.10.6 Core and Builtins
...........................

   - gh-135496(1): Fix typo in the f-string conversion type error
     ("exclamanation" -> "exclamation").

   - gh-135371(2): Fixed *note asyncio: b. debugging tools to properly
     display internal coroutine call stacks alongside external task
     dependencies.  The ‘python -m asyncio ps’ and ‘python -m asyncio
     pstree’ commands now show complete execution context.  Patch by
     Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/135496

   (2) https://github.com/python/cpython/issues/135371


File: python.info,  Node: ライブラリ<20>,  Next: Core and Builtins<18>,  Prev: Core and Builtins<17>,  Up: Python 3 14 0 beta 3

1.24.10.7 ライブラリ
....................

   - gh-127319(1): Set the ‘allow_reuse_port’ class variable to ‘False’
     on the XMLRPC, logging, and HTTP servers.  This matches the
     behavior in prior Python releases, which is to not allow port
     reuse.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127319


File: python.info,  Node: Core and Builtins<18>,  Next: ライブラリ<21>,  Prev: ライブラリ<20>,  Up: Python 3 14 0 beta 3

1.24.10.8 Core and Builtins
...........................

   - gh-135171(1): Reverts the behavior of async generator expressions
     when created with object w/o __aiter__ method to the pre-3.13
     behavior of raising a TypeError.

   - gh-130077(2): Properly raise custom syntax errors when incorrect
     syntax containing names that are prefixes of soft keywords is
     encountered.  Patch by Pablo Galindo.

   - gh-135171(3): Reverts the behavior of generator expressions when
     created with a non-iterable to the pre-3.13 behavior of raising a
     TypeError.  It is no longer possible to cause a crash in the
     debugger by altering the generator expression's local variables.
     This is achieved by moving the ‘GET_ITER’ instruction back to the
     creation of the generator expression and adding an additional check
     to ‘FOR_ITER’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/135171

   (2) https://github.com/python/cpython/issues/130077

   (3) https://github.com/python/cpython/issues/135171


File: python.info,  Node: ライブラリ<21>,  Next: Core and Builtins<19>,  Prev: Core and Builtins<18>,  Up: Python 3 14 0 beta 3

1.24.10.9 ライブラリ
....................

   - gh-116738(1): Make methods in *note heapq: 6d. thread-safe on the
     *note free threaded: 1f4. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116738


File: python.info,  Node: Core and Builtins<19>,  Next: ライブラリ<22>,  Prev: ライブラリ<21>,  Up: Python 3 14 0 beta 3

1.24.10.10 Core and Builtins
............................

   - gh-134876(1): Add support to PEP 768(2) remote debugging for Linux
     kernels which don't have CONFIG_CROSS_MEMORY_ATTACH configured.

   - gh-134889(3): Fix handling of a few opcodes that leave operands on
     the stack when optimizing ‘LOAD_FAST’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/134876

   (2) https://peps.python.org/pep-0768/

   (3) https://github.com/python/cpython/issues/134889


File: python.info,  Node: ライブラリ<22>,  Next: Core and Builtins<20>,  Prev: Core and Builtins<19>,  Up: Python 3 14 0 beta 3

1.24.10.11 ライブラリ
.....................

   - gh-134908(1): Fix crash when iterating over lines in a text file on
     the *note free threaded: 1f4. build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/134908


File: python.info,  Node: Core and Builtins<20>,  Next: C API<6>,  Prev: ライブラリ<22>,  Up: Python 3 14 0 beta 3

1.24.10.12 Core and Builtins
............................

   - gh-132617(1): Fix *note dict.update(): 167e. modification check
     that could incorrectly raise a "dict mutated during update" error
     when a different dictionary was modified that happens to share the
     same underlying keys object.

   - gh-134679(2): Fix crash in the *note free threading: 1f4. build's
     QSBR code that could occur when changing an object's ‘__dict__’
     attribute.

   - gh-127682(3): No longer call ‘__iter__’ twice in list
     comprehensions.  This brings the behavior of list comprehensions in
     line with other forms of iteration

   - gh-133912(4): Fix the C API function ‘PyObject_GenericSetDict’ to
     handle extension classes with inline values.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132617

   (2) https://github.com/python/cpython/issues/134679

   (3) https://github.com/python/cpython/issues/127682

   (4) https://github.com/python/cpython/issues/133912


File: python.info,  Node: C API<6>,  Next: ビルド<6>,  Prev: Core and Builtins<20>,  Up: Python 3 14 0 beta 3

1.24.10.13 C API
................

   - gh-134989(1): Fix ‘Py_RETURN_NONE’, ‘Py_RETURN_TRUE’ and
     ‘Py_RETURN_FALSE’ macros in the limited C API 3.11 and older: don't
     treat ‘Py_None’, ‘Py_True’ and ‘Py_False’ as immortal.  Patch by
     Victor Stinner.

   - gh-134989(2): Implement *note PyObject_DelAttr(): 1831. and *note
     PyObject_DelAttrString(): 1832. as macros in the limited C API 3.12
     and older.  Patch by Victor Stinner.

   - gh-133968(3): Add *note PyUnicodeWriter_WriteASCII(): 3b9. function
     to write an ASCII string into a *note PyUnicodeWriter: 3b3.  The
     function is faster than *note PyUnicodeWriter_WriteUTF8(): 3bf, but
     has an undefined behavior if the input string contains non-ASCII
     characters.  Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/134989

   (2) https://github.com/python/cpython/issues/134989

   (3) https://github.com/python/cpython/issues/133968


File: python.info,  Node: ビルド<6>,  Prev: C API<6>,  Up: Python 3 14 0 beta 3

1.24.10.14 ビルド
.................

   - gh-119132(1): Remove "experimental" tag from the CPython
     free-threading build.

   - gh-135497(2): Fix the detection of ‘MAXLOGNAME’ in the
     ‘configure.ac’ script.

   - gh-134923(3): Windows builds with profile-guided optimization
     enabled now use ‘/GENPROFILE’ and ‘/USEPROFILE’ instead of
     deprecated ‘/LTCG:’ options.

   - gh-134774(4): Fix *note Py_DEBUG: 1834. macro redefinition warnings
     on Windows debug builds.  Patch by Chris Eibl.

   - gh-134632(5): Fixed ‘build-details.json’ generation to use
     ‘INCLUDEPY’, in order to reference the ‘pythonX.Y’ subdirectory of
     the include directory, as required in PEP 739(6), instead of the
     top-level include directory.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/119132

   (2) https://github.com/python/cpython/issues/135497

   (3) https://github.com/python/cpython/issues/134923

   (4) https://github.com/python/cpython/issues/134774

   (5) https://github.com/python/cpython/issues/134632

   (6) https://peps.python.org/pep-0739/


File: python.info,  Node: Python 3 14 0 beta 2,  Next: Python 3 14 0 beta 1,  Prev: Python 3 14 0 beta 3,  Up: 変更履歴

1.24.11 Python 3.14.0 beta 2
----------------------------

'Release date: 2025-05-26'

* Menu:

* Windows: Windows<8>.
* Tools/Demos: Tools/Demos<7>.
* テスト: テスト<5>.
* セキュリティ: セキュリティ<9>.
* ライブラリ: ライブラリ<23>.
* Core and Builtins: Core and Builtins<21>.
* C API: C API<7>.
* ビルド: ビルド<7>.


File: python.info,  Node: Windows<8>,  Next: Tools/Demos<7>,  Up: Python 3 14 0 beta 2

1.24.11.1 Windows
.................

   - gh-130727(1): Fix a race in internal calls into WMI that can result
     in an "invalid handle" exception under high load.  Patch by Chris
     Eibl.

   - gh-76023(2): Make *note os.path.realpath(): 262. ignore Windows
     error 1005 when in non-strict mode.

   - gh-133779(3): Reverts the change to generate different ‘pyconfig.h’
     files based on compiler settings, as it was frequently causing
     extension builds to break.  In particular, the ‘Py_GIL_DISABLED’
     preprocessor variable must now always be defined explicitly when
     compiling for the experimental free-threaded runtime.  The *note
     sysconfig.get_config_var(): 174. function can be used to determine
     whether the current runtime was compiled with that flag or not.

   - gh-133626(4): Ensures packages are not accidentally bundled into
     the traditional installer.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/130727

   (2) https://github.com/python/cpython/issues/76023

   (3) https://github.com/python/cpython/issues/133779

   (4) https://github.com/python/cpython/issues/133626


File: python.info,  Node: Tools/Demos<7>,  Next: テスト<5>,  Prev: Windows<8>,  Up: Python 3 14 0 beta 2

1.24.11.2 Tools/Demos
.....................

   - gh-134215(1): *note REPL: 491. import autocomplete only suggests
     private modules when explicitly specified.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/134215


File: python.info,  Node: テスト<5>,  Next: セキュリティ<9>,  Prev: Tools/Demos<7>,  Up: Python 3 14 0 beta 2

1.24.11.3 テスト
................

   - gh-133744(1): Fix multiprocessing interrupt test.  Add an event to
     synchronize the parent process with the child process: wait until
     the child process starts sleeping.  Patch by Victor Stinner.

   - gh-133682(2): Fixed test case
     ‘test.test_annotationlib.TestStringFormat.test_displays’ which
     ensures proper handling of complex data structures (lists, sets,
     dictionaries, and tuples) in string annotations.

   - gh-133639(3): Fix ‘TestPyReplAutoindent.test_auto_indent_default()’
     doesn't run ‘input_code’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/133744

   (2) https://github.com/python/cpython/issues/133682

   (3) https://github.com/python/cpython/issues/133639


File: python.info,  Node: セキュリティ<9>,  Next: ライブラリ<23>,  Prev: テスト<5>,  Up: Python 3 14 0 beta 2

1.24.11.4 セキュリティ
......................

   - gh-133767(1): Fix use-after-free in the "unicode-escape" decoder
     with a non-"strict" error handler.

   - gh-128840(2): Short-circuit the processing of long IPv6 addresses
     early in *note ipaddress: 84. to prevent excessive memory
     consumption and a minor denial-of-service.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/133767

   (2) https://github.com/python/cpython/issues/128840


File: python.info,  Node: ライブラリ<23>,  Next: Core and Builtins<21>,  Prev: セキュリティ<9>,  Up: Python 3 14 0 beta 2

1.24.11.5 ライブラリ
....................

   - gh-132710(1): If possible, ensure that *note uuid.getnode(): da0.
     returns the same result even across different processes.
     Previously, the result was constant only within the same process.
     Patch by Bénédikt Tran.

   - gh-80334(2): *note multiprocessing.freeze_support(): 183b. now
     checks for work on any "spawn" start method platform rather than
     only on Windows.

   - gh-134582(3): Fix tokenize.untokenize() round-trip errors related
     to t-strings braces escaping

   - gh-134546(4): Ensure *note pdb: aa. remote debugging script is
     readable by remote Python process.

   - gh-134451(5): Converted ‘asyncio.tools.CycleFoundException’ from
     dataclass to a regular exception type.

   - gh-114177(6): Fix *note asyncio: b. to not close subprocess pipes
     which would otherwise error out when the event loop is already
     closed.

   - gh-90871(7): Fixed an off by one error concerning the backlog
     parameter in *note create_unix_server(): 4ca.  Contributed by
     Christian Harries.

   - gh-134323(8): Fix the *note threading.RLock.locked(): 183c. method.

   - gh-86802(9): Fixed asyncio memory leak in cancelled shield tasks.
     For shielded tasks where the shield was cancelled, log potential
     exceptions through the exception handler.  Contributed by Christian
     Harries.

   - gh-134209(10): *note curses: 2f.: The *note curses.window.instr():
     183d. and *note curses.window.getstr(): 183e. methods now allocate
     their internal buffer on the heap instead of the stack; in
     addition, the max buffer size is increased from 1023 to 2047.

   - gh-134235(11): Updated tab completion on REPL to include builtin
     modules.  Contributed by Tom Wang, Hunter Young

   - gh-134152(12): Fixed *note UnboundLocalError: 174f. that could
     occur during *note email: 3f. header parsing if an expected
     trailing delimiter is missing in some contexts.

   - gh-134168(13): *note http.server: 76.: Fix IPv6 address binding and
     *note -directory: 183f. handling when using HTTPS.

   - gh-62184(14): Remove import of C implementation of *note io.FileIO:
     1527. from Python implementation which has its own implementation

   - gh-133982(15): Emit *note RuntimeWarning: 4d7. in the Python
     implementation of *note io: 83. when the *note file-like object:
     13db. is not closed explicitly in the presence of multiple I/O
     layers.

   - gh-133890(16): The *note tarfile: e4. module now handles *note
     UnicodeEncodeError: 887. in the same way as *note OSError: 2c0.
     when cannot extract a member.

   - gh-134097(17): Fix interaction of the new *note REPL: 491. and
     *note -X showrefcount: 16f. command line option.

   - gh-133889(18): The generated directory listing page in *note
     http.server.SimpleHTTPRequestHandler: d38. now only shows the
     decoded path component of the requested URL, and not the query and
     fragment.

   - gh-134098(19): Fix handling paths that end with a percent-encoded
     slash (‘%2f’ or ‘%2F’) in *note
     http.server.SimpleHTTPRequestHandler: d38.

   - gh-132124(20): On POSIX-compliant systems,
     ‘multiprocessing.util.get_temp_dir()’ now ignores ‘TMPDIR’ (and
     similar environment variables) if the path length of ‘AF_UNIX’
     socket files exceeds the platform-specific maximum length when
     using the *note forkserver: 1d4. start method.  Patch by Bénédikt
     Tran.

   - gh-134062(21): *note ipaddress: 84.: fix collisions in *note
     __hash__(): cf3. for *note IPv4Network: 50e. and *note IPv6Network:
     50f. objects.

   - gh-133970(22): Make ‘string.templatelib.Template’ and
     ‘string.templatelib.Interpolation’ generic.

   - gh-71253(23): Raise *note ValueError: 2ec. in *note open(): 316. if
     'opener' returns a negative file-descriptor in the Python
     implementation of *note io: 83. to match the C implementation.

   - gh-133960(24): Simplify and improve *note
     typing.evaluate_forward_ref(): 1815.  It now no longer raises
     errors on certain invalid types.  In several situations, it is now
     able to evaluate forward references that were previously
     unsupported.

   - gh-133925(25): Make the private class ‘typing._UnionGenericAlias’
     hashable.

   - gh-133653(26): Fix *note argparse.ArgumentParser: 1bd. with the
     'formatter_class' argument.  Fix TypeError when 'formatter_class'
     is a custom subclass of ‘HelpFormatter’.  Fix TypeError when
     'formatter_class' is not a subclass of ‘HelpFormatter’ and
     non-standard 'prefix_char' is used.  Fix support of colorizing when
     'formatter_class' is not a subclass of ‘HelpFormatter’.

   - gh-132641(27): Fixed a race in *note functools.lru_cache(): be2.
     under free-threading.

   - gh-133783(28): Fix bug with applying *note copy.replace(): 1c0. to
     *note ast: 9. objects.  Attributes that default to ‘None’ were
     incorrectly treated as required for manually created AST nodes.

   - gh-133684(29): Fix bug where *note annotationlib.get_annotations():
     459. would return the wrong result for certain classes that are
     part of a class hierarchy where ‘from __future__ import
     annotations’ is used.

   - gh-77057(30): Fix handling of invalid markup declarations in *note
     html.parser.HTMLParser: a77.

   - gh-130328(31): Speedup pasting in ‘PyREPL’ on Windows in a legacy
     console.  Patch by Chris Eibl.

   - gh-133701(32): Fix bug where *note typing.TypedDict: 332. classes
     defined under ‘from __future__ import annotations’ and inheriting
     from another ‘TypedDict’ had an incorrect ‘__annotations__’
     attribute.

   - gh-133581(33): Improve unparsing of t-strings in *note
     ast.unparse(): ae2. and ‘from __future__ import annotations’.
     Empty t-strings now round-trip correctly and formatting in
     interpolations is preserved.  Patch by Jelle Zijlstra.

   - gh-133551(34): Support t-strings ( PEP 750(35)) in *note
     annotationlib: 6.  Patch by Jelle Zijlstra.

   - gh-133439(36): Fix dot commands with trailing spaces are mistaken
     for multi-line SQL statements in the sqlite3 command-line
     interface.

   - gh-132493(37): Avoid accessing ‘__annotations__’ unnecessarily in
     *note inspect.signature(): 22f.

   - gh-132876(38): ‘ldexp()’ on Windows doesn't round subnormal results
     before Windows 11, but should.  Python's *note math.ldexp(): 1840.
     wrapper now does round them, so results may change slightly, in
     rare cases of very small results, on Windows versions before 11.

   - gh-133009(39): *note xml.etree.ElementTree: 12b.: Fix a crash in
     *note Element.__deepcopy__: 17e1. when the element is concurrently
     mutated.  Patch by Bénédikt Tran.

   - gh-91555(40): Ignore log messages generated during handling of log
     messages, to avoid deadlock or infinite recursion.  [NOTE: This
     change has since been reverted.]

   - gh-125028(41): *note functools.Placeholder: 216. cannot be passed
     to *note functools.partial(): 217. as a keyword argument.

   - gh-62824(42): Fix aliases for ‘iso8859_8’ encoding.  Patch by Dave
     Goncalves.

   - gh-86155(43): *note html.parser.HTMLParser.close(): 1841. no longer
     loses data when the ‘<script>’ tag is not closed.  Patch by Waylan
     Limberg.

   - gh-69426(44): Fix *note html.parser.HTMLParser: a77. to not
     unescape character entities in attribute values if they are
     followed by an ASCII alphanumeric or an equals sign.

   - bpo-28494(45): Improve Zip file validation false positive rate in
     *note zipfile.is_zipfile(): 1542.

   - gh-134381(46): Fix *note RuntimeError: 244. when using a
     not-started *note threading.Thread: 176. after calling *note
     os.fork(): 4b5.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132710

   (2) https://github.com/python/cpython/issues/80334

   (3) https://github.com/python/cpython/issues/134582

   (4) https://github.com/python/cpython/issues/134546

   (5) https://github.com/python/cpython/issues/134451

   (6) https://github.com/python/cpython/issues/114177

   (7) https://github.com/python/cpython/issues/90871

   (8) https://github.com/python/cpython/issues/134323

   (9) https://github.com/python/cpython/issues/86802

   (10) https://github.com/python/cpython/issues/134209

   (11) https://github.com/python/cpython/issues/134235

   (12) https://github.com/python/cpython/issues/134152

   (13) https://github.com/python/cpython/issues/134168

   (14) https://github.com/python/cpython/issues/62184

   (15) https://github.com/python/cpython/issues/133982

   (16) https://github.com/python/cpython/issues/133890

   (17) https://github.com/python/cpython/issues/134097

   (18) https://github.com/python/cpython/issues/133889

   (19) https://github.com/python/cpython/issues/134098

   (20) https://github.com/python/cpython/issues/132124

   (21) https://github.com/python/cpython/issues/134062

   (22) https://github.com/python/cpython/issues/133970

   (23) https://github.com/python/cpython/issues/71253

   (24) https://github.com/python/cpython/issues/133960

   (25) https://github.com/python/cpython/issues/133925

   (26) https://github.com/python/cpython/issues/133653

   (27) https://github.com/python/cpython/issues/132641

   (28) https://github.com/python/cpython/issues/133783

   (29) https://github.com/python/cpython/issues/133684

   (30) https://github.com/python/cpython/issues/77057

   (31) https://github.com/python/cpython/issues/130328

   (32) https://github.com/python/cpython/issues/133701

   (33) https://github.com/python/cpython/issues/133581

   (34) https://github.com/python/cpython/issues/133551

   (35) https://peps.python.org/pep-0750/

   (36) https://github.com/python/cpython/issues/133439

   (37) https://github.com/python/cpython/issues/132493

   (38) https://github.com/python/cpython/issues/132876

   (39) https://github.com/python/cpython/issues/133009

   (40) https://github.com/python/cpython/issues/91555

   (41) https://github.com/python/cpython/issues/125028

   (42) https://github.com/python/cpython/issues/62824

   (43) https://github.com/python/cpython/issues/86155

   (44) https://github.com/python/cpython/issues/69426

   (45) https://bugs.python.org/issue?@action=redirect&bpo=28494

   (46) https://github.com/python/cpython/issues/134381


File: python.info,  Node: Core and Builtins<21>,  Next: C API<7>,  Prev: ライブラリ<23>,  Up: Python 3 14 0 beta 2

1.24.11.6 Core and Builtins
...........................

   - gh-127960(1): PyREPL interactive shell no longer starts with
     ‘__package__’ and ‘__file__’ global names set to ‘_pyrepl’ package
     internals.  Contributed by Yuichiro Tachibana.

   - gh-130397(2): Remove special-casing for C stack depth limits for
     WASI. Due to WebAssembly's built-in stack protection this does not
     pose a security concern.

   - gh-128066(3): Fixes an edge case where PyREPL improperly threw an
     error when Python is invoked on a read only filesystem while trying
     to write history file entries.

   - gh-69605(4): When auto-completing an import in the *note REPL: 491,
     finding no candidates now issues no suggestion, rather than
     suggestions from the current namespace.

   - gh-134158(5): Fix coloring of double braces in f-strings and
     t-strings in the *note REPL: 491.

   - gh-134119(6): Fix crash when calling *note next(): 9d8. on an
     exhausted template string iterator.  Patch by Jelle Zijlstra.

   - gh-134100(7): Fix a use-after-free bug that occurs when an imported
     module isn't in *note sys.modules: 17e6. after its initial import.
     Patch by Nico-Posada.

   - gh-133999(8): Fix *note SyntaxError: 18e. regression in *note
     except: 1ab. parsing after gh-123440(9).

   - gh-133886(10): Fix *note sys.remote_exec(): 16d. for non-ASCII
     paths in non-UTF-8 locales and non-UTF-8 paths in UTF-8 locales.

   - gh-133703(11): Fix hashtable in dict can be bigger than intended in
     some situations.

   - gh-133778(12): Fix bug where assigning to the *note
     __annotations__: 1843. attributes of classes defined under ‘from
     __future__ import annotations’ had no effect.

   - gh-132762(13): *note fromkeys(): 24e. no longer loops forever when
     adding a small set of keys to a large base dict.  Patch by Angela
     Liss.

   - gh-133541(14): Inconsistent indentation in user input crashed the
     new REPL when syntax highlighting was active.  This is now fixed.

   - gh-133516(15): Raise *note ValueError: 2ec. when constants ‘True’,
     ‘False’ or ‘None’ are used as an identifier after NFKC
     normalization.

   - gh-132542(16): Update *note Thread.native_id: c33. after
     ‘fork(2)(17)’ to ensure accuracy.  Patch by Noam Cohen.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127960

   (2) https://github.com/python/cpython/issues/130397

   (3) https://github.com/python/cpython/issues/128066

   (4) https://github.com/python/cpython/issues/69605

   (5) https://github.com/python/cpython/issues/134158

   (6) https://github.com/python/cpython/issues/134119

   (7) https://github.com/python/cpython/issues/134100

   (8) https://github.com/python/cpython/issues/133999

   (9) https://github.com/python/cpython/issues/123440

   (10) https://github.com/python/cpython/issues/133886

   (11) https://github.com/python/cpython/issues/133703

   (12) https://github.com/python/cpython/issues/133778

   (13) https://github.com/python/cpython/issues/132762

   (14) https://github.com/python/cpython/issues/133541

   (15) https://github.com/python/cpython/issues/133516

   (16) https://github.com/python/cpython/issues/132542

   (17) https://manpages.debian.org/fork(2)


File: python.info,  Node: C API<7>,  Next: ビルド<7>,  Prev: Core and Builtins<21>,  Up: Python 3 14 0 beta 2

1.24.11.7 C API
...............

   - gh-134144(1): Fix crash when calling *note Py_EndInterpreter():
     1845. with a *note thread state: 1846. that isn't the initial
     thread for the interpreter.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/134144


File: python.info,  Node: ビルド<7>,  Prev: C API<7>,  Up: Python 3 14 0 beta 2

1.24.11.8 ビルド
................

   - gh-134455(1): Fixed ‘build-details.json’ generation to use the
     correct ‘c_api.headers’ as defined in PEP 739(2), instead of
     ‘c_api.include’.

   - gh-131769(3): Fix detecting when the build Python in a cross-build
     is a pydebug build.

   - gh-117088(4): AIX linker don't support -h option, so avoid it
     through platform check

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/134455

   (2) https://peps.python.org/pep-0739/

   (3) https://github.com/python/cpython/issues/131769

   (4) https://github.com/python/cpython/issues/117088


File: python.info,  Node: Python 3 14 0 beta 1,  Next: Python 3 14 0 alpha 7,  Prev: Python 3 14 0 beta 2,  Up: 変更履歴

1.24.12 Python 3.14.0 beta 1
----------------------------

'Release date: 2025-05-06'

* Menu:

* Windows: Windows<9>.
* Tools/Demos: Tools/Demos<8>.
* テスト: テスト<6>.
* セキュリティ: セキュリティ<10>.
* ライブラリ: ライブラリ<24>.
* IDLE: IDLE<5>.
* ドキュメント: ドキュメント<8>.
* Core and Builtins: Core and Builtins<22>.
* ライブラリ: ライブラリ<25>.
* Core and Builtins: Core and Builtins<23>.
* ライブラリ: ライブラリ<26>.
* Core and Builtins: Core and Builtins<24>.
* ライブラリ: ライブラリ<27>.
* C API: C API<8>.
* ビルド: ビルド<8>.


File: python.info,  Node: Windows<9>,  Next: Tools/Demos<8>,  Up: Python 3 14 0 beta 1

1.24.12.1 Windows
.................

   - gh-132930(1): Marks the installer for Windows as deprecated and
     updates documentation to cover the new Python install manager.

   - gh-127405(2): Add ‘ABIFLAGS’ to *note sysconfig.get_config_vars():
     298. on Windows.  Patch by Xuehai Pan.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132930

   (2) https://github.com/python/cpython/issues/127405


File: python.info,  Node: Tools/Demos<8>,  Next: テスト<6>,  Prev: Windows<9>,  Up: Python 3 14 0 beta 1

1.24.12.2 Tools/Demos
.....................

   - gh-130453(1): Allow passing multiple keyword arguments with the
     same function name in ‘pygettext’.

   - gh-130195(2): Add warning messages when ‘pygettext’ unimplemented
     ‘-a/--extract-all’ option is called.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/130453

   (2) https://github.com/python/cpython/issues/130195


File: python.info,  Node: テスト<6>,  Next: セキュリティ<10>,  Prev: Tools/Demos<8>,  Up: Python 3 14 0 beta 1

1.24.12.3 テスト
................

   - gh-133131(1): The iOS testbed will now select the most recently
     released "SE-class" device for testing if a device isn't explicitly
     specified.

   - gh-91048(2): Add ability to externally inspect all pending asyncio
     tasks, even if no task is currently entered on the event loop.

   - gh-109981(3): The test helper that counts the list of open file
     descriptors now uses the optimised ‘/dev/fd’ approach on all Apple
     platforms, not just macOS. This avoids crashes caused by guarded
     file descriptors.

   - gh-132678(4): Add ‘--prioritize’ to ‘-m test’.  This option allows
     the user to specify which selected tests should execute first, even
     if the order is otherwise randomized.  This is particularly useful
     for tests that run the longest.

   - gh-131290(5): Tests in ‘Lib/test’ can now be correctly executed as
     standalone scripts.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/133131

   (2) https://github.com/python/cpython/issues/91048

   (3) https://github.com/python/cpython/issues/109981

   (4) https://github.com/python/cpython/issues/132678

   (5) https://github.com/python/cpython/issues/131290


File: python.info,  Node: セキュリティ<10>,  Next: ライブラリ<24>,  Prev: テスト<6>,  Up: Python 3 14 0 beta 1

1.24.12.4 セキュリティ
......................

   - gh-115322(1): The underlying extension modules behind *note
     readline: bf.:, *note subprocess: dc, and *note ctypes: 2e. now
     raise audit events on previously uncovered code paths that could
     lead to file system access related to C function calling and
     external binary execution.  The ‘ctypes.call_function’ audit hook
     has also been fixed to use an unsigned value for its ‘function
     pointer’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115322


File: python.info,  Node: ライブラリ<24>,  Next: IDLE<5>,  Prev: セキュリティ<10>,  Up: Python 3 14 0 beta 1

1.24.12.5 ライブラリ
....................

   - gh-133490(1): Add color support to PDB in remote mode.

   - gh-132493(2): Avoid eagerly evaluating annotations in functions
     decorated with *note reprlib.recursive_repr(): 140c.

   - gh-130645(3): Add color to stdlib argparse CLIs.  Patch by Hugo van
     Kemenade.

   - gh-119180(4): Make *note annotationlib.get_annotations(): 459.
     succeed with the ‘FORWARDREF’ format if evaluating the annotations
     throws an exception other than *note NameError: 452. or *note
     AttributeError: 5f0.

   - gh-133351(5): Fix remote PDB to correctly request tab completions
     for Python expressions from the server when completing a
     continuation line of a multi-line Python block.

   - gh-133367(6): Add the ‘--feature-version’, ‘--optimize’, and
     ‘--show-empty’ options to the *note ast: 9. command-line interface.
     Patch by Semyon Moroz.

   - gh-133363(7): The *note cmd.Cmd: 184e. class has been fixed to
     reliably call the ‘completedefault’ method whenever the ‘do_shell’
     method is not defined and tab completion is requested for a line
     beginning with ‘!’.

   - gh-113081(8): Highlight syntax on source code in *note pdb: aa.

   - gh-133349(9): Introduced auto-indent in *note pdb: aa. multi-line
     input.

   - gh-133306(10): Use ‘\z’ instead of ‘\Z’ in *note
     fnmatch.translate(): 184f. and *note glob.translate(): 4fb.

   - gh-133306(11): Support ‘\z’ as a synonym for ‘\Z’ in *note regular
     expressions: be.

   - gh-133300(12): Make *note argparse.ArgumentParser: 1bd.'s
     ‘suggest_on_error’ a keyword-only parameter.  Patch by Hugo van
     Kemenade.

   - gh-133290(13): Fix attribute caching issue when setting *note
     ctypes._Pointer._type_: 1850. in the undocumented and deprecated
     ‘ctypes.SetPointerType()’ function and the undocumented
     ‘set_type()’ method.

   - gh-133223(14): When PDB is attached to a remote process, do a
     better job of intercepting Ctrl+C and forwarding it to the remote
     process.

   - gh-133153(15): Do not complete *note pdb: aa. commands in
     ‘interact’ mode of *note pdb: aa.

   - gh-133139(16): Add the *note curses.assume_default_colors(): 1f6.
     function, a refinement of the *note curses.use_default_colors():
     1f7. function which allows to change the color pair ‘0’.

   - gh-133089(17): Use original timeout value for *note
     subprocess.TimeoutExpired: 17ab. when the func *note
     subprocess.run(): d7f. is called with a timeout instead of
     sometimes a confusing partial remaining time out value used
     internally on the final ‘wait()’.

   - gh-133036(18): *note codecs.open(): 315. is now deprecated.  Use
     *note open(): 316. instead.  Contributed by Inada Naoki.

   - gh-132987(19): Many builtin and extension functions which accept an
     unsigned integer argument, now use *note __index__(): 19e. if
     available.

   - gh-124703(20): Set return code to ‘1’ when aborting process from
     *note pdb: aa.

   - gh-133005(21): Support passing ‘preset’ option to *note
     tarfile.open(): 1077. when using ‘'w|xz'’ mode.

   - gh-115032(22): Support for custom logging handlers with the 'strm'
     argument is deprecated and scheduled for removal in Python 3.16.
     Define handlers with the 'stream' argument instead.  Patch by
     Mariusz Felisiak.

   - gh-132991(23): Add ‘socket.IP_FREEBIND’ constant on Linux 2.4 and
     later.

   - gh-132995(24): Bump the version of pip bundled in ensurepip to
     version 25.1.1

   - gh-132933(25): The zipapp module now applies the filter when
     creating the list of files to add, rather than waiting until the
     file is being added to the archive.

   - gh-121249(26): Always support the float complex and double complex
     C types in the *note struct: db. module.  Patch by Sergey B
     Kirpichev.

   - gh-132915(27): *note fcntl.fcntl(): 1851. and *note fcntl.ioctl():
     1694. can now detect a buffer overflow and raise *note SystemError:
     795.  The stack and memory can be corrupted in such case, so treat
     this error as fatal.

   - gh-132017(28): Fix error when ‘pyrepl’ is suspended, then resumed
     and terminated.

   - gh-132893(29): Improved *note statistics.NormalDist.cdf(): 1852.
     accuracy for inputs smaller than the mean.

   - gh-130328(30): Speedup pasting in ‘PyREPL’ on Windows.  Fix by
     Chris Eibl.

   - gh-132882(31): Fix copying of *note typing.Union: 2a8. objects
     containing objects that do not support the ‘|’ operator.

   - gh-93696(32): Fixed the breakpoint display error for frozen modules
     in *note pdb: aa.

   - gh-129965(33): Add MIME types for ‘.7z’, ‘.apk’, ‘.deb’, ‘.glb’,
     ‘.gltf’, ‘.gz’, ‘.m4v’, ‘.php’, ‘.rar’, ‘.rpm’, ‘.stl’ and ‘.wmv’.
     Patch by Hugo van Kemenade.

   - gh-132742(34): *note fcntl.fcntl(): 1851. now supports arbitrary
     *note bytes-like objects: 193, not only *note bytes: 192.  *note
     fcntl.ioctl(): 1694. now automatically retries system calls failing
     with EINTR and releases the GIL during a system call even for large
     bytes-like object.

   - gh-132451(35): The CLI for the PDB debugger now accepts a ‘-p PID’
     argument to allow attaching to a running process.  The process must
     be running the same version of Python as the one running PDB.

   - gh-125618(36): Add a 'format' parameter to *note
     annotationlib.ForwardRef.evaluate(): 17b2.  Evaluating annotations
     in the ‘FORWARDREF’ format now succeeds in more cases that would
     previously have raised an exception.

   - gh-132805(37): Fix incorrect handling of nested non-constant values
     in the FORWARDREF format in *note annotationlib: 6.

   - gh-132734(38): Add new constants for Bluetooth *note sockets: d1.

   - gh-132673(39): Fix *note AssertionError: 8b8. raised on *note
     ctypes.Structure: 1e5. with ‘_align_ = 0’ and ‘_fields_ = []’.

   - gh-132578(40): Rename the ‘threading.Thread._handle’ field to avoid
     shadowing methods defined on subclasses of ‘threading.Thread’.

   - gh-132561(41): Fix the public ‘locked’ method of
     ‘multiprocessing.SemLock’ class.  Also adding 2 tests for the
     derivated *note multiprocessing.Lock: 1853. and *note
     multiprocessing.RLock: 1854. classes.

   - gh-121468(42): Add *note pdb.set_trace_async(): 279. function to
     support *note await: 18d. statements in *note pdb: aa.

   - gh-132493(43): *note typing.Protocol: 56b. now uses *note
     annotationlib.get_annotations(): 459. when checking whether or not
     an instance implements the protocol with *note isinstance(): 2ad.
     This enables support for ‘isinstance’ checks against classes with
     deferred annotations.

   - gh-132536(44): Do not disable *note PY_THROW: 1855. event in *note
     bdb: 10. because it can't be disabled.

   - gh-132527(45): Include the valid typecode 'w' in the error message
     when an invalid typecode is passed to *note array.array: 4be.

   - gh-132099(46): The Bluetooth socket with the *note BTPROTO_HCI:
     281. protocol on Linux now accepts an address in the format of an
     integer ‘device_id’, not only a tuple ‘(device_id,)’.

   - gh-81793(47): Fix *note os.link(): 1307. on platforms (like Linux)
     where the system ‘link()’ function does not follow symlinks.  On
     Linux, it now follows symlinks by default or if
     ‘follow_symlinks=True’ is specified.  On Windows, it now raises an
     error if ‘follow_symlinks=True’ is passed.  On macOS, it now raises
     an error if ‘follow_symlinks=False’ is passed and the system
     ‘linkat()’ function is not available at runtime.

   - gh-132493(48): Support creation of *note typing.Protocol: 56b.
     classes with annotations that cannot be resolved at class creation
     time.

   - gh-132491(49): Rename ‘annotationlib.value_to_string’ to *note
     annotationlib.type_repr(): 1856. and provide better handling for
     function objects.

   - gh-132426(50): Add *note
     annotationlib.get_annotate_from_class_namespace(): 45b. as a helper
     for accessing annotations in metaclasses, and remove
     ‘annotationlib.get_annotate_function’.

   - gh-70145(51): Add support for channels in Bluetooth HCI protocol
     (*note BTPROTO_HCI: 281.).

   - gh-131913(52): Add a shortcut function *note
     multiprocessing.Process.interrupt(): 251. alongside the existing
     *note multiprocessing.Process.terminate(): 1857. and *note
     multiprocessing.Process.kill(): d4f. for an improved control over
     child process termination.

   - gh-132439(53): Fix ‘PyREPL’ on Windows: characters entered via
     AltGr are swallowed.  Patch by Chris Eibl.

   - gh-132429(54): Fix support of Bluetooth sockets on NetBSD and
     DragonFly BSD. Add support for 'cid' and 'bdaddr_type' in the
     BTPROTO_L2CAP address on FreeBSD. Return 'cid' in ‘getsockname()’
     for BTPROTO_L2CAP if it is not zero.

   - gh-132106(55): *note QueueListener.start: 243. now raises a *note
     RuntimeError: 244. if the listener is already started.

   - gh-132417(56): Fix a ‘NULL’ pointer dereference when a C function
     called using *note ctypes: 2e. with ‘restype’ *note py_object: 1f3.
     returns ‘NULL’.

   - gh-132385(57): Fix instance error suggestions trigger potential
     exceptions in *note object.__getattr__(): 6fa. in *note traceback:
     104.

   - gh-125866(58): Add optional 'add_scheme' argument to *note
     urllib.request.pathname2url(): 2bf.; when set to true, a complete
     URL is returned.  Likewise add optional 'require_scheme' argument
     to *note url2pathname(): 2bd.; when set to true, a complete URL is
     accepted.

   - gh-132308(59): A *note traceback.TracebackException: 563. now
     correctly renders the ‘__context__’ and ‘__cause__’ attributes from
     *note falsey: 1858. *note Exception: bcd, and the ‘exceptions’
     attribute from falsey *note ExceptionGroup: 4d2.

   - gh-130645(60): Add colour to *note argparse: 7. help output.  Patch
     by Hugo van Kemenade.

   - gh-127495(61): In PyREPL, append a new entry to the
     ‘PYTHON_HISTORY’ file 'after' every statement.  This should
     preserve command-line history after interpreter is terminated.
     Patch by Sergey B Kirpichev.

   - gh-129463(62): Comparison of *note annotationlib.ForwardRef: 1776.
     objects no longer uses the internal ‘__code__’ and ‘__ast_node__’
     attributes, which are used as caches.

   - gh-132250(63): Fixed the *note SystemError: 795. in *note cProfile:
     2b. when locating the actual C function of a method raises an
     exception.

   - gh-132064(64): *note annotationlib.get_annotations(): 459. now uses
     the ‘__annotate__’ attribute if it is present, even if
     ‘__annotations__’ is not present.  Additionally, the function now
     raises a *note TypeError: 198. if it is passed an object that does
     not have any annotatins.

   - gh-130664(65): Support the ‘'_'’ digit separator in formatting of
     the integral part of *note Decimal: 1fe.'s.  Patch by Sergey B
     Kirpichev.

   - gh-131952(66): Add color output to the ‘json’ CLI. Patch by Tomas
     Roun.

   - gh-132063(67): Prevent exceptions that evaluate as falsey (namely,
     when their ‘__bool__’ method returns ‘False’ or their ‘__len__’
     method returns 0) from being ignored by *note
     concurrent.futures.ProcessPoolExecutor: 1d6. and *note
     concurrent.futures.ThreadPoolExecutor: 949.

   - gh-132106(68): *note logging.handlers.QueueListener: 242. now
     implements the context manager protocol, allowing it to be used in
     a *note with: 186. statement.

   - gh-132054(69): The ‘application/yaml’ mime type ( RFC 9512(70)) is
     now supported by *note mimetypes: 93.  Patch by Sasha "Nelie"
     Chernykh and Hugo van Kemenade.

   - gh-119605(71): Respect ‘follow_wrapped’ for ‘__init__()’ and
     ‘__new__()’ methods when getting the class signature for a class
     with *note inspect.signature(): 22f.  Preserve class signature
     after wrapping with *note warnings.deprecated(): 489.  Patch by
     Xuehai Pan.

   - gh-118761(72): Improve import times by up to 33x for the *note
     shlex: c9. module, and improve the performance of *note
     shlex.quote(): 582. by up to 12x.  Patch by Adam Turner.

   - gh-85302(73): Add support for *note BTPROTO_SCO: 282. in sockets on
     FreeBSD.

   - gh-131757(74): Make *note functools.lru_cache(): be2. call the
     cached function unlocked to allow concurrency.

   - gh-131423(75): *note ssl: d5. can show descriptions for errors
     added in OpenSSL 3.4.1.  Patch by Bénédikt Tran.

   - gh-131434(76): Improve error reporting for incorrect format in
     *note time.strptime(): 1646.

   - gh-131524(77): Add help message to *note platform: af. command-line
     interface.  Contributed by Harry Lees.

   - gh-100926(78): Move *note ctypes.POINTER(): 1f1. types cache from a
     global internal cache (‘_pointer_type_cache’) to the *note
     ctypes._CData.__pointer_type__: 1f2. attribute of the corresponding
     *note ctypes: 2e. types.  This will stop the cache from growing
     without limits in some situations.

   - gh-85702(79): If ‘zoneinfo._common.load_tzdata’ is given a package
     without a resource a ‘ZoneInfoNotFoundError’ is raised rather than
     a *note IsADirectoryError: 1264.

   - gh-123471(80): Make concurrent iterations over *note
     itertools.repeat: 1859. safe under free-threading.

   - gh-131127(81): Systems using LibreSSL now successfully build.

   - gh-89157(82): Make the pure Python implementation of *note
     datetime.date.fromisoformat(): 828, only accept ASCII strings for
     consistency with the C implementation.

   - gh-130941(83): Fix *note configparser.ConfigParser: 4de. parsing
     empty interpolation with ‘allow_no_value’ set to ‘True’.

   - gh-110067(84): Make *note heapq: 6d. max-heap functions *note
     heapq.heapify_max(): 221, *note heapq.heappush_max(): 222, *note
     heapq.heappop_max(): 223, and *note heapq.heapreplace_max(): 224.
     public.  Previous underscored naming is kept for backwards
     compatibility.  Additionally, the missing function *note
     heapq.heappushpop_max(): 225. has been added to both the C and
     Python implementations.

   - gh-129098(85): Fix REPL traceback reporting when using *note
     compile(): 4b1. with an inexisting file.  Patch by Bénédikt Tran.

   - gh-130631(86): ‘http.cookiejar.join_header_words()’ is now more
     similar to the original Perl version.  It now quotes the same set
     of characters and always quote values that end with ‘"\n"’.

   - gh-130482(87): Add ability to specify name for ‘tkinter.OptionMenu’
     and ‘tkinter.ttk.OptionMenu’.

   - gh-77065(88): Add keyword-only optional argument 'echo_char' for
     *note getpass.getpass(): 21d. for optional visual keyboard feedback
     support.  Patch by Semyon Moroz.

   - gh-130317(89): Fix *note PyFloat_Pack2(): 969. and *note
     PyFloat_Unpack2(): 96c. for NaN's with payload.  This corrects
     round-trip for *note struct.unpack(): 185a. and *note
     struct.pack(): 148e. in case of the IEEE 754 binary16 "half
     precision" type.  Patch by Sergey B Kirpichev.

   - gh-130402(90): Joining running daemon threads during interpreter
     shutdown now raises *note PythonFinalizationError: 47a.

   - gh-130167(91): Improve speed of *note difflib.IS_LINE_JUNK(): 2d7.
     Patch by Semyon Moroz.

   - gh-101410(92): Added more detailed messages for domain errors in
     the *note math: 92. module.

   - gh-128384(93): Make *note warnings.catch_warnings: 179. use a
     context variable for holding the warning filtering state if the
     *note sys.flags.context_aware_warnings: 18a. flag is set to true.
     This makes using the context manager thread-safe in multi-threaded
     programs.  The flag is true by default in free-threaded builds and
     is otherwise false.  The value of the flag can be overridden by the
     the *note -X context_aware_warnings: 16f. command-line option or by
     the *note PYTHON_CONTEXT_AWARE_WARNINGS: 185b. environment
     variable.

   - gh-129719(94): Fix missing ‘socket.CAN_RAW_ERR_FILTER’ constant in
     the socket module on Linux systems.  It was missing since Python
     3.11.

   - gh-129027(95): Raise *note DeprecationWarning: 1a3. for *note
     sys._clear_type_cache(): 292.  This function was deprecated in
     Python 3.13 but it didn't raise a runtime warning.

   - gh-128307(96): Add ‘eager_start’ keyword argument to *note
     asyncio.loop.create_task(): 1ca.

   - gh-127604(97): Add support for printing the C stack trace on
     systems that support it via *note faulthandler.dump_c_stack(): 20e.
     or via the 'c_stack' argument in *note faulthandler.enable(): 20f.

   - gh-127385(98): Add the ‘F_DUPFD_QUERY’ constant to the *note fcntl:
     5d. module.

   - gh-126838(99): Add 'resolve_host' keyword-only parameter to *note
     urllib.request.url2pathname(): 2bd, and fix handling of file URLs
     with authorities.

   - gh-82129(100): Fix *note NameError: 452. when calling *note
     typing.get_type_hints(): 8c0. on a *note dataclasses.dataclass():
     4e1. created by *note dataclasses.make_dataclass(): 185c. with
     un-annotated fields.

   - gh-122559(101): Remove ‘__reduce__()’ and ‘__reduce_ex__()’ methods
     that always raise *note TypeError: 198. in the C implementation of
     *note io.FileIO: 1527, *note io.BufferedReader: 1427, *note
     io.BufferedWriter: 15cb. and *note io.BufferedRandom: 15cc. and
     replace them with default ‘__getstate__()’ methods that raise
     ‘TypeError’.  This restores fine details of behavior of Python 3.11
     and older versions.

   - gh-122179(102): *note hashlib.file_digest(): 854. now raises *note
     BlockingIOError: 235. when no data is available during non-blocking
     I/O. Before, it added spurious null bytes to the digest.

   - gh-53032(103): Expose *note decimal.IEEEContext(): 1ff. to support
     creation of contexts corresponding to the IEEE 754 (2008) decimal
     interchange formats.  Patch by Sergey B Kirpichev.

   - gh-120220(104): Deprecate the ‘tkinter.Variable’ methods
     ‘trace_variable()’, ‘trace_vdelete()’ and ‘trace_vinfo()’.  Methods
     ‘trace_add()’, ‘trace_remove()’ and ‘trace_info()’ can be used
     instead.

   - gh-113539(105): *note webbrowser: 11b.: Names in the ‘BROWSER’
     environment variable can now refer to already registered web
     browsers, instead of always generating a new browser command.

     This makes it possible to set ‘BROWSER’ to the value of one of the
     supported browsers on macOS.

   - bpo-44172(106): Keep a reference to original *note curses: 2f.
     windows in subwindows so that the original window does not get
     deleted before subwindows.

   - gh-75223(107): Deprecate undotted extensions in *note
     mimetypes.MimeTypes.add_type(): 319.  Patch by Hugo van Kemenade.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/133490

   (2) https://github.com/python/cpython/issues/132493

   (3) https://github.com/python/cpython/issues/130645

   (4) https://github.com/python/cpython/issues/119180

   (5) https://github.com/python/cpython/issues/133351

   (6) https://github.com/python/cpython/issues/133367

   (7) https://github.com/python/cpython/issues/133363

   (8) https://github.com/python/cpython/issues/113081

   (9) https://github.com/python/cpython/issues/133349

   (10) https://github.com/python/cpython/issues/133306

   (11) https://github.com/python/cpython/issues/133306

   (12) https://github.com/python/cpython/issues/133300

   (13) https://github.com/python/cpython/issues/133290

   (14) https://github.com/python/cpython/issues/133223

   (15) https://github.com/python/cpython/issues/133153

   (16) https://github.com/python/cpython/issues/133139

   (17) https://github.com/python/cpython/issues/133089

   (18) https://github.com/python/cpython/issues/133036

   (19) https://github.com/python/cpython/issues/132987

   (20) https://github.com/python/cpython/issues/124703

   (21) https://github.com/python/cpython/issues/133005

   (22) https://github.com/python/cpython/issues/115032

   (23) https://github.com/python/cpython/issues/132991

   (24) https://github.com/python/cpython/issues/132995

   (25) https://github.com/python/cpython/issues/132933

   (26) https://github.com/python/cpython/issues/121249

   (27) https://github.com/python/cpython/issues/132915

   (28) https://github.com/python/cpython/issues/132017

   (29) https://github.com/python/cpython/issues/132893

   (30) https://github.com/python/cpython/issues/130328

   (31) https://github.com/python/cpython/issues/132882

   (32) https://github.com/python/cpython/issues/93696

   (33) https://github.com/python/cpython/issues/129965

   (34) https://github.com/python/cpython/issues/132742

   (35) https://github.com/python/cpython/issues/132451

   (36) https://github.com/python/cpython/issues/125618

   (37) https://github.com/python/cpython/issues/132805

   (38) https://github.com/python/cpython/issues/132734

   (39) https://github.com/python/cpython/issues/132673

   (40) https://github.com/python/cpython/issues/132578

   (41) https://github.com/python/cpython/issues/132561

   (42) https://github.com/python/cpython/issues/121468

   (43) https://github.com/python/cpython/issues/132493

   (44) https://github.com/python/cpython/issues/132536

   (45) https://github.com/python/cpython/issues/132527

   (46) https://github.com/python/cpython/issues/132099

   (47) https://github.com/python/cpython/issues/81793

   (48) https://github.com/python/cpython/issues/132493

   (49) https://github.com/python/cpython/issues/132491

   (50) https://github.com/python/cpython/issues/132426

   (51) https://github.com/python/cpython/issues/70145

   (52) https://github.com/python/cpython/issues/131913

   (53) https://github.com/python/cpython/issues/132439

   (54) https://github.com/python/cpython/issues/132429

   (55) https://github.com/python/cpython/issues/132106

   (56) https://github.com/python/cpython/issues/132417

   (57) https://github.com/python/cpython/issues/132385

   (58) https://github.com/python/cpython/issues/125866

   (59) https://github.com/python/cpython/issues/132308

   (60) https://github.com/python/cpython/issues/130645

   (61) https://github.com/python/cpython/issues/127495

   (62) https://github.com/python/cpython/issues/129463

   (63) https://github.com/python/cpython/issues/132250

   (64) https://github.com/python/cpython/issues/132064

   (65) https://github.com/python/cpython/issues/130664

   (66) https://github.com/python/cpython/issues/131952

   (67) https://github.com/python/cpython/issues/132063

   (68) https://github.com/python/cpython/issues/132106

   (69) https://github.com/python/cpython/issues/132054

   (70) https://datatracker.ietf.org/doc/html/rfc9512.html

   (71) https://github.com/python/cpython/issues/119605

   (72) https://github.com/python/cpython/issues/118761

   (73) https://github.com/python/cpython/issues/85302

   (74) https://github.com/python/cpython/issues/131757

   (75) https://github.com/python/cpython/issues/131423

   (76) https://github.com/python/cpython/issues/131434

   (77) https://github.com/python/cpython/issues/131524

   (78) https://github.com/python/cpython/issues/100926

   (79) https://github.com/python/cpython/issues/85702

   (80) https://github.com/python/cpython/issues/123471

   (81) https://github.com/python/cpython/issues/131127

   (82) https://github.com/python/cpython/issues/89157

   (83) https://github.com/python/cpython/issues/130941

   (84) https://github.com/python/cpython/issues/110067

   (85) https://github.com/python/cpython/issues/129098

   (86) https://github.com/python/cpython/issues/130631

   (87) https://github.com/python/cpython/issues/130482

   (88) https://github.com/python/cpython/issues/77065

   (89) https://github.com/python/cpython/issues/130317

   (90) https://github.com/python/cpython/issues/130402

   (91) https://github.com/python/cpython/issues/130167

   (92) https://github.com/python/cpython/issues/101410

   (93) https://github.com/python/cpython/issues/128384

   (94) https://github.com/python/cpython/issues/129719

   (95) https://github.com/python/cpython/issues/129027

   (96) https://github.com/python/cpython/issues/128307

   (97) https://github.com/python/cpython/issues/127604

   (98) https://github.com/python/cpython/issues/127385

   (99) https://github.com/python/cpython/issues/126838

   (100) https://github.com/python/cpython/issues/82129

   (101) https://github.com/python/cpython/issues/122559

   (102) https://github.com/python/cpython/issues/122179

   (103) https://github.com/python/cpython/issues/53032

   (104) https://github.com/python/cpython/issues/120220

   (105) https://github.com/python/cpython/issues/113539

   (106) https://bugs.python.org/issue?@action=redirect&bpo=44172

   (107) https://github.com/python/cpython/issues/75223


File: python.info,  Node: IDLE<5>,  Next: ドキュメント<8>,  Prev: ライブラリ<24>,  Up: Python 3 14 0 beta 1

1.24.12.6 IDLE
..............

   - gh-112936(1): fix IDLE: no Shell menu item in single-process mode.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/112936


File: python.info,  Node: ドキュメント<8>,  Next: Core and Builtins<22>,  Prev: IDLE<5>,  Up: Python 3 14 0 beta 1

1.24.12.7 ドキュメント
......................

   - gh-107006(1): Move documentation and example code for *note
     threading.local: 185f. from its docstring to the official docs.

   - gh-125142(2): As part of the builtin help intro text, show the
     keyboard shortcuts for the new, non-basic REPL (F1, F2, and F3).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/107006

   (2) https://github.com/python/cpython/issues/125142


File: python.info,  Node: Core and Builtins<22>,  Next: ライブラリ<25>,  Prev: ドキュメント<8>,  Up: Python 3 14 0 beta 1

1.24.12.8 Core and Builtins
...........................

   - gh-133336(1): ‘-J’ is no longer reserved for use by Jython.  Patch
     by Adam Turner.

   - gh-133261(2): Fix bug where the cycle GC could untrack objects in
     the trashcan because they looked like they were immortal.  When
     objects are added to the trashcan, we take care to ensure they keep
     a mortal reference count.

   - gh-133346(3): Added experimental color theming support to the
     ‘_colorize’ module.

   - gh-132917(4): For the free-threaded build, check the process memory
     usage increase before triggering a full automatic garbage
     collection.  If the memory used has not increased 10% since the
     last collection then defer it.

   - gh-91048(5): Add a new ‘python -m asyncio ps PID’ command-line
     interface to inspect asyncio tasks in a running Python process.
     Displays a flat table of await relationships.  A variant showing a
     tree view is also available as ‘python -m asyncio pstree PID’.
     Both are useful for debugging async code.  Patch by Pablo Galindo,
     Łukasz Langa, Yury Selivanov, and Marta Gomez Macias.

   - gh-133304(6): Workaround NaN's "canonicalization" in *note
     PyFloat_Pack4(): 96a. and *note PyFloat_Unpack4(): 96d. on RISC-V.

   - gh-133197(7): Improve *note SyntaxError: 18e. error messages for
     incompatible string / bytes prefixes.

   - gh-133231(8): Add new utilities of observing JIT compilation: *note
     sys._jit.is_available(): 44f, *note sys._jit.is_enabled(): 450, and
     *note sys._jit.is_active(): 1861.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/133336

   (2) https://github.com/python/cpython/issues/133261

   (3) https://github.com/python/cpython/issues/133346

   (4) https://github.com/python/cpython/issues/132917

   (5) https://github.com/python/cpython/issues/91048

   (6) https://github.com/python/cpython/issues/133304

   (7) https://github.com/python/cpython/issues/133197

   (8) https://github.com/python/cpython/issues/133231


File: python.info,  Node: ライブラリ<25>,  Next: Core and Builtins<23>,  Prev: Core and Builtins<22>,  Up: Python 3 14 0 beta 1

1.24.12.9 ライブラリ
....................

   - gh-133194(1): *note ast.parse(): 1c2. will no longer parse new PEP
     758(2) syntax with older 'feature_version' passed.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/133194

   (2) https://peps.python.org/pep-0758/


File: python.info,  Node: Core and Builtins<23>,  Next: ライブラリ<26>,  Prev: ライブラリ<25>,  Up: Python 3 14 0 beta 1

1.24.12.10 Core and Builtins
............................

   - gh-131798(1): Split ‘CALL_LEN’ into several uops allowing the JIT
     to remove them when optimizing.  Patch by Diego Russo.

   - gh-131798(2): Use ‘sym_new_type’ instead of ‘sym_new_not_null’ for
     _BUILD_STRING, _BUILD_SET

   - gh-132942(3): Fix two races in the type lookup cache.  This
     affected the free-threaded build and could cause crashes
     (apparently quite difficult to trigger).

   - gh-131798(4): Propagate the return type of
     ‘_BINARY_OP_SUBSCR_TUPLE_INT’ in JIT. Patch by Tomas Roun

   - gh-132952(5): Speed up startup with the ‘-S’ argument by importing
     the private ‘_io’ module instead of *note io: 83.  This fixes a
     performance regression introduced earlier in Python 3.14
     development and restores performance to the level of Python 3.13.

   - gh-131798(6): Allow the JIT to remove int guards after ‘_CALL_LEN’
     by setting the return type to int.  Patch by Diego Russo

   - gh-131798(7): Split ‘CALL_TUPLE_1’ into several uops allowing the
     JIT to remove some of them.  Patch by Tomas Roun

   - gh-131798(8): Split ‘CALL_STR_1’ into several uops allowing the JIT
     to remove some of them.  Patch by Tomas Roun

   - gh-132825(9): Enhance unhashable key/element error messages for
     *note dict: 183. and *note set: 184.  Patch by Victor Stinner.

   - gh-131591(10): Reset any PEP 768(11) remote debugging pending call
     in children after *note os.fork(): 4b5. calls.

   - gh-132713(12): Fix ‘repr(list)’ race condition: hold a strong
     reference to the item while calling ‘repr(item)’.  Patch by Victor
     Stinner.

   - gh-132661(13): Implement PEP 750(14) (Template Strings).  Add new
     syntax for t-strings and implement new internal
     ‘string.templatelib.Template’ and
     ‘string.templatelib.Interpolation’ types.

   - gh-132479(15): Fix compiler crash in certain circumstances where
     multiple module-level annotations include comprehensions and other
     nested scopes.

   - gh-132747(16): Fix a crash when calling *note __get__(): 1701. of a
     *note method: 1864. with a *note None: 885. second argument.

   - gh-132744(17): Certain calls now check for runaway recursion and
     respect the system recursion limit.

   - gh-132449(18): Syntax errors that look like misspellings of Python
     keywords now provide a helpful fix suggestion for the typo.
     Contributed by Pablo Galindo Salgado.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131798

   (2) https://github.com/python/cpython/issues/131798

   (3) https://github.com/python/cpython/issues/132942

   (4) https://github.com/python/cpython/issues/131798

   (5) https://github.com/python/cpython/issues/132952

   (6) https://github.com/python/cpython/issues/131798

   (7) https://github.com/python/cpython/issues/131798

   (8) https://github.com/python/cpython/issues/131798

   (9) https://github.com/python/cpython/issues/132825

   (10) https://github.com/python/cpython/issues/131591

   (11) https://peps.python.org/pep-0768/

   (12) https://github.com/python/cpython/issues/132713

   (13) https://github.com/python/cpython/issues/132661

   (14) https://peps.python.org/pep-0750/

   (15) https://github.com/python/cpython/issues/132479

   (16) https://github.com/python/cpython/issues/132747

   (17) https://github.com/python/cpython/issues/132744

   (18) https://github.com/python/cpython/issues/132449


File: python.info,  Node: ライブラリ<26>,  Next: Core and Builtins<24>,  Prev: Core and Builtins<23>,  Up: Python 3 14 0 beta 1

1.24.12.11 ライブラリ
.....................

   - gh-132737(1): Support profiling code that requires ‘__main__’, such
     as *note pickle: ab.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132737


File: python.info,  Node: Core and Builtins<24>,  Next: ライブラリ<27>,  Prev: ライブラリ<26>,  Up: Python 3 14 0 beta 1

1.24.12.12 Core and Builtins
............................

   - gh-132639(1): Added *note PyLong_AsNativeBytes(): 606, *note
     PyLong_FromNativeBytes(): 607. and *note
     PyLong_FromUnsignedNativeBytes(): 608. to the limited C API.

   - gh-100239(2): Add specialisation for ‘BINARY_OP/SUBSCR’ on list and
     slice.

   - gh-132508(3): Uses tagged integers on the evaluation stack to
     represent the instruction offsets when reraising an exception.
     This avoids the need to box the integer which could fail in low
     memory conditions.

   - gh-124476(4): Fix decoding from the locale encoding in the C.UTF-8
     locale.

   - gh-131927(5): Compiler warnings originating from the same module
     and line number are now only emitted once, matching the behaviour
     of warnings emitted from user code.  This can also be configured
     with *note warnings: 118. filters.

   - gh-132457(6): Make *note staticmethod(): 453. and *note
     classmethod(): 48e. generic.

   - gh-131798(7): Use ‘sym_new_type’ instead of ‘sym_new_not_null’ for
     _BUILD_LIST, _BUILD_SET, _BUILD_MAP

   - gh-131798(8): Split ‘CALL_TYPE_1’ into several uops allowing the
     JIT to remove some of them.

   - gh-132386(9): Fix crash when passing a dict subclass as the
     ‘globals’ parameter to *note exec(): 4a2.

   - gh-127682(10): No longer call ‘__iter__’ twice when creating and
     executing a generator expression.  Creating a generator expression
     from a non-interable will raise only when the generator expression
     is executed.  This brings the behavior of generator expressions in
     line with other generators.

   - gh-132261(11): The internal storage for annotations and annotate
     functions on classes now uses different keys in the class
     dictionary.  This eliminates various edge cases where access to the
     ‘__annotate__’ and ‘__annotations__’ attributes would behave
     unpredictably.

   - gh-132284(12): Don't wrap base ‘PyCFunction’ slots on class
     creation if not overridden.

   - gh-130415(13): Improve the JIT's ability to remove unused constant
     and local variable loads, and fix an issue where deallocating
     unused values could cause JIT code to crash or behave incorrectly.

   - gh-126703(14): Fix possible use after free in cases where a
     method's definition has the same lifetime as its ‘self’.

   - gh-132286(15): Fix that *note type.__annotate__: 1867. was not
     deleted, when *note type.__annotations__: 1843. was deleted.

   - gh-131798(16): Allow the JIT to remove an extra ‘_TO_BOOL_BOOL’
     instruction after ‘_CONTAINS_OP_DICT’ by setting the return type to
     bool.

   - gh-124715(17): Prevents against stack overflows when calling *note
     Py_DECREF(): 790.  Third-party extension objects no longer need to
     use the "trashcan" mechanism, as protection is now built into the
     *note Py_DECREF(): 790. macro.

   - gh-131798(18): Allow the JIT compiler to remove some type checks
     for operations on lists, tuples, dictionaries, and sets.

   - gh-128398(19): Improve error message when an object supporting the
     synchronous (resp.  asynchronous) context manager protocol is
     entered using *note async with: 185. (resp.  *note with: 186.)
     instead of *note with: 186. (resp.  *note async with: 185.).  Patch
     by Bénédikt Tran.

   - gh-131798(20): Allow the JIT to remove unicode guards after
     ‘_BINARY_OP_SUBSCR_STR_INT’ by setting the return type to string.

   - gh-131878(21): Handle uncaught exceptions in the main input loop
     for the new REPL.

   - gh-131878(22): Fix support of unicode characters with two or more
     codepoints on Windows in the new REPL.

   - gh-126835(23): Move constant folding to the peephole optimizer.
     Rename AST optimization related files (Python/ast_opt.c ->
     Python/ast_preprocess.c), structs (_PyASTOptimizeState ->
     _PyASTPreprocessState) and functions (_PyAST_Optimize ->
     _PyAST_Preprocess, _PyCompile_AstOptimize ->
     _PyCompile_AstPreprocess).

   - gh-114809(24): Add support for macOS multi-arch builds with the JIT
     enabled

   - gh-131507(25): PyREPL now supports syntax highlighting.
     Contributed by Łukasz Langa.

   - gh-130907(26): If the ‘__annotations__’ of a module object are
     accessed while the module is executing, return the annotations that
     have been defined so far, without caching them.

   - gh-130104(27): Three-argument *note pow(): 1a4. now try calling
     *note __rpow__(): 1a5. if necessary.  Previously it was only called
     in two-argument ‘pow()’ and the binary power operator.

   - gh-130070(28): Fixed an assertion error for *note exec(): 4a2.
     passed a string ‘source’ and a non-‘None’ ‘closure’.  Patch by
     Bartosz Sławecki.

   - gh-129958(29): Fix a bug that was allowing newlines inconsistently
     in format specifiers for single-quoted f-strings.  Patch by Pablo
     Galindo.

   - gh-129858(30): ‘elif’ statements that follow an ‘else’ block now
     have a specific error message.

   - gh-69605(31): Add module autocomplete to PyREPL.

   - gh-128555(32): Add the *note sys.flags.thread_inherit_context: 175.
     flag.

        * This flag is set to true by default on the free-threaded build
          and false otherwise.  If the flag is true, starting a new
          thread using *note threading.Thread: 176. will, by default,
          use a copy of the *note contextvars.Context: 177. from the
          caller of *note threading.Thread.start(): 178. rather than
          using an empty context.

        * Add the *note -X thread_inherit_context: 16f. command-line
          option and *note PYTHON_THREAD_INHERIT_CONTEXT: 1868.
          environment variable, which set the *note
          thread_inherit_context: 175. flag.

        * Add the ‘context’ keyword parameter to *note Thread: 176.  It
          can be used to explicitly pass a context value to be used by a
          new thread.

        * Make the ‘_contextvars’ module built-in.

   - gh-123539(33): Improve *note SyntaxError: 18e. message for using
     ‘import ... as’ and ‘from ... import ... as’ with not a name.

   - gh-102567(34): *note -X importtime: 16f. now accepts value ‘2’,
     which indicates that an ‘importtime’ entry should also be printed
     if an imported module has already been loaded.  Patch by Noah Kim
     and Adam Turner.

   - gh-116436(35): Improve error message when *note TypeError: 198.
     occurs during *note dict.update(): 167e.

   - gh-103997(36): String arguments passed to "-c" are now
     automatically dedented as if by *note textwrap.dedent(): 1a9.  This
     allows "python -c" invocations to be indented in shell scripts
     without causing indentation errors.  (Patch by Jon Crall and Steven
     Sun)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132639

   (2) https://github.com/python/cpython/issues/100239

   (3) https://github.com/python/cpython/issues/132508

   (4) https://github.com/python/cpython/issues/124476

   (5) https://github.com/python/cpython/issues/131927

   (6) https://github.com/python/cpython/issues/132457

   (7) https://github.com/python/cpython/issues/131798

   (8) https://github.com/python/cpython/issues/131798

   (9) https://github.com/python/cpython/issues/132386

   (10) https://github.com/python/cpython/issues/127682

   (11) https://github.com/python/cpython/issues/132261

   (12) https://github.com/python/cpython/issues/132284

   (13) https://github.com/python/cpython/issues/130415

   (14) https://github.com/python/cpython/issues/126703

   (15) https://github.com/python/cpython/issues/132286

   (16) https://github.com/python/cpython/issues/131798

   (17) https://github.com/python/cpython/issues/124715

   (18) https://github.com/python/cpython/issues/131798

   (19) https://github.com/python/cpython/issues/128398

   (20) https://github.com/python/cpython/issues/131798

   (21) https://github.com/python/cpython/issues/131878

   (22) https://github.com/python/cpython/issues/131878

   (23) https://github.com/python/cpython/issues/126835

   (24) https://github.com/python/cpython/issues/114809

   (25) https://github.com/python/cpython/issues/131507

   (26) https://github.com/python/cpython/issues/130907

   (27) https://github.com/python/cpython/issues/130104

   (28) https://github.com/python/cpython/issues/130070

   (29) https://github.com/python/cpython/issues/129958

   (30) https://github.com/python/cpython/issues/129858

   (31) https://github.com/python/cpython/issues/69605

   (32) https://github.com/python/cpython/issues/128555

   (33) https://github.com/python/cpython/issues/123539

   (34) https://github.com/python/cpython/issues/102567

   (35) https://github.com/python/cpython/issues/116436

   (36) https://github.com/python/cpython/issues/103997


File: python.info,  Node: ライブラリ<27>,  Next: C API<8>,  Prev: Core and Builtins<24>,  Up: Python 3 14 0 beta 1

1.24.12.13 ライブラリ
.....................

   - gh-89562(1): Remove ‘hostflags’ member from ‘PySSLContext’ struct.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89562


File: python.info,  Node: C API<8>,  Next: ビルド<8>,  Prev: ライブラリ<27>,  Up: Python 3 14 0 beta 1

1.24.12.14 C API
................

   - gh-133166(1): Fix regression where *note PyType_GetModuleByDef():
     635. returns NULL without setting *note TypeError: 198. when a
     static type is passed.

   - gh-133164(2): Add *note
     PyUnstable_Object_IsUniqueReferencedTemporary(): 3c7. function for
     determining if an object exists as a unique temporary variable on
     the interpreter's stack.  This is a replacement for some cases
     where checking that *note Py_REFCNT(): 2cf. is one is no longer
     sufficient to determine if it's safe to modify a Python object
     in-place with no visible side effects.

   - gh-133140(3): Add *note PyUnstable_Object_IsUniquelyReferenced():
     3c6. as a replacement for ‘Py_REFNCT(op) == 1’ on *note free
     threaded: 1f4. builds of Python.

   - gh-131747(4): On non-Windows platforms, deprecate using *note
     ctypes.Structure._pack_: 317. to use a Windows-compatible layout on
     non-Windows platforms.  The layout should be specified explicitly
     by setting *note ctypes.Structure._layout_: 1e7. to ‘'ms'’.

   - gh-128972(5): For non-free-threaded builds, the memory layout of
     *note PyASCIIObject: 138d. is reverted to match Python 3.13.  (Note
     that the structure is not part of stable ABI and so its memory
     layout is 'guaranteed' to remain stable.)

   - gh-133079(6): The undocumented APIs ‘Py_C_RECURSION_LIMIT’ and
     ‘PyThreadState.c_recursion_remaining’, added in 3.13, are removed
     without a deprecation period.

   - gh-132987(7): The ‘k’ and ‘K’ formats in *note PyArg_Parse(): 180e.
     now support the *note __index__(): 19e. special method, like all
     other integer formats.

   - gh-132909(8): Fix an overflow when handling the *note K: 186b.
     format in *note Py_BuildValue(): 3c2.  Patch by Bénédikt Tran.

   - gh-132798(9): Deprecated and undocumented functions
     ‘PyUnicode_AsEncodedObject()’, ‘PyUnicode_AsDecodedObject()’,
     ‘PyUnicode_AsEncodedUnicode()’ and ‘PyUnicode_AsDecodedUnicode()’
     are scheduled for removal in 3.15.

   - gh-132470(10): Creating a *note ctypes.CField: 1e8. with a
     'byte_size' that does not match the actual type size now raises a
     *note ValueError: 2ec. instead of crashing the interpreter.

   - gh-112068(11): [Reverted in gh-136991(12)] Add support of nullable
     arguments in *note PyArg_Parse(): 180e. and similar functions.
     Adding ‘?’ after any format unit makes ‘None’ be accepted as a
     value.

   - gh-50333(13): Non-tuple sequences are deprecated as argument for
     the ‘(items)’ format unit in *note PyArg_ParseTuple(): 3c1. and
     other *note argument parsing: 3d5. functions if 'items' contains
     format units which store a *note borrowed buffer: 3d6. or a *note
     borrowed reference: 3d7.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/133166

   (2) https://github.com/python/cpython/issues/133164

   (3) https://github.com/python/cpython/issues/133140

   (4) https://github.com/python/cpython/issues/131747

   (5) https://github.com/python/cpython/issues/128972

   (6) https://github.com/python/cpython/issues/133079

   (7) https://github.com/python/cpython/issues/132987

   (8) https://github.com/python/cpython/issues/132909

   (9) https://github.com/python/cpython/issues/132798

   (10) https://github.com/python/cpython/issues/132470

   (11) https://github.com/python/cpython/issues/112068

   (12) https://github.com/python/cpython/issues/136991

   (13) https://github.com/python/cpython/issues/50333


File: python.info,  Node: ビルド<8>,  Prev: C API<8>,  Up: Python 3 14 0 beta 1

1.24.12.15 ビルド
.................

   - gh-113464(1): Use the cpython-bin-deps "externals" repository for
     Windows LLVM dependency management.  Installing LLVM manually is no
     longer necessary for Windows JIT builds.

   - gh-133183(2): iOS compiler shims now include
     ‘IPHONEOS_DEPLOYMENT_TARGET’ in target triples, ensuring that SDK
     version minimums are honored.

   - gh-133167(3): Fix compilation process with ‘--enable-optimizations’
     and ‘--without-docstrings’.

   - gh-133171(4): Since free-threaded builds do not support the
     experimental JIT compiler, prevent these configurations from being
     combined.

   - gh-132758(5): Fix building with tail call interpreter and pystats.

   - gh-132649(6): The ‘PClayout’ script now allows passing
     ‘--include-tcltk’ on Windows ARM64.

   - gh-132257(7): Change the default LTO flags on GCC to not pass
     ‘-flto-partition=none’, and allow parallelization of LTO. For newer
     GNU makes and GCC, this has a multiple factor speedup for LTO build
     times, with no noticeable loss in performance.

   - gh-132026(8): Fix use of undefined identifiers in platform triplet
     detection on MIPS Linux platforms.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/113464

   (2) https://github.com/python/cpython/issues/133183

   (3) https://github.com/python/cpython/issues/133167

   (4) https://github.com/python/cpython/issues/133171

   (5) https://github.com/python/cpython/issues/132758

   (6) https://github.com/python/cpython/issues/132649

   (7) https://github.com/python/cpython/issues/132257

   (8) https://github.com/python/cpython/issues/132026


File: python.info,  Node: Python 3 14 0 alpha 7,  Next: Python 3 14 0 alpha 6,  Prev: Python 3 14 0 beta 1,  Up: 変更履歴

1.24.13 Python 3.14.0 alpha 7
-----------------------------

'リリース日: 2025-04-08'

* Menu:

* macOS: macOS<4>.
* Windows: Windows<10>.
* Tools/Demos: Tools/Demos<9>.
* テスト: テスト<7>.
* セキュリティ: セキュリティ<11>.
* ライブラリ: ライブラリ<28>.
* ドキュメント: ドキュメント<9>.
* Core and Builtins: Core and Builtins<25>.
* ライブラリ: ライブラリ<29>.
* Core and Builtins: Core and Builtins<26>.
* C API: C API<9>.
* ビルド: ビルド<9>.


File: python.info,  Node: macOS<4>,  Next: Windows<10>,  Up: Python 3 14 0 alpha 7

1.24.13.1 macOS
...............

   - gh-124111(1): Update macOS installer to use Tcl/Tk 8.6.16.

   - gh-131423(2): Update macOS installer to use OpenSSL 3.0.16.  Patch
     by Bénédikt Tran.

   - gh-131025(3): Update macOS installer to ship with SQLite 3.49.1.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/124111

   (2) https://github.com/python/cpython/issues/131423

   (3) https://github.com/python/cpython/issues/131025


File: python.info,  Node: Windows<10>,  Next: Tools/Demos<9>,  Prev: macOS<4>,  Up: Python 3 14 0 alpha 7

1.24.13.2 Windows
.................

   - gh-131423(1): Update bundled version of OpenSSL to 3.0.16.  The new
     build also disables uplink support, which may be relevant to
     embedders but has no impact on normal use.

   - gh-131453(2): Some ‘SND_*’ and ‘MB_*’ constants are added to *note
     winsound: 11d.

   - gh-91349(3): Replaces our copy of ‘zlib’ with ‘zlib-ng’, for
     performance improvements in *note zlib: 139.

   - gh-131025(4): Update Windows installer to ship with SQLite 3.49.1.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131423

   (2) https://github.com/python/cpython/issues/131453

   (3) https://github.com/python/cpython/issues/91349

   (4) https://github.com/python/cpython/issues/131025


File: python.info,  Node: Tools/Demos<9>,  Next: テスト<7>,  Prev: Windows<10>,  Up: Python 3 14 0 alpha 7

1.24.13.3 Tools/Demos
.....................

   - gh-132121(1): Always escape non-printable Unicode characters in
     ‘pygettext’.

   - gh-131852(2): ‘msgfmt’ no longer adds the ‘POT-Creation-Date’ to
     generated ‘.mo’ files for consistency with GNU ‘msgfmt’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132121

   (2) https://github.com/python/cpython/issues/131852


File: python.info,  Node: テスト<7>,  Next: セキュリティ<11>,  Prev: Tools/Demos<9>,  Up: Python 3 14 0 alpha 7

1.24.13.4 テスト
................

   - gh-131277(1): Allow to unset one or more environment variables at
     once via *note EnvironmentVarGuard.unset(): 1872.  Patch by
     Bénédikt Tran.

   - gh-131050(2): ‘test_ssl.test_dh_params’ is skipped if the
     underlying TLS library does not support finite-field ephemeral
     Diffie-Hellman.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131277

   (2) https://github.com/python/cpython/issues/131050


File: python.info,  Node: セキュリティ<11>,  Next: ライブラリ<28>,  Prev: テスト<7>,  Up: Python 3 14 0 alpha 7

1.24.13.5 セキュリティ
......................

   - gh-131809(1): Update bundled libexpat to 2.7.1

   - gh-131261(2): Upgrade to libexpat 2.7.0

   - gh-121284(3): Fix bug in the folding of rfc2047 encoded-words when
     flattening an email message using a modern email policy.
     Previously when an encoded-word was too long for a line, it would
     be decoded, split across lines, and re-encoded.  But commas and
     other special characters in the original text could be left
     unencoded and unquoted.  This could theoretically be used to spoof
     header lines using a carefully constructed encoded-word if the
     resulting rendered email was transmitted or re-parsed.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131809

   (2) https://github.com/python/cpython/issues/131261

   (3) https://github.com/python/cpython/issues/121284


File: python.info,  Node: ライブラリ<28>,  Next: ドキュメント<9>,  Prev: セキュリティ<11>,  Up: Python 3 14 0 alpha 7

1.24.13.6 ライブラリ
....................

   - gh-132174(1): Fix function name in error message of
     ‘_interpreters.run_string’.

   - gh-132171(2): Fix crash of ‘_interpreters.run_string’ on string
     subclasses.

   - gh-129204(3): Introduce new ‘_PYTHON_SUBPROCESS_USE_POSIX_SPAWN’
     environment variable knob in *note subprocess: dc. to control the
     use of *note os.posix_spawn(): 52e.

   - gh-132159(4): Do not shadow user arguments in generated ‘__new__()’
     by decorator *note warnings.deprecated: 489.  Patch by Xuehai Pan.

   - gh-132168(5): The *note ctypes.py_object: 1f3. type now supports
     subscription, making it a *note generic type: 1a1.

   - gh-84481(6): Add the ‘zipfile.ZipFile.data_offset’ attribute, which
     stores the offset to the beginning of ZIP data in a file when
     available.  When the *note zipfile.ZipFile: 8d3. is opened in
     either mode ‘'w'’ or ‘'x'’ and the underlying file does not support
     ‘tell()’, the value will be ‘None’ instead.

   - gh-132075(7): Fix possible use of *note socket: d1. address
     structures with uninitialized members.  Now all structure members
     are initialized with zeroes by default.

   - gh-118761(8): Improve import times by up to 27x for the *note
     string: d8. module.  Patch by Adam Turner.

   - gh-125434(9): Display thread name in *note faulthandler: 5c.  Patch
     by Victor Stinner.

   - gh-132002(10): Fix crash when deallocating *note
     contextvars.ContextVar: 1875. with weird unahashable string names.

   - gh-131938(11): *note xml.etree.ElementTree: 12b.: update the error
     message when an element to remove via *note Element.remove: 1876.
     is not found.  Patch by Bénédikt Tran.

   - gh-115942(12): Add *note threading.RLock.locked(): 183c, *note
     multiprocessing.Lock.locked(): 1877, *note
     multiprocessing.RLock.locked(): 1878, and allow *note
     multiprocessing.managers.SyncManager.Lock(): 15af. and *note
     multiprocessing.managers.SyncManager.RLock(): 15b0. to proxy
     ‘locked()’ call.

   - gh-131974(13): Fix several thread-safety issues in *note ctypes:
     2e. on the *note free threaded: 1f4. build.

   - gh-118761(14): Improve the import time of the *note ast: 9. module
     by extracting the *note unparse(): ae2. function to a helper
     module.

   - gh-107369(15): Improved performance of *note textwrap.indent():
     57d. by an average of ~1.3x.  Patch by Adam Turner.

   - gh-131792(16): Improved performance of *note textwrap.dedent():
     1a9. by an average of ~2.4x, (with improvements of up to 4x for
     large inputs), and fixed a bug where blank lines with whitespace
     characters other than space or horizontal tab were not normalised
     to the newline.  Patch by Adam Turner, Marius Juston, and Pieter
     Eendebak.

   - gh-131668(17): *note socket: d1.: Fix code parsing AF_BLUETOOTH
     socket addresses.

   - gh-60115(18): Support frozen modules for *note linecache.getline():
     240.

   - gh-131492(19): Fix a resource leak when constructing a *note
     gzip.GzipFile: 65c. with a filename fails, for example when passing
     an invalid ‘compresslevel’.

   - gh-131435(20): 10-20% performance improvement of *note
     random.randint(): 1447.

   - gh-131461(21): Fix *note ResourceWarning: 54c. when constructing a
     *note gzip.GzipFile: 65c. in write mode with a broken file object.

   - gh-125866(22): Deprecate the ‘nturl2path’ module.  Call *note
     urllib.request.url2pathname(): 2bd. and *note pathname2url(): 2bf.
     instead.

   - gh-126367(23): Fix issue where *note urllib.request.url2pathname():
     2bd. raised *note OSError: 2c0. when given a Windows URI containing
     a colon character not following a drive letter, such as before an
     NTFS alternate data stream.

   - gh-120144(24): Disable ‘CALL’ event in *note bdb: 10. in
     ‘monitoring’ backend when we don't need any new events on the code
     object to get a better performance.

   - gh-131358(25): Register ‘cseuckr’ as an encoding alias for
     ‘euc_kr’.

   - gh-131325(26): Fix sendfile fallback implementation to drain data
     after writing to transport in *note asyncio: b.

   - gh-90548(27): *note platform.libc_ver(): 17f5. can now detect and
     report the version of ‘musl’ on Alpine Linux.

   - gh-129843(28): Fix incorrect argument passing in *note
     warnings.warn_explicit(): efd.

   - gh-70647(29): When creating a *note datetime: 34. object with an
     out of range date a more informative error is raised.

   - gh-130914(30): Allow *note graphlib.TopologicalSorter.prepare():
     21f. to be called more than once as long as sorting has not
     started.  Patch by Daniel Pope.

   - gh-131236(31): Allow to generate multiple UUIDs at once via *note
     python -m uuid -count: 2c7.

   - gh-126895(32): Fix *note readline: bf. in *note free-threaded: 1f4.
     build.

   - gh-121468(33): ‘$_asynctask’ is added as a *note pdb: aa.
     convenience variable to access the current asyncio task if
     applicable.

   - gh-118761(34): Improve import time of *note locale: 8a. using lazy
     import ‘re’.  Patch by Semyon Moroz.

   - gh-129598(35): Fix *note ast.unparse(): ae2. when *note
     ast.Interactive: 1879. contains multiple statements.

   - gh-85162(36): The *note http.server: 76. module now includes
     built-in support for HTTPS servers exposed by *note
     http.server.HTTPSServer: 228.  This functionality is exposed by the
     command-line interface (‘python -m http.server’) through the
     ‘--tls-cert’, ‘--tls-key’ and ‘--tls-password-file’ options.  Patch
     by Semyon Moroz.

   - gh-129463(37): The implementations of equality and hashing for
     *note annotationlib.ForwardRef: 1776. now use all attributes on the
     object.  Two ‘ForwardRef’ objects are equal only if all attributes
     are equal.

   - gh-128593(38): *note annotationlib.ForwardRef: 1776. objects no
     longer cache their value when they are successfully evaluated.
     Successive calls to *note annotationlib.ForwardRef.evaluate():
     17b2. may return different values.

   - gh-117779(39): Fix reading duplicated entries in *note zipfile:
     137. by name.  Reading duplicated entries (except the last one) by
     ‘ZipInfo’ now emits a warning instead of raising an exception.

   - gh-128715(40): The class of *note Structure: 1e5./*note Union: 1e6.
     field descriptors is now available as *note CField: 1e8, and has
     new attributes to aid debugging and introspection.

   - gh-128055(41): Fix ‘test.test_sysconfig.test_sysconfigdata_json’
     when running outside the build directory (eg.  after installing).

   - gh-126037(42): *note xml.etree.ElementTree: 12b.: Fix a crash in
     *note Element.find: 187a, *note Element.findtext: 187b. and *note
     Element.findall: 187c. when the tag to find implements an *note
     __eq__(): cf2. method mutating the element being queried.  Patch by
     Bénédikt Tran.

   - gh-127794(43): When headers are added to *note
     email.message.Message: 581. objects, either through *note
     email.message.Message.__setitem__(): 187d. or *note
     email.message.Message.add_header(): 187e, the field name is now
     validated according to RFC 5322, Section 2.2(44) and a *note
     ValueError: 2ec. is raised if the field name contains any invalid
     characters.

   - gh-123599(45): Deprecate ‘pathlib.PurePath.as_uri()’; use *note
     pathlib.Path.as_uri(): 31c. instead.

   - gh-126033(46): *note xml.etree.ElementTree: 12b.: Fix a crash in
     *note Element.remove: 1876. when the element is concurrently
     mutated.  Patch by Bénédikt Tran.

   - gh-120144(47): Add the optional backend of ‘sys.monitoring’ to
     *note bdb: 10. and use it for *note pdb: aa.

   - gh-74598(48): Add *note fnmatch.filterfalse(): 211. for excluding
     names matching a pattern.  Patch by Bénédikt Tran.

   - gh-114917(49): Add support for AI_NUMERICSERV in getaddrinfo
     emulation

   - bpo-17254(50): Added aliases for Thai Language using Microsoft Code
     Pages.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132174

   (2) https://github.com/python/cpython/issues/132171

   (3) https://github.com/python/cpython/issues/129204

   (4) https://github.com/python/cpython/issues/132159

   (5) https://github.com/python/cpython/issues/132168

   (6) https://github.com/python/cpython/issues/84481

   (7) https://github.com/python/cpython/issues/132075

   (8) https://github.com/python/cpython/issues/118761

   (9) https://github.com/python/cpython/issues/125434

   (10) https://github.com/python/cpython/issues/132002

   (11) https://github.com/python/cpython/issues/131938

   (12) https://github.com/python/cpython/issues/115942

   (13) https://github.com/python/cpython/issues/131974

   (14) https://github.com/python/cpython/issues/118761

   (15) https://github.com/python/cpython/issues/107369

   (16) https://github.com/python/cpython/issues/131792

   (17) https://github.com/python/cpython/issues/131668

   (18) https://github.com/python/cpython/issues/60115

   (19) https://github.com/python/cpython/issues/131492

   (20) https://github.com/python/cpython/issues/131435

   (21) https://github.com/python/cpython/issues/131461

   (22) https://github.com/python/cpython/issues/125866

   (23) https://github.com/python/cpython/issues/126367

   (24) https://github.com/python/cpython/issues/120144

   (25) https://github.com/python/cpython/issues/131358

   (26) https://github.com/python/cpython/issues/131325

   (27) https://github.com/python/cpython/issues/90548

   (28) https://github.com/python/cpython/issues/129843

   (29) https://github.com/python/cpython/issues/70647

   (30) https://github.com/python/cpython/issues/130914

   (31) https://github.com/python/cpython/issues/131236

   (32) https://github.com/python/cpython/issues/126895

   (33) https://github.com/python/cpython/issues/121468

   (34) https://github.com/python/cpython/issues/118761

   (35) https://github.com/python/cpython/issues/129598

   (36) https://github.com/python/cpython/issues/85162

   (37) https://github.com/python/cpython/issues/129463

   (38) https://github.com/python/cpython/issues/128593

   (39) https://github.com/python/cpython/issues/117779

   (40) https://github.com/python/cpython/issues/128715

   (41) https://github.com/python/cpython/issues/128055

   (42) https://github.com/python/cpython/issues/126037

   (43) https://github.com/python/cpython/issues/127794

   (44) https://datatracker.ietf.org/doc/html/rfc5322.html#section-2.2

   (45) https://github.com/python/cpython/issues/123599

   (46) https://github.com/python/cpython/issues/126033

   (47) https://github.com/python/cpython/issues/120144

   (48) https://github.com/python/cpython/issues/74598

   (49) https://github.com/python/cpython/issues/114917

   (50) https://bugs.python.org/issue?@action=redirect&bpo=17254


File: python.info,  Node: ドキュメント<9>,  Next: Core and Builtins<25>,  Prev: ライブラリ<28>,  Up: Python 3 14 0 alpha 7

1.24.13.7 ドキュメント
......................

   - gh-131417(1): Mention *note asyncio.Future: dc6. and *note
     asyncio.Task: 1c7. in generic classes list.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131417


File: python.info,  Node: Core and Builtins<25>,  Next: ライブラリ<29>,  Prev: ドキュメント<9>,  Up: Python 3 14 0 alpha 7

1.24.13.8 Core and Builtins
...........................

   - gh-131798(1): Allow the JIT to remove an extra ‘_TO_BOOL_BOOL’
     instruction after ‘_CONTAINS_OP_SET’ by setting the return type to
     bool.

   - gh-132011(2): Fix crash when calling *note list.append(): 8dc. as
     an unbound method.

   - gh-131998(3): Fix a crash when using an unbound method *note
     descriptor: 1881. object in a function where a bound method
     descriptor was used.

   - gh-131591(4): Implement PEP 768(5) (Safe external debugger
     interface for CPython).  Add a new *note sys.remote_exec(): 16d.
     function to the *note sys: df. module.  This function schedules the
     execution of a Python file in a separate process.  Patch by Pablo
     Galindo, Matt Wozniski and Ivona Stojanovic.

   - gh-131798(6): Allow JIT to omit str guard in truthiness test when
     str type is known.

   - gh-131833(7): Add support for optionally dropping grouping
     parentheses when using multiple exception types as per PEP 758(8).
     Patch by Pablo Galindo

   - gh-130924(9): Usage of a name in a function-scope annotation no
     longer triggers creation of a cell for that variable.  This fixes a
     regression in earlier alphas of Python 3.14.

   - gh-131800(10): Improve the experimental JIT's ability to remove
     type checks for certain subscripting operations.

   - gh-131738(11): Compiler emits optimized code for builtin
     any/all/tuple calls over a generator expression.

   - gh-131719(12): Fix missing NULL check in ‘_PyMem_FreeDelayed’ in
     *note free-threaded: 1f4. build.

   - gh-131670(13): Fix *note anext(): 9d6. failing on sync *note
     __anext__(): 1882. raising an exception.

   - gh-131666(14): Fix signature of ‘anext_awaitable.close’ objects.
     Patch by Bénédikt Tran.

   - gh-130415(15): Optimize comparison of two constants in JIT builds

   - gh-129149(16): Add fast path for small and medium-size integers in
     *note PyLong_FromInt32(): 3a3, *note PyLong_FromUInt32(): 3a5,
     *note PyLong_FromInt64(): 3a4. and *note PyLong_FromUInt64(): 3a6.
     Patch by Chris Eibl.

   - gh-130887(17): Optimize the AArch64 code generation for the JIT.
     Patch by Diego Russo

   - gh-130956(18): Optimize the AArch64 code generation for the JIT.
     Patch by Diego Russo

   - gh-130928(19): Fix error message when formatting bytes using the
     ‘'i'’ flag.  Patch by Maxim Ageev.

   - gh-130935(20): Annotations at the class and module level that are
     conditionally defined are now only reflected in ‘__annotations__’
     if the block they are in is executed.  Patch by Jelle Zijlstra.

   - gh-130775(21): Do not crash on negative ‘column’ and ‘end_column’
     in *note ast: 9. locations.

   - gh-130704(22): Optimize ‘LOAD_FAST’ and its superinstruction form
     to reduce reference counting overhead.  These instructions are
     replaced with faster variants that load borrowed references onto
     the operand stack when we can prove that the reference in the frame
     outlives the reference loaded onto the stack.

   - gh-88887(23): Fixing multiprocessing Resource Tracker process
     leaking, usually observed when running Python as PID 1.

   - gh-130115(24): Fix an issue with thread identifiers being
     sign-extended on some platforms.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131798

   (2) https://github.com/python/cpython/issues/132011

   (3) https://github.com/python/cpython/issues/131998

   (4) https://github.com/python/cpython/issues/131591

   (5) https://peps.python.org/pep-0768/

   (6) https://github.com/python/cpython/issues/131798

   (7) https://github.com/python/cpython/issues/131833

   (8) https://peps.python.org/pep-0758/

   (9) https://github.com/python/cpython/issues/130924

   (10) https://github.com/python/cpython/issues/131800

   (11) https://github.com/python/cpython/issues/131738

   (12) https://github.com/python/cpython/issues/131719

   (13) https://github.com/python/cpython/issues/131670

   (14) https://github.com/python/cpython/issues/131666

   (15) https://github.com/python/cpython/issues/130415

   (16) https://github.com/python/cpython/issues/129149

   (17) https://github.com/python/cpython/issues/130887

   (18) https://github.com/python/cpython/issues/130956

   (19) https://github.com/python/cpython/issues/130928

   (20) https://github.com/python/cpython/issues/130935

   (21) https://github.com/python/cpython/issues/130775

   (22) https://github.com/python/cpython/issues/130704

   (23) https://github.com/python/cpython/issues/88887

   (24) https://github.com/python/cpython/issues/130115


File: python.info,  Node: ライブラリ<29>,  Next: Core and Builtins<26>,  Prev: Core and Builtins<25>,  Up: Python 3 14 0 alpha 7

1.24.13.9 ライブラリ
....................

   - gh-99108(1): Add support for built-in implementation of HMAC ( RFC
     2104(2)) based on HACL*.  Patch by Bénédikt Tran.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99108

   (2) https://datatracker.ietf.org/doc/html/rfc2104.html


File: python.info,  Node: Core and Builtins<26>,  Next: C API<9>,  Prev: ライブラリ<29>,  Up: Python 3 14 0 alpha 7

1.24.13.10 Core and Builtins
............................

   - gh-130080(1): Implement PEP 765: Disallow return/break/continue
     that exit a finally block.

   - gh-129900(2): Fix return codes inside *note SystemExit: f3c. not
     getting returned by the REPL.

   - gh-128632(3): Disallow ‘__classdict__’ as the name of a type
     parameter.  Using this name would previously crash the interpreter
     in some circumstances.

   - gh-126703(4): Improve performance of builtin methods by using a
     freelist.

   - gh-126703(5): Improve performance of *note range: b3d. by using a
     freelist.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/130080

   (2) https://github.com/python/cpython/issues/129900

   (3) https://github.com/python/cpython/issues/128632

   (4) https://github.com/python/cpython/issues/126703

   (5) https://github.com/python/cpython/issues/126703


File: python.info,  Node: C API<9>,  Next: ビルド<9>,  Prev: Core and Builtins<26>,  Up: Python 3 14 0 alpha 7

1.24.13.11 C API
................

   - gh-131740(1): Update PyUnstable_GC_VisitObjects to traverse perm
     gen.

   - gh-131525(2): The PyTupleObject now caches the computed hash value
     in the new field ob_hash.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131740

   (2) https://github.com/python/cpython/issues/131525


File: python.info,  Node: ビルド<9>,  Prev: C API<9>,  Up: Python 3 14 0 alpha 7

1.24.13.12 ビルド
.................

   - gh-131865(1): The DTrace build now properly passes the ‘CC’ and
     ‘CFLAGS’ variables to the ‘dtrace’ command when utilizing SystemTap
     on Linux.

   - gh-131675(2): Fix mimalloc library builds for 32-bit ARM targets.

   - gh-131691(3): clang-cl on Windows needs option ‘/EHa’ to support
     SEH (structured exception handling) correctly.  Fix by Chris Eibl.

   - gh-131278(4): Add optimizing flag ‘WITH_COMPUTED_GOTOS’ to Windows
     builds for when using a compiler that supports it (currently
     clang-cl).  Patch by Chris Eibl.

   - gh-130213(5): Update the vendored HACL* library to fix build issues
     with older clang compilers.

   - gh-130673(6): Fix potential ‘KeyError’ when handling object
     sections during JIT building process.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131865

   (2) https://github.com/python/cpython/issues/131675

   (3) https://github.com/python/cpython/issues/131691

   (4) https://github.com/python/cpython/issues/131278

   (5) https://github.com/python/cpython/issues/130213

   (6) https://github.com/python/cpython/issues/130673


File: python.info,  Node: Python 3 14 0 alpha 6,  Next: Python 3 14 0 alpha 5,  Prev: Python 3 14 0 alpha 7,  Up: 変更履歴

1.24.14 Python 3.14.0 alpha 6
-----------------------------

'Release date: 2025-03-14'

* Menu:

* macOS: macOS<5>.
* Windows: Windows<11>.
* Tools/Demos: Tools/Demos<10>.
* テスト: テスト<8>.
* セキュリティ: セキュリティ<12>.
* ライブラリ: ライブラリ<30>.
* ドキュメント: ドキュメント<10>.
* Core and Builtins: Core and Builtins<27>.
* ライブラリ: ライブラリ<31>.
* Core and Builtins: Core and Builtins<28>.
* ライブラリ: ライブラリ<32>.
* Core and Builtins: Core and Builtins<29>.
* C API: C API<10>.
* ビルド: ビルド<10>.


File: python.info,  Node: macOS<5>,  Next: Windows<11>,  Up: Python 3 14 0 alpha 6

1.24.14.1 macOS
...............

   - gh-128540(1): Ensure web browser is launched by *note
     webbrowser.open(): 1889. on macOS, even for ‘file://’ URLs.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128540


File: python.info,  Node: Windows<11>,  Next: Tools/Demos<10>,  Prev: macOS<5>,  Up: Python 3 14 0 alpha 6

1.24.14.2 Windows
.................

   - gh-131020(1): pylauncher(2) correctly detects a BOM when searching
     for the shebang.  Fix by Chris Eibl.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131020

   (2) https://github.com/python/cpython/tree/3.14/PC/launcher2.c


File: python.info,  Node: Tools/Demos<10>,  Next: テスト<8>,  Prev: Windows<11>,  Up: Python 3 14 0 alpha 6

1.24.14.3 Tools/Demos
.....................

   - gh-130453(1): Make it possible to override default keywords in
     ‘pygettext’.

   - gh-85012(2): Correctly reset ‘msgctxt’ when compiling messages in
     ‘msgfmt’.

   - gh-130453(3): Extend support for specifying custom keywords in
     ‘pygettext’.

   - gh-130195(4): Add warning messages when ‘pygettext’ unimplemented
     ‘-a/--extract-all’ option is called.

   - gh-130057(5): Add support for translator comments in
     ‘pygettext.py’.

   - gh-130025(6): The iOS testbed now correctly handles symlinks used
     as Python framework references.

   - gh-129911(7): Fix the keyword entry in the help output of
     ‘pygettext’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/130453

   (2) https://github.com/python/cpython/issues/85012

   (3) https://github.com/python/cpython/issues/130453

   (4) https://github.com/python/cpython/issues/130195

   (5) https://github.com/python/cpython/issues/130057

   (6) https://github.com/python/cpython/issues/130025

   (7) https://github.com/python/cpython/issues/129911


File: python.info,  Node: テスト<8>,  Next: セキュリティ<12>,  Prev: Tools/Demos<10>,  Up: Python 3 14 0 alpha 6

1.24.14.4 テスト
................

   - gh-129200(1): Multiple iOS testbed runners can now be started at
     the same time without introducing an ambiguity over simulator
     ownership.

   - gh-130292(2): The iOS testbed will now run successfully on a
     machine that has not previously run Xcode tests (such as CI
     configurations).

   - gh-130293(3): The tests of terminal colorization are no longer
     sensitive to the value of the ‘TERM’ variable in the testing
     environment.

   - gh-129401(4): Fix a flaky test in ‘test_repr_rlock’ that checks the
     representation of *note multiprocessing.RLock: 1854.

   - gh-126332(5): Add unit tests for pyrepl.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129200

   (2) https://github.com/python/cpython/issues/130292

   (3) https://github.com/python/cpython/issues/130293

   (4) https://github.com/python/cpython/issues/129401

   (5) https://github.com/python/cpython/issues/126332


File: python.info,  Node: セキュリティ<12>,  Next: ライブラリ<30>,  Prev: テスト<8>,  Up: Python 3 14 0 alpha 6

1.24.14.5 セキュリティ
......................

   - gh-127371(1): Avoid unbounded buffering for
     ‘tempfile.SpooledTemporaryFile.writelines()’.  Previously, disk
     spillover was only checked after the lines iterator had been
     exhausted.  This is now done after each line is written.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127371


File: python.info,  Node: ライブラリ<30>,  Next: ドキュメント<10>,  Prev: セキュリティ<12>,  Up: Python 3 14 0 alpha 6

1.24.14.6 ライブラリ
....................

   - gh-131204(1): Use monospace font from System Font Stack for
     cross-platform support in *note difflib.HtmlDiff: 201.

   - gh-131196(2): Improve performance of *note uuid.UUID.hex: 188f. and
     *note uuid.UUID.__str__: 830.

   - gh-130940(3): The behavior of ‘PyConfig.use_system_logger’ was
     modified to be enabled by default on iOS. It remains disabled by
     default on macOS.

   - gh-131123(4): Supported completions for attributes of convenience
     variables in *note pdb: aa.

   - gh-93096(5): Removed undocumented CLI ‘python -m difflib’.  Use
     ‘python -m doctest Lib/difflib.py -v’ instead.  Patch by Semyon
     Moroz.

   - gh-93096(6): Removed undocumented ‘-t’ and ‘-v’ arguments of
     ‘python -m pickle’.  Use ‘python -m doctest Lib/pickle.py -v’
     instead.  Patch by Semyon Moroz.

   - gh-81267(7): Correct *note time.sleep(): 8ac. error message when an
     object that cannot be interpreted as an integer or float is
     provided.

   - gh-93096(8): Removed undocumented ‘-t’ and ‘-v’ arguments of
     ‘python -m pickletools’.  Use ‘python -m doctest Lib/pickletools.py
     -v’ instead.  Patch by Semyon Moroz.

   - gh-131045(9): Fix issue with ‘__contains__’, values, and
     pseudo-members for *note enum.Flag: 835.

   - gh-130959(10): Fix pure-Python implementation of *note
     datetime.time.fromisoformat(): 829. to reject times with spaces in
     fractional part (for example, ‘12:34:56.400 +02:00’), matching the
     C implementation.  Patch by Michał Gorny.

   - gh-130806(11): Deleting *note gzip.GzipFile: 65c. before it is
     closed now emits a *note ResourceWarning: 54c.

   - gh-130637(12): Add validation for numeric response data in
     poplib.POP3.stat() method

   - gh-130665(13): Only apply locale to *note calendar CLI: 1d0. when
     set via ‘--locale’ and not via ‘LANG’ environment variable.

   - gh-130660(14): ‘sys.ps1’ and ‘sys.ps2’ are now restored after *note
     code.interact(): 1890. call.

   - gh-130608(15): Remove 'dirs_exist_ok' argument from *note
     pathlib.Path.copy(): 267. and *note copy_into(): 268.  These
     methods are new in Python 3.14.

   - gh-130461(16): Remove ‘.. index::’ directives from the *note uuid:
     116. module documentation.  These directives previously created
     entries in the general index for *note getnode(): da0. as well as
     the *note uuid1(): da1, *note uuid3(): 2e5, *note uuid4(): 2e7,
     *note uuid5(): 2e6, and *note uuid8(): 2c4. constructor functions.

   - gh-130379(17): The zipapp module now calculates the list of files
     to be added to the archive before creating the archive.  This
     avoids accidentally including the target when it is being created
     in the source directory.

   - gh-82987(18): Inline breakpoints like *note breakpoint(): 271. or
     *note pdb.set_trace(): 272. will always stop the program at calling
     frame, ignoring the ‘skip’ pattern (if any).

   - gh-125377(19): ‘<tab>’ at the beginning of the line in *note pdb:
     aa. multi-line input will fill in a 4-space indentation now,
     instead of inserting a ‘\t’ character.

   - gh-125413(20): Ensure the path returned from *note
     pathlib.Path.copy(): 267. or *note move(): 269. has fresh *note
     info: 26b.

   - gh-65697(21): stdlib configparser will now attempt to validate that
     keys it writes will not result in file corruption (creating a file
     unable to be accurately parsed by a future read() call from the
     same parser).  Attempting a corrupting write() will raise an
     InvalidWriteError.

   - gh-125413(22): Speed up *note Path.copy: 267. by making better use
     of *note info: 26b. internally.

   - gh-130285(23): Fix corner case for *note random.sample(): 94d.
     allowing the 'counts' parameter to specify an empty population.  So
     now, ‘sample([], 0, counts=[])’ and ‘sample('abc', k=0, counts=[0,
     0, 0])’ both give the same result as ‘sample([], 0)’.

   - gh-124703(24): Executing ‘quit’ command in *note pdb: aa. will
     raise *note bdb.BdbQuit: 278. when *note pdb: aa. is started from
     an interactive console using *note breakpoint(): 271. or *note
     pdb.set_trace(): 272.

   - gh-107773(25): Make *note datetime: 34. subclass *note __repr__():
     82f. consistent both implementations.  Patch by Semyon Moroz.

   - gh-130250(26): Fix regression in ‘traceback.print_last()’.

   - gh-123471(27): Make concurrent iterations over *note
     itertools.batched: 511. safe under free-threading.

   - gh-57537(28): Support breakpoints for *note zipimport: 138. modules
     on *note pdb: aa.

   - gh-130230(29): Fix crash in *note pow(): 1a4. with only *note
     Decimal: 1fe. third argument.

   - gh-126944(30): Show explicit errors when required arguments of
     *note pdb: aa. commands are missing

   - gh-127750(31): Improve repr of *note
     functools.singledispatchmethod: be5. methods and descriptors.

   - gh-128520(32): Apply type conversion consistently in *note
     pathlib.PurePath: 6cd. and *note Path: 266. methods can accept a
     path object as an argument, such as *note match(): 6d3. and *note
     rename(): 1891.  The argument is now converted to path object if it
     lacks a *note with_segments(): 6ce. attribute, and not otherwise.

   - gh-118761(33): Reverts a change in the previous release attempting
     to make some stdlib imports used within the *note subprocess: dc.
     module lazy as this was causing errors during ‘__del__’ finalizers
     calling methods such as ‘terminate’, or ‘kill’, or ‘send_signal’.

   - gh-130164(34): Fixed failure to raise *note TypeError: 198. in
     *note inspect.Signature.bind(): 1892. for positional-only arguments
     provided by keyword when a variadic keyword argument (e.g.
     ‘**kwargs’) is present.

   - gh-130151(35): Fix reference leaks in ‘_hashlib.hmac_new()’ and
     ‘_hashlib.hmac_digest()’.  Patch by Bénédikt Tran.

   - gh-130145(36): Fix ‘asyncio.AbstractEventloop.run_forever()’ when
     another loop is already running.

   - gh-130139(37): Fix bug where *note ast.parse(): 1c2. did not error
     on AST input which is not of the correct type, when called with
     optimize=False.

   - gh-127260(38): Forbid the use of colon (":") as a fractional
     component separator and other improvements to the consistency of
     error raising between the C and Python implementations of *note
     datetime.time.fromisoformat(): 829. and *note
     datetime.datetime.fromisoformat(): 82a.  Patch by Semyon Moroz.

   - gh-85795(39): Using *note super(): 1a6. and ‘__class__’ *note
     closure variable: 1893. in user-defined methods of *note
     typing.NamedTuple: 331. subclasses is now explicitly prohibited at
     runtime.  Contributed by Bartosz Sławecki in gh-130082(40).

   - gh-118761(41): Improve import time of *note cmd: 1a. by lazy
     importing *note inspect: 82. and removing *note string: d8.  Patch
     by Semyon Moroz.

   - gh-129726(42): Fix *note gzip.GzipFile: 65c. raising an unraisable
     exception during garbage collection when referring to a temporary
     object by breaking the reference loop with *note weakref: 11a.

   - gh-127750(43): Remove broken *note
     functools.singledispatchmethod(): be5. caching introduced in
     gh-85160(44).  Achieve the same performance using different
     optimization.

   - gh-129948(45): Add support for shared *note set: 184. to *note
     multiprocessing.managers.SyncManager: 1894. via *note
     SyncManager.set(): 24f.

   - gh-129965(46): Update MIME types for ‘.avi’ and ‘.wav’.  Add MIME
     types for ‘.docx’, ‘.pptx’, ‘.xlsx’, ‘.epub’, ‘.flac’, ‘.m4a’,
     ‘.odg’, ‘.odp’, ‘.ods’, ‘.odt’, ‘.oga’, ‘.ogg’, ‘.ogx’ and ‘.weba’.
     Patch by Hugo van Kemenade.

   - gh-129889(47): Support context manager protocol by *note
     contextvars.Token: 1e2.  Patch by Andrew Svetlov.

   - gh-97850(48): Update the deprecation warning of *note
     importlib.abc.Loader.load_module(): a69.

   - gh-129678(49): *note configparser.ConfigParser: 4de.: do not write
     an empty unnamed section

   - gh-128641(50): Restore *note configparser.ConfigParser.read():
     1681. performance.

   - gh-129569(51): Fix *note unicodedata.normalize(): 8e4. to always
     return a built-in *note str: 169. object when given an input of a
     *note str: 169. subclass, regardless of whether the string is
     already normalized.

   - gh-128231(52): Execution of multiple statements in the new REPL now
     stops immediately upon the first exception encountered.  Patch by
     Bartosz Sławecki.

   - gh-96092(53): Fix bug in *note traceback.walk_stack(): 1081. called
     with None where it was skipping more frames than in prior versions.
     This bug fix also changes walk_stack to walk the stack in the frame
     where it was called rather than where it first gets used.

   - gh-129288(54): Add optional ‘l2_cid’ and ‘l2_bdaddr_type’ fields to
     *note socket: d1. ‘BTPROTO_L2CAP’ sockaddr tuple.

   - gh-128703(55): Fix *note mimetypes.guess_type(): 517. to use
     default mapping for empty ‘Content-Type’ in registry.

   - gh-128647(56): Eagerly write to buffers passed to *note
     gzip.GzipFile: 65c.'s *note readinto(): 1895. and *note
     readinto1(): 101c. implementations, avoiding unnecessary
     allocations.  Patch by Chris Markiewicz.

   - gh-128184(57): Improve display of *note annotationlib.ForwardRef:
     1776. object within *note inspect.Signature: 4e3. representations.
     This also fixes a *note NameError: 452. that was raised when using
     *note dataclasses.dataclass(): 4e1. on classes with unresolvable
     forward references.

   - gh-128041(58): Add *note
     concurrent.futures.ProcessPoolExecutor.terminate_workers(): 1da.
     and *note concurrent.futures.ProcessPoolExecutor.kill_workers():
     1db. as ways to terminate or kill all living worker processes in
     the given pool.  (Contributed by Charles Machalow in
     gh-130849(59).)

   - gh-127647(60): Add protocols *note io.Reader: 236. and *note
     io.Writer: 237. as alternatives to *note typing.IO: 238, *note
     typing.TextIO: 239, and *note typing.BinaryIO: 23a.

   - gh-109798(61): Added additional information into error messages in
     *note datetime: 34, and made the messages more consistent between
     the C and Python implementations.  Patch by Semyon Moroz.

   - gh-125746(62): Delay deprecated *note
     zipimport.zipimporter.load_module(): 338. removal time to 3.15.
     Use *note zipimport.zipimporter.exec_module(): 339. instead.

   - gh-74028(63): Add the optional ‘buffersize’ parameter to *note
     concurrent.futures.Executor.map(): 1dc. to limit the number of
     submitted tasks whose results have not yet been yielded.  If the
     buffer is full, iteration over the 'iterables' pauses until a
     result is yielded from the buffer.

   - gh-124927(64): Non-printing characters are now properly handled in
     the new REPL.

   - gh-124096(65): Turn on virtual terminal mode and enable bracketed
     paste in REPL on Windows console.  (If the terminal does not
     support bracketed paste, enabling it does nothing.)

   - gh-89083(66): Add *note uuid.uuid7(): 2c3. for generating UUIDv7
     objects as specified in RFC 9562(67).  Patch by Bénédikt Tran.

   - gh-89083(68): Add *note uuid.uuid6(): 2c2. for generating UUIDv6
     objects as specified in RFC 9562(69).  Patch by Bénédikt Tran.

   - gh-117151(70): Increase ‘io.DEFAULT_BUFFER_SIZE’ from 8k to 128k
     and adjust *note open(): 316. on platforms where *note os.fstat():
     f8c. provides a ‘st_blksize’ field (such as Linux) to use
     ‘max(min(blocksize, 8 MiB), io.DEFAULT_BUFFER_SIZE)’ rather than
     always using the device block size.  This should improve I/O
     performance.  Patch by Romain Morotti.

   - gh-105499(71): Make *note types.UnionType: 2a7. an alias for *note
     typing.Union: 2a8.  Both ‘int | str’ and ‘Union[int, str]’ now
     create instances of the same type.  Patch by Jelle Zijlstra.

   - gh-93096(72): Document the command-line for *note mimetypes: 93.
     It now exits with ‘1’ on failure instead of ‘0’ and ‘2’ on
     incorrect command-line parameters instead of ‘1’.  Also, errors are
     printed to stderr instead of stdout and their text is made tighter.
     Patch by Oleg Iarygin and Hugo van Kemenade.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131204

   (2) https://github.com/python/cpython/issues/131196

   (3) https://github.com/python/cpython/issues/130940

   (4) https://github.com/python/cpython/issues/131123

   (5) https://github.com/python/cpython/issues/93096

   (6) https://github.com/python/cpython/issues/93096

   (7) https://github.com/python/cpython/issues/81267

   (8) https://github.com/python/cpython/issues/93096

   (9) https://github.com/python/cpython/issues/131045

   (10) https://github.com/python/cpython/issues/130959

   (11) https://github.com/python/cpython/issues/130806

   (12) https://github.com/python/cpython/issues/130637

   (13) https://github.com/python/cpython/issues/130665

   (14) https://github.com/python/cpython/issues/130660

   (15) https://github.com/python/cpython/issues/130608

   (16) https://github.com/python/cpython/issues/130461

   (17) https://github.com/python/cpython/issues/130379

   (18) https://github.com/python/cpython/issues/82987

   (19) https://github.com/python/cpython/issues/125377

   (20) https://github.com/python/cpython/issues/125413

   (21) https://github.com/python/cpython/issues/65697

   (22) https://github.com/python/cpython/issues/125413

   (23) https://github.com/python/cpython/issues/130285

   (24) https://github.com/python/cpython/issues/124703

   (25) https://github.com/python/cpython/issues/107773

   (26) https://github.com/python/cpython/issues/130250

   (27) https://github.com/python/cpython/issues/123471

   (28) https://github.com/python/cpython/issues/57537

   (29) https://github.com/python/cpython/issues/130230

   (30) https://github.com/python/cpython/issues/126944

   (31) https://github.com/python/cpython/issues/127750

   (32) https://github.com/python/cpython/issues/128520

   (33) https://github.com/python/cpython/issues/118761

   (34) https://github.com/python/cpython/issues/130164

   (35) https://github.com/python/cpython/issues/130151

   (36) https://github.com/python/cpython/issues/130145

   (37) https://github.com/python/cpython/issues/130139

   (38) https://github.com/python/cpython/issues/127260

   (39) https://github.com/python/cpython/issues/85795

   (40) https://github.com/python/cpython/issues/130082

   (41) https://github.com/python/cpython/issues/118761

   (42) https://github.com/python/cpython/issues/129726

   (43) https://github.com/python/cpython/issues/127750

   (44) https://github.com/python/cpython/issues/85160

   (45) https://github.com/python/cpython/issues/129948

   (46) https://github.com/python/cpython/issues/129965

   (47) https://github.com/python/cpython/issues/129889

   (48) https://github.com/python/cpython/issues/97850

   (49) https://github.com/python/cpython/issues/129678

   (50) https://github.com/python/cpython/issues/128641

   (51) https://github.com/python/cpython/issues/129569

   (52) https://github.com/python/cpython/issues/128231

   (53) https://github.com/python/cpython/issues/96092

   (54) https://github.com/python/cpython/issues/129288

   (55) https://github.com/python/cpython/issues/128703

   (56) https://github.com/python/cpython/issues/128647

   (57) https://github.com/python/cpython/issues/128184

   (58) https://github.com/python/cpython/issues/128041

   (59) https://github.com/python/cpython/issues/130849

   (60) https://github.com/python/cpython/issues/127647

   (61) https://github.com/python/cpython/issues/109798

   (62) https://github.com/python/cpython/issues/125746

   (63) https://github.com/python/cpython/issues/74028

   (64) https://github.com/python/cpython/issues/124927

   (65) https://github.com/python/cpython/issues/124096

   (66) https://github.com/python/cpython/issues/89083

   (67) https://datatracker.ietf.org/doc/html/rfc9562.html

   (68) https://github.com/python/cpython/issues/89083

   (69) https://datatracker.ietf.org/doc/html/rfc9562.html

   (70) https://github.com/python/cpython/issues/117151

   (71) https://github.com/python/cpython/issues/105499

   (72) https://github.com/python/cpython/issues/93096


File: python.info,  Node: ドキュメント<10>,  Next: Core and Builtins<27>,  Prev: ライブラリ<30>,  Up: Python 3 14 0 alpha 6

1.24.14.7 ドキュメント
......................

   - gh-125722(1): Require Sphinx 8.2.0 or later to build the Python
     documentation.  Patch by Adam Turner.

   - gh-129712(2): The wheel tags supported by each macOS universal SDK
     option are now documented.

   - gh-46236(3): C API: Document *note PyUnicode_RSplit(): 1897, *note
     PyUnicode_Partition(): 1898. and *note PyUnicode_RPartition():
     1899.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/125722

   (2) https://github.com/python/cpython/issues/129712

   (3) https://github.com/python/cpython/issues/46236


File: python.info,  Node: Core and Builtins<27>,  Next: ライブラリ<31>,  Prev: ドキュメント<10>,  Up: Python 3 14 0 alpha 6

1.24.14.8 Core and Builtins
...........................

   - gh-131141(1): Fix data race in *note sys.monitoring: e0.
     instrumentation while registering callback.

   - gh-130804(2): Fix support of unicode characters on Windows in the
     new REPL.

   - gh-130932(3): Fix incorrect exception handling in
     ‘_PyModule_IsPossiblyShadowing’

   - gh-122029(4): *note sys.setprofile(): 1717. and *note
     sys.settrace(): 2e1. will not generate a ‘c_call’ event for
     ‘INSTRUMENTED_CALL_FUNCTION_EX’ if the callable is a method with a
     C function wrapped, because we do not generate ‘c_return’ event in
     such case.

   - gh-129964(5): Fix JIT crash on Windows on Arm.  Patch by Diego
     Russo and Brandt Bucher.

   - gh-130851(6): Fix a crash in the *note free threading: 1f4. build
     when constructing a *note code: 1b. object with *note co_consts:
     189b. that contains instances of types that are not otherwise
     generated by the bytecode compiler.

   - gh-128534(7): Ensure that both left and right branches have the
     same source for ‘async for’ loops.  Add these branches to the
     ‘co_branches()’ iterator.

   - gh-130794(8): Fix memory leak in the *note free threaded: 1f4.
     build when resizing a shared list or dictionary from multiple
     short-lived threads.

   - gh-130415(9): Improve JIT understanding of integers in boolean
     context.

   - gh-130382(10): Fix ‘PyRefTracer_DESTROY’ not being sent from
     ‘Python/ceval.c’ ‘Py_DECREF()’.

   - gh-130574(11): Renumber *note RESUME: 5bb. from 149 to 128.

   - gh-124878(12): Fix race conditions during runtime finalization that
     could lead to accessing freed memory.

   - gh-130415(13): Improve the experimental JIT's ability to narrow
     boolean values based on the results of truthiness tests.

   - gh-130618(14): Fix a bug that was causing ‘UnicodeDecodeError’ or
     ‘SystemError’ to be raised when using f-strings with ‘lambda’
     expressions with non-ASCII characters.  Patch by Pablo Galindo

   - gh-123044(15): Make sure that the location of branch targets in
     ‘match’ cases is in the body, not the pattern.

   - gh-128534(16): Add branch monitoring (‘BRANCH_LEFT’ and
     ‘BRANCH_RIGHT’ events) for ‘async for’ loops.

   - gh-130163(17): Fix possible crashes related to concurrent change
     and use of the *note sys: df. module attributes.

   - gh-122029(18): ‘INSTRUMENTED_CALL_KW’ will expand the method before
     monitoring to reflect the actual behavior more accurately.

   - gh-130415(19): Improve JIT's ability to optimize strings in boolean
     contexts.

   - gh-130396(20): Use actual stack limits (from
     ‘pthread_getattr_np(3)(21)’) for linux, and other systems with
     ‘_GNU_SOURCE’ defined, when determining limits for C stack
     protection.

   - gh-128396(22): Fix a crash that occurs when calling *note locals():
     46f. inside an inline comprehension that uses the same local
     variable as the outer frame scope where the variable is a free or
     cell var.

   - gh-129107(23): Fix two more *note bytearray: 344. functions for
     *note free threading: 1f4.

   - gh-127705(24): Use tagged references (‘_PyStackRef’) for the
     default build as well as for the free-threading build.  This has a
     small negative performance impact short-term but will enable larger
     speedups in the future and significantly reduce maintenance costs
     by allowing a single implementation of tagged references in the
     future.

   - gh-130094(25): Fix two race conditions involving concurrent imports
     that could lead to spurious failures with *note
     ModuleNotFoundError: d3d.

   - gh-129107(26): Make *note bytearray: 344. iterator safe under *note
     free threading: 1f4.

   - gh-115802(27): Use the more efficient "medium" code model for
     JIT-compiled code on supported platforms.

   - gh-107956(28): A ‘build-details.json’ file is now install in the
     platform-independent standard library directory ( PEP 739(29)
     implementation).

   - gh-116042(30): Fix location for SyntaxErrors of invalid escapes in
     the tokenizer.  Patch by Pablo Galindo

   - gh-91079(31): Change C stack overflow protection to consider the
     amount of stack consumed, rather than a counter.  This allows
     deeper recursion in many cases, but remains safe.

   - gh-129715(32): Improve the experimental JIT's handling of returns
     to unknown callers.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131141

   (2) https://github.com/python/cpython/issues/130804

   (3) https://github.com/python/cpython/issues/130932

   (4) https://github.com/python/cpython/issues/122029

   (5) https://github.com/python/cpython/issues/129964

   (6) https://github.com/python/cpython/issues/130851

   (7) https://github.com/python/cpython/issues/128534

   (8) https://github.com/python/cpython/issues/130794

   (9) https://github.com/python/cpython/issues/130415

   (10) https://github.com/python/cpython/issues/130382

   (11) https://github.com/python/cpython/issues/130574

   (12) https://github.com/python/cpython/issues/124878

   (13) https://github.com/python/cpython/issues/130415

   (14) https://github.com/python/cpython/issues/130618

   (15) https://github.com/python/cpython/issues/123044

   (16) https://github.com/python/cpython/issues/128534

   (17) https://github.com/python/cpython/issues/130163

   (18) https://github.com/python/cpython/issues/122029

   (19) https://github.com/python/cpython/issues/130415

   (20) https://github.com/python/cpython/issues/130396

   (21) https://manpages.debian.org/pthread_getattr_np(3)

   (22) https://github.com/python/cpython/issues/128396

   (23) https://github.com/python/cpython/issues/129107

   (24) https://github.com/python/cpython/issues/127705

   (25) https://github.com/python/cpython/issues/130094

   (26) https://github.com/python/cpython/issues/129107

   (27) https://github.com/python/cpython/issues/115802

   (28) https://github.com/python/cpython/issues/107956

   (29) https://peps.python.org/pep-0739/

   (30) https://github.com/python/cpython/issues/116042

   (31) https://github.com/python/cpython/issues/91079

   (32) https://github.com/python/cpython/issues/129715


File: python.info,  Node: ライブラリ<31>,  Next: Core and Builtins<28>,  Prev: Core and Builtins<27>,  Up: Python 3 14 0 alpha 6

1.24.14.9 ライブラリ
....................

   - gh-129983(1): Fix data race in compile_template in ‘sre.c’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129983


File: python.info,  Node: Core and Builtins<28>,  Next: ライブラリ<32>,  Prev: ライブラリ<31>,  Up: Python 3 14 0 alpha 6

1.24.14.10 Core and Builtins
............................

   - gh-129967(1): Fix a race condition in the *note free threading:
     1f4. build when ‘repr(set)’ is called concurrently with
     ‘set.clear()’.

   - gh-129953(2): The internal (evaluation) stack is now spilled to
     memory whenever execution escapes from the interpreter or JIT
     compiled code.  This should have no observable effect in either
     Python or builtin extensions, but will allow various important
     optimizations in the future.

   - gh-129515(3): Clarify syntax error messages for conditional
     expressions when a statement is specified before an *note if: 181.
     or after an *note else: 17c. keyword.

   - gh-129349(4): *note bytes.fromhex(): 190. and *note
     bytearray.fromhex(): 191. now accepts ASCII *note bytes: 192. and
     *note bytes-like objects: 193.

   - gh-129149(5): Add fast path for medium-size integers in *note
     PyLong_FromSsize_t(): 189e.  Patch by Chris Eibl.

   - gh-129107(6): Make the *note bytearray: 344. safe under *note free
     threading: 1f4.

   - gh-128974(7): Fix a crash in *note UnicodeError.__str__: 830. when
     custom attributes implement *note __str__(): 830. with
     side-effects.  Patch by Bénédikt Tran.

   - gh-126085(8): *note typing.TypeAliasType: 2ae. now supports star
     unpacking.

   - gh-125331(9): ‘from __future__ import barry_as_FLUFL’ now works in
     more contexts, including when it is used in files, with the ‘-c’
     flag, and in the REPL when there are multiple statements on the
     same line.  Previously, it worked only on subsequent lines in the
     REPL, and when the appropriate flags were passed directly to *note
     compile(): 4b1.  Patch by Pablo Galindo.

   - gh-121464(10): Make concurrent iterations over the same *note
     enumerate(): 169a. iterator safe under free-threading.  See
     Strategy for Iterators in Free Threading(11).

   - gh-87790(12): Support underscore and comma as thousands separators
     in the fractional part for floating-point presentation types of the
     new-style string formatting (with *note format(): 199. or *note
     f-strings: 19a.).  Patch by Sergey B Kirpichev.

   - gh-124445(13): Fix specialization of generic aliases that are
     generic over a *note typing.ParamSpec: 487. and have been
     specialized with a nested type variable.

   - gh-120608(14): Adapt *note reversed(): a65. for use in the
     free-threading build.  The *note reversed(): a65. is still not
     thread-safe in the sense that concurrent iterations may see the
     same object, but they will not corrupt the interpreter state.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129967

   (2) https://github.com/python/cpython/issues/129953

   (3) https://github.com/python/cpython/issues/129515

   (4) https://github.com/python/cpython/issues/129349

   (5) https://github.com/python/cpython/issues/129149

   (6) https://github.com/python/cpython/issues/129107

   (7) https://github.com/python/cpython/issues/128974

   (8) https://github.com/python/cpython/issues/126085

   (9) https://github.com/python/cpython/issues/125331

   (10) https://github.com/python/cpython/issues/121464

   (11) https://github.com/python/cpython/issues/124397

   (12) https://github.com/python/cpython/issues/87790

   (13) https://github.com/python/cpython/issues/124445

   (14) https://github.com/python/cpython/issues/120608


File: python.info,  Node: ライブラリ<32>,  Next: Core and Builtins<29>,  Prev: Core and Builtins<28>,  Up: Python 3 14 0 alpha 6

1.24.14.11 ライブラリ
.....................

   - gh-100388(1): Fix the ‘platform._sys_version()’ method when
     ‘__DATE__’ is undefined at buildtime by changing default buildtime
     datetime string to the UNIX epoch.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100388


File: python.info,  Node: Core and Builtins<29>,  Next: C API<10>,  Prev: ライブラリ<32>,  Up: Python 3 14 0 alpha 6

1.24.14.12 Core and Builtins
............................

   - bpo-44369(1): Improve syntax errors for incorrectly closed strings.
     Patch by Pablo Galindo

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44369


File: python.info,  Node: C API<10>,  Next: ビルド<10>,  Prev: Core and Builtins<29>,  Up: Python 3 14 0 alpha 6

1.24.14.13 C API
................

   - gh-111178(1): Fix *note PyCMethod: 968. API: replace ‘size_t nargs’
     with ‘Py_ssize_t nargs’ in *note PyCMethod: 968.  Patch by Victor
     Stinner.

   - gh-130947(2): Add again *note PySequence_Fast(): 18a2. to the
     limited C API. Patch by Victor Stinner.

   - gh-128863(3): The following private functions are deprecated and
     planned for removal in Python 3.18:

        * ‘_PyUnicodeWriter_Init()’: replace
          ‘_PyUnicodeWriter_Init(&writer)’ with *note writer =
          PyUnicodeWriter_Create(0): 3b4.

        * ‘_PyUnicodeWriter_Finish()’: replace
          ‘_PyUnicodeWriter_Finish(&writer)’ with *note
          PyUnicodeWriter_Finish(writer): 3b7.

        * ‘_PyUnicodeWriter_Dealloc()’: replace
          ‘_PyUnicodeWriter_Dealloc(&writer)’ with *note
          PyUnicodeWriter_Discard(writer): 3b6.

        * ‘_PyUnicodeWriter_WriteChar()’: replace
          ‘_PyUnicodeWriter_WriteChar(&writer, ch)’ with *note
          PyUnicodeWriter_WriteChar(writer, ch): 3ba.

        * ‘_PyUnicodeWriter_WriteStr()’: replace
          ‘_PyUnicodeWriter_WriteStr(&writer, str)’ with *note
          PyUnicodeWriter_WriteStr(writer, str): 3bc.

        * ‘_PyUnicodeWriter_WriteSubstring()’: replace
          ‘_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)’
          with *note PyUnicodeWriter_WriteSubstring(writer, str, start,
          end): 3bd.

        * ‘_PyUnicodeWriter_WriteASCIIString()’: replace
          ‘_PyUnicodeWriter_WriteASCIIString(&writer, str)’ with *note
          PyUnicodeWriter_WriteUTF8(writer, str): 3bf.

        * ‘_PyUnicodeWriter_WriteLatin1String()’: replace
          ‘_PyUnicodeWriter_WriteLatin1String(&writer, str)’ with *note
          PyUnicodeWriter_WriteUTF8(writer, str): 3bf.

        * ‘_PyUnicodeWriter_Prepare()’: (no replacement).

        * ‘_PyUnicodeWriter_PrepareKind()’: (no replacement).

     The pythoncapi-compat project(4) can be used to get these new
     public functions on Python 3.13 and older.

     Patch by Victor Stinner.

   - gh-45325(5): Add a new ‘p’ format parameter to *note
     Py_BuildValue(): 3c2. that allows to take a C integer and produce a
     Python *note bool: 3c3. object.  Patch by Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/111178

   (2) https://github.com/python/cpython/issues/130947

   (3) https://github.com/python/cpython/issues/128863

   (4) https://github.com/python/pythoncapi-compat/

   (5) https://github.com/python/cpython/issues/45325


File: python.info,  Node: ビルド<10>,  Prev: C API<10>,  Up: Python 3 14 0 alpha 6

1.24.14.14 ビルド
.................

   - gh-131035(1): Use ‘-flto=thin’ for faster build times using
     clang-cl on Windows.  Patch by Chris Eibl.

   - gh-130740(2): Ensure that ‘Python.h’ is included before ‘stdbool.h’
     unless ‘pyconfig.h’ is included before or in some platform-specific
     contexts.

   - gh-130090(3): Building with ‘PlatformToolset=ClangCL’ on Windows
     now supports PGO (profile guided optimization).  Patch by Chris
     Eibl with invaluable support from Steve Dover.

   - gh-129819(4): Allow building the JIT with the tailcall interpreter.

   - gh-129989(5): Fix a bug where the tailcall interpreter was enabled
     when ‘--without-tail-call-interp’ was provided to the configure
     script.

   - gh-129838(6): Don't redefine ‘_Py_NO_SANITIZE_UNDEFINED’ when
     compiling with a recent GCC version and undefined sanitizer
     enabled.

   - gh-82909(7): ‘#pragma’-based linking with ‘python3*.lib’ can now be
     switched off with *note Py_NO_LINK_LIB: 444.  Patch by
     Jean-Christophe Fillion-Robin.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/131035

   (2) https://github.com/python/cpython/issues/130740

   (3) https://github.com/python/cpython/issues/130090

   (4) https://github.com/python/cpython/issues/129819

   (5) https://github.com/python/cpython/issues/129989

   (6) https://github.com/python/cpython/issues/129838

   (7) https://github.com/python/cpython/issues/82909


File: python.info,  Node: Python 3 14 0 alpha 5,  Next: Python 3 14 0 alpha 4,  Prev: Python 3 14 0 alpha 6,  Up: 変更履歴

1.24.15 Python 3.14.0 alpha 5
-----------------------------

'Release date: 2025-02-11'

* Menu:

* macOS: macOS<6>.
* Tools/Demos: Tools/Demos<11>.
* テスト: テスト<9>.
* セキュリティ: セキュリティ<13>.
* ライブラリ: ライブラリ<33>.
* IDLE: IDLE<6>.
* ドキュメント: ドキュメント<11>.
* Core and Builtins: Core and Builtins<30>.
* ライブラリ: ライブラリ<34>.
* Core and Builtins: Core and Builtins<31>.
* ライブラリ: ライブラリ<35>.
* Core and Builtins: Core and Builtins<32>.
* ライブラリ: ライブラリ<36>.
* C API: C API<11>.
* ビルド: ビルド<11>.


File: python.info,  Node: macOS<6>,  Next: Tools/Demos<11>,  Up: Python 3 14 0 alpha 5

1.24.15.1 macOS
...............

   - gh-91132(1): Update macOS installer to use ncurses 6.5.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/91132


File: python.info,  Node: Tools/Demos<11>,  Next: テスト<9>,  Prev: macOS<6>,  Up: Python 3 14 0 alpha 5

1.24.15.2 Tools/Demos
.....................

   - gh-129248(1): The iOS test runner now strips the log prefix from
     each line output by the test suite.

   - gh-104400(2): Fix several bugs in extraction by switching to an AST
     parser in ‘pygettext’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129248

   (2) https://github.com/python/cpython/issues/104400


File: python.info,  Node: テスト<9>,  Next: セキュリティ<13>,  Prev: Tools/Demos<11>,  Up: Python 3 14 0 alpha 5

1.24.15.3 テスト
................

   - gh-129386(1): Add ‘test.support.reset_code’, which can be used to
     reset various bytecode-level optimizations and local
     instrumentation for a function.

   - gh-128474(2): Disable ‘test_embed’ test cases that segfault on BOLT
     instrument binaries.  The tests are only disabled when BOLT is
     enabled.

   - gh-128003(3): Add an option ‘--parallel-threads=N’ to the
     regression test runner that runs individual tests in multiple
     threads in parallel in order to find concurrency bugs.  Note that
     most of the test suite is not yet reviewed for thread-safety or
     annotated with ‘@thread_unsafe’ when necessary.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129386

   (2) https://github.com/python/cpython/issues/128474

   (3) https://github.com/python/cpython/issues/128003


File: python.info,  Node: セキュリティ<13>,  Next: ライブラリ<33>,  Prev: テスト<9>,  Up: Python 3 14 0 alpha 5

1.24.15.4 セキュリティ
......................

   - gh-105704(1): When using *note urllib.parse.urlsplit(): f3a. and
     *note urllib.parse.urlparse(): 362. host parsing would not reject
     domain names containing square brackets (‘[’ and ‘]’).  Square
     brackets are only valid for IPv6 and IPvFuture hosts according to
     RFC 3986 Section 3.2.2(2).

   - gh-126108(3): Fix a possible ‘NULL’ pointer dereference in
     ‘PySys_AddWarnOptionUnicode()’.

   - gh-80222(4): Fix bug in the folding of quoted strings when
     flattening an email message using a modern email policy.
     Previously when a quoted string was folded so that it spanned more
     than one line, the surrounding quotes and internal escapes would be
     omitted.  This could theoretically be used to spoof header lines
     using a carefully constructed quoted string if the resulting
     rendered email was transmitted or re-parsed.

   - gh-119511(5): Fix a potential denial of service in the *note
     imaplib: 78. module.  When connecting to a malicious server, it
     could cause an arbitrary amount of memory to be allocated.  On many
     systems this is harmless as unused virtual memory is only a
     mapping, but if this hit a virtual address size limit it could lead
     to a *note MemoryError: 179e. or other process crash.  On unusual
     systems or builds where all allocated memory is touched and backed
     by actual ram or storage it could've consumed resources doing so
     until similarly crashing.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/105704

   (2) https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2

   (3) https://github.com/python/cpython/issues/126108

   (4) https://github.com/python/cpython/issues/80222

   (5) https://github.com/python/cpython/issues/119511


File: python.info,  Node: ライブラリ<33>,  Next: IDLE<6>,  Prev: セキュリティ<13>,  Up: Python 3 14 0 alpha 5

1.24.15.5 ライブラリ
....................

   - gh-129939(1): Comparison pages with highlighted changes generated
     by the *note difflib.HtmlDiff: 201. class now support dark mode.

   - gh-129928(2): Raise *note sqlite3.ProgrammingError: 305. if a
     user-defined SQL function with invalid number of parameters is
     created.  Patch by Erlend Aasland.

   - gh-129583(3): Update bundled pip to 25.0.1

   - gh-129766(4): Fix crash in *note warnings: 118, when calling
     ‘_release_lock()’ with no existing lock.

   - gh-129005(5): ‘_pyio.FileIO.readall()’ now allocates, resizes, and
     fills a data buffer using the same algorithm ‘_io.FileIO.readall()’
     uses.

   - gh-129646(6): Update the locale alias mapping in the *note locale:
     8a. module to match the latest X Org locale alias mapping and
     support new locales in Glibc 2.41.

   - gh-128317(7): Put CLI calendar highlighting in private class,
     removing ‘highlight_day’ from public *note calendar.TextCalendar:
     18aa. API. Patch by Hugo van Kemenade.

   - gh-129603(8): Fix bugs where *note sqlite3.Row: 1071. objects could
     segfault if their inherited *note description: 18ab. was set to
     ‘None’.  Patch by Erlend Aasland.

   - gh-129559(9): Add *note bytearray.resize(): 18ac. method so *note
     bytearray: 344. can be efficiently resized in place.

   - gh-129502(10): Unlikely errors in preparing arguments for *note
     ctypes: 2e. callback are now handled in the same way as errors
     raised in the callback of in converting the result of the callback
     - using *note sys.unraisablehook(): 507. instead of *note
     sys.excepthook(): a0c. and not setting *note sys.last_exc: 6e5. and
     other variables.

   - gh-129403(11): Corrected *note ValueError: 2ec. message for *note
     asyncio.Barrier: 816. and *note threading.Barrier: 13fc.

   - gh-129409(12): Fix an integer overflow in the *note csv: 2d. module
     when writing a data field larger than 2GB.

   - gh-126400(13): Add a socket 'timeout' keyword argument to *note
     logging.handlers.SysLogHandler: 86c.

   - gh-118761(14): Always lazy import ‘warnings’ in *note threading:
     f3.  Patch by Taneli Hukkinen.

   - gh-118761(15): Improve import time of *note subprocess: dc. by lazy
     importing ‘locale’ and ‘signal’.  Patch by Taneli Hukkinen.

   - gh-129346(16): In *note sqlite3: d4, handle out-of-memory when
     creating user-defined SQL functions.

   - gh-129005(17): Optimize ‘_pyio.FileIO.readinto’ by avoiding
     unnecessary objects and copies using *note os.readinto(): 25f.

   - gh-129195(18): Support reporting call graph information from
     ‘asyncio.staggered.staggered_race()’.

   - gh-129205(19): Add *note os.readinto(): 25f. to read into a *note
     buffer object: 260. from a file descriptor.

   - gh-128772(20): Fix *note pydoc: ba. for methods with the
     ‘__module__’ attribute equal to ‘None’.

   - gh-129061(21): Fix FORCE_COLOR and NO_COLOR when empty strings.
     Patch by Hugo van Kemenade.

   - gh-92897(22): Scheduled the deprecation of the ‘check_home’
     argument of *note sysconfig.is_python_build(): 32d. to Python 3.15.

   - gh-129064(23): Deprecate ‘sysconfig.expand_makefile_vars()’, in
     favor of using *note sysconfig.get_paths(): 340. with the ‘vars’
     argument.

   - gh-128550(24): Removed an incorrect optimization relating to eager
     tasks in *note asyncio.TaskGroup: 4d1. that resulted in
     cancellations being missed.

   - gh-128991(25): Release the enter frame reference within *note bdb:
     10. callback

   - gh-118761(26): Reduce import time of *note pstats: b5. and *note
     zipfile: 137. by up to 20%, by removing unnecessary imports to
     *note typing: 10a.  Patch by Bénédikt Tran.

   - gh-128978(27): Fix a *note NameError: 452. in
     ‘sysconfig.expand_makefile_vars()’.  Patch by Bénédikt Tran.

   - gh-128961(28): Fix a crash when setting state on an exhausted *note
     array.array: 4be. iterator.

   - gh-128894(29): Fix
     ‘traceback.TracebackException._format_syntax_error’ not to fail on
     exceptions with custom metadata.

   - gh-128916(30): Do not attempt to set ‘SO_REUSEPORT’ on sockets of
     address families other than ‘AF_INET’ and ‘AF_INET6’, as it is
     meaningless with these address families, and the call with fail
     with Linux kernel 6.12.9 and newer.

   - gh-118761(31): Improve import time of *note tomllib: 102. by
     removing ‘typing’, ‘string’, and ‘tomllib._types’ imports.  Patch
     by Taneli Hukkinen.

   - gh-128679(32): *note tracemalloc: 105.: Fix race conditions when
     *note tracemalloc.stop(): 18ad. is called by a thread, while other
     threads are tracing memory allocations.  Patch by Victor Stinner.

   - gh-128891(33): Add specialized opcodes to ‘opcode.opname’.

   - gh-118761(34): Reduce import time of *note gettext: 67. by up to
     ten times, by importing *note re: be. on demand.  In particular,
     ‘re’ is no longer implicitly exposed as ‘gettext.re’.  Patch by Eli
     Schwartz.

   - gh-118761(35): Reduce the import time of *note optparse: a4. when
     no help text is printed.  Patch by Eli Schwartz.

   - gh-128657(36): Fix possible extra reference when using objects
     returned by *note hashlib.sha256(): 18ae. under *note free
     threading: 1f4.

   - gh-118761(37): Reduce the import time of *note csv: 2d. by up to
     five times, by importing *note re: be. on demand.  In particular,
     ‘re’ is no more implicitly exposed as ‘csv.re’.  Patch by Bénédikt
     Tran.

   - gh-128308(38): Support the 'name' keyword argument for eager tasks
     in *note asyncio.loop.create_task(): 1ca, *note
     asyncio.create_task(): 1c9. and *note
     asyncio.TaskGroup.create_task(): 1cb, by passing on all 'kwargs' to
     the task factory set by *note asyncio.loop.set_task_factory(): 1c8.

   - gh-118761(39): Improve the performance of *note base64.b16decode():
     2d3. by up to ten times by more efficiently checking the
     byte-string for hexadecimal digits.  Reduce the import time of
     *note base64: f. by up to six times, by no longer importing *note
     re: be.  Patch by Bénédikt Tran, Chris Markiewicz, and Adam Turner.

   - gh-128156(40): When using macOS system ‘libffi’, support for
     complex types in *note ctypes: 2e. is now checked at runtime (macOS
     10.15 or newer).  The types must also be available at build time.

   - gh-128636(41): Fix PyREPL failure when *note os.environ: 259. is
     overwritten with an invalid value.

   - gh-128498(42): Default to stdout isatty for color detection instead
     of stderr.  Patch by Hugo van Kemenade.

   - gh-128384(43): Add locking to *note warnings: 118. to avoid some
     data races when free-threading is used.  Change
     ‘_warnings_runtime_state.mutex’ to be a recursive mutex and expose
     it to *note warnings: 118, via the ‘_acquire_lock()’ and
     ‘_release_lock()’ functions.  The lock is held when ‘filters’ and
     ‘_filters_version’ are updated.

   - gh-128509(44): Add *note sys._is_immortal(): 28f. for identifying
     *note immortal: 290. objects at runtime.

   - gh-128479(45): Fix ‘asyncio.staggered.staggered_race()’ leaking
     tasks and issuing an unhandled exception.

   - gh-128427(46): *note uuid.NIL: 2c5. and *note uuid.MAX: 2c6. are
     now available to represent the Nil and Max UUID formats as defined
     by RFC 9562(47).

   - gh-91279(48): *note zipfile.ZipFile.writestr(): 2cc. now respect
     ‘SOURCE_DATE_EPOCH’ that distributions can set centrally and have
     build tools consume this in order to produce reproducible output.

   - gh-112064(49): Fix incorrect handling of negative read sizes in
     *note HTTPResponse.read: 18af.  Patch by Yury Manushkin.

   - gh-58956(50): Fixed a frame reference leak in *note bdb: 10.

   - gh-128131(51): Completely support random access of uncompressed
     unencrypted read-only zip files obtained by *note ZipFile.open:
     65d.

   - gh-127975(52): Avoid reusing quote types in *note ast.unparse():
     ae2. if not needed.

   - gh-115514(53): Fix exceptions and incomplete writes after
     ‘asyncio._SelectorTransport’ is closed before writes are completed.

   - gh-121604(54): Add missing Deprecation warnings for *note
     importlib.machinery.DEBUG_BYTECODE_SUFFIXES: 18b0, *note
     importlib.machinery.OPTIMIZED_BYTECODE_SUFFIXES: 18b1, *note
     importlib.machinery.WindowsRegistryFinder: f26, *note
     importlib.abc.ResourceLoader: de2, *note
     importlib.abc.SourceLoader.path_mtime(): 13a2.

   - gh-127873(55): When ‘-E’ is set, only ignore ‘PYTHON_COLORS’ and
     not ‘FORCE_COLOR’/‘NO_COLOR’/‘TERM’ when colourising output.  Patch
     by Hugo van Kemenade.

   - gh-125413(56): Add *note pathlib.Path.info: 26b. attribute, which
     stores an object implementing the *note pathlib.types.PathInfo:
     26c. protocol (also new).  The object supports querying the file
     type and internally caching *note stat(): 26d. results.  Path
     objects generated by *note iterdir(): 26e. are initialized with
     file type information gleaned from scanning the parent directory.

   - gh-127712(57): Fix handling of the ‘secure’ argument of *note
     logging.handlers.SMTPHandler: 18b2.

   - gh-127096(58): Do not recreate unnamed section on every read in
     *note configparser.ConfigParser: 4de.  Patch by Andrey Efremov.

   - gh-124369(59): Deprecate ‘pdb.Pdb.curframe_locals’

   - gh-126332(60): Fix _pyrepl crash when entering a double CTRL-Z on
     an overflowing line.

   - gh-125553(61): Fix round-trip invariance for backslash
     continuations in *note tokenize.untokenize(): 18b3.

   - gh-91048(62): Add *note asyncio.capture_call_graph(): 1cc. and
     *note asyncio.print_call_graph(): 1cd. functions.

   - gh-124703(63): Quitting *note pdb: aa. in ‘inline’ mode will emit a
     confirmation prompt and exit gracefully now, instead of printing an
     exception traceback.

   - gh-123987(64): Fixed issue in NamespaceReader where a non-path item
     in a namespace path, such as a sentinel added by an editable
     installer, would break resource loading.

   - gh-119349(65): Add the *note ctypes.util.dllist(): 1f0. function to
     list the loaded shared libraries for the current process.

   - gh-55454(66): Add IMAP4 ‘IDLE’ support to the *note imaplib: 78.
     module.  Patch by Forest.

   - gh-119257(67): Show tab completions menu below the current line,
     which results in less janky behaviour, and fixes a cursor movement
     bug.  Patch by Daniel Hollas

   - gh-101410(68): Support custom messages for domain errors in the
     *note math: 92. module (*note math.sqrt(): bf9, *note math.log():
     16d9. and *note math.atanh(): 15f0. were modified as examples).
     Patch by Charlie Zhao and Sergey B Kirpichev.

   - gh-81340(69): Use *note os.copy_file_range(): 18b4. in *note
     shutil.copy(): c4f, *note shutil.copy2(): c50, and *note
     shutil.copyfile(): c4e. functions by default.  An underlying Linux
     system call gives filesystems an opportunity to implement the use
     of copy-on-write (in case of btrfs and XFS) or server-side copy (in
     the case of NFS.) Patch by Illia Volochii.

   - bpo-27307(70): Add attribute and item access support to *note
     string.Formatter: 10bd. in auto-numbering mode, which allows format
     strings like '{.name}' and '{[1]}'.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129939

   (2) https://github.com/python/cpython/issues/129928

   (3) https://github.com/python/cpython/issues/129583

   (4) https://github.com/python/cpython/issues/129766

   (5) https://github.com/python/cpython/issues/129005

   (6) https://github.com/python/cpython/issues/129646

   (7) https://github.com/python/cpython/issues/128317

   (8) https://github.com/python/cpython/issues/129603

   (9) https://github.com/python/cpython/issues/129559

   (10) https://github.com/python/cpython/issues/129502

   (11) https://github.com/python/cpython/issues/129403

   (12) https://github.com/python/cpython/issues/129409

   (13) https://github.com/python/cpython/issues/126400

   (14) https://github.com/python/cpython/issues/118761

   (15) https://github.com/python/cpython/issues/118761

   (16) https://github.com/python/cpython/issues/129346

   (17) https://github.com/python/cpython/issues/129005

   (18) https://github.com/python/cpython/issues/129195

   (19) https://github.com/python/cpython/issues/129205

   (20) https://github.com/python/cpython/issues/128772

   (21) https://github.com/python/cpython/issues/129061

   (22) https://github.com/python/cpython/issues/92897

   (23) https://github.com/python/cpython/issues/129064

   (24) https://github.com/python/cpython/issues/128550

   (25) https://github.com/python/cpython/issues/128991

   (26) https://github.com/python/cpython/issues/118761

   (27) https://github.com/python/cpython/issues/128978

   (28) https://github.com/python/cpython/issues/128961

   (29) https://github.com/python/cpython/issues/128894

   (30) https://github.com/python/cpython/issues/128916

   (31) https://github.com/python/cpython/issues/118761

   (32) https://github.com/python/cpython/issues/128679

   (33) https://github.com/python/cpython/issues/128891

   (34) https://github.com/python/cpython/issues/118761

   (35) https://github.com/python/cpython/issues/118761

   (36) https://github.com/python/cpython/issues/128657

   (37) https://github.com/python/cpython/issues/118761

   (38) https://github.com/python/cpython/issues/128308

   (39) https://github.com/python/cpython/issues/118761

   (40) https://github.com/python/cpython/issues/128156

   (41) https://github.com/python/cpython/issues/128636

   (42) https://github.com/python/cpython/issues/128498

   (43) https://github.com/python/cpython/issues/128384

   (44) https://github.com/python/cpython/issues/128509

   (45) https://github.com/python/cpython/issues/128479

   (46) https://github.com/python/cpython/issues/128427

   (47) https://datatracker.ietf.org/doc/html/rfc9562.html

   (48) https://github.com/python/cpython/issues/91279

   (49) https://github.com/python/cpython/issues/112064

   (50) https://github.com/python/cpython/issues/58956

   (51) https://github.com/python/cpython/issues/128131

   (52) https://github.com/python/cpython/issues/127975

   (53) https://github.com/python/cpython/issues/115514

   (54) https://github.com/python/cpython/issues/121604

   (55) https://github.com/python/cpython/issues/127873

   (56) https://github.com/python/cpython/issues/125413

   (57) https://github.com/python/cpython/issues/127712

   (58) https://github.com/python/cpython/issues/127096

   (59) https://github.com/python/cpython/issues/124369

   (60) https://github.com/python/cpython/issues/126332

   (61) https://github.com/python/cpython/issues/125553

   (62) https://github.com/python/cpython/issues/91048

   (63) https://github.com/python/cpython/issues/124703

   (64) https://github.com/python/cpython/issues/123987

   (65) https://github.com/python/cpython/issues/119349

   (66) https://github.com/python/cpython/issues/55454

   (67) https://github.com/python/cpython/issues/119257

   (68) https://github.com/python/cpython/issues/101410

   (69) https://github.com/python/cpython/issues/81340

   (70) https://bugs.python.org/issue?@action=redirect&bpo=27307


File: python.info,  Node: IDLE<6>,  Next: ドキュメント<11>,  Prev: ライブラリ<33>,  Up: Python 3 14 0 alpha 5

1.24.15.6 IDLE
..............

   - gh-129873(1): Simplify displaying the IDLE doc by only copying the
     text section of idle.html to idlelib/help.html.  Patch by Stan
     Ulbrych.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129873


File: python.info,  Node: ドキュメント<11>,  Next: Core and Builtins<30>,  Prev: IDLE<6>,  Up: Python 3 14 0 alpha 5

1.24.15.7 ドキュメント
......................

   - gh-125722(1): Require Sphinx 8.1.3 or later to build the Python
     documentation.  Patch by Adam Turner.

   - gh-67206(2): Document that *note string.printable: 18b7. is not
     printable in the POSIX sense.  In particular, *note
     string.printable.isprintable(): fd8. returns *note False: d2b.
     Patch by Bénédikt Tran.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/125722

   (2) https://github.com/python/cpython/issues/67206


File: python.info,  Node: Core and Builtins<30>,  Next: ライブラリ<34>,  Prev: ドキュメント<11>,  Up: Python 3 14 0 alpha 5

1.24.15.8 Core and Builtins
...........................

   - gh-100239(1): Replace the opcode BINARY_SUBSCR and its family by
     BINARY_OP with oparg NB_SUBSCR.

   - gh-129732(2): Fixed a race in ‘_Py_qsbr_reserve’ in the free
     threading build.

   - gh-129763(3): Remove the internal ‘LLTRACE’ macro (use *note
     Py_DEBUG: 1834. instead).

   - gh-129715(4): Improve JIT performance for generators.

   - gh-129643(5): Fix thread safety of *note PyList_Insert(): 18b9. in
     free-threading builds.

   - gh-129668(6): Fix race condition when raising *note MemoryError:
     179e. in the free threaded build.

   - gh-129643(7): Fix thread safety of *note PyList_SetItem(): 18ba. in
     free-threading builds.  Patch by Kumar Aditya.

   - gh-128563(8): Fix an issue where the "lltrace" debug feature could
     have been incorrectly enabled for some frames.

   - gh-129393(9): On FreeBSD, *note sys.platform: 291. doesn't contain
     the major version anymore.  It is always ‘'freebsd'’, instead of
     ‘'freebsd13'’ or ‘'freebsd14'’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100239

   (2) https://github.com/python/cpython/issues/129732

   (3) https://github.com/python/cpython/issues/129763

   (4) https://github.com/python/cpython/issues/129715

   (5) https://github.com/python/cpython/issues/129643

   (6) https://github.com/python/cpython/issues/129668

   (7) https://github.com/python/cpython/issues/129643

   (8) https://github.com/python/cpython/issues/128563

   (9) https://github.com/python/cpython/issues/129393


File: python.info,  Node: ライブラリ<34>,  Next: Core and Builtins<31>,  Prev: Core and Builtins<30>,  Up: Python 3 14 0 alpha 5

1.24.15.9 ライブラリ
....................

   - gh-129345(1): Fix null pointer dereference in *note
     syslog.openlog(): 760. when an audit hook raises an exception.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129345


File: python.info,  Node: Core and Builtins<31>,  Next: ライブラリ<35>,  Prev: ライブラリ<34>,  Up: Python 3 14 0 alpha 5

1.24.15.10 Core and Builtins
............................

   - gh-129231(1): Improve memory layout of JIT traces.  Patch by Diego
     Russo

   - gh-129149(2): Add fast path for medium-size integers in *note
     PyLong_FromUnsignedLong(): 18bd, *note
     PyLong_FromUnsignedLongLong(): 18be. and *note PyLong_FromSize_t():
     18bf.

   - gh-129201(3): The free-threaded version of the cyclic garbage
     collector has been optimized to conditionally use CPU prefetch
     instructions during the collection.  This can reduce collection
     times by making it more likely that data is in the CPU cache when
     it is needed.  The prefetch instructions are enabled if the number
     of long-lived objects (objects surviving a full collection) exceeds
     a threshold.

   - gh-129093(4): Fix f-strings such as ‘f'{expr=}'’ sometimes not
     displaying the full expression when the expression contains ‘!=’.

   - gh-124363(5): Treat debug expressions in f-string as raw strings.
     Patch by Pablo Galindo

   - gh-128714(6): Fix the potential races in get/set dunder methods
     ‘__annotations__’, ‘__annotate__’ and ‘__type_params__’ for
     function object, and add related tests.

   - gh-128799(7): Add frame of ‘except*’ to traceback when it wraps a
     naked exception.

   - gh-128842(8): Collect JIT memory stats using pystats.  Patch by
     Diego Russo.

   - gh-100239(9): Specialize ‘BINARY_OP’ for bitwise logical operations
     on compact ints.

   - gh-128910(10): Undocumented and unused private C-API functions
     ‘_PyTrash_begin’ and ‘_PyTrash_end’ are removed.

   - gh-128807(11): Add a marking phase to the free-threaded GC. This is
     similar to what was done in gh-126491(12).  Since the free-threaded
     GC does not have generations and is not incremental, the marking
     phase looks for all objects reachable from known roots.  The roots
     are objects known to not be garbage, like the module dictionary for
     *note sys: df.  For most programs, this marking phase should make
     the GC a bit faster since typically less work is done per object.

   - gh-100239(13): Add opcode ‘BINARY_OP_EXTEND’ which executes a pair
     of functions (guard and specialization functions) accessed from the
     inline cache.

   - gh-128563(14): A new type of interpreter has been added to CPython.
     This interpreter uses tail calls for its instruction handlers.
     Preliminary benchmark results suggest 7-11% geometric mean faster
     on pyperformance (depending on platform), and up to 30% faster on
     Python-intensive workloads.  This interpreter currently only works
     on newer compilers, such as ‘clang-19’.  Other compilers will
     continue using the old interpreter.  Patch by Ken Jin, with ideas
     on how to implement this in CPython by Mark Shannon, Garret Gu,
     Haoran Xu, and Josh Haberman.

   - gh-126703(15): Improve performance of iterating over lists and
     tuples by using a freelist for the iterator objects.

   - gh-127953(16): The time to handle a ‘LINE’ event in sys.monitoring
     (and sys.settrace) is now independent of the number of lines in the
     code object.

   - gh-128330(17): Restore terminal control characters on REPL exit.

   - gh-128016(18): Improved the ‘SyntaxWarning’ message for invalid
     escape sequences to clarify that such sequences will raise a
     ‘SyntaxError’ in future Python releases.  The new message also
     suggests a potential fix, i.e., ‘Did you mean "\\e"?’.

   - gh-126004(19): Fix handling of *note UnicodeError.start: 18c0. and
     *note UnicodeError.end: 18c1. values in the *note
     codecs.replace_errors(): 18c2. error handler.  Patch by Bénédikt
     Tran.

   - gh-126004(20): Fix handling of *note UnicodeError.start: 18c0. and
     *note UnicodeError.end: 18c1. values in the *note
     codecs.backslashreplace_errors(): 18c3. error handler.  Patch by
     Bénédikt Tran.

   - gh-126004(21): Fix handling of *note UnicodeError.start: 18c0. and
     *note UnicodeError.end: 18c1. values in the *note
     codecs.xmlcharrefreplace_errors(): 18c4. error handler.  Patch by
     Bénédikt Tran.

   - gh-127119(22): Slightly optimize the *note int: 19b. deallocator.

   - gh-127349(23): Fixed the error when resizing terminal in Python
     REPL. Patch by Semyon Moroz.

   - gh-125723(24): Fix crash with ‘gi_frame.f_locals’ when generator
     frames outlive their generator.  Patch by Mikhail Efimov.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129231

   (2) https://github.com/python/cpython/issues/129149

   (3) https://github.com/python/cpython/issues/129201

   (4) https://github.com/python/cpython/issues/129093

   (5) https://github.com/python/cpython/issues/124363

   (6) https://github.com/python/cpython/issues/128714

   (7) https://github.com/python/cpython/issues/128799

   (8) https://github.com/python/cpython/issues/128842

   (9) https://github.com/python/cpython/issues/100239

   (10) https://github.com/python/cpython/issues/128910

   (11) https://github.com/python/cpython/issues/128807

   (12) https://github.com/python/cpython/issues/126491

   (13) https://github.com/python/cpython/issues/100239

   (14) https://github.com/python/cpython/issues/128563

   (15) https://github.com/python/cpython/issues/126703

   (16) https://github.com/python/cpython/issues/127953

   (17) https://github.com/python/cpython/issues/128330

   (18) https://github.com/python/cpython/issues/128016

   (19) https://github.com/python/cpython/issues/126004

   (20) https://github.com/python/cpython/issues/126004

   (21) https://github.com/python/cpython/issues/126004

   (22) https://github.com/python/cpython/issues/127119

   (23) https://github.com/python/cpython/issues/127349

   (24) https://github.com/python/cpython/issues/125723


File: python.info,  Node: ライブラリ<35>,  Next: Core and Builtins<32>,  Prev: Core and Builtins<31>,  Up: Python 3 14 0 alpha 5

1.24.15.11 ライブラリ
.....................

   - gh-126349(1): Add *note turtle.fill(): 2a3, *note turtle.poly():
     2a4. and *note turtle.no_animation(): 2a5. context managers.  Patch
     by Marie Roald and Yngve Mardal Moe.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126349


File: python.info,  Node: Core and Builtins<32>,  Next: ライブラリ<36>,  Prev: ライブラリ<35>,  Up: Python 3 14 0 alpha 5

1.24.15.12 Core and Builtins
............................

   - gh-115911(1): If the current working directory cannot be determined
     due to permissions, then import will no longer raise *note
     PermissionError: f3e.  Patch by Alex Willmer.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115911


File: python.info,  Node: ライブラリ<36>,  Next: C API<11>,  Prev: Core and Builtins<32>,  Up: Python 3 14 0 alpha 5

1.24.15.13 ライブラリ
.....................

   - gh-112713(1): Added support for the ‘Partitioned’ cookie flag in
     *note http.cookies: 75.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/112713


File: python.info,  Node: C API<11>,  Next: ビルド<11>,  Prev: ライブラリ<36>,  Up: Python 3 14 0 alpha 5

1.24.15.14 C API
................

   - gh-129533(1): Update *note PyGC_Enable(): aa4, *note
     PyGC_Disable(): aa5, *note PyGC_IsEnabled(): aa6. to use atomic
     operation for thread-safety at free-threading build.  Patch by
     Donghee Na.

   - gh-89188(2): Implement *note PyUnicode_KIND(): 1395. and *note
     PyUnicode_DATA(): 1391. as function, in addition to the macros with
     the same names.  The macros rely on C bit fields which have
     compiler-specific layout.  Patch by Victor Stinner.

   - gh-91417(3): Remove *note PySequence_Fast(): 18a2. from the limited
     C API, since this function has to be used with *note
     PySequence_Fast_GET_ITEM: 3cb. which never worked in the limited C
     API. Patch by Victor Stinner.

   - gh-128509(4): Add *note PyUnstable_IsImmortal(): 3c4. for
     determining whether an object is *note immortal: 290.

   - gh-129033(5): Remove ‘_PyInterpreterState_GetConfigCopy()’ and
     ‘_PyInterpreterState_SetConfig()’ private functions.  Use instead
     *note PyConfig_Get(): 37c. and *note PyConfig_Set(): 37d, public C
     API added by PEP 741(6) "Python Configuration C API". Patch by
     Victor Stinner.

   - gh-129033(7): Remove the private ‘_Py_InitializeMain()’ function.
     It was a *note provisional API: 3d1. added to Python 3.8 by PEP
     587(8).  Patch by Victor Stinner.

   - gh-128844(9): Add *note PyUnstable_TryIncRef(): 18c9. and *note
     PyUnstable_EnableTryIncRef(): 18ca. unstable APIs.  These are
     helpers for dealing with unowned references in a thread-safe way,
     particularly in the free threading build.

   - gh-128911(10): Add *note PyImport_ImportModuleAttr(): 396. and
     *note PyImport_ImportModuleAttrString(): 397. helper functions to
     import a module and get an attribute of the module.  Patch by
     Victor Stinner.

   - gh-128863(11): The following private functions are deprecated and
     planned for removal in Python 3.18:

        * ‘_PyBytes_Join()’: use *note PyBytes_Join(): 383.

        * ‘_PyDict_GetItemStringWithError()’: use *note
          PyDict_GetItemStringRef(): 421.

        * ‘_PyDict_Pop()’: use *note PyDict_Pop(): 422.

        * ‘_PyLong_Sign()’: use *note PyLong_GetSign(): 39a.

        * ‘_PyLong_FromDigits()’ and ‘_PyLong_New()’: use *note
          PyLongWriter_Create(): 3aa.

        * ‘_PyThreadState_UncheckedGet()’: use *note
          PyThreadState_GetUnchecked(): 423.

        * ‘_PyUnicode_AsString()’: use *note PyUnicode_AsUTF8(): 424.

        * ‘_Py_HashPointer()’: use *note Py_HashPointer(): 425.

        * ‘_Py_fopen_obj()’: use *note Py_fopen(): 393.

     The pythoncapi-compat project(12) can be used to get these new
     public functions on Python 3.13 and older.

     Patch by Victor Stinner.

   - gh-126599(13): Remove some internal test APIs for the experimental
     JIT compiler.

   - gh-127925(14): Convert the *note decimal: 3a. module to use PEP
     757(15) C API (export-import integers), offering some speed-up if
     the integer part of the *note Decimal: 1fe. instance is small.
     Patch by Sergey B Kirpichev.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129533

   (2) https://github.com/python/cpython/issues/89188

   (3) https://github.com/python/cpython/issues/91417

   (4) https://github.com/python/cpython/issues/128509

   (5) https://github.com/python/cpython/issues/129033

   (6) https://peps.python.org/pep-0741/

   (7) https://github.com/python/cpython/issues/129033

   (8) https://peps.python.org/pep-0587/

   (9) https://github.com/python/cpython/issues/128844

   (10) https://github.com/python/cpython/issues/128911

   (11) https://github.com/python/cpython/issues/128863

   (12) https://github.com/python/pythoncapi-compat/

   (13) https://github.com/python/cpython/issues/126599

   (14) https://github.com/python/cpython/issues/127925

   (15) https://peps.python.org/pep-0757/


File: python.info,  Node: ビルド<11>,  Prev: C API<11>,  Up: Python 3 14 0 alpha 5

1.24.15.15 ビルド
.................

   - gh-129660(1): Drop ‘test_embed’ from PGO training, whose
     contribution in recent versions is considered to be ignorable.

   - gh-128902(2): Fix compile errors with Clang 9 and older due to lack
     of ‘__attribute__((fallthrough))’ support.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/129660

   (2) https://github.com/python/cpython/issues/128902


File: python.info,  Node: Python 3 14 0 alpha 4,  Next: Python 3 14 0 alpha 3,  Prev: Python 3 14 0 alpha 5,  Up: 変更履歴

1.24.16 Python 3.14.0 alpha 4
-----------------------------

'Release date: 2025-01-14'

* Menu:

* macOS: macOS<7>.
* Tools/Demos: Tools/Demos<12>.
* テスト: テスト<10>.
* ライブラリ: ライブラリ<37>.
* Core and Builtins: Core and Builtins<33>.
* ライブラリ: ライブラリ<38>.
* Core and Builtins: Core and Builtins<34>.
* ライブラリ: ライブラリ<39>.
* Core and Builtins: Core and Builtins<35>.
* C API: C API<12>.
* ビルド: ビルド<12>.


File: python.info,  Node: macOS<7>,  Next: Tools/Demos<12>,  Up: Python 3 14 0 alpha 4

1.24.16.1 macOS
...............

   - gh-127592(1): Usage of the unified Apple System Log APIs was
     disabled when the minimum macOS version is earlier than 10.12.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127592


File: python.info,  Node: Tools/Demos<12>,  Next: テスト<10>,  Prev: macOS<7>,  Up: Python 3 14 0 alpha 4

1.24.16.2 Tools/Demos
.....................

   - gh-128152(1): Fix a bug where Argument Clinic's C pre-processor
     parser tried to parse pre-processor directives inside C comments.
     Patch by Erlend Aasland.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128152


File: python.info,  Node: テスト<10>,  Next: ライブラリ<37>,  Prev: Tools/Demos<12>,  Up: Python 3 14 0 alpha 4

1.24.16.3 テスト
................

   - gh-128690(1): Temporarily do not use test_embed in PGO profile
     builds until the problem with test_init_pyvenv_cfg failing in some
     configurations is resolved.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128690


File: python.info,  Node: ライブラリ<37>,  Next: Core and Builtins<33>,  Prev: テスト<10>,  Up: Python 3 14 0 alpha 4

1.24.16.4 ライブラリ
....................

   - gh-128731(1): Fix *note ResourceWarning: 54c. in *note
     urllib.robotparser.RobotFileParser.read(): 18d1.

   - gh-71339(2): Add new assertion methods for *note unittest: 10c.:
     *note assertHasAttr(): 2b4, *note assertNotHasAttr(): 2b5, *note
     assertIsSubclass(): 2b6, *note assertNotIsSubclass(): 2b7. *note
     assertStartsWith(): 2b8, *note assertNotStartsWith(): 2b9, *note
     assertEndsWith(): 2ba. and *note assertNotEndsWith(): 2bb.

   - gh-118761(3): Improve import time of *note pickle: ab. by 25% by
     removing an unnecessary regular expression.  As such, *note re: be.
     is no more implicitly available as ‘pickle.re’.  Patch by Bénédikt
     Tran.

   - gh-128661(4): Fixes *note typing.evaluate_forward_ref(): 1815. not
     showing deprecation when ‘type_params’ arg is not passed.

   - gh-128562(5): Fix possible conflicts in generated *note tkinter:
     f6. widget names if the widget class name ends with a digit.

   - gh-128559(6): Improved import time of *note asyncio: b.

   - gh-128552(7): Fix cyclic garbage introduced by *note
     asyncio.loop.create_task(): 1ca. and *note
     asyncio.TaskGroup.create_task(): 1cb. holding a reference to the
     created task if it is eager.

   - gh-128340(8): Add internal thread safe handle to be used in *note
     asyncio.loop.call_soon_threadsafe(): cfb. for thread safe
     cancellation.

   - gh-128182(9): Fix crash when using *note ctypes: 2e. pointers
     concurrently on the *note free threaded: 1f4. build.

   - gh-128400(10): Only show the current thread in *note faulthandler:
     5c. on the *note free threaded: 1f4. build to prevent races.

   - gh-128400(11): Fix crash when using *note
     faulthandler.dump_traceback(): fff. while other threads are active
     on the *note free threaded: 1f4. build.

   - gh-128388(12): Fix ‘PyREPL’ on Windows to support more keybindings,
     like the ‘Control’-‘←’ and ‘Control’-‘→’ word-skipping keybindings
     and those with meta (i.e.  ‘Alt’), e.g.  ‘Alt’-‘d’ to ‘kill-word’
     or ‘Alt’-‘Backspace’ ‘backward-kill-word’.

   - gh-88834(13): Unify the instance check for *note typing.Union: 2a8.
     and *note types.UnionType: 2a7.: ‘Union’ now uses the instance
     checks against its parameters instead of the subclass checks.

   - gh-128302(14): Fix
     ‘xml.dom.xmlbuilder.DOMEntityResolver.resolveEntity()’, which was
     broken by the Python 3.0 transition.

   - gh-128317(15): Highlight today in colour in *note calendar: 15.'s
     CLI output.  Patch by Hugo van Kemenade.

   - gh-128302(16): Allow ‘xml.dom.xmlbuilder.DOMParser.parse()’ to
     correctly handle ‘xml.dom.xmlbuilder.DOMInputSource’ instances that
     only have a ‘systemId’ attribute set.

   - gh-128151(17): Improve generation of *note UUID: c56. objects
     version 3, 4, 5, and 8 via their dedicated functions by 30%.  Patch
     by Bénédikt Tran.

   - gh-128118(18): Improve performance of *note copy.copy(): 757. by
     30% via a fast path for atomic types and container types.

   - gh-127946(19): Fix crash when modifying *note ctypes._CFuncPtr:
     18d2. objects concurrently on the *note free threaded: 1f4. build.

   - gh-128062(20): Revert the font of *note turtledemo: 108.'s menu bar
     to its default value and display the shortcut keys in the correct
     position.

   - gh-128014(21): Fix resetting the default window icon by passing
     ‘default=''’ to the *note tkinter: f6. method ‘wm_iconbitmap()’.

   - gh-41872(22): Fix quick extraction of module docstrings from a file
     in *note pydoc: ba.  It now supports docstrings with single quotes,
     escape sequences, raw string literals, and other Python syntax.

   - gh-127060(23): Set TERM environment variable to "dumb" to disable
     traceback colors in IDLE, since IDLE doesn't understand ANSI escape
     sequences.  Patch by Victor Stinner.

   - gh-126742(24): Fix support of localized error messages reported by
     ‘dlerror(3)(25)’ and ‘gdbm_strerror(26)’ in *note ctypes: 2e. and
     *note dbm.gnu: 37. functions respectively.  Patch by Bénédikt Tran.

   - gh-122548(27): Adds two new local events to sys.monitoring,
     ‘BRANCH_LEFT’ and ‘BRANCH_RIGHT’.  This allows the two arms of the
     branch to be disabled independently, which should hugely improve
     performance of branch-level coverage tools.  The old branch event,
     ‘BRANCH’ is now deprecated.

   - gh-127847(28): Fix the position when doing interleaved seeks and
     reads in uncompressed, unencrypted zip files returned by *note
     zipfile.ZipFile.open(): 65d.

   - gh-127688(29): Add the *note SCHED_DEADLINE: 25d. and *note
     SCHED_NORMAL: 25e. constants to the *note os: a5. module.

   - gh-83662(30): Add missing ‘__class_getitem__’ method to the Python
     implementation of *note functools.partial(): 217, to make it
     compatible with the C version.  This is mainly relevant for
     alternative Python implementations like PyPy and GraalPy, because
     CPython will usually use the C-implementation of that function.

   - gh-127586(31): *note multiprocessing.pool.Pool: 116d. now properly
     restores blocked signal handlers of the parent thread when creating
     processes via either 'spawn' or 'forkserver'.

   - gh-98188(32): Fix an issue in *note
     email.message.Message.get_payload(): 13e5. where data cannot be
     decoded if the Content Transfer Encoding mechanism contains
     trailing whitespaces or additional junk text.  Patch by Hui Liu.

   - gh-127529(33): Correct behavior of
     ‘asyncio.selector_events.BaseSelectorEventLoop._accept_connection()’
     in handling *note ConnectionAbortedError: 1268. in a loop.  This
     improves performance on OpenBSD.

   - gh-127360(34): When a descriptive error message cannot be provided
     for an *note ssl.SSLError: 1491, the "unknown error" message now
     shows the internal error code (as retrieved by ‘ERR_get_error’ and
     similar OpenSSL functions).

   - gh-127196(35): Fix crash when dict with keys in invalid encoding
     were passed to several functions in ‘_interpreters’ module.

   - gh-124130(36): Fix a bug in matching regular expression ‘\B’ in
     empty input string.  Now it is always the opposite of ‘\b’.  To get
     an old behavior, use ‘(?!\A\Z)\B’.  To get a new behavior in old
     Python versions, use ‘(?!\b)’.

   - gh-126639(37): *note tempfile.NamedTemporaryFile: 6ed. will now
     issue a *note ResourceWarning: 54c. when it is finalized by the
     garbage collector without being explicitly closed.

   - gh-126624(38): Expose error code *note XML_ERROR_NOT_STARTED: 18d3.
     of Expat >=2.6.4 in *note xml.parsers.expat.errors: 12d.

   - gh-126225(39): *note getopt: 65. and *note optparse: a4. are no
     longer marked as deprecated.  There are legitimate reasons to use
     one of these modules in preference to *note argparse: 7, and none
     of these modules are at risk of being removed from the standard
     library.  Of the three, ‘argparse’ remains the recommended default
     choice, 'unless' one of the concerns noted at the top of the
     ‘optparse’ module documentation applies.

   - gh-124761(40): Add *note SO_REUSEPORT_LB: 18d4. constant to *note
     socket: d1. for FreeBSD.

   - gh-121720(41): *note enum.EnumDict: 4f6. can now be used without
     resorting to private API.

   - gh-123424(42): Add *note zipfile.ZipInfo._for_archive(): 2ca.
     setting default properties on *note ZipInfo: 2cb. objects.  Patch
     by Bénédikt Tran and Jason R. Coombs.

   - gh-121676(43): Deprecate calling the Python implementation of *note
     functools.reduce(): 21a. with a ‘function’ or ‘sequence’ as a *note
     keyword argument: f0e.  This will be forbidden in Python 3.16 in
     order to match the C implementation.

   - gh-112015(44): *note ctypes.memoryview_at(): 1eb. now exists to
     create a *note memoryview: 165. object that refers to the supplied
     pointer and length.  This works like *note ctypes.string_at(): 1ec.
     except it avoids a buffer copy, and is typically useful when
     implementing pure Python callback functions that are passed
     dynamically-sized buffers.

   - gh-95371(45): Added support for other image formats (PNG, PGM, and
     PPM) to the turtle module.  Patch by Shin-myoung-serp.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128731

   (2) https://github.com/python/cpython/issues/71339

   (3) https://github.com/python/cpython/issues/118761

   (4) https://github.com/python/cpython/issues/128661

   (5) https://github.com/python/cpython/issues/128562

   (6) https://github.com/python/cpython/issues/128559

   (7) https://github.com/python/cpython/issues/128552

   (8) https://github.com/python/cpython/issues/128340

   (9) https://github.com/python/cpython/issues/128182

   (10) https://github.com/python/cpython/issues/128400

   (11) https://github.com/python/cpython/issues/128400

   (12) https://github.com/python/cpython/issues/128388

   (13) https://github.com/python/cpython/issues/88834

   (14) https://github.com/python/cpython/issues/128302

   (15) https://github.com/python/cpython/issues/128317

   (16) https://github.com/python/cpython/issues/128302

   (17) https://github.com/python/cpython/issues/128151

   (18) https://github.com/python/cpython/issues/128118

   (19) https://github.com/python/cpython/issues/127946

   (20) https://github.com/python/cpython/issues/128062

   (21) https://github.com/python/cpython/issues/128014

   (22) https://github.com/python/cpython/issues/41872

   (23) https://github.com/python/cpython/issues/127060

   (24) https://github.com/python/cpython/issues/126742

   (25) https://manpages.debian.org/dlerror(3)

   (26) https://manpages.debian.org/gdbm(3)

   (27) https://github.com/python/cpython/issues/122548

   (28) https://github.com/python/cpython/issues/127847

   (29) https://github.com/python/cpython/issues/127688

   (30) https://github.com/python/cpython/issues/83662

   (31) https://github.com/python/cpython/issues/127586

   (32) https://github.com/python/cpython/issues/98188

   (33) https://github.com/python/cpython/issues/127529

   (34) https://github.com/python/cpython/issues/127360

   (35) https://github.com/python/cpython/issues/127196

   (36) https://github.com/python/cpython/issues/124130

   (37) https://github.com/python/cpython/issues/126639

   (38) https://github.com/python/cpython/issues/126624

   (39) https://github.com/python/cpython/issues/126225

   (40) https://github.com/python/cpython/issues/124761

   (41) https://github.com/python/cpython/issues/121720

   (42) https://github.com/python/cpython/issues/123424

   (43) https://github.com/python/cpython/issues/121676

   (44) https://github.com/python/cpython/issues/112015

   (45) https://github.com/python/cpython/issues/95371


File: python.info,  Node: Core and Builtins<33>,  Next: ライブラリ<38>,  Prev: ライブラリ<37>,  Up: Python 3 14 0 alpha 4

1.24.16.5 Core and Builtins
...........................

   - gh-128078(1): Fix a *note SystemError: 795. when using *note
     anext(): 9d6. with a default tuple value.  Patch by Bénédikt Tran.

   - gh-128717(2): Fix a crash when setting the recursion limit while
     other threads are active on the *note free threaded: 1f4. build.

   - gh-124483(3): Treat ‘Py_DECREF’ and variants as escaping when
     generating opcode and uop metadata.  This prevents the possibility
     of a ‘__del__’ method causing the JIT to behave incorrectly.

   - gh-126703(4): Improve performance of class methods by using a
     freelist.

   - gh-128137(5): Update *note PyASCIIObject: 138d. layout to handle
     interned field with the atomic operation.  Patch by Donghee Na.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128078

   (2) https://github.com/python/cpython/issues/128717

   (3) https://github.com/python/cpython/issues/124483

   (4) https://github.com/python/cpython/issues/126703

   (5) https://github.com/python/cpython/issues/128137


File: python.info,  Node: ライブラリ<38>,  Next: Core and Builtins<34>,  Prev: Core and Builtins<33>,  Up: Python 3 14 0 alpha 4

1.24.16.6 ライブラリ
....................

   - gh-128192(1): Upgrade HTTP digest authentication algorithm for
     *note urllib.request: 111. by supporting SHA-256 digest
     authentication as specified in RFC 7616(2).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128192

   (2) https://datatracker.ietf.org/doc/html/rfc7616.html


File: python.info,  Node: Core and Builtins<34>,  Next: ライブラリ<39>,  Prev: ライブラリ<38>,  Up: Python 3 14 0 alpha 4

1.24.16.7 Core and Builtins
...........................

   - gh-126868(1): Increase usage of freelist for *note int: 19b.
     allocation.

   - gh-114203(2): Optimize ‘Py_BEGIN_CRITICAL_SECTION’ for simple
     recursive calls.

   - gh-127705(3): Adds stackref debugging when ‘Py_STACKREF_DEBUG’ is
     set.  Finds all double-closes and leaks, logging the origin and
     last borrow.

     Inspired by HPy's debug mode.
     ‘https://docs.hpyproject.org/en/latest/debug-mode.html’

   - gh-128079(4): Fix a bug where *note except*: 1ac. does not properly
     check the return value of an *note ExceptionGroup: 4d2.'s *note
     split(): 18d8. function, leading to a crash in some cases.  Now
     when *note split(): 18d8. returns an invalid object, *note except*:
     1ac. raises a *note TypeError: 198. with the original raised *note
     ExceptionGroup: 4d2. object chained to it.

   - gh-128030(5): Avoid error from calling ‘PyModule_GetFilenameObject’
     on a non-module object when importing a non-existent symbol from a
     non-module object.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126868

   (2) https://github.com/python/cpython/issues/114203

   (3) https://github.com/python/cpython/issues/127705

   (4) https://github.com/python/cpython/issues/128079

   (5) https://github.com/python/cpython/issues/128030


File: python.info,  Node: ライブラリ<39>,  Next: Core and Builtins<35>,  Prev: Core and Builtins<34>,  Up: Python 3 14 0 alpha 4

1.24.16.8 ライブラリ
....................

   - gh-128035(1): Indicate through *note ssl.HAS_PHA: 286. whether the
     *note ssl: d5. module supports TLSv1.3 post-handshake client
     authentication (PHA). Patch by Will Childs-Klein.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128035


File: python.info,  Node: Core and Builtins<35>,  Next: C API<12>,  Prev: ライブラリ<39>,  Up: Python 3 14 0 alpha 4

1.24.16.9 Core and Builtins
...........................

   - gh-127274(1): Add a new flag, ‘CO_METHOD’, to *note co_flags: 18db.
     that indicates whether the code object belongs to a function
     defined in class scope.

   - gh-66409(2): During the *note path initialization: 18dc, we now
     check if ‘base_exec_prefix’ is the same as ‘base_prefix’ before
     falling back to searching the Python interpreter directory.

   - gh-127970(3): We now use the location of the ‘libpython’ runtime
     library used in the current process to determine *note
     sys.base_prefix: 3e6. on all platforms implementing the dladdr(4)
     function defined by the UNIX standard — this includes Linux,
     Android, macOS, iOS, FreeBSD, etc.  This was already the case on
     Windows and macOS Framework builds.

   - gh-127773(5): Do not use the type attribute cache for types with
     incompatible *note MRO: 18dd.

   - gh-127903(6): ‘Objects/unicodeobject.c’: fix a crash on DEBUG
     builds in ‘_copy_characters’ when there is nothing to copy.

   - gh-127809(7): Fix an issue where the experimental JIT may infer an
     incorrect result type for exponentiation (‘**’ and ‘**=’), leading
     to bugs or crashes.

   - gh-126862(8): Fix a possible overflow when a class inherits from an
     absurd number of super-classes.  Reported by Valery Fedorenko.
     Patch by Bénédikt Tran.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127274

   (2) https://github.com/python/cpython/issues/66409

   (3) https://github.com/python/cpython/issues/127970

   (4) 
https://pubs.opengroup.org/onlinepubs/9799919799/functions/dladdr.html

   (5) https://github.com/python/cpython/issues/127773

   (6) https://github.com/python/cpython/issues/127903

   (7) https://github.com/python/cpython/issues/127809

   (8) https://github.com/python/cpython/issues/126862


File: python.info,  Node: C API<12>,  Next: ビルド<12>,  Prev: Core and Builtins<35>,  Up: Python 3 14 0 alpha 4

1.24.16.10 C API
................

   - gh-128400(1): *note Py_FatalError(): b7a. no longer shows all
     threads on the *note free threaded: 1f4. build to prevent crashes.

   - gh-128629(2): Add macros *note Py_PACK_VERSION(): 37f. and *note
     Py_PACK_FULL_VERSION(): 380. for bit-packing Python version
     numbers.

   - gh-128008(3): Add *note PyWeakref_IsDead(): 18df. function, which
     tests if a weak reference is dead.

   - gh-127350(4): Add *note Py_fopen(): 393. function to open a file.
     Similar to the ‘fopen()’ function, but the 'path' parameter is a
     Python object and an exception is set on error.  Add also *note
     Py_fclose(): 394. function to close a file, function needed for
     Windows support.  Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128400

   (2) https://github.com/python/cpython/issues/128629

   (3) https://github.com/python/cpython/issues/128008

   (4) https://github.com/python/cpython/issues/127350


File: python.info,  Node: ビルド<12>,  Prev: C API<12>,  Up: Python 3 14 0 alpha 4

1.24.16.11 ビルド
.................

   - gh-128627(1): For Emscripten builds the function pointer cast call
     trampoline now uses the wasm-gc ref.test instruction if it's
     available instead of Wasm JS type reflection.

   - gh-128472(2): Skip BOLT optimization of functions using computed
     gotos, fixing errors on build with LLVM 19.

   - gh-115765(3): GNU Autoconf 2.72 is now required to generate
     ‘configure’.  Patch by Erlend Aasland.

   - gh-123925(4): Fix building the *note curses: 2f. module on
     platforms with libncurses but without libncursesw.

   - gh-90905(5): Add support for cross-compiling to x86_64 on
     aarch64/arm64 macOS.

   - gh-128321(6): Set ‘LIBS’ instead of ‘LDFLAGS’ when checking if
     *note sqlite3: d4. library functions are available.  This fixes the
     ordering of linked libraries during checks, which was incorrect
     when using a statically linked ‘libsqlite3’.

   - gh-100384(7): Error on ‘unguarded-availability’ in macOS builds,
     preventing invalid use of symbols that are not available in older
     versions of the OS.

   - gh-128104(8): Remove ‘Py_STRFTIME_C99_SUPPORT’ conditions in favor
     of requiring C99 ‘strftime(3)(9)’ specifier support at build time.
     When cross-compiling, there is no build time check and support is
     assumed.

   - gh-127951(10): Add option ‘--pystats’ to the Windows build to
     enable performance statistics collection.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/128627

   (2) https://github.com/python/cpython/issues/128472

   (3) https://github.com/python/cpython/issues/115765

   (4) https://github.com/python/cpython/issues/123925

   (5) https://github.com/python/cpython/issues/90905

   (6) https://github.com/python/cpython/issues/128321

   (7) https://github.com/python/cpython/issues/100384

   (8) https://github.com/python/cpython/issues/128104

   (9) https://manpages.debian.org/strftime(3)

   (10) https://github.com/python/cpython/issues/127951


File: python.info,  Node: Python 3 14 0 alpha 3,  Next: Python 3 14 0 alpha 2,  Prev: Python 3 14 0 alpha 4,  Up: 変更履歴

1.24.17 Python 3.14.0 alpha 3
-----------------------------

'Release date: 2024-12-17'

* Menu:

* Windows: Windows<12>.
* Tools/Demos: Tools/Demos<13>.
* テスト: テスト<11>.
* セキュリティ: セキュリティ<14>.
* ライブラリ: ライブラリ<40>.
* ドキュメント: ドキュメント<12>.
* Core and Builtins: Core and Builtins<36>.
* ライブラリ: ライブラリ<41>.
* Core and Builtins: Core and Builtins<37>.
* C API: C API<13>.
* ビルド: ビルド<13>.


File: python.info,  Node: Windows<12>,  Next: Tools/Demos<13>,  Up: Python 3 14 0 alpha 3

1.24.17.1 Windows
.................

   - gh-127353(1): Allow to force color output on Windows using
     environment variables.  Patch by Andrey Efremov.

   - gh-125729(2): Makes the presence of the *note turtle: 107. module
     dependent on the Tcl/Tk installer option.  Previously, the module
     was always installed but would be unusable without Tcl/Tk.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127353

   (2) https://github.com/python/cpython/issues/125729


File: python.info,  Node: Tools/Demos<13>,  Next: テスト<11>,  Prev: Windows<12>,  Up: Python 3 14 0 alpha 3

1.24.17.2 Tools/Demos
.....................

   - gh-126700(1): Add support for multi-argument *note gettext: 67.
     functions in ‘pygettext.py’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126700


File: python.info,  Node: テスト<11>,  Next: セキュリティ<14>,  Prev: Tools/Demos<13>,  Up: Python 3 14 0 alpha 3

1.24.17.3 テスト
................

   - gh-127906(1): Test the limited C API in test_cppext.  Patch by
     Victor Stinner.

   - gh-127637(2): Add tests for the *note dis: 3c. command-line
     interface.  Patch by Bénédikt Tran.

   - gh-126925(3): iOS test results are now streamed during test
     execution, and the deprecated xcresulttool is no longer used.

   - gh-127076(4): Disable strace based system call tests when
     LD_PRELOAD is set.

   - gh-127076(5): Filter out memory-related ‘mmap’, ‘munmap’, and
     ‘mprotect’ calls from file-related ones when testing *note io: 83.
     behavior using strace.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127906

   (2) https://github.com/python/cpython/issues/127637

   (3) https://github.com/python/cpython/issues/126925

   (4) https://github.com/python/cpython/issues/127076

   (5) https://github.com/python/cpython/issues/127076


File: python.info,  Node: セキュリティ<14>,  Next: ライブラリ<40>,  Prev: テスト<11>,  Up: Python 3 14 0 alpha 3

1.24.17.4 セキュリティ
......................

   - gh-127655(1): Fixed the
     ‘asyncio.selector_events._SelectorSocketTransport’ transport not
     pausing writes for the protocol when the buffer reaches the high
     water mark when using *note asyncio.WriteTransport.writelines():
     17c9.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127655


File: python.info,  Node: ライブラリ<40>,  Next: ドキュメント<12>,  Prev: セキュリティ<14>,  Up: Python 3 14 0 alpha 3

1.24.17.5 ライブラリ
....................

   - gh-126907(1): Fix crash when using *note atexit: d. concurrently on
     the *note free-threaded: 1f4. build.

   - gh-127870(2): Detect recursive calls in ctypes ‘_as_parameter_’
     handling.  Patch by Victor Stinner.

   - gh-127732(3): The *note platform: af. module now correctly detects
     Windows Server 2025.

   - gh-126789(4): Fixed *note sysconfig.get_config_vars(): 298, *note
     sysconfig.get_paths(): 340, and siblings, returning outdated cached
     data if the value of *note sys.prefix: 3e7. or *note
     sys.exec_prefix: 3eb. changes.  Overwriting *note sys.prefix: 3e7.
     or *note sys.exec_prefix: 3eb. still is discouraged, as that might
     break other parts of the code.

   - gh-127718(5): Add colour to *note test.regrtest: e9. output.  Patch
     by Hugo van Kemenade.

   - gh-127610(6): Added validation for more than one var-positional or
     var-keyword parameters in *note inspect.Signature: 4e3.  Patch by
     Maxim Ageev.

   - gh-127627(7): Added ‘posix._emscripten_debugger()’ to help with
     debugging the test suite on the Emscripten target.

   - gh-126821(8): macOS and iOS apps can now choose to redirect stdout
     and stderr to the system log during interpreter configuration.

   - gh-93312(9): Include ‘<sys/pidfd.h>’ to get ‘os.PIDFD_NONBLOCK’
     constant.  Patch by Victor Stinner.

   - gh-127481(10): Add the ‘EPOLLWAKEUP’ constant to the *note select:
     c6. module.

   - gh-127065(11): Make *note operator.methodcaller(): 1034.
     thread-safe and re-entrant safe.

   - gh-127321(12): *note pdb.set_trace(): 272. will not stop at an
     opcode that does not have an associated line number anymore.

   - gh-127429(13): Fixed bug where, on cross-builds, the *note
     sysconfig: e1. POSIX data was being generated with the host
     Python's ‘Makefile’.  The data is now generated from current
     build's ‘Makefile’.

   - gh-127413(14): Add the *note dis -specialized: 209. command-line
     option to show specialized bytecode.  Patch by Bénédikt Tran.

   - gh-125413(15): Revert addition of ‘pathlib.Path.scandir()’.  This
     method was added in 3.14.0a2.  The optimizations remain for file
     system paths, but other subclasses should only have to implement
     *note pathlib.Path.iterdir(): 26e.

   - gh-127257(16): In *note ssl: d5, system call failures that OpenSSL
     reports using ‘ERR_LIB_SYS’ are now raised as *note OSError: 2c0.

   - gh-59705(17): On Linux, *note threading.Thread: 176. now sets the
     thread name to the operating system.  Patch by Victor Stinner.

   - gh-127303(18): Publicly expose *note EXACT_TOKEN_TYPES: 18e7. in
     ‘token.__all__’.

   - gh-127331(19): *note ssl: d5. can show descriptions for errors
     added in OpenSSL 3.4.

   - gh-123967(20): Fix faulthandler for trampoline frames.  If the
     top-most frame is a trampoline frame, skip it.  Patch by Victor
     Stinner.

   - gh-127178(21): A ‘_sysconfig_vars_(...).json’ file is now shipped
     in the standard library directory.  It contains the output of *note
     sysconfig.get_config_vars(): 298. on the default environment
     encoded as JSON data.  This is an implementation detail, and may
     change at any time.

   - gh-127072(22): Remove outdated ‘socket.NETLINK_*’ constants not
     present in Linux kernels beyond 2.6.17.

   - gh-127255(23): The *note CopyComPointer(): 1ea. function is now
     public.  Previously, this was private and only available in
     ‘_ctypes’.

   - gh-127182(24): Fix ‘io.StringIO.__setstate__()’ crash, when *note
     None: 885. was passed as the first value.

   - gh-127217(25): Fix *note urllib.request.pathname2url(): 2bf. for
     paths starting with multiple slashes on Posix.

   - gh-125866(26): *note urllib.request.pathname2url(): 2bf. now adds
     an empty authority when generating a URL for a path that begins
     with exactly one slash.  For example, the path ‘/etc/hosts’ is
     converted to the scheme-less URL ‘///etc/hosts’.  As a result of
     this change, URLs without authorities are only generated for
     relative paths.

   - gh-127221(27): Add colour to *note unittest: 10c. output.  Patch by
     Hugo van Kemenade.

   - gh-127035(28): Fix *note shutil.which: 6db. on Windows.  Now it
     looks at direct match if and only if the command ends with a
     PATHEXT extension or X_OK is not in mode.  Support extensionless
     files if "."  is in PATHEXT. Support PATHEXT extensions that end
     with a dot.

   - gh-122273(29): Support PyREPL history on Windows.  Patch by
     devdanzin and Victor Stinner.

   - gh-125866(30): *note urllib.request.pathname2url(): 2bf. and *note
     url2pathname(): 2bd. no longer convert Windows drive letters to
     uppercase.

   - gh-127078(31): Fix issue where *note urllib.request.url2pathname():
     2bd. failed to discard an extra slash before a UNC drive in the URL
     path on Windows.

   - gh-126766(32): Fix issue where *note urllib.request.url2pathname():
     2bd. failed to discard any 'localhost' authority present in the
     URL.

   - gh-127065(33): Fix crash when calling a *note
     operator.methodcaller(): 1034. instance from multiple threads in
     the free threading build.

   - gh-127090(34): Fix value of *note urllib.response.addinfourl.url:
     18e8. for ‘file:’ URLs that express relative paths and absolute
     Windows paths.  The canonical URL generated by *note
     urllib.request.pathname2url(): 2bf. is now used.

   - gh-126992(35): Fix LONG and INT opcodes to only use base 10 for
     string to integer conversion in *note pickle: ab.

   - gh-126997(36): Fix support of STRING and GLOBAL opcodes with
     non-ASCII arguments in *note pickletools: ac.  *note
     pickletools.dis(): ebe. now outputs non-ASCII bytes in STRING,
     BINSTRING and SHORT_BINSTRING arguments as escaped (‘\xXX’).

   - gh-126316(37): *note grp: 6a.: Make *note grp.getgrall(): 18e9.
     thread-safe by adding a mutex.  Patch by Victor Stinner.

   - gh-126618(38): Fix the representation of *note itertools.count:
     149b. objects when the count value is *note sys.maxsize: 13dd.

   - gh-126615(39): The *note COMError: 1e9. exception is now public.
     Previously, this was private and only available in ‘_ctypes’.

   - gh-126985(40): When running under a virtual environment with the
     *note site: cc. disabled (see *note -S: 13c0.), *note sys.prefix:
     3e7. and *note sys.base_prefix: 3e6. will now point to the virtual
     environment, instead of the base installation.

   - gh-112192(41): In the *note trace: 103. module, increase the
     coverage precision (‘cov%’) to one decimal.

   - gh-118761(42): Improve import time of *note mimetypes: 93. by
     around 11-16 times.  Patch by Hugo van Kemenade.

   - gh-126947(43): Raise *note TypeError: 198. in
     ‘_pydatetime.timedelta.__new__()’ if the passed arguments are not
     *note int: 19b. or *note float: 196, so that the Python
     implementation is in line with the C implementation.

   - gh-126946(44): Improve the *note GetoptError: 18ea. error message
     when a long option prefix matches multiple accepted options in
     *note getopt.getopt(): 16d4. and *note getopt.gnu_getopt(): 16d3.

   - gh-126899(45): Make tkinter widget methods ‘after()’ and
     ‘after_idle()’ accept arguments passed by keyword.

   - gh-85168(46): Fix issue where *note urllib.request.url2pathname():
     2bd. and *note pathname2url(): 2bf. always used UTF-8 when quoting
     and unquoting file URIs.  They now use the *note filesystem
     encoding and error handler: 75d.

   - gh-126780(47): Fix *note os.path.normpath(): 1531. for
     drive-relative paths on Windows.

   - gh-126775(48): Make *note linecache.checkcache(): 18eb. thread safe
     and GC re-entrancy safe.

   - gh-126601(49): Fix issue where *note urllib.request.pathname2url():
     2bf. raised *note OSError: 2c0. when given a Windows path
     containing a colon character not following a drive letter, such as
     before an NTFS alternate data stream.

   - gh-126727(50): ‘locale.nl_langinfo(locale.ERA)’ now returns
     multiple era description segments separated by semicolons.
     Previously it only returned the first segment on platforms with
     Glibc.

   - gh-85046(51): Add *note EHWPOISON: 20b. error code to *note errno:
     5b.

   - gh-118201(52): Fixed intermittent failures of *note os.confstr:
     18ec, *note os.pathconf: 1313. and *note os.sysconf: 18ed. on iOS
     and Android.

   - gh-86463(53): The ‘usage’ parameter of *note
     argparse.ArgumentParser: 1bd. no longer affects the default value
     of the ‘prog’ parameter in subparsers.

   - gh-124008(54): Fix possible crash (in debug build), incorrect
     output or returning incorrect value from raw binary ‘write()’ when
     writing to console on Windows.

   - gh-123401(55): The *note http.cookies: 75. module now supports
     parsing obsolete RFC 850(56) date formats, in accordance with RFC
     9110(57) requirements.  Patch by Nano Zheng.

   - gh-122431(58): *note readline.append_history_file(): 1051. now
     raises a *note ValueError: 2ec. when given a negative value.

   - gh-122356(59): Guarantee that the position of a file-like object
     passed to *note zipfile.is_zipfile(): 1542. is left untouched after
     the call.  Patch by Bénédikt Tran.

   - gh-122288(60): Improve the performances of *note
     fnmatch.translate(): 184f. by a factor 1.7.  Patch by Bénédikt
     Tran.

   - gh-88110(61): Fixed *note multiprocessing.Process: 252. reporting a
     ‘.exitcode’ of 1 even on success when using the ‘"fork"’ start
     method while using a *note concurrent.futures.ThreadPoolExecutor:
     949.

   - gh-97514(62): Authentication was added to the *note
     multiprocessing: 98. forkserver start method control socket so that
     only processes with the authentication key generated by the process
     that spawned the forkserver can control it.  This is an enhancement
     over the other gh-97514(63) fixes so that access is no longer
     limited only by filesystem permissions.

     The file descriptor exchange of control pipes with the forked
     worker process now requires an explicit acknowledgement byte to be
     sent over the socket after the exchange on all forkserver
     supporting platforms.  That makes testing the above much easier.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126907

   (2) https://github.com/python/cpython/issues/127870

   (3) https://github.com/python/cpython/issues/127732

   (4) https://github.com/python/cpython/issues/126789

   (5) https://github.com/python/cpython/issues/127718

   (6) https://github.com/python/cpython/issues/127610

   (7) https://github.com/python/cpython/issues/127627

   (8) https://github.com/python/cpython/issues/126821

   (9) https://github.com/python/cpython/issues/93312

   (10) https://github.com/python/cpython/issues/127481

   (11) https://github.com/python/cpython/issues/127065

   (12) https://github.com/python/cpython/issues/127321

   (13) https://github.com/python/cpython/issues/127429

   (14) https://github.com/python/cpython/issues/127413

   (15) https://github.com/python/cpython/issues/125413

   (16) https://github.com/python/cpython/issues/127257

   (17) https://github.com/python/cpython/issues/59705

   (18) https://github.com/python/cpython/issues/127303

   (19) https://github.com/python/cpython/issues/127331

   (20) https://github.com/python/cpython/issues/123967

   (21) https://github.com/python/cpython/issues/127178

   (22) https://github.com/python/cpython/issues/127072

   (23) https://github.com/python/cpython/issues/127255

   (24) https://github.com/python/cpython/issues/127182

   (25) https://github.com/python/cpython/issues/127217

   (26) https://github.com/python/cpython/issues/125866

   (27) https://github.com/python/cpython/issues/127221

   (28) https://github.com/python/cpython/issues/127035

   (29) https://github.com/python/cpython/issues/122273

   (30) https://github.com/python/cpython/issues/125866

   (31) https://github.com/python/cpython/issues/127078

   (32) https://github.com/python/cpython/issues/126766

   (33) https://github.com/python/cpython/issues/127065

   (34) https://github.com/python/cpython/issues/127090

   (35) https://github.com/python/cpython/issues/126992

   (36) https://github.com/python/cpython/issues/126997

   (37) https://github.com/python/cpython/issues/126316

   (38) https://github.com/python/cpython/issues/126618

   (39) https://github.com/python/cpython/issues/126615

   (40) https://github.com/python/cpython/issues/126985

   (41) https://github.com/python/cpython/issues/112192

   (42) https://github.com/python/cpython/issues/118761

   (43) https://github.com/python/cpython/issues/126947

   (44) https://github.com/python/cpython/issues/126946

   (45) https://github.com/python/cpython/issues/126899

   (46) https://github.com/python/cpython/issues/85168

   (47) https://github.com/python/cpython/issues/126780

   (48) https://github.com/python/cpython/issues/126775

   (49) https://github.com/python/cpython/issues/126601

   (50) https://github.com/python/cpython/issues/126727

   (51) https://github.com/python/cpython/issues/85046

   (52) https://github.com/python/cpython/issues/118201

   (53) https://github.com/python/cpython/issues/86463

   (54) https://github.com/python/cpython/issues/124008

   (55) https://github.com/python/cpython/issues/123401

   (56) https://datatracker.ietf.org/doc/html/rfc850.html

   (57) https://datatracker.ietf.org/doc/html/rfc9110.html

   (58) https://github.com/python/cpython/issues/122431

   (59) https://github.com/python/cpython/issues/122356

   (60) https://github.com/python/cpython/issues/122288

   (61) https://github.com/python/cpython/issues/88110

   (62) https://github.com/python/cpython/issues/97514

   (63) https://github.com/python/cpython/issues/97514


File: python.info,  Node: ドキュメント<12>,  Next: Core and Builtins<36>,  Prev: ライブラリ<40>,  Up: Python 3 14 0 alpha 3

1.24.17.6 ドキュメント
......................

   - gh-127347(1): Publicly expose *note traceback.print_list(): 18ef.
     in ‘traceback.__all__’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127347


File: python.info,  Node: Core and Builtins<36>,  Next: ライブラリ<41>,  Prev: ドキュメント<12>,  Up: Python 3 14 0 alpha 3

1.24.17.7 Core and Builtins
...........................

   - gh-127740(1): Fix error message in *note bytes.fromhex(): 190. when
     given an odd number of digits to properly indicate that an even
     number of hexadecimal digits is required.

   - gh-127058(2): ‘PySequence_Tuple’ now creates the resulting tuple
     atomically, preventing partially created tuples being visible to
     the garbage collector or through ‘gc.get_referrers()’

   - gh-127599(3): Fix statistics for increments of object reference
     counts (in particular, when a reference count was increased by more
     than 1 in a single operation).

   - gh-127651(4): When raising *note ImportError: 65b. for missing
     symbols in ‘from’ imports, use ‘__file__’ in the error message if
     ‘__spec__.origin’ is not a location

   - gh-127582(5): Fix non-thread-safe object resurrection when calling
     finalizers and watcher callbacks in the free threading build.

   - gh-127434(6): The iOS compiler shims can now accept arguments with
     spaces.

   - gh-127536(7): Add missing locks around some list assignment
     operations in the free threading build.

   - gh-127085(8): Fix race when exporting a buffer from a *note
     memoryview: 165. object on the *note free-threaded: 1f4. build.

   - gh-127238(9): Correct error message for *note
     sys.set_int_max_str_digits(): 18f1.

   - gh-113841(10): Fix possible undefined behavior division by zero in
     *note complex: 197.'s *note _Py_c_pow(): 18f2.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127740

   (2) https://github.com/python/cpython/issues/127058

   (3) https://github.com/python/cpython/issues/127599

   (4) https://github.com/python/cpython/issues/127651

   (5) https://github.com/python/cpython/issues/127582

   (6) https://github.com/python/cpython/issues/127434

   (7) https://github.com/python/cpython/issues/127536

   (8) https://github.com/python/cpython/issues/127085

   (9) https://github.com/python/cpython/issues/127238

   (10) https://github.com/python/cpython/issues/113841


File: python.info,  Node: ライブラリ<41>,  Next: Core and Builtins<37>,  Prev: Core and Builtins<36>,  Up: Python 3 14 0 alpha 3

1.24.17.8 ライブラリ
....................

   - gh-127133(1): Calling *note
     argparse.ArgumentParser.add_argument_group(): 2eb. on an argument
     group, and calling *note
     argparse.ArgumentParser.add_argument_group(): 2eb. or *note
     argparse.ArgumentParser.add_mutually_exclusive_group(): 2ed. on a
     mutually exclusive group now raise exceptions.  This nesting was
     never supported, often failed to work correctly, and was
     unintentionally exposed through inheritance.  This functionality
     has been deprecated since Python 3.11.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127133


File: python.info,  Node: Core and Builtins<37>,  Next: C API<13>,  Prev: ライブラリ<41>,  Up: Python 3 14 0 alpha 3

1.24.17.9 Core and Builtins
...........................

   - gh-126491(1): Add a marking phase to the GC. All objects that can
     be transitively reached from builtin modules or the stacks are
     marked as reachable before cycle detection.  This reduces the
     amount of work done by the GC by approximately half.

   - gh-127020(2): Fix a crash in the free threading build when *note
     PyCode_GetCode(): 97c, *note PyCode_GetVarnames(): 97d, *note
     PyCode_GetCellvars(): 97e, or *note PyCode_GetFreevars(): 97f. were
     called from multiple threads at the same time.

   - gh-127010(3): Simplify GC tracking of dictionaries.  All
     dictionaries are tracked when created, rather than being lazily
     tracked when a trackable object was added to them.  This simplifies
     the code considerably and results in a slight speedup.

   - gh-126980(4): Fix *note __buffer__(): 68c. of *note bytearray: 344.
     crashing when *note READ: 18f5. or *note WRITE: 18f6. are passed as
     flags.

   - gh-126937(5): Fix *note TypeError: 198. when a *note
     ctypes.Structure: 1e5. has a field size that doesn't fit into an
     unsigned 16-bit integer.  Instead, the maximum number of 'bits' is
     *note sys.maxsize: 13dd.

   - gh-126868(6): Increase performance of *note int: 19b. by adding a
     freelist for compact ints.

   - gh-126881(7): Fix crash in finalization of dtoa state.  Patch by
     Kumar Aditya.

   - gh-126892(8): Require cold or invalidated code to "warm up" before
     being JIT compiled again.

   - gh-126091(9): Ensure stack traces are complete when throwing into a
     generator chain that ends in a custom generator.

   - gh-126024(10): Optimize decoding of short UTF-8 sequences
     containing non-ASCII characters by approximately 15%.

   - gh-125420(11): Add *note memoryview.index(): 18f7. to *note
     memoryview: 165. objects.  Patch by Bénédikt Tran.

   - gh-125420(12): Add *note memoryview.count(): 18f8. to *note
     memoryview: 165. objects.  Patch by Bénédikt Tran.

   - gh-124470(13): Fix crash in free-threaded builds when replacing
     object dictionary while reading attribute on another thread

   - gh-69639(14): Implement mixed-mode arithmetic rules combining real
     and complex numbers as specified by C standards since C99.  Patch
     by Sergey B Kirpichev.

   - gh-120010(15): Correct invalid corner cases which resulted in
     ‘(nan+nanj)’ output in complex multiplication, e.g.,
     ‘(1e300+1j)*(nan+infj)’.  Patch by Sergey B Kirpichev.

   - gh-109746(16): If ‘_thread.start_new_thread()’ fails to start a new
     thread, it deletes its state from interpreter and thus avoids its
     repeated cleanup on finalization.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126491

   (2) https://github.com/python/cpython/issues/127020

   (3) https://github.com/python/cpython/issues/127010

   (4) https://github.com/python/cpython/issues/126980

   (5) https://github.com/python/cpython/issues/126937

   (6) https://github.com/python/cpython/issues/126868

   (7) https://github.com/python/cpython/issues/126881

   (8) https://github.com/python/cpython/issues/126892

   (9) https://github.com/python/cpython/issues/126091

   (10) https://github.com/python/cpython/issues/126024

   (11) https://github.com/python/cpython/issues/125420

   (12) https://github.com/python/cpython/issues/125420

   (13) https://github.com/python/cpython/issues/124470

   (14) https://github.com/python/cpython/issues/69639

   (15) https://github.com/python/cpython/issues/120010

   (16) https://github.com/python/cpython/issues/109746


File: python.info,  Node: C API<13>,  Next: ビルド<13>,  Prev: Core and Builtins<37>,  Up: Python 3 14 0 alpha 3

1.24.17.10 C API
................

   - gh-127896(1): The previously undocumented function *note
     PySequence_In(): 3d8. is *note soft deprecated: 23d.  Use *note
     PySequence_Contains(): 3d9. instead.

   - gh-127791(2): Fix loss of callbacks after more than one call to
     *note PyUnstable_AtExit(): 18fa.

   - gh-127691(3): The *note Unicode Exception Objects: 461. C API now
     raises a *note TypeError: 198. if its exception argument is not a
     *note UnicodeError: 462. object.  Patch by Bénédikt Tran.

   - gh-123378(4): Ensure that the value of *note
     UnicodeEncodeError.end: 18c1. retrieved by *note
     PyUnicodeEncodeError_GetEnd(): 18fb. lies in ‘[min(1, objlen),
     max(min(1, objlen), objlen)]’ where 'objlen' is the length of *note
     UnicodeEncodeError.object: 18fc.  Similar arguments apply to *note
     UnicodeDecodeError: c08. and *note UnicodeTranslateError: 18fd. and
     their corresponding C interface.  Patch by Bénédikt Tran.

   - gh-127314(5): Improve error message when calling the C API without
     an active thread state on the *note free-threaded: 1f4. build.

   - gh-123378(6): Ensure that the value of *note
     UnicodeEncodeError.start: 18c0. retrieved by *note
     PyUnicodeEncodeError_GetStart(): 18fe. lies in ‘[0, max(0, objlen -
     1)]’ where 'objlen' is the length of *note
     UnicodeEncodeError.object: 18fc.  Similar arguments apply to *note
     UnicodeDecodeError: c08. and *note UnicodeTranslateError: 18fd. and
     their corresponding C interface.  Patch by Bénédikt Tran.

   - gh-109523(7): Reading text from a non-blocking stream with ‘read’
     may now raise a *note BlockingIOError: 235. if the operation cannot
     immediately return bytes.

   - gh-102471(8): Add a new import and export API for Python *note int:
     19b. objects ( PEP 757(9)):

        * *note PyLong_GetNativeLayout(): 3a7.;

        * *note PyLong_Export(): 3a8.;

        * *note PyLong_FreeExport(): 3a9.;

        * *note PyLongWriter_Create(): 3aa.;

        * *note PyLongWriter_Finish(): 3ab.;

        * *note PyLongWriter_Discard(): 3ac.

     Patch by Victor Stinner.

   - gh-121058(10): ‘PyThreadState_Clear()’ now warns (and calls
     ‘sys.excepthook’) if the thread state still has an active
     exception.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127896

   (2) https://github.com/python/cpython/issues/127791

   (3) https://github.com/python/cpython/issues/127691

   (4) https://github.com/python/cpython/issues/123378

   (5) https://github.com/python/cpython/issues/127314

   (6) https://github.com/python/cpython/issues/123378

   (7) https://github.com/python/cpython/issues/109523

   (8) https://github.com/python/cpython/issues/102471

   (9) https://peps.python.org/pep-0757/

   (10) https://github.com/python/cpython/issues/121058


File: python.info,  Node: ビルド<13>,  Prev: C API<13>,  Up: Python 3 14 0 alpha 3

1.24.17.11 ビルド
.................

   - gh-127865(1): Fix build failure on systems without thread-locals
     support.

   - gh-127629(2): Emscripten builds now include ctypes support.

   - gh-127111(3): Updated the Emscripten web example to use ES6 modules
     and be built into a distinct ‘web_example’ subfolder.

   - gh-115869(4): Make ‘jit_stencils.h’ (which is produced during JIT
     builds) reproducible.

   - gh-126898(5): The Emscripten build of Python is now based on ES6
     modules.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/127865

   (2) https://github.com/python/cpython/issues/127629

   (3) https://github.com/python/cpython/issues/127111

   (4) https://github.com/python/cpython/issues/115869

   (5) https://github.com/python/cpython/issues/126898


File: python.info,  Node: Python 3 14 0 alpha 2,  Next: Python 3 14 0 alpha 1,  Prev: Python 3 14 0 alpha 3,  Up: 変更履歴

1.24.18 Python 3.14.0 alpha 2
-----------------------------

'Release date: 2024-11-19'

* Menu:

* Windows: Windows<13>.
* Tools/Demos: Tools/Demos<14>.
* テスト: テスト<12>.
* セキュリティ: セキュリティ<15>.
* ライブラリ: ライブラリ<42>.
* ドキュメント: ドキュメント<13>.
* Core and Builtins: Core and Builtins<38>.
* ライブラリ: ライブラリ<43>.
* Core and Builtins: Core and Builtins<39>.
* ライブラリ: ライブラリ<44>.
* Core and Builtins: Core and Builtins<40>.
* ライブラリ: ライブラリ<45>.
* C API: C API<14>.
* ビルド: ビルド<14>.


File: python.info,  Node: Windows<13>,  Next: Tools/Demos<14>,  Up: Python 3 14 0 alpha 2

1.24.18.1 Windows
.................

   - gh-126911(1): Update credits command output.

   - gh-118973(2): Ensures the experimental free-threaded install
     includes the ‘_tkinter’ module.  The optional Tcl/Tk component must
     also be installed in order for the module to work.

   - gh-126497(3): Fixes venv failure due to missing redirector
     executables in experimental free-threaded installs.

   - gh-126074(4): Removed unnecessary DLLs from Windows embeddable
     package

   - gh-125315(5): Avoid crashing in *note platform: af. due to slow WMI
     calls on some Windows machines.

   - gh-126084(6): Fix venvwlauncher to launch pythonw instead of python
     so no extra console window is created.

   - gh-125842(7): Fix a *note SystemError: 795. when *note sys.exit():
     277. is called with ‘0xffffffff’ on Windows.

   - gh-125550(8): Enable the *note Python install manager: 7da. to
     detect Python 3.14 installs from the Windows Store.

   - gh-123803(9): All Windows code pages are now supported as "cpXXX"
     codecs on Windows.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126911

   (2) https://github.com/python/cpython/issues/118973

   (3) https://github.com/python/cpython/issues/126497

   (4) https://github.com/python/cpython/issues/126074

   (5) https://github.com/python/cpython/issues/125315

   (6) https://github.com/python/cpython/issues/126084

   (7) https://github.com/python/cpython/issues/125842

   (8) https://github.com/python/cpython/issues/125550

   (9) https://github.com/python/cpython/issues/123803


File: python.info,  Node: Tools/Demos<14>,  Next: テスト<12>,  Prev: Windows<13>,  Up: Python 3 14 0 alpha 2

1.24.18.2 Tools/Demos
.....................

   - gh-126807(1): Fix extraction warnings in ‘pygettext.py’ caused by
     mistaking function definitions for function calls.

   - gh-126167(2): The iOS testbed was modified so that it can be used
     by third-party projects for testing purposes.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126807

   (2) https://github.com/python/cpython/issues/126167


File: python.info,  Node: テスト<12>,  Next: セキュリティ<15>,  Prev: Tools/Demos<14>,  Up: Python 3 14 0 alpha 2

1.24.18.3 テスト
................

   - gh-126909(1): Fix test_os extended attribute tests to work on
     filesystems with 1 KiB xattr size limit.

   - gh-125730(2): Change ‘make test’ to not run GUI tests by default.
     Use ‘make ci’ to run tests with GUI tests instead.

   - gh-124295(3): Add translation tests to the *note argparse: 7.
     module.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126909

   (2) https://github.com/python/cpython/issues/125730

   (3) https://github.com/python/cpython/issues/124295


File: python.info,  Node: セキュリティ<15>,  Next: ライブラリ<42>,  Prev: テスト<12>,  Up: Python 3 14 0 alpha 2

1.24.18.4 セキュリティ
......................

   - gh-126623(1): Upgrade libexpat to 2.6.4

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126623


File: python.info,  Node: ライブラリ<42>,  Next: ドキュメント<13>,  Prev: セキュリティ<15>,  Up: Python 3 14 0 alpha 2

1.24.18.5 ライブラリ
....................

   - gh-85957(1): Add missing MIME types for images with RFCs: emf,
     fits, g3fax, jp2, jpm, jpx, t38, tiff-fx and wmf.  Patch by Hugo
     van Kemenade.

   - gh-126920(2): Fix the ‘prefix’ and ‘exec_prefix’ keys from *note
     sysconfig.get_config_vars(): 298. incorrectly having the same value
     as *note sys.base_prefix: 3e6. and *note sys.base_exec_prefix: 3ea,
     respectively, inside virtual environments.  They now accurately
     reflect *note sys.prefix: 3e7. and *note sys.exec_prefix: 3eb.

   - gh-67877(3): Fix memory leaks when *note regular expression: be.
     matching terminates abruptly, either because of a signal or because
     memory allocation fails.

   - gh-125063(4): *note marshal: 91. now supports *note slice: 694.
     objects.  The marshal format version was increased to 5.

   - gh-126789(5): Fixed the values of *note
     sysconfig.get_config_vars(): 298, *note sysconfig.get_paths(): 340,
     and their siblings when the *note site: cc. initialization happens
     after *note sysconfig: e1. has built a cache for *note
     sysconfig.get_config_vars(): 298.

   - gh-126188(6): Update bundled pip to 24.3.1

   - gh-126766(7): Fix issue where *note urllib.request.url2pathname():
     2bd. failed to discard two leading slashes introducing an empty
     authority section.

   - gh-126705(8): Allow *note os.PathLike: e4b. to be a base for
     Protocols.

   - gh-126699(9): Allow *note collections.abc.AsyncIterator: fde. to be
     a base for Protocols.

   - gh-126654(10): Fix crash when non-dict was passed to several
     functions in ‘_interpreters’ module.

   - gh-104745(11): Limit starting a patcher (from *note
     unittest.mock.patch(): 1092. or *note unittest.mock.patch.object():
     1906.) more than once without stopping it

   - gh-126595(12): Fix a crash when instantiating *note
     itertools.count: 149b. with an initial count of *note sys.maxsize:
     13dd. on debug builds.  Patch by Bénédikt Tran.

   - gh-120423(13): Fix issue where *note urllib.request.pathname2url():
     2bf. mishandled Windows paths with embedded forward slashes.

   - gh-126565(14): Improve performances of *note zipfile.Path.open():
     1907. for non-reading modes.

   - gh-126505(15): Fix bugs in compiling case-insensitive *note regular
     expressions: be. with character classes containing non-BMP
     characters: upper-case non-BMP character did was ignored and the
     ASCII flag was ignored when matching a character range whose upper
     bound is beyond the BMP region.

   - gh-117378(16): Fixed the *note multiprocessing: 98. ‘"forkserver"’
     start method forkserver process to correctly inherit the parent's
     *note sys.path: 3e4. during the importing of *note
     multiprocessing.set_forkserver_preload(): 1908. modules in the same
     manner as *note sys.path: 3e4. is configured in workers before
     executing work items.

     This bug caused some forkserver module preloading to silently fail
     to preload.  This manifested as a performance degradation in child
     processes when the ‘sys.path’ was required due to additional
     repeated work in every worker.

     It could also have a side effect of ‘""’ remaining in *note
     sys.path: 3e4. during forkserver preload imports instead of the
     absolute path from *note os.getcwd(): 1909. at multiprocessing
     import time used in the worker ‘sys.path’.

     The ‘sys.path’ differences between phases in the child process
     could potentially have caused preload to import incorrect things
     from the wrong location.  We are unaware of that actually having
     happened in practice.

   - gh-125679(17): The *note multiprocessing.Lock: 1853. and *note
     multiprocessing.RLock: 1854. ‘repr’ values no longer say "unknown"
     on macOS.

   - gh-126476(18): Raise *note calendar.IllegalMonthError: 190a. (now a
     subclass of *note IndexError: 174e.) for *note calendar.month():
     190b. when the input month is not correct.

   - gh-126489(19): The Python implementation of *note pickle: ab. no
     longer calls *note pickle.Pickler.persistent_id(): 190c. for the
     result of ‘persistent_id()’.

   - gh-126451(20): Register the *note contextvars.Context: 177. type to
     *note collections.abc.Mapping: ac7.

   - gh-126175(21): Add ‘msg’, ‘doc’, ‘pos’, ‘lineno’ and ‘colno’
     attributes to *note tomllib.TOMLDecodeError: 190d.  Deprecate
     instantiating with free-form arguments.

   - gh-89416(22): Add RFC 9559(23) MIME types for Matroska audiovisual
     container formats.  Patch by Hugo van Kemenade.

   - gh-126417(24): Register the ‘multiprocessing.managers.DictProxy’
     and ‘multiprocessing.managers.ListProxy’ types in *note
     multiprocessing.managers: 9b. to *note
     collections.abc.MutableMapping: 12c0. and *note
     collections.abc.MutableSequence: 4bf, respectively.

   - gh-126390(25): Add support for returning intermixed options and
     non-option arguments in order in *note getopt.gnu_getopt(): 16d3.

   - gh-126374(26): Add support for options with optional arguments in
     the *note getopt: 65. module.

   - gh-126363(27): Speed up pattern parsing in *note
     pathlib.Path.glob(): 537. by skipping creation of a *note
     pathlib.Path: 266. object for the pattern.

   - gh-126353(28): *note asyncio.get_event_loop(): 2f2. now does not
     implicitly creates an event loop.  It now raises a *note
     RuntimeError: 244. if there is no set event loop.  Patch by Kumar
     Aditya.

   - gh-126313(29): Fix an issue in *note curses.napms(): 190e. when
     *note curses.initscr(): 190f. has not yet been called.  Patch by
     Bénédikt Tran.

   - gh-126303(30): Fix pickling and copying of *note os.sched_param:
     1910. objects.

   - gh-126138(31): Fix a use-after-free crash on *note asyncio.Task:
     1c7. objects whose underlying coroutine yields an object that
     implements an evil *note __getattribute__(): dcb.  Patch by Nico
     Posada.

   - gh-120057(32): Replace the ‘os.environ.refresh()’ method with a new
     *note os.reload_environ(): 258. function.  Patch by Victor Stinner.

   - gh-126220(33): Fix crash in ‘cProfile.Profile’ and
     ‘_lsprof.Profiler’ when their callbacks were directly called with 0
     arguments.

   - gh-126212(34): Fix issue where *note urllib.request.pathname2url():
     2bf. and *note url2pathname(): 2bd. removed slashes from Windows
     DOS drive paths and URLs.

   - gh-126223(35): Raise a *note UnicodeEncodeError: 887. instead of a
     *note SystemError: 795. upon calling ‘_interpreters.create()’ with
     an invalid Unicode character.

   - gh-126205(36): Fix issue where *note urllib.request.pathname2url():
     2bf. generated URLs beginning with four slashes (rather than two)
     when given a Windows UNC path.

   - gh-126156(37): Improved performances of creating *note Morsel: dfe.
     objects by a factor of 3.8x.

   - gh-126105(38): Fix a crash in *note ast: 9. when the *note
     ast.AST._fields: 17d7. attribute is deleted.

   - gh-126106(39): Fixes a possible ‘NULL’ pointer dereference in *note
     ssl: d5.

   - gh-126080(40): Fix a use-after-free crash on *note asyncio.Task:
     1c7. objects for which the underlying event loop implements an evil
     *note __getattribute__(): dcb.  Reported by Nico-Posada.  Patch by
     Bénédikt Tran.

   - gh-125322(41): Correct detection of complex numbers support in
     libffi.

   - gh-126083(42): Fixed a reference leak in *note asyncio.Task: 1c7.
     objects when reinitializing the same object with a non-‘None’
     context.  Patch by Nico Posada.

   - gh-126068(43): Fix exceptions in the *note argparse: 7. module so
     that only error messages for ArgumentError and ArgumentTypeError
     are now translated.  ArgumentError is now only used for command
     line errors, not for logical errors in the program.  TypeError is
     now raised instead of ValueError for some logical errors.

   - gh-125413(44): Add ‘pathlib.Path.scandir()’ method to efficiently
     fetch directory children and their file attributes.  This is a
     trivial wrapper of *note os.scandir(): c54.

   - gh-125984(45): Fix use-after-free crashes on *note asyncio.Future:
     dc6. objects for which the underlying event loop implements an evil
     *note __getattribute__(): dcb.  Reported by Nico-Posada.  Patch by
     Bénédikt Tran.

   - gh-125926(46): Fix *note urllib.parse.urljoin(): 1096. for base URI
     with undefined authority.  Although RFC 3986(47) only specify
     reference resolution for absolute base URI, ‘urljoin()’ should
     continue to return sensible result for relative base URI.

   - gh-125969(48): Fix an out-of-bounds crash when an evil *note
     asyncio.loop.call_soon(): cfa. mutates the length of the internal
     callbacks list.  Patch by Bénédikt Tran.

   - gh-125966(49): Fix a use-after-free crash in *note
     asyncio.Future.remove_done_callback(): 1911.  Patch by Bénédikt
     Tran.

   - gh-125789(50): Fix possible crash when mutating list of callbacks
     returned by ‘asyncio.Future._callbacks’.  It now always returns a
     new copy in C implementation ‘_asyncio’.  Patch by Kumar Aditya.

   - gh-126916(51): Allow the 'initial' parameter of *note
     functools.reduce(): 21a. to be passed as a keyword argument.  Patch
     by Sayandip Dutta.

   - gh-124452(52): Fix an issue in *note
     email.policy.EmailPolicy.header_source_parse(): 1912. and *note
     email.policy.Compat32.header_source_parse(): 1913. that introduced
     spurious leading whitespaces into header values when the header
     includes a newline character after the header name delimiter (‘:’)
     and before the value.

   - gh-117941(53): ‘argparse.BooleanOptionalAction’ now rejects option
     names starting with ‘--no-’.

   - gh-125884(54): Fixed the bug for *note pdb: aa. where it can't set
     breakpoints on functions with certain annotations.

   - gh-125355(55): Fix several bugs in *note
     argparse.ArgumentParser.parse_intermixed_args(): cf7.

        * The parser no longer changes temporarily during parsing.

        * Default values are not processed twice.

        * Required mutually exclusive groups containing positional
          arguments are now supported.

        * The missing arguments report now includes the names of all
          required optional and positional arguments.

        * Unknown options can be intermixed with positional arguments in
          parse_known_intermixed_args().

   - gh-125767(56): *note super: 1a6. objects are now *note pickleable:
     ab. and *note copyable: 29.

   - gh-124969(57): ‘locale.nl_langinfo(locale.ALT_DIGITS)’ now returns
     a string again.  The returned value consists of up to 100
     semicolon-separated symbols.

   - gh-84850(58): Remove ‘URLopener’ and ‘FancyURLopener’ classes from
     *note urllib.request: 111.  They had previously raised *note
     DeprecationWarning: 1a3. since Python 3.3.

   - gh-125666(59): Avoid the exiting the interpreter if a null byte is
     given as input in the new REPL.

   - gh-125710(60): [Enum] fix hashable<->nonhashable comparisons for
     member values

   - gh-125631(61): Restore ability to set *note persistent_id: 190c.
     and *note persistent_load: 1914. attributes of instances of the
     ‘Pickler’ and ‘Unpickler’ classes in the *note pickle: ab. module.

   - gh-125378(62): Fixed the bug in *note pdb: aa. where after a
     multi-line command, an empty line repeats the first line of the
     multi-line command, instead of the full command.

   - gh-125682(63): Reject non-ASCII digits in the Python implementation
     of *note json.loads(): b4e. conforming to the JSON specification.

   - gh-125660(64): Reject invalid unicode escapes for Python
     implementation of *note json.loads(): b4e.

   - gh-52551(65): Use ‘wcsftime()’ to implement *note time.strftime():
     1402. on Windows.

   - gh-125259(66): Fix the notes removal logic for errors thrown in
     enum initialization.

   - gh-125633(67): Add function *note inspect.ispackage(): 232. to
     determine whether an object is a *note package: 233. or not.

   - gh-125614(68): In the *note FORWARDREF: 15f. format of *note
     annotationlib: 6, fix bug where nested expressions were not
     returned as *note annotationlib.ForwardRef: 1776. format.

   - gh-125590(69): Allow ‘FrameLocalsProxy’ to delete and pop if the
     key is not a fast variable.

   - gh-125600(70): Only show stale code warning in *note pdb: aa. when
     we display source code.

   - gh-125542(71): Deprecate passing keyword-only 'prefix_chars'
     argument to *note argparse.ArgumentParser.add_argument_group():
     2eb.

   - gh-125541(72): Pressing ‘Ctrl’-‘C’ while blocked in *note
     threading.Lock.acquire(): 8a7, *note threading.RLock.acquire():
     107b, and *note threading.Thread.join(): 13fd. now interrupts the
     function call and raises a *note KeyboardInterrupt: bc5. exception
     on Windows, similar to how those functions behave on macOS and
     Linux.

   - gh-125519(73): Improve traceback if *note importlib.reload(): 73d.
     is called with an object that is not a module.  Patch by Alex
     Waygood.

   - gh-125451(74): Fix deadlock when *note
     concurrent.futures.ProcessPoolExecutor: 1d6. shuts down
     concurrently with an error when feeding a job to a worker process.

   - gh-125115(75): Fixed a bug in *note pdb: aa. where arguments
     starting with ‘-’ can't be passed to the debugged script.

   - gh-125398(76): Fix the conversion of the ‘VIRTUAL_ENV’ path in the
     activate script in *note venv: 117. when running in Git Bash for
     Windows.

   - gh-125245(77): Fix race condition when importing *note
     collections.abc: 1f, which could incorrectly return an empty
     module.

   - gh-52551(78): Fix encoding issues in *note time.strftime(): 1402,
     the *note strftime(): e8e. method of the *note datetime: 34.
     classes *note datetime: 4e2, *note date: 1fa. and *note time: 1fb.
     and formatting of these classes.  Characters not encodable in the
     current locale are now acceptable in the format string.  Surrogate
     pairs and sequence of surrogatescape-encoded bytes are no longer
     recombinated.  Embedded null character no longer terminates the
     format string.

   - gh-124984(79): Fixed thread safety in *note ssl: d5. in the
     free-threaded build.  OpenSSL operations are now protected by a
     per-object lock.

   - gh-124651(80): Properly quote template strings in *note venv: 117.
     activation scripts.

   - gh-124694(81): We've added *note
     concurrent.futures.InterpreterPoolExecutor: 1d2, which allows you
     to run code in multiple isolated interpreters.  This allows you to
     circumvent the limitations of CPU-bound threads (due to the GIL).
     Patch by Eric Snow.

     This addition is unrelated to PEP 734(82).

   - gh-58032(83): Deprecate the *note argparse.FileType: 30c. type
     converter.

   - gh-99749(84): Adds a feature to optionally enable suggestions for
     argument choices and subparser names if mistyped by the user.

   - gh-58956(85): Fixed a bug in *note pdb: aa. where sometimes the
     breakpoint won't trigger if it was set on a function which is
     already in the call stack.

   - gh-124111(86): The tkinter module can now be built to use either
     the new version 9.0.0 of Tcl/Tk or the latest release 8.6.15 of
     Tcl/Tk 8.  Tcl/Tk 9 includes many improvements, both to the Tcl
     language and to the appearance and utility of the graphical user
     interface provided by Tk.

   - gh-80958(87): unittest discovery supports PEP 420 namespace
     packages as start directory again.

   - gh-123370(88): Fix the canvas not clearing after running turtledemo
     clock.

   - gh-89083(89): Add *note uuid.uuid8(): 2c4. for generating UUIDv8
     objects as specified in RFC 9562(90).  Patch by Bénédikt Tran

   - gh-122549(91): Add *note platform.invalidate_caches(): 27d. to
     invalidate cached results.

   - gh-120754(92): Update unbounded ‘read’ calls in *note zipfile: 137.
     to specify an explicit ‘size’ putting a limit on how much data they
     may read.  This also updates handling around ZIP max comment size
     to match the standard instead of reading comments that are one byte
     too long.

   - gh-121267(93): Improve the performance of *note tarfile: e4. when
     writing files, by caching user names and group names.

   - gh-70764(94): Fixed an issue where *note inspect.getclosurevars():
     12ec. would incorrectly classify an attribute name as a global
     variable when the name exists both as an attribute name and a
     global variable.

   - gh-118289(95): ‘posixpath.realpath()’ now raises *note
     NotADirectoryError: 1265. when 'strict' mode is enabled and a
     non-directory path with a trailing slash is supplied.

   - gh-119826(96): Always return an absolute path for *note
     os.path.abspath(): 1532. on Windows.

   - gh-97850(97): Remove deprecated ‘pkgutil.get_loader()’ and
     ‘pkgutil.find_loader()’.

   - gh-118986(98): Add ‘socket.IPV6_RECVERR’ constant (available since
     Linux 2.2).

   - gh-116897(99): Accepting objects with false values (like ‘0’ and
     ‘[]’) except empty strings, byte-like objects and ‘None’ in *note
     urllib.parse: 110. functions *note parse_qsl(): 31e. and *note
     parse_qs(): 31f. is now deprecated.

   - gh-101955(100): Fix SystemError when match regular expression
     pattern containing some combination of possessive quantifier,
     alternative and capture group.

   - gh-71936(101): Fix a race condition in *note
     multiprocessing.pool.Pool: 116d.

   - bpo-46128(102): Strip *note unittest.IsolatedAsyncioTestCase: 361.
     stack frames from reported stacktraces.

   - gh-84852(103): Add MIME types for MS Embedded OpenType, OpenType
     Layout, TrueType, WOFF 1.0 and 2.0 fonts.  Patch by Sahil Prajapati
     and Hugo van Kemenade.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/85957

   (2) https://github.com/python/cpython/issues/126920

   (3) https://github.com/python/cpython/issues/67877

   (4) https://github.com/python/cpython/issues/125063

   (5) https://github.com/python/cpython/issues/126789

   (6) https://github.com/python/cpython/issues/126188

   (7) https://github.com/python/cpython/issues/126766

   (8) https://github.com/python/cpython/issues/126705

   (9) https://github.com/python/cpython/issues/126699

   (10) https://github.com/python/cpython/issues/126654

   (11) https://github.com/python/cpython/issues/104745

   (12) https://github.com/python/cpython/issues/126595

   (13) https://github.com/python/cpython/issues/120423

   (14) https://github.com/python/cpython/issues/126565

   (15) https://github.com/python/cpython/issues/126505

   (16) https://github.com/python/cpython/issues/117378

   (17) https://github.com/python/cpython/issues/125679

   (18) https://github.com/python/cpython/issues/126476

   (19) https://github.com/python/cpython/issues/126489

   (20) https://github.com/python/cpython/issues/126451

   (21) https://github.com/python/cpython/issues/126175

   (22) https://github.com/python/cpython/issues/89416

   (23) https://datatracker.ietf.org/doc/html/rfc9559.html

   (24) https://github.com/python/cpython/issues/126417

   (25) https://github.com/python/cpython/issues/126390

   (26) https://github.com/python/cpython/issues/126374

   (27) https://github.com/python/cpython/issues/126363

   (28) https://github.com/python/cpython/issues/126353

   (29) https://github.com/python/cpython/issues/126313

   (30) https://github.com/python/cpython/issues/126303

   (31) https://github.com/python/cpython/issues/126138

   (32) https://github.com/python/cpython/issues/120057

   (33) https://github.com/python/cpython/issues/126220

   (34) https://github.com/python/cpython/issues/126212

   (35) https://github.com/python/cpython/issues/126223

   (36) https://github.com/python/cpython/issues/126205

   (37) https://github.com/python/cpython/issues/126156

   (38) https://github.com/python/cpython/issues/126105

   (39) https://github.com/python/cpython/issues/126106

   (40) https://github.com/python/cpython/issues/126080

   (41) https://github.com/python/cpython/issues/125322

   (42) https://github.com/python/cpython/issues/126083

   (43) https://github.com/python/cpython/issues/126068

   (44) https://github.com/python/cpython/issues/125413

   (45) https://github.com/python/cpython/issues/125984

   (46) https://github.com/python/cpython/issues/125926

   (47) https://datatracker.ietf.org/doc/html/rfc3986.html

   (48) https://github.com/python/cpython/issues/125969

   (49) https://github.com/python/cpython/issues/125966

   (50) https://github.com/python/cpython/issues/125789

   (51) https://github.com/python/cpython/issues/126916

   (52) https://github.com/python/cpython/issues/124452

   (53) https://github.com/python/cpython/issues/117941

   (54) https://github.com/python/cpython/issues/125884

   (55) https://github.com/python/cpython/issues/125355

   (56) https://github.com/python/cpython/issues/125767

   (57) https://github.com/python/cpython/issues/124969

   (58) https://github.com/python/cpython/issues/84850

   (59) https://github.com/python/cpython/issues/125666

   (60) https://github.com/python/cpython/issues/125710

   (61) https://github.com/python/cpython/issues/125631

   (62) https://github.com/python/cpython/issues/125378

   (63) https://github.com/python/cpython/issues/125682

   (64) https://github.com/python/cpython/issues/125660

   (65) https://github.com/python/cpython/issues/52551

   (66) https://github.com/python/cpython/issues/125259

   (67) https://github.com/python/cpython/issues/125633

   (68) https://github.com/python/cpython/issues/125614

   (69) https://github.com/python/cpython/issues/125590

   (70) https://github.com/python/cpython/issues/125600

   (71) https://github.com/python/cpython/issues/125542

   (72) https://github.com/python/cpython/issues/125541

   (73) https://github.com/python/cpython/issues/125519

   (74) https://github.com/python/cpython/issues/125451

   (75) https://github.com/python/cpython/issues/125115

   (76) https://github.com/python/cpython/issues/125398

   (77) https://github.com/python/cpython/issues/125245

   (78) https://github.com/python/cpython/issues/52551

   (79) https://github.com/python/cpython/issues/124984

   (80) https://github.com/python/cpython/issues/124651

   (81) https://github.com/python/cpython/issues/124694

   (82) https://peps.python.org/pep-0734/

   (83) https://github.com/python/cpython/issues/58032

   (84) https://github.com/python/cpython/issues/99749

   (85) https://github.com/python/cpython/issues/58956

   (86) https://github.com/python/cpython/issues/124111

   (87) https://github.com/python/cpython/issues/80958

   (88) https://github.com/python/cpython/issues/123370

   (89) https://github.com/python/cpython/issues/89083

   (90) https://datatracker.ietf.org/doc/html/rfc9562.html

   (91) https://github.com/python/cpython/issues/122549

   (92) https://github.com/python/cpython/issues/120754

   (93) https://github.com/python/cpython/issues/121267

   (94) https://github.com/python/cpython/issues/70764

   (95) https://github.com/python/cpython/issues/118289

   (96) https://github.com/python/cpython/issues/119826

   (97) https://github.com/python/cpython/issues/97850

   (98) https://github.com/python/cpython/issues/118986

   (99) https://github.com/python/cpython/issues/116897

   (100) https://github.com/python/cpython/issues/101955

   (101) https://github.com/python/cpython/issues/71936

   (102) https://bugs.python.org/issue?@action=redirect&bpo=46128

   (103) https://github.com/python/cpython/issues/84852


File: python.info,  Node: ドキュメント<13>,  Next: Core and Builtins<38>,  Prev: ライブラリ<42>,  Up: Python 3 14 0 alpha 2

1.24.18.6 ドキュメント
......................

   - gh-126622(1): Added stub pages for removed modules explaining their
     removal, where to find replacements, and linking to the last Python
     version that supported them.  Contributed by Ned Batchelder.

   - gh-125277(2): Require Sphinx 7.2.6 or later to build the Python
     documentation.  Patch by Adam Turner.

   - gh-60712(3): Include the *note object: c7e. type in the lists of
     documented types.  Change by Furkan Onder and Martin Panter.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126622

   (2) https://github.com/python/cpython/issues/125277

   (3) https://github.com/python/cpython/issues/60712


File: python.info,  Node: Core and Builtins<38>,  Next: ライブラリ<43>,  Prev: ドキュメント<13>,  Up: Python 3 14 0 alpha 2

1.24.18.7 Core and Builtins
...........................

   - gh-126795(1): Increase the threshold for JIT code warmup.
     Depending on platform and workload, this can result in performance
     gains of 1-9% and memory savings of 3-5%.

   - gh-126341(2): Now *note ValueError: 2ec. is raised instead of *note
     SystemError: 795. when trying to iterate over a released *note
     memoryview: 165. object.

   - gh-126688(3): Fix a crash when calling *note os.fork(): 4b5. on
     some operating systems, including SerenityOS.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126795

   (2) https://github.com/python/cpython/issues/126341

   (3) https://github.com/python/cpython/issues/126688


File: python.info,  Node: ライブラリ<43>,  Next: Core and Builtins<39>,  Prev: Core and Builtins<38>,  Up: Python 3 14 0 alpha 2

1.24.18.8 ライブラリ
....................

   - gh-126066(1): Fix *note importlib: 7b. to not write an incomplete
     .pyc files when a ulimit or some other operating system mechanism
     is preventing the write to go through fully.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126066


File: python.info,  Node: Core and Builtins<39>,  Next: ライブラリ<44>,  Prev: ライブラリ<43>,  Up: Python 3 14 0 alpha 2

1.24.18.9 Core and Builtins
...........................

   - gh-126222(1): Do not include count of "peek" items in
     ‘_PyUop_num_popped’.  This ensures that the correct number of items
     are popped from the stack when a micro-op exits with an error.

   - gh-126366(2): Fix crash when using ‘yield from’ on an object that
     raises an exception in its ‘__iter__’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126222

   (2) https://github.com/python/cpython/issues/126366


File: python.info,  Node: ライブラリ<44>,  Next: Core and Builtins<40>,  Prev: Core and Builtins<39>,  Up: Python 3 14 0 alpha 2

1.24.18.10 ライブラリ
.....................

   - gh-126209(1): Fix an issue with ‘skip_file_prefixes’ parameter
     which resulted in an inconsistent behaviour between the C and
     Python implementations of *note warnings.warn(): 1732.  Patch by
     Daehee Kim.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126209


File: python.info,  Node: Core and Builtins<40>,  Next: ライブラリ<45>,  Prev: ライブラリ<44>,  Up: Python 3 14 0 alpha 2

1.24.18.11 Core and Builtins
............................

   - gh-126312(1): Fix crash during garbage collection on an object
     frozen by *note gc.freeze(): d2e. on the free-threaded build.

   - gh-103951(2): Relax optimization requirements to allow fast
     attribute access to module subclasses.

   - gh-126072(3): Following gh-126101(4), for *note コードオブジェクト:
     7d2. like lambda, annotation and type alias, we no longer add
     ‘None’ to its *note co_consts: 189b.

   - gh-126195(5): Improve JIT performance by 1.4% on macOS Apple
     Silicon by using platform-specific memory protection APIs.  Patch
     by Diego Russo.

   - gh-126139(6): Provide better error location when attempting to use
     a *note future statement: fad. with an unknown future feature.

   - gh-126072(7): Add a new attribute in *note co_flags: 18db. to
     indicate whether the first item in *note co_consts: 189b. is the
     docstring.  If a code object has no docstring, ‘None’ will 'NOT' be
     inserted.

   - gh-126076(8): Relocated objects such as ‘tuple’, ‘bytes’ and ‘str’
     objects are properly tracked by *note tracemalloc: 105. and its
     associated hooks.  Patch by Pablo Galindo.

   - gh-90370(9): Avoid temporary tuple creation for vararg in argument
     passing with Argument Clinic generated code (if arguments either
     vararg or positional-only).

   - gh-126018(10): Fix a crash in *note sys.audit(): 191b. when passing
     a non-string as first argument and Python was compiled in debug
     mode.

   - gh-126012(11): The *note memoryview: 165. type now supports
     subscription, making it a *note generic type: 1a1.

   - gh-125837(12): Adds *note LOAD_SMALL_INT: 36e. and *note
     LOAD_CONST_IMMORTAL: 375. instructions.  ‘LOAD_SMALL_INT’ pushes a
     small integer equal to the ‘oparg’ to the stack.
     ‘LOAD_CONST_IMMORTAL’ does the same as ‘LOAD_CONST’ but is more
     efficient for immortal objects.  Removes ‘RETURN_CONST’
     instruction.

   - gh-125942(13): On Android, the ‘errors’ setting of *note
     sys.stdout: ccd. was changed from ‘surrogateescape’ to
     ‘backslashreplace’.

   - gh-125859(14): Fix a crash in the free threading build when *note
     gc.get_objects(): a04. or *note gc.get_referrers(): a05. is called
     during an in-progress garbage collection.

   - gh-125868(15): It was possible in 3.14.0a1 only for attribute
     lookup to give the wrong value.  This was due to an incorrect
     specialization in very specific circumstances.  This is fixed in
     3.14.0a2.

   - gh-125498(16): The JIT has been updated to leverage Clang 19’s new
     ‘preserve_none’ attribute, which supports more platforms and is
     more useful than LLVM's existing ‘ghccc’ calling convention.  This
     also removes the need to manually patch the calling convention in
     LLVM IR, simplifying the JIT compilation process.

   - gh-125703(17): Correctly honour *note tracemalloc: 105. hooks in
     specialized ‘Py_DECREF’ paths.  Patch by Pablo Galindo

   - gh-125593(18): Use color to highlight error locations in traceback
     from exception group

   - gh-125017(19): Fix crash on certain accesses to the
     ‘__annotations__’ of *note staticmethod: 453. and *note
     classmethod: 48e. objects.

   - gh-125588(20): The Python PEG generator can now use f-strings in
     the grammar actions.  Patch by Pablo Galindo

   - gh-125444(21): Fix illegal instruction for older Arm architectures.
     Patch by Diego Russo, testing by Ross Burton.

   - gh-118423(22): Add a new ‘INSTRUCTION_SIZE’ macro to the cases
     generator which returns the current instruction size.

   - gh-125038(23): Fix crash when iterating over a generator expression
     after direct changes on ‘gi_frame.f_locals’.  Patch by Mikhail
     Efimov.

   - gh-124855(24): Don't allow the JIT and perf support to be active at
     the same time.  Patch by Pablo Galindo

   - gh-123714(25): Update JIT compilation to use LLVM 19

   - gh-123930(26): Improve the error message when a script shadowing a
     module from the standard library causes *note ImportError: 65b. to
     be raised during a "from" import.  Similarly, improve the error
     message when a script shadowing a third party module attempts to
     "from" import an attribute from that third party module while still
     initialising.

   - gh-119793(27): The *note map(): 19f. built-in now has an optional
     keyword-only 'strict' flag like *note zip(): 1a0. to check that all
     the iterables are of equal length.  Patch by Wannes Boeykens.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126312

   (2) https://github.com/python/cpython/issues/103951

   (3) https://github.com/python/cpython/issues/126072

   (4) https://github.com/python/cpython/issues/126101

   (5) https://github.com/python/cpython/issues/126195

   (6) https://github.com/python/cpython/issues/126139

   (7) https://github.com/python/cpython/issues/126072

   (8) https://github.com/python/cpython/issues/126076

   (9) https://github.com/python/cpython/issues/90370

   (10) https://github.com/python/cpython/issues/126018

   (11) https://github.com/python/cpython/issues/126012

   (12) https://github.com/python/cpython/issues/125837

   (13) https://github.com/python/cpython/issues/125942

   (14) https://github.com/python/cpython/issues/125859

   (15) https://github.com/python/cpython/issues/125868

   (16) https://github.com/python/cpython/issues/125498

   (17) https://github.com/python/cpython/issues/125703

   (18) https://github.com/python/cpython/issues/125593

   (19) https://github.com/python/cpython/issues/125017

   (20) https://github.com/python/cpython/issues/125588

   (21) https://github.com/python/cpython/issues/125444

   (22) https://github.com/python/cpython/issues/118423

   (23) https://github.com/python/cpython/issues/125038

   (24) https://github.com/python/cpython/issues/124855

   (25) https://github.com/python/cpython/issues/123714

   (26) https://github.com/python/cpython/issues/123930

   (27) https://github.com/python/cpython/issues/119793


File: python.info,  Node: ライブラリ<45>,  Next: C API<14>,  Prev: Core and Builtins<40>,  Up: Python 3 14 0 alpha 2

1.24.18.12 ライブラリ
.....................

   - gh-118950(1): Fix bug where SSLProtocol.connection_lost wasn't
     getting called when OSError was thrown on writing to socket.

   - gh-113570(2): Fixed a bug in ‘reprlib.repr’ where it incorrectly
     called the repr method on shadowed Python built-in types.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118950

   (2) https://github.com/python/cpython/issues/113570


File: python.info,  Node: C API<14>,  Next: ビルド<14>,  Prev: ライブラリ<45>,  Up: Python 3 14 0 alpha 2

1.24.18.13 C API
................

   - gh-126554(1): Fix error handling in *note ctypes.CDLL: bdc. objects
     which could result in a crash in rare situations.

   - gh-126061(2): Add *note PyLong_IsPositive(): 39b, *note
     PyLong_IsNegative(): 39c. and *note PyLong_IsZero(): 39d. for
     checking if a *note PyLongObject: 39e. is positive, negative, or
     zero, respectively.

   - gh-125608(3): Fix a bug where dictionary watchers (e.g., *note
     PyDict_Watch(): 784.) on an object's attribute dictionary (*note
     __dict__: 77d.) were not triggered when the object's attributes
     were modified.

   - gh-123619(4): Added the *note
     PyUnstable_Object_EnableDeferredRefcount(): 3c5. function for
     enabling PEP 703(5) deferred reference counting.

   - gh-121654(6): Add *note PyType_Freeze(): 3af. function to make a
     type immutable.  Patch by Victor Stinner.

   - gh-120026(7): The ‘Py_HUGE_VAL’ macro is *note soft deprecated:
     23d.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126554

   (2) https://github.com/python/cpython/issues/126061

   (3) https://github.com/python/cpython/issues/125608

   (4) https://github.com/python/cpython/issues/123619

   (5) https://peps.python.org/pep-0703/

   (6) https://github.com/python/cpython/issues/121654

   (7) https://github.com/python/cpython/issues/120026


File: python.info,  Node: ビルド<14>,  Prev: C API<14>,  Up: Python 3 14 0 alpha 2

1.24.18.14 ビルド
.................

   - gh-126691(1): Removed the ‘--with-emscripten-target’ configure
     flag.  We unified the ‘node’ and ‘browser’ options and the same
     build can now be used, independent of target runtime.

   - gh-123877(2): Use ‘wasm32-wasip1’ as the target triple for WASI
     instead of ‘wasm32-wasi’.  The latter will eventually be reclaimed
     for WASI 1.0 while CPython currently only supports WASI preview1.

   - gh-126458(3): Disable SIMD support for HACL under WASI.

   - gh-89640(4): Hard-code float word ordering as little endian on
     WASM.

   - gh-126206(5): ‘make clinic’ now runs Argument Clinic using the
     ‘--force’ option, thus forcefully regenerating generated code.

   - gh-126187(6): Introduced ‘Tools/wasm/emscripten.py’ to simplify
     doing Emscripten builds.

   - gh-124932(7): For cross builds, there is now support for having a
     different install ‘prefix’ than the ‘host_prefix’ used by
     ‘getpath.py’.  This is set to ‘/’ by default for Emscripten, on
     other platforms the default behavior is the same as before.

   - gh-125946(8): The minimum supported Android version is now 7.0 (API
     level 24).

   - gh-125940(9): The Android build now supports 16 KB page sizes(10).

   - gh-89640(11): Improve detection of float word ordering on Linux
     when link-time optimizations are enabled.

   - gh-124928(12): Emscripten builds now require node >= 18.

   - gh-115382(13): Fix cross compile failures when the host and target
     SOABIs match.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/126691

   (2) https://github.com/python/cpython/issues/123877

   (3) https://github.com/python/cpython/issues/126458

   (4) https://github.com/python/cpython/issues/89640

   (5) https://github.com/python/cpython/issues/126206

   (6) https://github.com/python/cpython/issues/126187

   (7) https://github.com/python/cpython/issues/124932

   (8) https://github.com/python/cpython/issues/125946

   (9) https://github.com/python/cpython/issues/125940

   (10) https://developer.android.com/guide/practices/page-sizes

   (11) https://github.com/python/cpython/issues/89640

   (12) https://github.com/python/cpython/issues/124928

   (13) https://github.com/python/cpython/issues/115382


File: python.info,  Node: Python 3 14 0 alpha 1,  Next: Python 3 13 0 beta 1,  Prev: Python 3 14 0 alpha 2,  Up: 変更履歴

1.24.19 Python 3.14.0 alpha 1
-----------------------------

'Release date: 2024-10-15'

* Menu:

* macOS: macOS<8>.
* Windows: Windows<14>.
* Tools/Demos: Tools/Demos<15>.
* テスト: テスト<13>.
* セキュリティ: セキュリティ<16>.
* ライブラリ: ライブラリ<46>.
* IDLE: IDLE<7>.
* ドキュメント: ドキュメント<14>.
* Core and Builtins: Core and Builtins<41>.
* ライブラリ: ライブラリ<47>.
* Core and Builtins: Core and Builtins<42>.
* ライブラリ: ライブラリ<48>.
* Core and Builtins: Core and Builtins<43>.
* ライブラリ: ライブラリ<49>.
* Core and Builtins: Core and Builtins<44>.
* ライブラリ: ライブラリ<50>.
* Core and Builtins: Core and Builtins<45>.
* ライブラリ: ライブラリ<51>.
* Core and Builtins: Core and Builtins<46>.
* ライブラリ: ライブラリ<52>.
* Core and Builtins: Core and Builtins<47>.
* ライブラリ: ライブラリ<53>.
* Core and Builtins: Core and Builtins<48>.
* C API: C API<15>.
* ビルド: ビルド<15>.


File: python.info,  Node: macOS<8>,  Next: Windows<14>,  Up: Python 3 14 0 alpha 1

1.24.19.1 macOS
...............

   - gh-124448(1): Update bundled Tcl/Tk in macOS installer to 8.6.15.

   - gh-123797(2): Check for runtime availability of ‘ptsname_r’
     function on macos.

   - gh-123418(3): Updated macOS installer build to use OpenSSL 3.0.15.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/124448

   (2) https://github.com/python/cpython/issues/123797

   (3) https://github.com/python/cpython/issues/123418


File: python.info,  Node: Windows<14>,  Next: Tools/Demos<15>,  Prev: macOS<8>,  Up: Python 3 14 0 alpha 1

1.24.19.2 Windows
.................

   - gh-124487(1): Increases Windows required OS and API level to
     Windows 10.

   - gh-124609(2): Fix ‘_Py_ThreadId’ for Windows builds using MinGW.
     Patch by Tony Roberts.

   - gh-124448(3): Updated bundled Tcl/Tk to 8.6.15.

   - gh-124254(4): Ensures experimental free-threaded binaries remain
     installed when updating.

   - gh-123915(5): Ensure that ‘Tools\msi\buildrelease.bat’ uses
     different directories for AMD64 and ARM64 builds.

   - gh-123418(6): Updated Windows build to use OpenSSL 3.0.15.

   - gh-123476(7): Add support for ‘socket.TCP_QUICKACK’ on Windows
     platforms.

   - gh-122573(8): The Windows build of CPython now requires 3.10 or
     newer.

   - gh-100256(9): *note mimetypes: 93. no longer fails when it
     encounters an inaccessible registry key.

   - gh-119679(10): Ensures correct import libraries are included in
     Windows installs.

   - gh-119690(11): Adds Unicode support and fixes audit events for
     ‘_winapi.CreateNamedPipe’.

   - gh-111201(12): Add support for new pyrepl on Windows

   - gh-119070(13): Fixes ‘py.exe’ handling of shebangs like
     ‘/usr/bin/env python3.12’, which were previously interpreted as
     ‘python3.exe’ instead of ‘python3.12.exe’.

   - gh-117505(14): Fixes an issue with the Windows installer not
     running ensurepip in a fully isolated environment.  This could
     cause unexpected interactions with the user site-packages.

   - gh-118209(15): Avoid crashing in *note mmap: 94. on Windows when
     the mapped memory is inaccessible due to file system errors or
     access violations.

   - gh-79846(16): Makes ‘ssl.create_default_context()’ ignore invalid
     certificates in the Windows certificate store

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/124487

   (2) https://github.com/python/cpython/issues/124609

   (3) https://github.com/python/cpython/issues/124448

   (4) https://github.com/python/cpython/issues/124254

   (5) https://github.com/python/cpython/issues/123915

   (6) https://github.com/python/cpython/issues/123418

   (7) https://github.com/python/cpython/issues/123476

   (8) https://github.com/python/cpython/issues/122573

   (9) https://github.com/python/cpython/issues/100256

   (10) https://github.com/python/cpython/issues/119679

   (11) https://github.com/python/cpython/issues/119690

   (12) https://github.com/python/cpython/issues/111201

   (13) https://github.com/python/cpython/issues/119070

   (14) https://github.com/python/cpython/issues/117505

   (15) https://github.com/python/cpython/issues/118209

   (16) https://github.com/python/cpython/issues/79846


File: python.info,  Node: Tools/Demos<15>,  Next: テスト<13>,  Prev: Windows<14>,  Up: Python 3 14 0 alpha 1

1.24.19.3 Tools/Demos
.....................

   - gh-123418(1): Update GitHub CI workflows to use OpenSSL 3.0.15 and
     multissltests to use 3.0.15, 3.1.7, and 3.2.3.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/123418


File: python.info,  Node: テスト<13>,  Next: セキュリティ<16>,  Prev: Tools/Demos<15>,  Up: Python 3 14 0 alpha 1

1.24.19.4 テスト
................

   - gh-125041(1): Re-enable skipped tests for *note zlib: 139. on the
     s390x architecture: only skip checks of the compressed bytes, which
     can be different between zlib's software implementation and the
     hardware-accelerated implementation.

   - gh-124378(2): Updated ‘test_ttk’ to pass with Tcl/Tk 8.6.15.

   - gh-124213(3): Detect whether the test suite is running inside a
     systemd-nspawn container with ‘--suppress-sync=true’ option, and
     skip the ‘test_os’ and ‘test_mmap’ tests that are failing in this
     scenario.

   - gh-124190(4): Add capability to ignore entire files or directories
     in check warning CI tool

   - gh-121921(5): Update ‘Lib/test/crashers/bogus_code_obj.py’ so that
     it crashes properly again.

   - gh-112301(6): Add tooling to check for changes in compiler
     warnings.  Patch by Nate Ohlson.

   - gh-59022(7): Add tests for *note pkgutil.extend_path(): 1924.
     Patch by Andreas Stocker.

   - gh-99242(8): *note os.getloadavg(): 1925. may throw *note OSError:
     2c0. when running regression tests under certain conditions (e.g.
     chroot).  This error is now caught and ignored, since reporting
     load average is optional.

   - gh-121084(9): Fix test_typing random leaks.  Clear typing ABC
     caches when running tests for refleaks (‘-R’ option): call
     ‘_abc_caches_clear()’ on typing abstract classes and their
     subclasses.  Patch by Victor Stinner.

   - gh-121160(10): Add a test for *note readline.set_history_length():
     1926.  Note that this test may fail on readline libraries.

   - gh-121200(11): Fix ‘test_expanduser_pwd2()’ of ‘test_posixpath’.
     Call ‘getpwnam()’ to get ‘pw_dir’, since it can be different than
     ‘getpwall()’ ‘pw_dir’.  Patch by Victor Stinner.

   - gh-121188(12): When creating the JUnit XML file, regrtest now
     escapes characters which are invalid in XML, such as the chr(27)
     control character used in ANSI escape sequences.  Patch by Victor
     Stinner.

   - gh-120801(13): Cleaned up fixtures for importlib.metadata tests and
     consolidated behavior with 'test.support.os_helper'.

   - gh-119727(14): Add ‘--single-process’ command line option to Python
     test runner (regrtest).  Patch by Victor Stinner.

   - gh-119273(15): Python test runner no longer runs tests using TTY
     (ex: test_ioctl) in a process group (using ‘setsid()’).
     Previously, tests using TTY were skipped.  Patch by Victor Stinner.

   - gh-119050(16): regrtest test runner: Add XML support to the refleak
     checker (-R option).  Patch by Victor Stinner.

   - gh-101525(17): Skip ‘test_gdb’ if the binary is relocated by BOLT.
     Patch by Donghee Na.

   - gh-107562(18): Test certificates have been updated to expire far in
     the future.  This allows testing Y2038 with system time set to
     after that, so that actual Y2038 issues can be exposed, and not
     masked by expired certificate errors.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/125041

   (2) https://github.com/python/cpython/issues/124378

   (3) https://github.com/python/cpython/issues/124213

   (4) https://github.com/python/cpython/issues/124190

   (5) https://github.com/python/cpython/issues/121921

   (6) https://github.com/python/cpython/issues/112301

   (7) https://github.com/python/cpython/issues/59022

   (8) https://github.com/python/cpython/issues/99242

   (9) https://github.com/python/cpython/issues/121084

   (10) https://github.com/python/cpython/issues/121160

   (11) https://github.com/python/cpython/issues/121200

   (12) https://github.com/python/cpython/issues/121188

   (13) https://github.com/python/cpython/issues/120801

   (14) https://github.com/python/cpython/issues/119727

   (15) https://github.com/python/cpython/issues/119273

   (16) https://github.com/python/cpython/issues/119050

   (17) https://github.com/python/cpython/issues/101525

   (18) https://github.com/python/cpython/issues/107562


File: python.info,  Node: セキュリティ<16>,  Next: ライブラリ<46>,  Prev: テスト<13>,  Up: Python 3 14 0 alpha 1

1.24.19.5 セキュリティ
......................

   - gh-125140(1): Remove the current directory from ‘sys.path’ when
     using PyREPL.

   - gh-123678(2): Upgrade libexpat to 2.6.3

   - gh-112301(3): Enable compiler options that warn of potential
     security vulnerabilities.

   - gh-122792(4): Changed IPv4-mapped ‘ipaddress.IPv6Address’ to
     consistently use the mapped IPv4 address value for deciding
     properties.  Properties which have their behavior fixed are
     ‘is_multicast’, ‘is_reserved’, ‘is_link_local’, ‘is_global’, and
     ‘is_unspecified’.

   - gh-112301(5): Add ability to ignore warnings per file with warning
     count in warning checking tooling.  Patch by Nate Ohlson.

   - gh-112301(6): Add macOS warning tracking to warning check tooling.
     Patch by Nate Ohlson.

   - gh-122133(7): Authenticate the socket connection for the
     ‘socket.socketpair()’ fallback on platforms where ‘AF_UNIX’ is not
     available like Windows.

     Patch by Gregory P. Smith <<greg@krypto.org>> and Seth Larson
     <<seth@python.org>>.  Reported by Ellie <<el@horse64.org>>

   - gh-121957(8): Fixed missing audit events around interactive use of
     Python, now also properly firing for ‘python -i’, as well as for
     ‘python -m asyncio’.  The events in question are
     ‘cpython.run_stdin’ and ‘cpython.run_startup’.

   - gh-112301(9): Enable runtime protections for glibc to abort
     execution when unsafe behavior is encountered, for all platforms
     except Windows.

   - gh-121285(10): Remove backtracking from tarfile header parsing for
     ‘hdrcharset’, PAX, and GNU sparse headers.

   - gh-112301(11): Add default compiler options to improve security.
     Enable -Wimplicit-fallthrough, -fstack-protector-strong,
     -Wtrampolines.

   - gh-118773(12): Fixes creation of ACLs in *note os.mkdir(): 52b. on
     Windows to work correctly on non-English machines.

   - gh-118486(13): *note os.mkdir(): 52b. on Windows now accepts 'mode'
     of ‘0o700’ to restrict the new directory to the current user.  This
     fixes CVE 2024-4030(14) affecting *note tempfile.mkdtemp(): 52d. in
     scenarios where the base temporary directory is more permissive
     than the default.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/125140

   (2) https://github.com/python/cpython/issues/123678

   (3) https://github.com/python/cpython/issues/112301

   (4) https://github.com/python/cpython/issues/122792

   (5) https://github.com/python/cpython/issues/112301

   (6) https://github.com/python/cpython/issues/112301

   (7) https://github.com/python/cpython/issues/122133

   (8) https://github.com/python/cpython/issues/121957

   (9) https://github.com/python/cpython/issues/112301

   (10) https://github.com/python/cpython/issues/121285

   (11) https://github.com/python/cpython/issues/112301

   (12) https://github.com/python/cpython/issues/118773

   (13) https://github.com/python/cpython/issues/118486

   (14) https://www.cve.org/CVERecord?id=CVE-2024-4030


File: python.info,  Node: ライブラリ<46>,  Next: IDLE<7>,  Prev: セキュリティ<16>,  Up: Python 3 14 0 alpha 1

1.24.19.6 ライブラリ
....................

   - gh-125422(1): Fixed the bug where *note pdb: aa. and *note bdb: 10.
     can step into the bottom caller frame.

   - gh-100141(2): Fixed the bug where *note pdb: aa. will be stuck in
     an infinite loop when debugging an empty file.

   - gh-53203(3): Fix *note time.strptime(): 1646. for ‘%c’, ‘%x’ and
     ‘%X’ formats in many locales that use non-ASCII digits, like
     Persian, Burmese, Odia and Shan.

   - gh-125206(4): Workaround for old libffi versions is added.  Module
     ctypes supports double complex only with libffi >= 3.3.0.  Patch by
     Mikhail Efimov.

   - gh-89967(5): Make *note WeakKeyDictionary: 1929. and *note
     WeakValueDictionary: 192a. safe against concurrent mutations from
     other threads.  Patch by Kumar Aditya.

   - gh-125260(6): The *note gzip.compress(): 84e. 'mtime' parameter now
     defaults to 0 for reproducible output.  Patch by Bernhard M.
     Wiedemann and Adam Turner.

   - gh-125243(7): Fix data race when creating *note zoneinfo.ZoneInfo:
     adc. objects in the free threading build.

   - gh-125254(8): Fix a bug where ArgumentError includes the incorrect
     ambiguous option in *note argparse: 7.

   - gh-125235(9): Keep *note tkinter: f6. TCL paths in venv pointing to
     base installation on Windows.

   - gh-61011(10): Fix inheritance of nested mutually exclusive groups
     from parent parser in *note argparse.ArgumentParser: 1bd.
     Previously, all nested mutually exclusive groups lost their
     connection to the group containing them and were displayed as
     belonging directly to the parser.

   - gh-125118(11): Don't copy arbitrary values to _Bool in the *note
     struct: db. module.

   - gh-125069(12): Fix an issue where providing a *note
     pathlib.PurePath: 6cd. object as an initializer argument to a
     second *note PurePath: 6cd. object with a different *note parser:
     536. resulted in arguments to the former object's initializer being
     joined by the latter object's parser.

   - gh-125096(13): If the *note PYTHON_BASIC_REPL: 1b6. environment
     variable is set, the *note site: cc. module no longer imports the
     ‘_pyrepl’ module.  Moreover, the *note site: cc. module now
     respects *note -E: b56. and *note -I: b57. command line options:
     ignore *note PYTHON_BASIC_REPL: 1b6. in this case.  Patch by Victor
     Stinner.

   - gh-124969(14): Fix ‘locale.nl_langinfo(locale.ALT_DIGITS)’.  Now it
     returns a tuple of up to 100 strings (an empty tuple on most
     locales).  Previously it returned the first item of that tuple or
     an empty string.

   - gh-124960(15): Fix support for the ‘barry_as_FLUFL’ future flag in
     the new REPL.

   - gh-69998(16): Fix *note locale.nl_langinfo(): 454. in case when
     different categories have different locales.  The function now sets
     temporarily the ‘LC_CTYPE’ locale in some cases.  This temporary
     change affects other threads.

   - gh-124958(17): Fix refcycles in exceptions raised from *note
     asyncio.TaskGroup: 4d1. and the python implementation of *note
     asyncio.Future: dc6.

   - gh-53203(18): Fix *note time.strptime(): 1646. for ‘%c’ and ‘%x’
     formats in many locales: Arabic, Bislama, Breton, Bodo, Kashubian,
     Chuvash, Estonian, French, Irish, Ge'ez, Gurajati, Manx Gaelic,
     Hebrew, Hindi, Chhattisgarhi, Haitian Kreyol, Japanese, Kannada,
     Korean, Marathi, Malay, Norwegian, Nynorsk, Punjabi, Rajasthani,
     Tok Pisin, Yoruba, Yue Chinese, Yau/Nungon and Chinese.

   - gh-123961(19): Convert *note curses: 2f. to multi-phase
     initialization ( PEP 489(20)), thereby fixing reference leaks at
     interpreter shutdown.  Patch by Bénédikt Tran.

   - gh-124944(21): Add ‘SO_ORIGINAL_DST’ to the *note socket: d1.
     module.

   - gh-117151(22): The default buffer size used by *note
     shutil.copyfileobj(): c52. has been increased from 64k to 256k on
     non-Windows platforms.  It was already larger on Windows.

   - gh-90102(23): Skip the ‘isatty’ system call during open() when the
     file is known to not be a character device.  This provides a slight
     performance improvement when reading whole files.

   - gh-124917(24): Allow calling *note os.path.exists(): c03. and *note
     os.path.lexists(): c04. with keyword arguments on Windows.  Fixes a
     regression in 3.13.0.

   - gh-65865(25): *note argparse: 7. now raises early error for invalid
     ‘help’ arguments to *note add_argument(): 4bc, *note
     add_subparsers(): e11. and ‘add_parser()’.

   - gh-124653(26): Fix detection of the minimal Queue API needed by the
     *note logging: 8b. module.  Patch by Bénédikt Tran.

   - gh-91818(27): The CLI of many modules (*note ast: 9, *note
     ensurepip: 59, *note json: 86, *note pdb: aa, *note sqlite3: d4,
     *note tokenize: 101, *note venv: 117.) now uses the actual
     executable name instead of simply "python" to display in the usage
     message.

   - gh-124858(28): Fix reference cycles left in tracebacks in *note
     asyncio.open_connection(): d0e. when used with
     ‘happy_eyeballs_delay’

   - gh-124390(29): Fixed *note AssertionError: 8b8. when using
     ‘asyncio.staggered.staggered_race()’ with *note
     asyncio.eager_task_factory: 6a2.

   - gh-85935(30): *note argparse.ArgumentParser.add_argument(): 4bc.
     now raises an exception if an *note action: 192b. that does not
     consume arguments (like 'store_const' or 'store_true') or explicit
     ‘nargs=0’ are specified for positional arguments.

   - gh-124835(31): Make *note tomllib.loads(): 192c. raise *note
     TypeError: 198. not *note AttributeError: 5f0. on bad input types
     that do not have the ‘replace’ attribute.  Improve error message
     when *note bytes: 192. is received.

   - gh-124693(32): Fix a bug where *note argparse: 7. doesn't recognize
     negative complex numbers or negative numbers using scientific
     notation.

   - gh-124787(33): Fix *note typing.TypeAliasType: 2ae. with incorrect
     ‘type_params’ argument.  Now it raises a *note TypeError: 198. when
     a type parameter without a default follows one with a default, and
     when an entry in the ‘type_params’ tuple is not a type parameter
     object.

   - gh-66436(34): Improved *note prog: 1bc. default value for *note
     argparse.ArgumentParser: 1bd.  It will now include the name of the
     Python executable along with the module or package name, or the
     path to a directory, ZIP file, or directory within a ZIP file if
     the code was run that way.

   - gh-116850(35): Fix *note argparse: 7. for namespaces with not
     directly writable dict (e.g.  classes).

   - gh-101552(36): Add an 'annoation_format' parameter to *note
     inspect.signature(): 22f.  Add an 'quote_annotation_strings'
     parameter to *note inspect.Signature.format(): 231.  Use the new
     functionality to improve the display of annotations in signatures
     in *note pydoc: ba.  Patch by Jelle Zijlstra.

   - gh-58573(37): Fix conflicts between abbreviated long options in the
     parent parser and subparsers in *note argparse: 7.

   - gh-124594(38): All *note asyncio: b. REPL prompts run in the same
     *note context: 177.  Contributed by Bartosz Sławecki.

   - gh-61181(39): Fix support of *note choices: 192d. with string value
     in *note argparse: 7.  Substrings of the specified string no longer
     considered valid values.

   - gh-116750(40): Provide *note sys.monitoring.clear_tool_id(): 192e.
     to unregister all events and callbacks set by the tool.

   - gh-124552(41): Improve the accuracy of *note bdb: 10.'s check for
     the possibility of breakpoint in a frame.  This makes it possible
     to disable unnecessary events in functions.

   - gh-124538(42): Fixed crash when using *note gc.get_referents():
     a06. on a capsule object.

   - gh-80259(43): Fix *note argparse: 7. support of positional
     arguments with ‘nargs='?'’, ‘default=argparse.SUPPRESS’ and
     specified ‘type’.

   - gh-120378(44): Fix a crash related to an integer overflow in *note
     curses.resizeterm(): 192f. and *note curses.resize_term(): 1930.

   - gh-124498(45): Fix *note typing.TypeAliasType: 2ae. not to be
     generic, when ‘type_params’ is an empty tuple.

   - gh-53834(46): Fix support of arguments with *note choices: 192d. in
     *note argparse: 7.  Positional arguments with *note nargs: 1931.
     equal to ‘'?'’ or ‘'*'’ no longer check *note default: 1932.
     against ‘choices’.  Optional arguments with ‘nargs’ equal to ‘'?'’
     no longer check *note const: 1933. against ‘choices’.

   - gh-123884(47): Fixed bug in itertools.tee() handling of other tee
     inputs (a tee in a tee).  The output now has the promised 'n'
     independent new iterators.  Formerly, the first iterator was
     identical (not independent) to the input iterator.  This would
     sometimes give surprising results.

   - gh-123017(48): Due to unreliable results on some devices, *note
     time.strftime(): 1402. no longer accepts negative years on Android.

   - gh-123014(49): *note os.pidfd_open(): 6a4. and *note
     signal.pidfd_send_signal(): b25. are now unavailable when building
     against Android API levels older than 31, since the underlying
     system calls may cause a crash.

   - gh-124176(50): Add support for *note dataclasses.dataclass(): 4e1.
     in *note unittest.mock.create_autospec(): 1934.  Now
     ‘create_autospec’ will check for potential dataclasses and use
     *note dataclasses.fields(): 1935. function to retrieve the spec
     information.

   - gh-124345(51): *note argparse: 7. supports abbreviated single-dash
     long options separated by ‘=’ from its value.

   - gh-124400(52): Fixed a *note pdb: aa. bug where ‘until’ has no
     effect when it appears in a ‘commands’ sequence.  Also avoid
     printing the frame information at a breakpoint that has a command
     list containing a command that resumes execution.

   - gh-90562(53): Modify dataclasses to support zero-argument super()
     when ‘slots=True’ is specified.  This works by modifying all
     references to ‘__class__’ to point to the newly created class.

   - gh-104860(54): Fix disallowing abbreviation of single-dash long
     options in *note argparse: 7. with ‘allow_abbrev=False’.

   - gh-63143(55): Fix parsing mutually exclusive arguments in *note
     argparse: 7.  Arguments with the value identical to the default
     value (e.g.  booleans, small integers, empty or 1-character
     strings) are no longer considered "not present".

   - gh-72795(56): Positional arguments with *note nargs: 1931. equal to
     ‘'*'’ or ‘argparse.REMAINDER’ are no longer required.  This allows
     to use positional argument with ‘nargs='*'’ and without ‘default’
     in mutually exclusive group and improves error message about
     required arguments.

   - gh-59317(57): Fix parsing positional argument with *note nargs:
     1931. equal to ‘'?'’ or ‘'*'’ if it is preceded by an option and
     another positional argument.

   - gh-100980(58): The *note _fields_: 1936. attribute of *note
     ctypes.Structure: 1e5. and *note Union: 1e6. is no longer set if
     the setattr operation raises an error.

   - gh-53780(59): *note argparse: 7. now ignores the first ‘"--"’
     (double dash) between an option and command.

   - gh-124217(60): Add RFC 9637 reserved IPv6 block ‘3fff::/20’ in
     *note ipaddress: 84. module.

   - gh-111513(61): Improve the error message that may be raised by
     *note datetime.date.fromtimestamp(): dcd.

   - gh-124248(62): Fixed potential crash when using *note struct: db.
     to process zero-width 'Pascal string' fields (‘0p’).

   - gh-81691(63): Fix handling of multiple ‘"--"’ (double dashes) in
     *note argparse: 7.  Only the first one has now been removed, all
     subsequent ones are now taken literally.

   - gh-87041(64): Fix a bug in *note argparse: 7. where lengthy
     subparser argument help is incorrectly indented.

   - gh-84559(65): The default *note multiprocessing: 98. start method
     on Linux and other POSIX systems has been changed away from often
     unsafe ‘"fork"’ to ‘"forkserver"’ (when the platform supports
     sending file handles over pipes as most do) or ‘"spawn"’.  Mac and
     Windows are unchanged as they already default to ‘"spawn"’.

   - gh-124212(66): Fix invalid variable in *note venv: 117. handling of
     failed symlink on Windows

   - gh-124171(67): Add workaround for broken ‘fmod()’ implementations
     on Windows, that loose zero sign (e.g.  ‘fmod(-10, 1)’ returns
     ‘0.0’).  Patch by Sergey B Kirpichev.

   - gh-123978(68): Remove broken *note time.thread_time(): b30. and
     *note time.thread_time_ns(): d8a. on NetBSD.

   - gh-123934(69): Fix *note unittest.mock.MagicMock: 108f. resetting
     magic methods return values after ‘.reset_mock(return_value=True)’
     was called.

   - gh-124016(70): Update *note unicodedata: 10b. database to Unicode
     16.0.0.

   - gh-123968(71): Fix the command-line interface for the *note random:
     bd. module to select floats between 0 and N, not 1 and N.

   - gh-123945(72): Fix a bug where *note argparse: 7. doesn't recognize
     negative numbers with underscores

   - gh-123935(73): Fix parent slots detection for dataclasses that
     inherit from classes with ‘__dictoffset__’.

   - gh-123892(74): Add ‘"_wmi"’ to *note sys.stdlib_module_names: a42.
     Patch by Victor Stinner.

   - gh-84808(75): Fix error handling in *note socket: fa1. method *note
     connect_ex(): 1753. on platforms where ‘errno’ can be negative.

   - gh-123756(76): Added a new argument ‘mode’ to *note pdb.Pdb: 273.
     Only allow *note pdb: aa. from command line to use ‘restart’
     command.

   - gh-122765(77): Fix unbalanced quote errors occurring when
     activate.csh in *note venv: 117. was sourced with a custom prompt
     containing unpaired quotes or newlines.

   - gh-123657(78): Fix crash and memory leak in *note
     decimal.getcontext(): 1937.  It crashed when using a thread-local
     context by ‘--with-decimal-contextvar=no’.

   - gh-123339(79): Fix *note inspect.getsource(): 17c3. for classes in
     *note collections.abc: 1f. and *note decimal: 3a. (for pure Python
     implementation) modules.  *note inspect.getcomments(): 1938. now
     raises OSError instead of IndexError if the ‘__firstlineno__’ value
     for a class is out of bound.

   - gh-123374(80): Remove check for redefined memo entry in *note
     pickletools.dis(): ebe.

   - gh-123504(81): Fixed reference leak in the finalization of *note
     tkinter: f6.

   - gh-123430(82): Pages generated by the *note http.server: 76. module
     allow the browser to apply its default dark mode.

   - gh-123446(83): Fix empty function name in *note TypeError: 198.
     when *note csv.reader(): 6ae, *note csv.writer(): 6af, or *note
     csv.register_dialect(): 1939. are used without the required args.

   - gh-123448(84): Fixed memory leak of *note typing.NoDefault: 569. by
     moving it to the static types array.

   - gh-123409(85): Fix *note ipaddress.IPv6Address.reverse_pointer:
     193a. output according to RFC 3596, §2.5(86).  Patch by Bénédikt
     Tran.

   - gh-123089(87): Make *note weakref.WeakSet: 7f5. safe against
     concurrent mutations while it is being iterated.  Patch by Kumar
     Aditya.

   - gh-123363(88): Show string value of *note CONTAINS_OP: 193b. oparg
     in *note dis: 3c. output.  Patch by Alexandr153.

   - gh-123341(89): Add *note __class_getitem__(): 943. to
     ‘tkinter.Event’ for type subscript support at runtime.  Patch by
     Adonis Rakateli.

   - gh-123340(90): Show string value of *note IS_OP: 193c. oparg in
     *note dis: 3c. output.

   - gh-119518(91): Speed up normalization of *note pathlib.PurePath:
     6cd. and *note Path: 266. objects by not interning string parts.

   - gh-123270(92): Applied a more surgical fix for malformed payloads
     in *note zipfile.Path: 8d8. causing infinite loops (gh-122905(93))
     without breaking contents using legitimate characters.

   - gh-73991(94): Add *note pathlib.Path.copy_into(): 268. and *note
     move_into(): 26a, which copy and move files and directories into
     'existing' directories.

   - gh-123228(95): Fix return type for
     ‘_pyrepl.readline._ReadlineWrapper.get_line_buffer()’ to be *note
     str(): 169.  Patch by Sergey B Kirpichev.

   - gh-123240(96): Raise audit events for the *note input(): 14f0. in
     the new REPL.

   - gh-76960(97): Fix *note urllib.parse.urljoin(): 1096. and *note
     urllib.parse.urldefrag(): 145f. for URIs containing empty
     components.  For example, ‘urljoin()’ with relative reference "?"
     now sets empty query and removes fragment.  Preserve empty
     components (authority, params, query, fragment) in ‘urljoin()’.
     Preserve empty components (authority, params, query) in
     ‘urldefrag()’.

   - gh-116810(98): Resolve a memory leak introduced in CPython 3.10's
     *note ssl: d5. when the *note ssl.SSLSocket.session: 193d. property
     was accessed.  Speeds up read and write access to said property by
     no longer unnecessarily cloning session objects via serialization.

   - gh-123243(99): Fix memory leak in ‘_decimal’.

   - gh-122546(100): Consistently use same file name for different
     exceptions in the new repl.  Patch by Sergey B Kirpichev.

   - gh-123213(101): *note xml.etree.ElementTree.Element.extend(): 13eb.
     and *note Element: 363. assignment no longer hide the internal
     exception if an erroneous generator is passed.  Patch by Bar Harel.

   - gh-85110(102): Preserve relative path in URL without netloc in
     *note urllib.parse.urlunsplit(): 193e. and *note
     urllib.parse.urlunparse(): 193f.

   - gh-123165(103): Add support for rendering *note Positions: 1940. in
     *note dis: 3c.

   - gh-122909(104): In urllib.request when URLError is raised opening
     an ftp URL, the exception argument is now consistently a string.
     Earlier versions passed either a string or an ftplib exception
     instance as the argument to URLError.

   - gh-123084(105): Deprecate ‘shutil.ExecError’, which hasn't been
     raised by any *note shutil: ca. function since Python 3.4.  It's
     now an alias for *note RuntimeError: 244.

   - gh-123085(106): In a bare call to *note
     importlib.resources.files(): 6b6, ensure the caller's frame is
     properly detected when ‘importlib.resources’ is itself available as
     a compiled module only (no source).

   - gh-123067(107): Fix quadratic complexity in parsing ‘"’-quoted
     cookie values with backslashes by *note http.cookies: 75.

   - gh-123049(108): Add support for *note UNNAMED_SECTION: 178a. in
     *note configparser.ConfigParser.add_section(): 1485.

   - gh-121735(109): When working with zip archives, importlib.resources
     now properly honors module-adjacent references (e.g.
     ‘files(pkg.mod)’ and not just ‘files(pkg)’).

   - gh-122981(110): Fix *note inspect.getsource(): 17c3. for generated
     classes with Python base classes (e.g.  enums).

   - gh-122903(111): ‘zipfile.Path.glob’ now correctly matches
     directories instead of silently omitting them.

   - gh-122905(112): *note zipfile.Path: 8d8. objects now sanitize names
     from the zipfile.

   - gh-122873(113): Enable *note json: 86. module to work as a script
     using the *note -m: 23c. switch: ‘python -m json’.  See the *note
     JSON command-line interface: 23e. documentation.  Patch by Trey
     Hunner.

   - gh-122858(114): Deprecate ‘asyncio.iscoroutinefunction()’ in favor
     of *note inspect.iscoroutinefunction(): 30d.

   - gh-116263(115): *note logging.handlers.RotatingFileHandler: 1941.
     no longer rolls over empty log files.

   - gh-105376(116): Restore the deprecated *note logging: 8b. ‘warn()’
     method.  It was removed in Python 3.13 alpha 1.  Keep the
     deprecated ‘warn()’ method in Python 3.13.  Patch by Victor
     Stinner.

   - gh-122311(117): Improve errors in the *note pickle: ab. module.
     *note PicklingError: 1942. is now raised more often instead of
     *note UnicodeEncodeError: 887, *note ValueError: 2ec. and *note
     AttributeError: 5f0, and the original exception is chained to it.
     Improve and unify error messages in Python and C implementations.

   - gh-122744(118): Bump the version of pip bundled in ensurepip to
     version 24.2.

   - gh-118761(119): Improve import time of *note pprint: b3. by around
     seven times.  Patch by Hugo van Kemenade.

   - gh-118974(120): Add ‘decorator’ parameter to *note
     dataclasses.make_dataclass(): 185c. to customize the functional
     creation of dataclasses.

   - gh-118814(121): Fix the *note typing.TypeVar: 486. constructor when
     name is passed by keyword.

   - gh-122637(122): Adjust ‘cmath.tanh(nanj)’ and ‘cmath.tanh(infj)’
     for recent C standards.

   - gh-122478(123): Remove internal frames from tracebacks shown in
     *note code.InteractiveInterpreter: 1943. with non-default *note
     sys.excepthook(): a0c.  Save correct tracebacks in *note
     sys.last_traceback: 6e8. and update ‘__traceback__’ attribute of
     *note sys.last_value: 6e7. and *note sys.last_exc: 6e5.

   - gh-116622(124): On Android, the ‘FICLONE’ and ‘FICLONERANGE’
     constants are no longer exposed by *note fcntl: 5d, as these ioctls
     are blocked by SELinux.

   - gh-82378(125): Make sure that the new *note REPL: 491. interprets
     *note sys.tracebacklimit: 1944. in the same way that the classic
     REPL did.

   - gh-122334(126): Fix crash when importing *note ssl: d5. after the
     main interpreter restarts.

   - gh-122459(127): Optimize *note pickling: ab. by name objects
     without the ‘__module__’ attribute.

   - gh-87320(128): In *note code.InteractiveInterpreter: 1943, handle
     exceptions caused by calling a non-default *note sys.excepthook():
     a0c.  Before, the exception bubbled up to the caller, ending the
     *note REPL: 491.

   - gh-122272(129): On some platforms such as Linux, year with century
     was not 0-padded when formatted by *note strftime(): e8e. with
     C99-specific specifiers ‘'%C'’ or ‘'%F'’.  The 0-padding behavior
     is now guaranteed when the format specifiers ‘'%C'’ and ‘'%F'’ are
     supported by the C library.  Patch by Ben Hsing

   - gh-122400(130): Handle *note ValueError: 2ec.s raised by *note
     os.stat(): 26d. in *note filecmp.dircmp: 1142. and *note
     filecmp.cmpfiles(): 1945.  Patch by Bénédikt Tran.

   - gh-122311(131): Fix some error messages in *note pickle: ab.

   - gh-121650(132): *note email: 3f. headers with embedded newlines are
     now quoted on output.  The *note generator: 44. will now refuse to
     serialize (write) headers that are unsafely folded or delimited;
     see *note verify_generated_headers: 4f2.  (Contributed by Bas
     Bloemsaat and Petr Viktorin in gh-121650(133).)

   - gh-122332(134): Fixed segfault with *note asyncio.Task.get_coro():
     bcf. when using an eager task factory.

   - gh-105733(135): *note ctypes.ARRAY(): 59e. is now *note soft
     deprecated: 23d.: it no longer emits deprecation warnings and is
     not scheduled for removal.

   - gh-122213(136): Add notes for pickle serialization errors that
     allow to identify the source of the error.

   - gh-119180(137): As part of PEP 749(138), add the following
     attributes for customizing evaluation of annotation scopes:

        * ‘evaluate_value’ on *note typing.TypeAliasType: 2ae.

        * ‘evaluate_bound’, ‘evaluate_constraints’, and
          ‘evaluate_default’ on *note typing.TypeVar: 486.

        * ‘evaluate_default’ on *note typing.ParamSpec: 487.

        * ‘evaluate_default’ on *note typing.TypeVarTuple: 488.

   - gh-119180(139): Fix handling of classes with custom metaclasses in
     ‘annotationlib.get_annotations’.

   - gh-122170(140): Handle *note ValueError: 2ec.s raised by *note
     os.stat(): 26d. in *note linecache: 89.  Patch by Bénédikt Tran.

   - gh-122163(141): Add notes for JSON serialization errors that allow
     to identify the source of the error.

   - gh-122129(142): Improve support of method descriptors and wrappers
     in the help title.

   - gh-122145(143): Fix an issue when reporting tracebacks
     corresponding to Python code emitting an empty AST body.  Patch by
     Nikita Sobolev and Bénédikt Tran.

   - gh-121723(144): Make *note logging.config.dictConfig(): 13c8.
     accept any object implementing the Queue public API. See the *note
     queue configuration: 1946. section for details.  Patch by Bénédikt
     Tran.

   - gh-82951(145): Serializing objects with complex ‘__qualname__’
     (such as unbound methods and nested classes) by name no longer
     involves serializing parent objects by value in pickle protocols <
     4.

   - gh-120754(146): ‘Pathlib.read_bytes’ no longer opens the file in
     Python's buffered I/O mode.  This reduces overheads as the code
     reads a file in whole leading to a modest speedup.

   - gh-113785(147): *note csv: 2d. now correctly parses numeric fields
     (when used with *note csv.QUOTE_NONNUMERIC: 1947. or *note
     csv.QUOTE_STRINGS: 6ad.) which start with an escape character.

   - gh-122088(148): *note @warnings.deprecated: 489. now copies the
     coroutine status of functions and methods so that *note
     inspect.iscoroutinefunction(): 30d. returns the correct result.

   - gh-122081(149): Fix a crash in the ‘decimal.IEEEContext()’ optional
     function available via the ‘EXTRA_FUNCTIONALITY’ configuration
     flag.

   - gh-73991(150): Add *note pathlib.Path.move(): 269, which moves a
     file or directory tree.

   - gh-121268(151): Remove workarounds for non-IEEE 754 systems in
     *note cmath: 19.

   - gh-119698(152): Due to the lack of interest for *note
     symtable.Class.get_methods(): 31d, the method is marked as
     deprecated and will be removed in Python 3.16.  Patch by Bénédikt
     Tran.

   - gh-121889(153): Adjusts ‘cmath.acosh(complex('0+nanj'))’ for recent
     C standards.

   - gh-121804(154): Correctly show error locations, when *note
     SyntaxError: 18e. raised in new repl.  Patch by Sergey B Kirpichev.

   - gh-121797(155): Add alternative *note Fraction: 213. constructor
     *note Fraction.from_number(): 214.

   - gh-121798(156): Add alternative *note Decimal: 1fe. constructor
     *note Decimal.from_number(): 1fd.

   - gh-120930(157): Fixed a bug introduced by gh-92081(158) that added
     an incorrect extra blank to encoded words occurring in wrapped
     headers.

   - gh-57141(159): The 'shallow' argument to *note filecmp.dircmp:
     1142. (new in Python 3.13) is now keyword-only.

   - gh-121245(160): Simplify handling of the history file in
     ‘site.register_readline()’ helper.  The ‘CAN_USE_PYREPL’ variable
     now will be initialized, when imported.  Patch by Sergey B
     Kirpichev.

   - gh-121249(161): Support the float complex and double complex C
     types in the *note struct: db. module if the compiler has C11
     complex arithmetic.  Patch by Sergey B Kirpichev.

   - gh-121486(162): *note math: 92. functions *note isqrt(): bf8, *note
     log(): 16d9, *note log2(): 12f3. and *note log10(): 1948. now
     support integers larger than ‘2**2**32’ on 32-bit platforms.

   - gh-121474(163): Fix missing sanity check for ‘parties’ arg in *note
     threading.Barrier: 13fc. constructor.  Patch by Clinton Christian
     (pygeek).

   - gh-121450(164): Hard-coded breakpoints (*note breakpoint(): 271.
     and *note pdb.set_trace(): 272.) now reuse the most recent ‘Pdb’
     instance that calls ‘Pdb.set_trace()’, instead of creating a new
     one each time.  As a result, all the instance specific data like
     ‘display’ and ‘commands’ are preserved across Hard-coded
     breakpoints.

   - gh-119169(165): Slightly speed up *note os.walk(): 6d0. by
     simplifying exception handling.

   - gh-121423(166): Improve import time of *note socket: d1. by lazy
     importing modules and writing ‘socket.errorTab’ as a constant.

   - gh-59110(167): *note zipimport: 138. supports now namespace
     packages when no directory entry exists.

   - gh-119004(168): Fix a crash in *note OrderedDict.__eq__: 1949. when
     operands are mutated during the check.  Patch by Bénédikt Tran.

   - gh-121313(169): Limit the reading size in the *note
     multiprocessing.connection.Connection: 12f8. class to 64 KiB to
     prevent memory overallocation and unnecessary memory management
     system calls.

   - gh-121332(170): Fix constructor of *note ast: 9. nodes with custom
     ‘_attributes’.  Previously, passing custom attributes would raise a
     *note DeprecationWarning: 1a3.  Passing arguments to the
     constructor that are not in ‘_fields’ or ‘_attributes’ remains
     deprecated.  Patch by Jelle Zijlstra.

   - gh-121245(171): Fix a bug in the handling of the command history of
     the new *note REPL: 491. that caused the history file to be wiped
     at REPL exit.

   - gh-121210(172): Handle AST nodes with missing runtime fields or
     attributes in *note ast.compare(): 1bf.  Patch by Bénédikt Tran.

   - gh-121163(173): Add support for ‘all’ as an valid ‘action’ for
     *note warnings.simplefilter(): 8d0. and *note
     warnings.filterwarnings(): 16c2.

   - gh-121151(174): Fix wrapping of long usage text of arguments inside
     a mutually exclusive group in *note argparse: 7.

   - gh-121141(175): Add support for *note copy.replace(): 1c0. to AST
     nodes.  Patch by Bénédikt Tran.

   - gh-87744(176): Fix waitpid race while calling *note send_signal():
     194a. in asyncio.  Patch by Kumar Aditya.

   - gh-121027(177): Add a future warning in
     ‘functools.partial.__get__()’.  In future Python versions *note
     functools.partial: 217. will be a method descriptor.

   - gh-121027(178): Make the *note functools.partial: 217. object a
     method descriptor.

   - gh-117784(179): CPython now detects whether its linked TLS library
     supports TLSv1.3 post-handshake authentication and disables that
     feature if support is lacking.

   - gh-121025(180): Improve the *note __repr__(): 82f. of *note
     functools.partialmethod: 218.  Patch by Bénédikt Tran.

   - gh-121018(181): Fixed issues where
     ‘argparse.ArgumentParser.parse_args()’ did not honor
     ‘exit_on_error=False’.  Based on patch by Ben Hsing.

   - gh-119614(182): Fix truncation of strings with embedded null
     characters in some internal operations in *note tkinter: f6.

   - gh-120910(183): When reading installed files from an egg, use
     ‘relative_to(walk_up=True)’ to honor files installed outside of the
     installation root.

   - gh-61103(184): Support float complex, double complex and long
     double complex C types in *note ctypes: 2e. as *note
     c_float_complex: 1ed, *note c_double_complex: 1ee. and *note
     c_longdouble_complex: 1ef. if the compiler has C11 complex
     arithmetic.  Patch by Sergey B Kirpichev.

   - gh-120888(185): Upgrade pip wheel bundled with ensurepip (pip
     24.1.1)

   - gh-101830(186): Accessing the *note tkinter: f6. object's string
     representation no longer converts the underlying Tcl object to a
     string on Windows.

   - gh-120678(187): Fix regression in the new REPL that meant that
     globals from files passed using the ‘-i’ argument would not be
     included in the REPL's global namespace.  Patch by Alex Waygood.

   - gh-120811(188): Fix possible memory leak in *note
     contextvars.Context.run(): 194b.

   - gh-120782(189): Fix wrong references of the *note datetime: 34.
     types after reloading the module.

   - gh-120713(190): *note datetime.datetime.strftime(): e8e. now 0-pads
     years with less than four digits for the format specifiers ‘%Y’ and
     ‘%G’ on Linux.  Patch by Ben Hsing

   - gh-120769(191): Make empty line in *note pdb: aa. repeats the last
     command even when the command is from ‘cmdqueue’.

   - gh-120780(192): Show string value of LOAD_SPECIAL oparg in *note
     dis: 3c. output.

   - gh-41431(193): Add *note datetime.time.strptime(): 194c. and *note
     datetime.date.strptime(): 1f9.  Contributed by Wannes Boeykens.

   - gh-120743(194): *note Soft deprecate: 23d. *note os.popen(): 31a.
     and *note os.spawn*: 31b. functions.  They should no longer be used
     to write new code.  The *note subprocess: dc. module is recommended
     instead.  Patch by Victor Stinner.

   - gh-120732(195): Fix ‘name’ passing to *note unittest.mock.Mock:
     c3f. object when using *note unittest.mock.create_autospec(): 1934.

   - gh-111259(196): *note re: be. now handles patterns like ‘"[\s\S]"’
     or ‘"\s|\S"’ which match any character as effectively as a dot with
     the ‘DOTALL’ modifier (‘"(?s:.)"’).

   - gh-120683(197): Fix an error in *note logging.LogRecord: 11e8, when
     the integer part of the timestamp is rounded up, while the
     millisecond calculation truncates, causing the log timestamp to be
     wrong by up to 999 ms (affected roughly 1 in 8 million timestamps).

   - gh-118710(198): *note ipaddress.IPv4Address: 50c. and *note
     ipaddress.IPv6Address: 50d. attributes ‘version’ and
     ‘max_prefixlen’ are now available on the class.

   - gh-120633(199): Move scrollbar and remove tear-off menus in
     turtledemo.

   - gh-120606(200): Allow users to use EOF to exit ‘commands’
     definition in *note pdb: aa.

   - gh-120284(201): Allow *note asyncio.Runner.run(): 194d. to accept
     *note awaitable: 4c9. objects instead of simply *note coroutine:
     6b9.s.

   - gh-120541(202): Improve the prompt in the "less" pager when *note
     help(): ad4. is called with non-string argument.

   - gh-120495(203): Fix incorrect exception handling in Tab Nanny.
     Patch by Wulian233.

   - gh-120388(204): Improve a warning message when a test method in
     *note unittest: 10c. returns something other than ‘None’.  Now we
     show the returned object type and optional asyncio-related tip.

   - gh-120381(205): Correct *note inspect.ismethoddescriptor(): 194e.
     to check also for the lack of *note __delete__(): 194f.  Patch by
     Jan Kaliszewski.

   - gh-90425(206): The OS byte in gzip headers is now always set to 255
     when using *note gzip.compress(): 84e.

   - gh-120343(207): Fix column offset reporting for tokens that come
     after multiline f-strings in the *note tokenize: 101. module.

   - gh-119180(208): As part of implementing PEP 649(209) and PEP
     749(210), add a new module ‘annotationlib’.  Add support for
     unresolved forward references in annotations to *note dataclasses:
     33, *note typing.TypedDict: 332, and *note typing.NamedTuple: 331.

   - gh-119600(211): Fix *note unittest.mock.patch(): 1092. to not read
     attributes of the target when ‘new_callable’ is set.  Patch by
     Robert Collins.

   - gh-120289(212): Fixed the use-after-free issue in *note cProfile:
     2b. by disallowing ‘disable()’ and ‘clear()’ in external timers.

   - gh-82017(213): Added support for converting any objects that have
     the ‘as_integer_ratio()’ method to a *note Fraction: 213.

   - gh-114053(214): Fix edge-case bug where *note
     typing.get_type_hints(): 8c0. would produce incorrect results if
     type parameters in a class scope were overridden by assignments in
     a class scope and ‘from __future__ import annotations’ semantics
     were enabled.  Patch by Alex Waygood.

   - gh-114053(215): Fix erroneous *note NameError: 452. when calling
     *note inspect.get_annotations(): a14. with ‘eval_str=True`’ on a
     class that made use of PEP 695(216) type parameters in a module
     that had ‘from __future__ import annotations’ at the top of the
     file.  Patch by Alex Waygood.

   - gh-120268(217): Prohibit passing ‘None’ to pure-Python *note
     datetime.date.fromtimestamp(): dcd. to achieve consistency with
     C-extension implementation.

   - gh-120244(218): Fix memory leak in *note re.sub(): 5a3. when the
     replacement string contains backreferences.

   - gh-120254(219): Added ‘commands’ argument to *note pdb.set_trace():
     272. which allows users to send debugger commands from the source
     file.

   - gh-120211(220): Fix *note tkinter.ttk: ff. with Tcl/Tk 9.0.

   - gh-71587(221): Fix crash in C version of *note
     datetime.datetime.strptime(): 1950. when called again on the
     restarted interpreter.

   - gh-117983(222): Defer the ‘threading’ import in ‘importlib.util’
     until lazy loading is used.

   - gh-120157(223): Remove unused constant
     ‘concurrent.futures._base._FUTURE_STATES’ in *note
     concurrent.futures: 24.  Patch by Clinton Christian (pygeek).

   - gh-120161(224): *note datetime: 34. no longer crashes in certain
     complex reference cycle situations.

   - gh-119698(225): Fix *note symtable.Class.get_methods(): 31d. and
     document its behaviour.  Patch by Bénédikt Tran.

   - gh-120121(226): Add *note concurrent.futures.InvalidStateError:
     1951. to module's ‘__all__’.

   - gh-119933(227): Add the *note symtable.SymbolTableType: 1952.
     enumeration to represent the possible outputs of the *note
     symtable.SymbolTable.get_type: 1953. method.  Patch by Bénédikt
     Tran.

   - gh-120029(228): Expose *note symtable.Symbol: 289. methods *note
     is_free_class(): 28c, *note is_comp_iter(): 28b. and *note
     is_comp_cell(): 28a.  Patch by Bénédikt Tran.

   - gh-120108(229): Fix calling *note copy.deepcopy(): d65. on *note
     ast: 9. trees that have been modified to have references to parent
     nodes.  Patch by Jelle Zijlstra.

   - gh-120056(230): Add ‘socket.IP_RECVERR’ and ‘socket.IP_RECVTTL’
     constants (both available since Linux 2.2).  And
     ‘socket.IP_RECVORIGDSTADDR’ constant (available since Linux
     2.6.29).

   - gh-112672(231): Support building *note tkinter: f6. with Tcl 9.0.

   - gh-120057(232): Added the *note os.environ.refresh(): 259. method
     to update *note os.environ: 259. with changes to the environment
     made by *note os.putenv(): 25b, by *note os.unsetenv(): 25c, or
     made outside Python in the same process.  Patch by Victor Stinner.

   - gh-120029(233): Expose *note symtable.Symbol.is_type_parameter():
     1954. in the *note symtable: de. module.  Patch by Bénédikt Tran.

   - gh-119819(234): Fix regression to allow logging configuration with
     multiprocessing queue types.

   - gh-65454(235): *note unittest.mock.Mock.attach_mock(): 1955. no
     longer triggers a call to a ‘PropertyMock’ being attached.

   - gh-117142(236): The *note ctypes: 2e. module may now be imported in
     all subinterpreters, including those that have their own GIL.

   - gh-118835(237): Fix _pyrepl crash when using custom prompt with
     ANSI escape codes.

   - gh-81936(238): ‘help()’ and ‘showtopic()’ methods now respect a
     configured 'output' argument to ‘pydoc.Helper’ and not use the
     pager in such cases.  Patch by Enrico Tröger.

   - gh-117398(239): The ‘_datetime’ module (C implementation for *note
     datetime: 34.) now supports being imported in multiple
     interpreters.

   - gh-119824(240): Print stack entry in *note pdb: aa. when and only
     when user input is needed.

   - gh-119838(241): In mixed arithmetic operations with *note Fraction:
     213. and complex, the fraction is now converted to *note float:
     196. instead of *note complex: 197.

   - gh-119770(242): Make *note termios: e7. ‘ioctl()’ constants
     positive.  Patch by Victor Stinner.

   - gh-89727(243): Fix issue with *note shutil.rmtree(): 356. where a
     *note RecursionError: f68. is raised on deep directory trees.

   - gh-119577(244): The *note DeprecationWarning: 1a3. emitted when
     testing the truth value of an *note xml.etree.ElementTree.Element:
     363. now describes unconditionally returning ‘True’ in a future
     version rather than raising an exception in Python 3.14.

   - gh-89727(245): Partially fix issue with *note shutil.rmtree(): 356.
     where a *note RecursionError: f68. is raised on deep directory
     trees.  A recursion error is no longer raised when
     ‘rmtree.avoids_symlink_attacks’ is false.

   - gh-93963(246): Remove deprecated names from ‘importlib.abc’ as
     found in ‘importlib.resources.abc’.

   - gh-119118(247): Fix performance regression in the *note tokenize:
     101. module by caching the ‘line’ token attribute and calculating
     the column offset more efficiently.

   - gh-89727(248): Fix issue with *note os.fwalk(): d52. where a *note
     RecursionError: f68. was raised on deep directory trees by
     adjusting the implementation to be iterative instead of recursive.

   - gh-119594(249): If one calls pow(fractions.Fraction, x, module)
     with modulo not None, the error message now says that the types are
     incompatible rather than saying pow only takes 2 arguments.  Patch
     by Wim Jeantine-Glenn and Mark Dickinson.

   - gh-119588(250): ‘zipfile.Path.is_symlink’ now assesses if the given
     path is a symlink.

   - gh-119562(251): Remove ‘ast.Num’, ‘ast.Str’, ‘ast.Bytes’,
     ‘ast.NameConstant’ and ‘ast.Ellipsis’.  They had all emitted
     deprecation warnings since Python 3.12.  Patch by Alex Waygood.

   - gh-119555(252): Catch *note SyntaxError: 18e. from *note compile():
     4b1. in the runsource() method of the InteractiveColoredConsole.
     Patch by Sergey B Kirpichev.

   - gh-118908(253): Limit exposed globals from internal imports and
     definitions on new REPL startup.  Patch by Eugene Triguba and Pablo
     Galindo.

   - gh-117865(254): Improve the import time of the *note ast: 9. module
     by deferring the import of *note re: be.  Patch by Jelle Zijlstra.

   - gh-119127(255): Positional arguments of *note functools.partial():
     217. objects now support placeholders via *note
     functools.Placeholder: 216.

   - gh-113892(256): Now, the method ‘sock_connect’ of *note
     asyncio.ProactorEventLoop: 81d. raises a *note ValueError: 2ec. if
     given socket is not in non-blocking mode, as well as in other loop
     implementations.

   - gh-119506(257): Fix ‘io.TextIOWrapper.write()’ method breaks
     internal buffer when the method is called again during flushing
     internal buffer.

   - gh-69214(258): Fix ‘fcntl.ioctl()’ 'request' parameter: use an
     ‘unsigned long’ instead of an ‘unsigned int’ for the 'request'
     parameter of *note fcntl.ioctl(): 1694. to support requests larger
     than ‘UINT_MAX’.  Patch by Victor Stinner.

   - gh-119105(259): ‘difflib’'s ‘DIffer.compare()’ (and so also
     ‘ndiff’) can no longer be provoked into cubic-time behavior, or
     into unbounded recursion, and should generally be faster in
     ordinary cases too.  Results may change in some cases, although
     that should be rare.  Correctness of diffs is not affected.  Some
     similar lines far apart may be reported as deleting one and adding
     the other, where before they were displayed on adjacent output
     lines with markup showing the intraline differences.

   - gh-119443(260): The interactive REPL no longer runs with ‘from
     __future__ import annotations’ enabled.  Patch by Jelle Zijlstra.

   - gh-119461(261): Add ‘socket.VMADDR_CID_LOCAL’ constant.  Patch by
     Victor Stinner.

   - gh-117398(262): Objects in the datetime C-API are now all
     statically allocated, which means better memory safety, especially
     when the module is reloaded.  This should be transparent to users.

   - gh-118894(263): *note asyncio: b. REPL now has the same
     capabilities as PyREPL.

   - gh-118830(264): Bump *note pickle: ab. default protocol to ‘5’.

   - gh-118911(265): In PyREPL, updated ‘maybe-accept’'s logic so that
     if the user hits ‘Enter’ twice, they are able to terminate the
     block even if there's trailing whitespace.  Also, now when the user
     hits arrow up, the cursor is on the last functional line.  This
     matches IPython's behavior.  Patch by Aya Elsayed.

   - gh-115225(266): Raise error on certain technically valid but
     pathological ISO 8601 strings passed to *note
     datetime.time.fromisoformat(): 829. that were previously parsed
     incorrectly.

   - gh-111201(267): Remove dependency to *note readline: bf. from the
     new Python REPL.

   - gh-119189(268): When using the ‘**’ operator or *note pow(): 1a4.
     with *note Fraction: 213. as the base and an exponent that is not
     rational, a float, or a complex, the fraction is no longer
     converted to a float.

   - gh-119174(269): Fix high DPI causes turtledemo(turtle-graphics
     examples) windows blurry Patch by Wulian233 and Terry Jan Reedy

   - gh-119121(270): Fix a NameError happening in
     ‘asyncio.staggered.staggered_race’.  This function is now tested.

   - gh-119105(271): ‘difflib.Differ’ is much faster for some cases of
     diffs where many pairs of lines are equally similar.

   - gh-119113(272): Fix issue where *note
     pathlib.PurePath.with_suffix(): 1956. didn't raise *note TypeError:
     198. when given ‘None’ as a suffix.

   - gh-118643(273): Fix an AttributeError in the *note email: 3f.
     module when re-fold a long address list.  Also fix more cases of
     incorrect encoding of the address separator in the address list.

   - gh-73991(274): Add *note pathlib.Path.copy(): 267, which copies a
     file or directory to another.

   - gh-58933(275): Make *note pdb: aa. return to caller frame correctly
     when ‘f_trace’ of the caller frame is not set

   - gh-82805(276): Support single-dot file extensions in *note
     pathlib.PurePath.suffix: 1957. and related attributes and methods.
     For example, the *note suffixes: 1958. of ‘PurePath('foo.bar.')’
     are now ‘['.bar', '.']’ rather than ‘[]’.  This brings file
     extension splitting in line with *note os.path.splitext(): 1959.

   - gh-118924(277): Remove ‘version’ and ‘version_info’ from *note
     sqlite3: d4.  Patch by Hugo van Kemenade.

   - gh-118928(278): Disallow using a sequence of parameters with named
     placeholders in *note sqlite3: d4. queries.  Patch by Erlend E.
     Aasland.

   - gh-118895(279): Setting attributes on *note typing.NoDefault: 569.
     now raises *note AttributeError: 5f0. instead of *note TypeError:
     198.

   - gh-118868(280): Fixed issue where kwargs were no longer passed to
     the logging handler QueueHandler

   - gh-118827(281): Remove deprecated ‘Quoter’ class from *note
     urllib.parse: 110.  It had previously raised a *note
     DeprecationWarning: 1a3. since Python 3.11.  Patch by Nikita
     Sobolev.

   - gh-118824(282): Remove deprecated ‘pty.master_open()’ and
     ‘pty.slave_open()’.  Use *note pty.openpty(): 301. instead.  Patch
     by Nikita Sobolev.

   - gh-118851(283): ‘ctx’ arguments to the constructors of *note ast:
     9. node classes now default to *note ast.Load(): 4c2.  Patch by
     Jelle Zijlstra.

   - gh-101588(284): Remove copy, deepcopy, and pickle from itertools.
     These had previously raised a DeprecationWarning since Python 3.12.

   - gh-118805(285): Remove 'type', 'choices', and 'metavar' parameters
     of ‘argparse.BooleanOptionalAction’.  They were deprecated since
     Python 3.12.

   - gh-118803(286): ‘typing.ByteString’ and
     ‘collections.abc.ByteString’ are removed.  They had previously
     raised a *note DeprecationWarning: 1a3. since Python 3.12.

   - gh-118798(287): The 'isdst' parameter has been removed from *note
     email.utils.localtime(): 2f7.  Patch by Hugo van Kemenade.

   - gh-118760(288): Restore the default value of ‘tkiter.wantobjects’
     to ‘1’.

   - gh-118760(289): Fix errors in calling Tkinter bindings on Windows.

   - gh-74033(290): Drop support for passing keyword arguments to *note
     pathlib.Path: 266.

   - gh-101357(291): Suppress all *note OSError: 2c0. exceptions from
     *note pathlib.Path.exists(): c0b. and ‘is_*()’ methods, rather than
     a selection of more common errors.  The new behaviour is consistent
     with *note os.path.exists(): c03, *note os.path.isdir(): c05, etc.
     Use *note pathlib.Path.stat(): a24. to retrieve the file status
     without suppressing exceptions.

   - gh-78707(292): Drop support for passing additional positional
     arguments to *note pathlib.PurePath.relative_to(): 2fd. and *note
     is_relative_to(): 2fe.

   - gh-118507(293): Fix *note os.path.isfile(): c06. on Windows for
     pipes.  Speedup *note os.path.isjunction(): 6ca. and *note
     os.path.lexists(): c04. on Windows with a native implementation.

   - gh-118772(294): Allow *note typing.TypeVar: 486. instances without
     a default to follow instances without a default in some cases.
     Patch by Jelle Zijlstra.

   - gh-118714(295): Allow ‘restart’ in post-mortem debugging of *note
     pdb: aa.  Removed restart message when the user quits pdb from
     post-mortem mode.

   - gh-118673(296): Removed executable bits and shebang from stdlib
     modules.

   - gh-110863(297): *note os.path.realpath(): 262. now suppresses any
     *note OSError: 2c0. from *note os.readlink(): b1a. when 'strict'
     mode is disabled (the default).

   - gh-118263(298): Speed up *note os.path.splitroot(): 6cb. & *note
     os.path.normpath(): 1531. with a direct C call.

   - gh-110190(299): Fix ctypes structs with array on SPARC by setting
     ‘MAX_STRUCT_SIZE’ to 32 in stgdict.  Patch by Jakub Kulik

   - gh-118033(300): Fix *note dataclasses.dataclass(): 4e1. not
     creating a ‘__weakref__’ slot when subclassing *note
     typing.Generic: 17b6.

   - gh-117766(301): Always use *note str(): 169. to print ‘choices’ in
     *note argparse: 7.

   - gh-106531(302): In *note importlib.resources: 7f, sync with
     importlib_resources 6.3.2(303), including: ‘MultiplexedPath’ now
     expects ‘Traversable’ paths, deprecating string arguments to
     ‘MultiplexedPath’; Enabled support for resources in namespace
     packages in zip files; Fixed ‘NotADirectoryError’ when calling
     files on a subdirectory of a namespace package.

   - gh-115937(304): Removed extra preprocessing for the ‘__signature__’
     attribute: the code just check if it's a *note inspect.Signature:
     4e3. instance.  Patch by Sergey B Kirpichev.

   - gh-115808(305): Add *note operator.is_none(): 255. and *note
     operator.is_not_none(): 256. functions.

   - gh-114264(306): Improve performance of *note copy.deepcopy(): d65.
     by adding a fast path for atomic types.

   - gh-113878(307): Add 'doc' parameter to *note dataclasses.field():
     195a, so it can be stored and shown as a documentation / metadata.
     If ‘@dataclass(slots=True)’ is used, then the supplied string is
     available in the *note __slots__: 1704. dict.  Otherwise, the
     supplied string is only available in the corresponding *note
     dataclasses.Field: 195b. object.

     In order to support this feature we are changing the ‘__slots__’
     format in dataclasses from *note tuple: 614. to *note dict: 183.
     when documentation / metadata is present.

   - gh-113978(308): Ignore warnings on text completion inside REPL.

   - gh-113008(309): Correct argparse usage output for required,
     mutually exclusive groups containing a positional argument

   - gh-108172(310): ‘webbrowser’ honors OS preferred browser on Linux
     when its desktop entry name contains the text of a known browser
     name.

   - gh-109109(311): You can now get the raw TLS certificate chains from
     TLS connections via *note ssl.SSLSocket.get_verified_chain(): 195c.
     and *note ssl.SSLSocket.get_unverified_chain(): 195d. methods.

     Contributed by Mateusz Nowak.

   - gh-105623(312): Fix performance degradation in *note
     logging.handlers.RotatingFileHandler: 1941.  Patch by Craig Robson.

   - gh-102450(313): Add missing ISO-8601 24:00 alternative to midnight
     of next day to *note datetime.datetime.fromisoformat(): 82a. and
     *note datetime.time.fromisoformat(): 829.  Patch by Izan
     "TizzySaurus" Robinson (<tizzysaurus@gmail.com>)

   - gh-103956(314): Fix lack of newline characters in *note trace: 103.
     module output when line tracing is enabled but source code line for
     current frame is not available.

   - gh-92081(315): Fix missing spaces in email headers when the spaces
     are mixed with encoded 8-bit characters.

   - gh-103194(316): Prepare Tkinter for C API changes in Tcl 8.7/9.0 to
     avoid ‘_tkinter.Tcl_Obj’ being unexpectedly returned instead of
     *note bool: 3c3, *note str: 169, *note bytearray: 344, or *note
     int: 19b.

   - gh-87106(317): Fixed handling in *note inspect.Signature.bind():
     1892. of keyword arguments having the same name as positional-only
     arguments when a variadic keyword argument (e.g.  ‘**kwargs’) is
     present.

   - gh-103134(318): Add additional methods to *note proxy objects: 24c.
     in the ‘multiprocessing’ module:

        * ‘clear()’ and ‘copy()’ for proxies of *note list: 24d.

        * *note fromkeys(): 24e, ‘reversed(d)’, ‘d | {}’, ‘{} | d’, ‘d
          |= {'b': 2}’ for proxies of *note dict: 183.

   - bpo-45767(319): Fix integer conversion in *note os.major(): 195e,
     *note os.minor(): 195f, and *note os.makedev(): 1960.  Support
     device numbers larger than ‘2**63-1’.  Support non-existent device
     number (‘NODEV’).

   - bpo-44864(320): Do not translate user-provided strings in *note
     argparse.ArgumentParser: 1bd.

   - bpo-41843(321): Solaris now uses *note os.sendfile(): d05.
     fast-copy syscall for more efficient *note shutil: ca. file copy
     related functions.

   - bpo-15987(322): Implemented *note ast.compare(): 1bf. for comparing
     two ASTs.  Patch by Batuhan Taskaya with some help from Jeremy
     Hylton.

   - gh-67693(323): Fix *note urllib.parse.urlunparse(): 193f. and *note
     urllib.parse.urlunsplit(): 193e. for URIs with path starting with
     multiple slashes and no authority.  Based on patch by Ashwin
     Ramaswami.

   - bpo-14074(324): Fix *note argparse: 7. metavar processing to allow
     positional arguments to have a tuple metavar.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/125422

   (2) https://github.com/python/cpython/issues/100141

   (3) https://github.com/python/cpython/issues/53203

   (4) https://github.com/python/cpython/issues/125206

   (5) https://github.com/python/cpython/issues/89967

   (6) https://github.com/python/cpython/issues/125260

   (7) https://github.com/python/cpython/issues/125243

   (8) https://github.com/python/cpython/issues/125254

   (9) https://github.com/python/cpython/issues/125235

   (10) https://github.com/python/cpython/issues/61011

   (11) https://github.com/python/cpython/issues/125118

   (12) https://github.com/python/cpython/issues/125069

   (13) https://github.com/python/cpython/issues/125096

   (14) https://github.com/python/cpython/issues/124969

   (15) https://github.com/python/cpython/issues/124960

   (16) https://github.com/python/cpython/issues/69998

   (17) https://github.com/python/cpython/issues/124958

   (18) https://github.com/python/cpython/issues/53203

   (19) https://github.com/python/cpython/issues/123961

   (20) https://peps.python.org/pep-0489/

   (21) https://github.com/python/cpython/issues/124944

   (22) https://github.com/python/cpython/issues/117151

   (23) https://github.com/python/cpython/issues/90102

   (24) https://github.com/python/cpython/issues/124917

   (25) https://github.com/python/cpython/issues/65865

   (26) https://github.com/python/cpython/issues/124653

   (27) https://github.com/python/cpython/issues/91818

   (28) https://github.com/python/cpython/issues/124858

   (29) https://github.com/python/cpython/issues/124390

   (30) https://github.com/python/cpython/issues/85935

   (31) https://github.com/python/cpython/issues/124835

   (32) https://github.com/python/cpython/issues/124693

   (33) https://github.com/python/cpython/issues/124787

   (34) https://github.com/python/cpython/issues/66436

   (35) https://github.com/python/cpython/issues/116850

   (36) https://github.com/python/cpython/issues/101552

   (37) https://github.com/python/cpython/issues/58573

   (38) https://github.com/python/cpython/issues/124594

   (39) https://github.com/python/cpython/issues/61181

   (40) https://github.com/python/cpython/issues/116750

   (41) https://github.com/python/cpython/issues/124552

   (42) https://github.com/python/cpython/issues/124538

   (43) https://github.com/python/cpython/issues/80259

   (44) https://github.com/python/cpython/issues/120378

   (45) https://github.com/python/cpython/issues/124498

   (46) https://github.com/python/cpython/issues/53834

   (47) https://github.com/python/cpython/issues/123884

   (48) https://github.com/python/cpython/issues/123017

   (49) https://github.com/python/cpython/issues/123014

   (50) https://github.com/python/cpython/issues/124176

   (51) https://github.com/python/cpython/issues/124345

   (52) https://github.com/python/cpython/issues/124400

   (53) https://github.com/python/cpython/issues/90562

   (54) https://github.com/python/cpython/issues/104860

   (55) https://github.com/python/cpython/issues/63143

   (56) https://github.com/python/cpython/issues/72795

   (57) https://github.com/python/cpython/issues/59317

   (58) https://github.com/python/cpython/issues/100980

   (59) https://github.com/python/cpython/issues/53780

   (60) https://github.com/python/cpython/issues/124217

   (61) https://github.com/python/cpython/issues/111513

   (62) https://github.com/python/cpython/issues/124248

   (63) https://github.com/python/cpython/issues/81691

   (64) https://github.com/python/cpython/issues/87041

   (65) https://github.com/python/cpython/issues/84559

   (66) https://github.com/python/cpython/issues/124212

   (67) https://github.com/python/cpython/issues/124171

   (68) https://github.com/python/cpython/issues/123978

   (69) https://github.com/python/cpython/issues/123934

   (70) https://github.com/python/cpython/issues/124016

   (71) https://github.com/python/cpython/issues/123968

   (72) https://github.com/python/cpython/issues/123945

   (73) https://github.com/python/cpython/issues/123935

   (74) https://github.com/python/cpython/issues/123892

   (75) https://github.com/python/cpython/issues/84808

   (76) https://github.com/python/cpython/issues/123756

   (77) https://github.com/python/cpython/issues/122765

   (78) https://github.com/python/cpython/issues/123657

   (79) https://github.com/python/cpython/issues/123339

   (80) https://github.com/python/cpython/issues/123374

   (81) https://github.com/python/cpython/issues/123504

   (82) https://github.com/python/cpython/issues/123430

   (83) https://github.com/python/cpython/issues/123446

   (84) https://github.com/python/cpython/issues/123448

   (85) https://github.com/python/cpython/issues/123409

   (86) https://datatracker.ietf.org/doc/html/rfc3596.html#section-2.5

   (87) https://github.com/python/cpython/issues/123089

   (88) https://github.com/python/cpython/issues/123363

   (89) https://github.com/python/cpython/issues/123341

   (90) https://github.com/python/cpython/issues/123340

   (91) https://github.com/python/cpython/issues/119518

   (92) https://github.com/python/cpython/issues/123270

   (93) https://github.com/python/cpython/issues/122905

   (94) https://github.com/python/cpython/issues/73991

   (95) https://github.com/python/cpython/issues/123228

   (96) https://github.com/python/cpython/issues/123240

   (97) https://github.com/python/cpython/issues/76960

   (98) https://github.com/python/cpython/issues/116810

   (99) https://github.com/python/cpython/issues/123243

   (100) https://github.com/python/cpython/issues/122546

   (101) https://github.com/python/cpython/issues/123213

   (102) https://github.com/python/cpython/issues/85110

   (103) https://github.com/python/cpython/issues/123165

   (104) https://github.com/python/cpython/issues/122909

   (105) https://github.com/python/cpython/issues/123084

   (106) https://github.com/python/cpython/issues/123085

   (107) https://github.com/python/cpython/issues/123067

   (108) https://github.com/python/cpython/issues/123049

   (109) https://github.com/python/cpython/issues/121735

   (110) https://github.com/python/cpython/issues/122981

   (111) https://github.com/python/cpython/issues/122903

   (112) https://github.com/python/cpython/issues/122905

   (113) https://github.com/python/cpython/issues/122873

   (114) https://github.com/python/cpython/issues/122858

   (115) https://github.com/python/cpython/issues/116263

   (116) https://github.com/python/cpython/issues/105376

   (117) https://github.com/python/cpython/issues/122311

   (118) https://github.com/python/cpython/issues/122744

   (119) https://github.com/python/cpython/issues/118761

   (120) https://github.com/python/cpython/issues/118974

   (121) https://github.com/python/cpython/issues/118814

   (122) https://github.com/python/cpython/issues/122637

   (123) https://github.com/python/cpython/issues/122478

   (124) https://github.com/python/cpython/issues/116622

   (125) https://github.com/python/cpython/issues/82378

   (126) https://github.com/python/cpython/issues/122334

   (127) https://github.com/python/cpython/issues/122459

   (128) https://github.com/python/cpython/issues/87320

   (129) https://github.com/python/cpython/issues/122272

   (130) https://github.com/python/cpython/issues/122400

   (131) https://github.com/python/cpython/issues/122311

   (132) https://github.com/python/cpython/issues/121650

   (133) https://github.com/python/cpython/issues/121650

   (134) https://github.com/python/cpython/issues/122332

   (135) https://github.com/python/cpython/issues/105733

   (136) https://github.com/python/cpython/issues/122213

   (137) https://github.com/python/cpython/issues/119180

   (138) https://peps.python.org/pep-0749/

   (139) https://github.com/python/cpython/issues/119180

   (140) https://github.com/python/cpython/issues/122170

   (141) https://github.com/python/cpython/issues/122163

   (142) https://github.com/python/cpython/issues/122129

   (143) https://github.com/python/cpython/issues/122145

   (144) https://github.com/python/cpython/issues/121723

   (145) https://github.com/python/cpython/issues/82951

   (146) https://github.com/python/cpython/issues/120754

   (147) https://github.com/python/cpython/issues/113785

   (148) https://github.com/python/cpython/issues/122088

   (149) https://github.com/python/cpython/issues/122081

   (150) https://github.com/python/cpython/issues/73991

   (151) https://github.com/python/cpython/issues/121268

   (152) https://github.com/python/cpython/issues/119698

   (153) https://github.com/python/cpython/issues/121889

   (154) https://github.com/python/cpython/issues/121804

   (155) https://github.com/python/cpython/issues/121797

   (156) https://github.com/python/cpython/issues/121798

   (157) https://github.com/python/cpython/issues/120930

   (158) https://github.com/python/cpython/issues/92081

   (159) https://github.com/python/cpython/issues/57141

   (160) https://github.com/python/cpython/issues/121245

   (161) https://github.com/python/cpython/issues/121249

   (162) https://github.com/python/cpython/issues/121486

   (163) https://github.com/python/cpython/issues/121474

   (164) https://github.com/python/cpython/issues/121450

   (165) https://github.com/python/cpython/issues/119169

   (166) https://github.com/python/cpython/issues/121423

   (167) https://github.com/python/cpython/issues/59110

   (168) https://github.com/python/cpython/issues/119004

   (169) https://github.com/python/cpython/issues/121313

   (170) https://github.com/python/cpython/issues/121332

   (171) https://github.com/python/cpython/issues/121245

   (172) https://github.com/python/cpython/issues/121210

   (173) https://github.com/python/cpython/issues/121163

   (174) https://github.com/python/cpython/issues/121151

   (175) https://github.com/python/cpython/issues/121141

   (176) https://github.com/python/cpython/issues/87744

   (177) https://github.com/python/cpython/issues/121027

   (178) https://github.com/python/cpython/issues/121027

   (179) https://github.com/python/cpython/issues/117784

   (180) https://github.com/python/cpython/issues/121025

   (181) https://github.com/python/cpython/issues/121018

   (182) https://github.com/python/cpython/issues/119614

   (183) https://github.com/python/cpython/issues/120910

   (184) https://github.com/python/cpython/issues/61103

   (185) https://github.com/python/cpython/issues/120888

   (186) https://github.com/python/cpython/issues/101830

   (187) https://github.com/python/cpython/issues/120678

   (188) https://github.com/python/cpython/issues/120811

   (189) https://github.com/python/cpython/issues/120782

   (190) https://github.com/python/cpython/issues/120713

   (191) https://github.com/python/cpython/issues/120769

   (192) https://github.com/python/cpython/issues/120780

   (193) https://github.com/python/cpython/issues/41431

   (194) https://github.com/python/cpython/issues/120743

   (195) https://github.com/python/cpython/issues/120732

   (196) https://github.com/python/cpython/issues/111259

   (197) https://github.com/python/cpython/issues/120683

   (198) https://github.com/python/cpython/issues/118710

   (199) https://github.com/python/cpython/issues/120633

   (200) https://github.com/python/cpython/issues/120606

   (201) https://github.com/python/cpython/issues/120284

   (202) https://github.com/python/cpython/issues/120541

   (203) https://github.com/python/cpython/issues/120495

   (204) https://github.com/python/cpython/issues/120388

   (205) https://github.com/python/cpython/issues/120381

   (206) https://github.com/python/cpython/issues/90425

   (207) https://github.com/python/cpython/issues/120343

   (208) https://github.com/python/cpython/issues/119180

   (209) https://peps.python.org/pep-0649/

   (210) https://peps.python.org/pep-0749/

   (211) https://github.com/python/cpython/issues/119600

   (212) https://github.com/python/cpython/issues/120289

   (213) https://github.com/python/cpython/issues/82017

   (214) https://github.com/python/cpython/issues/114053

   (215) https://github.com/python/cpython/issues/114053

   (216) https://peps.python.org/pep-0695/

   (217) https://github.com/python/cpython/issues/120268

   (218) https://github.com/python/cpython/issues/120244

   (219) https://github.com/python/cpython/issues/120254

   (220) https://github.com/python/cpython/issues/120211

   (221) https://github.com/python/cpython/issues/71587

   (222) https://github.com/python/cpython/issues/117983

   (223) https://github.com/python/cpython/issues/120157

   (224) https://github.com/python/cpython/issues/120161

   (225) https://github.com/python/cpython/issues/119698

   (226) https://github.com/python/cpython/issues/120121

   (227) https://github.com/python/cpython/issues/119933

   (228) https://github.com/python/cpython/issues/120029

   (229) https://github.com/python/cpython/issues/120108

   (230) https://github.com/python/cpython/issues/120056

   (231) https://github.com/python/cpython/issues/112672

   (232) https://github.com/python/cpython/issues/120057

   (233) https://github.com/python/cpython/issues/120029

   (234) https://github.com/python/cpython/issues/119819

   (235) https://github.com/python/cpython/issues/65454

   (236) https://github.com/python/cpython/issues/117142

   (237) https://github.com/python/cpython/issues/118835

   (238) https://github.com/python/cpython/issues/81936

   (239) https://github.com/python/cpython/issues/117398

   (240) https://github.com/python/cpython/issues/119824

   (241) https://github.com/python/cpython/issues/119838

   (242) https://github.com/python/cpython/issues/119770

   (243) https://github.com/python/cpython/issues/89727

   (244) https://github.com/python/cpython/issues/119577

   (245) https://github.com/python/cpython/issues/89727

   (246) https://github.com/python/cpython/issues/93963

   (247) https://github.com/python/cpython/issues/119118

   (248) https://github.com/python/cpython/issues/89727

   (249) https://github.com/python/cpython/issues/119594

   (250) https://github.com/python/cpython/issues/119588

   (251) https://github.com/python/cpython/issues/119562

   (252) https://github.com/python/cpython/issues/119555

   (253) https://github.com/python/cpython/issues/118908

   (254) https://github.com/python/cpython/issues/117865

   (255) https://github.com/python/cpython/issues/119127

   (256) https://github.com/python/cpython/issues/113892

   (257) https://github.com/python/cpython/issues/119506

   (258) https://github.com/python/cpython/issues/69214

   (259) https://github.com/python/cpython/issues/119105

   (260) https://github.com/python/cpython/issues/119443

   (261) https://github.com/python/cpython/issues/119461

   (262) https://github.com/python/cpython/issues/117398

   (263) https://github.com/python/cpython/issues/118894

   (264) https://github.com/python/cpython/issues/118830

   (265) https://github.com/python/cpython/issues/118911

   (266) https://github.com/python/cpython/issues/115225

   (267) https://github.com/python/cpython/issues/111201

   (268) https://github.com/python/cpython/issues/119189

   (269) https://github.com/python/cpython/issues/119174

   (270) https://github.com/python/cpython/issues/119121

   (271) https://github.com/python/cpython/issues/119105

   (272) https://github.com/python/cpython/issues/119113

   (273) https://github.com/python/cpython/issues/118643

   (274) https://github.com/python/cpython/issues/73991

   (275) https://github.com/python/cpython/issues/58933

   (276) https://github.com/python/cpython/issues/82805

   (277) https://github.com/python/cpython/issues/118924

   (278) https://github.com/python/cpython/issues/118928

   (279) https://github.com/python/cpython/issues/118895

   (280) https://github.com/python/cpython/issues/118868

   (281) https://github.com/python/cpython/issues/118827

   (282) https://github.com/python/cpython/issues/118824

   (283) https://github.com/python/cpython/issues/118851

   (284) https://github.com/python/cpython/issues/101588

   (285) https://github.com/python/cpython/issues/118805

   (286) https://github.com/python/cpython/issues/118803

   (287) https://github.com/python/cpython/issues/118798

   (288) https://github.com/python/cpython/issues/118760

   (289) https://github.com/python/cpython/issues/118760

   (290) https://github.com/python/cpython/issues/74033

   (291) https://github.com/python/cpython/issues/101357

   (292) https://github.com/python/cpython/issues/78707

   (293) https://github.com/python/cpython/issues/118507

   (294) https://github.com/python/cpython/issues/118772

   (295) https://github.com/python/cpython/issues/118714

   (296) https://github.com/python/cpython/issues/118673

   (297) https://github.com/python/cpython/issues/110863

   (298) https://github.com/python/cpython/issues/118263

   (299) https://github.com/python/cpython/issues/110190

   (300) https://github.com/python/cpython/issues/118033

   (301) https://github.com/python/cpython/issues/117766

   (302) https://github.com/python/cpython/issues/106531

   (303) 
https://importlib-resources.readthedocs.io/en/latest/history.html#v6-3-2

   (304) https://github.com/python/cpython/issues/115937

   (305) https://github.com/python/cpython/issues/115808

   (306) https://github.com/python/cpython/issues/114264

   (307) https://github.com/python/cpython/issues/113878

   (308) https://github.com/python/cpython/issues/113978

   (309) https://github.com/python/cpython/issues/113008

   (310) https://github.com/python/cpython/issues/108172

   (311) https://github.com/python/cpython/issues/109109

   (312) https://github.com/python/cpython/issues/105623

   (313) https://github.com/python/cpython/issues/102450

   (314) https://github.com/python/cpython/issues/103956

   (315) https://github.com/python/cpython/issues/92081

   (316) https://github.com/python/cpython/issues/103194

   (317) https://github.com/python/cpython/issues/87106

   (318) https://github.com/python/cpython/issues/103134

   (319) https://bugs.python.org/issue?@action=redirect&bpo=45767

   (320) https://bugs.python.org/issue?@action=redirect&bpo=44864

   (321) https://bugs.python.org/issue?@action=redirect&bpo=41843

   (322) https://bugs.python.org/issue?@action=redirect&bpo=15987

   (323) https://github.com/python/cpython/issues/67693

   (324) https://bugs.python.org/issue?@action=redirect&bpo=14074


File: python.info,  Node: IDLE<7>,  Next: ドキュメント<14>,  Prev: ライブラリ<46>,  Up: Python 3 14 0 alpha 1

1.24.19.7 IDLE
..............

   - gh-122392(1): Increase currently inadequate vertical spacing for
     the IDLE browsers (path, module, and stack) on high-resolution
     monitors.

   - gh-112938(2): Fix uninteruptable hang when Shell gets rapid
     continuous output.

   - gh-122482(3): Change About IDLE to direct users to
     discuss.python.org instead of the now unused idle-dev email and
     mailing list.

   - gh-78889(4): Stop Shell freezes by blocking user access to
     non-method sys.stdout.shell attributes, which are all private.

   - gh-120083(5): Add explicit black IDLE Hovertip foreground color
     needed for recent macOS. Fixes Sonoma showing unreadable white on
     pale yellow.  Patch by John Riggles.

   - gh-120104(6): Fix padding in config and search dialog windows in
     IDLE.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/122392

   (2) https://github.com/python/cpython/issues/112938

   (3) https://github.com/python/cpython/issues/122482

   (4) https://github.com/python/cpython/issues/78889

   (5) https://github.com/python/cpython/issues/120083

   (6) https://github.com/python/cpython/issues/120104


File: python.info,  Node: ドキュメント<14>,  Next: Core and Builtins<41>,  Prev: IDLE<7>,  Up: Python 3 14 0 alpha 1

1.24.19.8 ドキュメント
......................

   - gh-124872(1): Added definitions for *note context: 1963, *note
     current context: 1964, and *note context management protocol: 1965,
     updated related definitions to be consistent, and expanded the
     documentation for *note contextvars.Context: 177.

   - gh-125018(2): The *note importlib.metadata: 7e. documentation now
     includes semantic cross-reference targets for the significant
     documented APIs.  This means intersphinx references like *note
     importlib.metadata.version(): 1966. will now work as expected.

   - gh-124720(3): Update "Using Python on a Mac" section of the "Python
     Setup and Usage" document and include information on installing
     free-threading support.

   - gh-124457(4): Remove coverity scan from the CPython repo.  It has
     not been used since 2020 and is currently unmaintained.

   - gh-116622(5): Add an Android platform guide, and flag modules not
     available on Android.

   - gh-123976(6): Refresh docs around custom providers.

   - gh-70870(7): Clarified the dual usage of the term "free variable"
     (both the formal meaning of any reference to names defined outside
     the local scope, and the narrower pragmatic meaning of nonlocal
     variables named in ‘co_freevars’).

   - gh-121277(8): Writers of CPython's documentation can now use ‘next’
     as the version for the ‘versionchanged’, ‘versionadded’,
     ‘deprecated’ directives.

   - gh-117765(9): Improved documentation for *note
     unittest.mock.patch.dict(): 1967.

   - gh-121749(10): Fix documentation for *note PyModule_AddObjectRef():
     60a.

   - gh-120012(11): Clarify the behaviours of *note
     multiprocessing.Queue.empty(): 1968. and *note
     multiprocessing.SimpleQueue.empty(): 1969. on closed queues.  Patch
     by Bénédikt Tran.

   - gh-119574(12): Added some missing environment variables to the
     output of *note -help-env: 808.

   - bpo-34008(13): The *note Py_Main(): e1e. documentation moved from
     the "Very High Level API" section to the "Initialization and
     Finalization" section.

     Also make it explicit that we expect ‘Py_Main’ to typically be
     called instead of ‘Py_Initialize’ rather than after it (since
     ‘Py_Main’ makes its own call to ‘Py_Initialize’).  Document that
     calling both is supported but is version dependent on which
     settings will be applied correctly.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/124872

   (2) https://github.com/python/cpython/issues/125018

   (3) https://github.com/python/cpython/issues/124720

   (4) https://github.com/python/cpython/issues/124457

   (5) https://github.com/python/cpython/issues/116622

   (6) https://github.com/python/cpython/issues/123976

   (7) https://github.com/python/cpython/issues/70870

   (8) https://github.com/python/cpython/issues/121277

   (9) https://github.com/python/cpython/issues/117765

   (10) https://github.com/python/cpython/issues/121749

   (11) https://github.com/python/cpython/issues/120012

   (12) https://github.com/python/cpython/issues/119574

   (13) https://bugs.python.org/issue?@action=redirect&bpo=34008


File: python.info,  Node: Core and Builtins<41>,  Next: ライブラリ<47>,  Prev: ドキュメント<14>,  Up: Python 3 14 0 alpha 1

1.24.19.9 Core and Builtins
...........................

   - gh-124375(1): Fix a crash in the free threading build when the GC
     runs concurrently with a new thread starting.

   - gh-125221(2): Fix possible race condition when calling *note
     __reduce_ex__(): 196b. for the first time in the free threading
     build.

   - gh-125174(3): Make the handling of reference counts of immortal
     objects more robust.  Immortal objects with reference counts that
     deviate from their original reference count by up to a billion
     (half a billion on 32 bit builds) are still counted as immortal.

   - gh-125039(4): Make ‘this_instr’ and ‘prev_instr’ const in cases
     generator.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/124375

   (2) https://github.com/python/cpython/issues/125221

   (3) https://github.com/python/cpython/issues/125174

   (4) https://github.com/python/cpython/issues/125039


File: python.info,  Node: ライブラリ<47>,  Next: Core and Builtins<42>,  Prev: Core and Builtins<41>,  Up: Python 3 14 0 alpha 1

1.24.19.10 ライブラリ
.....................

   - gh-125008(1): Fix *note tokenize.untokenize(): 18b3. producing
     invalid syntax for double braces preceded by certain escape
     characters.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/125008


File: python.info,  Node: Core and Builtins<42>,  Next: ライブラリ<48>,  Prev: ライブラリ<47>,  Up: Python 3 14 0 alpha 1

1.24.19.11 Core and Builtins
............................

   - gh-124871(1): Fix compiler bug (in some versions of 3.13) where an
     assertion fails during reachability analysis.

   - gh-123378(2): Fix a crash in the *note __str__(): 830. method of
     *note UnicodeError: 462. objects when the *note UnicodeError.start:
     18c0. and *note UnicodeError.end: 18c1. values are invalid or
     out-of-range.  Patch by Bénédikt Tran.

   - gh-118093(3): Improve the experimental JIT compiler's ability to
     stay "on trace" when encountering highly-biased branches.

   - gh-124642(4): Fixed scalability issue in free-threaded builds for
     lock-free reads from dictionaries in multi-threaded scenarios

   - gh-116510(5): Fix a crash caused by immortal interned strings being
     shared between sub-interpreters that use basic single-phase init.
     In that case, the string can be used by an interpreter that
     outlives the interpreter that created and interned it.  For
     interpreters that share obmalloc state, also share the interned
     dict with the main interpreter.

   - gh-116510(6): Fix a bug that can cause a crash when
     sub-interpreters use "basic" single-phase extension modules.
     Shared objects could refer to PyGC_Head nodes that had been freed
     as part of interpreter cleanup.

   - gh-119180(7): The ‘__main__’ module no longer always contains an
     ‘__annotations__’ dictionary in its global namespace.

   - gh-124547(8): When deallocating an object with inline values whose
     ‘__dict__’ is still live: if memory allocation for the inline
     values fails, clear the dictionary.  Prevents an interpreter crash.

   - gh-124513(9): Fix a crash in FrameLocalsProxy constructor: check
     the number of arguments.  Patch by Victor Stinner.

   - gh-124442(10): Fix nondeterminism in compilation by sorting the
     value of *note __static_attributes__: 477.  Patch by kp2pml30.

   - gh-124285(11): Fix bug where ‘bool(a)’ can be invoked more than
     once during the evaluation of a compound boolean expression.

   - gh-123856(12): Fix PyREPL failure when a keyboard interrupt is
     triggered after using a history search

   - gh-65961(13): Deprecate the setting and using ‘__package__’ and
     ‘__cached__’.

   - gh-119726(14): The JIT now generates more efficient code for calls
     to C functions resulting in up to 0.8% memory savings and 1.5%
     speed improvement on AArch64.  Patch by Diego Russo.

   - gh-122878(15): Use the ‘pager’ binary, if available (e.g.  on
     Debian and derivatives), to display REPL ‘help()’.

   - gh-124188(16): Fix reading and decoding a line from the source file
     with non-UTF-8 encoding for syntax errors raised in the compiler.

   - gh-124027(17): Support ‘<page up>’, ‘<page down>’, and ‘<delete>’
     keys in the Python REPL when ‘$TERM’ is set to ‘vt100’.

   - gh-124022(18): Fix bug where docstring is removed from classes in
     interactive mode.

   - gh-123958(19): docstrings are now removed from the optimized AST in
     optimization level 2.

   - gh-123923(20): The ‘f_executable’ field in the internal *note
     _PyInterpreterFrame: 196e. struct now uses a tagged pointer.
     Profilers and debuggers that uses this field should clear the least
     significant bit to recover the *note PyObject: 5df.* pointer.

   - gh-77894(21): Fix possible crash in the garbage collector when it
     tries to break a reference loop containing a *note memoryview: 165.
     object.  Now a ‘memoryview’ object can only be cleared if there are
     no buffers that refer it.

   - gh-120221(22): asyncio REPL is now again properly recognizing
     KeyboardInterrupts.  Display of exceptions raised in secondary
     threads is fixed.

   - gh-119310(23): Allow the new interactive shell to read history
     files written with the editline library that use unicode-escaped
     entries.  Patch by aorcajo and Łukasz Langa.

   - gh-123572(24): Fix key mappings for various F-keys in Windows for
     the new REPL. Patch by devdanzin

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/124871

   (2) https://github.com/python/cpython/issues/123378

   (3) https://github.com/python/cpython/issues/118093

   (4) https://github.com/python/cpython/issues/124642

   (5) https://github.com/python/cpython/issues/116510

   (6) https://github.com/python/cpython/issues/116510

   (7) https://github.com/python/cpython/issues/119180

   (8) https://github.com/python/cpython/issues/124547

   (9) https://github.com/python/cpython/issues/124513

   (10) https://github.com/python/cpython/issues/124442

   (11) https://github.com/python/cpython/issues/124285

   (12) https://github.com/python/cpython/issues/123856

   (13) https://github.com/python/cpython/issues/65961

   (14) https://github.com/python/cpython/issues/119726

   (15) https://github.com/python/cpython/issues/122878

   (16) https://github.com/python/cpython/issues/124188

   (17) https://github.com/python/cpython/issues/124027

   (18) https://github.com/python/cpython/issues/124022

   (19) https://github.com/python/cpython/issues/123958

   (20) https://github.com/python/cpython/issues/123923

   (21) https://github.com/python/cpython/issues/77894

   (22) https://github.com/python/cpython/issues/120221

   (23) https://github.com/python/cpython/issues/119310

   (24) https://github.com/python/cpython/issues/123572


File: python.info,  Node: ライブラリ<48>,  Next: Core and Builtins<43>,  Prev: Core and Builtins<42>,  Up: Python 3 14 0 alpha 1

1.24.19.12 ライブラリ
.....................

   - gh-123614(1): Add *note turtle.save(): 1970. to easily save Turtle
     drawings as PostScript files.  Patch by Marie Roald and Yngve
     Mardal Moe.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/123614


File: python.info,  Node: Core and Builtins<43>,  Next: ライブラリ<49>,  Prev: ライブラリ<48>,  Up: Python 3 14 0 alpha 1

1.24.19.13 Core and Builtins
............................

   - gh-123339(1): Setting the ‘__module__’ attribute for a class now
     removes the ‘__firstlineno__’ item from the type's dict, so they
     will no longer be inconsistent.

   - gh-119034(2): Change ‘<page up>’ and ‘<page down>’ keys of the
     Python REPL to history search forward/backward.  Patch by Victor
     Stinner.

   - gh-123562(3): Improve *note SyntaxError: 18e. message for using
     ‘case ... as ...’ with not a name.

   - gh-123545(4): Fix a double decref in rare cases on experimental JIT
     builds.

   - gh-123484(5): Fix ‘_Py_DebugOffsets’ for long objects to be
     relative to the start of the object rather than the start of a
     subobject.

   - gh-123446(6): Fix empty function name in *note TypeError: 198. when
     builtin magic methods are used without the required args.

   - gh-123440(7): Improve *note SyntaxError: 18e. message for using
     ‘except as’ with not a name.

   - gh-116017(8): Improved JIT memory consumption by periodically
     freeing memory used by infrequently-executed code.  This change is
     especially likely to improve the memory footprint of long-running
     programs.

   - gh-123344(9): Add AST optimizations for type parameter defaults.

   - gh-123321(10): Prevent Parser/myreadline race condition from
     segfaulting on multi-threaded use.  Patch by Bar Harel and Amit
     Wienner.

   - gh-123177(11): Fix a bug causing stray prompts to appear in the
     middle of wrapped lines in the new REPL.

   - gh-122982(12): Extend the deprecation period for bool inversion
     (‘~’) by two years.

   - gh-123271(13): Make concurrent iterations over the same *note
     zip(): 1a0. iterator safe under free-threading.

   - gh-123275(14): Support *note -X gil=1: 16f. and *note PYTHON_GIL=1:
     49a. on non-free-threaded builds.

   - gh-123177(15): Deactivate line wrap in the Apple Terminal via a
     ANSI escape code.  Patch by Pablo Galindo

   - gh-123229(16): Fix valgrind warning by initializing the f-string
     buffers to 0 in the tokenizer.  Patch by Pablo Galindo

   - gh-122298(17): Restore printout of GC stats when
     ‘gc.set_debug(gc.DEBUG_STATS)’ is called.  This feature was
     accidentally removed when implementing incremental GC.

   - gh-121804(18): Correctly show error locations when a *note
     SyntaxError: 18e. is raised in the basic REPL. Patch by Sergey B
     Kirpichev.

   - gh-115776(19): Enables inline values (Python's equivalent of hidden
     classes) on any class who's instances are of a fixed size.

   - gh-123142(20): Fix too-wide source location in exception tracebacks
     coming from broken iterables in comprehensions.

   - gh-123048(21): Fix a bug where pattern matching code could emit a
     *note JUMP_FORWARD: 1972. with no source location.

   - gh-118093(22): Break up ‘CALL_ALLOC_AND_ENTER_INIT’ into micro-ops
     and relax requirement for exact args, in order to increase the
     amount of code supported by tier 2.

   - gh-123123(23): Fix displaying *note SyntaxError: 18e. exceptions
     covering multiple lines.  Patch by Pablo Galindo

   - gh-123083(24): Fix a potential use-after-free in
     ‘STORE_ATTR_WITH_HINT’.

   - gh-123022(25): Fix crash in free-threaded build when calling *note
     Py_Initialize(): 460. from a non-main thread.

   - gh-118093(26): Add three specializations for *note CALL_KW: 372.:

        * ‘CALL_KW_PY’ for calls to Python functions

        * ‘CALL_KW_BOUND_METHOD’ for calls to bound methods

        * ‘CALL_KW_NON_PY’ for all other calls

   - gh-122821(27): Make sure that branches in *note while: 1973.
     statements have consistent offsets for *note sys.monitoring: e0.
     ‘while’ statements are now compiled with a simple jump at the end
     of the body, instead of duplicating the test.

   - gh-122907(28): Building with ‘HAVE_DYNAMIC_LOADING’ now works as
     well as it did in 3.12.  Existing deficiences will be addressed
     separately.  (See
     ‘https://github.com/python/cpython/issues/122950’.)

   - gh-122888(29): Fix crash on certain calls to ‘str()’ with
     positional arguments of the wrong type.  Patch by Jelle Zijlstra.

   - gh-118093(30): Improve the experimental JIT's handling of
     polymorphic code.

   - gh-122697(31): Fixed memory leaks at interpreter shutdown in the
     free-threaded build, and also reporting of leaked memory blocks via
     *note -X showrefcount: 16f.

   - gh-116622(32): Fix Android stdout and stderr messages being
     truncated or lost.

   - gh-122527(33): Fix a crash that occurred when a ‘PyStructSequence’
     was deallocated after its type's dictionary was cleared by the GC.
     The type's *note tp_basicsize: b7e. now accounts for non-sequence
     fields that aren't included in the *note Py_SIZE: 985. of the
     sequence.

   - gh-122445(34): Add only fields which are modified via self.* to
     *note __static_attributes__: 477.

   - gh-122417(35): In the free-threaded build, the reference counts for
     heap type objects are now partially stored in a distributed manner
     in per-thread arrays.  This reduces contention on the heap type's
     reference count fields when creating or destroying instances of the
     same type from multiple threads concurrently.

   - gh-116090(36): Fix an issue in JIT builds that prevented some *note
     for: 34a. loops from correctly firing *note RAISE: 1974. monitoring
     events.

   - gh-122300(37): Preserve AST nodes for f-string with single-element
     format specifiers.  Patch by Pablo Galindo

   - gh-120906(38): *note frame.f_locals: 4a5. now supports arbitrary
     hashable objects as keys.

   - gh-122239(39): When a *note list: 24d, *note tuple: 614. or *note
     dict: 183. with too many elements is unpacked, show the actual
     length in the error message.

   - gh-122245(40): Detection of writes to ‘__debug__’ is moved from the
     compiler's codegen stage to the symtable.  This means that these
     errors are now detected even in code that is optimized away before
     codegen (such as assertions with the *note -O: 18c. command line
     option).

   - gh-122234(41): Specializations for sums with float and complex
     inputs in *note sum(): 695. now always use compensated summation.
     Also, for integer items in above specializations: *note
     PyLong_AsDouble(): 1975. is used, instead of *note
     PyLong_AsLongAndOverflow(): 147d.  Patch by Sergey B Kirpichev.

   - gh-122208(42): Dictionary watchers now only deliver the
     PyDict_EVENT_ADDED event when the insertion is in a known good
     state to succeed.

   - gh-122160(43): Remove the ‘BUILD_CONST_KEY_MAP’ opcode.  Use *note
     BUILD_MAP: 369. instead.

   - gh-122029(44): Emit ‘c_call’ events in *note sys.setprofile():
     1717. when a ‘PyMethodObject’ pointing to a ‘PyCFunction’ is
     called.

   - gh-122026(45): Fix a bug that caused the tokenizer to not correctly
     identify mismatched parentheses inside f-strings in some
     situations.  Patch by Pablo Galindo

   - gh-99108(46): Python's hashlib now unconditionally uses the
     vendored HACL* library for Blake2.  Python no longer accepts libb2
     as an optional dependency for Blake2.

     We refreshed HACL* to the latest version, and now vendor HACL*'s
     128-bit and 256-bit wide vector implementations for Blake2, which
     are used on x86/x64 toolchains when the required CPU features are
     available at runtime.

     HACL*'s 128-bit wide vector implementation of Blake2 can also run
     on ARM NEON and Power8, but lacking evidence of a performance gain,
     these are not enabled (yet).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/123339

   (2) https://github.com/python/cpython/issues/119034

   (3) https://github.com/python/cpython/issues/123562

   (4) https://github.com/python/cpython/issues/123545

   (5) https://github.com/python/cpython/issues/123484

   (6) https://github.com/python/cpython/issues/123446

   (7) https://github.com/python/cpython/issues/123440

   (8) https://github.com/python/cpython/issues/116017

   (9) https://github.com/python/cpython/issues/123344

   (10) https://github.com/python/cpython/issues/123321

   (11) https://github.com/python/cpython/issues/123177

   (12) https://github.com/python/cpython/issues/122982

   (13) https://github.com/python/cpython/issues/123271

   (14) https://github.com/python/cpython/issues/123275

   (15) https://github.com/python/cpython/issues/123177

   (16) https://github.com/python/cpython/issues/123229

   (17) https://github.com/python/cpython/issues/122298

   (18) https://github.com/python/cpython/issues/121804

   (19) https://github.com/python/cpython/issues/115776

   (20) https://github.com/python/cpython/issues/123142

   (21) https://github.com/python/cpython/issues/123048

   (22) https://github.com/python/cpython/issues/118093

   (23) https://github.com/python/cpython/issues/123123

   (24) https://github.com/python/cpython/issues/123083

   (25) https://github.com/python/cpython/issues/123022

   (26) https://github.com/python/cpython/issues/118093

   (27) https://github.com/python/cpython/issues/122821

   (28) https://github.com/python/cpython/issues/122907

   (29) https://github.com/python/cpython/issues/122888

   (30) https://github.com/python/cpython/issues/118093

   (31) https://github.com/python/cpython/issues/122697

   (32) https://github.com/python/cpython/issues/116622

   (33) https://github.com/python/cpython/issues/122527

   (34) https://github.com/python/cpython/issues/122445

   (35) https://github.com/python/cpython/issues/122417

   (36) https://github.com/python/cpython/issues/116090

   (37) https://github.com/python/cpython/issues/122300

   (38) https://github.com/python/cpython/issues/120906

   (39) https://github.com/python/cpython/issues/122239

   (40) https://github.com/python/cpython/issues/122245

   (41) https://github.com/python/cpython/issues/122234

   (42) https://github.com/python/cpython/issues/122208

   (43) https://github.com/python/cpython/issues/122160

   (44) https://github.com/python/cpython/issues/122029

   (45) https://github.com/python/cpython/issues/122026

   (46) https://github.com/python/cpython/issues/99108


File: python.info,  Node: ライブラリ<49>,  Next: Core and Builtins<44>,  Prev: Core and Builtins<43>,  Up: Python 3 14 0 alpha 1

1.24.19.14 ライブラリ
.....................

   - gh-121999(1): The default extraction filter for the *note tarfile:
     e4. module is now set to *note 'data': 29a.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/121999


File: python.info,  Node: Core and Builtins<44>,  Next: ライブラリ<50>,  Prev: ライブラリ<49>,  Up: Python 3 14 0 alpha 1

1.24.19.15 Core and Builtins
............................

   - gh-121860(1): Fix crash when rematerializing a managed dictionary
     after it was deleted.

   - gh-121795(2): Improve performance of set membership testing,
     ‘set.remove()’ and ‘set.discard()’ when the argument is a set.

   - gh-121814(3): Fixed the SegFault when *note PyEval_SetTrace(): 663.
     is used with no Python frame on stack.

   - gh-121295(4): Fix PyREPL console getting into a blocked state after
     interrupting a long paste

   - gh-121794(5): Fix bug in free-threaded Python where a resurrected
     object could lead to a negative ref count assertion failure.

   - gh-121657(6): Improve the *note SyntaxError: 18e. message if the
     user tries to use *note yield from: bc2. outside a function.

   - gh-121609(7): Fix pasting of characters containing unicode
     character joiners in the new REPL. Patch by Marta Gomez Macias

   - gh-121297(8): Previously, incorrect usage of *note await: 18d. or
     asynchronous comprehensions in code removed by the *note -O: 18c.
     option was not flagged by the Python compiler.  Now, such code
     raises *note SyntaxError: 18e.  Patch by Jelle Zijlstra.

   - gh-117482(9): Unexpected slot wrappers are no longer created for
     builtin static types in subinterpreters.

   - gh-121562(10): Optimized performance of hex_from_char by replacing
     switch-case with a lookup table

   - gh-121499(11): Fix a bug affecting how multi-line history was being
     rendered in the new REPL after interacting with the new screen
     cache.  Patch by Pablo Galindo

   - gh-121497(12): Fix a bug that was preventing the REPL to correctly
     respect the history when an input hook was set.  Patch by Pablo
     Galindo

   - gh-121012(13): Tier 2 execution now ensures that list iterators
     remain exhausted, once they become exhausted.

   - gh-121439(14): Allow tuples of length 20 in the freelist to be
     reused.

   - gh-121288(15): *note ValueError: 2ec. messages for *note
     list.index(): 15de, *note range.index(): 1978, ‘deque.index()’,
     ‘deque.remove()’ and ‘ShareableList.index()’ no longer contain the
     repr of the searched value (which can be arbitrary large) and are
     consistent with error messages for other *note index(): 1979. and
     *note remove(): 197a. methods.

   - gh-121368(16): Fix race condition in ‘_PyType_Lookup’ in the
     free-threaded build due to a missing memory fence.  This could lead
     to ‘_PyType_Lookup’ returning incorrect results on arm64.

   - gh-121149(17): Added specialization for summation of complexes,
     this also improves accuracy of builtin *note sum(): 695. for such
     inputs.  Patch by Sergey B Kirpichev.

   - gh-121130(18): Fix f-strings with debug expressions in format
     specifiers.  Patch by Pablo Galindo

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/121860

   (2) https://github.com/python/cpython/issues/121795

   (3) https://github.com/python/cpython/issues/121814

   (4) https://github.com/python/cpython/issues/121295

   (5) https://github.com/python/cpython/issues/121794

   (6) https://github.com/python/cpython/issues/121657

   (7) https://github.com/python/cpython/issues/121609

   (8) https://github.com/python/cpython/issues/121297

   (9) https://github.com/python/cpython/issues/117482

   (10) https://github.com/python/cpython/issues/121562

   (11) https://github.com/python/cpython/issues/121499

   (12) https://github.com/python/cpython/issues/121497

   (13) https://github.com/python/cpython/issues/121012

   (14) https://github.com/python/cpython/issues/121439

   (15) https://github.com/python/cpython/issues/121288

   (16) https://github.com/python/cpython/issues/121368

   (17) https://github.com/python/cpython/issues/121149

   (18) https://github.com/python/cpython/issues/121130


File: python.info,  Node: ライブラリ<50>,  Next: Core and Builtins<45>,  Prev: Core and Builtins<44>,  Up: Python 3 14 0 alpha 1

1.24.19.16 ライブラリ
.....................

   - gh-121381(1): Remove ‘subprocess._USE_VFORK’ escape hatch code and
     documentation.  It was added just in case, and doesn't have any
     known cases that require it.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/121381


File: python.info,  Node: Core and Builtins<45>,  Next: ライブラリ<51>,  Prev: ライブラリ<50>,  Up: Python 3 14 0 alpha 1

1.24.19.17 Core and Builtins
............................

   - gh-119726(1): Optimize code layout for calls to C functions from
     the JIT on AArch64.  Patch by Diego Russo.

   - gh-121115(2): *note PyLong_AsNativeBytes(): 606. no longer uses
     *note __index__(): 19e. methods by default.  The
     ‘Py_ASNATIVEBYTES_ALLOW_INDEX’ flag has been added to allow it.

   - gh-120838(3): *note Py_Finalize(): 45f. and *note Py_FinalizeEx():
     f11. now always run with the main interpreter active.

   - gh-113433(4): Subinterpreters now get cleaned up automatically
     during runtime finalization.

   - gh-119726(5): Improve the speed and memory use of C function calls
     from JIT code on AArch64.  Patch by Diego Russo

   - gh-116017(6): Simplify the warmup mechanism used for "side exits"
     in JIT code, resulting in slightly better performance and slightly
     lower memory usage for most platforms.

   - gh-98442(7): Fix too wide source locations of the cleanup
     instructions of a with statement.

   - gh-120754(8): Reduce the number of system calls invoked when
     reading a whole file (ex.  ‘open('a.txt').read()’).  For a sample
     program that reads the contents of the 400+ ‘.rst’ files in the
     cpython repository ‘Doc’ folder, there is an over 10% reduction in
     system call count.

   - gh-119462(9): Make sure that invariants of type versioning are
     maintained: * Superclasses always have their version number
     assigned before subclasses * The version tag is always zero if the
     tag is not valid.  * The version tag is always non-if the tag is
     valid.

   - gh-120437(10): Fix ‘_CHECK_STACK_SPACE’ optimization problems
     introduced in gh-118322(11).

   - gh-120722(12): Correctly set the bytecode position on return
     instructions within lambdas.  Patch by Jelle Zijlstra.

   - gh-120367(13): Fix bug where compiler creates a redundant jump
     during pseudo-op replacement.  Can only happen with a synthetic AST
     that has a try on the same line as the instruction following the
     exception handler.

   - gh-120507(14): Remove the ‘BEFORE_WITH’ and ‘BEFORE_ASYNC_WITH’
     instructions.  Add the new *note LOAD_SPECIAL: 36f. instruction.
     Generate code for ‘with’ and ‘async with’ statements using the new
     instruction.

   - gh-113993(15): Strings interned with *note sys.intern(): 14f3. are
     again garbage-collected when no longer used, as per the
     documentation.  Strings interned with the C function *note
     PyUnicode_InternInPlace(): aae. are still immortal.  Internals of
     the string interning mechanism have been changed.  This may affect
     performance and identities of *note str: 169. objects.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/119726

   (2) https://github.com/python/cpython/issues/121115

   (3) https://github.com/python/cpython/issues/120838

   (4) https://github.com/python/cpython/issues/113433

   (5) https://github.com/python/cpython/issues/119726

   (6) https://github.com/python/cpython/issues/116017

   (7) https://github.com/python/cpython/issues/98442

   (8) https://github.com/python/cpython/issues/120754

   (9) https://github.com/python/cpython/issues/119462

   (10) https://github.com/python/cpython/issues/120437

   (11) https://github.com/python/cpython/issues/118322

   (12) https://github.com/python/cpython/issues/120722

   (13) https://github.com/python/cpython/issues/120367

   (14) https://github.com/python/cpython/issues/120507

   (15) https://github.com/python/cpython/issues/113993


File: python.info,  Node: ライブラリ<51>,  Next: Core and Builtins<46>,  Prev: Core and Builtins<45>,  Up: Python 3 14 0 alpha 1

1.24.19.18 ライブラリ
.....................

   - gh-120485(1): Add an override of ‘allow_reuse_port’ on classes
     subclassing ‘socketserver.TCPServer’ where ‘allow_reuse_address’ is
     also overridden.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/120485


File: python.info,  Node: Core and Builtins<46>,  Next: ライブラリ<52>,  Prev: ライブラリ<51>,  Up: Python 3 14 0 alpha 1

1.24.19.19 Core and Builtins
............................

   - gh-120384(1): Fix an array out of bounds crash in
     ‘list_ass_subscript’, which could be invoked via some specifically
     tailored input: including concurrent modification of a list object,
     where one thread assigns a slice and another clears it.

   - gh-120367(2): Fix crash in compiler on code with redundant NOPs and
     JUMPs which show up after exception handlers are moved to the end
     of the code.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/120384

   (2) https://github.com/python/cpython/issues/120367


File: python.info,  Node: ライブラリ<52>,  Next: Core and Builtins<47>,  Prev: Core and Builtins<46>,  Up: Python 3 14 0 alpha 1

1.24.19.20 ライブラリ
.....................

   - gh-120380(1): Fix Python implementation of *note pickle.Pickler:
     c13. for *note bytes: 192. and *note bytearray: 344. objects when
     using protocol version 5.  Patch by Bénédikt Tran.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/120380


File: python.info,  Node: Core and Builtins<47>,  Next: ライブラリ<53>,  Prev: ライブラリ<52>,  Up: Python 3 14 0 alpha 1

1.24.19.21 Core and Builtins
............................

   - gh-120397(1): Improve the throughput by up to two times for the
     *note str.count(): 1981, *note bytes.count(): 1982. and *note
     bytearray.count(): 1794. methods for counting single characters.

   - gh-120221(2): Deliver real signals on Ctrl-C and Ctrl-Z in the new
     REPL. Patch by Pablo Galindo

   - gh-120346(3): Respect *note PYTHON_BASIC_REPL: 1b6. when running in
     interactive inspect mode (‘python -i’).  Patch by Pablo Galindo

   - gh-93691(4): Fix source locations of instructions generated for the
     iterator of a for statement.

   - gh-120198(5): Fix a crash when multiple threads read and write to
     the same ‘__class__’ of an object concurrently.

   - gh-120298(6): Fix use-after free in ‘list_richcompare_impl’ which
     can be invoked via some specifically tailored evil input.

   - gh-119666(7): Fix a compiler crash in the case where two
     comprehensions in class scope both reference ‘__class__’.

   - gh-119726(8): JIT: Re-use trampolines on AArch64 when creating
     stencils.  Patch by Diego Russo

   - gh-120225(9): Fix crash in compiler on empty block at end of
     exception handler.

   - gh-93691(10): Fix source locations of instructions generated for
     with statements.

   - gh-120097(11): ‘FrameLocalsProxy’ now subclasses
     ‘collections.abc.Mapping’ and can be matched as a mapping in
     ‘match’ statements

   - gh-120080(12): Direct call to the ‘int.__round__()’ now accepts
     ‘None’ as a valid argument.

   - gh-119933(13): Improve *note SyntaxError: 18e. messages for invalid
     expressions in a type parameters bound, a type parameter constraint
     tuple or a default type parameter.  Patch by Bénédikt Tran.

   - gh-119724(14): Reverted improvements to error messages for
     ‘elif’/‘else’ statements not matching any valid statements, which
     made in hard to locate the syntax errors inside those ‘elif’/‘else’
     blocks.

   - gh-119879(15): String search is now slightly faster for certain
     cases.  It now utilizes last character gap (good suffix rule) for
     two-way periodic needles.

   - gh-119842(16): Honor *note PyOS_InputHook(): 7a4. in the new REPL.
     Patch by Pablo Galindo

   - gh-119180(17): *note classmethod(): 48e. and *note staticmethod():
     453. now wrap the *note __annotations__: 458. and *note
     __annotate__: 1983. attributes of their underlying callable lazily.
     See PEP 649(18).  Patch by Jelle Zijlstra.

   - gh-119821(19): Fix execution of *note annotation scopes: 4ab.
     within classes when ‘globals’ is set to a non-dict.  Patch by Jelle
     Zijlstra.

   - gh-118934(20): Make ‘PyEval_GetLocals’ return borrowed reference

   - gh-119740(21): Remove the previously-deprecated delegation of *note
     int(): 19b. to *note __trunc__(): 19c.

   - gh-119689(22): Generate stack effect metadata for pseudo
     instructions from bytecodes.c.

   - gh-109218(23): *note complex(): 197. accepts now a string only as a
     positional argument.  Passing a complex number as the "real" or
     "imag" argument is deprecated; it should only be passed as a single
     positional argument.

   - gh-119548(24): Add a ‘clear’ command to the REPL. Patch by Pablo
     Galindo

   - gh-111999(25): Fix the signature of *note str.format_map(): fd7.

   - gh-119560(26): An invalid assert in beta 1 has been removed.  The
     assert would fail if ‘PyState_FindModule()’ was used in an
     extension module's init function before the module def had been
     initialized.

   - gh-119369(27): Fix deadlock during thread deletion in free-threaded
     build, which could occur when the GIL was enabled at runtime.

   - gh-119525(28): Fix deadlock involving ‘_PyType_Lookup()’ cache in
     the free-threaded build when the GIL is dynamically enabled at
     runtime.

   - gh-119258(29): Eliminate type version guards in the tier two
     interpreter.

     Note that setting the ‘tp_version_tag’ manually (which has never
     been supported) may result in crashes.

   - gh-119311(30): Fix bug where names are unexpectedly mangled in the
     bases of generic classes.

   - gh-119395(31): Fix bug where names appearing after a generic class
     are mangled as if they are in the generic class.

   - gh-119372(32): Correct invalid corner cases in complex division
     (resulted in ‘(nan+nanj)’ output), e.g.  ‘1/complex('(inf+infj)')’.
     Patch by Sergey B Kirpichev.

   - gh-119180(33): Evaluation of annotations is now deferred.  See PEP
     649(34) for details.

   - gh-119180(35): Replace ‘LOAD_ASSERTION_ERROR’ opcode with *note
     LOAD_COMMON_CONSTANT: 36a. and add support for *note
     NotImplementedError: 36b.

   - gh-119213(36): Non-builtin modules built with argument clinic were
     crashing if used in a subinterpreter before the main interpreter.
     The objects that were causing the problem by leaking between
     interpreters carelessly have been fixed.

   - gh-119011(37): Fixes ‘type.__type_params__’ to return an empty
     tuple instead of a descriptor.

   - gh-118692(38): Avoid creating unnecessary *note StopIteration: df5.
     instances for monitoring.

   - gh-119180(39): Add an ‘__annotate__’ attribute to functions,
     classes, and modules as part of PEP 649(40).  Patch by Jelle
     Zijlstra.

   - gh-119049(41): Fix displaying the source line for warnings created
     by the C API if the *note warnings: 118. module had not yet been
     imported.

   - gh-119057(42): Improve *note ZeroDivisionError: b3f. error message.
     Now, all error messages are harmonized: all ‘/’, ‘//’, and ‘%’
     operations just use "division by zero" message.  And ‘0 ** -1’
     operation uses "zero to a negative power".

   - gh-118844(43): Fix build failures when configuring with both
     ‘--disable-gil’ and ‘--enable-experimental-jit’.

   - gh-118921(44): Add ‘copy()’ method for ‘FrameLocalsProxy’ which
     returns a snapshot ‘dict’ for local variables.

   - gh-117657(45): Fix data races on the field that stores a pointer to
     the interpreter's main thread that occur in free-threaded builds.

   - gh-118750(46): If the C version of the ‘decimal’ module is
     available, ‘int(str)’ now uses it to supply an asymptotically much
     faster conversion.  However, this only applies if the string
     contains over about 2 million digits.

   - gh-118767(47): Using *note NotImplemented: 1a2. in a boolean
     context now raises *note TypeError: 198.  Contributed by Jelle
     Zijlstra.

   - gh-118561(48): Fix race condition in free-threaded build where
     *note list.extend(): 602. could expose uninitialised memory to
     concurrent readers.

   - gh-117139(49): Convert the Python evaluation stack to use internal
     stack references.  The purpose is to support tagged pointers.  In
     PEP 703(50), this will allow for its form of deferred reference
     counting.  For both the default and free-threaded builds, this sets
     up the infrastructure for unboxed integers in the future.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/120397

   (2) https://github.com/python/cpython/issues/120221

   (3) https://github.com/python/cpython/issues/120346

   (4) https://github.com/python/cpython/issues/93691

   (5) https://github.com/python/cpython/issues/120198

   (6) https://github.com/python/cpython/issues/120298

   (7) https://github.com/python/cpython/issues/119666

   (8) https://github.com/python/cpython/issues/119726

   (9) https://github.com/python/cpython/issues/120225

   (10) https://github.com/python/cpython/issues/93691

   (11) https://github.com/python/cpython/issues/120097

   (12) https://github.com/python/cpython/issues/120080

   (13) https://github.com/python/cpython/issues/119933

   (14) https://github.com/python/cpython/issues/119724

   (15) https://github.com/python/cpython/issues/119879

   (16) https://github.com/python/cpython/issues/119842

   (17) https://github.com/python/cpython/issues/119180

   (18) https://peps.python.org/pep-0649/

   (19) https://github.com/python/cpython/issues/119821

   (20) https://github.com/python/cpython/issues/118934

   (21) https://github.com/python/cpython/issues/119740

   (22) https://github.com/python/cpython/issues/119689

   (23) https://github.com/python/cpython/issues/109218

   (24) https://github.com/python/cpython/issues/119548

   (25) https://github.com/python/cpython/issues/111999

   (26) https://github.com/python/cpython/issues/119560

   (27) https://github.com/python/cpython/issues/119369

   (28) https://github.com/python/cpython/issues/119525

   (29) https://github.com/python/cpython/issues/119258

   (30) https://github.com/python/cpython/issues/119311

   (31) https://github.com/python/cpython/issues/119395

   (32) https://github.com/python/cpython/issues/119372

   (33) https://github.com/python/cpython/issues/119180

   (34) https://peps.python.org/pep-0649/

   (35) https://github.com/python/cpython/issues/119180

   (36) https://github.com/python/cpython/issues/119213

   (37) https://github.com/python/cpython/issues/119011

   (38) https://github.com/python/cpython/issues/118692

   (39) https://github.com/python/cpython/issues/119180

   (40) https://peps.python.org/pep-0649/

   (41) https://github.com/python/cpython/issues/119049

   (42) https://github.com/python/cpython/issues/119057

   (43) https://github.com/python/cpython/issues/118844

   (44) https://github.com/python/cpython/issues/118921

   (45) https://github.com/python/cpython/issues/117657

   (46) https://github.com/python/cpython/issues/118750

   (47) https://github.com/python/cpython/issues/118767

   (48) https://github.com/python/cpython/issues/118561

   (49) https://github.com/python/cpython/issues/117139

   (50) https://peps.python.org/pep-0703/


File: python.info,  Node: ライブラリ<53>,  Next: Core and Builtins<48>,  Prev: Core and Builtins<47>,  Up: Python 3 14 0 alpha 1

1.24.19.22 ライブラリ
.....................

   - gh-115801(1): Raise ‘TypeError’ when passing a string to *note
     difflib.unified_diff(): 1985. and *note difflib.context_diff():
     1986.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115801


File: python.info,  Node: Core and Builtins<48>,  Next: C API<15>,  Prev: ライブラリ<53>,  Up: Python 3 14 0 alpha 1

1.24.19.23 Core and Builtins
............................

   - gh-117558(1): Improve error messages when a string, bytes or
     bytearray object of length 1 is expected.

   - gh-117195(2): Avoid assertion failure for debug builds when calling
     ‘object.__sizeof__(1)’

   - gh-116022(3): Improve the *note __repr__(): 82f. output of *note
     AST: 4c3. nodes.

   - gh-114091(4): Changed the error message for awaiting something that
     can't be awaited from "object <type> can't be used in an await
     expression" to "'<type>' object can't be awaited".

   - gh-113190(5): *note Py_Finalize(): 45f. now deletes all interned
     strings.

   - gh-84978(6): Add class methods *note float.from_number(): 194. and
     *note complex.from_number(): 195.

   - gh-95144(7): Improve the error message from ‘a in b’ when ‘b’ is
     not a container to mention the term "container".

   - bpo-24766(8): Fix handling of ‘doc’ argument to subclasses of
     ‘property’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/117558

   (2) https://github.com/python/cpython/issues/117195

   (3) https://github.com/python/cpython/issues/116022

   (4) https://github.com/python/cpython/issues/114091

   (5) https://github.com/python/cpython/issues/113190

   (6) https://github.com/python/cpython/issues/84978

   (7) https://github.com/python/cpython/issues/95144

   (8) https://bugs.python.org/issue?@action=redirect&bpo=24766


File: python.info,  Node: C API<15>,  Next: ビルド<15>,  Prev: Core and Builtins<48>,  Up: Python 3 14 0 alpha 1

1.24.19.24 C API
................

   - gh-123961(1): Convert the *note curses.window: 1989. static type
     exposed by the ‘PyCursesWindow_Type’ macro in ‘Include/py_curses.h’
     to a *note heap type: b5e.  Patch by Bénédikt Tran.

   - gh-124502(2): Add *note PyUnicode_Equal(): 3b2. function to the
     limited C API: test if two strings are equal.  Patch by Victor
     Stinner.

   - gh-124296(3): *note PyDictObject: 64f. no longer maintains a
     private version tag field ‘ma_version_tag’ per PEP 699(4).  This
     field was originally added in Python 3.6 ( PEP 509(5)) and
     deprecated in Python 3.12.

   - gh-124160(6): Fix crash when importing modules containing state and
     single-phase initialization in a subinterpreter.

   - gh-124153(7): Add *note PyType_GetBaseByToken(): 3b0. and *note
     Py_tp_token: 3b1. slot for easier type checking, related to PEP
     489(8) and PEP 630(9).

   - gh-124127(10): In the limited C API 3.14 and newer, *note
     Py_REFCNT(): 2cf. is now implemented as an opaque function call to
     hide implementation details.  Patch by Victor Stinner.

   - gh-123880(11): Fixed a bug that prevented circular imports of
     extension modules that use single-phase initialization.

   - gh-123909(12): *note PyType_FromSpec(): 79d, *note
     PyType_FromSpecWithBases(): 79e. and *note
     PyType_FromModuleAndSpec(): 773. will now fail if the metaclass of
     the new type has custom *note tp_new: 79f.

   - gh-107954(13): Add functions to configure the Python initialization
     ( PEP 741(14)):

        * *note PyInitConfig_Create(): 387.

        * *note PyInitConfig_Free(): 388.

        * *note PyInitConfig_GetError(): 38a.

        * *note PyInitConfig_GetExitCode(): 38b.

        * *note PyInitConfig_HasOption(): 38f.

        * *note PyInitConfig_GetInt(): 38c.

        * *note PyInitConfig_GetStr(): 38d.

        * *note PyInitConfig_GetStrList(): 38e.

        * *note PyInitConfig_FreeStrList(): 389.

        * *note PyInitConfig_SetInt(): 390.

        * *note PyInitConfig_SetStr(): 391.

        * *note PyInitConfig_SetStrList(): 392.

        * *note PyInitConfig_AddModule(): 37b.

        * *note Py_InitializeFromInitConfig(): 386.

     Patch by Victor Stinner.

   - gh-107954(15): Add functions to get and set the current runtime
     Python configuration:

        * *note PyConfig_Get(): 37c.

        * *note PyConfig_GetInt(): 384.

        * *note PyConfig_Set(): 37d.

        * *note PyConfig_Names(): 385.

     Patch by Victor Stinner.

   - gh-123465(16): *note Py_RELATIVE_OFFSET: 770. is now allowed in
     *note PyMemberDef: 771. for the special offset member
     ‘"__vectorcalloffset__"’, as well as the discouraged special offset
     members ‘"__dictoffset__"’ and ‘"__weaklistoffset__"’

   - gh-100554(17): Added a slot ‘Py_tp_vectorcall’ to set *note
     tp_vectorcall: 198a. via the *note PyType_FromSpec(): 79d. function
     family.  Limited API extensions can use this feature to provide
     more efficient vector call-based implementation of ‘__new__’ and
     ‘__init__’.

   - gh-122854(18): Add *note Py_HashBuffer(): 395. to compute and
     return the hash value of a buffer.  Patch by Antoine Pitrou and
     Victor Stinner.

   - gh-122728(19): Fix *note PyEval_GetLocals(): 5f8. to avoid *note
     SystemError: 795. ("bad argument to internal function").  Patch by
     Victor Stinner.

   - gh-116622(20): Make *note PyObject_Print: 198b. work around a bug
     in Android and OpenBSD which prevented it from throwing an
     exception when trying to write to a read-only stream.

   - gh-105201(21): Add *note PyIter_NextItem(): 398. to replace *note
     PyIter_Next(): 399, which has an ambiguous return value.  Patch by
     Irit Katriel and Erlend Aasland.

   - gh-121489(22): Export private ‘_PyBytes_Join()’ again.

   - gh-121645(23): Add *note PyBytes_Join(sep, iterable): 383.
     function, similar to ‘sep.join(iterable)’ in Python.  Patch by
     Victor Stinner.

   - gh-89364(24): Export the *note PySignal_SetWakeupFd(): 15f4.
     function.  Previously, the function was documented but it couldn't
     be used in 3rd party code.  Patch by Victor Stinner.

   - gh-113993(25): *note PyUnicode_InternInPlace(): aae. no longer
     prevents its argument from being garbage collected.

     Several functions that take ‘char *’ are now documented as possibly
     preventing string objects from being garbage collected; refer to
     their documentation for details: *note
     PyUnicode_InternFromString(): 198c, *note PyDict_SetItemString():
     198d, *note PyObject_SetAttrString(): 198e, *note
     PyObject_DelAttrString(): 1832, *note PyUnicode_InternFromString():
     198c, and ‘PyModule_Add*’ convenience functions.

   - gh-113601(26): Removed debug build assertions related to interning
     strings, which were falsely triggered by stable ABI extensions.

   - gh-112136(27): Restore the private ‘_PyArg_Parser’ structure and
     the private ‘_PyArg_ParseTupleAndKeywordsFast()’ function,
     previously removed in Python 3.13 alpha 1.  Patch by Victor
     Stinner.

   - gh-120642(28): Remove the private ‘_Py_CODEUNIT’ type from the
     public C API. The internal ‘pycore_code.h’ header should now be
     used to get this internal type.  Patch by Victor Stinner.

   - gh-120858(29): *note PyDict_Next(): 198f. no longer locks the
     dictionary in the free-threaded build.  The locking needs to be
     done by the caller around the entire iteration loop.

   - gh-120642(30): Remove the following unstable functions:

        * ‘PyUnstable_Replace_Executor()’

        * ‘PyUnstable_SetOptimizer()’

        * ‘PyUnstable_GetOptimizer()’

        * ‘PyUnstable_GetExecutor()’

        * ‘PyUnstable_Optimizer_NewCounter()’

        * ‘PyUnstable_Optimizer_NewUOpOptimizer()’

     Patch by Victor Stinner.

   - gh-120389(31): Add new functions to convert C ‘<stdint.h>’ numbers
     from/to Python *note int: 19b.:

        * *note PyLong_FromInt32(): 3a3.

        * *note PyLong_FromUInt32(): 3a5.

        * *note PyLong_FromInt64(): 3a4.

        * *note PyLong_FromUInt64(): 3a6.

        * *note PyLong_AsInt32(): 39f.

        * *note PyLong_AsUInt32(): 3a1.

        * *note PyLong_AsInt64(): 3a0.

        * *note PyLong_AsUInt64(): 3a2.

     Patch by Victor Stinner.

   - gh-120600(32): In the limited C API 3.14 and newer, *note
     Py_TYPE(): 3c9. is now implemented as an opaque function call to
     hide implementation details.  Patch by Victor Stinner.

   - gh-70278(33): *note PyUnicode_FromFormat(): 62b. no longer produces
     the ending ‘\ufffd’ character for truncated C string when use
     precision with ‘%s’ and ‘%V’.  It now truncates the string before
     the start of truncated multibyte sequences.

   - gh-119771(34): Set *note errno: 5b. in *note _Py_c_pow(): 18f2. on
     overflows.  Patch by Sergey B Kirpichev.

   - gh-119182(35): Add a new *note PyUnicodeWriter: 3b3. API to create
     a Python *note str: 169. object:

        * *note PyUnicodeWriter_Create(): 3b4.

        * *note PyUnicodeWriter_Discard(): 3b6.

        * *note PyUnicodeWriter_Finish(): 3b7.

        * *note PyUnicodeWriter_WriteChar(): 3ba.

        * *note PyUnicodeWriter_WriteUTF8(): 3bf.

        * *note PyUnicodeWriter_WriteUCS4(): 3be.

        * *note PyUnicodeWriter_WriteWideChar(): 3c0.

        * *note PyUnicodeWriter_WriteStr(): 3bc.

        * *note PyUnicodeWriter_WriteRepr(): 3bb.

        * *note PyUnicodeWriter_WriteSubstring(): 3bd.

        * *note PyUnicodeWriter_Format(): 3b8.

        * *note PyUnicodeWriter_DecodeUTF8Stateful(): 3b5.

     Patch by Victor Stinner.

   - gh-119613(36): Soft deprecate the *note Py_MEMCPY: 1990. macro: use
     directly ‘memcpy()’ instead.  Patch by Victor Stinner.

   - gh-119775(37): Creating *note immutable types: 3cf. with mutable
     bases was deprecated since 3.12 and now raises a *note TypeError:
     198.

   - gh-119585(38): Fix crash when a thread state that was created by
     *note PyGILState_Ensure(): 64a. calls a destructor that during
     *note PyThreadState_Clear(): 1991. that calls back into *note
     PyGILState_Ensure(): 64a. and *note PyGILState_Release(): 64b.
     This might occur when in the free-threaded build or when using
     thread-local variables whose destructors call *note
     PyGILState_Ensure(): 64a.

   - gh-119613(39): Macros ‘Py_IS_NAN’, ‘Py_IS_INFINITY’ and
     ‘Py_IS_FINITE’ are *note soft deprecated: 23d.

   - gh-119336(40): Restore the removed ‘_PyLong_NumBits()’ function.
     It is used by the pywin32 project.  Patch by Ethan Smith

   - gh-119344(41): The critical section API is now public as part of
     the non-limited C API.

   - gh-119333(42): Add *note PyContext_AddWatcher(): 1992. and *note
     PyContext_ClearWatcher(): 1993. APIs to register callbacks to
     receive notification on enter and exit of context objects.

   - gh-119247(43): Added ‘Py_BEGIN_CRITICAL_SECTION_SEQUENCE_FAST’ and
     ‘Py_END_CRITICAL_SECTION_SEQUENCE_FAST’ macros to make it possible
     to use PySequence_Fast APIs safely when free-threaded, and update
     str.join to work without the GIL using them.

   - gh-111389(44): Add *note PyHASH_MULTIPLIER: 1994. constant: prime
     multiplier used in string and various other hashes.  Patch by
     Victor Stinner.

   - gh-118771(45): Several C declarations with names that didn't start
     with the ‘Py’ or ‘_Py’ prefixes, which were added by mistake in
     3.13 alpha and beta releases, were moved to internal headers.

   - gh-116984(46): Make mimalloc includes relative to the current file
     to avoid embedders or extensions needing to include
     ‘Internal/mimalloc’ if they are already including internal CPython
     headers.

   - gh-118789(47): Add *note
     PyUnstable_Object_ClearWeakRefsNoCallbacks(): 1995, which clears
     weakrefs without calling their callbacks.

   - gh-118789(48): Restore ‘_PyWeakref_ClearRef’ that was previously
     removed in Python 3.13 alpha 1.

   - gh-117511(49): Make the *note PyMutex: 484. public in the
     non-limited C API.

   - gh-116560(50): Add *note PyLong_GetSign(): 39a. function.  Patch by
     Sergey B Kirpichev.

   - gh-97588(51): Fix creating bitfields in *note ctypes: 2e.
     structures and unions.  Fields no longer overlap.

   - gh-87135(52): Attempting to acquire the GIL after runtime
     finalization has begun in a different thread now causes the thread
     to hang rather than terminate, which avoids potential crashes or
     memory corruption caused by attempting to terminate a thread that
     is running code not specifically designed to support termination.
     In most cases this hanging is harmless since the process will soon
     exit anyway.

     The ‘PyThread_exit_thread’ function is now deprecated.  Its
     behavior is inconsistent across platforms, and it can only be used
     safely in the unlikely case that every function in the entire call
     stack has been designed to support the platform-dependent
     termination mechanism.  It is recommended that users of this
     function change their design to not require thread termination.  In
     the unlikely case that thread termination is needed and can be done
     safely, users may migrate to calling platform-specific APIs such as
     ‘pthread_exit’ (POSIX) or ‘_endthreadex’ (Windows) directly.

   - bpo-34008(53): Added ‘Py_IsInitialized’ to the list of APIs that
     are safe to call before the interpreter is initialized, and updated
     the embedding tests to cover it.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/123961

   (2) https://github.com/python/cpython/issues/124502

   (3) https://github.com/python/cpython/issues/124296

   (4) https://peps.python.org/pep-0699/

   (5) https://peps.python.org/pep-0509/

   (6) https://github.com/python/cpython/issues/124160

   (7) https://github.com/python/cpython/issues/124153

   (8) https://peps.python.org/pep-0489/

   (9) https://peps.python.org/pep-0630/

   (10) https://github.com/python/cpython/issues/124127

   (11) https://github.com/python/cpython/issues/123880

   (12) https://github.com/python/cpython/issues/123909

   (13) https://github.com/python/cpython/issues/107954

   (14) https://peps.python.org/pep-0741/

   (15) https://github.com/python/cpython/issues/107954

   (16) https://github.com/python/cpython/issues/123465

   (17) https://github.com/python/cpython/issues/100554

   (18) https://github.com/python/cpython/issues/122854

   (19) https://github.com/python/cpython/issues/122728

   (20) https://github.com/python/cpython/issues/116622

   (21) https://github.com/python/cpython/issues/105201

   (22) https://github.com/python/cpython/issues/121489

   (23) https://github.com/python/cpython/issues/121645

   (24) https://github.com/python/cpython/issues/89364

   (25) https://github.com/python/cpython/issues/113993

   (26) https://github.com/python/cpython/issues/113601

   (27) https://github.com/python/cpython/issues/112136

   (28) https://github.com/python/cpython/issues/120642

   (29) https://github.com/python/cpython/issues/120858

   (30) https://github.com/python/cpython/issues/120642

   (31) https://github.com/python/cpython/issues/120389

   (32) https://github.com/python/cpython/issues/120600

   (33) https://github.com/python/cpython/issues/70278

   (34) https://github.com/python/cpython/issues/119771

   (35) https://github.com/python/cpython/issues/119182

   (36) https://github.com/python/cpython/issues/119613

   (37) https://github.com/python/cpython/issues/119775

   (38) https://github.com/python/cpython/issues/119585

   (39) https://github.com/python/cpython/issues/119613

   (40) https://github.com/python/cpython/issues/119336

   (41) https://github.com/python/cpython/issues/119344

   (42) https://github.com/python/cpython/issues/119333

   (43) https://github.com/python/cpython/issues/119247

   (44) https://github.com/python/cpython/issues/111389

   (45) https://github.com/python/cpython/issues/118771

   (46) https://github.com/python/cpython/issues/116984

   (47) https://github.com/python/cpython/issues/118789

   (48) https://github.com/python/cpython/issues/118789

   (49) https://github.com/python/cpython/issues/117511

   (50) https://github.com/python/cpython/issues/116560

   (51) https://github.com/python/cpython/issues/97588

   (52) https://github.com/python/cpython/issues/87135

   (53) https://bugs.python.org/issue?@action=redirect&bpo=34008


File: python.info,  Node: ビルド<15>,  Prev: C API<15>,  Up: Python 3 14 0 alpha 1

1.24.19.25 ビルド
.................

   - gh-125269(1): Fix detection of whether ‘-latomic’ is needed when
     cross-compiling CPython using the configure script.

   - gh-123990(2): Remove ‘WITH_FREELISTS’ macro and
     ‘--without-freelists’ build configuration

   - gh-124102(3): Update internal documentation under PCbuild, so it
     now correctly states that Windows requires VS2017 or later and
     Python 3.10 or later

   - gh-124043(4): Building using *note -with-trace-refs: 636. is
     (temporarily) disallowed when the GIL is disabled.

   - gh-123418(5): Updated Android build to use OpenSSL 3.0.15.

   - gh-123297(6): Propagate the value of ‘LDFLAGS’ to ‘LDCXXSHARED’ in
     *note sysconfig: e1.  Patch by Pablo Galindo

   - gh-121634(7): Allow for specifying the target compile triple for
     WASI.

   - gh-122578(8): Use WASI SDK 24 for testing.

   - gh-116622(9): Rename build variable ‘MODULE_LDFLAGS’ back to
     ‘LIBPYTHON’, as it's used by package build systems (e.g.  Meson).

   - gh-118943(10): Fix an issue where the experimental JIT could be
     built several times by the ‘make regen-all’ target, leading to
     possible race conditions on heavily parallelized builds.

   - gh-121996(11): Introduce ./configure -disable-safety and
     -enable-slower-safety options.  Patch by Donghee Na.

   - gh-120522(12): Added a *note -with-app-store-compliance: 1997.
     option to patch out known issues with macOS/iOS App Store review
     processes.

   - gh-120371(13): Support WASI SDK 22 by explicitly skipping functions
     that are just stubs in wasi-libc.

   - gh-121731(14): Fix mimalloc compile error on GNU/Hurd

   - gh-121487(15): Fix deprecation warning for ATOMIC_VAR_INIT in
     mimalloc.

   - gh-121467(16): Fix a Makefile bug that prevented mimalloc header
     files from being installed.

   - gh-121103(17): On POSIX systems, excluding macOS framework
     installs, the lib directory for the free-threaded build now
     includes a "t" suffix to avoid conflicts with a co-located default
     build installation.

   - gh-120831(18): The default minimum iOS version was increased to
     13.0.

   - gh-121082(19): Fix build failure when the developer use
     ‘--enable-pystats’ arguments in configuration command after
     #118450.

   - gh-120671(20): Fix failing configure tests due to a missing space
     when appending to CFLAGS.

   - gh-120602(21): Correctly handle LLVM installs with
     ‘LLVM_VERSION_SUFFIX’ when building with
     ‘--enable-experimental-jit’.

   - gh-120688(22): On WASI in debug mode, Python is now built with
     compiler flag ‘-O3’ instead of ‘-Og’, to support more recursive
     calls.  Patch by Victor Stinner.

   - gh-118943(23): Fix a possible race condition affecting parallel
     builds configured with ‘--enable-experimental-jit’, in which *note
     FileNotFoundError: 264. could be caused by another process already
     moving ‘jit_stencils.h.new’ to ‘jit_stencils.h’.

   - gh-120326(24): On Windows, fix build error when ‘--disable-gil’ and
     ‘--experimental-jit’ options are combined.

   - gh-120291(25): Make the ‘python-config’ shell script compatible
     with non-bash shells.

   - gh-113565(26): Improve *note curses: 2f. and *note curses.panel:
     31. dependency checks in ‘configure’.

   - gh-119729(27): On POSIX systems, the pkg-config (‘.pc’) filenames
     now include the ABI flags, which may include debug ("d") and
     free-threaded ("t").  For example: * ‘python-3.14.pc’ (default,
     non-debug build) * ‘python-3.14d.pc’ (default, debug build) *
     ‘python-3.14t.pc’ (free-threaded build)

   - gh-119400(28): ‘make_ssl_certs’, the script that prepares
     certificate data for the test suite, now allows specifying
     expiration dates.

   - gh-115119(29): Fall back to the bundled libmpdec if a system
     version cannot be found.

   - gh-119132(30): Update *note sys.version: 49c. to identify whether
     the build is default build or free-threading build.  Patch By
     Donghee Na.

   - gh-118836(31): Fix an ‘AssertionError’ when building with
     ‘--enable-experimental-jit’ and the compiler emits a ‘SHT_NOTE’
     section.

   - gh-118943(32): Fix a possible race condition affecting parallel
     builds configured with ‘--enable-experimental-jit’, in which
     compilation errors could be caused by an incompletely-generated
     header file.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/125269

   (2) https://github.com/python/cpython/issues/123990

   (3) https://github.com/python/cpython/issues/124102

   (4) https://github.com/python/cpython/issues/124043

   (5) https://github.com/python/cpython/issues/123418

   (6) https://github.com/python/cpython/issues/123297

   (7) https://github.com/python/cpython/issues/121634

   (8) https://github.com/python/cpython/issues/122578

   (9) https://github.com/python/cpython/issues/116622

   (10) https://github.com/python/cpython/issues/118943

   (11) https://github.com/python/cpython/issues/121996

   (12) https://github.com/python/cpython/issues/120522

   (13) https://github.com/python/cpython/issues/120371

   (14) https://github.com/python/cpython/issues/121731

   (15) https://github.com/python/cpython/issues/121487

   (16) https://github.com/python/cpython/issues/121467

   (17) https://github.com/python/cpython/issues/121103

   (18) https://github.com/python/cpython/issues/120831

   (19) https://github.com/python/cpython/issues/121082

   (20) https://github.com/python/cpython/issues/120671

   (21) https://github.com/python/cpython/issues/120602

   (22) https://github.com/python/cpython/issues/120688

   (23) https://github.com/python/cpython/issues/118943

   (24) https://github.com/python/cpython/issues/120326

   (25) https://github.com/python/cpython/issues/120291

   (26) https://github.com/python/cpython/issues/113565

   (27) https://github.com/python/cpython/issues/119729

   (28) https://github.com/python/cpython/issues/119400

   (29) https://github.com/python/cpython/issues/115119

   (30) https://github.com/python/cpython/issues/119132

   (31) https://github.com/python/cpython/issues/118836

   (32) https://github.com/python/cpython/issues/118943


File: python.info,  Node: Python 3 13 0 beta 1,  Next: Python 3 13 0 alpha 6,  Prev: Python 3 14 0 alpha 1,  Up: 変更履歴

1.24.20 Python 3.13.0 beta 1
----------------------------

'Release date: 2024-05-08'

* Menu:

* セキュリティ: セキュリティ<17>.
* Core and Builtins: Core and Builtins<49>.
* ライブラリ: ライブラリ<54>.
* Core and Builtins: Core and Builtins<50>.
* ライブラリ: ライブラリ<55>.
* ドキュメント: ドキュメント<15>.
* ビルド: ビルド<16>.
* Windows: Windows<15>.
* macOS: macOS<9>.
* IDLE: IDLE<8>.
* C API: C API<16>.


File: python.info,  Node: セキュリティ<17>,  Next: Core and Builtins<49>,  Up: Python 3 13 0 beta 1

1.24.20.1 セキュリティ
......................

   - gh-116741(1): Update bundled libexpat to 2.6.2

   - gh-117233(2): Detect BLAKE2, SHA3, Shake, & truncated SHA512
     support in the OpenSSL-ish libcrypto library at build time.  This
     allows *note hashlib: 6c. to be used with libraries that do not to
     support every algorithm that upstream OpenSSL does.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116741

   (2) https://github.com/python/cpython/issues/117233


File: python.info,  Node: Core and Builtins<49>,  Next: ライブラリ<54>,  Prev: セキュリティ<17>,  Up: Python 3 13 0 beta 1

1.24.20.2 Core and Builtins
...........................

   - gh-118414(1): Add instrumented opcodes to YIELD_VALUE assertion for
     tracing cases.

   - gh-117953(2): When a builtin or extension module is imported for
     the first time, while a subinterpreter is active, the module's init
     function is now run by the main interpreter first before import
     continues in the subinterpreter.  Consequently, single-phase init
     modules now fail in an isolated subinterpreter without the init
     function running under that interpreter, whereas before it would
     run under the subinterpreter 'before' failing, potentially leaving
     behind global state and callbacks and otherwise leaving the module
     in an inconsistent state.

   - gh-117549(3): Don't use designated initializer syntax in inline
     functions in internal headers.  They cause problems for C++ or MSVC
     users who aren't yet using the latest C++ standard (C++20).  While
     internal, pycore_backoff.h, is included (indirectly, via
     pycore_code.h) by some key 3rd party software that does so for
     speed.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118414

   (2) https://github.com/python/cpython/issues/117953

   (3) https://github.com/python/cpython/issues/117549


File: python.info,  Node: ライブラリ<54>,  Next: Core and Builtins<50>,  Prev: Core and Builtins<49>,  Up: Python 3 13 0 beta 1

1.24.20.3 ライブラリ
....................

   - gh-95382(1): Improve performance of *note json.dumps(): f41. and
     *note json.dump(): f40. when using the argument 'indent'.
     Depending on the data the encoding using *note json.dumps(): f41.
     with 'indent' can be up to 2 to 3 times faster.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/95382


File: python.info,  Node: Core and Builtins<50>,  Next: ライブラリ<55>,  Prev: ライブラリ<54>,  Up: Python 3 13 0 beta 1

1.24.20.4 Core and Builtins
...........................

   - gh-116322(1): In ‘--disable-gil’ builds, the GIL will be enabled
     while loading C extension modules.  If the module indicates that it
     supports running without the GIL, the GIL will be disabled once
     loading is complete.  Otherwise, the GIL will remain enabled for
     the remainder of the interpreter's lifetime.  This behavior does
     not apply if the GIL has been explicitly enabled or disabled with
     ‘PYTHON_GIL’ or ‘-Xgil’.

   - gh-118513(2): Fix incorrect *note UnboundLocalError: 174f. when two
     comprehensions in the same function both reference the same name,
     and in one comprehension the name is bound while in the other it's
     an implicit global.

   - gh-118518(3): Allow the Linux perf support to work without frame
     pointers using perf's advanced JIT support.  The feature is
     activated when using the ‘PYTHON_PERF_JIT_SUPPORT’ environment
     variable or when running Python with ‘-Xperf_jit’.  Patch by Pablo
     Galindo.

   - gh-117514(4): Add ‘sys._is_gil_enabled()’ function that returns
     whether the GIL is currently enabled.  In the default build it
     always returns ‘True’ because the GIL is always enabled.  In the
     free-threaded build, it may return ‘True’ or ‘False’.

   - gh-118164(5): Break a loop between the Python implementation of the
     *note decimal: 3a. module and the Python code for integer to string
     conversion.  Also optimize integer to string conversion for values
     in the range from 9_000 to 135_000 decimal digits.

   - gh-118473(6): Fix *note sys.set_asyncgen_hooks(): 199d. not to be
     partially set when raising *note TypeError: 198.

   - gh-118465(7): Compiler populates the new ‘__firstlineno__’ field on
     a class with the line number of the first line of the class
     definition.

   - gh-118492(8): Fix an issue where the type cache can expose a
     previously accessed attribute when a finalizer is run.

   - gh-117714(9): update ‘async_generator.athrow().close()’ and
     ‘async_generator.asend().close()’ to close their section of the
     underlying async generator

   - gh-111201(10): The *note interactive: 1b5. interpreter is now
     implemented in Python, which allows for a number of new features
     like colors, multiline input, history viewing, and paste mode.
     Contributed by Pablo Galindo, Łukasz Langa and Lysandros Nikolaou
     based on code from the PyPy project.

   - gh-74929(11): Implement PEP 667: converted *note
     FrameType.f_locals: 4a5. and *note PyFrame_GetLocals(): 661. to
     return a write-through proxy object when the frame refers to a
     function or comprehension.

   - gh-116767(12): Fix crash in compiler on 'async with' that has many
     context managers.

   - gh-118335(13): Change how to use the tier 2 interpreter.  Instead
     of running Python with ‘-X uops’ or setting the environment
     variable ‘PYTHON_UOPS=1’, this choice is now made at build time by
     configuring with ‘--enable-experimental-jit=interpreter’.

     'Beware!'  This changes the environment variable to enable or
     disable micro-ops to ‘PYTHON_JIT’.  The old ‘PYTHON_UOPS’ is no
     longer used.

   - gh-118306(14): Update JIT compilation to use LLVM 18

   - gh-118160(15): *note Annotation scopes: 4ab. within classes can now
     contain comprehensions.  However, such comprehensions are not
     inlined into their parent scope at runtime.  Patch by Jelle
     Zijlstra.

   - gh-118272(16): Fix bug where ‘generator.close’ does not free the
     generator frame's locals.

   - gh-118216(17): Don't consider *note __future__: 0. imports with
     dots before the module name.

   - gh-118074(18): Make sure that the Executor objects in the
     COLD_EXITS array aren't assumed to be GC-able (which would access
     bytes outside the object).

   - gh-107674(19): Lazy load frame line number to improve performance
     of tracing

   - gh-118082(20): Improve *note SyntaxError: 18e. message for imports
     without names, like in ‘from x import’ and ‘import’ cases.  It now
     points out to users that *note import: 7f8. expects at least one
     name after it.

   - gh-118090(21): Improve *note SyntaxError: 18e. message for empty
     type param brackets.

   - gh-117958(22): Added a ‘get_jit_code()’ method to access JIT
     compiled machine code from the UOp Executor when the experimental
     JIT is enabled.  Patch by Anthony Shaw.

   - gh-117901(23): Add option for compiler's codegen to save nested
     instruction sequences for introspection.

   - gh-116622(24): Redirect stdout and stderr to system log when
     embedded in an Android app.

   - gh-109118(25): *note annotation scope: 4ab. within class scopes can
     now contain lambdas.

   - gh-117894(26): Prevent ‘agen.aclose()’ objects being re-used after
     ‘.throw()’.

   - gh-117881(27): prevent concurrent access to an async generator via
     athrow().throw() or asend().throw()

   - gh-117536(28): Fix a *note RuntimeWarning: 4d7. when calling
     ‘agen.aclose().throw(Exception)’.

   - gh-117755(29): Fix mimalloc allocator for huge memory allocation
     (around 8,589,934,592 GiB) on s390x.  Patch by Victor Stinner.

   - gh-117750(30): Fix issue where an object's dict would get out of
     sync with the object's internal values when being cleared.
     ‘obj.__dict__.clear()’ now clears the internal values, but leaves
     the dict attached to the object.

   - gh-117431(31): Improve the performance of the following *note
     bytes: 192. and *note bytearray: 344. methods by adapting them to
     the *note METH_FASTCALL: 199e. calling convention:

        * ‘count()’

        * ‘find()’

        * ‘index()’

        * ‘rfind()’

        * ‘rindex()’

   - gh-117709(32): Speed up calls to *note str(): 169. with
     positional-only argument, by using the PEP 590(33) ‘vectorcall’
     calling convention.  Patch by Erlend Aasland.

   - gh-117680(34): Give ‘_PyInstructionSequence’ a Python interface and
     use it in tests.

   - gh-115776(35): Statically allocated objects are, by definition,
     immortal so must be marked as such regardless of whether they are
     in extension modules or not.

   - gh-117385(36): Remove unhandled ‘PY_MONITORING_EVENT_BRANCH’ and
     ‘PY_MONITORING_EVENT_EXCEPTION_HANDLED’ events from *note
     sys.settrace(): 2e1.

   - gh-116322(37): Extension modules may indicate to the runtime that
     they can run without the GIL. Multi-phase init modules do so by
     calling providing ‘Py_MOD_GIL_NOT_USED’ for the ‘Py_mod_gil’ slot,
     while single-phase init modules call ‘PyUnstable_Module_SetGIL(mod,
     Py_MOD_GIL_NOT_USED)’ from their init function.

   - gh-116129(38): Implement PEP 696(39), adding support for defaults
     on type parameters.  Patch by Jelle Zijlstra.

   - gh-93502(40): Add two new functions to the C-API, *note
     PyRefTracer_SetTracer(): 610. and *note PyRefTracer_GetTracer():
     611, that allows to track object creation and destruction the same
     way the *note tracemalloc: 105. module does.  Patch by Pablo
     Galindo

   - gh-107674(41): Improved the performance of *note sys.settrace():
     2e1. significantly

   - gh-95754(42): Improve the error message when a script shadowing a
     module from the standard library causes *note AttributeError: 5f0.
     to be raised.  Similarly, improve the error message when a script
     shadowing a third party module attempts to access an attribute from
     that third party module while still initialising.

   - gh-99180(43): Elide uninformative traceback indicators in ‘return’
     and simple ‘assignment’ statements.  Patch by Pablo Galindo.

   - gh-105879(44): Allow the 'globals' and 'locals' arguments to *note
     exec(): 4a2. and *note eval(): 4a3. to be passed as keywords.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116322

   (2) https://github.com/python/cpython/issues/118513

   (3) https://github.com/python/cpython/issues/118518

   (4) https://github.com/python/cpython/issues/117514

   (5) https://github.com/python/cpython/issues/118164

   (6) https://github.com/python/cpython/issues/118473

   (7) https://github.com/python/cpython/issues/118465

   (8) https://github.com/python/cpython/issues/118492

   (9) https://github.com/python/cpython/issues/117714

   (10) https://github.com/python/cpython/issues/111201

   (11) https://github.com/python/cpython/issues/74929

   (12) https://github.com/python/cpython/issues/116767

   (13) https://github.com/python/cpython/issues/118335

   (14) https://github.com/python/cpython/issues/118306

   (15) https://github.com/python/cpython/issues/118160

   (16) https://github.com/python/cpython/issues/118272

   (17) https://github.com/python/cpython/issues/118216

   (18) https://github.com/python/cpython/issues/118074

   (19) https://github.com/python/cpython/issues/107674

   (20) https://github.com/python/cpython/issues/118082

   (21) https://github.com/python/cpython/issues/118090

   (22) https://github.com/python/cpython/issues/117958

   (23) https://github.com/python/cpython/issues/117901

   (24) https://github.com/python/cpython/issues/116622

   (25) https://github.com/python/cpython/issues/109118

   (26) https://github.com/python/cpython/issues/117894

   (27) https://github.com/python/cpython/issues/117881

   (28) https://github.com/python/cpython/issues/117536

   (29) https://github.com/python/cpython/issues/117755

   (30) https://github.com/python/cpython/issues/117750

   (31) https://github.com/python/cpython/issues/117431

   (32) https://github.com/python/cpython/issues/117709

   (33) https://peps.python.org/pep-0590/

   (34) https://github.com/python/cpython/issues/117680

   (35) https://github.com/python/cpython/issues/115776

   (36) https://github.com/python/cpython/issues/117385

   (37) https://github.com/python/cpython/issues/116322

   (38) https://github.com/python/cpython/issues/116129

   (39) https://peps.python.org/pep-0696/

   (40) https://github.com/python/cpython/issues/93502

   (41) https://github.com/python/cpython/issues/107674

   (42) https://github.com/python/cpython/issues/95754

   (43) https://github.com/python/cpython/issues/99180

   (44) https://github.com/python/cpython/issues/105879


File: python.info,  Node: ライブラリ<55>,  Next: ドキュメント<15>,  Prev: Core and Builtins<50>,  Up: Python 3 13 0 beta 1

1.24.20.5 ライブラリ
....................

   - gh-118418(1): A *note DeprecationWarning: 1a3. is now emitted if
     you fail to pass a value to the new 'type_params' parameter of
     ‘typing._eval_type()’ or ‘typing.ForwardRef._evaluate()’.  (Using
     either of these private and undocumented functions is discouraged
     to begin with, but failing to pass a value to the ‘type_params’
     parameter may lead to incorrect behaviour on Python 3.12 or newer.)

   - gh-118660(2): Add an optional second type parameter to *note
     typing.ContextManager: e8b. and *note typing.AsyncContextManager:
     19a0, representing the return types of *note __exit__(): 1518. and
     *note __aexit__(): 19a1. respectively.  This parameter defaults to
     ‘bool | None’.

   - gh-118650(3): The ‘enum’ module allows method named ‘_repr_*’ to be
     defined on ‘Enum’ types.

   - gh-118648(4): Add type parameter defaults to *note
     typing.Generator: 19a2. and *note typing.AsyncGenerator: 19a3.

   - gh-101137(5): Mime type ‘text/x-rst’ is now supported by *note
     mimetypes: 93.

   - gh-118164(6): The Python implementation of the ‘decimal’ module
     could appear to hang in relatively small power cases (like
     ‘2**117’) if context precision was set to a very high value.  A
     different method to check for exactly representable results is used
     now that doesn't rely on computing ‘10**precision’ (which could be
     effectively too large to compute).

   - gh-111744(7): ‘breakpoint()’ and ‘pdb.set_trace()’ now enter the
     debugger immediately after the call rather than before the next
     line is executed.

   - gh-118500(8): Add *note pdb: aa. support for zipapps

   - gh-118406(9): Add signature for *note sqlite3.Connection: 54d.
     objects.

   - gh-101732(10): Use a Y2038 compatible openssl time function when
     available.

   - gh-118404(11): Fix *note inspect.signature(): 22f. for
     non-comparable callables.

   - gh-118402(12): Fix *note inspect.signature(): 22f. for the result
     of the *note functools.cmp_to_key(): 13f2. call.

   - gh-116622(13): On Android, *note sysconfig.get_platform: 145a. now
     returns the format specified by PEP 738(14).

   - gh-118285(15): Allow to specify the signature of custom callable
     instances of extension type by the ‘__text_signature__’ attribute.
     Specify signatures of *note operator.attrgetter: 1033, *note
     operator.itemgetter: c57, and *note operator.methodcaller: 1034.
     instances.

   - gh-118314(16): Fix an edge case in *note binascii.a2b_base64():
     19a4. strict mode, where excessive padding is not detected when no
     padding is necessary.

   - gh-118271(17): Add the ‘PhotoImage’ methods ‘read()’ to read an
     image from a file and ‘data()’ to get the image data.  Add
     'background' and 'grayscale' parameters to ‘PhotoImage’ method
     ‘write()’.

   - gh-118225(18): Add the ‘PhotoImage’ method ‘copy_replace()’ to copy
     a region from one image to other image, possibly with pixel zooming
     and/or subsampling.  Add 'from_coords' parameter to ‘PhotoImage’
     methods ‘copy()’, ‘zoom()’ and ‘subsample()’.  Add 'zoom' and
     'subsample' parameters to ‘PhotoImage’ method ‘copy()’.

   - gh-118221(19): Fix a bug where *note sqlite3.Connection.iterdump():
     54f. could fail if a custom *note row factory: 19a5. was used.
     Patch by Erlend Aasland.

   - gh-118013(20): Fix regression introduced in gh-103193(21) that
     meant that calling *note inspect.getattr_static(): 6bc. on an
     instance would cause a strong reference to that instance's class to
     persist in an internal cache in the *note inspect: 82. module.
     This caused unexpected memory consumption if the class was
     dynamically created, the class held strong references to other
     objects which took up a significant amount of memory, and the cache
     contained the sole strong reference to the class.  The fix for the
     regression leads to a slowdown in ‘getattr_static()’, but the
     function should still be significantly faster than it was in Python
     3.11.  Patch by Alex Waygood.

   - gh-118218(22): Speed up *note itertools.pairwise(): a16. in the
     common case by up to 1.8x.

   - gh-117486(23): Improve the behavior of user-defined subclasses of
     *note ast.AST: 4c3.  Such classes will now require no changes in
     the usual case to conform with the behavior changes of the *note
     ast: 9. module in Python 3.13.  Patch by Jelle Zijlstra.

   - gh-90848(24): Fixed *note unittest.mock.create_autospec(): 1934. to
     configure parent mock with keyword arguments.

   - gh-118168(25): Fix incorrect argument substitution when *note
     typing.Unpack: 19a6. is used with the builtin *note tuple: 614.
     ‘typing.Unpack’ now raises *note TypeError: 198. when used with
     certain invalid types.  Patch by Jelle Zijlstra.

   - gh-118131(26): Add command-line interface for the *note random: bd.
     module.  Patch by Hugo van Kemenade.

   - gh-118107(27): Fix *note zipimport: 138. reading of ZIP64 files
     with file entries that are too big or offset too far.

   - gh-102511(28): Fix *note os.path.normpath(): 1531. for UNC paths on
     Windows.  Speed up *note os.path.splitroot(): 6cb. with a native
     implementation.

   - gh-117535(29): Change the unknown filename of *note warnings: 118.
     from ‘sys’ to ‘<sys>’ to clarify that it's not a real filename.

   - gh-114053(30): Fix erroneous *note NameError: 452. when calling
     *note typing.get_type_hints(): 8c0. on a class that made use of PEP
     695(31) type parameters in a module that had ‘from __future__
     import annotations’ at the top of the file.  Patch by Alex Waygood.

   - gh-116931(32): Add parameter 'fileobj' check for *note
     tarfile.TarFile.addfile(): 19a7.

   - gh-117995(33): Don't raise *note DeprecationWarning: 1a3. when a
     *note sequence: 716. of parameters is used to bind indexed,
     nameless placeholders.  See also gh-100668(34).

   - gh-80361(35): Fix TypeError in *note
     email.message.Message.get_payload(): 13e5. when the charset is RFC
     2231(36) encoded.

   - gh-86650(37): Fix IndexError when parse some emails with invalid
     Message-ID (including one-off addresses generated by Microsoft
     Outlook).

   - gh-117691(38): Improve the error messages emitted by *note tarfile:
     e4. deprecation warnings relating to PEP 706.  If a ‘filter’
     argument is not provided to ‘extract()’ or ‘extractall’, the
     deprecation warning now points to the line in the user's code where
     the relevant function was called.  Patch by Alex Waygood.

   - gh-115874(39): Fixed a possible segfault during garbage collection
     of ‘_asyncio.FutureIter’ objects.  Patch by Savannah Ostrowski.

   - gh-115060(40): Speed up *note pathlib.Path.glob(): 537. by omitting
     an initial *note is_dir(): 53a. call.  As a result of this change,
     *note glob(): 537. can no longer raise *note OSError: 2c0.

   - gh-77102(41): *note site: cc. module now parses ‘.pth’ file with
     UTF-8 first, and *note locale encoding: 54a. if
     ‘UnicodeDecodeError’ happened.  It supported only locale encoding
     before.

   - gh-76785(42): We've exposed the low-level ‘_interpreters’ module
     for the sake of the PyPI implementation of PEP 734(43).  It was
     sometimes available as the ‘_xxsubinterpreters’ module and was
     formerly used only for testing.  For the most part, it should be
     considered an internal module, like ‘_thread’ and ‘_imp’.  See
     ‘https://discuss.python.org/t/pep-734-multiple-interpreters-in-the-stdlib/41147/26’.

   - gh-115060(44): Speed up *note pathlib.Path.glob(): 537. by not
     scanning directories for non-wildcard pattern segments.

   - gh-117727(45): Speed up *note pathlib.Path.iterdir(): 26e. by using
     *note os.scandir(): c54. internally.

   - gh-117586(46): Speed up *note pathlib.Path.walk(): 6cf. by working
     with strings internally.

   - gh-117722(47): Change the new multi-separator support in *note
     asyncio.StreamReader.readuntil(): 4d0. to only accept tuples of
     separators rather than arbitrary iterables.

   - gh-117692(48): Fixes a bug when *note doctest.DocTestFinder: 19a8.
     was failing on wrapped ‘builtin_function_or_method’.

   - gh-117348(49): Largely restored import time performance of
     configparser by avoiding dataclasses.

   - gh-117641(50): Speedup *note os.path.commonpath(): 103d. on Unix.

   - gh-117663(51): Fix ‘_simple_enum’ to detect aliases when multiple
     arguments are present but only one is the member value.

   - gh-117636(52): Speedup *note os.path.join(): 19a9.

   - gh-117618(53): Support ‘package.module’ as ‘filename’ for ‘break’
     command of *note pdb: aa.

   - gh-102247(54): the status codes enum with constants in
     http.HTTPStatus are updated to include the names from RFC9110.
     This RFC includes some HTTP statuses previously only used for
     WEBDAV and assigns more generic names to them.

     The old constants are preserved for backwards compatibility.

   - gh-117607(55): Speedup *note os.path.relpath(): 6d1.

   - gh-117586(56): Speed up *note pathlib.Path.glob(): 537. by working
     with strings internally.

   - gh-117225(57): Add colour to doctest output.  Patch by Hugo van
     Kemenade.

   - gh-117566(58): *note ipaddress.IPv6Address.is_loopback(): 19aa.
     will now return ‘True’ for IPv4-mapped loopback addresses, i.e.
     addresses in the ‘::ffff:127.0.0.0/104’ address space.

   - gh-117546(59): Fix issue where *note os.path.realpath(): 262.
     stopped resolving symlinks after encountering a symlink loop on
     POSIX.

   - gh-116720(60): Improved behavior of *note asyncio.TaskGroup: 4d1.
     when an external cancellation collides with an internal
     cancellation.  For example, when two task groups are nested and
     both experience an exception in a child task simultaneously, it was
     possible that the outer task group would misbehave, because its
     internal cancellation was swallowed by the inner task group.

     In the case where a task group is cancelled externally and also
     must raise an *note ExceptionGroup: 4d2, it will now call the
     parent task's *note cancel(): 4d3. method.  This ensures that a
     *note asyncio.CancelledError: 4d4. will be raised at the next *note
     await: 18d, so the cancellation is not lost.

     An added benefit of these changes is that task groups now preserve
     the cancellation count (*note asyncio.Task.cancelling(): 4d5.).

     In order to handle some corner cases, *note
     asyncio.Task.uncancel(): 4d6. may now reset the undocumented
     ‘_must_cancel’ flag when the cancellation count reaches zero.

   - gh-117516(61): Add *note typing.TypeIs: 48b, implementing PEP
     742(62).  Patch by Jelle Zijlstra.

   - gh-117503(63): Fix support of non-ASCII user names in bytes paths
     in *note os.path.expanduser(): c09. on Posix.

   - gh-117394(64): *note os.path.ismount(): c07. is now 2-3 times
     faster if the user has permissions.

   - gh-117313(65): Only treat ‘'\n'’, ‘'\r'’ and ‘'\r\n'’ as line
     separators in re-folding the *note email: 3f. messages.  Preserve
     control characters ‘'\v'’, ‘'\f'’, ‘'\x1c'’, ‘'\x1d'’ and ‘'\x1e'’
     and Unicode line separators ‘'\x85'’, ‘'\u2028'’ and ‘'\u2029'’ as
     is.

   - gh-117142(66): Convert ‘_ctypes’ to multi-phase initialisation (
     PEP 489(67)).

   - gh-66543(68): Add the *note mimetypes.guess_file_type(): 516.
     function which works with file path.  Passing file path instead of
     URL in *note guess_type(): 517. is *note soft deprecated: 23d.

   - gh-68583(69): webbrowser CLI: replace getopt with argparse, add
     long options.  Patch by Hugo van Kemenade.

   - gh-116871(70): Name suggestions for *note AttributeError: 5f0. and
     *note ImportError: 65b. now only include underscored names if the
     original name was underscored.

   - gh-116023(71): Don't show empty fields (value ‘None’ or ‘[]’) in
     *note ast.dump(): ae1. by default.  Add ‘show_empty=False’
     parameter to optionally show them.

   - gh-115961(72): Added ‘name’ and ‘mode’ attributes for compressed
     and archived file-like objects in modules *note bz2: 14, *note
     lzma: 8e, *note tarfile: e4. and *note zipfile: 137.  The value of
     the ‘mode’ attribute of *note gzip.GzipFile: 65c. was changed from
     integer (‘1’ or ‘2’) to string (‘'rb'’ or ‘'wb'’).  The value of
     the ‘mode’ attribute of the readable file-like object returned by
     *note zipfile.ZipFile.open(): 65d. was changed from ‘'r'’ to
     ‘'rb'’.

   - gh-82062(73): Fix *note inspect.signature(): 22f. to correctly
     handle parameter defaults on methods in extension modules that use
     names defined in the module namespace.

   - gh-83856(74): Honor *note atexit: d. for all *note multiprocessing:
     98. start methods

   - gh-113081(75): Print colorized exception just like built-in
     traceback in *note pdb: aa.

   - gh-112855(76): Speed up pickling of *note pathlib.PurePath: 6cd.
     objects.  Patch by Barney Gale.

   - gh-111744(77): Support opcode events in *note bdb: 10.

   - gh-109617(78): ‘ncurses’: fixed a crash that could occur on macOS
     13 or earlier when Python was built with Apple Xcode 15's SDK.

   - gh-83151(79): Enabled arbitrary statements and evaluations in *note
     pdb: aa. shell to access the local variables of the current frame,
     which made it possible for multi-scope code like generators or
     nested function to work.

   - gh-110209(80): Add *note __class_getitem__(): 943. to *note
     types.GeneratorType: 19ab. and *note types.CoroutineType: 1089. for
     type hinting purposes.  Patch by James Hilton-Balfe.

   - gh-108191(81): The *note types.SimpleNamespace: 4e5. now accepts an
     optional positional argument which specifies initial values of
     attributes as a dict or an iterable of key-value pairs.

   - gh-62090(82): Fix assertion errors caused by whitespace in metavars
     or ‘SUPPRESS’-ed groups in *note argparse: 7. by simplifying usage
     formatting.  Patch by Ali Hamdan.

   - gh-102402(83): Adjust ‘logging.LogRecord’ to use ‘time.time_ns()’
     and fix minor bug related to floating-point math.

   - gh-100242(84): Bring pure Python implementation
     ‘functools.partial.__new__’ more in line with the C-implementation
     by not just always checking for the presence of the attribute
     ‘'func'’ on the first argument of ‘partial’.  Instead, both the
     Python version and the C version perform an ‘isinstance(func,
     partial)’ check on the first argument of ‘partial’.

   - gh-99730(85): HEAD requests are no longer upgraded to GET request
     during redirects in urllib.

   - gh-66410(86): Setting the ‘tkinter’ module global ‘wantobjects’ to
     ‘2’ before creating the *note Tk: 19ac. object or call the
     ‘wantobjects()’ method of the ‘Tk’ object with argument ‘2’ makes
     now arguments to callbacks registered in the *note tkinter: f6.
     module to be passed as various Python objects (‘int’, ‘float’,
     ‘bytes’, ‘tuple’), depending on their internal representation in
     Tcl, instead of always ‘str’.  ‘tkinter.wantobjects’ is now set to
     ‘2’ by default.

   - bpo-40943(87): Fix several IndexError when parse emails with
     truncated Message-ID, address, routes, etc, e.g.  ‘example@’.

   - bpo-39324(88): Add mime type mapping for .md <-> text/markdown

   - bpo-18108(89): *note shutil.chown(): 548. now supports 'dir_fd' and
     'follow_symlinks' keyword arguments.

   - bpo-30988(90): Fix parsing of emails with invalid address headers
     having a leading or trailing dot.  Patch by tsufeki.

   - bpo-32839(91): Add the ‘after_info()’ method for Tkinter widgets.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118418

   (2) https://github.com/python/cpython/issues/118660

   (3) https://github.com/python/cpython/issues/118650

   (4) https://github.com/python/cpython/issues/118648

   (5) https://github.com/python/cpython/issues/101137

   (6) https://github.com/python/cpython/issues/118164

   (7) https://github.com/python/cpython/issues/111744

   (8) https://github.com/python/cpython/issues/118500

   (9) https://github.com/python/cpython/issues/118406

   (10) https://github.com/python/cpython/issues/101732

   (11) https://github.com/python/cpython/issues/118404

   (12) https://github.com/python/cpython/issues/118402

   (13) https://github.com/python/cpython/issues/116622

   (14) https://peps.python.org/pep-0738/

   (15) https://github.com/python/cpython/issues/118285

   (16) https://github.com/python/cpython/issues/118314

   (17) https://github.com/python/cpython/issues/118271

   (18) https://github.com/python/cpython/issues/118225

   (19) https://github.com/python/cpython/issues/118221

   (20) https://github.com/python/cpython/issues/118013

   (21) https://github.com/python/cpython/issues/103193

   (22) https://github.com/python/cpython/issues/118218

   (23) https://github.com/python/cpython/issues/117486

   (24) https://github.com/python/cpython/issues/90848

   (25) https://github.com/python/cpython/issues/118168

   (26) https://github.com/python/cpython/issues/118131

   (27) https://github.com/python/cpython/issues/118107

   (28) https://github.com/python/cpython/issues/102511

   (29) https://github.com/python/cpython/issues/117535

   (30) https://github.com/python/cpython/issues/114053

   (31) https://peps.python.org/pep-0695/

   (32) https://github.com/python/cpython/issues/116931

   (33) https://github.com/python/cpython/issues/117995

   (34) https://github.com/python/cpython/issues/100668

   (35) https://github.com/python/cpython/issues/80361

   (36) https://datatracker.ietf.org/doc/html/rfc2231.html

   (37) https://github.com/python/cpython/issues/86650

   (38) https://github.com/python/cpython/issues/117691

   (39) https://github.com/python/cpython/issues/115874

   (40) https://github.com/python/cpython/issues/115060

   (41) https://github.com/python/cpython/issues/77102

   (42) https://github.com/python/cpython/issues/76785

   (43) https://peps.python.org/pep-0734/

   (44) https://github.com/python/cpython/issues/115060

   (45) https://github.com/python/cpython/issues/117727

   (46) https://github.com/python/cpython/issues/117586

   (47) https://github.com/python/cpython/issues/117722

   (48) https://github.com/python/cpython/issues/117692

   (49) https://github.com/python/cpython/issues/117348

   (50) https://github.com/python/cpython/issues/117641

   (51) https://github.com/python/cpython/issues/117663

   (52) https://github.com/python/cpython/issues/117636

   (53) https://github.com/python/cpython/issues/117618

   (54) https://github.com/python/cpython/issues/102247

   (55) https://github.com/python/cpython/issues/117607

   (56) https://github.com/python/cpython/issues/117586

   (57) https://github.com/python/cpython/issues/117225

   (58) https://github.com/python/cpython/issues/117566

   (59) https://github.com/python/cpython/issues/117546

   (60) https://github.com/python/cpython/issues/116720

   (61) https://github.com/python/cpython/issues/117516

   (62) https://peps.python.org/pep-0742/

   (63) https://github.com/python/cpython/issues/117503

   (64) https://github.com/python/cpython/issues/117394

   (65) https://github.com/python/cpython/issues/117313

   (66) https://github.com/python/cpython/issues/117142

   (67) https://peps.python.org/pep-0489/

   (68) https://github.com/python/cpython/issues/66543

   (69) https://github.com/python/cpython/issues/68583

   (70) https://github.com/python/cpython/issues/116871

   (71) https://github.com/python/cpython/issues/116023

   (72) https://github.com/python/cpython/issues/115961

   (73) https://github.com/python/cpython/issues/82062

   (74) https://github.com/python/cpython/issues/83856

   (75) https://github.com/python/cpython/issues/113081

   (76) https://github.com/python/cpython/issues/112855

   (77) https://github.com/python/cpython/issues/111744

   (78) https://github.com/python/cpython/issues/109617

   (79) https://github.com/python/cpython/issues/83151

   (80) https://github.com/python/cpython/issues/110209

   (81) https://github.com/python/cpython/issues/108191

   (82) https://github.com/python/cpython/issues/62090

   (83) https://github.com/python/cpython/issues/102402

   (84) https://github.com/python/cpython/issues/100242

   (85) https://github.com/python/cpython/issues/99730

   (86) https://github.com/python/cpython/issues/66410

   (87) https://bugs.python.org/issue?@action=redirect&bpo=40943

   (88) https://bugs.python.org/issue?@action=redirect&bpo=39324

   (89) https://bugs.python.org/issue?@action=redirect&bpo=18108

   (90) https://bugs.python.org/issue?@action=redirect&bpo=30988

   (91) https://bugs.python.org/issue?@action=redirect&bpo=32839


File: python.info,  Node: ドキュメント<15>,  Next: ビルド<16>,  Prev: ライブラリ<55>,  Up: Python 3 13 0 beta 1

1.24.20.6 ドキュメント
......................

   - gh-117928(1): The minimum Sphinx version required for the
     documentation is now 6.2.1.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/117928


File: python.info,  Node: ビルド<16>,  Next: Windows<15>,  Prev: ドキュメント<15>,  Up: Python 3 13 0 beta 1

1.24.20.7 ビルド
................

   - gh-118734(1): Fixes Windows build when invoked directly (not
     through the ‘build.bat’ script) without specifying a value for
     ‘UseTIER2’.

   - gh-115119(2): The ‘configure’ option *note -with-system-libmpdec:
     657. now defaults to ‘yes’.  The bundled copy of ‘libmpdecimal’
     will be removed in Python 3.15.

   - gh-117845(3): Fix building against recent libedit versions by
     detecting readline hook signatures in ‘configure’.

   - gh-116622(4): A testbed project was added to run the test suite on
     Android.

   - gh-117645(5): Increase WASI stack size from 512 KiB to 8 MiB and
     the initial memory from 10 MiB to 20 MiB. Patch by Victor Stinner.

   - gh-115119(6): ‘configure’ now uses ‘pkg-config’ to detect *note
     decimal: 3a. dependencies if the *note -with-system-libmpdec: 657.
     option is given.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118734

   (2) https://github.com/python/cpython/issues/115119

   (3) https://github.com/python/cpython/issues/117845

   (4) https://github.com/python/cpython/issues/116622

   (5) https://github.com/python/cpython/issues/117645

   (6) https://github.com/python/cpython/issues/115119


File: python.info,  Node: Windows<15>,  Next: macOS<9>,  Prev: ビルド<16>,  Up: Python 3 13 0 beta 1

1.24.20.8 Windows
.................

   - gh-115119(1): Update Windows installer to use libmpdecimal 4.0.0.

   - gh-118486(2): *note os.mkdir(): 52b. now accepts 'mode' of ‘0o700’
     to restrict the new directory to the current user.

   - gh-118347(3): Fixes launcher updates not being installed.

   - gh-118293(4): The ‘multiprocessing’ module now passes the
     ‘STARTF_FORCEOFFFEEDBACK’ flag when spawning processes to tell
     Windows not to change the mouse cursor.

   - gh-115009(5): Update Windows installer to use SQLite 3.45.3.

   - gh-90329(6): Suppress the warning displayed on virtual environment
     creation when the requested and created paths differ only by a
     short (8.3 style) name.  Warnings will continue to be shown if a
     junction or symlink in the path caused the venv to be created in a
     different location than originally requested.

   - gh-117786(7): Fixes virtual environments not correctly launching
     when created from a Store install.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115119

   (2) https://github.com/python/cpython/issues/118486

   (3) https://github.com/python/cpython/issues/118347

   (4) https://github.com/python/cpython/issues/118293

   (5) https://github.com/python/cpython/issues/115009

   (6) https://github.com/python/cpython/issues/90329

   (7) https://github.com/python/cpython/issues/117786


File: python.info,  Node: macOS<9>,  Next: IDLE<8>,  Prev: Windows<15>,  Up: Python 3 13 0 beta 1

1.24.20.9 macOS
...............

   - gh-115119(1): Update macOS installer to use libmpdecimal 4.0.0.

   - gh-114099(2): iOS preprocessor symbol usage was made compatible
     with older macOS SDKs.

   - gh-115009(3): Update macOS installer to use SQLite 3.45.3.

   - gh-91629(4): Use ‘~/.config/fish/conf.d’ configs and
     ‘fish_add_path’ to set ‘PATH’ when installing for the Fish shell.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115119

   (2) https://github.com/python/cpython/issues/114099

   (3) https://github.com/python/cpython/issues/115009

   (4) https://github.com/python/cpython/issues/91629


File: python.info,  Node: IDLE<8>,  Next: C API<16>,  Prev: macOS<9>,  Up: Python 3 13 0 beta 1

1.24.20.10 IDLE
...............

   - bpo-34774(1): Use user-selected color theme for Help => IDLE Doc.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34774


File: python.info,  Node: C API<16>,  Prev: IDLE<8>,  Up: Python 3 13 0 beta 1

1.24.20.11 C API
................

   - gh-118124(1): Fix *note Py_BUILD_ASSERT: 19b3. and *note
     Py_BUILD_ASSERT_EXPR: 19b4. for non-constant expressions: use
     ‘static_assert()’ on C11 and newer.  Patch by Victor Stinner.

   - gh-110850(2): Add "Raw" variant of PyTime functions

        * *note PyTime_MonotonicRaw(): 5d8.

        * *note PyTime_PerfCounterRaw(): 5da.

        * *note PyTime_TimeRaw(): 5dc.

     Patch by Victor Stinner.

   - gh-117987(3): Restore functions removed in Python 3.13 alpha 1:

        * *note Py_SetPythonHome(): 19b5.

        * *note Py_SetProgramName(): 19b6.

        * *note PySys_SetArgvEx(): 19b7.

        * *note PySys_SetArgv(): 19b8.

     Patch by Victor Stinner.

   - gh-117929(4): Restore removed *note PyEval_InitThreads(): 19b9.
     function.  Patch by Victor Stinner.

   - gh-117534(5): Improve validation logic in the C implementation of
     *note datetime.datetime.fromisoformat(): 82a. to better handle
     invalid years.  Patch by Vlad Efanov.

   - gh-68114(6): Fixed skipitem()'s handling of the old 'w' and 'w#'
     formatters.  These are no longer supported and now raise an
     exception if used.

   - gh-111997(7): Add a C-API for firing monitoring events.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/118124

   (2) https://github.com/python/cpython/issues/110850

   (3) https://github.com/python/cpython/issues/117987

   (4) https://github.com/python/cpython/issues/117929

   (5) https://github.com/python/cpython/issues/117534

   (6) https://github.com/python/cpython/issues/68114

   (7) https://github.com/python/cpython/issues/111997


File: python.info,  Node: Python 3 13 0 alpha 6,  Next: Python 3 13 0 alpha 5,  Prev: Python 3 13 0 beta 1,  Up: 変更履歴

1.24.21 Python 3.13.0 alpha 6
-----------------------------

'Release date: 2024-04-09'

* Menu:

* Core and Builtins: Core and Builtins<51>.
* ライブラリ: ライブラリ<56>.
* Core and Builtins: Core and Builtins<52>.
* ライブラリ: ライブラリ<57>.
* ドキュメント: ドキュメント<16>.
* テスト: テスト<14>.
* ビルド: ビルド<17>.
* Windows: Windows<16>.
* C API: C API<17>.


File: python.info,  Node: Core and Builtins<51>,  Next: ライブラリ<56>,  Up: Python 3 13 0 alpha 6

1.24.21.1 Core and Builtins
...........................

   - gh-117494(1): Refactored the instruction sequence data structure
     out of compile.c into instruction_sequence.c.

   - gh-116968(2): Introduce a unified 16-bit backoff counter type
     (‘_Py_BackoffCounter’), shared between the Tier 1 adaptive
     specializer and the Tier 2 optimizer.  The API used for adaptive
     specialization counters is changed but the behavior is (supposed to
     be) identical.

     The behavior of the Tier 2 counters is changed:

        * There are no longer dynamic thresholds (we never varied
          these).

        * All counters now use the same exponential backoff.

        * The counter for ‘JUMP_BACKWARD’ starts counting down from 16.

        * The ‘temperature’ in side exits starts counting down from 64.

   - gh-117431(3): Improve the performance of the following *note bytes:
     192. and *note bytearray: 344. methods by adapting them to the
     *note METH_FASTCALL: 199e. calling convention:

        * ‘endswith()’

        * ‘startswith()’

   - gh-117431(4): Improve the performance of the following *note str:
     169. methods by adapting them to the *note METH_FASTCALL: 199e.
     calling convention:

        * *note count(): 1981.

        * *note endswith(): 10cc.

        * *note find(): 10a8.

        * *note index(): 19bc.

        * *note rfind(): 10a9.

        * *note rindex(): 146f.

        * *note startswith(): 10cb.

   - gh-117411(5): Move ‘PyFutureFeatures’ to an internal header and
     make it private.

   - gh-109120(6): Added handle of incorrect star expressions, e.g ‘f(3,
     *)’.  Patch by Grigoryev Semyon

   - gh-117266(7): Fix crashes for certain user-created subclasses of
     *note ast.AST: 4c3.  Such classes are now expected to set the
     ‘_field_types’ attribute.

   - gh-99108(8): Updated the *note hashlib: 6c. built-in HACL*
     project(9) C code from upstream that we use for many
     implementations when they are not present via OpenSSL in a given
     build.  This also avoids the rare potential for a C symbol name one
     definition rule linking issue.

   - gh-117108(10): Change the old space bit of objects in the young
     generation from 0 to gcstate->visited, so that any objects created
     during GC will have the old bit set correctly if they get moved
     into the old generation.

   - gh-117108(11): The cycle GC now chooses the size of increments
     based on the total heap size, instead of the rate of object
     creation.  This ensures that it can keep up with growing heaps.

   - gh-116735(12): For ‘INSTRUMENTED_CALL_FUNCTION_EX’, set ‘arg0’ to
     ‘sys.monitoring.MISSING’ instead of ‘None’ for *note CALL: 19bd.
     event.

   - gh-113964(13): Starting new threads and process creation through
     *note os.fork(): 4b5. are now only prevented once all non-daemon
     threads exit.

   - gh-116626(14): Ensure ‘INSTRUMENTED_CALL_FUNCTION_EX’ always emits
     *note CALL: 19bd.

   - gh-116554(15): ‘list.sort()’ now exploits more cases of partial
     ordering, particularly those with long descending runs with
     sub-runs of equal values.  Those are recognized as single runs now
     (previously, each block of repeated values caused a new run to be
     created).

   - gh-114099(16): Added a Loader that can discover extension modules
     in an iOS-style Frameworks folder.

   - gh-115775(17): Compiler populates the new ‘__static_attributes__’
     field on a class with the names of attributes of this class which
     are accessed through self.X from any function in its body.

   - gh-115776(18): The array of values, the ‘PyDictValues’ struct is
     now embedded in the object during allocation.  This provides better
     performance in the common case, and does not degrade as much when
     the object's ‘__dict__’ is materialized.

   - gh-108362(19): Implement an incremental cyclic garbage collector.
     By collecting the old generation in increments, there is no need
     for a full heap scan.  This can hugely reduce maximum pause time
     for programs with large heaps.

     Reduce the number of generations from three to two.  The old
     generation is split into two spaces, "visited" and "pending".

     Collection happens in two steps:: * An increment is formed from the
     young generation and a small part of the pending space.  * This
     increment is scanned and the survivors moved to the end of the
     visited space.

     When the collecting space becomes empty, the two spaces are
     swapped.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/117494

   (2) https://github.com/python/cpython/issues/116968

   (3) https://github.com/python/cpython/issues/117431

   (4) https://github.com/python/cpython/issues/117431

   (5) https://github.com/python/cpython/issues/117411

   (6) https://github.com/python/cpython/issues/109120

   (7) https://github.com/python/cpython/issues/117266

   (8) https://github.com/python/cpython/issues/99108

   (9) https://github.com/hacl-star/hacl-star

   (10) https://github.com/python/cpython/issues/117108

   (11) https://github.com/python/cpython/issues/117108

   (12) https://github.com/python/cpython/issues/116735

   (13) https://github.com/python/cpython/issues/113964

   (14) https://github.com/python/cpython/issues/116626

   (15) https://github.com/python/cpython/issues/116554

   (16) https://github.com/python/cpython/issues/114099

   (17) https://github.com/python/cpython/issues/115775

   (18) https://github.com/python/cpython/issues/115776

   (19) https://github.com/python/cpython/issues/108362


File: python.info,  Node: ライブラリ<56>,  Next: Core and Builtins<52>,  Prev: Core and Builtins<51>,  Up: Python 3 13 0 alpha 6

1.24.21.2 ライブラリ
....................

   - gh-109870(1): Dataclasses now calls *note exec(): 4a2. once per
     dataclass, instead of once per method being added.  This can speed
     up dataclass creation by up to 20%.

   - gh-97901(2): Mime type ‘text/rtf’ is now supported by *note
     mimetypes: 93.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/109870

   (2) https://github.com/python/cpython/issues/97901


File: python.info,  Node: Core and Builtins<52>,  Next: ライブラリ<57>,  Prev: ライブラリ<56>,  Up: Python 3 13 0 alpha 6

1.24.21.3 Core and Builtins
...........................

   - bpo-24612(1): Improve the *note SyntaxError: 18e. that happens when
     'not' appears after an operator.  Patch by Pablo Galindo

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24612


File: python.info,  Node: ライブラリ<57>,  Next: ドキュメント<16>,  Prev: Core and Builtins<52>,  Up: Python 3 13 0 alpha 6

1.24.21.4 ライブラリ
....................

   - gh-117648(1): Improve performance of *note os.path.join(): 19a9.
     and *note os.path.expanduser(): c09.

   - gh-117584(2): Raise *note TypeError: 198. for non-paths in *note
     posixpath.relpath: 6d1.

   - gh-117467(3): Preserve mailbox ownership when rewriting in *note
     mailbox.mbox.flush: 19c1.  Patch by Tony Mountifield.

   - gh-114848(4): Raise *note FileNotFoundError: 264. when ‘getcwd()’
     returns '(unreachable)', which can happen on Linux >= 2.6.36 with
     glibc < 2.27.

   - gh-117459(5): ‘asyncio.asyncio.run_coroutine_threadsafe()’ now
     keeps the traceback of ‘CancelledError’, *note TimeoutError: a36.
     and ‘InvalidStateError’ which are raised in the coroutine.

   - gh-117381(6): Fix error message for ‘ntpath.commonpath()’.

   - gh-117337(7): Deprecate undocumented ‘glob.glob0()’ and
     ‘glob.glob1()’ functions.  Use *note glob.glob(): 5a0. and pass a
     directory to its 'root_dir' argument instead.

   - gh-117349(8): Optimise several functions in *note os.path: a6.

   - gh-117348(9): Refactored ‘configparser.RawConfigParser._read()’ to
     reduce cyclometric complexity and improve comprehensibility.

   - gh-117335(10): Raise TypeError for non-sequences for
     ‘ntpath.commonpath()’.

   - gh-66449(11): *note configparser.ConfigParser: 4de. now accepts
     unnamed sections before named ones, if configured to do so.

   - gh-88014(12): In documentation of *note gzip.GzipFile: 65c. in
     module gzip, explain data type of optional constructor argument
     'mtime', and recommend ‘mtime = 0’ for generating deterministic
     streams.

   - gh-117310(13): Fixed an unlikely early & extra ‘Py_DECREF’
     triggered crash in *note ssl: d5. when creating a new
     ‘_ssl._SSLContext’ if CPython was built implausibly such that the
     default cipher list is empty 'or' the SSL library it was linked
     against reports a failure from its C ‘SSL_CTX_set_cipher_list()’
     API.

   - gh-117294(14): A ‘DocTestCase’ now reports as skipped if all
     examples in the doctest are skipped.

   - gh-98966(15): In *note subprocess: dc, raise a more informative
     message when ‘stdout=STDOUT’.

   - gh-117225(16): doctest: only print "and X failed" when non-zero,
     don't pluralise "1 items".  Patch by Hugo van Kemenade.

   - gh-117205(17): Speed up *note compileall.compile_dir(): d1b. by 20%
     when using multiprocessing by increasing ‘chunksize’.

   - gh-117178(18): Fix regression in lazy loading of self-referential
     modules, introduced in gh-114781(19).

   - gh-112383(20): Fix *note dis: 3c. module's handling of
     ‘ENTER_EXECUTOR’ instructions.

   - gh-117182(21): Lazy-loading of modules that modify their own
     ‘__class__’ no longer reverts the ‘__class__’ to *note
     types.ModuleType: 1014.

   - gh-117084(22): Fix *note zipfile: 137. extraction for directory
     entries with the name containing backslashes on Windows.

   - gh-117114(23): Make *note os.path.isdevdrive(): 19c2. available on
     all platforms.  For those that do not offer Dev Drives, it will
     always return ‘False’.

   - gh-117110(24): Fix a bug that prevents subclasses of *note
     typing.Any: 8bb. to be instantiated with arguments.  Patch by Chris
     Fu.

   - gh-109653(25): Deferred select imports in importlib.metadata and
     importlib.resources for a 14% speedup.

   - gh-70647(26): Start the deprecation period for the current behavior
     of *note datetime.datetime.strptime(): 1950. and *note
     time.strptime(): 1646. which always fails to parse a date string
     with a *note ValueError: 2ec. involving a day of month such as
     ‘strptime("02-29", "%m-%d")’ when a year is 'not' specified and the
     date happen to be February 29th.  This should help avoid users
     finding new bugs every four years due to a natural mistaken
     assumption about the API when parsing partial date values.

   - gh-116987(27): Fixed ‘inspect.findsource()’ for class code objects.

   - gh-114099(28): Modify standard library to allow for iOS platform
     differences.

   - gh-90872(29): On Windows, *note subprocess.Popen.wait(): ee0. no
     longer calls ‘WaitForSingleObject()’ with a negative timeout: pass
     ‘0’ ms if the timeout is negative.  Patch by Victor Stinner.

   - gh-116957(30): configparser: Don't leave ConfigParser values in an
     invalid state (stored as a list instead of a str) after an earlier
     read raised DuplicateSectionError or DuplicateOptionError.

   - gh-115538(31): ‘_io.WindowsConsoleIO’ now emit a warning if a
     boolean value is passed as a filedescriptor argument.

   - gh-90095(32): Ignore empty lines and comments in ‘.pdbrc’

   - gh-106531(33): Refreshed zipfile._path from zipp 3.18(34),
     providing better compatibility for PyPy, better glob performance
     for deeply nested zipfiles, and providing internal access to
     ‘CompleteDirs.inject’ for use in other tests (like
     importlib.resources).

   - gh-63207(35): On Windows, *note time.time(): 55d. now uses the
     ‘GetSystemTimePreciseAsFileTime()’ clock to have a resolution
     better than 1 us, instead of the ‘GetSystemTimeAsFileTime()’ clock
     which has a resolution of 15.6 ms.  Patch by Victor Stinner.

   - gh-116764(36): Restore support of ‘None’ and other false values in
     *note urllib.parse: 110. functions *note parse_qs(): 31f. and *note
     parse_qsl(): 31e.  Also, they now raise a TypeError for non-zero
     integers and non-empty sequences.

   - gh-116811(37): In ‘PathFinder.invalidate_caches’, delegate to
     ‘MetadataPathFinder.invalidate_caches’.

   - gh-116647(38): Fix recursive child in dataclasses

   - gh-113171(39): Fixed various false positives and false negatives in

        * *note ipaddress.IPv4Address.is_private: 19c3. (see these docs
          for details)

        * *note ipaddress.IPv4Address.is_global: 1161.

        * *note ipaddress.IPv6Address.is_private: 19c4.

        * *note ipaddress.IPv6Address.is_global: 19c5.

     Also in the corresponding *note ipaddress.IPv4Network: 50e. and
     *note ipaddress.IPv6Network: 50f. attributes.

   - gh-63283(40): In *note encodings.idna: 56, any capitalization of
     the ACE prefix (‘xn--’) is now acceptable.  Patch by Pepijn de Vos
     and Zackery Spytz.

   - gh-71042(41): Add *note platform.android_ver(): 19c6, which
     provides device and OS information on Android.

   - gh-73468(42): Added new *note math.fma(): 514. function, wrapping
     C99's ‘fma()’ operation: fused multiply-add function.  Patch by
     Mark Dickinson and Victor Stinner.

   - gh-116608(43): The *note importlib.resources: 7f. functions *note
     is_resource(): 4fd, *note open_binary(): 4fe, *note open_text():
     4ff, *note path(): 500, *note read_binary(): 501, and *note
     read_text(): 502. are un-deprecated, and support subdirectories via
     multiple positional arguments.  The *note contents(): 503. function
     also allows subdirectories, but remains deprecated.

   - gh-116484(44): Change automatically generated ‘tkinter.Checkbutton’
     widget names to avoid collisions with automatically generated
     ‘tkinter.ttk.Checkbutton’ widget names within the same parent
     widget.

   - gh-114314(45): In *note ctypes: 2e, ctype data is now stored in
     type objects directly rather than in a dict subclass.  This is an
     internal change that should not affect usage.

   - gh-116401(46): Fix blocking *note os.fwalk(): d52. and *note
     shutil.rmtree(): 356. on opening named pipe.

   - gh-71052(47): Implement *note ctypes.util.find_library(): f45. on
     Android.

   - gh-90535(48): Fix support of 'interval' values > 1 in
     ‘logging.TimedRotatingFileHandler’ for ‘when='MIDNIGHT'’ and
     ‘when='Wx'’.

   - gh-113308(49): Remove some internal protected parts from *note
     uuid: 116.: ‘_has_uuid_generate_time_safe’, ‘_netbios_getnode’,
     ‘_ipconfig_getnode’, and ‘_load_system_functions’.  They were
     unused.

   - gh-115627(50): Fix the *note ssl: d5. module error handling of
     connection terminate by peer.  It now throws an OSError with the
     appropriate error code instead of an EOFError.

   - gh-114847(51): Speed up *note os.path.realpath(): 262. on
     non-Windows platforms.

   - gh-114271(52): Fix a race in ‘threading.Thread.join()’.

     ‘threading._MainThread’ now always represents the main thread of
     the main interpreter.

     ‘PyThreadState.on_delete’ and ‘PyThreadState.on_delete_data’ have
     been removed.

   - gh-113538(53): Add *note asyncio.Server.close_clients(): 4ce. and
     *note asyncio.Server.abort_clients(): 4cf. methods which allow to
     more forcefully close an asyncio server.

   - gh-85287(54): Changes Unicode codecs to return UnicodeEncodeError
     or UnicodeDecodeError, rather than just UnicodeError.

   - gh-113548(55): *note pdb: aa. now allows CLI arguments to ‘pdb -m’.

   - gh-112948(56): Make completion of *note pdb: aa. similar to Python
     REPL

   - gh-105866(57): Fixed ‘_get_slots’ bug which caused error when
     defining dataclasses with slots and a weakref_slot.

   - gh-96471(58): Add *note asyncio.Queue: c6a. termination with *note
     shutdown(): 4cc. method.

   - gh-89739(59): The *note zipimport: 138. module can now read ZIP64
     files.

   - bpo-33533(60): *note asyncio.as_completed(): 4c6. now returns an
     object that is both an asynchronous iterator and plain iterator.
     The new asynchronous iteration pattern allows for easier
     correlation between prior tasks and their completed results.  This
     is a closer match to *note concurrent.futures.as_completed():
     19c7.'s iteration pattern.  Patch by Justin Arthur.

   - bpo-27578(61): *note inspect.getsource(): 17c3. (and related
     functions) work with empty module files, returning ‘'\n'’ (or
     reasonable equivalent) instead of raising ‘OSError’.  Patch by
     Kernc.

   - bpo-37141(62): Accept an iterable of separators in *note
     asyncio.StreamReader.readuntil(): 4d0, stopping when one of them is
     encountered.

   - gh-66543(63): Make *note mimetypes.guess_type(): 517. properly
     parsing of URLs with only a host name, URLs containing fragment or
     query, and filenames with only a UNC sharepoint on Windows.  Based
     on patch by Dong-hee Na.

   - bpo-15010(64): *note unittest.TestLoader.discover(): 11e7. now
     saves the original value of ‘unittest.TestLoader._top_level_dir’
     and restores it at the end of the call.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/117648

   (2) https://github.com/python/cpython/issues/117584

   (3) https://github.com/python/cpython/issues/117467

   (4) https://github.com/python/cpython/issues/114848

   (5) https://github.com/python/cpython/issues/117459

   (6) https://github.com/python/cpython/issues/117381

   (7) https://github.com/python/cpython/issues/117337

   (8) https://github.com/python/cpython/issues/117349

   (9) https://github.com/python/cpython/issues/117348

   (10) https://github.com/python/cpython/issues/117335

   (11) https://github.com/python/cpython/issues/66449

   (12) https://github.com/python/cpython/issues/88014

   (13) https://github.com/python/cpython/issues/117310

   (14) https://github.com/python/cpython/issues/117294

   (15) https://github.com/python/cpython/issues/98966

   (16) https://github.com/python/cpython/issues/117225

   (17) https://github.com/python/cpython/issues/117205

   (18) https://github.com/python/cpython/issues/117178

   (19) https://github.com/python/cpython/issues/114781

   (20) https://github.com/python/cpython/issues/112383

   (21) https://github.com/python/cpython/issues/117182

   (22) https://github.com/python/cpython/issues/117084

   (23) https://github.com/python/cpython/issues/117114

   (24) https://github.com/python/cpython/issues/117110

   (25) https://github.com/python/cpython/issues/109653

   (26) https://github.com/python/cpython/issues/70647

   (27) https://github.com/python/cpython/issues/116987

   (28) https://github.com/python/cpython/issues/114099

   (29) https://github.com/python/cpython/issues/90872

   (30) https://github.com/python/cpython/issues/116957

   (31) https://github.com/python/cpython/issues/115538

   (32) https://github.com/python/cpython/issues/90095

   (33) https://github.com/python/cpython/issues/106531

   (34) https://zipp.readthedocs.io/en/latest/history.html#v3-18-0

   (35) https://github.com/python/cpython/issues/63207

   (36) https://github.com/python/cpython/issues/116764

   (37) https://github.com/python/cpython/issues/116811

   (38) https://github.com/python/cpython/issues/116647

   (39) https://github.com/python/cpython/issues/113171

   (40) https://github.com/python/cpython/issues/63283

   (41) https://github.com/python/cpython/issues/71042

   (42) https://github.com/python/cpython/issues/73468

   (43) https://github.com/python/cpython/issues/116608

   (44) https://github.com/python/cpython/issues/116484

   (45) https://github.com/python/cpython/issues/114314

   (46) https://github.com/python/cpython/issues/116401

   (47) https://github.com/python/cpython/issues/71052

   (48) https://github.com/python/cpython/issues/90535

   (49) https://github.com/python/cpython/issues/113308

   (50) https://github.com/python/cpython/issues/115627

   (51) https://github.com/python/cpython/issues/114847

   (52) https://github.com/python/cpython/issues/114271

   (53) https://github.com/python/cpython/issues/113538

   (54) https://github.com/python/cpython/issues/85287

   (55) https://github.com/python/cpython/issues/113548

   (56) https://github.com/python/cpython/issues/112948

   (57) https://github.com/python/cpython/issues/105866

   (58) https://github.com/python/cpython/issues/96471

   (59) https://github.com/python/cpython/issues/89739

   (60) https://bugs.python.org/issue?@action=redirect&bpo=33533

   (61) https://bugs.python.org/issue?@action=redirect&bpo=27578

   (62) https://bugs.python.org/issue?@action=redirect&bpo=37141

   (63) https://github.com/python/cpython/issues/66543

   (64) https://bugs.python.org/issue?@action=redirect&bpo=15010


File: python.info,  Node: ドキュメント<16>,  Next: テスト<14>,  Prev: ライブラリ<57>,  Up: Python 3 13 0 alpha 6

1.24.21.5 ドキュメント
......................

   - gh-115977(1): Remove compatibility references to Emscripten.

   - gh-114099(2): Add an iOS platform guide, and flag modules not
     available on iOS.

   - gh-91565(3): Changes to documentation files and config outputs to
     reflect the new location for reporting bugs - i.e.  GitHub rather
     than bugs.python.org.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115977

   (2) https://github.com/python/cpython/issues/114099

   (3) https://github.com/python/cpython/issues/91565


File: python.info,  Node: テスト<14>,  Next: ビルド<17>,  Prev: ドキュメント<16>,  Up: Python 3 13 0 alpha 6

1.24.21.6 テスト
................

   - gh-83434(1): Disable JUnit XML output (‘--junit-xml=FILE’ command
     line option) in regrtest when hunting for reference leaks (‘-R’
     option).  Patch by Victor Stinner.

   - gh-117187(2): Fix XML tests for vanilla Expat <2.6.0.

   - gh-116333(3): Tests of TLS related things (error codes, etc) were
     updated to be more lenient about specific error message strings and
     behaviors as seen in the BoringSSL and AWS-LC forks of OpenSSL.

   - gh-117089(4): Consolidated tests for importlib.metadata in their
     own ‘metadata’ package.

   - gh-115979(5): Update test_importlib so that it passes under WASI
     SDK 21.

   - gh-112536(6): Add -tsan to test.regrtest for running TSAN tests in
     reasonable execution times.  Patch by Donghee Na.

   - gh-116307(7): Added import helper ‘isolated_modules’ as
     ‘CleanImport’ does not remove modules imported during the context.
     Use it in importlib.resources tests to avoid leaving ‘mod’ around
     to impede importlib.metadata tests.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/83434

   (2) https://github.com/python/cpython/issues/117187

   (3) https://github.com/python/cpython/issues/116333

   (4) https://github.com/python/cpython/issues/117089

   (5) https://github.com/python/cpython/issues/115979

   (6) https://github.com/python/cpython/issues/112536

   (7) https://github.com/python/cpython/issues/116307


File: python.info,  Node: ビルド<17>,  Next: Windows<16>,  Prev: テスト<14>,  Up: Python 3 13 0 alpha 6

1.24.21.7 ビルド
................

   - gh-114736(1): Have WASI builds use WASI SDK 21.

   - gh-115983(2): Skip building test modules that must be built as
     shared under WASI.

   - gh-71052(3): Add Android build script and instructions.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/114736

   (2) https://github.com/python/cpython/issues/115983

   (3) https://github.com/python/cpython/issues/71052


File: python.info,  Node: Windows<16>,  Next: C API<17>,  Prev: ビルド<17>,  Up: Python 3 13 0 alpha 6

1.24.21.8 Windows
.................

   - gh-117267(1): Ensure ‘DirEntry.stat().st_ctime’ behaves
     consistently with *note os.stat(): 26d. during the deprecation
     period of ‘st_ctime’ by containing the same value as
     ‘st_birthtime’.  After the deprecation period, ‘st_ctime’ will be
     the metadata change time (or unavailable through ‘DirEntry’), and
     only ‘st_birthtime’ will contain the creation time.

   - gh-116195(2): Improves performance of *note os.getppid(): 19cc. by
     using an alternate system API when available.  Contributed by
     vxiiduu.

   - gh-88494(3): On Windows, *note time.monotonic(): 55c. now uses the
     ‘QueryPerformanceCounter()’ clock to have a resolution better than
     1 us, instead of the ‘GetTickCount64()’ clock which has a
     resolution of 15.6 ms.  Patch by Victor Stinner.

   - gh-116773(4): Fix instances of ‘<_overlapped.Overlapped object at
     0xXXX> still has pending operation at deallocation, the process may
     crash’.

   - gh-91227(5): Fix the asyncio ProactorEventLoop implementation so
     that sending a datagram to an address that is not listening does
     not prevent receiving any more datagrams.

   - gh-115119(6): Switched from vendored ‘libmpdecimal’ code to a
     separately-hosted external package in the ‘cpython-source-deps’
     repository when building the ‘_decimal’ module.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/117267

   (2) https://github.com/python/cpython/issues/116195

   (3) https://github.com/python/cpython/issues/88494

   (4) https://github.com/python/cpython/issues/116773

   (5) https://github.com/python/cpython/issues/91227

   (6) https://github.com/python/cpython/issues/115119


File: python.info,  Node: C API<17>,  Prev: Windows<16>,  Up: Python 3 13 0 alpha 6

1.24.21.9 C API
...............

   - gh-117642(1): Fix PEP 737(2) implementation for ‘%#T’ and ‘%#N’.

   - gh-87193(3): *note _PyBytes_Resize(): 19ce. can now be called for
     bytes objects with reference count > 1, including 1-byte bytes
     objects.  It creates a new bytes object and destroys the old one if
     it has reference count > 1.

   - gh-117021(4): Fix integer overflow in *note PyLong_AsPid(): 19cf.
     on non-Windows 64-bit platforms.

   - gh-115756(5): ‘PyCode_GetFirstFree()’ is an ustable API now and has
     been renamed to *note PyUnstable_Code_GetFirstFree(): 627.
     (Contributed by Bogdan Romanyuk in gh-115781(6))

   - gh-116869(7): Add ‘test_cext’ test: build a C extension to check if
     the Python C API emits C compiler warnings.  Patch by Victor
     Stinner.

   - gh-116869(8): Make the C API compatible with
     ‘-Werror=declaration-after-statement’ compiler flag again.  Patch
     by Victor Stinner.

   - gh-116936(9): Add *note PyType_GetModuleByDef(): 635. to the
     limited C API. Patch by Victor Stinner.

   - gh-116809(10): Restore removed private ‘_PyErr_ChainExceptions1()’
     function.  Patch by Victor Stinner.

   - gh-115754(11): In the limited C API version 3.13, getting
     ‘Py_None’, ‘Py_False’, ‘Py_True’, ‘Py_Ellipsis’ and
     ‘Py_NotImplemented’ singletons is now implemented as function calls
     at the stable ABI level to hide implementation details.  Getting
     these constants still return borrowed references.  Patch by Victor
     Stinner.

   - gh-115754(12): Add *note Py_GetConstant(): 5f9. and *note
     Py_GetConstantBorrowed(): 5fa. functions to get constants.  For
     example, ‘Py_GetConstant(Py_CONSTANT_ZERO)’ returns a *note strong
     reference: 5e2. to the constant zero.  Patch by Victor Stinner.

   - gh-111696(13): Add support for ‘%T’, ‘%T#’, ‘%N’ and ‘%N#’ formats
     to *note PyUnicode_FromFormat(): 62b.: format the fully qualified
     name of an object type and of a type: call *note
     PyType_GetModuleName(): 618.  See PEP 737(14) for more information.
     Patch by Victor Stinner.

   - gh-111696(15): Add *note PyType_GetModuleName(): 618. function to
     get the type's module name.  Equivalent to getting the
     ‘type.__module__’ attribute.  Patch by Eric Snow and Victor
     Stinner.

   - gh-111696(16): Add *note PyType_GetFullyQualifiedName(): 616.
     function to get the type's fully qualified name.  Equivalent to
     ‘f"{type.__module__}.{type.__qualname__}"’, or ‘type.__qualname__’
     if ‘type.__module__’ is not a string or is equal to ‘"builtins"’.
     Patch by Victor Stinner.

   - gh-85283(17): The ‘fcntl’, ‘grp’, ‘pwd’, ‘termios’, ‘_statistics’
     and ‘_testconsole’ C extensions are now built with the *note
     limited C API: 637.  Patch by Victor Stinner.

   - gh-111140(18): Add additional flags to *note
     PyLong_AsNativeBytes(): 606. and *note PyLong_FromNativeBytes():
     607. to allow the caller to determine how to handle edge cases
     around values that fill the entire buffer.

   - gh-113024(19): Add *note PyObject_GenericHash(): 60c. function.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/117642

   (2) https://peps.python.org/pep-0737/

   (3) https://github.com/python/cpython/issues/87193

   (4) https://github.com/python/cpython/issues/117021

   (5) https://github.com/python/cpython/issues/115756

   (6) https://github.com/python/cpython/issues/115781

   (7) https://github.com/python/cpython/issues/116869

   (8) https://github.com/python/cpython/issues/116869

   (9) https://github.com/python/cpython/issues/116936

   (10) https://github.com/python/cpython/issues/116809

   (11) https://github.com/python/cpython/issues/115754

   (12) https://github.com/python/cpython/issues/115754

   (13) https://github.com/python/cpython/issues/111696

   (14) https://peps.python.org/pep-0737/

   (15) https://github.com/python/cpython/issues/111696

   (16) https://github.com/python/cpython/issues/111696

   (17) https://github.com/python/cpython/issues/85283

   (18) https://github.com/python/cpython/issues/111140

   (19) https://github.com/python/cpython/issues/113024


File: python.info,  Node: Python 3 13 0 alpha 5,  Next: Python 3 13 0 alpha 4,  Prev: Python 3 13 0 alpha 6,  Up: 変更履歴

1.24.22 Python 3.13.0 alpha 5
-----------------------------

'Release date: 2024-03-12'

* Menu:

* セキュリティ: セキュリティ<18>.
* Core and Builtins: Core and Builtins<53>.
* ライブラリ: ライブラリ<58>.
* Core and Builtins: Core and Builtins<54>.
* ライブラリ: ライブラリ<59>.
* Core and Builtins: Core and Builtins<55>.
* ライブラリ: ライブラリ<60>.
* ドキュメント: ドキュメント<17>.
* テスト: テスト<15>.
* ビルド: ビルド<18>.
* Windows: Windows<17>.
* macOS: macOS<10>.
* IDLE: IDLE<9>.
* Tools/Demos: Tools/Demos<16>.
* C API: C API<18>.


File: python.info,  Node: セキュリティ<18>,  Next: Core and Builtins<53>,  Up: Python 3 13 0 alpha 5

1.24.22.1 セキュリティ
......................

   - gh-115398(1): Allow controlling Expat >=2.6.0 reparse deferral (
     CVE 2023-52425(2)) by adding five new methods:

        * *note xml.etree.ElementTree.XMLParser.flush(): 576.

        * *note xml.etree.ElementTree.XMLPullParser.flush(): 577.

        * *note xml.parsers.expat.xmlparser.GetReparseDeferralEnabled():
          578.

        * *note xml.parsers.expat.xmlparser.SetReparseDeferralEnabled():
          579.

        * ‘xml.sax.expatreader.ExpatParser.flush()’

   - gh-114572(3): *note ssl.SSLContext.cert_store_stats(): 11ae. and
     *note ssl.SSLContext.get_ca_certs(): 11af. now correctly lock
     access to the certificate store, when the *note ssl.SSLContext:
     357. is shared across multiple threads.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115398

   (2) https://www.cve.org/CVERecord?id=CVE-2023-52425

   (3) https://github.com/python/cpython/issues/114572


File: python.info,  Node: Core and Builtins<53>,  Next: ライブラリ<58>,  Prev: セキュリティ<18>,  Up: Python 3 13 0 alpha 5

1.24.22.2 Core and Builtins
...........................

   - gh-116604(1): Respect the status of the garbage collector when
     indirect calls are made via *note PyErr_CheckSignals(): 693. and
     the evaluation breaker.  Patch by Pablo Galindo

   - gh-112087(2): *note list: 24d. is now compatible with the
     implementation of PEP 703(3).

   - gh-116381(4): Add specialization for ‘CONTAINS_OP’.

   - gh-116296(5): Fix possible refleak in ‘object.__reduce__()’
     internal error handling.

   - gh-115823(6): Properly calculate error ranges in the parser when
     raising *note SyntaxError: 18e. exceptions caused by invalid byte
     sequences.  Patch by Pablo Galindo

   - gh-115778(7): Add ‘tierN’ annotation for instruction definition in
     interpreter DSL.

   - gh-115733(8): Fix crash when calling ‘next()’ on exhausted list
     iterators.

   - gh-115700(9): The regen-cases build stage now works on Windows.

   - gh-115347(10): Fix bug where docstring was replaced by a redundant
     NOP when Python is run with ‘-OO’.

   - gh-115323(11): Make error message more meaningful for when *note
     bytearray.extend(): 1791. is called with a *note str: 169. object.

   - gh-112175(12): Every ‘PyThreadState’ now has its own
     ‘eval_breaker’, allowing specific threads to be interrupted.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116604

   (2) https://github.com/python/cpython/issues/112087

   (3) https://peps.python.org/pep-0703/

   (4) https://github.com/python/cpython/issues/116381

   (5) https://github.com/python/cpython/issues/116296

   (6) https://github.com/python/cpython/issues/115823

   (7) https://github.com/python/cpython/issues/115778

   (8) https://github.com/python/cpython/issues/115733

   (9) https://github.com/python/cpython/issues/115700

   (10) https://github.com/python/cpython/issues/115347

   (11) https://github.com/python/cpython/issues/115323

   (12) https://github.com/python/cpython/issues/112175


File: python.info,  Node: ライブラリ<58>,  Next: Core and Builtins<54>,  Prev: Core and Builtins<53>,  Up: Python 3 13 0 alpha 5

1.24.22.3 ライブラリ
....................

   - gh-115154(1): Fix a bug that was causing the *note
     tokenize.untokenize(): 18b3. function to handle unicode named
     literals incorrectly.  Patch by Pablo Galindo

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115154


File: python.info,  Node: Core and Builtins<54>,  Next: ライブラリ<59>,  Prev: ライブラリ<58>,  Up: Python 3 13 0 alpha 5

1.24.22.4 Core and Builtins
...........................

   - gh-112433(1): Add ability to force alignment of *note
     ctypes.Structure: 1e5. by way of the new ‘_align_’ attribute on the
     class.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/112433


File: python.info,  Node: ライブラリ<59>,  Next: Core and Builtins<55>,  Prev: Core and Builtins<54>,  Up: Python 3 13 0 alpha 5

1.24.22.5 ライブラリ
....................

   - gh-104090(1): The multiprocessing resource tracker now exits with
     non-zero status code if a resource leak was detected.  It still
     exits with status code 0 otherwise.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104090


File: python.info,  Node: Core and Builtins<55>,  Next: ライブラリ<60>,  Prev: ライブラリ<59>,  Up: Python 3 13 0 alpha 5

1.24.22.6 Core and Builtins
...........................

   - gh-105858(1): Improve the constructors for *note ast: 9. nodes.
     Arguments of list types now default to an empty list if omitted,
     and optional fields default to ‘None’.  AST nodes now have an
     ‘__annotations__’ attribute with the expected types of their
     attributes.  Passing unrecognized extra arguments to AST nodes is
     deprecated and will become an error in Python 3.15.  Omitting a
     required argument to an AST node is deprecated and will become an
     error in Python 3.15.  Patch by Jelle Zijlstra.

   - gh-101860(2): Expose ‘__name__’ attribute on property.

   - gh-96497(3): Fix incorrect resolution of mangled class variables
     used in assignment expressions in comprehensions.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/105858

   (2) https://github.com/python/cpython/issues/101860

   (3) https://github.com/python/cpython/issues/96497


File: python.info,  Node: ライブラリ<60>,  Next: ドキュメント<17>,  Prev: Core and Builtins<55>,  Up: Python 3 13 0 alpha 5

1.24.22.7 ライブラリ
....................

   - gh-116600(1): Fix *note repr(): 1c1. for global *note Flag: 835.
     members.

   - gh-116349(2): *note platform.java_ver(): 32c. is deprecated and
     will be removed in 3.15.  It was largely untested, had a confusing
     API, and was only useful for Jython support.

   - gh-116143(3): Fix a race in pydoc ‘_start_server’, eliminating a
     window in which ‘_start_server’ can return a thread that is
     "serving" but without a ‘docserver’ set.

   - gh-116127(4): *note typing: 10a.: implement PEP 705(5) which adds
     *note typing.ReadOnly: 48a. support to *note typing.TypedDict: 332.

   - gh-116325(6): *note typing: 10a.: raise *note SyntaxError: 18e.
     instead of *note AttributeError: 5f0. on forward references as
     empty strings.

   - gh-115957(7): When ‘asyncio.TaskGroup.create_task’ is called on an
     inactive ‘asyncio.TaskGroup’, the given coroutine will be closed
     (which prevents a ‘RuntimeWarning’).

   - gh-115978(8): Disable preadv(), readv(), pwritev(), and writev() on
     WASI.

     Under wasmtime for WASI 0.2, these functions don't pass test_posix
     (‘https://github.com/bytecodealliance/wasmtime/issues/7830’).

   - gh-88352(9): Fix the computation of the next rollover time in the
     ‘logging.TimedRotatingFileHandler’ handler.  ‘computeRollover()’
     now always returns a timestamp larger than the specified time and
     works correctly during the DST change.  ‘doRollover()’ no longer
     overwrite the already rolled over file, saving from data loss when
     run at midnight or during repeated time at the DST change.

   - gh-87115(10): Set ‘__main__.__spec__’ to ‘None’ when running a
     script with *note pdb: aa.

   - gh-76511(11): Fix UnicodeEncodeError in ‘email.Message.as_string()’
     that results when a message that claims to be in the ascii
     character set actually has non-ascii characters.  Non-ascii
     characters are now replaced with the U+FFFD replacement character,
     like in the ‘replace’ error handler.

   - gh-89547(12): Add support for nested typing special forms like
     Final[ClassVar[int]].

   - gh-65824(13): Improve the ‘less’ prompt in *note pydoc: ba.

   - gh-116040(14): [Enum] fix by-value calls when second value is
     falsey; e.g.  Cardinal(1, 0)

   - gh-115821(15): [Enum] Improve error message when calling
     super().__new__() in custom __new__.

   - gh-85644(16): Use the ‘XDG_CURRENT_DESKTOP’ environment variable in
     *note webbrowser: 11b. to check desktop.  Prefer it to the
     deprecated ‘GNOME_DESKTOP_SESSION_ID’ for GNOME detection.

   - gh-75988(17): Fixed *note unittest.mock.create_autospec(): 1934. to
     pass the call through to the wrapped object to return the real
     result.

   - gh-115881(18): Fix issue where *note ast.parse(): 1c2. would
     incorrectly flag conditional context managers (such as ‘with (x()
     if y else z()): ...’) as invalid syntax if ‘feature_version=(3, 8)’
     was passed.  This reverts changes to the grammar made as part of
     gh-94949(19).

   - gh-115886(20): Fix silent truncation of the name with an embedded
     null character in *note multiprocessing.shared_memory.SharedMemory:
     19d8.

   - gh-115532(21): Add kernel density estimation to the statistics
     module.

   - gh-115714(22): On WASI, the *note time: f4. module no longer get
     process time using ‘times()’ or ‘CLOCK_PROCESS_CPUTIME_ID’, system
     API is that is unreliable and is likely to be removed from WASI.
     The affected clock functions fall back to calling ‘clock()’.

   - gh-115809(23): Improve algorithm for computing which rolled-over
     log files to delete in ‘logging.TimedRotatingFileHandler’.  It is
     now reliable for handlers without ‘namer’ and with arbitrary
     deterministic ‘namer’ that leaves the datetime part in the file
     name unmodified.

   - gh-74668(24): *note urllib.parse: 110. functions *note parse_qs():
     31f. and *note parse_qsl(): 31e. now support bytes arguments
     containing raw and percent-encoded non-ASCII data.

   - gh-67044(25): *note csv.writer(): 6af. now always quotes or escapes
     ‘'\r'’ and ‘'\n'’, regardless of 'lineterminator' value.

   - gh-115712(26): Restore support of space delimiter with
     ‘skipinitialspace=True’ in *note csv: 2d.  *note csv.writer(): 6af.
     now quotes empty fields if delimiter is a space and
     skipinitialspace is true and raises exception if quoting is not
     possible.

   - gh-112364(27): Fixed *note ast.unparse(): ae2. to handle
     format_spec with ‘"’, ‘'’ or ‘\\’.  Patched by Frank Hoffmann.

   - gh-112997(28): Stop logging potentially sensitive callback
     arguments in *note asyncio: b. unless debug mode is active.

   - gh-114914(29): Fix an issue where an abandoned ‘StreamWriter’ would
     not be garbage collected.

   - gh-111358(30): Fix a bug in
     ‘asyncio.BaseEventLoop.shutdown_default_executor()’ to ensure the
     timeout passed to the coroutine behaves as expected.

   - gh-115618(31): Fix improper decreasing the reference count for
     ‘None’ argument in *note property: 4b3. methods *note getter():
     19d9, *note setter(): 19da. and *note deleter(): 19db.

   - gh-112720(32): Refactor ‘dis.ArgResolver’ to make it possible to
     subclass and change the way jump args are interpreted.

   - gh-112006(33): Fix *note inspect.unwrap(): 115e. for types with the
     ‘__wrapper__’ data descriptor.  Fix *note
     inspect.Signature.from_callable(): 942. for builtins *note
     classmethod(): 48e. and *note staticmethod(): 453.

   - gh-101293(34): Support callables with the ‘__call__()’ method and
     types with ‘__new__()’ and ‘__init__()’ methods set to class
     methods, static methods, bound methods, partial functions, and
     other types of methods and descriptors in *note
     inspect.Signature.from_callable(): 942.

   - gh-103092(35): Isolate ‘_lsprof’ (apply PEP 687(36)).

   - gh-113942(37): *note pydoc: ba. no longer skips global functions
     implemented as builtin methods, such as ‘MethodDescriptorType’ and
     ‘WrapperDescriptorType’.

   - gh-115256(38): Added DeprecationWarning when accessing the tarfile
     attribute of TarInfo objects.  The attribute is never used
     internally and is only attached to TarInfos when the tarfile is
     opened in write-mode, not read-mode.  The attribute creates an
     unnecessary reference cycle which may cause corruption when not
     closing the handle after writing a tarfile.

   - gh-115197(39): ‘urllib.request’ no longer resolves the hostname
     before checking it against the system's proxy bypass list on macOS
     and Windows.

   - gh-113812(40): ‘DatagramTransport.sendto()’ will now send
     zero-length datagrams if called with an empty bytes object.  The
     transport flow control also now accounts for the datagram header
     when calculating the buffer size.

   - gh-114763(41): Protect modules loaded with *note
     importlib.util.LazyLoader: eab. from race conditions when multiple
     threads try to access attributes before the loading is complete.

   - gh-114709(42): ‘posixpath.commonpath()’ now raises a *note
     ValueError: 2ec. exception when passed an empty iterable.
     Previously, *note IndexError: 174e. was raised.

     ‘posixpath.commonpath()’ now raises a *note TypeError: 198.
     exception when passed ‘None’.  Previously, *note ValueError: 2ec.
     was raised.

   - gh-114610(43): Fix bug where *note pathlib.PurePath.with_stem():
     19dc. converted a non-empty path suffix to a stem when given an
     empty 'stem' argument.  It now raises *note ValueError: 2ec, just
     like *note pathlib.PurePath.with_suffix(): 1956. does when called
     on a path with an empty stem, given a non-empty 'suffix' argument.

   - gh-107361(44): Add *note ssl.VERIFY_X509_PARTIAL_CHAIN: 481. and
     ‘VERIFY_X509_STRICT’ to the default SSL context created with *note
     ssl.create_default_context(): 480.

   - gh-112281(45): Allow creating *note union of types: 9c5. for *note
     typing.Annotated: b37. with unhashable metadata.

   - gh-111775(46): Fix
     ‘importlib.resources.simple.ResourceHandle.open()’ for text mode,
     added missed ‘stream’ argument.

   - gh-90095(47): Make .pdbrc and -c work with any valid pdb commands.

   - gh-107625(48): Raise *note configparser.ParsingError: 729. from
     *note read(): 1681. and *note read_file(): 72a. methods of *note
     configparser.ConfigParser: 4de. if a key without a corresponding
     value is continued (that is, followed by an indented line).

   - gh-107155(49): Fix incorrect output of ‘help(x)’ where ‘x’ is a
     *note lambda: 14b5. function, which has an ‘__annotations__’
     dictionary attribute with a ‘"return"’ key.

   - gh-57141(50): Add option for 'non-shallow' comparisons to *note
     filecmp.dircmp: 1142. like *note filecmp.cmp(): 19dd.  Original
     patch by Steven Ward.  Enhanced by Tobias Rautenkranz

   - gh-69990(51): ‘Profile.print_stats()’ has been improved to accept
     multiple sort arguments.  Patched by Chiu-Hsiang Hsu and Furkan
     Onder.

   - gh-104061(52): Add ‘socket.SO_BINDTOIFINDEX’ constant.

   - gh-60346(53): Fix ArgumentParser inconsistent with
     parse_known_args.

   - gh-102389(54): Add ‘windows_31j’ to aliases for ‘cp932’ codec

   - gh-72249(55): Always include the *note module: 19de. name in the
     *note repr(): 1c1. of *note functools.partial(): 217. objects.
     Patch by Furkan Onder and Anilyka Barry.

   - gh-100985(56): Update HTTPSConnection to consistently wrap IPv6
     Addresses when using a proxy.

   - gh-100884(57): email: fix misfolding of comma in address-lists over
     multiple lines in combination with unicode encoding.

   - gh-95782(58): Fix ‘io.BufferedReader.tell()’,
     ‘io.BufferedReader.seek()’, ‘_pyio.BufferedReader.tell()’,
     ‘io.BufferedRandom.tell()’, ‘io.BufferedRandom.seek()’ and
     ‘_pyio.BufferedRandom.tell()’ being able to return negative
     offsets.

   - gh-96310(59): Fix a traceback in *note argparse: 7. when all
     options in a mutually exclusive group are suppressed.

   - gh-93205(60): Fixed a bug in *note
     logging.handlers.TimedRotatingFileHandler: 1163. where multiple
     rotating handler instances pointing to files with the same name but
     different extensions would conflict and not delete the correct
     files.

   - bpo-31116(61): Add Z85 encoding to ‘base64’.

   - bpo-44865(62): Add missing call to localization function in *note
     argparse: 7.

   - bpo-43952(63): Fix *note
     multiprocessing.connection.Listener.accept(): 19df. to accept empty
     bytes as authkey.  Not accepting empty bytes as key causes it to
     hang indefinitely.

   - bpo-42125(64): linecache: get module name from ‘__spec__’ if
     available.  This allows getting source code for the ‘__main__’
     module when a custom loader is used.

   - bpo-41122(65): Failing to pass arguments properly to *note
     functools.singledispatchmethod(): be5. now throws a TypeError
     instead of hitting an index out of bounds internally.

   - bpo-40818(66): The asyncio REPL now runs *note
     sys.__interactivehook__: 11ca. on startup.  The default
     implementation of *note sys.__interactivehook__: 11ca. provides
     auto-completion to the asyncio REPL. Patch contributed by Rémi
     Lapeyre.

   - bpo-33775(67): Add 'default' and 'version' help text for
     localization in argparse.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116600

   (2) https://github.com/python/cpython/issues/116349

   (3) https://github.com/python/cpython/issues/116143

   (4) https://github.com/python/cpython/issues/116127

   (5) https://peps.python.org/pep-0705/

   (6) https://github.com/python/cpython/issues/116325

   (7) https://github.com/python/cpython/issues/115957

   (8) https://github.com/python/cpython/issues/115978

   (9) https://github.com/python/cpython/issues/88352

   (10) https://github.com/python/cpython/issues/87115

   (11) https://github.com/python/cpython/issues/76511

   (12) https://github.com/python/cpython/issues/89547

   (13) https://github.com/python/cpython/issues/65824

   (14) https://github.com/python/cpython/issues/116040

   (15) https://github.com/python/cpython/issues/115821

   (16) https://github.com/python/cpython/issues/85644

   (17) https://github.com/python/cpython/issues/75988

   (18) https://github.com/python/cpython/issues/115881

   (19) https://github.com/python/cpython/issues/94949

   (20) https://github.com/python/cpython/issues/115886

   (21) https://github.com/python/cpython/issues/115532

   (22) https://github.com/python/cpython/issues/115714

   (23) https://github.com/python/cpython/issues/115809

   (24) https://github.com/python/cpython/issues/74668

   (25) https://github.com/python/cpython/issues/67044

   (26) https://github.com/python/cpython/issues/115712

   (27) https://github.com/python/cpython/issues/112364

   (28) https://github.com/python/cpython/issues/112997

   (29) https://github.com/python/cpython/issues/114914

   (30) https://github.com/python/cpython/issues/111358

   (31) https://github.com/python/cpython/issues/115618

   (32) https://github.com/python/cpython/issues/112720

   (33) https://github.com/python/cpython/issues/112006

   (34) https://github.com/python/cpython/issues/101293

   (35) https://github.com/python/cpython/issues/103092

   (36) https://peps.python.org/pep-0687/

   (37) https://github.com/python/cpython/issues/113942

   (38) https://github.com/python/cpython/issues/115256

   (39) https://github.com/python/cpython/issues/115197

   (40) https://github.com/python/cpython/issues/113812

   (41) https://github.com/python/cpython/issues/114763

   (42) https://github.com/python/cpython/issues/114709

   (43) https://github.com/python/cpython/issues/114610

   (44) https://github.com/python/cpython/issues/107361

   (45) https://github.com/python/cpython/issues/112281

   (46) https://github.com/python/cpython/issues/111775

   (47) https://github.com/python/cpython/issues/90095

   (48) https://github.com/python/cpython/issues/107625

   (49) https://github.com/python/cpython/issues/107155

   (50) https://github.com/python/cpython/issues/57141

   (51) https://github.com/python/cpython/issues/69990

   (52) https://github.com/python/cpython/issues/104061

   (53) https://github.com/python/cpython/issues/60346

   (54) https://github.com/python/cpython/issues/102389

   (55) https://github.com/python/cpython/issues/72249

   (56) https://github.com/python/cpython/issues/100985

   (57) https://github.com/python/cpython/issues/100884

   (58) https://github.com/python/cpython/issues/95782

   (59) https://github.com/python/cpython/issues/96310

   (60) https://github.com/python/cpython/issues/93205

   (61) https://bugs.python.org/issue?@action=redirect&bpo=31116

   (62) https://bugs.python.org/issue?@action=redirect&bpo=44865

   (63) https://bugs.python.org/issue?@action=redirect&bpo=43952

   (64) https://bugs.python.org/issue?@action=redirect&bpo=42125

   (65) https://bugs.python.org/issue?@action=redirect&bpo=41122

   (66) https://bugs.python.org/issue?@action=redirect&bpo=40818

   (67) https://bugs.python.org/issue?@action=redirect&bpo=33775


File: python.info,  Node: ドキュメント<17>,  Next: テスト<15>,  Prev: ライブラリ<60>,  Up: Python 3 13 0 alpha 5

1.24.22.8 ドキュメント
......................

   - gh-115399(1): Document CVE 2023-52425(2) of Expat <2.6.0 under "XML
     vulnerabilities".

   - gh-109653(3): Improve import time of *note uuid: 116. on Linux.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115399

   (2) https://www.cve.org/CVERecord?id=CVE-2023-52425

   (3) https://github.com/python/cpython/issues/109653


File: python.info,  Node: テスト<15>,  Next: ビルド<18>,  Prev: ドキュメント<17>,  Up: Python 3 13 0 alpha 5

1.24.22.9 テスト
................

   - gh-71052(1): Add test exclusions to support running the test suite
     on Android.

   - gh-71052(2): Enable ‘test_concurrent_futures’ on platforms that
     support threading but not multiprocessing.

   - gh-115796(3): Make '_testinternalcapi.assemble_code_object'
     construct the exception table for the code object.

   - gh-115720(4): Leak tests (‘-R’, ‘--huntrleaks’) now show a summary
     of the number of leaks found in each iteration.

   - gh-115122(5): Add ‘--bisect’ option to regrtest test runner: run
     failed tests with ‘test.bisect_cmd’ to identify failing tests.
     Patch by Victor Stinner.

   - gh-115596(6): Fix ‘ProgramPriorityTests’ in ‘test_os’ permanently
     changing the process priority.

   - gh-115556(7): On Windows, commas passed in arguments to
     ‘Tools\buildbot\test.bat’ and ‘PCbuild\\rt.bat’ are now properly
     handled.

   - gh-115420(8): Fix translation of exception handler targets by
     ‘_testinternalcapi.optimize_cfg’.

   - gh-115376(9): Fix segfault in ‘_testinternalcapi.compiler_codegen’
     on bad input.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/71052

   (2) https://github.com/python/cpython/issues/71052

   (3) https://github.com/python/cpython/issues/115796

   (4) https://github.com/python/cpython/issues/115720

   (5) https://github.com/python/cpython/issues/115122

   (6) https://github.com/python/cpython/issues/115596

   (7) https://github.com/python/cpython/issues/115556

   (8) https://github.com/python/cpython/issues/115420

   (9) https://github.com/python/cpython/issues/115376


File: python.info,  Node: ビルド<18>,  Next: Windows<17>,  Prev: テスト<15>,  Up: Python 3 13 0 alpha 5

1.24.22.10 ビルド
.................

   - gh-116313(1): Get WASI builds to work under wasmtime 18 w/ WASI
     0.2/preview2 primitives.

   - gh-71052(2): Change Android's *note sys.platform: 291. from
     ‘"linux"’ to ‘"android"’.

   - gh-116117(3): Backport ‘libb2’'s PR #42 to fix compiling CPython on
     32-bit Windows with ‘clang-cl’.

   - gh-71052(4): Fix several Android build issues

   - gh-114099(5): A testbed project was added to run the test suite on
     iOS.

   - gh-115350(6): Fix building ctypes module with -DWIN32_LEAN_AND_MEAN
     defined

   - gh-111225(7): Link extension modules against libpython on Android.

   - gh-115737(8): The install name for libPython is now correctly set
     for non-framework macOS builds.

   - gh-114099(9): Makefile targets were added to support compiling an
     iOS-compatible framework build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116313

   (2) https://github.com/python/cpython/issues/71052

   (3) https://github.com/python/cpython/issues/116117

   (4) https://github.com/python/cpython/issues/71052

   (5) https://github.com/python/cpython/issues/114099

   (6) https://github.com/python/cpython/issues/115350

   (7) https://github.com/python/cpython/issues/111225

   (8) https://github.com/python/cpython/issues/115737

   (9) https://github.com/python/cpython/issues/114099


File: python.info,  Node: Windows<17>,  Next: macOS<10>,  Prev: ビルド<18>,  Up: Python 3 13 0 alpha 5

1.24.22.11 Windows
..................

   - gh-116012(1): Ensure the value of ‘GetLastError()’ is preserved
     across GIL operations.

   - gh-115582(2): Building extensions intended for free-threaded builds
     of CPython now require compiling with ‘/DPy_GIL_DISABLED’ manually
     when using a regular install.  This is expected to change in future
     releases.

   - gh-115554(3): The installer now has more strict rules about
     updating the *note Python install manager: 7da.  In general, most
     users only have a single launcher installed and will see no
     difference.  When multiple launchers have been installed, the
     option to install the launcher is disabled until all but one have
     been removed.  Downgrading the launcher (which was never allowed)
     is now more obviously blocked.

   - gh-115543(4): *note Python install manager: 7da. can now detect
     Python 3.13 when installed from the Microsoft Store, and will
     install Python 3.12 by default when ‘PYLAUNCHER_ALLOW_INSTALL’ is
     set.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116012

   (2) https://github.com/python/cpython/issues/115582

   (3) https://github.com/python/cpython/issues/115554

   (4) https://github.com/python/cpython/issues/115543


File: python.info,  Node: macOS<10>,  Next: IDLE<9>,  Prev: Windows<17>,  Up: Python 3 13 0 alpha 5

1.24.22.12 macOS
................

   - gh-116145(1): Update macOS installer to Tcl/Tk 8.6.14.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/116145


File: python.info,  Node: IDLE<9>,  Next: Tools/Demos<16>,  Prev: macOS<10>,  Up: Python 3 13 0 alpha 5

1.24.22.13 IDLE
...............

   - gh-88516(1): On macOS show a proxy icon in the title bar of editor
     windows to match platform behaviour.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/88516


File: python.info,  Node: Tools/Demos<16>,  Next: C API<18>,  Prev: IDLE<9>,  Up: Python 3 13 0 alpha 5

1.24.22.14 Tools/Demos
......................

   - gh-100176(1): Remove outdated Tools/{io,cc,string}bench

   - bpo-45101(2): Add consistency in usage message IO between 2
     versions of python-config.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100176

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45101


File: python.info,  Node: C API<18>,  Prev: Tools/Demos<16>,  Up: Python 3 13 0 alpha 5

1.24.22.15 C API
................

   - gh-114626(1): Add again ‘_PyCFunctionFastWithKeywords’ name,
     removed in Python 3.13 alpha 4 by mistake.  Keep the old private
     ‘_PyCFunctionFastWithKeywords’ name (Python 3.7) as an alias to the
     new public name ‘PyCFunctionFastWithKeywords’ (Python 3.13a4).
     Patch by Victor Stinner.

   - gh-111418(2): Add *note PyHASH_MODULUS: 19e8, *note PyHASH_BITS:
     19e9, *note PyHASH_INF: 19ea. and *note PyHASH_IMAG: 19eb. C
     macros.  Patch by Sergey B Kirpichev.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/114626

   (2) https://github.com/python/cpython/issues/111418


File: python.info,  Node: Python 3 13 0 alpha 4,  Next: Python 3 13 0 alpha 3,  Prev: Python 3 13 0 alpha 5,  Up: 変更履歴

1.24.23 Python 3.13.0 alpha 4
-----------------------------

'Release date: 2024-02-15'

* Menu:

* セキュリティ: セキュリティ<19>.
* Core and Builtins: Core and Builtins<56>.
* ライブラリ: ライブラリ<61>.
* ドキュメント: ドキュメント<18>.
* テスト: テスト<16>.
* ビルド: ビルド<19>.
* Windows: Windows<18>.
* macOS: macOS<11>.
* IDLE: IDLE<10>.
* Tools/Demos: Tools/Demos<17>.
* C API: C API<19>.


File: python.info,  Node: セキュリティ<19>,  Next: Core and Builtins<56>,  Up: Python 3 13 0 alpha 4

1.24.23.1 セキュリティ
......................

   - gh-115399(1): Update bundled libexpat to 2.6.0

   - gh-115243(2): Fix possible crashes in *note
     collections.deque.index(): fd0. when the deque is concurrently
     modified.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115399

   (2) https://github.com/python/cpython/issues/115243


File: python.info,  Node: Core and Builtins<56>,  Next: ライブラリ<61>,  Prev: セキュリティ<19>,  Up: Python 3 13 0 alpha 4

1.24.23.2 Core and Builtins
...........................

   - gh-112087(1): For an empty reverse iterator for list will be
     reduced to *note reversed(): a65.  Patch by Donghee Na

   - gh-114570(2): Add *note PythonFinalizationError: 47a. exception.
     This exception derived from *note RuntimeError: 244. is raised when
     an operation is blocked during the *note Python finalization: 479.
     Patch by Victor Stinner.

   - gh-114695(3): Add *note sys._clear_internal_caches(): 364, which
     clears all internal performance-related caches (and deprecate the
     less-general *note sys._clear_type_cache(): 292. function).

   - gh-114828(4): Fix compilation crashes in uncommon code examples
     using *note super(): 1a6. inside a comprehension in a class body.

   - gh-112069(5): Adapt *note set: 184. and *note frozenset: 7f2.
     methods to Argument Clinic.

   - gh-115011(6): Setters for members with an unsigned integer type now
     support the same range of valid values for objects that has a *note
     __index__(): 19e. method as for *note int: 19b.

   - gh-114887(7): Changed socket type validation in *note
     create_datagram_endpoint(): 93c. to accept all non-stream sockets.
     This fixes a regression in compatibility with raw sockets.

   - gh-114944(8): Fixes a race between ‘PyParkingLot_Park’ and
     ‘_PyParkingLot_UnparkAll’.

   - gh-113462(9): Limit the number of versions that a single class can
     use.  Prevents a few wayward classes using up all the version
     numbers.

   - gh-76763(10): The *note chr(): 19ef. builtin function now always
     raises *note ValueError: 2ec. for values outside the valid range.
     Previously it raised *note OverflowError: a81. for very large or
     small values.

   - gh-114806(11): No longer specialize calls to classes, if those
     classes have metaclasses.  Fixes bug where the ‘__call__’ method of
     the metaclass was not being called.

   - gh-107944(12): Improve error message for function calls with bad
     keyword arguments via getargs

   - gh-112529(13): The free-threaded build no longer allocates space
     for the ‘PyGC_Head’ structure in objects that support cyclic
     garbage collection.  A number of other fields and data structures
     are used as replacements, including ‘ob_gc_bits’, ‘ob_tid’, and
     mimalloc internal data structures.

   - gh-114456(14): Lower the recursion limit under a debug build of
     WASI.

   - gh-114083(15): Compiler applies folding of LOAD_CONST with
     following instruction in a separate pass before other
     optimisations.  This enables jump threading in certain
     circumstances.

   - gh-114388(16): Fix a *note RuntimeWarning: 4d7. emitted when assign
     an integer-like value that is not an instance of *note int: 19b. to
     an attribute that corresponds to a C struct member of *note type:
     19f0. T_UINT and T_ULONG. Fix a double *note RuntimeWarning: 4d7.
     emitted when assign a negative integer value to an attribute that
     corresponds to a C struct member of type T_UINT.

   - gh-114265(17): Compiler propagates line numbers before
     optimization, leading to more optimization opportunities and
     removing the need for the ‘guarantee_lineno_for_exits’ hack.

   - gh-112529(18): The free-threaded build now has its own thread-safe
     GC implementation that uses mimalloc to find GC tracked objects.
     It is non-generational, unlike the existing GC implementation.

   - gh-114050(19): Fix segmentation fault caused by an incorrect format
     string in ‘TypeError’ exception when more than two arguments are
     passed to ‘int’.

   - gh-112354(20): The ‘END_FOR’ instruction now pops only one value.
     This is to better support side exits in loops.

   - gh-113884(21): Make *note queue.SimpleQueue: d61. thread safe when
     the GIL is disabled.

   - gh-114058(22): Implement the foundations of the Tier 2 redundancy
     eliminator.

   - gh-113939(23): frame.clear(): Clear frame.f_locals as well, and not
     only the fast locals.  This is relevant once frame.f_locals was
     accessed, which would contain also references to all the locals.

   - gh-112050(24): Convert *note collections.deque: 7f4. to use
     Argument Clinic.

   - gh-112050(25): Make methods on *note collections.deque: 7f4.
     thread-safe when the GIL is disabled.

   - gh-113464(26): Add an option (‘--enable-experimental-jit’ for
     ‘configure’-based builds or ‘--experimental-jit’ for
     ‘PCbuild’-based ones) to build an 'experimental' just-in-time
     compiler, based on copy-and-patch(27)

   - gh-113055(28): Make interp->obmalloc a pointer.  For interpreters
     that share state with the main interpreter, this points to the same
     static memory structure.  For interpreters with their own obmalloc
     state, it is heap allocated.  Add free_obmalloc_arenas() which will
     free the obmalloc arenas and radix tree structures for interpreters
     with their own obmalloc state.

   - gh-55664(29): Add warning when creating *note type: f44. using a
     namespace dictionary with non-string keys.  Patched by Daniel Urban
     and Furkan Onder.

   - gh-104530(30): Use native Win32 condition variables.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/112087

   (2) https://github.com/python/cpython/issues/114570

   (3) https://github.com/python/cpython/issues/114695

   (4) https://github.com/python/cpython/issues/114828

   (5) https://github.com/python/cpython/issues/112069

   (6) https://github.com/python/cpython/issues/115011

   (7) https://github.com/python/cpython/issues/114887

   (8) https://github.com/python/cpython/issues/114944

   (9) https://github.com/python/cpython/issues/113462

   (10) https://github.com/python/cpython/issues/76763

   (11) https://github.com/python/cpython/issues/114806

   (12) https://github.com/python/cpython/issues/107944

   (13) https://github.com/python/cpython/issues/112529

   (14) https://github.com/python/cpython/issues/114456

   (15) https://github.com/python/cpython/issues/114083

   (16) https://github.com/python/cpython/issues/114388

   (17) https://github.com/python/cpython/issues/114265

   (18) https://github.com/python/cpython/issues/112529

   (19) https://github.com/python/cpython/issues/114050

   (20) https://github.com/python/cpython/issues/112354

   (21) https://github.com/python/cpython/issues/113884

   (22) https://github.com/python/cpython/issues/114058

   (23) https://github.com/python/cpython/issues/113939

   (24) https://github.com/python/cpython/issues/112050

   (25) https://github.com/python/cpython/issues/112050

   (26) https://github.com/python/cpython/issues/113464

   (27) https://fredrikbk.com/publications/copy-and-patch.pdf

   (28) https://github.com/python/cpython/issues/113055

   (29) https://github.com/python/cpython/issues/55664

   (30) https://github.com/python/cpython/issues/104530


File: python.info,  Node: ライブラリ<61>,  Next: ドキュメント<18>,  Prev: Core and Builtins<56>,  Up: Python 3 13 0 alpha 4

1.24.23.3 ライブラリ
....................

   - gh-115392(1): Fix a bug in *note doctest: 3e. where incorrect line
     numbers would be reported for decorated functions.

   - gh-114563(2): Fix several *note format(): 199. bugs when using the
     C implementation of *note Decimal: 1fe.: * memory leak in some rare
     cases when using the ‘z’ format option (coerce negative 0) *
     incorrect output when applying the ‘z’ format option to type ‘F’
     (fixed-point with capital ‘NAN’ / ‘INF’) * incorrect output when
     applying the ‘#’ format option (alternate form)

   - gh-102840(3): Fix confused traceback when floordiv, mod, or divmod
     operations happens between instances of *note fractions.Fraction:
     213. and *note complex: 197.

   - gh-115165(4): Most exceptions are now ignored when attempting to
     set the ‘__orig_class__’ attribute on objects returned when calling
     *note typing: 10a. generic aliases (including generic aliases
     created using *note typing.Annotated: b37.).  Previously only *note
     AttributeError: 5f0. was ignored.  Patch by Dave Shawley.

   - gh-112903(5): Fix "issubclass() arg 1 must be a class" errors in
     certain cases of multiple inheritance with generic aliases
     (regression in early 3.13 alpha releases).

   - gh-115133(6): Fix tests for *note XMLPullParser: 11f5. with Expat
     2.6.0.

   - gh-115059(7): ‘io.BufferedRandom.read1()’ now flushes the
     underlying write buffer.

   - gh-79382(8): Trailing ‘**’ no longer allows to match files and
     non-existing paths in recursive *note glob(): 5a0.

   - gh-67837(9): Avoid race conditions in the creation of directories
     during concurrent extraction in *note tarfile: e4. and *note
     zipfile: 137.

   - gh-115060(10): Speed up *note pathlib.Path.glob(): 537. by removing
     redundant regex matching.

   - gh-97928(11): Partially revert the behavior of
     ‘tkinter.Text.count()’.  By default it preserves the behavior of
     older Python versions, except that setting ‘wantobjects’ to 0 no
     longer has effect.  Add a new parameter 'return_ints': specifying
     ‘return_ints=True’ makes ‘Text.count()’ always returning the single
     count as an integer instead of a 1-tuple or ‘None’.

   - gh-114628(12): When csv.Error is raised when handling TypeError, do
     not print the TypeError traceback.

   - gh-85984(13): Added ‘_POSIX_VDISABLE’ from C's ‘<unistd.h>’ to
     *note termios: e7.

   - gh-114965(14): Update bundled pip to 24.0

   - gh-114959(15): *note tarfile: e4. no longer ignores errors when
     trying to extract a directory on top of a file.

   - gh-114894(16): Add *note array.array.clear(): 4c0.

   - gh-114071(17): Support tuple subclasses using auto() for enum
     member value.

   - gh-109475(18): Fix support of explicit option value "-" in *note
     argparse: 7. (e.g.  ‘--option=--’).

   - gh-49766(19): Fix *note date: 1fa.-*note datetime: 4e2. comparison.
     Now the special comparison methods like ‘__eq__’ and ‘__lt__’
     return *note NotImplemented: 1a2. if one of comparands is ‘date’
     and other is ‘datetime’ instead of ignoring the time part and the
     time zone or forcefully return "not equal" or raise *note
     TypeError: 198.  It makes comparison of ‘date’ and ‘datetime’
     subclasses more symmetric and allows to change the default behavior
     by overriding the special comparison methods in subclasses.

   - gh-110190(20): Fix ctypes structs with array on Windows ARM64
     platform by setting ‘MAX_STRUCT_SIZE’ to 32 in stgdict.  Patch by
     Diego Russo

   - gh-114678(21): Ensure that deprecation warning for 'N' specifier in
     *note Decimal: 1fe. format is not raised for cases where 'N'
     appears in other places in the format specifier.  Based on patch by
     Stefan Krah.

   - gh-70303(22): Return both files and directories from *note
     pathlib.Path.glob(): 537. if a pattern ends with "‘**’".
     Previously only directories were returned.

   - gh-109653(23): Improve import time of *note importlib.metadata: 7e.
     and *note email.utils: 54.

   - gh-113280(24): Fix a leak of open socket in rare cases when error
     occurred in *note ssl.SSLSocket: ae7. creation.

   - gh-77749(25): *note email.policy.EmailPolicy.fold(): 19f2. now
     always encodes non-ASCII characters in headers if *note utf8: ff9.
     is false.

   - gh-83383(26): Synchronization of the *note dbm.dumb: 36. database
     is now no-op if there was no modification since opening or last
     synchronization.  The directory file for a newly created empty
     *note dbm.dumb: 36. database is now created immediately after
     opening instead of deferring this until synchronizing or closing.

   - gh-91602(27): Add 'filter' keyword-only parameter to *note
     sqlite3.Connection.iterdump(): 54f. for filtering database objects
     to dump.  Patch by Mariusz Felisiak.

   - gh-112451(28): Prohibit subclassing pure-Python *note
     datetime.timezone: 12d5.  This is consistent with C-extension
     implementation.  Patch by Mariusz Felisiak.

   - gh-69893(29): Add the ‘close()’ method for the iterator returned by
     *note xml.etree.ElementTree.iterparse(): 57a.

   - gh-109653(30): Reduce the import time of *note threading: f3.
     module by ~50%.  Patch by Daniel Hollas.

   - gh-114492(31): Make the result of *note termios.tcgetattr(): 19f3.
     reproducible on Alpine Linux.  Previously it could leave a random
     garbage in some fields.

   - gh-114315(32): Make *note threading.Lock: 19f4. a real class, not a
     factory function.  Add ‘__new__’ to ‘_thread.lock’ type.

   - gh-100414(33): Add *note dbm.sqlite3: 39. as a backend to *note
     dbm: 35, and make it the new default ‘dbm’ backend.  Patch by
     Raymond Hettinger and Erlend E. Aasland.

   - gh-113267(34): Revert changes in gh-106584(35) which made calls of
     ‘TestResult’ methods ‘startTest()’ and ‘stopTest()’ unbalanced.

   - gh-75128(36): Ignore an *note OSError: 2c0. in
     ‘asyncio.BaseEventLoop.create_server()’ when IPv6 is available but
     the interface cannot actually support it.

   - gh-114423(37): ‘_DummyThread’ entries in ‘threading._active’ are
     now automatically removed when the related thread dies.

   - gh-114257(38): Dismiss the ‘FileNotFound’ error in *note
     ctypes.util.find_library(): f45. and just return ‘None’ on Linux.

   - gh-114321(39): Expose more platform specific constants in the *note
     fcntl: 5d. module on Linux, macOS, FreeBSD and NetBSD.

   - gh-114328(40): The *note tty.setcbreak(): 19f5. and new *note
     tty.cfmakecbreak(): 19f6. no longer clears the terminal input ICRLF
     flag.  This fixes a regression introduced in 3.12 that no longer
     matched how OSes define cbreak mode in their ‘stty(1)’ manual
     pages.

   - gh-114281(41): Remove type hints from ‘Lib/asyncio/staggered.py’.
     The annotations in the typeshed(42) project should be used instead.

   - gh-101438(43): Avoid reference cycle in ElementTree.iterparse.  The
     iterator returned by ‘ElementTree.iterparse’ may hold on to a file
     descriptor.  The reference cycle prevented prompt clean-up of the
     file descriptor if the returned iterator was not exhausted.

   - gh-114198(44): The signature for the ‘__replace__’ method on *note
     dataclasses: 33. now has the first argument named ‘self’, rather
     than ‘obj’.

   - gh-104522(45): *note OSError: 2c0. raised when run a subprocess now
     only has 'filename' attribute set to 'cwd' if the error was caused
     by a failed attempt to change the current directory.

   - gh-114149(46): Enum: correctly handle tuple subclasses in custom
     ‘__new__’.

   - gh-83648(47): Support deprecation of options, positional arguments
     and subcommands in *note argparse: 7.

   - gh-114087(48): Speed up ‘dataclasses.asdict’ up to 1.35x.

   - gh-109534(49): Fix a reference leak in
     ‘asyncio.selector_events.BaseSelectorEventLoop’ when SSL handshakes
     fail.  Patch contributed by Jamie Phan.

   - gh-79634(50): Accept *note path-like objects: 5a1. as patterns in
     *note pathlib.Path.glob(): 537. and *note rglob(): 538.

   - gh-112202(51): Ensure that a *note asyncio.Condition.notify():
     19f7. call does not get lost if the awakened ‘Task’ is
     simultaneously cancelled or encounters any other error.

   - gh-113951(52): Fix the behavior of ‘tag_unbind()’ methods of
     ‘tkinter.Text’ and ‘tkinter.Canvas’ classes with three arguments.
     Previously, ‘widget.tag_unbind(tag, sequence, funcid)’ destroyed
     the current binding for 'sequence', leaving 'sequence' unbound, and
     deleted the 'funcid' command.  Now it removes only 'funcid' from
     the binding for 'sequence', keeping other commands, and deletes the
     'funcid' command.  It leaves 'sequence' unbound only if 'funcid'
     was the last bound command.

   - gh-97959(53): Fix rendering class methods, bound methods, method
     and function aliases in *note pydoc: ba.  Class methods no longer
     have "method of builtins.type instance" note.  Corresponding notes
     are now added for class and unbound methods.  Method and function
     aliases now have references to the module or the class where the
     origin was defined if it differs from the current.  Bound methods
     are now listed in the static methods section.  Methods of builtin
     classes are now supported as well as methods of Python classes.

   - gh-113796(54): Add more validation checks in the *note csv.Dialect:
     1827. constructor.  *note ValueError: 2ec. is now raised if the
     same character is used in different roles.

   - gh-113732(55): Fix support of *note QUOTE_NOTNULL: 6ac. and *note
     QUOTE_STRINGS: 6ad. in *note csv.reader(): 6ae.

   - gh-113225(56): Speed up *note pathlib.Path.walk(): 6cf. by using
     *note os.DirEntry.path: 19f8. where possible.

   - gh-89039(57): When replace() method is called on a subclass of
     datetime, date or time, properly call derived constructor.
     Previously, only the base class's constructor was called.

     Also, make sure to pass non-zero fold values when creating
     subclasses in various methods.  Previously, fold was silently
     ignored.

   - gh-112919(58): Speed-up *note datetime.datetime.replace(): 16e4,
     *note datetime.date.replace(): 19f9. and *note
     datetime.time.replace(): 19fa.

   - gh-59013(59): Set breakpoint on the first executable line of the
     function, instead of the line of function definition when the user
     do ‘break func’ using *note pdb: aa.

   - gh-112343(60): Improve handling of pdb convenience variables to
     avoid replacing string contents.

   - gh-112240(61): Add option to calendar module CLI to specify the
     weekday to start each week.  Patch by Steven Ward.

   - gh-111741(62): Recognise ‘image/webp’ as a standard format in the
     *note mimetypes: 93. module.

   - gh-43457(63): Fix the *note tkinter: f6. widget method
     ‘wm_attributes()’.  It now accepts the attribute name without the
     minus prefix to get window attributes and allows to specify
     attributes and values to set as keyword arguments.  Add new
     optional keyword argument 'return_python_dict': calling
     ‘w.wm_attributes(return_python_dict=True)’ returns the attributes
     as a dict instead of a tuple.  Calling ‘w.wm_attributes()’ now
     returns a tuple instead of string if 'wantobjects' was set to 0.

   - gh-82626(64): Many functions now emit a warning if a boolean value
     is passed as a file descriptor argument.

   - gh-111051(65): Added check for file modification during debugging
     with *note pdb: aa.

   - gh-110345(66): Show the Tcl/Tk patchlevel (rather than version) in
     ‘tkinter._test()’.

   - gh-38807(67): Fix race condition in *note trace: 103.  Instead of
     checking if a directory exists and creating it, directly call *note
     os.makedirs(): 52c. with the kwarg ‘exist_ok=True’.

   - gh-75705(68): Set unixfrom envelope in *note mailbox.mbox: 19fb.
     and *note mailbox.MMDF: 19fc.

   - gh-106233(69): Fix stacklevel in ‘InvalidTZPathWarning’ during
     *note zoneinfo: 13a. module import.

   - gh-105102(70): Allow *note ctypes.Union: 1e6. to be nested in *note
     ctypes.Structure: 1e5. when the system endianness is the opposite
     of the classes.

   - gh-104282(71): Fix null pointer dereference in
     ‘lzma._decode_filter_properties()’ due to improper handling of BCJ
     filters with properties of zero length.  Patch by Radislav
     Chugunov.

   - gh-96471(72): Add *note queue.Queue: 15ac. termination with *note
     shutdown(): 542.

   - gh-101599(73): Changed argparse flag options formatting to remove
     redundancy.

   - gh-85984(74): Add POSIX pseudo-terminal functions *note
     os.posix_openpt(): 19fd, *note os.grantpt(): 19fe, *note
     os.unlockpt(): 19ff, and *note os.ptsname(): 1a00.

   - gh-102512(75): When *note os.fork(): 4b5. is called from a foreign
     thread (aka ‘_DummyThread’), the type of the thread in a child
     process is changed to ‘_MainThread’.  Also changed its name and
     daemonic status, it can be now joined.

   - gh-88569(76): Add *note os.path.isreserved(): 32b, which identifies
     reserved pathnames such as "NUL", "AUX" and "CON". This function is
     only available on Windows.

     Deprecate *note pathlib.PurePath.is_reserved(): 32a.

   - bpo-38364(77): The ‘inspect’ functions ‘isgeneratorfunction’,
     ‘iscoroutinefunction’, ‘isasyncgenfunction’ now support
     ‘functools.partialmethod’ wrapped functions the same way they
     support ‘functools.partial’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115392

   (2) https://github.com/python/cpython/issues/114563

   (3) https://github.com/python/cpython/issues/102840

   (4) https://github.com/python/cpython/issues/115165

   (5) https://github.com/python/cpython/issues/112903

   (6) https://github.com/python/cpython/issues/115133

   (7) https://github.com/python/cpython/issues/115059

   (8) https://github.com/python/cpython/issues/79382

   (9) https://github.com/python/cpython/issues/67837

   (10) https://github.com/python/cpython/issues/115060

   (11) https://github.com/python/cpython/issues/97928

   (12) https://github.com/python/cpython/issues/114628

   (13) https://github.com/python/cpython/issues/85984

   (14) https://github.com/python/cpython/issues/114965

   (15) https://github.com/python/cpython/issues/114959

   (16) https://github.com/python/cpython/issues/114894

   (17) https://github.com/python/cpython/issues/114071

   (18) https://github.com/python/cpython/issues/109475

   (19) https://github.com/python/cpython/issues/49766

   (20) https://github.com/python/cpython/issues/110190

   (21) https://github.com/python/cpython/issues/114678

   (22) https://github.com/python/cpython/issues/70303

   (23) https://github.com/python/cpython/issues/109653

   (24) https://github.com/python/cpython/issues/113280

   (25) https://github.com/python/cpython/issues/77749

   (26) https://github.com/python/cpython/issues/83383

   (27) https://github.com/python/cpython/issues/91602

   (28) https://github.com/python/cpython/issues/112451

   (29) https://github.com/python/cpython/issues/69893

   (30) https://github.com/python/cpython/issues/109653

   (31) https://github.com/python/cpython/issues/114492

   (32) https://github.com/python/cpython/issues/114315

   (33) https://github.com/python/cpython/issues/100414

   (34) https://github.com/python/cpython/issues/113267

   (35) https://github.com/python/cpython/issues/106584

   (36) https://github.com/python/cpython/issues/75128

   (37) https://github.com/python/cpython/issues/114423

   (38) https://github.com/python/cpython/issues/114257

   (39) https://github.com/python/cpython/issues/114321

   (40) https://github.com/python/cpython/issues/114328

   (41) https://github.com/python/cpython/issues/114281

   (42) https://github.com/python/typeshed

   (43) https://github.com/python/cpython/issues/101438

   (44) https://github.com/python/cpython/issues/114198

   (45) https://github.com/python/cpython/issues/104522

   (46) https://github.com/python/cpython/issues/114149

   (47) https://github.com/python/cpython/issues/83648

   (48) https://github.com/python/cpython/issues/114087

   (49) https://github.com/python/cpython/issues/109534

   (50) https://github.com/python/cpython/issues/79634

   (51) https://github.com/python/cpython/issues/112202

   (52) https://github.com/python/cpython/issues/113951

   (53) https://github.com/python/cpython/issues/97959

   (54) https://github.com/python/cpython/issues/113796

   (55) https://github.com/python/cpython/issues/113732

   (56) https://github.com/python/cpython/issues/113225

   (57) https://github.com/python/cpython/issues/89039

   (58) https://github.com/python/cpython/issues/112919

   (59) https://github.com/python/cpython/issues/59013

   (60) https://github.com/python/cpython/issues/112343

   (61) https://github.com/python/cpython/issues/112240

   (62) https://github.com/python/cpython/issues/111741

   (63) https://github.com/python/cpython/issues/43457

   (64) https://github.com/python/cpython/issues/82626

   (65) https://github.com/python/cpython/issues/111051

   (66) https://github.com/python/cpython/issues/110345

   (67) https://github.com/python/cpython/issues/38807

   (68) https://github.com/python/cpython/issues/75705

   (69) https://github.com/python/cpython/issues/106233

   (70) https://github.com/python/cpython/issues/105102

   (71) https://github.com/python/cpython/issues/104282

   (72) https://github.com/python/cpython/issues/96471

   (73) https://github.com/python/cpython/issues/101599

   (74) https://github.com/python/cpython/issues/85984

   (75) https://github.com/python/cpython/issues/102512

   (76) https://github.com/python/cpython/issues/88569

   (77) https://bugs.python.org/issue?@action=redirect&bpo=38364


File: python.info,  Node: ドキュメント<18>,  Next: テスト<16>,  Prev: ライブラリ<61>,  Up: Python 3 13 0 alpha 4

1.24.23.4 ドキュメント
......................

   - gh-115233(1): Fix an example for *note LoggerAdapter: 150d. in the
     Logging Cookbook.

   - gh-114123(2): Move the *note csv: 2d. module docstring to the ‘csv’
     module instead of reexporting it from the internal ‘_csv’ module,
     and remove ‘__doc__’ from ‘csv.__all__’.

     Move ‘csv.__version__’ to the ‘csv’ module instead of reexporting
     it from the internal ‘_csv’ module, and remove ‘__version__’ from
     ‘csv.__all__’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115233

   (2) https://github.com/python/cpython/issues/114123


File: python.info,  Node: テスト<16>,  Next: ビルド<19>,  Prev: ドキュメント<18>,  Up: Python 3 13 0 alpha 4

1.24.23.5 テスト
................

   - gh-114099(1): Added test exclusions required to run the test suite
     on iOS.

   - gh-105089(2): Fix
     ‘test.test_zipfile.test_core.TestWithDirectory.test_create_directory_with_write’
     test in AIX by doing a bitwise AND of 0xFFFF on mode , so that it
     will be in sync with ‘zinfo.external_attr’

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/114099

   (2) https://github.com/python/cpython/issues/105089


File: python.info,  Node: ビルド<19>,  Next: Windows<18>,  Prev: テスト<16>,  Up: Python 3 13 0 alpha 4

1.24.23.6 ビルド
................

   - gh-115167(1): Avoid vendoring ‘vcruntime140_threads.dll’ when
     building with Visual Studio 2022 version 17.8.

   - gh-113632(2): Promote WASI to a tier 2 platform and drop Emscripten
     from tier 3 in configure.ac.

   - gh-114099(3): configure and Makefile were refactored to accommodate
     framework builds on Apple platforms other than macOS.

   - gh-114875(4): Add ‘getgrent()’ as a prerequisite for building the
     *note grp: 6a. module.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115167

   (2) https://github.com/python/cpython/issues/113632

   (3) https://github.com/python/cpython/issues/114099

   (4) https://github.com/python/cpython/issues/114875


File: python.info,  Node: Windows<18>,  Next: macOS<11>,  Prev: ビルド<19>,  Up: Python 3 13 0 alpha 4

1.24.23.7 Windows
.................

   - gh-115049(1): Fixes ‘py.exe’ launcher failing when run as users
     without user profiles.

   - gh-115009(2): Update Windows installer to use SQLite 3.45.1.

   - gh-109991(3): Update Windows build to use OpenSSL 3.0.13.

   - gh-111239(4): Update Windows builds to use zlib v1.3.1.

   - gh-100107(5): The ‘py.exe’ launcher will no longer attempt to run
     the Microsoft Store redirector when launching a script containing a
     ‘/usr/bin/env’ shebang

   - gh-112984(6): Adds free-threaded binaries to Windows installer as
     an optional component.

   - gh-89240(7): Allows *note multiprocessing: 98. to create pools of
     greater than 62 processes.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115049

   (2) https://github.com/python/cpython/issues/115009

   (3) https://github.com/python/cpython/issues/109991

   (4) https://github.com/python/cpython/issues/111239

   (5) https://github.com/python/cpython/issues/100107

   (6) https://github.com/python/cpython/issues/112984

   (7) https://github.com/python/cpython/issues/89240


File: python.info,  Node: macOS<11>,  Next: IDLE<10>,  Prev: Windows<18>,  Up: Python 3 13 0 alpha 4

1.24.23.8 macOS
...............

   - gh-115009(1): Update macOS installer to use SQLite 3.45.1.

   - gh-109991(2): Update macOS installer to use OpenSSL 3.0.13.

   - gh-114490(3): Add Mach-O linkage support for *note
     platform.architecture(): 1a06.

   - gh-87804(4): On macOS the result of ‘os.statvfs’ and ‘os.fstatvfs’
     now correctly report the size of very large disks, in previous
     versions the reported number of blocks was wrong for disks with at
     least 2**32 blocks.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115009

   (2) https://github.com/python/cpython/issues/109991

   (3) https://github.com/python/cpython/issues/114490

   (4) https://github.com/python/cpython/issues/87804


File: python.info,  Node: IDLE<10>,  Next: Tools/Demos<17>,  Prev: macOS<11>,  Up: Python 3 13 0 alpha 4

1.24.23.9 IDLE
..............

   - gh-96905(1): In idlelib code, stop redefining built-ins 'dict' and
     'object'.

   - gh-103820(2): Revise IDLE bindings so that events from mouse button
     4/5 on non-X11 windowing systems (i.e.  Win32 and Aqua) are not
     mistaken for scrolling.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/96905

   (2) https://github.com/python/cpython/issues/103820


File: python.info,  Node: Tools/Demos<17>,  Next: C API<19>,  Prev: IDLE<10>,  Up: Python 3 13 0 alpha 4

1.24.23.10 Tools/Demos
......................

   - gh-113516(1): Don't set ‘LDSHARED’ when building for WASI.

   - gh-109991(2): Update GitHub CI workflows to use OpenSSL 3.0.13 and
     multissltests to use 1.1.1w, 3.0.13, 3.1.5, and 3.2.1.

   - gh-115015(3): Fix a bug in Argument Clinic that generated incorrect
     code for methods with no parameters that use the *note METH_METHOD
     | METH_FASTCALL | METH_KEYWORDS: 1a09. calling convention.  Only
     the positional parameter count was checked; any keyword argument
     passed would be silently accepted.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/113516

   (2) https://github.com/python/cpython/issues/109991

   (3) https://github.com/python/cpython/issues/115015


File: python.info,  Node: C API<19>,  Prev: Tools/Demos<17>,  Up: Python 3 13 0 alpha 4

1.24.23.11 C API
................

   - gh-111140(1): Adds *note PyLong_AsNativeBytes(): 606, *note
     PyLong_FromNativeBytes(): 607. and *note
     PyLong_FromUnsignedNativeBytes(): 608. functions.

   - gh-114685(2): *note PyBuffer_FillInfo(): 964. now raises a *note
     SystemError: 795. if called with *note PyBUF_READ: 1a0b. or *note
     PyBUF_WRITE: 1a0c. as flags.  These flags should only be used with
     the ‘PyMemoryView_*’ C API.

   - gh-114685(3): *note PyObject_GetBuffer(): 63a. now raises a *note
     SystemError: 795. if called with *note PyBUF_READ: 1a0b. or *note
     PyBUF_WRITE: 1a0c. as flags.  These flags should only be used with
     the ‘PyMemoryView_*’ C API.

   - gh-114626(4): Add ‘PyCFunctionFast’ and
     ‘PyCFunctionFastWithKeywords’ typedefs (identical to the existing
     ‘_PyCFunctionFast’ and ‘_PyCFunctionFastWithKeywords’ typedefs,
     just without a leading ‘_’ prefix).

   - gh-114329(5): Add *note PyList_GetItemRef(): 5fe, which is similar
     to *note PyList_GetItem(): 5ff. but returns a *note strong
     reference: 5e2. instead of a *note borrowed reference: 3d7.

   - gh-110850(6): Add PyTime C API:

        * *note PyTime_t: 5d3. type.

        * *note PyTime_MIN: 5d4. and *note PyTime_MAX: 5d5. constants.

        * *note PyTime_AsSecondsDouble(): 5d6, *note PyTime_Monotonic():
          5d7, *note PyTime_PerfCounter(): 5d9, and *note PyTime_Time():
          5db. functions.

     Patch by Victor Stinner.

   - gh-112066(7): Add *note PyDict_SetDefaultRef(): 5e3.: insert a key
     and value into a dictionary if the key is not already present.
     This is similar to *note dict.setdefault(): 1285, but returns an
     integer value indicating if the key was already present.  It is
     also similar to *note PyDict_SetDefault(): 5e4, but returns a
     strong reference instead of a borrowed reference.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/111140

   (2) https://github.com/python/cpython/issues/114685

   (3) https://github.com/python/cpython/issues/114685

   (4) https://github.com/python/cpython/issues/114626

   (5) https://github.com/python/cpython/issues/114329

   (6) https://github.com/python/cpython/issues/110850

   (7) https://github.com/python/cpython/issues/112066


File: python.info,  Node: Python 3 13 0 alpha 3,  Next: Python 3 13 0 alpha 2,  Prev: Python 3 13 0 alpha 4,  Up: 変更履歴

1.24.24 Python 3.13.0 alpha 3
-----------------------------

'Release date: 2024-01-17'

* Menu:

* セキュリティ: セキュリティ<20>.
* Core and Builtins: Core and Builtins<57>.
* ライブラリ: ライブラリ<62>.
* ドキュメント: ドキュメント<19>.
* テスト: テスト<17>.
* ビルド: ビルド<20>.
* Windows: Windows<19>.
* macOS: macOS<12>.
* IDLE: IDLE<11>.
* C API: C API<20>.


File: python.info,  Node: セキュリティ<20>,  Next: Core and Builtins<57>,  Up: Python 3 13 0 alpha 3

1.24.24.1 セキュリティ
......................

   - gh-113659(1): Skip ‘.pth’ files with names starting with a dot or
     hidden file attribute.

   - gh-112302(2): Created a Software Bill-of-Materials document and
     tooling for tracking dependencies.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/113659

   (2) https://github.com/python/cpython/issues/112302


File: python.info,  Node: Core and Builtins<57>,  Next: ライブラリ<62>,  Prev: セキュリティ<20>,  Up: Python 3 13 0 alpha 3

1.24.24.2 Core and Builtins
...........................

   - gh-107901(1): Compiler duplicates basic blocks that have an eval
     breaker check, no line number, and multiple predecessors.

   - gh-107901(2): A jump leaving an exception handler back to normal
     code no longer checks the eval breaker.

   - gh-113655(3): Set the C recursion limit to 4000 on Windows, and
     10000 on Linux/OSX. This seems to be near the sweet spot to
     maintain safety, but not compromise backwards compatibility.

   - gh-113710(4): Add typed stack effects to the interpreter DSL, along
     with various instruction annotations.

   - gh-77046(5): On Windows, file descriptors wrapping Windows handles
     are now created non inheritable by default ( PEP 446(6)).  Patch by
     Zackery Spytz and Victor Stinner.

   - gh-113853(7): Guarantee that all executors make progress.  This
     then guarantees that tier 2 execution always makes progress.

   - gh-113753(8): Fix an issue where the finalizer of ‘PyAsyncGenASend’
     objects might not be called if they were allocated from a free
     list.

   - gh-107901(9): Compiler changed so that synthetic jumps which are
     not at loop end no longer check the eval breaker.

   - gh-113703(10): Fix a regression in the *note codeop: 1d. module
     that was causing it to incorrectly identify incomplete f-strings.
     Patch by Pablo Galindo

   - gh-89811(11): Check for a valid ‘tp_version_tag’ before performing
     bytecode specializations that rely on this value being usable.

   - gh-111488(12): Changed error message in case of no 'in' keyword
     after 'for' in list comprehensions

   - gh-113657(13): Fix an issue that caused important instruction
     pointer updates to be optimized out of tier two traces.

   - gh-113603(14): Fixed bug where a redundant NOP is not removed,
     causing an assertion to fail in the compiler in debug mode.

   - gh-113602(15): Fix an error that was causing the parser to try to
     overwrite existing errors and crashing in the process.  Patch by
     Pablo Galindo

   - gh-113486(16): No longer issue spurious ‘PY_UNWIND’ events for
     optimized calls to classes.

   - gh-113297(17): Fix segfault in the compiler on with statement with
     19 context managers.

   - gh-113212(18): Improve *note super: 1a6. error messages.

   - gh-111375(19): Only use ‘NULL’ in the exception stack to indicate
     an exception was handled.  Patch by Carey Metcalfe.

   - gh-112215(20): Increase the C recursion limit by a factor of 3 for
     non-debug builds, except for webassembly and s390 platforms which
     are unchanged.  This mitigates some regressions in 3.12 with deep
     recursion mixing builtin (C) and Python code.

   - gh-113054(21): Fixed bug where a redundant NOP is not removed,
     causing an assertion to fail in the compiler in debug mode.

   - gh-106905(22): Use per AST-parser state rather than global state to
     track recursion depth within the AST parser to prevent potential
     race condition due to simultaneous parsing.

     The issue primarily showed up in 3.11 by multithreaded users of
     *note ast.parse(): 1c2.  In 3.12 a change to when garbage
     collection can be triggered prevented the race condition from
     occurring.

   - gh-108866(23): Change the API and contract of ‘_PyExecutorObject’
     to return the next_instr pointer, instead of the frame, and to
     always execute at least one instruction.

   - gh-90350(24): Optimize builtin functions *note min(): 110b. and
     *note max(): 110c.

   - gh-112943(25): Correctly compute end column offsets for multiline
     tokens in the *note tokenize: 101. module.  Patch by Pablo Galindo

   - gh-112125(26): Fix ‘None.__ne__(None)’ returning ‘NotImplemented’
     instead of ‘False’.

   - gh-74616(27): *note input(): 14f0. now raises a ValueError when
     output on the terminal if the prompt contains embedded null
     characters instead of silently truncating it.

   - gh-112716(28): Fix SystemError in the ‘import’ statement and in
     ‘__reduce__()’ methods of builtin types when ‘__builtins__’ is not
     a dict.

   - gh-112730(29): Use color to highlight error locations in
     tracebacks.  Patch by Pablo Galindo

   - gh-112625(30): Fixes a bug where a bytearray object could be
     cleared while iterating over an argument in the ‘bytearray.join()’
     method that could result in reading memory after it was freed.

   - gh-112660(31): Do not clear unexpected errors during formatting
     error messages for ImportError and AttributeError for modules.

   - gh-105967(32): Workaround a bug in Apple's macOS platform zlib
     library where *note zlib.crc32(): 1a10. and *note binascii.crc32():
     1a11. could produce incorrect results on multi-gigabyte inputs.
     Including when using *note zipfile: 137. on zips containing large
     data.

   - gh-95754(33): Provide a better error message when accessing invalid
     attributes on partially initialized modules.  The origin of the
     module being accessed is now included in the message to help with
     the common issue of shadowing other modules.

   - gh-112217(34): Add check for the type of ‘__cause__’ returned from
     calling the type ‘T’ in ‘raise from T’.

   - gh-111058(35): Change coro.cr_frame/gen.gi_frame to return ‘None’
     after the coroutine/generator has been closed.  This fixes a bug
     where *note getcoroutinestate(): 101a. and *note
     getgeneratorstate(): 144e. return the wrong state for a closed
     coroutine/generator.

   - gh-112388(36): Fix an error that was causing the parser to try to
     overwrite tokenizer errors.  Patch by pablo Galindo

   - gh-112387(37): Fix error positions for decoded strings with
     backwards tokenize errors.  Patch by Pablo Galindo

   - gh-99606(38): Make code generated for an empty f-string identical
     to the code of an empty normal string.

   - gh-112367(39): Avoid undefined behaviour when using the perf
     trampolines by not freeing the code arenas until shutdown.  Patch
     by Pablo Galindo

   - gh-112320(40): The Tier 2 translator now tracks the confidence
     level for staying "on trace" (i.e.  not exiting back to the Tier 1
     interpreter) for branch instructions based on the number of bits
     set in the branch "counter".  Trace translation ends when the
     confidence drops below 1/3rd.

   - gh-109598(41): *note PyComplex_RealAsDouble(): 1a12./*note
     PyComplex_ImagAsDouble(): 1a13. now tries to convert an object to a
     *note complex: 197. instance using its ‘__complex__()’ method
     before falling back to the ‘__float__()’ method.  Patch by Sergey B
     Kirpichev.

   - gh-94606(42): Fix UnicodeEncodeError when
     ‘email.message.get_payload()’ reads a message with a Unicode
     surrogate character and the message content is not well-formed for
     surrogateescape encoding.  Patch by Sidney Markowitz.

   - bpo-21861(43): Use the object's actual class name in
     ‘_io.FileIO.__repr__()’, ‘_io._WindowsConsoleIO()’ and
     ‘_io.TextIOWrapper.__repr__()’, to make these methods subclass
     friendly.

   - bpo-45369(44): Remove LibreSSL workarounds as per PEP 644(45).

   - bpo-34392(46): Added *note sys._is_interned(): 559.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/107901

   (2) https://github.com/python/cpython/issues/107901

   (3) https://github.com/python/cpython/issues/113655

   (4) https://github.com/python/cpython/issues/113710

   (5) https://github.com/python/cpython/issues/77046

   (6) https://peps.python.org/pep-0446/

   (7) https://github.com/python/cpython/issues/113853

   (8) https://github.com/python/cpython/issues/113753

   (9) https://github.com/python/cpython/issues/107901

   (10) https://github.com/python/cpython/issues/113703

   (11) https://github.com/python/cpython/issues/89811

   (12) https://github.com/python/cpython/issues/111488

   (13) https://github.com/python/cpython/issues/113657

   (14) https://github.com/python/cpython/issues/113603

   (15) https://github.com/python/cpython/issues/113602

   (16) https://github.com/python/cpython/issues/113486

   (17) https://github.com/python/cpython/issues/113297

   (18) https://github.com/python/cpython/issues/113212

   (19) https://github.com/python/cpython/issues/111375

   (20) https://github.com/python/cpython/issues/112215

   (21) https://github.com/python/cpython/issues/113054

   (22) https://github.com/python/cpython/issues/106905

   (23) https://github.com/python/cpython/issues/108866

   (24) https://github.com/python/cpython/issues/90350

   (25) https://github.com/python/cpython/issues/112943

   (26) https://github.com/python/cpython/issues/112125

   (27) https://github.com/python/cpython/issues/74616

   (28) https://github.com/python/cpython/issues/112716

   (29) https://github.com/python/cpython/issues/112730

   (30) https://github.com/python/cpython/issues/112625

   (31) https://github.com/python/cpython/issues/112660

   (32) https://github.com/python/cpython/issues/105967

   (33) https://github.com/python/cpython/issues/95754

   (34) https://github.com/python/cpython/issues/112217

   (35) https://github.com/python/cpython/issues/111058

   (36) https://github.com/python/cpython/issues/112388

   (37) https://github.com/python/cpython/issues/112387

   (38) https://github.com/python/cpython/issues/99606

   (39) https://github.com/python/cpython/issues/112367

   (40) https://github.com/python/cpython/issues/112320

   (41) https://github.com/python/cpython/issues/109598

   (42) https://github.com/python/cpython/issues/94606

   (43) https://bugs.python.org/issue?@action=redirect&bpo=21861

   (44) https://bugs.python.org/issue?@action=redirect&bpo=45369

   (45) https://peps.python.org/pep-0644/

   (46) https://bugs.python.org/issue?@action=redirect&bpo=34392


File: python.info,  Node: ライブラリ<62>,  Next: ドキュメント<19>,  Prev: Core and Builtins<57>,  Up: Python 3 13 0 alpha 3

1.24.24.3 ライブラリ
....................

   - gh-114077(1): Fix possible *note OverflowError: a81. in *note
     socket.socket.sendfile(): 105d. when pass 'count' larger than 2 GiB
     on 32-bit platform.

   - gh-111803(2): *note plistlib: b0. now supports loading more deeply
     nested lists in binary format.

   - gh-114014(3): Fixed a bug in *note fractions.Fraction: 213. where
     an invalid string using ‘d’ in the decimals part creates a
     different error compared to other invalid letters/characters.
     Patch by Jeremiah Gabriel Pascual.

   - gh-108364(4): *note sqlite3.Connection.iterdump(): 54f. now ensures
     that foreign key support is disabled before dumping the database
     schema, if there is any foreign key violation.  Patch by Erlend E.
     Aasland and Mariusz Felisiak.

   - gh-113971(5): The *note zipfile.ZipInfo: 2cb. previously protected
     ‘._compresslevel’ attribute has been made public as
     ‘.compress_level’ with the old ‘_compresslevel’ name remaining
     available as a property to retain compatibility.

   - gh-113877(6): Fix *note tkinter: f6. method ‘winfo_pathname()’ on
     64-bit Windows.

   - gh-113868(7): Added *note mmap.MAP_NORESERVE: 1a15, *note
     mmap.MAP_NOEXTEND: 1a16, *note mmap.MAP_HASSEMAPHORE: 1a17, *note
     mmap.MAP_NOCACHE: 1a18, *note mmap.MAP_JIT: 1a19, *note
     mmap.MAP_RESILIENT_CODESIGN: 1a1a, *note mmap.MAP_RESILIENT_MEDIA:
     1a1b, *note mmap.MAP_32BIT: 1a1c, *note
     mmap.MAP_TRANSLATED_ALLOW_EXECUTE: 1a1d, *note mmap.MAP_UNIX03:
     1a1e. and *note mmap.MAP_TPRO: 1a1f.  All of them are ‘mmap(2)’
     flags on macOS.

   - gh-113848(8): *note asyncio.TaskGroup(): 4d1. and *note
     asyncio.timeout(): 814. context managers now handle *note
     CancelledError: 4d4. subclasses as well as exact ‘CancelledError’.

   - gh-113661(9): unittest runner: Don't exit 5 if tests were skipped.
     The intention of exiting 5 was to detect issues where the test
     suite wasn't discovered at all.  If we skipped tests, it was
     correctly discovered.

   - gh-96037(10): Insert *note TimeoutError: a36. in the context of the
     exception that was raised during exiting an expired *note
     asyncio.timeout(): 814. block.

   - gh-113781(11): Silence unraisable AttributeError when warnings are
     emitted during Python finalization.

   - gh-113238(12): Add ‘Anchor’ to ‘importlib.resources’ (in order for
     the code to comply with the documentation)

   - gh-111693(13): *note asyncio.Condition.wait(): 1a20. now re-raises
     the same ‘CancelledError’ instance that may have caused it to be
     interrupted.  Fixed race condition in *note
     asyncio.Semaphore.acquire(): 1a21. when interrupted with a
     ‘CancelledError’.

   - gh-113791(14): Add ‘CLOCK_MONOTONIC_RAW_APPROX’ and
     ‘CLOCK_UPTIME_RAW_APPROX’ to *note time: f4. on macOS. These are
     clocks available on macOS 10.12 or later.

   - gh-112932(15): Restore the ability for *note zipfile: 137. to
     ‘extractall’ from zip files with a "/" directory entry in them as
     is commonly added to zips by some wiki or bug tracker data
     exporters.

   - gh-113568(16): Raise deprecation warnings from *note
     pathlib.PurePath: 6cd. and not its private base class
     ‘PurePathBase’.

   - gh-113594(17): Fix *note UnicodeEncodeError: 887. in *note email:
     3f. when re-fold lines that contain unknown-8bit encoded part
     followed by non-unknown-8bit encoded part.

   - gh-113538(18): In ‘asyncio.StreamReaderProtocol.connection_made()’,
     there is callback that logs an error if the task wrapping the
     "connected callback" fails.  This callback would itself fail if the
     task was cancelled.  Prevent this by checking whether the task was
     cancelled first.  If so, close the transport but don't log an
     error.

   - gh-113626(19): Add support for the 'allow_code' argument in the
     *note marshal: 91. module.  Passing ‘allow_code=False’ prevents
     serialization and de-serialization of code objects which is
     incompatible between Python versions.

   - gh-85567(20): Fix resource warnings for unclosed files in *note
     pickle: ab. and *note pickletools: ac. command line interfaces.

   - gh-113537(21): Support loads ‘str’ in *note plistlib.loads(): b49.

   - gh-89850(22): Add default implementations of *note
     pickle.Pickler.persistent_id(): 190c. and *note
     pickle.Unpickler.persistent_load(): 1914. methods in the C
     implementation.  Calling ‘super().persistent_id()’ and
     ‘super().persistent_load()’ in subclasses of the C implementation
     of *note pickle.Pickler: c13. and *note pickle.Unpickler: 1777.
     classes no longer causes infinite recursion.

   - gh-113569(23): Indicate if there were no actual calls in unittest
     *note assert_has_calls(): 1a22. failure.

   - gh-101225(24): Increase the backlog for *note
     multiprocessing.connection.Listener: 1a23. objects created by
     ‘multiprocessing.manager’ and ‘multiprocessing.resource_sharer’ to
     significantly reduce the risk of getting a connection refused error
     when creating a *note multiprocessing.connection.Connection: 12f8.
     to them.

   - gh-113568(25): Raise audit events from *note pathlib.Path: 266. and
     not its private base class ‘PathBase’.

   - gh-113543(26): Make sure that ‘webbrowser.MacOSXOSAScript’ sends
     ‘webbrowser.open’ audit event.

   - gh-113028(27): When a second reference to a string appears in the
     input to *note pickle: ab, and the Python implementation is in use,
     we are guaranteed that a single copy gets pickled and a single
     object is shared when reloaded.  Previously, in protocol 0, when a
     string contained certain characters (e.g.  newline) it resulted in
     duplicate objects.

   - gh-113421(28): Fix multiprocessing logger for ‘%(filename)s’.

   - gh-111784(29): Fix segfaults in the ‘_elementtree’ module.  Fix
     first segfault during deallocation of ‘_elementtree.XMLParser’
     instances by keeping strong reference to ‘pyexpat’ module in module
     state for capsule lifetime.  Fix second segfault which happens in
     the same deallocation process by keeping strong reference to
     ‘_elementtree’ module in ‘XMLParser’ structure for ‘_elementtree’
     module lifetime.

   - gh-113407(30): Fix import of *note unittest.mock: 10d. when CPython
     is built without docstrings.

   - gh-113320(31): Fix regression in Python 3.12 where *note Protocol:
     56b. classes that were not marked as *note runtime-checkable: 675.
     would be unnecessarily introspected, potentially causing exceptions
     to be raised if the protocol had problematic members.  Patch by
     Alex Waygood.

   - gh-53502(32): Add a new option ‘aware_datetime’ in *note plistlib:
     b0. to loads or dumps aware datetime.

   - gh-113358(33): Fix rendering tracebacks with exceptions with a
     broken __getattr__

   - gh-113214(34): Fix an ‘AttributeError’ during asyncio SSL protocol
     aborts in SSL-over-SSL scenarios.

   - gh-113246(35): Update bundled pip to 23.3.2.

   - gh-87264(36): Fixed tarfile list() method to show file type.

   - gh-112182(37): ‘asyncio.futures.Future.set_exception()’ now
     transforms *note StopIteration: df5. into *note RuntimeError: 244.
     instead of hanging or other misbehavior.  Patch contributed by
     Jamie Phan.

   - gh-113225(38): Speed up *note pathlib.Path.glob(): 537. by using
     *note os.DirEntry.path: 19f8. where possible.

   - gh-113149(39): Improve error message when a JSON array or object
     contains a trailing comma.  Patch by Carson Radtke.

   - gh-113117(40): The *note subprocess: dc. module can now use the
     *note os.posix_spawn(): 52e. function with ‘close_fds=True’ on
     platforms where ‘posix_spawn_file_actions_addclosefrom_np’ is
     available.  Patch by Jakub Kulik.

   - gh-113199(41): Make ‘http.client.HTTPResponse.read1’ and
     ‘http.client.HTTPResponse.readline’ close IO after reading all data
     when content length is known.  Patch by Illia Volochii.

   - gh-113191(42): Add support of *note os.fchmod(): 52a. and a file
     descriptor in *note os.chmod(): 529. on Windows.

   - gh-113188(43): Fix *note shutil.copymode(): 1a24. and *note
     shutil.copystat(): 1346. on Windows.  Previously they worked
     differently if 'dst' is a symbolic link: they modified the
     permission bits of 'dst' itself rather than the file it points to
     if 'follow_symlinks' is true or 'src' is not a symbolic link, and
     did not modify the permission bits if 'follow_symlinks' is false
     and 'src' is a symbolic link.

   - gh-113119(44): *note os.posix_spawn(): 52e. now accepts ‘env=None’,
     which makes the newly spawned process use the current process
     environment.  Patch by Jakub Kulik.

   - gh-113202(45): Add a ‘strict’ option to ‘batched()’ in the
     ‘itertools’ module.

   - gh-61648(46): Detect line numbers of properties in doctests.

   - gh-113175(47): Sync with importlib_metadata 7.0, including improved
     type annotations, fixed issue with symlinked packages in
     ‘package_distributions’, added ‘EntryPoints.__repr__’, introduced
     the ‘diagnose’ script, added ‘Distribution.origin’ property, and
     removed deprecated ‘EntryPoint’ access by numeric index (tuple
     behavior).

   - gh-59616(48): Add support of *note os.lchmod(): 528. and the
     'follow_symlinks' argument in *note os.chmod(): 529. on Windows.
     Note that the default value of 'follow_symlinks' in ‘os.lchmod()’
     is ‘False’ on Windows.

   - gh-112559(49): *note signal.signal(): 134c. and *note
     signal.getsignal(): 1a25. no longer call ‘repr’ on callable
     handlers.  *note asyncio.run(): 2f3. and *note
     asyncio.Runner.run(): 194d. no longer call ‘repr’ on the task
     results.  Patch by Yilei Yang.

   - gh-112962(50): *note dis: 3c. module functions add cache
     information to the *note Instruction: 203. instance rather than
     creating fake *note Instruction: 203. instances to represent the
     cache entries.

   - gh-112989(51): Reduce overhead to connect sockets with *note
     asyncio: b. SelectorEventLoop.

   - gh-112970(52): Use ‘closefrom()’ on Linux where available (e.g.
     glibc-2.34), rather than only FreeBSD.

   - gh-110190(53): Fix ctypes structs with array on PPC64LE platform by
     setting ‘MAX_STRUCT_SIZE’ to 64 in stgdict.  Patch by Diego Russo.

   - gh-112540(54): The statistics.geometric_mean() function now returns
     zero for datasets containing a zero.  Formerly, it would raise an
     exception.

   - gh-87286(55): Added ‘LOG_FTP’, ‘LOG_NETINFO’, ‘LOG_REMOTEAUTH’,
     ‘LOG_INSTALL’, ‘LOG_RAS’, and ‘LOG_LAUNCHD’ tot the *note syslog:
     e2. module, all of them constants on used on macOS.

   - gh-112800(56): Fix *note asyncio: b. ‘SubprocessTransport.close()’
     not to throw ‘PermissionError’ when used with setuid executables.

   - gh-51944(57): Add the following constants to the *note termios: e7.
     module.  These values are present in macOS system headers:
     ‘ALTWERASE’, ‘B14400’, ‘B28800’, ‘B7200’, ‘B76800’, ‘CCAR_OFLOW’,
     ‘CCTS_OFLOW’, ‘CDSR_OFLOW’, ‘CDTR_IFLOW’, ‘CIGNORE’, ‘CRTS_IFLOW’,
     ‘EXTPROC’, ‘IUTF8’, ‘MDMBUF’, ‘NL2’, ‘NL3’, ‘NOKERNINFO’, ‘ONOEOT’,
     ‘OXTABS’, ‘VDSUSP’, ‘VSTATUS’.

   - gh-79325(58): Fix an infinite recursion error in *note
     tempfile.TemporaryDirectory(): 144c. cleanup on Windows.

   - gh-94692(59): *note shutil.rmtree(): 356. now only catches OSError
     exceptions.  Previously a symlink attack resistant version of
     ‘shutil.rmtree()’ could ignore or pass to the error handler
     arbitrary exception when invalid arguments were provided.

   - gh-112736(60): The use of del-safe symbols in ‘subprocess’ was
     refactored to allow for use in cross-platform build environments.

   - gh-112727(61): Speed up *note pathlib.Path.absolute(): 1a26.  Patch
     by Barney Gale.

   - gh-74690(62): Speedup *note issubclass(): 9c4. checks against
     simple *note runtime-checkable protocols: 675. by around 6%.  Patch
     by Alex Waygood.

   - gh-74690(63): Speedup *note isinstance(): 2ad. checks by roughly
     20% for *note runtime-checkable protocols: 675. that only have one
     callable member.  Speedup *note issubclass(): 9c4. checks for these
     protocols by roughly 10%.  Patch by Alex Waygood.

   - gh-112645(64): Remove deprecation error on passing ‘onerror’ to
     *note shutil.rmtree(): 356.

   - gh-112640(65): Add ‘kwdefaults’ parameter to *note
     types.FunctionType: a83. to set default keyword argument values.

   - gh-112622(66): Ensure ‘name’ parameter is passed to event loop in
     *note asyncio.create_task(): 1c9.

   - gh-112618(67): Fix a caching bug relating to *note
     typing.Annotated: b37.  ‘Annotated[str, True]’ is no longer
     identical to ‘Annotated[str, 1]’.

   - gh-112334(68): Fixed a performance regression in 3.12's *note
     subprocess: dc. on Linux where it would no longer use the fast-path
     ‘vfork()’ system call when it could have due to a logic bug,
     instead falling back to the safe but slower ‘fork()’.

     Also fixed a second 3.12.0 potential security bug.  If a value of
     ‘extra_groups=[]’ was passed to *note subprocess.Popen: 4b7. or
     related APIs, the underlying ‘setgroups(0, NULL)’ system call to
     clear the groups list would not be made in the child process prior
     to ‘exec()’.

     This was identified via code inspection in the process of fixing
     the first bug.

   - gh-110190(69): Fix ctypes structs with array on Arm platform by
     setting ‘MAX_STRUCT_SIZE’ to 32 in stgdict.  Patch by Diego Russo.

   - gh-81194(70): Fix a crash in *note socket.if_indextoname(): c24.
     with specific value (UINT_MAX). Fix an integer overflow in *note
     socket.if_indextoname(): c24. on 64-bit non-Windows platforms.

   - gh-112578(71): Fix a spurious *note RuntimeWarning: 4d7. when
     executing the *note zipfile: 137. module.

   - gh-112516(72): Update the bundled copy of pip to version 23.3.1.

   - gh-112510(73): Add *note readline.backend: 1a27. for the backend
     readline uses (‘editline’ or ‘readline’)

   - gh-112328(74): [Enum] Make ‘EnumDict’, ‘EnumDict.member_names’,
     ‘EnumType._add_alias_’ and ‘EnumType._add_value_alias_’ public.

   - gh-112509(75): Fix edge cases that could cause a key to be present
     in both the ‘__required_keys__’ and ‘__optional_keys__’ attributes
     of a *note typing.TypedDict: 332.  Patch by Jelle Zijlstra.

   - gh-101336(76): Add ‘keep_alive’ keyword parameter for
     ‘AbstractEventLoop.create_server()’ and
     ‘BaseEventLoop.create_server()’.

   - gh-63284(77): Added support for TLS-PSK (pre-shared key) mode to
     the *note ssl: d5. module.

   - gh-112414(78): Fix regression in Python 3.12 where calling *note
     repr(): 1c1. on a module that had been imported using a custom
     *note loader: 1a28. could fail with *note AttributeError: 5f0.
     Patch by Alex Waygood.

   - gh-112358(79): Revert change to *note struct.Struct: 1778.
     initialization that broke some cases of subclassing.

   - gh-112405(80): Optimize *note pathlib.PurePath.relative_to(): 2fd.
     Patch by Alex Waygood.

   - gh-94722(81): Fix bug where comparison between instances of *note
     DocTest: 1a29. fails if one of them has ‘None’ as its lineno.

   - gh-112361(82): Speed up a small handful of *note pathlib: a8.
     methods by removing some temporary objects.

   - gh-112345(83): Improve error message when trying to call *note
     issubclass(): 9c4. against a *note typing.Protocol: 56b. that has
     non-method members.  Patch by Randolf Scholz.

   - gh-112137(84): Change *note dis: 3c. output to display no-lineno as
     "-" instead of "None".

   - gh-112332(85): Deprecate the ‘exc_type’ field of *note
     traceback.TracebackException: 563.  Add ‘exc_type_str’ to replace
     it.

   - gh-81620(86): Add extra tests for *note random.binomialvariate():
     6d7.

   - gh-112292(87): Fix a crash in *note readline: bf. when imported
     from a sub interpreter.  Patch by Anthony Shaw

   - gh-77621(88): Slightly improve the import time of the *note
     pathlib: a8. module by deferring some imports.  Patch by Barney
     Gale.

   - gh-112137(89): Change *note dis: 3c. output to display logical
     labels for jump targets instead of offsets.

   - gh-112139(90): Add ‘Signature.format()’ to format signatures to
     string with extra options.  And use it in *note pydoc: ba. to
     render more readable signatures that have new lines between
     parameters.

   - gh-112105(91): Make *note readline.set_completer_delims(): 1a2a.
     work with libedit

   - gh-106922(92): Display multiple lines with ‘traceback’ when errors
     span multiple lines.

   - gh-111874(93): When creating a *note typing.NamedTuple: 331. class,
     ensure *note __set_name__(): e48. is called on all objects that
     define ‘__set_name__’ and exist in the values of the ‘NamedTuple’
     class's class dictionary.  Patch by Alex Waygood.

   - gh-68166(94): Add support of the "vsapi" element type in *note
     tkinter.ttk.Style.element_create(): 55f.

   - gh-110275(95): Named tuple's methods ‘_replace()’ and
     ‘__replace__()’ now raise TypeError instead of ValueError for
     invalid keyword arguments.

   - gh-99367(96): Do not mangle ‘sys.path[0]’ in *note pdb: aa. if
     safe_path is set

   - gh-111615(97): Fix a regression caused by a fix to gh-93162(98)
     whereby you couldn't configure a ‘QueueHandler’ without specifying
     handlers.

   - gh-75666(99): Fix the behavior of *note tkinter: f6. widget's
     ‘unbind()’ method with two arguments.  Previously,
     ‘widget.unbind(sequence, funcid)’ destroyed the current binding for
     'sequence', leaving 'sequence' unbound, and deleted the 'funcid'
     command.  Now it removes only 'funcid' from the binding for
     'sequence', keeping other commands, and deletes the 'funcid'
     command.  It leaves 'sequence' unbound only if 'funcid' was the
     last bound command.

   - gh-67790(100): Implement basic formatting support (minimum width,
     alignment, fill) for *note fractions.Fraction: 213.

   - gh-111049(101): Fix crash during garbage collection of the *note
     io.BytesIO: 10a4. buffer object.

   - gh-102980(102): Redirect the output of ‘interact’ command of *note
     pdb: aa. to the same channel as the debugger.  Add tests and
     improve docs.

   - gh-102988(103): *note email.utils.getaddresses(): 4f3. and *note
     email.utils.parseaddr(): 4f4. now return ‘('', '')’ 2-tuples in
     more situations where invalid email addresses are encountered
     instead of potentially inaccurate values.  Add optional 'strict'
     parameter to these two functions: use ‘strict=False’ to get the old
     behavior, accept malformed inputs.  ‘getattr(email.utils,
     'supports_strict_parsing', False)’ can be use to check if the
     'strict' parameter is available.  Patch by Thomas Dwyer and Victor
     Stinner to improve the CVE 2023-27043(104) fix.

   - gh-52161(105): *note cmd.Cmd.do_help(): 1a2b. now cleans docstrings
     with *note inspect.cleandoc(): 1a2c. before writing them.  Patch by
     Filip Łapkiewicz.

   - gh-82300(106): Add ‘track’ parameter to *note
     multiprocessing.shared_memory.SharedMemory: 19d8. that allows using
     shared memory blocks without having to register with the POSIX
     resource tracker that automatically releases them upon process
     exit.

   - gh-110109(107): Add private ‘pathlib._PurePathBase’ class: a base
     class for *note pathlib.PurePath: 6cd. that omits certain magic
     methods.  It may be made public (along with ‘_PathBase’) in future.

   - gh-109858(108): Protect *note zipfile: 137. from "quoted-overlap"
     zipbomb.  It now raises BadZipFile when try to read an entry that
     overlaps with other entry or central directory.

   - gh-109786(109): Fix possible reference leaks and crash when
     re-enter the ‘__next__()’ method of *note itertools.pairwise: a16.

   - gh-91539(110): Small (10 - 20%) and trivial performance improvement
     of ‘urllib.request.getproxies_environment()’, typically useful when
     there are many environment variables to go over.

   - gh-103363(111): Add 'follow_symlinks' keyword-only argument to
     *note pathlib.Path.owner(): 53b. and *note group(): 53c, defaulting
     to ‘True’.

   - gh-102130(112): Support tab completion in *note cmd: 1a. for
     ‘editline’.

   - gh-99437(113): *note runpy.run_path(): 4a4. now decodes path-like
     objects, making sure __file__ and sys.argv[0] of the module being
     run are always strings.

   - gh-104003(114): Add *note warnings.deprecated(): 489, a decorator
     to mark deprecated functions to static type checkers and to warn on
     usage of deprecated classes and functions.  See PEP 702(115).
     Patch by Jelle Zijlstra.

   - gh-103708(116): Make hardcoded python name, a configurable
     parameter so that different implementations of python can override
     it instead of making huge diffs in sysconfig.py

   - gh-66515(117): *note mailbox.MH: 1a2d. now supports folders that do
     not contain a ‘.mh_sequences’ file (e.g.  Claws Mail IMAP-cache
     folders).  Patch by Serhiy Storchaka.

   - gh-83162(118): Renamed ‘re.error’ to ‘PatternError’ for clarity,
     and kept ‘re.error’ for backward compatibility.  Patch by Matthias
     Bussonnier and Adam Chhina.

   - gh-91133(119): Fix a bug in *note tempfile.TemporaryDirectory:
     144c. cleanup, which now no longer dereferences symlinks when
     working around file system permission errors.

   - bpo-43153(120): On Windows, ‘tempfile.TemporaryDirectory’
     previously masked a ‘PermissionError’ with ‘NotADirectoryError’
     during directory cleanup.  It now correctly raises
     ‘PermissionError’ if errors are not ignored.  Patch by Andrei
     Kulakov and Ken Jin.

   - bpo-32731(121): *note getpass.getuser(): 65a. now raises *note
     OSError: 2c0. for all failures rather than *note ImportError: 65b.
     on systems lacking the *note pwd: b7. module or *note KeyError:
     5e7. if the password database is empty.

   - bpo-34321(122): *note mmap.mmap: 519. now has a 'trackfd' parameter
     on Unix; if it is ‘False’, the file descriptor specified by
     'fileno' will not be duplicated.

   - bpo-35332(123): The *note shutil.rmtree(): 356. function now
     ignores errors when calling *note os.close(): d6b. when
     'ignore_errors' is ‘True’, and *note os.close(): d6b. no longer
     retried after error.

   - bpo-35928(124): *note io.TextIOWrapper: 9be. now correctly handles
     the decoding buffer after ‘read()’ and ‘write()’.

   - bpo-26791(125): *note shutil.move(): c51. now moves a symlink into
     a directory when that directory is the target of the symlink.  This
     provides the same behavior as the mv shell command.  The previous
     behavior raised an exception.  Patch by Jeffrey Kintscher.

   - bpo-41422(126): Fixed memory leaks of *note pickle.Pickler: c13.
     and *note pickle.Unpickler: 1777. involving cyclic references via
     the internal memo mapping.

   - bpo-19821(127): The ‘pydoc.ispackage()’ function has been
     deprecated.

   - bpo-40262(128): The ‘ssl.SSLSocket.recv_into()’ method no longer
     requires the 'buffer' argument to implement ‘__len__’ and supports
     buffers with arbitrary item size.

   - bpo-39912(129): *note warnings.filterwarnings(): 16c2. and *note
     warnings.simplefilter(): 8d0. now raise appropriate exceptions
     instead of ‘AssertionError’.  Patch contributed by Rémi Lapeyre.

   - bpo-37260(130): Fixed a race condition in *note shutil.rmtree():
     356. in which directory entries removed by another process or
     thread while ‘shutil.rmtree()’ is running can cause it to raise
     FileNotFoundError.  Patch by Jeffrey Kintscher.

   - bpo-36959(131): Fix some error messages for invalid ISO format
     string combinations in ‘strptime()’ that referred to directives not
     contained in the format string.  Patch by Gordon P. Hemsley.

   - bpo-18060(132): Fixed a class inheritance issue that can cause
     segfaults when deriving two or more levels of subclasses from a
     base class of Structure or Union.

   - bpo-29779(133): Add a new *note PYTHON_HISTORY: 4b0. environment
     variable to set the location of a ‘.python_history’ file.

   - bpo-21360(134): *note mailbox.Maildir: 65e. now ignores files with
     a leading dot.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/114077

   (2) https://github.com/python/cpython/issues/111803

   (3) https://github.com/python/cpython/issues/114014

   (4) https://github.com/python/cpython/issues/108364

   (5) https://github.com/python/cpython/issues/113971

   (6) https://github.com/python/cpython/issues/113877

   (7) https://github.com/python/cpython/issues/113868

   (8) https://github.com/python/cpython/issues/113848

   (9) https://github.com/python/cpython/issues/113661

   (10) https://github.com/python/cpython/issues/96037

   (11) https://github.com/python/cpython/issues/113781

   (12) https://github.com/python/cpython/issues/113238

   (13) https://github.com/python/cpython/issues/111693

   (14) https://github.com/python/cpython/issues/113791

   (15) https://github.com/python/cpython/issues/112932

   (16) https://github.com/python/cpython/issues/113568

   (17) https://github.com/python/cpython/issues/113594

   (18) https://github.com/python/cpython/issues/113538

   (19) https://github.com/python/cpython/issues/113626

   (20) https://github.com/python/cpython/issues/85567

   (21) https://github.com/python/cpython/issues/113537

   (22) https://github.com/python/cpython/issues/89850

   (23) https://github.com/python/cpython/issues/113569

   (24) https://github.com/python/cpython/issues/101225

   (25) https://github.com/python/cpython/issues/113568

   (26) https://github.com/python/cpython/issues/113543

   (27) https://github.com/python/cpython/issues/113028

   (28) https://github.com/python/cpython/issues/113421

   (29) https://github.com/python/cpython/issues/111784

   (30) https://github.com/python/cpython/issues/113407

   (31) https://github.com/python/cpython/issues/113320

   (32) https://github.com/python/cpython/issues/53502

   (33) https://github.com/python/cpython/issues/113358

   (34) https://github.com/python/cpython/issues/113214

   (35) https://github.com/python/cpython/issues/113246

   (36) https://github.com/python/cpython/issues/87264

   (37) https://github.com/python/cpython/issues/112182

   (38) https://github.com/python/cpython/issues/113225

   (39) https://github.com/python/cpython/issues/113149

   (40) https://github.com/python/cpython/issues/113117

   (41) https://github.com/python/cpython/issues/113199

   (42) https://github.com/python/cpython/issues/113191

   (43) https://github.com/python/cpython/issues/113188

   (44) https://github.com/python/cpython/issues/113119

   (45) https://github.com/python/cpython/issues/113202

   (46) https://github.com/python/cpython/issues/61648

   (47) https://github.com/python/cpython/issues/113175

   (48) https://github.com/python/cpython/issues/59616

   (49) https://github.com/python/cpython/issues/112559

   (50) https://github.com/python/cpython/issues/112962

   (51) https://github.com/python/cpython/issues/112989

   (52) https://github.com/python/cpython/issues/112970

   (53) https://github.com/python/cpython/issues/110190

   (54) https://github.com/python/cpython/issues/112540

   (55) https://github.com/python/cpython/issues/87286

   (56) https://github.com/python/cpython/issues/112800

   (57) https://github.com/python/cpython/issues/51944

   (58) https://github.com/python/cpython/issues/79325

   (59) https://github.com/python/cpython/issues/94692

   (60) https://github.com/python/cpython/issues/112736

   (61) https://github.com/python/cpython/issues/112727

   (62) https://github.com/python/cpython/issues/74690

   (63) https://github.com/python/cpython/issues/74690

   (64) https://github.com/python/cpython/issues/112645

   (65) https://github.com/python/cpython/issues/112640

   (66) https://github.com/python/cpython/issues/112622

   (67) https://github.com/python/cpython/issues/112618

   (68) https://github.com/python/cpython/issues/112334

   (69) https://github.com/python/cpython/issues/110190

   (70) https://github.com/python/cpython/issues/81194

   (71) https://github.com/python/cpython/issues/112578

   (72) https://github.com/python/cpython/issues/112516

   (73) https://github.com/python/cpython/issues/112510

   (74) https://github.com/python/cpython/issues/112328

   (75) https://github.com/python/cpython/issues/112509

   (76) https://github.com/python/cpython/issues/101336

   (77) https://github.com/python/cpython/issues/63284

   (78) https://github.com/python/cpython/issues/112414

   (79) https://github.com/python/cpython/issues/112358

   (80) https://github.com/python/cpython/issues/112405

   (81) https://github.com/python/cpython/issues/94722

   (82) https://github.com/python/cpython/issues/112361

   (83) https://github.com/python/cpython/issues/112345

   (84) https://github.com/python/cpython/issues/112137

   (85) https://github.com/python/cpython/issues/112332

   (86) https://github.com/python/cpython/issues/81620

   (87) https://github.com/python/cpython/issues/112292

   (88) https://github.com/python/cpython/issues/77621

   (89) https://github.com/python/cpython/issues/112137

   (90) https://github.com/python/cpython/issues/112139

   (91) https://github.com/python/cpython/issues/112105

   (92) https://github.com/python/cpython/issues/106922

   (93) https://github.com/python/cpython/issues/111874

   (94) https://github.com/python/cpython/issues/68166

   (95) https://github.com/python/cpython/issues/110275

   (96) https://github.com/python/cpython/issues/99367

   (97) https://github.com/python/cpython/issues/111615

   (98) https://github.com/python/cpython/issues/93162

   (99) https://github.com/python/cpython/issues/75666

   (100) https://github.com/python/cpython/issues/67790

   (101) https://github.com/python/cpython/issues/111049

   (102) https://github.com/python/cpython/issues/102980

   (103) https://github.com/python/cpython/issues/102988

   (104) https://www.cve.org/CVERecord?id=CVE-2023-27043

   (105) https://github.com/python/cpython/issues/52161

   (106) https://github.com/python/cpython/issues/82300

   (107) https://github.com/python/cpython/issues/110109

   (108) https://github.com/python/cpython/issues/109858

   (109) https://github.com/python/cpython/issues/109786

   (110) https://github.com/python/cpython/issues/91539

   (111) https://github.com/python/cpython/issues/103363

   (112) https://github.com/python/cpython/issues/102130

   (113) https://github.com/python/cpython/issues/99437

   (114) https://github.com/python/cpython/issues/104003

   (115) https://peps.python.org/pep-0702/

   (116) https://github.com/python/cpython/issues/103708

   (117) https://github.com/python/cpython/issues/66515

   (118) https://github.com/python/cpython/issues/83162

   (119) https://github.com/python/cpython/issues/91133

   (120) https://bugs.python.org/issue?@action=redirect&bpo=43153

   (121) https://bugs.python.org/issue?@action=redirect&bpo=32731

   (122) https://bugs.python.org/issue?@action=redirect&bpo=34321

   (123) https://bugs.python.org/issue?@action=redirect&bpo=35332

   (124) https://bugs.python.org/issue?@action=redirect&bpo=35928

   (125) https://bugs.python.org/issue?@action=redirect&bpo=26791

   (126) https://bugs.python.org/issue?@action=redirect&bpo=41422

   (127) https://bugs.python.org/issue?@action=redirect&bpo=19821

   (128) https://bugs.python.org/issue?@action=redirect&bpo=40262

   (129) https://bugs.python.org/issue?@action=redirect&bpo=39912

   (130) https://bugs.python.org/issue?@action=redirect&bpo=37260

   (131) https://bugs.python.org/issue?@action=redirect&bpo=36959

   (132) https://bugs.python.org/issue?@action=redirect&bpo=18060

   (133) https://bugs.python.org/issue?@action=redirect&bpo=29779

   (134) https://bugs.python.org/issue?@action=redirect&bpo=21360


File: python.info,  Node: ドキュメント<19>,  Next: テスト<17>,  Prev: ライブラリ<62>,  Up: Python 3 13 0 alpha 3

1.24.24.4 ドキュメント
......................

   - gh-111699(1): Relocate ‘smtpd’ deprecation notice to its own
     section rather than under ‘locale’ in What's New in Python 3.12
     document

   - gh-110746(2): Improved markup for valid options/values for methods
     ttk.treeview.column and ttk.treeview.heading, and for Layouts.

   - gh-95649(3): Document that the *note asyncio: b. module contains
     code taken from v0.16.0 of the uvloop project(4), as well as the
     required MIT licensing information.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/111699

   (2) https://github.com/python/cpython/issues/110746

   (3) https://github.com/python/cpython/issues/95649

   (4) https://github.com/MagicStack/uvloop/tree/v0.16.0


File: python.info,  Node: テスト<17>,  Next: ビルド<20>,  Prev: ドキュメント<19>,  Up: Python 3 13 0 alpha 3

1.24.24.5 テスト
................

   - gh-111798(1): Disable ‘test_super_deep()’ from ‘test_call’ under
     pydebug builds on WASI; the stack depth is too small to make the
     test useful.

   - gh-111801(2): Lower the recursion limit in ‘test_isinstance’ for
     ‘test_infinitely_many_bases()’.  This prevents a stack overflow on
     a pydebug build of WASI.

   - gh-111802(3): Specify a low recursion depth for
     ‘test_bad_getattr()’ in ‘test.pickletester’ to avoid exhausting the
     stack under a pydebug build for WASI.

   - gh-44626(4): Fix *note os.path.isabs(): 531. incorrectly returning
     ‘True’ when given a path that starts with exactly one (back)slash
     on Windows.

     Fix ‘pathlib.PureWindowsPath.is_absolute()’ incorrectly returning
     ‘False’ for some paths beginning with two (back)slashes.

   - gh-113633(5): Use module state for the _testcapi extension module.

   - gh-109980(6): Fix ‘test_tarfile_vs_tar’ in ‘test_shutil’ for macOS,
     where system tar can include more information in the archive than
     *note shutil.make_archive: 6da.

   - gh-112769(7): The tests now correctly compare zlib version when
     *note zlib.ZLIB_RUNTIME_VERSION: 1386. contains non-integer
     suffixes.  For example zlib-ng defines the version as
     ‘1.3.0.zlib-ng’.

   - gh-112334(8): Adds a regression test to verify that ‘vfork()’ is
     used when expected by *note subprocess: dc. on vfork enabled POSIX
     systems (Linux).

   - gh-108927(9): Fixed order dependence in running tests in the same
     process when a test that has submodules (e.g.  test_importlib)
     follows a test that imports its submodule (e.g.
     test_importlib.util) and precedes a test (e.g.  test_unittest or
     test_compileall) that uses that submodule.

   - bpo-40648(10): Test modes that file can get with chmod() on
     Windows.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/111798

   (2) https://github.com/python/cpython/issues/111801

   (3) https://github.com/python/cpython/issues/111802

   (4) https://github.com/python/cpython/issues/44626

   (5) https://github.com/python/cpython/issues/113633

   (6) https://github.com/python/cpython/issues/109980

   (7) https://github.com/python/cpython/issues/112769

   (8) https://github.com/python/cpython/issues/112334

   (9) https://github.com/python/cpython/issues/108927

   (10) https://bugs.python.org/issue?@action=redirect&bpo=40648


File: python.info,  Node: ビルド<20>,  Next: Windows<19>,  Prev: テスト<17>,  Up: Python 3 13 0 alpha 3

1.24.24.6 ビルド
................

   - gh-114013(1): Fix ‘Tools/wasm/wasi.py’ to not include the path to
     ‘python.wasm’ as part of ‘HOSTRUNNER’.  The environment variable is
     meant to specify how to run the WASI host only, having
     ‘python.wasm’ and relevant flags appended to the ‘HOSTRUNNER’.
     This fixes ‘make test’ work.

   - gh-113258(2): Changed the Windows build to write out generated
     frozen modules into the build tree instead of the source tree.

   - gh-112305(3): Fixed the ‘check-clean-src’ step performed on out of
     tree builds to detect errant ‘$(srcdir)/Python/frozen_modules/*.h’
     files and recommend appropriate source tree cleanup steps to get a
     working build again.

   - gh-112536(4): Add support for thread sanitizer (TSAN)

   - gh-112867(5): Fix the build for the case that
     WITH_PYMALLOC_RADIX_TREE=0 set.

   - gh-103065(6): Introduce ‘Tools/wasm/wasi.py’ to simplify doing a
     WASI build.

   - bpo-11102(7): The *note os.major(): 195e, *note os.makedev(): 1960,
     and *note os.minor(): 195f. functions are now available on HP-UX
     v3.

   - bpo-36351(8): Do not set ipv6type when cross-compiling.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/114013

   (2) https://github.com/python/cpython/issues/113258

   (3) https://github.com/python/cpython/issues/112305

   (4) https://github.com/python/cpython/issues/112536

   (5) https://github.com/python/cpython/issues/112867

   (6) https://github.com/python/cpython/issues/103065

   (7) https://bugs.python.org/issue?@action=redirect&bpo=11102

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36351


File: python.info,  Node: Windows<19>,  Next: macOS<12>,  Prev: ビルド<20>,  Up: Python 3 13 0 alpha 3

1.24.24.7 Windows
.................

   - gh-114096(1): Process privileges that are activated for creating
     directory junctions are now restored afterwards, avoiding behaviour
     changes in other parts of the program.

   - gh-111877(2): *note os.stat(): 26d. calls were returning incorrect
     time values for files that could not be accessed directly.

   - gh-111973(3): Update Windows installer to use SQLite 3.44.2.

   - gh-113009(4): *note multiprocessing: 98.: On Windows, fix a race
     condition in ‘Process.terminate()’: no longer set the ‘returncode’
     attribute to always call ‘WaitForSingleObject()’ in
     ‘Process.wait()’.  Previously, sometimes the process was still
     running after ‘TerminateProcess()’ even if ‘GetExitCodeProcess()’
     is not ‘STILL_ACTIVE’.  Patch by Victor Stinner.

   - gh-86179(5): Fixes path calculations when launching Python on
     Windows through a symlink.

   - gh-71383(6): Update Tcl/Tk in Windows installer to 8.6.13 with a
     patch to suppress incorrect ThemeChanged warnings.

   - gh-111650(7): Ensures the ‘Py_GIL_DISABLED’ preprocessor variable
     is defined in ‘pyconfig.h’ so that extension modules written in C
     are able to use it.

   - gh-112278(8): Reduce the time cost for some functions in *note
     platform: af. on Windows if current user has no permission to the
     WMI.

   - gh-73427(9): Deprecate *note sys._enablelegacywindowsfsencoding():
     33e.  Use *note PYTHONLEGACYWINDOWSFSENCODING: 33f. instead.  Patch
     by Inada Naoki.

   - gh-87868(10): Correctly sort and remove duplicate environment
     variables in ‘_winapi.CreateProcess()’.

   - bpo-37308(11): Fix mojibake in *note mmap.mmap: 519. when using a
     non-ASCII 'tagname' argument on Windows.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/114096

   (2) https://github.com/python/cpython/issues/111877

   (3) https://github.com/python/cpython/issues/111973

   (4) https://github.com/python/cpython/issues/113009

   (5) https://github.com/python/cpython/issues/86179

   (6) https://github.com/python/cpython/issues/71383

   (7) https://github.com/python/cpython/issues/111650

   (8) https://github.com/python/cpython/issues/112278

   (9) https://github.com/python/cpython/issues/73427

   (10) https://github.com/python/cpython/issues/87868

   (11) https://bugs.python.org/issue?@action=redirect&bpo=37308


File: python.info,  Node: macOS<12>,  Next: IDLE<11>,  Prev: Windows<19>,  Up: Python 3 13 0 alpha 3

1.24.24.8 macOS
...............

   - gh-113666(1): Add the following constants to module *note stat:
     d6.: ‘UF_SETTABLE’, ‘UF_TRACKED’, ‘UF_DATAVAULT’, ‘SF_SUPPORTED’,
     ‘SF_SETTABLE’, ‘SF_SYNTHETIC’, ‘SF_RESTRICTED’, ‘SF_FIRMLINK’ and
     ‘SF_DATALESS’.  The values ‘UF_SETTABLE’, ‘SF_SUPPORTED’,
     ‘SF_SETTABLE’ and ‘SF_SYNTHETIC’ are only available on macOS.

   - gh-113536(2): *note os.waitid(): f99. is now available on macOS

   - gh-110459(3): Running ‘configure ... --with-openssl-rpath=X/Y/Z’ no
     longer fails to detect OpenSSL on macOS.

   - gh-74573(4): Document that *note dbm.ndbm: 38. can silently corrupt
     DBM files on updates when exceeding undocumented platform limits,
     and can crash (segmentation fault) when reading such a corrupted
     file.  (FB8919203)

   - gh-65701(5): The ‘freeze’ tool doesn't work with framework builds
     of Python.  Document this and bail out early when running the tool
     with such a build.

   - gh-87277(6): webbrowser: Don't look for X11 browsers on macOS.
     Those are generally not used and probing for them can result in
     starting XQuartz even if it isn't used otherwise.

   - gh-111973(7): Update macOS installer to use SQLite 3.44.2.

   - gh-108269(8): Set ‘CFBundleAllowMixedLocalizations’ to true in the
     Info.plist for the framework, embedded Python.app and IDLE.app with
     framework installs on macOS. This allows applications to pick up
     the user's preferred locale when that's different from english.

   - gh-102362(9): Make sure the result of ‘sysconfig.get_plaform()’
     includes at least a major and minor versions, even if
     ‘MACOSX_DEPLOYMENT_TARGET’ is set to only a major version during
     build to match the format expected by pip.

   - gh-110017(10): Disable a signal handling stress test on macOS due
     to a bug in macOS (FB13453490).

   - gh-110820(11): Make sure the preprocessor definitions for
     ‘ALIGNOF_MAX_ALIGN_T’, ‘SIZEOF_LONG_DOUBLE’ and
     ‘HAVE_GCC_ASM_FOR_X64’ are correct for Universal 2 builds on macOS.

   - gh-109981(12): Use ‘/dev/fd’ on macOS to determine the number of
     open files in ‘test.support.os_helper.fd_count’ to avoid a crash
     with "guarded" file descriptors when probing for open files.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/113666

   (2) https://github.com/python/cpython/issues/113536

   (3) https://github.com/python/cpython/issues/110459

   (4) https://github.com/python/cpython/issues/74573

   (5) https://github.com/python/cpython/issues/65701

   (6) https://github.com/python/cpython/issues/87277

   (7) https://github.com/python/cpython/issues/111973

   (8) https://github.com/python/cpython/issues/108269

   (9) https://github.com/python/cpython/issues/102362

   (10) https://github.com/python/cpython/issues/110017

   (11) https://github.com/python/cpython/issues/110820

   (12) https://github.com/python/cpython/issues/109981


File: python.info,  Node: IDLE<11>,  Next: C API<20>,  Prev: macOS<12>,  Up: Python 3 13 0 alpha 3

1.24.24.9 IDLE
..............

   - gh-72284(1): Improve the lists of features, editor key bindings,
     and shell key bingings in the IDLE doc.

   - gh-113903(2): Fix rare failure of test.test_idle, in
     test_configdialog.

   - gh-113729(3): Fix the "Help -> IDLE Doc" menu bug in 3.11.7 and
     3.12.1.

   - gh-113269(4): Fix test_editor hang on macOS Catalina.

   - gh-112898(5): Fix processing unsaved files when quitting IDLE on
     macOS.

   - bpo-13586(6): Enter the selected text when opening the "Replace"
     dialog.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/72284

   (2) https://github.com/python/cpython/issues/113903

   (3) https://github.com/python/cpython/issues/113729

   (4) https://github.com/python/cpython/issues/113269

   (5) https://github.com/python/cpython/issues/112898

   (6) https://bugs.python.org/issue?@action=redirect&bpo=13586


File: python.info,  Node: C API<20>,  Prev: IDLE<11>,  Up: Python 3 13 0 alpha 3

1.24.24.10 C API
................

   - gh-106560(1): Fix redundant declarations in the public C API.
     Declare PyBool_Type, PyLong_Type and PySys_Audit() only once.
     Patch by Victor Stinner.

   - gh-112438(2): Fix support of format units "es", "et", "es#", and
     "et#" in nested tuples in *note PyArg_ParseTuple(): 3c1.-like
     functions.

   - gh-111545(3): Add *note Py_HashPointer(): 425. function to hash a
     pointer.  Patch by Victor Stinner.

   - gh-65210(4): Change the declaration of the 'keywords' parameter of
     *note PyArg_ParseTupleAndKeywords(): 624. and *note
     PyArg_VaParseTupleAndKeywords(): 625. for better compatibility with
     C++.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/106560

   (2) https://github.com/python/cpython/issues/112438

   (3) https://github.com/python/cpython/issues/111545

   (4) https://github.com/python/cpython/issues/65210


File: python.info,  Node: Python 3 13 0 alpha 2,  Next: Python 3 13 0 alpha 1,  Prev: Python 3 13 0 alpha 3,  Up: 変更履歴

1.24.25 Python 3.13.0 alpha 2
-----------------------------

'Release date: 2023-11-22'

* Menu:

* Core and Builtins: Core and Builtins<58>.
* ライブラリ: ライブラリ<63>.
* テスト: テスト<18>.
* ビルド: ビルド<21>.
* Windows: Windows<20>.
* macOS: macOS<13>.
* IDLE: IDLE<12>.
* Tools/Demos: Tools/Demos<18>.
* C API: C API<21>.


File: python.info,  Node: Core and Builtins<58>,  Next: ライブラリ<63>,  Up: Python 3 13 0 alpha 2

1.24.25.1 Core and Builtins
...........................

   - gh-112243(1): Don't include comments in f-string debug expressions.
     Patch by Pablo Galindo

   - gh-112287(2): Slightly optimize the Tier 2 (uop) interpreter by
     only loading ‘oparg’ and ‘operand’ when needed.  Also double the
     trace size limit again, to 512 this time.

   - gh-112266(3): Change docstrings of *note __dict__: 77d. and
     ‘__weakref__’.

   - gh-111807(4): Lower the max parser stack depth to 1000 under WASI
     debug builds.

   - gh-111798(5): When Python is built in debug mode, set the C
     recursion limit to 500 instead of 1500.  A debug build is likely
     built with low optimization level which implies higher stack memory
     usage than a release build.  Patch by Victor Stinner.

   - gh-106529(6): Enable translating unspecialized ‘FOR_ITER’ to Tier
     2.

   - gh-111916(7): Make hashlib related modules thread-safe without the
     GIL

   - gh-81137(8): Deprecate assignment to a function's ‘__code__’ field
     when the new code object is of a mismatched type (e.g., from a
     generator to a plain function).

   - gh-79932(9): Raise exception if *note frame.clear(): 585. is called
     on a suspended frame.

   - gh-81925(10): Implement native thread ids for GNU KFreeBSD.

   - gh-111843(11): Use exponential backoff to reduce the number of
     failed tier 2 optimization attempts by over 99%.

   - gh-110829(12): Joining a thread now ensures the underlying OS
     thread has exited.  This is required for safer fork() in
     multi-threaded processes.

   - gh-109369(13): Make sure that tier 2 traces are de-optimized if the
     code is instrumented

   - gh-111772(14): Specialize slot loads and stores for _Py_T_OBJECT as
     well as Py_T_OBJECT_EX

   - gh-111666(15): Speed up *note BaseExceptionGroup.derive(): 1a37,
     *note BaseExceptionGroup.subgroup(): 1a38, and *note
     BaseExceptionGroup.split(): 18d8. by changing how they parse passed
     arguments.

   - gh-111654(16): Fix runtime crash when some error happens in opcode
     ‘LOAD_FROM_DICT_OR_DEREF’.

   - gh-111623(17): Add support for sharing tuples between interpreters
     using the cross-interpreter API. Patch by Anthony Shaw.

   - gh-111354(18): The oparg of *note YIELD_VALUE: 5ba. is now ‘1’ if
     the instruction is part of a yield-from or await, and ‘0’
     otherwise.

     The SUSPENDED frame state is now split into ‘SUSPENDED’ and
     ‘SUSPENDED_YIELD_FROM’.  This simplifies the code in ‘_PyGen_yf’.

   - gh-111520(19): Merge the Tier 1 (bytecode) and Tier 2 (micro-ops)
     interpreters together, moving the Tier 2 interpreter loop and
     switch into ‘_PyEval_EvalFrameDefault()’ in ‘Python/ceval.c’.  The
     ‘Python/executor.c’ file is gone.  Also the ‘TIER_ONE’ and
     ‘TIER_TWO’ macros are now handled by the code generator.

     'Beware!'  This changes the environment variables to enable
     micro-ops and their debugging to ‘PYTHON_UOPS’ and
     ‘PYTHON_LLTRACE’.

   - gh-109181(20): Speed up ‘Traceback’ object creation by lazily
     compute the line number.  Patch by Pablo Galindo

   - gh-111420(21): Allow type comments in parenthesized ‘with’
     statements

   - gh-111438(22): Add support for sharing floats between interpreters
     using the cross-interpreter API. Patch by Anthony Shaw.

   - gh-111435(23): Add support for sharing of ‘True’ and ‘False’
     between interpreters using the cross-interpreter API. Patch by
     Anthony Shaw.

   - gh-102388(24): Fix a bug where ‘iso2022_jp_3’ and ‘iso2022_jp_2004’
     codecs read out of bounds

   - gh-111366(25): Fix an issue in the *note codeop: 1d. that was
     causing *note SyntaxError: 18e. exceptions raised in the presence
     of invalid syntax to not contain precise error messages.  Patch by
     Pablo Galindo

   - gh-111380(26): Fix a bug that was causing *note SyntaxWarning: 1ae.
     to appear twice when parsing if invalid syntax is encountered
     later.  Patch by Pablo galindo

   - gh-111374(27): Added a new environment variable *note
     PYTHON_FROZEN_MODULES: 4ad.  It determines whether or not frozen
     modules are ignored by the import machinery, equivalent of the
     *note -X frozen_modules: 16f. command-line option.

   - gh-111354(28): Remove ‘oparg’ from *note YIELD_VALUE: 5ba.  Change
     ‘oparg’ of *note RESUME: 5bb. to include information about the
     except-depth.  These changes make it possible to simplify the code
     in generator close.

   - gh-94438(29): Fix a regression that prevented jumping across ‘is
     None’ and ‘is not None’ when debugging.  Patch by Savannah
     Ostrowski.

   - gh-67224(30): Show source lines in tracebacks when using the ‘-c’
     option when running Python.  Patch by Pablo Galindo

   - gh-111123(31): Fix a bug where a *note global: 4ac. declaration in
     an *note except: 1ab. block is rejected when the global is used in
     the *note else: 17c. block.

   - gh-110938(32): Fix error messages for indented blocks with
     functions and classes with generic type parameters.  Patch by Pablo
     Galindo

   - gh-109214(33): Remove unnecessary instruction pointer updates
     before returning from frames.

   - gh-110912(34): Correctly display the traceback for *note
     MemoryError: 179e. exceptions using the *note traceback: 104.
     module.  Patch by Pablo Galindo

   - gh-109894(35): Fixed crash due to improperly initialized static
     *note MemoryError: 179e. in subinterpreter.

   - gh-110892(36): Return ‘NULL’ for ‘PyTrace_RETURN’ events caused by
     an exception

   - gh-110864(37): Fix argument parsing by
     ‘_PyArg_UnpackKeywordsWithVararg’ for functions defining
     pos-or-keyword, vararg, and kw-only parameters.

   - gh-109094(38): Replace ‘prev_instr’ on the interpreter frame by
     ‘instr_ptr’ which points to the beginning of the instruction that
     is currently executing (or will execute once the frame resumes).

   - gh-110805(39): Allow the repl to show source code and complete
     tracebacks.  Patch by Pablo Galindo

   - gh-110722(40): Add ‘PYTHON_PRESITE=package.module’ to import a
     module early in the interpreter lifecycle before ‘site.py’ is
     executed.  Python needs to be *note built in debug mode: 509. for
     this option to exist.

   - gh-110481(41): Implement biased reference counting in
     ‘--disable-gil’ builds.

   - gh-110543(42): Fix regression in Python 3.12 where
     ‘types.CodeType.replace()’ would produce a broken code object if
     called on a module or class code object that contains a
     comprehension.  Patch by Jelle Zijlstra.

   - gh-89519(43): Removed chained *note classmethod: 48e. descriptors
     (introduced in bpo-19072(44)).  This can no longer be used to wrap
     other descriptors such as *note property: 4b3.  The core design of
     this feature was flawed and caused a number of downstream problems.
     To "pass-through" a *note classmethod: 48e, consider using the
     ‘__wrapped__’ attribute that was added in Python 3.10.

   - gh-103615(45): Use local events for opcode tracing

   - bpo-46657(46): Add mimalloc memory allocator support.

   - gh-106718(47): When PyConfig.stdlib_dir is explicitly set, it's now
     respected and won't be overridden by PyConfig.home.

   - gh-106905(48): Fix incorrect SystemError about AST constructor
     recursion depth mismatch.

   - gh-100445(49): Improve error message for unterminated strings with
     escapes.

   - bpo-45759(50): Improved error messages for ‘elif’/‘else’ statements
     not matching any valid statements.  Patch by Jeremiah Vivian.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/112243

   (2) https://github.com/python/cpython/issues/112287

   (3) https://github.com/python/cpython/issues/112266

   (4) https://github.com/python/cpython/issues/111807

   (5) https://github.com/python/cpython/issues/111798

   (6) https://github.com/python/cpython/issues/106529

   (7) https://github.com/python/cpython/issues/111916

   (8) https://github.com/python/cpython/issues/81137

   (9) https://github.com/python/cpython/issues/79932

   (10) https://github.com/python/cpython/issues/81925

   (11) https://github.com/python/cpython/issues/111843

   (12) https://github.com/python/cpython/issues/110829

   (13) https://github.com/python/cpython/issues/109369

   (14) https://github.com/python/cpython/issues/111772

   (15) https://github.com/python/cpython/issues/111666

   (16) https://github.com/python/cpython/issues/111654

   (17) https://github.com/python/cpython/issues/111623

   (18) https://github.com/python/cpython/issues/111354

   (19) https://github.com/python/cpython/issues/111520

   (20) https://github.com/python/cpython/issues/109181

   (21) https://github.com/python/cpython/issues/111420

   (22) https://github.com/python/cpython/issues/111438

   (23) https://github.com/python/cpython/issues/111435

   (24) https://github.com/python/cpython/issues/102388

   (25) https://github.com/python/cpython/issues/111366

   (26) https://github.com/python/cpython/issues/111380

   (27) https://github.com/python/cpython/issues/111374

   (28) https://github.com/python/cpython/issues/111354

   (29) https://github.com/python/cpython/issues/94438

   (30) https://github.com/python/cpython/issues/67224

   (31) https://github.com/python/cpython/issues/111123

   (32) https://github.com/python/cpython/issues/110938

   (33) https://github.com/python/cpython/issues/109214

   (34) https://github.com/python/cpython/issues/110912

   (35) https://github.com/python/cpython/issues/109894

   (36) https://github.com/python/cpython/issues/110892

   (37) https://github.com/python/cpython/issues/110864

   (38) https://github.com/python/cpython/issues/109094

   (39) https://github.com/python/cpython/issues/110805

   (40) https://github.com/python/cpython/issues/110722

   (41) https://github.com/python/cpython/issues/110481

   (42) https://github.com/python/cpython/issues/110543

   (43) https://github.com/python/cpython/issues/89519

   (44) https://bugs.python.org/issue?@action=redirect&bpo=19072

   (45) https://github.com/python/cpython/issues/103615

   (46) https://bugs.python.org/issue?@action=redirect&bpo=46657

   (47) https://github.com/python/cpython/issues/106718

   (48) https://github.com/python/cpython/issues/106905

   (49) https://github.com/python/cpython/issues/100445

   (50) https://bugs.python.org/issue?@action=redirect&bpo=45759


File: python.info,  Node: ライブラリ<63>,  Next: テスト<18>,  Prev: Core and Builtins<58>,  Up: Python 3 13 0 alpha 2

1.24.25.2 ライブラリ
....................

   - gh-111942(1): Fix SystemError in the TextIOWrapper constructor with
     non-encodable "errors" argument in non-debug mode.

   - gh-111995(2): Added the ‘NI_IDN’ constant to the *note socket: d1.
     module when present in C at build time for use with *note
     socket.getnameinfo(): 1a3a.

   - gh-109538(3): Issue warning message instead of having *note
     RuntimeError: 244. be displayed when event loop has already been
     closed at ‘StreamWriter.__del__()’.

   - gh-111942(4): Fix crashes in *note io.TextIOWrapper.reconfigure():
     d40. when pass invalid arguments, e.g.  non-string encoding.

   - gh-111460(5): *note curses: 2f.: restore wide character support
     (including *note curses.unget_wch(): 12aa. and *note get_wch():
     12a9.) on macOS, which was unavailable due to a regression in
     Python 3.12.

   - gh-103791(6): *note contextlib.suppress: 1129. now supports
     suppressing exceptions raised as part of a *note
     BaseExceptionGroup: 566, in addition to the recent support for
     *note ExceptionGroup: 4d2.

   - gh-111835(7): The *note mmap.mmap: 519. class now has an *note
     seekable(): 51a. method that can be used when a seekable file-like
     object is required.  The *note seek(): 51b. method now returns the
     new absolute position.  Patch by Donghee Na.

   - gh-111804(8): Remove posix.fallocate() under WASI as the underlying
     posix_fallocate() is not available in WASI preview2.

   - gh-111841(9): Fix truncating arguments on an embedded null
     character in *note os.putenv(): 25b. and *note os.unsetenv(): 25c.
     on Windows.

   - gh-111768(10): *note wsgiref.util.is_hop_by_hop(): 1a3b. is now
     exposed correctly in ‘__all__’.

   - gh-80731(11): Avoid executing the default function in *note
     cmd.Cmd: 184e. in an except block

   - gh-111541(12): Fix *note doctest: 3e. for *note SyntaxError: 18e.
     not-builtin subclasses.

   - gh-111719(13): Add extra argument validation for ‘alias’ command in
     *note pdb: aa.

   - gh-111482(14): *note time: f4.: Make *note time.clock_gettime():
     1376. and *note time.clock_gettime_ns(): cdb. functions up to 2x
     faster by faster calling convention.  Patch by Victor Stinner.

   - gh-110894(15): Call loop exception handler for exceptions in
     ‘client_connected_cb’ of *note asyncio.start_server(): d0f. so that
     applications can handle it.  Patch by Kumar Aditya.

   - gh-111531(16): Fix reference leaks in ‘bind_class()’ and
     ‘bind_all()’ methods of *note tkinter: f6. widgets.

   - gh-111246(17): *note asyncio.loop.create_unix_server(): 4ca. will
     now automatically remove the Unix socket when the server is closed.

   - gh-111356(18): Added *note io.text_encoding(): 1a3c, *note
     io.DEFAULT_BUFFER_SIZE: 1a3d, and *note
     io.IncrementalNewlineDecoder: 1a3e. to ‘io.__all__’.

   - gh-66425(19): Remove the code to set the REMOTE_HOST header from
     wsgiref module, as it is unreachable.  This header is used for
     performance reasons, which is not necessary in the wsgiref module.

   - gh-111429(20): Speed up *note pathlib.PurePath.relative_to(): 2fd.
     and *note is_relative_to(): 2fe.

   - gh-111342(21): Fixed typo in *note math.sumprod(): 6bf.

   - gh-68166(22): Remove mention of not supported "vsapi" element type
     in *note tkinter.ttk.Style.element_create(): 55f.  Add tests for
     ‘element_create()’ and other ‘ttk.Style’ methods.  Add examples for
     ‘element_create()’ in the documentation.

   - gh-111388(23): Add ‘show_group’ parameter to *note
     traceback.format_exception_only(): a4e, which allows to format
     *note ExceptionGroup: 4d2. instances.

   - gh-79033(24): Another attempt at fixing *note
     asyncio.Server.wait_closed(): 1a3f.  It now blocks until both
     conditions are true: the server is closed, 'and' there are no more
     active connections.  (This means that in some cases where in 3.12.0
     this function would 'incorrectly' have returned immediately, it
     will now block; in particular, when there are no active connections
     but the server hasn't been closed yet.)

   - gh-111259(25): Optimize recursive wildcards in *note pathlib: a8.

   - gh-111295(26): Fix *note time: f4. not checking for errors when
     initializing.

   - gh-111253(27): Add error checking during ‘_socket’ module init.

   - gh-111251(28): Fix ‘_blake2’ not checking for errors when
     initializing.

   - gh-111233(29): Fix *note select: c6. not checking for errors when
     initializing.

   - gh-111230(30): Fix *note ssl: d5. not checking for errors when
     initializing.

   - gh-111174(31): Fix crash in *note io.BytesIO.getbuffer(): 140a.
     called repeatedly for empty BytesIO.

   - gh-111187(32): Postpone removal version for
     locale.getdefaultlocale() to Python 3.15.

   - gh-111159(33): Fix *note doctest: 3e. output comparison for
     exceptions with notes.

   - gh-110910(34): Fix invalid state handling in *note
     asyncio.TaskGroup: 4d1. and *note asyncio.Timeout: 1a40.  They now
     raise proper RuntimeError if they are improperly used and are left
     in consistent state after this.

   - gh-111092(35): Make turtledemo run without default root enabled.

   - gh-110944(36): Support alias and convenience vars for *note pdb:
     aa. completion

   - gh-110745(37): Added 'newline' parameter to *note
     pathlib.Path.read_text(): 1045.  Patch by Junya Okabe.

   - gh-84583(38): Make *note pdb: aa. enter post-mortem mode even for
     *note SyntaxError: 18e.

   - gh-80675(39): Set ‘f_trace_lines = True’ on all frames upon *note
     pdb.set_trace(): 272.

   - gh-110771(40): Expose the setup and cleanup portions of
     ‘asyncio.run_forever()’ as the standalone methods
     ‘asyncio.run_forever_setup()’ and ‘asyncio.run_forever_cleanup()’.
     This allows for tighter integration with GUI event loops.

   - gh-110774(41): Support setting the *note asyncio.Runner: 2f5.
     loop_factory kwarg in *note unittest.IsolatedAsyncioTestCase: 361.

   - gh-110392(42): Fix *note tty.setraw(): 1a41. and *note
     tty.setcbreak(): 19f5.: previously they returned partially modified
     list of the original tty attributes.  *note tty.cfmakeraw(): 1a42.
     and *note tty.cfmakecbreak(): 19f6. now make a copy of the list of
     special characters before modifying it.

   - gh-59013(43): Make line number of function breakpoint more precise
     in *note pdb: aa.

   - gh-88434(44): Emit deprecation warning for non-integer numbers in
     *note gettext: 67. functions and methods that consider plural forms
     even if the translation was not found.

   - gh-110395(45): Ensure that *note select.kqueue(): 1a43. objects
     correctly appear as closed in forked children, to prevent
     operations on an invalid file descriptor.

   - gh-110196(46): Add ‘__reduce__’ method to ‘IPv6Address’ in order to
     keep ‘scope_id’

   - gh-109747(47): Improve errors for unsupported look-behind patterns.
     Now re.error is raised instead of OverflowError or RuntimeError for
     too large width of look-behind pattern.

   - gh-109466(48): Add the *note ipaddress.IPv4Address.ipv6_mapped:
     50b. property, which returns the IPv4-mapped IPv6 address.

   - gh-85098(49): Implement the CLI of the *note symtable: de. module
     and improve the repr of *note Symbol: 289.

   - gh-108791(50): Improved error handling in *note pdb: aa. command
     line interface, making it produce more concise error messages.

   - gh-105931(51): Change *note compileall: 21. to only strip the
     stripdir prefix from the full path recorded in the compiled ‘.pyc’
     file, when the prefix matches the start of the full path in its
     entirety.  When the prefix does not match, no stripping is
     performed and a warning to this effect is displayed.

     Previously all path components of the stripdir prefix that matched
     the full path were removed, while those that did not match were
     left alone (including ones interspersed between matching
     components).

   - gh-107431(52): Make the ‘DictProxy’ and ‘ListProxy’ types in *note
     multiprocessing.managers: 9b. *note Generic Alias Types: 8c1. for
     ‘[]’ use in typing contexts.

   - gh-72904(53): Add *note glob.translate(): 4fb.  This function
     converts a pathname with shell-style wildcards to a regular
     expression.

   - gh-90026(54): Define ‘USE_XATTRS’ on Cygwin so that XATTR-related
     functions in the *note os: a5. module become available.

   - gh-90890(55): New methods *note mailbox.Maildir.get_info(): 1a44,
     *note mailbox.Maildir.set_info(): 1a45, *note
     mailbox.Maildir.get_flags(): 1a46, *note
     mailbox.Maildir.set_flags(): 1a47, *note
     mailbox.Maildir.add_flag(): 1a48, *note
     mailbox.Maildir.remove_flag(): 1a49.  These methods speed up
     accessing a message's info and/or flags and are useful when it is
     not necessary to access the message's contents, as when iterating
     over a Maildir to find messages with specific flags.

   - gh-102956(56): Fix returning of empty byte strings after seek in
     zipfile module

   - gh-102895(57): Added a parameter ‘local_exit’ for *note
     code.interact(): 1890. to prevent ‘exit()’ and ‘quit’ from closing
     ‘sys.stdin’ and raise ‘SystemExit’.

   - gh-97928(58): Change the behavior of ‘tkinter.Text.count()’.  It
     now always returns an integer if one or less counting options are
     specified.  Previously it could return a single count as a 1-tuple,
     an integer (only if option ‘"update"’ was specified) or ‘None’ if
     no items found.  The result is now the same if ‘wantobjects’ is set
     to ‘0’.

   - gh-96954(59): Switch the storage of the unicode codepoint names to
     use a different data-structure, a directed acyclic word graph(60).
     This makes the unicodedata shared library about 440 KiB smaller.
     Contributed by Carl Friedrich Bolz-Tereick using code from the PyPy
     project.

   - gh-73561(61): Omit the interface scope from an IPv6 address when
     used as Host header by *note http.client: 73.

   - gh-86826(62): ‘zipinfo’ now supports the full range of values in
     the TZ string determined by RFC 8536 and detects all invalid
     formats.  Both Python and C implementations now raise exceptions of
     the same type on invalid data.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/111942

   (2) https://github.com/python/cpython/issues/111995

   (3) https://github.com/python/cpython/issues/109538

   (4) https://github.com/python/cpython/issues/111942

   (5) https://github.com/python/cpython/issues/111460

   (6) https://github.com/python/cpython/issues/103791

   (7) https://github.com/python/cpython/issues/111835

   (8) https://github.com/python/cpython/issues/111804

   (9) https://github.com/python/cpython/issues/111841

   (10) https://github.com/python/cpython/issues/111768

   (11) https://github.com/python/cpython/issues/80731

   (12) https://github.com/python/cpython/issues/111541

   (13) https://github.com/python/cpython/issues/111719

   (14) https://github.com/python/cpython/issues/111482

   (15) https://github.com/python/cpython/issues/110894

   (16) https://github.com/python/cpython/issues/111531

   (17) https://github.com/python/cpython/issues/111246

   (18) https://github.com/python/cpython/issues/111356

   (19) https://github.com/python/cpython/issues/66425

   (20) https://github.com/python/cpython/issues/111429

   (21) https://github.com/python/cpython/issues/111342

   (22) https://github.com/python/cpython/issues/68166

   (23) https://github.com/python/cpython/issues/111388

   (24) https://github.com/python/cpython/issues/79033

   (25) https://github.com/python/cpython/issues/111259

   (26) https://github.com/python/cpython/issues/111295

   (27) https://github.com/python/cpython/issues/111253

   (28) https://github.com/python/cpython/issues/111251

   (29) https://github.com/python/cpython/issues/111233

   (30) https://github.com/python/cpython/issues/111230

   (31) https://github.com/python/cpython/issues/111174

   (32) https://github.com/python/cpython/issues/111187

   (33) https://github.com/python/cpython/issues/111159

   (34) https://github.com/python/cpython/issues/110910

   (35) https://github.com/python/cpython/issues/111092

   (36) https://github.com/python/cpython/issues/110944

   (37) https://github.com/python/cpython/issues/110745

   (38) https://github.com/python/cpython/issues/84583

   (39) https://github.com/python/cpython/issues/80675

   (40) https://github.com/python/cpython/issues/110771

   (41) https://github.com/python/cpython/issues/110774

   (42) https://github.com/python/cpython/issues/110392

   (43) https://github.com/python/cpython/issues/59013

   (44) https://github.com/python/cpython/issues/88434

   (45) https://github.com/python/cpython/issues/110395

   (46) https://github.com/python/cpython/issues/110196

   (47) https://github.com/python/cpython/issues/109747

   (48) https://github.com/python/cpython/issues/109466

   (49) https://github.com/python/cpython/issues/85098

   (50) https://github.com/python/cpython/issues/108791

   (51) https://github.com/python/cpython/issues/105931

   (52) https://github.com/python/cpython/issues/107431

   (53) https://github.com/python/cpython/issues/72904

   (54) https://github.com/python/cpython/issues/90026

   (55) https://github.com/python/cpython/issues/90890

   (56) https://github.com/python/cpython/issues/102956

   (57) https://github.com/python/cpython/issues/102895

   (58) https://github.com/python/cpython/issues/97928

   (59) https://github.com/python/cpython/issues/96954

   (60) 
https://en.wikipedia.org/wiki/Deterministic_acyclic_finite_state_automaton

   (61) https://github.com/python/cpython/issues/73561

   (62) https://github.com/python/cpython/issues/86826


File: python.info,  Node: テスト<18>,  Next: ビルド<21>,  Prev: ライブラリ<63>,  Up: Python 3 13 0 alpha 2

1.24.25.3 テスト
................

   - gh-111808(1): Make the default value of
     ‘test.support.infinite_recursion()’ to be conditional based on
     whether optimizations were used when compiling the interpreter.
     This helps with platforms like WASI whose stack size is greatly
     restricted in debug builds.

   - gh-110722(2): Gathering line coverage of standard libraries within
     the regression test suite is now precise, as well as much faster.
     Patch by Łukasz Langa.

   - gh-110367(3): Make regrtest ‘--verbose3’ option compatible with
     ‘--huntrleaks -jN’ options.  The ‘./python -m test -j1 -R 3:3
     --verbose3’ command now works as expected.  Patch by Victor
     Stinner.

   - gh-111165(4): Remove no longer used functions ‘run_unittest()’ and
     ‘run_doctest()’ from the *note test.support: ea. module.

   - gh-110932(5): Fix regrtest if the ‘SOURCE_DATE_EPOCH’ environment
     variable is defined: use the variable value as the random seed.
     Patch by Victor Stinner.

   - gh-110995(6): test_gdb: Fix detection of gdb built without Python
     scripting support.  Patch by Victor Stinner.

   - gh-110918(7): Test case matching patterns specified by options
     ‘--match’, ‘--ignore’, ‘--matchfile’ and ‘--ignorefile’ are now
     tested in the order of specification, and the last match determines
     whether the test case be run or ignored.

   - gh-108747(8): Add unit test for ‘usercustomize’ and ‘sitecustomize’
     hooks from *note site: cc.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/111808

   (2) https://github.com/python/cpython/issues/110722

   (3) https://github.com/python/cpython/issues/110367

   (4) https://github.com/python/cpython/issues/111165

   (5) https://github.com/python/cpython/issues/110932

   (6) https://github.com/python/cpython/issues/110995

   (7) https://github.com/python/cpython/issues/110918

   (8) https://github.com/python/cpython/issues/108747


File: python.info,  Node: ビルド<21>,  Next: Windows<20>,  Prev: テスト<18>,  Up: Python 3 13 0 alpha 2

1.24.25.4 ビルド
................

   - gh-96954(1): Make ‘make regen-unicodedata’ work for out-of-tree
     builds of CPython.

   - gh-112088(2): Add ‘Tools/build/regen-configure.sh’ script to
     regenerate the ‘configure’ with an Ubuntu container image.  The
     ‘quay.io/tiran/cpython_autoconf:271’ container image
     (tiran/cpython_autoconf(3)) is no longer used.  Patch by Victor
     Stinner.

   - gh-111046(4): For wasi-threads, memory is now exported to fix
     compatibility issues with some wasm runtimes.

   - gh-110828(5): AIX 32bit needs ‘-latomic’ to build the ‘_testcapi’
     extension module.

   - gh-85283(6): The ‘errno’, ‘md5’, ‘resource’, ‘winsound’,
     ‘_ctypes_test’, ‘_multiprocessing.posixshmem’, ‘_scproxy’, ‘_stat’,
     ‘_testimportmultiple’ and ‘_uuid’ C extensions are now built with
     the *note limited C API: 637.  Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/96954

   (2) https://github.com/python/cpython/issues/112088

   (3) https://github.com/tiran/cpython_autoconf

   (4) https://github.com/python/cpython/issues/111046

   (5) https://github.com/python/cpython/issues/110828

   (6) https://github.com/python/cpython/issues/85283


File: python.info,  Node: Windows<20>,  Next: macOS<13>,  Prev: ビルド<21>,  Up: Python 3 13 0 alpha 2

1.24.25.5 Windows
.................

   - gh-111856(1): Fixes *note fstat(): f8c. on file systems that do not
     support file ID requests.  This includes FAT32 and exFAT.

   - gh-111293(2): Fix *note os.DirEntry.inode: 1a4d. dropping higher 64
     bits of a file id on some filesystems on Windows.

   - gh-110913(3): WindowsConsoleIO now correctly chunks large buffers
     without splitting up UTF-8 sequences.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/111856

   (2) https://github.com/python/cpython/issues/111293

   (3) https://github.com/python/cpython/issues/110913


File: python.info,  Node: macOS<13>,  Next: IDLE<12>,  Prev: Windows<20>,  Up: Python 3 13 0 alpha 2

1.24.25.6 macOS
...............

   - gh-59703(1): For macOS framework builds, in ‘getpath.c’ use the
     system ‘dladdr’ function to find the path to the shared library
     rather than depending on deprecated macOS APIs.

   - gh-110950(2): Update macOS installer to include an upstream Tcl/Tk
     fix for the ‘Secure coding is not enabled for restorable state!’
     warning encountered in Tkinter on macOS 14 Sonoma.

   - gh-111015(3): Ensure that IDLE.app and Python Launcher.app are
     installed with appropriate permissions on macOS builds.

   - gh-71383(4): Update macOS installer to include an upstream Tcl/Tk
     fix for the ‘ttk::ThemeChanged’ error encountered in Tkinter.

   - gh-92603(5): Update macOS installer to include a fix accepted by
     upstream Tcl/Tk for a crash encountered after the first *note
     tkinter.Tk(): 19ac. instance is destroyed.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/59703

   (2) https://github.com/python/cpython/issues/110950

   (3) https://github.com/python/cpython/issues/111015

   (4) https://github.com/python/cpython/issues/71383

   (5) https://github.com/python/cpython/issues/92603


File: python.info,  Node: IDLE<12>,  Next: Tools/Demos<18>,  Prev: macOS<13>,  Up: Python 3 13 0 alpha 2

1.24.25.7 IDLE
..............

   - bpo-35668(1): Add docstrings to the IDLE debugger module.  Fix two
     bugs: initialize ‘Idb.botframe’ (should be in Bdb); in
     ‘Idb.in_rpc_code’, check whether ‘prev_frame’ is ‘None’ before
     trying to use it.  Greatly expand test_debugger.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35668


File: python.info,  Node: Tools/Demos<18>,  Next: C API<21>,  Prev: IDLE<12>,  Up: Python 3 13 0 alpha 2

1.24.25.8 Tools/Demos
.....................

   - gh-111903(1): Argument Clinic now supports the ‘@critical_section’
     directive that instructs Argument Clinic to generate a critical
     section around the function call, which locks the ‘self’ object in
     ‘--disable-gil’ builds.  Patch by Sam Gross.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/111903


File: python.info,  Node: C API<21>,  Prev: Tools/Demos<18>,  Up: Python 3 13 0 alpha 2

1.24.25.9 C API
...............

   - gh-112026(1): Add again the private ‘_PyThreadState_UncheckedGet()’
     function as an alias to the new public *note
     PyThreadState_GetUnchecked(): 423. function.  Patch by Victor
     Stinner.

   - gh-112026(2): Restore the removed
     ‘_PyDict_GetItemStringWithError()’ function.  It is used by numpy.
     Patch by Victor Stinner.

   - gh-112026(3): Restore removed private C API functions, macros and
     structures which have no simple replacement for now:

        * _PyDict_GetItem_KnownHash()

        * _PyDict_NewPresized()

        * _PyHASH_BITS

        * _PyHASH_IMAG

        * _PyHASH_INF

        * _PyHASH_MODULUS

        * _PyHASH_MULTIPLIER

        * _PyLong_Copy()

        * _PyLong_FromDigits()

        * _PyLong_New()

        * _PyLong_Sign()

        * _PyObject_CallMethodId()

        * _PyObject_CallMethodNoArgs()

        * _PyObject_CallMethodOneArg()

        * _PyObject_CallOneArg()

        * _PyObject_EXTRA_INIT

        * _PyObject_FastCallDict()

        * _PyObject_GetAttrId()

        * _PyObject_Vectorcall()

        * _PyObject_VectorcallMethod()

        * _PyStack_AsDict()

        * _PyThread_CurrentFrames()

        * _PyUnicodeWriter structure

        * _PyUnicodeWriter_Dealloc()

        * _PyUnicodeWriter_Finish()

        * _PyUnicodeWriter_Init()

        * _PyUnicodeWriter_Prepare()

        * _PyUnicodeWriter_PrepareKind()

        * _PyUnicodeWriter_WriteASCIIString()

        * _PyUnicodeWriter_WriteChar()

        * _PyUnicodeWriter_WriteLatin1String()

        * _PyUnicodeWriter_WriteStr()

        * _PyUnicodeWriter_WriteSubstring()

        * _PyUnicode_AsString()

        * _PyUnicode_FromId()

        * _PyVectorcall_Function()

        * _Py_IDENTIFIER()

        * _Py_c_abs()

        * _Py_c_diff()

        * _Py_c_neg()

        * _Py_c_pow()

        * _Py_c_prod()

        * _Py_c_quot()

        * _Py_c_sum()

        * _Py_static_string()

        * _Py_static_string_init()

     Patch by Victor Stinner.

   - gh-112026(4): Add again ‘<ctype.h>’ and ‘<unistd.h>’ includes in
     ‘Python.h’, but don't include them in the limited C API version
     3.13 and newer.  Patch by Victor Stinner.

   - gh-111956(5): Add internal-only one-time initialization API:
     ‘_PyOnceFlag’ and ‘_PyOnceFlag_CallOnce’.

   - gh-111262(6): Add *note PyDict_Pop(): 422. and *note
     PyDict_PopString(): 5e5. functions: remove a key from a dictionary
     and optionally return the removed value.  This is similar to *note
     dict.pop(): 5e6, but without the default value and not raising
     *note KeyError: 5e7. if the key missing.  Patch by Stefan Behnel
     and Victor Stinner.

   - gh-111863(7): Rename ‘Py_NOGIL’ to ‘Py_GIL_DISABLED’.  Patch by
     Hugo van Kemenade.

   - gh-111138(8): Add *note PyList_Extend(): 600. and *note
     PyList_Clear(): 601. functions: similar to Python ‘list.extend()’
     and ‘list.clear()’ methods.  Patch by Victor Stinner.

   - gh-108765(9): On Windows, ‘Python.h’ no longer includes the
     ‘<stddef.h>’ standard header file.  If needed, it should now be
     included explicitly.  Patch by Victor Stinner.

   - gh-111569(10): Implement "Python Critical Sections" from PEP
     703(11).  These are macros to help replace the GIL with per-object
     locks in the ‘--disable-gil’ build of CPython.  The macros are
     no-ops in the default build.

   - gh-111506(12): In the limited C API version 3.13, *note
     Py_SET_REFCNT(): aa8. function is now implemented as an opaque
     function call.  Patch by Victor Stinner.

   - gh-108082(13): Add *note PyErr_FormatUnraisable(): 5f1. function.

   - gh-110964(14): Move the undocumented private _PyArg functions and
     _PyArg_Parser structure to internal C API (‘pycore_modsupport.h’).
     Patch by Victor Stinner.

   - gh-110815(15): Support non-ASCII keyword names in *note
     PyArg_ParseTupleAndKeywords(): 624.

   - gh-109587(16): Introduced
     ‘PyUnstable_PerfTrampoline_CompileCode()’,
     ‘PyUnstable_PerfTrampoline_SetPersistAfterFork()’ and
     ‘PyUnstable_CopyPerfMapFile()’.  These functions allow extension
     modules to initialize trampolines eagerly, after the application is
     "warmed up".  This makes it possible to have perf-trampolines
     running in an always-enabled fashion.

   - gh-85283(17): Add the *note PySys_Audit(): 613. function to the
     limited C API. Patch by Victor Stinner.

   - gh-85283(18): Add *note PyMem_RawMalloc(): 631, *note
     PyMem_RawCalloc(): 632, *note PyMem_RawRealloc(): 633. and *note
     PyMem_RawFree(): 634. to the limited C API. Patch by Victor
     Stinner.

   - gh-106672(19): Functions *note PyDict_GetItem(): 628, *note
     PyDict_GetItemString(): 629, *note PyMapping_HasKey(): 620, *note
     PyMapping_HasKeyString(): 622, *note PyObject_HasAttr(): 61c, *note
     PyObject_HasAttrString(): 61e, and *note PySys_GetObject(): 62a,
     which clear all errors occurred during calling the function, report
     now them using *note sys.unraisablehook(): 507.

   - gh-67565(20): Remove redundant C-contiguity check in ‘getargs.c’,
     *note binascii: 11, *note ssl: d5. and Argument Clinic.  Patched by
     Stefan Krah and Furkan Onder

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/112026

   (2) https://github.com/python/cpython/issues/112026

   (3) https://github.com/python/cpython/issues/112026

   (4) https://github.com/python/cpython/issues/112026

   (5) https://github.com/python/cpython/issues/111956

   (6) https://github.com/python/cpython/issues/111262

   (7) https://github.com/python/cpython/issues/111863

   (8) https://github.com/python/cpython/issues/111138

   (9) https://github.com/python/cpython/issues/108765

   (10) https://github.com/python/cpython/issues/111569

   (11) https://peps.python.org/pep-0703/

   (12) https://github.com/python/cpython/issues/111506

   (13) https://github.com/python/cpython/issues/108082

   (14) https://github.com/python/cpython/issues/110964

   (15) https://github.com/python/cpython/issues/110815

   (16) https://github.com/python/cpython/issues/109587

   (17) https://github.com/python/cpython/issues/85283

   (18) https://github.com/python/cpython/issues/85283

   (19) https://github.com/python/cpython/issues/106672

   (20) https://github.com/python/cpython/issues/67565


File: python.info,  Node: Python 3 13 0 alpha 1,  Next: Python 3 12 0 beta 1,  Prev: Python 3 13 0 alpha 2,  Up: 変更履歴

1.24.26 Python 3.13.0 alpha 1
-----------------------------

'Release date: 2023-10-13'

* Menu:

* セキュリティ: セキュリティ<21>.
* Core and Builtins: Core and Builtins<59>.
* ライブラリ: ライブラリ<64>.
* ドキュメント: ドキュメント<20>.
* テスト: テスト<19>.
* ビルド: ビルド<22>.
* Windows: Windows<21>.
* macOS: macOS<14>.
* IDLE: IDLE<13>.
* Tools/Demos: Tools/Demos<19>.
* C API: C API<22>.


File: python.info,  Node: セキュリティ<21>,  Next: Core and Builtins<59>,  Up: Python 3 13 0 alpha 1

1.24.26.1 セキュリティ
......................

   - gh-108310(1): Fixed an issue where instances of *note
     ssl.SSLSocket: ae7. were vulnerable to a bypass of the TLS
     handshake and included protections (like certificate verification)
     and treating sent unencrypted data as if it were post-handshake TLS
     encrypted data.  Security issue reported as CVE 2023-40217(2) by
     Aapo Oksman.  Patch by Gregory P. Smith.

   - gh-107774(3): PEP 669 specifies that
     ‘sys.monitoring.register_callback’ will generate an audit event.
     Pre-releases of Python 3.12 did not generate the audit event.  This
     is now fixed.

   - gh-102988(4): Reverted the *note email.utils: 54. security
     improvement change released in 3.12beta4 that unintentionally
     caused *note email.utils.getaddresses: 4f3. to fail to parse email
     addresses with a comma in the quoted name field.  See gh-106669(5).

   - gh-99108(6): Refresh our new HACL* built-in *note hashlib: 6c. code
     from upstream.  Built-in SHA2 should be faster and an issue with
     SHA3 on 32-bit platforms is fixed.

   - gh-102509(7): Start initializing ‘ob_digit’ during creation of
     *note PyLongObject: 39e. objects.  Patch by Illia Volochii.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/108310

   (2) https://www.cve.org/CVERecord?id=CVE-2023-40217

   (3) https://github.com/python/cpython/issues/107774

   (4) https://github.com/python/cpython/issues/102988

   (5) https://github.com/python/cpython/issues/106669

   (6) https://github.com/python/cpython/issues/99108

   (7) https://github.com/python/cpython/issues/102509


File: python.info,  Node: Core and Builtins<59>,  Next: ライブラリ<64>,  Prev: セキュリティ<21>,  Up: Python 3 13 0 alpha 1

1.24.26.2 Core and Builtins
...........................

   - gh-110782(1): Fix crash when *note typing.TypeVar: 486. is
     constructed with a keyword argument.  Patch by Jelle Zijlstra.

   - gh-110752(2): Reset ‘ceval.eval_breaker’ in ‘interpreter_clear()’

   - gh-110721(3): Use the *note traceback: 104. implementation for the
     default ‘PyErr_Display()’ functionality.  Patch by Pablo Galindo

   - gh-110696(4): Fix incorrect error message for invalid argument
     unpacking.  Patch by Pablo Galindo

   - gh-104169(5): Split the tokenizer into two separate directories: -
     One part includes the actual lexeme producing logic and lives in
     ‘Parser/lexer’.  - The second part wraps the lexer according to the
     different tokenization modes we have (string, utf-8, file,
     interactive, readline) and lives in ‘Parser/tokenizer’.

   - gh-110688(6): Remove undocumented ‘test_c_api’ method from *note
     set: 184, which was only defined for testing purposes under
     ‘Py_DEBUG’.  Now we have proper CAPI tests.

   - gh-104584(7): Fix a reference leak when running with ‘PYTHONUOPS’
     or *note -X uops: 16f. enabled.

   - gh-110514(8): Add ‘PY_THROW’ to *note sys.setprofile(): 1717.
     events

   - gh-110489(9): Optimise *note math.ceil(): 15d8. when the input is
     exactly a float, resulting in about a 10% improvement.

   - gh-110455(10): Guard ‘assert(tstate->thread_id > 0)’ with ‘#ifndef
     HAVE_PTHREAD_STUBS’.  This allows for for pydebug builds to work
     under WASI which (currently) lacks thread support.

   - gh-110309(11): Remove unnecessary empty constant nodes in the ast
     of f-string specs.

   - gh-110259(12): Correctly identify the format spec in f-strings
     (with single or triple quotes) that have multiple lines in the
     expression part and include a formatting spec.  Patch by Pablo
     Galindo

   - gh-110237(13): Fix missing error checks for calls to
     ‘PyList_Append’ in ‘_PyEval_MatchClass’.

   - gh-110164(14): regrtest: If the ‘SOURCE_DATE_EPOCH’ environment
     variable is defined, regrtest now disables tests randomization.
     Patch by Victor Stinner.

   - gh-109889(15): Fix the compiler's redundant NOP detection algorithm
     to skip over NOPs with no line number when looking for the next
     instruction's lineno.

   - gh-109853(16): ‘sys.path[0]’ is now set correctly for
     subinterpreters.

   - gh-109923(17): Set line number on the ‘POP_TOP’ that follows a
     ‘RETURN_GENERATOR’.

   - gh-105716(18): Subinterpreters now correctly handle the case where
     they have threads running in the background.  Before, such threads
     would interfere with cleaning up and destroying them, as well as
     prevent running another script.

   - gh-109369(19): The internal eval_breaker and supporting flags, plus
     the monitoring version have been merged into a single atomic
     integer to speed up checks.

   - gh-109823(20): Fix bug where compiler does not adjust labels when
     removing an empty basic block which is a jump target.

   - gh-109793(21): The main thread no longer exits prematurely when a
     subinterpreter is cleaned up during runtime finalization.  The bug
     was a problem particularly because, when triggered, the Python
     process would always return with a 0 exitcode, even if it failed.

   - gh-109719(22): Fix missing jump target labels when compiler
     reorders cold/warm blocks.

   - gh-109595(23): Add *note -X cpu_count: 16f. command line option to
     override return results of *note os.cpu_count(): 4db. and *note
     os.process_cpu_count(): 4da.  This option is useful for users who
     need to limit CPU resources of a container system without having to
     modify the container (application code).  Patch by Donghee Na.

   - gh-109627(24): Fix bug where the compiler does not assign a new
     jump target label to a duplicated small exit block.

   - gh-109596(25): Fix some tokens in the grammar that were incorrectly
     marked as soft keywords.  Also fix some repeated rule names and
     ensure that repeated rules are not allowed.  Patch by Pablo Galindo

   - gh-109496(26): On a Python built in debug mode, *note Py_DECREF():
     790. now calls ‘_Py_NegativeRefcount()’ if the object is a dangling
     pointer to deallocated memory: memory filled with ‘0xDD’ "dead
     byte" by the debug hook on memory allocators.  The fix is to check
     the reference count 'before' checking for ‘_Py_IsImmortal()’.
     Patch by Victor Stinner.

   - gh-107265(27): Deopt opcodes hidden by the executor when base
     opcode is needed

   - gh-109371(28): Deopted instructions correctly for tool
     initialization and modified the incorrect assertion in
     instrumentation, when a previous tool already sets INSTRUCTION
     events

   - gh-105658(29): Fix bug where the line trace of an except block
     ending with a conditional includes an excess event with the line of
     the conditional expression.

   - gh-109219(30): Fix compiling type param scopes that use a name
     which is also free in an inner scope.

   - gh-109351(31): Fix crash when compiling an invalid AST involving a
     named (walrus) expression.

   - gh-109341(32): Fix crash when compiling an invalid AST involving a
     *note ast.TypeAlias: 1a55.

   - gh-109195(33): Fix source location for the ‘LOAD_*’ instruction
     preceding a ‘LOAD_SUPER_ATTR’ to load the ‘super’ global (or
     shadowing variable) so that it encompasses only the name ‘super’
     and not the following parentheses.

   - gh-109256(34): Opcode IDs for specialized opcodes are allocated in
     their own range to improve stability of the IDs for the 'real'
     opcodes.

   - gh-109216(35): Fix possible memory leak in *note BUILD_MAP: 369.

   - gh-109207(36): Fix a SystemError in ‘__repr__’ of symtable entry
     object.

   - gh-109179(37): Fix bug where the C traceback display drops notes
     from *note SyntaxError: 18e.

   - gh-109118(38): Disallow nested scopes (lambdas, generator
     expressions, and comprehensions) within PEP 695 annotation scopes
     that are nested within classes.

   - gh-109156(39): Add tests for de-instrumenting instructions while
     keeping the instrumentation for lines

   - gh-109114(40): Relax the detection of the error message for invalid
     lambdas inside f-strings to not search for arbitrary replacement
     fields to avoid false positives.  Patch by Pablo Galindo

   - gh-105848(41): Add a new *note CALL_KW: 372. opcode, used for calls
     containing keyword arguments.  Also, fix a possible crash when
     jumping over method calls in a debugger.

   - gh-109052(42): Use the base opcode when comparing code objects to
     avoid interference from instrumentation

   - gh-109118(43): Fix interpreter crash when a NameError is raised
     inside the type parameters of a generic class.

   - gh-88943(44): Improve syntax error for non-ASCII character that
     follows a numerical literal.  It now points on the invalid
     non-ASCII character, not on the valid numerical literal.

   - gh-108976(45): Fix crash that occurs after de-instrumenting a code
     object in a monitoring callback.

   - gh-108732(46): Make iteration variables of module- and class-scoped
     comprehensions visible to pdb and other tools that use
     ‘frame.f_locals’ again.

   - gh-108959(47): Fix caret placement for error locations for
     subscript and binary operations that involve non-semantic
     parentheses and spaces.  Patch by Pablo Galindo

   - gh-104584(48): Fix a crash when running with ‘PYTHONUOPS’ or *note
     -X uops: 16f. enabled and an error occurs during optimization.

   - gh-108727(49): Define ‘tp_dealloc’ for ‘CounterOptimizer_Type’.
     This fixes a segfault on deallocation.

   - gh-108520(50): Fix
     ‘multiprocessing.synchronize.SemLock.__setstate__()’ to properly
     initialize ‘multiprocessing.synchronize.SemLock._is_fork_ctx’.
     This fixes a regression when passing a SemLock across nested
     processes.

     Rename ‘multiprocessing.synchronize.SemLock.is_fork_ctx’ to
     ‘multiprocessing.synchronize.SemLock._is_fork_ctx’ to avoid
     exposing it as public API.

   - gh-108654(51): Restore locals shadowed by an inlined comprehension
     if the comprehension raises an exception.

   - gh-108488(52): Change the initialization of inline cache entries so
     that the cache entry for ‘JUMP_BACKWARD’ is initialized to zero,
     instead of the ‘adaptive_counter_warmup()’ value used for all other
     instructions.  This counter, unique among instructions, counts up
     from zero.

   - gh-108716(53): Turn off deep-freezing of code objects.  Modules are
     still frozen, so that a file system search is not needed for common
     modules.

   - gh-108614(54): Add RESUME_CHECK instruction, to avoid having to
     handle instrumentation, signals, and contexts switches in the tier
     2 execution engine.

   - gh-108487(55): Move an assert that would cause a spurious crash in
     a devious case that should only trigger deoptimization.

   - gh-106176(56): Use a ‘WeakValueDictionary’ to track the lists
     containing the modules each thread is currently importing.  This
     helps avoid a reference leak from keeping the list around longer
     than necessary.  Weakrefs are used as GC can't interrupt the
     cleanup.

   - gh-105481(57): The regen-opcode build stage was removed and its
     work is now done in regen-cases.

   - gh-107901(58): Fix missing line number on *note JUMP_BACKWARD: 91a.
     at the end of a for loop.

   - gh-108113(59): The *note compile(): 4b1. built-in can now accept a
     new flag, ‘ast.PyCF_OPTIMIZED_AST’, which is similar to
     ‘ast.PyCF_ONLY_AST’ except that the returned ‘AST’ is optimized
     according to the value of the ‘optimize’ argument.

     *note ast.parse(): 1c2. now accepts an optional argument ‘optimize’
     which is passed on to the *note compile(): 4b1. built-in.  This
     makes it possible to obtain an optimized ‘AST’.

   - gh-107971(60): Opcode IDs are generated from bytecodes.c instead of
     being hard coded in opcode.py.

   - gh-107944(61): Improve error message for function calls with bad
     keyword arguments.  Patch by Pablo Galindo

   - gh-108390(62): Raise an exception when setting a non-local event
     (‘RAISE’, ‘EXCEPTION_HANDLED’, etc.)  in
     ‘sys.monitoring.set_local_events’.

     Fixes crash when tracing in recursive calls to Python classes.

   - gh-108035(63): Remove the ‘_PyCFrame’ struct, moving the pointer to
     the current interpreter frame back to the threadstate, as it was
     for 3.10 and earlier.  The ‘_PyCFrame’ existed as a performance
     optimization for tracing.  Since PEP 669 has been implemented, this
     optimization no longer applies.

   - gh-91051(64): Fix abort / segfault when using all eight type
     watcher slots, on platforms where ‘char’ is signed by default.

   - gh-106581(65): Fix possible assertion failures and missing
     instrumentation events when ‘PYTHONUOPS’ or *note -X uops: 16f. is
     enabled.

   - gh-107526(66): Revert converting ‘vars’, ‘dir’, ‘next’, ‘getattr’,
     and ‘iter’ to argument clinic.

   - gh-84805(67): Autogenerate signature for *note METH_NOARGS: 16ed.
     and *note METH_O: 1720. extension functions.

   - gh-107758(68): Make the ‘dump_stack()’ routine used by the
     ‘lltrace’ feature (low-level interpreter debugging) robust against
     recursion by ensuring that it never calls a ‘__repr__’ method
     implemented in Python.  Also make the similar output for Tier-2
     uops appear on ‘stdout’ (instead of ‘stderr’), to match the
     ‘lltrace’ code in ceval.c.

   - gh-107659(69): Add docstrings for *note ctypes.pointer(): 1a56. and
     *note ctypes.POINTER(): 1f1.

   - gh-105848(70): Modify the bytecode so that the actual callable for
     a *note CALL: 915. is at a consistent position on the stack
     (regardless of whether or not bound-method-calling optimizations
     are active).

   - gh-107674(71): Fixed performance regression in ‘sys.settrace’.

   - gh-107724(72): In pre-release versions of 3.12, up to rc1, the
     sys.monitoring callback function for the ‘PY_THROW’ event was
     missing the third, exception argument.  That is now fixed.

   - gh-84436(73): Skip reference count modifications for many known
     immortal objects.

   - gh-107596(74): Specialize subscripting *note str: 169. objects by
     *note int: 19b. indexes.

   - gh-107080(75): Trace refs builds (‘--with-trace-refs’) were
     crashing when used with isolated subinterpreters.  The problematic
     global state has been isolated to each interpreter.  Other fixing
     the crashes, this change does not affect users.

   - gh-107557(76): Generate the cases needed for the barebones tier 2
     abstract interpreter for optimization passes in CPython.

   - gh-106608(77): Make ‘_PyUOpExecutorObject’ variable length.

   - gh-100964(78): Clear generators' exception state after ‘return’ to
     break reference cycles.

   - gh-107455(79): Improve error messages when converting an
     incompatible type to *note ctypes.c_char_p: 1a57, *note
     ctypes.c_wchar_p: 1a58. and *note ctypes.c_void_p: 1a59.

   - gh-107263(80): Increase C recursion limit for functions other than
     the main interpreter from 800 to 1500.  This should allow functions
     like ‘list.__repr__’ and ‘json.dumps’ to handle all the inputs that
     they could prior to 3.12

   - gh-104584(81): Fix an issue which caused incorrect inline caches to
     be read when running with ‘PYTHONUOPS’ or *note -X uops: 16f.
     enabled.

   - gh-104432(82): Fix potential unaligned memory access on C APIs
     involving returned sequences of ‘char *’ pointers within the *note
     grp: 6a. and *note socket: d1. modules.  These were revealed using
     a ‘-fsaniziter=alignment’ build on ARM macOS. Patch by Christopher
     Chavez.

   - gh-106078(83): Isolate ‘_decimal’ (apply PEP 687(84)).  Patch by
     Charlie Zhao.

   - gh-106898(85): Add the exception as the third argument to
     ‘PY_UNIND’ callbacks in ‘sys.monitoring’.  This makes the
     ‘PY_UNWIND’ callback consistent with the other exception handling
     callbacks.

   - gh-106895(86): Raise a ‘ValueError’ when a monitoring callback
     function returns ‘DISABLE’ for events that cannot be disabled
     locally.

   - gh-106897(87): Add a ‘RERAISE’ event to ‘sys.monitoring’, which
     occurs when an exception is reraise, either explicitly by a plain
     ‘raise’ statement, or implicitly in an ‘except’ or ‘finally’ block.

   - gh-77377(88): Ensure that multiprocessing synchronization objects
     created in a fork context are not sent to a different process
     created in a spawn context.  This changes a segfault into an
     actionable RuntimeError in the parent process.

   - gh-106931(89): Statically allocated string objects are now interned
     globally instead of per-interpreter.  This fixes a situation where
     such a string would only be interned in a single interpreter.
     Normal string objects are unaffected.

   - gh-104621(90): Unsupported modules now always fail to be imported.

   - gh-107122(91): Add ‘dbm.ndbm.ndbm.clear()’ to *note dbm.ndbm: 38.
     Patch By Donghee Na.

   - gh-107122(92): Add ‘dbm.gnu.gdbm.clear()’ to *note dbm.gnu: 37.
     Patch By Donghee Na.

   - gh-107015(93): The ASYNC and AWAIT tokens are removed from the
     Grammar, which removes the possibility of making ‘async’ and
     ‘await’ soft keywords when using ‘feature_version<7’ in *note
     ast.parse(): 1c2.

   - gh-106917(94): Fix classmethod-style *note super(): 1a6. method
     calls (i.e., where the second argument to *note super(): 1a6, or
     the implied second argument drawn from ‘self/cls’ in the case of
     zero-arg super, is a type) when the target of the call is not a
     classmethod.

   - gh-105699(95): Python no longer crashes due an infrequent race when
     initializing per-interpreter interned strings.  The crash would
     manifest when the interpreter was finalized.

   - gh-105699(96): Python no longer crashes due to an infrequent race
     in setting ‘Py_FileSystemDefaultEncoding’ and
     ‘Py_FileSystemDefaultEncodeErrors’ (both deprecated), when
     simultaneously initializing two isolated subinterpreters.  Now they
     are only set during runtime initialization.

   - gh-106908(97): Fix various hangs, reference leaks, test failures,
     and tracing/introspection bugs when running with ‘PYTHONUOPS’ or
     *note -X uops: 16f. enabled.

   - gh-106092(98): Fix a segmentation fault caused by a use-after-free
     bug in ‘frame_dealloc’ when the trashcan delays the deallocation of
     a ‘PyFrameObject’.

   - gh-106485(99): Reduce the number of materialized instances
     dictionaries by dematerializing them when possible.

   - gh-106719(100): No longer suppress arbitrary errors in the
     ‘__annotations__’ getter and setter in the type and module types.

   - gh-106723(101): Propagate ‘frozen_modules’ to multiprocessing
     spawned process interpreters.

   - gh-104909(102): Split ‘LOAD_ATTR_INSTANCE_VALUE’ into micro-ops.

   - gh-104909(103): Split *note LOAD_GLOBAL: 1a5a. specializations into
     micro-ops.

   - gh-106597(104): A new debug structure of offsets has been added to
     the ‘_PyRuntimeState’ that will help out-of-process debuggers and
     profilers to obtain the offsets to relevant interpreter structures
     in a way that is agnostic of how Python was compiled and that
     doesn't require copying the headers.  Patch by Pablo Galindo

   - gh-106487(105): Allow the 'count' argument of *note str.replace():
     4b8. to be a keyword.  Patch by Hugo van Kemenade.

   - gh-96844(106): Improve error message of *note list.remove(): 1a5b.
     Patch by Donghee Na.

   - gh-81283(107): Compiler now strips indents from docstrings.  It
     reduces ‘pyc’ file size 5% when the module is heavily documented.
     This change affects to ‘__doc__’ so tools like doctest will be
     affected.

   - gh-106396(108): When the format specification of an f-string
     expression is empty, the parser now generates an empty *note
     ast.JoinedStr: 1a5c. node for it instead of an one-element *note
     ast.JoinedStr: 1a5c. with an empty string *note ast.Constant: 2ef.

   - gh-100288(109): Specialize *note LOAD_ATTR: 704. for
     non-descriptors on the class.  Adds
     ‘LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES’ and
     ‘LOAD_ATTR_NONDESCRIPTOR_NO_DICT’.

   - gh-106008(110): Fix possible reference leaks when failing to
     optimize comparisons with *note None: 885. in the bytecode
     compiler.

   - gh-106145(111): Make ‘end_lineno’ and ‘end_col_offset’ required on
     ‘type_param’ ast nodes.

   - gh-106213(112): Changed the way that Emscripten call trampolines
     work for compatibility with Wasm/JS Promise integration.

   - gh-106182(113): *note sys.getfilesystemencoding(): e53. and *note
     sys.getfilesystemencodeerrors: ee2. now return interned Unicode
     object.

   - gh-106210(114): Removed Emscripten import trampoline as it was no
     longer necessary for Pyodide.

   - gh-104584(115): Added a new, experimental, tracing optimizer and
     interpreter (a.k.a.  "tier 2").  This currently pessimizes, so
     don't use yet - this is infrastructure so we can experiment with
     optimizing passes.  To enable it, pass ‘-Xuops’ or set
     ‘PYTHONUOPS=1’.  To get debug output, set ‘PYTHONUOPSDEBUG=N’ where
     ‘N’ is a debug level (0-4, where 0 is no debug output and 4 is
     excessively verbose).

   - gh-105775(116): *note LOAD_CLOSURE: 1a5d. is now a pseudo-op.

   - gh-105730(117): Allow any callable other than type objects as the
     condition predicate in *note BaseExceptionGroup.split(): 18d8. and
     *note BaseExceptionGroup.subgroup(): 1a38.

   - gh-105979(118): Fix crash in ‘_imp.get_frozen_object()’ due to
     improper exception handling.

   - gh-106003(119): Add a new *note TO_BOOL: 1a5e. instruction, which
     performs boolean conversions for *note POP_JUMP_IF_TRUE: 1a5f,
     *note POP_JUMP_IF_FALSE: 1a60, and *note UNARY_NOT: 1a61. (which
     all expect exact *note bool: 3c3. values now).  Also, modify the
     oparg of *note COMPARE_OP: b61. to include an optional "boolean
     conversion" flag.

   - gh-98931(120): Ensure custom *note SyntaxError: 18e. error messages
     are raised for invalid imports with multiple targets.  Patch by
     Pablo Galindo

   - gh-105724(121): Improve ‘assert’ error messages by providing exact
     error range.

   - gh-105908(122): Fixed bug where gh-99111(123) breaks future import
     ‘barry_as_FLUFL’ in the Python REPL.

   - gh-105840(124): Fix possible crashes when specializing function
     calls with too many ‘__defaults__’.

   - gh-105831(125): Fix an f-string bug, where using a debug expression
     (the ‘=’ sign) that appears in the last line of a file results to
     the debug buffer that holds the expression text being one character
     too small.

   - gh-105800(126): Correctly issue *note SyntaxWarning: 1ae. in
     f-strings if invalid sequences are used.  Patch by Pablo Galindo

   - gh-105340(127): Include the comprehension iteration variable in
     ‘locals()’ inside a module- or class-scope comprehension.

   - gh-105331(128): Raise *note ValueError: 2ec. if the ‘delay’
     argument to *note asyncio.sleep(): c64. is a NaN (matching *note
     time.sleep(): 8ac.).

   - gh-105587(129): The runtime can't guarantee that immortal objects
     will not be mutated by Extensions.  Thus, this modifies
     _PyStaticObject_CheckRefcnt to warn instead of asserting.

   - gh-105564(130): Don't include artificil newlines in the ‘line’
     attribute of tokens in the APIs of the *note tokenize: 101. module.
     Patch by Pablo Galindo

   - gh-105549(131): Tokenize separately ‘NUMBER’ and ‘NAME’ tokens that
     are not ambiguous.  Patch by Pablo Galindo.

   - gh-105588(132): Fix an issue that could result in crashes when
     compiling malformed *note ast: 9. nodes.

   - gh-100987(133): Allow objects other than code objects as the
     "executable" in internal frames.  In the long term, this can help
     tools like Cython and PySpy interact more efficiently.  In the
     shorter term, it allows us to perform some optimizations more
     simply.

   - gh-105375(134): Fix bugs in the *note builtins: 13. module where
     exceptions could end up being overwritten.

   - gh-105375(135): Fix bug in the compiler where an exception could
     end up being overwritten.

   - gh-105375(136): Improve error handling in *note
     PyUnicode_BuildEncodingMap(): 1a62. where an exception could end up
     being overwritten.

   - gh-105486(137): Change the repr of ‘ParamSpec’ list of args in
     ‘types.GenericAlias’.

   - gh-105678(138): Break the ‘MAKE_FUNCTION’ instruction into two
     parts, ‘MAKE_FUNCTION’ which makes the function and
     ‘SET_FUNCTION_ATTRIBUTE’ which sets the attributes on the function.
     This makes the stack effect of ‘MAKE_FUNCTION’ regular to ease
     optimization and code generation.

   - gh-105435(139): Fix spurious newline character if file ends on a
     comment without a newline.  Patch by Pablo Galindo

   - gh-105390(140): Correctly raise *note tokenize.TokenError: 764.
     exceptions instead of *note SyntaxError: 18e. for tokenize errors
     such as incomplete input.  Patch by Pablo Galindo

   - gh-105259(141): Don't include newline character for trailing
     ‘NEWLINE’ tokens emitted in the *note tokenize: 101. module.  Patch
     by Pablo Galindo

   - gh-104635(142): Eliminate redundant *note STORE_FAST: 1a63.
     instructions in the compiler.  Patch by Donghee Na and Carl Meyer.

   - gh-105324(143): Fix the main function of the *note tokenize: 101.
     module when reading from ‘sys.stdin’.  Patch by Pablo Galindo

   - gh-33092(144): Simplify and speed up interpreter for f-strings.
     Removes ‘FORMAT_VALUE’ opcode.  Add ‘CONVERT_VALUE’,
     ‘FORMAT_SIMPLE’ and ‘FORMAT_WITH_SPEC’ opcode.  Compiler emits more
     efficient sequence for each format expression.

   - gh-105229(145): Remove remaining two-codeunit superinstructions.
     All remaining superinstructions only take a single codeunit,
     simplifying instrumentation and quickening.

   - gh-105235(146): Prevent out-of-bounds memory access during
     ‘mmap.find()’ calls.

   - gh-98963(147): Restore the ability for a subclass of *note
     property: 4b3. to define ‘__slots__’ or otherwise be dict-less by
     ignoring failures to set a docstring on such a class.  This
     behavior had regressed in 3.12beta1.  An *note AttributeError: 5f0.
     where there had not previously been one was disruptive to existing
     code.

   - gh-104812(148): The "pending call" machinery now works for all
     interpreters, not just the main interpreter, and runs in all
     threads, not just the main thread.  Some calls are still only done
     in the main thread, ergo in the main interpreter.  This change does
     not affect signal handling nor the existing public C-API
     (‘Py_AddPendingCall()’), which both still only target the main
     thread.  The new functionality is meant strictly for internal use
     for now, since consequences of its use are not well understood yet
     outside some very restricted cases.  This change brings the
     capability in line with the intention when the state was made
     per-interpreter several years ago.

   - gh-105194(149): Do not escape with backslashes f-string format
     specifiers.  Patch by Pablo Galindo

   - gh-105229(150): Replace some dynamic superinstructions with single
     instruction equivalents.

   - gh-105162(151): Fixed bug in generator.close()/throw() where an
     inner iterator would be ignored when the outer iterator was
     instrumented.

   - gh-105164(152): Ensure annotations are set up correctly if the only
     annotation in a block is within a *note match: a0e. block.  Patch
     by Jelle Zijlstra.

   - gh-105148(153): Make ‘_PyASTOptimizeState’ internal to ast_opt.c.
     Make ‘_PyAST_Optimize’ take two integers instead of a pointer to
     this struct.  This avoids the need to include pycore_compile.h in
     ast_opt.c.

   - gh-104799(154): Attributes of *note ast: 9. nodes that are lists
     now default to the empty list if omitted.  This means that some
     code that previously raised *note TypeError: 198. when the AST node
     was used will now proceed with the empty list instead.  Patch by
     Jelle Zijlstra.

   - gh-105111(155): Remove the old trashcan macros
     ‘Py_TRASHCAN_SAFE_BEGIN’ and ‘Py_TRASHCAN_SAFE_END’.  They should
     be replaced by the new macros ‘Py_TRASHCAN_BEGIN’ and
     ‘Py_TRASHCAN_END’.

   - gh-105035(156): Fix *note super(): 1a6. calls on types with custom
     *note tp_getattro: 1a64. implementation (e.g.  meta-types.)

   - gh-105017(157): Show CRLF lines in the tokenize string attribute in
     both NL and NEWLINE tokens.  Patch by Marta Gómez.

   - gh-105013(158): Fix handling of multiline parenthesized lambdas in
     *note inspect.getsource(): 17c3.  Patch by Pablo Galindo

   - gh-105017(159): Do not include an additional final ‘NL’ token when
     parsing files having CRLF lines.  Patch by Marta Gómez.

   - gh-104976(160): Ensure that trailing ‘DEDENT’ ‘tokenize.TokenInfo’
     objects emitted by the *note tokenize: 101. module are reported as
     in Python 3.11.  Patch by Pablo Galindo

   - gh-104972(161): Ensure that the ‘line’ attribute in
     ‘tokenize.TokenInfo’ objects in the *note tokenize: 101. module are
     always correct.  Patch by Pablo Galindo

   - gh-104955(162): Fix signature for the new *note
     __release_buffer__(): 1a65. slot.  Patch by Jelle Zijlstra.

   - gh-104690(163): Starting new threads and process creation through
     *note os.fork(): 4b5. during interpreter shutdown (such as from
     *note atexit: d. handlers) is no longer supported.  It can lead to
     race condition between the main Python runtime thread freeing
     thread states while internal *note threading: f3. routines are
     trying to allocate and use the state of just created threads.  Or
     forked children trying to use the mid-shutdown runtime and thread
     state in the child process.

   - gh-104879(164): Fix crash when accessing the ‘__module__’ attribute
     of type aliases defined outside a module.  Patch by Jelle Zijlstra.

   - gh-104825(165): Tokens emitted by the *note tokenize: 101. module
     do not include an implicit ‘\n’ character in the ‘line’ attribute
     anymore.  Patch by Pablo Galindo

   - gh-104770(166): If a generator returns a value upon being closed,
     the value is now returned by *note generator.close(): 1793.

   - gh-89091(167): Raise *note RuntimeWarning: 4d7. for unawaited async
     generator methods like *note asend(): ad6, *note athrow(): 71d. and
     *note aclose(): ad5.  Patch by Kumar Aditya.

   - gh-96663(168): Add a better, more introspect-able error message
     when setting attributes on classes without a ‘__dict__’ and no slot
     member for the attribute.

   - gh-93627(169): Update the Python pickle module implementation to
     match the C implementation of the pickle module.  For objects
     setting reduction methods like *note __reduce_ex__(): 196b. or
     *note __reduce__(): bc6. to ‘None’, pickling will result in a *note
     TypeError: 198.

   - gh-101006(170): Improve error handling when read *note marshal: 91.
     data.

   - gh-91095(171): Specializes calls to most Python classes.
     Specifically, any class that inherits from ‘object’, or another
     Python class, and does not override ‘__new__’.

     The specialized instruction does the following:

       1. Creates the object (by calling ‘object.__new__’)

       2. Pushes a shim frame to the frame stack (to cleanup after
          ‘__init__’)

       3. Pushes the frame for ‘__init__’ to the frame stack

     Speeds up the instantiation of most Python classes.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/110782

   (2) https://github.com/python/cpython/issues/110752

   (3) https://github.com/python/cpython/issues/110721

   (4) https://github.com/python/cpython/issues/110696

   (5) https://github.com/python/cpython/issues/104169

   (6) https://github.com/python/cpython/issues/110688

   (7) https://github.com/python/cpython/issues/104584

   (8) https://github.com/python/cpython/issues/110514

   (9) https://github.com/python/cpython/issues/110489

   (10) https://github.com/python/cpython/issues/110455

   (11) https://github.com/python/cpython/issues/110309

   (12) https://github.com/python/cpython/issues/110259

   (13) https://github.com/python/cpython/issues/110237

   (14) https://github.com/python/cpython/issues/110164

   (15) https://github.com/python/cpython/issues/109889

   (16) https://github.com/python/cpython/issues/109853

   (17) https://github.com/python/cpython/issues/109923

   (18) https://github.com/python/cpython/issues/105716

   (19) https://github.com/python/cpython/issues/109369

   (20) https://github.com/python/cpython/issues/109823

   (21) https://github.com/python/cpython/issues/109793

   (22) https://github.com/python/cpython/issues/109719

   (23) https://github.com/python/cpython/issues/109595

   (24) https://github.com/python/cpython/issues/109627

   (25) https://github.com/python/cpython/issues/109596

   (26) https://github.com/python/cpython/issues/109496

   (27) https://github.com/python/cpython/issues/107265

   (28) https://github.com/python/cpython/issues/109371

   (29) https://github.com/python/cpython/issues/105658

   (30) https://github.com/python/cpython/issues/109219

   (31) https://github.com/python/cpython/issues/109351

   (32) https://github.com/python/cpython/issues/109341

   (33) https://github.com/python/cpython/issues/109195

   (34) https://github.com/python/cpython/issues/109256

   (35) https://github.com/python/cpython/issues/109216

   (36) https://github.com/python/cpython/issues/109207

   (37) https://github.com/python/cpython/issues/109179

   (38) https://github.com/python/cpython/issues/109118

   (39) https://github.com/python/cpython/issues/109156

   (40) https://github.com/python/cpython/issues/109114

   (41) https://github.com/python/cpython/issues/105848

   (42) https://github.com/python/cpython/issues/109052

   (43) https://github.com/python/cpython/issues/109118

   (44) https://github.com/python/cpython/issues/88943

   (45) https://github.com/python/cpython/issues/108976

   (46) https://github.com/python/cpython/issues/108732

   (47) https://github.com/python/cpython/issues/108959

   (48) https://github.com/python/cpython/issues/104584

   (49) https://github.com/python/cpython/issues/108727

   (50) https://github.com/python/cpython/issues/108520

   (51) https://github.com/python/cpython/issues/108654

   (52) https://github.com/python/cpython/issues/108488

   (53) https://github.com/python/cpython/issues/108716

   (54) https://github.com/python/cpython/issues/108614

   (55) https://github.com/python/cpython/issues/108487

   (56) https://github.com/python/cpython/issues/106176

   (57) https://github.com/python/cpython/issues/105481

   (58) https://github.com/python/cpython/issues/107901

   (59) https://github.com/python/cpython/issues/108113

   (60) https://github.com/python/cpython/issues/107971

   (61) https://github.com/python/cpython/issues/107944

   (62) https://github.com/python/cpython/issues/108390

   (63) https://github.com/python/cpython/issues/108035

   (64) https://github.com/python/cpython/issues/91051

   (65) https://github.com/python/cpython/issues/106581

   (66) https://github.com/python/cpython/issues/107526

   (67) https://github.com/python/cpython/issues/84805

   (68) https://github.com/python/cpython/issues/107758

   (69) https://github.com/python/cpython/issues/107659

   (70) https://github.com/python/cpython/issues/105848

   (71) https://github.com/python/cpython/issues/107674

   (72) https://github.com/python/cpython/issues/107724

   (73) https://github.com/python/cpython/issues/84436

   (74) https://github.com/python/cpython/issues/107596

   (75) https://github.com/python/cpython/issues/107080

   (76) https://github.com/python/cpython/issues/107557

   (77) https://github.com/python/cpython/issues/106608

   (78) https://github.com/python/cpython/issues/100964

   (79) https://github.com/python/cpython/issues/107455

   (80) https://github.com/python/cpython/issues/107263

   (81) https://github.com/python/cpython/issues/104584

   (82) https://github.com/python/cpython/issues/104432

   (83) https://github.com/python/cpython/issues/106078

   (84) https://peps.python.org/pep-0687/

   (85) https://github.com/python/cpython/issues/106898

   (86) https://github.com/python/cpython/issues/106895

   (87) https://github.com/python/cpython/issues/106897

   (88) https://github.com/python/cpython/issues/77377

   (89) https://github.com/python/cpython/issues/106931

   (90) https://github.com/python/cpython/issues/104621

   (91) https://github.com/python/cpython/issues/107122

   (92) https://github.com/python/cpython/issues/107122

   (93) https://github.com/python/cpython/issues/107015

   (94) https://github.com/python/cpython/issues/106917

   (95) https://github.com/python/cpython/issues/105699

   (96) https://github.com/python/cpython/issues/105699

   (97) https://github.com/python/cpython/issues/106908

   (98) https://github.com/python/cpython/issues/106092

   (99) https://github.com/python/cpython/issues/106485

   (100) https://github.com/python/cpython/issues/106719

   (101) https://github.com/python/cpython/issues/106723

   (102) https://github.com/python/cpython/issues/104909

   (103) https://github.com/python/cpython/issues/104909

   (104) https://github.com/python/cpython/issues/106597

   (105) https://github.com/python/cpython/issues/106487

   (106) https://github.com/python/cpython/issues/96844

   (107) https://github.com/python/cpython/issues/81283

   (108) https://github.com/python/cpython/issues/106396

   (109) https://github.com/python/cpython/issues/100288

   (110) https://github.com/python/cpython/issues/106008

   (111) https://github.com/python/cpython/issues/106145

   (112) https://github.com/python/cpython/issues/106213

   (113) https://github.com/python/cpython/issues/106182

   (114) https://github.com/python/cpython/issues/106210

   (115) https://github.com/python/cpython/issues/104584

   (116) https://github.com/python/cpython/issues/105775

   (117) https://github.com/python/cpython/issues/105730

   (118) https://github.com/python/cpython/issues/105979

   (119) https://github.com/python/cpython/issues/106003

   (120) https://github.com/python/cpython/issues/98931

   (121) https://github.com/python/cpython/issues/105724

   (122) https://github.com/python/cpython/issues/105908

   (123) https://github.com/python/cpython/issues/99111

   (124) https://github.com/python/cpython/issues/105840

   (125) https://github.com/python/cpython/issues/105831

   (126) https://github.com/python/cpython/issues/105800

   (127) https://github.com/python/cpython/issues/105340

   (128) https://github.com/python/cpython/issues/105331

   (129) https://github.com/python/cpython/issues/105587

   (130) https://github.com/python/cpython/issues/105564

   (131) https://github.com/python/cpython/issues/105549

   (132) https://github.com/python/cpython/issues/105588

   (133) https://github.com/python/cpython/issues/100987

   (134) https://github.com/python/cpython/issues/105375

   (135) https://github.com/python/cpython/issues/105375

   (136) https://github.com/python/cpython/issues/105375

   (137) https://github.com/python/cpython/issues/105486

   (138) https://github.com/python/cpython/issues/105678

   (139) https://github.com/python/cpython/issues/105435

   (140) https://github.com/python/cpython/issues/105390

   (141) https://github.com/python/cpython/issues/105259

   (142) https://github.com/python/cpython/issues/104635

   (143) https://github.com/python/cpython/issues/105324

   (144) https://github.com/python/cpython/issues/33092

   (145) https://github.com/python/cpython/issues/105229

   (146) https://github.com/python/cpython/issues/105235

   (147) https://github.com/python/cpython/issues/98963

   (148) https://github.com/python/cpython/issues/104812

   (149) https://github.com/python/cpython/issues/105194

   (150) https://github.com/python/cpython/issues/105229

   (151) https://github.com/python/cpython/issues/105162

   (152) https://github.com/python/cpython/issues/105164

   (153) https://github.com/python/cpython/issues/105148

   (154) https://github.com/python/cpython/issues/104799

   (155) https://github.com/python/cpython/issues/105111

   (156) https://github.com/python/cpython/issues/105035

   (157) https://github.com/python/cpython/issues/105017

   (158) https://github.com/python/cpython/issues/105013

   (159) https://github.com/python/cpython/issues/105017

   (160) https://github.com/python/cpython/issues/104976

   (161) https://github.com/python/cpython/issues/104972

   (162) https://github.com/python/cpython/issues/104955

   (163) https://github.com/python/cpython/issues/104690

   (164) https://github.com/python/cpython/issues/104879

   (165) https://github.com/python/cpython/issues/104825

   (166) https://github.com/python/cpython/issues/104770

   (167) https://github.com/python/cpython/issues/89091

   (168) https://github.com/python/cpython/issues/96663

   (169) https://github.com/python/cpython/issues/93627

   (170) https://github.com/python/cpython/issues/101006

   (171) https://github.com/python/cpython/issues/91095


File: python.info,  Node: ライブラリ<64>,  Next: ドキュメント<20>,  Prev: Core and Builtins<59>,  Up: Python 3 13 0 alpha 1

1.24.26.3 ライブラリ
....................

   - gh-110786(1): *note sysconfig: e1.'s CLI now ignores *note
     BrokenPipeError: 1267, making it exit normally if its output is
     being piped and the pipe closes.

   - gh-103480(2): The *note sysconfig: e1. module is now a package,
     instead of a single-file module.

   - gh-110733(3): Micro-optimization: Avoid calling ‘min()’, ‘max()’ in
     ‘BaseEventLoop._run_once()’.

   - gh-94597(4): Added *note asyncio.EventLoop: 1a67. for use with the
     *note asyncio.run(): 2f3. 'loop_factory' kwarg to avoid calling the
     asyncio policy system.

   - gh-110682(5): *note runtime-checkable protocols: 675. used to
     consider ‘__match_args__’ a protocol member in ‘__instancecheck__’
     if it was present on the protocol.  Now, this attribute is ignored
     if it is present.

   - gh-110488(6): Fix a couple of issues in *note
     pathlib.PurePath.with_name(): 1a68.: a single dot was incorrectly
     considered a valid name, and in ‘PureWindowsPath’, a name with an
     NTFS alternate data stream, like ‘a:b’, was incorrectly considered
     invalid.

   - gh-110590(7): Fix a bug in ‘_sre.compile()’ where *note TypeError:
     198. would be overwritten by *note OverflowError: a81. when the
     'code' argument was a list of non-ints.

   - gh-65052(8): Prevent *note pdb: aa. from crashing when trying to
     display undisplayable objects

   - gh-110519(9): Deprecation warning about non-integer number in *note
     gettext: 67. now always refers to the line in the user code where
     gettext function or method is used.  Previously it could refer to a
     line in ‘gettext’ code.

   - gh-89902(10): Deprecate non-standard format specifier "N" for *note
     decimal.Decimal: 1fe.  It was not documented and only supported in
     the C implementation.

   - gh-110378(11): *note contextmanager(): 141b. and *note
     asynccontextmanager(): d1f. context managers now close an invalid
     underlying generator object that yields more then one value.

   - gh-106670(12): In *note pdb: aa, set convenience variable
     ‘$_exception’ for post mortem debugging.

   - gh-110365(13): Fix *note termios.tcsetattr(): 1a69. bug that was
     overwriting existing errors during parsing integers from ‘term’
     list.

   - gh-109653(14): Slightly improve the import time of several
     standard-library modules by deferring imports of *note warnings:
     118. within those modules.  Patch by Alex Waygood.

   - gh-110273(15): *note dataclasses.replace(): 1a6a. now raises
     TypeError instead of ValueError if specify keyword argument for a
     field declared with init=False or miss keyword argument for
     required InitVar field.

   - gh-110249(16): Add ‘--inline-caches’ flag to ‘dis’ command line.

   - gh-109653(17): Fix a Python 3.12 regression in the import time of
     *note random: bd.  Patch by Alex Waygood.

   - gh-110222(18): Add support of struct sequence objects in *note
     copy.replace(): 1c0.  Patched by Xuehai Pan.

   - gh-109649(19): *note multiprocessing: 98, *note concurrent.futures:
     24, *note compileall: 21.: Replace *note os.cpu_count(): 4db. with
     *note os.process_cpu_count(): 4da. to select the default number of
     worker threads and processes.  Get the CPU affinity if supported.
     Patch by Victor Stinner.

   - gh-110150(20): Fix base case handling in statistics.quantiles.  Now
     allows a single data point.

   - gh-110036(21): On Windows, multiprocessing ‘Popen.terminate()’ now
     catches *note PermissionError: f3e. and get the process exit code.
     If the process is still running, raise again the *note
     PermissionError: f3e.  Otherwise, the process terminated as
     expected: store its exit code.  Patch by Victor Stinner.

   - gh-110038(22): Fixed an issue that caused ‘KqueueSelector.select()’
     to not return all the ready events in some cases when a file
     descriptor is registered for both read and write.

   - gh-110045(23): Update the *note symtable: de. module to support the
     new scopes introduced by PEP 695(24).

   - gh-88402(25): Add new variables to *note
     sysconfig.get_config_vars(): 298. on Windows: ‘LIBRARY’,
     ‘LDLIBRARY’, ‘LIBDIR’, ‘SOABI’, and ‘Py_NOGIL’.

   - gh-109631(26): *note re: be. functions such as *note re.findall():
     122b, *note re.split(): 5a2, *note re.search(): 1444. and *note
     re.sub(): 5a3. which perform short repeated matches can now be
     interrupted by user.

   - gh-109653(27): Reduce the import time of *note email.utils: 54. by
     around 43%.  This results in the import time of *note
     email.message: 48. falling by around 18%, which in turn reduces the
     import time of *note importlib.metadata: 7e. by around 6%.  Patch
     by Alex Waygood.

   - gh-109818(28): Fix *note reprlib.recursive_repr(): 140c. not
     copying ‘__type_params__’ from decorated function.

   - gh-109047(29): *note concurrent.futures: 24.: The 'executor manager
     thread' now catches exceptions when adding an item to the 'call
     queue'.  During Python finalization, creating a new thread can now
     raise *note RuntimeError: 244.  Catch the exception and call
     ‘terminate_broken()’ in this case.  Patch by Victor Stinner.

   - gh-109782(30): Ensure the signature of *note os.path.isdir(): c05.
     is identical on all platforms.  Patch by Amin Alaee.

   - gh-109653(31): Improve import time of *note functools: 63. by
     around 13%.  Patch by Alex Waygood.

   - gh-109590(32): *note shutil.which(): 6db. will prefer files with an
     extension in ‘PATHEXT’ if the given mode includes ‘os.X_OK’ on
     win32.  If no ‘PATHEXT’ match is found, a file without an extension
     in ‘PATHEXT’ can be returned.  This change will have *note
     shutil.which(): 6db. act more similarly to previous behavior in
     Python 3.11.

   - gh-109653(33): Reduce the import time of *note enum: 5a. by over
     50%.  Patch by Alex Waygood.

   - gh-109593(34): Avoid deadlocking on a reentrant call to the
     multiprocessing resource tracker.  Such a reentrant call, though
     unlikely, can happen if a GC pass invokes the finalizer for a
     multiprocessing object such as SemLock.

   - gh-109653(35): Reduce the import time of *note typing: 10a. by
     around a third.  Patch by Alex Waygood.

   - gh-109649(36): Add *note os.process_cpu_count(): 4da. function to
     get the number of logical CPUs usable by the calling thread of the
     current process.  Patch by Victor Stinner.

   - gh-74481(37): Add ‘set_error_mode’ related constants in ‘msvcrt’
     module in Python debug build.

   - gh-109613(38): Fix *note os.stat(): 26d. and *note
     os.DirEntry.stat(): 1a6b.: check for exceptions.  Previously, on
     Python built in debug mode, these functions could trigger a fatal
     Python error (and abort the process) when a function succeeded with
     an exception set.  Patch by Victor Stinner.

   - gh-109599(39): Expose the type of PyCapsule objects as
     ‘types.CapsuleType’.

   - gh-109109(40): You can now get the raw TLS certificate chains from
     TLS connections via *note ssl.SSLSocket.get_verified_chain(): 195c.
     and *note ssl.SSLSocket.get_unverified_chain(): 195d. methods.

     Contributed by Mateusz Nowak.

   - gh-109559(41): Update *note unicodedata: 10b. database to Unicode
     15.1.0.

   - gh-109543(42): Remove unnecessary *note hasattr(): 6f9. check
     during *note typing.TypedDict: 332. creation.

   - gh-109495(43): Remove unnecessary extra ‘__slots__’ in *note
     datetime: 4e2.'s pure python implementation to reduce memory size,
     as they are defined in the superclass.  Patch by James Hilton-Balfe

   - gh-109461(44): *note logging: 8b.: Use a context manager for lock
     acquisition.

   - gh-109096(45): *note http.server.CGIHTTPRequestHandler: 325. has
     been deprecated for removal in 3.15.  Its design is old and the web
     world has long since moved beyond CGI.

   - gh-109409(46): Fix error when it was possible to inherit a frozen
     dataclass from multiple parents some of which were possibly not
     frozen.

   - gh-109375(47): The *note pdb: aa. ‘alias’ command now prevents
     registering aliases without arguments.

   - gh-109319(48): Deprecate the ‘dis.HAVE_ARGUMENT’ field in favour of
     ‘dis.hasarg’.

   - gh-107219(49): Fix a race condition in ‘concurrent.futures’.  When
     a process in the process pool was terminated abruptly (while the
     future was running or pending), close the connection write end.  If
     the call queue is blocked on sending bytes to a worker process,
     closing the connection write end interrupts the send, so the queue
     can be closed.  Patch by Victor Stinner.

   - gh-66143(50): The *note codecs.CodecInfo: 1a6c. object has been
     made copyable and pickleable.  Patched by Robert Lehmann and Furkan
     Onder.

   - gh-109187(51): *note pathlib.Path.resolve(): 1a6d. now treats
     symlink loops like other errors: in strict mode, *note OSError:
     2c0. is raised, and in non-strict mode, no exception is raised.

   - gh-50644(52): Attempts to pickle or create a shallow or deep copy
     of *note codecs: 1c. streams now raise a TypeError.  Previously,
     copying failed with a RecursionError, while pickling produced wrong
     results that eventually caused unpickling to fail with a
     RecursionError.

   - gh-109174(53): Add support of *note types.SimpleNamespace: 4e5. in
     *note copy.replace(): 1c0.

   - gh-109164(54): *note pdb: aa.: Replace *note getopt: 65. with *note
     argparse: 7. for parsing command line arguments.

   - gh-109151(55): Enable ‘readline’ editing features in the *note
     sqlite3 command-line interface: 674. (‘python -m sqlite3’).

   - gh-108987(56): Fix *note _thread.start_new_thread(): 4b4. race
     condition.  If a thread is created during Python finalization, the
     newly spawned thread now exits immediately instead of trying to
     access freed memory and lead to a crash.  Patch by Victor Stinner.

   - gh-108682(57): Enum: require ‘names=()’ or ‘type=...’ to create an
     empty enum using the functional syntax.

   - gh-109033(58): Exceptions raised by os.utime builtin function now
     include the related filename

   - gh-108843(59): Fix an issue in *note ast.unparse(): ae2. when
     unparsing f-strings containing many quote types.

   - gh-108469(60): *note ast.unparse(): ae2. now supports new *note
     f-string: 66b. syntax introduced in Python 3.12.  Note that the
     *note f-string: 66b. quotes are reselected for simplicity under the
     new syntax.  (Patch by Steven Sun)

   - gh-108751(61): Add *note copy.replace(): 1c0. function which allows
     to create a modified copy of an object.  It supports named tuples,
     dataclasses, and many other objects.

   - gh-108682(62): Enum: raise *note TypeError: 198. if
     ‘super().__new__()’ is called from a custom ‘__new__’.

   - gh-108278(63): Deprecate passing the callback callable by keyword
     for the following *note sqlite3.Connection: 54d. APIs:

        * *note set_authorizer(): 5a9.

        * *note set_progress_handler(): 5aa.

        * *note set_trace_callback(): 5ab.

     The affected parameters will become positional-only in Python 3.15.

     Patch by Erlend E. Aasland.

   - gh-105829(64): Fix concurrent.futures.ProcessPoolExecutor deadlock

   - gh-108295(65): Fix crashes related to use of weakrefs on *note
     typing.TypeVar: 486.

   - gh-108463(66): Make expressions/statements work as expected in pdb

   - gh-108277(67): Add *note os.timerfd_create(): 51f, *note
     os.timerfd_settime(): 520, *note os.timerfd_gettime(): 522, *note
     os.timerfd_settime_ns(): 521, and *note os.timerfd_gettime_ns():
     523. to provide a low level interface for Linux's timer
     notification file descriptor.

   - gh-107811(68): *note tarfile: e4.: extraction of members with
     overly large UID or GID (e.g.  on an OS with 32-bit ‘id_t’) now
     fails in the same way as failing to set the ID.

   - gh-64662(69): Fix support for virtual tables in *note
     sqlite3.Connection.iterdump(): 54f.  Patch by Aviv Palivoda.

   - gh-108111(70): Fix a regression introduced in gh-101251(71) for
     3.12, resulting in an incorrect offset calculation in
     ‘gzip.GzipFile.seek()’.

   - gh-108294(72): *note time.sleep(): 8ac. now raises an auditing
     event.

   - gh-108278(73): Deprecate passing name, number of arguments, and the
     callable as keyword arguments, for the following *note
     sqlite3.Connection: 54d. APIs:

        * *note create_function(): 5a7.

        * *note create_aggregate(): 5a8.

     The affected parameters will become positional-only in Python 3.15.

     Patch by Erlend E. Aasland.

   - gh-108322(74): Speed-up NormalDist.samples() by using the inverse
     CDF method instead of calling random.gauss().

   - gh-83417(75): Add the ability for venv to create a ‘.gitignore’
     file which causes the created environment to be ignored by Git.  It
     is on by default when venv is called via its CLI.

   - gh-105736(76): Harmonized the pure Python version of *note
     OrderedDict: 7f3. with the C version.  Now, both versions set up
     their internal state in ‘__new__’.  Formerly, the pure Python
     version did the set up in ‘__init__’.

   - gh-108083(77): Fix bugs in the constructor of *note
     sqlite3.Connection: 54d. and *note sqlite3.Connection.close(): 54e.
     where exceptions could be leaked.  Patch by Erlend E. Aasland.

   - gh-107932(78): Fix ‘dis’ module to properly report and display
     bytecode that do not have source lines.

   - gh-105539(79): *note sqlite3: d4. now emits an *note
     ResourceWarning: 54c. if a *note sqlite3.Connection: 54d. object is
     not ‘closed’ explicitly.  Patch by Erlend E. Aasland.

   - gh-107995(80): The ‘__module__’ attribute on instances of *note
     functools.cached_property: 763. is now set to the name of the
     module in which the cached_property is defined, rather than
     "functools".  This means that doctests in ‘cached_property’
     docstrings are now properly collected by the *note doctest: 3e.
     module.  Patch by Tyler Smart.

   - gh-107963(81): Fix *note multiprocessing.set_forkserver_preload():
     1908. to check the given list of modules names.  Patch by Donghee
     Na.

   - gh-106242(82): Fixes *note os.path.normpath(): 1531. to handle
     embedded null characters without truncating the path.

   - gh-81555(83): *note xml.dom.minidom: 128. now only quotes ‘"’ in
     attributes.

   - gh-50002(84): *note xml.dom.minidom: 128. now preserves whitespaces
     in attributes.

   - gh-93057(85): Passing more than one positional argument to *note
     sqlite3.connect(): 5a6. and the *note sqlite3.Connection: 54d.
     constructor is deprecated.  The remaining parameters will become
     keyword-only in Python 3.15.  Patch by Erlend E. Aasland.

   - gh-76913(86): Add 'merge_extra' parameter/feature to *note
     logging.LoggerAdapter: 150d.

   - gh-107913(87): Fix possible losses of ‘errno’ and ‘winerror’ values
     in *note OSError: 2c0. exceptions if they were cleared or modified
     by the cleanup code before creating the exception object.

   - gh-107845(88): *note tarfile.data_filter(): 29a. now takes the
     location of symlinks into account when determining their target, so
     it will no longer reject some valid tarballs with
     ‘LinkOutsideDestinationError’.

   - gh-107812(89): Extend socket's netlink support to the FreeBSD
     platform.

   - gh-107805(90): Fix signatures of module-level generated functions
     in *note turtle: 107.

   - gh-107782(91): *note pydoc: ba. is now able to show signatures
     which are not representable in Python, e.g.  for ‘getattr’ and
     ‘dict.pop’.

   - gh-56166(92): Deprecate passing optional arguments 'maxsplit',
     'count' and 'flags' in module-level functions *note re.split():
     5a2, *note re.sub(): 5a3. and *note re.subn(): 5a4. as positional.
     They should only be passed by keyword.

   - gh-107710(93): Speed up *note logging.getHandlerNames(): 1a6e.

   - gh-107715(94): Fix *note doctest.DocTestFinder.find(): 1a6f. in
     presence of class names with special characters.  Patch by Gertjan
     van Zwieten.

   - gh-100814(95): Passing a callable object as an option value to a
     Tkinter image now raises the expected TclError instead of an
     AttributeError.

   - gh-72684(96): Add *note tkinter: f6. widget methods:
     ‘tk_busy_hold()’, ‘tk_busy_configure()’, ‘tk_busy_cget()’,
     ‘tk_busy_forget()’, ‘tk_busy_current()’, and ‘tk_busy_status()’.

   - gh-106684(97): Raise *note ResourceWarning: 54c. when *note
     asyncio.StreamWriter: 1a70. is not closed leading to memory leaks.
     Patch by Kumar Aditya.

   - gh-107465(98): Add *note pathlib.Path.from_uri(): 534. classmethod.

   - gh-107077(99): Seems that in some conditions, OpenSSL will return
     ‘SSL_ERROR_SYSCALL’ instead of ‘SSL_ERROR_SSL’ when a certification
     verification has failed, but the error parameters will still
     contain ‘ERR_LIB_SSL’ and ‘SSL_R_CERTIFICATE_VERIFY_FAILED’.  We
     are now detecting this situation and raising the appropriate
     ‘ssl.SSLCertVerificationError’.  Patch by Pablo Galindo

   - gh-107576(100): Fix *note types.get_original_bases(): 6f5. to only
     return ‘__orig_bases__’ if it is present on ‘cls’ directly.  Patch
     by James Hilton-Balfe.

   - gh-105481(101): Remove ‘opcode.is_pseudo’,
     ‘opcode.MIN_PSEUDO_OPCODE’ and ‘opcode.MAX_PSEUDO_OPCODE’, which
     were added in 3.12, were never documented and were not intended to
     be used externally.

   - gh-105481(102): ‘opcode.ENABLE_SPECIALIZATION’ (which was added in
     3.12 but never documented or intended for external usage) is moved
     to ‘_opcode.ENABLE_SPECIALIZATION’ where tests can access it.

   - gh-107396(103): tarfiles; Fixed use before assignment of
     self.exception for gzip decompression

   - gh-107409(104): Set ‘__wrapped__’ attribute in *note
     reprlib.recursive_repr(): 140c.

   - gh-107406(105): Implement new ‘__repr__()’ method for *note
     struct.Struct: 1778.  Now it returns ‘Struct(<format repr>)’.

   - gh-107369(106): Optimize *note textwrap.indent(): 57d.  It is ~30%
     faster for large input.  Patch by Inada Naoki.

   - gh-78722(107): Fix issue where *note pathlib.Path.iterdir(): 26e.
     did not raise *note OSError: 2c0. until iterated.

   - gh-105578(108): Deprecate *note typing.AnyStr: 5ac. in favor of the
     new Type Parameter syntax.  See PEP 695.

   - gh-62519(109): Make *note gettext.pgettext(): be8. search plural
     definitions when translation is not found.

   - gh-107089(110): Shelves opened with *note shelve.open(): 1a71. have
     a much faster ‘clear()’ method.  Patch by James Cave.

   - gh-82500(111): Fix overflow on 32-bit systems with *note asyncio:
     b. *note os.sendfile(): d05. implementation.

   - gh-83006(112): Document behavior of *note shutil.disk_usage():
     1345. for non-mounted filesystems on Unix.

   - gh-65495(113): Use lowercase ‘mail from’ and ‘rcpt to’ in
     ‘smptlib.SMTP’.

   - gh-106186(114): Do not report ‘MultipartInvariantViolationDefect’
     defect when the *note email.parser.Parser: 13b5. class is used to
     parse emails with ‘headersonly=True’.

   - gh-105002(115): Fix invalid result from ‘PurePath.relative_to()’
     method when attempting to walk a "‘..’" segment in 'other' with
     'walk_up' enabled.  A *note ValueError: 2ec. exception is now
     raised in this case.

   - gh-106739(116): Add the ‘rtype_cache’ to the warning message (as an
     addition to the type of leaked objects and the number of leaked
     objects already included in the message) to make debugging leaked
     objects easier when the multiprocessing resource tracker process
     finds leaked objects at shutdown.  This helps more quickly identify
     what was leaked and/or why the leaked object was not properly
     cleaned up.

   - gh-106751(117): Optimize ‘SelectSelector.select()’ for many
     iteration case.  Patch By Donghee Na.

   - gh-106751(118): Optimize ‘_PollLikeSelector.select()’ for many
     iteration case.

   - gh-106751(119): Optimize ‘KqueueSelector.select()’ for many
     iteration case.  Patch By Donghee Na.

   - gh-106831(120): Fix potential missing ‘NULL’ check of
     ‘d2i_SSL_SESSION’ result in ‘_ssl.c’.

   - gh-105481(121): The various opcode lists in the *note dis: 3c.
     module are now generated from bytecodes.c instead of explicitly
     constructed in opcode.py.

   - gh-106727(122): Make *note inspect.getsource(): 17c3. smarter for
     class for same name definitions

   - gh-106789(123): Remove import of *note pprint: b3. from *note
     sysconfig: e1.

   - gh-105726(124): Added ‘__slots__’ to *note
     contextlib.AbstractContextManager: e8a. and *note
     contextlib.AbstractAsyncContextManager: d20. so that child classes
     can use ‘__slots__’.

   - gh-106774(125): Update the bundled copy of pip to version 23.2.1.

   - gh-106751(126): *note selectors: c7.: Optimize
     ‘EpollSelector.select()’ code by moving some code outside of the
     loop.

   - gh-106752(127): Fixed several bugs in zipfile.Path, including: in
     ‘zipfile.Path.match()’, Windows separators are no longer honored
     (and never were meant to be); Fixed
     ‘name’/‘suffix’/‘suffixes’/‘stem’ operations when no filename is
     present and the Path is not at the root of the zipfile; Reworked
     glob for performance and more correct matching behavior.

   - gh-105293(128): Remove call to ‘SSL_CTX_set_session_id_context’
     during client side context creation in the *note ssl: d5. module.

   - gh-106734(129): Disable tab completion in multiline mode of *note
     pdb: aa.

   - gh-105481(130): Expose opcode metadata through ‘_opcode’.

   - gh-106670(131): Add the new ‘exceptions’ command to the Pdb
     debugger.  It makes it possible to move between chained exceptions
     when using post mortem debugging.

   - gh-106602(132): Add __copy__ and __deepcopy__ in *note enum: 5a.

   - gh-106664(133): *note selectors: c7.: Add ‘_SelectorMapping.get()’
     method and optimize ‘_SelectorMapping.__getitem__()’.

   - gh-106628(134): Speed up parsing of emails by about 20% by not
     compiling a new regular expression for every single email.

   - gh-89427(135): Set the environment variable ‘VIRTUAL_ENV_PROMPT’ at
     *note venv: 117. activation, even when ‘VIRTUAL_ENV_DISABLE_PROMPT’
     is set.

   - gh-106530(136): Revert a change to *note colorsys.rgb_to_hls():
     1a72. that caused division by zero for certain almost-white inputs.
     Patch by Terry Jan Reedy.

   - gh-106584(137): Fix exit code for ‘unittest’ if all tests are
     skipped.  Patch by Egor Eliseev.

   - gh-106566(138): Optimize ‘(?!)’ (pattern which always fails) in
     regular expressions.

   - gh-106554(139): *note selectors: c7.: Reduce Selector overhead by
     using a ‘dict.get()’ to lookup file descriptors.

   - gh-106558(140): Remove ref cycle in callers of ‘convert_to_error()’
     by deleting ‘result’ from scope in a ‘finally’ block.

   - gh-100502(141): Add ‘pathlib.PurePath.pathmod’ class attribute that
     stores the implementation of *note os.path: a6. used for low-level
     path operations: either ‘posixpath’ or ‘ntpath’.

   - gh-106527(142): Reduce overhead to add and remove *note asyncio: b.
     readers and writers.

   - gh-106524(143): Fix crash in ‘_sre.template()’ with templates
     containing invalid group indices.

   - gh-106531(144): Removed ‘_legacy’ and the names it provided from
     ‘importlib.resources’: ‘Resource’, ‘contents’, ‘is_resource’,
     ‘open_binary’, ‘open_text’, ‘path’, ‘read_binary’, and ‘read_text’.

   - gh-106052(145): *note re: be. module: fix the matching of
     possessive quantifiers in the case of a subpattern containing
     backtracking.

   - gh-106510(146): Improve debug output for atomic groups in regular
     expressions.

   - gh-106503(147): Fix ref cycle in ‘asyncio._SelectorSocketTransport’
     by removing ‘_write_ready’ in ‘close’.

   - gh-105497(148): Fix flag mask inversion when unnamed flags exist.

   - gh-90876(149): Prevent ‘multiprocessing.spawn’ from failing to
     'import' in environments where ‘sys.executable’ is ‘None’.  This
     regressed in 3.11 with the addition of support for path-like
     objects in multiprocessing.

   - gh-106403(150): Instances of *note typing.TypeVar: 486, *note
     typing.ParamSpec: 487, *note typing.ParamSpecArgs: 9c9, *note
     typing.ParamSpecKwargs: 9ca, and *note typing.TypeVarTuple: 488.
     once again support weak references, fixing a regression introduced
     in Python 3.12.0 beta 1.  Patch by Jelle Zijlstra.

   - gh-89812(151): Add private ‘pathlib._PathBase’ class, which
     provides experimental support for virtual filesystems, and may be
     made public in a future version of Python.

   - gh-106292(152): Check for an instance-dict cached value in the
     ‘__get__()’ method of *note functools.cached_property(): 763.  This
     better matches the pre-3.12 behavior and improves compatibility for
     users subclassing *note functools.cached_property(): 763. and
     adding a ‘__set__()’ method.

   - gh-106350(153): Detect possible memory allocation failure in the
     libtommath function ‘mp_init()’ used by the ‘_tkinter’ module.

   - gh-106330(154): Fix incorrect matching of empty paths in *note
     pathlib.PurePath.match(): 6d3.  This bug was introduced in Python
     3.12.0 beta 1.

   - gh-106309(155): Deprecate *note typing.no_type_check_decorator():
     333.  No major type checker ever added support for this decorator.
     Patch by Alex Waygood.

   - gh-102541(156): Make ‘pydoc.doc()’ catch bad module *note
     ImportError: 65b. when output stream is not ‘None’.

   - gh-106263(157): Fix crash when calling ‘repr’ with a manually
     constructed SignalDict object.  Patch by Charlie Zhao.

   - gh-106236(158): Replace ‘assert’ statements with ‘raise
     RuntimeError’ in *note threading: f3, so that ‘_DummyThread’ cannot
     be joined even with ‘-OO’.

   - gh-106238(159): Fix rare concurrency bug in lock acquisition by the
     logging package.

   - gh-106152(160): Added PY_THROW event hook for *note cProfile: 2b.
     for generators

   - gh-106075(161): Added ‘asyncio.taskgroups.__all__’ to
     ‘asyncio.__all__’ for export in star imports.

   - gh-104527(162): Zipapp will now skip over appending an archive to
     itself.

   - gh-106046(163): Improve the error message from *note os.fspath():
     e4d. if called on an object where ‘__fspath__’ is set to ‘None’.
     Patch by Alex Waygood.

   - gh-105987(164): Fix crash due to improper reference counting in
     *note asyncio: b. eager task factory internal routines.

   - gh-105974(165): Fix bug where a *note typing.Protocol: 56b. class
     that had one or more non-callable members would raise *note
     TypeError: 198. when *note issubclass(): 9c4. was called against
     it, even if it defined a custom ‘__subclasshook__’ method.  The
     behaviour in Python 3.11 and lower - which has now been restored -
     was not to raise *note TypeError: 198. in these situations if a
     custom ‘__subclasshook__’ method was defined.  Patch by Alex
     Waygood.

   - gh-96145(166): Reverted addition of ‘json.AttrDict’.

   - gh-89812(167): Add *note pathlib.UnsupportedOperation: 533, which
     is raised instead of *note NotImplementedError: 36b. when a path
     operation isn't supported.

   - gh-105808(168): Fix a regression introduced in gh-101251(169) for
     3.12, causing ‘gzip.GzipFile.flush()’ to not flush the compressor
     (nor pass along the ‘zip_mode’ argument).

   - gh-105481(170): *note stack_effect(): 1132. no longer raises an
     exception if an ‘oparg’ is provided for an ‘opcode’ that doesn't
     use its arg, or when it is not provided for an ‘opcode’ that does
     use it.  In the latter case, the stack effect is returned for
     ‘oparg=0’.

   - gh-104799(171): Enable *note ast.unparse(): ae2. to unparse
     function and class definitions created without the new
     ‘type_params’ field from PEP 695(172).  Patch by Jelle Zijlstra.

   - gh-105793(173): Add 'follow_symlinks' keyword-only argument to
     *note pathlib.Path.is_dir(): 53a. and *note is_file(): 539,
     defaulting to ‘True’.

   - gh-105570(174): Deprecate two methods of creating *note
     typing.TypedDict: 332. classes with 0 fields using the functional
     syntax: ‘TD = TypedDict("TD")’ and ‘TD = TypedDict("TD", None)’.
     Both will be disallowed in Python 3.15.  To create a ‘TypedDict’
     class with 0 fields, either use ‘class TD(TypedDict): pass’ or ‘TD
     = TypedDict("TD", {})’.

   - gh-105745(175): Fix ‘webbrowser.Konqueror.open’ method.

   - gh-105733(176): *note ctypes: 2e.: Deprecate undocumented
     ‘ctypes.SetPointerType()’ and ‘ctypes.ARRAY()’ functions.  Patch by
     Victor Stinner.

   - gh-105687(177): Remove deprecated ‘re.template’, ‘re.T’,
     ‘re.TEMPLATE’, ‘sre_constans.SRE_FLAG_TEMPLATE’.

   - gh-105684(178): Supporting *note asyncio.Task.set_name(): bd0. is
     now mandatory for third party task implementations.  The
     undocumented ‘_set_task_name()’ function (deprecated since 3.8) has
     been removed.  Patch by Kumar Aditya.

   - gh-105375(179): Fix a bug in ‘_Unpickler_SetInputStream()’ where an
     exception could end up being overwritten in case of failure.

   - gh-105626(180): Change the default return value of *note
     http.client.HTTPConnection.get_proxy_response_headers(): 1a73. to
     be ‘None’ and not ‘{}’.

   - gh-105375(181): Fix bugs in *note sys: df. where exceptions could
     end up being overwritten because of deferred error handling.

   - gh-105605(182): Harden ‘pyexpat’ error handling during module
     initialisation to prevent exceptions from possibly being
     overwritten, and objects from being dereferenced twice.

   - gh-105375(183): Fix bug in *note decimal: 3a. where an exception
     could end up being overwritten.

   - gh-105375(184): Fix bugs in ‘_datetime’ where exceptions could be
     overwritten in case of module initialisation failure.

   - gh-105375(185): Fix bugs in ‘_ssl’ initialisation which could lead
     to leaked references and overwritten exceptions.

   - gh-105375(186): Fix a bug in *note array.array: 4be. where an
     exception could end up being overwritten.

   - gh-105375(187): Fix bugs in ‘_ctypes’ where exceptions could end up
     being overwritten.

   - gh-105375(188): Fix a bug in the *note posix: b2. module where an
     exception could be overwritten.

   - gh-105375(189): Fix bugs in ‘_elementtree’ where exceptions could
     be overwritten.

   - gh-105375(190): Fix bugs in *note zoneinfo: 13a. where exceptions
     could be overwritten.

   - gh-105375(191): Fix bugs in *note errno: 5b. where exceptions could
     be overwritten.

   - gh-105566(192): Deprecate creating a *note typing.NamedTuple: 331.
     class using keyword arguments to denote the fields (‘NT =
     NamedTuple("NT", x=int, y=str)’).  This will be disallowed in
     Python 3.15.  Use the class-based syntax or the functional syntax
     instead.

     Two methods of creating ‘NamedTuple’ classes with 0 fields using
     the functional syntax are also deprecated, and will be disallowed
     in Python 3.15: ‘NT = NamedTuple("NT")’ and ‘NT = NamedTuple("NT",
     None)’.  To create a ‘NamedTuple’ class with 0 fields, either use
     ‘class NT(NamedTuple): pass’ or ‘NT = NamedTuple("NT", [])’.

   - gh-105545(193): Remove deprecated in 3.11
     ‘webbrowser.MacOSXOSAScript._name’ attribute.

   - gh-105497(194): Fix flag inversion when alias/mask members exist.

   - gh-105509(195): *note typing.Annotated: b37. is now implemented as
     an instance of ‘typing._SpecialForm’ rather than a class.  This
     should have no user-facing impact for users of the *note typing:
     10a. module public API.

   - gh-105375(196): Fix bugs in *note pickle: ab. where exceptions
     could be overwritten.

   - gh-70303(197): Emit *note FutureWarning: 659. from *note
     pathlib.Path.glob(): 537. and *note rglob(): 538. if the given
     pattern ends with "‘**’".  In a future Python release, patterns
     with this ending will match both files and directories.  Add a
     trailing slash to only match directories.

   - gh-105375(198): Fix a bug in *note sqlite3: d4. where an exception
     could be overwritten in the *note collation: 886. callback.

   - gh-105382(199): Remove 'cafile', 'capath' and 'cadefault'
     parameters of the *note urllib.request.urlopen(): 307. function,
     deprecated in Python 3.6.  Patch by Victor Stinner.

   - gh-105376(200): *note logging: 8b.: Remove undocumented and
     untested ‘Logger.warn()’ and ‘LoggerAdapter.warn()’ methods and
     ‘logging.warn()’ function.  Deprecated since Python 3.3, they were
     aliases to the *note logging.Logger.warning(): 1a74. method,
     ‘logging.LoggerAdapter.warning()’ method and *note
     logging.warning(): 354. function.  Patch by Victor Stinner.

   - gh-105332(201): Revert pickling method from by-name back to
     by-value.

   - gh-104554(202): Add RTSPS scheme support in urllib.parse

   - gh-105292(203): Add option to *note
     traceback.format_exception_only(): a4e. to recurse into the nested
     exception of a *note BaseExceptionGroup: 566.

   - gh-105280(204): Fix bug where ‘isinstance([],
     collections.abc.Mapping)’ could evaluate to ‘True’ if garbage
     collection happened at the wrong time.  The bug was caused by
     changes to the implementation of *note typing.Protocol: 56b. in
     Python 3.12.

   - gh-80480(205): *note array: 8.: Add ‘'w'’ typecode that represents
     ‘Py_UCS4’.

   - gh-105239(206): Fix longstanding bug where ‘issubclass(object,
     typing.Protocol)’ would evaluate to ‘True’ in some edge cases.
     Patch by Alex Waygood.

   - gh-104310(207): In the beta 1 release we added a utility function
     for extension module authors, to use when testing their module for
     support in multiple interpreters or under a per-interpreter GIL.
     The name of that function has changed from
     ‘allowing_all_extensions’ to
     ‘_incompatible_extension_module_restrictions’.  The default for the
     "disable_check" argument has change from ‘True’ to ‘False’, to
     better match the new function name.

   - gh-105080(208): Fixed inconsistent signature on derived classes for
     *note inspect.signature(): 22f.

   - gh-105144(209): Fix a recent regression in the *note typing: 10a.
     module.  The regression meant that doing ‘class Foo(X,
     typing.Protocol)’, where ‘X’ was a class that had *note
     abc.ABCMeta: 111c. as its metaclass, would then cause subsequent
     ‘isinstance(1, X)’ calls to erroneously raise *note TypeError: 198.
     Patch by Alex Waygood.

   - gh-62948(210): The *note io.IOBase: 505. finalizer now logs the
     ‘close()’ method errors with *note sys.unraisablehook: 507.
     Previously, errors were ignored silently by default, and only
     logged in *note Python Development Mode: 508. or on *note Python
     built on debug mode: 509.  Patch by Victor Stinner.

   - gh-105096(211): *note wave: 119.: Deprecate the ‘getmark()’,
     ‘setmark()’ and ‘getmarkers()’ methods of the *note wave.Wave_read:
     336. and *note wave.Wave_write: 337. classes.  They will be removed
     in Python 3.15.  Patch by Victor Stinner.

   - gh-104992(212): Remove the untested and undocumented
     ‘unittest.TestProgram.usageExit()’ method, deprecated in Python
     3.11.  Patch by Hugo van Kemenade.

   - gh-104996(213): Improve performance of *note pathlib.PurePath: 6cd.
     initialisation by deferring joining of paths when multiple
     arguments are given.

   - gh-101588(214): Deprecate undocumented copy/deepcopy/pickle support
     for itertools.

   - gh-103631(215): Fix
     ‘pathlib.PurePosixPath(pathlib.PureWindowsPath(...))’ not
     converting path separators to restore 3.11 compatible behavior.

   - gh-104947(216): Make comparisons between *note
     pathlib.PureWindowsPath: 1a75. objects consistent across Windows
     and Posix to match 3.11 behavior.

   - gh-104773(217): PEP 594(218): Remove the ‘audioop’ module,
     deprecated in Python 3.11.  Patch by Victor Stinner.

   - gh-104773(219): PEP 594(220): Remove the ‘aifc’ module, deprecated
     in Python 3.11.  Patch by Victor Stinner.

   - gh-104773(221): PEP 594(222): Remove the ‘uu’ module, deprecated in
     Python 3.11.  Patch by Victor Stinner.

   - gh-104935(223): Fix bugs with the interaction between *note
     typing.runtime_checkable(): 675. and *note typing.Generic: 17b6.
     that were introduced by the PEP 695(224) implementation.  Patch by
     Jelle Zijlstra.

   - gh-104773(225): PEP 594(226): Remove the ‘crypt’ module and its
     private ‘_crypt’ extension, deprecated in Python 3.11.  Patch by
     Victor Stinner.

   - gh-104773(227): PEP 594(228): Remove the ‘nis’ module, deprecated
     in Python 3.11.  Patch by Victor Stinner.

   - gh-104898(229): Add missing *note __slots__: 1704. to *note
     os.PathLike: e4b.

   - gh-104773(230): PEP 594(231): Remove the ‘xdrlib’ module,
     deprecated in Python 3.11.  Patch by Victor Stinner.

   - gh-104773(232): PEP 594(233): Remove the ‘nntplib’ module,
     deprecated in Python 3.11.  Patch by Victor Stinner.

   - gh-104886(234): Remove the undocumented
     ‘configparser.LegacyInterpolation’ class, deprecated in the
     docstring since Python 3.2, and with a deprecation warning since
     Python 3.11.  Patch by Hugo van Kemenade.

   - gh-104786(235): Remove kwargs-based *note typing.TypedDict: 332.
     creation

   - gh-104876(236): Remove the ‘turtle.RawTurtle.settiltangle()’
     method, deprecated in docs since Python 3.1 and with a deprecation
     warning since Python 3.11.  Patch by Hugo van Kemenade.

   - gh-104773(237): PEP 594(238): Removed the ‘msilib’ package,
     deprecated in Python 3.11.

   - gh-104773(239): PEP 594(240): Remove the ‘spwd’ module, deprecated
     in Python 3.11: the python-pam(241) project can be used instead.
     Patch by Victor Stinner.

   - gh-75552(242): Removed the ‘tkinter.tix’ module, deprecated since
     Python 3.6.

   - gh-104773(243): PEP 594(244): Remove the ‘chunk’ module, deprecated
     in Python 3.11.  Patch by Victor Stinner.

   - gh-104773(245): PEP 594(246): Remove the ‘mailcap’ module,
     deprecated in Python 3.11.  Patch by Victor Stinner.

   - gh-104773(247): PEP 594(248): Remove the ‘sunau’ module, deprecated
     in Python 3.11.  Patch by Victor Stinner.

   - gh-104780(249): PEP 594(250): Remove the ‘ossaudiodev’ module,
     deprecated in Python 3.11.  Patch Victor Stinner.

   - gh-104773(251): PEP 594(252): Remove the ‘pipes’ module, deprecated
     in Python 3.11.  Patch by Victor Stinner.

   - gh-104873(253): Add *note typing.get_protocol_members(): 56a. to
     return the set of members defining a *note typing.Protocol: 56b.
     Add *note typing.is_protocol(): 56c. to check whether a class is a
     *note typing.Protocol: 56b.  Patch by Jelle Zijlstra.

   - gh-104874(254): Document the ‘__name__’ and ‘__supertype__’
     attributes of *note typing.NewType: ef1.  Patch by Jelle Zijlstra.

   - gh-104835(255): Removed the following *note unittest: 10c.
     functions, deprecated in Python 3.11:

        * ‘unittest.findTestCases()’

        * ‘unittest.makeSuite()’

        * ‘unittest.getTestCaseNames()’

     Use *note TestLoader: 593. methods instead:

        * *note unittest.TestLoader.loadTestsFromModule(): 594.

        * *note unittest.TestLoader.loadTestsFromTestCase(): 595.

        * *note unittest.TestLoader.getTestCaseNames(): 596.

     Patch by Hugo van Kemenade.

   - gh-104804(256): Remove the untested and undocumented *note
     webbrowser: 11b. ‘MacOSX’ class, deprecated in Python 3.11.  Patch
     by Hugo van Kemenade.

   - gh-83863(257): Support for using *note pathlib.Path: 266. objects
     as context managers has been removed.  Before Python 3.9, exiting
     the context manager marked a path as "closed", which caused some
     (but not all!)  methods to raise when called.  Since Python 3.9,
     using a path as a context manager does nothing.

   - gh-104799(258): Adjust the location of the (see PEP 695(259))
     ‘type_params’ field on *note ast.ClassDef: 1a76, *note
     ast.AsyncFunctionDef: 1a77, and *note ast.FunctionDef: 1a78. to
     better preserve backward compatibility.  Patch by Jelle Zijlstra

   - gh-104797(260): Allow *note typing.Protocol: 56b. classes to
     inherit from *note collections.abc.Buffer: 343.  Patch by Jelle
     Zijlstra.

   - gh-104783(261): Remove ‘locale.resetlocale()’ function deprecated
     in Python 3.11.  Patch by Victor Stinner.

   - gh-104780(262): Remove the ‘2to3’ program and the ‘lib2to3’ module,
     deprecated in Python 3.11.  Patch by Victor Stinner.

   - gh-104773(263): PEP 594(264): Remove the ‘telnetlib’ module,
     deprecated in Python 3.11.  Patch by Victor Stinner.

   - gh-104773(265): PEP 594(266): Remove the ‘imghdr’ module,
     deprecated in Python 3.11.  Patch by Victor Stinner.

   - gh-104773(267): PEP 594(268): Remove the ‘cgi’ and ‘cgitb’ modules,
     deprecated in Python 3.11.  Patch by Victor Stinner.

   - gh-104773(269): PEP 594(270): Remove the ‘sndhdr’ module,
     deprecated in Python 3.11.  Patch by Victor Stinner.

   - gh-104372(271): On Linux where *note subprocess: dc. can use the
     ‘vfork()’ syscall for faster spawning, prevent the parent process
     from blocking other threads by dropping the GIL while it waits for
     the vfork'ed child process ‘exec()’ outcome.  This prevents
     spawning a binary from a slow filesystem from blocking the rest of
     the application.

   - gh-99108(272): We now release the GIL around built-in *note
     hashlib: 6c. computations of reasonable size for the SHA families
     and MD5 hash functions, matching what our OpenSSL backed hash
     computations already does.

   - gh-102613(273): Improve performance of *note pathlib.Path.glob():
     537. when expanding a pattern with a non-terminal "‘**’" component
     by filtering walked paths through a regular expression, rather than
     calling *note os.scandir(): c54. more than once on each directory.

   - gh-104399(274): Prepare the ‘_tkinter’ module for building with Tcl
     9.0 and future libtommath by replacing usage of deprecated
     functions ‘mp_to_unsigned_bin_n()’ and ‘mp_unsigned_bin_size()’
     when necessary.

   - gh-102676(275): Add fields ‘start_offset’, ‘cache_offset’,
     ‘end_offset’, ‘baseopname’, ‘baseopcode’, ‘jump_target’ and ‘oparg’
     to *note dis.Instruction: 203.

   - gh-103558(276): Fixed ‘parent’ argument validation mechanism of
     *note argparse: 7.  Improved test coverage.

   - gh-103464(277): Provide helpful usage messages when parsing
     incorrect *note pdb: aa. commands.

   - gh-103384(278): Generalize the regex pattern
     ‘BaseConfigurator.INDEX_PATTERN’ to allow spaces and
     non-alphanumeric characters in keys.

   - gh-103124(279): Added multiline statement support for *note pdb:
     aa.

   - gh-101162(280): Forbid using ‘builtins.issubclass()’ with *note
     types.GenericAlias: 9ec. as the first argument.

   - gh-103200(281): Fix cache repopulation semantics of
     zipimport.invalidate_caches().  The cache is now repopulated upon
     retrieving files with an invalid cache, not when the cache is
     invalidated.

   - gh-100061(282): Fix a bug that causes wrong matches for regular
     expressions with possessive qualifier.

   - gh-77609(283): Add 'follow_symlinks' argument to *note
     pathlib.Path.glob(): 537. and *note rglob(): 538, defaulting to
     false.

   - gh-102541(284): Hide traceback in *note help(): ad4. prompt, when
     import failed.

   - gh-102120(285): Added a stream mode to ‘tarfile’ that allows for
     reading archives without caching info about the inner files.

   - gh-102029(286): Deprecate passing any arguments to *note
     threading.RLock(): 32e.

   - gh-88233(287): Refactored ‘zipfile._strip_extra’ to use higher
     level abstractions for extras instead of a heavy-state loop.

   - gh-102024(288): Reduce calls of ‘_idle_semaphore.release()’ in
     ‘concurrent.futures.thread._worker()’.

   - gh-73435(289): Add support for recursive wildcards in *note
     pathlib.PurePath.match(): 6d3.

   - gh-84867(290): *note unittest.TestLoader: 593. no longer loads test
     cases from exact *note unittest.TestCase: 2b3. and *note
     unittest.FunctionTestCase: 1a79. classes.

   - gh-99203(291): Restore following CPython <= 3.10.5 behavior of
     *note shutil.make_archive(): 6da.: do not create an empty archive
     if ‘root_dir’ is not a directory, and, in that case, raise *note
     FileNotFoundError: 264. or *note NotADirectoryError: 1265.
     regardless of ‘format’ choice.  Beyond the brought-back behavior,
     the function may now also raise these exceptions in ‘dry_run’ mode.

   - gh-80480(292): Emit *note DeprecationWarning: 1a3. for *note array:
     8.'s ‘'u'’ type code, deprecated in docs since Python 3.3.

   - gh-94924(293): *note unittest.mock.create_autospec(): 1934. now
     properly returns coroutine functions compatible with *note
     inspect.iscoroutinefunction(): 30d.

   - gh-94777(294): Fix hanging *note multiprocessing: 98.
     ‘ProcessPoolExecutor’ when a child process crashes while data is
     being written in the call queue.

   - gh-92871(295): Remove the ‘typing.io’ and ‘typing.re’ namespaces,
     deprecated since Python 3.8.  All items are still available from
     the main *note typing: 10a. module.

   - bpo-43633(296): Improve the textual representation of IPv4-mapped
     IPv6 addresses ( RFC 4291(297) Sections 2.2, 2.5.5.2) in *note
     ipaddress: 84.  Patch by Oleksandr Pavliuk.

   - bpo-44850(298): Improve performance of *note
     operator.methodcaller(): 1034. using the PEP 590(299) ‘vectorcall’
     convention.  Patch by Anthony Lee and Pieter Eendebak.

   - bpo-44185(300): *note unittest.mock.mock_open(): 11e9. will call
     the ‘close()’ method of the file handle mock when it is exiting
     from the context manager.  Patch by Samet Yaslan.

   - bpo-40988(301): Improve performance of *note
     functools.singledispatchmethod: be5. by caching the generated
     dispatch wrapper.  Optimization suggested by frederico.  Patch by
     @mental32, Alex Waygood and Pieter Eendebak.

   - bpo-41768(302): *note unittest.mock: 10d. speccing no longer calls
     class properties.  Patch by Melanie Witt.

   - bpo-18319(303): Ensure ‘gettext(msg)’ retrieve translations even if
     a plural form exists.  In other words: ‘gettext(msg) ==
     ngettext(msg, '', 1)’.

   - bpo-17013(304): Add ‘ThreadingMock’ to *note unittest.mock: 10d.
     that can be used to create Mock objects that can wait until they
     are called.  Patch by Karthikeyan Singaravelan and Mario Corchero.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/110786

   (2) https://github.com/python/cpython/issues/103480

   (3) https://github.com/python/cpython/issues/110733

   (4) https://github.com/python/cpython/issues/94597

   (5) https://github.com/python/cpython/issues/110682

   (6) https://github.com/python/cpython/issues/110488

   (7) https://github.com/python/cpython/issues/110590

   (8) https://github.com/python/cpython/issues/65052

   (9) https://github.com/python/cpython/issues/110519

   (10) https://github.com/python/cpython/issues/89902

   (11) https://github.com/python/cpython/issues/110378

   (12) https://github.com/python/cpython/issues/106670

   (13) https://github.com/python/cpython/issues/110365

   (14) https://github.com/python/cpython/issues/109653

   (15) https://github.com/python/cpython/issues/110273

   (16) https://github.com/python/cpython/issues/110249

   (17) https://github.com/python/cpython/issues/109653

   (18) https://github.com/python/cpython/issues/110222

   (19) https://github.com/python/cpython/issues/109649

   (20) https://github.com/python/cpython/issues/110150

   (21) https://github.com/python/cpython/issues/110036

   (22) https://github.com/python/cpython/issues/110038

   (23) https://github.com/python/cpython/issues/110045

   (24) https://peps.python.org/pep-0695/

   (25) https://github.com/python/cpython/issues/88402

   (26) https://github.com/python/cpython/issues/109631

   (27) https://github.com/python/cpython/issues/109653

   (28) https://github.com/python/cpython/issues/109818

   (29) https://github.com/python/cpython/issues/109047

   (30) https://github.com/python/cpython/issues/109782

   (31) https://github.com/python/cpython/issues/109653

   (32) https://github.com/python/cpython/issues/109590

   (33) https://github.com/python/cpython/issues/109653

   (34) https://github.com/python/cpython/issues/109593

   (35) https://github.com/python/cpython/issues/109653

   (36) https://github.com/python/cpython/issues/109649

   (37) https://github.com/python/cpython/issues/74481

   (38) https://github.com/python/cpython/issues/109613

   (39) https://github.com/python/cpython/issues/109599

   (40) https://github.com/python/cpython/issues/109109

   (41) https://github.com/python/cpython/issues/109559

   (42) https://github.com/python/cpython/issues/109543

   (43) https://github.com/python/cpython/issues/109495

   (44) https://github.com/python/cpython/issues/109461

   (45) https://github.com/python/cpython/issues/109096

   (46) https://github.com/python/cpython/issues/109409

   (47) https://github.com/python/cpython/issues/109375

   (48) https://github.com/python/cpython/issues/109319

   (49) https://github.com/python/cpython/issues/107219

   (50) https://github.com/python/cpython/issues/66143

   (51) https://github.com/python/cpython/issues/109187

   (52) https://github.com/python/cpython/issues/50644

   (53) https://github.com/python/cpython/issues/109174

   (54) https://github.com/python/cpython/issues/109164

   (55) https://github.com/python/cpython/issues/109151

   (56) https://github.com/python/cpython/issues/108987

   (57) https://github.com/python/cpython/issues/108682

   (58) https://github.com/python/cpython/issues/109033

   (59) https://github.com/python/cpython/issues/108843

   (60) https://github.com/python/cpython/issues/108469

   (61) https://github.com/python/cpython/issues/108751

   (62) https://github.com/python/cpython/issues/108682

   (63) https://github.com/python/cpython/issues/108278

   (64) https://github.com/python/cpython/issues/105829

   (65) https://github.com/python/cpython/issues/108295

   (66) https://github.com/python/cpython/issues/108463

   (67) https://github.com/python/cpython/issues/108277

   (68) https://github.com/python/cpython/issues/107811

   (69) https://github.com/python/cpython/issues/64662

   (70) https://github.com/python/cpython/issues/108111

   (71) https://github.com/python/cpython/issues/101251

   (72) https://github.com/python/cpython/issues/108294

   (73) https://github.com/python/cpython/issues/108278

   (74) https://github.com/python/cpython/issues/108322

   (75) https://github.com/python/cpython/issues/83417

   (76) https://github.com/python/cpython/issues/105736

   (77) https://github.com/python/cpython/issues/108083

   (78) https://github.com/python/cpython/issues/107932

   (79) https://github.com/python/cpython/issues/105539

   (80) https://github.com/python/cpython/issues/107995

   (81) https://github.com/python/cpython/issues/107963

   (82) https://github.com/python/cpython/issues/106242

   (83) https://github.com/python/cpython/issues/81555

   (84) https://github.com/python/cpython/issues/50002

   (85) https://github.com/python/cpython/issues/93057

   (86) https://github.com/python/cpython/issues/76913

   (87) https://github.com/python/cpython/issues/107913

   (88) https://github.com/python/cpython/issues/107845

   (89) https://github.com/python/cpython/issues/107812

   (90) https://github.com/python/cpython/issues/107805

   (91) https://github.com/python/cpython/issues/107782

   (92) https://github.com/python/cpython/issues/56166

   (93) https://github.com/python/cpython/issues/107710

   (94) https://github.com/python/cpython/issues/107715

   (95) https://github.com/python/cpython/issues/100814

   (96) https://github.com/python/cpython/issues/72684

   (97) https://github.com/python/cpython/issues/106684

   (98) https://github.com/python/cpython/issues/107465

   (99) https://github.com/python/cpython/issues/107077

   (100) https://github.com/python/cpython/issues/107576

   (101) https://github.com/python/cpython/issues/105481

   (102) https://github.com/python/cpython/issues/105481

   (103) https://github.com/python/cpython/issues/107396

   (104) https://github.com/python/cpython/issues/107409

   (105) https://github.com/python/cpython/issues/107406

   (106) https://github.com/python/cpython/issues/107369

   (107) https://github.com/python/cpython/issues/78722

   (108) https://github.com/python/cpython/issues/105578

   (109) https://github.com/python/cpython/issues/62519

   (110) https://github.com/python/cpython/issues/107089

   (111) https://github.com/python/cpython/issues/82500

   (112) https://github.com/python/cpython/issues/83006

   (113) https://github.com/python/cpython/issues/65495

   (114) https://github.com/python/cpython/issues/106186

   (115) https://github.com/python/cpython/issues/105002

   (116) https://github.com/python/cpython/issues/106739

   (117) https://github.com/python/cpython/issues/106751

   (118) https://github.com/python/cpython/issues/106751

   (119) https://github.com/python/cpython/issues/106751

   (120) https://github.com/python/cpython/issues/106831

   (121) https://github.com/python/cpython/issues/105481

   (122) https://github.com/python/cpython/issues/106727

   (123) https://github.com/python/cpython/issues/106789

   (124) https://github.com/python/cpython/issues/105726

   (125) https://github.com/python/cpython/issues/106774

   (126) https://github.com/python/cpython/issues/106751

   (127) https://github.com/python/cpython/issues/106752

   (128) https://github.com/python/cpython/issues/105293

   (129) https://github.com/python/cpython/issues/106734

   (130) https://github.com/python/cpython/issues/105481

   (131) https://github.com/python/cpython/issues/106670

   (132) https://github.com/python/cpython/issues/106602

   (133) https://github.com/python/cpython/issues/106664

   (134) https://github.com/python/cpython/issues/106628

   (135) https://github.com/python/cpython/issues/89427

   (136) https://github.com/python/cpython/issues/106530

   (137) https://github.com/python/cpython/issues/106584

   (138) https://github.com/python/cpython/issues/106566

   (139) https://github.com/python/cpython/issues/106554

   (140) https://github.com/python/cpython/issues/106558

   (141) https://github.com/python/cpython/issues/100502

   (142) https://github.com/python/cpython/issues/106527

   (143) https://github.com/python/cpython/issues/106524

   (144) https://github.com/python/cpython/issues/106531

   (145) https://github.com/python/cpython/issues/106052

   (146) https://github.com/python/cpython/issues/106510

   (147) https://github.com/python/cpython/issues/106503

   (148) https://github.com/python/cpython/issues/105497

   (149) https://github.com/python/cpython/issues/90876

   (150) https://github.com/python/cpython/issues/106403

   (151) https://github.com/python/cpython/issues/89812

   (152) https://github.com/python/cpython/issues/106292

   (153) https://github.com/python/cpython/issues/106350

   (154) https://github.com/python/cpython/issues/106330

   (155) https://github.com/python/cpython/issues/106309

   (156) https://github.com/python/cpython/issues/102541

   (157) https://github.com/python/cpython/issues/106263

   (158) https://github.com/python/cpython/issues/106236

   (159) https://github.com/python/cpython/issues/106238

   (160) https://github.com/python/cpython/issues/106152

   (161) https://github.com/python/cpython/issues/106075

   (162) https://github.com/python/cpython/issues/104527

   (163) https://github.com/python/cpython/issues/106046

   (164) https://github.com/python/cpython/issues/105987

   (165) https://github.com/python/cpython/issues/105974

   (166) https://github.com/python/cpython/issues/96145

   (167) https://github.com/python/cpython/issues/89812

   (168) https://github.com/python/cpython/issues/105808

   (169) https://github.com/python/cpython/issues/101251

   (170) https://github.com/python/cpython/issues/105481

   (171) https://github.com/python/cpython/issues/104799

   (172) https://peps.python.org/pep-0695/

   (173) https://github.com/python/cpython/issues/105793

   (174) https://github.com/python/cpython/issues/105570

   (175) https://github.com/python/cpython/issues/105745

   (176) https://github.com/python/cpython/issues/105733

   (177) https://github.com/python/cpython/issues/105687

   (178) https://github.com/python/cpython/issues/105684

   (179) https://github.com/python/cpython/issues/105375

   (180) https://github.com/python/cpython/issues/105626

   (181) https://github.com/python/cpython/issues/105375

   (182) https://github.com/python/cpython/issues/105605

   (183) https://github.com/python/cpython/issues/105375

   (184) https://github.com/python/cpython/issues/105375

   (185) https://github.com/python/cpython/issues/105375

   (186) https://github.com/python/cpython/issues/105375

   (187) https://github.com/python/cpython/issues/105375

   (188) https://github.com/python/cpython/issues/105375

   (189) https://github.com/python/cpython/issues/105375

   (190) https://github.com/python/cpython/issues/105375

   (191) https://github.com/python/cpython/issues/105375

   (192) https://github.com/python/cpython/issues/105566

   (193) https://github.com/python/cpython/issues/105545

   (194) https://github.com/python/cpython/issues/105497

   (195) https://github.com/python/cpython/issues/105509

   (196) https://github.com/python/cpython/issues/105375

   (197) https://github.com/python/cpython/issues/70303

   (198) https://github.com/python/cpython/issues/105375

   (199) https://github.com/python/cpython/issues/105382

   (200) https://github.com/python/cpython/issues/105376

   (201) https://github.com/python/cpython/issues/105332

   (202) https://github.com/python/cpython/issues/104554

   (203) https://github.com/python/cpython/issues/105292

   (204) https://github.com/python/cpython/issues/105280

   (205) https://github.com/python/cpython/issues/80480

   (206) https://github.com/python/cpython/issues/105239

   (207) https://github.com/python/cpython/issues/104310

   (208) https://github.com/python/cpython/issues/105080

   (209) https://github.com/python/cpython/issues/105144

   (210) https://github.com/python/cpython/issues/62948

   (211) https://github.com/python/cpython/issues/105096

   (212) https://github.com/python/cpython/issues/104992

   (213) https://github.com/python/cpython/issues/104996

   (214) https://github.com/python/cpython/issues/101588

   (215) https://github.com/python/cpython/issues/103631

   (216) https://github.com/python/cpython/issues/104947

   (217) https://github.com/python/cpython/issues/104773

   (218) https://peps.python.org/pep-0594/

   (219) https://github.com/python/cpython/issues/104773

   (220) https://peps.python.org/pep-0594/

   (221) https://github.com/python/cpython/issues/104773

   (222) https://peps.python.org/pep-0594/

   (223) https://github.com/python/cpython/issues/104935

   (224) https://peps.python.org/pep-0695/

   (225) https://github.com/python/cpython/issues/104773

   (226) https://peps.python.org/pep-0594/

   (227) https://github.com/python/cpython/issues/104773

   (228) https://peps.python.org/pep-0594/

   (229) https://github.com/python/cpython/issues/104898

   (230) https://github.com/python/cpython/issues/104773

   (231) https://peps.python.org/pep-0594/

   (232) https://github.com/python/cpython/issues/104773

   (233) https://peps.python.org/pep-0594/

   (234) https://github.com/python/cpython/issues/104886

   (235) https://github.com/python/cpython/issues/104786

   (236) https://github.com/python/cpython/issues/104876

   (237) https://github.com/python/cpython/issues/104773

   (238) https://peps.python.org/pep-0594/

   (239) https://github.com/python/cpython/issues/104773

   (240) https://peps.python.org/pep-0594/

   (241) https://pypi.org/project/python-pam/

   (242) https://github.com/python/cpython/issues/75552

   (243) https://github.com/python/cpython/issues/104773

   (244) https://peps.python.org/pep-0594/

   (245) https://github.com/python/cpython/issues/104773

   (246) https://peps.python.org/pep-0594/

   (247) https://github.com/python/cpython/issues/104773

   (248) https://peps.python.org/pep-0594/

   (249) https://github.com/python/cpython/issues/104780

   (250) https://peps.python.org/pep-0594/

   (251) https://github.com/python/cpython/issues/104773

   (252) https://peps.python.org/pep-0594/

   (253) https://github.com/python/cpython/issues/104873

   (254) https://github.com/python/cpython/issues/104874

   (255) https://github.com/python/cpython/issues/104835

   (256) https://github.com/python/cpython/issues/104804

   (257) https://github.com/python/cpython/issues/83863

   (258) https://github.com/python/cpython/issues/104799

   (259) https://peps.python.org/pep-0695/

   (260) https://github.com/python/cpython/issues/104797

   (261) https://github.com/python/cpython/issues/104783

   (262) https://github.com/python/cpython/issues/104780

   (263) https://github.com/python/cpython/issues/104773

   (264) https://peps.python.org/pep-0594/

   (265) https://github.com/python/cpython/issues/104773

   (266) https://peps.python.org/pep-0594/

   (267) https://github.com/python/cpython/issues/104773

   (268) https://peps.python.org/pep-0594/

   (269) https://github.com/python/cpython/issues/104773

   (270) https://peps.python.org/pep-0594/

   (271) https://github.com/python/cpython/issues/104372

   (272) https://github.com/python/cpython/issues/99108

   (273) https://github.com/python/cpython/issues/102613

   (274) https://github.com/python/cpython/issues/104399

   (275) https://github.com/python/cpython/issues/102676

   (276) https://github.com/python/cpython/issues/103558

   (277) https://github.com/python/cpython/issues/103464

   (278) https://github.com/python/cpython/issues/103384

   (279) https://github.com/python/cpython/issues/103124

   (280) https://github.com/python/cpython/issues/101162

   (281) https://github.com/python/cpython/issues/103200

   (282) https://github.com/python/cpython/issues/100061

   (283) https://github.com/python/cpython/issues/77609

   (284) https://github.com/python/cpython/issues/102541

   (285) https://github.com/python/cpython/issues/102120

   (286) https://github.com/python/cpython/issues/102029

   (287) https://github.com/python/cpython/issues/88233

   (288) https://github.com/python/cpython/issues/102024

   (289) https://github.com/python/cpython/issues/73435

   (290) https://github.com/python/cpython/issues/84867

   (291) https://github.com/python/cpython/issues/99203

   (292) https://github.com/python/cpython/issues/80480

   (293) https://github.com/python/cpython/issues/94924

   (294) https://github.com/python/cpython/issues/94777

   (295) https://github.com/python/cpython/issues/92871

   (296) https://bugs.python.org/issue?@action=redirect&bpo=43633

   (297) https://datatracker.ietf.org/doc/html/rfc4291.html

   (298) https://bugs.python.org/issue?@action=redirect&bpo=44850

   (299) https://peps.python.org/pep-0590/

   (300) https://bugs.python.org/issue?@action=redirect&bpo=44185

   (301) https://bugs.python.org/issue?@action=redirect&bpo=40988

   (302) https://bugs.python.org/issue?@action=redirect&bpo=41768

   (303) https://bugs.python.org/issue?@action=redirect&bpo=18319

   (304) https://bugs.python.org/issue?@action=redirect&bpo=17013


File: python.info,  Node: ドキュメント<20>,  Next: テスト<19>,  Prev: ライブラリ<64>,  Up: Python 3 13 0 alpha 1

1.24.26.4 ドキュメント
......................

   - gh-109209(1): The minimum Sphinx version required for the
     documentation is now 4.2.

   - gh-108826(2): *note dis: 3c. module command-line interface is now
     mentioned in documentation.

   - gh-107305(3): Add documentation for *note PyInterpreterConfig: 78e.
     and *note Py_NewInterpreterFromConfig(): 689.  Also clarify some of
     the nearby docs relative to per-interpreter GIL.

   - gh-107008(4): Document the *note curses: 2f. module variables *note
     LINES: fec. and *note COLS: fed.

   - gh-106948(5): Add a number of standard external names to
     ‘nitpick_ignore’.

   - gh-106232(6): Make timeit doc command lines compatible with Windows
     by using double quotes for arguments.  This works on linux and
     macOS also.

   - gh-105172(7): Fixed *note functools.lru_cache(): be2. docstring
     accounting for ‘typed’ argument's different handling of str and
     int.  Patch by Bar Harel.

   - gh-105052(8): Update ‘timeit’ doc to specify that time in seconds
     is just the default.

   - gh-89455(9): Add missing documentation for the ‘max_group_depth’
     and ‘max_group_width’ parameters and the ‘exceptions’ attribute of
     the *note traceback.TracebackException: 563. class.

   - gh-89412(10): Add missing documentation for the ‘end_lineno’ and
     ‘end_offset’ attributes of the *note traceback.TracebackException:
     563. class.

   - gh-104943(11): Remove mentions of old Python versions in *note
     typing.NamedTuple: 331.

   - gh-54738(12): Add documentation on how to localize the *note
     argparse: 7. module.

   - gh-102823(13): Document the return type of ‘x // y’ when ‘x’ and
     ‘y’ have type *note float: 196.

   - gh-102759(14): Align function signature for ‘functools.reduce’ in
     documentation and docstring with the C implementation.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/109209

   (2) https://github.com/python/cpython/issues/108826

   (3) https://github.com/python/cpython/issues/107305

   (4) https://github.com/python/cpython/issues/107008

   (5) https://github.com/python/cpython/issues/106948

   (6) https://github.com/python/cpython/issues/106232

   (7) https://github.com/python/cpython/issues/105172

   (8) https://github.com/python/cpython/issues/105052

   (9) https://github.com/python/cpython/issues/89455

   (10) https://github.com/python/cpython/issues/89412

   (11) https://github.com/python/cpython/issues/104943

   (12) https://github.com/python/cpython/issues/54738

   (13) https://github.com/python/cpython/issues/102823

   (14) https://github.com/python/cpython/issues/102759


File: python.info,  Node: テスト<19>,  Next: ビルド<22>,  Prev: ドキュメント<20>,  Up: Python 3 13 0 alpha 1

1.24.26.5 テスト
................

   - gh-110647(1): Fix test_stress_modifying_handlers() of test_signal.
     Patch by Victor Stinner.

   - gh-103053(2): Fix test_tools.test_freeze on FreeBSD: run "make
     distclean" instead of "make clean" in the copied source directory
     to remove also the "python" program.  Patch by Victor Stinner.

   - gh-110167(3): Fix a deadlock in test_socket when server fails with
     a timeout but the client is still running in its thread.  Don't
     hold a lock to call cleanup functions in doCleanups().  One of the
     cleanup function waits until the client completes, whereas the
     client could deadlock if it called addCleanup() in such situation.
     Patch by Victor Stinner.

   - gh-110388(4): Add tests for *note tty: 106.

   - gh-81002(5): Add tests for *note termios: e7.

   - gh-110367(6): regrtest: When using worker processes (-jN) with
     -verbose3 option, regrtest can now display the worker output even
     if a worker process does crash.  Previously, sys.stdout and
     sys.stderr were replaced and so the worker output was lost on a
     crash.  Patch by Victor Stinner.

   - gh-110267(7): Add tests for pickling and copying PyStructSequence
     objects.  Patched by Xuehai Pan.

   - gh-110171(8): ‘libregrtest’ now always sets and shows
     ‘random.seed’, so tests are more reproducible.  Use ‘--randseed’
     flag to pass the explicit random seed for tests.

   - gh-110152(9): Remove ‘Tools/scripts/run_tests.py’ and ‘make
     hostrunnertest’.  Just run ‘./python -m test --slow-ci’, ‘make
     buildbottest’ or ‘make test’ instead.  Python test runner
     (regrtest) now handles cross-compilation and HOSTRUNNER. It also
     adds options to Python such fast ‘-u -E -W default -bb’ when
     ‘--fast-ci’ or ‘--slow-ci’ option is used.  Patch by Victor
     Stinner.

   - gh-110031(10): Skip test_threading tests using thread+fork if
     Python is built with Address Sanitizer (ASAN). Patch by Victor
     Stinner.

   - gh-110088(11): Fix test_asyncio timeouts: don't measure the maximum
     duration, a test should not measure a CI performance.  Only measure
     the minimum duration when a task has a timeout or delay.  Add
     ‘CLOCK_RES’ to ‘test_asyncio.utils’.  Patch by Victor Stinner.

   - gh-109974(12): Fix race conditions in test_threading lock tests.
     Wait until a condition is met rather than using *note time.sleep():
     8ac. with a hardcoded number of seconds.  Patch by Victor Stinner.

   - gh-110033(13): Fix ‘test_interprocess_signal()’ of ‘test_signal’.
     Make sure that the ‘subprocess.Popen’ object is deleted before the
     test raising an exception in a signal handler.  Otherwise,
     ‘Popen.__del__()’ can get the exception which is logged as
     ‘Exception ignored in: ...’ and the test fails.  Patch by Victor
     Stinner.

   - gh-109594(14): Fix test_timeout() of
     test_concurrent_futures.test_wait.  Remove the future which may or
     may not complete depending if it takes longer than the timeout or
     not.  Keep the second future which does not complete before wait()
     timeout.  Patch by Victor Stinner.

   - gh-109972(15): Split test_gdb.py file into a test_gdb package made
     of multiple tests, so tests can now be run in parallel.  Patch by
     Victor Stinner.

   - gh-109566(16): regrtest: When ‘--fast-ci’ or ‘--slow-ci’ option is
     used, regrtest now replaces the current process with a new process
     to add ‘-u -W default -bb -E’ options to Python.  Patch by Victor
     Stinner.

   - gh-109748(17): Fix ‘test_zippath_from_non_installed_posix()’ of
     test_venv: don't copy ‘__pycache__/’ sub-directories, because they
     can be modified by other Python tests running in parallel.  Patch
     by Victor Stinner.

   - gh-109739(18): regrtest: Fix reference leak check on Windows.
     Disable the load tracker on Windows in the reference leak check
     mode (-R option).  Patch by Victor Stinner.

   - gh-109276(19): regrtest: When a test fails with "env changed" and
     the -rerun option is used, the test is now re-run in verbose mode
     in a fresh process.  Patch by Victor Stinner.

   - gh-103053(20): Skip test_freeze_simple_script() of
     test_tools.test_freeze if Python is built with ‘./configure
     --enable-optimizations’, which means with Profile Guided
     Optimization (PGO): it just makes the test too slow.  The freeze
     tool is tested by many other CIs with other (faster) compiler
     flags.  Patch by Victor Stinner.

   - gh-109580(21): Skip ‘test_perf_profiler’ if Python is built with
     ASAN, MSAN or UBSAN sanitizer.  Python does crash randomly in this
     test on such build.  Patch by Victor Stinner.

   - gh-109566(22): regrtest: Add ‘--fast-ci’ and ‘--slow-ci’ options.
     ‘--fast-ci’ uses a default timeout of 10 minutes and ‘-u all,-cpu’
     (skip slowest tests).  ‘--slow-ci’ uses a default timeout of 20
     minutes and ‘-u all’ (run all tests).  Patch by Victor Stinner.

   - gh-109425(23): libregrtest now decodes stdout of test worker
     processes with the "backslashreplace" error handler to log
     corrupted stdout, instead of failing with an error and not logging
     the stdout.  Patch by Victor Stinner.

   - gh-109396(24): Fix ‘test_socket.test_hmac_sha1()’ in FIPS mode.
     Use a longer key: FIPS mode requires at least of at least 112 bits.
     The previous key was only 32 bits.  Patch by Victor Stinner.

   - gh-104736(25): Fix test_gdb on Python built with LLVM clang 16 on
     Linux ppc64le (ex: Fedora 38).  Search patterns in gdb "bt" command
     output to detect when gdb fails to retrieve the traceback.  For
     example, skip a test if ‘Backtrace stopped: frame did not save the
     PC’ is found.  Patch by Victor Stinner.

   - gh-109276(26): libregrtest now calls *note random.seed(): 148b.
     before running each test file when ‘-r/--randomize’ command line
     option is used.  Moreover, it's also called in worker processes.
     It should help to make tests more deterministic.  Previously, it
     was only called once in the main process before running all test
     files and it was not called in worker processes.  Patch by Victor
     Stinner.

   - gh-109276(27): libregrtest now uses a separated file descriptor to
     write test result as JSON. Previously, if a test wrote debug
     messages late around the JSON, the main test process failed to
     parse JSON. Patch by Victor Stinner.

   - gh-108996(28): Fix and enable ‘test_msvcrt’.

   - gh-109237(29): Fix ‘test_site.test_underpth_basic()’ when the
     working directory contains at least one non-ASCII character: encode
     the ‘._pth’ file to UTF-8 and enable the UTF-8 Mode to use UTF-8
     for the child process stdout.  Patch by Victor Stinner.

   - gh-109230(30): Fix ‘test_pyexpat.test_exception()’: it can now be
     run from a directory different than Python source code directory.
     Before, the test failed in this case.  Skip the test if
     Modules/pyexpat.c source is not available.  Skip also the test on
     Python implementations other than CPython.  Patch by Victor
     Stinner.

   - gh-108996(31): Add tests for ‘msvcrt’.

   - gh-109015(32): Fix test_asyncio, test_imaplib and test_socket tests
     on FreeBSD if the TCP blackhole is enabled (‘sysctl
     net.inet.tcp.blackhole’).  Skip the few tests which failed with
     ‘ETIMEDOUT’ which such non standard configuration.  Currently, the
     FreeBSD GCP image enables TCP and UDP blackhole(33) (‘sysctl
     net.inet.tcp.blackhole=2’ and ‘sysctl net.inet.udp.blackhole=1’).
     Patch by Victor Stinner.

   - gh-91960(34): Skip ‘test_gdb’ if gdb is unable to retrieve Python
     frame objects: if a frame is ‘<optimized out>’.  When Python is
     built with "clang -Og", gdb can fail to retrieve the 'frame'
     parameter of ‘_PyEval_EvalFrameDefault()’.  In this case, tests
     like ‘py_bt()’ are likely to fail.  Without getting access to
     Python frames, ‘python-gdb.py’ is mostly clueless on retrieving the
     Python traceback.  Moreover, ‘test_gdb’ is no longer skipped on
     macOS if Python is built with Clang.  Patch by Victor Stinner.

   - gh-108962(35): Skip ‘test_tempfile.test_flags()’ if ‘chflags()’
     fails with "OSError: [Errno 45] Operation not supported" (ex: on
     FreeBSD 13).  Patch by Victor Stinner.

   - gh-91960(36): FreeBSD 13.2 CI coverage for pull requests is now
     provided by Cirrus-CI (a hosted CI service that supports Linux,
     macOS, Windows, and FreeBSD).

   - gh-89392(37): Removed support of ‘test_main()’ function in tests.
     They now always use normal unittest test runner.

   - gh-108851(38): Fix ‘test_tomllib’ recursion tests for WASI
     buildbots: reduce the recursion limit and compute the maximum
     nested array/dict depending on the current available recursion
     limit.  Patch by Victor Stinner.

   - gh-108851(39): Add ‘get_recursion_available()’ and
     ‘get_recursion_depth()’ functions to the *note test.support: ea.
     module.  Patch by Victor Stinner.

   - gh-108834(40): Add ‘--fail-rerun option’ option to regrtest: if a
     test failed when then passed when rerun in verbose mode, exit the
     process with exit code 2 (error), instead of exit code 0 (success).
     Patch by Victor Stinner.

   - gh-108834(41): Rename regrtest ‘--verbose2’ option (‘-w’) to
     ‘--rerun’.  Keep ‘--verbose2’ as a deprecated alias.  Patch by
     Victor Stinner.

   - gh-108834(42): When regrtest reruns failed tests in verbose mode
     (‘./python -m test --rerun’), tests are now rerun in fresh worker
     processes rather than being executed in the main process.  If a
     test does crash or is killed by a timeout, the main process can
     detect and handle the killed worker process.  Tests are rerun in
     parallel if the ‘-jN’ option is used to run tests in parallel.
     Patch by Victor Stinner.

   - gh-108822(43): ‘regrtest’ now computes statistics on all tests:
     successes, failures and skipped.  ‘test_netrc’,
     ‘test_pep646_syntax’ and ‘test_xml_etree’ now return results in
     their ‘test_main()’ function.  Patch by Victor Stinner and Alex
     Waygood.

   - gh-108794(44): The *note doctest.DocTestRunner.run(): 4ee. method
     now counts the number of skipped tests.  Add *note
     doctest.DocTestRunner.skips: 4ef. and *note
     doctest.TestResults.skipped: 4f0. attributes.  Patch by Victor
     Stinner.

   - gh-108388(45): Convert test_concurrent_futures to a package of 7
     sub-tests.  Patch by Victor Stinner.

   - gh-108388(46): Split test_multiprocessing_fork,
     test_multiprocessing_forkserver and test_multiprocessing_spawn into
     test packages.  Each package is made of 4 sub-tests: processes,
     threads, manager and misc.  It allows running more tests in
     parallel and so reduce the total test duration.  Patch by Victor
     Stinner.

   - gh-105776(47): Fix test_cppext when the C compiler command
     ‘-std=c11’ option: remove ‘-std=’ options from the compiler
     command.  Patch by Victor Stinner.

   - gh-107652(48): Set up CIFuzz to run fuzz targets in GitHub Actions.
     Patch by Illia Volochii.

   - gh-107237(49): ‘test_logging’: Fix ‘test_udp_reconnection()’ by
     increasing the timeout from 100 ms to 5 minutes (LONG_TIMEOUT).
     Patch by Victor Stinner.

   - gh-107178(50): Add the C API test for functions in the Mapping
     Protocol, the Sequence Protocol and some functions in the Object
     Protocol.

   - gh-106714(51): test_capi: Fix test_no_FatalError_infinite_loop() to
     no longer write a coredump, by using
     test.support.SuppressCrashReport.  Patch by Victor Stinner.

   - gh-104090(52): Avoid creating a reference to the test object in
     *note collectedDurations(): 1a7c.

   - gh-106752(53): Moved tests for ‘zipfile.Path’ into
     ‘Lib/test/test_zipfile/_path’.  Made ‘zipfile._path’ a package.

   - gh-106690(54): Add .coveragerc to cpython repository for use with
     coverage package.

   - gh-101634(55): When running the Python test suite with ‘-jN’
     option, if a worker stdout cannot be decoded from the locale
     encoding report a failed testn so the exitcode is non-zero.  Patch
     by Victor Stinner.

   - gh-105084(56): When the Python build is configured
     ‘--with-wheel-pkg-dir’, tests requiring the ‘setuptools’ and
     ‘wheel’ wheels will search for the wheels in ‘WHEEL_PKG_DIR’.

   - gh-81005(57): String tests are modified to reflect that ‘str’ and
     ‘unicode’ are merged in Python 3.  Patch by Daniel Fortunov.

   - gh-103186(58): Suppress and assert expected RuntimeWarnings in
     test_sys_settrace.py

   - gh-69714(59): Add additional tests to *note calendar: 15. to
     achieve full test coverage.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/110647

   (2) https://github.com/python/cpython/issues/103053

   (3) https://github.com/python/cpython/issues/110167

   (4) https://github.com/python/cpython/issues/110388

   (5) https://github.com/python/cpython/issues/81002

   (6) https://github.com/python/cpython/issues/110367

   (7) https://github.com/python/cpython/issues/110267

   (8) https://github.com/python/cpython/issues/110171

   (9) https://github.com/python/cpython/issues/110152

   (10) https://github.com/python/cpython/issues/110031

   (11) https://github.com/python/cpython/issues/110088

   (12) https://github.com/python/cpython/issues/109974

   (13) https://github.com/python/cpython/issues/110033

   (14) https://github.com/python/cpython/issues/109594

   (15) https://github.com/python/cpython/issues/109972

   (16) https://github.com/python/cpython/issues/109566

   (17) https://github.com/python/cpython/issues/109748

   (18) https://github.com/python/cpython/issues/109739

   (19) https://github.com/python/cpython/issues/109276

   (20) https://github.com/python/cpython/issues/103053

   (21) https://github.com/python/cpython/issues/109580

   (22) https://github.com/python/cpython/issues/109566

   (23) https://github.com/python/cpython/issues/109425

   (24) https://github.com/python/cpython/issues/109396

   (25) https://github.com/python/cpython/issues/104736

   (26) https://github.com/python/cpython/issues/109276

   (27) https://github.com/python/cpython/issues/109276

   (28) https://github.com/python/cpython/issues/108996

   (29) https://github.com/python/cpython/issues/109237

   (30) https://github.com/python/cpython/issues/109230

   (31) https://github.com/python/cpython/issues/108996

   (32) https://github.com/python/cpython/issues/109015

   (33) https://reviews.freebsd.org/D41751

   (34) https://github.com/python/cpython/issues/91960

   (35) https://github.com/python/cpython/issues/108962

   (36) https://github.com/python/cpython/issues/91960

   (37) https://github.com/python/cpython/issues/89392

   (38) https://github.com/python/cpython/issues/108851

   (39) https://github.com/python/cpython/issues/108851

   (40) https://github.com/python/cpython/issues/108834

   (41) https://github.com/python/cpython/issues/108834

   (42) https://github.com/python/cpython/issues/108834

   (43) https://github.com/python/cpython/issues/108822

   (44) https://github.com/python/cpython/issues/108794

   (45) https://github.com/python/cpython/issues/108388

   (46) https://github.com/python/cpython/issues/108388

   (47) https://github.com/python/cpython/issues/105776

   (48) https://github.com/python/cpython/issues/107652

   (49) https://github.com/python/cpython/issues/107237

   (50) https://github.com/python/cpython/issues/107178

   (51) https://github.com/python/cpython/issues/106714

   (52) https://github.com/python/cpython/issues/104090

   (53) https://github.com/python/cpython/issues/106752

   (54) https://github.com/python/cpython/issues/106690

   (55) https://github.com/python/cpython/issues/101634

   (56) https://github.com/python/cpython/issues/105084

   (57) https://github.com/python/cpython/issues/81005

   (58) https://github.com/python/cpython/issues/103186

   (59) https://github.com/python/cpython/issues/69714


File: python.info,  Node: ビルド<22>,  Next: Windows<21>,  Prev: テスト<19>,  Up: Python 3 13 0 alpha 1

1.24.26.6 ビルド
................

   - gh-103053(1): "make check-clean-src" now also checks if the
     "python" program is found in the source directory: fail with an
     error if it does exist.  Patch by Victor Stinner.

   - gh-109191(2): Fix compile error when building with recent versions
     of libedit.

   - gh-110276(3): No longer ignore *note PROFILE_TASK: 1a7e. failure
     silently: command used by Profile Guided Optimization (PGO). Patch
     by Victor Stinner.

   - gh-109566(4): Remove ‘make testall’ target: use ‘make buildbottest’
     instead.  Patch by Victor Stinner.

   - gh-109740(5): The experimental ‘--disable-gil’ configure flag now
     includes "t" (for "threaded") in extension ABI tags.

   - gh-109054(6): Fix building the ‘_testcapi’ extension on Linux
     AArch64 which requires linking to libatomic when
     ‘<cpython/pyatomic.h>’ is used: the ‘_Py_atomic_or_uint64()’
     function requires libatomic ‘__atomic_fetch_or_8()’ on this
     platform.  The configure script now checks if linking to libatomic
     is needed and generates a new LIBATOMIC variable used to build the
     _testcapi extension.  Patch by Victor Stinner.

   - gh-63760(7): Fix Solaris build: no longer redefine the
     ‘gethostname()’ function.  Solaris defines the function since 2005.
     Patch by Victor Stinner, original patch by Jakub Kulík.

   - gh-108740(8): Fix a race condition in ‘make regen-all’.  The
     ‘deepfreeze.c’ source and files generated by Argument Clinic are
     now generated or updated before generating "global objects".
     Previously, some identifiers may miss depending on the order in
     which these files were generated.  Patch by Victor Stinner.

   - gh-108634(9): Python built with ‘configure’ *note -with-trace-refs:
     636. (tracing references) is now ABI compatible with Python release
     build and *note debug build: 509.  Patch by Victor Stinner.

   - gh-85283(10): The ‘_stat’ C extension is now built with the *note
     limited C API: 637.  Patch by Victor Stinner.

   - gh-108447(11): Fix x86_64 GNU/Hurd build

   - gh-107814(12): When calling ‘find_python.bat’ with ‘-q’ it did not
     properly silence the output of nuget.  That is now fixed.

   - gh-105481(13): Remove the make target ‘regen-opcode-targets’, merge
     its work into ‘regen-opcode’ which repeats most of the calculation.
     This simplifies the code for the build and reduces code
     duplication.

   - gh-106881(14): Check for ‘linux/limits.h’ before including it in
     ‘Modules/posixmodule.c’.

   - gh-95855(15): Refactor platform triplet detection code and add
     detection for MIPS soft float and musl libc.

   - gh-106962(16): Detect MPI compilers in ‘configure’.

   - gh-106118(17): Fix compilation for platforms without ‘O_CLOEXEC’.
     The issue was introduced with Python 3.12b1 in gh-103295(18).
     Patch by Erlend Aasland.

   - gh-105875(19): SQLite 3.15.2 or newer is required to build the
     *note sqlite3: d4. extension module.  Patch by Erlend Aasland.

   - gh-90005(20): Fix a regression in ‘configure’ where we could end up
     unintentionally linking with ‘libbsd’.

   - gh-102404(21): Document how to perform a WASI build on Linux.  Also
     add Tools/wasm/build_wasi.sh as a reference implementation of the
     docs.

   - gh-89886(22): Autoconf 2.71 and aclocal 1.16.4 is now required to
     regenerate ‘configure’.

   - gh-104692(23): Include ‘commoninstall’ as a prerequisite for
     ‘bininstall’

     This ensures that ‘commoninstall’ is completed before ‘bininstall’
     is started when parallel builds are used (‘make -j install’), and
     so the ‘python3’ symlink is only installed after all standard
     library modules are installed.

   - gh-101538(24): Add experimental wasi-threads support.  Patch by
     Takashi Yamamoto.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/103053

   (2) https://github.com/python/cpython/issues/109191

   (3) https://github.com/python/cpython/issues/110276

   (4) https://github.com/python/cpython/issues/109566

   (5) https://github.com/python/cpython/issues/109740

   (6) https://github.com/python/cpython/issues/109054

   (7) https://github.com/python/cpython/issues/63760

   (8) https://github.com/python/cpython/issues/108740

   (9) https://github.com/python/cpython/issues/108634

   (10) https://github.com/python/cpython/issues/85283

   (11) https://github.com/python/cpython/issues/108447

   (12) https://github.com/python/cpython/issues/107814

   (13) https://github.com/python/cpython/issues/105481

   (14) https://github.com/python/cpython/issues/106881

   (15) https://github.com/python/cpython/issues/95855

   (16) https://github.com/python/cpython/issues/106962

   (17) https://github.com/python/cpython/issues/106118

   (18) https://github.com/python/cpython/issues/103295

   (19) https://github.com/python/cpython/issues/105875

   (20) https://github.com/python/cpython/issues/90005

   (21) https://github.com/python/cpython/issues/102404

   (22) https://github.com/python/cpython/issues/89886

   (23) https://github.com/python/cpython/issues/104692

   (24) https://github.com/python/cpython/issues/101538


File: python.info,  Node: Windows<21>,  Next: macOS<14>,  Prev: ビルド<22>,  Up: Python 3 13 0 alpha 1

1.24.26.7 Windows
.................

   - gh-110437(1): Allows overriding the source of VC redistributables
     so that releases can be guaranteed to never downgrade between
     updates.

   - gh-109286(2): Update Windows installer to use SQLite 3.43.1.

   - gh-82367(3): *note os.path.realpath(): 262. now resolves MS-DOS
     style file names even if the file is not accessible.  Patch by
     Moonsik Park.

   - gh-109991(4): Update Windows build to use OpenSSL 3.0.11.

   - gh-106242(5): Fixes *note realpath(): 262. to behave consistently
     when passed a path containing an embedded null character on
     Windows.  In strict mode, it now raises *note OSError: 2c0. instead
     of the unexpected *note ValueError: 2ec, and in non-strict mode
     will make the path absolute.

   - gh-83180(6): Changes the *note Python install manager: 7da. to
     prefer an active virtual environment when the launched script has a
     shebang line using a Unix-like virtual command, even if the command
     requests a specific version of Python.

   - gh-106844(7): Fix integer overflow and truncating by the null
     character in ‘_winapi.LCMapStringEx()’ which affects
     ‘ntpath.normcase()’.

   - gh-105436(8): Ensure that an empty environment block is terminated
     by two null characters, as is required by Windows.

   - gh-105146(9): Updated the links at the end of the installer to
     point to Discourse rather than the mailing lists.

   - gh-103646(10): When installed from the Microsoft Store, ‘pip’ no
     longer defaults to per-user installs.  However, as the install
     directory is unwritable, it should automatically decide to do a
     per-user install anyway.  This should resolve issues when ‘pip’ is
     passed an option that conflicts with ‘--user’.

   - gh-88745(11): Improve performance of *note shutil.copy2(): c50. by
     using the operating system's ‘CopyFile2’ function.  This may result
     in subtle changes to metadata copied along with some files,
     bringing them in line with normal OS behavior.

   - gh-104820(12): Fixes *note stat(): 26d. and related functions on
     file systems that do not support file ID requests.  This includes
     FAT32 and exFAT.

   - gh-104803(13): Add *note os.path.isdevdrive(): 19c2. to detect
     whether a path is on a Windows Dev Drive.  Returns ‘False’ on
     platforms that do not support Dev Drive, and is absent on
     non-Windows platforms.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/110437

   (2) https://github.com/python/cpython/issues/109286

   (3) https://github.com/python/cpython/issues/82367

   (4) https://github.com/python/cpython/issues/109991

   (5) https://github.com/python/cpython/issues/106242

   (6) https://github.com/python/cpython/issues/83180

   (7) https://github.com/python/cpython/issues/106844

   (8) https://github.com/python/cpython/issues/105436

   (9) https://github.com/python/cpython/issues/105146

   (10) https://github.com/python/cpython/issues/103646

   (11) https://github.com/python/cpython/issues/88745

   (12) https://github.com/python/cpython/issues/104820

   (13) https://github.com/python/cpython/issues/104803


File: python.info,  Node: macOS<14>,  Next: IDLE<13>,  Prev: Windows<21>,  Up: Python 3 13 0 alpha 1

1.24.26.8 macOS
...............

   - gh-109286(1): Update macOS installer to use SQLite 3.43.1.

   - gh-109991(2): Update macOS installer to use OpenSSL 3.0.11.

   - gh-99079(3): Update macOS installer to use OpenSSL 3.0.9.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/109286

   (2) https://github.com/python/cpython/issues/109991

   (3) https://github.com/python/cpython/issues/99079


File: python.info,  Node: IDLE<13>,  Next: Tools/Demos<19>,  Prev: macOS<14>,  Up: Python 3 13 0 alpha 1

1.24.26.9 IDLE
..............

   - gh-104719(1): Remove IDLE's modification of tokenize.tabsize and
     test other uses of tokenize data and methods.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104719


File: python.info,  Node: Tools/Demos<19>,  Next: C API<22>,  Prev: IDLE<13>,  Up: Python 3 13 0 alpha 1

1.24.26.10 Tools/Demos
......................

   - gh-109991(1): Update GitHub CI workflows to use OpenSSL 3.0.11 and
     multissltests to use 1.1.1w, 3.0.11, and 3.1.3.

   - gh-108494(2): Argument Clinic(3) now has a partial support of the
     *note Limited API: 637.: see documentation in the Python
     Developer's Guide(4) Patch by Victor Stinner.

   - gh-107704(5): It is now possible to deprecate passing keyword
     arguments for keyword-or-positional parameters with Argument
     Clinic, using the new ‘/ [from X.Y]’ syntax.  (To be read as
     '"positional-only from Python version X.Y"'.) See documentation in
     the Python Developer's Guide(6) for more information.

   - gh-107880(7): Argument Clinic can now clone ‘__init__()’ and
     ‘__new__()’ methods.

   - gh-104683(8): Add ‘--exclude’ option to Argument Clinic CLI.

   - gh-95065(9): Argument Clinic now supports overriding automatically
     generated signature by using directive ‘@text_signature’.  See
     documentation in the Python Developer's Guide(10)

   - gh-107609(11): Fix duplicate module check in Argument Clinic.
     Previously, a duplicate definition would incorrectly be silently
     accepted.  Patch by Erlend E. Aasland.

   - gh-107467(12): The Argument Clinic command-line tool now prints to
     stderr instead of stdout on failure.

   - gh-106970(13): Fix bugs in the Argument Clinic ‘destination <name>
     clear’ command; the destination buffers would never be cleared, and
     the ‘destination’ directive parser would simply continue to the
     fault handler after processing the command.  Patch by Erlend E.
     Aasland.

   - gh-106706(14): Change bytecode syntax for families to remove
     redundant name matching pseudo syntax.

   - gh-106359(15): Argument Clinic now explicitly forbids "kwarg
     splats" in function calls used as annotations.

   - gh-103186(16): ‘freeze’ now fetches ‘CONFIG_ARGS’ from the original
     CPython instance the Makefile uses to call utility scripts.  Patch
     by Ijtaba Hussain.

   - gh-95065(17): It is now possible to deprecate passing parameters
     positionally with Argument Clinic, using the new ‘* [from X.Y]’
     syntax.  (To be read as '"keyword-only from Python version X.Y"'.)
     See documentation in the Python Developer's Guide(18) for more
     information.  Patch by Erlend E. Aasland with help from Alex
     Waygood, Nikita Sobolev, and Serhiy Storchaka.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/109991

   (2) https://github.com/python/cpython/issues/108494

   (3) https://devguide.python.org/development-tools/clinic/

   (4) 
https://devguide.python.org/development-tools/clinic/#clinic-howto-limited-capi

   (5) https://github.com/python/cpython/issues/107704

   (6) 
https://devguide.python.org/development-tools/clinic/#clinic-howto-deprecate-keyword

   (7) https://github.com/python/cpython/issues/107880

   (8) https://github.com/python/cpython/issues/104683

   (9) https://github.com/python/cpython/issues/95065

   (10) 
https://devguide.python.org/development-tools/clinic/#clinic-howto-override-signature

   (11) https://github.com/python/cpython/issues/107609

   (12) https://github.com/python/cpython/issues/107467

   (13) https://github.com/python/cpython/issues/106970

   (14) https://github.com/python/cpython/issues/106706

   (15) https://github.com/python/cpython/issues/106359

   (16) https://github.com/python/cpython/issues/103186

   (17) https://github.com/python/cpython/issues/95065

   (18) 
https://devguide.python.org/development-tools/clinic/#clinic-howto-deprecate-positional


File: python.info,  Node: C API<22>,  Prev: Tools/Demos<19>,  Up: Python 3 13 0 alpha 1

1.24.26.11 C API
................

   - gh-85283(1): If the *note Py_LIMITED_API: 660. macro is defined,
     ‘Py_BUILD_CORE’, ‘Py_BUILD_CORE_BUILTIN’ and ‘Py_BUILD_CORE_MODULE’
     macros are now undefined by ‘<Python.h>’.  Patch by Victor Stinner.

   - gh-110289(2): Add *note PyUnicode_EqualToUTF8AndSize(): 619. and
     *note PyUnicode_EqualToUTF8(): 61a. functions.

   - gh-110235(3): Raise *note TypeError: 198. for duplicate/unknown
     fields in ‘PyStructSequence’ constructor.  Patched by Xuehai Pan.

   - gh-110014(4): Remove undocumented ‘PY_TIMEOUT_MAX’ constant from
     the limited C API. Patch by Victor Stinner.

   - gh-109521(5): *note PyImport_GetImporter(): 1a84. now sets
     RuntimeError if it fails to get *note sys.path_hooks: 1225. or
     *note sys.path_importer_cache: 7fa. or they are not list and dict
     correspondingly.  Previously it could return NULL without setting
     error in obscure cases, crash or raise SystemError if these
     attributes have wrong type.

   - gh-108724(6): Add *note PyMutex: 484. internal-only lightweight
     locking API.

   - gh-85283(7): Add *note PySys_AuditTuple(): 612. function: similar
     to *note PySys_Audit(): 613, but pass event arguments as a Python
     *note tuple: 614. object.  Patch by Victor Stinner.

   - gh-108867(8): Add *note PyThreadState_GetUnchecked(): 423.
     function: similar to *note PyThreadState_Get(): 615, but don't kill
     the process with a fatal error if it is NULL. The caller is
     responsible to check if the result is NULL. Previously, the
     function was private and known as ‘_PyThreadState_UncheckedGet()’.
     Patch by Victor Stinner.

   - gh-108765(9): ‘Python.h’ no longer includes the ‘<ctype.h>’
     standard header file.  If needed, it should now be included
     explicitly.  For example, it provides ‘isalpha()’ and ‘tolower()’
     functions which are locale dependent.  Python provides locale
     independent functions, like ‘Py_ISALPHA()’ and ‘Py_TOLOWER()’.
     Patch by Victor Stinner.

   - gh-108765(10): ‘Python.h’ no longer includes the ‘<unistd.h>’
     standard header file.  If needed, it should now be included
     explicitly.  For example, it provides the functions: ‘close()’,
     ‘getpagesize()’, ‘getpid()’ and ‘sysconf()’.  Patch by Victor
     Stinner.

   - gh-108765(11): ‘Python.h’ no longer includes the ‘<ieeefp.h>’
     standard header.  It was included for the ‘finite()’ function which
     is now provided by the ‘<math.h>’ header.  It should now be
     included explicitly if needed.  Remove also the ‘HAVE_IEEEFP_H’
     macro.  Patch by Victor Stinner.

   - gh-108765(12): ‘Python.h’ no longer includes these standard header
     files: ‘<time.h>’, ‘<sys/select.h>’ and ‘<sys/time.h>’.  If needed,
     they should now be included explicitly.  For example, ‘<time.h>’
     provides the ‘clock()’ and ‘gmtime()’ functions, ‘<sys/select.h>’
     provides the ‘select()’ function, and ‘<sys/time.h>’ provides the
     ‘futimes()’, ‘gettimeofday()’ and ‘setitimer()’ functions.  Patch
     by Victor Stinner.

   - gh-108511(13): Add functions *note PyObject_HasAttrWithError():
     61b, *note PyObject_HasAttrStringWithError(): 61d, *note
     PyMapping_HasKeyWithError(): 61f. and *note
     PyMapping_HasKeyStringWithError(): 621.

   - gh-107073(14): Add *note PyObject_VisitManagedDict(): 60d. and
     *note PyObject_ClearManagedDict(): 60e. functions which must be
     called by the traverse and clear functions of a type using *note
     Py_TPFLAGS_MANAGED_DICT: 60f. flag.  Patch by Victor Stinner.

   - gh-108634(15): Python built with ‘configure’ *note
     -with-trace-refs: 636. (tracing references) now supports the *note
     Limited API: 637.  Patch by Victor Stinner.

   - gh-108014(16): Add *note PyLong_AsInt(): 604. function: similar to
     *note PyLong_AsLong(): 605, but store the result in a C int instead
     of a C long.  Previously, it was known as the private function
     ‘_PyLong_AsInt()’ (with an underscore prefix).  Patch by Victor
     Stinner.

   - gh-108314(17): Add *note PyDict_ContainsString(): 5dd. function:
     same as *note PyDict_Contains(): 5de, but 'key' is specified as a
     const char* UTF-8 encoded bytes string, rather than a *note
     PyObject: 5df.*.  Patch by Victor Stinner.

   - gh-108337(18): Add atomic operations on additional data types in
     pyatomic.h.

   - gh-108014(19): Add *note Py_IsFinalizing(): 5fd. function: check if
     the main Python interpreter is *note shutting down: 479.  Patch by
     Victor Stinner.

   - gh-107916(20): C API functions *note
     PyErr_SetFromErrnoWithFilename(): 1a85, *note
     PyErr_SetExcFromWindowsErrWithFilename(): 1a86. and *note
     PyErr_SetFromWindowsErrWithFilename(): 1a87. save now the error
     code before calling *note PyUnicode_DecodeFSDefault(): 1a88.

   - gh-107915(21): Such C API functions as ‘PyErr_SetString()’,
     ‘PyErr_Format()’, ‘PyErr_SetFromErrnoWithFilename()’ and many
     others no longer crash or ignore errors if it failed to format the
     error message or decode the filename.  Instead, they keep a
     corresponding error.

   - gh-107810(22): Improve *note DeprecationWarning: 1a3. for uses of
     *note PyType_Spec: 1a89. with metaclasses that have custom
     ‘tp_new’.

   - gh-107249(23): Implement the *note Py_UNUSED: 1a8a. macro for
     Windows MSVC compiler.  Patch by Victor Stinner.

   - gh-107226(24): *note PyModule_AddObjectRef(): 60a. is now only
     available in the limited API version 3.10 or later.

   - gh-106320(25): Remove private ‘_PyUnicode_AsString()’ alias to
     *note PyUnicode_AsUTF8(): 424.  It was kept for backward
     compatibility with Python 3.0 - 3.2.  The *note PyUnicode_AsUTF8():
     424. is available since Python 3.3.  The *note
     PyUnicode_AsUTF8String(): 13a6. function can be used to keep
     compatibility with Python 3.2 and older.  Patch by Victor Stinner.

   - gh-106572(26): Convert *note PyObject_DelAttr(): 1831. and *note
     PyObject_DelAttrString(): 1832. macros to functions.  Patch by
     Victor Stinner.

   - gh-106307(27): Add *note PyMapping_GetOptionalItem(): 5e8.
     function.

   - gh-106521(28): Add *note PyObject_GetOptionalAttr(): 5ec. and *note
     PyObject_GetOptionalAttrString(): 5ed. functions.

   - gh-106320(29): Remove ‘_PyInterpreterState_Get()’ alias to *note
     PyInterpreterState_Get(): 64c. which was kept for backward
     compatibility with Python 3.8.  Patch by Victor Stinner.

   - gh-106316(30): Remove ‘cpython/pytime.h’ header file: it only
     contained private functions.  Patch by Victor Stinner.

   - gh-106023(31): Remove private ‘_PyObject_FastCall()’ function: use
     ‘PyObject_Vectorcall()’ which is available since Python 3.8 ( PEP
     590(32)).  Patch by Victor Stinner.

   - gh-106168(33): If Python is built in *note debug mode: 509. or
     *note with assertions: 62d, *note PyTuple_SET_ITEM(): 62e. and
     *note PyList_SET_ITEM(): 62f. now check the index argument with an
     assertion.  If the assertion fails, make sure that the size is set
     before.  Patch by Victor Stinner.

   - gh-106084(34): Remove the old aliases to functions calling
     functions which were kept for backward compatibility with Python
     3.8 provisional API:

        * ‘_PyObject_CallMethodNoArgs()’: use
          ‘PyObject_CallMethodNoArgs()’

        * ‘_PyObject_CallMethodOneArg()’: use
          ‘PyObject_CallMethodOneArg()’

        * ‘_PyObject_CallOneArg()’: use ‘PyObject_CallOneArg()’

        * ‘_PyObject_FastCallDict()’: use ‘PyObject_VectorcallDict()’

        * ‘_PyObject_Vectorcall()’: use ‘PyObject_Vectorcall()’

        * ‘_PyObject_VectorcallMethod()’: use
          ‘PyObject_VectorcallMethod()’

        * ‘_PyVectorcall_Function()’: use ‘PyVectorcall_Function()’

     Just remove the underscore prefix to update your code.  Patch by
     Victor Stinner.

   - gh-106004(35): Adds *note PyDict_GetItemRef(): 5e0. and *note
     PyDict_GetItemStringRef(): 421. functions: similar to *note
     PyDict_GetItemWithError(): 5e1. but returning a *note strong
     reference: 5e2. instead of a *note borrowed reference: 3d7.  Patch
     by Victor Stinner.

   - gh-105927(36): Deprecate the *note PyWeakref_GetObject(): 3dd. and
     *note PyWeakref_GET_OBJECT(): 3de. functions: use the new *note
     PyWeakref_GetRef(): 3df. function instead.  Patch by Victor
     Stinner.

   - gh-105927(37): Add *note PyWeakref_GetRef(): 3df. function: similar
     to *note PyWeakref_GetObject(): 3dd. but returns a *note strong
     reference: 5e2, or ‘NULL’ if the referent is no longer live.  Patch
     by Victor Stinner.

   - gh-105922(38): Add *note PyImport_AddModuleRef(): 5fb.: similar to
     *note PyImport_AddModule(): 5fc, but return a *note strong
     reference: 5e2. instead of a *note borrowed reference: 3d7.  Patch
     by Victor Stinner.

   - gh-105227(39): The new *note PyType_GetDict(): 1a8b. provides the
     dictionary for the given type object that is normally exposed by
     ‘cls.__dict__’.  Normally it's sufficient to use *note tp_dict:
     1a8c, but for the static builtin types ‘tp_dict’ is now always
     ‘NULL’.  ‘PyType_GetDict()’ provides the correct dict object
     instead.

   - gh-105375(40): Fix a bug in *note PyErr_WarnExplicit(): 1a8d. where
     an exception could end up being overwritten if the API failed
     internally.

   - gh-105603(41): We've renamed the new (in 3.12)
     ‘PyInterpreterConfig.own_gil’ to ‘PyInterpreterConfig.gil’ and
     changed the meaning of the value from "bool" to an integer with
     supported values of ‘PyInterpreterConfig_DEFAULT_GIL’,
     ‘PyInterpreterConfig_SHARED_GIL’, and
     ‘PyInterpreterConfig_OWN_GIL’.  The default is "shared".

   - gh-105387(42): In the limited C API version 3.12, *note
     Py_INCREF(): 78f. and *note Py_DECREF(): 790. functions are now
     implemented as opaque function calls to hide implementation
     details.  Patch by Victor Stinner.

   - gh-105396(43): Deprecate the *note PyImport_ImportModuleNoBlock():
     3db. function which is just an alias to *note
     PyImport_ImportModule(): 3dc. since Python 3.3.  Patch by Victor
     Stinner.

   - gh-103968(44): *note PyType_FromMetaclass(): 772. now allows
     metaclasses with ‘tp_new’ set to ‘NULL’.

   - gh-105268(45): Remove the old private, undocumented and untested
     ‘_PyGC_FINALIZED()’ macro which was kept for backward compatibility
     with Python 3.8 and older.  Patch by Victor Stinner.

   - gh-105182(46): Remove ‘PyEval_AcquireLock()’ and
     ‘PyEval_ReleaseLock()’ functions, deprecated in Python 3.2.  Patch
     by Victor Stinner.

   - gh-105182(47): Remove ‘PyEval_InitThreads()’ and
     ‘PyEval_ThreadsInitialized()’ functions, deprecated in Python 3.9.
     Patch by Victor Stinner.

   - gh-105145(48): Deprecate old Python initialization functions:

        * *note PySys_ResetWarnOptions(): 3f4.

        * *note Py_GetExecPrefix(): 3e9.

        * *note Py_GetPath(): 3e3.

        * *note Py_GetPrefix(): 3e5.

        * *note Py_GetProgramFullPath(): 3ec.

        * *note Py_GetProgramName(): 3ee.

        * *note Py_GetPythonHome(): 3ef.

     Patch by Victor Stinner.

   - gh-85275(49): ‘PyObject_AsCharBuffer()’, ‘PyObject_AsReadBuffer()’,
     ‘PyObject_CheckReadBuffer()’, and ‘PyObject_AsWriteBuffer()’ are
     removed.  Please migrate to new buffer protocol; *note
     PyObject_GetBuffer(): 63a. and *note PyBuffer_Release(): 63b.

   - gh-105156(50): Deprecate the old ‘Py_UNICODE’ and ‘PY_UNICODE_TYPE’
     types: use directly the ‘wchar_t’ type instead.  Since Python 3.3,
     ‘Py_UNICODE’ and ‘PY_UNICODE_TYPE’ are just aliases to ‘wchar_t’.
     Patch by Victor Stinner.

   - gh-105145(51): Remove the following old functions to configure the
     Python initialization, deprecated in Python 3.11:

        * ‘PySys_AddWarnOptionUnicode()’

        * ‘PySys_AddWarnOption()’

        * ‘PySys_AddXOption()’

        * ‘PySys_HasWarnOptions()’

        * ‘PySys_SetArgvEx()’

        * ‘PySys_SetArgv()’

        * ‘PySys_SetPath()’

        * ‘Py_SetPath()’

        * ‘Py_SetProgramName()’

        * ‘Py_SetPythonHome()’

        * ‘Py_SetStandardStreamEncoding()’

        * ‘_Py_SetProgramFullPath()’

     Patch by Victor Stinner.

   - gh-105107(52): Remove functions deprecated in Python 3.9.

        * ‘PyEval_CallObject()’, ‘PyEval_CallObjectWithKeywords()’: use
          *note PyObject_CallNoArgs(): 63c. and *note PyObject_Call():
          63d. (positional arguments must not be 'NULL') instead.

        * ‘PyEval_CallFunction()’: use *note PyObject_CallFunction():
          63f. instead.

        * ‘PyEval_CallMethod()’: use *note PyObject_CallMethod(): 640.
          instead.

        * ‘PyCFunction_Call()’: use *note PyObject_Call(): 63d. instead.

     Patch by Victor Stinner.

   - gh-105115(53): ‘PyTypeObject.tp_bases’ (and ‘tp_mro’) for builtin
     static types are now shared by all interpreters, whereas in
     3.12-beta1 they were stored on ‘PyInterpreterState’.  Also note
     that now the tuples are immortal objects.

   - gh-105071(54): Add ‘PyUnstable_Exc_PrepReraiseStar’ to the unstable
     C api to expose the implementation of *note except*: 1ac.

   - gh-104922(55): ‘PY_SSIZE_T_CLEAN’ is no longer required to use
     ‘'#'’ formats in APIs like *note PyArg_ParseTuple(): 3c1. and *note
     Py_BuildValue(): 3c2.  They uses ‘Py_ssize_t’ for ‘'#'’ regardless
     ‘PY_SSIZE_T_CLEAN’.

   - gh-104584(56): Add an unstable C API for hooking in an optimizer.
     This is mainly internal, but marked "unstable" to allow third-party
     experimentation.

   - gh-104668(57): Don't call *note PyOS_InputHook: 7a4. or *note
     PyOS_ReadlineFunctionPointer: 7a5. in subinterpreters, since it's
     generally difficult to avoid using global state in their registered
     callbacks.  This also avoids situations where extensions may find
     themselves running in a subinterpreter they don't support (or
     haven't yet been loaded in).

   - bpo-42327(58): Add *note PyModule_Add(): 609. function: similar to
     *note PyModule_AddObjectRef(): 60a. and *note PyModule_AddObject():
     60b, but always steals a reference to the value.

   - bpo-40309(59): Properly handle trailing spaces before closing
     parenthesis in *note Py_BuildValue(): 3c2. format strings.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/85283

   (2) https://github.com/python/cpython/issues/110289

   (3) https://github.com/python/cpython/issues/110235

   (4) https://github.com/python/cpython/issues/110014

   (5) https://github.com/python/cpython/issues/109521

   (6) https://github.com/python/cpython/issues/108724

   (7) https://github.com/python/cpython/issues/85283

   (8) https://github.com/python/cpython/issues/108867

   (9) https://github.com/python/cpython/issues/108765

   (10) https://github.com/python/cpython/issues/108765

   (11) https://github.com/python/cpython/issues/108765

   (12) https://github.com/python/cpython/issues/108765

   (13) https://github.com/python/cpython/issues/108511

   (14) https://github.com/python/cpython/issues/107073

   (15) https://github.com/python/cpython/issues/108634

   (16) https://github.com/python/cpython/issues/108014

   (17) https://github.com/python/cpython/issues/108314

   (18) https://github.com/python/cpython/issues/108337

   (19) https://github.com/python/cpython/issues/108014

   (20) https://github.com/python/cpython/issues/107916

   (21) https://github.com/python/cpython/issues/107915

   (22) https://github.com/python/cpython/issues/107810

   (23) https://github.com/python/cpython/issues/107249

   (24) https://github.com/python/cpython/issues/107226

   (25) https://github.com/python/cpython/issues/106320

   (26) https://github.com/python/cpython/issues/106572

   (27) https://github.com/python/cpython/issues/106307

   (28) https://github.com/python/cpython/issues/106521

   (29) https://github.com/python/cpython/issues/106320

   (30) https://github.com/python/cpython/issues/106316

   (31) https://github.com/python/cpython/issues/106023

   (32) https://peps.python.org/pep-0590/

   (33) https://github.com/python/cpython/issues/106168

   (34) https://github.com/python/cpython/issues/106084

   (35) https://github.com/python/cpython/issues/106004

   (36) https://github.com/python/cpython/issues/105927

   (37) https://github.com/python/cpython/issues/105927

   (38) https://github.com/python/cpython/issues/105922

   (39) https://github.com/python/cpython/issues/105227

   (40) https://github.com/python/cpython/issues/105375

   (41) https://github.com/python/cpython/issues/105603

   (42) https://github.com/python/cpython/issues/105387

   (43) https://github.com/python/cpython/issues/105396

   (44) https://github.com/python/cpython/issues/103968

   (45) https://github.com/python/cpython/issues/105268

   (46) https://github.com/python/cpython/issues/105182

   (47) https://github.com/python/cpython/issues/105182

   (48) https://github.com/python/cpython/issues/105145

   (49) https://github.com/python/cpython/issues/85275

   (50) https://github.com/python/cpython/issues/105156

   (51) https://github.com/python/cpython/issues/105145

   (52) https://github.com/python/cpython/issues/105107

   (53) https://github.com/python/cpython/issues/105115

   (54) https://github.com/python/cpython/issues/105071

   (55) https://github.com/python/cpython/issues/104922

   (56) https://github.com/python/cpython/issues/104584

   (57) https://github.com/python/cpython/issues/104668

   (58) https://bugs.python.org/issue?@action=redirect&bpo=42327

   (59) https://bugs.python.org/issue?@action=redirect&bpo=40309


File: python.info,  Node: Python 3 12 0 beta 1,  Next: Python 3 12 0 alpha 7,  Prev: Python 3 13 0 alpha 1,  Up: 変更履歴

1.24.27 Python 3.12.0 beta 1
----------------------------

'Release date: 2023-05-22'

* Menu:

* セキュリティ: セキュリティ<22>.
* ライブラリ: ライブラリ<65>.
* Core and Builtins: Core and Builtins<60>.
* ライブラリ: ライブラリ<66>.
* Core and Builtins: Core and Builtins<61>.
* ライブラリ: ライブラリ<67>.
* ドキュメント: ドキュメント<21>.
* テスト: テスト<20>.
* ビルド: ビルド<23>.
* Windows: Windows<22>.
* macOS: macOS<15>.
* IDLE: IDLE<14>.
* Tools/Demos: Tools/Demos<20>.
* C API: C API<23>.


File: python.info,  Node: セキュリティ<22>,  Next: ライブラリ<65>,  Up: Python 3 12 0 beta 1

1.24.27.1 セキュリティ
......................

   - gh-99889(1): Fixed a security in flaw in ‘uu.decode()’ that could
     allow for directory traversal based on the input if no ‘out_file’
     was specified.

   - gh-104049(2): Do not expose the local on-disk location in directory
     indexes produced by ‘http.client.SimpleHTTPRequestHandler’.

   - gh-99108(3): Upgrade built-in *note hashlib: 6c. SHA3
     implementation to a verified implementation from the ‘HACL*’
     project.  Used when OpenSSL is not present or lacks SHA3.

   - gh-102153(4): *note urllib.parse.urlsplit(): f3a. now strips
     leading C0 control and space characters following the specification
     for URLs defined by WHATWG in response to CVE 2023-24329(5).  Patch
     by Illia Volochii.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99889

   (2) https://github.com/python/cpython/issues/104049

   (3) https://github.com/python/cpython/issues/99108

   (4) https://github.com/python/cpython/issues/102153

   (5) https://www.cve.org/CVERecord?id=CVE-2023-24329


File: python.info,  Node: ライブラリ<65>,  Next: Core and Builtins<60>,  Prev: セキュリティ<22>,  Up: Python 3 12 0 beta 1

1.24.27.2 ライブラリ
....................

   - gh-102856(1): Implement PEP 701 changes in the *note tokenize: 101.
     module.  Patch by Marta Gómez Macías and Pablo Galindo Salgado

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102856


File: python.info,  Node: Core and Builtins<60>,  Next: ライブラリ<66>,  Prev: ライブラリ<65>,  Up: Python 3 12 0 beta 1

1.24.27.3 Core and Builtins
...........................

   - gh-104615(1): Fix wrong ordering of assignments in code like ‘a, a
     = x, y’.  Contributed by Carl Meyer.

   - gh-104572(2): Improve syntax error message for invalid constructs
     in PEP 695(3) contexts and in annotations when ‘from __future__
     import annotations’ is active.

   - gh-104482(4): Fix three error handling bugs in ast.c's validation
     of pattern matching statements.

   - gh-102818(5): Do not add a frame to the traceback in the
     ‘sys.setprofile’ and ‘sys.settrace’ trampoline functions.  This
     ensures that frames are not duplicated if an exception is raised in
     the callback function, and ensures that frames are not omitted if a
     C callback is used and that does not add the frame.

   - gh-104405(6): Fix an issue where some *note bytecode: 4aa.
     instructions could ignore PEP 523(7) when "inlining" calls.

   - gh-103082(8): Change behavior of ‘sys.monitoring.events.LINE’
     events in ‘sys.monitoring’: Line events now occur when a new line
     is reached dynamically, instead of using a static approximation, as
     before.  This makes the behavior very similar to that of "line"
     events in ‘sys.settrace’.  This should ease porting of tools from
     3.11 to 3.12.

   - gh-104263(9): Fix ‘float("nan")’ to produce a quiet NaN on
     platforms (like MIPS) where the meaning of the signalling / quiet
     bit is inverted from its usual meaning.  Also introduce a new macro
     ‘Py_INFINITY’ matching C99's ‘INFINITY’, and refactor internals to
     rely on C99's ‘NAN’ and ‘INFINITY’ macros instead of hard-coding
     bit patterns for infinities and NaNs.  Thanks Sebastian Berg.

   - gh-99113(10): Multi-phase init extension modules may now indicate
     that they support running in subinterpreters that have their own
     GIL. This is done by using ‘Py_MOD_PER_INTERPRETER_GIL_SUPPORTED’
     as the value for the ‘Py_mod_multiple_interpreters’ module def
     slot.  Otherwise the module, by default, cannot be imported in such
     subinterpreters.  (This does not affect the main interpreter or
     subinterpreters that do not have their own GIL.) In addition to the
     isolation that multi-phase init already normally requires, support
     for per-interpreter GIL involves one additional constraint:
     thread-safety.  If the module has external (linked) dependencies
     and those libraries have any state that isn't thread-safe then the
     module must do the additional work to add thread-safety.  This
     should be an uncommon case.

   - gh-99113(11): The GIL is now (optionally) per-interpreter.  This is
     the fundamental change for PEP 684.  This is all made possible by
     virtue of the isolated state of each interpreter in the process.
     The behavior of the main interpreter remains unchanged.  Likewise,
     interpreters created using ‘Py_NewInterpreter()’ are not affected.
     To get an interpreter with its own GIL, call
     ‘Py_NewInterpreterFromConfig()’.

   - gh-104108(12): Multi-phase init extension modules may now indicate
     whether or not they actually support multiple interpreters.  By
     default such modules are expected to support use in multiple
     interpreters.  In the uncommon case that one does not, it may use
     the new ‘Py_mod_multiple_interpreters’ module def slot.  A value of
     ‘0’ means the module does not support them.  ‘1’ means it does.
     The default is ‘1’.

   - gh-104142(13): Fix an issue where *note list: 24d. or *note tuple:
     614. repetition could fail to respect PEP 683(14).

   - gh-104078(15): Improve the performance of *note
     PyObject_HasAttrString(): 61e.

   - gh-104066(16): Improve the performance of *note hasattr(): 6f9. for
     module objects with a missing attribute.

   - gh-104028(17): Reduce object creation while calling callback
     function from gc.  Patch by Donghee Na.

   - gh-104018(18): Disallow the "z" format specifier in %-format of
     bytes objects.

   - gh-102213(19): Fix performance loss when accessing an object's
     attributes with ‘__getattr__’ defined.

   - gh-103895(20): Improve handling of edge cases in showing
     ‘Exception.__notes__’.  Ensures that the messages always end with a
     newline and that string/bytes are not exploded over multiple lines.
     Patch by Carey Metcalfe.

   - gh-103907(21): Don't modify the refcounts of known immortal objects
     (*note True: e07, *note False: d2b, and *note None: 885.) in the
     main interpreter loop.

   - gh-103899(22): Provide a helpful hint in the *note TypeError: 198.
     message when accidentally calling a *note module: 19de. object that
     has a callable attribute of the same name (such as *note dis.dis():
     205. or *note datetime.datetime: 4e2.).

   - gh-103845(23): Remove both line and instruction instrumentation
     before adding new ones for monitoring, to avoid newly added
     instrumentation being removed immediately.

   - gh-103763(24): Implement PEP 695(25), adding syntactic support for
     generic classes, generic functions, and type aliases.

     A new ‘type X = ...’ syntax is added for type aliases, which
     resolves at runtime to an instance of the new class
     ‘typing.TypeAliasType’.  The value is lazily evaluated and is
     accessible through the ‘.__value__’ attribute.  This is implemented
     as a new AST node ‘ast.TypeAlias’.

     New syntax (‘class X[T]: ...’, ‘def func[T](): ...’) is added for
     defining generic functions and classes.  This is implemented as a
     new ‘type_params’ attribute on the AST nodes for classes and
     functions.  This node holds instances of the new AST classes
     ‘ast.TypeVar’, ‘ast.ParamSpec’, and ‘ast.TypeVarTuple’.

     ‘typing.TypeVar’, ‘typing.ParamSpec’, ‘typing.ParamSpecArgs’,
     ‘typing.ParamSpecKwargs’, ‘typing.TypeVarTuple’, and
     ‘typing.Generic’ are now implemented in C rather than Python.

     There are new bytecode instructions ‘LOAD_LOCALS’,
     ‘LOAD_CLASSDICT_OR_GLOBAL’, and ‘LOAD_CLASSDICT_OR_DEREF’ to
     support correct resolution of names in class namespaces.

     Patch by Eric Traut, Larry Hastings, and Jelle Zijlstra.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104615

   (2) https://github.com/python/cpython/issues/104572

   (3) https://peps.python.org/pep-0695/

   (4) https://github.com/python/cpython/issues/104482

   (5) https://github.com/python/cpython/issues/102818

   (6) https://github.com/python/cpython/issues/104405

   (7) https://peps.python.org/pep-0523/

   (8) https://github.com/python/cpython/issues/103082

   (9) https://github.com/python/cpython/issues/104263

   (10) https://github.com/python/cpython/issues/99113

   (11) https://github.com/python/cpython/issues/99113

   (12) https://github.com/python/cpython/issues/104108

   (13) https://github.com/python/cpython/issues/104142

   (14) https://peps.python.org/pep-0683/

   (15) https://github.com/python/cpython/issues/104078

   (16) https://github.com/python/cpython/issues/104066

   (17) https://github.com/python/cpython/issues/104028

   (18) https://github.com/python/cpython/issues/104018

   (19) https://github.com/python/cpython/issues/102213

   (20) https://github.com/python/cpython/issues/103895

   (21) https://github.com/python/cpython/issues/103907

   (22) https://github.com/python/cpython/issues/103899

   (23) https://github.com/python/cpython/issues/103845

   (24) https://github.com/python/cpython/issues/103763

   (25) https://peps.python.org/pep-0695/


File: python.info,  Node: ライブラリ<66>,  Next: Core and Builtins<61>,  Prev: Core and Builtins<60>,  Up: Python 3 12 0 beta 1

1.24.27.4 ライブラリ
....................

   - gh-103801(1): Adds three minor linting fixes to the wasm module
     caught that were caught by ruff.

   - gh-103793(2): Optimized asyncio Task creation by deferring
     expensive string formatting (task name generation) from Task
     creation to the first time ‘get_name’ is called.  This makes
     asyncio benchmarks up to 5% faster.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/103801

   (2) https://github.com/python/cpython/issues/103793


File: python.info,  Node: Core and Builtins<61>,  Next: ライブラリ<67>,  Prev: ライブラリ<66>,  Up: Python 3 12 0 beta 1

1.24.27.5 Core and Builtins
...........................

   - gh-102310(1): Change the error range for invalid bytes literals.

   - gh-103590(2): Do not wrap a single exception raised from a
     ‘try-except*’ construct in an *note ExceptionGroup: 4d2.

   - gh-103650(3): Change the perf map format to remove the '0x' prefix
     from the addresses

   - gh-102856(4): Implement the required C tokenizer changes for PEP
     701.  Patch by Pablo Galindo Salgado, Lysandros Nikolaou, Batuhan
     Taskaya, Marta Gómez Macías and sunmy2019.

   - gh-100530(5): Clarify the error message raised when the called part
     of a class pattern isn't actually a class.

   - gh-101517(6): Fix bug in line numbers of instructions emitted for
     *note except*: 1ac.

   - gh-103492(7): Clarify *note SyntaxWarning: 1ae. with literal ‘is’
     comparison by specifying which literal is problematic, since
     comparisons using ‘is’ with e.g.  ‘None’ and bool literals are
     idiomatic.

   - gh-87729(8): Add *note LOAD_SUPER_ATTR: 702. (and a specialization
     for ‘super().method()’) to speed up ‘super().method()’ and
     ‘super().attr’.  This makes ‘super().method()’ roughly 2.3x faster
     and brings it within 20% of the performance of a simple method
     call.  Patch by Vladimir Matveev and Carl Meyer.

   - gh-103488(9): Change the internal offset distinguishing yield and
     return target addresses, so that the instruction pointer is correct
     for exception handling and other stack unwinding.

   - gh-82012(10): The bitwise inversion operator (‘~’) on bool is
     deprecated.  It returns the bitwise inversion of the underlying
     ‘int’ representation such that ‘bool(~True) == True’, which can be
     confusing.  Use ‘not’ for logical negation of bools.  In the rare
     case that you really need the bitwise inversion of the underlying
     ‘int’, convert to int explicitly ‘~int(x)’.

   - gh-77757(11): Exceptions raised in a typeobject's ‘__set_name__’
     method are no longer wrapped by a *note RuntimeError: 244.  Context
     information is added to the exception as a PEP 678(12) note.

   - gh-103333(13): *note AttributeError: 5f0. now retains the ‘name’
     attribute when pickled and unpickled.

   - gh-103242(14): Migrate *note set_ecdh_curve(): 135b. method not to
     use deprecated OpenSSL APIs.  Patch by Donghee Na.

   - gh-103323(15): We've replaced our use of
     ‘_PyRuntime.tstate_current’ with a thread-local variable.  This is
     a fairly low-level implementation detail, and there should be no
     change in behavior.

   - gh-84436(16): The implementation of PEP-683 which adds Immortal
     Objects by using a fixed reference count that skips reference
     counting to make objects truly immutable.

   - gh-102700(17): Allow built-in modules to be submodules.  This
     allows submodules to be statically linked into a CPython binary.

   - gh-103082(18): Implement PEP 669(19) Low Impact Monitoring for
     CPython.

   - gh-88691(20): Reduce the number of inline *note CACHE: 908. entries
     for *note CALL: 915.

   - gh-102500(21): Make the buffer protocol accessible in Python code
     using the new ‘__buffer__’ and ‘__release_buffer__’ magic methods.
     See PEP 688(22) for details.  Patch by Jelle Zijlstra.

   - gh-97933(23): PEP 709(24): inline list, dict and set comprehensions
     to improve performance and reduce bytecode size.

   - gh-99184(25): Bypass instance attribute access of ‘__name__’ in
     ‘repr’ of *note weakref.ref: 11f2.

   - gh-98003(26): Complex function calls are now faster and consume no
     C stack space.

   - bpo-39610(27): ‘len()’ for 0-dimensional *note memoryview: 165.
     objects (such as ‘memoryview(ctypes.c_uint8(42))’) now raises a
     *note TypeError: 198.  Previously this returned ‘1’, which was not
     consistent with ‘mem_0d[0]’ raising an *note IndexError: 174e.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102310

   (2) https://github.com/python/cpython/issues/103590

   (3) https://github.com/python/cpython/issues/103650

   (4) https://github.com/python/cpython/issues/102856

   (5) https://github.com/python/cpython/issues/100530

   (6) https://github.com/python/cpython/issues/101517

   (7) https://github.com/python/cpython/issues/103492

   (8) https://github.com/python/cpython/issues/87729

   (9) https://github.com/python/cpython/issues/103488

   (10) https://github.com/python/cpython/issues/82012

   (11) https://github.com/python/cpython/issues/77757

   (12) https://peps.python.org/pep-0678/

   (13) https://github.com/python/cpython/issues/103333

   (14) https://github.com/python/cpython/issues/103242

   (15) https://github.com/python/cpython/issues/103323

   (16) https://github.com/python/cpython/issues/84436

   (17) https://github.com/python/cpython/issues/102700

   (18) https://github.com/python/cpython/issues/103082

   (19) https://peps.python.org/pep-0669/

   (20) https://github.com/python/cpython/issues/88691

   (21) https://github.com/python/cpython/issues/102500

   (22) https://peps.python.org/pep-0688/

   (23) https://github.com/python/cpython/issues/97933

   (24) https://peps.python.org/pep-0709/

   (25) https://github.com/python/cpython/issues/99184

   (26) https://github.com/python/cpython/issues/98003

   (27) https://bugs.python.org/issue?@action=redirect&bpo=39610


File: python.info,  Node: ライブラリ<67>,  Next: ドキュメント<21>,  Prev: Core and Builtins<61>,  Up: Python 3 12 0 beta 1

1.24.27.6 ライブラリ
....................

   - bpo-31821(1): Fix ‘pause_reading()’ to work when called from
     ‘connection_made()’ in *note asyncio: b.

   - gh-104600(2): *note functools.update_wrapper(): 1223. now sets the
     ‘__type_params__’ attribute (added by PEP 695(3)).

   - gh-104340(4): When an ‘asyncio’ pipe protocol loses its connection
     due to an error, and the caller doesn't await ‘wait_closed()’ on
     the corresponding ‘StreamWriter’, don't log a warning about an
     exception that was never retrieved.  After all, according to the
     ‘StreamWriter.close()’ docs, the ‘wait_closed()’ call is optional
     ("not mandatory").

   - gh-104555(5): Fix issue where an *note issubclass(): 9c4. check
     comparing a class ‘X’ against a *note runtime-checkable protocol:
     675. ‘Y’ with non-callable members would not cause *note TypeError:
     198. to be raised if an *note isinstance(): 2ad. call had
     previously been made comparing an instance of ‘X’ to ‘Y’.  This
     issue was present in edge cases on Python 3.11, but became more
     prominent in 3.12 due to some unrelated changes that were made to
     runtime-checkable protocols.  Patch by Alex Waygood.

   - gh-104372(6): Refactored the ‘_posixsubprocess’ internals to avoid
     Python C API usage between fork and exec when marking ‘pass_fds=’
     file descriptors inheritable.

   - gh-104484(7): Added 'case_sensitive' argument to *note
     pathlib.PurePath.match(): 6d3.

   - gh-75367(8): Fix data descriptor detection in *note
     inspect.getattr_static(): 6bc.

   - gh-104536(9): Fix a race condition in the internal
     ‘multiprocessing.process’ cleanup logic that could manifest as an
     unintended ‘AttributeError’ when calling ‘process.close()’.

   - gh-103857(10): Update datetime deprecations' stracktrace to point
     to the calling line

   - gh-101520(11): Move the core functionality of the ‘tracemalloc’
     module in the ‘Python/’ folder, leaving just the module wrapper in
     ‘Modules/’.

   - gh-104392(12): Remove undocumented and unused ‘_paramspec_tvars’
     attribute from some classes in *note typing: 10a.

   - gh-102613(13): Fix issue where *note pathlib.Path.glob(): 537.
     raised *note RecursionError: f68. when walking deep directory
     trees.

   - gh-103000(14): Improve performance of *note dataclasses.asdict():
     1a95. for the common case where 'dict_factory' is ‘dict’.  Patch by
     David C Ellis.

   - gh-104301(15): Allow leading whitespace in disambiguated statements
     in *note pdb: aa.

   - gh-104139(16): Teach ‘urllib.parse.unsplit()’ to retain the ‘"//"’
     when assembling ‘itms-services://?action=generate-bugs’ style Apple
     Platform Deployment(17) URLs.

   - gh-104307(18): *note socket.getnameinfo(): 1a3a. now releases the
     GIL while contacting the DNS server

   - gh-104310(19): Users may now use
     ‘importlib.util.allowing_all_extensions()’ (a context manager) to
     temporarily disable the strict compatibility checks for importing
     extension modules in subinterpreters.

   - gh-87695(20): Fix issue where *note pathlib.Path.glob(): 537.
     raised *note OSError: 2c0. when it encountered a symlink to an
     overly long path.

   - gh-104265(21): Prevent possible crash by disallowing instantiation
     of the ‘_csv.Reader’ and ‘_csv.Writer’ types.  The regression was
     introduced in 3.10.0a4 with PR 23224 (bpo-14935(22)).  Patch by
     Radislav Chugunov.

   - gh-102613(23): Improve performance of *note pathlib.Path.glob():
     537. when expanding recursive wildcards ("‘**’") by merging
     adjacent wildcards and de-duplicating results only when necessary.

   - gh-65772(24): Remove unneeded comments and code in turtle.py.

   - gh-90208(25): Fixed issue where *note pathlib.Path.glob(): 537.
     returned incomplete results when it encountered a *note
     PermissionError: f3e.  This method now suppresses all *note
     OSError: 2c0. exceptions, except those raised from calling *note
     is_dir(): 53a. on the top-level path.

   - gh-104144(26): Optimize *note asyncio.TaskGroup: 4d1. when using
     *note asyncio.eager_task_factory(): 6a2.  Skip scheduling a done
     callback if a TaskGroup task completes eagerly.

   - gh-104144(27): Optimize *note asyncio.gather(): 813. when using
     *note asyncio.eager_task_factory(): 6a2. to complete eagerly if all
     fututres completed eagerly.  Avoid scheduling done callbacks for
     futures that complete eagerly.

   - gh-104114(28): Fix issue where *note pathlib.Path.glob(): 537.
     returns paths using the case of non-wildcard segments for
     corresponding path segments, rather than the real filesystem case.

   - gh-104104(29): Improve performance of *note pathlib.Path.glob():
     537. by using *note re.IGNORECASE: 1a96. to implement
     case-insensitive matching.

   - gh-104102(30): Improve performance of *note pathlib.Path.glob():
     537. when evaluating patterns that contain ‘'../'’ segments.

   - gh-103822(31): Update the return type of ‘weekday’ to the newly
     added Day attribute

   - gh-103629(32): Update the ‘repr’ of *note typing.Unpack: 19a6.
     according to PEP 692(33).

   - gh-103963(34): Make *note dis: 3c. display the names of the args
     for ‘CALL_INTRINSIC_*’.

   - gh-104035(35): Do not ignore user-defined ‘__getstate__’ and
     ‘__setstate__’ methods for slotted frozen dataclasses.

   - gh-103987(36): In *note mmap: 94, fix several bugs that could lead
     to access to memory-mapped files after they have been invalidated.

   - gh-103977(37): Improve import time of *note platform: af. module.

   - gh-88773(38): Added *note turtle.teleport(): 1a97. to the *note
     turtle: 107. module to move a turtle to a new point without tracing
     a line, visible or invisible.  Patch by Liam Gersten.

   - gh-103935(39): Use *note io.open_code(): 1a98. for files to be
     executed instead of raw *note open(): 316.

   - gh-68968(40): Fixed garbled output of *note assertEqual(): 74c.
     when an input lacks final newline.

   - gh-100370(41): Fix potential *note OverflowError: a81. in *note
     sqlite3.Connection.blobopen(): 891. for 32-bit builds.  Patch by
     Erlend E. Aasland.

   - gh-102628(42): Substitute CTRL-D with CTRL-Z in *note sqlite3: d4.
     CLI banner when running on Windows.

   - gh-103636(43): Module-level attributes ‘January’ and ‘February’ are
     deprecated from *note calendar: 15.

   - gh-103583(44): Isolate ‘_multibytecodec’ and codecs extension
     modules.  Patches by Erlend E. Aasland.

   - gh-103848(45): Add checks to ensure that ‘[’ bracketed ‘]’ hosts
     found by *note urllib.parse.urlsplit(): f3a. are of IPv6 or
     IPvFuture format.

   - gh-103872(46): Update the bundled copy of pip to version 23.1.2.

   - gh-99944(47): Make *note dis: 3c. display the value of oparg of
     ‘KW_NAMES’.

   - gh-74940(48): The C.UTF-8 locale is no longer converted to
     en_US.UTF-8, enabling the use of UTF-8 encoding on systems which
     have no locales installed.

   - gh-103861(49): Fix ‘zipfile.Zipfile’ creating invalid zip files
     when ‘force_zip64’ was used to add files to them.  Patch by Carey
     Metcalfe.

   - gh-103857(50): Deprecated *note datetime.datetime.utcnow(): 351.
     and *note datetime.datetime.utcfromtimestamp(): 352.  (Patch by
     Paul Ganssle)

   - gh-103839(51): Avoid compilation error due to tommath.h not being
     found when building Tkinter against Tcl 8.7 built with bundled
     libtommath.

   - gh-103791(52): *note contextlib.suppress: 1129. now supports
     suppressing exceptions raised as part of an *note ExceptionGroup:
     4d2.  If other exceptions exist on the group, they are re-raised in
     a group that does not contain the suppressed exceptions.

   - gh-90750(53): Use *note datetime.datetime.fromisocalendar(): be0.
     in the implementation of *note datetime.datetime.strptime(): 1950,
     which should now accept only valid ISO dates.  (Patch by Paul
     Ganssle)

   - gh-103685(54): Prepare ‘tkinter.Menu.index()’ for Tk 8.7 so that it
     does not raise ‘TclError: expected integer but got ""’ when it
     should return ‘None’.

   - gh-81403(55): *note urllib.request.CacheFTPHandler: 1a99. no longer
     raises ‘URLError’ if a cached FTP instance is reused.  ftplib's
     endtransfer method calls voidresp to drain the connection to handle
     FTP instance reuse properly.

   - gh-103699(56): Add ‘__orig_bases__’ to non-generic TypedDicts,
     call-based TypedDicts, and call-based NamedTuples.  Other
     TypedDicts and NamedTuples already had the attribute.

   - gh-103693(57): Add convenience variable feature to *note pdb: aa.

   - gh-92248(58): Deprecate ‘type’, ‘choices’, and ‘metavar’ parameters
     of ‘argparse.BooleanOptionalAction’.

   - gh-89415(59): Add *note socket: d1. constants for source-specific
     multicast.  Patch by Reese Hyde.

   - gh-103673(60): *note socketserver: d2. gains
     ‘ForkingUnixStreamServer’ and ‘ForkingUnixDatagramServer’ classes.
     Patch by Jay Berry.

   - gh-103636(61): Added Enum for months and days in the calendar
     module.

   - gh-84976(62): Create a new ‘Lib/_pydatetime.py’ file that defines
     the Python version of the ‘datetime’ module, and make ‘datetime’
     import the contents of the new library only if the C implementation
     is missing.  Currently, the full Python implementation is defined
     and then deleted if the C implementation is not available, slowing
     down ‘import datetime’ unnecessarily.

   - gh-103596(63): Attributes/methods are no longer shadowed by
     same-named enum members, although they may be shadowed by
     enum.property's.

   - gh-103584(64): Updated ‘importlib.metadata’ with changes from
     ‘importlib_metadata’ 5.2 through 6.5.0, including: Support
     ‘installed-files.txt’ for ‘Distribution.files’ when present.
     ‘PackageMetadata’ now stipulates an additional ‘get’ method
     allowing for easy querying of metadata keys that may not be
     present.  ‘packages_distributions’ now honors packages and modules
     with Python modules that not ‘.py’ sources (e.g.  ‘.pyc’, ‘.so’).
     Expand protocol for ‘PackageMetadata.get_all’ to match the upstream
     implementation of ‘email.message.Message.get_all’ in
     python/typeshed#9620.  Deprecated use of ‘Distribution’ without
     defining abstract methods.  Deprecated expectation that
     ‘PackageMetadata.__getitem__’ will return ‘None’ for missing keys.
     In the future, it will raise a ‘KeyError’.

   - gh-103578(65): Fixed a bug where *note pdb: aa. crashes when
     reading source file with different encoding by replacing *note
     io.open(): 740. with *note io.open_code(): 1a98.  The new method
     would also call into the hook set by *note
     PyFile_SetOpenCodeHook(): 1a9a.

   - gh-103556(66): Now creating *note inspect.Signature: 4e3. objects
     with positional-only parameter with a default followed by a
     positional-or-keyword parameter without one is impossible.

   - gh-103559(67): Update the bundled copy of pip to version 23.1.1.

   - gh-103548(68): Improve performance of *note
     pathlib.Path.absolute(): 1a26. and *note cwd(): 1a9b. by joining
     paths only when necessary.  Also improve performance of *note
     pathlib.PurePath.is_absolute(): 1a9c. on Posix by skipping path
     parsing and normalization.

   - gh-103538(69): Remove ‘_tkinter’ module code guarded by definition
     of the ‘TK_AQUA’ macro which was only needed for Tk 8.4.7 or
     earlier and was never actually defined by any build system or
     documented for manual use.

   - gh-103533(70): Update *note cProfile: 2b. to use PEP 669 API

   - gh-103525(71): Fix misleading exception message when mixed ‘str’
     and ‘bytes’ arguments are supplied to *note pathlib.PurePath: 6cd.
     and *note Path: 266.

   - gh-103489(72): Add *note getconfig(): 6e0. and *note setconfig():
     6e1. to *note Connection: 54d. to make configuration changes to a
     database connection.  Patch by Erlend E. Aasland.

   - gh-103365(73): Set default Flag boundary to ‘STRICT’ and fix
     bitwise operations.

   - gh-103472(74): Avoid a potential *note ResourceWarning: 54c. in
     *note http.client.HTTPConnection: d35. by closing the proxy /
     tunnel's CONNECT response explicitly.

   - gh-103462(75): Fixed an issue with using *note writelines(): 17c9.
     in *note asyncio: b. to send very large payloads that exceed the
     amount of data that can be written in one call to *note
     socket.socket.send(): fa7. or *note socket.socket.sendmsg(): 6a1,
     resulting in the remaining buffer being left unwritten.

   - gh-103449(76): Fix a bug in doc string generation in *note
     dataclasses.dataclass(): 4e1.

   - gh-103092(77): Isolate ‘_collections’ (apply PEP 687(78)).  Patch
     by Erlend E. Aasland.

   - gh-103357(79): Added support for *note logging.Formatter: 16b0.
     ‘defaults’ parameter to *note logging.config.dictConfig(): 13c8.
     and *note logging.config.fileConfig(): d48.  Patch by Bar Harel.

   - gh-103092(80): Adapt the *note winreg: 11c. extension module to PEP
     687(81).

   - gh-74690(82): The performance of *note isinstance(): 2ad. checks
     against *note runtime-checkable protocols: 675. has been
     considerably improved for protocols that only have a few members.
     To achieve this improvement, several internal implementation
     details of the *note typing: 10a. module have been refactored,
     including ‘typing._ProtocolMeta.__instancecheck__’,
     ‘typing._is_callable_members_only’, and
     ‘typing._get_protocol_attrs’.  Patches by Alex Waygood.

   - gh-74690(83): The members of a runtime-checkable protocol are now
     considered "frozen" at runtime as soon as the class has been
     created.  See *note "What's new in Python 3.12": 6f8. for more
     details.

   - gh-103256(84): Fixed a bug that caused *note hmac: 6e. to raise an
     exception when the requested hash algorithm was not available in
     OpenSSL despite being available separately as part of ‘hashlib’
     itself.  It now falls back properly to the built-in.  This could
     happen when, for example, your OpenSSL does not include SHA3
     support and you want to compute ‘hmac.digest(b'K', b'M',
     'sha3_256')’.

   - gh-102778(85): Support ‘sys.last_exc’ in *note idlelib: 77.

   - gh-103285(86): Improve performance of *note
     ast.get_source_segment(): bcb.

   - gh-103225(87): Fix a bug in *note pdb: aa. when displaying line
     numbers of module-level source code.

   - gh-103092(88): Adapt the *note msvcrt: 97. extension module to PEP
     687(89).

   - gh-103092(90): Adapt the *note winsound: 11d. extension module to
     PEP 687(91).

   - gh-93910(92): Remove deprecation of enum ‘member.member’ access.

   - gh-102978(93): Fixes *note unittest.mock.patch(): 1092. not
     enforcing function signatures for methods decorated with
     ‘@classmethod’ or ‘@staticmethod’ when patch is called with
     ‘autospec=True’.

   - gh-103092(94): Isolate ‘_socket’ (apply PEP 687(95)).  Patch by
     Erlend E. Aasland.

   - gh-100479(96): Add *note pathlib.PurePath.with_segments(): 6ce,
     which creates a path object from arguments.  This method is called
     whenever a derivative path is created, such as from *note
     pathlib.PurePath.parent: 1a9d.  Subclasses may override this method
     to share information between path objects.

   - gh-103220(97): Fix issue where *note os.path.join(): 19a9. added a
     slash when joining onto an incomplete UNC drive with a trailing
     slash on Windows.

   - gh-103204(98): Fixes *note http.server: 76. accepting HTTP requests
     with HTTP version numbers preceded by '+', or '-', or with
     digit-separating '_' characters.  The length of the version numbers
     is also constrained.

   - gh-75586(99): Fix various Windows-specific issues with
     ‘shutil.which’.

   - gh-103193(100): Improve performance of *note
     inspect.getattr_static(): 6bc.  Patch by Alex Waygood.

   - gh-103176(101): *note sys._current_exceptions(): 6e9. now returns a
     mapping from thread-id to an exception instance, rather than to a
     ‘(typ, exc, tb)’ tuple.

   - gh-103143(102): Polish the help messages and docstrings of *note
     pdb: aa.

   - gh-103015(103): Add 'entrypoint' keyword-only parameter to *note
     sqlite3.Connection.load_extension(): 6df, for overriding the SQLite
     extension entry point.  Patch by Erlend E. Aasland.

   - gh-103000(104): Improve performance of *note dataclasses.astuple():
     1a9e. and *note dataclasses.asdict(): 1a95. in cases where the
     contents are common Python types.

   - gh-102953(105): The extraction methods in *note tarfile: e4, and
     *note shutil.unpack_archive(): 696, have a new a 'filter' argument
     that allows limiting tar features than may be surprising or
     dangerous, such as creating files outside the destination
     directory.  See *note Extraction filters: 697. for details.

   - gh-97696(106): Implemented an eager task factory in asyncio.  When
     used as a task factory on an event loop, it performs eager
     execution of coroutines.  Coroutines that are able to complete
     synchronously (e.g.  return or raise without blocking) are returned
     immediately as a finished task, and the task is never scheduled to
     the event loop.  If the coroutine blocks, the (pending) task is
     scheduled and returned.

   - gh-81079(107): Add 'case_sensitive' keyword-only argument to *note
     pathlib.Path.glob(): 537. and *note rglob(): 538.

   - gh-101819(108): Isolate the *note io: 83. extension module by
     applying PEP 687(109).  Patch by Kumar Aditya, Victor Stinner, and
     Erlend E. Aasland.

   - gh-91896(110): Deprecate *note collections.abc.ByteString: 342.

   - gh-101362(111): Speed up *note pathlib.Path: 266. construction by
     omitting the path anchor from the internal list of path parts.

   - gh-102114(112): Functions in the *note dis: 3c. module that accept
     a source code string as argument now print a more concise traceback
     when the string contains a syntax or indentation error.

   - gh-62432(113): The *note unittest: 10c. runner will now exit with
     status code 5 if no tests were run.  It is common for test runner
     misconfiguration to fail to find any tests, this should be an
     error.

   - gh-78079(114): Fix incorrect normalization of UNC device path
     roots, and partial UNC share path roots, in *note pathlib.PurePath:
     6cd.  Pathlib no longer appends a trailing slash to such paths.

   - gh-85984(115): Add *note tty.cfmakeraw(): 1a42. and *note
     tty.cfmakecbreak(): 19f6. to *note tty: 106. and modernize, the
     behavior of *note tty.setraw(): 1a41. and *note tty.setcbreak():
     19f5. to use POSIX.1-2017 Chapter 11 "General Terminal Interface"
     flag masks by default.

   - gh-101688(116): Implement *note types.get_original_bases(): 6f5. to
     provide further introspection for types.

   - gh-101640(117): *note argparse.ArgumentParser: 1bd. now catches
     errors when writing messages, such as when *note sys.stderr: b33.
     is ‘None’.  Patch by Oleg Iarygin.

   - gh-83861(118): Fix datetime.astimezone method return value when
     invoked on a naive datetime instance that represents local time
     falling in a timezone transition gap.  PEP 495 requires that
     instances with fold=1 produce earlier times than those with fold=0
     in this case.

   - gh-89550(119): Decrease execution time of some *note gzip: 6b. file
     writes by 15% by adding more appropriate buffering.

   - gh-95299(120): Remove the bundled setuptools wheel from
     ‘ensurepip’, and stop installing setuptools in environments created
     by ‘venv’.

   - gh-99353(121): Respect the *note http.client.HTTPConnection: d35.
     ‘.debuglevel’ flag in ‘urllib.request.AbstractHTTPHandler’ when its
     constructor parameter ‘debuglevel’ is not set.  And do the same for
     ‘*HTTPS*’.

   - gh-98040(122): Remove the long-deprecated ‘imp’ module.

   - gh-97850(123): Deprecate ‘pkgutil.find_loader()’ and
     ‘pkgutil.get_loader()’ in favor of *note
     importlib.util.find_spec(): 5af.

   - gh-94473(124): Flatten arguments in ‘tkinter.Canvas.coords()’.  It
     now accepts not only ‘x1, y1, x2, y2, ...’ and ‘[x1, y1, x2, y2,
     ...]’, but also ‘(x1, y1), (x2, y2), ...’ and ‘[(x1, y1), (x2, y2),
     ...]’.

   - gh-98040(125): Remove more deprecated importlib APIs:
     ‘find_loader()’, ‘find_module()’, ‘importlib.abc.Finder’,
     ‘pkgutil.ImpImporter’, ‘pkgutil.ImpLoader’.

   - gh-96522(126): Fix potential deadlock in pty.spawn()

   - gh-96534(127): Support divert(4) added in FreeBSD 14.

   - gh-87474(128): Fix potential file descriptor leaks in *note
     subprocess.Popen: 4b7.

   - gh-94906(129): Support multiple steps in *note math.nextafter():
     6c0.  Patch by Shantanu Jain and Matthias Gorgens.

   - gh-51574(130): Make *note tempfile.mkdtemp(): 52d. return absolute
     paths when its 'dir' parameter is relative.

   - gh-94518(131): Convert private ‘_posixsubprocess.fork_exec()’ to
     use Argument Clinic.

   - gh-92184(132): When creating zip files using *note zipfile: 137,
     ‘os.altsep’, if not ‘None’, will always be treated as a path
     separator even when it is not ‘/’.  Patch by Carey Metcalfe.

   - bpo-46797(133): Deprecation warnings are now emitted for ‘ast.Num’,
     ‘ast.Bytes’, ‘ast.Str’, ‘ast.NameConstant’ and ‘ast.Ellipsis’.
     These have been documented as deprecated since Python 3.8, and will
     be removed in Python 3.14.

   - bpo-44844(134): Enables *note webbrowser: 11b. to detect and launch
     Microsoft Edge browser.

   - bpo-45606(135): Fixed the bug in *note pathlib.Path.glob(): 537. -
     previously a dangling symlink would not be found by this method
     when the pattern is an exact match, but would be found when the
     pattern contains a wildcard or the recursive wildcard (‘**’).  With
     this change, a dangling symlink will be found in both cases.

   - bpo-23041(136): Add *note QUOTE_STRINGS: 6ad. and *note
     QUOTE_NOTNULL: 6ac. to the suite of *note csv: 2d. module quoting
     styles.

   - bpo-24964(137): Added *note
     http.client.HTTPConnection.get_proxy_response_headers(): 1a73. that
     provides access to the HTTP headers on a proxy server response to
     the ‘CONNECT’ request.

   - bpo-17258(138): *note multiprocessing: 98. now supports stronger
     HMAC algorithms for inter-process connection authentication rather
     than only HMAC-MD5.

   - bpo-39744(139): Make *note
     asyncio.subprocess.Process.communicate(): 1a9f. close the
     subprocess's stdin even when called with ‘input=None’.

   - bpo-22708(140): http.client CONNECT method tunnel improvements: Use
     HTTP 1.1 protocol; send a matching Host: header with CONNECT, if
     one is not provided; convert IDN domain names to Punycode.  Patch
     by Michael Handler.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31821

   (2) https://github.com/python/cpython/issues/104600

   (3) https://peps.python.org/pep-0695/

   (4) https://github.com/python/cpython/issues/104340

   (5) https://github.com/python/cpython/issues/104555

   (6) https://github.com/python/cpython/issues/104372

   (7) https://github.com/python/cpython/issues/104484

   (8) https://github.com/python/cpython/issues/75367

   (9) https://github.com/python/cpython/issues/104536

   (10) https://github.com/python/cpython/issues/103857

   (11) https://github.com/python/cpython/issues/101520

   (12) https://github.com/python/cpython/issues/104392

   (13) https://github.com/python/cpython/issues/102613

   (14) https://github.com/python/cpython/issues/103000

   (15) https://github.com/python/cpython/issues/104301

   (16) https://github.com/python/cpython/issues/104139

   (17) 
https://support.apple.com/en-gb/guide/deployment/depce7cefc4d/web

   (18) https://github.com/python/cpython/issues/104307

   (19) https://github.com/python/cpython/issues/104310

   (20) https://github.com/python/cpython/issues/87695

   (21) https://github.com/python/cpython/issues/104265

   (22) https://bugs.python.org/issue?@action=redirect&bpo=14935

   (23) https://github.com/python/cpython/issues/102613

   (24) https://github.com/python/cpython/issues/65772

   (25) https://github.com/python/cpython/issues/90208

   (26) https://github.com/python/cpython/issues/104144

   (27) https://github.com/python/cpython/issues/104144

   (28) https://github.com/python/cpython/issues/104114

   (29) https://github.com/python/cpython/issues/104104

   (30) https://github.com/python/cpython/issues/104102

   (31) https://github.com/python/cpython/issues/103822

   (32) https://github.com/python/cpython/issues/103629

   (33) https://peps.python.org/pep-0692/

   (34) https://github.com/python/cpython/issues/103963

   (35) https://github.com/python/cpython/issues/104035

   (36) https://github.com/python/cpython/issues/103987

   (37) https://github.com/python/cpython/issues/103977

   (38) https://github.com/python/cpython/issues/88773

   (39) https://github.com/python/cpython/issues/103935

   (40) https://github.com/python/cpython/issues/68968

   (41) https://github.com/python/cpython/issues/100370

   (42) https://github.com/python/cpython/issues/102628

   (43) https://github.com/python/cpython/issues/103636

   (44) https://github.com/python/cpython/issues/103583

   (45) https://github.com/python/cpython/issues/103848

   (46) https://github.com/python/cpython/issues/103872

   (47) https://github.com/python/cpython/issues/99944

   (48) https://github.com/python/cpython/issues/74940

   (49) https://github.com/python/cpython/issues/103861

   (50) https://github.com/python/cpython/issues/103857

   (51) https://github.com/python/cpython/issues/103839

   (52) https://github.com/python/cpython/issues/103791

   (53) https://github.com/python/cpython/issues/90750

   (54) https://github.com/python/cpython/issues/103685

   (55) https://github.com/python/cpython/issues/81403

   (56) https://github.com/python/cpython/issues/103699

   (57) https://github.com/python/cpython/issues/103693

   (58) https://github.com/python/cpython/issues/92248

   (59) https://github.com/python/cpython/issues/89415

   (60) https://github.com/python/cpython/issues/103673

   (61) https://github.com/python/cpython/issues/103636

   (62) https://github.com/python/cpython/issues/84976

   (63) https://github.com/python/cpython/issues/103596

   (64) https://github.com/python/cpython/issues/103584

   (65) https://github.com/python/cpython/issues/103578

   (66) https://github.com/python/cpython/issues/103556

   (67) https://github.com/python/cpython/issues/103559

   (68) https://github.com/python/cpython/issues/103548

   (69) https://github.com/python/cpython/issues/103538

   (70) https://github.com/python/cpython/issues/103533

   (71) https://github.com/python/cpython/issues/103525

   (72) https://github.com/python/cpython/issues/103489

   (73) https://github.com/python/cpython/issues/103365

   (74) https://github.com/python/cpython/issues/103472

   (75) https://github.com/python/cpython/issues/103462

   (76) https://github.com/python/cpython/issues/103449

   (77) https://github.com/python/cpython/issues/103092

   (78) https://peps.python.org/pep-0687/

   (79) https://github.com/python/cpython/issues/103357

   (80) https://github.com/python/cpython/issues/103092

   (81) https://peps.python.org/pep-0687/

   (82) https://github.com/python/cpython/issues/74690

   (83) https://github.com/python/cpython/issues/74690

   (84) https://github.com/python/cpython/issues/103256

   (85) https://github.com/python/cpython/issues/102778

   (86) https://github.com/python/cpython/issues/103285

   (87) https://github.com/python/cpython/issues/103225

   (88) https://github.com/python/cpython/issues/103092

   (89) https://peps.python.org/pep-0687/

   (90) https://github.com/python/cpython/issues/103092

   (91) https://peps.python.org/pep-0687/

   (92) https://github.com/python/cpython/issues/93910

   (93) https://github.com/python/cpython/issues/102978

   (94) https://github.com/python/cpython/issues/103092

   (95) https://peps.python.org/pep-0687/

   (96) https://github.com/python/cpython/issues/100479

   (97) https://github.com/python/cpython/issues/103220

   (98) https://github.com/python/cpython/issues/103204

   (99) https://github.com/python/cpython/issues/75586

   (100) https://github.com/python/cpython/issues/103193

   (101) https://github.com/python/cpython/issues/103176

   (102) https://github.com/python/cpython/issues/103143

   (103) https://github.com/python/cpython/issues/103015

   (104) https://github.com/python/cpython/issues/103000

   (105) https://github.com/python/cpython/issues/102953

   (106) https://github.com/python/cpython/issues/97696

   (107) https://github.com/python/cpython/issues/81079

   (108) https://github.com/python/cpython/issues/101819

   (109) https://peps.python.org/pep-0687/

   (110) https://github.com/python/cpython/issues/91896

   (111) https://github.com/python/cpython/issues/101362

   (112) https://github.com/python/cpython/issues/102114

   (113) https://github.com/python/cpython/issues/62432

   (114) https://github.com/python/cpython/issues/78079

   (115) https://github.com/python/cpython/issues/85984

   (116) https://github.com/python/cpython/issues/101688

   (117) https://github.com/python/cpython/issues/101640

   (118) https://github.com/python/cpython/issues/83861

   (119) https://github.com/python/cpython/issues/89550

   (120) https://github.com/python/cpython/issues/95299

   (121) https://github.com/python/cpython/issues/99353

   (122) https://github.com/python/cpython/issues/98040

   (123) https://github.com/python/cpython/issues/97850

   (124) https://github.com/python/cpython/issues/94473

   (125) https://github.com/python/cpython/issues/98040

   (126) https://github.com/python/cpython/issues/96522

   (127) https://github.com/python/cpython/issues/96534

   (128) https://github.com/python/cpython/issues/87474

   (129) https://github.com/python/cpython/issues/94906

   (130) https://github.com/python/cpython/issues/51574

   (131) https://github.com/python/cpython/issues/94518

   (132) https://github.com/python/cpython/issues/92184

   (133) https://bugs.python.org/issue?@action=redirect&bpo=46797

   (134) https://bugs.python.org/issue?@action=redirect&bpo=44844

   (135) https://bugs.python.org/issue?@action=redirect&bpo=45606

   (136) https://bugs.python.org/issue?@action=redirect&bpo=23041

   (137) https://bugs.python.org/issue?@action=redirect&bpo=24964

   (138) https://bugs.python.org/issue?@action=redirect&bpo=17258

   (139) https://bugs.python.org/issue?@action=redirect&bpo=39744

   (140) https://bugs.python.org/issue?@action=redirect&bpo=22708


File: python.info,  Node: ドキュメント<21>,  Next: テスト<20>,  Prev: ライブラリ<67>,  Up: Python 3 12 0 beta 1

1.24.27.7 ドキュメント
......................

   - gh-67056(1): Document that the effect of registering or
     unregistering an *note atexit: d. cleanup function from within a
     registered cleanup function is undefined.

   - gh-103629(2): Mention the new way of typing ‘**kwargs’ with
     ‘Unpack’ and ‘TypedDict’ introduced in PEP 692(3).

   - gh-48241(4): Clarifying documentation about the url parameter to
     urllib.request.urlopen and urllib.request.Request needing to be
     encoded properly.

   - gh-86094(5): Add support for Unicode Path Extra Field in ZipFile.
     Patch by Yeojin Kim and Andrea Giudiceandrea

   - gh-99202(6): Fix extension type from documentation for compiling in
     C++20 mode

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/67056

   (2) https://github.com/python/cpython/issues/103629

   (3) https://peps.python.org/pep-0692/

   (4) https://github.com/python/cpython/issues/48241

   (5) https://github.com/python/cpython/issues/86094

   (6) https://github.com/python/cpython/issues/99202


File: python.info,  Node: テスト<20>,  Next: ビルド<23>,  Prev: ドキュメント<21>,  Up: Python 3 12 0 beta 1

1.24.27.8 テスト
................

   - gh-104494(1): Update ‘test_pack_configure_in’ and
     ‘test_place_configure_in’ for changes to error message formatting
     in Tk 8.7.

   - gh-104461(2): Run test_configure_screen on X11 only, since the
     ‘DISPLAY’ environment variable and ‘-screen’ option for toplevels
     are not useful on Tk for Win32 or Aqua.

   - gh-86275(3): Added property-based tests to the *note zoneinfo: 13a.
     tests, along with stubs for the ‘hypothesis’ interface.  (Patch by
     Paul Ganssle)

   - gh-103329(4): Regression tests for the behaviour of
     ‘unittest.mock.PropertyMock’ were added.

   - gh-102795(5): fix use of poll in test_epoll's test_control_and_wait

   - gh-75729(6): Fix the *note os.spawn*: 31b. tests failing on Windows
     when the working directory or interpreter path contains spaces.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104494

   (2) https://github.com/python/cpython/issues/104461

   (3) https://github.com/python/cpython/issues/86275

   (4) https://github.com/python/cpython/issues/103329

   (5) https://github.com/python/cpython/issues/102795

   (6) https://github.com/python/cpython/issues/75729


File: python.info,  Node: ビルド<23>,  Next: Windows<22>,  Prev: テスト<20>,  Up: Python 3 12 0 beta 1

1.24.27.9 ビルド
................

   - gh-101282(1): BOLT optimization is now applied to the libpython
     shared library if building a shared library.  BOLT instrumentation
     and application settings can now be influenced via the
     ‘BOLT_INSTRUMENT_FLAGS’ and ‘BOLT_APPLY_FLAGS’ configure variables.

   - gh-99017(2): ‘PYTHON_FOR_REGEN’ now require Python 3.10 or newer.

   - gh-104490(3): Define ‘.PHONY’ / virtual make targets consistently
     and properly.

   - gh-104106(4): Add gcc fallback of mkfifoat/mknodat for macOS. Patch
     by Donghee Na.

   - gh-103532(5): The ‘TKINTER_PROTECT_LOADTK’ macro is no longer
     defined or used in the ‘_tkinter’ module.  It was previously only
     defined when building against Tk 8.4.13 and older, but Tk older
     than 8.5.12 has been unsupported since gh-91152(6).

   - gh-99069(7): Extended workaround defining ‘static_assert’ when
     missing from the libc headers to all clang and gcc builds.  In
     particular, this fixes building on macOS <= 10.10.

   - gh-100220(8): Changed the default value of the ‘SHELL’ Makefile
     variable from ‘/bin/sh’ to ‘/bin/sh -e’ to ensure that complex
     recipes correctly fail after an error.  Previously, ‘make install’
     could fail to install some files and yet return a successful
     result.

   - gh-90656(9): Add platform triplets for 64-bit LoongArch:

        * loongarch64-linux-gnusf

        * loongarch64-linux-gnuf32

        * loongarch64-linux-gnu

     Patch by Zhang Na.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101282

   (2) https://github.com/python/cpython/issues/99017

   (3) https://github.com/python/cpython/issues/104490

   (4) https://github.com/python/cpython/issues/104106

   (5) https://github.com/python/cpython/issues/103532

   (6) https://github.com/python/cpython/issues/91152

   (7) https://github.com/python/cpython/issues/99069

   (8) https://github.com/python/cpython/issues/100220

   (9) https://github.com/python/cpython/issues/90656


File: python.info,  Node: Windows<22>,  Next: macOS<15>,  Prev: ビルド<23>,  Up: Python 3 12 0 beta 1

1.24.27.10 Windows
..................

   - gh-104623(1): Update Windows installer to use SQLite 3.42.0.

   - gh-82814(2): Fix a potential ‘[Errno 13] Permission denied’ when
     using *note shutil.copystat(): 1346. within Windows Subsystem for
     Linux (WSL) on a mounted filesystem by adding ‘errno.EACCES’ to the
     list of ignored errors within the internal implementation.

   - gh-103088(3): Fix virtual environment ‘activate’ script having
     incorrect line endings for Cygwin.

   - gh-103088(4): Fixes venvs not working in bash on Windows across
     different disks

   - gh-102997(5): Update Windows installer to use SQLite 3.41.2.

   - gh-88013(6): Fixed a bug where *note TypeError: 198. was raised
     when calling ‘ntpath.realpath()’ with a bytes parameter in some
     cases.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104623

   (2) https://github.com/python/cpython/issues/82814

   (3) https://github.com/python/cpython/issues/103088

   (4) https://github.com/python/cpython/issues/103088

   (5) https://github.com/python/cpython/issues/102997

   (6) https://github.com/python/cpython/issues/88013


File: python.info,  Node: macOS<15>,  Next: IDLE<14>,  Prev: Windows<22>,  Up: Python 3 12 0 beta 1

1.24.27.11 macOS
................

   - gh-99834(1): Update macOS installer to Tcl/Tk 8.6.13.

   - gh-104623(2): Update macOS installer to SQLite 3.42.0.

   - gh-103545(3): Add ‘os.PRIO_DARWIN_THREAD’,
     ‘os.PRIO_DARWIN_PROCESS’, ‘os.PRIO_DARWIN_BG’ and
     ‘os.PRIO_DARWIN_NONUI’.  These can be used with ‘os.setpriority’ to
     run the process at a lower priority and make use of the efficiency
     cores on Apple Silicon systems.

   - gh-104180(4): Support reading SOCKS proxy configuration from macOS
     System Configuration.  Patch by Sam Schott.

   - gh-60436(5): update curses textbox to additionally handle backspace
     using the ‘curses.ascii.DEL’ key press.

   - gh-102997(6): Update macOS installer to SQLite 3.41.2.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99834

   (2) https://github.com/python/cpython/issues/104623

   (3) https://github.com/python/cpython/issues/103545

   (4) https://github.com/python/cpython/issues/104180

   (5) https://github.com/python/cpython/issues/60436

   (6) https://github.com/python/cpython/issues/102997


File: python.info,  Node: IDLE<14>,  Next: Tools/Demos<20>,  Prev: macOS<15>,  Up: Python 3 12 0 beta 1

1.24.27.12 IDLE
...............

   - gh-104499(1): Fix completions for Tk Aqua 8.7 (currently blank).

   - gh-104496(2): About prints both tcl and tk versions if different
     (expected someday).

   - gh-88496(3): Fix IDLE test hang on macOS.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104499

   (2) https://github.com/python/cpython/issues/104496

   (3) https://github.com/python/cpython/issues/88496


File: python.info,  Node: Tools/Demos<20>,  Next: C API<23>,  Prev: IDLE<14>,  Up: Python 3 12 0 beta 1

1.24.27.13 Tools/Demos
......................

   - gh-104389(1): Argument Clinic C converters now accept the ‘unused’
     keyword, for wrapping a parameter with *note Py_UNUSED: 1a8a.
     Patch by Erlend E. Aasland.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/104389


File: python.info,  Node: C API<23>,  Prev: Tools/Demos<20>,  Up: Python 3 12 0 beta 1

1.24.27.14 C API
................

   - gh-101291(1): Added unstable C API for extracting the value of
     "compact" integers: *note PyUnstable_Long_IsCompact(): 7a6. and
     *note PyUnstable_Long_CompactValue(): 7a7.

   - gh-104109(2): We've added ‘Py_NewInterpreterFromConfig()’ and
     ‘PyInterpreterConfig’ to the public C-API (but not the stable ABI;
     not yet at least).  The new function may be used to create a new
     interpreter with various features configured.  The function was
     added to support PEP 684 (per-interpreter GIL).

   - gh-103968(3): *note PyType_FromSpec(): 79d. and its variants now
     allow creating classes whose metaclass overrides *note tp_new: 79f.
     The ‘tp_new’ is ignored.  This behavior is deprecated and will be
     disallowed in 3.14+.  The new *note PyType_FromMetaclass(): 772.
     already disallows it.

   - gh-103743(4): Add *note PyUnstable_Object_GC_NewWithExtraData():
     1aa8. function that can be used to allocate additional memory after
     an object for data not managed by Python.

   - gh-103295(5): Introduced *note PyUnstable_WritePerfMapEntry():
     1aa9, *note PyUnstable_PerfMapState_Init(): 1aaa. and *note
     PyUnstable_PerfMapState_Fini(): 1aab.  These allow extension
     modules (JIT compilers in particular) to write to perf-map files in
     a thread safe manner.  The *note Python support for the Linux perf
     profiler: 1aac. also uses these APIs to write entries in the
     perf-map file.

   - gh-103509(6): Added C API for extending types whose instance memory
     layout is opaque: *note PyType_Spec.basicsize: 76a. can now be zero
     or negative, *note PyObject_GetTypeData(): 76b. can be used to get
     subclass-specific data, and *note Py_TPFLAGS_ITEMS_AT_END: 76d. can
     be used to safely extend variable-size objects.  See PEP 697(7) for
     details.

   - gh-103091(8): Add a new C-API function to eagerly assign a version
     tag to a PyTypeObject: ‘PyUnstable_Type_AssignVersionTag()’.

   - gh-101408(9): *note PyObject_GC_Resize: 1aad. should calculate
     preheader size if needed.  Patch by Donghee Na.

   - gh-98836(10): Add support of more formatting options (left
     aligning, octals, uppercase hexadecimals, ‘intmax_t’, ‘ptrdiff_t’,
     ‘wchar_t’ C strings, variable width and precision) in *note
     PyUnicode_FromFormat(): 62b. and *note PyUnicode_FromFormatV():
     794.

   - gh-96803(11): Add unstable C-API functions to get the code object,
     lasti and line number from the internal ‘_PyInterpreterFrame’ in
     the limited API. The functions are:

        * ‘PyCodeObject * PyUnstable_InterpreterFrame_GetCode(struct
          _PyInterpreterFrame *frame)’

        * ‘int PyUnstable_InterpreterFrame_GetLasti(struct
          _PyInterpreterFrame *frame)’

        * ‘int PyUnstable_InterpreterFrame_GetLine(struct
          _PyInterpreterFrame *frame)’

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101291

   (2) https://github.com/python/cpython/issues/104109

   (3) https://github.com/python/cpython/issues/103968

   (4) https://github.com/python/cpython/issues/103743

   (5) https://github.com/python/cpython/issues/103295

   (6) https://github.com/python/cpython/issues/103509

   (7) https://peps.python.org/pep-0697/

   (8) https://github.com/python/cpython/issues/103091

   (9) https://github.com/python/cpython/issues/101408

   (10) https://github.com/python/cpython/issues/98836

   (11) https://github.com/python/cpython/issues/96803


File: python.info,  Node: Python 3 12 0 alpha 7,  Next: Python 3 12 0 alpha 6,  Prev: Python 3 12 0 beta 1,  Up: 変更履歴

1.24.28 Python 3.12.0 alpha 7
-----------------------------

'Release date: 2023-04-04'

* Menu:

* Core and Builtins: Core and Builtins<62>.
* ライブラリ: ライブラリ<68>.
* Core and Builtins: Core and Builtins<63>.
* ビルド: ビルド<24>.
* Core and Builtins: Core and Builtins<64>.
* ライブラリ: ライブラリ<69>.
* ドキュメント: ドキュメント<22>.
* テスト: テスト<21>.
* ビルド: ビルド<25>.
* Windows: Windows<23>.
* Tools/Demos: Tools/Demos<21>.
* C API: C API<24>.


File: python.info,  Node: Core and Builtins<62>,  Next: ライブラリ<68>,  Up: Python 3 12 0 alpha 7

1.24.28.1 Core and Builtins
...........................

   - gh-102192(1): Deprecated ‘_PyErr_ChainExceptions’ in favour of
     ‘_PyErr_ChainExceptions1’.

   - gh-89987(2): Reduce the number of inline *note CACHE: 908. entries
     for ‘BINARY_SUBSCR’.

   - gh-102859(3): Removed ‘JUMP_IF_FALSE_OR_POP’ and
     ‘JUMP_IF_TRUE_OR_POP’ instructions.

   - gh-101975(4): Fixed ‘stacktop’ value on tracing entries to avoid
     corruption on garbage collection.

   - gh-102778(5): Add *note sys.last_exc: 6e5. and deprecate *note
     sys.last_type: 6e6, *note sys.last_value: 6e7. and *note
     sys.last_traceback: 6e8, which hold the same information in its
     legacy form.

   - gh-100982(6): Replace all occurrences of ‘COMPARE_AND_BRANCH’ with
     *note COMPARE_OP: b61.

   - gh-102701(7): Fix overflow when creating very large dict.

   - gh-102755(8): Add *note PyErr_DisplayException(): 435. which takes
     just an exception instance, to replace the legacy ‘PyErr_Display()’
     which takes the ‘(typ, exc, tb)’ triplet.

   - gh-102594(9): Add note to exception raised in ‘PyErr_SetObject’
     when normalization fails.

   - gh-90997(10): Shrink the number of inline *note CACHE: 908. entries
     used by *note LOAD_GLOBAL: 1a5a.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102192

   (2) https://github.com/python/cpython/issues/89987

   (3) https://github.com/python/cpython/issues/102859

   (4) https://github.com/python/cpython/issues/101975

   (5) https://github.com/python/cpython/issues/102778

   (6) https://github.com/python/cpython/issues/100982

   (7) https://github.com/python/cpython/issues/102701

   (8) https://github.com/python/cpython/issues/102755

   (9) https://github.com/python/cpython/issues/102594

   (10) https://github.com/python/cpython/issues/90997


File: python.info,  Node: ライブラリ<68>,  Next: Core and Builtins<63>,  Prev: Core and Builtins<62>,  Up: Python 3 12 0 alpha 7

1.24.28.2 ライブラリ
....................

   - gh-102491(1): Improve import time of ‘platform’ by removing
     IronPython version parsing.  The IronPython version parsing was not
     functional (see
     ‘https://github.com/IronLanguages/ironpython3/issues/1667’).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102491


File: python.info,  Node: Core and Builtins<63>,  Next: ビルド<24>,  Prev: ライブラリ<68>,  Up: Python 3 12 0 alpha 7

1.24.28.3 Core and Builtins
...........................

   - gh-101291(1): Rearrage bits in first field (after header) of
     PyLongObject.  * Bits 0 and 1: 1 - sign.  I.e.  0 for positive
     numbers, 1 for zero and 2 for negative numbers.  * Bit 2 reserved
     (probably for the immortal bit) * Bits 3+ the unsigned size.

     This makes a few operations slightly more efficient, and will
     enable a more compact and faster 2s-complement representation of
     most ints in future.

   - gh-102397(2): Fix segfault from race condition in signal handling
     during garbage collection.  Patch by Kumar Aditya.

   - gh-102406(3): *note codecs: 1c. encoding/decoding errors now get
     the context information (which operation and which codecs) attached
     as PEP 678(4) notes instead of through chaining a new instance of
     the exception.

   - gh-102281(5): Fix potential nullptr dereference and use of
     uninitialized memory in fileutils.  Patch by Max Bachmann.

   - gh-102300(6): Reuse operands with refcount of 1 in float
     specializations of BINARY_OP.

   - gh-102213(7): Fix performance loss when accessing an object's
     attributes with ‘__getattr__’ defined.

   - gh-102255(8): Improve build support for the Xbox.  Patch by Max
     Bachmann.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101291

   (2) https://github.com/python/cpython/issues/102397

   (3) https://github.com/python/cpython/issues/102406

   (4) https://peps.python.org/pep-0678/

   (5) https://github.com/python/cpython/issues/102281

   (6) https://github.com/python/cpython/issues/102300

   (7) https://github.com/python/cpython/issues/102213

   (8) https://github.com/python/cpython/issues/102255


File: python.info,  Node: ビルド<24>,  Next: Core and Builtins<64>,  Prev: Core and Builtins<63>,  Up: Python 3 12 0 alpha 7

1.24.28.4 ビルド
................

   - gh-102027(1): Fix SSE2 and SSE3 detection in ‘_blake2’ internal
     module.  Patch by Max Bachmann.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102027


File: python.info,  Node: Core and Builtins<64>,  Next: ライブラリ<69>,  Prev: ビルド<24>,  Up: Python 3 12 0 alpha 7

1.24.28.5 Core and Builtins
...........................

   - gh-101865(1): Deprecate ‘co_lnotab’ in code objects, schedule it
     for removal in Python 3.14

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101865


File: python.info,  Node: ライブラリ<69>,  Next: ドキュメント<22>,  Prev: Core and Builtins<64>,  Up: Python 3 12 0 alpha 7

1.24.28.6 ライブラリ
....................

   - bpo-1635741(1): Adapt ‘_pickle’ to PEP 687(2).  Patch by Mohamed
     Koubaa and Erlend Aasland.

   - gh-103085(3): Pure python *note locale.getencoding(): 329. will not
     warn deprecation.

   - gh-103068(4): It's no longer possible to register conditional
     breakpoints in *note Pdb: 273. that raise *note SyntaxError: 18e.
     Patch by Tian Gao.

   - gh-102549(5): Don't ignore exceptions in member type creation.

   - gh-103056(6): Ensure final ‘_generate_next_value_’ is a
     ‘staticmethod’.

   - gh-103046(7): Display current line label correctly in *note dis:
     3c. when ‘show_caches’ is False and ‘lasti’ points to a CACHE
     entry.

   - gh-102433(8): *note isinstance(): 2ad. checks against *note
     runtime-checkable protocols: 675. now use *note
     inspect.getattr_static(): 6bc. rather than *note hasattr(): 6f9. to
     lookup whether attributes exist.  This means that descriptors and
     *note __getattr__(): 6fa. methods are no longer unexpectedly
     evaluated during ‘isinstance()’ checks against runtime-checkable
     protocols.  However, it may also mean that some objects which used
     to be considered instances of a runtime-checkable protocol may no
     longer be considered instances of that protocol on Python 3.12+,
     and vice versa.  Most users are unlikely to be affected by this
     change.  Patch by Alex Waygood.

   - gh-103023(9): It's no longer possible to register expressions to
     display in *note Pdb: 273. that raise *note SyntaxError: 18e.
     Patch by Tian Gao.

   - gh-102947(10): Improve traceback when *note dataclasses.fields():
     1935. is called on a non-dataclass.  Patch by Alex Waygood

   - gh-102780(11): The *note asyncio.Timeout: 1a40. context manager now
     works reliably even when performing cleanup due to task
     cancellation.  Previously it could raise a *note CancelledError:
     4d4. instead of an *note TimeoutError: 1ab5. in such cases.

   - gh-102871(12): Remove support for obsolete browsers from *note
     webbrowser: 11b.  Removed browsers include Grail, Mosaic, Netscape,
     Galeon, Skipstone, Iceape, Firebird, and Firefox versions 35 and
     below.

   - gh-102839(13): Improve performance of *note math.log(): 16d9.
     arguments handling by removing the argument clinic.

   - gh-102828(14): Add the ‘onexc’ arg to *note shutil.rmtree(): 356,
     which is like ‘onerror’ but expects an exception instance rather
     than an exc_info tuple.  Deprecate ‘onerror’.

   - gh-88965(15): typing: Fix a bug relating to substitution in custom
     classes generic over a *note ParamSpec: 487.  Previously, if the
     ‘ParamSpec’ was substituted with a parameters list that itself
     contained a *note TypeVar: 486, the ‘TypeVar’ in the parameters
     list could not be subsequently substituted.  This is now fixed.

     Patch by Nikita Sobolev.

   - gh-76846(16): Fix issue where ‘__new__()’ and ‘__init__()’ methods
     of *note pathlib.PurePath: 6cd. and *note Path: 266. subclasses
     were not called in some circumstances.

   - gh-78530(17): *note asyncio.wait(): 6a7. now accepts generators
     yielding tasks.  Patch by Kumar Aditya.

   - gh-102748(18): *note asyncio.iscoroutine(): 6a6. now returns
     ‘False’ for generators as *note asyncio: b. does not support legacy
     generator-based coroutines.  Patch by Kumar Aditya.

   - gh-102670(19): Optimized fmean(), correlation(), covariance(), and
     linear_regression() using the new math.sumprod() function.

   - gh-102615(20): Typing: Improve the ‘repr’ of generic aliases for
     classes generic over a *note ParamSpec: 487.  (Use square brackets
     to represent a parameter list.)

   - gh-100112(21): *note asyncio.Task.get_coro(): bcf. now always
     returns a coroutine when wrapping an awaitable object.  Patch by
     Kumar Aditya.

   - gh-102578(22): Speed up setting or deleting mutable attributes on
     non-dataclass subclasses of frozen dataclasses.  Due to the
     implementation of ‘__setattr__’ and ‘__delattr__’ for frozen
     dataclasses, this previously had a time complexity of 'O'('n').  It
     now has a time complexity of 'O'(1).

   - gh-102519(23): Add *note os.listdrives(): 6c5, *note
     os.listvolumes(): 6c6. and *note os.listmounts(): 6c7. functions on
     Windows for enumerating drives, volumes and mount points

   - gh-74468(24): Attribute name of the extracted *note tarfile: e4.
     file object now holds filename of itself rather than of the archive
     it is contained in.  Patch by Oleg Iarygin.

   - gh-102378(25): Private helper method
     ‘inspect._signature_strip_non_python_syntax’ will no longer strip
     ‘/’ from the input string.

   - gh-79940(26): Add *note inspect.getasyncgenstate(): 6ba. and *note
     inspect.getasyncgenlocals(): 6bb.  Patch by Thomas Krennwallner.

   - gh-102103(27): Add ‘module’ argument to *note
     dataclasses.make_dataclass(): 185c. and make classes produced by it
     pickleable.

   - gh-102069(28): Fix ‘__weakref__’ descriptor generation for custom
     dataclasses.

   - gh-102038(29): Skip a ‘stat’ in *note site: cc. if we have already
     found a ‘pyvenv.cfg’

   - gh-98886(30): Fix issues when defining dataclasses that have fields
     with specific underscore names that aren't clearly reserved by
     *note dataclasses: 33.

   - gh-101673(31): Fix a *note pdb: aa. bug where ‘ll’ clears the
     changes to local variables.

   - gh-101313(32): Added -h and -help arguments to the webbrowser CLI

   - gh-100372(33): *note ssl.SSLContext.load_verify_locations(): 10ee.
     no longer incorrectly accepts some cases of trailing data when
     parsing DER.

   - gh-89727(34): Fix pathlib.Path.walk RecursionError on deep
     directory trees by rewriting it using iteration instead of
     recursion.

   - gh-100131(35): Added an optional ‘delete’ keyword argument to *note
     tempfile.TemporaryDirectory: 144c.

   - gh-48330(36): Added ‘--durations’ command line option, showing the
     N slowest test cases.  *note unittest.TextTestRunner: 1ab6. and
     *note unittest.TextTestResult: 754. constructors accept a new
     'durations' keyword argument.  Subclasses should take this into
     account or accept ‘**kwargs’.  Added *note
     unittest.TestResult.addDuration(): 1ab7. method and *note
     unittest.TestResult.collectedDurations: 1a7c. attribute.

     (Contributed by Giampaolo Rodola)

   - gh-98169(37): Fix *note dataclasses.astuple(): 1a9e. crash when
     *note collections.defaultdict: 13d4. is present in the attributes.

   - gh-96931(38): Fix incorrect results from *note
     ssl.SSLSocket.shared_ciphers(): 106c.

   - gh-95495(39): When built against OpenSSL 3.0, the *note ssl: d5.
     module had a bug where it reported unauthenticated EOFs (i.e.
     without close_notify) as a clean TLS-level EOF. It now raises *note
     SSLEOFError: 1ab8, matching the behavior in previous versions of
     OpenSSL. The *note options: a39. attribute on *note SSLContext:
     357. also no longer includes *note OP_IGNORE_UNEXPECTED_EOF: a38.
     by default.  This option may be set to specify the previous OpenSSL
     3.0 behavior.

   - gh-94684(40): Now *note uuid.uuid3(): 2e5. and *note uuid.uuid5():
     2e6. functions support *note bytes: 192. objects as their 'name'
     argument.

   - gh-94440(41): Fix a ‘concurrent.futures.process’ bug where
     ‘ProcessPoolExecutor’ shutdown could hang after a future has been
     quickly submitted and canceled.

   - gh-72346(42): Added deprecation warning to 'isdst' parameter of
     *note email.utils.localtime(): 2f7.

   - bpo-36305(43): Fix handling of Windows filenames that resemble
     drives, such as ‘./a:b’, in *note pathlib: a8.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (2) https://peps.python.org/pep-0687/

   (3) https://github.com/python/cpython/issues/103085

   (4) https://github.com/python/cpython/issues/103068

   (5) https://github.com/python/cpython/issues/102549

   (6) https://github.com/python/cpython/issues/103056

   (7) https://github.com/python/cpython/issues/103046

   (8) https://github.com/python/cpython/issues/102433

   (9) https://github.com/python/cpython/issues/103023

   (10) https://github.com/python/cpython/issues/102947

   (11) https://github.com/python/cpython/issues/102780

   (12) https://github.com/python/cpython/issues/102871

   (13) https://github.com/python/cpython/issues/102839

   (14) https://github.com/python/cpython/issues/102828

   (15) https://github.com/python/cpython/issues/88965

   (16) https://github.com/python/cpython/issues/76846

   (17) https://github.com/python/cpython/issues/78530

   (18) https://github.com/python/cpython/issues/102748

   (19) https://github.com/python/cpython/issues/102670

   (20) https://github.com/python/cpython/issues/102615

   (21) https://github.com/python/cpython/issues/100112

   (22) https://github.com/python/cpython/issues/102578

   (23) https://github.com/python/cpython/issues/102519

   (24) https://github.com/python/cpython/issues/74468

   (25) https://github.com/python/cpython/issues/102378

   (26) https://github.com/python/cpython/issues/79940

   (27) https://github.com/python/cpython/issues/102103

   (28) https://github.com/python/cpython/issues/102069

   (29) https://github.com/python/cpython/issues/102038

   (30) https://github.com/python/cpython/issues/98886

   (31) https://github.com/python/cpython/issues/101673

   (32) https://github.com/python/cpython/issues/101313

   (33) https://github.com/python/cpython/issues/100372

   (34) https://github.com/python/cpython/issues/89727

   (35) https://github.com/python/cpython/issues/100131

   (36) https://github.com/python/cpython/issues/48330

   (37) https://github.com/python/cpython/issues/98169

   (38) https://github.com/python/cpython/issues/96931

   (39) https://github.com/python/cpython/issues/95495

   (40) https://github.com/python/cpython/issues/94684

   (41) https://github.com/python/cpython/issues/94440

   (42) https://github.com/python/cpython/issues/72346

   (43) https://bugs.python.org/issue?@action=redirect&bpo=36305


File: python.info,  Node: ドキュメント<22>,  Next: テスト<21>,  Prev: ライブラリ<69>,  Up: Python 3 12 0 alpha 7

1.24.28.7 ドキュメント
......................

   - gh-103112(1): Add docstring to *note
     http.client.HTTPResponse.read(): 18af. to fix ‘pydoc’ output.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/103112


File: python.info,  Node: テスト<21>,  Next: ビルド<25>,  Prev: ドキュメント<22>,  Up: Python 3 12 0 alpha 7

1.24.28.8 テスト
................

   - gh-102980(1): Improve test coverage on *note pdb: aa.

   - gh-102537(2): Adjust the error handling strategy in
     ‘test_zoneinfo.TzPathTest.python_tzpath_context’.  Patch by Paul
     Ganssle.

   - gh-101377(3): Improved test_locale_calendar_formatweekday of
     calendar.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102980

   (2) https://github.com/python/cpython/issues/102537

   (3) https://github.com/python/cpython/issues/101377


File: python.info,  Node: ビルド<25>,  Next: Windows<23>,  Prev: テスト<21>,  Up: Python 3 12 0 alpha 7

1.24.28.9 ビルド
................

   - gh-102973(1): Add a dev container (along with accompanying
     Dockerfile) for development purposes.

   - gh-102711(2): Fix ‘-Wstrict-prototypes’ compiler warnings.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102973

   (2) https://github.com/python/cpython/issues/102711


File: python.info,  Node: Windows<23>,  Next: Tools/Demos<21>,  Prev: ビルド<25>,  Up: Python 3 12 0 alpha 7

1.24.28.10 Windows
..................

   - gh-102690(1): Update *note webbrowser: 11b. to fall back to
     Microsoft Edge instead of Internet Explorer.

   - gh-99726(2): Improves correctness of stat results for Windows, and
     uses faster API when available

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102690

   (2) https://github.com/python/cpython/issues/99726


File: python.info,  Node: Tools/Demos<21>,  Next: C API<24>,  Prev: Windows<23>,  Up: Python 3 12 0 alpha 7

1.24.28.11 Tools/Demos
......................

   - gh-102809(1): ‘Misc/gdbinit’ was removed.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102809


File: python.info,  Node: C API<24>,  Prev: Tools/Demos<21>,  Up: Python 3 12 0 alpha 7

1.24.28.12 C API
................

   - gh-102013(1): Add a new (unstable) C-API function for iterating
     over GC'able objects using a callback: ‘PyUnstable_VisitObjects’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102013


File: python.info,  Node: Python 3 12 0 alpha 6,  Next: Python 3 12 0 alpha 5,  Prev: Python 3 12 0 alpha 7,  Up: 変更履歴

1.24.29 Python 3.12.0 alpha 6
-----------------------------

'Release date: 2023-03-07'

* Menu:

* セキュリティ: セキュリティ<23>.
* Core and Builtins: Core and Builtins<65>.
* ライブラリ: ライブラリ<70>.
* ドキュメント: ドキュメント<23>.
* テスト: テスト<22>.
* ビルド: ビルド<26>.
* Windows: Windows<24>.
* macOS: macOS<16>.
* C API: C API<25>.


File: python.info,  Node: セキュリティ<23>,  Next: Core and Builtins<65>,  Up: Python 3 12 0 alpha 6

1.24.29.1 セキュリティ
......................

   - gh-99108(1): Replace builtin hashlib implementations of MD5 and
     SHA1 with verified ones from the HACL* project.

   - gh-101727(2): Updated the OpenSSL version used in Windows and macOS
     binary release builds to 1.1.1t to address CVE 2023-0286(3), CVE
     2022-4303(4), and CVE 2022-4303(5) per the OpenSSL 2023-02-07
     security advisory(6).

   - gh-99108(7): Replace the builtin *note hashlib: 6c. implementations
     of SHA2-384 and SHA2-512 originally from LibTomCrypt with formally
     verified, side-channel resistant code from the HACL*(8) project.
     The builtins remain a fallback only used when OpenSSL does not
     provide them.

   - gh-101283(9): *note subprocess.Popen: 4b7. now uses a safer
     approach to find ‘cmd.exe’ when launching with ‘shell=True’.  Patch
     by Eryk Sun, based on a patch by Oleg Iarygin.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99108

   (2) https://github.com/python/cpython/issues/101727

   (3) https://www.cve.org/CVERecord?id=CVE-2023-0286

   (4) https://www.cve.org/CVERecord?id=CVE-2022-4303

   (5) https://www.cve.org/CVERecord?id=CVE-2022-4303

   (6) https://openssl-library.org/news/secadv/20230207.txt

   (7) https://github.com/python/cpython/issues/99108

   (8) https://github.com/hacl-star/hacl-star/

   (9) https://github.com/python/cpython/issues/101283


File: python.info,  Node: Core and Builtins<65>,  Next: ライブラリ<70>,  Prev: セキュリティ<23>,  Up: Python 3 12 0 alpha 6

1.24.29.2 Core and Builtins
...........................

   - gh-102493(1): Fix regression in semantics of normalisation in
     ‘PyErr_SetObject’.

   - gh-102416(2): Do not memoize incorrectly automatically generated
     loop rules in the parser.  Patch by Pablo Galindo.

   - gh-102356(3): Fix a bug that caused a crash when deallocating
     deeply nested filter objects.  Patch by Marta Gómez Macías.

   - gh-102336(4): Cleanup Windows 7 specific special handling.  Patch
     by Max Bachmann.

   - gh-102250(5): Fixed a segfault occurring when the interpreter calls
     a ‘__bool__’ method that raises.

   - gh-102126(6): Fix deadlock at shutdown when clearing thread states
     if any finalizer tries to acquire the runtime head lock.  Patch by
     Kumar Aditya.

   - gh-102027(7): Use ‘GetCurrentProcessId’ on Windows when ‘getpid’ is
     unavailable.  Patch by Max Bachmann.

   - gh-102056(8): Fix error handling bugs in interpreter's exception
     printing code, which could cause a crash on infinite recursion.

   - gh-100982(9): Restrict the scope of the ‘FOR_ITER_RANGE’
     instruction to the scope of the original *note FOR_ITER: 1ac2.
     instruction, to allow instrumentation.

   - gh-101967(10): Fix possible segfault in
     ‘positional_only_passed_as_keyword’ function, when new list
     created.

   - gh-101952(11): Fix possible segfault in ‘BUILD_SET’ opcode, when
     new set created.

   - gh-74895(12): *note socket.getaddrinfo: 1ac3. no longer raises
     *note OverflowError: a81. for *note int: 19b. 'port' values outside
     of the C long range.  Out of range values are left up to the
     underlying string based C library API to report.  A *note
     socket.gaierror: 1ac4. ‘SAI_SERVICE’ may occur instead, or no error
     at all as not all platform C libraries generate an error.

   - gh-101799(13): Add *note CALL_INTRINSIC_2: 708. and use it instead
     of ‘PREP_RERAISE_STAR’.

   - gh-101857(14): Fix xattr support detection on Linux systems by
     widening the check to linux, not just glibc.  This fixes support
     for musl.

   - gh-84783(15): Make the slice object hashable.  Patch by Will
     Bradshaw and Furkan Onder.

   - gh-87849(16): Change the ‘SEND’ instruction to leave the receiver
     on the stack.  This allows the specialized form of ‘SEND’ to skip
     the chain of C calls and jump directly to the ‘RESUME’ in the
     generator or coroutine.

   - gh-101765(17): Fix SystemError / segmentation fault in iter
     ‘__reduce__’ when internal access of ‘builtins.__dict__’ keys
     mutates the iter object.

   - gh-101430(18): Update *note tracemalloc: 105. to handle presize of
     object properly.  Patch by Donghee Na.

   - gh-101696(19): Invalidate type version tag in
     ‘_PyStaticType_Dealloc’ for static types, avoiding bug where a
     false cache hit could crash the interpreter.  Patch by Kumar
     Aditya.

   - gh-101632(20): Adds a new ‘RETURN_CONST’ instruction.

   - gh-100719(21): Remove gi_code field from generator (and coroutine
     and async generator) objects as it is redundant.  The frame already
     includes a reference to the code object.

   - gh-98627(22): When an interpreter is configured to check (and only
     then), importing an extension module will now fail when the
     extension does not support multiple interpreters (i.e.  doesn't
     implement PEP 489 multi-phase init).  This does not apply to the
     main interpreter, nor to subinterpreters created with
     ‘Py_NewInterpreter()’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102493

   (2) https://github.com/python/cpython/issues/102416

   (3) https://github.com/python/cpython/issues/102356

   (4) https://github.com/python/cpython/issues/102336

   (5) https://github.com/python/cpython/issues/102250

   (6) https://github.com/python/cpython/issues/102126

   (7) https://github.com/python/cpython/issues/102027

   (8) https://github.com/python/cpython/issues/102056

   (9) https://github.com/python/cpython/issues/100982

   (10) https://github.com/python/cpython/issues/101967

   (11) https://github.com/python/cpython/issues/101952

   (12) https://github.com/python/cpython/issues/74895

   (13) https://github.com/python/cpython/issues/101799

   (14) https://github.com/python/cpython/issues/101857

   (15) https://github.com/python/cpython/issues/84783

   (16) https://github.com/python/cpython/issues/87849

   (17) https://github.com/python/cpython/issues/101765

   (18) https://github.com/python/cpython/issues/101430

   (19) https://github.com/python/cpython/issues/101696

   (20) https://github.com/python/cpython/issues/101632

   (21) https://github.com/python/cpython/issues/100719

   (22) https://github.com/python/cpython/issues/98627


File: python.info,  Node: ライブラリ<70>,  Next: ドキュメント<23>,  Prev: Core and Builtins<65>,  Up: Python 3 12 0 alpha 6

1.24.29.3 ライブラリ
....................

   - gh-102302(1): Micro-optimise hashing of *note inspect.Parameter:
     4e4, reducing the time it takes to hash an instance by around 40%.

   - gh-101979(2): Fix a bug where parentheses in the ‘metavar’ argument
     to *note argparse.ArgumentParser.add_argument(): 4bc. were dropped.
     Patch by Yeojin Kim.

   - gh-91038(3): *note platform.platform(): 1ac6. now has boolean
     default arguments.

   - gh-81652(4): Add *note mmap.MAP_ALIGNED_SUPER: 1ac7. FreeBSD and
     *note mmap.MAP_CONCEAL: 1ac8. OpenBSD constants to *note mmap: 94.
     Patch by Yeojin Kim.

   - gh-102179(5): Fix *note os.dup2(): d5a. error message for negative
     fds.

   - gh-101961(6): For the binary mode, ‘fileinput.hookcompressed()’
     doesn't set the ‘encoding’ value even if the value is ‘None’.
     Patch by Gihwan Kim.

   - gh-101936(7): The default value of ‘fp’ becomes *note io.BytesIO:
     10a4. if *note HTTPError: 11e0. is initialized without a designated
     ‘fp’ parameter.  Patch by Long Vo.

   - gh-101566(8): In zipfile, sync Path with zipp 3.14(9), including
     fix for extractall on the underlying zipfile after being wrapped in
     ‘Path’.

   - gh-97930(10): Apply changes from importlib_resources 5.12(11),
     including fix for ‘MultiplexedPath’ to support directories in
     multiple namespaces (python/importlib_resources#265).

   - gh-101997(12): Upgrade pip wheel bundled with ensurepip (pip
     23.0.1)

   - gh-99108(13): The built-in extension modules for *note hashlib: 6c.
     SHA2 algorithms, used when OpenSSL does not provide them, now live
     in a single internal ‘_sha2’ module instead of separate ‘_sha256’
     and ‘_sha512’ modules.

   - gh-101892(14): Callable iterators no longer raise *note
     SystemError: 795. when the callable object exhausts the iterator
     but forgets to either return a sentinel value or raise *note
     StopIteration: df5.

   - gh-87634(15): Remove locking behavior from *note
     functools.cached_property(): 763.

   - gh-97786(16): Fix potential undefined behaviour in corner cases of
     floating-point-to-time conversions.

   - gh-101517(17): Fixed bug where *note bdb: 10. looks up the source
     line with *note linecache: 89. with a ‘lineno=None’, which causes
     it to fail with an unhandled exception.

   - gh-101773(18): Optimize *note fractions.Fraction: 213. for small
     components.  The private argument ‘_normalize’ of the *note
     fractions.Fraction: 213. constructor has been removed.

   - gh-101693(19): In *note sqlite3.Cursor.execute(): 5b0, *note
     DeprecationWarning: 1a3. is now emitted when *note named
     placeholders: 5b2. are used together with parameters supplied as a
     *note sequence: 716. instead of as a *note dict: 183.  Starting
     from Python 3.14, using named placeholders with parameters supplied
     as a sequence will raise a *note ProgrammingError: 305.  Patch by
     Erlend E. Aasland.

   - gh-101446(20): Change repr of *note collections.OrderedDict: 7f3.
     to use regular dictionary formatting instead of pairs of keys and
     values.

   - gh-101362(21): Speed up *note pathlib.PurePath: 6cd. construction
     by handling arguments more uniformly.  When a *note pathlib.Path:
     266. argument is supplied, we use its string representation rather
     than joining its parts with *note os.path.join(): 19a9.

   - gh-101362(22): Speed up *note pathlib.PurePath: 6cd. construction
     by calling *note os.path.join(): 19a9. only when two or more
     arguments are given.

   - gh-101362(23): Speed up *note pathlib.Path: 266. construction by
     running the path flavour compatibility check only when pathlib is
     imported.

   - gh-85984(24): Refactored the implementation of *note pty.fork():
     1ac9. to use *note os.login_tty(): 1aca.

     A *note DeprecationWarning: 1a3. is now raised by
     ‘pty.master_open()’ and ‘pty.slave_open()’.  They were undocumented
     and deprecated long long ago in the docstring in favor of *note
     pty.openpty(): 301.

   - gh-101561(25): Add a new decorator *note typing.override(): 67d.
     See PEP 698(26) for details.  Patch by Steven Troxler.

   - gh-63301(27): Set exit code when *note tabnanny: e3. CLI exits on
     error.

   - gh-101360(28): Fix anchor matching in
     ‘pathlib.PureWindowsPath.match()’.  Path and pattern anchors are
     now matched with *note fnmatch: 60, just like other path parts.
     This allows patterns such as ‘"*:/Users/*"’ to be matched.

   - gh-101277(29): Remove global state from *note itertools: 85. module
     ( PEP 687(30)).  Patches by Erlend E. Aasland.

   - gh-100809(31): Fix handling of drive-relative paths (like 'C:' and
     'C:foo') in *note pathlib.Path.absolute(): 1a26.  This method now
     uses the OS API to retrieve the correct current working directory
     for the drive.

   - gh-99138(32): Apply PEP 687(33) to *note zoneinfo: 13a.  Patch by
     Erlend E. Aasland.

   - gh-96764(34): *note asyncio.wait_for(): 815. now uses *note
     asyncio.timeout(): 814. as its underlying implementation.  Patch by
     Kumar Aditya.

   - gh-88233(35): Correctly preserve "extra" fields in ‘zipfile’
     regardless of their ordering relative to a zip64 "extra."

   - bpo-23224(36): Fix segfaults when creating *note
     lzma.LZMADecompressor: 1acb. and *note bz2.BZ2Decompressor: 1acc.
     objects without calling ‘__init__()’, and fix leakage of locks and
     internal buffers when calling the ‘__init__()’ methods of *note
     lzma.LZMADecompressor: 1acb, *note lzma.LZMACompressor: 1acd, *note
     bz2.BZ2Compressor: 1ace, and *note bz2.BZ2Decompressor: 1acc.
     objects multiple times.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102302

   (2) https://github.com/python/cpython/issues/101979

   (3) https://github.com/python/cpython/issues/91038

   (4) https://github.com/python/cpython/issues/81652

   (5) https://github.com/python/cpython/issues/102179

   (6) https://github.com/python/cpython/issues/101961

   (7) https://github.com/python/cpython/issues/101936

   (8) https://github.com/python/cpython/issues/101566

   (9) https://zipp.readthedocs.io/en/latest/history.html#v3-14-0

   (10) https://github.com/python/cpython/issues/97930

   (11) 
https://importlib-resources.readthedocs.io/en/latest/history.html#v5-12-0

   (12) https://github.com/python/cpython/issues/101997

   (13) https://github.com/python/cpython/issues/99108

   (14) https://github.com/python/cpython/issues/101892

   (15) https://github.com/python/cpython/issues/87634

   (16) https://github.com/python/cpython/issues/97786

   (17) https://github.com/python/cpython/issues/101517

   (18) https://github.com/python/cpython/issues/101773

   (19) https://github.com/python/cpython/issues/101693

   (20) https://github.com/python/cpython/issues/101446

   (21) https://github.com/python/cpython/issues/101362

   (22) https://github.com/python/cpython/issues/101362

   (23) https://github.com/python/cpython/issues/101362

   (24) https://github.com/python/cpython/issues/85984

   (25) https://github.com/python/cpython/issues/101561

   (26) https://peps.python.org/pep-0698/

   (27) https://github.com/python/cpython/issues/63301

   (28) https://github.com/python/cpython/issues/101360

   (29) https://github.com/python/cpython/issues/101277

   (30) https://peps.python.org/pep-0687/

   (31) https://github.com/python/cpython/issues/100809

   (32) https://github.com/python/cpython/issues/99138

   (33) https://peps.python.org/pep-0687/

   (34) https://github.com/python/cpython/issues/96764

   (35) https://github.com/python/cpython/issues/88233

   (36) https://bugs.python.org/issue?@action=redirect&bpo=23224


File: python.info,  Node: ドキュメント<23>,  Next: テスト<22>,  Prev: ライブラリ<70>,  Up: Python 3 12 0 alpha 6

1.24.29.4 ドキュメント
......................

   - gh-85417(1): Update *note cmath: 19. documentation to clarify
     behaviour on branch cuts.

   - gh-97725(2): Fix *note asyncio.Task.print_stack(): 1ad0.
     description for ‘file=None’.  Patch by Oleg Iarygin.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/85417

   (2) https://github.com/python/cpython/issues/97725


File: python.info,  Node: テスト<22>,  Next: ビルド<26>,  Prev: ドキュメント<23>,  Up: Python 3 12 0 alpha 6

1.24.29.5 テスト
................

   - gh-102019(1): Fix deadlock on shutdown if
     ‘test_current_{exception,frames}’ fails.  Patch by Jacob Bower.

   - gh-85984(2): Utilize new "winsize" functions from termios in pty
     tests.

   - gh-89792(3): ‘test_tools’ now copies up to 10x less source data to
     a temporary directory during the ‘freeze’ test by ignoring git
     metadata and other artifacts.  It also limits its python build
     parallelism based on os.cpu_count instead of hard coding it as 8
     cores.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102019

   (2) https://github.com/python/cpython/issues/85984

   (3) https://github.com/python/cpython/issues/89792


File: python.info,  Node: ビルド<26>,  Next: Windows<24>,  Prev: テスト<22>,  Up: Python 3 12 0 alpha 6

1.24.29.6 ビルド
................

   - gh-99942(1): On Android, in a static build, python-config in embed
     mode no longer incorrectly reports a library to link to.

   - gh-99942(2): On Android, python.pc now correctly reports the
     library to link to, the same as python-config.sh.

   - gh-100221(3): Fix creating install directories in ‘make
     sharedinstall’ if they exist outside ‘DESTDIR’ already.

   - gh-96821(4): Explicitly mark C extension modules that need defined
     signed integer overflow, and add a configure option *note
     -with-strict-overflow: 1ad3.  Patch by Matthias Görgens and
     Shantanu Jain.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99942

   (2) https://github.com/python/cpython/issues/99942

   (3) https://github.com/python/cpython/issues/100221

   (4) https://github.com/python/cpython/issues/96821


File: python.info,  Node: Windows<24>,  Next: macOS<16>,  Prev: ビルド<26>,  Up: Python 3 12 0 alpha 6

1.24.29.7 Windows
.................

   - gh-102344(1): Implement ‘winreg.QueryValue’ using ‘QueryValueEx’
     and ‘winreg.SetValue’ using ‘SetValueEx’.  Patch by Max Bachmann.

   - gh-101881(2): Handle read and write operations on non-blocking
     pipes properly on Windows.

   - gh-101881(3): Add support for the os.get_blocking() and
     os.set_blocking() functions on Windows.

   - gh-101849(4): Ensures installer will correctly upgrade existing
     ‘py.exe’ launcher installs.

   - gh-101763(5): Updates copy of libffi bundled with Windows installs
     to 3.4.4.

   - gh-101759(6): Update Windows installer to SQLite 3.40.1.

   - gh-101614(7): Correctly handle extensions built against debug
     binaries that reference ‘python3_d.dll’.

   - gh-101196(8): The functions ‘os.path.isdir’, ‘os.path.isfile’,
     ‘os.path.islink’ and ‘os.path.exists’ are now 13% to 28% faster on
     Windows, by making fewer Win32 API calls.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/102344

   (2) https://github.com/python/cpython/issues/101881

   (3) https://github.com/python/cpython/issues/101881

   (4) https://github.com/python/cpython/issues/101849

   (5) https://github.com/python/cpython/issues/101763

   (6) https://github.com/python/cpython/issues/101759

   (7) https://github.com/python/cpython/issues/101614

   (8) https://github.com/python/cpython/issues/101196


File: python.info,  Node: macOS<16>,  Next: C API<25>,  Prev: Windows<24>,  Up: Python 3 12 0 alpha 6

1.24.29.8 macOS
...............

   - gh-101759(1): Update macOS installer to SQLite 3.40.1.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101759


File: python.info,  Node: C API<25>,  Prev: macOS<16>,  Up: Python 3 12 0 alpha 6

1.24.29.9 C API
...............

   - gh-101907(1): Removes use of non-standard C++ extension in public
     header files.

   - gh-99293(2): Document that the Py_TPFLAGS_VALID_VERSION_TAG is an
     internal feature, should not be used, and will be removed.

   - gh-101578(3): Add *note PyErr_GetRaisedException(): 429. and *note
     PyErr_SetRaisedException(): 42c. for saving and restoring the
     current exception.  These functions return and accept a single
     exception object, rather than the triple arguments of the
     now-deprecated *note PyErr_Fetch(): 428. and *note PyErr_Restore():
     42b.  This is less error prone and a bit more efficient.

     Add *note PyException_GetArgs(): 78b. and *note
     PyException_SetArgs(): 78c. as convenience functions for retrieving
     and modifying the *note args: 78d. passed to the exception's
     constructor.

   - gh-91744(4): Introduced the 'Unstable C API tier', marking APi that
     is allowed to change in minor releases without a deprecation
     period.  See PEP 689(5) for details.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101907

   (2) https://github.com/python/cpython/issues/99293

   (3) https://github.com/python/cpython/issues/101578

   (4) https://github.com/python/cpython/issues/91744

   (5) https://peps.python.org/pep-0689/


File: python.info,  Node: Python 3 12 0 alpha 5,  Next: Python 3 12 0 alpha 4,  Prev: Python 3 12 0 alpha 6,  Up: 変更履歴

1.24.30 Python 3.12.0 alpha 5
-----------------------------

'Release date: 2023-02-07'

* Menu:

* セキュリティ: セキュリティ<24>.
* Core and Builtins: Core and Builtins<66>.
* ライブラリ: ライブラリ<71>.
* ドキュメント: ドキュメント<24>.
* テスト: テスト<23>.
* ビルド: ビルド<27>.
* Windows: Windows<25>.


File: python.info,  Node: セキュリティ<24>,  Next: Core and Builtins<66>,  Up: Python 3 12 0 alpha 5

1.24.30.1 セキュリティ
......................

   - gh-99108(1): Replace the builtin *note hashlib: 6c. implementations
     of SHA2-224 and SHA2-256 originally from LibTomCrypt with formally
     verified, side-channel resistant code from the HACL*(2) project.
     The builtins remain a fallback only used when OpenSSL does not
     provide them.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99108

   (2) https://github.com/hacl-star/hacl-star/


File: python.info,  Node: Core and Builtins<66>,  Next: ライブラリ<71>,  Prev: セキュリティ<24>,  Up: Python 3 12 0 alpha 5

1.24.30.2 Core and Builtins
...........................

   - gh-92173(1): Fix the ‘defs’ and ‘kwdefs’ arguments to *note
     PyEval_EvalCodeEx(): 1ada. and a reference leak in that function.

   - gh-59956(2): The GILState API is now partially compatible with
     subinterpreters.  Previously, ‘PyThreadState_GET()’ and
     ‘PyGILState_GetThisThreadState()’ would get out of sync, causing
     inconsistent behavior and crashes.

   - gh-101400(3): Fix wrong lineno in exception message on *note
     continue: 180. or *note break: 17f. which are not in a loop.  Patch
     by Donghee Na.

   - gh-101372(4): Fix *note is_normalized(): c3c. to properly handle
     the UCD 3.2.0 cases.  Patch by Donghee Na.

   - gh-101266(5): Fix *note sys.getsizeof(): 1adb. reporting for *note
     int: 19b. subclasses.

   - gh-101291(6): Refactor the ‘PyLongObject’ struct into a normal
     Python object header and a ‘PyLongValue’ struct.

   - gh-101046(7): Fix a possible memory leak in the parser when raising
     *note MemoryError: 179e.  Patch by Pablo Galindo

   - gh-101037(8): Fix potential memory underallocation issue for
     instances of *note int: 19b. subclasses with value zero.

   - gh-100762(9): Record the (virtual) exception block depth in the
     oparg of *note YIELD_VALUE: 5ba.  Use this to avoid the expensive
     ‘throw()’ when closing generators (and coroutines) that can be
     closed trivially.

   - gh-100982(10): Adds a new ‘COMPARE_AND_BRANCH’ instruction.  This
     is a bit more efficient when performing a comparison immediately
     followed by a branch, and restores the design intent of PEP 659
     that specializations are local to a single instruction.

   - gh-100942(11): Fixed segfault in property.getter/setter/deleter
     that occurred when a property subclass overrode the ‘__new__’
     method to return a non-property instance.

   - gh-100923(12): Remove the ‘mask’ cache entry for the *note
     COMPARE_OP: b61. instruction and embed the mask into the oparg.

   - gh-100892(13): Fix race while iterating over thread states in
     clearing *note threading.local: 185f.  Patch by Kumar Aditya.

   - gh-91351(14): Fix a case where re-entrant imports could corrupt the
     import deadlock detection code and cause a *note KeyError: 5e7. to
     be raised out of ‘importlib/_bootstrap’.  In addition to the
     straightforward cases, this could also happen when garbage
     collection leads to a warning being emitted - as happens when it
     collects an open socket or file)

   - gh-100726(15): Optimize construction of ‘range’ object for medium
     size integers.

   - gh-100712(16): Added option to build cpython with specialization
     disabled, by setting ‘ENABLE_SPECIALIZATION=False’ in ‘opcode’,
     followed by ‘make regen-all’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/92173

   (2) https://github.com/python/cpython/issues/59956

   (3) https://github.com/python/cpython/issues/101400

   (4) https://github.com/python/cpython/issues/101372

   (5) https://github.com/python/cpython/issues/101266

   (6) https://github.com/python/cpython/issues/101291

   (7) https://github.com/python/cpython/issues/101046

   (8) https://github.com/python/cpython/issues/101037

   (9) https://github.com/python/cpython/issues/100762

   (10) https://github.com/python/cpython/issues/100982

   (11) https://github.com/python/cpython/issues/100942

   (12) https://github.com/python/cpython/issues/100923

   (13) https://github.com/python/cpython/issues/100892

   (14) https://github.com/python/cpython/issues/91351

   (15) https://github.com/python/cpython/issues/100726

   (16) https://github.com/python/cpython/issues/100712


File: python.info,  Node: ライブラリ<71>,  Next: ドキュメント<24>,  Prev: Core and Builtins<66>,  Up: Python 3 12 0 alpha 5

1.24.30.3 ライブラリ
....................

   - bpo-32780(1): Inter-field padding is now inserted into the PEP3118
     format strings obtained from *note ctypes.Structure: 1e5. objects,
     reflecting their true representation in memory.

   - gh-101541(2): [Enum] - fix psuedo-flag creation

   - gh-101570(3): Upgrade pip wheel bundled with ensurepip (pip 23.0)

   - gh-101323(4): Fix a bug where errors where not thrown by
     zlib._ZlibDecompressor if encountered during decompressing.

   - gh-101317(5): Add 'ssl_shutdown_timeout' parameter for *note
     asyncio.StreamWriter.start_tls(): 819.

   - gh-101326(6): Fix regression when passing ‘None’ as second or third
     argument to ‘FutureIter.throw’.

   - gh-92123(7): Adapt the ‘_elementtree’ extension module to
     multi-phase init ( PEP 489(8)).  Patches by Erlend E. Aasland.

   - gh-100795(9): Avoid potential unexpected ‘freeaddrinfo’ call
     (double free) in *note socket: d1. when when a libc ‘getaddrinfo()’
     implementation leaves garbage in an output pointer when returning
     an error.  Original patch by Sergey G. Brester.

   - gh-101143(10): Remove unused references to *note TimerHandle: 1add.
     in ‘asyncio.base_events.BaseEventLoop._add_callback’.

   - gh-101144(11): Make *note zipfile.Path.open(): 1907. and *note
     zipfile.Path.read_text(): 1ade. also accept ‘encoding’ as a
     positional argument.  This was the behavior in Python 3.9 and
     earlier.  3.10 introduced a regression where supplying it as a
     positional argument would lead to a *note TypeError: 198.

   - gh-94518(12): Group-related variables of ‘_posixsubprocess’ module
     are renamed to stress that supplementary group affinity is added to
     a fork, not replace the inherited ones.  Patch by Oleg Iarygin.

   - gh-101015(13): Fix *note typing.get_type_hints(): 8c0. on
     ‘'*tuple[...]'’ and ‘*tuple[...]’.  It must not drop the ‘Unpack’
     part.

   - gh-101000(14): Add *note os.path.splitroot(): 6cb, which splits a
     path into a 3-item tuple ‘(drive, root, tail)’.  This new function
     is used by *note pathlib: a8. to improve the performance of path
     construction by up to a third.

   - gh-100573(15): Fix a Windows *note asyncio: b. bug with named pipes
     where a client doing ‘os.stat()’ on the pipe would cause an error
     in the server that disabled serving future requests.

   - gh-39615(16): *note warnings.warn(): 1732. now has the ability to
     skip stack frames based on code filename prefix rather than only a
     numeric ‘stacklevel’ via the new ‘skip_file_prefixes’ keyword
     argument.

   - gh-100750(17): pass encoding kwarg to subprocess in platform

   - gh-100160(18): Emit a deprecation warning in
     ‘asyncio.DefaultEventLoopPolicy.get_event_loop()’ if there is no
     current event loop set and it decides to create one.

   - gh-96290(19): Fix handling of partial and invalid UNC drives in
     ‘ntpath.splitdrive()’, and in ‘ntpath.normpath()’ on non-Windows
     systems.  Paths such as '\server' and '\' are now considered by
     ‘splitdrive()’ to contain only a drive, and consequently are not
     modified by ‘normpath()’ on non-Windows systems.  The behaviour of
     ‘normpath()’ on Windows systems is unaffected, as native OS APIs
     are used.  Patch by Eryk Sun, with contributions by Barney Gale.

   - gh-99952(20): Fix a reference undercounting issue in *note
     ctypes.Structure: 1e5. with ‘from_param()’ results larger than a C
     pointer.

   - gh-67790(21): Add float-style formatting support for *note
     fractions.Fraction: 213. instances.

   - gh-99266(22): Preserve more detailed error messages in *note
     ctypes: 2e.

   - gh-86682(23): Ensure runtime-created collections have the correct
     module name using the newly added (internal) *note
     sys._getframemodulename(): 1adf.

   - gh-88597(24): *note uuid: 116. now has a command line interface.
     Try ‘python -m uuid -h’.

   - gh-60580(25): ‘ctypes.wintypes.BYTE’ definition changed from *note
     c_byte: 1ae0. to *note c_ubyte: 1ae1. to match Windows SDK. Patch
     by Anatoly Techtonik and Oleg Iarygin.

   - gh-94518(26): ‘_posixsubprocess’ now initializes all UID and GID
     variables using a reserved ‘-1’ value instead of a separate flag.
     Patch by Oleg Iarygin.

   - bpo-38941(27): The *note xml.etree.ElementTree: 12b. module now
     emits *note DeprecationWarning: 1a3. when testing the truth value
     of an *note xml.etree.ElementTree.Element: 363.  Before, the Python
     implementation emitted *note FutureWarning: 659, and the C
     implementation emitted nothing.

   - bpo-40077(28): Convert ‘elementtree’ types to heap types.  Patch by
     Erlend E. Aasland.

   - bpo-29847(29): Fix a bug where *note pathlib.Path: 266. accepted
     and ignored keyword arguments.  Patch provided by Yurii Karabas.

   - gh-77772(30): *note ctypes.CDLL: bdc, *note ctypes.OleDLL: 1ae2,
     *note ctypes.WinDLL: 1ae3, and *note ctypes.PyDLL: 1ae4. now accept
     *note path-like objects: 5a1. as their ‘name’ argument.  Patch by
     Robert Hoelzl.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32780

   (2) https://github.com/python/cpython/issues/101541

   (3) https://github.com/python/cpython/issues/101570

   (4) https://github.com/python/cpython/issues/101323

   (5) https://github.com/python/cpython/issues/101317

   (6) https://github.com/python/cpython/issues/101326

   (7) https://github.com/python/cpython/issues/92123

   (8) https://peps.python.org/pep-0489/

   (9) https://github.com/python/cpython/issues/100795

   (10) https://github.com/python/cpython/issues/101143

   (11) https://github.com/python/cpython/issues/101144

   (12) https://github.com/python/cpython/issues/94518

   (13) https://github.com/python/cpython/issues/101015

   (14) https://github.com/python/cpython/issues/101000

   (15) https://github.com/python/cpython/issues/100573

   (16) https://github.com/python/cpython/issues/39615

   (17) https://github.com/python/cpython/issues/100750

   (18) https://github.com/python/cpython/issues/100160

   (19) https://github.com/python/cpython/issues/96290

   (20) https://github.com/python/cpython/issues/99952

   (21) https://github.com/python/cpython/issues/67790

   (22) https://github.com/python/cpython/issues/99266

   (23) https://github.com/python/cpython/issues/86682

   (24) https://github.com/python/cpython/issues/88597

   (25) https://github.com/python/cpython/issues/60580

   (26) https://github.com/python/cpython/issues/94518

   (27) https://bugs.python.org/issue?@action=redirect&bpo=38941

   (28) https://bugs.python.org/issue?@action=redirect&bpo=40077

   (29) https://bugs.python.org/issue?@action=redirect&bpo=29847

   (30) https://github.com/python/cpython/issues/77772


File: python.info,  Node: ドキュメント<24>,  Next: テスト<23>,  Prev: ライブラリ<71>,  Up: Python 3 12 0 alpha 5

1.24.30.4 ドキュメント
......................

   - gh-88324(1): Reword *note subprocess: dc. to emphasize default
     behavior of 'stdin', 'stdout', and 'stderr' arguments.  Remove
     inaccurate statement about child file handle inheritance.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/88324


File: python.info,  Node: テスト<23>,  Next: ビルド<27>,  Prev: ドキュメント<24>,  Up: Python 3 12 0 alpha 5

1.24.30.5 テスト
................

   - gh-101334(1): ‘test_tarfile’ has been updated to pass when run as a
     high UID.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101334


File: python.info,  Node: ビルド<27>,  Next: Windows<25>,  Prev: テスト<23>,  Up: Python 3 12 0 alpha 5

1.24.30.6 ビルド
................

   - gh-101282(1): Update BOLT configuration not to use deprecated usage
     of ‘--split functions’.  Patch by Donghee Na.

   - gh-101522(2): Allow overriding Windows dependencies versions and
     paths using MSBuild properties.

   - gh-77532(3): Minor fixes to allow building with
     ‘PlatformToolset=ClangCL’ on Windows.

   - gh-101152(4): In accordance with PEP 699(5), the ‘ma_version_tag’
     field in *note PyDictObject: 64f. is deprecated for extension
     modules.  Accessing this field will generate a compiler warning at
     compile time.  This field will be removed in Python 3.14.

   - gh-100340(6): Allows -Wno-int-conversion for wasm-sdk 17 and
     onwards, thus enables building WASI builds once against the latest
     sdk.

   - gh-101060(7): Conditionally add ‘-fno-reorder-blocks-and-partition’
     in configure.  Effectively fixes ‘--enable-bolt’ when using Clang,
     as this appears to be a GCC-only flag.

   - gh-98705(8): ‘__bool__’ is defined in AIX system header files which
     breaks the build in AIX, so undefine it.

   - gh-98636(9): Fix a regression in detecting ‘gdbm_compat’ library
     for the ‘_gdbm’ module build.

   - gh-96305(10): ‘_aix_support’ now uses a simple code to get platform
     details rather than the now non-existent ‘_bootsubprocess’ during
     bootstrap.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101282

   (2) https://github.com/python/cpython/issues/101522

   (3) https://github.com/python/cpython/issues/77532

   (4) https://github.com/python/cpython/issues/101152

   (5) https://peps.python.org/pep-0699/

   (6) https://github.com/python/cpython/issues/100340

   (7) https://github.com/python/cpython/issues/101060

   (8) https://github.com/python/cpython/issues/98705

   (9) https://github.com/python/cpython/issues/98636

   (10) https://github.com/python/cpython/issues/96305


File: python.info,  Node: Windows<25>,  Prev: ビルド<27>,  Up: Python 3 12 0 alpha 5

1.24.30.7 Windows
.................

   - gh-101543(1): Ensure the install path in the registry is only used
     when the standard library hasn't been located in any other way.

   - gh-101467(2): The ‘py.exe’ launcher now correctly filters when only
     a single runtime is installed.  It also correctly handles prefix
     matches on tags so that ‘-3.1’ does not match ‘3.11’, but would
     still match ‘3.1-32’.

   - gh-99834(3): Updates bundled copy of Tcl/Tk to 8.6.13.0

   - gh-101135(4): Restore ability to launch older 32-bit versions from
     the ‘py.exe’ launcher when both 32-bit and 64-bit installs of the
     same version are available.

   - gh-82052(5): Fixed an issue where writing more than 32K of Unicode
     output to the console screen in one go can result in mojibake.

   - gh-100320(6): Ensures the ‘PythonPath’ registry key from an install
     is used when launching from a different copy of Python that relies
     on an existing install to provide a copy of its modules and
     standard library.

   - gh-100247(7): Restores support for the ‘py.exe’ launcher finding
     shebang commands in its configuration file using the full command
     name.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/101543

   (2) https://github.com/python/cpython/issues/101467

   (3) https://github.com/python/cpython/issues/99834

   (4) https://github.com/python/cpython/issues/101135

   (5) https://github.com/python/cpython/issues/82052

   (6) https://github.com/python/cpython/issues/100320

   (7) https://github.com/python/cpython/issues/100247


File: python.info,  Node: Python 3 12 0 alpha 4,  Next: Python 3 12 0 alpha 3,  Prev: Python 3 12 0 alpha 5,  Up: 変更履歴

1.24.31 Python 3.12.0 alpha 4
-----------------------------

'Release date: 2023-01-10'

* Menu:

* Core and Builtins: Core and Builtins<67>.
* ライブラリ: ライブラリ<72>.
* Core and Builtins: Core and Builtins<68>.
* ライブラリ: ライブラリ<73>.
* Core and Builtins: Core and Builtins<69>.
* ライブラリ: ライブラリ<74>.
* ドキュメント: ドキュメント<25>.
* テスト: テスト<24>.
* ビルド: ビルド<28>.
* Windows: Windows<26>.
* macOS: macOS<17>.
* Tools/Demos: Tools/Demos<22>.
* C API: C API<26>.


File: python.info,  Node: Core and Builtins<67>,  Next: ライブラリ<72>,  Up: Python 3 12 0 alpha 4

1.24.31.1 Core and Builtins
...........................

   - gh-100776(1): Fix misleading default value in *note input():
     14f0.'s ‘__text_signature__’.

   - gh-99005(2): Remove ‘UNARY_POSITIVE’, ‘ASYNC_GEN_WRAP’ and
     ‘LIST_TO_TUPLE’, replacing them with intrinsics.

   - gh-99005(3): Add new *note CALL_INTRINSIC_1: 707. instruction.
     Remove ‘IMPORT_STAR’, ‘PRINT_EXPR’ and ‘STOPITERATION_ERROR’,
     replacing them with the *note CALL_INTRINSIC_1: 707. instruction.

   - gh-100288(4): Remove the LOAD_ATTR_METHOD_WITH_DICT specialized
     instruction.  Stats show it is not useful.

   - gh-100720(5): Added ‘_PyFrame_NumSlotsForCodeObject’, which returns
     the number of slots needed in a frame for a given code object.

   - gh-100719(6): Removed the co_nplaincellvars field from the code
     object, as it is redundant.

   - gh-100637(7): Fix ‘int.__sizeof__()’ calculation to include the
     1-element ‘ob_digit’ array for ‘0’ and ‘False’.

   - gh-100649(8): Update the native_thread_id field of PyThreadState
     after fork.

   - gh-100126(9): Fix an issue where "incomplete" frames could be
     briefly visible to C code while other frames are being torn down,
     possibly resulting in corruption or hard crashes of the interpreter
     while running finalizers.

   - gh-87447(10): Fix *note SyntaxError: 18e. on comprehension rebind
     checking with names that are not actually redefined.

     Now reassigning ‘b’ in ‘[(b := 1) for a, b.prop in some_iter]’ is
     allowed.  Reassigning ‘a’ is still disallowed as per PEP 572(11).

   - gh-100268(12): Add *note int.is_integer(): 1aeb. to improve duck
     type compatibility between *note int: 19b. and *note float: 196.

   - gh-100425(13): Improve the accuracy of ‘sum()’ with compensated
     summation.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100776

   (2) https://github.com/python/cpython/issues/99005

   (3) https://github.com/python/cpython/issues/99005

   (4) https://github.com/python/cpython/issues/100288

   (5) https://github.com/python/cpython/issues/100720

   (6) https://github.com/python/cpython/issues/100719

   (7) https://github.com/python/cpython/issues/100637

   (8) https://github.com/python/cpython/issues/100649

   (9) https://github.com/python/cpython/issues/100126

   (10) https://github.com/python/cpython/issues/87447

   (11) https://peps.python.org/pep-0572/

   (12) https://github.com/python/cpython/issues/100268

   (13) https://github.com/python/cpython/issues/100425


File: python.info,  Node: ライブラリ<72>,  Next: Core and Builtins<68>,  Prev: Core and Builtins<67>,  Up: Python 3 12 0 alpha 4

1.24.31.2 ライブラリ
....................

   - gh-100374(1): Fix incorrect result and delay in *note
     socket.getfqdn(): 1aed.  Patch by Dominic Socular.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100374


File: python.info,  Node: Core and Builtins<68>,  Next: ライブラリ<73>,  Prev: ライブラリ<72>,  Up: Python 3 12 0 alpha 4

1.24.31.3 Core and Builtins
...........................

   - gh-100357(1): Convert ‘vars’, ‘dir’, ‘next’, ‘getattr’, and ‘iter’
     to argument clinic.

   - gh-100117(2): Improve the output of *note codeobject.co_lines():
     350. by emitting only one entry for each line range.

   - gh-90043(3): Handle NaNs when specializing *note COMPARE_OP: b61.
     for *note float: 196. values.

   - gh-100222(4): Redefine the ‘_Py_CODEUNIT’ typedef as a union to
     describe its layout to the C compiler, avoiding type punning and
     improving clarity.

   - gh-99955(5): Internal compiler functions (in compile.c) now
     consistently return -1 on error and 0 on success.

   - gh-100188(6): The ‘BINARY_SUBSCR_LIST_INT’ and
     ‘BINARY_SUBSCR_TUPLE_INT’ instructions are no longer used for
     negative integers because those instructions always miss when
     encountering negative integers.

   - gh-99110(7): Initialize frame->previous in frameobject.c to fix a
     segmentation fault when accessing frames created by *note
     PyFrame_New(): 1aef.

   - gh-94155(8): Improved the hashing algorithm for code objects,
     mitigating some hash collisions.

   - gh-99540(9): ‘None’ now hashes to a constant value.  This is not a
     requirements change.

   - gh-100143(10): When built with ‘--enable-pystats’, stats collection
     is now off by default.  To enable it early at startup, pass the
     ‘-Xpystats’ flag.  Stats are now always dumped, even if switched
     off.

   - gh-100146(11): Improve ‘BUILD_LIST’ opcode so that it works
     similarly to the ‘BUILD_TUPLE’ opcode, by stealing references from
     the stack rather than repeatedly using stack operations to set list
     elements.  Implementation details are in a new private API
     ‘_PyList_FromArraySteal()’.

   - gh-100110(12): Specialize ‘FOR_ITER’ for tuples.

   - gh-100050(13): Honor existing errors obtained when searching for
     mismatching parentheses in the tokenizer.  Patch by Pablo Galindo

   - gh-92216(14): Improve the performance of *note hasattr(): 6f9. for
     type objects with a missing attribute.

   - gh-99582(15): Freeze *note zipimport: 138. module into
     ‘_bootstrap_python’.

   - gh-99554(16): Pack debugging location tables more efficiently
     during bytecode compilation.

   - gh-98522(17): Add an internal version number to code objects, to
     give better versioning of inner functions and comprehensions, and
     thus better specialization of those functions.  This change is
     invisible to both Python and C extensions.

   - gh-94603(18): Improve performance of ‘list.pop’ for small lists.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100357

   (2) https://github.com/python/cpython/issues/100117

   (3) https://github.com/python/cpython/issues/90043

   (4) https://github.com/python/cpython/issues/100222

   (5) https://github.com/python/cpython/issues/99955

   (6) https://github.com/python/cpython/issues/100188

   (7) https://github.com/python/cpython/issues/99110

   (8) https://github.com/python/cpython/issues/94155

   (9) https://github.com/python/cpython/issues/99540

   (10) https://github.com/python/cpython/issues/100143

   (11) https://github.com/python/cpython/issues/100146

   (12) https://github.com/python/cpython/issues/100110

   (13) https://github.com/python/cpython/issues/100050

   (14) https://github.com/python/cpython/issues/92216

   (15) https://github.com/python/cpython/issues/99582

   (16) https://github.com/python/cpython/issues/99554

   (17) https://github.com/python/cpython/issues/98522

   (18) https://github.com/python/cpython/issues/94603


File: python.info,  Node: ライブラリ<73>,  Next: Core and Builtins<69>,  Prev: Core and Builtins<68>,  Up: Python 3 12 0 alpha 4

1.24.31.4 ライブラリ
....................

   - gh-89051(1): Add *note ssl.OP_LEGACY_SERVER_CONNECT: 1af1.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89051


File: python.info,  Node: Core and Builtins<69>,  Next: ライブラリ<74>,  Prev: ライブラリ<73>,  Up: Python 3 12 0 alpha 4

1.24.31.5 Core and Builtins
...........................

   - bpo-32782(1): ‘ctypes’ arrays of length 0 now report a correct
     itemsize when a ‘memoryview’ is constructed from them, rather than
     always giving a value of 0.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32782


File: python.info,  Node: ライブラリ<74>,  Next: ドキュメント<25>,  Prev: Core and Builtins<69>,  Up: Python 3 12 0 alpha 4

1.24.31.6 ライブラリ
....................

   - gh-100833(1): Speed up *note math.fsum(): 15ed. by removing
     defensive ‘volatile’ qualifiers.

   - gh-100805(2): Modify *note random.choice(): 1448. implementation to
     once again work with NumPy arrays.

   - gh-100813(3): Add ‘socket.IP_PKTINFO’ constant.

   - gh-100792(4): Make *note email.message.Message.__contains__():
     1af4. twice as fast.

   - gh-91851(5): Microoptimizations for *note
     fractions.Fraction.__round__(): 1af5, *note
     fractions.Fraction.__ceil__(): 1af6. and *note
     fractions.Fraction.__floor__(): 1af7.

   - gh-90104(6): Avoid RecursionError on ‘repr’ if a dataclass field
     definition has a cyclic reference.

   - gh-100689(7): Fix crash in ‘pyexpat’ by statically allocating
     ‘PyExpat_CAPI’ capsule.

   - gh-100740(8): Fix ‘unittest.mock.Mock’ not respecting the spec for
     attribute names prefixed with ‘assert’.

   - gh-91219(9): Change ‘SimpleHTTPRequestHandler’ to support
     subclassing to provide a different set of index file names instead
     of using ‘__init__’ parameters.

   - gh-100690(10): ‘Mock’ objects which are not unsafe will now raise
     an ‘AttributeError’ when accessing an attribute that matches the
     name of an assertion but without the prefix ‘assert_’, e.g.
     accessing ‘called_once’ instead of ‘assert_called_once’.  This is
     in addition to this already happening for accessing attributes with
     prefixes ‘assert’, ‘assret’, ‘asert’, ‘aseert’, and ‘assrt’.

   - gh-89727(11): Simplify and optimize *note os.walk(): 6d0. by using
     *note isinstance(): 2ad. checks to check the top of the stack.

   - gh-100485(12): Add math.sumprod() to compute the sum of products.

   - gh-86508(13): Fix *note asyncio.open_connection(): d0e. to skip
     binding to local addresses of different family.  Patch by Kumar
     Aditya.

   - gh-97930(14): ‘importlib.resources.files’ now accepts a module as
     an anchor instead of only accepting packages.  If a module is
     passed, resources are resolved adjacent to that module (in the same
     package or at the package root).  The parameter was renamed from
     ‘package’ to ‘anchor’ with a compatibility shim for those passing
     by keyword.  Additionally, the new ‘anchor’ parameter is now
     optional and will default to the caller's module.

   - gh-100585(15): Fixed a bug where importlib.resources.as_file was
     leaving file pointers open

   - gh-100562(16): Improve performance of *note
     pathlib.Path.absolute(): 1a26. by nearly 2x.  This comes at the
     cost of a performance regression in *note pathlib.Path.cwd(): 1a9b,
     which is generally used less frequently in user code.

   - gh-100519(17): Small simplification of
     ‘http.cookiejar.eff_request_host()’ that improves readability and
     better matches the RFC wording.

   - gh-100287(18): Fix the interaction of *note unittest.mock.seal():
     d9a. with *note unittest.mock.AsyncMock: c3e.

   - gh-100488(19): Add ‘Fraction.is_integer()’ to check whether a *note
     fractions.Fraction: 213. is an integer.  This improves duck type
     compatibility with *note float: 196. and *note int: 19b.

   - gh-100474(20): *note http.server: 76. now checks that an index page
     is actually a regular file before trying to serve it.  This avoids
     issues with directories named ‘index.html’.

   - gh-100363(21): Speed up *note asyncio.get_running_loop(): d01. by
     removing redundant ‘getpid’ checks.  Patch by Kumar Aditya.

   - gh-78878(22): Fix crash when creating an instance of
     ‘_ctypes.CField’.

   - gh-100348(23): Fix ref cycle in ‘asyncio._SelectorSocketTransport’
     by removing ‘_read_ready_cb’ in ‘close’.

   - gh-100344(24): Provide C implementation for *note
     asyncio.current_task(): 6a5. for a 4x-6x speedup.

   - gh-100272(25): Fix JSON serialization of OrderedDict.  It now
     preserves the order of keys.

   - gh-83076(26): Instantiation of ‘Mock()’ and ‘AsyncMock()’ is now
     3.8x faster.

   - gh-100234(27): Set a default value of 1.0 for the ‘lambd’ parameter
     in random.expovariate().

   - gh-100228(28): A *note DeprecationWarning: 1a3. may be raised when
     *note os.fork(): 4b5. or *note os.forkpty(): 4b6. is called from
     multi-threaded processes.  Forking with threads is unsafe and can
     cause deadlocks, crashes and subtle problems.  Lack of a warning
     does not indicate that the fork call was actually safe, as Python
     may not be aware of all threads.

   - gh-100039(29): Improve signatures for enums and flags.

   - gh-100133(30): Fix regression in *note asyncio: b. where a
     subprocess would sometimes lose data received from pipe.

   - bpo-44592(31): Fixes inconsistent handling of case sensitivity of
     'extrasaction' arg in *note csv.DictWriter: 1417.

   - gh-100098(32): Fix ‘tuple’ subclasses being cast to ‘tuple’ when
     used as enum values.

   - gh-85432(33): Rename the 'fmt' parameter of the pure-Python
     implementation of *note datetime.time.strftime(): 1af8. to
     'format'.  Rename the 't' parameter of *note
     datetime.datetime.fromtimestamp(): 712. to 'timestamp'.  These
     changes mean the parameter names in the pure-Python implementation
     now match the parameter names in the C implementation.  Patch by
     Alex Waygood.

   - gh-98778(34): Update *note HTTPError: 11e0. to be initialized
     properly, even if the ‘fp’ is ‘None’.  Patch by Donghee Na.

   - gh-99925(35): Unify error messages in JSON serialization between
     ‘json.dumps(float('nan'), allow_nan=False)’ and
     ‘json.dumps(float('nan'), allow_nan=False, indent=<SOMETHING>)’.
     Now both include the representation of the value that could not be
     serialized.

   - gh-89727(36): Fix issue with *note os.walk(): 6d0. where a *note
     RecursionError: f68. would occur on deep directory structures by
     adjusting the implementation of *note os.walk(): 6d0. to be
     iterative instead of recursive.

   - gh-94943(37): Add *note データクラスのサポート: 1af9. to the *note
     Enum: 842. *note __repr__(): 1afa.  When inheriting from a *note
     dataclass: 4e1, only show the field names in the value section of
     the member *note repr(): 1c1, and not the dataclass' class name.

   - gh-83035(38): Fix *note inspect.getsource(): 17c3. handling of
     decorator calls with nested parentheses.

   - gh-99576(39): Fix ‘.save()’ method for ‘LWPCookieJar’ and
     ‘MozillaCookieJar’: saved file was not truncated on repeated save.

   - gh-94912(40): Add *note inspect.markcoroutinefunction(): 6b8.
     decorator which manually marks a function as a coroutine for the
     benefit of ‘iscoroutinefunction()’.

   - gh-99509(41): Add PEP 585(42) support for
     ‘multiprocessing.queues.Queue’.

   - gh-99482(43): Remove ‘Jython’ partial compatibility code from
     several stdlib modules.

   - gh-99433(44): Fix *note doctest: 3e. failure on *note
     types.MethodWrapperType: 85b. in modules.

   - gh-85267(45): Several improvements to *note inspect.signature():
     22f.'s handling of ‘__text_signature’.  - Fixes a case where *note
     inspect.signature(): 22f. dropped parameters - Fixes a case where
     *note inspect.signature(): 22f. raised *note tokenize.TokenError:
     764. - Allows *note inspect.signature(): 22f. to understand
     defaults involving binary operations of constants - *note
     inspect.signature(): 22f. is documented as only raising *note
     TypeError: 198. or *note ValueError: 2ec, but sometimes raised
     *note RuntimeError: 244.  These cases now raise *note ValueError:
     2ec. - Removed a dead code path

   - gh-91166(46): *note asyncio: b. is optimized to avoid excessive
     copying when writing to socket and use *note sendmsg(): 6a1. if the
     platform supports it.  Patch by Kumar Aditya.

   - gh-98030(47): Add missing TCP socket options from Linux:
     ‘TCP_MD5SIG’, ‘TCP_THIN_LINEAR_TIMEOUTS’, ‘TCP_THIN_DUPACK’,
     ‘TCP_REPAIR’, ‘TCP_REPAIR_QUEUE’, ‘TCP_QUEUE_SEQ’,
     ‘TCP_REPAIR_OPTIONS’, ‘TCP_TIMESTAMP’, ‘TCP_CC_INFO’,
     ‘TCP_SAVE_SYN’, ‘TCP_SAVED_SYN’, ‘TCP_REPAIR_WINDOW’,
     ‘TCP_FASTOPEN_CONNECT’, ‘TCP_ULP’, ‘TCP_MD5SIG_EXT’,
     ‘TCP_FASTOPEN_KEY’, ‘TCP_FASTOPEN_NO_COOKIE’,
     ‘TCP_ZEROCOPY_RECEIVE’, ‘TCP_INQ’, ‘TCP_TX_DELAY’.

   - gh-88500(48): Reduced the memory usage of *note
     urllib.parse.unquote(): 1afb. and *note
     urllib.parse.unquote_to_bytes(): 1afc. on large values.

   - gh-96127(49): ‘inspect.signature’ was raising ‘TypeError’ on call
     with mock objects.  Now it correctly returns ‘(*args, **kwargs)’ as
     inferred signature.

   - gh-95882(50): Fix a 3.11 regression in *note asynccontextmanager():
     d1f, which caused it to propagate exceptions with incorrect
     tracebacks and fix a 3.11 regression in *note contextmanager():
     141b, which caused it to propagate exceptions with incorrect
     tracebacks for *note StopIteration: df5.

   - gh-78707(51): Deprecate passing more than one positional argument
     to *note pathlib.PurePath.relative_to(): 2fd. and *note
     is_relative_to(): 2fe.

   - gh-92122(52): Fix reStructuredText syntax errors in docstrings in
     the *note enum: 5a. module.

   - gh-91851(53): Optimize the *note Fraction: 213. arithmetics for
     small components.

   - bpo-24132(54): Make *note pathlib.PurePath: 6cd. and *note Path:
     266. subclassable (private to start).  Previously, attempting to
     instantiate a subclass resulted in an *note AttributeError: 5f0.
     being raised.  Patch by Barney Gale.

   - bpo-40447(55): Accept *note os.PathLike: e4b. (such as *note
     pathlib.Path: 266.) in the ‘stripdir’ arguments of *note
     compileall.compile_file(): fe1. and *note compileall.compile_dir():
     d1b.

   - bpo-36880(56): Fix a reference counting issue when a *note ctypes:
     2e. callback with return type *note py_object: 1f3. returns ‘None’,
     which could cause crashes.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100833

   (2) https://github.com/python/cpython/issues/100805

   (3) https://github.com/python/cpython/issues/100813

   (4) https://github.com/python/cpython/issues/100792

   (5) https://github.com/python/cpython/issues/91851

   (6) https://github.com/python/cpython/issues/90104

   (7) https://github.com/python/cpython/issues/100689

   (8) https://github.com/python/cpython/issues/100740

   (9) https://github.com/python/cpython/issues/91219

   (10) https://github.com/python/cpython/issues/100690

   (11) https://github.com/python/cpython/issues/89727

   (12) https://github.com/python/cpython/issues/100485

   (13) https://github.com/python/cpython/issues/86508

   (14) https://github.com/python/cpython/issues/97930

   (15) https://github.com/python/cpython/issues/100585

   (16) https://github.com/python/cpython/issues/100562

   (17) https://github.com/python/cpython/issues/100519

   (18) https://github.com/python/cpython/issues/100287

   (19) https://github.com/python/cpython/issues/100488

   (20) https://github.com/python/cpython/issues/100474

   (21) https://github.com/python/cpython/issues/100363

   (22) https://github.com/python/cpython/issues/78878

   (23) https://github.com/python/cpython/issues/100348

   (24) https://github.com/python/cpython/issues/100344

   (25) https://github.com/python/cpython/issues/100272

   (26) https://github.com/python/cpython/issues/83076

   (27) https://github.com/python/cpython/issues/100234

   (28) https://github.com/python/cpython/issues/100228

   (29) https://github.com/python/cpython/issues/100039

   (30) https://github.com/python/cpython/issues/100133

   (31) https://bugs.python.org/issue?@action=redirect&bpo=44592

   (32) https://github.com/python/cpython/issues/100098

   (33) https://github.com/python/cpython/issues/85432

   (34) https://github.com/python/cpython/issues/98778

   (35) https://github.com/python/cpython/issues/99925

   (36) https://github.com/python/cpython/issues/89727

   (37) https://github.com/python/cpython/issues/94943

   (38) https://github.com/python/cpython/issues/83035

   (39) https://github.com/python/cpython/issues/99576

   (40) https://github.com/python/cpython/issues/94912

   (41) https://github.com/python/cpython/issues/99509

   (42) https://peps.python.org/pep-0585/

   (43) https://github.com/python/cpython/issues/99482

   (44) https://github.com/python/cpython/issues/99433

   (45) https://github.com/python/cpython/issues/85267

   (46) https://github.com/python/cpython/issues/91166

   (47) https://github.com/python/cpython/issues/98030

   (48) https://github.com/python/cpython/issues/88500

   (49) https://github.com/python/cpython/issues/96127

   (50) https://github.com/python/cpython/issues/95882

   (51) https://github.com/python/cpython/issues/78707

   (52) https://github.com/python/cpython/issues/92122

   (53) https://github.com/python/cpython/issues/91851

   (54) https://bugs.python.org/issue?@action=redirect&bpo=24132

   (55) https://bugs.python.org/issue?@action=redirect&bpo=40447

   (56) https://bugs.python.org/issue?@action=redirect&bpo=36880


File: python.info,  Node: ドキュメント<25>,  Next: テスト<24>,  Prev: ライブラリ<74>,  Up: Python 3 12 0 alpha 4

1.24.31.7 ドキュメント
......................

   - gh-100616(1): Document existing ‘attr’ parameter to *note
     curses.window.vline(): 1afe. function in *note curses: 2f.

   - gh-100472(2): Remove claim in documentation that the ‘stripdir’,
     ‘prependdir’ and ‘limit_sl_dest’ parameters of *note
     compileall.compile_dir(): d1b. and *note compileall.compile_file():
     fe1. could be *note bytes: 192.

   - bpo-25377(3): Clarify use of octal format of mode argument in
     help(os.chmod) as well as help(os.fchmod)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100616

   (2) https://github.com/python/cpython/issues/100472

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25377


File: python.info,  Node: テスト<24>,  Next: ビルド<28>,  Prev: ドキュメント<25>,  Up: Python 3 12 0 alpha 4

1.24.31.8 テスト
................

   - gh-100454(1): Start running SSL tests with OpenSSL 3.1.0-beta1.

   - gh-100086(2): The Python test runner (libregrtest) now logs Python
     build information like "debug" vs "release" build, or LTO and PGO
     optimizations.  Patch by Victor Stinner.

   - gh-93018(3): Make two tests forgiving towards host system libexpat
     with backported security fixes applied.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100454

   (2) https://github.com/python/cpython/issues/100086

   (3) https://github.com/python/cpython/issues/93018


File: python.info,  Node: ビルド<28>,  Next: Windows<26>,  Prev: テスト<24>,  Up: Python 3 12 0 alpha 4

1.24.31.9 ビルド
................

   - gh-100540(1): Removed the ‘--with-system-ffi’ ‘configure’ option;
     ‘libffi’ must now always be supplied by the system on all
     non-Windows platforms.  The option has had no effect on non-Darwin
     platforms for several releases, and in 3.11 only had the
     non-obvious effect of invoking ‘pkg-config’ to find ‘libffi’ and
     never setting ‘-DUSING_APPLE_OS_LIBFFI’.  Now on Darwin platforms
     ‘configure’ will first check for the OS ‘libffi’ and then fall back
     to the same processing as other platforms if it is not found.

   - gh-88267(2): Avoid exporting Python symbols in linked Windows
     applications when the core is built as static.

   - bpo-41916(3): Allow override of ac_cv_cxx_thread so that cross
     compiled python can set -pthread for CXX.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100540

   (2) https://github.com/python/cpython/issues/88267

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41916


File: python.info,  Node: Windows<26>,  Next: macOS<17>,  Prev: ビルド<28>,  Up: Python 3 12 0 alpha 4

1.24.31.10 Windows
..................

   - gh-100180(1): Update Windows installer to OpenSSL 1.1.1s

   - gh-99191(2): Use ‘_MSVC_LANG >= 202002L’ instead of less-precise
     ‘_MSC_VER >=1929’ to more accurately test for C++20 support in
     ‘PC/_wmimodule.cpp’.

   - gh-79218(3): Define ‘MS_WIN64’ for Mingw-w64 64bit, fix cython
     compilation failure.

   - gh-99941(4): Ensure that *note asyncio.Protocol.data_received():
     1b02. receives an immutable *note bytes: 192. object (as
     documented), instead of *note bytearray: 344.

   - bpo-43984(5): *note winreg.SetValueEx(): 1b03. now leaves the
     target value untouched in the case of conversion errors.
     Previously, ‘-1’ would be written in case of such errors.

   - bpo-34816(6): ‘hasattr(ctypes.windll, 'nonexistant')’ now returns
     ‘False’ instead of raising *note OSError: 2c0.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100180

   (2) https://github.com/python/cpython/issues/99191

   (3) https://github.com/python/cpython/issues/79218

   (4) https://github.com/python/cpython/issues/99941

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43984

   (6) https://bugs.python.org/issue?@action=redirect&bpo=34816


File: python.info,  Node: macOS<17>,  Next: Tools/Demos<22>,  Prev: Windows<26>,  Up: Python 3 12 0 alpha 4

1.24.31.11 macOS
................

   - gh-100180(1): Update macOS installer to OpenSSL 1.1.1s

   - gh-100540(2): Removed obsolete ‘dlfcn.h’ shim from the ‘_ctypes’
     extension module, which has not been necessary since Mac OS X 10.2.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100180

   (2) https://github.com/python/cpython/issues/100540


File: python.info,  Node: Tools/Demos<22>,  Next: C API<26>,  Prev: macOS<17>,  Up: Python 3 12 0 alpha 4

1.24.31.12 Tools/Demos
......................

   - bpo-45256(1): Fix a bug that caused an *note AttributeError: 5f0.
     to be raised in ‘python-gdb.py’ when ‘py-locals’ is used without a
     frame.

   - gh-100342(2): Add missing ‘NULL’ check for possible allocation
     failure in ‘*args’ parsing in Argument Clinic.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45256

   (2) https://github.com/python/cpython/issues/100342


File: python.info,  Node: C API<26>,  Prev: Tools/Demos<22>,  Up: Python 3 12 0 alpha 4

1.24.31.13 C API
................

   - gh-99947(1): Raising SystemError on import will now have its cause
     be set to the original unexpected exception.

   - gh-99240(2): In argument parsing, after deallocating newly
     allocated memory, reset its pointer to NULL.

   - gh-98724(3): The *note Py_CLEAR: 798, *note Py_SETREF: 799. and
     *note Py_XSETREF: 79a. macros now only evaluate their arguments
     once.  If an argument has side effects, these side effects are no
     longer duplicated.  Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99947

   (2) https://github.com/python/cpython/issues/99240

   (3) https://github.com/python/cpython/issues/98724


File: python.info,  Node: Python 3 12 0 alpha 3,  Next: Python 3 12 0 alpha 2,  Prev: Python 3 12 0 alpha 4,  Up: 変更履歴

1.24.32 Python 3.12.0 alpha 3
-----------------------------

'リリース日: 2022-12-06'

* Menu:

* セキュリティ: セキュリティ<25>.
* Core and Builtins: Core and Builtins<70>.
* ライブラリ: ライブラリ<75>.
* Core and Builtins: Core and Builtins<71>.
* ライブラリ: ライブラリ<76>.
* ドキュメント: ドキュメント<26>.
* テスト: テスト<25>.
* ビルド: ビルド<29>.
* Windows: Windows<27>.
* macOS: macOS<18>.
* Tools/Demos: Tools/Demos<23>.
* C API: C API<27>.


File: python.info,  Node: セキュリティ<25>,  Next: Core and Builtins<70>,  Up: Python 3 12 0 alpha 3

1.24.32.1 セキュリティ
......................

   - gh-100001(1): ‘python -m http.server’ no longer allows terminal
     control characters sent within a garbage request to be printed to
     the stderr server log.

     This is done by changing the *note http.server: 76.
     ‘BaseHTTPRequestHandler’ ‘.log_message’ method to replace control
     characters with a ‘\xHH’ hex escape before printing.

   - gh-87604(2): Avoid publishing list of active per-interpreter audit
     hooks via the *note gc: 64. module

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100001

   (2) https://github.com/python/cpython/issues/87604


File: python.info,  Node: Core and Builtins<70>,  Next: ライブラリ<75>,  Prev: セキュリティ<25>,  Up: Python 3 12 0 alpha 3

1.24.32.2 Core and Builtins
...........................

   - gh-99891(1): Fix a bug in the tokenizer that could cause infinite
     recursion when showing syntax warnings that happen in the first
     line of the source.  Patch by Pablo Galindo

   - gh-91054(2): Add *note PyCode_AddWatcher(): 787. and *note
     PyCode_ClearWatcher(): 788. APIs to register callbacks to receive
     notification on creation and destruction of code objects.

   - gh-99729(3): Fix an issue that could cause frames to be visible to
     Python code as they are being torn down, possibly leading to memory
     corruption or hard crashes of the interpreter.

   - gh-99708(4): Fix bug where compiler crashes on an if expression
     with an empty body block.

   - gh-99578(5): Fix a reference bug in ‘_imp.create_builtin()’ after
     the creation of the first sub-interpreter for modules ‘builtins’
     and ‘sys’.  Patch by Victor Stinner.

   - gh-99581(6): Fixed a bug that was causing a buffer overflow if the
     tokenizer copies a line missing the newline character from a file
     that is as long as the available tokenizer buffer.  Patch by Pablo
     galindo

   - gh-99553(7): Fix bug where an *note ExceptionGroup: 4d2. subclass
     can wrap a *note BaseException: 7d6.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99891

   (2) https://github.com/python/cpython/issues/91054

   (3) https://github.com/python/cpython/issues/99729

   (4) https://github.com/python/cpython/issues/99708

   (5) https://github.com/python/cpython/issues/99578

   (6) https://github.com/python/cpython/issues/99581

   (7) https://github.com/python/cpython/issues/99553


File: python.info,  Node: ライブラリ<75>,  Next: Core and Builtins<71>,  Prev: Core and Builtins<70>,  Up: Python 3 12 0 alpha 3

1.24.32.3 ライブラリ
....................

   - gh-99547(1): Add a function to os.path to check if a path is a
     junction: isjunction.  Add similar functionality to pathlib.Path as
     is_junction.

   - gh-99370(2): Fix zip path for venv created from a non-installed
     python on POSIX platforms.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99547

   (2) https://github.com/python/cpython/issues/99370


File: python.info,  Node: Core and Builtins<71>,  Next: ライブラリ<76>,  Prev: ライブラリ<75>,  Up: Python 3 12 0 alpha 3

1.24.32.4 Core and Builtins
...........................

   - gh-99377(1): Add audit events for thread creation and clear
     operations.

   - gh-98686(2): Remove the ‘BINARY_OP_GENERIC’ and
     ‘COMPARE_OP_GENERIC’ "specializations".

   - gh-99298(3): Remove the remaining error paths for attribute
     specializations, and refuse to specialize attribute accesses on
     types that haven't had *note PyType_Ready(): 980. called on them
     yet.

   - gh-99127(4): Allow some features of *note syslog: e2. to the main
     interpreter only.  Patch by Donghee Na.

   - gh-91053(5): Optimizing interpreters and JIT compilers may need to
     invalidate internal metadata when functions are modified.  This
     change adds the ability to provide a callback that will be invoked
     each time a function is created, modified, or destroyed.

   - gh-90994(6): Improve error messages when there's a syntax error
     with call arguments.  The following three cases are covered: - No
     value is assigned to a named argument, eg ‘foo(a=)’.  - A value is
     assigned to a star argument, eg ‘foo(*args=[0])’.  - A value is
     assigned to a double-star keyword argument, eg ‘foo(**kwarg={'a':
     0})’.

   - bpo-45026(7): Optimize the *note range: b3d. object iterator.  It
     is now smaller, faster iteration of ranges containing large
     numbers.  Smaller pickles, faster unpickling.

   - bpo-31718(8): Raise *note ValueError: 2ec. instead of *note
     SystemError: 795. when methods of uninitialized *note
     io.IncrementalNewlineDecoder: 1a3e. objects are called.  Patch by
     Oren Milman.

   - bpo-38031(9): Fix a possible assertion failure in *note io.FileIO:
     1527. when the opener returns an invalid file descriptor.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99377

   (2) https://github.com/python/cpython/issues/98686

   (3) https://github.com/python/cpython/issues/99298

   (4) https://github.com/python/cpython/issues/99127

   (5) https://github.com/python/cpython/issues/91053

   (6) https://github.com/python/cpython/issues/90994

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45026

   (8) https://bugs.python.org/issue?@action=redirect&bpo=31718

   (9) https://bugs.python.org/issue?@action=redirect&bpo=38031


File: python.info,  Node: ライブラリ<76>,  Next: ドキュメント<26>,  Prev: Core and Builtins<71>,  Up: Python 3 12 0 alpha 3

1.24.32.5 ライブラリ
....................

   - gh-100001(1): Also escape s in the http.server
     BaseHTTPRequestHandler.log_message so that it is technically
     possible to parse the line and reconstruct what the original data
     was.  Without this a xHH is ambiguous as to if it is a hex
     replacement we put in or the characters r"x" came through in the
     original request line.

   - gh-99957(2): Add ‘frozen_default’ parameter to *note
     typing.dataclass_transform(): 6fb.

   - gh-79033(3): Fix *note asyncio.Server.wait_closed(): 1a3f. to
     actually do what the docs promise - wait for all existing
     connections to complete, after closing the server.

   - gh-51524(4): Fix bug when calling trace.CoverageResults with valid
     infile.

   - gh-99645(5): Fix a bug in handling class cleanups in *note
     unittest.TestCase: 2b3.  Now ‘addClassCleanup()’ uses separate
     lists for different ‘TestCase’ subclasses, and ‘doClassCleanups()’
     only cleans up the particular class.

   - gh-99508(6): Fix ‘TypeError’ in
     ‘Lib/importlib/_bootstrap_external.py’ while calling
     ‘_imp.source_hash()’.

   - gh-66285(7): Fix *note asyncio: b. to not share event loop and
     signal wakeupfd in forked processes.  Patch by Kumar Aditya.

   - gh-97001(8): Release the GIL when calling termios APIs to avoid
     blocking threads.

   - gh-92647(9): Use final status of an enum to determine lookup or
     creation branch of functional API.

   - gh-99388(10): Add 'loop_factory' parameter to *note asyncio.run():
     2f3. to allow specifying a custom event loop factory.  Patch by
     Kumar Aditya.

   - gh-99341(11): Fix *note ast.increment_lineno(): 1b0d. to also cover
     *note ast.TypeIgnore: 1b0e. when changing line numbers.

   - gh-99382(12): Check the number of arguments in substitution in user
     generics containing a *note TypeVarTuple: 488. and one or more
     *note TypeVar: 486.

   - gh-99379(13): Fix substitution of *note ParamSpec: 487. followed by
     *note TypeVarTuple: 488. in generic aliases.

   - gh-99344(14): Fix substitution of *note TypeVarTuple: 488. and
     *note ParamSpec: 487. together in user generics.

   - gh-99284(15): Remove ‘_use_broken_old_ctypes_structure_semantics_’
     old untested and undocumented hack from *note ctypes: 2e.

   - gh-99201(16): Fix *note IndexError: 174e. when initializing the
     config variables on Windows if ‘HAVE_DYNAMIC_LOADING’ is not set.

   - gh-99240(17): Fix double-free bug in Argument Clinic
     ‘str_converter’ by extracting memory clean up to a new
     ‘post_parsing’ section.

   - gh-64490(18): Fix refcount error when arguments are packed to tuple
     in Argument Clinic.

   - gh-99029(19): *note pathlib.PurePath.relative_to(): 2fd. now treats
     naked Windows drive paths as relative.  This brings its behaviour
     in line with other parts of pathlib.

   - gh-98253(20): The implementation of the typing module is now more
     resilient to reference leaks in binary extension modules.

     Previously, a reference leak in a typed C API-based extension
     module could leak internals of the typing module, which could in
     turn introduce leaks in essentially any other package with typed
     function signatures.  Although the typing package is not the
     original source of the problem, such non-local dependences
     exacerbate debugging of large-scale projects, and the
     implementation was therefore changed to reduce harm by providing
     better isolation.

   - gh-98458(21): Fix infinite loop in unittest when a self-referencing
     chained exception is raised

   - gh-93453(22): *note asyncio.get_event_loop(): 2f2. and many other
     *note asyncio: b. functions like *note asyncio.ensure_future():
     e71, *note asyncio.shield(): c65. or *note asyncio.gather(): 813,
     and also the ‘get_event_loop()’ method of
     ‘asyncio.BaseDefaultEventLoopPolicy’ now raise a *note
     RuntimeError: 244. if called when there is no running event loop
     and the current event loop was not set.  Previously they implicitly
     created and set a new current event loop.  *note
     DeprecationWarning: 1a3. is no longer emitted if there is no
     running event loop but the current event loop was set.

   - gh-97966(23): On ‘uname_result’, restored expectation that
     ‘_fields’ and ‘_asdict’ would include all six properties including
     ‘processor’.

   - gh-98248(24): Provide informative error messages in *note
     struct.pack(): 148e. when its integral arguments are not in range.

   - gh-98108(25): ‘zipfile.Path’ is now pickleable if its
     initialization parameters were pickleable (e.g.  for file system
     paths).

   - gh-98098(26): Created packages from zipfile and test_zipfile
     modules, separating ‘zipfile.Path’ functionality.

   - gh-82836(27): Fix *note is_private: 19c3. properties in the *note
     ipaddress: 84. module.  Previously non-private networks (0.0.0.0/0)
     would return ‘True’ from this method; now they correctly return
     ‘False’.

   - gh-96828(28): Add an *note OP_ENABLE_KTLS: 1b0f. option for
     enabling the use of the kernel TLS (kTLS). Patch by Illia Volochii.

   - gh-88863(29): To avoid apparent memory leaks when *note
     asyncio.open_connection(): d0e. raises, break reference cycles
     generated by local exception and future instances (which has
     exception instance as its member var).  Patch by Dong Uk, Kang.

   - gh-91078(30): ‘TarFile.next()’ now returns ‘None’ when called on an
     empty tarfile.

   - bpo-47220(31): Document the optional 'callback' parameter of
     ‘WeakMethod’.  Patch by Géry Ogam.

   - bpo-44817(32): Ignore WinError 53 (ERROR_BAD_NETPATH), 65
     (ERROR_NETWORK_ACCESS_DENIED) and 161 (ERROR_BAD_PATHNAME) when
     using ntpath.realpath().

   - bpo-41260(33): Rename the 'fmt' parameter of the pure Python
     implementation of *note datetime.date.strftime(): e8f. to 'format'.

   - bpo-15999(34): All built-in functions now accept arguments of any
     type instead of just ‘bool’ and ‘int’ for boolean parameters.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/100001

   (2) https://github.com/python/cpython/issues/99957

   (3) https://github.com/python/cpython/issues/79033

   (4) https://github.com/python/cpython/issues/51524

   (5) https://github.com/python/cpython/issues/99645

   (6) https://github.com/python/cpython/issues/99508

   (7) https://github.com/python/cpython/issues/66285

   (8) https://github.com/python/cpython/issues/97001

   (9) https://github.com/python/cpython/issues/92647

   (10) https://github.com/python/cpython/issues/99388

   (11) https://github.com/python/cpython/issues/99341

   (12) https://github.com/python/cpython/issues/99382

   (13) https://github.com/python/cpython/issues/99379

   (14) https://github.com/python/cpython/issues/99344

   (15) https://github.com/python/cpython/issues/99284

   (16) https://github.com/python/cpython/issues/99201

   (17) https://github.com/python/cpython/issues/99240

   (18) https://github.com/python/cpython/issues/64490

   (19) https://github.com/python/cpython/issues/99029

   (20) https://github.com/python/cpython/issues/98253

   (21) https://github.com/python/cpython/issues/98458

   (22) https://github.com/python/cpython/issues/93453

   (23) https://github.com/python/cpython/issues/97966

   (24) https://github.com/python/cpython/issues/98248

   (25) https://github.com/python/cpython/issues/98108

   (26) https://github.com/python/cpython/issues/98098

   (27) https://github.com/python/cpython/issues/82836

   (28) https://github.com/python/cpython/issues/96828

   (29) https://github.com/python/cpython/issues/88863

   (30) https://github.com/python/cpython/issues/91078

   (31) https://bugs.python.org/issue?@action=redirect&bpo=47220

   (32) https://bugs.python.org/issue?@action=redirect&bpo=44817

   (33) https://bugs.python.org/issue?@action=redirect&bpo=41260

   (34) https://bugs.python.org/issue?@action=redirect&bpo=15999


File: python.info,  Node: ドキュメント<26>,  Next: テスト<25>,  Prev: ライブラリ<76>,  Up: Python 3 12 0 alpha 3

1.24.32.6 ドキュメント
......................

   - gh-99931(1): Use sphinxext-opengraph(2) to generate OpenGraph
     metadata(3).

   - gh-89682(4): Reworded docstring of the default ‘__contains__’ to
     clarify that it returns a *note bool: 3c3.

   - gh-88330(5): Improved the description of what a resource is in
     importlib.resources docs.

   - gh-92892(6): Document that calling variadic functions with ctypes
     requires special care on macOS/arm64 (and possibly other
     platforms).

   - bpo-41825(7): Restructured the documentation for the *note
     os.wait*: f98. family of functions, and improved the docs for *note
     os.waitid(): f99. with more explanation of the possible argument
     constants.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99931

   (2) https://sphinxext-opengraph.readthedocs.io/

   (3) https://ogp.me/

   (4) https://github.com/python/cpython/issues/89682

   (5) https://github.com/python/cpython/issues/88330

   (6) https://github.com/python/cpython/issues/92892

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41825


File: python.info,  Node: テスト<25>,  Next: ビルド<29>,  Prev: ドキュメント<26>,  Up: Python 3 12 0 alpha 3

1.24.32.7 テスト
................

   - gh-99892(1): Skip test_normalization() of test_unicodedata if it
     fails to download NormalizationTest.txt file from pythontest.net.
     Patch by Victor Stinner.

   - gh-99934(2): Correct test_marsh on (32 bit) x86: test_deterministic
     sets was failing.

   - gh-99741(3): We've implemented multi-phase init (PEP 489/630/687)
     for the internal (for testing) _xxsubinterpreters module.

   - gh-99659(4): Optional big memory tests in ‘test_sqlite3’ now catch
     the correct ‘sqlite.DataError’ exception type in case of too large
     strings and/or blobs passed.

   - gh-99593(5): Cover the Unicode C API with tests.

   - gh-96002(6): Add functional test for Argument Clinic.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99892

   (2) https://github.com/python/cpython/issues/99934

   (3) https://github.com/python/cpython/issues/99741

   (4) https://github.com/python/cpython/issues/99659

   (5) https://github.com/python/cpython/issues/99593

   (6) https://github.com/python/cpython/issues/96002


File: python.info,  Node: ビルド<29>,  Next: Windows<27>,  Prev: テスト<25>,  Up: Python 3 12 0 alpha 3

1.24.32.8 ビルド
................

   - gh-99086(1): Fix ‘-Wimplicit-int’, ‘-Wstrict-prototypes’, and
     ‘-Wimplicit-function-declaration’ compiler warnings in ‘configure’
     checks.

   - gh-99337(2): Fix a compilation issue with GCC 12 on macOS.

   - gh-99289(3): Add a ‘COMPILEALL_OPTS’ variable in Makefile to
     override *note compileall: 21. options (default: ‘-j0’) in ‘make
     install’.  Also merged the ‘compileall’ commands into a single
     command building .pyc files for the all optimization levels (0, 1,
     2) at once.  Patch by Victor Stinner.

   - gh-98872(4): Fix a possible fd leak in ‘Programs/_freeze_module.c’
     introduced in Python 3.11.

   - gh-88226(5): Always define ‘TARGET_*’ labels in ‘Python/ceval.c’,
     even if ‘USE_COMPUTED_GOTOS’ is disabled.  This allows breakpoints
     to be set at those labels in (for instance) ‘gdb’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99086

   (2) https://github.com/python/cpython/issues/99337

   (3) https://github.com/python/cpython/issues/99289

   (4) https://github.com/python/cpython/issues/98872

   (5) https://github.com/python/cpython/issues/88226


File: python.info,  Node: Windows<27>,  Next: macOS<18>,  Prev: ビルド<29>,  Up: Python 3 12 0 alpha 3

1.24.32.9 Windows
.................

   - gh-99345(1): Use faster initialization functions to detect install
     location for Windows Store package

   - gh-98629(2): Fix initialization of *note sys.version: 49c. and
     ‘sys._git’ on Windows

   - gh-99442(3): Fix handling in *note Python install manager: 7da.
     when ‘argv[0]’ does not include a file extension.

   - bpo-40882(4): Fix a memory leak in *note
     multiprocessing.shared_memory.SharedMemory: 19d8. on Windows.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99345

   (2) https://github.com/python/cpython/issues/98629

   (3) https://github.com/python/cpython/issues/99442

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40882


File: python.info,  Node: macOS<18>,  Next: Tools/Demos<23>,  Prev: Windows<27>,  Up: Python 3 12 0 alpha 3

1.24.32.10 macOS
................

   - gh-87235(1): On macOS ‘python3 /dev/fd/9 9</path/to/script.py’
     failed for any script longer than a couple of bytes.

   - gh-98940(2): Fix ‘Mac/Extras.install.py’ file filter bug.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/87235

   (2) https://github.com/python/cpython/issues/98940


File: python.info,  Node: Tools/Demos<23>,  Next: C API<27>,  Prev: macOS<18>,  Up: Python 3 12 0 alpha 3

1.24.32.11 Tools/Demos
......................

   - gh-64490(1): Argument Clinic varargs bugfixes

        * Fix out-of-bounds error in
          ‘_PyArg_UnpackKeywordsWithVararg()’.

        * Fix incorrect check which allowed more than one varargs in
          clinic.py.

        * Fix miscalculation of ‘noptargs’ in generated code.

        * Do not generate ‘noptargs’ when there is a vararg argument and
          no optional argument.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/64490


File: python.info,  Node: C API<27>,  Prev: Tools/Demos<23>,  Up: Python 3 12 0 alpha 3

1.24.32.12 C API
................

   - gh-98680(1): ‘PyBUF_*’ constants were marked as part of Limited API
     of Python 3.11+.  These were available in 3.11.0 with *note
     Py_LIMITED_API: 660. defined for 3.11, and are necessary to use the
     buffer API.

   - gh-99612(2): Fix *note PyUnicode_DecodeUTF8Stateful(): 1b17. for
     ASCII-only data: ‘*consumed’ was not set.

   - gh-47146(3): The ‘structmember.h’ header is deprecated.  Its
     non-deprecated contents are now available just by including
     ‘Python.h’, with a ‘Py_’ prefix added if it was missing.
     (Deprecated contents are *note T_OBJECT: 7b0, *note T_NONE: 7b2,
     and no-op flags.)  Patch by Petr Viktorin, based on earlier work by
     Alexander Belopolsky and Matthias Braun.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98680

   (2) https://github.com/python/cpython/issues/99612

   (3) https://github.com/python/cpython/issues/47146


File: python.info,  Node: Python 3 12 0 alpha 2,  Next: Python 3 12 0 alpha 1,  Prev: Python 3 12 0 alpha 3,  Up: 変更履歴

1.24.33 Python 3.12.0 alpha 2
-----------------------------

'Release date: 2022-11-14'

* Menu:

* セキュリティ: セキュリティ<26>.
* Core and Builtins: Core and Builtins<72>.
* ビルド: ビルド<30>.
* Core and Builtins: Core and Builtins<73>.
* ライブラリ: ライブラリ<77>.
* ドキュメント: ドキュメント<27>.
* テスト: テスト<26>.
* ビルド: ビルド<31>.
* Windows: Windows<28>.
* macOS: macOS<19>.
* C API: C API<28>.


File: python.info,  Node: セキュリティ<26>,  Next: Core and Builtins<72>,  Up: Python 3 12 0 alpha 2

1.24.33.1 セキュリティ
......................

   - gh-98433(1): The IDNA codec decoder used on DNS hostnames by *note
     socket: d1. or *note asyncio: b. related name resolution functions
     no longer involves a quadratic algorithm.  This prevents a
     potential CPU denial of service if an out-of-spec excessive length
     hostname involving bidirectional characters were decoded.  Some
     protocols such as *note urllib: 10e. http ‘3XX’ redirects
     potentially allow for an attacker to supply such a name.

     Individual labels within an IDNA encoded DNS name will now raise an
     error early during IDNA decoding if they are longer than 1024
     unicode characters given that each decoded DNS label must be 63 or
     fewer characters and the entire decoded DNS name is limited to 255.
     Only an application presenting a hostname or label consisting
     primarily of RFC 3454(2) section 3.1 "Nothing" characters to be
     removed would run into of this new limit.  See also RFC 5894(3)
     section 6 and RFC 3491(4).

   - gh-98739(5): Update bundled libexpat to 2.5.0

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98433

   (2) https://datatracker.ietf.org/doc/html/rfc3454.html

   (3) https://datatracker.ietf.org/doc/html/rfc5894.html

   (4) https://datatracker.ietf.org/doc/html/rfc3491.html

   (5) https://github.com/python/cpython/issues/98739


File: python.info,  Node: Core and Builtins<72>,  Next: ビルド<30>,  Prev: セキュリティ<26>,  Up: Python 3 12 0 alpha 2

1.24.33.2 Core and Builtins
...........................

   - gh-81057(1): The docs clearly say that *note PyImport_Inittab:
     1b1b, *note PyImport_AppendInittab(): 1b1c, and *note
     PyImport_ExtendInittab(): 1b1d. should not be used after *note
     Py_Initialize(): 460. has been called.  We now enforce this for the
     two functions.  Additionally, the runtime now uses an internal copy
     of *note PyImport_Inittab: 1b1b, to guard against modification.

   - gh-99298(2): Fix an issue that could potentially cause incorrect
     error handling for some bytecode instructions.

   - gh-99254(3): The compiler now removes all unused constants from
     code objects (except the first one, which may be a docstring).

   - gh-99205(4): Fix an issue that prevented *note PyThreadState: 990.
     and *note PyInterpreterState: aba. memory from being freed
     properly.

   - gh-81057(5): The 18 global C variables holding the state of the
     allocators have been moved to ‘_PyRuntimeState’.  This is a
     strictly internal change with no change in behavior.

   - gh-99181(6): Fix failure in *note except*: 1ac. with unhashable
     exceptions.

   - gh-99204(7): Fix calculation of ‘sys._base_executable’ when inside
     a POSIX virtual environment using copies of the python binary when
     the base installation does not provide the executable name used by
     the venv.  Calculation will fall back to alternative names
     ("python<MAJOR>", "python<MAJOR>.<MINOR>").

   - gh-96055(8): Update *note faulthandler: 5c. to emit an error
     message with the proper unexpected signal number.  Patch by Donghee
     Na.

   - gh-99153(9): Fix location of *note SyntaxError: 18e. for a *note
     try: 8f8. block with both *note except: 1ab. and *note except*:
     1ac.

   - gh-98686(10): Merge the adaptive opcode logic into each
     instruction's unquickened variant, and merge the logic in
     ‘EXTENDED_ARG_QUICK’ into *note EXTENDED_ARG: 1b1e.  With these
     changes, the quickening that happens at code object creation is now
     only responsible for initializing warmup counters and inserting
     superinstructions.

   - gh-99103(11): Fix the error reporting positions of specialized
     traceback anchors when the source line contains Unicode characters.

   - gh-99139(12): Improve the error suggestion for *note NameError:
     452. exceptions for instances.  Now if a *note NameError: 452. is
     raised in a method and the instance has an attribute that's exactly
     equal to the name in the exception, the suggestion will include
     ‘self.<NAME>’ instead of the closest match in the method scope.
     Patch by Pablo Galindo

   - gh-98401(13): Octal escapes with value larger than ‘0o377’ (ex:
     ‘"\477"’), deprecated in Python 3.11, now produce a *note
     SyntaxWarning: 1ae, instead of *note DeprecationWarning: 1a3.  In a
     future Python version they will be eventually a *note SyntaxError:
     18e.  Patch by Victor Stinner.

   - gh-98401(14): A backslash-character pair that is not a valid escape
     sequence now generates a *note SyntaxWarning: 1ae, instead of *note
     DeprecationWarning: 1a3.  For example, ‘re.compile("\d+\.\d+")’ now
     emits a *note SyntaxWarning: 1ae. (‘"\d"’ is an invalid escape
     sequence), use raw strings for regular expression:
     ‘re.compile(r"\d+\.\d+")’.  In a future Python version, *note
     SyntaxError: 18e. will eventually be raised, instead of *note
     SyntaxWarning: 1ae.  Patch by Victor Stinner.

   - gh-96793(15): Handle StopIteration and StopAsyncIteration raised in
     generator or coroutines in the bytecode, rather than in wrapping C
     code.

   - gh-98931(16): Improve the *note SyntaxError: 18e. error message
     when the user types ‘import x from y’ instead of ‘from y import x’.
     Patch by Pablo Galindo

   - gh-98852(17): Fix subscription of type aliases containing bare
     generic types or types like *note TypeVar: 486.: for example
     ‘tuple[A, T][int]’ and ‘tuple[TypeVar, T][int]’, where ‘A’ is a
     generic type, and ‘T’ is a type variable.

   - gh-98925(18): Lower the recursion depth for marshal on WASI to
     support (in-development) wasmtime 2.0.

   - gh-98783(19): Fix multiple crashes in debug mode when ‘str’
     subclasses are used instead of ‘str’ itself.

   - gh-98811(20): Use complete source locations to simplify detection
     of ‘__future__’ imports which are not at the beginning of the file.
     Also corrects the offset in the exception raised in one case, which
     was off by one and impeded highlighting.

   - gh-96793(21): Add specialization of *note FOR_ITER: 1ac2. for
     generators.  Saves multiple layers of dispatch and checking to get
     from the *note FOR_ITER: 1ac2. instruction in the caller to the
     *note RESUME: 5bb. in the generator.

   - gh-98762(22): Fix source locations of *note match: a0e.
     sub-patterns.

   - gh-98586(23): Added the methods *note PyObject_Vectorcall(): 77e.
     and *note PyObject_VectorcallMethod(): 77f. to the *note Limited
     API: 775. along with the auxiliary macro constant *note
     PY_VECTORCALL_ARGUMENTS_OFFSET: 780.

     The availability of these functions enables more efficient PEP
     590(24) vector calls from binary extension modules that avoid
     argument boxing/unboxing overheads.

   - gh-99257(25): Fix an issue where member descriptors (such as those
     for *note __slots__: 1704.) could behave incorrectly or crash
     instead of raising a *note TypeError: 198. when accessed via an
     instance of an invalid type.

   - gh-93143(26): Rather than changing ‘co_code’, the interpreter will
     now display a *note RuntimeWarning: 4d7. and assign *note None:
     885. to any fast locals that are left unbound after jumps or *note
     del: 1b1f. statements executed while tracing.

   - gh-96421(27): When calling into Python code from C code, through
     *note PyEval_EvalFrameEx(): 122f. or a related C-API function, a
     shim frame in inserted into the call stack.  This occurs in the
     ‘_PyEval_EvalFrameDefault()’ function.  The extra frame should be
     invisible to all Python and most C extensions, but out-of-process
     profilers and debuggers need to be aware of it.  These shim frames
     can be detected by checking ‘frame->owner ==
     FRAME_OWNED_BY_CSTACK’.

     Extensions implementing their own interpreters using PEP 523 need
     to be aware of this shim frame and the changes to the semantics of
     *note RETURN_VALUE: 1b20, *note YIELD_VALUE: 5ba, and *note
     RETURN_GENERATOR: 90b, which now clear the frame.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/81057

   (2) https://github.com/python/cpython/issues/99298

   (3) https://github.com/python/cpython/issues/99254

   (4) https://github.com/python/cpython/issues/99205

   (5) https://github.com/python/cpython/issues/81057

   (6) https://github.com/python/cpython/issues/99181

   (7) https://github.com/python/cpython/issues/99204

   (8) https://github.com/python/cpython/issues/96055

   (9) https://github.com/python/cpython/issues/99153

   (10) https://github.com/python/cpython/issues/98686

   (11) https://github.com/python/cpython/issues/99103

   (12) https://github.com/python/cpython/issues/99139

   (13) https://github.com/python/cpython/issues/98401

   (14) https://github.com/python/cpython/issues/98401

   (15) https://github.com/python/cpython/issues/96793

   (16) https://github.com/python/cpython/issues/98931

   (17) https://github.com/python/cpython/issues/98852

   (18) https://github.com/python/cpython/issues/98925

   (19) https://github.com/python/cpython/issues/98783

   (20) https://github.com/python/cpython/issues/98811

   (21) https://github.com/python/cpython/issues/96793

   (22) https://github.com/python/cpython/issues/98762

   (23) https://github.com/python/cpython/issues/98586

   (24) https://peps.python.org/pep-0590/

   (25) https://github.com/python/cpython/issues/99257

   (26) https://github.com/python/cpython/issues/93143

   (27) https://github.com/python/cpython/issues/96421


File: python.info,  Node: ビルド<30>,  Next: Core and Builtins<73>,  Prev: Core and Builtins<72>,  Up: Python 3 12 0 alpha 2

1.24.33.3 ビルド
................

   - gh-98415(1): Fix detection of MAC addresses for *note uuid: 116. on
     certain OSs.  Patch by Chaim Sanders

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98415


File: python.info,  Node: Core and Builtins<73>,  Next: ライブラリ<77>,  Prev: ビルド<30>,  Up: Python 3 12 0 alpha 2

1.24.33.4 Core and Builtins
...........................

   - gh-98686(1): Quicken all code objects, and specialize adaptive
     bytecode instructions more aggressively.

   - gh-92119(2): Print exception class name instead of its string
     representation when raising errors from *note ctypes: 2e. calls.

   - gh-91058(3): *note ImportError: 65b. raised from failed ‘from
     <module> import <name>’ now include suggestions for the value of
     ‘<name>’ based on the available names in ‘<module>’.  Patch by
     Pablo Galindo

   - gh-96793(4): The *note FOR_ITER: 1ac2. now leaves the iterator on
     the stack on termination of the loop.  This is to assist
     specialization of loops for generators.

   - gh-90716(5): Add _pylong.py module.  It includes asymptotically
     faster algorithms that can be used for operations on integers with
     many digits.  It is used by longobject.c to speed up some
     operations.

   - gh-95389(6): Expose *note ETH_P_ALL: 1b23. and some of the *note
     ETHERTYPE_* constants: 1b24. in *note socket: d1.  Patch by Noam
     Cohen.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98686

   (2) https://github.com/python/cpython/issues/92119

   (3) https://github.com/python/cpython/issues/91058

   (4) https://github.com/python/cpython/issues/96793

   (5) https://github.com/python/cpython/issues/90716

   (6) https://github.com/python/cpython/issues/95389


File: python.info,  Node: ライブラリ<77>,  Next: ドキュメント<27>,  Prev: Core and Builtins<73>,  Up: Python 3 12 0 alpha 2

1.24.33.5 ライブラリ
....................

   - gh-93696(1): Allow *note pdb: aa. to locate source for frozen
     modules in the standard library.

   - gh-99418(2): Fix bug in *note urllib.parse.urlparse(): 362. that
     causes URL schemes that begin with a digit, a plus sign, or a minus
     sign to be parsed incorrectly.

   - gh-94597(3): Deprecate ‘asyncio.AbstractChildWatcher’ to be removed
     in Python 3.14.  Patch by Kumar Aditya.

   - gh-99305(4): Improve performance of *note secrets.token_hex():
     1b26.

   - gh-74044(5): Fixed bug where *note inspect.signature(): 22f.
     reported incorrect arguments for decorated methods.

   - gh-99275(6): Fix ‘SystemError’ in *note ctypes: 2e. when exception
     was not set during ‘__initsubclass__’.

   - gh-99277(7): Remove older version of
     ‘_SSLProtocolTransport.get_write_buffer_limits’ in
     ‘asyncio.sslproto’

   - gh-99248(8): fix negative numbers failing in verify()

   - gh-99155(9): Fix *note statistics.NormalDist: c2d. pickle with ‘0’
     and ‘1’ protocols.

   - gh-93464(10): ‘enum.auto()’ is now correctly activated when
     combined with other assignment values.  E.g.  ‘ONE = auto(), 'some
     text'’ will now evaluate as ‘(1, 'some text')’.

   - gh-99134(11): Update the bundled copy of pip to version 22.3.1.

   - gh-92584(12): Remove the ‘distutils’ package.  It was deprecated in
     Python 3.10 by PEP 632(13) "Deprecate distutils module".  For
     projects still using ‘distutils’ and cannot be updated to something
     else, the ‘setuptools’ project can be installed: it still provides
     ‘distutils’.  Patch by Victor Stinner.

   - gh-98999(14): Now ‘_pyio’ is consistent with ‘_io’ in raising
     ‘ValueError’ when executing methods over closed buffers.

   - gh-83004(15): Clean up refleak on failed module initialisation in
     ‘_zoneinfo’

   - gh-83004(16): Clean up refleaks on failed module initialisation in
     ‘_pickle’

   - gh-83004(17): Clean up refleak on failed module initialisation in
     ‘_io’.

   - gh-98897(18): Fix memory leak in *note math.dist(): bf5. when both
     points don't have the same dimension.  Patch by Kumar Aditya.

   - gh-98878(19): Use the frame bound builtins when offering a name
     suggestion in *note traceback: 104. to prevent crashing when
     ‘__builtins__’ is not a dict.

   - gh-98139(20): In ‘importlib._bootstrap’, enhance namespace package
     repr to ‘<module 'x' (namespace) from ['path']>’.

   - gh-90352(21): Fix ‘_SelectorDatagramTransport’ to inherit from
     *note DatagramTransport: 1b27. in *note asyncio: b.  Patch by Kumar
     Aditya.

   - gh-98793(22): Fix argument typechecks in ‘_overlapped.WSAConnect()’
     and ‘_overlapped.Overlapped.WSASendTo()’ functions.

   - gh-98744(23): Prevent crashing in *note traceback: 104. when
     retrieving the byte-offset for some source files that contain
     certain unicode characters.

   - gh-98740(24): Fix internal error in the *note re: be. module which
     in very rare circumstances prevented compilation of a regular
     expression containing a *note conditional expression: 1b28. without
     the "else" branch.

   - gh-98703(25): Fix *note asyncio.StreamWriter.drain(): 1b29. to call
     ‘protocol.connection_lost’ callback only once on Windows.

   - gh-98624(26): Add a mutex to unittest.mock.NonCallableMock to
     protect concurrent access to mock attributes.

   - gh-98658(27): The *note array.array: 4be. class now supports
     subscripting, making it a *note generic type: 1a1.

   - gh-98284(28): Improved *note TypeError: 198. message for undefined
     abstract methods of a *note abc.ABC: 111b. instance.  The names of
     the missing methods are surrounded by single-quotes to highlight
     them.

   - gh-96151(29): Allow ‘BUILTINS’ to be a valid field name for frozen
     dataclasses.

   - gh-98086(30): Make sure ‘patch.dict()’ can be applied on async
     functions.

   - gh-72719(31): Remove modules ‘asyncore’ and ‘asynchat’, which were
     deprecated by PEP 594(32).

   - gh-96192(33): Fix handling of ‘bytes’ *note path-like objects: 5a1.
     in ‘os.ismount()’.

   - gh-94172(34): *note ftplib: 62.: Remove the ‘FTP_TLS.ssl_version’
     class attribute: use the 'context' parameter instead.  Patch by
     Victor Stinner

   - gh-94172(35): Remove the 'keyfile' and 'certfile' parameters from
     the *note ftplib: 62, *note imaplib: 78, *note poplib: b1. and
     *note smtplib: cf. modules, and the 'key_file', 'cert_file' and
     'check_hostname' parameters from the *note http.client: 73. module,
     all deprecated since Python 3.6.  Use the 'context' parameter
     ('ssl_context' in *note imaplib: 78.) instead.  Patch by Victor
     Stinner.

   - gh-83638(36): Add the *note autocommit: 6dd. attribute to *note
     sqlite3.Connection: 54d. and the 'autocommit' parameter to *note
     sqlite3.connect(): 5a6. to control PEP 249(37)-compliant *note
     transaction handling: 6de.  Patch by Erlend E. Aasland.

   - gh-92452(38): Fixed a race condition that could cause *note
     sysconfig.get_config_var(): 174. to incorrectly return *note None:
     885. in multi-threaded programs.

   - gh-91803(39): Fix an error when using a method of objects mocked
     with *note unittest.mock.create_autospec(): 1934. after it was
     sealed with *note unittest.mock.seal(): d9a. function.

   - bpo-38523(40): *note shutil.copytree(): c1e. now applies the
     'ignore_dangling_symlinks' argument recursively.

   - bpo-40358(41): Add walk_up argument in *note
     pathlib.PurePath.relative_to(): 2fd.

   - bpo-36267(42): Fix IndexError in *note argparse.ArgumentParser:
     1bd. when a ‘store_true’ action is given an explicit argument.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/93696

   (2) https://github.com/python/cpython/issues/99418

   (3) https://github.com/python/cpython/issues/94597

   (4) https://github.com/python/cpython/issues/99305

   (5) https://github.com/python/cpython/issues/74044

   (6) https://github.com/python/cpython/issues/99275

   (7) https://github.com/python/cpython/issues/99277

   (8) https://github.com/python/cpython/issues/99248

   (9) https://github.com/python/cpython/issues/99155

   (10) https://github.com/python/cpython/issues/93464

   (11) https://github.com/python/cpython/issues/99134

   (12) https://github.com/python/cpython/issues/92584

   (13) https://peps.python.org/pep-0632/

   (14) https://github.com/python/cpython/issues/98999

   (15) https://github.com/python/cpython/issues/83004

   (16) https://github.com/python/cpython/issues/83004

   (17) https://github.com/python/cpython/issues/83004

   (18) https://github.com/python/cpython/issues/98897

   (19) https://github.com/python/cpython/issues/98878

   (20) https://github.com/python/cpython/issues/98139

   (21) https://github.com/python/cpython/issues/90352

   (22) https://github.com/python/cpython/issues/98793

   (23) https://github.com/python/cpython/issues/98744

   (24) https://github.com/python/cpython/issues/98740

   (25) https://github.com/python/cpython/issues/98703

   (26) https://github.com/python/cpython/issues/98624

   (27) https://github.com/python/cpython/issues/98658

   (28) https://github.com/python/cpython/issues/98284

   (29) https://github.com/python/cpython/issues/96151

   (30) https://github.com/python/cpython/issues/98086

   (31) https://github.com/python/cpython/issues/72719

   (32) https://peps.python.org/pep-0594/

   (33) https://github.com/python/cpython/issues/96192

   (34) https://github.com/python/cpython/issues/94172

   (35) https://github.com/python/cpython/issues/94172

   (36) https://github.com/python/cpython/issues/83638

   (37) https://peps.python.org/pep-0249/

   (38) https://github.com/python/cpython/issues/92452

   (39) https://github.com/python/cpython/issues/91803

   (40) https://bugs.python.org/issue?@action=redirect&bpo=38523

   (41) https://bugs.python.org/issue?@action=redirect&bpo=40358

   (42) https://bugs.python.org/issue?@action=redirect&bpo=36267


File: python.info,  Node: ドキュメント<27>,  Next: テスト<26>,  Prev: ライブラリ<77>,  Up: Python 3 12 0 alpha 2

1.24.33.6 ドキュメント
......................

   - gh-98832(1): Changes wording of docstring for *note
     pathlib.Path.iterdir(): 26e.

   - gh-97966(2): Update uname docs to clarify the special nature of the
     platform attribute and to indicate when it became late-bound.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98832

   (2) https://github.com/python/cpython/issues/97966


File: python.info,  Node: テスト<26>,  Next: ビルド<31>,  Prev: ドキュメント<27>,  Up: Python 3 12 0 alpha 2

1.24.33.7 テスト
................

   - gh-98903(1): The Python test suite now fails with exit code 4 if no
     tests ran.  It should help detecting typos in test names and test
     methods.

   - gh-98713(2): Fix a bug in the *note typing: 10a. tests where a test
     relying on CPython-specific implementation details was not
     decorated with ‘@cpython_only’ and was not skipped on other
     implementations.

   - gh-87390(3): Add tests for star-unpacking with PEP 646, and some
     other miscellaneous PEP 646 tests.

   - gh-96853(4): Added explicit coverage of ‘Py_Initialize’ (and hence
     ‘Py_InitializeEx’) back to the embedding tests (all other embedding
     tests migrated to ‘Py_InitializeFromConfig’ in Python 3.11)

   - bpo-34272(5): Some C API tests were moved into the new
     Lib/test/test_capi/ directory.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98903

   (2) https://github.com/python/cpython/issues/98713

   (3) https://github.com/python/cpython/issues/87390

   (4) https://github.com/python/cpython/issues/96853

   (5) https://bugs.python.org/issue?@action=redirect&bpo=34272


File: python.info,  Node: ビルド<31>,  Next: Windows<28>,  Prev: テスト<26>,  Up: Python 3 12 0 alpha 2

1.24.33.8 ビルド
................

   - gh-99086(1): Fix ‘-Wimplicit-int’ compiler warning in ‘configure’
     check for ‘PTHREAD_SCOPE_SYSTEM’.

   - gh-99016(2): Fix build with ‘PYTHON_FOR_REGEN=python3.8’.

   - gh-97731(3): Specify the full path to the source location for ‘make
     docclean’ (needed for cross-builds).

   - gh-98949(4): Drop unused build dependency on ‘readelf’.

   - gh-98989(5): Use ‘python3.11’, if available, for regeneration and
     freezing.

   - gh-98831(6): Add new tooling, in ‘Tools/cases_generator’, to
     generate the interpreter switch statement from a list of opcode
     definitions.  This only affects adding, modifying or removing
     instruction definitions.  The instruction definitions now live in
     ‘Python/bytecodes.c’, in the form of a custom DSL (under
     development)(7).  The tooling reads this file and writes
     ‘Python/generated_cases.c.h’, which is then included by
     ‘Python/ceval.c’ to provide most of the cases of the main
     interpreter switch.

   - gh-98817(8): Remove PCbuild/lib.pyproj: it's not used for anything,
     is only a minor convenience for Visual Studio users (who probably
     mostly don't even know about it), and it takes a lot of maintenance
     effort to keep updated.

   - gh-98776(9): Fix ‘make regen-test-levenshtein’ for out-of-tree
     builds.

   - gh-98707(10): Don't use vendored ‘libmpdec’ headers if *note
     -with-system-libmpdec: 657. is passed to ‘configure’.  Don't use
     vendored ‘libexpat’ headers if *note -with-system-expat: 1b2d. is
     passed to ‘configure’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/99086

   (2) https://github.com/python/cpython/issues/99016

   (3) https://github.com/python/cpython/issues/97731

   (4) https://github.com/python/cpython/issues/98949

   (5) https://github.com/python/cpython/issues/98989

   (6) https://github.com/python/cpython/issues/98831

   (7) 
https://github.com/faster-cpython/ideas/blob/main/3.12/interpreter_definition.md

   (8) https://github.com/python/cpython/issues/98817

   (9) https://github.com/python/cpython/issues/98776

   (10) https://github.com/python/cpython/issues/98707


File: python.info,  Node: Windows<28>,  Next: macOS<19>,  Prev: ビルド<31>,  Up: Python 3 12 0 alpha 2

1.24.33.9 Windows
.................

   - gh-98689(1): Update Windows builds to zlib v1.2.13.  v1.2.12 has
     CVE 2022-37434(2), but the vulnerable ‘inflateGetHeader’ API is not
     used by Python.

   - gh-98790(3): Assumes that a missing ‘DLLs’ directory means that
     standard extension modules are in the executable's directory.

   - gh-98745(4): Update ‘py.exe’ launcher to install 3.11 by default
     and 3.12 on request.

   - gh-98692(5): Fix the *note Python install manager: 7da. ignoring
     unrecognized shebang lines instead of treating them as local paths

   - gh-94328(6): Update Windows installer to use SQLite 3.39.4.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98689

   (2) https://www.cve.org/CVERecord?id=CVE-2022-37434

   (3) https://github.com/python/cpython/issues/98790

   (4) https://github.com/python/cpython/issues/98745

   (5) https://github.com/python/cpython/issues/98692

   (6) https://github.com/python/cpython/issues/94328


File: python.info,  Node: macOS<19>,  Next: C API<28>,  Prev: Windows<28>,  Up: Python 3 12 0 alpha 2

1.24.33.10 macOS
................

   - gh-94328(1): Update macOS installer to SQLite 3.39.4.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/94328


File: python.info,  Node: C API<28>,  Prev: macOS<19>,  Up: Python 3 12 0 alpha 2

1.24.33.11 C API
................

   - gh-98724(1): The *note Py_CLEAR: 798, *note Py_SETREF: 799. and
     *note Py_XSETREF: 79a. macros now only evaluate their argument
     once.  If the argument has side effects, these side effects are no
     longer duplicated.  Patch by Victor Stinner.

   - gh-98978(2): Fix use-after-free in ‘Py_SetPythonHome(NULL)’,
     ‘Py_SetProgramName(NULL)’ and ‘_Py_SetProgramFullPath(NULL)’
     function calls.  Issue reported by Benedikt Reinartz.  Patch by
     Victor Stinner.

   - gh-98410(3): Add ‘getbufferproc’ and ‘releasebufferproc’ to the
     stable API.

   - gh-98610(4): Some configurable capabilities of sub-interpreters
     have changed.  They always allow subprocesses (*note subprocess:
     dc.) now, whereas before subprocesses could be optionally
     disallowed for a sub-interpreter.  Instead ‘os.exec()’ can now be
     disallowed.  Disallowing daemon threads is now supported.
     Disallowing all threads is still allowed, but is never done by
     default.  Note that the optional restrictions are only available
     through ‘_Py_NewInterpreterFromConfig()’, which isn't a public API.
     They do not affect the main interpreter, nor *note
     Py_NewInterpreter(): 1b31.

   - gh-98608(5): A ‘_PyInterpreterConfig’ has been added and
     ‘_Py_NewInterpreter()’ has been renamed to
     ‘_Py_NewInterpreterFromConfig()’.  The "isolated_subinterpreters"
     argument is now a granular config that captures the previous
     behavior.  Note that this is all "private" API.

   - gh-96853(6): ‘Py_InitializeEx’ now correctly calls ‘PyConfig_Clear’
     after initializing the interpreter (the omission didn't cause a
     memory leak only because none of the dynamically allocated config
     fields are populated by the wrapper function)

   - gh-91248(7): Add *note PyFrame_GetVar(): 789. and *note
     PyFrame_GetVarString(): 78a. functions to get a frame variable by
     its name.  Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98724

   (2) https://github.com/python/cpython/issues/98978

   (3) https://github.com/python/cpython/issues/98410

   (4) https://github.com/python/cpython/issues/98610

   (5) https://github.com/python/cpython/issues/98608

   (6) https://github.com/python/cpython/issues/96853

   (7) https://github.com/python/cpython/issues/91248


File: python.info,  Node: Python 3 12 0 alpha 1,  Next: Python 3 11 0 beta 1,  Prev: Python 3 12 0 alpha 2,  Up: 変更履歴

1.24.34 Python 3.12.0 alpha 1
-----------------------------

'Release date: 2022-10-25'

* Menu:

* セキュリティ: セキュリティ<27>.
* Core and Builtins: Core and Builtins<74>.
* ライブラリ: ライブラリ<78>.
* Core and Builtins: Core and Builtins<75>.
* ライブラリ: ライブラリ<79>.
* Core and Builtins: Core and Builtins<76>.
* ライブラリ: ライブラリ<80>.
* Core and Builtins: Core and Builtins<77>.
* ライブラリ: ライブラリ<81>.
* Core and Builtins: Core and Builtins<78>.
* ライブラリ: ライブラリ<82>.
* Core and Builtins: Core and Builtins<79>.
* ライブラリ: ライブラリ<83>.
* Core and Builtins: Core and Builtins<80>.
* ライブラリ: ライブラリ<84>.
* Core and Builtins: Core and Builtins<81>.
* ライブラリ: ライブラリ<85>.
* Core and Builtins: Core and Builtins<82>.
* ライブラリ: ライブラリ<86>.
* Core and Builtins: Core and Builtins<83>.
* ライブラリ: ライブラリ<87>.
* ドキュメント: ドキュメント<28>.
* テスト: テスト<27>.
* ビルド: ビルド<32>.
* Windows: Windows<29>.
* macOS: macOS<20>.
* IDLE: IDLE<15>.
* Tools/Demos: Tools/Demos<24>.
* C API: C API<29>.


File: python.info,  Node: セキュリティ<27>,  Next: Core and Builtins<74>,  Up: Python 3 12 0 alpha 1

1.24.34.1 セキュリティ
......................

   - gh-97616(1): Fix multiplying a list by an integer (‘list *= int’):
     detect the integer overflow when the new allocated length is close
     to the maximum size.  Issue reported by Jordan Limor.  Patch by
     Victor Stinner.

   - gh-97514(2): On Linux the *note multiprocessing: 98. module returns
     to using filesystem backed unix domain sockets for communication
     with the 'forkserver' process instead of the Linux abstract socket
     namespace.  Only code that chooses to use the *note "forkserver"
     start method: 1d5. is affected.

     Abstract sockets have no permissions and could allow any user on
     the system in the same network namespace(3) (often the whole
     system) to inject code into the multiprocessing 'forkserver'
     process.  This was a potential privilege escalation.  Filesystem
     based socket permissions restrict this to the 'forkserver' process
     user as was the default in Python 3.8 and earlier.

     This prevents Linux CVE 2022-42919(4).

   - gh-87389(5): *note http.server: 76.: Fix an open redirection
     vulnerability in the HTTP server when an URI path starts with ‘//’.
     Vulnerability discovered, and initial fix proposed, by Hamza Avvan.

   - gh-79096(6): LWPCookieJar and MozillaCookieJar create files with
     file mode 600 instead of 644 (Microsoft Windows is not affected)

   - gh-92888(7): Fix ‘memoryview’ use after free when accessing the
     backing buffer in certain cases.

   - gh-68966(8): The deprecated mailcap module now refuses to inject
     unsafe text (filenames, MIME types, parameters) into shell
     commands.  Instead of using such text, it will warn and act as if a
     match was not found (or for test commands, as if the test failed).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97616

   (2) https://github.com/python/cpython/issues/97514

   (3) https://man7.org/linux/man-pages/man7/network_namespaces.7.html

   (4) https://www.cve.org/CVERecord?id=CVE-2022-42919

   (5) https://github.com/python/cpython/issues/87389

   (6) https://github.com/python/cpython/issues/79096

   (7) https://github.com/python/cpython/issues/92888

   (8) https://github.com/python/cpython/issues/68966


File: python.info,  Node: Core and Builtins<74>,  Next: ライブラリ<78>,  Prev: セキュリティ<27>,  Up: Python 3 12 0 alpha 1

1.24.34.2 Core and Builtins
...........................

   - gh-98374(1): Suppress ImportError for invalid query for help()
     command.  Patch by Donghee Na.

   - gh-98461(2): Fix source location in bytecode for list, set and dict
     comprehensions as well as generator expressions.

   - gh-98354(3): Added unicode check for ‘name’ attribute of ‘spec’
     argument passed in ‘_imp.create_builtin()’ function.

   - gh-98398(4): Fix source location of 'assert' bytecodes.

   - gh-98390(5): Fix location of sub-expressions of boolean
     expressions, by reducing their scope to that of the sub-expression.

   - gh-98254(6): Modules from the standard library are now potentially
     suggested as part of the error messages displayed by the
     interpreter when an *note NameError: 452. is raised to the top
     level.  Patch by Pablo Galindo

   - gh-97997(7): Add running column offset to the tokenizer state to
     avoid calculating AST column information with pointer arithmetic.

   - gh-97973(8): Modify the tokenizer to return all necessary
     information the parser needs to set location information in the AST
     nodes, so that the parser does not have to calculate those doing
     pointer arithmetic.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98374

   (2) https://github.com/python/cpython/issues/98461

   (3) https://github.com/python/cpython/issues/98354

   (4) https://github.com/python/cpython/issues/98398

   (5) https://github.com/python/cpython/issues/98390

   (6) https://github.com/python/cpython/issues/98254

   (7) https://github.com/python/cpython/issues/97997

   (8) https://github.com/python/cpython/issues/97973


File: python.info,  Node: ライブラリ<78>,  Next: Core and Builtins<75>,  Prev: Core and Builtins<74>,  Up: Python 3 12 0 alpha 1

1.24.34.3 ライブラリ
....................

   - gh-96078(1): *note os.sched_yield(): 1329. now release the GIL
     while calling sched_yield(2).  Patch by Donghee Na.

   - gh-97955(2): Migrate *note zoneinfo: 13a. to Argument Clinic.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/96078

   (2) https://github.com/python/cpython/issues/97955


File: python.info,  Node: Core and Builtins<75>,  Next: ライブラリ<79>,  Prev: ライブラリ<78>,  Up: Python 3 12 0 alpha 1

1.24.34.4 Core and Builtins
...........................

   - gh-97912(1): The compiler now avoids quadratic behavior when
     finding which instructions should use the *note LOAD_FAST_CHECK:
     70b. opcode.

   - gh-97002(2): Fix an issue where several frame objects could be
     backed by the same interpreter frame, possibly leading to corrupted
     memory and hard crashes of the interpreter.

   - gh-97943(3): Bugfix: *note PyFunction_GetAnnotations(): 1b37.
     should return a borrowed reference.  It was returning a new
     reference.

   - gh-97922(4): The Garbage Collector now runs only on the eval
     breaker mechanism of the Python bytecode evaluation loop instead on
     object allocations.  The GC can also run when *note
     PyErr_CheckSignals(): 693. is called so C extensions that need to
     run for a long time without executing any Python code also have a
     chance to execute the GC periodically.

   - gh-65961(5): When ‘__package__’ is different than
     ‘__spec__.parent’, raise a ‘DeprecationWarning’ instead of
     ‘ImportWarning’.

     Also remove ‘importlib.util.set_package()’ which was scheduled for
     removal.

   - gh-97850(6): Long deprecated, ‘module_repr()’ should now be
     completely eradicated.

   - gh-86298(7): In cases where ‘warnings.warn_explicit()’ consults the
     module's loader, an ‘DeprecationWarning’ is issued when
     ‘m.__loader__’ differs from ‘m.__spec__.loader’.

   - gh-97779(8): Ensure that all Python frame objects are backed by
     "complete" frames.

   - gh-91052(9): Add API for subscribing to modification events on
     selected dictionaries.

   - gh-97752(10): Fix possible data corruption or crashes when
     accessing the ‘f_back’ member of newly-created generator or
     coroutine frames.

   - gh-97591(11): Fixed a missing incref/decref pair in
     ‘Exception.__setstate__()’.  Patch by Ofey Chan.

   - gh-97670(12): Remove the ‘sys.getdxp()’ function and the
     ‘Tools/scripts/analyze_dxp.py’ script.  DXP stands for "dynamic
     execution pairs".  They were related to ‘DYNAMIC_EXECUTION_PROFILE’
     and ‘DXPAIRS’ macros which have been removed in Python 3.11.
     Python can now be built with *note ./configure -enable-pystats:
     1b38. to gather statistics on Python opcodes.  Patch by Victor
     Stinner.

   - gh-94526(13): Fix the Python path configuration used to initialized
     *note sys.path: 3e4. at Python startup.  Paths are no longer
     encoded to UTF-8/strict to avoid encoding errors if it contains
     surrogate characters (bytes paths are decoded with the
     surrogateescape error handler).  Patch by Victor Stinner.

   - gh-96670(14): The parser now raises *note SyntaxError: 18e. when
     parsing source code containing null bytes.  Patch by Pablo Galindo

   - gh-96975(15): Fix a crash occurring when *note PyEval_GetFrame():
     1b39. is called while the topmost Python frame is in a
     partially-initialized state.

   - gh-96848(16): Fix command line parsing: reject *note -X
     int_max_str_digits: 16f. option with no value (invalid) when the
     *note PYTHONINTMAXSTRDIGITS: 1b3a. environment variable is set to a
     valid limit.  Patch by Victor Stinner.

   - gh-95921(17): Fix overly-broad source position information for
     chained comparisons used as branching conditions.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97912

   (2) https://github.com/python/cpython/issues/97002

   (3) https://github.com/python/cpython/issues/97943

   (4) https://github.com/python/cpython/issues/97922

   (5) https://github.com/python/cpython/issues/65961

   (6) https://github.com/python/cpython/issues/97850

   (7) https://github.com/python/cpython/issues/86298

   (8) https://github.com/python/cpython/issues/97779

   (9) https://github.com/python/cpython/issues/91052

   (10) https://github.com/python/cpython/issues/97752

   (11) https://github.com/python/cpython/issues/97591

   (12) https://github.com/python/cpython/issues/97670

   (13) https://github.com/python/cpython/issues/94526

   (14) https://github.com/python/cpython/issues/96670

   (15) https://github.com/python/cpython/issues/96975

   (16) https://github.com/python/cpython/issues/96848

   (17) https://github.com/python/cpython/issues/95921


File: python.info,  Node: ライブラリ<79>,  Next: Core and Builtins<76>,  Prev: Core and Builtins<75>,  Up: Python 3 12 0 alpha 1

1.24.34.5 ライブラリ
....................

   - gh-96821(1): Fix undefined behaviour in ‘audioop.c’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/96821


File: python.info,  Node: Core and Builtins<76>,  Next: ライブラリ<80>,  Prev: ライブラリ<79>,  Up: Python 3 12 0 alpha 1

1.24.34.6 Core and Builtins
...........................

   - gh-96821(1): Fix undefined behaviour in ‘_testcapimodule.c’.

   - gh-95778(2): When *note ValueError: 2ec. is raised if an integer is
     larger than the limit, mention the *note
     sys.set_int_max_str_digits(): 18f1. function in the error message.
     Patch by Victor Stinner.

   - gh-96387(3): At Python exit, sometimes a thread holding the GIL can
     wait forever for a thread (usually a daemon thread) which requested
     to drop the GIL, whereas the thread already exited.  To fix the
     race condition, the thread which requested the GIL drop now resets
     its request before exiting.  Issue discovered and analyzed by
     Mingliang ZHAO. Patch by Victor Stinner.

   - gh-96864(4): Fix a possible assertion failure, fatal error, or
     *note SystemError: 795. if a line tracing event raises an exception
     while opcode tracing is enabled.

   - gh-95778(5): The ‘PyLong_FromString’ function was refactored to
     make it more maintainable and extensible.

   - gh-96678(6): Fix undefined behaviour in C code of null pointer
     arithmetic.

   - gh-96754(7): Make sure that all frame objects created are created
     from valid interpreter frames.  Prevents the possibility of invalid
     frames in backtraces and signal handlers.

   - gh-90997(8): Improve the performance of reading and writing inline
     bytecode caches on some platforms.

   - gh-96751(9): Remove dead code from ‘CALL_FUNCTION_EX’ opcode.

   - gh-90751(10): *note memoryview: 165. now supports half-floats.
     Patch by Donghee Na and Antoine Pitrou.

   - gh-96678(11): Fix case of undefined behavior in ceval.c

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/96821

   (2) https://github.com/python/cpython/issues/95778

   (3) https://github.com/python/cpython/issues/96387

   (4) https://github.com/python/cpython/issues/96864

   (5) https://github.com/python/cpython/issues/95778

   (6) https://github.com/python/cpython/issues/96678

   (7) https://github.com/python/cpython/issues/96754

   (8) https://github.com/python/cpython/issues/90997

   (9) https://github.com/python/cpython/issues/96751

   (10) https://github.com/python/cpython/issues/90751

   (11) https://github.com/python/cpython/issues/96678


File: python.info,  Node: ライブラリ<80>,  Next: Core and Builtins<77>,  Prev: Core and Builtins<76>,  Up: Python 3 12 0 alpha 1

1.24.34.7 ライブラリ
....................

   - gh-64373(1): Convert ‘_functools’ to argument clinic.

   - gh-96641(2): Do not expose ‘KeyWrapper’ in ‘_functools’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/64373

   (2) https://github.com/python/cpython/issues/96641


File: python.info,  Node: Core and Builtins<77>,  Next: ライブラリ<81>,  Prev: ライブラリ<80>,  Up: Python 3 12 0 alpha 1

1.24.34.8 Core and Builtins
...........................

   - gh-96636(1): Ensure that tracing, ‘sys.setrace()’, is turned on
     immediately.  In pre-release versions of 3.11, some tracing events
     might have been lost when turning on tracing in a ‘__del__’ method
     or interrupt.

   - gh-96572(2): Fix use after free in trace refs build mode.  Patch by
     Kumar Aditya.

   - gh-96611(3): When loading a file with invalid UTF-8 inside a
     multi-line string, a correct SyntaxError is emitted.

   - gh-96612(4): Make sure that incomplete frames do not show up in
     tracemalloc traces.

   - gh-90230(5): Fix compiler warnings and test failures when building
     with ‘--enable-pystats’.

   - gh-96587(6): Correctly raise ‘SyntaxError’ on exception groups (
     PEP 654(7)) on python versions prior to 3.11

   - gh-96569(8): Remove two cases of undefined behavior, by adding NULL
     checks.

   - gh-96582(9): Fix possible ‘NULL’ pointer dereference in
     ‘_PyThread_CurrentFrames’.  Patch by Kumar Aditya.

   - gh-91079(10): Separate Python recursion checking from C recursion
     checking which reduces the chance of C stack overflow and allows
     the recursion limit to be increased safely.

   - gh-93911(11): Fix an issue that could prevent *note LOAD_ATTR: 704.
     from specializing properly when accessing properties.

   - gh-96348(12): Emit a DeprecationWarning when *note throw(): 71c,
     *note throw(): 71b. or *note athrow(): 71d. are called with more
     than one argument.

   - gh-95196(13): Disable incorrect pickling of the C implemented
     classmethod descriptors.

   - gh-96364(14): Fix text signatures of ‘list.__getitem__’ and
     ‘dict.__getitem__’.

   - gh-96352(15): Fix *note AttributeError: 5f0. missing ‘name’ and
     ‘obj’ attributes in *note object.__getattribute__(): dcb.  Patch by
     Philip Georgi.

   - gh-93554(16): Change the jump opcodes so that all conditional jumps
     are forward jumps.  Backward jumps are converted by the assembler
     into a conditional forward jump whose target is the fallthrough
     block (and with a reversed condition), followed by an unconditional
     backward jump.  For example:

     ‘POP_JUMP_IF_TRUE BACKWARD_TARGET’ becomes ‘POP_JUMP_IF_FALSE
     NEXT_BLOCK; JUMP BACKWARD_TARGET’.

     All the directed conditional jump opcodes were removed:
     ‘POP_JUMP_FORWARD_IF_TRUE’, ‘POP_JUMP_BACKWARD_IF_TRUE’,
     ‘POP_JUMP_FORWARD_IF_FALSE’, ‘POP_JUMP_BACKWARD_IF_FALSE’,
     ‘POP_JUMP_FORWARD_IF_NONE’, ‘POP_JUMP_BACKWARD_IF_NONE’,
     ‘POP_JUMP_FORWARD_IF_NOT_NONE’, ‘POP_JUMP_BACKWARD_IF_NOT_NONE’.

     The corresponding opcodes without direction are no longer
     pseudo-instructions, and they implement the forward conditional
     jumps.

   - gh-96268(17): Loading a file with invalid UTF-8 will now report the
     broken character at the correct location.

   - gh-96237(18): The internal field ‘_PyInterpreterFrame.f_func’ is
     renamed to ‘_PyInterpreterFrame.f_funcobj’ and may be any object.
     The ‘f_globals’ and ‘f_builtin’ fields may hold junk values.

     It is safest to treat the ‘_PyInterpreterFrame’ struct as opaque.

   - gh-96187(19): Fixed a bug that caused ‘_PyCode_GetExtra’ to return
     garbage for negative indexes.  Patch by Pablo Galindo

   - gh-96143(20): Add a new ‘-X perf’ Python command line option as
     well as *note sys.activate_stack_trampoline(): 69a. and *note
     sys.deactivate_stack_trampoline(): 69b. function in the *note sys:
     df. module that allows to set/unset the interpreter in a way that
     the Linux ‘perf’ profiler can detect Python calls.  The new *note
     sys.is_stack_trampoline_active(): 69c. function allows to query the
     state of the perf trampoline.  Design by Pablo Galindo.  Patch by
     Pablo Galindo and Christian Heimes with contributions from Gregory
     P. Smith [Google] and Mark Shannon.

   - gh-96071(21): Fix a deadlock in *note PyGILState_Ensure(): 64a.
     when allocating new thread state.  Patch by Kumar Aditya.

   - gh-96046(22): *note PyType_Ready(): 980. now initializes
     ‘ht_cached_keys’ and performs additional checks to ensure that type
     objects are properly configured.  This avoids crashes in 3rd party
     packages that don't use regular API to create new types.

   - gh-96005(23): On WASI *note ENOTCAPABLE: 1b3f. is now mapped to
     *note PermissionError: f3e.  The *note errno: 5b. modules exposes
     the new error number.  ‘getpath.py’ now ignores *note
     PermissionError: f3e. when it cannot open landmark files
     ‘pybuilddir.txt’ and ‘pyenv.cfg’.

   - gh-93678(24): Added test a harness for direct unit tests of the
     compiler's optimization stage.  The
     ‘_testinternalcapi.optimize_cfg()’ function runs the optimiser on a
     sequence of instructions.  The ‘CfgOptimizationTestCase’ class in
     ‘test.support’ has utilities for invoking the optimizer and
     checking the output.

   - gh-95245(25): Reduces the size of a "simple" Python object from 8
     to 6 words by moving the weakreflist pointer into the pre-header
     directly before the object's dict/values pointer.

   - gh-90997(26): Compile virtual *note try: 8f8./*note except: 1ab.
     blocks to handle exceptions raised during *note close(): 1793. or
     *note throw(): 71c. calls through a suspended frame.

   - gh-95977(27): Optimized calling *note __get__(): 1701. with
     vectorcall.  Patch by Kumar Aditya.

   - gh-91210(28): Improve error message when a parameter without a
     default value follows one with a default value, and show the same
     message, even when the non-default/default sequence is preceded by
     positional-only parameters.

   - gh-95922(29): Fixed bug where the compiler's
     ‘eliminate_empty_basic_blocks’ function ignores the last block of
     the code unit.

   - gh-95818(30): Skip over incomplete frames in *note
     PyThreadState_GetFrame(): 991.

   - gh-95876(31): Fix format string in
     ‘_PyPegen_raise_error_known_location’ that can lead to memory
     corruption on some 64bit systems.  The function was building a
     tuple with ‘i’ (int) instead of ‘n’ (Py_ssize_t) for Py_ssize_t
     arguments.

   - gh-95605(32): Fix misleading contents of error message when
     converting an all-whitespace string to *note float: 196.

   - gh-95150(33): Update code object hashing and equality to consider
     all debugging and exception handling tables.  This fixes an issue
     where certain non-identical code objects could be "deduplicated"
     during compilation.

   - gh-91146(34): Reduce allocation size of *note list: 24d. from *note
     str.split(): 10aa. and *note str.rsplit(): 146d.  Patch by Donghee
     Na and Inada Naoki.

   - gh-87092(35): Create a 'jump target label' abstraction in the
     compiler so that the compiler's codegen stage does not work
     directly with basic blocks.  This prepares the code for changes to
     the underlying CFG generation mechanism.

   - gh-95355(36): ‘_PyPegen_Parser_New’ now properly detects token
     memory allocation errors.  Patch by Honglin Zhu.

   - gh-90081(37): Run Python code in tracer/profiler function at full
     speed.  Fixes slowdown in earlier versions of 3.11.

   - gh-95324(38): Emit a warning in debug mode if an object does not
     call *note PyObject_GC_UnTrack(): 171e. before deallocation.  Patch
     by Pablo Galindo.

   - gh-95245(39): Merge managed dict and values pointer into a single
     tagged pointer to save one word in the pre-header.

   - gh-93678(40): Add cfg_builder struct and refactor the relevant code
     so that a cfg can be constructed without an instance of the
     compiler struct.

   - gh-95185(41): Prevented crashes in the AST constructor when
     compiling some absurdly long expressions like ‘"+0"*1000000’.
     *note RecursionError: f68. is now raised instead.  Patch by Pablo
     Galindo

   - gh-93351(42): *note ast.AST: 4c3. node positions are now validated
     when provided to *note compile(): 4b1. and other related functions.
     If invalid positions are detected, a *note ValueError: 2ec. will be
     raised.

   - gh-94438(43): Fix an issue that caused extended opcode arguments
     and some conditional pops to be ignored when calculating valid jump
     targets for assignments to the ‘f_lineno’ attribute of frame
     objects.  In some cases, this could cause inconsistent internal
     state, resulting in a hard crash of the interpreter.

   - gh-95060(44): Undocumented ‘PyCode_Addr2Location’ function now
     properly returns when ‘addrq’ argument is less than zero.

   - gh-95113(45): Replace all ‘EXTENDED_ARG_QUICK’ instructions with
     basic *note EXTENDED_ARG: 1b1e. instructions in unquickened code.
     Consumers of non-adaptive bytecode should be able to handle
     extended arguments the same way they were handled in CPython 3.10
     and older.

   - gh-91409(46): Fix incorrect source location info caused by certain
     optimizations in the bytecode compiler.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/96636

   (2) https://github.com/python/cpython/issues/96572

   (3) https://github.com/python/cpython/issues/96611

   (4) https://github.com/python/cpython/issues/96612

   (5) https://github.com/python/cpython/issues/90230

   (6) https://github.com/python/cpython/issues/96587

   (7) https://peps.python.org/pep-0654/

   (8) https://github.com/python/cpython/issues/96569

   (9) https://github.com/python/cpython/issues/96582

   (10) https://github.com/python/cpython/issues/91079

   (11) https://github.com/python/cpython/issues/93911

   (12) https://github.com/python/cpython/issues/96348

   (13) https://github.com/python/cpython/issues/95196

   (14) https://github.com/python/cpython/issues/96364

   (15) https://github.com/python/cpython/issues/96352

   (16) https://github.com/python/cpython/issues/93554

   (17) https://github.com/python/cpython/issues/96268

   (18) https://github.com/python/cpython/issues/96237

   (19) https://github.com/python/cpython/issues/96187

   (20) https://github.com/python/cpython/issues/96143

   (21) https://github.com/python/cpython/issues/96071

   (22) https://github.com/python/cpython/issues/96046

   (23) https://github.com/python/cpython/issues/96005

   (24) https://github.com/python/cpython/issues/93678

   (25) https://github.com/python/cpython/issues/95245

   (26) https://github.com/python/cpython/issues/90997

   (27) https://github.com/python/cpython/issues/95977

   (28) https://github.com/python/cpython/issues/91210

   (29) https://github.com/python/cpython/issues/95922

   (30) https://github.com/python/cpython/issues/95818

   (31) https://github.com/python/cpython/issues/95876

   (32) https://github.com/python/cpython/issues/95605

   (33) https://github.com/python/cpython/issues/95150

   (34) https://github.com/python/cpython/issues/91146

   (35) https://github.com/python/cpython/issues/87092

   (36) https://github.com/python/cpython/issues/95355

   (37) https://github.com/python/cpython/issues/90081

   (38) https://github.com/python/cpython/issues/95324

   (39) https://github.com/python/cpython/issues/95245

   (40) https://github.com/python/cpython/issues/93678

   (41) https://github.com/python/cpython/issues/95185

   (42) https://github.com/python/cpython/issues/93351

   (43) https://github.com/python/cpython/issues/94438

   (44) https://github.com/python/cpython/issues/95060

   (45) https://github.com/python/cpython/issues/95113

   (46) https://github.com/python/cpython/issues/91409


File: python.info,  Node: ライブラリ<81>,  Next: Core and Builtins<78>,  Prev: Core and Builtins<77>,  Up: Python 3 12 0 alpha 1

1.24.34.9 ライブラリ
....................

   - gh-95023(1): Implement *note os.setns(): 1b41. and *note
     os.unshare(): 1b42. for Linux.  Patch by Noam Cohen.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/95023


File: python.info,  Node: Core and Builtins<78>,  Next: ライブラリ<82>,  Prev: ライブラリ<81>,  Up: Python 3 12 0 alpha 1

1.24.34.10 Core and Builtins
............................

   - gh-94036(1): Fix incorrect source location info for some multi-line
     attribute accesses and method calls.

   - gh-94938(2): Fix error detection in some builtin functions when
     keyword argument name is an instance of a str subclass with
     overloaded ‘__eq__’ and ‘__hash__’.  Previously it could cause
     SystemError or other undesired behavior.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/94036

   (2) https://github.com/python/cpython/issues/94938


File: python.info,  Node: ライブラリ<82>,  Next: Core and Builtins<79>,  Prev: Core and Builtins<78>,  Up: Python 3 12 0 alpha 1

1.24.34.11 ライブラリ
.....................

   - gh-94996(1): *note ast.parse(): 1c2. will no longer parse function
     definitions with positional-only params when passed
     ‘feature_version’ less than ‘(3, 8)’.  Patch by Shantanu Jain.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/94996


File: python.info,  Node: Core and Builtins<79>,  Next: ライブラリ<83>,  Prev: ライブラリ<82>,  Up: Python 3 12 0 alpha 1

1.24.34.12 Core and Builtins
............................

   - gh-94739(1): Allow jumping within, out of, and across exception
     handlers in the debugger.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/94739


File: python.info,  Node: ライブラリ<83>,  Next: Core and Builtins<80>,  Prev: Core and Builtins<79>,  Up: Python 3 12 0 alpha 1

1.24.34.13 ライブラリ
.....................

   - gh-94949(1): *note ast.parse(): 1c2. will no longer parse
     parenthesized context managers when passed ‘feature_version’ less
     than ‘(3, 9)’.  Patch by Shantanu Jain.

   - gh-94947(2): *note ast.parse(): 1c2. will no longer parse
     assignment expressions when passed ‘feature_version’ less than ‘(3,
     8)’.  Patch by Shantanu Jain.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/94949

   (2) https://github.com/python/cpython/issues/94947


File: python.info,  Node: Core and Builtins<80>,  Next: ライブラリ<84>,  Prev: ライブラリ<83>,  Up: Python 3 12 0 alpha 1

1.24.34.14 Core and Builtins
............................

   - gh-91256(1): Ensures the program name is known for help text during
     interpreter startup.

   - gh-94869(2): Fix the column offsets for some expressions in
     multi-line f-strings *note ast: 9. nodes.  Patch by Pablo Galindo.

   - gh-94893(3): Fix an issue where frame object manipulations could
     corrupt inline bytecode caches.

   - gh-94822(4): Fix an issue where lookups of metaclass descriptors
     may be ignored when an identically-named attribute also exists on
     the class itself.

   - gh-91153(5): Fix an issue where a *note bytearray: 344. item
     assignment could crash if it's resized by the new value's
     ‘__index__()’ method.

   - gh-90699(6): Fix reference counting bug in ‘bool.__repr__()’.
     Patch by Kumar Aditya.

   - gh-94694(7): Fix an issue that could cause code with multi-line
     method lookups to have misleading or incorrect column offset
     information.  In some cases (when compiling a hand-built AST) this
     could have resulted in a hard crash of the interpreter.

   - gh-93252(8): Fix an issue that caused internal frames to outlive
     failed Python function calls, possibly resulting in memory leaks or
     hard interpreter crashes.

   - gh-94215(9): Fix an issue where exceptions raised by line-tracing
     events would cause frames to be left in an invalid state, possibly
     resulting in a hard crash of the interpreter.

   - gh-92228(10): Disable the compiler's inline-small-exit-blocks
     optimization for exit blocks that are associated with source code
     lines.  This fixes a bug where the debugger cannot tell where an
     exception handler ends and the following code block begins.

   - gh-94485(11): Line number of a module's ‘RESUME’ instruction is set
     to 0 as specified in PEP 626(12).

   - gh-94438(13): Account for instructions that can push NULL to the
     stack when setting line number in a frame.  Prevents some
     (unlikely) crashes.

   - gh-91719(14): Reload ‘opcode’ when raising ‘unknown opcode error’
     in the interpreter main loop, for C compilers to generate
     dispatching code independently.

   - gh-94329(15): Compile and run code with unpacking of extremely
     large sequences (1000s of elements).  Such code failed to compile.
     It now compiles and runs correctly.

   - gh-94360(16): Fixed a tokenizer crash when reading encoded files
     with syntax errors from ‘stdin’ with non utf-8 encoded text.  Patch
     by Pablo Galindo

   - gh-88116(17): Fix an issue when reading line numbers from code
     objects if the encoded line numbers are close to ‘INT_MIN’.  Patch
     by Pablo Galindo

   - gh-94262(18): Don't create frame objects for incomplete frames.
     Prevents the creation of generators and closures from being
     observable to Python and C extensions, restoring the behavior of
     3.10 and earlier.

   - gh-94192(19): Fix error for dictionary literals with invalid
     expression as value.

   - gh-87995(20): *note types.MappingProxyType: 698. instances are now
     hashable if the underlying mapping is hashable.

   - gh-93883(21): Revise the display strategy of traceback enhanced
     error locations.  The indicators are only shown when the location
     doesn't span the whole line.

   - gh-94163(22): Add *note BINARY_SLICE: 705. and *note STORE_SLICE:
     706. instructions for more efficient handling and better
     specialization of slicing operations, where the slice is explicit
     in the source code.

   - gh-94021(23): Fix unreachable code warning in
     ‘Python/specialize.c’.

   - gh-93911(24): Specialize ‘LOAD_ATTR’ for objects with custom
     ‘__getattribute__’.

   - gh-93955(25): Improve performance of attribute lookups on objects
     with custom ‘__getattribute__’ and ‘__getattr__’.  Patch by Ken
     Jin.

   - gh-93911(26): Specialize ‘LOAD_ATTR’ for ‘property()’ attributes.

   - gh-93678(27): Refactor compiler optimisation code so that it no
     longer needs the ‘struct assembler’ and ‘struct compiler’ passed
     around.  Instead, each function takes the CFG and other data that
     it actually needs.  This will make it possible to test this code
     directly.

   - gh-93841(28): When built with ‘-enable-pystats’, ‘sys._stats_on()’,
     ‘sys._stats_off()’, ‘sys._stats_clear()’ and ‘sys._stats_dump()’
     functions have been added to enable gathering stats for parts of
     programs.

   - gh-93516(29): Store offset of first traceable instruction in code
     object to avoid having to recompute it for each instruction when
     tracing.

   - gh-93516(30): Lazily create a table mapping bytecode offsets to
     line numbers to speed up calculation of line numbers when tracing.

   - gh-89828(31): *note types.GenericAlias: 9ec. no longer relays the
     ‘__class__’ attribute.  For example, ‘isinstance(list[int], type)’
     no longer returns ‘True’.

   - gh-93678(32): Refactor the compiler to reduce boilerplate and
     repetition.

   - gh-93671(33): Fix some exponential backtrace case happening with
     deeply nested sequence patterns in match statements.  Patch by
     Pablo Galindo

   - gh-93662(34): Make sure that the end column offsets are correct in
     multi-line method calls.  Previously, the end column could precede
     the column offset.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/91256

   (2) https://github.com/python/cpython/issues/94869

   (3) https://github.com/python/cpython/issues/94893

   (4) https://github.com/python/cpython/issues/94822

   (5) https://github.com/python/cpython/issues/91153

   (6) https://github.com/python/cpython/issues/90699

   (7) https://github.com/python/cpython/issues/94694

   (8) https://github.com/python/cpython/issues/93252

   (9) https://github.com/python/cpython/issues/94215

   (10) https://github.com/python/cpython/issues/92228

   (11) https://github.com/python/cpython/issues/94485

   (12) https://peps.python.org/pep-0626/

   (13) https://github.com/python/cpython/issues/94438

   (14) https://github.com/python/cpython/issues/91719

   (15) https://github.com/python/cpython/issues/94329

   (16) https://github.com/python/cpython/issues/94360

   (17) https://github.com/python/cpython/issues/88116

   (18) https://github.com/python/cpython/issues/94262

   (19) https://github.com/python/cpython/issues/94192

   (20) https://github.com/python/cpython/issues/87995

   (21) https://github.com/python/cpython/issues/93883

   (22) https://github.com/python/cpython/issues/94163

   (23) https://github.com/python/cpython/issues/94021

   (24) https://github.com/python/cpython/issues/93911

   (25) https://github.com/python/cpython/issues/93955

   (26) https://github.com/python/cpython/issues/93911

   (27) https://github.com/python/cpython/issues/93678

   (28) https://github.com/python/cpython/issues/93841

   (29) https://github.com/python/cpython/issues/93516

   (30) https://github.com/python/cpython/issues/93516

   (31) https://github.com/python/cpython/issues/89828

   (32) https://github.com/python/cpython/issues/93678

   (33) https://github.com/python/cpython/issues/93671

   (34) https://github.com/python/cpython/issues/93662


File: python.info,  Node: ライブラリ<84>,  Next: Core and Builtins<81>,  Prev: Core and Builtins<80>,  Up: Python 3 12 0 alpha 1

1.24.34.15 ライブラリ
.....................

   - gh-93461(1): *note importlib.invalidate_caches(): e0a. now drops
     entries from *note sys.path_importer_cache: 7fa. with a relative
     path as name.  This solves a caching issue when a process changes
     its current working directory.

     ‘FileFinder’ no longer inserts a dot in the path, e.g.
     ‘/egg/./spam’ is now ‘/egg/spam’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/93461


File: python.info,  Node: Core and Builtins<81>,  Next: ライブラリ<85>,  Prev: ライブラリ<84>,  Up: Python 3 12 0 alpha 1

1.24.34.16 Core and Builtins
............................

   - gh-93621(1): Change order of bytecode instructions emitted for
     *note with: 186. and *note async with: 185. to reduce the number of
     entries in the exception table.

   - gh-93533(2): Reduce the size of the inline cache for ‘LOAD_METHOD’
     by 2 bytes.

   - gh-93444(3): Removed redundant fields from the compiler's
     basicblock struct: ‘b_nofallthrough’, ‘b_exit’, ‘b_return’.  They
     can be easily calculated from the opcode of the last instruction of
     the block.

   - gh-93429(4): ‘LOAD_METHOD’ instruction has been removed.  It was
     merged back into ‘LOAD_ATTR’.

   - gh-93418(5): Fixed an assert where an f-string has an equal sign
     '=' following an expression, but there's no trailing brace.  For
     example, f"{i=".

   - gh-93382(6): Cache the result of *note PyCode_GetCode(): 97c.
     function to restore the 'O'(1) lookup of the ‘co_code’ attribute.

   - gh-93359(7): Ensure that custom *note ast: 9. nodes without
     explicit end positions can be compiled.  Patch by Pablo Galindo.

   - gh-93356(8): Code for exception handlers is emitted at the end of
     the code unit's bytecode.  This avoids one jump when no exception
     is raised.

   - gh-93354(9): Use exponential backoff for specialization counters in
     the interpreter.  Can reduce the number of failed specializations
     significantly and avoid slowdown for those parts of a program that
     are not suitable for specialization.

   - gh-93283(10): Improve error message for invalid syntax of
     conversion character in f-string expressions.

   - gh-93345(11): Fix a crash in substitution of a ‘TypeVar’ in nested
     generic alias after ‘TypeVarTuple’.

   - gh-93223(12): When a bytecode instruction jumps to an unconditional
     jump instruction, the first instruction can often be optimized to
     target the unconditional jump's target directly.  For tracing
     reasons, this would previously only occur if both instructions have
     the same line number.  This also now occurs if the unconditional
     jump is artificial, i.e., if it has no associated line number.

   - gh-84694(13): The ‘--experimental-isolated-subinterpreters’
     configure option and ‘EXPERIMENTAL_ISOLATED_SUBINTERPRETERS’ macro
     have been removed.

   - gh-91924(14): Fix ‘__lltrace__’ debug feature if the stdout
     encoding is not UTF-8.  Patch by Victor Stinner.

   - gh-93040(15): Wraps unused parameters in ‘Objects/obmalloc.c’ with
     ‘Py_UNUSED’.

   - gh-93143(16): Avoid ‘NULL’ checks for uninitialized local variables
     by determining at compile time which variables must be initialized.

   - gh-93061(17): Backward jumps after ‘async for’ loops are no longer
     given dubious line numbers.

   - gh-93065(18): Fix contextvars HAMT implementation to handle
     iteration over deep trees.

     The bug was discovered and fixed by Eli Libman.  See
     MagicStack/immutables#84(19) for more details.

   - gh-93012(20): Added the new function *note PyType_FromMetaclass():
     772, which generalizes the existing *note
     PyType_FromModuleAndSpec(): 773. using an additional metaclass
     argument.  This is useful for language binding tools, where it can
     be used to intercept type-related operations like subclassing or
     static attribute access by specifying a metaclass with custom
     slots.

     Importantly, *note PyType_FromMetaclass(): 772. is available in the
     Limited API, which provides a path towards migrating more binding
     tools onto the Stable ABI.

   - gh-93021(21): Fix the ‘__text_signature__’ for ‘__get__()’ methods
     implemented in C. Patch by Jelle Zijlstra.

   - gh-89914(22): The operand of the ‘YIELD_VALUE’ instruction is set
     to the stack depth.  This is done to help frame handling on ‘yield’
     and may assist debuggers.

   - gh-92955(23): Fix memory leak in code object's lines and positions
     iterators as they were not finalized at exit.  Patch by Kumar
     Aditya.

   - gh-92930(24): Fixed a crash in ‘_pickle.c’ from mutating
     collections during ‘__reduce__’ or ‘persistent_id’.

   - gh-90690(25): The PRECALL instruction has been removed.  It offered
     only a small advantage for specialization and is not needed in the
     vast majority of cases.

   - gh-92914(26): Always round the allocated size for lists up to the
     nearest even number.

   - gh-92858(27): Improve error message for some suites with syntax
     error before ':'

   - gh-90473(28): Decrease default recursion limit on WASI to address
     limited call stack size.

   - gh-92804(29): Fix memory leak in ‘memoryview’ iterator as it was
     not finalized at exit.  Patch by Kumar Aditya.

   - gh-92777(30): Specialize ‘LOAD_METHOD’ for objects with lazy
     dictionaries.  Patch by Ken Jin.

   - gh-92658(31): Add support for connecting and binding to Hyper-V
     sockets on Windows Hyper-V hosts and guests.

   - gh-92236(32): Remove spurious "LINE" event when starting a
     generator or coroutine, visible tracing functions implemented in C.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/93621

   (2) https://github.com/python/cpython/issues/93533

   (3) https://github.com/python/cpython/issues/93444

   (4) https://github.com/python/cpython/issues/93429

   (5) https://github.com/python/cpython/issues/93418

   (6) https://github.com/python/cpython/issues/93382

   (7) https://github.com/python/cpython/issues/93359

   (8) https://github.com/python/cpython/issues/93356

   (9) https://github.com/python/cpython/issues/93354

   (10) https://github.com/python/cpython/issues/93283

   (11) https://github.com/python/cpython/issues/93345

   (12) https://github.com/python/cpython/issues/93223

   (13) https://github.com/python/cpython/issues/84694

   (14) https://github.com/python/cpython/issues/91924

   (15) https://github.com/python/cpython/issues/93040

   (16) https://github.com/python/cpython/issues/93143

   (17) https://github.com/python/cpython/issues/93061

   (18) https://github.com/python/cpython/issues/93065

   (19) https://github.com/MagicStack/immutables/issues/84

   (20) https://github.com/python/cpython/issues/93012

   (21) https://github.com/python/cpython/issues/93021

   (22) https://github.com/python/cpython/issues/89914

   (23) https://github.com/python/cpython/issues/92955

   (24) https://github.com/python/cpython/issues/92930

   (25) https://github.com/python/cpython/issues/90690

   (26) https://github.com/python/cpython/issues/92914

   (27) https://github.com/python/cpython/issues/92858

   (28) https://github.com/python/cpython/issues/90473

   (29) https://github.com/python/cpython/issues/92804

   (30) https://github.com/python/cpython/issues/92777

   (31) https://github.com/python/cpython/issues/92658

   (32) https://github.com/python/cpython/issues/92236


File: python.info,  Node: ライブラリ<85>,  Next: Core and Builtins<82>,  Prev: Core and Builtins<81>,  Up: Python 3 12 0 alpha 1

1.24.34.17 ライブラリ
.....................

   - gh-91102(1): ‘_warnings.warn_explicit()’ is ported to Argument
     Clinic.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/91102


File: python.info,  Node: Core and Builtins<82>,  Next: ライブラリ<86>,  Prev: ライブラリ<85>,  Up: Python 3 12 0 alpha 1

1.24.34.18 Core and Builtins
............................

   - gh-92619(1): Make the compiler duplicate an exit block only if none
     of its instructions have a lineno (previously only the first
     instruction in the block was checked, leading to unnecessarily
     duplicated blocks).

   - gh-88750(2): The deprecated debug build only ‘PYTHONTHREADDEBUG’
     environment variable no longer does anything.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/92619

   (2) https://github.com/python/cpython/issues/88750


File: python.info,  Node: ライブラリ<86>,  Next: Core and Builtins<83>,  Prev: Core and Builtins<82>,  Up: Python 3 12 0 alpha 1

1.24.34.19 ライブラリ
.....................

   - gh-92261(1): Fix hang when trying to iterate over a ‘typing.Union’.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/92261


File: python.info,  Node: Core and Builtins<83>,  Next: ライブラリ<87>,  Prev: ライブラリ<86>,  Up: Python 3 12 0 alpha 1

1.24.34.20 Core and Builtins
............................

   - gh-91432(1): Specialized the *note FOR_ITER: 1ac2. opcode using the
     PEP 659 machinery

   - gh-91399(2): Removed duplicate '{0, 0, 0, 0, 0, 0}' entry in
     'Objects/unicodetype_db.h'.

   - gh-91578(3): Updates the error message for abstract class.

   - bpo-47091(4): Improve performance of repetition of *note list: 24d.
     and *note tuple: 614. by using ‘memcpy’ to copy data and performing
     the reference increments in one step.

   - bpo-46142(5): Make ‘--help’ output shorter by moving some info to
     the new ‘--help-env’ and ‘--help-xoptions’ command-line options.
     Also add ‘--help-all’ option to print complete usage.

   - bpo-42316(6): Document some places where an assignment expression
     needs parentheses.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/91432

   (2) https://github.com/python/cpython/issues/91399

   (3) https://github.com/python/cpython/issues/91578

   (4) https://bugs.python.org/issue?@action=redirect&bpo=47091

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46142

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42316


File: python.info,  Node: ライブラリ<87>,  Next: ドキュメント<28>,  Prev: Core and Builtins<83>,  Up: Python 3 12 0 alpha 1

1.24.34.21 ライブラリ
.....................

   - gh-89237(1): Fix hang on Windows in ‘subprocess.wait_closed()’ in
     *note asyncio: b. with *note ProactorEventLoop: 81d.  Patch by
     Kumar Aditya.

   - gh-97928(2): ‘tkinter.Text.count()’ raises now an exception for
     options starting with "-" instead of silently ignoring them.

   - gh-98393(3): The *note os: a5. module no longer accepts bytes-like
     paths, like *note bytearray: 344. and *note memoryview: 165. types:
     only the exact *note bytes: 192. type is accepted for bytes
     strings.  Patch by Victor Stinner.

   - gh-98363(4): Added itertools.batched() to batch data into lists of
     a given length with the last list possibly being shorter than the
     others.

   - gh-98331(5): Update the bundled copies of pip and setuptools to
     versions 22.3 and 65.5.0 respectively.

   - gh-98307(6): A *note createSocket(): 86b. method was added to *note
     SysLogHandler: 86c.

   - gh-96035(7): Fix bug in *note urllib.parse.urlparse(): 362. that
     causes certain port numbers containing whitespace, underscores,
     plus and minus signs, or non-ASCII digits to be incorrectly
     accepted.

   - gh-98257(8): Make *note sys.setprofile(): 1717. and *note
     sys.settrace(): 2e1. functions reentrant.  They can no long fail
     with: ‘RuntimeError("Cannot install a trace function while another
     trace function is being installed")’.  Patch by Victor Stinner.

   - gh-98251(9): Allow *note venv: 117. to pass along ‘PYTHON*’
     variables to ‘ensurepip’ and ‘pip’ when they do not impact path
     resolution

   - gh-94597(10): Deprecated
     ‘asyncio.AbstractEventLoopPolicy.get_child_watcher()’ and
     ‘asyncio.AbstractEventLoopPolicy.set_child_watcher()’ methods to be
     removed in Python 3.14.  Patch by Kumar Aditya.

   - gh-98178(11): On macOS, fix a crash in *note syslog.syslog(): 762.
     in multi-threaded applications.  On macOS, the libc ‘syslog()’
     function is not thread-safe, so *note syslog.syslog(): 762. no
     longer releases the GIL to call it.  Patch by Victor Stinner.

   - gh-44098(12): Release the GIL when creating *note mmap.mmap: 519.
     objects on Unix.

   - gh-87730(13): Wrap network errors consistently in urllib FTP
     support, so the test suite doesn't fail when a network is available
     but the public internet is not reachable.

   - gh-94597(14): The child watcher classes ‘MultiLoopChildWatcher’,
     ‘FastChildWatcher’ and ‘SafeChildWatcher’ are deprecated and will
     be removed in Python 3.14.  Patch by Kumar Aditya.

   - gh-98023(15): Change default child watcher to ‘PidfdChildWatcher’
     on Linux systems which supports it.  Patch by Kumar Aditya.

   - gh-90985(16): Earlier in 3.11 we deprecated
     ‘asyncio.Task.cancel("message")’.  We realized we were too harsh,
     and have undeprecated it.

   - gh-65961(17): Do not rely solely on ‘__cached__’ on modules; code
     will also support ‘__spec__.cached’.

   - gh-97646(18): Replace deprecated ‘application/javascript’ with
     ‘text/javascript’ in *note mimetypes: 93.  See RFC 9239(19).  Patch
     by Noam Cohen.

   - gh-97930(20): Apply changes from importlib_resources 5.8 and 5.9:
     ‘Traversable.joinpath’ provides a concrete implementation.
     ‘as_file’ now supports directories of resources.

   - gh-97850(21): Remove deprecated ‘importlib.util.set_loader()’ and
     ‘importlib.util.module_for_loader()’ from *note importlib.util: 81.

   - gh-97837(22): Change deprecate warning message in *note unittest:
     10c. from

     ‘It is deprecated to return a value!=None’

     to

     ‘It is deprecated to return a value that is not None from a test
     case’

   - gh-97825(23): Fixes *note AttributeError: 5f0. when *note
     subprocess.check_output(): 11c4. is used with argument ‘input=None’
     and either of the arguments 'encoding' or 'errors' are used.

   - gh-97008(24): *note NameError: 452. and *note AttributeError: 5f0.
     spelling suggestions provided since gh-82711(25) are now also
     emitted by the pure Python *note traceback: 104. module.  Tests for
     those suggestions now exercise both implementations to ensure they
     are equivalent.  Patch by Carl Friedrich Bolz-Tereick and Łukasz
     Langa.

   - gh-97799(26): ‘dataclass’ now uses *note inspect.get_annotations():
     a14. to examine the annotations on class objects.

   - gh-97781(27): Removed deprecated interfaces in ‘importlib.metadata’
     (entry points accessed as dictionary, implicit dictionary
     construction of sequence of ‘EntryPoint’ objects, mutablility of
     ‘EntryPoints’ result, access of entry point by index).
     ‘entry_points’ now has a simpler, more straightforward API
     (returning ‘EntryPoints’).

   - gh-96827(28): Avoid spurious tracebacks from *note asyncio: b. when
     default executor cleanup is delayed until after the event loop is
     closed (e.g.  as the result of a keyboard interrupt).

   - gh-95534(29): ‘gzip.GzipFile.read()’ reads 10% faster.

   - gh-97592(30): Avoid a crash in the C version of *note
     asyncio.Future.remove_done_callback(): 1911. when an evil argument
     is passed.

   - gh-97639(31): Remove ‘tokenize.NL’ check from *note tabnanny: e3.

   - gh-97545(32): Make Semaphore run faster.

   - gh-73588(33): Fix generation of the default name of
     ‘tkinter.Checkbutton’.  Previously, checkbuttons in different
     parent widgets could have the same short name and share the same
     state if arguments "name" and "variable" are not specified.  Now
     they are globally unique.

   - gh-96865(34): fix Flag to use boundary CONFORM

     This restores previous Flag behavior of allowing flags with
     non-sequential values to be combined; e.g.

     class Skip(Flag): TWO = 2 EIGHT = 8

     Skip.TWO | Skip.EIGHT -> <Skip.TWO|EIGHT: 10>

   - gh-97005(35): Update bundled libexpat to 2.4.9

   - gh-85760(36): Fix race condition in *note asyncio: b. where *note
     process_exited(): 1b4f. called before the *note
     pipe_data_received(): 1b50. leading to inconsistent output.  Patch
     by Kumar Aditya.

   - gh-96704(37): Pass the correct ‘contextvars.Context’ when a
     ‘asyncio’ exception handler is called on behalf of a task or
     callback handle.  This adds a new ‘Task’ method, ‘get_context’, and
     also a new ‘Handle’ method with the same name.  If this method is
     not found on a task object (perhaps because it is a third-party
     library that does not yet provide this method), the context
     prevailing at the time the exception handler is called is used.

   - gh-96819(38): Fixed check in ‘multiprocessing.resource_tracker’
     that guarantees that the length of a write to a pipe is not greater
     than ‘PIPE_BUF’.

   - gh-95865(39): Reduce *note urllib.parse.quote_from_bytes(): 1b51.
     memory use on large values.

     Contributed by Dennis Sweeney.

   - gh-96741(40): Corrected type annotation for dataclass attribute
     ‘pstats.FunctionProfile.ncalls’ to be ‘str’.

   - gh-96734(41): Update *note unicodedata: 10b. database to Unicode
     15.0.0.

   - gh-96735(42): Fix undefined behaviour in *note struct.unpack():
     185a.

   - gh-46412(43): Improve performance of ‘bool(db)’ for large ndb/gdb
     databases.  Previously this would call ‘len(db)’ which would
     iterate over all keys - the answer (empty or not) is known after
     the first key.

   - gh-96652(44): Fix the faulthandler implementation of
     ‘faulthandler.register(signal, chain=True)’ if the ‘sigaction()’
     function is not available: don't call the previous signal handler
     if it's NULL. Patch by Victor Stinner.

   - gh-68163(45): Correct conversion of *note numbers.Rational: 14d6.'s
     to *note float: 196.

   - gh-96538(46): Speed up ‘bisect.bisect()’ functions by taking
     advantage of type-stability.

   - gh-96465(47): Fraction hashes are now cached.

   - gh-96079(48): In *note typing: 10a, fix missing field ‘name’ and
     incorrect ‘__module__’ in _AnnotatedAlias.

   - gh-96415(49): Remove ‘types._cell_factory’ from module namespace.

   - gh-95987(50): Fix ‘repr’ of ‘Any’ subclasses.

   - gh-96388(51): Work around missing socket functions in *note socket:
     fa1.'s ‘__repr__’.

   - gh-96385(52): Fix ‘TypeVarTuple.__typing_prepare_subst__’.
     ‘TypeError’ was not raised when using more than one ‘TypeVarTuple’,
     like ‘[*T, *V]’ in type alias substitutions.

   - gh-96142(53): Add ‘match_args’, ‘kw_only’, ‘slots’, and
     ‘weakref_slot’ to ‘_DataclassParams’.

   - gh-96073(54): In *note inspect: 82, fix overeager replacement of
     "‘typing.’" in formatting annotations.

   - gh-89258(55): Added a *note getChildren(): 1b52. method to *note
     logging.Logger: d46, to get the immediate child loggers of a
     logger.

   - gh-96346(56): Use double caching for compiled RE patterns.

   - gh-96349(57): Fixed a minor performance regression in
     ‘threading.Event.__init__()’

   - gh-90467(58): Fix ‘asyncio.streams.StreamReaderProtocol’ to keep a
     strong reference to the created task, so that it's not garbage
     collected

   - gh-96172(59): Fix a bug in ‘unicodedata’: ‘east_asian_width’ used
     to return the wrong value for unassigned characters; and for yet
     unassigned, but reserved characters.

   - gh-96159(60): Fix a performance regression in logging
     TimedRotatingFileHandler.  Only check for special files when the
     rollover time has passed.

   - gh-96175(61): Fix unused ‘localName’ parameter in the ‘Attr’ class
     in *note xml.dom.minidom: 128.

   - gh-96145(62): Add AttrDict to JSON module for use with object_hook.

   - gh-96052(63): Fix handling compiler warnings (SyntaxWarning and
     DeprecationWarning) in *note codeop.compile_command(): 1b53. when
     checking for incomplete input.  Previously it emitted warnings and
     raised a SyntaxError.  Now it always returns ‘None’ for incomplete
     input without emitting any warnings.

   - gh-96125(64): Fix incorrect condition that causes
     ‘sys.thread_info.name’ to be wrong on pthread platforms.

   - gh-96019(65): Fix a bug in the ‘makeunicodedata.py’ script leading
     to about 13 KiB of space saving in the ‘unicodedata’ module,
     specifically the character decomposition data.

   - gh-95463(66): Remove an incompatible change from bpo-28080(67) that
     caused a regression that ignored the utf8 in ‘ZipInfo.flag_bits’.
     Patch by Pablo Galindo.

   - gh-69142(68): Add ‘%:z’ strftime format code (generates tzoffset
     with colons as separator), see *note strftime() and strptime()
     behavior: 1b54.

   - gh-95899(69): Fix *note asyncio.Runner: 2f5. to call *note
     asyncio.set_event_loop(): 1b55. only once to avoid calling
     ‘attach_loop()’ multiple times on child watchers.  Patch by Kumar
     Aditya.

   - gh-95736(70): Fix *note unittest.IsolatedAsyncioTestCase: 361. to
     set event loop before calling setup functions.  Patch by Kumar
     Aditya.

   - gh-95865(71): Speed up *note urllib.parse.quote_from_bytes(): 1b51.
     by replacing a list comprehension with ‘map()’.

   - gh-95861(72): Add support for computing Spearman's correlation
     coefficient to the existing statistics.correlation() function.

   - gh-95804(73): Fix ‘logging’ shutdown handler so it respects
     ‘MemoryHandler.flushOnClose’.

   - gh-95704(74): When a task catches *note asyncio.CancelledError:
     4d4. and raises some other error, the other error should generally
     not silently be suppressed.

   - gh-95149(75): The *note HTTPStatus: afc. enum offers a couple of
     properties to indicate the HTTP status category e.g.
     ‘HTTPStatus.OK.is_success’.

   - gh-95609(76): Update bundled pip to 22.2.2.

   - gh-95289(77): Fix *note asyncio.TaskGroup: 4d1. to propagate
     exception when *note asyncio.CancelledError: 4d4. was replaced with
     another exception by a context manager.  Patch by Kumar Aditya and
     Guido van Rossum.

   - gh-94909(78): Fix incorrect joining of relative Windows paths with
     drives in *note pathlib.PurePath: 6cd. initializer.

   - gh-95385(79): Faster ‘json.dumps()’ when sorting of keys is not
     requested (default).

   - gh-83901(80): Improve *note Signature.bind: 1892. error message for
     missing keyword-only arguments.

   - gh-95339(81): Update bundled pip to 22.2.1.

   - gh-95045(82): Fix GC crash when deallocating ‘_lsprof.Profiler’ by
     untracking it before calling any callbacks.  Patch by Kumar Aditya.

   - gh-95231(83): Fail gracefully if *note EPERM: 1b56. or *note
     ENOSYS: 1b57. is raised when loading ‘crypt’ methods.  This may
     happen when trying to load ‘MD5’ on a Linux kernel with FIPS
     (Federal Information Processing Standard) enabled.

   - gh-95097(84): Fix *note asyncio.run(): 2f3. for *note asyncio.Task:
     1c7. implementations without *note uncancel(): 4d6. method.  Patch
     by Kumar Aditya.

   - gh-95087(85): Fix IndexError in parsing invalid date in the *note
     email: 3f. module.

   - gh-95199(86): Upgrade bundled setuptools to 63.2.0.

   - gh-95194(87): Upgrade bundled pip to 22.2.

   - gh-93899(88): Fix check for existence of *note os.EFD_CLOEXEC:
     1b58, *note os.EFD_NONBLOCK: 1b59. and *note os.EFD_SEMAPHORE:
     1b5a. flags on older kernel versions where these flags are not
     present.  Patch by Kumar Aditya.

   - gh-95166(89): Fix *note concurrent.futures.Executor.map(): 1dc. to
     cancel the currently waiting on future on an error - e.g.
     TimeoutError or KeyboardInterrupt.

   - gh-95132(90): Fix a *note sqlite3: d4. regression where ‘*args’ and
     ‘**kwds’ were incorrectly relayed from *note connect(): 5a6. to the
     *note Connection: 54d. factory.  The regression was introduced in
     3.11a1 with PR 24421 (gh-85128(91)).  Patch by Erlend E. Aasland.

   - gh-93157(92): Fix *note fileinput: 5f. module didn't support
     ‘errors’ option when ‘inplace’ is true.

   - gh-91212(93): Fixed flickering of the turtle window when the tracer
     is turned off.  Patch by Shin-myoung-serp.

   - gh-95077(94): Add deprecation warning for enum ‘member.member’
     access (e.g.  ‘Color.RED.BLUE’).  Remove ‘EnumMeta.__getattr__’.

   - gh-95109(95): Ensure that timeouts scheduled with *note
     asyncio.Timeout: 1a40. that have already expired are delivered
     promptly.

   - gh-95105(96): ‘wsgiref.types.InputStream.__iter__()’ should return
     ‘Iterator[bytes]’, not ‘Iterable[bytes]’.  Patch by Shantanu Jain.

   - gh-95066(97): Replaced assert with exception in *note ast.parse():
     1c2, when ‘feature_version’ has an invalid major version.  Patch by
     Shantanu Jain.

   - gh-77617(98): Add *note sqlite3: d4. *note command-line interface:
     674.  Patch by Erlend Aasland.

   - gh-95005(99): Replace _PyAccu with _PyUnicodeWriter in JSON encoder
     and StringIO and remove the _PyAccu implementation.

   - gh-90085(100): Remove ‘-c/--clock’ and ‘-t/--time’ CLI options of
     *note timeit: f5.  The options had been deprecated since Python 3.3
     and the functionality was removed in Python 3.7.  Patch by Shantanu
     Jain.

   - gh-94857(101): Fix refleak in ‘_io.TextIOWrapper.reconfigure’.
     Patch by Kumar Aditya.

   - gh-94821(102): Fix binding of unix socket to empty address on Linux
     to use an available address from the abstract namespace, instead of
     "0".

   - gh-94736(103): Fix crash when deallocating an instance of a
     subclass of ‘_multiprocessing.SemLock’.  Patch by Kumar Aditya.

   - gh-81620(104): Add random.binomialvariate().

   - gh-74116(105): Allow *note asyncio.StreamWriter.drain(): 1b29. to
     be awaited concurrently by multiple tasks.  Patch by Kumar Aditya.

   - gh-87822(106): When called with ‘capture_locals=True’, the *note
     traceback: 104. module functions swallow exceptions raised from
     calls to ‘repr()’ on local variables of frames.  This is in order
     to prioritize the original exception over rendering errors.  An
     indication of the failure is printed in place of the missing value.
     (Patch by Simon-Martin Schroeder).

   - gh-88050(107): Fix *note asyncio: b. subprocess transport to kill
     process cleanly when process is blocked and avoid ‘RuntimeError’
     when loop is closed.  Patch by Kumar Aditya.

   - gh-94637(108): ‘SSLContext.set_default_verify_paths()’ now releases
     the GIL around ‘SSL_CTX_set_default_verify_paths’ call.  The
     function call performs I/O and CPU intensive work.

   - gh-94309(109): Deprecate aliases *note typing.Hashable: 717. and
     *note typing.Sized: 718.

   - gh-92546(110): An undocumented ‘python -m pprint’ benchmark is
     moved into ‘pprint’ suite of pyperformance.  Patch by Oleg Iarygin.

   - gh-94607(111): Fix subclassing complex generics with type variables
     in *note typing: 10a.  Previously an error message saying ‘Some
     type variables ... are not listed in Generic[...]’ was shown.
     *note typing: 10a. no longer populates ‘__parameters__’ with the
     ‘__parameters__’ of a Python class.

   - gh-94619(112): Remove the long-deprecated ‘module_repr()’ from
     *note importlib: 7b.

   - gh-93910(113): The ability to access the other values of an enum on
     an enum (e.g.  ‘Color.RED.BLUE’) has been restored in order to fix
     a performance regression.

   - gh-93896(114): Fix *note asyncio.run(): 2f3. and *note
     unittest.IsolatedAsyncioTestCase: 361. to always the set event loop
     as it was done in Python 3.10 and earlier.  Patch by Kumar Aditya.

   - gh-94343(115): Allow setting the attributes of ‘reprlib.Repr’
     during object initialization

   - gh-94382(116): Port static types of ‘_multiprocessing’ module to
     heap types.  Patch by Kumar Aditya.

   - gh-78724(117): Fix crash in *note struct.Struct: 1778. when it was
     not completely initialized by initializing it in *note __new__():
     7a0.  Patch by Kumar Aditya.

   - gh-94510(118): Re-entrant calls to *note sys.setprofile(): 1717.
     and *note sys.settrace(): 2e1. now raise *note RuntimeError: 244.
     Patch by Pablo Galindo.

   - gh-92336(119): Fix bug where *note linecache.getline(): 240. fails
     on bad files with *note UnicodeDecodeError: c08. or *note
     SyntaxError: 18e.  It now returns an empty string as per the
     documentation.

   - gh-94398(120): Once a *note asyncio.TaskGroup: 4d1. has started
     shutting down (i.e., at least one task has failed and the task
     group has started cancelling the remaining tasks), it should not be
     possible to add new tasks to the task group.

   - gh-94383(121): ‘xml.etree’: Remove the ‘ElementTree.Element.copy()’
     method of the pure Python implementation, deprecated in Python
     3.10, use the *note copy.copy(): 757. function instead.  The C
     implementation of ‘xml.etree’ has no ‘copy()’ method, only a
     ‘__copy__()’ method.  Patch by Victor Stinner.

   - gh-94379(122): *note zipimport: 138.: Remove ‘find_loader()’ and
     ‘find_module()’ methods, deprecated in Python 3.10: use the
     ‘find_spec()’ method instead.  See PEP 451(123) for the rationale.
     Patch by Victor Stinner.

   - gh-94352(124): *note shlex.split(): 75e.: Passing ‘None’ for 's'
     argument now raises an exception, rather than reading *note
     sys.stdin: 75f.  The feature was deprecated in Python 3.9.  Patch
     by Victor Stinner.

   - gh-94318(125): Strip trailing spaces in *note pydoc: ba. text
     output.

   - gh-89988(126): Fix memory leak in *note pickle.Pickler: c13. when
     looking up ‘dispatch_table’.  Patch by Kumar Aditya.

   - gh-90016(127): Deprecate *note sqlite3: d4. *note default adapters
     and converters: 714.  Patch by Erlend E. Aasland.

   - gh-94254(128): Fixed types of *note struct: db. module to be
     immutable.  Patch by Kumar Aditya.

   - gh-93259(129): Now raise ‘ValueError’ when ‘None’ or an empty
     string are passed to ‘Distribution.from_name’ (and other callers).

   - gh-74696(130): *note shutil.make_archive(): 6da. now passes the
     'root_dir' argument to custom archivers which support it.

   - gh-94216(131): The *note dis: 3c. module now has the opcodes for
     pseudo instructions (those which are used by the compiler during
     code generation but then removed or replaced by real opcodes before
     the final bytecode is emitted).

   - gh-93096(132): Removed undocumented ‘python -m codecs’.  Use
     ‘python -m unittest test.test_codecs.EncodedFileTest’ instead.

   - gh-94207(133): Made ‘_struct.Struct’ GC-tracked in order to fix a
     reference leak in the ‘_struct’ module.

   - gh-93096(134): Removed undocumented ‘-t’ argument of ‘python -m
     base64’.  Use ‘python -m unittest
     test.test_base64.LegacyBase64TestCase.test_encodebytes’ instead.

   - gh-94226(135): Remove the ‘locale.format()’ function, deprecated in
     Python 3.7: use *note locale.format_string(): 742. instead.  Patch
     by Victor Stinner.

   - gh-94199(136): Remove the ‘ssl.match_hostname()’ function.  The
     ‘ssl.match_hostname()’ was deprecated in Python 3.7.  OpenSSL
     performs hostname matching since Python 3.7, Python no longer uses
     the ‘ssl.match_hostname()’ function.  Patch by Victor Stinner.

   - gh-94214(137): Document the ‘context’ object used in the
     ‘venv.EnvBuilder’ class, and add the new environment's library path
     to it.

   - gh-94199(138): Remove the ‘ssl.wrap_socket()’ function, deprecated
     in Python 3.7: instead, create a *note ssl.SSLContext: 357. object
     and call its *note ssl.SSLContext.wrap_socket: 748. method.  Any
     package that still uses ‘ssl.wrap_socket()’ is broken and insecure.
     The function neither sends a SNI TLS extension nor validates server
     hostname.  Code is subject to CWE 295(139) Improper Certificate
     Validation.  Patch by Victor Stinner.

   - gh-94199(140): Remove the ‘ssl.RAND_pseudo_bytes()’ function,
     deprecated in Python 3.6: use *note os.urandom(): 746. or *note
     ssl.RAND_bytes(): 747. instead.  Patch by Victor Stinner.

   - gh-94199(141): *note hashlib: 6c.: Remove the pure Python
     implementation of *note hashlib.pbkdf2_hmac(): 733, deprecated in
     Python 3.10.  Python 3.10 and newer requires OpenSSL 1.1.1 ( PEP
     644(142)): this OpenSSL version provides a C implementation of
     *note pbkdf2_hmac(): 733. which is faster.  Patch by Victor
     Stinner.

   - gh-94196(143): *note gzip: 6b.: Remove the ‘filename’ attribute of
     *note gzip.GzipFile: 65c, deprecated since Python 2.6, use the
     *note name: 731. attribute instead.  In write mode, the ‘filename’
     attribute added ‘'.gz'’ file extension if it was not present.
     Patch by Victor Stinner.

   - gh-94182(144): run the ‘asyncio.PidfdChildWatcher’ on the running
     loop, this allows event loops to run subprocesses when there is no
     default event loop running on the main thread

   - gh-94169(145): Remove ‘io.OpenWrapper’ and ‘_pyio.OpenWrapper’,
     deprecated in Python 3.10: just use *note open(): 316. instead.
     The *note open(): 316. (*note io.open(): 740.) function is a
     built-in function.  Since Python 3.10, ‘_pyio.open()’ is also a
     static method.  Patch by Victor Stinner.

   - gh-91742(146): Fix *note pdb: aa. crash after jump caused by a null
     pointer dereference.  Patch by Kumar Aditya.

   - gh-94101(147): Manual instantiation of *note ssl.SSLSession: ed9.
     objects is no longer allowed as it lead to misconfigured instances
     that crashed the interpreter when attributes where accessed on
     them.

   - gh-84753(148): *note inspect.iscoroutinefunction(): 30d, *note
     inspect.isgeneratorfunction(): 1b5b, and *note
     inspect.isasyncgenfunction(): 1b5c. now properly return ‘True’ for
     duck-typed function-like objects like instances of *note
     unittest.mock.AsyncMock: c3e.

     This makes *note inspect.iscoroutinefunction(): 30d. consistent
     with the behavior of ‘asyncio.iscoroutinefunction()’.  Patch by
     Mehdi ABAAKOUK.

   - gh-94028(149): Fix a regression in the *note sqlite3: d4. where
     statement objects were not properly cleared and reset after use in
     cursor iters.  The regression was introduced by PR 27884 in Python
     3.11a1.  Patch by Erlend E. Aasland.

   - gh-93973(150): Add keyword argument ‘all_errors’ to
     ‘asyncio.create_connection’ so that multiple connection errors can
     be raised as an ‘ExceptionGroup’.

   - gh-93963(151): Officially deprecate from ‘importlib.abc’ classes
     moved to ‘importlib.resources.abc’.

   - gh-93858(152): Prevent error when activating venv in nested fish
     instances.

   - gh-93820(153): Pickle *note enum.Flag: 835. by name.

   - gh-93847(154): Fix repr of enum of generic aliases.

   - gh-91404(155): Revert the *note re: be. memory leak when a match is
     terminated by a signal or memory allocation failure as the
     implemented fix caused a major performance regression.

   - gh-83499(156): Fix double closing of file description in *note
     tempfile: e6.

   - gh-93820(157): Fixed a regression when *note copy.copy(): 757.-ing
     *note enum.Flag: 835. with multiple flag members.

   - gh-79512(158): Fixed names and ‘__module__’ value of *note weakref:
     11a. classes *note ReferenceType: 1b5d, *note ProxyType: 1b5e,
     *note CallableProxyType: 1b5f.  It makes them pickleable.

   - gh-91389(159): Fix an issue where *note dis: 3c. utilities could
     report missing or incorrect position information in the presence of
     ‘CACHE’ entries.

   - gh-93626(160): Set ‘__future__.annotations’ to have a ‘None’
     mandatoryRelease to indicate that it is currently 'TBD'.

   - gh-90473(161): Emscripten and WASI have no home directory and
     cannot provide PEP 370(162) user site directory.

   - gh-90494(163): *note copy.copy(): 757. and *note copy.deepcopy():
     d65. now always raise a TypeError if ‘__reduce__()’ returns a tuple
     with length 6 instead of silently ignore the 6th item or produce
     incorrect result.

   - gh-90549(164): Fix a multiprocessing bug where a global named
     resource (such as a semaphore) could leak when a child process is
     spawned (as opposed to forked).

   - gh-93521(165): Fixed a case where dataclasses would try to add
     ‘__weakref__’ into the ‘__slots__’ for a dataclass that specified
     ‘weakref_slot=True’ when it was already defined in one of its
     bases.  This resulted in a ‘TypeError’ upon the new class being
     created.

   - gh-79579(166): *note sqlite3: d4. now correctly detects DML queries
     with leading comments.  Patch by Erlend E. Aasland.

   - gh-93421(167): Update *note sqlite3.Cursor.rowcount: 1b60. when a
     DML statement has run to completion.  This fixes the row count for
     SQL queries like ‘UPDATE ... RETURNING’.  Patch by Erlend E.
     Aasland.

   - gh-93475(168): Expose ‘FICLONE’ and ‘FICLONERANGE’ constants in
     *note fcntl: 5d.  Patch by Illia Volochii.

   - gh-93370(169): Deprecate ‘version’ and ‘version_info’.

   - gh-91810(170): Suppress writing an XML declaration in open files in
     ‘ElementTree.write()’ with ‘encoding='unicode'’ and
     ‘xml_declaration=None’.

   - gh-91162(171): Support splitting of unpacked arbitrary-length tuple
     over ‘TypeVar’ and ‘TypeVarTuple’ parameters.  For example:

        * ‘A[T, *Ts][*tuple[int, ...]]’ -> ‘A[int, *tuple[int, ...]]’

        * ‘A[*Ts, T][*tuple[int, ...]]’ -> ‘A[*tuple[int, ...], int]’

   - gh-93353(172): Fix the *note importlib.resources.as_file(): 6b5.
     context manager to remove the temporary file if destroyed late
     during Python finalization: keep a local reference to the *note
     os.remove(): 1308. function.  Patch by Victor Stinner.

   - gh-83658(173): Make ‘multiprocessing.Pool’ raise an exception if
     ‘maxtasksperchild’ is not ‘None’ or a positive int.

   - gh-93312(174): Add *note os.PIDFD_NONBLOCK: 6c2. flag to open a
     file descriptor for a process with *note os.pidfd_open(): 6a4. in
     non-blocking mode.  Patch by Kumar Aditya.

   - gh-88123(175): Implement ‘Enum.__contains__’ that returns ‘True’ or
     ‘False’ to replace the deprecated behaviour that would sometimes
     raise a *note TypeError: 198.

   - gh-93297(176): Make asyncio task groups prevent child tasks from
     being GCed

   - gh-85308(177): Changed *note argparse.ArgumentParser: 1bd. to use
     *note filesystem encoding and error handler: 75d. instead of
     default text encoding to read arguments from file (e.g.
     ‘fromfile_prefix_chars’ option).  This change affects Windows;
     argument file should be encoded with UTF-8 instead of ANSI
     Codepage.

   - gh-93156(178): Accessing the *note pathlib.PurePath.parents: a21.
     sequence of an absolute path using negative index values produced
     incorrect results.

   - gh-93162(179): Add the ability for *note
     logging.config.dictConfig(): 13c8. to usefully configure *note
     QueueHandler: 1b61. and *note QueueListener: 242. as a pair, and
     add *note logging.getHandlerByName(): 1b62. and *note
     logging.getHandlerNames(): 1a6e. APIs to allow access to handlers
     by name.

   - gh-93243(180): The ‘smtpd’ module was removed per the schedule in
     PEP 594(181).

   - gh-92886(182): Replace ‘assert’ statements with ‘raise
     AssertionError()’ in ‘BaseHandler’ so that the tested behaviour is
     maintained running with optimizations ‘(-O)’.

   - gh-90155(183): Fix broken *note asyncio.Semaphore: c68. when
     acquire is cancelled.

   - gh-90817(184): The ‘locale.resetlocale()’ function is deprecated
     and will be removed in Python 3.13.  Use
     ‘locale.setlocale(locale.LC_ALL, "")’ instead.  Patch by Victor
     Stinner.

   - gh-91513(185): Added ‘taskName’ attribute to *note logging: 8b.
     module for use with *note asyncio: b. tasks.

   - gh-74696(186): *note shutil.make_archive(): 6da. no longer
     temporarily changes the current working directory during creation
     of standard ‘.zip’ or tar archives.

   - gh-92728(187): The ‘re.template()’ function and the corresponding
     ‘re.TEMPLATE’ and ‘re.T’ flags are restored after they were removed
     in 3.11.0b1, but they are now deprecated, so they might be removed
     from Python 3.13.

   - gh-93033(188): Search in some strings (platform dependent i.e
     [U+0xFFFF, U+0x0100] on Windows or [U+0xFFFFFFFF, U+0x00010000] on
     Linux 64-bit) are now up to 10 times faster.

   - gh-89973(189): Fix ‘re.error’ raised in *note fnmatch: 60. if the
     pattern contains a character range with upper bound lower than
     lower bound (e.g.  ‘[c-a]’).  Now such ranges are interpreted as
     empty ranges.

   - gh-93044(190): No longer convert the database argument of *note
     sqlite3.connect(): 5a6. to bytes before passing it to the factory.

   - gh-93010(191): In a very special case, the email package tried to
     append the nonexistent ‘InvalidHeaderError’ to the defect list.  It
     should have been ‘InvalidHeaderDefect’.

   - gh-92986(192): Fix *note ast.unparse(): ae2. when
     ‘ImportFrom.level’ is ‘None’

   - gh-92932(193): Now *note dis(): 205. and *note get_instructions():
     4ec. handle operand values for instructions prefixed by
     ‘EXTENDED_ARG_QUICK’.  Patch by Sam Gross and Donghee Na.

   - gh-92675(194): Fix ‘venv.ensure_directories()’ to accept *note
     pathlib.Path: 266. arguments in addition to *note str: 169. paths.
     Patch by David Foster.

   - gh-87901(195): Removed the ‘encoding’ argument from *note
     os.popen(): 31a. that was added in 3.11b1.

   - gh-91922(196): Fix function ‘sqlite.connect()’ and the
     ‘sqlite.Connection’ constructor on non-UTF-8 locales.  Also, they
     now support bytes paths non-decodable with the current FS encoding.

   - gh-92869(197): Added *note c_time_t: 1b63. to *note ctypes: 2e,
     which has the same size as the ‘time_t’ type in C.

   - gh-92839(198): Fixed crash resulting from calling bisect.insort()
     or bisect.insort_left() with the key argument not equal to ‘None’.

   - gh-90473(199): *note subprocess: dc. now fails early on Emscripten
     and WASI platforms to work around missing *note os.pipe(): 1b64. on
     WASI.

   - gh-89325(200): Removed many old deprecated *note unittest: 10c.
     features: *note TestCase: 2b3. method aliases, undocumented and
     broken *note TestCase: 2b3. method ‘assertDictContainsSubset’,
     undocumented *note TestLoader.loadTestsFromModule: 594. parameter
     'use_load_tests', and an underscored alias of the *note
     TextTestResult: 754. class.

   - gh-92734(201): Allow multi-element reprs emitted by *note reprlib:
     c0. to be pretty-printed using configurable indentation.

   - gh-92671(202): Fixed *note ast.unparse(): ae2. for empty tuples in
     the assignment target context.

   - gh-91581(203): *note utcfromtimestamp(): 352. no longer attempts to
     resolve ‘fold’ in the pure Python implementation, since the fold is
     never 1 in UTC. In addition to being slightly faster in the common
     case, this also prevents some errors when the timestamp is close to
     *note datetime.min: 1b65.  Patch by Paul Ganssle.

   - gh-86388(204): Removed randrange() functionality deprecated since
     Python 3.10.  Formerly, randrange(10.0) losslessly converted to
     randrange(10).  Now, it raises a TypeError.  Also, the exception
     raised for non-integral values such as randrange(10.5) or
     randrange('10') has been changed from ValueError to TypeError.

   - gh-90385(205): Add *note pathlib.Path.walk(): 6cf. as an
     alternative to *note os.walk(): 6d0.

   - gh-92550(206): Fix *note pathlib.Path.rglob(): 538. for empty
     pattern.

   - gh-92591(207): Allow *note logging: 8b. filters to return a *note
     logging.LogRecord: 11e8. instance so that filters attached to *note
     logging.Handler: 16af.s can enrich records without side effects on
     other handlers.

   - gh-92445(208): Fix a bug in *note argparse: 7. where ‘nargs="*"’
     would raise an error instead of returning an empty list when 0
     arguments were supplied if choice was also defined in
     ‘parser.add_argument’.

   - gh-92547(209): Remove undocumented *note sqlite3: d4. features
     deprecated in Python 3.10:

        * ‘sqlite3.enable_shared_cache()’

        * ‘sqlite3.OptimizedUnicode’

     Patch by Erlend E. Aasland.

   - gh-92530(210): Fix an issue that occurred after interrupting *note
     threading.Condition.notify(): 1b66.

   - gh-92531(211): The statistics.median_grouped() function now always
     return a float.  Formerly, it did not convert the input type when
     for sequences of length one.

   - gh-84131(212): The *note pathlib.Path: 266. deprecated method
     ‘link_to’ has been removed.  Use 3.10's *note hardlink_to(): a22.
     method instead as its semantics are consistent with that of *note
     symlink_to(): a23.

   - gh-89336(213): Removed *note configparser: 26. module APIs: the
     ‘SafeConfigParser’ class alias, the ‘ParsingError.filename’
     property and parameter, and the ‘ConfigParser.readfp’ method, all
     of which were deprecated since Python 3.2.

   - gh-92391(214): Add *note __class_getitem__(): 943. to *note
     csv.DictReader: bd8. and *note csv.DictWriter: 1417, allowing them
     to be parameterized at runtime.  Patch by Marc Mueller.

   - gh-91968(215): Add ‘SO_RTABLE’ and ‘SO_USER_COOKIE’ constants to
     *note socket: d1.

   - gh-91810(216): *note ElementTree: b47. method *note write(): c8c.
     and function *note tostring(): 11f7. now use the text file's
     encoding ("UTF-8" if not available) instead of locale encoding in
     XML declaration when ‘encoding="unicode"’ is specified.

   - gh-81790(217): *note os.path.splitdrive(): def. now understands DOS
     device paths with UNC links (beginning ‘\\?\UNC\’).  Contributed by
     Barney Gale.

   - gh-91760(218): Apply more strict rules for numerical group
     references and group names in regular expressions.  Only sequence
     of ASCII digits is now accepted as a numerical reference.  The
     group name in bytes patterns and replacement strings can now only
     contain ASCII letters and digits and underscore.

   - gh-90622(219): Worker processes for *note
     concurrent.futures.ProcessPoolExecutor: 1d6. are no longer spawned
     on demand (a feature added in 3.9) when the multiprocessing context
     start method is ‘"fork"’ as that can lead to deadlocks in the child
     processes due to a fork happening while threads are running.

   - gh-91577(220): Move imports in ‘SharedMemory’ methods to module
     level so that they can be executed late in python finalization.

   - gh-91581(221): Remove an unhandled error case in the C
     implementation of calls to *note datetime.fromtimestamp: 712. with
     no time zone (i.e.  getting a local time from an epoch timestamp).
     This should have no user-facing effect other than giving a possibly
     more accurate error message when called with timestamps that fall
     on 10000-01-01 in the local time.  Patch by Paul Ganssle.

   - gh-91539(222): Improve performance of
     ‘urllib.request.getproxies_environment’ when there are many
     environment variables

   - gh-91524(223): Speed up the regular expression substitution
     (functions *note re.sub(): 5a3. and *note re.subn(): 5a4. and
     corresponding *note re.Pattern: 1b67. methods) for replacement
     strings containing group references by 2-3 times.

   - gh-91447(224): Fix findtext in the xml module to only give an empty
     string when the text attribute is set to ‘None’.

   - gh-91456(225): Deprecate current default auto() behavior: In 3.13
     the default will be for for auto() to always return the largest
     member value incremented by 1, and to raise if incompatible value
     types are used.

   - bpo-47231(226): Fixed an issue with inconsistent trailing slashes
     in tarfile longname directories.

   - bpo-39064(227): *note zipfile.ZipFile: 8d3. now raises *note
     zipfile.BadZipFile: 1b68. instead of ‘ValueError’ when reading a
     corrupt zip file in which the central directory offset is negative.

   - bpo-41287(228): Fix handling of the ‘doc’ argument in subclasses of
     *note property(): 4b3.

   - gh-90005(229): *note ctypes: 2e. dependency ‘libffi’ is now
     detected with ‘pkg-config’.

   - bpo-32547(230): The constructors for *note DictWriter: 1417. and
     *note DictReader: bd8. now coerce the ‘fieldnames’ argument to a
     *note list: 24d. if it is an iterator.

   - bpo-35540(231): Fix *note dataclasses.asdict(): 1a95. crash when
     *note collections.defaultdict: 13d4. is present in the attributes.

   - bpo-47063(232): Add an index_pages parameter to support using
     non-default index page names.

   - bpo-47025(233): Drop support for *note bytes: 192. on *note
     sys.path: 3e4.

   - bpo-46951(234): Order the contents of zipapp archives, to make
     builds more reproducible.

   - bpo-42777(235): Implement *note pathlib.Path.is_mount(): c0c. for
     Windows paths.

   - bpo-46755(236): In ‘QueueHandler’, clear ‘stack_info’ from
     ‘LogRecord’ to prevent stack trace from being written twice.

   - bpo-45393(237): Fix the formatting for ‘await x’ and ‘not x’ in the
     operator precedence table when using the *note help(): ad4. system.

   - bpo-46642(238): Improve error message when trying to subclass an
     instance of *note typing.TypeVar: 486, *note typing.ParamSpec: 487,
     *note typing.TypeVarTuple: 488, etc.  Based on patch by Gregory
     Beauregard.

   - bpo-46364(239): Restrict use of sockets instead of pipes for stdin
     of subprocesses created by *note asyncio: b. to AIX platform only.

   - bpo-28249(240): Set *note doctest.DocTest.lineno: 17c7. to ‘None’
     when an object does not have *note __doc__: b21.

   - bpo-46197(241): Fix *note ensurepip: 59. environment isolation for
     subprocess running ‘pip’.

   - bpo-45924(242): Fix *note asyncio: b. incorrect traceback when
     future's exception is raised multiple times.  Patch by Kumar
     Aditya.

   - bpo-45046(243): Add support of context managers in *note unittest:
     10c.: methods *note enterContext(): 8c8. and *note
     enterClassContext(): 8c9. of class *note TestCase: 2b3, method
     *note enterAsyncContext(): 8ca. of class *note
     IsolatedAsyncioTestCase: 361. and function *note
     unittest.enterModuleContext(): 8cb.

   - bpo-44173(244): Enable fast seeking of uncompressed unencrypted
     ‘zipfile.ZipExtFile’

   - bpo-42627(245): Fix incorrect parsing of Windows registry proxy
     settings

   - bpo-42047(246): Add *note threading.get_native_id(): c32. support
     for DragonFly BSD. Patch by David Carlier.

   - bpo-14243(247): The *note tempfile.NamedTemporaryFile: 6ed.
     function has a new optional parameter 'delete_on_close'

   - bpo-41246(248): Give the same callback function for when the
     overlapped operation is done to the functions ‘recv’, ‘recv_into’,
     ‘recvfrom’, ‘sendto’, ‘send’ and ‘sendfile’ inside ‘IocpProactor’.

   - bpo-39264(249): Fixed ‘collections.UserDict.get()’ to not call
     *note __missing__(): 13d5. when a value is not found.  This matches
     the behavior of *note dict: 183.  Patch by Bar Harel.

   - bpo-38693(250): *note importlib: 7b. now uses f-strings internally
     instead of ‘str.format’.

   - bpo-38267(251): Add 'timeout' parameter to *note
     asyncio.loop.shutdown_default_executor(): ae4.  The default value
     is ‘None’, which means the executor will be given an unlimited
     amount of time.  When called from *note asyncio.Runner: 2f5. or
     *note asyncio.run(): 2f3, the default timeout is 5 minutes.

   - bpo-34828(252): *note sqlite3.Connection.iterdump(): 54f. now
     handles databases that use ‘AUTOINCREMENT’ in one or more tables.

   - bpo-32990(253): Support reading wave files with the
     ‘WAVE_FORMAT_EXTENSIBLE’ format in the *note wave: 119. module.

   - bpo-26253(254): Allow adjustable compression level for tarfile
     streams in *note tarfile.open(): 1077.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89237

   (2) https://github.com/python/cpython/issues/97928

   (3) https://github.com/python/cpython/issues/98393

   (4) https://github.com/python/cpython/issues/98363

   (5) https://github.com/python/cpython/issues/98331

   (6) https://github.com/python/cpython/issues/98307

   (7) https://github.com/python/cpython/issues/96035

   (8) https://github.com/python/cpython/issues/98257

   (9) https://github.com/python/cpython/issues/98251

   (10) https://github.com/python/cpython/issues/94597

   (11) https://github.com/python/cpython/issues/98178

   (12) https://github.com/python/cpython/issues/44098

   (13) https://github.com/python/cpython/issues/87730

   (14) https://github.com/python/cpython/issues/94597

   (15) https://github.com/python/cpython/issues/98023

   (16) https://github.com/python/cpython/issues/90985

   (17) https://github.com/python/cpython/issues/65961

   (18) https://github.com/python/cpython/issues/97646

   (19) https://datatracker.ietf.org/doc/html/rfc9239.html

   (20) https://github.com/python/cpython/issues/97930

   (21) https://github.com/python/cpython/issues/97850

   (22) https://github.com/python/cpython/issues/97837

   (23) https://github.com/python/cpython/issues/97825

   (24) https://github.com/python/cpython/issues/97008

   (25) https://github.com/python/cpython/issues/82711

   (26) https://github.com/python/cpython/issues/97799

   (27) https://github.com/python/cpython/issues/97781

   (28) https://github.com/python/cpython/issues/96827

   (29) https://github.com/python/cpython/issues/95534

   (30) https://github.com/python/cpython/issues/97592

   (31) https://github.com/python/cpython/issues/97639

   (32) https://github.com/python/cpython/issues/97545

   (33) https://github.com/python/cpython/issues/73588

   (34) https://github.com/python/cpython/issues/96865

   (35) https://github.com/python/cpython/issues/97005

   (36) https://github.com/python/cpython/issues/85760

   (37) https://github.com/python/cpython/issues/96704

   (38) https://github.com/python/cpython/issues/96819

   (39) https://github.com/python/cpython/issues/95865

   (40) https://github.com/python/cpython/issues/96741

   (41) https://github.com/python/cpython/issues/96734

   (42) https://github.com/python/cpython/issues/96735

   (43) https://github.com/python/cpython/issues/46412

   (44) https://github.com/python/cpython/issues/96652

   (45) https://github.com/python/cpython/issues/68163

   (46) https://github.com/python/cpython/issues/96538

   (47) https://github.com/python/cpython/issues/96465

   (48) https://github.com/python/cpython/issues/96079

   (49) https://github.com/python/cpython/issues/96415

   (50) https://github.com/python/cpython/issues/95987

   (51) https://github.com/python/cpython/issues/96388

   (52) https://github.com/python/cpython/issues/96385

   (53) https://github.com/python/cpython/issues/96142

   (54) https://github.com/python/cpython/issues/96073

   (55) https://github.com/python/cpython/issues/89258

   (56) https://github.com/python/cpython/issues/96346

   (57) https://github.com/python/cpython/issues/96349

   (58) https://github.com/python/cpython/issues/90467

   (59) https://github.com/python/cpython/issues/96172

   (60) https://github.com/python/cpython/issues/96159

   (61) https://github.com/python/cpython/issues/96175

   (62) https://github.com/python/cpython/issues/96145

   (63) https://github.com/python/cpython/issues/96052

   (64) https://github.com/python/cpython/issues/96125

   (65) https://github.com/python/cpython/issues/96019

   (66) https://github.com/python/cpython/issues/95463

   (67) https://bugs.python.org/issue?@action=redirect&bpo=28080

   (68) https://github.com/python/cpython/issues/69142

   (69) https://github.com/python/cpython/issues/95899

   (70) https://github.com/python/cpython/issues/95736

   (71) https://github.com/python/cpython/issues/95865

   (72) https://github.com/python/cpython/issues/95861

   (73) https://github.com/python/cpython/issues/95804

   (74) https://github.com/python/cpython/issues/95704

   (75) https://github.com/python/cpython/issues/95149

   (76) https://github.com/python/cpython/issues/95609

   (77) https://github.com/python/cpython/issues/95289

   (78) https://github.com/python/cpython/issues/94909

   (79) https://github.com/python/cpython/issues/95385

   (80) https://github.com/python/cpython/issues/83901

   (81) https://github.com/python/cpython/issues/95339

   (82) https://github.com/python/cpython/issues/95045

   (83) https://github.com/python/cpython/issues/95231

   (84) https://github.com/python/cpython/issues/95097

   (85) https://github.com/python/cpython/issues/95087

   (86) https://github.com/python/cpython/issues/95199

   (87) https://github.com/python/cpython/issues/95194

   (88) https://github.com/python/cpython/issues/93899

   (89) https://github.com/python/cpython/issues/95166

   (90) https://github.com/python/cpython/issues/95132

   (91) https://github.com/python/cpython/issues/85128

   (92) https://github.com/python/cpython/issues/93157

   (93) https://github.com/python/cpython/issues/91212

   (94) https://github.com/python/cpython/issues/95077

   (95) https://github.com/python/cpython/issues/95109

   (96) https://github.com/python/cpython/issues/95105

   (97) https://github.com/python/cpython/issues/95066

   (98) https://github.com/python/cpython/issues/77617

   (99) https://github.com/python/cpython/issues/95005

   (100) https://github.com/python/cpython/issues/90085

   (101) https://github.com/python/cpython/issues/94857

   (102) https://github.com/python/cpython/issues/94821

   (103) https://github.com/python/cpython/issues/94736

   (104) https://github.com/python/cpython/issues/81620

   (105) https://github.com/python/cpython/issues/74116

   (106) https://github.com/python/cpython/issues/87822

   (107) https://github.com/python/cpython/issues/88050

   (108) https://github.com/python/cpython/issues/94637

   (109) https://github.com/python/cpython/issues/94309

   (110) https://github.com/python/cpython/issues/92546

   (111) https://github.com/python/cpython/issues/94607

   (112) https://github.com/python/cpython/issues/94619

   (113) https://github.com/python/cpython/issues/93910

   (114) https://github.com/python/cpython/issues/93896

   (115) https://github.com/python/cpython/issues/94343

   (116) https://github.com/python/cpython/issues/94382

   (117) https://github.com/python/cpython/issues/78724

   (118) https://github.com/python/cpython/issues/94510

   (119) https://github.com/python/cpython/issues/92336

   (120) https://github.com/python/cpython/issues/94398

   (121) https://github.com/python/cpython/issues/94383

   (122) https://github.com/python/cpython/issues/94379

   (123) https://peps.python.org/pep-0451/

   (124) https://github.com/python/cpython/issues/94352

   (125) https://github.com/python/cpython/issues/94318

   (126) https://github.com/python/cpython/issues/89988

   (127) https://github.com/python/cpython/issues/90016

   (128) https://github.com/python/cpython/issues/94254

   (129) https://github.com/python/cpython/issues/93259

   (130) https://github.com/python/cpython/issues/74696

   (131) https://github.com/python/cpython/issues/94216

   (132) https://github.com/python/cpython/issues/93096

   (133) https://github.com/python/cpython/issues/94207

   (134) https://github.com/python/cpython/issues/93096

   (135) https://github.com/python/cpython/issues/94226

   (136) https://github.com/python/cpython/issues/94199

   (137) https://github.com/python/cpython/issues/94214

   (138) https://github.com/python/cpython/issues/94199

   (139) https://cwe.mitre.org/data/definitions/295.html

   (140) https://github.com/python/cpython/issues/94199

   (141) https://github.com/python/cpython/issues/94199

   (142) https://peps.python.org/pep-0644/

   (143) https://github.com/python/cpython/issues/94196

   (144) https://github.com/python/cpython/issues/94182

   (145) https://github.com/python/cpython/issues/94169

   (146) https://github.com/python/cpython/issues/91742

   (147) https://github.com/python/cpython/issues/94101

   (148) https://github.com/python/cpython/issues/84753

   (149) https://github.com/python/cpython/issues/94028

   (150) https://github.com/python/cpython/issues/93973

   (151) https://github.com/python/cpython/issues/93963

   (152) https://github.com/python/cpython/issues/93858

   (153) https://github.com/python/cpython/issues/93820

   (154) https://github.com/python/cpython/issues/93847

   (155) https://github.com/python/cpython/issues/91404

   (156) https://github.com/python/cpython/issues/83499

   (157) https://github.com/python/cpython/issues/93820

   (158) https://github.com/python/cpython/issues/79512

   (159) https://github.com/python/cpython/issues/91389

   (160) https://github.com/python/cpython/issues/93626

   (161) https://github.com/python/cpython/issues/90473

   (162) https://peps.python.org/pep-0370/

   (163) https://github.com/python/cpython/issues/90494

   (164) https://github.com/python/cpython/issues/90549

   (165) https://github.com/python/cpython/issues/93521

   (166) https://github.com/python/cpython/issues/79579

   (167) https://github.com/python/cpython/issues/93421

   (168) https://github.com/python/cpython/issues/93475

   (169) https://github.com/python/cpython/issues/93370

   (170) https://github.com/python/cpython/issues/91810

   (171) https://github.com/python/cpython/issues/91162

   (172) https://github.com/python/cpython/issues/93353

   (173) https://github.com/python/cpython/issues/83658

   (174) https://github.com/python/cpython/issues/93312

   (175) https://github.com/python/cpython/issues/88123

   (176) https://github.com/python/cpython/issues/93297

   (177) https://github.com/python/cpython/issues/85308

   (178) https://github.com/python/cpython/issues/93156

   (179) https://github.com/python/cpython/issues/93162

   (180) https://github.com/python/cpython/issues/93243

   (181) https://peps.python.org/pep-0594/

   (182) https://github.com/python/cpython/issues/92886

   (183) https://github.com/python/cpython/issues/90155

   (184) https://github.com/python/cpython/issues/90817

   (185) https://github.com/python/cpython/issues/91513

   (186) https://github.com/python/cpython/issues/74696

   (187) https://github.com/python/cpython/issues/92728

   (188) https://github.com/python/cpython/issues/93033

   (189) https://github.com/python/cpython/issues/89973

   (190) https://github.com/python/cpython/issues/93044

   (191) https://github.com/python/cpython/issues/93010

   (192) https://github.com/python/cpython/issues/92986

   (193) https://github.com/python/cpython/issues/92932

   (194) https://github.com/python/cpython/issues/92675

   (195) https://github.com/python/cpython/issues/87901

   (196) https://github.com/python/cpython/issues/91922

   (197) https://github.com/python/cpython/issues/92869

   (198) https://github.com/python/cpython/issues/92839

   (199) https://github.com/python/cpython/issues/90473

   (200) https://github.com/python/cpython/issues/89325

   (201) https://github.com/python/cpython/issues/92734

   (202) https://github.com/python/cpython/issues/92671

   (203) https://github.com/python/cpython/issues/91581

   (204) https://github.com/python/cpython/issues/86388

   (205) https://github.com/python/cpython/issues/90385

   (206) https://github.com/python/cpython/issues/92550

   (207) https://github.com/python/cpython/issues/92591

   (208) https://github.com/python/cpython/issues/92445

   (209) https://github.com/python/cpython/issues/92547

   (210) https://github.com/python/cpython/issues/92530

   (211) https://github.com/python/cpython/issues/92531

   (212) https://github.com/python/cpython/issues/84131

   (213) https://github.com/python/cpython/issues/89336

   (214) https://github.com/python/cpython/issues/92391

   (215) https://github.com/python/cpython/issues/91968

   (216) https://github.com/python/cpython/issues/91810

   (217) https://github.com/python/cpython/issues/81790

   (218) https://github.com/python/cpython/issues/91760

   (219) https://github.com/python/cpython/issues/90622

   (220) https://github.com/python/cpython/issues/91577

   (221) https://github.com/python/cpython/issues/91581

   (222) https://github.com/python/cpython/issues/91539

   (223) https://github.com/python/cpython/issues/91524

   (224) https://github.com/python/cpython/issues/91447

   (225) https://github.com/python/cpython/issues/91456

   (226) https://bugs.python.org/issue?@action=redirect&bpo=47231

   (227) https://bugs.python.org/issue?@action=redirect&bpo=39064

   (228) https://bugs.python.org/issue?@action=redirect&bpo=41287

   (229) https://github.com/python/cpython/issues/90005

   (230) https://bugs.python.org/issue?@action=redirect&bpo=32547

   (231) https://bugs.python.org/issue?@action=redirect&bpo=35540

   (232) https://bugs.python.org/issue?@action=redirect&bpo=47063

   (233) https://bugs.python.org/issue?@action=redirect&bpo=47025

   (234) https://bugs.python.org/issue?@action=redirect&bpo=46951

   (235) https://bugs.python.org/issue?@action=redirect&bpo=42777

   (236) https://bugs.python.org/issue?@action=redirect&bpo=46755

   (237) https://bugs.python.org/issue?@action=redirect&bpo=45393

   (238) https://bugs.python.org/issue?@action=redirect&bpo=46642

   (239) https://bugs.python.org/issue?@action=redirect&bpo=46364

   (240) https://bugs.python.org/issue?@action=redirect&bpo=28249

   (241) https://bugs.python.org/issue?@action=redirect&bpo=46197

   (242) https://bugs.python.org/issue?@action=redirect&bpo=45924

   (243) https://bugs.python.org/issue?@action=redirect&bpo=45046

   (244) https://bugs.python.org/issue?@action=redirect&bpo=44173

   (245) https://bugs.python.org/issue?@action=redirect&bpo=42627

   (246) https://bugs.python.org/issue?@action=redirect&bpo=42047

   (247) https://bugs.python.org/issue?@action=redirect&bpo=14243

   (248) https://bugs.python.org/issue?@action=redirect&bpo=41246

   (249) https://bugs.python.org/issue?@action=redirect&bpo=39264

   (250) https://bugs.python.org/issue?@action=redirect&bpo=38693

   (251) https://bugs.python.org/issue?@action=redirect&bpo=38267

   (252) https://bugs.python.org/issue?@action=redirect&bpo=34828

   (253) https://bugs.python.org/issue?@action=redirect&bpo=32990

   (254) https://bugs.python.org/issue?@action=redirect&bpo=26253


File: python.info,  Node: ドキュメント<28>,  Next: テスト<27>,  Prev: ライブラリ<87>,  Up: Python 3 12 0 alpha 1

1.24.34.22 ドキュメント
.......................

   - gh-85525(1): Remove extra row

   - gh-86404(2): Deprecated tools ‘make suspicious’ and ‘rstlint.py’
     are now removed.  They have been replaced by sphinx-lint(3).

   - gh-97741(4): Fix ‘!’ in c domain ref target syntax via a ‘conf.py’
     patch, so it works as intended to disable ref target resolution.

   - gh-96432(5): Fraction literals now support whitespace around the
     forward slash, ‘Fraction('2 / 3')’.

   - gh-96098(6): Improve discoverability of the higher level
     concurrent.futures module by providing clearer links from the lower
     level threading and multiprocessing modules.

   - gh-95957(7): What's New 3.11 now has instructions for how to
     provide compiler and linker flags for Tcl/Tk and OpenSSL on RHEL 7
     and CentOS 7.

   - gh-95588(8): Clarified the conflicting advice given in the *note
     ast: 9. documentation about *note ast.literal_eval(): e12. being
     "safe" for use on untrusted input while at the same time warning
     that it can crash the process.  The latter statement is true and is
     deemed unfixable without a large amount of work unsuitable for a
     bugfix.  So we keep the warning and no longer claim that
     ‘literal_eval’ is safe.

   - gh-91207(9): Fix stylesheet not working in Windows CHM htmlhelp
     docs and add warning that they are deprecated.  Contributed by
     C.A.M. Gerlach.

   - gh-95454(10): Replaced incorrectly written true/false values in
     documentation.  Patch by Robert O'Shea

   - gh-95451(11): Update library documentation with *note availability
     information: 1b6a. on WebAssembly platforms ‘wasm32-emscripten’ and
     ‘wasm32-wasi’.

   - gh-95415(12): Use consistent syntax for platform availability.  The
     directive now supports a content body and emits a warning when it
     encounters an unknown platform.

   - gh-94321(13): Document the PEP 246(14) style protocol type *note
     sqlite3.PrepareProtocol: 1b6b.

   - gh-86128(15): Document a limitation in ThreadPoolExecutor where its
     exit handler is executed before any handlers in atexit.

   - gh-61162(16): Clarify *note sqlite3: d4. behavior when *note
     接続(connection)コンテキストマネージャの使い方: 1b6c.

   - gh-87260(17): Align *note sqlite3: d4. argument specs with the
     actual implementation.

   - gh-86986(18): The minimum Sphinx version required to build the
     documentation is now 3.2.

   - gh-88831(19): Augmented documentation of asyncio.create_task().
     Clarified the need to keep strong references to tasks and added a
     code snippet detailing how to do this.

   - gh-86438(20): Clarify that *note -W: ac6. and *note PYTHONWARNINGS:
     da3. are matched literally and case-insensitively, rather than as
     regular expressions, in *note warnings: 118.

   - gh-93031(21): Update tutorial introduction output to use 3.10+
     SyntaxError invalid range.

   - gh-92240(22): Added release dates for "What's New in Python 3.X"
     for 3.0, 3.1, 3.2, 3.8 and 3.10

   - bpo-47161(23): Document that *note pathlib.PurePath: 6cd. does not
     collapse initial double slashes because they denote UNC paths.

   - bpo-40838(24): Document that *note inspect.getdoc(): bed, *note
     inspect.getmodule(): 1b6d, and *note inspect.getsourcefile(): 1b6e.
     might return ‘None’.

   - bpo-43689(25): The ‘Differ’ documentation now also mentions other
     whitespace characters, which make it harder to understand the diff
     output.

   - bpo-38056(26): Overhaul the *note エラーハンドラ: 1b6f.
     documentation in *note codecs: 1c.

   - bpo-13553(27): Document tkinter.Tk args.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/85525

   (2) https://github.com/python/cpython/issues/86404

   (3) https://pypi.org/project/sphinx-lint/

   (4) https://github.com/python/cpython/issues/97741

   (5) https://github.com/python/cpython/issues/96432

   (6) https://github.com/python/cpython/issues/96098

   (7) https://github.com/python/cpython/issues/95957

   (8) https://github.com/python/cpython/issues/95588

   (9) https://github.com/python/cpython/issues/91207

   (10) https://github.com/python/cpython/issues/95454

   (11) https://github.com/python/cpython/issues/95451

   (12) https://github.com/python/cpython/issues/95415

   (13) https://github.com/python/cpython/issues/94321

   (14) https://peps.python.org/pep-0246/

   (15) https://github.com/python/cpython/issues/86128

   (16) https://github.com/python/cpython/issues/61162

   (17) https://github.com/python/cpython/issues/87260

   (18) https://github.com/python/cpython/issues/86986

   (19) https://github.com/python/cpython/issues/88831

   (20) https://github.com/python/cpython/issues/86438

   (21) https://github.com/python/cpython/issues/93031

   (22) https://github.com/python/cpython/issues/92240

   (23) https://bugs.python.org/issue?@action=redirect&bpo=47161

   (24) https://bugs.python.org/issue?@action=redirect&bpo=40838

   (25) https://bugs.python.org/issue?@action=redirect&bpo=43689

   (26) https://bugs.python.org/issue?@action=redirect&bpo=38056

   (27) https://bugs.python.org/issue?@action=redirect&bpo=13553


File: python.info,  Node: テスト<27>,  Next: ビルド<32>,  Prev: ドキュメント<28>,  Up: Python 3 12 0 alpha 1

1.24.34.23 テスト
.................

   - gh-95027(1): On Windows, when the Python test suite is run with the
     ‘-jN’ option, the ANSI code page is now used as the encoding for
     the stdout temporary file, rather than using UTF-8 which can lead
     to decoding errors.  Patch by Victor Stinner.

   - gh-96624(2): Fixed the failure of repeated runs of
     ‘test.test_unittest’ caused by side effects in
     ‘test_dotted_but_module_not_loaded’.

   - gh-95243(3): Mitigate the inherent race condition from using
     find_unused_port() in testSockName() by trying to find an unused
     port a few times before failing.  Patch by Ross Burton.

   - gh-95573(4): Lib/test/test_asyncio/test_ssl.py(5) exposed a bug in
     the macOS kernel where intense concurrent load on non-blocking
     sockets occasionally causes *note errno.ENOBUFS: 1b71. ("No buffer
     space available") to be emitted.  FB11063974 filed with Apple, in
     the mean time as a workaround buffer size used in tests on macOS is
     decreased to avoid intermittent failures.  Patch by Fantix King.

   - gh-95280(6): Fix problem with ‘test_ssl’ ‘test_get_ciphers’ on
     systems that require perfect forward secrecy (PFS) ciphers.

   - gh-95212(7): Make multiprocessing test case
     ‘test_shared_memory_recreate’ parallel-safe.

   - gh-95218(8): Move tests for importlib.resources into
     test_importlib.resources.

   - gh-93963(9): Updated tests to use preferred location for
     ‘importlib.resources’ ABCs.

   - gh-94675(10): Add a regression test for *note re: be. exponentional
     slowdown when using rjsmin.

   - gh-91330(11): Added more tests for *note dataclasses: 33. to cover
     behavior with data descriptor-based fields.

   - gh-94208(12): ‘test_ssl’ is now checking for supported TLS version
     and protocols in more tests.

   - gh-94315(13): Tests now check for DAC override capability instead
     of relying on *note os.geteuid(): 1b72.

   - gh-54781(14): Rename test_tk to test_tkinter, and rename
     test_ttk_guionly to test_ttk.  Patch by Victor Stinner.

   - gh-93839(15): Move ‘Lib/ctypes/test/’ to ‘Lib/test/test_ctypes/’.
     Patch by Victor Stinner.

   - gh-93951(16): In test_bdb.StateTestCase.test_skip, avoid including
     auxiliary importers.

   - gh-93957(17): Provide nicer error reporting from subprocesses in
     test_venv.EnsurePipTest.test_with_pip.

   - gh-93884(18): Add test cases for *note PyNumber_ToBase(): 1b73.
     that take a large number or a non-int object as parameter.

   - gh-93852(19): test_asyncio, test_logging, test_socket and
     test_socketserver now create AF_UNIX domains in the current
     directory to no longer fail with ‘OSError("AF_UNIX path too long")’
     if the temporary directory (the ‘TMPDIR’ environment variable) is
     too long.  Patch by Victor Stinner.

   - gh-93353(20): regrtest now checks if a test leaks temporary files
     or directories if run with -jN option.  Patch by Victor Stinner.

   - gh-84461(21): ‘run_tests.py’ now handles cross compiling env vars
     correctly and pass ‘HOSTRUNNER’ to regression tests.

   - gh-93616(22): ‘test_modulefinder’ now creates a temporary directory
     in ‘ModuleFinderTest.setUp()’ instead of module scope.

   - gh-93575(23): Fix issue with test_unicode test_raiseMemError.  The
     test case now use ‘test.support.calcobjsize’ to calculate size of
     PyUnicode structs.  *note sys.getsizeof(): 1adb. may return
     different size when string has UTF-8 memory.

   - gh-90473(24): WASI does not have a ‘chmod(2)’ syscall.  *note
     os.chmod(): 529. is now a dummy function on WASI. Skip all tests
     that depend on working *note os.chmod(): 529.

   - gh-90473(25): Skip tests on WASI that require symlinks with
     absolute paths.

   - gh-57539(26): Increase calendar test coverage for
     ‘calendar.LocaleTextCalendar.formatweekday()’.

   - gh-90473(27): Skip symlink tests on WASI. wasmtime uses
     ‘openat2(2)’ with ‘RESOLVE_BENEATH’ flag, which prevents symlinks
     with absolute paths.

   - gh-89858(28): Fix ‘test_embed’ for out-of-tree builds.  Patch by
     Kumar Aditya.

   - gh-92886(29): Fixing tests that fail when running with
     optimizations (‘-O’) in ‘test_imaplib.py’.

   - gh-92886(30): Fixing tests that fail when running with
     optimizations (‘-O’) in ‘test_zipimport.py’

   - gh-92886(31): Fixing tests that fail when running with
     optimizations (‘-O’) in ‘test_py_compile.py’

   - gh-92886(32): Fixing tests that fail when running with
     optimizations (‘-O’) in ‘test_sys_settrace.py’.

   - gh-92886(33): Fixing tests that fail when running with
     optimizations (‘-O’) in ‘_test_multiprocessing.py’

   - gh-92670(34): Skip
     ‘test_shutil.TestCopy.test_copyfile_nonexistent_dir’ test on AIX as
     the test uses a trailing slash to force the OS consider the path as
     a directory, but on AIX the trailing slash has no effect and is
     considered as a file.

   - gh-92514(35): Remove unused ‘test.support.BasicTestRunner’.  Patch
     by Jelle Zijlstra.

   - bpo-47016(36): Create a GitHub Actions workflow for verifying
     bundled pip and setuptools.  Patch by Illia Volochii and Adam
     Turner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/95027

   (2) https://github.com/python/cpython/issues/96624

   (3) https://github.com/python/cpython/issues/95243

   (4) https://github.com/python/cpython/issues/95573

   (5) 
https://github.com/python/cpython/tree/3.14/Lib/test/test_asyncio/test_ssl.py

   (6) https://github.com/python/cpython/issues/95280

   (7) https://github.com/python/cpython/issues/95212

   (8) https://github.com/python/cpython/issues/95218

   (9) https://github.com/python/cpython/issues/93963

   (10) https://github.com/python/cpython/issues/94675

   (11) https://github.com/python/cpython/issues/91330

   (12) https://github.com/python/cpython/issues/94208

   (13) https://github.com/python/cpython/issues/94315

   (14) https://github.com/python/cpython/issues/54781

   (15) https://github.com/python/cpython/issues/93839

   (16) https://github.com/python/cpython/issues/93951

   (17) https://github.com/python/cpython/issues/93957

   (18) https://github.com/python/cpython/issues/93884

   (19) https://github.com/python/cpython/issues/93852

   (20) https://github.com/python/cpython/issues/93353

   (21) https://github.com/python/cpython/issues/84461

   (22) https://github.com/python/cpython/issues/93616

   (23) https://github.com/python/cpython/issues/93575

   (24) https://github.com/python/cpython/issues/90473

   (25) https://github.com/python/cpython/issues/90473

   (26) https://github.com/python/cpython/issues/57539

   (27) https://github.com/python/cpython/issues/90473

   (28) https://github.com/python/cpython/issues/89858

   (29) https://github.com/python/cpython/issues/92886

   (30) https://github.com/python/cpython/issues/92886

   (31) https://github.com/python/cpython/issues/92886

   (32) https://github.com/python/cpython/issues/92886

   (33) https://github.com/python/cpython/issues/92886

   (34) https://github.com/python/cpython/issues/92670

   (35) https://github.com/python/cpython/issues/92514

   (36) https://bugs.python.org/issue?@action=redirect&bpo=47016


File: python.info,  Node: ビルド<32>,  Next: Windows<29>,  Prev: テスト<27>,  Up: Python 3 12 0 alpha 1

1.24.34.24 ビルド
.................

   - gh-96761(1): Fix the build process of clang compiler for
     ‘_bootstrap_python’ if LTO optimization is applied.  Patch by
     Matthias Görgens and Donghee Na.

   - gh-96883(2): ‘wasm32-emscripten’ builds for browsers now include
     *note concurrent.futures: 24. for *note asyncio: b. and *note
     unittest.mock: 10d.

   - gh-85936(3): CPython now uses the ThinLTO option as the default
     policy if the Clang compiler accepts the flag.  Patch by Donghee
     Na.

   - gh-96729(4): Ensure that Windows releases built with
     ‘Tools\msi\buildrelease.bat’ are upgradable to and from official
     Python releases.

   - gh-96269(5): Shared module targets now depend on new ‘MODULE_DEPS’
     variable, which includes ‘EXPORTSYMS’.  This fixes a build order
     issue on unsupported AIX platform.

   - gh-84461(6): ‘wasm32-emscripten’ platform no longer builds *note
     resource: c1. module, *note getresuid(): 152d, *note getresgid():
     152c, and their setters.  The APIs are stubs and not functional.

   - gh-95973(7): Add a new ‘--with-dsymutil’ configure option to link
     debug information in macOS. Patch by Pablo Galindo.

   - gh-90536(8): Use the BOLT post-link optimizer to improve
     performance, particularly on medium-to-large applications.

   - gh-93744(9): Remove the ‘configure --with-cxx-main’ build option:
     it didn't work for many years.  Remove the ‘MAINCC’ variable from
     ‘configure’ and ‘Makefile’.  Patch by Victor Stinner.

   - gh-94801(10): Fix a regression in ‘configure’ script that caused
     some header checks to ignore custom ‘CPPFLAGS’.  The regression was
     introduced in gh-94802(11).

   - gh-95145(12): wasm32-wasi builds no longer depend on WASIX's
     pthread stubs.  Python now has its own stubbed pthread API.

   - gh-95174(13): Python now detects missing ‘dup’ function in WASI and
     works around some missing *note errno: 5b, *note select: c6, and
     *note socket: d1. constants.

   - gh-95174(14): Python now skips missing *note socket: d1. functions
     and methods on WASI. WASI can only create sockets from existing fd
     / accept and has no netdb.

   - gh-95085(15): Platforms ‘wasm32-unknown-emscripten’ and
     ‘wasm32-unknown-wasi’ have been promoted to PEP 11(16) tier 3
     platform support.

   - gh-94847(17): Fixed ‘_decimal’ module build issue on GCC when
     compiling with LTO and pydebug.  Debug builds no longer force
     inlining of functions.

   - gh-94841(18): Fix the possible performance regression of *note
     PyObject_Free(): e60. compiled with MSVC version 1932.

   - gh-94801(19): ‘configure’ now uses custom flags like ‘ZLIB_CFLAGS’
     and ‘ZLIB_LIBS’ when searching for headers and libraries.

   - gh-94773(20): ‘deepfreeze.py’ now supports code object with
     frozensets that contain incompatible, unsortable types.

   - gh-94682(21): Build and test with OpenSSL 1.1.1q

   - gh-90005(22): Dependencies of *note readline: bf. and *note curses:
     2f. module are now detected in ‘configure’ script with
     ‘pkg-config’.  Only ‘ncurses’ / ‘ncursesw’ are detected
     automatically.  The old ‘curses’ library is not configured
     automatically.  Workaround for missing ‘termcap’ or ‘tinfo’ library
     has been removed.

   - gh-90005(23): Fix building ‘_ctypes’ extension without
     ‘pkg-config’.

   - gh-90005(24): ‘_dbm’ module dependencies are now detected by
     configure.

   - gh-94404(25): ‘makesetup’ now works around an issue with sed on
     macOS and uses correct CFLAGS for object files that end up in a
     shared extension.  Module CFLAGS are used before
     PY_STDMODULE_CFLAGS to avoid clashes with system headers.

   - gh-93939(26): C extension modules are now built by ‘configure’ and
     ‘make’ instead of ‘distutils’ and ‘setup.py’.

   - gh-93939(27): The ‘2to3’, ‘idle’, and ‘pydoc’ scripts are now
     generated and installed by ‘Makefile’ instead of ‘setup.py’.

   - gh-94280(28): Updated pegen regeneration script on Windows to find
     and use Python 3.9 or higher.  Prior to this, pegen regeneration
     already required 3.9 or higher, but the script may have used lower
     versions of Python.

   - gh-93584(29): Address race condition in ‘Makefile’ when installing
     a PGO build.  All ‘test’ and ‘install’ targets now depend on ‘all’
     target.

   - gh-93491(30): ‘configure’ now detects and reports PEP 11(31)
     support tiers.

   - gh-69093(32): Fix ‘Modules/Setup.stdlib.in’ rule for ‘_sqlite3’
     extension.

   - gh-93207(33): ‘va_start()’ with two parameters, like
     ‘va_start(args, format),’ is now required to build Python.
     ‘va_start()’ is no longer called with a single parameter.  Patch by
     Kumar Aditya.

   - gh-93202(34): Python now always use the ‘%zu’ and ‘%zd’ printf
     formats to format a ‘size_t’ or ‘Py_ssize_t’ number.  Building
     Python 3.12 requires a C11 compiler, so these printf formats are
     now always supported.  Patch by Victor Stinner.

   - gh-90473(35): Disable pymalloc and increase stack size on
     ‘wasm32-wasi’.

   - bpo-34449(36): Drop invalid compiler switch ‘-fPIC’ for HP aCC on
     HP-UX. Patch by Michael Osipov.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/96761

   (2) https://github.com/python/cpython/issues/96883

   (3) https://github.com/python/cpython/issues/85936

   (4) https://github.com/python/cpython/issues/96729

   (5) https://github.com/python/cpython/issues/96269

   (6) https://github.com/python/cpython/issues/84461

   (7) https://github.com/python/cpython/issues/95973

   (8) https://github.com/python/cpython/issues/90536

   (9) https://github.com/python/cpython/issues/93744

   (10) https://github.com/python/cpython/issues/94801

   (11) https://github.com/python/cpython/issues/94802

   (12) https://github.com/python/cpython/issues/95145

   (13) https://github.com/python/cpython/issues/95174

   (14) https://github.com/python/cpython/issues/95174

   (15) https://github.com/python/cpython/issues/95085

   (16) https://peps.python.org/pep-0011/

   (17) https://github.com/python/cpython/issues/94847

   (18) https://github.com/python/cpython/issues/94841

   (19) https://github.com/python/cpython/issues/94801

   (20) https://github.com/python/cpython/issues/94773

   (21) https://github.com/python/cpython/issues/94682

   (22) https://github.com/python/cpython/issues/90005

   (23) https://github.com/python/cpython/issues/90005

   (24) https://github.com/python/cpython/issues/90005

   (25) https://github.com/python/cpython/issues/94404

   (26) https://github.com/python/cpython/issues/93939

   (27) https://github.com/python/cpython/issues/93939

   (28) https://github.com/python/cpython/issues/94280

   (29) https://github.com/python/cpython/issues/93584

   (30) https://github.com/python/cpython/issues/93491

   (31) https://peps.python.org/pep-0011/

   (32) https://github.com/python/cpython/issues/69093

   (33) https://github.com/python/cpython/issues/93207

   (34) https://github.com/python/cpython/issues/93202

   (35) https://github.com/python/cpython/issues/90473

   (36) https://bugs.python.org/issue?@action=redirect&bpo=34449


File: python.info,  Node: Windows<29>,  Next: macOS<20>,  Prev: ビルド<32>,  Up: Python 3 12 0 alpha 1

1.24.34.25 Windows
..................

   - gh-98360(1): Fixes *note multiprocessing: 98. spawning child
     processes on Windows from a virtual environment to ensure that
     child processes that also use *note multiprocessing: 98. to spawn
     more children will recognize that they are in a virtual
     environment.

   - gh-98414(2): Fix ‘py.exe’ launcher handling of ‘-V:<COMPANY>/’
     option when default preferences have been set in environment
     variables or configuration files.

   - gh-97728(3): Fix possible crashes caused by the use of
     uninitialized variables when pass invalid arguments in *note
     os.system(): 1676. on Windows and in Windows-specific modules (like
     ‘winreg’).

   - gh-90989(4): Made *note Python install manager: 7da. install
     per-user by default (unless an all users install already exists),
     and clarify some text in the installer.

   - gh-97649(5): The ‘Tools’ directory is no longer installed on
     Windows

   - gh-96965(6): Update libffi to 3.4.3

   - gh-96577(7): Fixes a potential buffer overrun in ‘msilib’.

   - gh-96559(8): Fixes the Windows launcher not using the compatible
     interpretation of default tags found in configuration files when no
     tag was passed to the command.

   - gh-94781(9): Fix ‘pcbuild.proj’ to clean previous instances of
     output files in ‘Python\deepfreeze’ and ‘Python\frozen_modules’
     directories on Windows.  Patch by Charlie Zhao.

   - gh-89545(10): Updates *note platform: af. code getting the Windows
     version to use native Windows Management Instrumentation (WMI)
     queries to determine OS version, type, and architecture.

   - gh-95733(11): Make certain requirements of the Windows Store
     package optional to allow installing on earlier updates of Windows.

   - gh-95656(12): Enable the *note enable_load_extension(): a3f. *note
     sqlite3: d4. API.

   - gh-95587(13): Fixes some issues where the Windows installer would
     incorrectly detect certain features of an existing install when
     upgrading.

   - gh-94399(14): Restores the behaviour of *note Python install
     manager: 7da. for ‘/usr/bin/env’ shebang lines, which will now
     search ‘PATH’ for an executable matching the given command.  If
     none is found, the usual search process is used.

   - gh-95445(15): Fixes the unsuccessful removal of the HTML document
     directory when uninstalling with Windows msi.

   - gh-95359(16): Fix *note Python install manager: 7da. handling of
     ‘py.ini’ commands (it was incorrectly expecting a ‘py_’ prefix on
     keys) and crashes when reading per-user configuration file.

   - gh-95285(17): Fix *note Python install manager: 7da. handling of
     command lines where it is only passed a short executable name.

   - gh-90844(18): Allow virtual environments to correctly launch when
     they have spaces in the path.

   - gh-94772(19): Fix incorrect handling of shebang lines in py.exe
     launcher

   - gh-94018(20): *note zipfile: 137. will now remove trailing spaces
     from path components when extracting files on Windows.

   - gh-93824(21): Drag and drop of files onto Python files in Windows
     Explorer has been enabled for Windows ARM64.

   - gh-43414(22): *note os.get_terminal_size(): 131a. now attempts to
     read the size from any provided handle, rather than only supporting
     file descriptors 0, 1 and 2.

   - gh-92817(23): Ensures that ‘py.exe’ will prefer an active virtual
     environment over default tags specified with environment variables
     or through a ‘py.ini’ file.

   - gh-92984(24): Explicitly disable incremental linking for non-Debug
     builds

   - gh-92841(25): *note asyncio: b. no longer throws ‘RuntimeError:
     Event loop is closed’ on interpreter exit after asynchronous socket
     activity.  Patch by Oleg Iarygin.

   - bpo-46907(26): Update Windows installer to use SQLite 3.38.4.

   - gh-91061(27): Accept os.PathLike for the argument to
     winsound.PlaySound

   - bpo-42658(28): Support native Windows case-insensitive path
     comparisons by using ‘LCMapStringEx’ instead of *note str.lower():
     1b76. in ‘ntpath.normcase()’.  Add ‘LCMapStringEx’ to the ‘_winapi’
     module.

   - bpo-38704(29): Prevent installation on unsupported Windows
     versions.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98360

   (2) https://github.com/python/cpython/issues/98414

   (3) https://github.com/python/cpython/issues/97728

   (4) https://github.com/python/cpython/issues/90989

   (5) https://github.com/python/cpython/issues/97649

   (6) https://github.com/python/cpython/issues/96965

   (7) https://github.com/python/cpython/issues/96577

   (8) https://github.com/python/cpython/issues/96559

   (9) https://github.com/python/cpython/issues/94781

   (10) https://github.com/python/cpython/issues/89545

   (11) https://github.com/python/cpython/issues/95733

   (12) https://github.com/python/cpython/issues/95656

   (13) https://github.com/python/cpython/issues/95587

   (14) https://github.com/python/cpython/issues/94399

   (15) https://github.com/python/cpython/issues/95445

   (16) https://github.com/python/cpython/issues/95359

   (17) https://github.com/python/cpython/issues/95285

   (18) https://github.com/python/cpython/issues/90844

   (19) https://github.com/python/cpython/issues/94772

   (20) https://github.com/python/cpython/issues/94018

   (21) https://github.com/python/cpython/issues/93824

   (22) https://github.com/python/cpython/issues/43414

   (23) https://github.com/python/cpython/issues/92817

   (24) https://github.com/python/cpython/issues/92984

   (25) https://github.com/python/cpython/issues/92841

   (26) https://bugs.python.org/issue?@action=redirect&bpo=46907

   (27) https://github.com/python/cpython/issues/91061

   (28) https://bugs.python.org/issue?@action=redirect&bpo=42658

   (29) https://bugs.python.org/issue?@action=redirect&bpo=38704


File: python.info,  Node: macOS<20>,  Next: IDLE<15>,  Prev: Windows<29>,  Up: Python 3 12 0 alpha 1

1.24.34.26 macOS
................

   - gh-97897(1): The macOS 13 SDK includes support for the ‘mkfifoat’
     and ‘mknodat’ system calls.  Using the ‘dir_fd’ option with either
     *note os.mkfifo(): f90. or *note os.mknod(): f91. could result in a
     segfault if cpython is built with the macOS 13 SDK but run on an
     earlier version of macOS. Prevent this by adding runtime support
     for detection of these system calls ("weaklinking") as is done for
     other newer syscalls on macOS.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97897


File: python.info,  Node: IDLE<15>,  Next: Tools/Demos<24>,  Prev: macOS<20>,  Up: Python 3 12 0 alpha 1

1.24.34.27 IDLE
...............

   - gh-97527(1): Fix a bug in the previous bugfix that caused IDLE to
     not start when run with 3.10.8, 3.12.0a1, and at least Microsoft
     Python 3.10.2288.0 installed without the Lib/test package.  3.11.0
     was never affected.

   - gh-65802(2): Document handling of extensions in Save As dialogs.

   - gh-95191(3): Include prompts when saving Shell (interactive input
     and output).

   - gh-95511(4): Fix the Shell context menu copy-with-prompts bug of
     copying an extra line when one selects whole lines.

   - gh-95471(5): In the Edit menu, move ‘Select All’ and add a new
     separator.

   - gh-95411(6): Enable using IDLE's module browser with .pyw files.

   - gh-89610(7): Add .pyi as a recognized extension for IDLE on macOS.
     This allows opening stub files by double clicking on them in the
     Finder.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97527

   (2) https://github.com/python/cpython/issues/65802

   (3) https://github.com/python/cpython/issues/95191

   (4) https://github.com/python/cpython/issues/95511

   (5) https://github.com/python/cpython/issues/95471

   (6) https://github.com/python/cpython/issues/95411

   (7) https://github.com/python/cpython/issues/89610


File: python.info,  Node: Tools/Demos<24>,  Next: C API<29>,  Prev: IDLE<15>,  Up: Python 3 12 0 alpha 1

1.24.34.28 Tools/Demos
......................

   - gh-68686(1): Remove ptags and eptags scripts.

   - gh-97681(2): Remove the ‘Tools/demo/’ directory which contained old
     demo scripts.  A copy can be found in the old-demos project(3).
     Patch by Victor Stinner.

   - gh-97669(4): Remove outdated example scripts of the
     ‘Tools/scripts/’ directory.  A copy can be found in the old-demos
     project(5).  Patch by Victor Stinner.

   - gh-95853(6): The ‘wasm_build.py’ script now pre-builds Emscripten
     ports, checks for broken EMSDK versions, and warns about pkg-config
     env vars.

   - gh-95853(7): The new tool ‘Tools/wasm/wasm_builder.py’ automates
     configure, compile, and test steps for building CPython on
     WebAssembly platforms.

   - gh-95731(8): Fix handling of module docstrings in
     ‘Tools/i18n/pygettext.py’.

   - gh-93939(9): Add script ‘Tools/scripts/check_modules.py’ to check
     and validate builtin and shared extension modules.  The script also
     handles ‘Modules/Setup’ and will eventually replace ‘setup.py’.

   - gh-94538(10): Fix Argument Clinic output to custom file
     destinations.  Patch by Erlend E. Aasland.

   - gh-94430(11): Allow parameters named ‘module’ and ‘self’ with
     custom C names in Argument Clinic.  Patch by Erlend E. Aasland

   - gh-86087(12): The ‘Tools/scripts/parseentities.py’ script used to
     parse HTML4 entities has been removed.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/68686

   (2) https://github.com/python/cpython/issues/97681

   (3) https://github.com/gvanrossum/old-demos

   (4) https://github.com/python/cpython/issues/97669

   (5) https://github.com/gvanrossum/old-demos

   (6) https://github.com/python/cpython/issues/95853

   (7) https://github.com/python/cpython/issues/95853

   (8) https://github.com/python/cpython/issues/95731

   (9) https://github.com/python/cpython/issues/93939

   (10) https://github.com/python/cpython/issues/94538

   (11) https://github.com/python/cpython/issues/94430

   (12) https://github.com/python/cpython/issues/86087


File: python.info,  Node: C API<29>,  Prev: Tools/Demos<24>,  Up: Python 3 12 0 alpha 1

1.24.34.29 C API
................

   - gh-98393(1): The *note PyUnicode_FSDecoder(): 797. function no
     longer accepts bytes-like paths, like *note bytearray: 344. and
     *note memoryview: 165. types: only the exact *note bytes: 192. type
     is accepted for bytes strings.  Patch by Victor Stinner.

   - gh-91051(2): Add *note PyType_Watch(): 786. and related APIs to
     allow callbacks on *note PyType_Modified(): 1b7b.

   - gh-95756(3): Lazily create and cache ‘co_’ attributes for better
     performance for code getters.

   - gh-96512(4): Configuration for the *note integer string conversion
     length limitation: 80b. now lives in the PyConfig C API struct.

   - gh-95589(5): Extensions classes that set ‘tp_dictoffset’ and
     ‘tp_weaklistoffset’ lose the support for multiple inheritance, but
     are now safe.  Extension classes should use *note
     Py_TPFLAGS_MANAGED_DICT: 60f. and *note Py_TPFLAGS_MANAGED_WEAKREF:
     77c. instead.

   - gh-95781(6): An unrecognized format character in *note
     PyUnicode_FromFormat(): 62b. and *note PyUnicode_FromFormatV():
     794. now sets a *note SystemError: 795.  In previous versions it
     caused all the rest of the format string to be copied as-is to the
     result string, and any extra arguments discarded.

   - gh-92678(7): Restore the 3.10 behavior for multiple inheritance of
     C extension classes that store their dictionary at the end of the
     struct.

   - gh-92678(8): Support C extensions using managed dictionaries by
     setting the ‘Py_TPFLAGS_MANAGED_DICT’ flag.

   - gh-93274(9): API for implementing vectorcall (*note
     Py_TPFLAGS_HAVE_VECTORCALL: 776, *note PyVectorcall_NARGS(): 777.
     and *note PyVectorcall_Call(): 778.) was added to the limited API
     and stable ABI.

   - gh-95504(10): Fix sign placement when specifying width or precision
     in *note PyUnicode_FromFormat(): 62b. and *note
     PyUnicode_FromFormatV(): 794.  Patch by Philip Georgi.

   - gh-93012(11): The *note Py_TPFLAGS_HAVE_VECTORCALL: 776. flag is
     now removed from a class when the class's *note __call__(): 77a.
     method is reassigned.  This makes vectorcall safe to use with
     mutable types (i.e.  heap types without the ‘immutable’ flag).
     Mutable types that do not override *note tp_call: 77b. now inherit
     the *note Py_TPFLAGS_HAVE_VECTORCALL: 776. flag.

   - gh-95388(12): Creating *note immutable types: 3cf. with mutable
     bases is deprecated and is planned to be disabled in Python 3.14.

   - gh-92678(13): Adds unstable C-API functions
     ‘_PyObject_VisitManagedDict’ and ‘_PyObject_ClearManagedDict’ to
     allow C extensions to allow the VM to manage their object's
     dictionaries.

   - gh-94936(14): Added *note PyCode_GetVarnames(): 97d, *note
     PyCode_GetCellvars(): 97e. and *note PyCode_GetFreevars(): 97f. for
     accessing ‘co_varnames’, ‘co_cellvars’ and ‘co_freevars’
     respectively via the C API.

   - gh-94930(15): Fix ‘SystemError’ raised when *note
     PyArg_ParseTupleAndKeywords(): 624. is used with ‘#’ in ‘(...)’ but
     without ‘PY_SSIZE_T_CLEAN’ defined.

   - gh-94731(16): Python again uses C-style casts for most casting
     operations when compiled with C++.  This may trigger compiler
     warnings, if they are enabled with e.g.  ‘-Wold-style-cast’ or
     ‘-Wzero-as-null-pointer-constant’ options for ‘g++’.

   - gh-93937(17): The following frame functions and type are now
     directly available with ‘#include <Python.h>’, it's no longer
     needed to add ‘#include <frameobject.h>’:

        * *note PyFrame_Check(): 988.

        * *note PyFrame_GetBack(): 989.

        * *note PyFrame_GetBuiltins(): 96f.

        * *note PyFrame_GetGenerator(): 970.

        * *note PyFrame_GetGlobals(): 971.

        * *note PyFrame_GetLasti(): 972.

        * *note PyFrame_GetLocals(): 661.

        * *note PyFrame_Type: 98a.

     Patch by Victor Stinner.

   - gh-91321(18): Fix the compatibility of the Python C API with C++
     older than C++11.  Patch by Victor Stinner.

   - gh-91731(19): Avoid defining the ‘static_assert’ when compiling
     with C++ 11, where this is a keyword and redefining it can lead to
     undefined behavior.  Patch by Pablo Galindo

   - gh-89546(20): *note PyType_FromMetaclass(): 772. (and other
     ‘PyType_From*’ functions) now check that offsets and the base
     class's *note tp_basicsize: b7e. fit in the new class's
     ‘tp_basicsize’.

   - gh-93503(21): Add two new public functions to the public C-API,
     *note PyEval_SetProfileAllThreads(): 781. and *note
     PyEval_SetTraceAllThreads(): 664, that allow to set tracing and
     profiling functions in all running threads in addition to the
     calling one.  Also, two analogous functions to the *note threading:
     f3. module (*note threading.setprofile_all_threads(): 6f0. and
     *note threading.settrace_all_threads(): 6ef.) that allow to do the
     same from Python.  Patch by Pablo Galindo

   - gh-93442(22): Add C++ overloads for _Py_CAST_impl() to handle
     0/NULL. This will allow C++ extensions that pass 0 or NULL to
     macros using _Py_CAST() to continue to compile.

   - gh-93466(23): Slot IDs in PyType_Spec may not be repeated.  The
     documentation was updated to mention this.  For some cases of
     repeated slots, PyType_FromSpec and related functions will now
     raise an exception.

   - gh-92898(24): Fix C++ compiler warnings when casting function
     arguments to ‘PyObject*’.  Patch by Serge Guelton.

   - gh-93103(25): Deprecate global configuration variables, like *note
     Py_IgnoreEnvironmentFlag: 40a, in the documentation: the *note
     Py_InitializeFromConfig(): 3f6. API should be instead.  Patch by
     Victor Stinner.

   - gh-77782(26): Deprecate global configuration variable like *note
     Py_IgnoreEnvironmentFlag: 40a.: the *note
     Py_InitializeFromConfig(): 3f6. API should be instead.  Patch by
     Victor Stinner.

   - gh-92913(27): Ensures changes to *note
     PyConfig.module_search_paths: 643. are ignored unless *note
     PyConfig.module_search_paths_set: 805. is set

   - gh-92781(28): Avoid mixing declarations and code in the C API to
     fix the compiler warning: "ISO C90 forbids mixed declarations and
     code" [-Werror=declaration-after-statement].  Patch by Victor
     Stinner.

   - gh-92651(29): Remove the ‘token.h’ header file.  There was never
     any public tokenizer C API. The ‘token.h’ header file was only
     designed to be used by Python internals.  Patch by Victor Stinner.

   - gh-92536(30): Remove legacy Unicode APIs based on ‘Py_UNICODE*’.

   - gh-85858(31): Remove the ‘PyUnicode_InternImmortal()’ function and
     the ‘SSTATE_INTERNED_IMMORTAL’ macro.  Patch by Victor Stinner.

   - gh-92193(32): Add new function *note PyFunction_SetVectorcall():
     782. to the C API which sets the vectorcall field of a given *note
     PyFunctionObject: 783.

     Warning: extensions using this API must preserve the behavior of
     the unaltered function!

   - gh-59121(33): Fixed an assert that prevented ‘PyRun_InteractiveOne’
     from providing tracebacks when parsing from the provided FD.

   - bpo-45383(34): The *note PyType_FromSpec(): 79d. API will now find
     and use a metaclass based on the provided bases.  An error will be
     raised if there is a metaclass conflict.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/98393

   (2) https://github.com/python/cpython/issues/91051

   (3) https://github.com/python/cpython/issues/95756

   (4) https://github.com/python/cpython/issues/96512

   (5) https://github.com/python/cpython/issues/95589

   (6) https://github.com/python/cpython/issues/95781

   (7) https://github.com/python/cpython/issues/92678

   (8) https://github.com/python/cpython/issues/92678

   (9) https://github.com/python/cpython/issues/93274

   (10) https://github.com/python/cpython/issues/95504

   (11) https://github.com/python/cpython/issues/93012

   (12) https://github.com/python/cpython/issues/95388

   (13) https://github.com/python/cpython/issues/92678

   (14) https://github.com/python/cpython/issues/94936

   (15) https://github.com/python/cpython/issues/94930

   (16) https://github.com/python/cpython/issues/94731

   (17) https://github.com/python/cpython/issues/93937

   (18) https://github.com/python/cpython/issues/91321

   (19) https://github.com/python/cpython/issues/91731

   (20) https://github.com/python/cpython/issues/89546

   (21) https://github.com/python/cpython/issues/93503

   (22) https://github.com/python/cpython/issues/93442

   (23) https://github.com/python/cpython/issues/93466

   (24) https://github.com/python/cpython/issues/92898

   (25) https://github.com/python/cpython/issues/93103

   (26) https://github.com/python/cpython/issues/77782

   (27) https://github.com/python/cpython/issues/92913

   (28) https://github.com/python/cpython/issues/92781

   (29) https://github.com/python/cpython/issues/92651

   (30) https://github.com/python/cpython/issues/92536

   (31) https://github.com/python/cpython/issues/85858

   (32) https://github.com/python/cpython/issues/92193

   (33) https://github.com/python/cpython/issues/59121

   (34) https://bugs.python.org/issue?@action=redirect&bpo=45383


File: python.info,  Node: Python 3 11 0 beta 1,  Next: Python 3 11 0 alpha 7,  Prev: Python 3 12 0 alpha 1,  Up: 変更履歴

1.24.35 Python 3.11.0 beta 1
----------------------------

'Release date: 2022-05-06'

* Menu:

* セキュリティ: セキュリティ<28>.
* Core and Builtins: Core and Builtins<84>.
* ライブラリ: ライブラリ<88>.
* Core and Builtins: Core and Builtins<85>.
* ビルド: ビルド<33>.
* Core and Builtins: Core and Builtins<86>.
* ライブラリ: ライブラリ<89>.
* ドキュメント: ドキュメント<29>.
* テスト: テスト<28>.
* ビルド: ビルド<34>.
* Windows: Windows<30>.
* macOS: macOS<21>.
* Tools/Demos: Tools/Demos<25>.
* C API: C API<30>.


File: python.info,  Node: セキュリティ<28>,  Next: Core and Builtins<84>,  Up: Python 3 11 0 beta 1

1.24.35.1 セキュリティ
......................

   - gh-57684(1): Add the *note -P: 7c1. command line option and the
     *note PYTHONSAFEPATH: 7c2. environment variable to not prepend a
     potentially unsafe path to *note sys.path: 3e4.  Patch by Victor
     Stinner.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/57684


File: python.info,  Node: Core and Builtins<84>,  Next: ライブラリ<88>,  Prev: セキュリティ<28>,  Up: Python 3 11 0 beta 1

1.24.35.2 Core and Builtins
...........................

   - gh-89519(1): Chaining classmethod descriptors (introduced in
     bpo-19072(2)) is deprecated.  It can no longer be used to wrap
     other descriptors such as property().  The core design of this
     feature was flawed, and it caused a number of downstream problems.

   - gh-92345(3): ‘pymain_run_python()’ now imports ‘readline’ and
     ‘rlcompleter’ before sys.path is extended to include the current
     working directory of an interactive interpreter.  Non-interactive
     interpreters are not affected.

   - bpo-43857(4): Improve the *note AttributeError: 5f0. message when
     deleting a missing attribute.  Patch by Géry Ogam.

   - gh-92245(5): Make sure that PEP 523 is respected in all cases.  In
     3.11a7, specialization may have prevented Python-to-Python calls
     respecting PEP 523.

   - gh-92203(6): Add a closure keyword-only parameter to *note exec():
     4a2.  It can only be specified when exec-ing a code object that
     uses free variables.  When specified, it must be a tuple, with
     exactly the number of cell variables referenced by the code object.
     closure has a default value of ‘None’, and it must be ‘None’ if the
     code object doesn't refer to any free variables.

   - gh-91173(7): Disable frozen modules in debug builds.  Patch by
     Kumar Aditya.

   - gh-92114(8): Improve error message when subscript a type with
     ‘__class_getitem__’ set to ‘None’.

   - gh-92112(9): Fix crash triggered by an evil custom ‘mro()’ on a
     metaclass.

   - gh-92063(10): The ‘PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS’
     instruction now ensures methods are called only on objects of the
     correct type.

   - gh-92031(11): Deoptimize statically allocated code objects during
     ‘Py_FINALIZE()’ so that future ‘_PyCode_Quicken’ calls always start
     with unquickened code.

   - gh-92036(12): Fix a crash in subinterpreters related to the garbage
     collector.  When a subinterpreter is deleted, untrack all objects
     tracked by its GC. To prevent a crash in deallocator functions
     expecting objects to be tracked by the GC, leak a strong reference
     to these objects on purpose, so they are never deleted and their
     deallocator functions are not called.  Patch by Victor Stinner.

   - gh-92032(13): The interpreter can now autocomplete soft keywords,
     as of now ‘match’, ‘case’, and ‘_’ (wildcard pattern) from PEP
     634(14).

   - gh-87999(15): The warning emitted by the Python parser for a
     numeric literal immediately followed by keyword has been changed
     from deprecation warning to syntax warning.

   - gh-91869(16): Fix an issue where specialized opcodes with extended
     arguments could produce incorrect tracing output or lead to
     assertion failures.

   - gh-91603(17): Speed up *note types.UnionType: 2a7. instantiation.
     Based on patch provided by Yurii Karabas.

   - gh-89373(18): If Python is built in debug mode, Python now ensures
     that deallocator functions leave the current exception unchanged.
     Patch by Victor Stinner.

   - gh-91632(19): Fix a minor memory leak at exit: release the memory
     of the ‘generic_alias_iterator’ type.  Patch by Donghee Na.

   - gh-81548(20): Octal escapes with value larger than ‘0o377’ now
     produce a *note DeprecationWarning: 1a3.  In a future Python
     version they will be a *note SyntaxWarning: 1ae. and eventually a
     *note SyntaxError: 18e.

   - bpo-43950(21): Use a single compact table for line starts, ends and
     column offsets.  Reduces memory consumption for location info by
     half

   - gh-91102(22): Use Argument Clinic for ‘EncodingMap’.  Patch by Oleg
     Iarygin.

   - gh-91636(23): Fixed a crash in a garbage-collection edge-case, in
     which a ‘PyFunction_Type.tp_clear’ function could leave a python
     function object in an inconsistent state.

   - gh-91603(24): Speed up *note isinstance(): 2ad. and *note
     issubclass(): 9c4. checks for *note types.UnionType: 2a7.  Patch by
     Yurii Karabas.

   - gh-91625(25): Fixed a bug in which adaptive opcodes ignored any
     preceding ‘EXTENDED_ARG’s on specialization failure.

   - gh-78607(26): The LLTRACE special build now looks for the name
     ‘__lltrace__’ defined in module globals, rather than the name
     ‘__ltrace__’, which had been introduced as a typo.

   - gh-91576(27): Speed up iteration of ascii strings by 50%.  Patch by
     Kumar Aditya.

   - gh-89279(28): Improve interpreter performance on Windows by
     inlining a few specific macros.

   - gh-91502(29): Add a new ‘_PyFrame_IsEntryFrame()’ API function, to
     check if a *note PyFrameObject: 98c. is an entry frame.  Patch by
     Pablo Galindo.

   - gh-91266(30): Refactor the ‘bytearray’ strip methods ‘strip’,
     ‘lstrip’ and ‘rstrip’ to use a common implementation.

   - gh-91479(31): Replaced the ‘__note__’ field of *note BaseException:
     7d6. (added in an earlier version of 3.11) with the final design of
     PEP 678(32).  Namely, *note BaseException: 7d6. gets an
     ‘add_note()’ method, and its ‘__notes__’ field is created when
     necessary.

   - gh-46055(33): Speed up right shift of negative integers, by
     removing unnecessary creation of temporaries.  Original patch by
     Xinhang Xu, reworked by Mark Dickinson.

   - gh-91462(34): Make the interpreter's low-level tracing (lltrace)
     feature output more readable by displaying opcode names (rather
     than just numbers), and by displaying stack contents before each
     opcode.

   - gh-89455(35): Fixed an uninitialized bool value in the traceback
     printing code path that was introduced by the initial bpo-45292(36)
     exception groups work.

   - gh-91421(37): Fix a potential integer overflow in _Py_DecodeUTF8Ex.

   - gh-91428(38): Add ‘static const char *const _PyOpcode_OpName[256] =
     {...};’ to ‘opcode.h’ for debug builds to assist in debugging the
     Python interpreter.  It is now more convenient to make various
     forms of debugging output more human-readable by including opcode
     names rather than just the corresponding decimal digits.

   - bpo-47120(39): Make *note POP_JUMP_IF_TRUE: 1a5f, *note
     POP_JUMP_IF_FALSE: 1a60, *note POP_JUMP_IF_NONE: 1b7f. and *note
     POP_JUMP_IF_NOT_NONE: 1b80. virtual, mapping to new relative jump
     opcodes.

   - bpo-45317(40): Add internal documentation explaining design of new
     (for 3.11) frame stack.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89519

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19072

   (3) https://github.com/python/cpython/issues/92345

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43857

   (5) https://github.com/python/cpython/issues/92245

   (6) https://github.com/python/cpython/issues/92203

   (7) https://github.com/python/cpython/issues/91173

   (8) https://github.com/python/cpython/issues/92114

   (9) https://github.com/python/cpython/issues/92112

   (10) https://github.com/python/cpython/issues/92063

   (11) https://github.com/python/cpython/issues/92031

   (12) https://github.com/python/cpython/issues/92036

   (13) https://github.com/python/cpython/issues/92032

   (14) https://peps.python.org/pep-0634/

   (15) https://github.com/python/cpython/issues/87999

   (16) https://github.com/python/cpython/issues/91869

   (17) https://github.com/python/cpython/issues/91603

   (18) https://github.com/python/cpython/issues/89373

   (19) https://github.com/python/cpython/issues/91632

   (20) https://github.com/python/cpython/issues/81548

   (21) https://bugs.python.org/issue?@action=redirect&bpo=43950

   (22) https://github.com/python/cpython/issues/91102

   (23) https://github.com/python/cpython/issues/91636

   (24) https://github.com/python/cpython/issues/91603

   (25) https://github.com/python/cpython/issues/91625

   (26) https://github.com/python/cpython/issues/78607

   (27) https://github.com/python/cpython/issues/91576

   (28) https://github.com/python/cpython/issues/89279

   (29) https://github.com/python/cpython/issues/91502

   (30) https://github.com/python/cpython/issues/91266

   (31) https://github.com/python/cpython/issues/91479

   (32) https://peps.python.org/pep-0678/

   (33) https://github.com/python/cpython/issues/46055

   (34) https://github.com/python/cpython/issues/91462

   (35) https://github.com/python/cpython/issues/89455

   (36) https://bugs.python.org/issue?@action=redirect&bpo=45292

   (37) https://github.com/python/cpython/issues/91421

   (38) https://github.com/python/cpython/issues/91428

   (39) https://bugs.python.org/issue?@action=redirect&bpo=47120

   (40) https://bugs.python.org/issue?@action=redirect&bpo=45317


File: python.info,  Node: ライブラリ<88>,  Next: Core and Builtins<85>,  Prev: Core and Builtins<84>,  Up: Python 3 11 0 beta 1

1.24.35.3 ライブラリ
....................

   - bpo-47197(1): ctypes used to mishandle ‘void’ return types, so that
     for instance a function declared like ‘ctypes.CFUNCTYPE(None,
     ctypes.c_int)’ would be called with signature ‘int f(int)’ instead
     of ‘void f(int)’.  Wasm targets require function pointers to be
     called with the correct signatures so this led to crashes.  The
     problem is now fixed.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=47197


File: python.info,  Node: Core and Builtins<85>,  Next: ビルド<33>,  Prev: ライブラリ<88>,  Up: Python 3 11 0 beta 1

1.24.35.4 Core and Builtins
...........................

   - bpo-47120(1): Make opcodes ‘JUMP_IF_TRUE_OR_POP’ and
     ‘JUMP_IF_FALSE_OR_POP’ relative rather than absolute.

   - bpo-47177(2): Replace the ‘f_lasti’ member of the internal
     ‘_PyInterpreterFrame’ structure with a ‘prev_instr’ pointer, which
     reduces overhead in the main interpreter loop.  The ‘f_lasti’
     attribute of Python-layer frame objects is preserved for
     backward-compatibility.

   - bpo-46961(3): Integer mod/remainder operations, including the
     three-argument form of *note pow(): 1a4, now consistently return
     ints from the global small integer cache when applicable.

   - bpo-46962(4): Classes and functions that unconditionally declared
     their docstrings ignoring the ‘--without-doc-strings’ compilation
     flag no longer do so.

     The classes affected are ‘ctypes.UnionType’, *note
     pickle.PickleBuffer: 177b, ‘testcapi.RecursingInfinitelyError’, and
     *note types.GenericAlias: 9ec.

     The functions affected are 24 methods in *note ctypes: 2e.

     Patch by Oleg Iarygin.

   - bpo-46942(5): Use Argument Clinic for the *note types.MethodType:
     1b83. constructor.  Patch by Oleg Iarygin.

   - bpo-46764(6): Fix wrapping bound methods with @classmethod

   - bpo-43464(7): Optimize *note set.intersection(): 1b84. for non-set
     arguments.

   - bpo-46721(8): Optimize *note set.issuperset(): 1b85. for non-set
     argument.

   - bpo-46509(9): Add type-specialized versions of the ‘Py_DECREF()’,
     and use them for ‘float’, ‘int’, ‘str’, ‘bool’, and ‘None’ to avoid
     pointer-chasing at runtime where types are known at C compile time.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=47120

   (2) https://bugs.python.org/issue?@action=redirect&bpo=47177

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46961

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46962

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46942

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46764

   (7) https://bugs.python.org/issue?@action=redirect&bpo=43464

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46721

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46509


File: python.info,  Node: ビルド<33>,  Next: Core and Builtins<86>,  Prev: Core and Builtins<85>,  Up: Python 3 11 0 beta 1

1.24.35.5 ビルド
................

   - bpo-46045(1): Do not use POSIX semaphores on NetBSD

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46045


File: python.info,  Node: Core and Builtins<86>,  Next: ライブラリ<89>,  Prev: ビルド<33>,  Up: Python 3 11 0 beta 1

1.24.35.6 Core and Builtins
...........................

   - bpo-36819(1): Fix crashes in built-in encoders with error handlers
     that return position less or equal than the starting position of
     non-encodable characters.

   - bpo-34093(2): ‘marshal.dumps()’ uses ‘FLAG_REF’ for all interned
     strings.  This makes output more deterministic and helps
     reproducible build.

   - bpo-26579(3): Added ‘object.__getstate__’ which provides the
     default implementation of the ‘__getstate__()’ method.

     Copying and pickling instances of subclasses of builtin types
     bytearray, set, frozenset, collections.OrderedDict,
     collections.deque, weakref.WeakSet, and datetime.tzinfo now copies
     and pickles instance attributes implemented as slots.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36819

   (2) https://bugs.python.org/issue?@action=redirect&bpo=34093

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26579


File: python.info,  Node: ライブラリ<89>,  Next: ドキュメント<29>,  Prev: Core and Builtins<86>,  Up: Python 3 11 0 beta 1

1.24.35.7 ライブラリ
....................

   - gh-87901(1): Add the 'encoding' parameter to *note os.popen(): 31a.

   - gh-90997(2): Fix an issue where *note dis: 3c. utilities may
     interpret populated inline cache entries as valid instructions.

   - gh-92332(3): Deprecate *note typing.Text: 360. (removal of the
     class is currently not planned).  Patch by Alex Waygood.

   - gh-78157(4): Deprecate nested classes in enum definitions becoming
     members - in 3.13 they will be normal classes; add ‘member’ and
     ‘nonmember’ functions to allow control over results now.

   - gh-92356(5): Fixed a performance regression in ctypes function
     calls.

   - gh-90997(6): Show the actual named values stored in inline caches
     when ‘show_caches=True’ is passed to *note dis: 3c. utilities.

   - gh-92301(7): Prefer ‘close_range()’ to iterating over procfs for
     file descriptor closing in *note subprocess: dc. for better
     performance.

   - gh-67248(8): Sort the miscellaneous topics in Cmd.do_help()

   - gh-92210(9): Port ‘socket.__init__’ to Argument Clinic.  Patch by
     Cinder.

   - gh-80010(10): Add support for generalized ISO 8601 parsing to *note
     datetime.datetime.fromisoformat(): 82a, *note
     datetime.date.fromisoformat(): 828. and *note
     datetime.time.fromisoformat(): 829.  Patch by Paul Ganssle.

   - gh-92118(11): Fix a 3.11 regression in *note contextmanager():
     141b, which caused it to propagate exceptions with incorrect
     tracebacks.

   - gh-90887(12): Adding ‘COPYFILE_STAT’, ‘COPYFILE_ACL’ and
     ‘COPYFILE_XATTR’ constants for ‘os.fcopyfile()’ available in macOs.

   - gh-91215(13): For *note @~dataclasses.dataclass: 4e1, add
     'weakref_slot'.  The new parameter defaults to ‘False’.  If true,
     and if ‘slots=True’, add a slot named ‘"__weakref__"’, which will
     allow instances to be weakref'd.  Contributed by Eric V. Smith

   - gh-85984(14): New function os.login_tty() for Unix.

   - gh-92128(15): Add *note __class_getitem__(): 943. to *note
     logging.LoggerAdapter: 150d. and *note logging.StreamHandler: 1411,
     allowing them to be parameterized at runtime.  Patch by Alex
     Waygood.

   - gh-92049(16): Forbid pickling constants ‘re._constants.SUCCESS’
     etc.  Previously, pickling did not fail, but the result could not
     be unpickled.

   - gh-92062(17): *note inspect.Parameter: 4e4. now raises *note
     ValueError: 2ec. if ‘name’ is a keyword, in addition to the
     existing check that it is an identifier.

   - gh-87390(18): Add an ‘__unpacked__’ attribute to *note
     types.GenericAlias: 9ec.  Patch by Jelle Zijlstra.

   - gh-88089(19): Add support for generic *note typing.NamedTuple: 331.

   - gh-91996(20): New http.HTTPMethod enum to represent all the
     available HTTP request methods in a convenient way

   - gh-91984(21): Modified test strings in test_argparse.py to not
     contain trailing spaces before end of line.

   - gh-91952(22): Add ‘encoding="locale"’ support to
     ‘TextIOWrapper.reconfigure()’.

   - gh-91954(23): Add 'encoding' and 'errors' arguments to *note
     subprocess.getoutput(): 11c5. and *note
     subprocess.getstatusoutput(): 11c6.

   - bpo-47029(24): Always close the read end of the pipe used by *note
     multiprocessing.Queue: 1b89. 'after' the last write of buffered
     data to the write end of the pipe to avoid *note BrokenPipeError:
     1267. at garbage collection and at *note
     multiprocessing.Queue.close(): 1b8a. calls.  Patch by Géry Ogam.

   - gh-91928(25): Add ‘datetime.UTC’ alias for ‘datetime.timezone.utc’.

     Patch by Kabir Kwatra.

   - gh-68966(26): The ‘mailcap’ module is now deprecated and will be
     removed in Python 3.13.  See PEP 594(27) for the rationale and the
     *note mimetypes: 93. module for an alternative.  Patch by Victor
     Stinner.

   - gh-91401(28): Provide a way to disable *note subprocess: dc. use of
     ‘vfork()’ just in case it is ever needed and document the existing
     mechanism for ‘posix_spawn()’.

   - gh-64783(29): Fix *note signal.NSIG: 1b8b. value on FreeBSD to
     accept signal numbers greater than 32, like ‘signal.SIGRTMIN’ and
     ‘signal.SIGRTMAX’.  Patch by Victor Stinner.

   - gh-91910(30): Add missing f prefix to f-strings in error messages
     from the *note multiprocessing: 98. and *note asyncio: b. modules.

   - gh-91860(31): Add *note typing.dataclass_transform(): 6fb,
     implementing PEP 681(32).  Patch by Jelle Zijlstra.

   - gh-91832(33): Add ‘required’ attribute to *note argparse.Action:
     1b8c. repr output.

   - gh-91827(34): In the *note tkinter: f6. module add method
     ‘info_patchlevel()’ which returns the exact version of the Tcl
     library as a named tuple similar to *note sys.version_info: 8af.

   - gh-84461(35): Add *note -enable-wasm-pthreads: 1b8d. to enable
     pthreads support for WASM builds.  ‘Emscripten/node’ no longer has
     threading enabled by default.  Include additional file systems.

   - gh-91821(36): Fix unstable ‘test_from_tuple’ test in
     ‘test_decimal.py’.

   - gh-91217(37): Deprecate the xdrlib module.

   - gh-91217(38): Deprecate the uu module.

   - gh-91760(39): More strict rules will be applied for numerical group
     references and group names in regular expressions.  For now, a
     deprecation warning is emitted for group references and group names
     which will be errors in future Python versions.

   - gh-84461(40): Add provisional *note sys._emscripten_info: 1b8e.
     named tuple with build-time and run-time information about
     Emscripten platform.

   - gh-90623(41): *note signal.raise_signal(): 1b8f. and *note
     os.kill(): 157f. now check immediately for pending signals.  Patch
     by Victor Stinner.

   - gh-91734(42): Fix OSS audio support on Solaris.

   - gh-90633(43): Include the passed value in the exception thrown by
     *note typing.assert_never(): 8b6.  Patch by Jelle Zijlstra.

   - gh-91700(44): Compilation of regular expression containing a
     conditional expression ‘(?(group)...)’ now raises an appropriate
     ‘re.error’ if the group number refers to not defined group.
     Previously an internal RuntimeError was raised.

   - gh-91231(45): Add an optional keyword 'shutdown_timeout' parameter
     to the ‘multiprocessing.BaseManager’ constructor.  Kill the process
     if terminate() takes longer than the timeout.  Patch by Victor
     Stinner.

   - gh-91621(46): Fix *note typing.get_type_hints(): 8c0. for *note
     collections.abc.Callable: 9eb.  Patch by Shantanu Jain.

   - gh-90568(47): Parsing ‘\N’ escapes of Unicode Named Character
     Sequences in a *note regular expression: be. raises now ‘re.error’
     instead of ‘TypeError’.

   - gh-91670(48): Remove deprecated ‘SO’ config variable in *note
     sysconfig: e1.

   - gh-91217(49): Deprecate the telnetlib module.

   - gh-91217(50): Deprecate the sunau module.

   - gh-91217(51): Deprecate the spwd module.

   - gh-91217(52): Deprecate the sndhdr module, as well as inline needed
     functionality for ‘email.mime.MIMEAudio’.

   - gh-91616(53): *note re: be. module, fix *note fullmatch(): 1188.
     mismatch when using Atomic Grouping or Possessive Quantifiers.

   - gh-91217(54): Deprecate the 'pipes' module.

   - gh-91217(55): Deprecate the ossaudiodev module.

   - bpo-47256(56): *note re: be. module, limit the maximum capturing
     group to 1,073,741,823 in 64-bit build, this increases the depth of
     backtracking.

   - gh-91217(57): Deprecate the nis module.

   - gh-91595(58): Fix the comparison of character and integer inside
     ‘Tools.gdb.libpython.write_repr()’.  Patch by Yu Liu.

   - gh-74166(59): Add option to raise all errors from *note
     create_connection(): 882. in an *note ExceptionGroup: 4d2. when it
     fails to create a connection.  The default remains to raise only
     the last error that had occurred when multiple addresses were
     tried.

   - gh-91487(60): Optimize asyncio UDP speed, over 100 times faster
     when transferring a large file.

   - gh-91575(61): Update case-insensitive matching in the *note re: be.
     module to the latest Unicode version.

   - gh-90622(62): In ‘concurrent.futures.process.ProcessPoolExecutor’
     disallow the "fork" multiprocessing start method when the new
     ‘max_tasks_per_child’ feature is used as the mix of threads+fork
     can hang the child processes.  Default to using the safe "spawn"
     start method in that circumstance if no ‘mp_context’ was supplied.

   - gh-89022(63): In *note sqlite3: d4, ‘SQLITE_MISUSE’ result codes
     are now mapped to *note InterfaceError: 88d. instead of *note
     ProgrammingError: 305.  Also, more accurate exceptions are raised
     when binding parameters fail.  Patch by Erlend E. Aasland.

   - gh-91526(64): Stop calling ‘os.device_encoding(file.fileno())’ in
     ‘TextIOWrapper’.  It was complex, never documented, and didn't work
     for most cases.  (Patch by Inada Naoki.)

   - gh-88116(65): Change the frame-related functions in the *note
     inspect: 82. module to return a regular object (that is backwards
     compatible with the old tuple-like interface) that include the
     extended PEP 657(66) position information (end line number, column
     and end column).  The affected functions are: *note
     inspect.getframeinfo(): 85f, *note inspect.getouterframes(): 860,
     *note inspect.getinnerframes(): 861, *note inspect.stack(): 862.
     and *note inspect.trace(): 863.  Patch by Pablo Galindo.

   - gh-69093(67): Add indexing and slicing support to *note
     sqlite3.Blob: 892.  Patch by Aviv Palivoda and Erlend E. Aasland.

   - gh-69093(68): Add *note context manager: 1e1. support to *note
     sqlite3.Blob: 892.  Patch by Aviv Palivoda and Erlend E. Aasland.

   - gh-91217(69): Deprecate nntplib.

   - gh-91217(70): Deprecate msilib.

   - gh-91404(71): Improve the performance of *note re: be. matching by
     using computed gotos (or "threaded code") on supported platforms
     and removing expensive pointer indirections.

   - gh-91217(72): Deprecate the imghdr module.

   - gh-91217(73): Deprecate the crypt module.

   - gh-91276(74): Make space for longer opcodes in *note dis: 3c.
     output.

   - bpo-47000(75): Make ‘TextIOWrapper’ uses locale encoding when
     ‘encoding="locale"’ is specified even in UTF-8 mode.

   - gh-91230(76): *note warnings.catch_warnings(): 179. now accepts
     arguments for *note warnings.simplefilter(): 8d0, providing a more
     concise way to locally ignore warnings or convert them to errors.

   - gh-91217(77): Deprecate the chunk module.

   - gh-91498(78): Add the ‘TCP_CONNECTION_INFO’ option (available on
     macOS) to *note socket: d1.

   - bpo-47260(79): Fix ‘os.closerange()’ potentially being a no-op in a
     Linux seccomp sandbox.

   - bpo-47087(80): Implement ‘typing.Required’ and ‘typing.NotRequired’
     ( PEP 655(81)).  Patch by David Foster and Jelle Zijlstra.

   - bpo-47061(82): Deprecate cgi and cgitb.

   - bpo-47061(83): Deprecate audioop.

   - bpo-47000(84): Add *note locale.getencoding(): 329. to get the
     current locale encoding.  It is similar to
     ‘locale.getpreferredencoding(False)’ but ignores the *note Python
     UTF-8 Mode: 866.

   - bpo-42012(85): Add *note wsgiref.types: 122, containing
     WSGI-specific types for static type checking.

   - bpo-47227(86): Suppress expression chaining for more *note re: be.
     parsing errors.

   - bpo-47211(87): Remove undocumented and never working function
     ‘re.template()’ and flag ‘re.TEMPLATE’.  This was later reverted in
     3.11.0b2 and deprecated instead.

   - bpo-47135(88): *note decimal.localcontext(): 159e. now accepts
     context attributes via keyword arguments

   - bpo-43323(89): Fix errors in the *note email: 3f. module if the
     charset itself contains undecodable/unencodable characters.

   - bpo-46841(90): Disassembly of quickened code.

   - bpo-46681(91): Forward gzip.compress() compresslevel to zlib.

   - bpo-45100(92): Add *note typing.get_overloads(): 8bd. and *note
     typing.clear_overloads(): 8be.  Patch by Jelle Zijlstra.

   - bpo-44807(93): *note typing.Protocol: 56b. no longer silently
     replaces ‘__init__()’ methods defined on subclasses.  Patch by
     Adrian Garcia Badaracco.

   - bpo-46787(94): Fix *note concurrent.futures.ProcessPoolExecutor:
     1d6. exception memory leak

   - bpo-46720(95): Add support for path-like objects to *note
     multiprocessing.set_executable(): 1b90. for Windows to be on a par
     with Unix-like systems.  Patch by Géry Ogam.

   - bpo-46696(96): Add ‘SO_INCOMING_CPU’ constant to *note socket: d1.

   - bpo-46053(97): Fix OSS audio support on NetBSD.

   - bpo-45639(98): ‘image/avif’ and ‘image/webp’ were added to *note
     mimetypes: 93.

   - bpo-46285(99): Add command-line option ‘-p’/‘--protocol’ to module
     *note http.server: 76. which specifies the HTTP version to which
     the server is conformant (HTTP/1.1 conformant servers can now be
     run from the command-line interface of module *note http.server:
     76.).  Patch by Géry Ogam.

   - bpo-44791(100): Accept ellipsis as the last argument of *note
     typing.Concatenate: 9c7.

   - bpo-46547(101): Remove variables leaking into ‘pydoc.Helper’ class
     namespace.

   - bpo-46415(102): Fix ipaddress.ip_{address,interface,network}
     raising TypeError instead of ValueError if given invalid tuple as
     address parameter.

   - bpo-46075(103): ‘CookieJar’ with ‘DefaultCookiePolicy’ now can
     process cookies from localhost with domain=localhost explicitly
     specified in Set-Cookie header.

   - bpo-45995(104): Add a "z" option to the string formatting
     specification that coerces negative zero floating-point values to
     positive zero after rounding to the format precision.  Contributed
     by John Belmonte.

   - bpo-26175(105): Fully implement the *note io.BufferedIOBase: 8a3.
     or *note io.TextIOBase: 8a4. interface for *note
     tempfile.SpooledTemporaryFile: 8a2. objects.  This lets them work
     correctly with higher-level layers (like compression modules).
     Patch by Carey Metcalfe.

   - bpo-45138(106): Fix a regression in the *note sqlite3: d4. trace
     callback where bound parameters were not expanded in the passed
     statement string.  The regression was introduced in Python 3.10 by
     bpo-40318(107).  Patch by Erlend E. Aasland.

   - bpo-44863(108): Allow *note TypedDict: 332. subclasses to also
     include *note Generic: 17b6. as a base class in class based syntax.
     Thereby allowing the user to define a generic ‘TypedDict’, just
     like a user-defined generic but with ‘TypedDict’ semantics.

   - bpo-44587(109): Fix BooleanOptionalAction to not automatically add
     a default string.  If a default string is desired, use a formatter
     to add it.

   - bpo-43827(110): All positional-or-keyword parameters to
     ‘ABCMeta.__new__’ are now positional-only to avoid conflicts with
     keyword arguments to be passed to ‘__init_subclass__()’.

   - bpo-43218(111): Prevent creation of a venv whose path contains the
     PATH separator.  This could affect the usage of the activate
     script.  Patch by Dustin Rodrigues.

   - bpo-38435(112): Add a ‘process_group’ parameter to *note
     subprocess.Popen: 4b7. to help move more things off of the unsafe
     ‘preexec_fn’ parameter.

   - bpo-42066(113): Fix cookies getting sorted in
     ‘CookieJar.__iter__()’ which is an extra behavior and not mentioned
     in RFC 2965 or Netscape cookie protocol.  Now the cookies in
     ‘CookieJar’ follows the order of the ‘Set-Cookie’ header.  Patch by
     Iman Kermani.

   - bpo-40617(114): Add *note create_window_function(): 890. to *note
     sqlite3.Connection: 54d. for creating aggregate window functions.
     Patch by Erlend E. Aasland.

   - bpo-40676(115): Convert *note csv: 2d. to use Argument Clinic for
     *note csv.field_size_limit(): 1b91, *note csv.get_dialect(): 1b92,
     *note csv.unregister_dialect(): 1b93. and *note
     csv.list_dialects(): 1b94.

   - bpo-39716(116): Raise an ‘ArgumentError’ when the same subparser
     name is added twice to an ‘argparse.ArgumentParser’.  This is
     consistent with the (default) behavior when the same option string
     is added twice to an ‘ArgumentParser’.

   - bpo-36073(117): Raise *note ProgrammingError: 305. instead of
     segfaulting on recursive usage of cursors in *note sqlite3: d4.
     converters.  Patch by Sergey Fedoseev.

   - bpo-34975(118): Adds a ‘start_tls()’ method to ‘StreamWriter’,
     which upgrades the connection with TLS using the given *note
     SSLContext: 357.

   - bpo-22276(119): *note Path: 266. methods *note glob(): 537. and
     *note rglob(): 538. return only directories if 'pattern' ends with
     a pathname components separator (‘/’ or *note sep: 87a.).  Patch by
     Eisuke Kawashima.

   - bpo-24905(120): Add *note blobopen(): 891. to *note
     sqlite3.Connection: 54d.  *note sqlite3.Blob: 892. allows
     incremental I/O operations on blobs.  Patch by Aviv Palivoda and
     Erlend E. Aasland.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/87901

   (2) https://github.com/python/cpython/issues/90997

   (3) https://github.com/python/cpython/issues/92332

   (4) https://github.com/python/cpython/issues/78157

   (5) https://github.com/python/cpython/issues/92356

   (6) https://github.com/python/cpython/issues/90997

   (7) https://github.com/python/cpython/issues/92301

   (8) https://github.com/python/cpython/issues/67248

   (9) https://github.com/python/cpython/issues/92210

   (10) https://github.com/python/cpython/issues/80010

   (11) https://github.com/python/cpython/issues/92118

   (12) https://github.com/python/cpython/issues/90887

   (13) https://github.com/python/cpython/issues/91215

   (14) https://github.com/python/cpython/issues/85984

   (15) https://github.com/python/cpython/issues/92128

   (16) https://github.com/python/cpython/issues/92049

   (17) https://github.com/python/cpython/issues/92062

   (18) https://github.com/python/cpython/issues/87390

   (19) https://github.com/python/cpython/issues/88089

   (20) https://github.com/python/cpython/issues/91996

   (21) https://github.com/python/cpython/issues/91984

   (22) https://github.com/python/cpython/issues/91952

   (23) https://github.com/python/cpython/issues/91954

   (24) https://bugs.python.org/issue?@action=redirect&bpo=47029

   (25) https://github.com/python/cpython/issues/91928

   (26) https://github.com/python/cpython/issues/68966

   (27) https://peps.python.org/pep-0594/

   (28) https://github.com/python/cpython/issues/91401

   (29) https://github.com/python/cpython/issues/64783

   (30) https://github.com/python/cpython/issues/91910

   (31) https://github.com/python/cpython/issues/91860

   (32) https://peps.python.org/pep-0681/

   (33) https://github.com/python/cpython/issues/91832

   (34) https://github.com/python/cpython/issues/91827

   (35) https://github.com/python/cpython/issues/84461

   (36) https://github.com/python/cpython/issues/91821

   (37) https://github.com/python/cpython/issues/91217

   (38) https://github.com/python/cpython/issues/91217

   (39) https://github.com/python/cpython/issues/91760

   (40) https://github.com/python/cpython/issues/84461

   (41) https://github.com/python/cpython/issues/90623

   (42) https://github.com/python/cpython/issues/91734

   (43) https://github.com/python/cpython/issues/90633

   (44) https://github.com/python/cpython/issues/91700

   (45) https://github.com/python/cpython/issues/91231

   (46) https://github.com/python/cpython/issues/91621

   (47) https://github.com/python/cpython/issues/90568

   (48) https://github.com/python/cpython/issues/91670

   (49) https://github.com/python/cpython/issues/91217

   (50) https://github.com/python/cpython/issues/91217

   (51) https://github.com/python/cpython/issues/91217

   (52) https://github.com/python/cpython/issues/91217

   (53) https://github.com/python/cpython/issues/91616

   (54) https://github.com/python/cpython/issues/91217

   (55) https://github.com/python/cpython/issues/91217

   (56) https://bugs.python.org/issue?@action=redirect&bpo=47256

   (57) https://github.com/python/cpython/issues/91217

   (58) https://github.com/python/cpython/issues/91595

   (59) https://github.com/python/cpython/issues/74166

   (60) https://github.com/python/cpython/issues/91487

   (61) https://github.com/python/cpython/issues/91575

   (62) https://github.com/python/cpython/issues/90622

   (63) https://github.com/python/cpython/issues/89022

   (64) https://github.com/python/cpython/issues/91526

   (65) https://github.com/python/cpython/issues/88116

   (66) https://peps.python.org/pep-0657/

   (67) https://github.com/python/cpython/issues/69093

   (68) https://github.com/python/cpython/issues/69093

   (69) https://github.com/python/cpython/issues/91217

   (70) https://github.com/python/cpython/issues/91217

   (71) https://github.com/python/cpython/issues/91404

   (72) https://github.com/python/cpython/issues/91217

   (73) https://github.com/python/cpython/issues/91217

   (74) https://github.com/python/cpython/issues/91276

   (75) https://bugs.python.org/issue?@action=redirect&bpo=47000

   (76) https://github.com/python/cpython/issues/91230

   (77) https://github.com/python/cpython/issues/91217

   (78) https://github.com/python/cpython/issues/91498

   (79) https://bugs.python.org/issue?@action=redirect&bpo=47260

   (80) https://bugs.python.org/issue?@action=redirect&bpo=47087

   (81) https://peps.python.org/pep-0655/

   (82) https://bugs.python.org/issue?@action=redirect&bpo=47061

   (83) https://bugs.python.org/issue?@action=redirect&bpo=47061

   (84) https://bugs.python.org/issue?@action=redirect&bpo=47000

   (85) https://bugs.python.org/issue?@action=redirect&bpo=42012

   (86) https://bugs.python.org/issue?@action=redirect&bpo=47227

   (87) https://bugs.python.org/issue?@action=redirect&bpo=47211

   (88) https://bugs.python.org/issue?@action=redirect&bpo=47135

   (89) https://bugs.python.org/issue?@action=redirect&bpo=43323

   (90) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (91) https://bugs.python.org/issue?@action=redirect&bpo=46681

   (92) https://bugs.python.org/issue?@action=redirect&bpo=45100

   (93) https://bugs.python.org/issue?@action=redirect&bpo=44807

   (94) https://bugs.python.org/issue?@action=redirect&bpo=46787

   (95) https://bugs.python.org/issue?@action=redirect&bpo=46720

   (96) https://bugs.python.org/issue?@action=redirect&bpo=46696

   (97) https://bugs.python.org/issue?@action=redirect&bpo=46053

   (98) https://bugs.python.org/issue?@action=redirect&bpo=45639

   (99) https://bugs.python.org/issue?@action=redirect&bpo=46285

   (100) https://bugs.python.org/issue?@action=redirect&bpo=44791

   (101) https://bugs.python.org/issue?@action=redirect&bpo=46547

   (102) https://bugs.python.org/issue?@action=redirect&bpo=46415

   (103) https://bugs.python.org/issue?@action=redirect&bpo=46075

   (104) https://bugs.python.org/issue?@action=redirect&bpo=45995

   (105) https://bugs.python.org/issue?@action=redirect&bpo=26175

   (106) https://bugs.python.org/issue?@action=redirect&bpo=45138

   (107) https://bugs.python.org/issue?@action=redirect&bpo=40318

   (108) https://bugs.python.org/issue?@action=redirect&bpo=44863

   (109) https://bugs.python.org/issue?@action=redirect&bpo=44587

   (110) https://bugs.python.org/issue?@action=redirect&bpo=43827

   (111) https://bugs.python.org/issue?@action=redirect&bpo=43218

   (112) https://bugs.python.org/issue?@action=redirect&bpo=38435

   (113) https://bugs.python.org/issue?@action=redirect&bpo=42066

   (114) https://bugs.python.org/issue?@action=redirect&bpo=40617

   (115) https://bugs.python.org/issue?@action=redirect&bpo=40676

   (116) https://bugs.python.org/issue?@action=redirect&bpo=39716

   (117) https://bugs.python.org/issue?@action=redirect&bpo=36073

   (118) https://bugs.python.org/issue?@action=redirect&bpo=34975

   (119) https://bugs.python.org/issue?@action=redirect&bpo=22276

   (120) https://bugs.python.org/issue?@action=redirect&bpo=24905


File: python.info,  Node: ドキュメント<29>,  Next: テスト<28>,  Prev: ライブラリ<89>,  Up: Python 3 11 0 beta 1

1.24.35.8 ドキュメント
......................

   - gh-91888(1): Add a new ‘gh’ role to the documentation to link to
     GitHub issues.

   - gh-91783(2): Document security issues concerning the use of the
     function *note shutil.unpack_archive(): 696.

   - gh-91547(3): Remove "Undocumented modules" page.

   - gh-91298(4): In ‘importlib.resources.abc’, refined the
     documentation of the Traversable Protocol, applying changes from
     importlib_resources 5.7.1.

   - bpo-44347(5): Clarify the meaning of 'dirs_exist_ok', a kwarg of
     *note shutil.copytree(): c1e.

   - bpo-36329(6): Remove 'make -C Doc serve' in favour of 'make -C Doc
     htmlview'

   - bpo-47189(7): Add a What's New in Python 3.11 entry for the Faster
     CPython project.  Documentation by Ken Jin and Kumar Aditya.

   - bpo-38668(8): Update the introduction to documentation for *note
     os.path: a6. to remove warnings that became irrelevant after the
     implementations of PEP 383(9) and PEP 529(10).

   - bpo-47115(11): The documentation now lists which members of C
     structs are part of the *note Limited API/Stable ABI: 775.

   - bpo-46962(12): All docstrings in code snippets are now wrapped into
     *note PyDoc_STR: 1b96. to follow the guideline of PEP 7's
     Documentation Strings paragraph(13).  Patch by Oleg Iarygin.

   - bpo-26792(14): Improve the docstrings of *note runpy.run_module():
     1b97. and *note runpy.run_path(): 4a4.  Original patch by Andrew
     Brezovsky.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/91888

   (2) https://github.com/python/cpython/issues/91783

   (3) https://github.com/python/cpython/issues/91547

   (4) https://github.com/python/cpython/issues/91298

   (5) https://bugs.python.org/issue?@action=redirect&bpo=44347

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36329

   (7) https://bugs.python.org/issue?@action=redirect&bpo=47189

   (8) https://bugs.python.org/issue?@action=redirect&bpo=38668

   (9) https://peps.python.org/pep-0383/

   (10) https://peps.python.org/pep-0529/

   (11) https://bugs.python.org/issue?@action=redirect&bpo=47115

   (12) https://bugs.python.org/issue?@action=redirect&bpo=46962

   (13) https://peps.python.org/pep-0007/#documentation-strings

   (14) https://bugs.python.org/issue?@action=redirect&bpo=26792


File: python.info,  Node: テスト<28>,  Next: ビルド<34>,  Prev: ドキュメント<29>,  Up: Python 3 11 0 beta 1

1.24.35.9 テスト
................

   - gh-92169(1): Use ‘warnings_helper.import_deprecated()’ to import
     deprecated modules uniformly in tests.  Patch by Hugo van Kemenade.

   - gh-84461(2): When multiprocessing is enabled, libregrtest can now
     use a Python executable other than ‘sys.executable’ via the
     ‘--python’ flag.

   - gh-91904(3): Fix initialization of ‘PYTHONREGRTEST_UNICODE_GUARD’
     which prevented running regression tests on non-UTF-8 locale.

   - gh-91752(4): Added @requires_zlib to
     test.test_tools.test_freeze.TestFreeze.

   - gh-91607(5): Fix ‘test_concurrent_futures’ to test the correct
     multiprocessing start method context in several cases where the
     test logic mixed this up.

   - bpo-40280(6): Threading tests are now skipped on WASM targets
     without pthread support.

   - bpo-47109(7): Test for ‘ctypes.macholib.dyld’,
     ‘ctypes.macholib.dylib’, and ‘ctypes.macholib.framework’ are
     brought from manual pre-*note unittest: 10c. times to ‘ctypes.test’
     location and structure.  Patch by Oleg Iarygin.

   - bpo-29890(8): Add tests for *note ipaddress.IPv4Interface: 1b99.
     and *note ipaddress.IPv6Interface: 1b9a. construction with tuple
     arguments.  Original patch and tests by louisom.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/92169

   (2) https://github.com/python/cpython/issues/84461

   (3) https://github.com/python/cpython/issues/91904

   (4) https://github.com/python/cpython/issues/91752

   (5) https://github.com/python/cpython/issues/91607

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (7) https://bugs.python.org/issue?@action=redirect&bpo=47109

   (8) https://bugs.python.org/issue?@action=redirect&bpo=29890


File: python.info,  Node: ビルド<34>,  Next: Windows<30>,  Prev: テスト<28>,  Up: Python 3 11 0 beta 1

1.24.35.10 ビルド
.................

   - gh-89452(1): gdbm-compat is now preferred over ndbm if both are
     available on the system.  This allows avoiding the problematic
     ndbm.h on macOS.

   - gh-91731(2): Python is now built with ‘-std=c11’ compiler option,
     rather than ‘-std=c99’.  Patch by Victor Stinner.

   - bpo-47152(3): Add script and make target for generating
     ‘sre_constants.h’.

   - bpo-47103(4): Windows ‘PGInstrument’ builds now copy a required DLL
     into the output directory, making it easier to run the profile
     stage of a PGO build.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89452

   (2) https://github.com/python/cpython/issues/91731

   (3) https://bugs.python.org/issue?@action=redirect&bpo=47152

   (4) https://bugs.python.org/issue?@action=redirect&bpo=47103


File: python.info,  Node: Windows<30>,  Next: macOS<21>,  Prev: ビルド<34>,  Up: Python 3 11 0 beta 1

1.24.35.11 Windows
..................

   - bpo-46907(1): Update Windows installer to use SQLite 3.38.3.

   - bpo-47239(2): Fixed -list and -list-paths output for *note Python
     install manager: 7da. when used in an active virtual environment.

   - bpo-46907(3): Update Windows installer to use SQLite 3.38.2.

   - bpo-46785(4): Fix race condition between *note os.stat(): 26d. and
     unlinking a file on Windows, by using errors codes returned by
     ‘FindFirstFileW()’ when appropriate in ‘win32_xstat_impl’.

   - bpo-40859(5): Update Windows build to use xz-5.2.5

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46907

   (2) https://bugs.python.org/issue?@action=redirect&bpo=47239

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46907

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46785

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40859


File: python.info,  Node: macOS<21>,  Next: Tools/Demos<25>,  Prev: Windows<30>,  Up: Python 3 11 0 beta 1

1.24.35.12 macOS
................

   - bpo-46907(1): Update macOS installer to SQLite 3.38.4.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46907


File: python.info,  Node: Tools/Demos<25>,  Next: C API<30>,  Prev: macOS<21>,  Up: Python 3 11 0 beta 1

1.24.35.13 Tools/Demos
......................

   - gh-91583(1): Fix regression in the code generated by Argument
     Clinic for functions with the ‘defining_class’ parameter.

   - gh-91575(2): Add script ‘Tools/scripts/generate_re_casefix.py’ and
     the make target ‘regen-re’ for generating additional data for
     case-insensitive matching according to the current Unicode version.

   - gh-91551(3): Remove the ancient Pynche color editor.  It has moved
     to ‘https://gitlab.com/warsaw/pynche’

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/91583

   (2) https://github.com/python/cpython/issues/91575

   (3) https://github.com/python/cpython/issues/91551


File: python.info,  Node: C API<30>,  Prev: Tools/Demos<25>,  Up: Python 3 11 0 beta 1

1.24.35.14 C API
................

   - gh-88279(1): Deprecate the C functions: ‘PySys_SetArgv()’,
     ‘PySys_SetArgvEx()’, ‘PySys_SetPath()’.  Patch by Victor Stinner.

   - gh-92154(2): Added the *note PyCode_GetCode(): 97c. function.  This
     function does the equivalent of the Python code
     ‘getattr(code_object, 'co_code')’.

   - gh-92173(3): Fix the ‘closure’ argument to *note
     PyEval_EvalCodeEx(): 1ada.

   - gh-91320(4): Fix C++ compiler warnings about "old-style cast" (‘g++
     -Wold-style-cast’) in the Python C API. Use C++
     ‘reinterpret_cast<>’ and ‘static_cast<>’ casts when the Python C
     API is used in C++.  Patch by Victor Stinner.

   - gh-80527(5): Mark functions as deprecated by PEP 623(6):
     ‘PyUnicode_AS_DATA()’, ‘PyUnicode_AS_UNICODE()’,
     ‘PyUnicode_GET_DATA_SIZE()’, ‘PyUnicode_GET_SIZE()’.  Patch by
     Victor Stinner.

   - gh-91768(7): *note Py_REFCNT(): 2cf, *note Py_TYPE(): 3c9, *note
     Py_SIZE(): 985. and *note Py_IS_TYPE(): 1ba0. functions argument
     type is now ‘PyObject*’, rather than ‘const PyObject*’.  Patch by
     Victor Stinner.

   - gh-91020(8): Add ‘PyBytes_Type.tp_alloc’ to initialize
     ‘PyBytesObject.ob_shash’ for bytes subclasses.

   - bpo-40421(9): Add ‘PyFrame_GetLasti’ C-API function to access frame
     object's ‘f_lasti’ attribute safely from C code.

   - bpo-35134(10): Remove the ‘Include/code.h’ header file.  C
     extensions should only include the main ‘<Python.h>’ header file.
     Patch by Victor Stinner.

   - bpo-47169(11): *note PyOS_CheckStack(): 1ba1. is now exported in
     the Stable ABI on Windows.

   - bpo-47169(12): *note PyThread_get_thread_native_id(): 1ba2. is
     excluded from the stable ABI on platforms where it doesn't exist
     (like Solaris).

   - bpo-46343(13): Added *note PyErr_GetHandledException(): 973. and
     *note PyErr_SetHandledException(): 974. as simpler alternatives to
     *note PyErr_GetExcInfo(): 976. and *note PyErr_SetExcInfo(): 975.

     They are included in the stable ABI.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/88279

   (2) https://github.com/python/cpython/issues/92154

   (3) https://github.com/python/cpython/issues/92173

   (4) https://github.com/python/cpython/issues/91320

   (5) https://github.com/python/cpython/issues/80527

   (6) https://peps.python.org/pep-0623/

   (7) https://github.com/python/cpython/issues/91768

   (8) https://github.com/python/cpython/issues/91020

   (9) https://bugs.python.org/issue?@action=redirect&bpo=40421

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35134

   (11) https://bugs.python.org/issue?@action=redirect&bpo=47169

   (12) https://bugs.python.org/issue?@action=redirect&bpo=47169

   (13) https://bugs.python.org/issue?@action=redirect&bpo=46343


File: python.info,  Node: Python 3 11 0 alpha 7,  Next: Python 3 11 0 alpha 6,  Prev: Python 3 11 0 beta 1,  Up: 変更履歴

1.24.36 Python 3.11.0 alpha 7
-----------------------------

'Release date: 2022-04-05'

* Menu:

* Core and Builtins: Core and Builtins<87>.
* ライブラリ: ライブラリ<90>.
* Core and Builtins: Core and Builtins<88>.
* ライブラリ: ライブラリ<91>.
* Core and Builtins: Core and Builtins<89>.
* ライブラリ: ライブラリ<92>.
* ドキュメント: ドキュメント<30>.
* テスト: テスト<29>.
* ビルド: ビルド<35>.
* Windows: Windows<31>.
* macOS: macOS<22>.
* Tools/Demos: Tools/Demos<26>.
* C API: C API<31>.


File: python.info,  Node: Core and Builtins<87>,  Next: ライブラリ<90>,  Up: Python 3 11 0 alpha 7

1.24.36.1 Core and Builtins
...........................

   - bpo-47212(1): Raise *note IndentationError: 1750. instead of *note
     SyntaxError: 18e. for a bare ‘except’ with no following indent.
     Improve *note SyntaxError: 18e. locations for an un-parenthesized
     generator used as arguments.  Patch by Matthieu Dartiailh.

   - bpo-47186(2): Replace ‘JUMP_IF_NOT_EG_MATCH’ by *note
     CHECK_EG_MATCH: 911. + jump.

   - bpo-47176(3): Emscripten builds cannot handle signals in the usual
     way due to platform limitations.  Python can now handle signals.
     To use, set Module.Py_EmscriptenSignalBuffer to be a single byte
     SharedArrayBuffer and set Py_EMSCRIPTEN_SIGNAL_HANDLING to 1.
     Writing a number into the SharedArrayBuffer will cause the
     corresponding signal to be raised into the Python thread.

   - bpo-47186(4): Replace ‘JUMP_IF_NOT_EXC_MATCH’ by *note
     CHECK_EXC_MATCH: 919. + jump.

   - bpo-47120(5): Replace the absolute jump opcode *note
     JUMP_NO_INTERRUPT: 1ba5. by the relative *note
     JUMP_BACKWARD_NO_INTERRUPT: 90e.

   - bpo-46841(6): Avoid unnecessary allocations when comparing code
     objects.

   - bpo-47182(7): Fix a crash when using a named unicode character like
     ‘"\N{digit nine}"’ after the main interpreter has been initialized
     a second time.

   - bpo-47162(8): WebAssembly cannot deal with bad function pointer
     casts (different count or types of arguments).  Python can now use
     call trampolines to mitigate the problem.  Define
     ‘PY_CALL_TRAMPOLINE’ to enable call trampolines.

   - bpo-46775(9): Some Windows system error codes(>= 10000) are now
     mapped into the correct errno and may now raise a subclass of *note
     OSError: 2c0.  Patch by Donghee Na.

   - bpo-47129(10): Improve error messages in f-string syntax errors
     concerning empty expressions.

   - bpo-47117(11): Fix a crash if we fail to decode characters in
     interactive mode if the tokenizer buffers are uninitialized.  Patch
     by Pablo Galindo.

   - bpo-47127(12): Speed up calls to c functions with keyword arguments
     by 25% with specialization.  Patch by Kumar Aditya.

   - bpo-47120(13): Replaced ‘JUMP_ABSOLUTE’ by the relative jump *note
     JUMP_BACKWARD: 91a.

   - bpo-42197(14): ‘PyFrame_FastToLocalsWithError()’ and
     ‘PyFrame_LocalsToFast()’ are no longer called during profiling nor
     tracing.  C code can access the ‘f_locals’ attribute of *note
     PyFrameObject: 98c. by calling *note PyFrame_GetLocals(): 661.

   - bpo-47070(15): Improve performance of ‘array_inplace_repeat’ by
     reducing the number of invocations of ‘memcpy’.  Refactor the
     ‘repeat’ and inplace ‘repeat’ methods of ‘array’, ‘bytes’,
     ‘bytearray’ and ‘unicodeobject’ to use the common
     ‘_PyBytes_Repeat’.

   - bpo-47053(16): Reduce de-optimization in the specialized
     ‘BINARY_OP_INPLACE_ADD_UNICODE’ opcode.

   - bpo-47045(17): Remove the ‘f_state’ field from the
     _PyInterpreterFrame struct.  Add the ‘owner’ field to the
     _PyInterpreterFrame struct to make ownership explicit to simplify
     clearing and deallocing frames and generators.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=47212

   (2) https://bugs.python.org/issue?@action=redirect&bpo=47186

   (3) https://bugs.python.org/issue?@action=redirect&bpo=47176

   (4) https://bugs.python.org/issue?@action=redirect&bpo=47186

   (5) https://bugs.python.org/issue?@action=redirect&bpo=47120

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (7) https://bugs.python.org/issue?@action=redirect&bpo=47182

   (8) https://bugs.python.org/issue?@action=redirect&bpo=47162

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46775

   (10) https://bugs.python.org/issue?@action=redirect&bpo=47129

   (11) https://bugs.python.org/issue?@action=redirect&bpo=47117

   (12) https://bugs.python.org/issue?@action=redirect&bpo=47127

   (13) https://bugs.python.org/issue?@action=redirect&bpo=47120

   (14) https://bugs.python.org/issue?@action=redirect&bpo=42197

   (15) https://bugs.python.org/issue?@action=redirect&bpo=47070

   (16) https://bugs.python.org/issue?@action=redirect&bpo=47053

   (17) https://bugs.python.org/issue?@action=redirect&bpo=47045


File: python.info,  Node: ライブラリ<90>,  Next: Core and Builtins<88>,  Prev: Core and Builtins<87>,  Up: Python 3 11 0 alpha 7

1.24.36.2 ライブラリ
....................

   - bpo-46968(1): Check for the existence of the "sys/auxv.h" header in
     *note faulthandler: 5c. to avoid compilation problems in systems
     where this header doesn't exist.  Patch by Pablo Galindo

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46968


File: python.info,  Node: Core and Builtins<88>,  Next: ライブラリ<91>,  Prev: ライブラリ<90>,  Up: Python 3 11 0 alpha 7

1.24.36.3 Core and Builtins
...........................

   - bpo-46329(1): Use low bit of ‘LOAD_GLOBAL’ to indicate whether to
     push a ‘NULL’ before the global.  Helps streamline the call
     sequence a bit.

   - bpo-46841(2): Quicken bytecode in-place by storing it as part of
     the corresponding ‘PyCodeObject’.

   - bpo-47012(3): Speed up iteration of *note bytes: 192. and *note
     bytearray: 344. by 30%.  Patch by Kumar Aditya.

   - bpo-47009(4): Improved the performance of *note list.append(): 8dc.
     and list comprehensions by optimizing for the common case, where no
     resize is needed.  Patch by Dennis Sweeney.

   - bpo-47005(5): Improve performance of ‘bytearray_repeat’ and
     ‘bytearray_irepeat’ by reducing the number of invocations of
     ‘memcpy’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46329

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (3) https://bugs.python.org/issue?@action=redirect&bpo=47012

   (4) https://bugs.python.org/issue?@action=redirect&bpo=47009

   (5) https://bugs.python.org/issue?@action=redirect&bpo=47005


File: python.info,  Node: ライブラリ<91>,  Next: Core and Builtins<89>,  Prev: Core and Builtins<88>,  Up: Python 3 11 0 alpha 7

1.24.36.4 ライブラリ
....................

   - bpo-46829(1): Deprecate passing a message into *note
     asyncio.Future.cancel(): 1ba9. and *note asyncio.Task.cancel():
     4d3.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46829


File: python.info,  Node: Core and Builtins<89>,  Next: ライブラリ<92>,  Prev: ライブラリ<91>,  Up: Python 3 11 0 alpha 7

1.24.36.5 Core and Builtins
...........................

   - bpo-46993(1): Speed up *note bytearray: 344. creation from *note
     list: 24d. and *note tuple: 614. by 40%.  Patch by Kumar Aditya.

   - bpo-39829(2): Removed the ‘__len__()’ call when initializing a list
     and moved initializing to ‘list_extend’.  Patch by Jeremiah
     Pascual.

   - bpo-46944(3): Speed up throwing exception in generator with *note
     METH_FASTCALL: 199e. calling convention.  Patch by Kumar Aditya.

   - bpo-46841(4): Modify *note STORE_SUBSCR: 1bab. to use an inline
     cache entry (rather than its oparg) as an adaptive counter.

   - bpo-46841(5): Use inline caching for ‘PRECALL’ and *note CALL: 915,
     and remove the internal machinery for managing the (now unused)
     non-inline caches.

   - bpo-46881(6): Statically allocate and initialize the latin1
     characters.

   - bpo-46838(7): Improve syntax errors for incorrect function
     definitions.  Patch by Pablo Galindo

   - bpo-43721(8): Fix docstrings of *note getter: 19d9, *note setter:
     19da, and *note deleter: 19db. to clarify that they create a new
     copy of the property.

   - bpo-43224(9): Make grammar changes required for PEP 646.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46993

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39829

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46944

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46881

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46838

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43721

   (9) https://bugs.python.org/issue?@action=redirect&bpo=43224


File: python.info,  Node: ライブラリ<92>,  Next: ドキュメント<30>,  Prev: Core and Builtins<89>,  Up: Python 3 11 0 alpha 7

1.24.36.6 ライブラリ
....................

   - bpo-47208(1): Allow vendors to override ‘CTYPES_MAX_ARGCOUNT’.

   - bpo-23689(2): *note re: be. module: fix memory leak when a match is
     terminated by a signal or memory allocation failure.  Patch by Ma
     Lin.

   - bpo-47167(3): Allow overriding a future compliance check in *note
     asyncio.Task: 1c7.

   - bpo-47151(4): When subprocess tries to use vfork, it now falls back
     to fork if vfork returns an error.  This allows use in situations
     where vfork isn't allowed by the OS kernel.

   - bpo-47152(5): Convert the *note re: be. module into a package.
     Deprecate modules ‘sre_compile’, ‘sre_constants’ and ‘sre_parse’.

   - bpo-4833(6): Add ‘ZipFile.mkdir()’

   - bpo-27929(7): Fix *note asyncio.loop.sock_connect(): fc8. to only
     resolve names for *note socket.AF_INET: 1bad. or *note
     socket.AF_INET6: 1bae. families.  Resolution may not make sense for
     other families, like *note socket.AF_BLUETOOTH: 1baf. and *note
     socket.AF_UNIX: 1bb0.

   - bpo-14265(8): Adds the fully qualified test name to unittest output

   - bpo-47061(9): Deprecate the aifc module.

   - bpo-39622(10): Handle Ctrl+C in asyncio programs to interrupt the
     main task.

   - bpo-47101(11): *note hashlib.algorithms_available: 158c. now lists
     only algorithms that are provided by activated crypto providers on
     OpenSSL 3.0.  Legacy algorithms are not listed unless the legacy
     provider has been loaded into the default OSSL context.

   - bpo-47099(12): All ‘URLError’ exception messages raised in
     ‘urllib.request.URLopener’ now contain a colon between ‘ftp error’
     and the rest of the message.  Previously, ‘open_ftp()’ missed the
     colon.  Patch by Oleg Iarygin.

   - bpo-47099(13): Exception chaining is changed from
     ‘Exception.with_traceback()’/*note sys.exc_info(): 89a. to PEP
     3134(14).  Patch by Oleg Iarygin.

   - bpo-47095(15): *note hashlib: 6c.'s internal ‘_blake2’ module now
     prefers ‘libb2’ from ‘https://www.blake2.net/’ over Python's
     vendored copy of blake2.

   - bpo-47098(16): The Keccak Code Package for *note hashlib: 6c.'s
     internal ‘_sha3’ module has been replaced with tiny_sha3.  The
     module is used as fallback when Python is built without OpenSSL.

   - bpo-47088(17): Implement *note typing.LiteralString: 7e6, part of
     PEP 675(18).  Patch by Jelle Zijlstra.

   - bpo-42885(19): Optimize *note re.search(): 1444, *note re.split():
     5a2, *note re.findall(): 122b, *note re.finditer(): 1713. and *note
     re.sub(): 5a3. for regular expressions starting with ‘\A’ or ‘^’.

   - bpo-23691(20): Protect the *note re.finditer(): 1713. iterator from
     re-entering.

   - bpo-47067(21): Optimize calling ‘GenericAlias’ objects by using PEP
     590(22) ‘vectorcall’ and by replacing ‘PyObject_SetAttrString’ with
     ‘PyObject_SetAttr’.

   - bpo-28080(23): Add the 'metadata_encoding' parameter in the *note
     zipfile.ZipFile: 8d3. constructor and the ‘--metadata-encoding’
     option in the *note zipfile: 137. CLI to allow reading zipfiles
     using non-standard codecs to encode the filenames within the
     archive.

   - bpo-47000(24): Make *note io.text_encoding(): 1a3c. returns "utf-8"
     when UTF-8 mode is enabled.

   - bpo-42369(25): Fix thread safety of ‘zipfile._SharedFile.tell()’ to
     avoid a "zipfile.BadZipFile: Bad CRC-32 for file" exception when
     reading a ‘ZipFile’ from multiple threads.

   - bpo-38256(26): Fix *note binascii.crc32(): 1a11. when it is
     compiled to use zlib'c crc32 to work properly on inputs 4+GiB in
     length instead of returning the wrong result.  The workaround prior
     to this was to always feed the function data in increments smaller
     than 4GiB or to just call the zlib module function.

     We also have *note binascii.crc32(): 1a11. release the GIL when
     computing on larger inputs as *note zlib.crc32(): 1a10. and *note
     hashlib: 6c. do.

     This also boosts performance on Windows as it now uses the zlib
     crc32 implementation for *note binascii.crc32(): 1a11. for a 2-3x
     speedup.

     That the stdlib has a crc32 API in two modules is a known
     historical oddity.  This moves us closer to a single implementation
     behind them.

   - bpo-47066(27): Global inline flags (e.g.  ‘(?i)’) can now only be
     used at the start of the regular expressions.  Using them not at
     the start of expression was deprecated since Python 3.6.

   - bpo-39394(28): A warning about inline flags not at the start of the
     regular expression now contains the position of the flag.

   - bpo-433030(29): Add support of atomic grouping (‘(?>...)’) and
     possessive quantifiers (‘*+’, ‘++’, ‘?+’, ‘{m,n}+’) in *note
     regular expressions: be.

   - bpo-47062(30): Implement *note asyncio.Runner: 2f5. context
     manager.

   - bpo-46382(31): *note dataclass(): 4e1. ‘slots=True’ now correctly
     omits slots already defined in base classes.  Patch by Arie
     Bovenberg.

   - bpo-47057(32): Use FASTCALL convention for ‘FutureIter.throw()’

   - bpo-47061(33): Deprecate the various modules listed by PEP 594(34):

     aifc, asynchat, asyncore, audioop, cgi, cgitb, chunk, crypt,
     imghdr, msilib, nntplib, nis, ossaudiodev, pipes, smtpd, sndhdr,
     spwd, sunau, telnetlib, uu, xdrlib

   - bpo-34790(35): Remove passing coroutine objects to *note
     asyncio.wait(): 6a7.

   - bpo-47039(36): Normalize ‘repr()’ of asyncio future and task
     objects.

   - bpo-2604(37): Fix bug where doctests using globals would fail when
     run multiple times.

   - bpo-45150(38): Add *note hashlib.file_digest(): 854. helper for
     efficient hashing of file object.

   - bpo-34861(39): Made cumtime the default sorting key for cProfile

   - bpo-45997(40): Fix *note asyncio.Semaphore: c68. re-aquiring FIFO
     order.

   - bpo-47022(41): The ‘asynchat’, ‘asyncore’ and ‘smtpd’ modules have
     been deprecated since at least Python 3.6.  Their documentation and
     deprecation warnings and have now been updated to note they will
     removed in Python 3.12 ( PEP 594(42)).

   - bpo-43253(43): Fix a crash when closing transports where the
     underlying socket handle is already invalid on the Proactor event
     loop.

   - bpo-40280(44): *note select.select(): fa0. now passes ‘NULL’ to
     ‘select’ for each empty fdset.

   - bpo-47004(45): Apply bugfixes from importlib_metadata 4.11.3,
     including bugfix for EntryPoint.extras, which was returning match
     objects and not the extras strings.

   - bpo-46998(46): Allow subclassing of *note typing.Any: 8bb.  Patch
     by Shantanu Jain.

   - bpo-46995(47): Deprecate missing *note asyncio.Task.set_name():
     bd0. for third-party task implementations, schedule making it
     mandatory in Python 3.13.

   - bpo-46994(48): Accept explicit contextvars.Context in *note
     asyncio.create_task(): 1c9. and *note asyncio.loop.create_task():
     1ca.

   - bpo-46981(49): ‘typing.get_args(typing.Tuple[()])’ now returns ‘()’
     instead of ‘((),)’.

   - bpo-46968(50): Add ‘os.sysconf_names['SC_MINSIGSTKSZ']’.

   - bpo-46985(51): Upgrade pip wheel bundled with ensurepip (pip
     22.0.4)

   - bpo-46968(52): *note faulthandler: 5c.: On Linux 5.14 and newer,
     dynamically determine size of signal handler stack size CPython
     allocates using ‘getauxval(AT_MINSIGSTKSZ)’.  This changes allows
     for Python extension's request to Linux kernel to use AMX_TILE
     instruction set on Sapphire Rapids Xeon processor to succeed,
     unblocking use of the ISA in frameworks.

   - bpo-46917(53): The *note math.nan: 873. value is now always
     available.  Patch by Victor Stinner.

   - bpo-46955(54): Expose ‘asyncio.base_events.Server’ as *note
     asyncio.Server: d08.  Patch by Stefan Zabka.

   - bpo-23325(55): The *note signal: cb. module no longer assumes that
     *note SIG_IGN: 1bb1. and *note SIG_DFL: 1bb2. are small int
     singletons.

   - bpo-46932(56): Update bundled libexpat to 2.4.7

   - bpo-46933(57): The *note pwd: b7. module is now optional.  *note
     os.path.expanduser(): c09. returns the path when the *note pwd: b7.
     module is not available.

   - bpo-40059(58): PEP 680(59), the *note tomllib: 102. module.  Adds
     support for parsing TOML.

   - bpo-464471(60): *note asyncio.timeout(): 814. and *note
     asyncio.timeout_at(): 1bb3. context managers added.  Patch by Tin
     Tvrtković and Andrew Svetlov.

   - bpo-46805(61): Added raw datagram socket functions for asyncio:
     ‘sock_sendto()’, ‘sock_recvfrom()’ and ‘sock_recvfrom_into()’.

   - bpo-46644(62): No longer require valid typeforms to be callable.
     This allows *note typing.Annotated: b37. to wrap *note
     typing.ParamSpecArgs: 9c9. and *note dataclasses.InitVar: 1bb4.
     Patch by Gregory Beauregard.

   - bpo-46581(63): Brings ‘ParamSpec’ propagation for ‘GenericAlias’ in
     line with ‘Concatenate’ (and others).

   - bpo-45413(64): Define 'posix_venv' and 'nt_venv' *note sysconfig
     installation schemes: 449. to be used for bootstrapping new virtual
     environments.  Add 'venv' sysconfig installation scheme to get the
     appropriate one of the above.  The schemes are identical to the
     pre-existing 'posix_prefix' and 'nt' install schemes.  The *note
     venv: 117. module now uses the 'venv' scheme to create new virtual
     environments instead of hardcoding the paths depending only on the
     platform.  Downstream Python distributors customizing the
     'posix_prefix' or 'nt' install scheme in a way that is not
     compatible with the install scheme used in virtual environments are
     encouraged not to customize the 'venv' schemes.  When Python itself
     runs in a virtual environment, *note
     sysconfig.get_default_scheme(): 1bb5. and *note
     sysconfig.get_preferred_scheme(): 89f. with ‘key="prefix"’ returns
     'venv'.

   - bpo-43224(65): Implement support for PEP 646 in typing.py.

   - bpo-43224(66): Allow unpacking types.GenericAlias objects, e.g.
     ‘*tuple[int, str]’.

   - bpo-46557(67): Warnings captured by the logging module are now
     logged without a format string to prevent systems that group logs
     by the msg argument from grouping captured warnings together.

   - bpo-41370(68): *note typing.get_type_hints(): 8c0. now supports
     evaluating strings as forward references in *note PEP 585 generic
     aliases: 8c1.

   - bpo-46607(69): Add *note DeprecationWarning: 1a3. to
     ‘LegacyInterpolation’, deprecated in the docstring since Python
     3.2.  Will be removed in Python 3.13.  Use ‘BasicInterpolation’ or
     ‘ExtendedInterpolation’ instead.

   - bpo-26120(70): *note pydoc: ba. now excludes __future__ imports
     from the module's data items.

   - bpo-46480(71): Add *note typing.assert_type(): 8ba.  Patch by Jelle
     Zijlstra.

   - bpo-46421(72): Fix a unittest issue where if the command was
     invoked as ‘python -m unittest’ and the filename(s) began with a
     dot (.), a ‘ValueError’ is returned.

   - bpo-46245(73): Add optional parameter 'dir_fd' in *note
     shutil.rmtree(): 356.

   - bpo-22859(74): ‘unittest.TestProgram.usageExit()’ is marked as
     deprecated, to be removed in Python 3.13.

   - bpo-46170(75): Improve the error message when you try to subclass
     an instance of *note typing.NewType: ef1.

   - bpo-40296(76): Fix supporting generic aliases in *note pydoc: ba.

   - bpo-20392(77): Fix inconsistency with uppercase file extensions in
     ‘MimeTypes.guess_type()’.  Patch by Kumar Aditya.

   - bpo-46030(78): Add ‘LOCAL_CREDS’, ‘LOCAL_CREDS_PERSISTENT’ and
     ‘SCM_CREDS2’ FreeBSD constants to the socket module.

   - bpo-44439(79): Fix ‘.write()’ method of a member file in ‘ZipFile’,
     when the input data is an object that supports the buffer protocol,
     the file length may be wrong.

   - bpo-45171(80): Fix handling of the ‘stacklevel’ argument to logging
     functions in the *note logging: 8b. module so that it is consistent
     across all logging functions and, as advertised, similar to the
     ‘stacklevel’ argument used in *note warn(): 1732.

   - bpo-24959(81): Fix bug where *note unittest: 10c. sometimes drops
     frames from tracebacks of exceptions raised in tests.

   - bpo-44859(82): Raise more accurate and PEP 249(83) compatible
     exceptions in *note sqlite3: d4.

        * Raise *note InterfaceError: 88d. instead of *note
          ProgrammingError: 305. for ‘SQLITE_MISUSE’ errors.

        * Don't overwrite *note BufferError: 1797. with *note
          ValueError: 2ec. when conversion to BLOB fails.

        * Raise *note ProgrammingError: 305. instead of *note Warning:
          1bb6. if user tries to *note execute(): 5b0. more than one SQL
          statement.

        * Raise *note ProgrammingError: 305. instead of *note
          ValueError: 2ec. if an SQL query contains null characters.

   - bpo-44493(84): Add missing terminated NUL in sockaddr_un's length

     This was potentially observable when using non-abstract AF_UNIX
     datagram sockets to processes written in another programming
     language.

   - bpo-41930(85): Add *note serialize(): 88e. and *note deserialize():
     88f. support to *note sqlite3: d4.  Patch by Erlend E. Aasland.

   - bpo-33178(86): Added *note ctypes.BigEndianUnion: 1bb7. and *note
     ctypes.LittleEndianUnion: 1bb8. classes, as originally documented
     in the library docs but not yet implemented.

   - bpo-43352(87): Add an Barrier object in synchronization primitives
     of 'asyncio' Lib in order to be consistent with Barrier from
     'threading' and 'multiprocessing' libs*

   - bpo-35859(88): *note re: be. module, fix a few bugs about capturing
     group.  In rare cases, capturing group gets an incorrect string.
     Patch by Ma Lin.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=47208

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23689

   (3) https://bugs.python.org/issue?@action=redirect&bpo=47167

   (4) https://bugs.python.org/issue?@action=redirect&bpo=47151

   (5) https://bugs.python.org/issue?@action=redirect&bpo=47152

   (6) https://bugs.python.org/issue?@action=redirect&bpo=4833

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27929

   (8) https://bugs.python.org/issue?@action=redirect&bpo=14265

   (9) https://bugs.python.org/issue?@action=redirect&bpo=47061

   (10) https://bugs.python.org/issue?@action=redirect&bpo=39622

   (11) https://bugs.python.org/issue?@action=redirect&bpo=47101

   (12) https://bugs.python.org/issue?@action=redirect&bpo=47099

   (13) https://bugs.python.org/issue?@action=redirect&bpo=47099

   (14) https://peps.python.org/pep-3134/

   (15) https://bugs.python.org/issue?@action=redirect&bpo=47095

   (16) https://bugs.python.org/issue?@action=redirect&bpo=47098

   (17) https://bugs.python.org/issue?@action=redirect&bpo=47088

   (18) https://peps.python.org/pep-0675/

   (19) https://bugs.python.org/issue?@action=redirect&bpo=42885

   (20) https://bugs.python.org/issue?@action=redirect&bpo=23691

   (21) https://bugs.python.org/issue?@action=redirect&bpo=47067

   (22) https://peps.python.org/pep-0590/

   (23) https://bugs.python.org/issue?@action=redirect&bpo=28080

   (24) https://bugs.python.org/issue?@action=redirect&bpo=47000

   (25) https://bugs.python.org/issue?@action=redirect&bpo=42369

   (26) https://bugs.python.org/issue?@action=redirect&bpo=38256

   (27) https://bugs.python.org/issue?@action=redirect&bpo=47066

   (28) https://bugs.python.org/issue?@action=redirect&bpo=39394

   (29) https://bugs.python.org/issue?@action=redirect&bpo=433030

   (30) https://bugs.python.org/issue?@action=redirect&bpo=47062

   (31) https://bugs.python.org/issue?@action=redirect&bpo=46382

   (32) https://bugs.python.org/issue?@action=redirect&bpo=47057

   (33) https://bugs.python.org/issue?@action=redirect&bpo=47061

   (34) https://peps.python.org/pep-0594/

   (35) https://bugs.python.org/issue?@action=redirect&bpo=34790

   (36) https://bugs.python.org/issue?@action=redirect&bpo=47039

   (37) https://bugs.python.org/issue?@action=redirect&bpo=2604

   (38) https://bugs.python.org/issue?@action=redirect&bpo=45150

   (39) https://bugs.python.org/issue?@action=redirect&bpo=34861

   (40) https://bugs.python.org/issue?@action=redirect&bpo=45997

   (41) https://bugs.python.org/issue?@action=redirect&bpo=47022

   (42) https://peps.python.org/pep-0594/

   (43) https://bugs.python.org/issue?@action=redirect&bpo=43253

   (44) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (45) https://bugs.python.org/issue?@action=redirect&bpo=47004

   (46) https://bugs.python.org/issue?@action=redirect&bpo=46998

   (47) https://bugs.python.org/issue?@action=redirect&bpo=46995

   (48) https://bugs.python.org/issue?@action=redirect&bpo=46994

   (49) https://bugs.python.org/issue?@action=redirect&bpo=46981

   (50) https://bugs.python.org/issue?@action=redirect&bpo=46968

   (51) https://bugs.python.org/issue?@action=redirect&bpo=46985

   (52) https://bugs.python.org/issue?@action=redirect&bpo=46968

   (53) https://bugs.python.org/issue?@action=redirect&bpo=46917

   (54) https://bugs.python.org/issue?@action=redirect&bpo=46955

   (55) https://bugs.python.org/issue?@action=redirect&bpo=23325

   (56) https://bugs.python.org/issue?@action=redirect&bpo=46932

   (57) https://bugs.python.org/issue?@action=redirect&bpo=46933

   (58) https://bugs.python.org/issue?@action=redirect&bpo=40059

   (59) https://peps.python.org/pep-0680/

   (60) https://bugs.python.org/issue?@action=redirect&bpo=464471

   (61) https://bugs.python.org/issue?@action=redirect&bpo=46805

   (62) https://bugs.python.org/issue?@action=redirect&bpo=46644

   (63) https://bugs.python.org/issue?@action=redirect&bpo=46581

   (64) https://bugs.python.org/issue?@action=redirect&bpo=45413

   (65) https://bugs.python.org/issue?@action=redirect&bpo=43224

   (66) https://bugs.python.org/issue?@action=redirect&bpo=43224

   (67) https://bugs.python.org/issue?@action=redirect&bpo=46557

   (68) https://bugs.python.org/issue?@action=redirect&bpo=41370

   (69) https://bugs.python.org/issue?@action=redirect&bpo=46607

   (70) https://bugs.python.org/issue?@action=redirect&bpo=26120

   (71) https://bugs.python.org/issue?@action=redirect&bpo=46480

   (72) https://bugs.python.org/issue?@action=redirect&bpo=46421

   (73) https://bugs.python.org/issue?@action=redirect&bpo=46245

   (74) https://bugs.python.org/issue?@action=redirect&bpo=22859

   (75) https://bugs.python.org/issue?@action=redirect&bpo=46170

   (76) https://bugs.python.org/issue?@action=redirect&bpo=40296

   (77) https://bugs.python.org/issue?@action=redirect&bpo=20392

   (78) https://bugs.python.org/issue?@action=redirect&bpo=46030

   (79) https://bugs.python.org/issue?@action=redirect&bpo=44439

   (80) https://bugs.python.org/issue?@action=redirect&bpo=45171

   (81) https://bugs.python.org/issue?@action=redirect&bpo=24959

   (82) https://bugs.python.org/issue?@action=redirect&bpo=44859

   (83) https://peps.python.org/pep-0249/

   (84) https://bugs.python.org/issue?@action=redirect&bpo=44493

   (85) https://bugs.python.org/issue?@action=redirect&bpo=41930

   (86) https://bugs.python.org/issue?@action=redirect&bpo=33178

   (87) https://bugs.python.org/issue?@action=redirect&bpo=43352

   (88) https://bugs.python.org/issue?@action=redirect&bpo=35859


File: python.info,  Node: ドキュメント<30>,  Next: テスト<29>,  Prev: ライブラリ<92>,  Up: Python 3 11 0 alpha 7

1.24.36.7 ドキュメント
......................

   - bpo-45099(1): Document internal *note asyncio: b. API.

   - bpo-47126(2): Update PEP URLs to PEP 676(3)'s new canonical form.

   - bpo-47040(4): Clarified the old Python versions compatibility note
     of *note binascii.crc32(): 1a11. / *note zlib.adler32(): 1bba. /
     *note zlib.crc32(): 1a10. functions.

   - bpo-46033(5): Clarify ‘for’ statement execution in its doc.

   - bpo-45790(6): Adjust inaccurate phrasing in *note 拡張の型の定義;
     チュートリアル: 1bbb. about the ‘ob_base’ field and the macros used
     to access its contents.

   - bpo-42340(7): Document that in some circumstances *note
     KeyboardInterrupt: bc5. may cause the code to enter an inconsistent
     state.  Provided a sample workaround to avoid it if needed.

   - bpo-41233(8): Link the errnos referenced in
     ‘Doc/library/exceptions.rst’ to their respective section in
     ‘Doc/library/errno.rst’, and vice versa.  Previously this was only
     done for EINTR and InterruptedError.  Patch by Yan "yyyyyyyan"
     Orestes.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45099

   (2) https://bugs.python.org/issue?@action=redirect&bpo=47126

   (3) https://peps.python.org/pep-0676/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=47040

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46033

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45790

   (7) https://bugs.python.org/issue?@action=redirect&bpo=42340

   (8) https://bugs.python.org/issue?@action=redirect&bpo=41233


File: python.info,  Node: テスト<29>,  Next: ビルド<35>,  Prev: ドキュメント<30>,  Up: Python 3 11 0 alpha 7

1.24.36.8 テスト
................

   - bpo-47205(1): Skip test for *note sched_getaffinity(): 1322. and
     *note sched_setaffinity(): 1326. error case on FreeBSD.

   - bpo-46126(2): Restore 'descriptions' when running tests internally.

   - bpo-47104(3): Rewrite *note asyncio.to_thread(): ae5. tests to use
     *note unittest.IsolatedAsyncioTestCase: 361.

   - bpo-40280(4): The test suite is now passing on the Emscripten
     platform.  All fork, socket, and subprocess-based tests are
     skipped.

   - bpo-47037(5): Skip ‘strftime("%4Y")’ feature test on Windows.  It
     can cause an assertion error in debug builds.

   - bpo-46587(6): Skip tests if platform's ‘strftime’ does not support
     non-portable glibc extensions.

   - bpo-47015(7): A test case for *note os.sendfile(): d05. is
     converted from deprecated ‘asyncore’ (see PEP 594(8)) to *note
     asyncio: b.  Patch by Oleg Iarygin.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=47205

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46126

   (3) https://bugs.python.org/issue?@action=redirect&bpo=47104

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (5) https://bugs.python.org/issue?@action=redirect&bpo=47037

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46587

   (7) https://bugs.python.org/issue?@action=redirect&bpo=47015

   (8) https://peps.python.org/pep-0594/


File: python.info,  Node: ビルド<35>,  Next: Windows<31>,  Prev: テスト<29>,  Up: Python 3 11 0 alpha 7

1.24.36.9 ビルド
................

   - bpo-40280(1): Add configure option *note
     -enable-wasm-dynamic-linking: 1bbe. to enable ‘dlopen’ and
     MAIN_MODULE / SIDE_MODULE on ‘wasm32-emscripten’.

   - bpo-46023(2): ‘makesetup’ now detects and skips all duplicated
     module definitions.  The first entry wins.

   - bpo-40280(3): Add SOABI ‘wasm32-emscripten’ for Emscripten and
     ‘wasm32-wasi’ for WASI on 32bit WASM as well as ‘wasm64’ counter
     parts.

   - bpo-47032(4): Ensure Windows install builds fail correctly with a
     non-zero exit code when part of the build fails.

   - bpo-47024(5): Update OpenSSL to 1.1.1n for macOS installers and all
     Windows builds.

   - bpo-46996(6): The *note tkinter: f6. package now requires Tcl/Tk
     version 8.5.12 or newer.

   - bpo-46973(7): Add ‘regen-configure’ make target to regenerate
     configure script with Christian's container image
     ‘quay.io/tiran/cpython_autoconf:269’.

   - bpo-46917(8): Building Python now requires support of IEEE 754
     floating-point numbers.  Patch by Victor Stinner.

   - bpo-45774(9): ‘configure’ now verifies that all SQLite C APIs
     needed for the *note sqlite3: d4. extension module are found.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46023

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (4) https://bugs.python.org/issue?@action=redirect&bpo=47032

   (5) https://bugs.python.org/issue?@action=redirect&bpo=47024

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46996

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46973

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46917

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45774


File: python.info,  Node: Windows<31>,  Next: macOS<22>,  Prev: ビルド<35>,  Up: Python 3 11 0 alpha 7

1.24.36.10 Windows
..................

   - bpo-47194(1): Update ‘zlib’ to v1.2.12 to resolve CVE
     2018-25032(2).

   - bpo-47171(3): Enables installing the ‘py.exe’ launcher on Windows
     ARM64.

   - bpo-46566(4): Upgraded *note Python install manager: 7da. to
     support a new ‘-V:company/tag’ argument for full PEP 514(5) support
     and to detect ARM64 installs.  The ‘-64’ suffix on arguments is
     deprecated, but still selects any non-32-bit install.  Setting
     ‘PYLAUNCHER_ALLOW_INSTALL’ and specifying a version that is not
     installed will attempt to install the requested version from the
     Microsoft Store.

   - bpo-47086(6): The installer for Windows now includes documentation
     as loose HTML files rather than a single compiled ‘.chm’ file.

   - bpo-46907(7): Update Windows installer to use SQLite 3.38.1.

   - bpo-44549(8): Update bzip2 to 1.0.8 in Windows builds to mitigate
     CVE 2016-3189(9) and CVE 2019-12900(10).

   - bpo-46948(11): Prevent CVE 2022-26488(12) by ensuring the Add to
     PATH option in the Windows installer uses the correct path when
     being repaired.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=47194

   (2) https://www.cve.org/CVERecord?id=CVE-2018-25032

   (3) https://bugs.python.org/issue?@action=redirect&bpo=47171

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46566

   (5) https://peps.python.org/pep-0514/

   (6) https://bugs.python.org/issue?@action=redirect&bpo=47086

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46907

   (8) https://bugs.python.org/issue?@action=redirect&bpo=44549

   (9) https://www.cve.org/CVERecord?id=CVE-2016-3189

   (10) https://www.cve.org/CVERecord?id=CVE-2019-12900

   (11) https://bugs.python.org/issue?@action=redirect&bpo=46948

   (12) https://www.cve.org/CVERecord?id=CVE-2022-26488


File: python.info,  Node: macOS<22>,  Next: Tools/Demos<26>,  Prev: Windows<31>,  Up: Python 3 11 0 alpha 7

1.24.36.11 macOS
................

   - bpo-46890(1): Fix a regression in the setting of
     ‘sys._base_executable’ in framework builds, and thereby fix a
     regression in *note venv: 117. virtual environments with such
     builds.

   - bpo-46907(2): Update macOS installer to SQLite 3.38.1.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46890

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46907


File: python.info,  Node: Tools/Demos<26>,  Next: C API<31>,  Prev: macOS<22>,  Up: Python 3 11 0 alpha 7

1.24.36.12 Tools/Demos
......................

   - bpo-40280(1): Replace Emscripten's limited shell with Katie Bell's
     browser-ui REPL from python-wasm project.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40280


File: python.info,  Node: C API<31>,  Prev: Tools/Demos<26>,  Up: Python 3 11 0 alpha 7

1.24.36.13 C API
................

   - bpo-40421(1): Add ‘PyFrame_GetBuiltins’, ‘PyFrame_GetGenerator’ and
     ‘PyFrame_GetGlobals’ C-API functions to access frame object
     attributes safely from C code.

   - bpo-46850(2): Move the private ‘_PyFrameEvalFunction’ type, and
     private ‘_PyInterpreterState_GetEvalFrameFunc()’ and
     ‘_PyInterpreterState_SetEvalFrameFunc()’ functions to the internal
     C API. The ‘_PyFrameEvalFunction’ callback function type now uses
     the ‘_PyInterpreterFrame’ type which is part of the internal C API.
     Patch by Victor Stinner.

   - bpo-46850(3): Move the private undocumented
     ‘_PyEval_EvalFrameDefault()’ function to the internal C API. The
     function now uses the ‘_PyInterpreterFrame’ type which is part of
     the internal C API. Patch by Victor Stinner.

   - bpo-46850(4): Remove the private undocumented function
     ‘_PyEval_CallTracing()’ from the C API. Call the public *note
     sys.call_tracing(): 1bc3. function instead.  Patch by Victor
     Stinner.

   - bpo-46850(5): Remove the private undocumented function
     ‘_PyEval_GetCoroutineOriginTrackingDepth()’ from the C API. Call
     the public *note sys.get_coroutine_origin_tracking_depth(): d84.
     function instead.  Patch by Victor Stinner.

   - bpo-46850(6): Remove the following private undocumented functions
     from the C API:

        * ‘_PyEval_GetAsyncGenFirstiter()’

        * ‘_PyEval_GetAsyncGenFinalizer()’

        * ‘_PyEval_SetAsyncGenFirstiter()’

        * ‘_PyEval_SetAsyncGenFinalizer()’

     Call the public *note sys.get_asyncgen_hooks(): 1bc4. and *note
     sys.set_asyncgen_hooks(): 199d. functions instead.  Patch by Victor
     Stinner.

   - bpo-46987(7): Remove private functions ‘_PySys_GetObjectId()’ and
     ‘_PySys_SetObjectId()’.  Patch by Donghee Na.

   - bpo-46906(8): Add new functions to pack and unpack C double
     (serialize and deserialize): *note PyFloat_Pack2(): 969, *note
     PyFloat_Pack4(): 96a, *note PyFloat_Pack8(): 96b, *note
     PyFloat_Unpack2(): 96c, *note PyFloat_Unpack4(): 96d. and *note
     PyFloat_Unpack8(): 96e.  Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40421

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46850

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46850

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46850

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46850

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46850

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46987

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46906


File: python.info,  Node: Python 3 11 0 alpha 6,  Next: Python 3 11 0 alpha 5,  Prev: Python 3 11 0 alpha 7,  Up: 変更履歴

1.24.37 Python 3.11.0 alpha 6
-----------------------------

'Release date: 2022-03-07'

* Menu:

* Core and Builtins: Core and Builtins<90>.
* ライブラリ: ライブラリ<93>.
* Core and Builtins: Core and Builtins<91>.
* ライブラリ: ライブラリ<94>.
* Core and Builtins: Core and Builtins<92>.
* ライブラリ: ライブラリ<95>.
* Core and Builtins: Core and Builtins<93>.
* ライブラリ: ライブラリ<96>.
* ドキュメント: ドキュメント<31>.
* テスト: テスト<30>.
* ビルド: ビルド<36>.
* Windows: Windows<32>.
* IDLE: IDLE<16>.
* C API: C API<32>.


File: python.info,  Node: Core and Builtins<90>,  Next: ライブラリ<93>,  Up: Python 3 11 0 alpha 6

1.24.37.1 Core and Builtins
...........................

   - bpo-46940(1): Avoid overriding *note AttributeError: 5f0. metadata
     information for nested attribute access calls.  Patch by Pablo
     Galindo.

   - bpo-46927(2): Include the type's name in the error message for
     subscripting non-generic types.

   - bpo-46921(3): Support vectorcall for ‘super()’.  Patch by Ken Jin.

   - bpo-46841(4): Fix incorrect handling of inline cache entries when
     specializing *note BINARY_OP: 366.

   - bpo-46841(5): Use an oparg to simplify the construction of helpful
     error messages in *note GET_AWAITABLE: 1bc7.

   - bpo-46903(6): Make sure that str subclasses can be used as
     attribute names for instances with virtual dictionaries.  Fixes
     regression in 3.11alpha

   - bpo-46841(7): Add more detailed specialization failure stats for
     *note COMPARE_OP: b61. followed by *note EXTENDED_ARG: 1b1e.

   - bpo-46891(8): Fix bug introduced during 3.11alpha where subclasses
     of ‘types.ModuleType’ with ‘__slots__’ were not initialized
     correctly, resulting in an interpreter crash.

   - bpo-46841(9): Use inline caching for *note LOAD_ATTR: 704,
     ‘LOAD_METHOD’, and *note STORE_ATTR: 1bc8.

   - bpo-46841(10): Use inline cache for ‘BINARY_SUBSCR’.

   - bpo-46841(11): Use inline caching for *note COMPARE_OP: b61.

   - bpo-46864(12): Deprecate ‘PyBytesObject.ob_shash’.  It will be
     removed in Python 3.13.

   - bpo-46841(13): Use inline caching for *note UNPACK_SEQUENCE: 1bc9.

   - bpo-46845(14): Reduces dict size by removing hash value from hash
     table when all inserted keys are Unicode.  For example,
     ‘sys.getsizeof(dict.fromkeys("abcdefg"))’ becomes 272 bytes from
     352 bytes on 64bit platform.

   - bpo-46841(15): Use inline cache for *note LOAD_GLOBAL: 1a5a.

   - bpo-46852(16): Rename the private undocumented
     ‘float.__set_format__()’ method to ‘float.__setformat__()’ to fix a
     typo introduced in Python 3.7.  The method is only used by
     test_float.  Patch by Victor Stinner.

   - bpo-46852(17): Remove the undocumented private
     ‘float.__set_format__()’ method, previously known as
     ‘float.__setformat__()’ in Python 3.7.  Its docstring said: "You
     probably don't want to use this function.  It exists mainly to be
     used in Python's test suite."  Patch by Victor Stinner.

   - bpo-40116(18): Fix regression that dict.update(other) may don't
     respect iterate order of other when other is key sharing dict.

   - bpo-46712(19): Share global string identifiers in deep-frozen
     modules.

   - bpo-46430(20): Fix memory leak in interned strings of deep-frozen
     modules.

   - bpo-46841(21): Store *note BINARY_OP: 366. caches inline using a
     new *note CACHE: 908. instruction.

   - bpo-45107(22): Specialize ‘LOAD_METHOD’ for instances with a dict.

   - bpo-44337(23): Reduce the memory usage of specialized *note
     LOAD_ATTR: 704. and *note STORE_ATTR: 1bc8. instructions.

   - bpo-46729(24): Add number of sub-exceptions to
     ‘BaseException.__str__()’.

   - bpo-45885(25): Don't un-adapt *note COMPARE_OP: b61. when
     collecting specialization stats.

   - bpo-46329(26): Fix specialization stats gathering for ‘PRECALL’
     instructions.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46940

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46927

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46921

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46903

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46891

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (10) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (11) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (12) https://bugs.python.org/issue?@action=redirect&bpo=46864

   (13) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (14) https://bugs.python.org/issue?@action=redirect&bpo=46845

   (15) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (16) https://bugs.python.org/issue?@action=redirect&bpo=46852

   (17) https://bugs.python.org/issue?@action=redirect&bpo=46852

   (18) https://bugs.python.org/issue?@action=redirect&bpo=40116

   (19) https://bugs.python.org/issue?@action=redirect&bpo=46712

   (20) https://bugs.python.org/issue?@action=redirect&bpo=46430

   (21) https://bugs.python.org/issue?@action=redirect&bpo=46841

   (22) https://bugs.python.org/issue?@action=redirect&bpo=45107

   (23) https://bugs.python.org/issue?@action=redirect&bpo=44337

   (24) https://bugs.python.org/issue?@action=redirect&bpo=46729

   (25) https://bugs.python.org/issue?@action=redirect&bpo=45885

   (26) https://bugs.python.org/issue?@action=redirect&bpo=46329


File: python.info,  Node: ライブラリ<93>,  Next: Core and Builtins<91>,  Prev: Core and Builtins<90>,  Up: Python 3 11 0 alpha 6

1.24.37.2 ライブラリ
....................

   - bpo-46794(1): Bump up the libexpat version into 2.4.6

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46794


File: python.info,  Node: Core and Builtins<91>,  Next: ライブラリ<94>,  Prev: ライブラリ<93>,  Up: Python 3 11 0 alpha 6

1.24.37.3 Core and Builtins
...........................

   - bpo-46823(1): Implement a specialized combined opcode
     ‘LOAD_FAST__LOAD_ATTR_INSTANCE_VALUE’.  Patch by Dennis Sweeney.

   - bpo-46820(2): Fix parsing a numeric literal immediately (without
     spaces) followed by "not in" keywords, like in ‘1not in x’.  Now
     the parser only emits a warning, not a syntax error.

   - bpo-46329(3): Move ‘KW_NAMES’ before ‘PRECALL’ instruction in call
     sequence.  Change ‘operand’ of ‘CALL’ to match ‘PRECALL’ for easier
     specialization.

   - bpo-46808(4): Remove the ‘NEXT_BLOCK’ macro from compile.c, and
     make the compiler automatically generate implicit blocks when they
     are needed.

   - bpo-46329(5): Add ‘PUSH_NULL’ instruction.  This is used as a
     prefix when evaluating a callable, so that the stack has the same
     shape for methods and other calls.  ‘PRECALL_FUNCTION’ and
     ‘PRECALL_METHOD’ are merged into a single ‘PRECALL’ instruction.

     There is no change in semantics.

   - bpo-46762(6): Fix an assert failure in debug builds when a '<',
     '>', or '=' is the last character in an f-string that's missing a
     closing right brace.

   - bpo-46730(7): Message of AttributeError caused by getting, setting
     or deleting a property without the corresponding function now
     mentions that the attribute is in fact a property and also
     specifies type of the class that it belongs to.

   - bpo-46724(8): Make sure that all backwards jumps use the
     ‘JUMP_ABSOLUTE’ instruction, rather than ‘JUMP_FORWARD’ with an
     argument of ‘(2**32)+offset’.

   - bpo-46732(9): Correct the docstring for the *note __bool__(): 14ed.
     method.  Patch by Jelle Zijlstra.

   - bpo-46072(10): Add more detailed specialization failure statistics
     for *note BINARY_OP: 366.

   - bpo-46707(11): Avoid potential exponential backtracking when
     producing some syntax errors involving lots of brackets.  Patch by
     Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46823

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46820

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46329

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46808

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46329

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46762

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46730

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46724

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46732

   (10) https://bugs.python.org/issue?@action=redirect&bpo=46072

   (11) https://bugs.python.org/issue?@action=redirect&bpo=46707


File: python.info,  Node: ライブラリ<94>,  Next: Core and Builtins<92>,  Prev: Core and Builtins<91>,  Up: Python 3 11 0 alpha 6

1.24.37.4 ライブラリ
....................

   - bpo-46323(1): *note ctypes: 2e. now allocates memory on the stack
     instead of on the heap to pass arguments while calling a Python
     callback function.  Patch by Donghee Na.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46323


File: python.info,  Node: Core and Builtins<92>,  Next: ライブラリ<95>,  Prev: ライブラリ<94>,  Up: Python 3 11 0 alpha 6

1.24.37.5 Core and Builtins
...........................

   - bpo-45923(1): Add a quickened form of *note RESUME: 5bb. that skips
     quickening checks.

   - bpo-46702(2): Specialize *note UNPACK_SEQUENCE: 1bc9. for *note
     tuple: 614. and *note list: 24d. unpackings.

   - bpo-46072(3): Opcode pair stats are now gathered with
     ‘--enable-pystats’.  Defining ‘DYNAMIC_EXECUTION_PROFILE’ or
     ‘DXPAIRS’ no longer has any effect.

   - bpo-46675(4): Allow more than 16 items in a split dict before it is
     combined.  The limit is now 254.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45923

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46702

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46072

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46675


File: python.info,  Node: ライブラリ<95>,  Next: Core and Builtins<93>,  Prev: Core and Builtins<92>,  Up: Python 3 11 0 alpha 6

1.24.37.6 ライブラリ
....................

   - bpo-40479(1): Add a missing call to ‘va_end()’ in
     ‘Modules/_hashopenssl.c’.

   - bpo-46323(2): Use *note PyObject_Vectorcall(): 77e. while calling
     ctypes callback function.  Patch by Donghee Na.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40479

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46323


File: python.info,  Node: Core and Builtins<93>,  Next: ライブラリ<96>,  Prev: ライブラリ<95>,  Up: Python 3 11 0 alpha 6

1.24.37.7 Core and Builtins
...........................

   - bpo-46615(1): When iterating over sets internally in ‘setobject.c’,
     acquire strong references to the resulting items from the set.
     This prevents crashes in corner-cases of various set operations
     where the set gets mutated.

   - bpo-45828(2): The bytecode compiler now attempts to apply runtime
     stack manipulations at compile-time (whenever it is feasible to do
     so).

   - bpo-30496(3): Fixed a minor portability issue in the implementation
     of *note PyLong_FromLong(): 1bd0, and added a fast path for
     single-digit integers to *note PyLong_FromLongLong(): 1bd1.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46615

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45828

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30496


File: python.info,  Node: ライブラリ<96>,  Next: ドキュメント<31>,  Prev: Core and Builtins<93>,  Up: Python 3 11 0 alpha 6

1.24.37.8 ライブラリ
....................

   - bpo-25707(1): Fixed a file leak in *note
     xml.etree.ElementTree.iterparse(): 57a. when the iterator is not
     exhausted.  Patch by Jacob Walls.

   - bpo-46877(2): Export *note unittest.doModuleCleanups(): 1bd3. in
     *note unittest: 10c.  Patch by Kumar Aditya.

   - bpo-46848(3): For performance, use the optimized string-searching
     implementations from *note find(): 1bd4. and *note rfind(): 1bd5.
     for ‘find()’ and ‘rfind()’.

   - bpo-46736(4): *note SimpleHTTPRequestHandler: d38. now uses HTML5
     grammar.  Patch by Donghee Na.

   - bpo-44886(5): Inherit asyncio proactor datagram transport from
     *note asyncio.DatagramTransport: 1b27.

   - bpo-46827(6): Support UDP sockets in *note
     asyncio.loop.sock_connect(): fc8. for selector-based event loops.
     Patch by Thomas Grainger.

   - bpo-46811(7): Make test suite support Expat >=2.4.5

   - bpo-46252(8): Raise *note TypeError: 198. if *note ssl.SSLSocket:
     ae7. is passed to transport-based APIs.

   - bpo-46784(9): Fix libexpat symbols collisions with user dynamically
     loaded or statically linked libexpat in embedded Python.

   - bpo-46786(10): The HTML serialisation in xml.etree.ElementTree now
     writes ‘embed’, ‘source’, ‘track’ and ‘wbr’ as empty tags, as
     defined in HTML 5.

   - bpo-39327(11): *note shutil.rmtree(): 356. can now work with
     VirtualBox shared folders when running from the guest
     operating-system.

   - bpo-45390(12): Propagate *note asyncio.CancelledError: 4d4. message
     from inner task to outer awaiter.

   - bpo-46756(13): Fix a bug in *note
     urllib.request.HTTPPasswordMgr.find_user_password(): 1bd6. and
     *note
     urllib.request.HTTPPasswordMgrWithPriorAuth.is_authenticated():
     1bd7. which allowed to bypass authorization.  For example, access
     to URI ‘example.org/foobar’ was allowed if the user was authorized
     for URI ‘example.org/foo’.

   - bpo-46737(14): *note random.gauss(): 1bd8. and *note
     random.normalvariate(): 1bd9. now have default arguments.

   - bpo-46752(15): Add task groups to asyncio (structured concurrency,
     inspired by Trio's nurseries).  This also introduces a change to
     task cancellation, where a cancelled task can't be cancelled again
     until it calls .uncancel().

   - bpo-46724(16): Fix *note dis: 3c. behavior on negative jump
     offsets.

   - bpo-46333(17): The ‘__repr__()’ method of *note typing.ForwardRef:
     1bda. now includes the ‘module’ parameter of *note
     typing.ForwardRef: 1bda. when it is set.

   - bpo-46643(18): In *note typing.get_type_hints(): 8c0, support
     evaluating stringified ‘ParamSpecArgs’ and ‘ParamSpecKwargs’
     annotations.  Patch by Gregory Beauregard.

   - bpo-45863(19): When the *note tarfile: e4. module creates a pax
     format archive, it will put an integer representation of timestamps
     in the ustar header (if possible) for the benefit of older
     unarchivers, in addition to the existing full-precision timestamps
     in the pax extended header.

   - bpo-46066(20): Deprecate kwargs-based syntax for *note
     typing.TypedDict: 332. definitions.  It had confusing semantics
     when specifying totality, and was largely unused.  Patch by
     Jingchen Ye.

   - bpo-46676(21): Make *note typing.ParamSpec: 487. args and kwargs
     equal to themselves.  Patch by Gregory Beauregard.

   - bpo-46323(22): ‘ctypes.CFUNCTYPE()’ and ‘ctypes.WINFUNCTYPE()’ now
     fail to create the type if its ‘_argtypes_’ member contains too
     many arguments.  Previously, the error was only raised when calling
     a function.  Patch by Victor Stinner.

   - bpo-46672(23): Fix ‘NameError’ in *note asyncio.gather(): 813. when
     initial type check fails.

   - bpo-46659(24): The *note calendar.LocaleTextCalendar: 94b. and
     *note calendar.LocaleHTMLCalendar: 94c. classes now use *note
     locale.getlocale(): 327, instead of using *note
     locale.getdefaultlocale(): 326, if no locale is specified.  Patch
     by Victor Stinner.

   - bpo-46659(25): The *note locale.getdefaultlocale(): 326. function
     is deprecated and will be removed in Python 3.13.  Use *note
     locale.setlocale(): 328, *note locale.getpreferredencoding(False):
     75c. and *note locale.getlocale(): 327. functions instead.  Patch
     by Victor Stinner.

   - bpo-46655(26): In *note typing.get_type_hints(): 8c0, support
     evaluating bare stringified ‘TypeAlias’ annotations.  Patch by
     Gregory Beauregard.

   - bpo-45948(27): Fixed a discrepancy in the C implementation of the
     *note xml.etree.ElementTree: 12b. module.  Now, instantiating an
     *note xml.etree.ElementTree.XMLParser: c49. with a ‘target=None’
     keyword provides a default *note xml.etree.ElementTree.TreeBuilder:
     c4a. target as the Python implementation does.

   - bpo-46626(28): Expose Linux's ‘IP_BIND_ADDRESS_NO_PORT’ option in
     *note socket: d1.

   - bpo-46521(29): Fix a bug in the *note codeop: 1d. module that was
     incorrectly identifying invalid code involving string quotes as
     valid code.

   - bpo-46571(30): Improve *note typing.no_type_check(): 8c3.

     Now it does not modify external classes and functions.  We also now
     correctly mark classmethods as not to be type checked.

   - bpo-46400(31): expat: Update libexpat from 2.4.1 to 2.4.4

   - bpo-46556(32): Deprecate undocumented support for using a *note
     pathlib.Path: 266. object as a context manager.

   - bpo-46534(33): Implement PEP 673(34) *note typing.Self: 7e3.  Patch
     by James Hilton-Balfe.

   - bpo-46522(35): Make various module ‘__getattr__’ AttributeErrors
     more closely match a typical AttributeError

   - bpo-46475(36): Add *note typing.Never: 8b7. and *note
     typing.assert_never(): 8b6.  Patch by Jelle Zijlstra.

   - bpo-46333(37): The ‘__eq__()’ and ‘__hash__()’ methods of *note
     typing.ForwardRef: 1bda. now honor the ‘module’ parameter of *note
     typing.ForwardRef: 1bda.  Forward references from different modules
     are now differentiated.

   - bpo-46246(38): Add missing ‘__slots__’ to
     ‘importlib.metadata.DeprecatedList’.  Patch by Arie Bovenberg.

   - bpo-46232(39): The *note ssl: d5. module now handles certificates
     with bit strings in DN correctly.

   - bpo-46195(40): *note typing.get_type_hints(): 8c0. no longer adds
     ‘Optional’ to parameters with ‘None’ as a default.  This aligns to
     changes to PEP 484 in ‘https://github.com/python/peps/pull/689’

   - bpo-31369(41): Add *note RegexFlag: 83f. to ‘re.__all__’ and
     documented it.  Add ‘NOFLAG’ to indicate no flags being set.

   - bpo-45898(42): *note ctypes: 2e. no longer defines ‘ffi_type_*’
     symbols in ‘cfield.c’.  The symbols have been provided by libffi
     for over a decade.

   - bpo-44953(43): Calling ‘operator.itemgetter’ objects and
     ‘operator.attrgetter’ objects is now faster due to use of the
     vectorcall calling convention.

   - bpo-44289(44): Fix an issue with *note is_tarfile(): 1bdb. method
     when using 'fileobj' argument: position in the 'fileobj' was
     advanced forward which made it unreadable with *note
     tarfile.TarFile.open(): 1bdc.

   - bpo-44011(45): Reimplement SSL/TLS support in asyncio, borrow the
     implementation from uvloop library.

   - bpo-41086(46): Make the *note configparser.ConfigParser: 4de.
     constructor raise *note TypeError: 198. if the ‘interpolation’
     parameter is not of type ‘configparser.Interpolation’

   - bpo-29418(47): Implement *note inspect.ismethodwrapper(): 85a. and
     fix *note inspect.isroutine(): 1bdd. for cases where methodwrapper
     is given.  Patch by Hakan Çelik.

   - bpo-14156(48): argparse.FileType now supports an argument of '-' in
     binary mode, returning the .buffer attribute of
     sys.stdin/sys.stdout as appropriate.  Modes including 'x' and 'a'
     are treated equivalently to 'w' when argument is '-'.  Patch
     contributed by Josh Rosenberg

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25707

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46877

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46848

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46736

   (5) https://bugs.python.org/issue?@action=redirect&bpo=44886

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46827

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46811

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46252

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46784

   (10) https://bugs.python.org/issue?@action=redirect&bpo=46786

   (11) https://bugs.python.org/issue?@action=redirect&bpo=39327

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45390

   (13) https://bugs.python.org/issue?@action=redirect&bpo=46756

   (14) https://bugs.python.org/issue?@action=redirect&bpo=46737

   (15) https://bugs.python.org/issue?@action=redirect&bpo=46752

   (16) https://bugs.python.org/issue?@action=redirect&bpo=46724

   (17) https://bugs.python.org/issue?@action=redirect&bpo=46333

   (18) https://bugs.python.org/issue?@action=redirect&bpo=46643

   (19) https://bugs.python.org/issue?@action=redirect&bpo=45863

   (20) https://bugs.python.org/issue?@action=redirect&bpo=46066

   (21) https://bugs.python.org/issue?@action=redirect&bpo=46676

   (22) https://bugs.python.org/issue?@action=redirect&bpo=46323

   (23) https://bugs.python.org/issue?@action=redirect&bpo=46672

   (24) https://bugs.python.org/issue?@action=redirect&bpo=46659

   (25) https://bugs.python.org/issue?@action=redirect&bpo=46659

   (26) https://bugs.python.org/issue?@action=redirect&bpo=46655

   (27) https://bugs.python.org/issue?@action=redirect&bpo=45948

   (28) https://bugs.python.org/issue?@action=redirect&bpo=46626

   (29) https://bugs.python.org/issue?@action=redirect&bpo=46521

   (30) https://bugs.python.org/issue?@action=redirect&bpo=46571

   (31) https://bugs.python.org/issue?@action=redirect&bpo=46400

   (32) https://bugs.python.org/issue?@action=redirect&bpo=46556

   (33) https://bugs.python.org/issue?@action=redirect&bpo=46534

   (34) https://peps.python.org/pep-0673/

   (35) https://bugs.python.org/issue?@action=redirect&bpo=46522

   (36) https://bugs.python.org/issue?@action=redirect&bpo=46475

   (37) https://bugs.python.org/issue?@action=redirect&bpo=46333

   (38) https://bugs.python.org/issue?@action=redirect&bpo=46246

   (39) https://bugs.python.org/issue?@action=redirect&bpo=46232

   (40) https://bugs.python.org/issue?@action=redirect&bpo=46195

   (41) https://bugs.python.org/issue?@action=redirect&bpo=31369

   (42) https://bugs.python.org/issue?@action=redirect&bpo=45898

   (43) https://bugs.python.org/issue?@action=redirect&bpo=44953

   (44) https://bugs.python.org/issue?@action=redirect&bpo=44289

   (45) https://bugs.python.org/issue?@action=redirect&bpo=44011

   (46) https://bugs.python.org/issue?@action=redirect&bpo=41086

   (47) https://bugs.python.org/issue?@action=redirect&bpo=29418

   (48) https://bugs.python.org/issue?@action=redirect&bpo=14156


File: python.info,  Node: ドキュメント<31>,  Next: テスト<30>,  Prev: ライブラリ<96>,  Up: Python 3 11 0 alpha 6

1.24.37.9 ドキュメント
......................

   - bpo-42238(1): ‘Doc/tools/rstlint.py’ has moved to its own
     repository and is now packaged on PyPI as ‘sphinx-lint’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42238


File: python.info,  Node: テスト<30>,  Next: ビルド<36>,  Prev: ドキュメント<31>,  Up: Python 3 11 0 alpha 6

1.24.37.10 テスト
.................

   - bpo-46913(1): Fix test_faulthandler.test_sigfpe() if Python is
     built with undefined behavior sanitizer (UBSAN): disable UBSAN on
     the faulthandler_sigfpe() function.  Patch by Victor Stinner.

   - bpo-46760(2): Remove bytecode offsets from expected values in
     test.test_dis module.  Reduces the obstacles to modifying the VM or
     compiler.

   - bpo-46708(3): Prevent default asyncio event loop policy
     modification warning after ‘test_asyncio’ execution.

   - bpo-46678(4): The function ‘make_legacy_pyc’ in
     ‘Lib/test/support/import_helper.py’ no longer fails when
     ‘PYTHONPYCACHEPREFIX’ is set to a directory on a different device
     from where tempfiles are stored.

   - bpo-46623(5): Skip test_pair() and test_speech128() of test_zlib on
     s390x since they fail if zlib uses the s390x hardware accelerator.
     Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46913

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46760

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46708

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46678

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46623


File: python.info,  Node: ビルド<36>,  Next: Windows<32>,  Prev: テスト<30>,  Up: Python 3 11 0 alpha 6

1.24.37.11 ビルド
.................

   - bpo-46860(1): Respect ‘--with-suffix’ when building on
     case-insensitive file systems.

   - bpo-46656(2): Building Python now requires a C11 compiler.
     Optional C11 features are not required.  Patch by Victor Stinner.

   - bpo-46656(3): Building Python now requires support for
     floating-point Not-a-Number (NaN): remove the ‘Py_NO_NAN’ macro.
     Patch by Victor Stinner.

   - bpo-46640(4): Building Python now requires a C99 ‘<math.h>’ header
     file providing a ‘NAN’ constant, or the ‘__builtin_nan()’ built-in
     function.  Patch by Victor Stinner.

   - bpo-46608(5): Exclude marshalled-frozen data if deep-freezing to
     save 300 KB disk space.  This includes adding a new ‘is_package’
     field to *note _frozen: 979.  Patch by Kumar Aditya.

   - bpo-40280(6): Fix wasm32-emscripten test failures and platform
     issues.  - Disable syscalls that are not supported or don't work,
     e.g.  wait, getrusage, prlimit, mkfifo, mknod, setres[gu]id,
     setgroups.  - Use fd_count to count open fds.  - Add more checks
     for subprocess and fork.  - Add workarounds for missing
     _multiprocessing and failing socket.accept().  - Enable bzip2.  -
     Disable large file support.  - Disable signal.alarm.

   - bpo-46430(7): Intern strings in deep-frozen modules.  Patch by
     Kumar Aditya.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46860

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46656

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46656

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46640

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46608

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46430


File: python.info,  Node: Windows<32>,  Next: IDLE<16>,  Prev: ビルド<36>,  Up: Python 3 11 0 alpha 6

1.24.37.12 Windows
..................

   - bpo-46744(1): The default all users install directory for ARM64 is
     now under the native ‘Program Files’ folder, rather than ‘Program
     Files (Arm)’ which is intended for ARM (32-bit) files.

   - bpo-46567(2): Adds Tcl and Tk support for Windows ARM64.  This also
     adds IDLE to the installation.

   - bpo-46638(3): Ensures registry virtualization is consistently
     disabled.  For 3.10 and earlier, it remains enabled (some registry
     writes are protected), while for 3.11 and later it is disabled
     (registry modifications affect all applications).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46744

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46567

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46638


File: python.info,  Node: IDLE<16>,  Next: C API<32>,  Prev: Windows<32>,  Up: Python 3 11 0 alpha 6

1.24.37.13 IDLE
...............

   - bpo-46630(1): Make query dialogs on Windows start with a cursor in
     the entry box.

   - bpo-45447(2): Apply IDLE syntax highlighting to ‘.pyi’ files.
     Patch by Alex Waygood and Terry Jan Reedy.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46630

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45447


File: python.info,  Node: C API<32>,  Prev: IDLE<16>,  Up: Python 3 11 0 alpha 6

1.24.37.14 C API
................

   - bpo-46748(1): Python's public headers no longer import
     ‘<stdbool.h>’, leaving code that embeds/extends Python free to
     define ‘bool’, ‘true’ and ‘false’.

   - bpo-46836(2): Move the *note PyFrameObject: 98c. type definition
     (‘struct _frame’) to the internal C API ‘pycore_frame.h’ header
     file.  Patch by Victor Stinner.

   - bpo-45459(3): Rename ‘Include/buffer.h’ header file to
     ‘Include/pybuffer.h’ to avoid conflicts with projects having an
     existing ‘buffer.h’ header file.  Patch by Victor Stinner.

   - bpo-45412(4): Remove the ‘HAVE_PY_SET_53BIT_PRECISION’ macro (moved
     to the internal C API). Patch by Victor Stinner.

   - bpo-46613(5): Added function *note PyType_GetModuleByDef(): 635,
     which allows access to module state when a method's defining class
     is not available.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46748

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46836

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45459

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45412

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46613


File: python.info,  Node: Python 3 11 0 alpha 5,  Next: Python 3 11 0 alpha 4,  Prev: Python 3 11 0 alpha 6,  Up: 変更履歴

1.24.38 Python 3.11.0 alpha 5
-----------------------------

'Release date: 2022-02-03'

* Menu:

* Core and Builtins: Core and Builtins<94>.
* ライブラリ: ライブラリ<97>.
* Core and Builtins: Core and Builtins<95>.
* ライブラリ: ライブラリ<98>.
* ビルド: ビルド<37>.
* Core and Builtins: Core and Builtins<96>.
* ライブラリ: ライブラリ<99>.
* ドキュメント: ドキュメント<32>.
* テスト: テスト<31>.
* ビルド: ビルド<38>.
* Windows: Windows<33>.
* macOS: macOS<23>.
* IDLE: IDLE<17>.
* C API: C API<33>.


File: python.info,  Node: Core and Builtins<94>,  Next: ライブラリ<97>,  Up: Python 3 11 0 alpha 5

1.24.38.1 Core and Builtins
...........................

   - bpo-45773(1): Remove two invalid "peephole" optimizations from the
     bytecode compiler.

   - bpo-46564(2): Do not create frame objects when creating *note
     super: 1a6. object.  Patch by Kumar Aditya.

   - bpo-45885(3): Added more fined-grained specialization failure stats
     regarding the ‘COMPARE_OP’ bytecode.

   - bpo-44977(4): The delegation of *note int(): 19b. to ‘__trunc__()’
     is now deprecated.  Calling ‘int(a)’ when ‘type(a)’ implements
     ‘__trunc__()’ but not ‘__int__()’ or ‘__index__()’ now raises a
     *note DeprecationWarning: 1a3.

   - bpo-46458(5): Reorder code emitted by the compiler for a *note try:
     8f8.-*note except: 1ab. block so that the *note else: 17c. block's
     code immediately follows the *note try: 8f8. body (without a jump).
     This is more optimal for the happy path.

   - bpo-46527(6): Allow passing ‘iterable’ as a keyword argument to
     *note enumerate(): 169a. again.  Patch by Jelle Zijlstra.

   - bpo-46528(7): Replace several stack manipulation instructions
     (‘DUP_TOP’, ‘DUP_TOP_TWO’, ‘ROT_TWO’, ‘ROT_THREE’, ‘ROT_FOUR’, and
     ‘ROT_N’) with new *note COPY: 917. and *note SWAP: 918.
     instructions.

   - bpo-46329(8): Use two or three bytecodes to implement most calls.

     Calls without named arguments are implemented as a sequence of two
     instructions: ‘PRECALL; CALL’.  Calls with named arguments are
     implemented as a sequence of three instructions: ‘PRECALL;
     KW_NAMES; CALL’.  There are two different ‘PRECALL’ instructions:
     ‘PRECALL_FUNTION’ and ‘PRECALL_METHOD’.  The latter pairs with
     ‘LOAD_METHOD’.

     This partition into pre-call and call allows better specialization,
     and thus better performance ultimately.

     There is no change in semantics.

   - bpo-46503(9): Fix an assert when parsing some invalid N escape
     sequences in f-strings.

   - bpo-46431(10): Improve error message on invalid calls to
     ‘BaseExceptionGroup.__new__()’.

   - bpo-46476(11): Fix memory leak in code objects generated by
     deepfreeze.  Patch by Kumar Aditya.

   - bpo-46481(12): Speed up calls to ‘weakref.ref.__call__()’ by using
     the PEP 590(13) ‘vectorcall’ calling convention.  Patch by Donghee
     Na.

   - bpo-46417(14): Fix a race condition on setting a type ‘__bases__’
     attribute: the internal function ‘add_subclass()’ now gets the
     ‘PyTypeObject.tp_subclasses’ member after calling *note
     PyWeakref_NewRef(): 1be6. which can trigger a garbage collection
     which can indirectly modify ‘PyTypeObject.tp_subclasses’.  Patch by
     Victor Stinner.

   - bpo-46417(15): ‘python -X showrefcount’ now shows the total
     reference count after clearing and destroyed the main Python
     interpreter.  Previously, it was shown before.  Patch by Victor
     Stinner.

   - bpo-43683(16): Add ASYNC_GEN_WRAP opcode to wrap the value to be
     yielded in async generators.  Removes the need to special case
     async generators in the ‘YIELD_VALUE’ instruction.

   - bpo-46407(17): Optimize some modulo operations in
     ‘Objects/longobject.c’.  Patch by Jeremiah Vivian.

   - bpo-46409(18): Add new ‘RETURN_GENERATOR’ bytecode to make
     generators.  Simplifies calling Python functions in the VM, as they
     no longer any need to special case generator functions.

     Also add ‘JUMP_NO_INTERRUPT’ bytecode that acts like
     ‘JUMP_ABSOLUTE’, but does not check for interrupts.

   - bpo-46406(19): The integer division ‘//’ implementation has been
     optimized to better let the compiler understand its constraints.
     It can be 20% faster on the amd64 platform when dividing an int by
     a value smaller than ‘2**30’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45773

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46564

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45885

   (4) https://bugs.python.org/issue?@action=redirect&bpo=44977

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46458

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46527

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46528

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46329

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46503

   (10) https://bugs.python.org/issue?@action=redirect&bpo=46431

   (11) https://bugs.python.org/issue?@action=redirect&bpo=46476

   (12) https://bugs.python.org/issue?@action=redirect&bpo=46481

   (13) https://peps.python.org/pep-0590/

   (14) https://bugs.python.org/issue?@action=redirect&bpo=46417

   (15) https://bugs.python.org/issue?@action=redirect&bpo=46417

   (16) https://bugs.python.org/issue?@action=redirect&bpo=43683

   (17) https://bugs.python.org/issue?@action=redirect&bpo=46407

   (18) https://bugs.python.org/issue?@action=redirect&bpo=46409

   (19) https://bugs.python.org/issue?@action=redirect&bpo=46406


File: python.info,  Node: ライブラリ<97>,  Next: Core and Builtins<95>,  Prev: Core and Builtins<94>,  Up: Python 3 11 0 alpha 5

1.24.38.2 ライブラリ
....................

   - bpo-46383(1): Fix invalid signature of ‘_zoneinfo’'s ‘module_free’
     function to resolve a crash on wasm32-emscripten platform.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46383


File: python.info,  Node: Core and Builtins<95>,  Next: ライブラリ<98>,  Prev: ライブラリ<97>,  Up: Python 3 11 0 alpha 5

1.24.38.3 Core and Builtins
...........................

   - bpo-46361(1): Ensure that "small" integers created by *note
     int.from_bytes(): 1be9. and *note decimal.Decimal: 1fe. are
     properly cached.

   - bpo-46161(2): Fix the class building error when the arguments are
     constants and CALL_FUNCTION_EX is used.

   - bpo-46028(3): Fixes calculation of ‘sys._base_executable’ when
     inside a virtual environment that uses symlinks with different
     binary names than the base environment provides.

   - bpo-46091(4): Correctly calculate indentation levels for lines with
     whitespace character that are ended by line continuation
     characters.  Patch by Pablo Galindo

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46361

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46161

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46028

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46091


File: python.info,  Node: ライブラリ<98>,  Next: ビルド<37>,  Prev: Core and Builtins<95>,  Up: Python 3 11 0 alpha 5

1.24.38.4 ライブラリ
....................

   - bpo-30512(1): Add CAN Socket support for NetBSD.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30512


File: python.info,  Node: ビルド<37>,  Next: Core and Builtins<96>,  Prev: ライブラリ<98>,  Up: Python 3 11 0 alpha 5

1.24.38.5 ビルド
................

   - bpo-46045(1): Do not use POSIX semaphores on NetBSD

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46045


File: python.info,  Node: Core and Builtins<96>,  Next: ライブラリ<99>,  Prev: ビルド<37>,  Up: Python 3 11 0 alpha 5

1.24.38.6 Core and Builtins
...........................

   - bpo-44024(1): Improve the *note TypeError: 198. message for
     non-string second arguments passed to the built-in functions *note
     getattr(): dca. and *note hasattr(): 6f9.  Patch by Géry Ogam.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44024


File: python.info,  Node: ライブラリ<99>,  Next: ドキュメント<32>,  Prev: Core and Builtins<96>,  Up: Python 3 11 0 alpha 5

1.24.38.7 ライブラリ
....................

   - bpo-46624(1): Restore support for non-integer arguments of *note
     random.randrange(): a6b. and *note random.randint(): 1447.

   - bpo-46591(2): Make the IDLE doc URL on the About IDLE dialog
     clickable.

   - bpo-46565(3): Remove loop variables that are leaking into modules'
     namespaces.

   - bpo-46553(4): In *note typing.get_type_hints(): 8c0, support
     evaluating bare stringified ‘ClassVar’ annotations.  Patch by
     Gregory Beauregard.

   - bpo-46544(5): Don't leak ‘x’ & ‘uspace’ intermediate vars in *note
     textwrap.TextWrapper: 11cf.

   - bpo-46487(6): Add the ‘get_write_buffer_limits’ method to
     ‘asyncio.transports.WriteTransport’ and to the SSL transport.

   - bpo-45173(7): Note the configparser deprecations will be removed in
     Python 3.12.

   - bpo-45162(8): The deprecated *note unittest: 10c. APIs removed in
     3.11a1 have been temporarily restored to be removed in 3.12 while
     cleanups in external projects go in.

   - bpo-46539(9): In *note typing.get_type_hints(): 8c0, support
     evaluating stringified ‘ClassVar’ and ‘Final’ annotations inside
     ‘Annotated’.  Patch by Gregory Beauregard.

   - bpo-46510(10): Add missing test for *note types.TracebackType: cea.
     and *note types.FrameType: 1bee.  Calculate them directly from the
     caught exception without calling *note sys.exc_info(): 89a.

   - bpo-46491(11): Allow *note typing.Annotated: b37. to wrap *note
     typing.Final: 56e. and *note typing.ClassVar: 56d.  Patch by
     Gregory Beauregard.

   - bpo-46483(12): Remove *note __class_getitem__(): 943. from *note
     pathlib.PurePath: 6cd. as this class was not supposed to be
     generic.

   - bpo-46436(13): Fix command-line option ‘-d’/‘--directory’ in module
     *note http.server: 76. which is ignored when combined with
     command-line option ‘--cgi’.  Patch by Géry Ogam.

   - bpo-41403(14): Make ‘mock.patch()’ raise a *note TypeError: 198.
     with a relevant error message on invalid arg.  Previously it
     allowed a cryptic *note AttributeError: 5f0. to escape.

   - bpo-46474(15): In ‘importlib.metadata.EntryPoint.pattern’, avoid
     potential REDoS by limiting ambiguity in consecutive whitespace.

   - bpo-46474(16): Removed private method from
     ‘importlib.metadata.Path’.  Sync with importlib_metadata 4.10.0.

   - bpo-46470(17): Remove unused branch from
     ‘typing._remove_dups_flatten’

   - bpo-46469(18): *note asyncio: b. generic classes now return *note
     types.GenericAlias: 9ec. in ‘__class_getitem__’ instead of the same
     class.

   - bpo-41906(19): Support passing filter instances in the ‘filters’
     values of ‘handlers’ and ‘loggers’ in the dictionary passed to
     *note logging.config.dictConfig(): 13c8.

   - bpo-46422(20): Use ‘dis.Positions’ in ‘dis.Instruction’ instead of
     a regular ‘tuple’.

   - bpo-46434(21): *note pdb: aa. now gracefully handles ‘help’ when
     *note __doc__: 1bef. is missing, for example when run with
     pregenerated optimized ‘.pyc’ files.

   - bpo-43869(22): Python uses the same time Epoch on all platforms.
     Add an explicit unit test to ensure that it's the case.  Patch by
     Victor Stinner.

   - bpo-46414(23): Add *note typing.reveal_type(): 8b9.  Patch by Jelle
     Zijlstra.

   - bpo-40280(24): *note subprocess: dc. now imports Windows-specific
     imports when ‘msvcrt’ module is available, and POSIX-specific
     imports on all other platforms.  This gives a clean exception when
     ‘_posixsubprocess’ is not available (e.g.  Emscripten browser
     target).

   - bpo-40066(25): ‘IntEnum’, ‘IntFlag’, and ‘StrEnum’ use the mixed-in
     type for their ‘str()’ and ‘format()’ output.

   - bpo-46316(26): Optimize *note pathlib.Path.iterdir(): 26e. by
     removing an unnecessary check for special entries.

   - bpo-29688(27): Document *note pathlib.Path.absolute(): 1a26. (which
     has always existed).

   - bpo-43012(28): The pathlib module's obsolete and internal
     ‘_Accessor’ class has been removed to prepare the terrain for
     upcoming enhancements to the module.

   - bpo-46258(29): Speed up *note math.isqrt(): bf8. for small positive
     integers by replacing two division steps with a lookup table.

   - bpo-46242(30): Improve error message when creating a new *note
     enum.Enum: 842. type subclassing an existing ‘Enum’ with
     ‘_member_names_’ using ‘enum.Enum.__call__()’.

   - bpo-43118(31): Fix a bug in *note inspect.signature(): 22f. that
     was causing it to fail on some subclasses of classes with a
     ‘__text_signature__’ referencing module globals.  Patch by Weipeng
     Hong.

   - bpo-26552(32): Fixed case where failing *note
     asyncio.ensure_future(): e71. did not close the coroutine.  Patch
     by Kumar Aditya.

   - bpo-21987(33): Fix an issue with *note tarfile.TarFile.getmember():
     1bf0. getting a directory name with a trailing slash.

   - bpo-46124(34): Update *note zoneinfo: 13a. to rely on
     importlib.resources traversable API.

   - bpo-46103(35): Now *note inspect.getmembers(): 1bf1. only gets
     ‘__bases__’ attribute from class type.  Patch by Weipeng Hong.

   - bpo-46080(36): Fix exception in argparse help text generation if a
     *note argparse.BooleanOptionalAction: 1bf2. argument's default is
     ‘argparse.SUPPRESS’ and it has ‘help’ specified.  Patch by Felix
     Fontein.

   - bpo-44791(37): Fix substitution of *note ParamSpec: 487. in *note
     Concatenate: 9c7. with different parameter expressions.
     Substitution with a list of types returns now a tuple of types.
     Substitution with ‘Concatenate’ returns now a ‘Concatenate’ with
     concatenated lists of arguments.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46624

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46591

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46565

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46553

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46544

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46487

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45173

   (8) https://bugs.python.org/issue?@action=redirect&bpo=45162

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46539

   (10) https://bugs.python.org/issue?@action=redirect&bpo=46510

   (11) https://bugs.python.org/issue?@action=redirect&bpo=46491

   (12) https://bugs.python.org/issue?@action=redirect&bpo=46483

   (13) https://bugs.python.org/issue?@action=redirect&bpo=46436

   (14) https://bugs.python.org/issue?@action=redirect&bpo=41403

   (15) https://bugs.python.org/issue?@action=redirect&bpo=46474

   (16) https://bugs.python.org/issue?@action=redirect&bpo=46474

   (17) https://bugs.python.org/issue?@action=redirect&bpo=46470

   (18) https://bugs.python.org/issue?@action=redirect&bpo=46469

   (19) https://bugs.python.org/issue?@action=redirect&bpo=41906

   (20) https://bugs.python.org/issue?@action=redirect&bpo=46422

   (21) https://bugs.python.org/issue?@action=redirect&bpo=46434

   (22) https://bugs.python.org/issue?@action=redirect&bpo=43869

   (23) https://bugs.python.org/issue?@action=redirect&bpo=46414

   (24) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (25) https://bugs.python.org/issue?@action=redirect&bpo=40066

   (26) https://bugs.python.org/issue?@action=redirect&bpo=46316

   (27) https://bugs.python.org/issue?@action=redirect&bpo=29688

   (28) https://bugs.python.org/issue?@action=redirect&bpo=43012

   (29) https://bugs.python.org/issue?@action=redirect&bpo=46258

   (30) https://bugs.python.org/issue?@action=redirect&bpo=46242

   (31) https://bugs.python.org/issue?@action=redirect&bpo=43118

   (32) https://bugs.python.org/issue?@action=redirect&bpo=26552

   (33) https://bugs.python.org/issue?@action=redirect&bpo=21987

   (34) https://bugs.python.org/issue?@action=redirect&bpo=46124

   (35) https://bugs.python.org/issue?@action=redirect&bpo=46103

   (36) https://bugs.python.org/issue?@action=redirect&bpo=46080

   (37) https://bugs.python.org/issue?@action=redirect&bpo=44791


File: python.info,  Node: ドキュメント<32>,  Next: テスト<31>,  Prev: ライブラリ<99>,  Up: Python 3 11 0 alpha 5

1.24.38.8 ドキュメント
......................

   - bpo-46463(1): Fixes ‘escape4chm.py’ script used when building the
     CHM documentation file

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46463


File: python.info,  Node: テスト<31>,  Next: ビルド<38>,  Prev: ドキュメント<32>,  Up: Python 3 11 0 alpha 5

1.24.38.9 テスト
................

   - bpo-43478(1): Mocks can no longer be provided as the specs for
     other Mocks.  As a result, an already-mocked object cannot be
     passed to ‘mock.Mock()’.  This can uncover bugs in tests since
     these Mock-derived Mocks will always pass certain tests (e.g.
     isinstance) and builtin assert functions (e.g.
     assert_called_once_with) will unconditionally pass.

   - bpo-46616(2): Ensures ‘test_importlib.test_windows’ cleans up
     registry keys after completion.

   - bpo-44359(3): test_ftplib now silently ignores socket errors to
     prevent logging unhandled threading exceptions.  Patch by Victor
     Stinner.

   - bpo-46600(4): Fix test_gdb.test_pycfunction() for Python built with
     ‘clang -Og’.  Tolerate inlined functions in the gdb traceback.
     Patch by Victor Stinner.

   - bpo-46542(5): Fix a Python crash in test_lib2to3 when using Python
     built in debug mode: limit the recursion limit.  Patch by Victor
     Stinner.

   - bpo-46576(6): test_peg_generator now disables compiler optimization
     when testing compilation of its own C extensions to significantly
     speed up the testing on non-debug builds of CPython.

   - bpo-46542(7): Fix ‘test_json’ tests checking for *note
     RecursionError: f68.: modify these tests to use
     ‘support.infinite_recursion()’.  Patch by Victor Stinner.

   - bpo-13886(8): Skip test_builtin PTY tests on non-ASCII characters
     if the readline module is loaded.  The readline module changes
     input() behavior, but test_builtin is not intended to test the
     readline module.  Patch by Victor Stinner.

   - bpo-40280(9): Add ‘test.support.requires_fork()’ decorators to mark
     tests that require a working *note os.fork(): 4b5.

   - bpo-40280(10): Add ‘test.support.requires_subprocess()’ decorator
     to mark tests which require working *note subprocess: dc. module or
     ‘os.spawn*’.  The wasm32-emscripten platform has no support for
     processes.

   - bpo-46126(11): Disable 'descriptions' when running tests
     internally.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43478

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46616

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44359

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46600

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46542

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46576

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46542

   (8) https://bugs.python.org/issue?@action=redirect&bpo=13886

   (9) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (10) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (11) https://bugs.python.org/issue?@action=redirect&bpo=46126


File: python.info,  Node: ビルド<38>,  Next: Windows<33>,  Prev: テスト<31>,  Up: Python 3 11 0 alpha 5

1.24.38.10 ビルド
.................

   - bpo-46602(1): Tidied up configure.ac so that conftest.c is
     truncated rather than appended.  This assists in the case where the
     'rm' of conftest.c fails to happen between tests.  Downstream
     issues such as a clobbered SOABI can result.

   - bpo-46600(2): Fix the test checking if the C compiler supports
     ‘-Og’ option in the ‘./configure’ script to also use ‘-Og’ on clang
     which supports it.  Patch by Victor Stinner.

   - bpo-38472(3): Fix GCC detection in setup.py when cross-compiling.
     The C compiler is now run with LC_ALL=C. Previously, the detection
     failed with a German locale.

   - bpo-46513(4): ‘configure’ no longer uses ‘AC_C_CHAR_UNSIGNED’ macro
     and ‘pyconfig.h’ no longer defines reserved symbol
     ‘__CHAR_UNSIGNED__’.

   - bpo-46471(5): Use global singletons for single byte bytes objects
     in deepfreeze.

   - bpo-46443(6): Deepfreeze now uses cached small integers as it saves
     some space for common small integers.

   - bpo-46429(7): Merge all deep-frozen files into one for space
     savings.  Patch by Kumar Aditya.

   - bpo-45569(8): The build now defaults to using 30-bit digits for
     Python integers.  Previously either 15-bit or 30-bit digits would
     be selected, depending on the platform.  15-bit digits may still be
     selected using the ‘--enable-big-digits=15’ option to the
     ‘configure’ script, or by defining ‘PYLONG_BITS_IN_DIGIT’ in
     ‘pyconfig.h’.

   - bpo-45925(9): Update Windows installer to use SQLite 3.37.2.

   - bpo-43112(10): Detect musl libc as a separate SOABI (tagged as
     ‘linux-musl’).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46602

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46600

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38472

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46513

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46471

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46443

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46429

   (8) https://bugs.python.org/issue?@action=redirect&bpo=45569

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45925

   (10) https://bugs.python.org/issue?@action=redirect&bpo=43112


File: python.info,  Node: Windows<33>,  Next: macOS<23>,  Prev: ビルド<38>,  Up: Python 3 11 0 alpha 5

1.24.38.11 Windows
..................

   - bpo-33125(1): The traditional EXE/MSI based installer for Windows
     is now available for ARM64

   - bpo-46362(2): os.path.abspath("C:CON") is now fixed to return
     "\.CON", not the same path.  The regression was true of all legacy
     DOS devices such as COM1, LPT1, or NUL.

   - bpo-44934(3): The installer now offers a command-line only option
     to add the installation directory to the end of ‘PATH’ instead of
     at the start.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33125

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46362

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44934


File: python.info,  Node: macOS<23>,  Next: IDLE<17>,  Prev: Windows<33>,  Up: Python 3 11 0 alpha 5

1.24.38.12 macOS
................

   - bpo-45925(1): Update macOS installer to SQLite 3.37.2.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45925


File: python.info,  Node: IDLE<17>,  Next: C API<33>,  Prev: macOS<23>,  Up: Python 3 11 0 alpha 5

1.24.38.13 IDLE
...............

   - bpo-45296(1): Clarify close, quit, and exit in IDLE. In the File
     menu, 'Close' and 'Exit' are now 'Close Window' (the current one)
     and 'Exit' is now 'Exit IDLE' (by closing all windows).  In Shell,
     'quit()' and 'exit()' mean 'close Shell'.  If there are no other
     windows, this also exits IDLE.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45296


File: python.info,  Node: C API<33>,  Prev: IDLE<17>,  Up: Python 3 11 0 alpha 5

1.24.38.14 C API
................

   - bpo-40170(1): Remove the ‘PyHeapType_GET_MEMBERS()’ macro.  It was
     exposed in the public C API by mistake, it must only be used by
     Python internally.  Use the ‘PyTypeObject.tp_members’ member
     instead.  Patch by Victor Stinner.

   - bpo-40170(2): Move _Py_GetAllocatedBlocks() and
     _PyObject_DebugMallocStats() private functions to the internal C
     API. Patch by Victor Stinner.

   - bpo-46433(3): The internal function _PyType_GetModuleByDef now
     correctly handles inheritance patterns involving static types.

   - bpo-45459(4): *note Py_buffer: 95c. and various ‘Py_buffer’ related
     functions are now part of the limited API and stable ABI.

   - bpo-14916(5): Fixed bug in the tokenizer that prevented
     ‘PyRun_InteractiveOne’ from parsing from the provided FD.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40170

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40170

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46433

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45459

   (5) https://bugs.python.org/issue?@action=redirect&bpo=14916


File: python.info,  Node: Python 3 11 0 alpha 4,  Next: Python 3 11 0 alpha 3,  Prev: Python 3 11 0 alpha 5,  Up: 変更履歴

1.24.39 Python 3.11.0 alpha 4
-----------------------------

'リリース日: 2022-01-13'

* Menu:

* Core and Builtins: Core and Builtins<97>.
* ライブラリ: ライブラリ<100>.
* Core and Builtins: Core and Builtins<98>.
* ライブラリ: ライブラリ<101>.
* Core and Builtins: Core and Builtins<99>.
* ライブラリ: ライブラリ<102>.
* Core and Builtins: Core and Builtins<100>.
* ライブラリ: ライブラリ<103>.
* ドキュメント: ドキュメント<33>.
* テスト: テスト<32>.
* ビルド: ビルド<39>.
* Windows: Windows<34>.
* macOS: macOS<24>.
* C API: C API<34>.


File: python.info,  Node: Core and Builtins<97>,  Next: ライブラリ<100>,  Up: Python 3 11 0 alpha 4

1.24.39.1 Core and Builtins
...........................

   - bpo-46070(1): *note Py_EndInterpreter(): 1845. now explicitly
     untracks all objects currently tracked by the GC. Previously, if an
     object was used later by another interpreter, calling *note
     PyObject_GC_UnTrack(): 171e. on the object crashed if the previous
     or the next object of the ‘PyGC_Head’ structure became a dangling
     pointer.  Patch by Victor Stinner.

   - bpo-46347(2): Fix memory leak in PyEval_EvalCodeEx.

   - bpo-46339(3): Fix a crash in the parser when retrieving the error
     text for multi-line f-strings expressions that do not start in the
     first line of the string.  Patch by Pablo Galindo

   - bpo-46331(4): Do not set line number of instruction storing
     doc-string.  Fixes regression introduced in 3.11 alpha.

   - bpo-46314(5): Remove spurious "call" event when creating a lambda
     function that was accidentally introduced in 3.11a4.

   - bpo-46289(6): ASDL declaration of ‘FormattedValue’ has changed to
     reflect ‘conversion’ field is not optional.

   - bpo-46297(7): Fixed an interpreter crash on bootup with multiple
     PythonPaths set in the Windows registry.  Patch by Derzsi Dániel.

   - bpo-46237(8): Fix the line number of tokenizer errors inside
     f-strings.  Patch by Pablo Galindo.

   - bpo-46263(9): We always expect the "use_frozen_modules" config to
     be set, now that getpath.c was rewritten in pure Python and the
     logic improved.

   - bpo-46006(10): Fix a regression when a type method like
     ‘__init__()’ is modified in a subinterpreter.  Fix a regression in
     ‘_PyUnicode_EqualToASCIIId()’ and type ‘update_slot()’.  Revert the
     change which made the Unicode dictionary of interned strings
     compatible with subinterpreters: the internal interned dictionary
     is shared again by all interpreters.  Patch by Victor Stinner.

   - bpo-45923(11): Add RESUME opcode.  This is a logical no-op.  It is
     emitted by the compiler anywhere a Python function can be entered.
     It is used by the interpreter to perform tracing and optimizer
     checks.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46070

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46347

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46339

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46331

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46314

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46289

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46297

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46237

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46263

   (10) https://bugs.python.org/issue?@action=redirect&bpo=46006

   (11) https://bugs.python.org/issue?@action=redirect&bpo=45923


File: python.info,  Node: ライブラリ<100>,  Next: Core and Builtins<98>,  Prev: Core and Builtins<97>,  Up: Python 3 11 0 alpha 4

1.24.39.2 ライブラリ
....................

   - bpo-46208(1): Fix the regression of os.path.normpath("A/../../B")
     not returning expected "../B" but "B".

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46208


File: python.info,  Node: Core and Builtins<98>,  Next: ライブラリ<101>,  Prev: ライブラリ<100>,  Up: Python 3 11 0 alpha 4

1.24.39.3 Core and Builtins
...........................

   - bpo-46240(1): Correct the error message for unclosed parentheses
     when the tokenizer doesn't reach the end of the source when the
     error is reported.  Patch by Pablo Galindo

   - bpo-46009(2): Remove the ‘GEN_START’ opcode.

   - bpo-46235(3): Certain sequence multiplication operations like ‘[0]
     * 1_000’ are now faster due to reference-counting optimizations.
     Patch by Dennis Sweeney.

   - bpo-46221(4): ‘PREP_RERAISE_STAR’ no longer pushes ‘lasti’ to the
     stack.

   - bpo-46202(5): Remove ‘POP_EXCEPT_AND_RERAISE’ and replace it by an
     equivalent sequence of other opcodes.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46240

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46009

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46235

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46221

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46202


File: python.info,  Node: ライブラリ<101>,  Next: Core and Builtins<99>,  Prev: Core and Builtins<98>,  Up: Python 3 11 0 alpha 4

1.24.39.4 ライブラリ
....................

   - bpo-46085(1): Fix iterator cache mechanism of ‘OrderedDict’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46085


File: python.info,  Node: Core and Builtins<99>,  Next: ライブラリ<102>,  Prev: ライブラリ<101>,  Up: Python 3 11 0 alpha 4

1.24.39.5 Core and Builtins
...........................

   - bpo-46055(1): Speed up shifting operation involving integers less
     than *note PyLong_BASE: 1c00.  Patch by Xinhang Xu.

   - bpo-46110(2): Add a maximum recursion check to the PEG parser to
     avoid stack overflow.  Patch by Pablo Galindo

   - bpo-46107(3): Fix bug where ‘ExceptionGroup.split()’ and
     ‘ExceptionGroup.subgroup()’ did not copy the exception group's
     ‘__note__’ field to the parts.

   - bpo-45711(4): The interpreter state's representation of handled
     exceptions (a.k.a exc_info, or _PyErr_StackItem) now has only the
     ‘exc_value’ field, ‘exc_type’ and ‘exc_traceback’ have been removed
     as their values can be derived from ‘exc_value’.

   - bpo-44525(5): Replace the four call bytecode instructions which one
     pre-call instruction and two call instructions.

     Removes ‘CALL_FUNCTION’, ‘CALL_FUNCTION_KW’, ‘CALL_METHOD’ and
     ‘CALL_METHOD_KW’.

     Adds ‘CALL_NO_KW’ and ‘CALL_KW’ call instructions, and
     ‘PRECALL_METHOD’ prefix for pairing with ‘LOAD_METHOD’.

   - bpo-46039(6): Remove the ‘YIELD_FROM’ instruction and replace it
     with the ‘SEND’ instruction which performs the same operation, but
     without the loop.

   - bpo-45635(7): The code called from ‘_PyErr_Display()’ was
     refactored to improve error handling.  It now exits immediately
     upon an unrecoverable error.

   - bpo-46054(8): Fix parser error when parsing non-utf8 characters in
     source files.  Patch by Pablo Galindo.

   - bpo-46042(9): Improve the location of the caret in *note
     SyntaxError: 18e. exceptions emitted by the symbol table.  Patch by
     Pablo Galindo.

   - bpo-46049(10): Ensure ‘._pth’ files work as intended on platforms
     other than Windows.

   - bpo-46048(11): Fixes parsing of ‘._pth’ files on startup so that
     single-character paths are correctly read.

   - bpo-37971(12): Fix a bug where the line numbers given in a
     traceback when a decorator application raised an exception were
     wrong.

   - bpo-46031(13): Add *note POP_JUMP_IF_NOT_NONE: 1b80. and *note
     POP_JUMP_IF_NONE: 1b7f. opcodes to speed up conditional jumps.

   - bpo-45654(14): Deepfreeze *note runpy: c3, patch by Kumar Aditya.

   - bpo-46025(15): Fix a crash in the *note atexit: d. module involving
     functions that unregister themselves before raising exceptions.
     Patch by Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46055

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46110

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46107

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45711

   (5) https://bugs.python.org/issue?@action=redirect&bpo=44525

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46039

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45635

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46054

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46042

   (10) https://bugs.python.org/issue?@action=redirect&bpo=46049

   (11) https://bugs.python.org/issue?@action=redirect&bpo=46048

   (12) https://bugs.python.org/issue?@action=redirect&bpo=37971

   (13) https://bugs.python.org/issue?@action=redirect&bpo=46031

   (14) https://bugs.python.org/issue?@action=redirect&bpo=45654

   (15) https://bugs.python.org/issue?@action=redirect&bpo=46025


File: python.info,  Node: ライブラリ<102>,  Next: Core and Builtins<100>,  Prev: Core and Builtins<99>,  Up: Python 3 11 0 alpha 4

1.24.39.6 ライブラリ
....................

   - bpo-46000(1): Improve compatibility of the *note curses: 2f. module
     with NetBSD curses.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46000


File: python.info,  Node: Core and Builtins<100>,  Next: ライブラリ<103>,  Prev: ライブラリ<102>,  Up: Python 3 11 0 alpha 4

1.24.39.7 Core and Builtins
...........................

   - bpo-44525(1): Specialize the CALL_FUNCTION instruction for calls to
     builtin types with a single argument.  Speeds up ‘range(x)’,
     ‘list(x)’, and specifically ‘type(obj)’.

   - bpo-42918(2): Fix bug where the built-in *note compile(): 4b1.
     function did not always raise a *note SyntaxError: 18e. when passed
     multiple statements in 'single' mode.  Patch by Weipeng Hong.

   - bpo-45953(3): The main interpreter in _PyRuntimeState.interpreters
     is now statically allocated (as part of _PyRuntime).  Likewise for
     the initial thread state of each interpreter.  This means less
     allocation during runtime init, as well as better memory locality
     for these key state objects.

   - bpo-45292(4): Complete the PEP 654(5) implementation: add
     ‘except*’.

   - bpo-43413(6): Revert changes in ‘set.__init__’.  Subclass of *note
     set: 184. needs to define a ‘__init__()’ method if it defines a
     ‘__new__()’ method with additional keyword parameters.

   - bpo-43931(7): Added the *note Py_Version: 381. constant which bears
     the same value as *note PY_VERSION_HEX: 382.  Patch by Gabriele N.
     Tornetta.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44525

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42918

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45953

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45292

   (5) https://peps.python.org/pep-0654/

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43413

   (7) https://bugs.python.org/issue?@action=redirect&bpo=43931


File: python.info,  Node: ライブラリ<103>,  Next: ドキュメント<33>,  Prev: Core and Builtins<100>,  Up: Python 3 11 0 alpha 4

1.24.39.8 ライブラリ
....................

   - bpo-46342(1): The ‘@typing.final’ decorator now sets the
     ‘__final__’ attribute on the decorated object to allow runtime
     introspection.  Patch by Jelle Zijlstra.

   - bpo-46328(2): Added the *note sys.exception(): 89b. method which
     returns the active exception instance.

   - bpo-46307(3): Add *note string.Template.is_valid(): 896. and *note
     string.Template.get_identifiers(): 895. methods.

   - bpo-46306(4): Assume that *note types.CodeType: 32f. always has
     ‘types.CodeType.co_firstlineno’ in *note doctest: 3e.

   - bpo-40479(5): Fix *note hashlib: 6c. 'usedforsecurity' option to
     work correctly with OpenSSL 3.0.0 in FIPS mode.

   - bpo-46070(6): Fix possible segfault when importing the *note
     asyncio: b. module from different sub-interpreters in parallel.
     Patch by Erlend E. Aasland.

   - bpo-46244(7): Removed ‘__slots__’ from *note typing.ParamSpec: 487.
     and *note typing.TypeVar: 486.  They served no purpose.  Patch by
     Arie Bovenberg.

   - bpo-46278(8): Reflect ‘context’ argument in
     ‘AbstractEventLoop.call_*()’ methods.  Loop implementations already
     support it.

   - bpo-46269(9): Remove special-casing of ‘__new__’ in *note
     enum.Enum.__dir__(): 1c04.

   - bpo-46266(10): Improve day constants in *note calendar: 15.

     Now all constants (‘MONDAY’ ...  ‘SUNDAY’) are documented, tested,
     and added to ‘__all__’.

   - bpo-46257(11): Optimized the mean, variance, and stdev functions in
     the statistics module.  If the input is an iterator, it is consumed
     in a single pass rather than eating memory by conversion to a list.
     The single pass algorithm is about twice as fast as the previous
     two pass code.

   - bpo-41011(12): Added two new variables to 'pyvenv.cfg' which is
     generated by *note venv: 117. module: 'executable' for the
     executable and 'command' for the command line used to create the
     environment.

   - bpo-46239(13): Improve error message when importing
     ‘asyncio.windows_events’ on non-Windows.

   - bpo-46238(14): Reuse ‘_winapi’ constants in
     ‘asyncio.windows_events’.

   - bpo-46222(15): Adding ‘SF_NOCACHE’ sendfile constant for FreeBSD
     for the posixmodule.

   - bpo-37295(16): Add fast path for ‘0 <= k <= n <= 67’ for *note
     math.comb(): 8df.

   - bpo-46176(17): Adding the ‘MAP_STACK’ constant for the mmap module.

   - bpo-43424(18): Deprecate ‘webbrowser.MacOSXOSAScript._name’ and use
     ‘name’ instead.

   - bpo-45321(19): Added missing error codes to module
     ‘xml.parsers.expat.errors’.

   - bpo-46125(20): Refactor tests to test traversable API directly.
     Includes changes from importlib 5.4.0.

   - bpo-46118(21): Moved importlib.resources and its related
     functionality to a package.

   - bpo-37578(22): Add 'include_hidden' parameter to *note glob(): 5a0.
     and *note iglob(): a08. to match hidden files and directories when
     using special characters like ‘*’, ‘**’, ‘?’ and ‘[]’.

   - bpo-20369(23): *note concurrent.futures.wait(): 1c05. no longer
     blocks forever when given duplicate Futures.  Patch by Kumar
     Aditya.

   - bpo-46105(24): Honor spec when generating requirement specs with
     urls and extras (importlib_metadata 4.8.3).

   - bpo-44893(25): EntryPoint objects are no longer tuples.
     Recommended means to access is by attribute ('.name', '.group') or
     accessor ('.load()').  Access by index is deprecated and will raise
     deprecation warning.

   - bpo-22815(26): Print unexpected successes together with failures
     and errors in summary in *note unittest.TextTestResult: 754.

   - bpo-22047(27): Calling ‘add_argument_group()’ on an argument group
     is deprecated.  Calling ‘add_argument_group()’ or
     ‘add_mutually_exclusive_group()’ on a mutually exclusive group is
     deprecated.

     These features were never supported and do not always work
     correctly.  The functions exist on the API by accident through
     inheritance and will be removed in the future.

   - bpo-26952(28): *note argparse: 7. raises *note ValueError: 2ec.
     with clear message when trying to render usage for an empty
     mutually exclusive group.  Previously it raised a cryptic *note
     IndexError: 174e.

   - bpo-45615(29): Functions in the *note traceback: 104. module raise
     *note TypeError: 198. rather than *note AttributeError: 5f0. when
     an exception argument is not of type *note BaseException: 7d6.

   - bpo-16594(30): Add allow allow_reuse_port flag in socketserver.

   - bpo-27718(31): Fix help for the *note signal: cb. module.  Some
     functions (e.g.  ‘signal()’ and ‘getsignal()’) were omitted.

   - bpo-46032(32): The ‘registry()’ method of *note
     functools.singledispatch(): 84b. functions checks now the first
     argument or the first parameter annotation and raises a TypeError
     if it is not supported.  Previously unsupported "types" were
     ignored (e.g.  ‘typing.List[int]’) or caused an error at calling
     time (e.g.  ‘list[int]’).

   - bpo-46014(33): Add ability to use ‘typing.Union’ and
     ‘types.UnionType’ as dispatch argument to
     ‘functools.singledispatch’.  Patch provided by Yurii Karabas.

   - bpo-27062(34): Add ‘__all__’ to *note inspect: 82, patch by Kumar
     Aditya.

   - bpo-46018(35): Ensure that *note math.expm1(): 1405. does not raise
     on underflow.

   - bpo-46016(36): Adding ‘F_DUP2FD’ and ‘F_DUP2FD_CLOEXEC’ constants
     from FreeBSD into the *note fcntl: 5d. module.

   - bpo-45755(37): *note typing: 10a. generic aliases now reveal the
     class attributes of the original generic class when passed to
     ‘dir()’.  This was the behavior up to Python 3.6, but was changed
     in 3.7-3.9.

   - bpo-45874(38): The empty query string, consisting of no query
     arguments, is now handled correctly in ‘urllib.parse.parse_qsl’.
     This caused problems before when strict parsing was enabled.

   - bpo-44674(39): Change how dataclasses disallows mutable default
     values.  It used to use a list of known types (list, dict, set).
     Now it disallows unhashable objects to be defaults.  It's using
     unhashability as a proxy for mutability.  Patch by Eric V. Smith,
     idea by Raymond Hettinger.

   - bpo-23882(40): Remove namespace package (PEP 420) support from
     unittest discovery.  It was introduced in Python 3.4 but has been
     broken since Python 3.7.

   - bpo-25066(41): Added a ‘__repr__()’ method to *note
     multiprocessing.Event: 1c06. objects, patch by Kumar Aditya.

   - bpo-45643(42): Added *note signal.SIGSTKFLT: 1c07. on platforms
     where this signal is defined.

   - bpo-44092(43): Fetch across rollback no longer raises *note
     InterfaceError: 88d.  Instead we leave it to the SQLite library to
     handle these cases.  Patch by Erlend E. Aasland.

   - bpo-42413(44): Replace ‘concurrent.futures.TimeoutError’ and
     ‘asyncio.TimeoutError’ with builtin *note TimeoutError: a36, keep
     these names as deprecated aliases.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46342

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46328

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46307

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46306

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40479

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46070

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46244

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46278

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46269

   (10) https://bugs.python.org/issue?@action=redirect&bpo=46266

   (11) https://bugs.python.org/issue?@action=redirect&bpo=46257

   (12) https://bugs.python.org/issue?@action=redirect&bpo=41011

   (13) https://bugs.python.org/issue?@action=redirect&bpo=46239

   (14) https://bugs.python.org/issue?@action=redirect&bpo=46238

   (15) https://bugs.python.org/issue?@action=redirect&bpo=46222

   (16) https://bugs.python.org/issue?@action=redirect&bpo=37295

   (17) https://bugs.python.org/issue?@action=redirect&bpo=46176

   (18) https://bugs.python.org/issue?@action=redirect&bpo=43424

   (19) https://bugs.python.org/issue?@action=redirect&bpo=45321

   (20) https://bugs.python.org/issue?@action=redirect&bpo=46125

   (21) https://bugs.python.org/issue?@action=redirect&bpo=46118

   (22) https://bugs.python.org/issue?@action=redirect&bpo=37578

   (23) https://bugs.python.org/issue?@action=redirect&bpo=20369

   (24) https://bugs.python.org/issue?@action=redirect&bpo=46105

   (25) https://bugs.python.org/issue?@action=redirect&bpo=44893

   (26) https://bugs.python.org/issue?@action=redirect&bpo=22815

   (27) https://bugs.python.org/issue?@action=redirect&bpo=22047

   (28) https://bugs.python.org/issue?@action=redirect&bpo=26952

   (29) https://bugs.python.org/issue?@action=redirect&bpo=45615

   (30) https://bugs.python.org/issue?@action=redirect&bpo=16594

   (31) https://bugs.python.org/issue?@action=redirect&bpo=27718

   (32) https://bugs.python.org/issue?@action=redirect&bpo=46032

   (33) https://bugs.python.org/issue?@action=redirect&bpo=46014

   (34) https://bugs.python.org/issue?@action=redirect&bpo=27062

   (35) https://bugs.python.org/issue?@action=redirect&bpo=46018

   (36) https://bugs.python.org/issue?@action=redirect&bpo=46016

   (37) https://bugs.python.org/issue?@action=redirect&bpo=45755

   (38) https://bugs.python.org/issue?@action=redirect&bpo=45874

   (39) https://bugs.python.org/issue?@action=redirect&bpo=44674

   (40) https://bugs.python.org/issue?@action=redirect&bpo=23882

   (41) https://bugs.python.org/issue?@action=redirect&bpo=25066

   (42) https://bugs.python.org/issue?@action=redirect&bpo=45643

   (43) https://bugs.python.org/issue?@action=redirect&bpo=44092

   (44) https://bugs.python.org/issue?@action=redirect&bpo=42413


File: python.info,  Node: ドキュメント<33>,  Next: テスト<32>,  Prev: ライブラリ<103>,  Up: Python 3 11 0 alpha 4

1.24.39.9 ドキュメント
......................

   - bpo-46196(1): Document method *note cmd.Cmd.columnize(): 1c09.

   - bpo-46120(2): State that ‘|’ is preferred for readability over
     ‘Union’ in the *note typing: 10a. docs.

   - bpo-46109(3): Extracted ‘importlib.resources’ and
     ‘importlib.resources.abc’ documentation into separate files.

   - bpo-19737(4): Update the documentation for the *note globals():
     1c0a. function.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46196

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46120

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46109

   (4) https://bugs.python.org/issue?@action=redirect&bpo=19737


File: python.info,  Node: テスト<32>,  Next: ビルド<39>,  Prev: ドキュメント<33>,  Up: Python 3 11 0 alpha 4

1.24.39.10 テスト
.................

   - bpo-46296(1): Add a test case for *note enum: 5a. with ‘_use_args_
     == True’ and ‘_member_type_ == object’.

   - bpo-46205(2): Fix hang in runtest_mp due to race condition

   - bpo-46263(3): Fix test_capi on FreeBSD 14-dev: instruct jemalloc to
     not fill freed memory with junk byte.

   - bpo-46262(4): Cover ‘ValueError’ path in tests for
     ‘enum.Flag._missing_()’.

   - bpo-46150(5): Now ‘fakename’ in
     ‘test_pathlib.PosixPathTest.test_expanduser’ is checked to be
     non-existent.

   - bpo-46129(6): Rewrite ‘asyncio.locks’ tests with *note
     unittest.IsolatedAsyncioTestCase: 361. usage.

   - bpo-23819(7): Fixed *note asyncio: b. tests in python optimized
     mode.  Patch by Kumar Aditya.

   - bpo-46114(8): Fix test case for OpenSSL 3.0.1 version.  OpenSSL 3.0
     uses ‘0xMNN00PP0L’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46296

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46205

   (3) https://bugs.python.org/issue?@action=redirect&bpo=46263

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46262

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46150

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46129

   (7) https://bugs.python.org/issue?@action=redirect&bpo=23819

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46114


File: python.info,  Node: ビルド<39>,  Next: Windows<34>,  Prev: テスト<32>,  Up: Python 3 11 0 alpha 4

1.24.39.11 ビルド
.................

   - bpo-44133(1): When Python is configured with *note
     -without-static-libpython: a8e, the Python static library
     (libpython.a) is no longer built.  Patch by Victor Stinner.

   - bpo-44133(2): When Python is built without *note -enable-shared:
     a63, the ‘python’ program is now linked to object files, rather
     than being linked to the Python static library (libpython.a), to
     make sure that all symbols are exported.  Previously, the linker
     omitted some symbols like the ‘Py_FrozenMain()’ function.  Patch by
     Victor Stinner.

   - bpo-40280(3): The ‘configure’ script has a new option
     ‘--with-emscripten-target’ to select browser or node as Emscripten
     build target.

   - bpo-46315(4): Added and fixed ‘#ifdef HAVE_FEATURE’ checks for
     functionality that is not available on WASI platform.

   - bpo-45723(5): Fixed a regression in ‘configure’ check for *note
     select.epoll(): 1196.

   - bpo-46263(6): ‘configure’ no longer sets ‘MULTIARCH’ on FreeBSD
     platforms.

   - bpo-46106(7): Updated OpenSSL to 1.1.1m in Windows builds, macOS
     installer builds, and CI. Patch by Kumar Aditya.

   - bpo-46088(8): Automatically detect or install bootstrap Python
     runtime when building from Visual Studio.

   - bpo-46072(9): Add a -with-pystats configure option to turn on
     internal statistics gathering.

   - bpo-40280(10): A new directory ‘Tools/wasm’ contains
     WebAssembly-related helpers like ‘config.site’ override for
     wasm32-emscripten, wasm assets generator to bundle the stdlib, and
     a README.

   - bpo-46023(11): ‘makesetup’ no longer builds extensions that have
     been marked as 'disabled'.  This allows users to disable modules in
     ‘Modules/Setup.local’.

   - bpo-45949(12): Use pure Python ‘freeze_module’ for all but
     importlib bootstrap files.  ‘--with-freeze-module’ ‘configure’
     option is no longer needed for cross builds.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44133

   (2) https://bugs.python.org/issue?@action=redirect&bpo=44133

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (4) https://bugs.python.org/issue?@action=redirect&bpo=46315

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45723

   (6) https://bugs.python.org/issue?@action=redirect&bpo=46263

   (7) https://bugs.python.org/issue?@action=redirect&bpo=46106

   (8) https://bugs.python.org/issue?@action=redirect&bpo=46088

   (9) https://bugs.python.org/issue?@action=redirect&bpo=46072

   (10) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (11) https://bugs.python.org/issue?@action=redirect&bpo=46023

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45949


File: python.info,  Node: Windows<34>,  Next: macOS<24>,  Prev: ビルド<39>,  Up: Python 3 11 0 alpha 4

1.24.39.12 Windows
..................

   - bpo-46217(1): Removed parameter that is unsupported on Windows 8.1
     and early Windows 10 and may have caused build or runtime failures.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46217


File: python.info,  Node: macOS<24>,  Next: C API<34>,  Prev: Windows<34>,  Up: Python 3 11 0 alpha 4

1.24.39.13 macOS
................

   - bpo-40477(1): The Python Launcher app for macOS now properly
     launches scripts and, if necessary, the Terminal app when running
     on recent macOS releases.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40477


File: python.info,  Node: C API<34>,  Prev: macOS<24>,  Up: Python 3 11 0 alpha 4

1.24.39.14 C API
................

   - bpo-46236(1): Fix a bug in *note PyFunction_GetAnnotations(): 1b37.
     that caused it to return a ‘tuple’ instead of a ‘dict’.

   - bpo-46140(2): *note PyBuffer_GetPointer(): 95d, *note
     PyBuffer_FromContiguous(): 960, *note PyBuffer_ToContiguous(): 95f.
     and *note PyMemoryView_FromBuffer(): 965. now take buffer info by
     ‘const Py_buffer *’ instead of ‘Py_buffer *’, as they do not need
     mutability.  *note PyBuffer_FromContiguous(): 960. also now takes
     the source buffer as ‘const void *’, and similarly *note
     PyBuffer_GetPointer(): 95d. takes the strides as ‘const Py_ssize_t
     *’.

   - bpo-45855(3): Document that the 'no_block' argument to *note
     PyCapsule_Import(): 1c10. is a no-op now.

   - bpo-45855(4): Replaced deprecated usage of *note
     PyImport_ImportModuleNoBlock(): 3db. with *note
     PyImport_ImportModule(): 3dc. in stdlib modules.  Patch by Kumar
     Aditya.

   - bpo-46007(5): The ‘PyUnicode_CHECK_INTERNED()’ macro has been
     excluded from the limited C API. It was never usable there, because
     it used internal structures which are not available in the limited
     C API. Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46236

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46140

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45855

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45855

   (5) https://bugs.python.org/issue?@action=redirect&bpo=46007


File: python.info,  Node: Python 3 11 0 alpha 3,  Next: Python 3 11 0 alpha 2,  Prev: Python 3 11 0 alpha 4,  Up: 変更履歴

1.24.40 Python 3.11.0 alpha 3
-----------------------------

'Release date: 2021-12-08'

* Menu:

* Core and Builtins: Core and Builtins<101>.
* ライブラリ: ライブラリ<104>.
* Core and Builtins: Core and Builtins<102>.
* ライブラリ: ライブラリ<105>.
* ドキュメント: ドキュメント<34>.
* テスト: テスト<33>.
* ビルド: ビルド<40>.
* Windows: Windows<35>.
* macOS: macOS<25>.
* C API: C API<35>.


File: python.info,  Node: Core and Builtins<101>,  Next: ライブラリ<104>,  Up: Python 3 11 0 alpha 3

1.24.40.1 Core and Builtins
...........................

   - bpo-46009(1): Restore behavior from 3.9 and earlier when sending
     non-None to newly started generator.  In 3.9 this did not affect
     the state of the generator.  In 3.10.0 and 3.10.1
     ‘gen_func().send(0)’ is equivalent to
     ‘gen_func().throw(TypeError(...)’ which exhausts the generator.  In
     3.10.2 onward, the behavior has been reverted to that of 3.9.

   - bpo-46004(2): Fix the *note SyntaxError: 18e. location for errors
     involving for loops with invalid targets.  Patch by Pablo Galindo

   - bpo-45711(3): ‘_PyErr_ChainStackItem()’ no longer normalizes
     ‘exc_info’ (including setting the traceback on the exception
     instance) because ‘exc_info’ is always normalized.

   - bpo-45607(4): The ‘__note__’ field was added to *note
     BaseException: 7d6.  It is ‘None’ by default but can be set to a
     string which is added to the exception's traceback.

   - bpo-45947(5): Place pointers to dict and values immediately before
     GC header.  This reduces number of dependent memory loads to access
     either dict or values from 3 to 1.

   - bpo-45915(6): ‘is_valid_fd’ now uses faster ‘fcntl(fd, F_GETFD)’ on
     Linux, macOS, and Windows.

   - bpo-44530(7): Reverts a change to the ‘code.__new__’ *note audit
     event: 1c13. from an earlier prerelease.

   - bpo-42268(8): Fail the configure step if the selected compiler
     doesn't support memory sanitizer.  Patch by Pablo Galindo

   - bpo-45711(9): The three values of ‘exc_info’ are now always
     consistent with each other.  In particular, the ‘type’ and
     ‘traceback’ fields are now derived from the exception instance.
     This impacts the return values of *note sys.exc_info(): 89a. and
     *note PyErr_GetExcInfo(): 976. if the exception instance is
     modified while the exception is handled, as well as *note
     PyErr_SetExcInfo(): 975, which now ignores the ‘type’ and
     ‘traceback’ arguments provided to it.

   - bpo-45727(10): Refine the custom syntax error that suggests that a
     comma may be missing to trigger only when the expressions are
     detected between parentheses or brackets.  Patch by Pablo Galindo

   - bpo-45885(11): Specialized the ‘COMPARE_OP’ opcode using the PEP
     659 machinery.

   - bpo-45786(12): Allocate space for the interpreter frame in the
     frame object, to avoid an additional allocation when the frame
     object outlives the frame activation.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46009

   (2) https://bugs.python.org/issue?@action=redirect&bpo=46004

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45711

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45607

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45947

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45915

   (7) https://bugs.python.org/issue?@action=redirect&bpo=44530

   (8) https://bugs.python.org/issue?@action=redirect&bpo=42268

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45711

   (10) https://bugs.python.org/issue?@action=redirect&bpo=45727

   (11) https://bugs.python.org/issue?@action=redirect&bpo=45885

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45786


File: python.info,  Node: ライブラリ<104>,  Next: Core and Builtins<102>,  Prev: Core and Builtins<101>,  Up: Python 3 11 0 alpha 3

1.24.40.2 ライブラリ
....................

   - bpo-45614(1): Fix *note traceback: 104. display for exceptions with
     invalid module name.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45614


File: python.info,  Node: Core and Builtins<102>,  Next: ライブラリ<105>,  Prev: ライブラリ<104>,  Up: Python 3 11 0 alpha 3

1.24.40.3 Core and Builtins
...........................

   - bpo-45813(1): Fix crash when calling coro.cr_frame.clear() after
     coroutine has been freed.

   - bpo-45811(2): Improve the tokenizer errors when encountering
     invisible control characters in the parser.  Patch by Pablo Galindo

   - bpo-45848(3): Allow the parser to obtain error lines directly from
     encoded files.  Patch by Pablo Galindo

   - bpo-45709(4): Restore behavior from 3.10 when tracing an exception
     raised within a with statement.

   - bpo-44525(5): Adds new *note COPY_FREE_VARS: 90d. opcode, to make
     copying of free variables from function to frame explicit.  Helps
     optimization of calls to Python function.

   - bpo-45829(6): Specialize ‘BINARY_SUBSCR’ for classes with a
     ‘__getitem__’ method implemented in Python

   - bpo-45826(7): Fixed a crash when calling ‘.with_traceback(None)’ on
     ‘NameError’.  This occurs internally in
     ‘unittest.TestCase.assertRaises()’.

   - bpo-45822(8): Fixed a bug in the parser that was causing it to not
     respect PEP 263(9) coding cookies when no flags are provided.
     Patch by Pablo Galindo

   - bpo-45820(10): Fix a segfault when the parser fails without reading
     any input.  Patch by Pablo Galindo

   - bpo-45636(11): Simplify the implementation of *note BINARY_OP: 366.
     by indexing into an array of function pointers (rather than
     switching on the oparg).

   - bpo-42540(12): Fix crash when *note os.fork(): 4b5. is called with
     an active non-default memory allocator.

   - bpo-45738(13): Fix computation of error location for invalid
     continuation characters in the parser.  Patch by Pablo Galindo.

   - bpo-45636(14): Remove an existing "fast path" for old-style string
     formatting, since it no longer appears to have any measurable
     impact.

   - bpo-45753(15): Make recursion checks a bit more efficient by
     tracking amount of calls left before overflow.

   - bpo-45773(16): Fix a compiler hang when attempting to optimize
     certain jump patterns.

   - bpo-45764(17): The parser now gives a better error message when
     leaving out the opening parenthesis ‘(’ after a ‘def’-statement:

          >>> def f:
            File "<stdin>", line 1
              def f:
                   ^
          SyntaxError: expected '('

   - bpo-45609(18): Specialized the ‘STORE_SUBSCR’ opcode using the PEP
     659 machinery.

   - bpo-45636(19): Replace all numeric ‘BINARY_*’ and ‘INPLACE_*’
     instructions with a single *note BINARY_OP: 366. implementation.

   - bpo-45582(20): Path calculation (known as ‘getpath’) has been
     reimplemented as a frozen Python module.  This should have no
     visible impact, but may affect calculation of all paths referenced
     in *note sys: df. and *note sysconfig: e1.

   - bpo-45450(21): Improve the syntax error message for parenthesized
     arguments.  Patch by Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45813

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45811

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45848

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45709

   (5) https://bugs.python.org/issue?@action=redirect&bpo=44525

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45829

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45826

   (8) https://bugs.python.org/issue?@action=redirect&bpo=45822

   (9) https://peps.python.org/pep-0263/

   (10) https://bugs.python.org/issue?@action=redirect&bpo=45820

   (11) https://bugs.python.org/issue?@action=redirect&bpo=45636

   (12) https://bugs.python.org/issue?@action=redirect&bpo=42540

   (13) https://bugs.python.org/issue?@action=redirect&bpo=45738

   (14) https://bugs.python.org/issue?@action=redirect&bpo=45636

   (15) https://bugs.python.org/issue?@action=redirect&bpo=45753

   (16) https://bugs.python.org/issue?@action=redirect&bpo=45773

   (17) https://bugs.python.org/issue?@action=redirect&bpo=45764

   (18) https://bugs.python.org/issue?@action=redirect&bpo=45609

   (19) https://bugs.python.org/issue?@action=redirect&bpo=45636

   (20) https://bugs.python.org/issue?@action=redirect&bpo=45582

   (21) https://bugs.python.org/issue?@action=redirect&bpo=45450


File: python.info,  Node: ライブラリ<105>,  Next: ドキュメント<34>,  Prev: Core and Builtins<102>,  Up: Python 3 11 0 alpha 3

1.24.40.4 ライブラリ
....................

   - bpo-27946(1): Fix possible crash when getting an attribute of *note
     xml.etree.ElementTree.Element: 363. simultaneously with replacing
     the ‘attrib’ dict.

   - bpo-45711(2): Make *note asyncio: b. normalize exceptions as soon
     as they are captured with *note PyErr_Fetch(): 428, and before they
     are stored as an exc_info triplet.  This brings *note asyncio: b.
     in line with the rest of the codebase, where an exc_info triplet is
     always normalized.

   - bpo-23819(3): Replaced asserts with exceptions in asyncio, patch by
     Kumar Aditya.

   - bpo-13236(4): *note unittest.TextTestResult: 754. and *note
     unittest.TextTestRunner: 1ab6. flush now the output stream more
     often.

   - bpo-45917(5): Added *note math.exp2(): 870.:, which returns 2
     raised to the power of x.

   - bpo-37658(6): Fix issue when on certain conditions
     ‘asyncio.wait_for()’ may allow a coroutine to complete
     successfully, but fail to return the result, potentially causing
     memory leaks or other issues.

   - bpo-45876(7): Improve the accuracy of stdev() and pstdev() in the
     statistics module.  When the inputs are floats or fractions, the
     output is a correctly rounded float

   - bpo-44649(8): Handle dataclass(slots=True) with a field that has
     default a default value, but for which init=False.

   - bpo-45803(9): Added missing kw_only parameter to
     dataclasses.make_dataclass().

   - bpo-45837(10): The ‘turtle.RawTurtle.settiltangle()’ is deprecated
     since Python 3.1, it now emits a deprecation warning and will be
     removed in Python 3.13.

     Use ‘turtle.RawTurtle.tiltangle()’ instead.

     ‘turtle.RawTurtle.tiltangle()’ was earlier incorrectly marked as
     deprecated, its docstring has been corrected.

     Patch by Hugo van Kemenade.

   - bpo-45831(11): *note faulthandler: 5c. can now write ASCII-only
     strings (like filenames and function names) with a single write()
     syscall when dumping a traceback.  It reduces the risk of getting
     an unreadable dump when two threads or two processes dump a
     traceback to the same file (like stderr) at the same time.  Patch
     by Victor Stinner.

   - bpo-45828(12): ‘sqlite’ C callbacks now use unraisable exceptions
     if callback tracebacks are enabled.  Patch by Erlend E. Aasland.

   - bpo-41735(13): Fix thread lock in ‘zlib.Decompress.flush()’ method
     before ‘PyObject_GetBuffer’.

   - bpo-45235(14): Reverted an argparse bugfix that caused regression
     in the handling of default arguments for subparsers.  This
     prevented leaf level arguments from taking precedence over root
     level arguments.

   - bpo-45754(15): Fix a regression in Python 3.11a1 and 3.11a2 where
     *note sqlite3: d4. incorrectly would use ‘SQLITE_LIMIT_LENGTH’ when
     checking SQL statement lengths.  Now, ‘SQLITE_LIMIT_SQL_LENGTH’ is
     used.  Patch by Erlend E. Aasland.

   - bpo-45766(16): Added 'proportional' option to *note
     statistics.linear_regression(): a32.

   - bpo-45765(17): In importlib.metadata, fix distribution discovery
     for an empty path.

   - bpo-45757(18): Fix bug where *note dis: 3c. produced an incorrect
     oparg when *note EXTENDED_ARG: 1b1e. is followed by an opcode that
     does not use its argument.

   - bpo-45644(19): In-place JSON file formatting using ‘python3 -m
     json.tool infile infile’ now works correctly, previously it left
     the file empty.  Patch by Chris Wesseling.

   - bpo-45703(20): When a namespace package is imported before another
     module from the same namespace is created/installed in a different
     *note sys.path: 3e4. location while the program is running, calling
     the *note importlib.invalidate_caches(): e0a. function will now
     also guarantee the new module is noticed.

   - bpo-45535(21): Improve output of ‘dir()’ with Enums.

   - bpo-45664(22): Fix *note types.resolve_bases(): d95. and *note
     types.new_class(): 1379. for *note types.GenericAlias: 9ec.
     instance as a base.

   - bpo-45663(23): Fix *note dataclasses.is_dataclass(): 1c17. for
     dataclasses which are subclasses of *note types.GenericAlias: 9ec.

   - bpo-45662(24): Fix the repr of *note dataclasses.InitVar: 1bb4.
     with a type alias to the built-in class, e.g.
     ‘InitVar[list[int]]’.

   - bpo-43137(25): Launch GNOME web browsers via gio tool instead of
     obsolete gvfs-open

   - bpo-45429(26): On Windows, *note time.sleep(): 8ac. now uses a
     waitable timer which supports high-resolution timers.  Patch by
     Donghee Na and Eryk Sun.

   - bpo-37295(27): Optimize *note math.comb(): 8df. and *note
     math.perm(): 8e0.

   - bpo-45514(28): Deprecated legacy functions in *note
     importlib.resources: 7f.

   - bpo-45507(29): Add tests for truncated/missing trailers in
     gzip.decompress implementation.

   - bpo-45359(30): Implement PEP 585(31) for *note
     graphlib.TopologicalSorter: ade.

   - bpo-44733(32): Add ‘max_tasks_per_child’ to *note
     concurrent.futures.ProcessPoolExecutor: 1d6.  This allows users to
     specify the maximum number of tasks a single process should execute
     before the process needs to be restarted.

   - bpo-28806(33): Improve netrc library.  netrc file no longer needs
     to contain all tokens.  And if the login name is anonymous,
     security check is no longer need.

   - bpo-43498(34): Avoid a possible '"RuntimeError: dictionary changed
     size during iteration"' when adjusting the process count of
     ‘ProcessPoolExecutor’.

   - bpo-42158(35): Add MIME types for N-quads, N-triples, Notation3 and
     TriG to ‘mimetypes’.

   - bpo-30533(36): Add *note inspect.getmembers_static(): 859. , it
     return all members without triggering dynamic lookup via the
     descriptor protocol.  Patch by Weipeng Hong.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27946

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45711

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23819

   (4) https://bugs.python.org/issue?@action=redirect&bpo=13236

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45917

   (6) https://bugs.python.org/issue?@action=redirect&bpo=37658

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45876

   (8) https://bugs.python.org/issue?@action=redirect&bpo=44649

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45803

   (10) https://bugs.python.org/issue?@action=redirect&bpo=45837

   (11) https://bugs.python.org/issue?@action=redirect&bpo=45831

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45828

   (13) https://bugs.python.org/issue?@action=redirect&bpo=41735

   (14) https://bugs.python.org/issue?@action=redirect&bpo=45235

   (15) https://bugs.python.org/issue?@action=redirect&bpo=45754

   (16) https://bugs.python.org/issue?@action=redirect&bpo=45766

   (17) https://bugs.python.org/issue?@action=redirect&bpo=45765

   (18) https://bugs.python.org/issue?@action=redirect&bpo=45757

   (19) https://bugs.python.org/issue?@action=redirect&bpo=45644

   (20) https://bugs.python.org/issue?@action=redirect&bpo=45703

   (21) https://bugs.python.org/issue?@action=redirect&bpo=45535

   (22) https://bugs.python.org/issue?@action=redirect&bpo=45664

   (23) https://bugs.python.org/issue?@action=redirect&bpo=45663

   (24) https://bugs.python.org/issue?@action=redirect&bpo=45662

   (25) https://bugs.python.org/issue?@action=redirect&bpo=43137

   (26) https://bugs.python.org/issue?@action=redirect&bpo=45429

   (27) https://bugs.python.org/issue?@action=redirect&bpo=37295

   (28) https://bugs.python.org/issue?@action=redirect&bpo=45514

   (29) https://bugs.python.org/issue?@action=redirect&bpo=45507

   (30) https://bugs.python.org/issue?@action=redirect&bpo=45359

   (31) https://peps.python.org/pep-0585/

   (32) https://bugs.python.org/issue?@action=redirect&bpo=44733

   (33) https://bugs.python.org/issue?@action=redirect&bpo=28806

   (34) https://bugs.python.org/issue?@action=redirect&bpo=43498

   (35) https://bugs.python.org/issue?@action=redirect&bpo=42158

   (36) https://bugs.python.org/issue?@action=redirect&bpo=30533


File: python.info,  Node: ドキュメント<34>,  Next: テスト<33>,  Prev: ライブラリ<105>,  Up: Python 3 11 0 alpha 3

1.24.40.5 ドキュメント
......................

   - bpo-42238(1): ‘make -C Doc suspicious’ will be removed soon in
     favor of ‘make -C Doc check’, mark it as deprecated.

   - bpo-45840(2): Improve cross-references in the documentation for the
     data model.

   - bpo-45640(3): Properly marked-up grammar tokens in the
     documentation are now clickable and take you to the definition of a
     given piece of grammar.  Patch by Arthur Milchior.

   - bpo-45788(4): Link doc for sys.prefix to sysconfig doc on
     installation paths.

   - bpo-45772(5): ‘socket.socket’ documentation is corrected to a class
     from a function.

   - bpo-45392(6): Update the docstring of the *note type: f44. built-in
     to remove a redundant line and to mention keyword arguments for the
     constructor.

   - bpo-45250(7): Update the documentation to note that CPython does
     not consistently require iterators to define ‘__iter__’.

   - bpo-25381(8): In the extending chapter of the extending doc, update
     a paragraph about the global variables containing exception
     information.

   - bpo-43905(9): Expanded *note astuple(): 1a9e. and *note asdict():
     1a95. docs, warning about deepcopy being applied and providing a
     workaround.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42238

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45840

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45640

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45788

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45772

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45392

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45250

   (8) https://bugs.python.org/issue?@action=redirect&bpo=25381

   (9) https://bugs.python.org/issue?@action=redirect&bpo=43905


File: python.info,  Node: テスト<33>,  Next: ビルド<40>,  Prev: ドキュメント<34>,  Up: Python 3 11 0 alpha 3

1.24.40.6 テスト
................

   - bpo-45695(1): Out-of-tree builds with a read-only source directory
     are now tested by CI.

   - bpo-19460(2): Add new Test for
     ‘Lib/email/mime/nonmultipart.py::MIMENonMultipart’.

   - bpo-45835(3): Fix race condition in test_queue tests with multiple
     "feeder" threads.

   - bpo-45783(4): The test for the freeze tool now handles file moves
     and deletions.

   - bpo-45745(5): Remove the ‘--findleaks’ command line option of
     regrtest: use the ‘--fail-env-changed’ option instead.  Since
     Python 3.7, it was a deprecated alias to the ‘--fail-env-changed’
     option.

   - bpo-45701(6): Add tests with ‘tuple’ type with *note
     functools.lru_cache(): be2. to ‘test_functools’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45695

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19460

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45835

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45783

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45745

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45701


File: python.info,  Node: ビルド<40>,  Next: Windows<35>,  Prev: テスト<33>,  Up: Python 3 11 0 alpha 3

1.24.40.7 ビルド
................

   - bpo-44035(1): CI now verifies that autoconf files have been
     regenerated with a current and unpatched autoconf package.

   - bpo-45950(2): The build system now uses a ‘_bootstrap_python’
     interpreter for freezing and deepfreezing again.  To speed up build
     process the build tools ‘_bootstrap_python’ and ‘_freeze_module’
     are no longer build with LTO.

   - bpo-45881(3): The ‘configure’ script now accepts
     ‘--with-build-python’ and ‘--with-freeze-module’ options to make
     cross compiling easier.

   - bpo-40280(4): Emscripten platform now uses ‘.wasm’ suffix by
     default.

   - bpo-40280(5): Disable unusable core extension modules on
     WASM/Emscripten targets.

   - bpo-40280(6): ‘configure’ now checks for socket ‘shutdown’
     function.  The check makes it possible to disable ‘SYS_shutdown’
     with ‘ac_cv_func_shutdown=no’ in CONFIG_SITE.

   - bpo-40280(7): ‘configure’ now checks for functions ‘fork1, getegid,
     geteuid, getgid, getppid, getuid, opendir, pipe, system, wait,
     ttyname’.

   - bpo-33393(8): Update ‘config.guess’ to 2021-06-03 and ‘config.sub’
     to 2021-08-14.  ‘Makefile’ now has an ‘update-config’ target to
     make updating more convenient.

   - bpo-45866(9): ‘make regen-all’ now produces the same output when
     run from a directory other than the source tree: when building
     Python out of the source tree.  pegen now strips directory of the
     "generated by pygen from <FILENAME>" header Patch by Victor
     Stinner.

   - bpo-40280(10): ‘configure’ now accepts machine ‘wasm32’ or ‘wasm64’
     and OS ‘wasi’ or ‘emscripten’ for cross building, e.g.
     ‘wasm32-unknown-emscripten’, ‘wasm32-wasi’, or
     ‘wasm32-unknown-wasi’.

   - bpo-41498(11): Python now compiles on platforms without ‘sigset_t’.
     Several functions in *note signal: cb. are not available when
     ‘sigset_t’ is missing.

     Based on patch by Roman Yurchak for pyodide.

   - bpo-45881(12): ‘setup.py’ now uses ‘CC’ from environment first to
     discover multiarch and cross compile paths.

   - bpo-45886(13): The ‘_freeze_module’ program path can now be
     overridden on the command line, e.g.  ‘make
     FREEZE_MODULE=../x86_64/Program/_freeze_module’.

   - bpo-45873(14): Get rid of the ‘_bootstrap_python’ build step.  The
     deepfreeze.py script is now run using ‘$(PYTHON_FOR_REGEN)’ which
     can be Python 3.7 or newer (on Windows, 3.8 or newer).

   - bpo-45847(15): Port builtin hashlib extensions to ‘PY_STDLIB_MOD’
     macro and ‘addext()’.

   - bpo-45723(16): Add ‘autoconf’ helpers for saving and restoring
     environment variables:

        * ‘SAVE_ENV’: Save ‘$CFLAGS’, ‘$LDFLAGS’, ‘$LIBS’, and
          ‘$CPPFLAGS’.

        * ‘RESTORE_ENV’: Restore ‘$CFLAGS’, ‘$LDFLAGS’, ‘$LIBS’, and
          ‘$CPPFLAGS’.

        * ‘WITH_SAVE_ENV([SCRIPT])’: Run ‘SCRIPT’ wrapped with
          ‘SAVE_ENV’ and ‘RESTORE_ENV’.

     Patch by Erlend E. Aasland.

   - bpo-45573(17): Mandatory core modules, that are required to
     bootstrap Python, are now in ‘Modules/Setup.bootstrap’.

   - bpo-45573(18): ‘configure’ now creates ‘Modules/Setup.stdlib’ with
     conditionally enabled/disabled extension module lines.  The file is
     not used, yet.

   - bpo-45573(19): ‘configure’ now uses a unified format to set state,
     compiler flags, and linker flags in Makefile.  The new macro
     ‘PY_STDLIB_MOD’ sets three variables that are consumed by
     ‘Modules/Setup’ and ‘setup.py’.

   - bpo-45816(20): Python now supports building with Visual Studio 2022
     (MSVC v143, VS Version 17.0).  Patch by Jeremiah Vivian.

   - bpo-45800(21): Settings for ‘pyexpat’ C extension are now detected
     by ‘configure’.  The bundled ‘expat’ library is built in
     ‘Makefile’.

   - bpo-45798(22): Settings for *note decimal: 3a. internal C extension
     are now detected by ‘configure’.  The bundled ‘libmpdec’ library is
     built in ‘Makefile’.

   - bpo-45723(23): ‘configure’ has a new option ‘--with-pkg-config’ to
     disable or require pkg-config.

   - bpo-45774(24): The build dependencies for *note sqlite3: d4. are
     now detected by ‘configure’ and ‘pkg-config’.  Patch by Erlend E.
     Aasland.

   - bpo-45763(25): The build dependencies for *note zlib: 139, *note
     bz2: 14, and *note lzma: 8e. are now detected by ‘configure’.

   - bpo-45747(26): gdbm and dbm build dependencies are now detected by
     ‘configure’.

   - bpo-45743(27): On macOS, the build system no longer passes
     ‘search_paths_first’ to the linker.  The flag has been the default
     since Xcode 4 / macOS 10.6.

   - bpo-45723(28): ‘configure.ac’ is now compatible with autoconf 2.71.
     Deprecated checks ‘STDC_HEADERS’ and ‘AC_HEADER_TIME’ have been
     removed.

   - bpo-45723(29): ‘configure’ now prints a warning when pkg-config is
     missing.

   - bpo-45731(30): ‘configure --enable-loadable-sqlite-extensions’ is
     now handled by new ‘PY_SQLITE_ENABLE_LOAD_EXTENSION’ macro instead
     of logic in setup.py.

   - bpo-45723(31): configure.ac now uses custom helper macros and
     ‘AC_CACHE_CHECK’ to simplify and speed up configure runs.

   - bpo-45696(32): Skip the marshal step for frozen modules by
     generating C code that produces a set of ready-to-use code objects.
     This speeds up startup time by another 10% or more.

   - bpo-45561(33): Run smelly.py tool from $(srcdir).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44035

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45950

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45881

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (8) https://bugs.python.org/issue?@action=redirect&bpo=33393

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45866

   (10) https://bugs.python.org/issue?@action=redirect&bpo=40280

   (11) https://bugs.python.org/issue?@action=redirect&bpo=41498

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45881

   (13) https://bugs.python.org/issue?@action=redirect&bpo=45886

   (14) https://bugs.python.org/issue?@action=redirect&bpo=45873

   (15) https://bugs.python.org/issue?@action=redirect&bpo=45847

   (16) https://bugs.python.org/issue?@action=redirect&bpo=45723

   (17) https://bugs.python.org/issue?@action=redirect&bpo=45573

   (18) https://bugs.python.org/issue?@action=redirect&bpo=45573

   (19) https://bugs.python.org/issue?@action=redirect&bpo=45573

   (20) https://bugs.python.org/issue?@action=redirect&bpo=45816

   (21) https://bugs.python.org/issue?@action=redirect&bpo=45800

   (22) https://bugs.python.org/issue?@action=redirect&bpo=45798

   (23) https://bugs.python.org/issue?@action=redirect&bpo=45723

   (24) https://bugs.python.org/issue?@action=redirect&bpo=45774

   (25) https://bugs.python.org/issue?@action=redirect&bpo=45763

   (26) https://bugs.python.org/issue?@action=redirect&bpo=45747

   (27) https://bugs.python.org/issue?@action=redirect&bpo=45743

   (28) https://bugs.python.org/issue?@action=redirect&bpo=45723

   (29) https://bugs.python.org/issue?@action=redirect&bpo=45723

   (30) https://bugs.python.org/issue?@action=redirect&bpo=45731

   (31) https://bugs.python.org/issue?@action=redirect&bpo=45723

   (32) https://bugs.python.org/issue?@action=redirect&bpo=45696

   (33) https://bugs.python.org/issue?@action=redirect&bpo=45561


File: python.info,  Node: Windows<35>,  Next: macOS<25>,  Prev: ビルド<40>,  Up: Python 3 11 0 alpha 3

1.24.40.8 Windows
.................

   - bpo-46105(1): Fixed calculation of *note sys.path: 3e4. in a venv
     on Windows.

   - bpo-45901(2): When installed through the Microsoft Store and set as
     the default app for ‘*.py’ files, command line arguments will now
     be passed to Python when invoking a script without explicitly
     launching Python (that is, ‘script.py args’ rather than ‘python
     script.py args’).

   - bpo-45616(3): Fix Python Launcher's ability to distinguish between
     versions 3.1 and 3.10 when either one is explicitly requested.
     Previously, 3.1 would be used if 3.10 was requested but not
     installed, and 3.10 would be used if 3.1 was requested but 3.10 was
     installed.

   - bpo-45850(4): Implement changes to build with deep-frozen modules
     on Windows.  Note that we now require Python 3.10 as the
     "bootstrap" or "host" Python.

   - bpo-45732(5): Updates bundled Tcl/Tk to 8.6.12.

   - bpo-45720(6): Internal reference to ‘shlwapi.dll’ was dropped to
     help improve startup time.  This DLL will no longer be loaded at
     the start of every Python process.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=46105

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45901

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45616

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45850

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45732

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45720


File: python.info,  Node: macOS<25>,  Next: C API<35>,  Prev: Windows<35>,  Up: Python 3 11 0 alpha 3

1.24.40.9 macOS
...............

   - bpo-45732(1): Update python.org macOS installer to use Tcl/Tk
     8.6.12.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45732


File: python.info,  Node: C API<35>,  Prev: macOS<25>,  Up: Python 3 11 0 alpha 3

1.24.40.10 C API
................

   - bpo-39026(1): Fix Python.h to build C extensions with Xcode: remove
     a relative include from ‘Include/cpython/pystate.h’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39026


File: python.info,  Node: Python 3 11 0 alpha 2,  Next: Python 3 11 0 alpha 1,  Prev: Python 3 11 0 alpha 3,  Up: 変更履歴

1.24.41 Python 3.11.0 alpha 2
-----------------------------

'リリース日: 2021-11-05'

* Menu:

* Core and Builtins: Core and Builtins<103>.
* ライブラリ: ライブラリ<106>.
* ドキュメント: ドキュメント<35>.
* テスト: テスト<34>.
* ビルド: ビルド<41>.
* Windows: Windows<36>.
* macOS: macOS<26>.
* IDLE: IDLE<18>.
* C API: C API<36>.


File: python.info,  Node: Core and Builtins<103>,  Next: ライブラリ<106>,  Up: Python 3 11 0 alpha 2

1.24.41.1 Core and Builtins
...........................

   - bpo-45716(1): Improve the *note SyntaxError: 18e. message when
     using ‘True’, ‘None’ or ‘False’ as keywords in a function call.
     Patch by Pablo Galindo.

   - bpo-45688(2): *note sys.stdlib_module_names: a42. now contains the
     macOS-specific module ‘_scproxy’.

   - bpo-45379(3): Clarify *note ImportError: 65b. message when we try
     to explicitly import a frozen module but frozen modules are
     disabled.

   - bpo-44525(4): Specialize simple calls to Python functions (no
     starargs, keyword dict, or closure)

   - bpo-45530(5): Cases of sorting using tuples as keys may now be
     significantly faster in some cases.  Patch by Tim Peters.

     The order of the result may differ from earlier releases if the
     tuple elements don't define a total ordering (see *note 値の比較:
     1c20. for information on total ordering).  It's generally true that
     the result of sorting simply isn't well-defined in the absence of a
     total ordering on list elements.

   - bpo-45526(6): In obmalloc, set ADDRESS_BITS to not ignore any bits
     (ignored 16 before).  That is safer in the case that the kernel
     gives user-space virtual addresses that span a range greater than
     48 bits.

   - bpo-30570(7): Fixed a crash in ‘issubclass()’ from infinite
     recursion when searching pathological ‘__bases__’ tuples.

   - bpo-45521(8): Fix a bug in the obmalloc radix tree code.  On 64-bit
     machines, the bug causes the tree to hold 46-bits of virtual
     addresses, rather than the intended 48-bits.

   - bpo-45494(9): Fix parser crash when reporting errors involving
     invalid continuation characters.  Patch by Pablo Galindo.

   - bpo-45445(10): Python now fails to initialize if it finds an
     invalid *note -X: 16f. option in the command line.  Patch by Pablo
     Galindo.

   - bpo-45340(11): Object attributes are held in an array instead of a
     dictionary.  An object's dictionary are created lazily, only when
     needed.  Reduces the memory consumption of a typical Python object
     by about 30%.  Patch by Mark Shannon.

   - bpo-45408(12): Fix a crash in the parser when reporting tokenizer
     errors that occur at the same time unclosed parentheses are
     detected.  Patch by Pablo Galindo.

   - bpo-29410(13): Add SipHash13 for string hash algorithm and use it
     by default.

   - bpo-45385(14): Fix reference leak from descr_check.  Patch by
     Donghee Na.

   - bpo-45367(15): Specialized the ‘BINARY_MULTIPLY’ opcode to
     ‘BINARY_MULTIPLY_INT’ and ‘BINARY_MULTIPLY_FLOAT’ using the PEP 659
     machinery.

   - bpo-21736(16): Frozen stdlib modules now have ‘__file__’ to the .py
     file they would otherwise be loaded from, if possible.  For
     packages, ‘__path__’ now has the correct entry instead of being an
     empty list, which allows unfrozen submodules to be imported.  These
     are set only if the stdlib directory is known when the runtime is
     initialized.  Note that the file at ‘__file__’ is not guaranteed to
     exist.  None of this affects non-stdlib frozen modules nor, for
     now, frozen modules imported using ‘PyImport_ImportFrozenModule()’.
     Also, at the moment ‘co_filename’ is not updated for the module.

   - bpo-45020(17): For frozen stdlib modules, record the original
     module name as ‘module.__spec__.loader_state.origname’.  If the
     value is different than ‘module.__spec__.name’ then the module was
     defined as an alias in Tools/scripts/freeze_modules.py.  If it is
     ‘None’ then the module comes from a source file outside the stdlib.

   - bpo-45324(18): In FrozenImporter.find_spec(), we now preserve the
     information needed in exec_module() to load the module.  This
     change mostly impacts internal details, rather than changing the
     importer's behavior.

   - bpo-45292(19): Implement PEP 654(20).  Add *note ExceptionGroup:
     4d2. and *note BaseExceptionGroup: 566.  Update traceback display
     code.

   - bpo-40116(21): Change to the implementation of split dictionaries.
     Classes where the instances differ either in the exact set of
     attributes, or in the order in which those attributes are set, can
     still share keys.  This should have no observable effect on users
     of Python or the C-API. Patch by Mark Shannon.

   - bpo-44050(22): Extensions that indicate they use global state (by
     setting ‘m_size’ to -1) can again be used in multiple interpreters.
     This reverts to behavior of Python 3.8.

   - bpo-44525(23): Setup initial specialization infrastructure for the
     ‘CALL_FUNCTION’ opcode.  Implemented initial specializations for C
     function calls:

        * ‘CALL_FUNCTION_BUILTIN_O’ for ‘METH_O’ flag.

        * ‘CALL_FUNCTION_BUILTIN_FAST’ for ‘METH_FASTCALL’ flag without
          keywords.

        * ‘CALL_FUNCTION_LEN’ for ‘len(o)’.

        * ‘CALL_FUNCTION_ISINSTANCE’ for ‘isinstance(o, t)’.

   - bpo-44511(24): Improve the generated bytecode for class and mapping
     patterns.

   - bpo-43706(25): Speed up calls to ‘enumerate()’ by using the PEP
     590(26) ‘vectorcall’ calling convention.  Patch by Donghee Na.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45716

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45688

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45379

   (4) https://bugs.python.org/issue?@action=redirect&bpo=44525

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45530

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45526

   (7) https://bugs.python.org/issue?@action=redirect&bpo=30570

   (8) https://bugs.python.org/issue?@action=redirect&bpo=45521

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45494

   (10) https://bugs.python.org/issue?@action=redirect&bpo=45445

   (11) https://bugs.python.org/issue?@action=redirect&bpo=45340

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45408

   (13) https://bugs.python.org/issue?@action=redirect&bpo=29410

   (14) https://bugs.python.org/issue?@action=redirect&bpo=45385

   (15) https://bugs.python.org/issue?@action=redirect&bpo=45367

   (16) https://bugs.python.org/issue?@action=redirect&bpo=21736

   (17) https://bugs.python.org/issue?@action=redirect&bpo=45020

   (18) https://bugs.python.org/issue?@action=redirect&bpo=45324

   (19) https://bugs.python.org/issue?@action=redirect&bpo=45292

   (20) https://peps.python.org/pep-0654/

   (21) https://bugs.python.org/issue?@action=redirect&bpo=40116

   (22) https://bugs.python.org/issue?@action=redirect&bpo=44050

   (23) https://bugs.python.org/issue?@action=redirect&bpo=44525

   (24) https://bugs.python.org/issue?@action=redirect&bpo=44511

   (25) https://bugs.python.org/issue?@action=redirect&bpo=43706

   (26) https://peps.python.org/pep-0590/


File: python.info,  Node: ライブラリ<106>,  Next: ドキュメント<35>,  Prev: Core and Builtins<103>,  Up: Python 3 11 0 alpha 2

1.24.41.2 ライブラリ
....................

   - bpo-45679(1): Fix caching of multi-value *note typing.Literal: a55.
     ‘Literal[True, 2]’ is no longer equal to ‘Literal[1, 2]’.

   - bpo-42064(2): Convert *note sqlite3: d4. to multi-phase
     initialisation (PEP 489).  Patches by Erlend E. Aasland.

   - bpo-45438(3): Fix typing.Signature string representation for
     generic builtin types.

   - bpo-45613(4): *note sqlite3: d4. now sets *note
     sqlite3.threadsafety: 88c. based on the default threading mode the
     underlying SQLite library has been compiled with.  Patch by Erlend
     E. Aasland.

   - bpo-45574(5): Fix warning about ‘print_escape’ being unused.

   - bpo-45581(6): *note sqlite3.connect(): 5a6. now correctly raises
     *note MemoryError: 179e. if the underlying SQLite API signals
     memory error.  Patch by Erlend E. Aasland.

   - bpo-45557(7): *note pprint.pprint(): a29. now handles
     'underscore_numbers' correctly.  Previously it was always setting
     it to ‘False’.

   - bpo-44019(8): Add *note operator.call(): 1c22. to
     ‘operator.__all__’.  Patch by Kreusada.

   - bpo-42174(9): *note shutil.get_terminal_size(): 131b. now falls
     back to sane values if the column or line count are 0.

   - bpo-35673(10): Improve the introspectability of the ‘__loader__’
     attribute for namespace packages.  *note
     importlib.machinery.NamespaceLoader: 1158. is now public, and
     implements the *note importlib.abc.InspectLoader: 1156. interface.
     ‘_NamespaceLoader’ is kept for backward compatibility.

   - bpo-45515(11): Add references to *note zoneinfo: 13a. in the *note
     datetime: 34. documentation, mostly replacing outdated references
     to ‘dateutil.tz’.  Change by Paul Ganssle.

   - bpo-45475(12): Reverted optimization of iterating *note
     gzip.GzipFile: 65c, *note bz2.BZ2File: a66, and *note
     lzma.LZMAFile: 120e. (see bpo-43787(13)) because it caused
     regression when user iterate them without having reference of them.
     Patch by Inada Naoki.

   - bpo-45489(14): Update *note ForwardRef: 1bda. to support ‘|’
     operator.  Patch by Donghee Na.

   - bpo-42222(15): Removed deprecated support for float arguments in
     'randrange()'.

   - bpo-45428(16): Fix a regression in py_compile when reading
     filenames from standard input.

   - bpo-45467(17): Fix incremental decoder and stream reader in the
     "raw-unicode-escape" codec.  Previously they failed if the escape
     sequence was split.

   - bpo-45461(18): Fix incremental decoder and stream reader in the
     "unicode-escape" codec.  Previously they failed if the escape
     sequence was split.

   - bpo-45239(19): Fixed *note email.utils.parsedate_tz(): 1c23.
     crashing with *note UnboundLocalError: 174f. on certain invalid
     input instead of returning ‘None’.  Patch by Ben Hoyt.

   - bpo-45417(20): Fix quadratic behaviour in the enum module: Creation
     of enum classes with a lot of entries was quadratic.

   - bpo-45249(21): Fix the behaviour of *note traceback.print_exc():
     1c24. when displaying the caret when the ‘end_offset’ in the
     exception is set to 0.  Patch by Pablo Galindo

   - bpo-45416(22): Fix use of *note asyncio.Condition: c67. with
     explicit *note asyncio.Lock: c66. objects, which was a regression
     due to removal of explicit loop arguments.  Patch by Joongi Kim.

   - bpo-20028(23): Empty escapechar/quotechar is not allowed when
     initializing *note csv.Dialect: 1827.  Patch by Vajrasky Kok and
     Donghee Na.

   - bpo-44904(24): Fix bug in the *note doctest: 3e. module that caused
     it to fail if a docstring included an example with a ‘classmethod’
     ‘property’.  Patch by Alex Waygood.

   - bpo-45406(25): Make *note inspect.getmodule(): 1b6d. catch
     ‘FileNotFoundError’ raised by ‘inspect.getabsfile()’, and return
     ‘None’ to indicate that the module could not be determined.

   - bpo-45411(26): Add extensions for files containing subtitles - .srt
     & .vtt - to the mimetypes.py module.

   - bpo-10716(27): Migrated pydoc to HTML5 (without changing the look
     of it).  Side effect is to update xmlrpc's ‘ServerHTMLDoc’ which
     now uses the CSS too.  cgitb now relies less on pydoc (as it can't
     use the CSS file).

   - bpo-27580(28): Add support of null characters in *note csv: 2d.

   - bpo-45262(29): Prevent use-after-free in asyncio.  Make sure the
     cached running loop holder gets cleared on dealloc to prevent
     use-after-free in get_running_loop

   - bpo-45386(30): Make *note xmlrpc.client: 134. more robust to C
     runtimes where the underlying C ‘strftime’ function results in a
     ‘ValueError’ when testing for year formatting options.

   - bpo-20028(31): Improve error message of *note csv.Dialect: 1827.
     when initializing.  Patch by Vajrasky Kok and Donghee Na.

   - bpo-45343(32): Update bundled pip to 21.2.4 and setuptools to
     58.1.0

   - bpo-45328(33): Fixed *note http.client.HTTPConnection: d35. to work
     properly in OSs that don't support the ‘TCP_NODELAY’ socket option.

   - bpo-45243(34): Add *note setlimit(): 88a. and *note getlimit():
     88b. to *note sqlite3.Connection: 54d. for setting and getting
     SQLite limits by connection basis.  Patch by Erlend E. Aasland.

   - bpo-45320(35): Removed from the *note inspect: 82. module:

        * 
          the ‘getargspec’ function, deprecated since Python 3.0;

               use *note inspect.signature(): 22f. or *note
               inspect.getfullargspec(): 941. instead.

        * the ‘formatargspec’ function, deprecated since Python 3.5; use
          the *note inspect.signature(): 22f. function and ‘Signature’
          object directly.

        * the undocumented ‘Signature.from_builtin’ and
          ‘Signature.from_function’ functions, deprecated since Python
          3.5; use the *note Signature.from_callable(): 942. method
          instead.

     Patch by Hugo van Kemenade.

   - bpo-45192(36): Fix the ‘tempfile._infer_return_type’ function so
     that the ‘dir’ argument of the *note tempfile: e6. functions
     accepts an object implementing the ‘os.PathLike’ protocol.

     Patch by Kyungmin Lee.

   - bpo-45160(37): When tracing a tkinter variable used by a ttk
     OptionMenu, callbacks are no longer made twice.

   - bpo-25625(38): Added non parallel-safe *note chdir(): 820. context
     manager to change the current working directory and then restore it
     on exit.  Simple wrapper around *note chdir(): 821.

   - bpo-24139(39): Add support for SQLite extended result codes in
     *note sqlite3.Error: 1c25.  Patch by Erlend E. Aasland.

   - bpo-24444(40): Fixed an error raised in *note argparse: 7. help
     display when help for an option is set to 1+ blank spaces or when
     'choices' arg is an empty container.

   - bpo-44547(41): Implement ‘Fraction.__int__’, so that a *note
     fractions.Fraction: 213. instance ‘f’ passes an ‘isinstance(f,
     typing.SupportsInt)’ check.

   - bpo-40321(42): Adds support for HTTP 308 redirects to *note urllib:
     10e.  See RFC 7538(43) for details.  Patch by Jochem
     Schulenklopper.

   - bpo-41374(44): Ensure that ‘socket.TCP_*’ constants are exposed on
     Cygwin 3.1.6 and greater.

   - bpo-35970(45): Add help flag to the base64 module's command line
     interface.  Patch contributed by Robert Kuska.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45679

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42064

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45438

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45613

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45574

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45581

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45557

   (8) https://bugs.python.org/issue?@action=redirect&bpo=44019

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42174

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35673

   (11) https://bugs.python.org/issue?@action=redirect&bpo=45515

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45475

   (13) https://bugs.python.org/issue?@action=redirect&bpo=43787

   (14) https://bugs.python.org/issue?@action=redirect&bpo=45489

   (15) https://bugs.python.org/issue?@action=redirect&bpo=42222

   (16) https://bugs.python.org/issue?@action=redirect&bpo=45428

   (17) https://bugs.python.org/issue?@action=redirect&bpo=45467

   (18) https://bugs.python.org/issue?@action=redirect&bpo=45461

   (19) https://bugs.python.org/issue?@action=redirect&bpo=45239

   (20) https://bugs.python.org/issue?@action=redirect&bpo=45417

   (21) https://bugs.python.org/issue?@action=redirect&bpo=45249

   (22) https://bugs.python.org/issue?@action=redirect&bpo=45416

   (23) https://bugs.python.org/issue?@action=redirect&bpo=20028

   (24) https://bugs.python.org/issue?@action=redirect&bpo=44904

   (25) https://bugs.python.org/issue?@action=redirect&bpo=45406

   (26) https://bugs.python.org/issue?@action=redirect&bpo=45411

   (27) https://bugs.python.org/issue?@action=redirect&bpo=10716

   (28) https://bugs.python.org/issue?@action=redirect&bpo=27580

   (29) https://bugs.python.org/issue?@action=redirect&bpo=45262

   (30) https://bugs.python.org/issue?@action=redirect&bpo=45386

   (31) https://bugs.python.org/issue?@action=redirect&bpo=20028

   (32) https://bugs.python.org/issue?@action=redirect&bpo=45343

   (33) https://bugs.python.org/issue?@action=redirect&bpo=45328

   (34) https://bugs.python.org/issue?@action=redirect&bpo=45243

   (35) https://bugs.python.org/issue?@action=redirect&bpo=45320

   (36) https://bugs.python.org/issue?@action=redirect&bpo=45192

   (37) https://bugs.python.org/issue?@action=redirect&bpo=45160

   (38) https://bugs.python.org/issue?@action=redirect&bpo=25625

   (39) https://bugs.python.org/issue?@action=redirect&bpo=24139

   (40) https://bugs.python.org/issue?@action=redirect&bpo=24444

   (41) https://bugs.python.org/issue?@action=redirect&bpo=44547

   (42) https://bugs.python.org/issue?@action=redirect&bpo=40321

   (43) https://datatracker.ietf.org/doc/html/rfc7538.html

   (44) https://bugs.python.org/issue?@action=redirect&bpo=41374

   (45) https://bugs.python.org/issue?@action=redirect&bpo=35970


File: python.info,  Node: ドキュメント<35>,  Next: テスト<34>,  Prev: ライブラリ<106>,  Up: Python 3 11 0 alpha 2

1.24.41.3 ドキュメント
......................

   - bpo-45726(1): Improve documentation for *note
     functools.singledispatch(): 84b. and *note
     functools.singledispatchmethod: be5.

   - bpo-45680(2): Amend the docs on ‘GenericAlias’ objects to clarify
     that non-container classes can also implement ‘__class_getitem__’.
     Patch contributed by Alex Waygood.

   - bpo-45618(3): Update Sphinx version used to build the documentation
     to 4.2.0.  Patch by Maciej Olko.

   - bpo-45655(4): Add a new "relevant PEPs" section to the top of the
     documentation for the ‘typing’ module.  Patch by Alex Waygood.

   - bpo-45604(5): Add ‘level’ argument to
     ‘multiprocessing.log_to_stderr’ function docs.

   - bpo-45516(6): Add protocol description to the
     ‘importlib.abc.TraversableResources’ documentation.

   - bpo-45464(7): Mention in the documentation of *note Built-in
     Exceptions: 1c27. that inheriting from multiple exception types in
     a single subclass is not recommended due to possible memory layout
     incompatibility.

   - bpo-45449(8): Add note about PEP 585(9) in *note collections.abc:
     1f.

   - bpo-45516(10): Add protocol description to the
     ‘importlib.abc.Traversable’ documentation.

   - bpo-20692(11): Add Programming FAQ entry explaining that int
     literal attribute access requires either a space after or
     parentheses around the literal.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45726

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45680

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45618

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45655

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45604

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45516

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45464

   (8) https://bugs.python.org/issue?@action=redirect&bpo=45449

   (9) https://peps.python.org/pep-0585/

   (10) https://bugs.python.org/issue?@action=redirect&bpo=45516

   (11) https://bugs.python.org/issue?@action=redirect&bpo=20692


File: python.info,  Node: テスト<34>,  Next: ビルド<41>,  Prev: ドキュメント<35>,  Up: Python 3 11 0 alpha 2

1.24.41.4 テスト
................

   - bpo-45678(1): Add tests for scenarios in which *note
     functools.singledispatchmethod: be5. is stacked on top of a method
     that has already been wrapped by two other decorators.  Patch by
     Alex Waygood.

   - bpo-45578(2): Add tests for *note dis.distb(): 206.

   - bpo-45678(3): Add tests to ensure that
     ‘functools.singledispatchmethod’ correctly wraps the attributes of
     the target function.

   - bpo-45668(4): PGO tests now pass when Python is built without test
     extension modules.

   - bpo-45577(5): Add subtests for all ‘pickle’ protocols in
     ‘test_zoneinfo’.

   - bpo-45566(6): Fix ‘test_frozen_pickle’ in ‘test_dataclasses’ to
     check all ‘pickle’ versions.

   - bpo-43592(7): ‘test.libregrtest’ now raises the soft resource limit
     for the maximum number of file descriptors when the default is too
     low for our test suite as was often the case on macOS.

   - bpo-39679(8): Add more test cases for
     ‘@functools.singledispatchmethod’ when combined with ‘@classmethod’
     or ‘@staticmethod’.

   - bpo-45410(9): When libregrtest spawns a worker process, stderr is
     now written into stdout to keep messages order.  Use a single pipe
     for stdout and stderr, rather than two pipes.  Previously, messages
     were out of order which made analysis of buildbot logs harder Patch
     by Victor Stinner.

   - bpo-45402(10): Fix test_tools.test_sundry() when Python is built
     out of tree: fix how the freeze_modules.py tool locates the
     _freeze_module program.  Patch by Victor Stinner.

   - bpo-45403(11): Fix test_sys.test_stdlib_dir() when Python is built
     outside the source tree: compare normalized paths.  Patch by Victor
     Stinner.

   - bpo-45400(12): Fix
     test_name_error_suggestions_do_not_trigger_for_too_many_locals() of
     test_exceptions if a directory name contains "a1" (like
     "Python-3.11.0a1"): use a stricter regular expression.  Patch by
     Victor Stinner.

   - bpo-10572(13): Rename *note sqlite3: d4. tests from ‘test_sqlite’
     to ‘test_sqlite3’, and relocate them to ‘Lib/test/test_sqlite3’.
     Patch by Erlend E. Aasland.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45678

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45578

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45678

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45668

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45577

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45566

   (7) https://bugs.python.org/issue?@action=redirect&bpo=43592

   (8) https://bugs.python.org/issue?@action=redirect&bpo=39679

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45410

   (10) https://bugs.python.org/issue?@action=redirect&bpo=45402

   (11) https://bugs.python.org/issue?@action=redirect&bpo=45403

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45400

   (13) https://bugs.python.org/issue?@action=redirect&bpo=10572


File: python.info,  Node: ビルド<41>,  Next: Windows<36>,  Prev: テスト<34>,  Up: Python 3 11 0 alpha 2

1.24.41.5 ビルド
................

   - bpo-43158(1): ‘setup.py’ now uses values from configure script to
     build the ‘_uuid’ extension module.  Configure now detects
     util-linux's ‘libuuid’, too.

   - bpo-45666(2): Fix warning of ‘swprintf’ and ‘%s’ usage in
     ‘_testembed.c’

   - bpo-45548(3): ‘Modules/Setup’ and ‘Modules/makesetup’ have been
     improved.  The ‘Setup’ file now contains working rules for all
     extensions.  Outdated comments have been removed.  Rules defined by
     ‘makesetup’ track dependencies correctly.

   - bpo-45548(4): The *note math: 92. and *note cmath: 19.
     implementation now require a C99 compatible ‘libm’ and no longer
     ship with workarounds for missing acosh, asinh, atanh, expm1, and
     log1p functions.

   - bpo-45595(5): ‘setup.py’ and ‘makesetup’ now track build
     dependencies on all Python header files and module specific header
     files.

   - bpo-45571(6): ‘Modules/Setup’ now use ‘PY_CFLAGS_NODIST’ instead of
     ‘PY_CFLAGS’ to compile shared modules.

   - bpo-45570(7): ‘pyexpat’ and ‘_elementtree’ no longer define
     obsolete macros ‘HAVE_EXPAT_CONFIG_H’ and ‘USE_PYEXPAT_CAPI’.
     ‘XML_POOR_ENTROPY’ is now defined in ‘expat_config.h’.

   - bpo-43974(8): ‘setup.py’ no longer defines ‘Py_BUILD_CORE_MODULE’.
     Instead every module, that uses the internal API, defines the
     macro.

   - bpo-45548(9): Fill in missing entries in Modules/Setup.

   - bpo-45532(10): Update *note sys.version: 49c. to use ‘main’ as
     fallback information.  Patch by Jeong YunWon.

   - bpo-45536(11): The ‘configure’ script now checks whether OpenSSL
     headers and libraries provide required APIs.  Most common APIs are
     verified.  The check detects outdated or missing OpenSSL. Failures
     do not stop configure.

   - bpo-45221(12): Fixed regression in handling of ‘LDFLAGS’ and
     ‘CPPFLAGS’ options where ‘argparse.parse_known_args()’ could
     interpret an option as one of the built-in command line argument,
     for example ‘-h’ for help.

   - bpo-45440(13): Building Python now requires a C99 ‘<math.h>’ header
     file providing the following functions: ‘copysign()’, ‘hypot()’,
     ‘isfinite()’, ‘isinf()’, ‘isnan()’, ‘round()’.  Patch by Victor
     Stinner.

   - bpo-45405(14): Prevent ‘internal configure error’ when running
     ‘configure’ with recent versions of non-Apple clang.  Patch by
     David Bohman.

   - bpo-45433(15): Avoid linking libpython with libcrypt.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43158

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45666

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45548

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45548

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45595

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45571

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45570

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43974

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45548

   (10) https://bugs.python.org/issue?@action=redirect&bpo=45532

   (11) https://bugs.python.org/issue?@action=redirect&bpo=45536

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45221

   (13) https://bugs.python.org/issue?@action=redirect&bpo=45440

   (14) https://bugs.python.org/issue?@action=redirect&bpo=45405

   (15) https://bugs.python.org/issue?@action=redirect&bpo=45433


File: python.info,  Node: Windows<36>,  Next: macOS<26>,  Prev: ビルド<41>,  Up: Python 3 11 0 alpha 2

1.24.41.6 Windows
.................

   - bpo-43652(1): Update Tcl/Tk to 8.6.11, actually this time.  The
     previous update incorrectly included 8.6.10.

   - bpo-45337(2): venv now warns when the created environment may need
     to be accessed at a different path, due to redirections, links or
     junctions.  It also now correctly installs or upgrades components
     when the alternate path is required.

   - bpo-43851(3): Build SQLite ‘SQLITE_OMIT_AUTOINIT’ on Windows.
     Patch by Erlend E. Aasland.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43652

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45337

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43851


File: python.info,  Node: macOS<26>,  Next: IDLE<18>,  Prev: Windows<36>,  Up: Python 3 11 0 alpha 2

1.24.41.7 macOS
...............

   - bpo-44828(1): Avoid tkinter file dialog failure on macOS 12
     Monterey when using the Tk 8.6.11 provided by python.org macOS
     installers.  Patch by Marc Culler of the Tk project.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44828


File: python.info,  Node: IDLE<18>,  Next: C API<36>,  Prev: macOS<26>,  Up: Python 3 11 0 alpha 2

1.24.41.8 IDLE
..............

   - bpo-45495(1): Add context keywords 'case' and 'match' to
     completions list.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45495


File: python.info,  Node: C API<36>,  Prev: IDLE<18>,  Up: Python 3 11 0 alpha 2

1.24.41.9 C API
...............

   - bpo-29103(1): *note PyType_FromSpec*: 773. now copies the class
     name from the spec to a buffer owned by the class, so the original
     can be safely deallocated.  Patch by Petr Viktorin.

   - bpo-45522(2): The internal freelists for frame, float, list, dict,
     async generators, and context objects can now be disabled.

   - bpo-35134(3): Exclude *note PyWeakref_GET_OBJECT(): 3de. from the
     limited C API. It never worked since the ‘PyWeakReference’
     structure is opaque in the limited C API.

   - bpo-35081(4): Move the ‘interpreteridobject.h’ header file from
     ‘Include/’ to ‘Include/internal/’.  It only provides private
     functions.  Patch by Victor Stinner.

   - bpo-35134(5): The non-limited API files ‘cellobject.h’,
     ‘classobject.h’, ‘context.h’, ‘funcobject.h’, ‘genobject.h’ and
     ‘longintrepr.h’ have been moved to the ‘Include/cpython’ directory.
     Moreover, the ‘eval.h’ header file was removed.  These files must
     not be included directly, as they are already included in
     ‘Python.h’: *note Include Files: 987.  If they have been included
     directly, consider including ‘Python.h’ instead.  Patch by Victor
     Stinner.

   - bpo-45474(6): The following items are no longer available when
     ‘Py_LIMITED_API’ is defined:

        * *note PyMarshal_WriteLongToFile(): 999.

        * *note PyMarshal_WriteObjectToFile(): 99a.

        * *note PyMarshal_ReadObjectFromString(): 99b.

        * *note PyMarshal_WriteObjectToString(): 99c.

        * ‘Py_MARSHAL_VERSION’ マクロ

     These are not part of the *note limited API: 99d.

     Patch by Victor Stinner.

   - bpo-45434(7): Remove the ‘pystrhex.h’ header file.  It only
     contains private functions.  C extensions should only include the
     main ‘<Python.h>’ header file.  Patch by Victor Stinner.

   - bpo-45440(8): Remove the ‘Py_FORCE_DOUBLE()’ macro.  It was used by
     the ‘Py_IS_INFINITY()’ macro.  Patch by Victor Stinner.

   - bpo-45434(9): ‘<Python.h>’ no longer includes the header files
     ‘<stdlib.h>’, ‘<stdio.h>’, ‘<errno.h>’ and ‘<string.h>’ when the
     ‘Py_LIMITED_API’ macro is set to ‘0x030b0000’ (Python 3.11) or
     higher.  C extensions should explicitly include the header files
     after ‘#include <Python.h>’.  Patch by Victor Stinner.

   - bpo-41123(10): Remove ‘Py_UNICODE_COPY()’ and ‘Py_UNICODE_FILL()’
     macros, deprecated since Python 3.3.  Use
     ‘PyUnicode_CopyCharacters()’ or ‘memcpy()’ (‘wchar_t*’ string), and
     ‘PyUnicode_Fill()’ functions instead.  Patch by Victor Stinner.

   - bpo-45412(11): Remove the following math macros using the ‘errno’
     variable:

        * ‘Py_ADJUST_ERANGE1()’

        * ‘Py_ADJUST_ERANGE2()’

        * ‘Py_OVERFLOWED()’

        * ‘Py_SET_ERANGE_IF_OVERFLOW()’

        * ‘Py_SET_ERRNO_ON_MATH_ERROR()’

     Patch by Victor Stinner.

   - bpo-45395(12): Custom frozen modules (the array set to
     ‘PyImport_FrozenModules’) are now treated as additions, rather than
     replacing all the default frozen modules.  Frozen stdlib modules
     can still be disabled by setting the "code" field of the custom
     array entry to NULL.

   - bpo-43760(13): Add new *note PyThreadState_EnterTracing(): 95a, and
     *note PyThreadState_LeaveTracing(): 95b. functions to the limited C
     API to suspend and resume tracing and profiling.  Patch by Victor
     Stinner.

   - bpo-44220(14): *note PyStructSequence_UnnamedField: b79. is added
     to the Stable ABI.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29103

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45522

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35134

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35081

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35134

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45474

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45434

   (8) https://bugs.python.org/issue?@action=redirect&bpo=45440

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45434

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41123

   (11) https://bugs.python.org/issue?@action=redirect&bpo=45412

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45395

   (13) https://bugs.python.org/issue?@action=redirect&bpo=43760

   (14) https://bugs.python.org/issue?@action=redirect&bpo=44220


File: python.info,  Node: Python 3 11 0 alpha 1,  Next: Python 3 10 0 beta 1,  Prev: Python 3 11 0 alpha 2,  Up: 変更履歴

1.24.42 Python 3.11.0 alpha 1
-----------------------------

'Release date: 2021-10-05'

* Menu:

* セキュリティ: セキュリティ<29>.
* Core and Builtins: Core and Builtins<104>.
* ライブラリ: ライブラリ<107>.
* Core and Builtins: Core and Builtins<105>.
* ライブラリ: ライブラリ<108>.
* Core and Builtins: Core and Builtins<106>.
* ライブラリ: ライブラリ<109>.
* Core and Builtins: Core and Builtins<107>.
* ライブラリ: ライブラリ<110>.
* Core and Builtins: Core and Builtins<108>.
* ライブラリ: ライブラリ<111>.
* Core and Builtins: Core and Builtins<109>.
* ライブラリ: ライブラリ<112>.
* Core and Builtins: Core and Builtins<110>.
* ライブラリ: ライブラリ<113>.
* Core and Builtins: Core and Builtins<111>.
* ライブラリ: ライブラリ<114>.
* Core and Builtins: Core and Builtins<112>.
* ライブラリ: ライブラリ<115>.
* Core and Builtins: Core and Builtins<113>.
* ライブラリ: ライブラリ<116>.
* ドキュメント: ドキュメント<36>.
* テスト: テスト<35>.
* ビルド: ビルド<42>.
* Windows: Windows<37>.
* macOS: macOS<27>.
* IDLE: IDLE<19>.
* Tools/Demos: Tools/Demos<27>.
* C API: C API<37>.


File: python.info,  Node: セキュリティ<29>,  Next: Core and Builtins<104>,  Up: Python 3 11 0 alpha 1

1.24.42.1 セキュリティ
......................

   - bpo-42278(1): Replaced usage of *note tempfile.mktemp(): 1c30. with
     *note TemporaryDirectory: 144c. to avoid a potential race
     condition.

   - bpo-44600(2): Fix incorrect line numbers while tracing some failed
     patterns in *note match: a0e. statements.  Patch by Charles
     Burkland.

   - bpo-41180(3): Add auditing events to the *note marshal: 91. module,
     and stop raising ‘code.__init__’ events for every unmarshalled code
     object.  Directly instantiated code objects will continue to raise
     an event, and audit event handlers should inspect or collect the
     raw marshal data.  This reduces a significant performance overhead
     when loading from ‘.pyc’ files.

   - bpo-44394(4): Update the vendored copy of libexpat to 2.4.1 (from
     2.2.8) to get the fix for the CVE 2013-0340(5) "Billion Laughs"
     vulnerability.  This copy is most used on Windows and macOS.

   - bpo-43124(6): Made the internal ‘putcmd’ function in *note smtplib:
     cf. sanitize input for presence of ‘\r’ and ‘\n’ characters to
     avoid (unlikely) command injection.

   - bpo-44022(7): *note http.client: 73. now avoids infinitely reading
     potential HTTP headers after a ‘100 Continue’ status response from
     the server.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42278

   (2) https://bugs.python.org/issue?@action=redirect&bpo=44600

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41180

   (4) https://bugs.python.org/issue?@action=redirect&bpo=44394

   (5) https://www.cve.org/CVERecord?id=CVE-2013-0340

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43124

   (7) https://bugs.python.org/issue?@action=redirect&bpo=44022


File: python.info,  Node: Core and Builtins<104>,  Next: ライブラリ<107>,  Prev: セキュリティ<29>,  Up: Python 3 11 0 alpha 1

1.24.42.2 Core and Builtins
...........................

   - bpo-43760(1): The number of hardware branches per instruction
     dispatch is reduced from two to one by adding a special instruction
     for tracing.  Patch by Mark Shannon.

   - bpo-45061(2): Add a deallocator to the bool type to detect refcount
     bugs in C extensions which call Py_DECREF(Py_True) or
     Py_DECREF(Py_False) by mistake.  Detect also refcount bugs when the
     empty tuple singleton or the Unicode empty string singleton is
     destroyed by mistake.  Patch by Victor Stinner.

   - bpo-24076(3): sum() was further optimised for summing up single
     digit integers.

   - bpo-45190(4): Update Unicode databases to Unicode 14.0.0.

   - bpo-45167(5): Fix deepcopying of *note types.GenericAlias: 9ec.
     objects.

   - bpo-45155(6): *note int.to_bytes(): 1c32. and *note
     int.from_bytes(): 1be9. now take a default value of ‘"big"’ for the
     ‘byteorder’ argument.  *note int.to_bytes(): 1c32. also takes a
     default value of ‘1’ for the ‘length’ argument.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43760

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45061

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24076

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45190

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45167

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45155


File: python.info,  Node: ライブラリ<107>,  Next: Core and Builtins<105>,  Prev: Core and Builtins<104>,  Up: Python 3 11 0 alpha 1

1.24.42.3 ライブラリ
....................

   - bpo-44219(1): Release the GIL while performing ‘isatty’ system
     calls on arbitrary file descriptors.  In particular, this affects
     *note os.isatty(): 1c34, *note os.device_encoding(): 1c35. and
     *note io.TextIOWrapper: 9be.  By extension, *note io.open(): 740.
     in text mode is also affected.  This change solves a deadlock in
     *note os.isatty(): 1c34.  Patch by Vincent Michel in bpo-44219(2).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44219

   (2) https://bugs.python.org/issue?@action=redirect&bpo=44219


File: python.info,  Node: Core and Builtins<105>,  Next: ライブラリ<108>,  Prev: ライブラリ<107>,  Up: Python 3 11 0 alpha 1

1.24.42.4 Core and Builtins
...........................

   - bpo-44959(1): Added fallback to extension modules with '.sl' suffix
     on HP-UX

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44959


File: python.info,  Node: ライブラリ<108>,  Next: Core and Builtins<106>,  Prev: Core and Builtins<105>,  Up: Python 3 11 0 alpha 1

1.24.42.5 ライブラリ
....................

   - bpo-45121(1): Fix issue where ‘Protocol.__init__’ raises
     ‘RecursionError’ when it's called directly or via ‘super()’.  Patch
     provided by Yurii Karabas.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45121


File: python.info,  Node: Core and Builtins<106>,  Next: ライブラリ<109>,  Prev: ライブラリ<108>,  Up: Python 3 11 0 alpha 1

1.24.42.6 Core and Builtins
...........................

   - bpo-44348(1): The deallocator function of the *note BaseException:
     7d6. type now uses the trashcan mechanism to prevent stack
     overflow.  For example, when a *note RecursionError: f68. instance
     is raised, it can be linked to another RecursionError through the
     ‘__context__’ attribute or the ‘__traceback__’ attribute, and then
     a chain of exceptions is created.  When the chain is destroyed,
     nested deallocator function calls can crash with a stack overflow
     if the chain is too long compared to the available stack memory.
     Patch by Victor Stinner.

   - bpo-45123(2): Fix PyAiter_Check to only check for the __anext__
     presence (not for __aiter__).  Rename PyAiter_Check to
     PyAIter_Check, PyObject_GetAiter -> PyObject_GetAIter.

   - bpo-1514420(3): Interpreter no longer attempts to open files with
     names in angle brackets (like "<string>" or "<stdin>") when
     formatting an exception.

   - bpo-41031(4): Match C and Python code formatting of unprintable
     exceptions and exceptions in the *note __main__: 1. module.

   - bpo-37330(5): *note open(): 316, *note io.open(): 740, *note
     codecs.open(): 315. and *note fileinput.FileInput: 940. no longer
     accept ‘'U'’ ("universal newline") in the file mode.  This flag was
     deprecated since Python 3.3.  Patch by Victor Stinner.

   - bpo-45083(6): When the interpreter renders an exception, its name
     now has a complete qualname.  Previously only the class name was
     concatenated to the module name, which sometimes resulted in an
     incorrect full name being displayed.

     (This issue impacted only the C code exception rendering, the *note
     traceback: 104. module was using qualname already).

   - bpo-34561(7): List sorting now uses the merge-ordering strategy
     from Munro and Wild's ‘powersort()’.  Unlike the former strategy,
     this is provably near-optimal in the entropy of the distribution of
     run lengths.  Most uses of ‘list.sort()’ probably won't see a
     significant time difference, but may see significant improvements
     in cases where the former strategy was exceptionally poor.
     However, as these are all fast linear-time approximations to a
     problem that's inherently at best quadratic-time to solve truly
     optimally, it's also possible to contrive cases where the former
     strategy did better.

   - bpo-45056(8): Compiler now removes trailing unused constants from
     co_consts.

   - bpo-45020(9): Add a new command line option, "-X
     frozen_modules=[on|off]" to opt out of (or into) using optional
     frozen modules.  This defaults to "on" (or "off" if it's running
     out of the source tree).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44348

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45123

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1514420

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41031

   (5) https://bugs.python.org/issue?@action=redirect&bpo=37330

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45083

   (7) https://bugs.python.org/issue?@action=redirect&bpo=34561

   (8) https://bugs.python.org/issue?@action=redirect&bpo=45056

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45020


File: python.info,  Node: ライブラリ<109>,  Next: Core and Builtins<107>,  Prev: Core and Builtins<106>,  Up: Python 3 11 0 alpha 1

1.24.42.7 ライブラリ
....................

   - bpo-45012(1): In *note posix: b2, release GIL during ‘stat()’,
     ‘lstat()’, and ‘fstatat()’ syscalls made by *note
     os.DirEntry.stat(): 1a6b.  Patch by Stanisław Skonieczny.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45012


File: python.info,  Node: Core and Builtins<107>,  Next: ライブラリ<110>,  Prev: ライブラリ<109>,  Up: Python 3 11 0 alpha 1

1.24.42.8 Core and Builtins
...........................

   - bpo-45018(1): Fixed pickling of range iterators that iterated for
     over ‘2**32’ times.

   - bpo-45000(2): A *note SyntaxError: 18e. is now raised when trying
     to delete *note __debug__: 9da.  Patch by Donghee Na.

   - bpo-44963(3): Implement ‘send()’ and ‘throw()’ methods for
     ‘anext_awaitable’ objects.  Patch by Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45018

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45000

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44963


File: python.info,  Node: ライブラリ<110>,  Next: Core and Builtins<108>,  Prev: Core and Builtins<107>,  Up: Python 3 11 0 alpha 1

1.24.42.9 ライブラリ
....................

   - bpo-44962(1): Fix a race in WeakKeyDictionary, WeakValueDictionary
     and WeakSet when two threads attempt to commit the last pending
     removal.  This fixes asyncio.create_task and fixes a data loss in
     asyncio.run where shutdown_asyncgens is not run

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44962


File: python.info,  Node: Core and Builtins<108>,  Next: ライブラリ<111>,  Prev: ライブラリ<110>,  Up: Python 3 11 0 alpha 1

1.24.42.10 Core and Builtins
............................

   - bpo-24234(1): Implement the ‘__bytes__()’ special method on the
     *note bytes: 192. type, so a bytes object ‘b’ passes an
     ‘isinstance(b, typing.SupportsBytes)’ check.

   - bpo-24234(2): Implement the ‘__complex__()’ special method on the
     *note complex: 197. type, so a complex number ‘z’ passes an
     ‘isinstance(z, typing.SupportsComplex)’ check.

   - bpo-44954(3): Fixed a corner case bug where the result of
     ‘float.fromhex('0x.8p-1074')’ was rounded the wrong way.

   - bpo-44947(4): Refine the syntax error for trailing commas in import
     statements.  Patch by Pablo Galindo.

   - bpo-44945(5): Specialize the BINARY_ADD instruction using the PEP
     659 machinery.  Adds five new instructions:

        * BINARY_ADD_ADAPTIVE

        * BINARY_ADD_FLOAT

        * BINARY_ADD_INT

        * BINARY_ADD_UNICODE

        * BINARY_ADD_UNICODE_INPLACE_FAST

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24234

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24234

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44954

   (4) https://bugs.python.org/issue?@action=redirect&bpo=44947

   (5) https://bugs.python.org/issue?@action=redirect&bpo=44945


File: python.info,  Node: ライブラリ<111>,  Next: Core and Builtins<109>,  Prev: Core and Builtins<108>,  Up: Python 3 11 0 alpha 1

1.24.42.11 ライブラリ
.....................

   - bpo-44929(1): Fix some edge cases of ‘enum.Flag’ string
     representation in the REPL. Patch by Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44929


File: python.info,  Node: Core and Builtins<109>,  Next: ライブラリ<112>,  Prev: ライブラリ<111>,  Up: Python 3 11 0 alpha 1

1.24.42.12 Core and Builtins
............................

   - bpo-44914(1): Class version tags are no longer recycled.

     This means that a version tag serves as a unique identifier for the
     state of a class.  We rely on this for effective specialization of
     the LOAD_ATTR and other instructions.

   - bpo-44698(2): Restore behaviour of complex exponentiation with
     integer-valued exponent of type *note float: 196. or *note complex:
     197.

   - bpo-44895(3): A debug variable *note PYTHONDUMPREFSFILE: 1c3f. is
     added for creating a dump file which is generated by *note
     -with-trace-refs: 636.  Patch by Donghee Na.

   - bpo-44900(4): Add five superinstructions for PEP 659 quickening:

        * LOAD_FAST LOAD_FAST

        * STORE_FAST LOAD_FAST

        * LOAD_FAST LOAD_CONST

        * LOAD_CONST LOAD_FAST

        * STORE_FAST STORE_FAST

   - bpo-44889(5): Initial implementation of adaptive specialization of
     ‘LOAD_METHOD’.  The following specialized forms were added:

        * ‘LOAD_METHOD_CACHED’

        * ‘LOAD_METHOD_MODULE’

        * ‘LOAD_METHOD_CLASS’

   - bpo-44890(6): Specialization stats are always collected in debug
     builds.

   - bpo-44885(7): Correct the ast locations of f-strings with format
     specs and repeated expressions.  Patch by Pablo Galindo

   - bpo-44878(8): Remove the loop from the bytecode interpreter.  All
     instructions end with a DISPATCH macro, so the loop is now
     redundant.

   - bpo-44878(9): Remove switch statement for interpreter loop when
     using computed gotos.  This makes sure that we only have one
     dispatch table in the interpreter.

   - bpo-44874(10): Deprecate the old trashcan macros
     (‘Py_TRASHCAN_SAFE_BEGIN’/‘Py_TRASHCAN_SAFE_END’).  They should be
     replaced by the new macros ‘Py_TRASHCAN_BEGIN’ and
     ‘Py_TRASHCAN_END’.

   - bpo-44872(11): Use new trashcan macros (Py_TRASHCAN_BEGIN/END) in
     frameobject.c instead of the old ones (Py_TRASHCAN_SAFE_BEGIN/END).

   - bpo-33930(12): Fix segmentation fault with deep recursion when
     cleaning method objects.  Patch by Augusto Goulart and Pablo
     Galindo.

   - bpo-25782(13): Fix bug where ‘PyErr_SetObject’ hangs when the
     current exception has a cycle in its context chain.

   - bpo-44856(14): Fix reference leaks in the error paths of
     ‘update_bases()’ and ‘__build_class__’.  Patch by Pablo Galindo.

   - bpo-44826(15): Initial implementation of adaptive specialization of
     STORE_ATTR

     Three specialized forms of STORE_ATTR are added:

        * STORE_ATTR_SLOT

        * STORE_ATTR_SPLIT_KEYS

        * STORE_ATTR_WITH_HINT

   - bpo-44838(16): Fixed a bug that was causing the parser to raise an
     incorrect custom *note SyntaxError: 18e. for invalid 'if'
     expressions.  Patch by Pablo Galindo.

   - bpo-44821(17): Create instance dictionaries (__dict__) eagerly, to
     improve regularity of object layout and assist specialization.

   - bpo-44792(18): Improve syntax errors for if expressions.  Patch by
     Miguel Brito

   - bpo-34013(19): Generalize the invalid legacy statement custom error
     message (like the one generated when "print" is called without
     parentheses) to include more generic expressions.  Patch by Pablo
     Galindo

   - bpo-44732(20): Rename ‘types.Union’ to ‘types.UnionType’.

   - bpo-44725(21): Expose specialization stats in python via
     ‘_opcode.get_specialization_stats()’.

   - bpo-44717(22): Improve AttributeError on circular imports of
     submodules.

   - bpo-44698(23): Fix undefined behaviour in complex object
     exponentiation.

   - bpo-44653(24): Support *note typing: 10a. types in parameter
     substitution in the union type.

   - bpo-44676(25): Add ability to serialise ‘types.Union’ objects.
     Patch provided by Yurii Karabas.

   - bpo-44633(26): Parameter substitution of the union type with wrong
     types now raises ‘TypeError’ instead of returning *note
     NotImplemented: 1a2.

   - bpo-44661(27): Update ‘property_descr_set’ to use vectorcall if
     possible.  Patch by Donghee Na.

   - bpo-44662(28): Add ‘__module__’ to ‘types.Union’.  This also fixes
     ‘types.Union’ issues with ‘typing.Annotated’.  Patch provided by
     Yurii Karabas.

   - bpo-44655(29): Include the name of the type in unset __slots__
     attribute errors.  Patch by Pablo Galindo

   - bpo-44655(30): Don't include a missing attribute with the same name
     as the failing one when offering suggestions for missing
     attributes.  Patch by Pablo Galindo

   - bpo-44646(31): Fix the hash of the union type: it no longer depends
     on the order of arguments.

   - bpo-44636(32): Collapse union of equal types.  E.g.  the result of
     ‘int | int’ is now ‘int’.  Fix comparison of the union type with
     non-hashable objects.  E.g.  ‘int | str == {}’ no longer raises a
     TypeError.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44914

   (2) https://bugs.python.org/issue?@action=redirect&bpo=44698

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44895

   (4) https://bugs.python.org/issue?@action=redirect&bpo=44900

   (5) https://bugs.python.org/issue?@action=redirect&bpo=44889

   (6) https://bugs.python.org/issue?@action=redirect&bpo=44890

   (7) https://bugs.python.org/issue?@action=redirect&bpo=44885

   (8) https://bugs.python.org/issue?@action=redirect&bpo=44878

   (9) https://bugs.python.org/issue?@action=redirect&bpo=44878

   (10) https://bugs.python.org/issue?@action=redirect&bpo=44874

   (11) https://bugs.python.org/issue?@action=redirect&bpo=44872

   (12) https://bugs.python.org/issue?@action=redirect&bpo=33930

   (13) https://bugs.python.org/issue?@action=redirect&bpo=25782

   (14) https://bugs.python.org/issue?@action=redirect&bpo=44856

   (15) https://bugs.python.org/issue?@action=redirect&bpo=44826

   (16) https://bugs.python.org/issue?@action=redirect&bpo=44838

   (17) https://bugs.python.org/issue?@action=redirect&bpo=44821

   (18) https://bugs.python.org/issue?@action=redirect&bpo=44792

   (19) https://bugs.python.org/issue?@action=redirect&bpo=34013

   (20) https://bugs.python.org/issue?@action=redirect&bpo=44732

   (21) https://bugs.python.org/issue?@action=redirect&bpo=44725

   (22) https://bugs.python.org/issue?@action=redirect&bpo=44717

   (23) https://bugs.python.org/issue?@action=redirect&bpo=44698

   (24) https://bugs.python.org/issue?@action=redirect&bpo=44653

   (25) https://bugs.python.org/issue?@action=redirect&bpo=44676

   (26) https://bugs.python.org/issue?@action=redirect&bpo=44633

   (27) https://bugs.python.org/issue?@action=redirect&bpo=44661

   (28) https://bugs.python.org/issue?@action=redirect&bpo=44662

   (29) https://bugs.python.org/issue?@action=redirect&bpo=44655

   (30) https://bugs.python.org/issue?@action=redirect&bpo=44655

   (31) https://bugs.python.org/issue?@action=redirect&bpo=44646

   (32) https://bugs.python.org/issue?@action=redirect&bpo=44636


File: python.info,  Node: ライブラリ<112>,  Next: Core and Builtins<110>,  Prev: Core and Builtins<109>,  Up: Python 3 11 0 alpha 1

1.24.42.13 ライブラリ
.....................

   - bpo-44611(1): On Windows, *note os.urandom(): 746.: uses
     BCryptGenRandom API instead of CryptGenRandom API which is
     deprecated from Microsoft Windows API. Patch by Donghee Na.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44611


File: python.info,  Node: Core and Builtins<110>,  Next: ライブラリ<113>,  Prev: ライブラリ<112>,  Up: Python 3 11 0 alpha 1

1.24.42.14 Core and Builtins
............................

   - bpo-44635(1): Convert ‘None’ to ‘type(None)’ in the union type
     constructor.

   - bpo-26280(2): Implement adaptive specialization for BINARY_SUBSCR

     Three specialized forms of BINARY_SUBSCR are added:

        * BINARY_SUBSCR_LIST_INT

        * BINARY_SUBSCR_TUPLE_INT

        * BINARY_SUBSCR_DICT

   - bpo-44589(3): Mapping patterns in ‘match’ statements with two or
     more equal literal keys will now raise a *note SyntaxError: 18e. at
     compile-time.

   - bpo-44606(4): Fix ‘__instancecheck__’ and ‘__subclasscheck__’ for
     the union type.

   - bpo-42073(5): The ‘@classmethod’ decorator can now wrap other
     classmethod-like descriptors.

   - bpo-41972(6): Tuned the string-searching algorithm of fastsearch.h
     to have a shorter inner loop for most cases.

   - bpo-44590(7): All necessary data for executing a Python function
     (local variables, stack, etc) is now kept in a per-thread stack.
     Frame objects are lazily allocated on demand.  This increases
     performance by about 7% on the standard benchmark suite.
     Introspection and debugging are unaffected as frame objects are
     always available when needed.  Patch by Mark Shannon.

   - bpo-44584(8): The threading debug (‘PYTHONTHREADDEBUG’ environment
     variable) is deprecated in Python 3.10 and will be removed in
     Python 3.12.  This feature requires a debug build of Python.  Patch
     by Victor Stinner.

   - bpo-43895(9): An obsolete internal cache of shared object file
     handles added in 1995 that attempted, but did not guarantee, that a
     .so would not be dlopen'ed twice to work around flaws in mid-1990s
     posix-ish operating systems has been removed from dynload_shlib.c.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44635

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26280

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44589

   (4) https://bugs.python.org/issue?@action=redirect&bpo=44606

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42073

   (6) https://bugs.python.org/issue?@action=redirect&bpo=41972

   (7) https://bugs.python.org/issue?@action=redirect&bpo=44590

   (8) https://bugs.python.org/issue?@action=redirect&bpo=44584

   (9) https://bugs.python.org/issue?@action=redirect&bpo=43895


File: python.info,  Node: ライブラリ<113>,  Next: Core and Builtins<111>,  Prev: Core and Builtins<110>,  Up: Python 3 11 0 alpha 1

1.24.42.15 ライブラリ
.....................

   - bpo-44490(1): *note typing: 10a. now searches for type parameters
     in ‘types.Union’ objects.  ‘get_type_hints’ will also properly
     resolve annotations with nested ‘types.Union’ objects.  Patch
     provided by Yurii Karabas.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44490


File: python.info,  Node: Core and Builtins<111>,  Next: ライブラリ<114>,  Prev: ライブラリ<113>,  Up: Python 3 11 0 alpha 1

1.24.42.16 Core and Builtins
............................

   - bpo-43950(1): Code objects can now provide the column information
     for instructions when available.  This is levaraged during
     traceback printing to show the expressions responsible for errors.

     Contributed by Pablo Galindo, Batuhan Taskaya and Ammar Askar as
     part of PEP 657(2).

   - bpo-44562(3): Remove uses of *note PyObject_GC_Del(): 171c. in
     error path when initializing *note types.GenericAlias: 9ec.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43950

   (2) https://peps.python.org/pep-0657/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44562


File: python.info,  Node: ライブラリ<114>,  Next: Core and Builtins<112>,  Prev: Core and Builtins<111>,  Up: Python 3 11 0 alpha 1

1.24.42.17 ライブラリ
.....................

   - bpo-41486(1): Fix a memory consumption and copying performance
     regression in earlier 3.10 beta releases if someone used an output
     buffer larger than 4GiB with zlib.decompress on input data that
     expands that large.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41486


File: python.info,  Node: Core and Builtins<112>,  Next: ライブラリ<115>,  Prev: ライブラリ<114>,  Up: Python 3 11 0 alpha 1

1.24.42.18 Core and Builtins
............................

   - bpo-43908(1): Heap types with the *note Py_TPFLAGS_IMMUTABLETYPE:
     3cf. flag can now inherit the PEP 590(2) vectorcall protocol.
     Previously, this was only possible for *note static types: 983.
     Patch by Erlend E. Aasland.

   - bpo-44553(3): Implement GC methods for ‘types.Union’ to break
     reference cycles and prevent memory leaks.

   - bpo-44490(4): Add ‘__parameters__’ attribute and ‘__getitem__’
     operator to ‘types.Union’.  Patch provided by Yurii Karabas.

   - bpo-44523(5): Remove the pass-through for *note hash(): 801. of
     *note weakref.proxy: c46. objects to prevent unintended
     consequences when the original referred object dies while the proxy
     is part of a hashable object.  Patch by Pablo Galindo.

   - bpo-44483(6): Fix a crash in ‘types.Union’ objects when creating a
     union of an object with bad ‘__module__’ field.

   - bpo-44486(7): Modules will always have a dictionary, even when
     created by ‘types.ModuleType.__new__()’

   - bpo-44472(8): Fix ltrace functionality when exceptions are raised.
     Patch by Pablo Galindo

   - bpo-12022(9): A *note TypeError: 198. is now raised instead of an
     *note AttributeError: 5f0. in *note with: 186. and *note async
     with: 185. statements for objects which do not support the *note
     context manager: 1e1. or *note asynchronous context manager: 7f0.
     protocols correspondingly.

   - bpo-44297(10): Make sure that the line number is set when entering
     a comprehension scope.  This ensures that backtraces including
     generator expressions show the correct line number.

   - bpo-44456(11): Improve the syntax error when mixing positional and
     keyword patterns.  Patch by Pablo Galindo.

   - bpo-44409(12): Fix error location information for tokenizer errors
     raised on initialization of the tokenizer.  Patch by Pablo Galindo.

   - bpo-44396(13): Fix a possible crash in the tokenizer when raising
     syntax errors for unclosed strings.  Patch by Pablo Galindo.

   - bpo-44376(14): Exact integer exponentiation (like ‘i**2’ or ‘pow(i,
     2)’) with a small exponent is much faster, due to reducing overhead
     in such cases.

   - bpo-44313(15): Directly imported objects and modules (through
     import and from import statements) don't generate
     ‘LOAD_METHOD’/‘CALL_METHOD’ for directly accessed objects on their
     namespace.  They now use the regular ‘LOAD_ATTR’/‘CALL_FUNCTION’.

   - bpo-44338(16): Implement adaptive specialization for LOAD_GLOBAL

     Two specialized forms of LOAD_GLOBAL are added:

        * LOAD_GLOBAL_MODULE

        * LOAD_GLOBAL_BUILTIN

   - bpo-44368(17): Improve syntax errors for invalid "as" targets.
     Patch by Pablo Galindo

   - bpo-44349(18): Fix an edge case when displaying text from files
     with encoding in syntax errors.  Patch by Pablo Galindo.

   - bpo-44337(19): Initial implementation of adaptive specialization of
     LOAD_ATTR

     Four specialized forms of LOAD_ATTR are added:

        * LOAD_ATTR_SLOT

        * LOAD_ATTR_SPLIT_KEYS

        * LOAD_ATTR_WITH_HINT

        * LOAD_ATTR_MODULE

   - bpo-44335(20): Fix a regression when identifying incorrect
     characters in syntax errors.  Patch by Pablo Galindo

   - bpo-43693(21): Computation of the offsets of cell variables is done
     in the compiler instead of at runtime.  This reduces the overhead
     of handling cell and free variables, especially in the case where a
     variable is both an argument and cell variable.

   - bpo-44317(22): Improve tokenizer error with improved locations.
     Patch by Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43908

   (2) https://peps.python.org/pep-0590/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44553

   (4) https://bugs.python.org/issue?@action=redirect&bpo=44490

   (5) https://bugs.python.org/issue?@action=redirect&bpo=44523

   (6) https://bugs.python.org/issue?@action=redirect&bpo=44483

   (7) https://bugs.python.org/issue?@action=redirect&bpo=44486

   (8) https://bugs.python.org/issue?@action=redirect&bpo=44472

   (9) https://bugs.python.org/issue?@action=redirect&bpo=12022

   (10) https://bugs.python.org/issue?@action=redirect&bpo=44297

   (11) https://bugs.python.org/issue?@action=redirect&bpo=44456

   (12) https://bugs.python.org/issue?@action=redirect&bpo=44409

   (13) https://bugs.python.org/issue?@action=redirect&bpo=44396

   (14) https://bugs.python.org/issue?@action=redirect&bpo=44376

   (15) https://bugs.python.org/issue?@action=redirect&bpo=44313

   (16) https://bugs.python.org/issue?@action=redirect&bpo=44338

   (17) https://bugs.python.org/issue?@action=redirect&bpo=44368

   (18) https://bugs.python.org/issue?@action=redirect&bpo=44349

   (19) https://bugs.python.org/issue?@action=redirect&bpo=44337

   (20) https://bugs.python.org/issue?@action=redirect&bpo=44335

   (21) https://bugs.python.org/issue?@action=redirect&bpo=43693

   (22) https://bugs.python.org/issue?@action=redirect&bpo=44317


File: python.info,  Node: ライブラリ<115>,  Next: Core and Builtins<113>,  Prev: Core and Builtins<112>,  Up: Python 3 11 0 alpha 1

1.24.42.19 ライブラリ
.....................

   - bpo-44304(1): Fix a crash in the *note sqlite3: d4. module that
     happened when the garbage collector clears ‘sqlite.Statement’
     objects.  Patch by Pablo Galindo

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44304


File: python.info,  Node: Core and Builtins<113>,  Next: ライブラリ<116>,  Prev: ライブラリ<115>,  Up: Python 3 11 0 alpha 1

1.24.42.20 Core and Builtins
............................

   - bpo-44305(1): Improve error message for ‘try’ blocks without
     ‘except’ or ‘finally’ blocks.  Patch by Pablo Galindo.

   - bpo-43413(2): Constructors of subclasses of some builtin classes
     (e.g.  *note tuple: 614, *note list: 24d, *note frozenset: 7f2.) no
     longer accept arbitrary keyword arguments.  [reverted in 3.11a4]
     Subclass of *note set: 184. can now define a ‘__new__()’ method
     with additional keyword parameters without overriding also
     ‘__init__()’.

   - bpo-43667(3): Improve Unicode support in non-UTF locales on Oracle
     Solaris.  This issue does not affect other Solaris systems.

   - bpo-43693(4): A new opcode MAKE_CELL has been added that
     effectively moves some of the work done on function entry into the
     compiler and into the eval loop.  In addition to creating the
     required cell objects, the new opcode converts relevant arguments
     (and other locals) to cell variables on function entry.

   - bpo-44232(5): Fix a regression in *note type(): f44. when a
     metaclass raises an exception.  The C function ‘type_new()’ must
     properly report the exception when a metaclass constructor raises
     an exception and the winner class is not the metaclass.  Patch by
     Victor Stinner.

   - bpo-44201(6): Avoid side effects of checking for specialized syntax
     errors in the REPL that was causing it to ask for extra tokens
     after a syntax error had been detected.  Patch by Pablo Galindo

   - bpo-43693(7): ‘PyCodeObject’ gained ‘co_fastlocalnames’ and
     ‘co_fastlocalkinds’ as the authoritative source of fast locals
     info.  Marshaled code objects have changed accordingly.

   - bpo-44184(8): Fix a crash at Python exit when a deallocator
     function removes the last strong reference to a heap type.  Patch
     by Victor Stinner.

   - bpo-44187(9): Implement quickening in the interpreter.  This offers
     no advantages as yet, but is an enabler of future optimizations.
     See PEP 659 for full explanation.

   - bpo-44180(10): The parser doesn't report generic syntax errors that
     happen in a position further away that the one it reached in the
     first pass.  Patch by Pablo Galindo

   - bpo-44168(11): Fix error message in the parser involving keyword
     arguments with invalid expressions.  Patch by Pablo Galindo

   - bpo-44156(12): String caches in ‘compile.c’ are now subinterpreter
     compatible.

   - bpo-44143(13): Fixed a crash in the parser that manifest when
     raising tokenizer errors when an existing exception was present.
     Patch by Pablo Galindo.

   - bpo-44032(14): Move 'fast' locals and other variables from the
     frame object to a per-thread datastack.

   - bpo-44114(15): Fix incorrect dictkeys_reversed and
     dictitems_reversed function signatures in C code, which broke
     webassembly builds.

   - bpo-44110(16): Improve ‘str.__getitem__()’ error message

   - bpo-26110(17): Add ‘CALL_METHOD_KW’ opcode to speed up method calls
     with keyword arguments.  Idea originated from PyPy.  A side effect
     is executing ‘CALL_METHOD’ is now branchless in the evaluation
     loop.

   - bpo-28307(18): Compiler now optimizes simple C-style formatting
     with literal format containing only format codes %s, %r and %a by
     converting them to f-string expressions.

   - bpo-43149(19): Correct the syntax error message regarding multiple
     exception types to not refer to "exception groups".  Patch by Pablo
     Galindo

   - bpo-43822(20): The parser will prioritize tokenizer errors over
     custom syntax errors when raising exceptions.  Patch by Pablo
     Galindo.

   - bpo-40222(21): "Zero cost" exception handling.

        * Uses a lookup table to determine how to handle exceptions.

        * Removes SETUP_FINALLY and POP_TOP block instructions,
          eliminating the runtime overhead of try statements.

        * Reduces the size of the frame object by about 60%.

     Patch by Mark Shannon

   - bpo-43918(22): Document the signature and ‘default’ argument in the
     docstring of the new ‘anext’ builtin.

   - bpo-43833(23): Emit a deprecation warning if the numeric literal is
     immediately followed by one of keywords: and, else, for, if, in,
     is, or.  Raise a syntax error with more informative message if it
     is immediately followed by other keyword or identifier.

   - bpo-43879(24): Add native_thread_id to PyThreadState.  Patch by
     Gabriele N. Tornetta.

   - bpo-43693(25): Compute cell offsets relative to locals in compiler.
     Allows the interpreter to treats locals and cells a single array,
     which is slightly more efficient.  Also make the LOAD_CLOSURE
     opcode an alias for LOAD_FAST. Preserving LOAD_CLOSURE helps keep
     bytecode a bit more readable.

   - bpo-17792(26): More accurate error messages for access of unbound
     locals or free vars.

   - bpo-28146(27): Fix a confusing error message in *note str.format():
     833.

   - bpo-11105(28): When compiling *note ast.AST: 4c3. objects with
     recursive references through *note compile(): 4b1, the interpreter
     doesn't crash anymore instead it raises a *note RecursionError:
     f68.

   - bpo-39091(29): Fix crash when using passing a non-exception to a
     generator's ‘throw()’ method.  Patch by Noah Oxer

   - bpo-33346(30): Asynchronous comprehensions are now allowed inside
     comprehensions in asynchronous functions.  Outer comprehensions
     implicitly become asynchronous.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44305

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43413

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43667

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43693

   (5) https://bugs.python.org/issue?@action=redirect&bpo=44232

   (6) https://bugs.python.org/issue?@action=redirect&bpo=44201

   (7) https://bugs.python.org/issue?@action=redirect&bpo=43693

   (8) https://bugs.python.org/issue?@action=redirect&bpo=44184

   (9) https://bugs.python.org/issue?@action=redirect&bpo=44187

   (10) https://bugs.python.org/issue?@action=redirect&bpo=44180

   (11) https://bugs.python.org/issue?@action=redirect&bpo=44168

   (12) https://bugs.python.org/issue?@action=redirect&bpo=44156

   (13) https://bugs.python.org/issue?@action=redirect&bpo=44143

   (14) https://bugs.python.org/issue?@action=redirect&bpo=44032

   (15) https://bugs.python.org/issue?@action=redirect&bpo=44114

   (16) https://bugs.python.org/issue?@action=redirect&bpo=44110

   (17) https://bugs.python.org/issue?@action=redirect&bpo=26110

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28307

   (19) https://bugs.python.org/issue?@action=redirect&bpo=43149

   (20) https://bugs.python.org/issue?@action=redirect&bpo=43822

   (21) https://bugs.python.org/issue?@action=redirect&bpo=40222

   (22) https://bugs.python.org/issue?@action=redirect&bpo=43918

   (23) https://bugs.python.org/issue?@action=redirect&bpo=43833

   (24) https://bugs.python.org/issue?@action=redirect&bpo=43879

   (25) https://bugs.python.org/issue?@action=redirect&bpo=43693

   (26) https://bugs.python.org/issue?@action=redirect&bpo=17792

   (27) https://bugs.python.org/issue?@action=redirect&bpo=28146

   (28) https://bugs.python.org/issue?@action=redirect&bpo=11105

   (29) https://bugs.python.org/issue?@action=redirect&bpo=39091

   (30) https://bugs.python.org/issue?@action=redirect&bpo=33346


File: python.info,  Node: ライブラリ<116>,  Next: ドキュメント<36>,  Prev: Core and Builtins<113>,  Up: Python 3 11 0 alpha 1

1.24.42.21 ライブラリ
.....................

   - bpo-45371(1): Fix clang rpath issue in ‘distutils’.  The
     UnixCCompiler now uses correct clang option to add a runtime
     library directory (rpath) to a shared library.

   - bpo-45329(2): Fix freed memory access in ‘pyexpat.xmlparser’ when
     building it with an installed expat library <= 2.2.0.

   - bpo-41710(3): On Unix, if the ‘sem_clockwait()’ function is
     available in the C library (glibc 2.30 and newer), the *note
     threading.Lock.acquire(): 8a7. method now uses the monotonic clock
     (*note time.CLOCK_MONOTONIC: 8a8.) for the timeout, rather than
     using the system clock (*note time.CLOCK_REALTIME: 8a9.), to not be
     affected by system clock changes.  Patch by Victor Stinner.

   - bpo-1596321(4): Fix the ‘threading._shutdown()’ function when the
     *note threading: f3. module was imported first from a thread
     different than the main thread: no longer log an error at Python
     exit.

   - bpo-45274(5): Fix a race condition in the *note Thread.join():
     13fd. method of the *note threading: f3. module.  If the function
     is interrupted by a signal and the signal handler raises an
     exception, make sure that the thread remains in a consistent state
     to prevent a deadlock.  Patch by Victor Stinner.

   - bpo-21302(6): In Unix operating systems, *note time.sleep(): 8ac.
     now uses the ‘nanosleep()’ function, if ‘clock_nanosleep()’ is not
     available but ‘nanosleep()’ is available.  ‘nanosleep()’ allows to
     sleep with nanosecond precision.

   - bpo-21302(7): On Windows, *note time.sleep(): 8ac. now uses a
     waitable timer which has a resolution of 100 nanoseconds (10^-7
     seconds).  Previously, it had a resolution of 1 millisecond (10^-3
     seconds).  Patch by Benjamin Szőke and Victor Stinner.

   - bpo-45238(8): Fix ‘unittest.IsolatedAsyncioTestCase.debug()’: it
     runs now asynchronous methods and callbacks.

   - bpo-36674(9): *note unittest.TestCase.debug(): 1c49. raises now a
     *note unittest.SkipTest: 11e6. if the class or the test method are
     decorated with the skipping decorator.

   - bpo-45235(10): Fix an issue where argparse would not preserve
     values in a provided namespace when using a subparser with
     defaults.

   - bpo-45183(11): Have zipimport.zipimporter.find_spec() not raise an
     exception when the underlying zip file has been deleted and the
     internal cache has been reset via invalidate_cache().

   - bpo-45234(12): Fixed a regression in *note copyfile(): c4e, *note
     copy(): c4f, *note copy2(): c50. raising *note FileNotFoundError:
     264. when source is a directory, which should raise *note
     IsADirectoryError: 1264.

   - bpo-45228(13): Fix stack buffer overflow in parsing J1939 network
     address.

   - bpo-45225(14): use map function instead of genexpr in capwords.

   - bpo-42135(15): Fix typo: ‘importlib.find_loader’ is really slated
     for removal in Python 3.12 not 3.10, like the others in PR 25169.

     Patch by Hugo van Kemenade.

   - bpo-20524(16): Improves error messages on ‘.format()’ operation for
     ‘str’, ‘float’, ‘int’, and ‘complex’.  New format now shows the
     problematic pattern and the object type.

   - bpo-45168(17): Change *note dis.dis(): 205. output to omit op arg
     values that cannot be resolved due to ‘co_consts’, ‘co_names’ etc
     not being provided.  Previously the oparg itself was repeated in
     the value field, which is not useful and can be confusing.

   - bpo-21302(18): In Unix operating systems, *note time.sleep(): 8ac.
     now uses the ‘clock_nanosleep()’ function, if available, which
     allows to sleep for an interval specified with nanosecond
     precision.

   - bpo-45173(19): Remove from the *note configparser: 26. module: the
     ‘SafeConfigParser’ class, the ‘filename’ property of the *note
     ParsingError: 729. class, the ‘readfp()’ method of the *note
     ConfigParser: 4de. class, deprecated since Python 3.2.

     Patch by Hugo van Kemenade.

   - bpo-44987(20): Pure ASCII strings are now normalized in constant
     time by *note unicodedata.normalize(): 8e4.  Patch by Donghee Na.

   - bpo-35474(21): Calling *note mimetypes.guess_all_extensions():
     1c4a. with ‘strict=False’ no longer affects the result of the
     following call with ‘strict=True’.  Also, mutating the returned
     list no longer affects the global state.

   - bpo-45166(22): *note typing.get_type_hints(): 8c0. now works with
     *note Final: 56e. wrapped in *note ForwardRef: 1bda.

   - bpo-45162(23): Remove many old deprecated *note unittest: 10c.
     features:

        * "‘fail*’" and "‘assert*’" aliases of *note TestCase: 2b3.
          methods.

        * Broken from start *note TestCase: 2b3. method
          ‘assertDictContainsSubset()’.

        * Ignored ‘<unittest.TestLoader.loadTestsFromModule>
          TestLoader.loadTestsFromModule()’ parameter 'use_load_tests'.

        * Old alias ‘_TextTestResult’ of *note TextTestResult: 754.

   - bpo-38371(24): Remove the deprecated ‘split()’ method of
     ‘_tkinter.TkappType’.  Patch by Erlend E. Aasland.

   - bpo-20499(25): Improve the speed and accuracy of
     statistics.pvariance().

   - bpo-45132(26): Remove *note __getitem__(): 588. methods of *note
     xml.dom.pulldom.DOMEventStream: 93e, *note
     wsgiref.util.FileWrapper: 93f. and *note fileinput.FileInput: 940,
     deprecated since Python 3.9.

     Patch by Hugo van Kemenade.

   - bpo-45129(27): Due to significant security concerns, the
     'reuse_address' parameter of *note
     asyncio.loop.create_datagram_endpoint(): 93c, disabled in Python
     3.9, is now entirely removed.  This is because of the behavior of
     the socket option ‘SO_REUSEADDR’ in UDP.

     Patch by Hugo van Kemenade.

   - bpo-45124(28): The ‘bdist_msi’ command, deprecated in Python 3.9,
     is now removed.

     Use ‘bdist_wheel’ (wheel packages) instead.

     Patch by Hugo van Kemenade.

   - bpo-30856(29): *note unittest.TestResult: 137f. methods *note
     addFailure(): 1c4b, *note addError(): 1c4c, *note addSkip(): 1c4d.
     and *note addSubTest(): 1c4e. are now called immediately after
     raising an exception in test or finishing a subtest.  Previously
     they were called only after finishing the test clean up.

   - bpo-45034(30): Changes how error is formatted for ‘struct.pack’
     with ‘'H'’ and ‘'h'’ modes and too large / small numbers.  Now it
     shows the actual numeric limits, while previously it was showing
     arithmetic expressions.

   - bpo-25894(31): *note unittest: 10c. now always reports skipped and
     failed subtests separately: separate characters in default mode and
     separate lines in verbose mode.  Also the test description is now
     output for errors in test method, class and module cleanups.

   - bpo-45081(32): Fix issue when dataclasses that inherit from
     ‘typing.Protocol’ subclasses have wrong ‘__init__’.  Patch provided
     by Yurii Karabas.

   - bpo-45085(33): The ‘binhex’ module, deprecated in Python 3.9, is
     now removed.  The following *note binascii: 11. functions,
     deprecated in Python 3.9, are now also removed:

        * ‘a2b_hqx()’, ‘b2a_hqx()’;

        * ‘rlecode_hqx()’, ‘rledecode_hqx()’.

     The *note binascii.crc_hqx(): 93d. function remains available.

     Patch by Victor Stinner.

   - bpo-40360(34): The ‘lib2to3’ package is now deprecated and may not
     be able to parse Python 3.10 or newer.  See the PEP 617(35) (New
     PEG parser for CPython).  Patch by Victor Stinner.

   - bpo-45075(36): Rename ‘traceback.StackSummary.format_frame()’ to
     *note traceback.StackSummary.format_frame_summary(): 8b2.  This
     method was added for 3.11 so it was not released yet.

     Updated code and docs to better distinguish frame and FrameSummary.

   - bpo-31299(37): Add option to completely drop frames from a
     traceback by returning ‘None’ from a ‘format_frame()’ override.

   - bpo-41620(38): *note run(): 137e. now always return a *note
     TestResult: 137f. instance.  Previously it returned ‘None’ if the
     test class or method was decorated with a skipping decorator.

   - bpo-45021(39): Fix a potential deadlock at shutdown of forked
     children when using *note concurrent.futures: 24. module

   - bpo-43913(40): Fix bugs in cleaning up classes and modules in *note
     unittest: 10c.:

        * Functions registered with *note addModuleCleanup(): c40. were
          not called unless the user defines ‘tearDownModule()’ in their
          test module.

        * Functions registered with *note addClassCleanup(): c41. were
          not called if ‘tearDownClass’ is set to ‘None’.

        * Buffering in *note TestResult: 137f. did not work with
          functions registered with ‘addClassCleanup()’ and
          ‘addModuleCleanup()’.

        * Errors in functions registered with ‘addClassCleanup()’ and
          ‘addModuleCleanup()’ were not handled correctly in buffered
          and debug modes.

        * Errors in ‘setUpModule()’ and functions registered with
          ‘addModuleCleanup()’ were reported in wrong order.

        * And several lesser bugs.

   - bpo-45030(41): Fix integer overflow in pickling and copying the
     range iterator.

   - bpo-45001(42): Made email date parsing more robust against
     malformed input, namely a whitespace-only ‘Date:’ header.  Patch by
     Wouter Bolsterlee.

   - bpo-45010(43): Remove support of special method ‘__div__’ in *note
     unittest.mock: 10d.  It is not used in Python 3.

   - bpo-39218(44): Improve accuracy of variance calculations by using
     ‘x*x’ instead of ‘x**2’.

   - bpo-43613(45): Improve the speed of *note gzip.compress(): 84e. and
     *note gzip.decompress(): 1426. by compressing and decompressing at
     once in memory instead of in a streamed fashion.

   - bpo-37596(46): Ensure that *note set: 184. and *note frozenset:
     7f2. objects are always *note marshalled: 91. reproducibly.

   - bpo-44019(47): A new function ‘operator.call’ has been added, such
     that ‘operator.call(obj, *args, **kwargs) == obj(*args, **kwargs)’.

   - bpo-42255(48): ‘webbrowser.MacOSX’ is deprecated and will be
     removed in Python 3.13.  It is untested and undocumented and also
     not used by *note webbrowser: 11b. itself.  Patch by Donghee Na.

   - bpo-44955(49): Method *note stopTestRun(): 1562. is now always
     called in pair with method *note startTestRun(): 1561. for *note
     TestResult: 137f. objects implicitly created in *note run(): 137e.
     Previously it was not called for test methods and classes decorated
     with a skipping decorator.

   - bpo-39039(50): tarfile.open raises *note ReadError: 1c4f. when a
     zlib error occurs during file extraction.

   - bpo-44935(51): *note subprocess: dc. on Solaris now also uses *note
     os.posix_spawn(): 52e. for better performance.

   - bpo-44911(52): *note IsolatedAsyncioTestCase: 361. will no longer
     throw an exception while cancelling leaked tasks.  Patch by Bar
     Harel.

   - bpo-41322(53): Added ‘DeprecationWarning’ for tests and async tests
     that return a value!=None (as this may indicate an improperly
     written test, for example a test written as a generator function).

   - bpo-44524(54): Make exception message more useful when subclass
     from typing special form alias.  Patch provided by Yurii Karabas.

   - bpo-38956(55): *note argparse.BooleanOptionalAction: 1bf2.'s
     default value is no longer printed twice when used with *note
     argparse.ArgumentDefaultsHelpFormatter: 1c50.

   - bpo-44860(56): Fix the ‘posix_user’ scheme in *note sysconfig: e1.
     to not depend on *note sys.platlibdir: b32.

   - bpo-44859(57): Improve error handling in *note sqlite3: d4. and
     raise more accurate exceptions.

        * *note MemoryError: 179e. is now raised instead of *note
          sqlite3.Warning: 1bb6. when memory is not enough for encoding
          a statement to UTF-8 in ‘Connection.__call__()’ and
          ‘Cursor.execute()’.

        * ‘UnicodEncodeError’ is now raised instead of *note
          sqlite3.Warning: 1bb6. when the statement contains surrogate
          characters in ‘Connection.__call__()’ and ‘Cursor.execute()’.

        * *note TypeError: 198. is now raised instead of *note
          ValueError: 2ec. for non-string script argument in
          ‘Cursor.executescript()’.

        * *note ValueError: 2ec. is now raised for script containing the
          null character instead of truncating it in
          ‘Cursor.executescript()’.

        * Correctly handle exceptions raised when getting boolean value
          of the result of the progress handler.

        * Add many tests covering different corner cases.

   - bpo-44581(58): Upgrade bundled pip to 21.2.3 and setuptools to
     57.4.0

   - bpo-44849(59): Fix the *note os.set_inheritable(): 10fe. function
     on FreeBSD 14 for file descriptor opened with the *note O_PATH:
     1174. flag: ignore the *note EBADF: b54. error on ‘ioctl()’,
     fallback on the ‘fcntl()’ implementation.  Patch by Victor Stinner.

   - bpo-44605(60): The @functools.total_ordering() decorator now works
     with metaclasses.

   - bpo-44524(61): Fixed an issue wherein the ‘__name__’ and
     ‘__qualname__’ attributes of subscribed specialforms could be
     ‘None’.

   - bpo-44839(62): *note MemoryError: 179e. raised in user-defined
     functions will now produce a ‘MemoryError’ in *note sqlite3: d4.
     *note OverflowError: a81. will now be converted to *note DataError:
     1c51.  Previously *note OperationalError: 1c52. was produced in
     these cases.

   - bpo-44822(63): *note sqlite3: d4. user-defined functions and
     aggregators returning *note strings: 169. with embedded NUL
     characters are no longer truncated.  Patch by Erlend E. Aasland.

   - bpo-44801(64): Ensure that the *note ParamSpec: 487. variable in
     Callable can only be substituted with a parameters expression (a
     list of types, an ellipsis, ParamSpec or Concatenate).

   - bpo-44806(65): Non-protocol subclasses of *note typing.Protocol:
     56b. ignore now the ‘__init__’ method inherited from protocol base
     classes.

   - bpo-27275(66): *note collections.OrderedDict.popitem(): 1505. and
     ‘collections.OrderedDict.pop()’ no longer call ‘__getitem__’ and
     ‘__delitem__’ methods of the OrderedDict subclasses.

   - bpo-44793(67): Fix checking the number of arguments when subscribe
     a generic type with ‘ParamSpec’ parameter.

   - bpo-44784(68): In importlib.metadata tests, override warnings
     behavior under expected DeprecationWarnings (importlib_metadata
     4.6.3).

   - bpo-44667(69): The *note tokenize.tokenize(): 700. doesn't
     incorrectly generate a ‘NEWLINE’ token if the source doesn't end
     with a new line character but the last line is a comment, as the
     function is already generating a ‘NL’ token.  Patch by Pablo
     Galindo

   - bpo-44771(70): Added ‘importlib.simple’ module implementing
     adapters from a low-level resources reader interface to a
     ‘TraversableResources’ interface.  Legacy API (‘path’, ‘contents’,
     ...)  is now supported entirely by the ‘.files()’ API with a
     compatibility shim supplied for resource loaders without that
     functionality.  Feature parity with ‘importlib_resources’ 5.2.

   - bpo-44752(71): ‘rcompleter’ does not call *note getattr(): dca. on
     *note property: 4b3. objects to avoid the side-effect of evaluating
     the corresponding method.

   - bpo-44747(72): Refactor usage of ‘sys._getframe’ in ‘typing’
     module.  Patch provided by Yurii Karabas.

   - bpo-42378(73): Fixes the issue with log file being overwritten when
     *note logging.FileHandler: 1c53. is used in *note atexit: d. with
     'filemode' set to ‘'w'’.  Note this will cause the message in
     'atexit' not being logged if the log stream is already closed due
     to shutdown of logging.

   - bpo-44720(74): ‘weakref.proxy’ objects referencing non-iterators
     now raise ‘TypeError’ rather than dereferencing the null
     ‘tp_iternext’ slot and crashing.

   - bpo-44704(75): The implementation of ‘collections.abc.Set._hash()’
     now matches that of ‘frozenset.__hash__()’.

   - bpo-44666(76): Fixed issue in *note compileall.compile_file(): fe1.
     when ‘sys.stdout’ is redirected.  Patch by Stefan Hölzl.

   - bpo-44688(77): *note sqlite3.Connection.create_collation(): 886.
     now accepts non-ASCII collation names.  Patch by Erlend E. Aasland.

   - bpo-44690(78): Adopt 'binacii.a2b_base64"s strict mode in
     'base64.b64decode'.

   - bpo-42854(79): Fixed a bug in the ‘_ssl’ module that was throwing
     *note OverflowError: a81. when using ‘_ssl._SSLSocket.write()’ and
     ‘_ssl._SSLSocket.read()’ for a big value of the ‘len’ parameter.
     Patch by Pablo Galindo.

   - bpo-44686(80): Replace ‘unittest.mock._importer’ with
     ‘pkgutil.resolve_name’.

   - bpo-44353(81): Make ‘NewType.__call__’ faster by implementing it in
     C. Patch provided by Yurii Karabas.

   - bpo-44682(82): Change the *note pdb: aa. 'commands' directive to
     disallow setting commands for an invalid breakpoint and to display
     an appropriate error.

   - bpo-44353(83): Refactor ‘typing.NewType’ from function into
     callable class.  Patch provided by Yurii Karabas.

   - bpo-44678(84): Added a separate error message for discontinuous
     padding in 'binascii.a2b_base64' strict mode.

   - bpo-44524(85): Add missing ‘__name__’ and ‘__qualname__’ attributes
     to ‘typing’ module classes.  Patch provided by Yurii Karabas.

   - bpo-40897(86): Give priority to using the current class constructor
     in *note inspect.signature(): 22f.  Patch by Weipeng Hong.

   - bpo-44638(87): Add a reference to the zipp project and hint as to
     how to use it.

   - bpo-44648(88): Fixed wrong error being thrown by *note
     inspect.getsource(): 17c3. when examining a class in the
     interactive session.  Instead of *note TypeError: 198, it should be
     *note OSError: 2c0. with appropriate error message.

   - bpo-44608(89): Fix memory leak in ‘_tkinter._flatten()’ if it is
     called with a sequence or set, but not list or tuple.

   - bpo-44594(90): Fix an edge case of ‘ExitStack’ and ‘AsyncExitStack’
     exception chaining.  They will now match ‘with’ block behavior when
     ‘__context__’ is explicitly set to ‘None’ when the exception is in
     flight.

   - bpo-42799(91): In *note fnmatch: 60, the cache size for compiled
     regex patterns (*note functools.lru_cache(): be2.) was bumped up
     from 256 to 32768, affecting functions: *note fnmatch.fnmatch():
     1c54, *note fnmatch.fnmatchcase(): 1c55, *note fnmatch.filter():
     1c56.

   - bpo-41928(92): Update *note shutil.copyfile(): c4e. to raise *note
     FileNotFoundError: 264. instead of confusing *note
     IsADirectoryError: 1264. when a path ending with a ‘os.path.sep’
     does not exist; *note shutil.copy(): c4f. and *note shutil.copy2():
     c50. are also affected.

   - bpo-44569(93): Added the ‘StackSummary.format_frame()’ function in
     *note traceback: 104.  This allows users to customize the way
     individual lines are formatted in tracebacks without
     re-implementing logic to handle recursive tracebacks.

   - bpo-44566(94): handle StopIteration subclass raised from
     @contextlib.contextmanager generator

   - bpo-44558(95): Make the implementation consistency of *note
     indexOf(): ad8. between C and Python versions.  Patch by Donghee
     Na.

   - bpo-41249(96): Fixes ‘TypedDict’ to work with
     ‘typing.get_type_hints()’ and postponed evaluation of annotations
     across modules.

   - bpo-44554(97): Refactor argument processing in ‘pdb.main()’ to
     simplify detection of errors in input loading and clarify behavior
     around module or script invocation.

   - bpo-34798(98): Break up paragraph about *note pprint.PrettyPrinter:
     1181. construction parameters to make it easier to read.

   - bpo-44539(99): Added support for recognizing JPEG files without
     JFIF or Exif markers.

   - bpo-44461(100): Fix bug with *note pdb: aa.'s handling of import
     error due to a package which does not have a ‘__main__’ module

   - bpo-43625(101): Fix a bug in the detection of CSV file headers by
     *note csv.Sniffer.has_header(): 1c57. and improve documentation of
     same.

   - bpo-44516(102): Update vendored pip to 21.1.3

   - bpo-42892(103): Fixed an exception thrown while parsing a malformed
     multipart email by *note email.message.EmailMessage: 580.

   - bpo-44468(104): *note typing.get_type_hints(): 8c0. now finds
     annotations in classes and base classes with unexpected
     ‘__module__’.  Previously, it skipped those MRO elements.

   - bpo-44491(105): Allow clearing the *note sqlite3: d4. authorizer
     callback by passing *note None: 885. to *note set_authorizer():
     5a9.  Patch by Erlend E. Aasland.

   - bpo-43977(106): Set the proper *note Py_TPFLAGS_MAPPING: 1c58. and
     *note Py_TPFLAGS_SEQUENCE: 1c59. flags for subclasses created
     before a parent has been registered as a *note
     collections.abc.Mapping: ac7. or *note collections.abc.Sequence:
     13dc.

   - bpo-44482(107): Fix very unlikely resource leak in *note glob: 68.
     in alternate Python implementations.

   - bpo-44466(108): The *note faulthandler: 5c. module now detects if a
     fatal error occurs during a garbage collector collection.  Patch by
     Victor Stinner.

   - bpo-44471(109): A *note TypeError: 198. is now raised instead of an
     *note AttributeError: 5f0. in *note
     contextlib.ExitStack.enter_context(): 7ee. and *note
     contextlib.AsyncExitStack.enter_async_context(): 7ef. for objects
     which do not support the *note context manager: 1e1. or *note
     asynchronous context manager: 7f0. protocols correspondingly.

   - bpo-44404(110): *note tkinter: f6.'s ‘after()’ method now supports
     callables without the ‘__name__’ attribute.

   - bpo-41546(111): Make *note pprint: b3. (like the builtin ‘print’)
     not attempt to write to ‘stdout’ when it is ‘None’.

   - bpo-44458(112): ‘BUFFER_BLOCK_SIZE’ is now declared static, to
     avoid linking collisions when bz2, lmza or zlib are statically
     linked.

   - bpo-44464(113): Remove exception for flake8 in deprecated
     importlib.metadata interfaces.  Sync with importlib_metadata 4.6.

   - bpo-44446(114): Take into account that ‘lineno’ might be ‘None’ in
     *note traceback.FrameSummary: 1084.

   - bpo-44439(115): Fix in ‘bz2.BZ2File.write()’ /
     ‘lzma.LZMAFile.write()’ methods, when the input data is an object
     that supports the buffer protocol, the file length may be wrong.

   - bpo-44434(116): _thread.start_new_thread() no longer calls
     PyThread_exit_thread() explicitly at the thread exit, the call was
     redundant.  On Linux with the glibc, pthread_exit() aborts the
     whole process if dlopen() fails to open libgcc_s.so file (ex:
     EMFILE error).  Patch by Victor Stinner.

   - bpo-42972(117): The _thread.RLock type now fully implement the GC
     protocol: add a traverse function and the *note Py_TPFLAGS_HAVE_GC:
     981. flag.  Patch by Victor Stinner.

   - bpo-44422(118): The *note threading.enumerate(): 1c5a. function now
     uses a reentrant lock to prevent a hang on reentrant call.  Patch
     by Victor Stinner.

   - bpo-38291(119): Importing typing.io or typing.re now prints a
     ‘DeprecationWarning’.

   - bpo-37880(120): argparse actions store_const and append_const each
     receive a default value of ‘None’ when the ‘const’ kwarg is not
     provided.  Previously, this raised a *note TypeError: 198.

   - bpo-44389(121): Fix deprecation of *note ssl.OP_NO_TLSv1_3: 1c5b.

   - bpo-27827(122): ‘pathlib.PureWindowsPath.is_reserved()’ now
     identifies a greater range of reserved filenames, including those
     with trailing spaces or colons.

   - bpo-44395(123): Fix ‘as_string()’ to pass unixfrom properly.  Patch
     by Donghee Na.

   - bpo-34266(124): Handle exceptions from parsing the arg of *note
     pdb: aa.'s run/restart command.

   - bpo-44362(125): Improve *note ssl: d5. module's deprecation
     messages, error reporting, and documentation for deprecations.

   - bpo-44342(126): [Enum] Change pickling from by-value to by-name.

   - bpo-44356(127): [Enum] Allow multiple data-type mixins if they are
     all the same.

   - bpo-44351(128): Restore back ‘parse_makefile()’ in
     ‘distutils.sysconfig’ because it behaves differently than the
     similar implementation in *note sysconfig: e1.

   - bpo-35800(129): ‘smtpd.MailmanProxy’ is now removed as it is
     unusable without an external module, ‘mailman’.  Patch by Donghee
     Na.

   - bpo-44357(130): Added a function that returns cube root of the
     given number *note math.cbrt(): 871.

   - bpo-44339(131): Change ‘math.pow(±0.0, -math.inf)’ to return ‘inf’
     instead of raising ‘ValueError’.  This brings the special-case
     handling of ‘math.pow’ into compliance with the IEEE 754 standard.

   - bpo-44242(132): Remove missing flag check from Enum creation and
     move into a ‘verify’ decorator.

   - bpo-44246(133): In ‘importlib.metadata’, restore compatibility in
     the result from ‘Distribution.entry_points’ (‘EntryPoints’) to
     honor expectations in older implementations and issuing deprecation
     warnings for these cases: A. ‘EntryPoints’ objects are once again
     mutable, allowing for ‘sort()’ and other list-based mutation
     operations.  Avoid deprecation warnings by casting to a mutable
     sequence (e.g.  ‘list(dist.entry_points).sort()’).  B.
     ‘EntryPoints’ results once again allow for access by index.  To
     avoid deprecation warnings, cast the result to a Sequence first
     (e.g.  ‘tuple(dist.entry_points)[0]’).

   - bpo-44246(134): In importlib.metadata.entry_points, de-duplication
     of distributions no longer requires loading the full metadata for
     PathDistribution objects, improving entry point loading performance
     by ~10x.

   - bpo-43858(135): Added a function that returns a copy of a dict of
     logging levels: *note logging.getLevelNamesMapping(): 869.

   - bpo-44260(136): The *note random.Random: 1c5c. constructor no
     longer reads system entropy without need.

   - bpo-44254(137): On Mac, give turtledemo button text a color that
     works on both light or dark background.  Programmers cannot control
     the latter.

   - bpo-44258(138): Support PEP 515 for Fraction's initialization from
     string.

   - bpo-44235(139): Remove deprecated functions in the *note gettext:
     67.  Patch by Donghee Na.

   - bpo-38693(140): Prefer f-strings to ‘.format’ in
     importlib.resources.

   - bpo-33693(141): Importlib.metadata now prefers f-strings to
     .format.

   - bpo-44241(142): Incorporate minor tweaks from importlib_metadata
     4.1: SimplePath protocol, support for Metadata 2.2.

   - bpo-43216(143): Remove the ‘@asyncio.coroutine’ *note decorator:
     93a. enabling legacy generator-based coroutines to be compatible
     with async/await code; remove ‘asyncio.coroutines.CoroWrapper’ used
     for wrapping legacy coroutine objects in the debug mode.  The
     decorator has been deprecated since Python 3.8 and the removal was
     initially scheduled for Python 3.10.  Patch by Illia Volochii.

   - bpo-44210(144): Make importlib.metadata._meta.PackageMetadata
     public.

   - bpo-43643(145): Declare readers.MultiplexedPath.name as a property
     per the spec.

   - bpo-27334(146): The *note sqlite3: d4. context manager now performs
     a rollback (thus releasing the database lock) if commit failed.
     Patch by Luca Citi and Erlend E. Aasland.

   - bpo-4928(147): Documented existing behavior on POSIX:
     NamedTemporaryFiles are not deleted when creating process is killed
     with SIGKILL

   - bpo-44154(148): Optimize *note fractions.Fraction: 213. pickling
     for large components.

   - bpo-33433(149): For IPv4 mapped IPv6 addresses ( RFC 4291(150)
     Section 2.5.5.2), the *note ipaddress.IPv6Address.is_private: 19c4.
     check is deferred to the mapped IPv4 address.  This solves a bug
     where public mapped IPv4 addresses were considered private by the
     IPv6 check.

   - bpo-44150(151): Add optional 'weights' argument to
     statistics.fmean().

   - bpo-44142(152): *note ast.unparse(): ae2. will now drop the
     redundant parentheses when tuples used as assignment targets (e.g
     in for loops).

   - bpo-44145(153): *note hmac: 6e. computations were not releasing the
     GIL while calling the OpenSSL ‘HMAC_Update’ C API (a new feature in
     3.9).  This unintentionally prevented parallel computation as other
     *note hashlib: 6c. algorithms support.

   - bpo-44095(154): *note zipfile.Path: 8d8. now supports *note
     zipfile.Path.stem: 8d5, *note zipfile.Path.suffixes: 8d7, and *note
     zipfile.Path.suffix: 8d6. attributes.

   - bpo-44077(155): It's now possible to receive the type of service
     (ToS), a.k.a.  differentiated services (DS), a.k.a.  differentiated
     services code point (DSCP) and explicit congestion notification
     (ECN) IP header fields with ‘socket.IP_RECVTOS’.

   - bpo-37788(156): Fix a reference leak when a Thread object is never
     joined.

   - bpo-38908(157): Subclasses of ‘typing.Protocol’ which only have
     data variables declared will now raise a ‘TypeError’ when checked
     with ‘isinstance’ unless they are decorated with
     ‘runtime_checkable()’.  Previously, these checks passed silently.
     Patch provided by Yurii Karabas.

   - bpo-44098(158): ‘typing.ParamSpec’ will no longer be found in the
     ‘__parameters__’ of most *note typing: 10a. generics except in
     valid use locations specified by PEP 612(159).  This prevents
     incorrect usage like ‘typing.List[P][int]’.  This change means
     incorrect usage which may have passed silently in 3.10 beta 1 and
     earlier will now error.

   - bpo-44089(160): Allow subclassing ‘csv.Error’ in 3.10 (it was
     allowed in 3.9 and earlier but was disallowed in early versions of
     3.10).

   - bpo-44081(161): *note ast.unparse(): ae2. now doesn't use redundant
     spaces to separate ‘lambda’ and the ‘:’ if there are no parameters.

   - bpo-44061(162): Fix regression in previous release when calling
     *note pkgutil.iter_modules(): f47. with a list of *note
     pathlib.Path: 266. objects

   - bpo-44059(163): Register the SerenityOS Browser in the *note
     webbrowser: 11b. module.

   - bpo-36515(164): The *note hashlib: 6c. module no longer does
     unaligned memory accesses when compiled for ARM platforms.

   - bpo-40465(165): Remove random module features deprecated in Python
     3.9.

   - bpo-44018(166): random.seed() no longer mutates bytearray inputs.

   - bpo-38352(167): Add ‘IO’, ‘BinaryIO’, ‘TextIO’, ‘Match’, and
     ‘Pattern’ to ‘typing.__all__’.  Patch by Jelle Zijlstra.

   - bpo-44002(168): *note urllib.parse: 110. now uses
     ‘functool.lru_cache()’ for its internal URL splitting and quoting
     caches instead of rolling its own like its the '90s.

     The undocumented internal *note urllib.parse: 110. ‘Quoted’ class
     API is now deprecated, for removal in 3.14.

   - bpo-43972(169): When *note http.server.SimpleHTTPRequestHandler:
     d38. sends a ‘301 (Moved Permanently)’ for a directory path not
     ending with ‘/’, add a ‘Content-Length: 0’ header.  This improves
     the behavior for certain clients.

   - bpo-28528(170): Fix a bug in *note pdb: aa. where ‘checkline()’
     raises *note AttributeError: 5f0. if it is called after ‘reset()’.

   - bpo-43853(171): Improved string handling for *note sqlite3: d4.
     user-defined functions and aggregates:

        * It is now possible to pass strings with embedded null
          characters to UDFs

        * Conversion failures now correctly raise *note MemoryError:
          179e.

     Patch by Erlend E. Aasland.

   - bpo-43666(172): AIX: ‘Lib/_aix_support.get_platform()’ may fail in
     an AIX WPAR. The fileset bos.rte appears to have a builddate in
     both LPAR and WPAR so this fileset is queried rather than bos.mp64.
     To prevent a similar situation (no builddate in ODM) a value (9988)
     sufficient for completing a build is provided.  Patch by M Felt.

   - bpo-43650(173): Fix *note MemoryError: 179e. in *note
     shutil.unpack_archive(): 696. which fails inside
     ‘shutil._unpack_zipfile()’ on large files.  Patch by Igor
     Bolshakov.

   - bpo-43612(174): *note zlib.compress(): 84f. now accepts a wbits
     parameter which allows users to compress data as a raw deflate
     block without zlib headers and trailers in one go.  Previously this
     required instantiating a ‘zlib.compressobj’.  It also provides a
     faster alternative to ‘gzip.compress’ when wbits=31 is used.

   - bpo-43392(175): ‘importlib._bootstrap._find_and_load()’ now
     implements a two-step check to avoid locking when modules have been
     already imported and are ready.  This improves performance of
     repeated calls to *note importlib.import_module(): 73c. and *note
     importlib.__import__(): 1279.

   - bpo-43318(176): Fix a bug where *note pdb: aa. does not always echo
     cleared breakpoints.

   - bpo-43234(177): Prohibit passing non-*note
     concurrent.futures.ThreadPoolExecutor: 949. executors to
     ‘loop.set_default_executor()’ following a deprecation in Python
     3.8.  Patch by Illia Volochii.

   - bpo-43232(178): Prohibit previously deprecated potentially
     disruptive operations on ‘asyncio.trsock.TransportSocket’.  Patch
     by Illia Volochii.

   - bpo-30077(179): Added support for Apple's aifc/sowt
     pseudo-compression

   - bpo-42971(180): Add definition of ‘errno.EQFULL’ for platforms that
     define this constant (such as macOS).

   - bpo-43086(181): Added a new optional ‘strict_mode’ parameter to
     'binascii.a2b_base64'.  When ‘scrict_mode’ is set to ‘True’, the
     'a2b_base64' function will accept only valid base64 content.  More
     details about what "valid base64 content" is, can be found in the
     function's documentation.

   - bpo-43024(182): Improve the help signature of *note
     traceback.print_exception(): a4f, *note
     traceback.format_exception(): a4d. and *note
     traceback.format_exception_only(): a4e.

   - bpo-33809(183): Add the *note traceback.TracebackException.print():
     8b3. method which prints the formatted exception information.

   - bpo-42862(184): *note sqlite3: d4. now utilizes *note
     functools.lru_cache(): be2. to implement the connection statement
     cache.  As a small optimisation, the default statement cache size
     has been increased from 100 to 128.  Patch by Erlend E. Aasland.

   - bpo-41818(185): Soumendra Ganguly: add termios.tcgetwinsize(),
     termios.tcsetwinsize().

   - bpo-40497(186): *note subprocess.check_output(): 11c4. now raises
     *note ValueError: 2ec. when the invalid keyword argument 'check' is
     passed by user code.  Previously such use would fail later with a
     *note TypeError: 198.  Patch by Rémi Lapeyre.

   - bpo-37449(187): ‘ensurepip’ now uses ‘importlib.resources.files()’
     traversable APIs

   - bpo-40956(188): Use Argument Clinic in *note sqlite3: d4.  Patches
     by Erlend E. Aasland.

   - bpo-41730(189): ‘DeprecationWarning’ is now raised when importing
     ‘tkinter.tix’, which has been deprecated in documentation since
     Python 3.6.

   - bpo-20684(190): Remove unused ‘_signature_get_bound_param’ function
     from *note inspect: 82. - by Anthony Sottile.

   - bpo-41402(191): Fix *note email.message.EmailMessage.set_content():
     1c5d. when called with binary data and ‘7bit’ content transfer
     encoding.

   - bpo-32695(192): The 'compresslevel' and 'preset' keyword arguments
     of *note tarfile.open(): 1077. are now both documented and tested.

   - bpo-41137(193): Use utf-8 encoding while reading .pdbrc files.
     Patch by Srinivas Reddy Thatiparthy

   - bpo-24391(194): Improved reprs of *note threading: f3.
     synchronization objects: *note Semaphore: 136e, *note
     BoundedSemaphore: 136f, *note Event: 1370. and *note Barrier: 13fc.

   - bpo-5846(195): Deprecated the following *note unittest: 10c.
     functions, scheduled for removal in Python 3.13:

        * ‘findTestCases()’

        * ‘makeSuite()’

        * ‘getTestCaseNames()’

     Use *note TestLoader: 593. methods instead:

        * *note unittest.TestLoader.loadTestsFromModule(): 594.

        * *note unittest.TestLoader.loadTestsFromTestCase(): 595.

        * *note unittest.TestLoader.getTestCaseNames(): 596.

     Patch by Erlend E. Aasland.

   - bpo-40563(196): Support pathlike objects on dbm/shelve.  Patch by
     Hakan Çelik and Henry-Joseph Audéoud.

   - bpo-34990(197): Fixed a Y2k38 bug in the compileall module where it
     would fail to compile files with a modification time after the year
     2038.

   - bpo-39549(198): Whereas the code for reprlib.Repr had previously
     used a hardcoded string value of '...', this PR updates it to use
     of a “fillvalue” attribute, whose value defaults to '...'  and can
     be reset in either individual reprlib.Repr instances or in
     subclasses thereof.

   - bpo-37022(199): *note pdb: aa. now displays exceptions from
     ‘repr()’ with its ‘p’ and ‘pp’ commands.

   - bpo-38840(200): Fix ‘test___all__’ on platforms lacking a shared
     memory implementation.

   - bpo-39359(201): Add one missing check that the password is a bytes
     object for an encrypted zipfile.

   - bpo-38741(202): *note configparser: 26.: using ']' inside a section
     header will no longer cut the section name short at the ']'

   - bpo-38415(203): Added missing behavior to *note
     contextlib.asynccontextmanager(): d1f. to match *note
     contextlib.contextmanager(): 141b. so decorated functions can
     themselves be decorators.

   - bpo-30256(204): Pass multiprocessing BaseProxy argument
     ‘manager_owned’ through AutoProxy.

   - bpo-27513(205): *note email.utils.getaddresses(): 4f3. now accepts
     *note email.header.Header: 1c5e. objects along with string values.
     Patch by Zackery Spytz.

   - bpo-16379(206): Add SQLite error code and name to *note sqlite3:
     d4. exceptions.  Patch by Aviv Palivoda, Daniel Shahaf, and Erlend
     E. Aasland.

   - bpo-26228(207): pty.spawn no longer hangs on FreeBSD, macOS, and
     Solaris.

   - bpo-33349(208): lib2to3 now recognizes async generators everywhere.

   - bpo-29298(209): Fix ‘TypeError’ when required subparsers without
     ‘dest’ do not receive arguments.  Patch by Anthony Sottile.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45371

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45329

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41710

   (4) https://bugs.python.org/issue?@action=redirect&bpo=1596321

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45274

   (6) https://bugs.python.org/issue?@action=redirect&bpo=21302

   (7) https://bugs.python.org/issue?@action=redirect&bpo=21302

   (8) https://bugs.python.org/issue?@action=redirect&bpo=45238

   (9) https://bugs.python.org/issue?@action=redirect&bpo=36674

   (10) https://bugs.python.org/issue?@action=redirect&bpo=45235

   (11) https://bugs.python.org/issue?@action=redirect&bpo=45183

   (12) https://bugs.python.org/issue?@action=redirect&bpo=45234

   (13) https://bugs.python.org/issue?@action=redirect&bpo=45228

   (14) https://bugs.python.org/issue?@action=redirect&bpo=45225

   (15) https://bugs.python.org/issue?@action=redirect&bpo=42135

   (16) https://bugs.python.org/issue?@action=redirect&bpo=20524

   (17) https://bugs.python.org/issue?@action=redirect&bpo=45168

   (18) https://bugs.python.org/issue?@action=redirect&bpo=21302

   (19) https://bugs.python.org/issue?@action=redirect&bpo=45173

   (20) https://bugs.python.org/issue?@action=redirect&bpo=44987

   (21) https://bugs.python.org/issue?@action=redirect&bpo=35474

   (22) https://bugs.python.org/issue?@action=redirect&bpo=45166

   (23) https://bugs.python.org/issue?@action=redirect&bpo=45162

   (24) https://bugs.python.org/issue?@action=redirect&bpo=38371

   (25) https://bugs.python.org/issue?@action=redirect&bpo=20499

   (26) https://bugs.python.org/issue?@action=redirect&bpo=45132

   (27) https://bugs.python.org/issue?@action=redirect&bpo=45129

   (28) https://bugs.python.org/issue?@action=redirect&bpo=45124

   (29) https://bugs.python.org/issue?@action=redirect&bpo=30856

   (30) https://bugs.python.org/issue?@action=redirect&bpo=45034

   (31) https://bugs.python.org/issue?@action=redirect&bpo=25894

   (32) https://bugs.python.org/issue?@action=redirect&bpo=45081

   (33) https://bugs.python.org/issue?@action=redirect&bpo=45085

   (34) https://bugs.python.org/issue?@action=redirect&bpo=40360

   (35) https://peps.python.org/pep-0617/

   (36) https://bugs.python.org/issue?@action=redirect&bpo=45075

   (37) https://bugs.python.org/issue?@action=redirect&bpo=31299

   (38) https://bugs.python.org/issue?@action=redirect&bpo=41620

   (39) https://bugs.python.org/issue?@action=redirect&bpo=45021

   (40) https://bugs.python.org/issue?@action=redirect&bpo=43913

   (41) https://bugs.python.org/issue?@action=redirect&bpo=45030

   (42) https://bugs.python.org/issue?@action=redirect&bpo=45001

   (43) https://bugs.python.org/issue?@action=redirect&bpo=45010

   (44) https://bugs.python.org/issue?@action=redirect&bpo=39218

   (45) https://bugs.python.org/issue?@action=redirect&bpo=43613

   (46) https://bugs.python.org/issue?@action=redirect&bpo=37596

   (47) https://bugs.python.org/issue?@action=redirect&bpo=44019

   (48) https://bugs.python.org/issue?@action=redirect&bpo=42255

   (49) https://bugs.python.org/issue?@action=redirect&bpo=44955

   (50) https://bugs.python.org/issue?@action=redirect&bpo=39039

   (51) https://bugs.python.org/issue?@action=redirect&bpo=44935

   (52) https://bugs.python.org/issue?@action=redirect&bpo=44911

   (53) https://bugs.python.org/issue?@action=redirect&bpo=41322

   (54) https://bugs.python.org/issue?@action=redirect&bpo=44524

   (55) https://bugs.python.org/issue?@action=redirect&bpo=38956

   (56) https://bugs.python.org/issue?@action=redirect&bpo=44860

   (57) https://bugs.python.org/issue?@action=redirect&bpo=44859

   (58) https://bugs.python.org/issue?@action=redirect&bpo=44581

   (59) https://bugs.python.org/issue?@action=redirect&bpo=44849

   (60) https://bugs.python.org/issue?@action=redirect&bpo=44605

   (61) https://bugs.python.org/issue?@action=redirect&bpo=44524

   (62) https://bugs.python.org/issue?@action=redirect&bpo=44839

   (63) https://bugs.python.org/issue?@action=redirect&bpo=44822

   (64) https://bugs.python.org/issue?@action=redirect&bpo=44801

   (65) https://bugs.python.org/issue?@action=redirect&bpo=44806

   (66) https://bugs.python.org/issue?@action=redirect&bpo=27275

   (67) https://bugs.python.org/issue?@action=redirect&bpo=44793

   (68) https://bugs.python.org/issue?@action=redirect&bpo=44784

   (69) https://bugs.python.org/issue?@action=redirect&bpo=44667

   (70) https://bugs.python.org/issue?@action=redirect&bpo=44771

   (71) https://bugs.python.org/issue?@action=redirect&bpo=44752

   (72) https://bugs.python.org/issue?@action=redirect&bpo=44747

   (73) https://bugs.python.org/issue?@action=redirect&bpo=42378

   (74) https://bugs.python.org/issue?@action=redirect&bpo=44720

   (75) https://bugs.python.org/issue?@action=redirect&bpo=44704

   (76) https://bugs.python.org/issue?@action=redirect&bpo=44666

   (77) https://bugs.python.org/issue?@action=redirect&bpo=44688

   (78) https://bugs.python.org/issue?@action=redirect&bpo=44690

   (79) https://bugs.python.org/issue?@action=redirect&bpo=42854

   (80) https://bugs.python.org/issue?@action=redirect&bpo=44686

   (81) https://bugs.python.org/issue?@action=redirect&bpo=44353

   (82) https://bugs.python.org/issue?@action=redirect&bpo=44682

   (83) https://bugs.python.org/issue?@action=redirect&bpo=44353

   (84) https://bugs.python.org/issue?@action=redirect&bpo=44678

   (85) https://bugs.python.org/issue?@action=redirect&bpo=44524

   (86) https://bugs.python.org/issue?@action=redirect&bpo=40897

   (87) https://bugs.python.org/issue?@action=redirect&bpo=44638

   (88) https://bugs.python.org/issue?@action=redirect&bpo=44648

   (89) https://bugs.python.org/issue?@action=redirect&bpo=44608

   (90) https://bugs.python.org/issue?@action=redirect&bpo=44594

   (91) https://bugs.python.org/issue?@action=redirect&bpo=42799

   (92) https://bugs.python.org/issue?@action=redirect&bpo=41928

   (93) https://bugs.python.org/issue?@action=redirect&bpo=44569

   (94) https://bugs.python.org/issue?@action=redirect&bpo=44566

   (95) https://bugs.python.org/issue?@action=redirect&bpo=44558

   (96) https://bugs.python.org/issue?@action=redirect&bpo=41249

   (97) https://bugs.python.org/issue?@action=redirect&bpo=44554

   (98) https://bugs.python.org/issue?@action=redirect&bpo=34798

   (99) https://bugs.python.org/issue?@action=redirect&bpo=44539

   (100) https://bugs.python.org/issue?@action=redirect&bpo=44461

   (101) https://bugs.python.org/issue?@action=redirect&bpo=43625

   (102) https://bugs.python.org/issue?@action=redirect&bpo=44516

   (103) https://bugs.python.org/issue?@action=redirect&bpo=42892

   (104) https://bugs.python.org/issue?@action=redirect&bpo=44468

   (105) https://bugs.python.org/issue?@action=redirect&bpo=44491

   (106) https://bugs.python.org/issue?@action=redirect&bpo=43977

   (107) https://bugs.python.org/issue?@action=redirect&bpo=44482

   (108) https://bugs.python.org/issue?@action=redirect&bpo=44466

   (109) https://bugs.python.org/issue?@action=redirect&bpo=44471

   (110) https://bugs.python.org/issue?@action=redirect&bpo=44404

   (111) https://bugs.python.org/issue?@action=redirect&bpo=41546

   (112) https://bugs.python.org/issue?@action=redirect&bpo=44458

   (113) https://bugs.python.org/issue?@action=redirect&bpo=44464

   (114) https://bugs.python.org/issue?@action=redirect&bpo=44446

   (115) https://bugs.python.org/issue?@action=redirect&bpo=44439

   (116) https://bugs.python.org/issue?@action=redirect&bpo=44434

   (117) https://bugs.python.org/issue?@action=redirect&bpo=42972

   (118) https://bugs.python.org/issue?@action=redirect&bpo=44422

   (119) https://bugs.python.org/issue?@action=redirect&bpo=38291

   (120) https://bugs.python.org/issue?@action=redirect&bpo=37880

   (121) https://bugs.python.org/issue?@action=redirect&bpo=44389

   (122) https://bugs.python.org/issue?@action=redirect&bpo=27827

   (123) https://bugs.python.org/issue?@action=redirect&bpo=44395

   (124) https://bugs.python.org/issue?@action=redirect&bpo=34266

   (125) https://bugs.python.org/issue?@action=redirect&bpo=44362

   (126) https://bugs.python.org/issue?@action=redirect&bpo=44342

   (127) https://bugs.python.org/issue?@action=redirect&bpo=44356

   (128) https://bugs.python.org/issue?@action=redirect&bpo=44351

   (129) https://bugs.python.org/issue?@action=redirect&bpo=35800

   (130) https://bugs.python.org/issue?@action=redirect&bpo=44357

   (131) https://bugs.python.org/issue?@action=redirect&bpo=44339

   (132) https://bugs.python.org/issue?@action=redirect&bpo=44242

   (133) https://bugs.python.org/issue?@action=redirect&bpo=44246

   (134) https://bugs.python.org/issue?@action=redirect&bpo=44246

   (135) https://bugs.python.org/issue?@action=redirect&bpo=43858

   (136) https://bugs.python.org/issue?@action=redirect&bpo=44260

   (137) https://bugs.python.org/issue?@action=redirect&bpo=44254

   (138) https://bugs.python.org/issue?@action=redirect&bpo=44258

   (139) https://bugs.python.org/issue?@action=redirect&bpo=44235

   (140) https://bugs.python.org/issue?@action=redirect&bpo=38693

   (141) https://bugs.python.org/issue?@action=redirect&bpo=33693

   (142) https://bugs.python.org/issue?@action=redirect&bpo=44241

   (143) https://bugs.python.org/issue?@action=redirect&bpo=43216

   (144) https://bugs.python.org/issue?@action=redirect&bpo=44210

   (145) https://bugs.python.org/issue?@action=redirect&bpo=43643

   (146) https://bugs.python.org/issue?@action=redirect&bpo=27334

   (147) https://bugs.python.org/issue?@action=redirect&bpo=4928

   (148) https://bugs.python.org/issue?@action=redirect&bpo=44154

   (149) https://bugs.python.org/issue?@action=redirect&bpo=33433

   (150) https://datatracker.ietf.org/doc/html/rfc4291.html

   (151) https://bugs.python.org/issue?@action=redirect&bpo=44150

   (152) https://bugs.python.org/issue?@action=redirect&bpo=44142

   (153) https://bugs.python.org/issue?@action=redirect&bpo=44145

   (154) https://bugs.python.org/issue?@action=redirect&bpo=44095

   (155) https://bugs.python.org/issue?@action=redirect&bpo=44077

   (156) https://bugs.python.org/issue?@action=redirect&bpo=37788

   (157) https://bugs.python.org/issue?@action=redirect&bpo=38908

   (158) https://bugs.python.org/issue?@action=redirect&bpo=44098

   (159) https://peps.python.org/pep-0612/

   (160) https://bugs.python.org/issue?@action=redirect&bpo=44089

   (161) https://bugs.python.org/issue?@action=redirect&bpo=44081

   (162) https://bugs.python.org/issue?@action=redirect&bpo=44061

   (163) https://bugs.python.org/issue?@action=redirect&bpo=44059

   (164) https://bugs.python.org/issue?@action=redirect&bpo=36515

   (165) https://bugs.python.org/issue?@action=redirect&bpo=40465

   (166) https://bugs.python.org/issue?@action=redirect&bpo=44018

   (167) https://bugs.python.org/issue?@action=redirect&bpo=38352

   (168) https://bugs.python.org/issue?@action=redirect&bpo=44002

   (169) https://bugs.python.org/issue?@action=redirect&bpo=43972

   (170) https://bugs.python.org/issue?@action=redirect&bpo=28528

   (171) https://bugs.python.org/issue?@action=redirect&bpo=43853

   (172) https://bugs.python.org/issue?@action=redirect&bpo=43666

   (173) https://bugs.python.org/issue?@action=redirect&bpo=43650

   (174) https://bugs.python.org/issue?@action=redirect&bpo=43612

   (175) https://bugs.python.org/issue?@action=redirect&bpo=43392

   (176) https://bugs.python.org/issue?@action=redirect&bpo=43318

   (177) https://bugs.python.org/issue?@action=redirect&bpo=43234

   (178) https://bugs.python.org/issue?@action=redirect&bpo=43232

   (179) https://bugs.python.org/issue?@action=redirect&bpo=30077

   (180) https://bugs.python.org/issue?@action=redirect&bpo=42971

   (181) https://bugs.python.org/issue?@action=redirect&bpo=43086

   (182) https://bugs.python.org/issue?@action=redirect&bpo=43024

   (183) https://bugs.python.org/issue?@action=redirect&bpo=33809

   (184) https://bugs.python.org/issue?@action=redirect&bpo=42862

   (185) https://bugs.python.org/issue?@action=redirect&bpo=41818

   (186) https://bugs.python.org/issue?@action=redirect&bpo=40497

   (187) https://bugs.python.org/issue?@action=redirect&bpo=37449

   (188) https://bugs.python.org/issue?@action=redirect&bpo=40956

   (189) https://bugs.python.org/issue?@action=redirect&bpo=41730

   (190) https://bugs.python.org/issue?@action=redirect&bpo=20684

   (191) https://bugs.python.org/issue?@action=redirect&bpo=41402

   (192) https://bugs.python.org/issue?@action=redirect&bpo=32695

   (193) https://bugs.python.org/issue?@action=redirect&bpo=41137

   (194) https://bugs.python.org/issue?@action=redirect&bpo=24391

   (195) https://bugs.python.org/issue?@action=redirect&bpo=5846

   (196) https://bugs.python.org/issue?@action=redirect&bpo=40563

   (197) https://bugs.python.org/issue?@action=redirect&bpo=34990

   (198) https://bugs.python.org/issue?@action=redirect&bpo=39549

   (199) https://bugs.python.org/issue?@action=redirect&bpo=37022

   (200) https://bugs.python.org/issue?@action=redirect&bpo=38840

   (201) https://bugs.python.org/issue?@action=redirect&bpo=39359

   (202) https://bugs.python.org/issue?@action=redirect&bpo=38741

   (203) https://bugs.python.org/issue?@action=redirect&bpo=38415

   (204) https://bugs.python.org/issue?@action=redirect&bpo=30256

   (205) https://bugs.python.org/issue?@action=redirect&bpo=27513

   (206) https://bugs.python.org/issue?@action=redirect&bpo=16379

   (207) https://bugs.python.org/issue?@action=redirect&bpo=26228

   (208) https://bugs.python.org/issue?@action=redirect&bpo=33349

   (209) https://bugs.python.org/issue?@action=redirect&bpo=29298


File: python.info,  Node: ドキュメント<36>,  Next: テスト<35>,  Prev: ライブラリ<116>,  Up: Python 3 11 0 alpha 1

1.24.42.22 ドキュメント
.......................

   - bpo-45216(1): Remove extra documentation listing methods in
     ‘difflib’.  It was rendering twice in pydoc and was outdated in
     some places.

   - bpo-45024(2): *note collections.abc: 1f. documentation has been
     expanded to explicitly cover how instance and subclass checks work,
     with additional doctest examples and an exhaustive list of ABCs
     which test membership purely by presence of the right *note special
     method: 1c60.s.  Patch by Raymond Hettinger.

   - bpo-44957(3): Promote PEP 604 union syntax by using it where
     possible.  Also, mention ‘X | Y’ more prominently in section about
     ‘Union’ and mention ‘X | None’ at all in section about ‘Optional’.

   - bpo-16580(4): Added code equivalents for the *note int.to_bytes():
     1c32. and *note int.from_bytes(): 1be9. methods, as well as tests
     ensuring that these code equivalents are valid.

   - bpo-44903(5): Removed the ‘othergui.rst’ file, any references to
     it, and the list of GUI frameworks in the FAQ. In their place I've
     added links to the Python Wiki page on GUI frameworks(6).

   - bpo-33479(7): Tkinter documentation has been greatly expanded with
     new "Architecture" and "Threading model" sections.

   - bpo-36700(8): *note base64: f. RFC references were updated to point
     to RFC 4648(9); a section was added to point users to the new
     "security considerations" section of the RFC.

   - bpo-44740(10): Replaced occurrences of uppercase "Web" and
     "Internet" with lowercase versions per the 2016 revised Associated
     Press Style Book.

   - bpo-44693(11): Update the definition of __future__ in the glossary
     by replacing the confusing word "pseudo-module" with a more
     accurate description.

   - bpo-35183(12): Add typical examples to os.path.splitext docs

   - bpo-30511(13): Clarify that *note shutil.make_archive(): 6da. is
     not thread-safe due to reliance on changing the current working
     directory.

   - bpo-44561(14): Update of three expired hyperlinks in
     Doc/distributing/index.rst: "Project structure", "Building and
     packaging the project", and "Uploading the project to the Python
     Packaging Index".

   - bpo-44651(15): Delete entry "coercion" in Doc/glossary.rst for its
     outdated definition.

   - bpo-42958(16): Updated the docstring and docs of *note
     filecmp.cmp(): 19dd. to be more accurate and less confusing
     especially in respect to 'shallow' arg.

   - bpo-44631(17): Refactored the ‘repr()’ code of the ‘_Environ’ (os
     module).

   - bpo-44613(18): importlib.metadata is no longer provisional.

   - bpo-44558(19): Match the docstring and python implementation of
     *note countOf(): ad9. to the behavior of its c implementation.

   - bpo-44544(20): List all kwargs for *note textwrap.wrap(): 16e0,
     *note textwrap.fill(): 16df, and *note textwrap.shorten(): 11d2.
     Now, there are nav links to attributes of ‘TextWrap’, which makes
     navigation much easier while minimizing duplication in the
     documentation.

   - bpo-38062(21): Clarify that atexit uses equality comparisons
     internally.

   - bpo-40620(22): Convert examples in tutorial controlflow.rst section
     4.3 to be interpreter-demo style.

   - bpo-43066(23): Added a warning to *note zipfile: 137. docs:
     filename arg with a leading slash may cause archive to be
     un-openable on Windows systems.

   - bpo-39452(24): Rewrote ‘Doc/library/__main__.rst’.  Broadened scope
     of the document to explicitly discuss and differentiate between
     ‘__main__.py’ in packages versus the ‘__name__ == '__main__'’
     expression (and the idioms that surround it).

   - bpo-13814(25): In the Design FAQ, answer "Why don't generators
     support the with statement?"

   - bpo-27752(26): Documentation of csv.Dialect is more descriptive.

   - bpo-44453(27): Fix documentation for the return type of *note
     sysconfig.get_path(): 1545.

   - bpo-44392(28): Added a new section in the C API documentation for
     types used in type hinting.  Documented ‘Py_GenericAlias’ and
     ‘Py_GenericAliasType’.

   - bpo-38291(29): Mark ‘typing.io’ and ‘typing.re’ as deprecated since
     Python 3.8 in the documentation.  They were never properly
     supported by type checkers.

   - bpo-44322(30): Document that SyntaxError args have a details tuple
     and that details are adjusted for errors in f-string field
     replacement expressions.

   - bpo-42392(31): Document the deprecation and removal of the ‘loop’
     parameter for many functions and classes in *note asyncio: b.

   - bpo-44195(32): Corrected references to ‘TraversableResources’ in
     docs.  There is no ‘TraversableReader’.

   - bpo-41963(33): Document that ‘ConfigParser’ strips off comments
     when reading configuration files.

   - bpo-44072(34): Correct where in the numeric ABC hierarchy ‘**’
     support is added, i.e., in numbers.Complex, not numbers.Integral.

   - bpo-43558(35): Add the remark to *note dataclasses: 33.
     documentation that the ‘__init__()’ of any base class has to be
     called in ‘__post_init__()’, along with a code example.

   - bpo-44025(36): Clarify when '_' in match statements is a keyword,
     and when not.

   - bpo-41706(37): Fix docs about how methods like ‘__add__’ are
     invoked when evaluating operator expressions.

   - bpo-41621(38): Document that *note collections.defaultdict: 13d4.
     parameter ‘default_factory’ defaults to ‘None’ and is
     positional-only.

   - bpo-41576(39): document BaseException in favor of bare except

   - bpo-21760(40): The description for __file__ fixed.  Patch by Furkan
     Onder

   - bpo-39498(41): Add a "Security Considerations" index which links to
     standard library modules that have explicitly documented security
     considerations.

   - bpo-33479(42): Remove the unqualified claim that tkinter is
     threadsafe.  It has not been true for several years and likely
     never was.  An explanation of what is true may be added later,
     after more discussion, and possibly after patching _tkinter.c,

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45216

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45024

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44957

   (4) https://bugs.python.org/issue?@action=redirect&bpo=16580

   (5) https://bugs.python.org/issue?@action=redirect&bpo=44903

   (6) https://wiki.python.org/moin/GuiProgramming

   (7) https://bugs.python.org/issue?@action=redirect&bpo=33479

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36700

   (9) https://datatracker.ietf.org/doc/html/rfc4648.html

   (10) https://bugs.python.org/issue?@action=redirect&bpo=44740

   (11) https://bugs.python.org/issue?@action=redirect&bpo=44693

   (12) https://bugs.python.org/issue?@action=redirect&bpo=35183

   (13) https://bugs.python.org/issue?@action=redirect&bpo=30511

   (14) https://bugs.python.org/issue?@action=redirect&bpo=44561

   (15) https://bugs.python.org/issue?@action=redirect&bpo=44651

   (16) https://bugs.python.org/issue?@action=redirect&bpo=42958

   (17) https://bugs.python.org/issue?@action=redirect&bpo=44631

   (18) https://bugs.python.org/issue?@action=redirect&bpo=44613

   (19) https://bugs.python.org/issue?@action=redirect&bpo=44558

   (20) https://bugs.python.org/issue?@action=redirect&bpo=44544

   (21) https://bugs.python.org/issue?@action=redirect&bpo=38062

   (22) https://bugs.python.org/issue?@action=redirect&bpo=40620

   (23) https://bugs.python.org/issue?@action=redirect&bpo=43066

   (24) https://bugs.python.org/issue?@action=redirect&bpo=39452

   (25) https://bugs.python.org/issue?@action=redirect&bpo=13814

   (26) https://bugs.python.org/issue?@action=redirect&bpo=27752

   (27) https://bugs.python.org/issue?@action=redirect&bpo=44453

   (28) https://bugs.python.org/issue?@action=redirect&bpo=44392

   (29) https://bugs.python.org/issue?@action=redirect&bpo=38291

   (30) https://bugs.python.org/issue?@action=redirect&bpo=44322

   (31) https://bugs.python.org/issue?@action=redirect&bpo=42392

   (32) https://bugs.python.org/issue?@action=redirect&bpo=44195

   (33) https://bugs.python.org/issue?@action=redirect&bpo=41963

   (34) https://bugs.python.org/issue?@action=redirect&bpo=44072

   (35) https://bugs.python.org/issue?@action=redirect&bpo=43558

   (36) https://bugs.python.org/issue?@action=redirect&bpo=44025

   (37) https://bugs.python.org/issue?@action=redirect&bpo=41706

   (38) https://bugs.python.org/issue?@action=redirect&bpo=41621

   (39) https://bugs.python.org/issue?@action=redirect&bpo=41576

   (40) https://bugs.python.org/issue?@action=redirect&bpo=21760

   (41) https://bugs.python.org/issue?@action=redirect&bpo=39498

   (42) https://bugs.python.org/issue?@action=redirect&bpo=33479


File: python.info,  Node: テスト<35>,  Next: ビルド<42>,  Prev: ドキュメント<36>,  Up: Python 3 11 0 alpha 1

1.24.42.23 テスト
.................

   - bpo-40173(1): Fix *note
     test.support.import_helper.import_fresh_module(): 1c62.

   - bpo-45280(2): Add a test case for empty *note typing.NamedTuple:
     331.

   - bpo-45269(3): Cover case when invalid ‘markers’ type is supplied to
     ‘c_make_encoder’.

   - bpo-45128(4): Fix ‘test_multiprocessing_fork’ failure due to
     ‘test_logging’ and ‘sys.modules’ manipulation.

   - bpo-45209(5): Fix ‘UserWarning: resource_tracker’ warning in
     ‘_test_multiprocessing._TestSharedMemory.test_shared_memory_cleaned_after_process_termination’

   - bpo-45185(6): Enables ‘TestEnumerations’ test cases in ‘test_ssl’
     suite.

   - bpo-45195(7): Fix test_readline.test_nonascii(): sometimes, the
     newline character is not written at the end, so don't expect it in
     the output.  Patch by Victor Stinner.

   - bpo-45156(8): Fixes infinite loop on *note unittest.mock.seal():
     d9a. of mocks created by ‘create_autospec()’.

   - bpo-45125(9): Improves pickling tests and docs of ‘SharedMemory’
     and ‘SharableList’ objects.

   - bpo-44860(10): Update ‘test_sysconfig.test_user_similar()’ for the
     posix_user scheme: ‘platlib’ doesn't use *note sys.platlibdir: b32.
     Patch by Victor Stinner.

   - bpo-45052(11):
     ‘WithProcessesTestSharedMemory.test_shared_memory_basics’ test was
     ignored, because ‘self.assertEqual(sms.size, sms2.size)’ line was
     failing.  It is now removed and test is unskipped.

     The main motivation for this line to be removed from the test is
     that the ‘size’ of ‘SharedMemory’ is not ever guaranteed to be the
     same.  It is decided by the platform.

   - bpo-44895(12): libregrtest now clears the type cache later to
     reduce the risk of false alarm when checking for reference leaks.
     Previously, the type cache was cleared too early and libregrtest
     raised a false alarm about reference leaks under very specific
     conditions.  Patch by Irit Katriel and Victor Stinner.

   - bpo-45042(13): Fixes that test classes decorated with
     ‘@hashlib_helper.requires_hashdigest’ were skipped all the time.

   - bpo-25130(14): Add calls of *note gc.collect(): 1b3. in tests to
     support PyPy.

   - bpo-45011(15): Made tests relying on the ‘_asyncio’ C extension
     module optional to allow running on alternative Python
     implementations.  Patch by Serhiy Storchaka.

   - bpo-44949(16): Fix auto history tests of test_readline: sometimes,
     the newline character is not written at the end, so don't expect it
     in the output.

   - bpo-44891(17): Tests were added to clarify *note id(): 163c. is
     preserved when ‘obj * 1’ is used on *note str: 169. and *note
     bytes: 192. objects.  Patch by Nikita Sobolev.

   - bpo-44852(18): Add ability to wholesale silence DeprecationWarnings
     while running the regression test suite.

   - bpo-40928(19): Notify users running test_decimal regression tests
     on macOS of potential harmless "malloc can't allocate region"
     messages spewed by test_decimal.

   - bpo-44734(20): Fixed floating-point precision issue in turtle
     tests.

   - bpo-44708(21): Regression tests, when run with -w, are now
     re-running only the affected test methods instead of re-running the
     entire test file.

   - bpo-42095(22): Added interop tests for Apple plists: generate plist
     files with Python plistlib and parse with Apple plutil; and the
     other way round.

   - bpo-44647(23): Added a permanent Unicode-valued environment
     variable to regression tests to ensure they handle this use case in
     the future.  If your test environment breaks because of that,
     report a bug to us, and temporarily set
     PYTHONREGRTEST_UNICODE_GUARD=0 in your test environment.

   - bpo-44515(24): Adjust recently added contextlib tests to avoid
     assuming the use of a refcounted GC

   - bpo-44287(25): Fix asyncio test_popen() of test_windows_utils by
     using a longer timeout.  Use military grade battle-tested *note
     test.support.SHORT_TIMEOUT: 1c63. timeout rather than a hardcoded
     timeout of 10 seconds: it's 30 seconds by default, but it is made
     longer on slow buildbots.  Patch by Victor Stinner.

   - bpo-44451(26): Reset ‘DeprecationWarning’ filters in
     ‘test.test_importlib.test_metadata_api.APITests.test_entry_points_by_index’
     to avoid ‘StopIteration’ error if ‘DeprecationWarnings’ are
     ignored.

   - bpo-44363(27): Account for address sanitizer in test_capi.
     test_capi now passes when run GCC address sanitizer.

   - bpo-44364(28): Add non integral tests for *note math.sqrt(): bf9.
     function.

   - bpo-43921(29): Fix test_ssl.test_wrong_cert_tls13(): use
     ‘suppress_ragged_eofs=False’, since ‘read()’ can raise *note
     ssl.SSLEOFError: 1ab8. on Windows.  Patch by Victor Stinner.

   - bpo-43921(30): Fix test_pha_required_nocert() of test_ssl: catch
     two more EOF cases (when the ‘recv()’ method returns an empty
     string).  Patch by Victor Stinner.

   - bpo-44131(31): Add test_frozenmain to test_embed to test the
     ‘Py_FrozenMain()’ C function.  Patch by Victor Stinner.

   - bpo-31904(32): Ignore error string case in test_file_not_exists().

   - bpo-42083(33): Add test to check that ‘PyStructSequence_NewType’
     accepts a ‘PyStructSequence_Desc’ with ‘doc’ field set to ‘NULL’.

   - bpo-35753(34): Fix crash in doctest when doctest parses modules
     that include unwrappable functions by skipping those functions.

   - bpo-30256(35): Add test for nested queues when using
     ‘multiprocessing’ shared objects ‘AutoProxy[Queue]’ inside
     ‘ListProxy’ and ‘DictProxy’

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40173

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45280

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45269

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45128

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45209

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45185

   (7) https://bugs.python.org/issue?@action=redirect&bpo=45195

   (8) https://bugs.python.org/issue?@action=redirect&bpo=45156

   (9) https://bugs.python.org/issue?@action=redirect&bpo=45125

   (10) https://bugs.python.org/issue?@action=redirect&bpo=44860

   (11) https://bugs.python.org/issue?@action=redirect&bpo=45052

   (12) https://bugs.python.org/issue?@action=redirect&bpo=44895

   (13) https://bugs.python.org/issue?@action=redirect&bpo=45042

   (14) https://bugs.python.org/issue?@action=redirect&bpo=25130

   (15) https://bugs.python.org/issue?@action=redirect&bpo=45011

   (16) https://bugs.python.org/issue?@action=redirect&bpo=44949

   (17) https://bugs.python.org/issue?@action=redirect&bpo=44891

   (18) https://bugs.python.org/issue?@action=redirect&bpo=44852

   (19) https://bugs.python.org/issue?@action=redirect&bpo=40928

   (20) https://bugs.python.org/issue?@action=redirect&bpo=44734

   (21) https://bugs.python.org/issue?@action=redirect&bpo=44708

   (22) https://bugs.python.org/issue?@action=redirect&bpo=42095

   (23) https://bugs.python.org/issue?@action=redirect&bpo=44647

   (24) https://bugs.python.org/issue?@action=redirect&bpo=44515

   (25) https://bugs.python.org/issue?@action=redirect&bpo=44287

   (26) https://bugs.python.org/issue?@action=redirect&bpo=44451

   (27) https://bugs.python.org/issue?@action=redirect&bpo=44363

   (28) https://bugs.python.org/issue?@action=redirect&bpo=44364

   (29) https://bugs.python.org/issue?@action=redirect&bpo=43921

   (30) https://bugs.python.org/issue?@action=redirect&bpo=43921

   (31) https://bugs.python.org/issue?@action=redirect&bpo=44131

   (32) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (33) https://bugs.python.org/issue?@action=redirect&bpo=42083

   (34) https://bugs.python.org/issue?@action=redirect&bpo=35753

   (35) https://bugs.python.org/issue?@action=redirect&bpo=30256


File: python.info,  Node: ビルド<42>,  Next: Windows<37>,  Prev: テスト<35>,  Up: Python 3 11 0 alpha 1

1.24.42.24 ビルド
.................

   - bpo-45220(1): Avoid building with the Windows 11 SDK previews
     automatically.  This may be overridden by setting the
     ‘DefaultWindowsSDKVersion’ environment variable before building.

   - bpo-45020(2): Freeze stdlib modules that are imported during
     startup.  This provides significant performance improvements to
     startup.  If necessary, use the previously added "-X
     frozen_modules=off" commandline option to force importing the
     source modules.

   - bpo-45188(3): Windows builds now regenerate frozen modules as the
     first part of the build.  Previously the regeneration was later in
     the build, which would require it to be restarted if any modules
     had changed.

   - bpo-45163(4): Fixes Haiku platform build.

   - bpo-45067(5): The ncurses function extended_color_content was
     introduced in 2017

     (‘https://invisible-island.net/ncurses/NEWS.html#index-t20170401’).
     The

     ncurses-devel package in CentOS 7 had a older version ncurses
     resulted in compilation error.  For compiling ncurses with extended
     color support, we verify the version of the ncurses library >=
     20170401.

   - bpo-45019(6): Generate lines in relevant files for frozen modules.
     Up until now each of the files had to be edited manually.  This
     change makes it easier to add to and modify the frozen modules.

   - bpo-44340(7): Add support for building with clang thin lto via
     -with-lto=thin/full.  Patch by Donghee Na and Brett Holman.

   - bpo-44535(8): Enable building using a Visual Studio 2022 install on
     Windows.

   - bpo-43298(9): Improved error message when building without a
     Windows SDK installed.

   - bpo-44381(10): The Windows build now accepts
     ‘EnableControlFlowGuard’ set to ‘guard’ to enable CFG.

   - bpo-41282(11): Fix broken ‘make install’ that caused standard
     library extension modules to be unnecessarily and incorrectly
     rebuilt during the install phase of cpython.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45220

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45020

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45188

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45163

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45067

   (6) https://bugs.python.org/issue?@action=redirect&bpo=45019

   (7) https://bugs.python.org/issue?@action=redirect&bpo=44340

   (8) https://bugs.python.org/issue?@action=redirect&bpo=44535

   (9) https://bugs.python.org/issue?@action=redirect&bpo=43298

   (10) https://bugs.python.org/issue?@action=redirect&bpo=44381

   (11) https://bugs.python.org/issue?@action=redirect&bpo=41282


File: python.info,  Node: Windows<37>,  Next: macOS<27>,  Prev: ビルド<42>,  Up: Python 3 11 0 alpha 1

1.24.42.25 Windows
..................

   - bpo-45375(1): Fixes an assertion failure due to searching for the
     standard library in unnormalised paths.

   - bpo-45022(2): Update Windows release to include libffi 3.4.2

   - bpo-45007(3): Update to OpenSSL 1.1.1l in Windows build

   - bpo-44848(4): Upgrade Windows installer to use SQLite 3.36.0.

   - bpo-44572(5): Avoid consuming standard input in the *note platform:
     af. module

   - bpo-44582(6): Accelerate speed of *note mimetypes: 93.
     initialization using a native implementation of the registry scan.

   - bpo-41299(7): Fix 16 milliseconds jitter when using timeouts in
     *note threading: f3, such as with *note threading.Lock.acquire():
     8a7. or *note threading.Condition.wait(): 1c66.

   - bpo-42686(8): Build *note sqlite3: d4. with math functions enabled.
     Patch by Erlend E. Aasland.

   - bpo-40263(9): This is a follow-on bug from
     ‘https://bugs.python.org/issue26903’.  Once that is applied we run
     into an off-by-one assertion problem.  The assert was not correct.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45375

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45022

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45007

   (4) https://bugs.python.org/issue?@action=redirect&bpo=44848

   (5) https://bugs.python.org/issue?@action=redirect&bpo=44572

   (6) https://bugs.python.org/issue?@action=redirect&bpo=44582

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41299

   (8) https://bugs.python.org/issue?@action=redirect&bpo=42686

   (9) https://bugs.python.org/issue?@action=redirect&bpo=40263


File: python.info,  Node: macOS<27>,  Next: IDLE<19>,  Prev: Windows<37>,  Up: Python 3 11 0 alpha 1

1.24.42.26 macOS
................

   - bpo-45007(1): Update macOS installer builds to use OpenSSL 1.1.1l.

   - bpo-34602(2): When building CPython on macOS with ‘./configure
     --with-undefined-behavior-sanitizer --with-pydebug’, the stack size
     is now quadrupled to allow for the entire test suite to pass.

   - bpo-44848(3): Update macOS installer to use SQLite 3.36.0.

   - bpo-44689(4): *note ctypes.util.find_library(): f45. now works
     correctly on macOS 11 Big Sur even if Python is built on an older
     version of macOS. Previously, when built on older macOS systems,
     ‘find_library’ was not able to find macOS system libraries when
     running on Big Sur due to changes in how system libraries are
     stored.

   - bpo-41972(5): The framework build's user header path in sysconfig
     is changed to add a 'pythonX.Y' component to match distutils's
     behavior.

   - bpo-43109(6): Allow -with-lto configure option to work with
     Apple-supplied Xcode or Command Line Tools.

   - bpo-34932(7): Add socket.TCP_KEEPALIVE support for macOS. Patch by
     Shane Harvey.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45007

   (2) https://bugs.python.org/issue?@action=redirect&bpo=34602

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44848

   (4) https://bugs.python.org/issue?@action=redirect&bpo=44689

   (5) https://bugs.python.org/issue?@action=redirect&bpo=41972

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43109

   (7) https://bugs.python.org/issue?@action=redirect&bpo=34932


File: python.info,  Node: IDLE<19>,  Next: Tools/Demos<27>,  Prev: macOS<27>,  Up: Python 3 11 0 alpha 1

1.24.42.27 IDLE
...............

   - bpo-45296(1): On Windows, change exit/quit message to suggest
     Ctrl-D, which works, instead of <Ctrl-Z Return>, which does not
     work in IDLE.

   - bpo-45193(2): Make completion boxes appear on Ubuntu again.

   - bpo-40128(3): Mostly fix completions on macOS when not using tcl/tk
     8.6.11 (as with 3.9).  The added update_idletask call should be
     harmless and possibly helpful otherwise.

   - bpo-33962(4): Move the indent space setting from the Font tab to
     the new Windows tab.  Patch by Mark Roseman and Terry Jan Reedy.

   - bpo-40468(5): Split the settings dialog General tab into Windows
     and Shell/ED tabs.  Move help sources, which extend the Help menu,
     to the Extensions tab.  Make space for new options and shorten the
     dialog.  The latter makes the dialog better fit small screens.

   - bpo-41611(6): Avoid uncaught exceptions in
     ‘AutoCompleteWindow.winconfig_event()’.

   - bpo-41611(7): Fix IDLE sometimes freezing upon tab-completion on
     macOS.

   - bpo-44010(8): Highlight the new *note match: a0e. statement's *note
     soft keywords: a0d.: *note match: a0e, *note case: a0e, and *note
     _: a0f.  However, this highlighting is not perfect and will be
     incorrect in some rare cases, including some ‘_’-s in ‘case’
     patterns.

   - bpo-44026(9): Include interpreter's typo fix suggestions in message
     line for NameErrors and AttributeErrors.  Patch by E. Paine.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=45296

   (2) https://bugs.python.org/issue?@action=redirect&bpo=45193

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40128

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33962

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40468

   (6) https://bugs.python.org/issue?@action=redirect&bpo=41611

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41611

   (8) https://bugs.python.org/issue?@action=redirect&bpo=44010

   (9) https://bugs.python.org/issue?@action=redirect&bpo=44026


File: python.info,  Node: Tools/Demos<27>,  Next: C API<37>,  Prev: IDLE<19>,  Up: Python 3 11 0 alpha 1

1.24.42.28 Tools/Demos
......................

   - bpo-44786(1): Fix a warning in regular expression in the c-analyzer
     script.

   - bpo-44967(2): pydoc now returns a non-zero status code when a
     module cannot be found.

   - bpo-44978(3): Allow the Argument Clinic tool to handle
     ‘__complex__’ special methods.

   - bpo-43425(4): Removed the 'test2to3' demo project that demonstrated
     using lib2to3 to support Python 2.x and Python 3.x from a single
     source in a distutils package.  Patch by Donghee Na

   - bpo-44074(5): Make patchcheck automatically detect the correct base
     branch name (previously it was hardcoded to 'master')

   - bpo-20291(6): Added support for variadic positional parameters in
     Argument Clinic.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44786

   (2) https://bugs.python.org/issue?@action=redirect&bpo=44967

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44978

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43425

   (5) https://bugs.python.org/issue?@action=redirect&bpo=44074

   (6) https://bugs.python.org/issue?@action=redirect&bpo=20291


File: python.info,  Node: C API<37>,  Prev: Tools/Demos<27>,  Up: Python 3 11 0 alpha 1

1.24.42.29 C API
................

   - bpo-41710(1): The PyThread_acquire_lock_timed() function now clamps
     the timeout if it is too large, rather than aborting the process.
     Patch by Victor Stinner.

   - bpo-44687(2): ‘BufferedReader.peek()’ no longer raises *note
     ValueError: 2ec. when the entire file has already been buffered.

   - bpo-45116(3): Add the *note Py_ALWAYS_INLINE: 1c6b. macro to ask
     the compiler to always inline a static inline function.  The
     compiler can ignore it and decides to not inline the function.
     Patch by Victor Stinner.

   - bpo-45094(4): Add the *note Py_NO_INLINE: 1802. macro to disable
     inlining on a function.  Patch by Victor Stinner.

   - bpo-45061(5): Add a deallocator to the *note bool: 3c3. type to
     detect refcount bugs in C extensions which call
     ‘Py_DECREF(Py_True);’ or ‘Py_DECREF(Py_False);’ by mistake.  Patch
     by Victor Stinner.

   - bpo-42035(6): Add a new *note PyType_GetQualName(): 959. function
     to get type's qualified name.

   - bpo-41103(7): Reverts removal of the old buffer protocol because
     they are part of stable ABI.

   - bpo-44751(8): Remove ‘crypt.h’ include from the public ‘Python.h’
     header.

   - bpo-42747(9): The ‘Py_TPFLAGS_HAVE_VERSION_TAG’ type flag now does
     nothing.  The ‘Py_TPFLAGS_HAVE_AM_SEND’ flag (which was added in
     3.10) is removed.  Both were unnecessary because it is not possible
     to have type objects with the relevant fields missing.

   - bpo-44530(10): Added the ‘co_qualname’ to the ‘PyCodeObject’
     structure to propagate the qualified name from the compiler to code
     objects.

     Patch by Gabriele N. Tornetta

   - bpo-44441(11): *note Py_RunMain(): bbc. now resets *note
     PyImport_Inittab: 1b1b. to its initial value at exit.  It must be
     possible to call *note PyImport_AppendInittab(): 1b1c. or *note
     PyImport_ExtendInittab(): 1b1d. at each Python initialization.
     Patch by Victor Stinner.

   - bpo-39947(12): Remove 4 private trashcan C API functions which were
     only kept for the backward compatibility of the stable ABI with
     Python 3.8 and older, since the trashcan API was not usable with
     the limited C API on Python 3.8 and older.  The trashcan API was
     excluded from the limited C API in Python 3.9.

     Removed functions:

        * _PyTrash_deposit_object()

        * _PyTrash_destroy_chain()

        * _PyTrash_thread_deposit_object()

        * _PyTrash_thread_destroy_chain()

     The trashcan C API was never usable with the limited C API, since
     old trashcan macros accessed directly *note PyThreadState: 990.
     members like ‘_tstate->trash_delete_nesting’, whereas the *note
     PyThreadState: 990. structure is opaque in the limited C API.

     Exclude also the ‘PyTrash_UNWIND_LEVEL’ constant from the C API.

     Patch by Victor Stinner.

   - bpo-40939(13): Removed documentation for the removed ‘PyParser_*’ C
     API.

   - bpo-43795(14): The list in *note 限定版APIの内容: 99d. now shows
     the public name *note PyFrameObject: 98c. rather than ‘_frame’.
     The non-existing entry ‘_node’ no longer appears in the list.

   - bpo-44378(15): *note Py_IS_TYPE(): 1ba0. no longer uses *note
     Py_TYPE(): 3c9. to avoid a compiler warning: no longer cast ‘const
     PyObject*’ to ‘PyObject*’.  Patch by Victor Stinner.

   - bpo-39573(16): Convert the *note Py_TYPE(): 3c9. and *note
     Py_SIZE(): 985. macros to static inline functions.  The *note
     Py_SET_TYPE(): 984. and *note Py_SET_SIZE(): 986. functions must
     now be used to set an object type and size.  Patch by Victor
     Stinner.

   - bpo-44263(17): The *note PyType_Ready(): 980. function now raises
     an error if a type is defined with the *note Py_TPFLAGS_HAVE_GC:
     981. flag set but has no traverse function (*note
     PyTypeObject.tp_traverse: 982.).  Patch by Victor Stinner.

   - bpo-43795(18): The undocumented function ‘Py_FrozenMain()’ is
     removed from the Limited API.

   - bpo-44113(19): Deprecate the following functions to configure the
     Python initialization:

        * ‘PySys_AddWarnOptionUnicode()’

        * ‘PySys_AddWarnOption()’

        * ‘PySys_AddXOption()’

        * ‘PySys_HasWarnOptions()’

        * ‘Py_SetPath()’

        * ‘Py_SetProgramName()’

        * ‘Py_SetPythonHome()’

        * ‘Py_SetStandardStreamEncoding()’

        * ‘_Py_SetProgramFullPath()’

     Use the new *note PyConfig: 3f7. API of the *note Python
     Initialization Configuration: 646. instead ( PEP 587(20)).

   - bpo-44094(21): Remove ‘PyErr_SetFromErrnoWithUnicodeFilename()’,
     ‘PyErr_SetFromWindowsErrWithUnicodeFilename()’, and
     ‘PyErr_SetExcFromWindowsErrWithUnicodeFilename()’.  They are not
     documented and have been deprecated since Python 3.3.

   - bpo-43795(22): *note PyCodec_Unregister(): a97. is now properly
     exported as a function in the Windows Stable ABI DLL.

   - bpo-44029(23): Remove deprecated ‘Py_UNICODE’ APIs:
     ‘PyUnicode_Encode’, ‘PyUnicode_EncodeUTF7’, ‘PyUnicode_EncodeUTF8’,
     ‘PyUnicode_EncodeUTF16’, ‘PyUnicode_EncodeUTF32’,
     ‘PyUnicode_EncodeLatin1’, ‘PyUnicode_EncodeMBCS’,
     ‘PyUnicode_EncodeDecimal’, ‘PyUnicode_EncodeRawUnicodeEscape’,
     ‘PyUnicode_EncodeCharmap’, ‘PyUnicode_EncodeUnicodeEscape’,
     ‘PyUnicode_TransformDecimalToASCII’, ‘PyUnicode_TranslateCharmap’,
     ‘PyUnicodeEncodeError_Create’, ‘PyUnicodeTranslateError_Create’.
     See PEP 393(24) and PEP 624(25) for reference.

   - bpo-42035(26): Add a new *note PyType_GetName(): 958. function to
     get type's short name.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41710

   (2) https://bugs.python.org/issue?@action=redirect&bpo=44687

   (3) https://bugs.python.org/issue?@action=redirect&bpo=45116

   (4) https://bugs.python.org/issue?@action=redirect&bpo=45094

   (5) https://bugs.python.org/issue?@action=redirect&bpo=45061

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42035

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41103

   (8) https://bugs.python.org/issue?@action=redirect&bpo=44751

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42747

   (10) https://bugs.python.org/issue?@action=redirect&bpo=44530

   (11) https://bugs.python.org/issue?@action=redirect&bpo=44441

   (12) https://bugs.python.org/issue?@action=redirect&bpo=39947

   (13) https://bugs.python.org/issue?@action=redirect&bpo=40939

   (14) https://bugs.python.org/issue?@action=redirect&bpo=43795

   (15) https://bugs.python.org/issue?@action=redirect&bpo=44378

   (16) https://bugs.python.org/issue?@action=redirect&bpo=39573

   (17) https://bugs.python.org/issue?@action=redirect&bpo=44263

   (18) https://bugs.python.org/issue?@action=redirect&bpo=43795

   (19) https://bugs.python.org/issue?@action=redirect&bpo=44113

   (20) https://peps.python.org/pep-0587/

   (21) https://bugs.python.org/issue?@action=redirect&bpo=44094

   (22) https://bugs.python.org/issue?@action=redirect&bpo=43795

   (23) https://bugs.python.org/issue?@action=redirect&bpo=44029

   (24) https://peps.python.org/pep-0393/

   (25) https://peps.python.org/pep-0624/

   (26) https://bugs.python.org/issue?@action=redirect&bpo=42035


File: python.info,  Node: Python 3 10 0 beta 1,  Next: Python 3 10 0 alpha 7,  Prev: Python 3 11 0 alpha 1,  Up: 変更履歴

1.24.43 Python 3.10.0 beta 1
----------------------------

'リリース日: 2021-05-03'

* Menu:

* セキュリティ: セキュリティ<30>.
* Core and Builtins: Core and Builtins<114>.
* ライブラリ: ライブラリ<117>.
* Core and Builtins: Core and Builtins<115>.
* ライブラリ: ライブラリ<118>.
* Core and Builtins: Core and Builtins<116>.
* ライブラリ: ライブラリ<119>.
* ドキュメント: ドキュメント<37>.
* テスト: テスト<36>.
* ビルド: ビルド<43>.
* Windows: Windows<38>.
* macOS: macOS<28>.
* IDLE: IDLE<20>.
* C API: C API<38>.


File: python.info,  Node: セキュリティ<30>,  Next: Core and Builtins<114>,  Up: Python 3 10 0 beta 1

1.24.43.1 セキュリティ
......................

   - bpo-43434(1): Creating *note sqlite3.Connection: 54d. objects now
     also produces ‘sqlite3.connect’ and ‘sqlite3.connect/handle’ *note
     auditing events: 1c6e.  Previously these events were only produced
     by *note sqlite3.connect(): 5a6. calls.  Patch by Erlend E.
     Aasland.

   - bpo-43998(2): The *note ssl: d5. module sets more secure cipher
     suites defaults.  Ciphers without forward secrecy and with SHA-1
     MAC are disabled by default.  Security level 2 prohibits weak RSA,
     DH, and ECC keys with less than 112 bits of security.  *note
     SSLContext: 357. defaults to minimum protocol version TLS 1.2.
     Settings are based on Hynek Schlawack's research.

   - bpo-43882(3): The presence of newline or tab characters in parts of
     a URL could allow some forms of attacks.

     Following the controlling specification for URLs defined by WHATWG
     *note urllib.parse(): 110. now removes ASCII newlines and tabs from
     URLs, preventing such attacks.

   - bpo-43472(4): Ensures interpreter-level audit hooks receive the
     ‘cpython.PyInterpreterState_New’ event when called through the
     ‘_xxsubinterpreters’ module.

   - bpo-43362(5): Fix invalid free in _sha3 module.  The issue was
     introduced in 3.10.0a1.  Python 3.9 and earlier are not affected.

   - bpo-43762(6): Add audit events for ‘sqlite3.connect/handle()’,
     *note sqlite3.Connection.enable_load_extension(): a3f, and *note
     sqlite3.Connection.load_extension(): 6df.  Patch by Erlend E.
     Aasland.

   - bpo-43756(7): Add new audit event ‘glob.glob/2’ to incorporate the
     new 'root_dir' and 'dir_fd' arguments added to *note glob.glob():
     5a0. and *note glob.iglob(): a08.

   - bpo-36384(8): *note ipaddress: 84. module no longer accepts any
     leading zeros in IPv4 address strings.  Leading zeros are ambiguous
     and interpreted as octal notation by some libraries.  For example
     the legacy function *note socket.inet_aton(): b5a. treats leading
     zeros as octal notation.  glibc implementation of modern *note
     inet_pton(): b5b. does not accept any leading zeros.  For a while
     the *note ipaddress: 84. module used to accept ambiguous leading
     zeros.

   - bpo-43075(9): Fix Regular Expression Denial of Service (ReDoS)
     vulnerability in *note urllib.request.AbstractBasicAuthHandler:
     1c6f.  The ReDoS-vulnerable regex has quadratic worst-case
     complexity and it allows cause a denial of service when identifying
     crafted invalid RFCs.  This ReDoS issue is on the client side and
     needs remote attackers to control the HTTP server.

   - bpo-42800(10): Audit hooks are now fired for frame.f_code,
     traceback.tb_frame, and generator code/frame attribute access.

   - bpo-37363(11): Add audit events to the *note http.client: 73.
     module.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43434

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43998

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43882

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43472

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43362

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43762

   (7) https://bugs.python.org/issue?@action=redirect&bpo=43756

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36384

   (9) https://bugs.python.org/issue?@action=redirect&bpo=43075

   (10) https://bugs.python.org/issue?@action=redirect&bpo=42800

   (11) https://bugs.python.org/issue?@action=redirect&bpo=37363


File: python.info,  Node: Core and Builtins<114>,  Next: ライブラリ<117>,  Prev: セキュリティ<30>,  Up: Python 3 10 0 beta 1

1.24.43.2 Core and Builtins
...........................

   - bpo-43977(1): Prevent classes being both a sequence and a mapping
     when pattern matching.

   - bpo-43977(2): Use *note tp_flags: 1c71. on the class object to
     determine if the subject is a sequence or mapping when pattern
     matching.  Avoids the need to import *note collections.abc: 1f.
     when pattern matching.

   - bpo-43892(3): Restore proper validation of complex literal value
     patterns when parsing ‘match’ blocks.

   - bpo-43933(4): Set frame.f_lineno to the line number of the 'with'
     kweyword when executing the call to ‘__exit__’.

   - bpo-43933(5): If the current position in a frame has no line number
     then set the f_lineno attribute to None, instead of -1, to conform
     to PEP 626.  This should not normally be possible, but might occur
     in some unusual circumstances.

   - bpo-43963(6): Importing the ‘_signal’ module in a subinterpreter
     has no longer side effects.

   - bpo-42739(7): The internal representation of line number tables is
     changed to not use sentinels, and an explicit length parameter is
     added to the out of process API function
     ‘PyLineTable_InitAddressRange’.  This makes the handling of line
     number tables more robust in some circumstances.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43977

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43977

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43892

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43933

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43933

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43963

   (7) https://bugs.python.org/issue?@action=redirect&bpo=42739


File: python.info,  Node: ライブラリ<117>,  Next: Core and Builtins<115>,  Prev: Core and Builtins<114>,  Up: Python 3 10 0 beta 1

1.24.43.3 ライブラリ
....................

   - bpo-43908(1): Make *note re: be. types immutable.  Patch by Erlend
     E. Aasland.

   - bpo-43908(2): Make the *note array.array: 4be. type immutable.
     Patch by Erlend E. Aasland.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43908

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43908


File: python.info,  Node: Core and Builtins<115>,  Next: ライブラリ<118>,  Prev: ライブラリ<117>,  Up: Python 3 10 0 beta 1

1.24.43.4 Core and Builtins
...........................

   - bpo-43901(1): Change class and module objects to lazy-create empty
     annotations dicts on demand.  The annotations dicts are stored in
     the object's __dict__ for backwards compatibility.

   - bpo-43892(2): Match patterns now use new dedicated AST nodes
     (‘MatchValue’, ‘MatchSingleton’, ‘MatchSequence’, ‘MatchStar’,
     ‘MatchMapping’, ‘MatchClass’) rather than reusing expression AST
     nodes.  ‘MatchAs’ and ‘MatchOr’ are now defined as pattern nodes
     rather than as expression nodes.  Patch by Nick Coghlan.

   - bpo-42725(3): Usage of ‘await’/‘yield’/‘yield from’ and named
     expressions within an annotation is now forbidden when PEP 563 is
     activated.

   - bpo-43754(4): When performing structural pattern matching ( PEP
     634(5)), captured names are now left unbound until the 'entire'
     pattern has matched successfully.

   - bpo-42737(6): Annotations for complex targets (everything beside
     simple names) no longer cause any runtime effects with ‘from
     __future__ import annotations’.

   - bpo-43914(7): *note SyntaxError: 18e. exceptions raised by the
     interpreter will highlight the full error range of the expression
     that constitutes the syntax error itself, instead of just where the
     problem is detected.  Patch by Pablo Galindo.

   - bpo-38605(8): Revert making ‘from __future__ import annotations’
     the default.  This follows the Steering Council decision to
     postpone PEP 563 changes to at least Python 3.11.  See the original
     email for more information regarding the decision:
     ‘https://mail.python.org/archives/list/python-dev@python.org/thread/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/’.
     Patch by Pablo Galindo.

   - bpo-43475(9): Hashes of NaN values now depend on object identity.
     Formerly, they always hashed to 0 even though NaN values are not
     equal to one another.  Having the same hash for unequal values
     caused pile-ups in hash tables.

   - bpo-43859(10): Improve the error message for *note
     IndentationError: 1750. exceptions.  Patch by Pablo Galindo

   - bpo-41323(11): Constant tuple folding in bytecode optimizer now
     reuses tuple in constant table.

   - bpo-43846(12): Data stack usage is much reduced for large literal
     and call expressions.

   - bpo-38530(13): When printing *note NameError: 452. raised by the
     interpreter, ‘PyErr_Display()’ will offer suggestions of similar
     variable names in the function that the exception was raised from.
     Patch by Pablo Galindo

   - bpo-43823(14): Improve syntax errors for invalid dictionary
     literals.  Patch by Pablo Galindo.

   - bpo-43822(15): Improve syntax errors in the parser for missing
     commas between expressions.  Patch by Pablo Galindo.

   - bpo-43798(16): *note ast.alias: 1c74. nodes now include source
     location metadata attributes e.g.  lineno, col_offset.

   - bpo-43797(17): Improve ‘SyntaxError’ error messages for invalid
     comparisons.  Patch by Pablo Galindo.

   - bpo-43760(18): Move the flag for checking whether tracing is
     enabled to the C stack, from the heap.  Should speed up dispatch in
     the interpreter.

   - bpo-43682(19): Static methods (*note @staticmethod: 453.) and class
     methods (*note @classmethod: 48e.) now inherit the method
     attributes (‘__module__’, ‘__name__’, ‘__qualname__’, ‘__doc__’,
     ‘__annotations__’) and have a new ‘__wrapped__’ attribute.  Patch
     by Victor Stinner.

   - bpo-43751(20): Fixed a bug where ‘anext(ait, default)’ would
     erroneously return None.

   - bpo-42128(21): *note __match_args__: 1c75. is no longer allowed to
     be a list.

   - bpo-43683(22): Add GEN_START opcode.  Marks start of generator,
     including async, or coroutine and handles sending values to a newly
     created generator or coroutine.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43901

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43892

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42725

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43754

   (5) https://peps.python.org/pep-0634/

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42737

   (7) https://bugs.python.org/issue?@action=redirect&bpo=43914

   (8) https://bugs.python.org/issue?@action=redirect&bpo=38605

   (9) https://bugs.python.org/issue?@action=redirect&bpo=43475

   (10) https://bugs.python.org/issue?@action=redirect&bpo=43859

   (11) https://bugs.python.org/issue?@action=redirect&bpo=41323

   (12) https://bugs.python.org/issue?@action=redirect&bpo=43846

   (13) https://bugs.python.org/issue?@action=redirect&bpo=38530

   (14) https://bugs.python.org/issue?@action=redirect&bpo=43823

   (15) https://bugs.python.org/issue?@action=redirect&bpo=43822

   (16) https://bugs.python.org/issue?@action=redirect&bpo=43798

   (17) https://bugs.python.org/issue?@action=redirect&bpo=43797

   (18) https://bugs.python.org/issue?@action=redirect&bpo=43760

   (19) https://bugs.python.org/issue?@action=redirect&bpo=43682

   (20) https://bugs.python.org/issue?@action=redirect&bpo=43751

   (21) https://bugs.python.org/issue?@action=redirect&bpo=42128

   (22) https://bugs.python.org/issue?@action=redirect&bpo=43683


File: python.info,  Node: ライブラリ<118>,  Next: Core and Builtins<116>,  Prev: Core and Builtins<115>,  Up: Python 3 10 0 beta 1

1.24.43.5 ライブラリ
....................

   - bpo-43105(1): Importlib now resolves relative paths when creating
     module spec objects from file locations.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43105


File: python.info,  Node: Core and Builtins<116>,  Next: ライブラリ<119>,  Prev: ライブラリ<118>,  Up: Python 3 10 0 beta 1

1.24.43.6 Core and Builtins
...........................

   - bpo-43682(1): Static methods (*note @staticmethod: 453.) are now
     callable as regular functions.  Patch by Victor Stinner.

   - bpo-42609(2): Prevented crashes in the AST validator and optimizer
     when compiling some absurdly long expressions like ‘"+0"*1000000’.
     *note RecursionError: f68. is now raised instead.

   - bpo-38530(3): When printing *note AttributeError: 5f0,
     ‘PyErr_Display()’ will offer suggestions of similar attribute names
     in the object that the exception was raised from.  Patch by Pablo
     Galindo

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43682

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42609

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38530


File: python.info,  Node: ライブラリ<119>,  Next: ドキュメント<37>,  Prev: Core and Builtins<116>,  Up: Python 3 10 0 beta 1

1.24.43.7 ライブラリ
....................

   - bpo-44015(1): In @dataclass(), raise a TypeError if KW_ONLY is
     specified more than once.

   - bpo-25478(2): Added a 'total()' method to collections.Counter() to
     compute the sum of the counts.

   - bpo-43733(3): Change *note netrc.netrc: 1c79. to use UTF-8 encoding
     before using locale encoding.

   - bpo-43979(4): Removed an unnecessary list comprehension before
     looping from *note urllib.parse.parse_qsl(): 31e.  Patch by
     Christoph Zwerschke and Donghee Na.

   - bpo-43993(5): Update bundled pip to 21.1.1.

   - bpo-43957(6): [Enum] Deprecate ‘TypeError’ when non-member is used
     in a containment check; In 3.12 ‘True’ or ‘False’ will be returned
     instead, and containment will return ‘True’ if the value is either
     a member of that enum or one of its members' value.

   - bpo-42904(7): For backwards compatibility with previous minor
     versions of Python, if *note typing.get_type_hints(): 8c0. receives
     no namespace dictionary arguments, *note typing.get_type_hints():
     8c0. will search through the global then local namespaces during
     evaluation of stringized type annotations (string forward
     references) inside a class.

   - bpo-43945(8): [Enum] Deprecate non-standard mixin format()
     behavior: in 3.12 the enum member, not the member's value, will be
     used for format() calls.

   - bpo-41139(9): Deprecate undocumented ‘cgi.log()’ API.

   - bpo-43937(10): Fixed the *note turtle: 107. module working with
     non-default root window.

   - bpo-43930(11): Update bundled pip to 21.1 and setuptools to 56.0.0

   - bpo-43907(12): Fix a bug in the pure-Python pickle implementation
     when using protocol 5, where bytearray instances that occur several
     time in the pickled object graph would incorrectly unpickle into
     repeated copies of the bytearray object.

   - bpo-43926(13): In ‘importlib.metadata’, provide a uniform interface
     to ‘Description’, allow for any field to be encoded with multiline
     values, remove continuation lines from multiline values, and add a
     ‘.json’ property for easy access to the PEP 566 JSON-compatible
     form.  Sync with ‘importlib_metadata 4.0’.

   - bpo-43920(14): OpenSSL 3.0.0: *note load_verify_locations(): 10ee.
     now returns a consistent error message when cadata contains no
     valid certificate.

   - bpo-43607(15): *note urllib: 10e. can now convert Windows paths
     with ‘\\?\’ prefixes into URL paths.

   - bpo-43817(16): Add *note inspect.get_annotations(): a14, which
     safely computes the annotations defined on an object.  It works
     around the quirks of accessing the annotations from various types
     of objects, and makes very few assumptions about the object passed
     in.  *note inspect.get_annotations(): a14. can also correctly
     un-stringize stringized annotations.

     *note inspect.signature(): 22f, ‘inspect.from_callable()’, and
     ‘inspect.from_function()’ now call *note inspect.get_annotations():
     a14. to retrieve annotations.  This means *note
     inspect.signature(): 22f. and ‘inspect.from_callable()’ can now
     un-stringize stringized annotations, too.

   - bpo-43284(17): platform.win32_ver derives the windows version from
     sys.getwindowsversion().platform_version which in turn derives the
     version from kernel32.dll (which can be of a different version than
     Windows itself).  Therefore change the platform.win32_ver to
     determine the version using the platform module's _syscmd_ver
     private function to return an accurate version.

   - bpo-42854(18): The *note ssl: d5. module now uses ‘SSL_read_ex’ and
     ‘SSL_write_ex’ internally.  The functions support reading and
     writing of data larger than 2 GB. Writing zero-length data no
     longer fails with a protocol violation error.

   - bpo-42333(19): Port ‘_ssl’ extension module to multiphase
     initialization.

   - bpo-43880(20): *note ssl: d5. now raises DeprecationWarning for
     OP_NO_SSL/TLS* options, old TLS versions, old protocols, and other
     features that have been deprecated since Python 3.6, 3.7, or
     OpenSSL 1.1.0.

   - bpo-41559(21): PEP 612(22) is now implemented purely in Python;
     builtin ‘types.GenericAlias’ objects no longer include
     ‘typing.ParamSpec’ in ‘__parameters__’ (with the exception of
     ‘collections.abc.Callable’'s ‘GenericAlias’).  This means
     previously invalid uses of ‘ParamSpec’ (such as ‘list[P]’) which
     worked in earlier versions of Python 3.10 alpha, will now raise
     ‘TypeError’ during substitution.

   - bpo-43867(23): The *note multiprocessing: 98. ‘Server’ class now
     explicitly catches *note SystemExit: f3c. and closes the client
     connection in this case.  It happens when the
     ‘Server.serve_client()’ method reaches the end of file (EOF).

   - bpo-40443(24): Remove unused imports: pyclbr no longer uses copy,
     and typing no longer uses ast.  Patch by Victor Stinner.

   - bpo-43820(25): Remove an unneeded copy of the namespace passed to
     dataclasses.make_dataclass().

   - bpo-43787(26): Add ‘__iter__()’ method to *note bz2.BZ2File: a66,
     *note gzip.GzipFile: 65c, and *note lzma.LZMAFile: 120e.  It makes
     iterating them about 2x faster.  Patch by Inada Naoki.

   - bpo-43680(27): Deprecate io.OpenWrapper and _pyio.OpenWrapper: use
     io.open and _pyio.open instead.  Until Python 3.9, _pyio.open was
     not a static method and builtins.open was set to OpenWrapper to not
     become a bound method when set to a class variable.  _io.open is a
     built-in function whereas _pyio.open is a Python function.  In
     Python 3.10, _pyio.open() is now a static method, and
     builtins.open() is now io.open().

   - bpo-43680(28): The Python ‘_pyio.open()’ function becomes a static
     method to behave as *note io.open(): 740. built-in function: don't
     become a bound method when stored as a class variable.  It becomes
     possible since static methods are now callable in Python 3.10.
     Moreover, ‘_pyio.OpenWrapper()’ becomes a simple alias to
     ‘_pyio.open()’.  Patch by Victor Stinner.

   - bpo-41515(29): Fix *note KeyError: 5e7. raised in *note
     typing.get_type_hints(): 8c0. due to synthetic modules that don't
     appear in ‘sys.modules’.

   - bpo-43776(30): When *note subprocess.Popen: 4b7. args are provided
     as a string or as *note pathlib.Path: 266, the Popen instance repr
     now shows the right thing.

   - bpo-42248(31): [Enum] ensure exceptions raised in ‘_missing__’ are
     released

   - bpo-43744(32): fix issue with enum member name matching the start
     of a private variable name

   - bpo-43772(33): Fixed the return value of ‘TypeVar.__ror__’.  Patch
     by Jelle Zijlstra.

   - bpo-43764(34): Add match_args parameter to @dataclass decorator to
     allow suppression of __match_args__ generation.

   - bpo-43799(35): OpenSSL 3.0.0: define ‘OPENSSL_API_COMPAT’ 1.1.1 to
     suppress deprecation warnings.  Python requires OpenSSL 1.1.1 APIs.

   - bpo-43478(36): Mocks can no longer be used as the specs for other
     Mocks.  As a result, an already-mocked object cannot have an
     attribute mocked using ‘autospec=True’ or be the subject of a
     ‘create_autospec(...)’ call.  This can uncover bugs in tests since
     these Mock-derived Mocks will always pass certain tests (e.g.
     *note isinstance(): 2ad.) and builtin assert functions (e.g.
     assert_called_once_with) will unconditionally pass.

   - bpo-43794(37): Add *note ssl.OP_IGNORE_UNEXPECTED_EOF: a38.
     constants (OpenSSL 3.0.0)

   - bpo-43785(38): Improve ‘bz2.BZ2File’ performance by removing the
     RLock from BZ2File.  This makes BZ2File thread unsafe in the face
     of multiple simultaneous readers or writers, just like its
     equivalent classes in *note gzip: 6b. and *note lzma: 8e. have
     always been.  Patch by Inada Naoki.

   - bpo-43789(39): OpenSSL 3.0.0: Don't call the password callback
     function a second time when first call has signaled an error
     condition.

   - bpo-43788(40): The header files for *note ssl: d5. error codes are
     now OpenSSL version-specific.  Exceptions will now show correct
     reason and library codes.  The ‘make_ssl_data.py’ script has been
     rewritten to use OpenSSL's text file with error codes.

   - bpo-43766(41): Implement PEP 647(42) in the *note typing: 10a.
     module by adding ‘TypeGuard’.

   - bpo-25264(43): *note os.path.realpath(): 262. now accepts a
     'strict' keyword-only argument.  When set to ‘True’, *note OSError:
     2c0. is raised if a path doesn't exist or a symlink loop is
     encountered.

   - bpo-43780(44): In ‘importlib.metadata’, incorporate changes from
     importlib_metadata 3.10: Add mtime-based caching during
     distribution discovery.  Flagged use of dict result from
     ‘entry_points()’ as deprecated.

   - gh-47383(45): The ‘P.args’ and ‘P.kwargs’ attributes of *note
     typing.ParamSpec: 487. are now instances of the new classes *note
     typing.ParamSpecArgs: 9c9. and *note typing.ParamSpecKwargs: 9ca,
     which enables a more useful ‘repr()’.  Patch by Jelle Zijlstra.

   - bpo-43731(46): Add an ‘encoding’ parameter ‘logging.fileConfig()’.

   - bpo-43712(47): Add ‘encoding’ and ‘errors’ parameters to *note
     fileinput.input(): a00. and *note fileinput.FileInput: 940.

   - bpo-38659(48): A ‘simple_enum’ decorator is added to the ‘enum’
     module to convert a normal class into an Enum.  ‘test_simple_enum’
     added to test simple enums against a corresponding normal Enum.
     Standard library modules updated to use ‘simple_enum’.

   - bpo-43764(49): Fix an issue where *note __match_args__: 1c75.
     generation could fail for some *note dataclasses: 33.

   - bpo-43752(50): Fix *note sqlite3: d4. regression for zero-sized
     blobs with converters, where ‘b""’ was returned instead of ‘None’.
     The regression was introduced by PR 24723.  Patch by Erlend E.
     Aasland.

   - bpo-43655(51): *note tkinter: f6. dialog windows are now recognized
     as dialogs by window managers on macOS and X Window.

   - bpo-43723(52): The following ‘threading’ methods are now deprecated
     and should be replaced:

        - ‘currentThread’ => *note threading.current_thread(): 35e.

        - ‘activeCount’ => *note threading.active_count(): 35f.

        - ‘Condition.notifyAll’ => *note
          threading.Condition.notify_all(): 359.

        - ‘Event.isSet’ => *note threading.Event.is_set(): 35a.

        - ‘Thread.setName’ => *note threading.Thread.name: 2a0.

        - ‘thread.getName’ => *note threading.Thread.name: 2a0.

        - ‘Thread.isDaemon’ => *note threading.Thread.daemon: 35c.

        - ‘Thread.setDaemon’ => *note threading.Thread.daemon: 35c.

     Patch by Jelle Zijlstra.

   - bpo-2135(53): Deprecate find_module() and find_loader()
     implementations in importlib and zipimport.

   - bpo-43534(54): *note turtle.textinput(): 1c7a. and *note
     turtle.numinput(): 1c7b. create now a transient window working on
     behalf of the canvas window.

   - bpo-43532(55): Add the ability to specify keyword-only fields to
     dataclasses.  These fields will become keyword-only arguments to
     the generated __init__.

   - bpo-43522(56): Fix problem with *note hostname_checks_common_name:
     d76.  OpenSSL does not copy hostflags from 'struct SSL_CTX' to
     'struct SSL'.

   - bpo-8978(57): Improve error message for *note tarfile.open(): 1077.
     when *note lzma: 8e. / *note bz2: 14. are unavailable.  Patch by
     Anthony Sottile.

   - bpo-42967(58): Allow *note bytes: 192. ‘separator’ argument in
     ‘urllib.parse.parse_qs’ and ‘urllib.parse.parse_qsl’ when parsing
     *note str: 169. query strings.  Previously, this raised a
     ‘TypeError’.

   - bpo-43296(59): Improve *note sqlite3: d4. error handling:
     ‘sqlite3_value_blob()’ errors that set ‘SQLITE_NOMEM’ now raise
     *note MemoryError: 179e.  Patch by Erlend E. Aasland.

   - bpo-43312(60): New functions *note
     sysconfig.get_preferred_scheme(): 89f. and *note
     sysconfig.get_default_scheme(): 1bb5. are added to query a platform
     for its preferred "user", "home", and "prefix" (default) scheme
     names.

   - bpo-43265(61): Improve *note sqlite3.Connection.backup(): d73.
     error handling.  The error message for non-existent target database
     names is now ‘unknown database <database name>’ instead of ‘SQL
     logic error’.  Patch by Erlend E. Aasland.

   - bpo-41282(62): Install schemes in ‘distutils.command.install’ are
     now loaded from *note sysconfig: e1.

   - bpo-41282(63): ‘distutils.sysconfig’ has been merged to *note
     sysconfig: e1.

   - bpo-43176(64): Fixed processing of a dataclass that inherits from a
     frozen dataclass with no fields.  It is now correctly detected as
     an error.

   - bpo-43080(65): *note pprint: b3. now has support for *note
     dataclasses.dataclass: 4e1.  Patch by Lewis Gaul.

   - bpo-39950(66): Add ‘pathlib.Path.hardlink_to()’ method that
     supersedes ‘link_to()’.  The new method has the same argument order
     as ‘symlink_to()’.

   - bpo-42904(67): *note typing.get_type_hints(): 8c0. now checks the
     local namespace of a class when evaluating PEP 563(68) annotations
     inside said class.

   - bpo-42269(69): Add ‘slots’ parameter to ‘dataclasses.dataclass’
     decorator to automatically generate ‘__slots__’ for class.  Patch
     provided by Yurii Karabas.

   - bpo-39529(70): Deprecated use of *note asyncio.get_event_loop():
     2f2. without running event loop.  Emit deprecation warning for
     *note asyncio: b. functions which implicitly create a *note Future:
     dc6. or *note Task: 1c7. objects if there is no running event loop
     and no explicit 'loop' argument is passed: *note ensure_future():
     e71, *note wrap_future(): 1c7c, *note gather(): 813, *note
     shield(): c65, *note as_completed(): 4c6. and constructors of *note
     Future: dc6, *note Task: 1c7, *note StreamReader: 1c7d,
     ‘StreamReaderProtocol’.

   - bpo-18369(71): Certificate and PrivateKey classes were added to the
     ssl module.  Certificates and keys can now be loaded from memory
     buffer, too.

   - bpo-41486(72): Use a new output buffer management code for *note
     bz2: 14. / *note lzma: 8e. / *note zlib: 139. modules, and add
     ‘.readall()’ function to ‘_compression.DecompressReader’ class.
     These bring some performance improvements.  Patch by Ma Lin.

   - bpo-31870(73): The *note ssl.get_server_certificate(): a3d.
     function now has a 'timeout' parameter.

   - bpo-41735(74): Fix thread locks in zlib module may go wrong in rare
     case.  Patch by Ma Lin.

   - bpo-36470(75): Fix dataclasses with ‘InitVar’s and *note replace():
     1a6a.  Patch by Claudiu Popa.

   - bpo-40849(76): Expose X509_V_FLAG_PARTIAL_CHAIN ssl flag

   - bpo-35114(77): *note ssl.RAND_status(): 1c7e. now returns a boolean
     value (as documented) instead of ‘1’ or ‘0’.

   - bpo-39906(78): *note pathlib.Path.stat(): a24. and *note chmod():
     a25. now accept a 'follow_symlinks' keyword-only argument for
     consistency with corresponding functions in the *note os: a5.
     module.

   - bpo-39899(79): *note os.path.expanduser(): c09. now refuses to
     guess Windows home directories if the basename of current user's
     home directory does not match their username.

     *note pathlib.Path.expanduser(): 1042. and *note home(): 1043. now
     consistently raise *note RuntimeError: 244. exception when a home
     directory cannot be resolved.  Previously a *note KeyError: 5e7.
     exception could be raised on Windows when the ‘"USERNAME"’
     environment variable was unset.

   - bpo-36076(80): Added SNI support to *note
     ssl.get_server_certificate(): a3d.

   - bpo-38490(81): Covariance, Pearson's correlation, and simple linear
     regression functionality was added to statistics module.  Patch by
     Tymoteusz Wołodźko.

   - bpo-33731(82): Provide a locale.localize() function, which converts
     a normalized number string into a locale format.

   - bpo-32745(83): Fix a regression in the handling of ctypes' *note
     ctypes.c_wchar_p: 1a58. type: embedded null characters would cause
     a *note ValueError: 2ec. to be raised.  Patch by Zackery Spytz.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=44015

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25478

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43733

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43979

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43993

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43957

   (7) https://bugs.python.org/issue?@action=redirect&bpo=42904

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43945

   (9) https://bugs.python.org/issue?@action=redirect&bpo=41139

   (10) https://bugs.python.org/issue?@action=redirect&bpo=43937

   (11) https://bugs.python.org/issue?@action=redirect&bpo=43930

   (12) https://bugs.python.org/issue?@action=redirect&bpo=43907

   (13) https://bugs.python.org/issue?@action=redirect&bpo=43926

   (14) https://bugs.python.org/issue?@action=redirect&bpo=43920

   (15) https://bugs.python.org/issue?@action=redirect&bpo=43607

   (16) https://bugs.python.org/issue?@action=redirect&bpo=43817

   (17) https://bugs.python.org/issue?@action=redirect&bpo=43284

   (18) https://bugs.python.org/issue?@action=redirect&bpo=42854

   (19) https://bugs.python.org/issue?@action=redirect&bpo=42333

   (20) https://bugs.python.org/issue?@action=redirect&bpo=43880

   (21) https://bugs.python.org/issue?@action=redirect&bpo=41559

   (22) https://peps.python.org/pep-0612/

   (23) https://bugs.python.org/issue?@action=redirect&bpo=43867

   (24) https://bugs.python.org/issue?@action=redirect&bpo=40443

   (25) https://bugs.python.org/issue?@action=redirect&bpo=43820

   (26) https://bugs.python.org/issue?@action=redirect&bpo=43787

   (27) https://bugs.python.org/issue?@action=redirect&bpo=43680

   (28) https://bugs.python.org/issue?@action=redirect&bpo=43680

   (29) https://bugs.python.org/issue?@action=redirect&bpo=41515

   (30) https://bugs.python.org/issue?@action=redirect&bpo=43776

   (31) https://bugs.python.org/issue?@action=redirect&bpo=42248

   (32) https://bugs.python.org/issue?@action=redirect&bpo=43744

   (33) https://bugs.python.org/issue?@action=redirect&bpo=43772

   (34) https://bugs.python.org/issue?@action=redirect&bpo=43764

   (35) https://bugs.python.org/issue?@action=redirect&bpo=43799

   (36) https://bugs.python.org/issue?@action=redirect&bpo=43478

   (37) https://bugs.python.org/issue?@action=redirect&bpo=43794

   (38) https://bugs.python.org/issue?@action=redirect&bpo=43785

   (39) https://bugs.python.org/issue?@action=redirect&bpo=43789

   (40) https://bugs.python.org/issue?@action=redirect&bpo=43788

   (41) https://bugs.python.org/issue?@action=redirect&bpo=43766

   (42) https://peps.python.org/pep-0647/

   (43) https://bugs.python.org/issue?@action=redirect&bpo=25264

   (44) https://bugs.python.org/issue?@action=redirect&bpo=43780

   (45) https://github.com/python/cpython/issues/47383

   (46) https://bugs.python.org/issue?@action=redirect&bpo=43731

   (47) https://bugs.python.org/issue?@action=redirect&bpo=43712

   (48) https://bugs.python.org/issue?@action=redirect&bpo=38659

   (49) https://bugs.python.org/issue?@action=redirect&bpo=43764

   (50) https://bugs.python.org/issue?@action=redirect&bpo=43752

   (51) https://bugs.python.org/issue?@action=redirect&bpo=43655

   (52) https://bugs.python.org/issue?@action=redirect&bpo=43723

   (53) https://bugs.python.org/issue?@action=redirect&bpo=2135

   (54) https://bugs.python.org/issue?@action=redirect&bpo=43534

   (55) https://bugs.python.org/issue?@action=redirect&bpo=43532

   (56) https://bugs.python.org/issue?@action=redirect&bpo=43522

   (57) https://bugs.python.org/issue?@action=redirect&bpo=8978

   (58) https://bugs.python.org/issue?@action=redirect&bpo=42967

   (59) https://bugs.python.org/issue?@action=redirect&bpo=43296

   (60) https://bugs.python.org/issue?@action=redirect&bpo=43312

   (61) https://bugs.python.org/issue?@action=redirect&bpo=43265

   (62) https://bugs.python.org/issue?@action=redirect&bpo=41282

   (63) https://bugs.python.org/issue?@action=redirect&bpo=41282

   (64) https://bugs.python.org/issue?@action=redirect&bpo=43176

   (65) https://bugs.python.org/issue?@action=redirect&bpo=43080

   (66) https://bugs.python.org/issue?@action=redirect&bpo=39950

   (67) https://bugs.python.org/issue?@action=redirect&bpo=42904

   (68) https://peps.python.org/pep-0563/

   (69) https://bugs.python.org/issue?@action=redirect&bpo=42269

   (70) https://bugs.python.org/issue?@action=redirect&bpo=39529

   (71) https://bugs.python.org/issue?@action=redirect&bpo=18369

   (72) https://bugs.python.org/issue?@action=redirect&bpo=41486

   (73) https://bugs.python.org/issue?@action=redirect&bpo=31870

   (74) https://bugs.python.org/issue?@action=redirect&bpo=41735

   (75) https://bugs.python.org/issue?@action=redirect&bpo=36470

   (76) https://bugs.python.org/issue?@action=redirect&bpo=40849

   (77) https://bugs.python.org/issue?@action=redirect&bpo=35114

   (78) https://bugs.python.org/issue?@action=redirect&bpo=39906

   (79) https://bugs.python.org/issue?@action=redirect&bpo=39899

   (80) https://bugs.python.org/issue?@action=redirect&bpo=36076

   (81) https://bugs.python.org/issue?@action=redirect&bpo=38490

   (82) https://bugs.python.org/issue?@action=redirect&bpo=33731

   (83) https://bugs.python.org/issue?@action=redirect&bpo=32745


File: python.info,  Node: ドキュメント<37>,  Next: テスト<36>,  Prev: ライブラリ<119>,  Up: Python 3 10 0 beta 1

1.24.43.8 ドキュメント
......................

   - bpo-43987(1): Add "Annotations Best Practices" document as a new
     HOWTO.

   - bpo-43977(2): Document the new *note Py_TPFLAGS_MAPPING: 1c58. and
     *note Py_TPFLAGS_SEQUENCE: 1c59. type flags.

   - bpo-43959(3): The documentation on the PyContextVar C-API was
     clarified.

   - bpo-43938(4): Update dataclasses documentation to express that
     FrozenInstanceError is derived from AttributeError.

   - bpo-43778(5): Fix the Sphinx glossary_search extension: create the
     _static/ sub-directory if it doesn't exist.

   - bpo-43755(6): Update documentation to reflect that unparenthesized
     lambda expressions can no longer be the expression part in an ‘if’
     clause in comprehensions and generator expressions since Python
     3.9.

   - bpo-43739(7): Fixing the example code in
     Doc/extending/extending.rst to declare and initialize the pmodule
     variable to be of the right type.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43987

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43977

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43959

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43938

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43778

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43755

   (7) https://bugs.python.org/issue?@action=redirect&bpo=43739


File: python.info,  Node: テスト<36>,  Next: ビルド<43>,  Prev: ドキュメント<37>,  Up: Python 3 10 0 beta 1

1.24.43.9 テスト
................

   - bpo-43961(1): Fix test_logging.test_namer_rotator_inheritance() on
     Windows: use *note os.replace(): 130a. rather than *note
     os.rename(): 1309.  Patch by Victor Stinner.

   - bpo-43842(2): Fix a race condition in the SMTP test of
     test_logging.  Don't close a file descriptor (socket) from a
     different thread while asyncore.loop() is polling the file
     descriptor.  Patch by Victor Stinner.

   - bpo-43843(3): ‘test.libregrtest’ now marks a test as ENV_CHANGED
     (altered the execution environment) if a thread raises an exception
     but does not catch it.  It sets a hook on *note
     threading.excepthook(): a4b.  Use ‘--fail-env-changed’ option to
     mark the test as failed.  Patch by Victor Stinner.

   - bpo-43811(4): Tests multiple OpenSSL versions on GitHub Actions.
     Use ccache to speed up testing.

   - bpo-43791(5): OpenSSL 3.0.0: Disable testing of legacy protocols
     TLS 1.0 and 1.1.  Tests are failing with
     TLSV1_ALERT_INTERNAL_ERROR.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43961

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43842

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43843

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43811

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43791


File: python.info,  Node: ビルド<43>,  Next: Windows<38>,  Prev: テスト<36>,  Up: Python 3 10 0 beta 1

1.24.43.10 ビルド
.................

   - bpo-43567(1): Improved generated code refresh
     (AST/tokens/opcodes/keywords) on Windows.

   - bpo-43669(2): Implement PEP 644(3).  Python now requires OpenSSL
     1.1.1 or newer.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43567

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43669

   (3) https://peps.python.org/pep-0644/


File: python.info,  Node: Windows<38>,  Next: macOS<28>,  Prev: ビルド<43>,  Up: Python 3 10 0 beta 1

1.24.43.11 Windows
..................

   - bpo-35306(1): Adds additional arguments to *note os.startfile():
     1c83. function.

   - bpo-43538(2): Avoid raising errors from *note
     pathlib.Path.exists(): c0b. when passed an invalid filename.

   - bpo-38822(3): Fixed *note os.stat(): 26d. failing on inaccessible
     directories with a trailing slash, rather than falling back to the
     parent directory's metadata.  This implicitly affected *note
     os.path.exists(): c03. and *note os.path.isdir(): c05.

   - bpo-26227(4): Fixed decoding of host names in *note
     socket.gethostbyaddr(): 1c84. and *note socket.gethostbyname_ex():
     1c85.

   - bpo-40432(5): Updated pegen regeneration script on Windows to find
     and use Python 3.8 or higher.  Prior to this, pegen regeneration
     already required 3.8 or higher, but the script may have used lower
     versions of Python.

   - bpo-43745(6): Actually updates Windows release to OpenSSL 1.1.1k.
     Earlier releases were mislabelled and actually included 1.1.1i
     again.

   - bpo-43652(7): Update Tcl and Tk to 8.6.11 in Windows installer.

   - bpo-43492(8): Upgrade Windows installer to use SQLite 3.35.5.

   - bpo-30555(9): Fix ‘WindowsConsoleIO’ errors in the presence of fd
     redirection.  Patch by Segev Finer.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35306

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43538

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38822

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26227

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40432

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43745

   (7) https://bugs.python.org/issue?@action=redirect&bpo=43652

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43492

   (9) https://bugs.python.org/issue?@action=redirect&bpo=30555


File: python.info,  Node: macOS<28>,  Next: IDLE<20>,  Prev: Windows<38>,  Up: Python 3 10 0 beta 1

1.24.43.12 macOS
................

   - bpo-42119(1): Fix check for macOS SDK paths when building Python.
     Narrow search to match contents of SDKs, namely only files in
     ‘/System/Library’, ‘/System/IOSSupport’, and ‘/usr’ other than
     ‘/usr/local’.  Previously, anything under ‘/System’ was assumed to
     be in an SDK which causes problems with the new file system layout
     in 10.15+ where user file systems may appear to be mounted under
     ‘/System’.  Paths in ‘/Library’ were also incorrectly treated as
     SDK locations.

   - bpo-43568(2): Drop support for MACOSX_DEPLOYMENT_TARGET < 10.3

   - bpo-44009(3): Provide "python3.x-intel64" executable to allow
     reliably forcing macOS universal2 framework builds to run under
     Rosetta 2 Intel-64 emulation on Apple Silicon Macs.  This can be
     useful for testing or when universal2 wheels are not yet available.

   - bpo-43851(4): Build SQLite with ‘SQLITE_OMIT_AUTOINIT’ on macOS.
     Patch by Erlend E. Aasland.

   - bpo-43492(5): Update macOS installer to use SQLite 3.35.4.

   - bpo-42235(6): ‘Mac/BuildScript/build-installer.py’ will now use
     "-enable-optimizations" and ‘--with-lto’ when building on macOS
     10.15 or later.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42119

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43568

   (3) https://bugs.python.org/issue?@action=redirect&bpo=44009

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43851

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43492

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42235


File: python.info,  Node: IDLE<20>,  Next: C API<38>,  Prev: macOS<28>,  Up: Python 3 10 0 beta 1

1.24.43.13 IDLE
...............

   - bpo-37903(1): Add mouse actions to the shell sidebar.  Left click
     and optional drag selects one or more lines, as with the editor
     line number sidebar.  Right click after selecting raises a context
     menu with 'copy with prompts'.  This zips together prompts from the
     sidebar with lines from the selected text.

   - bpo-43981(2): Fix reference leak in test_sidebar and test_squeezer.
     Patches by Terry Jan Reedy and Pablo Galindo

   - bpo-37892(3): Indent IDLE Shell input with spaces instead of tabs

   - bpo-43655(4): IDLE dialog windows are now recognized as dialogs by
     window managers on macOS and X Window.

   - bpo-37903(5): IDLE's shell now shows prompts in a separate
     side-bar.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37903

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43981

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37892

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43655

   (5) https://bugs.python.org/issue?@action=redirect&bpo=37903


File: python.info,  Node: C API<38>,  Prev: IDLE<20>,  Up: Python 3 10 0 beta 1

1.24.43.14 C API
................

   - bpo-43916(1): Add a new *note Py_TPFLAGS_DISALLOW_INSTANTIATION:
     7a2. type flag to disallow creating type instances.  Patch by
     Victor Stinner.

   - bpo-43774(2): Remove the now unused ‘PYMALLOC_DEBUG’ macro.  Debug
     hooks on memory allocators are now installed by default if Python
     is built in debug mode (if ‘Py_DEBUG’ macro is defined).  Moreover,
     they can now be used on Python build in release mode (ex: using
     ‘PYTHONMALLOC=debug’ environment variable).

   - bpo-43962(3): _PyInterpreterState_IDIncref() now calls
     _PyInterpreterState_IDInitref() and always increments id_refcount.
     Previously, calling _xxsubinterpreters.get_current() could create
     an id_refcount inconsistency when a
     _xxsubinterpreters.InterpreterID object was deallocated.  Patch by
     Victor Stinner.

   - bpo-28254(4): Add new C-API functions to control the state of the
     garbage collector: *note PyGC_Enable(): aa4, *note PyGC_Disable():
     aa5, *note PyGC_IsEnabled(): aa6, corresponding to the functions in
     the *note gc: 64. module.

   - bpo-43908(5): Introduce *note Py_TPFLAGS_IMMUTABLETYPE: 3cf. flag
     for immutable type objects, and modify *note PyType_Ready(): 980.
     to set it for static types.  Patch by Erlend E. Aasland.

   - bpo-43795(6): *note PyMem_Calloc(): 10ad. is now available in the
     limited C API (‘Py_LIMITED_API’).

   - bpo-43868(7): *note PyOS_ReadlineFunctionPointer(): 7a5. is no
     longer exported by limited C API headers and by ‘python3.dll’ on
     Windows.  Like any function that takes ‘FILE*’, it is not part of
     the stable ABI.

   - bpo-43795(8): Stable ABI and limited API definitions are generated
     from a central manifest ( PEP 652(9)).

   - bpo-43753(10): Add the *note Py_Is(x, y): aa0. function to test if
     the 'x' object is the 'y' object, the same as ‘x is y’ in Python.
     Add also the *note Py_IsNone(): aa1, *note Py_IsTrue(): aa2, *note
     Py_IsFalse(): aa3. functions to test if an object is, respectively,
     the ‘None’ singleton, the ‘True’ singleton or the ‘False’
     singleton.  Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43916

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43774

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43962

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28254

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43908

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43795

   (7) https://bugs.python.org/issue?@action=redirect&bpo=43868

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43795

   (9) https://peps.python.org/pep-0652/

   (10) https://bugs.python.org/issue?@action=redirect&bpo=43753


File: python.info,  Node: Python 3 10 0 alpha 7,  Next: Python 3 10 0 alpha 6,  Prev: Python 3 10 0 beta 1,  Up: 変更履歴

1.24.44 Python 3.10.0 alpha 7
-----------------------------

'Release date: 2021-04-05'

* Menu:

* セキュリティ: セキュリティ<31>.
* Core and Builtins: Core and Builtins<117>.
* ライブラリ: ライブラリ<120>.
* Core and Builtins: Core and Builtins<118>.
* ライブラリ: ライブラリ<121>.
* ドキュメント: ドキュメント<38>.
* テスト: テスト<37>.
* ビルド: ビルド<44>.
* Windows: Windows<39>.
* IDLE: IDLE<21>.
* C API: C API<39>.


File: python.info,  Node: セキュリティ<31>,  Next: Core and Builtins<117>,  Up: Python 3 10 0 alpha 7

1.24.44.1 セキュリティ
......................

   - bpo-42988(1): CVE 2021-3426(2): Remove the ‘getfile’ feature of the
     *note pydoc: ba. module which could be abused to read arbitrary
     files on the disk (directory traversal vulnerability).  Moreover,
     even source code of Python modules can contain sensitive data like
     passwords.  Vulnerability reported by David Schwörer.

   - bpo-43285(3): *note ftplib: 62. no longer trusts the IP address
     value returned from the server in response to the PASV command by
     default.  This prevents a malicious FTP server from using the
     response to probe IPv4 address and port combinations on the client
     network.

     Code that requires the former vulnerable behavior may set a
     ‘trust_server_pasv_ipv4_address’ attribute on their *note
     ftplib.FTP: af6. instances to ‘True’ to re-enable it.

   - bpo-43439(4): Add audit hooks for *note gc.get_objects(): a04,
     *note gc.get_referrers(): a05. and *note gc.get_referents(): a06.
     Patch by Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42988

   (2) https://www.cve.org/CVERecord?id=CVE-2021-3426

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43285

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43439


File: python.info,  Node: Core and Builtins<117>,  Next: ライブラリ<120>,  Prev: セキュリティ<31>,  Up: Python 3 10 0 alpha 7

1.24.44.2 Core and Builtins
...........................

   - bpo-27129(1): Update CPython bytecode magic number.

   - bpo-43672(2): Raise ImportWarning when calling find_loader().

   - bpo-43660(3): Fix crash that happens when replacing ‘sys.stderr’
     with a callable that can remove the object while an exception is
     being printed.  Patch by Pablo Galindo.

   - bpo-27129(4): The bytecode interpreter uses instruction, rather
     byte, offsets internally.  This reduces the number of EXTENDED_ARG
     instructions needed and streamlines instruction dispatch a bit.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27129

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43672

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43660

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27129


File: python.info,  Node: ライブラリ<120>,  Next: Core and Builtins<118>,  Prev: Core and Builtins<117>,  Up: Python 3 10 0 alpha 7

1.24.44.3 ライブラリ
....................

   - bpo-40645(1): Fix reference leak in the ‘_hashopenssl’ extension.
     Patch by Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40645


File: python.info,  Node: Core and Builtins<118>,  Next: ライブラリ<121>,  Prev: ライブラリ<120>,  Up: Python 3 10 0 alpha 7

1.24.44.4 Core and Builtins
...........................

   - bpo-42134(1): Calls to find_module() by the import system now raise
     ImportWarning.

   - bpo-41064(2): Improve the syntax error for invalid usage of double
     starred elements ('**') in f-strings.  Patch by Pablo Galindo.

   - bpo-43575(3): Speed up calls to ‘map()’ by using the PEP 590(4)
     ‘vectorcall’ calling convention.  Patch by Donghee Na.

   - bpo-42137(5): The import system now prefers using ‘__spec__’ for
     ‘ModuleType.__repr__’ over ‘module_repr()’.

   - bpo-43452(6): Added micro-optimizations to ‘_PyType_Lookup()’ to
     improve cache lookup performance in the common case of cache hits.

   - bpo-43555(7): Report the column offset for *note SyntaxError: 18e.
     for invalid line continuation characters.  Patch by Pablo Galindo.

   - bpo-43517(8): Fix misdetection of circular imports when using ‘from
     pkg.mod import attr’, which caused false positives in non-trivial
     multi-threaded code.

   - bpo-43497(9): Emit SyntaxWarnings for assertions with tuple
     constants, this is a regression introduced in python3.7

   - bpo-39316(10): Tracing now has correct line numbers for attribute
     accesses when the attribute is on a different line from the object.
     Improves debugging and profiling for multi-line method chains.

   - bpo-35883(11): Python no longer fails at startup with a fatal error
     if a command line argument contains an invalid Unicode character.
     The *note Py_DecodeLocale(): dc0. function now escapes byte
     sequences which would be decoded as Unicode characters outside the
     [U+0000; U+10ffff] range.

   - bpo-43410(12): Fix a bug that was causing the parser to crash when
     emitting syntax errors when reading input from stdin.  Patch by
     Pablo Galindo

   - bpo-43406(13): Fix a possible race condition where
     ‘PyErr_CheckSignals’ tries to execute a non-Python signal handler.

   - bpo-42128(14): Add ‘__match_args__’ to *note struct sequence
     objects: 13d7.  Patch by Pablo Galindo.

   - bpo-43390(15): CPython now sets the ‘SA_ONSTACK’ flag in
     ‘PyOS_setsig’ for the VM's default signal handlers.  This is
     friendlier to other in-process code that an extension module or
     embedding use could pull in (such as Golang's cgo) where tiny
     thread stacks are the norm and ‘sigaltstack()’ has been used to
     provide for signal handlers.  This is a no-op change for the vast
     majority of processes that don't use sigaltstack.

   - bpo-43287(16): Speed up calls to ‘filter()’ by using the PEP
     590(17) ‘vectorcall’ calling convention.  Patch by Donghee Na.

   - bpo-37448(18): Add a radix tree based memory map to track in-use
     obmalloc arenas.  Use to replace the old implementation of
     address_in_range().  The radix tree approach makes it easy to
     increase pool sizes beyond the OS page size.  Boosting the pool and
     arena size allows obmalloc to handle a significantly higher
     percentage of requests from its ultra-fast paths.

     It also has the advantage of eliminating the memory unsanitary
     behavior of the previous address_in_range().  The old
     address_in_range() was marked with the annotations
     _Py_NO_SANITIZE_ADDRESS, _Py_NO_SANITIZE_THREAD, and
     _Py_NO_SANITIZE_MEMORY. Those annotations are no longer needed.

     To disable the radix tree map, set a preprocessor flag as follows:
     ‘-DWITH_PYMALLOC_RADIX_TREE=0’.

     Co-authored-by: Tim Peters <<tim.peters@gmail.com>>

   - bpo-29988(19): Only handle asynchronous exceptions and requests to
     drop the GIL when returning from a call or on the back edges of
     loops.  Makes sure that *note __exit__(): 1518. is always called in
     with statements, even for interrupts.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42134

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41064

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43575

   (4) https://peps.python.org/pep-0590/

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42137

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43452

   (7) https://bugs.python.org/issue?@action=redirect&bpo=43555

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43517

   (9) https://bugs.python.org/issue?@action=redirect&bpo=43497

   (10) https://bugs.python.org/issue?@action=redirect&bpo=39316

   (11) https://bugs.python.org/issue?@action=redirect&bpo=35883

   (12) https://bugs.python.org/issue?@action=redirect&bpo=43410

   (13) https://bugs.python.org/issue?@action=redirect&bpo=43406

   (14) https://bugs.python.org/issue?@action=redirect&bpo=42128

   (15) https://bugs.python.org/issue?@action=redirect&bpo=43390

   (16) https://bugs.python.org/issue?@action=redirect&bpo=43287

   (17) https://peps.python.org/pep-0590/

   (18) https://bugs.python.org/issue?@action=redirect&bpo=37448

   (19) https://bugs.python.org/issue?@action=redirect&bpo=29988


File: python.info,  Node: ライブラリ<121>,  Next: ドキュメント<38>,  Prev: Core and Builtins<118>,  Up: Python 3 10 0 alpha 7

1.24.44.5 ライブラリ
....................

   - bpo-43720(1): Document various stdlib deprecations in imp, pkgutil,
     and importlib.util for removal in Python 3.12.

   - bpo-43433(2): *note xmlrpc.client.ServerProxy: c4c. no longer
     ignores query and fragment in the URL of the server.

   - bpo-31956(3): The *note index(): 9e1. method of *note array.array:
     4be. now has optional 'start' and 'stop' parameters.

   - bpo-40066(4): Enum: adjust ‘repr()’ to show only enum and member
     name (not value, nor angle brackets) and ‘str()’ to show only
     member name.  Update and improve documentation to match.

   - bpo-42136(5): Deprecate all module_repr() methods found in
     importlib as their use is being phased out by Python 3.12.

   - bpo-35930(6): Raising an exception raised in a "future" instance
     will create reference cycles.

   - bpo-41369(7): Finish updating the vendored libmpdec to version
     2.5.1.  Patch by Stefan Krah.

   - bpo-43422(8): Revert the _decimal C API which was added in
     bpo-41324(9).

   - bpo-43577(10): Fix deadlock when using *note ssl.SSLContext: 357.
     debug callback with *note ssl.SSLContext.sni_callback(): 1c8f.

   - bpo-43571(11): It's now possible to create MPTCP sockets with
     IPPROTO_MPTCP

   - bpo-43542(12): ‘image/heic’ and ‘image/heif’ were added to *note
     mimetypes: 93.

   - bpo-40645(13): The *note hmac: 6e. module now uses OpenSSL's HMAC
     implementation when digestmod argument is a hash name or builtin
     hash function.

   - bpo-43510(14): Implement PEP 597(15): Add ‘EncodingWarning’
     warning, ‘-X warn_default_encoding’ option, *note
     PYTHONWARNDEFAULTENCODING: 9bf. environment variable and
     ‘encoding="locale"’ argument value.

   - bpo-43521(16): ‘ast.unparse’ can now render NaNs and empty sets.

   - bpo-42914(17): *note pprint.pprint(): a29. gains a new boolean
     ‘underscore_numbers’ optional argument to emit integers with
     thousands separated by an underscore character for improved
     readability (for example ‘1_000_000’ instead of ‘1000000’).

   - bpo-41361(18): *note rotate(): 1c90. calls are now slightly faster
     due to faster argument parsing.

   - bpo-43423(19): ‘subprocess.communicate()’ no longer raises an
     IndexError when there is an empty stdout or stderr IO buffer during
     a timeout on Windows.

   - bpo-27820(20): Fixed long-standing bug of smtplib.SMTP where doing
     AUTH LOGIN with initial_response_ok=False will fail.

     The cause is that SMTP.auth_login _always_ returns a password if
     provided with a challenge string, thus non-compliant with the
     standard for AUTH LOGIN.

     Also fixes bug with the test for smtpd.

   - bpo-43445(21): Add frozen modules to *note sys.stdlib_module_names:
     a42.  For example, add ‘"_frozen_importlib"’ and
     ‘"_frozen_importlib_external"’ names.

   - bpo-43245(22): Add keyword arguments support to
     ‘ChainMap.new_child()’.

   - bpo-29982(23): Add optional parameter 'ignore_cleanup_errors' to
     *note tempfile.TemporaryDirectory(): 144c. and allow multiple
     ‘cleanup()’ attempts.  Contributed by C.A.M. Gerlach.

   - bpo-43428(24): Include changes from importlib_metadata 3.7(25):

     Performance enhancements to distribution discovery.

     ‘entry_points’ only returns unique distributions.

     Introduces new ‘EntryPoints’ object for containing a set of entry
     points with convenience methods for selecting entry points by group
     or name.  ‘entry_points’ now returns this object if selection
     parameters are supplied but continues to return a dict object for
     compatibility.  Users are encouraged to rely on the selection
     interface.  The dict object result is likely to be deprecated in
     the future.

     Added packages_distributions function to return a mapping of
     packages to the distributions that provide them.

   - bpo-43332(26): Improves the networking efficiency of *note
     http.client: 73. when using a proxy via ‘set_tunnel()’.  Fewer
     small send calls are made during connection setup.

   - bpo-43420(27): Improve performance of *note fractions.Fraction:
     213. arithmetics for large components.  Contributed by Sergey B.
     Kirpichev.

   - bpo-43356(28): Allow passing a signal number to
     ‘_thread.interrupt_main()’.

   - bpo-43399(29): Fix ‘ElementTree.extend’ not working on iterators
     when using the Python implementation

   - bpo-43369(30): Improve *note sqlite3: d4. error handling: If
     ‘sqlite3_column_text()’ and ‘sqlite3_column_blob()’ set
     ‘SQLITE_NOMEM’, *note MemoryError: 179e. is now raised.  Patch by
     Erlend E. Aasland.

   - bpo-43368(31): Fix a regression introduced in PR 24562, where an
     empty bytestring was fetched as ‘None’ instead of ‘b''’ in *note
     sqlite3: d4.  Patch by Mariusz Felisiak.

   - bpo-41282(32): Fixed stacklevel of ‘DeprecationWarning’ emitted
     from ‘import distutils’.

   - bpo-42129(33): ‘importlib.resources’ now honors namespace packages,
     merging resources from each location in the namespace as introduced
     in ‘importlib_resources’ 3.2 and including incidental changes
     through 5.0.3.

   - bpo-43295(34): *note datetime.datetime.strptime(): 1950. now raises
     ‘ValueError’ instead of ‘IndexError’ when matching ‘'z'’ with the
     ‘%z’ format specifier.

   - bpo-43125(35): Return empty string if base64mime.body_encode
     receive empty bytes

   - bpo-43084(36): *note curses.window.enclose(): 1c91. returns now
     ‘True’ or ‘False’ (as was documented) instead of ‘1’ or ‘0’.

   - bpo-42994(37): Add MIME types for opus, AAC, 3gpp and 3gpp2

   - bpo-14678(38): Add an invalidate_caches() method to the
     zipimport.zipimporter class to support
     importlib.invalidate_caches().  Patch by Desmond Cheong.

   - bpo-42782(39): Fail fast in *note shutil.move(): c51. to avoid
     creating destination directories on failure.

   - bpo-40066(40): Enum's ‘repr()’ and ‘str()’ have changed: ‘repr()’
     is now 'EnumClass.MemberName' and ‘str()’ is 'MemberName'.
     Additionally, stdlib Enum's whose contents are available as module
     attributes, such as ‘RegexFlag.IGNORECASE’, have their ‘repr()’ as
     'module.name', e.g.  ‘re.IGNORECASE’.

   - bpo-26053(41): Fixed bug where the *note pdb: aa. interactive run
     command echoed the args from the shell command line, even if those
     have been overridden at the pdb prompt.

   - bpo-24160(42): Fixed bug where breakpoints did not persist across
     multiple debugger sessions in *note pdb: aa.'s interactive mode.

   - bpo-40701(43): When the *note tempfile.tempdir: 1c92. global
     variable is set to a value of type bytes, it is now handled
     consistently.  Previously exceptions could be raised from some
     tempfile APIs when the directory did not already exist in this
     situation.  Also ensures that the *note tempfile.gettempdir():
     1c93. and *note tempfile.gettempdirb(): 1c94. functions 'always'
     return ‘str’ and ‘bytes’ respectively.

   - bpo-39342(44): Expose ‘X509_V_FLAG_ALLOW_PROXY_CERTS’ as *note
     VERIFY_ALLOW_PROXY_CERTS: 1c95. to allow proxy certificate
     validation as explained in
     ‘https://docs.openssl.org/1.1.1/man7/proxy-certificates/’.

   - bpo-31861(45): Add builtins.aiter and builtins.anext.  Patch by
     Joshua Bronson (@jab), Daniel Pope (@lordmauve), and Justin Wang
     (@justin39).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43720

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43433

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31956

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40066

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42136

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35930

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41369

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43422

   (9) https://bugs.python.org/issue?@action=redirect&bpo=41324

   (10) https://bugs.python.org/issue?@action=redirect&bpo=43577

   (11) https://bugs.python.org/issue?@action=redirect&bpo=43571

   (12) https://bugs.python.org/issue?@action=redirect&bpo=43542

   (13) https://bugs.python.org/issue?@action=redirect&bpo=40645

   (14) https://bugs.python.org/issue?@action=redirect&bpo=43510

   (15) https://peps.python.org/pep-0597/

   (16) https://bugs.python.org/issue?@action=redirect&bpo=43521

   (17) https://bugs.python.org/issue?@action=redirect&bpo=42914

   (18) https://bugs.python.org/issue?@action=redirect&bpo=41361

   (19) https://bugs.python.org/issue?@action=redirect&bpo=43423

   (20) https://bugs.python.org/issue?@action=redirect&bpo=27820

   (21) https://bugs.python.org/issue?@action=redirect&bpo=43445

   (22) https://bugs.python.org/issue?@action=redirect&bpo=43245

   (23) https://bugs.python.org/issue?@action=redirect&bpo=29982

   (24) https://bugs.python.org/issue?@action=redirect&bpo=43428

   (25) 
https://importlib-metadata.readthedocs.io/en/latest/history.html#v3-7-0

   (26) https://bugs.python.org/issue?@action=redirect&bpo=43332

   (27) https://bugs.python.org/issue?@action=redirect&bpo=43420

   (28) https://bugs.python.org/issue?@action=redirect&bpo=43356

   (29) https://bugs.python.org/issue?@action=redirect&bpo=43399

   (30) https://bugs.python.org/issue?@action=redirect&bpo=43369

   (31) https://bugs.python.org/issue?@action=redirect&bpo=43368

   (32) https://bugs.python.org/issue?@action=redirect&bpo=41282

   (33) https://bugs.python.org/issue?@action=redirect&bpo=42129

   (34) https://bugs.python.org/issue?@action=redirect&bpo=43295

   (35) https://bugs.python.org/issue?@action=redirect&bpo=43125

   (36) https://bugs.python.org/issue?@action=redirect&bpo=43084

   (37) https://bugs.python.org/issue?@action=redirect&bpo=42994

   (38) https://bugs.python.org/issue?@action=redirect&bpo=14678

   (39) https://bugs.python.org/issue?@action=redirect&bpo=42782

   (40) https://bugs.python.org/issue?@action=redirect&bpo=40066

   (41) https://bugs.python.org/issue?@action=redirect&bpo=26053

   (42) https://bugs.python.org/issue?@action=redirect&bpo=24160

   (43) https://bugs.python.org/issue?@action=redirect&bpo=40701

   (44) https://bugs.python.org/issue?@action=redirect&bpo=39342

   (45) https://bugs.python.org/issue?@action=redirect&bpo=31861


File: python.info,  Node: ドキュメント<38>,  Next: テスト<37>,  Prev: ライブラリ<121>,  Up: Python 3 10 0 alpha 7

1.24.44.6 ドキュメント
......................

   - bpo-43199(1): Answer "Why is there no goto?"  in the Design and
     History FAQ.

   - bpo-43407(2): Clarified that a result from *note time.monotonic():
     55c, *note time.perf_counter(): c7a, *note time.process_time():
     c7b, or *note time.thread_time(): b30. can be compared with the
     result from any following call to the same function - not just the
     next immediate call.

   - bpo-43354(3): Fix type documentation for ‘Fault.faultCode’; the
     type has to be ‘int’ instead of ‘str’.

   - bpo-41933(4): Clarified wording of s * n in the Common Sequence
     Operations

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43199

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43407

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43354

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41933


File: python.info,  Node: テスト<37>,  Next: ビルド<44>,  Prev: ドキュメント<38>,  Up: Python 3 10 0 alpha 7

1.24.44.7 テスト
................

   - bpo-37945(1): Fix test_getsetlocale_issue1813() of test_locale:
     skip the test if ‘setlocale()’ fails.  Patch by Victor Stinner.

   - bpo-41561(2): Add workaround for Ubuntu's custom OpenSSL security
     level policy.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37945

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41561


File: python.info,  Node: ビルド<44>,  Next: Windows<39>,  Prev: テスト<37>,  Up: Python 3 10 0 alpha 7

1.24.44.8 ビルド
................

   - bpo-43179(1): Introduce and correctly use ALIGNOF_X in place of
     SIZEOF_X for alignment-related code in optimized string routines.
     Patch by Jessica Clarke.

   - bpo-43631(2): Update macOS, Windows, and CI to OpenSSL 1.1.1k.

   - bpo-43617(3): Improve configure.ac: Check for presence of
     autoconf-archive package and remove our copies of M4 macros.

   - bpo-43466(4): The ‘configure’ script now supports
     ‘--with-openssl-rpath’ option.

   - bpo-43372(5): Use ‘_freeze_importlib’ to generate code for the
     ‘__hello__’ module.  This approach ensures the code matches the
     interpreter version.  Previously, PYTHON_FOR_REGEN was used to
     generate the code, which might be wrong.  The marshal format for
     code objects has changed with bpo-42246(6), commit 877df851.
     Update the code and the expected code sizes in ctypes
     test_frozentable.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43179

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43631

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43617

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43466

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43372

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42246


File: python.info,  Node: Windows<39>,  Next: IDLE<21>,  Prev: ビルド<44>,  Up: Python 3 10 0 alpha 7

1.24.44.9 Windows
.................

   - bpo-43440(1): Build *note sqlite3: d4. with the ‘R*Tree’ module
     enabled.  Patch by Erlend E. Aasland.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43440


File: python.info,  Node: IDLE<21>,  Next: C API<39>,  Prev: Windows<39>,  Up: Python 3 10 0 alpha 7

1.24.44.10 IDLE
...............

   - bpo-42225(1): Document that IDLE can fail on Unix either from
     misconfigured IP masquerade rules or failure displaying complex
     colored (non-ascii) characters.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42225


File: python.info,  Node: C API<39>,  Prev: IDLE<21>,  Up: Python 3 10 0 alpha 7

1.24.44.11 C API
................

   - bpo-43688(1): The limited C API is now supported if Python is built
     in debug mode (if the ‘Py_DEBUG’ macro is defined).  In the limited
     C API, the *note Py_INCREF(): 78f. and *note Py_DECREF(): 790.
     functions are now implemented as opaque function calls, rather than
     accessing directly the *note PyObject.ob_refcnt: a9f. member, if
     Python is built in debug mode and the ‘Py_LIMITED_API’ macro
     targets Python 3.10 or newer.  It became possible to support the
     limited C API in debug mode because the *note PyObject: 5df.
     structure is the same in release and debug mode since Python 3.8
     (see bpo-36465(2)).

     The limited C API is still not supported in the ‘--with-trace-refs’
     special build (‘Py_TRACE_REFS’ macro).

     Patch by Victor Stinner.

   - bpo-43244(3): Remove the ‘pyarena.h’ header file with functions:

        * ‘PyArena_New()’

        * ‘PyArena_Free()’

        * ‘PyArena_Malloc()’

        * ‘PyArena_AddPyObject()’

     These functions were undocumented, excluded from the limited C API,
     and were only used internally by the compiler.  Patch by Victor
     Stinner.

   - bpo-43244(4): Remove the compiler and parser functions using
     ‘struct _mod’ type, because the public AST C API was removed:

        * ‘PyAST_Compile()’

        * ‘PyAST_CompileEx()’

        * ‘PyAST_CompileObject()’

        * ‘PyFuture_FromAST()’

        * ‘PyFuture_FromASTObject()’

        * ‘PyParser_ASTFromFile()’

        * ‘PyParser_ASTFromFileObject()’

        * ‘PyParser_ASTFromFilename()’

        * ‘PyParser_ASTFromString()’

        * ‘PyParser_ASTFromStringObject()’

     These functions were undocumented and excluded from the limited C
     API. Patch by Victor Stinner.

   - bpo-43244(5): Remove ‘ast.h’, ‘asdl.h’, and ‘Python-ast.h’ header
     files.  These functions were undocumented and excluded from the
     limited C API. Most names defined by these header files were not
     prefixed by ‘Py’ and so could create names conflicts.  For example,
     ‘Python-ast.h’ defined a ‘Yield’ macro which was conflict with the
     ‘Yield’ name used by the Windows ‘<winbase.h>’ header.  Use the
     Python *note ast: 9. module instead.  Patch by Victor Stinner.

   - bpo-43541(6): Fix a ‘PyEval_EvalCodeEx()’ regression: fix reference
     counting on builtins.  Patch by Victor Stinner.

   - bpo-43244(7): Remove the ‘symtable.h’ header file and the
     undocumented functions:

        * ‘PyST_GetScope()’

        * ‘PySymtable_Build()’

        * ‘PySymtable_BuildObject()’

        * ‘PySymtable_Free()’

        * ‘Py_SymtableString()’

        * ‘Py_SymtableStringObject()’

     The ‘Py_SymtableString()’ function was part the stable ABI by
     mistake but it could not be used, because the ‘symtable.h’ header
     file was excluded from the limited C API.

     The Python *note symtable: de. module remains available and is
     unchanged.

     Patch by Victor Stinner.

   - bpo-43244(8): Remove the ‘PyAST_Validate()’ function.  It is no
     longer possible to build a AST object (‘mod_ty’ type) with the
     public C API. The function was already excluded from the limited C
     API ( PEP 384(9)).  Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43688

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36465

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43244

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43244

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43244

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43541

   (7) https://bugs.python.org/issue?@action=redirect&bpo=43244

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43244

   (9) https://peps.python.org/pep-0384/


File: python.info,  Node: Python 3 10 0 alpha 6,  Next: Python 3 10 0 alpha 5,  Prev: Python 3 10 0 alpha 7,  Up: 変更履歴

1.24.45 Python 3.10.0 alpha 6
-----------------------------

'Release date: 2021-03-01'

* Menu:

* セキュリティ: セキュリティ<32>.
* Core and Builtins: Core and Builtins<119>.
* ライブラリ: ライブラリ<122>.
* Core and Builtins: Core and Builtins<120>.
* ライブラリ: ライブラリ<123>.
* Core and Builtins: Core and Builtins<121>.
* ライブラリ: ライブラリ<124>.
* ドキュメント: ドキュメント<39>.
* テスト: テスト<38>.
* ビルド: ビルド<45>.
* Windows: Windows<40>.
* macOS: macOS<29>.
* IDLE: IDLE<22>.
* C API: C API<40>.


File: python.info,  Node: セキュリティ<32>,  Next: Core and Builtins<119>,  Up: Python 3 10 0 alpha 6

1.24.45.1 セキュリティ
......................

   - bpo-42967(1): Fix web cache poisoning vulnerability by defaulting
     the query args separator to ‘&’, and allowing the user to choose a
     custom separator.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42967


File: python.info,  Node: Core and Builtins<119>,  Next: ライブラリ<122>,  Prev: セキュリティ<32>,  Up: Python 3 10 0 alpha 6

1.24.45.2 Core and Builtins
...........................

   - bpo-43321(1): Fix ‘SystemError’ raised when ‘PyArg_Parse*()’ is
     used with ‘#’ but without ‘PY_SSIZE_T_CLEAN’ defined.

   - bpo-36346(2): ‘PyArg_Parse*()’ functions now emits
     ‘DeprecationWarning’ when ‘u’ or ‘Z’ format is used.  See PEP
     623(3) for detail.

   - bpo-43277(4): Add a new *note PySet_CheckExact(): a9d. function to
     the C-API to check if an object is an instance of *note set: 184.
     but not an instance of a subtype.  Patch by Pablo Galindo.

   - bpo-42990(5): The *note types.FunctionType: a83. constructor now
     inherits the current builtins if the 'globals' dictionary has no
     ‘"__builtins__"’ key, rather than using ‘{"None": None}’ as
     builtins: same behavior as *note eval(): 4a3. and *note exec():
     4a2. functions.  Defining a function with ‘def function(...): ...’
     in Python is not affected, globals cannot be overridden with this
     syntax: it also inherits the current builtins.  Patch by Victor
     Stinner.

   - bpo-42990(6): Functions have a new ‘__builtins__’ attribute which
     is used to look for builtin symbols when a function is executed,
     instead of looking into ‘__globals__['__builtins__']’.  Patch by
     Mark Shannon and Victor Stinner.

   - bpo-43149(7): Improve the error message in the parser for exception
     groups without parentheses.  Patch by Pablo Galindo.

   - bpo-43121(8): Fixed an incorrect *note SyntaxError: 18e. message
     for missing comma in literals.  Patch by Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43321

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36346

   (3) https://peps.python.org/pep-0623/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43277

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42990

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42990

   (7) https://bugs.python.org/issue?@action=redirect&bpo=43149

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43121


File: python.info,  Node: ライブラリ<122>,  Next: Core and Builtins<120>,  Prev: Core and Builtins<119>,  Up: Python 3 10 0 alpha 6

1.24.45.3 ライブラリ
....................

   - bpo-42819(1): *note readline: bf.: Explicitly disable bracketed
     paste in the interactive interpreter, even if it's set in the
     inputrc, is enabled by default (eg GNU Readline 8.1), or a user
     calls ‘readline.read_init_file()’.  The Python REPL has not
     implemented bracketed paste support.  Also, bracketed mode writes
     the ‘"\x1b[?2004h"’ escape sequence into stdout which causes test
     failures in applications that don't support it.  It can still be
     explicitly enabled by calling ‘readline.parse_and_bind("set
     enable-bracketed-paste on")’.  Patch by Dustin Rodrigues.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42819


File: python.info,  Node: Core and Builtins<120>,  Next: ライブラリ<123>,  Prev: ライブラリ<122>,  Up: Python 3 10 0 alpha 6

1.24.45.4 Core and Builtins
...........................

   - bpo-42808(1): Simple calls to ‘type(object)’ are now faster due to
     the ‘vectorcall’ calling convention.  Patch by Dennis Sweeney.

   - bpo-42217(2): Make the compiler merges same co_code and
     co_linetable objects in a module like already did for co_consts.

   - bpo-41972(3): Substring search functions such as ‘str1 in str2’ and
     ‘str2.find(str1)’ now sometimes use the "Two-Way" string comparison
     algorithm to avoid quadratic behavior on long strings.

   - bpo-42128(4): Implement PEP 634(5) (structural pattern matching).
     Patch by Brandt Bucher.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42808

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42217

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41972

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42128

   (5) https://peps.python.org/pep-0634/


File: python.info,  Node: ライブラリ<123>,  Next: Core and Builtins<121>,  Prev: Core and Builtins<120>,  Up: Python 3 10 0 alpha 6

1.24.45.5 ライブラリ
....................

   - bpo-40692(1): In the *note concurrent.futures.ProcessPoolExecutor:
     1d6, validate that ‘multiprocess.synchronize()’ is available on a
     given platform and rely on that check in the *note
     concurrent.futures: 24. test suite so we can run tests that are
     unrelated to ‘ProcessPoolExecutor’ on those platforms.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40692


File: python.info,  Node: Core and Builtins<121>,  Next: ライブラリ<124>,  Prev: ライブラリ<123>,  Up: Python 3 10 0 alpha 6

1.24.45.6 Core and Builtins
...........................

   - bpo-38302(1): If *note object.__ipow__(): 9d3. returns *note
     NotImplemented: 1a2, the operator will correctly fall back to *note
     object.__pow__(): 9d4. and *note object.__rpow__(): 1a5. as
     expected.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38302


File: python.info,  Node: ライブラリ<124>,  Next: ドキュメント<39>,  Prev: Core and Builtins<121>,  Up: Python 3 10 0 alpha 6

1.24.45.7 ライブラリ
....................

   - bpo-43316(1): The ‘python -m gzip’ command line application now
     properly fails when detecting an unsupported extension.  It exits
     with a non-zero exit code and prints an error message to stderr.

   - bpo-43317(2): Set the chunk size for the ‘gzip’ module main
     function to io.DEFAULT_BUFFER_SIZE. This is slightly faster than
     the 1024 bytes constant that was used previously.

   - bpo-43146(3): Handle None in single-arg versions of *note
     print_exception(): a4f. and *note format_exception(): a4d.

   - bpo-43260(4): Fix TextIOWrapper can not flush internal buffer
     forever after very large text is written.

   - bpo-43258(5): Prevent needless allocation of *note sqlite3: d4.
     aggregate function context when no rows match an aggregate query.
     Patch by Erlend E. Aasland.

   - bpo-43251(6): Improve *note sqlite3: d4. error handling:
     ‘sqlite3_column_name()’ failures now result in *note MemoryError:
     179e.  Patch by Erlend E. Aasland.

   - bpo-40956(7): Fix segfault in *note sqlite3.Connection.backup():
     d73. if no argument was provided.  The regression was introduced by
     PR 23838.  Patch by Erlend E. Aasland.

   - bpo-43172(8): The readline module now passes its tests when built
     directly against libedit.  Existing irreconcilable API differences
     remain in *note readline.get_begidx(): 1ca4. and *note
     readline.get_endidx(): 1ca5. behavior based on libreadline vs
     libedit use.

   - bpo-43163(9): Fix a bug in *note codeop: 1d. that was causing it to
     not ask for more input when multi-line snippets have unclosed
     parentheses.  Patch by Pablo Galindo

   - bpo-43162(10): deprecate unsupported ability to access enum members
     as attributes of other enum members

   - bpo-43146(11): Fix recent regression in None argument handling in
     *note traceback: 104. module functions.

   - bpo-43102(12): The namedtuple __new__ method had its __builtins__
     set to None instead of an actual dictionary.  This created problems
     for introspection tools.

   - bpo-43106(13): Added *note O_EVTONLY: a1b, *note O_FSYNC: a1c,
     *note O_SYMLINK: a1d. and *note O_NOFOLLOW_ANY: a1e. for macOS.
     Patch by Donghee Na.

   - bpo-42960(14): Adds *note resource.RLIMIT_KQUEUES: 1ca6. constant
     from FreeBSD to the *note resource: c1. module.

   - bpo-42151(15): Make the pure Python implementation of *note
     xml.etree.ElementTree: 12b. behave the same as the C implementation
     (‘_elementree’) regarding default attribute values (by not setting
     ‘specified_attributes=1’).

   - bpo-29753(16): In ctypes, now packed bitfields are calculated
     properly and the first item of packed bitfields is now shrank
     correctly.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43316

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43317

   (3) https://bugs.python.org/issue?@action=redirect&bpo=43146

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43260

   (5) https://bugs.python.org/issue?@action=redirect&bpo=43258

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43251

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40956

   (8) https://bugs.python.org/issue?@action=redirect&bpo=43172

   (9) https://bugs.python.org/issue?@action=redirect&bpo=43163

   (10) https://bugs.python.org/issue?@action=redirect&bpo=43162

   (11) https://bugs.python.org/issue?@action=redirect&bpo=43146

   (12) https://bugs.python.org/issue?@action=redirect&bpo=43102

   (13) https://bugs.python.org/issue?@action=redirect&bpo=43106

   (14) https://bugs.python.org/issue?@action=redirect&bpo=42960

   (15) https://bugs.python.org/issue?@action=redirect&bpo=42151

   (16) https://bugs.python.org/issue?@action=redirect&bpo=29753


File: python.info,  Node: ドキュメント<39>,  Next: テスト<38>,  Prev: ライブラリ<124>,  Up: Python 3 10 0 alpha 6

1.24.45.8 ドキュメント
......................

   - bpo-27646(1): Clarify that 'yield from <expr>' works with any
     iterable, not just iterators.

   - bpo-36346(2): Update some deprecated unicode APIs which are
     documented as "will be removed in 4.0" to "3.12".  See PEP 623(3)
     for detail.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27646

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36346

   (3) https://peps.python.org/pep-0623/


File: python.info,  Node: テスト<38>,  Next: ビルド<45>,  Prev: ドキュメント<39>,  Up: Python 3 10 0 alpha 6

1.24.45.9 テスト
................

   - bpo-43288(1): Fix test_importlib to correctly skip Unicode file
     tests if the filesystem does not support them.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43288


File: python.info,  Node: ビルド<45>,  Next: Windows<40>,  Prev: テスト<38>,  Up: Python 3 10 0 alpha 6

1.24.45.10 ビルド
.................

   - bpo-43174(1): Windows build now uses ‘/utf-8’ compiler option.

   - bpo-43103(2): Add a new configure ‘--without-static-libpython’
     option to not build the ‘libpythonMAJOR.MINOR.a’ static library and
     not install the ‘python.o’ object file.

   - bpo-13501(3): The configure script can now use 'libedit' instead of
     'readline' with the command line option ‘--with-readline=editline’.

   - bpo-42603(4): Make configure script use pkg-config to detect the
     location of Tcl/Tk headers and libraries, used to build tkinter.

     On macOS, a Tcl/Tk configuration provided by pkg-config will be
     preferred over Tcl/Tk frameworks installed in
     ‘/{System/,}Library/Frameworks’.  If both exist and the latter is
     preferred, the appropriate ‘--with-tcltk-*’ configuration options
     need to be explicitly set.

   - bpo-39448(5): Add the "regen-frozen" makefile target that
     regenerates the code for the frozen ‘__hello__’ module.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43174

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43103

   (3) https://bugs.python.org/issue?@action=redirect&bpo=13501

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42603

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39448


File: python.info,  Node: Windows<40>,  Next: macOS<29>,  Prev: ビルド<45>,  Up: Python 3 10 0 alpha 6

1.24.45.11 Windows
..................

   - bpo-43155(1): *note PyCMethod_New(): 1cab. is now present in
     ‘python3.lib’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43155


File: python.info,  Node: macOS<29>,  Next: IDLE<22>,  Prev: Windows<40>,  Up: Python 3 10 0 alpha 6

1.24.45.12 macOS
................

   - bpo-41837(1): Update macOS installer build to use OpenSSL 1.1.1j.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41837


File: python.info,  Node: IDLE<22>,  Next: C API<40>,  Prev: macOS<29>,  Up: Python 3 10 0 alpha 6

1.24.45.13 IDLE
...............

   - bpo-43283(1): Document why printing to IDLE's Shell is often slower
     than printing to a system terminal and that it can be made faster
     by pre-formatting a single string before printing.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43283


File: python.info,  Node: C API<40>,  Prev: IDLE<22>,  Up: Python 3 10 0 alpha 6

1.24.45.14 C API
................

   - bpo-43278(1): Always put compiler and system information on the
     first line of the REPL welcome message.

   - bpo-43270(2): Remove the private ‘_PyErr_OCCURRED()’ macro: use the
     public *note PyErr_Occurred(): 1caf. function instead.

   - bpo-35134(3): Move odictobject.h, parser_interface.h,
     picklebufobject.h, pydebug.h, and pyfpe.h into the cpython/
     directory.  They must not be included directly, as they are already
     included by Python.h: *note Include Files: 987.

   - bpo-35134(4): Move pyarena.h, pyctype.h, and pytime.h into the
     cpython/ directory.  They must not be included directly, as they
     are already included by Python.h: *note Include Files: 987.

   - bpo-40170(5): *note PyExceptionClass_Name(): c5b. is now always
     declared as a function, in order to hide implementation details.
     The macro accessed *note PyTypeObject.tp_name: 1cb0. directly.
     Patch by Erlend E. Aasland.

   - bpo-43239(6): The *note PyCFunction_New(): 1cb1. function is now
     exported in the ABI when compiled with ‘-fvisibility=hidden’.

   - bpo-40170(7): *note PyIter_Check(): 1cb2. is now always declared as
     a function, in order to hide implementation details.  The macro
     accessed *note PyTypeObject.tp_iternext: 1709. directly.  Patch by
     Erlend E. Aasland.

   - bpo-40170(8): Convert *note PyDescr_IsData(): 1cb3. macro to a
     function to hide implementation details: The macro accessed *note
     PyTypeObject.tp_descr_set: 1cb4. directly.  Patch by Erlend E.
     Aasland.

   - bpo-43181(9): Convert *note PyObject_TypeCheck(): 1cb5. macro to a
     static inline function.  Patch by Erlend E. Aasland.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43278

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43270

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35134

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35134

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40170

   (6) https://bugs.python.org/issue?@action=redirect&bpo=43239

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40170

   (8) https://bugs.python.org/issue?@action=redirect&bpo=40170

   (9) https://bugs.python.org/issue?@action=redirect&bpo=43181


File: python.info,  Node: Python 3 10 0 alpha 5,  Next: Python 3 10 0 alpha 4,  Prev: Python 3 10 0 alpha 6,  Up: 変更履歴

1.24.46 Python 3.10.0 alpha 5
-----------------------------

'Release date: 2021-02-02'

* Menu:

* セキュリティ: セキュリティ<33>.
* Core and Builtins: Core and Builtins<122>.
* ライブラリ: ライブラリ<125>.
* Core and Builtins: Core and Builtins<123>.
* ライブラリ: ライブラリ<126>.
* ドキュメント: ドキュメント<40>.
* テスト: テスト<39>.
* ビルド: ビルド<46>.
* Windows: Windows<41>.
* macOS: macOS<30>.
* IDLE: IDLE<23>.
* C API: C API<41>.


File: python.info,  Node: セキュリティ<33>,  Next: Core and Builtins<122>,  Up: Python 3 10 0 alpha 5

1.24.46.1 セキュリティ
......................

   - bpo-42938(1): Avoid static buffers when computing the repr of *note
     ctypes.c_double: 1cb8. and *note ctypes.c_longdouble: 1cb9. values.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42938


File: python.info,  Node: Core and Builtins<122>,  Next: ライブラリ<125>,  Prev: セキュリティ<33>,  Up: Python 3 10 0 alpha 5

1.24.46.2 Core and Builtins
...........................

   - bpo-42990(1): Refactor the ‘PyEval_’ family of functions.

        * An new function ‘_PyEval_Vector’ is added to simplify calls to
          Python from C.

        * ‘_PyEval_EvalCodeWithName’ is removed

        * ‘PyEval_EvalCodeEx’ is retained as part of the API, but is not
          used internally

   - bpo-38631(2): Replace *note Py_FatalError(): b7a. calls in the
     compiler with regular *note SystemError: 795. exceptions.  Patch by
     Victor Stinner.

   - bpo-42997(3): Improve error message for missing ":" before blocks.
     Patch by Pablo Galindo.

   - bpo-43017(4): Improve error message in the parser when using
     un-parenthesised tuples in comprehensions.  Patch by Pablo Galindo.

   - bpo-42986(5): Fix parser crash when reporting syntax errors in
     f-string with newlines.  Patch by Pablo Galindo.

   - bpo-40176(6): Syntax errors for unterminated string literals now
     point to the start of the string instead of reporting EOF/EOL.

   - bpo-42927(7): The inline cache for ‘LOAD_ATTR’ now also optimizes
     access to attributes defined by ‘__slots__’.  This makes reading
     such attribute up to 30% faster.

   - bpo-42864(8): Improve error messages in the parser when parentheses
     are not closed.  Patch by Pablo Galindo.

   - bpo-42924(9): Fix ‘bytearray’ repetition incorrectly copying data
     from the start of the buffer, even if the data is offset within the
     buffer (e.g.  after reassigning a slice at the start of the
     ‘bytearray’ to a shorter byte string).

   - bpo-42882(10): Fix the ‘_PyUnicode_FromId()’ function
     (_Py_IDENTIFIER(var) API) when *note Py_Initialize(): 460. / *note
     Py_Finalize(): 45f. is called multiple times: preserve
     ‘_PyRuntime.unicode_ids.next_index’ value.

   - bpo-42827(11): Fix a crash when working out the error line of a
     *note SyntaxError: 18e. in some multi-line expressions.

   - bpo-42823(12): frame.f_lineno is correct even if frame.f_trace is
     set to True

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42990

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38631

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42997

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43017

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42986

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40176

   (7) https://bugs.python.org/issue?@action=redirect&bpo=42927

   (8) https://bugs.python.org/issue?@action=redirect&bpo=42864

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42924

   (10) https://bugs.python.org/issue?@action=redirect&bpo=42882

   (11) https://bugs.python.org/issue?@action=redirect&bpo=42827

   (12) https://bugs.python.org/issue?@action=redirect&bpo=42823


File: python.info,  Node: ライブラリ<125>,  Next: Core and Builtins<123>,  Prev: Core and Builtins<122>,  Up: Python 3 10 0 alpha 5

1.24.46.3 ライブラリ
....................

   - bpo-37324(1): Remove deprecated aliases to *note
     コレクション抽象基底クラス: a78. from the *note collections: 1e.
     module.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37324


File: python.info,  Node: Core and Builtins<123>,  Next: ライブラリ<126>,  Prev: ライブラリ<125>,  Up: Python 3 10 0 alpha 5

1.24.46.4 Core and Builtins
...........................

   - bpo-41994(1): Fixed possible leak in ‘import’ when ‘sys.modules’ is
     not a ‘dict’.

   - bpo-27772(2): In string formatting, preceding the 'width' field by
     ‘'0'’ no longer affects the default alignment for strings.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41994

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27772


File: python.info,  Node: ライブラリ<126>,  Next: ドキュメント<40>,  Prev: Core and Builtins<123>,  Up: Python 3 10 0 alpha 5

1.24.46.5 ライブラリ
....................

   - bpo-43108(1): Fixed a reference leak in the *note curses: 2f.
     module.  Patch by Pablo Galindo

   - bpo-43077(2): Update the bundled pip to 21.0.1 and setuptools to
     52.0.0.

   - bpo-41282(3): Deprecate ‘distutils’ in documentation and add
     warning on import.

   - bpo-43014(4): Improve performance of *note tokenize: 101. by
     20-30%.  Patch by Anthony Sottile.

   - bpo-42323(5): Fix *note math.nextafter(): 6c0. for NaN on AIX.

   - bpo-42955(6): Add *note sys.stdlib_module_names: a42, containing
     the list of the standard library module names.  Patch by Victor
     Stinner.

   - bpo-42944(7): Fix ‘random.Random.sample’ when ‘counts’ argument is
     not ‘None’.

   - bpo-42934(8): Use *note TracebackException: 563.'s new ‘compact’
     param in *note TestResult: 137f. to reduce time and memory consumed
     by traceback formatting.

   - bpo-42931(9): Add ‘randbytes()’ to ‘random.__all__’.

   - bpo-38250(10): [Enum] Flags consisting of a single bit are now
     considered canonical, and will be the only flags returned from
     listing and iterating over a Flag class or a Flag member.
     Multi-bit flags are considered aliases; they will be returned from
     lookups and operations that result in their value.  Iteration for
     both Flag and Flag members is in definition order.

   - bpo-42877(11): Added the ‘compact’ parameter to the constructor of
     *note traceback.TracebackException: 563. to reduce time and memory
     for use cases that only need to call ‘TracebackException.format()’
     and ‘TracebackException.format_exception_only()’.

   - bpo-42923(12): The *note Py_FatalError(): b7a. function and the
     *note faulthandler: 5c. module now dump the list of extension
     modules on a fatal error.

   - bpo-42848(13): Removed recursion from *note TracebackException:
     563. to allow it to handle long exception chains.

   - bpo-42901(14): [Enum] move member creation from ‘EnumMeta.__new__’
     to ‘_proto_member.__set_name__’, allowing members to be created and
     visible in ‘__init_subclass__’.

   - bpo-42780(15): Fix os.set_inheritable() for O_PATH file descriptors
     on Linux.

   - bpo-42866(16): Fix a reference leak in the ‘getcodec()’ function of
     CJK codecs.  Patch by Victor Stinner.

   - bpo-42846(17): Convert the 6 CJK codec extension modules
     (_codecs_cn, _codecs_hk, _codecs_iso2022, _codecs_jp, _codecs_kr
     and _codecs_tw) to the multiphase initialization API ( PEP
     489(18)).  Patch by Victor Stinner.

   - bpo-42851(19): remove __init_subclass__ support for Enum members

   - bpo-42834(20): Make internal caches of the ‘_json’ module
     compatible with subinterpreters.

   - bpo-41748(21): Fix HTMLParser parsing rules for element attributes
     containing commas with spaces.  Patch by Karl Dubost.

   - bpo-40810(22): Require SQLite 3.7.15 or newer.  Patch by Erlend E.
     Aasland.

   - bpo-1635741(23): Convert the _multibytecodec extension module (CJK
     codecs) to multi-phase initialization ( PEP 489(24)).  Patch by
     Erlend E. Aasland.

   - bpo-42802(25): The distutils ‘bdist_wininst’ command deprecated in
     Python 3.8 has been removed.  The distutils ‘bdist_wheel’ command
     is now recommended to distribute binary packages on Windows.

   - bpo-24464(26): The undocumented built-in function
     ‘sqlite3.enable_shared_cache’ is now deprecated, scheduled for
     removal in Python 3.12.  Its use is strongly discouraged by the
     SQLite3 documentation.  Patch by Erlend E. Aasland.

   - bpo-42384(27): Make pdb populate sys.path[0] exactly the same as
     regular python execution.

   - bpo-42383(28): Fix pdb: previously pdb would fail to restart the
     debugging target if it was specified using a relative path and the
     current directory changed.

   - bpo-42005(29): Fix CLI of *note cProfile: 2b. and *note profile:
     b4. to catch *note BrokenPipeError: 1267.

   - bpo-41604(30): Don't decrement the reference count of the previous
     user_ptr when set_panel_userptr fails.

   - bpo-41149(31): Allow executing callables that have a boolean value
     of ‘False’ when passed to ‘Threading.thread’ as the target.  Patch
     contributed by Barney Stratford.

   - bpo-38307(32): Add an 'end_lineno' attribute to the Class and
     Function objects that appear in the tree returned by pyclbr
     functions.  This and the existing 'lineno' attribute define the
     extent of class and def statements.  Patch by Aviral Srivastava.

   - bpo-39273(33): The ‘BUTTON5_*’ constants are now exposed in the
     *note curses: 2f. module if available.

   - bpo-33289(34): Correct call to *note tkinter.colorchooser: f7. to
     return RGB triplet of ints instead of floats.  Patch by Cheryl
     Sabella.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43108

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43077

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41282

   (4) https://bugs.python.org/issue?@action=redirect&bpo=43014

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42323

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42955

   (7) https://bugs.python.org/issue?@action=redirect&bpo=42944

   (8) https://bugs.python.org/issue?@action=redirect&bpo=42934

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42931

   (10) https://bugs.python.org/issue?@action=redirect&bpo=38250

   (11) https://bugs.python.org/issue?@action=redirect&bpo=42877

   (12) https://bugs.python.org/issue?@action=redirect&bpo=42923

   (13) https://bugs.python.org/issue?@action=redirect&bpo=42848

   (14) https://bugs.python.org/issue?@action=redirect&bpo=42901

   (15) https://bugs.python.org/issue?@action=redirect&bpo=42780

   (16) https://bugs.python.org/issue?@action=redirect&bpo=42866

   (17) https://bugs.python.org/issue?@action=redirect&bpo=42846

   (18) https://peps.python.org/pep-0489/

   (19) https://bugs.python.org/issue?@action=redirect&bpo=42851

   (20) https://bugs.python.org/issue?@action=redirect&bpo=42834

   (21) https://bugs.python.org/issue?@action=redirect&bpo=41748

   (22) https://bugs.python.org/issue?@action=redirect&bpo=40810

   (23) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (24) https://peps.python.org/pep-0489/

   (25) https://bugs.python.org/issue?@action=redirect&bpo=42802

   (26) https://bugs.python.org/issue?@action=redirect&bpo=24464

   (27) https://bugs.python.org/issue?@action=redirect&bpo=42384

   (28) https://bugs.python.org/issue?@action=redirect&bpo=42383

   (29) https://bugs.python.org/issue?@action=redirect&bpo=42005

   (30) https://bugs.python.org/issue?@action=redirect&bpo=41604

   (31) https://bugs.python.org/issue?@action=redirect&bpo=41149

   (32) https://bugs.python.org/issue?@action=redirect&bpo=38307

   (33) https://bugs.python.org/issue?@action=redirect&bpo=39273

   (34) https://bugs.python.org/issue?@action=redirect&bpo=33289


File: python.info,  Node: ドキュメント<40>,  Next: テスト<39>,  Prev: ライブラリ<126>,  Up: Python 3 10 0 alpha 5

1.24.46.6 ドキュメント
......................

   - bpo-40304(1): Fix doc for type(name, bases, dict).  Patch by Boris
     Verkhovskiy and Éric Araujo.

   - bpo-42811(2): Updated importlib.util.resolve_name() doc to use
     __spec__.parent instead of __package__.  (Thanks Yair Frid.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40304

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42811


File: python.info,  Node: テスト<39>,  Next: ビルド<46>,  Prev: ドキュメント<40>,  Up: Python 3 10 0 alpha 5

1.24.46.7 テスト
................

   - bpo-40823(1): Use ‘unittest.TestLoader().loadTestsFromTestCase()’
     instead of ‘unittest.makeSuite()’ in *note sqlite3: d4. tests.
     Patch by Erlend E. Aasland.

   - bpo-40810(2): In *note sqlite3: d4, fix ‘CheckTraceCallbackContent’
     for SQLite pre 3.7.15.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40823

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40810


File: python.info,  Node: ビルド<46>,  Next: Windows<41>,  Prev: テスト<39>,  Up: Python 3 10 0 alpha 5

1.24.46.8 ビルド
................

   - bpo-43031(1): Pass ‘--timeout=$(TESTTIMEOUT)’ option to the default
     profile task ‘./python -m test --pgo’ command.

   - bpo-36143(2): ‘make regen-all’ now also runs ‘regen-keyword’.
     Patch by Victor Stinner.

   - bpo-42874(3): Removed the grep -q and -E flags in the tzpath
     validation section of the configure script to better accommodate
     users of some platforms (specifically Solaris 10).

   - bpo-31904(4): Add library search path by wr-cc in
     add_cross_compiling_paths() for VxWorks.

   - bpo-42856(5): Add ‘--with-wheel-pkg-dir=PATH’ option to the
     ‘./configure’ script.  If specified, the *note ensurepip: 59.
     module looks for ‘setuptools’ and ‘pip’ wheel packages in this
     directory: if both are present, these wheel packages are used
     instead of ensurepip bundled wheel packages.

     Some Linux distribution packaging policies recommend against
     bundling dependencies.  For example, Fedora installs wheel packages
     in the ‘/usr/share/python-wheels/’ directory and don't install the
     ‘ensurepip._bundled’ package.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43031

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36143

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42874

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42856


File: python.info,  Node: Windows<41>,  Next: macOS<30>,  Prev: ビルド<46>,  Up: Python 3 10 0 alpha 5

1.24.46.9 Windows
.................

   - bpo-41837(1): Updated Windows installer to include OpenSSL 1.1.1i

   - bpo-42584(2): Upgrade Windows installer to use SQLite 3.34.0.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41837

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42584


File: python.info,  Node: macOS<30>,  Next: IDLE<23>,  Prev: Windows<41>,  Up: Python 3 10 0 alpha 5

1.24.46.10 macOS
................

   - bpo-42504(1): Ensure that the value of
     sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') is always a
     string, even in when the value is parsable as an integer.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42504


File: python.info,  Node: IDLE<23>,  Next: C API<41>,  Prev: macOS<30>,  Up: Python 3 10 0 alpha 5

1.24.46.11 IDLE
...............

   - bpo-43008(1): Make IDLE invoke *note sys.excepthook(): a0c. in
     normal, 2-process mode.  Patch by Ken Hilton.

   - bpo-33065(2): Fix problem debugging user classes with __repr__
     method.

   - bpo-23544(3): Disable Debug=>Stack Viewer when user code is running
     or Debugger is active, to prevent hang or crash.  Patch by Zackery
     Spytz.

   - bpo-32631(4): Finish zzdummy example extension module: make menu
     entries work; add docstrings and tests with 100% coverage.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=43008

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33065

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23544

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32631


File: python.info,  Node: C API<41>,  Prev: IDLE<23>,  Up: Python 3 10 0 alpha 5

1.24.46.12 C API
................

   - bpo-42979(1): When Python is built in debug mode (with C
     assertions), calling a type slot like ‘sq_length’ (‘__len__()’ in
     Python) now fails with a fatal error if the slot succeeded with an
     exception set, or failed with no exception set.  The error message
     contains the slot, the type name, and the current exception (if an
     exception is set).  Patch by Victor Stinner.

   - bpo-43030(2): Fixed a compiler warning in *note
     Py_UNICODE_ISSPACE(): 1cc5. on platforms with signed ‘wchar_t’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42979

   (2) https://bugs.python.org/issue?@action=redirect&bpo=43030


File: python.info,  Node: Python 3 10 0 alpha 4,  Next: Python 3 10 0 alpha 3,  Prev: Python 3 10 0 alpha 5,  Up: 変更履歴

1.24.47 Python 3.10.0 alpha 4
-----------------------------

'Release date: 2021-01-04'

* Menu:

* Core and Builtins: Core and Builtins<124>.
* ライブラリ: ライブラリ<127>.
* Core and Builtins: Core and Builtins<125>.
* ライブラリ: ライブラリ<128>.
* Core and Builtins: Core and Builtins<126>.
* ライブラリ: ライブラリ<129>.
* ドキュメント: ドキュメント<41>.
* テスト: テスト<40>.
* ビルド: ビルド<47>.
* macOS: macOS<31>.
* Tools/Demos: Tools/Demos<28>.
* C API: C API<42>.


File: python.info,  Node: Core and Builtins<124>,  Next: ライブラリ<127>,  Up: Python 3 10 0 alpha 4

1.24.47.1 Core and Builtins
...........................

   - bpo-42814(1): Fix undefined behavior in
     ‘Objects/genericaliasobject.c’.

   - bpo-42806(2): Fix the column offsets for f-strings *note ast: 9.
     nodes surrounded by parentheses and for nodes that spawn multiple
     lines.  Patch by Pablo Galindo.

   - bpo-40631(3): Fix regression where a single parenthesized starred
     expression was a valid assignment target.

   - bpo-27794(4): Improve the error message for failed writes/deletes
     to property objects.  When possible, the attribute name is now
     shown.  Patch provided by Yurii Karabas.

   - bpo-42745(5): Make the type attribute lookup cache per-interpreter.
     Patch by Victor Stinner.

   - bpo-42246(6): Jumps to jumps are not eliminated when it would break
     PEP 626.

   - bpo-42246(7): Make sure that the ‘f_lasti’ and ‘f_lineno’
     attributes of a frame are set correctly when an exception is raised
     or re-raised.  Required for PEP 626.

   - bpo-32381(8): The coding cookie (ex: ‘# coding: latin1’) is now
     ignored in the command passed to the *note -c: 1a8. command line
     option.  Patch by Victor Stinner.

   - bpo-30858(9): Improve error location in expressions that contain
     assignments.  Patch by Pablo Galindo and Lysandros Nikolaou.

   - bpo-42615(10): Remove jump commands made redundant by the deletion
     of unreachable bytecode blocks

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42814

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42806

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40631

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27794

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42745

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42246

   (7) https://bugs.python.org/issue?@action=redirect&bpo=42246

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32381

   (9) https://bugs.python.org/issue?@action=redirect&bpo=30858

   (10) https://bugs.python.org/issue?@action=redirect&bpo=42615


File: python.info,  Node: ライブラリ<127>,  Next: Core and Builtins<125>,  Prev: Core and Builtins<124>,  Up: Python 3 10 0 alpha 4

1.24.47.2 ライブラリ
....................

   - bpo-42639(1): Make the *note atexit: d. module state
     per-interpreter.  It is now safe have more than one *note atexit:
     d. module instance.  Patch by Donghee Na and Victor Stinner.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42639


File: python.info,  Node: Core and Builtins<125>,  Next: ライブラリ<128>,  Prev: ライブラリ<127>,  Up: Python 3 10 0 alpha 4

1.24.47.3 Core and Builtins
...........................

   - bpo-32381(1): Fix encoding name when running a ‘.pyc’ file on
     Windows: *note PyRun_SimpleFileExFlags(): 1cca. now uses the
     correct encoding to decode the filename.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32381


File: python.info,  Node: ライブラリ<128>,  Next: Core and Builtins<126>,  Prev: Core and Builtins<125>,  Up: Python 3 10 0 alpha 4

1.24.47.4 ライブラリ
....................

   - bpo-42195(1): The ‘__args__’ of the parameterized generics for
     *note typing.Callable: 9c8. and *note collections.abc.Callable:
     9eb. are now consistent.  The ‘__args__’ for *note
     collections.abc.Callable: 9eb. are now flattened while *note
     typing.Callable: 9c8.'s have not changed.  To allow this change,
     *note types.GenericAlias: 9ec. can now be subclassed and
     ‘collections.abc.Callable’'s ‘__class_getitem__’ will now return a
     subclass of ‘types.GenericAlias’.  Tests for typing were also
     updated to not subclass things like ‘Callable[..., T]’ as that is
     not a valid base class.  Finally, both ‘Callable’s no longer
     validate their ‘argtypes’, in ‘Callable[[argtypes], resulttype]’ to
     prepare for PEP 612(2).  Patch by Ken Jin.

   - bpo-40137(3): Convert functools module to use *note
     PyType_FromModuleAndSpec(): 773.

   - bpo-40077(4): Convert *note array: 8. to use heap types, and
     establish module state for these.

   - bpo-42008(5): Fix _random.Random() seeding.

   - bpo-1635741(6): Port the ‘pyexpat’ extension module to multi-phase
     initialization ( PEP 489(7)).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42195

   (2) https://peps.python.org/pep-0612/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40137

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40077

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42008

   (6) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (7) https://peps.python.org/pep-0489/


File: python.info,  Node: Core and Builtins<126>,  Next: ライブラリ<129>,  Prev: ライブラリ<128>,  Up: Python 3 10 0 alpha 4

1.24.47.5 Core and Builtins
...........................

   - bpo-40521(1): Make the Unicode dictionary of interned strings
     compatible with subinterpreters.  Patch by Victor Stinner.

   - bpo-39465(2): Make ‘_PyUnicode_FromId()’ function compatible with
     subinterpreters.  Each interpreter now has an array of identifier
     objects (interned strings decoded from UTF-8).  Patch by Victor
     Stinner.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40521

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39465


File: python.info,  Node: ライブラリ<129>,  Next: ドキュメント<41>,  Prev: Core and Builtins<126>,  Up: Python 3 10 0 alpha 4

1.24.47.6 ライブラリ
....................

   - bpo-42257(1): Handle empty string in variable executable in
     platform.libc_ver()

   - bpo-42772(2): randrange() now raises a TypeError when step is
     specified without a stop argument.  Formerly, it silently ignored
     the step argument.

   - bpo-42759(3): Fixed equality comparison of ‘tkinter.Variable’ and
     *note tkinter.font.Font: 1cce.  Objects which belong to different
     Tcl interpreters are now always different, even if they have the
     same name.

   - bpo-42756(4): Configure LMTP Unix-domain socket to use socket
     global default timeout when a timeout is not explicitly provided.

   - bpo-23328(5): Allow / character in username, password fields on
     _PROXY envars.

   - bpo-42740(6): *note typing.get_args(): 2ac. and *note
     typing.get_origin(): 2ab. now support PEP 604(7) union types and
     PEP 612(8) additions to ‘Callable’.

   - bpo-42655(9): *note subprocess: dc. 'extra_groups' is now correctly
     passed into setgroups() system call.

   - bpo-42727(10): ‘EnumMeta.__prepare__’ now accepts ‘**kwds’ to
     properly support ‘__init_subclass__’

   - bpo-38308(11): Add optional 'weights' to
     'statistics.harmonic_mean()'.

   - bpo-42721(12): When simple query dialogs (*note
     tkinter.simpledialog: fe.), message boxes (*note
     tkinter.messagebox: fc.) or color choose dialog (*note
     tkinter.colorchooser: f7.) are created without arguments 'master'
     and 'parent', and the default root window is not yet created, and
     ‘NoDefaultRoot()’ was not called, a new temporal hidden root window
     will be created automatically.  It will not be set as the default
     root window and will be destroyed right after closing the dialog
     window.  It will help to use these simple dialog windows in
     programs which do not need other GUI.

   - bpo-25246(13): Optimized *note collections.deque.remove(): 1ccf.

   - bpo-35728(14): Added a root parameter to *note
     tkinter.font.nametofont(): 1cd0.

   - bpo-15303(15): *note tkinter: f6. supports now widgets with boolean
     value False.

   - bpo-42681(16): Fixed range checks for color and pair numbers in
     *note curses: 2f.

   - bpo-42685(17): Improved placing of simple query windows in Tkinter
     (such as *note tkinter.simpledialog.askinteger(): 1cd1.).  They are
     now centered at the center of the parent window if it is specified
     and shown, otherwise at the center of the screen.

   - bpo-9694(18): Argparse help no longer uses the confusing phrase,
     "optional arguments".  It uses "options" instead.

   - bpo-1635741(19): Port the ‘_thread’ extension module to the
     multiphase initialization API ( PEP 489(20)) and convert its static
     types to heap types.

   - bpo-37961(21): Fix crash in ‘tracemalloc.Traceback.__repr__()’
     (regressed in Python 3.9).

   - bpo-42630(22): *note tkinter: f6. functions and constructors which
     need a default root window raise now *note RuntimeError: 244. with
     descriptive message instead of obscure *note AttributeError: 5f0.
     or *note NameError: 452. if it is not created yet or cannot be
     created automatically.

   - bpo-42639(23): ‘atexit._run_exitfuncs()’ now logs callback
     exceptions using *note sys.unraisablehook: 507, rather than logging
     them directly into *note sys.stderr: b33. and raise the last
     exception.

   - bpo-42644(24): ‘logging.disable’ will now validate the types and
     value of its parameter.  It also now accepts strings representing
     the levels (as does ‘logging.setLevel’) instead of only the
     numerical values.

   - bpo-42639(25): At Python exit, if a callback registered with *note
     atexit.register(): a7e. fails, its exception is now logged.
     Previously, only some exceptions were logged, and the last
     exception was always silently ignored.

   - bpo-36541(26): Fixed lib2to3.pgen2 to be able to parse PEP-570
     positional only argument syntax.

   - bpo-42382(27): In ‘importlib.metadata’: - ‘EntryPoint’ objects now
     expose a ‘.dist’ object referencing the ‘Distribution’ when
     constructed from a ‘Distribution’.  - Add support for package
     discovery under package normalization rules.  - The object returned
     by ‘metadata()’ now has a formally defined protocol called
     ‘PackageMetadata’ with declared support for the ‘.get_all()’
     method.  - Synced with importlib_metadata 3.3.

   - bpo-41877(28): A check is added against misspellings of autospect,
     auto_spec and set_spec being passed as arguments to patch,
     patch.object and create_autospec.

   - bpo-39717(29): [tarfile] update nested exception raising to use
     ‘from None’ or ‘from e’

   - bpo-41877(30): AttributeError for suspected misspellings of
     assertions on mocks are now pointing out that the cause are
     misspelled assertions and also what to do if the misspelling is
     actually an intended attribute name.  The unittest.mock document is
     also updated to reflect the current set of recognised misspellings.

   - bpo-41559(31): Implemented PEP 612(32): added ‘ParamSpec’ and
     ‘Concatenate’ to *note typing: 10a.  Patch by Ken Jin.

   - bpo-42385(33): StrEnum: fix _generate_next_value_ to return a str

   - bpo-31904(34): Define THREAD_STACK_SIZE for VxWorks.

   - bpo-34750(35): [Enum] ‘_EnumDict.update()’ is now supported.

   - bpo-42517(36): Enum: private names do not become members / do not
     generate errors - they remain normal attributes

   - bpo-42678(37): ‘Enum’: call ‘__init_subclass__’ after members have
     been added

   - bpo-28964(38): *note ast.literal_eval(): e12. adds line number
     information (if available) in error message for malformed nodes.

   - bpo-42470(39): *note random.sample(): 94d. no longer warns on a
     sequence which is also a set.

   - bpo-31904(40): ‘posixpath.expanduser()’ returns the input 'path'
     unchanged if user home directory is None on VxWorks.

   - bpo-42388(41): Fix subprocess.check_output(..., input=None)
     behavior when text=True to be consistent with that of the
     documentation and universal_newlines=True.

   - bpo-34463(42): Fixed discrepancy between *note traceback: 104. and
     the interpreter in formatting of SyntaxError with lineno not set
     (*note traceback: 104. was changed to match interpreter).

   - bpo-42393(43): Raise *note OverflowError: a81. instead of silent
     truncation in *note socket.ntohs(): a80. and *note socket.htons():
     a7f.  Silent truncation was deprecated in Python 3.7.  Patch by
     Erlend E. Aasland

   - bpo-42222(44): Harmonized *note random.randrange(): a6b. argument
     handling to match *note range(): b3d.

        * The integer test and conversion in ‘randrange()’ now uses
          *note operator.index(): 1cd2.

        * Non-integer arguments to ‘randrange()’ are deprecated.

        * The ‘ValueError’ is deprecated in favor of a ‘TypeError’.

        * It now runs a little faster than before.

     (Contributed by Raymond Hettinger and Serhiy Storchaka.)

   - bpo-42163(45): Restore compatibility for ‘uname_result’ around
     deepcopy and _replace.

   - bpo-42090(46): ‘zipfile.Path.joinpath’ now accepts arbitrary
     arguments, same as ‘pathlib.Path.joinpath’.

   - bpo-1635741(47): Port the _csv module to the multi-phase
     initialization API ( PEP 489(48)).

   - bpo-42059(49): *note typing.TypedDict: 332. types created using the
     alternative call-style syntax now correctly respect the ‘total’
     keyword argument when setting their ‘__required_keys__’ and
     ‘__optional_keys__’ class attributes.

   - bpo-41960(50): Add ‘globalns’ and ‘localns’ parameters to the *note
     inspect.signature(): 22f. and *note
     inspect.Signature.from_callable(): 942.

   - bpo-41907(51): fix ‘format()’ behavior for ‘IntFlag’

   - bpo-41891(52): Ensure asyncio.wait_for waits for task completion

   - bpo-24792(53): Fixed bug where ‘zipimporter’ sometimes reports an
     incorrect cause of import errors.

   - bpo-31904(54): Fix site and sysconfig modules for VxWorks RTOS
     which has no home directories.

   - bpo-41462(55): Add *note os.set_blocking(): 103a. support for
     VxWorks RTOS.

   - bpo-40219(56): Lowered ‘tkinter.ttk.LabeledScale’ dummy widget to
     prevent hiding part of the content label.

   - bpo-37193(57): Fixed memory leak in ‘socketserver.ThreadingMixIn’
     introduced in Python 3.7.

   - bpo-39068(58): Fix initialization race condition in ‘a85encode()’
     and ‘b85encode()’ in *note base64: f.  Patch by Brandon Stansbury.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42257

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42772

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42759

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42756

   (5) https://bugs.python.org/issue?@action=redirect&bpo=23328

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42740

   (7) https://peps.python.org/pep-0604/

   (8) https://peps.python.org/pep-0612/

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42655

   (10) https://bugs.python.org/issue?@action=redirect&bpo=42727

   (11) https://bugs.python.org/issue?@action=redirect&bpo=38308

   (12) https://bugs.python.org/issue?@action=redirect&bpo=42721

   (13) https://bugs.python.org/issue?@action=redirect&bpo=25246

   (14) https://bugs.python.org/issue?@action=redirect&bpo=35728

   (15) https://bugs.python.org/issue?@action=redirect&bpo=15303

   (16) https://bugs.python.org/issue?@action=redirect&bpo=42681

   (17) https://bugs.python.org/issue?@action=redirect&bpo=42685

   (18) https://bugs.python.org/issue?@action=redirect&bpo=9694

   (19) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (20) https://peps.python.org/pep-0489/

   (21) https://bugs.python.org/issue?@action=redirect&bpo=37961

   (22) https://bugs.python.org/issue?@action=redirect&bpo=42630

   (23) https://bugs.python.org/issue?@action=redirect&bpo=42639

   (24) https://bugs.python.org/issue?@action=redirect&bpo=42644

   (25) https://bugs.python.org/issue?@action=redirect&bpo=42639

   (26) https://bugs.python.org/issue?@action=redirect&bpo=36541

   (27) https://bugs.python.org/issue?@action=redirect&bpo=42382

   (28) https://bugs.python.org/issue?@action=redirect&bpo=41877

   (29) https://bugs.python.org/issue?@action=redirect&bpo=39717

   (30) https://bugs.python.org/issue?@action=redirect&bpo=41877

   (31) https://bugs.python.org/issue?@action=redirect&bpo=41559

   (32) https://peps.python.org/pep-0612/

   (33) https://bugs.python.org/issue?@action=redirect&bpo=42385

   (34) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (35) https://bugs.python.org/issue?@action=redirect&bpo=34750

   (36) https://bugs.python.org/issue?@action=redirect&bpo=42517

   (37) https://bugs.python.org/issue?@action=redirect&bpo=42678

   (38) https://bugs.python.org/issue?@action=redirect&bpo=28964

   (39) https://bugs.python.org/issue?@action=redirect&bpo=42470

   (40) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (41) https://bugs.python.org/issue?@action=redirect&bpo=42388

   (42) https://bugs.python.org/issue?@action=redirect&bpo=34463

   (43) https://bugs.python.org/issue?@action=redirect&bpo=42393

   (44) https://bugs.python.org/issue?@action=redirect&bpo=42222

   (45) https://bugs.python.org/issue?@action=redirect&bpo=42163

   (46) https://bugs.python.org/issue?@action=redirect&bpo=42090

   (47) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (48) https://peps.python.org/pep-0489/

   (49) https://bugs.python.org/issue?@action=redirect&bpo=42059

   (50) https://bugs.python.org/issue?@action=redirect&bpo=41960

   (51) https://bugs.python.org/issue?@action=redirect&bpo=41907

   (52) https://bugs.python.org/issue?@action=redirect&bpo=41891

   (53) https://bugs.python.org/issue?@action=redirect&bpo=24792

   (54) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (55) https://bugs.python.org/issue?@action=redirect&bpo=41462

   (56) https://bugs.python.org/issue?@action=redirect&bpo=40219

   (57) https://bugs.python.org/issue?@action=redirect&bpo=37193

   (58) https://bugs.python.org/issue?@action=redirect&bpo=39068


File: python.info,  Node: ドキュメント<41>,  Next: テスト<40>,  Prev: ライブラリ<129>,  Up: Python 3 10 0 alpha 4

1.24.47.7 ドキュメント
......................

   - bpo-17140(1): Add documentation for the *note
     multiprocessing.pool.ThreadPool: 1cd4. class.

   - bpo-34398(2): Prominently feature listings from the glossary in
     documentation search results.  Patch by Ammar Askar.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17140

   (2) https://bugs.python.org/issue?@action=redirect&bpo=34398


File: python.info,  Node: テスト<40>,  Next: ビルド<47>,  Prev: ドキュメント<41>,  Up: Python 3 10 0 alpha 4

1.24.47.8 テスト
................

   - bpo-42794(1): Update test_nntplib to use official group name of
     news.aioe.org for testing.  Patch by Donghee Na.

   - bpo-31904(2): Skip some asyncio tests on VxWorks.

   - bpo-42641(3): Enhance ‘test_select.test_select()’: it now takes 500
     milliseconds rather than 10 seconds.  Use Python rather than a
     shell to make the test more portable.

   - bpo-31904(4): Skip some tests in _test_all_chown_common() on
     VxWorks.

   - bpo-42199(5): Fix bytecode helper assertNotInBytecode.

   - bpo-41443(6): Add more attribute checking in test_posix.py

   - bpo-31904(7): Disable os.popen and impacted tests on VxWorks

   - bpo-41439(8): Port test_ssl and test_uuid to VxWorks RTOS.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42794

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42641

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42199

   (6) https://bugs.python.org/issue?@action=redirect&bpo=41443

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (8) https://bugs.python.org/issue?@action=redirect&bpo=41439


File: python.info,  Node: ビルド<47>,  Next: macOS<31>,  Prev: テスト<40>,  Up: Python 3 10 0 alpha 4

1.24.47.9 ビルド
................

   - bpo-42692(1): Fix __builtin_available check on older compilers.
     Patch by Joshua Root.

   - bpo-27640(2): Added ‘--disable-test-modules’ option to the
     ‘configure’ script: don't build nor install test modules.  Patch by
     Xavier de Gaye, Thomas Petazzoni and Peixing Xin.

   - bpo-42604(3): Now all platforms use a value for the "EXT_SUFFIX"
     build variable derived from SOABI (for instance in freeBSD,
     "EXT_SUFFIX" is now ".cpython-310d.so" instead of ".so").
     Previously only Linux, Mac and VxWorks were using a value for
     "EXT_SUFFIX" that included "SOABI".

   - bpo-42598(4): Fix implicit function declarations in configure which
     could have resulted in incorrect configuration checks.  Patch
     contributed by Joshua Root.

   - bpo-31904(5): Enable libpython3.so for VxWorks.

   - bpo-29076(6): Add fish shell support to macOS installer.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42692

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27640

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42604

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42598

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (6) https://bugs.python.org/issue?@action=redirect&bpo=29076


File: python.info,  Node: macOS<31>,  Next: Tools/Demos<28>,  Prev: ビルド<47>,  Up: Python 3 10 0 alpha 4

1.24.47.10 macOS
................

   - bpo-42361(1): Update macOS installer build to use Tcl/Tk 8.6.11
     (rc2, expected to be final release).

   - bpo-41837(2): Update macOS installer build to use OpenSSL 1.1.1i.

   - bpo-42584(3): Update macOS installer to use SQLite 3.34.0.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42361

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41837

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42584


File: python.info,  Node: Tools/Demos<28>,  Next: C API<42>,  Prev: macOS<31>,  Up: Python 3 10 0 alpha 4

1.24.47.11 Tools/Demos
......................

   - bpo-42726(1): Fixed Python 3 compatibility issue with
     gdb/libpython.py handling of attribute dictionaries.

   - bpo-42613(2): Fix ‘freeze.py’ tool to use the prope config and
     library directories.  Patch by Victor Stinner.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42726

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42613


File: python.info,  Node: C API<42>,  Prev: Tools/Demos<28>,  Up: Python 3 10 0 alpha 4

1.24.47.12 C API
................

   - bpo-42591(1): Export the ‘Py_FrozenMain()’ function: fix a Python
     3.9.0 regression.  Python 3.9 uses ‘-fvisibility=hidden’ and the
     function was not exported explicitly and so not exported.

   - bpo-32381(2): Remove the private ‘_Py_fopen()’ function which is no
     longer needed.  Use ‘_Py_wfopen()’ or ‘_Py_fopen_obj()’ instead.
     Patch by Victor Stinner.

   - bpo-1635741(3): Port *note resource: c1. extension module to module
     state

   - bpo-42111(4): Update the ‘xxlimited’ module to be a better example
     of how to use the limited C API.

   - bpo-40052(5): Fix an alignment build warning/error in function
     ‘PyVectorcall_Function()’.  Patch by Andreas Schneider, Antoine
     Pitrou and Petr Viktorin.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42591

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32381

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42111

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40052


File: python.info,  Node: Python 3 10 0 alpha 3,  Next: Python 3 10 0 alpha 2,  Prev: Python 3 10 0 alpha 4,  Up: 変更履歴

1.24.48 Python 3.10.0 alpha 3
-----------------------------

'リリース日: 2020-12-07'

* Menu:

* セキュリティ: セキュリティ<34>.
* Core and Builtins: Core and Builtins<127>.
* ライブラリ: ライブラリ<130>.
* Core and Builtins: Core and Builtins<128>.
* ライブラリ: ライブラリ<131>.
* Core and Builtins: Core and Builtins<129>.
* ライブラリ: ライブラリ<132>.
* Core and Builtins: Core and Builtins<130>.
* ライブラリ: ライブラリ<133>.
* ドキュメント: ドキュメント<42>.
* テスト: テスト<41>.
* ビルド: ビルド<48>.
* Windows: Windows<42>.
* macOS: macOS<32>.
* IDLE: IDLE<24>.
* Tools/Demos: Tools/Demos<29>.
* C API: C API<43>.


File: python.info,  Node: セキュリティ<34>,  Next: Core and Builtins<127>,  Up: Python 3 10 0 alpha 3

1.24.48.1 セキュリティ
......................

   - bpo-40791(1): Add ‘volatile’ to the accumulator variable in
     ‘hmac.compare_digest’, making constant-time-defeating optimizations
     less likely.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40791


File: python.info,  Node: Core and Builtins<127>,  Next: ライブラリ<130>,  Prev: セキュリティ<34>,  Up: Python 3 10 0 alpha 3

1.24.48.2 Core and Builtins
...........................

   - bpo-42576(1): ‘types.GenericAlias’ will now raise a ‘TypeError’
     when attempting to initialize with a keyword argument.  Previously,
     this would cause the interpreter to crash if the interpreter was
     compiled with debug symbols.  This does not affect interpreters
     compiled for release.  Patch by Ken Jin.

   - bpo-42536(2): Several built-in and standard library types now
     ensure that their internal result tuples are always tracked by the
     *note garbage collector: 17d8.:

        - *note collections.OrderedDict.items(): 7f3.

        - *note dict.items(): 9d2.

        - *note enumerate(): 169a.

        - *note functools.reduce(): 21a.

        - *note itertools.combinations(): 1529.

        - *note itertools.combinations_with_replacement(): 1499.

        - *note itertools.permutations(): 1cdd.

        - *note itertools.product(): 152a.

        - *note itertools.zip_longest(): 14b6.

        - *note zip(): 1a0.

     Previously, they could have become untracked by a prior garbage
     collection.  Patch by Brandt Bucher.

   - bpo-42500(3): Improve handling of exceptions near recursion limit.
     Converts a number of Fatal Errors in RecursionErrors.

   - bpo-42246(4): PEP 626: After a return, the f_lineno attribute of a
     frame is always the last line executed.

   - bpo-42435(5): Speed up comparison of bytes objects with non-bytes
     objects when option *note -b: 7f9. is specified.  Speed up
     comparison of bytarray objects with non-buffer object.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42576

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42536

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42500

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42246

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42435


File: python.info,  Node: ライブラリ<130>,  Next: Core and Builtins<128>,  Prev: Core and Builtins<127>,  Up: Python 3 10 0 alpha 3

1.24.48.3 ライブラリ
....................

   - bpo-1635741(1): Port the ‘_warnings’ extension module to the
     multi-phase initialization API ( PEP 489(2)).  Patch by Victor
     Stinner.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (2) https://peps.python.org/pep-0489/


File: python.info,  Node: Core and Builtins<128>,  Next: ライブラリ<131>,  Prev: ライブラリ<130>,  Up: Python 3 10 0 alpha 3

1.24.48.4 Core and Builtins
...........................

   - bpo-41686(1): On Windows, the ‘SIGINT’ event,
     ‘_PyOS_SigintEvent()’, is now created even if Python is configured
     to not install signal handlers (if *note
     PyConfig.install_signal_handlers: abb. equals to 0, or
     ‘Py_InitializeEx(0)’).

   - bpo-42381(2): Allow assignment expressions in set literals and set
     comprehensions as per PEP 572.  Patch by Pablo Galindo.

   - bpo-42202(3): Change function parameters annotations internal
     representation to tuple of strings.  Patch provided by Yurii
     Karabas.

   - bpo-42374(4): Fix a regression introduced by the new parser, where
     an unparenthesized walrus operator was not allowed within generator
     expressions.

   - bpo-42316(5): Allow an unparenthesized walrus in subscript indexes.

   - bpo-42349(6): Make sure that the compiler front-end produces a
     well-formed control flow graph.  Be more aggressive in the compiler
     back-end, as it is now safe to do so.

   - bpo-42296(7): On Windows, fix a regression in signal handling which
     prevented to interrupt a program using CTRL+C. The signal handler
     can be run in a thread different than the Python thread, in which
     case the test deciding if the thread can handle signals is wrong.

   - bpo-42332(8): *note types.GenericAlias: 9ec. objects can now be the
     targets of weakrefs.

   - bpo-42282(9): Optimise constant subexpressions that appear as part
     of named expressions (previously the AST optimiser did not descend
     into named expressions).  Patch by Nick Coghlan.

   - bpo-42266(10): Fixed a bug with the LOAD_ATTR opcode cache that was
     not respecting monkey-patching a class-level attribute to make it a
     descriptor.  Patch by Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41686

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42381

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42202

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42374

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42316

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42349

   (7) https://bugs.python.org/issue?@action=redirect&bpo=42296

   (8) https://bugs.python.org/issue?@action=redirect&bpo=42332

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42282

   (10) https://bugs.python.org/issue?@action=redirect&bpo=42266


File: python.info,  Node: ライブラリ<131>,  Next: Core and Builtins<129>,  Prev: Core and Builtins<128>,  Up: Python 3 10 0 alpha 3

1.24.48.5 ライブラリ
....................

   - bpo-40077(1): Convert *note queue: bb. to use heap types.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40077


File: python.info,  Node: Core and Builtins<129>,  Next: ライブラリ<132>,  Prev: ライブラリ<131>,  Up: Python 3 10 0 alpha 3

1.24.48.6 Core and Builtins
...........................

   - bpo-42246(1): Improved accuracy of line tracing events and f_lineno
     attribute of Frame objects.  See PEP 626 for details.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42246


File: python.info,  Node: ライブラリ<132>,  Next: Core and Builtins<130>,  Prev: Core and Builtins<129>,  Up: Python 3 10 0 alpha 3

1.24.48.7 ライブラリ
....................

   - bpo-40077(1): Convert *note mmap: 94. to use heap types.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40077


File: python.info,  Node: Core and Builtins<130>,  Next: ライブラリ<133>,  Prev: ライブラリ<132>,  Up: Python 3 10 0 alpha 3

1.24.48.8 Core and Builtins
...........................

   - bpo-42233(1): Allow ‘GenericAlias’ objects to use *note union type
     expressions: 9c5.  This allows expressions like ‘list[int] |
     dict[float, str]’ where previously a ‘TypeError’ would have been
     thrown.  This also fixes union type expressions not de-duplicating
     ‘GenericAlias’ objects.  (Contributed by Ken Jin in bpo-42233(2).)

   - bpo-26131(3): The import system triggers a ‘ImportWarning’ when it
     falls back to using ‘load_module()’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42233

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42233

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26131


File: python.info,  Node: ライブラリ<133>,  Next: ドキュメント<42>,  Prev: Core and Builtins<130>,  Up: Python 3 10 0 alpha 3

1.24.48.9 ライブラリ
....................

   - bpo-5054(1): CGIHTTPRequestHandler.run_cgi() HTTP_ACCEPT improperly
     parsed.  Replace the special purpose getallmatchingheaders with
     generic get_all method and add relevant tests.

     Original Patch by Martin Panter.  Modified by Senthil Kumaran.

   - bpo-42562(2): Fix issue when dis failed to parse function that has
     no line numbers.  Patch provided by Yurii Karabas.

   - bpo-17735(3): ‘inspect.findsource()’ now raises *note OSError: 2c0.
     instead of *note IndexError: 174e. when ‘co_lineno’ of a code
     object is greater than the file length.  This can happen, for
     example, when a file is edited after it was imported.  PR by Irit
     Katriel.

   - bpo-42116(4): Fix handling of trailing comments by *note
     inspect.getsource(): 17c3.

   - bpo-42532(5): Remove unexpected call of ‘__bool__’ when passing a
     ‘spec_arg’ argument to a Mock.

   - bpo-38200(6): Added itertools.pairwise()

   - bpo-41818(7): Fix test_master_read() so that it succeeds on all
     platforms that either raise OSError or return b"" upon reading from
     master.

   - bpo-42487(8): ChainMap.__iter__ no longer calls __getitem__ on
     underlying maps

   - bpo-42482(9): *note TracebackException: 563. no longer holds a
     reference to the exception's traceback object.  Consequently,
     instances of TracebackException for equivalent but non-equal
     exceptions now compare as equal.

   - bpo-41818(10): Make test_openpty() avoid unexpected success due to
     number of rows and/or number of columns being == 0.

   - bpo-42392(11): Remove loop parameter from ‘asyncio.subprocess’ and
     ‘asyncio.tasks’ functions.  Patch provided by Yurii Karabas.

   - bpo-42392(12): Remove loop parameter from ‘asyncio.open_connection’
     and ‘asyncio.start_server’ functions.  Patch provided by Yurii
     Karabas.

   - bpo-28468(13): Add *note platform.freedesktop_os_release(): a27.
     function to parse freedesktop.org ‘os-release’ files.

   - bpo-42299(14): Removed the ‘formatter’ module, which was deprecated
     in Python 3.4.  It is somewhat obsolete, little used, and not
     tested.  It was originally scheduled to be removed in Python 3.6,
     but such removals were delayed until after Python 2.7 EOL. Existing
     users should copy whatever classes they use into their code.  Patch
     by Donghee Na and and Terry J. Reedy.

   - bpo-26131(15): Deprecate zipimport.zipimporter.load_module() in
     favour of exec_module().

   - bpo-41818(16): Updated tests for the pty library.  test_basic() has
     been changed to test_openpty(); this additionally checks if slave
     termios and slave winsize are being set properly by pty.openpty().
     In order to add support for FreeBSD, NetBSD, OpenBSD, and Darwin,
     this also adds test_master_read(), which demonstrates that
     pty.spawn() should not depend on an OSError to exit from its copy
     loop.

   - bpo-42392(17): Remove loop parameter from ‘__init__’ in all
     ‘asyncio.locks’ and ‘asyncio.Queue’ classes.  Patch provided by
     Yurii Karabas.

   - bpo-15450(18): Make *note filecmp.dircmp: 1142. respect
     subclassing.  Now the *note filecmp.dircmp.subdirs: 1ce5. behaves
     as expected when subclassing dircmp.

   - bpo-42413(19): The exception *note socket.timeout: a35. is now an
     alias of *note TimeoutError: a36.

   - bpo-31904(20): Support signal module on VxWorks.

   - bpo-42406(21): We fixed an issue in ‘pickle.whichmodule’ in which
     importing ‘multiprocessing’ could change the how pickle identifies
     which module an object belongs to, potentially breaking the
     unpickling of those objects.

   - bpo-42403(22): Simplify the *note importlib: 7b. external bootstrap
     code: ‘importlib._bootstrap_external’ now uses regular imports to
     import builtin modules.  When it is imported, the builtin *note
     __import__(): ad1. function is already fully working and so can be
     used to import builtin modules like *note sys: df.  Patch by Victor
     Stinner.

   - bpo-1635741(23): Convert _sre module types to heap types (PEP 384).
     Patch by Erlend E. Aasland.

   - bpo-42375(24): subprocess module update for DragonFlyBSD support.

   - bpo-41713(25): Port the ‘_signal’ extension module to the
     multi-phase initialization API ( PEP 489(26)).  Patch by Victor
     Stinner and Mohamed Koubaa.

   - bpo-37205(27): *note time.time(): 55d, *note time.perf_counter():
     c7a. and *note time.monotonic(): 55c. functions can no longer fail
     with a Python fatal error, instead raise a regular Python exception
     on failure.

   - bpo-42328(28): Fixed *note tkinter.ttk.Style.map(): 1ce6.  The
     function accepts now the representation of the default state as
     empty sequence (as returned by ‘Style.map()’).  The structure of
     the result is now the same on all platform and does not depend on
     the value of ‘wantobjects’.

   - bpo-42345(29): Fix various issues with ‘typing.Literal’ parameter
     handling (flatten, deduplicate, use type to cache key).  Patch
     provided by Yurii Karabas.

   - bpo-37205(30): *note time.perf_counter(): c7a. on Windows and *note
     time.monotonic(): 55c. on macOS are now system-wide.  Previously,
     they used an offset computed at startup to reduce the precision
     loss caused by the float type.  Use *note time.perf_counter_ns():
     cde. and *note time.monotonic_ns(): cdd. added in Python 3.7 to
     avoid this precision loss.

   - bpo-42318(31): Fixed support of non-BMP characters in *note
     tkinter: f6. on macOS.

   - bpo-42350(32): Fix the *note threading.Thread: 176. class at fork:
     do nothing if the thread is already stopped (ex: fork called at
     Python exit).  Previously, an error was logged in the child
     process.

   - bpo-42333(33): Port _ssl extension module to heap types.

   - bpo-42014(34): The ‘onerror’ callback from ‘shutil.rmtree’ now
     receives correct function when ‘os.open’ fails.

   - bpo-42237(35): Fix ‘os.sendfile()’ on illumos.

   - bpo-42308(36): Add *note threading.__excepthook__: a4a. to allow
     retrieving the original value of *note threading.excepthook(): a4b.
     in case it is set to a broken or a different value.  Patch by Mario
     Corchero.

   - bpo-42131(37): Implement PEP 451/spec methods on
     zipimport.zipimporter: find_spec(), create_module(), and
     exec_module().

     This also allows for the documented deprecation of find_loader(),
     find_module(), and load_module().

   - bpo-41877(38): Mock objects which are not unsafe will now raise an
     AttributeError if an attribute with the prefix asert, aseert, or
     assrt is accessed, in addition to this already happening for the
     prefixes assert or assret.

   - bpo-42264(39): ‘sqlite3.OptimizedUnicode’ has been undocumented and
     obsolete since Python 3.3, when it was made an alias to *note str:
     169.  It is now deprecated, scheduled for removal in Python 3.12.

   - bpo-42251(40): Added *note threading.gettrace(): a46. and *note
     threading.getprofile(): a47. to retrieve the functions set by *note
     threading.settrace(): a48. and *note threading.setprofile(): a49.
     respectively.  Patch by Mario Corchero.

   - bpo-42249(41): Fixed writing binary Plist files larger than 4 GiB.

   - bpo-42236(42): On Unix, the *note os.device_encoding(): 1c35.
     function now returns ‘'UTF-8'’ rather than the device encoding if
     the *note Python UTF-8 Mode: 866. is enabled.

   - bpo-41754(43): webbrowser: Ignore 'NotADirectoryError' when calling
     ‘xdg-settings’.

   - bpo-42183(44): Fix a stack overflow error for asyncio Task or
     Future repr().

     The overflow occurs under some circumstances when a Task or Future
     recursively returns itself.

   - bpo-42140(45): Improve asyncio.wait function to create the futures
     set just one time.

   - bpo-42133(46): Update various modules in the stdlib to fall back on
     ‘__spec__.loader’ when ‘__loader__’ isn't defined on a module.

   - bpo-26131(47): The ‘load_module()’ methods found in ‘importlib’ now
     trigger a ‘DeprecationWarning’.

   - bpo-39825(48): Windows: Change
     ‘sysconfig.get_config_var('EXT_SUFFIX')’ to the expected full
     ‘platform_tag.extension’ format.  Previously it was hard-coded to
     ‘.pyd’, now it is compatible with ‘distutils.sysconfig’ and will
     result in something like ‘.cp38-win_amd64.pyd’.  This brings
     windows into conformance with the other platforms.

   - bpo-26389(49): The *note traceback.format_exception(): a4d, *note
     traceback.format_exception_only(): a4e, and *note
     traceback.print_exception(): a4f. functions can now take an
     exception object as a positional-only argument.

   - bpo-41889(50): Enum: fix regression involving inheriting a multiply
     inherited enum

   - bpo-41861(51): Convert *note sqlite3: d4. to use heap types (PEP
     384).  Patch by Erlend E. Aasland.

   - bpo-40624(52): Added support for the XPath ‘!=’ operator in
     xml.etree

   - bpo-28850(53): Fix *note pprint.PrettyPrinter.format(): 1ce7.
     overrides being ignored for contents of small containers.  The
     ‘pprint._safe_repr()’ function was removed.

   - bpo-41625(54): Expose the ‘splice()’ as *note os.splice(): a1a. in
     the *note os: a5. module.  Patch by Pablo Galindo

   - bpo-34215(55): Clarify the error message for *note
     asyncio.IncompleteReadError: 1ce8. when ‘expected’ is ‘None’.

   - bpo-41543(56): Add async context manager support for
     contextlib.nullcontext.

   - bpo-21041(57): *note pathlib.PurePath.parents: a21. now supports
     negative indexing.  Patch contributed by Yaroslav Pankovych.

   - bpo-41332(58): Added missing connect_accepted_socket() method to
     ‘asyncio.AbstractEventLoop’.

   - bpo-12800(59): Extracting a symlink from a tarball should succeed
     and overwrite the symlink if it already exists.  The fix is to
     remove the existing file or symlink before extraction.  Based on
     patch by Chris AtLee, Jeffrey Kintscher, and Senthil Kumaran.

   - bpo-40968(60): *note urllib.request: 111. and *note http.client:
     73. now send ‘http/1.1’ ALPN extension during TLS handshake when no
     custom context is supplied.

   - bpo-41001(61): Add *note os.eventfd(): a19. to provide a low level
     interface for Linux's event notification file descriptor.

   - bpo-40816(62): Add AsyncContextDecorator to contextlib to support
     async context manager as a decorator.

   - bpo-40550(63): Fix time-of-check/time-of-action issue in
     subprocess.Popen.send_signal.

   - bpo-39411(64): Add an ‘is_async’ identifier to *note pyclbr: b9.'s
     ‘Function’ objects.  Patch by Batuhan Taskaya

   - bpo-35498(65): Add slice support to *note pathlib.PurePath.parents:
     a21.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5054

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42562

   (3) https://bugs.python.org/issue?@action=redirect&bpo=17735

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42116

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42532

   (6) https://bugs.python.org/issue?@action=redirect&bpo=38200

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41818

   (8) https://bugs.python.org/issue?@action=redirect&bpo=42487

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42482

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41818

   (11) https://bugs.python.org/issue?@action=redirect&bpo=42392

   (12) https://bugs.python.org/issue?@action=redirect&bpo=42392

   (13) https://bugs.python.org/issue?@action=redirect&bpo=28468

   (14) https://bugs.python.org/issue?@action=redirect&bpo=42299

   (15) https://bugs.python.org/issue?@action=redirect&bpo=26131

   (16) https://bugs.python.org/issue?@action=redirect&bpo=41818

   (17) https://bugs.python.org/issue?@action=redirect&bpo=42392

   (18) https://bugs.python.org/issue?@action=redirect&bpo=15450

   (19) https://bugs.python.org/issue?@action=redirect&bpo=42413

   (20) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (21) https://bugs.python.org/issue?@action=redirect&bpo=42406

   (22) https://bugs.python.org/issue?@action=redirect&bpo=42403

   (23) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (24) https://bugs.python.org/issue?@action=redirect&bpo=42375

   (25) https://bugs.python.org/issue?@action=redirect&bpo=41713

   (26) https://peps.python.org/pep-0489/

   (27) https://bugs.python.org/issue?@action=redirect&bpo=37205

   (28) https://bugs.python.org/issue?@action=redirect&bpo=42328

   (29) https://bugs.python.org/issue?@action=redirect&bpo=42345

   (30) https://bugs.python.org/issue?@action=redirect&bpo=37205

   (31) https://bugs.python.org/issue?@action=redirect&bpo=42318

   (32) https://bugs.python.org/issue?@action=redirect&bpo=42350

   (33) https://bugs.python.org/issue?@action=redirect&bpo=42333

   (34) https://bugs.python.org/issue?@action=redirect&bpo=42014

   (35) https://bugs.python.org/issue?@action=redirect&bpo=42237

   (36) https://bugs.python.org/issue?@action=redirect&bpo=42308

   (37) https://bugs.python.org/issue?@action=redirect&bpo=42131

   (38) https://bugs.python.org/issue?@action=redirect&bpo=41877

   (39) https://bugs.python.org/issue?@action=redirect&bpo=42264

   (40) https://bugs.python.org/issue?@action=redirect&bpo=42251

   (41) https://bugs.python.org/issue?@action=redirect&bpo=42249

   (42) https://bugs.python.org/issue?@action=redirect&bpo=42236

   (43) https://bugs.python.org/issue?@action=redirect&bpo=41754

   (44) https://bugs.python.org/issue?@action=redirect&bpo=42183

   (45) https://bugs.python.org/issue?@action=redirect&bpo=42140

   (46) https://bugs.python.org/issue?@action=redirect&bpo=42133

   (47) https://bugs.python.org/issue?@action=redirect&bpo=26131

   (48) https://bugs.python.org/issue?@action=redirect&bpo=39825

   (49) https://bugs.python.org/issue?@action=redirect&bpo=26389

   (50) https://bugs.python.org/issue?@action=redirect&bpo=41889

   (51) https://bugs.python.org/issue?@action=redirect&bpo=41861

   (52) https://bugs.python.org/issue?@action=redirect&bpo=40624

   (53) https://bugs.python.org/issue?@action=redirect&bpo=28850

   (54) https://bugs.python.org/issue?@action=redirect&bpo=41625

   (55) https://bugs.python.org/issue?@action=redirect&bpo=34215

   (56) https://bugs.python.org/issue?@action=redirect&bpo=41543

   (57) https://bugs.python.org/issue?@action=redirect&bpo=21041

   (58) https://bugs.python.org/issue?@action=redirect&bpo=41332

   (59) https://bugs.python.org/issue?@action=redirect&bpo=12800

   (60) https://bugs.python.org/issue?@action=redirect&bpo=40968

   (61) https://bugs.python.org/issue?@action=redirect&bpo=41001

   (62) https://bugs.python.org/issue?@action=redirect&bpo=40816

   (63) https://bugs.python.org/issue?@action=redirect&bpo=40550

   (64) https://bugs.python.org/issue?@action=redirect&bpo=39411

   (65) https://bugs.python.org/issue?@action=redirect&bpo=35498


File: python.info,  Node: ドキュメント<42>,  Next: テスト<41>,  Prev: ライブラリ<133>,  Up: Python 3 10 0 alpha 3

1.24.48.10 ドキュメント
.......................

   - bpo-42238(1): Tentative to deprecate ‘make suspicious’ by first
     removing it from the CI and documentation builds, but keeping it
     around for manual uses.

   - bpo-42153(2): Fix the URL for the IMAP protocol documents.

   - bpo-41028(3): Language and version switchers, previously maintained
     in every cpython branches, are now handled by docsbuild-script.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42238

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42153

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41028


File: python.info,  Node: テスト<41>,  Next: ビルド<48>,  Prev: ドキュメント<42>,  Up: Python 3 10 0 alpha 3

1.24.48.11 テスト
.................

   - bpo-41473(1): Re-enable test_gdb on gdb 9.2 and newer:
     ‘https://bugzilla.redhat.com/show_bug.cgi?id=1866884’ bug is fixed
     in gdb 10.1.

   - bpo-42553(2): Fix ‘test_asyncio.test_call_later()’ race condition:
     don't measure asyncio performance in the ‘call_later()’ unit test.
     The test failed randomly on the CI.

   - bpo-31904(3): Fix test_netrc on VxWorks: create temporary
     directories using temp_cwd().

   - bpo-31904(4): skip test_getaddrinfo_ipv6_scopeid_symbolic and
     test_getnameinfo_ipv6_scopeid_symbolic on VxWorks

   - bpo-31904(5): skip test_test of test_mailcap on VxWorks

   - bpo-31904(6): add shell requirement for test_pipes

   - bpo-31904(7): skip some tests related to fifo on VxWorks

   - bpo-31904(8): Fix test_doctest.py failures for VxWorks.

   - bpo-40754(9): Include ‘_testinternalcapi’ module in Windows
     installer for test suite

   - bpo-41561(10): test_ssl: skip test_min_max_version_mismatch when
     TLS 1.0 is not available

   - bpo-31904(11): Fix os module failures for VxWorks RTOS.

   - bpo-31904(12): Fix fifo test cases for VxWorks RTOS.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41473

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42553

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (8) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (9) https://bugs.python.org/issue?@action=redirect&bpo=40754

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41561

   (11) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31904


File: python.info,  Node: ビルド<48>,  Next: Windows<42>,  Prev: テスト<41>,  Up: Python 3 10 0 alpha 3

1.24.48.12 ビルド
.................

   - bpo-31904(1): remove libnet dependency from detect_socket() for
     VxWorks

   - bpo-42398(2): Fix a race condition in "make regen-all" when make
     -jN option is used to run jobs in parallel.  The clinic.py script
     now only use atomic write to write files.  Moveover, generated
     files are now left unchanged if the content does not change, to not
     change the file modification time.

   - bpo-41617(3): Fix building ‘pycore_bitutils.h’ internal header on
     old clang version without ‘__builtin_bswap16()’ (ex: Xcode 4.6.3 on
     Mac OS X 10.7).  Patch by Joshua Root and Victor Stinner.

   - bpo-38823(4): It is no longer possible to build the ‘_ctypes’
     extension module without ‘wchar_t’ type: remove ‘CTYPES_UNICODE’
     macro.  Anyway, the ‘wchar_t’ type is required to build Python.
     Patch by Victor Stinner.

   - bpo-42087(5): Support was removed for AIX 5.3 and below.  See
     bpo-40680(6).

   - bpo-40998(7): Addressed three compiler warnings found by undefined
     behavior sanitizer (ubsan).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42398

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41617

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38823

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42087

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40680

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40998


File: python.info,  Node: Windows<42>,  Next: macOS<32>,  Prev: ビルド<48>,  Up: Python 3 10 0 alpha 3

1.24.48.13 Windows
..................

   - bpo-42120(1): Remove macro definition of ‘copysign’ (to
     ‘_copysign’) in headers.

   - bpo-38506(2): The Windows launcher now properly handles Python 3.10
     when listing installed Python versions.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42120

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38506


File: python.info,  Node: macOS<32>,  Next: IDLE<24>,  Prev: Windows<42>,  Up: Python 3 10 0 alpha 3

1.24.48.14 macOS
................

   - bpo-42504(1): Fix build on macOS Big Sur when
     MACOSX_DEPLOYMENT_TARGET=11

   - bpo-41116(2): Ensure distutils.unixxcompiler.find_library_file can
     find system provided libraries on macOS 11.

   - bpo-41100(3): Add support for macOS 11 and Apple Silicon systems.

     It is now possible to build "Universal 2" binaries using
     "-enable-universalsdk -with-universal-archs=universal2".

     Binaries build on later macOS versions can be deployed back to
     older versions (tested up to macOS 10.9), when using the correct
     deployment target.  This is tested using Xcode 11 and later.

   - bpo-42232(4): Added Darwin specific madvise options to mmap module.

   - bpo-38443(5): The ‘--enable-universalsdk’ and
     ‘--with-universal-archs’ options for the configure script now check
     that the specified architectures can be used.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42504

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41116

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41100

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42232

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38443


File: python.info,  Node: IDLE<24>,  Next: Tools/Demos<29>,  Prev: macOS<32>,  Up: Python 3 10 0 alpha 3

1.24.48.15 IDLE
...............

   - bpo-42508(1): Keep IDLE running on macOS. Remove obsolete
     workaround that prevented running files with shortcuts when using
     new universal2 installers built on macOS 11.

   - bpo-42426(2): Fix reporting offset of the RE error in searchengine.

   - bpo-42415(3): Get docstrings for IDLE calltips more often by using
     inspect.getdoc.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42508

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42426

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42415


File: python.info,  Node: Tools/Demos<29>,  Next: C API<43>,  Prev: IDLE<24>,  Up: Python 3 10 0 alpha 3

1.24.48.16 Tools/Demos
......................

   - bpo-42212(1): The smelly.py script now also checks the Python
     dynamic library and extension modules, not only the Python static
     library.  Make also the script more verbose: explain what it does.

   - bpo-36310(2): Allow ‘Tools/i18n/pygettext.py’ to detect calls to
     ‘gettext’ in f-strings.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42212

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36310


File: python.info,  Node: C API<43>,  Prev: Tools/Demos<29>,  Up: Python 3 10 0 alpha 3

1.24.48.17 C API
................

   - bpo-42423(1): The *note PyType_FromSpecWithBases(): 79e. and *note
     PyType_FromModuleAndSpec(): 773. functions now accept a single
     class as the 'bases' argument.

   - bpo-1635741(2): Port *note select: c6. extension module to
     multiphase initialization ( PEP 489(3)).

   - bpo-1635741(4): Port _posixsubprocess extension module to
     multiphase initialization ( PEP 489(5)).

   - bpo-1635741(6): Port _posixshmem extension module to multiphase
     initialization ( PEP 489(7))

   - bpo-1635741(8): Port _struct extension module to multiphase
     initialization ( PEP 489(9))

   - bpo-1635741(10): Port ‘spwd’ extension module to multiphase
     initialization ( PEP 489(11))

   - bpo-1635741(12): Port *note gc: 64. extension module to multiphase
     initialization ( PEP 489(13))

   - bpo-1635741(14): Port _queue extension module to multiphase
     initialization ( PEP 489(15))

   - bpo-39573(16): Convert *note Py_TYPE(): 3c9. and *note Py_SIZE():
     985. back to macros to allow using them as an l-value.  Many third
     party C extension modules rely on the ability of using Py_TYPE()
     and Py_SIZE() to set an object type and size: ‘Py_TYPE(obj) =
     type;’ and ‘Py_SIZE(obj) = size;’.

   - bpo-1635741(17): Port *note symtable: de. extension module to
     multiphase initialization ( PEP 489(18))

   - bpo-1635741(19): Port *note grp: 6a. and *note pwd: b7. extension
     modules to multiphase initialization ( PEP 489(20))

   - bpo-1635741(21): Port _random extension module to multiphase
     initialization ( PEP 489(22))

   - bpo-1635741(23): Port _hashlib extension module to multiphase
     initialization ( PEP 489(24))

   - bpo-41713(25): Removed the undocumented ‘PyOS_InitInterrupts()’
     function.  Initializing Python already implicitly installs signal
     handlers: see *note PyConfig.install_signal_handlers: abb.  Patch
     by Victor Stinner.

   - bpo-40170(26): The ‘Py_TRASHCAN_BEGIN’ macro no longer accesses
     PyTypeObject attributes, but now can get the condition by calling
     the new private ‘_PyTrash_cond()’ function which hides
     implementation details.

   - bpo-42260(27): *note Py_GetPath(): 3e3, *note Py_GetPrefix(): 3e5,
     *note Py_GetExecPrefix(): 3e9, *note Py_GetProgramFullPath(): 3ec,
     *note Py_GetPythonHome(): 3ef. and *note Py_GetProgramName(): 3ee.
     functions now return ‘NULL’ if called before *note Py_Initialize():
     460. (before Python is initialized).  Use the new *note Python
     Initialization Configuration API: 646. to get the *note Python Path
     Configuration.: aaa.  Patch by Victor Stinner.

   - bpo-42260(28): The *note PyConfig_Read(): 993. function now only
     parses *note PyConfig.argv: 3f1. arguments once: *note
     PyConfig.parse_argv: 1cf1. is set to ‘2’ after arguments are
     parsed.  Since Python arguments are strippped from *note
     PyConfig.argv: 3f1, parsing arguments twice would parse the
     application options as Python options.

   - bpo-42262(29): Added *note Py_NewRef(): a9a. and *note
     Py_XNewRef(): a9b. functions to increment the reference count of an
     object and return the object.  Patch by Victor Stinner.

   - bpo-42260(30): When *note Py_Initialize(): 460. is called twice,
     the second call now updates more *note sys: df. attributes for the
     configuration, rather than only *note sys.argv: 147c.  Patch by
     Victor Stinner.

   - bpo-41832(31): The *note PyType_FromModuleAndSpec(): 773. function
     now accepts NULL ‘tp_doc’ slot.

   - bpo-1635741(32): Added *note PyModule_AddObjectRef(): 60a.
     function: similar to *note PyModule_AddObject(): 60b. but don't
     steal a reference to the value on success.  Patch by Victor
     Stinner.

   - bpo-42171(33): The *note METH_FASTCALL: 199e. calling convention is
     added to the limited API. The functions *note PyModule_AddType():
     b6c, *note PyType_FromModuleAndSpec(): 773, *note
     PyType_GetModule(): b66. and *note PyType_GetModuleState(): b67.
     are added to the limited API on Windows.

   - bpo-42085(34): Add dedicated entry to PyAsyncMethods for sending
     values

   - bpo-41073(35): *note PyType_GetSlot(): a9c. can now accept static
     types.

   - bpo-30459(36): *note PyList_SET_ITEM(): 62f, *note
     PyTuple_SET_ITEM(): 62e. and *note PyCell_SET(): aab. macros can no
     longer be used as l-value or r-value.  For example, ‘x =
     PyList_SET_ITEM(a, b, c)’ and ‘PyList_SET_ITEM(a, b, c) = x’ now
     fail with a compiler error.  It prevents bugs like ‘if
     (PyList_SET_ITEM (a, b, c) < 0) ...’ test.  Patch by Zackery Spytz
     and Victor Stinner.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42423

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (3) https://peps.python.org/pep-0489/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (5) https://peps.python.org/pep-0489/

   (6) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (7) https://peps.python.org/pep-0489/

   (8) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (9) https://peps.python.org/pep-0489/

   (10) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (11) https://peps.python.org/pep-0489/

   (12) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (13) https://peps.python.org/pep-0489/

   (14) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (15) https://peps.python.org/pep-0489/

   (16) https://bugs.python.org/issue?@action=redirect&bpo=39573

   (17) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (18) https://peps.python.org/pep-0489/

   (19) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (20) https://peps.python.org/pep-0489/

   (21) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (22) https://peps.python.org/pep-0489/

   (23) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (24) https://peps.python.org/pep-0489/

   (25) https://bugs.python.org/issue?@action=redirect&bpo=41713

   (26) https://bugs.python.org/issue?@action=redirect&bpo=40170

   (27) https://bugs.python.org/issue?@action=redirect&bpo=42260

   (28) https://bugs.python.org/issue?@action=redirect&bpo=42260

   (29) https://bugs.python.org/issue?@action=redirect&bpo=42262

   (30) https://bugs.python.org/issue?@action=redirect&bpo=42260

   (31) https://bugs.python.org/issue?@action=redirect&bpo=41832

   (32) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (33) https://bugs.python.org/issue?@action=redirect&bpo=42171

   (34) https://bugs.python.org/issue?@action=redirect&bpo=42085

   (35) https://bugs.python.org/issue?@action=redirect&bpo=41073

   (36) https://bugs.python.org/issue?@action=redirect&bpo=30459


File: python.info,  Node: Python 3 10 0 alpha 2,  Next: Python 3 10 0 alpha 1,  Prev: Python 3 10 0 alpha 3,  Up: 変更履歴

1.24.49 Python 3.10.0 alpha 2
-----------------------------

'Release date: 2020-11-03'

* Menu:

* セキュリティ: セキュリティ<35>.
* Core and Builtins: Core and Builtins<131>.
* ライブラリ: ライブラリ<134>.
* Core and Builtins: Core and Builtins<132>.
* ライブラリ: ライブラリ<135>.
* ドキュメント: ドキュメント<43>.
* テスト: テスト<42>.
* ビルド: ビルド<49>.
* Windows: Windows<43>.
* macOS: macOS<33>.
* IDLE: IDLE<25>.
* C API: C API<44>.


File: python.info,  Node: セキュリティ<35>,  Next: Core and Builtins<131>,  Up: Python 3 10 0 alpha 2

1.24.49.1 セキュリティ
......................

   - bpo-42103(1): Prevented potential DoS attack via CPU and RAM
     exhaustion when processing malformed Apple Property List files in
     binary format.

   - bpo-42051(2): The *note plistlib: b0. module no longer accepts
     entity declarations in XML plist files to avoid XML
     vulnerabilities.  This should not affect users as entity
     declarations are not used in regular plist files.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42103

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42051


File: python.info,  Node: Core and Builtins<131>,  Next: ライブラリ<134>,  Prev: セキュリティ<35>,  Up: Python 3 10 0 alpha 2

1.24.49.2 Core and Builtins
...........................

   - bpo-42236(1): If the ‘nl_langinfo(CODESET)’ function returns an
     empty string, Python now uses UTF-8 as the filesystem encoding.
     Patch by Victor Stinner.

   - bpo-42218(2): Fixed a bug in the PEG parser that was causing
     crashes in debug mode.  Now errors are checked in left-recursive
     rules to avoid cases where such errors do not get handled in time
     and appear as long-distance crashes in other places.

   - bpo-42214(3): Fixed a possible crash in the PEG parser when
     checking for the '!=' token in the ‘barry_as_flufl’ rule.  Patch by
     Pablo Galindo.

   - bpo-42206(4): Propagate and raise the errors caused by
     ‘PyAST_Validate()’ in the parser.

   - bpo-41796(5): The *note ast: 9. module internal state is now per
     interpreter.  Patch by Victor Stinner.

   - bpo-42143(6): Fix handling of errors during creation of
     ‘PyFunctionObject’, which resulted in operations on uninitialized
     memory.  Patch by Yonatan Goldschmidt.

   - bpo-41659(7): Fix a bug in the parser, where a curly brace
     following a ‘primary’ didn't fail immediately.  This led to invalid
     expressions like ‘a {b}’ to throw a *note SyntaxError: 18e. with a
     wrong offset, or invalid expressions ending with a curly brace like
     ‘a {’ to not fail immediately in the REPL.

   - bpo-42150(8): Fix possible buffer overflow in the new parser when
     checking for continuation lines.  Patch by Pablo Galindo.

   - bpo-42123(9): Run the parser two times.  On the first run, disable
     all the rules that only generate better error messages to gain
     performance.  If there's a parse failure, run the parser a second
     time with those enabled.

   - bpo-42093(10): The ‘LOAD_ATTR’ instruction now uses new "per opcode
     cache" mechanism and it is about 36% faster now.  Patch by Pablo
     Galindo and Yury Selivanov.

   - bpo-42030(11): Support for the legacy AIX-specific shared library
     loading support has been removed.  All versions of AIX since 4.3
     have supported and defaulted to using the common Unix mechanism
     instead.

   - bpo-41984(12): The garbage collector now tracks all user-defined
     classes.  Patch by Brandt Bucher.

   - bpo-41993(13): Fixed potential issues with removing not completely
     initialized module from ‘sys.modules’ when import fails.

   - bpo-41979(14): Star-unpacking is now allowed for with item's
     targets in the PEG parser.

   - bpo-41974(15): Removed special methods ‘__int__’, ‘__float__’,
     ‘__floordiv__’, ‘__mod__’, ‘__divmod__’, ‘__rfloordiv__’,
     ‘__rmod__’ and ‘__rdivmod__’ of the *note complex: 197. class.
     They always raised a *note TypeError: 198.

   - bpo-41902(16): Micro optimization when compute *note sq_item: 1cf5.
     and *note mp_subscript: 1cf6. of *note range: b3d.  Patch by
     Donghee Na.

   - bpo-41894(17): When loading a native module and a load failure
     occurs, prevent a possible UnicodeDecodeError when not running in a
     UTF-8 locale by decoding the load error message using the current
     locale's encoding.

   - bpo-41902(18): Micro optimization for range.index if step is 1.
     Patch by Donghee Na.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42236

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42218

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42214

   (4) https://bugs.python.org/issue?@action=redirect&bpo=42206

   (5) https://bugs.python.org/issue?@action=redirect&bpo=41796

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42143

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41659

   (8) https://bugs.python.org/issue?@action=redirect&bpo=42150

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42123

   (10) https://bugs.python.org/issue?@action=redirect&bpo=42093

   (11) https://bugs.python.org/issue?@action=redirect&bpo=42030

   (12) https://bugs.python.org/issue?@action=redirect&bpo=41984

   (13) https://bugs.python.org/issue?@action=redirect&bpo=41993

   (14) https://bugs.python.org/issue?@action=redirect&bpo=41979

   (15) https://bugs.python.org/issue?@action=redirect&bpo=41974

   (16) https://bugs.python.org/issue?@action=redirect&bpo=41902

   (17) https://bugs.python.org/issue?@action=redirect&bpo=41894

   (18) https://bugs.python.org/issue?@action=redirect&bpo=41902


File: python.info,  Node: ライブラリ<134>,  Next: Core and Builtins<132>,  Prev: Core and Builtins<131>,  Up: Python 3 10 0 alpha 2

1.24.49.3 ライブラリ
....................

   - bpo-41435(1): Add ‘sys._current_exceptions()’ function to retrieve
     a dictionary mapping each thread's identifier to the topmost
     exception currently active in that thread at the time the function
     is called.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41435


File: python.info,  Node: Core and Builtins<132>,  Next: ライブラリ<135>,  Prev: ライブラリ<134>,  Up: Python 3 10 0 alpha 2

1.24.49.4 Core and Builtins
...........................

   - bpo-38605(1): Enable ‘from __future__ import annotations’ ( PEP
     563(2)) by default.  The values found in *note __annotations__:
     458. dicts are now strings, for example ‘{"x": "int"}’ instead of
     ‘{"x": int}’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38605

   (2) https://peps.python.org/pep-0563/


File: python.info,  Node: ライブラリ<135>,  Next: ドキュメント<43>,  Prev: Core and Builtins<132>,  Up: Python 3 10 0 alpha 2

1.24.49.5 ライブラリ
....................

   - bpo-35455(1): On Solaris, *note thread_time(): b30. is now
     implemented with ‘gethrvtime()’ because
     ‘clock_gettime(CLOCK_THREAD_CPUTIME_ID)’ is not always available.
     Patch by Jakub Kulik.

   - bpo-42233(2): The *note repr(): 1c1. of *note typing: 10a. types
     containing *note Generic Alias Types: 8c1. previously did not show
     the parameterized types in the ‘GenericAlias’.  They have now been
     changed to do so.

   - bpo-29566(3): ‘binhex.binhex()’ consistently writes macOS 9 line
     endings.

   - bpo-26789(4): The *note logging.FileHandler: 1c53. class now keeps
     a reference to the builtin *note open(): 316. function to be able
     to open or reopen the file during Python finalization.  Fix errors
     like: ‘NameError: name 'open' is not defined’.  Patch by Victor
     Stinner.

   - bpo-42157(5): Removed the ‘unicodedata.ucnhash_CAPI’ attribute
     which was an internal PyCapsule object.  The related private
     ‘_PyUnicode_Name_CAPI’ structure was moved to the internal C API.
     Patch by Victor Stinner.

   - bpo-42157(6): Convert the *note unicodedata: 10b. extension module
     to the multiphase initialization API ( PEP 489(7)) and convert the
     ‘unicodedata.UCD’ static type to a heap type.  Patch by Mohamed
     Koubaa and Victor Stinner.

   - bpo-42146(8): Fix memory leak in *note subprocess.Popen(): 4b7. in
     case an uid (gid) specified in ‘user’ (‘group’, ‘extra_groups’)
     overflows ‘uid_t’ (‘gid_t’).

   - bpo-42103(9): *note InvalidFileException: 1cfa. and *note
     RecursionError: f68. are now the only errors caused by loading
     malformed binary Plist file (previously ValueError and TypeError
     could be raised in some specific cases).

   - bpo-41490(10): In ‘importlib.resources’, ‘.path’ method is more
     aggressive about releasing handles to zipfile objects early,
     enabling use-cases like certifi to leave the context open but
     delete the underlying zip file.

   - bpo-41052(11): Pickling heap types implemented in C with protocols
     0 and 1 raises now an error instead of producing incorrect data.

   - bpo-42089(12): In ‘importlib.metadata.PackageNotFoundError’, make
     reference to the package metadata being missing to improve the user
     experience.

   - bpo-41491(13): plistlib: fix parsing XML plists with hexadecimal
     integer values

   - bpo-42065(14): Fix an incorrectly formatted error from
     ‘_codecs.charmap_decode()’ when called with a mapped value outside
     the range of valid Unicode code points.  PR by Max Bernstein.

   - bpo-41966(15): Fix pickling pure Python *note datetime.time: 1fb.
     subclasses.  Patch by Dean Inwood.

   - bpo-19270(16): *note sched.scheduler.cancel(): 1cfb. will now
     cancel the correct event, if two events with same priority are
     scheduled for the same time.  Patch by Bar Harel.

   - bpo-28660(17): *note textwrap.wrap(): 16e0. now attempts to break
     long words after hyphens when ‘break_long_words=True’ and
     ‘break_on_hyphens=True’.

   - bpo-35823(18): Use ‘vfork()’ instead of ‘fork()’ for *note
     subprocess.Popen(): 4b7. on Linux to improve performance in cases
     where it is deemed safe.

   - bpo-42043(19): Add support for ‘zipfile.Path’ inheritance.
     ‘zipfile.Path.is_file()’ now returns False for non-existent names.
     ‘zipfile.Path’ objects now expose a ‘.filename’ attribute and rely
     on that to resolve ‘.name’ and ‘.parent’ when the ‘Path’ object is
     at the root of the zipfile.

   - bpo-42021(20): Fix possible ref leaks in *note sqlite3: d4. module
     init.

   - bpo-39101(21): Fixed tests using IsolatedAsyncioTestCase from
     hanging on BaseExceptions.

   - bpo-41976(22): Fixed a bug that was causing *note
     ctypes.util.find_library(): f45. to return ‘None’ when triying to
     locate a library in an environment when gcc>=9 is available and
     ‘ldconfig’ is not.  Patch by Pablo Galindo

   - bpo-41943(23): Fix bug where TestCase.assertLogs doesn't correctly
     filter messages by level.

   - bpo-41923(24): Implement PEP 613(25), introducing *note
     typing.TypeAlias: 9cc. annotation.

   - bpo-41905(26): A new function in abc: 'update_abstractmethods' to
     re-calculate an abstract class's abstract status.  In addition,
     'dataclass' has been changed to call this function.

   - bpo-23706(27): Added 'newline' parameter to
     ‘pathlib.Path.write_text()’.

   - bpo-41876(28): Tkinter font class repr uses font name

   - bpo-41831(29): ‘str()’ for the ‘type’ attribute of the
     ‘tkinter.Event’ object always returns now the numeric code returned
     by Tk instead of the name of the event type.

   - bpo-39337(30): *note encodings.normalize_encoding(): 9fd. now
     ignores non-ASCII characters.

   - bpo-41747(31): Ensure all methods that generated from *note
     dataclasses.dataclass(): 4e1. objects now have the proper
     ‘__qualname__’ attribute referring to the class they belong to.
     Patch by Batuhan Taskaya.

   - bpo-30681(32): Handle exceptions caused by unparsable date headers
     when using email "default" policy.  Patch by Tim Bell, Georges Toth

   - bpo-41586(33): Add F_SETPIPE_SZ and F_GETPIPE_SZ to fcntl module.
     Allow setting pipesize on subprocess.Popen.

   - bpo-41229(34): Add ‘contextlib.aclosing’ for deterministic cleanup
     of async generators which is analogous to ‘contextlib.closing’ for
     non-async generators.  Patch by Joongi Kim and John Belmonte.

   - bpo-16396(35): Allow ‘ctypes.wintypes’ to be imported on
     non-Windows systems.

   - bpo-4356(36): Add a key function to the bisect module.

   - bpo-40592(37): *note shutil.which(): 6db. now ignores empty entries
     in ‘PATHEXT’ instead of treating them as a match.

   - bpo-40492(38): Fix ‘--outfile’ for *note cProfile: 2b. / *note
     profile: b4. not writing the output file in the original directory
     when the program being profiled changes the working directory.  PR
     by Anthony Sottile.

   - bpo-34204(39): The *note shelve: c8. module now uses *note
     pickle.DEFAULT_PROTOCOL: a2f. by default instead of *note pickle:
     ab. protocol ‘3’.

   - bpo-27321(40): Fixed KeyError exception when flattening an email to
     a string attempts to replace a non-existent
     Content-Transfer-Encoding header.

   - bpo-38976(41): The *note http.cookiejar: 74. module now supports
     the parsing of cookies in CURL-style cookiejar files through
     MozillaCookieJar on all platforms.  Previously, such cookie entries
     would be silently ignored when loading a cookiejar with such
     entries.

     Additionally, the HTTP Only attribute is persisted in the object,
     and will be correctly written to file if the MozillaCookieJar
     object is subsequently dumped.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35455

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42233

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29566

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26789

   (5) https://bugs.python.org/issue?@action=redirect&bpo=42157

   (6) https://bugs.python.org/issue?@action=redirect&bpo=42157

   (7) https://peps.python.org/pep-0489/

   (8) https://bugs.python.org/issue?@action=redirect&bpo=42146

   (9) https://bugs.python.org/issue?@action=redirect&bpo=42103

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41490

   (11) https://bugs.python.org/issue?@action=redirect&bpo=41052

   (12) https://bugs.python.org/issue?@action=redirect&bpo=42089

   (13) https://bugs.python.org/issue?@action=redirect&bpo=41491

   (14) https://bugs.python.org/issue?@action=redirect&bpo=42065

   (15) https://bugs.python.org/issue?@action=redirect&bpo=41966

   (16) https://bugs.python.org/issue?@action=redirect&bpo=19270

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28660

   (18) https://bugs.python.org/issue?@action=redirect&bpo=35823

   (19) https://bugs.python.org/issue?@action=redirect&bpo=42043

   (20) https://bugs.python.org/issue?@action=redirect&bpo=42021

   (21) https://bugs.python.org/issue?@action=redirect&bpo=39101

   (22) https://bugs.python.org/issue?@action=redirect&bpo=41976

   (23) https://bugs.python.org/issue?@action=redirect&bpo=41943

   (24) https://bugs.python.org/issue?@action=redirect&bpo=41923

   (25) https://peps.python.org/pep-0613/

   (26) https://bugs.python.org/issue?@action=redirect&bpo=41905

   (27) https://bugs.python.org/issue?@action=redirect&bpo=23706

   (28) https://bugs.python.org/issue?@action=redirect&bpo=41876

   (29) https://bugs.python.org/issue?@action=redirect&bpo=41831

   (30) https://bugs.python.org/issue?@action=redirect&bpo=39337

   (31) https://bugs.python.org/issue?@action=redirect&bpo=41747

   (32) https://bugs.python.org/issue?@action=redirect&bpo=30681

   (33) https://bugs.python.org/issue?@action=redirect&bpo=41586

   (34) https://bugs.python.org/issue?@action=redirect&bpo=41229

   (35) https://bugs.python.org/issue?@action=redirect&bpo=16396

   (36) https://bugs.python.org/issue?@action=redirect&bpo=4356

   (37) https://bugs.python.org/issue?@action=redirect&bpo=40592

   (38) https://bugs.python.org/issue?@action=redirect&bpo=40492

   (39) https://bugs.python.org/issue?@action=redirect&bpo=34204

   (40) https://bugs.python.org/issue?@action=redirect&bpo=27321

   (41) https://bugs.python.org/issue?@action=redirect&bpo=38976


File: python.info,  Node: ドキュメント<43>,  Next: テスト<42>,  Prev: ライブラリ<135>,  Up: Python 3 10 0 alpha 2

1.24.49.6 ドキュメント
......................

   - bpo-42061(1): Document __format__ functionality for IP addresses.

   - bpo-41910(2): Document the default implementation of
     ‘object.__eq__’.

   - bpo-42010(3): Clarify that subscription expressions are also valid
     for certain *note classes: 1cfd. and *note types: 1cfe. in the
     standard library, and for user-defined classes and types if the
     classmethod ‘__class_getitem__()’ is provided.

   - bpo-41805(4): Documented *note generic alias type: 8c1. and *note
     types.GenericAlias: 9ec.  Also added an entry in glossary for *note
     generic types: 1a1.

   - bpo-39693(5): Fix tarfile's extractfile documentation

   - bpo-39416(6): Document some restrictions on the default string
     representations of numeric classes.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42061

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41910

   (3) https://bugs.python.org/issue?@action=redirect&bpo=42010

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41805

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39693

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39416


File: python.info,  Node: テスト<42>,  Next: ビルド<49>,  Prev: ドキュメント<43>,  Up: Python 3 10 0 alpha 2

1.24.49.7 テスト
................

   - bpo-41739(1): Fix
     test_logging.test_race_between_set_target_and_flush(): the test now
     waits until all threads complete to avoid leaking running threads.

   - bpo-41970(2): Avoid a test failure in ‘test_lib2to3’ if the module
     has already imported at the time the test executes.  Patch by Pablo
     Galindo.

   - bpo-41944(3): Tests for CJK codecs no longer call ‘eval()’ on
     content received via HTTP.

   - bpo-41306(4): Fixed a failure in ‘test_tk.test_widgets.ScaleTest’
     happening when executing the test with Tk 8.6.10.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41739

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41970

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41944

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41306


File: python.info,  Node: ビルド<49>,  Next: Windows<43>,  Prev: テスト<42>,  Up: Python 3 10 0 alpha 2

1.24.49.8 ビルド
................

   - bpo-38980(1): Add ‘-fno-semantic-interposition’ to both the compile
     and link line when building with ‘--enable-optimizations’.  Patch
     by Victor Stinner and Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38980


File: python.info,  Node: Windows<43>,  Next: macOS<33>,  Prev: ビルド<49>,  Up: Python 3 10 0 alpha 2

1.24.49.9 Windows
.................

   - bpo-38439(1): Updates the icons for IDLE in the Windows Store
     package.

   - bpo-38252(2): Use 8-byte step to detect ASCII sequence in 64-bit
     Windows build.

   - bpo-39107(3): Update Tcl and Tk to 8.6.10 in Windows installer.

   - bpo-41557(4): Update Windows installer to use SQLite 3.33.0.

   - bpo-38324(5): Avoid Unicode errors when accessing certain locale
     data on Windows.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38439

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38252

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39107

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41557

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38324


File: python.info,  Node: macOS<33>,  Next: IDLE<25>,  Prev: Windows<43>,  Up: Python 3 10 0 alpha 2

1.24.49.10 macOS
................

   - bpo-41471(1): Ignore invalid prefix lengths in system proxy
     excludes.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41471


File: python.info,  Node: IDLE<25>,  Next: C API<44>,  Prev: macOS<33>,  Up: Python 3 10 0 alpha 2

1.24.49.11 IDLE
...............

   - bpo-33987(1): Mostly finish using ttk widgets, mainly for editor,
     settings, and searches.  Some patches by Mark Roseman.

   - bpo-40511(2): Typing opening and closing parentheses inside the
     parentheses of a function call will no longer cause unnecessary
     "flashing" off and on of an existing open call-tip, e.g.  when
     typed in a string literal.

   - bpo-38439(3): Add a 256×256 pixel IDLE icon to the Windows .ico
     file.  Created by Andrew Clover.  Remove the low-color gif
     variations from the .ico file.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33987

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40511

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38439


File: python.info,  Node: C API<44>,  Prev: IDLE<25>,  Up: Python 3 10 0 alpha 2

1.24.49.12 C API
................

   - bpo-42157(1): The private ‘_PyUnicode_Name_CAPI’ structure of the
     PyCapsule API ‘unicodedata.ucnhash_CAPI’ has been moved to the
     internal C API. Patch by Victor Stinner.

   - bpo-42015(2): Fix potential crash in deallocating method objects
     when dynamically allocated *note PyMethodDef: 16f0.'s lifetime is
     managed through the ‘self’ argument of a *note PyCFunction: 1691.

   - bpo-40423(3): The *note subprocess: dc. module and ‘os.closerange’
     will now use the ‘close_range(low, high, flags)’ syscall when it is
     available for more efficient closing of ranges of descriptors.

   - bpo-41845(4): *note PyObject_GenericGetDict(): 1d05. is available
     again in the limited API when targeting 3.10 or later.

   - bpo-40422(5): Add ‘_Py_closerange’ function to provide performant
     closing of a range of file descriptors.

   - bpo-41986(6): ‘Py_FileSystemDefaultEncodeErrors’ and ‘Py_UTF8Mode’
     are available again in limited API.

   - bpo-41756(7): Add ‘PyIter_Send’ function to allow sending value
     into generator/coroutine/iterator without raising StopIteration
     exception to signal return.

   - bpo-41784(8): Added ‘PyUnicode_AsUTF8AndSize’ to the limited C API.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42157

   (2) https://bugs.python.org/issue?@action=redirect&bpo=42015

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40423

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41845

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40422

   (6) https://bugs.python.org/issue?@action=redirect&bpo=41986

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41756

   (8) https://bugs.python.org/issue?@action=redirect&bpo=41784


File: python.info,  Node: Python 3 10 0 alpha 1,  Next: Python 3 9 0 beta 1,  Prev: Python 3 10 0 alpha 2,  Up: 変更履歴

1.24.50 Python 3.10.0 alpha 1
-----------------------------

'Release date: 2020-10-05'

* Menu:

* セキュリティ: セキュリティ<36>.
* Core and Builtins: Core and Builtins<133>.
* ライブラリ: ライブラリ<136>.
* Core and Builtins: Core and Builtins<134>.
* ライブラリ: ライブラリ<137>.
* Core and Builtins: Core and Builtins<135>.
* ライブラリ: ライブラリ<138>.
* Core and Builtins: Core and Builtins<136>.
* ライブラリ: ライブラリ<139>.
* Core and Builtins: Core and Builtins<137>.
* ライブラリ: ライブラリ<140>.
* Core and Builtins: Core and Builtins<138>.
* ライブラリ: ライブラリ<141>.
* Core and Builtins: Core and Builtins<139>.
* ライブラリ: ライブラリ<142>.
* Core and Builtins: Core and Builtins<140>.
* ライブラリ: ライブラリ<143>.
* Core and Builtins: Core and Builtins<141>.
* ライブラリ: ライブラリ<144>.
* Core and Builtins: Core and Builtins<142>.
* ライブラリ: ライブラリ<145>.
* Core and Builtins: Core and Builtins<143>.
* ライブラリ: ライブラリ<146>.
* Core and Builtins: Core and Builtins<144>.
* ライブラリ: ライブラリ<147>.
* Core and Builtins: Core and Builtins<145>.
* ライブラリ: ライブラリ<148>.
* Core and Builtins: Core and Builtins<146>.
* ライブラリ: ライブラリ<149>.
* Core and Builtins: Core and Builtins<147>.
* ライブラリ: ライブラリ<150>.
* ドキュメント: ドキュメント<44>.
* テスト: テスト<43>.
* ビルド: ビルド<50>.
* Windows: Windows<44>.
* macOS: macOS<34>.
* IDLE: IDLE<26>.
* C API: C API<45>.


File: python.info,  Node: セキュリティ<36>,  Next: Core and Builtins<133>,  Up: Python 3 10 0 alpha 1

1.24.50.1 セキュリティ
......................

   - bpo-41304(1): Fixes ‘python3x._pth’ being ignored on Windows,
     caused by the fix for bpo-29778(2) ( CVE 2020-15801(3)).

   - bpo-41162(4): Audit hooks are now cleared later during finalization
     to avoid missing events.

   - bpo-29778(5): Ensure ‘python3.dll’ is loaded from correct locations
     when Python is embedded ( CVE 2020-15523(6)).

   - bpo-41004(7): The __hash__() methods of ipaddress.IPv4Interface and
     ipaddress.IPv6Interface incorrectly generated constant hash values
     of 32 and 128 respectively.  This resulted in always causing hash
     collisions.  The fix uses hash() to generate hash values for the
     tuple of (address, mask length, network address).

   - bpo-39603(8): Prevent http header injection by rejecting control
     characters in http.client.putrequest(...).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41304

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29778

   (3) https://www.cve.org/CVERecord?id=CVE-2020-15801

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41162

   (5) https://bugs.python.org/issue?@action=redirect&bpo=29778

   (6) https://www.cve.org/CVERecord?id=CVE-2020-15523

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41004

   (8) https://bugs.python.org/issue?@action=redirect&bpo=39603


File: python.info,  Node: Core and Builtins<133>,  Next: ライブラリ<136>,  Prev: セキュリティ<36>,  Up: Python 3 10 0 alpha 1

1.24.50.2 Core and Builtins
...........................

   - bpo-41909(1): Fixed stack overflow in *note issubclass(): 9c4. and
     *note isinstance(): 2ad. when getting the ‘__bases__’ attribute
     leads to infinite recursion.

   - bpo-41922(2): Speed up calls to ‘reversed()’ by using the PEP
     590(3) ‘vectorcall’ calling convention.  Patch by Donghee Na.

   - bpo-41873(4): Calls to ‘float()’ are now faster due to the
     ‘vectorcall’ calling convention.  Patch by Dennis Sweeney.

   - bpo-41870(5): Speed up calls to ‘bool()’ by using the PEP 590(6)
     ‘vectorcall’ calling convention.  Patch by Donghee Na.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41909

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41922

   (3) https://peps.python.org/pep-0590/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41873

   (5) https://bugs.python.org/issue?@action=redirect&bpo=41870

   (6) https://peps.python.org/pep-0590/


File: python.info,  Node: ライブラリ<136>,  Next: Core and Builtins<134>,  Prev: Core and Builtins<133>,  Up: Python 3 10 0 alpha 1

1.24.50.3 ライブラリ
....................

   - bpo-1635741(1): Port the ‘_bisect’ module to the multi-phase
     initialization API ( PEP 489(2)).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (2) https://peps.python.org/pep-0489/


File: python.info,  Node: Core and Builtins<134>,  Next: ライブラリ<137>,  Prev: ライブラリ<136>,  Up: Python 3 10 0 alpha 1

1.24.50.4 Core and Builtins
...........................

   - bpo-39934(1): Correctly count control blocks in 'except' in
     compiler.  Ensures that a syntax error, rather a fatal error,
     occurs for deeply nested, named exception handlers.

   - bpo-41780(2): Fix ‘__dir__()’ of *note types.GenericAlias: 9ec.
     Patch by Batuhan Taskaya.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39934

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41780


File: python.info,  Node: ライブラリ<137>,  Next: Core and Builtins<135>,  Prev: Core and Builtins<134>,  Up: Python 3 10 0 alpha 1

1.24.50.5 ライブラリ
....................

   - bpo-1635741(1): Port the ‘_lsprof’ extension module to multi-phase
     initialization ( PEP 489(2)).

   - bpo-1635741(3): Port the *note cmath: 19. extension module to
     multi-phase initialization ( PEP 489(4)).

   - bpo-1635741(5): Port the ‘_scproxy’ extension module to multi-phase
     initialization ( PEP 489(6)).

   - bpo-1635741(7): Port the *note termios: e7. extension module to
     multi-phase initialization ( PEP 489(8)).

   - bpo-1635741(9): Convert the ‘_sha256’ extension module types to
     heap types.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (2) https://peps.python.org/pep-0489/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (4) https://peps.python.org/pep-0489/

   (5) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (6) https://peps.python.org/pep-0489/

   (7) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (8) https://peps.python.org/pep-0489/

   (9) https://bugs.python.org/issue?@action=redirect&bpo=1635741


File: python.info,  Node: Core and Builtins<135>,  Next: ライブラリ<138>,  Prev: ライブラリ<137>,  Up: Python 3 10 0 alpha 1

1.24.50.6 Core and Builtins
...........................

   - bpo-41690(1): Fix a possible stack overflow in the parser when
     parsing functions and classes with a huge amount of arguments.
     Patch by Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41690


File: python.info,  Node: ライブラリ<138>,  Next: Core and Builtins<136>,  Prev: Core and Builtins<135>,  Up: Python 3 10 0 alpha 1

1.24.50.7 ライブラリ
....................

   - bpo-1635741(1): Port the ‘_overlapped’ extension module to
     multi-phase initialization ( PEP 489(2)).

   - bpo-1635741(3): Port the ‘_curses_panel’ extension module to
     multi-phase initialization ( PEP 489(4)).

   - bpo-1635741(5): Port the ‘_opcode’ extension module to multi-phase
     initialization ( PEP 489(6)).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (2) https://peps.python.org/pep-0489/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (4) https://peps.python.org/pep-0489/

   (5) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (6) https://peps.python.org/pep-0489/


File: python.info,  Node: Core and Builtins<136>,  Next: ライブラリ<139>,  Prev: ライブラリ<138>,  Up: Python 3 10 0 alpha 1

1.24.50.8 Core and Builtins
...........................

   - bpo-41681(1): Fixes the wrong error description in the error raised
     by using 2 ‘,’ in format string in f-string and *note str.format():
     833.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41681


File: python.info,  Node: ライブラリ<139>,  Next: Core and Builtins<137>,  Prev: Core and Builtins<136>,  Up: Python 3 10 0 alpha 1

1.24.50.9 ライブラリ
....................

   - bpo-41675(1): The implementation of *note signal.siginterrupt():
     134d. now uses ‘sigaction()’ (if it is available in the system)
     instead of the deprecated ‘siginterrupt()’.  Patch by Pablo
     Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41675


File: python.info,  Node: Core and Builtins<137>,  Next: ライブラリ<140>,  Prev: ライブラリ<139>,  Up: Python 3 10 0 alpha 1

1.24.50.10 Core and Builtins
............................

   - bpo-41670(1): Prevent line trace being skipped on platforms not
     compiled with ‘USE_COMPUTED_GOTOS’.  Fixes issue where some lines
     nested within a try-except block were not being traced on Windows.

   - bpo-41654(2): Fix a crash that occurred when destroying subclasses
     of *note MemoryError: 179e.  Patch by Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41670

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41654


File: python.info,  Node: ライブラリ<140>,  Next: Core and Builtins<138>,  Prev: Core and Builtins<137>,  Up: Python 3 10 0 alpha 1

1.24.50.11 ライブラリ
.....................

   - bpo-1635741(1): Port the *note zlib: 139. extension module to
     multi-phase initialization ( PEP 489(2)).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (2) https://peps.python.org/pep-0489/


File: python.info,  Node: Core and Builtins<138>,  Next: ライブラリ<141>,  Prev: ライブラリ<140>,  Up: Python 3 10 0 alpha 1

1.24.50.12 Core and Builtins
............................

   - bpo-41631(1): The ‘_ast’ module uses again a global state.  Using a
     module state per module instance is causing subtle practical
     problems.  For example, the Mercurial project replaces the
     ‘__import__()’ function to implement lazy import, whereas Python
     expected that ‘import _ast’ always return a fully initialized
     ‘_ast’ module.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41631


File: python.info,  Node: ライブラリ<141>,  Next: Core and Builtins<139>,  Prev: Core and Builtins<138>,  Up: Python 3 10 0 alpha 1

1.24.50.13 ライブラリ
.....................

   - bpo-40077(1): Convert ‘_operator’ to use *note PyType_FromSpec():
     79d.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40077


File: python.info,  Node: Core and Builtins<139>,  Next: ライブラリ<142>,  Prev: ライブラリ<141>,  Up: Python 3 10 0 alpha 1

1.24.50.14 Core and Builtins
............................

   - bpo-1653741(1): Port ‘_sha3’ to multi-phase init.  Convert static
     types to heap types.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1653741


File: python.info,  Node: ライブラリ<142>,  Next: Core and Builtins<140>,  Prev: Core and Builtins<139>,  Up: Python 3 10 0 alpha 1

1.24.50.15 ライブラリ
.....................

   - bpo-1635741(1): Port the ‘_blake2’ extension module to the
     multi-phase initialization API ( PEP 489(2)).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (2) https://peps.python.org/pep-0489/


File: python.info,  Node: Core and Builtins<140>,  Next: ライブラリ<143>,  Prev: ライブラリ<142>,  Up: Python 3 10 0 alpha 1

1.24.50.16 Core and Builtins
............................

   - bpo-41533(1): Free the stack allocated in ‘va_build_stack’ if
     ‘do_mkstack’ fails and the stack is not a ‘small_stack’.

   - bpo-41531(2): Fix a bug that was dropping keys when compiling dict
     literals with more than 0xFFFF elements.  Patch by Pablo Galindo.

   - bpo-41525(3): The output of ‘python --help’ contains now only ASCII
     characters.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41533

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41531

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41525


File: python.info,  Node: ライブラリ<143>,  Next: Core and Builtins<141>,  Prev: Core and Builtins<140>,  Up: Python 3 10 0 alpha 1

1.24.50.17 ライブラリ
.....................

   - bpo-1635741(1): Port the ‘_sha1’, ‘_sha512’, and ‘_md5’ extension
     modules to multi-phase initialization API ( PEP 489(2)).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (2) https://peps.python.org/pep-0489/


File: python.info,  Node: Core and Builtins<141>,  Next: ライブラリ<144>,  Prev: ライブラリ<143>,  Up: Python 3 10 0 alpha 1

1.24.50.18 Core and Builtins
............................

   - bpo-41431(1): Optimize ‘dict_merge()’ for copying dict (e.g.
     ‘dict(d)’ and ‘{}.update(d)’).

   - bpo-41428(2): Implement PEP 604.  This supports (int | str) etc.
     in place of Union[str, int].

   - bpo-41340(3): Removed fallback implementation for ‘strdup’.

   - bpo-38156(4): Handle interrupts that come after EOF correctly in
     ‘PyOS_StdioReadline’.

   - bpo-41342(5): *note round(): 14f2. with integer argument is now
     faster (9-60%).

   - bpo-41334(6): Constructors *note str(): 169, *note bytes(): 192.
     and *note bytearray(): 344. are now faster (around 30-40% for small
     objects).

   - bpo-41295(7): Resolve a regression in CPython 3.8.4 where defining
     "__setattr__" in a multi-inheritance setup and calling up the
     hierarchy chain could fail if builtins/extension types were
     involved in the base types.

   - bpo-41323(8): Bytecode optimizations are performed directly on the
     control flow graph.  This will result in slightly more compact code
     objects in some circumstances.

   - bpo-41247(9): Always cache the running loop holder when running
     ‘asyncio.set_running_loop’.

   - bpo-41252(10): Fix incorrect refcounting in _ssl.c's
     ‘_servername_callback()’.

   - bpo-1635741(11): Port *note multiprocessing: 98. to multi-phase
     initialization

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41431

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41428

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41340

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38156

   (5) https://bugs.python.org/issue?@action=redirect&bpo=41342

   (6) https://bugs.python.org/issue?@action=redirect&bpo=41334

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41295

   (8) https://bugs.python.org/issue?@action=redirect&bpo=41323

   (9) https://bugs.python.org/issue?@action=redirect&bpo=41247

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41252

   (11) https://bugs.python.org/issue?@action=redirect&bpo=1635741


File: python.info,  Node: ライブラリ<144>,  Next: Core and Builtins<142>,  Prev: Core and Builtins<141>,  Up: Python 3 10 0 alpha 1

1.24.50.19 ライブラリ
.....................

   - bpo-1635741(1): Port ‘winapi’ to multiphase initialization

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1635741


File: python.info,  Node: Core and Builtins<142>,  Next: ライブラリ<145>,  Prev: ライブラリ<144>,  Up: Python 3 10 0 alpha 1

1.24.50.20 Core and Builtins
............................

   - bpo-41215(1): Use non-NULL default values in the PEG parser keyword
     list to overcome a bug that was preventing Python from being
     properly compiled when using the XLC compiler.  Patch by Pablo
     Galindo.

   - bpo-41218(2): Python 3.8.3 had a regression where compiling with
     ast.PyCF_ALLOW_TOP_LEVEL_AWAIT would aggressively mark list
     comprehension with CO_COROUTINE. Now only list comprehension making
     use of async/await will tagged as so.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41215

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41218


File: python.info,  Node: ライブラリ<145>,  Next: Core and Builtins<143>,  Prev: Core and Builtins<142>,  Up: Python 3 10 0 alpha 1

1.24.50.21 ライブラリ
.....................

   - bpo-1635741(1): Port *note faulthandler: 5c. to multiphase
     initialization.

   - bpo-1635741(2): Port ‘sha256’ to multiphase initialization

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1635741


File: python.info,  Node: Core and Builtins<143>,  Next: ライブラリ<146>,  Prev: ライブラリ<145>,  Up: Python 3 10 0 alpha 1

1.24.50.22 Core and Builtins
............................

   - bpo-41175(1): Guard against a NULL pointer dereference within
     bytearrayobject triggered by the ‘bytearray() + bytearray()’
     operation.

   - bpo-41100(2): add arm64 to the allowable Mac OS arches in
     mpdecimal.h

   - bpo-41094(3): Fix decoding errors with audit when open files with
     non-ASCII names on non-UTF-8 locale.

   - bpo-39960(4): The "hackcheck" that prevents sneaking around a
     type's __setattr__() by calling the superclass method was rewritten
     to allow C implemented heap types.

   - bpo-41084(5): Prefix the error message with 'f-string: ', when
     parsing an f-string expression which throws a *note SyntaxError:
     18e.

   - bpo-40521(6): Empty frozensets are no longer singletons.

   - bpo-41076(7): Pre-feed the parser with the location of the f-string
     expression, not the f-string itself, which allows us to skip the
     shifting of the AST node locations after the parsing is completed.

   - bpo-41056(8): Fixes a reference to deallocated stack space during
     startup when constructing sys.path involving a relative symlink
     when code was supplied via -c.  (discovered via Coverity)

   - bpo-41061(9): Fix incorrect expressions and asserts in hashtable
     code and tests.

   - bpo-41052(10): Opt out serialization/deserialization for
     _random.Random

   - bpo-40939(11): Rename ‘PyPegen*’ functions to ‘PyParser*’, so that
     we can remove the old set of ‘PyParser*’ functions that were using
     the old parser, but keep everything backwards-compatible.

   - bpo-35975(12): Stefan Behnel reported that cf_feature_version is
     used even when PyCF_ONLY_AST is not set.  This is against the
     intention and against the documented behavior, so it's been fixed.

   - bpo-40939(13): Remove the remaining files from the old parser and
     the ‘symbol’ module.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41175

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41100

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41094

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39960

   (5) https://bugs.python.org/issue?@action=redirect&bpo=41084

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40521

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41076

   (8) https://bugs.python.org/issue?@action=redirect&bpo=41056

   (9) https://bugs.python.org/issue?@action=redirect&bpo=41061

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41052

   (11) https://bugs.python.org/issue?@action=redirect&bpo=40939

   (12) https://bugs.python.org/issue?@action=redirect&bpo=35975

   (13) https://bugs.python.org/issue?@action=redirect&bpo=40939


File: python.info,  Node: ライブラリ<146>,  Next: Core and Builtins<144>,  Prev: Core and Builtins<143>,  Up: Python 3 10 0 alpha 1

1.24.50.23 ライブラリ
.....................

   - bpo-40077(1): Convert ‘_bz2’ to use *note PyType_FromSpec(): 79d.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40077


File: python.info,  Node: Core and Builtins<144>,  Next: ライブラリ<147>,  Prev: ライブラリ<146>,  Up: Python 3 10 0 alpha 1

1.24.50.24 Core and Builtins
............................

   - bpo-41006(1): The ‘encodings.latin_1’ module is no longer imported
     at startup.  Now it is only imported when it is the filesystem
     encoding or the stdio encoding.

   - bpo-40636(2): *note zip(): 1a0. now supports PEP 618(3)'s ‘strict’
     parameter, which raises a *note ValueError: 2ec. if the arguments
     are exhausted at different lengths.  Patch by Brandt Bucher.

   - bpo-1635741(4): Port ‘_gdbm’ to multiphase initialization.

   - bpo-40985(5): Fix a bug that caused the *note SyntaxError: 18e.
     text to be empty when a file ends with a line ending in a line
     continuation character (i.e.  backslash).  The error text should
     contain the text of the last line.

   - bpo-40958(6): Fix a possible buffer overflow in the PEG parser when
     gathering information for emitting syntax errors.  Patch by Pablo
     Galindo.

   - bpo-1635741(7): Port ‘_dbm’ to multiphase initialization.

   - bpo-40957(8): Fix refleak in _Py_fopen_obj() when PySys_Audit()
     fails

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41006

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40636

   (3) https://peps.python.org/pep-0618/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40985

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40958

   (7) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (8) https://bugs.python.org/issue?@action=redirect&bpo=40957


File: python.info,  Node: ライブラリ<147>,  Next: Core and Builtins<145>,  Prev: Core and Builtins<144>,  Up: Python 3 10 0 alpha 1

1.24.50.25 ライブラリ
.....................

   - bpo-40950(1): Add a state to the ‘nis’ module ( PEP 3121(2)) and
     apply the multiphase initialization.  Patch by Donghee Na.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40950

   (2) https://peps.python.org/pep-3121/


File: python.info,  Node: Core and Builtins<145>,  Next: ライブラリ<148>,  Prev: ライブラリ<147>,  Up: Python 3 10 0 alpha 1

1.24.50.26 Core and Builtins
............................

   - bpo-40947(1): The Python *note Path Configuration: aaa. now takes
     *note PyConfig.platlibdir: 1d21. in account.

   - bpo-40939(2): Remove the old parser, the ‘parser’ module and all
     associated support code, command-line options and environment
     variables.  Patch by Pablo Galindo.

   - bpo-40847(3): Fix a bug where a line with only a line continuation
     character is not considered a blank line at tokenizer level.  In
     such cases, more than a single ‘NEWLINE’ token was emitted.  The
     old parser was working around the issue, but the new parser threw a
     *note SyntaxError: 18e. for valid input due to this.  For example,
     an empty line following a line continuation character was
     interpreted as a *note SyntaxError: 18e.

   - bpo-40890(4): Each dictionary view now has a ‘mapping’ attribute
     that provides a *note types.MappingProxyType: 698. wrapping the
     original dictionary.  Patch contributed by Dennis Sweeney.

   - bpo-40889(5): Improved the performance of symmetric difference
     operations on dictionary item views.  Patch by Dennis Sweeney.

   - bpo-40904(6): Fix possible segfault in the new PEG parser when
     parsing f-string containing yield statements with no value
     (‘f"{yield}"’).  Patch by Pablo Galindo

   - bpo-40903(7): Fixed a possible segfault in the new PEG parser when
     producing error messages for invalid assignments of the form
     ‘p=p=’.  Patch by Pablo Galindo

   - bpo-40880(8): Fix invalid memory read in the new parser when
     checking newlines in string literals.  Patch by Pablo Galindo.

   - bpo-40883(9): Fix memory leak in when parsing f-strings in the new
     parser.  Patch by Pablo Galindo

   - bpo-40870(10): Raise *note ValueError: 2ec. when validating custom
     AST's where the constants ‘True’, ‘False’ and ‘None’ are used
     within a *note ast.Name: 1d22. node.

   - bpo-40854(11): Allow overriding *note sys.platlibdir: b32. via a
     new *note PYTHONPLATLIBDIR: 1d23. environment variable.

   - bpo-40826(12): Fix GIL usage in ‘PyOS_Readline()’: lock the GIL to
     set an exception and pass the Python thread state when checking if
     there is a pending signal.

   - bpo-1635741(13): Port *note fcntl: 5d. to multiphase
     initialization.

   - bpo-19468(14): Delete unnecessary instance check in
     importlib.reload().  Patch by Furkan Önder.

   - bpo-40824(15): Unexpected errors in calling the ‘__iter__’ method
     are no longer masked by ‘TypeError’ in the *note in: 34b. operator
     and functions *note contains(): ad7, *note indexOf(): ad8. and
     *note countOf(): ad9. of the *note operator: a3. module.

   - bpo-40792(16): Attributes ‘start’, ‘stop’ and ‘step’ of the *note
     range: b3d. object now always has exact type *note int: 19b.
     Previously, they could have been an instance of a subclass of
     ‘int’.

   - bpo-40780(17): Fix a corner case where g-style string formatting of
     a float failed to remove trailing zeros.

   - bpo-38964(18): When there's a *note SyntaxError: 18e. in the
     expression part of an fstring, the filename attribute of the *note
     SyntaxError: 18e. gets correctly set to the name of the file the
     fstring resides in.

   - bpo-40750(19): Support the "-d" debug flag in the new PEG parser.
     Patch by Pablo Galindo

   - bpo-40217(20): Instances of types created with *note
     PyType_FromSpecWithBases(): 79e. will no longer automatically visit
     their class object when traversing references in the garbage
     collector.  The user is expected to manually visit the object's
     class.  Patch by Pablo Galindo.

   - bpo-39573(21): *note Py_TYPE(): 3c9. is changed to the inline
     static function.  Patch by Donghee Na.

   - bpo-40696(22): Fix a hang that can arise after *note
     generator.throw(): 71c. due to a cycle in the exception context
     chain.

   - bpo-40521(23): Each interpreter now its has own free lists,
     singletons and caches:

        * Free lists: float, tuple, list, dict, frame, context,
          asynchronous generator, MemoryError.

        * Singletons: empty tuple, empty bytes string, empty Unicode
          string, single byte character, single Unicode (latin1)
          character.

        * Slice cache.

     They are no longer shared by all interpreters.

   - bpo-40679(24): Certain *note TypeError: 198. messages about missing
     or extra arguments now include the function's *note qualified name:
     1d24.  Patch by Dennis Sweeney.

   - bpo-29590(25): Make the stack trace correct after calling *note
     generator.throw(): 71c. on a generator that has yielded from a
     ‘yield from’.

   - bpo-4022(26): Improve performance of generators by not raising
     internal StopIteration.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40947

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40939

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40847

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40890

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40889

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40904

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40903

   (8) https://bugs.python.org/issue?@action=redirect&bpo=40880

   (9) https://bugs.python.org/issue?@action=redirect&bpo=40883

   (10) https://bugs.python.org/issue?@action=redirect&bpo=40870

   (11) https://bugs.python.org/issue?@action=redirect&bpo=40854

   (12) https://bugs.python.org/issue?@action=redirect&bpo=40826

   (13) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (14) https://bugs.python.org/issue?@action=redirect&bpo=19468

   (15) https://bugs.python.org/issue?@action=redirect&bpo=40824

   (16) https://bugs.python.org/issue?@action=redirect&bpo=40792

   (17) https://bugs.python.org/issue?@action=redirect&bpo=40780

   (18) https://bugs.python.org/issue?@action=redirect&bpo=38964

   (19) https://bugs.python.org/issue?@action=redirect&bpo=40750

   (20) https://bugs.python.org/issue?@action=redirect&bpo=40217

   (21) https://bugs.python.org/issue?@action=redirect&bpo=39573

   (22) https://bugs.python.org/issue?@action=redirect&bpo=40696

   (23) https://bugs.python.org/issue?@action=redirect&bpo=40521

   (24) https://bugs.python.org/issue?@action=redirect&bpo=40679

   (25) https://bugs.python.org/issue?@action=redirect&bpo=29590

   (26) https://bugs.python.org/issue?@action=redirect&bpo=4022


File: python.info,  Node: ライブラリ<148>,  Next: Core and Builtins<146>,  Prev: Core and Builtins<145>,  Up: Python 3 10 0 alpha 1

1.24.50.27 ライブラリ
.....................

   - bpo-1635741(1): Port *note mmap: 94. to multiphase initialization.

   - bpo-1635741(2): Port ‘_lzma’ to multiphase initialization.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1635741


File: python.info,  Node: Core and Builtins<146>,  Next: ライブラリ<149>,  Prev: ライブラリ<148>,  Up: Python 3 10 0 alpha 1

1.24.50.28 Core and Builtins
............................

   - bpo-37999(1): Builtin and extension functions that take integer
     arguments no longer accept *note Decimal: 1fe.s, *note Fraction:
     213.s and other objects that can be converted to integers only with
     a loss (e.g.  that have the *note __int__(): 19d. method but do not
     have the *note __index__(): 19e. method).

   - bpo-29882(2): Add *note int.bit_count(): 9cf, counting the number
     of ones in the binary representation of an integer.  Patch by
     Niklas Fiekas.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37999

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29882


File: python.info,  Node: ライブラリ<149>,  Next: Core and Builtins<147>,  Prev: Core and Builtins<146>,  Up: Python 3 10 0 alpha 1

1.24.50.29 ライブラリ
.....................

   - bpo-36982(1): Use ncurses extended color functions when available
     to support terminals with 256 colors, and add the new function
     *note curses.has_extended_color_support(): 9f6. to indicate whether
     extended color support is provided by the underlying ncurses
     library.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36982


File: python.info,  Node: Core and Builtins<147>,  Next: ライブラリ<150>,  Prev: ライブラリ<149>,  Up: Python 3 10 0 alpha 1

1.24.50.30 Core and Builtins
............................

   - bpo-19569(1): Add the private macros ‘_Py_COMP_DIAG_PUSH’,
     ‘_Py_COMP_DIAG_IGNORE_DEPR_DECLS’, and ‘_Py_COMP_DIAG_POP’.

   - bpo-26680(2): The int type now supports the x.is_integer() method
     for compatibility with float.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19569

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26680


File: python.info,  Node: ライブラリ<150>,  Next: ドキュメント<44>,  Prev: Core and Builtins<147>,  Up: Python 3 10 0 alpha 1

1.24.50.31 ライブラリ
.....................

   - bpo-41900(1): C14N 2.0 serialisation in xml.etree.ElementTree
     failed for unprefixed attributes when a default namespace was
     defined.

   - bpo-41887(2): Strip leading spaces and tabs on *note
     ast.literal_eval(): e12.  Also document stripping of spaces and
     tabs for *note eval(): 4a3.

   - bpo-41773(3): Note in documentation that *note random.choices():
     ec1. doesn't support non-finite weights, raise *note ValueError:
     2ec. when given non-finite weights.

   - bpo-41840(4): Fix a bug in the *note symtable: de. module that was
     causing module-scope global variables to not be reported as both
     local and global.  Patch by Pablo Galindo.

   - bpo-41842(5): Add *note codecs.unregister(): 9e9. function to
     unregister a codec search function.

   - bpo-40564(6): In ‘zipfile.Path’, mutate the passed ZipFile object
     type instead of making a copy.  Prevents issues when both the local
     copy and the caller’s copy attempt to close the same file handle.

   - bpo-40670(7): More reliable validation of statements in *note
     timeit.Timer: 16e1.  It now accepts "empty" statements (only
     whitespaces and comments) and rejects misindentent statements.

   - bpo-41833(8): The *note threading.Thread: 176. constructor now uses
     the target name if the 'target' argument is specified but the
     'name' argument is omitted.

   - bpo-41817(9): fix ‘tkinter.EventType’ Enum so all members are
     strings, and none are tuples

   - bpo-41810(10): *note types.EllipsisType: a51, *note
     types.NotImplementedType: a53. and *note types.NoneType: a52. have
     been reintroduced, providing a new set of types readily
     interpretable by static type checkers.

   - bpo-41815(11): Fix SQLite3 segfault when backing up closed
     database.  Patch contributed by Peter David McCormick.

   - bpo-41816(12): StrEnum added: it ensures that all members are
     already strings or string candidates

   - bpo-41517(13): fix bug allowing Enums to be extended via multiple
     inheritance

   - bpo-39587(14): use the correct mix-in data type when constructing
     Enums

   - bpo-41792(15): Add is_typeddict function to typing.py to check if a
     type is a TypedDict class

     Previously there was no way to check that without using private
     API.  See the relevant issue in python/typing(16).

   - bpo-41789(17): Honor ‘object’ overrides in ‘Enum’ class creation
     (specifically, ‘__str__’, ‘__repr__’, ‘__format__’, and
     ‘__reduce_ex__’).

   - bpo-32218(18): ‘enum.Flag’ and ‘enum.IntFlag’ members are now
     iterable.

   - bpo-39651(19): Fix a race condition in the ‘call_soon_threadsafe()’
     method of ‘asyncio.ProactorEventLoop’: do nothing if the self-pipe
     socket has been closed.

   - bpo-1635741(20): Port the ‘mashal’ extension module to the
     multi-phase initialization API ( PEP 489(21)).

   - bpo-1635741(22): Port the ‘_string’ extension module to the
     multi-phase initialization API ( PEP 489(23)).

   - bpo-41732(24): Added an *note iterator: 4c8. to *note memoryview:
     165.

   - bpo-41720(25): Fixed ‘turtle.Vec2D.__rmul__()’ for arguments which
     are not int or float.

   - bpo-41696(26): Fix handling of debug mode in *note asyncio.run():
     2f3.  This allows setting ‘PYTHONASYNCIODEBUG’ or ‘-X dev’ to
     enable asyncio debug mode when using *note asyncio.run(): 2f3.

   - bpo-41687(27): Fix implementation of sendfile to be compatible with
     Solaris.

   - bpo-41662(28): No longer override exceptions raised in ‘__len__()’
     of a sequence of parameters in *note sqlite3: d4. with *note
     ProgrammingError: 305.

   - bpo-39010(29): Restarting a ‘ProactorEventLoop’ on Windows no
     longer logs spurious ‘ConnectionResetErrors’.

   - bpo-41638(30): *note ProgrammingError: 305. message for absent
     parameter in *note sqlite3: d4. contains now the name of the
     parameter instead of its index when parameters are supplied as a
     dict.

   - bpo-41662(31): Fixed crash when mutate list of parameters during
     iteration in *note sqlite3: d4.

   - bpo-41513(32): Improved the accuracy of math.hypot().  Internally,
     each step is computed with extra precision so that the result is
     now almost always correctly rounded.

   - bpo-41609(33): The pdb whatis command correctly reports instance
     methods as 'Method' rather than 'Function'.

   - bpo-39994(34): Fixed pprint's handling of dict subclasses that
     override __repr__.

   - bpo-32751(35): When cancelling the task due to a timeout, *note
     asyncio.wait_for(): 815. will now wait until the cancellation is
     complete also in the case when 'timeout' is <= 0, like it does with
     positive timeouts.

   - bpo-37658(36): *note asyncio.wait_for(): 815. now properly handles
     races between cancellation of itself and the completion of the
     wrapped awaitable.

   - bpo-40782(37): Change the method
     asyncio.AbstractEventLoop.run_in_executor to not be a coroutine.

   - bpo-41520(38): Fix *note codeop: 1d. regression that prevented
     turning compile warnings into errors.

   - bpo-41528(39): turtle uses math module functions to convert degrees
     to radians and vice versa and to calculate vector norm

   - bpo-41513(40): Minor algorithmic improvement to math.hypot() and
     math.dist() giving small gains in speed and accuracy.

   - bpo-41503(41): Fixed a race between setTarget and flush in
     logging.handlers.MemoryHandler.

   - bpo-41497(42): Fix potential UnicodeDecodeError in dis module.

   - bpo-41467(43): On Windows, fix asyncio ‘recv_into()’ return value
     when the socket/pipe is closed (*note BrokenPipeError: 1267.):
     return ‘0’ rather than an empty byte string (‘b''’).

   - bpo-41425(44): Make tkinter doc example runnable.

   - bpo-41421(45): Make an algebraic simplification to
     random.paretovariate().  It now is slightly less subject to
     round-off error and is slightly faster.  Inputs that used to cause
     ZeroDivisionError now cause an OverflowError instead.

   - bpo-41440(46): Add *note os.cpu_count(): 4db. support for VxWorks
     RTOS.

   - bpo-41316(47): Fix the *note tarfile: e4. module to write only
     basename of TAR file to GZIP compression header.

   - bpo-41384(48): Raise TclError instead of TypeError when an unknown
     option is passed to tkinter.OptionMenu.

   - bpo-41317(49): Use add_done_callback() in
     asyncio.loop.sock_accept() to unsubscribe reader early on
     cancellation.

   - bpo-41364(50): Reduce import overhead of *note uuid: 116.

   - bpo-35328(51): Set the environment variable ‘VIRTUAL_ENV_PROMPT’ at
     *note venv: 117. activation.

   - bpo-41341(52): Recursive evaluation of ‘typing.ForwardRef’ in
     ‘get_type_hints’.

   - bpo-41344(53): Prevent creating ‘shared_memory.SharedMemory’
     objects with ‘size=0’.

   - bpo-41333(54): ‘collections.OrderedDict.pop()’ is now 2 times
     faster.

   - bpo-41288(55): Unpickling invalid NEWOBJ_EX opcode with the C
     implementation raises now UnpicklingError instead of crashing.

   - bpo-39017(56): Avoid infinite loop when reading specially crafted
     TAR files using the tarfile module ( CVE 2019-20907(57)).

   - bpo-41273(58): Speed up any transport using
     ‘_ProactorReadPipeTransport’ by calling ‘recv_into’ instead of
     ‘recv’, thus not creating a new buffer for each ‘recv’ call in the
     transport's read loop.

   - bpo-41235(59): Fix the error handling in *note
     ssl.SSLContext.load_dh_params(): 135a.

   - bpo-41207(60): In distutils.spawn, restore expectation that
     DistutilsExecError is raised when the command is not found.

   - bpo-29727(61): Register *note array.array: 4be. as a *note
     MutableSequence: 4bf.  Patch by Pablo Galindo.

   - bpo-39168(62): Remove the ‘__new__’ method of *note typing.Generic:
     17b6.

   - bpo-41194(63): Fix a crash in the ‘_ast’ module: it can no longer
     be loaded more than once.  It now uses a global state rather than a
     module state.

   - bpo-41195(64): Add read-only ssl.SSLContext.security_level
     attribute to retrieve the context's security level.

   - bpo-41193(65): The ‘write_history()’ atexit function of the
     readline completer now ignores any *note OSError: 2c0. to ignore
     error if the filesystem is read-only, instead of only ignoring
     *note FileNotFoundError: 264. and *note PermissionError: f3e.

   - bpo-41182(66): selector: use DefaultSelector based upon
     implementation

   - bpo-41161(67): The decimal module now requires libmpdec-2.5.0.
     Users of -with-system-libmpdec should update their system library.

   - bpo-40874(68): The decimal module now requires libmpdec-2.5.0.

   - bpo-41138(69): Fixed the *note trace: 103. module CLI for Python
     source files with non-UTF-8 encoding.

   - bpo-31082(70): Use the term "iterable" in the docstring for *note
     functools.reduce(): 21a.

   - bpo-40521(71): Remove freelist from collections.deque().

   - bpo-31938(72): Fix default-value signatures of several functions in
     the *note select: c6. module - by Anthony Sottile.

   - bpo-41068(73): Fixed reading files with non-ASCII names from ZIP
     archive directly after writing them.

   - bpo-41058(74): ‘pdb.find_function()’ now correctly determines the
     source file encoding.

   - bpo-41056(75): Invalid file descriptor values are now prevented
     from being passed to os.fpathconf.  (discovered by Coverity)

   - bpo-41056(76): Fix a NULL pointer dereference within the ssl module
     during a MemoryError in the keylog callback.  (discovered by
     Coverity)

   - bpo-41056(77): Fixed an instance where a MemoryError within the
     zoneinfo module might not be reported or not reported at its
     source.  (found by Coverity)

   - bpo-41048(78): *note mimetypes.read_mime_types(): 1d2a. function
     reads the rule file using UTF-8 encoding, not the locale encoding.
     Patch by Srinivas Reddy Thatiparthy.

   - bpo-41043(79): Fixed the use of *note glob(): 5a0. in the stdlib:
     literal part of the path is now always correctly escaped.

   - bpo-41025(80): Fixed an issue preventing the C implementation of
     *note zoneinfo.ZoneInfo: adc. from being subclassed.

   - bpo-35018(81): Add the *note xml.sax.handler.LexicalHandler: a5c.
     class that is present in other SAX XML implementations.

   - bpo-41002(82): Improve performance of HTTPResponse.read with a
     given amount.  Patch by Bruce Merry.

   - bpo-40448(83): *note ensurepip: 59. now disables the use of ‘pip’
     cache when installing the bundled versions of ‘pip’ and
     ‘setuptools’.  Patch by Krzysztof Konopko.

   - bpo-40967(84): Removed ‘asyncio.Task.current_task()’ and
     ‘asyncio.Task.all_tasks()’.  Patch contributed by Rémi Lapeyre.

   - bpo-40924(85): Ensure ‘importlib.resources.path’ returns an extant
     path for the SourceFileLoader's resource reader.  Avoids the
     regression identified in master while a long-term solution is
     devised.

   - bpo-40955(86): Fix a minor memory leak in *note subprocess: dc.
     module when extra_groups was specified.

   - bpo-40855(87): The standard deviation and variance functions in the
     statistics module were ignoring their mu and xbar arguments.

   - bpo-40939(88): Use the new PEG parser when generating the stdlib
     *note keyword: 88. module.

   - bpo-23427(89): Add *note sys.orig_argv: a41. attribute: the list of
     the original command line arguments passed to the Python
     executable.

   - bpo-33689(90): Ignore empty or whitespace-only lines in .pth files.
     This matches the documentated behavior.  Before, empty lines caused
     the site-packages dir to appear multiple times in sys.path.  By Ido
     Michael, contributors Malcolm Smith and Tal Einat.

   - bpo-40884(91): Added a ‘defaults’ parameter to *note
     logging.Formatter: 16b0, to allow specifying default values for
     custom fields.  Patch by Asaf Alon and Bar Harel.

   - bpo-40876(92): Clarify error message in the *note csv: 2d. module.

   - bpo-39791(93): Refresh importlib.metadata from importlib_metadata
     1.6.1.

   - bpo-40807(94): Stop codeop._maybe_compile, used by
     code.InteractiveInterpreter (and IDLE). from emitting each warning
     three times.

   - bpo-32604(95): Fix reference leak in the *note select: c6. module
     when the module is imported in a subinterpreter.

   - bpo-39791(96): Built-in loaders (SourceFileLoader and ZipImporter)
     now supply ‘TraversableResources’ implementations for
     ‘ResourceReader’, and the fallback function has been removed.

   - bpo-39314(97): *note rlcompleter.Completer: 1d2b. and the standard
     Python shell now close the parenthesis for functions that take no
     arguments.  Patch contributed by Rémi Lapeyre.

   - bpo-17005(98): The topological sort functionality that was
     introduced initially in the *note functools: 63. module has been
     moved to a new *note graphlib: 69. module to better accommodate the
     new tools and keep the original scope of the *note functools: 63.
     module.  Patch by Pablo Galindo

   - bpo-40834(99): Fix truncate when sending str object
     with_xxsubinterpreters.channel_send.

   - bpo-40755(100): Add rich comparisons to collections.Counter().

   - bpo-26407(101): Unexpected errors in calling the ‘__iter__’ method
     are no longer masked by ‘TypeError’ in *note csv.reader(): 6ae,
     ‘csv.writer.writerow()’ and ‘csv.writer.writerows()’.

   - bpo-39384(102): Fixed email.contentmanager to allow set_content()
     to set a null string.

   - bpo-40744(103): The *note sqlite3: d4. module uses SQLite API
     functions that require SQLite v3.7.3 or higher.  This patch removes
     support for older SQLite versions, and explicitly requires SQLite
     3.7.3 both at build, compile and runtime.  Patch by Sergey Fedoseev
     and Erlend E. Aasland.

   - bpo-40777(104): Initialize PyDateTime_IsoCalendarDateType.tp_base
     at run-time to avoid errors on some compilers.

   - bpo-38488(105): Update ensurepip to install pip 20.1.1 and
     setuptools 47.1.0.

   - bpo-40792(106): The result of *note operator.index(): 1cd2. now
     always has exact type *note int: 19b.  Previously, the result could
     have been an instance of a subclass of ‘int’.

   - bpo-40767(107): *note webbrowser: 11b. now properly finds the
     default browser in pure Wayland systems by checking the
     WAYLAND_DISPLAY environment variable.  Patch contributed by Jérémy
     Attali.

   - bpo-40791(108): ‘hashlib.compare_digest()’ uses OpenSSL's
     ‘CRYPTO_memcmp()’ function when OpenSSL is available.

   - bpo-40795(109): *note ctypes: 2e. module: If ctypes fails to
     convert the result of a callback or if a ctypes callback function
     raises an exception, sys.unraisablehook is now called with an
     exception set.  Previously, the error was logged into stderr by
     *note PyErr_Print(): 1d2c.

   - bpo-16995(110): Add *note base64.b32hexencode(): 9e4. and *note
     base64.b32hexdecode(): 9e5. to support the Base32 Encoding with
     Extended Hex Alphabet.

   - bpo-30008(111): Fix *note ssl: d5. code to be compatible with
     OpenSSL 1.1.x builds that use ‘no-deprecated’ and ‘--api=1.1.0’.

   - bpo-30064(112): Fix asyncio ‘loop.sock_*’ race condition issue

   - bpo-40759(113): Deprecate the ‘symbol’ module.

   - bpo-40756(114): The second argument (extra) of
     ‘LoggerAdapter.__init__’ now defaults to None.

   - bpo-37129(115): Add a new *note os.RWF_APPEND: 1d2d. flag for *note
     os.pwritev(): d57.

   - bpo-40737(116): Fix possible reference leak for *note sqlite3: d4.
     initialization.

   - bpo-40726(117): Handle cases where the ‘end_lineno’ is ‘None’ on
     *note ast.increment_lineno(): 1b0d.

   - bpo-40698(118): ‘distutils’ upload creates SHA2-256 and Blake2b-256
     digests.  MD5 digests is skipped if platform blocks MD5.

   - bpo-40695(119): *note hashlib: 6c. no longer falls back to builtin
     hash implementations when OpenSSL provides a hash digest and the
     algorithm is blocked by security policy.

   - bpo-9216(120): *note hashlib.new(): 1d2e. passed ‘usedforsecurity’
     to OpenSSL EVP constructor ‘_hashlib.new()’.  test_hashlib and
     test_smtplib handle strict security policy better.

   - bpo-40614(121): *note ast.parse(): 1c2. will not parse self
     documenting expressions in f-strings when passed ‘feature_version’
     is less than ‘(3, 8)’.

   - bpo-40626(122): Add h5 file extension as MIME Type
     application/x-hdf5, as per HDF Group recommendation for HDF5
     formatted data files.  Patch contributed by Mark Schwab.

   - bpo-25920(123): On macOS, when building Python for macOS 10.4 and
     older, which wasn't the case for python.org macOS installer, *note
     socket.getaddrinfo(): 1ac3. no longer uses an internal lock to
     prevent race conditions when calling ‘getaddrinfo()’ which is
     thread-safe since macOS 10.5.  Python 3.9 requires macOS 10.6 or
     newer.  The internal lock caused random hang on fork when another
     thread was calling *note socket.getaddrinfo(): 1ac3.  The lock was
     also used on FreeBSD older than 5.3, OpenBSD older than 201311 and
     NetBSD older than 4.

   - bpo-40671(124): Prepare ‘_hashlib’ for PEP 489(125) and use *note
     PyModule_AddType(): b6c.

   - bpo-32309(126): Added a new *note coroutine: 6b9. *note
     asyncio.to_thread(): ae5.  It is mainly used for running IO-bound
     functions in a separate thread to avoid blocking the event loop,
     and essentially works as a high-level version of *note
     run_in_executor(): ae6. that can directly take keyword arguments.

   - bpo-36543(127): Restored the deprecated ‘xml.etree.cElementTree’
     module.

   - bpo-40611(128): *note MAP_POPULATE: 1d2f. constant has now been
     added to the list of exported *note mmap: 94. module flags.

   - bpo-39881(129): PEP 554 for use in the test suite.  (Patch By
     Joannah Nanjekye)

   - bpo-13097(130): ‘ctypes’ now raises an ‘ArgumentError’ when a
     callback is invoked with more than 1024 arguments.

   - bpo-39385(131): A new test assertion context-manager,
     ‘unittest.assertNoLogs()’ will ensure a given block of code emits
     no log messages using the logging module.  Contributed by Kit Yan
     Choi.

   - bpo-23082(132): Updated the error message and docs of
     PurePath.relative_to() to better reflect the function behaviour.

   - bpo-40318(133): Use SQLite3 trace v2 API, if it is available.

   - bpo-40105(134): ZipFile truncates files to avoid corruption when a
     shorter comment is provided in append ("a") mode.  Patch by Jan
     Mazur.

   - bpo-40084(135): Fix ‘Enum.__dir__’: dir(Enum.member) now includes
     attributes as well as methods.

   - bpo-31122(136): ssl.wrap_socket() now raises ssl.SSLEOFError rather
     than OSError when peer closes connection during TLS negotiation

   - bpo-39728(137): fix default ‘_missing_’ so a duplicate ‘ValueError’
     is not set as the ‘__context__’ of the original ‘ValueError’.

   - bpo-39244(138): Fixed
     ‘multiprocessing.context.get_all_start_methods’ to properly return
     the default method first on macOS.

   - bpo-39040(139): Fix parsing of invalid mime headers parameters by
     collapsing whitespace between encoded words in a bare-quote-string.

   - bpo-38731(140): Add ‘--quiet’ option to command-line interface of
     *note py_compile: b8.  Patch by Gregory Schevchenko.

   - bpo-35714(141): *note struct.error: 153b. is now raised if there is
     a null character in a *note struct: db. format string.

   - bpo-38144(142): Added the 'root_dir' and 'dir_fd' parameters in
     *note glob.glob(): 5a0.

   - bpo-26543(143): Fix ‘IMAP4.noop()’ when debug mode is enabled (ex:
     ‘imaplib.Debug = 3’).

   - bpo-12178(144): *note csv.writer(): 6af. now correctly escapes
     'escapechar' when input contains 'escapechar'.  Patch by Catalin
     Iacob, Berker Peksag, and Itay Elbirt.

   - bpo-36290(145): AST nodes are now raising *note TypeError: 198. on
     conflicting keyword arguments.  Patch contributed by Rémi Lapeyre.

   - bpo-33944(146): Added site.py site-packages tracing in verbose
     mode.

   - bpo-35078(147): Refactor formatweekday, formatmonthname methods in
     LocaleHTMLCalendar and LocaleTextCalendar classes in calendar
     module to call the base class methods.This enables customizable CSS
     classes for LocaleHTMLCalendar.  Patch by Srinivas Reddy
     Thatiparthy

   - bpo-29620(148): *note assertWarns(): 137c. no longer raises a
     ‘RuntimeException’ when accessing a module's ‘__warningregistry__’
     causes importation of a new module, or when a new module is
     imported in another thread.  Patch by Kernc.

   - bpo-31844(149): Remove ‘ParserBase.error()’ method from the private
     and undocumented ‘_markupbase’ module.  *note
     html.parser.HTMLParser: a77. is the only subclass of ‘ParserBase’
     and its ‘error()’ implementation was deprecated in Python 3.4 and
     removed in Python 3.5.

   - bpo-34226(150): Fix ‘cgi.parse_multipart’ without content_length.
     Patch by Roger Duran

   - bpo-33660(151): Fix pathlib.PosixPath to resolve a relative path
     located on the root directory properly.

   - bpo-28557(152): Improve the error message for a misbehaving
     ‘rawio.readinto’

   - bpo-26680(153): The d.is_integer() method is added to the Decimal
     type, for compatibility with other number types.

   - bpo-26680(154): The x.is_integer() method is incorporated into the
     abstract types of the numeric tower, Real, Rational and Integral,
     with appropriate default implementations.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41900

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41887

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41773

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41840

   (5) https://bugs.python.org/issue?@action=redirect&bpo=41842

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40564

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40670

   (8) https://bugs.python.org/issue?@action=redirect&bpo=41833

   (9) https://bugs.python.org/issue?@action=redirect&bpo=41817

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41810

   (11) https://bugs.python.org/issue?@action=redirect&bpo=41815

   (12) https://bugs.python.org/issue?@action=redirect&bpo=41816

   (13) https://bugs.python.org/issue?@action=redirect&bpo=41517

   (14) https://bugs.python.org/issue?@action=redirect&bpo=39587

   (15) https://bugs.python.org/issue?@action=redirect&bpo=41792

   (16) https://github.com/python/typing/issues/751

   (17) https://bugs.python.org/issue?@action=redirect&bpo=41789

   (18) https://bugs.python.org/issue?@action=redirect&bpo=32218

   (19) https://bugs.python.org/issue?@action=redirect&bpo=39651

   (20) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (21) https://peps.python.org/pep-0489/

   (22) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (23) https://peps.python.org/pep-0489/

   (24) https://bugs.python.org/issue?@action=redirect&bpo=41732

   (25) https://bugs.python.org/issue?@action=redirect&bpo=41720

   (26) https://bugs.python.org/issue?@action=redirect&bpo=41696

   (27) https://bugs.python.org/issue?@action=redirect&bpo=41687

   (28) https://bugs.python.org/issue?@action=redirect&bpo=41662

   (29) https://bugs.python.org/issue?@action=redirect&bpo=39010

   (30) https://bugs.python.org/issue?@action=redirect&bpo=41638

   (31) https://bugs.python.org/issue?@action=redirect&bpo=41662

   (32) https://bugs.python.org/issue?@action=redirect&bpo=41513

   (33) https://bugs.python.org/issue?@action=redirect&bpo=41609

   (34) https://bugs.python.org/issue?@action=redirect&bpo=39994

   (35) https://bugs.python.org/issue?@action=redirect&bpo=32751

   (36) https://bugs.python.org/issue?@action=redirect&bpo=37658

   (37) https://bugs.python.org/issue?@action=redirect&bpo=40782

   (38) https://bugs.python.org/issue?@action=redirect&bpo=41520

   (39) https://bugs.python.org/issue?@action=redirect&bpo=41528

   (40) https://bugs.python.org/issue?@action=redirect&bpo=41513

   (41) https://bugs.python.org/issue?@action=redirect&bpo=41503

   (42) https://bugs.python.org/issue?@action=redirect&bpo=41497

   (43) https://bugs.python.org/issue?@action=redirect&bpo=41467

   (44) https://bugs.python.org/issue?@action=redirect&bpo=41425

   (45) https://bugs.python.org/issue?@action=redirect&bpo=41421

   (46) https://bugs.python.org/issue?@action=redirect&bpo=41440

   (47) https://bugs.python.org/issue?@action=redirect&bpo=41316

   (48) https://bugs.python.org/issue?@action=redirect&bpo=41384

   (49) https://bugs.python.org/issue?@action=redirect&bpo=41317

   (50) https://bugs.python.org/issue?@action=redirect&bpo=41364

   (51) https://bugs.python.org/issue?@action=redirect&bpo=35328

   (52) https://bugs.python.org/issue?@action=redirect&bpo=41341

   (53) https://bugs.python.org/issue?@action=redirect&bpo=41344

   (54) https://bugs.python.org/issue?@action=redirect&bpo=41333

   (55) https://bugs.python.org/issue?@action=redirect&bpo=41288

   (56) https://bugs.python.org/issue?@action=redirect&bpo=39017

   (57) https://www.cve.org/CVERecord?id=CVE-2019-20907

   (58) https://bugs.python.org/issue?@action=redirect&bpo=41273

   (59) https://bugs.python.org/issue?@action=redirect&bpo=41235

   (60) https://bugs.python.org/issue?@action=redirect&bpo=41207

   (61) https://bugs.python.org/issue?@action=redirect&bpo=29727

   (62) https://bugs.python.org/issue?@action=redirect&bpo=39168

   (63) https://bugs.python.org/issue?@action=redirect&bpo=41194

   (64) https://bugs.python.org/issue?@action=redirect&bpo=41195

   (65) https://bugs.python.org/issue?@action=redirect&bpo=41193

   (66) https://bugs.python.org/issue?@action=redirect&bpo=41182

   (67) https://bugs.python.org/issue?@action=redirect&bpo=41161

   (68) https://bugs.python.org/issue?@action=redirect&bpo=40874

   (69) https://bugs.python.org/issue?@action=redirect&bpo=41138

   (70) https://bugs.python.org/issue?@action=redirect&bpo=31082

   (71) https://bugs.python.org/issue?@action=redirect&bpo=40521

   (72) https://bugs.python.org/issue?@action=redirect&bpo=31938

   (73) https://bugs.python.org/issue?@action=redirect&bpo=41068

   (74) https://bugs.python.org/issue?@action=redirect&bpo=41058

   (75) https://bugs.python.org/issue?@action=redirect&bpo=41056

   (76) https://bugs.python.org/issue?@action=redirect&bpo=41056

   (77) https://bugs.python.org/issue?@action=redirect&bpo=41056

   (78) https://bugs.python.org/issue?@action=redirect&bpo=41048

   (79) https://bugs.python.org/issue?@action=redirect&bpo=41043

   (80) https://bugs.python.org/issue?@action=redirect&bpo=41025

   (81) https://bugs.python.org/issue?@action=redirect&bpo=35018

   (82) https://bugs.python.org/issue?@action=redirect&bpo=41002

   (83) https://bugs.python.org/issue?@action=redirect&bpo=40448

   (84) https://bugs.python.org/issue?@action=redirect&bpo=40967

   (85) https://bugs.python.org/issue?@action=redirect&bpo=40924

   (86) https://bugs.python.org/issue?@action=redirect&bpo=40955

   (87) https://bugs.python.org/issue?@action=redirect&bpo=40855

   (88) https://bugs.python.org/issue?@action=redirect&bpo=40939

   (89) https://bugs.python.org/issue?@action=redirect&bpo=23427

   (90) https://bugs.python.org/issue?@action=redirect&bpo=33689

   (91) https://bugs.python.org/issue?@action=redirect&bpo=40884

   (92) https://bugs.python.org/issue?@action=redirect&bpo=40876

   (93) https://bugs.python.org/issue?@action=redirect&bpo=39791

   (94) https://bugs.python.org/issue?@action=redirect&bpo=40807

   (95) https://bugs.python.org/issue?@action=redirect&bpo=32604

   (96) https://bugs.python.org/issue?@action=redirect&bpo=39791

   (97) https://bugs.python.org/issue?@action=redirect&bpo=39314

   (98) https://bugs.python.org/issue?@action=redirect&bpo=17005

   (99) https://bugs.python.org/issue?@action=redirect&bpo=40834

   (100) https://bugs.python.org/issue?@action=redirect&bpo=40755

   (101) https://bugs.python.org/issue?@action=redirect&bpo=26407

   (102) https://bugs.python.org/issue?@action=redirect&bpo=39384

   (103) https://bugs.python.org/issue?@action=redirect&bpo=40744

   (104) https://bugs.python.org/issue?@action=redirect&bpo=40777

   (105) https://bugs.python.org/issue?@action=redirect&bpo=38488

   (106) https://bugs.python.org/issue?@action=redirect&bpo=40792

   (107) https://bugs.python.org/issue?@action=redirect&bpo=40767

   (108) https://bugs.python.org/issue?@action=redirect&bpo=40791

   (109) https://bugs.python.org/issue?@action=redirect&bpo=40795

   (110) https://bugs.python.org/issue?@action=redirect&bpo=16995

   (111) https://bugs.python.org/issue?@action=redirect&bpo=30008

   (112) https://bugs.python.org/issue?@action=redirect&bpo=30064

   (113) https://bugs.python.org/issue?@action=redirect&bpo=40759

   (114) https://bugs.python.org/issue?@action=redirect&bpo=40756

   (115) https://bugs.python.org/issue?@action=redirect&bpo=37129

   (116) https://bugs.python.org/issue?@action=redirect&bpo=40737

   (117) https://bugs.python.org/issue?@action=redirect&bpo=40726

   (118) https://bugs.python.org/issue?@action=redirect&bpo=40698

   (119) https://bugs.python.org/issue?@action=redirect&bpo=40695

   (120) https://bugs.python.org/issue?@action=redirect&bpo=9216

   (121) https://bugs.python.org/issue?@action=redirect&bpo=40614

   (122) https://bugs.python.org/issue?@action=redirect&bpo=40626

   (123) https://bugs.python.org/issue?@action=redirect&bpo=25920

   (124) https://bugs.python.org/issue?@action=redirect&bpo=40671

   (125) https://peps.python.org/pep-0489/

   (126) https://bugs.python.org/issue?@action=redirect&bpo=32309

   (127) https://bugs.python.org/issue?@action=redirect&bpo=36543

   (128) https://bugs.python.org/issue?@action=redirect&bpo=40611

   (129) https://bugs.python.org/issue?@action=redirect&bpo=39881

   (130) https://bugs.python.org/issue?@action=redirect&bpo=13097

   (131) https://bugs.python.org/issue?@action=redirect&bpo=39385

   (132) https://bugs.python.org/issue?@action=redirect&bpo=23082

   (133) https://bugs.python.org/issue?@action=redirect&bpo=40318

   (134) https://bugs.python.org/issue?@action=redirect&bpo=40105

   (135) https://bugs.python.org/issue?@action=redirect&bpo=40084

   (136) https://bugs.python.org/issue?@action=redirect&bpo=31122

   (137) https://bugs.python.org/issue?@action=redirect&bpo=39728

   (138) https://bugs.python.org/issue?@action=redirect&bpo=39244

   (139) https://bugs.python.org/issue?@action=redirect&bpo=39040

   (140) https://bugs.python.org/issue?@action=redirect&bpo=38731

   (141) https://bugs.python.org/issue?@action=redirect&bpo=35714

   (142) https://bugs.python.org/issue?@action=redirect&bpo=38144

   (143) https://bugs.python.org/issue?@action=redirect&bpo=26543

   (144) https://bugs.python.org/issue?@action=redirect&bpo=12178

   (145) https://bugs.python.org/issue?@action=redirect&bpo=36290

   (146) https://bugs.python.org/issue?@action=redirect&bpo=33944

   (147) https://bugs.python.org/issue?@action=redirect&bpo=35078

   (148) https://bugs.python.org/issue?@action=redirect&bpo=29620

   (149) https://bugs.python.org/issue?@action=redirect&bpo=31844

   (150) https://bugs.python.org/issue?@action=redirect&bpo=34226

   (151) https://bugs.python.org/issue?@action=redirect&bpo=33660

   (152) https://bugs.python.org/issue?@action=redirect&bpo=28557

   (153) https://bugs.python.org/issue?@action=redirect&bpo=26680

   (154) https://bugs.python.org/issue?@action=redirect&bpo=26680


File: python.info,  Node: ドキュメント<44>,  Next: テスト<43>,  Prev: ライブラリ<150>,  Up: Python 3 10 0 alpha 1

1.24.50.32 ドキュメント
.......................

   - bpo-41428(1): Add documentation for PEP 604(2) (Allow writing union
     types as ‘X | Y’).

   - bpo-41774(3): In Programming FAQ "Sequences (Tuples/Lists)"
     section, add "How do you remove multiple items from a list".

   - bpo-35293(4): Fix RemovedInSphinx40Warning when building the
     documentation.  Patch by Donghee Na.

   - bpo-37149(5): Change Shipman tkinter doc link from archive.org to
     TkDocs.  (The doc has been removed from the NMT server.)  The new
     link responds much faster and includes a short explanatory note.

   - bpo-41726(6): Update the refcounts info of
     ‘PyType_FromModuleAndSpec’.

   - bpo-41624(7): Fix the signature of *note typing.Coroutine: 1d31.

   - bpo-40204(8): Enable Sphinx 3.2 ‘c_allow_pre_v3’ option and disable
     ‘c_warn_on_allowed_pre_v3’ option to make the documentation
     compatible with Sphinx 2 and Sphinx 3.

   - bpo-41045(9): Add documentation for debug feature of f-strings.

   - bpo-41314(10): Changed the release when ‘from __future__ import
     annotations’ becomes the default from ‘4.0’ to ‘3.10’ (following a
     change in PEP 563).

   - bpo-40979(11): Refactored typing.rst, arranging more than 70
     classes, functions, and decorators into new sub-sections.

   - bpo-40552(12): Fix in tutorial section 4.2.  Code snippet is now
     correct.

   - bpo-39883(13): Make code, examples, and recipes in the Python
     documentation be licensed under the more permissive BSD0 license in
     addition to the existing Python 2.0 license.

   - bpo-37703(14): Updated Documentation to comprehensively elaborate
     on the behaviour of gather.cancel()

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41428

   (2) https://peps.python.org/pep-0604/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41774

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35293

   (5) https://bugs.python.org/issue?@action=redirect&bpo=37149

   (6) https://bugs.python.org/issue?@action=redirect&bpo=41726

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41624

   (8) https://bugs.python.org/issue?@action=redirect&bpo=40204

   (9) https://bugs.python.org/issue?@action=redirect&bpo=41045

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41314

   (11) https://bugs.python.org/issue?@action=redirect&bpo=40979

   (12) https://bugs.python.org/issue?@action=redirect&bpo=40552

   (13) https://bugs.python.org/issue?@action=redirect&bpo=39883

   (14) https://bugs.python.org/issue?@action=redirect&bpo=37703


File: python.info,  Node: テスト<43>,  Next: ビルド<50>,  Prev: ドキュメント<44>,  Up: Python 3 10 0 alpha 1

1.24.50.33 テスト
.................

   - bpo-41939(1): Fix test_site.test_license_exists_at_url(): call
     ‘urllib.request.urlcleanup()’ to reset the global
     ‘urllib.request._opener’.  Patch by Victor Stinner.

   - bpo-41731(2): Make test_cmd_line_script pass with option '-vv'.

   - bpo-41602(3): Add tests for SIGINT handling in the runpy module.

   - bpo-41521(4): *note test.support: ea.: Rename ‘blacklist’ parameter
     of *note check__all__(): 1d33. to ‘not_exported’.

   - bpo-41477(5): Make ctypes optional in test_genericalias.

   - bpo-41085(6): Fix integer overflow in the *note
     array.array.index(): 9e1. method on 64-bit Windows for index larger
     than ‘2**31’.

   - bpo-41069(7): ‘test.support.TESTFN’ and the current directory for
     tests when run via ‘test.regrtest’ contain now non-ascii characters
     if possible.

   - bpo-38377(8): On Linux, skip tests using multiprocessing if the
     current user cannot create a file in ‘/dev/shm/’ directory.  Add
     the *note skip_if_broken_multiprocessing_synchronize(): 1d34.
     function to the *note test.support: ea. module.

   - bpo-41009(9): Fix use of
     ‘support.require_{linux|mac|freebsd}_version()’ decorators as class
     decorator.

   - bpo-41003(10): Fix ‘test_copyreg’ when ‘numpy’ is installed:
     ‘test.pickletester’ now saves/restores warnings filters when
     importing ‘numpy’, to ignore filters installed by ‘numpy’.

   - bpo-40964(11): Disable remote *note imaplib: 78. tests, host
     cyrus.andrew.cmu.edu is blocking incoming connections.

   - bpo-40927(12): Fix test_binhex when run twice: it now uses
     import_fresh_module() to ensure that it raises DeprecationWarning
     each time.

   - bpo-17258(13): Skip some *note multiprocessing: 98. tests when MD5
     hash digest is blocked.

   - bpo-31904(14): Increase LOOPBACK_TIMEOUT to 10 for VxWorks RTOS.

   - bpo-38169(15): Increase code coverage for SharedMemory and
     ShareableList

   - bpo-34401(16): Make test_gdb properly run on HP-UX. Patch by
     Michael Osipov.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41939

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41731

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41602

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41521

   (5) https://bugs.python.org/issue?@action=redirect&bpo=41477

   (6) https://bugs.python.org/issue?@action=redirect&bpo=41085

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41069

   (8) https://bugs.python.org/issue?@action=redirect&bpo=38377

   (9) https://bugs.python.org/issue?@action=redirect&bpo=41009

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41003

   (11) https://bugs.python.org/issue?@action=redirect&bpo=40964

   (12) https://bugs.python.org/issue?@action=redirect&bpo=40927

   (13) https://bugs.python.org/issue?@action=redirect&bpo=17258

   (14) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (15) https://bugs.python.org/issue?@action=redirect&bpo=38169

   (16) https://bugs.python.org/issue?@action=redirect&bpo=34401


File: python.info,  Node: ビルド<50>,  Next: Windows<44>,  Prev: テスト<43>,  Up: Python 3 10 0 alpha 1

1.24.50.34 ビルド
.................

   - bpo-38249(1): Update *note Py_UNREACHABLE: dae. to use
     __builtin_unreachable() if only the compiler is able to use it.
     Patch by Donghee Na.

   - bpo-41617(2): Fix ‘pycore_bitutils.h’ header file to support old
     clang versions: ‘__builtin_bswap16()’ is not available in LLVM
     clang 3.0.

   - bpo-40204(3): Pin Sphinx version to 2.3.1 in ‘Doc/Makefile’.

   - bpo-36020(4): The C99 functions ‘snprintf()’ and ‘vsnprintf()’ are
     now required to build Python.

   - bpo-40684(5): ‘make install’ now uses the ‘PLATLIBDIR’ variable for
     the destination ‘lib-dynload/’ directory when ‘./configure
     --with-platlibdir’ is used.

   - bpo-40683(6): Fixed an issue where the *note zoneinfo: 13a. module
     and its tests were not included when Python is installed with
     ‘make’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38249

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41617

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40204

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36020

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40684

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40683


File: python.info,  Node: Windows<44>,  Next: macOS<34>,  Prev: ビルド<50>,  Up: Python 3 10 0 alpha 1

1.24.50.35 Windows
..................

   - bpo-41744(1): Fixes automatic import of props file when using the
     Nuget package.

   - bpo-41627(2): The user site directory for 32-bit now includes a
     ‘-32’ suffix to distinguish it from the 64-bit interpreter's
     directory.

   - bpo-41526(3): Fixed layout of final page of the installer by
     removing the special thanks to Mark Hammond (with his permission).

   - bpo-41492(4): Fixes the description that appears in UAC prompts.

   - bpo-40948(5): Improve post-install message to direct people to the
     "py" command.

   - bpo-41412(6): The installer will now fail to install on Windows 7
     and Windows 8.  Further, the UCRT dependency is now always
     downloaded on demand.

   - bpo-40741(7): Update Windows release to include SQLite 3.32.3.

   - bpo-41142(8): ‘msilib’ now supports creating CAB files with
     non-ASCII file path and adding files with non-ASCII file path to
     them.

   - bpo-41074(9): Fixed support of non-ASCII names in functions
     ‘msilib.OpenDatabase()’ and ‘msilib.init_database()’ and non-ASCII
     SQL in method ‘msilib.Database.OpenView()’.

   - bpo-41039(10): Stable ABI redirection DLL (python3.dll) now uses
     ‘#pragma comment(linker)’ for re-exporting.

   - bpo-40164(11): Updates Windows OpenSSL to 1.1.1g

   - bpo-39631(12): Changes the registered MIME type for ‘.py’ files on
     Windows to ‘text/x-python’ instead of ‘text/plain’.

   - bpo-40677(13): Manually define IO_REPARSE_TAG_APPEXECLINK in case
     some old Windows SDK doesn't have it.

   - bpo-37556(14): Extend py.exe help to mention overrides via venv,
     shebang, environmental variables & ini files.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41744

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41627

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41526

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41492

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40948

   (6) https://bugs.python.org/issue?@action=redirect&bpo=41412

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40741

   (8) https://bugs.python.org/issue?@action=redirect&bpo=41142

   (9) https://bugs.python.org/issue?@action=redirect&bpo=41074

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41039

   (11) https://bugs.python.org/issue?@action=redirect&bpo=40164

   (12) https://bugs.python.org/issue?@action=redirect&bpo=39631

   (13) https://bugs.python.org/issue?@action=redirect&bpo=40677

   (14) https://bugs.python.org/issue?@action=redirect&bpo=37556


File: python.info,  Node: macOS<34>,  Next: IDLE<26>,  Prev: Windows<44>,  Up: Python 3 10 0 alpha 1

1.24.50.36 macOS
................

   - bpo-41557(1): Update macOS installer to use SQLite 3.33.0.

   - bpo-39580(2): Avoid opening Finder window if running installer from
     the command line.  Patch contributed by Rick Heil.

   - bpo-41100(3): Fix configure error when building on macOS 11.  Note
     that the current Python release was released shortly after the
     first developer preview of macOS 11 (Big Sur); there are other
     known issues with building and running on the developer preview.
     Big Sur is expected to be fully supported in a future bugfix
     release of Python 3.8.x and with 3.9.0.

   - bpo-40741(4): Update macOS installer to use SQLite 3.32.3.

   - bpo-41005(5): fixed an XDG settings issue not allowing macos to
     open browser in webbrowser.py

   - bpo-40741(6): Update macOS installer to use SQLite 3.32.2.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41557

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39580

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41100

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40741

   (5) https://bugs.python.org/issue?@action=redirect&bpo=41005

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40741


File: python.info,  Node: IDLE<26>,  Next: C API<45>,  Prev: macOS<34>,  Up: Python 3 10 0 alpha 1

1.24.50.37 IDLE
...............

   - bpo-41775(1): Use 'IDLE Shell' as shell title

   - bpo-35764(2): Rewrite the Calltips doc section.

   - bpo-40181(3): In calltips, stop reminding that '/' marks the end of
     positional-only arguments.

   - bpo-41468(4): Improve IDLE run crash error message (which users
     should never see).

   - bpo-41373(5): Save files loaded with no line ending, as when blank,
     or different line endings, by setting its line ending to the system
     default.  Fix regression in 3.8.4 and 3.9.0b4.

   - bpo-41300(6): Save files with non-ascii chars.  Fix regression
     released in 3.9.0b4 and 3.8.4.

   - bpo-37765(7): Add keywords to module name completion list.  Rewrite
     Completions section of IDLE doc.

   - bpo-41152(8): The encoding of ‘stdin’, ‘stdout’ and ‘stderr’ in
     IDLE is now always UTF-8.

   - bpo-41144(9): Make Open Module open a special module such as
     os.path.

   - bpo-39885(10): Make context menu Cut and Copy work again when
     right-clicking within a selection.

   - bpo-40723(11): Make test_idle pass when run after import.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41775

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35764

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40181

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41468

   (5) https://bugs.python.org/issue?@action=redirect&bpo=41373

   (6) https://bugs.python.org/issue?@action=redirect&bpo=41300

   (7) https://bugs.python.org/issue?@action=redirect&bpo=37765

   (8) https://bugs.python.org/issue?@action=redirect&bpo=41152

   (9) https://bugs.python.org/issue?@action=redirect&bpo=41144

   (10) https://bugs.python.org/issue?@action=redirect&bpo=39885

   (11) https://bugs.python.org/issue?@action=redirect&bpo=40723


File: python.info,  Node: C API<45>,  Prev: IDLE<26>,  Up: Python 3 10 0 alpha 1

1.24.50.38 C API
................

   - bpo-41936(1): Removed undocumented macros ‘Py_ALLOW_RECURSION’ and
     ‘Py_END_ALLOW_RECURSION’ and the ‘recursion_critical’ field of the
     *note PyInterpreterState: aba. structure.

   - bpo-41692(2): The ‘PyUnicode_InternImmortal()’ function is now
     deprecated and will be removed in Python 3.12: use *note
     PyUnicode_InternInPlace(): aae. instead.  Patch by Victor Stinner.

   - bpo-41842(3): Add *note PyCodec_Unregister(): a97. function to
     unregister a codec search function.

   - bpo-41834(4): Remove the ‘_Py_CheckRecursionLimit’ variable: it has
     been replaced by ‘ceval.recursion_limit’ of the *note
     PyInterpreterState: aba. structure.  Patch by Victor Stinner.

   - bpo-41689(5): Types created with *note PyType_FromSpec(): 79d. now
     make any signature in their ‘tp_doc’ slot accessible from
     ‘__text_signature__’.

   - bpo-41524(6): Fix bug in *note PyOS_mystrnicmp(): 1d3a. and *note
     PyOS_mystricmp(): 1d3b. that incremented pointers beyond the end of
     a string.

   - bpo-41324(7): Add a minimal decimal capsule API. The API supports
     fast conversions between Decimals up to 38 digits and their triple
     representation as a C struct.

   - bpo-30155(8): Add *note PyDateTime_DATE_GET_TZINFO(): a95. and
     *note PyDateTime_TIME_GET_TZINFO(): a96. macros for accessing the
     ‘tzinfo’ attributes of *note datetime.datetime: 4e2. and *note
     datetime.time: 1fb. objects.

   - bpo-40170(9): Revert *note PyType_HasFeature(): 1d3c. change: it
     reads again directly the *note PyTypeObject.tp_flags: 1c71. member
     when the limited C API is not used, rather than always calling
     *note PyType_GetFlags(): 1d3d. which hides implementation details.

   - bpo-41123(10): Remove ‘PyUnicode_AsUnicodeCopy’.

   - bpo-41123(11): Removed ‘PyLong_FromUnicode()’.

   - bpo-41123(12): Removed ‘PyUnicode_GetMax()’.

   - bpo-41123(13): Removed ‘Py_UNICODE_str*’ functions manipulating
     ‘Py_UNICODE*’ strings.

   - bpo-41103(14): ‘PyObject_AsCharBuffer()’,
     ‘PyObject_AsReadBuffer()’, ‘PyObject_CheckReadBuffer()’, and
     ‘PyObject_AsWriteBuffer()’ are removed.  Please migrate to new
     buffer protocol; *note PyObject_GetBuffer(): 63a. and *note
     PyBuffer_Release(): 63b.

   - bpo-36346(15): Raises DeprecationWarning for
     ‘PyUnicode_FromUnicode(NULL, size)’ and
     ‘PyUnicode_FromStringAndSize(NULL, size)’ with ‘size > 0’.

   - bpo-36346(16): Mark ‘Py_UNICODE_COPY’, ‘Py_UNICODE_FILL’,
     ‘PyUnicode_WSTR_LENGTH’, ‘PyUnicode_FromUnicode’,
     ‘PyUnicode_AsUnicode’, and ‘PyUnicode_AsUnicodeAndSize’ as
     deprecated in C. Remove ‘Py_UNICODE_MATCH’ which was deprecated and
     broken since Python 3.3.

   - bpo-40989(17): The *note PyObject_INIT(): 1d3e. and *note
     PyObject_INIT_VAR(): 1d3f. macros become aliases to, respectively,
     *note PyObject_Init(): c60. and *note PyObject_InitVar(): 1d40.
     functions.

   - bpo-36020(18): On Windows, ‘#include "pyerrors.h"’ no longer
     defines ‘snprintf’ and ‘vsnprintf’ macros.

   - bpo-40943(19): The ‘PY_SSIZE_T_CLEAN’ macro must now be defined to
     use *note PyArg_ParseTuple(): 3c1. and *note Py_BuildValue(): 3c2.
     formats which use ‘#’: ‘es#’, ‘et#’, ‘s#’, ‘u#’, ‘y#’, ‘z#’, ‘U#’
     and ‘Z#’.  See *note Parsing arguments and building values: 3d5.
     and the PEP 353(20).

   - bpo-40910(21): Export explicitly the *note Py_GetArgcArgv(): 1d41.
     function to the C API and document the function.  Previously, it
     was exported implicitly which no longer works since Python is built
     with ‘-fvisibility=hidden’.

   - bpo-40724(22): Allow defining buffer slots in type specs.

   - bpo-40679(23): Fix a ‘_PyEval_EvalCode()’ crash if 'qualname'
     argument is NULL.

   - bpo-40839(24): Calling *note PyDict_GetItem(): 628. without *note
     GIL: 164. held had been allowed for historical reason.  It is no
     longer allowed.

   - bpo-40826(25): *note PyOS_InterruptOccurred(): 1d42. now fails with
     a fatal error if it is called with the GIL released.

   - bpo-40792(26): The result of *note PyNumber_Index(): a93. now
     always has exact type *note int: 19b.  Previously, the result could
     have been an instance of a subclass of ‘int’.

   - bpo-39573(27): Convert *note Py_REFCNT(): 2cf. and *note Py_SIZE():
     985. macros to static inline functions.  They cannot be used as
     l-value anymore: use *note Py_SET_REFCNT(): aa8. and *note
     Py_SET_SIZE(): 986. to set an object reference count and size.
     This change is backward incompatible on purpose, to prepare the C
     API for an opaque *note PyObject: 5df. structure.

   - bpo-40703(28): The PyType_FromSpec*() functions no longer overwrite
     the type's "__module__" attribute if it is set via "Py_tp_members"
     or "Py_tp_getset".

   - bpo-39583(29): Remove superfluous "extern C" declarations from
     ‘Include/cpython/*.h’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=41936

   (2) https://bugs.python.org/issue?@action=redirect&bpo=41692

   (3) https://bugs.python.org/issue?@action=redirect&bpo=41842

   (4) https://bugs.python.org/issue?@action=redirect&bpo=41834

   (5) https://bugs.python.org/issue?@action=redirect&bpo=41689

   (6) https://bugs.python.org/issue?@action=redirect&bpo=41524

   (7) https://bugs.python.org/issue?@action=redirect&bpo=41324

   (8) https://bugs.python.org/issue?@action=redirect&bpo=30155

   (9) https://bugs.python.org/issue?@action=redirect&bpo=40170

   (10) https://bugs.python.org/issue?@action=redirect&bpo=41123

   (11) https://bugs.python.org/issue?@action=redirect&bpo=41123

   (12) https://bugs.python.org/issue?@action=redirect&bpo=41123

   (13) https://bugs.python.org/issue?@action=redirect&bpo=41123

   (14) https://bugs.python.org/issue?@action=redirect&bpo=41103

   (15) https://bugs.python.org/issue?@action=redirect&bpo=36346

   (16) https://bugs.python.org/issue?@action=redirect&bpo=36346

   (17) https://bugs.python.org/issue?@action=redirect&bpo=40989

   (18) https://bugs.python.org/issue?@action=redirect&bpo=36020

   (19) https://bugs.python.org/issue?@action=redirect&bpo=40943

   (20) https://peps.python.org/pep-0353/

   (21) https://bugs.python.org/issue?@action=redirect&bpo=40910

   (22) https://bugs.python.org/issue?@action=redirect&bpo=40724

   (23) https://bugs.python.org/issue?@action=redirect&bpo=40679

   (24) https://bugs.python.org/issue?@action=redirect&bpo=40839

   (25) https://bugs.python.org/issue?@action=redirect&bpo=40826

   (26) https://bugs.python.org/issue?@action=redirect&bpo=40792

   (27) https://bugs.python.org/issue?@action=redirect&bpo=39573

   (28) https://bugs.python.org/issue?@action=redirect&bpo=40703

   (29) https://bugs.python.org/issue?@action=redirect&bpo=39583


File: python.info,  Node: Python 3 9 0 beta 1,  Next: Python 3 9 0 alpha 6,  Prev: Python 3 10 0 alpha 1,  Up: 変更履歴

1.24.51 Python 3.9.0 beta 1
---------------------------

'リリース日: 2020-05-19'

* Menu:

* セキュリティ: セキュリティ<37>.
* Core and Builtins: Core and Builtins<148>.
* ライブラリ: ライブラリ<151>.
* ドキュメント: ドキュメント<45>.
* テスト: テスト<44>.
* ビルド: ビルド<51>.
* Windows: Windows<45>.
* macOS: macOS<35>.
* Tools/Demos: Tools/Demos<30>.
* C API: C API<46>.


File: python.info,  Node: セキュリティ<37>,  Next: Core and Builtins<148>,  Up: Python 3 9 0 beta 1

1.24.51.1 セキュリティ
......................

   - bpo-40501(1): *note uuid: 116. no longer uses *note ctypes: 2e. to
     load ‘libuuid’ or ‘rpcrt4.dll’ at runtime.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40501


File: python.info,  Node: Core and Builtins<148>,  Next: ライブラリ<151>,  Prev: セキュリティ<37>,  Up: Python 3 9 0 beta 1

1.24.51.2 Core and Builtins
...........................

   - bpo-40663(1): Correctly generate annotations where parentheses are
     omitted but required (e.g: ‘Type[(str, int, *other))]’.

   - bpo-40596(2): Fixed *note str.isidentifier(): 1d46. for
     non-canonicalized strings containing non-BMP characters on Windows.

   - bpo-40593(3): Improved syntax errors for invalid characters in
     source code.

   - bpo-40585(4): Fixed a bug when using *note
     codeop.compile_command(): 1b53. that was causing exceptions to be
     swallowed with the new parser.  Patch by Pablo Galindo

   - bpo-40566(5): Apply PEP 573(6) to *note abc: 4.

   - bpo-40502(7): Initialize ‘n->n_col_offset’.  (Patch by Joannah
     Nanjekye)

   - bpo-40527(8): Fix command line argument parsing: no longer write
     errors multiple times into stderr.

   - bpo-1635741(9): Port *note errno: 5b. to multiphase initialization
     ( PEP 489(10)).

   - bpo-40523(11): Add pass-throughs for *note hash(): 801. and *note
     reversed(): a65. to *note weakref.proxy: c46. objects.  Patch by
     Pablo Galindo.

   - bpo-1635741(12): Port *note syslog: e2. to multiphase
     initialization ( PEP 489(13)).

   - bpo-40246(14): Reporting a specialised error message for invalid
     string prefixes, which was introduced in bpo-40246(15), is being
     reverted due to backwards compatibility concerns for strings that
     immediately follow a reserved keyword without whitespace between
     them.  Constructs like ‘bg="#d00" if clear else"#fca"’ were failing
     to parse, which is not an acceptable breakage on such short notice.

   - bpo-40417(16): Fix imp module deprecation warning when
     PyImport_ReloadModule is called.  Patch by Robert Rouhani.

   - bpo-40408(17): Fixed support of nested type variables in
     GenericAlias (e.g.  ‘list[list[T]]’).

   - bpo-1635741(18): Port _stat module to multiphase initialization (
     PEP 489(19)).

   - bpo-29587(20): Enable implicit exception chaining when calling
     *note generator.throw(): 71c.

   - bpo-40328(21): Add tools for generating mappings headers for
     CJKCodecs.

   - bpo-40228(22): Setting frame.f_lineno is now robust w.r.t.  changes
     in the source-to-bytecode compiler

   - bpo-38880(23): Added the ability to list interpreters associated
     with channel ends in the internal subinterpreters module.

   - bpo-37986(24): Improve performance of *note PyLong_FromDouble():
     b3c. for values that fit into long.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40663

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40596

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40593

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40585

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40566

   (6) https://peps.python.org/pep-0573/

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40502

   (8) https://bugs.python.org/issue?@action=redirect&bpo=40527

   (9) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (10) https://peps.python.org/pep-0489/

   (11) https://bugs.python.org/issue?@action=redirect&bpo=40523

   (12) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (13) https://peps.python.org/pep-0489/

   (14) https://bugs.python.org/issue?@action=redirect&bpo=40246

   (15) https://bugs.python.org/issue?@action=redirect&bpo=40246

   (16) https://bugs.python.org/issue?@action=redirect&bpo=40417

   (17) https://bugs.python.org/issue?@action=redirect&bpo=40408

   (18) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (19) https://peps.python.org/pep-0489/

   (20) https://bugs.python.org/issue?@action=redirect&bpo=29587

   (21) https://bugs.python.org/issue?@action=redirect&bpo=40328

   (22) https://bugs.python.org/issue?@action=redirect&bpo=40228

   (23) https://bugs.python.org/issue?@action=redirect&bpo=38880

   (24) https://bugs.python.org/issue?@action=redirect&bpo=37986


File: python.info,  Node: ライブラリ<151>,  Next: ドキュメント<45>,  Prev: Core and Builtins<148>,  Up: Python 3 9 0 beta 1

1.24.51.3 ライブラリ
....................

   - bpo-40662(1): Fixed *note ast.get_source_segment(): bcb. for ast
     nodes that have incomplete location information.  Patch by Irit
     Katriel.

   - bpo-40665(2): Convert *note bisect: 12. to use Argument Clinic.

   - bpo-40536(3): Added the *note available_timezones(): 1d48. function
     to the *note zoneinfo: 13a. module.  Patch by Paul Ganssle.

   - bpo-40645(4): The *note hmac.HMAC: d33. exposes internal
     implementation details.  The attributes ‘digest_cons’, ‘inner’, and
     ‘outer’ are deprecated and will be removed in the future.

   - bpo-40645(5): The internal module ‘_hashlib’ wraps and exposes
     OpenSSL's HMAC API. The new code will be used in Python 3.10 after
     the internal implementation details of the pure Python HMAC module
     are no longer part of the public API.

   - bpo-40637(6): Builtin hash modules can now be disabled or
     selectively enabled with ‘configure
     --with-builtin-hashlib-hashes=sha3,blake1’ or
     ‘--without-builtin-hashlib-hashes’.

   - bpo-37630(7): The *note hashlib: 6c. module can now use SHA3 hashes
     and SHAKE XOF from OpenSSL when available.

   - bpo-40479(8): The *note hashlib: 6c. now compiles with OpenSSL
     3.0.0-alpha2.

   - bpo-40257(9): Revert changes to *note inspect.getdoc(): bed.

   - bpo-40607(10): When cancelling a task due to timeout, *note
     asyncio.wait_for(): 815. will now propagate the exception if an
     error happens during cancellation.  Patch by Roman Skurikhin.

   - bpo-40612(11): Fix edge cases in SyntaxError formatting.  If the
     offset is <= 0, no caret is printed.  If the offset is > line
     length, the caret is printed pointing just after the last
     character.

   - bpo-40597(12): If text content lines are longer than
     policy.max_line_length, always use a content-encoding to make sure
     they are wrapped.

   - bpo-40571(13): Added functools.cache() as a simpler, more
     discoverable way to access the unbounded cache variant of
     lru_cache(maxsize=None).

   - bpo-40503(14): PEP 615(15), the *note zoneinfo: 13a. module.  Adds
     support for the IANA time zone database.

   - bpo-40397(16): Removed attributes ‘__args__’ and ‘__parameters__’
     from special generic aliases like ‘typing.List’ (not subscripted).

   - bpo-40549(17): Convert posixmodule.c ("posix" or "nt" module) to
     the multiphase initialization (PEP 489).

   - bpo-31033(18): Add a ‘msg’ argument to ‘Future.cancel()’ and
     ‘Task.cancel()’.

   - bpo-40541(19): Added an optional 'counts' parameter to
     random.sample().

   - bpo-40515(20): The *note ssl: d5. and *note hashlib: 6c. modules
     now actively check that OpenSSL is build with thread support.
     Python 3.7.0 made thread support mandatory and no longer works
     safely with a no-thread builds.

   - bpo-31033(21): When a *note asyncio.Task: 1c7. is cancelled, the
     exception traceback now chains all the way back to where the task
     was first interrupted.

   - bpo-40504(22): *note functools.lru_cache(): be2. objects can now be
     the targets of weakrefs.

   - bpo-40559(23): Fix possible memory leak in the C implementation of
     *note asyncio.Task: 1c7.

   - bpo-40480(24): ‘fnmatch.fnmatch()’ could take exponential time in
     the presence of multiple ‘*’ pattern characters.  This was repaired
     by generating more elaborate regular expressions to avoid futile
     backtracking.

   - bpo-40495(25): *note compileall: 21. is now able to use hardlinks
     to prevent duplicates in a case when ‘.pyc’ files for different
     optimization levels have the same content.

   - bpo-40457(26): The ssl module now support OpenSSL builds without
     TLS 1.0 and 1.1 methods.

   - bpo-40355(27): Improve error reporting in *note ast.literal_eval():
     e12. in the presence of malformed *note ast.Dict: 1d49. nodes
     instead of silently ignoring any non-conforming elements.  Patch by
     Curtis Bucher.

   - bpo-40465(28): Deprecated the optional 'random' argument to
     'random.shuffle()'.

   - bpo-40459(29): *note platform.win32_ver(): 1d4a. now produces
     correct 'ptype' strings instead of empty strings.

   - bpo-39435(30): The first argument of *note pickle.loads(): f0d. is
     now positional-only.

   - bpo-39305(31): Update ‘nntplib’ to merge ‘nntplib.NNTP’ and
     ‘nntplib._NNTPBase’.  Patch by Donghee Na.

   - bpo-32494(32): Update *note dbm.gnu: 37. to use gdbm_count if
     possible when calling *note len(): 840.  Patch by Donghee Na.

   - bpo-40453(33): Add ‘isolated=True’ keyword-only parameter to
     ‘_xxsubinterpreters.create()’.  An isolated subinterpreter cannot
     spawn threads, spawn a child process or call ‘os.fork()’.

   - bpo-40286(34): Remove ‘_random.Random.randbytes()’: the C
     implementation of ‘randbytes()’.  Implement the method in Python to
     ease subclassing: ‘randbytes()’ now directly reuses
     ‘getrandbits()’.

   - bpo-40394(35): Added default arguments to *note
     difflib.SequenceMatcher.find_longest_match(): 1d4b.

   - bpo-39995(36): Fix a race condition in
     concurrent.futures._ThreadWakeup: access to _ThreadWakeup is now
     protected with the shutdown lock.

   - bpo-30966(37): ‘Process.shutdown(wait=True)’ of *note
     concurrent.futures: 24. now closes explicitly the result queue.

   - bpo-30966(38): Add a new *note close(): b11. method to the *note
     SimpleQueue: b10. class to explicitly close the queue.

   - bpo-39966(39): Revert bpo-25597(40).  *note
     unittest.mock.MagicMock: 108f. with wraps' set uses default return
     values for magic methods.

   - bpo-39791(41): Added ‘files()’ function to importlib.resources with
     support for subdirectories in package data, matching backport in
     importlib_resources 1.5.

   - bpo-40375(42): *note imaplib.IMAP4.unselect(): b03. is added.
     Patch by Donghee Na.

   - bpo-40389(43): ‘repr()’ now returns ‘typing.Optional[T]’ when
     called for ‘typing.Union’ of two types, one of which is ‘NoneType’.

   - bpo-40291(44): Add support for CAN_J1939 sockets (available on
     Linux 5.4+)

   - bpo-40273(45): *note types.MappingProxyType: 698. is now
     reversible.

   - bpo-39075(46): The repr for *note types.SimpleNamespace: 4e5. is
     now insertion ordered rather than alphabetical.

   - bpo-40192(47): On AIX, *note thread_time(): b30. is now implemented
     with ‘thread_cputime()’ which has nanosecond resolution, rather
     than ‘clock_gettime(CLOCK_THREAD_CPUTIME_ID)’ which has a
     resolution of 10 milliseconds.  Patch by Batuhan Taskaya.

   - bpo-40025(48): Raise TypeError when _generate_next_value_ is
     defined after members.  Patch by Ethan Onstott.

   - bpo-39058(49): In the argparse module, the repr for Namespace() and
     other argument holders now displayed in the order attributes were
     added.  Formerly, it displayed in alphabetical order even though
     argument order is preserved the user visible parts of the module.

   - bpo-24416(50): The ‘isocalendar()’ methods of *note datetime.date:
     1fa. and *note datetime.datetime: 4e2. now return a *note named
     tuple: 85e. instead of a *note tuple: 614.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40662

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40665

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40536

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40645

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40645

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40637

   (7) https://bugs.python.org/issue?@action=redirect&bpo=37630

   (8) https://bugs.python.org/issue?@action=redirect&bpo=40479

   (9) https://bugs.python.org/issue?@action=redirect&bpo=40257

   (10) https://bugs.python.org/issue?@action=redirect&bpo=40607

   (11) https://bugs.python.org/issue?@action=redirect&bpo=40612

   (12) https://bugs.python.org/issue?@action=redirect&bpo=40597

   (13) https://bugs.python.org/issue?@action=redirect&bpo=40571

   (14) https://bugs.python.org/issue?@action=redirect&bpo=40503

   (15) https://peps.python.org/pep-0615/

   (16) https://bugs.python.org/issue?@action=redirect&bpo=40397

   (17) https://bugs.python.org/issue?@action=redirect&bpo=40549

   (18) https://bugs.python.org/issue?@action=redirect&bpo=31033

   (19) https://bugs.python.org/issue?@action=redirect&bpo=40541

   (20) https://bugs.python.org/issue?@action=redirect&bpo=40515

   (21) https://bugs.python.org/issue?@action=redirect&bpo=31033

   (22) https://bugs.python.org/issue?@action=redirect&bpo=40504

   (23) https://bugs.python.org/issue?@action=redirect&bpo=40559

   (24) https://bugs.python.org/issue?@action=redirect&bpo=40480

   (25) https://bugs.python.org/issue?@action=redirect&bpo=40495

   (26) https://bugs.python.org/issue?@action=redirect&bpo=40457

   (27) https://bugs.python.org/issue?@action=redirect&bpo=40355

   (28) https://bugs.python.org/issue?@action=redirect&bpo=40465

   (29) https://bugs.python.org/issue?@action=redirect&bpo=40459

   (30) https://bugs.python.org/issue?@action=redirect&bpo=39435

   (31) https://bugs.python.org/issue?@action=redirect&bpo=39305

   (32) https://bugs.python.org/issue?@action=redirect&bpo=32494

   (33) https://bugs.python.org/issue?@action=redirect&bpo=40453

   (34) https://bugs.python.org/issue?@action=redirect&bpo=40286

   (35) https://bugs.python.org/issue?@action=redirect&bpo=40394

   (36) https://bugs.python.org/issue?@action=redirect&bpo=39995

   (37) https://bugs.python.org/issue?@action=redirect&bpo=30966

   (38) https://bugs.python.org/issue?@action=redirect&bpo=30966

   (39) https://bugs.python.org/issue?@action=redirect&bpo=39966

   (40) https://bugs.python.org/issue?@action=redirect&bpo=25597

   (41) https://bugs.python.org/issue?@action=redirect&bpo=39791

   (42) https://bugs.python.org/issue?@action=redirect&bpo=40375

   (43) https://bugs.python.org/issue?@action=redirect&bpo=40389

   (44) https://bugs.python.org/issue?@action=redirect&bpo=40291

   (45) https://bugs.python.org/issue?@action=redirect&bpo=40273

   (46) https://bugs.python.org/issue?@action=redirect&bpo=39075

   (47) https://bugs.python.org/issue?@action=redirect&bpo=40192

   (48) https://bugs.python.org/issue?@action=redirect&bpo=40025

   (49) https://bugs.python.org/issue?@action=redirect&bpo=39058

   (50) https://bugs.python.org/issue?@action=redirect&bpo=24416


File: python.info,  Node: ドキュメント<45>,  Next: テスト<44>,  Prev: ライブラリ<151>,  Up: Python 3 9 0 beta 1

1.24.51.4 ドキュメント
......................

   - bpo-34790(1): Add version of removal for explicit passing of coros
     to ‘asyncio.wait()’'s documentation

   - bpo-40561(2): Provide docstrings for webbrowser open functions.

   - bpo-40499(3): Mention that *note asyncio.wait(): 6a7. requires a
     non-empty set of awaitables.

   - bpo-39705(4): Tutorial example for sorted() in the Loop Techniques
     section is given a better explanation.  Also a new example is
     included to explain sorted()'s basic behavior.

   - bpo-39435(5): Fix an incorrect signature for *note pickle.loads():
     f0d. in the docs

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34790

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40561

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40499

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39705

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39435


File: python.info,  Node: テスト<44>,  Next: ビルド<51>,  Prev: ドキュメント<45>,  Up: Python 3 9 0 beta 1

1.24.51.5 テスト
................

   - bpo-40055(1): distutils.tests now saves/restores warnings filters
     to leave them unchanged.  Importing tests imports docutils which
     imports pkg_resources which adds a warnings filter.

   - bpo-40436(2): test_gdb and test.pythoninfo now check gdb command
     exit code.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40055

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40436


File: python.info,  Node: ビルド<51>,  Next: Windows<45>,  Prev: テスト<44>,  Up: Python 3 9 0 beta 1

1.24.51.6 ビルド
................

   - bpo-40653(1): Move _dirnameW out of HAVE_SYMLINK to fix a potential
     compiling issue.

   - bpo-40514(2): Add ‘--with-experimental-isolated-subinterpreters’
     build option to ‘configure’: better isolate subinterpreters,
     experimental build mode.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40653

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40514


File: python.info,  Node: Windows<45>,  Next: macOS<35>,  Prev: ビルド<51>,  Up: Python 3 9 0 beta 1

1.24.51.7 Windows
.................

   - bpo-40650(1): Include winsock2.h in pytime.c for timeval.

   - bpo-40458(2): Increase reserved stack space to prevent overflow
     crash on Windows.

   - bpo-39148(3): Add IPv6 support to *note asyncio: b. datagram
     endpoints in ProactorEventLoop.  Change the raised exception for
     unknown address families to ValueError as it's not coming from
     Windows API.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40650

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40458

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39148


File: python.info,  Node: macOS<35>,  Next: Tools/Demos<30>,  Prev: Windows<45>,  Up: Python 3 9 0 beta 1

1.24.51.8 macOS
...............

   - bpo-34956(1): When building Python on macOS from source, ‘_tkinter’
     now links with non-system Tcl and Tk frameworks if they are
     installed in ‘/Library/Frameworks’, as had been the case on older
     releases of macOS. If a macOS SDK is explicitly configured, by
     using ‘--enable-universalsdk=’ or ‘-isysroot’, only the SDK itself
     is searched.  The default behavior can still be overridden with
     ‘--with-tcltk-includes’ and ‘--with-tcltk-libs’.

   - bpo-35569(2): Expose RFC 3542 IPv6 socket options.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34956

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35569


File: python.info,  Node: Tools/Demos<30>,  Next: C API<46>,  Prev: macOS<35>,  Up: Python 3 9 0 beta 1

1.24.51.9 Tools/Demos
.....................

   - bpo-40479(1): Update multissltest helper to test with latest
     OpenSSL 1.0.2, 1.1.0, 1.1.1, and 3.0.0-alpha.

   - bpo-40431(2): Fix a syntax typo in ‘turtledemo’ that now raises a
     ‘SyntaxError’.

   - bpo-40163(3): Fix multissltest tool.  OpenSSL has changed download
     URL for old releases.  The multissltest tool now tries to download
     from current and old download URLs.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40479

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40431

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40163


File: python.info,  Node: C API<46>,  Prev: Tools/Demos<30>,  Up: Python 3 9 0 beta 1

1.24.51.10 C API
................

   - bpo-39465(1): Remove the ‘_PyUnicode_ClearStaticStrings()’ function
     from the C API.

   - bpo-38787(2): Add PyCFunction_CheckExact() macro for exact type
     checks now that we allow subtypes of PyCFunction, as well as
     PyCMethod_CheckExact() and PyCMethod_Check() for the new PyCMethod
     subtype.

   - bpo-40545(3): Declare ‘_PyErr_GetTopmostException()’ with
     ‘PyAPI_FUNC()’ to properly export the function in the C API. The
     function remains private (‘_Py’) prefix.

   - bpo-40412(4): Nullify inittab_copy during finalization, preventing
     future interpreter initializations in an embedded situation from
     crashing.  Patch by Gregory Szorc.

   - bpo-40429(5): The *note PyThreadState_GetFrame(): 991. function now
     returns a strong reference to the frame.

   - bpo-40428(6): Remove the following functions from the C API. Call
     *note PyGC_Collect(): b85. explicitly to free all free lists.

        * ‘PyAsyncGen_ClearFreeLists()’

        * ‘PyContext_ClearFreeList()’

        * ‘PyDict_ClearFreeList()’

        * ‘PyFloat_ClearFreeList()’

        * ‘PyFrame_ClearFreeList()’

        * ‘PyList_ClearFreeList()’

        * ‘PySet_ClearFreeList()’

        * ‘PyTuple_ClearFreeList()’

   - bpo-40421(7): New *note PyFrame_GetBack(): 989. function: get the
     frame next outer frame.

   - bpo-40421(8): New *note PyFrame_GetCode(): 98d. function: return a
     borrowed reference to the frame code.

   - bpo-40217(9): Ensure that instances of types created with *note
     PyType_FromSpecWithBases(): 79e. will visit its class object when
     traversing references in the garbage collector (implemented as an
     extension of the provided *note tp_traverse: 982.).  Patch by Pablo
     Galindo.

   - bpo-38787(10): Module C state is now accessible from C-defined heap
     type methods ( PEP 573(11)).  Patch by Marcel Plch and Petr
     Viktorin.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39465

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38787

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40545

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40412

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40429

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40428

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40421

   (8) https://bugs.python.org/issue?@action=redirect&bpo=40421

   (9) https://bugs.python.org/issue?@action=redirect&bpo=40217

   (10) https://bugs.python.org/issue?@action=redirect&bpo=38787

   (11) https://peps.python.org/pep-0573/


File: python.info,  Node: Python 3 9 0 alpha 6,  Next: Python 3 9 0 alpha 5,  Prev: Python 3 9 0 beta 1,  Up: 変更履歴

1.24.52 Python 3.9.0 alpha 6
----------------------------

'リリース日: 2020-04-27'

* Menu:

* セキュリティ: セキュリティ<38>.
* Core and Builtins: Core and Builtins<149>.
* ライブラリ: ライブラリ<152>.
* ドキュメント: ドキュメント<46>.
* テスト: テスト<45>.
* ビルド: ビルド<52>.
* Windows: Windows<46>.
* macOS: macOS<36>.
* IDLE: IDLE<27>.
* Tools/Demos: Tools/Demos<31>.
* C API: C API<47>.


File: python.info,  Node: セキュリティ<38>,  Next: Core and Builtins<149>,  Up: Python 3 9 0 alpha 6

1.24.52.1 セキュリティ
......................

   - bpo-40121(1): Fixes audit events raised on creating a new socket.

   - bpo-39073(2): Disallow CR or LF in email.headerregistry.Address
     arguments to guard against header injection attacks.

   - bpo-39503(3): CVE 2020-8492(4): The *note AbstractBasicAuthHandler:
     1c6f. class of the *note urllib.request: 111. module uses an
     inefficient regular expression which can be exploited by an
     attacker to cause a denial of service.  Fix the regex to prevent
     the catastrophic backtracking.  Vulnerability reported by Ben
     Caller and Matt Schwager.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40121

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39073

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39503

   (4) https://www.cve.org/CVERecord?id=CVE-2020-8492


File: python.info,  Node: Core and Builtins<149>,  Next: ライブラリ<152>,  Prev: セキュリティ<38>,  Up: Python 3 9 0 alpha 6

1.24.52.2 Core and Builtins
...........................

   - bpo-40313(1): Improve the performance of bytes.hex().

   - bpo-40334(2): Switch to a new parser, based on PEG. For more
     details see PEP 617.  To temporarily switch back to the old parser,
     use ‘-X oldparser’ or ‘PYTHONOLDPARSER=1’.  In Python 3.10 we will
     remove the old parser completely, including the ‘parser’ module
     (already deprecated) and anything that depends on it.

   - bpo-40267(3): Fix the tokenizer to display the correct error
     message, when there is a ‘SyntaxError’ on the last input character
     and no newline follows.  It used to be ‘unexpected EOF while
     parsing’, while it should be ‘invalid syntax’.

   - bpo-39522(4): Correctly unparse explicit ‘u’ prefix for strings
     when postponed evaluation for annotations activated.  Patch by
     Batuhan Taskaya.

   - bpo-40246(5): Report a specialized error message, ‘invalid string
     prefix’, when the tokenizer encounters a string with an invalid
     prefix.

   - bpo-40082(6): Fix the signal handler: it now always uses the main
     interpreter, rather than trying to get the current Python thread
     state.

   - bpo-37388(7): str.encode() and str.decode() no longer check the
     encoding and errors in development mode or in debug mode during
     Python finalization.  The codecs machinery can no longer work on
     very late calls to str.encode() and str.decode().

   - bpo-40077(8): Fix possible refleaks in ‘_json’, memo of
     PyScannerObject should be traversed.

   - bpo-37207(9): Speed up calls to ‘dict()’ by using the PEP 590(10)
     ‘vectorcall’ calling convention.

   - bpo-40141(11): Add column and line information to ‘ast.keyword’
     nodes.  Patch by Pablo Galindo.

   - bpo-1635741(12): Port *note resource: c1. to multiphase
     initialization ( PEP 489(13)).

   - bpo-1635741(14): Port *note math: 92. to multiphase initialization
     ( PEP 489(15)).

   - bpo-1635741(16): Port _uuid module to multiphase initialization (
     PEP 489(17)).

   - bpo-40077(18): Convert json module to use *note PyType_FromSpec():
     79d.

   - bpo-40067(19): Improve the error message for multiple star
     expressions in an assignment.  Patch by Furkan Onder

   - bpo-1635741(20): Port _functools module to multiphase
     initialization (PEP 489).  Patch by Paulo Henrique Silva.

   - bpo-1635741(21): Port operator module to multiphase initialization
     (PEP 489).  Patch by Paulo Henrique Silva.

   - bpo-20526(22): Fix *note PyThreadState_Clear(): 1991.
     ‘PyThreadState.frame’ is a borrowed reference, not a strong
     reference: ‘PyThreadState_Clear()’ must not call
     ‘Py_CLEAR(tstate->frame)’.

   - bpo-1635741(23): Port time module to multiphase initialization (
     PEP 489(24)).  Patch by Paulo Henrique Silva.

   - bpo-1635741(25): Port _weakref extension module to multiphase
     initialization ( PEP 489(26)).

   - bpo-40020(27): Fix a leak and subsequent crash in parsetok.c caused
     by realloc misuse on a rare codepath.

   - bpo-39939(28): Added str.removeprefix and str.removesuffix methods
     and corresponding bytes, bytearray, and collections.UserString
     methods to remove affixes from a string if present.  See PEP
     616(29) for a full description.  Patch by Dennis Sweeney.

   - bpo-39481(30): Implement PEP 585.  This supports list[int],
     tuple[str, ...]  etc.

   - bpo-32894(31): Support unparsing of infinity numbers in postponed
     annotations.  Patch by Batuhan Taşkaya.

   - bpo-37207(32): Speed up calls to ‘list()’ by using the PEP 590(33)
     ‘vectorcall’ calling convention.  Patch by Mark Shannon.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40313

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40334

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40267

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39522

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40246

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40082

   (7) https://bugs.python.org/issue?@action=redirect&bpo=37388

   (8) https://bugs.python.org/issue?@action=redirect&bpo=40077

   (9) https://bugs.python.org/issue?@action=redirect&bpo=37207

   (10) https://peps.python.org/pep-0590/

   (11) https://bugs.python.org/issue?@action=redirect&bpo=40141

   (12) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (13) https://peps.python.org/pep-0489/

   (14) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (15) https://peps.python.org/pep-0489/

   (16) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (17) https://peps.python.org/pep-0489/

   (18) https://bugs.python.org/issue?@action=redirect&bpo=40077

   (19) https://bugs.python.org/issue?@action=redirect&bpo=40067

   (20) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (21) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (22) https://bugs.python.org/issue?@action=redirect&bpo=20526

   (23) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (24) https://peps.python.org/pep-0489/

   (25) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (26) https://peps.python.org/pep-0489/

   (27) https://bugs.python.org/issue?@action=redirect&bpo=40020

   (28) https://bugs.python.org/issue?@action=redirect&bpo=39939

   (29) https://peps.python.org/pep-0616/

   (30) https://bugs.python.org/issue?@action=redirect&bpo=39481

   (31) https://bugs.python.org/issue?@action=redirect&bpo=32894

   (32) https://bugs.python.org/issue?@action=redirect&bpo=37207

   (33) https://peps.python.org/pep-0590/


File: python.info,  Node: ライブラリ<152>,  Next: ドキュメント<46>,  Prev: Core and Builtins<149>,  Up: Python 3 9 0 alpha 6

1.24.52.3 ライブラリ
....................

   - bpo-40398(1): *note typing.get_args(): 2ac. now always returns an
     empty tuple for special generic aliases.

   - bpo-40396(2): Functions *note typing.get_origin(): 2ab, *note
     typing.get_args(): 2ac. and *note typing.get_type_hints(): 8c0.
     support now generic aliases like ‘list[int]’.

   - bpo-38061(3): Optimize the *note subprocess: dc. module on FreeBSD
     using ‘closefrom()’.  A single ‘close(fd)’ syscall is cheap, but
     when ‘sysconf(_SC_OPEN_MAX)’ is high, the loop calling ‘close(fd)’
     on each file descriptor can take several milliseconds.

     The workaround on FreeBSD to improve performance was to load and
     mount the fdescfs kernel module, but this is not enabled by
     default.

     Initial patch by Ed Maste (emaste), Conrad Meyer (cem), Kyle Evans
     (kevans) and Kubilay Kocak (koobs):
     ‘https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242274’

   - bpo-38061(4): On FreeBSD, ‘os.closerange(fd_low, fd_high)’ now
     calls ‘closefrom(fd_low)’ if 'fd_high' is greater than or equal to
     ‘sysconf(_SC_OPEN_MAX)’.

     Initial patch by Ed Maste (emaste), Conrad Meyer (cem), Kyle Evans
     (kevans) and Kubilay Kocak (koobs):
     ‘https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242274’

   - bpo-40360(5): The ‘lib2to3’ module is pending deprecation due to
     PEP 617(6).

   - bpo-40138(7): Fix the Windows implementation of *note os.waitpid():
     f9a. for exit code larger than ‘INT_MAX >> 8’.  The exit status is
     now interpreted as an unsigned number.

   - bpo-39942(8): Set "__main__" as the default module name when
     "__name__" is missing in *note typing.TypeVar: 486.  Patch by
     Weipeng Hong.

   - bpo-40275(9): The *note logging: 8b. package is now imported lazily
     in *note unittest: 10c. only when the *note assertLogs(): a59.
     assertion is used.

   - bpo-40275(10): The *note asyncio: b. package is now imported lazily
     in *note unittest: 10c. only when the *note
     IsolatedAsyncioTestCase: 361. class is used.

   - bpo-40330(11): In ‘ShareableList.__setitem__()’, check the size of
     a new string item after encoding it to utf-8, not before.

   - bpo-40148(12): Added ‘pathlib.Path.with_stem()’ to create a new
     Path with the stem replaced.

   - bpo-40325(13): Deprecated support for set objects in
     random.sample().

   - bpo-40257(14): Improved help for the *note typing: 10a. module.
     Docstrings are now shown for all special forms and special generic
     aliases (like ‘Union’ and ‘List’).  Using ‘help()’ with generic
     alias like ‘List[int]’ will show the help for the correspondent
     concrete type (‘list’ in this case).

   - bpo-40257(15): *note inspect.getdoc(): bed. no longer returns
     docstring inherited from the type of the object or from parent
     class if it is a class if it is not defined in the object itself.
     In *note pydoc: ba. the documentation string is now shown not only
     for class, function, method etc, but for any object that has its
     own ‘__doc__’ attribute.

   - bpo-40287(16): Fixed ‘SpooledTemporaryFile.seek()’ to return the
     position.

   - bpo-40290(17): Added zscore() to statistics.NormalDist().

   - bpo-40282(18): Allow ‘random.getrandbits(0)’ to succeed and to
     return 0.

   - bpo-40286(19): Add *note random.randbytes(): 1826. function and
     *note random.Random.randbytes(): b23. method to generate random
     bytes.

   - bpo-40277(20): *note collections.namedtuple(): 4e0. now provides a
     human-readable repr for its field accessors.

   - bpo-40270(21): The included copy of sqlite3 on Windows is now
     compiled with the json extension.  This allows the use of functions
     such as ‘json_object’.

   - bpo-29255(22): Wait in ‘KqueueSelector.select’ when no fds are
     registered

   - bpo-40260(23): Ensure *note modulefinder: 95. uses *note
     io.open_code(): 1a98. and respects coding comments.

   - bpo-40234(24): Allow again to spawn daemon threads in
     subinterpreters (revert change which denied them).

   - bpo-39207(25): Workers in *note ProcessPoolExecutor: 1d6. are now
     spawned on demand, only when there are no available idle workers to
     reuse.  This optimizes startup overhead and reduces the amount of
     lost CPU time to idle workers.  Patch by Kyle Stanley.

   - bpo-40091(26): Fix a hang at fork in the logging module: the new
     private _at_fork_reinit() method is now used to reinitialize locks
     at fork in the child process.

   - bpo-40149(27): Implement traverse and clear slots in _abc._abc_data
     type.

   - bpo-40208(28): Remove deprecated ‘symtable.SymbolTable.has_exec()’.

   - bpo-40196(29): Fix a bug in the *note symtable: de. module that was
     causing incorrectly report global variables as local.  Patch by
     Pablo Galindo.

   - bpo-40190(30): Add support for ‘_SC_AIX_REALMEM’ to
     ‘posix.sysconf()’.

   - bpo-40182(31): Removed the ‘_field_types’ attribute of the *note
     typing.NamedTuple: 331. class.

   - bpo-36517(32): Multiple inheritance with *note typing.NamedTuple:
     331. now raises an error instead of silently ignoring other types.

   - bpo-40126(33): Fixed reverting multiple patches in unittest.mock.
     Patcher's ‘__exit__()’ is now never called if its ‘__enter__()’ is
     failed.  Returning true from ‘__exit__()’ silences now the
     exception.

   - bpo-40094(34): CGIHTTPRequestHandler of http.server now logs the
     CGI script exit code, rather than the CGI script exit status of
     os.waitpid().  For example, if the script is killed by signal 11,
     it now logs: "CGI script exit code -11."

   - bpo-40108(35): Improve the error message when triying to import a
     module using *note runpy: c3. and incorrectly using the ".py"
     extension at the end of the module name.  Patch by Pablo Galindo.

   - bpo-40094(36): Add *note os.waitstatus_to_exitcode(): b17.
     function: convert a wait status to an exit code.

   - bpo-40089(37): Fix threading._after_fork(): if fork was not called
     by a thread spawned by threading.Thread, threading._after_fork()
     now creates a _MainThread instance for _main_thread, instead of a
     _DummyThread instance.

   - bpo-40089(38): Add a private ‘_at_fork_reinit()’ method to
     ‘_thread.Lock’, ‘_thread.RLock’, *note threading.RLock: 32e. and
     *note threading.Condition: 136d. classes: reinitialize the lock at
     fork in the child process, reset the lock to the unlocked state.
     Rename also the private ‘_reset_internal_locks()’ method of *note
     threading.Event: 1370. to ‘_at_fork_reinit()’.

   - bpo-25780(39): Expose *note CAN_RAW_JOIN_FILTERS: b2b. in the *note
     socket: d1. module.

   - bpo-39503(40): *note AbstractBasicAuthHandler: 1c6f. of *note
     urllib.request: 111. now parses all WWW-Authenticate HTTP headers
     and accepts multiple challenges per header: use the realm of the
     first Basic challenge.

   - bpo-39812(41): Removed daemon threads from *note
     concurrent.futures: 24. by adding an internal
     ‘threading._register_atexit()’, which calls registered functions
     prior to joining all non-daemon threads.  This allows for
     compatibility with subinterpreters, which don't support daemon
     threads.

   - bpo-40050(42): Fix ‘importlib._bootstrap_external’: avoid creating
     a new ‘winreg’ builtin module if it's already available in *note
     sys.modules: 17e6, and remove redundant imports.

   - bpo-40014(43): Fix ‘os.getgrouplist()’: if ‘getgrouplist()’
     function fails because the group list is too small, retry with a
     larger group list.  On failure, the glibc implementation of
     ‘getgrouplist()’ sets ‘ngroups’ to the total number of groups.  For
     other implementations, double the group list size.

   - bpo-40017(44): Add *note time.CLOCK_TAI: 1d57. constant if the
     operating system support it.

   - bpo-40016(45): In re docstring, clarify the relationship between
     inline and argument compile flags.

   - bpo-39953(46): Update internal table of OpenSSL error codes in the
     ‘ssl’ module.

   - bpo-36144(47): Added PEP 584(48) operators to *note
     weakref.WeakValueDictionary: 192a.

   - bpo-36144(49): Added PEP 584(50) operators to *note
     weakref.WeakKeyDictionary: 1929.

   - bpo-38891(51): Fix linear runtime behaviour of the ‘__getitem__’
     and ‘__setitem__’ methods in *note
     multiprocessing.shared_memory.ShareableList: 1d58.  This avoids
     quadratic performance when iterating a ‘ShareableList’.  Patch by
     Thomas Krennwallner.

   - bpo-39682(52): Remove undocumented support for 'closing' a
     ‘pathlib.Path’ object via its context manager.  The context manager
     magic methods remain, but they are now a no-op, making ‘Path’
     objects immutable.

   - bpo-36144(53): Added PEP 584(54) operators (‘|’ and ‘|=’) to *note
     collections.ChainMap: e16.

   - bpo-39011(55): Normalization of line endings in ElementTree
     attributes was removed, as line endings which were replaced by
     entity numbers should be preserved in original form.

   - bpo-38410(56): Properly handle *note sys.audit(): 191b. failures in
     *note sys.set_asyncgen_hooks(): 199d.

   - bpo-36541(57): lib2to3 now recognizes named assignment expressions
     (the walrus operator, ‘:=’)

   - bpo-35967(58): In platform, delay the invocation of 'uname -p'
     until the processor attribute is requested.

   - bpo-35113(59): *note inspect.getsource(): 17c3. now returns correct
     source code for inner class with same name as module level class.
     Decorators are also returned as part of source of the class.  Patch
     by Karthikeyan Singaravelan.

   - bpo-33262(60): Deprecate passing None as an argument for *note
     shlex.split(): 75e.'s ‘s’ parameter.  Patch by Zackery Spytz.

   - bpo-31758(61): Prevent crashes when using an uninitialized
     ‘_elementtree.XMLParser’ object.  Patch by Oren Milman.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40398

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40396

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38061

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38061

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40360

   (6) https://peps.python.org/pep-0617/

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40138

   (8) https://bugs.python.org/issue?@action=redirect&bpo=39942

   (9) https://bugs.python.org/issue?@action=redirect&bpo=40275

   (10) https://bugs.python.org/issue?@action=redirect&bpo=40275

   (11) https://bugs.python.org/issue?@action=redirect&bpo=40330

   (12) https://bugs.python.org/issue?@action=redirect&bpo=40148

   (13) https://bugs.python.org/issue?@action=redirect&bpo=40325

   (14) https://bugs.python.org/issue?@action=redirect&bpo=40257

   (15) https://bugs.python.org/issue?@action=redirect&bpo=40257

   (16) https://bugs.python.org/issue?@action=redirect&bpo=40287

   (17) https://bugs.python.org/issue?@action=redirect&bpo=40290

   (18) https://bugs.python.org/issue?@action=redirect&bpo=40282

   (19) https://bugs.python.org/issue?@action=redirect&bpo=40286

   (20) https://bugs.python.org/issue?@action=redirect&bpo=40277

   (21) https://bugs.python.org/issue?@action=redirect&bpo=40270

   (22) https://bugs.python.org/issue?@action=redirect&bpo=29255

   (23) https://bugs.python.org/issue?@action=redirect&bpo=40260

   (24) https://bugs.python.org/issue?@action=redirect&bpo=40234

   (25) https://bugs.python.org/issue?@action=redirect&bpo=39207

   (26) https://bugs.python.org/issue?@action=redirect&bpo=40091

   (27) https://bugs.python.org/issue?@action=redirect&bpo=40149

   (28) https://bugs.python.org/issue?@action=redirect&bpo=40208

   (29) https://bugs.python.org/issue?@action=redirect&bpo=40196

   (30) https://bugs.python.org/issue?@action=redirect&bpo=40190

   (31) https://bugs.python.org/issue?@action=redirect&bpo=40182

   (32) https://bugs.python.org/issue?@action=redirect&bpo=36517

   (33) https://bugs.python.org/issue?@action=redirect&bpo=40126

   (34) https://bugs.python.org/issue?@action=redirect&bpo=40094

   (35) https://bugs.python.org/issue?@action=redirect&bpo=40108

   (36) https://bugs.python.org/issue?@action=redirect&bpo=40094

   (37) https://bugs.python.org/issue?@action=redirect&bpo=40089

   (38) https://bugs.python.org/issue?@action=redirect&bpo=40089

   (39) https://bugs.python.org/issue?@action=redirect&bpo=25780

   (40) https://bugs.python.org/issue?@action=redirect&bpo=39503

   (41) https://bugs.python.org/issue?@action=redirect&bpo=39812

   (42) https://bugs.python.org/issue?@action=redirect&bpo=40050

   (43) https://bugs.python.org/issue?@action=redirect&bpo=40014

   (44) https://bugs.python.org/issue?@action=redirect&bpo=40017

   (45) https://bugs.python.org/issue?@action=redirect&bpo=40016

   (46) https://bugs.python.org/issue?@action=redirect&bpo=39953

   (47) https://bugs.python.org/issue?@action=redirect&bpo=36144

   (48) https://peps.python.org/pep-0584/

   (49) https://bugs.python.org/issue?@action=redirect&bpo=36144

   (50) https://peps.python.org/pep-0584/

   (51) https://bugs.python.org/issue?@action=redirect&bpo=38891

   (52) https://bugs.python.org/issue?@action=redirect&bpo=39682

   (53) https://bugs.python.org/issue?@action=redirect&bpo=36144

   (54) https://peps.python.org/pep-0584/

   (55) https://bugs.python.org/issue?@action=redirect&bpo=39011

   (56) https://bugs.python.org/issue?@action=redirect&bpo=38410

   (57) https://bugs.python.org/issue?@action=redirect&bpo=36541

   (58) https://bugs.python.org/issue?@action=redirect&bpo=35967

   (59) https://bugs.python.org/issue?@action=redirect&bpo=35113

   (60) https://bugs.python.org/issue?@action=redirect&bpo=33262

   (61) https://bugs.python.org/issue?@action=redirect&bpo=31758


File: python.info,  Node: ドキュメント<46>,  Next: テスト<45>,  Prev: ライブラリ<152>,  Up: Python 3 9 0 alpha 6

1.24.52.4 ドキュメント
......................

   - bpo-27635(1): The pickle documentation incorrectly claimed that
     ‘__new__’ isn't called by default when unpickling.

   - bpo-39879(2): Updated *note データモデル: 1d5a. docs to include
     *note dict(): 183. insertion order preservation.  Patch by Furkan
     Onder and Samy Lahfa.

   - bpo-38387(3): Document *note PyDoc_STRVAR: 1d5b. macro in the C-API
     reference.

   - bpo-13743(4): Some methods within xml.dom.minidom.Element class are
     now better documented.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27635

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39879

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38387

   (4) https://bugs.python.org/issue?@action=redirect&bpo=13743


File: python.info,  Node: テスト<45>,  Next: ビルド<52>,  Prev: ドキュメント<46>,  Up: Python 3 9 0 alpha 6

1.24.52.5 テスト
................

   - bpo-31904(1): Set expected default encoding in
     test_c_locale_coercion.py for VxWorks RTOS.

   - bpo-40162(2): Update Travis CI configuration to OpenSSL 1.1.1f.

   - bpo-40146(3): Update OpenSSL to 1.1.1f in Azure Pipelines.

   - bpo-40094(4): Add *note test.support.wait_process(): 1d5d.
     function.

   - bpo-40003(5): ‘test.bisect_cmd’ now copies Python command line
     options like ‘-O’ or ‘-W’.  Moreover, emit a warning if
     ‘test.bisect_cmd’ is used with ‘-w’/‘--verbose2’ option.

   - bpo-39380(6): Add the encoding in *note ftplib.FTP: af6. and *note
     ftplib.FTP_TLS: af7. to the constructor as keyword-only and change
     the default from ‘latin-1’ to ‘utf-8’ to follow RFC 2640(7).

   - bpo-39793(8): Use the same domain when testing ‘make_msgid’.  Patch
     by Batuhan Taskaya.

   - bpo-1812(9): Fix newline handling in doctest.testfile when loading
     from a package whose loader has a get_data method.  Patch by Peter
     Donis.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40162

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40146

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40094

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40003

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39380

   (7) https://datatracker.ietf.org/doc/html/rfc2640.html

   (8) https://bugs.python.org/issue?@action=redirect&bpo=39793

   (9) https://bugs.python.org/issue?@action=redirect&bpo=1812


File: python.info,  Node: ビルド<52>,  Next: Windows<46>,  Prev: テスト<45>,  Up: Python 3 9 0 alpha 6

1.24.52.6 ビルド
................

   - bpo-38360(1): Support single-argument form of macOS -isysroot flag.

   - bpo-40158(2): Fix CPython MSBuild Properties in NuGet Package
     (build/native/python.props)

   - bpo-38527(3): Fix configure check on Solaris for "float word
     ordering": sometimes, the correct "grep" command was not being
     used.  Patch by Arnon Yaari.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38360

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40158

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38527


File: python.info,  Node: Windows<46>,  Next: macOS<36>,  Prev: ビルド<52>,  Up: Python 3 9 0 alpha 6

1.24.52.7 Windows
.................

   - bpo-40164(1): Updates Windows to OpenSSL 1.1.1f

   - bpo-8901(2): Ignore the Windows registry when the ‘-E’ option is
     used.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40164

   (2) https://bugs.python.org/issue?@action=redirect&bpo=8901


File: python.info,  Node: macOS<36>,  Next: IDLE<27>,  Prev: Windows<46>,  Up: Python 3 9 0 alpha 6

1.24.52.8 macOS
...............

   - bpo-38329(1): python.org macOS installers now update the Current
     version symlink of /Library/Frameworks/Python.framework/Versions
     for 3.9 installs.  Previously, Current was only updated for Python
     2.x installs.  This should make it easier to embed Python 3 into
     other macOS applications.

   - bpo-40164(2): Update macOS installer builds to use OpenSSL 1.1.1g.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38329

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40164


File: python.info,  Node: IDLE<27>,  Next: Tools/Demos<31>,  Prev: macOS<36>,  Up: Python 3 9 0 alpha 6

1.24.52.9 IDLE
..............

   - bpo-38439(1): Add a 256×256 pixel IDLE icon to support more modern
     environments.  Created by Andrew Clover.  Delete the unused macOS
     idle.icns icon file.

   - bpo-38689(2): IDLE will no longer freeze when inspect.signature
     fails when fetching a calltip.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38439

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38689


File: python.info,  Node: Tools/Demos<31>,  Next: C API<47>,  Prev: IDLE<27>,  Up: Python 3 9 0 alpha 6

1.24.52.10 Tools/Demos
......................

   - bpo-40385(1): Removed the checkpyc.py tool.  Please see compileall
     without force mode as a potential alternative.

   - bpo-40179(2): Fixed translation of ‘#elif’ in Argument Clinic.

   - bpo-40094(3): Fix ‘which.py’ script exit code: it now uses *note
     os.waitstatus_to_exitcode(): b17. to convert *note os.system():
     1676. exit status into an exit code.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40385

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40179

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40094


File: python.info,  Node: C API<47>,  Prev: Tools/Demos<31>,  Up: Python 3 9 0 alpha 6

1.24.52.11 C API
................

   - bpo-40241(1): Move the ‘PyGC_Head’ structure to the internal C API.

   - bpo-40170(2): Convert *note PyObject_IS_GC(): b7b. macro to a
     function to hide implementation details.

   - bpo-40241(3): Add the functions *note PyObject_GC_IsTracked(): b6d.
     and *note PyObject_GC_IsFinalized(): b6e. to the public API to
     allow to query if Python objects are being currently tracked or
     have been already finalized by the garbage collector respectively.
     Patch by Pablo Galindo.

   - bpo-40170(4): The ‘PyObject_NEW()’ macro becomes an alias to the
     *note PyObject_New(): b7c. macro, and the ‘PyObject_NEW_VAR()’
     macro becomes an alias to the *note PyObject_NewVar(): b7d. macro,
     to hide implementation details.  They no longer access directly the
     *note PyTypeObject.tp_basicsize: b7e. member.

   - bpo-40170(5): *note PyType_HasFeature(): 1d3c. now always calls
     *note PyType_GetFlags(): 1d3d. to hide implementation details.
     Previously, it accessed directly the *note PyTypeObject.tp_flags:
     1c71. member when the limited C API was not used.

   - bpo-40170(6): Convert the ‘PyObject_GET_WEAKREFS_LISTPTR()’ macro
     to a function to hide implementation details: the macro accessed
     directly to the *note PyTypeObject.tp_weaklistoffset: b7f. member.

   - bpo-40170(7): Convert *note PyObject_CheckBuffer(): 639. macro to a
     function to hide implementation details: the macro accessed
     directly the *note PyTypeObject.tp_as_buffer: b80. member.

   - bpo-40170(8): Always declare *note PyIndex_Check(): b81. as an
     opaque function to hide implementation details: remove
     ‘PyIndex_Check()’ macro.  The macro accessed directly the *note
     PyTypeObject.tp_as_number: b82. member.

   - bpo-39947(9): Add *note PyThreadState_GetID(): b6a. function: get
     the unique identifier of a Python thread state.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40241

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40170

   (3) https://bugs.python.org/issue?@action=redirect&bpo=40241

   (4) https://bugs.python.org/issue?@action=redirect&bpo=40170

   (5) https://bugs.python.org/issue?@action=redirect&bpo=40170

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40170

   (7) https://bugs.python.org/issue?@action=redirect&bpo=40170

   (8) https://bugs.python.org/issue?@action=redirect&bpo=40170

   (9) https://bugs.python.org/issue?@action=redirect&bpo=39947


File: python.info,  Node: Python 3 9 0 alpha 5,  Next: Python 3 9 0 alpha 4,  Prev: Python 3 9 0 alpha 6,  Up: 変更履歴

1.24.53 Python 3.9.0 alpha 5
----------------------------

'リリース日: 2020-03-23'

* Menu:

* セキュリティ: セキュリティ<39>.
* Core and Builtins: Core and Builtins<150>.
* ライブラリ: ライブラリ<153>.
* ドキュメント: ドキュメント<47>.
* テスト: テスト<46>.
* ビルド: ビルド<53>.
* Windows: Windows<47>.
* macOS: macOS<37>.
* IDLE: IDLE<28>.
* Tools/Demos: Tools/Demos<32>.
* C API: C API<48>.


File: python.info,  Node: セキュリティ<39>,  Next: Core and Builtins<150>,  Up: Python 3 9 0 alpha 5

1.24.53.1 セキュリティ
......................

   - bpo-38576(1): Disallow control characters in hostnames in
     http.client, addressing CVE 2019-18348(2).  Such potentially
     malicious header injection URLs now cause a InvalidURL to be
     raised.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38576

   (2) https://www.cve.org/CVERecord?id=CVE-2019-18348


File: python.info,  Node: Core and Builtins<150>,  Next: ライブラリ<153>,  Prev: セキュリティ<39>,  Up: Python 3 9 0 alpha 5

1.24.53.2 Core and Builtins
...........................

   - bpo-40010(1): Optimize pending calls in multithreaded applications.
     If a thread different than the main thread schedules a pending call
     (*note Py_AddPendingCall(): b78.), the bytecode evaluation loop is
     no longer interrupted at each bytecode instruction to check for
     pending calls which cannot be executed.  Only the main thread can
     execute pending calls.

     Previously, the bytecode evaluation loop was interrupted at each
     instruction until the main thread executes pending calls.

   - bpo-1635741(2): Port _weakref extension module to multiphase
     initialization ( PEP 489(3)).

   - bpo-1635741(4): Port _collections module to multiphase
     initialization ( PEP 489(5)).

   - bpo-40010(6): Optimize signal handling in multithreaded
     applications.  If a thread different than the main thread gets a
     signal, the bytecode evaluation loop is no longer interrupted at
     each bytecode instruction to check for pending signals which cannot
     be handled.  Only the main thread of the main interpreter can
     handle signals.

     Previously, the bytecode evaluation loop was interrupted at each
     instruction until the main thread handles signals.

   - bpo-39984(7): If *note Py_AddPendingCall(): b78. is called in a
     subinterpreter, the function is now scheduled to be called from the
     subinterpreter, rather than being called from the main interpreter.
     Each subinterpreter now has its own list of scheduled calls.

   - bpo-1635741(8): Port _heapq module to multiphase initialization.

   - bpo-1635741(9): Port itertools module to multiphase initialization
     ( PEP 489(10)).

   - bpo-37207(11): Speed up calls to ‘frozenset()’ by using the PEP
     590(12) ‘vectorcall’ calling convention.  Patch by Donghee Na.

   - bpo-39984(13): subinterpreters: Move
     ‘_PyRuntimeState.ceval.tracing_possible’ to
     ‘PyInterpreterState.ceval.tracing_possible’: each interpreter now
     has its own variable.

   - bpo-37207(14): Speed up calls to ‘set()’ by using the PEP 590(15)
     ‘vectorcall’ calling convention.  Patch by Donghee Na.

   - bpo-1635741(16): Port _statistics module to multiphase
     initialization ( PEP 489(17)).

   - bpo-39968(18): Use inline function to replace extension modules'
     get_module_state macros.

   - bpo-39965(19): Correctly raise ‘SyntaxError’ if 'await' is used
     inside non-async functions and ‘PyCF_ALLOW_TOP_LEVEL_AWAIT’ is set
     (like in the asyncio REPL). Patch by Pablo Galindo.

   - bpo-39562(20): Allow executing asynchronous comprehensions on the
     top level when the ‘PyCF_ALLOW_TOP_LEVEL_AWAIT’ flag is given.
     Patch by Batuhan Taskaya.

   - bpo-37207(21): Speed up calls to ‘tuple()’ by using the PEP 590(22)
     ‘vectorcall’ calling convention.  Patch by Donghee Na.

   - bpo-38373(23): Changed list overallocation strategy.  It no longer
     overallocates if the new size is closer to overallocated size than
     to the old size and adds padding.

   - bpo-39926(24): Update Unicode database to Unicode version 13.0.0.

   - bpo-19466(25): Clear the frames of daemon threads earlier during
     the Python shutdown to call objects destructors.  So "unclosed
     file" resource warnings are now emitted for daemon threads in a
     more reliable way.

   - bpo-38894(26): Fix a bug that was causing incomplete results when
     calling ‘pathlib.Path.glob’ in the presence of symlinks that point
     to files where the user does not have read access.  Patch by Pablo
     Galindo and Matt Wozniski.

   - bpo-39877(27): Fix *note PyEval_RestoreThread(): 648. random crash
     at exit with daemon threads.  It now accesses the ‘_PyRuntime’
     variable directly instead of using ‘tstate->interp->runtime’, since
     ‘tstate’ can be a dangling pointer after *note Py_Finalize(): 45f.
     has been called.  Moreover, the daemon thread now exits before
     trying to take the GIL.

   - bpo-39871(28): Fix a possible *note SystemError: 795. in
     ‘math.{atan2,copysign,remainder}()’ when the first argument cannot
     be converted to a *note float: 196.  Patch by Zackery Spytz.

   - bpo-39776(29): Fix race condition where threads created by
     PyGILState_Ensure() could get a duplicate id.

     This affects consumers of tstate->id like the contextvar caching
     machinery, which could return invalid cached objects under heavy
     thread load (observed in embedded scenarios).

   - bpo-39778(30): Fixed a crash due to incorrect handling of weak
     references in ‘collections.OrderedDict’ classes.  Patch by Pablo
     Galindo.

   - bpo-1635741(31): Port audioop extension module to multiphase
     initialization ( PEP 489(32)).

   - bpo-39702(33): Relax *note decorator: 93a. grammar restrictions to
     allow any valid expression ( PEP 614(34)).

   - bpo-38091(35): Tweak import deadlock detection code to not deadlock
     itself.

   - bpo-1635741(36): Port _locale extension module to multiphase
     initialization ( PEP 489(37)).

   - bpo-39087(38): Optimize *note PyUnicode_AsUTF8(): 424. and *note
     PyUnicode_AsUTF8AndSize(): a99. slightly when they need to create
     internal UTF-8 cache.

   - bpo-39520(39): Fix unparsing of ext slices with no items
     (‘foo[:,]’).  Patch by Batuhan Taskaya.

   - bpo-39220(40): Do not optimize annotations if 'from __future__
     import annotations' is used.  Patch by Pablo Galindo.

   - bpo-35712(41): Using *note NotImplemented: 1a2. in a boolean
     context has been deprecated.  Patch contributed by Josh Rosenberg.

   - bpo-22490(42): Don't leak environment variable
     ‘__PYVENV_LAUNCHER__’ into the interpreter session on macOS.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40010

   (2) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (3) https://peps.python.org/pep-0489/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (5) https://peps.python.org/pep-0489/

   (6) https://bugs.python.org/issue?@action=redirect&bpo=40010

   (7) https://bugs.python.org/issue?@action=redirect&bpo=39984

   (8) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (9) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (10) https://peps.python.org/pep-0489/

   (11) https://bugs.python.org/issue?@action=redirect&bpo=37207

   (12) https://peps.python.org/pep-0590/

   (13) https://bugs.python.org/issue?@action=redirect&bpo=39984

   (14) https://bugs.python.org/issue?@action=redirect&bpo=37207

   (15) https://peps.python.org/pep-0590/

   (16) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (17) https://peps.python.org/pep-0489/

   (18) https://bugs.python.org/issue?@action=redirect&bpo=39968

   (19) https://bugs.python.org/issue?@action=redirect&bpo=39965

   (20) https://bugs.python.org/issue?@action=redirect&bpo=39562

   (21) https://bugs.python.org/issue?@action=redirect&bpo=37207

   (22) https://peps.python.org/pep-0590/

   (23) https://bugs.python.org/issue?@action=redirect&bpo=38373

   (24) https://bugs.python.org/issue?@action=redirect&bpo=39926

   (25) https://bugs.python.org/issue?@action=redirect&bpo=19466

   (26) https://bugs.python.org/issue?@action=redirect&bpo=38894

   (27) https://bugs.python.org/issue?@action=redirect&bpo=39877

   (28) https://bugs.python.org/issue?@action=redirect&bpo=39871

   (29) https://bugs.python.org/issue?@action=redirect&bpo=39776

   (30) https://bugs.python.org/issue?@action=redirect&bpo=39778

   (31) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (32) https://peps.python.org/pep-0489/

   (33) https://bugs.python.org/issue?@action=redirect&bpo=39702

   (34) https://peps.python.org/pep-0614/

   (35) https://bugs.python.org/issue?@action=redirect&bpo=38091

   (36) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (37) https://peps.python.org/pep-0489/

   (38) https://bugs.python.org/issue?@action=redirect&bpo=39087

   (39) https://bugs.python.org/issue?@action=redirect&bpo=39520

   (40) https://bugs.python.org/issue?@action=redirect&bpo=39220

   (41) https://bugs.python.org/issue?@action=redirect&bpo=35712

   (42) https://bugs.python.org/issue?@action=redirect&bpo=22490


File: python.info,  Node: ライブラリ<153>,  Next: ドキュメント<47>,  Prev: Core and Builtins<150>,  Up: Python 3 9 0 alpha 5

1.24.53.3 ライブラリ
....................

   - bpo-39830(1): Add *note zipfile.Path: 8d8. to ‘__all__’ in the
     *note zipfile: 137. module.

   - bpo-40000(2): Improved error messages for validation of
     ‘ast.Constant’ nodes.  Patch by Batuhan Taskaya.

   - bpo-39999(3): ‘__module__’ of the AST node classes is now set to
     "ast" instead of "_ast".  Added docstrings for dummy AST node
     classes and deprecated attributes.

   - bpo-39991(4): *note uuid.getnode(): da0. now skips IPv6 addresses
     with the same string length than a MAC address (17 characters):
     only use MAC addresses.

   - bpo-39988(5): Deprecated ‘ast.AugLoad’ and ‘ast.AugStore’ node
     classes because they are no longer used.

   - bpo-39656(6): Ensure ‘bin/python3.#’ is always present in virtual
     environments on POSIX platforms - by Anthony Sottile.

   - bpo-39969(7): Deprecated ‘ast.Param’ node class because it's no
     longer used.  Patch by Batuhan Taskaya.

   - bpo-39360(8): Ensure all workers exit when finalizing a
     ‘multiprocessing.Pool’ implicitly via the module finalization
     handlers of multiprocessing.  This fixes a deadlock situation that
     can be experienced when the Pool is not properly finalized via the
     context manager or a call to ‘multiprocessing.Pool.terminate’.
     Patch by Batuhan Taskaya and Pablo Galindo.

   - bpo-35370(9): sys.settrace(), sys.setprofile() and
     _lsprof.Profiler.enable() now properly report *note PySys_Audit():
     613. error if "sys.setprofile" or "sys.settrace" audit event is
     denied.

   - bpo-39936(10): AIX: Fix _aix_support module when the subprocess is
     not available, when building Python from scratch.  It now uses new
     private _bootsubprocess module, rather than having two
     implementations depending if subprocess is available or not.  So
     _aix_support.aix_platform() result is now the same if subprocess is
     available or not.

   - bpo-36144(11): *note collections.OrderedDict: 7f3. now implements
     ‘|’ and ‘|=’ ( PEP 584(12)).

   - bpo-39652(13): The column name found in
     ‘sqlite3.Cursor.description’ is now truncated on the first '[' only
     if the PARSE_COLNAMES option is set.

   - bpo-39915(14): Ensure *note
     unittest.mock.AsyncMock.await_args_list: 1d68. has call objects in
     the order of awaited arguments instead of using *note
     unittest.mock.Mock.call_args: 1d69. which has the last value of the
     call.  Patch by Karthikeyan Singaravelan.

   - bpo-36144(15): Updated *note os.environ: 259. and *note
     os.environb: 25a. to support PEP 584(16)'s merge (‘|’) and update
     (‘|=’) operators.

   - bpo-38662(17): The ‘ensurepip’ module now invokes ‘pip’ via the
     ‘runpy’ module.  Hence it is no longer tightly coupled with the
     internal API of the bundled ‘pip’ version, allowing easier updates
     to a newer ‘pip’ version both internally and for distributors.

   - bpo-38075(18): Fix the *note random.Random.seed(): 1d6a. method
     when a *note bool: 3c3. is passed as the seed.

   - bpo-39916(19): More reliable use of ‘os.scandir()’ in
     ‘Path.glob()’.  It no longer emits a ResourceWarning when
     interrupted.

   - bpo-39850(20): *note multiprocessing: 98. now supports abstract
     socket addresses (if abstract sockets are supported in the running
     platform).  When creating arbitrary addresses (like when
     default-constructing *note multiprocessing.connection.Listener:
     1a23. objects) abstract sockets are preferred to avoid the case
     when the temporary-file-generated address is too large for an
     AF_UNIX socket address.  Patch by Pablo Galindo.

   - bpo-36287(21): *note ast.dump(): ae1. no longer outputs optional
     fields and attributes with default values.  The default values for
     optional fields and attributes of AST nodes are now set as class
     attributes (e.g.  ‘Constant.kind’ is set to ‘None’).

   - bpo-39889(22): Fixed *note ast.unparse(): ae2. for extended slices
     containing a single element (e.g.  ‘a[i:j,]’).  Remove redundant
     tuples when index with a tuple (e.g.  ‘a[i, j]’).

   - bpo-39828(23): Fix *note json.tool: 87. to catch *note
     BrokenPipeError: 1267.  Patch by Donghee Na.

   - bpo-13487(24): Avoid a possible '"RuntimeError: dictionary changed
     size during iteration"' from *note inspect.getmodule(): 1b6d. when
     it tried to loop through *note sys.modules: 17e6.

   - bpo-39674(25): Revert "bpo-37330(26): open() no longer accept 'U'
     in file mode".  The "U" mode of open() is kept in Python 3.9 to
     ease transition from Python 2.7, but will be removed in Python
     3.10.

   - bpo-28577(27): The hosts method on 32-bit prefix length
     IPv4Networks and 128-bit prefix IPv6Networks now returns a list
     containing the single Address instead of an empty list.

   - bpo-39826(28): Add getConnection method to logging HTTPHandler to
     enable custom connections.

   - bpo-39763(29): Reimplement ‘distutils.spawn.spawn’ function with
     the *note subprocess: dc. module.

   - bpo-39794(30): Add -without-decimal-contextvar build option.  This
     enables a thread-local rather than a coroutine local context.

   - bpo-36144(31): *note collections.defaultdict: 13d4. now implements
     ‘|’ ( PEP 584(32)).

   - bpo-39517(33): Fix runpy.run_path() when using pathlike objects

   - bpo-39775(34): Change ‘inspect.Signature.parameters’ back to
     ‘collections.OrderedDict’.  This was changed to ‘dict’ in Python
     3.9.0a4.

   - bpo-39678(35): Refactor queue_manager in *note
     concurrent.futures.ProcessPoolExecutor: 1d6. to make it easier to
     maintain.

   - bpo-39764(36): Fix AttributeError when calling get_stack on a
     PyAsyncGenObject Task

   - bpo-39769(37): The *note compileall.compile_dir(): d1b. function's
     'ddir' parameter and the compileall command line flag ‘-d’ no
     longer write the wrong pathname to the generated pyc file for
     submodules beneath the root of the directory tree being compiled.
     This fixes a regression introduced with Python 3.5.

   - bpo-36144(38): *note types.MappingProxyType: 698. objects now
     support the merge (‘|’) operator from PEP 584(39).

   - bpo-38691(40): The *note importlib: 7b. module now ignores the
     *note PYTHONCASEOK: b55. environment variable when the *note -E:
     b56. or *note -I: b57. command line options are being used.

   - bpo-39719(41): Remove ‘tempfile.SpooledTemporaryFile.softspace()’
     as files no longer have the ‘softspace’ attribute in Python 3.
     Patch by Shantanu.

   - bpo-39667(42): Improve pathlib.Path compatibility on zipfile.Path
     and correct performance degradation as found in zipp 3.0.

   - bpo-39638(43): Keep ASDL signatures in the docstrings for ‘AST’
     nodes.  Patch by Batuhan Taskaya

   - bpo-39639(44): Deprecated ‘ast.Suite’ node class because it's no
     longer used.  Patch by Batuhan Taskaya.

   - bpo-39609(45): Add thread_name_prefix to default asyncio executor

   - bpo-39548(46): Fix handling of header in *note
     urllib.request.AbstractDigestAuthHandler: 1d6b. when the optional
     ‘qop’ parameter is not present.

   - bpo-39509(47): HTTP status codes ‘103 EARLY_HINTS’ and ‘425
     TOO_EARLY’ are added to *note http.HTTPStatus: afc.  Patch by
     Donghee Na.

   - bpo-39507(48): Adding HTTP status 418 "I'm a Teapot" to HTTPStatus
     in http library.  Patch by Ross Rhodes.

   - bpo-39495(49): Remove default value from 'attrs' parameter of *note
     xml.etree.ElementTree.TreeBuilder.start(): 1d6c. for consistency
     between Python and C implementations.

   - bpo-38971(50): Open issue in the BPO indicated a desire to make the
     implementation of codecs.open() at parity with io.open(), which
     implements a try/except to assure file stream gets closed before an
     exception is raised.

   - bpo-38641(51): Added starred expressions support to ‘return’ and
     ‘yield’ statements for ‘lib2to3’.  Patch by Vlad Emelianov.

   - bpo-37534(52): When using minidom module to generate XML documents
     the ability to add Standalone Document Declaration is added.  All
     the changes are made to generate a document in compliance with
     Extensible Markup Language (XML) 1.0 (Fifth Edition) W3C
     Recommendation (available here:
     ‘https://www.w3.org/TR/xml/#sec-prolog-dtd’).

   - bpo-34788(53): Add support for scoped IPv6 addresses to *note
     ipaddress: 84.  Patch by Oleksandr Pavliuk.

   - bpo-34822(54): Simplified AST for subscription.  Simple indices are
     now represented by their value, extended slices are represented as
     tuples.  *note ast: 9. classes ‘Index’ and ‘ExtSlice’ are
     considered deprecated and will be removed in future Python
     versions.  In the meantime, ‘Index(value)’ now returns a ‘value’
     itself, ‘ExtSlice(slices)’ returns ‘Tuple(slices, Load())’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39830

   (2) https://bugs.python.org/issue?@action=redirect&bpo=40000

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39999

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39991

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39988

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39656

   (7) https://bugs.python.org/issue?@action=redirect&bpo=39969

   (8) https://bugs.python.org/issue?@action=redirect&bpo=39360

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35370

   (10) https://bugs.python.org/issue?@action=redirect&bpo=39936

   (11) https://bugs.python.org/issue?@action=redirect&bpo=36144

   (12) https://peps.python.org/pep-0584/

   (13) https://bugs.python.org/issue?@action=redirect&bpo=39652

   (14) https://bugs.python.org/issue?@action=redirect&bpo=39915

   (15) https://bugs.python.org/issue?@action=redirect&bpo=36144

   (16) https://peps.python.org/pep-0584/

   (17) https://bugs.python.org/issue?@action=redirect&bpo=38662

   (18) https://bugs.python.org/issue?@action=redirect&bpo=38075

   (19) https://bugs.python.org/issue?@action=redirect&bpo=39916

   (20) https://bugs.python.org/issue?@action=redirect&bpo=39850

   (21) https://bugs.python.org/issue?@action=redirect&bpo=36287

   (22) https://bugs.python.org/issue?@action=redirect&bpo=39889

   (23) https://bugs.python.org/issue?@action=redirect&bpo=39828

   (24) https://bugs.python.org/issue?@action=redirect&bpo=13487

   (25) https://bugs.python.org/issue?@action=redirect&bpo=39674

   (26) https://bugs.python.org/issue?@action=redirect&bpo=37330

   (27) https://bugs.python.org/issue?@action=redirect&bpo=28577

   (28) https://bugs.python.org/issue?@action=redirect&bpo=39826

   (29) https://bugs.python.org/issue?@action=redirect&bpo=39763

   (30) https://bugs.python.org/issue?@action=redirect&bpo=39794

   (31) https://bugs.python.org/issue?@action=redirect&bpo=36144

   (32) https://peps.python.org/pep-0584/

   (33) https://bugs.python.org/issue?@action=redirect&bpo=39517

   (34) https://bugs.python.org/issue?@action=redirect&bpo=39775

   (35) https://bugs.python.org/issue?@action=redirect&bpo=39678

   (36) https://bugs.python.org/issue?@action=redirect&bpo=39764

   (37) https://bugs.python.org/issue?@action=redirect&bpo=39769

   (38) https://bugs.python.org/issue?@action=redirect&bpo=36144

   (39) https://peps.python.org/pep-0584/

   (40) https://bugs.python.org/issue?@action=redirect&bpo=38691

   (41) https://bugs.python.org/issue?@action=redirect&bpo=39719

   (42) https://bugs.python.org/issue?@action=redirect&bpo=39667

   (43) https://bugs.python.org/issue?@action=redirect&bpo=39638

   (44) https://bugs.python.org/issue?@action=redirect&bpo=39639

   (45) https://bugs.python.org/issue?@action=redirect&bpo=39609

   (46) https://bugs.python.org/issue?@action=redirect&bpo=39548

   (47) https://bugs.python.org/issue?@action=redirect&bpo=39509

   (48) https://bugs.python.org/issue?@action=redirect&bpo=39507

   (49) https://bugs.python.org/issue?@action=redirect&bpo=39495

   (50) https://bugs.python.org/issue?@action=redirect&bpo=38971

   (51) https://bugs.python.org/issue?@action=redirect&bpo=38641

   (52) https://bugs.python.org/issue?@action=redirect&bpo=37534

   (53) https://bugs.python.org/issue?@action=redirect&bpo=34788

   (54) https://bugs.python.org/issue?@action=redirect&bpo=34822


File: python.info,  Node: ドキュメント<47>,  Next: テスト<46>,  Prev: ライブラリ<153>,  Up: Python 3 9 0 alpha 5

1.24.53.4 ドキュメント
......................

   - bpo-39868(1): Updated the Language Reference for PEP 572(2).

   - bpo-13790(3): Change 'string' to 'specification' in format doc.

   - bpo-17422(4): The language reference no longer restricts default
     class namespaces to dicts only.

   - bpo-39530(5): Fix misleading documentation about mixed-type numeric
     comparisons.

   - bpo-39718(6): Update *note token: 100. documentation to reflect
     additions in Python 3.8

   - bpo-39677(7): Changed operand name of 'MAKE_FUNCTION' from 'argc'
     to 'flags' for module *note dis: 3c.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39868

   (2) https://peps.python.org/pep-0572/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=13790

   (4) https://bugs.python.org/issue?@action=redirect&bpo=17422

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39530

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39718

   (7) https://bugs.python.org/issue?@action=redirect&bpo=39677


File: python.info,  Node: テスト<46>,  Next: ビルド<53>,  Prev: ドキュメント<47>,  Up: Python 3 9 0 alpha 5

1.24.53.5 テスト
................

   - bpo-40019(1): test_gdb now skips tests if it detects that gdb
     failed to read debug information because the Python binary is
     optimized.

   - bpo-27807(2): ‘test_site.test_startup_imports()’ is now skipped if
     a path of *note sys.path: 3e4. contains a ‘.pth’ file.

   - bpo-26067(3): Do not fail test_shutil test_chown test when uid or
     gid of user cannot be resolved to a name.

   - bpo-39855(4): test_subprocess.test_user() now skips the test on an
     user name if the user name doesn't exist.  For example, skip the
     test if the user "nobody" doesn't exist on Linux.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40019

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27807

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26067

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39855


File: python.info,  Node: ビルド<53>,  Next: Windows<47>,  Prev: テスト<46>,  Up: Python 3 9 0 alpha 5

1.24.53.6 ビルド
................

   - bpo-39761(1): Fix build with DTrace but without additional DFLAGS.

   - bpo-39763(2): setup.py now uses a basic implementation of the *note
     subprocess: dc. module if the *note subprocess: dc. module is not
     available: before required C extension modules are built.

   - bpo-1294959(3): Add ‘--with-platlibdir’ option to the configure
     script: name of the platform-specific library directory, stored in
     the new *note sys.platlibdir: b32. attribute.  It is used to build
     the path of platform-specific extension modules and the path of the
     standard library.  It is equal to ‘"lib"’ on most platforms.  On
     Fedora and SuSE, it is equal to ‘"lib64"’ on 64-bit platforms.
     Patch by Jan Matějek, Matěj Cepl, Charalampos Stratakis and Victor
     Stinner.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39761

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39763

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1294959


File: python.info,  Node: Windows<47>,  Next: macOS<37>,  Prev: ビルド<53>,  Up: Python 3 9 0 alpha 5

1.24.53.7 Windows
.................

   - bpo-39930(1): Ensures the required ‘vcruntime140.dll’ is included
     in install packages.

   - bpo-39847(2): Avoid hang when computer is hibernated whilst waiting
     for a mutex (for lock-related objects from *note threading: f3.)
     around 49-day uptime.

   - bpo-38597(3): ‘distutils’ will no longer statically link
     ‘vcruntime140.dll’ when a redistributable version is unavailable.
     All future releases of CPython will include a copy of this DLL to
     ensure distributed extensions can continue to load.

   - bpo-38380(4): Update Windows builds to use SQLite 3.31.1

   - bpo-39789(5): Update Windows release build machines to Visual
     Studio 2019 (MSVC 14.2).

   - bpo-34803(6): Package for nuget.org now includes repository
     reference and bundled icon image.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39930

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39847

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38597

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38380

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39789

   (6) https://bugs.python.org/issue?@action=redirect&bpo=34803


File: python.info,  Node: macOS<37>,  Next: IDLE<28>,  Prev: Windows<47>,  Up: Python 3 9 0 alpha 5

1.24.53.8 macOS
...............

   - bpo-38380(1): Update macOS builds to use SQLite 3.31.1

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38380


File: python.info,  Node: IDLE<28>,  Next: Tools/Demos<32>,  Prev: macOS<37>,  Up: Python 3 9 0 alpha 5

1.24.53.9 IDLE
..............

   - bpo-27115(1): For 'Go to Line', use a Query box subclass with IDLE
     standard behavior and improved error checking.

   - bpo-39885(2): Since clicking to get an IDLE context menu moves the
     cursor, any text selection should be and now is cleared.

   - bpo-39852(3): Edit "Go to line" now clears any selection,
     preventing accidental deletion.  It also updates Ln and Col on the
     status bar.

   - bpo-39781(4): Selecting code context lines no longer causes a jump.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27115

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39885

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39852

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39781


File: python.info,  Node: Tools/Demos<32>,  Next: C API<48>,  Prev: IDLE<28>,  Up: Python 3 9 0 alpha 5

1.24.53.10 Tools/Demos
......................

   - bpo-36184(1): Port python-gdb.py to FreeBSD. python-gdb.py now
     checks for "take_gil" function name to check if a frame tries to
     acquire the GIL, instead of checking for "pthread_cond_timedwait"
     which is specific to Linux and can be a different condition than
     the GIL.

   - bpo-38080(2): Added support to fix ‘getproxies’ in the
     ‘lib2to3.fixes.fix_urllib’ module.  Patch by José Roberto Meza
     Cabrera.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36184

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38080


File: python.info,  Node: C API<48>,  Prev: Tools/Demos<32>,  Up: Python 3 9 0 alpha 5

1.24.53.11 C API
................

   - bpo-40024(1): Add *note PyModule_AddType(): b6c. helper function:
     add a type to a module.  Patch by Donghee Na.

   - bpo-39946(2): Remove ‘_PyRuntime.getframe’ hook and remove
     ‘_PyThreadState_GetFrame’ macro which was an alias to
     ‘_PyRuntime.getframe’.  They were only exposed by the internal C
     API. Remove also ‘PyThreadFrameGetter’ type.

   - bpo-39947(3): Add *note PyThreadState_GetFrame(): 991. function:
     get the current frame of a Python thread state.

   - bpo-37207(4): Add _PyArg_NoKwnames helper function.  Patch by
     Donghee Na.

   - bpo-39947(5): Add *note PyThreadState_GetInterpreter(): b69.: get
     the interpreter of a Python thread state.

   - bpo-39947(6): Add *note PyInterpreterState_Get(): 64c. function to
     the limited C API.

   - bpo-35370(7): If *note PySys_Audit(): 613. fails in *note
     PyEval_SetProfile(): 1716. or *note PyEval_SetTrace(): 663, log the
     error as an unraisable exception.

   - bpo-39947(8): Move the static inline function flavor of
     Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() to the internal
     C API: they access PyThreadState attributes.  The limited C API
     provides regular functions which hide implementation details.

   - bpo-39947(9): Py_TRASHCAN_BEGIN_CONDITION and Py_TRASHCAN_END macro
     no longer access PyThreadState attributes, but call new private
     _PyTrash_begin() and _PyTrash_end() functions which hide
     implementation details.

   - bpo-39884(10): *note PyDescr_NewMethod(): 1d75. and *note
     PyCFunction_NewEx(): 1d76. now include the method name in the
     SystemError "bad call flags" error message to ease debug.

   - bpo-39877(11): Deprecated ‘PyEval_InitThreads()’ and
     ‘PyEval_ThreadsInitialized()’.  Calling ‘PyEval_InitThreads()’ now
     does nothing.

   - bpo-38249(12): *note Py_UNREACHABLE: dae. is now implemented with
     ‘__builtin_unreachable()’ and analogs in release mode.

   - bpo-38643(13): *note PyNumber_ToBase(): 1b73. now raises a *note
     SystemError: 795. instead of crashing when called with invalid
     base.

   - bpo-39882(14): The *note Py_FatalError(): b7a. function is replaced
     with a macro which logs automatically the name of the current
     function, unless the ‘Py_LIMITED_API’ macro is defined.

   - bpo-39824(15): Extension modules: *note m_traverse: b71, *note
     m_clear: b72. and *note m_free: b73. functions of *note
     PyModuleDef: b74. are no longer called if the module state was
     requested but is not allocated yet.  This is the case immediately
     after the module is created and before the module is executed
     (*note Py_mod_exec: b75. function).  More precisely, these
     functions are not called if *note m_size: b76. is greater than 0
     and the module state (as returned by *note PyModule_GetState():
     b77.) is ‘NULL’.

     Extension modules without module state (‘m_size <= 0’) are not
     affected.

   - bpo-38913(16): Fixed segfault in ‘Py_BuildValue()’ called with a
     format containing "#" and undefined PY_SSIZE_T_CLEAN whwn an
     exception is set.

   - bpo-38500(17): Add a private API to get and set the frame
     evaluation function: add *note
     _PyInterpreterState_GetEvalFrameFunc(): 1d77. and *note
     _PyInterpreterState_SetEvalFrameFunc(): 1d78. C functions.  The
     *note _PyFrameEvalFunction: 97a. function type now takes a 'tstate'
     parameter.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=40024

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39946

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39947

   (4) https://bugs.python.org/issue?@action=redirect&bpo=37207

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39947

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39947

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35370

   (8) https://bugs.python.org/issue?@action=redirect&bpo=39947

   (9) https://bugs.python.org/issue?@action=redirect&bpo=39947

   (10) https://bugs.python.org/issue?@action=redirect&bpo=39884

   (11) https://bugs.python.org/issue?@action=redirect&bpo=39877

   (12) https://bugs.python.org/issue?@action=redirect&bpo=38249

   (13) https://bugs.python.org/issue?@action=redirect&bpo=38643

   (14) https://bugs.python.org/issue?@action=redirect&bpo=39882

   (15) https://bugs.python.org/issue?@action=redirect&bpo=39824

   (16) https://bugs.python.org/issue?@action=redirect&bpo=38913

   (17) https://bugs.python.org/issue?@action=redirect&bpo=38500


File: python.info,  Node: Python 3 9 0 alpha 4,  Next: Python 3 9 0 alpha 3,  Prev: Python 3 9 0 alpha 5,  Up: 変更履歴

1.24.54 Python 3.9.0 alpha 4
----------------------------

'Release date: 2020-02-25'

* Menu:

* セキュリティ: セキュリティ<40>.
* Core and Builtins: Core and Builtins<151>.
* ライブラリ: ライブラリ<154>.
* ドキュメント: ドキュメント<48>.
* テスト: テスト<47>.
* ビルド: ビルド<54>.
* Windows: Windows<48>.
* IDLE: IDLE<29>.
* C API: C API<49>.


File: python.info,  Node: セキュリティ<40>,  Next: Core and Builtins<151>,  Up: Python 3 9 0 alpha 4

1.24.54.1 セキュリティ
......................

   - bpo-39184(1): Add audit events to functions in ‘fcntl’, ‘msvcrt’,
     ‘os’, ‘resource’, ‘shutil’, ‘signal’ and ‘syslog’.

   - bpo-39401(2): Avoid unsafe DLL load at startup on Windows 7 and
     earlier.

   - bpo-39184(3): Add audit events to command execution functions in os
     and pty modules.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39184

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39401

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39184


File: python.info,  Node: Core and Builtins<151>,  Next: ライブラリ<154>,  Prev: セキュリティ<40>,  Up: Python 3 9 0 alpha 4

1.24.54.2 Core and Builtins
...........................

   - bpo-39382(1): Fix a use-after-free in the single inheritance path
     of ‘issubclass()’, when the ‘__bases__’ of an object has a single
     reference, and so does its first item.  Patch by Yonatan
     Goldschmidt.

   - bpo-39573(2): Update clinic tool to use *note Py_IS_TYPE(): 1ba0.
     Patch by Donghee Na.

   - bpo-39619(3): Enable use of *note os.chroot(): 1d7c. on HP-UX
     systems.

   - bpo-39573(4): Add *note Py_IS_TYPE(): 1ba0. static inline function
     to check whether the object 'o' type is 'type'.

   - bpo-39606(5): Fix regression caused by fix for bpo-39386(6), that
     prevented calling ‘aclose’ on an async generator that had already
     been closed or exhausted.

   - bpo-39579(7): Change the ending column offset of ‘Attribute’ nodes
     constructed in ‘ast_for_dotted_name’ to point at the end of the
     current node and not at the end of the last ‘NAME’ node.

   - bpo-1635741(8): Port _crypt extension module to multiphase
     initialization ( PEP 489(9)).

   - bpo-1635741(10): Port _contextvars extension module to multiphase
     initialization ( PEP 489(11)).

   - bpo-39510(12): Fix segfault in ‘readinto()’ method on closed
     BufferedReader.

   - bpo-39502(13): Fix *note time.localtime(): 1712. on 64-bit AIX to
     support years before 1902 and after 2038.  Patch by M Felt.

   - bpo-39492(14): Fix a reference cycle in the C Pickler that was
     preventing the garbage collection of deleted, pickled objects.

   - bpo-39453(15): Fixed a possible crash in ‘list.__contains__()’ when
     a list is changed during comparing items.  Patch by Donghee Na.

   - bpo-39434(16): *note floor division: b3e. of float operation now
     has a better performance.  Also the message of *note
     ZeroDivisionError: b3f. for this operation is updated.  Patch by
     Donghee Na.

   - bpo-1635741(17): Port _codecs extension module to multiphase
     initialization ( PEP 489(18)).

   - bpo-1635741(19): Port _bz2 extension module to multiphase
     initialization ( PEP 489(20)).

   - bpo-1635741(21): Port _abc extension module to multiphase
     initialization ( PEP 489(22)).

   - bpo-39320(23): Replace two complex bytecodes for building dicts
     with two simpler ones.  The new bytecodes ‘DICT_MERGE’ and
     ‘DICT_UPDATE’ have been added The old bytecodes ‘BUILD_MAP_UNPACK’
     and ‘BUILD_MAP_UNPACK_WITH_CALL’ have been removed.

   - bpo-39219(24): Syntax errors raised in the tokenizer now always set
     correct "text" and "offset" attributes.

   - bpo-36051(25): Drop the GIL during large ‘bytes.join’ operations.
     Patch by Bruce Merry.

   - bpo-38960(26): Fix DTrace build issues on FreeBSD. Patch by David
     Carlier.

   - bpo-37207(27): Speed up calls to ‘range()’ by about 30%, by using
     the PEP 590 ‘vectorcall’ calling convention.  Patch by Mark
     Shannon.

   - bpo-36144(28): *note dict: 183. (and *note collections.UserDict:
     1d7d.) objects now support PEP 584's merge (‘|’) and update (‘|=’)
     operators.  Patch by Brandt Bucher.

   - bpo-32856(29): Optimized the idiom for assignment a temporary
     variable in comprehensions.  Now ‘for y in [expr]’ in
     comprehensions is as fast as a simple assignment ‘y = expr’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39382

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39573

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39619

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39573

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39606

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39386

   (7) https://bugs.python.org/issue?@action=redirect&bpo=39579

   (8) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (9) https://peps.python.org/pep-0489/

   (10) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (11) https://peps.python.org/pep-0489/

   (12) https://bugs.python.org/issue?@action=redirect&bpo=39510

   (13) https://bugs.python.org/issue?@action=redirect&bpo=39502

   (14) https://bugs.python.org/issue?@action=redirect&bpo=39492

   (15) https://bugs.python.org/issue?@action=redirect&bpo=39453

   (16) https://bugs.python.org/issue?@action=redirect&bpo=39434

   (17) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (18) https://peps.python.org/pep-0489/

   (19) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (20) https://peps.python.org/pep-0489/

   (21) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (22) https://peps.python.org/pep-0489/

   (23) https://bugs.python.org/issue?@action=redirect&bpo=39320

   (24) https://bugs.python.org/issue?@action=redirect&bpo=39219

   (25) https://bugs.python.org/issue?@action=redirect&bpo=36051

   (26) https://bugs.python.org/issue?@action=redirect&bpo=38960

   (27) https://bugs.python.org/issue?@action=redirect&bpo=37207

   (28) https://bugs.python.org/issue?@action=redirect&bpo=36144

   (29) https://bugs.python.org/issue?@action=redirect&bpo=32856


File: python.info,  Node: ライブラリ<154>,  Next: ドキュメント<48>,  Prev: Core and Builtins<151>,  Up: Python 3 9 0 alpha 4

1.24.54.3 ライブラリ
....................

   - bpo-30566(1): Fix *note IndexError: 174e. when trying to decode an
     invalid string with punycode codec.

   - bpo-39649(2): Remove obsolete check for ‘__args__’ in
     ‘bdb.Bdb.format_stack_entry’.

   - bpo-39648(3): Expanded *note math.gcd(): b0c. and *note math.lcm():
     b0d. to handle multiple arguments.

   - bpo-39681(4): Fix a regression where the C pickle module wouldn't
     allow unpickling from a file-like object that doesn't expose a
     readinto() method.

   - bpo-35950(5): Raise *note io.UnsupportedOperation: 1d7f. in
     ‘io.BufferedReader.truncate()’ when it is called on a read-only
     *note io.BufferedReader: 1427. instance.

   - bpo-39479(6): Add *note math.lcm(): b0d. function: least common
     multiple.

   - bpo-39674(7): Revert "Do not expose abstract collection classes in
     the collections module" change (bpo-25988(8)).  Aliases to ABC like
     collections.Mapping are kept in Python 3.9 to ease transition from
     Python 2.7, but will be removed in Python 3.10.

   - bpo-39104(9): Fix hanging ProcessPoolExcutor on
     ‘shutdown(wait=False)’ when a task has failed pickling.

   - bpo-39627(10): Fixed TypedDict totality check for inherited keys.

   - bpo-39474(11): Fixed starting position of AST for expressions like
     ‘(a)(b)’, ‘(a)[b]’ and ‘(a).b’.

   - bpo-21016(12): The *note pydoc: ba. and *note trace: 103. modules
     now use the *note sysconfig: e1. module to get the path to the
     Python standard library, to support uncommon installation path like
     ‘/usr/lib64/python3.9/’ on Fedora.  Patch by Jan Matějek.

   - bpo-39590(13): Collections.deque now holds strong references during
     deque.__contains__ and deque.count, fixing crashes.

   - bpo-39586(14): The distutils ‘bdist_msi’ command is deprecated in
     Python 3.9, use ‘bdist_wheel’ (wheel packages) instead.

   - bpo-39595(15): Improved performance of zipfile.Path for files with
     a large number of entries.  Also improved performance and fixed
     minor issue as published with importlib_metadata 1.5(16).

   - bpo-39350(17): Fix regression in *note fractions.Fraction: 213. if
     the numerator and/or the denominator is an *note int: 19b.
     subclass.  The *note math.gcd(): b0c. function is now used to
     normalize the 'numerator' and 'denominator'.  *note math.gcd():
     b0c. always return a *note int: 19b. type.  Previously, the GCD
     type depended on 'numerator' and 'denominator'.

   - bpo-39567(18): Added audit for *note os.walk(): 6d0, *note
     os.fwalk(): d52, *note pathlib.Path.glob(): 537. and *note
     pathlib.Path.rglob(): 538.

   - bpo-39559(19): Remove unused, undocumented argument ‘getters’ from
     *note uuid.getnode(): da0.

   - bpo-38149(20): *note sys.audit(): 191b. is now called only once per
     call of *note glob.glob(): 5a0. and *note glob.iglob(): a08.

   - bpo-39546(21): Fix a regression in *note ArgumentParser: 1bd. where
     ‘allow_abbrev=False’ was ignored for long options that used a
     prefix character other than "-".

   - bpo-39450(22): Striped whitespace from docstring before returning
     it from ‘unittest.case.shortDescription()’.

   - bpo-12915(23): A new function ‘resolve_name’ has been added to the
     ‘pkgutil’ module.  This resolves a string of the form ‘'a.b.c.d'’
     or ‘'a.b:c.d'’ to an object.  In the example, ‘a.b’ is a
     package/module and ‘c.d’ is an object within that package/module
     reached via recursive attribute access.

   - bpo-39353(24): The *note binascii.crc_hqx(): 93d. function is no
     longer deprecated.

   - bpo-39493(25): Mark ‘typing.IO.closed’ as a property

   - bpo-39491(26): Add *note typing.Annotated: b37. and
     ‘include_extras’ parameter to *note typing.get_type_hints(): 8c0.
     as part of PEP 593(27).  Patch by Till Varoquaux, documentation by
     Till Varoquaux and Konstantin Kashin.

   - bpo-39485(28): Fix a bug in *note unittest.mock.create_autospec():
     1934. that would complain about the wrong number of arguments for
     custom descriptors defined in an extension module returning
     functions.

   - bpo-38932(29): Mock fully resets child objects on reset_mock().
     Patch by Vegard Stikbakke

   - bpo-39082(30): Allow AsyncMock to correctly patch static/class
     methods

   - bpo-39432(31): Implement PEP-489 algorithm for non-ascii
     "PyInit_..."  symbol names in distutils to make it export the
     correct init symbol also on Windows.

   - bpo-18819(32): Omit ‘devmajor’ and ‘devminor’ fields for non-device
     files in *note tarfile: e4. archives, enabling bit-for-bit
     compatibility with GNU ‘tar(1)’.

   - bpo-39349(33): Added a new 'cancel_futures' parameter to *note
     concurrent.futures.Executor.shutdown(): aea. that cancels all
     pending futures which have not started running, instead of waiting
     for them to complete before shutting down the executor.

   - bpo-39274(34): ‘bool(fraction.Fraction)’ now returns a boolean even
     if (numerator != 0) does not return a boolean (ex: numpy number).

   - bpo-34793(35): Remove support for ‘with (await asyncio.lock):’ and
     ‘with (yield from asyncio.lock):’.  The same is correct for
     ‘asyncio.Condition’ and ‘asyncio.Semaphore’.

   - bpo-25597(36): Ensure, if ‘wraps’ is supplied to *note
     unittest.mock.MagicMock: 108f, it is used to calculate return
     values for the magic methods instead of using the default return
     values.  Patch by Karthikeyan Singaravelan.

   - bpo-36350(37): ‘inspect.Signature.parameters’ and
     ‘inspect.BoundArguments.arguments’ are now dicts instead of
     OrderedDicts.  Patch contributed by Rémi Lapeyre.

   - bpo-35727(38): Fix sys.exit() and sys.exit(None) exit code
     propagation when used in multiprocessing.Process.

   - bpo-32173(39): * Add ‘lazycache’ function to ‘__all__’.  * Use
     ‘dict.clear’ to clear the cache.  * Refactoring ‘getline’ function
     and ‘checkcache’ function.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30566

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39649

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39648

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39681

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35950

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39479

   (7) https://bugs.python.org/issue?@action=redirect&bpo=39674

   (8) https://bugs.python.org/issue?@action=redirect&bpo=25988

   (9) https://bugs.python.org/issue?@action=redirect&bpo=39104

   (10) https://bugs.python.org/issue?@action=redirect&bpo=39627

   (11) https://bugs.python.org/issue?@action=redirect&bpo=39474

   (12) https://bugs.python.org/issue?@action=redirect&bpo=21016

   (13) https://bugs.python.org/issue?@action=redirect&bpo=39590

   (14) https://bugs.python.org/issue?@action=redirect&bpo=39586

   (15) https://bugs.python.org/issue?@action=redirect&bpo=39595

   (16) 
https://importlib-metadata.readthedocs.io/en/latest/history.html#v1-5-0

   (17) https://bugs.python.org/issue?@action=redirect&bpo=39350

   (18) https://bugs.python.org/issue?@action=redirect&bpo=39567

   (19) https://bugs.python.org/issue?@action=redirect&bpo=39559

   (20) https://bugs.python.org/issue?@action=redirect&bpo=38149

   (21) https://bugs.python.org/issue?@action=redirect&bpo=39546

   (22) https://bugs.python.org/issue?@action=redirect&bpo=39450

   (23) https://bugs.python.org/issue?@action=redirect&bpo=12915

   (24) https://bugs.python.org/issue?@action=redirect&bpo=39353

   (25) https://bugs.python.org/issue?@action=redirect&bpo=39493

   (26) https://bugs.python.org/issue?@action=redirect&bpo=39491

   (27) https://peps.python.org/pep-0593/

   (28) https://bugs.python.org/issue?@action=redirect&bpo=39485

   (29) https://bugs.python.org/issue?@action=redirect&bpo=38932

   (30) https://bugs.python.org/issue?@action=redirect&bpo=39082

   (31) https://bugs.python.org/issue?@action=redirect&bpo=39432

   (32) https://bugs.python.org/issue?@action=redirect&bpo=18819

   (33) https://bugs.python.org/issue?@action=redirect&bpo=39349

   (34) https://bugs.python.org/issue?@action=redirect&bpo=39274

   (35) https://bugs.python.org/issue?@action=redirect&bpo=34793

   (36) https://bugs.python.org/issue?@action=redirect&bpo=25597

   (37) https://bugs.python.org/issue?@action=redirect&bpo=36350

   (38) https://bugs.python.org/issue?@action=redirect&bpo=35727

   (39) https://bugs.python.org/issue?@action=redirect&bpo=32173


File: python.info,  Node: ドキュメント<48>,  Next: テスト<47>,  Prev: ライブラリ<154>,  Up: Python 3 9 0 alpha 4

1.24.54.4 ドキュメント
......................

   - bpo-17422(1): The language reference now specifies restrictions on
     class namespaces.  Adapted from a patch by Ethan Furman.

   - bpo-39572(2): Updated documentation of ‘total’ flag of ‘TypedDict’.

   - bpo-39654(3): In pyclbr doc, update 'class' to 'module' where
     appropriate and add readmodule comment.  Patch by Hakan Çelik.

   - bpo-39153(4): Clarify refcounting semantics for the following
     functions: - PyObject_SetItem - PyMapping_SetItemString -
     PyDict_SetItem - PyDict_SetItemString

   - bpo-39392(5): Explain that when filling with turtle, overlap
     regions may be left unfilled.

   - bpo-39369(6): Update mmap readline method description.  The fact
     that the readline method does update the file position should not
     be ignored since this might give the impression for the programmer
     that it doesn't update it.

   - bpo-9056(7): Include subsection in TOC for PDF version of docs.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17422

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39572

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39654

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39153

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39392

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39369

   (7) https://bugs.python.org/issue?@action=redirect&bpo=9056


File: python.info,  Node: テスト<47>,  Next: ビルド<54>,  Prev: ドキュメント<48>,  Up: Python 3 9 0 alpha 4

1.24.54.5 テスト
................

   - bpo-38325(1): Skip tests on non-BMP characters of
     test_winconsoleio.

   - bpo-39502(2): Skip test_zipfile.test_add_file_after_2107() if *note
     time.localtime(): 1712. fails with *note OverflowError: a81.  It is
     the case on AIX 6.1 for example.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38325

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39502


File: python.info,  Node: ビルド<54>,  Next: Windows<48>,  Prev: テスト<47>,  Up: Python 3 9 0 alpha 4

1.24.54.6 ビルド
................

   - bpo-39489(1): Remove ‘COUNT_ALLOCS’ special build.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39489


File: python.info,  Node: Windows<48>,  Next: IDLE<29>,  Prev: ビルド<54>,  Up: Python 3 9 0 alpha 4

1.24.54.7 Windows
.................

   - bpo-39553(1): Delete unused code related to SxS manifests.

   - bpo-39439(2): Honor the Python path when a virtualenv is active on
     Windows.

   - bpo-39393(3): Improve the error message when attempting to load a
     DLL with unresolved dependencies.

   - bpo-38883(4): *note home(): 1043. and *note expanduser(): 1042. on
     Windows now prefer ‘USERPROFILE’ and no longer use ‘HOME’, which is
     not normally set for regular user accounts.  This makes them again
     behave like *note os.path.expanduser(): c09, which was changed to
     ignore ‘HOME’ in 3.8, see bpo-36264(5).

   - bpo-39185(6): The build.bat script has additional options for
     very-quiet output (-q) and very-verbose output (-vv)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39553

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39439

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39393

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38883

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36264

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39185


File: python.info,  Node: IDLE<29>,  Next: C API<49>,  Prev: Windows<48>,  Up: Python 3 9 0 alpha 4

1.24.54.8 IDLE
..............

   - bpo-39663(1): Add tests for pyparse find_good_parse_start().

   - bpo-39600(2): In the font configuration window, remove duplicated
     font names.

   - bpo-30780(3): Add remaining configdialog tests for buttons and
     highlights and keys tabs.

   - bpo-39388(4): IDLE Settings Cancel button now cancels pending
     changes

   - bpo-38792(5): Close an IDLE shell calltip if a *note
     KeyboardInterrupt: bc5. or shell restart occurs.  Patch by Zackery
     Spytz.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39663

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39600

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30780

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39388

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38792


File: python.info,  Node: C API<49>,  Prev: IDLE<29>,  Up: Python 3 9 0 alpha 4

1.24.54.9 C API
...............

   - bpo-35081(1): Move the ‘bytes_methods.h’ header file to the
     internal C API as ‘pycore_bytes_methods.h’: it only contains
     private symbols (prefixed by ‘_Py’), except of the
     ‘PyDoc_STRVAR_shared()’ macro.

   - bpo-35081(2): Move the ‘dtoa.h’ header file to the internal C API
     as ‘pycore_dtoa.h’: it only contains private functions (prefixed by
     ‘_Py’).  The *note math: 92. and *note cmath: 19. modules must now
     be compiled with the ‘Py_BUILD_CORE’ macro defined.

   - bpo-39573(3): Add *note Py_SET_SIZE(): 986. function to set the
     size of an object.

   - bpo-39500(4): *note PyUnicode_IsIdentifier(): 1d86. does not call
     *note Py_FatalError(): b7a. anymore if the string is not ready.

   - bpo-39573(5): Add *note Py_SET_TYPE(): 984. function to set the
     type of an object.

   - bpo-39573(6): Add a *note Py_SET_REFCNT(): aa8. function to set the
     reference counter of an object.

   - bpo-39542(7): Convert *note PyType_HasFeature(): 1d3c, *note
     PyType_Check(): 1d87. and *note PyType_CheckExact(): 1d88. macros
     to static inline functions.

   - bpo-39542(8): In the limited C API, ‘PyObject_INIT()’ and
     ‘PyObject_INIT_VAR()’ are now defined as aliases to *note
     PyObject_Init(): c60. and *note PyObject_InitVar(): 1d40. to make
     their implementation opaque.  It avoids to leak implementation
     details in the limited C API. Exclude the following functions from
     the limited C API: ‘_Py_NewReference()’, ‘_Py_ForgetReference()’,
     ‘_PyTraceMalloc_NewReference()’ and ‘_Py_GetRefTotal()’.

   - bpo-39542(9): Exclude trashcan mechanism from the limited C API: it
     requires access to PyTypeObject and PyThreadState structure fields,
     whereas these structures are opaque in the limited C API.

   - bpo-39511(10): The *note PyThreadState_Clear(): 1991. function now
     calls the ‘PyThreadState.on_delete’ callback.  Previously, that
     happened in *note PyThreadState_Delete(): 1d89.

   - bpo-38076(11): Fix to clear the interpreter state only after
     clearing module globals to guarantee module state access from C
     Extensions during runtime destruction

   - bpo-39245(12): The Vectorcall API (PEP 590) was made public, adding
     the functions ‘PyObject_Vectorcall’, ‘PyObject_VectorcallMethod’,
     ‘PyVectorcall_Function’, ‘PyObject_CallOneArg’,
     ‘PyObject_CallMethodNoArgs’, ‘PyObject_CallMethodOneArg’,
     ‘PyObject_FastCallDict’, and the flag ‘Py_TPFLAGS_HAVE_VECTORCALL’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35081

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35081

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39573

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39500

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39573

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39573

   (7) https://bugs.python.org/issue?@action=redirect&bpo=39542

   (8) https://bugs.python.org/issue?@action=redirect&bpo=39542

   (9) https://bugs.python.org/issue?@action=redirect&bpo=39542

   (10) https://bugs.python.org/issue?@action=redirect&bpo=39511

   (11) https://bugs.python.org/issue?@action=redirect&bpo=38076

   (12) https://bugs.python.org/issue?@action=redirect&bpo=39245


File: python.info,  Node: Python 3 9 0 alpha 3,  Next: Python 3 9 0 alpha 2,  Prev: Python 3 9 0 alpha 4,  Up: 変更履歴

1.24.55 Python 3.9.0 alpha 3
----------------------------

'Release date: 2020-01-24'

* Menu:

* Core and Builtins: Core and Builtins<152>.
* ライブラリ: ライブラリ<155>.
* ドキュメント: ドキュメント<49>.
* ビルド: ビルド<55>.
* IDLE: IDLE<30>.
* C API: C API<50>.


File: python.info,  Node: Core and Builtins<152>,  Next: ライブラリ<155>,  Up: Python 3 9 0 alpha 3

1.24.55.1 Core and Builtins
...........................

   - bpo-39427(1): Document all possibilities for the ‘-X’ options in
     the command line help section.  Patch by Pablo Galindo.

   - bpo-39421(2): Fix possible crashes when operating with the
     functions in the *note heapq: 6d. module and custom comparison
     operators.

   - bpo-39386(3): Prevent double awaiting of async iterator.

   - bpo-17005(4): Add ‘functools.TopologicalSorter’ to the *note
     functools: 63. module to offers functionality to perform
     topological sorting of graphs.  Patch by Pablo Galindo, Tim Peters
     and Larry Hastings.

   - bpo-39320(5): Replace four complex bytecodes for building sequences
     with three simpler ones.

     The following four bytecodes have been removed:

        * BUILD_LIST_UNPACK

        * BUILD_TUPLE_UNPACK

        * BUILD_SET_UNPACK

        * BUILD_TUPLE_UNPACK_WITH_CALL

     The following three bytecodes have been added:

        * LIST_TO_TUPLE

        * LIST_EXTEND

        * SET_UPDATE

   - bpo-39336(6): Import loaders which publish immutable module objects
     can now publish immutable packages in addition to individual
     modules.

   - bpo-39322(7): Added a new function *note gc.is_finalized(): af9. to
     check if an object has been finalized by the garbage collector.
     Patch by Pablo Galindo.

   - bpo-39048(8): Improve the displayed error message when incorrect
     types are passed to ‘async with’ statements by looking up the
     ‘__aenter__()’ special method before the ‘__aexit__()’ special
     method when entering an asynchronous context manager.  Patch by
     Géry Ogam.

   - bpo-39235(9): Fix AST end location for lone generator expression in
     function call, e.g.  f(i for i in a).

   - bpo-39209(10): Correctly handle multi-line tokens in interactive
     mode.  Patch by Pablo Galindo.

   - bpo-1635741(11): Port _json extension module to multiphase
     initialization ( PEP 489(12)).

   - bpo-39216(13): Fix constant folding optimization for positional
     only arguments - by Anthony Sottile.

   - bpo-39215(14): Fix ‘SystemError’ when nested function has
     annotation on positional-only argument - by Anthony Sottile.

   - bpo-39200(15): Correct the error message when calling the *note
     min(): 110b. or *note max(): 110c. with no arguments.  Patch by
     Donghee Na.

   - bpo-39200(16): Correct the error message when trying to construct
     *note range: b3d. objects with no arguments.  Patch by Pablo
     Galindo.

   - bpo-39166(17): Fix incorrect line execution reporting in trace
     functions when tracing the last iteration of asynchronous for
     loops.  Patch by Pablo Galindo.

   - bpo-39114(18): Fix incorrect line execution reporting in trace
     functions when tracing exception handlers with name binding.  Patch
     by Pablo Galindo.

   - bpo-39156(19): Split the COMPARE_OP bytecode instruction into four
     distinct instructions.

        * COMPARE_OP for rich comparisons

        * IS_OP for 'is' and 'is not' tests

        * CONTAINS_OP for 'in' and 'is not' tests

        * JUMP_IF_NOT_EXC_MATCH for checking exceptions in 'try-except'
          statements.

     This improves the clarity of the interpreter and should provide a
     modest speedup.

   - bpo-38588(20): Fix possible crashes in dict and list when calling
     *note PyObject_RichCompareBool(): 1d8c.

   - bpo-13601(21): By default, ‘sys.stderr’ is line-buffered now, even
     if ‘stderr’ is redirected to a file.  You can still make
     ‘sys.stderr’ unbuffered by passing the *note -u: 1d8d. command-line
     option or setting the *note PYTHONUNBUFFERED: 1d8e. environment
     variable.

     (Contributed by Jendrik Seipp in bpo-13601(22).)

   - bpo-38610(23): Fix possible crashes in several list methods by
     holding strong references to list elements when calling *note
     PyObject_RichCompareBool(): 1d8c.

   - bpo-32021(24): Include brotli .br encoding in mimetypes
     encodings_map

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39427

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39421

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39386

   (4) https://bugs.python.org/issue?@action=redirect&bpo=17005

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39320

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39336

   (7) https://bugs.python.org/issue?@action=redirect&bpo=39322

   (8) https://bugs.python.org/issue?@action=redirect&bpo=39048

   (9) https://bugs.python.org/issue?@action=redirect&bpo=39235

   (10) https://bugs.python.org/issue?@action=redirect&bpo=39209

   (11) https://bugs.python.org/issue?@action=redirect&bpo=1635741

   (12) https://peps.python.org/pep-0489/

   (13) https://bugs.python.org/issue?@action=redirect&bpo=39216

   (14) https://bugs.python.org/issue?@action=redirect&bpo=39215

   (15) https://bugs.python.org/issue?@action=redirect&bpo=39200

   (16) https://bugs.python.org/issue?@action=redirect&bpo=39200

   (17) https://bugs.python.org/issue?@action=redirect&bpo=39166

   (18) https://bugs.python.org/issue?@action=redirect&bpo=39114

   (19) https://bugs.python.org/issue?@action=redirect&bpo=39156

   (20) https://bugs.python.org/issue?@action=redirect&bpo=38588

   (21) https://bugs.python.org/issue?@action=redirect&bpo=13601

   (22) https://bugs.python.org/issue?@action=redirect&bpo=13601

   (23) https://bugs.python.org/issue?@action=redirect&bpo=38610

   (24) https://bugs.python.org/issue?@action=redirect&bpo=32021


File: python.info,  Node: ライブラリ<155>,  Next: ドキュメント<49>,  Prev: Core and Builtins<152>,  Up: Python 3 9 0 alpha 3

1.24.55.2 ライブラリ
....................

   - bpo-39430(1): Fixed race condition in lazy imports in *note
     tarfile: e4.

   - bpo-39413(2): The *note os.unsetenv(): 25c. function is now also
     available on Windows.

   - bpo-39390(3): Fixed a regression with the ‘ignore’ callback of
     *note shutil.copytree(): c1e.  The argument types are now ‘str’ and
     ‘List[str]’ again.

   - bpo-39395(4): The *note os.putenv(): 25b. and *note os.unsetenv():
     25c. functions are now always available.

   - bpo-39406(5): If ‘setenv()’ C function is available, *note
     os.putenv(): 25b. is now implemented with ‘setenv()’ instead of
     ‘putenv()’, so Python doesn't have to handle the environment
     variable memory.

   - bpo-39396(6): Fix ‘math.nextafter(-0.0, +0.0)’ on AIX 7.1.

   - bpo-29435(7): Allow *note tarfile.is_tarfile(): 1bdb. to be used
     with file and file-like objects, like *note zipfile.is_zipfile():
     1542.  Patch by William Woodruff.

   - bpo-39377(8): Removed ‘encoding’ option from *note json.loads():
     b4e.  It has been deprecated since Python 3.1.

   - bpo-39389(9): Write accurate compression level metadata in *note
     gzip: 6b. archives, rather than always signaling maximum
     compression.

   - bpo-39366(10): The previously deprecated ‘xpath()’ and ‘xgtitle()’
     methods of ‘nntplib.NNTP’ have been removed.

   - bpo-39357(11): Remove the 'buffering' parameter of *note
     bz2.BZ2File: a66.  Since Python 3.0, it was ignored and using it
     was emitting *note DeprecationWarning: 1a3.  Pass an open file
     object, to control how the file is opened.  The 'compresslevel'
     parameter becomes keyword-only.

   - bpo-39353(12): Deprecate binhex4 and hexbin4 standards.  Deprecate
     the ‘binhex’ module and the following *note binascii: 11.
     functions: ‘b2a_hqx()’, ‘a2b_hqx()’, ‘rlecode_hqx()’,
     ‘rledecode_hqx()’, *note crc_hqx(): 93d.

   - bpo-39351(13): Remove ‘base64.encodestring()’ and
     ‘base64.decodestring()’, aliases deprecated since Python 3.1: use
     *note base64.encodebytes(): b4c. and *note base64.decodebytes():
     b4d. instead.

   - bpo-39350(14): Remove ‘fractions.gcd()’ function, deprecated since
     Python 3.5 (bpo-22486(15)): use *note math.gcd(): b0c. instead.

   - bpo-39329(16): *note LMTP: b29. constructor now has an optional
     'timeout' parameter.  Patch by Donghee Na.

   - bpo-39313(17): Add a new ‘exec_function’ option ('-exec-function'
     in the CLI) to ‘RefactoringTool’ for making ‘exec’ a function.
     Patch by Batuhan Taskaya.

   - bpo-39259(18): *note FTP_TLS: af7. and *note FTP_TLS: af7. now
     raise a *note ValueError: 2ec. if the given timeout for their
     constructor is zero to prevent the creation of a non-blocking
     socket.  Patch by Donghee Na.

   - bpo-39259(19): *note SMTP: b27. and *note SMTP_SSL: b28. now raise
     a *note ValueError: 2ec. if the given timeout for their constructor
     is zero to prevent the creation of a non-blocking socket.  Patch by
     Donghee Na.

   - bpo-39310(20): Add *note math.ulp(): b0e.: return the value of the
     least significant bit of a float.

   - bpo-39297(21): Improved performance of importlib.metadata
     distribution discovery and resilients to inaccessible sys.path
     entries (importlib_metadata v1.4.0).

   - bpo-39259(22): ‘NNTP’ and ‘NNTP_SSL’ now raise a *note ValueError:
     2ec. if the given timeout for their constructor is zero to prevent
     the creation of a non-blocking socket.  Patch by Donghee Na.

   - bpo-38901(23): When you specify prompt='.'  or equivalently python
     -m venv -prompt .  ...  the basename of the current directory is
     used to set the created venv's prompt when it's activated.

   - bpo-39288(24): Add *note math.nextafter(): 6c0.: return the next
     floating-point value after 'x' towards 'y'.

   - bpo-39259(25): *note POP3: b1d. and *note POP3_SSL: b1e. now raise
     a *note ValueError: 2ec. if the given timeout for their constructor
     is zero to prevent the creation of a non-blocking socket.  Patch by
     Donghee Na.

   - bpo-39242(26): Updated the Gmane domain from news.gmane.org to
     news.gmane.io which is used for examples of ‘NNTP’ news reader
     server and nntplib tests.

   - bpo-35292(27): Proxy the ‘SimpleHTTPRequestHandler.guess_type’ to
     ‘mimetypes.guess_type’ so the ‘mimetypes.init’ is called lazily to
     avoid unnecessary costs when *note http.server: 76. module is
     imported.

   - bpo-39239(28): The *note select.epoll.unregister(): b53. method no
     longer ignores the *note EBADF: b54. error.

   - bpo-38907(29): In http.server script, restore binding to IPv4 on
     Windows.

   - bpo-39152(30): Fix ttk.Scale.configure([name]) to return
     configuration tuple for name or all options.  Giovanni Lombardo
     contributed part of the patch.

   - bpo-39198(31): If an exception were to be thrown in
     ‘Logger.isEnabledFor’ (say, by asyncio timeouts or stopit) , the
     ‘logging’ global lock may not be released appropriately, resulting
     in deadlock.  This change wraps that block of code with
     ‘try...finally’ to ensure the lock is released.

   - bpo-39191(32): Perform a check for running loop before starting a
     new task in ‘loop.run_until_complete()’ to fail fast; it prevents
     the side effect of new task spawning before exception raising.

   - bpo-38871(33): Correctly parenthesize filter-based statements that
     contain lambda expressions in ‘lib2to3’.  Patch by Donghee Na.

   - bpo-39142(34): A change was made to logging.config.dictConfig to
     avoid converting instances of named tuples to ConvertingTuple.
     It's assumed that named tuples are too specialised to be treated
     like ordinary tuples; if a user of named tuples requires
     ConvertingTuple functionality, they will have to implement that
     themselves in their named tuple class.

   - bpo-39158(35): ast.literal_eval() now supports empty sets.

   - bpo-39129(36): Fix import path for ‘asyncio.TimeoutError’

   - bpo-39057(37): ‘urllib.request.proxy_bypass_environment()’ now
     ignores leading dots and no longer ignores a trailing newline.

   - bpo-39056(38): Fixed handling invalid warning category in the -W
     option.  No longer import the re module if it is not needed.

   - bpo-39055(39): *note base64.b64decode(): 1d90. with ‘validate=True’
     raises now a binascii.Error if the input ends with a single ‘\n’.

   - bpo-21600(40): Fix ‘mock.patch.stopall()’ to stop active patches
     that were created with ‘mock.patch.dict()’.

   - bpo-39019(41): Implement dummy ‘__class_getitem__’ for *note
     tempfile.SpooledTemporaryFile: 8a2.

   - bpo-39019(42): Implement dummy ‘__class_getitem__’ for
     ‘subprocess.Popen’, ‘subprocess.CompletedProcess’

   - bpo-38914(43): Adjusted the wording of the warning issued by
     distutils' ‘check’ command when the ‘author’ and ‘maintainer’
     fields are supplied but no corresponding e-mail field
     (‘author_email’ or ‘maintainer_email’) is found.  The wording now
     reflects the fact that these fields are suggested, but not
     required.  Patch by Juergen Gmach.

   - bpo-38878(44): Fixed __subclasshook__ of *note os.PathLike: e4b. to
     return a correct result upon inheritance.  Patch by Bar Harel.

   - bpo-38615(45): *note IMAP4: aff. and *note IMAP4_SSL: b00. now have
     an optional 'timeout' parameter for their constructors.  Also, the
     *note open(): b01. method now has an optional 'timeout' parameter
     with this change.  The overridden methods of *note IMAP4_SSL: b00.
     and *note IMAP4_stream: b02. were applied to this change.  Patch by
     Donghee Na.

   - bpo-35182(46): Fixed ‘Popen.communicate()’ subsequent call crash
     when the child process has already closed any piped standard
     stream, but still continues to be running.  Patch by Andriy
     Maletsky.

   - bpo-38630(47): On Unix, *note subprocess.Popen.send_signal(): 15f7.
     now polls the process status.  Polling reduces the risk of sending
     a signal to the wrong process if the process completed, the *note
     subprocess.Popen.returncode: c83. attribute is still ‘None’, and
     the pid has been reassigned (recycled) to a new different process.

   - bpo-38536(48): Removes trailing space in formatted currency with
     ‘international=True’ and a locale with symbol following value.
     E.g.  ‘locale.currency(12.34, international=True)’ returned ‘'12,34
     EUR '’ instead of ‘'12,34 EUR'’.

   - bpo-38473(49): Use signature from inner mock for autospecced
     methods attached with ‘unittest.mock.attach_mock()’.  Patch by
     Karthikeyan Singaravelan.

   - bpo-38361(50): Fixed an issue where ‘ident’ could include a leading
     path separator when *note syslog.openlog(): 760. was called without
     arguments.

   - bpo-38293(51): Add *note copy.copy(): 757. and *note
     copy.deepcopy(): d65. support to *note property(): 4b3. objects.

   - bpo-37958(52): Added the pstats.Stats.get_profile_dict() method to
     return the profile data as a StatsProfile instance.

   - bpo-28367(53): Termios magic constants for the following baud
     rates: - B500000 - B576000 - B921600 - B1000000 - B1152000 -
     B1500000 - B2000000 - B2500000 - B3000000 - B3500000 - B4000000
     Patch by Andrey Smirnov

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39430

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39413

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39390

   (4) https://bugs.python.org/issue?@action=redirect&bpo=39395

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39406

   (6) https://bugs.python.org/issue?@action=redirect&bpo=39396

   (7) https://bugs.python.org/issue?@action=redirect&bpo=29435

   (8) https://bugs.python.org/issue?@action=redirect&bpo=39377

   (9) https://bugs.python.org/issue?@action=redirect&bpo=39389

   (10) https://bugs.python.org/issue?@action=redirect&bpo=39366

   (11) https://bugs.python.org/issue?@action=redirect&bpo=39357

   (12) https://bugs.python.org/issue?@action=redirect&bpo=39353

   (13) https://bugs.python.org/issue?@action=redirect&bpo=39351

   (14) https://bugs.python.org/issue?@action=redirect&bpo=39350

   (15) https://bugs.python.org/issue?@action=redirect&bpo=22486

   (16) https://bugs.python.org/issue?@action=redirect&bpo=39329

   (17) https://bugs.python.org/issue?@action=redirect&bpo=39313

   (18) https://bugs.python.org/issue?@action=redirect&bpo=39259

   (19) https://bugs.python.org/issue?@action=redirect&bpo=39259

   (20) https://bugs.python.org/issue?@action=redirect&bpo=39310

   (21) https://bugs.python.org/issue?@action=redirect&bpo=39297

   (22) https://bugs.python.org/issue?@action=redirect&bpo=39259

   (23) https://bugs.python.org/issue?@action=redirect&bpo=38901

   (24) https://bugs.python.org/issue?@action=redirect&bpo=39288

   (25) https://bugs.python.org/issue?@action=redirect&bpo=39259

   (26) https://bugs.python.org/issue?@action=redirect&bpo=39242

   (27) https://bugs.python.org/issue?@action=redirect&bpo=35292

   (28) https://bugs.python.org/issue?@action=redirect&bpo=39239

   (29) https://bugs.python.org/issue?@action=redirect&bpo=38907

   (30) https://bugs.python.org/issue?@action=redirect&bpo=39152

   (31) https://bugs.python.org/issue?@action=redirect&bpo=39198

   (32) https://bugs.python.org/issue?@action=redirect&bpo=39191

   (33) https://bugs.python.org/issue?@action=redirect&bpo=38871

   (34) https://bugs.python.org/issue?@action=redirect&bpo=39142

   (35) https://bugs.python.org/issue?@action=redirect&bpo=39158

   (36) https://bugs.python.org/issue?@action=redirect&bpo=39129

   (37) https://bugs.python.org/issue?@action=redirect&bpo=39057

   (38) https://bugs.python.org/issue?@action=redirect&bpo=39056

   (39) https://bugs.python.org/issue?@action=redirect&bpo=39055

   (40) https://bugs.python.org/issue?@action=redirect&bpo=21600

   (41) https://bugs.python.org/issue?@action=redirect&bpo=39019

   (42) https://bugs.python.org/issue?@action=redirect&bpo=39019

   (43) https://bugs.python.org/issue?@action=redirect&bpo=38914

   (44) https://bugs.python.org/issue?@action=redirect&bpo=38878

   (45) https://bugs.python.org/issue?@action=redirect&bpo=38615

   (46) https://bugs.python.org/issue?@action=redirect&bpo=35182

   (47) https://bugs.python.org/issue?@action=redirect&bpo=38630

   (48) https://bugs.python.org/issue?@action=redirect&bpo=38536

   (49) https://bugs.python.org/issue?@action=redirect&bpo=38473

   (50) https://bugs.python.org/issue?@action=redirect&bpo=38361

   (51) https://bugs.python.org/issue?@action=redirect&bpo=38293

   (52) https://bugs.python.org/issue?@action=redirect&bpo=37958

   (53) https://bugs.python.org/issue?@action=redirect&bpo=28367


File: python.info,  Node: ドキュメント<49>,  Next: ビルド<55>,  Prev: ライブラリ<155>,  Up: Python 3 9 0 alpha 3

1.24.55.3 ドキュメント
......................

   - bpo-39381(1): Mention in docs that *note asyncio.get_event_loop():
     2f2. implicitly creates new event loop only if called from the main
     thread.

   - bpo-38918(2): Add an entry for ‘__module__’ in the "function" &
     "method" sections of the *note inspect: 82. docs' *note
     型とメンバー: 1d92. table.

   - bpo-3530(3): In the *note ast: 9. module documentation, fix a
     misleading ‘NodeTransformer’ example and add advice on when to use
     the ‘fix_missing_locations’ function.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39381

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38918

   (3) https://bugs.python.org/issue?@action=redirect&bpo=3530


File: python.info,  Node: ビルド<55>,  Next: IDLE<30>,  Prev: ドキュメント<49>,  Up: Python 3 9 0 alpha 3

1.24.55.4 ビルド
................

   - bpo-39395(1): On non-Windows platforms, the ‘setenv()’ and
     ‘unsetenv()’ functions are now required to build Python.

   - bpo-39160(2): Updated the documentation in ‘./configure --help’ to
     show default values, reference documentation where required and add
     additional explanation where needed.

   - bpo-39144(3): The ctags and etags build targets both include
     Modules/_ctypes and Python standard library source files.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39395

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39160

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39144


File: python.info,  Node: IDLE<30>,  Next: C API<50>,  Prev: ビルド<55>,  Up: Python 3 9 0 alpha 3

1.24.55.5 IDLE
..............

   - bpo-39050(1): Make IDLE Settings dialog Help button work again.

   - bpo-34118(2): Tag memoryview, range, and tuple as classes, the same
     as list, etcetera, in the library manual built-in functions list.

   - bpo-32989(3): Add tests for editor newline_and_indent_event method.
     Remove dead code from pyparse find_good_parse_start method.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39050

   (2) https://bugs.python.org/issue?@action=redirect&bpo=34118

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32989


File: python.info,  Node: C API<50>,  Prev: IDLE<30>,  Up: Python 3 9 0 alpha 3

1.24.55.6 C API
...............

   - bpo-39372(1): Clean header files of interfaces defined but with no
     implementation.  The public API symbols being removed are:
     ‘_PyBytes_InsertThousandsGroupingLocale’,
     ‘_PyBytes_InsertThousandsGrouping’, ‘_Py_InitializeFromArgs’,
     ‘_Py_InitializeFromWideArgs’, ‘_PyFloat_Repr’, ‘_PyFloat_Digits’,
     ‘_PyFloat_DigitsInit’, ‘PyFrame_ExtendStack’,
     ‘_PyAIterWrapper_Type’, ‘PyNullImporter_Type’, ‘PyCmpWrapper_Type’,
     ‘PySortWrapper_Type’, ‘PyNoArgsFunction’.

   - bpo-39164(2): Add a private ‘_PyErr_GetExcInfo()’ function to
     retrieve exception information of the specified Python thread
     state.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39372

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39164


File: python.info,  Node: Python 3 9 0 alpha 2,  Next: Python 3 9 0 alpha 1,  Prev: Python 3 9 0 alpha 3,  Up: 変更履歴

1.24.56 Python 3.9.0 alpha 2
----------------------------

'Release date: 2019-12-18'

* Menu:

* セキュリティ: セキュリティ<41>.
* Core and Builtins: Core and Builtins<153>.
* ライブラリ: ライブラリ<156>.
* ドキュメント: ドキュメント<50>.
* テスト: テスト<48>.
* ビルド: ビルド<56>.
* Windows: Windows<49>.
* macOS: macOS<38>.
* IDLE: IDLE<31>.
* C API: C API<51>.


File: python.info,  Node: セキュリティ<41>,  Next: Core and Builtins<153>,  Up: Python 3 9 0 alpha 2

1.24.56.1 セキュリティ
......................

   - bpo-38945(1): Newline characters have been escaped when performing
     uu encoding to prevent them from overflowing into to content
     section of the encoded file.  This prevents malicious or accidental
     modification of data during the decoding process.

   - bpo-37228(2): Due to significant security concerns, the
     'reuse_address' parameter of *note
     asyncio.loop.create_datagram_endpoint(): 93c. is no longer
     supported.  This is because of the behavior of ‘SO_REUSEADDR’ in
     UDP. For more details, see the documentation for
     ‘loop.create_datagram_endpoint()’.  (Contributed by Kyle Stanley,
     Antoine Pitrou, and Yury Selivanov in bpo-37228(3).)

   - bpo-38804(4): Fixes a ReDoS vulnerability in *note http.cookiejar:
     74.  Patch by Ben Caller.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38945

   (2) https://bugs.python.org/issue?@action=redirect&bpo=37228

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37228

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38804


File: python.info,  Node: Core and Builtins<153>,  Next: ライブラリ<156>,  Prev: セキュリティ<41>,  Up: Python 3 9 0 alpha 2

1.24.56.2 Core and Builtins
...........................

   - bpo-39028(1): Slightly improve the speed of keyword argument
     parsing with many kwargs by strengthening the assumption that
     kwargs are interned strings.

   - bpo-39080(2): Fix the value of 'end_col_offset' for Starred
     Expression AST nodes when they are among the elements in the 'args'
     attribute of Call AST nodes.

   - bpo-39031(3): When parsing an "elif" node, lineno and col_offset of
     the node now point to the "elif" keyword and not to its condition,
     making it consistent with the "if" node.  Patch by Lysandros
     Nikolaou.

   - bpo-20443(4): In Python 3.9.0a1, sys.argv[0] was made an absolute
     path if a filename was specified on the command line.  Revert this
     change, since most users expect sys.argv to be unmodified.

   - bpo-39008(5): *note PySys_Audit(): 613. now requires ‘Py_ssize_t’
     to be used for size arguments in the format string, regardless of
     whether ‘PY_SSIZE_T_CLEAN’ was defined at include time.

   - bpo-38673(6): In REPL mode, don't switch to PS2 if the line starts
     with comment or whitespace.  Based on work by Batuhan Taşkaya.

   - bpo-38922(7): Calling ‘replace’ on a code object now raises the
     ‘code.__new__’ audit event.

   - bpo-38920(8): Add audit hooks for when *note sys.excepthook(): a0c.
     and *note sys.unraisablehook(): 507. are invoked.

   - bpo-38892(9): Improve documentation for audit events table and
     functions.

   - bpo-38852(10): Set the thread stack size to 8 Mb for debug builds
     on android platforms.

   - bpo-38858(11): Each Python subinterpreter now has its own "small
     integer singletons": numbers in [-5; 257] range.  It is no longer
     possible to change the number of small integers at build time by
     overriding ‘NSMALLNEGINTS’ and ‘NSMALLPOSINTS’ macros: macros
     should now be modified manually in ‘pycore_pystate.h’ header file.

   - bpo-36854(12): The garbage collector state becomes per interpreter
     (‘PyInterpreterState.gc’), rather than being global
     (‘_PyRuntimeState.gc’).

   - bpo-38835(13): The ‘PyFPE_START_PROTECT()’ and
     ‘PyFPE_END_PROTECT()’ macros are empty: they have been doing
     nothing for the last year, so stop using them.

   - bpo-38328(14): Sped up the creation time of constant *note list:
     24d. and *note set: 184. displays.  Patch by Brandt Bucher.

   - bpo-38707(15): ‘MainThread.native_id’ is now correctly reset in
     child processes spawned using *note multiprocessing.Process: 252,
     instead of retaining the parent's value.

   - bpo-38629(16): Added ‘__floor__’ and ‘__ceil__’ methods to float
     object.  Patch by Batuhan Taşkaya.

   - bpo-27145(17): int + int and int - int operators can now return
     small integer singletons.  Patch by hongweipeng.

   - bpo-38021(18): Provide a platform tag for AIX that is sufficient
     for PEP425 binary distribution identification.  Patch by Michael
     Felt.

   - bpo-35409(19): Ignore GeneratorExit exceptions when throwing an
     exception into the aclose coroutine of an asynchronous generator.

   - bpo-33387(20): Removed WITH_CLEANUP_START, WITH_CLEANUP_FINISH,
     BEGIN_FINALLY, END_FINALLY, CALL_FINALLY and POP_FINALLY bytecodes.
     Replaced with RERAISE and WITH_EXCEPT_START bytecodes.  The
     compiler now generates different code for exceptional and
     non-exceptional branches for 'with' and 'try-except' statements.
     For 'try-finally' statements the 'finally' block is replicated for
     each exit from the 'try' body.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39028

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39080

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39031

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20443

   (5) https://bugs.python.org/issue?@action=redirect&bpo=39008

   (6) https://bugs.python.org/issue?@action=redirect&bpo=38673

   (7) https://bugs.python.org/issue?@action=redirect&bpo=38922

   (8) https://bugs.python.org/issue?@action=redirect&bpo=38920

   (9) https://bugs.python.org/issue?@action=redirect&bpo=38892

   (10) https://bugs.python.org/issue?@action=redirect&bpo=38852

   (11) https://bugs.python.org/issue?@action=redirect&bpo=38858

   (12) https://bugs.python.org/issue?@action=redirect&bpo=36854

   (13) https://bugs.python.org/issue?@action=redirect&bpo=38835

   (14) https://bugs.python.org/issue?@action=redirect&bpo=38328

   (15) https://bugs.python.org/issue?@action=redirect&bpo=38707

   (16) https://bugs.python.org/issue?@action=redirect&bpo=38629

   (17) https://bugs.python.org/issue?@action=redirect&bpo=27145

   (18) https://bugs.python.org/issue?@action=redirect&bpo=38021

   (19) https://bugs.python.org/issue?@action=redirect&bpo=35409

   (20) https://bugs.python.org/issue?@action=redirect&bpo=33387


File: python.info,  Node: ライブラリ<156>,  Next: ドキュメント<50>,  Prev: Core and Builtins<153>,  Up: Python 3 9 0 alpha 2

1.24.56.3 ライブラリ
....................

   - bpo-39033(1): Fix *note NameError: 452. in *note zipimport: 138.
     Patch by Karthikeyan Singaravelan.

   - bpo-39022(2): Update importlib.metadata to include improvements
     from importlib_metadata 1.3 including better serialization of
     EntryPoints and improved documentation for custom finders.

   - bpo-39006(3): Fix asyncio when the ssl module is missing: only
     check for ssl.SSLSocket instance if the ssl module is available.

   - bpo-38708(4): Fix a potential IndexError in email parser when
     parsing an empty msg-id.

   - bpo-38698(5): Add a new ‘InvalidMessageID’ token to email parser to
     represent invalid Message-ID headers.  Also, add defects when there
     is remaining value after parsing the header.

   - bpo-38994(6): Implement ‘__class_getitem__’ for ‘os.PathLike’,
     ‘pathlib.Path’.

   - bpo-38979(7): Return class from ‘ContextVar.__class_getitem__’ to
     simplify subclassing.

   - bpo-38978(8): Implement ‘__class_getitem__’ on asyncio objects
     (Future, Task, Queue).  Patch by Batuhan Taskaya.

   - bpo-38916(9): *note array.array: 4be.: Remove ‘tostring()’ and
     ‘fromstring()’ methods.  They were aliases to ‘tobytes()’ and
     ‘frombytes()’, deprecated since Python 3.2.

   - bpo-38986(10): Make repr of C accelerated TaskWakeupMethWrapper the
     same as of pure Python version.

   - bpo-38982(11): Fix asyncio ‘PidfdChildWatcher’: handle ‘waitpid()’
     error.  If ‘waitpid()’ is called elsewhere, ‘waitpid()’ call fails
     with *note ChildProcessError: 1263.: use return code 255 in this
     case, and log a warning.  It ensures that the pidfd file descriptor
     is closed if this error occurs.

   - bpo-38529(12): Drop too noisy asyncio warning about deletion of a
     stream without explicit ‘.close()’ call.

   - bpo-27413(13): Added ability to pass through ‘ensure_ascii’ options
     to json.dumps in the ‘json.tool’ command-line interface.

   - bpo-38634(14): The *note readline: bf. module now detects if Python
     is linked to libedit at runtime on all platforms.  Previously, the
     check was only done on macOS.

   - bpo-33684(15): Fix ‘json.tool’ failed to read a JSON file with
     non-ASCII characters when locale encoding is not UTF-8.

   - bpo-38698(16): Prevent UnboundLocalError to pop up in
     parse_message_id.

     parse_message_id() was improperly using a token defined inside an
     exception handler, which was raising ‘UnboundLocalError’ on parsing
     an invalid value.  Patch by Claudiu Popa.

   - bpo-38927(17): Use ‘python -m pip’ instead of ‘pip’ to upgrade
     dependencies in venv.

   - bpo-26730(18): Fix ‘SpooledTemporaryFile.rollover()’ might corrupt
     the file when it is in text mode.  Patch by Serhiy Storchaka.

   - bpo-38881(19): random.choices() now raises a ValueError when all
     the weights are zero.

   - bpo-38876(20): Raise pickle.UnpicklingError when loading an item
     from memo for invalid input.

     The previous code was raising a ‘KeyError’ for both the Python and
     C implementation.  This was caused by the specified index of an
     invalid input which did not exist in the memo structure, where the
     pickle stores what objects it has seen.  The malformed input would
     have caused either a ‘BINGET’ or ‘LONG_BINGET’ load from the memo,
     leading to a ‘KeyError’ as the determined index was bogus.  Patch
     by Claudiu Popa.

   - bpo-38688(21): Calling func:‘shutil.copytree’ to copy a directory
     tree from one directory to another subdirectory resulted in an
     endless loop and a RecursionError.  A fix was added to consume an
     iterator and create the list of the entries to be copied, avoiding
     the recursion for newly created directories.  Patch by Bruno P.
     Kinoshita.

   - bpo-38863(22): Improve ‘is_cgi()’ function in *note http.server:
     76, which enables processing the case that cgi directory is a child
     of another directory other than root.

   - bpo-37838(23): *note typing.get_type_hints(): 8c0. properly handles
     functions decorated with *note functools.wraps(): 115f.

   - bpo-38870(24): Expose *note ast.unparse(): ae2. as a function of
     the *note ast: 9. module that can be used to unparse an *note
     ast.AST: 4c3. object and produce a string with code that would
     produce an equivalent *note ast.AST: 4c3. object when parsed.
     Patch by Pablo Galindo and Batuhan Taskaya.

   - bpo-38859(25): AsyncMock now returns StopAsyncIteration on the
     exhaustion of a side_effects iterable.  Since PEP-479 its
     Impossible to raise a StopIteration exception from a coroutine.

   - bpo-38857(26): AsyncMock fix for return values that are awaitable
     types.  This also covers side_effect iterable values that happened
     to be awaitable, and wraps callables that return an awaitable type.
     Before these awaitables were being awaited instead of being
     returned as is.

   - bpo-38834(27): *note typing.TypedDict: 332. subclasses now track
     which keys are optional using the ‘__required_keys__’ and
     ‘__optional_keys__’ attributes, to enable runtime validation by
     downstream projects.  Patch by Zac Hatfield-Dodds.

   - bpo-38821(28): Fix unhandled exceptions in *note argparse: 7. when
     internationalizing error messages for arguments with ‘nargs’ set to
     special (non-integer) values.  Patch by Federico Bond.

   - bpo-38820(29): Make Python compatible with OpenSSL 3.0.0.  *note
     ssl.SSLSocket.getpeercert(): 11ba. no longer returns IPv6 addresses
     with a trailing new line.

   - bpo-38811(30): Fix an unhandled exception in *note pathlib: a8.
     when *note os.link(): 1307. is missing.  Patch by Toke
     Høiland-Jørgensen.

   - bpo-38686(31): Added support for multiple ‘qop’ values in *note
     urllib.request.AbstractDigestAuthHandler: 1d6b.

   - bpo-38712(32): Add the Linux-specific *note
     signal.pidfd_send_signal(): b25. function, which allows sending a
     signal to a process identified by a file descriptor rather than a
     pid.

   - bpo-38348(33): Add ‘-i’ and ‘--indent’ (indentation level), and
     ‘--no-type-comments’ (type comments) command line options to ast
     parsing tool.

   - bpo-37523(34): Change ‘zipfile.ZipExtFile’ to raise ‘ValueError’
     when trying to access the underlying file object after it has been
     closed.  This new behavior is consistent with how accessing closed
     files is handled in other parts of Python.

   - bpo-38045(35): Improve the performance of ‘enum._decompose()’ in
     *note enum: 5a.  Patch by hongweipeng.

   - bpo-36820(36): Break cycle generated when saving an exception in
     socket.py, codeop.py and dyld.py as they keep alive not only the
     exception but user objects through the ‘__traceback__’ attribute.
     Patch by Mario Corchero.

   - bpo-36406(37): Handle namespace packages in *note doctest: 3e.
     Patch by Karthikeyan Singaravelan.

   - bpo-34776(38): Fix dataclasses to support forward references in
     type annotations

   - bpo-20928(39): ElementTree supports recursive XInclude processing.
     Patch by Stefan Behnel.

   - bpo-29636(40): Add whitespace options for formatting JSON with the
     ‘json.tool’ CLI. The following mutually exclusive options are now
     supported: ‘--indent’ for setting the indent level in spaces;
     ‘--tab’ for indenting with tabs; ‘--no-indent’ for suppressing
     newlines; and ‘--compact’ for suppressing all whitespace.  The
     default behavior remains the same as ‘--indent=4’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39033

   (2) https://bugs.python.org/issue?@action=redirect&bpo=39022

   (3) https://bugs.python.org/issue?@action=redirect&bpo=39006

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38708

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38698

   (6) https://bugs.python.org/issue?@action=redirect&bpo=38994

   (7) https://bugs.python.org/issue?@action=redirect&bpo=38979

   (8) https://bugs.python.org/issue?@action=redirect&bpo=38978

   (9) https://bugs.python.org/issue?@action=redirect&bpo=38916

   (10) https://bugs.python.org/issue?@action=redirect&bpo=38986

   (11) https://bugs.python.org/issue?@action=redirect&bpo=38982

   (12) https://bugs.python.org/issue?@action=redirect&bpo=38529

   (13) https://bugs.python.org/issue?@action=redirect&bpo=27413

   (14) https://bugs.python.org/issue?@action=redirect&bpo=38634

   (15) https://bugs.python.org/issue?@action=redirect&bpo=33684

   (16) https://bugs.python.org/issue?@action=redirect&bpo=38698

   (17) https://bugs.python.org/issue?@action=redirect&bpo=38927

   (18) https://bugs.python.org/issue?@action=redirect&bpo=26730

   (19) https://bugs.python.org/issue?@action=redirect&bpo=38881

   (20) https://bugs.python.org/issue?@action=redirect&bpo=38876

   (21) https://bugs.python.org/issue?@action=redirect&bpo=38688

   (22) https://bugs.python.org/issue?@action=redirect&bpo=38863

   (23) https://bugs.python.org/issue?@action=redirect&bpo=37838

   (24) https://bugs.python.org/issue?@action=redirect&bpo=38870

   (25) https://bugs.python.org/issue?@action=redirect&bpo=38859

   (26) https://bugs.python.org/issue?@action=redirect&bpo=38857

   (27) https://bugs.python.org/issue?@action=redirect&bpo=38834

   (28) https://bugs.python.org/issue?@action=redirect&bpo=38821

   (29) https://bugs.python.org/issue?@action=redirect&bpo=38820

   (30) https://bugs.python.org/issue?@action=redirect&bpo=38811

   (31) https://bugs.python.org/issue?@action=redirect&bpo=38686

   (32) https://bugs.python.org/issue?@action=redirect&bpo=38712

   (33) https://bugs.python.org/issue?@action=redirect&bpo=38348

   (34) https://bugs.python.org/issue?@action=redirect&bpo=37523

   (35) https://bugs.python.org/issue?@action=redirect&bpo=38045

   (36) https://bugs.python.org/issue?@action=redirect&bpo=36820

   (37) https://bugs.python.org/issue?@action=redirect&bpo=36406

   (38) https://bugs.python.org/issue?@action=redirect&bpo=34776

   (39) https://bugs.python.org/issue?@action=redirect&bpo=20928

   (40) https://bugs.python.org/issue?@action=redirect&bpo=29636


File: python.info,  Node: ドキュメント<50>,  Next: テスト<48>,  Prev: ライブラリ<156>,  Up: Python 3 9 0 alpha 2

1.24.56.4 ドキュメント
......................

   - bpo-38928(1): Correct when venv's ‘upgrade_dependencies()’ and
     ‘--upgrade-deps’ are added.

   - bpo-38899(2): Update documentation to state that to activate
     virtual environments under fish one should use ‘source’, not ‘.’ as
     documented at
     ‘https://fishshell.com/docs/current/cmds/source.html’.

   - bpo-22377(3): Improves documentation of the values that *note
     datetime.datetime.strptime(): 1950. accepts for ‘%Z’.  Patch by
     Karl Dubost.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38928

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38899

   (3) https://bugs.python.org/issue?@action=redirect&bpo=22377


File: python.info,  Node: テスト<48>,  Next: ビルド<56>,  Prev: ドキュメント<50>,  Up: Python 3 9 0 alpha 2

1.24.56.5 テスト
................

   - bpo-38546(1): Fix test_ressources_gced_in_workers() of
     test_concurrent_futures: explicitly stop the manager to prevent
     leaking a child process running in the background after the test
     completes.

   - bpo-38546(2): Multiprocessing and concurrent.futures tests now stop
     the resource tracker process when tests complete.

   - bpo-38614(3): Replace hardcoded timeout constants in tests with new
     *note test.support: ea. constants: *note LOOPBACK_TIMEOUT: 1d9c,
     *note INTERNET_TIMEOUT: 1d9d, *note SHORT_TIMEOUT: 1c63. and *note
     LONG_TIMEOUT: 1d9e.  It becomes easier to adjust these four timeout
     constants for all tests at once, rather than having to adjust every
     single test file.

   - bpo-38547(4): Fix test_pty: if the process is the session leader,
     closing the master file descriptor raises a SIGHUP signal: simply
     ignore SIGHUP when running the tests.

   - bpo-38992(5): Fix a test for *note math.fsum(): 15ed. that was
     failing due to constant folding.

   - bpo-38991(6): *note test.support: ea.: ‘run_python_until_end()’,
     ‘assert_python_ok()’ and ‘assert_python_failure()’ functions no
     longer strip whitespaces from stderr.  Remove
     ‘test.support.strip_python_stderr()’ function.

   - bpo-38965(7): Fix test_faulthandler on GCC 10.  Use the "volatile"
     keyword in ‘faulthandler._stack_overflow()’ to prevent tail call
     optimization on any compiler, rather than relying on compiler
     specific pragma.

   - bpo-38875(8): test_capi: trashcan tests now require the test "cpu"
     resource.

   - bpo-38841(9): Skip asyncio
     test_create_datagram_endpoint_existing_sock_unix on platforms
     lacking a functional bind() for named unix domain sockets.

   - bpo-38692(10): Skip the test_posix.test_pidfd_open() test if
     ‘os.pidfd_open()’ fails with a *note PermissionError: f3e.  This
     situation can happen in a Linux sandbox using a syscall whitelist
     which doesn't allow the ‘pidfd_open()’ syscall yet.

   - bpo-38839(11): Fix some unused functions in tests.  Patch by Adam
     Johnson.

   - bpo-38669(12): Raise *note TypeError: 198. when passing target as a
     string with *note unittest.mock.patch.object(): 1906.

   - bpo-37957(13): test.regrtest now can receive a list of test
     patterns to ignore (using the -i/-ignore argument) or a file with a
     list of patterns to ignore (using the -ignore-file argument).
     Patch by Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38546

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38546

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38614

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38547

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38992

   (6) https://bugs.python.org/issue?@action=redirect&bpo=38991

   (7) https://bugs.python.org/issue?@action=redirect&bpo=38965

   (8) https://bugs.python.org/issue?@action=redirect&bpo=38875

   (9) https://bugs.python.org/issue?@action=redirect&bpo=38841

   (10) https://bugs.python.org/issue?@action=redirect&bpo=38692

   (11) https://bugs.python.org/issue?@action=redirect&bpo=38839

   (12) https://bugs.python.org/issue?@action=redirect&bpo=38669

   (13) https://bugs.python.org/issue?@action=redirect&bpo=37957


File: python.info,  Node: ビルド<56>,  Next: Windows<49>,  Prev: テスト<48>,  Up: Python 3 9 0 alpha 2

1.24.56.6 ビルド
................

   - bpo-37404(1): *note asyncio: b. now raises *note TypeError: 198.
     when calling incompatible methods with an *note ssl.SSLSocket: ae7.
     socket.  Patch by Ido Michael.

   - bpo-36500(2): Added an optional "regen" project to the Visual
     Studio solution that will regenerate all grammar, tokens, and
     opcodes.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37404

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36500


File: python.info,  Node: Windows<49>,  Next: macOS<38>,  Prev: ビルド<56>,  Up: Python 3 9 0 alpha 2

1.24.56.7 Windows
.................

   - bpo-39007(1): Add auditing events to functions in *note winreg:
     11c.

   - bpo-33125(2): Add support for building and releasing Windows ARM64
     packages.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=39007

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33125


File: python.info,  Node: macOS<38>,  Next: IDLE<31>,  Prev: Windows<49>,  Up: Python 3 9 0 alpha 2

1.24.56.8 macOS
...............

   - bpo-37931(1): Fixed a crash on OSX dynamic builds that occurred
     when re-initializing the posix module after a Py_Finalize if the
     environment had changed since the previous ‘import posix’.  Patch
     by Benoît Hudson.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37931


File: python.info,  Node: IDLE<31>,  Next: C API<51>,  Prev: macOS<38>,  Up: Python 3 9 0 alpha 2

1.24.56.9 IDLE
..............

   - bpo-38944(1): Escape key now closes IDLE completion windows.  Patch
     by Johnny Najera.

   - bpo-38943(2): Fix IDLE autocomplete windows not always appearing on
     some systems.  Patch by Johnny Najera.

   - bpo-38862(3): 'Strip Trailing Whitespace' on the Format menu
     removes extra newlines at the end of non-shell files.

   - bpo-38636(4): Fix IDLE Format menu tab toggle and file indent
     width.  These functions (default shortcuts Alt-T and Alt-U) were
     mistakenly disabled in 3.7.5 and 3.8.0.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38944

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38943

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38862

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38636


File: python.info,  Node: C API<51>,  Prev: IDLE<31>,  Up: Python 3 9 0 alpha 2

1.24.56.10 C API
................

   - bpo-38896(1): Remove ‘PyUnicode_ClearFreeList()’ function: the
     Unicode free list has been removed in Python 3.3.

   - bpo-37340(2): Remove ‘PyMethod_ClearFreeList()’ and
     ‘PyCFunction_ClearFreeList()’ functions: the free lists of bound
     method objects have been removed.

   - bpo-38835(3): Exclude ‘PyFPE_START_PROTECT()’ and
     ‘PyFPE_END_PROTECT()’ macros of ‘pyfpe.h’ from ‘Py_LIMITED_API’
     (stable API).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38896

   (2) https://bugs.python.org/issue?@action=redirect&bpo=37340

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38835


File: python.info,  Node: Python 3 9 0 alpha 1,  Next: Python 3 8 0 beta 1,  Prev: Python 3 9 0 alpha 2,  Up: 変更履歴

1.24.57 Python 3.9.0 alpha 1
----------------------------

'Release date: 2019-11-19'

* Menu:

* セキュリティ: セキュリティ<42>.
* Core and Builtins: Core and Builtins<154>.
* ライブラリ: ライブラリ<157>.
* ドキュメント: ドキュメント<51>.
* テスト: テスト<49>.
* ビルド: ビルド<57>.
* Windows: Windows<50>.
* macOS: macOS<39>.
* IDLE: IDLE<32>.
* Tools/Demos: Tools/Demos<33>.
* C API: C API<52>.


File: python.info,  Node: セキュリティ<42>,  Next: Core and Builtins<154>,  Up: Python 3 9 0 alpha 1

1.24.57.1 セキュリティ
......................

   - bpo-38722(1): *note runpy: c3. now uses *note io.open_code(): 1a98.
     to open code files.  Patch by Jason Killen.

   - bpo-38622(2): Add additional audit events for the *note ctypes: 2e.
     module.

   - bpo-38418(3): Fixes audit event for *note os.system(): 1676. to be
     named ‘os.system’.

   - bpo-38243(4): Escape the server title of *note
     xmlrpc.server.DocXMLRPCServer: 1da6. when rendering the document
     page as HTML. (Contributed by Donghee Na in bpo-38243(5).)

   - bpo-38174(6): Update vendorized expat library version to 2.2.8,
     which resolves CVE 2019-15903(7).

   - bpo-37764(8): Fixes email._header_value_parser.get_unstructured
     going into an infinite loop for a specific case in which the email
     header does not have trailing whitespace, and the case in which it
     contains an invalid encoded word.  Patch by Ashwin Ramaswami.

   - bpo-37461(9): Fix an infinite loop when parsing specially crafted
     email headers.  Patch by Abhilash Raj.

   - bpo-37363(10): Adds audit events for the range of supported run
     commands (see *note コマンドラインと環境: 1da7.).

   - bpo-37463(11): ssl.match_hostname() no longer accepts IPv4
     addresses with additional text after the address and only
     quad-dotted notation without trailing whitespaces.  Some
     inet_aton() implementations ignore whitespace and all data after
     whitespace, e.g.  '127.0.0.1 whatever'.

   - bpo-37363(12): Adds audit events for *note ensurepip: 59, *note
     ftplib: 62, *note glob: 68, *note imaplib: 78, ‘nntplib’, *note
     pdb: aa, *note poplib: b1, *note shutil: ca, *note smtplib: cf,
     *note sqlite3: d4, *note subprocess: dc, ‘telnetlib’, *note
     tempfile: e6. and *note webbrowser: 11b, as well as *note
     os.listdir(): 1312, *note os.scandir(): c54. and *note
     breakpoint(): 271.

   - bpo-37364(13): *note io.open_code(): 1a98. is now used when reading
     ‘.pth’ files.

   - bpo-34631(14): Updated OpenSSL to 1.1.1c in Windows installer

   - bpo-34155(15): Fix parsing of invalid email addresses with more
     than one ‘@’ (e.g.  a@b@c.com.)  to not return the part before 2nd
     ‘@’ as valid email address.  Patch by maxking & jpic.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38722

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38622

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38418

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38243

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38243

   (6) https://bugs.python.org/issue?@action=redirect&bpo=38174

   (7) https://www.cve.org/CVERecord?id=CVE-2019-15903

   (8) https://bugs.python.org/issue?@action=redirect&bpo=37764

   (9) https://bugs.python.org/issue?@action=redirect&bpo=37461

   (10) https://bugs.python.org/issue?@action=redirect&bpo=37363

   (11) https://bugs.python.org/issue?@action=redirect&bpo=37463

   (12) https://bugs.python.org/issue?@action=redirect&bpo=37363

   (13) https://bugs.python.org/issue?@action=redirect&bpo=37364

   (14) https://bugs.python.org/issue?@action=redirect&bpo=34631

   (15) https://bugs.python.org/issue?@action=redirect&bpo=34155


File: python.info,  Node: Core and Builtins<154>,  Next: ライブラリ<157>,  Prev: セキュリティ<42>,  Up: Python 3 9 0 alpha 1

1.24.57.2 Core and Builtins
...........................

   - bpo-38631(1): Replace ‘Py_FatalError()’ call with a regular *note
     RuntimeError: 244. exception in ‘float.__getformat__()’.

   - bpo-38639(2): Optimized *note math.floor(): 15d7, *note
     math.ceil(): 15d8. and *note math.trunc(): 15d9. for floats.

   - bpo-38640(3): Fixed a bug in the compiler that was causing to raise
     in the presence of break statements and continue statements inside
     always false while loops.  Patch by Pablo Galindo.

   - bpo-38613(4): Optimized some set operations (e.g.  ‘|’, ‘^’, and
     ‘-’) of ‘dict_keys’.  ‘d.keys() | other’ was slower than ‘set(d) |
     other’ but they are almost same performance for now.

   - bpo-28029(5): ‘"".replace("", s, n)’ now returns ‘s’ instead of an
     empty string for all non-zero ‘n’.  There are similar changes for
     *note bytes: 192. and *note bytearray: 344. objects.

   - bpo-38535(6): Fixed line numbers and column offsets for AST nodes
     for calls without arguments in decorators.

   - bpo-38525(7): Fix a segmentation fault when using reverse iterators
     of empty ‘dict’ objects.  Patch by Donghee Na and Inada Naoki.

   - bpo-38465(8): *note bytearray: 344, *note array: 4be. and *note
     mmap: 519. objects allow now to export more than ‘2**31’ buffers at
     a time.

   - bpo-38469(9): Fixed a bug where the scope of named expressions was
     not being resolved correctly in the presence of the 'global'
     keyword.  Patch by Pablo Galindo.

   - bpo-38437(10): Activate the ‘GC_DEBUG’ macro for debug builds of
     the interpreter (when ‘Py_DEBUG’ is set).  Patch by Pablo Galindo.

   - bpo-38379(11): When the garbage collector makes a collection in
     which some objects resurrect (they are reachable from outside the
     isolated cycles after the finalizers have been executed), do not
     block the collection of all objects that are still unreachable.
     Patch by Pablo Galindo and Tim Peters.

   - bpo-38379(12): When cyclic garbage collection (gc) runs finalizers
     that resurrect unreachable objects, the current gc run ends,
     without collecting any cyclic trash.  However, the statistics
     reported by ‘collect()’ and ‘get_stats()’ claimed that all cyclic
     trash found was collected, and that the resurrected objects were
     collected.  Changed the stats to report that none were collected.

   - bpo-38392(13): In debug mode, *note PyObject_GC_Track(): 171d. now
     calls ‘tp_traverse()’ of the object type to ensure that the object
     is valid: test that objects visited by ‘tp_traverse()’ are valid.

   - bpo-38210(14): Remove unnecessary intersection and update set
     operation in dictview with empty set.  (Contributed by Donghee Na
     in bpo-38210(15).)

   - bpo-38402(16): Check the error from the system's underlying ‘crypt’
     or ‘crypt_r’.

   - bpo-37474(17): On FreeBSD, Python no longer calls
     ‘fedisableexcept()’ at startup to control the floating-point
     control mode.  The call became useless since FreeBSD 6: it became
     the default mode.

   - bpo-38006(18): Fix a bug due to the interaction of weakrefs and the
     cyclic garbage collector.  We must clear any weakrefs in garbage in
     order to prevent their callbacks from executing and causing a
     crash.

   - bpo-38317(19): Fix warnings options priority:
     ‘PyConfig.warnoptions’ has the highest priority, as stated in the
     PEP 587(20).

   - bpo-38310(21): Predict ‘BUILD_MAP_UNPACK_WITH_CALL’ ->
     ‘CALL_FUNCTION_EX’ opcode pairs in the main interpreter loop.
     Patch by Brandt Bucher.

   - bpo-36871(22): Improve error handling for the assert_has_calls and
     assert_has_awaits methods of mocks.  Fixed a bug where any errors
     encountered while binding the expected calls to the mock's spec
     were silently swallowed, leading to misleading error output.

   - bpo-11410(23): Better control over symbol visibility is provided
     through use of the visibility attributes available in gcc >= 4.0,
     provided in a uniform way across POSIX and Windows.  The POSIX
     build files have been updated to compile with -fvisibility=hidden,
     minimising exported symbols.

   - bpo-38219(24): Optimized the *note dict: 183. constructor and the
     *note update(): 167e. method for the case when the argument is a
     dict.

   - bpo-38236(25): Python now dumps path configuration if it fails to
     import the Python codecs of the filesystem and stdio encodings.

   - bpo-38013(26): Allow to call ‘async_generator_athrow().throw(...)’
     even for non-started async generator helper.  It fixes annoying
     warning at the end of *note asyncio.run(): 2f3. call.

   - bpo-38124(27): Fix an off-by-one error in PyState_AddModule that
     could cause out-of-bounds memory access.

   - bpo-38116(28): The select module is now PEP-384 compliant and no
     longer has static state

   - bpo-38113(29): ast module updated to PEP-384 and all statics
     removed

   - bpo-38076(30): The struct module is now PEP-384 compatible

   - bpo-38075(31): The random module is now PEP-384 compatible

   - bpo-38074(32): zlib module made PEP-384 compatible

   - bpo-38073(33): Make pwd extension module PEP-384 compatible

   - bpo-38072(34): grp module made PEP-384 compatible

   - bpo-38069(35): Make _posixsubprocess PEP-384 compatible

   - bpo-38071(36): Make termios extension module PEP-384 compatible

   - bpo-38005(37): Fixed comparing and creating of InterpreterID and
     ChannelID.

   - bpo-36946(38): Fix possible signed integer overflow when handling
     slices.  Patch by hongweipeng.

   - bpo-37994(39): Fixed silencing arbitrary errors if an attribute
     lookup fails in several sites.  Only AttributeError should be
     silenced.

   - bpo-8425(40): Optimize set difference_update for the case when the
     other set is much larger than the base set.  (Suggested by Evgeny
     Kapun with code contributed by Michele Orrù).

   - bpo-37966(41): The implementation of *note is_normalized(): c3c.
     has been greatly sped up on strings that aren't normalized, by
     implementing the full normalization-quick-check algorithm from the
     Unicode standard.

   - bpo-37947(42): Adjust correctly the recursion level in the symtable
     generation for named expressions.  Patch by Pablo Galindo.

   - bpo-37812(43): The ‘CHECK_SMALL_INT’ macro used inside
     ‘Object/longobject.c’ has been replaced with an explicit ‘return’
     at each call site.

   - bpo-37751(44): Fix *note codecs.lookup(): b5c. to normalize the
     encoding name the same way than *note
     encodings.normalize_encoding(): 9fd, except that *note
     codecs.lookup(): b5c. also converts the name to lower case.

   - bpo-37830(45): Fixed compilation of *note break: 17f. and *note
     continue: 180. in the *note finally: 1b0. block when the
     corresponding *note try: 8f8. block contains *note return: 1af.
     with a non-constant value.

   - bpo-20490(46): Improve import error message for partially
     initialized module on circular ‘from’ imports - by Anthony Sottile.

   - bpo-37840(47): Fix handling of negative indices in *note sq_item:
     1cf5. of *note bytearray: 344.  Patch by Sergey Fedoseev.

   - bpo-37802(48): Slightly improve performance of *note
     PyLong_FromUnsignedLong(): 18bd, *note
     PyLong_FromUnsignedLongLong(): 18be. and *note PyLong_FromSize_t():
     18bf.  Patch by Sergey Fedoseev.

   - bpo-37409(49): Ensure explicit relative imports from interactive
     sessions and scripts (having no parent package) always raise
     ImportError, rather than treating the current module as the
     package.  Patch by Ben Lewis.

   - bpo-32912(50): Reverted bpo-32912(51): emitting *note
     SyntaxWarning: 1ae. instead of *note DeprecationWarning: 1a3. for
     invalid escape sequences in string and bytes literals.

   - bpo-37757(52): PEP 572(53): As described in the PEP, assignment
     expressions now raise *note SyntaxError: 18e. when their
     interaction with comprehension scoping results in an ambiguous
     target scope.

     The ‘TargetScopeError’ subclass originally proposed by the PEP has
     been removed in favour of just raising regular syntax errors for
     the disallowed cases.

   - bpo-36279(54): Fix potential use of uninitialized memory in *note
     os.wait3(): f96.

   - bpo-36311(55): Decoding bytes objects larger than 2GiB is faster
     and no longer fails when a multibyte characters spans a chunk
     boundary.

   - bpo-34880(56): The *note assert: b60. statement now works properly
     if the *note AssertionError: 8b8. exception is being shadowed.
     Patch by Zackery Spytz.

   - bpo-37340(57): Removed object cache (‘free_list’) for bound method
     objects.  Temporary bound method objects are less used than before
     thanks to the ‘LOAD_METHOD’ opcode and the
     ‘_PyObject_VectorcallMethod’ C API.

   - bpo-37648(58): Fixed minor inconsistency in ‘list.__contains__()’,
     ‘tuple.__contains__()’ and a few other places.  The collection's
     item is now always at the left and the needle is on the right of
     ‘==’.

   - bpo-37444(59): Update differing exception between
     ‘builtins.__import__()’ and *note importlib.__import__(): 1279.

   - bpo-37619(60): When adding a wrapper descriptor from one class to a
     different class (for example, setting ‘__add__ = str.__add__’ on an
     ‘int’ subclass), an exception is correctly raised when the operator
     is called.

   - bpo-37593(61): Swap the positions of the 'posonlyargs' and 'args'
     parameters in the constructor of ‘ast.parameters’ nodes.

   - bpo-37543(62): Optimized pymalloc for non PGO build.

   - bpo-37537(63): Compute allocated pymalloc blocks inside
     _Py_GetAllocatedBlocks().  This slows down _Py_GetAllocatedBlocks()
     but gives a small speedup to _PyObject_Malloc() and
     _PyObject_Free().

   - bpo-37467(64): Fix *note sys.excepthook(): a0c. and
     ‘PyErr_Display()’ if a filename is a bytes string.  For example,
     for a SyntaxError exception where the filename attribute is a bytes
     string.

   - bpo-37433(65): Fix ‘SyntaxError’ indicator printing too many spaces
     for multi-line strings - by Anthony Sottile.

   - bpo-37417(66): *note bytearray.extend(): 1791. now correctly
     handles errors that arise during iteration.  Patch by Brandt
     Bucher.

   - bpo-37414(67): The undocumented ‘sys.callstats()’ function has been
     removed.  Since Python 3.7, it was deprecated and always returned
     ‘None’.  It required a special build option ‘CALL_PROFILE’ which
     was already removed in Python 3.7.

   - bpo-37392(68): Remove ‘sys.getcheckinterval()’ and
     ‘sys.setcheckinterval()’ functions.  They were deprecated since
     Python 3.2.  Use *note sys.getswitchinterval(): b43. and *note
     sys.setswitchinterval(): b44. instead.  Remove also
     ‘check_interval’ field of the ‘PyInterpreterState’ structure.

   - bpo-37388(69): In development mode and in debug build, 'encoding'
     and 'errors' arguments are now checked on string encoding and
     decoding operations.  Examples: *note open(): 316, *note
     str.encode(): ad2. and *note bytes.decode(): ad3.

     By default, for best performances, the 'errors' argument is only
     checked at the first encoding/decoding error, and the 'encoding'
     argument is sometimes ignored for empty strings.

   - bpo-37348(70): Optimized decoding short ASCII string with UTF-8 and
     ascii codecs.  ‘b"foo".decode()’ is about 15% faster.  Patch by
     Inada Naoki.

   - bpo-24214(71): Improved support of the surrogatepass error handler
     in the UTF-8 and UTF-16 incremental decoders.

   - bpo-37330(72): *note open(): 316, *note io.open(): 740, *note
     codecs.open(): 315. and *note fileinput.FileInput: 940. no longer
     accept ‘'U'’ ("universal newline") in the file mode.  This flag was
     deprecated since Python 3.3.

   - bpo-35224(73): Reverse evaluation order of key: value in dict
     comprehensions as proposed in PEP 572.  I.e.  in ‘{k: v for ...}’,
     ‘k’ will be evaluated before ‘v’.

   - bpo-37316(74): Fix the *note PySys_Audit(): 613. call in *note
     mmap.mmap: 519.

   - bpo-37300(75): Remove an unnecessary Py_XINCREF in classobject.c.

   - bpo-37269(76): Fix a bug in the peephole optimizer that was not
     treating correctly constant conditions with binary operators.
     Patch by Pablo Galindo.

   - bpo-20443(77): Python now gets the absolute path of the script
     filename specified on the command line (ex: "python3 script.py"):
     the __file__ attribute of the __main__ module and sys.path[0]
     become an absolute path, rather than a relative path.

   - bpo-37257(78): Python's small object allocator (‘obmalloc.c’) now
     allows (no more than) one empty arena to remain available for
     immediate reuse, without returning it to the OS. This prevents
     thrashing in simple loops where an arena could be created and
     destroyed anew on each iteration.

   - bpo-37231(79): The dispatching of type slots to special methods
     (for example calling ‘__mul__’ when doing ‘x * y’) has been made
     faster.

   - bpo-36974(80): Implemented separate vectorcall functions for every
     calling convention of builtin functions and methods.  This improves
     performance for calls.

   - bpo-37213(81): Handle correctly negative line offsets in the
     peephole optimizer.  Patch by Pablo Galindo.

   - bpo-37219(82): Remove erroneous optimization for empty set
     differences.

   - bpo-15913(83): Implement *note PyBuffer_SizeFromFormat(): 95e.
     function (previously documented but not implemented): call *note
     struct.calcsize(): 1da9.  Patch by Joannah Nanjekye.

   - bpo-36922(84): Slot functions optimize any callable with
     ‘Py_TPFLAGS_METHOD_DESCRIPTOR’ instead of only instances of
     ‘function’.

   - bpo-36974(85): The slot ‘tp_vectorcall_offset’ is inherited
     unconditionally to support ‘super().__call__()’ when the base class
     uses vectorcall.

   - bpo-37160(86): *note threading.get_native_id(): c32. now also
     supports NetBSD.

   - bpo-37077(87): Add *note threading.get_native_id(): c32. support
     for AIX. Patch by M. Felt

   - bpo-36781(88): *note sum(): 695. has been optimized for boolean
     values.

   - bpo-34556(89): Add ‘--upgrade-deps’ to venv module.  Patch by
     Cooper Ry Lees

   - bpo-20523(90): ‘pdb.Pdb’ supports ~/.pdbrc in Windows 7.  Patch by
     Tim Hopper and Dan Lidral-Porter.

   - bpo-35551(91): Updated encodings: - Removed the "tis260" encoding,
     which was an alias for the nonexistent "tactis" codec.  - Added
     "mac_centeuro" as an alias for the mac_latin2 encoding.

   - bpo-19072(92): The *note classmethod: 48e. decorator can now wrap
     other descriptors such as property objects.  Adapted from a patch
     written by Graham Dumpleton.

   - bpo-27575(93): Improve speed of dictview intersection by directly
     using set intersection logic.  Patch by David Su.

   - bpo-30773(94): Prohibit parallel running of aclose() / asend() /
     athrow().  Fix ag_running to reflect the actual running status of
     the AG.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38631

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38639

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38640

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38613

   (5) https://bugs.python.org/issue?@action=redirect&bpo=28029

   (6) https://bugs.python.org/issue?@action=redirect&bpo=38535

   (7) https://bugs.python.org/issue?@action=redirect&bpo=38525

   (8) https://bugs.python.org/issue?@action=redirect&bpo=38465

   (9) https://bugs.python.org/issue?@action=redirect&bpo=38469

   (10) https://bugs.python.org/issue?@action=redirect&bpo=38437

   (11) https://bugs.python.org/issue?@action=redirect&bpo=38379

   (12) https://bugs.python.org/issue?@action=redirect&bpo=38379

   (13) https://bugs.python.org/issue?@action=redirect&bpo=38392

   (14) https://bugs.python.org/issue?@action=redirect&bpo=38210

   (15) https://bugs.python.org/issue?@action=redirect&bpo=38210

   (16) https://bugs.python.org/issue?@action=redirect&bpo=38402

   (17) https://bugs.python.org/issue?@action=redirect&bpo=37474

   (18) https://bugs.python.org/issue?@action=redirect&bpo=38006

   (19) https://bugs.python.org/issue?@action=redirect&bpo=38317

   (20) https://peps.python.org/pep-0587/

   (21) https://bugs.python.org/issue?@action=redirect&bpo=38310

   (22) https://bugs.python.org/issue?@action=redirect&bpo=36871

   (23) https://bugs.python.org/issue?@action=redirect&bpo=11410

   (24) https://bugs.python.org/issue?@action=redirect&bpo=38219

   (25) https://bugs.python.org/issue?@action=redirect&bpo=38236

   (26) https://bugs.python.org/issue?@action=redirect&bpo=38013

   (27) https://bugs.python.org/issue?@action=redirect&bpo=38124

   (28) https://bugs.python.org/issue?@action=redirect&bpo=38116

   (29) https://bugs.python.org/issue?@action=redirect&bpo=38113

   (30) https://bugs.python.org/issue?@action=redirect&bpo=38076

   (31) https://bugs.python.org/issue?@action=redirect&bpo=38075

   (32) https://bugs.python.org/issue?@action=redirect&bpo=38074

   (33) https://bugs.python.org/issue?@action=redirect&bpo=38073

   (34) https://bugs.python.org/issue?@action=redirect&bpo=38072

   (35) https://bugs.python.org/issue?@action=redirect&bpo=38069

   (36) https://bugs.python.org/issue?@action=redirect&bpo=38071

   (37) https://bugs.python.org/issue?@action=redirect&bpo=38005

   (38) https://bugs.python.org/issue?@action=redirect&bpo=36946

   (39) https://bugs.python.org/issue?@action=redirect&bpo=37994

   (40) https://bugs.python.org/issue?@action=redirect&bpo=8425

   (41) https://bugs.python.org/issue?@action=redirect&bpo=37966

   (42) https://bugs.python.org/issue?@action=redirect&bpo=37947

   (43) https://bugs.python.org/issue?@action=redirect&bpo=37812

   (44) https://bugs.python.org/issue?@action=redirect&bpo=37751

   (45) https://bugs.python.org/issue?@action=redirect&bpo=37830

   (46) https://bugs.python.org/issue?@action=redirect&bpo=20490

   (47) https://bugs.python.org/issue?@action=redirect&bpo=37840

   (48) https://bugs.python.org/issue?@action=redirect&bpo=37802

   (49) https://bugs.python.org/issue?@action=redirect&bpo=37409

   (50) https://bugs.python.org/issue?@action=redirect&bpo=32912

   (51) https://bugs.python.org/issue?@action=redirect&bpo=32912

   (52) https://bugs.python.org/issue?@action=redirect&bpo=37757

   (53) https://peps.python.org/pep-0572/

   (54) https://bugs.python.org/issue?@action=redirect&bpo=36279

   (55) https://bugs.python.org/issue?@action=redirect&bpo=36311

   (56) https://bugs.python.org/issue?@action=redirect&bpo=34880

   (57) https://bugs.python.org/issue?@action=redirect&bpo=37340

   (58) https://bugs.python.org/issue?@action=redirect&bpo=37648

   (59) https://bugs.python.org/issue?@action=redirect&bpo=37444

   (60) https://bugs.python.org/issue?@action=redirect&bpo=37619

   (61) https://bugs.python.org/issue?@action=redirect&bpo=37593

   (62) https://bugs.python.org/issue?@action=redirect&bpo=37543

   (63) https://bugs.python.org/issue?@action=redirect&bpo=37537

   (64) https://bugs.python.org/issue?@action=redirect&bpo=37467

   (65) https://bugs.python.org/issue?@action=redirect&bpo=37433

   (66) https://bugs.python.org/issue?@action=redirect&bpo=37417

   (67) https://bugs.python.org/issue?@action=redirect&bpo=37414

   (68) https://bugs.python.org/issue?@action=redirect&bpo=37392

   (69) https://bugs.python.org/issue?@action=redirect&bpo=37388

   (70) https://bugs.python.org/issue?@action=redirect&bpo=37348

   (71) https://bugs.python.org/issue?@action=redirect&bpo=24214

   (72) https://bugs.python.org/issue?@action=redirect&bpo=37330

   (73) https://bugs.python.org/issue?@action=redirect&bpo=35224

   (74) https://bugs.python.org/issue?@action=redirect&bpo=37316

   (75) https://bugs.python.org/issue?@action=redirect&bpo=37300

   (76) https://bugs.python.org/issue?@action=redirect&bpo=37269

   (77) https://bugs.python.org/issue?@action=redirect&bpo=20443

   (78) https://bugs.python.org/issue?@action=redirect&bpo=37257

   (79) https://bugs.python.org/issue?@action=redirect&bpo=37231

   (80) https://bugs.python.org/issue?@action=redirect&bpo=36974

   (81) https://bugs.python.org/issue?@action=redirect&bpo=37213

   (82) https://bugs.python.org/issue?@action=redirect&bpo=37219

   (83) https://bugs.python.org/issue?@action=redirect&bpo=15913

   (84) https://bugs.python.org/issue?@action=redirect&bpo=36922

   (85) https://bugs.python.org/issue?@action=redirect&bpo=36974

   (86) https://bugs.python.org/issue?@action=redirect&bpo=37160

   (87) https://bugs.python.org/issue?@action=redirect&bpo=37077

   (88) https://bugs.python.org/issue?@action=redirect&bpo=36781

   (89) https://bugs.python.org/issue?@action=redirect&bpo=34556

   (90) https://bugs.python.org/issue?@action=redirect&bpo=20523

   (91) https://bugs.python.org/issue?@action=redirect&bpo=35551

   (92) https://bugs.python.org/issue?@action=redirect&bpo=19072

   (93) https://bugs.python.org/issue?@action=redirect&bpo=27575

   (94) https://bugs.python.org/issue?@action=redirect&bpo=30773


File: python.info,  Node: ライブラリ<157>,  Next: ドキュメント<51>,  Prev: Core and Builtins<154>,  Up: Python 3 9 0 alpha 1

1.24.57.3 ライブラリ
....................

   - bpo-36589(1): The *note curses.update_lines_cols(): feb. function
     now returns ‘None’ instead of ‘1’ on success.

   - bpo-38807(2): Update *note TypeError: 198. messages for *note
     os.path.join(): 19a9. to include *note os.PathLike: e4b. objects as
     acceptable input types.

   - bpo-38724(3): Add a repr for ‘subprocess.Popen’ objects.  Patch by
     Andrey Doroschenko.

   - bpo-38786(4): pydoc now recognizes and parses HTTPS URLs.  Patch by
     python273.

   - bpo-38785(5): Prevent asyncio from crashing if parent ‘__init__’ is
     not called from a constructor of object derived from
     ‘asyncio.Future’.

   - bpo-38723(6): *note pdb: aa. now uses *note io.open_code(): 1a98.
     to trigger auditing events.

   - bpo-27805(7): Allow opening pipes and other non-seekable files in
     append mode with *note open(): 316.

   - bpo-38438(8): Simplify the *note argparse: 7. usage message for
     ‘nargs="*"’.

   - bpo-38761(9): WeakSet is now registered as a
     collections.abc.MutableSet.

   - bpo-38716(10): logging: change RotatingHandler namer and rotator to
     class-level attributes.  This stops __init__ from setting them to
     None in the case where a subclass defines them with eponymous
     methods.

   - bpo-38713(11): Add *note os.P_PIDFD: b16. constant, which may be
     passed to *note os.waitid(): f99. to wait on a Linux process file
     descriptor.

   - bpo-38692(12): Add ‘asyncio.PidfdChildWatcher’, a Linux-specific
     child watcher implementation that polls process file descriptors.

   - bpo-38692(13): Expose the Linux ‘pidfd_open’ syscall as *note
     os.pidfd_open(): 6a4.

   - bpo-38602(14): Added constants ‘F_OFD_GETLK’, ‘F_OFD_SETLK’ and
     ‘F_OFD_SETLKW’ to the *note fcntl: 5d. module.  Patch by Donghee
     Na.

   - bpo-38334(15): Fixed seeking backward on an encrypted
     ‘zipfile.ZipExtFile’.

   - bpo-38312(16): Add *note curses.get_escdelay(): aec, *note
     curses.set_escdelay(): aed, *note curses.get_tabsize(): aee, and
     *note curses.set_tabsize(): aef. functions - by Anthony Sottile.

   - bpo-38586(17): Now *note fileConfig(): d48. correctly sets the
     .name of handlers loaded.

   - bpo-38565(18): Add new cache_parameters() method for
     functools.lru_cache() to better support pickling.

   - bpo-34679(19): asynci.ProactorEventLoop.close() now only calls
     signal.set_wakeup_fd() in the main thread.

   - bpo-31202(20): The case the result of ‘pathlib.WindowsPath.glob()’
     matches now the case of the pattern for literal parts.

   - bpo-36321(21): Remove misspelled attribute.  The 3.8 changelog
     noted that this would be removed in 3.9.

   - bpo-38521(22): Fixed erroneous equality comparison in
     statistics.NormalDist().

   - bpo-38493(23): Added *note CLD_KILLED: b14. and *note CLD_STOPPED:
     b15. for ‘si_code’.  Patch by Donghee Na.

   - bpo-38478(24): Fixed a bug in ‘inspect.signature.bind()’ that was
     causing it to fail when handling a keyword argument with same name
     as positional-only parameter.  Patch by Pablo Galindo.

   - bpo-33604(25): Fixed ‘hmac.new’ and ‘hmac.HMAC’ to raise TypeError
     instead of ValueError when the digestmod parameter, now required in
     3.8, is omitted.  Also clarified the hmac module documentation and
     docstrings.

   - bpo-38378(26): Parameters 'out' and 'in' of *note os.sendfile():
     d05. was renamed to 'out_fd' and 'in_fd'.

   - bpo-38417(27): Added support for setting the umask in the child
     process to the subprocess module on POSIX systems.

   - bpo-38449(28): Revert PR 15522, which introduces a regression in
     *note mimetypes.guess_type(): 517. due to improper handling of
     filenames as urls.

   - bpo-38431(29): Fix ‘__repr__’ method for *note dataclasses.InitVar:
     1bb4. to support typing objects, patch by Samuel Colvin.

   - bpo-38109(30): Add missing *note stat.S_IFDOOR: 11bd, *note
     stat.S_IFPORT: 11be, *note stat.S_IFWHT: 11bf, *note
     stat.S_ISDOOR(): 1dab, *note stat.S_ISPORT(): 1dac, and *note
     stat.S_ISWHT(): 1dad. values to the Python implementation of *note
     stat: d6.

   - bpo-38422(31): Clarify docstrings of pathlib suffix(es)

   - bpo-38405(32): Nested subclasses of *note typing.NamedTuple: 331.
     are now pickleable.

   - bpo-38332(33): Prevent *note KeyError: 5e7. thrown by
     ‘_encoded_words.decode()’ when given an encoded-word with invalid
     content-type encoding from propagating all the way to
     ‘email.message.get()’.

   - bpo-38371(34): Deprecated the ‘split()’ method in
     ‘_tkinter.TkappType’ in favour of the ‘splitlist()’ method which
     has more consistent and predictable behavior.

   - bpo-38341(35): Add *note smtplib.SMTPNotSupportedError: 1dae. to
     the *note smtplib: cf. exported names.

   - bpo-38319(36): sendfile() used in socket and shutil modules was
     raising OverflowError for files >= 2GiB on 32-bit architectures.
     (patch by Giampaolo Rodola)

   - bpo-38242(37): Revert the new asyncio Streams API

   - bpo-13153(38): OS native encoding is now used for converting
     between Python strings and Tcl objects.  This allows to display,
     copy and paste to clipboard emoji and other non-BMP characters.
     Converting strings from Tcl to Python and back now never fails
     (except MemoryError).

   - bpo-38019(39): Correctly handle pause/resume reading of closed
     asyncio unix pipe.

   - bpo-38163(40): Child mocks will now detect their type as either
     synchronous or asynchronous, asynchronous child mocks will be
     AsyncMocks and synchronous child mocks will be either MagicMock or
     Mock (depending on their parent type).

   - bpo-38161(41): Removes _AwaitEvent from AsyncMock.

   - bpo-38216(42): Allow the rare code that wants to send invalid http
     requests from the ‘http.client’ library a way to do so.  The fixes
     for bpo-30458(43) led to breakage for some projects that were
     relying on this ability to test their own behavior in the face of
     bad requests.

   - bpo-28286(44): Deprecate opening *note GzipFile: 65c. for writing
     implicitly.  Always specify the 'mode' argument for writing.

   - bpo-38108(45): Any synchronous magic methods on an AsyncMock now
     return a MagicMock.  Any asynchronous magic methods on a MagicMock
     now return an AsyncMock.

   - bpo-38265(46): Update the 'length' parameter of *note os.pread():
     d56. to accept *note Py_ssize_t: c55. instead of int.

   - bpo-38112(47): *note compileall: 21. has a higher default recursion
     limit and new command-line arguments for path manipulation,
     symlinks handling, and multiple optimization levels.

   - bpo-38248(48): asyncio: Fix inconsistent immediate Task
     cancellation

   - bpo-38237(49): The arguments for the builtin pow function are more
     descriptive.  They can now also be passed in as keywords.

   - bpo-34002(50): Improve efficiency in parts of email package by
     changing while-pop to a for loop, using isdisjoint instead of set
     intersections.

   - bpo-38191(51): Constructors of *note NamedTuple: 331. and *note
     TypedDict: 332. types now accept arbitrary keyword argument names,
     including "cls", "self", "typename", "_typename", "fields" and
     "_fields".

   - bpo-38155(52): Add ‘__all__’ to *note datetime: 34.  Patch by Tahia
     Khan.

   - bpo-38185(53): Fixed case-insensitive string comparison in *note
     sqlite3.Row: 1071. indexing.

   - bpo-38136(54): Changes AsyncMock call count and await count to be
     two different counters.  Now await count only counts when a
     coroutine has been awaited, not when it has been called, and
     vice-versa.  Update the documentation around this.

   - bpo-37828(55): Fix default mock name in *note
     unittest.mock.Mock.assert_called(): ef4. exceptions.  Patch by
     Abraham Toriz Cruz.

   - bpo-38175(56): Fix a memory leak in comparison of *note
     sqlite3.Row: 1071. objects.

   - bpo-33936(57): _hashlib no longer calls obsolete OpenSSL
     initialization function with OpenSSL 1.1.0+.

   - bpo-34706(58): Preserve subclassing in
     inspect.Signature.from_callable.

   - bpo-38153(59): Names of hashing algorithms from OpenSSL are now
     normalized to follow Python's naming conventions.  For example
     OpenSSL uses sha3-512 instead of sha3_512 or blake2b512 instead of
     blake2b.

   - bpo-38115(60): Fix a bug in dis.findlinestarts() where it would
     return invalid bytecode offsets.  Document that a code object's
     co_lnotab can contain invalid bytecode offsets.

   - bpo-38148(61): Add slots to *note asyncio: b. transport classes,
     which can reduce memory usage.

   - bpo-38142(62): The _hashlib OpenSSL wrapper extension module is now
     PEP-384 compliant.

   - bpo-9216(63): hashlib constructors now support usedforsecurity flag
     to signal that a hashing algorithm is not used in a security
     context.

   - bpo-36991(64): Fixes a potential incorrect AttributeError exception
     escaping ZipFile.extract() in some unsupported input error
     situations.

   - bpo-38134(65): Remove obsolete copy of PBKDF2_HMAC_fast.  All
     supported OpenSSL versions contain a fast implementation.

   - bpo-38132(66): The OpenSSL hashlib wrapper uses a simpler
     implementation.  Several Macros and pointless caches are gone.  The
     hash name now comes from OpenSSL's EVP. The algorithm name stays
     the same, except it is now always lower case.

   - bpo-38008(67): Fix parent class check in protocols to correctly
     identify the module that provides a builtin protocol, instead of
     assuming they all come from the *note collections.abc: 1f. module

   - bpo-34037(68): For *note asyncio: b, add a new coroutine
     ‘loop.shutdown_default_executor()’.  The new coroutine provides an
     API to schedule an executor shutdown that waits on the threadpool
     to finish closing.  Also, *note asyncio.run(): 2f3. has been
     updated to utilize the new coroutine.  Patch by Kyle Stanley.

   - bpo-37405(69): Fixed regression bug for socket.getsockname() for
     non-CAN_ISOTP AF_CAN address family sockets by returning a 1-tuple
     instead of string.

   - bpo-38121(70): Update parameter names on functions in
     importlib.metadata matching the changes in the 0.22 release of
     importlib_metadata.

   - bpo-38110(71): The os.closewalk() implementation now uses the libc
     fdwalk() API on platforms where it is available.

   - bpo-38093(72): Fixes AsyncMock so it doesn't crash when used with
     AsyncContextManagers or AsyncIterators.

   - bpo-37488(73): Add warning to ‘datetime.utctimetuple()’,
     ‘datetime.utcnow()’ and ‘datetime.utcfromtimestamp()’ .

   - bpo-35640(74): Allow passing a *note path-like object: 5a1. as
     ‘directory’ argument to the *note
     http.server.SimpleHTTPRequestHandler: d38. class.  Patch by Géry
     Ogam.

   - bpo-38086(75): Update importlib.metadata with changes from
     importlib_metadata 0.21(76).

   - bpo-37251(77): Remove ‘__code__’ check in AsyncMock that
     incorrectly evaluated function specs as async objects but failed to
     evaluate classes with ‘__await__’ but no ‘__code__’ attribute
     defined as async objects.

   - bpo-38037(78): Fix reference counters in the *note signal: cb.
     module.

   - bpo-38066(79): Hide internal asyncio.Stream methods: feed_eof(),
     feed_data(), set_exception() and set_transport().

   - bpo-38059(80): inspect.py now uses sys.exit() instead of exit()

   - bpo-38049(81): Added command-line interface for the *note ast: 9.
     module.

   - bpo-37953(82): In *note typing: 10a, improved the ‘__hash__’ and
     ‘__eq__’ methods for ‘ForwardReferences’.

   - bpo-38026(83): Fixed *note inspect.getattr_static(): 6bc. used
     ‘isinstance’ while it should avoid dynamic lookup.

   - bpo-35923(84): Update *note importlib.machinery.BuiltinImporter:
     ead. to use ‘loader._ORIGIN’ instead of a hardcoded value.  Patch
     by Donghee Na.

   - bpo-38010(85): In ‘importlib.metadata’ sync with
     ‘importlib_metadata’ 0.20, clarifying behavior of ‘files()’ and
     fixing issue where only one requirement was returned for
     ‘requires()’ on ‘dist-info’ packages.

   - bpo-38006(86): weakref.WeakValueDictionary defines a local remove()
     function used as callback for weak references.  This function was
     created with a closure.  Modify the implementation to avoid the
     closure.

   - bpo-37995(87): Added the 'indent' option to *note ast.dump(): ae1.
     which allows it to produce a multiline indented output.

   - bpo-34410(88): Fixed a crash in the ‘tee()’ iterator when re-enter
     it.  RuntimeError is now raised in this case.

   - bpo-37140(89): Fix a ctypes regression of Python 3.8.  When a
     ctypes.Structure is passed by copy to a function, ctypes internals
     created a temporary object which had the side effect of calling the
     structure finalizer (__del__) twice.  The Python semantics requires
     a finalizer to be called exactly once.  Fix ctypes internals to no
     longer call the finalizer twice.

   - bpo-37587(90): ‘_json.scanstring’ is now up to 3x faster when there
     are many backslash escaped characters in the JSON string.

   - bpo-37834(91): Prevent shutil.rmtree exception when built on
     non-Windows system without fd system call support, like older
     versions of macOS.

   - bpo-10978(92): Semaphores and BoundedSemaphores can now release
     more than one waiting thread at a time.

   - bpo-37972(93): Subscripts to the ‘unittest.mock.call’ objects now
     receive the same chaining mechanism as any other custom attributes,
     so that the following usage no longer raises a ‘TypeError’:

     ‘call().foo().__getitem__('bar')’

     Patch by blhsing

   - bpo-37965(94): Fix C compiler warning caused by
     distutils.ccompiler.CCompiler.has_function.

   - bpo-37964(95): Add ‘F_GETPATH’ command to *note fcntl: 5d.

   - bpo-37960(96): ‘repr()’ of buffered and text streams now silences
     only expected exceptions when get the value of "name" and "mode"
     attributes.

   - bpo-37961(97): Add a ‘total_nframe’ field to the traces collected
     by the tracemalloc module.  This field indicates the original
     number of frames before it was truncated.

   - bpo-37951(98): Most features of the subprocess module now work
     again in subinterpreters.  Only 'preexec_fn' is restricted in
     subinterpreters.

   - bpo-36205(99): Fix the rusage implementation of time.process_time()
     to correctly report the sum of the system and user CPU time.

   - bpo-37950(100): Fix *note ast.dump(): ae1. when call with
     incompletely initialized node.

   - bpo-34679(101): Restores instantiation of Windows IOCP event loops
     from the non-main thread.

   - bpo-36917(102): Add default implementation of the *note
     ast.NodeVisitor.visit_Constant(): c63. method which emits a
     deprecation warning and calls corresponding methods ‘visit_Num()’,
     ‘visit_Str()’, etc.

   - bpo-37798(103): Update test_statistics.py to verify that the
     statistics module works well for both C and Python implementations.
     Patch by Donghee Na

   - bpo-26589(104): Added a new status code to the http module: 451
     UNAVAILABLE_FOR_LEGAL_REASONS

   - bpo-37915(105): Fix a segmentation fault that appeared when
     comparing instances of ‘datetime.timezone’ and ‘datetime.tzinfo’
     objects.  Patch by Pablo Galindo.

   - bpo-32554(106): Deprecate having random.seed() call hash on
     arbitrary types.

   - bpo-9938(107): Add optional keyword argument ‘exit_on_error’ for
     ‘ArgumentParser’.

   - bpo-37851(108): The *note faulthandler: 5c. module no longer
     allocates its alternative stack at Python startup.  Now the stack
     is only allocated at the first faulthandler usage.

   - bpo-32793(109): Fix a duplicated debug message when *note
     smtplib.SMTP.connect(): 1daf. is called.

   - bpo-37885(110): venv: Don't generate unset variable warning on
     deactivate.

   - bpo-37868(111): Fix dataclasses.is_dataclass when given an instance
     that never raises AttributeError in __getattr__.  That is, an
     object that returns something for __dataclass_fields__ even if it's
     not a dataclass.

   - bpo-37811(112): Fix ‘socket’ module's ‘socket.connect(address)’
     function being unable to establish connection in case of
     interrupted system call.  The problem was observed on all OSes
     which ‘poll(2)’ system call can take only non-negative integers and
     -1 as a timeout value.

   - bpo-37863(113): Optimizations for Fraction.__hash__ suggested by
     Tim Peters.

   - bpo-21131(114): Fix ‘faulthandler.register(chain=True)’ stack.
     faulthandler now allocates a dedicated stack of ‘SIGSTKSZ*2’ bytes,
     instead of just ‘SIGSTKSZ’ bytes.  Calling the previous signal
     handler in faulthandler signal handler uses more than ‘SIGSTKSZ’
     bytes of stack memory on some platforms.

   - bpo-37798(115): Add C fastpath for statistics.NormalDist.inv_cdf()
     Patch by Donghee Na

   - bpo-37804(116): Remove the deprecated method
     ‘threading.Thread.isAlive()’.  Patch by Donghee Na.

   - bpo-37819(117): Add Fraction.as_integer_ratio() to match the
     corresponding methods in bool, int, float, and decimal.

   - bpo-14465(118): Add an xml.etree.ElementTree.indent() function for
     pretty-printing XML trees.  Contributed by Stefan Behnel.

   - bpo-37810(119): Fix *note difflib: 3b. ‘?’ hint in diff output when
     dealing with tabs.  Patch by Anthony Sottile.

   - bpo-37772(120): In ‘zipfile.Path’, when adding implicit dirs,
     ensure that ancestral directories are added and that duplicates are
     excluded.

   - bpo-18578(121): Renamed and documented ‘test.bytecode_helper’ as
     ‘test.support.bytecode_helper’.  Patch by Joannah Nanjekye.

   - bpo-37785(122): Fix xgettext warnings in *note argparse: 7.

   - bpo-34488(123): ‘writelines()’ method of *note io.BytesIO: 10a4. is
     now slightly faster when many small lines are passed.  Patch by
     Sergey Fedoseev.

   - bpo-37449(124): ‘ensurepip’ now uses
     ‘importlib.resources.read_binary()’ to read data instead of
     ‘pkgutil.get_data()’.  Patch by Joannah Nanjekye.

   - bpo-28292(125): Mark calendar.py helper functions as being private.
     The follows PEP 8 guidance to maintain the style conventions in the
     module and it addresses a known case of user confusion.

   - bpo-18049(126): Add definition of THREAD_STACK_SIZE for AIX in
     Python/thread_pthread.h The default thread stacksize caused crashes
     with the default recursion limit Patch by M Felt

   - bpo-37742(127): The logging.getLogger() API now returns the root
     logger when passed the name 'root', whereas previously it returned
     a non-root logger named 'root'.  This could affect cases where user
     code explicitly wants a non-root logger named 'root', or
     instantiates a logger using logging.getLogger(__name__) in some
     top-level module called 'root.py'.

   - bpo-37738(128): Fix the implementation of curses ‘addch(str,
     color_pair)’: pass the color pair to ‘setcchar()’, instead of
     always passing 0 as the color pair.

   - bpo-37723(129): Fix performance regression on regular expression
     parsing with huge character sets.  Patch by Yann Vaginay.

   - bpo-35943(130): The function *note PyImport_GetModule(): dac. now
     ensures any module it returns is fully initialized.  Patch by
     Joannah Nanjekye.

   - bpo-32178(131): Fix IndexError in *note email: 3f. package when
     trying to parse invalid address fields starting with ‘:’.

   - bpo-37268(132): The ‘parser’ module is deprecated and will be
     removed in future versions of Python.

   - bpo-11953(133): Completing WSA* error codes in *note socket: d1.

   - bpo-37685(134): Fixed comparisons of *note datetime.timedelta: bc3.
     and *note datetime.timezone: 12d5.

   - bpo-37697(135): Synchronize ‘importlib.metadata’ with
     importlib_metadata 0.19(136), improving handling of EGG-INFO files
     and fixing a crash when entry point names contained colons.

   - bpo-37695(137): Correct *note curses.unget_wch(): 12aa. error
     message.  Patch by Anthony Sottile.

   - bpo-37689(138): Add ‘is_relative_to()’ in ‘PurePath’ to determine
     whether or not one path is relative to another.

   - bpo-29553(139): Fixed *note argparse.ArgumentParser.format_usage():
     1db0. for mutually exclusive groups.  Patch by Andrew Nester.

   - bpo-37691(140): Let math.dist() accept coordinates as sequences (or
     iterables) rather than just tuples.

   - bpo-37685(141): Fixed ‘__eq__’, ‘__lt__’ etc implementations in
     some classes.  They now return *note NotImplemented: 1a2. for
     unsupported type of the other operand.  This allows the other
     operand to play role (for example the equality comparison with
     *note ANY: 1db1. will return ‘True’).

   - bpo-37354(142): Make Activate.ps1 Powershell script static to allow
     for signing it.

   - bpo-37664(143): Update wheels bundled with ensurepip (pip 19.2.3
     and setuptools 41.2.0)

   - bpo-37663(144): Bring consistency to venv shell activation scripts
     by always using __VENV_PROMPT__.

   - bpo-37642(145): Allowed the pure Python implementation of *note
     datetime.timezone: 12d5. to represent sub-minute offsets close to
     minimum and maximum boundaries, specifically in the ranges (23:59,
     24:00) and (-23:59, 24:00).  Patch by Ngalim Siregar

   - bpo-36161(146): In *note posix: b2, use ‘ttyname_r’ instead of
     ‘ttyname’ for thread safety.

   - bpo-36324(147): Make internal attributes for
     statistics.NormalDist() private.

   - bpo-37555(148): Fix ‘NonCallableMock._call_matcher’ returning tuple
     instead of ‘_Call’ object when ‘self._spec_signature’ exists.
     Patch by Elizabeth Uselton

   - bpo-29446(149): Make ‘from tkinter import *’ import only the
     expected objects.

   - bpo-16970(150): Adding a value error when an invalid value in
     passed to nargs Patch by Robert Leenders

   - bpo-34443(151): Exceptions from *note enum: 5a. now use the
     ‘__qualname’ of the enum class in the exception message instead of
     the ‘__name__’.

   - bpo-37491(152): Fix ‘IndexError’ when parsing email headers with
     unexpectedly ending bare-quoted string value.  Patch by Abhilash
     Raj.

   - bpo-37587(153): Make json.loads faster for long strings.  (Patch by
     Marco Paolini)

   - bpo-18378(154): Recognize "UTF-8" as a valid value for LC_CTYPE in
     locale._parse_localename.

   - bpo-37579(155): Return *note NotImplemented: 1a2. in Python
     implementation of ‘__eq__’ for *note timedelta: bc3. and *note
     time: 1fb. when the other object being compared is not of the same
     type to match C implementation.  Patch by Karthikeyan Singaravelan.

   - bpo-21478(156): Record calls to parent when autospecced object is
     attached to a mock using ‘unittest.mock.attach_mock()’.  Patch by
     Karthikeyan Singaravelan.

   - bpo-37531(157): "python3 -m test -jN -timeout=TIMEOUT" now kills a
     worker process if it runs longer than 'TIMEOUT' seconds.

   - bpo-37482(158): Fix serialization of display name in originator or
     destination address fields with both encoded words and special
     chars.

   - bpo-36993(159): Improve error reporting for corrupt zip files with
     bad zip64 extra data.  Patch by Daniel Hillier.

   - bpo-37502(160): pickle.loads() no longer raises TypeError when the
     buffers argument is set to None

   - bpo-37520(161): Correct behavior for zipfile.Path.parent when the
     path object identifies a subdirectory.

   - bpo-18374(162): Fix the ‘.col_offset’ attribute of nested *note
     ast.BinOp: 1db2. instances which had a too large value in some
     situations.

   - bpo-37424(163): Fixes a possible hang when using a timeout on
     ‘subprocess.run()’ while capturing output.  If the child process
     spawned its own children or otherwise connected its stdout or
     stderr handles with another process, we could hang after the
     timeout was reached and our child was killed when attempting to
     read final output from the pipes.

   - bpo-37421(164): Fix ‘multiprocessing.util.get_temp_dir()’
     finalizer: clear also the 'tempdir' configuration of the current
     process, so next call to ‘get_temp_dir()’ will create a new
     temporary directory, rather than reusing the removed temporary
     directory.

   - bpo-37481(165): The distutils ‘bdist_wininst’ command is deprecated
     in Python 3.8, use ‘bdist_wheel’ (wheel packages) instead.

   - bpo-37479(166): When ‘Enum.__str__’ is overridden in a derived
     class, the override will be used by ‘Enum.__format__’ regardless of
     whether mixin classes are present.

   - bpo-37440(167): http.client now enables TLS 1.3 post-handshake
     authentication for default context or if a cert_file is passed to
     HTTPSConnection.

   - bpo-37437(168): Update vendorized expat version to 2.2.7.

   - bpo-37428(169): SSLContext.post_handshake_auth = True no longer
     sets SSL_VERIFY_POST_HANDSHAKE verify flag for client connections.
     Although the option is documented as ignored for clients, OpenSSL
     implicitly enables cert chain validation when the flag is set.

   - bpo-37420(170): *note os.sched_setaffinity(): 1326. now correctly
     handles errors that arise during iteration over its ‘mask’
     argument.  Patch by Brandt Bucher.

   - bpo-37412(171): The *note os.getcwdb(): c82. function now uses the
     UTF-8 encoding on Windows, rather than the ANSI code page: see PEP
     529(172) for the rationale.  The function is no longer deprecated
     on Windows.

   - bpo-37406(173): The sqlite3 module now raises TypeError, rather
     than ValueError, if operation argument type is not str: execute(),
     executemany() and calling a connection.

   - bpo-29412(174): Fix IndexError in parsing a header value ending
     unexpectedly.  Patch by Abhilash Raj.

   - bpo-36546(175): The 'dist' argument for statistics.quantiles() is
     now positional only.  The current name doesn't reflect that the
     argument can be either a dataset or a distribution.  Marking the
     parameter as positional avoids confusion and makes it possible to
     change the name later.

   - bpo-37394(176): Fix a bug that was causing the *note queue: bb.
     module to fail if the accelerator module was not available.  Patch
     by Pablo Galindo.

   - bpo-37376(177): *note pprint: b3. now has support for *note
     types.SimpleNamespace: 4e5.  Patch by Carl Bordum Hansen.

   - bpo-26967(178): An *note ArgumentParser: 1bd. with
     ‘allow_abbrev=False’ no longer disables grouping of short flags,
     such as ‘-vv’, but only disables abbreviation of long flags as
     documented.  Patch by Zac Hatfield-Dodds.

   - bpo-37212(179): *note unittest.mock.call(): 1db3. now preserves the
     order of keyword arguments in repr output.  Patch by Karthikeyan
     Singaravelan.

   - bpo-37372(180): Fix error unpickling datetime.time objects from
     Python 2 with seconds>=24.  Patch by Justin Blanchard.

   - bpo-37345(181): Add formal support for UDPLITE sockets.  Support
     was present before, but it is now easier to detect support with
     ‘hasattr(socket, 'IPPROTO_UDPLITE')’ and there are constants
     defined for each of the values needed: ‘socket.IPPROTO_UDPLITE’,
     ‘UDPLITE_SEND_CSCOV’, and ‘UDPLITE_RECV_CSCOV’.  Patch by Gabe
     Appleton.

   - bpo-37358(182): Optimized ‘functools.partial’ by using vectorcall.

   - bpo-37347(183): *note sqlite3.Connection.create_aggregate(): 5a8,
     *note sqlite3.Connection.create_function(): 5a7, *note
     sqlite3.Connection.set_authorizer(): 5a9, *note
     sqlite3.Connection.set_progress_handler(): 5aa. *note
     sqlite3.Connection.set_trace_callback(): 5ab. methods lead to
     segfaults if some of these methods are called twice with an equal
     object but not the same.  Now callbacks are stored more carefully.
     Patch by Aleksandr Balezin.

   - bpo-37163(184): The 'obj' argument of *note dataclasses.replace():
     1a6a. is positional-only now.

   - bpo-37085(185): Add the optional Linux SocketCAN Broadcast Manager
     constants, used as flags to configure the BCM behaviour, in the
     socket module.  Patch by Karl Ding.

   - bpo-37328(186): ‘HTMLParser.unescape’ is removed.  It was
     undocumented and deprecated since Python 3.4.

   - bpo-37305(187): Add .webmanifest -> application/manifest+json to
     list of recognized file types and content type headers

   - bpo-37320(188): ‘aifc.openfp()’ alias to ‘aifc.open()’,
     ‘sunau.openfp()’ alias to ‘sunau.open()’, and ‘wave.openfp()’ alias
     to ‘wave.open()’ have been removed.  They were deprecated since
     Python 3.7.

   - bpo-37315(189): Deprecated accepting floats with integral value
     (like ‘5.0’) in *note math.factorial(): b41.

   - bpo-37312(190): ‘_dummy_thread’ and ‘dummy_threading’ modules have
     been removed.  These modules were deprecated since Python 3.7 which
     requires threading support.

   - bpo-33972(191): Email with single part but content-type set to
     ‘multipart/*’ doesn't raise AttributeError anymore.

   - bpo-37280(192): Use threadpool for reading from file for sendfile
     fallback mode.

   - bpo-37279(193): Fix asyncio sendfile support when sendfile sends
     extra data in fallback mode.

   - bpo-19865(194): *note ctypes.create_unicode_buffer(): 1db4. now
     also supports non-BMP characters on platforms with 16-bit ‘wchar_t’
     (for example, Windows and AIX).

   - bpo-37266(195): In a subinterpreter, spawning a daemon thread now
     raises an exception.  Daemon threads were never supported in
     subinterpreters.  Previously, the subinterpreter finalization
     crashed with a Python fatal error if a daemon thread was still
     running.

   - bpo-37210(196): Allow pure Python implementation of *note pickle:
     ab. to work even when the C ‘_pickle’ module is unavailable.

   - bpo-21872(197): Fix *note lzma: 8e.: module decompresses data
     incompletely.  When decompressing a FORMAT_ALONE format file, and
     it doesn't have the end marker, sometimes the last one to dozens
     bytes can't be output.  Patch by Ma Lin.

   - bpo-35922(198): Fix ‘RobotFileParser.crawl_delay()’ and
     ‘RobotFileParser.request_rate()’ to return ‘None’ rather than raise
     *note AttributeError: 5f0. when no relevant rule is defined in the
     robots.txt file.  Patch by Rémi Lapeyre.

   - bpo-35766(199): Change the format of feature_version to be a
     (major, minor) tuple.

   - bpo-36607(200): Eliminate *note RuntimeError: 244. raised by *note
     asyncio.all_tasks(): b4f. if internal tasks weak set is changed by
     another thread during iteration.

   - bpo-18748(201): ‘_pyio.IOBase’ destructor now does nothing if
     getting the ‘closed’ attribute fails to better mimic ‘_io.IOBase’
     finalizer.

   - bpo-36402(202): Fix a race condition at Python shutdown when
     waiting for threads.  Wait until the Python thread state of all
     non-daemon threads get deleted (join all non-daemon threads),
     rather than just wait until non-daemon Python threads complete.

   - bpo-37206(203): Default values which cannot be represented as
     Python objects no longer improperly represented as ‘None’ in
     function signatures.

   - bpo-37111(204): Added ‘encoding’ and ‘errors’ keyword parameters to
     ‘logging.basicConfig’.

   - bpo-12144(205): Ensure cookies with ‘expires’ attribute are handled
     in ‘CookieJar.make_cookies()’.

   - bpo-34886(206): Fix an unintended ValueError from *note
     subprocess.run(): d7f. when checking for conflicting 'input' and
     'stdin' or 'capture_output' and 'stdout' or 'stderr' args when they
     were explicitly provided but with ‘None’ values within a passed in
     ‘**kwargs’ dict rather than as passed directly by name.  Patch
     contributed by Rémi Lapeyre.

   - bpo-37173(207): The exception message for ‘inspect.getfile()’ now
     correctly reports the passed class rather than the builtins module.

   - bpo-37178(208): Give math.perm() a one argument form that means the
     same as math.factorial().

   - bpo-37178(209): For math.perm(n, k), let k default to n, giving the
     same result as factorial.

   - bpo-37165(210): Converted _collections._count_elements to use the
     Argument Clinic.

   - bpo-34767(211): Do not always create a *note collections.deque:
     7f4. in *note asyncio.Lock: c66.

   - bpo-37158(212): Speed-up statistics.fmean() by switching from a
     function to a generator.

   - bpo-34282(213): Remove ‘Enum._convert’ method, deprecated in 3.8.

   - bpo-37150(214): ‘argparse._ActionsContainer.add_argument’ now
     throws error, if someone accidentally pass FileType class object
     instead of instance of FileType as ‘type’ argument.

   - bpo-28724(215): The socket module now has the *note
     socket.send_fds(): b2d. and ‘socket.recv.fds()’ methods.
     Contributed by Joannah Nanjekye, Shinya Okano and Victor Stinner.

   - bpo-35621(216): Support running asyncio subprocesses when execution
     event loop in a thread on UNIX.

   - bpo-36520(217): Lengthy email headers with UTF-8 characters are now
     properly encoded when they are folded.  Patch by Jeffrey Kintscher.

   - bpo-30835(218): Fixed a bug in email parsing where a message with
     invalid bytes in content-transfer-encoding of a multipart message
     can cause an AttributeError.  Patch by Andrew Donnellan.

   - bpo-31163(219): pathlib.Path instance's rename and replace methods
     now return the new Path instance.

   - bpo-25068(220): *note urllib.request.ProxyHandler: 1db5. now
     lowercases the keys of the passed dictionary.

   - bpo-26185(221): Fix *note repr(): 1c1. on empty ‘ZipInfo’ object.
     Patch by Mickaël Schoentgen.

   - bpo-21315(222): Email headers containing RFC2047 encoded words are
     parsed despite the missing whitespace, and a defect registered.
     Also missing trailing whitespace after encoded words is now
     registered as a defect.

   - bpo-31904(223): Port test_datetime to VxWorks: skip zoneinfo tests
     on VxWorks

   - bpo-35805(224): Add parser for Message-ID header and add it to
     default HeaderRegistry.  This should prevent folding of Message-ID
     using RFC 2048 encoded words.

   - bpo-36871(225): Ensure method signature is used instead of
     constructor signature of a class while asserting mock object
     against method calls.  Patch by Karthikeyan Singaravelan.

   - bpo-35070(226): posix.getgrouplist() now works correctly when the
     user belongs to NGROUPS_MAX supplemental groups.  Patch by Jeffrey
     Kintscher.

   - bpo-31783(227): Fix race condition in ThreadPoolExecutor when
     worker threads are created during interpreter shutdown.

   - bpo-36582(228): Fix ‘UserString.encode()’ to correctly return
     ‘bytes’ rather than a ‘UserString’ instance.

   - bpo-32424(229): Deprecate xml.etree.ElementTree.Element.copy() in
     favor of copy.copy().

     Patch by Gordon P. Hemsley

   - bpo-36564(230): Fix infinite loop in email header folding logic
     that would be triggered when an email policy's max_line_length is
     not long enough to include the required markup and any values in
     the message.  Patch by Paul Ganssle

   - bpo-36543(231): Removed methods Element.getchildren(),
     Element.getiterator() and ElementTree.getiterator() and the
     xml.etree.cElementTree module.

   - bpo-36409(232): Remove the old plistlib API deprecated in Python
     3.4

   - bpo-36302(233): distutils sorts source file lists so that Extension
     .so files build more reproducibly by default

   - bpo-36250(234): Ignore ‘ValueError’ from ‘signal’ with
     ‘interaction’ in non-main thread.

   - bpo-36046(235): Added ‘user’, ‘group’ and ‘extra_groups’ parameters
     to the subprocess.Popen constructor.  Patch by Patrick McLean.

   - bpo-32627(236): Fix compile error when ‘_uuid’ headers conflicting
     included.

   - bpo-35800(237): Deprecate ‘smtpd.MailmanProxy’ ready for future
     removal.

   - bpo-35168(238): *note shlex.shlex.punctuation_chars: 1db6. is now a
     read-only property.

   - bpo-8538(239): Add support for boolean actions like ‘--foo’ and
     ‘--no-foo’ to argparse.  Patch contributed by Rémi Lapeyre.

   - bpo-20504(240): Fixes a bug in ‘cgi’ module when a
     multipart/form-data request has no ‘Content-Length’ header.

   - bpo-25988(241): The abstract base classes in *note collections.abc:
     1f. no longer are exposed in the regular *note collections: 1e.
     module.

   - bpo-11122(242): Distutils won't check for rpmbuild in specified
     paths only.

   - bpo-34775(243): Division handling of PurePath now returns
     NotImplemented instead of raising a TypeError when passed something
     other than an instance of str or PurePath.  Patch by Roger Aiudi.

   - bpo-34749(244): *note binascii.a2b_base64(): 19a4. is now up to 2
     times faster.  Patch by Sergey Fedoseev.

   - bpo-34519(245): Add additional aliases for HP Roman 8.  Patch by
     Michael Osipov.

   - bpo-28009(246): Fix uuid.getnode() on platforms with '.'  as MAC
     Addr delimiter as well fix for MAC Addr format that omits a leading
     0 in MAC Addr values.  Currently, AIX is the only know platform
     with these settings.  Patch by Michael Felt.

   - bpo-30618(247): Add *note readlink(): b19.  Patch by Girts
     Folkmanis.

   - bpo-32498(248): Made *note urllib.parse.unquote(): 1afb. accept
     bytes in addition to strings.  Patch by Stein Karlsen.

   - bpo-33348(249): lib2to3 now recognizes expressions after ‘*’ and
     ‘**’ like in ‘f(*[] or [])’.

   - bpo-32689(250): Update *note shutil.move(): c51. function to allow
     for Path objects to be used as source argument.  Patch by Emily
     Morehouse and Maxwell "5.13b" McKinnon.

   - bpo-32820(251): Added ‘__format__’ to IPv4 and IPv6 classes.
     Always outputs a fully zero-padded string.  Supports b/x/n
     modifiers (bin/hex/native format).  Native format for IPv4 is bin,
     native format for IPv6 is hex.  Also supports '#' and '_'
     modifiers.

   - bpo-27657(252): Fix urllib.parse.urlparse() with numeric paths.  A
     string like "path:80" is no longer parsed as a path but as a scheme
     ("path") and a path ("80").

   - bpo-4963(253): Fixed non-deterministic behavior related to
     mimetypes extension mapping and module reinitialization.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36589

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38807

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38724

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38786

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38785

   (6) https://bugs.python.org/issue?@action=redirect&bpo=38723

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27805

   (8) https://bugs.python.org/issue?@action=redirect&bpo=38438

   (9) https://bugs.python.org/issue?@action=redirect&bpo=38761

   (10) https://bugs.python.org/issue?@action=redirect&bpo=38716

   (11) https://bugs.python.org/issue?@action=redirect&bpo=38713

   (12) https://bugs.python.org/issue?@action=redirect&bpo=38692

   (13) https://bugs.python.org/issue?@action=redirect&bpo=38692

   (14) https://bugs.python.org/issue?@action=redirect&bpo=38602

   (15) https://bugs.python.org/issue?@action=redirect&bpo=38334

   (16) https://bugs.python.org/issue?@action=redirect&bpo=38312

   (17) https://bugs.python.org/issue?@action=redirect&bpo=38586

   (18) https://bugs.python.org/issue?@action=redirect&bpo=38565

   (19) https://bugs.python.org/issue?@action=redirect&bpo=34679

   (20) https://bugs.python.org/issue?@action=redirect&bpo=31202

   (21) https://bugs.python.org/issue?@action=redirect&bpo=36321

   (22) https://bugs.python.org/issue?@action=redirect&bpo=38521

   (23) https://bugs.python.org/issue?@action=redirect&bpo=38493

   (24) https://bugs.python.org/issue?@action=redirect&bpo=38478

   (25) https://bugs.python.org/issue?@action=redirect&bpo=33604

   (26) https://bugs.python.org/issue?@action=redirect&bpo=38378

   (27) https://bugs.python.org/issue?@action=redirect&bpo=38417

   (28) https://bugs.python.org/issue?@action=redirect&bpo=38449

   (29) https://bugs.python.org/issue?@action=redirect&bpo=38431

   (30) https://bugs.python.org/issue?@action=redirect&bpo=38109

   (31) https://bugs.python.org/issue?@action=redirect&bpo=38422

   (32) https://bugs.python.org/issue?@action=redirect&bpo=38405

   (33) https://bugs.python.org/issue?@action=redirect&bpo=38332

   (34) https://bugs.python.org/issue?@action=redirect&bpo=38371

   (35) https://bugs.python.org/issue?@action=redirect&bpo=38341

   (36) https://bugs.python.org/issue?@action=redirect&bpo=38319

   (37) https://bugs.python.org/issue?@action=redirect&bpo=38242

   (38) https://bugs.python.org/issue?@action=redirect&bpo=13153

   (39) https://bugs.python.org/issue?@action=redirect&bpo=38019

   (40) https://bugs.python.org/issue?@action=redirect&bpo=38163

   (41) https://bugs.python.org/issue?@action=redirect&bpo=38161

   (42) https://bugs.python.org/issue?@action=redirect&bpo=38216

   (43) https://bugs.python.org/issue?@action=redirect&bpo=30458

   (44) https://bugs.python.org/issue?@action=redirect&bpo=28286

   (45) https://bugs.python.org/issue?@action=redirect&bpo=38108

   (46) https://bugs.python.org/issue?@action=redirect&bpo=38265

   (47) https://bugs.python.org/issue?@action=redirect&bpo=38112

   (48) https://bugs.python.org/issue?@action=redirect&bpo=38248

   (49) https://bugs.python.org/issue?@action=redirect&bpo=38237

   (50) https://bugs.python.org/issue?@action=redirect&bpo=34002

   (51) https://bugs.python.org/issue?@action=redirect&bpo=38191

   (52) https://bugs.python.org/issue?@action=redirect&bpo=38155

   (53) https://bugs.python.org/issue?@action=redirect&bpo=38185

   (54) https://bugs.python.org/issue?@action=redirect&bpo=38136

   (55) https://bugs.python.org/issue?@action=redirect&bpo=37828

   (56) https://bugs.python.org/issue?@action=redirect&bpo=38175

   (57) https://bugs.python.org/issue?@action=redirect&bpo=33936

   (58) https://bugs.python.org/issue?@action=redirect&bpo=34706

   (59) https://bugs.python.org/issue?@action=redirect&bpo=38153

   (60) https://bugs.python.org/issue?@action=redirect&bpo=38115

   (61) https://bugs.python.org/issue?@action=redirect&bpo=38148

   (62) https://bugs.python.org/issue?@action=redirect&bpo=38142

   (63) https://bugs.python.org/issue?@action=redirect&bpo=9216

   (64) https://bugs.python.org/issue?@action=redirect&bpo=36991

   (65) https://bugs.python.org/issue?@action=redirect&bpo=38134

   (66) https://bugs.python.org/issue?@action=redirect&bpo=38132

   (67) https://bugs.python.org/issue?@action=redirect&bpo=38008

   (68) https://bugs.python.org/issue?@action=redirect&bpo=34037

   (69) https://bugs.python.org/issue?@action=redirect&bpo=37405

   (70) https://bugs.python.org/issue?@action=redirect&bpo=38121

   (71) https://bugs.python.org/issue?@action=redirect&bpo=38110

   (72) https://bugs.python.org/issue?@action=redirect&bpo=38093

   (73) https://bugs.python.org/issue?@action=redirect&bpo=37488

   (74) https://bugs.python.org/issue?@action=redirect&bpo=35640

   (75) https://bugs.python.org/issue?@action=redirect&bpo=38086

   (76) 
https://gitlab.com/python-devs/importlib_metadata/blob/0.21/importlib_metadata/docs/changelog.rst

   (77) https://bugs.python.org/issue?@action=redirect&bpo=37251

   (78) https://bugs.python.org/issue?@action=redirect&bpo=38037

   (79) https://bugs.python.org/issue?@action=redirect&bpo=38066

   (80) https://bugs.python.org/issue?@action=redirect&bpo=38059

   (81) https://bugs.python.org/issue?@action=redirect&bpo=38049

   (82) https://bugs.python.org/issue?@action=redirect&bpo=37953

   (83) https://bugs.python.org/issue?@action=redirect&bpo=38026

   (84) https://bugs.python.org/issue?@action=redirect&bpo=35923

   (85) https://bugs.python.org/issue?@action=redirect&bpo=38010

   (86) https://bugs.python.org/issue?@action=redirect&bpo=38006

   (87) https://bugs.python.org/issue?@action=redirect&bpo=37995

   (88) https://bugs.python.org/issue?@action=redirect&bpo=34410

   (89) https://bugs.python.org/issue?@action=redirect&bpo=37140

   (90) https://bugs.python.org/issue?@action=redirect&bpo=37587

   (91) https://bugs.python.org/issue?@action=redirect&bpo=37834

   (92) https://bugs.python.org/issue?@action=redirect&bpo=10978

   (93) https://bugs.python.org/issue?@action=redirect&bpo=37972

   (94) https://bugs.python.org/issue?@action=redirect&bpo=37965

   (95) https://bugs.python.org/issue?@action=redirect&bpo=37964

   (96) https://bugs.python.org/issue?@action=redirect&bpo=37960

   (97) https://bugs.python.org/issue?@action=redirect&bpo=37961

   (98) https://bugs.python.org/issue?@action=redirect&bpo=37951

   (99) https://bugs.python.org/issue?@action=redirect&bpo=36205

   (100) https://bugs.python.org/issue?@action=redirect&bpo=37950

   (101) https://bugs.python.org/issue?@action=redirect&bpo=34679

   (102) https://bugs.python.org/issue?@action=redirect&bpo=36917

   (103) https://bugs.python.org/issue?@action=redirect&bpo=37798

   (104) https://bugs.python.org/issue?@action=redirect&bpo=26589

   (105) https://bugs.python.org/issue?@action=redirect&bpo=37915

   (106) https://bugs.python.org/issue?@action=redirect&bpo=32554

   (107) https://bugs.python.org/issue?@action=redirect&bpo=9938

   (108) https://bugs.python.org/issue?@action=redirect&bpo=37851

   (109) https://bugs.python.org/issue?@action=redirect&bpo=32793

   (110) https://bugs.python.org/issue?@action=redirect&bpo=37885

   (111) https://bugs.python.org/issue?@action=redirect&bpo=37868

   (112) https://bugs.python.org/issue?@action=redirect&bpo=37811

   (113) https://bugs.python.org/issue?@action=redirect&bpo=37863

   (114) https://bugs.python.org/issue?@action=redirect&bpo=21131

   (115) https://bugs.python.org/issue?@action=redirect&bpo=37798

   (116) https://bugs.python.org/issue?@action=redirect&bpo=37804

   (117) https://bugs.python.org/issue?@action=redirect&bpo=37819

   (118) https://bugs.python.org/issue?@action=redirect&bpo=14465

   (119) https://bugs.python.org/issue?@action=redirect&bpo=37810

   (120) https://bugs.python.org/issue?@action=redirect&bpo=37772

   (121) https://bugs.python.org/issue?@action=redirect&bpo=18578

   (122) https://bugs.python.org/issue?@action=redirect&bpo=37785

   (123) https://bugs.python.org/issue?@action=redirect&bpo=34488

   (124) https://bugs.python.org/issue?@action=redirect&bpo=37449

   (125) https://bugs.python.org/issue?@action=redirect&bpo=28292

   (126) https://bugs.python.org/issue?@action=redirect&bpo=18049

   (127) https://bugs.python.org/issue?@action=redirect&bpo=37742

   (128) https://bugs.python.org/issue?@action=redirect&bpo=37738

   (129) https://bugs.python.org/issue?@action=redirect&bpo=37723

   (130) https://bugs.python.org/issue?@action=redirect&bpo=35943

   (131) https://bugs.python.org/issue?@action=redirect&bpo=32178

   (132) https://bugs.python.org/issue?@action=redirect&bpo=37268

   (133) https://bugs.python.org/issue?@action=redirect&bpo=11953

   (134) https://bugs.python.org/issue?@action=redirect&bpo=37685

   (135) https://bugs.python.org/issue?@action=redirect&bpo=37697

   (136) 
https://gitlab.com/python-devs/importlib_metadata/-/milestones/20

   (137) https://bugs.python.org/issue?@action=redirect&bpo=37695

   (138) https://bugs.python.org/issue?@action=redirect&bpo=37689

   (139) https://bugs.python.org/issue?@action=redirect&bpo=29553

   (140) https://bugs.python.org/issue?@action=redirect&bpo=37691

   (141) https://bugs.python.org/issue?@action=redirect&bpo=37685

   (142) https://bugs.python.org/issue?@action=redirect&bpo=37354

   (143) https://bugs.python.org/issue?@action=redirect&bpo=37664

   (144) https://bugs.python.org/issue?@action=redirect&bpo=37663

   (145) https://bugs.python.org/issue?@action=redirect&bpo=37642

   (146) https://bugs.python.org/issue?@action=redirect&bpo=36161

   (147) https://bugs.python.org/issue?@action=redirect&bpo=36324

   (148) https://bugs.python.org/issue?@action=redirect&bpo=37555

   (149) https://bugs.python.org/issue?@action=redirect&bpo=29446

   (150) https://bugs.python.org/issue?@action=redirect&bpo=16970

   (151) https://bugs.python.org/issue?@action=redirect&bpo=34443

   (152) https://bugs.python.org/issue?@action=redirect&bpo=37491

   (153) https://bugs.python.org/issue?@action=redirect&bpo=37587

   (154) https://bugs.python.org/issue?@action=redirect&bpo=18378

   (155) https://bugs.python.org/issue?@action=redirect&bpo=37579

   (156) https://bugs.python.org/issue?@action=redirect&bpo=21478

   (157) https://bugs.python.org/issue?@action=redirect&bpo=37531

   (158) https://bugs.python.org/issue?@action=redirect&bpo=37482

   (159) https://bugs.python.org/issue?@action=redirect&bpo=36993

   (160) https://bugs.python.org/issue?@action=redirect&bpo=37502

   (161) https://bugs.python.org/issue?@action=redirect&bpo=37520

   (162) https://bugs.python.org/issue?@action=redirect&bpo=18374

   (163) https://bugs.python.org/issue?@action=redirect&bpo=37424

   (164) https://bugs.python.org/issue?@action=redirect&bpo=37421

   (165) https://bugs.python.org/issue?@action=redirect&bpo=37481

   (166) https://bugs.python.org/issue?@action=redirect&bpo=37479

   (167) https://bugs.python.org/issue?@action=redirect&bpo=37440

   (168) https://bugs.python.org/issue?@action=redirect&bpo=37437

   (169) https://bugs.python.org/issue?@action=redirect&bpo=37428

   (170) https://bugs.python.org/issue?@action=redirect&bpo=37420

   (171) https://bugs.python.org/issue?@action=redirect&bpo=37412

   (172) https://peps.python.org/pep-0529/

   (173) https://bugs.python.org/issue?@action=redirect&bpo=37406

   (174) https://bugs.python.org/issue?@action=redirect&bpo=29412

   (175) https://bugs.python.org/issue?@action=redirect&bpo=36546

   (176) https://bugs.python.org/issue?@action=redirect&bpo=37394

   (177) https://bugs.python.org/issue?@action=redirect&bpo=37376

   (178) https://bugs.python.org/issue?@action=redirect&bpo=26967

   (179) https://bugs.python.org/issue?@action=redirect&bpo=37212

   (180) https://bugs.python.org/issue?@action=redirect&bpo=37372

   (181) https://bugs.python.org/issue?@action=redirect&bpo=37345

   (182) https://bugs.python.org/issue?@action=redirect&bpo=37358

   (183) https://bugs.python.org/issue?@action=redirect&bpo=37347

   (184) https://bugs.python.org/issue?@action=redirect&bpo=37163

   (185) https://bugs.python.org/issue?@action=redirect&bpo=37085

   (186) https://bugs.python.org/issue?@action=redirect&bpo=37328

   (187) https://bugs.python.org/issue?@action=redirect&bpo=37305

   (188) https://bugs.python.org/issue?@action=redirect&bpo=37320

   (189) https://bugs.python.org/issue?@action=redirect&bpo=37315

   (190) https://bugs.python.org/issue?@action=redirect&bpo=37312

   (191) https://bugs.python.org/issue?@action=redirect&bpo=33972

   (192) https://bugs.python.org/issue?@action=redirect&bpo=37280

   (193) https://bugs.python.org/issue?@action=redirect&bpo=37279

   (194) https://bugs.python.org/issue?@action=redirect&bpo=19865

   (195) https://bugs.python.org/issue?@action=redirect&bpo=37266

   (196) https://bugs.python.org/issue?@action=redirect&bpo=37210

   (197) https://bugs.python.org/issue?@action=redirect&bpo=21872

   (198) https://bugs.python.org/issue?@action=redirect&bpo=35922

   (199) https://bugs.python.org/issue?@action=redirect&bpo=35766

   (200) https://bugs.python.org/issue?@action=redirect&bpo=36607

   (201) https://bugs.python.org/issue?@action=redirect&bpo=18748

   (202) https://bugs.python.org/issue?@action=redirect&bpo=36402

   (203) https://bugs.python.org/issue?@action=redirect&bpo=37206

   (204) https://bugs.python.org/issue?@action=redirect&bpo=37111

   (205) https://bugs.python.org/issue?@action=redirect&bpo=12144

   (206) https://bugs.python.org/issue?@action=redirect&bpo=34886

   (207) https://bugs.python.org/issue?@action=redirect&bpo=37173

   (208) https://bugs.python.org/issue?@action=redirect&bpo=37178

   (209) https://bugs.python.org/issue?@action=redirect&bpo=37178

   (210) https://bugs.python.org/issue?@action=redirect&bpo=37165

   (211) https://bugs.python.org/issue?@action=redirect&bpo=34767

   (212) https://bugs.python.org/issue?@action=redirect&bpo=37158

   (213) https://bugs.python.org/issue?@action=redirect&bpo=34282

   (214) https://bugs.python.org/issue?@action=redirect&bpo=37150

   (215) https://bugs.python.org/issue?@action=redirect&bpo=28724

   (216) https://bugs.python.org/issue?@action=redirect&bpo=35621

   (217) https://bugs.python.org/issue?@action=redirect&bpo=36520

   (218) https://bugs.python.org/issue?@action=redirect&bpo=30835

   (219) https://bugs.python.org/issue?@action=redirect&bpo=31163

   (220) https://bugs.python.org/issue?@action=redirect&bpo=25068

   (221) https://bugs.python.org/issue?@action=redirect&bpo=26185

   (222) https://bugs.python.org/issue?@action=redirect&bpo=21315

   (223) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (224) https://bugs.python.org/issue?@action=redirect&bpo=35805

   (225) https://bugs.python.org/issue?@action=redirect&bpo=36871

   (226) https://bugs.python.org/issue?@action=redirect&bpo=35070

   (227) https://bugs.python.org/issue?@action=redirect&bpo=31783

   (228) https://bugs.python.org/issue?@action=redirect&bpo=36582

   (229) https://bugs.python.org/issue?@action=redirect&bpo=32424

   (230) https://bugs.python.org/issue?@action=redirect&bpo=36564

   (231) https://bugs.python.org/issue?@action=redirect&bpo=36543

   (232) https://bugs.python.org/issue?@action=redirect&bpo=36409

   (233) https://bugs.python.org/issue?@action=redirect&bpo=36302

   (234) https://bugs.python.org/issue?@action=redirect&bpo=36250

   (235) https://bugs.python.org/issue?@action=redirect&bpo=36046

   (236) https://bugs.python.org/issue?@action=redirect&bpo=32627

   (237) https://bugs.python.org/issue?@action=redirect&bpo=35800

   (238) https://bugs.python.org/issue?@action=redirect&bpo=35168

   (239) https://bugs.python.org/issue?@action=redirect&bpo=8538

   (240) https://bugs.python.org/issue?@action=redirect&bpo=20504

   (241) https://bugs.python.org/issue?@action=redirect&bpo=25988

   (242) https://bugs.python.org/issue?@action=redirect&bpo=11122

   (243) https://bugs.python.org/issue?@action=redirect&bpo=34775

   (244) https://bugs.python.org/issue?@action=redirect&bpo=34749

   (245) https://bugs.python.org/issue?@action=redirect&bpo=34519

   (246) https://bugs.python.org/issue?@action=redirect&bpo=28009

   (247) https://bugs.python.org/issue?@action=redirect&bpo=30618

   (248) https://bugs.python.org/issue?@action=redirect&bpo=32498

   (249) https://bugs.python.org/issue?@action=redirect&bpo=33348

   (250) https://bugs.python.org/issue?@action=redirect&bpo=32689

   (251) https://bugs.python.org/issue?@action=redirect&bpo=32820

   (252) https://bugs.python.org/issue?@action=redirect&bpo=27657

   (253) https://bugs.python.org/issue?@action=redirect&bpo=4963


File: python.info,  Node: ドキュメント<51>,  Next: テスト<49>,  Prev: ライブラリ<157>,  Up: Python 3 9 0 alpha 1

1.24.57.4 ドキュメント
......................

   - bpo-21767(1): Explicitly mention abc support in
     functools.singledispatch

   - bpo-38816(2): Provides more details about the interaction between
     ‘fork()’ and CPython's runtime, focusing just on the C-API. This
     includes cautions about where ‘fork()’ should and shouldn't be
     called.

   - bpo-38351(3): Modernize *note email: 3f. examples from %-formatting
     to f-strings.

   - bpo-38778(4): Document the fact that *note RuntimeError: 244. is
     raised if *note os.fork(): 4b5. is called in a subinterpreter.

   - bpo-38592(5): Add Brazilian Portuguese to the language switcher at
     Python Documentation website.

   - bpo-38294(6): Add list of no-longer-escaped chars to re.escape
     documentation

   - bpo-38053(7): Modernized the plistlib documentation

   - bpo-26868(8): Fix example usage of *note PyModule_AddObject(): 60b.
     to properly handle errors.

   - bpo-36797(9): Fix a dead link in the distutils API Reference.

   - bpo-37977(10): Warn more strongly and clearly about pickle
     insecurity

   - bpo-37979(11): Added a link to dateutil.parser.isoparse in the
     datetime.fromisoformat documentation.  Patch by Paul Ganssle

   - bpo-12707(12): Deprecate info(), geturl(), getcode() methods in
     favor of the headers, url, and status properties, respectively, for
     HTTPResponse and addinfourl.  Also deprecate the code attribute of
     addinfourl in favor of the status attribute.  Patch by Ashwin
     Ramaswami

   - bpo-37937(13): Mention ‘frame.f_trace’ in *note sys.settrace():
     2e1. docs.

   - bpo-37878(14): Make *note PyThreadState_DeleteCurrent(): 1db8.
     Internal.

   - bpo-37759(15): Beginning edits to Whatsnew 3.8

   - bpo-37726(16): Stop recommending getopt in the tutorial for command
     line argument parsing and promote argparse.

   - bpo-32910(17): Remove implementation-specific behaviour of how
     venv's Deactivate works.

   - bpo-37256(18): Fix wording of arguments for ‘Request’ in *note
     urllib.request: 111.

   - bpo-37284(19): Add a brief note to indicate that any new
     ‘sys.implementation’ required attributes must go through the PEP
     process.

   - bpo-30088(20): Documented that *note mailbox.Maildir: 65e.
     constructor doesn't attempt to verify the maildir folder layout
     correctness.  Patch by Sviatoslav Sydorenko.

   - bpo-37521(21): Fix ‘importlib’ examples to insert any newly created
     modules via importlib.util.module_from_spec() immediately into
     sys.modules instead of after calling loader.exec_module().

     Thanks to Benjamin Mintz for finding the bug.

   - bpo-37456(22): Slash ('/') is now part of syntax.

   - bpo-37487(23): Fix PyList_GetItem index description to include 0.

   - bpo-37149(24): Replace the dead link to the Tkinter 8.5 reference
     by John Shipman, New Mexico Tech, with a link to the archive.org
     copy.

   - bpo-37478(25): Added possible exceptions to the description of
     os.chdir().

   - bpo-34903(26): Documented that in *note
     datetime.datetime.strptime(): 1950, the leading zero in some
     two-digit formats is optional.  Patch by Mike Gleen.

   - bpo-36260(27): Add decompression pitfalls to zipfile module
     documentation.

   - bpo-37004(28): In the documentation for difflib, a note was added
     explicitly warning that the results of SequenceMatcher's ratio
     method may depend on the order of the input strings.

   - bpo-36960(29): Restructured the *note datetime: 34. docs in the
     interest of making them more user-friendly and improving
     readability.  Patch by Brad Solomon.

   - bpo-36487(30): Make C-API docs clear about what the "main"
     interpreter is.

   - bpo-23460(31): The documentation for decimal string formatting
     using the ‘:g’ specifier has been updated to reflect the correct
     exponential notation cutoff point.  Original patch contributed by
     Tuomas Suutari.

   - bpo-35803(32): Document and test that ‘tempfile’ functions may
     accept a *note path-like object: 5a1. for the ‘dir’ argument.
     Patch by Anthony Sottile.

   - bpo-33944(33): Added a note about the intended use of code in .pth
     files.

   - bpo-34293(34): Fix the Doc/Makefile regarding PAPER environment
     variable and PDF builds

   - bpo-25237(35): Add documentation for tkinter modules

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21767

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38816

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38351

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38778

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38592

   (6) https://bugs.python.org/issue?@action=redirect&bpo=38294

   (7) https://bugs.python.org/issue?@action=redirect&bpo=38053

   (8) https://bugs.python.org/issue?@action=redirect&bpo=26868

   (9) https://bugs.python.org/issue?@action=redirect&bpo=36797

   (10) https://bugs.python.org/issue?@action=redirect&bpo=37977

   (11) https://bugs.python.org/issue?@action=redirect&bpo=37979

   (12) https://bugs.python.org/issue?@action=redirect&bpo=12707

   (13) https://bugs.python.org/issue?@action=redirect&bpo=37937

   (14) https://bugs.python.org/issue?@action=redirect&bpo=37878

   (15) https://bugs.python.org/issue?@action=redirect&bpo=37759

   (16) https://bugs.python.org/issue?@action=redirect&bpo=37726

   (17) https://bugs.python.org/issue?@action=redirect&bpo=32910

   (18) https://bugs.python.org/issue?@action=redirect&bpo=37256

   (19) https://bugs.python.org/issue?@action=redirect&bpo=37284

   (20) https://bugs.python.org/issue?@action=redirect&bpo=30088

   (21) https://bugs.python.org/issue?@action=redirect&bpo=37521

   (22) https://bugs.python.org/issue?@action=redirect&bpo=37456

   (23) https://bugs.python.org/issue?@action=redirect&bpo=37487

   (24) https://bugs.python.org/issue?@action=redirect&bpo=37149

   (25) https://bugs.python.org/issue?@action=redirect&bpo=37478

   (26) https://bugs.python.org/issue?@action=redirect&bpo=34903

   (27) https://bugs.python.org/issue?@action=redirect&bpo=36260

   (28) https://bugs.python.org/issue?@action=redirect&bpo=37004

   (29) https://bugs.python.org/issue?@action=redirect&bpo=36960

   (30) https://bugs.python.org/issue?@action=redirect&bpo=36487

   (31) https://bugs.python.org/issue?@action=redirect&bpo=23460

   (32) https://bugs.python.org/issue?@action=redirect&bpo=35803

   (33) https://bugs.python.org/issue?@action=redirect&bpo=33944

   (34) https://bugs.python.org/issue?@action=redirect&bpo=34293

   (35) https://bugs.python.org/issue?@action=redirect&bpo=25237


File: python.info,  Node: テスト<49>,  Next: ビルド<57>,  Prev: ドキュメント<51>,  Up: Python 3 9 0 alpha 1

1.24.57.5 テスト
................

   - bpo-38614(1): Fix test_communicate() of
     test_asyncio.test_subprocess: use ‘support.LONG_TIMEOUT’ (5
     minutes), instead of just 1 minute.

   - bpo-38614(2): Add timeout constants to *note test.support: ea.:
     *note LOOPBACK_TIMEOUT: 1d9c, *note INTERNET_TIMEOUT: 1d9d, *note
     SHORT_TIMEOUT: 1c63. and *note LONG_TIMEOUT: 1d9e.

   - bpo-38502(3): test.regrtest now uses process groups in the
     multiprocessing mode (-jN command line option) if process groups
     are available: if *note os.setsid(): 1dba. and *note os.killpg():
     1dbb. functions are available.

   - bpo-35998(4): Fix a race condition in
     test_asyncio.test_start_tls_server_1().  Previously, there was a
     race condition between the test main() function which replaces the
     protocol and the test ServerProto protocol which sends ANSWER once
     it gets HELLO. Now, only the test main() function is responsible to
     send data, ServerProto no longer sends data.

   - bpo-38470(5): Fix ‘test_compileall.test_compile_dir_maxlevels()’ on
     Windows without long path support: only create 3 subdirectories
     instead of between 20 and 100 subdirectories.

   - bpo-37531(6): On timeout, regrtest no longer attempts to call
     ‘popen.communicate()’ again: it can hang until all child processes
     using stdout and stderr pipes completes.  Kill the worker process
     and ignores its output.  Change also the faulthandler timeout of
     the main process from 1 minute to 5 minutes, for Python slowest
     buildbots.

   - bpo-38239(7): Fix test_gdb for Link Time Optimization (LTO) builds.

   - bpo-38275(8): test_ssl now handles disabled TLS/SSL versions
     better.  OpenSSL's crypto policy and run-time settings are
     recognized and tests for disabled versions are skipped.  Tests also
     accept more TLS minimum_versions for platforms that override
     OpenSSL's default with strict settings.

   - bpo-38271(9): The private keys for test_ssl were encrypted with
     3DES in traditional PKCS#5 format.  3DES and the digest algorithm
     of PKCS#5 are blocked by some strict crypto policies.  Use PKCS#8
     format with AES256 encryption instead.

   - bpo-38270(10): test.support now has a helper function to check for
     availability of a hash digest function.  Several tests are
     refactored avoid MD5 and use SHA256 instead.  Other tests are
     marked to use MD5 and skipped when MD5 is disabled.

   - bpo-37123(11): Multiprocessing test test_mymanager() now also
     expects -SIGTERM, not only exitcode 0.
     BaseManager._finalize_manager() sends SIGTERM to the manager
     process if it takes longer than 1 second to stop, which happens on
     slow buildbots.

   - bpo-38212(12): Multiprocessing tests: increase
     test_queue_feeder_donot_stop_onexc() timeout from 1 to 60 seconds.

   - bpo-38117(13): Test with OpenSSL 1.1.1d

   - bpo-38018(14): Increase code coverage for
     multiprocessing.shared_memory.

   - bpo-37805(15): Add tests for json.dump(..., skipkeys=True).  Patch
     by Donghee Na.

   - bpo-37531(16): Enhance regrtest multiprocess timeout: write a
     message when killing a worker process, catch popen.kill() and
     popen.wait() exceptions, put a timeout on the second call to
     popen.communicate().

   - bpo-37876(17): Add tests for ROT-13 codec.

   - bpo-36833(18): Added tests for ‘PyDateTime_XXX_GET_XXX()’ macros of
     the C API of the *note datetime: 34. module.  Patch by Joannah
     Nanjekye.

   - bpo-37558(19): Fix
     test_shared_memory_cleaned_after_process_termination name handling

   - bpo-37526(20): Add ‘test.support.catch_threading_exception()’:
     context manager catching *note threading.Thread: 176. exception
     using *note threading.excepthook(): a4b.

   - bpo-37421(21): test_concurrent_futures now explicitly stops the
     ForkServer instance if it's running.

   - bpo-37421(22): multiprocessing tests now stop the ForkServer
     instance if it's running: close the "alive" file descriptor to ask
     the server to stop and then remove its UNIX address.

   - bpo-37421(23): test_distutils.test_build_ext() is now able to
     remove the temporary directory on Windows: don't import the newly
     built C extension ("xx") in the current process, but test it in a
     separated process.

   - bpo-37421(24): test_concurrent_futures now cleans up
     multiprocessing to remove immediately temporary directories created
     by multiprocessing.util.get_temp_dir().

   - bpo-37421(25): test_winconsoleio doesn't leak a temporary file
     anymore: use tempfile.TemporaryFile() to remove it when the test
     completes.

   - bpo-37421(26): multiprocessing tests now explicitly call
     ‘_run_finalizers()’ to immediately remove temporary directories
     created by tests.

   - bpo-37421(27): urllib.request tests now call *note urlcleanup():
     1dbc. to remove temporary files created by ‘urlretrieve()’ tests
     and to clear the ‘_opener’ global variable set by ‘urlopen()’ and
     functions calling indirectly ‘urlopen()’.

   - bpo-37472(28): Remove ‘Lib/test/outstanding_bugs.py’.

   - bpo-37199(29): Fix test failures when IPv6 is unavailable or
     disabled.

   - bpo-19696(30): Replace deprecated method "random.choose" with
     "random.choice" in "test_pkg_import.py".

   - bpo-37335(31): Remove no longer necessary code from c locale
     coercion tests

   - bpo-37421(32): Fix test_shutil to no longer leak temporary files.

   - bpo-37411(33): Fix test_wsgiref.testEnviron() to no longer depend
     on the environment variables (don't fail if "X" variable is set).

   - bpo-37400(34): Fix test_os.test_chown(): use os.getgroups() rather
     than grp.getgrall() to get groups.  Rename also the test to
     test_chown_gid().

   - bpo-37359(35): Add -cleanup option to python3 -m test to remove
     ‘test_python_*’ directories of previous failed jobs.  Add "make
     cleantest" to run ‘python3 -m test --cleanup’.

   - bpo-37362(36): test_gdb no longer fails if it gets an "unexpected"
     message on stderr: it now ignores stderr.  The purpose of test_gdb
     is to test that python-gdb.py commands work as expected, not to
     test gdb.

   - bpo-35998(37): Avoid TimeoutError in test_asyncio:
     test_start_tls_server_1()

   - bpo-37278(38): Fix test_asyncio ProactorLoopCtrlC: join the thread
     to prevent leaking a running thread and leaking a reference.

   - bpo-37261(39): Fix *note test.support.catch_unraisable_exception():
     1dbd.: its __exit__() method now ignores unraisable exception
     raised when clearing its ‘unraisable’ attribute.

   - bpo-37069(40): regrtest now uses *note sys.unraisablehook(): 507.
     to mark a test as "environment altered" (ENV_CHANGED) if it emits
     an "unraisable exception".  Moreover, regrtest logs a warning in
     this case.

     Use ‘python3 -m test --fail-env-changed’ to catch unraisable
     exceptions in tests.

   - bpo-37252(41): Fix assertions in ‘test_close’ and
     ‘test_events_mask_overflow’ devpoll tests.

   - bpo-37169(42): Rewrite ‘_PyObject_IsFreed()’ unit tests.

   - bpo-37153(43): ‘test_venv.test_multiprocessing()’ now explicitly
     calls ‘pool.terminate()’ to wait until the pool completes.

   - bpo-34001(44): Make test_ssl pass with LibreSSL. LibreSSL handles
     minimum and maximum TLS version differently than OpenSSL.

   - bpo-36919(45): Make ‘test_source_encoding.test_issue2301’
     implementation independent.  The test will work now for both
     CPython and IronPython.

   - bpo-30202(46): Update ‘test.test_importlib.test_abc’ to test
     ‘find_spec()’.

   - bpo-28009(47): Modify the test_uuid logic to test when a program is
     available AND can be used to obtain a MACADDR as basis for an UUID.
     Patch by M. Felt

   - bpo-34596(48): Fallback to a default reason when *note
     unittest.skip(): 1dbe. is uncalled.  Patch by Naitree Zhu.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38614

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38614

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38502

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35998

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38470

   (6) https://bugs.python.org/issue?@action=redirect&bpo=37531

   (7) https://bugs.python.org/issue?@action=redirect&bpo=38239

   (8) https://bugs.python.org/issue?@action=redirect&bpo=38275

   (9) https://bugs.python.org/issue?@action=redirect&bpo=38271

   (10) https://bugs.python.org/issue?@action=redirect&bpo=38270

   (11) https://bugs.python.org/issue?@action=redirect&bpo=37123

   (12) https://bugs.python.org/issue?@action=redirect&bpo=38212

   (13) https://bugs.python.org/issue?@action=redirect&bpo=38117

   (14) https://bugs.python.org/issue?@action=redirect&bpo=38018

   (15) https://bugs.python.org/issue?@action=redirect&bpo=37805

   (16) https://bugs.python.org/issue?@action=redirect&bpo=37531

   (17) https://bugs.python.org/issue?@action=redirect&bpo=37876

   (18) https://bugs.python.org/issue?@action=redirect&bpo=36833

   (19) https://bugs.python.org/issue?@action=redirect&bpo=37558

   (20) https://bugs.python.org/issue?@action=redirect&bpo=37526

   (21) https://bugs.python.org/issue?@action=redirect&bpo=37421

   (22) https://bugs.python.org/issue?@action=redirect&bpo=37421

   (23) https://bugs.python.org/issue?@action=redirect&bpo=37421

   (24) https://bugs.python.org/issue?@action=redirect&bpo=37421

   (25) https://bugs.python.org/issue?@action=redirect&bpo=37421

   (26) https://bugs.python.org/issue?@action=redirect&bpo=37421

   (27) https://bugs.python.org/issue?@action=redirect&bpo=37421

   (28) https://bugs.python.org/issue?@action=redirect&bpo=37472

   (29) https://bugs.python.org/issue?@action=redirect&bpo=37199

   (30) https://bugs.python.org/issue?@action=redirect&bpo=19696

   (31) https://bugs.python.org/issue?@action=redirect&bpo=37335

   (32) https://bugs.python.org/issue?@action=redirect&bpo=37421

   (33) https://bugs.python.org/issue?@action=redirect&bpo=37411

   (34) https://bugs.python.org/issue?@action=redirect&bpo=37400

   (35) https://bugs.python.org/issue?@action=redirect&bpo=37359

   (36) https://bugs.python.org/issue?@action=redirect&bpo=37362

   (37) https://bugs.python.org/issue?@action=redirect&bpo=35998

   (38) https://bugs.python.org/issue?@action=redirect&bpo=37278

   (39) https://bugs.python.org/issue?@action=redirect&bpo=37261

   (40) https://bugs.python.org/issue?@action=redirect&bpo=37069

   (41) https://bugs.python.org/issue?@action=redirect&bpo=37252

   (42) https://bugs.python.org/issue?@action=redirect&bpo=37169

   (43) https://bugs.python.org/issue?@action=redirect&bpo=37153

   (44) https://bugs.python.org/issue?@action=redirect&bpo=34001

   (45) https://bugs.python.org/issue?@action=redirect&bpo=36919

   (46) https://bugs.python.org/issue?@action=redirect&bpo=30202

   (47) https://bugs.python.org/issue?@action=redirect&bpo=28009

   (48) https://bugs.python.org/issue?@action=redirect&bpo=34596


File: python.info,  Node: ビルド<57>,  Next: Windows<50>,  Prev: テスト<49>,  Up: Python 3 9 0 alpha 1

1.24.57.6 ビルド
................

   - bpo-38809(1): On Windows, build scripts will now recognize and use
     python.exe from an active virtual env.

   - bpo-38684(2): Fix _hashlib build when Blake2 is disabled, but
     OpenSSL supports it.

   - bpo-38468(3): Misc/python-config.in now uses ‘getvar()’ for all
     still existing ‘sysconfig.get_config_var()’ calls.  Patch by
     Joannah Nanjekye.

   - bpo-37415(4): Fix stdatomic.h header check for ICC compiler: the
     ICC implementation lacks atomic_uintptr_t type which is needed by
     Python.

   - bpo-38301(5): In Solaris family, we must be sure to use
     ‘-D_REENTRANT’.  Patch by Jesús Cea Avión.

   - bpo-36002(6): Locate ‘llvm-profdata’ and ‘llvm-ar’ binaries using
     ‘AC_PATH_TOOL’ rather than ‘AC_PATH_TARGET_TOOL’.

   - bpo-37936(7): The ‘.gitignore’ file systematically keeps "rooted",
     with a non-trailing slash, all the rules that are meant to apply to
     files in a specific place in the repo.  Previously, when the
     intended file to ignore happened to be at the root of the repo,
     we'd most often accidentally also ignore files and directories with
     the same name anywhere in the tree.

   - bpo-37760(8): The ‘Tools/unicode/makeunicodedata.py’ script, which
     is used for converting information from the Unicode Character
     Database into generated code and data used by the methods of *note
     str: 169. and by the *note unicodedata: 10b. module, now handles
     each character's data as a ‘dataclass’ with named attributes,
     rather than a length-18 list of different fields.

   - bpo-37936(9): The ‘.gitignore’ file no longer applies to any files
     that are in fact tracked in the Git repository.  Patch by Greg
     Price.

   - bpo-37725(10): Change "clean" makefile target to also clean the
     program guided optimization (PGO) data.  Previously you would have
     to use "make clean" and "make profile-removal", or "make clobber".

   - bpo-37707(11): Mark some individual tests to skip when -pgo is
     used.  The tests marked increase the PGO task time significantly
     and likely don't help improve optimization of the final executable.

   - bpo-36044(12): Reduce the number of unit tests run for the PGO
     generation task.  This speeds up the task by a factor of about 15x.
     Running the full unit test suite is slow.  This change may result
     in a slightly less optimized build since not as many code branches
     will be executed.  If you are willing to wait for the much slower
     build, the old behavior can be restored using './configure [..]
     PROFILE_TASK="-m test -pgo-extended"'.  We make no guarantees as to
     which PGO task set produces a faster build.  Users who care should
     run their own relevant benchmarks as results can depend on the
     environment, workload, and compiler tool chain.

   - bpo-37468(13): ‘make install’ no longer installs ‘wininst-*.exe’
     files used by distutils bdist_wininst: bdist_wininst only works on
     Windows.

   - bpo-37189(14): Many ‘PyRun_XXX()’ functions like *note
     PyRun_String(): 1dc0. were no longer exported in ‘libpython38.dll’
     by mistake.  Export them again to fix the ABI compatibility.

   - bpo-25361(15): Enables use of SSE2 instructions in Windows 32-bit
     build.

   - bpo-36210(16): Update optional extension module detection for AIX.
     ossaudiodev and spwd are not applicable for AIX, and are no longer
     reported as missing.  3rd-party packaging of ncurses (with ASIS
     support) conflicts with officially supported AIX curses library, so
     configure AIX to use libcurses.a.  However, skip trying to build
     _curses_panel.

     patch by M Felt

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38809

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38684

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38468

   (4) https://bugs.python.org/issue?@action=redirect&bpo=37415

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38301

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36002

   (7) https://bugs.python.org/issue?@action=redirect&bpo=37936

   (8) https://bugs.python.org/issue?@action=redirect&bpo=37760

   (9) https://bugs.python.org/issue?@action=redirect&bpo=37936

   (10) https://bugs.python.org/issue?@action=redirect&bpo=37725

   (11) https://bugs.python.org/issue?@action=redirect&bpo=37707

   (12) https://bugs.python.org/issue?@action=redirect&bpo=36044

   (13) https://bugs.python.org/issue?@action=redirect&bpo=37468

   (14) https://bugs.python.org/issue?@action=redirect&bpo=37189

   (15) https://bugs.python.org/issue?@action=redirect&bpo=25361

   (16) https://bugs.python.org/issue?@action=redirect&bpo=36210


File: python.info,  Node: Windows<50>,  Next: macOS<39>,  Prev: ビルド<57>,  Up: Python 3 9 0 alpha 1

1.24.57.7 Windows
.................

   - bpo-38589(1): Fixes HTML Help shortcut when Windows is not
     installed to C drive

   - bpo-38453(2): Ensure ntpath.realpath() correctly resolves relative
     paths.

   - bpo-38519(3): Restores the internal C headers that were missing
     from the nuget.org and Microsoft Store packages.

   - bpo-38492(4): Remove ‘pythonw.exe’ dependency on the Microsoft C++
     runtime.

   - bpo-38344(5): Fix error message in activate.bat

   - bpo-38359(6): Ensures ‘pyw.exe’ launcher reads correct registry
     key.

   - bpo-38355(7): Fixes ‘ntpath.realpath’ failing on ‘sys.executable’.

   - bpo-38117(8): Update bundled OpenSSL to 1.1.1d

   - bpo-38092(9): Reduce overhead when using multiprocessing in a
     Windows virtual environment.

   - bpo-38133(10): Allow py.exe launcher to locate installations from
     the Microsoft Store and improve display of active virtual
     environments.

   - bpo-38114(11): The ‘pip.ini’ is no longer included in the Nuget
     package.

   - bpo-32592(12): Set Windows 8 as the minimum required version for
     API support

   - bpo-36634(13): *note os.cpu_count(): 4db. now returns active
     processors rather than maximum processors.

   - bpo-36634(14): venv activate.bat now works when the existing
     variables contain double quote characters.

   - bpo-38081(15): Prevent error calling *note os.path.realpath(): 262.
     on ‘'NUL'’.

   - bpo-38087(16): Fix case sensitivity in test_pathlib and
     test_ntpath.

   - bpo-38088(17): Fixes distutils not finding vcruntime140.dll with
     only the v142 toolset installed.

   - bpo-37283(18): Ensure command-line and unattend.xml setting
     override previously detected states in Windows installer.

   - bpo-38030(19): Fixes *note os.stat(): 26d. failing for block
     devices on Windows

   - bpo-38020(20): Fixes potential crash when calling *note
     os.readlink(): b1a. (or indirectly through *note realpath(): 262.)
     on a file that is not a supported link.

   - bpo-37705(21): Improve the implementation of ‘winerror_to_errno()’.

   - bpo-37549(22): *note os.dup(): 1dc2. no longer fails for standard
     streams on Windows 7.

   - bpo-1311(23): The ‘nul’ file on Windows now returns True from *note
     exists(): c03. and a valid result from *note os.stat(): 26d. with
     ‘S_IFCHR’ set.

   - bpo-9949(24): Enable support for following symlinks in
     ‘os.realpath()’.

   - bpo-37834(25): Treat all name surrogate reparse points on Windows
     in *note os.lstat(): 6c8. and other reparse points as regular files
     in *note os.stat(): 26d.

   - bpo-36266(26): Add the module name in the formatted error message
     when DLL load fail happens during module import in
     ‘_PyImport_FindSharedFuncptrWindows()’.  Patch by Srinivas
     Nyayapati.

   - bpo-25172(27): Trying to import the ‘crypt’ module on Windows will
     result in an *note ImportError: 65b. with a message explaining that
     the module isn't supported on Windows.  On other platforms, if the
     underlying ‘_crypt’ module is not available, the ImportError will
     include a message explaining the problem.

   - bpo-37778(28): Fixes the icons used for file associations to the
     Microsoft Store package.

   - bpo-37734(29): Fix use of registry values to launch Python from
     Microsoft Store app.

   - bpo-37702(30): Fix memory leak on Windows in creating an SSLContext
     object or running ‘urllib.request.urlopen('https://...')’.

   - bpo-37672(31): Switch Windows Store package's pip to use bundled
     ‘pip.ini’ instead of ‘PIP_USER’ variable.

   - bpo-10945(32): Officially drop support for creating bdist_wininst
     installers on non-Windows systems.

   - bpo-37445(33): Include the ‘FORMAT_MESSAGE_IGNORE_INSERTS’ flag in
     ‘FormatMessageW()’ calls.

   - bpo-37369(34): Fixes path for *note sys.executable: 3ed. when
     running from the Microsoft Store.

   - bpo-37380(35): Don't collect unfinished processes with
     ‘subprocess._active’ on Windows to cleanup later.  Patch by Ruslan
     Kuprieiev.

   - bpo-37351(36): Removes libpython38.a from standard Windows
     distribution.

   - bpo-35360(37): Update Windows builds to use SQLite 3.28.0.

   - bpo-37267(38): On Windows, *note os.dup(): 1dc2. no longer creates
     an inheritable fd when handling a character file.

   - bpo-36779(39): Ensure ‘time.tzname’ is correct on Windows when the
     active code page is set to CP_UTF7 or CP_UTF8.

   - bpo-32587(40): Make *note winreg.REG_MULTI_SZ: 1dc3. support
     zero-length strings.

   - bpo-28269(41): Replace use of ‘strcasecmp()’ for the system
     function ‘_stricmp()’.  Patch by Minmin Gong.

   - bpo-36590(42): Add native Bluetooth RFCOMM support to socket
     module.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38589

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38453

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38519

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38492

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38344

   (6) https://bugs.python.org/issue?@action=redirect&bpo=38359

   (7) https://bugs.python.org/issue?@action=redirect&bpo=38355

   (8) https://bugs.python.org/issue?@action=redirect&bpo=38117

   (9) https://bugs.python.org/issue?@action=redirect&bpo=38092

   (10) https://bugs.python.org/issue?@action=redirect&bpo=38133

   (11) https://bugs.python.org/issue?@action=redirect&bpo=38114

   (12) https://bugs.python.org/issue?@action=redirect&bpo=32592

   (13) https://bugs.python.org/issue?@action=redirect&bpo=36634

   (14) https://bugs.python.org/issue?@action=redirect&bpo=36634

   (15) https://bugs.python.org/issue?@action=redirect&bpo=38081

   (16) https://bugs.python.org/issue?@action=redirect&bpo=38087

   (17) https://bugs.python.org/issue?@action=redirect&bpo=38088

   (18) https://bugs.python.org/issue?@action=redirect&bpo=37283

   (19) https://bugs.python.org/issue?@action=redirect&bpo=38030

   (20) https://bugs.python.org/issue?@action=redirect&bpo=38020

   (21) https://bugs.python.org/issue?@action=redirect&bpo=37705

   (22) https://bugs.python.org/issue?@action=redirect&bpo=37549

   (23) https://bugs.python.org/issue?@action=redirect&bpo=1311

   (24) https://bugs.python.org/issue?@action=redirect&bpo=9949

   (25) https://bugs.python.org/issue?@action=redirect&bpo=37834

   (26) https://bugs.python.org/issue?@action=redirect&bpo=36266

   (27) https://bugs.python.org/issue?@action=redirect&bpo=25172

   (28) https://bugs.python.org/issue?@action=redirect&bpo=37778

   (29) https://bugs.python.org/issue?@action=redirect&bpo=37734

   (30) https://bugs.python.org/issue?@action=redirect&bpo=37702

   (31) https://bugs.python.org/issue?@action=redirect&bpo=37672

   (32) https://bugs.python.org/issue?@action=redirect&bpo=10945

   (33) https://bugs.python.org/issue?@action=redirect&bpo=37445

   (34) https://bugs.python.org/issue?@action=redirect&bpo=37369

   (35) https://bugs.python.org/issue?@action=redirect&bpo=37380

   (36) https://bugs.python.org/issue?@action=redirect&bpo=37351

   (37) https://bugs.python.org/issue?@action=redirect&bpo=35360

   (38) https://bugs.python.org/issue?@action=redirect&bpo=37267

   (39) https://bugs.python.org/issue?@action=redirect&bpo=36779

   (40) https://bugs.python.org/issue?@action=redirect&bpo=32587

   (41) https://bugs.python.org/issue?@action=redirect&bpo=28269

   (42) https://bugs.python.org/issue?@action=redirect&bpo=36590


File: python.info,  Node: macOS<39>,  Next: IDLE<32>,  Prev: Windows<50>,  Up: Python 3 9 0 alpha 1

1.24.57.8 macOS
...............

   - bpo-38117(1): Updated OpenSSL to 1.1.1d in macOS installer.

   - bpo-38089(2): Move Azure Pipelines to latest VM versions and make
     macOS tests optional

   - bpo-18049(3): Increase the default stack size of threads from 5MB
     to 16MB on macOS, to match the stack size of the main thread.  This
     avoids crashes on deep recursion in threads.

   - bpo-34602(4): Avoid test suite failures on macOS by no longer
     calling resource.setrlimit to increase the process stack size limit
     at runtime.  The runtime change is no longer needed since the
     interpreter is being built with a larger default stack size.

   - bpo-35360(5): Update macOS installer to use SQLite 3.28.0.

   - bpo-34631(6): Updated OpenSSL to 1.1.1c in macOS installer.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38117

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38089

   (3) https://bugs.python.org/issue?@action=redirect&bpo=18049

   (4) https://bugs.python.org/issue?@action=redirect&bpo=34602

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35360

   (6) https://bugs.python.org/issue?@action=redirect&bpo=34631


File: python.info,  Node: IDLE<32>,  Next: Tools/Demos<33>,  Prev: macOS<39>,  Up: Python 3 9 0 alpha 1

1.24.57.9 IDLE
..............

   - bpo-26353(1): Stop adding newline when saving an IDLE shell window.

   - bpo-4630(2): Add an option to toggle IDLE's cursor blink for shell,
     editor, and output windows.  See Settings, General, Window
     Preferences, Cursor Blink.  Patch by Zackery Spytz.

   - bpo-38598(3): Do not try to compile IDLE shell or output windows

   - bpo-36698(4): IDLE no longer fails when write non-encodable
     characters to stderr.  It now escapes them with a backslash, as the
     regular Python interpreter.  Added the ‘errors’ field to the
     standard streams.

   - bpo-35379(5): When exiting IDLE, catch any AttributeError.  One
     happens when EditorWindow.close is called twice.  Printing a
     traceback, when IDLE is run from a terminal, is useless and
     annoying.

   - bpo-38183(6): To avoid problems, test_idle ignores the user config
     directory.  It no longer tries to create or access .idlerc or any
     files within.  Users must run IDLE to discover problems with saving
     settings.

   - bpo-38077(7): IDLE no longer adds 'argv' to the user namespace when
     initializing it.  This bug only affected 3.7.4 and 3.8.0b2 to
     3.8.0b4.

   - bpo-38041(8): Shell restart lines now fill the window width, always
     start with '=', and avoid wrapping unnecessarily.  The line will
     still wrap if the included file name is long relative to the width.

   - bpo-35771(9): To avoid occasional spurious test_idle failures on
     slower machines, increase the ‘hover_delay’ in test_tooltip.

   - bpo-37824(10): Properly handle user input warnings in IDLE shell.
     Cease turning SyntaxWarnings into SyntaxErrors.

   - bpo-37929(11): IDLE Settings dialog now closes properly when there
     is no shell window.

   - bpo-37902(12): Add mousewheel scrolling for IDLE module, path, and
     stack browsers.  Patch by George Zhang.

   - bpo-37849(13): Fixed completions list appearing too high or low
     when shown above the current line.

   - bpo-36419(14): Refactor IDLE autocomplete and improve testing.

   - bpo-37748(15): Reorder the Run menu.  Put the most common choice,
     Run Module, at the top.

   - bpo-37692(16): Improve highlight config sample with example shell
     interaction and better labels for shell elements.

   - bpo-37628(17): Settings dialog no longer expands with font size.

   - bpo-37627(18): Initialize the Customize Run dialog with the command
     line arguments most recently entered before.  The user can
     optionally edit before submitting them.

   - bpo-33610(19): Fix code context not showing the correct context
     when first toggled on.

   - bpo-37530(20): Optimize code context to reduce unneeded background
     activity.  Font and highlight changes now occur along with text
     changes instead of after a random delay.

   - bpo-27452(21): Cleanup ‘config.py’ by inlining ‘RemoveFile’ and
     simplifying the handling of ‘file’ in ‘CreateConfigHandlers’.

   - bpo-37325(22): Fix tab focus traversal order for help source and
     custom run dialogs.

   - bpo-37321(23): Both subprocess connection error messages now refer
     to the 'Startup failure' section of the IDLE doc.

   - bpo-17535(24): Add optional line numbers for IDLE editor windows.
     Windows open without line numbers unless set otherwise in the
     General tab of the configuration dialog.

   - bpo-26806(25): To compensate for stack frames added by IDLE and
     avoid possible problems with low recursion limits, add 30 to limits
     in the user code execution process.  Subtract 30 when reporting
     recursion limits to make this addition mostly transparent.

   - bpo-37177(26): Properly 'attach' search dialogs to their main
     window so that they behave like other dialogs and do not get hidden
     behind their main window.

   - bpo-37039(27): Adjust "Zoom Height" to individual screens by
     momentarily maximizing the window on first use with a particular
     screen.  Changing screen settings may invalidate the saved height.
     While a window is maximized, "Zoom Height" has no effect.

   - bpo-35763(28): Make calltip reminder about '/' meaning
     positional-only less obtrusive by only adding it when there is room
     on the first line.

   - bpo-5680(29): Add 'Run...  Customized' to the Run menu to run a
     module with customized settings.  Any 'command line arguments'
     entered are added to sys.argv.  One can suppress the normal Shell
     main module restart.

   - bpo-36390(30): Gather Format menu functions into format.py.
     Combine paragraph.py, rstrip.py, and format methods from editor.py.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26353

   (2) https://bugs.python.org/issue?@action=redirect&bpo=4630

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38598

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36698

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35379

   (6) https://bugs.python.org/issue?@action=redirect&bpo=38183

   (7) https://bugs.python.org/issue?@action=redirect&bpo=38077

   (8) https://bugs.python.org/issue?@action=redirect&bpo=38041

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35771

   (10) https://bugs.python.org/issue?@action=redirect&bpo=37824

   (11) https://bugs.python.org/issue?@action=redirect&bpo=37929

   (12) https://bugs.python.org/issue?@action=redirect&bpo=37902

   (13) https://bugs.python.org/issue?@action=redirect&bpo=37849

   (14) https://bugs.python.org/issue?@action=redirect&bpo=36419

   (15) https://bugs.python.org/issue?@action=redirect&bpo=37748

   (16) https://bugs.python.org/issue?@action=redirect&bpo=37692

   (17) https://bugs.python.org/issue?@action=redirect&bpo=37628

   (18) https://bugs.python.org/issue?@action=redirect&bpo=37627

   (19) https://bugs.python.org/issue?@action=redirect&bpo=33610

   (20) https://bugs.python.org/issue?@action=redirect&bpo=37530

   (21) https://bugs.python.org/issue?@action=redirect&bpo=27452

   (22) https://bugs.python.org/issue?@action=redirect&bpo=37325

   (23) https://bugs.python.org/issue?@action=redirect&bpo=37321

   (24) https://bugs.python.org/issue?@action=redirect&bpo=17535

   (25) https://bugs.python.org/issue?@action=redirect&bpo=26806

   (26) https://bugs.python.org/issue?@action=redirect&bpo=37177

   (27) https://bugs.python.org/issue?@action=redirect&bpo=37039

   (28) https://bugs.python.org/issue?@action=redirect&bpo=35763

   (29) https://bugs.python.org/issue?@action=redirect&bpo=5680

   (30) https://bugs.python.org/issue?@action=redirect&bpo=36390


File: python.info,  Node: Tools/Demos<33>,  Next: C API<52>,  Prev: IDLE<32>,  Up: Python 3 9 0 alpha 1

1.24.57.10 Tools/Demos
......................

   - bpo-38118(1): Update Valgrind suppression file to ignore a false
     alarm in *note PyUnicode_Decode(): 1dc7. when using GCC builtin
     strcmp().

   - bpo-38347(2): pathfix.py: Assume all files that end on '.py' are
     Python scripts when working recursively.

   - bpo-37803(3): pdb's ‘--help’ and ‘--version’ long options now work.

   - bpo-37942(4): Improve ArgumentClinic converter for floats.

   - bpo-37704(5): Remove ‘Tools/scripts/h2py.py’: use cffi to access a
     C API in Python.

   - bpo-37675(6): 2to3 now works when run from a zipped standard
     library.

   - bpo-37034(7): Argument Clinic now uses the argument name on errors
     with keyword-only argument instead of their position.  Patch
     contributed by Rémi Lapeyre.

   - bpo-37064(8): Add option -k to pathscript.py script: preserve
     shebang flags.  Add option -a to pathscript.py script: add flags.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=38118

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38347

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37803

   (4) https://bugs.python.org/issue?@action=redirect&bpo=37942

   (5) https://bugs.python.org/issue?@action=redirect&bpo=37704

   (6) https://bugs.python.org/issue?@action=redirect&bpo=37675

   (7) https://bugs.python.org/issue?@action=redirect&bpo=37034

   (8) https://bugs.python.org/issue?@action=redirect&bpo=37064


File: python.info,  Node: C API<52>,  Prev: Tools/Demos<33>,  Up: Python 3 9 0 alpha 1

1.24.57.11 C API
................

   - bpo-37633(1): Re-export some function compatibility wrappers for
     macros in ‘pythonrun.h’.

   - bpo-38644(2): Provide *note Py_EnterRecursiveCall(): 3d2. and *note
     Py_LeaveRecursiveCall(): b6b. as regular functions for the limited
     API. Previously, there were defined as macros, but these macros
     didn't work with the limited API which cannot access
     ‘PyThreadState.recursion_depth’ field.  Remove
     ‘_Py_CheckRecursionLimit’ from the stable ABI.

   - bpo-38650(3): The global variable *note
     PyStructSequence_UnnamedField: b79. is now a constant and refers to
     a constant string.

   - bpo-38540(4): Fixed possible leak in *note PyArg_Parse(): 180e. and
     similar functions for format units ‘"es#"’ and ‘"et#"’ when the
     macro ‘PY_SSIZE_T_CLEAN’ is not defined.

   - bpo-38395(5): Fix a crash in *note weakref.proxy: c46. objects due
     to incorrect lifetime management when calling some associated
     methods that may delete the last reference to object being
     referenced by the proxy.  Patch by Pablo Galindo.

   - bpo-36389(6): The ‘_PyObject_CheckConsistency()’ function is now
     also available in release mode.  For example, it can be used to
     debug a crash in the ‘visit_decref()’ function of the GC.

   - bpo-38266(7): Revert the removal of PyThreadState_DeleteCurrent()
     with documentation.

   - bpo-38303(8): Update audioop extension module to use the stable ABI
     (PEP-384).  Patch by Tyler Kieft.

   - bpo-38234(9): ‘Py_SetPath()’ now sets *note sys.executable: 3ed. to
     the program full path (*note Py_GetProgramFullPath(): 3ec.) rather
     than to the program name (*note Py_GetProgramName(): 3ee.).

   - bpo-38234(10): Python ignored arguments passed to ‘Py_SetPath()’,
     ‘Py_SetPythonHome()’ and ‘Py_SetProgramName()’: fix Python
     initialization to use specified arguments.

   - bpo-38205(11): The *note Py_UNREACHABLE(): dae. macro now calls
     *note Py_FatalError(): b7a.

   - bpo-38140(12): Make dict and weakref offsets opaque for C heap
     types by passing the offsets through PyMemberDef

   - bpo-15088(13): The C function ‘PyGen_NeedsFinalizing’ has been
     removed.  It was not documented, tested or used anywhere within
     CPython after the implementation of PEP 442(14).  Patch by Joannah
     Nanjekye.  (Patch by Joannah Nanjekye)

   - bpo-36763(15): Options added by ‘PySys_AddXOption()’ are now
     handled the same way than ‘PyConfig.xoptions’ and command line ‘-X’
     options.

   - bpo-37926(16): Fix a crash in ‘PySys_SetArgvEx(0, NULL, 0)’.

   - bpo-37879(17): Fix subtype_dealloc to suppress the type decref when
     the base type is a C heap type

   - bpo-37645(18): Add ‘_PyObject_FunctionStr()’ to get a user-friendly
     string representation of a function-like object.  Patch by Jeroen
     Demeyer.

   - bpo-29548(19): The functions ‘PyEval_CallObject’,
     ‘PyEval_CallFunction’, ‘PyEval_CallMethod’ and
     ‘PyEval_CallObjectWithKeywords’ are deprecated.  Use *note
     PyObject_Call(): 63d. and its variants instead.

   - bpo-37151(20): ‘PyCFunction_Call’ is now a deprecated alias of
     *note PyObject_Call(): 63d.

   - bpo-37540(21): The vectorcall protocol now requires that the caller
     passes only strings as keyword names.

   - bpo-37207(22): The vectorcall protocol is now enabled for ‘type’
     objects: set ‘tp_vectorcall’ to a vectorcall function to be used
     instead of ‘tp_new’ and ‘tp_init’ when calling the class itself.

   - bpo-21120(23): Exclude Python-ast.h, ast.h and asdl.h from the
     limited API.

   - bpo-37483(24): Add new function ‘_PyObject_CallOneArg’ for calling
     an object with one positional argument.

   - bpo-36763(25): Add *note PyConfig_SetWideStringList(): 1dc9.
     function.

   - bpo-37337(26): Add fast functions for calling methods:
     ‘_PyObject_VectorcallMethod()’, ‘_PyObject_CallMethodNoArgs()’ and
     ‘_PyObject_CallMethodOneArg()’.

   - bpo-28805(27): The *note METH_FASTCALL: 199e. calling convention
     has been documented.

   - bpo-37221(28): The new function ‘PyCode_NewWithPosOnlyArgs()’
     allows to create code objects like ‘PyCode_New()’, but with an
     extra 'posonlyargcount' parameter for indicating the number of
     positonal-only arguments.

   - bpo-37215(29): Fix dtrace issue introduce by bpo-36842(30)

   - bpo-37194(31): Add a new public *note PyObject_CallNoArgs(): 63c.
     function to the C API: call a callable Python object without any
     arguments.  It is the most efficient way to call a callback without
     any argument.  On x86-64, for example,
     ‘PyObject_CallFunctionObjArgs(func, NULL)’ allocates 960 bytes on
     the stack per call, whereas ‘PyObject_CallNoArgs(func)’ only
     allocates 624 bytes per call.

   - bpo-37170(32): Fix the cast on error in *note
     PyLong_AsUnsignedLongLongMask(): 1dca.

   - bpo-35381(33): Convert posixmodule.c statically allocated types
     ‘DirEntryType’ and ‘ScandirIteratorType’ to heap-allocated types.

   - bpo-34331(34): Use singular/plural noun in error message when
     instantiating an abstract class with non-overridden abstract
     method(s).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37633

   (2) https://bugs.python.org/issue?@action=redirect&bpo=38644

   (3) https://bugs.python.org/issue?@action=redirect&bpo=38650

   (4) https://bugs.python.org/issue?@action=redirect&bpo=38540

   (5) https://bugs.python.org/issue?@action=redirect&bpo=38395

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36389

   (7) https://bugs.python.org/issue?@action=redirect&bpo=38266

   (8) https://bugs.python.org/issue?@action=redirect&bpo=38303

   (9) https://bugs.python.org/issue?@action=redirect&bpo=38234

   (10) https://bugs.python.org/issue?@action=redirect&bpo=38234

   (11) https://bugs.python.org/issue?@action=redirect&bpo=38205

   (12) https://bugs.python.org/issue?@action=redirect&bpo=38140

   (13) https://bugs.python.org/issue?@action=redirect&bpo=15088

   (14) https://peps.python.org/pep-0442/

   (15) https://bugs.python.org/issue?@action=redirect&bpo=36763

   (16) https://bugs.python.org/issue?@action=redirect&bpo=37926

   (17) https://bugs.python.org/issue?@action=redirect&bpo=37879

   (18) https://bugs.python.org/issue?@action=redirect&bpo=37645

   (19) https://bugs.python.org/issue?@action=redirect&bpo=29548

   (20) https://bugs.python.org/issue?@action=redirect&bpo=37151

   (21) https://bugs.python.org/issue?@action=redirect&bpo=37540

   (22) https://bugs.python.org/issue?@action=redirect&bpo=37207

   (23) https://bugs.python.org/issue?@action=redirect&bpo=21120

   (24) https://bugs.python.org/issue?@action=redirect&bpo=37483

   (25) https://bugs.python.org/issue?@action=redirect&bpo=36763

   (26) https://bugs.python.org/issue?@action=redirect&bpo=37337

   (27) https://bugs.python.org/issue?@action=redirect&bpo=28805

   (28) https://bugs.python.org/issue?@action=redirect&bpo=37221

   (29) https://bugs.python.org/issue?@action=redirect&bpo=37215

   (30) https://bugs.python.org/issue?@action=redirect&bpo=36842

   (31) https://bugs.python.org/issue?@action=redirect&bpo=37194

   (32) https://bugs.python.org/issue?@action=redirect&bpo=37170

   (33) https://bugs.python.org/issue?@action=redirect&bpo=35381

   (34) https://bugs.python.org/issue?@action=redirect&bpo=34331


File: python.info,  Node: Python 3 8 0 beta 1,  Next: Python 3 8 0 alpha 4,  Prev: Python 3 9 0 alpha 1,  Up: 変更履歴

1.24.58 Python 3.8.0 beta 1
---------------------------

'Release date: 2019-06-04'

* Menu:

* セキュリティ: セキュリティ<43>.
* Core and Builtins: Core and Builtins<155>.
* ライブラリ: ライブラリ<158>.
* ドキュメント: ドキュメント<52>.
* テスト: テスト<50>.
* ビルド: ビルド<58>.
* Windows: Windows<51>.
* macOS: macOS<40>.
* IDLE: IDLE<33>.
* Tools/Demos: Tools/Demos<34>.
* C API: C API<53>.


File: python.info,  Node: セキュリティ<43>,  Next: Core and Builtins<155>,  Up: Python 3 8 0 beta 1

1.24.58.1 セキュリティ
......................

   - bpo-35907(1): CVE 2019-9948(2): Avoid file reading by disallowing
     ‘local-file://’ and ‘local_file://’ URL schemes in
     ‘URLopener().open()’ and ‘URLopener().retrieve()’ of *note
     urllib.request: 111.

   - bpo-33529(3): Prevent fold function used in email header encoding
     from entering infinite loop when there are too many non-ASCII
     characters in a header.

   - bpo-33164(4): Updated blake2 implementation which uses secure
     memset implementation provided by platform.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35907

   (2) https://www.cve.org/CVERecord?id=CVE-2019-9948

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33529

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33164


File: python.info,  Node: Core and Builtins<155>,  Next: ライブラリ<158>,  Prev: セキュリティ<43>,  Up: Python 3 8 0 beta 1

1.24.58.2 Core and Builtins
...........................

   - bpo-35814(1): Allow unpacking in the right hand side of annotated
     assignments.  In particular, ‘t: Tuple[int, ...] = x, y, *z’ is now
     allowed.

   - bpo-37126(2): All structseq objects are now tracked by the garbage
     collector.  Patch by Pablo Galindo.

   - bpo-37122(3): Make the 'co_argcount' attribute of code objects
     represent the total number of positional arguments (including
     positional-only arguments).  The value of 'co_posonlyargcount' can
     be used to distinguish which arguments are positional only, and the
     difference ('co_argcount' - 'co_posonlyargcount') is the number of
     positional-or-keyword arguments.  Patch by Pablo Galindo.

   - bpo-20092(4): Constructors of *note int: 19b, *note float: 196. and
     *note complex: 197. will now use the *note __index__(): 19e.
     special method, if available and the corresponding method *note
     __int__(): 19d, *note __float__(): bc1. or *note __complex__():
     7fd. is not available.

   - bpo-37087(5): Add native thread ID (TID) support to OpenBSD.

   - bpo-26219(6): Implemented per opcode cache mechanism and
     ‘LOAD_GLOBAL’ instruction use it.  ‘LOAD_GLOBAL’ is now about 40%
     faster.  Contributed by Yury Selivanov, and Inada Naoki.

   - bpo-37072(7): Fix crash in PyAST_FromNodeObject() when flags is
     NULL.

   - bpo-37029(8): Freeing a great many small objects could take time
     quadratic in the number of arenas, due to using linear search to
     keep ‘obmalloc.c’'s list of usable arenas sorted by order of number
     of free memory pools.  This is accomplished without search now,
     leaving the worst-case time linear in the number of arenas.  For
     programs where this quite visibly matters (typically with more than
     100 thousand small objects alive simultaneously), this can greatly
     reduce the time needed to release their memory.

   - bpo-26423(9): Fix possible overflow in ‘wrap_lenfunc()’ when
     ‘sizeof(long) < sizeof(Py_ssize_t)’ (e.g., 64-bit Windows).

   - bpo-37050(10): Improve the AST for "debug" f-strings, which use '='
     to print out the source of the expression being evaluated.  Delete
     expr_text from the FormattedValue node, and instead use a Constant
     string node (possibly merged with adjacent constant expressions
     inside the f-string).

   - bpo-22385(11): The ‘bytes.hex’, ‘bytearray.hex’, and
     ‘memoryview.hex’ methods as well as the ‘binascii.hexlify’ and
     ‘b2a_hex’ functions now have the ability to include an optional
     separator between hex bytes.  This functionality was inspired by
     MicroPython's hexlify implementation.

   - bpo-26836(12): Add *note os.memfd_create(): bfe.

   - bpo-37032(13): Added new ‘replace()’ method to the code type (*note
     types.CodeType: 32f.).

   - bpo-37007(14): Implement *note socket.if_nameindex(): c22, *note
     socket.if_nametoindex(): c23, and *note socket.if_indextoname():
     c24. on Windows.

   - bpo-36829(15): *note PyErr_WriteUnraisable(): 5f2. now creates a
     traceback object if there is no current traceback.  Moreover, call
     *note PyErr_NormalizeException(): 42a. and *note
     PyException_SetTraceback(): 1dce. to normalize the exception value.
     Ignore any error.

   - bpo-36878(16): Only accept text after ‘# type: ignore’ if the first
     character is ASCII. This is to disallow things like ‘# type:
     ignoreé’.

   - bpo-36878(17): Store text appearing after a ‘# type: ignore’
     comment in the AST. For example a type ignore like ‘# type:
     ignore[E1000]’ will have the string ‘"[E1000]"’ stored in its AST
     node.

   - bpo-2180(18): Treat line continuation at EOF as a ‘SyntaxError’ by
     Anthony Sottile.

   - bpo-36907(19): Fix a crash when calling a C function with a keyword
     dict (‘f(**kwargs)’) and changing the dict ‘kwargs’ while that
     function is running.

   - bpo-36946(20): Fix possible signed integer overflow when handling
     slices.

   - bpo-36826(21): Add NamedExpression kind support to ast_unparse.c

   - bpo-1875(22): A *note SyntaxError: 18e. is now raised if a code
     blocks that will be optimized away (e.g.  if conditions that are
     always false) contains syntax errors.  Patch by Pablo Galindo.

   - bpo-36027(23): Allow computation of modular inverses via
     three-argument ‘pow’: the second argument is now permitted to be
     negative in the case where the first and third arguments are
     relatively prime.

   - bpo-36861(24): Update the Unicode database to version 12.1.0.

   - bpo-28866(25): Avoid caching attributes of classes which type
     defines mro() to avoid a hard cache invalidation problem.

   - bpo-36851(26): The ‘FrameType’ stack is now correctly cleaned up if
     the execution ends with a return and the stack is not empty.

   - bpo-34616(27): The ‘compile()’ builtin functions now support the
     ‘ast.PyCF_ALLOW_TOP_LEVEL_AWAIT’ flag, which allow to compile
     sources that contains top-level ‘await’, ‘async with’ or ‘async
     for’.  This is useful to evaluate async-code from with an already
     async functions; for example in a custom REPL.

   - bpo-36842(28): Implement PEP 578, adding sys.audit, io.open_code
     and related APIs.

   - bpo-27639(29): Correct return type for UserList slicing operations.
     Patch by Michael Blahay, Erick Cervantes, and vaultah

   - bpo-36737(30): Move PyRuntimeState.warnings into per-interpreter
     state (via "module state").

   - bpo-36793(31): Removed ‘__str__’ implementations from builtin types
     *note bool: 3c3, *note int: 19b, *note float: 196, *note complex:
     197. and few classes from the standard library.  They now inherit
     ‘__str__()’ from *note object: c7e.

   - bpo-36817(32): Add a ‘=’ feature f-strings for debugging.  This can
     precede ‘!s’, ‘!r’, or ‘!a’.  It produces the text of the
     expression, followed by an equal sign, followed by the repr of the
     value of the expression.  So ‘f'{3*9+15=}'’ would be equal to the
     string ‘'3*9+15=42'’.  If ‘=’ is specified, the default conversion
     is set to ‘!r’, unless a format spec is given, in which case the
     formatting behavior is unchanged, and __format__ will be used.

   - bpo-24048(33): Save the live exception during import.c's
     ‘remove_module()’.

   - bpo-27987(34): pymalloc returns memory blocks aligned by 16 bytes,
     instead of 8 bytes, on 64-bit platforms to conform x86-64 ABI.
     Recent compilers assume this alignment more often.  Patch by Inada
     Naoki.

   - bpo-36601(35): A long-since-meaningless check for ‘getpid() ==
     main_pid’ was removed from Python's internal C signal handler.

   - bpo-36594(36): Fix incorrect use of ‘%p’ in format strings.  Patch
     by Zackery Spytz.

   - bpo-36045(37): ‘builtins.help()’ now prefixes ‘async’ for async
     functions.

   - bpo-36084(38): Add native thread ID (TID) to threading.Thread
     objects (supported platforms: Windows, FreeBSD, Linux, macOS)

   - bpo-36035(39): Added fix for broken symlinks in combination with
     pathlib

   - bpo-35983(40): Added new trashcan macros to deal with a double
     deallocation that could occur when the ‘tp_dealloc’ of a subclass
     calls the ‘tp_dealloc’ of a base class and that base class uses the
     trashcan mechanism.  Patch by Jeroen Demeyer.

   - bpo-20602(41): Do not clear *note sys.flags: 89c. and *note
     sys.float_info: 1dcf. during shutdown.  Patch by Zackery Spytz.

   - bpo-26826(42): Expose ‘copy_file_range()’ as a low level API in the
     *note os: a5. module.

   - bpo-32388(43): Remove cross-version binary compatibility
     requirement in tp_flags.

   - bpo-31862(44): Port binascii to PEP 489 multiphase initialization.
     Patch by Marcel Plch.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35814

   (2) https://bugs.python.org/issue?@action=redirect&bpo=37126

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37122

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20092

   (5) https://bugs.python.org/issue?@action=redirect&bpo=37087

   (6) https://bugs.python.org/issue?@action=redirect&bpo=26219

   (7) https://bugs.python.org/issue?@action=redirect&bpo=37072

   (8) https://bugs.python.org/issue?@action=redirect&bpo=37029

   (9) https://bugs.python.org/issue?@action=redirect&bpo=26423

   (10) https://bugs.python.org/issue?@action=redirect&bpo=37050

   (11) https://bugs.python.org/issue?@action=redirect&bpo=22385

   (12) https://bugs.python.org/issue?@action=redirect&bpo=26836

   (13) https://bugs.python.org/issue?@action=redirect&bpo=37032

   (14) https://bugs.python.org/issue?@action=redirect&bpo=37007

   (15) https://bugs.python.org/issue?@action=redirect&bpo=36829

   (16) https://bugs.python.org/issue?@action=redirect&bpo=36878

   (17) https://bugs.python.org/issue?@action=redirect&bpo=36878

   (18) https://bugs.python.org/issue?@action=redirect&bpo=2180

   (19) https://bugs.python.org/issue?@action=redirect&bpo=36907

   (20) https://bugs.python.org/issue?@action=redirect&bpo=36946

   (21) https://bugs.python.org/issue?@action=redirect&bpo=36826

   (22) https://bugs.python.org/issue?@action=redirect&bpo=1875

   (23) https://bugs.python.org/issue?@action=redirect&bpo=36027

   (24) https://bugs.python.org/issue?@action=redirect&bpo=36861

   (25) https://bugs.python.org/issue?@action=redirect&bpo=28866

   (26) https://bugs.python.org/issue?@action=redirect&bpo=36851

   (27) https://bugs.python.org/issue?@action=redirect&bpo=34616

   (28) https://bugs.python.org/issue?@action=redirect&bpo=36842

   (29) https://bugs.python.org/issue?@action=redirect&bpo=27639

   (30) https://bugs.python.org/issue?@action=redirect&bpo=36737

   (31) https://bugs.python.org/issue?@action=redirect&bpo=36793

   (32) https://bugs.python.org/issue?@action=redirect&bpo=36817

   (33) https://bugs.python.org/issue?@action=redirect&bpo=24048

   (34) https://bugs.python.org/issue?@action=redirect&bpo=27987

   (35) https://bugs.python.org/issue?@action=redirect&bpo=36601

   (36) https://bugs.python.org/issue?@action=redirect&bpo=36594

   (37) https://bugs.python.org/issue?@action=redirect&bpo=36045

   (38) https://bugs.python.org/issue?@action=redirect&bpo=36084

   (39) https://bugs.python.org/issue?@action=redirect&bpo=36035

   (40) https://bugs.python.org/issue?@action=redirect&bpo=35983

   (41) https://bugs.python.org/issue?@action=redirect&bpo=20602

   (42) https://bugs.python.org/issue?@action=redirect&bpo=26826

   (43) https://bugs.python.org/issue?@action=redirect&bpo=32388

   (44) https://bugs.python.org/issue?@action=redirect&bpo=31862


File: python.info,  Node: ライブラリ<158>,  Next: ドキュメント<52>,  Prev: Core and Builtins<155>,  Up: Python 3 8 0 beta 1

1.24.58.3 ライブラリ
....................

   - bpo-37128(1): Added *note math.perm(): 8e0.

   - bpo-37120(2): Add SSLContext.num_tickets to control the number of
     TLSv1.3 session tickets.

   - bpo-12202(3): Fix the error handling in
     ‘msilib.SummaryInformation.GetProperty()’.  Patch by Zackery Spytz.

   - bpo-26835(4): The fcntl module now contains file sealing constants
     for sealing of memfds.

   - bpo-29262(5): Add ‘get_origin()’ and ‘get_args()’ introspection
     helpers to ‘typing’ module.

   - bpo-12639(6): ‘msilib.Directory.start_component()’ no longer fails
     if 'keyfile' is not ‘None’.

   - bpo-36999(7): Add the ‘asyncio.Task.get_coro()’ method to publicly
     expose the tasks's coroutine object.

   - bpo-35246(8): Make *note asyncio.create_subprocess_exec(): c6b.
     accept path-like arguments.

   - bpo-35279(9): Change default 'max_workers' of ‘ThreadPoolExecutor’
     from ‘cpu_count() * 5’ to ‘min(32, cpu_count() + 4)’.  Previous
     value was unreasonably large on many cores machines.

   - bpo-37076(10): *note _thread.start_new_thread(): 4b4. now logs
     uncaught exception raised by the function using *note
     sys.unraisablehook(): 507, rather than *note sys.excepthook(): a0c,
     so the hook gets access to the function which raised the exception.

   - bpo-33725(11): On macOS, the *note multiprocessing: 98. module now
     uses 'spawn' start method by default.

   - bpo-37054(12): Fix destructor ‘_pyio.BytesIO’ and
     ‘_pyio.TextIOWrapper’: initialize their ‘_buffer’ attribute as soon
     as possible (in the class body), because it's used by ‘__del__()’
     which calls ‘close()’.

   - bpo-37058(13): PEP 544: Add ‘Protocol’ and ‘@runtime_checkable’ to
     the ‘typing’ module.

   - bpo-36933(14): The functions ‘sys.set_coroutine_wrapper’ and
     ‘sys.get_coroutine_wrapper’ that were deprecated and marked for
     removal in 3.8 have been removed.

   - bpo-37047(15): Handle late binding and attribute access in *note
     unittest.mock.AsyncMock: c3e. setup for autospeccing.  Document
     newly implemented async methods in *note unittest.mock.MagicMock:
     108f.

   - bpo-37049(16): PEP 589: Add ‘TypedDict’ to the ‘typing’ module.

   - bpo-37046(17): PEP 586: Add ‘Literal’ to the ‘typing’ module.

   - bpo-37045(18): PEP 591: Add ‘Final’ qualifier and ‘@final’
     decorator to the ‘typing’ module.

   - bpo-37035(19): Don't log OSError based exceptions if a fatal error
     has occurred in asyncio transport.  Peer can generate almost any
     OSError, user cannot avoid these exceptions by fixing own code.
     Errors are still propagated to user code, it's just logging them is
     pointless and pollute asyncio logs.

   - bpo-37001(20): *note symtable.symtable(): 1dd1. now accepts the
     same input types for source code as the built-in *note compile():
     4b1. function.  Patch by Dino Viehland.

   - bpo-37028(21): Implement asyncio REPL

   - bpo-37027(22): Return safe to use proxy socket object from
     transport.get_extra_info('socket')

   - bpo-32528(23): Make asyncio.CancelledError a BaseException.

     This will address the common mistake many asyncio users make: an
     "except Exception" clause breaking Tasks cancellation.

     In addition to this change, we stop inheriting asyncio.TimeoutError
     and asyncio.InvalidStateError from their concurrent.futures.*
     counterparts.  There's no point for these exceptions to share the
     inheritance chain.

   - bpo-1230540(24): Add a new *note threading.excepthook(): a4b.
     function which handles uncaught *note threading.Thread.run(): c31.
     exception.  It can be overridden to control how uncaught *note
     threading.Thread.run(): c31. exceptions are handled.

   - bpo-36996(25): Handle *note unittest.mock.patch(): 1092. used as a
     decorator on async functions.

   - bpo-37008(26): Add support for calling *note next(): 9d8. with the
     mock resulting from *note unittest.mock.mock_open(): 11e9.

   - bpo-27737(27): Allow whitespace only header encoding in
     ‘email.header’ - by Batuhan Taskaya

   - bpo-36969(28): PDB command ‘args’ now display positional only
     arguments.  Patch contributed by Rémi Lapeyre.

   - bpo-36969(29): PDB command ‘args’ now display keyword only
     arguments.  Patch contributed by Rémi Lapeyre.

   - bpo-36983(30): Add missing names to ‘typing.__all__’: ‘ChainMap’,
     ‘ForwardRef’, ‘OrderedDict’ - by Anthony Sottile.

   - bpo-36972(31): Add SupportsIndex protocol to the typing module to
     allow type checking to detect classes that can be passed to
     ‘hex()’, ‘oct()’ and ‘bin()’.

   - bpo-32972(32): Implement ‘unittest.IsolatedAsyncioTestCase’ to help
     testing asyncio-based code.

   - bpo-36952(33): *note fileinput.input(): a00. and *note
     fileinput.FileInput: 940. 'bufsize' argument has been removed (was
     deprecated and ignored since Python 3.6), and as a result the
     'mode' and 'openhook' arguments have been made keyword-only.

   - bpo-36952(34): Starting with Python 3.3, importing ABCs from *note
     collections: 1e. is deprecated, and import should be done from
     *note collections.abc: 1f.  Still being able to import from *note
     collections: 1e. was marked for removal in 3.8, but has been
     delayed to 3.9; documentation and ‘DeprecationWarning’ clarified.

   - bpo-36949(35): Implement __repr__ for WeakSet objects.

   - bpo-36948(36): Fix *note NameError: 452. in
     ‘urllib.request.URLopener.retrieve()’.  Patch by Karthikeyan
     Singaravelan.

   - bpo-33524(37): Fix the folding of email header when the
     max_line_length is 0 or None and the header contains non-ascii
     characters.  Contributed by Licht Takeuchi (@Licht-T).

   - bpo-24564(38): *note shutil.copystat(): 1346. now ignores *note
     errno.EINVAL: 1dd2. on *note os.setxattr(): 131f. which may occur
     when copying files on filesystems without extended attributes
     support.

     Original patch by Giampaolo Rodola, updated by Ying Wang.

   - bpo-36888(39): Python child processes can now access the status of
     their parent process using multiprocessing.process.parent_process

   - bpo-36921(40): Deprecate ‘@coroutine’ for sake of ‘async def’.

   - bpo-25652(41): Fix bug in ‘__rmod__’ of ‘UserString’ - by Batuhan
     Taskaya.

   - bpo-36916(42): Remove a message about an unhandled exception in a
     task when writer.write() is used without await and writer.drain()
     fails with an exception.

   - bpo-36889(43): Introduce ‘asyncio.Stream’ class that merges *note
     asyncio.StreamReader: 1c7d. and *note asyncio.StreamWriter: 1a70.
     functionality.  ‘asyncio.Stream’ can work in readonly, writeonly
     and readwrite modes.  Provide ‘asyncio.connect()’,
     ‘asyncio.connect_unix()’, ‘asyncio.connect_read_pipe()’ and
     ‘asyncio.connect_write_pipe()’ factories to open ‘asyncio.Stream’
     connections.  Provide ‘asyncio.StreamServer’ and ‘UnixStreamServer’
     to serve servers with asyncio.Stream API. Modify *note
     asyncio.create_subprocess_shell(): c6c. and *note
     asyncio.create_subprocess_exec(): c6b. to use ‘asyncio.Stream’
     instead of deprecated ‘StreamReader’ and ‘StreamWriter’.  Deprecate
     *note asyncio.StreamReader: 1c7d. and *note asyncio.StreamWriter:
     1a70.  Deprecate usage of private classes, e.g.
     ‘asyncio.FlowControlMixing’ and ‘asyncio.StreamReaderProtocol’
     outside of asyncio package.

   - bpo-36845(44): Added validation of integer prefixes to the
     construction of IP networks and interfaces in the ipaddress module.

   - bpo-23378(45): Add an extend action to argparser.

   - bpo-36867(46): Fix a bug making a SharedMemoryManager instance and
     its parent process use two separate resource_tracker processes.

   - bpo-23896(47): Adds a grammar to lib2to3.pygram that contains exec
     as a function not as statement.

   - bpo-36895(48): The function ‘time.clock()’ was deprecated in 3.3 in
     favor of ‘time.perf_counter()’ and marked for removal in 3.8, it
     has removed.

   - bpo-35545(49): Fix asyncio discarding IPv6 scopes when ensuring
     hostname resolutions internally

   - bpo-36887(50): Add new function *note math.isqrt(): bf8. to compute
     integer square roots.

   - bpo-34632(51): Introduce the ‘importlib.metadata’ module with
     (provisional) support for reading metadata from third-party
     packages.

   - bpo-36878(52): When using ‘type_comments=True’ in ‘ast.parse’,
     treat ‘# type: ignore’ followed by a non-alphanumeric character and
     then arbitrary text as a type ignore, instead of requiring nothing
     but whitespace or another comment.  This is to permit formations
     such as ‘# type: ignore[E1000]’.

   - bpo-36778(53): ‘cp65001’ encoding (Windows code page 65001) becomes
     an alias to ‘utf_8’ encoding.

   - bpo-36867(54): The multiprocessing.resource_tracker replaces the
     multiprocessing.semaphore_tracker module.  Other than semaphores,
     resource_tracker also tracks shared_memory segments.

   - bpo-30262(55): The ‘Cache’ and ‘Statement’ objects of the *note
     sqlite3: d4. module are not exposed to the user.  Patch by Aviv
     Palivoda.

   - bpo-24538(56): In ‘shutil.copystat()’, first copy extended file
     attributes and then file permissions, since extended attributes can
     only be set on the destination while it is still writeable.

   - bpo-36829(57): Add new *note sys.unraisablehook(): 507. function
     which can be overridden to control how "unraisable exceptions" are
     handled.  It is called when an exception has occurred but there is
     no way for Python to handle it.  For example, when a destructor
     raises an exception or during garbage collection (*note
     gc.collect(): 1b3.).

   - bpo-36832(58): Introducing ‘zipfile.Path’, a pathlib-compatible
     wrapper for traversing zip files.

   - bpo-36814(59): Fix an issue where os.posix_spawnp() would
     incorrectly raise a TypeError when file_actions is None.

   - bpo-33110(60): Handle exceptions raised by functions added by
     concurrent.futures add_done_callback correctly when the Future has
     already completed.

   - bpo-26903(61): Limit ‘max_workers’ in ‘ProcessPoolExecutor’ to 61
     to work around a WaitForMultipleObjects limitation.

   - bpo-36813(62): Fix *note QueueListener: 242. to call
     ‘queue.task_done()’ upon stopping.  Patch by Bar Harel.

   - bpo-36806(63): Forbid creation of asyncio stream objects like
     StreamReader, StreamWriter, Process, and their protocols outside of
     asyncio package.

   - bpo-36802(64): Provide both sync and async calls for
     StreamWriter.write() and StreamWriter.close()

   - bpo-36801(65): Properly handle SSL connection closing in asyncio
     StreamWriter.drain() call.

   - bpo-36785(66): Implement PEP 574 (pickle protocol 5 with
     out-of-band buffers).

   - bpo-36772(67): functools.lru_cache() can now be used as a straight
     decorator in addition to its existing usage as a function that
     returns a decorator.

   - bpo-6584(68): Add a *note BadGzipFile: bea. exception to the *note
     gzip: 6b. module.

   - bpo-36748(69): Optimized write buffering in C implementation of
     ‘TextIOWrapper’.  Writing ASCII string to ‘TextIOWrapper’ with
     ascii, latin1, or utf-8 encoding is about 20% faster.  Patch by
     Inada Naoki.

   - bpo-8138(70): Don't mark ‘wsgiref.simple_server.SimpleServer’ as
     multi-threaded since ‘wsgiref.simple_server.WSGIServer’ is
     single-threaded.

   - bpo-22640(71): *note py_compile.compile(): c1a. now supports silent
     mode.  Patch by Joannah Nanjekye

   - bpo-29183(72): Fix double exceptions in *note
     wsgiref.handlers.BaseHandler: 1dd3. by calling its ‘close()’ method
     only when no exception is raised.

   - bpo-36548(73): Improved the repr of regular expression flags.

   - bpo-36542(74): The signature of Python functions can now be
     overridden by specifying the ‘__text_signature__’ attribute.

   - bpo-36533(75): Reinitialize logging.Handler locks in forked child
     processes instead of attempting to acquire them all in the parent
     before forking only to be released in the child process.  The
     acquire/release pattern was leading to deadlocks in code that has
     implemented any form of chained logging handlers that depend upon
     one another as the lock acquisition order cannot be guaranteed.

   - bpo-35252(76): Throw a TypeError instead of an AssertionError when
     using an invalid type annotation with singledispatch.

   - bpo-35900(77): Allow reduction methods to return a 6-item tuple
     where the 6th item specifies a custom state-setting method that's
     called instead of the regular ‘__setstate__’ method.

   - bpo-35900(78): enable custom reduction callback registration for
     functions and classes in _pickle.c, using the new Pickler's
     attribute ‘reducer_override’

   - bpo-36368(79): Fix a bug crashing SharedMemoryManager instances in
     interactive sessions after a ctrl-c (KeyboardInterrupt) was sent

   - bpo-31904(80): Fix mmap fail for VxWorks

   - bpo-27497(81): *note csv.DictWriter.writeheader(): 1418. now
     returns the return value of the underlying ‘csv.Writer.writerow()’
     method.  Patch contributed by Ashish Nitin Patil.

   - bpo-36239(82): Parsing .mo files now ignores comments starting and
     ending with #-#-#-#-#.

   - bpo-26707(83): Enable plistlib to read and write binary plist files
     that were created as a KeyedArchive file.  Specifically, this
     allows the plistlib to process 0x80 tokens as UID objects.

   - bpo-31904(84): Add posix module support for VxWorks.

   - bpo-35125(85): Asyncio: Remove inner callback on outer cancellation
     in shield

   - bpo-35721(86): Fix ‘asyncio.SelectorEventLoop.subprocess_exec()’
     leaks file descriptors if ‘Popen’ fails and called with
     ‘stdin=subprocess.PIPE’.  Patch by Niklas Fiekas.

   - bpo-31855(87): *note unittest.mock.mock_open(): 11e9. results now
     respects the argument of read([size]).  Patch contributed by Rémi
     Lapeyre.

   - bpo-35431(88): Implement *note math.comb(): 8df. that returns
     binomial coefficient, that computes the number of ways to choose k
     items from n items without repetition and without order.  Patch by
     Yash Aggarwal and Keller Fuchs.

   - bpo-26660(89): Fixed permission errors in *note TemporaryDirectory:
     144c. clean up.  Previously ‘TemporaryDirectory.cleanup()’ failed
     when non-writeable or non-searchable files or directories were
     created inside a temporary directory.

   - bpo-34271(90): Add debugging helpers to ssl module.  It's now
     possible to dump key material and to trace TLS protocol.  The
     default and stdlib contexts also support SSLKEYLOGFILE env var.

   - bpo-26467(91): Added AsyncMock to support using unittest to mock
     asyncio coroutines.  Patch by Lisa Roach.

   - bpo-33569(92): dataclasses.InitVar: Exposes the type used to create
     the init var.

   - bpo-34424(93): Fix serialization of messages containing encoded
     strings when the policy.linesep is set to a multi-character string.
     Patch by Jens Troeger.

   - bpo-34303(94): Performance of *note functools.reduce(): 21a. is
     slightly improved.  Patch by Sergey Fedoseev.

   - bpo-33361(95): Fix a bug in *note codecs.StreamRecoder: 1dd4. where
     seeking might leave old data in a buffer and break subsequent read
     calls.  Patch by Ammar Askar.

   - bpo-22454(96): The *note shlex: c9. module now exposes *note
     shlex.join(): c1c, the inverse of *note shlex.split(): 75e.  Patch
     by Bo Bayles.

   - bpo-31922(97):
     ‘asyncio.AbstractEventLoop.create_datagram_endpoint()’: Do not
     connect UDP socket when broadcast is allowed.  This allows to
     receive replies after a UDP broadcast.

   - bpo-24882(98): Change ThreadPoolExecutor to use existing idle
     threads before spinning up new ones.

   - bpo-31961(99): Added support for bytes and path-like objects in
     *note subprocess.Popen(): 4b7. on Windows.  The 'args' parameter
     now accepts a *note path-like object: 5a1. if 'shell' is ‘False’
     and a sequence containing bytes and path-like objects.  The
     'executable' parameter now accepts a bytes and *note path-like
     object: 5a1.  The 'cwd' parameter now accepts a bytes object.
     Based on patch by Anders Lorentsen.

   - bpo-33123(100): *note pathlib.Path.unlink: 1dd5. now accepts a
     'missing_ok' parameter to avoid a *note FileNotFoundError: 264.
     from being raised.  Patch by Robert Buchholz.

   - bpo-32941(101): Allow *note mmap.mmap: 519. objects to access the
     madvise() system call (through *note mmap.mmap.madvise(): bfb.).

   - bpo-22102(102): Added support for ZIP files with disks set to 0.
     Such files are commonly created by builtin tools on Windows when
     use ZIP64 extension.  Patch by Francisco Facioni.

   - bpo-32515(103): trace.py can now run modules via python3 -m trace
     -t -module module_name

   - bpo-32299(104): Changed *note unittest.mock.patch.dict(): 1967. to
     return the patched dictionary when used as context manager.  Patch
     by Vadim Tsander.

   - bpo-27141(105): Added a ‘__copy__()’ to ‘collections.UserList’ and
     ‘collections.UserDict’ in order to correctly implement shallow
     copying of the objects.  Patch by Bar Harel.

   - bpo-31829(106): ‘\r’, ‘\0’ and ‘\x1a’ (end-of-file on Windows) are
     now escaped in protocol 0 pickles of Unicode strings.  This allows
     to load them without loss from files open in text mode in Python 2.

   - bpo-23395(107): ‘_thread.interrupt_main()’ now avoids setting the
     Python error status if the ‘SIGINT’ signal is ignored or not
     handled by Python.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37128

   (2) https://bugs.python.org/issue?@action=redirect&bpo=37120

   (3) https://bugs.python.org/issue?@action=redirect&bpo=12202

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26835

   (5) https://bugs.python.org/issue?@action=redirect&bpo=29262

   (6) https://bugs.python.org/issue?@action=redirect&bpo=12639

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36999

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35246

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35279

   (10) https://bugs.python.org/issue?@action=redirect&bpo=37076

   (11) https://bugs.python.org/issue?@action=redirect&bpo=33725

   (12) https://bugs.python.org/issue?@action=redirect&bpo=37054

   (13) https://bugs.python.org/issue?@action=redirect&bpo=37058

   (14) https://bugs.python.org/issue?@action=redirect&bpo=36933

   (15) https://bugs.python.org/issue?@action=redirect&bpo=37047

   (16) https://bugs.python.org/issue?@action=redirect&bpo=37049

   (17) https://bugs.python.org/issue?@action=redirect&bpo=37046

   (18) https://bugs.python.org/issue?@action=redirect&bpo=37045

   (19) https://bugs.python.org/issue?@action=redirect&bpo=37035

   (20) https://bugs.python.org/issue?@action=redirect&bpo=37001

   (21) https://bugs.python.org/issue?@action=redirect&bpo=37028

   (22) https://bugs.python.org/issue?@action=redirect&bpo=37027

   (23) https://bugs.python.org/issue?@action=redirect&bpo=32528

   (24) https://bugs.python.org/issue?@action=redirect&bpo=1230540

   (25) https://bugs.python.org/issue?@action=redirect&bpo=36996

   (26) https://bugs.python.org/issue?@action=redirect&bpo=37008

   (27) https://bugs.python.org/issue?@action=redirect&bpo=27737

   (28) https://bugs.python.org/issue?@action=redirect&bpo=36969

   (29) https://bugs.python.org/issue?@action=redirect&bpo=36969

   (30) https://bugs.python.org/issue?@action=redirect&bpo=36983

   (31) https://bugs.python.org/issue?@action=redirect&bpo=36972

   (32) https://bugs.python.org/issue?@action=redirect&bpo=32972

   (33) https://bugs.python.org/issue?@action=redirect&bpo=36952

   (34) https://bugs.python.org/issue?@action=redirect&bpo=36952

   (35) https://bugs.python.org/issue?@action=redirect&bpo=36949

   (36) https://bugs.python.org/issue?@action=redirect&bpo=36948

   (37) https://bugs.python.org/issue?@action=redirect&bpo=33524

   (38) https://bugs.python.org/issue?@action=redirect&bpo=24564

   (39) https://bugs.python.org/issue?@action=redirect&bpo=36888

   (40) https://bugs.python.org/issue?@action=redirect&bpo=36921

   (41) https://bugs.python.org/issue?@action=redirect&bpo=25652

   (42) https://bugs.python.org/issue?@action=redirect&bpo=36916

   (43) https://bugs.python.org/issue?@action=redirect&bpo=36889

   (44) https://bugs.python.org/issue?@action=redirect&bpo=36845

   (45) https://bugs.python.org/issue?@action=redirect&bpo=23378

   (46) https://bugs.python.org/issue?@action=redirect&bpo=36867

   (47) https://bugs.python.org/issue?@action=redirect&bpo=23896

   (48) https://bugs.python.org/issue?@action=redirect&bpo=36895

   (49) https://bugs.python.org/issue?@action=redirect&bpo=35545

   (50) https://bugs.python.org/issue?@action=redirect&bpo=36887

   (51) https://bugs.python.org/issue?@action=redirect&bpo=34632

   (52) https://bugs.python.org/issue?@action=redirect&bpo=36878

   (53) https://bugs.python.org/issue?@action=redirect&bpo=36778

   (54) https://bugs.python.org/issue?@action=redirect&bpo=36867

   (55) https://bugs.python.org/issue?@action=redirect&bpo=30262

   (56) https://bugs.python.org/issue?@action=redirect&bpo=24538

   (57) https://bugs.python.org/issue?@action=redirect&bpo=36829

   (58) https://bugs.python.org/issue?@action=redirect&bpo=36832

   (59) https://bugs.python.org/issue?@action=redirect&bpo=36814

   (60) https://bugs.python.org/issue?@action=redirect&bpo=33110

   (61) https://bugs.python.org/issue?@action=redirect&bpo=26903

   (62) https://bugs.python.org/issue?@action=redirect&bpo=36813

   (63) https://bugs.python.org/issue?@action=redirect&bpo=36806

   (64) https://bugs.python.org/issue?@action=redirect&bpo=36802

   (65) https://bugs.python.org/issue?@action=redirect&bpo=36801

   (66) https://bugs.python.org/issue?@action=redirect&bpo=36785

   (67) https://bugs.python.org/issue?@action=redirect&bpo=36772

   (68) https://bugs.python.org/issue?@action=redirect&bpo=6584

   (69) https://bugs.python.org/issue?@action=redirect&bpo=36748

   (70) https://bugs.python.org/issue?@action=redirect&bpo=8138

   (71) https://bugs.python.org/issue?@action=redirect&bpo=22640

   (72) https://bugs.python.org/issue?@action=redirect&bpo=29183

   (73) https://bugs.python.org/issue?@action=redirect&bpo=36548

   (74) https://bugs.python.org/issue?@action=redirect&bpo=36542

   (75) https://bugs.python.org/issue?@action=redirect&bpo=36533

   (76) https://bugs.python.org/issue?@action=redirect&bpo=35252

   (77) https://bugs.python.org/issue?@action=redirect&bpo=35900

   (78) https://bugs.python.org/issue?@action=redirect&bpo=35900

   (79) https://bugs.python.org/issue?@action=redirect&bpo=36368

   (80) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (81) https://bugs.python.org/issue?@action=redirect&bpo=27497

   (82) https://bugs.python.org/issue?@action=redirect&bpo=36239

   (83) https://bugs.python.org/issue?@action=redirect&bpo=26707

   (84) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (85) https://bugs.python.org/issue?@action=redirect&bpo=35125

   (86) https://bugs.python.org/issue?@action=redirect&bpo=35721

   (87) https://bugs.python.org/issue?@action=redirect&bpo=31855

   (88) https://bugs.python.org/issue?@action=redirect&bpo=35431

   (89) https://bugs.python.org/issue?@action=redirect&bpo=26660

   (90) https://bugs.python.org/issue?@action=redirect&bpo=34271

   (91) https://bugs.python.org/issue?@action=redirect&bpo=26467

   (92) https://bugs.python.org/issue?@action=redirect&bpo=33569

   (93) https://bugs.python.org/issue?@action=redirect&bpo=34424

   (94) https://bugs.python.org/issue?@action=redirect&bpo=34303

   (95) https://bugs.python.org/issue?@action=redirect&bpo=33361

   (96) https://bugs.python.org/issue?@action=redirect&bpo=22454

   (97) https://bugs.python.org/issue?@action=redirect&bpo=31922

   (98) https://bugs.python.org/issue?@action=redirect&bpo=24882

   (99) https://bugs.python.org/issue?@action=redirect&bpo=31961

   (100) https://bugs.python.org/issue?@action=redirect&bpo=33123

   (101) https://bugs.python.org/issue?@action=redirect&bpo=32941

   (102) https://bugs.python.org/issue?@action=redirect&bpo=22102

   (103) https://bugs.python.org/issue?@action=redirect&bpo=32515

   (104) https://bugs.python.org/issue?@action=redirect&bpo=32299

   (105) https://bugs.python.org/issue?@action=redirect&bpo=27141

   (106) https://bugs.python.org/issue?@action=redirect&bpo=31829

   (107) https://bugs.python.org/issue?@action=redirect&bpo=23395


File: python.info,  Node: ドキュメント<52>,  Next: テスト<50>,  Prev: ライブラリ<158>,  Up: Python 3 8 0 beta 1

1.24.58.4 ドキュメント
......................

   - bpo-36896(1): Clarify that some types have unstable constructor
     signature between Python versions.

   - bpo-36686(2): Improve documentation of the stdin, stdout, and
     stderr arguments of the ‘asyncio.subprocess_exec’ function to
     specify which values are supported.  Also mention that decoding as
     text is not supported.

     Add a few tests to verify that the various values passed to the
     std* arguments actually work.

   - bpo-36984(3): Improve version added references in ‘typing’ module -
     by Anthony Sottile.

   - bpo-36868(4): What's new now mentions
     SSLContext.hostname_checks_common_name instead of
     SSLContext.host_flags.

   - bpo-35924(5): Add a note to the ‘curses.addstr()’ documentation to
     warn that multiline strings can cause segfaults because of an
     ncurses bug.

   - bpo-36783(6): Added C API Documentation for Time_FromTimeAndFold
     and PyDateTime_FromDateAndTimeAndFold as per PEP 495.  Patch by
     Edison Abahurire.

   - bpo-36797(7): More of the legacy distutils documentation has been
     either pruned, or else more clearly marked as being retained solely
     until the setuptools documentation covers it independently.

   - bpo-22865(8): Add detail to the documentation on the ‘pty.spawn’
     function.

   - bpo-35397(9): Remove deprecation and document
     urllib.parse.unwrap().  Patch contributed by Rémi Lapeyre.

   - bpo-32995(10): Added the context variable in glossary.

   - bpo-33519(11): Clarify that ‘copy()’ is not part of the
     ‘MutableSequence’ ABC.

   - bpo-33482(12): Make ‘codecs.StreamRecoder.writelines’ take a list
     of bytes.

   - bpo-25735(13): Added documentation for func factorial to indicate
     that returns integer values

   - bpo-20285(14): Expand object.__doc__ (docstring) to make it
     clearer.  Modify pydoc.py so that help(object) lists object methods
     (for other classes, help omits methods of the object base class.)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36896

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36686

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36984

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36868

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35924

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36783

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36797

   (8) https://bugs.python.org/issue?@action=redirect&bpo=22865

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35397

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32995

   (11) https://bugs.python.org/issue?@action=redirect&bpo=33519

   (12) https://bugs.python.org/issue?@action=redirect&bpo=33482

   (13) https://bugs.python.org/issue?@action=redirect&bpo=25735

   (14) https://bugs.python.org/issue?@action=redirect&bpo=20285


File: python.info,  Node: テスト<50>,  Next: ビルド<58>,  Prev: ドキュメント<52>,  Up: Python 3 8 0 beta 1

1.24.58.5 テスト
................

   - bpo-37069(1): Modify test_coroutines, test_cprofile,
     test_generators, test_raise, test_ssl and test_yield_from to use
     *note test.support.catch_unraisable_exception(): 1dbd. rather than
     *note test.support.captured_stderr(): 1dd8.

   - bpo-37098(2): Fix test_memfd_create on older Linux Kernels.

   - bpo-37081(3): Test with OpenSSL 1.1.1c

   - bpo-36829(4): Add *note test.support.catch_unraisable_exception():
     1dbd.: context manager catching unraisable exception using *note
     sys.unraisablehook(): 507.

   - bpo-36915(5): The main regrtest process now always removes all
     temporary directories of worker processes even if they crash or if
     they are killed on KeyboardInterrupt (CTRL+c).

   - bpo-36719(6): "python3 -m test -jN ..."  now continues the
     execution of next tests when a worker process crash (CHILD_ERROR
     state).  Previously, the test suite stopped immediately.  Use
     -failfast to stop at the first error.

   - bpo-36816(7): Update Lib/test/selfsigned_pythontestdotnet.pem to
     match self-signed.pythontest.net's new TLS certificate.

   - bpo-35925(8): Skip httplib and nntplib networking tests when they
     would otherwise fail due to a modern OS or distro with a default
     OpenSSL policy of rejecting connections to servers with weak
     certificates.

   - bpo-36782(9): Add tests for several C API functions in the *note
     datetime: 34. module.  Patch by Edison Abahurire.

   - bpo-36342(10): Fix test_multiprocessing in test_venv if platform
     lacks functioning sem_open.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37069

   (2) https://bugs.python.org/issue?@action=redirect&bpo=37098

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37081

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36829

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36915

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36719

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36816

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35925

   (9) https://bugs.python.org/issue?@action=redirect&bpo=36782

   (10) https://bugs.python.org/issue?@action=redirect&bpo=36342


File: python.info,  Node: ビルド<58>,  Next: Windows<51>,  Prev: テスト<50>,  Up: Python 3 8 0 beta 1

1.24.58.6 ビルド
................

   - bpo-36721(1): To embed Python into an application, a new ‘--embed’
     option must be passed to ‘python3-config --libs --embed’ to get
     ‘-lpython3.8’ (link the application to libpython).  To support both
     3.8 and older, try ‘python3-config --libs --embed’ first and
     fallback to ‘python3-config --libs’ (without ‘--embed’) if the
     previous command fails.

     Python をアプリケーションに組み込むために、‘python-3.8-embed’
     pkg-config モジュールが追加されました: ‘pkg-config python-3.8-embed
     --libs’ の出力は、‘-lpython3.8’ を含みます。 Python3.8 以前との互換
     性を保つためには、‘pkg-config python-X.Y-embed --libs’ をまず試みて
     から、失敗した場合 ‘pkg-config python-X.Y --libs’ (‘--embed’ なし)
     にフォールバックしてください。(‘X.Y’ を使用するPython のバージョン
     に置き換えてください)

     On the other hand, ‘pkg-config python3.8 --libs’ no longer contains
     ‘-lpython3.8’.  C extensions must not be linked to libpython
     (except on Android, case handled by the script); this change is
     backward incompatible on purpose.

   - bpo-36786(2): "make install" now runs compileall in parallel.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36721

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36786


File: python.info,  Node: Windows<51>,  Next: macOS<40>,  Prev: ビルド<58>,  Up: Python 3 8 0 beta 1

1.24.58.7 Windows
.................

   - bpo-36965(1): include of STATUS_CONTROL_C_EXIT without depending on
     MSC compiler

   - bpo-35926(2): Update to OpenSSL 1.1.1b for Windows.

   - bpo-29883(3): Add Windows support for UDP transports for the
     Proactor Event Loop.  Patch by Adam Meily.

   - bpo-33407(4): The *note Py_DEPRECATED(): c9b. macro has been
     implemented for MSVC.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36965

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35926

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29883

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33407


File: python.info,  Node: macOS<40>,  Next: IDLE<33>,  Prev: Windows<51>,  Up: Python 3 8 0 beta 1

1.24.58.8 macOS
...............

   - bpo-36231(1): Support building Python on macOS without /usr/include
     installed.  As of macOS 10.14, system header files are only
     available within an SDK provided by either the Command Line Tools
     or the Xcode app.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36231


File: python.info,  Node: IDLE<33>,  Next: Tools/Demos<34>,  Prev: macOS<40>,  Up: Python 3 8 0 beta 1

1.24.58.9 IDLE
..............

   - bpo-35610(1): Replace now redundant .context_use_ps1 with
     .prompt_last_line.  This finishes change started in bpo-31858(2).

   - bpo-37038(3): Make idlelib.run runnable; add test clause.

   - bpo-36958(4): Print any argument other than None or int passed to
     SystemExit or sys.exit().

   - bpo-36807(5): When saving a file, call os.fsync() so bits are
     flushed to e.g.  USB drive.

   - bpo-32411(6): In browser.py, remove extraneous sorting by line
     number since dictionary was created in line number order.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35610

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31858

   (3) https://bugs.python.org/issue?@action=redirect&bpo=37038

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36958

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36807

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32411


File: python.info,  Node: Tools/Demos<34>,  Next: C API<53>,  Prev: IDLE<33>,  Up: Python 3 8 0 beta 1

1.24.58.10 Tools/Demos
......................

   - bpo-37053(1): Handle strings like u"bar" correctly in
     Tools/parser/unparse.py.  Patch by Chih-Hsuan Yen.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=37053


File: python.info,  Node: C API<53>,  Prev: Tools/Demos<34>,  Up: Python 3 8 0 beta 1

1.24.58.11 C API
................

   - bpo-36763(1): Implement the PEP 587(2) "Python Initialization
     Configuration".

   - bpo-36379(3): Fix crashes when attempting to use the 'modulo'
     parameter when ‘__ipow__’ is implemented in C.

   - bpo-37107(4): Update *note PyObject_CallMethodObjArgs(): 1ddf. and
     ‘_PyObject_CallMethodIdObjArgs’ to use ‘_PyObject_GetMethod’ to
     avoid creating a bound method object in many cases.  Patch by
     Michael J. Sullivan.

   - bpo-36974(5): Implement PEP 590(6): Vectorcall: a fast calling
     protocol for CPython.  This is a new protocol to optimize calls of
     custom callable objects.

   - bpo-36763(7): ‘Py_Main()’ now returns the exitcode rather than
     calling ‘Py_Exit(exitcode)’ when calling ‘PyErr_Print()’ if the
     current exception type is ‘SystemExit’.

   - bpo-36922(8): Add new type flag ‘Py_TPFLAGS_METHOD_DESCRIPTOR’ for
     objects behaving like unbound methods.  These are objects
     supporting the optimization given by the
     ‘LOAD_METHOD’/‘CALL_METHOD’ opcodes.  See PEP 590.

   - bpo-36728(9): The ‘PyEval_ReInitThreads()’ function has been
     removed from the C API. It should not be called explicitly: use
     *note PyOS_AfterFork_Child(): 430. instead.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36763

   (2) https://peps.python.org/pep-0587/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36379

   (4) https://bugs.python.org/issue?@action=redirect&bpo=37107

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36974

   (6) https://peps.python.org/pep-0590/

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36763

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36922

   (9) https://bugs.python.org/issue?@action=redirect&bpo=36728


File: python.info,  Node: Python 3 8 0 alpha 4,  Next: Python 3 8 0 alpha 3,  Prev: Python 3 8 0 beta 1,  Up: 変更履歴

1.24.59 Python 3.8.0 alpha 4
----------------------------

'Release date: 2019-05-06'

* Menu:

* セキュリティ: セキュリティ<44>.
* Core and Builtins: Core and Builtins<156>.
* ライブラリ: ライブラリ<159>.
* ドキュメント: ドキュメント<53>.
* テスト: テスト<51>.
* ビルド: ビルド<59>.
* Windows: Windows<52>.
* macOS: macOS<41>.
* IDLE: IDLE<34>.
* Tools/Demos: Tools/Demos<35>.
* C API: C API<54>.


File: python.info,  Node: セキュリティ<44>,  Next: Core and Builtins<156>,  Up: Python 3 8 0 alpha 4

1.24.59.1 セキュリティ
......................

   - bpo-36742(1): Fixes mishandling of pre-normalization characters in
     urlsplit().

   - bpo-30458(2): Address CVE 2019-9740(3) by disallowing URL paths
     with embedded whitespace or control characters through into the
     underlying http client request.  Such potentially malicious header
     injection URLs now cause an http.client.InvalidURL exception to be
     raised.

   - bpo-35755(4): *note shutil.which(): 6db. now uses
     ‘os.confstr("CS_PATH")’ if available and if the ‘PATH’ environment
     variable is not set.  Remove also the current directory from
     ‘posixpath.defpath’.  On Unix, *note shutil.which(): 6db. and the
     *note subprocess: dc. module no longer search the executable in the
     current directory if the ‘PATH’ environment variable is not set.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36742

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30458

   (3) https://www.cve.org/CVERecord?id=CVE-2019-9740

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35755


File: python.info,  Node: Core and Builtins<156>,  Next: ライブラリ<159>,  Prev: セキュリティ<44>,  Up: Python 3 8 0 alpha 4

1.24.59.2 Core and Builtins
...........................

   - bpo-36722(1): In debug build, import now also looks for C
     extensions compiled in release mode and for C extensions compiled
     in the stable ABI.

   - bpo-32849(2): Fix Python Initialization code on FreeBSD to detect
     properly when stdin file descriptor (fd 0) is invalid.

   - bpo-36623(3): Remove parser headers and related function
     declarations that lack implementations after the removal of pgen.

   - bpo-20180(4): ‘dict.pop()’ is now up to 33% faster thanks to
     Argument Clinic.  Patch by Inada Naoki.

   - bpo-36611(5): Debug memory allocators: disable serialno field by
     default from debug hooks on Python memory allocators to reduce the
     memory footprint by 5%.  Enable *note tracemalloc: 105. to get the
     traceback where a memory block has been allocated when a fatal
     memory error is logged to decide where to put a breakpoint.
     Compile Python with ‘PYMEM_DEBUG_SERIALNO’ defined to get back the
     field.

   - bpo-36588(6): On AIX, *note sys.platform: 291. doesn't contain the
     major version anymore.  Always return ‘'aix'’, instead of ‘'aix3'’
     ..  ‘'aix7'’.  Since older Python versions include the version
     number, it is recommended to always use
     ‘sys.platform.startswith('aix')’.  Contributed by M. Felt.

   - bpo-36549(7): Change str.capitalize to use titlecase for the first
     character instead of uppercase.

   - bpo-36540(8): Implement PEP 570(9) (Python positional-only
     parameters).  Patch by Pablo Galindo.

   - bpo-36475(10): ‘PyEval_AcquireLock()’ and ‘PyEval_AcquireThread()’
     now terminate the current thread if called while the interpreter is
     finalizing, making them consistent with *note
     PyEval_RestoreThread(): 648, *note Py_END_ALLOW_THREADS(): c7f, and
     *note PyGILState_Ensure(): 64a.

   - bpo-36504(11): Fix signed integer overflow in _ctypes.c's
     ‘PyCArrayType_new()’.

   - bpo-20844(12): Fix running script with encoding cookie and LF line
     ending may fail on Windows.

   - bpo-24214(13): Fixed support of the surrogatepass error handler in
     the UTF-8 incremental decoder.

   - bpo-36452(14): Changing ‘dict’ keys during iteration of the dict
     itself, ‘keys()’, ‘values()’, or ‘items()’ will now be detected in
     certain corner cases where keys are deleted/added so that the
     number of keys isn't changed.  A ‘RuntimeError’ will be raised
     after ‘len(dict)’ iterations.  Contributed by Thomas Perl.

   - bpo-36459(15): Fix a possible double ‘PyMem_FREE()’ due to
     tokenizer.c's ‘tok_nextc()’.

   - bpo-36433(16): Fixed TypeError message in classmethoddescr_call.

   - bpo-36430(17): Fix a possible reference leak in *note
     itertools.count(): 149b.

   - bpo-36440(18): Include node names in ‘ParserError’ messages,
     instead of numeric IDs.  Patch by A. Skrobov.

   - bpo-36143(19): Regenerate *note keyword: 88. from the Grammar and
     Tokens file using pgen.  Patch by Pablo Galindo.

   - bpo-18372(20): Add missing *note PyObject_GC_Track(): 171d. calls
     in the *note pickle: ab. module.  Patch by Zackery Spytz.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36722

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32849

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36623

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20180

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36611

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36588

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36549

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36540

   (9) https://peps.python.org/pep-0570/

   (10) https://bugs.python.org/issue?@action=redirect&bpo=36475

   (11) https://bugs.python.org/issue?@action=redirect&bpo=36504

   (12) https://bugs.python.org/issue?@action=redirect&bpo=20844

   (13) https://bugs.python.org/issue?@action=redirect&bpo=24214

   (14) https://bugs.python.org/issue?@action=redirect&bpo=36452

   (15) https://bugs.python.org/issue?@action=redirect&bpo=36459

   (16) https://bugs.python.org/issue?@action=redirect&bpo=36433

   (17) https://bugs.python.org/issue?@action=redirect&bpo=36430

   (18) https://bugs.python.org/issue?@action=redirect&bpo=36440

   (19) https://bugs.python.org/issue?@action=redirect&bpo=36143

   (20) https://bugs.python.org/issue?@action=redirect&bpo=18372


File: python.info,  Node: ライブラリ<159>,  Next: ドキュメント<53>,  Prev: Core and Builtins<156>,  Up: Python 3 8 0 alpha 4

1.24.59.3 ライブラリ
....................

   - bpo-35952(1): Fix pythoninfo when the compiler is missing.

   - bpo-28238(2): The ‘.find*()’ methods of xml.etree.ElementTree can
     now search for wildcards like ‘{*}tag’ and ‘{ns}*’ that match a tag
     in any namespace or all tags in a namespace.  Patch by Stefan
     Behnel.

   - bpo-26978(3): ‘pathlib.path.link_to()’ is now implemented.  It
     creates a hard link pointing to a path.

   - bpo-1613500(4): *note fileinput.FileInput: 940. now uses the input
     file mode to correctly set the output file mode (previously it was
     hardcoded to ‘'w'’) when ‘inplace=True’ is passed to its
     constructor.

   - bpo-36734(5): Fix compilation of ‘faulthandler.c’ on HP-UX.
     Initialize ‘stack_t current_stack’ to zero using ‘memset()’.

   - bpo-13611(6): The xml.etree.ElementTree packages gained support for
     C14N 2.0 serialisation.  Patch by Stefan Behnel.

   - bpo-36669(7): Add missing matrix multiplication operator support to
     weakref.proxy.

   - bpo-36676(8): The XMLParser() in xml.etree.ElementTree provides
     namespace prefix context to the parser target if it defines the
     callback methods "start_ns()" and/or "end_ns()".  Patch by Stefan
     Behnel.

   - bpo-36673(9): The TreeBuilder and XMLPullParser in
     xml.etree.ElementTree gained support for parsing comments and
     processing instructions.  Patch by Stefan Behnel.

   - bpo-36650(10): The C version of functools.lru_cache() was treating
     calls with an empty ‘**kwargs’ dictionary as being distinct from
     calls with no keywords at all.  This did not result in an incorrect
     answer, but it did trigger an unexpected cache miss.

   - bpo-28552(11): Fix ‘distutils.sysconfig’ if *note sys.executable:
     3ed. is ‘None’ or an empty string: use *note os.getcwd(): 1909. to
     initialize ‘project_base’.  Fix also the distutils build command:
     don't use *note sys.executable: 3ed. if it is ‘None’ or an empty
     string.

   - bpo-35755(12): *note shutil.which(): 6db. and
     ‘distutils.spawn.find_executable’ now use ‘os.confstr("CS_PATH")’
     if available instead of *note os.defpath: 1de4, if the ‘PATH’
     environment variable is not set.  Moreover, don't use
     ‘os.confstr("CS_PATH")’ nor *note os.defpath: 1de4. if the ‘PATH’
     environment variable is set to an empty string.

   - bpo-25430(13): improve performance of ‘IPNetwork.__contains__()’

   - bpo-30485(14): Path expressions in xml.etree.ElementTree can now
     avoid explicit namespace prefixes for tags (or the "{namespace}tag"
     notation) by passing a default namespace with an empty string
     prefix.

   - bpo-36613(15): Fix *note asyncio: b. wait() not removing callback
     if exception

   - bpo-36598(16): Fix ‘isinstance’ check for Mock objects with spec
     when the code is executed under tracing.  Patch by Karthikeyan
     Singaravelan.

   - bpo-18748(17): In development mode (*note -X: 16f. ‘dev’) and in
     debug build, the *note io.IOBase: 505. destructor now logs
     ‘close()’ exceptions.  These exceptions are silent by default in
     release mode.

   - bpo-36575(18): The ‘_lsprof’ module now uses internal timer same to
     ‘time.perf_counter()’ by default.  ‘gettimeofday(2)’ was used on
     Unix.  New timer has better resolution on most Unix platforms and
     timings are no longer impacted by system clock updates since
     ‘perf_counter()’ is monotonic.  Patch by Inada Naoki.

   - bpo-33461(19): ‘json.loads’ now emits ‘DeprecationWarning’ when
     ‘encoding’ option is specified.  Patch by Matthias Bussonnier.

   - bpo-36559(20): The random module now prefers the lean internal
     _sha512 module over hashlib for seed(version=2) to optimize import
     time.

   - bpo-17561(21): Set backlog=None as the default for
     socket.create_server.

   - bpo-34373(22): Fix *note time.mktime(): 1401. error handling on AIX
     for year before 1970.

   - bpo-36232(23): Improve error message when trying to open existing
     DBM database that actually doesn't exist.  Patch by Marco Rougeth.

   - bpo-36546(24): Add statistics.quantiles()

   - bpo-36050(25): Optimized ‘http.client.HTTPResponse.read()’ for
     large response.  Patch by Inada Naoki.

   - bpo-36522(26): If 'debuglevel' is set to >0 in *note http.client:
     73, print all values for headers with multiple values for the same
     header name.  Patch by Matt Houglum.

   - bpo-36492(27): Deprecated passing required arguments like 'func' as
     keyword arguments in functions which should accept arbitrary
     keyword arguments and pass them to other function.  Arbitrary
     keyword arguments (even with names "self" and "func") can now be
     passed to these functions if the required arguments are passed as
     positional arguments.

   - bpo-27181(28): Add statistics.geometric_mean().

   - bpo-30427(29): ‘os.path.normcase()’ relies on ‘os.fspath()’ to
     check the type of its argument.  Redundant checks have been removed
     from its ‘posixpath.normcase()’ and ‘ntpath.normcase()’
     implementations.  Patch by Wolfgang Maier.

   - bpo-36385(30): Stop rejecting IPv4 octets for being ambiguously
     octal.  Leading zeros are ignored, and no longer are assumed to
     specify octal octets.  Octets are always decimal numbers.  Octets
     must still be no more than three digits, including leading zeroes.

   - bpo-36434(31): Errors during writing to a ZIP file no longer
     prevent to properly close it.

   - bpo-36407(32): Fixed wrong indentation writing for CDATA section in
     xml.dom.minidom.  Patch by Vladimir Surjaninov.

   - bpo-36326(33): inspect.getdoc() can now find docstrings for member
     objects when __slots__ is a dictionary.

   - bpo-36366(34): Calling ‘stop()’ on an unstarted or stopped *note
     unittest.mock.patch(): 1092. object will now return ‘None’ instead
     of raising *note RuntimeError: 244, making the method idempotent.
     Patch by Karthikeyan Singaravelan.

   - bpo-36348(35): The ‘imap.IMAP4.logout()’ method no longer ignores
     silently arbitrary exceptions.

   - bpo-31904(36): Add time module support and fix test_time failures
     for VxWorks.

   - bpo-36227(37): Added support for keyword arguments
     ‘default_namespace’ and ‘xml_declaration’ in functions
     ‘ElementTree.tostring()’ and ‘ElementTree.tostringlist()’.

   - bpo-36004(38): Added new alternate constructors *note
     datetime.date.fromisocalendar(): bdf. and *note
     datetime.datetime.fromisocalendar(): be0, which construct date
     objects from ISO year, week number and weekday; these are the
     inverse of each class's ‘isocalendar’ method.  Patch by Paul
     Ganssle.

   - bpo-35936(39): *note modulefinder: 95. no longer depends on the
     deprecated *note imp: 7a. module, and the initializer for *note
     modulefinder.ModuleFinder: 1de5. now has immutable default
     arguments.  Patch by Brandt Bucher.

   - bpo-35376(40): *note modulefinder: 95. correctly handles modules
     that have the same name as a bad package.  Patch by Brandt Bucher.

   - bpo-17396(41): *note modulefinder: 95. no longer crashes when
     encountering syntax errors in followed imports.  Patch by Brandt
     Bucher.

   - bpo-35934(42): Added *note create_server(): c20. and *note
     has_dualstack_ipv6(): c21. convenience functions to automate the
     necessary tasks usually involved when creating a server socket,
     including accepting both IPv4 and IPv6 connections on the same
     socket.  (Contributed by Giampaolo Rodola in bpo-17561(43).)

   - bpo-23078(44): Add support for *note classmethod(): 48e. and *note
     staticmethod(): 453. to *note unittest.mock.create_autospec():
     1934.  Initial patch by Felipe Ochoa.

   - bpo-35416(45): Fix potential resource warnings in distutils.  Patch
     by Mickaël Schoentgen.

   - bpo-25451(46): Add transparency methods to ‘tkinter.PhotoImage’.
     Patch by Zackery Spytz.

   - bpo-35082(47): Don't return deleted attributes when calling dir on
     a *note unittest.mock.Mock: c3f.

   - bpo-34547(48): *note wsgiref.handlers.BaseHandler: 1dd3. now
     handles abrupt client connection terminations gracefully.  Patch by
     Petter Strandmark.

   - bpo-31658(49): *note xml.sax.parse(): 1de6. now supports *note
     path-like: 5a1.  Patch by Mickaël Schoentgen.

   - bpo-34139(50): Remove stale unix datagram socket before binding

   - bpo-33530(51): Implemented Happy Eyeballs in
     ‘asyncio.create_connection()’.  Added two new arguments,
     'happy_eyeballs_delay' and 'interleave', to specify Happy Eyeballs
     behavior.

   - bpo-33291(52): Do not raise AttributeError when calling the inspect
     functions isgeneratorfunction, iscoroutinefunction,
     isasyncgenfunction on a method created from an arbitrary callable.
     Instead, return False.

   - bpo-31310(53): Fix the multiprocessing.semaphore_tracker so it is
     reused by child processes

   - bpo-31292(54): Fix ‘setup.py check --restructuredtext’ for files
     containing ‘include’ directives.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35952

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28238

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26978

   (4) https://bugs.python.org/issue?@action=redirect&bpo=1613500

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36734

   (6) https://bugs.python.org/issue?@action=redirect&bpo=13611

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36669

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36676

   (9) https://bugs.python.org/issue?@action=redirect&bpo=36673

   (10) https://bugs.python.org/issue?@action=redirect&bpo=36650

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28552

   (12) https://bugs.python.org/issue?@action=redirect&bpo=35755

   (13) https://bugs.python.org/issue?@action=redirect&bpo=25430

   (14) https://bugs.python.org/issue?@action=redirect&bpo=30485

   (15) https://bugs.python.org/issue?@action=redirect&bpo=36613

   (16) https://bugs.python.org/issue?@action=redirect&bpo=36598

   (17) https://bugs.python.org/issue?@action=redirect&bpo=18748

   (18) https://bugs.python.org/issue?@action=redirect&bpo=36575

   (19) https://bugs.python.org/issue?@action=redirect&bpo=33461

   (20) https://bugs.python.org/issue?@action=redirect&bpo=36559

   (21) https://bugs.python.org/issue?@action=redirect&bpo=17561

   (22) https://bugs.python.org/issue?@action=redirect&bpo=34373

   (23) https://bugs.python.org/issue?@action=redirect&bpo=36232

   (24) https://bugs.python.org/issue?@action=redirect&bpo=36546

   (25) https://bugs.python.org/issue?@action=redirect&bpo=36050

   (26) https://bugs.python.org/issue?@action=redirect&bpo=36522

   (27) https://bugs.python.org/issue?@action=redirect&bpo=36492

   (28) https://bugs.python.org/issue?@action=redirect&bpo=27181

   (29) https://bugs.python.org/issue?@action=redirect&bpo=30427

   (30) https://bugs.python.org/issue?@action=redirect&bpo=36385

   (31) https://bugs.python.org/issue?@action=redirect&bpo=36434

   (32) https://bugs.python.org/issue?@action=redirect&bpo=36407

   (33) https://bugs.python.org/issue?@action=redirect&bpo=36326

   (34) https://bugs.python.org/issue?@action=redirect&bpo=36366

   (35) https://bugs.python.org/issue?@action=redirect&bpo=36348

   (36) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (37) https://bugs.python.org/issue?@action=redirect&bpo=36227

   (38) https://bugs.python.org/issue?@action=redirect&bpo=36004

   (39) https://bugs.python.org/issue?@action=redirect&bpo=35936

   (40) https://bugs.python.org/issue?@action=redirect&bpo=35376

   (41) https://bugs.python.org/issue?@action=redirect&bpo=17396

   (42) https://bugs.python.org/issue?@action=redirect&bpo=35934

   (43) https://bugs.python.org/issue?@action=redirect&bpo=17561

   (44) https://bugs.python.org/issue?@action=redirect&bpo=23078

   (45) https://bugs.python.org/issue?@action=redirect&bpo=35416

   (46) https://bugs.python.org/issue?@action=redirect&bpo=25451

   (47) https://bugs.python.org/issue?@action=redirect&bpo=35082

   (48) https://bugs.python.org/issue?@action=redirect&bpo=34547

   (49) https://bugs.python.org/issue?@action=redirect&bpo=31658

   (50) https://bugs.python.org/issue?@action=redirect&bpo=34139

   (51) https://bugs.python.org/issue?@action=redirect&bpo=33530

   (52) https://bugs.python.org/issue?@action=redirect&bpo=33291

   (53) https://bugs.python.org/issue?@action=redirect&bpo=31310

   (54) https://bugs.python.org/issue?@action=redirect&bpo=31292


File: python.info,  Node: ドキュメント<53>,  Next: テスト<51>,  Prev: ライブラリ<159>,  Up: Python 3 8 0 alpha 4

1.24.59.4 ドキュメント
......................

   - bpo-36625(1): Remove obsolete comments from docstrings in
     fractions.Fraction

   - bpo-30840(2): Document relative imports

   - bpo-36523(3): Add docstring for io.IOBase.writelines().

   - bpo-36425(4): New documentation translation: Simplified Chinese(5).

   - bpo-36345(6): Avoid the duplication of code from
     ‘Tools/scripts/serve.py’ in using the ‘literalinclude’ directive
     for the basic wsgiref-based web server in the documentation of
     *note wsgiref: 11e.  Contributed by Stéphane Wirtel.

   - bpo-36345(7): Using the code of the ‘Tools/scripts/serve.py’ script
     as an example in the *note wsgiref: 11e. documentation.
     Contributed by Stéphane Wirtel.

   - bpo-36157(8): Added documentation for PyInterpreterState_Main().

   - bpo-33043(9): Updates the docs.python.org page with the addition of
     a 'Contributing to Docs' link at the end of the page (between
     'Reporting Bugs' and 'About Documentation').  Updates the 'Found a
     Bug' page with additional links and information in the
     Documentation Bugs section.

   - bpo-35581(10): @typing.type_check_only now allows type stubs to
     mark functions and classes not available during runtime.

   - bpo-33832(11): Add glossary entry for 'magic method'.

   - bpo-32913(12): Added re.Match.groupdict example to regex HOWTO.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36625

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30840

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36523

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36425

   (5) https://docs.python.org/zh-cn/

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36345

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36345

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36157

   (9) https://bugs.python.org/issue?@action=redirect&bpo=33043

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35581

   (11) https://bugs.python.org/issue?@action=redirect&bpo=33832

   (12) https://bugs.python.org/issue?@action=redirect&bpo=32913


File: python.info,  Node: テスト<51>,  Next: ビルド<59>,  Prev: ドキュメント<53>,  Up: Python 3 8 0 alpha 4

1.24.59.5 テスト
................

   - bpo-36719(1): regrtest now always detects uncollectable objects.
     Previously, the check was only enabled by ‘--findleaks’.  The check
     now also works with ‘-jN/--multiprocess N’.  ‘--findleaks’ becomes
     a deprecated alias to ‘--fail-env-changed’.

   - bpo-36725(2): When using multiprocessing mode (-jN), regrtest now
     better reports errors if a worker process fails, and it exits
     immediately on a worker thread failure or when interrupted.

   - bpo-36454(3): Change test_time.test_monotonic() to test only the
     lower bound of elapsed time after a sleep command rather than the
     upper bound.  This prevents unnecessary test failures on slow
     buildbots.  Patch by Victor Stinner.

   - bpo-32424(4): Improve test coverage for xml.etree.ElementTree.
     Patch by Gordon P. Hemsley.

   - bpo-32424(5): Fix typo in test_cyclic_gc() test for
     xml.etree.ElementTree.  Patch by Gordon P. Hemsley.

   - bpo-36635(6): Add a new ‘_testinternalcapi’ module to test the
     internal C API.

   - bpo-36629(7): Fix ‘test_imap4_host_default_value()’ of
     ‘test_imaplib’: catch also *note errno.ENETUNREACH: 1de9. error.

   - bpo-36611(8): Fix ‘test_sys.test_getallocatedblocks()’ when *note
     tracemalloc: 105. is enabled.

   - bpo-36560(9): Fix reference leak hunting in regrtest: compute also
     deltas (of reference count, allocated memory blocks, file
     descriptor count) during warmup, to ensure that everything is
     initialized before starting to hunt reference leaks.

   - bpo-36565(10): Fix reference hunting (‘python3 -m test -R 3:3’)
     when Python has no built-in abc module.

   - bpo-31904(11): Port test_resource to VxWorks: skip tests cases
     setting RLIMIT_FSIZE and RLIMIT_CPU.

   - bpo-31904(12): Fix test_tabnanny on VxWorks: adjust ENOENT error
     message.

   - bpo-36436(13): Fix ‘_testcapi.pymem_buffer_overflow()’: handle
     memory allocation failure.

   - bpo-31904(14): Fix test_utf8_mode on VxWorks: Python always use
     UTF-8 on VxWorks.

   - bpo-36341(15): Fix tests that may fail with PermissionError upon
     calling bind() on AF_UNIX sockets.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36719

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36725

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36454

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32424

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32424

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36635

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36629

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36611

   (9) https://bugs.python.org/issue?@action=redirect&bpo=36560

   (10) https://bugs.python.org/issue?@action=redirect&bpo=36565

   (11) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (13) https://bugs.python.org/issue?@action=redirect&bpo=36436

   (14) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (15) https://bugs.python.org/issue?@action=redirect&bpo=36341


File: python.info,  Node: ビルド<59>,  Next: Windows<52>,  Prev: テスト<51>,  Up: Python 3 8 0 alpha 4

1.24.59.6 ビルド
................

   - bpo-36747(1): Remove the stale scriptsinstall Makefile target.

   - bpo-21536(2): On Unix, C extensions are no longer linked to
     libpython except on Android and Cygwin.

     It is now possible for a statically linked Python to load a C
     extension built using a shared library Python.

     When Python is embedded, ‘libpython’ must not be loaded with
     ‘RTLD_LOCAL’, but ‘RTLD_GLOBAL’ instead.  Previously, using
     ‘RTLD_LOCAL’, it was already not possible to load C extensions
     which were not linked to ‘libpython’, such as C extensions of the
     standard library built by the ‘*shared*’ section of
     ‘Modules/Setup’.

     distutils, python-config and python-config.py have been modified.

   - bpo-36707(3): ‘./configure --with-pymalloc’ no longer adds the ‘m’
     flag to SOABI (sys.implementation.cache_tag).  Enabling or
     disabling pymalloc has no impact on the ABI.

   - bpo-36635(4): Change ‘PyAPI_FUNC(type)’, ‘PyAPI_DATA(type)’ and
     ‘PyMODINIT_FUNC’ macros of ‘pyport.h’ when ‘Py_BUILD_CORE_MODULE’
     is defined.  The ‘Py_BUILD_CORE_MODULE’ define must be now be used
     to build a C extension as a dynamic library accessing Python
     internals: export the ‘PyInit_XXX()’ function in DLL exports on
     Windows.

   - bpo-31904(5): Don't build the ‘_crypt’ extension on VxWorks.

   - bpo-36618(6): Add ‘-fmax-type-align=8’ to CFLAGS when clang
     compiler is detected.  The pymalloc memory allocator aligns memory
     on 8 bytes.  On x86-64, clang expects alignment on 16 bytes by
     default and so uses MOVAPS instruction which can lead to
     segmentation fault.  Instruct clang that Python is limited to
     alignment on 8 bytes to use MOVUPS instruction instead: slower but
     don't trigger a SIGSEGV if the memory is not aligned on 16 bytes.
     Sadly, the flag must be added to ‘CFLAGS’ and not just
     ‘CFLAGS_NODIST’, since third party C extensions can have the same
     issue.

   - bpo-36605(7): ‘make tags’ and ‘make TAGS’ now also parse
     ‘Modules/_io/*.c’ and ‘Modules/_io/*.h’.

   - bpo-36465(8): Release builds and debug builds are now ABI
     compatible: defining the ‘Py_DEBUG’ macro no longer implies the
     ‘Py_TRACE_REFS’ macro, which introduces the only ABI
     incompatibility.  The ‘Py_TRACE_REFS’ macro, which adds the *note
     sys.getobjects(): 28e. function and the *note PYTHONDUMPREFS: b9e.
     environment variable, can be set using the new ‘./configure
     --with-trace-refs’ build option.

   - bpo-36577(9): setup.py now correctly reports missing OpenSSL
     headers and libraries again.

   - bpo-36544(10): Fix regression introduced in bpo-36146(11)
     refactoring setup.py

   - bpo-36508(12): ‘python-config --ldflags’ no longer includes flags
     of the ‘LINKFORSHARED’ variable.  The ‘LINKFORSHARED’ variable must
     only be used to build executables.

   - bpo-36503(13): Remove references to "aix3" and "aix4".  Patch by M.
     Felt.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36747

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21536

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36707

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36635

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36618

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36605

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36465

   (9) https://bugs.python.org/issue?@action=redirect&bpo=36577

   (10) https://bugs.python.org/issue?@action=redirect&bpo=36544

   (11) https://bugs.python.org/issue?@action=redirect&bpo=36146

   (12) https://bugs.python.org/issue?@action=redirect&bpo=36508

   (13) https://bugs.python.org/issue?@action=redirect&bpo=36503


File: python.info,  Node: Windows<52>,  Next: macOS<41>,  Prev: ビルド<59>,  Up: Python 3 8 0 alpha 4

1.24.59.7 Windows
.................

   - bpo-35920(1): Added platform.win32_edition() and
     platform.win32_is_iot().  Added support for cross-compiling
     packages for Windows ARM32.  Skip tests that are not expected to
     work on Windows IoT Core ARM32.

   - bpo-36649(2): Remove trailing spaces for registry keys when
     installed via the Store.

   - bpo-34144(3): Fixed activate.bat to correctly update codepage when
     chcp.com returns dots in output.  Patch by Lorenz Mende.

   - bpo-36509(4): Added preset-iot layout for Windows IoT ARM
     containers.  This layout doesn't contain UI components like tkinter
     or IDLE. It also doesn't contain files to support on-target builds
     since Windows ARM32 builds must be cross-compiled when using MSVC.

   - bpo-35941(5): enum_certificates function of the ssl module now
     returns certificates from all available certificate stores inside
     windows in a query instead of returning only certificates from the
     system wide certificate store.  This includes certificates from
     these certificate stores: local machine, local machine enterprise,
     local machine group policy, current user, current user group
     policy, services, users.  ssl.enum_crls() function is changed in
     the same way to return all certificate revocation lists inside the
     windows certificate revocation list stores.

   - bpo-36441(6): Fixes creating a venv when debug binaries are
     installed.

   - bpo-36085(7): Enable better DLL resolution on Windows by using safe
     DLL search paths and adding *note os.add_dll_directory(): bdd.

   - bpo-36010(8): Add the venv standard library module to the nuget
     distribution for Windows.

   - bpo-29515(9): Add the following socket module constants on Windows:
     IPPROTO_AH IPPROTO_CBT IPPROTO_DSTOPTS IPPROTO_EGP IPPROTO_ESP
     IPPROTO_FRAGMENT IPPROTO_GGP IPPROTO_HOPOPTS IPPROTO_ICLFXBM
     IPPROTO_ICMPV6 IPPROTO_IDP IPPROTO_IGMP IPPROTO_IGP IPPROTO_IPV4
     IPPROTO_IPV6 IPPROTO_L2TP IPPROTO_MAX IPPROTO_ND IPPROTO_NONE
     IPPROTO_PGM IPPROTO_PIM IPPROTO_PUP IPPROTO_RDP IPPROTO_ROUTING
     IPPROTO_SCTP IPPROTO_ST

   - bpo-35947(10): Added current version of libffi to
     cpython-source-deps.  Change _ctypes to use current version of
     libffi on Windows.

   - bpo-34060(11): Report system load when running test suite on
     Windows.  Patch by Ammar Askar.  Based on prior work by Jeremy
     Kloth.

   - bpo-31512(12): With the Windows 10 Creators Update, non-elevated
     users can now create symlinks as long as the computer has Developer
     Mode enabled.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35920

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36649

   (3) https://bugs.python.org/issue?@action=redirect&bpo=34144

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36509

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35941

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36441

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36085

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36010

   (9) https://bugs.python.org/issue?@action=redirect&bpo=29515

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35947

   (11) https://bugs.python.org/issue?@action=redirect&bpo=34060

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31512


File: python.info,  Node: macOS<41>,  Next: IDLE<34>,  Prev: Windows<52>,  Up: Python 3 8 0 alpha 4

1.24.59.8 macOS
...............

   - bpo-34602(1): Avoid failures setting macOS stack resource limit
     with resource.setrlimit.  This reverts an earlier fix for
     bpo-18075(2) which forced a non-default stack size when building
     the interpreter executable on macOS.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34602

   (2) https://bugs.python.org/issue?@action=redirect&bpo=18075


File: python.info,  Node: IDLE<34>,  Next: Tools/Demos<35>,  Prev: macOS<41>,  Up: Python 3 8 0 alpha 4

1.24.59.9 IDLE
..............

   - bpo-36429(1): Fix starting IDLE with pyshell.  Add idlelib.pyshell
     alias at top; remove pyshell alias at bottom.  Remove obsolete
     __name__=='__main__' command.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36429


File: python.info,  Node: Tools/Demos<35>,  Next: C API<54>,  Prev: IDLE<34>,  Up: Python 3 8 0 alpha 4

1.24.59.10 Tools/Demos
......................

   - bpo-14546(1): Fix the argument handling in Tools/scripts/lll.py.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14546


File: python.info,  Node: C API<54>,  Prev: Tools/Demos<35>,  Up: Python 3 8 0 alpha 4

1.24.59.11 C API
................

   - bpo-36763(1): Fix memory leak in ‘Py_SetStandardStreamEncoding()’:
     release memory if the function is called twice.

   - bpo-36641(2): *note PyDoc_VAR: 1df0.(name) and *note PyDoc_STRVAR:
     1d5b.(name, str) now create ‘static const char name[]’ instead of
     ‘static char name[]’.  Patch by Inada Naoki.

   - bpo-36389(3): Change the value of ‘CLEANBYTE’, ‘DEADDYTE’ and
     ‘FORBIDDENBYTE’ internal constants used by debug hooks on Python
     memory allocators (*note PyMem_SetupDebugHooks(): e64. function).
     Byte patterns ‘0xCB’, ‘0xDB’ and ‘0xFB’ have been replaced with
     ‘0xCD’, ‘0xDD’ and ‘0xFD’ to use the same values than Windows CRT
     debug ‘malloc()’ and ‘free()’.

   - bpo-36443(4): Since Python 3.7.0, calling *note Py_DecodeLocale():
     dc0. before *note Py_Initialize(): 460. produces mojibake if the
     ‘LC_CTYPE’ locale is coerced and/or if the UTF-8 Mode is enabled by
     the user configuration.  The LC_CTYPE coercion and UTF-8 Mode are
     now disabled by default to fix the mojibake issue.  They must now
     be enabled explicitly (opt-in) using the new ‘_Py_PreInitialize()’
     API with ‘_PyPreConfig’.

   - bpo-36025(5): Fixed an accidental change to the datetime C API
     where the arguments to the *note PyDate_FromTimestamp(): 1df1.
     function were incorrectly interpreted as a single timestamp rather
     than an arguments tuple, which causes existing code to start
     raising *note TypeError: 198.  The backwards-incompatible change
     was only present in alpha releases of Python 3.8.  Patch by Paul
     Ganssle.

   - bpo-35810(6): Modify ‘PyObject_Init’ to correctly increase the
     refcount of heap-allocated Type objects.  Also fix the refcounts of
     the heap-allocated types that were either doing this manually or
     not decreasing the type's refcount in tp_dealloc

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36763

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36641

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36389

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36443

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36025

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35810


File: python.info,  Node: Python 3 8 0 alpha 3,  Next: Python 3 8 0 alpha 2,  Prev: Python 3 8 0 alpha 4,  Up: 変更履歴

1.24.60 Python 3.8.0 alpha 3
----------------------------

'Release date: 2019-03-25'

* Menu:

* セキュリティ: セキュリティ<45>.
* Core and Builtins: Core and Builtins<157>.
* ライブラリ: ライブラリ<160>.
* ドキュメント: ドキュメント<54>.
* テスト: テスト<52>.
* ビルド: ビルド<60>.
* Windows: Windows<53>.
* IDLE: IDLE<35>.
* Tools/Demos: Tools/Demos<36>.
* C API: C API<55>.


File: python.info,  Node: セキュリティ<45>,  Next: Core and Builtins<157>,  Up: Python 3 8 0 alpha 3

1.24.60.1 セキュリティ
......................

   - bpo-36216(1): Changes urlsplit() to raise ValueError when the URL
     contains characters that decompose under IDNA encoding
     (NFKC-normalization) into characters that affect how the URL is
     parsed.

   - bpo-35121(2): Don't send cookies of domain A without Domain
     attribute to domain B when domain A is a suffix match of domain B
     while using a cookiejar with *note
     http.cookiejar.DefaultCookiePolicy: 1df4. policy.  Patch by
     Karthikeyan Singaravelan.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36216

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35121


File: python.info,  Node: Core and Builtins<157>,  Next: ライブラリ<160>,  Prev: セキュリティ<45>,  Up: Python 3 8 0 alpha 3

1.24.60.2 Core and Builtins
...........................

   - bpo-36421(1): Fix a possible double decref in _ctypes.c's
     ‘PyCArrayType_new()’.

   - bpo-36412(2): Fix a possible crash when creating a new dictionary.

   - bpo-36398(3): Fix a possible crash in ‘structseq_repr()’.

   - bpo-36256(4): Fix bug in parsermodule when parsing a state in a DFA
     that has two or more arcs with labels of the same type.  Patch by
     Pablo Galindo.

   - bpo-36365(5): repr(structseq) is no longer limited to 512 bytes.

   - bpo-36374(6): Fix a possible null pointer dereference in
     ‘merge_consts_recursive()’.  Patch by Zackery Spytz.

   - bpo-36236(7): At Python initialization, the current directory is no
     longer prepended to *note sys.path: 3e4. if it has been removed.

   - bpo-36352(8): Python initialization now fails with an error, rather
     than silently truncating paths, if a path is too long.

   - bpo-36301(9): Python initialization now fails if decoding
     ‘pybuilddir.txt’ configuration file fails at startup.

   - bpo-36333(10): Fix leak in _PyRuntimeState_Fini.  Contributed by
     Stéphane Wirtel.

   - bpo-36332(11): The builtin *note compile(): 4b1. can now handle AST
     objects that contain assignment expressions.  Patch by Pablo
     Galindo.

   - bpo-36282(12): Improved error message for too much positional
     arguments in some builtin functions.

   - bpo-30040(13): New empty dict uses fewer memory for now.  It used
     more memory than empty dict created by ‘dict.clear()’.  And empty
     dict creation and deletion is about 2x faster.  Patch by Inada
     Naoki.

   - bpo-36262(14): Fix an unlikely memory leak on conversion from
     string to float in the function ‘_Py_dg_strtod()’ used by
     ‘float(str)’, ‘complex(str)’, *note pickle.load(): f0c, *note
     marshal.load(): 1df6, etc.

   - bpo-36252(15): Update Unicode databases to version 12.0.0.

   - bpo-36218(16): Fix a segfault occurring when sorting a list of
     heterogeneous values.  Patch contributed by Rémi Lapeyre and Elliot
     Gorokhovsky.

   - bpo-36188(17): Cleaned up left-over vestiges of Python 2 unbound
     method handling in method objects and documentation.  Patch by
     Martijn Pieters

   - bpo-36124(18): Add a new interpreter-specific dict and expose it in
     the C-API via PyInterpreterState_GetDict().  This parallels
     PyThreadState_GetDict().  However, extension modules should
     continue using PyModule_GetState() for their own internal
     per-interpreter state.

   - bpo-35975(19): Add a ‘feature_version’ flag to ‘ast.parse()’
     (documented) and ‘compile()’ (hidden) that allows tweaking the
     parser to support older versions of the grammar.  In particular, if
     ‘feature_version’ is 5 or 6, the hacks for the ‘async’ and ‘await’
     keyword from PEP 492 are reinstated.  (For 7 or higher, these are
     unconditionally treated as keywords, but they are still special
     tokens rather than ‘NAME’ tokens that the parser driver
     recognizes.)

   - bpo-31904(20): Use UTF-8 as the system encoding on VxWorks.

   - bpo-36048(21): The *note __index__(): 19e. special method will be
     used instead of *note __int__(): 19d. for implicit conversion of
     Python numbers to C integers.  Using the ‘__int__()’ method in
     implicit conversions has been deprecated.

   - bpo-35808(22): Retire pgen and use a modified version of pgen2 to
     generate the parser.  Patch by Pablo Galindo.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36421

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36412

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36398

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36256

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36365

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36374

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36236

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36352

   (9) https://bugs.python.org/issue?@action=redirect&bpo=36301

   (10) https://bugs.python.org/issue?@action=redirect&bpo=36333

   (11) https://bugs.python.org/issue?@action=redirect&bpo=36332

   (12) https://bugs.python.org/issue?@action=redirect&bpo=36282

   (13) https://bugs.python.org/issue?@action=redirect&bpo=30040

   (14) https://bugs.python.org/issue?@action=redirect&bpo=36262

   (15) https://bugs.python.org/issue?@action=redirect&bpo=36252

   (16) https://bugs.python.org/issue?@action=redirect&bpo=36218

   (17) https://bugs.python.org/issue?@action=redirect&bpo=36188

   (18) https://bugs.python.org/issue?@action=redirect&bpo=36124

   (19) https://bugs.python.org/issue?@action=redirect&bpo=35975

   (20) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (21) https://bugs.python.org/issue?@action=redirect&bpo=36048

   (22) https://bugs.python.org/issue?@action=redirect&bpo=35808


File: python.info,  Node: ライブラリ<160>,  Next: ドキュメント<54>,  Prev: Core and Builtins<157>,  Up: Python 3 8 0 alpha 3

1.24.60.3 ライブラリ
....................

   - bpo-36401(1): The class documentation created by pydoc now has a
     separate section for readonly properties.

   - bpo-36320(2): The typing.NamedTuple() class has deprecated the
     _field_types attribute in favor of the __annotations__ attribute
     which carried the same information.  Also, both attributes were
     converted from OrderedDict to a regular dict.

   - bpo-34745(3): Fix *note asyncio: b. ssl memory issues caused by
     circular references

   - bpo-36324(4): Add method to statistics.NormalDist for computing the
     inverse cumulative normal distribution.

   - bpo-36321(5): collections.namedtuple() misspelled the name of an
     attribute.  To be consistent with typing.NamedTuple, the attribute
     name should have been "_field_defaults" instead of
     "_fields_defaults".  For backwards compatibility, both spellings
     are now created.  The misspelled version may be removed in the
     future.

   - bpo-36297(6): "unicode_internal" codec is removed.  It was
     deprecated since Python 3.3.  Patch by Inada Naoki.

   - bpo-36298(7): Raise ModuleNotFoundError in pyclbr when a module
     can't be found.  Thanks to 'mental' for the bug report.

   - bpo-36268(8): Switch the default format used for writing tars with
     *note tarfile: e4. to the modern POSIX.1-2001 pax standard, from
     the vendor-specific GNU. Contributed by C.A.M. Gerlach.

   - bpo-36285(9): Fix integer overflows in the array module.  Patch by
     Stephan Hohe.

   - bpo-31904(10): Add _signal module support for VxWorks.

   - bpo-36272(11): *note logging: 8b. does not silently ignore
     RecursionError anymore.  Patch contributed by Rémi Lapeyre.

   - bpo-36280(12): Add a kind field to ast.Constant.  It is 'u' if the
     literal has a 'u' prefix (i.e.  a Python 2 style unicode literal),
     else None.

   - bpo-35931(13): The *note pdb: aa. ‘debug’ command now gracefully
     handles all exceptions.

   - bpo-36251(14): Fix format strings used for stderrprinter and
     re.Match reprs.  Patch by Stephan Hohe.

   - bpo-36235(15): Fix ‘CFLAGS’ in ‘customize_compiler()’ of
     ‘distutils.sysconfig’: when the ‘CFLAGS’ environment variable is
     defined, don't override ‘CFLAGS’ variable with the ‘OPT’ variable
     anymore.  Initial patch written by David Malcolm.

   - bpo-35807(16): Update ensurepip to install pip 19.0.3 and
     setuptools 40.8.0.

   - bpo-36139(17): Release GIL when closing *note mmap: 519. objects.

   - bpo-36179(18): Fix two unlikely reference leaks in _hashopenssl.
     The leaks only occur in out-of-memory cases.

   - bpo-36169(19): Add overlap() method to statistics.NormalDist.
     Computes the overlapping coefficient for two normal distributions.

   - bpo-36103(20): Default buffer size used by ‘shutil.copyfileobj()’
     is changed from 16 KiB to 64 KiB on non-Windows platform to reduce
     system call overhead.  Contributed by Inada Naoki.

   - bpo-36130(21): Fix ‘pdb’ with ‘skip=...’ when stepping into a frame
     without a ‘__name__’ global.  Patch by Anthony Sottile.

   - bpo-35652(22): shutil.copytree(copy_function=...)  erroneously pass
     DirEntry instead of a path string.

   - bpo-35178(23): Ensure custom *note warnings.formatwarning(): 1df8.
     function can receive ‘line’ as positional argument.  Based on patch
     by Tashrif Billah.

   - bpo-36106(24): Resolve potential name clash with libm's sinpi().
     Patch by Dmitrii Pasechnik.

   - bpo-36091(25): Clean up reference to async generator in Lib/types.
     Patch by Henry Chen.

   - bpo-36043(26): ‘FileCookieJar’ supports *note path-like object:
     5a1.  Contributed by Stéphane Wirtel

   - bpo-35899(27): Enum has been fixed to correctly handle empty
     strings and strings with non-Latin characters (ie.  'α', 'א')
     without crashing.  Original patch contributed by Maxwell.  Assisted
     by Stéphane Wirtel.

   - bpo-21269(28): Add ‘args’ and ‘kwargs’ properties to mock call
     objects.  Contributed by Kumar Akshay.

   - bpo-30670(29): ‘pprint.pp’ has been added to pretty-print objects
     with dictionary keys being sorted with their insertion order by
     default.  Parameter 'sort_dicts' has been added to ‘pprint.pprint’,
     ‘pprint.pformat’ and ‘pprint.PrettyPrinter’.  Contributed by Rémi
     Lapeyre.

   - bpo-35843(30): Implement ‘__getitem__’ for ‘_NamespacePath’.  Patch
     by Anthony Sottile.

   - bpo-35802(31): Clean up code which checked presence of ‘os.stat’ /
     ‘os.lstat’ / ‘os.chmod’ which are always present.  Patch by Anthony
     Sottile.

   - bpo-35715(32): Librates the return value of a ProcessPoolExecutor
     _process_worker after it's no longer needed to free memory

   - bpo-35493(33): Use *note multiprocessing.connection.wait(): 12f7.
     instead of polling each 0.2 seconds for worker updates in
     ‘multiprocessing.Pool’.  Patch by Pablo Galindo.

   - bpo-35661(34): Store the venv prompt in pyvenv.cfg.

   - bpo-35121(35): Don't set cookie for a request when the request path
     is a prefix match of the cookie's path attribute but doesn't end
     with "/".  Patch by Karthikeyan Singaravelan.

   - bpo-21478(36): Calls to a child function created with *note
     unittest.mock.create_autospec(): 1934. should propagate to the
     parent.  Patch by Karthikeyan Singaravelan.

   - bpo-35198(37): Fix C++ extension compilation on AIX

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36401

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36320

   (3) https://bugs.python.org/issue?@action=redirect&bpo=34745

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36324

   (5) https://bugs.python.org/issue?@action=redirect&bpo=36321

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36297

   (7) https://bugs.python.org/issue?@action=redirect&bpo=36298

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36268

   (9) https://bugs.python.org/issue?@action=redirect&bpo=36285

   (10) https://bugs.python.org/issue?@action=redirect&bpo=31904

   (11) https://bugs.python.org/issue?@action=redirect&bpo=36272

   (12) https://bugs.python.org/issue?@action=redirect&bpo=36280

   (13) https://bugs.python.org/issue?@action=redirect&bpo=35931

   (14) https://bugs.python.org/issue?@action=redirect&bpo=36251

   (15) https://bugs.python.org/issue?@action=redirect&bpo=36235

   (16) https://bugs.python.org/issue?@action=redirect&bpo=35807

   (17) https://bugs.python.org/issue?@action=redirect&bpo=36139

   (18) https://bugs.python.org/issue?@action=redirect&bpo=36179

   (19) https://bugs.python.org/issue?@action=redirect&bpo=36169

   (20) https://bugs.python.org/issue?@action=redirect&bpo=36103

   (21) https://bugs.python.org/issue?@action=redirect&bpo=36130

   (22) https://bugs.python.org/issue?@action=redirect&bpo=35652

   (23) https://bugs.python.org/issue?@action=redirect&bpo=35178

   (24) https://bugs.python.org/issue?@action=redirect&bpo=36106

   (25) https://bugs.python.org/issue?@action=redirect&bpo=36091

   (26) https://bugs.python.org/issue?@action=redirect&bpo=36043

   (27) https://bugs.python.org/issue?@action=redirect&bpo=35899

   (28) https://bugs.python.org/issue?@action=redirect&bpo=21269

   (29) https://bugs.python.org/issue?@action=redirect&bpo=30670

   (30) https://bugs.python.org/issue?@action=redirect&bpo=35843

   (31) https://bugs.python.org/issue?@action=redirect&bpo=35802

   (32) https://bugs.python.org/issue?@action=redirect&bpo=35715

   (33) https://bugs.python.org/issue?@action=redirect&bpo=35493

   (34) https://bugs.python.org/issue?@action=redirect&bpo=35661

   (35) https://bugs.python.org/issue?@action=redirect&bpo=35121

   (36) https://bugs.python.org/issue?@action=redirect&bpo=21478

   (37) https://bugs.python.org/issue?@action=redirect&bpo=35198


File: python.info,  Node: ドキュメント<54>,  Next: テスト<52>,  Prev: ライブラリ<160>,  Up: Python 3 8 0 alpha 3

1.24.60.4 ドキュメント
......................

   - bpo-36329(1): Declare the path of the Python binary for the usage
     of ‘Tools/scripts/serve.py’ when executing ‘make -C Doc/ serve’.
     Contributed by Stéphane Wirtel

   - bpo-36138(2): Improve documentation about converting
     datetime.timedelta to scalars.

   - bpo-21314(3): A new entry was added to the Core Language Section of
     the Programming FAQ, which explaines the usage of slash(/) in the
     signature of a function.  Patch by Lysandros Nikolaou

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36329

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36138

   (3) https://bugs.python.org/issue?@action=redirect&bpo=21314


File: python.info,  Node: テスト<52>,  Next: ビルド<60>,  Prev: ドキュメント<54>,  Up: Python 3 8 0 alpha 3

1.24.60.5 テスト
................

   - bpo-36234(1): test_posix.PosixUidGidTests: add tests for invalid
     uid/gid type (str).  Initial patch written by David Malcolm.

   - bpo-29571(2): Fix ‘test_re.test_locale_flag()’: use
     ‘locale.getpreferredencoding()’ rather than ‘locale.getlocale()’ to
     get the locale encoding.  With some locales, ‘locale.getlocale()’
     returns the wrong encoding.

   - bpo-36123(3): Fix race condition in test_socket.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36234

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29571

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36123


File: python.info,  Node: ビルド<60>,  Next: Windows<53>,  Prev: テスト<52>,  Up: Python 3 8 0 alpha 3

1.24.60.6 ビルド
................

   - bpo-36356(1): Fix leaks that led to build failure when configured
     with address sanitizer.

   - bpo-36146(2): Add ‘TEST_EXTENSIONS’ constant to ‘setup.py’ to allow
     to not build test extensions like ‘_testcapi’.

   - bpo-36146(3): Fix setup.py on macOS: only add ‘/usr/include/ffi’ to
     include directories of _ctypes, not for all extensions.

   - bpo-31904(4): Enable build system to cross-build for VxWorks RTOS.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36356

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36146

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36146

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31904


File: python.info,  Node: Windows<53>,  Next: IDLE<35>,  Prev: ビルド<60>,  Up: Python 3 8 0 alpha 3

1.24.60.7 Windows
.................

   - bpo-36312(1): Fixed decoders for the following code pages: 50220,
     50221, 50222, 50225, 50227, 50229, 57002 through 57011, 65000 and
     42.

   - bpo-36264(2): Don't honor POSIX ‘HOME’ in ‘os.path.expanduser’ on
     windows.  Patch by Anthony Sottile.

   - bpo-24643(3): Fix name collisions due to ‘#define timezone
     _timezone’ in PC/pyconfig.h.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36312

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36264

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24643


File: python.info,  Node: IDLE<35>,  Next: Tools/Demos<36>,  Prev: Windows<53>,  Up: Python 3 8 0 alpha 3

1.24.60.8 IDLE
..............

   - bpo-36405(1): Use dict unpacking in idlelib.

   - bpo-36396(2): Remove fgBg param of idlelib.config.GetHighlight().
     This param was only used twice and changed the return type.

   - bpo-36176(3): Fix IDLE autocomplete & calltip popup colors.
     Prevent conflicts with Linux dark themes (and slightly darken
     calltip background).

   - bpo-23205(4): For the grep module, add tests for findfiles,
     refactor findfiles to be a module-level function, and refactor
     findfiles to use os.walk.

   - bpo-23216(5): Add docstrings to IDLE search modules.

   - bpo-36152(6): Remove colorizer.ColorDelegator.close_when_done and
     the corresponding argument of .close().  In IDLE, both have always
     been None or False since 2007.

   - bpo-32129(7): Avoid blurry IDLE application icon on macOS with Tk
     8.6.  Patch by Kevin Walzer.

   - bpo-36096(8): Refactor class variables to instance variables in
     colorizer.

   - bpo-30348(9): Increase test coverage of idlelib.autocomplete by
     30%.  Patch by Louie Lu

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36405

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36396

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36176

   (4) https://bugs.python.org/issue?@action=redirect&bpo=23205

   (5) https://bugs.python.org/issue?@action=redirect&bpo=23216

   (6) https://bugs.python.org/issue?@action=redirect&bpo=36152

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32129

   (8) https://bugs.python.org/issue?@action=redirect&bpo=36096

   (9) https://bugs.python.org/issue?@action=redirect&bpo=30348


File: python.info,  Node: Tools/Demos<36>,  Next: C API<55>,  Prev: IDLE<35>,  Up: Python 3 8 0 alpha 3

1.24.60.9 Tools/Demos
.....................

   - bpo-35132(1): Fix py-list and py-bt commands of python-gdb.py on
     gdb7.

   - bpo-32217(2): Fix freeze script on Windows.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35132

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32217


File: python.info,  Node: C API<55>,  Prev: Tools/Demos<36>,  Up: Python 3 8 0 alpha 3

1.24.60.10 C API
................

   - bpo-36381(1): Raise ‘DeprecationWarning’ when '#' formats are used
     for building or parsing values without ‘PY_SSIZE_T_CLEAN’.

   - bpo-36142(2): The whole coreconfig.h header is now excluded from
     Py_LIMITED_API. Move functions definitions into a new internal
     pycore_coreconfig.h header.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36381

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36142


File: python.info,  Node: Python 3 8 0 alpha 2,  Next: Python 3 8 0 alpha 1,  Prev: Python 3 8 0 alpha 3,  Up: 変更履歴

1.24.61 Python 3.8.0 alpha 2
----------------------------

'Release date: 2019-02-25'

* Menu:

* Core and Builtins: Core and Builtins<158>.
* ライブラリ: ライブラリ<161>.
* ドキュメント: ドキュメント<55>.
* テスト: テスト<53>.
* Windows: Windows<54>.
* IDLE: IDLE<36>.


File: python.info,  Node: Core and Builtins<158>,  Next: ライブラリ<161>,  Up: Python 3 8 0 alpha 2

1.24.61.1 Core and Builtins
...........................

   - bpo-36052(1): Raise a *note SyntaxError: 18e. when assigning a
     value to ‘__debug__’ with the Assignment Operator.  Contributed by
     Stéphane Wirtel and Pablo Galindo.

   - bpo-36012(2): Doubled the speed of class variable writes.  When a
     non-dunder attribute was updated, there was an unnecessary call to
     update slots.

   - bpo-35942(3): The error message emitted when returning invalid
     types from ‘__fspath__’ in interfaces that allow passing *note
     PathLike: e4b. objects has been improved and now it does explain
     the origin of the error.

   - bpo-36016(4): ‘gc.get_objects’ can now receive an optional
     parameter indicating a generation to get objects from.  Patch by
     Pablo Galindo.

   - bpo-1054041(5): When the main interpreter exits due to an uncaught
     KeyboardInterrupt, the process now exits in the appropriate manner
     for its parent process to detect that a SIGINT or ^C terminated the
     process.  This allows shells and batch scripts to understand that
     the user has asked them to stop.

   - bpo-35992(6): Fix ‘__class_getitem__()’ not being called on a class
     with a custom non-subscriptable metaclass.

   - bpo-35993(7): Fix a crash on fork when using subinterpreters.
     Contributed by Stéphane Wirtel

   - bpo-35991(8): Fix a potential double free in
     Modules/_randommodule.c.

   - bpo-35961(9): Fix a crash in slice_richcompare(): use strong
     references rather than stolen references for the two temporary
     internal tuples.

   - bpo-35911(10): Enable the creation of cell objects by adding a
     ‘cell.__new__’ method, and expose the type ‘cell’ in ‘Lib/types.py’
     under the name CellType.  Patch by Pierre Glaser.

   - bpo-12822(11): Use monotonic clock for ‘pthread_cond_timedwait’
     when ‘pthread_condattr_setclock’ and ‘CLOCK_MONOTONIC’ are
     available.

   - bpo-15248(12): The compiler emits now syntax warnings in the case
     when a comma is likely missed before tuple or list.

   - bpo-35886(13): The implementation of PyInterpreterState has been
     moved into the internal header files (guarded by Py_BUILD_CORE).

   - bpo-31506(14): Clarify the errors reported when ‘object.__new__’
     and ‘object.__init__’ receive more than one argument.  Contributed
     by Sanyam Khurana.

   - bpo-35724(15): Signal-handling is now guaranteed to happen relative
     to the main interpreter.

   - bpo-33608(16): We added a new internal _Py_AddPendingCall() that
     operates relative to the provided interpreter.  This allows us to
     use the existing implementation to ask another interpreter to do
     work that cannot be done in the current interpreter, like decref an
     object the other interpreter owns.  The existing
     Py_AddPendingCall() only operates relative to the main interpreter.

   - bpo-33989(17): Fix a possible crash in *note list.sort(): dc8. when
     sorting objects with ‘ob_type->tp_richcompare == NULL’.  Patch by
     Zackery Spytz.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36052

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36012

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35942

   (4) https://bugs.python.org/issue?@action=redirect&bpo=36016

   (5) https://bugs.python.org/issue?@action=redirect&bpo=1054041

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35992

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35993

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35991

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35961

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35911

   (11) https://bugs.python.org/issue?@action=redirect&bpo=12822

   (12) https://bugs.python.org/issue?@action=redirect&bpo=15248

   (13) https://bugs.python.org/issue?@action=redirect&bpo=35886

   (14) https://bugs.python.org/issue?@action=redirect&bpo=31506

   (15) https://bugs.python.org/issue?@action=redirect&bpo=35724

   (16) https://bugs.python.org/issue?@action=redirect&bpo=33608

   (17) https://bugs.python.org/issue?@action=redirect&bpo=33989


File: python.info,  Node: ライブラリ<161>,  Next: ドキュメント<55>,  Prev: Core and Builtins<158>,  Up: Python 3 8 0 alpha 2

1.24.61.2 ライブラリ
....................

   - bpo-35512(1): *note unittest.mock.patch.dict(): 1967. used as a
     decorator with string target resolves the target during function
     call instead of during decorator construction.  Patch by
     Karthikeyan Singaravelan.

   - bpo-36018(2): Add statistics.NormalDist, a tool for creating and
     manipulating normal distributions of random variable.  Features a
     composite class that treats the mean and standard deviation of
     measurement data as single entity.

   - bpo-35904(3): Added statistics.fmean() as a faster, floating-point
     variant of the existing mean() function.

   - bpo-35918(4): Removed broken ‘has_key’ method from
     multiprocessing.managers.SyncManager.dict.  Contributed by Rémi
     Lapeyre.

   - bpo-18283(5): Add support for bytes to *note shutil.which(): 6db.

   - bpo-35960(6): Fix *note dataclasses.field(): 195a. throwing away
     empty mapping objects passed as metadata.

   - bpo-35500(7): Write expected and actual call parameters on separate
     lines in *note unittest.mock.Mock.assert_called_with(): 1e03.
     assertion errors.  Contributed by Susan Su.

   - bpo-35931(8): The *note pdb: aa. ‘debug’ command now gracefully
     handles syntax errors.

   - bpo-24209(9): In http.server script, rely on getaddrinfo to bind to
     preferred address based on the bind parameter.  Now default bind or
     binding to a name may bind to IPv6 or dual-stack, depending on the
     environment.

   - bpo-35321(10): Set ‘__spec__.origin’ of ‘_frozen_importlib’ to
     frozen so that it matches the behavior of
     ‘_frozen_importlib_external’.  Patch by Nina Zakharenko.

   - bpo-35378(11): Fix a reference issue inside ‘multiprocessing.Pool’
     that caused the pool to remain alive if it was deleted without
     being closed or terminated explicitly.  A new strong reference is
     added to the pool iterators to link the lifetime of the pool to the
     lifetime of its iterators so the pool does not get destroyed if a
     pool iterator is still alive.

   - bpo-34294(12): re module, fix wrong capturing groups in rare cases.
     *note re.search(): 1444, *note re.findall(): 122b, *note re.sub():
     5a3. and other functions that scan through string looking for a
     match, should reset capturing groups between two match attempts.
     Patch by Ma Lin.

   - bpo-35615(13): *note weakref: 11a.: Fix a RuntimeError when copying
     a WeakKeyDictionary or a WeakValueDictionary, due to some keys or
     values disappearing while iterating.

   - bpo-35606(14): Implement *note math.prod(): bf7. as analogous
     function to *note sum(): 695. that returns the product of a 'start'
     value (default: 1) times an iterable of numbers.  Patch by Pablo
     Galindo.

   - bpo-32417(15): Performing arithmetic between *note
     datetime.datetime: 4e2. subclasses and *note datetime.timedelta:
     bc3. now returns an object of the same type as the *note
     datetime.datetime: 4e2. subclass.  As a result, *note
     datetime.datetime.astimezone(): bc4. and alternate constructors
     like *note datetime.datetime.now(): 711. and
     ‘datetime.fromtimestamp()’ called with a ‘tz’ argument now 'also'
     retain their subclass.

   - bpo-35153(16): Add 'headers' optional keyword-only parameter to
     *note xmlrpc.client.ServerProxy: c4c, ‘xmlrpc.client.Transport’ and
     ‘xmlrpc.client.SafeTransport’.  Patch by Cédric Krier.

   - bpo-34572(17): Fix C implementation of pickle.loads to use
     importlib's locking mechanisms, and thereby avoid using partially
     loaded modules.  Patch by Tim Burgess.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35512

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36018

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35904

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35918

   (5) https://bugs.python.org/issue?@action=redirect&bpo=18283

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35960

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35500

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35931

   (9) https://bugs.python.org/issue?@action=redirect&bpo=24209

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35321

   (11) https://bugs.python.org/issue?@action=redirect&bpo=35378

   (12) https://bugs.python.org/issue?@action=redirect&bpo=34294

   (13) https://bugs.python.org/issue?@action=redirect&bpo=35615

   (14) https://bugs.python.org/issue?@action=redirect&bpo=35606

   (15) https://bugs.python.org/issue?@action=redirect&bpo=32417

   (16) https://bugs.python.org/issue?@action=redirect&bpo=35153

   (17) https://bugs.python.org/issue?@action=redirect&bpo=34572


File: python.info,  Node: ドキュメント<55>,  Next: テスト<53>,  Prev: ライブラリ<161>,  Up: Python 3 8 0 alpha 2

1.24.61.3 ドキュメント
......................

   - bpo-36083(1): Fix formatting of -check-hash-based-pycs options in
     the manpage Synopsis.

   - bpo-36007(2): Bump minimum sphinx version to 1.8.  Patch by Anthony
     Sottile.

   - bpo-22062(3): Update documentation and docstrings for pathlib.
     Original patch by Mike Short.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=36083

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36007

   (3) https://bugs.python.org/issue?@action=redirect&bpo=22062


File: python.info,  Node: テスト<53>,  Next: Windows<54>,  Prev: ドキュメント<55>,  Up: Python 3 8 0 alpha 2

1.24.61.4 テスト
................

   - bpo-27313(1): Avoid test_ttk_guionly ComboboxTest failure with
     macOS Cocoa Tk.

   - bpo-36019(2): Add test.support.TEST_HTTP_URL and replace references
     of ‘http://www.example.com’ by this new constant.  Contributed by
     Stéphane Wirtel.

   - bpo-36037(3): Fix test_ssl for strict OpenSSL configuration like
     RHEL8 strict crypto policy.  Use older TLS version for minimum TLS
     version of the server SSL context if needed, to test TLS version
     older than default minimum TLS version.

   - bpo-35798(4): Added ‘test.support.check_syntax_warning()’.

   - bpo-35505(5): Make test_imap4_host_default_value independent on
     whether the local IMAP server is running.

   - bpo-35917(6): multiprocessing: provide unit tests for SyncManager
     and SharedMemoryManager classes + all the shareable types which are
     supposed to be supported by them.  (patch by Giampaolo Rodola)

   - bpo-35704(7): Skip ‘test_shutil.test_unpack_archive_xztar’ to
     prevent a MemoryError on 32-bit AIX when MAXDATA setting is less
     than 0x20000000.

     Patch by Michael Felt (aixtools)

   - bpo-34720(8): Assert m_state != NULL to mimic GC traversal
     functions that do not correctly handle module creation when the
     module state has not been created.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27313

   (2) https://bugs.python.org/issue?@action=redirect&bpo=36019

   (3) https://bugs.python.org/issue?@action=redirect&bpo=36037

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35798

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35505

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35917

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35704

   (8) https://bugs.python.org/issue?@action=redirect&bpo=34720


File: python.info,  Node: Windows<54>,  Next: IDLE<36>,  Prev: テスト<53>,  Up: Python 3 8 0 alpha 2

1.24.61.5 Windows
.................

   - bpo-35976(1): Added ARM build support to Windows build files in
     PCBuild.

   - bpo-35692(2): ‘pathlib’ no longer raises when checking file and
     directory existence on drives that are not ready

   - bpo-35872(3): Uses the base Python executable when invoking venv in
     a virtual environment

   - bpo-35873(4): Prevents venv paths being inherited by child
     processes

   - bpo-35299(5): Fix sysconfig detection of the source directory and
     distutils handling of pyconfig.h during PGO profiling

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35976

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35692

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35872

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35873

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35299


File: python.info,  Node: IDLE<36>,  Prev: Windows<54>,  Up: Python 3 8 0 alpha 2

1.24.61.6 IDLE
..............

   - bpo-24310(1): IDLE - Document settings dialog font tab sample.

   - bpo-35833(2): Revise IDLE doc for control codes sent to Shell.  Add
     a code example block.

   - bpo-35689(3): Add docstrings and unittests for colorizer.py.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24310

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35833

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35689


File: python.info,  Node: Python 3 8 0 alpha 1,  Next: Python 3 7 0 final,  Prev: Python 3 8 0 alpha 2,  Up: 変更履歴

1.24.62 Python 3.8.0 alpha 1
----------------------------

'Release date: 2019-02-03'

* Menu:

* セキュリティ: セキュリティ<46>.
* Core and Builtins: Core and Builtins<159>.
* ライブラリ: ライブラリ<162>.
* ドキュメント: ドキュメント<56>.
* テスト: テスト<54>.
* ビルド: ビルド<61>.
* Windows: Windows<55>.
* macOS: macOS<42>.
* IDLE: IDLE<37>.
* Tools/Demos: Tools/Demos<37>.
* C API: C API<56>.


File: python.info,  Node: セキュリティ<46>,  Next: Core and Builtins<159>,  Up: Python 3 8 0 alpha 1

1.24.62.1 セキュリティ
......................

   - bpo-35746(1): CVE 2019-5010(2): Fix a NULL pointer deref in ssl
     module.  The cert parser did not handle CRL distribution points
     with empty DP or URI correctly.  A malicious or buggy certificate
     can result into segfault.  Vulnerability (TALOS-2018-0758) reported
     by Colin Read and Nicolas Edet of Cisco.

   - bpo-34812(3): The *note -I: b57. command line option (run Python in
     isolated mode) is now also copied by the *note multiprocessing: 98.
     and ‘distutils’ modules when spawning child processes.  Previously,
     only *note -E: b56. and *note -s: 15a6. options (enabled by *note
     -I: b57.) were copied.

   - bpo-34791(4): The xml.sax and xml.dom.domreg no longer use
     environment variables to override parser implementations when
     sys.flags.ignore_environment is set by -E or -I arguments.

   - bpo-17239(5): The xml.sax and xml.dom.minidom parsers no longer
     processes external entities by default.  External DTD and ENTITY
     declarations no longer load files or create network connections.

   - bpo-34623(6): CVE 2018-14647(7): The C accelerated _elementtree
     module now initializes hash randomization salt from _Py_HashSecret
     instead of libexpat's default CSPRNG.

   - bpo-34405(8): Updated to OpenSSL 1.1.0i for Windows builds.

   - bpo-33871(9): Fixed sending the part of the file in *note
     os.sendfile(): d05. on macOS. Using the 'trailers' argument could
     cause sending more bytes from the input file than was specified.

   - bpo-32533(10): Fixed thread-safety of error handling in _ssl.

   - bpo-33136(11): Harden ssl module against LibreSSL CVE
     2018-8970(12).  X509_VERIFY_PARAM_set1_host() is called with an
     explicit namelen.  A new test ensures that NULL bytes are not
     allowed.

   - bpo-33001(13): Minimal fix to prevent buffer overrun in os.symlink
     on Windows

   - bpo-32981(14): Regexes in difflib and poplib were vulnerable to
     catastrophic backtracking.  These regexes formed potential DOS
     vectors (REDOS). They have been refactored.  This resolves CVE
     2018-1060(15) and CVE 2018-1061(16).  Patch by Jamie Davis.

   - bpo-28414(17): The ssl module now allows users to perform their own
     IDN en/decoding when using SNI.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35746

   (2) https://www.cve.org/CVERecord?id=CVE-2019-5010

   (3) https://bugs.python.org/issue?@action=redirect&bpo=34812

   (4) https://bugs.python.org/issue?@action=redirect&bpo=34791

   (5) https://bugs.python.org/issue?@action=redirect&bpo=17239

   (6) https://bugs.python.org/issue?@action=redirect&bpo=34623

   (7) https://www.cve.org/CVERecord?id=CVE-2018-14647

   (8) https://bugs.python.org/issue?@action=redirect&bpo=34405

   (9) https://bugs.python.org/issue?@action=redirect&bpo=33871

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32533

   (11) https://bugs.python.org/issue?@action=redirect&bpo=33136

   (12) https://www.cve.org/CVERecord?id=CVE-2018-8970

   (13) https://bugs.python.org/issue?@action=redirect&bpo=33001

   (14) https://bugs.python.org/issue?@action=redirect&bpo=32981

   (15) https://www.cve.org/CVERecord?id=CVE-2018-1060

   (16) https://www.cve.org/CVERecord?id=CVE-2018-1061

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28414


File: python.info,  Node: Core and Builtins<159>,  Next: ライブラリ<162>,  Prev: セキュリティ<46>,  Up: Python 3 8 0 alpha 1

1.24.62.2 Core and Builtins
...........................

   - bpo-35877(1): Make parenthesis optional for named expressions in
     while statement.  Patch by Karthikeyan Singaravelan.

   - bpo-35814(2): Allow same right hand side expressions in annotated
     assignments as in normal ones.  In particular, ‘x: Tuple[int, int]
     = 1, 2’ (without parentheses on the right) is now allowed.

   - bpo-35766(3): Add the option to parse PEP 484 type comments in the
     ast module.  (Off by default.)  This is merging the key
     functionality of the third party fork thereof,
     [typed_ast](‘https://github.com/python/typed_ast’).

   - bpo-35713(4): Reorganize Python initialization to get working
     exceptions and sys.stderr earlier.

   - bpo-33416(5): Add end line and end column position information to
     the Python AST nodes.  This is a C-level backwards incompatible
     change.

   - bpo-35720(6): Fixed a minor memory leak in
     pymain_parse_cmdline_impl function in Modules/main.c

   - bpo-35634(7): ‘func(**kwargs)’ will now raise an error when
     ‘kwargs’ is a mapping containing multiple entries with the same
     key.  An error was already raised when other keyword arguments are
     passed before ‘**kwargs’ since Python 3.6.

   - bpo-35623(8): Fix a crash when sorting very long lists.  Patch by
     Stephan Hohe.

   - bpo-35214(9): clang Memory Sanitizer build instrumentation was
     added to work around false positives from posix, socket, time,
     test_io, and test_faulthandler.

   - bpo-35560(10): Fix an assertion error in *note format(): 199. in
     debug build for floating-point formatting with "n" format, zero
     padding and small width.  Release build is not impacted.  Patch by
     Karthikeyan Singaravelan.

   - bpo-35552(11): Format characters ‘%s’ and ‘%V’ in *note
     PyUnicode_FromFormat(): 62b. and ‘%s’ in *note
     PyBytes_FromFormat(): 1e0b. no longer read memory past the limit if
     'precision' is specified.

   - bpo-35504(12): Fix segfaults and *note SystemError: 795.s when
     deleting certain attributes.  Patch by Zackery Spytz.

   - bpo-35504(13): Fixed a SystemError when delete the
     characters_written attribute of an OSError.

   - bpo-35494(14): Improved syntax error messages for unbalanced
     parentheses in f-string.

   - bpo-35444(15): Fixed error handling in pickling methods when fail
     to look up builtin "getattr".  Sped up pickling iterators.

   - bpo-35436(16): Fix various issues with memory allocation error
     handling.  Patch by Zackery Spytz.

   - bpo-35423(17): Separate the signal handling trigger in the eval
     loop from the "pending calls" machinery.  There is no semantic
     change and the difference in performance is insignificant.

   - bpo-35357(18): Internal attributes' names of unittest.mock._Call
     and unittest.mock.MagicProxy (name, parent & from_kall) are now
     prefixed with _mock_ in order to prevent clashes with widely used
     object attributes.  Fixed minor typo in test function name.

   - bpo-35372(19): Fixed the code page decoder for input longer than 2
     GiB containing undecodable bytes.

   - bpo-35336(20): Fix PYTHONCOERCECLOCALE=1 environment variable: only
     coerce the C locale if the LC_CTYPE locale is "C".

   - bpo-31241(21): The 'lineno' and 'col_offset' attributes of AST
     nodes for list comprehensions, generator expressions and tuples are
     now point to the opening parenthesis or square brace.  For tuples
     without parenthesis they point to the position of the first item.

   - bpo-33954(22): For *note str.format(): 833, ‘float.__format__()’
     and ‘complex.__format__()’ methods for non-ASCII decimal point when
     using the "n" formatter.

   - bpo-35269(23): Fix a possible segfault involving a newly created
     coroutine.  Patch by Zackery Spytz.

   - bpo-35224(24): Implement PEP 572(25) (assignment expressions).
     Patch by Emily Morehouse.

   - bpo-32492(26): Speed up ‘namedtuple()’ attribute access by 1.6x
     using a C fast-path for the name descriptors.  Patch by Pablo
     Galindo.

   - bpo-35214(27): Fixed an out of bounds memory access when parsing a
     truncated unicode escape sequence at the end of a string such as
     ‘'\N'’.  It would read one byte beyond the end of the memory
     allocation.

   - bpo-35214(28): The interpreter and extension modules have had
     annotations added so that they work properly under clang's Memory
     Sanitizer.  A new configure flag -with-memory-sanitizer has been
     added to make test builds of this nature easier to perform.

   - bpo-35193(29): Fix an off by one error in the bytecode peephole
     optimizer where it could read bytes beyond the end of bounds of an
     array when removing unreachable code.  This bug was present in
     every release of Python 3.6 and 3.7 until now.

   - bpo-35169(30): Improved error messages for forbidden assignments.

   - bpo-34022(31): Fix handling of hash-based bytecode files in *note
     zipimport: 138.  Patch by Elvis Pranskevichus.

   - bpo-28401(32): Debug builds will no longer to attempt to import
     extension modules built for the ABI as they were never compatible
     to begin with.  Patch by Stefano Rivera.

   - bpo-29341(33): Clarify in the docstrings of *note os: a5. methods
     that path-like objects are also accepted as input parameters.

   - bpo-35050(34): *note socket: d1.: Fix off-by-one bug in length
     check for ‘AF_ALG’ name and type.

   - bpo-29743(35): Raise *note ValueError: 2ec. instead of *note
     OverflowError: a81. in case of a negative ‘_length_’ in a *note
     ctypes.Array: 1e0c. subclass.  Also raise *note TypeError: 198.
     instead of *note AttributeError: 5f0. for non-integer ‘_length_’.
     Original patch by Oren Milman.

   - bpo-16806(36): Fix ‘lineno’ and ‘col_offset’ for multi-line string
     tokens.

   - bpo-35029(37): *note SyntaxWarning: 1ae. raised as an exception at
     code generation time will be now replaced with a *note SyntaxError:
     18e. for better error reporting.

   - bpo-34983(38): Expose *note symtable.Symbol.is_nonlocal(): 1e0d. in
     the symtable module.  Patch by Pablo Galindo.

   - bpo-34974(39): *note bytes: 192. and *note bytearray: 344.
     constructors no longer convert unexpected exceptions (e.g.  *note
     MemoryError: 179e. and *note KeyboardInterrupt: bc5.) to *note
     TypeError: 198.

   - bpo-34939(40): Allow annotated names in module namespace that are
     declared global before the annotation happens.  Patch by Pablo
     Galindo.

   - bpo-34973(41): Fixed crash in *note bytes(): 192. when the *note
     list: 24d. argument is mutated while it is iterated.

   - bpo-34876(42): The 'lineno' and 'col_offset' attributes of the AST
     for decorated function and class refer now to the position of the
     corresponding ‘def’, ‘async def’ and ‘class’ instead of the
     position of the first decorator.  This leads to more correct line
     reporting in tracing.  This is the only case when the position of
     child AST nodes can precede the position of the parent AST node.

   - bpo-34879(43): Fix a possible null pointer dereference in
     bytesobject.c.  Patch by Zackery Spytz.

   - bpo-34784(44): Fix the implementation of PyStructSequence_NewType
     in order to create heap allocated StructSequences.

   - bpo-32912(45): A *note SyntaxWarning: 1ae. is now emitted instead
     of a *note DeprecationWarning: 1a3. for invalid escape sequences in
     string and bytes literals.

   - bpo-34854(46): Fixed a crash in compiling string annotations
     containing a lambda with a keyword-only argument that doesn't have
     a default value.

   - bpo-34850(47): The compiler now produces a *note SyntaxWarning:
     1ae. when identity checks (‘is’ and ‘is not’) are used with certain
     types of literals (e.g.  strings, ints).  These can often work by
     accident in CPython, but are not guaranteed by the language spec.
     The warning advises users to use equality tests (‘==’ and ‘!=’)
     instead.

   - bpo-34824(48): Fix a possible null pointer dereference in
     Modules/_ssl.c.  Patch by Zackery Spytz.

   - bpo-30156(49): The C function ‘property_descr_get()’ uses a
     "cached" tuple to optimize function calls.  But this tuple can be
     discovered in debug mode with *note sys.getobjects(): 28e.  Remove
     the optimization, it's not really worth it and it causes 3
     different crashes last years.

   - bpo-34762(50): Fix contextvars C API to use PyObject* pointer
     types.

   - bpo-34751(51): The hash function for tuples is now based on xxHash
     which gives better collision results on (formerly) pathological
     cases.  Additionally, on 64-bit systems it improves tuple hashes in
     general.  Patch by Jeroen Demeyer with substantial contributions by
     Tim Peters.

   - bpo-34735(52): Fix a memory leak in Modules/timemodule.c.  Patch by
     Zackery Spytz.

   - bpo-34683(53): Fixed a bug where some SyntaxError error pointed to
     locations that were off-by-one.

   - bpo-34651(54): Only allow the main interpreter to fork.  The avoids
     the possibility of affecting the main interpreter, which is
     critical to operation of the runtime.

   - bpo-34653(55): Remove unused function
     PyParser_SimpleParseStringFilename.

   - bpo-32236(56): Warn that line buffering is not supported if *note
     open(): 316. is called with binary mode and ‘buffering=1’.

   - bpo-34641(57): Further restrict the syntax of the left-hand side of
     keyword arguments in function calls.  In particular,
     ‘f((keyword)=arg)’ is now disallowed.

   - bpo-34637(58): Make the 'start' argument to 'sum()' visible as a
     keyword argument.

   - bpo-1621(59): Do not assume signed integer overflow behavior (C
     undefined behavior) when performing set hash table resizing.

   - bpo-34588(60): Fix an off-by-one in the recursive call pruning
     feature of traceback formatting.

   - bpo-34485(61): On Windows, the LC_CTYPE is now set to the user
     preferred locale at startup.  Previously, the LC_CTYPE locale was
     "C" at startup, but changed when calling setlocale(LC_CTYPE, "") or
     setlocale(LC_ALL, "").

   - bpo-34485(62): Standard streams like sys.stdout now use the
     "surrogateescape" error handler, instead of "strict", on the POSIX
     locale (when the C locale is not coerced and the UTF-8 Mode is
     disabled).

   - bpo-34485(63): Fix the error handler of standard streams like
     sys.stdout: PYTHONIOENCODING=":" is now ignored instead of setting
     the error handler to "strict".

   - bpo-34485(64): Python now gets the locale encoding with C code to
     initialize the encoding of standard streams like sys.stdout.
     Moreover, the encoding is now initialized to the Python codec name
     to get a normalized encoding name and to ensure that the codec is
     loaded.  The change avoids importing _bootlocale and _locale
     modules at startup by default.

   - bpo-34527(65): On FreeBSD, Py_DecodeLocale() and Py_EncodeLocale()
     now also forces the ASCII encoding if the LC_CTYPE locale is
     "POSIX", not only if the LC_CTYPE locale is "C".

   - bpo-34527(66): The UTF-8 Mode is now also enabled by the "POSIX"
     locale, not only by the "C" locale.

   - bpo-34403(67): On HP-UX with C or POSIX locale,
     sys.getfilesystemencoding() now returns "ascii" instead of "roman8"
     (when the UTF-8 Mode is disabled and the C locale is not coerced).

   - bpo-34523(68): The Python filesystem encoding is now read earlier
     during the Python initialization.

   - bpo-12458(69): Tracebacks show now correct line number for
     subexpressions in multiline expressions.  Tracebacks show now the
     line number of the first line for multiline expressions instead of
     the line number of the last subexpression.

   - bpo-34408(70): Prevent a null pointer dereference and resource
     leakage in ‘PyInterpreterState_New()’.

   - bpo-34400(71): Fix undefined behavior in parsetok.c.  Patch by
     Zackery Spytz.

   - bpo-33073(72): Added as_integer_ratio to ints to make them more
     interoperable with floats.

   - bpo-34377(73): Update valgrind suppression list to use
     ‘_PyObject_Free’/‘_PyObject_Realloc’ instead of
     ‘PyObject_Free’/‘PyObject_Realloc’.

   - bpo-34353(74): Added the "socket" option in the ‘stat.filemode()’
     Python implementation to match the C implementation.

   - bpo-34320(75): Fix ‘dict(od)’ didn't copy iteration order of
     OrderedDict.

   - bpo-34113(76): Fixed crash on debug builds when opcode stack was
     adjusted with negative numbers.  Patch by Constantin Petrisor.

   - bpo-34100(77): Compiler now merges constants in tuples and
     frozensets recursively.  Code attributes like ‘co_names’ are merged
     too.

   - bpo-34151(78): Performance of list concatenation, repetition and
     slicing operations is slightly improved.  Patch by Sergey Fedoseev.

   - bpo-34170(79): -X dev: it is now possible to override the memory
     allocator using PYTHONMALLOC even if the developer mode is enabled.

   - bpo-33237(80): Improved *note AttributeError: 5f0. message for
     partially initialized module.

   - bpo-34149(81): Fix min and max functions to get default behavior
     when key is None.

   - bpo-34125(82): Profiling of unbound built-in methods now works when
     ‘**kwargs’ is given.

   - bpo-34141(83): Optimized pickling atomic types (None, bool, int,
     float, bytes, str).

   - bpo-34126(84): Fix crashes when profiling certain invalid calls of
     unbound methods.  Patch by Jeroen Demeyer.

   - bpo-24618(85): Fixed reading invalid memory when create the code
     object with too small varnames tuple or too large argument counts.

   - bpo-34068(86): In *note io.IOBase.close(): 506, ensure that the
     *note closed: 1e0e. attribute is not set with a live exception.
     Patch by Zackery Spytz and Serhiy Storchaka.

   - bpo-34087(87): Fix buffer overflow while converting unicode to
     numeric values.

   - bpo-34080(88): Fixed a memory leak in the compiler when it raised
     some uncommon errors during tokenizing.

   - bpo-34066(89): Disabled interruption by Ctrl-C between calling
     ‘open()’ and entering a 'with' block in ‘with open()’.

   - bpo-34042(90): Fix dict.copy() to maintain correct total refcount
     (as reported by sys.gettotalrefcount()).

   - bpo-33418(91): Fix potential memory leak in function object when it
     creates reference cycle.

   - bpo-33985(92): Implement contextvars.ContextVar.name attribute.

   - bpo-33956(93): Update vendored Expat library copy to version 2.2.5.

   - bpo-24596(94): Decref the module object in *note
     PyRun_SimpleFileExFlags(): 1cca. before calling *note
     PyErr_Print(): 1d2c.  Patch by Zackery Spytz.

   - bpo-33451(95): Close directly executed pyc files before calling
     ‘PyEval_EvalCode()’.

   - bpo-1617161(96): The hash of ‘BuiltinMethodType’ instances (methods
     of built-in classes) now depends on the hash of the identity of
     '__self__' instead of its value.  The hash and equality of
     ‘ModuleType’ and ‘MethodWrapperType’ instances (methods of
     user-defined classes and some methods of built-in classes like
     ‘str.__add__’) now depend on the hash and equality of the identity
     of '__self__' instead of its value.  ‘MethodWrapperType’ instances
     no longer support ordering.

   - bpo-33824(97): Fix "LC_ALL=C python3.7 -V": reset properly the
     command line parser when the encoding changes after reading the
     Python configuration.

   - bpo-33803(98): Fix a crash in hamt.c caused by enabling GC tracking
     for an object that hadn't all of its fields set to NULL.

   - bpo-33738(99): Seven macro incompatibilities with the Limited API
     were fixed, and the macros *note PyIter_Check(): 1cb2, *note
     PyIndex_Check(): b81. and *note PyExceptionClass_Name(): c5b. were
     added as functions.  A script for automatic macro checks was added.

   - bpo-33786(100): Fix asynchronous generators to handle GeneratorExit
     in athrow() correctly

   - bpo-30167(101): ‘PyRun_SimpleFileExFlags’ removes ‘__cached__’ from
     module in addition to ‘__file__’.

   - bpo-33706(102): Fix a crash in Python initialization when parsing
     the command line options.  Thanks Christoph Gohlke for the bug
     report and the fix!

   - bpo-33597(103): Reduce ‘PyGC_Head’ size from 3 words to 2 words.

   - bpo-30654(104): Fixed reset of the SIGINT handler to SIG_DFL on
     interpreter shutdown even when there was a custom handler set
     previously.  Patch by Philipp Kerling.

   - bpo-33622(105): Fixed a leak when the garbage collector fails to
     add an object with the ‘__del__’ method or referenced by it into
     the *note gc.garbage: 13d9. list.  *note PyGC_Collect(): b85. can
     now be called when an exception is set and preserves it.

   - bpo-33462(106): Make dict and dict views reversible.  Patch by Rémi
     Lapeyre.

   - bpo-23722(107): A *note RuntimeError: 244. is now raised when the
     custom metaclass doesn't provide the ‘__classcell__’ entry in the
     namespace passed to ‘type.__new__’.  A *note DeprecationWarning:
     1a3. was emitted in Python 3.6-3.7.

   - bpo-33499(108): Add *note PYTHONPYCACHEPREFIX: b9b. environment
     variable and *note -X: 16f. ‘pycache_prefix’ command-line option to
     set an alternate root directory for writing module bytecode cache
     files.

   - bpo-25711(109): The *note zipimport: 138. module has been rewritten
     in pure Python.

   - bpo-33509(110): Fix module_globals parameter of
     warnings.warn_explicit(): don't crash if module_globals is not a
     dict.

   - bpo-31849(111): Fix signed/unsigned comparison warning in pyhash.c.

   - bpo-33475(112): Fixed miscellaneous bugs in converting annotations
     to strings and optimized parentheses in the string representation.

   - bpo-20104(113): Added support for the ‘setpgroup’, ‘resetids’,
     ‘setsigmask’, ‘setsigdef’ and ‘scheduler’ parameters of
     ‘posix_spawn’.  Patch by Pablo Galindo.

   - bpo-33391(114): Fix a leak in set_symmetric_difference().

   - bpo-33363(115): Raise a SyntaxError for ‘async with’ and ‘async
     for’ statements outside of async functions.

   - bpo-28055(116): Fix unaligned accesses in siphash24().  Patch by
     Rolf Eike Beer.

   - bpo-33128(117): Fix a bug that causes PathFinder to appear twice on
     sys.meta_path.  Patch by Pablo Galindo Salgado.

   - bpo-33331(118): Modules imported last are now cleared first at
     interpreter shutdown.

   - bpo-33312(119): Fixed clang ubsan (undefined behavior sanitizer)
     warnings in dictobject.c by adjusting how the internal struct
     _dictkeysobject shared keys structure is declared.

   - bpo-33305(120): Improved syntax error messages for invalid
     numerical literals.

   - bpo-33306(121): Improved syntax error messages for unbalanced
     parentheses.

   - bpo-33234(122): The list constructor will pre-size and not
     over-allocate when the input length is known.

   - bpo-33270(123): Intern the names for all anonymous code objects.
     Patch by Zackery Spytz.

   - bpo-30455(124): The C and Python code and the documentation related
     to tokens are now generated from a single source file
     ‘Grammar/Tokens’.

   - bpo-33176(125): Add a ‘toreadonly()’ method to memoryviews.

   - bpo-33231(126): Fix potential memory leak in ‘normalizestring()’.

   - bpo-33205(127): Change dict growth function from
     ‘round_up_to_power_2(used*2+hashtable_size/2)’ to
     ‘round_up_to_power_2(used*3)’.  Previously, dict is shrunk only
     when ‘used == 0’.  Now dict has more chance to be shrunk.

   - bpo-29922(128): Improved error messages in 'async with' when
     ‘__aenter__()’ or ‘__aexit__()’ return non-awaitable object.

   - bpo-33199(129): Fix ‘ma_version_tag’ in dict implementation is
     uninitialized when copying from key-sharing dict.

   - bpo-33053(130): When using the -m switch, sys.path[0] is now
     explicitly expanded as the 'starting' working directory, rather
     than being left as the empty path (which allows imports from the
     current working directory at the time of the import)

   - bpo-33138(131): Changed standard error message for non-pickleable
     and non-copyable types.  It now says "cannot pickle" instead of
     "can't pickle" or "cannot serialize".

   - bpo-33018(132): Improve consistency of errors raised by
     ‘issubclass()’ when called with a non-class and an abstract base
     class as the first and second arguments, respectively.  Patch by
     Josh Bronson.

   - bpo-33083(133): ‘math.factorial’ no longer accepts arguments that
     are not int-like.  Patch by Pablo Galindo.

   - bpo-33041(134): Added new opcode *note END_ASYNC_FOR: ca0. and
     fixes the following issues:

        * Setting global *note StopAsyncIteration: 1e0f. no longer
          breaks ‘async for’ loops.

        * Jumping into an ‘async for’ loop is now disabled.

        * Jumping out of an ‘async for’ loop no longer corrupts the
          stack.

   - bpo-25750(135): Fix rare Python crash due to bad refcounting in
     ‘type_getattro()’ if a descriptor deletes itself from the class.
     Patch by Jeroen Demeyer.

   - bpo-33041(136): Fixed bytecode generation for "async for" with a
     complex target.  A StopAsyncIteration raised on assigning or
     unpacking will be now propagated instead of stopping the iteration.

   - bpo-33026(137): Fixed jumping out of "with" block by setting
     f_lineno.

   - bpo-33005(138): Fix a crash on fork when using a custom memory
     allocator (ex: using PYTHONMALLOC env var).  _PyGILState_Reinit()
     and _PyInterpreterState_Enable() now use the default RAW memory
     allocator to allocate a new interpreters mutex on fork.

   - bpo-32911(139): Due to unexpected compatibility issues discovered
     during downstream beta testing, reverted bpo-29463(140).
     ‘docstring’ field is removed from Module, ClassDef, FunctionDef,
     and AsyncFunctionDef ast nodes which was added in 3.7a1.  Docstring
     expression is restored as a first statement in their body.  Based
     on patch by Inada Naoki.

   - bpo-17288(141): Prevent jumps from 'return' and 'exception' trace
     events.

   - bpo-32946(142): Importing names from already imported module with
     "from ...  import ..."  is now 30% faster if the module is not a
     package.

   - bpo-32932(143): Make error message more revealing when there are
     non-str objects in ‘__all__’.

   - bpo-32925(144): Optimized iterating and containing test for literal
     lists consisting of non-constants: ‘x in [a, b]’ and ‘for x in [a,
     b]’.  The case of all constant elements already was optimized.

   - bpo-32889(145): Update Valgrind suppression list to account for the
     rename of ‘Py_ADDRESS_IN_RANG’ to ‘address_in_range’.

   - bpo-32836(146): Don't use temporary variables in cases of
     list/dict/set comprehensions

   - bpo-31356(147): Remove the new API added in bpo-31356(148)
     (gc.ensure_disabled() context manager).

   - bpo-32305(149): For namespace packages, ensure that both ‘__file__’
     and ‘__spec__.origin’ are set to None.

   - bpo-32303(150): Make sure ‘__spec__.loader’ matches ‘__loader__’
     for namespace packages.

   - bpo-32711(151): Fix the warning messages for Python/ast_unparse.c.
     Patch by Stéphane Wirtel

   - bpo-32583(152): Fix possible crashing in builtin Unicode decoders
     caused by write out-of-bound errors when using customized decode
     error handlers.

   - bpo-32489(153): A *note continue: 180. statement is now allowed in
     the *note finally: 1b0. clause.

   - bpo-17611(154): Simplified the interpreter loop by moving the logic
     of unrolling the stack of blocks into the compiler.  The compiler
     emits now explicit instructions for adjusting the stack of values
     and calling the cleaning up code for *note break: 17f, *note
     continue: 180. and *note return: 1af.

     Removed opcodes ‘BREAK_LOOP’, ‘CONTINUE_LOOP’, ‘SETUP_LOOP’ and
     ‘SETUP_EXCEPT’.  Added new opcodes ‘ROT_FOUR’, ‘BEGIN_FINALLY’ and
     ‘CALL_FINALLY’ and ‘POP_FINALLY’.  Changed the behavior of
     ‘END_FINALLY’ and ‘WITH_CLEANUP_START’.

   - bpo-32285(155): New function unicodedata.is_normalized, which can
     check whether a string is in a specific normal form.

   - bpo-10544(156): Yield expressions are now disallowed in
     comprehensions and generator expressions except the expression for
     the outermost iterable.

   - bpo-32117(157): Iterable unpacking is now allowed without
     parentheses in yield and return statements, e.g.  ‘yield 1, 2, 3,
     *rest’.  Thanks to David Cuthbert for the change and Jordan Chapman
     for added tests.

   - bpo-31902(158): Fix the ‘col_offset’ attribute for ast nodes
     ‘ast.AsyncFor’, ‘ast.AsyncFunctionDef’, and ‘ast.AsyncWith’.
     Previously, ‘col_offset’ pointed to the keyword after ‘async’.

   - bpo-25862(159): Fix assertion failures in the ‘tell()’ method of
     ‘io.TextIOWrapper’.  Patch by Zackery Spytz.

   - bpo-21983(160): Fix a crash in ‘ctypes.cast()’ in case the type
     argument is a ctypes structured data type.  Patch by Eryk Sun and
     Oren Milman.

   - bpo-31577(161): Fix a crash in ‘os.utime()’ in case of a bad ns
     argument.  Patch by Oren Milman.

   - bpo-29832(162): Remove references to 'getsockaddrarg' from various
     socket error messages.  Patch by Oren Milman.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35877

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35814

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35766

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35713

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33416

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35720

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35634

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35623

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35214

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35560

   (11) https://bugs.python.org/issue?@action=redirect&bpo=35552

   (12) https://bugs.python.org/issue?@action=redirect&bpo=35504

   (13) https://bugs.python.org/issue?@action=redirect&bpo=35504

   (14) https://bugs.python.org/issue?@action=redirect&bpo=35494

   (15) https://bugs.python.org/issue?@action=redirect&bpo=35444

   (16) https://bugs.python.org/issue?@action=redirect&bpo=35436

   (17) https://bugs.python.org/issue?@action=redirect&bpo=35423

   (18) https://bugs.python.org/issue?@action=redirect&bpo=35357

   (19) https://bugs.python.org/issue?@action=redirect&bpo=35372

   (20) https://bugs.python.org/issue?@action=redirect&bpo=35336

   (21) https://bugs.python.org/issue?@action=redirect&bpo=31241

   (22) https://bugs.python.org/issue?@action=redirect&bpo=33954

   (23) https://bugs.python.org/issue?@action=redirect&bpo=35269

   (24) https://bugs.python.org/issue?@action=redirect&bpo=35224

   (25) https://peps.python.org/pep-0572/

   (26) https://bugs.python.org/issue?@action=redirect&bpo=32492

   (27) https://bugs.python.org/issue?@action=redirect&bpo=35214

   (28) https://bugs.python.org/issue?@action=redirect&bpo=35214

   (29) https://bugs.python.org/issue?@action=redirect&bpo=35193

   (30) https://bugs.python.org/issue?@action=redirect&bpo=35169

   (31) https://bugs.python.org/issue?@action=redirect&bpo=34022

   (32) https://bugs.python.org/issue?@action=redirect&bpo=28401

   (33) https://bugs.python.org/issue?@action=redirect&bpo=29341

   (34) https://bugs.python.org/issue?@action=redirect&bpo=35050

   (35) https://bugs.python.org/issue?@action=redirect&bpo=29743

   (36) https://bugs.python.org/issue?@action=redirect&bpo=16806

   (37) https://bugs.python.org/issue?@action=redirect&bpo=35029

   (38) https://bugs.python.org/issue?@action=redirect&bpo=34983

   (39) https://bugs.python.org/issue?@action=redirect&bpo=34974

   (40) https://bugs.python.org/issue?@action=redirect&bpo=34939

   (41) https://bugs.python.org/issue?@action=redirect&bpo=34973

   (42) https://bugs.python.org/issue?@action=redirect&bpo=34876

   (43) https://bugs.python.org/issue?@action=redirect&bpo=34879

   (44) https://bugs.python.org/issue?@action=redirect&bpo=34784

   (45) https://bugs.python.org/issue?@action=redirect&bpo=32912

   (46) https://bugs.python.org/issue?@action=redirect&bpo=34854

   (47) https://bugs.python.org/issue?@action=redirect&bpo=34850

   (48) https://bugs.python.org/issue?@action=redirect&bpo=34824

   (49) https://bugs.python.org/issue?@action=redirect&bpo=30156

   (50) https://bugs.python.org/issue?@action=redirect&bpo=34762

   (51) https://bugs.python.org/issue?@action=redirect&bpo=34751

   (52) https://bugs.python.org/issue?@action=redirect&bpo=34735

   (53) https://bugs.python.org/issue?@action=redirect&bpo=34683

   (54) https://bugs.python.org/issue?@action=redirect&bpo=34651

   (55) https://bugs.python.org/issue?@action=redirect&bpo=34653

   (56) https://bugs.python.org/issue?@action=redirect&bpo=32236

   (57) https://bugs.python.org/issue?@action=redirect&bpo=34641

   (58) https://bugs.python.org/issue?@action=redirect&bpo=34637

   (59) https://bugs.python.org/issue?@action=redirect&bpo=1621

   (60) https://bugs.python.org/issue?@action=redirect&bpo=34588

   (61) https://bugs.python.org/issue?@action=redirect&bpo=34485

   (62) https://bugs.python.org/issue?@action=redirect&bpo=34485

   (63) https://bugs.python.org/issue?@action=redirect&bpo=34485

   (64) https://bugs.python.org/issue?@action=redirect&bpo=34485

   (65) https://bugs.python.org/issue?@action=redirect&bpo=34527

   (66) https://bugs.python.org/issue?@action=redirect&bpo=34527

   (67) https://bugs.python.org/issue?@action=redirect&bpo=34403

   (68) https://bugs.python.org/issue?@action=redirect&bpo=34523

   (69) https://bugs.python.org/issue?@action=redirect&bpo=12458

   (70) https://bugs.python.org/issue?@action=redirect&bpo=34408

   (71) https://bugs.python.org/issue?@action=redirect&bpo=34400

   (72) https://bugs.python.org/issue?@action=redirect&bpo=33073

   (73) https://bugs.python.org/issue?@action=redirect&bpo=34377

   (74) https://bugs.python.org/issue?@action=redirect&bpo=34353

   (75) https://bugs.python.org/issue?@action=redirect&bpo=34320

   (76) https://bugs.python.org/issue?@action=redirect&bpo=34113

   (77) https://bugs.python.org/issue?@action=redirect&bpo=34100

   (78) https://bugs.python.org/issue?@action=redirect&bpo=34151

   (79) https://bugs.python.org/issue?@action=redirect&bpo=34170

   (80) https://bugs.python.org/issue?@action=redirect&bpo=33237

   (81) https://bugs.python.org/issue?@action=redirect&bpo=34149

   (82) https://bugs.python.org/issue?@action=redirect&bpo=34125

   (83) https://bugs.python.org/issue?@action=redirect&bpo=34141

   (84) https://bugs.python.org/issue?@action=redirect&bpo=34126

   (85) https://bugs.python.org/issue?@action=redirect&bpo=24618

   (86) https://bugs.python.org/issue?@action=redirect&bpo=34068

   (87) https://bugs.python.org/issue?@action=redirect&bpo=34087

   (88) https://bugs.python.org/issue?@action=redirect&bpo=34080

   (89) https://bugs.python.org/issue?@action=redirect&bpo=34066

   (90) https://bugs.python.org/issue?@action=redirect&bpo=34042

   (91) https://bugs.python.org/issue?@action=redirect&bpo=33418

   (92) https://bugs.python.org/issue?@action=redirect&bpo=33985

   (93) https://bugs.python.org/issue?@action=redirect&bpo=33956

   (94) https://bugs.python.org/issue?@action=redirect&bpo=24596

   (95) https://bugs.python.org/issue?@action=redirect&bpo=33451

   (96) https://bugs.python.org/issue?@action=redirect&bpo=1617161

   (97) https://bugs.python.org/issue?@action=redirect&bpo=33824

   (98) https://bugs.python.org/issue?@action=redirect&bpo=33803

   (99) https://bugs.python.org/issue?@action=redirect&bpo=33738

   (100) https://bugs.python.org/issue?@action=redirect&bpo=33786

   (101) https://bugs.python.org/issue?@action=redirect&bpo=30167

   (102) https://bugs.python.org/issue?@action=redirect&bpo=33706

   (103) https://bugs.python.org/issue?@action=redirect&bpo=33597

   (104) https://bugs.python.org/issue?@action=redirect&bpo=30654

   (105) https://bugs.python.org/issue?@action=redirect&bpo=33622

   (106) https://bugs.python.org/issue?@action=redirect&bpo=33462

   (107) https://bugs.python.org/issue?@action=redirect&bpo=23722

   (108) https://bugs.python.org/issue?@action=redirect&bpo=33499

   (109) https://bugs.python.org/issue?@action=redirect&bpo=25711

   (110) https://bugs.python.org/issue?@action=redirect&bpo=33509

   (111) https://bugs.python.org/issue?@action=redirect&bpo=31849

   (112) https://bugs.python.org/issue?@action=redirect&bpo=33475

   (113) https://bugs.python.org/issue?@action=redirect&bpo=20104

   (114) https://bugs.python.org/issue?@action=redirect&bpo=33391

   (115) https://bugs.python.org/issue?@action=redirect&bpo=33363

   (116) https://bugs.python.org/issue?@action=redirect&bpo=28055

   (117) https://bugs.python.org/issue?@action=redirect&bpo=33128

   (118) https://bugs.python.org/issue?@action=redirect&bpo=33331

   (119) https://bugs.python.org/issue?@action=redirect&bpo=33312

   (120) https://bugs.python.org/issue?@action=redirect&bpo=33305

   (121) https://bugs.python.org/issue?@action=redirect&bpo=33306

   (122) https://bugs.python.org/issue?@action=redirect&bpo=33234

   (123) https://bugs.python.org/issue?@action=redirect&bpo=33270

   (124) https://bugs.python.org/issue?@action=redirect&bpo=30455

   (125) https://bugs.python.org/issue?@action=redirect&bpo=33176

   (126) https://bugs.python.org/issue?@action=redirect&bpo=33231

   (127) https://bugs.python.org/issue?@action=redirect&bpo=33205

   (128) https://bugs.python.org/issue?@action=redirect&bpo=29922

   (129) https://bugs.python.org/issue?@action=redirect&bpo=33199

   (130) https://bugs.python.org/issue?@action=redirect&bpo=33053

   (131) https://bugs.python.org/issue?@action=redirect&bpo=33138

   (132) https://bugs.python.org/issue?@action=redirect&bpo=33018

   (133) https://bugs.python.org/issue?@action=redirect&bpo=33083

   (134) https://bugs.python.org/issue?@action=redirect&bpo=33041

   (135) https://bugs.python.org/issue?@action=redirect&bpo=25750

   (136) https://bugs.python.org/issue?@action=redirect&bpo=33041

   (137) https://bugs.python.org/issue?@action=redirect&bpo=33026

   (138) https://bugs.python.org/issue?@action=redirect&bpo=33005

   (139) https://bugs.python.org/issue?@action=redirect&bpo=32911

   (140) https://bugs.python.org/issue?@action=redirect&bpo=29463

   (141) https://bugs.python.org/issue?@action=redirect&bpo=17288

   (142) https://bugs.python.org/issue?@action=redirect&bpo=32946

   (143) https://bugs.python.org/issue?@action=redirect&bpo=32932

   (144) https://bugs.python.org/issue?@action=redirect&bpo=32925

   (145) https://bugs.python.org/issue?@action=redirect&bpo=32889

   (146) https://bugs.python.org/issue?@action=redirect&bpo=32836

   (147) https://bugs.python.org/issue?@action=redirect&bpo=31356

   (148) https://bugs.python.org/issue?@action=redirect&bpo=31356

   (149) https://bugs.python.org/issue?@action=redirect&bpo=32305

   (150) https://bugs.python.org/issue?@action=redirect&bpo=32303

   (151) https://bugs.python.org/issue?@action=redirect&bpo=32711

   (152) https://bugs.python.org/issue?@action=redirect&bpo=32583

   (153) https://bugs.python.org/issue?@action=redirect&bpo=32489

   (154) https://bugs.python.org/issue?@action=redirect&bpo=17611

   (155) https://bugs.python.org/issue?@action=redirect&bpo=32285

   (156) https://bugs.python.org/issue?@action=redirect&bpo=10544

   (157) https://bugs.python.org/issue?@action=redirect&bpo=32117

   (158) https://bugs.python.org/issue?@action=redirect&bpo=31902

   (159) https://bugs.python.org/issue?@action=redirect&bpo=25862

   (160) https://bugs.python.org/issue?@action=redirect&bpo=21983

   (161) https://bugs.python.org/issue?@action=redirect&bpo=31577

   (162) https://bugs.python.org/issue?@action=redirect&bpo=29832


File: python.info,  Node: ライブラリ<162>,  Next: ドキュメント<56>,  Prev: Core and Builtins<159>,  Up: Python 3 8 0 alpha 1

1.24.62.3 ライブラリ
....................

   - bpo-35845(1): Add 'order' parameter to memoryview.tobytes().

   - bpo-35864(2): The _asdict() method for collections.namedtuple now
     returns a regular dict instead of an OrderedDict.

   - bpo-35537(3): An ExitStack is now used internally within
     subprocess.Popen to clean up pipe file handles.  No behavior change
     in normal operation.  But if closing one handle were ever to cause
     an exception, the others will now be closed instead of leaked.
     (patch by Giampaolo Rodola)

   - bpo-35847(4): RISC-V needed the CTYPES_PASS_BY_REF_HACK. Fixes
     ctypes Structure test_pass_by_value.

   - bpo-35813(5): Shared memory submodule added to multiprocessing to
     avoid need for serialization between processes

   - bpo-35780(6): Fix lru_cache() errors arising in recursive,
     reentrant, or multi-threaded code.  These errors could result in
     orphan links and in the cache being trapped in a state with fewer
     than the specified maximum number of links.  Fix handling of
     negative maxsize which should have been treated as zero.  Fix
     errors in toggling the "full" status flag.  Fix misordering of
     links when errors are encountered.  Sync-up the C code and pure
     Python code for the space saving path in functions with a single
     positional argument.  In this common case, the space overhead of an
     lru cache entry is reduced by almost half.  Fix counting of cache
     misses.  In error cases, the miss count was out of sync with the
     actual number of times the underlying user function was called.

   - bpo-35537(7): *note os.posix_spawn(): 52e. and *note
     os.posix_spawnp(): 1e11. now have a 'setsid' parameter.

   - bpo-23846(8): *note asyncio.ProactorEventLoop: 81d. now catches and
     logs send errors when the self-pipe is full.

   - bpo-34323(9): *note asyncio: b.: Enhance ‘IocpProactor.close()’
     log: wait 1 second before the first log, then log every second.
     Log also the number of seconds since ‘close()’ was called.

   - bpo-35674(10): Add a new *note os.posix_spawnp(): 1e11. function.
     Patch by Joannah Nanjekye.

   - bpo-35733(11): ‘ast.Constant(boolean)’ no longer an instance of
     ‘ast.Num’.  Patch by Anthony Sottile.

   - bpo-35726(12): QueueHandler.prepare() now makes a copy of the
     record before modifying and enqueueing it, to avoid affecting other
     handlers in the chain.

   - bpo-35719(13): Sped up multi-argument *note math: 92. functions
     atan2(), copysign(), remainder() and hypot() by 1.3-2.5 times.

   - bpo-35717(14): Fix KeyError exception raised when using enums and
     compile.  Patch contributed by Rémi Lapeyre.

   - bpo-35699(15): Fixed detection of Visual Studio Build Tools 2017 in
     distutils

   - bpo-32710(16): Fix memory leaks in asyncio ProactorEventLoop on
     overlapped operation failure.

   - bpo-35702(17): The *note time.CLOCK_UPTIME_RAW: c37. constant is
     now available for macOS 10.12.

   - bpo-32710(18): Fix a memory leak in asyncio in the
     ProactorEventLoop when ‘ReadFile()’ or ‘WSASend()’ overlapped
     operation fail immediately: release the internal buffer.

   - bpo-35682(19): Fix ‘asyncio.ProactorEventLoop.sendfile()’: don't
     attempt to set the result of an internal future if it's already
     done.

   - bpo-35283(20): Add a deprecated warning for the
     ‘threading.Thread.isAlive()’ method.  Patch by Donghee Na.

   - bpo-35664(21): Improve operator.itemgetter() performance by 33%
     with optimized argument handling and with adding a fast path for
     the common case of a single non-negative integer index into a tuple
     (which is the typical use case in the standard library).

   - bpo-35643(22): Fixed a SyntaxWarning: invalid escape sequence in
     Modules/_sha3/cleanup.py.  Patch by Mickaël Schoentgen.

   - bpo-35619(23): Improved support of custom data descriptors in *note
     help(): ad4. and *note pydoc: ba.

   - bpo-28503(24): The ‘crypt’ module now internally uses the
     ‘crypt_r()’ library function instead of ‘crypt()’ when available.

   - bpo-35614(25): Fixed help() on metaclasses.  Patch by Sanyam
     Khurana.

   - bpo-35568(26): Expose ‘raise(signum)’ as ‘raise_signal’

   - bpo-35588(27): The floor division and modulo operations and the
     *note divmod(): b99. function on *note fractions.Fraction: 213.
     types are 2-4x faster.  Patch by Stefan Behnel.

   - bpo-35585(28): Speed-up building enums by value, e.g.
     http.HTTPStatus(200).

   - bpo-30561(29): random.gammavariate(1.0, beta) now computes the same
     result as random.expovariate(1.0 / beta).  This synchronizes the
     two algorithms and eliminates some idiosyncrasies in the old
     implementation.  It does however produce a difference stream of
     random variables than it used to.

   - bpo-35537(30): The *note subprocess: dc. module can now use the
     *note os.posix_spawn(): 52e. function in some cases for better
     performance.

   - bpo-35526(31): Delaying the 'joke' of barry_as_FLUFL.mandatory to
     Python version 4.0

   - bpo-35523(32): Remove *note ctypes: 2e. callback workaround: no
     longer create a callback at startup.  Avoid SELinux alert on
     ‘import ctypes’ and ‘import uuid’.

   - bpo-31784(33): *note uuid.uuid1(): da1. now calls *note
     time.time_ns(): ce0. rather than ‘int(time.time() * 1e9)’.

   - bpo-35513(34): ‘TextTestRunner’ of ‘unittest.runner’ now uses *note
     time.perf_counter(): c7a. rather than *note time.time(): 55d. to
     measure the execution time of a test: *note time.time(): 55d. can
     go backwards, whereas *note time.perf_counter(): c7a. is monotonic.

   - bpo-35502(35): Fixed reference leaks in *note
     xml.etree.ElementTree.TreeBuilder: c4a. in case of unfinished
     building of the tree (in particular when an error was raised during
     parsing XML).

   - bpo-35348(36): Make *note platform.architecture(): 1a06. parsing of
     ‘file’ command output more reliable: add the ‘-b’ option to the
     ‘file’ command to omit the filename, force the usage of the C
     locale, and search also the "shared object" pattern.

   - bpo-35491(37): *note multiprocessing: 98.: Add ‘Pool.__repr__()’
     and enhance ‘BaseProcess.__repr__()’ (add pid and parent pid) to
     ease debugging.  Pool state constant values are now strings instead
     of integers, for example ‘RUN’ value becomes ‘'RUN'’ instead of
     ‘0’.

   - bpo-35477(38): ‘multiprocessing.Pool.__enter__()’ now fails if the
     pool is not running: ‘with pool:’ fails if used more than once.

   - bpo-31446(39): Copy command line that was passed to CreateProcessW
     since this function can change the content of the input buffer.

   - bpo-35471(40): Python 2.4 dropped MacOS 9 support.  The macpath
     module was deprecated in Python 3.7.  The module is now removed.

   - bpo-23057(41): Unblock Proactor event loop when keyboard interrupt
     is received on Windows

   - bpo-35052(42): Fix xml.dom.minidom cloneNode() on a document with
     an entity: pass the correct arguments to the user data handler of
     an entity.

   - bpo-20239(43): Allow repeated assignment deletion of *note
     unittest.mock.Mock: c3f. attributes.  Patch by Pablo Galindo.

   - bpo-17185(44): Set ‘__signature__’ on mock for *note inspect: 82.
     to get signature.  Patch by Karthikeyan Singaravelan.

   - bpo-35445(45): Memory errors during creating posix.environ no
     longer ignored.

   - bpo-35415(46): Validate fileno= argument to socket.socket().

   - bpo-35424(47): ‘multiprocessing.Pool’ destructor now emits *note
     ResourceWarning: 54c. if the pool is still running.

   - bpo-35330(48): When a ‘Mock’ instance was used to wrap an object,
     if ‘side_effect’ is used in one of the mocks of it methods, don't
     call the original implementation and return the result of using the
     side effect the same way that it is done with return_value.

   - bpo-35346(49): Drop Mac OS 9 and Rhapsody support from the *note
     platform: af. module.  Rhapsody last release was in 2000.  Mac OS 9
     last release was in 2001.

   - bpo-10496(50): ‘check_environ()’ of ‘distutils.utils’ now catches
     *note KeyError: 5e7. on calling *note pwd.getpwuid(): 1e12.: don't
     create the ‘HOME’ environment variable in this case.

   - bpo-10496(51): ‘posixpath.expanduser()’ now returns the input
     'path' unchanged if the ‘HOME’ environment variable is not set and
     the current user has no home directory (if the current user
     identifier doesn't exist in the password database).  This change
     fix the *note site: cc. module if the current user doesn't exist in
     the password database (if the user has no home directory).

   - bpo-35389(52): *note platform.libc_ver(): 17f5. now uses
     ‘os.confstr('CS_GNU_LIBC_VERSION')’ if available and the
     'executable' parameter is not set.

   - bpo-35394(53): Add empty slots to asyncio abstract protocols.

   - bpo-35310(54): Fix a bug in *note select.select(): fa0. where, in
     some cases, the file descriptor sequences were returned unmodified
     after a signal interruption, even though the file descriptors might
     not be ready yet.  *note select.select(): fa0. will now always
     return empty lists if a timeout has occurred.  Patch by Oran
     Avraham.

   - bpo-35380(55): Enable TCP_NODELAY on Windows for proactor asyncio
     event loop.

   - bpo-35341(56): Add generic version of ‘collections.OrderedDict’ to
     the ‘typing’ module.  Patch by Ismo Toijala.

   - bpo-35371(57): Fixed possible crash in ‘os.utime()’ on Windows when
     pass incorrect arguments.

   - bpo-35346(58): *note platform.uname(): 1e13. now redirects ‘stderr’
     to *note os.devnull: 1e14. when running external programs like ‘cmd
     /c ver’.

   - bpo-35066(59): Previously, calling the strftime() method on a
     datetime object with a trailing '%' in the format string would
     result in an exception.  However, this only occurred when the
     datetime C module was being used; the python implementation did not
     match this behavior.  Datetime is now PEP-399 compliant, and will
     not throw an exception on a trailing '%'.

   - bpo-35345(60): The function ‘platform.popen’ has been removed, it
     was deprecated since Python 3.3: use *note os.popen(): 31a.
     instead.

   - bpo-35344(61): On macOS, *note platform.platform(): 1ac6. now uses
     *note platform.mac_ver(): 1e15, if it returns a non-empty release
     string, to get the macOS version rather than the darwin version.

   - bpo-35312(62): Make ‘lib2to3.pgen2.parse.ParseError’ round-trip
     pickle-able.  Patch by Anthony Sottile.

   - bpo-35308(63): Fix regression in ‘webbrowser’ where default
     browsers may be preferred over browsers in the ‘BROWSER’
     environment variable.

   - bpo-24746(64): Avoid stripping trailing whitespace in doctest fancy
     diff.  Original patch by R. David Murray & Jairo Trad.  Enhanced by
     Sanyam Khurana.

   - bpo-28604(65): *note locale.localeconv(): df8. now sets temporarily
     the ‘LC_CTYPE’ locale to the ‘LC_MONETARY’ locale if the two
     locales are different and monetary strings are non-ASCII. This
     temporary change affects other threads.

   - bpo-35277(66): Update ensurepip to install pip 18.1 and setuptools
     40.6.2.

   - bpo-24209(67): Adds IPv6 support when invoking http.server
     directly.

   - bpo-35226(68): Recursively check arguments when testing for
     equality of *note unittest.mock.call: 1db3. objects and add note
     that tracking of parameters used to create ancestors of mocks in
     ‘mock_calls’ is not possible.

   - bpo-29564(69): The warnings module now suggests to enable
     tracemalloc if the source is specified, the tracemalloc module is
     available, but tracemalloc is not tracing memory allocations.

   - bpo-35189(70): Modify the following fnctl function to retry if
     interrupted by a signal (EINTR): flock, lockf, fnctl

   - bpo-30064(71): Use add_done_callback() in sock_* asyncio API to
     unsubscribe reader/writer early on calcellation.

   - bpo-35186(72): Removed the "built with" comment added when
     ‘setup.py upload’ is used with either ‘bdist_rpm’ or ‘bdist_dumb’.

   - bpo-35152(73): Allow sending more than 2 GB at once on a
     multiprocessing connection on non-Windows systems.

   - bpo-35062(74): Fix incorrect parsing of *note
     io.IncrementalNewlineDecoder: 1a3e.'s 'translate' argument.

   - bpo-35065(75): Remove ‘StreamReaderProtocol._untrack_reader’.  The
     call to ‘_untrack_reader’ is currently performed too soon, causing
     the protocol to forget about the reader before ‘connection_lost’
     can run and feed the EOF to the reader.

   - bpo-34160(76): ElementTree and minidom now preserve the attribute
     order specified by the user.

   - bpo-35079(77): Improve difflib.SequenceManager.get_matching_blocks
     doc by adding 'non-overlapping' and changing '!=' to '<'.

   - bpo-33710(78): Deprecated ‘l*gettext()’ functions and methods in
     the *note gettext: 67. module.  They return encoded bytes instead
     of Unicode strings and are artifacts from Python 2 times.  Also
     deprecated functions and methods related to setting the charset for
     ‘l*gettext()’ functions and methods.

   - bpo-35017(79): *note socketserver.BaseServer.serve_forever(): 1357.
     now exits immediately if it's *note shutdown(): 1e16. method is
     called while it is polling for new events.

   - bpo-35024(80): ‘importlib’ no longer logs ‘wrote <bytecode path>’
     redundantly after ‘(created|could not create) <bytecode path>’ is
     already logged.  Patch by Quentin Agren.

   - bpo-35047(81): ‘unittest.mock’ now includes mock calls in exception
     messages if ‘assert_not_called’, ‘assert_called_once’, or
     ‘assert_called_once_with’ fails.  Patch by Petter Strandmark.

   - bpo-31047(82): Fix ‘ntpath.abspath’ regression where it didn't
     remove a trailing separator on Windows.  Patch by Tim Graham.

   - bpo-35053(83): tracemalloc now tries to update the traceback when
     an object is reused from a "free list" (optimization for faster
     object creation, used by the builtin list type for example).

   - bpo-31553(84): Add the -json-lines option to json.tool.  Patch by
     hongweipeng.

   - bpo-34794(85): Fixed a leak in Tkinter when pass the Python wrapper
     around Tcl_Obj back to Tcl/Tk.

   - bpo-34909(86): Enum: fix grandchildren subclassing when parent
     mixed with concrete data types.

   - bpo-35022(87): *note unittest.mock.MagicMock: 108f. now supports
     the ‘__fspath__’ method (from *note os.PathLike: e4b.).

   - bpo-35008(88): Fixed references leaks when call the
     ‘__setstate__()’ method of *note xml.etree.ElementTree.Element:
     363. in the C implementation for already initialized element.

   - bpo-23420(89): Verify the value for the parameter '-s' of the
     cProfile CLI. Patch by Robert Kuska

   - bpo-33947(90): dataclasses now handle recursive reprs without
     raising RecursionError.

   - bpo-34890(91): Make *note inspect.iscoroutinefunction(): 30d, *note
     inspect.isgeneratorfunction(): 1b5b. and *note
     inspect.isasyncgenfunction(): 1b5c. work with *note
     functools.partial(): 217.  Patch by Pablo Galindo.

   - bpo-34521(92): Use *note socket.CMSG_SPACE(): 1e17. to calculate
     ancillary data size instead of *note socket.CMSG_LEN(): 1e18. in
     ‘multiprocessing.reduction.recvfds()’ as RFC 3542(93) requires the
     use of the former for portable applications.

   - bpo-31522(94): The ‘mailbox.mbox.get_string’ function 'from_'
     parameter can now successfully be set to a non-default value.

   - bpo-34970(95): Protect tasks weak set manipulation in
     ‘asyncio.all_tasks()’

   - bpo-34969(96): gzip: Add -fast, -best on the gzip CLI, these
     parameters will be used for the fast compression method (quick) or
     the best method compress (slower, but smaller file).  Also, change
     the default compression level to 6 (tradeoff).

   - bpo-16965(97): The 2to3 ‘execfile’ fixer now opens the file with
     mode ‘'rb'’.  Patch by Zackery Spytz.

   - bpo-34966(98): *note pydoc: ba. now supports aliases not only to
     methods defined in the end class, but also to inherited methods.
     The docstring is not duplicated for aliases.

   - bpo-34926(99): *note mimetypes.MimeTypes.guess_type(): 1e19. now
     accepts *note path-like object: 5a1. in addition to url strings.
     Patch by Mayank Asthana.

   - bpo-23831(100): Add ‘moveto()’ method to the ‘tkinter.Canvas’
     widget.  Patch by Juliette Monsel.

   - bpo-34941(101): Methods ‘find()’, ‘findtext()’ and ‘findall()’ of
     the ‘Element’ class in the *note xml.etree.ElementTree: 12b. module
     are now able to find children which are instances of ‘Element’
     subclasses.

   - bpo-32680(102): *note smtplib.SMTP: b27. objects now always have a
     ‘sock’ attribute present

   - bpo-34769(103): Fix for async generators not finalizing when event
     loop is in debug mode and garbage collector runs in another thread.

   - bpo-34936(104): Fix ‘TclError’ in
     ‘tkinter.Spinbox.selection_element()’.  Patch by Juliette Monsel.

   - bpo-34829(105): Add methods ‘selection_from’, ‘selection_range’,
     ‘selection_present’ and ‘selection_to’ to the ‘tkinter.Spinbox’ for
     consistency with the ‘tkinter.Entry’ widget.  Patch by Juliette
     Monsel.

   - bpo-34911(106): Added 'secure_protocols' argument to
     'http.cookiejar.DefaultCookiePolicy' to allow for tweaking of
     protocols and also to add support by default for 'wss', the secure
     websocket protocol.

   - bpo-34922(107): Fixed integer overflow in the *note digest(): 1e1a.
     and *note hexdigest(): 1e1b. methods for the SHAKE algorithm in the
     *note hashlib: 6c. module.

   - bpo-34925(108): 25% speedup in argument parsing for the functions
     in the bisect module.

   - bpo-34900(109): Fixed *note unittest.TestCase.debug(): 1c49. when
     used to call test methods with subtests.  Patch by Bruno Oliveira.

   - bpo-34844(110): logging.Formatter enhancement - Ensure styles and
     fmt matches in logging.Formatter - Added validate method in each
     format style class: StrFormatStyle, PercentStyle,
     StringTemplateStyle.  - This method is called in the constructor of
     logging.Formatter class - Also re-raise the KeyError in the format
     method of each style class, so it would a bit clear that it's an
     error with the invalid format fields.

   - bpo-34897(111): Adjust test.support.missing_compiler_executable
     check so that a nominal command name of "" is ignored.  Patch by
     Michael Felt.

   - bpo-34871(112): Fix inspect module polluted ‘sys.modules’ when
     parsing ‘__text_signature__’ of callable.

   - bpo-34898(113): Add ‘mtime’ argument to ‘gzip.compress’ for
     reproducible output.  Patch by Guo Ci Teo.

   - bpo-28441(114): On Cygwin and MinGW, ensure that ‘sys.executable’
     always includes the full filename in the path, including the ‘.exe’
     suffix (unless it is a symbolic link).

   - bpo-34866(115): Adding ‘max_num_fields’ to ‘cgi.FieldStorage’ to
     make DOS attacks harder by limiting the number of
     ‘MiniFieldStorage’ objects created by ‘FieldStorage’.

   - bpo-34711(116): http.server ensures it reports HTTPStatus.NOT_FOUND
     when the local path ends with "/" and is not a directory, even if
     the underlying OS (e.g.  AIX) accepts such paths as a valid file
     reference.  Patch by Michael Felt.

   - bpo-34872(117): Fix self-cancellation in C implementation of
     asyncio.Task

   - bpo-34849(118): Don't log waiting for ‘selector.select’ in asyncio
     loop iteration.  The waiting is pretty normal for any asyncio
     program, logging its time just adds a noise to logs without any
     useful information provided.

   - bpo-34022(119): The ‘SOURCE_DATE_EPOCH’ environment variable no
     longer overrides the value of the 'invalidation_mode' argument to
     *note py_compile.compile(): c1a, and determines its default value
     instead.

   - bpo-34819(120): Use a monotonic clock to compute timeouts in
     ‘Executor.map()’ and ‘as_completed()’, in order to prevent timeouts
     from deviating when the system clock is adjusted.

   - bpo-34758(121): Add .wasm -> application/wasm to list of recognized
     file types and content type headers

   - bpo-34789(122): *note xml.sax.make_parser(): 1e1c. now accepts any
     iterable as its 'parser_list' argument.  Patch by Andrés Delfino.

   - bpo-34334(123): In ‘QueueHandler’, clear ‘exc_text’ from
     ‘LogRecord’ to prevent traceback from being written twice.

   - bpo-34687(124): On Windows, asyncio now uses ProactorEventLoop,
     instead of SelectorEventLoop, by default.

   - bpo-5950(125): Support reading zip files with archive comments in
     *note zipimport: 138.

   - bpo-32892(126): The parser now represents all constants as *note
     ast.Constant: 2ef. instead of using specific constant AST types
     (‘Num’, ‘Str’, ‘Bytes’, ‘NameConstant’ and ‘Ellipsis’).  These
     classes are considered deprecated and will be removed in future
     Python versions.

   - bpo-34728(127): Add deprecation warning when ‘loop’ is used in
     methods: ‘asyncio.sleep’, ‘asyncio.wait’ and ‘asyncio.wait_for’.

   - bpo-34738(128): ZIP files created by ‘distutils’ will now include
     entries for directories.

   - bpo-34659(129): Add an optional 'initial' argument to
     itertools.accumulate().

   - bpo-29577(130): Support multiple mixin classes when creating Enums.

   - bpo-34670(131): Add SSLContext.post_handshake_auth and
     SSLSocket.verify_client_post_handshake for TLS 1.3's post handshake
     authentication feature.

   - bpo-32718(132): The Activate.ps1 script from venv works with
     PowerShell Core 6.1 and is now available under all operating
     systems.

   - bpo-31177(133): Fix bug that prevented using *note reset_mock: ef6.
     on mock instances with deleted attributes

   - bpo-34672(134): Add a workaround, so the ‘'Z'’ *note
     time.strftime(): 1402. specifier on the musl C library can work in
     some cases.

   - bpo-34666(135): Implement ‘asyncio.StreamWriter.awrite’ and
     ‘asyncio.StreamWriter.aclose()’ coroutines.  Methods are needed for
     providing a consistent stream API with control flow switched on by
     default.

   - bpo-6721(136): Acquire the logging module's commonly used internal
     locks while fork()ing to avoid deadlocks in the child process.

   - bpo-34658(137): Fix a rare interpreter unhandled exception state
     SystemError only seen when using subprocess with a preexec_fn while
     an after_parent handler has been registered with
     os.register_at_fork and the fork system call fails.

   - bpo-34652(138): Ensure *note os.lchmod(): 528. is never defined on
     Linux.

   - bpo-34638(139): Store a weak reference to stream reader to break
     strong references loop between reader and protocol.  It allows to
     detect and close the socket if the stream is deleted (garbage
     collected) without ‘close()’ call.

   - bpo-34536(140): ‘Enum._missing_’: raise ‘ValueError’ if None
     returned and ‘TypeError’ if non-member is returned.

   - bpo-34636(141): Speed up re scanning of many non-matching
     characters for s w and d within bytes objects.  (microoptimization)

   - bpo-24412(142): Add *note addModuleCleanup(): c40. and *note
     addClassCleanup(): c41. to unittest to support cleanups for *note
     setUpModule(): c42. and *note setUpClass(): c43.  Patch by Lisa
     Roach.

   - bpo-34630(143): Don't log SSL certificate errors in asyncio code
     (connection error logging is skipped already).

   - bpo-32490(144): Prevent filename duplication in *note subprocess:
     dc. exception messages.  Patch by Zackery Spytz.

   - bpo-34363(145): dataclasses.asdict() and .astuple() now handle
     namedtuples correctly.

   - bpo-34625(146): Update vendorized expat library version to 2.2.6.

   - bpo-32270(147): The subprocess module no longer mistakenly closes
     redirected fds even when they were in pass_fds when outside of the
     default {0, 1, 2} set.

   - bpo-34622(148): Create a dedicated ‘asyncio.CancelledError’,
     ‘asyncio.InvalidStateError’ and ‘asyncio.TimeoutError’ exception
     classes.  Inherit them from corresponding exceptions from
     ‘concurrent.futures’ package.  Extract ‘asyncio’ exceptions into a
     separate file.

   - bpo-34610(149): Fixed iterator of
     ‘multiprocessing.managers.DictProxy’.

   - bpo-34421(150): Fix distutils logging for non-ASCII strings.  This
     caused installation issues on Windows.

   - bpo-34604(151): Fix possible mojibake in the error message of
     ‘pwd.getpwnam’ and ‘grp.getgrnam’ using string representation
     because of invisible characters or trailing whitespaces.  Patch by
     William Grzybowski.

   - bpo-30977(152): Make uuid.UUID use ‘__slots__’ to reduce its memory
     footprint.  Based on original patch by Wouter Bolsterlee.

   - bpo-34574(153): OrderedDict iterators are not exhausted during
     pickling anymore.  Patch by Sergey Fedoseev.

   - bpo-8110(154): Refactored *note subprocess: dc. to check for
     Windows-specific modules rather than ‘sys.platform == 'win32'’.

   - bpo-34530(155): ‘distutils.spawn.find_executable()’ now falls back
     on *note os.defpath: 1de4. if the ‘PATH’ environment variable is
     not set.

   - bpo-34563(156): On Windows, fix multiprocessing.Connection for very
     large read: fix _winapi.PeekNamedPipe() and _winapi.ReadFile() for
     read larger than INT_MAX (usually ‘2**31-1’).

   - bpo-34558(157): Correct typo in Lib/ctypes/_aix.py

   - bpo-34282(158): Move ‘Enum._convert’ to ‘EnumMeta._convert_’ and
     fix enum members getting shadowed by parent attributes.

   - bpo-22872(159): When the queue is closed, *note ValueError: 2ec. is
     now raised by *note multiprocessing.Queue.put(): 1e1d. and *note
     multiprocessing.Queue.get(): 1e1e. instead of *note AssertionError:
     8b8. and *note OSError: 2c0, respectively.  Patch by Zackery Spytz.

   - bpo-34515(160): Fix parsing non-ASCII identifiers in
     ‘lib2to3.pgen2.tokenize’ ( PEP 3131(161)).

   - bpo-13312(162): Avoids a possible integer underflow (undefined
     behavior) in the time module's year handling code when passed a
     very low negative year value.

   - bpo-34472(163): Improved compatibility for streamed files in *note
     zipfile: 137.  Previously an optional signature was not being
     written and certain ZIP applications were not supported.  Patch by
     Silas Sewell.

   - bpo-34454(164): Fix the .fromisoformat() methods of datetime types
     crashing when given unicode with non-UTF-8-encodable code points.
     Specifically, datetime.fromisoformat() now accepts surrogate
     unicode code points used as the separator.  Report and tests by
     Alexey Izbyshev, patch by Paul Ganssle.

   - bpo-6700(165): Fix inspect.getsourcelines for module level
     frames/tracebacks.  Patch by Vladimir Matveev.

   - bpo-34171(166): Running the *note trace: 103. module no longer
     creates the ‘trace.cover’ file.

   - bpo-34441(167): Fix crash when an ‘ABC’-derived class with invalid
     ‘__subclasses__’ is passed as the second argument to *note
     issubclass(): 9c4.  Patch by Alexey Izbyshev.

   - bpo-34427(168): Fix infinite loop in ‘a.extend(a)’ for
     ‘MutableSequence’ subclasses.

   - bpo-34412(169): Make *note signal.strsignal(): 1e1f. work on HP-UX.
     Patch by Michael Osipov.

   - bpo-20849(170): shutil.copytree now accepts a new ‘dirs_exist_ok’
     keyword argument.  Patch by Josh Bronson.

   - bpo-31715(171): Associate ‘.mjs’ file extension with
     ‘application/javascript’ MIME Type.

   - bpo-34384(172): *note os.readlink(): b1a. now accepts *note
     path-like: 5a1. and *note bytes: 192. objects on Windows.

   - bpo-22602(173): The UTF-7 decoder now raises *note
     UnicodeDecodeError: c08. for ill-formed sequences starting with "+"
     (as specified in RFC 2152).  Patch by Zackery Spytz.

   - bpo-2122(174): The *note mmap.flush(): c8f. method now returns
     ‘None’ on success, raises an exception on error under all
     platforms.

   - bpo-34341(175): Appending to the ZIP archive with the ZIP64
     extension no longer grows the size of extra fields of existing
     entries.

   - bpo-34333(176): Fix %-formatting in *note
     pathlib.PurePath.with_suffix(): 1956. when formatting an error
     message.

   - bpo-18540(177): The *note imaplib.IMAP4: aff. and *note
     imaplib.IMAP4_SSL: b00. classes now resolve to the local host IP
     correctly when the default value of 'host' parameter (‘''’) is
     used.

   - bpo-26502(178): Implement ‘traceback.FrameSummary.__len__()’ method
     to preserve compatibility with the old tuple API.

   - bpo-34318(179): *note assertRaises(): 750, *note
     assertRaisesRegex(): 752, *note assertWarns(): 137c. and *note
     assertWarnsRegex(): 137d. no longer success if the passed callable
     is None.  They no longer ignore unknown keyword arguments in the
     context manager mode.  A DeprecationWarning was raised in these
     cases since Python 3.5.

   - bpo-9372(180): Deprecate *note __getitem__(): 588. methods of *note
     xml.dom.pulldom.DOMEventStream: 93e, *note
     wsgiref.util.FileWrapper: 93f. and *note fileinput.FileInput: 940.

   - bpo-33613(181): Fix a race condition in
     ‘multiprocessing.semaphore_tracker’ when the tracker receives
     SIGINT before it can register signal handlers for ignoring it.

   - bpo-34248(182): Report filename in the exception raised when the
     database file cannot be opened by *note dbm.gnu.open(): 1e20. and
     *note dbm.ndbm.open(): 1e21. due to OS-related error.  Patch by
     Zsolt Cserna.

   - bpo-33089(183): Add math.dist() to compute the Euclidean distance
     between two points.

   - bpo-34246(184): *note smtplib.SMTP.send_message(): 105a. no longer
     modifies the content of the 'mail_options' argument.  Patch by
     Pablo S. Blum de Aguiar.

   - bpo-31047(185): Fix ‘ntpath.abspath’ for invalid paths on windows.
     Patch by Franz Woellert.

   - bpo-32321(186): Add pure Python fallback for functools.reduce.
     Patch by Robert Wright.

   - bpo-34270(187): The default asyncio task class now always has a
     name which can be get or set using two new methods (*note
     get_name(): bd1. and *note set_name(): bd0.) and is visible in the
     *note repr(): 1c1. output.  An initial name can also be set using
     the new ‘name’ keyword argument to *note asyncio.create_task():
     1c9. or the ‘create_task()’ method of the event loop.  If no
     initial name is set, the default Task implementation generates a
     name like ‘Task-1’ using a monotonic counter.

   - bpo-34263(188): asyncio's event loop will not pass timeouts longer
     than one day to epoll/select etc.

   - bpo-34035(189): Fix several AttributeError in zipfile seek()
     methods.  Patch by Mickaël Schoentgen.

   - bpo-32215(190): Fix performance regression in *note sqlite3: d4.
     when a DML statement appeared in a different line than the rest of
     the SQL query.

   - bpo-34075(191): Deprecate passing non-ThreadPoolExecutor instances
     to ‘AbstractEventLoop.set_default_executor()’.

   - bpo-34251(192): Restore ‘msilib.Win64’ to preserve backwards
     compatibility since it's already used by ‘distutils’' ‘bdist_msi’
     command.

   - bpo-19891(193): Ignore errors caused by missing / non-writable
     homedir while writing history during exit of an interactive
     session.  Patch by Anthony Sottile.

   - bpo-33089(194): Enhanced math.hypot() to support more than two
     dimensions.

   - bpo-34228(195): tracemalloc: PYTHONTRACEMALLOC=0 environment
     variable and -X tracemalloc=0 command line option are now allowed
     to disable explicitly tracemalloc at startup.

   - bpo-13041(196): Use *note shutil.get_terminal_size(): 131b. to
     calculate the terminal width correctly in the
     ‘argparse.HelpFormatter’ class.  Initial patch by Zbyszek
     Jędrzejewski-Szmek.

   - bpo-34213(197): Allow frozen dataclasses to have a field named
     "object".  Previously this conflicted with an internal use of
     "object".

   - bpo-34052(198): *note sqlite3.Connection.create_aggregate(): 5a8,
     *note sqlite3.Connection.create_function(): 5a7, *note
     sqlite3.Connection.set_authorizer(): 5a9, *note
     sqlite3.Connection.set_progress_handler(): 5aa. methods raises
     TypeError when unhashable objects are passed as callable.  These
     methods now don't pass such objects to SQLite API. Previous
     behavior could lead to segfaults.  Patch by Sergey Fedoseev.

   - bpo-34197(199): Attributes 'skipinitialspace', 'doublequote' and
     'strict' of the 'dialect' attribute of the *note csv: 2d. reader
     are now *note bool: 3c3. instances instead of integers 0 or 1.

   - bpo-32788(200): Errors other than *note TypeError: 198. raised in
     methods ‘__adapt__()’ and ‘__conform__()’ in the *note sqlite3: d4.
     module are now propagated to the user.

   - bpo-21446(201): The ‘reload’ fixer now uses *note
     importlib.reload(): 73d. instead of deprecated ‘imp.reload()’.

   - bpo-940286(202): pydoc's ‘Helper.showtopic()’ method now prints the
     cross references of a topic correctly.

   - bpo-34164(203): *note base64.b32decode(): 1226. could raise
     UnboundLocalError or OverflowError for incorrect padding.  Now it
     always raises ‘base64.Error’ in these cases.

   - bpo-33729(204): Fixed issues with arguments parsing in *note
     hashlib: 6c.

   - bpo-34097(205): ZipFile can zip files older than 1980-01-01 and
     newer than 2107-12-31 using a new ‘strict_timestamps’ parameter at
     the cost of setting the timestamp to the limit.

   - bpo-34108(206): Remove extraneous CR in 2to3 refactor.

   - bpo-34070(207): Make sure to only check if the handle is a tty,
     when opening a file with ‘buffering=-1’.

   - bpo-27494(208): Reverted bpo-27494(209).  2to3 rejects now a
     trailing comma in generator expressions.

   - bpo-33967(210): functools.singledispatch now raises TypeError
     instead of IndexError when no positional arguments are passed.

   - bpo-34041(211): Add the parameter 'deterministic' to the *note
     sqlite3.Connection.create_function(): 5a7. method.  Patch by Sergey
     Fedoseev.

   - bpo-34056(212): Ensure the loader shim created by ‘imp.load_module’
     always returns bytes from its ‘get_data()’ function.  This fixes
     using ‘imp.load_module’ with PEP 552(213) hash-based pycs.

   - bpo-34054(214): The multiprocessing module now uses the monotonic
     clock *note time.monotonic(): 55c. instead of the system clock
     *note time.time(): 55d. to implement timeout.

   - bpo-34043(215): Optimize tarfile uncompress performance about 15%
     when gzip is used.

   - bpo-34044(216): ‘subprocess.Popen’ now copies the 'startupinfo'
     argument to leave it unchanged: it will modify the copy, so that
     the same ‘STARTUPINFO’ object can be used multiple times.

   - bpo-34010(217): Fixed a performance regression for reading streams
     with tarfile.  The buffered read should use a list, instead of
     appending to a bytes object.

   - bpo-34019(218): webbrowser: Correct the arguments passed to Opera
     Browser when opening a new URL using the ‘webbrowser’ module.
     Patch by Bumsik Kim.

   - bpo-34003(219): csv.DictReader now creates dicts instead of
     OrderedDicts.  Patch by Michael Selik.

   - bpo-33978(220): Closed existing logging handlers before
     reconfiguration via fileConfig and dictConfig.  Patch by
     Karthikeyan Singaravelan.

   - bpo-14117(221): Make minor tweaks to turtledemo.  The 'wikipedia'
     example is now 'rosette', describing what it draws.  The 'penrose'
     print output is reduced.  The'1024' output of 'tree' is eliminated.

   - bpo-33974(222): Fixed passing lists and tuples of strings
     containing special characters ‘"’, ‘\’, ‘{’, ‘}’ and ‘\n’ as
     options to *note ttk: ff. widgets.

   - bpo-27500(223): Fix getaddrinfo to resolve IPv6 addresses
     correctly.

   - bpo-24567(224): Improve random.choices() to handle subnormal input
     weights that could occasionally trigger an IndexError.

   - bpo-33871(225): Fixed integer overflow in *note os.readv(): d55,
     *note os.writev(): d58, *note os.preadv(): d54. and *note
     os.pwritev(): d57. and in *note os.sendfile(): d05. with 'headers'
     or 'trailers' arguments (on BSD-based OSes and macOS).

   - bpo-25007(226): Add *note copy.copy(): 757. and *note
     copy.deepcopy(): d65. support to zlib compressors and
     decompressors.  Patch by Zackery Spytz.

   - bpo-33929(227): multiprocessing: Fix a race condition in Popen of
     multiprocessing.popen_spawn_win32.  The child process now
     duplicates the read end of pipe instead of "stealing" it.
     Previously, the read end of pipe was "stolen" by the child process,
     but it leaked a handle if the child process had been terminated
     before it could steal the handle from the parent process.

   - bpo-33899(228): Tokenize module now implicitly emits a NEWLINE when
     provided with input that does not have a trailing new line.  This
     behavior now matches what the C tokenizer does internally.
     Contributed by Ammar Askar.

   - bpo-33897(229): Added a 'force' keyword argument to
     logging.basicConfig().

   - bpo-33695(230): *note shutil.copytree(): c1e. uses *note
     os.scandir(): c54. function and all copy functions depending from
     it use cached *note os.stat(): 26d. values.  The speedup for
     copying a directory with 8000 files is around +9% on Linux, +20% on
     Windows and + 30% on a Windows SMB share.  Also the number of *note
     os.stat(): 26d. syscalls is reduced by 38% making *note
     shutil.copytree(): c1e. especially faster on network filesystems.
     (Contributed by Giampaolo Rodola' in bpo-33695(231).)

   - bpo-33916(232): bz2 and lzma: When Decompressor.__init__() is
     called twice, free the old lock to not leak memory.

   - bpo-32568(233): Make select.epoll() and its documentation
     consistent regarding 'sizehint' and 'flags'.

   - bpo-33833(234): Fixed bug in asyncio where ProactorSocketTransport
     logs AssertionError if force closed during write.

   - bpo-33663(235): Convert content length to string before putting to
     header.

   - bpo-33721(236): *note os.path: a6. functions that return a boolean
     result like *note exists(): c03, *note lexists(): c04, *note
     isdir(): c05, *note isfile(): c06, *note islink(): c01, and *note
     ismount(): c07, and *note pathlib.Path: 266. methods that return a
     boolean result like *note exists(): c0b, *note is_dir(): 53a, *note
     is_file(): 539, *note is_mount(): c0c, *note is_symlink(): c0d,
     *note is_block_device(): c0e, *note is_char_device(): c0f, *note
     is_fifo(): c10, *note is_socket(): c11. now return ‘False’ instead
     of raising *note ValueError: 2ec. or its subclasses *note
     UnicodeEncodeError: 887. and *note UnicodeDecodeError: c08. for
     paths that contain characters or bytes unrepresentable at the OS
     level.

   - bpo-26544(237): Fixed implementation of *note platform.libc_ver():
     17f5.  It almost always returned version '2.9' for glibc.

   - bpo-33843(238): Remove deprecated ‘cgi.escape’, ‘cgi.parse_qs’ and
     ‘cgi.parse_qsl’.

   - bpo-33842(239): Remove ‘tarfile.filemode’ which is deprecated since
     Python 3.3.

   - bpo-30167(240): Prevent site.main() exception if PYTHONSTARTUP is
     set.  Patch by Steve Weber.

   - bpo-33805(241): Improve error message of dataclasses.replace() when
     an InitVar is not specified

   - bpo-33687(242): Fix the call to ‘os.chmod()’ for ‘uu.decode()’ if a
     mode is given or decoded.  Patch by Timo Furrer.

   - bpo-33812(243): Datetime instance d with non-None tzinfo, but with
     d.tzinfo.utcoffset(d) returning None is now treated as naive by the
     astimezone() method.

   - bpo-32108(244): In configparser, don't clear section when it is
     assigned to itself.

   - bpo-27397(245): Make email module properly handle invalid-length
     base64 strings.

   - bpo-33578(246): Implement multibyte encoder/decoder state methods

   - bpo-30805(247): Avoid race condition with debug logging

   - bpo-33476(248): Fix _header_value_parser.py when address group is
     missing final ';'.  Contributed by Enrique Perez-Terron

   - bpo-33694(249): asyncio: Fix a race condition causing data loss on
     pause_reading()/resume_reading() when using the ProactorEventLoop.

   - bpo-32493(250): Correct test for ‘uuid_enc_be’ availability in
     ‘configure.ac’.  Patch by Michael Felt.

   - bpo-33792(251): Add asyncio.WindowsSelectorEventLoopPolicy and
     asyncio.WindowsProactorEventLoopPolicy.

   - bpo-33274(252): W3C DOM Level 1 specifies return value of
     Element.removeAttributeNode() as "The Attr node that was removed."
     xml.dom.minidom now complies with this requirement.

   - bpo-33778(253): Update ‘unicodedata’'s database to Unicode version
     11.0.0.

   - bpo-33165(254): Added a stacklevel parameter to logging calls to
     allow use of wrapper/helper functions for logging APIs.

   - bpo-33770(255): improve base64 exception message for encoded inputs
     of invalid length

   - bpo-33769(256): asyncio/start_tls: Fix error message; cancel
     callbacks in case of an unhandled error; mark SSLTransport as
     closed if it is aborted.

   - bpo-33767(257): The concatenation (‘+’) and repetition (‘*’)
     sequence operations now raise *note TypeError: 198. instead of
     *note SystemError: 795. when performed on *note mmap.mmap: 519.
     objects.  Patch by Zackery Spytz.

   - bpo-33734(258): asyncio/ssl: Fix AttributeError, increase default
     handshake timeout

   - bpo-31014(259): Fixed creating a controller for *note webbrowser:
     11b. when a user specifies a path to an entry in the BROWSER
     environment variable.  Based on patch by John Still.

   - bpo-2504(260): Add gettext.pgettext() and variants.

   - bpo-33197(261): Add description property for _ParameterKind

   - bpo-32751(262): When cancelling the task due to a timeout, *note
     asyncio.wait_for(): 815. will now wait until the cancellation is
     complete.

   - bpo-32684(263): Fix gather to propagate cancellation of itself even
     with return_exceptions.

   - bpo-33654(264): Support protocol type switching in
     SSLTransport.set_protocol().

   - bpo-33674(265): Pause the transport as early as possible to further
     reduce the risk of data_received() being called before
     connection_made().

   - bpo-33671(266): *note shutil.copyfile(): c4e, *note shutil.copy():
     c4f, *note shutil.copy2(): c50, *note shutil.copytree(): c1e. and
     *note shutil.move(): c51. use platform-specific fast-copy syscalls
     on Linux and macOS in order to copy the file more efficiently.  On
     Windows *note shutil.copyfile(): c4e. uses a bigger default buffer
     size (1 MiB instead of 16 KiB) and a *note memoryview(): 165.-based
     variant of *note shutil.copyfileobj(): c52. is used.  The speedup
     for copying a 512MiB file is about +26% on Linux, +50% on macOS and
     +40% on Windows.  Also, much less CPU cycles are consumed.
     (Contributed by Giampaolo Rodola' in bpo-25427(267).)

   - bpo-33674(268): Fix a race condition in
     SSLProtocol.connection_made() of asyncio.sslproto: start
     immediately the handshake instead of using call_soon().
     Previously, data_received() could be called before the handshake
     started, causing the handshake to hang or fail.

   - bpo-31647(269): Fixed bug where calling write_eof() on a
     _SelectorSocketTransport after it's already closed raises
     AttributeError.

   - bpo-32610(270): Make asyncio.all_tasks() return only pending tasks.

   - bpo-32410(271): Avoid blocking on file IO in sendfile fallback code

   - bpo-33469(272): Fix RuntimeError after closing loop that used
     run_in_executor

   - bpo-33672(273): Fix Task.__repr__ crash with Cython's bogus
     coroutines

   - bpo-33654(274): Fix transport.set_protocol() to support switching
     between asyncio.Protocol and asyncio.BufferedProtocol.  Fix
     loop.start_tls() to work with asyncio.BufferedProtocols.

   - bpo-33652(275): Pickles of type variables and subscripted generics
     are now future-proof and compatible with older Python versions.

   - bpo-32493(276): Fixed *note uuid.uuid1(): da1. on FreeBSD.

   - bpo-33238(277): Add ‘InvalidStateError’ to *note
     concurrent.futures: 24.  ‘Future.set_result’ and
     ‘Future.set_exception’ now raise ‘InvalidStateError’ if the futures
     are not pending or running.  Patch by Jason Haydaman.

   - bpo-33618(278): Finalize and document preliminary and experimental
     TLS 1.3 support with OpenSSL 1.1.1

   - bpo-33625(279): Release GIL on ‘grp.getgrnam’, ‘grp.getgrgid’,
     ‘pwd.getpwnam’ and ‘pwd.getpwuid’ if reentrant variants of these
     functions are available.  Patch by William Grzybowski.

   - bpo-33623(280): Fix possible SIGSGV when asyncio.Future is created
     in __del__

   - bpo-11874(281): Use a better regex when breaking usage into
     wrappable parts.  Avoids bogus assertion errors from custom metavar
     strings.

   - bpo-30877(282): Fixed a bug in the Python implementation of the
     JSON decoder that prevented the cache of parsed strings from
     clearing after finishing the decoding.  Based on patch by c-fos.

   - bpo-33604(283): Remove HMAC default to md5 marked for removal in
     3.8 (removal originally planned in 3.6, bump to 3.8 in PR 7062).

   - bpo-33582(284): Emit a deprecation warning for
     inspect.formatargspec

   - bpo-21145(285): Add ‘functools.cached_property’ decorator, for
     computed properties cached for the life of the instance.

   - bpo-33570(286): Change TLS 1.3 cipher suite settings for
     compatibility with OpenSSL 1.1.1-pre6 and newer.  OpenSSL 1.1.1
     will have TLS 1.3 ciphers enabled by default.

   - bpo-28556(287): Do not simplify arguments to ‘typing.Union’.  Now
     ‘Union[Manager, Employee]’ is not simplified to ‘Employee’ at
     runtime.  Such simplification previously caused several bugs and
     limited possibilities for introspection.

   - bpo-12486(288): *note tokenize.generate_tokens(): 701. is now
     documented as a public API to tokenize unicode strings.  It was
     previously present but undocumented.

   - bpo-33540(289): Add a new ‘block_on_close’ class attribute to
     ‘ForkingMixIn’ and ‘ThreadingMixIn’ classes of *note socketserver:
     d2.

   - bpo-33548(290): tempfile._candidate_tempdir_list should consider
     common TEMP locations

   - bpo-33109(291): argparse subparsers are once again not required by
     default, reverting the change in behavior introduced by
     bpo-26510(292) in 3.7.0a2.

   - bpo-33541(293): Remove unused private method
     ‘_strptime.LocaleTime.__pad’ (a.k.a.  ‘_LocaleTime__pad’).

   - bpo-33536(294): dataclasses.make_dataclass now checks for invalid
     field names and duplicate fields.  Also, added a check for invalid
     field specifications.

   - bpo-33542(295): Prevent ‘uuid.get_node’ from using a DUID instead
     of a MAC on Windows.  Patch by Zvi Effron

   - bpo-26819(296): Fix race condition with
     ‘ReadTransport.resume_reading’ in Windows proactor event loop.

   - Fix failure in ‘typing.get_type_hints()’ when ClassVar was provided
     as a string forward reference.

   - bpo-33516(297): *note unittest.mock.MagicMock: 108f. now supports
     the ‘__round__’ magic method.

   - bpo-28612(298): Added support for Site Maps to urllib's
     ‘RobotFileParser’ as *note RobotFileParser.site_maps(): 1e22.
     Patch by Lady Red, based on patch by Peter Wirtz.

   - bpo-28167(299): Remove platform.linux_distribution, which was
     deprecated since 3.5.

   - bpo-33504(300): Switch the default dictionary implementation for
     *note configparser: 26. from *note collections.OrderedDict: 7f3. to
     the standard *note dict: 183. type.

   - bpo-33505(301): Optimize asyncio.ensure_future() by reordering if
     checks: 1.17x faster.

   - bpo-33497(302): Add errors param to cgi.parse_multipart and make an
     encoding in FieldStorage use the given errors (needed for Twisted).
     Patch by Amber Brown.

   - bpo-29235(303): The ‘cProfile.Profile’ class can now be used as a
     context manager.  Patch by Scott Sanderson.

   - bpo-33495(304): Change dataclasses.Fields repr to use the repr of
     each of its members, instead of str.  This makes it more clear what
     each field actually represents.  This is especially true for the
     'type' member.

   - bpo-26103(305): Correct ‘inspect.isdatadescriptor’ to look for
     ‘__set__’ or ‘__delete__’.  Patch by Aaron Hall.

   - bpo-29209(306): Removed the ‘doctype()’ method and the 'html'
     parameter of the constructor of *note XMLParser: c49.  The
     ‘doctype()’ method defined in a subclass will no longer be called.
     Deprecated methods ‘getchildren()’ and ‘getiterator()’ in the *note
     ElementTree: 12b. module emit now a *note DeprecationWarning: 1a3.
     instead of *note PendingDeprecationWarning: ac5.

   - bpo-33453(307): Fix dataclasses to work if using literal string
     type annotations or if using PEP 563 "Postponed Evaluation of
     Annotations".  Only specific string prefixes are detected for both
     ClassVar ("ClassVar" and "typing.ClassVar") and InitVar ("InitVar"
     and "dataclasses.InitVar").

   - bpo-28556(308): Minor fixes in typing module: add annotations to
     ‘NamedTuple.__new__’, pass ‘*args’ and ‘**kwds’ in
     ‘Generic.__new__’.  Original PRs by Paulius Šarka and Chad
     Dombrova.

   - bpo-33365(309): Print the header values besides the header keys
     instead just the header keys if 'debuglevel' is set to >0 in *note
     http.client: 73.  Patch by Marco Strigl.

   - bpo-20087(310): Updated alias mapping with glibc 2.27 supported
     locales.

   - bpo-33422(311): Fix trailing quotation marks getting deleted when
     looking up byte/string literals on pydoc.  Patch by Andrés Delfino.

   - bpo-28167(312): The function ‘platform.linux_distribution’ and
     ‘platform.dist’ now trigger a ‘DeprecationWarning’ and have been
     marked for removal in Python 3.8

   - bpo-33281(313): Fix ctypes.util.find_library regression on macOS.

   - bpo-33311(314): Text and html output generated by cgitb does not
     display parentheses if the current call is done directly in the
     module.  Patch by Stéphane Blondon.

   - bpo-27300(315): The file classes in 'tempfile' now accept an
     'errors' parameter that complements the already existing
     'encoding'.  Patch by Stephan Hohe.

   - bpo-32933(316): *note unittest.mock.mock_open(): 11e9. now supports
     iteration over the file contents.  Patch by Tony Flury.

   - bpo-33217(317): Raise *note TypeError: 198. when looking up
     non-Enum objects in Enum classes and Enum members.

   - bpo-33197(318): Update error message when constructing invalid
     inspect.Parameters Patch by Donghee Na.

   - bpo-33383(319): Fixed crash in the get() method of the *note
     dbm.ndbm: 38. database object when it is called with a single
     argument.

   - bpo-33375(320): The warnings module now finds the Python file
     associated with a warning from the code object, rather than the
     frame's global namespace.  This is consistent with how tracebacks
     and pdb find filenames, and should work better for dynamically
     executed code.

   - bpo-33336(321): ‘imaplib’ now allows ‘MOVE’ command in
     ‘IMAP4.uid()’ (RFC 6851: IMAP MOVE Extension) and potentially as a
     name of supported method of ‘IMAP4’ object.

   - bpo-32455(322): Added 'jump' parameter to *note dis.stack_effect():
     1132.

   - bpo-27485(323): Rename and deprecate undocumented functions in
     *note urllib.parse(): 110.

   - bpo-33332(324): Add ‘signal.valid_signals()’ to expose the POSIX
     sigfillset() functionality.

   - bpo-33251(325): ‘ConfigParser.items()’ was fixed so that key-value
     pairs passed in via *note vars(): 1e23. are not included in the
     resulting output.

   - bpo-33329(326): Fix multiprocessing regression on newer glibcs

   - bpo-33334(327): *note dis.stack_effect(): 1132. now supports all
     defined opcodes including NOP and EXTENDED_ARG.

   - bpo-991266(328): Fix quoting of the ‘Comment’ attribute of *note
     http.cookies.SimpleCookie: 1e24.

   - bpo-33131(329): Upgrade bundled version of pip to 10.0.1.

   - bpo-33308(330): Fixed a crash in the ‘parser’ module when
     converting an ST object to a tree of tuples or lists with
     ‘line_info=False’ and ‘col_info=True’.

   - bpo-23403(331): lib2to3 now uses pickle protocol 4 for pre-computed
     grammars.

   - bpo-33266(332): lib2to3 now recognizes ‘rf'...'’ strings.

   - bpo-11594(333): Ensure line-endings are respected when using
     lib2to3.

   - bpo-33254(334): Have *note importlib.resources.contents(): 503. and
     ‘importlib.abc.ResourceReader.contents()’ return an *note iterable:
     12f1. instead of an *note iterator: 4c8.

   - bpo-33265(335): ‘contextlib.ExitStack’ and
     ‘contextlib.AsyncExitStack’ now use a method instead of a wrapper
     function for exit callbacks.

   - bpo-33263(336): Fix FD leak in ‘_SelectorSocketTransport’ Patch by
     Vlad Starostin.

   - bpo-33256(337): Fix display of ‘<module>’ call in the html produced
     by ‘cgitb.html()’.  Patch by Stéphane Blondon.

   - bpo-33144(338): ‘random.Random()’ and its subclassing mechanism got
     optimized to check only once at class/subclass instantiation time
     whether its ‘getrandbits()’ method can be relied on by other
     methods, including ‘randrange()’, for the generation of arbitrarily
     large random integers.  Patch by Wolfgang Maier.

   - bpo-33185(339): Fixed regression when running pydoc with the *note
     -m: 23c. switch.  (The regression was introduced in 3.7.0b3 by the
     resolution of bpo-33053(340))

     This fix also changed pydoc to add ‘os.getcwd()’ to *note sys.path:
     3e4. when necessary, rather than adding ‘"."’.

   - bpo-29613(341): Added support for the ‘SameSite’ cookie flag to the
     ‘http.cookies’ module.

   - bpo-33169(342): Delete entries of ‘None’ in *note
     sys.path_importer_cache: 7fa. when
     ‘importlib.machinery.invalidate_caches()’ is called.

   - bpo-33203(343): ‘random.Random.choice()’ now raises ‘IndexError’
     for empty sequences consistently even when called from subclasses
     without a ‘getrandbits()’ implementation.

   - bpo-33224(344): Update difflib.mdiff() for PEP 479(345).  Convert
     an uncaught StopIteration in a generator into a return-statement.

   - bpo-33209(346): End framing at the end of C implementation of *note
     pickle.Pickler.dump(): 1e25.

   - bpo-32861(347): The urllib.robotparser's ‘__str__’ representation
     now includes wildcard entries and the "Crawl-delay" and
     "Request-rate" fields.  Also removes extra newlines that were being
     appended to the end of the string.  Patch by Michael Lazar.

   - bpo-23403(348): ‘DEFAULT_PROTOCOL’ in *note pickle: ab. was bumped
     to 4.  Protocol 4 is described in PEP 3154(349) and available since
     Python 3.4.  It offers better performance and smaller size compared
     to protocol 3 introduced in Python 3.0.

   - bpo-20104(350): Improved error handling and fixed a reference leak
     in *note os.posix_spawn(): 52e.

   - bpo-33106(351): Deleting a key from a read-only dbm database raises
     module specific error instead of KeyError.

   - bpo-33175(352): In dataclasses, Field.__set_name__ now looks up the
     __set_name__ special method on the class, not the instance, of the
     default value.

   - bpo-32380(353): Create functools.singledispatchmethod to support
     generic single dispatch on descriptors and methods.

   - bpo-33141(354): Have Field objects pass through __set_name__ to
     their default values, if they have their own __set_name__.

   - bpo-33096(355): Allow ttk.Treeview.insert to insert iid that has a
     false boolean value.  Note iid=0 and iid=False would be same.
     Patch by Garvit Khatri.

   - bpo-32873(356): Treat type variables and special typing forms as
     immutable by copy and pickle.  This fixes several minor issues and
     inconsistencies, and improves backwards compatibility with Python
     3.6.

   - bpo-33134(357): When computing dataclass's __hash__, use the lookup
     table to contain the function which returns the __hash__ value.
     This is an improvement over looking up a string, and then testing
     that string to see what to do.

   - bpo-33127(358): The ssl module now compiles with LibreSSL 2.7.1.

   - bpo-32505(359): Raise TypeError if a member variable of a dataclass
     is of type Field, but doesn't have a type annotation.

   - bpo-33078(360): Fix the failure on OSX caused by the tests relying
     on sem_getvalue

   - bpo-33116(361): Add 'Field' to dataclasses.__all__.

   - bpo-32896(362): Fix an error where subclassing a dataclass with a
     field that uses a default_factory would generate an incorrect
     class.

   - bpo-33100(363): Dataclasses: If a field has a default value that's
     a MemberDescriptorType, then it's from that field being in
     __slots__, not an actual default value.

   - bpo-32953(364): If a non-dataclass inherits from a frozen
     dataclass, allow attributes to be added to the derived class.  Only
     attributes from the frozen dataclass cannot be assigned to.
     Require all dataclasses in a hierarchy to be either all frozen or
     all non-frozen.

   - bpo-33097(365): Raise RuntimeError when ‘executor.submit’ is called
     during interpreter shutdown.

   - bpo-32968(366): Modulo and floor division involving Fraction and
     float should return float.

   - bpo-33061(367): Add missing ‘NoReturn’ to ‘__all__’ in typing.py

   - bpo-33078(368): Fix the size handling in multiprocessing.Queue when
     a pickling error occurs.

   - bpo-33064(369): lib2to3 now properly supports trailing commas after
     ‘*args’ and ‘**kwargs’ in function signatures.

   - bpo-33056(370): FIX properly close leaking fds in
     concurrent.futures.ProcessPoolExecutor.

   - bpo-33021(371): Release the GIL during fstat() calls, avoiding hang
     of all threads when calling mmap.mmap(), os.urandom(), and
     random.seed().  Patch by Nir Soffer.

   - bpo-31804(372): Avoid failing in multiprocessing.Process if the
     standard streams are closed or None at exit.

   - bpo-33034(373): Providing an explicit error message when casting
     the port property to anything that is not an integer value using
     ‘urlparse()’ and ‘urlsplit()’.  Patch by Matt Eaton.

   - bpo-30249(374): Improve struct.unpack_from() exception messages for
     problems with the buffer size and offset.

   - bpo-33037(375): Skip sending/receiving data after SSL transport
     closing.

   - bpo-27683(376): Fix a regression in *note ipaddress: 84. that
     result of ‘hosts()’ is empty when the network is constructed by a
     tuple containing an integer mask and only 1 bit left for addresses.

   - bpo-22674(377): Add the strsignal() function in the signal module
     that returns the system description of the given signal, as
     returned by strsignal(3).

   - bpo-32999(378): Fix C implementation of ‘ABC.__subclasscheck__(cls,
     subclass)’ crashed when ‘subclass’ is not a type object.

   - bpo-33009(379): Fix inspect.signature() for single-parameter
     partialmethods.

   - bpo-32969(380): Expose several missing constants in zlib and fix
     corresponding documentation.

   - bpo-32056(381): Improved exceptions raised for invalid number of
     channels and sample width when read an audio file in modules
     ‘aifc’, *note wave: 119. and ‘sunau’.

   - bpo-32970(382): Improved disassembly of the MAKE_FUNCTION
     instruction.

   - bpo-32844(383): Fix wrong redirection of a low descriptor (0 or 1)
     to stderr in subprocess if another low descriptor is closed.

   - bpo-32960(384): For dataclasses, disallow inheriting frozen from
     non-frozen classes, and also disallow inheriting non-frozen from
     frozen classes.  This restriction will be relaxed at a future date.

   - bpo-32713(385): Fixed tarfile.itn handling of out-of-bounds float
     values.  Patch by Joffrey Fuhrer.

   - bpo-32257(386): The ssl module now contains OP_NO_RENEGOTIATION
     constant, available with OpenSSL 1.1.0h or 1.1.1.

   - bpo-32951(387): Direct instantiation of SSLSocket and SSLObject
     objects is now prohibited.  The constructors were never documented,
     tested, or designed as public constructors.  Users were suppose to
     use ssl.wrap_socket() or SSLContext.

   - bpo-32929(388): Remove the tri-state parameter "hash", and add the
     boolean "unsafe_hash".  If unsafe_hash is True, add a __hash__
     function, but if a __hash__ exists, raise TypeError.  If
     unsafe_hash is False, add a __hash__ based on the values of eq= and
     frozen=.  The unsafe_hash=False behavior is the same as the old
     hash=None behavior.  unsafe_hash=False is the default, just as
     hash=None used to be.

   - bpo-32947(389): Add OP_ENABLE_MIDDLEBOX_COMPAT and test workaround
     for TLSv1.3 for future compatibility with OpenSSL 1.1.1.

   - bpo-32146(390): Document the interaction between frozen executables
     and the spawn and forkserver start methods in multiprocessing.

   - bpo-30622(391): The ssl module now detects missing NPN support in
     LibreSSL.

   - bpo-32922(392): dbm.open() now encodes filename with the filesystem
     encoding rather than default encoding.

   - bpo-32759(393): Free unused arenas in multiprocessing.heap.

   - bpo-32859(394): In ‘os.dup2’, don't check every call whether the
     ‘dup3’ syscall exists or not.

   - bpo-32556(395): nt._getfinalpathname, nt._getvolumepathname and
     nt._getdiskusage now correctly convert from bytes.

   - bpo-21060(396): Rewrite confusing message from setup.py upload from
     "No dist file created in earlier command" to the more helpful "Must
     create and upload files in one command".

   - bpo-32857(397): In *note tkinter: f6, ‘after_cancel(None)’ now
     raises a *note ValueError: 2ec. instead of canceling the first
     scheduled function.  Patch by Cheryl Sabella.

   - bpo-32852(398): Make sure sys.argv remains as a list when running
     trace.

   - bpo-31333(399): ‘_abc’ module is added.  It is a speedup module
     with C implementations for various functions and methods in ‘abc’.
     Creating an ABC subclass and calling ‘isinstance’ or ‘issubclass’
     with an ABC subclass are up to 1.5x faster.  In addition, this
     makes Python start-up up to 10% faster.

     Note that the new implementation hides internal registry and
     caches, previously accessible via private attributes
     ‘_abc_registry’, ‘_abc_cache’, and ‘_abc_negative_cache’.  There
     are three debugging helper methods that can be used instead
     ‘_dump_registry’, ‘_abc_registry_clear’, and ‘_abc_caches_clear’.

   - bpo-32841(400): Fixed ‘asyncio.Condition’ issue which silently
     ignored cancellation after notifying and cancelling a conditional
     lock.  Patch by Bar Harel.

   - bpo-32819(401): ssl.match_hostname() has been simplified and no
     longer depends on re and ipaddress module for wildcard and IP
     addresses.  Error reporting for invalid wildcards has been
     improved.

   - bpo-19675(402): ‘multiprocessing.Pool’ no longer leaks processes if
     its initialization fails.

   - bpo-32394(403): socket: Remove
     TCP_FASTOPEN,TCP_KEEPCNT,TCP_KEEPIDLE,TCP_KEEPINTVL flags on older
     version Windows during run-time.

   - bpo-31787(404): Fixed refleaks of ‘__init__()’ methods in various
     modules.  (Contributed by Oren Milman)

   - bpo-30157(405): Fixed guessing quote and delimiter in
     csv.Sniffer.sniff() when only the last field is quoted.  Patch by
     Jake Davis.

   - bpo-30688(406): Added support of ‘\N{name}’ escapes in regular
     expressions.  Based on patch by Jonathan Eunice.

   - bpo-32792(407): collections.ChainMap() preserves the order of the
     underlying mappings.

   - bpo-32775(408): *note fnmatch.translate(): 184f. no longer produces
     patterns which contain set operations.  Sets starting with '[' or
     containing '-', '&&', '~~' or '||' will be interpreted differently
     in regular expressions in future versions.  Currently they emit
     warnings.  fnmatch.translate() now avoids producing patterns
     containing such sets by accident.

   - bpo-32622(409): Implement native fast sendfile for Windows proactor
     event loop.

   - bpo-32777(410): Fix a rare but potential pre-exec child process
     deadlock in subprocess on POSIX systems when marking file
     descriptors inheritable on exec in the child process.  This bug
     appears to have been introduced in 3.4.

   - bpo-32647(411): The ctypes module used to depend on indirect
     linking for dlopen.  The shared extension is now explicitly linked
     against libdl on platforms with dl.

   - bpo-32749(412): A *note dbm.dumb: 36. database opened with flags
     'r' is now read-only.  *note dbm.dumb.open(): c8d. with flags 'r'
     and 'w' no longer creates a database if it does not exist.

   - bpo-32741(413): Implement ‘asyncio.TimerHandle.when()’ method.

   - bpo-32691(414): Use mod_spec.parent when running modules with pdb

   - bpo-32734(415): Fixed ‘asyncio.Lock()’ safety issue which allowed
     acquiring and locking the same lock multiple times, without it
     being free.  Patch by Bar Harel.

   - bpo-32727(416): Do not include name field in SMTP envelope from
     address.  Patch by Stéphane Wirtel

   - bpo-31453(417): Add TLSVersion constants and
     SSLContext.maximum_version / minimum_version attributes.  The new
     API wraps OpenSSL 1.1
     ‘https://web.archive.org/web/20180309043602/https://www.openssl.org/docs/man1.1.0/ssl/SSL_CTX_set_min_proto_version.html’
     feature.

   - bpo-24334(418): Internal implementation details of ssl module were
     cleaned up.  The SSLSocket has one less layer of indirection.
     Owner and session information are now handled by the SSLSocket and
     SSLObject constructor.  Channel binding implementation has been
     simplified.

   - bpo-31848(419): Fix the error handling in Aifc_read.initfp() when
     the SSND chunk is not found.  Patch by Zackery Spytz.

   - bpo-32585(420): Add Ttk spinbox widget to *note tkinter.ttk: ff.
     Patch by Alan D Moore.

   - bpo-32512(421): *note profile: b4. CLI accepts ‘-m module_name’ as
     an alternative to script path.

   - bpo-8525(422): help() on a type now displays builtin subclasses.
     This is intended primarily to help with notification of more
     specific exception subclasses.

     Patch by Sanyam Khurana.

   - bpo-31639(423): http.server now exposes a ThreadingHTTPServer class
     and uses it when the module is run with ‘-m’ to cope with web
     browsers pre-opening sockets.

   - bpo-29877(424): compileall: import ProcessPoolExecutor only when
     needed, preventing hangs on low resource platforms

   - bpo-32221(425): Various functions returning tuple containing IPv6
     addresses now omit ‘%scope’ part since the same information is
     already encoded in 'scopeid' tuple item.  Especially this speeds up
     ‘socket.recvfrom()’ when it receives multicast packet since useless
     resolving of network interface name is omitted.

   - bpo-32147(426): *note binascii.unhexlify(): 1e26. is now up to 2
     times faster.  Patch by Sergey Fedoseev.

   - bpo-30693(427): The TarFile class now recurses directories in a
     reproducible way.

   - bpo-30693(428): The ZipFile class now recurses directories in a
     reproducible way.

   - bpo-31680(429): Added *note curses.ncurses_version: bda.

   - bpo-31908(430): Fix output of cover files for ‘trace’ module
     command-line tool.  Previously emitted cover files only when
     ‘--missing’ option was used.  Patch by Michael Selik.

   - bpo-31608(431): Raise a ‘TypeError’ instead of crashing if a
     ‘collections.deque’ subclass returns a non-deque from ‘__new__’.
     Patch by Oren Milman.

   - bpo-31425(432): Add support for sockets of the AF_QIPCRTR address
     family, supported by the Linux kernel.  This is used to communicate
     with services, such as GPS or radio, running on Qualcomm devices.
     Patch by Bjorn Andersson.

   - bpo-22005(433): Implemented unpickling instances of *note datetime:
     4e2, *note date: 1fa. and *note time: 1fb. pickled by Python 2.
     ‘encoding='latin1'’ should be used for successful decoding.

   - bpo-27645(434): *note sqlite3.Connection: 54d. now exposes a *note
     backup: d73. method, if the underlying SQLite library is at version
     3.6.11 or higher.  Patch by Lele Gaifax.

   - bpo-16865(435): Support arrays >=2GiB in *note ctypes: 2e.  Patch
     by Segev Finer.

   - bpo-31508(436): Removed support of arguments in
     ‘tkinter.ttk.Treeview.selection’.  It was deprecated in 3.6.  Use
     specialized methods like ‘selection_set’ for changing the
     selection.

   - bpo-29456(437): Fix bugs in hangul normalization: u1176, u11a7 and
     u11c3

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35845

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35864

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35537

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35847

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35813

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35780

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35537

   (8) https://bugs.python.org/issue?@action=redirect&bpo=23846

   (9) https://bugs.python.org/issue?@action=redirect&bpo=34323

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35674

   (11) https://bugs.python.org/issue?@action=redirect&bpo=35733

   (12) https://bugs.python.org/issue?@action=redirect&bpo=35726

   (13) https://bugs.python.org/issue?@action=redirect&bpo=35719

   (14) https://bugs.python.org/issue?@action=redirect&bpo=35717

   (15) https://bugs.python.org/issue?@action=redirect&bpo=35699

   (16) https://bugs.python.org/issue?@action=redirect&bpo=32710

   (17) https://bugs.python.org/issue?@action=redirect&bpo=35702

   (18) https://bugs.python.org/issue?@action=redirect&bpo=32710

   (19) https://bugs.python.org/issue?@action=redirect&bpo=35682

   (20) https://bugs.python.org/issue?@action=redirect&bpo=35283

   (21) https://bugs.python.org/issue?@action=redirect&bpo=35664

   (22) https://bugs.python.org/issue?@action=redirect&bpo=35643

   (23) https://bugs.python.org/issue?@action=redirect&bpo=35619

   (24) https://bugs.python.org/issue?@action=redirect&bpo=28503

   (25) https://bugs.python.org/issue?@action=redirect&bpo=35614

   (26) https://bugs.python.org/issue?@action=redirect&bpo=35568

   (27) https://bugs.python.org/issue?@action=redirect&bpo=35588

   (28) https://bugs.python.org/issue?@action=redirect&bpo=35585

   (29) https://bugs.python.org/issue?@action=redirect&bpo=30561

   (30) https://bugs.python.org/issue?@action=redirect&bpo=35537

   (31) https://bugs.python.org/issue?@action=redirect&bpo=35526

   (32) https://bugs.python.org/issue?@action=redirect&bpo=35523

   (33) https://bugs.python.org/issue?@action=redirect&bpo=31784

   (34) https://bugs.python.org/issue?@action=redirect&bpo=35513

   (35) https://bugs.python.org/issue?@action=redirect&bpo=35502

   (36) https://bugs.python.org/issue?@action=redirect&bpo=35348

   (37) https://bugs.python.org/issue?@action=redirect&bpo=35491

   (38) https://bugs.python.org/issue?@action=redirect&bpo=35477

   (39) https://bugs.python.org/issue?@action=redirect&bpo=31446

   (40) https://bugs.python.org/issue?@action=redirect&bpo=35471

   (41) https://bugs.python.org/issue?@action=redirect&bpo=23057

   (42) https://bugs.python.org/issue?@action=redirect&bpo=35052

   (43) https://bugs.python.org/issue?@action=redirect&bpo=20239

   (44) https://bugs.python.org/issue?@action=redirect&bpo=17185

   (45) https://bugs.python.org/issue?@action=redirect&bpo=35445

   (46) https://bugs.python.org/issue?@action=redirect&bpo=35415

   (47) https://bugs.python.org/issue?@action=redirect&bpo=35424

   (48) https://bugs.python.org/issue?@action=redirect&bpo=35330

   (49) https://bugs.python.org/issue?@action=redirect&bpo=35346

   (50) https://bugs.python.org/issue?@action=redirect&bpo=10496

   (51) https://bugs.python.org/issue?@action=redirect&bpo=10496

   (52) https://bugs.python.org/issue?@action=redirect&bpo=35389

   (53) https://bugs.python.org/issue?@action=redirect&bpo=35394

   (54) https://bugs.python.org/issue?@action=redirect&bpo=35310

   (55) https://bugs.python.org/issue?@action=redirect&bpo=35380

   (56) https://bugs.python.org/issue?@action=redirect&bpo=35341

   (57) https://bugs.python.org/issue?@action=redirect&bpo=35371

   (58) https://bugs.python.org/issue?@action=redirect&bpo=35346

   (59) https://bugs.python.org/issue?@action=redirect&bpo=35066

   (60) https://bugs.python.org/issue?@action=redirect&bpo=35345

   (61) https://bugs.python.org/issue?@action=redirect&bpo=35344

   (62) https://bugs.python.org/issue?@action=redirect&bpo=35312

   (63) https://bugs.python.org/issue?@action=redirect&bpo=35308

   (64) https://bugs.python.org/issue?@action=redirect&bpo=24746

   (65) https://bugs.python.org/issue?@action=redirect&bpo=28604

   (66) https://bugs.python.org/issue?@action=redirect&bpo=35277

   (67) https://bugs.python.org/issue?@action=redirect&bpo=24209

   (68) https://bugs.python.org/issue?@action=redirect&bpo=35226

   (69) https://bugs.python.org/issue?@action=redirect&bpo=29564

   (70) https://bugs.python.org/issue?@action=redirect&bpo=35189

   (71) https://bugs.python.org/issue?@action=redirect&bpo=30064

   (72) https://bugs.python.org/issue?@action=redirect&bpo=35186

   (73) https://bugs.python.org/issue?@action=redirect&bpo=35152

   (74) https://bugs.python.org/issue?@action=redirect&bpo=35062

   (75) https://bugs.python.org/issue?@action=redirect&bpo=35065

   (76) https://bugs.python.org/issue?@action=redirect&bpo=34160

   (77) https://bugs.python.org/issue?@action=redirect&bpo=35079

   (78) https://bugs.python.org/issue?@action=redirect&bpo=33710

   (79) https://bugs.python.org/issue?@action=redirect&bpo=35017

   (80) https://bugs.python.org/issue?@action=redirect&bpo=35024

   (81) https://bugs.python.org/issue?@action=redirect&bpo=35047

   (82) https://bugs.python.org/issue?@action=redirect&bpo=31047

   (83) https://bugs.python.org/issue?@action=redirect&bpo=35053

   (84) https://bugs.python.org/issue?@action=redirect&bpo=31553

   (85) https://bugs.python.org/issue?@action=redirect&bpo=34794

   (86) https://bugs.python.org/issue?@action=redirect&bpo=34909

   (87) https://bugs.python.org/issue?@action=redirect&bpo=35022

   (88) https://bugs.python.org/issue?@action=redirect&bpo=35008

   (89) https://bugs.python.org/issue?@action=redirect&bpo=23420

   (90) https://bugs.python.org/issue?@action=redirect&bpo=33947

   (91) https://bugs.python.org/issue?@action=redirect&bpo=34890

   (92) https://bugs.python.org/issue?@action=redirect&bpo=34521

   (93) https://datatracker.ietf.org/doc/html/rfc3542.html

   (94) https://bugs.python.org/issue?@action=redirect&bpo=31522

   (95) https://bugs.python.org/issue?@action=redirect&bpo=34970

   (96) https://bugs.python.org/issue?@action=redirect&bpo=34969

   (97) https://bugs.python.org/issue?@action=redirect&bpo=16965

   (98) https://bugs.python.org/issue?@action=redirect&bpo=34966

   (99) https://bugs.python.org/issue?@action=redirect&bpo=34926

   (100) https://bugs.python.org/issue?@action=redirect&bpo=23831

   (101) https://bugs.python.org/issue?@action=redirect&bpo=34941

   (102) https://bugs.python.org/issue?@action=redirect&bpo=32680

   (103) https://bugs.python.org/issue?@action=redirect&bpo=34769

   (104) https://bugs.python.org/issue?@action=redirect&bpo=34936

   (105) https://bugs.python.org/issue?@action=redirect&bpo=34829

   (106) https://bugs.python.org/issue?@action=redirect&bpo=34911

   (107) https://bugs.python.org/issue?@action=redirect&bpo=34922

   (108) https://bugs.python.org/issue?@action=redirect&bpo=34925

   (109) https://bugs.python.org/issue?@action=redirect&bpo=34900

   (110) https://bugs.python.org/issue?@action=redirect&bpo=34844

   (111) https://bugs.python.org/issue?@action=redirect&bpo=34897

   (112) https://bugs.python.org/issue?@action=redirect&bpo=34871

   (113) https://bugs.python.org/issue?@action=redirect&bpo=34898

   (114) https://bugs.python.org/issue?@action=redirect&bpo=28441

   (115) https://bugs.python.org/issue?@action=redirect&bpo=34866

   (116) https://bugs.python.org/issue?@action=redirect&bpo=34711

   (117) https://bugs.python.org/issue?@action=redirect&bpo=34872

   (118) https://bugs.python.org/issue?@action=redirect&bpo=34849

   (119) https://bugs.python.org/issue?@action=redirect&bpo=34022

   (120) https://bugs.python.org/issue?@action=redirect&bpo=34819

   (121) https://bugs.python.org/issue?@action=redirect&bpo=34758

   (122) https://bugs.python.org/issue?@action=redirect&bpo=34789

   (123) https://bugs.python.org/issue?@action=redirect&bpo=34334

   (124) https://bugs.python.org/issue?@action=redirect&bpo=34687

   (125) https://bugs.python.org/issue?@action=redirect&bpo=5950

   (126) https://bugs.python.org/issue?@action=redirect&bpo=32892

   (127) https://bugs.python.org/issue?@action=redirect&bpo=34728

   (128) https://bugs.python.org/issue?@action=redirect&bpo=34738

   (129) https://bugs.python.org/issue?@action=redirect&bpo=34659

   (130) https://bugs.python.org/issue?@action=redirect&bpo=29577

   (131) https://bugs.python.org/issue?@action=redirect&bpo=34670

   (132) https://bugs.python.org/issue?@action=redirect&bpo=32718

   (133) https://bugs.python.org/issue?@action=redirect&bpo=31177

   (134) https://bugs.python.org/issue?@action=redirect&bpo=34672

   (135) https://bugs.python.org/issue?@action=redirect&bpo=34666

   (136) https://bugs.python.org/issue?@action=redirect&bpo=6721

   (137) https://bugs.python.org/issue?@action=redirect&bpo=34658

   (138) https://bugs.python.org/issue?@action=redirect&bpo=34652

   (139) https://bugs.python.org/issue?@action=redirect&bpo=34638

   (140) https://bugs.python.org/issue?@action=redirect&bpo=34536

   (141) https://bugs.python.org/issue?@action=redirect&bpo=34636

   (142) https://bugs.python.org/issue?@action=redirect&bpo=24412

   (143) https://bugs.python.org/issue?@action=redirect&bpo=34630

   (144) https://bugs.python.org/issue?@action=redirect&bpo=32490

   (145) https://bugs.python.org/issue?@action=redirect&bpo=34363

   (146) https://bugs.python.org/issue?@action=redirect&bpo=34625

   (147) https://bugs.python.org/issue?@action=redirect&bpo=32270

   (148) https://bugs.python.org/issue?@action=redirect&bpo=34622

   (149) https://bugs.python.org/issue?@action=redirect&bpo=34610

   (150) https://bugs.python.org/issue?@action=redirect&bpo=34421

   (151) https://bugs.python.org/issue?@action=redirect&bpo=34604

   (152) https://bugs.python.org/issue?@action=redirect&bpo=30977

   (153) https://bugs.python.org/issue?@action=redirect&bpo=34574

   (154) https://bugs.python.org/issue?@action=redirect&bpo=8110

   (155) https://bugs.python.org/issue?@action=redirect&bpo=34530

   (156) https://bugs.python.org/issue?@action=redirect&bpo=34563

   (157) https://bugs.python.org/issue?@action=redirect&bpo=34558

   (158) https://bugs.python.org/issue?@action=redirect&bpo=34282

   (159) https://bugs.python.org/issue?@action=redirect&bpo=22872

   (160) https://bugs.python.org/issue?@action=redirect&bpo=34515

   (161) https://peps.python.org/pep-3131/

   (162) https://bugs.python.org/issue?@action=redirect&bpo=13312

   (163) https://bugs.python.org/issue?@action=redirect&bpo=34472

   (164) https://bugs.python.org/issue?@action=redirect&bpo=34454

   (165) https://bugs.python.org/issue?@action=redirect&bpo=6700

   (166) https://bugs.python.org/issue?@action=redirect&bpo=34171

   (167) https://bugs.python.org/issue?@action=redirect&bpo=34441

   (168) https://bugs.python.org/issue?@action=redirect&bpo=34427

   (169) https://bugs.python.org/issue?@action=redirect&bpo=34412

   (170) https://bugs.python.org/issue?@action=redirect&bpo=20849

   (171) https://bugs.python.org/issue?@action=redirect&bpo=31715

   (172) https://bugs.python.org/issue?@action=redirect&bpo=34384

   (173) https://bugs.python.org/issue?@action=redirect&bpo=22602

   (174) https://bugs.python.org/issue?@action=redirect&bpo=2122

   (175) https://bugs.python.org/issue?@action=redirect&bpo=34341

   (176) https://bugs.python.org/issue?@action=redirect&bpo=34333

   (177) https://bugs.python.org/issue?@action=redirect&bpo=18540

   (178) https://bugs.python.org/issue?@action=redirect&bpo=26502

   (179) https://bugs.python.org/issue?@action=redirect&bpo=34318

   (180) https://bugs.python.org/issue?@action=redirect&bpo=9372

   (181) https://bugs.python.org/issue?@action=redirect&bpo=33613

   (182) https://bugs.python.org/issue?@action=redirect&bpo=34248

   (183) https://bugs.python.org/issue?@action=redirect&bpo=33089

   (184) https://bugs.python.org/issue?@action=redirect&bpo=34246

   (185) https://bugs.python.org/issue?@action=redirect&bpo=31047

   (186) https://bugs.python.org/issue?@action=redirect&bpo=32321

   (187) https://bugs.python.org/issue?@action=redirect&bpo=34270

   (188) https://bugs.python.org/issue?@action=redirect&bpo=34263

   (189) https://bugs.python.org/issue?@action=redirect&bpo=34035

   (190) https://bugs.python.org/issue?@action=redirect&bpo=32215

   (191) https://bugs.python.org/issue?@action=redirect&bpo=34075

   (192) https://bugs.python.org/issue?@action=redirect&bpo=34251

   (193) https://bugs.python.org/issue?@action=redirect&bpo=19891

   (194) https://bugs.python.org/issue?@action=redirect&bpo=33089

   (195) https://bugs.python.org/issue?@action=redirect&bpo=34228

   (196) https://bugs.python.org/issue?@action=redirect&bpo=13041

   (197) https://bugs.python.org/issue?@action=redirect&bpo=34213

   (198) https://bugs.python.org/issue?@action=redirect&bpo=34052

   (199) https://bugs.python.org/issue?@action=redirect&bpo=34197

   (200) https://bugs.python.org/issue?@action=redirect&bpo=32788

   (201) https://bugs.python.org/issue?@action=redirect&bpo=21446

   (202) https://bugs.python.org/issue?@action=redirect&bpo=940286

   (203) https://bugs.python.org/issue?@action=redirect&bpo=34164

   (204) https://bugs.python.org/issue?@action=redirect&bpo=33729

   (205) https://bugs.python.org/issue?@action=redirect&bpo=34097

   (206) https://bugs.python.org/issue?@action=redirect&bpo=34108

   (207) https://bugs.python.org/issue?@action=redirect&bpo=34070

   (208) https://bugs.python.org/issue?@action=redirect&bpo=27494

   (209) https://bugs.python.org/issue?@action=redirect&bpo=27494

   (210) https://bugs.python.org/issue?@action=redirect&bpo=33967

   (211) https://bugs.python.org/issue?@action=redirect&bpo=34041

   (212) https://bugs.python.org/issue?@action=redirect&bpo=34056

   (213) https://peps.python.org/pep-0552/

   (214) https://bugs.python.org/issue?@action=redirect&bpo=34054

   (215) https://bugs.python.org/issue?@action=redirect&bpo=34043

   (216) https://bugs.python.org/issue?@action=redirect&bpo=34044

   (217) https://bugs.python.org/issue?@action=redirect&bpo=34010

   (218) https://bugs.python.org/issue?@action=redirect&bpo=34019

   (219) https://bugs.python.org/issue?@action=redirect&bpo=34003

   (220) https://bugs.python.org/issue?@action=redirect&bpo=33978

   (221) https://bugs.python.org/issue?@action=redirect&bpo=14117

   (222) https://bugs.python.org/issue?@action=redirect&bpo=33974

   (223) https://bugs.python.org/issue?@action=redirect&bpo=27500

   (224) https://bugs.python.org/issue?@action=redirect&bpo=24567

   (225) https://bugs.python.org/issue?@action=redirect&bpo=33871

   (226) https://bugs.python.org/issue?@action=redirect&bpo=25007

   (227) https://bugs.python.org/issue?@action=redirect&bpo=33929

   (228) https://bugs.python.org/issue?@action=redirect&bpo=33899

   (229) https://bugs.python.org/issue?@action=redirect&bpo=33897

   (230) https://bugs.python.org/issue?@action=redirect&bpo=33695

   (231) https://bugs.python.org/issue?@action=redirect&bpo=33695

   (232) https://bugs.python.org/issue?@action=redirect&bpo=33916

   (233) https://bugs.python.org/issue?@action=redirect&bpo=32568

   (234) https://bugs.python.org/issue?@action=redirect&bpo=33833

   (235) https://bugs.python.org/issue?@action=redirect&bpo=33663

   (236) https://bugs.python.org/issue?@action=redirect&bpo=33721

   (237) https://bugs.python.org/issue?@action=redirect&bpo=26544

   (238) https://bugs.python.org/issue?@action=redirect&bpo=33843

   (239) https://bugs.python.org/issue?@action=redirect&bpo=33842

   (240) https://bugs.python.org/issue?@action=redirect&bpo=30167

   (241) https://bugs.python.org/issue?@action=redirect&bpo=33805

   (242) https://bugs.python.org/issue?@action=redirect&bpo=33687

   (243) https://bugs.python.org/issue?@action=redirect&bpo=33812

   (244) https://bugs.python.org/issue?@action=redirect&bpo=32108

   (245) https://bugs.python.org/issue?@action=redirect&bpo=27397

   (246) https://bugs.python.org/issue?@action=redirect&bpo=33578

   (247) https://bugs.python.org/issue?@action=redirect&bpo=30805

   (248) https://bugs.python.org/issue?@action=redirect&bpo=33476

   (249) https://bugs.python.org/issue?@action=redirect&bpo=33694

   (250) https://bugs.python.org/issue?@action=redirect&bpo=32493

   (251) https://bugs.python.org/issue?@action=redirect&bpo=33792

   (252) https://bugs.python.org/issue?@action=redirect&bpo=33274

   (253) https://bugs.python.org/issue?@action=redirect&bpo=33778

   (254) https://bugs.python.org/issue?@action=redirect&bpo=33165

   (255) https://bugs.python.org/issue?@action=redirect&bpo=33770

   (256) https://bugs.python.org/issue?@action=redirect&bpo=33769

   (257) https://bugs.python.org/issue?@action=redirect&bpo=33767

   (258) https://bugs.python.org/issue?@action=redirect&bpo=33734

   (259) https://bugs.python.org/issue?@action=redirect&bpo=31014

   (260) https://bugs.python.org/issue?@action=redirect&bpo=2504

   (261) https://bugs.python.org/issue?@action=redirect&bpo=33197

   (262) https://bugs.python.org/issue?@action=redirect&bpo=32751

   (263) https://bugs.python.org/issue?@action=redirect&bpo=32684

   (264) https://bugs.python.org/issue?@action=redirect&bpo=33654

   (265) https://bugs.python.org/issue?@action=redirect&bpo=33674

   (266) https://bugs.python.org/issue?@action=redirect&bpo=33671

   (267) https://bugs.python.org/issue?@action=redirect&bpo=25427

   (268) https://bugs.python.org/issue?@action=redirect&bpo=33674

   (269) https://bugs.python.org/issue?@action=redirect&bpo=31647

   (270) https://bugs.python.org/issue?@action=redirect&bpo=32610

   (271) https://bugs.python.org/issue?@action=redirect&bpo=32410

   (272) https://bugs.python.org/issue?@action=redirect&bpo=33469

   (273) https://bugs.python.org/issue?@action=redirect&bpo=33672

   (274) https://bugs.python.org/issue?@action=redirect&bpo=33654

   (275) https://bugs.python.org/issue?@action=redirect&bpo=33652

   (276) https://bugs.python.org/issue?@action=redirect&bpo=32493

   (277) https://bugs.python.org/issue?@action=redirect&bpo=33238

   (278) https://bugs.python.org/issue?@action=redirect&bpo=33618

   (279) https://bugs.python.org/issue?@action=redirect&bpo=33625

   (280) https://bugs.python.org/issue?@action=redirect&bpo=33623

   (281) https://bugs.python.org/issue?@action=redirect&bpo=11874

   (282) https://bugs.python.org/issue?@action=redirect&bpo=30877

   (283) https://bugs.python.org/issue?@action=redirect&bpo=33604

   (284) https://bugs.python.org/issue?@action=redirect&bpo=33582

   (285) https://bugs.python.org/issue?@action=redirect&bpo=21145

   (286) https://bugs.python.org/issue?@action=redirect&bpo=33570

   (287) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (288) https://bugs.python.org/issue?@action=redirect&bpo=12486

   (289) https://bugs.python.org/issue?@action=redirect&bpo=33540

   (290) https://bugs.python.org/issue?@action=redirect&bpo=33548

   (291) https://bugs.python.org/issue?@action=redirect&bpo=33109

   (292) https://bugs.python.org/issue?@action=redirect&bpo=26510

   (293) https://bugs.python.org/issue?@action=redirect&bpo=33541

   (294) https://bugs.python.org/issue?@action=redirect&bpo=33536

   (295) https://bugs.python.org/issue?@action=redirect&bpo=33542

   (296) https://bugs.python.org/issue?@action=redirect&bpo=26819

   (297) https://bugs.python.org/issue?@action=redirect&bpo=33516

   (298) https://bugs.python.org/issue?@action=redirect&bpo=28612

   (299) https://bugs.python.org/issue?@action=redirect&bpo=28167

   (300) https://bugs.python.org/issue?@action=redirect&bpo=33504

   (301) https://bugs.python.org/issue?@action=redirect&bpo=33505

   (302) https://bugs.python.org/issue?@action=redirect&bpo=33497

   (303) https://bugs.python.org/issue?@action=redirect&bpo=29235

   (304) https://bugs.python.org/issue?@action=redirect&bpo=33495

   (305) https://bugs.python.org/issue?@action=redirect&bpo=26103

   (306) https://bugs.python.org/issue?@action=redirect&bpo=29209

   (307) https://bugs.python.org/issue?@action=redirect&bpo=33453

   (308) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (309) https://bugs.python.org/issue?@action=redirect&bpo=33365

   (310) https://bugs.python.org/issue?@action=redirect&bpo=20087

   (311) https://bugs.python.org/issue?@action=redirect&bpo=33422

   (312) https://bugs.python.org/issue?@action=redirect&bpo=28167

   (313) https://bugs.python.org/issue?@action=redirect&bpo=33281

   (314) https://bugs.python.org/issue?@action=redirect&bpo=33311

   (315) https://bugs.python.org/issue?@action=redirect&bpo=27300

   (316) https://bugs.python.org/issue?@action=redirect&bpo=32933

   (317) https://bugs.python.org/issue?@action=redirect&bpo=33217

   (318) https://bugs.python.org/issue?@action=redirect&bpo=33197

   (319) https://bugs.python.org/issue?@action=redirect&bpo=33383

   (320) https://bugs.python.org/issue?@action=redirect&bpo=33375

   (321) https://bugs.python.org/issue?@action=redirect&bpo=33336

   (322) https://bugs.python.org/issue?@action=redirect&bpo=32455

   (323) https://bugs.python.org/issue?@action=redirect&bpo=27485

   (324) https://bugs.python.org/issue?@action=redirect&bpo=33332

   (325) https://bugs.python.org/issue?@action=redirect&bpo=33251

   (326) https://bugs.python.org/issue?@action=redirect&bpo=33329

   (327) https://bugs.python.org/issue?@action=redirect&bpo=33334

   (328) https://bugs.python.org/issue?@action=redirect&bpo=991266

   (329) https://bugs.python.org/issue?@action=redirect&bpo=33131

   (330) https://bugs.python.org/issue?@action=redirect&bpo=33308

   (331) https://bugs.python.org/issue?@action=redirect&bpo=23403

   (332) https://bugs.python.org/issue?@action=redirect&bpo=33266

   (333) https://bugs.python.org/issue?@action=redirect&bpo=11594

   (334) https://bugs.python.org/issue?@action=redirect&bpo=33254

   (335) https://bugs.python.org/issue?@action=redirect&bpo=33265

   (336) https://bugs.python.org/issue?@action=redirect&bpo=33263

   (337) https://bugs.python.org/issue?@action=redirect&bpo=33256

   (338) https://bugs.python.org/issue?@action=redirect&bpo=33144

   (339) https://bugs.python.org/issue?@action=redirect&bpo=33185

   (340) https://bugs.python.org/issue?@action=redirect&bpo=33053

   (341) https://bugs.python.org/issue?@action=redirect&bpo=29613

   (342) https://bugs.python.org/issue?@action=redirect&bpo=33169

   (343) https://bugs.python.org/issue?@action=redirect&bpo=33203

   (344) https://bugs.python.org/issue?@action=redirect&bpo=33224

   (345) https://peps.python.org/pep-0479/

   (346) https://bugs.python.org/issue?@action=redirect&bpo=33209

   (347) https://bugs.python.org/issue?@action=redirect&bpo=32861

   (348) https://bugs.python.org/issue?@action=redirect&bpo=23403

   (349) https://peps.python.org/pep-3154/

   (350) https://bugs.python.org/issue?@action=redirect&bpo=20104

   (351) https://bugs.python.org/issue?@action=redirect&bpo=33106

   (352) https://bugs.python.org/issue?@action=redirect&bpo=33175

   (353) https://bugs.python.org/issue?@action=redirect&bpo=32380

   (354) https://bugs.python.org/issue?@action=redirect&bpo=33141

   (355) https://bugs.python.org/issue?@action=redirect&bpo=33096

   (356) https://bugs.python.org/issue?@action=redirect&bpo=32873

   (357) https://bugs.python.org/issue?@action=redirect&bpo=33134

   (358) https://bugs.python.org/issue?@action=redirect&bpo=33127

   (359) https://bugs.python.org/issue?@action=redirect&bpo=32505

   (360) https://bugs.python.org/issue?@action=redirect&bpo=33078

   (361) https://bugs.python.org/issue?@action=redirect&bpo=33116

   (362) https://bugs.python.org/issue?@action=redirect&bpo=32896

   (363) https://bugs.python.org/issue?@action=redirect&bpo=33100

   (364) https://bugs.python.org/issue?@action=redirect&bpo=32953

   (365) https://bugs.python.org/issue?@action=redirect&bpo=33097

   (366) https://bugs.python.org/issue?@action=redirect&bpo=32968

   (367) https://bugs.python.org/issue?@action=redirect&bpo=33061

   (368) https://bugs.python.org/issue?@action=redirect&bpo=33078

   (369) https://bugs.python.org/issue?@action=redirect&bpo=33064

   (370) https://bugs.python.org/issue?@action=redirect&bpo=33056

   (371) https://bugs.python.org/issue?@action=redirect&bpo=33021

   (372) https://bugs.python.org/issue?@action=redirect&bpo=31804

   (373) https://bugs.python.org/issue?@action=redirect&bpo=33034

   (374) https://bugs.python.org/issue?@action=redirect&bpo=30249

   (375) https://bugs.python.org/issue?@action=redirect&bpo=33037

   (376) https://bugs.python.org/issue?@action=redirect&bpo=27683

   (377) https://bugs.python.org/issue?@action=redirect&bpo=22674

   (378) https://bugs.python.org/issue?@action=redirect&bpo=32999

   (379) https://bugs.python.org/issue?@action=redirect&bpo=33009

   (380) https://bugs.python.org/issue?@action=redirect&bpo=32969

   (381) https://bugs.python.org/issue?@action=redirect&bpo=32056

   (382) https://bugs.python.org/issue?@action=redirect&bpo=32970

   (383) https://bugs.python.org/issue?@action=redirect&bpo=32844

   (384) https://bugs.python.org/issue?@action=redirect&bpo=32960

   (385) https://bugs.python.org/issue?@action=redirect&bpo=32713

   (386) https://bugs.python.org/issue?@action=redirect&bpo=32257

   (387) https://bugs.python.org/issue?@action=redirect&bpo=32951

   (388) https://bugs.python.org/issue?@action=redirect&bpo=32929

   (389) https://bugs.python.org/issue?@action=redirect&bpo=32947

   (390) https://bugs.python.org/issue?@action=redirect&bpo=32146

   (391) https://bugs.python.org/issue?@action=redirect&bpo=30622

   (392) https://bugs.python.org/issue?@action=redirect&bpo=32922

   (393) https://bugs.python.org/issue?@action=redirect&bpo=32759

   (394) https://bugs.python.org/issue?@action=redirect&bpo=32859

   (395) https://bugs.python.org/issue?@action=redirect&bpo=32556

   (396) https://bugs.python.org/issue?@action=redirect&bpo=21060

   (397) https://bugs.python.org/issue?@action=redirect&bpo=32857

   (398) https://bugs.python.org/issue?@action=redirect&bpo=32852

   (399) https://bugs.python.org/issue?@action=redirect&bpo=31333

   (400) https://bugs.python.org/issue?@action=redirect&bpo=32841

   (401) https://bugs.python.org/issue?@action=redirect&bpo=32819

   (402) https://bugs.python.org/issue?@action=redirect&bpo=19675

   (403) https://bugs.python.org/issue?@action=redirect&bpo=32394

   (404) https://bugs.python.org/issue?@action=redirect&bpo=31787

   (405) https://bugs.python.org/issue?@action=redirect&bpo=30157

   (406) https://bugs.python.org/issue?@action=redirect&bpo=30688

   (407) https://bugs.python.org/issue?@action=redirect&bpo=32792

   (408) https://bugs.python.org/issue?@action=redirect&bpo=32775

   (409) https://bugs.python.org/issue?@action=redirect&bpo=32622

   (410) https://bugs.python.org/issue?@action=redirect&bpo=32777

   (411) https://bugs.python.org/issue?@action=redirect&bpo=32647

   (412) https://bugs.python.org/issue?@action=redirect&bpo=32749

   (413) https://bugs.python.org/issue?@action=redirect&bpo=32741

   (414) https://bugs.python.org/issue?@action=redirect&bpo=32691

   (415) https://bugs.python.org/issue?@action=redirect&bpo=32734

   (416) https://bugs.python.org/issue?@action=redirect&bpo=32727

   (417) https://bugs.python.org/issue?@action=redirect&bpo=31453

   (418) https://bugs.python.org/issue?@action=redirect&bpo=24334

   (419) https://bugs.python.org/issue?@action=redirect&bpo=31848

   (420) https://bugs.python.org/issue?@action=redirect&bpo=32585

   (421) https://bugs.python.org/issue?@action=redirect&bpo=32512

   (422) https://bugs.python.org/issue?@action=redirect&bpo=8525

   (423) https://bugs.python.org/issue?@action=redirect&bpo=31639

   (424) https://bugs.python.org/issue?@action=redirect&bpo=29877

   (425) https://bugs.python.org/issue?@action=redirect&bpo=32221

   (426) https://bugs.python.org/issue?@action=redirect&bpo=32147

   (427) https://bugs.python.org/issue?@action=redirect&bpo=30693

   (428) https://bugs.python.org/issue?@action=redirect&bpo=30693

   (429) https://bugs.python.org/issue?@action=redirect&bpo=31680

   (430) https://bugs.python.org/issue?@action=redirect&bpo=31908

   (431) https://bugs.python.org/issue?@action=redirect&bpo=31608

   (432) https://bugs.python.org/issue?@action=redirect&bpo=31425

   (433) https://bugs.python.org/issue?@action=redirect&bpo=22005

   (434) https://bugs.python.org/issue?@action=redirect&bpo=27645

   (435) https://bugs.python.org/issue?@action=redirect&bpo=16865

   (436) https://bugs.python.org/issue?@action=redirect&bpo=31508

   (437) https://bugs.python.org/issue?@action=redirect&bpo=29456


File: python.info,  Node: ドキュメント<56>,  Next: テスト<54>,  Prev: ライブラリ<162>,  Up: Python 3 8 0 alpha 1

1.24.62.4 ドキュメント
......................

   - bpo-21257(1): Document *note http.client.parse_headers(): 1e28.

   - bpo-34764(2): Improve example of iter() with 2nd sentinel argument.

   - bpo-35564(3): Explicitly set master_doc variable in conf.py for
     compliance with Sphinx 2.0

   - bpo-35511(4): Specified that profile.Profile class doesn't not
     support enable or disable methods.  Also, elaborated that Profile
     object as a context manager is only supported in cProfile module.

   - bpo-10536(5): Enhance the gettext docs.  Patch by Éric Araujo

   - bpo-35089(6): Remove mention of ‘typing.io’ and ‘typing.re’.  Their
     types should be imported from ‘typing’ directly.

   - bpo-35038(7): Fix the documentation about an unexisting
     ‘f_restricted’ attribute in the frame object.  Patch by Stéphane
     Wirtel

   - bpo-35042(8): Replace PEP XYZ by the pep role and allow to use the
     direct links to the PEPs.

   - bpo-35044(9): Fix the documentation with the role ‘exc’ for the
     appropriated exception.  Patch by Stéphane Wirtel

   - bpo-35035(10): Rename documentation for *note email.utils: 54. to
     ‘email.utils.rst’.

   - bpo-34967(11): Use app.add_object_type() instead of the deprecated
     Sphinx function app.description_unit()

   - bpo-34913(12): Add documentation about the new command line
     interface of the gzip module.

   - bpo-32174(13): chm document displays non-ASCII characters properly
     on some MBCS Windows systems.

   - bpo-11233(14): Create availability directive for documentation.
     Original patch by Georg Brandl.

   - bpo-34790(15): Document how passing coroutines to asyncio.wait()
     can be confusing.

   - bpo-34552(16): Make clear that ‘==’ operator sometimes is
     equivalent to ‘is’.  The ‘<’, ‘<=’, ‘>’ and ‘>=’ operators are only
     defined where they make sense.

   - bpo-28617(17): Fixed info in the stdtypes docs concerning the types
     that support membership tests.

   - bpo-20177(18): Migrate datetime.date.fromtimestamp to Argument
     Clinic.  Patch by Tim Hoffmann.

   - bpo-34065(19): Fix wrongly written basicConfig documentation markup
     syntax

   - bpo-33460(20): replaced ellipsis with correct error codes in
     tutorial chapter 3.

   - bpo-33847(21): Add '@' operator entry to index.

   - bpo-33409(22): Clarified the relationship between PEP 538(23)'s
     PYTHONCOERCECLOCALE and PEP 540's PYTHONUTF8 mode.

   - bpo-33197(24): Add versionadded tag to the documentation of
     ParameterKind.description

   - bpo-17045(25): Improve the C-API doc for PyTypeObject.  This
     includes adding several quick-reference tables and a lot of missing
     slot/typedef entries.  The existing entries were also cleaned up
     with a slightly more consistent format.

   - bpo-33736(26): Improve the documentation of *note
     asyncio.open_connection(): d0e, *note asyncio.start_server(): d0f.
     and their UNIX socket counterparts.

   - bpo-23859(27): Document that ‘asyncio.wait()’ does not cancel its
     futures on timeout.

   - bpo-32436(28): Document PEP 567(29) changes to asyncio.

   - bpo-33604(30): Update HMAC md5 default to a DeprecationWarning,
     bump removal to 3.8.

   - bpo-33594(31): Document ‘getargspec’, ‘from_function’ and
     ‘from_builtin’ as deprecated in their respective docstring, and
     include version since deprecation in DeprecationWarning message.

   - bpo-33503(32): Fix broken pypi link

   - bpo-33421(33): Add missing documentation for
     ‘typing.AsyncContextManager’.

   - bpo-33487(34): BZ2file now emit a DeprecationWarning when
     buffering=None is passed, the deprecation message and documentation
     also now explicitly state it is deprecated since 3.0.

   - bpo-33378(35): Add Korean language switcher for
     ‘https://docs.python.org/3/’

   - bpo-33276(36): Clarify that the ‘__path__’ attribute on modules
     cannot be just any value.

   - bpo-33201(37): Modernize documentation for writing C extension
     types.

   - bpo-33195(38): Deprecate ‘Py_UNICODE’ usage in ‘c-api/arg’
     document.  ‘Py_UNICODE’ related APIs are deprecated since Python
     3.3, but it is missed in the document.

   - bpo-33126(39): Document PyBuffer_ToContiguous().

   - bpo-27212(40): Modify documentation for the ‘islice()’ recipe to
     consume initial values up to the start index.

   - bpo-28247(41): Update *note zipapp: 136. documentation to describe
     how to make standalone applications.

   - bpo-18802(42): Documentation changes for ipaddress.  Patch by Jon
     Foster and Berker Peksag.

   - bpo-27428(43): Update documentation to clarify that
     ‘WindowsRegistryFinder’ implements ‘MetaPathFinder’.  (Patch by
     Himanshu Lakhara)

   - bpo-28124(44): The ssl module function ssl.wrap_socket() has been
     de-emphasized and deprecated in favor of the more secure and
     efficient SSLContext.wrap_socket() method.

   - bpo-17232(45): Clarify docs for -O and -OO. Patch by Terry Reedy.

   - bpo-32436(46): Add documentation for the contextvars module (PEP
     567).

   - bpo-32800(47): Update link to w3c doc for xml default namespaces.

   - bpo-11015(48): Update *note test.support: ea. documentation.

   - bpo-32613(49): Update the faq/windows.html to use the py command
     from PEP 397 instead of python.

   - bpo-8722(50): Document ‘__getattr__()’ behavior when property
     ‘get()’ method raises *note AttributeError: 5f0.

   - bpo-32614(51): Modify RE examples in documentation to use raw
     strings to prevent *note DeprecationWarning: 1a3. and add text to
     REGEX HOWTO to highlight the deprecation.

   - bpo-20709(52): Remove the paragraph where we explain that
     os.utime() does not support a directory as path under Windows.
     Patch by Jan-Philip Gehrcke

   - bpo-32722(53): Remove the bad example in the tutorial of the
     Generator Expression.  Patch by Stéphane Wirtel

   - bpo-31972(54): Improve docstrings for ‘pathlib.PurePath’
     subclasses.

   - bpo-30607(55): Use the externalized ‘python-docs-theme’ package
     when building the documentation.

   - bpo-8243(56): Add a note about curses.addch and curses.addstr
     exception behavior when writing outside a window, or pad.

   - bpo-32337(57): Update documentation related with ‘dict’ order.

   - bpo-25041(58): Document ‘AF_PACKET’ in the *note socket: d1.
     module.

   - bpo-31432(59): Clarify meaning of CERT_NONE, CERT_OPTIONAL, and
     CERT_REQUIRED flags for ssl.SSLContext.verify_mode.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21257

   (2) https://bugs.python.org/issue?@action=redirect&bpo=34764

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35564

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35511

   (5) https://bugs.python.org/issue?@action=redirect&bpo=10536

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35089

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35038

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35042

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35044

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35035

   (11) https://bugs.python.org/issue?@action=redirect&bpo=34967

   (12) https://bugs.python.org/issue?@action=redirect&bpo=34913

   (13) https://bugs.python.org/issue?@action=redirect&bpo=32174

   (14) https://bugs.python.org/issue?@action=redirect&bpo=11233

   (15) https://bugs.python.org/issue?@action=redirect&bpo=34790

   (16) https://bugs.python.org/issue?@action=redirect&bpo=34552

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28617

   (18) https://bugs.python.org/issue?@action=redirect&bpo=20177

   (19) https://bugs.python.org/issue?@action=redirect&bpo=34065

   (20) https://bugs.python.org/issue?@action=redirect&bpo=33460

   (21) https://bugs.python.org/issue?@action=redirect&bpo=33847

   (22) https://bugs.python.org/issue?@action=redirect&bpo=33409

   (23) https://peps.python.org/pep-0538/

   (24) https://bugs.python.org/issue?@action=redirect&bpo=33197

   (25) https://bugs.python.org/issue?@action=redirect&bpo=17045

   (26) https://bugs.python.org/issue?@action=redirect&bpo=33736

   (27) https://bugs.python.org/issue?@action=redirect&bpo=23859

   (28) https://bugs.python.org/issue?@action=redirect&bpo=32436

   (29) https://peps.python.org/pep-0567/

   (30) https://bugs.python.org/issue?@action=redirect&bpo=33604

   (31) https://bugs.python.org/issue?@action=redirect&bpo=33594

   (32) https://bugs.python.org/issue?@action=redirect&bpo=33503

   (33) https://bugs.python.org/issue?@action=redirect&bpo=33421

   (34) https://bugs.python.org/issue?@action=redirect&bpo=33487

   (35) https://bugs.python.org/issue?@action=redirect&bpo=33378

   (36) https://bugs.python.org/issue?@action=redirect&bpo=33276

   (37) https://bugs.python.org/issue?@action=redirect&bpo=33201

   (38) https://bugs.python.org/issue?@action=redirect&bpo=33195

   (39) https://bugs.python.org/issue?@action=redirect&bpo=33126

   (40) https://bugs.python.org/issue?@action=redirect&bpo=27212

   (41) https://bugs.python.org/issue?@action=redirect&bpo=28247

   (42) https://bugs.python.org/issue?@action=redirect&bpo=18802

   (43) https://bugs.python.org/issue?@action=redirect&bpo=27428

   (44) https://bugs.python.org/issue?@action=redirect&bpo=28124

   (45) https://bugs.python.org/issue?@action=redirect&bpo=17232

   (46) https://bugs.python.org/issue?@action=redirect&bpo=32436

   (47) https://bugs.python.org/issue?@action=redirect&bpo=32800

   (48) https://bugs.python.org/issue?@action=redirect&bpo=11015

   (49) https://bugs.python.org/issue?@action=redirect&bpo=32613

   (50) https://bugs.python.org/issue?@action=redirect&bpo=8722

   (51) https://bugs.python.org/issue?@action=redirect&bpo=32614

   (52) https://bugs.python.org/issue?@action=redirect&bpo=20709

   (53) https://bugs.python.org/issue?@action=redirect&bpo=32722

   (54) https://bugs.python.org/issue?@action=redirect&bpo=31972

   (55) https://bugs.python.org/issue?@action=redirect&bpo=30607

   (56) https://bugs.python.org/issue?@action=redirect&bpo=8243

   (57) https://bugs.python.org/issue?@action=redirect&bpo=32337

   (58) https://bugs.python.org/issue?@action=redirect&bpo=25041

   (59) https://bugs.python.org/issue?@action=redirect&bpo=31432


File: python.info,  Node: テスト<54>,  Next: ビルド<61>,  Prev: ドキュメント<56>,  Up: Python 3 8 0 alpha 1

1.24.62.5 テスト
................

   - bpo-35772(1): Fix sparse file tests of test_tarfile on ppc64 with
     the tmpfs filesystem.  Fix the function testing if the filesystem
     supports sparse files: create a file which contains data and
     "holes", instead of creating a file which contains no data.  tmpfs
     effective block size is a page size (tmpfs lives in the page
     cache).  RHEL uses 64 KiB pages on aarch64, ppc64, ppc64le, only
     s390x and x86_64 use 4 KiB pages, whereas the test punch holes of 4
     KiB.

   - bpo-35045(2): Make ssl tests less strict and also accept TLSv1 as
     system default.  The changes unbreaks test_min_max_version on
     Fedora 29.

   - bpo-32710(3): ‘test_asyncio/test_sendfile.py’ now resets the event
     loop policy using ‘tearDownModule()’ as done in other tests, to
     prevent a warning when running tests on Windows.

   - bpo-33717(4): test.pythoninfo now logs information of all clocks,
     not only time.time() and time.perf_counter().

   - bpo-35488(5): Add a test to pathlib's Path.match() to verify it
     does not support glob-style ** recursive pattern matching.

   - bpo-31731(6): Fix a race condition in ‘check_interrupted_write()’
     of test_io: create directly the thread with SIGALRM signal blocked,
     rather than blocking the signal later from the thread.  Previously,
     it was possible that the thread gets the signal before the signal
     is blocked.

   - bpo-35424(7): Fix test_multiprocessing_main_handling: use
     ‘multiprocessing.Pool’ with a context manager and then explicitly
     join the pool.

   - bpo-35519(8): Rename ‘test.bisect’ module to ‘test.bisect_cmd’ to
     avoid conflict with *note bisect: 12. module when running directly
     a test like ‘./python Lib/test/test_xmlrpc.py’.

   - bpo-35513(9): Replace *note time.time(): 55d. with *note
     time.monotonic(): 55c. in tests to measure time delta.

   - bpo-34279(10): ‘test.support.run_unittest()’ no longer raise
     ‘TestDidNotRun’ if the test result contains skipped tests.  The
     exception is now only raised if no test have been run and no test
     have been skipped.

   - bpo-35412(11): Add testcase to ‘test_future4’: check unicode
     literal.

   - bpo-26704(12): Added test demonstrating double-patching of an
     instance method.  Patch by Anthony Sottile.

   - bpo-33725(13): test_multiprocessing_fork may crash on recent
     versions of macOS. Until the issue is resolved, skip the test on
     macOS.

   - bpo-35352(14): Modify test_asyncio to use the certificate set from
     the test directory.

   - bpo-35317(15): Fix ‘mktime()’ overflow error in ‘test_email’: run
     ‘test_localtime_daylight_true_dst_true()’ and
     ‘test_localtime_daylight_false_dst_true()’ with a specific
     timezone.

   - bpo-21263(16): After several reports that test_gdb does not work
     properly on macOS and since gdb is not shipped by default anymore,
     test_gdb is now skipped on macOS when LLVM Clang has been used to
     compile Python.  Patch by Lysandros Nikolaou

   - bpo-34279(17): regrtest issue a warning when no tests have been
     executed in a particular test file.  Also, a new final result state
     is issued if no test have been executed across all test files.
     Patch by Pablo Galindo.

   - bpo-34962(18): make docstest in Doc now passes., and is enforced in
     CI

   - bpo-23596(19): Use argparse for the command line of the gzip
     module.  Patch by Antony Lee

   - bpo-34537(20): Fix ‘test_gdb.test_strings()’ when ‘LC_ALL=C’ and
     GDB was compiled with Python 3.6 or earlier.

   - bpo-34587(21): test_socket: Remove RDSTest.testCongestion().  The
     test tries to fill the receiver's socket buffer and expects an
     error.  But the RDS protocol doesn't require that.  Moreover, the
     Linux implementation of RDS expects that the producer of the
     messages reduces its rate, it's not the role of the receiver to
     trigger an error.  The test fails on Fedora 28 by design, so just
     remove it.

   - bpo-34661(22): Fix test_shutil if unzip doesn't support -t.

   - bpo-34200(23): Fixed non-deterministic flakiness of test_pkg by not
     using the scary test.support.module_cleanup() logic to save and
     restore sys.modules contents between test cases.

   - bpo-34569(24): The experimental PEP 554 data channels now correctly
     pass negative PyLong objects between subinterpreters on 32-bit
     systems.  Patch by Michael Felt.

   - bpo-34594(25): Fix usage of hardcoded ‘errno’ values in the tests.

   - bpo-34579(26): Fix test_embed for AIX Patch by Michael Felt

   - bpo-34542(27): Use 3072 RSA keys and SHA-256 signature for test
     certs and keys.

   - bpo-11193(28): Remove special condition for AIX in
     ‘test_subprocess.test_undecodable_env’

   - bpo-34347(29): Fix ‘test_utf8_mode.test_cmd_line’ for AIX

   - bpo-34490(30): On AIX with AF_UNIX family sockets getsockname()
     does not provide 'sockname', so skip calls to
     transport.get_extra_info('sockname')

   - bpo-34391(31): Fix ftplib test for TLS 1.3 by reading from data
     socket.

   - bpo-11192(32): Fix ‘test_socket’ on AIX 6.1 and later IPv6 zone id
     supports only supported by ‘inet_pton6_zone()’.  Switch to
     runtime-based ‘platform.system()’ to establish current platform
     rather than build-time based ‘sys.platform()’

   - bpo-34399(33): Update all RSA keys and DH params to use at least
     2048 bits.

   - bpo-34373(34): Fix ‘test_mktime’ and ‘test_pthread_getcpuclickid’
     tests for AIX Add range checking for ‘_PyTime_localtime’ for AIX
     Patch by Michael Felt

   - bpo-11191(35): Skip the distutils test 'test_search_cpp' when using
     XLC as compiler patch by aixtools (Michael Felt)

   - Improved an error message when mock assert_has_calls fails.

   - bpo-33746(36): Fix test_unittest when run in verbose mode.

   - bpo-33901(37): Fix test_dbm_gnu on macOS with gdbm 1.15: add a
     larger value to make sure that the file size changes.

   - bpo-33873(38): Fix a bug in ‘regrtest’ that caused an extra test to
     run if -huntrleaks/-R was used.  Exit with error in case that
     invalid parameters are specified to -huntrleaks/-R (at least one
     warmup run and one repetition must be used).

   - bpo-33562(39): Check that a global asyncio event loop policy is not
     left behind by any tests.

   - bpo-33655(40): Ignore test_posix_fallocate failures on BSD
     platforms that might be due to running on ZFS.

   - bpo-32962(41): Fixed test_gdb when Python is compiled with flags
     -mcet -fcf-protection -O0.

   - bpo-33358(42): Fix
     ‘test_embed.test_pre_initialization_sys_options()’ when the
     interpreter is built with ‘--enable-shared’.

   - bpo-32872(43): Avoid regrtest compatibility issue with namespace
     packages.

   - bpo-32517(44): Fix failing ‘test_asyncio’ on macOS 10.12.2+ due to
     transport of ‘KqueueSelector’ loop was not being closed.

   - bpo-32663(45): Making sure the ‘SMTPUTF8SimTests’ class of tests
     gets run in ‘test_smtplib.py’.

   - bpo-27643(46): Test_C test case needs "signed short" bitfields, but
     the IBM XLC compiler (on AIX) does not support this Skip the code
     and test when AIX and XLC are used

     Applicable to Python2-2.7 and later

   - bpo-19417(47): Add test_bdb.py.

   - bpo-31809(48): Add tests to verify connection with secp ECDH
     curves.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35772

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35045

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32710

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33717

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35488

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31731

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35424

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35519

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35513

   (10) https://bugs.python.org/issue?@action=redirect&bpo=34279

   (11) https://bugs.python.org/issue?@action=redirect&bpo=35412

   (12) https://bugs.python.org/issue?@action=redirect&bpo=26704

   (13) https://bugs.python.org/issue?@action=redirect&bpo=33725

   (14) https://bugs.python.org/issue?@action=redirect&bpo=35352

   (15) https://bugs.python.org/issue?@action=redirect&bpo=35317

   (16) https://bugs.python.org/issue?@action=redirect&bpo=21263

   (17) https://bugs.python.org/issue?@action=redirect&bpo=34279

   (18) https://bugs.python.org/issue?@action=redirect&bpo=34962

   (19) https://bugs.python.org/issue?@action=redirect&bpo=23596

   (20) https://bugs.python.org/issue?@action=redirect&bpo=34537

   (21) https://bugs.python.org/issue?@action=redirect&bpo=34587

   (22) https://bugs.python.org/issue?@action=redirect&bpo=34661

   (23) https://bugs.python.org/issue?@action=redirect&bpo=34200

   (24) https://bugs.python.org/issue?@action=redirect&bpo=34569

   (25) https://bugs.python.org/issue?@action=redirect&bpo=34594

   (26) https://bugs.python.org/issue?@action=redirect&bpo=34579

   (27) https://bugs.python.org/issue?@action=redirect&bpo=34542

   (28) https://bugs.python.org/issue?@action=redirect&bpo=11193

   (29) https://bugs.python.org/issue?@action=redirect&bpo=34347

   (30) https://bugs.python.org/issue?@action=redirect&bpo=34490

   (31) https://bugs.python.org/issue?@action=redirect&bpo=34391

   (32) https://bugs.python.org/issue?@action=redirect&bpo=11192

   (33) https://bugs.python.org/issue?@action=redirect&bpo=34399

   (34) https://bugs.python.org/issue?@action=redirect&bpo=34373

   (35) https://bugs.python.org/issue?@action=redirect&bpo=11191

   (36) https://bugs.python.org/issue?@action=redirect&bpo=33746

   (37) https://bugs.python.org/issue?@action=redirect&bpo=33901

   (38) https://bugs.python.org/issue?@action=redirect&bpo=33873

   (39) https://bugs.python.org/issue?@action=redirect&bpo=33562

   (40) https://bugs.python.org/issue?@action=redirect&bpo=33655

   (41) https://bugs.python.org/issue?@action=redirect&bpo=32962

   (42) https://bugs.python.org/issue?@action=redirect&bpo=33358

   (43) https://bugs.python.org/issue?@action=redirect&bpo=32872

   (44) https://bugs.python.org/issue?@action=redirect&bpo=32517

   (45) https://bugs.python.org/issue?@action=redirect&bpo=32663

   (46) https://bugs.python.org/issue?@action=redirect&bpo=27643

   (47) https://bugs.python.org/issue?@action=redirect&bpo=19417

   (48) https://bugs.python.org/issue?@action=redirect&bpo=31809


File: python.info,  Node: ビルド<61>,  Next: Windows<55>,  Prev: テスト<54>,  Up: Python 3 8 0 alpha 1

1.24.62.6 ビルド
................

   - bpo-34691(1): The _contextvars module is now built into the core
     Python library on Windows.

   - bpo-35683(2): Improved Azure Pipelines build steps and now
     verifying layouts correctly

   - bpo-35642(3): Remove asynciomodule.c from pythoncore.vcxproj

   - bpo-35550(4): Fix incorrect Solaris #ifdef checks to look for __sun
     && __SVR4 instead of sun when compiling.

   - bpo-35499(5): ‘make profile-opt’ no longer replaces ‘CFLAGS_NODIST’
     with ‘CFLAGS’.  It now adds profile-guided optimization (PGO) flags
     to ‘CFLAGS_NODIST’: existing ‘CFLAGS_NODIST’ flags are kept.

   - bpo-35257(6): Avoid leaking the linker flags from Link Time
     Optimizations (LTO) into distutils when compiling C extensions.

   - bpo-35351(7): When building Python with clang and LTO, LTO flags
     are no longer passed into CFLAGS to build third-party C extensions
     through distutils.

   - bpo-35139(8): Fix a compiler error when statically linking
     ‘pyexpat’ in ‘Modules/Setup’.

   - bpo-35059(9): PCbuild: Set InlineFunctionExpansion to
     OnlyExplicitInline ("/Ob1" option) in pyproject.props in Debug mode
     to expand functions marked as inline.  This change should make
     Python compiled in Debug mode a little bit faster on Windows.

   - bpo-35011(10): Restores the use of pyexpatns.h to isolate our
     embedded copy of the expat C library so that its symbols do not
     conflict at link or dynamic loading time with an embedding
     application or other extension modules with their own version of
     libexpat.

   - bpo-28015(11): Have -with-lto works correctly with clang.

   - bpo-34765(12): Update the outdated install-sh file to the latest
     revision from automake v1.16.1

   - bpo-34585(13): Check for floating-point byte order in configure.ac
     using compilation tests instead of executing code, so that these
     checks work in cross-compiled builds.

   - bpo-34710(14): Fixed SSL module build with OpenSSL & pedantic
     CFLAGS.

   - bpo-34582(15): Add JUnit XML output for regression tests and update
     Azure DevOps builds.

   - bpo-34081(16): Make Sphinx warnings as errors in the Docs Makefile.

   - bpo-34555(17): Fix for case where it was not possible to have both
     ‘HAVE_LINUX_VM_SOCKETS_H’ and ‘HAVE_SOCKADDR_ALG’ be undefined.

   - bpo-33015(18): Fix an undefined behaviour in the pthread
     implementation of *note PyThread_start_new_thread(): 1e2b.: add a
     function wrapper to always return ‘NULL’.

   - bpo-34245(19): The Python shared library is now installed with
     write permission (mode 0755), which is the standard way of
     installing such libraries.

   - bpo-34121(20): Fix detection of C11 atomic support on clang.

   - bpo-32430(21): Rename Modules/Setup.dist to Modules/Setup, and
     remove the necessity to copy the former manually to the latter when
     updating the local source tree.

   - bpo-30345(22): Add -g to LDFLAGS when compiling with LTO to get
     debug symbols.

   - bpo-5755(23): Move ‘-Wstrict-prototypes’ option to ‘CFLAGS_NODIST’
     from ‘OPT’.  This option emitted annoying warnings when building
     extension modules written in C++.

   - bpo-33614(24): Ensures module definition files for the stable ABI
     on Windows are correctly regenerated.

   - bpo-33648(25): The -with-c-locale-warning configuration flag has
     been removed.  It has had no effect for about a year.

   - bpo-33522(26): Enable CI builds on Visual Studio Team Services at
     ‘https://python.visualstudio.com/cpython’

   - bpo-33512(27): configure's check for "long double" has been
     simplified

   - bpo-33483(28): C compiler is now correctly detected from the
     standard environment variables.  -without-gcc and -with-icc options
     have been removed.

   - bpo-33394(29): Enable the verbose build for extension modules, when
     GNU make is passed macros on the command line.

   - bpo-33393(30): Update config.guess and config.sub files.

   - bpo-33377(31): Add new triplets for mips r6 and riscv variants
     (used in extension suffixes).

   - bpo-32232(32): By default, modules configured in ‘Modules/Setup’
     are no longer built with ‘-DPy_BUILD_CORE’.  Instead, modules that
     specifically need that preprocessor definition include it in their
     individual entries.

   - bpo-33182(33): The embedding tests can once again be built with
     clang 6.0

   - bpo-33163(34): Upgrade pip to 9.0.3 and setuptools to v39.0.1.

   - bpo-33012(35): gcc 8 has added a new warning heuristic to detect
     invalid function casts and a stock python build seems to hit that
     warning quite often.  The most common is the cast of a METH_NOARGS
     function (that uses just one argument) to a PyCFunction.  Fix this
     by adding a dummy argument to all functions that implement
     METH_NOARGS.

   - bpo-32898(36): Fix the python debug build when using COUNT_ALLOCS.

   - bpo-29442(37): Replace optparse with argparse in setup.py

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34691

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35683

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35642

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35550

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35499

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35257

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35351

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35139

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35059

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35011

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28015

   (12) https://bugs.python.org/issue?@action=redirect&bpo=34765

   (13) https://bugs.python.org/issue?@action=redirect&bpo=34585

   (14) https://bugs.python.org/issue?@action=redirect&bpo=34710

   (15) https://bugs.python.org/issue?@action=redirect&bpo=34582

   (16) https://bugs.python.org/issue?@action=redirect&bpo=34081

   (17) https://bugs.python.org/issue?@action=redirect&bpo=34555

   (18) https://bugs.python.org/issue?@action=redirect&bpo=33015

   (19) https://bugs.python.org/issue?@action=redirect&bpo=34245

   (20) https://bugs.python.org/issue?@action=redirect&bpo=34121

   (21) https://bugs.python.org/issue?@action=redirect&bpo=32430

   (22) https://bugs.python.org/issue?@action=redirect&bpo=30345

   (23) https://bugs.python.org/issue?@action=redirect&bpo=5755

   (24) https://bugs.python.org/issue?@action=redirect&bpo=33614

   (25) https://bugs.python.org/issue?@action=redirect&bpo=33648

   (26) https://bugs.python.org/issue?@action=redirect&bpo=33522

   (27) https://bugs.python.org/issue?@action=redirect&bpo=33512

   (28) https://bugs.python.org/issue?@action=redirect&bpo=33483

   (29) https://bugs.python.org/issue?@action=redirect&bpo=33394

   (30) https://bugs.python.org/issue?@action=redirect&bpo=33393

   (31) https://bugs.python.org/issue?@action=redirect&bpo=33377

   (32) https://bugs.python.org/issue?@action=redirect&bpo=32232

   (33) https://bugs.python.org/issue?@action=redirect&bpo=33182

   (34) https://bugs.python.org/issue?@action=redirect&bpo=33163

   (35) https://bugs.python.org/issue?@action=redirect&bpo=33012

   (36) https://bugs.python.org/issue?@action=redirect&bpo=32898

   (37) https://bugs.python.org/issue?@action=redirect&bpo=29442


File: python.info,  Node: Windows<55>,  Next: macOS<42>,  Prev: ビルド<61>,  Up: Python 3 8 0 alpha 1

1.24.62.7 Windows
.................

   - bpo-35890(1): Fix API calling consistency of GetVersionEx and
     wcstok.

   - bpo-32560(2): The ‘py’ launcher now forwards its ‘STARTUPINFO’
     structure to child processes.

   - bpo-35854(3): Fix EnvBuilder and -symlinks in venv on Windows

   - bpo-35811(4): Avoid propagating venv settings when launching via
     py.exe

   - bpo-35797(5): Fix default executable used by the multiprocessing
     module

   - bpo-35758(6): Allow building on ARM with MSVC.

   - bpo-29734(7): Fix handle leaks in os.stat on Windows.

   - bpo-35596(8): Use unchecked PYCs for the embeddable distro to avoid
     zipimport restrictions.

   - bpo-35596(9): Fix vcruntime140.dll being added to embeddable distro
     multiple times.

   - bpo-35402(10): Update Windows build to use Tcl and Tk 8.6.9

   - bpo-35401(11): Updates Windows build to OpenSSL 1.1.0j

   - bpo-34977(12): venv on Windows will now use a python.exe redirector
     rather than copying the actual binaries from the base environment.

   - bpo-34977(13): Adds support for building a Windows App Store
     package

   - bpo-35067(14): Remove _distutils_findvs module and use vswhere.exe
     instead.

   - bpo-32557(15): Allow shutil.disk_usage to take a file path on
     Windows

   - bpo-34770(16): Fix a possible null pointer dereference in
     pyshellext.cpp.

   - bpo-34603(17): Fix returning structs from functions produced by
     MSVC

   - bpo-34581(18): Guard MSVC-specific code in socketmodule.c with
     ‘#ifdef _MSC_VER’.

   - bpo-34532(19): Fixes exit code of list version arguments for
     py.exe.

   - bpo-34062(20): Fixed the '-list' and '-list-paths' arguments for
     the py.exe launcher

   - bpo-34225(21): Ensure INCLUDE and LIB directories do not end with a
     backslash.

   - bpo-34011(22): A suite of code has been changed which copied across
     DLLs and init.tcl from the running Python location into a venv
     being created.  These copies are needed only when running from a
     Python source build, and the copying code is now only run when that
     is the case, rather than whenever a venv is created.

   - bpo-34006(23): Revert line length limit for Windows help docs.  The
     line-length limit is not needed because the pages appear in a
     separate app rather than on a browser tab.  It can also interact
     badly with the DPI setting.

   - bpo-31546(24): Restore running PyOS_InputHook while waiting for
     user input at the prompt.  The restores integration of interactive
     GUI windows (such as Matplotlib figures) with the prompt on
     Windows.

   - bpo-30237(25): Output error when ReadConsole is canceled by
     CancelSynchronousIo instead of crashing.

   - bpo-33895(26): GIL is released while calling functions that acquire
     Windows loader lock.

   - bpo-33720(27): Reduces maximum marshal recursion depth on release
     builds.

   - bpo-29097(28): Fix bug where ‘datetime.fromtimestamp()’ erroneously
     throws an *note OSError: 2c0. on Windows for values between 0 and
     86400.  Patch by Ammar Askar.

   - bpo-33316(29): PyThread_release_lock always fails

   - bpo-33184(30): Update Windows installer to use OpenSSL 1.1.0h.

   - bpo-32890(31): Fix usage of GetLastError() instead of errno in
     os.execve() and os.truncate().

   - bpo-33016(32): Fix potential use of uninitialized memory in
     nt._getfinalpathname

   - bpo-32903(33): Fix a memory leak in os.chdir() on Windows if the
     current directory is set to a UNC path.

   - bpo-32901(34): Update Tcl and Tk versions to 8.6.8

   - bpo-31966(35): Fixed WindowsConsoleIO.write() for writing empty
     data.

   - bpo-32409(36): Ensures activate.bat can handle Unicode contents.

   - bpo-32457(37): Improves handling of denormalized executable path
     when launching Python.

   - bpo-32370(38): Use the correct encoding for ipconfig output in the
     uuid module.  Patch by Segev Finer.

   - bpo-29248(39): Fix *note os.readlink(): b1a. on Windows, which was
     mistakenly treating the ‘PrintNameOffset’ field of the reparse data
     buffer as a number of characters instead of bytes.  Patch by Craig
     Holmquist and SSE4.

   - bpo-1104(40): Correctly handle string length in
     ‘msilib.SummaryInfo.GetProperty()’ to prevent it from truncating
     the last character.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35890

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32560

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35854

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35811

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35797

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35758

   (7) https://bugs.python.org/issue?@action=redirect&bpo=29734

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35596

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35596

   (10) https://bugs.python.org/issue?@action=redirect&bpo=35402

   (11) https://bugs.python.org/issue?@action=redirect&bpo=35401

   (12) https://bugs.python.org/issue?@action=redirect&bpo=34977

   (13) https://bugs.python.org/issue?@action=redirect&bpo=34977

   (14) https://bugs.python.org/issue?@action=redirect&bpo=35067

   (15) https://bugs.python.org/issue?@action=redirect&bpo=32557

   (16) https://bugs.python.org/issue?@action=redirect&bpo=34770

   (17) https://bugs.python.org/issue?@action=redirect&bpo=34603

   (18) https://bugs.python.org/issue?@action=redirect&bpo=34581

   (19) https://bugs.python.org/issue?@action=redirect&bpo=34532

   (20) https://bugs.python.org/issue?@action=redirect&bpo=34062

   (21) https://bugs.python.org/issue?@action=redirect&bpo=34225

   (22) https://bugs.python.org/issue?@action=redirect&bpo=34011

   (23) https://bugs.python.org/issue?@action=redirect&bpo=34006

   (24) https://bugs.python.org/issue?@action=redirect&bpo=31546

   (25) https://bugs.python.org/issue?@action=redirect&bpo=30237

   (26) https://bugs.python.org/issue?@action=redirect&bpo=33895

   (27) https://bugs.python.org/issue?@action=redirect&bpo=33720

   (28) https://bugs.python.org/issue?@action=redirect&bpo=29097

   (29) https://bugs.python.org/issue?@action=redirect&bpo=33316

   (30) https://bugs.python.org/issue?@action=redirect&bpo=33184

   (31) https://bugs.python.org/issue?@action=redirect&bpo=32890

   (32) https://bugs.python.org/issue?@action=redirect&bpo=33016

   (33) https://bugs.python.org/issue?@action=redirect&bpo=32903

   (34) https://bugs.python.org/issue?@action=redirect&bpo=32901

   (35) https://bugs.python.org/issue?@action=redirect&bpo=31966

   (36) https://bugs.python.org/issue?@action=redirect&bpo=32409

   (37) https://bugs.python.org/issue?@action=redirect&bpo=32457

   (38) https://bugs.python.org/issue?@action=redirect&bpo=32370

   (39) https://bugs.python.org/issue?@action=redirect&bpo=29248

   (40) https://bugs.python.org/issue?@action=redirect&bpo=1104


File: python.info,  Node: macOS<42>,  Next: IDLE<37>,  Prev: Windows<55>,  Up: Python 3 8 0 alpha 1

1.24.62.8 macOS
...............

   - bpo-35401(1): Update macOS installer to use OpenSSL 1.1.0j.

   - bpo-35025(2): Properly guard the use of the ‘CLOCK_GETTIME’ et al.
     macros in ‘timemodule’ on macOS.

   - bpo-24658(3): On macOS, fix reading from and writing into a file
     with a size larger than 2 GiB.

   - bpo-34405(4): Update to OpenSSL 1.1.0i for macOS installer builds.

   - bpo-33635(5): In macOS stat on some file descriptors (/dev/fd/3
     f.e) will result in bad file descriptor OSError.  Guard against
     this exception was added in is_dir, is_file and similar methods.
     DirEntry.is_dir can also throw this exception so
     _RecursiveWildcardSelector._iterate_directories was also extended
     with the same error ignoring pattern.

   - bpo-13631(6): The .editrc file in user's home directory is now
     processed correctly during the readline initialization through
     editline emulation on macOS.

   - bpo-33184(7): Update macOS installer build to use OpenSSL 1.1.0h.

   - bpo-32726(8): Build and link with private copy of Tcl/Tk 8.6 for
     the macOS 10.6+ installer.  The 10.9+ installer variant already
     does this.  This means that the Python 3.7 provided by the
     python.org macOS installers no longer need or use any external
     versions of Tcl/Tk, either system-provided or user-installed, such
     as ActiveTcl.

   - bpo-32901(9): Update macOS 10.9+ installer to Tcl/Tk 8.6.8.

   - bpo-31903(10): In ‘_scproxy’, drop the GIL when calling into
     ‘SystemConfiguration’ to avoid deadlocks.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35401

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35025

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24658

   (4) https://bugs.python.org/issue?@action=redirect&bpo=34405

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33635

   (6) https://bugs.python.org/issue?@action=redirect&bpo=13631

   (7) https://bugs.python.org/issue?@action=redirect&bpo=33184

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32726

   (9) https://bugs.python.org/issue?@action=redirect&bpo=32901

   (10) https://bugs.python.org/issue?@action=redirect&bpo=31903


File: python.info,  Node: IDLE<37>,  Next: Tools/Demos<37>,  Prev: macOS<42>,  Up: Python 3 8 0 alpha 1

1.24.62.9 IDLE
..............

   - bpo-35770(1): IDLE macosx deletes Options => Configure IDLE. It
     previously deleted Window => Zoom Height by mistake.  (Zoom Height
     is now on the Options menu).  On Mac, the settings dialog is
     accessed via Preferences on the IDLE menu.

   - bpo-35769(2): Change IDLE's new file name from 'Untitled' to
     'untitled'

   - bpo-35660(3): Fix imports in idlelib.window.

   - bpo-35641(4): Proper format ‘calltip’ when the function has no
     docstring.

   - bpo-33987(5): Use ttk Frame for ttk widgets.

   - bpo-34055(6): Fix erroneous 'smart' indents and newlines in IDLE
     Shell.

   - bpo-35591(7): Find Selection now works when selection not found.

   - bpo-35196(8): Speed up squeezer line counting.

   - bpo-35598(9): Update config_key: use PEP 8 names and ttk widgets,
     make some objects global, and add tests.

   - bpo-28097(10): Add Previous/Next History entries to Shell menu.

   - bpo-35208(11): Squeezer now properly counts wrapped lines before
     newlines.

   - bpo-35555(12): Gray out Code Context menu entry when it's not
     applicable.

   - bpo-35521(13): Document the IDLE editor code context feature.  Add
     some internal references within the IDLE doc.

   - bpo-22703(14): The Code Context menu label now toggles between
     Show/Hide Code Context.  The Zoom Height menu now toggles between
     Zoom/Restore Height.  Zoom Height has moved from the Window menu to
     the Options menu.

   - bpo-35213(15): Where appropriate, use 'macOS' in idlelib.

   - bpo-34864(16): On macOS, warn if the system preference "Prefer tabs
     when opening documents" is set to "Always".

   - bpo-34864(17): Document two IDLE on MacOS issues.  The System
     Preferences Dock "prefer tabs always" setting disables some IDLE
     features.  Menus are a bit different than as described for Windows
     and Linux.

   - bpo-35202(18): Remove unused imports from lib/idlelib

   - bpo-33000(19): Document that IDLE's shell has no line limit.  A
     program that runs indefinitely can overfill memory.

   - bpo-23220(20): Explain how IDLE's Shell displays output.

   - bpo-35099(21): Improve the doc about IDLE running user code.  The
     section is renamed from "IDLE - console differences" is renamed
     "Running user code".  It mostly covers the implications of using
     custom ‘sys.stdXXX’ objects.

   - bpo-35097(22): Add IDLE doc subsection explaining editor windows.
     Topics include opening, title and status bar, .py* extension, and
     running.

   - bpo-35093(23): Document the IDLE document viewer in the IDLE doc.
     Add a paragraph in "Help and preferences", "Help sources"
     subsection.

   - bpo-35088(24): Update idlelib.help.copy_string docstring.  We now
     use git and backporting instead of hg and forward merging.

   - bpo-35087(25): Update idlelib help files for the current doc build.
     The main change is the elimination of chapter-section numbers.

   - bpo-34548(26): Use configured color theme for read-only text views.

   - bpo-1529353(27): Enable "squeezing" of long outputs in the shell,
     to avoid performance degradation and to clean up the history
     without losing it.  Squeezed outputs may be copied, viewed in a
     separate window, and "unsqueezed".

   - bpo-34047(28): Fixed mousewheel scrolling direction on macOS.

   - bpo-34275(29): Make IDLE calltips always visible on Mac.  Some
     MacOS-tk combinations need .update_idletasks().  Patch by Kevin
     Walzer.

   - bpo-34120(30): Fix unresponsiveness after closing certain windows
     and dialogs.

   - bpo-33975(31): Avoid small type when running htests.  Since part of
     the purpose of human-viewed tests is to determine that widgets look
     right, it is important that they look the same for testing as when
     running IDLE.

   - bpo-33905(32): Add test for idlelib.stackview.StackBrowser.

   - bpo-33924(33): Change mainmenu.menudefs key 'windows' to 'window'.
     Every other menudef key is lowercase version of main menu entry.

   - bpo-33906(34): Rename idlelib.windows as window Match Window on the
     main menu and remove last plural module name.

   - bpo-33917(35): Fix and document idlelib/idle_test/template.py.  The
     revised file compiles, runs, and tests OK. idle_test/README.txt
     explains how to use it to create new IDLE test files.

   - bpo-33904(36): IDLE: In rstrip, rename class RstripExtension as
     Rstrip

   - bpo-33907(37): For consistency and clarity, rename an IDLE module
     and classes.  Module calltips and its class CallTips are now
     calltip and Calltip.  In module calltip_w, class CallTip is now
     CalltipWindow.

   - bpo-33856(38): Add "help" in the welcome message of IDLE

   - bpo-33839(39): IDLE: refactor ToolTip and CallTip and add
     documentation and tests

   - bpo-33855(40): Minimally test all IDLE modules.  Add missing files,
     import module, instantiate classes, and check coverage.  Check
     existing files.

   - bpo-33656(41): On Windows, add API call saying that tk scales for
     DPI. On Windows 8.1+ or 10, with DPI compatibility properties of
     the Python binary unchanged, and a monitor resolution greater than
     96 DPI, this should make text and lines sharper.  It should
     otherwise have no effect.

   - bpo-33768(42): Clicking on a context line moves that line to the
     top of the editor window.

   - bpo-33763(43): IDLE: Use read-only text widget for code context
     instead of label widget.

   - bpo-33664(44): Scroll IDLE editor text by lines.  Previously, the
     mouse wheel and scrollbar slider moved text by a fixed number of
     pixels, resulting in partial lines at the top of the editor box.
     The change also applies to the shell and grep output windows, but
     not to read-only text views.

   - bpo-33679(45): Enable theme-specific color configuration for Code
     Context.  Use the Highlights tab to see the setting for built-in
     themes or add settings to custom themes.

   - bpo-33642(46): Display up to maxlines non-blank lines for Code
     Context.  If there is no current context, show a single blank line.

   - bpo-33628(47): IDLE: Cleanup codecontext.py and its test.

   - bpo-33564(48): IDLE's code context now recognizes async as a block
     opener.

   - bpo-21474(49): Update word/identifier definition from ascii to
     unicode.  In text and entry boxes, this affects selection by
     double-click, movement left/right by control-left/right, and
     deletion left/right by control-BACKSPACE/DEL.

   - bpo-33204(50): IDLE: consistently color invalid string prefixes.  A
     'u' string prefix cannot be paired with either 'r' or 'f'.
     Consistently color as much of the prefix, starting at the right, as
     is valid.  Revise and extend colorizer test.

   - bpo-32984(51): Set ‘__file__’ while running a startup file.  Like
     Python, IDLE optionally runs one startup file in the Shell window
     before presenting the first interactive input prompt.  For IDLE,
     ‘-s’ runs a file named in environmental variable ‘IDLESTARTUP’ or
     *note PYTHONSTARTUP: 1b8.; ‘-r file’ runs ‘file’.  Python sets
     ‘__file__’ to the startup file name before running the file and
     unsets it before the first prompt.  IDLE now does the same when run
     normally, without the ‘-n’ option.

   - bpo-32940(52): Simplify and rename StringTranslatePseudoMapping in
     pyparse.

   - bpo-32916(53): Change ‘str’ to ‘code’ in pyparse.

   - bpo-32905(54): Remove unused code in pyparse module.

   - bpo-32874(55): Add tests for pyparse.

   - bpo-32837(56): Using the system and place-dependent default
     encoding for open() is a bad idea for IDLE's system and
     location-independent files.

   - bpo-32826(57): Add "encoding=utf-8" to open() in IDLE's
     test_help_about.  GUI test test_file_buttons() only looks at
     initial ascii-only lines, but failed on systems where open()
     defaults to 'ascii' because readline() internally reads and decodes
     far enough ahead to encounter a non-ascii character in CREDITS.txt.

   - bpo-32831(58): Add docstrings and tests for codecontext.

   - bpo-32765(59): Update configdialog General tab docstring to add new
     widgets to the widget list.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35770

   (2) https://bugs.python.org/issue?@action=redirect&bpo=35769

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35660

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35641

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33987

   (6) https://bugs.python.org/issue?@action=redirect&bpo=34055

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35591

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35196

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35598

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28097

   (11) https://bugs.python.org/issue?@action=redirect&bpo=35208

   (12) https://bugs.python.org/issue?@action=redirect&bpo=35555

   (13) https://bugs.python.org/issue?@action=redirect&bpo=35521

   (14) https://bugs.python.org/issue?@action=redirect&bpo=22703

   (15) https://bugs.python.org/issue?@action=redirect&bpo=35213

   (16) https://bugs.python.org/issue?@action=redirect&bpo=34864

   (17) https://bugs.python.org/issue?@action=redirect&bpo=34864

   (18) https://bugs.python.org/issue?@action=redirect&bpo=35202

   (19) https://bugs.python.org/issue?@action=redirect&bpo=33000

   (20) https://bugs.python.org/issue?@action=redirect&bpo=23220

   (21) https://bugs.python.org/issue?@action=redirect&bpo=35099

   (22) https://bugs.python.org/issue?@action=redirect&bpo=35097

   (23) https://bugs.python.org/issue?@action=redirect&bpo=35093

   (24) https://bugs.python.org/issue?@action=redirect&bpo=35088

   (25) https://bugs.python.org/issue?@action=redirect&bpo=35087

   (26) https://bugs.python.org/issue?@action=redirect&bpo=34548

   (27) https://bugs.python.org/issue?@action=redirect&bpo=1529353

   (28) https://bugs.python.org/issue?@action=redirect&bpo=34047

   (29) https://bugs.python.org/issue?@action=redirect&bpo=34275

   (30) https://bugs.python.org/issue?@action=redirect&bpo=34120

   (31) https://bugs.python.org/issue?@action=redirect&bpo=33975

   (32) https://bugs.python.org/issue?@action=redirect&bpo=33905

   (33) https://bugs.python.org/issue?@action=redirect&bpo=33924

   (34) https://bugs.python.org/issue?@action=redirect&bpo=33906

   (35) https://bugs.python.org/issue?@action=redirect&bpo=33917

   (36) https://bugs.python.org/issue?@action=redirect&bpo=33904

   (37) https://bugs.python.org/issue?@action=redirect&bpo=33907

   (38) https://bugs.python.org/issue?@action=redirect&bpo=33856

   (39) https://bugs.python.org/issue?@action=redirect&bpo=33839

   (40) https://bugs.python.org/issue?@action=redirect&bpo=33855

   (41) https://bugs.python.org/issue?@action=redirect&bpo=33656

   (42) https://bugs.python.org/issue?@action=redirect&bpo=33768

   (43) https://bugs.python.org/issue?@action=redirect&bpo=33763

   (44) https://bugs.python.org/issue?@action=redirect&bpo=33664

   (45) https://bugs.python.org/issue?@action=redirect&bpo=33679

   (46) https://bugs.python.org/issue?@action=redirect&bpo=33642

   (47) https://bugs.python.org/issue?@action=redirect&bpo=33628

   (48) https://bugs.python.org/issue?@action=redirect&bpo=33564

   (49) https://bugs.python.org/issue?@action=redirect&bpo=21474

   (50) https://bugs.python.org/issue?@action=redirect&bpo=33204

   (51) https://bugs.python.org/issue?@action=redirect&bpo=32984

   (52) https://bugs.python.org/issue?@action=redirect&bpo=32940

   (53) https://bugs.python.org/issue?@action=redirect&bpo=32916

   (54) https://bugs.python.org/issue?@action=redirect&bpo=32905

   (55) https://bugs.python.org/issue?@action=redirect&bpo=32874

   (56) https://bugs.python.org/issue?@action=redirect&bpo=32837

   (57) https://bugs.python.org/issue?@action=redirect&bpo=32826

   (58) https://bugs.python.org/issue?@action=redirect&bpo=32831

   (59) https://bugs.python.org/issue?@action=redirect&bpo=32765


File: python.info,  Node: Tools/Demos<37>,  Next: C API<56>,  Prev: IDLE<37>,  Up: Python 3 8 0 alpha 1

1.24.62.10 Tools/Demos
......................

   - bpo-35884(1): Add a benchmark script for timing various ways to
     access variables: ‘Tools/scripts/var_access_benchmark.py’.

   - bpo-34989(2): python-gdb.py now handles errors on computing the
     line number of a Python frame.

   - bpo-20260(3): Argument Clinic now has non-bitwise unsigned int
     converters.

   - bpo-32962(4): python-gdb now catches ‘UnicodeDecodeError’
     exceptions when calling ‘string()’.

   - bpo-32962(5): python-gdb now catches ValueError on read_var(): when
     Python has no debug symbols for example.

   - bpo-33189(6): ‘pygettext.py’ now recognizes only literal strings as
     docstrings and translatable strings, and rejects bytes literals and
     f-string expressions.

   - bpo-31920(7): Fixed handling directories as arguments in the
     ‘pygettext’ script.  Based on patch by Oleg Krasnikov.

   - bpo-29673(8): Fix pystackv and pystack gdbinit macros.

   - bpo-25427(9): Remove the pyvenv script in favor of ‘python3 -m
     venv’ in order to lower confusion as to what Python interpreter a
     virtual environment will be created for.

   - bpo-32885(10): Add an ‘-n’ flag for ‘Tools/scripts/pathfix.py’ to
     disable automatic backup creation (files with ‘~’ suffix).

   - bpo-32222(11): Fix pygettext not extracting docstrings for
     functions with type annotated arguments.  Patch by Toby Harradine.

   - bpo-31583(12): Fix 2to3 for using with -add-suffix option but
     without -output-dir option for relative path to files in current
     directory.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35884

   (2) https://bugs.python.org/issue?@action=redirect&bpo=34989

   (3) https://bugs.python.org/issue?@action=redirect&bpo=20260

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32962

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32962

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33189

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31920

   (8) https://bugs.python.org/issue?@action=redirect&bpo=29673

   (9) https://bugs.python.org/issue?@action=redirect&bpo=25427

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32885

   (11) https://bugs.python.org/issue?@action=redirect&bpo=32222

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31583


File: python.info,  Node: C API<56>,  Prev: Tools/Demos<37>,  Up: Python 3 8 0 alpha 1

1.24.62.11 C API
................

   - bpo-35713(1): The ‘PyByteArray_Init()’ and ‘PyByteArray_Fini()’
     functions have been removed.  They did nothing since Python 2.7.4
     and Python 3.2.0, were excluded from the limited API (stable ABI),
     and were not documented.

   - bpo-33817(2): Fixed *note _PyBytes_Resize(): 19ce. for empty bytes
     objects.

   - bpo-35322(3): Fix memory leak in *note PyUnicode_EncodeLocale():
     dc3. and *note PyUnicode_EncodeFSDefault(): 1e31. on error
     handling.

   - bpo-35059(4): The following C macros have been converted to static
     inline functions: *note Py_INCREF(): 78f, *note Py_DECREF(): 790,
     *note Py_XINCREF(): c5a, *note Py_XDECREF(): 992, *note
     PyObject_INIT(): 1d3e, *note PyObject_INIT_VAR(): 1d3f.

   - bpo-35296(5): ‘make install’ now also installs the internal API:
     ‘Include/internal/*.h’ header files.

   - bpo-35081(6): Internal APIs surrounded by ‘#ifdef Py_BUILD_CORE’
     have been moved from ‘Include/*.h’ headers to new header files
     ‘Include/internal/pycore_*.h’.

   - bpo-35259(7): Conditionally declare *note Py_FinalizeEx(): f11.
     (new in 3.6) based on Py_LIMITED_API. Patch by Arthur Neufeld.

   - bpo-35081(8): The ‘_PyObject_GC_TRACK()’ and
     ‘_PyObject_GC_UNTRACK()’ macros have been removed from the public C
     API.

   - bpo-35134(9): Creation of a new ‘Include/cpython/’ subdirectory.

   - bpo-34725(10): Adds _Py_SetProgramFullPath so embedders may
     override sys.executable

   - bpo-34910(11): Ensure that *note PyObject_Print(): 198b. always
     returns ‘-1’ on error.  Patch by Zackery Spytz.

   - bpo-34523(12): Py_DecodeLocale() and Py_EncodeLocale() now use the
     UTF-8 encoding on Windows if Py_LegacyWindowsFSEncodingFlag is
     zero.

   - bpo-34193(13): Fix pluralization in TypeError messages in getargs.c
     and typeobject.c: '1 argument' instead of '1 arguments' and '1
     element' instead of '1 elements'.

   - bpo-34127(14): Return grammatically correct error message based on
     argument count.  Patch by Karthikeyan Singaravelan.

   - bpo-23927(15): Fixed *note SystemError: 795. in *note
     PyArg_ParseTupleAndKeywords(): 624. when the ‘w*’ format unit is
     used for optional parameter.

   - bpo-32455(16): Added *note PyCompile_OpcodeStackEffectWithJump():
     1e32.

   - bpo-34008(17): Py_Main() can again be called after Py_Initialize(),
     as in Python 3.6.

   - bpo-32500(18): Fixed error messages for *note PySequence_Size():
     1e33, *note PySequence_GetItem(): 1e34, *note PySequence_SetItem():
     1e35. and *note PySequence_DelItem(): 1e36. called with a mapping
     and *note PyMapping_Size(): 1e37. called with a sequence.

   - bpo-33818(19): *note PyExceptionClass_Name(): c5b. will now return
     ‘const char *’ instead of ‘char *’.

   - bpo-33042(20): Embedding applications may once again call
     PySys_ResetWarnOptions, PySys_AddWarnOption, and PySys_AddXOption
     prior to calling Py_Initialize.

   - bpo-32374(21): Document that m_traverse for multi-phase initialized
     modules can be called with m_state=NULL, and add a sanity check

   - bpo-30863(22): *note PyUnicode_AsWideChar(): 1e38. and *note
     PyUnicode_AsWideCharString(): ab9. no longer cache the ‘wchar_t*’
     representation of string objects.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=35713

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33817

   (3) https://bugs.python.org/issue?@action=redirect&bpo=35322

   (4) https://bugs.python.org/issue?@action=redirect&bpo=35059

   (5) https://bugs.python.org/issue?@action=redirect&bpo=35296

   (6) https://bugs.python.org/issue?@action=redirect&bpo=35081

   (7) https://bugs.python.org/issue?@action=redirect&bpo=35259

   (8) https://bugs.python.org/issue?@action=redirect&bpo=35081

   (9) https://bugs.python.org/issue?@action=redirect&bpo=35134

   (10) https://bugs.python.org/issue?@action=redirect&bpo=34725

   (11) https://bugs.python.org/issue?@action=redirect&bpo=34910

   (12) https://bugs.python.org/issue?@action=redirect&bpo=34523

   (13) https://bugs.python.org/issue?@action=redirect&bpo=34193

   (14) https://bugs.python.org/issue?@action=redirect&bpo=34127

   (15) https://bugs.python.org/issue?@action=redirect&bpo=23927

   (16) https://bugs.python.org/issue?@action=redirect&bpo=32455

   (17) https://bugs.python.org/issue?@action=redirect&bpo=34008

   (18) https://bugs.python.org/issue?@action=redirect&bpo=32500

   (19) https://bugs.python.org/issue?@action=redirect&bpo=33818

   (20) https://bugs.python.org/issue?@action=redirect&bpo=33042

   (21) https://bugs.python.org/issue?@action=redirect&bpo=32374

   (22) https://bugs.python.org/issue?@action=redirect&bpo=30863


File: python.info,  Node: Python 3 7 0 final,  Next: Python 3 7 0 release candidate 1,  Prev: Python 3 8 0 alpha 1,  Up: 変更履歴

1.24.63 Python 3.7.0 final
--------------------------

'Release date: 2018-06-27'

* Menu:

* ライブラリ: ライブラリ<163>.
* C API: C API<57>.


File: python.info,  Node: ライブラリ<163>,  Next: C API<57>,  Up: Python 3 7 0 final

1.24.63.1 ライブラリ
....................

   - bpo-33851(1): Fix *note ast.get_docstring(): 1e3b. for a node that
     lacks a docstring.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33851


File: python.info,  Node: C API<57>,  Prev: ライブラリ<163>,  Up: Python 3 7 0 final

1.24.63.2 C API
...............

   - bpo-33932(1): Calling Py_Initialize() twice does nothing, instead
     of failing with a fatal error: restore the Python 3.6 behaviour.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33932


File: python.info,  Node: Python 3 7 0 release candidate 1,  Next: Python 3 7 0 beta 5,  Prev: Python 3 7 0 final,  Up: 変更履歴

1.24.64 Python 3.7.0 release candidate 1
----------------------------------------

'Release date: 2018-06-12'

* Menu:

* Core and Builtins: Core and Builtins<160>.
* ライブラリ: ライブラリ<164>.
* ドキュメント: ドキュメント<57>.
* ビルド: ビルド<62>.
* Windows: Windows<56>.
* IDLE: IDLE<38>.


File: python.info,  Node: Core and Builtins<160>,  Next: ライブラリ<164>,  Up: Python 3 7 0 release candidate 1

1.24.64.1 Core and Builtins
...........................

   - bpo-33803(1): Fix a crash in hamt.c caused by enabling GC tracking
     for an object that hadn't all of its fields set to NULL.

   - bpo-33706(2): Fix a crash in Python initialization when parsing the
     command line options.  Thanks Christoph Gohlke for the bug report
     and the fix!

   - bpo-30654(3): Fixed reset of the SIGINT handler to SIG_DFL on
     interpreter shutdown even when there was a custom handler set
     previously.  Patch by Philipp Kerling.

   - bpo-31849(4): Fix signed/unsigned comparison warning in pyhash.c.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33803

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33706

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30654

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31849


File: python.info,  Node: ライブラリ<164>,  Next: ドキュメント<57>,  Prev: Core and Builtins<160>,  Up: Python 3 7 0 release candidate 1

1.24.64.2 ライブラリ
....................

   - bpo-30167(1): Prevent site.main() exception if PYTHONSTARTUP is
     set.  Patch by Steve Weber.

   - bpo-33812(2): Datetime instance d with non-None tzinfo, but with
     d.tzinfo.utcoffset(d) returning None is now treated as naive by the
     astimezone() method.

   - bpo-30805(3): Avoid race condition with debug logging

   - bpo-33694(4): asyncio: Fix a race condition causing data loss on
     pause_reading()/resume_reading() when using the ProactorEventLoop.

   - bpo-32493(5): Correct test for ‘uuid_enc_be’ availability in
     ‘configure.ac’.  Patch by Michael Felt.

   - bpo-33792(6): Add asyncio.WindowsSelectorEventLoopPolicy and
     asyncio.WindowsProactorEventLoopPolicy.

   - bpo-33778(7): Update ‘unicodedata’'s database to Unicode version
     11.0.0.

   - bpo-33770(8): improve base64 exception message for encoded inputs
     of invalid length

   - bpo-33769(9): asyncio/start_tls: Fix error message; cancel
     callbacks in case of an unhandled error; mark SSLTransport as
     closed if it is aborted.

   - bpo-33767(10): The concatenation (‘+’) and repetition (‘*’)
     sequence operations now raise *note TypeError: 198. instead of
     *note SystemError: 795. when performed on *note mmap.mmap: 519.
     objects.  Patch by Zackery Spytz.

   - bpo-33734(11): asyncio/ssl: Fix AttributeError, increase default
     handshake timeout

   - bpo-11874(12): Use a better regex when breaking usage into
     wrappable parts.  Avoids bogus assertion errors from custom metavar
     strings.

   - bpo-33582(13): Emit a deprecation warning for inspect.formatargspec

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30167

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33812

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30805

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33694

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32493

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33792

   (7) https://bugs.python.org/issue?@action=redirect&bpo=33778

   (8) https://bugs.python.org/issue?@action=redirect&bpo=33770

   (9) https://bugs.python.org/issue?@action=redirect&bpo=33769

   (10) https://bugs.python.org/issue?@action=redirect&bpo=33767

   (11) https://bugs.python.org/issue?@action=redirect&bpo=33734

   (12) https://bugs.python.org/issue?@action=redirect&bpo=11874

   (13) https://bugs.python.org/issue?@action=redirect&bpo=33582


File: python.info,  Node: ドキュメント<57>,  Next: ビルド<62>,  Prev: ライブラリ<164>,  Up: Python 3 7 0 release candidate 1

1.24.64.3 ドキュメント
......................

   - bpo-33409(1): Clarified the relationship between PEP 538(2)'s
     PYTHONCOERCECLOCALE and PEP 540's PYTHONUTF8 mode.

   - bpo-33736(3): Improve the documentation of *note
     asyncio.open_connection(): d0e, *note asyncio.start_server(): d0f.
     and their UNIX socket counterparts.

   - bpo-31432(4): Clarify meaning of CERT_NONE, CERT_OPTIONAL, and
     CERT_REQUIRED flags for ssl.SSLContext.verify_mode.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33409

   (2) https://peps.python.org/pep-0538/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33736

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31432


File: python.info,  Node: ビルド<62>,  Next: Windows<56>,  Prev: ドキュメント<57>,  Up: Python 3 7 0 release candidate 1

1.24.64.4 ビルド
................

   - bpo-5755(1): Move ‘-Wstrict-prototypes’ option to ‘CFLAGS_NODIST’
     from ‘OPT’.  This option emitted annoying warnings when building
     extension modules written in C++.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5755


File: python.info,  Node: Windows<56>,  Next: IDLE<38>,  Prev: ビルド<62>,  Up: Python 3 7 0 release candidate 1

1.24.64.5 Windows
.................

   - bpo-33720(1): Reduces maximum marshal recursion depth on release
     builds.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33720


File: python.info,  Node: IDLE<38>,  Prev: Windows<56>,  Up: Python 3 7 0 release candidate 1

1.24.64.6 IDLE
..............

   - bpo-33656(1): On Windows, add API call saying that tk scales for
     DPI. On Windows 8.1+ or 10, with DPI compatibility properties of
     the Python binary unchanged, and a monitor resolution greater than
     96 DPI, this should make text and lines sharper.  It should
     otherwise have no effect.

   - bpo-33768(2): Clicking on a context line moves that line to the top
     of the editor window.

   - bpo-33763(3): IDLE: Use read-only text widget for code context
     instead of label widget.

   - bpo-33664(4): Scroll IDLE editor text by lines.  Previously, the
     mouse wheel and scrollbar slider moved text by a fixed number of
     pixels, resulting in partial lines at the top of the editor box.
     The change also applies to the shell and grep output windows, but
     not to read-only text views.

   - bpo-33679(5): Enable theme-specific color configuration for Code
     Context.  Use the Highlights tab to see the setting for built-in
     themes or add settings to custom themes.

   - bpo-33642(6): Display up to maxlines non-blank lines for Code
     Context.  If there is no current context, show a single blank line.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33656

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33768

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33763

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33664

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33679

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33642


File: python.info,  Node: Python 3 7 0 beta 5,  Next: Python 3 7 0 beta 4,  Prev: Python 3 7 0 release candidate 1,  Up: 変更履歴

1.24.65 Python 3.7.0 beta 5
---------------------------

'Release date: 2018-05-30'

* Menu:

* Core and Builtins: Core and Builtins<161>.
* ライブラリ: ライブラリ<165>.
* ドキュメント: ドキュメント<58>.
* テスト: テスト<55>.
* ビルド: ビルド<63>.
* macOS: macOS<43>.
* IDLE: IDLE<39>.


File: python.info,  Node: Core and Builtins<161>,  Next: ライブラリ<165>,  Up: Python 3 7 0 beta 5

1.24.65.1 Core and Builtins
...........................

   - bpo-33622(1): Fixed a leak when the garbage collector fails to add
     an object with the ‘__del__’ method or referenced by it into the
     *note gc.garbage: 13d9. list.  *note PyGC_Collect(): b85. can now
     be called when an exception is set and preserves it.

   - bpo-33509(2): Fix module_globals parameter of
     warnings.warn_explicit(): don't crash if module_globals is not a
     dict.

   - bpo-20104(3): The new ‘os.posix_spawn’ added in 3.7.0b1 was removed
     as we are still working on what the API should look like.  Expect
     this in 3.8 instead.

   - bpo-33475(4): Fixed miscellaneous bugs in converting annotations to
     strings and optimized parentheses in the string representation.

   - bpo-33391(5): Fix a leak in set_symmetric_difference().

   - bpo-28055(6): Fix unaligned accesses in siphash24().  Patch by Rolf
     Eike Beer.

   - bpo-32911(7): Due to unexpected compatibility issues discovered
     during downstream beta testing, reverted bpo-29463(8).  ‘docstring’
     field is removed from Module, ClassDef, FunctionDef, and
     AsyncFunctionDef ast nodes which was added in 3.7a1.  Docstring
     expression is restored as a first statement in their body.  Based
     on patch by Inada Naoki.

   - bpo-21983(9): Fix a crash in ‘ctypes.cast()’ in case the type
     argument is a ctypes structured data type.  Patch by Eryk Sun and
     Oren Milman.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33622

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33509

   (3) https://bugs.python.org/issue?@action=redirect&bpo=20104

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33475

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33391

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28055

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32911

   (8) https://bugs.python.org/issue?@action=redirect&bpo=29463

   (9) https://bugs.python.org/issue?@action=redirect&bpo=21983


File: python.info,  Node: ライブラリ<165>,  Next: ドキュメント<58>,  Prev: Core and Builtins<161>,  Up: Python 3 7 0 beta 5

1.24.65.2 ライブラリ
....................

   - bpo-32751(1): When cancelling the task due to a timeout, *note
     asyncio.wait_for(): 815. will now wait until the cancellation is
     complete.

   - bpo-32684(2): Fix gather to propagate cancellation of itself even
     with return_exceptions.

   - bpo-33654(3): Support protocol type switching in
     SSLTransport.set_protocol().

   - bpo-33674(4): Pause the transport as early as possible to further
     reduce the risk of data_received() being called before
     connection_made().

   - bpo-33674(5): Fix a race condition in SSLProtocol.connection_made()
     of asyncio.sslproto: start immediately the handshake instead of
     using call_soon().  Previously, data_received() could be called
     before the handshake started, causing the handshake to hang or
     fail.

   - bpo-31647(6): Fixed bug where calling write_eof() on a
     _SelectorSocketTransport after it's already closed raises
     AttributeError.

   - bpo-32610(7): Make asyncio.all_tasks() return only pending tasks.

   - bpo-32410(8): Avoid blocking on file IO in sendfile fallback code

   - bpo-33469(9): Fix RuntimeError after closing loop that used
     run_in_executor

   - bpo-33672(10): Fix Task.__repr__ crash with Cython's bogus
     coroutines

   - bpo-33654(11): Fix transport.set_protocol() to support switching
     between asyncio.Protocol and asyncio.BufferedProtocol.  Fix
     loop.start_tls() to work with asyncio.BufferedProtocols.

   - bpo-33652(12): Pickles of type variables and subscripted generics
     are now future-proof and compatible with older Python versions.

   - bpo-32493(13): Fixed *note uuid.uuid1(): da1. on FreeBSD.

   - bpo-33618(14): Finalize and document preliminary and experimental
     TLS 1.3 support with OpenSSL 1.1.1

   - bpo-33623(15): Fix possible SIGSGV when asyncio.Future is created
     in __del__

   - bpo-30877(16): Fixed a bug in the Python implementation of the JSON
     decoder that prevented the cache of parsed strings from clearing
     after finishing the decoding.  Based on patch by c-fos.

   - bpo-33570(17): Change TLS 1.3 cipher suite settings for
     compatibility with OpenSSL 1.1.1-pre6 and newer.  OpenSSL 1.1.1
     will have TLS 1.3 ciphers enabled by default.

   - bpo-28556(18): Do not simplify arguments to ‘typing.Union’.  Now
     ‘Union[Manager, Employee]’ is not simplified to ‘Employee’ at
     runtime.  Such simplification previously caused several bugs and
     limited possibilities for introspection.

   - bpo-33540(19): Add a new ‘block_on_close’ class attribute to
     ‘ForkingMixIn’ and ‘ThreadingMixIn’ classes of *note socketserver:
     d2.

   - bpo-33548(20): tempfile._candidate_tempdir_list should consider
     common TEMP locations

   - bpo-33109(21): argparse subparsers are once again not required by
     default, reverting the change in behavior introduced by
     bpo-26510(22) in 3.7.0a2.

   - bpo-33536(23): dataclasses.make_dataclass now checks for invalid
     field names and duplicate fields.  Also, added a check for invalid
     field specifications.

   - bpo-33542(24): Prevent ‘uuid.get_node’ from using a DUID instead of
     a MAC on Windows.  Patch by Zvi Effron

   - bpo-26819(25): Fix race condition with
     ‘ReadTransport.resume_reading’ in Windows proactor event loop.

   - Fix failure in ‘typing.get_type_hints()’ when ClassVar was provided
     as a string forward reference.

   - bpo-33505(26): Optimize asyncio.ensure_future() by reordering if
     checks: 1.17x faster.

   - bpo-33497(27): Add errors param to cgi.parse_multipart and make an
     encoding in FieldStorage use the given errors (needed for Twisted).
     Patch by Amber Brown.

   - bpo-33495(28): Change dataclasses.Fields repr to use the repr of
     each of its members, instead of str.  This makes it more clear what
     each field actually represents.  This is especially true for the
     'type' member.

   - bpo-33453(29): Fix dataclasses to work if using literal string type
     annotations or if using PEP 563 "Postponed Evaluation of
     Annotations".  Only specific string prefixes are detected for both
     ClassVar ("ClassVar" and "typing.ClassVar") and InitVar ("InitVar"
     and "dataclasses.InitVar").

   - bpo-28556(30): Minor fixes in typing module: add annotations to
     ‘NamedTuple.__new__’, pass ‘*args’ and ‘**kwds’ in
     ‘Generic.__new__’.  Original PRs by Paulius Šarka and Chad
     Dombrova.

   - bpo-20087(31): Updated alias mapping with glibc 2.27 supported
     locales.

   - bpo-33422(32): Fix trailing quotation marks getting deleted when
     looking up byte/string literals on pydoc.  Patch by Andrés Delfino.

   - bpo-28167(33): The function ‘platform.linux_distribution’ and
     ‘platform.dist’ now trigger a ‘DeprecationWarning’ and have been
     marked for removal in Python 3.8

   - bpo-33197(34): Update error message when constructing invalid
     inspect.Parameters Patch by Donghee Na.

   - bpo-33263(35): Fix FD leak in ‘_SelectorSocketTransport’ Patch by
     Vlad Starostin.

   - bpo-32861(36): The urllib.robotparser's ‘__str__’ representation
     now includes wildcard entries and the "Crawl-delay" and
     "Request-rate" fields.  Patch by Michael Lazar.

   - bpo-32257(37): The ssl module now contains OP_NO_RENEGOTIATION
     constant, available with OpenSSL 1.1.0h or 1.1.1.

   - bpo-16865(38): Support arrays >=2GiB in *note ctypes: 2e.  Patch by
     Segev Finer.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32751

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32684

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33654

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33674

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33674

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31647

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32610

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32410

   (9) https://bugs.python.org/issue?@action=redirect&bpo=33469

   (10) https://bugs.python.org/issue?@action=redirect&bpo=33672

   (11) https://bugs.python.org/issue?@action=redirect&bpo=33654

   (12) https://bugs.python.org/issue?@action=redirect&bpo=33652

   (13) https://bugs.python.org/issue?@action=redirect&bpo=32493

   (14) https://bugs.python.org/issue?@action=redirect&bpo=33618

   (15) https://bugs.python.org/issue?@action=redirect&bpo=33623

   (16) https://bugs.python.org/issue?@action=redirect&bpo=30877

   (17) https://bugs.python.org/issue?@action=redirect&bpo=33570

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (19) https://bugs.python.org/issue?@action=redirect&bpo=33540

   (20) https://bugs.python.org/issue?@action=redirect&bpo=33548

   (21) https://bugs.python.org/issue?@action=redirect&bpo=33109

   (22) https://bugs.python.org/issue?@action=redirect&bpo=26510

   (23) https://bugs.python.org/issue?@action=redirect&bpo=33536

   (24) https://bugs.python.org/issue?@action=redirect&bpo=33542

   (25) https://bugs.python.org/issue?@action=redirect&bpo=26819

   (26) https://bugs.python.org/issue?@action=redirect&bpo=33505

   (27) https://bugs.python.org/issue?@action=redirect&bpo=33497

   (28) https://bugs.python.org/issue?@action=redirect&bpo=33495

   (29) https://bugs.python.org/issue?@action=redirect&bpo=33453

   (30) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (31) https://bugs.python.org/issue?@action=redirect&bpo=20087

   (32) https://bugs.python.org/issue?@action=redirect&bpo=33422

   (33) https://bugs.python.org/issue?@action=redirect&bpo=28167

   (34) https://bugs.python.org/issue?@action=redirect&bpo=33197

   (35) https://bugs.python.org/issue?@action=redirect&bpo=33263

   (36) https://bugs.python.org/issue?@action=redirect&bpo=32861

   (37) https://bugs.python.org/issue?@action=redirect&bpo=32257

   (38) https://bugs.python.org/issue?@action=redirect&bpo=16865


File: python.info,  Node: ドキュメント<58>,  Next: テスト<55>,  Prev: ライブラリ<165>,  Up: Python 3 7 0 beta 5

1.24.65.3 ドキュメント
......................

   - bpo-23859(1): Document that ‘asyncio.wait()’ does not cancel its
     futures on timeout.

   - bpo-32436(2): Document PEP 567(3) changes to asyncio.

   - bpo-33604(4): Update HMAC md5 default to a DeprecationWarning, bump
     removal to 3.8.

   - bpo-33503(5): Fix broken pypi link

   - bpo-33421(6): Add missing documentation for
     ‘typing.AsyncContextManager’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23859

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32436

   (3) https://peps.python.org/pep-0567/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33604

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33503

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33421


File: python.info,  Node: テスト<55>,  Next: ビルド<63>,  Prev: ドキュメント<58>,  Up: Python 3 7 0 beta 5

1.24.65.4 テスト
................

   - bpo-33655(1): Ignore test_posix_fallocate failures on BSD platforms
     that might be due to running on ZFS.

   - bpo-32604(2): Remove the _xxsubinterpreters module (meant for
     testing) and associated helpers.  This module was originally added
     recently in 3.7b1.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33655

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32604


File: python.info,  Node: ビルド<63>,  Next: macOS<43>,  Prev: テスト<55>,  Up: Python 3 7 0 beta 5

1.24.65.5 ビルド
................

   - bpo-33614(1): Ensures module definition files for the stable ABI on
     Windows are correctly regenerated.

   - bpo-33522(2): Enable CI builds on Visual Studio Team Services at
     ‘https://python.visualstudio.com/cpython’

   - bpo-33012(3): Add ‘-Wno-cast-function-type’ for gcc 8 for silencing
     warnings about function casts like casting to PyCFunction in method
     definition lists.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33614

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33522

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33012


File: python.info,  Node: macOS<43>,  Next: IDLE<39>,  Prev: ビルド<63>,  Up: Python 3 7 0 beta 5

1.24.65.6 macOS
...............

   - bpo-13631(1): The .editrc file in user's home directory is now
     processed correctly during the readline initialization through
     editline emulation on macOS.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13631


File: python.info,  Node: IDLE<39>,  Prev: macOS<43>,  Up: Python 3 7 0 beta 5

1.24.65.7 IDLE
..............

   - bpo-33628(1): IDLE: Cleanup codecontext.py and its test.

   - bpo-33564(2): IDLE's code context now recognizes async as a block
     opener.

   - bpo-32831(3): Add docstrings and tests for codecontext.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33628

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33564

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32831


File: python.info,  Node: Python 3 7 0 beta 4,  Next: Python 3 7 0 beta 3,  Prev: Python 3 7 0 beta 5,  Up: 変更履歴

1.24.66 Python 3.7.0 beta 4
---------------------------

'Release date: 2018-05-02'

* Menu:

* Core and Builtins: Core and Builtins<162>.
* ライブラリ: ライブラリ<166>.
* ドキュメント: ドキュメント<59>.
* テスト: テスト<56>.
* ビルド: ビルド<64>.
* Windows: Windows<57>.
* macOS: macOS<44>.
* IDLE: IDLE<40>.
* Tools/Demos: Tools/Demos<38>.


File: python.info,  Node: Core and Builtins<162>,  Next: ライブラリ<166>,  Up: Python 3 7 0 beta 4

1.24.66.1 Core and Builtins
...........................

   - bpo-33363(1): Raise a SyntaxError for ‘async with’ and ‘async for’
     statements outside of async functions.

   - bpo-33128(2): Fix a bug that causes PathFinder to appear twice on
     sys.meta_path.  Patch by Pablo Galindo Salgado.

   - bpo-33312(3): Fixed clang ubsan (undefined behavior sanitizer)
     warnings in dictobject.c by adjusting how the internal struct
     _dictkeysobject shared keys structure is declared.

   - bpo-33231(4): Fix potential memory leak in ‘normalizestring()’.

   - bpo-33205(5): Change dict growth function from
     ‘round_up_to_power_2(used*2+hashtable_size/2)’ to
     ‘round_up_to_power_2(used*3)’.  Previously, dict is shrunk only
     when ‘used == 0’.  Now dict has more chance to be shrunk.

   - bpo-29922(6): Improved error messages in 'async with' when
     ‘__aenter__()’ or ‘__aexit__()’ return non-awaitable object.

   - bpo-33199(7): Fix ‘ma_version_tag’ in dict implementation is
     uninitialized when copying from key-sharing dict.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33363

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33128

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33312

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33231

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33205

   (6) https://bugs.python.org/issue?@action=redirect&bpo=29922

   (7) https://bugs.python.org/issue?@action=redirect&bpo=33199


File: python.info,  Node: ライブラリ<166>,  Next: ドキュメント<59>,  Prev: Core and Builtins<162>,  Up: Python 3 7 0 beta 4

1.24.66.2 ライブラリ
....................

   - bpo-33281(1): Fix ctypes.util.find_library regression on macOS.

   - bpo-33383(2): Fixed crash in the get() method of the *note
     dbm.ndbm: 38. database object when it is called with a single
     argument.

   - bpo-33329(3): Fix multiprocessing regression on newer glibcs

   - bpo-991266(4): Fix quoting of the ‘Comment’ attribute of *note
     http.cookies.SimpleCookie: 1e24.

   - bpo-33131(5): Upgrade bundled version of pip to 10.0.1.

   - bpo-33308(6): Fixed a crash in the ‘parser’ module when converting
     an ST object to a tree of tuples or lists with ‘line_info=False’
     and ‘col_info=True’.

   - bpo-33266(7): lib2to3 now recognizes ‘rf'...'’ strings.

   - bpo-11594(8): Ensure line-endings are respected when using lib2to3.

   - bpo-33254(9): Have *note importlib.resources.contents(): 503. and
     ‘importlib.abc.ResourceReader.contents()’ return an *note iterable:
     12f1. instead of an *note iterator: 4c8.

   - bpo-33256(10): Fix display of ‘<module>’ call in the html produced
     by ‘cgitb.html()’.  Patch by Stéphane Blondon.

   - bpo-33185(11): Fixed regression when running pydoc with the *note
     -m: 23c. switch.  (The regression was introduced in 3.7.0b3 by the
     resolution of bpo-33053(12)) This fix also changed pydoc to add
     ‘os.getcwd()’ to *note sys.path: 3e4. when necessary, rather than
     adding ‘"."’.

   - bpo-33169(13): Delete entries of ‘None’ in *note
     sys.path_importer_cache: 7fa. when
     ‘importlib.machinery.invalidate_caches()’ is called.

   - bpo-33217(14): Deprecate looking up non-Enum objects in Enum
     classes and Enum members (will raise *note TypeError: 198. in
     3.8+).

   - bpo-33203(15): ‘random.Random.choice()’ now raises ‘IndexError’ for
     empty sequences consistently even when called from subclasses
     without a ‘getrandbits()’ implementation.

   - bpo-33224(16): Update difflib.mdiff() for PEP 479(17).  Convert an
     uncaught StopIteration in a generator into a return-statement.

   - bpo-33209(18): End framing at the end of C implementation of *note
     pickle.Pickler.dump(): 1e25.

   - bpo-20104(19): Improved error handling and fixed a reference leak
     in *note os.posix_spawn(): 52e.

   - bpo-33175(20): In dataclasses, Field.__set_name__ now looks up the
     __set_name__ special method on the class, not the instance, of the
     default value.

   - bpo-33097(21): Raise RuntimeError when ‘executor.submit’ is called
     during interpreter shutdown.

   - bpo-31908(22): Fix output of cover files for ‘trace’ module
     command-line tool.  Previously emitted cover files only when
     ‘--missing’ option was used.  Patch by Michael Selik.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33281

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33383

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33329

   (4) https://bugs.python.org/issue?@action=redirect&bpo=991266

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33131

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33308

   (7) https://bugs.python.org/issue?@action=redirect&bpo=33266

   (8) https://bugs.python.org/issue?@action=redirect&bpo=11594

   (9) https://bugs.python.org/issue?@action=redirect&bpo=33254

   (10) https://bugs.python.org/issue?@action=redirect&bpo=33256

   (11) https://bugs.python.org/issue?@action=redirect&bpo=33185

   (12) https://bugs.python.org/issue?@action=redirect&bpo=33053

   (13) https://bugs.python.org/issue?@action=redirect&bpo=33169

   (14) https://bugs.python.org/issue?@action=redirect&bpo=33217

   (15) https://bugs.python.org/issue?@action=redirect&bpo=33203

   (16) https://bugs.python.org/issue?@action=redirect&bpo=33224

   (17) https://peps.python.org/pep-0479/

   (18) https://bugs.python.org/issue?@action=redirect&bpo=33209

   (19) https://bugs.python.org/issue?@action=redirect&bpo=20104

   (20) https://bugs.python.org/issue?@action=redirect&bpo=33175

   (21) https://bugs.python.org/issue?@action=redirect&bpo=33097

   (22) https://bugs.python.org/issue?@action=redirect&bpo=31908


File: python.info,  Node: ドキュメント<59>,  Next: テスト<56>,  Prev: ライブラリ<166>,  Up: Python 3 7 0 beta 4

1.24.66.3 ドキュメント
......................

   - bpo-33378(1): Add Korean language switcher for
     ‘https://docs.python.org/3/’

   - bpo-33276(2): Clarify that the ‘__path__’ attribute on modules
     cannot be just any value.

   - bpo-33201(3): Modernize documentation for writing C extension
     types.

   - bpo-33195(4): Deprecate ‘Py_UNICODE’ usage in ‘c-api/arg’ document.
     ‘Py_UNICODE’ related APIs are deprecated since Python 3.3, but it
     is missed in the document.

   - bpo-8243(5): Add a note about curses.addch and curses.addstr
     exception behavior when writing outside a window, or pad.

   - bpo-32337(6): Update documentation related with ‘dict’ order.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33378

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33276

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33201

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33195

   (5) https://bugs.python.org/issue?@action=redirect&bpo=8243

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32337


File: python.info,  Node: テスト<56>,  Next: ビルド<64>,  Prev: ドキュメント<59>,  Up: Python 3 7 0 beta 4

1.24.66.4 テスト
................

   - bpo-33358(1): Fix
     ‘test_embed.test_pre_initialization_sys_options()’ when the
     interpreter is built with ‘--enable-shared’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33358


File: python.info,  Node: ビルド<64>,  Next: Windows<57>,  Prev: テスト<56>,  Up: Python 3 7 0 beta 4

1.24.66.5 ビルド
................

   - bpo-33394(1): Enable the verbose build for extension modules, when
     GNU make is passed macros on the command line.

   - bpo-33393(2): Update config.guess and config.sub files.

   - bpo-33377(3): Add new triplets for mips r6 and riscv variants (used
     in extension suffixes).

   - bpo-32232(4): By default, modules configured in ‘Modules/Setup’ are
     no longer built with ‘-DPy_BUILD_CORE’.  Instead, modules that
     specifically need that preprocessor definition include it in their
     individual entries.

   - bpo-33182(5): The embedding tests can once again be built with
     clang 6.0

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33394

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33393

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33377

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32232

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33182


File: python.info,  Node: Windows<57>,  Next: macOS<44>,  Prev: ビルド<64>,  Up: Python 3 7 0 beta 4

1.24.66.6 Windows
.................

   - bpo-33184(1): Update Windows installer to use OpenSSL 1.1.0h.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33184


File: python.info,  Node: macOS<44>,  Next: IDLE<40>,  Prev: Windows<57>,  Up: Python 3 7 0 beta 4

1.24.66.7 macOS
...............

   - bpo-33184(1): Update macOS installer build to use OpenSSL 1.1.0h.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33184


File: python.info,  Node: IDLE<40>,  Next: Tools/Demos<38>,  Prev: macOS<44>,  Up: Python 3 7 0 beta 4

1.24.66.8 IDLE
..............

   - bpo-21474(1): Update word/identifier definition from ascii to
     unicode.  In text and entry boxes, this affects selection by
     double-click, movement left/right by control-left/right, and
     deletion left/right by control-BACKSPACE/DEL.

   - bpo-33204(2): IDLE: consistently color invalid string prefixes.  A
     'u' string prefix cannot be paired with either 'r' or 'f'.
     Consistently color as much of the prefix, starting at the right, as
     is valid.  Revise and extend colorizer test.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21474

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33204


File: python.info,  Node: Tools/Demos<38>,  Prev: IDLE<40>,  Up: Python 3 7 0 beta 4

1.24.66.9 Tools/Demos
.....................

   - bpo-33189(1): ‘pygettext.py’ now recognizes only literal strings as
     docstrings and translatable strings, and rejects bytes literals and
     f-string expressions.

   - bpo-31920(2): Fixed handling directories as arguments in the
     ‘pygettext’ script.  Based on patch by Oleg Krasnikov.

   - bpo-29673(3): Fix pystackv and pystack gdbinit macros.

   - bpo-31583(4): Fix 2to3 for using with -add-suffix option but
     without -output-dir option for relative path to files in current
     directory.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33189

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31920

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29673

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31583


File: python.info,  Node: Python 3 7 0 beta 3,  Next: Python 3 7 0 beta 2,  Prev: Python 3 7 0 beta 4,  Up: 変更履歴

1.24.67 Python 3.7.0 beta 3
---------------------------

'Release date: 2018-03-29'

* Menu:

* セキュリティ: セキュリティ<47>.
* Core and Builtins: Core and Builtins<163>.
* ライブラリ: ライブラリ<167>.
* ドキュメント: ドキュメント<60>.
* テスト: テスト<57>.
* ビルド: ビルド<65>.
* Windows: Windows<58>.
* macOS: macOS<45>.
* IDLE: IDLE<41>.
* Tools/Demos: Tools/Demos<39>.
* C API: C API<58>.


File: python.info,  Node: セキュリティ<47>,  Next: Core and Builtins<163>,  Up: Python 3 7 0 beta 3

1.24.67.1 セキュリティ
......................

   - bpo-33136(1): Harden ssl module against LibreSSL CVE 2018-8970(2).
     X509_VERIFY_PARAM_set1_host() is called with an explicit namelen.
     A new test ensures that NULL bytes are not allowed.

   - bpo-33001(3): Minimal fix to prevent buffer overrun in os.symlink
     on Windows

   - bpo-32981(4): Regexes in difflib and poplib were vulnerable to
     catastrophic backtracking.  These regexes formed potential DOS
     vectors (REDOS). They have been refactored.  This resolves CVE
     2018-1060(5) and CVE 2018-1061(6).  Patch by Jamie Davis.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33136

   (2) https://www.cve.org/CVERecord?id=CVE-2018-8970

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33001

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32981

   (5) https://www.cve.org/CVERecord?id=CVE-2018-1060

   (6) https://www.cve.org/CVERecord?id=CVE-2018-1061


File: python.info,  Node: Core and Builtins<163>,  Next: ライブラリ<167>,  Prev: セキュリティ<47>,  Up: Python 3 7 0 beta 3

1.24.67.2 Core and Builtins
...........................

   - bpo-33053(1): When using the -m switch, sys.path[0] is now
     explicitly expanded as the 'starting' working directory, rather
     than being left as the empty path (which allows imports from the
     current working directory at the time of the import)

   - bpo-33018(2): Improve consistency of errors raised by
     ‘issubclass()’ when called with a non-class and an abstract base
     class as the first and second arguments, respectively.  Patch by
     Josh Bronson.

   - bpo-33041(3): Fixed jumping when the function contains an ‘async
     for’ loop.

   - bpo-33026(4): Fixed jumping out of "with" block by setting
     f_lineno.

   - bpo-33005(5): Fix a crash on fork when using a custom memory
     allocator (ex: using PYTHONMALLOC env var).  _PyGILState_Reinit()
     and _PyInterpreterState_Enable() now use the default RAW memory
     allocator to allocate a new interpreters mutex on fork.

   - bpo-17288(6): Prevent jumps from 'return' and 'exception' trace
     events.

   - bpo-32836(7): Don't use temporary variables in cases of
     list/dict/set comprehensions

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33053

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33018

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33041

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33026

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33005

   (6) https://bugs.python.org/issue?@action=redirect&bpo=17288

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32836


File: python.info,  Node: ライブラリ<167>,  Next: ドキュメント<60>,  Prev: Core and Builtins<163>,  Up: Python 3 7 0 beta 3

1.24.67.3 ライブラリ
....................

   - bpo-33141(1): Have Field objects pass through __set_name__ to their
     default values, if they have their own __set_name__.

   - bpo-33096(2): Allow ttk.Treeview.insert to insert iid that has a
     false boolean value.  Note iid=0 and iid=False would be same.
     Patch by Garvit Khatri.

   - bpo-32873(3): Treat type variables and special typing forms as
     immutable by copy and pickle.  This fixes several minor issues and
     inconsistencies, and improves backwards compatibility with Python
     3.6.

   - bpo-33134(4): When computing dataclass's __hash__, use the lookup
     table to contain the function which returns the __hash__ value.
     This is an improvement over looking up a string, and then testing
     that string to see what to do.

   - bpo-33127(5): The ssl module now compiles with LibreSSL 2.7.1.

   - bpo-32505(6): Raise TypeError if a member variable of a dataclass
     is of type Field, but doesn't have a type annotation.

   - bpo-33078(7): Fix the failure on OSX caused by the tests relying on
     sem_getvalue

   - bpo-33116(8): Add 'Field' to dataclasses.__all__.

   - bpo-32896(9): Fix an error where subclassing a dataclass with a
     field that uses a default_factory would generate an incorrect
     class.

   - bpo-33100(10): Dataclasses: If a field has a default value that's a
     MemberDescriptorType, then it's from that field being in __slots__,
     not an actual default value.

   - bpo-32953(11): If a non-dataclass inherits from a frozen dataclass,
     allow attributes to be added to the derived class.  Only attributes
     from the frozen dataclass cannot be assigned to.  Require all
     dataclasses in a hierarchy to be either all frozen or all
     non-frozen.

   - bpo-33061(12): Add missing ‘NoReturn’ to ‘__all__’ in typing.py

   - bpo-33078(13): Fix the size handling in multiprocessing.Queue when
     a pickling error occurs.

   - bpo-33064(14): lib2to3 now properly supports trailing commas after
     ‘*args’ and ‘**kwargs’ in function signatures.

   - bpo-33056(15): FIX properly close leaking fds in
     concurrent.futures.ProcessPoolExecutor.

   - bpo-33021(16): Release the GIL during fstat() calls, avoiding hang
     of all threads when calling mmap.mmap(), os.urandom(), and
     random.seed().  Patch by Nir Soffer.

   - bpo-31804(17): Avoid failing in multiprocessing.Process if the
     standard streams are closed or None at exit.

   - bpo-33037(18): Skip sending/receiving data after SSL transport
     closing.

   - bpo-27683(19): Fix a regression in *note ipaddress: 84. that result
     of ‘hosts()’ is empty when the network is constructed by a tuple
     containing an integer mask and only 1 bit left for addresses.

   - bpo-32999(20): Fix C implementation of ‘ABC.__subclasscheck__(cls,
     subclass)’ crashed when ‘subclass’ is not a type object.

   - bpo-33009(21): Fix inspect.signature() for single-parameter
     partialmethods.

   - bpo-32969(22): Expose several missing constants in zlib and fix
     corresponding documentation.

   - bpo-32056(23): Improved exceptions raised for invalid number of
     channels and sample width when read an audio file in modules
     ‘aifc’, *note wave: 119. and ‘sunau’.

   - bpo-32844(24): Fix wrong redirection of a low descriptor (0 or 1)
     to stderr in subprocess if another low descriptor is closed.

   - bpo-32857(25): In *note tkinter: f6, ‘after_cancel(None)’ now
     raises a *note ValueError: 2ec. instead of canceling the first
     scheduled function.  Patch by Cheryl Sabella.

   - bpo-31639(26): http.server now exposes a ThreadedHTTPServer class
     and uses it when the module is run with ‘-m’ to cope with web
     browsers pre-opening sockets.

   - bpo-27645(27): *note sqlite3.Connection: 54d. now exposes a *note
     backup: d73. method, if the underlying SQLite library is at version
     3.6.11 or higher.  Patch by Lele Gaifax.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33141

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33096

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32873

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33134

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33127

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32505

   (7) https://bugs.python.org/issue?@action=redirect&bpo=33078

   (8) https://bugs.python.org/issue?@action=redirect&bpo=33116

   (9) https://bugs.python.org/issue?@action=redirect&bpo=32896

   (10) https://bugs.python.org/issue?@action=redirect&bpo=33100

   (11) https://bugs.python.org/issue?@action=redirect&bpo=32953

   (12) https://bugs.python.org/issue?@action=redirect&bpo=33061

   (13) https://bugs.python.org/issue?@action=redirect&bpo=33078

   (14) https://bugs.python.org/issue?@action=redirect&bpo=33064

   (15) https://bugs.python.org/issue?@action=redirect&bpo=33056

   (16) https://bugs.python.org/issue?@action=redirect&bpo=33021

   (17) https://bugs.python.org/issue?@action=redirect&bpo=31804

   (18) https://bugs.python.org/issue?@action=redirect&bpo=33037

   (19) https://bugs.python.org/issue?@action=redirect&bpo=27683

   (20) https://bugs.python.org/issue?@action=redirect&bpo=32999

   (21) https://bugs.python.org/issue?@action=redirect&bpo=33009

   (22) https://bugs.python.org/issue?@action=redirect&bpo=32969

   (23) https://bugs.python.org/issue?@action=redirect&bpo=32056

   (24) https://bugs.python.org/issue?@action=redirect&bpo=32844

   (25) https://bugs.python.org/issue?@action=redirect&bpo=32857

   (26) https://bugs.python.org/issue?@action=redirect&bpo=31639

   (27) https://bugs.python.org/issue?@action=redirect&bpo=27645


File: python.info,  Node: ドキュメント<60>,  Next: テスト<57>,  Prev: ライブラリ<167>,  Up: Python 3 7 0 beta 3

1.24.67.4 ドキュメント
......................

   - bpo-33126(1): Document PyBuffer_ToContiguous().

   - bpo-27212(2): Modify documentation for the ‘islice()’ recipe to
     consume initial values up to the start index.

   - bpo-28247(3): Update *note zipapp: 136. documentation to describe
     how to make standalone applications.

   - bpo-18802(4): Documentation changes for ipaddress.  Patch by Jon
     Foster and Berker Peksag.

   - bpo-27428(5): Update documentation to clarify that
     ‘WindowsRegistryFinder’ implements ‘MetaPathFinder’.  (Patch by
     Himanshu Lakhara)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33126

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27212

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28247

   (4) https://bugs.python.org/issue?@action=redirect&bpo=18802

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27428


File: python.info,  Node: テスト<57>,  Next: ビルド<65>,  Prev: ドキュメント<60>,  Up: Python 3 7 0 beta 3

1.24.67.5 テスト
................

   - bpo-32872(1): Avoid regrtest compatibility issue with namespace
     packages.

   - bpo-32517(2): Fix failing ‘test_asyncio’ on macOS 10.12.2+ due to
     transport of ‘KqueueSelector’ loop was not being closed.

   - bpo-19417(3): Add test_bdb.py.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32872

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32517

   (3) https://bugs.python.org/issue?@action=redirect&bpo=19417


File: python.info,  Node: ビルド<65>,  Next: Windows<58>,  Prev: テスト<57>,  Up: Python 3 7 0 beta 3

1.24.67.6 ビルド
................

   - bpo-33163(1): Upgrade pip to 9.0.3 and setuptools to v39.0.1.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33163


File: python.info,  Node: Windows<58>,  Next: macOS<45>,  Prev: ビルド<65>,  Up: Python 3 7 0 beta 3

1.24.67.7 Windows
.................

   - bpo-33016(1): Fix potential use of uninitialized memory in
     nt._getfinalpathname

   - bpo-32903(2): Fix a memory leak in os.chdir() on Windows if the
     current directory is set to a UNC path.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33016

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32903


File: python.info,  Node: macOS<45>,  Next: IDLE<41>,  Prev: Windows<58>,  Up: Python 3 7 0 beta 3

1.24.67.8 macOS
...............

   - bpo-32726(1): Build and link with private copy of Tcl/Tk 8.6 for
     the macOS 10.6+ installer.  The 10.9+ installer variant already
     does this.  This means that the Python 3.7 provided by the
     python.org macOS installers no longer need or use any external
     versions of Tcl/Tk, either system-provided or user-installed, such
     as ActiveTcl.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32726


File: python.info,  Node: IDLE<41>,  Next: Tools/Demos<39>,  Prev: macOS<45>,  Up: Python 3 7 0 beta 3

1.24.67.9 IDLE
..............

   - bpo-32984(1): Set ‘__file__’ while running a startup file.  Like
     Python, IDLE optionally runs one startup file in the Shell window
     before presenting the first interactive input prompt.  For IDLE,
     ‘-s’ runs a file named in environmental variable ‘IDLESTARTUP’ or
     *note PYTHONSTARTUP: 1b8.; ‘-r file’ runs ‘file’.  Python sets
     ‘__file__’ to the startup file name before running the file and
     unsets it before the first prompt.  IDLE now does the same when run
     normally, without the ‘-n’ option.

   - bpo-32940(2): Simplify and rename StringTranslatePseudoMapping in
     pyparse.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32984

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32940


File: python.info,  Node: Tools/Demos<39>,  Next: C API<58>,  Prev: IDLE<41>,  Up: Python 3 7 0 beta 3

1.24.67.10 Tools/Demos
......................

   - bpo-32885(1): Add an ‘-n’ flag for ‘Tools/scripts/pathfix.py’ to
     disable automatic backup creation (files with ‘~’ suffix).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32885


File: python.info,  Node: C API<58>,  Prev: Tools/Demos<39>,  Up: Python 3 7 0 beta 3

1.24.67.11 C API
................

   - bpo-33042(1): Embedding applications may once again call
     PySys_ResetWarnOptions, PySys_AddWarnOption, and PySys_AddXOption
     prior to calling Py_Initialize.

   - bpo-32374(2): Document that m_traverse for multi-phase initialized
     modules can be called with m_state=NULL, and add a sanity check

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33042

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32374


File: python.info,  Node: Python 3 7 0 beta 2,  Next: Python 3 7 0 beta 1,  Prev: Python 3 7 0 beta 3,  Up: 変更履歴

1.24.68 Python 3.7.0 beta 2
---------------------------

'Release date: 2018-02-27'

* Menu:

* セキュリティ: セキュリティ<48>.
* Core and Builtins: Core and Builtins<164>.
* ライブラリ: ライブラリ<168>.
* ドキュメント: ドキュメント<61>.
* テスト: テスト<58>.
* ビルド: ビルド<66>.
* Windows: Windows<59>.
* macOS: macOS<46>.
* IDLE: IDLE<42>.
* Tools/Demos: Tools/Demos<40>.


File: python.info,  Node: セキュリティ<48>,  Next: Core and Builtins<164>,  Up: Python 3 7 0 beta 2

1.24.68.1 セキュリティ
......................

   - bpo-28414(1): The ssl module now allows users to perform their own
     IDN en/decoding when using SNI.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28414


File: python.info,  Node: Core and Builtins<164>,  Next: ライブラリ<168>,  Prev: セキュリティ<48>,  Up: Python 3 7 0 beta 2

1.24.68.2 Core and Builtins
...........................

   - bpo-32889(1): Update Valgrind suppression list to account for the
     rename of ‘Py_ADDRESS_IN_RANG’ to ‘address_in_range’.

   - bpo-31356(2): Remove the new API added in bpo-31356(3)
     (gc.ensure_disabled() context manager).

   - bpo-32305(4): For namespace packages, ensure that both ‘__file__’
     and ‘__spec__.origin’ are set to None.

   - bpo-32303(5): Make sure ‘__spec__.loader’ matches ‘__loader__’ for
     namespace packages.

   - bpo-32711(6): Fix the warning messages for Python/ast_unparse.c.
     Patch by Stéphane Wirtel

   - bpo-32583(7): Fix possible crashing in builtin Unicode decoders
     caused by write out-of-bound errors when using customized decode
     error handlers.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32889

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31356

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31356

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32305

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32303

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32711

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32583


File: python.info,  Node: ライブラリ<168>,  Next: ドキュメント<61>,  Prev: Core and Builtins<164>,  Up: Python 3 7 0 beta 2

1.24.68.3 ライブラリ
....................

   - bpo-32960(1): For dataclasses, disallow inheriting frozen from
     non-frozen classes, and also disallow inheriting non-frozen from
     frozen classes.  This restriction will be relaxed at a future date.

   - bpo-32713(2): Fixed tarfile.itn handling of out-of-bounds float
     values.  Patch by Joffrey Fuhrer.

   - bpo-32951(3): Direct instantiation of SSLSocket and SSLObject
     objects is now prohibited.  The constructors were never documented,
     tested, or designed as public constructors.  Users were suppose to
     use ssl.wrap_socket() or SSLContext.

   - bpo-32929(4): Remove the tri-state parameter "hash", and add the
     boolean "unsafe_hash".  If unsafe_hash is True, add a __hash__
     function, but if a __hash__ exists, raise TypeError.  If
     unsafe_hash is False, add a __hash__ based on the values of eq= and
     frozen=.  The unsafe_hash=False behavior is the same as the old
     hash=None behavior.  unsafe_hash=False is the default, just as
     hash=None used to be.

   - bpo-32947(5): Add OP_ENABLE_MIDDLEBOX_COMPAT and test workaround
     for TLSv1.3 for future compatibility with OpenSSL 1.1.1.

   - bpo-30622(6): The ssl module now detects missing NPN support in
     LibreSSL.

   - bpo-32922(7): dbm.open() now encodes filename with the filesystem
     encoding rather than default encoding.

   - bpo-32859(8): In ‘os.dup2’, don't check every call whether the
     ‘dup3’ syscall exists or not.

   - bpo-32556(9): nt._getfinalpathname, nt._getvolumepathname and
     nt._getdiskusage now correctly convert from bytes.

   - bpo-25988(10): Emit a *note DeprecationWarning: 1a3. when using or
     importing an ABC directly from *note collections: 1e. rather than
     from *note collections.abc: 1f.

   - bpo-21060(11): Rewrite confusing message from setup.py upload from
     "No dist file created in earlier command" to the more helpful "Must
     create and upload files in one command".

   - bpo-32852(12): Make sure sys.argv remains as a list when running
     trace.

   - bpo-31333(13): ‘_abc’ module is added.  It is a speedup module with
     C implementations for various functions and methods in ‘abc’.
     Creating an ABC subclass and calling ‘isinstance’ or ‘issubclass’
     with an ABC subclass are up to 1.5x faster.  In addition, this
     makes Python start-up up to 10% faster.  Note that the new
     implementation hides internal registry and caches, previously
     accessible via private attributes ‘_abc_registry’, ‘_abc_cache’,
     and ‘_abc_negative_cache’.  There are three debugging helper
     methods that can be used instead ‘_dump_registry’,
     ‘_abc_registry_clear’, and ‘_abc_caches_clear’.

   - bpo-32841(14): Fixed ‘asyncio.Condition’ issue which silently
     ignored cancellation after notifying and cancelling a conditional
     lock.  Patch by Bar Harel.

   - bpo-32819(15): ssl.match_hostname() has been simplified and no
     longer depends on re and ipaddress module for wildcard and IP
     addresses.  Error reporting for invalid wildcards has been
     improved.

   - bpo-32394(16): socket: Remove
     TCP_FASTOPEN,TCP_KEEPCNT,TCP_KEEPIDLE,TCP_KEEPINTVL flags on older
     version Windows during run-time.

   - bpo-31787(17): Fixed refleaks of ‘__init__()’ methods in various
     modules.  (Contributed by Oren Milman)

   - bpo-30157(18): Fixed guessing quote and delimiter in
     csv.Sniffer.sniff() when only the last field is quoted.  Patch by
     Jake Davis.

   - bpo-32792(19): collections.ChainMap() preserves the order of the
     underlying mappings.

   - bpo-32775(20): *note fnmatch.translate(): 184f. no longer produces
     patterns which contain set operations.  Sets starting with '[' or
     containing '-', '&&', '~~' or '||' will be interpreted differently
     in regular expressions in future versions.  Currently they emit
     warnings.  fnmatch.translate() now avoids producing patterns
     containing such sets by accident.

   - bpo-32622(21): Implement native fast sendfile for Windows proactor
     event loop.

   - bpo-32777(22): Fix a rare but potential pre-exec child process
     deadlock in subprocess on POSIX systems when marking file
     descriptors inheritable on exec in the child process.  This bug
     appears to have been introduced in 3.4.

   - bpo-32647(23): The ctypes module used to depend on indirect linking
     for dlopen.  The shared extension is now explicitly linked against
     libdl on platforms with dl.

   - bpo-32741(24): Implement ‘asyncio.TimerHandle.when()’ method.

   - bpo-32691(25): Use mod_spec.parent when running modules with pdb

   - bpo-32734(26): Fixed ‘asyncio.Lock()’ safety issue which allowed
     acquiring and locking the same lock multiple times, without it
     being free.  Patch by Bar Harel.

   - bpo-32727(27): Do not include name field in SMTP envelope from
     address.  Patch by Stéphane Wirtel

   - bpo-31453(28): Add TLSVersion constants and
     SSLContext.maximum_version / minimum_version attributes.  The new
     API wraps OpenSSL 1.1
     ‘https://web.archive.org/web/20180309043602/https://www.openssl.org/docs/man1.1.0/ssl/SSL_CTX_set_min_proto_version.html’
     feature.

   - bpo-24334(29): Internal implementation details of ssl module were
     cleaned up.  The SSLSocket has one less layer of indirection.
     Owner and session information are now handled by the SSLSocket and
     SSLObject constructor.  Channel binding implementation has been
     simplified.

   - bpo-31848(30): Fix the error handling in Aifc_read.initfp() when
     the SSND chunk is not found.  Patch by Zackery Spytz.

   - bpo-32585(31): Add Ttk spinbox widget to *note tkinter.ttk: ff.
     Patch by Alan D Moore.

   - bpo-32221(32): Various functions returning tuple containing IPv6
     addresses now omit ‘%scope’ part since the same information is
     already encoded in 'scopeid' tuple item.  Especially this speeds up
     ‘socket.recvfrom()’ when it receives multicast packet since useless
     resolving of network interface name is omitted.

   - bpo-30693(33): The TarFile class now recurses directories in a
     reproducible way.

   - bpo-30693(34): The ZipFile class now recurses directories in a
     reproducible way.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32960

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32713

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32951

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32929

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32947

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30622

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32922

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32859

   (9) https://bugs.python.org/issue?@action=redirect&bpo=32556

   (10) https://bugs.python.org/issue?@action=redirect&bpo=25988

   (11) https://bugs.python.org/issue?@action=redirect&bpo=21060

   (12) https://bugs.python.org/issue?@action=redirect&bpo=32852

   (13) https://bugs.python.org/issue?@action=redirect&bpo=31333

   (14) https://bugs.python.org/issue?@action=redirect&bpo=32841

   (15) https://bugs.python.org/issue?@action=redirect&bpo=32819

   (16) https://bugs.python.org/issue?@action=redirect&bpo=32394

   (17) https://bugs.python.org/issue?@action=redirect&bpo=31787

   (18) https://bugs.python.org/issue?@action=redirect&bpo=30157

   (19) https://bugs.python.org/issue?@action=redirect&bpo=32792

   (20) https://bugs.python.org/issue?@action=redirect&bpo=32775

   (21) https://bugs.python.org/issue?@action=redirect&bpo=32622

   (22) https://bugs.python.org/issue?@action=redirect&bpo=32777

   (23) https://bugs.python.org/issue?@action=redirect&bpo=32647

   (24) https://bugs.python.org/issue?@action=redirect&bpo=32741

   (25) https://bugs.python.org/issue?@action=redirect&bpo=32691

   (26) https://bugs.python.org/issue?@action=redirect&bpo=32734

   (27) https://bugs.python.org/issue?@action=redirect&bpo=32727

   (28) https://bugs.python.org/issue?@action=redirect&bpo=31453

   (29) https://bugs.python.org/issue?@action=redirect&bpo=24334

   (30) https://bugs.python.org/issue?@action=redirect&bpo=31848

   (31) https://bugs.python.org/issue?@action=redirect&bpo=32585

   (32) https://bugs.python.org/issue?@action=redirect&bpo=32221

   (33) https://bugs.python.org/issue?@action=redirect&bpo=30693

   (34) https://bugs.python.org/issue?@action=redirect&bpo=30693


File: python.info,  Node: ドキュメント<61>,  Next: テスト<58>,  Prev: ライブラリ<168>,  Up: Python 3 7 0 beta 2

1.24.68.4 ドキュメント
......................

   - bpo-28124(1): The ssl module function ssl.wrap_socket() has been
     de-emphasized and deprecated in favor of the more secure and
     efficient SSLContext.wrap_socket() method.

   - bpo-17232(2): Clarify docs for -O and -OO. Patch by Terry Reedy.

   - bpo-32436(3): Add documentation for the contextvars module (PEP
     567).

   - bpo-32800(4): Update link to w3c doc for xml default namespaces.

   - bpo-11015(5): Update *note test.support: ea. documentation.

   - bpo-8722(6): Document ‘__getattr__()’ behavior when property
     ‘get()’ method raises *note AttributeError: 5f0.

   - bpo-32614(7): Modify RE examples in documentation to use raw
     strings to prevent *note DeprecationWarning: 1a3. and add text to
     REGEX HOWTO to highlight the deprecation.

   - bpo-31972(8): Improve docstrings for ‘pathlib.PurePath’ subclasses.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28124

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17232

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32436

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32800

   (5) https://bugs.python.org/issue?@action=redirect&bpo=11015

   (6) https://bugs.python.org/issue?@action=redirect&bpo=8722

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32614

   (8) https://bugs.python.org/issue?@action=redirect&bpo=31972


File: python.info,  Node: テスト<58>,  Next: ビルド<66>,  Prev: ドキュメント<61>,  Up: Python 3 7 0 beta 2

1.24.68.5 テスト
................

   - bpo-31809(1): Add tests to verify connection with secp ECDH curves.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31809


File: python.info,  Node: ビルド<66>,  Next: Windows<59>,  Prev: テスト<58>,  Up: Python 3 7 0 beta 2

1.24.68.6 ビルド
................

   - bpo-32898(1): Fix the python debug build when using COUNT_ALLOCS.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32898


File: python.info,  Node: Windows<59>,  Next: macOS<46>,  Prev: ビルド<66>,  Up: Python 3 7 0 beta 2

1.24.68.7 Windows
.................

   - bpo-32901(1): Update Tcl and Tk versions to 8.6.8

   - bpo-31966(2): Fixed WindowsConsoleIO.write() for writing empty
     data.

   - bpo-32409(3): Ensures activate.bat can handle Unicode contents.

   - bpo-32457(4): Improves handling of denormalized executable path
     when launching Python.

   - bpo-32370(5): Use the correct encoding for ipconfig output in the
     uuid module.  Patch by Segev Finer.

   - bpo-29248(6): Fix *note os.readlink(): b1a. on Windows, which was
     mistakenly treating the ‘PrintNameOffset’ field of the reparse data
     buffer as a number of characters instead of bytes.  Patch by Craig
     Holmquist and SSE4.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32901

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31966

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32409

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32457

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32370

   (6) https://bugs.python.org/issue?@action=redirect&bpo=29248


File: python.info,  Node: macOS<46>,  Next: IDLE<42>,  Prev: Windows<59>,  Up: Python 3 7 0 beta 2

1.24.68.8 macOS
...............

   - bpo-32901(1): Update macOS 10.9+ installer to Tcl/Tk 8.6.8.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32901


File: python.info,  Node: IDLE<42>,  Next: Tools/Demos<40>,  Prev: macOS<46>,  Up: Python 3 7 0 beta 2

1.24.68.9 IDLE
..............

   - bpo-32916(1): Change ‘str’ to ‘code’ in pyparse.

   - bpo-32905(2): Remove unused code in pyparse module.

   - bpo-32874(3): Add tests for pyparse.

   - bpo-32837(4): Using the system and place-dependent default encoding
     for open() is a bad idea for IDLE's system and location-independent
     files.

   - bpo-32826(5): Add "encoding=utf-8" to open() in IDLE's
     test_help_about.  GUI test test_file_buttons() only looks at
     initial ascii-only lines, but failed on systems where open()
     defaults to 'ascii' because readline() internally reads and decodes
     far enough ahead to encounter a non-ascii character in CREDITS.txt.

   - bpo-32765(6): Update configdialog General tab docstring to add new
     widgets to the widget list.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32916

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32905

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32874

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32837

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32826

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32765


File: python.info,  Node: Tools/Demos<40>,  Prev: IDLE<42>,  Up: Python 3 7 0 beta 2

1.24.68.10 Tools/Demos
......................

   - bpo-32222(1): Fix pygettext not extracting docstrings for functions
     with type annotated arguments.  Patch by Toby Harradine.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32222


File: python.info,  Node: Python 3 7 0 beta 1,  Next: Python 3 7 0 alpha 4,  Prev: Python 3 7 0 beta 2,  Up: 変更履歴

1.24.69 Python 3.7.0 beta 1
---------------------------

'Release date: 2018-01-30'

* Menu:

* Core and Builtins: Core and Builtins<165>.
* ライブラリ: ライブラリ<169>.
* ドキュメント: ドキュメント<62>.
* テスト: テスト<59>.
* ビルド: ビルド<67>.
* Windows: Windows<60>.
* macOS: macOS<47>.
* C API: C API<59>.


File: python.info,  Node: Core and Builtins<165>,  Next: ライブラリ<169>,  Up: Python 3 7 0 beta 1

1.24.69.1 Core and Builtins
...........................

   - bpo-32703(1): Fix coroutine's ResourceWarning when there's an
     active error set when it's being finalized.

   - bpo-32650(2): Pdb and other debuggers dependent on bdb.py will
     correctly step over (next command) native coroutines.  Patch by
     Pablo Galindo.

   - bpo-28685(3): Optimize list.sort() and sorted() by using type
     specialized comparisons when possible.

   - bpo-32685(4): Improve suggestion when the Python 2 form of print
     statement is either present on the same line as the header of a
     compound statement or else terminated by a semi-colon instead of a
     newline.  Patch by Nitish Chandra.

   - bpo-32697(5): Python now explicitly preserves the definition order
     of keyword-only parameters.  It's always preserved their order, but
     this behavior was never guaranteed before; this behavior is now
     guaranteed and tested.

   - bpo-32690(6): The locals() dictionary now displays in the lexical
     order that variables were defined.  Previously, the order was
     reversed.

   - bpo-32677(7): Add ‘.isascii()’ method to ‘str’, ‘bytes’ and
     ‘bytearray’.  It can be used to test that string contains only
     ASCII characters.

   - bpo-32670(8): Enforce PEP 479(9) for all code.  This means that
     manually raising a StopIteration exception from a generator is
     prohibited for all code, regardless of whether 'from __future__
     import generator_stop' was used or not.

   - bpo-32591(10): Added built-in support for tracking the origin of
     coroutine objects; see sys.set_coroutine_origin_tracking_depth and
     CoroutineType.cr_origin.  This replaces the asyncio debug mode's
     use of coroutine wrapping for native coroutine objects.

   - bpo-31368(11): Expose preadv and pwritev system calls in the os
     module.  Patch by Pablo Galindo

   - bpo-32544(12): ‘hasattr(obj, name)’ and ‘getattr(obj, name,
     default)’ are about 4 times faster than before when ‘name’ is not
     found and ‘obj’ doesn't override ‘__getattr__’ or
     ‘__getattribute__’.

   - bpo-26163(13): Improved frozenset() hash to create more distinct
     hash values when faced with datasets containing many similar
     values.

   - bpo-32550(14): Remove the STORE_ANNOTATION bytecode.

   - bpo-20104(15): Expose posix_spawn as a low level API in the os
     module.  (removed before 3.7.0rc1)

   - bpo-24340(16): Fixed estimation of the code stack size.

   - bpo-32436(17): Implement PEP 567(18) Context Variables.

   - bpo-18533(19): ‘repr()’ on a dict containing its own ‘values()’ or
     ‘items()’ no longer raises ‘RecursionError’; OrderedDict similarly.
     Instead, use ‘...’, as for other recursive structures.  Patch by
     Ben North.

   - bpo-20891(20): Py_Initialize() now creates the GIL. The GIL is no
     longer created "on demand" to fix a race condition when
     PyGILState_Ensure() is called in a non-Python thread.

   - bpo-32028(21): Leading whitespace is now correctly ignored when
     generating suggestions for converting Py2 print statements to Py3
     builtin print function calls.  Patch by Sanyam Khurana.

   - bpo-31179(22): Make dict.copy() up to 5.5 times faster.

   - bpo-31113(23): Get rid of recursion in the compiler for normal
     control flow.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32703

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32650

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28685

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32685

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32697

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32690

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32677

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32670

   (9) https://peps.python.org/pep-0479/

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32591

   (11) https://bugs.python.org/issue?@action=redirect&bpo=31368

   (12) https://bugs.python.org/issue?@action=redirect&bpo=32544

   (13) https://bugs.python.org/issue?@action=redirect&bpo=26163

   (14) https://bugs.python.org/issue?@action=redirect&bpo=32550

   (15) https://bugs.python.org/issue?@action=redirect&bpo=20104

   (16) https://bugs.python.org/issue?@action=redirect&bpo=24340

   (17) https://bugs.python.org/issue?@action=redirect&bpo=32436

   (18) https://peps.python.org/pep-0567/

   (19) https://bugs.python.org/issue?@action=redirect&bpo=18533

   (20) https://bugs.python.org/issue?@action=redirect&bpo=20891

   (21) https://bugs.python.org/issue?@action=redirect&bpo=32028

   (22) https://bugs.python.org/issue?@action=redirect&bpo=31179

   (23) https://bugs.python.org/issue?@action=redirect&bpo=31113


File: python.info,  Node: ライブラリ<169>,  Next: ドキュメント<62>,  Prev: Core and Builtins<165>,  Up: Python 3 7 0 beta 1

1.24.69.2 ライブラリ
....................

   - bpo-25988(1): Deprecate exposing the contents of collections.abc in
     the regular collections module.

   - bpo-31429(2): The default cipher suite selection of the ssl module
     now uses a blacklist approach rather than a hard-coded whitelist.
     Python no longer re-enables ciphers that have been blocked by
     OpenSSL security update.  Default cipher suite selection can be
     configured on compile time.

   - bpo-30306(3): contextlib.contextmanager now releases the arguments
     passed to the underlying generator as soon as the context manager
     is entered.  Previously it would keep them alive for as long as the
     context manager was alive, even when not being used as a function
     decorator.  Patch by Martin Teichmann.

   - bpo-21417(4): Added support for setting the compression level for
     zipfile.ZipFile.

   - bpo-32251(5): Implement asyncio.BufferedProtocol (provisional API).

   - bpo-32513(6): In dataclasses, allow easier overriding of dunder
     methods without specifying decorator parameters.

   - bpo-32660(7): *note termios: e7. makes available ‘FIONREAD’,
     ‘FIONCLEX’, ‘FIOCLEX’, ‘FIOASYNC’ and ‘FIONBIO’ also under
     Solaris/derivatives.

   - bpo-27931(8): Fix email address header parsing error when the
     username is an empty quoted string.  Patch by Xiang Zhang.

   - bpo-32659(9): Under Solaris and derivatives, *note os.stat_result:
     16da. provides a st_fstype attribute.

   - bpo-32662(10): Implement Server.start_serving(),
     Server.serve_forever(), and Server.is_serving() methods.  Add
     'start_serving' keyword parameter to loop.create_server() and
     loop.create_unix_server().

   - bpo-32391(11): Implement *note asyncio.StreamWriter.wait_closed():
     d02. and *note asyncio.StreamWriter.is_closing(): d03. methods

   - bpo-32643(12): Make Task._step, Task._wakeup and
     Future._schedule_callbacks methods private.

   - bpo-32630(13): Refactor decimal module to use contextvars to store
     decimal context.

   - bpo-32622(14): Add ‘asyncio.AbstractEventLoop.sendfile()’ method.

   - bpo-32304(15): distutils' upload command no longer corrupts tar
     files ending with a CR byte, and no longer tries to convert CR to
     CRLF in any of the upload text fields.

   - bpo-32502(16): uuid.uuid1 no longer raises an exception if a 64-bit
     hardware address is encountered.

   - bpo-32596(17): ‘concurrent.futures’ imports ‘ThreadPoolExecutor’
     and ‘ProcessPoolExecutor’ lazily (using PEP 562(18)).  It makes
     ‘import asyncio’ about 15% faster because asyncio uses only
     ‘ThreadPoolExecutor’ by default.

   - bpo-31801(19): Add ‘_ignore_’ to ‘Enum’ so temporary variables can
     be used during class construction without being turned into
     members.

   - bpo-32576(20): Use queue.SimpleQueue() in places where it can be
     invoked from a weakref callback.

   - bpo-32574(21): Fix memory leak in asyncio.Queue, when the queue has
     limited size and it is full, the cancellation of queue.put() can
     cause a memory leak.  Patch by: José Melero.

   - bpo-32521(22): The nis module is now compatible with new libnsl and
     headers location.

   - bpo-32467(23): collections.abc.ValuesView now inherits from
     collections.abc.Collection.

   - bpo-32473(24): Improve ABCMeta._dump_registry() output readability

   - bpo-32102(25): New argument ‘capture_output’ for subprocess.run

   - bpo-32521(26): glibc has removed Sun RPC. Use replacement libtirpc
     headers and library in nis module.

   - bpo-32493(27): UUID module fixes build for FreeBSD/OpenBSD

   - bpo-32503(28): Pickling with protocol 4 no longer creates too small
     frames.

   - bpo-29237(29): Create enum for pstats sorting options

   - bpo-32454(30): Add close(fd) function to the socket module.

   - bpo-25942(31): The subprocess module is now more graceful when
     handling a Ctrl-C KeyboardInterrupt during subprocess.call,
     subprocess.run, or a Popen context manager.  It now waits a short
     amount of time for the child (presumed to have also gotten the
     SIGINT) to exit, before continuing the KeyboardInterrupt exception
     handling.  This still includes a SIGKILL in the call() and run()
     APIs, but at least the child had a chance first.

   - bpo-32433(32): The hmac module now has hmac.digest(), which
     provides an optimized HMAC digest.

   - bpo-28134(33): Sockets now auto-detect family, type and protocol
     from file descriptor by default.

   - bpo-32404(34): Fix bug where *note
     datetime.datetime.fromtimestamp(): 712. did not call __new__ in
     *note datetime.datetime: 4e2. subclasses.

   - bpo-32403(35): Improved speed of *note datetime.date: 1fa. and
     *note datetime.datetime: 4e2. alternate constructors.

   - bpo-32228(36): Ensure that ‘truncate()’ preserves the file position
     (as reported by ‘tell()’) after writes longer than the buffer size.

   - bpo-32410(37): Implement ‘loop.sock_sendfile’ for asyncio event
     loop.

   - bpo-22908(38): Added seek and tell to the ZipExtFile class.  This
     only works if the file object used to open the zipfile is seekable.

   - bpo-32373(39): Add socket.getblocking() method.

   - bpo-32248(40): Add *note importlib.resources: 7f. and
     ‘importlib.abc.ResourceReader’ as the unified API for reading
     resources contained within packages.  Loaders wishing to support
     resource reading must implement the ‘get_resource_reader()’ method.
     File-based and zipimport-based loaders both implement these APIs.
     *note importlib.abc.ResourceLoader: de2. is deprecated in favor of
     these new APIs.

   - bpo-32320(41): collections.namedtuple() now supports default
     values.

   - bpo-29302(42): Add contextlib.AsyncExitStack.  Patch by Alexander
     Mohr and Ilya Kulakov.

   - bpo-31961(43): 'Removed in Python 3.7.0b2.'  The 'args' argument of
     subprocess.Popen can now be a *note path-like object: 5a1.  If
     'args' is given as a sequence, it's first element can now be a
     *note path-like object: 5a1. as well.

   - bpo-31900(44): The *note locale.localeconv(): df8. function now
     sets temporarily the ‘LC_CTYPE’ locale to the ‘LC_NUMERIC’ locale
     to decode ‘decimal_point’ and ‘thousands_sep’ byte strings if they
     are non-ASCII or longer than 1 byte, and the ‘LC_NUMERIC’ locale is
     different than the ‘LC_CTYPE’ locale.  This temporary change
     affects other threads.  Same change for the *note str.format():
     833. method when formatting a number (*note int: 19b, *note float:
     196, *note float: 196. and subclasses) with the ‘n’ type (ex:
     ‘'{:n}'.format(1234)’).

   - bpo-31853(45): Use super().method instead of socket.method in
     SSLSocket.  They were there most likely for legacy reasons.

   - bpo-31399(46): The ssl module now uses OpenSSL's
     X509_VERIFY_PARAM_set1_host() and X509_VERIFY_PARAM_set1_ip() API
     to verify hostname and IP addresses.  Subject common name fallback
     can be disabled with SSLContext.hostname_checks_common_name.

   - bpo-14976(47): Add a queue.SimpleQueue class, an unbounded FIFO
     queue with a reentrant C implementation of put().

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25988

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31429

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30306

   (4) https://bugs.python.org/issue?@action=redirect&bpo=21417

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32251

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32513

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32660

   (8) https://bugs.python.org/issue?@action=redirect&bpo=27931

   (9) https://bugs.python.org/issue?@action=redirect&bpo=32659

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32662

   (11) https://bugs.python.org/issue?@action=redirect&bpo=32391

   (12) https://bugs.python.org/issue?@action=redirect&bpo=32643

   (13) https://bugs.python.org/issue?@action=redirect&bpo=32630

   (14) https://bugs.python.org/issue?@action=redirect&bpo=32622

   (15) https://bugs.python.org/issue?@action=redirect&bpo=32304

   (16) https://bugs.python.org/issue?@action=redirect&bpo=32502

   (17) https://bugs.python.org/issue?@action=redirect&bpo=32596

   (18) https://peps.python.org/pep-0562/

   (19) https://bugs.python.org/issue?@action=redirect&bpo=31801

   (20) https://bugs.python.org/issue?@action=redirect&bpo=32576

   (21) https://bugs.python.org/issue?@action=redirect&bpo=32574

   (22) https://bugs.python.org/issue?@action=redirect&bpo=32521

   (23) https://bugs.python.org/issue?@action=redirect&bpo=32467

   (24) https://bugs.python.org/issue?@action=redirect&bpo=32473

   (25) https://bugs.python.org/issue?@action=redirect&bpo=32102

   (26) https://bugs.python.org/issue?@action=redirect&bpo=32521

   (27) https://bugs.python.org/issue?@action=redirect&bpo=32493

   (28) https://bugs.python.org/issue?@action=redirect&bpo=32503

   (29) https://bugs.python.org/issue?@action=redirect&bpo=29237

   (30) https://bugs.python.org/issue?@action=redirect&bpo=32454

   (31) https://bugs.python.org/issue?@action=redirect&bpo=25942

   (32) https://bugs.python.org/issue?@action=redirect&bpo=32433

   (33) https://bugs.python.org/issue?@action=redirect&bpo=28134

   (34) https://bugs.python.org/issue?@action=redirect&bpo=32404

   (35) https://bugs.python.org/issue?@action=redirect&bpo=32403

   (36) https://bugs.python.org/issue?@action=redirect&bpo=32228

   (37) https://bugs.python.org/issue?@action=redirect&bpo=32410

   (38) https://bugs.python.org/issue?@action=redirect&bpo=22908

   (39) https://bugs.python.org/issue?@action=redirect&bpo=32373

   (40) https://bugs.python.org/issue?@action=redirect&bpo=32248

   (41) https://bugs.python.org/issue?@action=redirect&bpo=32320

   (42) https://bugs.python.org/issue?@action=redirect&bpo=29302

   (43) https://bugs.python.org/issue?@action=redirect&bpo=31961

   (44) https://bugs.python.org/issue?@action=redirect&bpo=31900

   (45) https://bugs.python.org/issue?@action=redirect&bpo=31853

   (46) https://bugs.python.org/issue?@action=redirect&bpo=31399

   (47) https://bugs.python.org/issue?@action=redirect&bpo=14976


File: python.info,  Node: ドキュメント<62>,  Next: テスト<59>,  Prev: ライブラリ<169>,  Up: Python 3 7 0 beta 1

1.24.69.3 ドキュメント
......................

   - bpo-32724(1): Add references to some commands in the documentation
     of Pdb.  Patch by Stéphane Wirtel

   - bpo-32649(2): Complete the C API documentation, profiling and
     tracing part with the newly added per-opcode events.

   - bpo-17799(3): Explain real behaviour of sys.settrace and
     sys.setprofile and their C-API counterparts regarding which type of
     events are received in each function.  Patch by Pablo Galindo
     Salgado.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32724

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32649

   (3) https://bugs.python.org/issue?@action=redirect&bpo=17799


File: python.info,  Node: テスト<59>,  Next: ビルド<67>,  Prev: ドキュメント<62>,  Up: Python 3 7 0 beta 1

1.24.69.4 テスト
................

   - bpo-32721(1): Fix test_hashlib to not fail if the _md5 module is
     not built.

   - bpo-28414(2): Add test cases for IDNA 2003 and 2008 host names.
     IDNA 2003 internationalized host names are working since
     bpo-31399(3) has landed.  IDNA 2008 are still broken.

   - bpo-32604(4): Add a new "_xxsubinterpreters" extension module that
     exposes the existing subinterpreter C-API and a new
     cross-interpreter data sharing mechanism.  The module is primarily
     intended for more thorough testing of the existing subinterpreter
     support.  Note that the _xxsubinterpreters module has been removed
     in 3.7.0rc1.

   - bpo-32602(5): Add test certs and test for ECDSA cert and EC/RSA
     dual mode.

   - bpo-32549(6): On Travis CI, Python now Compiles and uses a local
     copy of OpenSSL 1.1.0g for testing.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32721

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28414

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31399

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32604

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32602

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32549


File: python.info,  Node: ビルド<67>,  Next: Windows<60>,  Prev: テスト<59>,  Up: Python 3 7 0 beta 1

1.24.69.5 ビルド
................

   - bpo-32635(1): Fix segfault of the crypt module when libxcrypt is
     provided instead of libcrypt at the system.

   - bpo-32598(2): Use autoconf to detect OpenSSL libs, headers and
     supported features.  The ax_check_openssl M4 macro uses pkg-config
     to locate OpenSSL and falls back to manual search.

   - bpo-32593(3): Drop support of FreeBSD 9 and older.

   - bpo-29708(4): If the ‘SOURCE_DATE_EPOCH’ environment variable is
     set, *note py_compile: b8. will always create hash-based ‘.pyc’
     files.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32635

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32598

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32593

   (4) https://bugs.python.org/issue?@action=redirect&bpo=29708


File: python.info,  Node: Windows<60>,  Next: macOS<47>,  Prev: ビルド<67>,  Up: Python 3 7 0 beta 1

1.24.69.6 Windows
.................

   - bpo-32588(1): Create standalone _distutils_findvs module and add
     missing _queue module to installer.

   - bpo-29911(2): Ensure separate Modify and Uninstall buttons are
     displayed.

   - bpo-32507(3): Use app-local UCRT install rather than the proper
     update for old versions of Windows.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32588

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29911

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32507


File: python.info,  Node: macOS<47>,  Next: C API<59>,  Prev: Windows<60>,  Up: Python 3 7 0 beta 1

1.24.69.7 macOS
...............

   - bpo-32726(1): Provide an additional, more modern macOS installer
     variant that supports macOS 10.9+ systems in 64-bit mode only.
     Upgrade the supplied third-party libraries to OpenSSL 1.1.0g and to
     SQLite 3.22.0.  The 10.9+ installer now links with and supplies its
     own copy of Tcl/Tk 8.6.

   - bpo-28440(2): No longer add /Library/Python/3.x/site-packages to
     sys.path for macOS framework builds to avoid future conflicts.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32726

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28440


File: python.info,  Node: C API<59>,  Prev: macOS<47>,  Up: Python 3 7 0 beta 1

1.24.69.8 C API
...............

   - bpo-32681(1): Fix uninitialized variable 'res' in the C
     implementation of os.dup2.  Patch by Stéphane Wirtel

   - bpo-10381(2): Add C API access to the ‘datetime.timezone’
     constructor and ‘datetime.timezone.UTC’ singleton.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32681

   (2) https://bugs.python.org/issue?@action=redirect&bpo=10381


File: python.info,  Node: Python 3 7 0 alpha 4,  Next: Python 3 7 0 alpha 3,  Prev: Python 3 7 0 beta 1,  Up: 変更履歴

1.24.70 Python 3.7.0 alpha 4
----------------------------

'Release date: 2018-01-08'

* Menu:

* Core and Builtins: Core and Builtins<166>.
* ライブラリ: ライブラリ<170>.
* ドキュメント: ドキュメント<63>.
* テスト: テスト<60>.
* Windows: Windows<61>.
* Tools/Demos: Tools/Demos<41>.
* C API: C API<60>.


File: python.info,  Node: Core and Builtins<166>,  Next: ライブラリ<170>,  Up: Python 3 7 0 alpha 4

1.24.70.1 Core and Builtins
...........................

   - bpo-31975(1): The default warning filter list now starts with a
     "default::DeprecationWarning:__main__" entry, so deprecation
     warnings are once again shown by default in single-file scripts and
     at the interactive prompt.

   - bpo-32226(2): ‘__class_getitem__’ is now an automatic class method.

   - bpo-32399(3): Add AIX uuid library support for RFC4122 using
     uuid_create() in libc.a

   - bpo-32390(4): Fix the compilation failure on AIX after the f_fsid
     field has been added to the object returned by os.statvfs()
     (bpo-32143(5)).  Original patch by Michael Felt.

   - bpo-32379(6): Make MRO computation faster when a class inherits
     from a single base.

   - bpo-32259(7): The error message of a TypeError raised when unpack
     non-iterable is now more specific.

   - bpo-27169(8): The ‘__debug__’ constant is now optimized out at
     compile time.  This fixes also bpo-22091(9).

   - bpo-32329(10): The *note -R: 1e78. option now turns on hash
     randomization when the *note PYTHONHASHSEED: 1289. environment
     variable is set to ‘0’.  Previously, the option was ignored.
     Moreover, ‘sys.flags.hash_randomization’ is now properly set to 0
     when hash randomization is turned off by ‘PYTHONHASHSEED=0’.

   - bpo-30416(11): The optimizer is now protected from spending much
     time doing complex calculations and consuming much memory for
     creating large constants in constant folding.  Increased limits for
     constants that can be produced in constant folding.

   - bpo-32282(12): Fix an unnecessary ifdef in the include of
     VersionHelpers.h in socketmodule on Windows.

   - bpo-30579(13): Implement TracebackType.__new__ to allow
     Python-level creation of traceback objects, and make
     TracebackType.tb_next mutable.

   - bpo-32260(14): Don't byte swap the input keys to the SipHash
     algorithm on big-endian platforms.  This should ensure siphash
     gives consistent results across platforms.

   - bpo-31506(15): Improve the error message logic for object.__new__
     and object.__init__.  Patch by Sanyam Khurana.

   - bpo-20361(16): ‘-b’ and ‘-bb’ now inject ‘'default::BytesWarning'’
     and ‘error::BytesWarning’ entries into ‘sys.warnoptions’, ensuring
     that they take precedence over any other warning filters configured
     via the ‘-W’ option or the ‘PYTHONWARNINGS’ environment variable.

   - bpo-32230(17): ‘-X dev’ now injects a ‘'default'’ entry into
     sys.warnoptions, ensuring that it behaves identically to actually
     passing ‘-Wdefault’ at the command line.

   - bpo-29240(18): Add a new UTF-8 mode: implementation of the PEP
     540(19).

   - bpo-32226(20): PEP 560(21): Add support for ‘__mro_entries__’ and
     ‘__class_getitem__’.  Implemented by Ivan Levkivskyi.

   - bpo-32225(22): PEP 562(23): Add support for module ‘__getattr__’
     and ‘__dir__’.  Implemented by Ivan Levkivskyi.

   - bpo-31901(24): The ‘atexit’ module now has its callback stored per
     interpreter.

   - bpo-31650(25): Implement PEP 552(26) (Deterministic pycs).  Python
     now supports invalidating bytecode cache files bashed on a source
     content hash rather than source last-modified time.

   - bpo-29469(27): Move constant folding from bytecode layer to AST
     layer.  Original patch by Eugene Toder.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31975

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32226

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32399

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32390

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32143

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32379

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32259

   (8) https://bugs.python.org/issue?@action=redirect&bpo=27169

   (9) https://bugs.python.org/issue?@action=redirect&bpo=22091

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32329

   (11) https://bugs.python.org/issue?@action=redirect&bpo=30416

   (12) https://bugs.python.org/issue?@action=redirect&bpo=32282

   (13) https://bugs.python.org/issue?@action=redirect&bpo=30579

   (14) https://bugs.python.org/issue?@action=redirect&bpo=32260

   (15) https://bugs.python.org/issue?@action=redirect&bpo=31506

   (16) https://bugs.python.org/issue?@action=redirect&bpo=20361

   (17) https://bugs.python.org/issue?@action=redirect&bpo=32230

   (18) https://bugs.python.org/issue?@action=redirect&bpo=29240

   (19) https://peps.python.org/pep-0540/

   (20) https://bugs.python.org/issue?@action=redirect&bpo=32226

   (21) https://peps.python.org/pep-0560/

   (22) https://bugs.python.org/issue?@action=redirect&bpo=32225

   (23) https://peps.python.org/pep-0562/

   (24) https://bugs.python.org/issue?@action=redirect&bpo=31901

   (25) https://bugs.python.org/issue?@action=redirect&bpo=31650

   (26) https://peps.python.org/pep-0552/

   (27) https://bugs.python.org/issue?@action=redirect&bpo=29469


File: python.info,  Node: ライブラリ<170>,  Next: ドキュメント<63>,  Prev: Core and Builtins<166>,  Up: Python 3 7 0 alpha 4

1.24.70.2 ライブラリ
....................

   - bpo-32506(1): Now that dict is defined as keeping insertion order,
     drop OrderedDict and just use plain dict.

   - bpo-32279(2): Add params to dataclasses.make_dataclasses(): init,
     repr, eq, order, hash, and frozen.  Pass them through to
     dataclass().

   - bpo-32278(3): Make type information optional on
     dataclasses.make_dataclass().  If omitted, the string 'typing.Any'
     is used.

   - bpo-32499(4): Add dataclasses.is_dataclass(obj), which returns True
     if obj is a dataclass or an instance of one.

   - bpo-32468(5): Improve frame repr() to mention filename, code name
     and current line number.

   - bpo-23749(6): asyncio: Implement loop.start_tls()

   - bpo-32441(7): Return the new file descriptor (i.e., the second
     argument) from ‘os.dup2’.  Previously, ‘None’ was always returned.

   - bpo-32422(8): ‘functools.lru_cache’ uses less memory (3 words for
     each cached key) and takes about 1/3 time for cyclic GC.

   - bpo-31721(9): Prevent Python crash from happening when
     Future._log_traceback is set to True manually.  Now it can only be
     set to False, or a ValueError is raised.

   - bpo-32415(10): asyncio: Add Task.get_loop() and Future.get_loop()

   - bpo-26133(11): Don't unsubscribe signals in asyncio UNIX event loop
     on interpreter shutdown.

   - bpo-32363(12): Make asyncio.Task.set_exception() and set_result()
     raise NotImplementedError.  Task._step() and Future.__await__()
     raise proper exceptions when they are in an invalid state, instead
     of raising an AssertionError.

   - bpo-32357(13): Optimize asyncio.iscoroutine() and
     loop.create_task() for non-native coroutines (e.g.  async/await
     compiled with Cython).  'loop.create_task(python_coroutine)' used
     to be 20% faster than 'loop.create_task(cython_coroutine)'.  Now,
     the latter is as fast.

   - bpo-32356(14): asyncio.transport.resume_reading() and
     pause_reading() are now idempotent.  New transport.is_reading()
     method is added.

   - bpo-32355(15): Optimize asyncio.gather(); now up to 15% faster.

   - bpo-32351(16): Use fastpath in asyncio.sleep if delay<0 (2x boost)

   - bpo-32348(17): Optimize asyncio.Future schedule/add/remove
     callback.  The optimization shows 3-6% performance improvements of
     async/await code.

   - bpo-32331(18): Fix socket.settimeout() and socket.setblocking() to
     keep socket.type as is.  Fix socket.socket() constructor to reset
     any bit flags applied to socket's type.  This change only affects
     OSes that have SOCK_NONBLOCK and/or SOCK_CLOEXEC.

   - bpo-32248(19): Add ‘importlib.abc.ResourceReader’ as an ABC for
     loaders to provide a unified API for reading resources contained
     within packages.  Also add *note importlib.resources: 7f. as the
     port of ‘importlib_resources’.

   - bpo-32311(20): Implement asyncio.create_task(coro) shortcut

   - bpo-32327(21): Convert asyncio functions that were documented as
     coroutines to coroutines.  Affected functions: loop.sock_sendall,
     loop.sock_recv, loop.sock_accept, loop.getaddrinfo,
     loop.getnameinfo.

   - bpo-32323(22): *note urllib.parse.urlsplit(): f3a. does not convert
     zone-id (scope) to lower case for scoped IPv6 addresses in
     hostnames now.

   - bpo-32302(23): Fix bdist_wininst of distutils for CRT v142: it
     binary compatible with CRT v140.

   - bpo-29711(24): Fix ‘stop_serving’ in asyncio proactor loop kill all
     listening servers

   - bpo-32308(25): *note re.sub(): 5a3. now replaces empty matches
     adjacent to a previous non-empty match.

   - bpo-29970(26): Abort asyncio SSLProtocol connection if handshake
     not complete within 10 seconds.

   - bpo-32314(27): Implement asyncio.run().

   - bpo-17852(28): Revert incorrect fix based on misunderstanding of
     _Py_PyAtExit() semantics.

   - bpo-32296(29): Implement asyncio._get_running_loop() and
     get_event_loop() in C. This makes them 4x faster.

   - bpo-32250(30): Implement ‘asyncio.current_task()’ and
     ‘asyncio.all_tasks()’.  Add helpers intended to be used by
     alternative task implementations: ‘asyncio._register_task’,
     ‘asyncio._enter_task’, ‘asyncio._leave_task’ and
     ‘asyncio._unregister_task’.  Deprecate
     ‘asyncio.Task.current_task()’ and ‘asyncio.Task.all_tasks()’.

   - bpo-32255(31): A single empty field is now always quoted when
     written into a CSV file.  This allows to distinguish an empty row
     from a row consisting of a single empty field.  Patch by Licht
     Takeuchi.

   - bpo-32277(32): Raise ‘NotImplementedError’ instead of ‘SystemError’
     on platforms where ‘chmod(..., follow_symlinks=False)’ is not
     supported.  Patch by Anthony Sottile.

   - bpo-30050(33): New argument warn_on_full_buffer to
     signal.set_wakeup_fd lets you control whether Python prints a
     warning on stderr when the wakeup fd buffer overflows.

   - bpo-29137(34): The ‘fpectl’ library has been removed.  It was never
     enabled by default, never worked correctly on x86-64, and it
     changed the Python ABI in ways that caused unexpected breakage of C
     extensions.

   - bpo-32273(35): Move asyncio.test_utils to test.test_asyncio.

   - bpo-32272(36): Remove asyncio.async() function.

   - bpo-32269(37): Add asyncio.get_running_loop() function.

   - bpo-32265(38): All class and static methods of builtin types now
     are correctly classified by inspect.classify_class_attrs() and
     grouped in pydoc output.  Added types.ClassMethodDescriptorType for
     unbound class methods of builtin types.

   - bpo-32253(39): Deprecate ‘yield from lock’, ‘await lock’, ‘with
     (yield from lock)’ and ‘with await lock’ for asyncio
     synchronization primitives.

   - bpo-22589(40): Changed MIME type of .bmp from 'image/x-ms-bmp' to
     'image/bmp'

   - bpo-32193(41): Convert asyncio to use 'async/await' syntax.  Old
     styled ‘yield from’ is still supported too.

   - bpo-32206(42): Add support to run modules with pdb

   - bpo-32227(43): ‘functools.singledispatch’ now supports registering
     implementations using type annotations.

   - bpo-15873(44): Added new alternate constructors *note
     datetime.datetime.fromisoformat(): 82a, *note
     datetime.time.fromisoformat(): 829. and *note
     datetime.date.fromisoformat(): 828. as the inverse operation of
     each classes's respective ‘isoformat’ methods.

   - bpo-32199(45): The getnode() ip getter now uses 'ip link' instead
     of 'ip link list'.

   - bpo-32143(46): os.statvfs() includes the f_fsid field from
     statvfs(2)

   - bpo-26439(47): Fix ctypes.util.find_library() for AIX by
     implementing ctypes._aix.find_library() Patch by: Michael Felt

   - bpo-31993(48): The pickler now uses less memory when serializing
     large bytes and str objects into a file.  Pickles created with
     protocol 4 will require less memory for unpickling large bytes and
     str objects.

   - bpo-27456(49): Ensure TCP_NODELAY is set on Linux.  Tests by Victor
     Stinner.

   - bpo-31778(50): ast.literal_eval() is now more strict.  Addition and
     subtraction of arbitrary numbers no longer allowed.

   - bpo-31802(51): Importing native path module (‘posixpath’, ‘ntpath’)
     now works even if the ‘os’ module still is not imported.

   - bpo-30241(52): Add contextlib.AbstractAsyncContextManager.  Patch
     by Jelle Zijlstra.

   - bpo-31699(53): Fix deadlocks in *note
     concurrent.futures.ProcessPoolExecutor: 1d6. when task arguments or
     results cause pickling or unpickling errors.  This should make sure
     that calls to the ‘ProcessPoolExecutor’ API always eventually
     return.

   - bpo-15216(54): ‘TextIOWrapper.reconfigure()’ supports changing
     'encoding', 'errors', and 'newline'.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32506

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32279

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32278

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32499

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32468

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23749

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32441

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32422

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31721

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32415

   (11) https://bugs.python.org/issue?@action=redirect&bpo=26133

   (12) https://bugs.python.org/issue?@action=redirect&bpo=32363

   (13) https://bugs.python.org/issue?@action=redirect&bpo=32357

   (14) https://bugs.python.org/issue?@action=redirect&bpo=32356

   (15) https://bugs.python.org/issue?@action=redirect&bpo=32355

   (16) https://bugs.python.org/issue?@action=redirect&bpo=32351

   (17) https://bugs.python.org/issue?@action=redirect&bpo=32348

   (18) https://bugs.python.org/issue?@action=redirect&bpo=32331

   (19) https://bugs.python.org/issue?@action=redirect&bpo=32248

   (20) https://bugs.python.org/issue?@action=redirect&bpo=32311

   (21) https://bugs.python.org/issue?@action=redirect&bpo=32327

   (22) https://bugs.python.org/issue?@action=redirect&bpo=32323

   (23) https://bugs.python.org/issue?@action=redirect&bpo=32302

   (24) https://bugs.python.org/issue?@action=redirect&bpo=29711

   (25) https://bugs.python.org/issue?@action=redirect&bpo=32308

   (26) https://bugs.python.org/issue?@action=redirect&bpo=29970

   (27) https://bugs.python.org/issue?@action=redirect&bpo=32314

   (28) https://bugs.python.org/issue?@action=redirect&bpo=17852

   (29) https://bugs.python.org/issue?@action=redirect&bpo=32296

   (30) https://bugs.python.org/issue?@action=redirect&bpo=32250

   (31) https://bugs.python.org/issue?@action=redirect&bpo=32255

   (32) https://bugs.python.org/issue?@action=redirect&bpo=32277

   (33) https://bugs.python.org/issue?@action=redirect&bpo=30050

   (34) https://bugs.python.org/issue?@action=redirect&bpo=29137

   (35) https://bugs.python.org/issue?@action=redirect&bpo=32273

   (36) https://bugs.python.org/issue?@action=redirect&bpo=32272

   (37) https://bugs.python.org/issue?@action=redirect&bpo=32269

   (38) https://bugs.python.org/issue?@action=redirect&bpo=32265

   (39) https://bugs.python.org/issue?@action=redirect&bpo=32253

   (40) https://bugs.python.org/issue?@action=redirect&bpo=22589

   (41) https://bugs.python.org/issue?@action=redirect&bpo=32193

   (42) https://bugs.python.org/issue?@action=redirect&bpo=32206

   (43) https://bugs.python.org/issue?@action=redirect&bpo=32227

   (44) https://bugs.python.org/issue?@action=redirect&bpo=15873

   (45) https://bugs.python.org/issue?@action=redirect&bpo=32199

   (46) https://bugs.python.org/issue?@action=redirect&bpo=32143

   (47) https://bugs.python.org/issue?@action=redirect&bpo=26439

   (48) https://bugs.python.org/issue?@action=redirect&bpo=31993

   (49) https://bugs.python.org/issue?@action=redirect&bpo=27456

   (50) https://bugs.python.org/issue?@action=redirect&bpo=31778

   (51) https://bugs.python.org/issue?@action=redirect&bpo=31802

   (52) https://bugs.python.org/issue?@action=redirect&bpo=30241

   (53) https://bugs.python.org/issue?@action=redirect&bpo=31699

   (54) https://bugs.python.org/issue?@action=redirect&bpo=15216


File: python.info,  Node: ドキュメント<63>,  Next: テスト<60>,  Prev: ライブラリ<170>,  Up: Python 3 7 0 alpha 4

1.24.70.3 ドキュメント
......................

   - bpo-32418(1): Add get_loop() method to Server and AbstractServer
     classes.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32418


File: python.info,  Node: テスト<60>,  Next: Windows<61>,  Prev: ドキュメント<63>,  Up: Python 3 7 0 alpha 4

1.24.70.4 テスト
................

   - bpo-32252(1): Fix faulthandler_suppress_crash_report() used to
     prevent core dump files when testing crashes.  getrlimit() returns
     zero on success.

   - bpo-32002(2): Adjust C locale coercion testing for the empty locale
     and POSIX locale cases to more readily adjust to platform dependent
     behaviour.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32252

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32002


File: python.info,  Node: Windows<61>,  Next: Tools/Demos<41>,  Prev: テスト<60>,  Up: Python 3 7 0 alpha 4

1.24.70.5 Windows
.................

   - bpo-19764(1): Implement support for
     ‘subprocess.Popen(close_fds=True)’ on Windows.  Patch by Segev
     Finer.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19764


File: python.info,  Node: Tools/Demos<41>,  Next: C API<60>,  Prev: Windows<61>,  Up: Python 3 7 0 alpha 4

1.24.70.6 Tools/Demos
.....................

   - bpo-24960(1): 2to3 and lib2to3 can now read pickled grammar files
     using pkgutil.get_data() rather than probing the filesystem.  This
     lets 2to3 and lib2to3 work when run from a zipfile.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24960


File: python.info,  Node: C API<60>,  Prev: Tools/Demos<41>,  Up: Python 3 7 0 alpha 4

1.24.70.7 C API
...............

   - bpo-32030(1): Py_Initialize() doesn't reset the memory allocators
     to default if the ‘PYTHONMALLOC’ environment variable is not set.

   - bpo-29084(2): Undocumented C API for OrderedDict has been excluded
     from the limited C API. It was added by mistake and actually never
     worked in the limited C API.

   - bpo-32264(3): Moved the pygetopt.h header into internal/, since it
     has no public APIs.

   - bpo-32241(4): ‘Py_SetProgramName()’ and ‘Py_SetPythonHome()’ now
     take the ‘const wchar *’ arguments instead of ‘wchar *’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32030

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29084

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32264

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32241


File: python.info,  Node: Python 3 7 0 alpha 3,  Next: Python 3 7 0 alpha 2,  Prev: Python 3 7 0 alpha 4,  Up: 変更履歴

1.24.71 Python 3.7.0 alpha 3
----------------------------

'Release date: 2017-12-05'

* Menu:

* Core and Builtins: Core and Builtins<167>.
* ライブラリ: ライブラリ<171>.
* ドキュメント: ドキュメント<64>.
* テスト: テスト<61>.
* ビルド: ビルド<68>.
* Windows: Windows<62>.
* macOS: macOS<48>.
* IDLE: IDLE<43>.
* Tools/Demos: Tools/Demos<42>.
* C API: C API<61>.


File: python.info,  Node: Core and Builtins<167>,  Next: ライブラリ<171>,  Up: Python 3 7 0 alpha 3

1.24.71.1 Core and Builtins
...........................

   - bpo-32176(1): co_flags.CO_NOFREE is now always set correctly by the
     code object constructor based on freevars and cellvars, rather than
     needing to be set correctly by the caller.  This ensures it will be
     cleared automatically when additional cell references are injected
     into a modified code object and function.

   - bpo-10544(2): Yield expressions are now deprecated in
     comprehensions and generator expressions.  They are still permitted
     in the definition of the outermost iterable, as that is evaluated
     directly in the enclosing scope.

   - bpo-32137(3): The repr of deeply nested dict now raises a
     RecursionError instead of crashing due to a stack overflow.

   - bpo-32096(4): Revert memory allocator changes in the C API: move
     structures back from _PyRuntime to Objects/obmalloc.c.  The memory
     allocators are once again initialized statically, and so
     PyMem_RawMalloc() and Py_DecodeLocale() can be called before
     _PyRuntime_Initialize().

   - bpo-32043(5): Add a new "developer mode": new "-X dev" command line
     option to enable debug checks at runtime.

   - bpo-32023(6): SyntaxError is now correctly raised when a generator
     expression without parenthesis is used instead of an inheritance
     list in a class definition.  The duplication of the parentheses can
     be omitted only on calls.

   - bpo-32012(7): SyntaxError is now correctly raised when a generator
     expression without parenthesis is passed as an argument, but
     followed by a trailing comma.  A generator expression always needs
     to be directly inside a set of parentheses and cannot have a comma
     on either side.

   - bpo-28180(8): A new internal ‘_Py_SetLocaleFromEnv(category)’
     helper function has been added in order to improve the consistency
     of behaviour across different ‘libc’ implementations (e.g.  Android
     doesn't support setting the locale from the environment by
     default).

   - bpo-31949(9): Fixed several issues in printing tracebacks
     (PyTraceBack_Print()).  Setting sys.tracebacklimit to 0 or less now
     suppresses printing tracebacks.  Setting sys.tracebacklimit to None
     now causes using the default limit.  Setting sys.tracebacklimit to
     an integer larger than LONG_MAX now means using the limit LONG_MAX
     rather than the default limit.  Fixed integer overflows in the case
     of more than ‘2**31’ traceback items on Windows.  Fixed output
     errors handling.

   - bpo-30696(10): Fix the interactive interpreter looping endlessly
     when no memory.

   - bpo-20047(11): Bytearray methods partition() and rpartition() now
     accept only bytes-like objects as separator, as documented.  In
     particular they now raise TypeError rather of returning a bogus
     result when an integer is passed as a separator.

   - bpo-21720(12): BytesWarning no longer emitted when the 'fromlist'
     argument of ‘__import__()’ or the ‘__all__’ attribute of the module
     contain bytes instances.

   - bpo-31845(13): Environment variables are once more read correctly
     at interpreter startup.

   - bpo-28936(14): Ensure that lexically first syntax error involving a
     parameter and ‘global’ or ‘nonlocal’ is detected first at a given
     scope.  Patch by Ivan Levkivskyi.

   - bpo-31825(15): Fixed OverflowError in the 'unicode-escape' codec
     and in codecs.escape_decode() when decode an escaped non-ascii
     byte.

   - bpo-31618(16): The per-frame tracing logic added in 3.7a1 has been
     altered so that ‘frame->f_lineno’ is updated before either ‘"line"’
     or ‘"opcode"’ events are emitted.  Previously, opcode events were
     emitted first, and therefore would occasionally see stale line
     numbers on the frame.  The behavior of this feature has changed
     slightly as a result: when both ‘f_trace_lines’ and
     ‘f_trace_opcodes’ are enabled, line events now occur first.

   - bpo-28603(17): Print the full context/cause chain of exceptions on
     interpreter exit, even if an exception in the chain is unhashable
     or compares equal to later ones.  Patch by Zane Bitter.

   - bpo-31786(18): Fix timeout rounding in the select module to round
     correctly negative timeouts between -1.0 and 0.0.  The functions
     now block waiting for events as expected.  Previously, the call was
     incorrectly non-blocking.  Patch by Pablo Galindo.

   - bpo-31781(19): Prevent crashes when calling methods of an
     uninitialized ‘zipimport.zipimporter’ object.  Patch by Oren
     Milman.

   - bpo-30399(20): Standard repr() of BaseException with a single
     argument no longer contains redundant trailing comma.

   - bpo-31626(21): Fixed a bug in debug memory allocator.  There was a
     write to freed memory after shrinking a memory block.

   - bpo-30817(22): ‘PyErr_PrintEx()’ clears now the ignored exception
     that may be raised by ‘_PySys_SetObjectId()’, for example when no
     memory.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32176

   (2) https://bugs.python.org/issue?@action=redirect&bpo=10544

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32137

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32096

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32043

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32023

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32012

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28180

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31949

   (10) https://bugs.python.org/issue?@action=redirect&bpo=30696

   (11) https://bugs.python.org/issue?@action=redirect&bpo=20047

   (12) https://bugs.python.org/issue?@action=redirect&bpo=21720

   (13) https://bugs.python.org/issue?@action=redirect&bpo=31845

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28936

   (15) https://bugs.python.org/issue?@action=redirect&bpo=31825

   (16) https://bugs.python.org/issue?@action=redirect&bpo=31618

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28603

   (18) https://bugs.python.org/issue?@action=redirect&bpo=31786

   (19) https://bugs.python.org/issue?@action=redirect&bpo=31781

   (20) https://bugs.python.org/issue?@action=redirect&bpo=30399

   (21) https://bugs.python.org/issue?@action=redirect&bpo=31626

   (22) https://bugs.python.org/issue?@action=redirect&bpo=30817


File: python.info,  Node: ライブラリ<171>,  Next: ドキュメント<64>,  Prev: Core and Builtins<167>,  Up: Python 3 7 0 alpha 3

1.24.71.2 ライブラリ
....................

   - bpo-28556(1): Two minor fixes for ‘typing’ module: allow shallow
     copying instances of generic classes, improve interaction of
     ‘__init_subclass__’ with generics.  Original PRs by Ivan
     Levkivskyi.

   - bpo-32214(2): PEP 557, Data Classes.  Provides a decorator which
     adds boilerplate methods to classes which use type annotations so
     specify fields.

   - bpo-27240(3): The header folding algorithm for the new email
     policies has been rewritten, which also fixes bpo-30788(4),
     bpo-31831(5), and bpo-32182(6).  In particular, RFC2231 folding is
     now done correctly.

   - bpo-32186(7): io.FileIO.readall() and io.FileIO.read() now release
     the GIL when getting the file size.  Fixed hang of all threads with
     inaccessible NFS server.  Patch by Nir Soffer.

   - bpo-32101(8): Add *note sys.flags.dev_mode: 1e82. flag

   - bpo-32154(9): The ‘asyncio.windows_utils.socketpair()’ function has
     been removed: use directly *note socket.socketpair(): df0. which is
     available on all platforms since Python 3.5 (before, it wasn't
     available on Windows).  ‘asyncio.windows_utils.socketpair()’ was
     just an alias to ‘socket.socketpair’ on Python 3.5 and newer.

   - bpo-32089(10): warnings: In development (-X dev) and debug mode
     (pydebug build), use the "default" action for ResourceWarning,
     rather than the "always" action, in the default warnings filters.

   - bpo-32107(11): ‘uuid.getnode()’ now preferentially returns
     universally administered MAC addresses if available, over locally
     administered MAC addresses.  This makes a better guarantee for
     global uniqueness of UUIDs returned from ‘uuid.uuid1()’.  If only
     locally administered MAC addresses are available, the first such
     one found is returned.

   - bpo-23033(12): Wildcard is now supported in hostname when it is one
     and only character in the left most segment of hostname in second
     argument of ‘ssl.match_hostname()’.  Patch by Mandeep Singh.

   - bpo-12239(13): Make ‘msilib.SummaryInformation.GetProperty()’
     return ‘None’ when the value of property is ‘VT_EMPTY’.  Initial
     patch by Mark Mc Mahon.

   - bpo-28334(14): Use *note os.path.expanduser(): c09. to find the
     ‘~/.netrc’ file in *note netrc.netrc: 1c79.  If it does not exist,
     *note FileNotFoundError: 264. is raised.  Patch by Dimitri
     Merejkowsky.

   - bpo-32121(15): Made ‘tracemalloc.Traceback’ behave more like the
     traceback module, sorting the frames from oldest to most recent.
     ‘Traceback.format()’ now accepts negative 'limit', truncating the
     result to the ‘abs(limit)’ oldest frames.  To get the old
     behaviour, one can use the new 'most_recent_first' argument to
     ‘Traceback.format()’.  (Patch by Jesse Bakker.)

   - bpo-31325(16): Fix wrong usage of *note collections.namedtuple():
     4e0. in the *note RobotFileParser.parse(): 1e83. method.  Initial
     patch by Robin Wellner.

   - bpo-12382(17): ‘msilib.OpenDatabase()’ now raises a better
     exception message when it couldn't open or create an MSI file.
     Initial patch by William Tisäter.

   - bpo-19610(18): ‘setup()’ now warns about invalid types for some
     fields.  The ‘distutils.dist.Distribution’ class now warns when
     ‘classifiers’, ‘keywords’ and ‘platforms’ fields are not specified
     as a list or a string.

   - bpo-32071(19): Added the ‘-k’ command-line option to ‘python -m
     unittest’ to run only tests that match the given pattern(s).

   - bpo-10049(20): Added 'nullcontext' no-op context manager to
     contextlib.  This provides a simpler and faster alternative to
     ExitStack() when handling optional context managers.

   - bpo-28684(21): The new test.support.skip_unless_bind_unix_socket()
     decorator is used here to skip asyncio tests that fail because the
     platform lacks a functional bind() function for unix domain sockets
     (as it is the case for non root users on the recent Android
     versions that run now SELinux in enforcing mode).

   - bpo-32110(22): ‘codecs.StreamReader.read(n)’ now returns not more
     than 'n' characters/bytes for non-negative 'n'.  This makes it
     compatible with ‘read()’ methods of other file-like objects.

   - bpo-27535(23): The warnings module doesn't leak memory anymore in
     the hidden warnings registry for the "ignore" action of warnings
     filters.  warn_explicit() function doesn't add the warning key to
     the registry anymore for the "ignore" action.

   - bpo-32088(24): warnings: When Python is build is debug mode
     (‘Py_DEBUG’), *note DeprecationWarning: 1a3, *note
     PendingDeprecationWarning: ac5. and *note ImportWarning: 71e.
     warnings are now displayed by default.

   - bpo-1647489(25): Fixed searching regular expression patterns that
     could match an empty string.  Non-empty string can now be correctly
     found after matching an empty string.

   - bpo-25054(26): Added support of splitting on a pattern that could
     match an empty string.

   - bpo-32072(27): Fixed issues with binary plists: Fixed saving
     bytearrays.  Identical objects will be saved only once.  Equal
     references will be load as identical objects.  Added support for
     saving and loading recursive data structures.

   - bpo-32069(28): Drop legacy SSL transport from asyncio,
     ssl.MemoryBIO is always used anyway.

   - bpo-32066(29): asyncio: Support pathlib.Path in
     create_unix_connection; sock arg should be optional

   - bpo-32046(30): Updates 2to3 to convert from
     operator.isCallable(obj) to callable(obj).  Patch by Donghee Na.

   - bpo-32018(31): inspect.signature should follow PEP 8(32), if the
     parameter has an annotation and a default value.  Patch by Donghee
     Na.

   - bpo-32025(33): Add time.thread_time() and time.thread_time_ns()

   - bpo-32037(34): Integers that fit in a signed 32-bit integer will be
     now pickled with protocol 0 using the INT opcode.  This will
     decrease the size of a pickle, speed up pickling and unpickling,
     and make these integers be unpickled as int instances in Python 2.

   - bpo-32034(35): Make asyncio.IncompleteReadError and
     LimitOverrunError pickleable.

   - bpo-32015(36): Fixed the looping of asyncio in the case of
     reconnection the socket during waiting async read/write from/to the
     socket.

   - bpo-32011(37): Restored support of loading marshal files with the
     TYPE_INT64 code.  These files can be produced in Python 2.7.

   - bpo-28369(38): Enhance add_reader/writer check that socket is not
     used by some transport.  Before, only cases when add_reader/writer
     were called with an int FD were supported.  Now the check is
     implemented correctly for all file-like objects.

   - bpo-31976(39): Fix race condition when flushing a file is slow,
     which can cause a segfault if closing the file from another thread.

   - bpo-31985(40): Formally deprecated aifc.openfp, sunau.openfp, and
     wave.openfp.  Since change 7bc817d5ba917528e8bd07ec461c635291e7b06a
     in 1993, openfp in each of the three modules had been pointing to
     that module's open function as a matter of backwards compatibility,
     though it had been both untested and undocumented.

   - bpo-21862(41): cProfile command line now accepts ‘-m module_name’
     as an alternative to script path.  Patch by Sanyam Khurana.

   - bpo-31970(42): Reduce performance overhead of asyncio debug mode.

   - bpo-31843(43): 'database' argument of sqlite3.connect() now accepts
     a *note path-like object: 5a1, instead of just a string.

   - bpo-31945(44): Add Configurable 'blocksize' to ‘HTTPConnection’ and
     ‘HTTPSConnection’ for improved upload throughput.  Patch by Nir
     Soffer.

   - bpo-31943(45): Add a ‘cancelled()’ method to *note asyncio.Handle:
     1e84.  Patch by Marat Sharafutdinov.

   - bpo-9678(46): Fixed determining the MAC address in the uuid module:
     Using ifconfig on NetBSD and OpenBSD. Using arp on Linux, FreeBSD,
     NetBSD and OpenBSD. Based on patch by Takayuki Shimizukawa.

   - bpo-30057(47): Fix potential missed signal in signal.signal().

   - bpo-31933(48): Fix Blake2 params leaf_size and node_offset on big
     endian platforms.  Patch by Jack O'Connor.

   - bpo-21423(49): Add an initializer argument to
     {Process,Thread}PoolExecutor

   - bpo-31927(50): Fixed compilation of the socket module on NetBSD 8.
     Fixed assertion failure or reading arbitrary data when parse a
     AF_BLUETOOTH address on NetBSD and DragonFly BSD.

   - bpo-27666(51): Fixed stack corruption in curses.box() and
     curses.ungetmouse() when the size of types chtype or mmask_t is
     less than the size of C long.  curses.box() now accepts characters
     as arguments.  Based on patch by Steve Fink.

   - bpo-31917(52): Add 3 new clock identifiers: *note
     time.CLOCK_BOOTTIME: d87, *note time.CLOCK_PROF: d88. and *note
     time.CLOCK_UPTIME: d89.

   - bpo-31897(53): plistlib now catches more errors when read binary
     plists and raises InvalidFileException instead of unexpected
     exceptions.

   - bpo-25720(54): Fix the method for checking pad state of curses
     WINDOW. Patch by Masayuki Yamamoto.

   - bpo-31893(55): Fixed the layout of the kqueue_event structure on
     OpenBSD and NetBSD. Fixed the comparison of the kqueue_event
     objects.

   - bpo-31891(56): Fixed building the curses module on NetBSD.

   - bpo-31884(57): added required constants to subprocess module for
     setting priority on windows

   - bpo-28281(58): Remove year (1-9999) limits on the
     Calendar.weekday() function.  Patch by Mark Gollahon.

   - bpo-31702(59): crypt.mksalt() now allows to specify the number of
     rounds for SHA-256 and SHA-512 hashing.

   - bpo-30639(60): *note inspect.getfile(): 1e85. no longer computes
     the repr of unknown objects to display in an error message, to
     protect against badly behaved custom reprs.

   - bpo-30768(61): Fix the pthread+semaphore implementation of
     PyThread_acquire_lock_timed() when called with timeout > 0 and
     intr_flag=0: recompute the timeout if sem_timedwait() is
     interrupted by a signal (EINTR). See also the PEP 475(62).

   - bpo-31854(63): Add ‘mmap.ACCESS_DEFAULT’ constant.

   - bpo-31834(64): Use optimized code for BLAKE2 only with SSSE3+.  The
     pure SSE2 implementation is slower than the pure C reference
     implementation.

   - bpo-28292(65): Calendar.itermonthdates() will now consistently
     raise an exception when a date falls outside of the 0001-01-01
     through 9999-12-31 range.  To support applications that cannot
     tolerate such exceptions, the new methods itermonthdays3() and
     itermonthdays4() are added.  The new methods return tuples and are
     not restricted by the range supported by datetime.date.

   - bpo-28564(66): The shutil.rmtree() function has been sped up to
     20-40%.  This was done using the os.scandir() function.

   - bpo-28416(67): Instances of pickle.Pickler subclass with the
     persistent_id() method and pickle.Unpickler subclass with the
     persistent_load() method no longer create reference cycles.

   - bpo-31653(68): Don't release the GIL if we can acquire a
     multiprocessing semaphore immediately.

   - bpo-28326(69): Fix multiprocessing.Process when stdout and/or
     stderr is closed or None.

   - bpo-20825(70): Add ‘subnet_of’ and ‘superset_of’ containment tests
     to *note ipaddress.IPv6Network: 50f. and *note
     ipaddress.IPv4Network: 50e.  Patch by Michel Albert and Cheryl
     Sabella.

   - bpo-31827(71): Remove the os.stat_float_times() function.  It was
     introduced in Python 2.3 for backward compatibility with Python
     2.2, and was deprecated since Python 3.1.

   - bpo-31756(72): Add a ‘subprocess.Popen(text=False)’ keyword
     argument to ‘subprocess’ functions to be more explicit about when
     the library should attempt to decode outputs into text.  Patch by
     Andrew Clegg.

   - bpo-31819(73): Add AbstractEventLoop.sock_recv_into().

   - bpo-31457(74): If nested log adapters are used, the inner
     ‘process()’ methods are no longer omitted.

   - bpo-31457(75): The ‘manager’ property on LoggerAdapter objects is
     now properly settable.

   - bpo-31806(76): Fix timeout rounding in time.sleep(),
     threading.Lock.acquire() and socket.socket.settimeout() to round
     correctly negative timeouts between -1.0 and 0.0.  The functions
     now block waiting for events as expected.  Previously, the call was
     incorrectly non-blocking.  Patch by Pablo Galindo.

   - bpo-31803(77): time.clock() and time.get_clock_info('clock') now
     emit a DeprecationWarning warning.

   - bpo-31800(78): Extended support for parsing UTC offsets.  strptime
     '%z' can now parse the output generated by datetime.isoformat,
     including seconds and microseconds.

   - bpo-28603(79): traceback: Fix a TypeError that occurred during
     printing of exception tracebacks when either the current exception
     or an exception in its context/cause chain is unhashable.  Patch by
     Zane Bitter.

   - bpo-30541(80): Add new function to seal a mock and prevent the
     automatically creation of child mocks.  Patch by Mario Corchero.

   - bpo-31784(81): Implement the PEP 564(82), add new 6 new functions
     with nanosecond resolution to the *note time: f4. module: *note
     clock_gettime_ns(): cdb, *note clock_settime_ns(): cdc, *note
     monotonic_ns(): cdd, *note perf_counter_ns(): cde, *note
     process_time_ns(): cdf, *note time_ns(): ce0.

   - bpo-30143(83): 2to3 now generates a code that uses abstract
     collection classes from collections.abc rather than collections.

   - bpo-31770(84): Prevent a crash when calling the ‘__init__()’ method
     of a ‘sqlite3.Cursor’ object more than once.  Patch by Oren Milman.

   - bpo-31764(85): Prevent a crash in ‘sqlite3.Cursor.close()’ in case
     the ‘Cursor’ object is uninitialized.  Patch by Oren Milman.

   - bpo-31752(86): Fix possible crash in timedelta constructor called
     with custom integers.

   - bpo-31620(87): an empty asyncio.Queue now doesn't leak memory when
     queue.get pollers timeout

   - bpo-31690(88): Allow the flags re.ASCII, re.LOCALE, and re.UNICODE
     to be used as group flags for regular expressions.

   - bpo-30349(89): FutureWarning is now emitted if a regular expression
     contains character set constructs that will change semantically in
     the future (nested sets and set operations).

   - bpo-31664(90): Added support for the Blowfish hashing in the crypt
     module.

   - bpo-31632(91): Fix method set_protocol() of class
     _SSLProtocolTransport in asyncio module.  This method was
     previously modifying a wrong reference to the protocol.

   - bpo-15037(92): Added a workaround for getkey() in curses for
     ncurses 5.7 and earlier.

   - bpo-31307(93): Allow use of bytes objects for arguments to *note
     configparser.ConfigParser.read(): 1681.  Patch by Vincent Michel.

   - bpo-31334(94): Fix ‘poll.poll([timeout])’ in the ‘select’ module
     for arbitrary negative timeouts on all OSes where it can only be a
     non-negative integer or -1.  Patch by Riccardo Coccioli.

   - bpo-31310(95): multiprocessing's semaphore tracker should be
     launched again if crashed.

   - bpo-31308(96): Make multiprocessing's forkserver process immune to
     Ctrl-C and other user interruptions.  If it crashes, restart it
     when necessary.

   - bpo-31245(97): Added support for AF_UNIX socket in asyncio
     ‘create_datagram_endpoint’.

   - bpo-30553(98): Add HTTP/2 status code 421 (Misdirected Request) to
     *note http.HTTPStatus: afc.  Patch by Vitor Pereira.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32214

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27240

   (4) https://bugs.python.org/issue?@action=redirect&bpo=30788

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31831

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32182

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32186

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32101

   (9) https://bugs.python.org/issue?@action=redirect&bpo=32154

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32089

   (11) https://bugs.python.org/issue?@action=redirect&bpo=32107

   (12) https://bugs.python.org/issue?@action=redirect&bpo=23033

   (13) https://bugs.python.org/issue?@action=redirect&bpo=12239

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28334

   (15) https://bugs.python.org/issue?@action=redirect&bpo=32121

   (16) https://bugs.python.org/issue?@action=redirect&bpo=31325

   (17) https://bugs.python.org/issue?@action=redirect&bpo=12382

   (18) https://bugs.python.org/issue?@action=redirect&bpo=19610

   (19) https://bugs.python.org/issue?@action=redirect&bpo=32071

   (20) https://bugs.python.org/issue?@action=redirect&bpo=10049

   (21) https://bugs.python.org/issue?@action=redirect&bpo=28684

   (22) https://bugs.python.org/issue?@action=redirect&bpo=32110

   (23) https://bugs.python.org/issue?@action=redirect&bpo=27535

   (24) https://bugs.python.org/issue?@action=redirect&bpo=32088

   (25) https://bugs.python.org/issue?@action=redirect&bpo=1647489

   (26) https://bugs.python.org/issue?@action=redirect&bpo=25054

   (27) https://bugs.python.org/issue?@action=redirect&bpo=32072

   (28) https://bugs.python.org/issue?@action=redirect&bpo=32069

   (29) https://bugs.python.org/issue?@action=redirect&bpo=32066

   (30) https://bugs.python.org/issue?@action=redirect&bpo=32046

   (31) https://bugs.python.org/issue?@action=redirect&bpo=32018

   (32) https://peps.python.org/pep-0008/

   (33) https://bugs.python.org/issue?@action=redirect&bpo=32025

   (34) https://bugs.python.org/issue?@action=redirect&bpo=32037

   (35) https://bugs.python.org/issue?@action=redirect&bpo=32034

   (36) https://bugs.python.org/issue?@action=redirect&bpo=32015

   (37) https://bugs.python.org/issue?@action=redirect&bpo=32011

   (38) https://bugs.python.org/issue?@action=redirect&bpo=28369

   (39) https://bugs.python.org/issue?@action=redirect&bpo=31976

   (40) https://bugs.python.org/issue?@action=redirect&bpo=31985

   (41) https://bugs.python.org/issue?@action=redirect&bpo=21862

   (42) https://bugs.python.org/issue?@action=redirect&bpo=31970

   (43) https://bugs.python.org/issue?@action=redirect&bpo=31843

   (44) https://bugs.python.org/issue?@action=redirect&bpo=31945

   (45) https://bugs.python.org/issue?@action=redirect&bpo=31943

   (46) https://bugs.python.org/issue?@action=redirect&bpo=9678

   (47) https://bugs.python.org/issue?@action=redirect&bpo=30057

   (48) https://bugs.python.org/issue?@action=redirect&bpo=31933

   (49) https://bugs.python.org/issue?@action=redirect&bpo=21423

   (50) https://bugs.python.org/issue?@action=redirect&bpo=31927

   (51) https://bugs.python.org/issue?@action=redirect&bpo=27666

   (52) https://bugs.python.org/issue?@action=redirect&bpo=31917

   (53) https://bugs.python.org/issue?@action=redirect&bpo=31897

   (54) https://bugs.python.org/issue?@action=redirect&bpo=25720

   (55) https://bugs.python.org/issue?@action=redirect&bpo=31893

   (56) https://bugs.python.org/issue?@action=redirect&bpo=31891

   (57) https://bugs.python.org/issue?@action=redirect&bpo=31884

   (58) https://bugs.python.org/issue?@action=redirect&bpo=28281

   (59) https://bugs.python.org/issue?@action=redirect&bpo=31702

   (60) https://bugs.python.org/issue?@action=redirect&bpo=30639

   (61) https://bugs.python.org/issue?@action=redirect&bpo=30768

   (62) https://peps.python.org/pep-0475/

   (63) https://bugs.python.org/issue?@action=redirect&bpo=31854

   (64) https://bugs.python.org/issue?@action=redirect&bpo=31834

   (65) https://bugs.python.org/issue?@action=redirect&bpo=28292

   (66) https://bugs.python.org/issue?@action=redirect&bpo=28564

   (67) https://bugs.python.org/issue?@action=redirect&bpo=28416

   (68) https://bugs.python.org/issue?@action=redirect&bpo=31653

   (69) https://bugs.python.org/issue?@action=redirect&bpo=28326

   (70) https://bugs.python.org/issue?@action=redirect&bpo=20825

   (71) https://bugs.python.org/issue?@action=redirect&bpo=31827

   (72) https://bugs.python.org/issue?@action=redirect&bpo=31756

   (73) https://bugs.python.org/issue?@action=redirect&bpo=31819

   (74) https://bugs.python.org/issue?@action=redirect&bpo=31457

   (75) https://bugs.python.org/issue?@action=redirect&bpo=31457

   (76) https://bugs.python.org/issue?@action=redirect&bpo=31806

   (77) https://bugs.python.org/issue?@action=redirect&bpo=31803

   (78) https://bugs.python.org/issue?@action=redirect&bpo=31800

   (79) https://bugs.python.org/issue?@action=redirect&bpo=28603

   (80) https://bugs.python.org/issue?@action=redirect&bpo=30541

   (81) https://bugs.python.org/issue?@action=redirect&bpo=31784

   (82) https://peps.python.org/pep-0564/

   (83) https://bugs.python.org/issue?@action=redirect&bpo=30143

   (84) https://bugs.python.org/issue?@action=redirect&bpo=31770

   (85) https://bugs.python.org/issue?@action=redirect&bpo=31764

   (86) https://bugs.python.org/issue?@action=redirect&bpo=31752

   (87) https://bugs.python.org/issue?@action=redirect&bpo=31620

   (88) https://bugs.python.org/issue?@action=redirect&bpo=31690

   (89) https://bugs.python.org/issue?@action=redirect&bpo=30349

   (90) https://bugs.python.org/issue?@action=redirect&bpo=31664

   (91) https://bugs.python.org/issue?@action=redirect&bpo=31632

   (92) https://bugs.python.org/issue?@action=redirect&bpo=15037

   (93) https://bugs.python.org/issue?@action=redirect&bpo=31307

   (94) https://bugs.python.org/issue?@action=redirect&bpo=31334

   (95) https://bugs.python.org/issue?@action=redirect&bpo=31310

   (96) https://bugs.python.org/issue?@action=redirect&bpo=31308

   (97) https://bugs.python.org/issue?@action=redirect&bpo=31245

   (98) https://bugs.python.org/issue?@action=redirect&bpo=30553


File: python.info,  Node: ドキュメント<64>,  Next: テスト<61>,  Prev: ライブラリ<171>,  Up: Python 3 7 0 alpha 3

1.24.71.3 ドキュメント
......................

   - bpo-32105(1): Added asyncio.BaseEventLoop.connect_accepted_socket
     versionadded marker.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32105


File: python.info,  Node: テスト<61>,  Next: ビルド<68>,  Prev: ドキュメント<64>,  Up: Python 3 7 0 alpha 3

1.24.71.4 テスト
................

   - bpo-31380(1): Skip test_httpservers test_undecodable_file on macOS:
     fails on APFS.

   - bpo-31705(2): Skip test_socket.test_sha256() on Linux kernel older
     than 4.5.  The test fails with ENOKEY on kernel 3.10 (on ppc64le).
     A fix was merged into the kernel 4.5.

   - bpo-32138(3): Skip on Android test_faulthandler tests that raise
     SIGSEGV and remove the test.support.requires_android_level
     decorator.

   - bpo-32136(4): The runtime embedding tests have been split out from
     ‘Lib/test/test_capi.py’ into a new ‘Lib/test/test_embed.py’ file.

   - bpo-28668(5): test.support.requires_multiprocessing_queue is
     removed.  Skip tests with
     test.support.import_module('multiprocessing.synchronize') instead
     when the semaphore implementation is broken or missing.

   - bpo-32126(6): Skip test_get_event_loop_new_process in
     test.test_asyncio.test_events when sem_open() is not functional.

   - bpo-31174(7): Fix test_tools.test_unparse: DirectoryTestCase now
     stores the names sample to always test the same files.  It prevents
     false alarms when hunting reference leaks.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31380

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31705

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32138

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32136

   (5) https://bugs.python.org/issue?@action=redirect&bpo=28668

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32126

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31174


File: python.info,  Node: ビルド<68>,  Next: Windows<62>,  Prev: テスト<61>,  Up: Python 3 7 0 alpha 3

1.24.71.5 ビルド
................

   - bpo-28538(1): Revert the previous changes, the if_nameindex
     structure is defined by Unified Headers.

   - bpo-28762(2): Revert the last commit, the F_LOCK macro is defined
     by Android Unified Headers.

   - bpo-29040(3): Support building Android with Unified Headers.  The
     first NDK release to support Unified Headers is android-ndk-r14.

   - bpo-32059(4): ‘detect_modules()’ in ‘setup.py’ now also searches
     the sysroot paths when cross-compiling.

   - bpo-31957(5): Fixes Windows SDK version detection when building for
     Windows.

   - bpo-31609(6): Fixes quotes in PCbuild/clean.bat

   - bpo-31934(7): Abort the build when building out of a not clean
     source tree.

   - bpo-31926(8): Fixed Argument Clinic sometimes causing compilation
     errors when there was more than one function and/or method in a .c
     file with the same name.

   - bpo-28791(9): Update Windows builds to use SQLite 3.21.0.

   - bpo-28791(10): Update OS X installer to use SQLite 3.21.0.

   - bpo-28643(11): Record profile-opt build progress with stamp files.

   - bpo-31866(12): Finish removing support for AtheOS.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28538

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28762

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29040

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32059

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31957

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31609

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31934

   (8) https://bugs.python.org/issue?@action=redirect&bpo=31926

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28791

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28791

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28643

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31866


File: python.info,  Node: Windows<62>,  Next: macOS<48>,  Prev: ビルド<68>,  Up: Python 3 7 0 alpha 3

1.24.71.6 Windows
.................

   - bpo-1102(1): Return ‘None’ when ‘View.Fetch()’ returns
     ‘ERROR_NO_MORE_ITEMS’ instead of raising ‘MSIError’.  Initial patch
     by Anthony Tuininga.

   - bpo-31944(2): Fixes Modify button in Apps and Features dialog.

   - bpo-20486(3): Implement the ‘Database.Close()’ method to help
     closing MSI database objects.

   - bpo-31857(4): Make the behavior of USE_STACKCHECK deterministic in
     a multi-threaded environment.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1102

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31944

   (3) https://bugs.python.org/issue?@action=redirect&bpo=20486

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31857


File: python.info,  Node: macOS<48>,  Next: IDLE<43>,  Prev: Windows<62>,  Up: Python 3 7 0 alpha 3

1.24.71.7 macOS
...............

   - bpo-31392(1): Update macOS installer to use OpenSSL 1.0.2m

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31392


File: python.info,  Node: IDLE<43>,  Next: Tools/Demos<42>,  Prev: macOS<48>,  Up: Python 3 7 0 alpha 3

1.24.71.8 IDLE
..............

   - bpo-32207(1): Improve tk event exception tracebacks in IDLE. When
     tk event handling is driven by IDLE's run loop, a confusing and
     distracting queue.EMPTY traceback context is no longer added to tk
     event exception tracebacks.  The traceback is now the same as when
     event handling is driven by user code.  Patch based on a suggestion
     by Serhiy Storchaka.

   - bpo-32164(2): Delete unused file idlelib/tabbedpages.py.  Use of
     TabbedPageSet in configdialog was replaced by ttk.Notebook.

   - bpo-32100(3): IDLE: Fix old and new bugs in pathbrowser; improve
     tests.  Patch mostly by Cheryl Sabella.

   - bpo-31858(4): IDLE - Restrict shell prompt manipulation to the
     shell.  Editor and output windows only see an empty last prompt
     line.  This simplifies the code and fixes a minor bug when newline
     is inserted.  Sys.ps1, if present, is read on Shell start-up, but
     is not set or changed.

   - bpo-31860(5): The font sample in the IDLE configuration dialog is
     now editable.  Changes persist while IDLE remains open

   - bpo-31836(6): Test_code_module now passes if run after test_idle,
     which sets ps1.  The code module uses sys.ps1 if present or sets it
     to '>>> ' if not.  Test_code_module now properly tests both
     behaviors.  Ditto for ps2.

   - bpo-28603(7): Fix a TypeError that caused a shell restart when
     printing a traceback that includes an exception that is unhashable.
     Patch by Zane Bitter.

   - bpo-13802(8): Use non-Latin characters in the IDLE's Font settings
     sample.  Even if one selects a font that defines a limited subset
     of the unicode Basic Multilingual Plane, tcl/tk will use other
     fonts that define a character.  The expanded example give users of
     non-Latin characters a better idea of what they might see in IDLE's
     shell and editors.  To make room for the expanded sample, frames on
     the Font tab are re-arranged.  The Font/Tabs help explains a bit
     about the additions.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32207

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32164

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32100

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31858

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31860

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31836

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28603

   (8) https://bugs.python.org/issue?@action=redirect&bpo=13802


File: python.info,  Node: Tools/Demos<42>,  Next: C API<61>,  Prev: IDLE<43>,  Up: Python 3 7 0 alpha 3

1.24.71.9 Tools/Demos
.....................

   - bpo-32159(1): Remove CVS and Subversion tools: remove svneol.py and
     treesync.py scripts.  CPython migrated from CVS to Subversion, to
     Mercurial, and then to Git.  CVS and Subversion are no longer used
     to develop CPython.

   - bpo-30722(2): Make redemo work with Python 3.6 and newer versions.
     Also, remove the ‘LOCALE’ option since it doesn't work with string
     patterns in Python 3.  Patch by Christoph Sarnowski.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32159

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30722


File: python.info,  Node: C API<61>,  Prev: Tools/Demos<42>,  Up: Python 3 7 0 alpha 3

1.24.71.10 C API
................

   - bpo-20891(1): Fix PyGILState_Ensure().  When PyGILState_Ensure() is
     called in a non-Python thread before PyEval_InitThreads(), only
     call PyEval_InitThreads() after calling PyThreadState_New() to fix
     a crash.

   - bpo-32125(2): The ‘Py_UseClassExceptionsFlag’ flag has been
     removed.  It was deprecated and wasn't used anymore since Python
     2.0.

   - bpo-25612(3): Move the current exception state from the frame
     object to the co-routine.  This simplifies the interpreter and
     fixes a couple of obscure bugs caused by having swap exception
     state when entering or exiting a generator.

   - bpo-23699(4): Add Py_RETURN_RICHCOMPARE macro to reduce boilerplate
     code in rich comparison functions.

   - bpo-30697(5): The ‘PyExc_RecursionErrorInst’ singleton is removed
     and ‘PyErr_NormalizeException()’ does not use it anymore.  This
     singleton is persistent and its members being never cleared may
     cause a segfault during finalization of the interpreter.  See also
     bpo-22898(6).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20891

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32125

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25612

   (4) https://bugs.python.org/issue?@action=redirect&bpo=23699

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30697

   (6) https://bugs.python.org/issue?@action=redirect&bpo=22898


File: python.info,  Node: Python 3 7 0 alpha 2,  Next: Python 3 7 0 alpha 1,  Prev: Python 3 7 0 alpha 3,  Up: 変更履歴

1.24.72 Python 3.7.0 alpha 2
----------------------------

'Release date: 2017-10-16'

* Menu:

* Core and Builtins: Core and Builtins<168>.
* ライブラリ: ライブラリ<172>.
* ドキュメント: ドキュメント<65>.
* ビルド: ビルド<69>.
* IDLE: IDLE<44>.
* C API: C API<62>.


File: python.info,  Node: Core and Builtins<168>,  Next: ライブラリ<172>,  Up: Python 3 7 0 alpha 2

1.24.72.1 Core and Builtins
...........................

   - bpo-31558(1): ‘gc.freeze()’ is a new API that allows for moving all
     objects currently tracked by the garbage collector to a permanent
     generation, effectively removing them from future collection
     events.  This can be used to protect those objects from having
     their PyGC_Head mutated.  In effect, this enables great
     copy-on-write stability at fork().

   - bpo-31642(2): Restored blocking "from package import module" by
     setting sys.modules["package.module"] to None.

   - bpo-31708(3): Allow use of asynchronous generator expressions in
     synchronous functions.

   - bpo-31709(4): Drop support of asynchronous __aiter__.

   - bpo-30404(5): The -u option now makes the stdout and stderr streams
     unbuffered rather than line-buffered.

   - bpo-31619(6): Fixed a ValueError when convert a string with large
     number of underscores to integer with binary base.

   - bpo-31602(7): Fix an assertion failure in
     ‘zipimporter.get_source()’ in case of a bad ‘zlib.decompress()’.
     Patch by Oren Milman.

   - bpo-31592(8): Fixed an assertion failure in Python parser in case
     of a bad ‘unicodedata.normalize()’.  Patch by Oren Milman.

   - bpo-31588(9): Raise a ‘TypeError’ with a helpful error message when
     class creation fails due to a metaclass with a bad ‘__prepare__()’
     method.  Patch by Oren Milman.

   - bpo-31574(10): Importlib was instrumented with two dtrace probes to
     profile import timing.

   - bpo-31566(11): Fix an assertion failure in ‘_warnings.warn()’ in
     case of a bad ‘__name__’ global.  Patch by Oren Milman.

   - bpo-31506(12): Improved the error message logic for
     ‘object.__new__’ and ‘object.__init__’.

   - bpo-31505(13): Fix an assertion failure in ‘json’, in case
     ‘_json.make_encoder()’ received a bad ‘encoder()’ argument.  Patch
     by Oren Milman.

   - bpo-31492(14): Fix assertion failures in case of failing to import
     from a module with a bad ‘__name__’ attribute, and in case of
     failing to access an attribute of such a module.  Patch by Oren
     Milman.

   - bpo-31478(15): Fix an assertion failure in ‘_random.Random.seed()’
     in case the argument has a bad ‘__abs__()’ method.  Patch by Oren
     Milman.

   - bpo-31336(16): Speed up class creation by 10-20% by reducing the
     overhead in the necessary special method lookups.  Patch by Stefan
     Behnel.

   - bpo-31415(17): Add ‘-X importtime’ option to show how long each
     import takes.  It can be used to optimize application's startup
     time.  Support the *note PYTHONPROFILEIMPORTTIME: ced. as an
     equivalent way to enable this.

   - bpo-31410(18): Optimized calling wrapper and classmethod
     descriptors.

   - bpo-31353(19): PEP 553(20) - Add a new built-in called
     ‘breakpoint()’ which calls ‘sys.breakpointhook()’.  By default this
     imports ‘pdb’ and calls ‘pdb.set_trace()’, but users may override
     ‘sys.breakpointhook()’ to call whatever debugger they want.  The
     original value of the hook is saved in ‘sys.__breakpointhook__’.

   - bpo-17852(21): Maintain a list of open buffered files, flush them
     before exiting the interpreter.  Based on a patch from Armin Rigo.

   - bpo-31315(22): Fix an assertion failure in imp.create_dynamic(),
     when spec.name is not a string.  Patch by Oren Milman.

   - bpo-31311(23): Fix a crash in the ‘__setstate__()’ method of
     ‘ctypes._CData’, in case of a bad ‘__dict__’.  Patch by Oren
     Milman.

   - bpo-31293(24): Fix crashes in true division and multiplication of a
     timedelta object by a float with a bad as_integer_ratio() method.
     Patch by Oren Milman.

   - bpo-31285(25): Fix an assertion failure in
     ‘warnings.warn_explicit’, when the return value of the received
     loader's ‘get_source()’ has a bad ‘splitlines()’ method.  Patch by
     Oren Milman.

   - bpo-30406(26): Make ‘async’ and ‘await’ proper keywords, as
     specified in PEP 492(27).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31558

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31642

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31708

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31709

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30404

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31619

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31602

   (8) https://bugs.python.org/issue?@action=redirect&bpo=31592

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31588

   (10) https://bugs.python.org/issue?@action=redirect&bpo=31574

   (11) https://bugs.python.org/issue?@action=redirect&bpo=31566

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31506

   (13) https://bugs.python.org/issue?@action=redirect&bpo=31505

   (14) https://bugs.python.org/issue?@action=redirect&bpo=31492

   (15) https://bugs.python.org/issue?@action=redirect&bpo=31478

   (16) https://bugs.python.org/issue?@action=redirect&bpo=31336

   (17) https://bugs.python.org/issue?@action=redirect&bpo=31415

   (18) https://bugs.python.org/issue?@action=redirect&bpo=31410

   (19) https://bugs.python.org/issue?@action=redirect&bpo=31353

   (20) https://peps.python.org/pep-0553/

   (21) https://bugs.python.org/issue?@action=redirect&bpo=17852

   (22) https://bugs.python.org/issue?@action=redirect&bpo=31315

   (23) https://bugs.python.org/issue?@action=redirect&bpo=31311

   (24) https://bugs.python.org/issue?@action=redirect&bpo=31293

   (25) https://bugs.python.org/issue?@action=redirect&bpo=31285

   (26) https://bugs.python.org/issue?@action=redirect&bpo=30406

   (27) https://peps.python.org/pep-0492/


File: python.info,  Node: ライブラリ<172>,  Next: ドキュメント<65>,  Prev: Core and Builtins<168>,  Up: Python 3 7 0 alpha 2

1.24.72.2 ライブラリ
....................

   - bpo-30058(1): Fixed buffer overflow in select.kqueue.control().

   - bpo-31672(2): ‘idpattern’ in ‘string.Template’ matched some
     non-ASCII characters.  Now it uses ‘-i’ regular expression local
     flag to avoid non-ASCII characters.

   - bpo-31701(3): On Windows, faulthandler.enable() now ignores MSC and
     COM exceptions.

   - bpo-31728(4): Prevent crashes in ‘_elementtree’ due to unsafe
     cleanup of ‘Element.text’ and ‘Element.tail’.  Patch by Oren
     Milman.

   - bpo-31671(5): Now ‘re.compile()’ converts passed RegexFlag to
     normal int object before compiling.  bm_regex_compile benchmark
     shows 14% performance improvements.

   - bpo-30397(6): The types of compiled regular objects and match
     objects are now exposed as ‘re.Pattern’ and ‘re.Match’.  This adds
     information in pydoc output for the ‘re’ module.

   - bpo-31675(7): Fixed memory leaks in Tkinter's methods splitlist()
     and split() when pass a string larger than 2 GiB.

   - bpo-31673(8): Fixed typo in the name of Tkinter's method
     adderrorinfo().

   - bpo-31648(9): Improvements to path predicates in ElementTree: Allow
     whitespace around predicate parts, i.e.  "[a = 'text']" instead of
     requiring the less readable "[a='text']".  Add support for text
     comparison of the current node, like "[.='text']".  Patch by Stefan
     Behnel.

   - bpo-30806(10): Fix the string representation of a netrc object.

   - bpo-31638(11): Add optional argument ‘compressed’ to
     ‘zipapp.create_archive’, and add option ‘--compress’ to the command
     line interface of ‘zipapp’.

   - bpo-25351(12): Avoid venv activate failures with undefined
     variables

   - bpo-20519(13): Avoid ctypes use (if possible) and improve import
     time for uuid.

   - bpo-28293(14): The regular expression cache is no longer completely
     dumped when it is full.

   - bpo-31596(15): Added pthread_getcpuclockid() to the time module

   - bpo-27494(16): Make 2to3 accept a trailing comma in generator
     expressions.  For example, ‘set(x for x in [],)’ is now allowed.

   - bpo-30347(17): Stop crashes when concurrently iterate over
     itertools.groupby() iterators.

   - bpo-30346(18): An iterator produced by itertools.groupby() iterator
     now becomes exhausted after advancing the groupby iterator.

   - bpo-31556(19): Cancel asyncio.wait_for future faster if timeout <=
     0

   - bpo-31540(20): Allow passing a context object in *note
     concurrent.futures.ProcessPoolExecutor: 1d6. constructor.  Also,
     free job resources in *note concurrent.futures.ProcessPoolExecutor:
     1d6. earlier to improve memory usage when a worker waits for new
     jobs.

   - bpo-31516(21): ‘threading.current_thread()’ should not return a
     dummy thread at shutdown.

   - bpo-31525(22): In the sqlite module, require the sqlite3_prepare_v2
     API. Thus, the sqlite module now requires sqlite version at least
     3.3.9.

   - bpo-26510(23): argparse subparsers are now required by default.
     This matches behaviour in Python 2.  For optional subparsers, use
     the new parameter ‘add_subparsers(required=False)’.  Patch by
     Anthony Sottile.  (As of 3.7.0rc1, the default was changed to not
     required as had been the case since Python 3.3.)

   - bpo-27541(24): Reprs of subclasses of some collection and iterator
     classes (‘bytearray’, ‘array.array’, ‘collections.deque’,
     ‘collections.defaultdict’, ‘itertools.count’, ‘itertools.repeat’)
     now contain actual type name instead of hardcoded names of the base
     class.

   - bpo-31351(25): python -m ensurepip now exits with non-zero exit
     code if pip bootstrapping has failed.

   - bpo-31389(26): ‘pdb.set_trace()’ now takes an optional keyword-only
     argument ‘header’.  If given, this is printed to the console just
     before debugging begins.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30058

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31672

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31701

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31728

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31671

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30397

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31675

   (8) https://bugs.python.org/issue?@action=redirect&bpo=31673

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31648

   (10) https://bugs.python.org/issue?@action=redirect&bpo=30806

   (11) https://bugs.python.org/issue?@action=redirect&bpo=31638

   (12) https://bugs.python.org/issue?@action=redirect&bpo=25351

   (13) https://bugs.python.org/issue?@action=redirect&bpo=20519

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28293

   (15) https://bugs.python.org/issue?@action=redirect&bpo=31596

   (16) https://bugs.python.org/issue?@action=redirect&bpo=27494

   (17) https://bugs.python.org/issue?@action=redirect&bpo=30347

   (18) https://bugs.python.org/issue?@action=redirect&bpo=30346

   (19) https://bugs.python.org/issue?@action=redirect&bpo=31556

   (20) https://bugs.python.org/issue?@action=redirect&bpo=31540

   (21) https://bugs.python.org/issue?@action=redirect&bpo=31516

   (22) https://bugs.python.org/issue?@action=redirect&bpo=31525

   (23) https://bugs.python.org/issue?@action=redirect&bpo=26510

   (24) https://bugs.python.org/issue?@action=redirect&bpo=27541

   (25) https://bugs.python.org/issue?@action=redirect&bpo=31351

   (26) https://bugs.python.org/issue?@action=redirect&bpo=31389


File: python.info,  Node: ドキュメント<65>,  Next: ビルド<69>,  Prev: ライブラリ<172>,  Up: Python 3 7 0 alpha 2

1.24.72.3 ドキュメント
......................

   - bpo-31537(1): Fix incorrect usage of ‘get_history_length’ in
     readline documentation example code.  Patch by Brad Smith.

   - bpo-30085(2): The operator functions without double underscores are
     preferred for clarity.  The one with underscores are only kept for
     back-compatibility.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31537

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30085


File: python.info,  Node: ビルド<69>,  Next: IDLE<44>,  Prev: ドキュメント<65>,  Up: Python 3 7 0 alpha 2

1.24.72.4 ビルド
................

   - bpo-31696(1): Improve compiler version information in *note
     sys.version: 49c. when Python is built with Clang.

   - bpo-31625(2): Stop using ranlib on static libraries.  Instead, we
     assume ar supports the 's' flag.

   - bpo-31624(3): Remove support for BSD/OS.

   - bpo-22140(4): Prevent double substitution of prefix in
     python-config.sh.

   - bpo-31569(5): Correct PCBuild/ case to PCbuild/ in build scripts
     and documentation.

   - bpo-31536(6): Avoid wholesale rebuild after ‘make regen-all’ if
     nothing changed.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31696

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31625

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31624

   (4) https://bugs.python.org/issue?@action=redirect&bpo=22140

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31569

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31536


File: python.info,  Node: IDLE<44>,  Next: C API<62>,  Prev: ビルド<69>,  Up: Python 3 7 0 alpha 2

1.24.72.5 IDLE
..............

   - bpo-31460(1): Simplify the API of IDLE's Module Browser.  Passing a
     widget instead of an flist with a root widget opens the option of
     creating a browser frame that is only part of a window.  Passing a
     full file name instead of pieces assumed to come from a .py file
     opens the possibility of browsing python files that do not end in
     .py.

   - bpo-31649(2): IDLE - Make _htest, _utest parameters keyword only.

   - bpo-31559(3): Remove test order dependence in
     idle_test.test_browser.

   - bpo-31459(4): Rename IDLE's module browser from Class Browser to
     Module Browser.  The original module-level class and method browser
     became a module browser, with the addition of module-level
     functions, years ago.  Nested classes and functions were added
     yesterday.  For back-compatibility, the virtual event
     <<open-class-browser>>, which appears on the Keys tab of the
     Settings dialog, is not changed.  Patch by Cheryl Sabella.

   - bpo-31500(5): Default fonts now are scaled on HiDPI displays.

   - bpo-1612262(6): IDLE module browser now shows nested classes and
     functions.  Original patches for code and tests by Guilherme Polo
     and Cheryl Sabella, respectively.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31460

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31649

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31559

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31459

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31500

   (6) https://bugs.python.org/issue?@action=redirect&bpo=1612262


File: python.info,  Node: C API<62>,  Prev: IDLE<44>,  Up: Python 3 7 0 alpha 2

1.24.72.6 C API
...............

   - bpo-28280(1): Make ‘PyMapping_Keys()’, ‘PyMapping_Values()’ and
     ‘PyMapping_Items()’ always return a ‘list’ (rather than a ‘list’ or
     a ‘tuple’).  Patch by Oren Milman.

   - bpo-31532(2): Fix memory corruption due to allocator mix in
     getpath.c between Py_GetPath() and Py_SetPath()

   - bpo-25658(3): Implement PEP 539(4) for Thread Specific Storage
     (TSS) API: it is a new Thread Local Storage (TLS) API to CPython
     which would supersede use of the existing TLS API within the
     CPython interpreter, while deprecating the existing API. PEP
     written by Erik M. Bray, patch by Masayuki Yamamoto.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28280

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31532

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25658

   (4) https://peps.python.org/pep-0539/


File: python.info,  Node: Python 3 7 0 alpha 1,  Next: Python 3 6 6 final,  Prev: Python 3 7 0 alpha 2,  Up: 変更履歴

1.24.73 Python 3.7.0 alpha 1
----------------------------

'Release date: 2017-09-19'

* Menu:

* セキュリティ: セキュリティ<49>.
* Core and Builtins: Core and Builtins<169>.
* ライブラリ: ライブラリ<173>.
* ドキュメント: ドキュメント<66>.
* テスト: テスト<62>.
* ビルド: ビルド<70>.
* Windows: Windows<63>.
* IDLE: IDLE<45>.
* Tools/Demos: Tools/Demos<43>.
* C API: C API<63>.


File: python.info,  Node: セキュリティ<49>,  Next: Core and Builtins<169>,  Up: Python 3 7 0 alpha 1

1.24.73.1 セキュリティ
......................

   - bpo-29781(1): SSLObject.version() now correctly returns None when
     handshake over BIO has not been performed yet.

   - bpo-29505(2): Add fuzz tests for float(str), int(str),
     unicode(str); for oss-fuzz.

   - bpo-30947(3): Upgrade libexpat embedded copy from version 2.2.1 to
     2.2.3 to get security fixes.

   - bpo-30730(4): Prevent environment variables injection in subprocess
     on Windows.  Prevent passing other environment variables and
     command arguments.

   - bpo-30694(5): Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes
     of multiple security vulnerabilities including: CVE 2017-9233(6)
     (External entity infinite loop DoS), CVE 2016-9063(7) (Integer
     overflow, re-fix), CVE 2016-0718(8) (Fix regression bugs from
     2.2.0's fix to CVE 2016-0718(9)) and CVE 2012-0876(10) (Counter
     hash flooding with SipHash).  Note: the CVE 2016-5300(11) (Use
     os-specific entropy sources like getrandom) doesn't impact Python,
     since Python already gets entropy from the OS to set the expat
     secret using ‘XML_SetHashSalt()’.

   - bpo-30500(12): Fix urllib.parse.splithost() to correctly parse
     fragments.  For example, ‘splithost('//127.0.0.1#@evil.com/')’ now
     correctly returns the ‘127.0.0.1’ host, instead of treating
     ‘@evil.com’ as the host in an authentication (‘login@host’).

   - bpo-29591(13): Update expat copy from 2.1.1 to 2.2.0 to get fixes
     of CVE 2016-0718(14) and CVE 2016-4472(15).  See
     ‘https://sourceforge.net/p/expat/bugs/537/’ for more information.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29781

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29505

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30947

   (4) https://bugs.python.org/issue?@action=redirect&bpo=30730

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30694

   (6) https://www.cve.org/CVERecord?id=CVE-2017-9233

   (7) https://www.cve.org/CVERecord?id=CVE-2016-9063

   (8) https://www.cve.org/CVERecord?id=CVE-2016-0718

   (9) https://www.cve.org/CVERecord?id=CVE-2016-0718

   (10) https://www.cve.org/CVERecord?id=CVE-2012-0876

   (11) https://www.cve.org/CVERecord?id=CVE-2016-5300

   (12) https://bugs.python.org/issue?@action=redirect&bpo=30500

   (13) https://bugs.python.org/issue?@action=redirect&bpo=29591

   (14) https://www.cve.org/CVERecord?id=CVE-2016-0718

   (15) https://www.cve.org/CVERecord?id=CVE-2016-4472


File: python.info,  Node: Core and Builtins<169>,  Next: ライブラリ<173>,  Prev: セキュリティ<49>,  Up: Python 3 7 0 alpha 1

1.24.73.2 Core and Builtins
...........................

   - bpo-31490(1): Fix an assertion failure in ‘ctypes’ class
     definition, in case the class has an attribute whose name is
     specified in ‘_anonymous_’ but not in ‘_fields_’.  Patch by Oren
     Milman.

   - bpo-31471(2): Fix an assertion failure in ‘subprocess.Popen()’ on
     Windows, in case the env argument has a bad ‘keys()’ method.  Patch
     by Oren Milman.

   - bpo-31418(3): Fix an assertion failure in ‘PyErr_WriteUnraisable()’
     in case of an exception with a bad ‘__module__’ attribute.  Patch
     by Oren Milman.

   - bpo-31416(4): Fix assertion failures in case of a bad
     warnings.filters or warnings.defaultaction.  Patch by Oren Milman.

   - bpo-28411(5): Change direct usage of PyInterpreterState.modules to
     PyImport_GetModuleDict().  Also introduce more uniformity in other
     code that deals with sys.modules.  This helps reduce complications
     when working on sys.modules.

   - bpo-28411(6): Switch to the abstract API when dealing with
     ‘PyInterpreterState.modules’.  This allows later support for all
     dict subclasses and other Mapping implementations.  Also add a
     ‘PyImport_GetModule()’ function to reduce a bunch of duplicated
     code.

   - bpo-31411(7): Raise a TypeError instead of SystemError in case
     warnings.onceregistry is not a dictionary.  Patch by Oren Milman.

   - bpo-31344(8): For finer control of tracing behaviour when testing
     the interpreter, two new frame attributes have been added to
     control the emission of particular trace events: ‘f_trace_lines’
     (‘True’ by default) to turn off per-line trace events; and
     ‘f_trace_opcodes’ (‘False’ by default) to turn on per-opcode trace
     events.

   - bpo-31373(9): Fix several possible instances of undefined behavior
     due to floating-point demotions.

   - bpo-30465(10): Location information (‘lineno’ and ‘col_offset’) in
     f-strings is now (mostly) correct.  This fixes tools like flake8
     from showing warnings on the wrong line (typically the first line
     of the file).

   - bpo-30860(11): Consolidate CPython's global runtime state under a
     single struct.  This improves discoverability of the runtime state.

   - bpo-31347(12): Fix possible undefined behavior in
     _PyObject_FastCall_Prepend.

   - bpo-31343(13): Include sys/sysmacros.h for major(), minor(), and
     makedev().  GNU C library plans to remove the functions from
     sys/types.h.

   - bpo-31291(14): Fix an assertion failure in
     ‘zipimport.zipimporter.get_data’ on Windows, when the return value
     of ‘pathname.replace('/','\\')’ isn't a string.  Patch by Oren
     Milman.

   - bpo-31271(15): Fix an assertion failure in the ‘write()’ method of
     ‘io.TextIOWrapper’, when the encoder doesn't return a bytes object.
     Patch by Oren Milman.

   - bpo-31243(16): Fix a crash in some methods of ‘io.TextIOWrapper’,
     when the decoder's state is invalid.  Patch by Oren Milman.

   - bpo-30721(17): ‘print’ now shows correct usage hint for using
     Python 2 redirection syntax.  Patch by Sanyam Khurana.

   - bpo-31070(18): Fix a race condition in importlib
     _get_module_lock().

   - bpo-30747(19): Add a non-dummy implementation of _Py_atomic_store
     and _Py_atomic_load on MSVC.

   - bpo-31095(20): Fix potential crash during GC caused by ‘tp_dealloc’
     which doesn't call ‘PyObject_GC_UnTrack()’.

   - bpo-31071(21): Avoid masking original TypeError in call with *
     unpacking when other arguments are passed.

   - bpo-30978(22): str.format_map() now passes key lookup exceptions
     through.  Previously any exception was replaced with a KeyError
     exception.

   - bpo-30808(23): Use _Py_atomic API for concurrency-sensitive signal
     state.

   - bpo-30876(24): Relative import from unloaded package now reimports
     the package instead of failing with SystemError.  Relative import
     from non-package now fails with ImportError rather than
     SystemError.

   - bpo-30703(25): Improve signal delivery.  Avoid using
     Py_AddPendingCall from signal handler, to avoid calling
     signal-unsafe functions.  The tests I'm adding here fail without
     the rest of the patch, on Linux and OS X. This means our signal
     delivery logic had defects (some signals could be lost).

   - bpo-30765(26): Avoid blocking in pthread_mutex_lock() when
     PyThread_acquire_lock() is asked not to block.

   - bpo-31161(27): Make sure the 'Missing parentheses' syntax error
     message is only applied to SyntaxError, not to subclasses.  Patch
     by Martijn Pieters.

   - bpo-30814(28): Fixed a race condition when import a submodule from
     a package.

   - bpo-30736(29): The internal unicodedata database has been upgraded
     to Unicode 10.0.

   - bpo-30604(30): Move co_extra_freefuncs from per-thread to
     per-interpreter to avoid crashes.

   - bpo-30597(31): ‘print’ now shows expected input in custom error
     message when used as a Python 2 statement.  Patch by Sanyam
     Khurana.

   - bpo-30682(32): Removed a too-strict assertion that failed for
     certain f-strings, such as eval("f'\n'") and eval("f'\r'").

   - bpo-30501(33): The compiler now produces more optimal code for
     complex condition expressions in the "if", "while" and "assert"
     statement, the "if" expression, and generator expressions and
     comprehensions.

   - bpo-28180(34): Implement PEP 538(35) (legacy C locale coercion).
     This means that when a suitable coercion target locale is
     available, both the core interpreter and locale-aware C extensions
     will assume the use of UTF-8 as the default text encoding, rather
     than ASCII.

   - bpo-30486(36): Allows setting cell values for __closure__.  Patch
     by Lisa Roach.

   - bpo-30537(37): itertools.islice now accepts integer-like objects
     (having an __index__ method) as start, stop, and slice arguments

   - bpo-25324(38): Tokens needed for parsing in Python moved to C.
     ‘COMMENT’, ‘NL’ and ‘ENCODING’.  This way the tokens and tok_names
     in the token module don't get changed when you import the tokenize
     module.

   - bpo-29104(39): Fixed parsing backslashes in f-strings.

   - bpo-27945(40): Fixed various segfaults with dict when input
     collections are mutated during searching, inserting or comparing.
     Based on patches by Duane Griffin and Tim Mitchell.

   - bpo-25794(41): Fixed type.__setattr__() and type.__delattr__() for
     non-interned attribute names.  Based on patch by Eryk Sun.

   - bpo-30039(42): If a KeyboardInterrupt happens when the interpreter
     is in the middle of resuming a chain of nested 'yield from' or
     'await' calls, it's now correctly delivered to the innermost frame.

   - bpo-28974(43): ‘object.__format__(x, '')’ is now equivalent to
     ‘str(x)’ rather than ‘format(str(self), '')’.

   - bpo-30024(44): Circular imports involving absolute imports with
     binding a submodule to a name are now supported.

   - bpo-12414(45): sys.getsizeof() on a code object now returns the
     sizes which includes the code struct and sizes of objects which it
     references.  Patch by Donghee Na.

   - bpo-29839(46): len() now raises ValueError rather than
     OverflowError if __len__() returned a large negative integer.

   - bpo-11913(47): README.rst is now included in the list of distutils
     standard READMEs and therefore included in source distributions.

   - bpo-29914(48): Fixed default implementations of __reduce__ and
     __reduce_ex__().  object.__reduce__() no longer takes arguments,
     object.__reduce_ex__() now requires one argument.

   - bpo-29949(49): Fix memory usage regression of set and frozenset
     object.

   - bpo-29935(50): Fixed error messages in the index() method of tuple,
     list and deque when pass indices of wrong type.

   - bpo-29816(51): Shift operation now has less opportunity to raise
     OverflowError.  ValueError always is raised rather than
     OverflowError for negative counts.  Shifting zero with non-negative
     count always returns zero.

   - bpo-24821(52): Fixed the slowing down to 25 times in the searching
     of some unlucky Unicode characters.

   - bpo-29102(53): Add a unique ID to PyInterpreterState.  This makes
     it easier to identify each subinterpreter.

   - bpo-29894(54): The deprecation warning is emitted if __complex__
     returns an instance of a strict subclass of complex.  In a future
     versions of Python this can be an error.

   - bpo-29859(55): Show correct error messages when any of the
     pthread_* calls in thread_pthread.h fails.

   - bpo-29849(56): Fix a memory leak when an ImportError is raised
     during from import.

   - bpo-28856(57): Fix an oversight that %b format for bytes should
     support objects follow the buffer protocol.

   - bpo-29723(58): The ‘sys.path[0]’ initialization change for
     bpo-29139(59) caused a regression by revealing an inconsistency in
     how sys.path is initialized when executing ‘__main__’ from a
     zipfile, directory, or other import location.  The interpreter now
     consistently avoids ever adding the import location's parent
     directory to ‘sys.path’, and ensures no other ‘sys.path’ entries
     are inadvertently modified when inserting the import location named
     on the command line.

   - bpo-29568(60): Escaped percent "%%" in the format string for
     classic string formatting no longer allows any characters between
     two percents.

   - bpo-29714(61): Fix a regression that bytes format may fail when
     containing zero bytes inside.

   - bpo-29695(62): bool(), float(), list() and tuple() no longer take
     keyword arguments.  The first argument of int() can now be passes
     only as positional argument.

   - bpo-28893(63): Set correct __cause__ for errors about invalid
     awaitables returned from __aiter__ and __anext__.

   - bpo-28876(64): ‘bool(range)’ works even if ‘len(range)’ raises
     *note OverflowError: a81.

   - bpo-29683(65): Fixes to memory allocation in _PyCode_SetExtra.
     Patch by Brian Coleman.

   - bpo-29684(66): Fix minor regression of
     PyEval_CallObjectWithKeywords.  It should raise TypeError when
     kwargs is not a dict.  But it might cause segv when args=NULL and
     kwargs is not a dict.

   - bpo-28598(67): Support __rmod__ for subclasses of str being called
     before str.__mod__.  Patch by Martijn Pieters.

   - bpo-29607(68): Fix stack_effect computation for CALL_FUNCTION_EX.
     Patch by Matthieu Dartiailh.

   - bpo-29602(69): Fix incorrect handling of signed zeros in complex
     constructor for complex subclasses and for inputs having a
     __complex__ method.  Patch by Serhiy Storchaka.

   - bpo-29347(70): Fixed possibly dereferencing undefined pointers when
     creating weakref objects.

   - bpo-29463(71): Add ‘docstring’ field to Module, ClassDef,
     FunctionDef, and AsyncFunctionDef ast nodes.  docstring is not
     first stmt in their body anymore.  It affects ‘co_firstlineno’ and
     ‘co_lnotab’ of code object for module and class.  (Reverted in
     bpo-32911(72).)

   - bpo-29438(73): Fixed use-after-free problem in key sharing dict.

   - bpo-29546(74): Set the 'path' and 'name' attribute on ImportError
     for ‘from ... import ...’.

   - bpo-29546(75): Improve from-import error message with location

   - bpo-29478(76): If max_line_length=None is specified while using the
     Compat32 policy, it is no longer ignored.  Patch by Mircea Cosbuc.

   - bpo-29319(77): Prevent RunMainFromImporter overwriting sys.path[0].

   - bpo-29337(78): Fixed possible BytesWarning when compare the code
     objects.  Warnings could be emitted at compile time.

   - bpo-29327(79): Fixed a crash when pass the iterable keyword
     argument to sorted().

   - bpo-29034(80): Fix memory leak and use-after-free in os module
     (path_converter).

   - bpo-29159(81): Fix regression in bytes(x) when x.__index__() raises
     Exception.

   - bpo-29049(82): Call _PyObject_GC_TRACK() lazily when calling Python
     function.  Calling function is up to 5% faster.

   - bpo-28927(83): bytes.fromhex() and bytearray.fromhex() now ignore
     all ASCII whitespace, not only spaces.  Patch by Robert Xiao.

   - bpo-28932(84): Do not include <sys/random.h> if it does not exist.

   - bpo-25677(85): Correct the positioning of the syntax error caret
     for indented blocks.  Based on patch by Michael Layzell.

   - bpo-29000(86): Fixed bytes formatting of octals with zero padding
     in alternate form.

   - bpo-18896(87): Python function can now have more than 255
     parameters.  collections.namedtuple() now supports tuples with more
     than 255 elements.

   - bpo-28596(88): The preferred encoding is UTF-8 on Android.  Patch
     written by Chi Hsuan Yen.

   - bpo-22257(89): Clean up interpreter startup (see PEP 432(90)).

   - bpo-26919(91): On Android, operating system data is now always
     encoded/decoded to/from UTF-8, instead of the locale encoding to
     avoid inconsistencies with os.fsencode() and os.fsdecode() which
     are already using UTF-8.

   - bpo-28991(92): functools.lru_cache() was susceptible to an obscure
     reentrancy bug triggerable by a monkey-patched len() function.

   - bpo-28147(93): Fix a memory leak in split-table dictionaries:
     setattr() must not convert combined table into split table.  Patch
     written by INADA Naoki.

   - bpo-28739(94): f-string expressions are no longer accepted as
     docstrings and by ast.literal_eval() even if they do not include
     expressions.

   - bpo-28512(95): Fixed setting the offset attribute of SyntaxError by
     PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().

   - bpo-28918(96): Fix the cross compilation of xxlimited when Python
     has been built with Py_DEBUG defined.

   - bpo-23722(97): Rather than silently producing a class that doesn't
     support zero-argument ‘super()’ in methods, failing to pass the new
     ‘__classcell__’ namespace entry up to ‘type.__new__’ now results in
     a ‘DeprecationWarning’ and a class that supports zero-argument
     ‘super()’.

   - bpo-28797(98): Modifying the class __dict__ inside the __set_name__
     method of a descriptor that is used inside that class no longer
     prevents calling the __set_name__ method of other descriptors.

   - bpo-28799(99): Remove the ‘PyEval_GetCallStats()’ function and
     deprecate the untested and undocumented ‘sys.callstats()’ function.
     Remove the ‘CALL_PROFILE’ special build: use the *note
     sys.setprofile(): 1717. function, *note cProfile: 2b. or *note
     profile: b4. to profile function calls.

   - bpo-12844(100): More than 255 arguments can now be passed to a
     function.

   - bpo-28782(101): Fix a bug in the implementation ‘yield from’ when
     checking if the next instruction is YIELD_FROM. Regression
     introduced by WORDCODE (bpo-26647(102)).

   - bpo-28774(103): Fix error position of the unicode error in ASCII
     and Latin1 encoders when a string returned by the error handler
     contains multiple non-encodable characters (non-ASCII for the ASCII
     codec, characters out of the U+0000-U+00FF range for Latin1).

   - bpo-28731(104): Optimize _PyDict_NewPresized() to create correct
     size dict.  Improve speed of dict literal with constant keys up to
     30%.

   - bpo-28532(105): Show sys.version when -V option is supplied twice.

   - bpo-27100(106): The with-statement now checks for __enter__ before
     it checks for __exit__.  This gives less confusing error messages
     when both methods are missing.  Patch by Jonathan Ellington.

   - bpo-28746(107): Fix the set_inheritable() file descriptor method on
     platforms that do not have the ioctl FIOCLEX and FIONCLEX commands.

   - bpo-26920(108): Fix not getting the locale's charset upon
     initializing the interpreter, on platforms that do not have
     langinfo.

   - bpo-28648(109): Fixed crash in Py_DecodeLocale() in debug build on
     Mac OS X when decode astral characters.  Patch by Xiang Zhang.

   - bpo-28665(110): Improve speed of the STORE_DEREF opcode by 40%.

   - bpo-19398(111): Extra slash no longer added to sys.path components
     in case of empty compile-time PYTHONPATH components.

   - bpo-28621(112): Sped up converting int to float by reusing faster
     bits counting implementation.  Patch by Adrian Wielgosik.

   - bpo-28580(113): Optimize iterating split table values.  Patch by
     Xiang Zhang.

   - bpo-28583(114): PyDict_SetDefault didn't combine split table when
     needed.  Patch by Xiang Zhang.

   - bpo-28128(115): Deprecation warning for invalid str and byte escape
     sequences now prints better information about where the error
     occurs.  Patch by Serhiy Storchaka and Eric Smith.

   - bpo-28509(116): dict.update() no longer allocate unnecessary large
     memory.

   - bpo-28426(117): Fixed potential crash in
     PyUnicode_AsDecodedObject() in debug build.

   - bpo-28517(118): Fixed of-by-one error in the peephole optimizer
     that caused keeping unreachable code.

   - bpo-28214(119): Improved exception reporting for problematic
     __set_name__ attributes.

   - bpo-23782(120): Fixed possible memory leak in _PyTraceback_Add()
     and exception loss in PyTraceBack_Here().

   - bpo-28183(121): Optimize and cleanup dict iteration.

   - bpo-26081(122): Added C implementation of asyncio.Future.  Original
     patch by Yury Selivanov.

   - bpo-28379(123): Added sanity checks and tests for
     PyUnicode_CopyCharacters().  Patch by Xiang Zhang.

   - bpo-28376(124): The type of long range iterator is now registered
     as Iterator.  Patch by Oren Milman.

   - bpo-28376(125): Creating instances of range_iterator by calling
     range_iterator type now is disallowed.  Calling iter() on range
     instance is the only way.  Patch by Oren Milman.

   - bpo-26906(126): Resolving special methods of uninitialized type now
     causes implicit initialization of the type instead of a fail.

   - bpo-18287(127): PyType_Ready() now checks that tp_name is not NULL.
     Original patch by Niklas Koep.

   - bpo-24098(128): Fixed possible crash when AST is changed in process
     of compiling it.

   - bpo-28201(129): Dict reduces possibility of 2nd conflict in hash
     table when hashes have same lower bits.

   - bpo-28350(130): String constants with null character no longer
     interned.

   - bpo-26617(131): Fix crash when GC runs during weakref callbacks.

   - bpo-27942(132): String constants now interned recursively in tuples
     and frozensets.

   - bpo-28289(133): ImportError.__init__ now resets not specified
     attributes.

   - bpo-21578(134): Fixed misleading error message when ImportError
     called with invalid keyword args.

   - bpo-28203(135): Fix incorrect type in complex(1.0, {2:3}) error
     message.  Patch by Soumya Sharma.

   - bpo-28086(136): Single var-positional argument of tuple subtype was
     passed unscathed to the C-defined function.  Now it is converted to
     exact tuple.

   - bpo-28214(137): Now __set_name__ is looked up on the class instead
     of the instance.

   - bpo-27955(138): Fallback on reading /dev/urandom device when the
     getrandom() syscall fails with EPERM, for example when blocked by
     SECCOMP.

   - bpo-28192(139): Don't import readline in isolated mode.

   - bpo-27441(140): Remove some redundant assignments to ob_size in
     longobject.c.  Thanks Oren Milman.

   - bpo-27222(141): Clean up redundant code in long_rshift function.
     Thanks Oren Milman.

   - Upgrade internal unicode databases to Unicode version 9.0.0.

   - bpo-28131(142): Fix a regression in zipimport's compile_source().
     zipimport should use the same optimization level as the
     interpreter.

   - bpo-28126(143): Replace Py_MEMCPY with memcpy().  Visual Studio can
     properly optimize memcpy().

   - bpo-28120(144): Fix dict.pop() for split dictionary when trying to
     remove a "pending key" (Not yet inserted in split-table).  Patch by
     Xiang Zhang.

   - bpo-26182(145): Raise DeprecationWarning when async and await
     keywords are used as variable/attribute/class/function name.

   - bpo-26182(146): Fix a refleak in code that raises
     DeprecationWarning.

   - bpo-28721(147): Fix asynchronous generators aclose() and athrow()
     to handle StopAsyncIteration propagation properly.

   - bpo-26110(148): Speed-up method calls: add LOAD_METHOD and
     CALL_METHOD opcodes.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31490

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31471

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31418

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31416

   (5) https://bugs.python.org/issue?@action=redirect&bpo=28411

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28411

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31411

   (8) https://bugs.python.org/issue?@action=redirect&bpo=31344

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31373

   (10) https://bugs.python.org/issue?@action=redirect&bpo=30465

   (11) https://bugs.python.org/issue?@action=redirect&bpo=30860

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31347

   (13) https://bugs.python.org/issue?@action=redirect&bpo=31343

   (14) https://bugs.python.org/issue?@action=redirect&bpo=31291

   (15) https://bugs.python.org/issue?@action=redirect&bpo=31271

   (16) https://bugs.python.org/issue?@action=redirect&bpo=31243

   (17) https://bugs.python.org/issue?@action=redirect&bpo=30721

   (18) https://bugs.python.org/issue?@action=redirect&bpo=31070

   (19) https://bugs.python.org/issue?@action=redirect&bpo=30747

   (20) https://bugs.python.org/issue?@action=redirect&bpo=31095

   (21) https://bugs.python.org/issue?@action=redirect&bpo=31071

   (22) https://bugs.python.org/issue?@action=redirect&bpo=30978

   (23) https://bugs.python.org/issue?@action=redirect&bpo=30808

   (24) https://bugs.python.org/issue?@action=redirect&bpo=30876

   (25) https://bugs.python.org/issue?@action=redirect&bpo=30703

   (26) https://bugs.python.org/issue?@action=redirect&bpo=30765

   (27) https://bugs.python.org/issue?@action=redirect&bpo=31161

   (28) https://bugs.python.org/issue?@action=redirect&bpo=30814

   (29) https://bugs.python.org/issue?@action=redirect&bpo=30736

   (30) https://bugs.python.org/issue?@action=redirect&bpo=30604

   (31) https://bugs.python.org/issue?@action=redirect&bpo=30597

   (32) https://bugs.python.org/issue?@action=redirect&bpo=30682

   (33) https://bugs.python.org/issue?@action=redirect&bpo=30501

   (34) https://bugs.python.org/issue?@action=redirect&bpo=28180

   (35) https://peps.python.org/pep-0538/

   (36) https://bugs.python.org/issue?@action=redirect&bpo=30486

   (37) https://bugs.python.org/issue?@action=redirect&bpo=30537

   (38) https://bugs.python.org/issue?@action=redirect&bpo=25324

   (39) https://bugs.python.org/issue?@action=redirect&bpo=29104

   (40) https://bugs.python.org/issue?@action=redirect&bpo=27945

   (41) https://bugs.python.org/issue?@action=redirect&bpo=25794

   (42) https://bugs.python.org/issue?@action=redirect&bpo=30039

   (43) https://bugs.python.org/issue?@action=redirect&bpo=28974

   (44) https://bugs.python.org/issue?@action=redirect&bpo=30024

   (45) https://bugs.python.org/issue?@action=redirect&bpo=12414

   (46) https://bugs.python.org/issue?@action=redirect&bpo=29839

   (47) https://bugs.python.org/issue?@action=redirect&bpo=11913

   (48) https://bugs.python.org/issue?@action=redirect&bpo=29914

   (49) https://bugs.python.org/issue?@action=redirect&bpo=29949

   (50) https://bugs.python.org/issue?@action=redirect&bpo=29935

   (51) https://bugs.python.org/issue?@action=redirect&bpo=29816

   (52) https://bugs.python.org/issue?@action=redirect&bpo=24821

   (53) https://bugs.python.org/issue?@action=redirect&bpo=29102

   (54) https://bugs.python.org/issue?@action=redirect&bpo=29894

   (55) https://bugs.python.org/issue?@action=redirect&bpo=29859

   (56) https://bugs.python.org/issue?@action=redirect&bpo=29849

   (57) https://bugs.python.org/issue?@action=redirect&bpo=28856

   (58) https://bugs.python.org/issue?@action=redirect&bpo=29723

   (59) https://bugs.python.org/issue?@action=redirect&bpo=29139

   (60) https://bugs.python.org/issue?@action=redirect&bpo=29568

   (61) https://bugs.python.org/issue?@action=redirect&bpo=29714

   (62) https://bugs.python.org/issue?@action=redirect&bpo=29695

   (63) https://bugs.python.org/issue?@action=redirect&bpo=28893

   (64) https://bugs.python.org/issue?@action=redirect&bpo=28876

   (65) https://bugs.python.org/issue?@action=redirect&bpo=29683

   (66) https://bugs.python.org/issue?@action=redirect&bpo=29684

   (67) https://bugs.python.org/issue?@action=redirect&bpo=28598

   (68) https://bugs.python.org/issue?@action=redirect&bpo=29607

   (69) https://bugs.python.org/issue?@action=redirect&bpo=29602

   (70) https://bugs.python.org/issue?@action=redirect&bpo=29347

   (71) https://bugs.python.org/issue?@action=redirect&bpo=29463

   (72) https://bugs.python.org/issue?@action=redirect&bpo=32911

   (73) https://bugs.python.org/issue?@action=redirect&bpo=29438

   (74) https://bugs.python.org/issue?@action=redirect&bpo=29546

   (75) https://bugs.python.org/issue?@action=redirect&bpo=29546

   (76) https://bugs.python.org/issue?@action=redirect&bpo=29478

   (77) https://bugs.python.org/issue?@action=redirect&bpo=29319

   (78) https://bugs.python.org/issue?@action=redirect&bpo=29337

   (79) https://bugs.python.org/issue?@action=redirect&bpo=29327

   (80) https://bugs.python.org/issue?@action=redirect&bpo=29034

   (81) https://bugs.python.org/issue?@action=redirect&bpo=29159

   (82) https://bugs.python.org/issue?@action=redirect&bpo=29049

   (83) https://bugs.python.org/issue?@action=redirect&bpo=28927

   (84) https://bugs.python.org/issue?@action=redirect&bpo=28932

   (85) https://bugs.python.org/issue?@action=redirect&bpo=25677

   (86) https://bugs.python.org/issue?@action=redirect&bpo=29000

   (87) https://bugs.python.org/issue?@action=redirect&bpo=18896

   (88) https://bugs.python.org/issue?@action=redirect&bpo=28596

   (89) https://bugs.python.org/issue?@action=redirect&bpo=22257

   (90) https://peps.python.org/pep-0432/

   (91) https://bugs.python.org/issue?@action=redirect&bpo=26919

   (92) https://bugs.python.org/issue?@action=redirect&bpo=28991

   (93) https://bugs.python.org/issue?@action=redirect&bpo=28147

   (94) https://bugs.python.org/issue?@action=redirect&bpo=28739

   (95) https://bugs.python.org/issue?@action=redirect&bpo=28512

   (96) https://bugs.python.org/issue?@action=redirect&bpo=28918

   (97) https://bugs.python.org/issue?@action=redirect&bpo=23722

   (98) https://bugs.python.org/issue?@action=redirect&bpo=28797

   (99) https://bugs.python.org/issue?@action=redirect&bpo=28799

   (100) https://bugs.python.org/issue?@action=redirect&bpo=12844

   (101) https://bugs.python.org/issue?@action=redirect&bpo=28782

   (102) https://bugs.python.org/issue?@action=redirect&bpo=26647

   (103) https://bugs.python.org/issue?@action=redirect&bpo=28774

   (104) https://bugs.python.org/issue?@action=redirect&bpo=28731

   (105) https://bugs.python.org/issue?@action=redirect&bpo=28532

   (106) https://bugs.python.org/issue?@action=redirect&bpo=27100

   (107) https://bugs.python.org/issue?@action=redirect&bpo=28746

   (108) https://bugs.python.org/issue?@action=redirect&bpo=26920

   (109) https://bugs.python.org/issue?@action=redirect&bpo=28648

   (110) https://bugs.python.org/issue?@action=redirect&bpo=28665

   (111) https://bugs.python.org/issue?@action=redirect&bpo=19398

   (112) https://bugs.python.org/issue?@action=redirect&bpo=28621

   (113) https://bugs.python.org/issue?@action=redirect&bpo=28580

   (114) https://bugs.python.org/issue?@action=redirect&bpo=28583

   (115) https://bugs.python.org/issue?@action=redirect&bpo=28128

   (116) https://bugs.python.org/issue?@action=redirect&bpo=28509

   (117) https://bugs.python.org/issue?@action=redirect&bpo=28426

   (118) https://bugs.python.org/issue?@action=redirect&bpo=28517

   (119) https://bugs.python.org/issue?@action=redirect&bpo=28214

   (120) https://bugs.python.org/issue?@action=redirect&bpo=23782

   (121) https://bugs.python.org/issue?@action=redirect&bpo=28183

   (122) https://bugs.python.org/issue?@action=redirect&bpo=26081

   (123) https://bugs.python.org/issue?@action=redirect&bpo=28379

   (124) https://bugs.python.org/issue?@action=redirect&bpo=28376

   (125) https://bugs.python.org/issue?@action=redirect&bpo=28376

   (126) https://bugs.python.org/issue?@action=redirect&bpo=26906

   (127) https://bugs.python.org/issue?@action=redirect&bpo=18287

   (128) https://bugs.python.org/issue?@action=redirect&bpo=24098

   (129) https://bugs.python.org/issue?@action=redirect&bpo=28201

   (130) https://bugs.python.org/issue?@action=redirect&bpo=28350

   (131) https://bugs.python.org/issue?@action=redirect&bpo=26617

   (132) https://bugs.python.org/issue?@action=redirect&bpo=27942

   (133) https://bugs.python.org/issue?@action=redirect&bpo=28289

   (134) https://bugs.python.org/issue?@action=redirect&bpo=21578

   (135) https://bugs.python.org/issue?@action=redirect&bpo=28203

   (136) https://bugs.python.org/issue?@action=redirect&bpo=28086

   (137) https://bugs.python.org/issue?@action=redirect&bpo=28214

   (138) https://bugs.python.org/issue?@action=redirect&bpo=27955

   (139) https://bugs.python.org/issue?@action=redirect&bpo=28192

   (140) https://bugs.python.org/issue?@action=redirect&bpo=27441

   (141) https://bugs.python.org/issue?@action=redirect&bpo=27222

   (142) https://bugs.python.org/issue?@action=redirect&bpo=28131

   (143) https://bugs.python.org/issue?@action=redirect&bpo=28126

   (144) https://bugs.python.org/issue?@action=redirect&bpo=28120

   (145) https://bugs.python.org/issue?@action=redirect&bpo=26182

   (146) https://bugs.python.org/issue?@action=redirect&bpo=26182

   (147) https://bugs.python.org/issue?@action=redirect&bpo=28721

   (148) https://bugs.python.org/issue?@action=redirect&bpo=26110


File: python.info,  Node: ライブラリ<173>,  Next: ドキュメント<66>,  Prev: Core and Builtins<169>,  Up: Python 3 7 0 alpha 1

1.24.73.3 ライブラリ
....................

   - bpo-31499(1): xml.etree: Fix a crash when a parser is part of a
     reference cycle.

   - bpo-31482(2): ‘random.seed()’ now works with bytes in version=1

   - bpo-28556(3): typing.get_type_hints now finds the right globalns
     for classes and modules by default (when no ‘globalns’ was
     specified by the caller).

   - bpo-28556(4): Speed improvements to the ‘typing’ module.  Original
     PRs by Ivan Levkivskyi and Mitar.

   - bpo-31544(5): The C accelerator module of ElementTree ignored
     exceptions raised when looking up TreeBuilder target methods in
     XMLParser().

   - bpo-31234(6): socket.create_connection() now fixes manually a
     reference cycle: clear the variable storing the last exception on
     success.

   - bpo-31457(7): LoggerAdapter objects can now be nested.

   - bpo-31431(8): SSLContext.check_hostname now automatically sets
     SSLContext.verify_mode to ssl.CERT_REQUIRED instead of failing with
     a ValueError.

   - bpo-31233(9): socketserver.ThreadingMixIn now keeps a list of
     non-daemonic threads to wait until all these threads complete in
     server_close().

   - bpo-28638(10): Changed the implementation strategy for
     collections.namedtuple() to substantially reduce the use of exec()
     in favor of precomputed methods.  As a result, the 'verbose'
     parameter and '_source' attribute are no longer supported.  The
     benefits include 1) having a smaller memory footprint for
     applications using multiple named tuples, 2) faster creation of the
     named tuple class (approx 4x to 6x depending on how it is
     measured), and 3) minor speed-ups for instance creation using
     __new__, _make, and _replace.  (The primary patch contributor is
     Jelle Zijlstra with further improvements by INADA Naoki, Serhiy
     Storchaka, and Raymond Hettinger.)

   - bpo-31400(11): Improves SSL error handling to avoid losing error
     numbers.

   - bpo-27629(12): Make return types of SSLContext.wrap_bio() and
     SSLContext.wrap_socket() customizable.

   - bpo-28958(13): ssl.SSLContext() now uses OpenSSL error information
     when a context cannot be instantiated.

   - bpo-28182(14): The SSL module now raises SSLCertVerificationError
     when OpenSSL fails to verify the peer's certificate.  The exception
     contains more information about the error.

   - bpo-27340(15): SSLSocket.sendall() now uses memoryview to create
     slices of data.  This fixes support for all bytes-like object.  It
     is also more efficient and avoids costly copies.

   - bpo-14191(16): A new function
     ‘argparse.ArgumentParser.parse_intermixed_args’ provides the
     ability to parse command lines where there user intermixes options
     and positional arguments.

   - bpo-31178(17): Fix string concatenation bug in rare error path in
     the subprocess module

   - bpo-31350(18): Micro-optimize ‘asyncio._get_running_loop()’ to
     become up to 10% faster.

   - bpo-31170(19): expat: Update libexpat from 2.2.3 to 2.2.4.  Fix
     copying of partial characters for UTF-8 input (libexpat bug 115):
     ‘https://github.com/libexpat/libexpat/issues/115’

   - bpo-29136(20): Add TLS 1.3 cipher suites and OP_NO_TLSv1_3.

   - bpo-1198569(21): ‘string.Template’ subclasses can optionally define
     ‘braceidpattern’ if they want to specify different placeholder
     patterns inside and outside the braces.  If None (the default) it
     falls back to ‘idpattern’.

   - bpo-31326(22): concurrent.futures.ProcessPoolExecutor.shutdown()
     now explicitly closes the call queue.  Moreover,
     shutdown(wait=True) now also join the call queue thread, to prevent
     leaking a dangling thread.

   - bpo-27144(23): The ‘map()’ and ‘as_completed()’ iterators in
     ‘concurrent.futures’ now avoid keeping a reference to yielded
     objects.

   - bpo-31281(24): Fix ‘fileinput.FileInput(files, inplace=True)’ when
     ‘files’ contain ‘pathlib.Path’ objects.

   - bpo-10746(25): Fix ctypes producing wrong PEP 3118(26) type codes
     for integer types.

   - bpo-27584(27): ‘AF_VSOCK’ has been added to the socket interface
     which allows communication between virtual machines and their host.

   - bpo-22536(28): The subprocess module now sets the filename when
     FileNotFoundError is raised on POSIX systems due to the executable
     or cwd not being found.

   - bpo-29741(29): Update some methods in the _pyio module to also
     accept integer types.  Patch by Oren Milman.

   - bpo-31249(30): concurrent.futures: WorkItem.run() used by
     ThreadPoolExecutor now breaks a reference cycle between an
     exception object and the WorkItem object.

   - bpo-31247(31): xmlrpc.server now explicitly breaks reference cycles
     when using sys.exc_info() in code handling exceptions.

   - bpo-23835(32): configparser: reading defaults in the
     ‘ConfigParser()’ constructor is now using ‘read_dict()’, making its
     behavior consistent with the rest of the parser.  Non-string keys
     and values in the defaults dictionary are now being implicitly
     converted to strings.  Patch by James Tocknell.

   - bpo-31238(33): pydoc: the stop() method of the private ServerThread
     class now waits until DocServer.serve_until_quit() completes and
     then explicitly sets its docserver attribute to None to break a
     reference cycle.

   - bpo-5001(34): Many asserts in ‘multiprocessing’ are now more
     informative, and some error types have been changed to more
     specific ones.

   - bpo-31109(35): Convert zipimport to use Argument Clinic.

   - bpo-30102(36): The ssl and hashlib modules now call
     OPENSSL_add_all_algorithms_noconf() on OpenSSL < 1.1.0.  The
     function detects CPU features and enables optimizations on some CPU
     architectures such as POWER8.  Patch is based on research from
     Gustavo Serra Scalet.

   - bpo-18966(37): Non-daemonic threads created by a
     multiprocessing.Process are now joined on child exit.

   - bpo-31183(38): ‘dis’ now works with asynchronous generator and
     coroutine objects.  Patch by George Collins based on diagnosis by
     Luciano Ramalho.

   - bpo-5001(39): There are a number of uninformative asserts in the
     ‘multiprocessing’ module, as noted in issue 5001.  This change
     fixes two of the most potentially problematic ones, since they are
     in error-reporting code, in the
     ‘multiprocessing.managers.convert_to_error’ function.  (It also
     makes more informative a ValueError message.)  The only potentially
     problematic change is that the AssertionError is now a TypeError;
     however, this should also help distinguish it from an
     AssertionError being 'reported' by the function/its caller (such as
     in issue 31169).  - Patch by Allen W. Smith (drallensmith on
     github).

   - bpo-31185(40): Fixed miscellaneous errors in asyncio speedup
     module.

   - bpo-31151(41): socketserver.ForkingMixIn.server_close() now waits
     until all child processes completed to prevent leaking zombie
     processes.

   - bpo-31072(42): Add an ‘include_file’ parameter to
     ‘zipapp.create_archive()’

   - bpo-24700(43): Optimize array.array comparison.  It is now from 10x
     up to 70x faster when comparing arrays holding values of the same
     integer type.

   - bpo-31135(44): ttk: fix the destroy() method of LabeledScale and
     OptionMenu classes.  Call the parent destroy() method even if the
     used attribute doesn't exist.  The LabeledScale.destroy() method
     now also explicitly clears label and scale attributes to help the
     garbage collector to destroy all widgets.

   - bpo-31107(45): Fix ‘copyreg._slotnames()’ mangled attribute
     calculation for classes whose name begins with an underscore.
     Patch by Shane Harvey.

   - bpo-31080(46): Allow ‘logging.config.fileConfig’ to accept kwargs
     and/or args.

   - bpo-30897(47): ‘pathlib.Path’ objects now include an ‘is_mount()’
     method (only implemented on POSIX). This is similar to
     ‘os.path.ismount(p)’.  Patch by Cooper Ry Lees.

   - bpo-31061(48): Fixed a crash when using asyncio and threads.

   - bpo-30987(49): Added support for CAN ISO-TP protocol in the socket
     module.

   - bpo-30522(50): Added a ‘setStream’ method to
     ‘logging.StreamHandler’ to allow the stream to be set after
     creation.

   - bpo-30502(51): Fix handling of long oids in ssl.  Based on patch by
     Christian Heimes.

   - bpo-5288(52): Support tzinfo objects with sub-minute offsets.

   - bpo-30919(53): Fix shared memory performance regression in
     multiprocessing in 3.x.  Shared memory used anonymous memory
     mappings in 2.x, while 3.x mmaps actual files.  Try to be careful
     to do as little disk I/O as possible.

   - bpo-26732(54): Fix too many fds in processes started with the
     "forkserver" method.  A child process would inherit as many fds as
     the number of still-running children.

   - bpo-29403(55): Fix ‘unittest.mock’'s autospec to not fail on
     method-bound builtin functions.  Patch by Aaron Gallagher.

   - bpo-30961(56): Fix decrementing a borrowed reference in
     tracemalloc.

   - bpo-19896(57): Fix multiprocessing.sharedctypes to recognize
     typecodes ‘'q'’ and ‘'Q'’.

   - bpo-30946(58): Remove obsolete code in readline module for
     platforms where GNU readline is older than 2.1 or where select() is
     not available.

   - bpo-25684(59): Change ‘ttk.OptionMenu’ radiobuttons to be unique
     across instances of ‘OptionMenu’.

   - bpo-30886(60): Fix multiprocessing.Queue.join_thread(): it now
     waits until the thread completes, even if the thread was started by
     the same process which created the queue.

   - bpo-29854(61): Fix segfault in readline when using readline's
     history-size option.  Patch by Nir Soffer.

   - bpo-30794(62): Added multiprocessing.Process.kill method to
     terminate using the SIGKILL signal on Unix.

   - bpo-30319(63): socket.close() now ignores ECONNRESET error.

   - bpo-30828(64): Fix out of bounds write in
     ‘asyncio.CFuture.remove_done_callback()’.

   - bpo-30302(65): Use keywords in the ‘repr’ of ‘datetime.timedelta’.

   - bpo-30807(66): signal.setitimer() may disable the timer when passed
     a tiny value.  Tiny values (such as 1e-6) are valid non-zero values
     for setitimer(), which is specified as taking
     microsecond-resolution intervals.  However, on some platform, our
     conversion routine could convert 1e-6 into a zero interval,
     therefore disabling the timer instead of (re-)scheduling it.

   - bpo-30441(67): Fix bug when modifying os.environ while iterating
     over it

   - bpo-29585(68): Avoid importing ‘sysconfig’ from ‘site’ to improve
     startup speed.  Python startup is about 5% faster on Linux and 30%
     faster on macOS.

   - bpo-29293(69): Add missing parameter "n" on
     multiprocessing.Condition.notify().  The doc claims
     multiprocessing.Condition behaves like threading.Condition, but its
     notify() method lacked the optional "n" argument (to specify the
     number of sleepers to wake up) that threading.Condition.notify()
     accepts.

   - bpo-30532(70): Fix email header value parser dropping folding white
     space in certain cases.

   - bpo-30596(71): Add a ‘close()’ method to ‘multiprocessing.Process’.

   - bpo-9146(72): Fix a segmentation fault in _hashopenssl when
     standard hash functions such as md5 are not available in the linked
     OpenSSL library.  As in some special FIPS-140 build environments.

   - bpo-29169(73): Update zlib to 1.2.11.

   - bpo-30119(74): ftplib.FTP.putline() now throws ValueError on
     commands that contains CR or LF. Patch by Donghee Na.

   - bpo-30879(75): os.listdir() and os.scandir() now emit bytes names
     when called with bytes-like argument.

   - bpo-30746(76): Prohibited the '=' character in environment variable
     names in ‘os.putenv()’ and ‘os.spawn*()’.

   - bpo-30664(77): The description of a unittest subtest now preserves
     the order of keyword arguments of TestCase.subTest().

   - bpo-21071(78): struct.Struct.format type is now *note str: 169.
     instead of *note bytes: 192.

   - bpo-29212(79): Fix concurrent.futures.thread.ThreadPoolExecutor
     threads to have a non repr() based thread name by default when no
     thread_name_prefix is supplied.  They will now identify themselves
     as "ThreadPoolExecutor-y_n".

   - bpo-29755(80): Fixed the lgettext() family of functions in the
     gettext module.  They now always return bytes.

   - bpo-30616(81): Functional API of enum allows to create empty enums.
     Patched by Donghee Na

   - bpo-30038(82): Fix race condition between signal delivery and
     wakeup file descriptor.  Patch by Nathaniel Smith.

   - bpo-23894(83): lib2to3 now recognizes ‘rb'...'’ and ‘f'...'’
     strings.

   - bpo-24744(84): pkgutil.walk_packages function now raises ValueError
     if 'path' is a string.  Patch by Sanyam Khurana.

   - bpo-24484(85): Avoid race condition in multiprocessing cleanup.

   - bpo-30589(86): Fix multiprocessing.Process.exitcode to return the
     opposite of the signal number when the process is killed by a
     signal (instead of 255) when using the "forkserver" method.

   - bpo-28994(87): The traceback no longer displayed for SystemExit
     raised in a callback registered by atexit.

   - bpo-30508(88): Don't log exceptions if Task/Future "cancel()"
     method was called.

   - bpo-30645(89): Fix path calculation in ‘imp.load_package()’, fixing
     it for cases when a package is only shipped with bytecodes.  Patch
     by Alexandru Ardelean.

   - bpo-11822(90): The dis.dis() function now is able to disassemble
     nested code objects.

   - bpo-30624(91): selectors does not take KeyboardInterrupt and
     SystemExit into account, leaving a fd in a bad state in case of
     error.  Patch by Giampaolo Rodola'.

   - bpo-30595(92): multiprocessing.Queue.get() with a timeout now polls
     its reader in non-blocking mode if it succeeded to acquire the lock
     but the acquire took longer than the timeout.

   - bpo-28556(93): Updates to typing module: Add generic
     AsyncContextManager, add support for ContextManager on all
     versions.  Original PRs by Jelle Zijlstra and Ivan Levkivskyi

   - bpo-30605(94): re.compile() no longer raises a BytesWarning when
     compiling a bytes instance with misplaced inline modifier.  Patch
     by Roy Williams.

   - bpo-29870(95): Fix ssl sockets leaks when connection is aborted in
     asyncio/ssl implementation.  Patch by Michaël Sghaïer.

   - bpo-29743(96): Closing transport during handshake process leaks
     open socket.  Patch by Nikolay Kim

   - bpo-27585(97): Fix waiter cancellation in asyncio.Lock.  Patch by
     Mathieu Sornay.

   - bpo-30014(98): modify() method of poll(), epoll() and devpoll()
     based classes of selectors module is around 10% faster.  Patch by
     Giampaolo Rodola'.

   - bpo-30418(99): On Windows, subprocess.Popen.communicate() now also
     ignore EINVAL on stdin.write() if the child process is still
     running but closed the pipe.

   - bpo-30463(100): Added empty __slots__ to abc.ABC. This allows
     subclassers to deny __dict__ and __weakref__ creation.  Patch by
     Aaron Hall.

   - bpo-30520(101): Loggers are now pickleable.

   - bpo-30557(102): faulthandler now correctly filters and displays
     exception codes on Windows

   - bpo-30526(103): Add TextIOWrapper.reconfigure() and a
     TextIOWrapper.write_through attribute.

   - bpo-30245(104): Fix possible overflow when organize
     struct.pack_into error message.  Patch by Yuan Liu.

   - bpo-30378(105): Fix the problem that logging.handlers.SysLogHandler
     cannot handle IPv6 addresses.

   - bpo-16500(106): Allow registering at-fork handlers.

   - bpo-30470(107): Deprecate invalid ctypes call protection on
     Windows.  Patch by Mariatta Wijaya.

   - bpo-30414(108): multiprocessing.Queue._feed background running
     thread do not break from main loop on exception.

   - bpo-30003(109): Fix handling escape characters in HZ codec.  Based
     on patch by Ma Lin.

   - bpo-30149(110): inspect.signature() now supports callables with
     variable-argument parameters wrapped with partialmethod.  Patch by
     Donghee Na.

   - bpo-30436(111): importlib.find_spec() raises ModuleNotFoundError
     instead of AttributeError if the specified parent module is not a
     package (i.e.  lacks a __path__ attribute).

   - bpo-30301(112): Fix AttributeError when using SimpleQueue.empty()
     under 'spawn' and 'forkserver' start methods.

   - bpo-30375(113): Warnings emitted when compile a regular expression
     now always point to the line in the user code.  Previously they
     could point into inners of the re module if emitted from inside of
     groups or conditionals.

   - bpo-30329(114): imaplib and poplib now catch the Windows socket
     WSAEINVAL error (code 10022) on shutdown(SHUT_RDWR): An invalid
     operation was attempted.  This error occurs sometimes on SSL
     connections.

   - bpo-29196(115): Removed previously deprecated in Python 2.4 classes
     Plist, Dict and _InternalDict in the plistlib module.  Dict values
     in the result of functions readPlist() and readPlistFromBytes() are
     now normal dicts.  You no longer can use attribute access to access
     items of these dictionaries.

   - bpo-9850(116): The ‘macpath’ is now deprecated and will be removed
     in Python 3.8.

   - bpo-30299(117): Compiling regular expression in debug mode on
     CPython now displays the compiled bytecode in human readable form.

   - bpo-30048(118): Fixed ‘Task.cancel()’ can be ignored when the task
     is running coroutine and the coroutine returned without any more
     ‘await’.

   - bpo-30266(119): contextlib.AbstractContextManager now supports
     anti-registration by setting __enter__ = None or __exit__ = None,
     following the pattern introduced in bpo-25958(120).  Patch by Jelle
     Zijlstra.

   - bpo-30340(121): Enhanced regular expressions optimization.  This
     increased the performance of matching some patterns up to 25 times.

   - bpo-30298(122): Weaken the condition of deprecation warnings for
     inline modifiers.  Now allowed several subsequential inline
     modifiers at the start of the pattern (e.g.  ‘'(?i)(?s)...'’).  In
     verbose mode whitespaces and comments now are allowed before and
     between inline modifiers (e.g.  ‘'(?x) (?i) (?s)...'’).

   - bpo-30285(123): Optimized case-insensitive matching and searching
     of regular expressions.

   - bpo-29990(124): Fix range checking in GB18030 decoder.  Original
     patch by Ma Lin.

   - bpo-29979(125): rewrite cgi.parse_multipart, reusing the
     FieldStorage class and making its results consistent with those of
     FieldStorage for multipart/form-data requests.  Patch by Pierre
     Quentel.

   - bpo-30243(126): Removed the __init__ methods of _json's scanner and
     encoder.  Misusing them could cause memory leaks or crashes.  Now
     scanner and encoder objects are completely initialized in the
     __new__ methods.

   - bpo-30215(127): Compiled regular expression objects with the
     re.LOCALE flag no longer depend on the locale at compile time.
     Only the locale at matching time affects the result of matching.

   - bpo-30185(128): Avoid KeyboardInterrupt tracebacks in forkserver
     helper process when Ctrl-C is received.

   - bpo-30103(129): binascii.b2a_uu() and uu.encode() now support using
     ‘'`'’ as zero instead of space.

   - bpo-28556(130): Various updates to typing module: add
     typing.NoReturn type, use WrapperDescriptorType, minor bug-fixes.
     Original PRs by Jim Fasarakis-Hilliard and Ivan Levkivskyi.

   - bpo-30205(131): Fix getsockname() for unbound AF_UNIX sockets on
     Linux.

   - bpo-30228(132): The seek() and tell() methods of io.FileIO now set
     the internal seekable attribute to avoid one syscall on open() (in
     buffered or text mode).

   - bpo-30190(133): unittest's assertAlmostEqual and
     assertNotAlmostEqual provide a better message in case of failure
     which includes the difference between left and right arguments.
     (patch by Giampaolo Rodola')

   - bpo-30101(134): Add support for curses.A_ITALIC.

   - bpo-29822(135): inspect.isabstract() now works during
     __init_subclass__.  Patch by Nate Soares.

   - bpo-29960(136): Preserve generator state when
     _random.Random.setstate() raises an exception.  Patch by Bryan
     Olson.

   - bpo-30070(137): Fixed leaks and crashes in errors handling in the
     parser module.

   - bpo-22352(138): Column widths in the output of dis.dis() are now
     adjusted for large line numbers and instruction offsets.

   - bpo-30061(139): Fixed crashes in IOBase methods __next__() and
     readlines() when readline() or __next__() respectively return
     non-sizeable object.  Fixed possible other errors caused by not
     checking results of PyObject_Size(), PySequence_Size(), or
     PyMapping_Size().

   - bpo-30218(140): Fix PathLike support for shutil.unpack_archive.
     Patch by Jelle Zijlstra.

   - bpo-10076(141): Compiled regular expression and match objects in
     the re module now support copy.copy() and copy.deepcopy() (they are
     considered atomic).

   - bpo-30068(142): _io._IOBase.readlines will check if it's closed
     first when hint is present.

   - bpo-29694(143): Fixed race condition in pathlib mkdir with flags
     parents=True.  Patch by Armin Rigo.

   - bpo-29692(144): Fixed arbitrary unchaining of RuntimeError
     exceptions in contextlib.contextmanager.  Patch by Siddharth
     Velankar.

   - bpo-26187(145): Test that sqlite3 trace callback is not called
     multiple times when schema is changing.  Indirectly fixed by
     switching to use sqlite3_prepare_v2() in bpo-9303(146).  Patch by
     Aviv Palivoda.

   - bpo-30017(147): Allowed calling the close() method of the zip entry
     writer object multiple times.  Writing to a closed writer now
     always produces a ValueError.

   - bpo-29998(148): Pickling and copying ImportError now preserves name
     and path attributes.

   - bpo-29995(149): re.escape() now escapes only regex special
     characters.

   - bpo-29962(150): Add math.remainder operation, implementing
     remainder as specified in IEEE 754.

   - bpo-29649(151): Improve struct.pack_into() exception messages for
     problems with the buffer size and offset.  Patch by Andrew Nester.

   - bpo-29654(152): Support If-Modified-Since HTTP header (browser
     cache).  Patch by Pierre Quentel.

   - bpo-29931(153): Fixed comparison check for ipaddress.ip_interface
     objects.  Patch by Sanjay Sundaresan.

   - bpo-29953(154): Fixed memory leaks in the replace() method of
     datetime and time objects when pass out of bound fold argument.

   - bpo-29942(155): Fix a crash in itertools.chain.from_iterable when
     encountering long runs of empty iterables.

   - bpo-10030(156): Sped up reading encrypted ZIP files by 2 times.

   - bpo-29204(157): Element.getiterator() and the html parameter of
     XMLParser() were deprecated only in the documentation (since Python
     3.2 and 3.4 correspondingly).  Now using them emits a deprecation
     warning.

   - bpo-27863(158): Fixed multiple crashes in ElementTree caused by
     race conditions and wrong types.

   - bpo-25996(159): Added support of file descriptors in os.scandir()
     on Unix.  os.fwalk() is sped up by 2 times by using os.scandir().

   - bpo-28699(160): Fixed a bug in pools in multiprocessing.pool that
     raising an exception at the very first of an iterable may swallow
     the exception or make the program hang.  Patch by Davin Potts and
     Xiang Zhang.

   - bpo-23890(161): unittest.TestCase.assertRaises() now manually
     breaks a reference cycle to not keep objects alive longer than
     expected.

   - bpo-29901(162): The zipapp module now supports general path-like
     objects, not just pathlib.Path.

   - bpo-25803(163): Avoid incorrect errors raised by
     Path.mkdir(exist_ok=True) when the OS gives priority to errors such
     as EACCES over EEXIST.

   - bpo-29861(164): Release references to tasks, their arguments and
     their results as soon as they are finished in multiprocessing.Pool.

   - bpo-19930(165): The mode argument of os.makedirs() no longer
     affects the file permission bits of newly created
     intermediate-level directories.

   - bpo-29884(166): faulthandler: Restore the old sigaltstack during
     teardown.  Patch by Christophe Zeitouny.

   - bpo-25455(167): Fixed crashes in repr of recursive buffered
     file-like objects.

   - bpo-29800(168): Fix crashes in partial.__repr__ if the keys of
     partial.keywords are not strings.  Patch by Michael Seifert.

   - bpo-8256(169): Fixed possible failing or crashing input() if
     attributes "encoding" or "errors" of sys.stdin or sys.stdout are
     not set or are not strings.

   - bpo-28692(170): Using non-integer value for selecting a plural form
     in gettext is now deprecated.

   - bpo-26121(171): Use C library implementation for math functions
     erf() and erfc().

   - bpo-29619(172): os.stat() and os.DirEntry.inode() now convert inode
     (st_ino) using unsigned integers.

   - bpo-28298(173): Fix a bug that prevented array 'Q', 'L' and 'I'
     from accepting big intables (objects that have __int__) as
     elements.

   - bpo-29645(174): Speed up importing the webbrowser module.
     webbrowser.register() is now thread-safe.

   - bpo-28231(175): The zipfile module now accepts path-like objects
     for external paths.

   - bpo-26915(176): index() and count() methods of
     collections.abc.Sequence now check identity before checking
     equality when do comparisons.

   - bpo-28682(177): Added support for bytes paths in os.fwalk().

   - bpo-29728(178): Add new ‘socket.TCP_NOTSENT_LOWAT’ (Linux 3.12)
     constant.  Patch by Nathaniel J. Smith.

   - bpo-29623(179): Allow use of path-like object as a single argument
     in ConfigParser.read().  Patch by David Ellis.

   - bpo-9303(180): Migrate sqlite3 module to _v2 API. Patch by Aviv
     Palivoda.

   - bpo-28963(181): Fix out of bound iteration in
     asyncio.Future.remove_done_callback implemented in C.

   - bpo-29704(182): asyncio.subprocess.SubprocessStreamProtocol no
     longer closes before all pipes are closed.

   - bpo-29271(183): Fix Task.current_task and Task.all_tasks
     implemented in C to accept None argument as their pure Python
     implementation.

   - bpo-29703(184): Fix asyncio to support instantiation of new event
     loops in child processes.

   - bpo-29615(185): SimpleXMLRPCDispatcher no longer chains KeyError
     (or any other exception) to exception(s) raised in the dispatched
     methods.  Patch by Petr Motejlek.

   - bpo-7769(186): Method register_function() of
     xmlrpc.server.SimpleXMLRPCDispatcher and its subclasses can now be
     used as a decorator.

   - bpo-29376(187): Fix assertion error in
     threading._DummyThread.is_alive().

   - bpo-28624(188): Add a test that checks that cwd parameter of
     Popen() accepts PathLike objects.  Patch by Sayan Chowdhury.

   - bpo-28518(189): Start a transaction implicitly before a DML
     statement.  Patch by Aviv Palivoda.

   - bpo-29742(190): get_extra_info() raises exception if get called on
     closed ssl transport.  Patch by Nikolay Kim.

   - bpo-16285(191): urllib.parse.quote is now based on RFC 3986 and
     hence includes '~' in the set of characters that is not quoted by
     default.  Patch by Christian Theune and Ratnadeep Debnath.

   - bpo-29532(192): Altering a kwarg dictionary passed to
     functools.partial() no longer affects a partial object after
     creation.

   - bpo-29110(193): Fix file object leak in aifc.open() when file is
     given as a filesystem path and is not in valid AIFF format.  Patch
     by Anthony Zhang.

   - bpo-22807(194): Add uuid.SafeUUID and uuid.UUID.is_safe to relay
     information from the platform about whether generated UUIDs are
     generated with a multiprocessing safe method.

   - bpo-29576(195): Improve some deprecations in importlib.  Some
     deprecated methods now emit DeprecationWarnings and have better
     descriptive messages.

   - bpo-29534(196): Fixed different behaviour of Decimal.from_float()
     for _decimal and _pydecimal.  Thanks Andrew Nester.

   - bpo-10379(197): locale.format_string now supports the 'monetary'
     keyword argument, and locale.format is deprecated.

   - bpo-29851(198): importlib.reload() now raises ModuleNotFoundError
     if the module lacks a spec.

   - bpo-28556(199): Various updates to typing module: typing.Counter,
     typing.ChainMap, improved ABC caching, etc.  Original PRs by Jelle
     Zijlstra, Ivan Levkivskyi, Manuel Krebber, and Łukasz Langa.

   - bpo-29100(200): Fix datetime.fromtimestamp() regression introduced
     in Python 3.6.0: check minimum and maximum years.

   - bpo-29416(201): Prevent infinite loop in pathlib.Path.mkdir

   - bpo-29444(202): Fixed out-of-bounds buffer access in the group()
     method of the match object.  Based on patch by WGH.

   - bpo-29377(203): Add WrapperDescriptorType, MethodWrapperType, and
     MethodDescriptorType built-in types to types module.  Original
     patch by Manuel Krebber.

   - bpo-29218(204): Unused install_misc command is now removed.  It has
     been documented as unused since 2000.  Patch by Eric N. Vander
     Weele.

   - bpo-29368(205): The extend() method is now called instead of the
     append() method when unpickle collections.deque and other list-like
     objects.  This can speed up unpickling to 2 times.

   - bpo-29338(206): The help of a builtin or extension class now
     includes the constructor signature if __text_signature__ is
     provided for the class.

   - bpo-29335(207): Fix subprocess.Popen.wait() when the child process
     has exited to a stopped instead of terminated state (ex: when under
     ptrace).

   - bpo-29290(208): Fix a regression in argparse that help messages
     would wrap at non-breaking spaces.

   - bpo-28735(209): Fixed the comparison of mock.MagickMock with
     mock.ANY.

   - bpo-29197(210): Removed deprecated function ntpath.splitunc().

   - bpo-29210(211): Removed support of deprecated argument "exclude" in
     tarfile.TarFile.add().

   - bpo-29219(212): Fixed infinite recursion in the repr of
     uninitialized ctypes.CDLL instances.

   - bpo-29192(213): Removed deprecated features in the http.cookies
     module.

   - bpo-29193(214): A format string argument for
     string.Formatter.format() is now positional-only.

   - bpo-29195(215): Removed support of deprecated undocumented keyword
     arguments in methods of regular expression objects.

   - bpo-28969(216): Fixed race condition in C implementation of
     functools.lru_cache.  KeyError could be raised when cached function
     with full cache was simultaneously called from different threads
     with the same uncached arguments.

   - bpo-20804(217): The unittest.mock.sentinel attributes now preserve
     their identity when they are copied or pickled.

   - bpo-29142(218): In urllib.request, suffixes in no_proxy environment
     variable with leading dots could match related hostnames again
     (e.g.  .b.c matches a.b.c).  Patch by Milan Oberkirch.

   - bpo-28961(219): Fix unittest.mock._Call helper: don't ignore the
     name parameter anymore.  Patch written by Jiajun Huang.

   - bpo-15812(220): inspect.getframeinfo() now correctly shows the
     first line of a context.  Patch by Sam Breese.

   - bpo-28985(221): Update authorizer constants in sqlite3 module.
     Patch by Dingyuan Wang.

   - bpo-29079(222): Prevent infinite loop in pathlib.resolve() on
     Windows

   - bpo-13051(223): Fixed recursion errors in large or resized
     curses.textpad.Textbox.  Based on patch by Tycho Andersen.

   - bpo-9770(224): curses.ascii predicates now work correctly with
     negative integers.

   - bpo-28427(225): old keys should not remove new values from
     WeakValueDictionary when collecting from another thread.

   - bpo-28923(226): Remove editor artifacts from Tix.py.

   - bpo-28871(227): Fixed a crash when deallocate deep ElementTree.

   - bpo-19542(228): Fix bugs in WeakValueDictionary.setdefault() and
     WeakValueDictionary.pop() when a GC collection happens in another
     thread.

   - bpo-20191(229): Fixed a crash in resource.prlimit() when passing a
     sequence that doesn't own its elements as limits.

   - bpo-16255(230): subprocess.Popen uses /system/bin/sh on Android as
     the shell, instead of /bin/sh.

   - bpo-28779(231): multiprocessing.set_forkserver_preload() would
     crash the forkserver process if a preloaded module instantiated
     some multiprocessing objects such as locks.

   - bpo-26937(232): The chown() method of the tarfile.TarFile class
     does not fail now when the grp module cannot be imported, as for
     example on Android platforms.

   - bpo-28847(233): dbm.dumb now supports reading read-only files and
     no longer writes the index file when it is not changed.  A
     deprecation warning is now emitted if the index file is missed and
     recreated in the 'r' and 'w' modes (will be an error in future
     Python releases).

   - bpo-27030(234): Unknown escapes consisting of ‘'\'’ and an ASCII
     letter in re.sub() replacement templates regular expressions now
     are errors.

   - bpo-28835(235): Fix a regression introduced in
     warnings.catch_warnings(): call warnings.showwarning() if it was
     overridden inside the context manager.

   - bpo-27172(236): To assist with upgrades from 2.7, the previously
     documented deprecation of ‘inspect.getfullargspec()’ has been
     reversed.  This decision may be revisited again after the Python
     2.7 branch is no longer officially supported.

   - bpo-28740(237): Add sys.getandroidapilevel(): return the build time
     API version of Android as an integer.  Function only available on
     Android.

   - bpo-26273(238): Add new ‘socket.TCP_CONGESTION’ (Linux 2.6.13) and
     ‘socket.TCP_USER_TIMEOUT’ (Linux 2.6.37) constants.  Patch written
     by Omar Sandoval.

   - bpo-28752(239): Restored the __reduce__() methods of datetime
     objects.

   - bpo-28727(240): Regular expression patterns, _sre.SRE_Pattern
     objects created by re.compile(), become comparable (only x==y and
     x!=y operators).  This change should fix the bpo-18383(241): don't
     duplicate warning filters when the warnings module is reloaded
     (thing usually only done in unit tests).

   - bpo-20572(242): Remove the subprocess.Popen.wait endtime parameter.
     It was deprecated in 3.4 and undocumented prior to that.

   - bpo-25659(243): In ctypes, prevent a crash calling the
     from_buffer() and from_buffer_copy() methods on abstract classes
     like Array.

   - bpo-28548(244): In the "http.server" module, parse the protocol
     version if possible, to avoid using HTTP 0.9 in some error
     responses.

   - bpo-19717(245): Makes Path.resolve() succeed on paths that do not
     exist.  Patch by Vajrasky Kok

   - bpo-28563(246): Fixed possible DoS and arbitrary code execution
     when handle plural form selections in the gettext module.  The
     expression parser now supports exact syntax supported by GNU
     gettext.

   - bpo-28387(247): Fixed possible crash in _io.TextIOWrapper
     deallocator when the garbage collector is invoked in other thread.
     Based on patch by Sebastian Cufre.

   - bpo-27517(248): LZMA compressor and decompressor no longer raise
     exceptions if given empty data twice.  Patch by Benjamin Fogle.

   - bpo-28549(249): Fixed segfault in curses's addch() with ncurses6.

   - bpo-28449(250): tarfile.open() with mode "r" or "r:" now tries to
     open a tar file with compression before trying to open it without
     compression.  Otherwise it had 50% chance failed with
     ignore_zeros=True.

   - bpo-23262(251): The webbrowser module now supports Firefox 36+ and
     derived browsers.  Based on patch by Oleg Broytman.

   - bpo-24241(252): The webbrowser in an X environment now prefers
     using the default browser directly.  Also, the webbrowser
     register() function now has a documented 'preferred' argument, to
     specify browsers to be returned by get() with no arguments.  Patch
     by David Steele

   - bpo-27939(253): Fixed bugs in tkinter.ttk.LabeledScale and
     tkinter.Scale caused by representing the scale as float value
     internally in Tk.  tkinter.IntVar now works if float value is set
     to underlying Tk variable.

   - bpo-28255(254): calendar.TextCalendar.prweek() no longer prints a
     space after a weeks's calendar.  calendar.TextCalendar.pryear() no
     longer prints redundant newline after a year's calendar.  Based on
     patch by Xiang Zhang.

   - bpo-28255(255): calendar.TextCalendar.prmonth() no longer prints a
     space at the start of new line after printing a month's calendar.
     Patch by Xiang Zhang.

   - bpo-20491(256): The textwrap.TextWrapper class now honors
     non-breaking spaces.  Based on patch by Kaarle Ritvanen.

   - bpo-28353(257): os.fwalk() no longer fails on broken links.

   - bpo-28430(258): Fix iterator of C implemented asyncio.Future
     doesn't accept non-None value is passed to it.send(val).

   - bpo-27025(259): Generated names for Tkinter widgets now start by
     the "!"  prefix for readability.

   - bpo-25464(260): Fixed HList.header_exists() in tkinter.tix module
     by addin a workaround to Tix library bug.

   - bpo-28488(261): shutil.make_archive() no longer adds entry "./" to
     ZIP archive.

   - bpo-25953(262): re.sub() now raises an error for invalid numerical
     group reference in replacement template even if the pattern is not
     found in the string.  Error message for invalid group reference now
     includes the group index and the position of the reference.  Based
     on patch by SilentGhost.

   - bpo-28469(263): timeit now uses the sequence 1, 2, 5, 10, 20,
     50,...  instead of 1, 10, 100,...  for autoranging.

   - bpo-28115(264): Command-line interface of the zipfile module now
     uses argparse.  Added support of long options.

   - bpo-18219(265): Optimize csv.DictWriter for large number of
     columns.  Patch by Mariatta Wijaya.

   - bpo-28448(266): Fix C implemented asyncio.Future didn't work on
     Windows.

   - bpo-23214(267): In the "io" module, the argument to BufferedReader
     and BytesIO's read1() methods is now optional and can be -1,
     matching the BufferedIOBase specification.

   - bpo-28480(268): Fix error building socket module when
     multithreading is disabled.

   - bpo-28240(269): timeit: remove ‘-c/--clock’ and ‘-t/--time’ command
     line options which were deprecated since Python 3.3.

   - bpo-28240(270): timeit now repeats the benchmarks 5 times instead
     of only 3 to make benchmarks more reliable.

   - bpo-28240(271): timeit autorange now uses a single loop iteration
     if the benchmark takes less than 10 seconds, instead of 10
     iterations.  "python3 -m timeit -s 'import time' 'time.sleep(1)'"
     now takes 4 seconds instead of 40 seconds.

   - Distutils.sdist now looks for README and setup.py files with case
     sensitivity.  This behavior matches that found in Setuptools 6.0
     and later.  See setuptools 100(272) for rationale.

   - bpo-24452(273): Make webbrowser support Chrome on Mac OS X. Patch
     by Ned Batchelder.

   - bpo-20766(274): Fix references leaked by pdb in the handling of
     SIGINT handlers.

   - bpo-27998(275): Fixed bytes path support in os.scandir() on
     Windows.  Patch by Eryk Sun.

   - bpo-28317(276): The disassembler now decodes FORMAT_VALUE argument.

   - bpo-28380(277): unittest.mock Mock autospec functions now properly
     support assert_called, assert_not_called, and assert_called_once.

   - bpo-28229(278): lzma module now supports pathlib.

   - bpo-28321(279): Fixed writing non-BMP characters with binary format
     in plistlib.

   - bpo-28225(280): bz2 module now supports pathlib.  Initial patch by
     Ethan Furman.

   - bpo-28227(281): gzip now supports pathlib.  Patch by Ethan Furman.

   - bpo-28332(282): Deprecated silent truncations in socket.htons and
     socket.ntohs.  Original patch by Oren Milman.

   - bpo-27358(283): Optimized merging var-keyword arguments and
     improved error message when passing a non-mapping as a var-keyword
     argument.

   - bpo-28257(284): Improved error message when passing a non-iterable
     as a var-positional argument.  Added opcode
     BUILD_TUPLE_UNPACK_WITH_CALL.

   - bpo-28322(285): Fixed possible crashes when unpickle itertools
     objects from incorrect pickle data.  Based on patch by John Leitch.

   - bpo-28228(286): imghdr now supports pathlib.

   - bpo-28226(287): compileall now supports pathlib.

   - bpo-28314(288): Fix function declaration (C flags) for the
     getiterator() method of xml.etree.ElementTree.Element.

   - bpo-28148(289): Stop using localtime() and gmtime() in the time
     module.  Introduced platform independent _PyTime_localtime API that
     is similar to POSIX localtime_r, but available on all platforms.
     Patch by Ed Schouten.

   - bpo-28253(290): Fixed calendar functions for extreme months:
     0001-01 and 9999-12.  Methods itermonthdays() and itermonthdays2()
     are reimplemented so that they don't call itermonthdates() which
     can cause datetime.date under/overflow.

   - bpo-28275(291): Fixed possible use after free in the decompress()
     methods of the LZMADecompressor and BZ2Decompressor classes.
     Original patch by John Leitch.

   - bpo-27897(292): Fixed possible crash in
     sqlite3.Connection.create_collation() if pass invalid string-like
     object as a name.  Patch by Xiang Zhang.

   - bpo-18844(293): random.choices() now has k as a keyword-only
     argument to improve the readability of common cases and come into
     line with the signature used in other languages.

   - bpo-18893(294): Fix invalid exception handling in
     Lib/ctypes/macholib/dyld.py.  Patch by Madison May.

   - bpo-27611(295): Fixed support of default root window in the
     tkinter.tix module.  Added the master parameter in the DisplayStyle
     constructor.

   - bpo-27348(296): In the traceback module, restore the formatting of
     exception messages like "Exception: None".  This fixes a regression
     introduced in 3.5a2.

   - bpo-25651(297): Allow false values to be used for msg parameter of
     subTest().

   - bpo-27778(298): Fix a memory leak in os.getrandom() when the
     getrandom() is interrupted by a signal and a signal handler raises
     a Python exception.

   - bpo-28200(299): Fix memory leak on Windows in the os module (fix
     path_converter() function).

   - bpo-25400(300): RobotFileParser now correctly returns default
     values for crawl_delay and request_rate.  Initial patch by Peter
     Wirtz.

   - bpo-27932(301): Prevent memory leak in win32_ver().

   - Fix UnboundLocalError in socket._sendfile_use_sendfile.

   - bpo-28075(302): Check for ERROR_ACCESS_DENIED in Windows
     implementation of os.stat().  Patch by Eryk Sun.

   - bpo-22493(303): Warning message emitted by using inline flags in
     the middle of regular expression now contains a (truncated) regex
     pattern.  Patch by Tim Graham.

   - bpo-25270(304): Prevent codecs.escape_encode() from raising
     SystemError when an empty bytestring is passed.

   - bpo-28181(305): Get antigravity over HTTPS. Patch by Kaartic
     Sivaraam.

   - bpo-25895(306): Enable WebSocket URL schemes in
     urllib.parse.urljoin.  Patch by Gergely Imreh and Markus
     Holtermann.

   - bpo-28114(307): Fix a crash in parse_envlist() when env contains
     byte strings.  Patch by Eryk Sun.

   - bpo-27599(308): Fixed buffer overrun in binascii.b2a_qp() and
     binascii.a2b_qp().

   - bpo-27906(309): Fix socket accept exhaustion during high TCP
     traffic.  Patch by Kevin Conway.

   - bpo-28174(310): Handle when SO_REUSEPORT isn't properly supported.
     Patch by Seth Michael Larson.

   - bpo-26654(311): Inspect functools.partial in
     asyncio.Handle.__repr__.  Patch by iceboy.

   - bpo-26909(312): Fix slow pipes IO in asyncio.  Patch by INADA
     Naoki.

   - bpo-28176(313): Fix callbacks race in
     asyncio.SelectorLoop.sock_connect.

   - bpo-27759(314): Fix selectors incorrectly retain invalid file
     descriptors.  Patch by Mark Williams.

   - bpo-28325(315): Remove vestigial MacOS 9 macurl2path module and its
     tests.

   - bpo-28368(316): Refuse monitoring processes if the child watcher
     has no loop attached.  Patch by Vincent Michel.

   - bpo-28369(317): Raise RuntimeError when transport's FD is used with
     add_reader, add_writer, etc.

   - bpo-28370(318): Speedup asyncio.StreamReader.readexactly.  Patch by
     Коренберг Марк.

   - bpo-28371(319): Deprecate passing asyncio.Handles to
     run_in_executor.

   - bpo-28372(320): Fix asyncio to support formatting of non-python
     coroutines.

   - bpo-28399(321): Remove UNIX socket from FS before binding.  Patch
     by Коренберг Марк.

   - bpo-27972(322): Prohibit Tasks to await on themselves.

   - bpo-24142(323): Reading a corrupt config file left configparser in
     an invalid state.  Original patch by Florian Höch.

   - bpo-29581(324): ABCMeta.__new__ now accepts ‘**kwargs’, allowing
     abstract base classes to use keyword parameters in
     __init_subclass__.  Patch by Nate Soares.

   - bpo-25532(325): inspect.unwrap() will now only try to unwrap an
     object sys.getrecursionlimit() times, to protect against objects
     which create a new object on every attribute access.

   - bpo-30177(326): path.resolve(strict=False) no longer cuts the path
     after the first element not present in the filesystem.  Patch by
     Antoine Pietri.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31499

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31482

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31544

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31234

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31457

   (8) https://bugs.python.org/issue?@action=redirect&bpo=31431

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31233

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28638

   (11) https://bugs.python.org/issue?@action=redirect&bpo=31400

   (12) https://bugs.python.org/issue?@action=redirect&bpo=27629

   (13) https://bugs.python.org/issue?@action=redirect&bpo=28958

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28182

   (15) https://bugs.python.org/issue?@action=redirect&bpo=27340

   (16) https://bugs.python.org/issue?@action=redirect&bpo=14191

   (17) https://bugs.python.org/issue?@action=redirect&bpo=31178

   (18) https://bugs.python.org/issue?@action=redirect&bpo=31350

   (19) https://bugs.python.org/issue?@action=redirect&bpo=31170

   (20) https://bugs.python.org/issue?@action=redirect&bpo=29136

   (21) https://bugs.python.org/issue?@action=redirect&bpo=1198569

   (22) https://bugs.python.org/issue?@action=redirect&bpo=31326

   (23) https://bugs.python.org/issue?@action=redirect&bpo=27144

   (24) https://bugs.python.org/issue?@action=redirect&bpo=31281

   (25) https://bugs.python.org/issue?@action=redirect&bpo=10746

   (26) https://peps.python.org/pep-3118/

   (27) https://bugs.python.org/issue?@action=redirect&bpo=27584

   (28) https://bugs.python.org/issue?@action=redirect&bpo=22536

   (29) https://bugs.python.org/issue?@action=redirect&bpo=29741

   (30) https://bugs.python.org/issue?@action=redirect&bpo=31249

   (31) https://bugs.python.org/issue?@action=redirect&bpo=31247

   (32) https://bugs.python.org/issue?@action=redirect&bpo=23835

   (33) https://bugs.python.org/issue?@action=redirect&bpo=31238

   (34) https://bugs.python.org/issue?@action=redirect&bpo=5001

   (35) https://bugs.python.org/issue?@action=redirect&bpo=31109

   (36) https://bugs.python.org/issue?@action=redirect&bpo=30102

   (37) https://bugs.python.org/issue?@action=redirect&bpo=18966

   (38) https://bugs.python.org/issue?@action=redirect&bpo=31183

   (39) https://bugs.python.org/issue?@action=redirect&bpo=5001

   (40) https://bugs.python.org/issue?@action=redirect&bpo=31185

   (41) https://bugs.python.org/issue?@action=redirect&bpo=31151

   (42) https://bugs.python.org/issue?@action=redirect&bpo=31072

   (43) https://bugs.python.org/issue?@action=redirect&bpo=24700

   (44) https://bugs.python.org/issue?@action=redirect&bpo=31135

   (45) https://bugs.python.org/issue?@action=redirect&bpo=31107

   (46) https://bugs.python.org/issue?@action=redirect&bpo=31080

   (47) https://bugs.python.org/issue?@action=redirect&bpo=30897

   (48) https://bugs.python.org/issue?@action=redirect&bpo=31061

   (49) https://bugs.python.org/issue?@action=redirect&bpo=30987

   (50) https://bugs.python.org/issue?@action=redirect&bpo=30522

   (51) https://bugs.python.org/issue?@action=redirect&bpo=30502

   (52) https://bugs.python.org/issue?@action=redirect&bpo=5288

   (53) https://bugs.python.org/issue?@action=redirect&bpo=30919

   (54) https://bugs.python.org/issue?@action=redirect&bpo=26732

   (55) https://bugs.python.org/issue?@action=redirect&bpo=29403

   (56) https://bugs.python.org/issue?@action=redirect&bpo=30961

   (57) https://bugs.python.org/issue?@action=redirect&bpo=19896

   (58) https://bugs.python.org/issue?@action=redirect&bpo=30946

   (59) https://bugs.python.org/issue?@action=redirect&bpo=25684

   (60) https://bugs.python.org/issue?@action=redirect&bpo=30886

   (61) https://bugs.python.org/issue?@action=redirect&bpo=29854

   (62) https://bugs.python.org/issue?@action=redirect&bpo=30794

   (63) https://bugs.python.org/issue?@action=redirect&bpo=30319

   (64) https://bugs.python.org/issue?@action=redirect&bpo=30828

   (65) https://bugs.python.org/issue?@action=redirect&bpo=30302

   (66) https://bugs.python.org/issue?@action=redirect&bpo=30807

   (67) https://bugs.python.org/issue?@action=redirect&bpo=30441

   (68) https://bugs.python.org/issue?@action=redirect&bpo=29585

   (69) https://bugs.python.org/issue?@action=redirect&bpo=29293

   (70) https://bugs.python.org/issue?@action=redirect&bpo=30532

   (71) https://bugs.python.org/issue?@action=redirect&bpo=30596

   (72) https://bugs.python.org/issue?@action=redirect&bpo=9146

   (73) https://bugs.python.org/issue?@action=redirect&bpo=29169

   (74) https://bugs.python.org/issue?@action=redirect&bpo=30119

   (75) https://bugs.python.org/issue?@action=redirect&bpo=30879

   (76) https://bugs.python.org/issue?@action=redirect&bpo=30746

   (77) https://bugs.python.org/issue?@action=redirect&bpo=30664

   (78) https://bugs.python.org/issue?@action=redirect&bpo=21071

   (79) https://bugs.python.org/issue?@action=redirect&bpo=29212

   (80) https://bugs.python.org/issue?@action=redirect&bpo=29755

   (81) https://bugs.python.org/issue?@action=redirect&bpo=30616

   (82) https://bugs.python.org/issue?@action=redirect&bpo=30038

   (83) https://bugs.python.org/issue?@action=redirect&bpo=23894

   (84) https://bugs.python.org/issue?@action=redirect&bpo=24744

   (85) https://bugs.python.org/issue?@action=redirect&bpo=24484

   (86) https://bugs.python.org/issue?@action=redirect&bpo=30589

   (87) https://bugs.python.org/issue?@action=redirect&bpo=28994

   (88) https://bugs.python.org/issue?@action=redirect&bpo=30508

   (89) https://bugs.python.org/issue?@action=redirect&bpo=30645

   (90) https://bugs.python.org/issue?@action=redirect&bpo=11822

   (91) https://bugs.python.org/issue?@action=redirect&bpo=30624

   (92) https://bugs.python.org/issue?@action=redirect&bpo=30595

   (93) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (94) https://bugs.python.org/issue?@action=redirect&bpo=30605

   (95) https://bugs.python.org/issue?@action=redirect&bpo=29870

   (96) https://bugs.python.org/issue?@action=redirect&bpo=29743

   (97) https://bugs.python.org/issue?@action=redirect&bpo=27585

   (98) https://bugs.python.org/issue?@action=redirect&bpo=30014

   (99) https://bugs.python.org/issue?@action=redirect&bpo=30418

   (100) https://bugs.python.org/issue?@action=redirect&bpo=30463

   (101) https://bugs.python.org/issue?@action=redirect&bpo=30520

   (102) https://bugs.python.org/issue?@action=redirect&bpo=30557

   (103) https://bugs.python.org/issue?@action=redirect&bpo=30526

   (104) https://bugs.python.org/issue?@action=redirect&bpo=30245

   (105) https://bugs.python.org/issue?@action=redirect&bpo=30378

   (106) https://bugs.python.org/issue?@action=redirect&bpo=16500

   (107) https://bugs.python.org/issue?@action=redirect&bpo=30470

   (108) https://bugs.python.org/issue?@action=redirect&bpo=30414

   (109) https://bugs.python.org/issue?@action=redirect&bpo=30003

   (110) https://bugs.python.org/issue?@action=redirect&bpo=30149

   (111) https://bugs.python.org/issue?@action=redirect&bpo=30436

   (112) https://bugs.python.org/issue?@action=redirect&bpo=30301

   (113) https://bugs.python.org/issue?@action=redirect&bpo=30375

   (114) https://bugs.python.org/issue?@action=redirect&bpo=30329

   (115) https://bugs.python.org/issue?@action=redirect&bpo=29196

   (116) https://bugs.python.org/issue?@action=redirect&bpo=9850

   (117) https://bugs.python.org/issue?@action=redirect&bpo=30299

   (118) https://bugs.python.org/issue?@action=redirect&bpo=30048

   (119) https://bugs.python.org/issue?@action=redirect&bpo=30266

   (120) https://bugs.python.org/issue?@action=redirect&bpo=25958

   (121) https://bugs.python.org/issue?@action=redirect&bpo=30340

   (122) https://bugs.python.org/issue?@action=redirect&bpo=30298

   (123) https://bugs.python.org/issue?@action=redirect&bpo=30285

   (124) https://bugs.python.org/issue?@action=redirect&bpo=29990

   (125) https://bugs.python.org/issue?@action=redirect&bpo=29979

   (126) https://bugs.python.org/issue?@action=redirect&bpo=30243

   (127) https://bugs.python.org/issue?@action=redirect&bpo=30215

   (128) https://bugs.python.org/issue?@action=redirect&bpo=30185

   (129) https://bugs.python.org/issue?@action=redirect&bpo=30103

   (130) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (131) https://bugs.python.org/issue?@action=redirect&bpo=30205

   (132) https://bugs.python.org/issue?@action=redirect&bpo=30228

   (133) https://bugs.python.org/issue?@action=redirect&bpo=30190

   (134) https://bugs.python.org/issue?@action=redirect&bpo=30101

   (135) https://bugs.python.org/issue?@action=redirect&bpo=29822

   (136) https://bugs.python.org/issue?@action=redirect&bpo=29960

   (137) https://bugs.python.org/issue?@action=redirect&bpo=30070

   (138) https://bugs.python.org/issue?@action=redirect&bpo=22352

   (139) https://bugs.python.org/issue?@action=redirect&bpo=30061

   (140) https://bugs.python.org/issue?@action=redirect&bpo=30218

   (141) https://bugs.python.org/issue?@action=redirect&bpo=10076

   (142) https://bugs.python.org/issue?@action=redirect&bpo=30068

   (143) https://bugs.python.org/issue?@action=redirect&bpo=29694

   (144) https://bugs.python.org/issue?@action=redirect&bpo=29692

   (145) https://bugs.python.org/issue?@action=redirect&bpo=26187

   (146) https://bugs.python.org/issue?@action=redirect&bpo=9303

   (147) https://bugs.python.org/issue?@action=redirect&bpo=30017

   (148) https://bugs.python.org/issue?@action=redirect&bpo=29998

   (149) https://bugs.python.org/issue?@action=redirect&bpo=29995

   (150) https://bugs.python.org/issue?@action=redirect&bpo=29962

   (151) https://bugs.python.org/issue?@action=redirect&bpo=29649

   (152) https://bugs.python.org/issue?@action=redirect&bpo=29654

   (153) https://bugs.python.org/issue?@action=redirect&bpo=29931

   (154) https://bugs.python.org/issue?@action=redirect&bpo=29953

   (155) https://bugs.python.org/issue?@action=redirect&bpo=29942

   (156) https://bugs.python.org/issue?@action=redirect&bpo=10030

   (157) https://bugs.python.org/issue?@action=redirect&bpo=29204

   (158) https://bugs.python.org/issue?@action=redirect&bpo=27863

   (159) https://bugs.python.org/issue?@action=redirect&bpo=25996

   (160) https://bugs.python.org/issue?@action=redirect&bpo=28699

   (161) https://bugs.python.org/issue?@action=redirect&bpo=23890

   (162) https://bugs.python.org/issue?@action=redirect&bpo=29901

   (163) https://bugs.python.org/issue?@action=redirect&bpo=25803

   (164) https://bugs.python.org/issue?@action=redirect&bpo=29861

   (165) https://bugs.python.org/issue?@action=redirect&bpo=19930

   (166) https://bugs.python.org/issue?@action=redirect&bpo=29884

   (167) https://bugs.python.org/issue?@action=redirect&bpo=25455

   (168) https://bugs.python.org/issue?@action=redirect&bpo=29800

   (169) https://bugs.python.org/issue?@action=redirect&bpo=8256

   (170) https://bugs.python.org/issue?@action=redirect&bpo=28692

   (171) https://bugs.python.org/issue?@action=redirect&bpo=26121

   (172) https://bugs.python.org/issue?@action=redirect&bpo=29619

   (173) https://bugs.python.org/issue?@action=redirect&bpo=28298

   (174) https://bugs.python.org/issue?@action=redirect&bpo=29645

   (175) https://bugs.python.org/issue?@action=redirect&bpo=28231

   (176) https://bugs.python.org/issue?@action=redirect&bpo=26915

   (177) https://bugs.python.org/issue?@action=redirect&bpo=28682

   (178) https://bugs.python.org/issue?@action=redirect&bpo=29728

   (179) https://bugs.python.org/issue?@action=redirect&bpo=29623

   (180) https://bugs.python.org/issue?@action=redirect&bpo=9303

   (181) https://bugs.python.org/issue?@action=redirect&bpo=28963

   (182) https://bugs.python.org/issue?@action=redirect&bpo=29704

   (183) https://bugs.python.org/issue?@action=redirect&bpo=29271

   (184) https://bugs.python.org/issue?@action=redirect&bpo=29703

   (185) https://bugs.python.org/issue?@action=redirect&bpo=29615

   (186) https://bugs.python.org/issue?@action=redirect&bpo=7769

   (187) https://bugs.python.org/issue?@action=redirect&bpo=29376

   (188) https://bugs.python.org/issue?@action=redirect&bpo=28624

   (189) https://bugs.python.org/issue?@action=redirect&bpo=28518

   (190) https://bugs.python.org/issue?@action=redirect&bpo=29742

   (191) https://bugs.python.org/issue?@action=redirect&bpo=16285

   (192) https://bugs.python.org/issue?@action=redirect&bpo=29532

   (193) https://bugs.python.org/issue?@action=redirect&bpo=29110

   (194) https://bugs.python.org/issue?@action=redirect&bpo=22807

   (195) https://bugs.python.org/issue?@action=redirect&bpo=29576

   (196) https://bugs.python.org/issue?@action=redirect&bpo=29534

   (197) https://bugs.python.org/issue?@action=redirect&bpo=10379

   (198) https://bugs.python.org/issue?@action=redirect&bpo=29851

   (199) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (200) https://bugs.python.org/issue?@action=redirect&bpo=29100

   (201) https://bugs.python.org/issue?@action=redirect&bpo=29416

   (202) https://bugs.python.org/issue?@action=redirect&bpo=29444

   (203) https://bugs.python.org/issue?@action=redirect&bpo=29377

   (204) https://bugs.python.org/issue?@action=redirect&bpo=29218

   (205) https://bugs.python.org/issue?@action=redirect&bpo=29368

   (206) https://bugs.python.org/issue?@action=redirect&bpo=29338

   (207) https://bugs.python.org/issue?@action=redirect&bpo=29335

   (208) https://bugs.python.org/issue?@action=redirect&bpo=29290

   (209) https://bugs.python.org/issue?@action=redirect&bpo=28735

   (210) https://bugs.python.org/issue?@action=redirect&bpo=29197

   (211) https://bugs.python.org/issue?@action=redirect&bpo=29210

   (212) https://bugs.python.org/issue?@action=redirect&bpo=29219

   (213) https://bugs.python.org/issue?@action=redirect&bpo=29192

   (214) https://bugs.python.org/issue?@action=redirect&bpo=29193

   (215) https://bugs.python.org/issue?@action=redirect&bpo=29195

   (216) https://bugs.python.org/issue?@action=redirect&bpo=28969

   (217) https://bugs.python.org/issue?@action=redirect&bpo=20804

   (218) https://bugs.python.org/issue?@action=redirect&bpo=29142

   (219) https://bugs.python.org/issue?@action=redirect&bpo=28961

   (220) https://bugs.python.org/issue?@action=redirect&bpo=15812

   (221) https://bugs.python.org/issue?@action=redirect&bpo=28985

   (222) https://bugs.python.org/issue?@action=redirect&bpo=29079

   (223) https://bugs.python.org/issue?@action=redirect&bpo=13051

   (224) https://bugs.python.org/issue?@action=redirect&bpo=9770

   (225) https://bugs.python.org/issue?@action=redirect&bpo=28427

   (226) https://bugs.python.org/issue?@action=redirect&bpo=28923

   (227) https://bugs.python.org/issue?@action=redirect&bpo=28871

   (228) https://bugs.python.org/issue?@action=redirect&bpo=19542

   (229) https://bugs.python.org/issue?@action=redirect&bpo=20191

   (230) https://bugs.python.org/issue?@action=redirect&bpo=16255

   (231) https://bugs.python.org/issue?@action=redirect&bpo=28779

   (232) https://bugs.python.org/issue?@action=redirect&bpo=26937

   (233) https://bugs.python.org/issue?@action=redirect&bpo=28847

   (234) https://bugs.python.org/issue?@action=redirect&bpo=27030

   (235) https://bugs.python.org/issue?@action=redirect&bpo=28835

   (236) https://bugs.python.org/issue?@action=redirect&bpo=27172

   (237) https://bugs.python.org/issue?@action=redirect&bpo=28740

   (238) https://bugs.python.org/issue?@action=redirect&bpo=26273

   (239) https://bugs.python.org/issue?@action=redirect&bpo=28752

   (240) https://bugs.python.org/issue?@action=redirect&bpo=28727

   (241) https://bugs.python.org/issue?@action=redirect&bpo=18383

   (242) https://bugs.python.org/issue?@action=redirect&bpo=20572

   (243) https://bugs.python.org/issue?@action=redirect&bpo=25659

   (244) https://bugs.python.org/issue?@action=redirect&bpo=28548

   (245) https://bugs.python.org/issue?@action=redirect&bpo=19717

   (246) https://bugs.python.org/issue?@action=redirect&bpo=28563

   (247) https://bugs.python.org/issue?@action=redirect&bpo=28387

   (248) https://bugs.python.org/issue?@action=redirect&bpo=27517

   (249) https://bugs.python.org/issue?@action=redirect&bpo=28549

   (250) https://bugs.python.org/issue?@action=redirect&bpo=28449

   (251) https://bugs.python.org/issue?@action=redirect&bpo=23262

   (252) https://bugs.python.org/issue?@action=redirect&bpo=24241

   (253) https://bugs.python.org/issue?@action=redirect&bpo=27939

   (254) https://bugs.python.org/issue?@action=redirect&bpo=28255

   (255) https://bugs.python.org/issue?@action=redirect&bpo=28255

   (256) https://bugs.python.org/issue?@action=redirect&bpo=20491

   (257) https://bugs.python.org/issue?@action=redirect&bpo=28353

   (258) https://bugs.python.org/issue?@action=redirect&bpo=28430

   (259) https://bugs.python.org/issue?@action=redirect&bpo=27025

   (260) https://bugs.python.org/issue?@action=redirect&bpo=25464

   (261) https://bugs.python.org/issue?@action=redirect&bpo=28488

   (262) https://bugs.python.org/issue?@action=redirect&bpo=25953

   (263) https://bugs.python.org/issue?@action=redirect&bpo=28469

   (264) https://bugs.python.org/issue?@action=redirect&bpo=28115

   (265) https://bugs.python.org/issue?@action=redirect&bpo=18219

   (266) https://bugs.python.org/issue?@action=redirect&bpo=28448

   (267) https://bugs.python.org/issue?@action=redirect&bpo=23214

   (268) https://bugs.python.org/issue?@action=redirect&bpo=28480

   (269) https://bugs.python.org/issue?@action=redirect&bpo=28240

   (270) https://bugs.python.org/issue?@action=redirect&bpo=28240

   (271) https://bugs.python.org/issue?@action=redirect&bpo=28240

   (272) https://github.com/pypa/setuptools/issues/100

   (273) https://bugs.python.org/issue?@action=redirect&bpo=24452

   (274) https://bugs.python.org/issue?@action=redirect&bpo=20766

   (275) https://bugs.python.org/issue?@action=redirect&bpo=27998

   (276) https://bugs.python.org/issue?@action=redirect&bpo=28317

   (277) https://bugs.python.org/issue?@action=redirect&bpo=28380

   (278) https://bugs.python.org/issue?@action=redirect&bpo=28229

   (279) https://bugs.python.org/issue?@action=redirect&bpo=28321

   (280) https://bugs.python.org/issue?@action=redirect&bpo=28225

   (281) https://bugs.python.org/issue?@action=redirect&bpo=28227

   (282) https://bugs.python.org/issue?@action=redirect&bpo=28332

   (283) https://bugs.python.org/issue?@action=redirect&bpo=27358

   (284) https://bugs.python.org/issue?@action=redirect&bpo=28257

   (285) https://bugs.python.org/issue?@action=redirect&bpo=28322

   (286) https://bugs.python.org/issue?@action=redirect&bpo=28228

   (287) https://bugs.python.org/issue?@action=redirect&bpo=28226

   (288) https://bugs.python.org/issue?@action=redirect&bpo=28314

   (289) https://bugs.python.org/issue?@action=redirect&bpo=28148

   (290) https://bugs.python.org/issue?@action=redirect&bpo=28253

   (291) https://bugs.python.org/issue?@action=redirect&bpo=28275

   (292) https://bugs.python.org/issue?@action=redirect&bpo=27897

   (293) https://bugs.python.org/issue?@action=redirect&bpo=18844

   (294) https://bugs.python.org/issue?@action=redirect&bpo=18893

   (295) https://bugs.python.org/issue?@action=redirect&bpo=27611

   (296) https://bugs.python.org/issue?@action=redirect&bpo=27348

   (297) https://bugs.python.org/issue?@action=redirect&bpo=25651

   (298) https://bugs.python.org/issue?@action=redirect&bpo=27778

   (299) https://bugs.python.org/issue?@action=redirect&bpo=28200

   (300) https://bugs.python.org/issue?@action=redirect&bpo=25400

   (301) https://bugs.python.org/issue?@action=redirect&bpo=27932

   (302) https://bugs.python.org/issue?@action=redirect&bpo=28075

   (303) https://bugs.python.org/issue?@action=redirect&bpo=22493

   (304) https://bugs.python.org/issue?@action=redirect&bpo=25270

   (305) https://bugs.python.org/issue?@action=redirect&bpo=28181

   (306) https://bugs.python.org/issue?@action=redirect&bpo=25895

   (307) https://bugs.python.org/issue?@action=redirect&bpo=28114

   (308) https://bugs.python.org/issue?@action=redirect&bpo=27599

   (309) https://bugs.python.org/issue?@action=redirect&bpo=27906

   (310) https://bugs.python.org/issue?@action=redirect&bpo=28174

   (311) https://bugs.python.org/issue?@action=redirect&bpo=26654

   (312) https://bugs.python.org/issue?@action=redirect&bpo=26909

   (313) https://bugs.python.org/issue?@action=redirect&bpo=28176

   (314) https://bugs.python.org/issue?@action=redirect&bpo=27759

   (315) https://bugs.python.org/issue?@action=redirect&bpo=28325

   (316) https://bugs.python.org/issue?@action=redirect&bpo=28368

   (317) https://bugs.python.org/issue?@action=redirect&bpo=28369

   (318) https://bugs.python.org/issue?@action=redirect&bpo=28370

   (319) https://bugs.python.org/issue?@action=redirect&bpo=28371

   (320) https://bugs.python.org/issue?@action=redirect&bpo=28372

   (321) https://bugs.python.org/issue?@action=redirect&bpo=28399

   (322) https://bugs.python.org/issue?@action=redirect&bpo=27972

   (323) https://bugs.python.org/issue?@action=redirect&bpo=24142

   (324) https://bugs.python.org/issue?@action=redirect&bpo=29581

   (325) https://bugs.python.org/issue?@action=redirect&bpo=25532

   (326) https://bugs.python.org/issue?@action=redirect&bpo=30177


File: python.info,  Node: ドキュメント<66>,  Next: テスト<62>,  Prev: ライブラリ<173>,  Up: Python 3 7 0 alpha 1

1.24.73.4 ドキュメント
......................

   - bpo-31294(1): Fix incomplete code snippet in the
     ZeroMQSocketListener and ZeroMQSocketHandler examples and adapt
     them to Python 3.

   - bpo-21649(2): Add RFC 7525 and Mozilla server side TLS links to SSL
     documentation.

   - bpo-31128(3): Allow the pydoc server to bind to arbitrary
     hostnames.

   - bpo-30803(4): Clarify doc on truth value testing.  Original patch
     by Peter Thomassen.

   - bpo-30176(5): Add missing attribute related constants in curses
     documentation.

   - bpo-30052(6): the link targets for *note bytes(): 192. and *note
     bytearray(): 344. are now their respective type definitions, rather
     than the corresponding builtin function entries.  Use *note bytes:
     1e9a. and *note bytearray: 1e9b. to reference the latter.  In order
     to ensure this and future cross-reference updates are applied
     automatically, the daily documentation builds now disable the
     default output caching features in Sphinx.

   - bpo-26985(7): Add missing info of code object in inspect
     documentation.

   - bpo-19824(8): Improve the documentation for, and links to, template
     strings by emphasizing their utility for internationalization, and
     by clarifying some usage constraints.  (See also: bpo-20314(9),
     bpo-12518(10))

   - bpo-28929(11): Link the documentation to its source file on GitHub.

   - bpo-25008(12): Document smtpd.py as effectively deprecated and add
     a pointer to aiosmtpd, a third-party asyncio-based replacement.

   - bpo-26355(13): Add canonical header link on each page to
     corresponding major version of the documentation.  Patch by
     Matthias Bussonnier.

   - bpo-29349(14): Fix Python 2 syntax in code for building the
     documentation.

   - bpo-23722(15): The data model reference and the porting section in
     the 3.6 What's New guide now cover the additional ‘__classcell__’
     handling needed for custom metaclasses to fully support PEP 487(16)
     and zero-argument ‘super()’.

   - bpo-28513(17): Documented command-line interface of zipfile.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31294

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21649

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31128

   (4) https://bugs.python.org/issue?@action=redirect&bpo=30803

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30176

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30052

   (7) https://bugs.python.org/issue?@action=redirect&bpo=26985

   (8) https://bugs.python.org/issue?@action=redirect&bpo=19824

   (9) https://bugs.python.org/issue?@action=redirect&bpo=20314

   (10) https://bugs.python.org/issue?@action=redirect&bpo=12518

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28929

   (12) https://bugs.python.org/issue?@action=redirect&bpo=25008

   (13) https://bugs.python.org/issue?@action=redirect&bpo=26355

   (14) https://bugs.python.org/issue?@action=redirect&bpo=29349

   (15) https://bugs.python.org/issue?@action=redirect&bpo=23722

   (16) https://peps.python.org/pep-0487/

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28513


File: python.info,  Node: テスト<62>,  Next: ビルド<70>,  Prev: ドキュメント<66>,  Up: Python 3 7 0 alpha 1

1.24.73.5 テスト
................

   - bpo-29639(1): test.support.HOST is now "localhost", a new HOSTv4
     constant has been added for your ‘127.0.0.1’ needs, similar to the
     existing HOSTv6 constant.

   - bpo-31320(2): Silence traceback in test_ssl

   - bpo-31346(3): Prefer PROTOCOL_TLS_CLIENT and PROTOCOL_TLS_SERVER
     protocols for SSLContext.

   - bpo-25674(4): Remove sha256.tbs-internet.com ssl test

   - bpo-30715(5): Address ALPN callback changes for OpenSSL 1.1.0f.
     The latest version behaves like OpenSSL 1.0.2 and no longer aborts
     handshake.

   - bpo-30822(6): regrtest: Exclude tzdata from regrtest -all.  When
     running the test suite using -use=all / -u all, exclude tzdata
     since it makes test_datetime too slow (15-20 min on some buildbots)
     which then times out on some buildbots.  Fix also regrtest command
     line parser to allow passing -u extralargefile to run
     test_zipfile64.

   - bpo-30695(7): Add the ‘set_nomemory(start, stop)’ and
     ‘remove_mem_hooks()’ functions to the ‘_testcapi’ module.

   - bpo-30357(8): test_thread: setUp() now uses
     support.threading_setup() and support.threading_cleanup() to wait
     until threads complete to avoid random side effects on following
     tests.  Initial patch written by Grzegorz Grzywacz.

   - bpo-30197(9): Enhanced functions swap_attr() and swap_item() in the
     test.support module.  They now work when delete replaced attribute
     or item inside the with statement.  The old value of the attribute
     or item (or None if it doesn't exist) now will be assigned to the
     target of the "as" clause, if there is one.

   - bpo-24932(10): Use proper command line parsing in _testembed

   - bpo-28950(11): Disallow -j0 to be combined with -T/-l in regrtest
     command line arguments.

   - bpo-28683(12): Fix the tests that bind() a unix socket and raise
     PermissionError on Android for a non-root user.

   - bpo-26936(13): Fix the test_socket failures on Android -
     getservbyname(), getservbyport() and getaddrinfo() are broken on
     some Android API levels.

   - bpo-28666(14): Now test.support.rmtree is able to remove unwritable
     or unreadable directories.

   - bpo-23839(15): Various caches now are cleared before running every
     test file.

   - bpo-26944(16): Fix test_posix for Android where 'id -G' is entirely
     wrong or missing the effective gid.

   - bpo-28409(17): regrtest: fix the parser of command line arguments.

   - bpo-28217(18): Adds _testconsole module to test console input.

   - bpo-26939(19): Add the support.setswitchinterval() function to fix
     test_functools hanging on the Android armv7 qemu emulator.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29639

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31320

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31346

   (4) https://bugs.python.org/issue?@action=redirect&bpo=25674

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30715

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30822

   (7) https://bugs.python.org/issue?@action=redirect&bpo=30695

   (8) https://bugs.python.org/issue?@action=redirect&bpo=30357

   (9) https://bugs.python.org/issue?@action=redirect&bpo=30197

   (10) https://bugs.python.org/issue?@action=redirect&bpo=24932

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28950

   (12) https://bugs.python.org/issue?@action=redirect&bpo=28683

   (13) https://bugs.python.org/issue?@action=redirect&bpo=26936

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28666

   (15) https://bugs.python.org/issue?@action=redirect&bpo=23839

   (16) https://bugs.python.org/issue?@action=redirect&bpo=26944

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28409

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28217

   (19) https://bugs.python.org/issue?@action=redirect&bpo=26939


File: python.info,  Node: ビルド<70>,  Next: Windows<63>,  Prev: テスト<62>,  Up: Python 3 7 0 alpha 1

1.24.73.6 ビルド
................

   - bpo-31354(1): Allow ‘--with-lto’ to be used on all builds, not just
     ‘make profile-opt’.

   - bpo-31370(2): Remove support for building -without-threads.  This
     option is not really useful anymore in the 21st century.  Removing
     lots of conditional paths allows us to simplify the code base,
     including in difficult to maintain low-level internal code.

   - bpo-31341(3): Per PEP 11(4), support for the IRIX operating system
     was removed.

   - bpo-30854(5): Fix compile error when compiling -without-threads.
     Patch by Masayuki Yamamoto.

   - bpo-30687(6): Locate msbuild.exe on Windows when building rather
     than vcvarsall.bat

   - bpo-20210(7): Support the 'disabled' marker in Setup files.
     Extension modules listed after this marker are not built at all,
     neither by the Makefile nor by setup.py.

   - bpo-29941(8): Add ‘--with-assertions’ configure flag to explicitly
     enable C ‘assert()’ checks.  Defaults to off.  ‘--with-pydebug’
     implies ‘--with-assertions’.

   - bpo-28787(9): Fix out-of-tree builds of Python when configured with
     ‘--with--dtrace’.

   - bpo-29243(10): Prevent unnecessary rebuilding of Python during
     ‘make test’, ‘make install’ and some other make targets when
     configured with ‘--enable-optimizations’.

   - bpo-23404(11): Don't regenerate generated files based on file
     modification time anymore: the action is now explicit.  Replace
     ‘make touch’ with ‘make regen-all’.

   - bpo-29643(12): Fix ‘--enable-optimization’ didn't work.

   - bpo-27593(13): sys.version and the platform module python_build(),
     python_branch(), and python_revision() functions now use git
     information rather than hg when building from a repo.

   - bpo-29572(14): Update Windows build and OS X installers to use
     OpenSSL 1.0.2k.

   - bpo-27659(15): Prohibit implicit C function declarations: use
     ‘-Werror=implicit-function-declaration’ when possible (GCC and
     Clang, but it depends on the compiler version).  Patch written by
     Chi Hsuan Yen.

   - bpo-29384(16): Remove old Be OS helper scripts.

   - bpo-26851(17): Set Android compilation and link flags.

   - bpo-28768(18): Fix implicit declaration of function _setmode.
     Patch by Masayuki Yamamoto

   - bpo-29080(19): Removes hard dependency on hg.exe from
     PCBuild/build.bat

   - bpo-23903(20): Added missed names to PC/python3.def.

   - bpo-28762(21): lockf() is available on Android API level 24, but
     the F_LOCK macro is not defined in android-ndk-r13.

   - bpo-28538(22): Fix the compilation error that occurs because
     if_nameindex() is available on Android API level 24, but the
     if_nameindex structure is not defined.

   - bpo-20211(23): Do not add the directory for installing C header
     files and the directory for installing object code libraries to the
     cross compilation search paths.  Original patch by Thomas
     Petazzoni.

   - bpo-28849(24): Do not define sys.implementation._multiarch on
     Android.

   - bpo-10656(25): Fix out-of-tree building on AIX. Patch by Tristan
     Carel and Michael Haubenwallner.

   - bpo-26359(26): Rename -with-optimiations to -enable-optimizations.

   - bpo-28444(27): Fix missing extensions modules when cross compiling.

   - bpo-28208(28): Update Windows build and OS X installers to use
     SQLite 3.14.2.

   - bpo-28248(29): Update Windows build and OS X installers to use
     OpenSSL 1.0.2j.

   - bpo-21124(30): Fix building the _struct module on Cygwin by passing
     ‘NULL’ instead of ‘&PyType_Type’ to PyVarObject_HEAD_INIT. Patch by
     Masayuki Yamamoto.

   - bpo-13756(31): Fix building extensions modules on Cygwin.  Patch by
     Roumen Petrov, based on original patch by Jason Tishler.

   - bpo-21085(32): Add configure check for siginfo_t.si_band, which
     Cygwin does not provide.  Patch by Masayuki Yamamoto with review
     and rebase by Erik Bray.

   - bpo-28258(33): Fixed build with Estonian locale (python-config and
     distclean targets in Makefile).  Patch by Arfrever Frehtes
     Taifersar Arahesis.

   - bpo-26661(34): setup.py now detects system libffi with multiarch
     wrapper.

   - bpo-27979(35): A full copy of libffi is no longer bundled for use
     when building _ctypes on non-OSX UNIX platforms.  An installed copy
     of libffi is now required when building _ctypes on such platforms.

   - bpo-15819(36): Remove redundant include search directory option for
     building outside the source tree.

   - bpo-28676(37): Prevent missing 'getentropy' declaration warning on
     macOS. Patch by Gareth Rees.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31354

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31370

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31341

   (4) https://peps.python.org/pep-0011/

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30854

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30687

   (7) https://bugs.python.org/issue?@action=redirect&bpo=20210

   (8) https://bugs.python.org/issue?@action=redirect&bpo=29941

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28787

   (10) https://bugs.python.org/issue?@action=redirect&bpo=29243

   (11) https://bugs.python.org/issue?@action=redirect&bpo=23404

   (12) https://bugs.python.org/issue?@action=redirect&bpo=29643

   (13) https://bugs.python.org/issue?@action=redirect&bpo=27593

   (14) https://bugs.python.org/issue?@action=redirect&bpo=29572

   (15) https://bugs.python.org/issue?@action=redirect&bpo=27659

   (16) https://bugs.python.org/issue?@action=redirect&bpo=29384

   (17) https://bugs.python.org/issue?@action=redirect&bpo=26851

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28768

   (19) https://bugs.python.org/issue?@action=redirect&bpo=29080

   (20) https://bugs.python.org/issue?@action=redirect&bpo=23903

   (21) https://bugs.python.org/issue?@action=redirect&bpo=28762

   (22) https://bugs.python.org/issue?@action=redirect&bpo=28538

   (23) https://bugs.python.org/issue?@action=redirect&bpo=20211

   (24) https://bugs.python.org/issue?@action=redirect&bpo=28849

   (25) https://bugs.python.org/issue?@action=redirect&bpo=10656

   (26) https://bugs.python.org/issue?@action=redirect&bpo=26359

   (27) https://bugs.python.org/issue?@action=redirect&bpo=28444

   (28) https://bugs.python.org/issue?@action=redirect&bpo=28208

   (29) https://bugs.python.org/issue?@action=redirect&bpo=28248

   (30) https://bugs.python.org/issue?@action=redirect&bpo=21124

   (31) https://bugs.python.org/issue?@action=redirect&bpo=13756

   (32) https://bugs.python.org/issue?@action=redirect&bpo=21085

   (33) https://bugs.python.org/issue?@action=redirect&bpo=28258

   (34) https://bugs.python.org/issue?@action=redirect&bpo=26661

   (35) https://bugs.python.org/issue?@action=redirect&bpo=27979

   (36) https://bugs.python.org/issue?@action=redirect&bpo=15819

   (37) https://bugs.python.org/issue?@action=redirect&bpo=28676


File: python.info,  Node: Windows<63>,  Next: IDLE<45>,  Prev: ビルド<70>,  Up: Python 3 7 0 alpha 1

1.24.73.7 Windows
.................

   - bpo-31392(1): Update Windows build to use OpenSSL 1.1.0f

   - bpo-30389(2): Adds detection of Visual Studio 2017 to distutils on
     Windows.

   - bpo-31358(3): zlib is no longer bundled in the CPython source,
     instead it is downloaded on demand just like bz2, lzma, OpenSSL,
     Tcl/Tk, and SQLite.

   - bpo-31340(4): Change to building with MSVC v141 (included with
     Visual Studio 2017)

   - bpo-30581(5): os.cpu_count() now returns the correct number of
     processors on Windows when the number of logical processors is
     greater than 64.

   - bpo-30916(6): Pre-build OpenSSL, Tcl and Tk and include the
     binaries in the build.

   - bpo-30731(7): Add a missing xmlns to python.manifest so that it
     matches the schema.

   - bpo-30291(8): Allow requiring 64-bit interpreters from py.exe using
     -64 suffix.  Contributed by Steve (Gadget) Barnes.

   - bpo-30362(9): Adds list options (-0, -0p) to py.exe launcher.
     Contributed by Steve Barnes.

   - bpo-23451(10): Fix socket deprecation warnings in socketmodule.c.
     Patch by Segev Finer.

   - bpo-30450(11): The build process on Windows no longer depends on
     Subversion, instead pulling external code from GitHub via a Python
     script.  If Python 3.6 is not found on the system (via ‘py -3.6’),
     NuGet is used to download a copy of 32-bit Python.

   - bpo-29579(12): Removes readme.txt from the installer.

   - bpo-25778(13): winreg does not truncate string correctly (Patch by
     Eryk Sun)

   - bpo-28896(14): Deprecate WindowsRegistryFinder and disable it by
     default

   - bpo-28522(15): Fixes mishandled buffer reallocation in getpathp.c

   - bpo-28402(16): Adds signed catalog files for stdlib on Windows.

   - bpo-28333(17): Enables Unicode for ps1/ps2 and input() prompts.
     (Patch by Eryk Sun)

   - bpo-28251(18): Improvements to help manuals on Windows.

   - bpo-28110(19): launcher.msi has different product codes between
     32-bit and 64-bit

   - bpo-28161(20): Opening CON for write access fails

   - bpo-28162(21): WindowsConsoleIO readall() fails if first line
     starts with Ctrl+Z

   - bpo-28163(22): WindowsConsoleIO fileno() passes wrong flags to
     _open_osfhandle

   - bpo-28164(23): _PyIO_get_console_type fails for various paths

   - bpo-28137(24): Renames Windows path file to ._pth

   - bpo-28138(25): Windows ._pth file should allow import site

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31392

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30389

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31358

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31340

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30581

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30916

   (7) https://bugs.python.org/issue?@action=redirect&bpo=30731

   (8) https://bugs.python.org/issue?@action=redirect&bpo=30291

   (9) https://bugs.python.org/issue?@action=redirect&bpo=30362

   (10) https://bugs.python.org/issue?@action=redirect&bpo=23451

   (11) https://bugs.python.org/issue?@action=redirect&bpo=30450

   (12) https://bugs.python.org/issue?@action=redirect&bpo=29579

   (13) https://bugs.python.org/issue?@action=redirect&bpo=25778

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28896

   (15) https://bugs.python.org/issue?@action=redirect&bpo=28522

   (16) https://bugs.python.org/issue?@action=redirect&bpo=28402

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28333

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28251

   (19) https://bugs.python.org/issue?@action=redirect&bpo=28110

   (20) https://bugs.python.org/issue?@action=redirect&bpo=28161

   (21) https://bugs.python.org/issue?@action=redirect&bpo=28162

   (22) https://bugs.python.org/issue?@action=redirect&bpo=28163

   (23) https://bugs.python.org/issue?@action=redirect&bpo=28164

   (24) https://bugs.python.org/issue?@action=redirect&bpo=28137

   (25) https://bugs.python.org/issue?@action=redirect&bpo=28138


File: python.info,  Node: IDLE<45>,  Next: Tools/Demos<43>,  Prev: Windows<63>,  Up: Python 3 7 0 alpha 1

1.24.73.8 IDLE
..............

   - bpo-31493(1): IDLE code context - fix code update and font update
     timers.  Canceling timers prevents a warning message when test_idle
     completes.

   - bpo-31488(2): IDLE - Update non-key options in former extension
     classes.  When applying configdialog changes, call .reload for each
     feature class.  Change ParenMatch so updated options affect
     existing instances attached to existing editor windows.

   - bpo-31477(3): IDLE - Improve rstrip entry in doc.  Strip trailing
     whitespace strips more than blank spaces.  Multiline string
     literals are not skipped.

   - bpo-31480(4): IDLE - make tests pass with zzdummy extension
     disabled by default.

   - bpo-31421(5): Document how IDLE runs tkinter programs.  IDLE calls
     tcl/tk update in the background in order to make live interaction
     and experimentation with tkinter applications much easier.

   - bpo-31414(6): IDLE - fix tk entry box tests by deleting first.
     Adding to an int entry is not the same as deleting and inserting
     because int('') will fail.

   - bpo-31051(7): Rearrange IDLE configdialog GenPage into Window,
     Editor, and Help sections.

   - bpo-30617(8): IDLE - Add docstrings and tests for outwin subclass
     of editor.  Move some data and functions from the class to module
     level.  Patch by Cheryl Sabella.

   - bpo-31287(9): IDLE - Do not modify tkinter.message in
     test_configdialog.

   - bpo-27099(10): Convert IDLE's built-in 'extensions' to regular
     features.  About 10 IDLE features were implemented as supposedly
     optional extensions.  Their different behavior could be confusing
     or worse for users and not good for maintenance.  Hence the
     conversion.  The main difference for users is that user
     configurable key bindings for builtin features are now handled
     uniformly.  Now, editing a binding in a keyset only affects its
     value in the keyset.  All bindings are defined together in the
     system-specific default keysets in config-extensions.def.  All
     custom keysets are saved as a whole in config-extension.cfg.  All
     take effect as soon as one clicks Apply or Ok.  The affected events
     are '<<force-open-completions>>', '<<expand-word>>',
     '<<force-open-calltip>>', '<<flash-paren>>',
     '<<format-paragraph>>', '<<run-module>>', '<<check-module>>', and
     '<<zoom-height>>'.  Any (global) customizations made before 3.6.3
     will not affect their keyset-specific customization after 3.6.3.
     and vice versa.  Initial patch by Charles Wohlganger.

   - bpo-31206(11): IDLE: Factor HighPage(Frame) class from
     ConfigDialog.  Patch by Cheryl Sabella.

   - bpo-31001(12): Add tests for configdialog highlight tab.  Patch by
     Cheryl Sabella.

   - bpo-31205(13): IDLE: Factor KeysPage(Frame) class from
     ConfigDialog.  The slightly modified tests continue to pass.  Patch
     by Cheryl Sabella.

   - bpo-31130(14): IDLE - stop leaks in test_configdialog.  Initial
     patch by Victor Stinner.

   - bpo-31002(15): Add tests for configdialog keys tab.  Patch by
     Cheryl Sabella.

   - bpo-19903(16): IDLE: Calltips use ‘inspect.signature’ instead of
     ‘inspect.getfullargspec’.  This improves calltips for builtins
     converted to use Argument Clinic.  Patch by Louie Lu.

   - bpo-31083(17): IDLE - Add an outline of a TabPage class in
     configdialog.  Update existing classes to match outline.  Initial
     patch by Cheryl Sabella.

   - bpo-31050(18): Factor GenPage(Frame) class from ConfigDialog.  The
     slightly modified tests continue to pass.  Patch by Cheryl Sabella.

   - bpo-31004(19): IDLE - Factor FontPage(Frame) class from
     ConfigDialog.  Slightly modified tests continue to pass.  Fix
     General tests.  Patch mostly by Cheryl Sabella.

   - bpo-30781(20): IDLE - Use ttk widgets in ConfigDialog.  Patches by
     Terry Jan Reedy and Cheryl Sabella.

   - bpo-31060(21): IDLE - Finish rearranging methods of ConfigDialog
     Grouping methods pertaining to each tab and the buttons will aid
     writing tests and improving the tabs and will enable splitting the
     groups into classes.

   - bpo-30853(22): IDLE - Factor a VarTrace class out of ConfigDialog.
     Instance tracers manages pairs consisting of a tk variable and a
     callback function.  When tracing is turned on, setting the variable
     calls the function.  Test coverage for the new class is 100%.

   - bpo-31003(23): IDLE: Add more tests for General tab.

   - bpo-30993(24): IDLE - Improve configdialog font page and tests.  In
     configdialog: Document causal pathways in create_font_tab
     docstring.  Simplify some attribute names.  Move set_samples calls
     to var_changed_font (idea from Cheryl Sabella).  Move related
     functions to positions after the create widgets function.  In
     test_configdialog: Fix test_font_set so not order dependent.  Fix
     renamed test_indent_scale so it tests the widget.  Adjust tests for
     movement of set_samples call.  Add tests for load functions.  Put
     all font tests in one class and tab indent tests in another.
     Except for two lines, these tests completely cover the related
     functions.

   - bpo-30981(25): IDLE - Add more configdialog font page tests.

   - bpo-28523(26): IDLE: replace 'colour' with 'color' in configdialog.

   - bpo-30917(27): Add tests for idlelib.config.IdleConf.  Increase
     coverage from 46% to 96%.  Patch by Louie Lu.

   - bpo-30934(28): Document coverage details for idlelib tests.  Add
     section to idlelib/idle-test/README.txt.  Include check that
     branches are taken both ways.  Exclude IDLE-specific code that does
     not run during unit tests.

   - bpo-30913(29): IDLE: Document ConfigDialog tk Vars, methods, and
     widgets in docstrings This will facilitate improving the dialog and
     splitting up the class.  Original patch by Cheryl Sabella.

   - bpo-30899(30): IDLE: Add tests for ConfigParser subclasses in
     config.  Patch by Louie Lu.

   - bpo-30881(31): IDLE: Add docstrings to browser.py.  Patch by Cheryl
     Sabella.

   - bpo-30851(32): IDLE: Remove unused variables in configdialog.  One
     is a duplicate, one is set but cannot be altered by users.  Patch
     by Cheryl Sabella.

   - bpo-30870(33): IDLE: In Settings dialog, select font with Up, Down
     keys as well as mouse.  Initial patch by Louie Lu.

   - bpo-8231(34): IDLE: call config.IdleConf.GetUserCfgDir only once.

   - bpo-30779(35): IDLE: Factor ConfigChanges class from configdialog,
     put in config; test.  * In config, put dump test code in a
     function; run it and unittest in 'if __name__ == '__main__'.  * Add
     class config.ConfigChanges based on changes_class_v4.py on bpo
     issue.  * Add class test_config.ChangesTest, partly using
     configdialog_tests_v1.py.  * Revise configdialog to use
     ConfigChanges; see tracker msg297804.  * Revise test_configdialog
     to match configdialog changes.  * Remove configdialog functions
     unused or moved to ConfigChanges.  Cheryl Sabella contributed parts
     of the patch.

   - bpo-30777(36): IDLE: configdialog - Add docstrings and fix
     comments.  Patch by Cheryl Sabella.

   - bpo-30495(37): IDLE: Improve textview with docstrings, PEP8 names,
     and more tests.  Patch by Cheryl Sabella.

   - bpo-30723(38): IDLE: Make several improvements to parenmatch.  Add
     'parens' style to highlight both opener and closer.  Make 'default'
     style, which is not default, a synonym for 'opener'.  Make
     time-delay work the same with all styles.  Add help for config
     dialog extensions tab, including help for parenmatch.  Add new
     tests.  Original patch by Charles Wohlganger.

   - bpo-30674(39): IDLE: add docstrings to grep module.  Patch by
     Cheryl Sabella

   - bpo-21519(40): IDLE's basic custom key entry dialog now detects
     duplicates properly.  Original patch by Saimadhav Heblikar.

   - bpo-29910(41): IDLE no longer deletes a character after commenting
     out a region by a key shortcut.  Add ‘return 'break'’ for this and
     other potential conflicts between IDLE and default key bindings.

   - bpo-30728(42): Review and change idlelib.configdialog names.
     Lowercase method and attribute names.  Replace 'colour' with
     'color', expand overly cryptic names, delete unneeded underscores.
     Replace ‘import *’ with specific imports.  Patches by Cheryl
     Sabella.

   - bpo-6739(43): IDLE: Verify user-entered key sequences by trying to
     bind them with tk.  Add tests for all 3 validation functions.
     Original patch by G Polo.  Tests added by Cheryl Sabella.

   - bpo-15786(44): Fix several problems with IDLE's autocompletion box.
     The following should now work: clicking on selection box items;
     using the scrollbar; selecting an item by hitting Return.  Hangs on
     MacOSX should no longer happen.  Patch by Louie Lu.

   - bpo-25514(45): Add doc subsubsection about IDLE failure to start.
     Popup no-connection message directs users to this section.

   - bpo-30642(46): Fix reference leaks in IDLE tests.  Patches by Louie
     Lu and Terry Jan Reedy.

   - bpo-30495(47): Add docstrings for textview.py and use PEP8 names.
     Patches by Cheryl Sabella and Terry Jan Reedy.

   - bpo-30290(48): Help-about: use pep8 names and add tests.  Increase
     coverage to 100%.  Patches by Louie Lu, Cheryl Sabella, and Terry
     Jan Reedy.

   - bpo-30303(49): Add _utest option to textview; add new tests.
     Increase coverage to 100%.  Patches by Louie Lu and Terry Jan
     Reedy.

   - bpo-29071(50): IDLE colors f-string prefixes (but not invalid ur
     prefixes).

   - bpo-28572(51): Add 10% to coverage of IDLE's test_configdialog.
     Update and augment description of the configuration system.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31493

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31488

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31477

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31480

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31421

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31414

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31051

   (8) https://bugs.python.org/issue?@action=redirect&bpo=30617

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31287

   (10) https://bugs.python.org/issue?@action=redirect&bpo=27099

   (11) https://bugs.python.org/issue?@action=redirect&bpo=31206

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31001

   (13) https://bugs.python.org/issue?@action=redirect&bpo=31205

   (14) https://bugs.python.org/issue?@action=redirect&bpo=31130

   (15) https://bugs.python.org/issue?@action=redirect&bpo=31002

   (16) https://bugs.python.org/issue?@action=redirect&bpo=19903

   (17) https://bugs.python.org/issue?@action=redirect&bpo=31083

   (18) https://bugs.python.org/issue?@action=redirect&bpo=31050

   (19) https://bugs.python.org/issue?@action=redirect&bpo=31004

   (20) https://bugs.python.org/issue?@action=redirect&bpo=30781

   (21) https://bugs.python.org/issue?@action=redirect&bpo=31060

   (22) https://bugs.python.org/issue?@action=redirect&bpo=30853

   (23) https://bugs.python.org/issue?@action=redirect&bpo=31003

   (24) https://bugs.python.org/issue?@action=redirect&bpo=30993

   (25) https://bugs.python.org/issue?@action=redirect&bpo=30981

   (26) https://bugs.python.org/issue?@action=redirect&bpo=28523

   (27) https://bugs.python.org/issue?@action=redirect&bpo=30917

   (28) https://bugs.python.org/issue?@action=redirect&bpo=30934

   (29) https://bugs.python.org/issue?@action=redirect&bpo=30913

   (30) https://bugs.python.org/issue?@action=redirect&bpo=30899

   (31) https://bugs.python.org/issue?@action=redirect&bpo=30881

   (32) https://bugs.python.org/issue?@action=redirect&bpo=30851

   (33) https://bugs.python.org/issue?@action=redirect&bpo=30870

   (34) https://bugs.python.org/issue?@action=redirect&bpo=8231

   (35) https://bugs.python.org/issue?@action=redirect&bpo=30779

   (36) https://bugs.python.org/issue?@action=redirect&bpo=30777

   (37) https://bugs.python.org/issue?@action=redirect&bpo=30495

   (38) https://bugs.python.org/issue?@action=redirect&bpo=30723

   (39) https://bugs.python.org/issue?@action=redirect&bpo=30674

   (40) https://bugs.python.org/issue?@action=redirect&bpo=21519

   (41) https://bugs.python.org/issue?@action=redirect&bpo=29910

   (42) https://bugs.python.org/issue?@action=redirect&bpo=30728

   (43) https://bugs.python.org/issue?@action=redirect&bpo=6739

   (44) https://bugs.python.org/issue?@action=redirect&bpo=15786

   (45) https://bugs.python.org/issue?@action=redirect&bpo=25514

   (46) https://bugs.python.org/issue?@action=redirect&bpo=30642

   (47) https://bugs.python.org/issue?@action=redirect&bpo=30495

   (48) https://bugs.python.org/issue?@action=redirect&bpo=30290

   (49) https://bugs.python.org/issue?@action=redirect&bpo=30303

   (50) https://bugs.python.org/issue?@action=redirect&bpo=29071

   (51) https://bugs.python.org/issue?@action=redirect&bpo=28572


File: python.info,  Node: Tools/Demos<43>,  Next: C API<63>,  Prev: IDLE<45>,  Up: Python 3 7 0 alpha 1

1.24.73.9 Tools/Demos
.....................

   - bpo-30983(1): gdb integration commands (py-bt, etc.)  work on
     optimized shared builds now, too.  PEP 523(2) introduced
     _PyEval_EvalFrameDefault which inlines PyEval_EvalFrameEx on
     non-debug shared builds.  This broke the ability to use py-bt,
     py-up, and a few other Python-specific gdb integrations.  The
     problem is fixed by only looking for _PyEval_EvalFrameDefault
     frames in python-gdb.py.  Original patch by Bruno "Polaco"
     Penteado.

   - bpo-29748(3): Added the slice index converter in Argument Clinic.

   - bpo-24037(4): Argument Clinic now uses the converter
     ‘bool(accept={int})’ rather than ‘int’ for semantical booleans.
     This avoids repeating the default value for Python and C and will
     help in converting to ‘bool’ in future.

   - bpo-29367(5): python-gdb.py now supports also ‘method-wrapper’
     (‘wrapperobject’) objects.

   - bpo-28023(6): Fix python-gdb.py didn't support new dict
     implementation.

   - bpo-15369(7): The pybench and pystone microbenchmark have been
     removed from Tools.  Please use the new Python benchmark suite
     ‘https://github.com/python/pyperformance’ which is more reliable
     and includes a portable version of pybench working on Python 2 and
     Python 3.

   - bpo-28102(8): The zipfile module CLI now prints usage to stderr.
     Patch by Stephen J. Turnbull.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30983

   (2) https://peps.python.org/pep-0523/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29748

   (4) https://bugs.python.org/issue?@action=redirect&bpo=24037

   (5) https://bugs.python.org/issue?@action=redirect&bpo=29367

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28023

   (7) https://bugs.python.org/issue?@action=redirect&bpo=15369

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28102


File: python.info,  Node: C API<63>,  Prev: Tools/Demos<43>,  Up: Python 3 7 0 alpha 1

1.24.73.10 C API
................

   - bpo-31338(1): Added the ‘Py_UNREACHABLE()’ macro for code paths
     which are never expected to be reached.  This and a few other
     useful macros are now documented in the C API manual.

   - bpo-30832(2): Remove own implementation for thread-local storage.
     CPython has provided the own implementation for thread-local
     storage (TLS) on Python/thread.c, it's used in the case which a
     platform has not supplied native TLS. However, currently all
     supported platforms (Windows and pthreads) have provided native TLS
     and defined the Py_HAVE_NATIVE_TLS macro with unconditional in any
     case.

   - bpo-30708(3): PyUnicode_AsWideCharString() now raises a ValueError
     if the second argument is NULL and the wchar_t* string contains
     null characters.

   - bpo-16500(4): Deprecate PyOS_AfterFork() and add PyOS_BeforeFork(),
     PyOS_AfterFork_Parent() and PyOS_AfterFork_Child().

   - bpo-6532(5): The type of results of PyThread_start_new_thread() and
     PyThread_get_thread_ident(), and the id parameter of
     PyThreadState_SetAsyncExc() changed from "long" to "unsigned long".

   - bpo-27867(6): Function PySlice_GetIndicesEx() is deprecated and
     replaced with a macro if Py_LIMITED_API is not set or set to the
     value between 0x03050400 and 0x03060000 (not including) or
     0x03060100 or higher.  Added functions PySlice_Unpack() and
     PySlice_AdjustIndices().

   - bpo-29083(7): Fixed the declaration of some public API functions.
     PyArg_VaParse() and PyArg_VaParseTupleAndKeywords() were not
     available in limited API. PyArg_ValidateKeywordArguments(),
     PyArg_UnpackTuple() and Py_BuildValue() were not available in
     limited API of version < 3.3 when PY_SSIZE_T_CLEAN is defined.

   - bpo-28769(8): The result of PyUnicode_AsUTF8AndSize() and
     PyUnicode_AsUTF8() is now of type ‘const char *’ rather of ‘char
     *’.

   - bpo-29058(9): All stable API extensions added after Python 3.2 are
     now available only when Py_LIMITED_API is set to the PY_VERSION_HEX
     value of the minimum Python version supporting this API.

   - bpo-28822(10): The index parameters 'start' and 'end' of
     PyUnicode_FindChar() are now adjusted to behave like
     ‘str[start:end]’.

   - bpo-28808(11): PyUnicode_CompareWithASCIIString() now never raises
     exceptions.

   - bpo-28761(12): The fields name and doc of structures PyMemberDef,
     PyGetSetDef, PyStructSequence_Field, PyStructSequence_Desc, and
     wrapperbase are now of type ‘const char *’ rather of ‘char *’.

   - bpo-28748(13): Private variable _Py_PackageContext is now of type
     ‘const char *’ rather of ‘char *’.

   - bpo-19569(14): Compiler warnings are now emitted if use most of
     deprecated functions.

   - bpo-28426(15): Deprecated undocumented functions
     PyUnicode_AsEncodedObject(), PyUnicode_AsDecodedObject(),
     PyUnicode_AsDecodedUnicode() and PyUnicode_AsEncodedUnicode().

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31338

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30832

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30708

   (4) https://bugs.python.org/issue?@action=redirect&bpo=16500

   (5) https://bugs.python.org/issue?@action=redirect&bpo=6532

   (6) https://bugs.python.org/issue?@action=redirect&bpo=27867

   (7) https://bugs.python.org/issue?@action=redirect&bpo=29083

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28769

   (9) https://bugs.python.org/issue?@action=redirect&bpo=29058

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28822

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28808

   (12) https://bugs.python.org/issue?@action=redirect&bpo=28761

   (13) https://bugs.python.org/issue?@action=redirect&bpo=28748

   (14) https://bugs.python.org/issue?@action=redirect&bpo=19569

   (15) https://bugs.python.org/issue?@action=redirect&bpo=28426


File: python.info,  Node: Python 3 6 6 final,  Next: Python 3 6 6 release candidate 1,  Prev: Python 3 7 0 alpha 1,  Up: 変更履歴

1.24.74 Python 3.6.6 final
--------------------------

'Release date: 2018-06-27'

There were no new changes in version 3.6.6.


File: python.info,  Node: Python 3 6 6 release candidate 1,  Next: Python 3 6 5 final,  Prev: Python 3 6 6 final,  Up: 変更履歴

1.24.75 Python 3.6.6 release candidate 1
----------------------------------------

'Release date: 2018-06-11'

* Menu:

* Core and Builtins: Core and Builtins<170>.
* ライブラリ: ライブラリ<174>.
* ドキュメント: ドキュメント<67>.
* テスト: テスト<63>.
* ビルド: ビルド<71>.
* Windows: Windows<64>.
* macOS: macOS<49>.
* IDLE: IDLE<46>.
* Tools/Demos: Tools/Demos<44>.
* C API: C API<64>.


File: python.info,  Node: Core and Builtins<170>,  Next: ライブラリ<174>,  Up: Python 3 6 6 release candidate 1

1.24.75.1 Core and Builtins
...........................

   - bpo-33786(1): Fix asynchronous generators to handle GeneratorExit
     in athrow() correctly

   - bpo-30654(2): Fixed reset of the SIGINT handler to SIG_DFL on
     interpreter shutdown even when there was a custom handler set
     previously.  Patch by Philipp Kerling.

   - bpo-33622(3): Fixed a leak when the garbage collector fails to add
     an object with the ‘__del__’ method or referenced by it into the
     *note gc.garbage: 13d9. list.  *note PyGC_Collect(): b85. can now
     be called when an exception is set and preserves it.

   - bpo-31849(4): Fix signed/unsigned comparison warning in pyhash.c.

   - bpo-33391(5): Fix a leak in set_symmetric_difference().

   - bpo-28055(6): Fix unaligned accesses in siphash24().  Patch by Rolf
     Eike Beer.

   - bpo-33231(7): Fix potential memory leak in ‘normalizestring()’.

   - bpo-29922(8): Improved error messages in 'async with' when
     ‘__aenter__()’ or ‘__aexit__()’ return non-awaitable object.

   - bpo-33199(9): Fix ‘ma_version_tag’ in dict implementation is
     uninitialized when copying from key-sharing dict.

   - bpo-33041(10): Fixed jumping when the function contains an ‘async
     for’ loop.

   - bpo-32282(11): Fix an unnecessary ifdef in the include of
     VersionHelpers.h in socketmodule on Windows.

   - bpo-21983(12): Fix a crash in ‘ctypes.cast()’ in case the type
     argument is a ctypes structured data type.  Patch by Eryk Sun and
     Oren Milman.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33786

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30654

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33622

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31849

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33391

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28055

   (7) https://bugs.python.org/issue?@action=redirect&bpo=33231

   (8) https://bugs.python.org/issue?@action=redirect&bpo=29922

   (9) https://bugs.python.org/issue?@action=redirect&bpo=33199

   (10) https://bugs.python.org/issue?@action=redirect&bpo=33041

   (11) https://bugs.python.org/issue?@action=redirect&bpo=32282

   (12) https://bugs.python.org/issue?@action=redirect&bpo=21983


File: python.info,  Node: ライブラリ<174>,  Next: ドキュメント<67>,  Prev: Core and Builtins<170>,  Up: Python 3 6 6 release candidate 1

1.24.75.2 ライブラリ
....................

   - bpo-30167(1): Prevent site.main() exception if PYTHONSTARTUP is
     set.  Patch by Steve Weber.

   - bpo-33812(2): Datetime instance d with non-None tzinfo, but with
     d.tzinfo.utcoffset(d) returning None is now treated as naive by the
     astimezone() method.

   - bpo-30805(3): Avoid race condition with debug logging

   - bpo-33767(4): The concatenation (‘+’) and repetition (‘*’) sequence
     operations now raise *note TypeError: 198. instead of *note
     SystemError: 795. when performed on *note mmap.mmap: 519. objects.
     Patch by Zackery Spytz.

   - bpo-32684(5): Fix gather to propagate cancellation of itself even
     with return_exceptions.

   - bpo-33674(6): Fix a race condition in SSLProtocol.connection_made()
     of asyncio.sslproto: start immediately the handshake instead of
     using call_soon().  Previously, data_received() could be called
     before the handshake started, causing the handshake to hang or
     fail.

   - bpo-31647(7): Fixed bug where calling write_eof() on a
     _SelectorSocketTransport after it's already closed raises
     AttributeError.

   - bpo-33672(8): Fix Task.__repr__ crash with Cython's bogus
     coroutines

   - bpo-33469(9): Fix RuntimeError after closing loop that used
     run_in_executor

   - bpo-11874(10): Use a better regex when breaking usage into
     wrappable parts.  Avoids bogus assertion errors from custom metavar
     strings.

   - bpo-30877(11): Fixed a bug in the Python implementation of the JSON
     decoder that prevented the cache of parsed strings from clearing
     after finishing the decoding.  Based on patch by c-fos.

   - bpo-33548(12): tempfile._candidate_tempdir_list should consider
     common TEMP locations

   - bpo-33542(13): Prevent ‘uuid.get_node’ from using a DUID instead of
     a MAC on Windows.  Patch by Zvi Effron

   - bpo-26819(14): Fix race condition with
     ‘ReadTransport.resume_reading’ in Windows proactor event loop.

   - bpo-28556(15): Minor fixes in typing module: add annotations to
     ‘NamedTuple.__new__’, pass ‘*args’ and ‘**kwds’ in
     ‘Generic.__new__’.  Original PRs by Paulius Šarka and Chad
     Dombrova.

   - bpo-20087(16): Updated alias mapping with glibc 2.27 supported
     locales.

   - bpo-33422(17): Fix trailing quotation marks getting deleted when
     looking up byte/string literals on pydoc.  Patch by Andrés Delfino.

   - bpo-33197(18): Update error message when constructing invalid
     inspect.Parameters Patch by Donghee Na.

   - bpo-33383(19): Fixed crash in the get() method of the *note
     dbm.ndbm: 38. database object when it is called with a single
     argument.

   - bpo-33329(20): Fix multiprocessing regression on newer glibcs

   - bpo-991266(21): Fix quoting of the ‘Comment’ attribute of *note
     http.cookies.SimpleCookie: 1e24.

   - bpo-33131(22): Upgrade bundled version of pip to 10.0.1.

   - bpo-33308(23): Fixed a crash in the ‘parser’ module when converting
     an ST object to a tree of tuples or lists with ‘line_info=False’
     and ‘col_info=True’.

   - bpo-33263(24): Fix FD leak in ‘_SelectorSocketTransport’ Patch by
     Vlad Starostin.

   - bpo-33256(25): Fix display of ‘<module>’ call in the html produced
     by ‘cgitb.html()’.  Patch by Stéphane Blondon.

   - bpo-33203(26): ‘random.Random.choice()’ now raises ‘IndexError’ for
     empty sequences consistently even when called from subclasses
     without a ‘getrandbits()’ implementation.

   - bpo-33224(27): Update difflib.mdiff() for PEP 479(28).  Convert an
     uncaught StopIteration in a generator into a return-statement.

   - bpo-33209(29): End framing at the end of C implementation of *note
     pickle.Pickler.dump(): 1e25.

   - bpo-32861(30): The urllib.robotparser's ‘__str__’ representation
     now includes wildcard entries and the "Crawl-delay" and
     "Request-rate" fields.  Patch by Michael Lazar.

   - bpo-33096(31): Allow ttk.Treeview.insert to insert iid that has a
     false boolean value.  Note iid=0 and iid=False would be same.
     Patch by Garvit Khatri.

   - bpo-33127(32): The ssl module now compiles with LibreSSL 2.7.1.

   - bpo-33021(33): Release the GIL during fstat() calls, avoiding hang
     of all threads when calling mmap.mmap(), os.urandom(), and
     random.seed().  Patch by Nir Soffer.

   - bpo-27683(34): Fix a regression in *note ipaddress: 84. that result
     of ‘hosts()’ is empty when the network is constructed by a tuple
     containing an integer mask and only 1 bit left for addresses.

   - bpo-32844(35): Fix wrong redirection of a low descriptor (0 or 1)
     to stderr in subprocess if another low descriptor is closed.

   - bpo-31908(36): Fix output of cover files for ‘trace’ module
     command-line tool.  Previously emitted cover files only when
     ‘--missing’ option was used.  Patch by Michael Selik.

   - bpo-31457(37): If nested log adapters are used, the inner
     ‘process()’ methods are no longer omitted.

   - bpo-16865(38): Support arrays >=2GiB in *note ctypes: 2e.  Patch by
     Segev Finer.

   - bpo-31238(39): pydoc: the stop() method of the private ServerThread
     class now waits until DocServer.serve_until_quit() completes and
     then explicitly sets its docserver attribute to None to break a
     reference cycle.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30167

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33812

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30805

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33767

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32684

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33674

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31647

   (8) https://bugs.python.org/issue?@action=redirect&bpo=33672

   (9) https://bugs.python.org/issue?@action=redirect&bpo=33469

   (10) https://bugs.python.org/issue?@action=redirect&bpo=11874

   (11) https://bugs.python.org/issue?@action=redirect&bpo=30877

   (12) https://bugs.python.org/issue?@action=redirect&bpo=33548

   (13) https://bugs.python.org/issue?@action=redirect&bpo=33542

   (14) https://bugs.python.org/issue?@action=redirect&bpo=26819

   (15) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (16) https://bugs.python.org/issue?@action=redirect&bpo=20087

   (17) https://bugs.python.org/issue?@action=redirect&bpo=33422

   (18) https://bugs.python.org/issue?@action=redirect&bpo=33197

   (19) https://bugs.python.org/issue?@action=redirect&bpo=33383

   (20) https://bugs.python.org/issue?@action=redirect&bpo=33329

   (21) https://bugs.python.org/issue?@action=redirect&bpo=991266

   (22) https://bugs.python.org/issue?@action=redirect&bpo=33131

   (23) https://bugs.python.org/issue?@action=redirect&bpo=33308

   (24) https://bugs.python.org/issue?@action=redirect&bpo=33263

   (25) https://bugs.python.org/issue?@action=redirect&bpo=33256

   (26) https://bugs.python.org/issue?@action=redirect&bpo=33203

   (27) https://bugs.python.org/issue?@action=redirect&bpo=33224

   (28) https://peps.python.org/pep-0479/

   (29) https://bugs.python.org/issue?@action=redirect&bpo=33209

   (30) https://bugs.python.org/issue?@action=redirect&bpo=32861

   (31) https://bugs.python.org/issue?@action=redirect&bpo=33096

   (32) https://bugs.python.org/issue?@action=redirect&bpo=33127

   (33) https://bugs.python.org/issue?@action=redirect&bpo=33021

   (34) https://bugs.python.org/issue?@action=redirect&bpo=27683

   (35) https://bugs.python.org/issue?@action=redirect&bpo=32844

   (36) https://bugs.python.org/issue?@action=redirect&bpo=31908

   (37) https://bugs.python.org/issue?@action=redirect&bpo=31457

   (38) https://bugs.python.org/issue?@action=redirect&bpo=16865

   (39) https://bugs.python.org/issue?@action=redirect&bpo=31238


File: python.info,  Node: ドキュメント<67>,  Next: テスト<63>,  Prev: ライブラリ<174>,  Up: Python 3 6 6 release candidate 1

1.24.75.3 ドキュメント
......................

   - bpo-33503(1): Fix broken pypi link

   - bpo-33421(2): Add missing documentation for
     ‘typing.AsyncContextManager’.

   - bpo-33378(3): Add Korean language switcher for
     ‘https://docs.python.org/3/’

   - bpo-33276(4): Clarify that the ‘__path__’ attribute on modules
     cannot be just any value.

   - bpo-33201(5): Modernize documentation for writing C extension
     types.

   - bpo-33195(6): Deprecate ‘Py_UNICODE’ usage in ‘c-api/arg’ document.
     ‘Py_UNICODE’ related APIs are deprecated since Python 3.3, but it
     is missed in the document.

   - bpo-33126(7): Document PyBuffer_ToContiguous().

   - bpo-27212(8): Modify documentation for the ‘islice()’ recipe to
     consume initial values up to the start index.

   - bpo-28247(9): Update *note zipapp: 136. documentation to describe
     how to make standalone applications.

   - bpo-18802(10): Documentation changes for ipaddress.  Patch by Jon
     Foster and Berker Peksag.

   - bpo-27428(11): Update documentation to clarify that
     ‘WindowsRegistryFinder’ implements ‘MetaPathFinder’.  (Patch by
     Himanshu Lakhara)

   - bpo-8243(12): Add a note about curses.addch and curses.addstr
     exception behavior when writing outside a window, or pad.

   - bpo-31432(13): Clarify meaning of CERT_NONE, CERT_OPTIONAL, and
     CERT_REQUIRED flags for ssl.SSLContext.verify_mode.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33503

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33421

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33378

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33276

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33201

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33195

   (7) https://bugs.python.org/issue?@action=redirect&bpo=33126

   (8) https://bugs.python.org/issue?@action=redirect&bpo=27212

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28247

   (10) https://bugs.python.org/issue?@action=redirect&bpo=18802

   (11) https://bugs.python.org/issue?@action=redirect&bpo=27428

   (12) https://bugs.python.org/issue?@action=redirect&bpo=8243

   (13) https://bugs.python.org/issue?@action=redirect&bpo=31432


File: python.info,  Node: テスト<63>,  Next: ビルド<71>,  Prev: ドキュメント<67>,  Up: Python 3 6 6 release candidate 1

1.24.75.4 テスト
................

   - bpo-33655(1): Ignore test_posix_fallocate failures on BSD platforms
     that might be due to running on ZFS.

   - bpo-19417(2): Add test_bdb.py.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33655

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19417


File: python.info,  Node: ビルド<71>,  Next: Windows<64>,  Prev: テスト<63>,  Up: Python 3 6 6 release candidate 1

1.24.75.5 ビルド
................

   - bpo-5755(1): Move ‘-Wstrict-prototypes’ option to ‘CFLAGS_NODIST’
     from ‘OPT’.  This option emitted annoying warnings when building
     extension modules written in C++.

   - bpo-33614(2): Ensures module definition files for the stable ABI on
     Windows are correctly regenerated.

   - bpo-33522(3): Enable CI builds on Visual Studio Team Services at
     ‘https://python.visualstudio.com/cpython’

   - bpo-33012(4): Add ‘-Wno-cast-function-type’ for gcc 8 for silencing
     warnings about function casts like casting to PyCFunction in method
     definition lists.

   - bpo-33394(5): Enable the verbose build for extension modules, when
     GNU make is passed macros on the command line.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5755

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33614

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33522

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33012

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33394


File: python.info,  Node: Windows<64>,  Next: macOS<49>,  Prev: ビルド<71>,  Up: Python 3 6 6 release candidate 1

1.24.75.6 Windows
.................

   - bpo-33184(1): Update Windows installer to OpenSSL 1.0.2o.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33184


File: python.info,  Node: macOS<49>,  Next: IDLE<46>,  Prev: Windows<64>,  Up: Python 3 6 6 release candidate 1

1.24.75.7 macOS
...............

   - bpo-33184(1): Update macOS installer build to use OpenSSL 1.0.2o.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33184


File: python.info,  Node: IDLE<46>,  Next: Tools/Demos<44>,  Prev: macOS<49>,  Up: Python 3 6 6 release candidate 1

1.24.75.8 IDLE
..............

   - bpo-33656(1): On Windows, add API call saying that tk scales for
     DPI. On Windows 8.1+ or 10, with DPI compatibility properties of
     the Python binary unchanged, and a monitor resolution greater than
     96 DPI, this should make text and lines sharper.  It should
     otherwise have no effect.

   - bpo-33768(2): Clicking on a context line moves that line to the top
     of the editor window.

   - bpo-33763(3): IDLE: Use read-only text widget for code context
     instead of label widget.

   - bpo-33664(4): Scroll IDLE editor text by lines.  Previously, the
     mouse wheel and scrollbar slider moved text by a fixed number of
     pixels, resulting in partial lines at the top of the editor box.
     The change also applies to the shell and grep output windows, but
     not to read-only text views.

   - bpo-33679(5): Enable theme-specific color configuration for Code
     Context.  Use the Highlights tab to see the setting for built-in
     themes or add settings to custom themes.

   - bpo-33642(6): Display up to maxlines non-blank lines for Code
     Context.  If there is no current context, show a single blank line.

   - bpo-33628(7): IDLE: Cleanup codecontext.py and its test.

   - bpo-33564(8): IDLE's code context now recognizes async as a block
     opener.

   - bpo-29706(9): IDLE now colors async and await as keywords in 3.6.
     They become full keywords in 3.7.

   - bpo-21474(10): Update word/identifier definition from ascii to
     unicode.  In text and entry boxes, this affects selection by
     double-click, movement left/right by control-left/right, and
     deletion left/right by control-BACKSPACE/DEL.

   - bpo-33204(11): IDLE: consistently color invalid string prefixes.  A
     'u' string prefix cannot be paired with either 'r' or 'f'.
     Consistently color as much of the prefix, starting at the right, as
     is valid.  Revise and extend colorizer test.

   - bpo-32831(12): Add docstrings and tests for codecontext.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33656

   (2) https://bugs.python.org/issue?@action=redirect&bpo=33768

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33763

   (4) https://bugs.python.org/issue?@action=redirect&bpo=33664

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33679

   (6) https://bugs.python.org/issue?@action=redirect&bpo=33642

   (7) https://bugs.python.org/issue?@action=redirect&bpo=33628

   (8) https://bugs.python.org/issue?@action=redirect&bpo=33564

   (9) https://bugs.python.org/issue?@action=redirect&bpo=29706

   (10) https://bugs.python.org/issue?@action=redirect&bpo=21474

   (11) https://bugs.python.org/issue?@action=redirect&bpo=33204

   (12) https://bugs.python.org/issue?@action=redirect&bpo=32831


File: python.info,  Node: Tools/Demos<44>,  Next: C API<64>,  Prev: IDLE<46>,  Up: Python 3 6 6 release candidate 1

1.24.75.9 Tools/Demos
.....................

   - bpo-33189(1): ‘pygettext.py’ now recognizes only literal strings as
     docstrings and translatable strings, and rejects bytes literals and
     f-string expressions.

   - bpo-31920(2): Fixed handling directories as arguments in the
     ‘pygettext’ script.  Based on patch by Oleg Krasnikov.

   - bpo-29673(3): Fix pystackv and pystack gdbinit macros.

   - bpo-32885(4): Add an ‘-n’ flag for ‘Tools/scripts/pathfix.py’ to
     disable automatic backup creation (files with ‘~’ suffix).

   - bpo-31583(5): Fix 2to3 for using with -add-suffix option but
     without -output-dir option for relative path to files in current
     directory.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33189

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31920

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29673

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32885

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31583


File: python.info,  Node: C API<64>,  Prev: Tools/Demos<44>,  Up: Python 3 6 6 release candidate 1

1.24.75.10 C API
................

   - bpo-32374(1): Document that m_traverse for multi-phase initialized
     modules can be called with m_state=NULL, and add a sanity check

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32374


File: python.info,  Node: Python 3 6 5 final,  Next: Python 3 6 5 release candidate 1,  Prev: Python 3 6 6 release candidate 1,  Up: 変更履歴

1.24.76 Python 3.6.5 final
--------------------------

'Release date: 2018-03-28'

* Menu:

* テスト: テスト<64>.
* ビルド: ビルド<72>.


File: python.info,  Node: テスト<64>,  Next: ビルド<72>,  Up: Python 3 6 5 final

1.24.76.1 テスト
................

   - bpo-32872(1): Avoid regrtest compatibility issue with namespace
     packages.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32872


File: python.info,  Node: ビルド<72>,  Prev: テスト<64>,  Up: Python 3 6 5 final

1.24.76.2 ビルド
................

   - bpo-33163(1): Upgrade pip to 9.0.3 and setuptools to v39.0.1.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33163


File: python.info,  Node: Python 3 6 5 release candidate 1,  Next: Python 3 6 4 final,  Prev: Python 3 6 5 final,  Up: 変更履歴

1.24.77 Python 3.6.5 release candidate 1
----------------------------------------

'Release date: 2018-03-13'

* Menu:

* セキュリティ: セキュリティ<50>.
* Core and Builtins: Core and Builtins<171>.
* ライブラリ: ライブラリ<175>.
* ドキュメント: ドキュメント<68>.
* テスト: テスト<65>.
* ビルド: ビルド<73>.
* Windows: Windows<65>.
* macOS: macOS<50>.
* IDLE: IDLE<47>.
* Tools/Demos: Tools/Demos<45>.
* C API: C API<65>.


File: python.info,  Node: セキュリティ<50>,  Next: Core and Builtins<171>,  Up: Python 3 6 5 release candidate 1

1.24.77.1 セキュリティ
......................

   - bpo-33001(1): Minimal fix to prevent buffer overrun in os.symlink
     on Windows

   - bpo-32981(2): Regexes in difflib and poplib were vulnerable to
     catastrophic backtracking.  These regexes formed potential DOS
     vectors (REDOS). They have been refactored.  This resolves CVE
     2018-1060(3) and CVE 2018-1061(4).  Patch by Jamie Davis.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33001

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32981

   (3) https://www.cve.org/CVERecord?id=CVE-2018-1060

   (4) https://www.cve.org/CVERecord?id=CVE-2018-1061


File: python.info,  Node: Core and Builtins<171>,  Next: ライブラリ<175>,  Prev: セキュリティ<50>,  Up: Python 3 6 5 release candidate 1

1.24.77.2 Core and Builtins
...........................

   - bpo-33026(1): Fixed jumping out of "with" block by setting
     f_lineno.

   - bpo-17288(2): Prevent jumps from 'return' and 'exception' trace
     events.

   - bpo-32889(3): Update Valgrind suppression list to account for the
     rename of ‘Py_ADDRESS_IN_RANG’ to ‘address_in_range’.

   - bpo-32650(4): Pdb and other debuggers dependent on bdb.py will
     correctly step over (next command) native coroutines.  Patch by
     Pablo Galindo.

   - bpo-32685(5): Improve suggestion when the Python 2 form of print
     statement is either present on the same line as the header of a
     compound statement or else terminated by a semi-colon instead of a
     newline.  Patch by Nitish Chandra.

   - bpo-32583(6): Fix possible crashing in builtin Unicode decoders
     caused by write out-of-bound errors when using customized decode
     error handlers.

   - bpo-26163(7): Improved frozenset() hash to create more distinct
     hash values when faced with datasets containing many similar
     values.

   - bpo-27169(8): The ‘__debug__’ constant is now optimized out at
     compile time.  This fixes also bpo-22091(9).

   - bpo-32329(10): ‘sys.flags.hash_randomization’ is now properly set
     to 0 when hash randomization is turned off by ‘PYTHONHASHSEED=0’.

   - bpo-30416(11): The optimizer is now protected from spending much
     time doing complex calculations and consuming much memory for
     creating large constants in constant folding.

   - bpo-18533(12): ‘repr()’ on a dict containing its own ‘values()’ or
     ‘items()’ no longer raises ‘RecursionError’; OrderedDict similarly.
     Instead, use ‘...’, as for other recursive structures.  Patch by
     Ben North.

   - bpo-32028(13): Leading whitespace is now correctly ignored when
     generating suggestions for converting Py2 print statements to Py3
     builtin print function calls.  Patch by Sanyam Khurana.

   - bpo-32137(14): The repr of deeply nested dict now raises a
     RecursionError instead of crashing due to a stack overflow.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33026

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17288

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32889

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32650

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32685

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32583

   (7) https://bugs.python.org/issue?@action=redirect&bpo=26163

   (8) https://bugs.python.org/issue?@action=redirect&bpo=27169

   (9) https://bugs.python.org/issue?@action=redirect&bpo=22091

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32329

   (11) https://bugs.python.org/issue?@action=redirect&bpo=30416

   (12) https://bugs.python.org/issue?@action=redirect&bpo=18533

   (13) https://bugs.python.org/issue?@action=redirect&bpo=32028

   (14) https://bugs.python.org/issue?@action=redirect&bpo=32137


File: python.info,  Node: ライブラリ<175>,  Next: ドキュメント<68>,  Prev: Core and Builtins<171>,  Up: Python 3 6 5 release candidate 1

1.24.77.3 ライブラリ
....................

   - bpo-33064(1): lib2to3 now properly supports trailing commas after
     ‘*args’ and ‘**kwargs’ in function signatures.

   - bpo-31804(2): Avoid failing in multiprocessing.Process if the
     standard streams are closed or None at exit.

   - bpo-33037(3): Skip sending/receiving data after SSL transport
     closing.

   - bpo-30353(4): Fix ctypes pass-by-value for structs on 64-bit
     Cygwin/MinGW.

   - bpo-33009(5): Fix inspect.signature() for single-parameter
     partialmethods.

   - bpo-32969(6): Expose several missing constants in zlib and fix
     corresponding documentation.

   - bpo-32713(7): Fixed tarfile.itn handling of out-of-bounds float
     values.  Patch by Joffrey Fuhrer.

   - bpo-30622(8): The ssl module now detects missing NPN support in
     LibreSSL.

   - bpo-32922(9): dbm.open() now encodes filename with the filesystem
     encoding rather than default encoding.

   - bpo-32859(10): In ‘os.dup2’, don't check every call whether the
     ‘dup3’ syscall exists or not.

   - bpo-21060(11): Rewrite confusing message from setup.py upload from
     "No dist file created in earlier command" to the more helpful "Must
     create and upload files in one command".

   - bpo-32857(12): In *note tkinter: f6, ‘after_cancel(None)’ now
     raises a *note ValueError: 2ec. instead of canceling the first
     scheduled function.  Patch by Cheryl Sabella.

   - bpo-32852(13): Make sure sys.argv remains as a list when running
     trace.

   - bpo-32841(14): Fixed ‘asyncio.Condition’ issue which silently
     ignored cancellation after notifying and cancelling a conditional
     lock.  Patch by Bar Harel.

   - bpo-31787(15): Fixed refleaks of ‘__init__()’ methods in various
     modules.  (Contributed by Oren Milman)

   - bpo-30157(16): Fixed guessing quote and delimiter in
     csv.Sniffer.sniff() when only the last field is quoted.  Patch by
     Jake Davis.

   - bpo-32394(17): socket: Remove TCP_FASTOPEN, TCP_KEEPCNT flags on
     older version Windows during run-time.

   - bpo-32777(18): Fix a rare but potential pre-exec child process
     deadlock in subprocess on POSIX systems when marking file
     descriptors inheritable on exec in the child process.  This bug
     appears to have been introduced in 3.4.

   - bpo-32647(19): The ctypes module used to depend on indirect linking
     for dlopen.  The shared extension is now explicitly linked against
     libdl on platforms with dl.

   - bpo-32734(20): Fixed ‘asyncio.Lock()’ safety issue which allowed
     acquiring and locking the same lock multiple times, without it
     being free.  Patch by Bar Harel.

   - bpo-32727(21): Do not include name field in SMTP envelope from
     address.  Patch by Stéphane Wirtel

   - bpo-27931(22): Fix email address header parsing error when the
     username is an empty quoted string.  Patch by Xiang Zhang.

   - bpo-32304(23): distutils' upload command no longer corrupts tar
     files ending with a CR byte, and no longer tries to convert CR to
     CRLF in any of the upload text fields.

   - bpo-32502(24): uuid.uuid1 no longer raises an exception if a 64-bit
     hardware address is encountered.

   - bpo-31848(25): Fix the error handling in Aifc_read.initfp() when
     the SSND chunk is not found.  Patch by Zackery Spytz.

   - bpo-32555(26): On FreeBSD and Solaris, os.strerror() now always
     decode the byte string from the current locale encoding, rather
     than using ASCII/surrogateescape in some cases.

   - bpo-32521(27): The nis module is now compatible with new libnsl and
     headers location.

   - bpo-32473(28): Improve ABCMeta._dump_registry() output readability

   - bpo-32521(29): glibc has removed Sun RPC. Use replacement libtirpc
     headers and library in nis module.

   - bpo-32228(30): Ensure that ‘truncate()’ preserves the file position
     (as reported by ‘tell()’) after writes longer than the buffer size.

   - bpo-26133(31): Don't unsubscribe signals in asyncio UNIX event loop
     on interpreter shutdown.

   - bpo-32185(32): The SSL module no longer sends IP addresses in SNI
     TLS extension on platforms with OpenSSL 1.0.2+ or inet_pton.

   - bpo-32323(33): *note urllib.parse.urlsplit(): f3a. does not convert
     zone-id (scope) to lower case for scoped IPv6 addresses in
     hostnames now.

   - bpo-32302(34): Fix bdist_wininst of distutils for CRT v142: it
     binary compatible with CRT v140.

   - bpo-32255(35): A single empty field is now always quoted when
     written into a CSV file.  This allows to distinguish an empty row
     from a row consisting of a single empty field.  Patch by Licht
     Takeuchi.

   - bpo-32277(36): Raise ‘NotImplementedError’ instead of ‘SystemError’
     on platforms where ‘chmod(..., follow_symlinks=False)’ is not
     supported.  Patch by Anthony Sottile.

   - bpo-32199(37): The getnode() ip getter now uses 'ip link' instead
     of 'ip link list'.

   - bpo-27456(38): Ensure TCP_NODELAY is set on Linux.  Tests by Victor
     Stinner.

   - bpo-31900(39): The *note locale.localeconv(): df8. function now
     sets temporarily the ‘LC_CTYPE’ locale to the ‘LC_NUMERIC’ locale
     to decode ‘decimal_point’ and ‘thousands_sep’ byte strings if they
     are non-ASCII or longer than 1 byte, and the ‘LC_NUMERIC’ locale is
     different than the ‘LC_CTYPE’ locale.  This temporary change
     affects other threads.  Same change for the *note str.format():
     833. method when formatting a number (*note int: 19b, *note float:
     196, *note float: 196. and subclasses) with the ‘n’ type (ex:
     ‘'{:n}'.format(1234)’).

   - bpo-31802(40): Importing native path module (‘posixpath’, ‘ntpath’)
     now works even if the ‘os’ module still is not imported.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33064

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31804

   (3) https://bugs.python.org/issue?@action=redirect&bpo=33037

   (4) https://bugs.python.org/issue?@action=redirect&bpo=30353

   (5) https://bugs.python.org/issue?@action=redirect&bpo=33009

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32969

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32713

   (8) https://bugs.python.org/issue?@action=redirect&bpo=30622

   (9) https://bugs.python.org/issue?@action=redirect&bpo=32922

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32859

   (11) https://bugs.python.org/issue?@action=redirect&bpo=21060

   (12) https://bugs.python.org/issue?@action=redirect&bpo=32857

   (13) https://bugs.python.org/issue?@action=redirect&bpo=32852

   (14) https://bugs.python.org/issue?@action=redirect&bpo=32841

   (15) https://bugs.python.org/issue?@action=redirect&bpo=31787

   (16) https://bugs.python.org/issue?@action=redirect&bpo=30157

   (17) https://bugs.python.org/issue?@action=redirect&bpo=32394

   (18) https://bugs.python.org/issue?@action=redirect&bpo=32777

   (19) https://bugs.python.org/issue?@action=redirect&bpo=32647

   (20) https://bugs.python.org/issue?@action=redirect&bpo=32734

   (21) https://bugs.python.org/issue?@action=redirect&bpo=32727

   (22) https://bugs.python.org/issue?@action=redirect&bpo=27931

   (23) https://bugs.python.org/issue?@action=redirect&bpo=32304

   (24) https://bugs.python.org/issue?@action=redirect&bpo=32502

   (25) https://bugs.python.org/issue?@action=redirect&bpo=31848

   (26) https://bugs.python.org/issue?@action=redirect&bpo=32555

   (27) https://bugs.python.org/issue?@action=redirect&bpo=32521

   (28) https://bugs.python.org/issue?@action=redirect&bpo=32473

   (29) https://bugs.python.org/issue?@action=redirect&bpo=32521

   (30) https://bugs.python.org/issue?@action=redirect&bpo=32228

   (31) https://bugs.python.org/issue?@action=redirect&bpo=26133

   (32) https://bugs.python.org/issue?@action=redirect&bpo=32185

   (33) https://bugs.python.org/issue?@action=redirect&bpo=32323

   (34) https://bugs.python.org/issue?@action=redirect&bpo=32302

   (35) https://bugs.python.org/issue?@action=redirect&bpo=32255

   (36) https://bugs.python.org/issue?@action=redirect&bpo=32277

   (37) https://bugs.python.org/issue?@action=redirect&bpo=32199

   (38) https://bugs.python.org/issue?@action=redirect&bpo=27456

   (39) https://bugs.python.org/issue?@action=redirect&bpo=31900

   (40) https://bugs.python.org/issue?@action=redirect&bpo=31802


File: python.info,  Node: ドキュメント<68>,  Next: テスト<65>,  Prev: ライブラリ<175>,  Up: Python 3 6 5 release candidate 1

1.24.77.4 ドキュメント
......................

   - bpo-17232(1): Clarify docs for -O and -OO. Patch by Terry Reedy.

   - bpo-32800(2): Update link to w3c doc for xml default namespaces.

   - bpo-8722(3): Document ‘__getattr__()’ behavior when property
     ‘get()’ method raises *note AttributeError: 5f0.

   - bpo-32614(4): Modify RE examples in documentation to use raw
     strings to prevent *note DeprecationWarning: 1a3. and add text to
     REGEX HOWTO to highlight the deprecation.

   - bpo-31972(5): Improve docstrings for ‘pathlib.PurePath’ subclasses.

   - bpo-17799(6): Explain real behaviour of sys.settrace and
     sys.setprofile and their C-API counterparts regarding which type of
     events are received in each function.  Patch by Pablo Galindo
     Salgado.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=17232

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32800

   (3) https://bugs.python.org/issue?@action=redirect&bpo=8722

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32614

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31972

   (6) https://bugs.python.org/issue?@action=redirect&bpo=17799


File: python.info,  Node: テスト<65>,  Next: ビルド<73>,  Prev: ドキュメント<68>,  Up: Python 3 6 5 release candidate 1

1.24.77.5 テスト
................

   - bpo-32517(1): Fix failing ‘test_asyncio’ on macOS 10.12.2+ due to
     transport of ‘KqueueSelector’ loop was not being closed.

   - bpo-32721(2): Fix test_hashlib to not fail if the _md5 module is
     not built.

   - bpo-32252(3): Fix faulthandler_suppress_crash_report() used to
     prevent core dump files when testing crashes.  getrlimit() returns
     zero on success.

   - bpo-31518(4): Debian Unstable has disabled TLS 1.0 and 1.1 for
     SSLv23_METHOD().  Change TLS/SSL protocol of some tests to
     PROTOCOL_TLS or PROTOCOL_TLSv1_2 to make them pass on Debian.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32517

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32721

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32252

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31518


File: python.info,  Node: ビルド<73>,  Next: Windows<65>,  Prev: テスト<65>,  Up: Python 3 6 5 release candidate 1

1.24.77.6 ビルド
................

   - bpo-32635(1): Fix segfault of the crypt module when libxcrypt is
     provided instead of libcrypt at the system.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32635


File: python.info,  Node: Windows<65>,  Next: macOS<50>,  Prev: ビルド<73>,  Up: Python 3 6 5 release candidate 1

1.24.77.7 Windows
.................

   - bpo-33016(1): Fix potential use of uninitialized memory in
     nt._getfinalpathname

   - bpo-32903(2): Fix a memory leak in os.chdir() on Windows if the
     current directory is set to a UNC path.

   - bpo-31966(3): Fixed WindowsConsoleIO.write() for writing empty
     data.

   - bpo-32409(4): Ensures activate.bat can handle Unicode contents.

   - bpo-32457(5): Improves handling of denormalized executable path
     when launching Python.

   - bpo-32370(6): Use the correct encoding for ipconfig output in the
     uuid module.  Patch by Segev Finer.

   - bpo-29248(7): Fix *note os.readlink(): b1a. on Windows, which was
     mistakenly treating the ‘PrintNameOffset’ field of the reparse data
     buffer as a number of characters instead of bytes.  Patch by Craig
     Holmquist and SSE4.

   - bpo-32588(8): Create standalone _distutils_findvs module.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33016

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32903

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31966

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32409

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32457

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32370

   (7) https://bugs.python.org/issue?@action=redirect&bpo=29248

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32588


File: python.info,  Node: macOS<50>,  Next: IDLE<47>,  Prev: Windows<65>,  Up: Python 3 6 5 release candidate 1

1.24.77.8 macOS
...............

   - bpo-32726(1): Provide an additional, more modern macOS installer
     variant that supports macOS 10.9+ systems in 64-bit mode only.
     Upgrade the supplied third-party libraries to OpenSSL 1.0.2n, XZ
     5.2.3, and SQLite 3.22.0.  The 10.9+ installer now links with and
     supplies its own copy of Tcl/Tk 8.6.8.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32726


File: python.info,  Node: IDLE<47>,  Next: Tools/Demos<45>,  Prev: macOS<50>,  Up: Python 3 6 5 release candidate 1

1.24.77.9 IDLE
..............

   - bpo-32984(1): Set ‘__file__’ while running a startup file.  Like
     Python, IDLE optionally runs one startup file in the Shell window
     before presenting the first interactive input prompt.  For IDLE,
     ‘-s’ runs a file named in environmental variable ‘IDLESTARTUP’ or
     *note PYTHONSTARTUP: 1b8.; ‘-r file’ runs ‘file’.  Python sets
     ‘__file__’ to the startup file name before running the file and
     unsets it before the first prompt.  IDLE now does the same when run
     normally, without the ‘-n’ option.

   - bpo-32940(2): Simplify and rename StringTranslatePseudoMapping in
     pyparse.

   - bpo-32916(3): Change ‘str’ to ‘code’ in pyparse.

   - bpo-32905(4): Remove unused code in pyparse module.

   - bpo-32874(5): Add tests for pyparse.

   - bpo-32837(6): Using the system and place-dependent default encoding
     for open() is a bad idea for IDLE's system and location-independent
     files.

   - bpo-32826(7): Add "encoding=utf-8" to open() in IDLE's
     test_help_about.  GUI test test_file_buttons() only looks at
     initial ascii-only lines, but failed on systems where open()
     defaults to 'ascii' because readline() internally reads and decodes
     far enough ahead to encounter a non-ascii character in CREDITS.txt.

   - bpo-32765(8): Update configdialog General tab docstring to add new
     widgets to the widget list.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32984

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32940

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32916

   (4) https://bugs.python.org/issue?@action=redirect&bpo=32905

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32874

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32837

   (7) https://bugs.python.org/issue?@action=redirect&bpo=32826

   (8) https://bugs.python.org/issue?@action=redirect&bpo=32765


File: python.info,  Node: Tools/Demos<45>,  Next: C API<65>,  Prev: IDLE<47>,  Up: Python 3 6 5 release candidate 1

1.24.77.10 Tools/Demos
......................

   - bpo-24960(1): 2to3 and lib2to3 can now read pickled grammar files
     using pkgutil.get_data() rather than probing the filesystem.  This
     lets 2to3 and lib2to3 work when run from a zipfile.

   - bpo-32222(2): Fix pygettext not extracting docstrings for functions
     with type annotated arguments.  Patch by Toby Harradine.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24960

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32222


File: python.info,  Node: C API<65>,  Prev: Tools/Demos<45>,  Up: Python 3 6 5 release candidate 1

1.24.77.11 C API
................

   - bpo-29084(1): Undocumented C API for OrderedDict has been excluded
     from the limited C API. It was added by mistake and actually never
     worked in the limited C API.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29084


File: python.info,  Node: Python 3 6 4 final,  Next: Python 3 6 4 release candidate 1,  Prev: Python 3 6 5 release candidate 1,  Up: 変更履歴

1.24.78 Python 3.6.4 final
--------------------------

'Release date: 2017-12-18'

There were no new code changes in version 3.6.4 since v3.6.4rc1.


File: python.info,  Node: Python 3 6 4 release candidate 1,  Next: Python 3 6 3 final,  Prev: Python 3 6 4 final,  Up: 変更履歴

1.24.79 Python 3.6.4 release candidate 1
----------------------------------------

'Release date: 2017-12-05'

* Menu:

* Core and Builtins: Core and Builtins<172>.
* ライブラリ: ライブラリ<176>.
* ドキュメント: ドキュメント<69>.
* テスト: テスト<66>.
* ビルド: ビルド<74>.
* Windows: Windows<66>.
* macOS: macOS<51>.
* IDLE: IDLE<48>.
* Tools/Demos: Tools/Demos<46>.
* C API: C API<66>.


File: python.info,  Node: Core and Builtins<172>,  Next: ライブラリ<176>,  Up: Python 3 6 4 release candidate 1

1.24.79.1 Core and Builtins
...........................

   - bpo-32176(1): co_flags.CO_NOFREE is now always set correctly by the
     code object constructor based on freevars and cellvars, rather than
     needing to be set correctly by the caller.  This ensures it will be
     cleared automatically when additional cell references are injected
     into a modified code object and function.

   - bpo-31949(2): Fixed several issues in printing tracebacks
     (PyTraceBack_Print()).  Setting sys.tracebacklimit to 0 or less now
     suppresses printing tracebacks.  Setting sys.tracebacklimit to None
     now causes using the default limit.  Setting sys.tracebacklimit to
     an integer larger than LONG_MAX now means using the limit LONG_MAX
     rather than the default limit.  Fixed integer overflows in the case
     of more than ‘2**31’ traceback items on Windows.  Fixed output
     errors handling.

   - bpo-30696(3): Fix the interactive interpreter looping endlessly
     when no memory.

   - bpo-20047(4): Bytearray methods partition() and rpartition() now
     accept only bytes-like objects as separator, as documented.  In
     particular they now raise TypeError rather of returning a bogus
     result when an integer is passed as a separator.

   - bpo-31852(5): Fix a segmentation fault caused by a combination of
     the async soft keyword and continuation lines.

   - bpo-21720(6): BytesWarning no longer emitted when the 'fromlist'
     argument of ‘__import__()’ or the ‘__all__’ attribute of the module
     contain bytes instances.

   - bpo-31825(7): Fixed OverflowError in the 'unicode-escape' codec and
     in codecs.escape_decode() when decode an escaped non-ascii byte.

   - bpo-28603(8): Print the full context/cause chain of exceptions on
     interpreter exit, even if an exception in the chain is unhashable
     or compares equal to later ones.  Patch by Zane Bitter.

   - bpo-31786(9): Fix timeout rounding in the select module to round
     correctly negative timeouts between -1.0 and 0.0.  The functions
     now block waiting for events as expected.  Previously, the call was
     incorrectly non-blocking.  Patch by Pablo Galindo.

   - bpo-31642(10): Restored blocking "from package import module" by
     setting sys.modules["package.module"] to None.

   - bpo-31626(11): Fixed a bug in debug memory allocator.  There was a
     write to freed memory after shrinking a memory block.

   - bpo-31619(12): Fixed a ValueError when convert a string with large
     number of underscores to integer with binary base.

   - bpo-31592(13): Fixed an assertion failure in Python parser in case
     of a bad ‘unicodedata.normalize()’.  Patch by Oren Milman.

   - bpo-31588(14): Raise a ‘TypeError’ with a helpful error message
     when class creation fails due to a metaclass with a bad
     ‘__prepare__()’ method.  Patch by Oren Milman.

   - bpo-31566(15): Fix an assertion failure in ‘_warnings.warn()’ in
     case of a bad ‘__name__’ global.  Patch by Oren Milman.

   - bpo-31505(16): Fix an assertion failure in ‘json’, in case
     ‘_json.make_encoder()’ received a bad ‘encoder()’ argument.  Patch
     by Oren Milman.

   - bpo-31492(17): Fix assertion failures in case of failing to import
     from a module with a bad ‘__name__’ attribute, and in case of
     failing to access an attribute of such a module.  Patch by Oren
     Milman.

   - bpo-31490(18): Fix an assertion failure in ‘ctypes’ class
     definition, in case the class has an attribute whose name is
     specified in ‘_anonymous_’ but not in ‘_fields_’.  Patch by Oren
     Milman.

   - bpo-31478(19): Fix an assertion failure in ‘_random.Random.seed()’
     in case the argument has a bad ‘__abs__()’ method.  Patch by Oren
     Milman.

   - bpo-31315(20): Fix an assertion failure in imp.create_dynamic(),
     when spec.name is not a string.  Patch by Oren Milman.

   - bpo-31311(21): Fix a crash in the ‘__setstate__()’ method of
     ‘ctypes._CData’, in case of a bad ‘__dict__’.  Patch by Oren
     Milman.

   - bpo-31293(22): Fix crashes in true division and multiplication of a
     timedelta object by a float with a bad as_integer_ratio() method.
     Patch by Oren Milman.

   - bpo-31285(23): Fix an assertion failure in
     ‘warnings.warn_explicit’, when the return value of the received
     loader's ‘get_source()’ has a bad ‘splitlines()’ method.  Patch by
     Oren Milman.

   - bpo-30817(24): ‘PyErr_PrintEx()’ clears now the ignored exception
     that may be raised by ‘_PySys_SetObjectId()’, for example when no
     memory.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32176

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31949

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30696

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20047

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31852

   (6) https://bugs.python.org/issue?@action=redirect&bpo=21720

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31825

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28603

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31786

   (10) https://bugs.python.org/issue?@action=redirect&bpo=31642

   (11) https://bugs.python.org/issue?@action=redirect&bpo=31626

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31619

   (13) https://bugs.python.org/issue?@action=redirect&bpo=31592

   (14) https://bugs.python.org/issue?@action=redirect&bpo=31588

   (15) https://bugs.python.org/issue?@action=redirect&bpo=31566

   (16) https://bugs.python.org/issue?@action=redirect&bpo=31505

   (17) https://bugs.python.org/issue?@action=redirect&bpo=31492

   (18) https://bugs.python.org/issue?@action=redirect&bpo=31490

   (19) https://bugs.python.org/issue?@action=redirect&bpo=31478

   (20) https://bugs.python.org/issue?@action=redirect&bpo=31315

   (21) https://bugs.python.org/issue?@action=redirect&bpo=31311

   (22) https://bugs.python.org/issue?@action=redirect&bpo=31293

   (23) https://bugs.python.org/issue?@action=redirect&bpo=31285

   (24) https://bugs.python.org/issue?@action=redirect&bpo=30817


File: python.info,  Node: ライブラリ<176>,  Next: ドキュメント<69>,  Prev: Core and Builtins<172>,  Up: Python 3 6 4 release candidate 1

1.24.79.2 ライブラリ
....................

   - bpo-28556(1): Two minor fixes for ‘typing’ module: allow shallow
     copying instances of generic classes, improve interaction of
     ‘__init_subclass__’ with generics.  Original PRs by Ivan
     Levkivskyi.

   - bpo-27240(2): The header folding algorithm for the new email
     policies has been rewritten, which also fixes bpo-30788(3),
     bpo-31831(4), and bpo-32182(5).  In particular, RFC2231 folding is
     now done correctly.

   - bpo-32186(6): io.FileIO.readall() and io.FileIO.read() now release
     the GIL when getting the file size.  Fixed hang of all threads with
     inaccessible NFS server.  Patch by Nir Soffer.

   - bpo-12239(7): Make ‘msilib.SummaryInformation.GetProperty()’ return
     ‘None’ when the value of property is ‘VT_EMPTY’.  Initial patch by
     Mark Mc Mahon.

   - bpo-31325(8): Fix wrong usage of *note collections.namedtuple():
     4e0. in the *note RobotFileParser.parse(): 1e83. method.  Initial
     patch by Robin Wellner.

   - bpo-12382(9): ‘msilib.OpenDatabase()’ now raises a better exception
     message when it couldn't open or create an MSI file.  Initial patch
     by William Tisäter.

   - bpo-32110(10): ‘codecs.StreamReader.read(n)’ now returns not more
     than 'n' characters/bytes for non-negative 'n'.  This makes it
     compatible with ‘read()’ methods of other file-like objects.

   - bpo-32072(11): Fixed issues with binary plists: Fixed saving
     bytearrays.  Identical objects will be saved only once.  Equal
     references will be load as identical objects.  Added support for
     saving and loading recursive data structures.

   - bpo-32034(12): Make asyncio.IncompleteReadError and
     LimitOverrunError pickleable.

   - bpo-32015(13): Fixed the looping of asyncio in the case of
     reconnection the socket during waiting async read/write from/to the
     socket.

   - bpo-32011(14): Restored support of loading marshal files with the
     TYPE_INT64 code.  These files can be produced in Python 2.7.

   - bpo-31970(15): Reduce performance overhead of asyncio debug mode.

   - bpo-9678(16): Fixed determining the MAC address in the uuid module:
     Using ifconfig on NetBSD and OpenBSD. Using arp on Linux, FreeBSD,
     NetBSD and OpenBSD. Based on patch by Takayuki Shimizukawa.

   - bpo-30057(17): Fix potential missed signal in signal.signal().

   - bpo-31933(18): Fix Blake2 params leaf_size and node_offset on big
     endian platforms.  Patch by Jack O'Connor.

   - bpo-31927(19): Fixed compilation of the socket module on NetBSD 8.
     Fixed assertion failure or reading arbitrary data when parse a
     AF_BLUETOOTH address on NetBSD and DragonFly BSD.

   - bpo-27666(20): Fixed stack corruption in curses.box() and
     curses.ungetmouse() when the size of types chtype or mmask_t is
     less than the size of C long.  curses.box() now accepts characters
     as arguments.  Based on patch by Steve Fink.

   - bpo-31897(21): plistlib now catches more errors when read binary
     plists and raises InvalidFileException instead of unexpected
     exceptions.

   - bpo-25720(22): Fix the method for checking pad state of curses
     WINDOW. Patch by Masayuki Yamamoto.

   - bpo-31893(23): Fixed the layout of the kqueue_event structure on
     OpenBSD and NetBSD. Fixed the comparison of the kqueue_event
     objects.

   - bpo-31891(24): Fixed building the curses module on NetBSD.

   - bpo-28416(25): Instances of pickle.Pickler subclass with the
     persistent_id() method and pickle.Unpickler subclass with the
     persistent_load() method no longer create reference cycles.

   - bpo-28326(26): Fix multiprocessing.Process when stdout and/or
     stderr is closed or None.

   - bpo-31457(27): If nested log adapters are used, the inner
     ‘process()’ methods are no longer omitted.

   - bpo-31457(28): The ‘manager’ property on LoggerAdapter objects is
     now properly settable.

   - bpo-31806(29): Fix timeout rounding in time.sleep(),
     threading.Lock.acquire() and socket.socket.settimeout() to round
     correctly negative timeouts between -1.0 and 0.0.  The functions
     now block waiting for events as expected.  Previously, the call was
     incorrectly non-blocking.  Patch by Pablo Galindo.

   - bpo-28603(30): traceback: Fix a TypeError that occurred during
     printing of exception tracebacks when either the current exception
     or an exception in its context/cause chain is unhashable.  Patch by
     Zane Bitter.

   - bpo-30058(31): Fixed buffer overflow in select.kqueue.control().

   - bpo-31770(32): Prevent a crash when calling the ‘__init__()’ method
     of a ‘sqlite3.Cursor’ object more than once.  Patch by Oren Milman.

   - bpo-31672(33): ‘idpattern’ in ‘string.Template’ matched some
     non-ASCII characters.  Now it uses ‘-i’ regular expression local
     flag to avoid non-ASCII characters.

   - bpo-31764(34): Prevent a crash in ‘sqlite3.Cursor.close()’ in case
     the ‘Cursor’ object is uninitialized.  Patch by Oren Milman.

   - bpo-31752(35): Fix possible crash in timedelta constructor called
     with custom integers.

   - bpo-31701(36): On Windows, faulthandler.enable() now ignores MSC
     and COM exceptions.

   - bpo-31728(37): Prevent crashes in ‘_elementtree’ due to unsafe
     cleanup of ‘Element.text’ and ‘Element.tail’.  Patch by Oren
     Milman.

   - bpo-31620(38): an empty asyncio.Queue now doesn't leak memory when
     queue.get pollers timeout

   - bpo-31632(39): Fix method set_protocol() of class
     _SSLProtocolTransport in asyncio module.  This method was
     previously modifying a wrong reference to the protocol.

   - bpo-31675(40): Fixed memory leaks in Tkinter's methods splitlist()
     and split() when pass a string larger than 2 GiB.

   - bpo-31673(41): Fixed typo in the name of Tkinter's method
     adderrorinfo().

   - bpo-30806(42): Fix the string representation of a netrc object.

   - bpo-15037(43): Added a workaround for getkey() in curses for
     ncurses 5.7 and earlier.

   - bpo-25351(44): Avoid venv activate failures with undefined
     variables

   - bpo-25532(45): inspect.unwrap() will now only try to unwrap an
     object sys.getrecursionlimit() times, to protect against objects
     which create a new object on every attribute access.

   - bpo-30347(46): Stop crashes when concurrently iterate over
     itertools.groupby() iterators.

   - bpo-31516(47): ‘threading.current_thread()’ should not return a
     dummy thread at shutdown.

   - bpo-31351(48): python -m ensurepip now exits with non-zero exit
     code if pip bootstrapping has failed.

   - bpo-31482(49): ‘random.seed()’ now works with bytes in version=1

   - bpo-31334(50): Fix ‘poll.poll([timeout])’ in the ‘select’ module
     for arbitrary negative timeouts on all OSes where it can only be a
     non-negative integer or -1.  Patch by Riccardo Coccioli.

   - bpo-31310(51): multiprocessing's semaphore tracker should be
     launched again if crashed.

   - bpo-31308(52): Make multiprocessing's forkserver process immune to
     Ctrl-C and other user interruptions.  If it crashes, restart it
     when necessary.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27240

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30788

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31831

   (5) https://bugs.python.org/issue?@action=redirect&bpo=32182

   (6) https://bugs.python.org/issue?@action=redirect&bpo=32186

   (7) https://bugs.python.org/issue?@action=redirect&bpo=12239

   (8) https://bugs.python.org/issue?@action=redirect&bpo=31325

   (9) https://bugs.python.org/issue?@action=redirect&bpo=12382

   (10) https://bugs.python.org/issue?@action=redirect&bpo=32110

   (11) https://bugs.python.org/issue?@action=redirect&bpo=32072

   (12) https://bugs.python.org/issue?@action=redirect&bpo=32034

   (13) https://bugs.python.org/issue?@action=redirect&bpo=32015

   (14) https://bugs.python.org/issue?@action=redirect&bpo=32011

   (15) https://bugs.python.org/issue?@action=redirect&bpo=31970

   (16) https://bugs.python.org/issue?@action=redirect&bpo=9678

   (17) https://bugs.python.org/issue?@action=redirect&bpo=30057

   (18) https://bugs.python.org/issue?@action=redirect&bpo=31933

   (19) https://bugs.python.org/issue?@action=redirect&bpo=31927

   (20) https://bugs.python.org/issue?@action=redirect&bpo=27666

   (21) https://bugs.python.org/issue?@action=redirect&bpo=31897

   (22) https://bugs.python.org/issue?@action=redirect&bpo=25720

   (23) https://bugs.python.org/issue?@action=redirect&bpo=31893

   (24) https://bugs.python.org/issue?@action=redirect&bpo=31891

   (25) https://bugs.python.org/issue?@action=redirect&bpo=28416

   (26) https://bugs.python.org/issue?@action=redirect&bpo=28326

   (27) https://bugs.python.org/issue?@action=redirect&bpo=31457

   (28) https://bugs.python.org/issue?@action=redirect&bpo=31457

   (29) https://bugs.python.org/issue?@action=redirect&bpo=31806

   (30) https://bugs.python.org/issue?@action=redirect&bpo=28603

   (31) https://bugs.python.org/issue?@action=redirect&bpo=30058

   (32) https://bugs.python.org/issue?@action=redirect&bpo=31770

   (33) https://bugs.python.org/issue?@action=redirect&bpo=31672

   (34) https://bugs.python.org/issue?@action=redirect&bpo=31764

   (35) https://bugs.python.org/issue?@action=redirect&bpo=31752

   (36) https://bugs.python.org/issue?@action=redirect&bpo=31701

   (37) https://bugs.python.org/issue?@action=redirect&bpo=31728

   (38) https://bugs.python.org/issue?@action=redirect&bpo=31620

   (39) https://bugs.python.org/issue?@action=redirect&bpo=31632

   (40) https://bugs.python.org/issue?@action=redirect&bpo=31675

   (41) https://bugs.python.org/issue?@action=redirect&bpo=31673

   (42) https://bugs.python.org/issue?@action=redirect&bpo=30806

   (43) https://bugs.python.org/issue?@action=redirect&bpo=15037

   (44) https://bugs.python.org/issue?@action=redirect&bpo=25351

   (45) https://bugs.python.org/issue?@action=redirect&bpo=25532

   (46) https://bugs.python.org/issue?@action=redirect&bpo=30347

   (47) https://bugs.python.org/issue?@action=redirect&bpo=31516

   (48) https://bugs.python.org/issue?@action=redirect&bpo=31351

   (49) https://bugs.python.org/issue?@action=redirect&bpo=31482

   (50) https://bugs.python.org/issue?@action=redirect&bpo=31334

   (51) https://bugs.python.org/issue?@action=redirect&bpo=31310

   (52) https://bugs.python.org/issue?@action=redirect&bpo=31308


File: python.info,  Node: ドキュメント<69>,  Next: テスト<66>,  Prev: ライブラリ<176>,  Up: Python 3 6 4 release candidate 1

1.24.79.3 ドキュメント
......................

   - bpo-32105(1): Added asyncio.BaseEventLoop.connect_accepted_socket
     versionadded marker.

   - bpo-31537(2): Fix incorrect usage of ‘get_history_length’ in
     readline documentation example code.  Patch by Brad Smith.

   - bpo-30085(3): The operator functions without double underscores are
     preferred for clarity.  The one with underscores are only kept for
     back-compatibility.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32105

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31537

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30085


File: python.info,  Node: テスト<66>,  Next: ビルド<74>,  Prev: ドキュメント<69>,  Up: Python 3 6 4 release candidate 1

1.24.79.4 テスト
................

   - bpo-31380(1): Skip test_httpservers test_undecodable_file on macOS:
     fails on APFS.

   - bpo-31705(2): Skip test_socket.test_sha256() on Linux kernel older
     than 4.5.  The test fails with ENOKEY on kernel 3.10 (on ppc64le).
     A fix was merged into the kernel 4.5.

   - bpo-31174(3): Fix test_tools.test_unparse: DirectoryTestCase now
     stores the names sample to always test the same files.  It prevents
     false alarms when hunting reference leaks.

   - bpo-30695(4): Add the ‘set_nomemory(start, stop)’ and
     ‘remove_mem_hooks()’ functions to the ‘_testcapi’ module.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31380

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31705

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31174

   (4) https://bugs.python.org/issue?@action=redirect&bpo=30695


File: python.info,  Node: ビルド<74>,  Next: Windows<66>,  Prev: テスト<66>,  Up: Python 3 6 4 release candidate 1

1.24.79.5 ビルド
................

   - bpo-32059(1): ‘detect_modules()’ in ‘setup.py’ now also searches
     the sysroot paths when cross-compiling.

   - bpo-31957(2): Fixes Windows SDK version detection when building for
     Windows.

   - bpo-31609(3): Fixes quotes in PCbuild/clean.bat

   - bpo-31934(4): Abort the build when building out of a not clean
     source tree.

   - bpo-31926(5): Fixed Argument Clinic sometimes causing compilation
     errors when there was more than one function and/or method in a .c
     file with the same name.

   - bpo-28791(6): Update Windows builds to use SQLite 3.21.0.

   - bpo-28791(7): Update OS X installer to use SQLite 3.21.0.

   - bpo-22140(8): Prevent double substitution of prefix in
     python-config.sh.

   - bpo-31536(9): Avoid wholesale rebuild after ‘make regen-all’ if
     nothing changed.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32059

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31957

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31609

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31934

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31926

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28791

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28791

   (8) https://bugs.python.org/issue?@action=redirect&bpo=22140

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31536


File: python.info,  Node: Windows<66>,  Next: macOS<51>,  Prev: ビルド<74>,  Up: Python 3 6 4 release candidate 1

1.24.79.6 Windows
.................

   - bpo-1102(1): Return ‘None’ when ‘View.Fetch()’ returns
     ‘ERROR_NO_MORE_ITEMS’ instead of raising ‘MSIError’.  Initial patch
     by Anthony Tuininga.

   - bpo-31944(2): Fixes Modify button in Apps and Features dialog.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=1102

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31944


File: python.info,  Node: macOS<51>,  Next: IDLE<48>,  Prev: Windows<66>,  Up: Python 3 6 4 release candidate 1

1.24.79.7 macOS
...............

   - bpo-31392(1): Update macOS installer to use OpenSSL 1.0.2m

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31392


File: python.info,  Node: IDLE<48>,  Next: Tools/Demos<46>,  Prev: macOS<51>,  Up: Python 3 6 4 release candidate 1

1.24.79.8 IDLE
..............

   - bpo-32207(1): Improve tk event exception tracebacks in IDLE. When
     tk event handling is driven by IDLE's run loop, a confusing and
     distracting queue.EMPTY traceback context is no longer added to tk
     event exception tracebacks.  The traceback is now the same as when
     event handling is driven by user code.  Patch based on a suggestion
     by Serhiy Storchaka.

   - bpo-32164(2): Delete unused file idlelib/tabbedpages.py.  Use of
     TabbedPageSet in configdialog was replaced by ttk.Notebook.

   - bpo-32100(3): IDLE: Fix old and new bugs in pathbrowser; improve
     tests.  Patch mostly by Cheryl Sabella.

   - bpo-31858(4): IDLE - Restrict shell prompt manipulation to the
     shell.  Editor and output windows only see an empty last prompt
     line.  This simplifies the code and fixes a minor bug when newline
     is inserted.  Sys.ps1, if present, is read on Shell start-up, but
     is not set or changed.

   - bpo-31860(5): The font sample in the IDLE configuration dialog is
     now editable.  Changes persist while IDLE remains open

   - bpo-31836(6): Test_code_module now passes if run after test_idle,
     which sets ps1.  The code module uses sys.ps1 if present or sets it
     to '>>> ' if not.  Test_code_module now properly tests both
     behaviors.  Ditto for ps2.

   - bpo-28603(7): Fix a TypeError that caused a shell restart when
     printing a traceback that includes an exception that is unhashable.
     Patch by Zane Bitter.

   - bpo-13802(8): Use non-Latin characters in the IDLE's Font settings
     sample.  Even if one selects a font that defines a limited subset
     of the unicode Basic Multilingual Plane, tcl/tk will use other
     fonts that define a character.  The expanded example give users of
     non-Latin characters a better idea of what they might see in IDLE's
     shell and editors.  To make room for the expanded sample, frames on
     the Font tab are re-arranged.  The Font/Tabs help explains a bit
     about the additions.

   - bpo-31460(9): Simplify the API of IDLE's Module Browser.  Passing a
     widget instead of an flist with a root widget opens the option of
     creating a browser frame that is only part of a window.  Passing a
     full file name instead of pieces assumed to come from a .py file
     opens the possibility of browsing python files that do not end in
     .py.

   - bpo-31649(10): IDLE - Make _htest, _utest parameters keyword only.

   - bpo-31559(11): Remove test order dependence in
     idle_test.test_browser.

   - bpo-31459(12): Rename IDLE's module browser from Class Browser to
     Module Browser.  The original module-level class and method browser
     became a module browser, with the addition of module-level
     functions, years ago.  Nested classes and functions were added
     yesterday.  For back-compatibility, the virtual event
     <<open-class-browser>>, which appears on the Keys tab of the
     Settings dialog, is not changed.  Patch by Cheryl Sabella.

   - bpo-31500(13): Default fonts now are scaled on HiDPI displays.

   - bpo-1612262(14): IDLE module browser now shows nested classes and
     functions.  Original patches for code and tests by Guilherme Polo
     and Cheryl Sabella, respectively.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32207

   (2) https://bugs.python.org/issue?@action=redirect&bpo=32164

   (3) https://bugs.python.org/issue?@action=redirect&bpo=32100

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31858

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31860

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31836

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28603

   (8) https://bugs.python.org/issue?@action=redirect&bpo=13802

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31460

   (10) https://bugs.python.org/issue?@action=redirect&bpo=31649

   (11) https://bugs.python.org/issue?@action=redirect&bpo=31559

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31459

   (13) https://bugs.python.org/issue?@action=redirect&bpo=31500

   (14) https://bugs.python.org/issue?@action=redirect&bpo=1612262


File: python.info,  Node: Tools/Demos<46>,  Next: C API<66>,  Prev: IDLE<48>,  Up: Python 3 6 4 release candidate 1

1.24.79.9 Tools/Demos
.....................

   - bpo-30722(1): Make redemo work with Python 3.6 and newer versions.
     Also, remove the ‘LOCALE’ option since it doesn't work with string
     patterns in Python 3.  Patch by Christoph Sarnowski.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30722


File: python.info,  Node: C API<66>,  Prev: Tools/Demos<46>,  Up: Python 3 6 4 release candidate 1

1.24.79.10 C API
................

   - bpo-20891(1): Fix PyGILState_Ensure().  When PyGILState_Ensure() is
     called in a non-Python thread before PyEval_InitThreads(), only
     call PyEval_InitThreads() after calling PyThreadState_New() to fix
     a crash.

   - bpo-31532(2): Fix memory corruption due to allocator mix in
     getpath.c between Py_GetPath() and Py_SetPath()

   - bpo-30697(3): The ‘PyExc_RecursionErrorInst’ singleton is removed
     and ‘PyErr_NormalizeException()’ does not use it anymore.  This
     singleton is persistent and its members being never cleared may
     cause a segfault during finalization of the interpreter.  See also
     bpo-22898(4).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20891

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31532

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30697

   (4) https://bugs.python.org/issue?@action=redirect&bpo=22898


File: python.info,  Node: Python 3 6 3 final,  Next: Python 3 6 3 release candidate 1,  Prev: Python 3 6 4 release candidate 1,  Up: 変更履歴

1.24.80 Python 3.6.3 final
--------------------------

'Release date: 2017-10-03'

* Menu:

* ライブラリ: ライブラリ<177>.
* ビルド: ビルド<75>.


File: python.info,  Node: ライブラリ<177>,  Next: ビルド<75>,  Up: Python 3 6 3 final

1.24.80.1 ライブラリ
....................

   - bpo-31641(1): Re-allow arbitrary iterables in
     ‘concurrent.futures.as_completed()’.  Fixes regression in 3.6.3rc1.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31641


File: python.info,  Node: ビルド<75>,  Prev: ライブラリ<177>,  Up: Python 3 6 3 final

1.24.80.2 ビルド
................

   - bpo-31662(1): Fix typos in Windows ‘uploadrelease.bat’ script.  Fix
     Windows Doc build issues in ‘Doc/make.bat’.

   - bpo-31423(2): Fix building the PDF documentation with newer
     versions of Sphinx.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31662

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31423


File: python.info,  Node: Python 3 6 3 release candidate 1,  Next: Python 3 6 2 final,  Prev: Python 3 6 3 final,  Up: 変更履歴

1.24.81 Python 3.6.3 release candidate 1
----------------------------------------

'Release date: 2017-09-18'

* Menu:

* セキュリティ: セキュリティ<51>.
* Core and Builtins: Core and Builtins<173>.
* ライブラリ: ライブラリ<178>.
* ドキュメント: ドキュメント<70>.
* テスト: テスト<67>.
* ビルド: ビルド<76>.
* Windows: Windows<67>.
* IDLE: IDLE<49>.
* Tools/Demos: Tools/Demos<47>.


File: python.info,  Node: セキュリティ<51>,  Next: Core and Builtins<173>,  Up: Python 3 6 3 release candidate 1

1.24.81.1 セキュリティ
......................

   - bpo-29781(1): SSLObject.version() now correctly returns None when
     handshake over BIO has not been performed yet.

   - bpo-30947(2): Upgrade libexpat embedded copy from version 2.2.1 to
     2.2.3 to get security fixes.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29781

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30947


File: python.info,  Node: Core and Builtins<173>,  Next: ライブラリ<178>,  Prev: セキュリティ<51>,  Up: Python 3 6 3 release candidate 1

1.24.81.2 Core and Builtins
...........................

   - bpo-31471(1): Fix an assertion failure in ‘subprocess.Popen()’ on
     Windows, in case the env argument has a bad ‘keys()’ method.  Patch
     by Oren Milman.

   - bpo-31418(2): Fix an assertion failure in ‘PyErr_WriteUnraisable()’
     in case of an exception with a bad ‘__module__’ attribute.  Patch
     by Oren Milman.

   - bpo-31416(3): Fix assertion failures in case of a bad
     warnings.filters or warnings.defaultaction.  Patch by Oren Milman.

   - bpo-31411(4): Raise a TypeError instead of SystemError in case
     warnings.onceregistry is not a dictionary.  Patch by Oren Milman.

   - bpo-31373(5): Fix several possible instances of undefined behavior
     due to floating-point demotions.

   - bpo-30465(6): Location information (‘lineno’ and ‘col_offset’) in
     f-strings is now (mostly) correct.  This fixes tools like flake8
     from showing warnings on the wrong line (typically the first line
     of the file).

   - bpo-31343(7): Include sys/sysmacros.h for major(), minor(), and
     makedev().  GNU C library plans to remove the functions from
     sys/types.h.

   - bpo-31291(8): Fix an assertion failure in
     ‘zipimport.zipimporter.get_data’ on Windows, when the return value
     of ‘pathname.replace('/','\\')’ isn't a string.  Patch by Oren
     Milman.

   - bpo-31271(9): Fix an assertion failure in the ‘write()’ method of
     ‘io.TextIOWrapper’, when the encoder doesn't return a bytes object.
     Patch by Oren Milman.

   - bpo-31243(10): Fix a crash in some methods of ‘io.TextIOWrapper’,
     when the decoder's state is invalid.  Patch by Oren Milman.

   - bpo-30721(11): ‘print’ now shows correct usage hint for using
     Python 2 redirection syntax.  Patch by Sanyam Khurana.

   - bpo-31070(12): Fix a race condition in importlib
     _get_module_lock().

   - bpo-31095(13): Fix potential crash during GC caused by ‘tp_dealloc’
     which doesn't call ‘PyObject_GC_UnTrack()’.

   - bpo-31071(14): Avoid masking original TypeError in call with *
     unpacking when other arguments are passed.

   - bpo-30978(15): str.format_map() now passes key lookup exceptions
     through.  Previously any exception was replaced with a KeyError
     exception.

   - bpo-30808(16): Use _Py_atomic API for concurrency-sensitive signal
     state.

   - bpo-30876(17): Relative import from unloaded package now reimports
     the package instead of failing with SystemError.  Relative import
     from non-package now fails with ImportError rather than
     SystemError.

   - bpo-30703(18): Improve signal delivery.  Avoid using
     Py_AddPendingCall from signal handler, to avoid calling
     signal-unsafe functions.  The tests I'm adding here fail without
     the rest of the patch, on Linux and OS X. This means our signal
     delivery logic had defects (some signals could be lost).

   - bpo-30765(19): Avoid blocking in pthread_mutex_lock() when
     PyThread_acquire_lock() is asked not to block.

   - bpo-31161(20): Make sure the 'Missing parentheses' syntax error
     message is only applied to SyntaxError, not to subclasses.  Patch
     by Martijn Pieters.

   - bpo-30814(21): Fixed a race condition when import a submodule from
     a package.

   - bpo-30597(22): ‘print’ now shows expected input in custom error
     message when used as a Python 2 statement.  Patch by Sanyam
     Khurana.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31471

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31418

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31416

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31411

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31373

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30465

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31343

   (8) https://bugs.python.org/issue?@action=redirect&bpo=31291

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31271

   (10) https://bugs.python.org/issue?@action=redirect&bpo=31243

   (11) https://bugs.python.org/issue?@action=redirect&bpo=30721

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31070

   (13) https://bugs.python.org/issue?@action=redirect&bpo=31095

   (14) https://bugs.python.org/issue?@action=redirect&bpo=31071

   (15) https://bugs.python.org/issue?@action=redirect&bpo=30978

   (16) https://bugs.python.org/issue?@action=redirect&bpo=30808

   (17) https://bugs.python.org/issue?@action=redirect&bpo=30876

   (18) https://bugs.python.org/issue?@action=redirect&bpo=30703

   (19) https://bugs.python.org/issue?@action=redirect&bpo=30765

   (20) https://bugs.python.org/issue?@action=redirect&bpo=31161

   (21) https://bugs.python.org/issue?@action=redirect&bpo=30814

   (22) https://bugs.python.org/issue?@action=redirect&bpo=30597


File: python.info,  Node: ライブラリ<178>,  Next: ドキュメント<70>,  Prev: Core and Builtins<173>,  Up: Python 3 6 3 release candidate 1

1.24.81.3 ライブラリ
....................

   - bpo-31499(1): xml.etree: Fix a crash when a parser is part of a
     reference cycle.

   - bpo-28556(2): typing.get_type_hints now finds the right globalns
     for classes and modules by default (when no ‘globalns’ was
     specified by the caller).

   - bpo-28556(3): Speed improvements to the ‘typing’ module.  Original
     PRs by Ivan Levkivskyi and Mitar.

   - bpo-31544(4): The C accelerator module of ElementTree ignored
     exceptions raised when looking up TreeBuilder target methods in
     XMLParser().

   - bpo-31234(5): socket.create_connection() now fixes manually a
     reference cycle: clear the variable storing the last exception on
     success.

   - bpo-31457(6): LoggerAdapter objects can now be nested.

   - bpo-31400(7): Improves SSL error handling to avoid losing error
     numbers.

   - bpo-28958(8): ssl.SSLContext() now uses OpenSSL error information
     when a context cannot be instantiated.

   - bpo-27340(9): SSLSocket.sendall() now uses memoryview to create
     slices of data.  This fixes support for all bytes-like object.  It
     is also more efficient and avoids costly copies.

   - bpo-31178(10): Fix string concatenation bug in rare error path in
     the subprocess module

   - bpo-31350(11): Micro-optimize ‘asyncio._get_running_loop()’ to
     become up to 10% faster.

   - bpo-31170(12): expat: Update libexpat from 2.2.3 to 2.2.4.  Fix
     copying of partial characters for UTF-8 input (libexpat bug 115):
     ‘https://github.com/libexpat/libexpat/issues/115’

   - bpo-29136(13): Add TLS 1.3 cipher suites and OP_NO_TLSv1_3.

   - bpo-29212(14): Fix concurrent.futures.thread.ThreadPoolExecutor
     threads to have a non repr() based thread name by default when no
     thread_name_prefix is supplied.  They will now identify themselves
     as "ThreadPoolExecutor-y_n".

   - bpo-9146(15): Fix a segmentation fault in _hashopenssl when
     standard hash functions such as md5 are not available in the linked
     OpenSSL library.  As in some special FIPS-140 build environments.

   - bpo-27144(16): The ‘map()’ and ‘as_completed()’ iterators in
     ‘concurrent.futures’ now avoid keeping a reference to yielded
     objects.

   - bpo-10746(17): Fix ctypes producing wrong PEP 3118(18) type codes
     for integer types.

   - bpo-22536(19): The subprocess module now sets the filename when
     FileNotFoundError is raised on POSIX systems due to the executable
     or cwd not being found.

   - bpo-31249(20): concurrent.futures: WorkItem.run() used by
     ThreadPoolExecutor now breaks a reference cycle between an
     exception object and the WorkItem object.

   - bpo-31247(21): xmlrpc.server now explicitly breaks reference cycles
     when using sys.exc_info() in code handling exceptions.

   - bpo-30102(22): The ssl and hashlib modules now call
     OPENSSL_add_all_algorithms_noconf() on OpenSSL < 1.1.0.  The
     function detects CPU features and enables optimizations on some CPU
     architectures such as POWER8.  Patch is based on research from
     Gustavo Serra Scalet.

   - bpo-31185(23): Fixed miscellaneous errors in asyncio speedup
     module.

   - bpo-31135(24): ttk: fix the destroy() method of LabeledScale and
     OptionMenu classes.  Call the parent destroy() method even if the
     used attribute doesn't exist.  The LabeledScale.destroy() method
     now also explicitly clears label and scale attributes to help the
     garbage collector to destroy all widgets.

   - bpo-31107(25): Fix ‘copyreg._slotnames()’ mangled attribute
     calculation for classes whose name begins with an underscore.
     Patch by Shane Harvey.

   - bpo-31061(26): Fixed a crash when using asyncio and threads.

   - bpo-30502(27): Fix handling of long oids in ssl.  Based on patch by
     Christian Heimes.

   - bpo-30119(28): ftplib.FTP.putline() now throws ValueError on
     commands that contains CR or LF. Patch by Donghee Na.

   - bpo-30595(29): multiprocessing.Queue.get() with a timeout now polls
     its reader in non-blocking mode if it succeeded to acquire the lock
     but the acquire took longer than the timeout.

   - bpo-29403(30): Fix ‘unittest.mock’'s autospec to not fail on
     method-bound builtin functions.  Patch by Aaron Gallagher.

   - bpo-30961(31): Fix decrementing a borrowed reference in
     tracemalloc.

   - bpo-25684(32): Change ‘ttk.OptionMenu’ radiobuttons to be unique
     across instances of ‘OptionMenu’.

   - bpo-30886(33): Fix multiprocessing.Queue.join_thread(): it now
     waits until the thread completes, even if the thread was started by
     the same process which created the queue.

   - bpo-29854(34): Fix segfault in readline when using readline's
     history-size option.  Patch by Nir Soffer.

   - bpo-30319(35): socket.close() now ignores ECONNRESET error.

   - bpo-30828(36): Fix out of bounds write in
     ‘asyncio.CFuture.remove_done_callback()’.

   - bpo-30807(37): signal.setitimer() may disable the timer when passed
     a tiny value.  Tiny values (such as 1e-6) are valid non-zero values
     for setitimer(), which is specified as taking
     microsecond-resolution intervals.  However, on some platform, our
     conversion routine could convert 1e-6 into a zero interval,
     therefore disabling the timer instead of (re-)scheduling it.

   - bpo-30441(38): Fix bug when modifying os.environ while iterating
     over it

   - bpo-30532(39): Fix email header value parser dropping folding white
     space in certain cases.

   - bpo-30879(40): os.listdir() and os.scandir() now emit bytes names
     when called with bytes-like argument.

   - bpo-30746(41): Prohibited the '=' character in environment variable
     names in ‘os.putenv()’ and ‘os.spawn*()’.

   - bpo-29755(42): Fixed the lgettext() family of functions in the
     gettext module.  They now always return bytes.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31499

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31544

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31234

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31457

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31400

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28958

   (9) https://bugs.python.org/issue?@action=redirect&bpo=27340

   (10) https://bugs.python.org/issue?@action=redirect&bpo=31178

   (11) https://bugs.python.org/issue?@action=redirect&bpo=31350

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31170

   (13) https://bugs.python.org/issue?@action=redirect&bpo=29136

   (14) https://bugs.python.org/issue?@action=redirect&bpo=29212

   (15) https://bugs.python.org/issue?@action=redirect&bpo=9146

   (16) https://bugs.python.org/issue?@action=redirect&bpo=27144

   (17) https://bugs.python.org/issue?@action=redirect&bpo=10746

   (18) https://peps.python.org/pep-3118/

   (19) https://bugs.python.org/issue?@action=redirect&bpo=22536

   (20) https://bugs.python.org/issue?@action=redirect&bpo=31249

   (21) https://bugs.python.org/issue?@action=redirect&bpo=31247

   (22) https://bugs.python.org/issue?@action=redirect&bpo=30102

   (23) https://bugs.python.org/issue?@action=redirect&bpo=31185

   (24) https://bugs.python.org/issue?@action=redirect&bpo=31135

   (25) https://bugs.python.org/issue?@action=redirect&bpo=31107

   (26) https://bugs.python.org/issue?@action=redirect&bpo=31061

   (27) https://bugs.python.org/issue?@action=redirect&bpo=30502

   (28) https://bugs.python.org/issue?@action=redirect&bpo=30119

   (29) https://bugs.python.org/issue?@action=redirect&bpo=30595

   (30) https://bugs.python.org/issue?@action=redirect&bpo=29403

   (31) https://bugs.python.org/issue?@action=redirect&bpo=30961

   (32) https://bugs.python.org/issue?@action=redirect&bpo=25684

   (33) https://bugs.python.org/issue?@action=redirect&bpo=30886

   (34) https://bugs.python.org/issue?@action=redirect&bpo=29854

   (35) https://bugs.python.org/issue?@action=redirect&bpo=30319

   (36) https://bugs.python.org/issue?@action=redirect&bpo=30828

   (37) https://bugs.python.org/issue?@action=redirect&bpo=30807

   (38) https://bugs.python.org/issue?@action=redirect&bpo=30441

   (39) https://bugs.python.org/issue?@action=redirect&bpo=30532

   (40) https://bugs.python.org/issue?@action=redirect&bpo=30879

   (41) https://bugs.python.org/issue?@action=redirect&bpo=30746

   (42) https://bugs.python.org/issue?@action=redirect&bpo=29755


File: python.info,  Node: ドキュメント<70>,  Next: テスト<67>,  Prev: ライブラリ<178>,  Up: Python 3 6 3 release candidate 1

1.24.81.4 ドキュメント
......................

   - bpo-31294(1): Fix incomplete code snippet in the
     ZeroMQSocketListener and ZeroMQSocketHandler examples and adapt
     them to Python 3.

   - bpo-21649(2): Add RFC 7525 and Mozilla server side TLS links to SSL
     documentation.

   - bpo-30803(3): Clarify doc on truth value testing.  Original patch
     by Peter Thomassen.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31294

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21649

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30803


File: python.info,  Node: テスト<67>,  Next: ビルド<76>,  Prev: ドキュメント<70>,  Up: Python 3 6 3 release candidate 1

1.24.81.5 テスト
................

   - bpo-31320(1): Silence traceback in test_ssl

   - bpo-25674(2): Remove sha256.tbs-internet.com ssl test

   - bpo-30715(3): Address ALPN callback changes for OpenSSL 1.1.0f.
     The latest version behaves like OpenSSL 1.0.2 and no longer aborts
     handshake.

   - bpo-30822(4): regrtest: Exclude tzdata from regrtest -all.  When
     running the test suite using -use=all / -u all, exclude tzdata
     since it makes test_datetime too slow (15-20 min on some buildbots)
     which then times out on some buildbots.  Fix also regrtest command
     line parser to allow passing -u extralargefile to run
     test_zipfile64.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31320

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25674

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30715

   (4) https://bugs.python.org/issue?@action=redirect&bpo=30822


File: python.info,  Node: ビルド<76>,  Next: Windows<67>,  Prev: テスト<67>,  Up: Python 3 6 3 release candidate 1

1.24.81.6 ビルド
................

   - bpo-30854(1): Fix compile error when compiling -without-threads.
     Patch by Masayuki Yamamoto.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30854


File: python.info,  Node: Windows<67>,  Next: IDLE<49>,  Prev: ビルド<76>,  Up: Python 3 6 3 release candidate 1

1.24.81.7 Windows
.................

   - bpo-30389(1): Adds detection of Visual Studio 2017 to distutils on
     Windows.

   - bpo-31340(2): Change to building with MSVC v141 (included with
     Visual Studio 2017)

   - bpo-30581(3): os.cpu_count() now returns the correct number of
     processors on Windows when the number of logical processors is
     greater than 64.

   - bpo-30731(4): Add a missing xmlns to python.manifest so that it
     matches the schema.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30389

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31340

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30581

   (4) https://bugs.python.org/issue?@action=redirect&bpo=30731


File: python.info,  Node: IDLE<49>,  Next: Tools/Demos<47>,  Prev: Windows<67>,  Up: Python 3 6 3 release candidate 1

1.24.81.8 IDLE
..............

   - bpo-31493(1): IDLE code context - fix code update and font update
     timers.  Canceling timers prevents a warning message when test_idle
     completes.

   - bpo-31488(2): IDLE - Update non-key options in former extension
     classes.  When applying configdialog changes, call .reload for each
     feature class.  Change ParenMatch so updated options affect
     existing instances attached to existing editor windows.

   - bpo-31477(3): IDLE - Improve rstrip entry in doc.  Strip trailing
     whitespace strips more than blank spaces.  Multiline string
     literals are not skipped.

   - bpo-31480(4): IDLE - make tests pass with zzdummy extension
     disabled by default.

   - bpo-31421(5): Document how IDLE runs tkinter programs.  IDLE calls
     tcl/tk update in the background in order to make live interaction
     and experimentation with tkinter applications much easier.

   - bpo-31414(6): IDLE - fix tk entry box tests by deleting first.
     Adding to an int entry is not the same as deleting and inserting
     because int('') will fail.

   - bpo-31051(7): Rearrange IDLE configdialog GenPage into Window,
     Editor, and Help sections.

   - bpo-30617(8): IDLE - Add docstrings and tests for outwin subclass
     of editor.  Move some data and functions from the class to module
     level.  Patch by Cheryl Sabella.

   - bpo-31287(9): IDLE - Do not modify tkinter.message in
     test_configdialog.

   - bpo-27099(10): Convert IDLE's built-in 'extensions' to regular
     features.  About 10 IDLE features were implemented as supposedly
     optional extensions.  Their different behavior could be confusing
     or worse for users and not good for maintenance.  Hence the
     conversion.  The main difference for users is that user
     configurable key bindings for builtin features are now handled
     uniformly.  Now, editing a binding in a keyset only affects its
     value in the keyset.  All bindings are defined together in the
     system-specific default keysets in config-extensions.def.  All
     custom keysets are saved as a whole in config-extension.cfg.  All
     take effect as soon as one clicks Apply or Ok.  The affected events
     are '<<force-open-completions>>', '<<expand-word>>',
     '<<force-open-calltip>>', '<<flash-paren>>',
     '<<format-paragraph>>', '<<run-module>>', '<<check-module>>', and
     '<<zoom-height>>'.  Any (global) customizations made before 3.6.3
     will not affect their keyset-specific customization after 3.6.3.
     and vice versa.  Initial patch by Charles Wohlganger.

   - bpo-31206(11): IDLE: Factor HighPage(Frame) class from
     ConfigDialog.  Patch by Cheryl Sabella.

   - bpo-31001(12): Add tests for configdialog highlight tab.  Patch by
     Cheryl Sabella.

   - bpo-31205(13): IDLE: Factor KeysPage(Frame) class from
     ConfigDialog.  The slightly modified tests continue to pass.  Patch
     by Cheryl Sabella.

   - bpo-31130(14): IDLE - stop leaks in test_configdialog.  Initial
     patch by Victor Stinner.

   - bpo-31002(15): Add tests for configdialog keys tab.  Patch by
     Cheryl Sabella.

   - bpo-19903(16): IDLE: Calltips use ‘inspect.signature’ instead of
     ‘inspect.getfullargspec’.  This improves calltips for builtins
     converted to use Argument Clinic.  Patch by Louie Lu.

   - bpo-31083(17): IDLE - Add an outline of a TabPage class in
     configdialog.  Update existing classes to match outline.  Initial
     patch by Cheryl Sabella.

   - bpo-31050(18): Factor GenPage(Frame) class from ConfigDialog.  The
     slightly modified tests continue to pass.  Patch by Cheryl Sabella.

   - bpo-31004(19): IDLE - Factor FontPage(Frame) class from
     ConfigDialog.  Slightly modified tests continue to pass.  Fix
     General tests.  Patch mostly by Cheryl Sabella.

   - bpo-30781(20): IDLE - Use ttk widgets in ConfigDialog.  Patches by
     Terry Jan Reedy and Cheryl Sabella.

   - bpo-31060(21): IDLE - Finish rearranging methods of ConfigDialog
     Grouping methods pertaining to each tab and the buttons will aid
     writing tests and improving the tabs and will enable splitting the
     groups into classes.

   - bpo-30853(22): IDLE - Factor a VarTrace class out of ConfigDialog.
     Instance tracers manages pairs consisting of a tk variable and a
     callback function.  When tracing is turned on, setting the variable
     calls the function.  Test coverage for the new class is 100%.

   - bpo-31003(23): IDLE: Add more tests for General tab.

   - bpo-30993(24): IDLE - Improve configdialog font page and tests.  In
     configdialog: Document causal pathways in create_font_tab
     docstring.  Simplify some attribute names.  Move set_samples calls
     to var_changed_font (idea from Cheryl Sabella).  Move related
     functions to positions after the create widgets function.  In
     test_configdialog: Fix test_font_set so not order dependent.  Fix
     renamed test_indent_scale so it tests the widget.  Adjust tests for
     movement of set_samples call.  Add tests for load functions.  Put
     all font tests in one class and tab indent tests in another.
     Except for two lines, these tests completely cover the related
     functions.

   - bpo-30981(25): IDLE - Add more configdialog font page tests.

   - bpo-28523(26): IDLE: replace 'colour' with 'color' in configdialog.

   - bpo-30917(27): Add tests for idlelib.config.IdleConf.  Increase
     coverage from 46% to 96%.  Patch by Louie Lu.

   - bpo-30934(28): Document coverage details for idlelib tests.  Add
     section to idlelib/idle-test/README.txt.  Include check that
     branches are taken both ways.  Exclude IDLE-specific code that does
     not run during unit tests.

   - bpo-30913(29): IDLE: Document ConfigDialog tk Vars, methods, and
     widgets in docstrings This will facilitate improving the dialog and
     splitting up the class.  Original patch by Cheryl Sabella.

   - bpo-30899(30): IDLE: Add tests for ConfigParser subclasses in
     config.  Patch by Louie Lu.

   - bpo-30881(31): IDLE: Add docstrings to browser.py.  Patch by Cheryl
     Sabella.

   - bpo-30851(32): IDLE: Remove unused variables in configdialog.  One
     is a duplicate, one is set but cannot be altered by users.  Patch
     by Cheryl Sabella.

   - bpo-30870(33): IDLE: In Settings dialog, select font with Up, Down
     keys as well as mouse.  Initial patch by Louie Lu.

   - bpo-8231(34): IDLE: call config.IdleConf.GetUserCfgDir only once.

   - bpo-30779(35): IDLE: Factor ConfigChanges class from configdialog,
     put in config; test.  * In config, put dump test code in a
     function; run it and unittest in 'if __name__ == '__main__'.  * Add
     class config.ConfigChanges based on changes_class_v4.py on bpo
     issue.  * Add class test_config.ChangesTest, partly using
     configdialog_tests_v1.py.  * Revise configdialog to use
     ConfigChanges; see tracker msg297804.  * Revise test_configdialog
     to match configdialog changes.  * Remove configdialog functions
     unused or moved to ConfigChanges.  Cheryl Sabella contributed parts
     of the patch.

   - bpo-30777(36): IDLE: configdialog - Add docstrings and fix
     comments.  Patch by Cheryl Sabella.

   - bpo-30495(37): IDLE: Improve textview with docstrings, PEP8 names,
     and more tests.  Patch by Cheryl Sabella.

   - bpo-30723(38): IDLE: Make several improvements to parenmatch.  Add
     'parens' style to highlight both opener and closer.  Make 'default'
     style, which is not default, a synonym for 'opener'.  Make
     time-delay work the same with all styles.  Add help for config
     dialog extensions tab, including help for parenmatch.  Add new
     tests.  Original patch by Charles Wohlganger.

   - bpo-30674(39): IDLE: add docstrings to grep module.  Patch by
     Cheryl Sabella

   - bpo-21519(40): IDLE's basic custom key entry dialog now detects
     duplicates properly.  Original patch by Saimadhav Heblikar.

   - bpo-29910(41): IDLE no longer deletes a character after commenting
     out a region by a key shortcut.  Add ‘return 'break'’ for this and
     other potential conflicts between IDLE and default key bindings.

   - bpo-30728(42): Review and change idlelib.configdialog names.
     Lowercase method and attribute names.  Replace 'colour' with
     'color', expand overly cryptic names, delete unneeded underscores.
     Replace ‘import *’ with specific imports.  Patches by Cheryl
     Sabella.

   - bpo-6739(43): IDLE: Verify user-entered key sequences by trying to
     bind them with tk.  Add tests for all 3 validation functions.
     Original patch by G Polo.  Tests added by Cheryl Sabella.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31493

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31488

   (3) https://bugs.python.org/issue?@action=redirect&bpo=31477

   (4) https://bugs.python.org/issue?@action=redirect&bpo=31480

   (5) https://bugs.python.org/issue?@action=redirect&bpo=31421

   (6) https://bugs.python.org/issue?@action=redirect&bpo=31414

   (7) https://bugs.python.org/issue?@action=redirect&bpo=31051

   (8) https://bugs.python.org/issue?@action=redirect&bpo=30617

   (9) https://bugs.python.org/issue?@action=redirect&bpo=31287

   (10) https://bugs.python.org/issue?@action=redirect&bpo=27099

   (11) https://bugs.python.org/issue?@action=redirect&bpo=31206

   (12) https://bugs.python.org/issue?@action=redirect&bpo=31001

   (13) https://bugs.python.org/issue?@action=redirect&bpo=31205

   (14) https://bugs.python.org/issue?@action=redirect&bpo=31130

   (15) https://bugs.python.org/issue?@action=redirect&bpo=31002

   (16) https://bugs.python.org/issue?@action=redirect&bpo=19903

   (17) https://bugs.python.org/issue?@action=redirect&bpo=31083

   (18) https://bugs.python.org/issue?@action=redirect&bpo=31050

   (19) https://bugs.python.org/issue?@action=redirect&bpo=31004

   (20) https://bugs.python.org/issue?@action=redirect&bpo=30781

   (21) https://bugs.python.org/issue?@action=redirect&bpo=31060

   (22) https://bugs.python.org/issue?@action=redirect&bpo=30853

   (23) https://bugs.python.org/issue?@action=redirect&bpo=31003

   (24) https://bugs.python.org/issue?@action=redirect&bpo=30993

   (25) https://bugs.python.org/issue?@action=redirect&bpo=30981

   (26) https://bugs.python.org/issue?@action=redirect&bpo=28523

   (27) https://bugs.python.org/issue?@action=redirect&bpo=30917

   (28) https://bugs.python.org/issue?@action=redirect&bpo=30934

   (29) https://bugs.python.org/issue?@action=redirect&bpo=30913

   (30) https://bugs.python.org/issue?@action=redirect&bpo=30899

   (31) https://bugs.python.org/issue?@action=redirect&bpo=30881

   (32) https://bugs.python.org/issue?@action=redirect&bpo=30851

   (33) https://bugs.python.org/issue?@action=redirect&bpo=30870

   (34) https://bugs.python.org/issue?@action=redirect&bpo=8231

   (35) https://bugs.python.org/issue?@action=redirect&bpo=30779

   (36) https://bugs.python.org/issue?@action=redirect&bpo=30777

   (37) https://bugs.python.org/issue?@action=redirect&bpo=30495

   (38) https://bugs.python.org/issue?@action=redirect&bpo=30723

   (39) https://bugs.python.org/issue?@action=redirect&bpo=30674

   (40) https://bugs.python.org/issue?@action=redirect&bpo=21519

   (41) https://bugs.python.org/issue?@action=redirect&bpo=29910

   (42) https://bugs.python.org/issue?@action=redirect&bpo=30728

   (43) https://bugs.python.org/issue?@action=redirect&bpo=6739


File: python.info,  Node: Tools/Demos<47>,  Prev: IDLE<49>,  Up: Python 3 6 3 release candidate 1

1.24.81.9 Tools/Demos
.....................

   - bpo-30983(1): gdb integration commands (py-bt, etc.)  work on
     optimized shared builds now, too.  PEP 523(2) introduced
     _PyEval_EvalFrameDefault which inlines PyEval_EvalFrameEx on
     non-debug shared builds.  This broke the ability to use py-bt,
     py-up, and a few other Python-specific gdb integrations.  The
     problem is fixed by only looking for _PyEval_EvalFrameDefault
     frames in python-gdb.py.  Original patch by Bruno "Polaco"
     Penteado.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30983

   (2) https://peps.python.org/pep-0523/


File: python.info,  Node: Python 3 6 2 final,  Next: Python 3 6 2 release candidate 2,  Prev: Python 3 6 3 release candidate 1,  Up: 変更履歴

1.24.82 Python 3.6.2 final
--------------------------

'Release date: 2017-07-17'

No changes since release candidate 2


File: python.info,  Node: Python 3 6 2 release candidate 2,  Next: Python 3 6 2 release candidate 1,  Prev: Python 3 6 2 final,  Up: 変更履歴

1.24.83 Python 3.6.2 release candidate 2
----------------------------------------

'Release date: 2017-07-07'

* Menu:

* セキュリティ: セキュリティ<52>.


File: python.info,  Node: セキュリティ<52>,  Up: Python 3 6 2 release candidate 2

1.24.83.1 セキュリティ
......................

   - bpo-30730(1): Prevent environment variables injection in subprocess
     on Windows.  Prevent passing other environment variables and
     command arguments.

   - bpo-30694(2): Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes
     of multiple security vulnerabilities including: CVE 2017-9233(3)
     (External entity infinite loop DoS), CVE 2016-9063(4) (Integer
     overflow, re-fix), CVE 2016-0718(5) (Fix regression bugs from
     2.2.0's fix to CVE 2016-0718(6)) and CVE 2012-0876(7) (Counter hash
     flooding with SipHash).  Note: the CVE 2016-5300(8) (Use
     os-specific entropy sources like getrandom) doesn't impact Python,
     since Python already gets entropy from the OS to set the expat
     secret using ‘XML_SetHashSalt()’.

   - bpo-30500(9): Fix urllib.parse.splithost() to correctly parse
     fragments.  For example, ‘splithost('//127.0.0.1#@evil.com/')’ now
     correctly returns the ‘127.0.0.1’ host, instead of treating
     ‘@evil.com’ as the host in an authentication (‘login@host’).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30730

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30694

   (3) https://www.cve.org/CVERecord?id=CVE-2017-9233

   (4) https://www.cve.org/CVERecord?id=CVE-2016-9063

   (5) https://www.cve.org/CVERecord?id=CVE-2016-0718

   (6) https://www.cve.org/CVERecord?id=CVE-2016-0718

   (7) https://www.cve.org/CVERecord?id=CVE-2012-0876

   (8) https://www.cve.org/CVERecord?id=CVE-2016-5300

   (9) https://bugs.python.org/issue?@action=redirect&bpo=30500


File: python.info,  Node: Python 3 6 2 release candidate 1,  Next: Python 3 6 1 final,  Prev: Python 3 6 2 release candidate 2,  Up: 変更履歴

1.24.84 Python 3.6.2 release candidate 1
----------------------------------------

'Release date: 2017-06-17'

* Menu:

* セキュリティ: セキュリティ<53>.
* Core and Builtins: Core and Builtins<174>.
* ライブラリ: ライブラリ<179>.
* IDLE: IDLE<50>.
* C API: C API<67>.
* ビルド: ビルド<77>.
* ドキュメント: ドキュメント<71>.
* Tools/Demos: Tools/Demos<48>.
* テスト: テスト<68>.
* Windows: Windows<68>.


File: python.info,  Node: セキュリティ<53>,  Next: Core and Builtins<174>,  Up: Python 3 6 2 release candidate 1

1.24.84.1 セキュリティ
......................

   - bpo-29591(1): Update expat copy from 2.1.1 to 2.2.0 to get fixes of
     CVE 2016-0718(2) and CVE 2016-4472(3).  See
     ‘https://sourceforge.net/p/expat/bugs/537/’ for more information.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29591

   (2) https://www.cve.org/CVERecord?id=CVE-2016-0718

   (3) https://www.cve.org/CVERecord?id=CVE-2016-4472


File: python.info,  Node: Core and Builtins<174>,  Next: ライブラリ<179>,  Prev: セキュリティ<53>,  Up: Python 3 6 2 release candidate 1

1.24.84.2 Core and Builtins
...........................

   - bpo-30682(1): Removed a too-strict assertion that failed for
     certain f-strings, such as eval("f'\n'") and eval("f'\r'").

   - bpo-30604(2): Move co_extra_freefuncs to not be per-thread to avoid
     crashes

   - bpo-29104(3): Fixed parsing backslashes in f-strings.

   - bpo-27945(4): Fixed various segfaults with dict when input
     collections are mutated during searching, inserting or comparing.
     Based on patches by Duane Griffin and Tim Mitchell.

   - bpo-25794(5): Fixed type.__setattr__() and type.__delattr__() for
     non-interned attribute names.  Based on patch by Eryk Sun.

   - bpo-30039(6): If a KeyboardInterrupt happens when the interpreter
     is in the middle of resuming a chain of nested 'yield from' or
     'await' calls, it's now correctly delivered to the innermost frame.

   - bpo-12414(7): sys.getsizeof() on a code object now returns the
     sizes which includes the code struct and sizes of objects which it
     references.  Patch by Donghee Na.

   - bpo-29949(8): Fix memory usage regression of set and frozenset
     object.

   - bpo-29935(9): Fixed error messages in the index() method of tuple,
     list and deque when pass indices of wrong type.

   - bpo-29859(10): Show correct error messages when any of the
     pthread_* calls in thread_pthread.h fails.

   - bpo-28876(11): ‘bool(range)’ works even if ‘len(range)’ raises
     *note OverflowError: a81.

   - bpo-29600(12): Fix wrapping coroutine return values in
     StopIteration.

   - bpo-28856(13): Fix an oversight that %b format for bytes should
     support objects follow the buffer protocol.

   - bpo-29714(14): Fix a regression that bytes format may fail when
     containing zero bytes inside.

   - bpo-29478(15): If max_line_length=None is specified while using the
     Compat32 policy, it is no longer ignored.  Patch by Mircea Cosbuc.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30682

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30604

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29104

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27945

   (5) https://bugs.python.org/issue?@action=redirect&bpo=25794

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30039

   (7) https://bugs.python.org/issue?@action=redirect&bpo=12414

   (8) https://bugs.python.org/issue?@action=redirect&bpo=29949

   (9) https://bugs.python.org/issue?@action=redirect&bpo=29935

   (10) https://bugs.python.org/issue?@action=redirect&bpo=29859

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28876

   (12) https://bugs.python.org/issue?@action=redirect&bpo=29600

   (13) https://bugs.python.org/issue?@action=redirect&bpo=28856

   (14) https://bugs.python.org/issue?@action=redirect&bpo=29714

   (15) https://bugs.python.org/issue?@action=redirect&bpo=29478


File: python.info,  Node: ライブラリ<179>,  Next: IDLE<50>,  Prev: Core and Builtins<174>,  Up: Python 3 6 2 release candidate 1

1.24.84.3 ライブラリ
....................

   - bpo-30616(1): Functional API of enum allows to create empty enums.
     Patched by Donghee Na

   - bpo-30038(2): Fix race condition between signal delivery and wakeup
     file descriptor.  Patch by Nathaniel Smith.

   - bpo-23894(3): lib2to3 now recognizes ‘rb'...'’ and ‘f'...'’
     strings.

   - bpo-23890(4): unittest.TestCase.assertRaises() now manually breaks
     a reference cycle to not keep objects alive longer than expected.

   - bpo-30149(5): inspect.signature() now supports callables with
     variable-argument parameters wrapped with partialmethod.  Patch by
     Donghee Na.

   - bpo-30645(6): Fix path calculation in imp.load_package(), fixing it
     for cases when a package is only shipped with bytecodes.  Patch by
     Alexandru Ardelean.

   - bpo-29931(7): Fixed comparison check for ipaddress.ip_interface
     objects.  Patch by Sanjay Sundaresan.

   - bpo-30605(8): re.compile() no longer raises a BytesWarning when
     compiling a bytes instance with misplaced inline modifier.  Patch
     by Roy Williams.

   - bpo-24484(9): Avoid race condition in multiprocessing cleanup
     (#2159)

   - bpo-28994(10): The traceback no longer displayed for SystemExit
     raised in a callback registered by atexit.

   - bpo-30508(11): Don't log exceptions if Task/Future "cancel()"
     method was called.

   - bpo-28556(12): Updates to typing module: Add generic
     AsyncContextManager, add support for ContextManager on all
     versions.  Original PRs by Jelle Zijlstra and Ivan Levkivskyi

   - bpo-29870(13): Fix ssl sockets leaks when connection is aborted in
     asyncio/ssl implementation.  Patch by Michaël Sghaïer.

   - bpo-29743(14): Closing transport during handshake process leaks
     open socket.  Patch by Nikolay Kim

   - bpo-27585(15): Fix waiter cancellation in asyncio.Lock.  Patch by
     Mathieu Sornay.

   - bpo-30418(16): On Windows, subprocess.Popen.communicate() now also
     ignore EINVAL on stdin.write() if the child process is still
     running but closed the pipe.

   - bpo-29822(17): inspect.isabstract() now works during
     __init_subclass__.  Patch by Nate Soares.

   - bpo-29581(18): ABCMeta.__new__ now accepts ‘**kwargs’, allowing
     abstract base classes to use keyword parameters in
     __init_subclass__.  Patch by Nate Soares.

   - bpo-30557(19): faulthandler now correctly filters and displays
     exception codes on Windows

   - bpo-30378(20): Fix the problem that logging.handlers.SysLogHandler
     cannot handle IPv6 addresses.

   - bpo-29960(21): Preserve generator state when
     _random.Random.setstate() raises an exception.  Patch by Bryan
     Olson.

   - bpo-30414(22): multiprocessing.Queue._feed background running
     thread do not break from main loop on exception.

   - bpo-30003(23): Fix handling escape characters in HZ codec.  Based
     on patch by Ma Lin.

   - bpo-30301(24): Fix AttributeError when using SimpleQueue.empty()
     under 'spawn' and 'forkserver' start methods.

   - bpo-30329(25): imaplib and poplib now catch the Windows socket
     WSAEINVAL error (code 10022) on shutdown(SHUT_RDWR): An invalid
     operation was attempted.  This error occurs sometimes on SSL
     connections.

   - bpo-30375(26): Warnings emitted when compile a regular expression
     now always point to the line in the user code.  Previously they
     could point into inners of the re module if emitted from inside of
     groups or conditionals.

   - bpo-30048(27): Fixed ‘Task.cancel()’ can be ignored when the task
     is running coroutine and the coroutine returned without any more
     ‘await’.

   - bpo-30266(28): contextlib.AbstractContextManager now supports
     anti-registration by setting __enter__ = None or __exit__ = None,
     following the pattern introduced in bpo-25958(29).  Patch by Jelle
     Zijlstra.

   - bpo-30298(30): Weaken the condition of deprecation warnings for
     inline modifiers.  Now allowed several subsequential inline
     modifiers at the start of the pattern (e.g.  ‘'(?i)(?s)...'’).  In
     verbose mode whitespaces and comments now are allowed before and
     between inline modifiers (e.g.  ‘'(?x) (?i) (?s)...'’).

   - bpo-29990(31): Fix range checking in GB18030 decoder.  Original
     patch by Ma Lin.

   - bpo-26293(32): Change resulted because of zipfile breakage.  (See
     also: bpo-29094(33))

   - bpo-30243(34): Removed the __init__ methods of _json's scanner and
     encoder.  Misusing them could cause memory leaks or crashes.  Now
     scanner and encoder objects are completely initialized in the
     __new__ methods.

   - bpo-30185(35): Avoid KeyboardInterrupt tracebacks in forkserver
     helper process when Ctrl-C is received.

   - bpo-28556(36): Various updates to typing module: add
     typing.NoReturn type, use WrapperDescriptorType, minor bug-fixes.
     Original PRs by Jim Fasarakis-Hilliard and Ivan Levkivskyi.

   - bpo-30205(37): Fix getsockname() for unbound AF_UNIX sockets on
     Linux.

   - bpo-30070(38): Fixed leaks and crashes in errors handling in the
     parser module.

   - bpo-30061(39): Fixed crashes in IOBase methods __next__() and
     readlines() when readline() or __next__() respectively return
     non-sizeable object.  Fixed possible other errors caused by not
     checking results of PyObject_Size(), PySequence_Size(), or
     PyMapping_Size().

   - bpo-30017(40): Allowed calling the close() method of the zip entry
     writer object multiple times.  Writing to a closed writer now
     always produces a ValueError.

   - bpo-30068(41): _io._IOBase.readlines will check if it's closed
     first when hint is present.

   - bpo-29694(42): Fixed race condition in pathlib mkdir with flags
     parents=True.  Patch by Armin Rigo.

   - bpo-29692(43): Fixed arbitrary unchaining of RuntimeError
     exceptions in contextlib.contextmanager.  Patch by Siddharth
     Velankar.

   - bpo-29998(44): Pickling and copying ImportError now preserves name
     and path attributes.

   - bpo-29953(45): Fixed memory leaks in the replace() method of
     datetime and time objects when pass out of bound fold argument.

   - bpo-29942(46): Fix a crash in itertools.chain.from_iterable when
     encountering long runs of empty iterables.

   - bpo-27863(47): Fixed multiple crashes in ElementTree caused by race
     conditions and wrong types.

   - bpo-28699(48): Fixed a bug in pools in multiprocessing.pool that
     raising an exception at the very first of an iterable may swallow
     the exception or make the program hang.  Patch by Davin Potts and
     Xiang Zhang.

   - bpo-25803(49): Avoid incorrect errors raised by
     Path.mkdir(exist_ok=True) when the OS gives priority to errors such
     as EACCES over EEXIST.

   - bpo-29861(50): Release references to tasks, their arguments and
     their results as soon as they are finished in multiprocessing.Pool.

   - bpo-29884(51): faulthandler: Restore the old sigaltstack during
     teardown.  Patch by Christophe Zeitouny.

   - bpo-25455(52): Fixed crashes in repr of recursive buffered
     file-like objects.

   - bpo-29800(53): Fix crashes in partial.__repr__ if the keys of
     partial.keywords are not strings.  Patch by Michael Seifert.

   - bpo-29742(54): get_extra_info() raises exception if get called on
     closed ssl transport.  Patch by Nikolay Kim.

   - bpo-8256(55): Fixed possible failing or crashing input() if
     attributes "encoding" or "errors" of sys.stdin or sys.stdout are
     not set or are not strings.

   - bpo-28298(56): Fix a bug that prevented array 'Q', 'L' and 'I' from
     accepting big intables (objects that have __int__) as elements.
     Patch by Oren Milman.

   - bpo-28231(57): The zipfile module now accepts path-like objects for
     external paths.

   - bpo-26915(58): index() and count() methods of
     collections.abc.Sequence now check identity before checking
     equality when do comparisons.

   - bpo-29615(59): SimpleXMLRPCDispatcher no longer chains KeyError (or
     any other exception) to exception(s) raised in the dispatched
     methods.  Patch by Petr Motejlek.

   - bpo-30177(60): path.resolve(strict=False) no longer cuts the path
     after the first element not present in the filesystem.  Patch by
     Antoine Pietri.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30616

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30038

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23894

   (4) https://bugs.python.org/issue?@action=redirect&bpo=23890

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30149

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30645

   (7) https://bugs.python.org/issue?@action=redirect&bpo=29931

   (8) https://bugs.python.org/issue?@action=redirect&bpo=30605

   (9) https://bugs.python.org/issue?@action=redirect&bpo=24484

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28994

   (11) https://bugs.python.org/issue?@action=redirect&bpo=30508

   (12) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (13) https://bugs.python.org/issue?@action=redirect&bpo=29870

   (14) https://bugs.python.org/issue?@action=redirect&bpo=29743

   (15) https://bugs.python.org/issue?@action=redirect&bpo=27585

   (16) https://bugs.python.org/issue?@action=redirect&bpo=30418

   (17) https://bugs.python.org/issue?@action=redirect&bpo=29822

   (18) https://bugs.python.org/issue?@action=redirect&bpo=29581

   (19) https://bugs.python.org/issue?@action=redirect&bpo=30557

   (20) https://bugs.python.org/issue?@action=redirect&bpo=30378

   (21) https://bugs.python.org/issue?@action=redirect&bpo=29960

   (22) https://bugs.python.org/issue?@action=redirect&bpo=30414

   (23) https://bugs.python.org/issue?@action=redirect&bpo=30003

   (24) https://bugs.python.org/issue?@action=redirect&bpo=30301

   (25) https://bugs.python.org/issue?@action=redirect&bpo=30329

   (26) https://bugs.python.org/issue?@action=redirect&bpo=30375

   (27) https://bugs.python.org/issue?@action=redirect&bpo=30048

   (28) https://bugs.python.org/issue?@action=redirect&bpo=30266

   (29) https://bugs.python.org/issue?@action=redirect&bpo=25958

   (30) https://bugs.python.org/issue?@action=redirect&bpo=30298

   (31) https://bugs.python.org/issue?@action=redirect&bpo=29990

   (32) https://bugs.python.org/issue?@action=redirect&bpo=26293

   (33) https://bugs.python.org/issue?@action=redirect&bpo=29094

   (34) https://bugs.python.org/issue?@action=redirect&bpo=30243

   (35) https://bugs.python.org/issue?@action=redirect&bpo=30185

   (36) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (37) https://bugs.python.org/issue?@action=redirect&bpo=30205

   (38) https://bugs.python.org/issue?@action=redirect&bpo=30070

   (39) https://bugs.python.org/issue?@action=redirect&bpo=30061

   (40) https://bugs.python.org/issue?@action=redirect&bpo=30017

   (41) https://bugs.python.org/issue?@action=redirect&bpo=30068

   (42) https://bugs.python.org/issue?@action=redirect&bpo=29694

   (43) https://bugs.python.org/issue?@action=redirect&bpo=29692

   (44) https://bugs.python.org/issue?@action=redirect&bpo=29998

   (45) https://bugs.python.org/issue?@action=redirect&bpo=29953

   (46) https://bugs.python.org/issue?@action=redirect&bpo=29942

   (47) https://bugs.python.org/issue?@action=redirect&bpo=27863

   (48) https://bugs.python.org/issue?@action=redirect&bpo=28699

   (49) https://bugs.python.org/issue?@action=redirect&bpo=25803

   (50) https://bugs.python.org/issue?@action=redirect&bpo=29861

   (51) https://bugs.python.org/issue?@action=redirect&bpo=29884

   (52) https://bugs.python.org/issue?@action=redirect&bpo=25455

   (53) https://bugs.python.org/issue?@action=redirect&bpo=29800

   (54) https://bugs.python.org/issue?@action=redirect&bpo=29742

   (55) https://bugs.python.org/issue?@action=redirect&bpo=8256

   (56) https://bugs.python.org/issue?@action=redirect&bpo=28298

   (57) https://bugs.python.org/issue?@action=redirect&bpo=28231

   (58) https://bugs.python.org/issue?@action=redirect&bpo=26915

   (59) https://bugs.python.org/issue?@action=redirect&bpo=29615

   (60) https://bugs.python.org/issue?@action=redirect&bpo=30177


File: python.info,  Node: IDLE<50>,  Next: C API<67>,  Prev: ライブラリ<179>,  Up: Python 3 6 2 release candidate 1

1.24.84.4 IDLE
..............

   - bpo-15786(1): Fix several problems with IDLE's autocompletion box.
     The following should now work: clicking on selection box items;
     using the scrollbar; selecting an item by hitting Return.  Hangs on
     MacOSX should no longer happen.  Patch by Louie Lu.

   - bpo-25514(2): Add doc subsubsection about IDLE failure to start.
     Popup no-connection message directs users to this section.

   - bpo-30642(3): Fix reference leaks in IDLE tests.  Patches by Louie
     Lu and Terry Jan Reedy.

   - bpo-30495(4): Add docstrings for textview.py and use PEP8 names.
     Patches by Cheryl Sabella and Terry Jan Reedy.

   - bpo-30290(5): Help-about: use pep8 names and add tests.  Increase
     coverage to 100%.  Patches by Louie Lu, Cheryl Sabella, and Terry
     Jan Reedy.

   - bpo-30303(6): Add _utest option to textview; add new tests.
     Increase coverage to 100%.  Patches by Louie Lu and Terry Jan
     Reedy.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15786

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25514

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30642

   (4) https://bugs.python.org/issue?@action=redirect&bpo=30495

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30290

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30303


File: python.info,  Node: C API<67>,  Next: ビルド<77>,  Prev: IDLE<50>,  Up: Python 3 6 2 release candidate 1

1.24.84.5 C API
...............

   - bpo-27867(1): Function PySlice_GetIndicesEx() no longer replaced
     with a macro if Py_LIMITED_API is not set.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27867


File: python.info,  Node: ビルド<77>,  Next: ドキュメント<71>,  Prev: C API<67>,  Up: Python 3 6 2 release candidate 1

1.24.84.6 ビルド
................

   - bpo-29941(1): Add ‘--with-assertions’ configure flag to explicitly
     enable C ‘assert()’ checks.  Defaults to off.  ‘--with-pydebug’
     implies ‘--with-assertions’.

   - bpo-28787(2): Fix out-of-tree builds of Python when configured with
     ‘--with--dtrace’.

   - bpo-29243(3): Prevent unnecessary rebuilding of Python during ‘make
     test’, ‘make install’ and some other make targets when configured
     with ‘--enable-optimizations’.

   - bpo-23404(4): Don't regenerate generated files based on file
     modification time anymore: the action is now explicit.  Replace
     ‘make touch’ with ‘make regen-all’.

   - bpo-29643(5): Fix ‘--enable-optimization’ didn't work.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29941

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28787

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29243

   (4) https://bugs.python.org/issue?@action=redirect&bpo=23404

   (5) https://bugs.python.org/issue?@action=redirect&bpo=29643


File: python.info,  Node: ドキュメント<71>,  Next: Tools/Demos<48>,  Prev: ビルド<77>,  Up: Python 3 6 2 release candidate 1

1.24.84.7 ドキュメント
......................

   - bpo-30176(1): Add missing attribute related constants in curses
     documentation.

   - bpo-30052(2): the link targets for *note bytes(): 192. and *note
     bytearray(): 344. are now their respective type definitions, rather
     than the corresponding builtin function entries.  Use *note bytes:
     1e9a. and *note bytearray: 1e9b. to reference the latter.  In order
     to ensure this and future cross-reference updates are applied
     automatically, the daily documentation builds now disable the
     default output caching features in Sphinx.

   - bpo-26985(3): Add missing info of code object in inspect
     documentation.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30176

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30052

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26985


File: python.info,  Node: Tools/Demos<48>,  Next: テスト<68>,  Prev: ドキュメント<71>,  Up: Python 3 6 2 release candidate 1

1.24.84.8 Tools/Demos
.....................

   - bpo-29367(1): python-gdb.py now supports also ‘method-wrapper’
     (‘wrapperobject’) objects.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29367


File: python.info,  Node: テスト<68>,  Next: Windows<68>,  Prev: Tools/Demos<48>,  Up: Python 3 6 2 release candidate 1

1.24.84.9 テスト
................

   - bpo-30357(1): test_thread: setUp() now uses
     support.threading_setup() and support.threading_cleanup() to wait
     until threads complete to avoid random side effects on following
     tests.  Initial patch written by Grzegorz Grzywacz.

   - bpo-30197(2): Enhanced functions swap_attr() and swap_item() in the
     test.support module.  They now work when delete replaced attribute
     or item inside the with statement.  The old value of the attribute
     or item (or None if it doesn't exist) now will be assigned to the
     target of the "as" clause, if there is one.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30357

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30197


File: python.info,  Node: Windows<68>,  Prev: テスト<68>,  Up: Python 3 6 2 release candidate 1

1.24.84.10 Windows
..................

   - bpo-30687(1): Locate msbuild.exe on Windows when building rather
     than vcvarsall.bat

   - bpo-30450(2): The build process on Windows no longer depends on
     Subversion, instead pulling external code from GitHub via a Python
     script.  If Python 3.6 is not found on the system (via ‘py -3.6’),
     NuGet is used to download a copy of 32-bit Python.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30687

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30450


File: python.info,  Node: Python 3 6 1 final,  Next: Python 3 6 1 release candidate 1,  Prev: Python 3 6 2 release candidate 1,  Up: 変更履歴

1.24.85 Python 3.6.1 final
--------------------------

'Release date: 2017-03-21'

* Menu:

* Core and Builtins: Core and Builtins<175>.
* ビルド: ビルド<78>.


File: python.info,  Node: Core and Builtins<175>,  Next: ビルド<78>,  Up: Python 3 6 1 final

1.24.85.1 Core and Builtins
...........................

   - bpo-29723(1): The ‘sys.path[0]’ initialization change for
     bpo-29139(2) caused a regression by revealing an inconsistency in
     how sys.path is initialized when executing ‘__main__’ from a
     zipfile, directory, or other import location.  The interpreter now
     consistently avoids ever adding the import location's parent
     directory to ‘sys.path’, and ensures no other ‘sys.path’ entries
     are inadvertently modified when inserting the import location named
     on the command line.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29723

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29139


File: python.info,  Node: ビルド<78>,  Prev: Core and Builtins<175>,  Up: Python 3 6 1 final

1.24.85.2 ビルド
................

   - bpo-27593(1): fix format of git information used in sys.version

   - Fix incompatible comment in python.h

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27593


File: python.info,  Node: Python 3 6 1 release candidate 1,  Next: Python 3 6 0 final,  Prev: Python 3 6 1 final,  Up: 変更履歴

1.24.86 Python 3.6.1 release candidate 1
----------------------------------------

'Release date: 2017-03-04'

* Menu:

* Core and Builtins: Core and Builtins<176>.
* ライブラリ: ライブラリ<180>.
* IDLE: IDLE<51>.
* Windows: Windows<69>.
* C API: C API<68>.
* ドキュメント: ドキュメント<72>.
* テスト: テスト<69>.
* ビルド: ビルド<79>.


File: python.info,  Node: Core and Builtins<176>,  Next: ライブラリ<180>,  Up: Python 3 6 1 release candidate 1

1.24.86.1 Core and Builtins
...........................

   - bpo-28893(1): Set correct __cause__ for errors about invalid
     awaitables returned from __aiter__ and __anext__.

   - bpo-29683(2): Fixes to memory allocation in _PyCode_SetExtra.
     Patch by Brian Coleman.

   - bpo-29684(3): Fix minor regression of
     PyEval_CallObjectWithKeywords.  It should raise TypeError when
     kwargs is not a dict.  But it might cause segv when args=NULL and
     kwargs is not a dict.

   - bpo-28598(4): Support __rmod__ for subclasses of str being called
     before str.__mod__.  Patch by Martijn Pieters.

   - bpo-29607(5): Fix stack_effect computation for CALL_FUNCTION_EX.
     Patch by Matthieu Dartiailh.

   - bpo-29602(6): Fix incorrect handling of signed zeros in complex
     constructor for complex subclasses and for inputs having a
     __complex__ method.  Patch by Serhiy Storchaka.

   - bpo-29347(7): Fixed possibly dereferencing undefined pointers when
     creating weakref objects.

   - bpo-29438(8): Fixed use-after-free problem in key sharing dict.

   - bpo-29319(9): Prevent RunMainFromImporter overwriting sys.path[0].

   - bpo-29337(10): Fixed possible BytesWarning when compare the code
     objects.  Warnings could be emitted at compile time.

   - bpo-29327(11): Fixed a crash when pass the iterable keyword
     argument to sorted().

   - bpo-29034(12): Fix memory leak and use-after-free in os module
     (path_converter).

   - bpo-29159(13): Fix regression in bytes(x) when x.__index__() raises
     Exception.

   - bpo-28932(14): Do not include <sys/random.h> if it does not exist.

   - bpo-25677(15): Correct the positioning of the syntax error caret
     for indented blocks.  Based on patch by Michael Layzell.

   - bpo-29000(16): Fixed bytes formatting of octals with zero padding
     in alternate form.

   - bpo-26919(17): On Android, operating system data is now always
     encoded/decoded to/from UTF-8, instead of the locale encoding to
     avoid inconsistencies with os.fsencode() and os.fsdecode() which
     are already using UTF-8.

   - bpo-28991(18): functools.lru_cache() was susceptible to an obscure
     reentrancy bug triggerable by a monkey-patched len() function.

   - bpo-28739(19): f-string expressions are no longer accepted as
     docstrings and by ast.literal_eval() even if they do not include
     expressions.

   - bpo-28512(20): Fixed setting the offset attribute of SyntaxError by
     PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().

   - bpo-28918(21): Fix the cross compilation of xxlimited when Python
     has been built with Py_DEBUG defined.

   - bpo-28731(22): Optimize _PyDict_NewPresized() to create correct
     size dict.  Improve speed of dict literal with constant keys up to
     30%.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28893

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29683

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29684

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28598

   (5) https://bugs.python.org/issue?@action=redirect&bpo=29607

   (6) https://bugs.python.org/issue?@action=redirect&bpo=29602

   (7) https://bugs.python.org/issue?@action=redirect&bpo=29347

   (8) https://bugs.python.org/issue?@action=redirect&bpo=29438

   (9) https://bugs.python.org/issue?@action=redirect&bpo=29319

   (10) https://bugs.python.org/issue?@action=redirect&bpo=29337

   (11) https://bugs.python.org/issue?@action=redirect&bpo=29327

   (12) https://bugs.python.org/issue?@action=redirect&bpo=29034

   (13) https://bugs.python.org/issue?@action=redirect&bpo=29159

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28932

   (15) https://bugs.python.org/issue?@action=redirect&bpo=25677

   (16) https://bugs.python.org/issue?@action=redirect&bpo=29000

   (17) https://bugs.python.org/issue?@action=redirect&bpo=26919

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28991

   (19) https://bugs.python.org/issue?@action=redirect&bpo=28739

   (20) https://bugs.python.org/issue?@action=redirect&bpo=28512

   (21) https://bugs.python.org/issue?@action=redirect&bpo=28918

   (22) https://bugs.python.org/issue?@action=redirect&bpo=28731


File: python.info,  Node: ライブラリ<180>,  Next: IDLE<51>,  Prev: Core and Builtins<176>,  Up: Python 3 6 1 release candidate 1

1.24.86.2 ライブラリ
....................

   - bpo-29169(1): Update zlib to 1.2.11.

   - bpo-29623(2): Allow use of path-like object as a single argument in
     ConfigParser.read().  Patch by David Ellis.

   - bpo-28963(3): Fix out of bound iteration in
     asyncio.Future.remove_done_callback implemented in C.

   - bpo-29704(4): asyncio.subprocess.SubprocessStreamProtocol no longer
     closes before all pipes are closed.

   - bpo-29271(5): Fix Task.current_task and Task.all_tasks implemented
     in C to accept None argument as their pure Python implementation.

   - bpo-29703(6): Fix asyncio to support instantiation of new event
     loops in child processes.

   - bpo-29376(7): Fix assertion error in
     threading._DummyThread.is_alive().

   - bpo-28624(8): Add a test that checks that cwd parameter of Popen()
     accepts PathLike objects.  Patch by Sayan Chowdhury.

   - bpo-28518(9): Start a transaction implicitly before a DML
     statement.  Patch by Aviv Palivoda.

   - bpo-29532(10): Altering a kwarg dictionary passed to
     functools.partial() no longer affects a partial object after
     creation.

   - bpo-29110(11): Fix file object leak in aifc.open() when file is
     given as a filesystem path and is not in valid AIFF format.  Patch
     by Anthony Zhang.

   - bpo-28556(12): Various updates to typing module: typing.Counter,
     typing.ChainMap, improved ABC caching, etc.  Original PRs by Jelle
     Zijlstra, Ivan Levkivskyi, Manuel Krebber, and Łukasz Langa.

   - bpo-29100(13): Fix datetime.fromtimestamp() regression introduced
     in Python 3.6.0: check minimum and maximum years.

   - bpo-29519(14): Fix weakref spewing exceptions during interpreter
     shutdown when used with a rare combination of multiprocessing and
     custom codecs.

   - bpo-29416(15): Prevent infinite loop in pathlib.Path.mkdir

   - bpo-29444(16): Fixed out-of-bounds buffer access in the group()
     method of the match object.  Based on patch by WGH.

   - bpo-29335(17): Fix subprocess.Popen.wait() when the child process
     has exited to a stopped instead of terminated state (ex: when under
     ptrace).

   - bpo-29290(18): Fix a regression in argparse that help messages
     would wrap at non-breaking spaces.

   - bpo-28735(19): Fixed the comparison of mock.MagickMock with
     mock.ANY.

   - bpo-29316(20): Restore the provisional status of typing module, add
     corresponding note to documentation.  Patch by Ivan L.

   - bpo-29219(21): Fixed infinite recursion in the repr of
     uninitialized ctypes.CDLL instances.

   - bpo-29011(22): Fix an important omission by adding Deque to the
     typing module.

   - bpo-28969(23): Fixed race condition in C implementation of
     functools.lru_cache.  KeyError could be raised when cached function
     with full cache was simultaneously called from different threads
     with the same uncached arguments.

   - bpo-29142(24): In urllib.request, suffixes in no_proxy environment
     variable with leading dots could match related hostnames again
     (e.g.  .b.c matches a.b.c).  Patch by Milan Oberkirch.

   - bpo-28961(25): Fix unittest.mock._Call helper: don't ignore the
     name parameter anymore.  Patch written by Jiajun Huang.

   - bpo-29203(26): functools.lru_cache() now respects PEP 468(27) and
     preserves the order of keyword arguments.  f(a=1, b=2) is now
     cached separately from f(b=2, a=1) since both calls could
     potentially give different results.

   - bpo-15812(28): inspect.getframeinfo() now correctly shows the first
     line of a context.  Patch by Sam Breese.

   - bpo-29094(29): Offsets in a ZIP file created with extern file
     object and modes "w" and "x" now are relative to the start of the
     file.

   - bpo-29085(30): Allow random.Random.seed() to use high quality OS
     randomness rather than the pid and time.

   - bpo-29061(31): Fixed bug in secrets.randbelow() which would hang
     when given a negative input.  Patch by Brendan Donegan.

   - bpo-29079(32): Prevent infinite loop in pathlib.resolve() on
     Windows

   - bpo-13051(33): Fixed recursion errors in large or resized
     curses.textpad.Textbox.  Based on patch by Tycho Andersen.

   - bpo-29119(34): Fix weakrefs in the pure python version of
     collections.OrderedDict move_to_end() method.  Contributed by Andra
     Bogildea.

   - bpo-9770(35): curses.ascii predicates now work correctly with
     negative integers.

   - bpo-28427(36): old keys should not remove new values from
     WeakValueDictionary when collecting from another thread.

   - bpo-28923(37): Remove editor artifacts from Tix.py.

   - bpo-29055(38): Neaten-up empty population error on random.choice()
     by suppressing the upstream exception.

   - bpo-28871(39): Fixed a crash when deallocate deep ElementTree.

   - bpo-19542(40): Fix bugs in WeakValueDictionary.setdefault() and
     WeakValueDictionary.pop() when a GC collection happens in another
     thread.

   - bpo-20191(41): Fixed a crash in resource.prlimit() when passing a
     sequence that doesn't own its elements as limits.

   - bpo-28779(42): multiprocessing.set_forkserver_preload() would crash
     the forkserver process if a preloaded module instantiated some
     multiprocessing objects such as locks.

   - bpo-28847(43): dbm.dumb now supports reading read-only files and no
     longer writes the index file when it is not changed.

   - bpo-26937(44): The chown() method of the tarfile.TarFile class does
     not fail now when the grp module cannot be imported, as for example
     on Android platforms.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29169

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29623

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28963

   (4) https://bugs.python.org/issue?@action=redirect&bpo=29704

   (5) https://bugs.python.org/issue?@action=redirect&bpo=29271

   (6) https://bugs.python.org/issue?@action=redirect&bpo=29703

   (7) https://bugs.python.org/issue?@action=redirect&bpo=29376

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28624

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28518

   (10) https://bugs.python.org/issue?@action=redirect&bpo=29532

   (11) https://bugs.python.org/issue?@action=redirect&bpo=29110

   (12) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (13) https://bugs.python.org/issue?@action=redirect&bpo=29100

   (14) https://bugs.python.org/issue?@action=redirect&bpo=29519

   (15) https://bugs.python.org/issue?@action=redirect&bpo=29416

   (16) https://bugs.python.org/issue?@action=redirect&bpo=29444

   (17) https://bugs.python.org/issue?@action=redirect&bpo=29335

   (18) https://bugs.python.org/issue?@action=redirect&bpo=29290

   (19) https://bugs.python.org/issue?@action=redirect&bpo=28735

   (20) https://bugs.python.org/issue?@action=redirect&bpo=29316

   (21) https://bugs.python.org/issue?@action=redirect&bpo=29219

   (22) https://bugs.python.org/issue?@action=redirect&bpo=29011

   (23) https://bugs.python.org/issue?@action=redirect&bpo=28969

   (24) https://bugs.python.org/issue?@action=redirect&bpo=29142

   (25) https://bugs.python.org/issue?@action=redirect&bpo=28961

   (26) https://bugs.python.org/issue?@action=redirect&bpo=29203

   (27) https://peps.python.org/pep-0468/

   (28) https://bugs.python.org/issue?@action=redirect&bpo=15812

   (29) https://bugs.python.org/issue?@action=redirect&bpo=29094

   (30) https://bugs.python.org/issue?@action=redirect&bpo=29085

   (31) https://bugs.python.org/issue?@action=redirect&bpo=29061

   (32) https://bugs.python.org/issue?@action=redirect&bpo=29079

   (33) https://bugs.python.org/issue?@action=redirect&bpo=13051

   (34) https://bugs.python.org/issue?@action=redirect&bpo=29119

   (35) https://bugs.python.org/issue?@action=redirect&bpo=9770

   (36) https://bugs.python.org/issue?@action=redirect&bpo=28427

   (37) https://bugs.python.org/issue?@action=redirect&bpo=28923

   (38) https://bugs.python.org/issue?@action=redirect&bpo=29055

   (39) https://bugs.python.org/issue?@action=redirect&bpo=28871

   (40) https://bugs.python.org/issue?@action=redirect&bpo=19542

   (41) https://bugs.python.org/issue?@action=redirect&bpo=20191

   (42) https://bugs.python.org/issue?@action=redirect&bpo=28779

   (43) https://bugs.python.org/issue?@action=redirect&bpo=28847

   (44) https://bugs.python.org/issue?@action=redirect&bpo=26937


File: python.info,  Node: IDLE<51>,  Next: Windows<69>,  Prev: ライブラリ<180>,  Up: Python 3 6 1 release candidate 1

1.24.86.3 IDLE
..............

   - bpo-29071(1): IDLE colors f-string prefixes (but not invalid ur
     prefixes).

   - bpo-28572(2): Add 10% to coverage of IDLE's test_configdialog.
     Update and augment description of the configuration system.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29071

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28572


File: python.info,  Node: Windows<69>,  Next: C API<68>,  Prev: IDLE<51>,  Up: Python 3 6 1 release candidate 1

1.24.86.4 Windows
.................

   - bpo-29579(1): Removes readme.txt from the installer

   - bpo-29326(2): Ignores blank lines in ._pth files (Patch by Alexey
     Izbyshev)

   - bpo-28164(3): Correctly handle special console filenames (patch by
     Eryk Sun)

   - bpo-29409(4): Implement PEP 529(5) for io.FileIO (Patch by Eryk
     Sun)

   - bpo-29392(6): Prevent crash when passing invalid arguments into
     msvcrt module.

   - bpo-25778(7): winreg does not truncate string correctly (Patch by
     Eryk Sun)

   - bpo-28896(8): Deprecate WindowsRegistryFinder and disable it by
     default.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29579

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29326

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28164

   (4) https://bugs.python.org/issue?@action=redirect&bpo=29409

   (5) https://peps.python.org/pep-0529/

   (6) https://bugs.python.org/issue?@action=redirect&bpo=29392

   (7) https://bugs.python.org/issue?@action=redirect&bpo=25778

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28896


File: python.info,  Node: C API<68>,  Next: ドキュメント<72>,  Prev: Windows<69>,  Up: Python 3 6 1 release candidate 1

1.24.86.5 C API
...............

   - bpo-27867(1): Function PySlice_GetIndicesEx() is replaced with a
     macro if Py_LIMITED_API is not set or set to the value between
     0x03050400 and 0x03060000 (not including) or 0x03060100 or higher.

   - bpo-29083(2): Fixed the declaration of some public API functions.
     PyArg_VaParse() and PyArg_VaParseTupleAndKeywords() were not
     available in limited API. PyArg_ValidateKeywordArguments(),
     PyArg_UnpackTuple() and Py_BuildValue() were not available in
     limited API of version < 3.3 when PY_SSIZE_T_CLEAN is defined.

   - bpo-29058(3): All stable API extensions added after Python 3.2 are
     now available only when Py_LIMITED_API is set to the PY_VERSION_HEX
     value of the minimum Python version supporting this API.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27867

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29083

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29058


File: python.info,  Node: ドキュメント<72>,  Next: テスト<69>,  Prev: C API<68>,  Up: Python 3 6 1 release candidate 1

1.24.86.6 ドキュメント
......................

   - bpo-28929(1): Link the documentation to its source file on GitHub.

   - bpo-25008(2): Document smtpd.py as effectively deprecated and add a
     pointer to aiosmtpd, a third-party asyncio-based replacement.

   - bpo-26355(3): Add canonical header link on each page to
     corresponding major version of the documentation.  Patch by
     Matthias Bussonnier.

   - bpo-29349(4): Fix Python 2 syntax in code for building the
     documentation.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28929

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25008

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26355

   (4) https://bugs.python.org/issue?@action=redirect&bpo=29349


File: python.info,  Node: テスト<69>,  Next: ビルド<79>,  Prev: ドキュメント<72>,  Up: Python 3 6 1 release candidate 1

1.24.86.7 テスト
................

   - bpo-28087(1): Skip test_asyncore and test_eintr poll failures on
     macOS. Skip some tests of select.poll when running on macOS due to
     unresolved issues with the underlying system poll function on some
     macOS versions.

   - bpo-29571(2): to match the behaviour of the ‘re.LOCALE’ flag,
     test_re.test_locale_flag now uses
     ‘locale.getpreferredencoding(False)’ to determine the candidate
     encoding for the test regex (allowing it to correctly skip the test
     when the default locale encoding is a multi-byte encoding)

   - bpo-28950(3): Disallow -j0 to be combined with -T/-l in regrtest
     command line arguments.

   - bpo-28683(4): Fix the tests that bind() a unix socket and raise
     PermissionError on Android for a non-root user.

   - bpo-26939(5): Add the support.setswitchinterval() function to fix
     test_functools hanging on the Android armv7 qemu emulator.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28087

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29571

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28950

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28683

   (5) https://bugs.python.org/issue?@action=redirect&bpo=26939


File: python.info,  Node: ビルド<79>,  Prev: テスト<69>,  Up: Python 3 6 1 release candidate 1

1.24.86.8 ビルド
................

   - bpo-27593(1): sys.version and the platform module python_build(),
     python_branch(), and python_revision() functions now use git
     information rather than hg when building from a repo.

   - bpo-29572(2): Update Windows build and OS X installers to use
     OpenSSL 1.0.2k.

   - bpo-26851(3): Set Android compilation and link flags.

   - bpo-28768(4): Fix implicit declaration of function _setmode.  Patch
     by Masayuki Yamamoto

   - bpo-29080(5): Removes hard dependency on hg.exe from
     PCBuild/build.bat

   - bpo-23903(6): Added missed names to PC/python3.def.

   - bpo-28762(7): lockf() is available on Android API level 24, but the
     F_LOCK macro is not defined in android-ndk-r13.

   - bpo-28538(8): Fix the compilation error that occurs because
     if_nameindex() is available on Android API level 24, but the
     if_nameindex structure is not defined.

   - bpo-20211(9): Do not add the directory for installing C header
     files and the directory for installing object code libraries to the
     cross compilation search paths.  Original patch by Thomas
     Petazzoni.

   - bpo-28849(10): Do not define sys.implementation._multiarch on
     Android.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27593

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29572

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26851

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28768

   (5) https://bugs.python.org/issue?@action=redirect&bpo=29080

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23903

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28762

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28538

   (9) https://bugs.python.org/issue?@action=redirect&bpo=20211

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28849


File: python.info,  Node: Python 3 6 0 final,  Next: Python 3 6 0 release candidate 2,  Prev: Python 3 6 1 release candidate 1,  Up: 変更履歴

1.24.87 Python 3.6.0 final
--------------------------

'Release date: 2016-12-23'

No changes since release candidate 2


File: python.info,  Node: Python 3 6 0 release candidate 2,  Next: Python 3 6 0 release candidate 1,  Prev: Python 3 6 0 final,  Up: 変更履歴

1.24.88 Python 3.6.0 release candidate 2
----------------------------------------

'Release date: 2016-12-16'

* Menu:

* Core and Builtins: Core and Builtins<177>.
* Tools/Demos: Tools/Demos<49>.
* Windows: Windows<70>.
* ビルド: ビルド<80>.


File: python.info,  Node: Core and Builtins<177>,  Next: Tools/Demos<49>,  Up: Python 3 6 0 release candidate 2

1.24.88.1 Core and Builtins
...........................

   - bpo-28147(1): Fix a memory leak in split-table dictionaries:
     setattr() must not convert combined table into split table.  Patch
     written by INADA Naoki.

   - bpo-28990(2): Fix asyncio SSL hanging if connection is closed
     before handshake is completed.  (Patch by HoHo-Ho)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28147

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28990


File: python.info,  Node: Tools/Demos<49>,  Next: Windows<70>,  Prev: Core and Builtins<177>,  Up: Python 3 6 0 release candidate 2

1.24.88.2 Tools/Demos
.....................

   - bpo-28770(1): Fix python-gdb.py for fastcalls.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28770


File: python.info,  Node: Windows<70>,  Next: ビルド<80>,  Prev: Tools/Demos<49>,  Up: Python 3 6 0 release candidate 2

1.24.88.3 Windows
.................

   - bpo-28896(1): Deprecate WindowsRegistryFinder.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28896


File: python.info,  Node: ビルド<80>,  Prev: Windows<70>,  Up: Python 3 6 0 release candidate 2

1.24.88.4 ビルド
................

   - bpo-28898(1): Prevent gdb build errors due to HAVE_LONG_LONG
     redefinition.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28898


File: python.info,  Node: Python 3 6 0 release candidate 1,  Next: Python 3 6 0 beta 4,  Prev: Python 3 6 0 release candidate 2,  Up: 変更履歴

1.24.89 Python 3.6.0 release candidate 1
----------------------------------------

'Release date: 2016-12-06'

* Menu:

* Core and Builtins: Core and Builtins<178>.
* ライブラリ: ライブラリ<181>.
* C API: C API<69>.
* ドキュメント: ドキュメント<73>.
* Tools/Demos: Tools/Demos<50>.


File: python.info,  Node: Core and Builtins<178>,  Next: ライブラリ<181>,  Up: Python 3 6 0 release candidate 1

1.24.89.1 Core and Builtins
...........................

   - bpo-23722(1): Rather than silently producing a class that doesn't
     support zero-argument ‘super()’ in methods, failing to pass the new
     ‘__classcell__’ namespace entry up to ‘type.__new__’ now results in
     a ‘DeprecationWarning’ and a class that supports zero-argument
     ‘super()’.

   - bpo-28797(2): Modifying the class __dict__ inside the __set_name__
     method of a descriptor that is used inside that class no longer
     prevents calling the __set_name__ method of other descriptors.

   - bpo-28782(3): Fix a bug in the implementation ‘yield from’ when
     checking if the next instruction is YIELD_FROM. Regression
     introduced by WORDCODE (bpo-26647(4)).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23722

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28797

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28782

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26647


File: python.info,  Node: ライブラリ<181>,  Next: C API<69>,  Prev: Core and Builtins<178>,  Up: Python 3 6 0 release candidate 1

1.24.89.2 ライブラリ
....................

   - bpo-27030(1): Unknown escapes in re.sub() replacement template are
     allowed again.  But they still are deprecated and will be disabled
     in 3.7.

   - bpo-28835(2): Fix a regression introduced in
     warnings.catch_warnings(): call warnings.showwarning() if it was
     overridden inside the context manager.

   - bpo-27172(3): To assist with upgrades from 2.7, the previously
     documented deprecation of ‘inspect.getfullargspec()’ has been
     reversed.  This decision may be revisited again after the Python
     2.7 branch is no longer officially supported.

   - bpo-26273(4): Add new ‘socket.TCP_CONGESTION’ (Linux 2.6.13) and
     ‘socket.TCP_USER_TIMEOUT’ (Linux 2.6.37) constants.  Patch written
     by Omar Sandoval.

   - bpo-24142(5): Reading a corrupt config file left configparser in an
     invalid state.  Original patch by Florian Höch.

   - bpo-28843(6): Fix asyncio C Task to handle exceptions
     __traceback__.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27030

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28835

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27172

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26273

   (5) https://bugs.python.org/issue?@action=redirect&bpo=24142

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28843


File: python.info,  Node: C API<69>,  Next: ドキュメント<73>,  Prev: ライブラリ<181>,  Up: Python 3 6 0 release candidate 1

1.24.89.3 C API
...............

   - bpo-28808(1): PyUnicode_CompareWithASCIIString() now never raises
     exceptions.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28808


File: python.info,  Node: ドキュメント<73>,  Next: Tools/Demos<50>,  Prev: C API<69>,  Up: Python 3 6 0 release candidate 1

1.24.89.4 ドキュメント
......................

   - bpo-23722(1): The data model reference and the porting section in
     the What's New guide now cover the additional ‘__classcell__’
     handling needed for custom metaclasses to fully support PEP 487(2)
     and zero-argument ‘super()’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23722

   (2) https://peps.python.org/pep-0487/


File: python.info,  Node: Tools/Demos<50>,  Prev: ドキュメント<73>,  Up: Python 3 6 0 release candidate 1

1.24.89.5 Tools/Demos
.....................

   - bpo-28023(1): Fix python-gdb.py didn't support new dict
     implementation.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28023


File: python.info,  Node: Python 3 6 0 beta 4,  Next: Python 3 6 0 beta 3,  Prev: Python 3 6 0 release candidate 1,  Up: 変更履歴

1.24.90 Python 3.6.0 beta 4
---------------------------

'Release date: 2016-11-21'

* Menu:

* Core and Builtins: Core and Builtins<179>.
* ライブラリ: ライブラリ<182>.
* ドキュメント: ドキュメント<74>.
* テスト: テスト<70>.
* ビルド: ビルド<81>.


File: python.info,  Node: Core and Builtins<179>,  Next: ライブラリ<182>,  Up: Python 3 6 0 beta 4

1.24.90.1 Core and Builtins
...........................

   - bpo-28532(1): Show sys.version when -V option is supplied twice.

   - bpo-27100(2): The with-statement now checks for __enter__ before it
     checks for __exit__.  This gives less confusing error messages when
     both methods are missing.  Patch by Jonathan Ellington.

   - bpo-28746(3): Fix the set_inheritable() file descriptor method on
     platforms that do not have the ioctl FIOCLEX and FIONCLEX commands.

   - bpo-26920(4): Fix not getting the locale's charset upon
     initializing the interpreter, on platforms that do not have
     langinfo.

   - bpo-28648(5): Fixed crash in Py_DecodeLocale() in debug build on
     Mac OS X when decode astral characters.  Patch by Xiang Zhang.

   - bpo-19398(6): Extra slash no longer added to sys.path components in
     case of empty compile-time PYTHONPATH components.

   - bpo-28665(7): Improve speed of the STORE_DEREF opcode by 40%.

   - bpo-28583(8): PyDict_SetDefault didn't combine split table when
     needed.  Patch by Xiang Zhang.

   - bpo-27243(9): Change PendingDeprecationWarning ->
     DeprecationWarning.  As it was agreed in the issue, __aiter__
     returning an awaitable should result in PendingDeprecationWarning
     in 3.5 and in DeprecationWarning in 3.6.

   - bpo-26182(10): Fix a refleak in code that raises
     DeprecationWarning.

   - bpo-28721(11): Fix asynchronous generators aclose() and athrow() to
     handle StopAsyncIteration propagation properly.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28532

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27100

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28746

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26920

   (5) https://bugs.python.org/issue?@action=redirect&bpo=28648

   (6) https://bugs.python.org/issue?@action=redirect&bpo=19398

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28665

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28583

   (9) https://bugs.python.org/issue?@action=redirect&bpo=27243

   (10) https://bugs.python.org/issue?@action=redirect&bpo=26182

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28721


File: python.info,  Node: ライブラリ<182>,  Next: ドキュメント<74>,  Prev: Core and Builtins<179>,  Up: Python 3 6 0 beta 4

1.24.90.2 ライブラリ
....................

   - bpo-28752(1): Restored the __reduce__() methods of datetime
     objects.

   - bpo-28727(2): Regular expression patterns, _sre.SRE_Pattern objects
     created by re.compile(), become comparable (only x==y and x!=y
     operators).  This change should fix the bpo-18383(3): don't
     duplicate warning filters when the warnings module is reloaded
     (thing usually only done in unit tests).

   - bpo-20572(4): The subprocess.Popen.wait method's undocumented
     endtime parameter now raises a DeprecationWarning.

   - bpo-25659(5): In ctypes, prevent a crash calling the from_buffer()
     and from_buffer_copy() methods on abstract classes like Array.

   - bpo-19717(6): Makes Path.resolve() succeed on paths that do not
     exist.  Patch by Vajrasky Kok

   - bpo-28563(7): Fixed possible DoS and arbitrary code execution when
     handle plural form selections in the gettext module.  The
     expression parser now supports exact syntax supported by GNU
     gettext.

   - bpo-28387(8): Fixed possible crash in _io.TextIOWrapper deallocator
     when the garbage collector is invoked in other thread.  Based on
     patch by Sebastian Cufre.

   - bpo-28600(9): Optimize loop.call_soon.

   - bpo-28613(10): Fix get_event_loop() return the current loop if
     called from coroutines/callbacks.

   - bpo-28634(11): Fix asyncio.isfuture() to support unittest.Mock.

   - bpo-26081(12): Fix refleak in _asyncio.Future.__iter__().throw.

   - bpo-28639(13): Fix inspect.isawaitable to always return bool Patch
     by Justin Mayfield.

   - bpo-28652(14): Make loop methods reject socket kinds they do not
     support.

   - bpo-28653(15): Fix a refleak in functools.lru_cache.

   - bpo-28703(16): Fix asyncio.iscoroutinefunction to handle Mock
     objects.

   - bpo-28704(17): Fix create_unix_server to support Path-like objects
     (PEP 519).

   - bpo-28720(18): Add collections.abc.AsyncGenerator.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28752

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28727

   (3) https://bugs.python.org/issue?@action=redirect&bpo=18383

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20572

   (5) https://bugs.python.org/issue?@action=redirect&bpo=25659

   (6) https://bugs.python.org/issue?@action=redirect&bpo=19717

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28563

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28387

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28600

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28613

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28634

   (12) https://bugs.python.org/issue?@action=redirect&bpo=26081

   (13) https://bugs.python.org/issue?@action=redirect&bpo=28639

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28652

   (15) https://bugs.python.org/issue?@action=redirect&bpo=28653

   (16) https://bugs.python.org/issue?@action=redirect&bpo=28703

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28704

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28720


File: python.info,  Node: ドキュメント<74>,  Next: テスト<70>,  Prev: ライブラリ<182>,  Up: Python 3 6 0 beta 4

1.24.90.3 ドキュメント
......................

   - bpo-28513(1): Documented command-line interface of zipfile.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28513


File: python.info,  Node: テスト<70>,  Next: ビルド<81>,  Prev: ドキュメント<74>,  Up: Python 3 6 0 beta 4

1.24.90.4 テスト
................

   - bpo-28666(1): Now test.support.rmtree is able to remove unwritable
     or unreadable directories.

   - bpo-23839(2): Various caches now are cleared before running every
     test file.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28666

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23839


File: python.info,  Node: ビルド<81>,  Prev: テスト<70>,  Up: Python 3 6 0 beta 4

1.24.90.5 ビルド
................

   - bpo-10656(1): Fix out-of-tree building on AIX. Patch by Tristan
     Carel and Michael Haubenwallner.

   - bpo-26359(2): Rename -with-optimiations to -enable-optimizations.

   - bpo-28676(3): Prevent missing 'getentropy' declaration warning on
     macOS. Patch by Gareth Rees.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=10656

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26359

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28676


File: python.info,  Node: Python 3 6 0 beta 3,  Next: Python 3 6 0 beta 2,  Prev: Python 3 6 0 beta 4,  Up: 変更履歴

1.24.91 Python 3.6.0 beta 3
---------------------------

'Release date: 2016-10-31'

* Menu:

* Core and Builtins: Core and Builtins<180>.
* ライブラリ: ライブラリ<183>.
* Windows: Windows<71>.
* ビルド: ビルド<82>.
* テスト: テスト<71>.


File: python.info,  Node: Core and Builtins<180>,  Next: ライブラリ<183>,  Up: Python 3 6 0 beta 3

1.24.91.1 Core and Builtins
...........................

   - bpo-28128(1): Deprecation warning for invalid str and byte escape
     sequences now prints better information about where the error
     occurs.  Patch by Serhiy Storchaka and Eric Smith.

   - bpo-28509(2): dict.update() no longer allocate unnecessary large
     memory.

   - bpo-28426(3): Fixed potential crash in PyUnicode_AsDecodedObject()
     in debug build.

   - bpo-28517(4): Fixed of-by-one error in the peephole optimizer that
     caused keeping unreachable code.

   - bpo-28214(5): Improved exception reporting for problematic
     __set_name__ attributes.

   - bpo-23782(6): Fixed possible memory leak in _PyTraceback_Add() and
     exception loss in PyTraceBack_Here().

   - bpo-28471(7): Fix "Python memory allocator called without holding
     the GIL" crash in socket.setblocking.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28128

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28509

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28426

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28517

   (5) https://bugs.python.org/issue?@action=redirect&bpo=28214

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23782

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28471


File: python.info,  Node: ライブラリ<183>,  Next: Windows<71>,  Prev: Core and Builtins<180>,  Up: Python 3 6 0 beta 3

1.24.91.2 ライブラリ
....................

   - bpo-27517(1): LZMA compressor and decompressor no longer raise
     exceptions if given empty data twice.  Patch by Benjamin Fogle.

   - bpo-28549(2): Fixed segfault in curses's addch() with ncurses6.

   - bpo-28449(3): tarfile.open() with mode "r" or "r:" now tries to
     open a tar file with compression before trying to open it without
     compression.  Otherwise it had 50% chance failed with
     ignore_zeros=True.

   - bpo-23262(4): The webbrowser module now supports Firefox 36+ and
     derived browsers.  Based on patch by Oleg Broytman.

   - bpo-27939(5): Fixed bugs in tkinter.ttk.LabeledScale and
     tkinter.Scale caused by representing the scale as float value
     internally in Tk.  tkinter.IntVar now works if float value is set
     to underlying Tk variable.

   - bpo-18844(6): The various ways of specifying weights for
     random.choices() now produce the same result sequences.

   - bpo-28255(7): calendar.TextCalendar().prmonth() no longer prints a
     space at the start of new line after printing a month's calendar.
     Patch by Xiang Zhang.

   - bpo-20491(8): The textwrap.TextWrapper class now honors
     non-breaking spaces.  Based on patch by Kaarle Ritvanen.

   - bpo-28353(9): os.fwalk() no longer fails on broken links.

   - bpo-28430(10): Fix iterator of C implemented asyncio.Future doesn't
     accept non-None value is passed to it.send(val).

   - bpo-27025(11): Generated names for Tkinter widgets now start by the
     "!"  prefix for readability.

   - bpo-25464(12): Fixed HList.header_exists() in tkinter.tix module by
     addin a workaround to Tix library bug.

   - bpo-28488(13): shutil.make_archive() no longer adds entry "./" to
     ZIP archive.

   - bpo-25953(14): re.sub() now raises an error for invalid numerical
     group reference in replacement template even if the pattern is not
     found in the string.  Error message for invalid group reference now
     includes the group index and the position of the reference.  Based
     on patch by SilentGhost.

   - bpo-18219(15): Optimize csv.DictWriter for large number of columns.
     Patch by Mariatta Wijaya.

   - bpo-28448(16): Fix C implemented asyncio.Future didn't work on
     Windows.

   - bpo-28480(17): Fix error building socket module when multithreading
     is disabled.

   - bpo-24452(18): Make webbrowser support Chrome on Mac OS X.

   - bpo-20766(19): Fix references leaked by pdb in the handling of
     SIGINT handlers.

   - bpo-28492(20): Fix how StopIteration exception is raised in
     _asyncio.Future.

   - bpo-28500(21): Fix asyncio to handle async gens GC from another
     thread.

   - bpo-26923(22): Fix asyncio.Gather to refuse being cancelled once
     all children are done.  Patch by Johannes Ebke.

   - bpo-26796(23): Don't configure the number of workers for default
     threadpool executor.  Initial patch by Hans Lawrenz.

   - bpo-28544(24): Implement asyncio.Task in C.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27517

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28549

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28449

   (4) https://bugs.python.org/issue?@action=redirect&bpo=23262

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27939

   (6) https://bugs.python.org/issue?@action=redirect&bpo=18844

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28255

   (8) https://bugs.python.org/issue?@action=redirect&bpo=20491

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28353

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28430

   (11) https://bugs.python.org/issue?@action=redirect&bpo=27025

   (12) https://bugs.python.org/issue?@action=redirect&bpo=25464

   (13) https://bugs.python.org/issue?@action=redirect&bpo=28488

   (14) https://bugs.python.org/issue?@action=redirect&bpo=25953

   (15) https://bugs.python.org/issue?@action=redirect&bpo=18219

   (16) https://bugs.python.org/issue?@action=redirect&bpo=28448

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28480

   (18) https://bugs.python.org/issue?@action=redirect&bpo=24452

   (19) https://bugs.python.org/issue?@action=redirect&bpo=20766

   (20) https://bugs.python.org/issue?@action=redirect&bpo=28492

   (21) https://bugs.python.org/issue?@action=redirect&bpo=28500

   (22) https://bugs.python.org/issue?@action=redirect&bpo=26923

   (23) https://bugs.python.org/issue?@action=redirect&bpo=26796

   (24) https://bugs.python.org/issue?@action=redirect&bpo=28544


File: python.info,  Node: Windows<71>,  Next: ビルド<82>,  Prev: ライブラリ<183>,  Up: Python 3 6 0 beta 3

1.24.91.3 Windows
.................

   - bpo-28522(1): Fixes mishandled buffer reallocation in getpathp.c

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28522


File: python.info,  Node: ビルド<82>,  Next: テスト<71>,  Prev: Windows<71>,  Up: Python 3 6 0 beta 3

1.24.91.4 ビルド
................

   - bpo-28444(1): Fix missing extensions modules when cross compiling.

   - bpo-28208(2): Update Windows build and OS X installers to use
     SQLite 3.14.2.

   - bpo-28248(3): Update Windows build and OS X installers to use
     OpenSSL 1.0.2j.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28444

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28208

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28248


File: python.info,  Node: テスト<71>,  Prev: ビルド<82>,  Up: Python 3 6 0 beta 3

1.24.91.5 テスト
................

   - bpo-26944(1): Fix test_posix for Android where 'id -G' is entirely
     wrong or missing the effective gid.

   - bpo-28409(2): regrtest: fix the parser of command line arguments.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26944

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28409


File: python.info,  Node: Python 3 6 0 beta 2,  Next: Python 3 6 0 beta 1,  Prev: Python 3 6 0 beta 3,  Up: 変更履歴

1.24.92 Python 3.6.0 beta 2
---------------------------

'Release date: 2016-10-10'

* Menu:

* Core and Builtins: Core and Builtins<181>.
* ライブラリ: ライブラリ<184>.
* Windows: Windows<72>.
* C API: C API<70>.
* ビルド: ビルド<83>.
* テスト: テスト<72>.


File: python.info,  Node: Core and Builtins<181>,  Next: ライブラリ<184>,  Up: Python 3 6 0 beta 2

1.24.92.1 Core and Builtins
...........................

   - bpo-28183(1): Optimize and cleanup dict iteration.

   - bpo-26081(2): Added C implementation of asyncio.Future.  Original
     patch by Yury Selivanov.

   - bpo-28379(3): Added sanity checks and tests for
     PyUnicode_CopyCharacters().  Patch by Xiang Zhang.

   - bpo-28376(4): The type of long range iterator is now registered as
     Iterator.  Patch by Oren Milman.

   - bpo-28376(5): Creating instances of range_iterator by calling
     range_iterator type now is deprecated.  Patch by Oren Milman.

   - bpo-28376(6): The constructor of range_iterator now checks that
     step is not 0.  Patch by Oren Milman.

   - bpo-26906(7): Resolving special methods of uninitialized type now
     causes implicit initialization of the type instead of a fail.

   - bpo-18287(8): PyType_Ready() now checks that tp_name is not NULL.
     Original patch by Niklas Koep.

   - bpo-24098(9): Fixed possible crash when AST is changed in process
     of compiling it.

   - bpo-28201(10): Dict reduces possibility of 2nd conflict in hash
     table when hashes have same lower bits.

   - bpo-28350(11): String constants with null character no longer
     interned.

   - bpo-26617(12): Fix crash when GC runs during weakref callbacks.

   - bpo-27942(13): String constants now interned recursively in tuples
     and frozensets.

   - bpo-21578(14): Fixed misleading error message when ImportError
     called with invalid keyword args.

   - bpo-28203(15): Fix incorrect type in complex(1.0, {2:3}) error
     message.  Patch by Soumya Sharma.

   - bpo-28086(16): Single var-positional argument of tuple subtype was
     passed unscathed to the C-defined function.  Now it is converted to
     exact tuple.

   - bpo-28214(17): Now __set_name__ is looked up on the class instead
     of the instance.

   - bpo-27955(18): Fallback on reading /dev/urandom device when the
     getrandom() syscall fails with EPERM, for example when blocked by
     SECCOMP.

   - bpo-28192(19): Don't import readline in isolated mode.

   - Upgrade internal unicode databases to Unicode version 9.0.0.

   - bpo-28131(20): Fix a regression in zipimport's compile_source().
     zipimport should use the same optimization level as the
     interpreter.

   - bpo-28126(21): Replace Py_MEMCPY with memcpy().  Visual Studio can
     properly optimize memcpy().

   - bpo-28120(22): Fix dict.pop() for split dictionary when trying to
     remove a "pending key" (Not yet inserted in split-table).  Patch by
     Xiang Zhang.

   - bpo-26182(23): Raise DeprecationWarning when async and await
     keywords are used as variable/attribute/class/function name.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28183

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26081

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28379

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28376

   (5) https://bugs.python.org/issue?@action=redirect&bpo=28376

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28376

   (7) https://bugs.python.org/issue?@action=redirect&bpo=26906

   (8) https://bugs.python.org/issue?@action=redirect&bpo=18287

   (9) https://bugs.python.org/issue?@action=redirect&bpo=24098

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28201

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28350

   (12) https://bugs.python.org/issue?@action=redirect&bpo=26617

   (13) https://bugs.python.org/issue?@action=redirect&bpo=27942

   (14) https://bugs.python.org/issue?@action=redirect&bpo=21578

   (15) https://bugs.python.org/issue?@action=redirect&bpo=28203

   (16) https://bugs.python.org/issue?@action=redirect&bpo=28086

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28214

   (18) https://bugs.python.org/issue?@action=redirect&bpo=27955

   (19) https://bugs.python.org/issue?@action=redirect&bpo=28192

   (20) https://bugs.python.org/issue?@action=redirect&bpo=28131

   (21) https://bugs.python.org/issue?@action=redirect&bpo=28126

   (22) https://bugs.python.org/issue?@action=redirect&bpo=28120

   (23) https://bugs.python.org/issue?@action=redirect&bpo=26182


File: python.info,  Node: ライブラリ<184>,  Next: Windows<72>,  Prev: Core and Builtins<181>,  Up: Python 3 6 0 beta 2

1.24.92.2 ライブラリ
....................

   - bpo-27998(1): Fixed bytes path support in os.scandir() on Windows.
     Patch by Eryk Sun.

   - bpo-28317(2): The disassembler now decodes FORMAT_VALUE argument.

   - bpo-26293(3): Fixed writing ZIP files that starts not from the
     start of the file.  Offsets in ZIP file now are relative to the
     start of the archive in conforming to the specification.

   - bpo-28380(4): unittest.mock Mock autospec functions now properly
     support assert_called, assert_not_called, and assert_called_once.

   - bpo-27181(5): remove statistics.geometric_mean and defer until 3.7.

   - bpo-28229(6): lzma module now supports pathlib.

   - bpo-28321(7): Fixed writing non-BMP characters with binary format
     in plistlib.

   - bpo-28225(8): bz2 module now supports pathlib.  Initial patch by
     Ethan Furman.

   - bpo-28227(9): gzip now supports pathlib.  Patch by Ethan Furman.

   - bpo-27358(10): Optimized merging var-keyword arguments and improved
     error message when passing a non-mapping as a var-keyword argument.

   - bpo-28257(11): Improved error message when passing a non-iterable
     as a var-positional argument.  Added opcode
     BUILD_TUPLE_UNPACK_WITH_CALL.

   - bpo-28322(12): Fixed possible crashes when unpickle itertools
     objects from incorrect pickle data.  Based on patch by John Leitch.

   - bpo-28228(13): imghdr now supports pathlib.

   - bpo-28226(14): compileall now supports pathlib.

   - bpo-28314(15): Fix function declaration (C flags) for the
     getiterator() method of xml.etree.ElementTree.Element.

   - bpo-28148(16): Stop using localtime() and gmtime() in the time
     module.  Introduced platform independent _PyTime_localtime API that
     is similar to POSIX localtime_r, but available on all platforms.
     Patch by Ed Schouten.

   - bpo-28253(17): Fixed calendar functions for extreme months: 0001-01
     and 9999-12.  Methods itermonthdays() and itermonthdays2() are
     reimplemented so that they don't call itermonthdates() which can
     cause datetime.date under/overflow.

   - bpo-28275(18): Fixed possible use after free in the decompress()
     methods of the LZMADecompressor and BZ2Decompressor classes.
     Original patch by John Leitch.

   - bpo-27897(19): Fixed possible crash in
     sqlite3.Connection.create_collation() if pass invalid string-like
     object as a name.  Patch by Xiang Zhang.

   - bpo-18844(20): random.choices() now has k as a keyword-only
     argument to improve the readability of common cases and come into
     line with the signature used in other languages.

   - bpo-18893(21): Fix invalid exception handling in
     Lib/ctypes/macholib/dyld.py.  Patch by Madison May.

   - bpo-27611(22): Fixed support of default root window in the
     tkinter.tix module.  Added the master parameter in the DisplayStyle
     constructor.

   - bpo-27348(23): In the traceback module, restore the formatting of
     exception messages like "Exception: None".  This fixes a regression
     introduced in 3.5a2.

   - bpo-25651(24): Allow false values to be used for msg parameter of
     subTest().

   - bpo-27778(25): Fix a memory leak in os.getrandom() when the
     getrandom() is interrupted by a signal and a signal handler raises
     a Python exception.

   - bpo-28200(26): Fix memory leak on Windows in the os module (fix
     path_converter() function).

   - bpo-25400(27): RobotFileParser now correctly returns default values
     for crawl_delay and request_rate.  Initial patch by Peter Wirtz.

   - bpo-27932(28): Prevent memory leak in win32_ver().

   - Fix UnboundLocalError in socket._sendfile_use_sendfile.

   - bpo-28075(29): Check for ERROR_ACCESS_DENIED in Windows
     implementation of os.stat().  Patch by Eryk Sun.

   - bpo-22493(30): Warning message emitted by using inline flags in the
     middle of regular expression now contains a (truncated) regex
     pattern.  Patch by Tim Graham.

   - bpo-25270(31): Prevent codecs.escape_encode() from raising
     SystemError when an empty bytestring is passed.

   - bpo-28181(32): Get antigravity over HTTPS. Patch by Kaartic
     Sivaraam.

   - bpo-25895(33): Enable WebSocket URL schemes in
     urllib.parse.urljoin.  Patch by Gergely Imreh and Markus
     Holtermann.

   - bpo-28114(34): Fix a crash in parse_envlist() when env contains
     byte strings.  Patch by Eryk Sun.

   - bpo-27599(35): Fixed buffer overrun in binascii.b2a_qp() and
     binascii.a2b_qp().

   - bpo-27906(36): Fix socket accept exhaustion during high TCP
     traffic.  Patch by Kevin Conway.

   - bpo-28174(37): Handle when SO_REUSEPORT isn't properly supported.
     Patch by Seth Michael Larson.

   - bpo-26654(38): Inspect functools.partial in
     asyncio.Handle.__repr__.  Patch by iceboy.

   - bpo-26909(39): Fix slow pipes IO in asyncio.  Patch by INADA Naoki.

   - bpo-28176(40): Fix callbacks race in
     asyncio.SelectorLoop.sock_connect.

   - bpo-27759(41): Fix selectors incorrectly retain invalid file
     descriptors.  Patch by Mark Williams.

   - bpo-28368(42): Refuse monitoring processes if the child watcher has
     no loop attached.  Patch by Vincent Michel.

   - bpo-28369(43): Raise RuntimeError when transport's FD is used with
     add_reader, add_writer, etc.

   - bpo-28370(44): Speedup asyncio.StreamReader.readexactly.  Patch by
     Коренберг Марк.

   - bpo-28371(45): Deprecate passing asyncio.Handles to
     run_in_executor.

   - bpo-28372(46): Fix asyncio to support formatting of non-python
     coroutines.

   - bpo-28399(47): Remove UNIX socket from FS before binding.  Patch by
     Коренберг Марк.

   - bpo-27972(48): Prohibit Tasks to await on themselves.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27998

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28317

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26293

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28380

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27181

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28229

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28321

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28225

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28227

   (10) https://bugs.python.org/issue?@action=redirect&bpo=27358

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28257

   (12) https://bugs.python.org/issue?@action=redirect&bpo=28322

   (13) https://bugs.python.org/issue?@action=redirect&bpo=28228

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28226

   (15) https://bugs.python.org/issue?@action=redirect&bpo=28314

   (16) https://bugs.python.org/issue?@action=redirect&bpo=28148

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28253

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28275

   (19) https://bugs.python.org/issue?@action=redirect&bpo=27897

   (20) https://bugs.python.org/issue?@action=redirect&bpo=18844

   (21) https://bugs.python.org/issue?@action=redirect&bpo=18893

   (22) https://bugs.python.org/issue?@action=redirect&bpo=27611

   (23) https://bugs.python.org/issue?@action=redirect&bpo=27348

   (24) https://bugs.python.org/issue?@action=redirect&bpo=25651

   (25) https://bugs.python.org/issue?@action=redirect&bpo=27778

   (26) https://bugs.python.org/issue?@action=redirect&bpo=28200

   (27) https://bugs.python.org/issue?@action=redirect&bpo=25400

   (28) https://bugs.python.org/issue?@action=redirect&bpo=27932

   (29) https://bugs.python.org/issue?@action=redirect&bpo=28075

   (30) https://bugs.python.org/issue?@action=redirect&bpo=22493

   (31) https://bugs.python.org/issue?@action=redirect&bpo=25270

   (32) https://bugs.python.org/issue?@action=redirect&bpo=28181

   (33) https://bugs.python.org/issue?@action=redirect&bpo=25895

   (34) https://bugs.python.org/issue?@action=redirect&bpo=28114

   (35) https://bugs.python.org/issue?@action=redirect&bpo=27599

   (36) https://bugs.python.org/issue?@action=redirect&bpo=27906

   (37) https://bugs.python.org/issue?@action=redirect&bpo=28174

   (38) https://bugs.python.org/issue?@action=redirect&bpo=26654

   (39) https://bugs.python.org/issue?@action=redirect&bpo=26909

   (40) https://bugs.python.org/issue?@action=redirect&bpo=28176

   (41) https://bugs.python.org/issue?@action=redirect&bpo=27759

   (42) https://bugs.python.org/issue?@action=redirect&bpo=28368

   (43) https://bugs.python.org/issue?@action=redirect&bpo=28369

   (44) https://bugs.python.org/issue?@action=redirect&bpo=28370

   (45) https://bugs.python.org/issue?@action=redirect&bpo=28371

   (46) https://bugs.python.org/issue?@action=redirect&bpo=28372

   (47) https://bugs.python.org/issue?@action=redirect&bpo=28399

   (48) https://bugs.python.org/issue?@action=redirect&bpo=27972


File: python.info,  Node: Windows<72>,  Next: C API<70>,  Prev: ライブラリ<184>,  Up: Python 3 6 0 beta 2

1.24.92.3 Windows
.................

   - bpo-28402(1): Adds signed catalog files for stdlib on Windows.

   - bpo-28333(2): Enables Unicode for ps1/ps2 and input() prompts.
     (Patch by Eryk Sun)

   - bpo-28251(3): Improvements to help manuals on Windows.

   - bpo-28110(4): launcher.msi has different product codes between
     32-bit and 64-bit

   - bpo-28161(5): Opening CON for write access fails

   - bpo-28162(6): WindowsConsoleIO readall() fails if first line starts
     with Ctrl+Z

   - bpo-28163(7): WindowsConsoleIO fileno() passes wrong flags to
     _open_osfhandle

   - bpo-28164(8): _PyIO_get_console_type fails for various paths

   - bpo-28137(9): Renames Windows path file to ._pth

   - bpo-28138(10): Windows ._pth file should allow import site

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28402

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28333

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28251

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28110

   (5) https://bugs.python.org/issue?@action=redirect&bpo=28161

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28162

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28163

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28164

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28137

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28138


File: python.info,  Node: C API<70>,  Next: ビルド<83>,  Prev: Windows<72>,  Up: Python 3 6 0 beta 2

1.24.92.4 C API
...............

   - bpo-28426(1): Deprecated undocumented functions
     PyUnicode_AsEncodedObject(), PyUnicode_AsDecodedObject(),
     PyUnicode_AsDecodedUnicode() and PyUnicode_AsEncodedUnicode().

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28426


File: python.info,  Node: ビルド<83>,  Next: テスト<72>,  Prev: C API<70>,  Up: Python 3 6 0 beta 2

1.24.92.5 ビルド
................

   - bpo-28258(1): Fixed build with Estonian locale (python-config and
     distclean targets in Makefile).  Patch by Arfrever Frehtes
     Taifersar Arahesis.

   - bpo-26661(2): setup.py now detects system libffi with multiarch
     wrapper.

   - bpo-15819(3): Remove redundant include search directory option for
     building outside the source tree.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28258

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26661

   (3) https://bugs.python.org/issue?@action=redirect&bpo=15819


File: python.info,  Node: テスト<72>,  Prev: ビルド<83>,  Up: Python 3 6 0 beta 2

1.24.92.6 テスト
................

   - bpo-28217(1): Adds _testconsole module to test console input.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28217


File: python.info,  Node: Python 3 6 0 beta 1,  Next: Python 3 6 0 alpha 4,  Prev: Python 3 6 0 beta 2,  Up: 変更履歴

1.24.93 Python 3.6.0 beta 1
---------------------------

'Release date: 2016-09-12'

* Menu:

* Core and Builtins: Core and Builtins<182>.
* ライブラリ: ライブラリ<185>.
* IDLE: IDLE<52>.
* C API: C API<71>.
* テスト: テスト<73>.
* ビルド: ビルド<84>.
* Tools/Demos: Tools/Demos<51>.
* Windows: Windows<73>.


File: python.info,  Node: Core and Builtins<182>,  Next: ライブラリ<185>,  Up: Python 3 6 0 beta 1

1.24.93.1 Core and Builtins
...........................

   - bpo-23722(1): The __class__ cell used by zero-argument super() is
     now initialized from type.__new__ rather than __build_class__, so
     class methods relying on that will now work correctly when called
     from metaclass methods during class creation.  Patch by Martin
     Teichmann.

   - bpo-25221(2): Fix corrupted result from PyLong_FromLong(0) when
     Python is compiled with NSMALLPOSINTS = 0.

   - bpo-27080(3): Implement formatting support for PEP 515(4).  Initial
     patch by Chris Angelico.

   - bpo-27199(5): In tarfile, expose copyfileobj bufsize to improve
     throughput.  Patch by Jason Fried.

   - bpo-27948(6): In f-strings, only allow backslashes inside the
     braces (where the expressions are).  This is a breaking change from
     the 3.6 alpha releases, where backslashes are allowed anywhere in
     an f-string.  Also, require that expressions inside f-strings be
     enclosed within literal braces, and not escapes like
     ‘f'\x7b"hi"\x7d'’.

   - bpo-28046(7): Remove platform-specific directories from sys.path.

   - bpo-28071(8): Add early-out for differencing from an empty set.

   - bpo-25758(9): Prevents zipimport from unnecessarily encoding a
     filename (patch by Eryk Sun)

   - bpo-25856(10): The __module__ attribute of extension classes and
     functions now is interned.  This leads to more compact pickle data
     with protocol 4.

   - bpo-27213(11): Rework CALL_FUNCTION* opcodes to produce shorter and
     more efficient bytecode.  Patch by Demur Rumed, design by Serhiy
     Storchaka, reviewed by Serhiy Storchaka and Victor Stinner.

   - bpo-26331(12): Implement tokenizing support for PEP 515(13).  Patch
     by Georg Brandl.

   - bpo-27999(14): Make "global after use" a SyntaxError, and ditto for
     nonlocal.  Patch by Ivan Levkivskyi.

   - bpo-28003(15): Implement PEP 525(16) - Asynchronous Generators.

   - bpo-27985(17): Implement PEP 526(18) - Syntax for Variable
     Annotations.  Patch by Ivan Levkivskyi.

   - bpo-26058(19): Add a new private version to the builtin dict type,
     incremented at each dictionary creation and at each dictionary
     change.  Implementation of the PEP 509.

   - bpo-27364(20): A backslash-character pair that is not a valid
     escape sequence now generates a DeprecationWarning.  Patch by
     Emanuel Barry.

   - bpo-27350(21): ‘dict’ implementation is changed like PyPy.  It is
     more compact and preserves insertion order.  (Concept developed by
     Raymond Hettinger and patch by Inada Naoki.)

   - bpo-27911(22): Remove unnecessary error checks in
     ‘exec_builtin_or_dynamic()’.

   - bpo-27078(23): Added BUILD_STRING opcode.  Optimized f-strings
     evaluation.

   - bpo-17884(24): Python now requires systems with inttypes.h and
     stdint.h

   - bpo-27961(25): Require platforms to support ‘long long’.  Python
     hasn't compiled without ‘long long’ for years, so this is basically
     a formality.

   - bpo-27355(26): Removed support for Windows CE. It was never
     finished, and Windows CE is no longer a relevant platform for
     Python.

   - Implement PEP 523(27).

   - bpo-27870(28): A left shift of zero by a large integer no longer
     attempts to allocate large amounts of memory.

   - bpo-25402(29): In int-to-decimal-string conversion, improve the
     estimate of the intermediate memory required, and remove an
     unnecessarily strict overflow check.  Patch by Serhiy Storchaka.

   - bpo-27214(30): In long_invert, be more careful about modifying
     object returned by long_add, and remove an unnecessary check for
     small longs.  Thanks Oren Milman for analysis and patch.

   - bpo-27506(31): Support passing the bytes/bytearray.translate()
     "delete" argument by keyword.

   - bpo-27812(32): Properly clear out a generator's frame's
     backreference to the generator to prevent crashes in frame.clear().

   - bpo-27811(33): Fix a crash when a coroutine that has not been
     awaited is finalized with warnings-as-errors enabled.

   - bpo-27587(34): Fix another issue found by PVS-Studio: Null pointer
     check after use of 'def' in _PyState_AddModule().  Initial patch by
     Christian Heimes.

   - bpo-27792(35): The modulo operation applied to ‘bool’ and other
     ‘int’ subclasses now always returns an ‘int’.  Previously the
     return type depended on the input values.  Patch by Xiang Zhang.

   - bpo-26984(36): int() now always returns an instance of exact int.

   - bpo-25604(37): Fix a minor bug in integer true division; this bug
     could potentially have caused off-by-one-ulp results on platforms
     with unreliable ldexp implementations.

   - bpo-24254(38): Make class definition namespace ordered by default.

   - bpo-27662(39): Fix an overflow check in ‘List_New’: the original
     code was checking against ‘Py_SIZE_MAX’ instead of the correct
     upper bound of ‘Py_SSIZE_T_MAX’.  Patch by Xiang Zhang.

   - bpo-27782(40): Multi-phase extension module import now correctly
     allows the ‘m_methods’ field to be used to add module level
     functions to instances of non-module types returned from
     ‘Py_create_mod’.  Patch by Xiang Zhang.

   - bpo-27936(41): The round() function accepted a second None argument
     for some types but not for others.  Fixed the inconsistency by
     accepting None for all numeric types.

   - bpo-27487(42): Warn if a submodule argument to "python -m" or
     runpy.run_module() is found in sys.modules after parent packages
     are imported, but before the submodule is executed.

   - bpo-27157(43): Make only type() itself accept the one-argument
     form.  Patch by Eryk Sun and Emanuel Barry.

   - bpo-27558(44): Fix a SystemError in the implementation of "raise"
     statement.  In a brand new thread, raise a RuntimeError since there
     is no active exception to reraise.  Patch written by Xiang Zhang.

   - bpo-28008(45): Implement PEP 530(46) - asynchronous comprehensions.

   - bpo-27942(47): Fix memory leak in codeobject.c

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23722

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25221

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27080

   (4) https://peps.python.org/pep-0515/

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27199

   (6) https://bugs.python.org/issue?@action=redirect&bpo=27948

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28046

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28071

   (9) https://bugs.python.org/issue?@action=redirect&bpo=25758

   (10) https://bugs.python.org/issue?@action=redirect&bpo=25856

   (11) https://bugs.python.org/issue?@action=redirect&bpo=27213

   (12) https://bugs.python.org/issue?@action=redirect&bpo=26331

   (13) https://peps.python.org/pep-0515/

   (14) https://bugs.python.org/issue?@action=redirect&bpo=27999

   (15) https://bugs.python.org/issue?@action=redirect&bpo=28003

   (16) https://peps.python.org/pep-0525/

   (17) https://bugs.python.org/issue?@action=redirect&bpo=27985

   (18) https://peps.python.org/pep-0526/

   (19) https://bugs.python.org/issue?@action=redirect&bpo=26058

   (20) https://bugs.python.org/issue?@action=redirect&bpo=27364

   (21) https://bugs.python.org/issue?@action=redirect&bpo=27350

   (22) https://bugs.python.org/issue?@action=redirect&bpo=27911

   (23) https://bugs.python.org/issue?@action=redirect&bpo=27078

   (24) https://bugs.python.org/issue?@action=redirect&bpo=17884

   (25) https://bugs.python.org/issue?@action=redirect&bpo=27961

   (26) https://bugs.python.org/issue?@action=redirect&bpo=27355

   (27) https://peps.python.org/pep-0523/

   (28) https://bugs.python.org/issue?@action=redirect&bpo=27870

   (29) https://bugs.python.org/issue?@action=redirect&bpo=25402

   (30) https://bugs.python.org/issue?@action=redirect&bpo=27214

   (31) https://bugs.python.org/issue?@action=redirect&bpo=27506

   (32) https://bugs.python.org/issue?@action=redirect&bpo=27812

   (33) https://bugs.python.org/issue?@action=redirect&bpo=27811

   (34) https://bugs.python.org/issue?@action=redirect&bpo=27587

   (35) https://bugs.python.org/issue?@action=redirect&bpo=27792

   (36) https://bugs.python.org/issue?@action=redirect&bpo=26984

   (37) https://bugs.python.org/issue?@action=redirect&bpo=25604

   (38) https://bugs.python.org/issue?@action=redirect&bpo=24254

   (39) https://bugs.python.org/issue?@action=redirect&bpo=27662

   (40) https://bugs.python.org/issue?@action=redirect&bpo=27782

   (41) https://bugs.python.org/issue?@action=redirect&bpo=27936

   (42) https://bugs.python.org/issue?@action=redirect&bpo=27487

   (43) https://bugs.python.org/issue?@action=redirect&bpo=27157

   (44) https://bugs.python.org/issue?@action=redirect&bpo=27558

   (45) https://bugs.python.org/issue?@action=redirect&bpo=28008

   (46) https://peps.python.org/pep-0530/

   (47) https://bugs.python.org/issue?@action=redirect&bpo=27942


File: python.info,  Node: ライブラリ<185>,  Next: IDLE<52>,  Prev: Core and Builtins<182>,  Up: Python 3 6 0 beta 1

1.24.93.2 ライブラリ
....................

   - bpo-28732(1): Fix crash in os.spawnv() with no elements in args

   - bpo-28485(2): Always raise ValueError for negative
     compileall.compile_dir(workers=...)  parameter, even when
     multithreading is unavailable.

   - bpo-28037(3): Use sqlite3_get_autocommit() instead of setting
     Connection->inTransaction manually.

   - bpo-25283(4): Attributes tm_gmtoff and tm_zone are now available on
     all platforms in the return values of time.localtime() and
     time.gmtime().

   - bpo-24454(5): Regular expression match object groups are now
     accessible using __getitem__.  "mo[x]" is equivalent to
     "mo.group(x)".

   - bpo-10740(6): sqlite3 no longer implicitly commit an open
     transaction before DDL statements.

   - bpo-17941(7): Add a 'module' parameter to collections.namedtuple().

   - bpo-22493(8): Inline flags now should be used only at the start of
     the regular expression.  Deprecation warning is emitted if uses
     them in the middle of the regular expression.

   - bpo-26885(9): xmlrpc now supports unmarshalling additional data
     types used by Apache XML-RPC implementation for numerics and None.

   - bpo-28070(10): Fixed parsing inline verbose flag in regular
     expressions.

   - bpo-19500(11): Add client-side SSL session resumption to the ssl
     module.

   - bpo-28022(12): Deprecate ssl-related arguments in favor of
     SSLContext.  The deprecation include manual creation of SSLSocket
     and certfile/keyfile (or similar) in ftplib, httplib, imaplib,
     smtplib, poplib and urllib.

   - bpo-28043(13): SSLContext has improved default settings:
     OP_NO_SSLv2, OP_NO_SSLv3, OP_NO_COMPRESSION,
     OP_CIPHER_SERVER_PREFERENCE, OP_SINGLE_DH_USE, OP_SINGLE_ECDH_USE
     and HIGH ciphers without MD5.

   - bpo-24693(14): Changed some RuntimeError's in the zipfile module to
     more appropriate types.  Improved some error messages and debugging
     output.

   - bpo-17909(15): ‘json.load’ and ‘json.loads’ now support binary
     input encoded as UTF-8, UTF-16 or UTF-32.  Patch by Serhiy
     Storchaka.

   - bpo-27137(16): the pure Python fallback implementation of
     ‘functools.partial’ now matches the behaviour of its accelerated C
     counterpart for subclassing, pickling and text representation
     purposes.  Patch by Emanuel Barry and Serhiy Storchaka.

   - Fix possible integer overflows and crashes in the mmap module with
     unusual usage patterns.

   - bpo-1703178(17): Fix the ability to pass the -link-objects option
     to the distutils build_ext command.

   - bpo-28019(18): itertools.count() no longer rounds non-integer step
     in range between 1.0 and 2.0 to 1.

   - bpo-18401(19): Pdb now supports the 'readrc' keyword argument to
     control whether .pdbrc files should be read.  Patch by Martin
     Matusiak and Sam Kimbrel.

   - bpo-25969(20): Update the lib2to3 grammar to handle the unpacking
     generalizations added in 3.5.

   - bpo-14977(21): mailcap now respects the order of the lines in the
     mailcap files ("first match"), as required by RFC 1542.  Patch by
     Michael Lazar.

   - bpo-28082(22): Convert re flag constants to IntFlag.

   - bpo-28025(23): Convert all ssl module constants to IntEnum and
     IntFlags.  SSLContext properties now return flags and enums.

   - bpo-23591(24): Add Flag, IntFlag, and auto() to enum module.

   - bpo-433028(25): Added support of modifier spans in regular
     expressions.

   - bpo-24594(26): Validates persist parameter when opening MSI
     database

   - bpo-17582(27): xml.etree.ElementTree nows preserves whitespaces in
     attributes (Patch by Duane Griffin.  Reviewed and approved by
     Stefan Behnel.)

   - bpo-28047(28): Fixed calculation of line length used for the base64
     CTE in the new email policies.

   - bpo-27576(29): Fix call order in OrderedDict.__init__().

   - email.generator.DecodedGenerator now supports the policy keyword.

   - bpo-28027(30): Remove undocumented modules from ‘Lib/plat-*’: IN,
     CDROM, DLFCN, TYPES, CDIO, and STROPTS.

   - bpo-27445(31): Don't pass str(_charset) to MIMEText.set_payload().
     Patch by Claude Paroz.

   - bpo-24277(32): The new email API is no longer provisional, and the
     docs have been reorganized and rewritten to emphasize the new API.

   - bpo-22450(33): urllib now includes an ‘Accept: */*’ header among
     the default headers.  This makes the results of REST API requests
     more consistent and predictable especially when proxy servers are
     involved.

   - lib2to3.pgen3.driver.load_grammar() now creates a stable cache file
     between runs given the same Grammar.txt input regardless of the
     hash randomization setting.

   - bpo-28005(34): Allow ImportErrors in encoding implementation to
     propagate.

   - bpo-26667(35): Support path-like objects in importlib.util.

   - bpo-27570(36): Avoid zero-length memcpy() etc calls with null
     source pointers in the "ctypes" and "array" modules.

   - bpo-22233(37): Break email header lines 'only' on the RFC specified
     CR and LF characters, not on arbitrary unicode line breaks.  This
     also fixes a bug in HTTP header parsing.

   - bpo-27331(38): The email.mime classes now all accept an optional
     policy keyword.

   - bpo-27988(39): Fix email iter_attachments incorrect mutation of
     payload list.

   - bpo-16113(40): Add SHA-3 and SHAKE support to hashlib module.

   - Eliminate a tautological-pointer-compare warning in _scproxy.c.

   - bpo-27776(41): The *note os.urandom(): 746. function does now block
     on Linux 3.17 and newer until the system urandom entropy pool is
     initialized to increase the security.  This change is part of the
     PEP 524(42).

   - bpo-27778(43): Expose the Linux ‘getrandom()’ syscall as a new
     *note os.getrandom(): eb9. function.  This change is part of the
     PEP 524(44).

   - bpo-27691(45): Fix ssl module's parsing of GEN_RID subject
     alternative name fields in X.509 certs.

   - bpo-18844(46): Add random.choices().

   - bpo-25761(47): Improved error reporting about truncated pickle data
     in C implementation of unpickler.  UnpicklingError is now raised
     instead of AttributeError and ValueError in some cases.

   - bpo-26798(48): Add BLAKE2 (blake2b and blake2s) to hashlib.

   - bpo-26032(49): Optimized globbing in pathlib by using os.scandir();
     it is now about 1.5-4 times faster.

   - bpo-25596(50): Optimized glob() and iglob() functions in the glob
     module; they are now about 3-6 times faster.

   - bpo-27928(51): Add scrypt (password-based key derivation function)
     to hashlib module (requires OpenSSL 1.1.0).

   - bpo-27850(52): Remove 3DES from ssl module's default cipher list to
     counter measure sweet32 attack ( CVE 2016-2183(53)).

   - bpo-27766(54): Add ChaCha20 Poly1305 to ssl module's default cipher
     list.  (Required OpenSSL 1.1.0 or LibreSSL).

   - bpo-25387(55): Check return value of winsound.MessageBeep.

   - bpo-27866(56): Add SSLContext.get_ciphers() method to get a list of
     all enabled ciphers.

   - bpo-27744(57): Add AF_ALG (Linux Kernel crypto) to socket module.

   - bpo-26470(58): Port ssl and hashlib module to OpenSSL 1.1.0.

   - bpo-11620(59): Fix support for SND_MEMORY in winsound.PlaySound.
     Based on a patch by Tim Lesher.

   - bpo-11734(60): Add support for IEEE 754 half-precision floats to
     the struct module.  Based on a patch by Eli Stevens.

   - bpo-27919(61): Deprecated ‘extra_path’ distribution option in
     distutils packaging.

   - bpo-23229(62): Add new ‘cmath’ constants: ‘cmath.inf’ and
     ‘cmath.nan’ to match ‘math.inf’ and ‘math.nan’, and also
     ‘cmath.infj’ and ‘cmath.nanj’ to match the format used by complex
     repr.

   - bpo-27842(63): The csv.DictReader now returns rows of type
     OrderedDict.  (Contributed by Steve Holden.)

   - Remove support for passing a file descriptor to os.access.  It
     never worked but previously didn't raise.

   - bpo-12885(64): Fix error when distutils encounters symlink.

   - bpo-27881(65): Fixed possible bugs when setting
     sqlite3.Connection.isolation_level.  Based on patch by Xiang Zhang.

   - bpo-27861(66): Fixed a crash in sqlite3.Connection.cursor() when a
     factory creates not a cursor.  Patch by Xiang Zhang.

   - bpo-19884(67): Avoid spurious output on OS X with Gnu Readline.

   - bpo-27706(68): Restore deterministic behavior of
     random.Random().seed() for string seeds using seeding version 1.
     Allows sequences of calls to random() to exactly match those
     obtained in Python 2.  Patch by Nofar Schnider.

   - bpo-10513(69): Fix a regression in Connection.commit().  Statements
     should not be reset after a commit.

   - bpo-12319(70): Chunked transfer encoding support added to
     http.client.HTTPConnection requests.  The
     urllib.request.AbstractHTTPHandler class does not enforce a
     Content-Length header any more.  If a HTTP request has a file or
     iterable body, but no Content-Length header, the library now falls
     back to use chunked transfer-encoding.

   - A new version of typing.py from ‘https://github.com/python/typing’:
     - Collection (only for 3.6) (bpo-27598(71)) - Add FrozenSet to
     __all__ (upstream #261) - fix crash in _get_type_vars() (upstream
     #259) - Remove the dict constraint in ForwardRef._eval_type
     (upstream #252)

   - bpo-27832(72): Make ‘_normalize’ parameter to ‘Fraction’
     constructor keyword-only, so that ‘Fraction(2, 3, 4)’ now raises
     ‘TypeError’.

   - bpo-27539(73): Fix unnormalised ‘Fraction.__pow__’ result in the
     case of negative exponent and negative base.

   - bpo-21718(74): cursor.description is now available for queries
     using CTEs.

   - bpo-27819(75): In distutils sdists, simply produce the "gztar"
     (gzipped tar format) distributions on all platforms unless
     "formats" is supplied.

   - bpo-2466(76): posixpath.ismount now correctly recognizes mount
     points which the user does not have permission to access.

   - bpo-9998(77): On Linux, ctypes.util.find_library now looks in
     LD_LIBRARY_PATH for shared libraries.

   - bpo-27573(78): exit message for code.interact is now configurable.

   - bpo-27930(79): Improved behaviour of
     logging.handlers.QueueListener.  Thanks to Paulo Andrade and Petr
     Viktorin for the analysis and patch.

   - bpo-6766(80): Distributed reference counting added to
     multiprocessing to support nesting of shared values / proxy
     objects.

   - bpo-21201(81): Improves readability of multiprocessing error
     message.  Thanks to Wojciech Walczak for patch.

   - asyncio: Add set_protocol / get_protocol to Transports.

   - bpo-27456(82): asyncio: Set TCP_NODELAY by default.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28732

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28485

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28037

   (4) https://bugs.python.org/issue?@action=redirect&bpo=25283

   (5) https://bugs.python.org/issue?@action=redirect&bpo=24454

   (6) https://bugs.python.org/issue?@action=redirect&bpo=10740

   (7) https://bugs.python.org/issue?@action=redirect&bpo=17941

   (8) https://bugs.python.org/issue?@action=redirect&bpo=22493

   (9) https://bugs.python.org/issue?@action=redirect&bpo=26885

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28070

   (11) https://bugs.python.org/issue?@action=redirect&bpo=19500

   (12) https://bugs.python.org/issue?@action=redirect&bpo=28022

   (13) https://bugs.python.org/issue?@action=redirect&bpo=28043

   (14) https://bugs.python.org/issue?@action=redirect&bpo=24693

   (15) https://bugs.python.org/issue?@action=redirect&bpo=17909

   (16) https://bugs.python.org/issue?@action=redirect&bpo=27137

   (17) https://bugs.python.org/issue?@action=redirect&bpo=1703178

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28019

   (19) https://bugs.python.org/issue?@action=redirect&bpo=18401

   (20) https://bugs.python.org/issue?@action=redirect&bpo=25969

   (21) https://bugs.python.org/issue?@action=redirect&bpo=14977

   (22) https://bugs.python.org/issue?@action=redirect&bpo=28082

   (23) https://bugs.python.org/issue?@action=redirect&bpo=28025

   (24) https://bugs.python.org/issue?@action=redirect&bpo=23591

   (25) https://bugs.python.org/issue?@action=redirect&bpo=433028

   (26) https://bugs.python.org/issue?@action=redirect&bpo=24594

   (27) https://bugs.python.org/issue?@action=redirect&bpo=17582

   (28) https://bugs.python.org/issue?@action=redirect&bpo=28047

   (29) https://bugs.python.org/issue?@action=redirect&bpo=27576

   (30) https://bugs.python.org/issue?@action=redirect&bpo=28027

   (31) https://bugs.python.org/issue?@action=redirect&bpo=27445

   (32) https://bugs.python.org/issue?@action=redirect&bpo=24277

   (33) https://bugs.python.org/issue?@action=redirect&bpo=22450

   (34) https://bugs.python.org/issue?@action=redirect&bpo=28005

   (35) https://bugs.python.org/issue?@action=redirect&bpo=26667

   (36) https://bugs.python.org/issue?@action=redirect&bpo=27570

   (37) https://bugs.python.org/issue?@action=redirect&bpo=22233

   (38) https://bugs.python.org/issue?@action=redirect&bpo=27331

   (39) https://bugs.python.org/issue?@action=redirect&bpo=27988

   (40) https://bugs.python.org/issue?@action=redirect&bpo=16113

   (41) https://bugs.python.org/issue?@action=redirect&bpo=27776

   (42) https://peps.python.org/pep-0524/

   (43) https://bugs.python.org/issue?@action=redirect&bpo=27778

   (44) https://peps.python.org/pep-0524/

   (45) https://bugs.python.org/issue?@action=redirect&bpo=27691

   (46) https://bugs.python.org/issue?@action=redirect&bpo=18844

   (47) https://bugs.python.org/issue?@action=redirect&bpo=25761

   (48) https://bugs.python.org/issue?@action=redirect&bpo=26798

   (49) https://bugs.python.org/issue?@action=redirect&bpo=26032

   (50) https://bugs.python.org/issue?@action=redirect&bpo=25596

   (51) https://bugs.python.org/issue?@action=redirect&bpo=27928

   (52) https://bugs.python.org/issue?@action=redirect&bpo=27850

   (53) https://www.cve.org/CVERecord?id=CVE-2016-2183

   (54) https://bugs.python.org/issue?@action=redirect&bpo=27766

   (55) https://bugs.python.org/issue?@action=redirect&bpo=25387

   (56) https://bugs.python.org/issue?@action=redirect&bpo=27866

   (57) https://bugs.python.org/issue?@action=redirect&bpo=27744

   (58) https://bugs.python.org/issue?@action=redirect&bpo=26470

   (59) https://bugs.python.org/issue?@action=redirect&bpo=11620

   (60) https://bugs.python.org/issue?@action=redirect&bpo=11734

   (61) https://bugs.python.org/issue?@action=redirect&bpo=27919

   (62) https://bugs.python.org/issue?@action=redirect&bpo=23229

   (63) https://bugs.python.org/issue?@action=redirect&bpo=27842

   (64) https://bugs.python.org/issue?@action=redirect&bpo=12885

   (65) https://bugs.python.org/issue?@action=redirect&bpo=27881

   (66) https://bugs.python.org/issue?@action=redirect&bpo=27861

   (67) https://bugs.python.org/issue?@action=redirect&bpo=19884

   (68) https://bugs.python.org/issue?@action=redirect&bpo=27706

   (69) https://bugs.python.org/issue?@action=redirect&bpo=10513

   (70) https://bugs.python.org/issue?@action=redirect&bpo=12319

   (71) https://bugs.python.org/issue?@action=redirect&bpo=27598

   (72) https://bugs.python.org/issue?@action=redirect&bpo=27832

   (73) https://bugs.python.org/issue?@action=redirect&bpo=27539

   (74) https://bugs.python.org/issue?@action=redirect&bpo=21718

   (75) https://bugs.python.org/issue?@action=redirect&bpo=27819

   (76) https://bugs.python.org/issue?@action=redirect&bpo=2466

   (77) https://bugs.python.org/issue?@action=redirect&bpo=9998

   (78) https://bugs.python.org/issue?@action=redirect&bpo=27573

   (79) https://bugs.python.org/issue?@action=redirect&bpo=27930

   (80) https://bugs.python.org/issue?@action=redirect&bpo=6766

   (81) https://bugs.python.org/issue?@action=redirect&bpo=21201

   (82) https://bugs.python.org/issue?@action=redirect&bpo=27456


File: python.info,  Node: IDLE<52>,  Next: C API<71>,  Prev: ライブラリ<185>,  Up: Python 3 6 0 beta 1

1.24.93.3 IDLE
..............

   - bpo-15308(1): Add 'interrupt execution' (^C) to Shell menu.  Patch
     by Roger Serwy, updated by Bayard Randel.

   - bpo-27922(2): Stop IDLE tests from 'flashing' gui widgets on the
     screen.

   - bpo-27891(3): Consistently group and sort imports within idlelib
     modules.

   - bpo-17642(4): add larger font sizes for classroom projection.

   - Add version to title of IDLE help window.

   - bpo-25564(5): In section on IDLE - console differences, mention
     that using exec means that __builtins__ is defined for each
     statement.

   - bpo-27821(6): Fix 3.6.0a3 regression that prevented custom key sets
     from being selected when no custom theme was defined.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15308

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27922

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27891

   (4) https://bugs.python.org/issue?@action=redirect&bpo=17642

   (5) https://bugs.python.org/issue?@action=redirect&bpo=25564

   (6) https://bugs.python.org/issue?@action=redirect&bpo=27821


File: python.info,  Node: C API<71>,  Next: テスト<73>,  Prev: IDLE<52>,  Up: Python 3 6 0 beta 1

1.24.93.4 C API
...............

   - bpo-26900(1): Excluded underscored names and other private API from
     limited API.

   - bpo-26027(2): Add support for path-like objects in
     PyUnicode_FSConverter() & PyUnicode_FSDecoder().

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26900

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26027


File: python.info,  Node: テスト<73>,  Next: ビルド<84>,  Prev: C API<71>,  Up: Python 3 6 0 beta 1

1.24.93.5 テスト
................

   - bpo-27427(1): Additional tests for the math module.  Patch by
     Francisco Couzo.

   - bpo-27953(2): Skip math and cmath tests that fail on OS X 10.4 due
     to a poor libm implementation of tan.

   - bpo-26040(3): Improve test_math and test_cmath coverage and rigour.
     Patch by Jeff Allen.

   - bpo-27787(4): Call gc.collect() before checking each test for
     "dangling threads", since the dangling threads are weak references.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27427

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27953

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26040

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27787


File: python.info,  Node: ビルド<84>,  Next: Tools/Demos<51>,  Prev: テスト<73>,  Up: Python 3 6 0 beta 1

1.24.93.6 ビルド
................

   - bpo-27566(1): Fix clean target in freeze makefile (patch by Lisa
     Roach)

   - bpo-27705(2): Update message in validate_ucrtbase.py

   - bpo-27976(3): Deprecate building _ctypes with the bundled copy of
     libffi on non-OSX UNIX platforms.

   - bpo-27983(4): Cause lack of llvm-profdata tool when using clang as
     required for PGO linking to be a configure time error rather than
     make time when ‘--with-optimizations’ is enabled.  Also improve our
     ability to find the llvm-profdata tool on MacOS and some Linuxes.

   - bpo-21590(5): Support for DTrace and SystemTap probes.

   - bpo-26307(6): The profile-opt build now applies PGO to the built-in
     modules.

   - bpo-26359(7): Add the -with-optimizations flag to turn on LTO and
     PGO build support when available.

   - bpo-27917(8): Set platform triplets for Android builds.

   - bpo-25825(9): Update references to the $(LIBPL) installation path
     on AIX. This path was changed in 3.2a4.

   - Update OS X installer to use SQLite 3.14.1 and XZ 5.2.2.

   - bpo-21122(10): Fix LTO builds on OS X.

   - bpo-17128(11): Build OS X installer with a private copy of OpenSSL.
     Also provide a sample Install Certificates command script to
     install a set of root certificates from the third-party certifi
     module.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27566

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27705

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27976

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27983

   (5) https://bugs.python.org/issue?@action=redirect&bpo=21590

   (6) https://bugs.python.org/issue?@action=redirect&bpo=26307

   (7) https://bugs.python.org/issue?@action=redirect&bpo=26359

   (8) https://bugs.python.org/issue?@action=redirect&bpo=27917

   (9) https://bugs.python.org/issue?@action=redirect&bpo=25825

   (10) https://bugs.python.org/issue?@action=redirect&bpo=21122

   (11) https://bugs.python.org/issue?@action=redirect&bpo=17128


File: python.info,  Node: Tools/Demos<51>,  Next: Windows<73>,  Prev: ビルド<84>,  Up: Python 3 6 0 beta 1

1.24.93.7 Tools/Demos
.....................

   - bpo-27952(1): Get Tools/scripts/fixcid.py working with Python 3 and
     the current "re" module, avoid invalid Python backslash escapes,
     and fix a bug parsing escaped C quote signs.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27952


File: python.info,  Node: Windows<73>,  Prev: Tools/Demos<51>,  Up: Python 3 6 0 beta 1

1.24.93.8 Windows
.................

   - bpo-28065(1): Update xz dependency to 5.2.2 and build it from
     source.

   - bpo-25144(2): Ensures TargetDir is set before continuing with
     custom install.

   - bpo-1602(3): Windows console doesn't input or print Unicode (PEP
     528)

   - bpo-27781(4): Change file system encoding on Windows to UTF-8 (PEP
     529)

   - bpo-27731(5): Opt-out of MAX_PATH on Windows 10

   - bpo-6135(6): Adds encoding and errors parameters to subprocess.

   - bpo-27959(7): Adds oem encoding, alias ansi to mbcs, move aliasmbcs
     to codec lookup.

   - bpo-27982(8): The functions of the winsound module now accept
     keyword arguments.

   - bpo-20366(9): Build full text search support into SQLite on
     Windows.

   - bpo-27756(10): Adds new icons for Python files and processes on
     Windows.  Designs by Cherry Wang.

   - bpo-27883(11): Update sqlite to 3.14.1.0 on Windows.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28065

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25144

   (3) https://bugs.python.org/issue?@action=redirect&bpo=1602

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27781

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27731

   (6) https://bugs.python.org/issue?@action=redirect&bpo=6135

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27959

   (8) https://bugs.python.org/issue?@action=redirect&bpo=27982

   (9) https://bugs.python.org/issue?@action=redirect&bpo=20366

   (10) https://bugs.python.org/issue?@action=redirect&bpo=27756

   (11) https://bugs.python.org/issue?@action=redirect&bpo=27883


File: python.info,  Node: Python 3 6 0 alpha 4,  Next: Python 3 6 0 alpha 3,  Prev: Python 3 6 0 beta 1,  Up: 変更履歴

1.24.94 Python 3.6.0 alpha 4
----------------------------

'Release date: 2016-08-15'

* Menu:

* Core and Builtins: Core and Builtins<183>.
* ライブラリ: ライブラリ<186>.
* IDLE: IDLE<53>.
* テスト: テスト<74>.
* Windows: Windows<74>.
* ビルド: ビルド<85>.


File: python.info,  Node: Core and Builtins<183>,  Next: ライブラリ<186>,  Up: Python 3 6 0 alpha 4

1.24.94.1 Core and Builtins
...........................

   - bpo-27704(1): Optimized creating bytes and bytearray from byte-like
     objects and iterables.  Speed up to 3 times for short objects.
     Original patch by Naoki Inada.

   - bpo-26823(2): Large sections of repeated lines in tracebacks are
     now abbreviated as "[Previous line repeated {count} more times]" by
     the builtin traceback rendering.  Patch by Emanuel Barry.

   - bpo-27574(3): Decreased an overhead of parsing keyword arguments in
     functions implemented with using Argument Clinic.

   - bpo-22557(4): Now importing already imported modules is up to 2.5
     times faster.

   - bpo-17596(5): Include <wincrypt.h> to help with Min GW building.

   - bpo-17599(6): On Windows, rename the privately defined
     REPARSE_DATA_BUFFER structure to avoid conflicting with the
     definition from Min GW.

   - bpo-27507(7): Add integer overflow check in bytearray.extend().
     Patch by Xiang Zhang.

   - bpo-27581(8): Don't rely on wrapping for overflow check in
     PySequence_Tuple().  Patch by Xiang Zhang.

   - bpo-1621(9): Avoid signed integer overflow in list and tuple
     operations.  Patch by Xiang Zhang.

   - bpo-27419(10): Standard __import__() no longer look up "__import__"
     in globals or builtins for importing submodules or "from import".
     Fixed a crash if raise a warning about unabling to resolve package
     from __spec__ or __package__.

   - bpo-27083(11): Respect the PYTHONCASEOK environment variable under
     Windows.

   - bpo-27514(12): Make having too many statically nested blocks a
     SyntaxError instead of SystemError.

   - bpo-27366(13): Implemented PEP 487(14) (Simpler customization of
     class creation).  Upon subclassing, the __init_subclass__
     classmethod is called on the base class.  Descriptors are
     initialized with __set_name__ after class creation.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27704

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26823

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27574

   (4) https://bugs.python.org/issue?@action=redirect&bpo=22557

   (5) https://bugs.python.org/issue?@action=redirect&bpo=17596

   (6) https://bugs.python.org/issue?@action=redirect&bpo=17599

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27507

   (8) https://bugs.python.org/issue?@action=redirect&bpo=27581

   (9) https://bugs.python.org/issue?@action=redirect&bpo=1621

   (10) https://bugs.python.org/issue?@action=redirect&bpo=27419

   (11) https://bugs.python.org/issue?@action=redirect&bpo=27083

   (12) https://bugs.python.org/issue?@action=redirect&bpo=27514

   (13) https://bugs.python.org/issue?@action=redirect&bpo=27366

   (14) https://peps.python.org/pep-0487/


File: python.info,  Node: ライブラリ<186>,  Next: IDLE<53>,  Prev: Core and Builtins<183>,  Up: Python 3 6 0 alpha 4

1.24.94.2 ライブラリ
....................

   - bpo-26027(1): Add PEP 519(2)/__fspath__() support to the os and
     os.path modules.  Includes code from Jelle Zijlstra.  (See also:
     bpo-27524(3))

   - bpo-27598(4): Add Collections to collections.abc.  Patch by Ivan
     Levkivskyi, docs by Neil Girdhar.

   - bpo-25958(5): Support "anti-registration" of special methods from
     various ABCs, like __hash__, __iter__ or __len__.  All these (and
     several more) can be set to None in an implementation class and the
     behavior will be as if the method is not defined at all.
     (Previously, this mechanism existed only for __hash__, to make
     mutable classes unhashable.)  Code contributed by Andrew Barnert
     and Ivan Levkivskyi.

   - bpo-16764(6): Support keyword arguments to zlib.decompress().
     Patch by Xiang Zhang.

   - bpo-27736(7): Prevent segfault after interpreter re-initialization
     due to ref count problem introduced in code for bpo-27038(8) in
     3.6.0a3.  Patch by Xiang Zhang.

   - bpo-25628(9): The 'verbose' and 'rename' parameters for
     collections.namedtuple are now keyword-only.

   - bpo-12345(10): Add mathematical constant tau to math and cmath.
     See also PEP 628(11).

   - bpo-26823(12): traceback.StackSummary.format now abbreviates large
     sections of repeated lines as "[Previous line repeated {count} more
     times]" (this change then further affects other traceback display
     operations in the module).  Patch by Emanuel Barry.

   - bpo-27664(13): Add to
     concurrent.futures.thread.ThreadPoolExecutor() the ability to
     specify a thread name prefix.

   - bpo-27181(14): Add geometric_mean and harmonic_mean to statistics
     module.

   - bpo-27573(15): code.interact now prints an message when exiting.

   - bpo-6422(16): Add autorange method to timeit.Timer objects.

   - bpo-27773(17): Correct some memory management errors
     server_hostname in _ssl.wrap_socket().

   - bpo-26750(18): unittest.mock.create_autospec() now works properly
     for subclasses of property() and other data descriptors.  Removes
     the never publicly used, never documented
     unittest.mock.DescriptorTypes tuple.

   - bpo-26754(19): Undocumented support of general bytes-like objects
     as path in compile() and similar functions is now deprecated.

   - bpo-26800(20): Undocumented support of general bytes-like objects
     as paths in os functions is now deprecated.

   - bpo-26981(21): Add _order_ compatibility shim to enum.Enum for
     Python 2/3 code bases.

   - bpo-27661(22): Added tzinfo keyword argument to datetime.combine.

   - In the curses module, raise an error if window.getstr() or
     window.instr() is passed a negative value.

   - bpo-27783(23): Fix possible usage of uninitialized memory in
     operator.methodcaller.

   - bpo-27774(24): Fix possible Py_DECREF on unowned object in _sre.

   - bpo-27760(25): Fix possible integer overflow in binascii.b2a_qp.

   - bpo-27758(26): Fix possible integer overflow in the _csv module for
     large record lengths.

   - bpo-27568(27): Prevent HTTPoxy attack ( CVE 2016-1000110(28)).
     Ignore the HTTP_PROXY variable when REQUEST_METHOD environment is
     set, which indicates that the script is in CGI mode.

   - bpo-7063(29): Remove dead code from the "array" module's slice
     handling.  Patch by Chuck.

   - bpo-27656(30): Do not assume sched.h defines any SCHED_* constants.

   - bpo-27130(31): In the "zlib" module, fix handling of large buffers
     (typically 4 GiB) when compressing and decompressing.  Previously,
     inputs were limited to 4 GiB, and compression and decompression
     operations did not properly handle results of 4 GiB.

   - bpo-24773(32): Implemented PEP 495(33) (Local Time Disambiguation).

   - Expose the EPOLLEXCLUSIVE constant (when it is defined) in the
     select module.

   - bpo-27567(34): Expose the EPOLLRDHUP and POLLRDHUP constants in the
     select module.

   - bpo-1621(35): Avoid signed int negation overflow in the "audioop"
     module.

   - bpo-27533(36): Release GIL in nt._isdir

   - bpo-17711(37): Fixed unpickling by the persistent ID with protocol
     0.  Original patch by Alexandre Vassalotti.

   - bpo-27522(38): Avoid an unintentional reference cycle in
     email.feedparser.

   - bpo-27512(39): Fix a segfault when os.fspath() called an
     __fspath__() method that raised an exception.  Patch by Xiang
     Zhang.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26027

   (2) https://peps.python.org/pep-0519/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27524

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27598

   (5) https://bugs.python.org/issue?@action=redirect&bpo=25958

   (6) https://bugs.python.org/issue?@action=redirect&bpo=16764

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27736

   (8) https://bugs.python.org/issue?@action=redirect&bpo=27038

   (9) https://bugs.python.org/issue?@action=redirect&bpo=25628

   (10) https://bugs.python.org/issue?@action=redirect&bpo=12345

   (11) https://peps.python.org/pep-0628/

   (12) https://bugs.python.org/issue?@action=redirect&bpo=26823

   (13) https://bugs.python.org/issue?@action=redirect&bpo=27664

   (14) https://bugs.python.org/issue?@action=redirect&bpo=27181

   (15) https://bugs.python.org/issue?@action=redirect&bpo=27573

   (16) https://bugs.python.org/issue?@action=redirect&bpo=6422

   (17) https://bugs.python.org/issue?@action=redirect&bpo=27773

   (18) https://bugs.python.org/issue?@action=redirect&bpo=26750

   (19) https://bugs.python.org/issue?@action=redirect&bpo=26754

   (20) https://bugs.python.org/issue?@action=redirect&bpo=26800

   (21) https://bugs.python.org/issue?@action=redirect&bpo=26981

   (22) https://bugs.python.org/issue?@action=redirect&bpo=27661

   (23) https://bugs.python.org/issue?@action=redirect&bpo=27783

   (24) https://bugs.python.org/issue?@action=redirect&bpo=27774

   (25) https://bugs.python.org/issue?@action=redirect&bpo=27760

   (26) https://bugs.python.org/issue?@action=redirect&bpo=27758

   (27) https://bugs.python.org/issue?@action=redirect&bpo=27568

   (28) https://www.cve.org/CVERecord?id=CVE-2016-1000110

   (29) https://bugs.python.org/issue?@action=redirect&bpo=7063

   (30) https://bugs.python.org/issue?@action=redirect&bpo=27656

   (31) https://bugs.python.org/issue?@action=redirect&bpo=27130

   (32) https://bugs.python.org/issue?@action=redirect&bpo=24773

   (33) https://peps.python.org/pep-0495/

   (34) https://bugs.python.org/issue?@action=redirect&bpo=27567

   (35) https://bugs.python.org/issue?@action=redirect&bpo=1621

   (36) https://bugs.python.org/issue?@action=redirect&bpo=27533

   (37) https://bugs.python.org/issue?@action=redirect&bpo=17711

   (38) https://bugs.python.org/issue?@action=redirect&bpo=27522

   (39) https://bugs.python.org/issue?@action=redirect&bpo=27512


File: python.info,  Node: IDLE<53>,  Next: テスト<74>,  Prev: ライブラリ<186>,  Up: Python 3 6 0 alpha 4

1.24.94.3 IDLE
..............

   - bpo-27714(1): text_textview and test_autocomplete now pass when
     re-run in the same process.  This occurs when test_idle fails when
     run with the -w option but without -jn.  Fix warning from
     test_config.

   - bpo-27621(2): Put query response validation error messages in the
     query box itself instead of in a separate messagebox.  Redo tests
     to match.  Add Mac OSX refinements.  Original patch by Mark
     Roseman.

   - bpo-27620(3): Escape key now closes Query box as cancelled.

   - bpo-27609(4): IDLE: tab after initial whitespace should tab, not
     autocomplete.  This fixes problem with writing docstrings at least
     twice indented.

   - bpo-27609(5): Explicitly return None when there are also non-None
     returns.  In a few cases, reverse a condition and eliminate a
     return.

   - bpo-25507(6): IDLE no longer runs buggy code because of its tkinter
     imports.  Users must include the same imports required to run
     directly in Python.

   - bpo-27173(7): Add 'IDLE Modern Unix' to the built-in key sets.
     Make the default key set depend on the platform.  Add tests for the
     changes to the config module.

   - bpo-27452(8): add line counter and crc to IDLE configHandler test
     dump.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27714

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27621

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27620

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27609

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27609

   (6) https://bugs.python.org/issue?@action=redirect&bpo=25507

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27173

   (8) https://bugs.python.org/issue?@action=redirect&bpo=27452


File: python.info,  Node: テスト<74>,  Next: Windows<74>,  Prev: IDLE<53>,  Up: Python 3 6 0 alpha 4

1.24.94.4 テスト
................

   - bpo-25805(1): Skip a test in test_pkgutil as needed that doesn't
     work when ‘__name__ == __main__’.  Patch by SilentGhost.

   - bpo-27472(2): Add test.support.unix_shell as the path to the
     default shell.

   - bpo-27369(3): In test_pyexpat, avoid testing an error message
     detail that changed in Expat 2.2.0.

   - bpo-27594(4): Prevent assertion error when running test_ast with
     coverage enabled: ensure code object has a valid first line number.
     Patch suggested by Ivan Levkivskyi.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25805

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27472

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27369

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27594


File: python.info,  Node: Windows<74>,  Next: ビルド<85>,  Prev: テスト<74>,  Up: Python 3 6 0 alpha 4

1.24.94.5 Windows
.................

   - bpo-27647(1): Update bundled Tcl/Tk to 8.6.6.

   - bpo-27610(2): Adds PEP 514(3) metadata to Windows installer

   - bpo-27469(4): Adds a shell extension to the launcher so that drag
     and drop works correctly.

   - bpo-27309(5): Enables proper Windows styles in python[w].exe
     manifest.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27647

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27610

   (3) https://peps.python.org/pep-0514/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27469

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27309


File: python.info,  Node: ビルド<85>,  Prev: Windows<74>,  Up: Python 3 6 0 alpha 4

1.24.94.6 ビルド
................

   - bpo-27713(1): Suppress spurious build warnings when updating
     importlib's bootstrap files.  Patch by Xiang Zhang

   - bpo-25825(2): Correct the references to Modules/python.exp, which
     is required on AIX. The references were accidentally changed in
     3.5.0a1.

   - bpo-27453(3): CPP invocation in configure must use CPPFLAGS. Patch
     by Chi Hsuan Yen.

   - bpo-27641(4): The configure script now inserts comments into the
     makefile to prevent the pgen and _freeze_importlib executables from
     being cross-compiled.

   - bpo-26662(5): Set PYTHON_FOR_GEN in configure as the Python program
     to be used for file generation during the build.

   - bpo-10910(6): Avoid C++ compilation errors on FreeBSD and OS X.
     Also update FreedBSD version checks for the original ctype UTF-8
     workaround.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27713

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25825

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27453

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27641

   (5) https://bugs.python.org/issue?@action=redirect&bpo=26662

   (6) https://bugs.python.org/issue?@action=redirect&bpo=10910


File: python.info,  Node: Python 3 6 0 alpha 3,  Next: Python 3 6 0 alpha 2,  Prev: Python 3 6 0 alpha 4,  Up: 変更履歴

1.24.95 Python 3.6.0 alpha 3
----------------------------

'Release date: 2016-07-11'

* Menu:

* セキュリティ: セキュリティ<54>.
* Core and Builtins: Core and Builtins<184>.
* ライブラリ: ライブラリ<187>.
* IDLE: IDLE<54>.
* C API: C API<72>.
* ビルド: ビルド<86>.
* Tools/Demos: Tools/Demos<52>.
* ドキュメント: ドキュメント<75>.
* テスト: テスト<75>.


File: python.info,  Node: セキュリティ<54>,  Next: Core and Builtins<184>,  Up: Python 3 6 0 alpha 3

1.24.95.1 セキュリティ
......................

   - bpo-27278(1): Fix os.urandom() implementation using getrandom() on
     Linux.  Truncate size to INT_MAX and loop until we collected enough
     random bytes, instead of casting a directly Py_ssize_t to int.

   - bpo-22636(2): Avoid shell injection problems with
     ctypes.util.find_library().

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27278

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22636


File: python.info,  Node: Core and Builtins<184>,  Next: ライブラリ<187>,  Prev: セキュリティ<54>,  Up: Python 3 6 0 alpha 3

1.24.95.2 Core and Builtins
...........................

   - bpo-27473(1): Fixed possible integer overflow in bytes and
     bytearray concatenations.  Patch by Xiang Zhang.

   - bpo-23034(2): The output of a special Python build with defined
     COUNT_ALLOCS, SHOW_ALLOC_COUNT or SHOW_TRACK_COUNT macros is now
     off by default.  It can be re-enabled using the "-X showalloccount"
     option.  It now outputs to stderr instead of stdout.

   - bpo-27443(3): __length_hint__() of bytearray iterators no longer
     return a negative integer for a resized bytearray.

   - bpo-27007(4): The fromhex() class methods of bytes and bytearray
     subclasses now return an instance of corresponding subclass.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27473

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23034

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27443

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27007


File: python.info,  Node: ライブラリ<187>,  Next: IDLE<54>,  Prev: Core and Builtins<184>,  Up: Python 3 6 0 alpha 3

1.24.95.3 ライブラリ
....................

   - bpo-26844(1): Fix error message for imp.find_module() to refer to
     'path' instead of 'name'.  Patch by Lev Maximov.

   - bpo-23804(2): Fix SSL zero-length recv() calls to not block and not
     raise an error about unclean EOF.

   - bpo-27466(3): Change time format returned by
     http.cookie.time2netscape, confirming the netscape cookie format
     and making it consistent with documentation.

   - bpo-21708(4): Deprecated dbm.dumb behavior that differs from common
     dbm behavior: creating a database in 'r' and 'w' modes and
     modifying a database in 'r' mode.

   - bpo-26721(5): Change the socketserver.StreamRequestHandler.wfile
     attribute to implement BufferedIOBase.  In particular, the write()
     method no longer does partial writes.

   - bpo-22115(6): Added methods trace_add, trace_remove and trace_info
     in the tkinter.Variable class.  They replace old methods
     trace_variable, trace, trace_vdelete and trace_vinfo that use
     obsolete Tcl commands and might not work in future versions of Tcl.
     Fixed old tracing methods: trace_vdelete() with wrong mode no
     longer break tracing, trace_vinfo() now always returns a list of
     pairs of strings, tracing in the "u" mode now works.

   - bpo-26243(7): Only the level argument to zlib.compress() is keyword
     argument now.  The first argument is positional-only.

   - bpo-27038(8): Expose the DirEntry type as os.DirEntry.  Code patch
     by Jelle Zijlstra.

   - bpo-27186(9): Update os.fspath()/PyOS_FSPath() to check the return
     value of __fspath__() to be either str or bytes.

   - bpo-18726(10): All optional parameters of the dump(), dumps(),
     load() and loads() functions and JSONEncoder and JSONDecoder class
     constructors in the json module are now keyword-only.

   - bpo-27319(11): Methods selection_set(), selection_add(),
     selection_remove() and selection_toggle() of ttk.TreeView now allow
     passing multiple items as multiple arguments instead of passing
     them as a tuple.  Deprecated undocumented ability of calling the
     selection() method with arguments.

   - bpo-27079(12): Fixed curses.ascii functions isblank(), iscntrl()
     and ispunct().

   - bpo-27294(13): Numerical state in the repr for Tkinter event
     objects is now represented as a combination of known flags.

   - bpo-27177(14): Match objects in the re module now support
     index-like objects as group indices.  Based on patches by Jeroen
     Demeyer and Xiang Zhang.

   - bpo-26754(15): Some functions (compile() etc) accepted a filename
     argument encoded as an iterable of integers.  Now only strings and
     byte-like objects are accepted.

   - bpo-26536(16): socket.ioctl now supports SIO_LOOPBACK_FAST_PATH.
     Patch by Daniel Stokes.

   - bpo-27048(17): Prevents distutils failing on Windows when
     environment variables contain non-ASCII characters

   - bpo-27330(18): Fixed possible leaks in the ctypes module.

   - bpo-27238(19): Got rid of bare excepts in the turtle module.
     Original patch by Jelle Zijlstra.

   - bpo-27122(20): When an exception is raised within the context being
     managed by a contextlib.ExitStack() and one of the exit stack
     generators catches and raises it in a chain, do not re-raise the
     original exception when exiting, let the new chained one through.
     This avoids the PEP 479(21) bug described in issue25782.

   - bpo-16864(22): sqlite3.Cursor.lastrowid now supports REPLACE
     statement.  Initial patch by Alex LordThorsen.

   - bpo-26386(23): Fixed ttk.TreeView selection operations with item
     id's containing spaces.

   - bpo-8637(24): Honor a pager set by the env var MANPAGER (in
     preference to one set by the env var PAGER).

   - bpo-16182(25): Fix various functions in the "readline" module to
     use the locale encoding, and fix get_begidx() and get_endidx() to
     return code point indexes.

   - bpo-27392(26): Add loop.connect_accepted_socket().  Patch by Jim
     Fulton.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26844

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23804

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27466

   (4) https://bugs.python.org/issue?@action=redirect&bpo=21708

   (5) https://bugs.python.org/issue?@action=redirect&bpo=26721

   (6) https://bugs.python.org/issue?@action=redirect&bpo=22115

   (7) https://bugs.python.org/issue?@action=redirect&bpo=26243

   (8) https://bugs.python.org/issue?@action=redirect&bpo=27038

   (9) https://bugs.python.org/issue?@action=redirect&bpo=27186

   (10) https://bugs.python.org/issue?@action=redirect&bpo=18726

   (11) https://bugs.python.org/issue?@action=redirect&bpo=27319

   (12) https://bugs.python.org/issue?@action=redirect&bpo=27079

   (13) https://bugs.python.org/issue?@action=redirect&bpo=27294

   (14) https://bugs.python.org/issue?@action=redirect&bpo=27177

   (15) https://bugs.python.org/issue?@action=redirect&bpo=26754

   (16) https://bugs.python.org/issue?@action=redirect&bpo=26536

   (17) https://bugs.python.org/issue?@action=redirect&bpo=27048

   (18) https://bugs.python.org/issue?@action=redirect&bpo=27330

   (19) https://bugs.python.org/issue?@action=redirect&bpo=27238

   (20) https://bugs.python.org/issue?@action=redirect&bpo=27122

   (21) https://peps.python.org/pep-0479/

   (22) https://bugs.python.org/issue?@action=redirect&bpo=16864

   (23) https://bugs.python.org/issue?@action=redirect&bpo=26386

   (24) https://bugs.python.org/issue?@action=redirect&bpo=8637

   (25) https://bugs.python.org/issue?@action=redirect&bpo=16182

   (26) https://bugs.python.org/issue?@action=redirect&bpo=27392


File: python.info,  Node: IDLE<54>,  Next: C API<72>,  Prev: ライブラリ<187>,  Up: Python 3 6 0 alpha 3

1.24.95.4 IDLE
..............

   - bpo-27477(1): IDLE search dialogs now use ttk widgets.

   - bpo-27173(2): Add 'IDLE Modern Unix' to the built-in key sets.
     Make the default key set depend on the platform.  Add tests for the
     changes to the config module.

   - bpo-27452(3): make command line "idle-test> python test_help.py"
     work.  __file__ is relative when python is started in the file's
     directory.

   - bpo-27452(4): add line counter and crc to IDLE configHandler test
     dump.

   - bpo-27380(5): IDLE: add query.py with base Query dialog and ttk
     widgets.  Module had subclasses SectionName, ModuleName, and
     HelpSource, which are used to get information from users by
     configdialog and file =>Load Module.  Each subclass has itw own
     validity checks.  Using ModuleName allows users to edit bad module
     names instead of starting over.  Add tests and delete the two files
     combined into the new one.

   - bpo-27372(6): Test_idle no longer changes the locale.

   - bpo-27365(7): Allow non-ascii chars in IDLE NEWS.txt, for
     contributor names.

   - bpo-27245(8): IDLE: Cleanly delete custom themes and key bindings.
     Previously, when IDLE was started from a console or by import, a
     cascade of warnings was emitted.  Patch by Serhiy Storchaka.

   - bpo-24137(9): Run IDLE, test_idle, and htest with tkinter default
     root disabled.  Fix code and tests that fail with this restriction.
     Fix htests to not create a second and redundant root and mainloop.

   - bpo-27310(10): Fix IDLE.app failure to launch on OS X due to
     vestigial import.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27477

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27173

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27452

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27452

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27380

   (6) https://bugs.python.org/issue?@action=redirect&bpo=27372

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27365

   (8) https://bugs.python.org/issue?@action=redirect&bpo=27245

   (9) https://bugs.python.org/issue?@action=redirect&bpo=24137

   (10) https://bugs.python.org/issue?@action=redirect&bpo=27310


File: python.info,  Node: C API<72>,  Next: ビルド<86>,  Prev: IDLE<54>,  Up: Python 3 6 0 alpha 3

1.24.95.5 C API
...............

   - bpo-26754(1): PyUnicode_FSDecoder() accepted a filename argument
     encoded as an iterable of integers.  Now only strings and byte-like
     objects are accepted.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26754


File: python.info,  Node: ビルド<86>,  Next: Tools/Demos<52>,  Prev: C API<72>,  Up: Python 3 6 0 alpha 3

1.24.95.6 ビルド
................

   - bpo-28066(1): Fix the logic that searches build directories for
     generated include files when building outside the source tree.

   - bpo-27442(2): Expose the Android API level that python was built
     against, in sysconfig.get_config_vars() as 'ANDROID_API_LEVEL'.

   - bpo-27434(3): The interpreter that runs the cross-build, found in
     PATH, must now be of the same feature version (e.g.  3.6) as the
     source being built.

   - bpo-26930(4): Update Windows builds to use OpenSSL 1.0.2h.

   - bpo-23968(5): Rename the platform directory from plat-$(MACHDEP) to
     plat-$(PLATFORM_TRIPLET). Rename the config directory (LIBPL) from
     config-$(LDVERSION) to config-$(LDVERSION)-$(PLATFORM_TRIPLET).
     Install the platform specific _sysconfigdata module into the
     platform directory and rename it to include the ABIFLAGS.

   - Don't use largefile support for GNU/Hurd.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28066

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27442

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27434

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26930

   (5) https://bugs.python.org/issue?@action=redirect&bpo=23968


File: python.info,  Node: Tools/Demos<52>,  Next: ドキュメント<75>,  Prev: ビルド<86>,  Up: Python 3 6 0 alpha 3

1.24.95.7 Tools/Demos
.....................

   - bpo-27332(1): Fixed the type of the first argument of module-level
     functions generated by Argument Clinic.  Patch by Petr Viktorin.

   - bpo-27418(2): Fixed Tools/importbench/importbench.py.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27332

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27418


File: python.info,  Node: ドキュメント<75>,  Next: テスト<75>,  Prev: Tools/Demos<52>,  Up: Python 3 6 0 alpha 3

1.24.95.8 ドキュメント
......................

   - bpo-19489(1): Moved the search box from the sidebar to the header
     and footer of each page.  Patch by Ammar Askar.

   - bpo-27285(2): Update documentation to reflect the deprecation of
     ‘pyvenv’ and normalize on the term "virtual environment".  Patch by
     Steve Piercy.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19489

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27285


File: python.info,  Node: テスト<75>,  Prev: ドキュメント<75>,  Up: Python 3 6 0 alpha 3

1.24.95.9 テスト
................

   - bpo-27027(1): Added test.support.is_android that is True when this
     is an Android build.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27027


File: python.info,  Node: Python 3 6 0 alpha 2,  Next: Python 3 6 0 alpha 1,  Prev: Python 3 6 0 alpha 3,  Up: 変更履歴

1.24.96 Python 3.6.0 alpha 2
----------------------------

'Release date: 2016-06-13'

* Menu:

* セキュリティ: セキュリティ<55>.
* Core and Builtins: Core and Builtins<185>.
* ライブラリ: ライブラリ<188>.
* IDLE: IDLE<55>.
* ドキュメント: ドキュメント<76>.
* テスト: テスト<76>.
* Windows: Windows<75>.
* ビルド: ビルド<87>.
* C API: C API<73>.
* Tools/Demos: Tools/Demos<53>.


File: python.info,  Node: セキュリティ<55>,  Next: Core and Builtins<185>,  Up: Python 3 6 0 alpha 2

1.24.96.1 セキュリティ
......................

   - bpo-26556(1): Update expat to 2.1.1, fixes CVE 2015-1283(2).

   - Fix TLS stripping vulnerability in smtplib, CVE 2016-0772(3).
     Reported by Team Oststrom.

   - bpo-26839(4): On Linux, *note os.urandom(): 746. now calls
     ‘getrandom()’ with ‘GRND_NONBLOCK’ to fall back on reading
     ‘/dev/urandom’ if the urandom entropy pool is not initialized yet.
     Patch written by Colm Buckley.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26556

   (2) https://www.cve.org/CVERecord?id=CVE-2015-1283

   (3) https://www.cve.org/CVERecord?id=CVE-2016-0772

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26839


File: python.info,  Node: Core and Builtins<185>,  Next: ライブラリ<188>,  Prev: セキュリティ<55>,  Up: Python 3 6 0 alpha 2

1.24.96.2 Core and Builtins
...........................

   - bpo-27095(1): Simplified MAKE_FUNCTION and removed MAKE_CLOSURE
     opcodes.  Patch by Demur Rumed.

   - bpo-27190(2): Raise NotSupportedError if sqlite3 is older than
     3.3.1.  Patch by Dave Sawyer.

   - bpo-27286(3): Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode.
     Calling function with generalized unpacking (PEP 448) and
     conflicting keyword names could cause undefined behavior.

   - bpo-27140(4): Added BUILD_CONST_KEY_MAP opcode.

   - bpo-27186(5): Add support for os.PathLike objects to open() (part
     of PEP 519(6)).

   - bpo-27066(7): Fixed SystemError if a custom opener (for open())
     returns a negative number without setting an exception.

   - bpo-26983(8): float() now always return an instance of exact float.
     The deprecation warning is emitted if __float__ returns an instance
     of a strict subclass of float.  In a future versions of Python this
     can be an error.

   - bpo-27097(9): Python interpreter is now about 7% faster due to
     optimized instruction decoding.  Based on patch by Demur Rumed.

   - bpo-26647(10): Python interpreter now uses 16-bit wordcode instead
     of bytecode.  Patch by Demur Rumed.

   - bpo-23275(11): Allow assigning to an empty target list in round
     brackets: () = iterable.

   - bpo-27243(12): Update the __aiter__ protocol: instead of returning
     an awaitable that resolves to an asynchronous iterator, the
     asynchronous iterator should be returned directly.  Doing the
     former will trigger a PendingDeprecationWarning.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27095

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27190

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27286

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27140

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27186

   (6) https://peps.python.org/pep-0519/

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27066

   (8) https://bugs.python.org/issue?@action=redirect&bpo=26983

   (9) https://bugs.python.org/issue?@action=redirect&bpo=27097

   (10) https://bugs.python.org/issue?@action=redirect&bpo=26647

   (11) https://bugs.python.org/issue?@action=redirect&bpo=23275

   (12) https://bugs.python.org/issue?@action=redirect&bpo=27243


File: python.info,  Node: ライブラリ<188>,  Next: IDLE<55>,  Prev: Core and Builtins<185>,  Up: Python 3 6 0 alpha 2

1.24.96.3 ライブラリ
....................

   - Comment out socket (SO_REUSEPORT) and posix (O_SHLOCK, O_EXLOCK)
     constants exposed on the API which are not implemented on GNU/Hurd.
     They would not work at runtime anyway.

   - bpo-27025(1): Generated names for Tkinter widgets are now more
     meaningful and recognizable.

   - bpo-25455(2): Fixed crashes in repr of recursive
     ElementTree.Element and functools.partial objects.

   - bpo-27294(3): Improved repr for Tkinter event objects.

   - bpo-20508(4): Improve exception message of
     IPv{4,6}Network.__getitem__.  Patch by Gareth Rees.

   - bpo-21386(5): Implement missing IPv4Address.is_global property.  It
     was documented since 07a5610bae9d.  Initial patch by Roger Luethi.

   - bpo-27029(6): Removed deprecated support of universal newlines mode
     from ZipFile.open().

   - bpo-27030(7): Unknown escapes consisting of ‘'\'’ and an ASCII
     letter in regular expressions now are errors.  The re.LOCALE flag
     now can be used only with bytes patterns.

   - bpo-27186(8): Add os.PathLike support to DirEntry (part of PEP
     519(9)).  Initial patch by Jelle Zijlstra.

   - bpo-20900(10): distutils register command now decodes HTTP
     responses correctly.  Initial patch by ingrid.

   - bpo-27186(11): Add os.PathLike support to pathlib, removing its
     provisional status (part of PEP 519).  Initial patch by Dusty
     Phillips.

   - bpo-27186(12): Add support for os.PathLike objects to os.fsencode()
     and os.fsdecode() (part of PEP 519(13)).

   - bpo-27186(14): Introduce os.PathLike and os.fspath() (part of PEP
     519(15)).

   - A new version of typing.py provides several new classes and
     features: @overload outside stubs, Reversible, DefaultDict, Text,
     ContextManager, Type[], NewType(), TYPE_CHECKING, and numerous bug
     fixes (note that some of the new features are not yet implemented
     in mypy or other static analyzers).  Also classes for PEP 492(16)
     (Awaitable, AsyncIterable, AsyncIterator) have been added (in fact
     they made it into 3.5.1 but were never mentioned).

   - bpo-25738(17): Stop http.server.BaseHTTPRequestHandler.send_error()
     from sending a message body for 205 Reset Content.  Also, don't
     send Content header fields in responses that don't have a body.
     Patch by Susumu Koshiba.

   - bpo-21313(18): Fix the "platform" module to tolerate when
     sys.version contains truncated build information.

   - bpo-23883(19): Added missing APIs to __all__ to match the
     documented APIs for the following modules: cgi, mailbox, mimetypes,
     plistlib and smtpd.  Patches by Jacek Kołodziej.

   - bpo-27164(20): In the zlib module, allow decompressing raw Deflate
     streams with a predefined zdict.  Based on patch by Xiang Zhang.

   - bpo-24291(21): Fix wsgiref.simple_server.WSGIRequestHandler to
     completely write data to the client.  Previously it could do
     partial writes and truncate data.  Also,
     wsgiref.handler.ServerHandler can now handle stdout doing partial
     writes, but this is deprecated.

   - bpo-21272(22): Use _sysconfigdata.py to initialize
     distutils.sysconfig.

   - bpo-19611(23): *note inspect: 82. now reports the implicit ‘.0’
     parameters generated by the compiler for comprehension and
     generator expression scopes as if they were positional-only
     parameters called ‘implicit0’.  Patch by Jelle Zijlstra.

   - bpo-26809(24): Add ‘__all__’ to *note string: d8.  Patch by Emanuel
     Barry.

   - bpo-26373(25): subprocess.Popen.communicate now correctly ignores
     BrokenPipeError when the child process dies before .communicate()
     is called in more/all circumstances.

   - signal, socket, and ssl module IntEnum constant name lookups now
     return a consistent name for values having multiple names.  Ex:
     signal.Signals(6) now refers to itself as signal.SIGALRM rather
     than flipping between that and signal.SIGIOT based on the
     interpreter's hash randomization seed.

   - bpo-27167(26): Clarify the subprocess.CalledProcessError error
     message text when the child process died due to a signal.

   - bpo-25931(27): Don't define socketserver.Forking* names on
     platforms such as Windows that do not support os.fork().

   - bpo-21776(28): distutils.upload now correctly handles HTTPError.
     Initial patch by Claudiu Popa.

   - bpo-26526(29): Replace custom parse tree validation in the parser
     module with a simple DFA validator.

   - bpo-27114(30): Fix SSLContext._load_windows_store_certs fails with
     PermissionError

   - bpo-18383(31): Avoid creating duplicate filters when using
     filterwarnings and simplefilter.  Based on patch by Alex Shkop.

   - bpo-23026(32): winreg.QueryValueEx() now return an integer for
     REG_QWORD type.

   - bpo-26741(33): subprocess.Popen destructor now emits a
     ResourceWarning warning if the child process is still running.

   - bpo-27056(34): Optimize pickle.load() and pickle.loads(), up to 10%
     faster to deserialize a lot of small objects.

   - bpo-21271(35): New keyword only parameters in reset_mock call.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27025

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25455

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27294

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20508

   (5) https://bugs.python.org/issue?@action=redirect&bpo=21386

   (6) https://bugs.python.org/issue?@action=redirect&bpo=27029

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27030

   (8) https://bugs.python.org/issue?@action=redirect&bpo=27186

   (9) https://peps.python.org/pep-0519/

   (10) https://bugs.python.org/issue?@action=redirect&bpo=20900

   (11) https://bugs.python.org/issue?@action=redirect&bpo=27186

   (12) https://bugs.python.org/issue?@action=redirect&bpo=27186

   (13) https://peps.python.org/pep-0519/

   (14) https://bugs.python.org/issue?@action=redirect&bpo=27186

   (15) https://peps.python.org/pep-0519/

   (16) https://peps.python.org/pep-0492/

   (17) https://bugs.python.org/issue?@action=redirect&bpo=25738

   (18) https://bugs.python.org/issue?@action=redirect&bpo=21313

   (19) https://bugs.python.org/issue?@action=redirect&bpo=23883

   (20) https://bugs.python.org/issue?@action=redirect&bpo=27164

   (21) https://bugs.python.org/issue?@action=redirect&bpo=24291

   (22) https://bugs.python.org/issue?@action=redirect&bpo=21272

   (23) https://bugs.python.org/issue?@action=redirect&bpo=19611

   (24) https://bugs.python.org/issue?@action=redirect&bpo=26809

   (25) https://bugs.python.org/issue?@action=redirect&bpo=26373

   (26) https://bugs.python.org/issue?@action=redirect&bpo=27167

   (27) https://bugs.python.org/issue?@action=redirect&bpo=25931

   (28) https://bugs.python.org/issue?@action=redirect&bpo=21776

   (29) https://bugs.python.org/issue?@action=redirect&bpo=26526

   (30) https://bugs.python.org/issue?@action=redirect&bpo=27114

   (31) https://bugs.python.org/issue?@action=redirect&bpo=18383

   (32) https://bugs.python.org/issue?@action=redirect&bpo=23026

   (33) https://bugs.python.org/issue?@action=redirect&bpo=26741

   (34) https://bugs.python.org/issue?@action=redirect&bpo=27056

   (35) https://bugs.python.org/issue?@action=redirect&bpo=21271


File: python.info,  Node: IDLE<55>,  Next: ドキュメント<76>,  Prev: ライブラリ<188>,  Up: Python 3 6 0 alpha 2

1.24.96.4 IDLE
..............

   - bpo-5124(1): Paste with text selected now replaces the selection on
     X11.  This matches how paste works on Windows, Mac, most modern
     Linux apps, and ttk widgets.  Original patch by Serhiy Storchaka.

   - bpo-24750(2): Switch all scrollbars in IDLE to ttk versions.  Where
     needed, minimal tests are added to cover changes.

   - bpo-24759(3): IDLE requires tk 8.5 and availability ttk widgets.
     Delete now unneeded tk version tests and code for older versions.
     Add test for IDLE syntax colorizer.

   - bpo-27239(4): idlelib.macosx.isXyzTk functions initialize as
     needed.

   - bpo-27262(5): move Aqua unbinding code, which enable context menus,
     to macosx.

   - bpo-24759(6): Make clear in idlelib.idle_test.__init__ that the
     directory is a private implementation of test.test_idle and tool
     for maintainers.

   - bpo-27196(7): Stop 'ThemeChanged' warnings when running IDLE tests.
     These persisted after other warnings were suppressed in #20567.
     Apply Serhiy Storchaka's update_idletasks solution to four test
     files.  Record this additional advice in idle_test/README.txt

   - bpo-20567(8): Revise idle_test/README.txt with advice about
     avoiding tk warning messages from tests.  Apply advice to several
     IDLE tests.

   - bpo-24225(9): Update idlelib/README.txt with new file names and
     event handlers.

   - bpo-27156(10): Remove obsolete code not used by IDLE.

   - bpo-27117(11): Make colorizer htest and turtledemo work with dark
     themes.  Move code for configuring text widget colors to a new
     function.

   - bpo-24225(12): Rename many ‘idlelib/*.py’ and ‘idle_test/test_*.py’
     files.  Edit files to replace old names with new names when the old
     name referred to the module rather than the class it contained.
     See the issue and IDLE section in What's New in 3.6 for more.

   - bpo-26673(13): When tk reports font size as 0, change to size 10.
     Such fonts on Linux prevented the configuration dialog from
     opening.

   - bpo-21939(14): Add test for IDLE's percolator.  Original patch by
     Saimadhav Heblikar.

   - bpo-21676(15): Add test for IDLE's replace dialog.  Original patch
     by Saimadhav Heblikar.

   - bpo-18410(16): Add test for IDLE's search dialog.  Original patch
     by Westley Martínez.

   - bpo-21703(17): Add test for undo delegator.  Patch mostly by
     Saimadhav Heblikar .

   - bpo-27044(18): Add ConfigDialog.remove_var_callbacks to stop memory
     leaks.

   - bpo-23977(19): Add more asserts to test_delegator.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5124

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24750

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24759

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27239

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27262

   (6) https://bugs.python.org/issue?@action=redirect&bpo=24759

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27196

   (8) https://bugs.python.org/issue?@action=redirect&bpo=20567

   (9) https://bugs.python.org/issue?@action=redirect&bpo=24225

   (10) https://bugs.python.org/issue?@action=redirect&bpo=27156

   (11) https://bugs.python.org/issue?@action=redirect&bpo=27117

   (12) https://bugs.python.org/issue?@action=redirect&bpo=24225

   (13) https://bugs.python.org/issue?@action=redirect&bpo=26673

   (14) https://bugs.python.org/issue?@action=redirect&bpo=21939

   (15) https://bugs.python.org/issue?@action=redirect&bpo=21676

   (16) https://bugs.python.org/issue?@action=redirect&bpo=18410

   (17) https://bugs.python.org/issue?@action=redirect&bpo=21703

   (18) https://bugs.python.org/issue?@action=redirect&bpo=27044

   (19) https://bugs.python.org/issue?@action=redirect&bpo=23977


File: python.info,  Node: ドキュメント<76>,  Next: テスト<76>,  Prev: IDLE<55>,  Up: Python 3 6 0 alpha 2

1.24.96.5 ドキュメント
......................

   - bpo-16484(1): Change the default PYTHONDOCS URL to "https:", and
     fix the resulting links to use lowercase.  Patch by Sean Rodman,
     test by Kaushik Nadikuditi.

   - bpo-24136(2): Document the new PEP 448(3) unpacking syntax of 3.5.

   - bpo-22558(4): Add remaining doc links to source code for
     Python-coded modules.  Patch by Yoni Lavi.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=16484

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24136

   (3) https://peps.python.org/pep-0448/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=22558


File: python.info,  Node: テスト<76>,  Next: Windows<75>,  Prev: ドキュメント<76>,  Up: Python 3 6 0 alpha 2

1.24.96.6 テスト
................

   - bpo-25285(1): regrtest now uses subprocesses when the -j1 command
     line option is used: each test file runs in a fresh child process.
     Before, the -j1 option was ignored.

   - bpo-25285(2): Tools/buildbot/test.bat script now uses -j1 by
     default to run each test file in fresh child process.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25285

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25285


File: python.info,  Node: Windows<75>,  Next: ビルド<87>,  Prev: テスト<76>,  Up: Python 3 6 0 alpha 2

1.24.96.7 Windows
.................

   - bpo-27064(1): The py.exe launcher now defaults to Python 3.  The
     Windows launcher ‘py.exe’ no longer prefers an installed Python 2
     version over Python 3 by default when used interactively.

   - bpo-17500(2): Remove unused and outdated icons.  (See also:
     ‘https://github.com/python/pythondotorg/issues/945’)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27064

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17500


File: python.info,  Node: ビルド<87>,  Next: C API<73>,  Prev: Windows<75>,  Up: Python 3 6 0 alpha 2

1.24.96.8 ビルド
................

   - bpo-27229(1): Fix the cross-compiling pgen rule for in-tree builds.
     Patch by Xavier de Gaye.

   - bpo-26930(2): Update OS X 10.5+ 32-bit-only installer to build and
     link with OpenSSL 1.0.2h.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27229

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26930


File: python.info,  Node: C API<73>,  Next: Tools/Demos<53>,  Prev: ビルド<87>,  Up: Python 3 6 0 alpha 2

1.24.96.9 C API
...............

   - bpo-27186(1): Add the PyOS_FSPath() function (part of PEP 519(2)).

   - bpo-26282(3): PyArg_ParseTupleAndKeywords() now supports
     positional-only parameters.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27186

   (2) https://peps.python.org/pep-0519/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26282


File: python.info,  Node: Tools/Demos<53>,  Prev: C API<73>,  Up: Python 3 6 0 alpha 2

1.24.96.10 Tools/Demos
......................

   - bpo-26282(1): Argument Clinic now supports positional-only and
     keyword parameters in the same function.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26282


File: python.info,  Node: Python 3 6 0 alpha 1,  Next: Python 3 5 5 final,  Prev: Python 3 6 0 alpha 2,  Up: 変更履歴

1.24.97 Python 3.6.0 alpha 1
----------------------------

'Release date: 2016-05-16'

* Menu:

* セキュリティ: セキュリティ<56>.
* Core and Builtins: Core and Builtins<186>.
* ライブラリ: ライブラリ<189>.
* IDLE: IDLE<56>.
* ドキュメント: ドキュメント<77>.
* テスト: テスト<77>.
* ビルド: ビルド<88>.
* Windows: Windows<76>.
* Tools/Demos: Tools/Demos<54>.
* C API: C API<74>.


File: python.info,  Node: セキュリティ<56>,  Next: Core and Builtins<186>,  Up: Python 3 6 0 alpha 1

1.24.97.1 セキュリティ
......................

   - bpo-26657(1): Fix directory traversal vulnerability with
     http.server on Windows.  This fixes a regression that was
     introduced in 3.3.4rc1 and 3.4.0rc1.  Based on patch by Philipp
     Hagemeister.

   - bpo-26313(2): ssl.py _load_windows_store_certs fails if windows
     cert store is empty.  Patch by Baji.

   - bpo-25939(3): On Windows open the cert store readonly in
     ssl.enum_certificates.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26657

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26313

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25939


File: python.info,  Node: Core and Builtins<186>,  Next: ライブラリ<189>,  Prev: セキュリティ<56>,  Up: Python 3 6 0 alpha 1

1.24.97.2 Core and Builtins
...........................

   - bpo-20041(1): Fixed TypeError when frame.f_trace is set to None.
     Patch by Xavier de Gaye.

   - bpo-26168(2): Fixed possible refleaks in failing Py_BuildValue()
     with the "N" format unit.

   - bpo-26991(3): Fix possible refleak when creating a function with
     annotations.

   - bpo-27039(4): Fixed bytearray.remove() for values greater than 127.
     Based on patch by Joe Jevnik.

   - bpo-23640(5): int.from_bytes() no longer bypasses constructors for
     subclasses.

   - bpo-27005(6): Optimized the float.fromhex() class method for exact
     float.  It is now 2 times faster.

   - bpo-18531(7): Single var-keyword argument of dict subtype was
     passed unscathed to the C-defined function.  Now it is converted to
     exact dict.

   - bpo-26811(8): gc.get_objects() no longer contains a broken tuple
     with NULL pointer.

   - bpo-20120(9): Use RawConfigParser for .pypirc parsing, removing
     support for interpolation unintentionally added with move to Python
     3.  Behavior no longer does any interpolation in .pypirc files,
     matching behavior in Python 2.7 and Setuptools 19.0.

   - bpo-26249(10): Memory functions of the *note PyMem_Malloc(): e5f.
     domain (*note PYMEM_DOMAIN_MEM: e63.) now use the *note pymalloc
     allocator: f0b. rather than system ‘malloc()’.  Applications
     calling *note PyMem_Malloc(): e5f. without holding the GIL can now
     crash: use ‘PYTHONMALLOC=debug’ environment variable to validate
     the usage of memory allocators in your application.

   - bpo-26802(11): Optimize function calls only using unpacking like
     ‘func(*tuple)’ (no other positional argument, no keyword): avoid
     copying the tuple.  Patch written by Joe Jevnik.

   - bpo-26659(12): Make the builtin slice type support cycle
     collection.

   - bpo-26718(13): super.__init__ no longer leaks memory if called
     multiple times.  NOTE: A direct call of super.__init__ is not
     endorsed!

   - bpo-27138(14): Fix the doc comment for FileFinder.find_spec().

   - bpo-27147(15): Mention PEP 420(16) in the importlib docs.

   - bpo-25339(17): PYTHONIOENCODING now has priority over locale in
     setting the error handler for stdin and stdout.

   - bpo-26494(18): Fixed crash on iterating exhausting iterators.
     Affected classes are generic sequence iterators, iterators of str,
     bytes, bytearray, list, tuple, set, frozenset, dict, OrderedDict,
     corresponding views and os.scandir() iterator.

   - bpo-26574(19): Optimize ‘bytes.replace(b'', b'.')’ and
     ‘bytearray.replace(b'', b'.')’.  Patch written by Josh Snider.

   - bpo-26581(20): If coding cookie is specified multiple times on a
     line in Python source code file, only the first one is taken to
     account.

   - bpo-19711(21): Add tests for reloading namespace packages.

   - bpo-21099(22): Switch applicable importlib tests to use PEP 451(23)
     API.

   - bpo-26563(24): Debug hooks on Python memory allocators now raise a
     fatal error if functions of the *note PyMem_Malloc(): e5f. family
     are called without holding the GIL.

   - bpo-26564(25): On error, the debug hooks on Python memory
     allocators now use the *note tracemalloc: 105. module to get the
     traceback where a memory block was allocated.

   - bpo-26558(26): The debug hooks on Python memory allocator *note
     PyObject_Malloc(): e62. now detect when functions are called
     without holding the GIL.

   - bpo-26516(27): Add *note PYTHONMALLOC: e5e. environment variable to
     set the Python memory allocators and/or install debug hooks.

   - bpo-26516(28): The *note PyMem_SetupDebugHooks(): e64. function can
     now also be used on Python compiled in release mode.

   - bpo-26516(29): The *note PYTHONMALLOCSTATS: 1f37. environment
     variable can now also be used on Python compiled in release mode.
     It now has no effect if set to an empty string.

   - bpo-26516(30): In debug mode, debug hooks are now also installed on
     Python memory allocators when Python is configured without
     pymalloc.

   - bpo-26464(31): Fix str.translate() when string is ASCII and first
     replacements removes character, but next replacement uses a
     non-ASCII character or a string longer than 1 character.
     Regression introduced in Python 3.5.0.

   - bpo-22836(32): Ensure exception reports from PyErr_Display() and
     PyErr_WriteUnraisable() are sensible even when formatting them
     produces secondary errors.  This affects the reports produced by
     sys.__excepthook__() and when __del__() raises an exception.

   - bpo-26302(33): Correct behavior to reject comma as a legal
     character for cookie names.

   - bpo-26136(34): Upgrade the warning when a generator raises
     StopIteration from PendingDeprecationWarning to DeprecationWarning.
     Patch by Anish Shah.

   - bpo-26204(35): The compiler now ignores all constant statements:
     bytes, str, int, float, complex, name constants (None, False,
     True), Ellipsis and ast.Constant; not only str and int.  For
     example, ‘1.0’ is now ignored in ‘def f(): 1.0’.

   - bpo-4806(36): Avoid masking the original TypeError exception when
     using star (‘*’) unpacking in function calls.  Based on patch by
     Hagen Fürstenau and Daniel Urban.

   - bpo-26146(37): Add a new kind of AST node: ‘ast.Constant’.  It can
     be used by external AST optimizers, but the compiler does not emit
     directly such node.

   - bpo-23601(38): Sped-up allocation of dict key objects by using
     Python's small object allocator.  (Contributed by Julian Taylor.)

   - bpo-18018(39): Import raises ImportError instead of SystemError if
     a relative import is attempted without a known parent package.

   - bpo-25843(40): When compiling code, don't merge constants if they
     are equal but have a different types.  For example, ‘f1, f2 =
     lambda: 1, lambda: 1.0’ is now correctly compiled to two different
     functions: ‘f1()’ returns ‘1’ (‘int’) and ‘f2()’ returns ‘1.0’
     (‘float’), even if ‘1’ and ‘1.0’ are equal.

   - bpo-26107(41): The format of the ‘co_lnotab’ attribute of code
     objects changes to support negative line number delta.

   - bpo-26154(42): Add a new private _PyThreadState_UncheckedGet()
     function to get the current Python thread state, but don't issue a
     fatal error if it is NULL. This new function must be used instead
     of accessing directly the _PyThreadState_Current variable.  The
     variable is no more exposed since Python 3.5.1 to hide the exact
     implementation of atomic C types, to avoid compiler issues.

   - bpo-25791(43): If __package__ != __spec__.parent or if neither
     __package__ or __spec__ are defined then ImportWarning is raised.

   - bpo-22995(44): [UPDATE] Comment out the one of the pickleability
     tests in _PyObject_GetState() due to regressions observed in
     Cython-based projects.

   - bpo-25961(45): Disallowed null characters in the type name.

   - bpo-25973(46): Fix segfault when an invalid nonlocal statement
     binds a name starting with two underscores.

   - bpo-22995(47): Instances of extension types with a state that
     aren't subclasses of list or dict and haven't implemented any
     pickle-related methods (__reduce__, __reduce_ex__, __getnewargs__,
     __getnewargs_ex__, or __getstate__), can no longer be pickled.
     Including memoryview.

   - bpo-20440(48): Massive replacing unsafe attribute setting code with
     special macro Py_SETREF.

   - bpo-25766(49): Special method __bytes__() now works in str
     subclasses.

   - bpo-25421(50): __sizeof__ methods of builtin types now use dynamic
     basic size.  This allows sys.getsize() to work correctly with their
     subclasses with __slots__ defined.

   - bpo-25709(51): Fixed problem with in-place string concatenation and
     utf-8 cache.

   - bpo-5319(52): New Py_FinalizeEx() API allowing Python to set an
     exit status of 120 on failure to flush buffered streams.

   - bpo-25485(53): telnetlib.Telnet is now a context manager.

   - bpo-24097(54): Fixed crash in object.__reduce__() if slot name is
     freed inside __getattr__.

   - bpo-24731(55): Fixed crash on converting objects with special
     methods __bytes__, __trunc__, and __float__ returning instances of
     subclasses of bytes, int, and float to subclasses of bytes, int,
     and float correspondingly.

   - bpo-25630(56): Fix a possible segfault during argument parsing in
     functions that accept filesystem paths.

   - bpo-23564(57): Fixed a partially broken sanity check in the
     _posixsubprocess internals regarding how fds_to_pass were passed to
     the child.  The bug had no actual impact as subprocess.py already
     avoided it.

   - bpo-25388(58): Fixed tokenizer crash when processing undecodable
     source code with a null byte.

   - bpo-25462(59): The hash of the key now is calculated only once in
     most operations in C implementation of OrderedDict.

   - bpo-22995(60): Default implementation of __reduce__ and
     __reduce_ex__ now rejects builtin types with not defined __new__.

   - bpo-24802(61): Avoid buffer overreads when int(), float(),
     compile(), exec() and eval() are passed bytes-like objects.  These
     objects are not necessarily terminated by a null byte, but the
     functions assumed they were.

   - bpo-25555(62): Fix parser and AST: fill lineno and col_offset of
     "arg" node when compiling AST from Python objects.

   - bpo-24726(63): Fixed a crash and leaking NULL in repr() of
     OrderedDict that was mutated by direct calls of dict methods.

   - bpo-25449(64): Iterating OrderedDict with keys with unstable hash
     now raises KeyError in C implementations as well as in Python
     implementation.

   - bpo-25395(65): Fixed crash when highly nested OrderedDict
     structures were garbage collected.

   - bpo-25401(66): Optimize bytes.fromhex() and bytearray.fromhex():
     they are now between 2x and 3.5x faster.

   - bpo-25399(67): Optimize bytearray % args using the new private
     _PyBytesWriter API. Formatting is now between 2.5 and 5 times
     faster.

   - bpo-25274(68): sys.setrecursionlimit() now raises a RecursionError
     if the new recursion limit is too low depending at the current
     recursion depth.  Modify also the "lower-water mark" formula to
     make it monotonic.  This mark is used to decide when the overflowed
     flag of the thread state is reset.

   - bpo-24402(69): Fix input() to prompt to the redirected stdout when
     sys.stdout.fileno() fails.

   - bpo-25349(70): Optimize bytes % args using the new private
     _PyBytesWriter API. Formatting is now up to 2 times faster.

   - bpo-24806(71): Prevent builtin types that are not allowed to be
     subclassed from being subclassed through multiple inheritance.

   - bpo-25301(72): The UTF-8 decoder is now up to 15 times as fast for
     error handlers: ‘ignore’, ‘replace’ and ‘surrogateescape’.

   - bpo-24848(73): Fixed a number of bugs in UTF-7 decoding of
     misformed data.

   - bpo-25267(74): The UTF-8 encoder is now up to 75 times as fast for
     error handlers: ‘ignore’, ‘replace’, ‘surrogateescape’,
     ‘surrogatepass’.  Patch co-written with Serhiy Storchaka.

   - bpo-25280(75): Import trace messages emitted in verbose (-v) mode
     are no longer formatted twice.

   - bpo-25227(76): Optimize ASCII and latin1 encoders with the
     ‘surrogateescape’ error handler: the encoders are now up to 3 times
     as fast.  Initial patch written by Serhiy Storchaka.

   - bpo-25003(77): On Solaris 11.3 or newer, os.urandom() now uses the
     getrandom() function instead of the getentropy() function.  The
     getentropy() function is blocking to generate very good quality
     entropy, os.urandom() doesn't need such high-quality entropy.

   - bpo-9232(78): Modify Python's grammar to allow trailing commas in
     the argument list of a function declaration.  For example, "def
     f(*, a = 3,): pass" is now legal.  Patch from Mark Dickinson.

   - bpo-24965(79): Implement PEP 498(80) "Literal String
     Interpolation".  This allows you to embed expressions inside
     f-strings, which are converted to normal strings at run time.
     Given x=3, then f'value={x}' == 'value=3'.  Patch by Eric V. Smith.

   - bpo-26478(81): Fix semantic bugs when using binary operators with
     dictionary views and tuples.

   - bpo-26171(82): Fix possible integer overflow and heap corruption in
     zipimporter.get_data().

   - bpo-25660(83): Fix TAB key behaviour in REPL with readline.

   - bpo-26288(84): Optimize PyLong_AsDouble.

   - bpo-26289(85): Optimize floor and modulo division for single-digit
     longs.  Microbenchmarks show 2-2.5x improvement.  Built-in 'divmod'
     function is now also ~10% faster.  (See also: bpo-26315(86))

   - bpo-25887(87): Raise a RuntimeError when a coroutine object is
     awaited more than once.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20041

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26168

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26991

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27039

   (5) https://bugs.python.org/issue?@action=redirect&bpo=23640

   (6) https://bugs.python.org/issue?@action=redirect&bpo=27005

   (7) https://bugs.python.org/issue?@action=redirect&bpo=18531

   (8) https://bugs.python.org/issue?@action=redirect&bpo=26811

   (9) https://bugs.python.org/issue?@action=redirect&bpo=20120

   (10) https://bugs.python.org/issue?@action=redirect&bpo=26249

   (11) https://bugs.python.org/issue?@action=redirect&bpo=26802

   (12) https://bugs.python.org/issue?@action=redirect&bpo=26659

   (13) https://bugs.python.org/issue?@action=redirect&bpo=26718

   (14) https://bugs.python.org/issue?@action=redirect&bpo=27138

   (15) https://bugs.python.org/issue?@action=redirect&bpo=27147

   (16) https://peps.python.org/pep-0420/

   (17) https://bugs.python.org/issue?@action=redirect&bpo=25339

   (18) https://bugs.python.org/issue?@action=redirect&bpo=26494

   (19) https://bugs.python.org/issue?@action=redirect&bpo=26574

   (20) https://bugs.python.org/issue?@action=redirect&bpo=26581

   (21) https://bugs.python.org/issue?@action=redirect&bpo=19711

   (22) https://bugs.python.org/issue?@action=redirect&bpo=21099

   (23) https://peps.python.org/pep-0451/

   (24) https://bugs.python.org/issue?@action=redirect&bpo=26563

   (25) https://bugs.python.org/issue?@action=redirect&bpo=26564

   (26) https://bugs.python.org/issue?@action=redirect&bpo=26558

   (27) https://bugs.python.org/issue?@action=redirect&bpo=26516

   (28) https://bugs.python.org/issue?@action=redirect&bpo=26516

   (29) https://bugs.python.org/issue?@action=redirect&bpo=26516

   (30) https://bugs.python.org/issue?@action=redirect&bpo=26516

   (31) https://bugs.python.org/issue?@action=redirect&bpo=26464

   (32) https://bugs.python.org/issue?@action=redirect&bpo=22836

   (33) https://bugs.python.org/issue?@action=redirect&bpo=26302

   (34) https://bugs.python.org/issue?@action=redirect&bpo=26136

   (35) https://bugs.python.org/issue?@action=redirect&bpo=26204

   (36) https://bugs.python.org/issue?@action=redirect&bpo=4806

   (37) https://bugs.python.org/issue?@action=redirect&bpo=26146

   (38) https://bugs.python.org/issue?@action=redirect&bpo=23601

   (39) https://bugs.python.org/issue?@action=redirect&bpo=18018

   (40) https://bugs.python.org/issue?@action=redirect&bpo=25843

   (41) https://bugs.python.org/issue?@action=redirect&bpo=26107

   (42) https://bugs.python.org/issue?@action=redirect&bpo=26154

   (43) https://bugs.python.org/issue?@action=redirect&bpo=25791

   (44) https://bugs.python.org/issue?@action=redirect&bpo=22995

   (45) https://bugs.python.org/issue?@action=redirect&bpo=25961

   (46) https://bugs.python.org/issue?@action=redirect&bpo=25973

   (47) https://bugs.python.org/issue?@action=redirect&bpo=22995

   (48) https://bugs.python.org/issue?@action=redirect&bpo=20440

   (49) https://bugs.python.org/issue?@action=redirect&bpo=25766

   (50) https://bugs.python.org/issue?@action=redirect&bpo=25421

   (51) https://bugs.python.org/issue?@action=redirect&bpo=25709

   (52) https://bugs.python.org/issue?@action=redirect&bpo=5319

   (53) https://bugs.python.org/issue?@action=redirect&bpo=25485

   (54) https://bugs.python.org/issue?@action=redirect&bpo=24097

   (55) https://bugs.python.org/issue?@action=redirect&bpo=24731

   (56) https://bugs.python.org/issue?@action=redirect&bpo=25630

   (57) https://bugs.python.org/issue?@action=redirect&bpo=23564

   (58) https://bugs.python.org/issue?@action=redirect&bpo=25388

   (59) https://bugs.python.org/issue?@action=redirect&bpo=25462

   (60) https://bugs.python.org/issue?@action=redirect&bpo=22995

   (61) https://bugs.python.org/issue?@action=redirect&bpo=24802

   (62) https://bugs.python.org/issue?@action=redirect&bpo=25555

   (63) https://bugs.python.org/issue?@action=redirect&bpo=24726

   (64) https://bugs.python.org/issue?@action=redirect&bpo=25449

   (65) https://bugs.python.org/issue?@action=redirect&bpo=25395

   (66) https://bugs.python.org/issue?@action=redirect&bpo=25401

   (67) https://bugs.python.org/issue?@action=redirect&bpo=25399

   (68) https://bugs.python.org/issue?@action=redirect&bpo=25274

   (69) https://bugs.python.org/issue?@action=redirect&bpo=24402

   (70) https://bugs.python.org/issue?@action=redirect&bpo=25349

   (71) https://bugs.python.org/issue?@action=redirect&bpo=24806

   (72) https://bugs.python.org/issue?@action=redirect&bpo=25301

   (73) https://bugs.python.org/issue?@action=redirect&bpo=24848

   (74) https://bugs.python.org/issue?@action=redirect&bpo=25267

   (75) https://bugs.python.org/issue?@action=redirect&bpo=25280

   (76) https://bugs.python.org/issue?@action=redirect&bpo=25227

   (77) https://bugs.python.org/issue?@action=redirect&bpo=25003

   (78) https://bugs.python.org/issue?@action=redirect&bpo=9232

   (79) https://bugs.python.org/issue?@action=redirect&bpo=24965

   (80) https://peps.python.org/pep-0498/

   (81) https://bugs.python.org/issue?@action=redirect&bpo=26478

   (82) https://bugs.python.org/issue?@action=redirect&bpo=26171

   (83) https://bugs.python.org/issue?@action=redirect&bpo=25660

   (84) https://bugs.python.org/issue?@action=redirect&bpo=26288

   (85) https://bugs.python.org/issue?@action=redirect&bpo=26289

   (86) https://bugs.python.org/issue?@action=redirect&bpo=26315

   (87) https://bugs.python.org/issue?@action=redirect&bpo=25887


File: python.info,  Node: ライブラリ<189>,  Next: IDLE<56>,  Prev: Core and Builtins<186>,  Up: Python 3 6 0 alpha 1

1.24.97.3 ライブラリ
....................

   - bpo-27057(1): Fix os.set_inheritable() on Android, ioctl() is
     blocked by SELinux and fails with EACCESS. The function now falls
     back to fcntl().  Patch written by Michał Bednarski.

   - bpo-27014(2): Fix infinite recursion using typing.py.  Thanks to
     Kalle Tuure!

   - bpo-27031(3): Removed dummy methods in Tkinter widget classes:
     tk_menuBar() and tk_bindForTraversal().

   - bpo-14132(4): Fix urllib.request redirect handling when the target
     only has a query string.  Original fix by Ján Janech.

   - bpo-17214(5): The "urllib.request" module now percent-encodes
     non-ASCII bytes found in redirect target URLs.  Some servers send
     Location header fields with non-ASCII bytes, but "http.client"
     requires the request target to be ASCII-encodable, otherwise a
     UnicodeEncodeError is raised.  Based on patch by Christian Heimes.

   - bpo-27033(6): The default value of the decode_data parameter for
     smtpd.SMTPChannel and smtpd.SMTPServer constructors is changed to
     False.

   - bpo-27034(7): Removed deprecated class asynchat.fifo.

   - bpo-26870(8): Added readline.set_auto_history(), which can stop
     entries being automatically added to the history list.  Based on
     patch by Tyler Crompton.

   - bpo-26039(9): zipfile.ZipFile.open() can now be used to write data
     into a ZIP file, as well as for extracting data.  Patch by Thomas
     Kluyver.

   - bpo-26892(10): Honor debuglevel flag in urllib.request.HTTPHandler.
     Patch contributed by Chi Hsuan Yen.

   - bpo-22274(11): In the subprocess module, allow stderr to be
     redirected to stdout even when stdout is not redirected.  Patch by
     Akira Li.

   - bpo-26807(12): mock_open 'files' no longer error on readline at end
     of file.  Patch from Yolanda Robla.

   - bpo-25745(13): Fixed leaking a userptr in curses panel destructor.

   - bpo-26977(14): Removed unnecessary, and ignored, call to sum of
     squares helper in statistics.pvariance.

   - bpo-26002(15): Use bisect in statistics.median instead of a linear
     search.  Patch by Upendra Kuma.

   - bpo-25974(16): Make use of new Decimal.as_integer_ratio() method in
     statistics module.  Patch by Stefan Krah.

   - bpo-26996(17): Add secrets module as described in PEP 506(18).

   - bpo-26881(19): The modulefinder module now supports extended opcode
     arguments.

   - bpo-23815(20): Fixed crashes related to directly created instances
     of types in _tkinter and curses.panel modules.

   - bpo-17765(21): weakref.ref() no longer silently ignores keyword
     arguments.  Patch by Georg Brandl.

   - bpo-26873(22): xmlrpc now raises ResponseError on unsupported type
     tags instead of silently return incorrect result.

   - bpo-26915(23): The __contains__ methods in the collections ABCs now
     check for identity before checking equality.  This better matches
     the behavior of the concrete classes, allows sensible handling of
     NaNs, and makes it easier to reason about container invariants.

   - bpo-26711(24): Fixed the comparison of plistlib.Data with other
     types.

   - bpo-24114(25): Fix an uninitialized variable in ‘ctypes.util’.  The
     bug only occurs on SunOS when the ctypes implementation searches
     for the ‘crle’ program.  Patch by Xiang Zhang.  Tested on SunOS by
     Kees Bos.

   - bpo-26864(26): In urllib.request, change the proxy bypass host
     checking against no_proxy to be case-insensitive, and to not match
     unrelated host names that happen to have a bypassed hostname as a
     suffix.  Patch by Xiang Zhang.

   - bpo-24902(27): Print server URL on http.server startup.  Initial
     patch by Felix Kaiser.

   - bpo-25788(28): fileinput.hook_encoded() now supports an "errors"
     argument for passing to open.  Original patch by Joseph Hackman.

   - bpo-26634(29): recursive_repr() now sets __qualname__ of wrapper.
     Patch by Xiang Zhang.

   - bpo-26804(30): urllib.request will prefer lower_case proxy
     environment variables over UPPER_CASE or Mixed_Case ones.  Patch
     contributed by Hans-Peter Jansen.

   - bpo-26837(31): assertSequenceEqual() now correctly outputs
     non-stringified differing items (like bytes in the -b mode).  This
     affects assertListEqual() and assertTupleEqual().

   - bpo-26041(32): Remove "will be removed in Python 3.7" from
     deprecation messages of platform.dist() and
     platform.linux_distribution().  Patch by Kumaripaba Miyurusara
     Athukorala.

   - bpo-26822(33): itemgetter, attrgetter and methodcaller objects no
     longer silently ignore keyword arguments.

   - bpo-26733(34): Disassembling a class now disassembles class and
     static methods.  Patch by Xiang Zhang.

   - bpo-26801(35): Fix error handling in *note
     shutil.get_terminal_size(): 131b, catch *note AttributeError: 5f0.
     instead of *note NameError: 452.  Patch written by Emanuel Barry.

   - bpo-24838(36): tarfile's ustar and gnu formats now correctly
     calculate name and link field limits for multibyte character
     encodings like utf-8.

   - bpo-26717(37): Stop encoding Latin-1-ized WSGI paths with UTF-8.
     Patch by Anthony Sottile.

   - bpo-26782(38): Add STARTUPINFO to subprocess.__all__ on Windows.

   - bpo-26404(39): Add context manager to socketserver.  Patch by Aviv
     Palivoda.

   - bpo-26735(40): Fix *note os.urandom(): 746. on Solaris 11.3 and
     newer when reading more than 1,024 bytes: call ‘getrandom()’
     multiple times with a limit of 1024 bytes per call.

   - bpo-26585(41): Eliminate http.server._quote_html() and use
     html.escape(quote=False).  Patch by Xiang Zhang.

   - bpo-26685(42): Raise OSError if closing a socket fails.

   - bpo-16329(43): Add .webm to mimetypes.types_map.  Patch by
     Giampaolo Rodola'.

   - bpo-13952(44): Add .csv to mimetypes.types_map.  Patch by Geoff
     Wilson.

   - bpo-26587(45): the site module now allows .pth files to specify
     files to be added to sys.path (e.g.  zip files).

   - bpo-25609(46): Introduce contextlib.AbstractContextManager and
     typing.ContextManager.

   - bpo-26709(47): Fixed Y2038 problem in loading binary PLists.

   - bpo-23735(48): Handle terminal resizing with Readline 6.3+ by
     installing our own SIGWINCH handler.  Patch by Eric Price.

   - bpo-25951(49): Change SSLSocket.sendall() to return None, as
     explicitly documented for plain socket objects.  Patch by Aviv
     Palivoda.

   - bpo-26586(50): In http.server, respond with "413 Request header
     fields too large" if there are too many header fields to parse,
     rather than killing the connection and raising an unhandled
     exception.  Patch by Xiang Zhang.

   - bpo-26676(51): Added missing XMLPullParser to ElementTree.__all__.

   - bpo-22854(52): Change BufferedReader.writable() and
     BufferedWriter.readable() to always return False.

   - bpo-26492(53): Exhausted iterator of array.array now conforms with
     the behavior of iterators of other mutable sequences: it lefts
     exhausted even if iterated array is extended.

   - bpo-26641(54): doctest.DocFileTest and doctest.testfile() now
     support packages (module split into multiple directories) for the
     package parameter.

   - bpo-25195(55): Fix a regression in mock.MagicMock.  _Call is a
     subclass of tuple (changeset 3603bae63c13 only works for classes)
     so we need to implement __ne__ ourselves.  Patch by Andrew Plummer.

   - bpo-26644(56): Raise ValueError rather than SystemError when a
     negative length is passed to SSLSocket.recv() or read().

   - bpo-23804(57): Fix SSL recv(0) and read(0) methods to return zero
     bytes instead of up to 1024.

   - bpo-26616(58): Fixed a bug in datetime.astimezone() method.

   - bpo-26637(59): The *note importlib: 7b. module now emits an *note
     ImportError: 65b. rather than a *note TypeError: 198. if *note
     __import__(): ad1. is tried during the Python shutdown process but
     *note sys.path: 3e4. is already cleared (set to ‘None’).

   - bpo-21925(60): *note warnings.formatwarning(): 1df8. now catches
     exceptions when calling *note linecache.getline(): 240. and *note
     tracemalloc.get_object_traceback(): 1f39. to be able to log *note
     ResourceWarning: 54c. emitted late during the Python shutdown
     process.

   - bpo-23848(61): On Windows, faulthandler.enable() now also installs
     an exception handler to dump the traceback of all Python threads on
     any Windows exception, not only on UNIX signals (SIGSEGV, SIGFPE,
     SIGABRT).

   - bpo-26530(62): Add C functions ‘_PyTraceMalloc_Track()’ and
     ‘_PyTraceMalloc_Untrack()’ to track memory blocks using the *note
     tracemalloc: 105. module.  Add ‘_PyTraceMalloc_GetTraceback()’ to
     get the traceback of an object.

   - bpo-26588(63): The _tracemalloc now supports tracing memory
     allocations of multiple address spaces (domains).

   - bpo-24266(64): Ctrl+C during Readline history search now cancels
     the search mode when compiled with Readline 7.

   - bpo-26590(65): Implement a safe finalizer for the _socket.socket
     type.  It now releases the GIL to close the socket.

   - bpo-18787(66): spwd.getspnam() now raises a PermissionError if the
     user doesn't have privileges.

   - bpo-26560(67): Avoid potential ValueError in
     BaseHandler.start_response.  Initial patch by Peter Inglesby.

   - bpo-26567(68): Add a new function *note PyErr_ResourceWarning():
     f13. function to pass the destroyed object.  Add a 'source'
     attribute to ‘warnings.WarningMessage’.  Add
     warnings._showwarnmsg() which uses tracemalloc to get the traceback
     where source object was allocated.

   - bpo-26569(69): Fix *note pyclbr.readmodule(): a2c. and *note
     pyclbr.readmodule_ex(): a2d. to support importing packages.

   - bpo-26499(70): Account for remaining Content-Length in
     HTTPResponse.readline() and read1().  Based on patch by Silent
     Ghost.  Also document that HTTPResponse now supports these methods.

   - bpo-25320(71): Handle sockets in directories unittest discovery is
     scanning.  Patch from Victor van den Elzen.

   - bpo-16181(72): cookiejar.http2time() now returns None if year is
     higher than datetime.MAXYEAR.

   - bpo-26513(73): Fixes platform module detection of Windows Server

   - bpo-23718(74): Fixed parsing time in week 0 before Jan 1.  Original
     patch by Tamás Bence Gedai.

   - bpo-26323(75): Add Mock.assert_called() and
     Mock.assert_called_once() methods to unittest.mock.  Patch written
     by Amit Saha.

   - bpo-20589(76): Invoking Path.owner() and Path.group() on Windows
     now raise NotImplementedError instead of ImportError.

   - bpo-26177(77): Fixed the keys() method for Canvas and Scrollbar
     widgets.

   - bpo-15068(78): Got rid of excessive buffering in fileinput.  The
     bufsize parameter is now deprecated and ignored.

   - bpo-19475(79): Added an optional argument timespec to the datetime
     isoformat() method to choose the precision of the time component.

   - bpo-2202(80): Fix UnboundLocalError in
     AbstractDigestAuthHandler.get_algorithm_impls.  Initial patch by
     Mathieu Dupuy.

   - bpo-26167(81): Minimized overhead in copy.copy() and
     copy.deepcopy().  Optimized copying and deepcopying bytearrays,
     NotImplemented, slices, short lists, tuples, dicts, sets.

   - bpo-25718(82): Fixed pickling and copying the accumulate() iterator
     with total is None.

   - bpo-26475(83): Fixed debugging output for regular expressions with
     the (?x) flag.

   - bpo-26482(84): Allowed pickling recursive dequeues.

   - bpo-26335(85): Make mmap.write() return the number of bytes written
     like other write methods.  Patch by Jakub Stasiak.

   - bpo-26457(86): Fixed the subnets() methods in IP network classes
     for the case when resulting prefix length is equal to maximal
     prefix length.  Based on patch by Xiang Zhang.

   - bpo-26385(87): Remove the file if the internal open() call in
     NamedTemporaryFile() fails.  Patch by Silent Ghost.

   - bpo-26402(88): Fix XML-RPC client to retry when the server shuts
     down a persistent connection.  This was a regression related to the
     new http.client.RemoteDisconnected exception in 3.5.0a4.

   - bpo-25913(89): Leading ‘<~’ is optional now in base64.a85decode()
     with adobe=True.  Patch by Swati Jaiswal.

   - bpo-26186(90): Remove an invalid type check in
     importlib.util.LazyLoader.

   - bpo-26367(91): importlib.__import__() raises ImportError like
     builtins.__import__() when ‘level’ is specified but without an
     accompanying package specified.

   - bpo-26309(92): In the "socketserver" module, shut down the request
     (closing the connected socket) when verify_request() returns false.
     Patch by Aviv Palivoda.

   - bpo-23430(93): Change the socketserver module to only catch
     exceptions raised from a request handler that are derived from
     Exception (instead of BaseException).  Therefore SystemExit and
     KeyboardInterrupt no longer trigger the handle_error() method, and
     will now to stop a single-threaded server.

   - bpo-25995(94): os.walk() no longer uses FDs proportional to the
     tree depth.

   - bpo-25994(95): Added the close() method and the support of the
     context manager protocol for the os.scandir() iterator.

   - bpo-23992(96): multiprocessing: make MapResult not fail-fast upon
     exception.

   - bpo-26243(97): Support keyword arguments to zlib.compress().  Patch
     by Aviv Palivoda.

   - bpo-26117(98): The os.scandir() iterator now closes file descriptor
     not only when the iteration is finished, but when it was failed
     with error.

   - bpo-25949(99): __dict__ for an OrderedDict instance is now created
     only when needed.

   - bpo-25911(100): Restored support of bytes paths in os.walk() on
     Windows.

   - bpo-26045(101): Add UTF-8 suggestion to error message when posting
     a non-Latin-1 string with http.client.

   - bpo-26039(102): Added zipfile.ZipInfo.from_file() and
     zipinfo.ZipInfo.is_dir().  Patch by Thomas Kluyver.

   - bpo-12923(103): Reset FancyURLopener's redirect counter even if
     there is an exception.  Based on patches by Brian Brazil and Daniel
     Rocco.

   - bpo-25945(104): Fixed a crash when unpickle the functools.partial
     object with wrong state.  Fixed a leak in failed functools.partial
     constructor.  "args" and "keywords" attributes of functools.partial
     have now always types tuple and dict correspondingly.

   - bpo-26202(105): copy.deepcopy() now correctly copies range()
     objects with non-atomic attributes.

   - bpo-23076(106): Path.glob() now raises a ValueError if it's called
     with an invalid pattern.  Patch by Thomas Nyberg.

   - bpo-19883(107): Fixed possible integer overflows in zipimport.

   - bpo-26227(108): On Windows, getnameinfo(), gethostbyaddr() and
     gethostbyname_ex() functions of the socket module now decode the
     hostname from the ANSI code page rather than UTF-8.

   - bpo-26099(109): The site module now writes an error into stderr if
     sitecustomize module can be imported but executing the module raise
     an ImportError.  Same change for usercustomize.

   - bpo-26147(110): xmlrpc now works with strings not encodable with
     used non-UTF-8 encoding.

   - bpo-25935(111): Garbage collector now breaks reference loops with
     OrderedDict.

   - bpo-16620(112): Fixed AttributeError in msilib.Directory.glob().

   - bpo-26013(113): Added compatibility with broken protocol 2 pickles
     created in old Python 3 versions (3.4.3 and lower).

   - bpo-26129(114): Deprecated accepting non-integers in
     grp.getgrgid().

   - bpo-25850(115): Use cross-compilation by default for 64-bit
     Windows.

   - bpo-25822(116): Add docstrings to the fields of urllib.parse
     results.  Patch contributed by Swati Jaiswal.

   - bpo-22642(117): Convert trace module option parsing mechanism to
     argparse.  Patch contributed by SilentGhost.

   - bpo-24705(118): Fix sysconfig._parse_makefile not expanding ${}
     vars appearing before $() vars.

   - bpo-26069(119): Remove the deprecated apis in the trace module.

   - bpo-22138(120): Fix mock.patch behavior when patching descriptors.
     Restore original values after patching.  Patch contributed by Sean
     McCully.

   - bpo-25672(121): In the ssl module, enable the
     SSL_MODE_RELEASE_BUFFERS mode option if it is safe to do so.

   - bpo-26012(122): Don't traverse into symlinks for ‘**’ pattern in
     pathlib.Path.[r]glob().

   - bpo-24120(123): Ignore PermissionError when traversing a tree with
     pathlib.Path.[r]glob().  Patch by Ulrich Petri.

   - bpo-21815(124): Accept ] characters in the data portion of imap
     responses, in order to handle the flags with square brackets
     accepted and produced by servers such as gmail.

   - bpo-25447(125): fileinput now uses sys.stdin as-is if it does not
     have a buffer attribute (restores backward compatibility).

   - bpo-25971(126): Optimized creating Fractions from floats by 2 times
     and from Decimals by 3 times.

   - bpo-25802(127): Document as deprecated the remaining
     implementations of importlib.abc.Loader.load_module().

   - bpo-25928(128): Add Decimal.as_integer_ratio().

   - bpo-25447(129): Copying the lru_cache() wrapper object now always
     works, independently from the type of the wrapped object (by
     returning the original object unchanged).

   - bpo-25768(130): Have the functions in compileall return booleans
     instead of ints and add proper documentation and tests for the
     return values.

   - bpo-24103(131): Fixed possible use after free in
     ElementTree.XMLPullParser.

   - bpo-25860(132): os.fwalk() no longer skips remaining directories
     when error occurs.  Original patch by Samson Lee.

   - bpo-25914(133): Fixed and simplified OrderedDict.__sizeof__.

   - bpo-25869(134): Optimized deepcopying ElementTree; it is now 20
     times faster.

   - bpo-25873(135): Optimized iterating ElementTree.  Iterating
     elements Element.iter() is now 40% faster, iterating text
     Element.itertext() is now up to 2.5 times faster.

   - bpo-25902(136): Fixed various refcount issues in ElementTree
     iteration.

   - bpo-22227(137): The TarFile iterator is reimplemented using
     generator.  This implementation is simpler that using class.

   - bpo-25638(138): Optimized ElementTree.iterparse(); it is now 2x
     faster.  Optimized ElementTree parsing; it is now 10% faster.

   - bpo-25761(139): Improved detecting errors in broken pickle data.

   - bpo-25717(140): Restore the previous behaviour of tolerating most
     fstat() errors when opening files.  This was a regression in 3.5a1,
     and stopped anonymous temporary files from working in special
     cases.

   - bpo-24903(141): Fix regression in number of arguments compileall
     accepts when '-d' is specified.  The check on the number of
     arguments has been dropped completely as it never worked correctly
     anyway.

   - bpo-25764(142): In the subprocess module, preserve any exception
     caused by fork() failure when preexec_fn is used.

   - bpo-25771(143): Tweak the exception message for
     importlib.util.resolve_name() when 'package' isn't specified but
     necessary.

   - bpo-6478(144): _strptime's regexp cache now is reset after changing
     timezone with time.tzset().

   - bpo-14285(145): When executing a package with the "python -m
     package" option, and package initialization fails, a proper
     traceback is now reported.  The "runpy" module now lets exceptions
     from package initialization pass back to the caller, rather than
     raising ImportError.

   - bpo-19771(146): Also in runpy and the "-m" option, omit the
     irrelevant message ".  .  .  is a package and cannot be directly
     executed" if the package could not even be initialized (e.g.  due
     to a bad ‘*.pyc’ file).

   - bpo-25177(147): Fixed problem with the mean of very small and very
     large numbers.  As a side effect, statistics.mean and
     statistics.variance should be significantly faster.

   - bpo-25718(148): Fixed copying object with state with boolean value
     is false.

   - bpo-10131(149): Fixed deep copying of minidom documents.  Based on
     patch by Marian Ganisin.

   - bpo-7990(150): dir() on ElementTree.Element now lists properties:
     "tag", "text", "tail" and "attrib".  Original patch by Santoso
     Wijaya.

   - bpo-25725(151): Fixed a reference leak in pickle.loads() when
     unpickling invalid data including tuple instructions.

   - bpo-25663(152): In the Readline completer, avoid listing duplicate
     global names, and search the global namespace before searching
     builtins.

   - bpo-25688(153): Fixed file leak in ElementTree.iterparse() raising
     an error.

   - bpo-23914(154): Fixed SystemError raised by unpickler on broken
     pickle data.

   - bpo-25691(155): Fixed crash on deleting ElementTree.Element
     attributes.

   - bpo-25624(156): ZipFile now always writes a ZIP_STORED header for
     directory entries.  Patch by Dingyuan Wang.

   - bpo-25626(157): Change three zlib functions to accept sizes that
     fit in Py_ssize_t, but internally cap those sizes to UINT_MAX. This
     resolves a regression in 3.5 where GzipFile.read() failed to read
     chunks larger than 2 or 4 GiB. The change affects the
     zlib.Decompress.decompress() max_length parameter, the
     zlib.decompress() bufsize parameter, and the
     zlib.Decompress.flush() length parameter.

   - bpo-25583(158): Avoid incorrect errors raised by
     os.makedirs(exist_ok=True) when the OS gives priority to errors
     such as EACCES over EEXIST.

   - bpo-25593(159): Change semantics of EventLoop.stop() in asyncio.

   - bpo-6973(160): When we know a subprocess.Popen process has died, do
     not allow the send_signal(), terminate(), or kill() methods to do
     anything as they could potentially signal a different process.

   - bpo-23883(161): Added missing APIs to __all__ to match the
     documented APIs for the following modules: calendar, csv, enum,
     fileinput, ftplib, logging, optparse, tarfile, threading and wave.
     Also added a test.support.check__all__() helper.  Patches by Jacek
     Kołodziej, Mauro S. M. Rodrigues and Joel Taddei.

   - bpo-25590(162): In the Readline completer, only call getattr() once
     per attribute.  Also complete names of attributes such as
     properties and slots which are listed by dir() but not yet created
     on an instance.

   - bpo-25498(163): Fix a crash when garbage-collecting ctypes objects
     created by wrapping a memoryview.  This was a regression made in
     3.5a1.  Based on patch by Eryksun.

   - bpo-25584(164): Added "escape" to the __all__ list in the glob
     module.

   - bpo-25584(165): Fixed recursive glob() with patterns starting with
     ‘**’.

   - bpo-25446(166): Fix regression in smtplib's AUTH LOGIN support.

   - bpo-18010(167): Fix the pydoc web server's module search function
     to handle exceptions from importing packages.

   - bpo-25554(168): Got rid of circular references in regular
     expression parsing.

   - bpo-18973(169): Command-line interface of the calendar module now
     uses argparse instead of optparse.

   - bpo-25510(170): fileinput.FileInput.readline() now returns b''
     instead of '' at the end if the FileInput was opened with binary
     mode.  Patch by Ryosuke Ito.

   - bpo-25503(171): Fixed inspect.getdoc() for inherited docstrings of
     properties.  Original patch by John Mark Vandenberg.

   - bpo-25515(172): Always use os.urandom as a source of randomness in
     uuid.uuid4.

   - bpo-21827(173): Fixed textwrap.dedent() for the case when largest
     common whitespace is a substring of smallest leading whitespace.
     Based on patch by Robert Li.

   - bpo-25447(174): The lru_cache() wrapper objects now can be copied
     and pickled (by returning the original object unchanged).

   - bpo-25390(175): typing: Don't crash on Union[str, Pattern].

   - bpo-25441(176): asyncio: Raise error from drain() when socket is
     closed.

   - bpo-25410(177): Cleaned up and fixed minor bugs in C implementation
     of OrderedDict.

   - bpo-25411(178): Improved Unicode support in SMTPHandler through
     better use of the email package.  Thanks to user simon04 for the
     patch.

   - Move the imp module from a PendingDeprecationWarning to
     DeprecationWarning.

   - bpo-25407(179): Remove mentions of the formatter module being
     removed in Python 3.6.

   - bpo-25406(180): Fixed a bug in C implementation of
     OrderedDict.move_to_end() that caused segmentation fault or hang in
     iterating after moving several items to the start of ordered dict.

   - bpo-25382(181): pickletools.dis() now outputs implicit memo index
     for the MEMOIZE opcode.

   - bpo-25357(182): Add an optional newline parameter to
     binascii.b2a_base64().  base64.b64encode() uses it to avoid a
     memory copy.

   - bpo-24164(183): Objects that need calling ‘__new__’ with keyword
     arguments, can now be pickled using pickle protocols older than
     protocol version 4.

   - bpo-25364(184): zipfile now works in threads disabled builds.

   - bpo-25328(185): smtpd's SMTPChannel now correctly raises a
     ValueError if both decode_data and enable_SMTPUTF8 are set to true.

   - bpo-16099(186): RobotFileParser now supports Crawl-delay and
     Request-rate extensions.  Patch by Nikolay Bogoychev.

   - bpo-25316(187): distutils raises OSError instead of
     DistutilsPlatformError when MSVC is not installed.

   - bpo-25380(188): Fixed protocol for the STACK_GLOBAL opcode in
     pickletools.opcodes.

   - bpo-23972(189): Updates asyncio datagram create method allowing
     reuseport and reuseaddr socket options to be set prior to binding
     the socket.  Mirroring the existing asyncio create_server method
     the reuseaddr option for datagram sockets defaults to True if the
     O/S is 'posix' (except if the platform is Cygwin).  Patch by Chris
     Laws.

   - bpo-25304(190): Add asyncio.run_coroutine_threadsafe().  This lets
     you submit a coroutine to a loop from another thread, returning a
     concurrent.futures.Future.  By Vincent Michel.

   - bpo-25232(191): Fix CGIRequestHandler to split the query from the
     URL at the first question mark (?)  rather than the last.  Patch
     from Xiang Zhang.

   - bpo-24657(192): Prevent CGIRequestHandler from collapsing slashes
     in the query part of the URL as if it were a path.  Patch from
     Xiang Zhang.

   - bpo-25287(193): Don't add crypt.METHOD_CRYPT to crypt.methods if
     it's not supported.  Check if it is supported, it may not be
     supported on OpenBSD for example.

   - bpo-23600(194): Default implementation of tzinfo.fromutc() was
     returning wrong results in some cases.

   - bpo-25203(195): Failed readline.set_completer_delims() no longer
     left the module in inconsistent state.

   - bpo-25011(196): rlcompleter now omits private and special attribute
     names unless the prefix starts with underscores.

   - bpo-25209(197): rlcompleter now can add a space or a colon after
     completed keyword.

   - bpo-22241(198): timezone.utc name is now plain 'UTC', not
     'UTC-00:00'.

   - bpo-23517(199): fromtimestamp() and utcfromtimestamp() methods of
     datetime.datetime now round microseconds to nearest with ties going
     to nearest even integer (ROUND_HALF_EVEN), as round(float), instead
     of rounding towards -Infinity (ROUND_FLOOR).

   - bpo-23552(200): Timeit now warns when there is substantial (4x)
     variance between best and worst times.  Patch from Serhiy
     Storchaka.

   - bpo-24633(201): site-packages/README -> README.txt.

   - bpo-24879(202): help() and pydoc can now list named tuple fields in
     the order they were defined rather than alphabetically.  The
     ordering is determined by the _fields attribute if present.

   - bpo-24874(203): Improve speed of itertools.cycle() and make its
     pickle more compact.

   - Fix crash in itertools.cycle.__setstate__() when the first argument
     wasn't a list.

   - bpo-20059(204): urllib.parse raises ValueError on all invalid
     ports.  Patch by Martin Panter.

   - bpo-24360(205): Improve __repr__ of argparse.Namespace() for
     invalid identifiers.  Patch by Matthias Bussonnier.

   - bpo-23426(206): run_setup was broken in distutils.  Patch from
     Alexander Belopolsky.

   - bpo-13938(207): 2to3 converts StringTypes to a tuple.  Patch from
     Mark Hammond.

   - bpo-2091(208): open() accepted a 'U' mode string containing '+',
     but 'U' can only be used with 'r'.  Patch from Jeff Balogh and John
     O'Connor.

   - bpo-8585(209): improved tests for zipimporter2.  Patch from Mark
     Lawrence.

   - bpo-18622(210): unittest.mock.mock_open().reset_mock would recurse
     infinitely.  Patch from Nicola Palumbo and Laurent De Buyst.

   - bpo-24426(211): Fast searching optimization in regular expressions
     now works for patterns that starts with capturing groups.  Fast
     searching optimization now can't be disabled at compile time.

   - bpo-23661(212): unittest.mock side_effects can now be exceptions
     again.  This was a regression vs Python 3.4.  Patch from Ignacio
     Rossi

   - bpo-13248(213): Remove deprecated inspect.getmoduleinfo function.

   - bpo-25578(214): Fix (another) memory leak in
     SSLSocket.getpeercer().

   - bpo-25530(215): Disable the vulnerable SSLv3 protocol by default
     when creating ssl.SSLContext.

   - bpo-25569(216): Fix memory leak in SSLSocket.getpeercert().

   - bpo-25471(217): Sockets returned from accept() shouldn't appear to
     be nonblocking.

   - bpo-25319(218): When threading.Event is reinitialized, the
     underlying condition should use a regular lock rather than a
     recursive lock.

   - Skip getaddrinfo if host is already resolved.  Patch by A. Jesse
     Jiryu Davis.

   - bpo-26050(219): Add asyncio.StreamReader.readuntil() method.  Patch
     by Марк Коренберг.

   - bpo-25924(220): Avoid unnecessary serialization of getaddrinfo(3)
     calls on OS X versions 10.5 or higher.  Original patch by A. Jesse
     Jiryu Davis.

   - bpo-26406(221): Avoid unnecessary serialization of getaddrinfo(3)
     calls on current versions of OpenBSD and NetBSD. Patch by A. Jesse
     Jiryu Davis.

   - bpo-26848(222): Fix asyncio/subprocess.communicate() to handle
     empty input.  Patch by Jack O'Connor.

   - bpo-27040(223): Add loop.get_exception_handler method

   - bpo-27041(224): asyncio: Add loop.create_future method

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27057

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27014

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27031

   (4) https://bugs.python.org/issue?@action=redirect&bpo=14132

   (5) https://bugs.python.org/issue?@action=redirect&bpo=17214

   (6) https://bugs.python.org/issue?@action=redirect&bpo=27033

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27034

   (8) https://bugs.python.org/issue?@action=redirect&bpo=26870

   (9) https://bugs.python.org/issue?@action=redirect&bpo=26039

   (10) https://bugs.python.org/issue?@action=redirect&bpo=26892

   (11) https://bugs.python.org/issue?@action=redirect&bpo=22274

   (12) https://bugs.python.org/issue?@action=redirect&bpo=26807

   (13) https://bugs.python.org/issue?@action=redirect&bpo=25745

   (14) https://bugs.python.org/issue?@action=redirect&bpo=26977

   (15) https://bugs.python.org/issue?@action=redirect&bpo=26002

   (16) https://bugs.python.org/issue?@action=redirect&bpo=25974

   (17) https://bugs.python.org/issue?@action=redirect&bpo=26996

   (18) https://peps.python.org/pep-0506/

   (19) https://bugs.python.org/issue?@action=redirect&bpo=26881

   (20) https://bugs.python.org/issue?@action=redirect&bpo=23815

   (21) https://bugs.python.org/issue?@action=redirect&bpo=17765

   (22) https://bugs.python.org/issue?@action=redirect&bpo=26873

   (23) https://bugs.python.org/issue?@action=redirect&bpo=26915

   (24) https://bugs.python.org/issue?@action=redirect&bpo=26711

   (25) https://bugs.python.org/issue?@action=redirect&bpo=24114

   (26) https://bugs.python.org/issue?@action=redirect&bpo=26864

   (27) https://bugs.python.org/issue?@action=redirect&bpo=24902

   (28) https://bugs.python.org/issue?@action=redirect&bpo=25788

   (29) https://bugs.python.org/issue?@action=redirect&bpo=26634

   (30) https://bugs.python.org/issue?@action=redirect&bpo=26804

   (31) https://bugs.python.org/issue?@action=redirect&bpo=26837

   (32) https://bugs.python.org/issue?@action=redirect&bpo=26041

   (33) https://bugs.python.org/issue?@action=redirect&bpo=26822

   (34) https://bugs.python.org/issue?@action=redirect&bpo=26733

   (35) https://bugs.python.org/issue?@action=redirect&bpo=26801

   (36) https://bugs.python.org/issue?@action=redirect&bpo=24838

   (37) https://bugs.python.org/issue?@action=redirect&bpo=26717

   (38) https://bugs.python.org/issue?@action=redirect&bpo=26782

   (39) https://bugs.python.org/issue?@action=redirect&bpo=26404

   (40) https://bugs.python.org/issue?@action=redirect&bpo=26735

   (41) https://bugs.python.org/issue?@action=redirect&bpo=26585

   (42) https://bugs.python.org/issue?@action=redirect&bpo=26685

   (43) https://bugs.python.org/issue?@action=redirect&bpo=16329

   (44) https://bugs.python.org/issue?@action=redirect&bpo=13952

   (45) https://bugs.python.org/issue?@action=redirect&bpo=26587

   (46) https://bugs.python.org/issue?@action=redirect&bpo=25609

   (47) https://bugs.python.org/issue?@action=redirect&bpo=26709

   (48) https://bugs.python.org/issue?@action=redirect&bpo=23735

   (49) https://bugs.python.org/issue?@action=redirect&bpo=25951

   (50) https://bugs.python.org/issue?@action=redirect&bpo=26586

   (51) https://bugs.python.org/issue?@action=redirect&bpo=26676

   (52) https://bugs.python.org/issue?@action=redirect&bpo=22854

   (53) https://bugs.python.org/issue?@action=redirect&bpo=26492

   (54) https://bugs.python.org/issue?@action=redirect&bpo=26641

   (55) https://bugs.python.org/issue?@action=redirect&bpo=25195

   (56) https://bugs.python.org/issue?@action=redirect&bpo=26644

   (57) https://bugs.python.org/issue?@action=redirect&bpo=23804

   (58) https://bugs.python.org/issue?@action=redirect&bpo=26616

   (59) https://bugs.python.org/issue?@action=redirect&bpo=26637

   (60) https://bugs.python.org/issue?@action=redirect&bpo=21925

   (61) https://bugs.python.org/issue?@action=redirect&bpo=23848

   (62) https://bugs.python.org/issue?@action=redirect&bpo=26530

   (63) https://bugs.python.org/issue?@action=redirect&bpo=26588

   (64) https://bugs.python.org/issue?@action=redirect&bpo=24266

   (65) https://bugs.python.org/issue?@action=redirect&bpo=26590

   (66) https://bugs.python.org/issue?@action=redirect&bpo=18787

   (67) https://bugs.python.org/issue?@action=redirect&bpo=26560

   (68) https://bugs.python.org/issue?@action=redirect&bpo=26567

   (69) https://bugs.python.org/issue?@action=redirect&bpo=26569

   (70) https://bugs.python.org/issue?@action=redirect&bpo=26499

   (71) https://bugs.python.org/issue?@action=redirect&bpo=25320

   (72) https://bugs.python.org/issue?@action=redirect&bpo=16181

   (73) https://bugs.python.org/issue?@action=redirect&bpo=26513

   (74) https://bugs.python.org/issue?@action=redirect&bpo=23718

   (75) https://bugs.python.org/issue?@action=redirect&bpo=26323

   (76) https://bugs.python.org/issue?@action=redirect&bpo=20589

   (77) https://bugs.python.org/issue?@action=redirect&bpo=26177

   (78) https://bugs.python.org/issue?@action=redirect&bpo=15068

   (79) https://bugs.python.org/issue?@action=redirect&bpo=19475

   (80) https://bugs.python.org/issue?@action=redirect&bpo=2202

   (81) https://bugs.python.org/issue?@action=redirect&bpo=26167

   (82) https://bugs.python.org/issue?@action=redirect&bpo=25718

   (83) https://bugs.python.org/issue?@action=redirect&bpo=26475

   (84) https://bugs.python.org/issue?@action=redirect&bpo=26482

   (85) https://bugs.python.org/issue?@action=redirect&bpo=26335

   (86) https://bugs.python.org/issue?@action=redirect&bpo=26457

   (87) https://bugs.python.org/issue?@action=redirect&bpo=26385

   (88) https://bugs.python.org/issue?@action=redirect&bpo=26402

   (89) https://bugs.python.org/issue?@action=redirect&bpo=25913

   (90) https://bugs.python.org/issue?@action=redirect&bpo=26186

   (91) https://bugs.python.org/issue?@action=redirect&bpo=26367

   (92) https://bugs.python.org/issue?@action=redirect&bpo=26309

   (93) https://bugs.python.org/issue?@action=redirect&bpo=23430

   (94) https://bugs.python.org/issue?@action=redirect&bpo=25995

   (95) https://bugs.python.org/issue?@action=redirect&bpo=25994

   (96) https://bugs.python.org/issue?@action=redirect&bpo=23992

   (97) https://bugs.python.org/issue?@action=redirect&bpo=26243

   (98) https://bugs.python.org/issue?@action=redirect&bpo=26117

   (99) https://bugs.python.org/issue?@action=redirect&bpo=25949

   (100) https://bugs.python.org/issue?@action=redirect&bpo=25911

   (101) https://bugs.python.org/issue?@action=redirect&bpo=26045

   (102) https://bugs.python.org/issue?@action=redirect&bpo=26039

   (103) https://bugs.python.org/issue?@action=redirect&bpo=12923

   (104) https://bugs.python.org/issue?@action=redirect&bpo=25945

   (105) https://bugs.python.org/issue?@action=redirect&bpo=26202

   (106) https://bugs.python.org/issue?@action=redirect&bpo=23076

   (107) https://bugs.python.org/issue?@action=redirect&bpo=19883

   (108) https://bugs.python.org/issue?@action=redirect&bpo=26227

   (109) https://bugs.python.org/issue?@action=redirect&bpo=26099

   (110) https://bugs.python.org/issue?@action=redirect&bpo=26147

   (111) https://bugs.python.org/issue?@action=redirect&bpo=25935

   (112) https://bugs.python.org/issue?@action=redirect&bpo=16620

   (113) https://bugs.python.org/issue?@action=redirect&bpo=26013

   (114) https://bugs.python.org/issue?@action=redirect&bpo=26129

   (115) https://bugs.python.org/issue?@action=redirect&bpo=25850

   (116) https://bugs.python.org/issue?@action=redirect&bpo=25822

   (117) https://bugs.python.org/issue?@action=redirect&bpo=22642

   (118) https://bugs.python.org/issue?@action=redirect&bpo=24705

   (119) https://bugs.python.org/issue?@action=redirect&bpo=26069

   (120) https://bugs.python.org/issue?@action=redirect&bpo=22138

   (121) https://bugs.python.org/issue?@action=redirect&bpo=25672

   (122) https://bugs.python.org/issue?@action=redirect&bpo=26012

   (123) https://bugs.python.org/issue?@action=redirect&bpo=24120

   (124) https://bugs.python.org/issue?@action=redirect&bpo=21815

   (125) https://bugs.python.org/issue?@action=redirect&bpo=25447

   (126) https://bugs.python.org/issue?@action=redirect&bpo=25971

   (127) https://bugs.python.org/issue?@action=redirect&bpo=25802

   (128) https://bugs.python.org/issue?@action=redirect&bpo=25928

   (129) https://bugs.python.org/issue?@action=redirect&bpo=25447

   (130) https://bugs.python.org/issue?@action=redirect&bpo=25768

   (131) https://bugs.python.org/issue?@action=redirect&bpo=24103

   (132) https://bugs.python.org/issue?@action=redirect&bpo=25860

   (133) https://bugs.python.org/issue?@action=redirect&bpo=25914

   (134) https://bugs.python.org/issue?@action=redirect&bpo=25869

   (135) https://bugs.python.org/issue?@action=redirect&bpo=25873

   (136) https://bugs.python.org/issue?@action=redirect&bpo=25902

   (137) https://bugs.python.org/issue?@action=redirect&bpo=22227

   (138) https://bugs.python.org/issue?@action=redirect&bpo=25638

   (139) https://bugs.python.org/issue?@action=redirect&bpo=25761

   (140) https://bugs.python.org/issue?@action=redirect&bpo=25717

   (141) https://bugs.python.org/issue?@action=redirect&bpo=24903

   (142) https://bugs.python.org/issue?@action=redirect&bpo=25764

   (143) https://bugs.python.org/issue?@action=redirect&bpo=25771

   (144) https://bugs.python.org/issue?@action=redirect&bpo=6478

   (145) https://bugs.python.org/issue?@action=redirect&bpo=14285

   (146) https://bugs.python.org/issue?@action=redirect&bpo=19771

   (147) https://bugs.python.org/issue?@action=redirect&bpo=25177

   (148) https://bugs.python.org/issue?@action=redirect&bpo=25718

   (149) https://bugs.python.org/issue?@action=redirect&bpo=10131

   (150) https://bugs.python.org/issue?@action=redirect&bpo=7990

   (151) https://bugs.python.org/issue?@action=redirect&bpo=25725

   (152) https://bugs.python.org/issue?@action=redirect&bpo=25663

   (153) https://bugs.python.org/issue?@action=redirect&bpo=25688

   (154) https://bugs.python.org/issue?@action=redirect&bpo=23914

   (155) https://bugs.python.org/issue?@action=redirect&bpo=25691

   (156) https://bugs.python.org/issue?@action=redirect&bpo=25624

   (157) https://bugs.python.org/issue?@action=redirect&bpo=25626

   (158) https://bugs.python.org/issue?@action=redirect&bpo=25583

   (159) https://bugs.python.org/issue?@action=redirect&bpo=25593

   (160) https://bugs.python.org/issue?@action=redirect&bpo=6973

   (161) https://bugs.python.org/issue?@action=redirect&bpo=23883

   (162) https://bugs.python.org/issue?@action=redirect&bpo=25590

   (163) https://bugs.python.org/issue?@action=redirect&bpo=25498

   (164) https://bugs.python.org/issue?@action=redirect&bpo=25584

   (165) https://bugs.python.org/issue?@action=redirect&bpo=25584

   (166) https://bugs.python.org/issue?@action=redirect&bpo=25446

   (167) https://bugs.python.org/issue?@action=redirect&bpo=18010

   (168) https://bugs.python.org/issue?@action=redirect&bpo=25554

   (169) https://bugs.python.org/issue?@action=redirect&bpo=18973

   (170) https://bugs.python.org/issue?@action=redirect&bpo=25510

   (171) https://bugs.python.org/issue?@action=redirect&bpo=25503

   (172) https://bugs.python.org/issue?@action=redirect&bpo=25515

   (173) https://bugs.python.org/issue?@action=redirect&bpo=21827

   (174) https://bugs.python.org/issue?@action=redirect&bpo=25447

   (175) https://bugs.python.org/issue?@action=redirect&bpo=25390

   (176) https://bugs.python.org/issue?@action=redirect&bpo=25441

   (177) https://bugs.python.org/issue?@action=redirect&bpo=25410

   (178) https://bugs.python.org/issue?@action=redirect&bpo=25411

   (179) https://bugs.python.org/issue?@action=redirect&bpo=25407

   (180) https://bugs.python.org/issue?@action=redirect&bpo=25406

   (181) https://bugs.python.org/issue?@action=redirect&bpo=25382

   (182) https://bugs.python.org/issue?@action=redirect&bpo=25357

   (183) https://bugs.python.org/issue?@action=redirect&bpo=24164

   (184) https://bugs.python.org/issue?@action=redirect&bpo=25364

   (185) https://bugs.python.org/issue?@action=redirect&bpo=25328

   (186) https://bugs.python.org/issue?@action=redirect&bpo=16099

   (187) https://bugs.python.org/issue?@action=redirect&bpo=25316

   (188) https://bugs.python.org/issue?@action=redirect&bpo=25380

   (189) https://bugs.python.org/issue?@action=redirect&bpo=23972

   (190) https://bugs.python.org/issue?@action=redirect&bpo=25304

   (191) https://bugs.python.org/issue?@action=redirect&bpo=25232

   (192) https://bugs.python.org/issue?@action=redirect&bpo=24657

   (193) https://bugs.python.org/issue?@action=redirect&bpo=25287

   (194) https://bugs.python.org/issue?@action=redirect&bpo=23600

   (195) https://bugs.python.org/issue?@action=redirect&bpo=25203

   (196) https://bugs.python.org/issue?@action=redirect&bpo=25011

   (197) https://bugs.python.org/issue?@action=redirect&bpo=25209

   (198) https://bugs.python.org/issue?@action=redirect&bpo=22241

   (199) https://bugs.python.org/issue?@action=redirect&bpo=23517

   (200) https://bugs.python.org/issue?@action=redirect&bpo=23552

   (201) https://bugs.python.org/issue?@action=redirect&bpo=24633

   (202) https://bugs.python.org/issue?@action=redirect&bpo=24879

   (203) https://bugs.python.org/issue?@action=redirect&bpo=24874

   (204) https://bugs.python.org/issue?@action=redirect&bpo=20059

   (205) https://bugs.python.org/issue?@action=redirect&bpo=24360

   (206) https://bugs.python.org/issue?@action=redirect&bpo=23426

   (207) https://bugs.python.org/issue?@action=redirect&bpo=13938

   (208) https://bugs.python.org/issue?@action=redirect&bpo=2091

   (209) https://bugs.python.org/issue?@action=redirect&bpo=8585

   (210) https://bugs.python.org/issue?@action=redirect&bpo=18622

   (211) https://bugs.python.org/issue?@action=redirect&bpo=24426

   (212) https://bugs.python.org/issue?@action=redirect&bpo=23661

   (213) https://bugs.python.org/issue?@action=redirect&bpo=13248

   (214) https://bugs.python.org/issue?@action=redirect&bpo=25578

   (215) https://bugs.python.org/issue?@action=redirect&bpo=25530

   (216) https://bugs.python.org/issue?@action=redirect&bpo=25569

   (217) https://bugs.python.org/issue?@action=redirect&bpo=25471

   (218) https://bugs.python.org/issue?@action=redirect&bpo=25319

   (219) https://bugs.python.org/issue?@action=redirect&bpo=26050

   (220) https://bugs.python.org/issue?@action=redirect&bpo=25924

   (221) https://bugs.python.org/issue?@action=redirect&bpo=26406

   (222) https://bugs.python.org/issue?@action=redirect&bpo=26848

   (223) https://bugs.python.org/issue?@action=redirect&bpo=27040

   (224) https://bugs.python.org/issue?@action=redirect&bpo=27041


File: python.info,  Node: IDLE<56>,  Next: ドキュメント<77>,  Prev: ライブラリ<189>,  Up: Python 3 6 0 alpha 1

1.24.97.4 IDLE
..............

   - bpo-20640(1): Add tests for idlelib.configHelpSourceEdit.  Patch by
     Saimadhav Heblikar.

   - In the 'IDLE-console differences' section of the IDLE doc, clarify
     how running with IDLE affects sys.modules and the standard streams.

   - bpo-25507(2): fix incorrect change in IOBinding that prevented
     printing.  Augment IOBinding htest to include all major IOBinding
     functions.

   - bpo-25905(3): Revert unwanted conversion of ' to ’ RIGHT SINGLE
     QUOTATION MARK in README.txt and open this and NEWS.txt with
     'ascii'.  Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'.

   - bpo-15348(4): Stop the debugger engine (normally in a user process)
     before closing the debugger window (running in the IDLE process).
     This prevents the RuntimeErrors that were being caught and ignored.

   - bpo-24455(5): Prevent IDLE from hanging when a) closing the shell
     while the debugger is active (15347); b) closing the debugger with
     the [X] button (15348); and c) activating the debugger when already
     active (24455).  The patch by Mark Roseman does this by making two
     changes.  1.  Suspend and resume the gui.interaction method with
     the tcl vwait mechanism intended for this purpose (instead of
     root.mainloop & .quit).  2.  In gui.run, allow any existing
     interaction to terminate first.

   - Change 'The program' to 'Your program' in an IDLE 'kill program?'
     message to make it clearer that the program referred to is the
     currently running user program, not IDLE itself.

   - bpo-24750(6): Improve the appearance of the IDLE editor window
     status bar.  Patch by Mark Roseman.

   - bpo-25313(7): Change the handling of new built-in text color themes
     to better address the compatibility problem introduced by the
     addition of IDLE Dark.  Consistently use the revised
     idleConf.CurrentTheme everywhere in idlelib.

   - bpo-24782(8): Extension configuration is now a tab in the IDLE
     Preferences dialog rather than a separate dialog.  The former tabs
     are now a sorted list.  Patch by Mark Roseman.

   - bpo-22726(9): Re-activate the config dialog help button with some
     content about the other buttons and the new IDLE Dark theme.

   - bpo-24820(10): IDLE now has an 'IDLE Dark' built-in text color
     theme.  It is more or less IDLE Classic inverted, with a cobalt
     blue background.  Strings, comments, keywords, ...  are still
     green, red, orange, ...  .  To use it with IDLEs released before
     November 2015, hit the 'Save as New Custom Theme' button and enter
     a new name, such as 'Custom Dark'.  The custom theme will work with
     any IDLE release, and can be modified.

   - bpo-25224(11): README.txt is now an idlelib index for IDLE
     developers and curious users.  The previous user content is now in
     the IDLE doc chapter.  'IDLE' now means 'Integrated Development and
     Learning Environment'.

   - bpo-24820(12): Users can now set breakpoint colors in Settings ->
     Custom Highlighting.  Original patch by Mark Roseman.

   - bpo-24972(13): Inactive selection background now matches active
     selection background, as configured by users, on all systems.
     Found items are now always highlighted on Windows.  Initial patch
     by Mark Roseman.

   - bpo-24570(14): Idle: make calltip and completion boxes appear on
     Macs affected by a tk regression.  Initial patch by Mark Roseman.

   - bpo-24988(15): Idle ScrolledList context menus (used in debugger)
     now work on Mac Aqua.  Patch by Mark Roseman.

   - bpo-24801(16): Make right-click for context menu work on Mac Aqua.
     Patch by Mark Roseman.

   - bpo-25173(17): Associate tkinter messageboxes with a specific
     widget.  For Mac OSX, make them a 'sheet'.  Patch by Mark Roseman.

   - bpo-25198(18): Enhance the initial html viewer now used for Idle
     Help.  Properly indent fixed-pitch text (patch by Mark Roseman).
     Give code snippet a very Sphinx-like light blueish-gray background.
     Re-use initial width and height set by users for shell and editor.
     When the Table of Contents (TOC) menu is used, put the section
     header at the top of the screen.

   - bpo-25225(19): Condense and rewrite Idle doc section on text
     colors.

   - bpo-21995(20): Explain some differences between IDLE and console
     Python.

   - bpo-22820(21): Explain need for 'print' when running file from Idle
     editor.

   - bpo-25224(22): Doc: augment Idle feature list and no-subprocess
     section.

   - bpo-25219(23): Update doc for Idle command line options.  Some were
     missing and notes were not correct.

   - bpo-24861(24): Most of idlelib is private and subject to change.
     Use idleib.idle.* to start Idle.  See idlelib.__init__.__doc__.

   - bpo-25199(25): Idle: add synchronization comments for future
     maintainers.

   - bpo-16893(26): Replace help.txt with help.html for Idle doc
     display.  The new idlelib/help.html is rstripped
     Doc/build/html/library/idle.html.  It looks better than help.txt
     and will better document Idle as released.  The tkinter html viewer
     that works for this file was written by Rose Roseman.  The now
     unused EditorWindow.HelpDialog class and helt.txt file are
     deprecated.

   - bpo-24199(27): Deprecate unused idlelib.idlever with possible
     removal in 3.6.

   - bpo-24790(28): Remove extraneous code (which also create 2 & 3
     conflicts).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20640

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25507

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25905

   (4) https://bugs.python.org/issue?@action=redirect&bpo=15348

   (5) https://bugs.python.org/issue?@action=redirect&bpo=24455

   (6) https://bugs.python.org/issue?@action=redirect&bpo=24750

   (7) https://bugs.python.org/issue?@action=redirect&bpo=25313

   (8) https://bugs.python.org/issue?@action=redirect&bpo=24782

   (9) https://bugs.python.org/issue?@action=redirect&bpo=22726

   (10) https://bugs.python.org/issue?@action=redirect&bpo=24820

   (11) https://bugs.python.org/issue?@action=redirect&bpo=25224

   (12) https://bugs.python.org/issue?@action=redirect&bpo=24820

   (13) https://bugs.python.org/issue?@action=redirect&bpo=24972

   (14) https://bugs.python.org/issue?@action=redirect&bpo=24570

   (15) https://bugs.python.org/issue?@action=redirect&bpo=24988

   (16) https://bugs.python.org/issue?@action=redirect&bpo=24801

   (17) https://bugs.python.org/issue?@action=redirect&bpo=25173

   (18) https://bugs.python.org/issue?@action=redirect&bpo=25198

   (19) https://bugs.python.org/issue?@action=redirect&bpo=25225

   (20) https://bugs.python.org/issue?@action=redirect&bpo=21995

   (21) https://bugs.python.org/issue?@action=redirect&bpo=22820

   (22) https://bugs.python.org/issue?@action=redirect&bpo=25224

   (23) https://bugs.python.org/issue?@action=redirect&bpo=25219

   (24) https://bugs.python.org/issue?@action=redirect&bpo=24861

   (25) https://bugs.python.org/issue?@action=redirect&bpo=25199

   (26) https://bugs.python.org/issue?@action=redirect&bpo=16893

   (27) https://bugs.python.org/issue?@action=redirect&bpo=24199

   (28) https://bugs.python.org/issue?@action=redirect&bpo=24790


File: python.info,  Node: ドキュメント<77>,  Next: テスト<77>,  Prev: IDLE<56>,  Up: Python 3 6 0 alpha 1

1.24.97.5 ドキュメント
......................

   - bpo-26736(1): Used HTTPS for external links in the documentation if
     possible.

   - bpo-6953(2): Rework the Readline module documentation to group
     related functions together, and add more details such as what
     underlying Readline functions and variables are accessed.

   - bpo-23606(3): Adds note to ctypes documentation regarding
     cdll.msvcrt.

   - bpo-24952(4): Clarify the default size argument of stack_size() in
     the "threading" and "_thread" modules.  Patch from Mattip.

   - bpo-26014(5): Update 3.x packaging documentation: * "See also"
     links to the new docs are now provided in the legacy pages * links
     to setuptools documentation have been updated

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26736

   (2) https://bugs.python.org/issue?@action=redirect&bpo=6953

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23606

   (4) https://bugs.python.org/issue?@action=redirect&bpo=24952

   (5) https://bugs.python.org/issue?@action=redirect&bpo=26014


File: python.info,  Node: テスト<77>,  Next: ビルド<88>,  Prev: ドキュメント<77>,  Up: Python 3 6 0 alpha 1

1.24.97.6 テスト
................

   - bpo-21916(1): Added tests for the turtle module.  Patch by ingrid,
     Gregory Loyse and Jelle Zijlstra.

   - bpo-26295(2): When using "python3 -m test -testdir=TESTDIR",
     regrtest doesn't add "test."  prefix to test module names.

   - bpo-26523(3): The multiprocessing thread pool
     (multiprocessing.dummy.Pool) was untested.

   - bpo-26015(4): Added new tests for pickling iterators of mutable
     sequences.

   - bpo-26325(5): Added test.support.check_no_resource_warning() to
     check that no ResourceWarning is emitted.

   - bpo-25940(6): Changed test_ssl to use its internal local server
     more.  This avoids relying on svn.python.org, which recently
     changed root certificate.

   - bpo-25616(7): Tests for OrderedDict are extracted from
     test_collections into separate file test_ordered_dict.

   - bpo-25449(8): Added tests for OrderedDict subclasses.

   - bpo-25188(9): Add -P/-pgo to test.regrtest to suppress error output
     when running the test suite for the purposes of a PGO build.
     Initial patch by Alecsandru Patrascu.

   - bpo-22806(10): Add ‘python -m test --list-tests’ command to list
     tests.

   - bpo-18174(11): ‘python -m test --huntrleaks ...’ now also checks
     for leak of file descriptors.  Patch written by Richard Oudkerk.

   - bpo-25260(12): Fix ‘python -m test --coverage’ on Windows.  Remove
     the list of ignored directories.

   - ‘PCbuild\rt.bat’ now accepts an unlimited number of arguments to
     pass along to regrtest.py.  Previously there was a limit of 9.

   - bpo-26583(13): Skip test_timestamp_overflow in test_import if
     bytecode files cannot be written.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21916

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26295

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26523

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26015

   (5) https://bugs.python.org/issue?@action=redirect&bpo=26325

   (6) https://bugs.python.org/issue?@action=redirect&bpo=25940

   (7) https://bugs.python.org/issue?@action=redirect&bpo=25616

   (8) https://bugs.python.org/issue?@action=redirect&bpo=25449

   (9) https://bugs.python.org/issue?@action=redirect&bpo=25188

   (10) https://bugs.python.org/issue?@action=redirect&bpo=22806

   (11) https://bugs.python.org/issue?@action=redirect&bpo=18174

   (12) https://bugs.python.org/issue?@action=redirect&bpo=25260

   (13) https://bugs.python.org/issue?@action=redirect&bpo=26583


File: python.info,  Node: ビルド<88>,  Next: Windows<76>,  Prev: テスト<77>,  Up: Python 3 6 0 alpha 1

1.24.97.7 ビルド
................

   - bpo-21277(1): Don't try to link _ctypes with a ffi_convenience
     library.

   - bpo-26884(2): Fix linking extension modules for cross builds.
     Patch by Xavier de Gaye.

   - bpo-26932(3): Fixed support of RTLD_* constants defined as enum
     values, not via macros (in particular on Android).  Patch by Chi
     Hsuan Yen.

   - bpo-22359(4): Disable the rules for running _freeze_importlib and
     pgen when cross-compiling.  The output of these programs is
     normally saved with the source code anyway, and is still
     regenerated when doing a native build.  Patch by Xavier de Gaye.

   - bpo-21668(5): Link audioop, _datetime, _ctypes_test modules to
     libm, except on Mac OS X. Patch written by Chi Hsuan Yen.

   - bpo-25702(6): A -with-lto configure option has been added that will
     enable link time optimizations at build time during a make
     profile-opt.  Some compilers and toolchains are known to not
     produce stable code when using LTO, be sure to test things
     thoroughly before relying on it.  It can provide a few % speed up
     over profile-opt alone.

   - bpo-26624(7): Adds validation of ucrtbase[d].dll version with
     warning for old versions.

   - bpo-17603(8): Avoid error about nonexistent fileblocks.o file by
     using a lower-level check for st_blocks in struct stat.

   - bpo-26079(9): Fixing the build output folder for tix-8.4.3.6.
     Patch by Bjoern Thiel.

   - bpo-26465(10): Update Windows builds to use OpenSSL 1.0.2g.

   - bpo-25348(11): Added ‘--pgo’ and ‘--pgo-job’ arguments to
     ‘PCbuild\build.bat’ for building with Profile-Guided Optimization.
     The old ‘PCbuild\build_pgo.bat’ script is removed.

   - bpo-25827(12): Add support for building with ICC to ‘configure’,
     including a new ‘--with-icc’ flag.

   - bpo-25696(13): Fix installation of Python on UNIX with make -j9.

   - bpo-24986(14): It is now possible to build Python on Windows
     without errors when external libraries are not available.

   - bpo-24421(15): Compile Modules/_math.c once, before building
     extensions.  Previously it could fail to compile properly if the
     math and cmath builds were concurrent.

   - bpo-26465(16): Update OS X 10.5+ 32-bit-only installer to build and
     link with OpenSSL 1.0.2g.

   - bpo-26268(17): Update Windows builds to use OpenSSL 1.0.2f.

   - bpo-25136(18): Support Apple Xcode 7's new textual SDK stub
     libraries.

   - bpo-24324(19): Do not enable unreachable code warnings when using
     gcc as the option does not work correctly in older versions of gcc
     and has been silently removed as of gcc-4.5.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21277

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26884

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26932

   (4) https://bugs.python.org/issue?@action=redirect&bpo=22359

   (5) https://bugs.python.org/issue?@action=redirect&bpo=21668

   (6) https://bugs.python.org/issue?@action=redirect&bpo=25702

   (7) https://bugs.python.org/issue?@action=redirect&bpo=26624

   (8) https://bugs.python.org/issue?@action=redirect&bpo=17603

   (9) https://bugs.python.org/issue?@action=redirect&bpo=26079

   (10) https://bugs.python.org/issue?@action=redirect&bpo=26465

   (11) https://bugs.python.org/issue?@action=redirect&bpo=25348

   (12) https://bugs.python.org/issue?@action=redirect&bpo=25827

   (13) https://bugs.python.org/issue?@action=redirect&bpo=25696

   (14) https://bugs.python.org/issue?@action=redirect&bpo=24986

   (15) https://bugs.python.org/issue?@action=redirect&bpo=24421

   (16) https://bugs.python.org/issue?@action=redirect&bpo=26465

   (17) https://bugs.python.org/issue?@action=redirect&bpo=26268

   (18) https://bugs.python.org/issue?@action=redirect&bpo=25136

   (19) https://bugs.python.org/issue?@action=redirect&bpo=24324


File: python.info,  Node: Windows<76>,  Next: Tools/Demos<54>,  Prev: ビルド<88>,  Up: Python 3 6 0 alpha 1

1.24.97.8 Windows
.................

   - bpo-27053(1): Updates make_zip.py to correctly generate library ZIP
     file.

   - bpo-26268(2): Update the prepare_ssl.py script to handle OpenSSL
     releases that don't include the contents of the include directory
     (that is, 1.0.2e and later).

   - bpo-26071(3): bdist_wininst created binaries fail to start and find
     32bit Python

   - bpo-26073(4): Update the list of magic numbers in launcher

   - bpo-26065(5): Excludes venv from library when generating embeddable
     distro.

   - bpo-25022(6): Removed very outdated PC/example_nt/ directory.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27053

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26268

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26071

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26073

   (5) https://bugs.python.org/issue?@action=redirect&bpo=26065

   (6) https://bugs.python.org/issue?@action=redirect&bpo=25022


File: python.info,  Node: Tools/Demos<54>,  Next: C API<74>,  Prev: Windows<76>,  Up: Python 3 6 0 alpha 1

1.24.97.9 Tools/Demos
.....................

   - bpo-26799(1): Fix python-gdb.py: don't get C types once when the
     Python code is loaded, but get C types on demand.  The C types can
     change if python-gdb.py is loaded before the Python executable.
     Patch written by Thomas Ilsche.

   - bpo-26271(2): Fix the Freeze tool to properly use flags passed
     through configure.  Patch by Daniel Shaulov.

   - bpo-26489(3): Add dictionary unpacking support to
     Tools/parser/unparse.py.  Patch by Guo Ci Teo.

   - bpo-26316(4): Fix variable name typo in Argument Clinic.

   - bpo-25440(5): Fix output of python-config -extension-suffix.

   - bpo-25154(6): The pyvenv script has been deprecated in favour of
     ‘python3 -m venv’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26799

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26271

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26489

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26316

   (5) https://bugs.python.org/issue?@action=redirect&bpo=25440

   (6) https://bugs.python.org/issue?@action=redirect&bpo=25154


File: python.info,  Node: C API<74>,  Prev: Tools/Demos<54>,  Up: Python 3 6 0 alpha 1

1.24.97.10 C API
................

   - bpo-26312(1): SystemError is now raised in all programming bugs
     with using PyArg_ParseTupleAndKeywords().  RuntimeError did raised
     before in some programming bugs.

   - bpo-26198(2): ValueError is now raised instead of TypeError on
     buffer overflow in parsing "es#" and "et#" format units.
     SystemError is now raised instead of TypeError on programmatical
     error in parsing format string.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26312

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26198


File: python.info,  Node: Python 3 5 5 final,  Next: Python 3 5 5 release candidate 1,  Prev: Python 3 6 0 alpha 1,  Up: 変更履歴

1.24.98 Python 3.5.5 final
--------------------------

'Release date: 2018-02-04'

There were no new changes in version 3.5.5.


File: python.info,  Node: Python 3 5 5 release candidate 1,  Next: Python 3 5 4 final,  Prev: Python 3 5 5 final,  Up: 変更履歴

1.24.99 Python 3.5.5 release candidate 1
----------------------------------------

'Release date: 2018-01-23'

* Menu:

* セキュリティ: セキュリティ<57>.
* Core and Builtins: Core and Builtins<187>.
* ライブラリ: ライブラリ<190>.


File: python.info,  Node: セキュリティ<57>,  Next: Core and Builtins<187>,  Up: Python 3 5 5 release candidate 1

1.24.99.1 セキュリティ
......................

   - bpo-32551(1): The ‘sys.path[0]’ initialization change for
     bpo-29139(2) caused a regression by revealing an inconsistency in
     how sys.path is initialized when executing ‘__main__’ from a
     zipfile, directory, or other import location.  This is considered a
     potential security issue, as it may lead to privileged processes
     unexpectedly loading code from user controlled directories in
     situations where that was not previously the case.  The interpreter
     now consistently avoids ever adding the import location's parent
     directory to ‘sys.path’, and ensures no other ‘sys.path’ entries
     are inadvertently modified when inserting the import location named
     on the command line.  (Originally reported as bpo-29723(3) against
     Python 3.6rc1, but it was missed at the time that the then upcoming
     Python 3.5.4 release would also be affected)

   - bpo-30657(4): Fixed possible integer overflow in
     PyBytes_DecodeEscape, CVE 2017-1000158(5).  Original patch by Jay
     Bosamiya; rebased to Python 3 by Miro Hrončok.

   - bpo-30947(6): Upgrade libexpat embedded copy from version 2.2.1 to
     2.2.3 to get security fixes.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32551

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29139

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29723

   (4) https://bugs.python.org/issue?@action=redirect&bpo=30657

   (5) https://www.cve.org/CVERecord?id=CVE-2017-1000158

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30947


File: python.info,  Node: Core and Builtins<187>,  Next: ライブラリ<190>,  Prev: セキュリティ<57>,  Up: Python 3 5 5 release candidate 1

1.24.99.2 Core and Builtins
...........................

   - bpo-31095(1): Fix potential crash during GC caused by ‘tp_dealloc’
     which doesn't call ‘PyObject_GC_UnTrack()’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=31095


File: python.info,  Node: ライブラリ<190>,  Prev: Core and Builtins<187>,  Up: Python 3 5 5 release candidate 1

1.24.99.3 ライブラリ
....................

   - bpo-32072(1): Fixed issues with binary plists: Fixed saving
     bytearrays.  Identical objects will be saved only once.  Equal
     references will be load as identical objects.  Added support for
     saving and loading recursive data structures.

   - bpo-31170(2): expat: Update libexpat from 2.2.3 to 2.2.4.  Fix
     copying of partial characters for UTF-8 input (libexpat bug 115):
     ‘https://github.com/libexpat/libexpat/issues/115’

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=32072

   (2) https://bugs.python.org/issue?@action=redirect&bpo=31170


File: python.info,  Node: Python 3 5 4 final,  Next: Python 3 5 4 release candidate 1,  Prev: Python 3 5 5 release candidate 1,  Up: 変更履歴

1.24.100 Python 3.5.4 final
---------------------------

'Release date: 2017-08-07'

* Menu:

* ライブラリ: ライブラリ<191>.


File: python.info,  Node: ライブラリ<191>,  Up: Python 3 5 4 final

1.24.100.1 ライブラリ
.....................

   - bpo-30119(1): ftplib.FTP.putline() now throws ValueError on
     commands that contains CR or LF. Patch by Donghee Na.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30119


File: python.info,  Node: Python 3 5 4 release candidate 1,  Next: Python 3 5 3 final,  Prev: Python 3 5 4 final,  Up: 変更履歴

1.24.101 Python 3.5.4 release candidate 1
-----------------------------------------

'Release date: 2017-07-23'

* Menu:

* セキュリティ: セキュリティ<58>.
* Core and Builtins: Core and Builtins<188>.
* ライブラリ: ライブラリ<192>.
* ドキュメント: ドキュメント<78>.
* テスト: テスト<78>.
* ビルド: ビルド<89>.
* Windows: Windows<77>.
* C API: C API<75>.


File: python.info,  Node: セキュリティ<58>,  Next: Core and Builtins<188>,  Up: Python 3 5 4 release candidate 1

1.24.101.1 セキュリティ
.......................

   - bpo-30730(1): Prevent environment variables injection in subprocess
     on Windows.  Prevent passing other environment variables and
     command arguments.

   - bpo-30694(2): Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes
     of multiple security vulnerabilities including: CVE 2017-9233(3)
     (External entity infinite loop DoS), CVE 2016-9063(4) (Integer
     overflow, re-fix), CVE 2016-0718(5) (Fix regression bugs from
     2.2.0's fix to CVE 2016-0718(6)) and CVE 2012-0876(7) (Counter hash
     flooding with SipHash).  Note: the CVE 2016-5300(8) (Use
     os-specific entropy sources like getrandom) doesn't impact Python,
     since Python already gets entropy from the OS to set the expat
     secret using ‘XML_SetHashSalt()’.

   - bpo-30500(9): Fix urllib.parse.splithost() to correctly parse
     fragments.  For example, ‘splithost('//127.0.0.1#@evil.com/')’ now
     correctly returns the ‘127.0.0.1’ host, instead of treating
     ‘@evil.com’ as the host in an authentication (‘login@host’).

   - bpo-29591(10): Update expat copy from 2.1.1 to 2.2.0 to get fixes
     of CVE 2016-0718(11) and CVE 2016-4472(12).  See
     ‘https://sourceforge.net/p/expat/bugs/537/’ for more information.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30730

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30694

   (3) https://www.cve.org/CVERecord?id=CVE-2017-9233

   (4) https://www.cve.org/CVERecord?id=CVE-2016-9063

   (5) https://www.cve.org/CVERecord?id=CVE-2016-0718

   (6) https://www.cve.org/CVERecord?id=CVE-2016-0718

   (7) https://www.cve.org/CVERecord?id=CVE-2012-0876

   (8) https://www.cve.org/CVERecord?id=CVE-2016-5300

   (9) https://bugs.python.org/issue?@action=redirect&bpo=30500

   (10) https://bugs.python.org/issue?@action=redirect&bpo=29591

   (11) https://www.cve.org/CVERecord?id=CVE-2016-0718

   (12) https://www.cve.org/CVERecord?id=CVE-2016-4472


File: python.info,  Node: Core and Builtins<188>,  Next: ライブラリ<192>,  Prev: セキュリティ<58>,  Up: Python 3 5 4 release candidate 1

1.24.101.2 Core and Builtins
............................

   - bpo-30876(1): Relative import from unloaded package now reimports
     the package instead of failing with SystemError.  Relative import
     from non-package now fails with ImportError rather than
     SystemError.

   - bpo-30765(2): Avoid blocking in pthread_mutex_lock() when
     PyThread_acquire_lock() is asked not to block.

   - bpo-27945(3): Fixed various segfaults with dict when input
     collections are mutated during searching, inserting or comparing.
     Based on patches by Duane Griffin and Tim Mitchell.

   - bpo-25794(4): Fixed type.__setattr__() and type.__delattr__() for
     non-interned attribute names.  Based on patch by Eryk Sun.

   - bpo-29935(5): Fixed error messages in the index() method of tuple,
     list and deque when pass indices of wrong type.

   - bpo-28876(6): ‘bool(range)’ works even if ‘len(range)’ raises *note
     OverflowError: a81.

   - bpo-29600(7): Fix wrapping coroutine return values in
     StopIteration.

   - bpo-29537(8): Restore runtime compatibility with bytecode files
     generated by CPython 3.5.0 to 3.5.2, and adjust the eval loop to
     avoid the problems that could be caused by the malformed variant of
     the BUILD_MAP_UNPACK_WITH_CALL opcode that they may contain.  Patch
     by Petr Viktorin, Serhiy Storchaka, and Nick Coghlan.

   - bpo-28598(9): Support __rmod__ for subclasses of str being called
     before str.__mod__.  Patch by Martijn Pieters.

   - bpo-29602(10): Fix incorrect handling of signed zeros in complex
     constructor for complex subclasses and for inputs having a
     __complex__ method.  Patch by Serhiy Storchaka.

   - bpo-29347(11): Fixed possibly dereferencing undefined pointers when
     creating weakref objects.

   - bpo-29438(12): Fixed use-after-free problem in key sharing dict.

   - bpo-29319(13): Prevent RunMainFromImporter overwriting sys.path[0].

   - bpo-29337(14): Fixed possible BytesWarning when compare the code
     objects.  Warnings could be emitted at compile time.

   - bpo-29478(15): If max_line_length=None is specified while using the
     Compat32 policy, it is no longer ignored.  Patch by Mircea Cosbuc.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30876

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30765

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27945

   (4) https://bugs.python.org/issue?@action=redirect&bpo=25794

   (5) https://bugs.python.org/issue?@action=redirect&bpo=29935

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28876

   (7) https://bugs.python.org/issue?@action=redirect&bpo=29600

   (8) https://bugs.python.org/issue?@action=redirect&bpo=29537

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28598

   (10) https://bugs.python.org/issue?@action=redirect&bpo=29602

   (11) https://bugs.python.org/issue?@action=redirect&bpo=29347

   (12) https://bugs.python.org/issue?@action=redirect&bpo=29438

   (13) https://bugs.python.org/issue?@action=redirect&bpo=29319

   (14) https://bugs.python.org/issue?@action=redirect&bpo=29337

   (15) https://bugs.python.org/issue?@action=redirect&bpo=29478


File: python.info,  Node: ライブラリ<192>,  Next: ドキュメント<78>,  Prev: Core and Builtins<188>,  Up: Python 3 5 4 release candidate 1

1.24.101.3 ライブラリ
.....................

   - bpo-29403(1): Fix ‘unittest.mock’'s autospec to not fail on
     method-bound builtin functions.  Patch by Aaron Gallagher.

   - bpo-30961(2): Fix decrementing a borrowed reference in tracemalloc.

   - bpo-30886(3): Fix multiprocessing.Queue.join_thread(): it now waits
     until the thread completes, even if the thread was started by the
     same process which created the queue.

   - bpo-29854(4): Fix segfault in readline when using readline's
     history-size option.  Patch by Nir Soffer.

   - bpo-30807(5): signal.setitimer() may disable the timer when passed
     a tiny value.  Tiny values (such as 1e-6) are valid non-zero values
     for setitimer(), which is specified as taking
     microsecond-resolution intervals.  However, on some platform, our
     conversion routine could convert 1e-6 into a zero interval,
     therefore disabling the timer instead of (re-)scheduling it.

   - bpo-30441(6): Fix bug when modifying os.environ while iterating
     over it

   - bpo-30532(7): Fix email header value parser dropping folding white
     space in certain cases.

   - bpo-29169(8): Update zlib to 1.2.11.

   - bpo-30879(9): os.listdir() and os.scandir() now emit bytes names
     when called with bytes-like argument.

   - bpo-30746(10): Prohibited the '=' character in environment variable
     names in ‘os.putenv()’ and ‘os.spawn*()’.

   - bpo-29755(11): Fixed the lgettext() family of functions in the
     gettext module.  They now always return bytes.

   - bpo-30645(12): Fix path calculation in imp.load_package(), fixing
     it for cases when a package is only shipped with bytecodes.  Patch
     by Alexandru Ardelean.

   - bpo-23890(13): unittest.TestCase.assertRaises() now manually breaks
     a reference cycle to not keep objects alive longer than expected.

   - bpo-30149(14): inspect.signature() now supports callables with
     variable-argument parameters wrapped with partialmethod.  Patch by
     Donghee Na.

   - bpo-29931(15): Fixed comparison check for ipaddress.ip_interface
     objects.  Patch by Sanjay Sundaresan.

   - bpo-24484(16): Avoid race condition in multiprocessing cleanup.

   - bpo-28994(17): The traceback no longer displayed for SystemExit
     raised in a callback registered by atexit.

   - bpo-30508(18): Don't log exceptions if Task/Future "cancel()"
     method was called.

   - bpo-28556(19): Updates to typing module: Add generic
     AsyncContextManager, add support for ContextManager on all
     versions.  Original PRs by Jelle Zijlstra and Ivan Levkivskyi

   - bpo-29870(20): Fix ssl sockets leaks when connection is aborted in
     asyncio/ssl implementation.  Patch by Michaël Sghaïer.

   - bpo-29743(21): Closing transport during handshake process leaks
     open socket.  Patch by Nikolay Kim

   - bpo-27585(22): Fix waiter cancellation in asyncio.Lock.  Patch by
     Mathieu Sornay.

   - bpo-30418(23): On Windows, subprocess.Popen.communicate() now also
     ignore EINVAL on stdin.write() if the child process is still
     running but closed the pipe.

   - bpo-30378(24): Fix the problem that logging.handlers.SysLogHandler
     cannot handle IPv6 addresses.

   - bpo-29960(25): Preserve generator state when
     _random.Random.setstate() raises an exception.  Patch by Bryan
     Olson.

   - bpo-30414(26): multiprocessing.Queue._feed background running
     thread do not break from main loop on exception.

   - bpo-30003(27): Fix handling escape characters in HZ codec.  Based
     on patch by Ma Lin.

   - bpo-30301(28): Fix AttributeError when using SimpleQueue.empty()
     under 'spawn' and 'forkserver' start methods.

   - bpo-30329(29): imaplib and poplib now catch the Windows socket
     WSAEINVAL error (code 10022) on shutdown(SHUT_RDWR): An invalid
     operation was attempted.  This error occurs sometimes on SSL
     connections.

   - bpo-30375(30): Warnings emitted when compile a regular expression
     now always point to the line in the user code.  Previously they
     could point into inners of the re module if emitted from inside of
     groups or conditionals.

   - bpo-30048(31): Fixed ‘Task.cancel()’ can be ignored when the task
     is running coroutine and the coroutine returned without any more
     ‘await’.

   - bpo-29990(32): Fix range checking in GB18030 decoder.  Original
     patch by Ma Lin.

   - bpo-26293(33): Change resulted because of zipfile breakage.  (See
     also: bpo-29094(34))

   - bpo-30243(35): Removed the __init__ methods of _json's scanner and
     encoder.  Misusing them could cause memory leaks or crashes.  Now
     scanner and encoder objects are completely initialized in the
     __new__ methods.

   - bpo-30185(36): Avoid KeyboardInterrupt tracebacks in forkserver
     helper process when Ctrl-C is received.

   - bpo-28556(37): Various updates to typing module: add
     typing.NoReturn type, use WrapperDescriptorType, minor bug-fixes.
     Original PRs by Jim Fasarakis-Hilliard and Ivan Levkivskyi.

   - bpo-30205(38): Fix getsockname() for unbound AF_UNIX sockets on
     Linux.

   - bpo-30070(39): Fixed leaks and crashes in errors handling in the
     parser module.

   - bpo-30061(40): Fixed crashes in IOBase methods __next__() and
     readlines() when readline() or __next__() respectively return
     non-sizeable object.  Fixed possible other errors caused by not
     checking results of PyObject_Size(), PySequence_Size(), or
     PyMapping_Size().

   - bpo-30068(41): _io._IOBase.readlines will check if it's closed
     first when hint is present.

   - bpo-29694(42): Fixed race condition in pathlib mkdir with flags
     parents=True.  Patch by Armin Rigo.

   - bpo-29692(43): Fixed arbitrary unchaining of RuntimeError
     exceptions in contextlib.contextmanager.  Patch by Siddharth
     Velankar.

   - bpo-29998(44): Pickling and copying ImportError now preserves name
     and path attributes.

   - bpo-29942(45): Fix a crash in itertools.chain.from_iterable when
     encountering long runs of empty iterables.

   - bpo-27863(46): Fixed multiple crashes in ElementTree caused by race
     conditions and wrong types.

   - bpo-28699(47): Fixed a bug in pools in multiprocessing.pool that
     raising an exception at the very first of an iterable may swallow
     the exception or make the program hang.  Patch by Davin Potts and
     Xiang Zhang.

   - bpo-25803(48): Avoid incorrect errors raised by
     Path.mkdir(exist_ok=True) when the OS gives priority to errors such
     as EACCES over EEXIST.

   - bpo-29861(49): Release references to tasks, their arguments and
     their results as soon as they are finished in multiprocessing.Pool.

   - bpo-29884(50): faulthandler: Restore the old sigaltstack during
     teardown.  Patch by Christophe Zeitouny.

   - bpo-25455(51): Fixed crashes in repr of recursive buffered
     file-like objects.

   - bpo-29800(52): Fix crashes in partial.__repr__ if the keys of
     partial.keywords are not strings.  Patch by Michael Seifert.

   - bpo-29742(53): get_extra_info() raises exception if get called on
     closed ssl transport.  Patch by Nikolay Kim.

   - bpo-8256(54): Fixed possible failing or crashing input() if
     attributes "encoding" or "errors" of sys.stdin or sys.stdout are
     not set or are not strings.

   - bpo-28298(55): Fix a bug that prevented array 'Q', 'L' and 'I' from
     accepting big intables (objects that have __int__) as elements.
     Patch by Oren Milman.

   - bpo-29615(56): SimpleXMLRPCDispatcher no longer chains KeyError (or
     any other exception) to exception(s) raised in the dispatched
     methods.  Patch by Petr Motejlek.

   - bpo-29704(57): asyncio.subprocess.SubprocessStreamProtocol no
     longer closes before all pipes are closed.

   - bpo-29703(58): Fix asyncio to support instantiation of new event
     loops in child processes.

   - bpo-29376(59): Fix assertion error in
     threading._DummyThread.is_alive().

   - bpo-29110(60): Fix file object leak in aifc.open() when file is
     given as a filesystem path and is not in valid AIFF format.  Patch
     by Anthony Zhang.

   - bpo-28961(61): Fix unittest.mock._Call helper: don't ignore the
     name parameter anymore.  Patch written by Jiajun Huang.

   - bpo-29532(62): Altering a kwarg dictionary passed to
     functools.partial() no longer affects a partial object after
     creation.

   - bpo-28556(63): Various updates to typing module: typing.Counter,
     typing.ChainMap, improved ABC caching, etc.  Original PRs by Jelle
     Zijlstra, Ivan Levkivskyi, Manuel Krebber, and Łukasz Langa.

   - bpo-29100(64): Fix datetime.fromtimestamp() regression introduced
     in Python 3.6.0: check minimum and maximum years.

   - bpo-29519(65): Fix weakref spewing exceptions during interpreter
     shutdown when used with a rare combination of multiprocessing and
     custom codecs.

   - bpo-29416(66): Prevent infinite loop in pathlib.Path.mkdir

   - bpo-29444(67): Fixed out-of-bounds buffer access in the group()
     method of the match object.  Based on patch by WGH.

   - bpo-29335(68): Fix subprocess.Popen.wait() when the child process
     has exited to a stopped instead of terminated state (ex: when under
     ptrace).

   - bpo-29290(69): Fix a regression in argparse that help messages
     would wrap at non-breaking spaces.

   - bpo-28735(70): Fixed the comparison of mock.MagickMock with
     mock.ANY.

   - bpo-29011(71): Fix an important omission by adding Deque to the
     typing module.

   - bpo-29219(72): Fixed infinite recursion in the repr of
     uninitialized ctypes.CDLL instances.

   - bpo-28969(73): Fixed race condition in C implementation of
     functools.lru_cache.  KeyError could be raised when cached function
     with full cache was simultaneously called from different threads
     with the same uncached arguments.

   - bpo-29142(74): In urllib.request, suffixes in no_proxy environment
     variable with leading dots could match related hostnames again
     (e.g.  .b.c matches a.b.c).  Patch by Milan Oberkirch.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29403

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30961

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30886

   (4) https://bugs.python.org/issue?@action=redirect&bpo=29854

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30807

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30441

   (7) https://bugs.python.org/issue?@action=redirect&bpo=30532

   (8) https://bugs.python.org/issue?@action=redirect&bpo=29169

   (9) https://bugs.python.org/issue?@action=redirect&bpo=30879

   (10) https://bugs.python.org/issue?@action=redirect&bpo=30746

   (11) https://bugs.python.org/issue?@action=redirect&bpo=29755

   (12) https://bugs.python.org/issue?@action=redirect&bpo=30645

   (13) https://bugs.python.org/issue?@action=redirect&bpo=23890

   (14) https://bugs.python.org/issue?@action=redirect&bpo=30149

   (15) https://bugs.python.org/issue?@action=redirect&bpo=29931

   (16) https://bugs.python.org/issue?@action=redirect&bpo=24484

   (17) https://bugs.python.org/issue?@action=redirect&bpo=28994

   (18) https://bugs.python.org/issue?@action=redirect&bpo=30508

   (19) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (20) https://bugs.python.org/issue?@action=redirect&bpo=29870

   (21) https://bugs.python.org/issue?@action=redirect&bpo=29743

   (22) https://bugs.python.org/issue?@action=redirect&bpo=27585

   (23) https://bugs.python.org/issue?@action=redirect&bpo=30418

   (24) https://bugs.python.org/issue?@action=redirect&bpo=30378

   (25) https://bugs.python.org/issue?@action=redirect&bpo=29960

   (26) https://bugs.python.org/issue?@action=redirect&bpo=30414

   (27) https://bugs.python.org/issue?@action=redirect&bpo=30003

   (28) https://bugs.python.org/issue?@action=redirect&bpo=30301

   (29) https://bugs.python.org/issue?@action=redirect&bpo=30329

   (30) https://bugs.python.org/issue?@action=redirect&bpo=30375

   (31) https://bugs.python.org/issue?@action=redirect&bpo=30048

   (32) https://bugs.python.org/issue?@action=redirect&bpo=29990

   (33) https://bugs.python.org/issue?@action=redirect&bpo=26293

   (34) https://bugs.python.org/issue?@action=redirect&bpo=29094

   (35) https://bugs.python.org/issue?@action=redirect&bpo=30243

   (36) https://bugs.python.org/issue?@action=redirect&bpo=30185

   (37) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (38) https://bugs.python.org/issue?@action=redirect&bpo=30205

   (39) https://bugs.python.org/issue?@action=redirect&bpo=30070

   (40) https://bugs.python.org/issue?@action=redirect&bpo=30061

   (41) https://bugs.python.org/issue?@action=redirect&bpo=30068

   (42) https://bugs.python.org/issue?@action=redirect&bpo=29694

   (43) https://bugs.python.org/issue?@action=redirect&bpo=29692

   (44) https://bugs.python.org/issue?@action=redirect&bpo=29998

   (45) https://bugs.python.org/issue?@action=redirect&bpo=29942

   (46) https://bugs.python.org/issue?@action=redirect&bpo=27863

   (47) https://bugs.python.org/issue?@action=redirect&bpo=28699

   (48) https://bugs.python.org/issue?@action=redirect&bpo=25803

   (49) https://bugs.python.org/issue?@action=redirect&bpo=29861

   (50) https://bugs.python.org/issue?@action=redirect&bpo=29884

   (51) https://bugs.python.org/issue?@action=redirect&bpo=25455

   (52) https://bugs.python.org/issue?@action=redirect&bpo=29800

   (53) https://bugs.python.org/issue?@action=redirect&bpo=29742

   (54) https://bugs.python.org/issue?@action=redirect&bpo=8256

   (55) https://bugs.python.org/issue?@action=redirect&bpo=28298

   (56) https://bugs.python.org/issue?@action=redirect&bpo=29615

   (57) https://bugs.python.org/issue?@action=redirect&bpo=29704

   (58) https://bugs.python.org/issue?@action=redirect&bpo=29703

   (59) https://bugs.python.org/issue?@action=redirect&bpo=29376

   (60) https://bugs.python.org/issue?@action=redirect&bpo=29110

   (61) https://bugs.python.org/issue?@action=redirect&bpo=28961

   (62) https://bugs.python.org/issue?@action=redirect&bpo=29532

   (63) https://bugs.python.org/issue?@action=redirect&bpo=28556

   (64) https://bugs.python.org/issue?@action=redirect&bpo=29100

   (65) https://bugs.python.org/issue?@action=redirect&bpo=29519

   (66) https://bugs.python.org/issue?@action=redirect&bpo=29416

   (67) https://bugs.python.org/issue?@action=redirect&bpo=29444

   (68) https://bugs.python.org/issue?@action=redirect&bpo=29335

   (69) https://bugs.python.org/issue?@action=redirect&bpo=29290

   (70) https://bugs.python.org/issue?@action=redirect&bpo=28735

   (71) https://bugs.python.org/issue?@action=redirect&bpo=29011

   (72) https://bugs.python.org/issue?@action=redirect&bpo=29219

   (73) https://bugs.python.org/issue?@action=redirect&bpo=28969

   (74) https://bugs.python.org/issue?@action=redirect&bpo=29142


File: python.info,  Node: ドキュメント<78>,  Next: テスト<78>,  Prev: ライブラリ<192>,  Up: Python 3 5 4 release candidate 1

1.24.101.4 ドキュメント
.......................

   - bpo-30176(1): Add missing attribute related constants in curses
     documentation.

   - bpo-26985(2): Add missing info of code object in inspect
     documentation.

   - bpo-28929(3): Link the documentation to its source file on GitHub.

   - bpo-25008(4): Document smtpd.py as effectively deprecated and add a
     pointer to aiosmtpd, a third-party asyncio-based replacement.

   - bpo-26355(5): Add canonical header link on each page to
     corresponding major version of the documentation.  Patch by
     Matthias Bussonnier.

   - bpo-29349(6): Fix Python 2 syntax in code for building the
     documentation.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30176

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26985

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28929

   (4) https://bugs.python.org/issue?@action=redirect&bpo=25008

   (5) https://bugs.python.org/issue?@action=redirect&bpo=26355

   (6) https://bugs.python.org/issue?@action=redirect&bpo=29349


File: python.info,  Node: テスト<78>,  Next: ビルド<89>,  Prev: ドキュメント<78>,  Up: Python 3 5 4 release candidate 1

1.24.101.5 テスト
.................

   - bpo-30822(1): Fix regrtest command line parser to allow passing -u
     extralargefile to run test_zipfile64.

   - bpo-30383(2): regrtest: Enhance regrtest and backport features from
     the master branch.  Add options: -coverage, -testdir, -list-tests
     (list test files, don't run them), -list-cases (list test
     identifiers, don't run them, bpo-30523(3)), -matchfile (load a list
     of test filters from a text file, bpo-30540(4)), -slowest (alias to
     -slow).  Enhance output: add timestamp, test result, currently
     running tests, "Tests result: xxx" summary with total duration,
     etc.  Fix reference leak hunting in regrtest, -huntrleaks: regrtest
     now warms up caches, create explicitly all internal singletons
     which are created on demand to prevent false positives when
     checking for reference leaks.  (bpo-30675(5)).

   - bpo-30357(6): test_thread: setUp() now uses
     support.threading_setup() and support.threading_cleanup() to wait
     until threads complete to avoid random side effects on following
     tests.  Initial patch written by Grzegorz Grzywacz.

   - bpo-28087(7): Skip test_asyncore and test_eintr poll failures on
     macOS. Skip some tests of select.poll when running on macOS due to
     unresolved issues with the underlying system poll function on some
     macOS versions.

   - bpo-30197(8): Enhanced functions swap_attr() and swap_item() in the
     test.support module.  They now work when delete replaced attribute
     or item inside the with statement.  The old value of the attribute
     or item (or None if it doesn't exist) now will be assigned to the
     target of the "as" clause, if there is one.

   - bpo-29571(9): to match the behaviour of the ‘re.LOCALE’ flag,
     test_re.test_locale_flag now uses
     ‘locale.getpreferredencoding(False)’ to determine the candidate
     encoding for the test regex (allowing it to correctly skip the test
     when the default locale encoding is a multi-byte encoding)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30822

   (2) https://bugs.python.org/issue?@action=redirect&bpo=30383

   (3) https://bugs.python.org/issue?@action=redirect&bpo=30523

   (4) https://bugs.python.org/issue?@action=redirect&bpo=30540

   (5) https://bugs.python.org/issue?@action=redirect&bpo=30675

   (6) https://bugs.python.org/issue?@action=redirect&bpo=30357

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28087

   (8) https://bugs.python.org/issue?@action=redirect&bpo=30197

   (9) https://bugs.python.org/issue?@action=redirect&bpo=29571


File: python.info,  Node: ビルド<89>,  Next: Windows<77>,  Prev: テスト<78>,  Up: Python 3 5 4 release candidate 1

1.24.101.6 ビルド
.................

   - bpo-29243(1): Prevent unnecessary rebuilding of Python during ‘make
     test’, ‘make install’ and some other make targets when configured
     with ‘--enable-optimizations’.

   - bpo-23404(2): Don't regenerate generated files based on file
     modification time anymore: the action is now explicit.  Replace
     ‘make touch’ with ‘make regen-all’.

   - bpo-29643(3): Fix ‘--enable-optimization’ didn't work.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29243

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23404

   (3) https://bugs.python.org/issue?@action=redirect&bpo=29643


File: python.info,  Node: Windows<77>,  Next: C API<75>,  Prev: ビルド<89>,  Up: Python 3 5 4 release candidate 1

1.24.101.7 Windows
..................

   - bpo-30687(1): Locate msbuild.exe on Windows when building rather
     than vcvarsall.bat

   - bpo-29392(2): Prevent crash when passing invalid arguments into
     msvcrt module.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=30687

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29392


File: python.info,  Node: C API<75>,  Prev: Windows<77>,  Up: Python 3 5 4 release candidate 1

1.24.101.8 C API
................

   - bpo-27867(1): Function PySlice_GetIndicesEx() is replaced with a
     macro if Py_LIMITED_API is set to the value between 0x03050400 and
     0x03060000 (not including) or 0x03060100 or higher.

   - bpo-29083(2): Fixed the declaration of some public API functions.
     PyArg_VaParse() and PyArg_VaParseTupleAndKeywords() were not
     available in limited API. PyArg_ValidateKeywordArguments(),
     PyArg_UnpackTuple() and Py_BuildValue() were not available in
     limited API of version < 3.3 when PY_SSIZE_T_CLEAN is defined.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27867

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29083


File: python.info,  Node: Python 3 5 3 final,  Next: Python 3 5 3 release candidate 1,  Prev: Python 3 5 4 release candidate 1,  Up: 変更履歴

1.24.102 Python 3.5.3 final
---------------------------

'Release date: 2017-01-17'

There were no code changes between 3.5.3rc1 and 3.5.3 final.


File: python.info,  Node: Python 3 5 3 release candidate 1,  Next: Python 3 5 2 final,  Prev: Python 3 5 3 final,  Up: 変更履歴

1.24.103 Python 3.5.3 release candidate 1
-----------------------------------------

'Release date: 2017-01-02'

* Menu:

* セキュリティ: セキュリティ<59>.
* Core and Builtins: Core and Builtins<189>.
* ライブラリ: ライブラリ<193>.
* IDLE: IDLE<57>.
* C API: C API<76>.
* ドキュメント: ドキュメント<79>.
* テスト: テスト<79>.
* Tools/Demos: Tools/Demos<55>.
* Windows: Windows<78>.
* ビルド: ビルド<90>.


File: python.info,  Node: セキュリティ<59>,  Next: Core and Builtins<189>,  Up: Python 3 5 3 release candidate 1

1.24.103.1 セキュリティ
.......................

   - bpo-27278(1): Fix os.urandom() implementation using getrandom() on
     Linux.  Truncate size to INT_MAX and loop until we collected enough
     random bytes, instead of casting a directly Py_ssize_t to int.

   - bpo-22636(2): Avoid shell injection problems with
     ctypes.util.find_library().

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27278

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22636


File: python.info,  Node: Core and Builtins<189>,  Next: ライブラリ<193>,  Prev: セキュリティ<59>,  Up: Python 3 5 3 release candidate 1

1.24.103.2 Core and Builtins
............................

   - bpo-29073(1): bytearray formatting no longer truncates on first
     null byte.

   - bpo-28932(2): Do not include <sys/random.h> if it does not exist.

   - bpo-28147(3): Fix a memory leak in split-table dictionaries:
     setattr() must not convert combined table into split table.

   - bpo-25677(4): Correct the positioning of the syntax error caret for
     indented blocks.  Based on patch by Michael Layzell.

   - bpo-29000(5): Fixed bytes formatting of octals with zero padding in
     alternate form.

   - bpo-28512(6): Fixed setting the offset attribute of SyntaxError by
     PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().

   - bpo-28991(7): functools.lru_cache() was susceptible to an obscure
     reentrancy bug caused by a monkey-patched len() function.

   - bpo-28648(8): Fixed crash in Py_DecodeLocale() in debug build on
     Mac OS X when decode astral characters.  Patch by Xiang Zhang.

   - bpo-19398(9): Extra slash no longer added to sys.path components in
     case of empty compile-time PYTHONPATH components.

   - bpo-28426(10): Fixed potential crash in PyUnicode_AsDecodedObject()
     in debug build.

   - bpo-23782(11): Fixed possible memory leak in _PyTraceback_Add() and
     exception loss in PyTraceBack_Here().

   - bpo-28379(12): Added sanity checks and tests for
     PyUnicode_CopyCharacters().  Patch by Xiang Zhang.

   - bpo-28376(13): The type of long range iterator is now registered as
     Iterator.  Patch by Oren Milman.

   - bpo-28376(14): The constructor of range_iterator now checks that
     step is not 0.  Patch by Oren Milman.

   - bpo-26906(15): Resolving special methods of uninitialized type now
     causes implicit initialization of the type instead of a fail.

   - bpo-18287(16): PyType_Ready() now checks that tp_name is not NULL.
     Original patch by Niklas Koep.

   - bpo-24098(17): Fixed possible crash when AST is changed in process
     of compiling it.

   - bpo-28350(18): String constants with null character no longer
     interned.

   - bpo-26617(19): Fix crash when GC runs during weakref callbacks.

   - bpo-27942(20): String constants now interned recursively in tuples
     and frozensets.

   - bpo-21578(21): Fixed misleading error message when ImportError
     called with invalid keyword args.

   - bpo-28203(22): Fix incorrect type in error message from
     ‘complex(1.0, {2:3})’.  Patch by Soumya Sharma.

   - bpo-27955(23): Fallback on reading /dev/urandom device when the
     getrandom() syscall fails with EPERM, for example when blocked by
     SECCOMP.

   - bpo-28131(24): Fix a regression in zipimport's compile_source().
     zipimport should use the same optimization level as the
     interpreter.

   - bpo-25221(25): Fix corrupted result from PyLong_FromLong(0) when
     Python is compiled with NSMALLPOSINTS = 0.

   - bpo-25758(26): Prevents zipimport from unnecessarily encoding a
     filename (patch by Eryk Sun)

   - bpo-28189(27): dictitems_contains no longer swallows compare
     errors.  (Patch by Xiang Zhang)

   - bpo-27812(28): Properly clear out a generator's frame's
     backreference to the generator to prevent crashes in frame.clear().

   - bpo-27811(29): Fix a crash when a coroutine that has not been
     awaited is finalized with warnings-as-errors enabled.

   - bpo-27587(30): Fix another issue found by PVS-Studio: Null pointer
     check after use of 'def' in _PyState_AddModule().  Initial patch by
     Christian Heimes.

   - bpo-26020(31): set literal evaluation order did not match
     documented behaviour.

   - bpo-27782(32): Multi-phase extension module import now correctly
     allows the ‘m_methods’ field to be used to add module level
     functions to instances of non-module types returned from
     ‘Py_create_mod’.  Patch by Xiang Zhang.

   - bpo-27936(33): The round() function accepted a second None argument
     for some types but not for others.  Fixed the inconsistency by
     accepting None for all numeric types.

   - bpo-27487(34): Warn if a submodule argument to "python -m" or
     runpy.run_module() is found in sys.modules after parent packages
     are imported, but before the submodule is executed.

   - bpo-27558(35): Fix a SystemError in the implementation of "raise"
     statement.  In a brand new thread, raise a RuntimeError since there
     is no active exception to reraise.  Patch written by Xiang Zhang.

   - bpo-27419(36): Standard __import__() no longer look up "__import__"
     in globals or builtins for importing submodules or "from import".
     Fixed handling an error of non-string package name.

   - bpo-27083(37): Respect the PYTHONCASEOK environment variable under
     Windows.

   - bpo-27514(38): Make having too many statically nested blocks a
     SyntaxError instead of SystemError.

   - bpo-27473(39): Fixed possible integer overflow in bytes and
     bytearray concatenations.  Patch by Xiang Zhang.

   - bpo-27507(40): Add integer overflow check in bytearray.extend().
     Patch by Xiang Zhang.

   - bpo-27581(41): Don't rely on wrapping for overflow check in
     PySequence_Tuple().  Patch by Xiang Zhang.

   - bpo-27443(42): __length_hint__() of bytearray iterators no longer
     return a negative integer for a resized bytearray.

   - bpo-27942(43): Fix memory leak in codeobject.c

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29073

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28932

   (3) https://bugs.python.org/issue?@action=redirect&bpo=28147

   (4) https://bugs.python.org/issue?@action=redirect&bpo=25677

   (5) https://bugs.python.org/issue?@action=redirect&bpo=29000

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28512

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28991

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28648

   (9) https://bugs.python.org/issue?@action=redirect&bpo=19398

   (10) https://bugs.python.org/issue?@action=redirect&bpo=28426

   (11) https://bugs.python.org/issue?@action=redirect&bpo=23782

   (12) https://bugs.python.org/issue?@action=redirect&bpo=28379

   (13) https://bugs.python.org/issue?@action=redirect&bpo=28376

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28376

   (15) https://bugs.python.org/issue?@action=redirect&bpo=26906

   (16) https://bugs.python.org/issue?@action=redirect&bpo=18287

   (17) https://bugs.python.org/issue?@action=redirect&bpo=24098

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28350

   (19) https://bugs.python.org/issue?@action=redirect&bpo=26617

   (20) https://bugs.python.org/issue?@action=redirect&bpo=27942

   (21) https://bugs.python.org/issue?@action=redirect&bpo=21578

   (22) https://bugs.python.org/issue?@action=redirect&bpo=28203

   (23) https://bugs.python.org/issue?@action=redirect&bpo=27955

   (24) https://bugs.python.org/issue?@action=redirect&bpo=28131

   (25) https://bugs.python.org/issue?@action=redirect&bpo=25221

   (26) https://bugs.python.org/issue?@action=redirect&bpo=25758

   (27) https://bugs.python.org/issue?@action=redirect&bpo=28189

   (28) https://bugs.python.org/issue?@action=redirect&bpo=27812

   (29) https://bugs.python.org/issue?@action=redirect&bpo=27811

   (30) https://bugs.python.org/issue?@action=redirect&bpo=27587

   (31) https://bugs.python.org/issue?@action=redirect&bpo=26020

   (32) https://bugs.python.org/issue?@action=redirect&bpo=27782

   (33) https://bugs.python.org/issue?@action=redirect&bpo=27936

   (34) https://bugs.python.org/issue?@action=redirect&bpo=27487

   (35) https://bugs.python.org/issue?@action=redirect&bpo=27558

   (36) https://bugs.python.org/issue?@action=redirect&bpo=27419

   (37) https://bugs.python.org/issue?@action=redirect&bpo=27083

   (38) https://bugs.python.org/issue?@action=redirect&bpo=27514

   (39) https://bugs.python.org/issue?@action=redirect&bpo=27473

   (40) https://bugs.python.org/issue?@action=redirect&bpo=27507

   (41) https://bugs.python.org/issue?@action=redirect&bpo=27581

   (42) https://bugs.python.org/issue?@action=redirect&bpo=27443

   (43) https://bugs.python.org/issue?@action=redirect&bpo=27942


File: python.info,  Node: ライブラリ<193>,  Next: IDLE<57>,  Prev: Core and Builtins<189>,  Up: Python 3 5 3 release candidate 1

1.24.103.3 ライブラリ
.....................

   - bpo-15812(1): inspect.getframeinfo() now correctly shows the first
     line of a context.  Patch by Sam Breese.

   - bpo-29094(2): Offsets in a ZIP file created with extern file object
     and modes "w" and "x" now are relative to the start of the file.

   - bpo-13051(3): Fixed recursion errors in large or resized
     curses.textpad.Textbox.  Based on patch by Tycho Andersen.

   - bpo-29119(4): Fix weakrefs in the pure python version of
     collections.OrderedDict move_to_end() method.  Contributed by Andra
     Bogildea.

   - bpo-9770(5): curses.ascii predicates now work correctly with
     negative integers.

   - bpo-28427(6): old keys should not remove new values from
     WeakValueDictionary when collecting from another thread.

   - bpo-28923(7): Remove editor artifacts from Tix.py.

   - bpo-28871(8): Fixed a crash when deallocate deep ElementTree.

   - bpo-19542(9): Fix bugs in WeakValueDictionary.setdefault() and
     WeakValueDictionary.pop() when a GC collection happens in another
     thread.

   - bpo-20191(10): Fixed a crash in resource.prlimit() when pass a
     sequence that doesn't own its elements as limits.

   - bpo-28779(11): multiprocessing.set_forkserver_preload() would crash
     the forkserver process if a preloaded module instantiated some
     multiprocessing objects such as locks.

   - bpo-28847(12): dbm.dumb now supports reading read-only files and no
     longer writes the index file when it is not changed.

   - bpo-25659(13): In ctypes, prevent a crash calling the from_buffer()
     and from_buffer_copy() methods on abstract classes like Array.

   - bpo-28732(14): Fix crash in os.spawnv() with no elements in args

   - bpo-28485(15): Always raise ValueError for negative
     compileall.compile_dir(workers=...)  parameter, even when
     multithreading is unavailable.

   - bpo-28387(16): Fixed possible crash in _io.TextIOWrapper
     deallocator when the garbage collector is invoked in other thread.
     Based on patch by Sebastian Cufre.

   - bpo-27517(17): LZMA compressor and decompressor no longer raise
     exceptions if given empty data twice.  Patch by Benjamin Fogle.

   - bpo-28549(18): Fixed segfault in curses's addch() with ncurses6.

   - bpo-28449(19): tarfile.open() with mode "r" or "r:" now tries to
     open a tar file with compression before trying to open it without
     compression.  Otherwise it had 50% chance failed with
     ignore_zeros=True.

   - bpo-23262(20): The webbrowser module now supports Firefox 36+ and
     derived browsers.  Based on patch by Oleg Broytman.

   - bpo-27939(21): Fixed bugs in tkinter.ttk.LabeledScale and
     tkinter.Scale caused by representing the scale as float value
     internally in Tk.  tkinter.IntVar now works if float value is set
     to underlying Tk variable.

   - bpo-28255(22): calendar.TextCalendar().prmonth() no longer prints a
     space at the start of new line after printing a month's calendar.
     Patch by Xiang Zhang.

   - bpo-20491(23): The textwrap.TextWrapper class now honors
     non-breaking spaces.  Based on patch by Kaarle Ritvanen.

   - bpo-28353(24): os.fwalk() no longer fails on broken links.

   - bpo-25464(25): Fixed HList.header_exists() in tkinter.tix module by
     addin a workaround to Tix library bug.

   - bpo-28488(26): shutil.make_archive() no longer add entry "./" to
     ZIP archive.

   - bpo-24452(27): Make webbrowser support Chrome on Mac OS X.

   - bpo-20766(28): Fix references leaked by pdb in the handling of
     SIGINT handlers.

   - bpo-26293(29): Fixed writing ZIP files that starts not from the
     start of the file.  Offsets in ZIP file now are relative to the
     start of the archive in conforming to the specification.

   - bpo-28321(30): Fixed writing non-BMP characters with binary format
     in plistlib.

   - bpo-28322(31): Fixed possible crashes when unpickle itertools
     objects from incorrect pickle data.  Based on patch by John Leitch.

   - Fix possible integer overflows and crashes in the mmap module with
     unusual usage patterns.

   - bpo-1703178(32): Fix the ability to pass the -link-objects option
     to the distutils build_ext command.

   - bpo-28253(33): Fixed calendar functions for extreme months: 0001-01
     and 9999-12.  Methods itermonthdays() and itermonthdays2() are
     reimplemented so that they don't call itermonthdates() which can
     cause datetime.date under/overflow.

   - bpo-28275(34): Fixed possible use after free in the decompress()
     methods of the LZMADecompressor and BZ2Decompressor classes.
     Original patch by John Leitch.

   - bpo-27897(35): Fixed possible crash in
     sqlite3.Connection.create_collation() if pass invalid string-like
     object as a name.  Patch by Xiang Zhang.

   - bpo-18893(36): Fix invalid exception handling in
     Lib/ctypes/macholib/dyld.py.  Patch by Madison May.

   - bpo-27611(37): Fixed support of default root window in the
     tkinter.tix module.

   - bpo-27348(38): In the traceback module, restore the formatting of
     exception messages like "Exception: None".  This fixes a regression
     introduced in 3.5a2.

   - bpo-25651(39): Allow false values to be used for msg parameter of
     subTest().

   - bpo-27932(40): Prevent memory leak in win32_ver().

   - Fix UnboundLocalError in socket._sendfile_use_sendfile.

   - bpo-28075(41): Check for ERROR_ACCESS_DENIED in Windows
     implementation of os.stat().  Patch by Eryk Sun.

   - bpo-25270(42): Prevent codecs.escape_encode() from raising
     SystemError when an empty bytestring is passed.

   - bpo-28181(43): Get antigravity over HTTPS. Patch by Kaartic
     Sivaraam.

   - bpo-25895(44): Enable WebSocket URL schemes in
     urllib.parse.urljoin.  Patch by Gergely Imreh and Markus
     Holtermann.

   - bpo-27599(45): Fixed buffer overrun in binascii.b2a_qp() and
     binascii.a2b_qp().

   - bpo-19003(46): m email.generator now replaces only ‘\r’ and/or ‘\n’
     line endings, per the RFC, instead of all unicode line endings.

   - bpo-28019(47): itertools.count() no longer rounds non-integer step
     in range between 1.0 and 2.0 to 1.

   - bpo-25969(48): Update the lib2to3 grammar to handle the unpacking
     generalizations added in 3.5.

   - bpo-14977(49): mailcap now respects the order of the lines in the
     mailcap files ("first match"), as required by RFC 1542.  Patch by
     Michael Lazar.

   - bpo-24594(50): Validates persist parameter when opening MSI
     database

   - bpo-17582(51): xml.etree.ElementTree nows preserves whitespaces in
     attributes (Patch by Duane Griffin.  Reviewed and approved by
     Stefan Behnel.)

   - bpo-28047(52): Fixed calculation of line length used for the base64
     CTE in the new email policies.

   - bpo-27445(53): Don't pass str(_charset) to MIMEText.set_payload().
     Patch by Claude Paroz.

   - bpo-22450(54): urllib now includes an ‘Accept: */*’ header among
     the default headers.  This makes the results of REST API requests
     more consistent and predictable especially when proxy servers are
     involved.

   - lib2to3.pgen3.driver.load_grammar() now creates a stable cache file
     between runs given the same Grammar.txt input regardless of the
     hash randomization setting.

   - bpo-27570(55): Avoid zero-length memcpy() etc calls with null
     source pointers in the "ctypes" and "array" modules.

   - bpo-22233(56): Break email header lines 'only' on the RFC specified
     CR and LF characters, not on arbitrary unicode line breaks.  This
     also fixes a bug in HTTP header parsing.

   - bpo-27988(57): Fix email iter_attachments incorrect mutation of
     payload list.

   - bpo-27691(58): Fix ssl module's parsing of GEN_RID subject
     alternative name fields in X.509 certs.

   - bpo-27850(59): Remove 3DES from ssl module's default cipher list to
     counter measure sweet32 attack ( CVE 2016-2183(60)).

   - bpo-27766(61): Add ChaCha20 Poly1305 to ssl module's default cipher
     list.  (Required OpenSSL 1.1.0 or LibreSSL).

   - bpo-26470(62): Port ssl and hashlib module to OpenSSL 1.1.0.

   - Remove support for passing a file descriptor to os.access.  It
     never worked but previously didn't raise.

   - bpo-12885(63): Fix error when distutils encounters symlink.

   - bpo-27881(64): Fixed possible bugs when setting
     sqlite3.Connection.isolation_level.  Based on patch by Xiang Zhang.

   - bpo-27861(65): Fixed a crash in sqlite3.Connection.cursor() when a
     factory creates not a cursor.  Patch by Xiang Zhang.

   - bpo-19884(66): Avoid spurious output on OS X with Gnu Readline.

   - bpo-27706(67): Restore deterministic behavior of
     random.Random().seed() for string seeds using seeding version 1.
     Allows sequences of calls to random() to exactly match those
     obtained in Python 2.  Patch by Nofar Schnider.

   - bpo-10513(68): Fix a regression in Connection.commit().  Statements
     should not be reset after a commit.

   - A new version of typing.py from ‘https://github.com/python/typing’:
     Collection (only for 3.6) (bpo-27598(69)).  Add FrozenSet to
     __all__ (upstream #261).  Fix crash in _get_type_vars() (upstream
     #259).  Remove the dict constraint in ForwardRef._eval_type
     (upstream #252).

   - bpo-27539(70): Fix unnormalised ‘Fraction.__pow__’ result in the
     case of negative exponent and negative base.

   - bpo-21718(71): cursor.description is now available for queries
     using CTEs.

   - bpo-2466(72): posixpath.ismount now correctly recognizes mount
     points which the user does not have permission to access.

   - bpo-27773(73): Correct some memory management errors
     server_hostname in _ssl.wrap_socket().

   - bpo-26750(74): unittest.mock.create_autospec() now works properly
     for subclasses of property() and other data descriptors.

   - In the curses module, raise an error if window.getstr() or
     window.instr() is passed a negative value.

   - bpo-27783(75): Fix possible usage of uninitialized memory in
     operator.methodcaller.

   - bpo-27774(76): Fix possible Py_DECREF on unowned object in _sre.

   - bpo-27760(77): Fix possible integer overflow in binascii.b2a_qp.

   - bpo-27758(78): Fix possible integer overflow in the _csv module for
     large record lengths.

   - bpo-27568(79): Prevent HTTPoxy attack ( CVE 2016-1000110(80)).
     Ignore the HTTP_PROXY variable when REQUEST_METHOD environment is
     set, which indicates that the script is in CGI mode.

   - bpo-27656(81): Do not assume sched.h defines any SCHED_* constants.

   - bpo-27130(82): In the "zlib" module, fix handling of large buffers
     (typically 4 GiB) when compressing and decompressing.  Previously,
     inputs were limited to 4 GiB, and compression and decompression
     operations did not properly handle results of 4 GiB.

   - bpo-27533(83): Release GIL in nt._isdir

   - bpo-17711(84): Fixed unpickling by the persistent ID with protocol
     0.  Original patch by Alexandre Vassalotti.

   - bpo-27522(85): Avoid an unintentional reference cycle in
     email.feedparser.

   - bpo-26844(86): Fix error message for imp.find_module() to refer to
     'path' instead of 'name'.  Patch by Lev Maximov.

   - bpo-23804(87): Fix SSL zero-length recv() calls to not block and
     not raise an error about unclean EOF.

   - bpo-27466(88): Change time format returned by
     http.cookie.time2netscape, confirming the netscape cookie format
     and making it consistent with documentation.

   - bpo-26664(89): Fix activate.fish by removing mis-use of ‘$’.

   - bpo-22115(90): Fixed tracing Tkinter variables: trace_vdelete()
     with wrong mode no longer break tracing, trace_vinfo() now always
     returns a list of pairs of strings, tracing in the "u" mode now
     works.

   - Fix a scoping issue in importlib.util.LazyLoader which triggered an
     UnboundLocalError when lazy-loading a module that was already put
     into sys.modules.

   - bpo-27079(91): Fixed curses.ascii functions isblank(), iscntrl()
     and ispunct().

   - bpo-26754(92): Some functions (compile() etc) accepted a filename
     argument encoded as an iterable of integers.  Now only strings and
     byte-like objects are accepted.

   - bpo-27048(93): Prevents distutils failing on Windows when
     environment variables contain non-ASCII characters

   - bpo-27330(94): Fixed possible leaks in the ctypes module.

   - bpo-27238(95): Got rid of bare excepts in the turtle module.
     Original patch by Jelle Zijlstra.

   - bpo-27122(96): When an exception is raised within the context being
     managed by a contextlib.ExitStack() and one of the exit stack
     generators catches and raises it in a chain, do not re-raise the
     original exception when exiting, let the new chained one through.
     This avoids the PEP 479(97) bug described in issue25782.

   - bpo-26386(98): Fixed ttk.TreeView selection operations with item
     id's containing spaces.

   - bpo-16182(99): Fix various functions in the "readline" module to
     use the locale encoding, and fix get_begidx() and get_endidx() to
     return code point indexes.

   - bpo-27392(100): Add loop.connect_accepted_socket().  Patch by Jim
     Fulton.

   - bpo-27930(101): Improved behaviour of
     logging.handlers.QueueListener.  Thanks to Paulo Andrade and Petr
     Viktorin for the analysis and patch.

   - bpo-21201(102): Improves readability of multiprocessing error
     message.  Thanks to Wojciech Walczak for patch.

   - bpo-27456(103): asyncio: Set TCP_NODELAY by default.

   - bpo-27906(104): Fix socket accept exhaustion during high TCP
     traffic.  Patch by Kevin Conway.

   - bpo-28174(105): Handle when SO_REUSEPORT isn't properly supported.
     Patch by Seth Michael Larson.

   - bpo-26654(106): Inspect functools.partial in
     asyncio.Handle.__repr__.  Patch by iceboy.

   - bpo-26909(107): Fix slow pipes IO in asyncio.  Patch by INADA
     Naoki.

   - bpo-28176(108): Fix callbacks race in
     asyncio.SelectorLoop.sock_connect.

   - bpo-27759(109): Fix selectors incorrectly retain invalid file
     descriptors.  Patch by Mark Williams.

   - bpo-28368(110): Refuse monitoring processes if the child watcher
     has no loop attached.  Patch by Vincent Michel.

   - bpo-28369(111): Raise RuntimeError when transport's FD is used with
     add_reader, add_writer, etc.

   - bpo-28370(112): Speedup asyncio.StreamReader.readexactly.  Patch by
     Коренберг Марк.

   - bpo-28371(113): Deprecate passing asyncio.Handles to
     run_in_executor.

   - bpo-28372(114): Fix asyncio to support formatting of non-python
     coroutines.

   - bpo-28399(115): Remove UNIX socket from FS before binding.  Patch
     by Коренберг Марк.

   - bpo-27972(116): Prohibit Tasks to await on themselves.

   - bpo-26923(117): Fix asyncio.Gather to refuse being cancelled once
     all children are done.  Patch by Johannes Ebke.

   - bpo-26796(118): Don't configure the number of workers for default
     threadpool executor.  Initial patch by Hans Lawrenz.

   - bpo-28600(119): Optimize loop.call_soon().

   - bpo-28613(120): Fix get_event_loop() return the current loop if
     called from coroutines/callbacks.

   - bpo-28639(121): Fix inspect.isawaitable to always return bool Patch
     by Justin Mayfield.

   - bpo-28652(122): Make loop methods reject socket kinds they do not
     support.

   - bpo-28653(123): Fix a refleak in functools.lru_cache.

   - bpo-28703(124): Fix asyncio.iscoroutinefunction to handle Mock
     objects.

   - bpo-24142(125): Reading a corrupt config file left the parser in an
     invalid state.  Original patch by Florian Höch.

   - bpo-28990(126): Fix SSL hanging if connection is closed before
     handshake completed.  (Patch by HoHo-Ho)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15812

   (2) https://bugs.python.org/issue?@action=redirect&bpo=29094

   (3) https://bugs.python.org/issue?@action=redirect&bpo=13051

   (4) https://bugs.python.org/issue?@action=redirect&bpo=29119

   (5) https://bugs.python.org/issue?@action=redirect&bpo=9770

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28427

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28923

   (8) https://bugs.python.org/issue?@action=redirect&bpo=28871

   (9) https://bugs.python.org/issue?@action=redirect&bpo=19542

   (10) https://bugs.python.org/issue?@action=redirect&bpo=20191

   (11) https://bugs.python.org/issue?@action=redirect&bpo=28779

   (12) https://bugs.python.org/issue?@action=redirect&bpo=28847

   (13) https://bugs.python.org/issue?@action=redirect&bpo=25659

   (14) https://bugs.python.org/issue?@action=redirect&bpo=28732

   (15) https://bugs.python.org/issue?@action=redirect&bpo=28485

   (16) https://bugs.python.org/issue?@action=redirect&bpo=28387

   (17) https://bugs.python.org/issue?@action=redirect&bpo=27517

   (18) https://bugs.python.org/issue?@action=redirect&bpo=28549

   (19) https://bugs.python.org/issue?@action=redirect&bpo=28449

   (20) https://bugs.python.org/issue?@action=redirect&bpo=23262

   (21) https://bugs.python.org/issue?@action=redirect&bpo=27939

   (22) https://bugs.python.org/issue?@action=redirect&bpo=28255

   (23) https://bugs.python.org/issue?@action=redirect&bpo=20491

   (24) https://bugs.python.org/issue?@action=redirect&bpo=28353

   (25) https://bugs.python.org/issue?@action=redirect&bpo=25464

   (26) https://bugs.python.org/issue?@action=redirect&bpo=28488

   (27) https://bugs.python.org/issue?@action=redirect&bpo=24452

   (28) https://bugs.python.org/issue?@action=redirect&bpo=20766

   (29) https://bugs.python.org/issue?@action=redirect&bpo=26293

   (30) https://bugs.python.org/issue?@action=redirect&bpo=28321

   (31) https://bugs.python.org/issue?@action=redirect&bpo=28322

   (32) https://bugs.python.org/issue?@action=redirect&bpo=1703178

   (33) https://bugs.python.org/issue?@action=redirect&bpo=28253

   (34) https://bugs.python.org/issue?@action=redirect&bpo=28275

   (35) https://bugs.python.org/issue?@action=redirect&bpo=27897

   (36) https://bugs.python.org/issue?@action=redirect&bpo=18893

   (37) https://bugs.python.org/issue?@action=redirect&bpo=27611

   (38) https://bugs.python.org/issue?@action=redirect&bpo=27348

   (39) https://bugs.python.org/issue?@action=redirect&bpo=25651

   (40) https://bugs.python.org/issue?@action=redirect&bpo=27932

   (41) https://bugs.python.org/issue?@action=redirect&bpo=28075

   (42) https://bugs.python.org/issue?@action=redirect&bpo=25270

   (43) https://bugs.python.org/issue?@action=redirect&bpo=28181

   (44) https://bugs.python.org/issue?@action=redirect&bpo=25895

   (45) https://bugs.python.org/issue?@action=redirect&bpo=27599

   (46) https://bugs.python.org/issue?@action=redirect&bpo=19003

   (47) https://bugs.python.org/issue?@action=redirect&bpo=28019

   (48) https://bugs.python.org/issue?@action=redirect&bpo=25969

   (49) https://bugs.python.org/issue?@action=redirect&bpo=14977

   (50) https://bugs.python.org/issue?@action=redirect&bpo=24594

   (51) https://bugs.python.org/issue?@action=redirect&bpo=17582

   (52) https://bugs.python.org/issue?@action=redirect&bpo=28047

   (53) https://bugs.python.org/issue?@action=redirect&bpo=27445

   (54) https://bugs.python.org/issue?@action=redirect&bpo=22450

   (55) https://bugs.python.org/issue?@action=redirect&bpo=27570

   (56) https://bugs.python.org/issue?@action=redirect&bpo=22233

   (57) https://bugs.python.org/issue?@action=redirect&bpo=27988

   (58) https://bugs.python.org/issue?@action=redirect&bpo=27691

   (59) https://bugs.python.org/issue?@action=redirect&bpo=27850

   (60) https://www.cve.org/CVERecord?id=CVE-2016-2183

   (61) https://bugs.python.org/issue?@action=redirect&bpo=27766

   (62) https://bugs.python.org/issue?@action=redirect&bpo=26470

   (63) https://bugs.python.org/issue?@action=redirect&bpo=12885

   (64) https://bugs.python.org/issue?@action=redirect&bpo=27881

   (65) https://bugs.python.org/issue?@action=redirect&bpo=27861

   (66) https://bugs.python.org/issue?@action=redirect&bpo=19884

   (67) https://bugs.python.org/issue?@action=redirect&bpo=27706

   (68) https://bugs.python.org/issue?@action=redirect&bpo=10513

   (69) https://bugs.python.org/issue?@action=redirect&bpo=27598

   (70) https://bugs.python.org/issue?@action=redirect&bpo=27539

   (71) https://bugs.python.org/issue?@action=redirect&bpo=21718

   (72) https://bugs.python.org/issue?@action=redirect&bpo=2466

   (73) https://bugs.python.org/issue?@action=redirect&bpo=27773

   (74) https://bugs.python.org/issue?@action=redirect&bpo=26750

   (75) https://bugs.python.org/issue?@action=redirect&bpo=27783

   (76) https://bugs.python.org/issue?@action=redirect&bpo=27774

   (77) https://bugs.python.org/issue?@action=redirect&bpo=27760

   (78) https://bugs.python.org/issue?@action=redirect&bpo=27758

   (79) https://bugs.python.org/issue?@action=redirect&bpo=27568

   (80) https://www.cve.org/CVERecord?id=CVE-2016-1000110

   (81) https://bugs.python.org/issue?@action=redirect&bpo=27656

   (82) https://bugs.python.org/issue?@action=redirect&bpo=27130

   (83) https://bugs.python.org/issue?@action=redirect&bpo=27533

   (84) https://bugs.python.org/issue?@action=redirect&bpo=17711

   (85) https://bugs.python.org/issue?@action=redirect&bpo=27522

   (86) https://bugs.python.org/issue?@action=redirect&bpo=26844

   (87) https://bugs.python.org/issue?@action=redirect&bpo=23804

   (88) https://bugs.python.org/issue?@action=redirect&bpo=27466

   (89) https://bugs.python.org/issue?@action=redirect&bpo=26664

   (90) https://bugs.python.org/issue?@action=redirect&bpo=22115

   (91) https://bugs.python.org/issue?@action=redirect&bpo=27079

   (92) https://bugs.python.org/issue?@action=redirect&bpo=26754

   (93) https://bugs.python.org/issue?@action=redirect&bpo=27048

   (94) https://bugs.python.org/issue?@action=redirect&bpo=27330

   (95) https://bugs.python.org/issue?@action=redirect&bpo=27238

   (96) https://bugs.python.org/issue?@action=redirect&bpo=27122

   (97) https://peps.python.org/pep-0479/

   (98) https://bugs.python.org/issue?@action=redirect&bpo=26386

   (99) https://bugs.python.org/issue?@action=redirect&bpo=16182

   (100) https://bugs.python.org/issue?@action=redirect&bpo=27392

   (101) https://bugs.python.org/issue?@action=redirect&bpo=27930

   (102) https://bugs.python.org/issue?@action=redirect&bpo=21201

   (103) https://bugs.python.org/issue?@action=redirect&bpo=27456

   (104) https://bugs.python.org/issue?@action=redirect&bpo=27906

   (105) https://bugs.python.org/issue?@action=redirect&bpo=28174

   (106) https://bugs.python.org/issue?@action=redirect&bpo=26654

   (107) https://bugs.python.org/issue?@action=redirect&bpo=26909

   (108) https://bugs.python.org/issue?@action=redirect&bpo=28176

   (109) https://bugs.python.org/issue?@action=redirect&bpo=27759

   (110) https://bugs.python.org/issue?@action=redirect&bpo=28368

   (111) https://bugs.python.org/issue?@action=redirect&bpo=28369

   (112) https://bugs.python.org/issue?@action=redirect&bpo=28370

   (113) https://bugs.python.org/issue?@action=redirect&bpo=28371

   (114) https://bugs.python.org/issue?@action=redirect&bpo=28372

   (115) https://bugs.python.org/issue?@action=redirect&bpo=28399

   (116) https://bugs.python.org/issue?@action=redirect&bpo=27972

   (117) https://bugs.python.org/issue?@action=redirect&bpo=26923

   (118) https://bugs.python.org/issue?@action=redirect&bpo=26796

   (119) https://bugs.python.org/issue?@action=redirect&bpo=28600

   (120) https://bugs.python.org/issue?@action=redirect&bpo=28613

   (121) https://bugs.python.org/issue?@action=redirect&bpo=28639

   (122) https://bugs.python.org/issue?@action=redirect&bpo=28652

   (123) https://bugs.python.org/issue?@action=redirect&bpo=28653

   (124) https://bugs.python.org/issue?@action=redirect&bpo=28703

   (125) https://bugs.python.org/issue?@action=redirect&bpo=24142

   (126) https://bugs.python.org/issue?@action=redirect&bpo=28990


File: python.info,  Node: IDLE<57>,  Next: C API<76>,  Prev: ライブラリ<193>,  Up: Python 3 5 3 release candidate 1

1.24.103.4 IDLE
...............

   - bpo-15308(1): Add 'interrupt execution' (^C) to Shell menu.  Patch
     by Roger Serwy, updated by Bayard Randel.

   - bpo-27922(2): Stop IDLE tests from 'flashing' gui widgets on the
     screen.

   - Add version to title of IDLE help window.

   - bpo-25564(3): In section on IDLE - console differences, mention
     that using exec means that __builtins__ is defined for each
     statement.

   - bpo-27714(4): text_textview and test_autocomplete now pass when
     re-run in the same process.  This occurs when test_idle fails when
     run with the -w option but without -jn.  Fix warning from
     test_config.

   - bpo-25507(5): IDLE no longer runs buggy code because of its tkinter
     imports.  Users must include the same imports required to run
     directly in Python.

   - bpo-27452(6): add line counter and crc to IDLE configHandler test
     dump.

   - bpo-27365(7): Allow non-ascii chars in IDLE NEWS.txt, for
     contributor names.

   - bpo-27245(8): IDLE: Cleanly delete custom themes and key bindings.
     Previously, when IDLE was started from a console or by import, a
     cascade of warnings was emitted.  Patch by Serhiy Storchaka.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15308

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27922

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25564

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27714

   (5) https://bugs.python.org/issue?@action=redirect&bpo=25507

   (6) https://bugs.python.org/issue?@action=redirect&bpo=27452

   (7) https://bugs.python.org/issue?@action=redirect&bpo=27365

   (8) https://bugs.python.org/issue?@action=redirect&bpo=27245


File: python.info,  Node: C API<76>,  Next: ドキュメント<79>,  Prev: IDLE<57>,  Up: Python 3 5 3 release candidate 1

1.24.103.5 C API
................

   - bpo-28808(1): PyUnicode_CompareWithASCIIString() now never raises
     exceptions.

   - bpo-26754(2): PyUnicode_FSDecoder() accepted a filename argument
     encoded as an iterable of integers.  Now only strings and
     bytes-like objects are accepted.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28808

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26754


File: python.info,  Node: ドキュメント<79>,  Next: テスト<79>,  Prev: C API<76>,  Up: Python 3 5 3 release candidate 1

1.24.103.6 ドキュメント
.......................

   - bpo-28513(1): Documented command-line interface of zipfile.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28513


File: python.info,  Node: テスト<79>,  Next: Tools/Demos<55>,  Prev: ドキュメント<79>,  Up: Python 3 5 3 release candidate 1

1.24.103.7 テスト
.................

   - bpo-28950(1): Disallow -j0 to be combined with -T/-l/-M in regrtest
     command line arguments.

   - bpo-28666(2): Now test.support.rmtree is able to remove unwritable
     or unreadable directories.

   - bpo-23839(3): Various caches now are cleared before running every
     test file.

   - bpo-28409(4): regrtest: fix the parser of command line arguments.

   - bpo-27787(5): Call gc.collect() before checking each test for
     "dangling threads", since the dangling threads are weak references.

   - bpo-27369(6): In test_pyexpat, avoid testing an error message
     detail that changed in Expat 2.2.0.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28950

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28666

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23839

   (4) https://bugs.python.org/issue?@action=redirect&bpo=28409

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27787

   (6) https://bugs.python.org/issue?@action=redirect&bpo=27369


File: python.info,  Node: Tools/Demos<55>,  Next: Windows<78>,  Prev: テスト<79>,  Up: Python 3 5 3 release candidate 1

1.24.103.8 Tools/Demos
......................

   - bpo-27952(1): Get Tools/scripts/fixcid.py working with Python 3 and
     the current "re" module, avoid invalid Python backslash escapes,
     and fix a bug parsing escaped C quote signs.

   - bpo-27332(2): Fixed the type of the first argument of module-level
     functions generated by Argument Clinic.  Patch by Petr Viktorin.

   - bpo-27418(3): Fixed Tools/importbench/importbench.py.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27952

   (2) https://bugs.python.org/issue?@action=redirect&bpo=27332

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27418


File: python.info,  Node: Windows<78>,  Next: ビルド<90>,  Prev: Tools/Demos<55>,  Up: Python 3 5 3 release candidate 1

1.24.103.9 Windows
..................

   - bpo-28251(1): Improvements to help manuals on Windows.

   - bpo-28110(2): launcher.msi has different product codes between
     32-bit and 64-bit

   - bpo-25144(3): Ensures TargetDir is set before continuing with
     custom install.

   - bpo-27469(4): Adds a shell extension to the launcher so that drag
     and drop works correctly.

   - bpo-27309(5): Enabled proper Windows styles in python[w].exe
     manifest.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28251

   (2) https://bugs.python.org/issue?@action=redirect&bpo=28110

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25144

   (4) https://bugs.python.org/issue?@action=redirect&bpo=27469

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27309


File: python.info,  Node: ビルド<90>,  Prev: Windows<78>,  Up: Python 3 5 3 release candidate 1

1.24.103.10 ビルド
..................

   - bpo-29080(1): Removes hard dependency on hg.exe from
     PCBuild/build.bat

   - bpo-23903(2): Added missed names to PC/python3.def.

   - bpo-10656(3): Fix out-of-tree building on AIX. Patch by Tristan
     Carel and Michael Haubenwallner.

   - bpo-26359(4): Rename -with-optimiations to -enable-optimizations.

   - bpo-28444(5): Fix missing extensions modules when cross compiling.

   - bpo-28248(6): Update Windows build and OS X installers to use
     OpenSSL 1.0.2j.

   - bpo-28258(7): Fixed build with Estonian locale (python-config and
     distclean targets in Makefile).  Patch by Arfrever Frehtes
     Taifersar Arahesis.

   - bpo-26661(8): setup.py now detects system libffi with multiarch
     wrapper.

   - bpo-28066(9): Fix the logic that searches build directories for
     generated include files when building outside the source tree.

   - bpo-15819(10): Remove redundant include search directory option for
     building outside the source tree.

   - bpo-27566(11): Fix clean target in freeze makefile (patch by Lisa
     Roach)

   - bpo-27705(12): Update message in validate_ucrtbase.py

   - bpo-27983(13): Cause lack of llvm-profdata tool when using clang as
     required for PGO linking to be a configure time error rather than
     make time when -with-optimizations is enabled.  Also improve our
     ability to find the llvm-profdata tool on MacOS and some Linuxes.

   - bpo-26307(14): The profile-opt build now applies PGO to the
     built-in modules.

   - bpo-26359(15): Add the -with-optimizations configure flag.

   - bpo-27713(16): Suppress spurious build warnings when updating
     importlib's bootstrap files.  Patch by Xiang Zhang

   - bpo-25825(17): Correct the references to Modules/python.exp and
     ld_so_aix, which are required on AIX. This updates references to an
     installation path that was changed in 3.2a4, and undoes changed
     references to the build tree that were made in 3.5.0a1.

   - bpo-27453(18): CPP invocation in configure must use CPPFLAGS. Patch
     by Chi Hsuan Yen.

   - bpo-27641(19): The configure script now inserts comments into the
     makefile to prevent the pgen and _freeze_importlib executables from
     being cross-compiled.

   - bpo-26662(20): Set PYTHON_FOR_GEN in configure as the Python
     program to be used for file generation during the build.

   - bpo-10910(21): Avoid C++ compilation errors on FreeBSD and OS X.
     Also update FreedBSD version checks for the original ctype UTF-8
     workaround.

   - bpo-28676(22): Prevent missing 'getentropy' declaration warning on
     macOS. Patch by Gareth Rees.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=29080

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23903

   (3) https://bugs.python.org/issue?@action=redirect&bpo=10656

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26359

   (5) https://bugs.python.org/issue?@action=redirect&bpo=28444

   (6) https://bugs.python.org/issue?@action=redirect&bpo=28248

   (7) https://bugs.python.org/issue?@action=redirect&bpo=28258

   (8) https://bugs.python.org/issue?@action=redirect&bpo=26661

   (9) https://bugs.python.org/issue?@action=redirect&bpo=28066

   (10) https://bugs.python.org/issue?@action=redirect&bpo=15819

   (11) https://bugs.python.org/issue?@action=redirect&bpo=27566

   (12) https://bugs.python.org/issue?@action=redirect&bpo=27705

   (13) https://bugs.python.org/issue?@action=redirect&bpo=27983

   (14) https://bugs.python.org/issue?@action=redirect&bpo=26307

   (15) https://bugs.python.org/issue?@action=redirect&bpo=26359

   (16) https://bugs.python.org/issue?@action=redirect&bpo=27713

   (17) https://bugs.python.org/issue?@action=redirect&bpo=25825

   (18) https://bugs.python.org/issue?@action=redirect&bpo=27453

   (19) https://bugs.python.org/issue?@action=redirect&bpo=27641

   (20) https://bugs.python.org/issue?@action=redirect&bpo=26662

   (21) https://bugs.python.org/issue?@action=redirect&bpo=10910

   (22) https://bugs.python.org/issue?@action=redirect&bpo=28676


File: python.info,  Node: Python 3 5 2 final,  Next: Python 3 5 2 release candidate 1,  Prev: Python 3 5 3 release candidate 1,  Up: 変更履歴

1.24.104 Python 3.5.2 final
---------------------------

'Release date: 2016-06-26'

* Menu:

* Core and Builtins: Core and Builtins<190>.
* テスト: テスト<80>.
* IDLE: IDLE<58>.


File: python.info,  Node: Core and Builtins<190>,  Next: テスト<80>,  Up: Python 3 5 2 final

1.24.104.1 Core and Builtins
............................

   - bpo-26930(1): Update Windows builds to use OpenSSL 1.0.2h.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26930


File: python.info,  Node: テスト<80>,  Next: IDLE<58>,  Prev: Core and Builtins<190>,  Up: Python 3 5 2 final

1.24.104.2 テスト
.................

   - bpo-26867(1): Ubuntu's openssl OP_NO_SSLv3 is forced on by default;
     fix test.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26867


File: python.info,  Node: IDLE<58>,  Prev: テスト<80>,  Up: Python 3 5 2 final

1.24.104.3 IDLE
...............

   - bpo-27365(1): Allow non-ascii in idlelib/NEWS.txt - minimal part
     for 3.5.2.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27365


File: python.info,  Node: Python 3 5 2 release candidate 1,  Next: Python 3 5 1 final,  Prev: Python 3 5 2 final,  Up: 変更履歴

1.24.105 Python 3.5.2 release candidate 1
-----------------------------------------

'Release date: 2016-06-12'

* Menu:

* セキュリティ: セキュリティ<60>.
* Core and Builtins: Core and Builtins<191>.
* ライブラリ: ライブラリ<194>.
* IDLE: IDLE<59>.
* ドキュメント: ドキュメント<80>.
* テスト: テスト<81>.
* ビルド: ビルド<91>.
* Windows: Windows<79>.
* Tools/Demos: Tools/Demos<56>.


File: python.info,  Node: セキュリティ<60>,  Next: Core and Builtins<191>,  Up: Python 3 5 2 release candidate 1

1.24.105.1 セキュリティ
.......................

   - bpo-26556(1): Update expat to 2.1.1, fixes CVE 2015-1283(2).

   - Fix TLS stripping vulnerability in smtplib, CVE 2016-0772(3).
     Reported by Team Oststrom.

   - bpo-26839(4): On Linux, *note os.urandom(): 746. now calls
     ‘getrandom()’ with ‘GRND_NONBLOCK’ to fall back on reading
     ‘/dev/urandom’ if the urandom entropy pool is not initialized yet.
     Patch written by Colm Buckley.

   - bpo-26657(5): Fix directory traversal vulnerability with
     http.server on Windows.  This fixes a regression that was
     introduced in 3.3.4rc1 and 3.4.0rc1.  Based on patch by Philipp
     Hagemeister.

   - bpo-26313(6): ssl.py _load_windows_store_certs fails if windows
     cert store is empty.  Patch by Baji.

   - bpo-25939(7): On Windows open the cert store readonly in
     ssl.enum_certificates.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26556

   (2) https://www.cve.org/CVERecord?id=CVE-2015-1283

   (3) https://www.cve.org/CVERecord?id=CVE-2016-0772

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26839

   (5) https://bugs.python.org/issue?@action=redirect&bpo=26657

   (6) https://bugs.python.org/issue?@action=redirect&bpo=26313

   (7) https://bugs.python.org/issue?@action=redirect&bpo=25939


File: python.info,  Node: Core and Builtins<191>,  Next: ライブラリ<194>,  Prev: セキュリティ<60>,  Up: Python 3 5 2 release candidate 1

1.24.105.2 Core and Builtins
............................

   - bpo-27066(1): Fixed SystemError if a custom opener (for open())
     returns a negative number without setting an exception.

   - bpo-20041(2): Fixed TypeError when frame.f_trace is set to None.
     Patch by Xavier de Gaye.

   - bpo-26168(3): Fixed possible refleaks in failing Py_BuildValue()
     with the "N" format unit.

   - bpo-26991(4): Fix possible refleak when creating a function with
     annotations.

   - bpo-27039(5): Fixed bytearray.remove() for values greater than 127.
     Patch by Joe Jevnik.

   - bpo-23640(6): int.from_bytes() no longer bypasses constructors for
     subclasses.

   - bpo-26811(7): gc.get_objects() no longer contains a broken tuple
     with NULL pointer.

   - bpo-20120(8): Use RawConfigParser for .pypirc parsing, removing
     support for interpolation unintentionally added with move to Python
     3.  Behavior no longer does any interpolation in .pypirc files,
     matching behavior in Python 2.7 and Setuptools 19.0.

   - bpo-26659(9): Make the builtin slice type support cycle collection.

   - bpo-26718(10): super.__init__ no longer leaks memory if called
     multiple times.  NOTE: A direct call of super.__init__ is not
     endorsed!

   - bpo-25339(11): PYTHONIOENCODING now has priority over locale in
     setting the error handler for stdin and stdout.

   - bpo-26494(12): Fixed crash on iterating exhausting iterators.
     Affected classes are generic sequence iterators, iterators of str,
     bytes, bytearray, list, tuple, set, frozenset, dict, OrderedDict,
     corresponding views and os.scandir() iterator.

   - bpo-26581(13): If coding cookie is specified multiple times on a
     line in Python source code file, only the first one is taken to
     account.

   - bpo-26464(14): Fix str.translate() when string is ASCII and first
     replacements removes character, but next replacement uses a
     non-ASCII character or a string longer than 1 character.
     Regression introduced in Python 3.5.0.

   - bpo-22836(15): Ensure exception reports from PyErr_Display() and
     PyErr_WriteUnraisable() are sensible even when formatting them
     produces secondary errors.  This affects the reports produced by
     sys.__excepthook__() and when __del__() raises an exception.

   - bpo-26302(16): Correct behavior to reject comma as a legal
     character for cookie names.

   - bpo-4806(17): Avoid masking the original TypeError exception when
     using star (‘*’) unpacking in function calls.  Based on patch by
     Hagen Fürstenau and Daniel Urban.

   - bpo-27138(18): Fix the doc comment for FileFinder.find_spec().

   - bpo-26154(19): Add a new private _PyThreadState_UncheckedGet()
     function to get the current Python thread state, but don't issue a
     fatal error if it is NULL. This new function must be used instead
     of accessing directly the _PyThreadState_Current variable.  The
     variable is no more exposed since Python 3.5.1 to hide the exact
     implementation of atomic C types, to avoid compiler issues.

   - bpo-26194(20): Deque.insert() gave odd results for bounded deques
     that had reached their maximum size.  Now an IndexError will be
     raised when attempting to insert into a full deque.

   - bpo-25843(21): When compiling code, don't merge constants if they
     are equal but have a different types.  For example, ‘f1, f2 =
     lambda: 1, lambda: 1.0’ is now correctly compiled to two different
     functions: ‘f1()’ returns ‘1’ (‘int’) and ‘f2()’ returns ‘1.0’
     (‘int’), even if ‘1’ and ‘1.0’ are equal.

   - bpo-22995(22): [UPDATE] Comment out the one of the pickleability
     tests in _PyObject_GetState() due to regressions observed in
     Cython-based projects.

   - bpo-25961(23): Disallowed null characters in the type name.

   - bpo-25973(24): Fix segfault when an invalid nonlocal statement
     binds a name starting with two underscores.

   - bpo-22995(25): Instances of extension types with a state that
     aren't subclasses of list or dict and haven't implemented any
     pickle-related methods (__reduce__, __reduce_ex__, __getnewargs__,
     __getnewargs_ex__, or __getstate__), can no longer be pickled.
     Including memoryview.

   - bpo-20440(26): Massive replacing unsafe attribute setting code with
     special macro Py_SETREF.

   - bpo-25766(27): Special method __bytes__() now works in str
     subclasses.

   - bpo-25421(28): __sizeof__ methods of builtin types now use dynamic
     basic size.  This allows sys.getsize() to work correctly with their
     subclasses with __slots__ defined.

   - bpo-25709(29): Fixed problem with in-place string concatenation and
     utf-8 cache.

   - bpo-27147(30): Mention PEP 420(31) in the importlib docs.

   - bpo-24097(32): Fixed crash in object.__reduce__() if slot name is
     freed inside __getattr__.

   - bpo-24731(33): Fixed crash on converting objects with special
     methods __bytes__, __trunc__, and __float__ returning instances of
     subclasses of bytes, int, and float to subclasses of bytes, int,
     and float correspondingly.

   - bpo-26478(34): Fix semantic bugs when using binary operators with
     dictionary views and tuples.

   - bpo-26171(35): Fix possible integer overflow and heap corruption in
     zipimporter.get_data().

   - bpo-25660(36): Fix TAB key behaviour in REPL with readline.

   - bpo-25887(37): Raise a RuntimeError when a coroutine object is
     awaited more than once.

   - bpo-27243(38): Update the __aiter__ protocol: instead of returning
     an awaitable that resolves to an asynchronous iterator, the
     asynchronous iterator should be returned directly.  Doing the
     former will trigger a PendingDeprecationWarning.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27066

   (2) https://bugs.python.org/issue?@action=redirect&bpo=20041

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26168

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26991

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27039

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23640

   (7) https://bugs.python.org/issue?@action=redirect&bpo=26811

   (8) https://bugs.python.org/issue?@action=redirect&bpo=20120

   (9) https://bugs.python.org/issue?@action=redirect&bpo=26659

   (10) https://bugs.python.org/issue?@action=redirect&bpo=26718

   (11) https://bugs.python.org/issue?@action=redirect&bpo=25339

   (12) https://bugs.python.org/issue?@action=redirect&bpo=26494

   (13) https://bugs.python.org/issue?@action=redirect&bpo=26581

   (14) https://bugs.python.org/issue?@action=redirect&bpo=26464

   (15) https://bugs.python.org/issue?@action=redirect&bpo=22836

   (16) https://bugs.python.org/issue?@action=redirect&bpo=26302

   (17) https://bugs.python.org/issue?@action=redirect&bpo=4806

   (18) https://bugs.python.org/issue?@action=redirect&bpo=27138

   (19) https://bugs.python.org/issue?@action=redirect&bpo=26154

   (20) https://bugs.python.org/issue?@action=redirect&bpo=26194

   (21) https://bugs.python.org/issue?@action=redirect&bpo=25843

   (22) https://bugs.python.org/issue?@action=redirect&bpo=22995

   (23) https://bugs.python.org/issue?@action=redirect&bpo=25961

   (24) https://bugs.python.org/issue?@action=redirect&bpo=25973

   (25) https://bugs.python.org/issue?@action=redirect&bpo=22995

   (26) https://bugs.python.org/issue?@action=redirect&bpo=20440

   (27) https://bugs.python.org/issue?@action=redirect&bpo=25766

   (28) https://bugs.python.org/issue?@action=redirect&bpo=25421

   (29) https://bugs.python.org/issue?@action=redirect&bpo=25709

   (30) https://bugs.python.org/issue?@action=redirect&bpo=27147

   (31) https://peps.python.org/pep-0420/

   (32) https://bugs.python.org/issue?@action=redirect&bpo=24097

   (33) https://bugs.python.org/issue?@action=redirect&bpo=24731

   (34) https://bugs.python.org/issue?@action=redirect&bpo=26478

   (35) https://bugs.python.org/issue?@action=redirect&bpo=26171

   (36) https://bugs.python.org/issue?@action=redirect&bpo=25660

   (37) https://bugs.python.org/issue?@action=redirect&bpo=25887

   (38) https://bugs.python.org/issue?@action=redirect&bpo=27243


File: python.info,  Node: ライブラリ<194>,  Next: IDLE<59>,  Prev: Core and Builtins<191>,  Up: Python 3 5 2 release candidate 1

1.24.105.3 ライブラリ
.....................

   - bpo-21386(1): Implement missing IPv4Address.is_global property.  It
     was documented since 07a5610bae9d.  Initial patch by Roger Luethi.

   - bpo-20900(2): distutils register command now decodes HTTP responses
     correctly.  Initial patch by ingrid.

   - A new version of typing.py provides several new classes and
     features: @overload outside stubs, Reversible, DefaultDict, Text,
     ContextManager, Type[], NewType(), TYPE_CHECKING, and numerous bug
     fixes (note that some of the new features are not yet implemented
     in mypy or other static analyzers).  Also classes for PEP 492(3)
     (Awaitable, AsyncIterable, AsyncIterator) have been added (in fact
     they made it into 3.5.1 but were never mentioned).

   - bpo-25738(4): Stop http.server.BaseHTTPRequestHandler.send_error()
     from sending a message body for 205 Reset Content.  Also, don't
     send Content header fields in responses that don't have a body.
     Patch by Susumu Koshiba.

   - bpo-21313(5): Fix the "platform" module to tolerate when
     sys.version contains truncated build information.

   - bpo-27164(6): In the zlib module, allow decompressing raw Deflate
     streams with a predefined zdict.  Based on patch by Xiang Zhang.

   - bpo-24291(7): Fix wsgiref.simple_server.WSGIRequestHandler to
     completely write data to the client.  Previously it could do
     partial writes and truncate data.  Also,
     wsgiref.handler.ServerHandler can now handle stdout doing partial
     writes, but this is deprecated.

   - bpo-26809(8): Add ‘__all__’ to *note string: d8.  Patch by Emanuel
     Barry.

   - bpo-26373(9): subprocess.Popen.communicate now correctly ignores
     BrokenPipeError when the child process dies before .communicate()
     is called in more/all circumstances.

   - bpo-21776(10): distutils.upload now correctly handles HTTPError.
     Initial patch by Claudiu Popa.

   - bpo-27114(11): Fix SSLContext._load_windows_store_certs fails with
     PermissionError

   - bpo-18383(12): Avoid creating duplicate filters when using
     filterwarnings and simplefilter.  Based on patch by Alex Shkop.

   - bpo-27057(13): Fix os.set_inheritable() on Android, ioctl() is
     blocked by SELinux and fails with EACCESS. The function now falls
     back to fcntl().  Patch written by Michał Bednarski.

   - bpo-27014(14): Fix infinite recursion using typing.py.  Thanks to
     Kalle Tuure!

   - bpo-14132(15): Fix urllib.request redirect handling when the target
     only has a query string.  Original fix by Ján Janech.

   - bpo-17214(16): The "urllib.request" module now percent-encodes
     non-ASCII bytes found in redirect target URLs.  Some servers send
     Location header fields with non-ASCII bytes, but "http.client"
     requires the request target to be ASCII-encodable, otherwise a
     UnicodeEncodeError is raised.  Based on patch by Christian Heimes.

   - bpo-26892(17): Honor debuglevel flag in urllib.request.HTTPHandler.
     Patch contributed by Chi Hsuan Yen.

   - bpo-22274(18): In the subprocess module, allow stderr to be
     redirected to stdout even when stdout is not redirected.  Patch by
     Akira Li.

   - bpo-26807(19): mock_open 'files' no longer error on readline at end
     of file.  Patch from Yolanda Robla.

   - bpo-25745(20): Fixed leaking a userptr in curses panel destructor.

   - bpo-26977(21): Removed unnecessary, and ignored, call to sum of
     squares helper in statistics.pvariance.

   - bpo-26881(22): The modulefinder module now supports extended opcode
     arguments.

   - bpo-23815(23): Fixed crashes related to directly created instances
     of types in _tkinter and curses.panel modules.

   - bpo-17765(24): weakref.ref() no longer silently ignores keyword
     arguments.  Patch by Georg Brandl.

   - bpo-26873(25): xmlrpc now raises ResponseError on unsupported type
     tags instead of silently return incorrect result.

   - bpo-26711(26): Fixed the comparison of plistlib.Data with other
     types.

   - bpo-24114(27): Fix an uninitialized variable in ‘ctypes.util’.  The
     bug only occurs on SunOS when the ctypes implementation searches
     for the ‘crle’ program.  Patch by Xiang Zhang.  Tested on SunOS by
     Kees Bos.

   - bpo-26864(28): In urllib.request, change the proxy bypass host
     checking against no_proxy to be case-insensitive, and to not match
     unrelated host names that happen to have a bypassed hostname as a
     suffix.  Patch by Xiang Zhang.

   - bpo-26634(29): recursive_repr() now sets __qualname__ of wrapper.
     Patch by Xiang Zhang.

   - bpo-26804(30): urllib.request will prefer lower_case proxy
     environment variables over UPPER_CASE or Mixed_Case ones.  Patch
     contributed by Hans-Peter Jansen.

   - bpo-26837(31): assertSequenceEqual() now correctly outputs
     non-stringified differing items (like bytes in the -b mode).  This
     affects assertListEqual() and assertTupleEqual().

   - bpo-26041(32): Remove "will be removed in Python 3.7" from
     deprecation messages of platform.dist() and
     platform.linux_distribution().  Patch by Kumaripaba Miyurusara
     Athukorala.

   - bpo-26822(33): itemgetter, attrgetter and methodcaller objects no
     longer silently ignore keyword arguments.

   - bpo-26733(34): Disassembling a class now disassembles class and
     static methods.  Patch by Xiang Zhang.

   - bpo-26801(35): Fix error handling in *note
     shutil.get_terminal_size(): 131b, catch *note AttributeError: 5f0.
     instead of *note NameError: 452.  Patch written by Emanuel Barry.

   - bpo-24838(36): tarfile's ustar and gnu formats now correctly
     calculate name and link field limits for multibyte character
     encodings like utf-8.

   - bpo-26717(37): Stop encoding Latin-1-ized WSGI paths with UTF-8.
     Patch by Anthony Sottile.

   - bpo-26735(38): Fix *note os.urandom(): 746. on Solaris 11.3 and
     newer when reading more than 1,024 bytes: call ‘getrandom()’
     multiple times with a limit of 1024 bytes per call.

   - bpo-16329(39): Add .webm to mimetypes.types_map.  Patch by
     Giampaolo Rodola'.

   - bpo-13952(40): Add .csv to mimetypes.types_map.  Patch by Geoff
     Wilson.

   - bpo-26709(41): Fixed Y2038 problem in loading binary PLists.

   - bpo-23735(42): Handle terminal resizing with Readline 6.3+ by
     installing our own SIGWINCH handler.  Patch by Eric Price.

   - bpo-26586(43): In http.server, respond with "413 Request header
     fields too large" if there are too many header fields to parse,
     rather than killing the connection and raising an unhandled
     exception.  Patch by Xiang Zhang.

   - bpo-22854(44): Change BufferedReader.writable() and
     BufferedWriter.readable() to always return False.

   - bpo-25195(45): Fix a regression in mock.MagicMock.  _Call is a
     subclass of tuple (changeset 3603bae63c13 only works for classes)
     so we need to implement __ne__ ourselves.  Patch by Andrew Plummer.

   - bpo-26644(46): Raise ValueError rather than SystemError when a
     negative length is passed to SSLSocket.recv() or read().

   - bpo-23804(47): Fix SSL recv(0) and read(0) methods to return zero
     bytes instead of up to 1024.

   - bpo-26616(48): Fixed a bug in datetime.astimezone() method.

   - bpo-21925(49): *note warnings.formatwarning(): 1df8. now catches
     exceptions on ‘linecache.getline(...)’ to be able to log *note
     ResourceWarning: 54c. emitted late during the Python shutdown
     process.

   - bpo-24266(50): Ctrl+C during Readline history search now cancels
     the search mode when compiled with Readline 7.

   - bpo-26560(51): Avoid potential ValueError in
     BaseHandler.start_response.  Initial patch by Peter Inglesby.

   - bpo-26569(52): Fix *note pyclbr.readmodule(): a2c. and *note
     pyclbr.readmodule_ex(): a2d. to support importing packages.

   - bpo-26499(53): Account for remaining Content-Length in
     HTTPResponse.readline() and read1().  Based on patch by Silent
     Ghost.  Also document that HTTPResponse now supports these methods.

   - bpo-25320(54): Handle sockets in directories unittest discovery is
     scanning.  Patch from Victor van den Elzen.

   - bpo-16181(55): cookiejar.http2time() now returns None if year is
     higher than datetime.MAXYEAR.

   - bpo-26513(56): Fixes platform module detection of Windows Server

   - bpo-23718(57): Fixed parsing time in week 0 before Jan 1.  Original
     patch by Tamás Bence Gedai.

   - bpo-20589(58): Invoking Path.owner() and Path.group() on Windows
     now raise NotImplementedError instead of ImportError.

   - bpo-26177(59): Fixed the keys() method for Canvas and Scrollbar
     widgets.

   - bpo-15068(60): Got rid of excessive buffering in the fileinput
     module.  The bufsize parameter is no longer used.

   - bpo-2202(61): Fix UnboundLocalError in
     AbstractDigestAuthHandler.get_algorithm_impls.  Initial patch by
     Mathieu Dupuy.

   - bpo-25718(62): Fixed pickling and copying the accumulate() iterator
     with total is None.

   - bpo-26475(63): Fixed debugging output for regular expressions with
     the (?x) flag.

   - bpo-26457(64): Fixed the subnets() methods in IP network classes
     for the case when resulting prefix length is equal to maximal
     prefix length.  Based on patch by Xiang Zhang.

   - bpo-26385(65): Remove the file if the internal open() call in
     NamedTemporaryFile() fails.  Patch by Silent Ghost.

   - bpo-26402(66): Fix XML-RPC client to retry when the server shuts
     down a persistent connection.  This was a regression related to the
     new http.client.RemoteDisconnected exception in 3.5.0a4.

   - bpo-25913(67): Leading ‘<~’ is optional now in base64.a85decode()
     with adobe=True.  Patch by Swati Jaiswal.

   - bpo-26186(68): Remove an invalid type check in
     importlib.util.LazyLoader.

   - bpo-26367(69): importlib.__import__() raises SystemError like
     builtins.__import__() when ‘level’ is specified but without an
     accompanying package specified.

   - bpo-26309(70): In the "socketserver" module, shut down the request
     (closing the connected socket) when verify_request() returns false.
     Patch by Aviv Palivoda.

   - bpo-25995(71): os.walk() no longer uses FDs proportional to the
     tree depth.

   - bpo-26117(72): The os.scandir() iterator now closes file descriptor
     not only when the iteration is finished, but when it was failed
     with error.

   - bpo-25911(73): Restored support of bytes paths in os.walk() on
     Windows.

   - bpo-26045(74): Add UTF-8 suggestion to error message when posting a
     non-Latin-1 string with http.client.

   - bpo-12923(75): Reset FancyURLopener's redirect counter even if
     there is an exception.  Based on patches by Brian Brazil and Daniel
     Rocco.

   - bpo-25945(76): Fixed a crash when unpickle the functools.partial
     object with wrong state.  Fixed a leak in failed functools.partial
     constructor.  "args" and "keywords" attributes of functools.partial
     have now always types tuple and dict correspondingly.

   - bpo-26202(77): copy.deepcopy() now correctly copies range() objects
     with non-atomic attributes.

   - bpo-23076(78): Path.glob() now raises a ValueError if it's called
     with an invalid pattern.  Patch by Thomas Nyberg.

   - bpo-19883(79): Fixed possible integer overflows in zipimport.

   - bpo-26227(80): On Windows, getnameinfo(), gethostbyaddr() and
     gethostbyname_ex() functions of the socket module now decode the
     hostname from the ANSI code page rather than UTF-8.

   - bpo-26147(81): xmlrpc now works with strings not encodable with
     used non-UTF-8 encoding.

   - bpo-25935(82): Garbage collector now breaks reference loops with
     OrderedDict.

   - bpo-16620(83): Fixed AttributeError in msilib.Directory.glob().

   - bpo-26013(84): Added compatibility with broken protocol 2 pickles
     created in old Python 3 versions (3.4.3 and lower).

   - bpo-25850(85): Use cross-compilation by default for 64-bit Windows.

   - bpo-17633(86): Improve zipimport's support for namespace packages.

   - bpo-24705(87): Fix sysconfig._parse_makefile not expanding ${} vars
     appearing before $() vars.

   - bpo-22138(88): Fix mock.patch behavior when patching descriptors.
     Restore original values after patching.  Patch contributed by Sean
     McCully.

   - bpo-25672(89): In the ssl module, enable the
     SSL_MODE_RELEASE_BUFFERS mode option if it is safe to do so.

   - bpo-26012(90): Don't traverse into symlinks for ‘**’ pattern in
     pathlib.Path.[r]glob().

   - bpo-24120(91): Ignore PermissionError when traversing a tree with
     pathlib.Path.[r]glob().  Patch by Ulrich Petri.

   - bpo-25447(92): fileinput now uses sys.stdin as-is if it does not
     have a buffer attribute (restores backward compatibility).

   - bpo-25447(93): Copying the lru_cache() wrapper object now always
     works, independently from the type of the wrapped object (by
     returning the original object unchanged).

   - bpo-24103(94): Fixed possible use after free in
     ElementTree.XMLPullParser.

   - bpo-25860(95): os.fwalk() no longer skips remaining directories
     when error occurs.  Original patch by Samson Lee.

   - bpo-25914(96): Fixed and simplified OrderedDict.__sizeof__.

   - bpo-25902(97): Fixed various refcount issues in ElementTree
     iteration.

   - bpo-25717(98): Restore the previous behaviour of tolerating most
     fstat() errors when opening files.  This was a regression in 3.5a1,
     and stopped anonymous temporary files from working in special
     cases.

   - bpo-24903(99): Fix regression in number of arguments compileall
     accepts when '-d' is specified.  The check on the number of
     arguments has been dropped completely as it never worked correctly
     anyway.

   - bpo-25764(100): In the subprocess module, preserve any exception
     caused by fork() failure when preexec_fn is used.

   - bpo-6478(101): _strptime's regexp cache now is reset after changing
     timezone with time.tzset().

   - bpo-14285(102): When executing a package with the "python -m
     package" option, and package initialization fails, a proper
     traceback is now reported.  The "runpy" module now lets exceptions
     from package initialization pass back to the caller, rather than
     raising ImportError.

   - bpo-19771(103): Also in runpy and the "-m" option, omit the
     irrelevant message ".  .  .  is a package and cannot be directly
     executed" if the package could not even be initialized (e.g.  due
     to a bad ‘*.pyc’ file).

   - bpo-25177(104): Fixed problem with the mean of very small and very
     large numbers.  As a side effect, statistics.mean and
     statistics.variance should be significantly faster.

   - bpo-25718(105): Fixed copying object with state with boolean value
     is false.

   - bpo-10131(106): Fixed deep copying of minidom documents.  Based on
     patch by Marian Ganisin.

   - bpo-25725(107): Fixed a reference leak in pickle.loads() when
     unpickling invalid data including tuple instructions.

   - bpo-25663(108): In the Readline completer, avoid listing duplicate
     global names, and search the global namespace before searching
     builtins.

   - bpo-25688(109): Fixed file leak in ElementTree.iterparse() raising
     an error.

   - bpo-23914(110): Fixed SystemError raised by unpickler on broken
     pickle data.

   - bpo-25691(111): Fixed crash on deleting ElementTree.Element
     attributes.

   - bpo-25624(112): ZipFile now always writes a ZIP_STORED header for
     directory entries.  Patch by Dingyuan Wang.

   - Skip getaddrinfo if host is already resolved.  Patch by A. Jesse
     Jiryu Davis.

   - bpo-26050(113): Add asyncio.StreamReader.readuntil() method.  Patch
     by Марк Коренберг.

   - bpo-25924(114): Avoid unnecessary serialization of getaddrinfo(3)
     calls on OS X versions 10.5 or higher.  Original patch by A. Jesse
     Jiryu Davis.

   - bpo-26406(115): Avoid unnecessary serialization of getaddrinfo(3)
     calls on current versions of OpenBSD and NetBSD. Patch by A. Jesse
     Jiryu Davis.

   - bpo-26848(116): Fix asyncio/subprocess.communicate() to handle
     empty input.  Patch by Jack O'Connor.

   - bpo-27040(117): Add loop.get_exception_handler method

   - bpo-27041(118): asyncio: Add loop.create_future method

   - bpo-27223(119): asyncio: Fix _read_ready and _write_ready to
     respect _conn_lost.  Patch by Łukasz Langa.

   - bpo-22970(120): asyncio: Fix inconsistency cancelling
     Condition.wait.  Patch by David Coles.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21386

   (2) https://bugs.python.org/issue?@action=redirect&bpo=20900

   (3) https://peps.python.org/pep-0492/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=25738

   (5) https://bugs.python.org/issue?@action=redirect&bpo=21313

   (6) https://bugs.python.org/issue?@action=redirect&bpo=27164

   (7) https://bugs.python.org/issue?@action=redirect&bpo=24291

   (8) https://bugs.python.org/issue?@action=redirect&bpo=26809

   (9) https://bugs.python.org/issue?@action=redirect&bpo=26373

   (10) https://bugs.python.org/issue?@action=redirect&bpo=21776

   (11) https://bugs.python.org/issue?@action=redirect&bpo=27114

   (12) https://bugs.python.org/issue?@action=redirect&bpo=18383

   (13) https://bugs.python.org/issue?@action=redirect&bpo=27057

   (14) https://bugs.python.org/issue?@action=redirect&bpo=27014

   (15) https://bugs.python.org/issue?@action=redirect&bpo=14132

   (16) https://bugs.python.org/issue?@action=redirect&bpo=17214

   (17) https://bugs.python.org/issue?@action=redirect&bpo=26892

   (18) https://bugs.python.org/issue?@action=redirect&bpo=22274

   (19) https://bugs.python.org/issue?@action=redirect&bpo=26807

   (20) https://bugs.python.org/issue?@action=redirect&bpo=25745

   (21) https://bugs.python.org/issue?@action=redirect&bpo=26977

   (22) https://bugs.python.org/issue?@action=redirect&bpo=26881

   (23) https://bugs.python.org/issue?@action=redirect&bpo=23815

   (24) https://bugs.python.org/issue?@action=redirect&bpo=17765

   (25) https://bugs.python.org/issue?@action=redirect&bpo=26873

   (26) https://bugs.python.org/issue?@action=redirect&bpo=26711

   (27) https://bugs.python.org/issue?@action=redirect&bpo=24114

   (28) https://bugs.python.org/issue?@action=redirect&bpo=26864

   (29) https://bugs.python.org/issue?@action=redirect&bpo=26634

   (30) https://bugs.python.org/issue?@action=redirect&bpo=26804

   (31) https://bugs.python.org/issue?@action=redirect&bpo=26837

   (32) https://bugs.python.org/issue?@action=redirect&bpo=26041

   (33) https://bugs.python.org/issue?@action=redirect&bpo=26822

   (34) https://bugs.python.org/issue?@action=redirect&bpo=26733

   (35) https://bugs.python.org/issue?@action=redirect&bpo=26801

   (36) https://bugs.python.org/issue?@action=redirect&bpo=24838

   (37) https://bugs.python.org/issue?@action=redirect&bpo=26717

   (38) https://bugs.python.org/issue?@action=redirect&bpo=26735

   (39) https://bugs.python.org/issue?@action=redirect&bpo=16329

   (40) https://bugs.python.org/issue?@action=redirect&bpo=13952

   (41) https://bugs.python.org/issue?@action=redirect&bpo=26709

   (42) https://bugs.python.org/issue?@action=redirect&bpo=23735

   (43) https://bugs.python.org/issue?@action=redirect&bpo=26586

   (44) https://bugs.python.org/issue?@action=redirect&bpo=22854

   (45) https://bugs.python.org/issue?@action=redirect&bpo=25195

   (46) https://bugs.python.org/issue?@action=redirect&bpo=26644

   (47) https://bugs.python.org/issue?@action=redirect&bpo=23804

   (48) https://bugs.python.org/issue?@action=redirect&bpo=26616

   (49) https://bugs.python.org/issue?@action=redirect&bpo=21925

   (50) https://bugs.python.org/issue?@action=redirect&bpo=24266

   (51) https://bugs.python.org/issue?@action=redirect&bpo=26560

   (52) https://bugs.python.org/issue?@action=redirect&bpo=26569

   (53) https://bugs.python.org/issue?@action=redirect&bpo=26499

   (54) https://bugs.python.org/issue?@action=redirect&bpo=25320

   (55) https://bugs.python.org/issue?@action=redirect&bpo=16181

   (56) https://bugs.python.org/issue?@action=redirect&bpo=26513

   (57) https://bugs.python.org/issue?@action=redirect&bpo=23718

   (58) https://bugs.python.org/issue?@action=redirect&bpo=20589

   (59) https://bugs.python.org/issue?@action=redirect&bpo=26177

   (60) https://bugs.python.org/issue?@action=redirect&bpo=15068

   (61) https://bugs.python.org/issue?@action=redirect&bpo=2202

   (62) https://bugs.python.org/issue?@action=redirect&bpo=25718

   (63) https://bugs.python.org/issue?@action=redirect&bpo=26475

   (64) https://bugs.python.org/issue?@action=redirect&bpo=26457

   (65) https://bugs.python.org/issue?@action=redirect&bpo=26385

   (66) https://bugs.python.org/issue?@action=redirect&bpo=26402

   (67) https://bugs.python.org/issue?@action=redirect&bpo=25913

   (68) https://bugs.python.org/issue?@action=redirect&bpo=26186

   (69) https://bugs.python.org/issue?@action=redirect&bpo=26367

   (70) https://bugs.python.org/issue?@action=redirect&bpo=26309

   (71) https://bugs.python.org/issue?@action=redirect&bpo=25995

   (72) https://bugs.python.org/issue?@action=redirect&bpo=26117

   (73) https://bugs.python.org/issue?@action=redirect&bpo=25911

   (74) https://bugs.python.org/issue?@action=redirect&bpo=26045

   (75) https://bugs.python.org/issue?@action=redirect&bpo=12923

   (76) https://bugs.python.org/issue?@action=redirect&bpo=25945

   (77) https://bugs.python.org/issue?@action=redirect&bpo=26202

   (78) https://bugs.python.org/issue?@action=redirect&bpo=23076

   (79) https://bugs.python.org/issue?@action=redirect&bpo=19883

   (80) https://bugs.python.org/issue?@action=redirect&bpo=26227

   (81) https://bugs.python.org/issue?@action=redirect&bpo=26147

   (82) https://bugs.python.org/issue?@action=redirect&bpo=25935

   (83) https://bugs.python.org/issue?@action=redirect&bpo=16620

   (84) https://bugs.python.org/issue?@action=redirect&bpo=26013

   (85) https://bugs.python.org/issue?@action=redirect&bpo=25850

   (86) https://bugs.python.org/issue?@action=redirect&bpo=17633

   (87) https://bugs.python.org/issue?@action=redirect&bpo=24705

   (88) https://bugs.python.org/issue?@action=redirect&bpo=22138

   (89) https://bugs.python.org/issue?@action=redirect&bpo=25672

   (90) https://bugs.python.org/issue?@action=redirect&bpo=26012

   (91) https://bugs.python.org/issue?@action=redirect&bpo=24120

   (92) https://bugs.python.org/issue?@action=redirect&bpo=25447

   (93) https://bugs.python.org/issue?@action=redirect&bpo=25447

   (94) https://bugs.python.org/issue?@action=redirect&bpo=24103

   (95) https://bugs.python.org/issue?@action=redirect&bpo=25860

   (96) https://bugs.python.org/issue?@action=redirect&bpo=25914

   (97) https://bugs.python.org/issue?@action=redirect&bpo=25902

   (98) https://bugs.python.org/issue?@action=redirect&bpo=25717

   (99) https://bugs.python.org/issue?@action=redirect&bpo=24903

   (100) https://bugs.python.org/issue?@action=redirect&bpo=25764

   (101) https://bugs.python.org/issue?@action=redirect&bpo=6478

   (102) https://bugs.python.org/issue?@action=redirect&bpo=14285

   (103) https://bugs.python.org/issue?@action=redirect&bpo=19771

   (104) https://bugs.python.org/issue?@action=redirect&bpo=25177

   (105) https://bugs.python.org/issue?@action=redirect&bpo=25718

   (106) https://bugs.python.org/issue?@action=redirect&bpo=10131

   (107) https://bugs.python.org/issue?@action=redirect&bpo=25725

   (108) https://bugs.python.org/issue?@action=redirect&bpo=25663

   (109) https://bugs.python.org/issue?@action=redirect&bpo=25688

   (110) https://bugs.python.org/issue?@action=redirect&bpo=23914

   (111) https://bugs.python.org/issue?@action=redirect&bpo=25691

   (112) https://bugs.python.org/issue?@action=redirect&bpo=25624

   (113) https://bugs.python.org/issue?@action=redirect&bpo=26050

   (114) https://bugs.python.org/issue?@action=redirect&bpo=25924

   (115) https://bugs.python.org/issue?@action=redirect&bpo=26406

   (116) https://bugs.python.org/issue?@action=redirect&bpo=26848

   (117) https://bugs.python.org/issue?@action=redirect&bpo=27040

   (118) https://bugs.python.org/issue?@action=redirect&bpo=27041

   (119) https://bugs.python.org/issue?@action=redirect&bpo=27223

   (120) https://bugs.python.org/issue?@action=redirect&bpo=22970


File: python.info,  Node: IDLE<59>,  Next: ドキュメント<80>,  Prev: ライブラリ<194>,  Up: Python 3 5 2 release candidate 1

1.24.105.4 IDLE
...............

   - bpo-5124(1): Paste with text selected now replaces the selection on
     X11.  This matches how paste works on Windows, Mac, most modern
     Linux apps, and ttk widgets.  Original patch by Serhiy Storchaka.

   - bpo-24759(2): Make clear in idlelib.idle_test.__init__ that the
     directory is a private implementation of test.test_idle and tool
     for maintainers.

   - bpo-27196(3): Stop 'ThemeChanged' warnings when running IDLE tests.
     These persisted after other warnings were suppressed in #20567.
     Apply Serhiy Storchaka's update_idletasks solution to four test
     files.  Record this additional advice in idle_test/README.txt

   - bpo-20567(4): Revise idle_test/README.txt with advice about
     avoiding tk warning messages from tests.  Apply advice to several
     IDLE tests.

   - bpo-27117(5): Make colorizer htest and turtledemo work with dark
     themes.  Move code for configuring text widget colors to a new
     function.

   - bpo-26673(6): When tk reports font size as 0, change to size 10.
     Such fonts on Linux prevented the configuration dialog from
     opening.

   - bpo-21939(7): Add test for IDLE's percolator.  Original patch by
     Saimadhav Heblikar.

   - bpo-21676(8): Add test for IDLE's replace dialog.  Original patch
     by Saimadhav Heblikar.

   - bpo-18410(9): Add test for IDLE's search dialog.  Original patch by
     Westley Martínez.

   - bpo-21703(10): Add test for IDLE's undo delegator.  Original patch
     by Saimadhav Heblikar .

   - bpo-27044(11): Add ConfigDialog.remove_var_callbacks to stop memory
     leaks.

   - bpo-23977(12): Add more asserts to test_delegator.

   - bpo-20640(13): Add tests for idlelib.configHelpSourceEdit.  Patch
     by Saimadhav Heblikar.

   - In the 'IDLE-console differences' section of the IDLE doc, clarify
     how running with IDLE affects sys.modules and the standard streams.

   - bpo-25507(14): fix incorrect change in IOBinding that prevented
     printing.  Augment IOBinding htest to include all major IOBinding
     functions.

   - bpo-25905(15): Revert unwanted conversion of ' to ’ RIGHT SINGLE
     QUOTATION MARK in README.txt and open this and NEWS.txt with
     'ascii'.  Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5124

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24759

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27196

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20567

   (5) https://bugs.python.org/issue?@action=redirect&bpo=27117

   (6) https://bugs.python.org/issue?@action=redirect&bpo=26673

   (7) https://bugs.python.org/issue?@action=redirect&bpo=21939

   (8) https://bugs.python.org/issue?@action=redirect&bpo=21676

   (9) https://bugs.python.org/issue?@action=redirect&bpo=18410

   (10) https://bugs.python.org/issue?@action=redirect&bpo=21703

   (11) https://bugs.python.org/issue?@action=redirect&bpo=27044

   (12) https://bugs.python.org/issue?@action=redirect&bpo=23977

   (13) https://bugs.python.org/issue?@action=redirect&bpo=20640

   (14) https://bugs.python.org/issue?@action=redirect&bpo=25507

   (15) https://bugs.python.org/issue?@action=redirect&bpo=25905


File: python.info,  Node: ドキュメント<80>,  Next: テスト<81>,  Prev: IDLE<59>,  Up: Python 3 5 2 release candidate 1

1.24.105.5 ドキュメント
.......................

   - bpo-19489(1): Moved the search box from the sidebar to the header
     and footer of each page.  Patch by Ammar Askar.

   - bpo-24136(2): Document the new PEP 448(3) unpacking syntax of 3.5.

   - bpo-26736(4): Used HTTPS for external links in the documentation if
     possible.

   - bpo-6953(5): Rework the Readline module documentation to group
     related functions together, and add more details such as what
     underlying Readline functions and variables are accessed.

   - bpo-23606(6): Adds note to ctypes documentation regarding
     cdll.msvcrt.

   - bpo-25500(7): Fix documentation to not claim that __import__ is
     searched for in the global scope.

   - bpo-26014(8): Update 3.x packaging documentation: * "See also"
     links to the new docs are now provided in the legacy pages * links
     to setuptools documentation have been updated

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19489

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24136

   (3) https://peps.python.org/pep-0448/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26736

   (5) https://bugs.python.org/issue?@action=redirect&bpo=6953

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23606

   (7) https://bugs.python.org/issue?@action=redirect&bpo=25500

   (8) https://bugs.python.org/issue?@action=redirect&bpo=26014


File: python.info,  Node: テスト<81>,  Next: ビルド<91>,  Prev: ドキュメント<80>,  Up: Python 3 5 2 release candidate 1

1.24.105.6 テスト
.................

   - bpo-21916(1): Added tests for the turtle module.  Patch by ingrid,
     Gregory Loyse and Jelle Zijlstra.

   - bpo-26523(2): The multiprocessing thread pool
     (multiprocessing.dummy.Pool) was untested.

   - bpo-26015(3): Added new tests for pickling iterators of mutable
     sequences.

   - bpo-26325(4): Added test.support.check_no_resource_warning() to
     check that no ResourceWarning is emitted.

   - bpo-25940(5): Changed test_ssl to use self-signed.pythontest.net.
     This avoids relying on svn.python.org, which recently changed root
     certificate.

   - bpo-25616(6): Tests for OrderedDict are extracted from
     test_collections into separate file test_ordered_dict.

   - bpo-26583(7): Skip test_timestamp_overflow in test_import if
     bytecode files cannot be written.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21916

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26523

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26015

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26325

   (5) https://bugs.python.org/issue?@action=redirect&bpo=25940

   (6) https://bugs.python.org/issue?@action=redirect&bpo=25616

   (7) https://bugs.python.org/issue?@action=redirect&bpo=26583


File: python.info,  Node: ビルド<91>,  Next: Windows<79>,  Prev: テスト<81>,  Up: Python 3 5 2 release candidate 1

1.24.105.7 ビルド
.................

   - bpo-26884(1): Fix linking extension modules for cross builds.
     Patch by Xavier de Gaye.

   - bpo-22359(2): Disable the rules for running _freeze_importlib and
     pgen when cross-compiling.  The output of these programs is
     normally saved with the source code anyway, and is still
     regenerated when doing a native build.  Patch by Xavier de Gaye.

   - bpo-27229(3): Fix the cross-compiling pgen rule for in-tree builds.
     Patch by Xavier de Gaye.

   - bpo-21668(4): Link audioop, _datetime, _ctypes_test modules to
     libm, except on Mac OS X. Patch written by Xavier de Gaye.

   - bpo-25702(5): A -with-lto configure option has been added that will
     enable link time optimizations at build time during a make
     profile-opt.  Some compilers and toolchains are known to not
     produce stable code when using LTO, be sure to test things
     thoroughly before relying on it.  It can provide a few % speed up
     over profile-opt alone.

   - bpo-26624(6): Adds validation of ucrtbase[d].dll version with
     warning for old versions.

   - bpo-17603(7): Avoid error about nonexistent fileblocks.o file by
     using a lower-level check for st_blocks in struct stat.

   - bpo-26079(8): Fixing the build output folder for tix-8.4.3.6.
     Patch by Bjoern Thiel.

   - bpo-26465(9): Update Windows builds to use OpenSSL 1.0.2g.

   - bpo-24421(10): Compile Modules/_math.c once, before building
     extensions.  Previously it could fail to compile properly if the
     math and cmath builds were concurrent.

   - bpo-25348(11): Added ‘--pgo’ and ‘--pgo-job’ arguments to
     ‘PCbuild\build.bat’ for building with Profile-Guided Optimization.
     The old ‘PCbuild\build_pgo.bat’ script is now deprecated, and
     simply calls ‘PCbuild\build.bat --pgo %*’.

   - bpo-25827(12): Add support for building with ICC to ‘configure’,
     including a new ‘--with-icc’ flag.

   - bpo-25696(13): Fix installation of Python on UNIX with make -j9.

   - bpo-26930(14): Update OS X 10.5+ 32-bit-only installer to build and
     link with OpenSSL 1.0.2h.

   - bpo-26268(15): Update Windows builds to use OpenSSL 1.0.2f.

   - bpo-25136(16): Support Apple Xcode 7's new textual SDK stub
     libraries.

   - bpo-24324(17): Do not enable unreachable code warnings when using
     gcc as the option does not work correctly in older versions of gcc
     and has been silently removed as of gcc-4.5.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26884

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22359

   (3) https://bugs.python.org/issue?@action=redirect&bpo=27229

   (4) https://bugs.python.org/issue?@action=redirect&bpo=21668

   (5) https://bugs.python.org/issue?@action=redirect&bpo=25702

   (6) https://bugs.python.org/issue?@action=redirect&bpo=26624

   (7) https://bugs.python.org/issue?@action=redirect&bpo=17603

   (8) https://bugs.python.org/issue?@action=redirect&bpo=26079

   (9) https://bugs.python.org/issue?@action=redirect&bpo=26465

   (10) https://bugs.python.org/issue?@action=redirect&bpo=24421

   (11) https://bugs.python.org/issue?@action=redirect&bpo=25348

   (12) https://bugs.python.org/issue?@action=redirect&bpo=25827

   (13) https://bugs.python.org/issue?@action=redirect&bpo=25696

   (14) https://bugs.python.org/issue?@action=redirect&bpo=26930

   (15) https://bugs.python.org/issue?@action=redirect&bpo=26268

   (16) https://bugs.python.org/issue?@action=redirect&bpo=25136

   (17) https://bugs.python.org/issue?@action=redirect&bpo=24324


File: python.info,  Node: Windows<79>,  Next: Tools/Demos<56>,  Prev: ビルド<91>,  Up: Python 3 5 2 release candidate 1

1.24.105.8 Windows
..................

   - bpo-27053(1): Updates make_zip.py to correctly generate library ZIP
     file.

   - bpo-26268(2): Update the prepare_ssl.py script to handle OpenSSL
     releases that don't include the contents of the include directory
     (that is, 1.0.2e and later).

   - bpo-26071(3): bdist_wininst created binaries fail to start and find
     32bit Python

   - bpo-26073(4): Update the list of magic numbers in launcher

   - bpo-26065(5): Excludes venv from library when generating embeddable
     distro.

   - bpo-17500(6): Remove unused and outdated icons.  (See also:
     ‘https://github.com/python/pythondotorg/issues/945’)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=27053

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26268

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26071

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26073

   (5) https://bugs.python.org/issue?@action=redirect&bpo=26065

   (6) https://bugs.python.org/issue?@action=redirect&bpo=17500


File: python.info,  Node: Tools/Demos<56>,  Prev: Windows<79>,  Up: Python 3 5 2 release candidate 1

1.24.105.9 Tools/Demos
......................

   - bpo-26799(1): Fix python-gdb.py: don't get C types once when the
     Python code is loaded, but get C types on demand.  The C types can
     change if python-gdb.py is loaded before the Python executable.
     Patch written by Thomas Ilsche.

   - bpo-26271(2): Fix the Freeze tool to properly use flags passed
     through configure.  Patch by Daniel Shaulov.

   - bpo-26489(3): Add dictionary unpacking support to
     Tools/parser/unparse.py.  Patch by Guo Ci Teo.

   - bpo-26316(4): Fix variable name typo in Argument Clinic.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=26799

   (2) https://bugs.python.org/issue?@action=redirect&bpo=26271

   (3) https://bugs.python.org/issue?@action=redirect&bpo=26489

   (4) https://bugs.python.org/issue?@action=redirect&bpo=26316


File: python.info,  Node: Python 3 5 1 final,  Next: Python 3 5 1 release candidate 1,  Prev: Python 3 5 2 release candidate 1,  Up: 変更履歴

1.24.106 Python 3.5.1 final
---------------------------

'Release date: 2015-12-06'

* Menu:

* Core and Builtins: Core and Builtins<192>.
* Windows: Windows<80>.


File: python.info,  Node: Core and Builtins<192>,  Next: Windows<80>,  Up: Python 3 5 1 final

1.24.106.1 Core and Builtins
............................

   - bpo-25709(1): Fixed problem with in-place string concatenation and
     utf-8 cache.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25709


File: python.info,  Node: Windows<80>,  Prev: Core and Builtins<192>,  Up: Python 3 5 1 final

1.24.106.2 Windows
..................

   - bpo-25715(1): Python 3.5.1 installer shows wrong upgrade path and
     incorrect logic for launcher detection.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25715


File: python.info,  Node: Python 3 5 1 release candidate 1,  Next: Python 3 5 0 final,  Prev: Python 3 5 1 final,  Up: 変更履歴

1.24.107 Python 3.5.1 release candidate 1
-----------------------------------------

'Release date: 2015-11-22'

* Menu:

* Core and Builtins: Core and Builtins<193>.
* ライブラリ: ライブラリ<195>.
* IDLE: IDLE<60>.
* ドキュメント: ドキュメント<81>.
* テスト: テスト<82>.
* ビルド: ビルド<92>.
* Windows: Windows<81>.
* Tools/Demos: Tools/Demos<57>.


File: python.info,  Node: Core and Builtins<193>,  Next: ライブラリ<195>,  Up: Python 3 5 1 release candidate 1

1.24.107.1 Core and Builtins
............................

   - bpo-25630(1): Fix a possible segfault during argument parsing in
     functions that accept filesystem paths.

   - bpo-23564(2): Fixed a partially broken sanity check in the
     _posixsubprocess internals regarding how fds_to_pass were passed to
     the child.  The bug had no actual impact as subprocess.py already
     avoided it.

   - bpo-25388(3): Fixed tokenizer crash when processing undecodable
     source code with a null byte.

   - bpo-25462(4): The hash of the key now is calculated only once in
     most operations in C implementation of OrderedDict.

   - bpo-22995(5): Default implementation of __reduce__ and
     __reduce_ex__ now rejects builtin types with not defined __new__.

   - bpo-25555(6): Fix parser and AST: fill lineno and col_offset of
     "arg" node when compiling AST from Python objects.

   - bpo-24802(7): Avoid buffer overreads when int(), float(),
     compile(), exec() and eval() are passed bytes-like objects.  These
     objects are not necessarily terminated by a null byte, but the
     functions assumed they were.

   - bpo-24726(8): Fixed a crash and leaking NULL in repr() of
     OrderedDict that was mutated by direct calls of dict methods.

   - bpo-25449(9): Iterating OrderedDict with keys with unstable hash
     now raises KeyError in C implementations as well as in Python
     implementation.

   - bpo-25395(10): Fixed crash when highly nested OrderedDict
     structures were garbage collected.

   - bpo-25274(11): sys.setrecursionlimit() now raises a RecursionError
     if the new recursion limit is too low depending at the current
     recursion depth.  Modify also the "lower-water mark" formula to
     make it monotonic.  This mark is used to decide when the overflowed
     flag of the thread state is reset.

   - bpo-24402(12): Fix input() to prompt to the redirected stdout when
     sys.stdout.fileno() fails.

   - bpo-24806(13): Prevent builtin types that are not allowed to be
     subclassed from being subclassed through multiple inheritance.

   - bpo-24848(14): Fixed a number of bugs in UTF-7 decoding of
     misformed data.

   - bpo-25280(15): Import trace messages emitted in verbose (-v) mode
     are no longer formatted twice.

   - bpo-25003(16): On Solaris 11.3 or newer, os.urandom() now uses the
     getrandom() function instead of the getentropy() function.  The
     getentropy() function is blocking to generate very good quality
     entropy, os.urandom() doesn't need such high-quality entropy.

   - bpo-25182(17): The stdprinter (used as sys.stderr before the io
     module is imported at startup) now uses the backslashreplace error
     handler.

   - bpo-25131(18): Make the line number and column offset of set/dict
     literals and comprehensions correspond to the opening brace.

   - bpo-25150(19): Hide the private ‘_Py_atomic_XXX’ symbols from the
     public Python.h header to fix a compilation error with OpenMP.
     PyThreadState_GET() becomes an alias to PyThreadState_Get() to
     avoid ABI incompatibilities.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25630

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23564

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25388

   (4) https://bugs.python.org/issue?@action=redirect&bpo=25462

   (5) https://bugs.python.org/issue?@action=redirect&bpo=22995

   (6) https://bugs.python.org/issue?@action=redirect&bpo=25555

   (7) https://bugs.python.org/issue?@action=redirect&bpo=24802

   (8) https://bugs.python.org/issue?@action=redirect&bpo=24726

   (9) https://bugs.python.org/issue?@action=redirect&bpo=25449

   (10) https://bugs.python.org/issue?@action=redirect&bpo=25395

   (11) https://bugs.python.org/issue?@action=redirect&bpo=25274

   (12) https://bugs.python.org/issue?@action=redirect&bpo=24402

   (13) https://bugs.python.org/issue?@action=redirect&bpo=24806

   (14) https://bugs.python.org/issue?@action=redirect&bpo=24848

   (15) https://bugs.python.org/issue?@action=redirect&bpo=25280

   (16) https://bugs.python.org/issue?@action=redirect&bpo=25003

   (17) https://bugs.python.org/issue?@action=redirect&bpo=25182

   (18) https://bugs.python.org/issue?@action=redirect&bpo=25131

   (19) https://bugs.python.org/issue?@action=redirect&bpo=25150


File: python.info,  Node: ライブラリ<195>,  Next: IDLE<60>,  Prev: Core and Builtins<193>,  Up: Python 3 5 1 release candidate 1

1.24.107.2 ライブラリ
.....................

   - bpo-25626(1): Change three zlib functions to accept sizes that fit
     in Py_ssize_t, but internally cap those sizes to UINT_MAX. This
     resolves a regression in 3.5 where GzipFile.read() failed to read
     chunks larger than 2 or 4 GiB. The change affects the
     zlib.Decompress.decompress() max_length parameter, the
     zlib.decompress() bufsize parameter, and the
     zlib.Decompress.flush() length parameter.

   - bpo-25583(2): Avoid incorrect errors raised by
     os.makedirs(exist_ok=True) when the OS gives priority to errors
     such as EACCES over EEXIST.

   - bpo-25593(3): Change semantics of EventLoop.stop() in asyncio.

   - bpo-6973(4): When we know a subprocess.Popen process has died, do
     not allow the send_signal(), terminate(), or kill() methods to do
     anything as they could potentially signal a different process.

   - bpo-25590(5): In the Readline completer, only call getattr() once
     per attribute.

   - bpo-25498(6): Fix a crash when garbage-collecting ctypes objects
     created by wrapping a memoryview.  This was a regression made in
     3.5a1.  Based on patch by Eryksun.

   - bpo-25584(7): Added "escape" to the __all__ list in the glob
     module.

   - bpo-25584(8): Fixed recursive glob() with patterns starting with
     ‘**’.

   - bpo-25446(9): Fix regression in smtplib's AUTH LOGIN support.

   - bpo-18010(10): Fix the pydoc web server's module search function to
     handle exceptions from importing packages.

   - bpo-25554(11): Got rid of circular references in regular expression
     parsing.

   - bpo-25510(12): fileinput.FileInput.readline() now returns b''
     instead of '' at the end if the FileInput was opened with binary
     mode.  Patch by Ryosuke Ito.

   - bpo-25503(13): Fixed inspect.getdoc() for inherited docstrings of
     properties.  Original patch by John Mark Vandenberg.

   - bpo-25515(14): Always use os.urandom as a source of randomness in
     uuid.uuid4.

   - bpo-21827(15): Fixed textwrap.dedent() for the case when largest
     common whitespace is a substring of smallest leading whitespace.
     Based on patch by Robert Li.

   - bpo-25447(16): The lru_cache() wrapper objects now can be copied
     and pickled (by returning the original object unchanged).

   - bpo-25390(17): typing: Don't crash on Union[str, Pattern].

   - bpo-25441(18): asyncio: Raise error from drain() when socket is
     closed.

   - bpo-25410(19): Cleaned up and fixed minor bugs in C implementation
     of OrderedDict.

   - bpo-25411(20): Improved Unicode support in SMTPHandler through
     better use of the email package.  Thanks to user simon04 for the
     patch.

   - bpo-25407(21): Remove mentions of the formatter module being
     removed in Python 3.6.

   - bpo-25406(22): Fixed a bug in C implementation of
     OrderedDict.move_to_end() that caused segmentation fault or hang in
     iterating after moving several items to the start of ordered dict.

   - bpo-25364(23): zipfile now works in threads disabled builds.

   - bpo-25328(24): smtpd's SMTPChannel now correctly raises a
     ValueError if both decode_data and enable_SMTPUTF8 are set to true.

   - bpo-25316(25): distutils raises OSError instead of
     DistutilsPlatformError when MSVC is not installed.

   - bpo-25380(26): Fixed protocol for the STACK_GLOBAL opcode in
     pickletools.opcodes.

   - bpo-23972(27): Updates asyncio datagram create method allowing
     reuseport and reuseaddr socket options to be set prior to binding
     the socket.  Mirroring the existing asyncio create_server method
     the reuseaddr option for datagram sockets defaults to True if the
     O/S is 'posix' (except if the platform is Cygwin).  Patch by Chris
     Laws.

   - bpo-25304(28): Add asyncio.run_coroutine_threadsafe().  This lets
     you submit a coroutine to a loop from another thread, returning a
     concurrent.futures.Future.  By Vincent Michel.

   - bpo-25232(29): Fix CGIRequestHandler to split the query from the
     URL at the first question mark (?)  rather than the last.  Patch
     from Xiang Zhang.

   - bpo-24657(30): Prevent CGIRequestHandler from collapsing slashes in
     the query part of the URL as if it were a path.  Patch from Xiang
     Zhang.

   - bpo-24483(31): C implementation of functools.lru_cache() now
     calculates key's hash only once.

   - bpo-22958(32): Constructor and update method of
     weakref.WeakValueDictionary now accept the self and the dict
     keyword arguments.

   - bpo-22609(33): Constructor of collections.UserDict now accepts the
     self keyword argument.

   - bpo-25111(34): Fixed comparison of traceback.FrameSummary.

   - bpo-25262(35): Added support for BINBYTES8 opcode in Python
     implementation of unpickler.  Highest 32 bits of 64-bit size for
     BINUNICODE8 and BINBYTES8 opcodes no longer silently ignored on
     32-bit platforms in C implementation.

   - bpo-25034(36): Fix string.Formatter problem with auto-numbering and
     nested format_specs.  Patch by Anthon van der Neut.

   - bpo-25233(37): Rewrite the guts of asyncio.Queue and
     asyncio.Semaphore to be more understandable and correct.

   - bpo-25203(38): Failed readline.set_completer_delims() no longer
     left the module in inconsistent state.

   - bpo-23600(39): Default implementation of tzinfo.fromutc() was
     returning wrong results in some cases.

   - bpo-23329(40): Allow the ssl module to be built with older versions
     of LibreSSL.

   - Prevent overflow in _Unpickler_Read.

   - bpo-25047(41): The XML encoding declaration written by Element Tree
     now respects the letter case given by the user.  This restores the
     ability to write encoding names in uppercase like "UTF-8", which
     worked in Python 2.

   - bpo-25135(42): Make deque_clear() safer by emptying the deque
     before clearing.  This helps avoid possible reentrancy issues.

   - bpo-19143(43): platform module now reads Windows version from
     kernel32.dll to avoid compatibility shims.

   - bpo-25092(44): Fix datetime.strftime() failure when errno was
     already set to EINVAL.

   - bpo-23517(45): Fix rounding in fromtimestamp() and
     utcfromtimestamp() methods of datetime.datetime: microseconds are
     now rounded to nearest with ties going to nearest even integer
     (ROUND_HALF_EVEN), instead of being rounding towards minus infinity
     (ROUND_FLOOR). It's important that these methods use the same
     rounding mode than datetime.timedelta to keep the property:
     (datetime(1970,1,1) + timedelta(seconds=t)) ==
     datetime.utcfromtimestamp(t).  It also the rounding mode used by
     round(float) for example.

   - bpo-25155(46): Fix datetime.datetime.now() and
     datetime.datetime.utcnow() on Windows to support date after year
     2038.  It was a regression introduced in Python 3.5.0.

   - bpo-25108(47): Omitted internal frames in traceback functions
     print_stack(), format_stack(), and extract_stack() called without
     arguments.

   - bpo-25118(48): Fix a regression of Python 3.5.0 in os.waitpid() on
     Windows.

   - bpo-24684(49): socket.socket.getaddrinfo() now calls
     PyUnicode_AsEncodedString() instead of calling the encode() method
     of the host, to handle correctly custom string with an encode()
     method which doesn't return a byte string.  The encoder of the IDNA
     codec is now called directly instead of calling the encode() method
     of the string.

   - bpo-25060(50): Correctly compute stack usage of the BUILD_MAP
     opcode.

   - bpo-24857(51): Comparing call_args to a long sequence now correctly
     returns a boolean result instead of raising an exception.  Patch by
     A Kaptur.

   - bpo-23144(52): Make sure that HTMLParser.feed() returns all the
     data, even when convert_charrefs is True.

   - bpo-24982(53): shutil.make_archive() with the "zip" format now adds
     entries for directories (including empty directories) in ZIP file.

   - bpo-25019(54): Fixed a crash caused by setting non-string key of
     expat parser.  Based on patch by John Leitch.

   - bpo-16180(55): Exit pdb if file has syntax error, instead of
     trapping user in an infinite loop.  Patch by Xavier de Gaye.

   - bpo-24891(56): Fix a race condition at Python startup if the file
     descriptor of stdin (0), stdout (1) or stderr (2) is closed while
     Python is creating sys.stdin, sys.stdout and sys.stderr objects.
     These attributes are now set to None if the creation of the object
     failed, instead of raising an OSError exception.  Initial patch
     written by Marco Paolini.

   - bpo-24992(57): Fix error handling and a race condition (related to
     garbage collection) in collections.OrderedDict constructor.

   - bpo-24881(58): Fixed setting binary mode in Python implementation
     of FileIO on Windows and Cygwin.  Patch from Akira Li.

   - bpo-25578(59): Fix (another) memory leak in SSLSocket.getpeercer().

   - bpo-25530(60): Disable the vulnerable SSLv3 protocol by default
     when creating ssl.SSLContext.

   - bpo-25569(61): Fix memory leak in SSLSocket.getpeercert().

   - bpo-25471(62): Sockets returned from accept() shouldn't appear to
     be nonblocking.

   - bpo-25319(63): When threading.Event is reinitialized, the
     underlying condition should use a regular lock rather than a
     recursive lock.

   - bpo-21112(64): Fix regression in unittest.expectedFailure on
     subclasses.  Patch from Berker Peksag.

   - bpo-24764(65): cgi.FieldStorage.read_multi() now ignores the
     Content-Length header in part headers.  Patch written by Peter
     Landry and reviewed by Pierre Quentel.

   - bpo-24913(66): Fix overrun error in deque.index().  Found by John
     Leitch and Bryce Darling.

   - bpo-24774(67): Fix docstring in http.server.test.  Patch from
     Chiu-Hsiang Hsu.

   - bpo-21159(68): Improve message in
     configparser.InterpolationMissingOptionError.  Patch from Łukasz
     Langa.

   - bpo-20362(69): Honour TestCase.longMessage correctly in
     assertRegex.  Patch from Ilia Kurenkov.

   - bpo-23572(70): Fixed functools.singledispatch on classes with false
     metaclasses.  Patch by Ethan Furman.

   - asyncio: ensure_future() now accepts awaitable objects.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25626

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25583

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25593

   (4) https://bugs.python.org/issue?@action=redirect&bpo=6973

   (5) https://bugs.python.org/issue?@action=redirect&bpo=25590

   (6) https://bugs.python.org/issue?@action=redirect&bpo=25498

   (7) https://bugs.python.org/issue?@action=redirect&bpo=25584

   (8) https://bugs.python.org/issue?@action=redirect&bpo=25584

   (9) https://bugs.python.org/issue?@action=redirect&bpo=25446

   (10) https://bugs.python.org/issue?@action=redirect&bpo=18010

   (11) https://bugs.python.org/issue?@action=redirect&bpo=25554

   (12) https://bugs.python.org/issue?@action=redirect&bpo=25510

   (13) https://bugs.python.org/issue?@action=redirect&bpo=25503

   (14) https://bugs.python.org/issue?@action=redirect&bpo=25515

   (15) https://bugs.python.org/issue?@action=redirect&bpo=21827

   (16) https://bugs.python.org/issue?@action=redirect&bpo=25447

   (17) https://bugs.python.org/issue?@action=redirect&bpo=25390

   (18) https://bugs.python.org/issue?@action=redirect&bpo=25441

   (19) https://bugs.python.org/issue?@action=redirect&bpo=25410

   (20) https://bugs.python.org/issue?@action=redirect&bpo=25411

   (21) https://bugs.python.org/issue?@action=redirect&bpo=25407

   (22) https://bugs.python.org/issue?@action=redirect&bpo=25406

   (23) https://bugs.python.org/issue?@action=redirect&bpo=25364

   (24) https://bugs.python.org/issue?@action=redirect&bpo=25328

   (25) https://bugs.python.org/issue?@action=redirect&bpo=25316

   (26) https://bugs.python.org/issue?@action=redirect&bpo=25380

   (27) https://bugs.python.org/issue?@action=redirect&bpo=23972

   (28) https://bugs.python.org/issue?@action=redirect&bpo=25304

   (29) https://bugs.python.org/issue?@action=redirect&bpo=25232

   (30) https://bugs.python.org/issue?@action=redirect&bpo=24657

   (31) https://bugs.python.org/issue?@action=redirect&bpo=24483

   (32) https://bugs.python.org/issue?@action=redirect&bpo=22958

   (33) https://bugs.python.org/issue?@action=redirect&bpo=22609

   (34) https://bugs.python.org/issue?@action=redirect&bpo=25111

   (35) https://bugs.python.org/issue?@action=redirect&bpo=25262

   (36) https://bugs.python.org/issue?@action=redirect&bpo=25034

   (37) https://bugs.python.org/issue?@action=redirect&bpo=25233

   (38) https://bugs.python.org/issue?@action=redirect&bpo=25203

   (39) https://bugs.python.org/issue?@action=redirect&bpo=23600

   (40) https://bugs.python.org/issue?@action=redirect&bpo=23329

   (41) https://bugs.python.org/issue?@action=redirect&bpo=25047

   (42) https://bugs.python.org/issue?@action=redirect&bpo=25135

   (43) https://bugs.python.org/issue?@action=redirect&bpo=19143

   (44) https://bugs.python.org/issue?@action=redirect&bpo=25092

   (45) https://bugs.python.org/issue?@action=redirect&bpo=23517

   (46) https://bugs.python.org/issue?@action=redirect&bpo=25155

   (47) https://bugs.python.org/issue?@action=redirect&bpo=25108

   (48) https://bugs.python.org/issue?@action=redirect&bpo=25118

   (49) https://bugs.python.org/issue?@action=redirect&bpo=24684

   (50) https://bugs.python.org/issue?@action=redirect&bpo=25060

   (51) https://bugs.python.org/issue?@action=redirect&bpo=24857

   (52) https://bugs.python.org/issue?@action=redirect&bpo=23144

   (53) https://bugs.python.org/issue?@action=redirect&bpo=24982

   (54) https://bugs.python.org/issue?@action=redirect&bpo=25019

   (55) https://bugs.python.org/issue?@action=redirect&bpo=16180

   (56) https://bugs.python.org/issue?@action=redirect&bpo=24891

   (57) https://bugs.python.org/issue?@action=redirect&bpo=24992

   (58) https://bugs.python.org/issue?@action=redirect&bpo=24881

   (59) https://bugs.python.org/issue?@action=redirect&bpo=25578

   (60) https://bugs.python.org/issue?@action=redirect&bpo=25530

   (61) https://bugs.python.org/issue?@action=redirect&bpo=25569

   (62) https://bugs.python.org/issue?@action=redirect&bpo=25471

   (63) https://bugs.python.org/issue?@action=redirect&bpo=25319

   (64) https://bugs.python.org/issue?@action=redirect&bpo=21112

   (65) https://bugs.python.org/issue?@action=redirect&bpo=24764

   (66) https://bugs.python.org/issue?@action=redirect&bpo=24913

   (67) https://bugs.python.org/issue?@action=redirect&bpo=24774

   (68) https://bugs.python.org/issue?@action=redirect&bpo=21159

   (69) https://bugs.python.org/issue?@action=redirect&bpo=20362

   (70) https://bugs.python.org/issue?@action=redirect&bpo=23572


File: python.info,  Node: IDLE<60>,  Next: ドキュメント<81>,  Prev: ライブラリ<195>,  Up: Python 3 5 1 release candidate 1

1.24.107.3 IDLE
...............

   - bpo-15348(1): Stop the debugger engine (normally in a user process)
     before closing the debugger window (running in the IDLE process).
     This prevents the RuntimeErrors that were being caught and ignored.

   - bpo-24455(2): Prevent IDLE from hanging when a) closing the shell
     while the debugger is active (15347); b) closing the debugger with
     the [X] button (15348); and c) activating the debugger when already
     active (24455).  The patch by Mark Roseman does this by making two
     changes.  1.  Suspend and resume the gui.interaction method with
     the tcl vwait mechanism intended for this purpose (instead of
     root.mainloop & .quit).  2.  In gui.run, allow any existing
     interaction to terminate first.

   - Change 'The program' to 'Your program' in an IDLE 'kill program?'
     message to make it clearer that the program referred to is the
     currently running user program, not IDLE itself.

   - bpo-24750(3): Improve the appearance of the IDLE editor window
     status bar.  Patch by Mark Roseman.

   - bpo-25313(4): Change the handling of new built-in text color themes
     to better address the compatibility problem introduced by the
     addition of IDLE Dark.  Consistently use the revised
     idleConf.CurrentTheme everywhere in idlelib.

   - bpo-24782(5): Extension configuration is now a tab in the IDLE
     Preferences dialog rather than a separate dialog.  The former tabs
     are now a sorted list.  Patch by Mark Roseman.

   - bpo-22726(6): Re-activate the config dialog help button with some
     content about the other buttons and the new IDLE Dark theme.

   - bpo-24820(7): IDLE now has an 'IDLE Dark' built-in text color
     theme.  It is more or less IDLE Classic inverted, with a cobalt
     blue background.  Strings, comments, keywords, ...  are still
     green, red, orange, ...  .  To use it with IDLEs released before
     November 2015, hit the 'Save as New Custom Theme' button and enter
     a new name, such as 'Custom Dark'.  The custom theme will work with
     any IDLE release, and can be modified.

   - bpo-25224(8): README.txt is now an idlelib index for IDLE
     developers and curious users.  The previous user content is now in
     the IDLE doc chapter.  'IDLE' now means 'Integrated Development and
     Learning Environment'.

   - bpo-24820(9): Users can now set breakpoint colors in Settings ->
     Custom Highlighting.  Original patch by Mark Roseman.

   - bpo-24972(10): Inactive selection background now matches active
     selection background, as configured by users, on all systems.
     Found items are now always highlighted on Windows.  Initial patch
     by Mark Roseman.

   - bpo-24570(11): Idle: make calltip and completion boxes appear on
     Macs affected by a tk regression.  Initial patch by Mark Roseman.

   - bpo-24988(12): Idle ScrolledList context menus (used in debugger)
     now work on Mac Aqua.  Patch by Mark Roseman.

   - bpo-24801(13): Make right-click for context menu work on Mac Aqua.
     Patch by Mark Roseman.

   - bpo-25173(14): Associate tkinter messageboxes with a specific
     widget.  For Mac OSX, make them a 'sheet'.  Patch by Mark Roseman.

   - bpo-25198(15): Enhance the initial html viewer now used for Idle
     Help.  Properly indent fixed-pitch text (patch by Mark Roseman).
     Give code snippet a very Sphinx-like light blueish-gray background.
     Re-use initial width and height set by users for shell and editor.
     When the Table of Contents (TOC) menu is used, put the section
     header at the top of the screen.

   - bpo-25225(16): Condense and rewrite Idle doc section on text
     colors.

   - bpo-21995(17): Explain some differences between IDLE and console
     Python.

   - bpo-22820(18): Explain need for 'print' when running file from Idle
     editor.

   - bpo-25224(19): Doc: augment Idle feature list and no-subprocess
     section.

   - bpo-25219(20): Update doc for Idle command line options.  Some were
     missing and notes were not correct.

   - bpo-24861(21): Most of idlelib is private and subject to change.
     Use idleib.idle.* to start Idle.  See idlelib.__init__.__doc__.

   - bpo-25199(22): Idle: add synchronization comments for future
     maintainers.

   - bpo-16893(23): Replace help.txt with help.html for Idle doc
     display.  The new idlelib/help.html is rstripped
     Doc/build/html/library/idle.html.  It looks better than help.txt
     and will better document Idle as released.  The tkinter html viewer
     that works for this file was written by Mark Roseman.  The now
     unused EditorWindow.HelpDialog class and helt.txt file are
     deprecated.

   - bpo-24199(24): Deprecate unused idlelib.idlever with possible
     removal in 3.6.

   - bpo-24790(25): Remove extraneous code (which also create 2 & 3
     conflicts).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15348

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24455

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24750

   (4) https://bugs.python.org/issue?@action=redirect&bpo=25313

   (5) https://bugs.python.org/issue?@action=redirect&bpo=24782

   (6) https://bugs.python.org/issue?@action=redirect&bpo=22726

   (7) https://bugs.python.org/issue?@action=redirect&bpo=24820

   (8) https://bugs.python.org/issue?@action=redirect&bpo=25224

   (9) https://bugs.python.org/issue?@action=redirect&bpo=24820

   (10) https://bugs.python.org/issue?@action=redirect&bpo=24972

   (11) https://bugs.python.org/issue?@action=redirect&bpo=24570

   (12) https://bugs.python.org/issue?@action=redirect&bpo=24988

   (13) https://bugs.python.org/issue?@action=redirect&bpo=24801

   (14) https://bugs.python.org/issue?@action=redirect&bpo=25173

   (15) https://bugs.python.org/issue?@action=redirect&bpo=25198

   (16) https://bugs.python.org/issue?@action=redirect&bpo=25225

   (17) https://bugs.python.org/issue?@action=redirect&bpo=21995

   (18) https://bugs.python.org/issue?@action=redirect&bpo=22820

   (19) https://bugs.python.org/issue?@action=redirect&bpo=25224

   (20) https://bugs.python.org/issue?@action=redirect&bpo=25219

   (21) https://bugs.python.org/issue?@action=redirect&bpo=24861

   (22) https://bugs.python.org/issue?@action=redirect&bpo=25199

   (23) https://bugs.python.org/issue?@action=redirect&bpo=16893

   (24) https://bugs.python.org/issue?@action=redirect&bpo=24199

   (25) https://bugs.python.org/issue?@action=redirect&bpo=24790


File: python.info,  Node: ドキュメント<81>,  Next: テスト<82>,  Prev: IDLE<60>,  Up: Python 3 5 1 release candidate 1

1.24.107.4 ドキュメント
.......................

   - bpo-22558(1): Add remaining doc links to source code for
     Python-coded modules.  Patch by Yoni Lavi.

   - bpo-12067(2): Rewrite Comparisons section in the Expressions
     chapter of the language reference.  Some of the details of
     comparing mixed types were incorrect or ambiguous.  NotImplemented
     is only relevant at a lower level than the Expressions chapter.
     Added details of comparing range() objects, and default behaviour
     and consistency suggestions for user-defined classes.  Patch from
     Andy Maier.

   - bpo-24952(3): Clarify the default size argument of stack_size() in
     the "threading" and "_thread" modules.  Patch from Mattip.

   - bpo-23725(4): Overhaul tempfile docs.  Note deprecated status of
     mktemp.  Patch from Zbigniew Jędrzejewski-Szmek.

   - bpo-24808(5): Update the types of some PyTypeObject fields.  Patch
     by Joseph Weston.

   - bpo-22812(6): Fix unittest discovery examples.  Patch from Pam
     McA'Nulty.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22558

   (2) https://bugs.python.org/issue?@action=redirect&bpo=12067

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24952

   (4) https://bugs.python.org/issue?@action=redirect&bpo=23725

   (5) https://bugs.python.org/issue?@action=redirect&bpo=24808

   (6) https://bugs.python.org/issue?@action=redirect&bpo=22812


File: python.info,  Node: テスト<82>,  Next: ビルド<92>,  Prev: ドキュメント<81>,  Up: Python 3 5 1 release candidate 1

1.24.107.5 テスト
.................

   - bpo-25449(1): Added tests for OrderedDict subclasses.

   - bpo-25099(2): Make test_compileall not fail when an entry on
     sys.path cannot be written to (commonly seen in administrative
     installs on Windows).

   - bpo-23919(3): Prevents assert dialogs appearing in the test suite.

   - ‘PCbuild\rt.bat’ now accepts an unlimited number of arguments to
     pass along to regrtest.py.  Previously there was a limit of 9.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25449

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25099

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23919


File: python.info,  Node: ビルド<92>,  Next: Windows<81>,  Prev: テスト<82>,  Up: Python 3 5 1 release candidate 1

1.24.107.6 ビルド
.................

   - bpo-24915(1): Add LLVM support for PGO builds and use the test
     suite to generate the profile data.  Initial patch by Alecsandru
     Patrascu of Intel.

   - bpo-24910(2): Windows MSIs now have unique display names.

   - bpo-24986(3): It is now possible to build Python on Windows without
     errors when external libraries are not available.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24915

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24910

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24986


File: python.info,  Node: Windows<81>,  Next: Tools/Demos<57>,  Prev: ビルド<92>,  Up: Python 3 5 1 release candidate 1

1.24.107.7 Windows
..................

   - bpo-25450(1): Updates shortcuts to start Python in installation
     directory.

   - bpo-25164(2): Changes default all-users install directory to match
     per-user directory.

   - bpo-25143(3): Improves installer error messages for unsupported
     platforms.

   - bpo-25163(4): Display correct directory in installer when using
     non-default settings.

   - bpo-25361(5): Disables use of SSE2 instructions in Windows 32-bit
     build

   - bpo-25089(6): Adds logging to installer for case where launcher is
     not selected on upgrade.

   - bpo-25165(7): Windows uninstallation should not remove launcher if
     other versions remain

   - bpo-25112(8): py.exe launcher is missing icons

   - bpo-25102(9): Windows installer does not precompile for -O or -OO.

   - bpo-25081(10): Makes Back button in installer go back to upgrade
     page when upgrading.

   - bpo-25091(11): Increases font size of the installer.

   - bpo-25126(12): Clarifies that the non-web installer will download
     some components.

   - bpo-25213(13): Restores requestedExecutionLevel to manifest to
     disable UAC virtualization.

   - bpo-25022(14): Removed very outdated PC/example_nt/ directory.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25450

   (2) https://bugs.python.org/issue?@action=redirect&bpo=25164

   (3) https://bugs.python.org/issue?@action=redirect&bpo=25143

   (4) https://bugs.python.org/issue?@action=redirect&bpo=25163

   (5) https://bugs.python.org/issue?@action=redirect&bpo=25361

   (6) https://bugs.python.org/issue?@action=redirect&bpo=25089

   (7) https://bugs.python.org/issue?@action=redirect&bpo=25165

   (8) https://bugs.python.org/issue?@action=redirect&bpo=25112

   (9) https://bugs.python.org/issue?@action=redirect&bpo=25102

   (10) https://bugs.python.org/issue?@action=redirect&bpo=25081

   (11) https://bugs.python.org/issue?@action=redirect&bpo=25091

   (12) https://bugs.python.org/issue?@action=redirect&bpo=25126

   (13) https://bugs.python.org/issue?@action=redirect&bpo=25213

   (14) https://bugs.python.org/issue?@action=redirect&bpo=25022


File: python.info,  Node: Tools/Demos<57>,  Prev: Windows<81>,  Up: Python 3 5 1 release candidate 1

1.24.107.8 Tools/Demos
......................

   - bpo-25440(1): Fix output of python-config -extension-suffix.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25440


File: python.info,  Node: Python 3 5 0 final,  Next: Python 3 5 0 release candidate 4,  Prev: Python 3 5 1 release candidate 1,  Up: 変更履歴

1.24.108 Python 3.5.0 final
---------------------------

'Release date: 2015-09-13'

* Menu:

* ビルド: ビルド<93>.


File: python.info,  Node: ビルド<93>,  Up: Python 3 5 0 final

1.24.108.1 ビルド
.................

   - bpo-25071(1): Windows installer should not require TargetDir
     parameter when installing quietly.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25071


File: python.info,  Node: Python 3 5 0 release candidate 4,  Next: Python 3 5 0 release candidate 3,  Prev: Python 3 5 0 final,  Up: 変更履歴

1.24.109 Python 3.5.0 release candidate 4
-----------------------------------------

'Release date: 2015-09-09'

* Menu:

* ライブラリ: ライブラリ<196>.
* ビルド: ビルド<94>.


File: python.info,  Node: ライブラリ<196>,  Next: ビルド<94>,  Up: Python 3 5 0 release candidate 4

1.24.109.1 ライブラリ
.....................

   - bpo-25029(1): Fixes MemoryError in test_strptime.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25029


File: python.info,  Node: ビルド<94>,  Prev: ライブラリ<196>,  Up: Python 3 5 0 release candidate 4

1.24.109.2 ビルド
.................

   - bpo-25027(1): Reverts partial-static build options and adds
     vcruntime140.dll to Windows installation.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=25027


File: python.info,  Node: Python 3 5 0 release candidate 3,  Next: Python 3 5 0 release candidate 2,  Prev: Python 3 5 0 release candidate 4,  Up: 変更履歴

1.24.110 Python 3.5.0 release candidate 3
-----------------------------------------

'Release date: 2015-09-07'

* Menu:

* Core and Builtins: Core and Builtins<194>.
* ライブラリ: ライブラリ<197>.


File: python.info,  Node: Core and Builtins<194>,  Next: ライブラリ<197>,  Up: Python 3 5 0 release candidate 3

1.24.110.1 Core and Builtins
............................

   - bpo-24305(1): Prevent import subsystem stack frames from being
     counted by the warnings.warn(stacklevel=) parameter.

   - bpo-24912(2): Prevent __class__ assignment to immutable built-in
     objects.

   - bpo-24975(3): Fix AST compilation for PEP 448(4) syntax.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24305

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24912

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24975

   (4) https://peps.python.org/pep-0448/


File: python.info,  Node: ライブラリ<197>,  Prev: Core and Builtins<194>,  Up: Python 3 5 0 release candidate 3

1.24.110.2 ライブラリ
.....................

   - bpo-24917(1): time_strftime() buffer over-read.

   - bpo-24748(2): To resolve a compatibility problem found with py2exe
     and pywin32, imp.load_dynamic() once again ignores previously
     loaded modules to support Python modules replacing themselves with
     extension modules.  Patch by Petr Viktorin.

   - bpo-24635(3): Fixed a bug in typing.py where isinstance([],
     typing.Iterable) would return True once, then False on subsequent
     calls.

   - bpo-24989(4): Fixed buffer overread in BytesIO.readline() if a
     position is set beyond size.  Based on patch by John Leitch.

   - bpo-24913(5): Fix overrun error in deque.index().  Found by John
     Leitch and Bryce Darling.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24917

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24748

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24635

   (4) https://bugs.python.org/issue?@action=redirect&bpo=24989

   (5) https://bugs.python.org/issue?@action=redirect&bpo=24913


File: python.info,  Node: Python 3 5 0 release candidate 2,  Next: Python 3 5 0 release candidate 1,  Prev: Python 3 5 0 release candidate 3,  Up: 変更履歴

1.24.111 Python 3.5.0 release candidate 2
-----------------------------------------

'Release date: 2015-08-25'

* Menu:

* Core and Builtins: Core and Builtins<195>.
* ライブラリ: ライブラリ<198>.


File: python.info,  Node: Core and Builtins<195>,  Next: ライブラリ<198>,  Up: Python 3 5 0 release candidate 2

1.24.111.1 Core and Builtins
............................

   - bpo-24769(1): Interpreter now starts properly when dynamic loading
     is disabled.  Patch by Petr Viktorin.

   - bpo-21167(2): NAN operations are now handled correctly when python
     is compiled with ICC even if -fp-model strict is not specified.

   - bpo-24492(3): A "package" lacking a __name__ attribute when trying
     to perform a ‘from .. import ...’ statement will trigger an
     ImportError instead of an AttributeError.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24769

   (2) https://bugs.python.org/issue?@action=redirect&bpo=21167

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24492


File: python.info,  Node: ライブラリ<198>,  Prev: Core and Builtins<195>,  Up: Python 3 5 0 release candidate 2

1.24.111.2 ライブラリ
.....................

   - bpo-24847(1): Removes vcruntime140.dll dependency from Tcl/Tk.

   - bpo-24839(2): platform._syscmd_ver raises DeprecationWarning

   - bpo-24867(3): Fix Task.get_stack() for 'async def' coroutines

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24847

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24839

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24867


File: python.info,  Node: Python 3 5 0 release candidate 1,  Next: Python 3 5 0 beta 4,  Prev: Python 3 5 0 release candidate 2,  Up: 変更履歴

1.24.112 Python 3.5.0 release candidate 1
-----------------------------------------

'Release date: 2015-08-09'

* Menu:

* Core and Builtins: Core and Builtins<196>.
* ライブラリ: ライブラリ<199>.
* IDLE: IDLE<61>.
* ドキュメント: ドキュメント<82>.
* テスト: テスト<83>.


File: python.info,  Node: Core and Builtins<196>,  Next: ライブラリ<199>,  Up: Python 3 5 0 release candidate 1

1.24.112.1 Core and Builtins
............................

   - bpo-24667(1): Resize odict in all cases that the underlying dict
     resizes.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24667


File: python.info,  Node: ライブラリ<199>,  Next: IDLE<61>,  Prev: Core and Builtins<196>,  Up: Python 3 5 0 release candidate 1

1.24.112.2 ライブラリ
.....................

   - bpo-24824(1): Signatures of codecs.encode() and codecs.decode() now
     are compatible with pydoc.

   - bpo-24634(2): Importing uuid should not try to load libc on Windows

   - bpo-24798(3): _msvccompiler.py doesn't properly support manifests

   - bpo-4395(4): Better testing and documentation of binary operators.
     Patch by Martin Panter.

   - bpo-23973(5): Update typing.py from GitHub repo.

   - bpo-23004(6): mock_open() now reads binary data correctly when the
     type of read_data is bytes.  Initial patch by Aaron Hill.

   - bpo-23888(7): Handle fractional time in cookie expiry.  Patch by
     ssh.

   - bpo-23652(8): Make it possible to compile the select module against
     the libc headers from the Linux Standard Base, which do not include
     some EPOLL macros.  Patch by Matt Frank.

   - bpo-22932(9): Fix timezones in email.utils.formatdate.  Patch from
     Dmitry Shachnev.

   - bpo-23779(10): imaplib raises TypeError if authenticator tries to
     abort.  Patch from Craig Holmquist.

   - bpo-23319(11): Fix ctypes.BigEndianStructure, swap correctly bytes.
     Patch written by Matthieu Gautier.

   - bpo-23254(12): Document how to close the TCPServer listening
     socket.  Patch from Martin Panter.

   - bpo-19450(13): Update Windows and OS X installer builds to use
     SQLite 3.8.11.

   - bpo-17527(14): Add PATCH to wsgiref.validator.  Patch from Luca
     Sbardella.

   - bpo-24791(15): Fix grammar regression for call syntax: 'g(*a or
     b)'.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24824

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24634

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24798

   (4) https://bugs.python.org/issue?@action=redirect&bpo=4395

   (5) https://bugs.python.org/issue?@action=redirect&bpo=23973

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23004

   (7) https://bugs.python.org/issue?@action=redirect&bpo=23888

   (8) https://bugs.python.org/issue?@action=redirect&bpo=23652

   (9) https://bugs.python.org/issue?@action=redirect&bpo=22932

   (10) https://bugs.python.org/issue?@action=redirect&bpo=23779

   (11) https://bugs.python.org/issue?@action=redirect&bpo=23319

   (12) https://bugs.python.org/issue?@action=redirect&bpo=23254

   (13) https://bugs.python.org/issue?@action=redirect&bpo=19450

   (14) https://bugs.python.org/issue?@action=redirect&bpo=17527

   (15) https://bugs.python.org/issue?@action=redirect&bpo=24791


File: python.info,  Node: IDLE<61>,  Next: ドキュメント<82>,  Prev: ライブラリ<199>,  Up: Python 3 5 0 release candidate 1

1.24.112.3 IDLE
...............

   - bpo-23672(1): Allow Idle to edit and run files with astral chars in
     name.  Patch by Mohd Sanad Zaki Rizvi.

   - bpo-24745(2): Idle editor default font.  Switch from Courier to
     platform-sensitive TkFixedFont.  This should not affect current
     customized font selections.  If there is a problem, edit
     $HOME/.idlerc/config-main.cfg and remove '‘fontXXX’' entries from
     [Editor Window].  Patch by Mark Roseman.

   - bpo-21192(3): Idle editor.  When a file is run, put its name in the
     restart bar.  Do not print false prompts.  Original patch by Adnan
     Umer.

   - bpo-13884(4): Idle menus.  Remove tearoff lines.  Patch by Roger
     Serwy.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23672

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24745

   (3) https://bugs.python.org/issue?@action=redirect&bpo=21192

   (4) https://bugs.python.org/issue?@action=redirect&bpo=13884


File: python.info,  Node: ドキュメント<82>,  Next: テスト<83>,  Prev: IDLE<61>,  Up: Python 3 5 0 release candidate 1

1.24.112.4 ドキュメント
.......................

   - bpo-24129(1): Clarify the reference documentation for name
     resolution.  This includes removing the assumption that readers
     will be familiar with the name resolution scheme Python used prior
     to the introduction of lexical scoping for function namespaces.
     Patch by Ivan Levkivskyi.

   - bpo-20769(2): Improve reload() docs.  Patch by Dorian Pula.

   - bpo-23589(3): Remove duplicate sentence from the FAQ. Patch by
     Yongzhi Pan.

   - bpo-24729(4): Correct IO tutorial to match implementation regarding
     encoding parameter to open function.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24129

   (2) https://bugs.python.org/issue?@action=redirect&bpo=20769

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23589

   (4) https://bugs.python.org/issue?@action=redirect&bpo=24729


File: python.info,  Node: テスト<83>,  Prev: ドキュメント<82>,  Up: Python 3 5 0 release candidate 1

1.24.112.5 テスト
.................

   - bpo-24751(1): When running regrtest with the ‘-w’ command line
     option, a test run is no longer marked as a failure if all tests
     succeed when re-run.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24751


File: python.info,  Node: Python 3 5 0 beta 4,  Next: Python 3 5 0 beta 3,  Prev: Python 3 5 0 release candidate 1,  Up: 変更履歴

1.24.113 Python 3.5.0 beta 4
----------------------------

'Release date: 2015-07-26'

* Menu:

* Core and Builtins: Core and Builtins<197>.
* ライブラリ: ライブラリ<200>.
* ビルド: ビルド<95>.


File: python.info,  Node: Core and Builtins<197>,  Next: ライブラリ<200>,  Up: Python 3 5 0 beta 4

1.24.113.1 Core and Builtins
............................

   - bpo-23573(1): Restored optimization of bytes.rfind() and
     bytearray.rfind() for single-byte argument on Linux.

   - bpo-24569(2): Make PEP 448(3) dictionary evaluation more
     consistent.

   - bpo-24583(4): Fix crash when set is mutated while being updated.

   - bpo-24407(5): Fix crash when dict is mutated while being updated.

   - bpo-24619(6): New approach for tokenizing async/await.  As a
     consequence, it is now possible to have one-line 'async def foo():
     await ..'  functions.

   - bpo-24687(7): Plug refleak on SyntaxError in function parameters
     annotations.

   - bpo-15944(8): memoryview: Allow arbitrary formats when casting to
     bytes.  Patch by Martin Panter.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23573

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24569

   (3) https://peps.python.org/pep-0448/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=24583

   (5) https://bugs.python.org/issue?@action=redirect&bpo=24407

   (6) https://bugs.python.org/issue?@action=redirect&bpo=24619

   (7) https://bugs.python.org/issue?@action=redirect&bpo=24687

   (8) https://bugs.python.org/issue?@action=redirect&bpo=15944


File: python.info,  Node: ライブラリ<200>,  Next: ビルド<95>,  Prev: Core and Builtins<197>,  Up: Python 3 5 0 beta 4

1.24.113.2 ライブラリ
.....................

   - bpo-23441(1): rcompleter now prints a tab character instead of
     displaying possible completions for an empty word.  Initial patch
     by Martin Sekera.

   - bpo-24683(2): Fixed crashes in _json functions called with
     arguments of inappropriate type.

   - bpo-21697(3): shutil.copytree() now correctly handles symbolic
     links that point to directories.  Patch by Eduardo Seabra and
     Thomas Kluyver.

   - bpo-14373(4): Fixed segmentation fault when gc.collect() is called
     during constructing lru_cache (C implementation).

   - bpo-24695(5): Fix a regression in traceback.print_exception().  If
     exc_traceback is None we shouldn't print a traceback header like
     described in the documentation.

   - bpo-24620(6): Random.setstate() now validates the value of state
     last element.

   - bpo-22485(7): Fixed an issue that caused ‘inspect.getsource’ to
     return incorrect results on nested functions.

   - bpo-22153(8): Improve unittest docs.  Patch from Martin Panter and
     evilzero.

   - bpo-24580(9): Symbolic group references to open group in re
     patterns now are explicitly forbidden as well as numeric group
     references.

   - bpo-24206(10): Fixed __eq__ and __ne__ methods of inspect classes.

   - bpo-24631(11): Fixed regression in the timeit module with multiline
     setup.

   - bpo-18622(12): unittest.mock.mock_open().reset_mock would recurse
     infinitely.  Patch from Nicola Palumbo and Laurent De Buyst.

   - bpo-23661(13): unittest.mock side_effects can now be exceptions
     again.  This was a regression vs Python 3.4.  Patch from Ignacio
     Rossi

   - bpo-24608(14): chunk.Chunk.read() now always returns bytes, not
     str.

   - bpo-18684(15): Fixed reading out of the buffer in the re module.

   - bpo-24259(16): tarfile now raises a ReadError if an archive is
     truncated inside a data segment.

   - bpo-15014(17): SMTP.auth() and SMTP.login() now support RFC 4954's
     optional initial-response argument to the SMTP AUTH command.

   - bpo-24669(18): Fix inspect.getsource() for 'async def' functions.
     Patch by Kai Groner.

   - bpo-24688(19): ast.get_docstring() for 'async def' functions.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23441

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24683

   (3) https://bugs.python.org/issue?@action=redirect&bpo=21697

   (4) https://bugs.python.org/issue?@action=redirect&bpo=14373

   (5) https://bugs.python.org/issue?@action=redirect&bpo=24695

   (6) https://bugs.python.org/issue?@action=redirect&bpo=24620

   (7) https://bugs.python.org/issue?@action=redirect&bpo=22485

   (8) https://bugs.python.org/issue?@action=redirect&bpo=22153

   (9) https://bugs.python.org/issue?@action=redirect&bpo=24580

   (10) https://bugs.python.org/issue?@action=redirect&bpo=24206

   (11) https://bugs.python.org/issue?@action=redirect&bpo=24631

   (12) https://bugs.python.org/issue?@action=redirect&bpo=18622

   (13) https://bugs.python.org/issue?@action=redirect&bpo=23661

   (14) https://bugs.python.org/issue?@action=redirect&bpo=24608

   (15) https://bugs.python.org/issue?@action=redirect&bpo=18684

   (16) https://bugs.python.org/issue?@action=redirect&bpo=24259

   (17) https://bugs.python.org/issue?@action=redirect&bpo=15014

   (18) https://bugs.python.org/issue?@action=redirect&bpo=24669

   (19) https://bugs.python.org/issue?@action=redirect&bpo=24688


File: python.info,  Node: ビルド<95>,  Prev: ライブラリ<200>,  Up: Python 3 5 0 beta 4

1.24.113.3 ビルド
.................

   - bpo-24603(1): Update Windows builds and OS X 10.5 installer to use
     OpenSSL 1.0.2d.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24603


File: python.info,  Node: Python 3 5 0 beta 3,  Next: Python 3 5 0 beta 2,  Prev: Python 3 5 0 beta 4,  Up: 変更履歴

1.24.114 Python 3.5.0 beta 3
----------------------------

'Release date: 2015-07-05'

* Menu:

* Core and Builtins: Core and Builtins<198>.
* ライブラリ: ライブラリ<201>.
* テスト: テスト<84>.
* ドキュメント: ドキュメント<83>.
* ビルド: ビルド<96>.


File: python.info,  Node: Core and Builtins<198>,  Next: ライブラリ<201>,  Up: Python 3 5 0 beta 3

1.24.114.1 Core and Builtins
............................

   - bpo-24467(1): Fixed possible buffer over-read in bytearray.  The
     bytearray object now always allocates place for trailing null byte
     and it's buffer now is always null-terminated.

   - Upgrade to Unicode 8.0.0.

   - bpo-24345(2): Add Py_tp_finalize slot for the stable ABI.

   - bpo-24400(3): Introduce a distinct type for PEP 492(4) coroutines;
     add types.CoroutineType, inspect.getcoroutinestate,
     inspect.getcoroutinelocals; coroutines no longer use CO_GENERATOR
     flag; sys.set_coroutine_wrapper works only for 'async def'
     coroutines; inspect.iscoroutine no longer uses
     collections.abc.Coroutine, it's intended to test for pure 'async
     def' coroutines only; add new opcode: GET_YIELD_FROM_ITER; fix
     generators wrapper used in types.coroutine to be instance of
     collections.abc.Generator; collections.abc.Awaitable and
     collections.abc.Coroutine can no longer be used to detect
     generator-based coroutines-use inspect.isawaitable instead.

   - bpo-24450(5): Add gi_yieldfrom to generators and cr_await to
     coroutines.  Contributed by Benno Leslie and Yury Selivanov.

   - bpo-19235(6): Add new RecursionError exception.  Patch by Georg
     Brandl.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24467

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24345

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24400

   (4) https://peps.python.org/pep-0492/

   (5) https://bugs.python.org/issue?@action=redirect&bpo=24450

   (6) https://bugs.python.org/issue?@action=redirect&bpo=19235


File: python.info,  Node: ライブラリ<201>,  Next: テスト<84>,  Prev: Core and Builtins<198>,  Up: Python 3 5 0 beta 3

1.24.114.2 ライブラリ
.....................

   - bpo-21750(1): mock_open.read_data can now be read from each
     instance, as it could in Python 3.3.

   - bpo-24552(2): Fix use after free in an error case of the _pickle
     module.

   - bpo-24514(3): tarfile now tolerates number fields consisting of
     only whitespace.

   - bpo-19176(4): Fixed doctype() related bugs in C implementation of
     ElementTree.  A deprecation warning no longer issued by XMLParser
     subclass with default doctype() method.  Direct call of doctype()
     now issues a warning.  Parser's doctype() now is not called if
     target's doctype() is called.  Based on patch by Martin Panter.

   - bpo-20387(5): Restore semantic round-trip correctness in
     tokenize/untokenize for tab-indented blocks.

   - bpo-24456(6): Fixed possible buffer over-read in adpcm2lin() and
     lin2adpcm() functions of the audioop module.

   - bpo-24336(7): The contextmanager decorator now works with functions
     with keyword arguments called "func" and "self".  Patch by Martin
     Panter.

   - bpo-24522(8): Fix possible integer overflow in json accelerator
     module.

   - bpo-24489(9): ensure a previously set C errno doesn't disturb
     cmath.polar().

   - bpo-24408(10): Fixed AttributeError in measure() and metrics()
     methods of tkinter.Font.

   - bpo-14373(11): C implementation of functools.lru_cache() now can be
     used with methods.

   - bpo-24347(12): Set KeyError if PyDict_GetItemWithError returns
     NULL.

   - bpo-24348(13): Drop superfluous incref/decref.

   - bpo-24359(14): Check for changed OrderedDict size during iteration.

   - bpo-24368(15): Support keyword arguments in OrderedDict methods.

   - bpo-24362(16): Simplify the C OrderedDict fast nodes resize logic.

   - bpo-24377(17): Fix a ref leak in OrderedDict.__repr__.

   - bpo-24369(18): Defend against key-changes during iteration.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21750

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24552

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24514

   (4) https://bugs.python.org/issue?@action=redirect&bpo=19176

   (5) https://bugs.python.org/issue?@action=redirect&bpo=20387

   (6) https://bugs.python.org/issue?@action=redirect&bpo=24456

   (7) https://bugs.python.org/issue?@action=redirect&bpo=24336

   (8) https://bugs.python.org/issue?@action=redirect&bpo=24522

   (9) https://bugs.python.org/issue?@action=redirect&bpo=24489

   (10) https://bugs.python.org/issue?@action=redirect&bpo=24408

   (11) https://bugs.python.org/issue?@action=redirect&bpo=14373

   (12) https://bugs.python.org/issue?@action=redirect&bpo=24347

   (13) https://bugs.python.org/issue?@action=redirect&bpo=24348

   (14) https://bugs.python.org/issue?@action=redirect&bpo=24359

   (15) https://bugs.python.org/issue?@action=redirect&bpo=24368

   (16) https://bugs.python.org/issue?@action=redirect&bpo=24362

   (17) https://bugs.python.org/issue?@action=redirect&bpo=24377

   (18) https://bugs.python.org/issue?@action=redirect&bpo=24369


File: python.info,  Node: テスト<84>,  Next: ドキュメント<83>,  Prev: ライブラリ<201>,  Up: Python 3 5 0 beta 3

1.24.114.3 テスト
.................

   - bpo-24373(1): _testmultiphase and xxlimited now use tp_traverse and
     tp_finalize to avoid reference leaks encountered when combining
     tp_dealloc with PyType_FromSpec (see bpo-16690(2) for details)

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24373

   (2) https://bugs.python.org/issue?@action=redirect&bpo=16690


File: python.info,  Node: ドキュメント<83>,  Next: ビルド<96>,  Prev: テスト<84>,  Up: Python 3 5 0 beta 3

1.24.114.4 ドキュメント
.......................

   - bpo-24458(1): Update documentation to cover multi-phase
     initialization for extension modules (PEP 489).  Patch by Petr
     Viktorin.

   - bpo-24351(2): Clarify what is meant by "identifier" in the context
     of string.Template instances.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24458

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24351


File: python.info,  Node: ビルド<96>,  Prev: ドキュメント<83>,  Up: Python 3 5 0 beta 3

1.24.114.5 ビルド
.................

   - bpo-24432(1): Update Windows builds and OS X 10.5 installer to use
     OpenSSL 1.0.2c.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24432


File: python.info,  Node: Python 3 5 0 beta 2,  Next: Python 3 5 0 beta 1,  Prev: Python 3 5 0 beta 3,  Up: 変更履歴

1.24.115 Python 3.5.0 beta 2
----------------------------

'Release date: 2015-05-31'

* Menu:

* Core and Builtins: Core and Builtins<199>.
* ライブラリ: ライブラリ<202>.


File: python.info,  Node: Core and Builtins<199>,  Next: ライブラリ<202>,  Up: Python 3 5 0 beta 2

1.24.115.1 Core and Builtins
............................

   - bpo-24284(1): The startswith and endswith methods of the str class
     no longer return True when finding the empty string and the indexes
     are completely out of range.

   - bpo-24115(2): Update uses of PyObject_IsTrue(), PyObject_Not(),
     PyObject_IsInstance(), PyObject_RichCompareBool() and
     _PyDict_Contains() to check for and handle errors correctly.

   - bpo-24328(3): Fix importing one character extension modules.

   - bpo-11205(4): In dictionary displays, evaluate the key before the
     value.

   - bpo-24285(5): Fixed regression that prevented importing extension
     modules from inside packages.  Patch by Petr Viktorin.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24284

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24115

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24328

   (4) https://bugs.python.org/issue?@action=redirect&bpo=11205

   (5) https://bugs.python.org/issue?@action=redirect&bpo=24285


File: python.info,  Node: ライブラリ<202>,  Prev: Core and Builtins<199>,  Up: Python 3 5 0 beta 2

1.24.115.2 ライブラリ
.....................

   - bpo-23247(1): Fix a crash in the StreamWriter.reset() of CJK
     codecs.

   - bpo-24270(2): Add math.isclose() and cmath.isclose() functions as
     per PEP 485(3).  Contributed by Chris Barker and Tal Einat.

   - bpo-5633(4): Fixed timeit when the statement is a string and the
     setup is not.

   - bpo-24326(5): Fixed audioop.ratecv() with non-default weightB
     argument.  Original patch by David Moore.

   - bpo-16991(6): Add a C implementation of OrderedDict.

   - bpo-23934(7): Fix inspect.signature to fail correctly for builtin
     types lacking signature information.  Initial patch by James
     Powell.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23247

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24270

   (3) https://peps.python.org/pep-0485/

   (4) https://bugs.python.org/issue?@action=redirect&bpo=5633

   (5) https://bugs.python.org/issue?@action=redirect&bpo=24326

   (6) https://bugs.python.org/issue?@action=redirect&bpo=16991

   (7) https://bugs.python.org/issue?@action=redirect&bpo=23934


File: python.info,  Node: Python 3 5 0 beta 1,  Next: Python 3 5 0 alpha 4,  Prev: Python 3 5 0 beta 2,  Up: 変更履歴

1.24.116 Python 3.5.0 beta 1
----------------------------

'Release date: 2015-05-24'

* Menu:

* Core and Builtins: Core and Builtins<200>.
* ライブラリ: ライブラリ<203>.
* IDLE: IDLE<62>.
* テスト: テスト<85>.
* ドキュメント: ドキュメント<84>.
* Tools/Demos: Tools/Demos<58>.


File: python.info,  Node: Core and Builtins<200>,  Next: ライブラリ<203>,  Up: Python 3 5 0 beta 1

1.24.116.1 Core and Builtins
............................

   - bpo-24276(1): Fixed optimization of property descriptor getter.

   - bpo-24268(2): PEP 489: Multi-phase extension module initialization.
     Patch by Petr Viktorin.

   - bpo-23955(3): Add pyvenv.cfg option to suppress
     registry/environment lookup for generating sys.path on Windows.

   - bpo-24257(4): Fixed system error in the comparison of faked
     types.SimpleNamespace.

   - bpo-22939(5): Fixed integer overflow in iterator object.  Patch by
     Clement Rouault.

   - bpo-23985(6): Fix a possible buffer overrun when deleting a slice
     from the front of a bytearray and then appending some other bytes
     data.

   - bpo-24102(7): Fixed exception type checking in standard error
     handlers.

   - bpo-15027(8): The UTF-32 encoder is now 3x to 7x faster.

   - bpo-23290(9): Optimize set_merge() for cases where the target is
     empty.  (Contributed by Serhiy Storchaka.)

   - bpo-2292(10): PEP 448: Additional Unpacking Generalizations.

   - bpo-24096(11): Make warnings.warn_explicit more robust against
     mutation of the warnings.filters list.

   - bpo-23996(12): Avoid a crash when a delegated generator raises an
     unnormalized StopIteration exception.  Patch by Stefan Behnel.

   - bpo-23910(13): Optimize property() getter calls.  Patch by Joe
     Jevnik.

   - bpo-23911(14): Move path-based importlib bootstrap code to a
     separate frozen module.

   - bpo-24192(15): Fix namespace package imports.

   - bpo-24022(16): Fix tokenizer crash when processing undecodable
     source code.

   - bpo-9951(17): Added a hex() method to bytes, bytearray, and
     memoryview.

   - bpo-22906(18): PEP 479: Change StopIteration handling inside
     generators.

   - bpo-24017(19): PEP 492: Coroutines with async and await syntax.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24276

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24268

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23955

   (4) https://bugs.python.org/issue?@action=redirect&bpo=24257

   (5) https://bugs.python.org/issue?@action=redirect&bpo=22939

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23985

   (7) https://bugs.python.org/issue?@action=redirect&bpo=24102

   (8) https://bugs.python.org/issue?@action=redirect&bpo=15027

   (9) https://bugs.python.org/issue?@action=redirect&bpo=23290

   (10) https://bugs.python.org/issue?@action=redirect&bpo=2292

   (11) https://bugs.python.org/issue?@action=redirect&bpo=24096

   (12) https://bugs.python.org/issue?@action=redirect&bpo=23996

   (13) https://bugs.python.org/issue?@action=redirect&bpo=23910

   (14) https://bugs.python.org/issue?@action=redirect&bpo=23911

   (15) https://bugs.python.org/issue?@action=redirect&bpo=24192

   (16) https://bugs.python.org/issue?@action=redirect&bpo=24022

   (17) https://bugs.python.org/issue?@action=redirect&bpo=9951

   (18) https://bugs.python.org/issue?@action=redirect&bpo=22906

   (19) https://bugs.python.org/issue?@action=redirect&bpo=24017


File: python.info,  Node: ライブラリ<203>,  Next: IDLE<62>,  Prev: Core and Builtins<200>,  Up: Python 3 5 0 beta 1

1.24.116.2 ライブラリ
.....................

   - bpo-14373(1): Added C implementation of functools.lru_cache().
     Based on patches by Matt Joiner and Alexey Kachayev.

   - bpo-24230(2): The tempfile module now accepts bytes for prefix,
     suffix and dir parameters and returns bytes in such situations
     (matching the os module APIs).

   - bpo-22189(3): collections.UserString now supports __getnewargs__(),
     __rmod__(), casefold(), format_map(), isprintable(), and
     maketrans().  Patch by Joe Jevnik.

   - bpo-24244(4): Prevents termination when an invalid format string is
     encountered on Windows in strftime.

   - bpo-23973(5): PEP 484: Add the typing module.

   - bpo-23086(6): The collections.abc.Sequence() abstract base class
     added 'start' and 'stop' parameters to the index() mixin.  Patch by
     Devin Jeanpierre.

   - bpo-20035(7): Replaced the ‘tkinter._fix’ module used for setting
     up the Tcl/Tk environment on Windows with a private function in the
     ‘_tkinter’ module that makes no permanent changes to the
     environment.

   - bpo-24257(8): Fixed segmentation fault in sqlite3.Row constructor
     with faked cursor type.

   - bpo-15836(9): assertRaises(), assertRaisesRegex(), assertWarns()
     and assertWarnsRegex() assertments now check the type of the first
     argument to prevent possible user error.  Based on patch by Daniel
     Wagner-Hall.

   - bpo-9858(10): Add missing method stubs to _io.RawIOBase.  Patch by
     Laura Rupprecht.

   - bpo-22955(11): attrgetter, itemgetter and methodcaller objects in
     the operator module now support pickling.  Added readable and
     evaluable repr for these objects.  Based on patch by Josh
     Rosenberg.

   - bpo-22107(12): tempfile.gettempdir() and tempfile.mkdtemp() now try
     again when a directory with the chosen name already exists on
     Windows as well as on Unix.  tempfile.mkstemp() now fails early if
     parent directory is not valid (not exists or is a file) on Windows.

   - bpo-23780(13): Improved error message in os.path.join() with single
     argument.

   - bpo-6598(14): Increased time precision and random number range in
     email.utils.make_msgid() to strengthen the uniqueness of the
     message ID.

   - bpo-24091(15): Fixed various crashes in corner cases in C
     implementation of ElementTree.

   - bpo-21931(16): msilib.FCICreate() now raises TypeError in the case
     of a bad argument instead of a ValueError with a bogus FCI error
     number.  Patch by Jeffrey Armstrong.

   - bpo-13866(17): 'quote_via' argument added to
     urllib.parse.urlencode.

   - bpo-20098(18): New mangle_from policy option for email, default
     True for compat32, but False for all other policies.

   - bpo-24211(19): The email library now supports RFC 6532: it can
     generate headers using utf-8 instead of encoded words.

   - bpo-16314(20): Added support for the LZMA compression in distutils.

   - bpo-21804(21): poplib now supports RFC 6856 (UTF8).

   - bpo-18682(22): Optimized pprint functions for builtin scalar types.

   - bpo-22027(23): smtplib now supports RFC 6531 (SMTPUTF8).

   - bpo-23488(24): Random generator objects now consume 2x less memory
     on 64-bit.

   - bpo-1322(25): platform.dist() and platform.linux_distribution()
     functions are now deprecated.  Initial patch by Vajrasky Kok.

   - bpo-22486(26): Added the math.gcd() function.  The fractions.gcd()
     function now is deprecated.  Based on patch by Mark Dickinson.

   - bpo-24064(27): Property() docstrings are now writeable.  (Patch by
     Berker Peksag.)

   - bpo-22681(28): Added support for the koi8_t encoding.

   - bpo-22682(29): Added support for the kz1048 encoding.

   - bpo-23796(30): peek and read1 methods of BufferedReader now raise
     ValueError if they called on a closed object.  Patch by John
     Hergenroeder.

   - bpo-21795(31): smtpd now supports the 8BITMIME extension whenever
     the new 'decode_data' constructor argument is set to False.

   - bpo-24155(32): optimize heapq.heapify() for better cache
     performance when heapifying large lists.

   - bpo-21800(33): imaplib now supports RFC 5161 (enable), RFC 6855
     (utf8/internationalized email) and automatically encodes non-ASCII
     usernames and passwords to UTF8.

   - bpo-20274(34): When calling a _sqlite.Connection, it now complains
     if passed any keyword arguments.  Previously it silently ignored
     them.

   - bpo-20274(35): Remove ignored and erroneous "kwargs" parameters
     from three METH_VARARGS methods on _sqlite.Connection.

   - bpo-24134(36): assertRaises(), assertRaisesRegex(), assertWarns()
     and assertWarnsRegex() checks now emits a deprecation warning when
     callable is None or keyword arguments except msg is passed in the
     context manager mode.

   - bpo-24018(37): Add a collections.abc.Generator abstract base class.
     Contributed by Stefan Behnel.

   - bpo-23880(38): Tkinter's getint() and getdouble() now support
     Tcl_Obj.  Tkinter's getdouble() now supports any numbers (in
     particular int).

   - bpo-22619(39): Added negative limit support in the traceback
     module.  Based on patch by Dmitry Kazakov.

   - bpo-24094(40): Fix possible crash in json.encode with poorly
     behaved dict subclasses.

   - bpo-9246(41): On POSIX, os.getcwd() now supports paths longer than
     1025 bytes.  Patch written by William Orr.

   - bpo-17445(42): add difflib.diff_bytes() to support comparison of
     byte strings (fixes a regression from Python 2).

   - bpo-23917(43): Fall back to sequential compilation when
     ProcessPoolExecutor doesn't exist.  Patch by Claudiu Popa.

   - bpo-23008(44): Fixed resolving attributes with boolean value is
     False in pydoc.

   - Fix asyncio issue 235: LifoQueue and PriorityQueue's put didn't
     increment unfinished tasks (this bug was introduced when
     JoinableQueue was merged with Queue).

   - bpo-23908(45): os functions now reject paths with embedded null
     character on Windows instead of silently truncating them.

   - bpo-23728(46): binascii.crc_hqx() could return an integer outside
     of the range 0-0xffff for empty data.

   - bpo-23887(47): urllib.error.HTTPError now has a proper repr()
     representation.  Patch by Berker Peksag.

   - asyncio: New event loop APIs: set_task_factory() and
     get_task_factory().

   - asyncio: async() function is deprecated in favour of
     ensure_future().

   - bpo-24178(48): asyncio.Lock, Condition, Semaphore, and
     BoundedSemaphore support new 'async with' syntax.  Contributed by
     Yury Selivanov.

   - bpo-24179(49): Support 'async for' for asyncio.StreamReader.
     Contributed by Yury Selivanov.

   - bpo-24184(50): Add AsyncIterator and AsyncIterable ABCs to
     collections.abc.  Contributed by Yury Selivanov.

   - bpo-22547(51): Implement informative __repr__ for
     inspect.BoundArguments.  Contributed by Yury Selivanov.

   - bpo-24190(52): Implement inspect.BoundArgument.apply_defaults()
     method.  Contributed by Yury Selivanov.

   - bpo-20691(53): Add 'follow_wrapped' argument to
     inspect.Signature.from_callable() and inspect.signature().
     Contributed by Yury Selivanov.

   - bpo-24248(54): Deprecate inspect.Signature.from_function() and
     inspect.Signature.from_builtin().

   - bpo-23898(55): Fix inspect.classify_class_attrs() to support
     attributes with overloaded __eq__ and __bool__.  Patch by Mike
     Bayer.

   - bpo-24298(56): Fix inspect.signature() to correctly unwrap wrappers
     around bound methods.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14373

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24230

   (3) https://bugs.python.org/issue?@action=redirect&bpo=22189

   (4) https://bugs.python.org/issue?@action=redirect&bpo=24244

   (5) https://bugs.python.org/issue?@action=redirect&bpo=23973

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23086

   (7) https://bugs.python.org/issue?@action=redirect&bpo=20035

   (8) https://bugs.python.org/issue?@action=redirect&bpo=24257

   (9) https://bugs.python.org/issue?@action=redirect&bpo=15836

   (10) https://bugs.python.org/issue?@action=redirect&bpo=9858

   (11) https://bugs.python.org/issue?@action=redirect&bpo=22955

   (12) https://bugs.python.org/issue?@action=redirect&bpo=22107

   (13) https://bugs.python.org/issue?@action=redirect&bpo=23780

   (14) https://bugs.python.org/issue?@action=redirect&bpo=6598

   (15) https://bugs.python.org/issue?@action=redirect&bpo=24091

   (16) https://bugs.python.org/issue?@action=redirect&bpo=21931

   (17) https://bugs.python.org/issue?@action=redirect&bpo=13866

   (18) https://bugs.python.org/issue?@action=redirect&bpo=20098

   (19) https://bugs.python.org/issue?@action=redirect&bpo=24211

   (20) https://bugs.python.org/issue?@action=redirect&bpo=16314

   (21) https://bugs.python.org/issue?@action=redirect&bpo=21804

   (22) https://bugs.python.org/issue?@action=redirect&bpo=18682

   (23) https://bugs.python.org/issue?@action=redirect&bpo=22027

   (24) https://bugs.python.org/issue?@action=redirect&bpo=23488

   (25) https://bugs.python.org/issue?@action=redirect&bpo=1322

   (26) https://bugs.python.org/issue?@action=redirect&bpo=22486

   (27) https://bugs.python.org/issue?@action=redirect&bpo=24064

   (28) https://bugs.python.org/issue?@action=redirect&bpo=22681

   (29) https://bugs.python.org/issue?@action=redirect&bpo=22682

   (30) https://bugs.python.org/issue?@action=redirect&bpo=23796

   (31) https://bugs.python.org/issue?@action=redirect&bpo=21795

   (32) https://bugs.python.org/issue?@action=redirect&bpo=24155

   (33) https://bugs.python.org/issue?@action=redirect&bpo=21800

   (34) https://bugs.python.org/issue?@action=redirect&bpo=20274

   (35) https://bugs.python.org/issue?@action=redirect&bpo=20274

   (36) https://bugs.python.org/issue?@action=redirect&bpo=24134

   (37) https://bugs.python.org/issue?@action=redirect&bpo=24018

   (38) https://bugs.python.org/issue?@action=redirect&bpo=23880

   (39) https://bugs.python.org/issue?@action=redirect&bpo=22619

   (40) https://bugs.python.org/issue?@action=redirect&bpo=24094

   (41) https://bugs.python.org/issue?@action=redirect&bpo=9246

   (42) https://bugs.python.org/issue?@action=redirect&bpo=17445

   (43) https://bugs.python.org/issue?@action=redirect&bpo=23917

   (44) https://bugs.python.org/issue?@action=redirect&bpo=23008

   (45) https://bugs.python.org/issue?@action=redirect&bpo=23908

   (46) https://bugs.python.org/issue?@action=redirect&bpo=23728

   (47) https://bugs.python.org/issue?@action=redirect&bpo=23887

   (48) https://bugs.python.org/issue?@action=redirect&bpo=24178

   (49) https://bugs.python.org/issue?@action=redirect&bpo=24179

   (50) https://bugs.python.org/issue?@action=redirect&bpo=24184

   (51) https://bugs.python.org/issue?@action=redirect&bpo=22547

   (52) https://bugs.python.org/issue?@action=redirect&bpo=24190

   (53) https://bugs.python.org/issue?@action=redirect&bpo=20691

   (54) https://bugs.python.org/issue?@action=redirect&bpo=24248

   (55) https://bugs.python.org/issue?@action=redirect&bpo=23898

   (56) https://bugs.python.org/issue?@action=redirect&bpo=24298


File: python.info,  Node: IDLE<62>,  Next: テスト<85>,  Prev: ライブラリ<203>,  Up: Python 3 5 0 beta 1

1.24.116.3 IDLE
...............

   - bpo-23184(1): remove unused names and imports in idlelib.  Initial
     patch by Al Sweigart.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23184


File: python.info,  Node: テスト<85>,  Next: ドキュメント<84>,  Prev: IDLE<62>,  Up: Python 3 5 0 beta 1

1.24.116.4 テスト
.................

   - bpo-21520(1): test_zipfile no longer fails if the word 'bad'
     appears anywhere in the name of the current directory.

   - bpo-9517(2): Move script_helper into the support package.  Patch by
     Christie Wilson.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=21520

   (2) https://bugs.python.org/issue?@action=redirect&bpo=9517


File: python.info,  Node: ドキュメント<84>,  Next: Tools/Demos<58>,  Prev: テスト<85>,  Up: Python 3 5 0 beta 1

1.24.116.5 ドキュメント
.......................

   - bpo-22155(1): Add File Handlers subsection with createfilehandler
     to tkinter doc.  Remove obsolete example from FAQ. Patch by Martin
     Panter.

   - bpo-24029(2): Document the name binding behavior for submodule
     imports.

   - bpo-24077(3): Fix typo in man page for -I command option: -s, not
     -S

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22155

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24029

   (3) https://bugs.python.org/issue?@action=redirect&bpo=24077


File: python.info,  Node: Tools/Demos<58>,  Prev: ドキュメント<84>,  Up: Python 3 5 0 beta 1

1.24.116.6 Tools/Demos
......................

   - bpo-24000(1): Improved Argument Clinic's mapping of converters to
     legacy "format units".  Updated the documentation to match.

   - bpo-24001(2): Argument Clinic converters now use accept={type}
     instead of types={'type'} to specify the types the converter
     accepts.

   - bpo-23330(3): h2py now supports arbitrary filenames in #include.

   - bpo-24031(4): make patchcheck now supports git checkouts, too.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=24000

   (2) https://bugs.python.org/issue?@action=redirect&bpo=24001

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23330

   (4) https://bugs.python.org/issue?@action=redirect&bpo=24031


File: python.info,  Node: Python 3 5 0 alpha 4,  Next: Python 3 5 0 alpha 3,  Prev: Python 3 5 0 beta 1,  Up: 変更履歴

1.24.117 Python 3.5.0 alpha 4
-----------------------------

'Release date: 2015-04-19'

* Menu:

* Core and Builtins: Core and Builtins<201>.
* ライブラリ: ライブラリ<204>.
* ビルド: ビルド<97>.
* テスト: テスト<86>.
* Tools/Demos: Tools/Demos<59>.
* C API: C API<77>.


File: python.info,  Node: Core and Builtins<201>,  Next: ライブラリ<204>,  Up: Python 3 5 0 alpha 4

1.24.117.1 Core and Builtins
............................

   - bpo-22980(1): Under Linux, GNU/KFreeBSD and the Hurd, C extensions
     now include the architecture triplet in the extension name, to make
     it easy to test builds for different ABIs in the same working tree.
     Under OS X, the extension name now includes PEP 3149(2)-style
     information.

   - bpo-22631(3): Added Linux-specific socket constant
     CAN_RAW_FD_FRAMES. Patch courtesy of Joe Jevnik.

   - bpo-23731(4): Implement PEP 488(5): removal of .pyo files.

   - bpo-23726(6): Don't enable GC for user subclasses of non-GC types
     that don't add any new fields.  Patch by Eugene Toder.

   - bpo-23309(7): Avoid a deadlock at shutdown if a daemon thread is
     aborted while it is holding a lock to a buffered I/O object, and
     the main thread tries to use the same I/O object (typically stdout
     or stderr).  A fatal error is emitted instead.

   - bpo-22977(8): Fixed formatting Windows error messages on Wine.
     Patch by Martin Panter.

   - bpo-23466(9): %c, %o, %x, and %X in bytes formatting now raise
     TypeError on non-integer input.

   - bpo-24044(10): Fix possible null pointer dereference in list.sort
     in out of memory conditions.

   - bpo-21354(11): PyCFunction_New function is exposed by python DLL
     again.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22980

   (2) https://peps.python.org/pep-3149/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=22631

   (4) https://bugs.python.org/issue?@action=redirect&bpo=23731

   (5) https://peps.python.org/pep-0488/

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23726

   (7) https://bugs.python.org/issue?@action=redirect&bpo=23309

   (8) https://bugs.python.org/issue?@action=redirect&bpo=22977

   (9) https://bugs.python.org/issue?@action=redirect&bpo=23466

   (10) https://bugs.python.org/issue?@action=redirect&bpo=24044

   (11) https://bugs.python.org/issue?@action=redirect&bpo=21354


File: python.info,  Node: ライブラリ<204>,  Next: ビルド<97>,  Prev: Core and Builtins<201>,  Up: Python 3 5 0 alpha 4

1.24.117.2 ライブラリ
.....................

   - bpo-23840(1): tokenize.open() now closes the temporary binary file
     on error to fix a resource warning.

   - bpo-16914(2): new debuglevel 2 in smtplib adds timestamps to debug
     output.

   - bpo-7159(3): urllib.request now supports sending auth credentials
     automatically after the first 401.  This enhancement is a superset
     of the enhancement from bpo-19494(4) and supersedes that change.

   - bpo-23703(5): Fix a regression in urljoin() introduced in
     901e4e52b20a.  Patch by Demian Brecht.

   - bpo-4254(6): Adds _curses.update_lines_cols().  Patch by Arnon
     Yaari

   - bpo-19933(7): Provide default argument for ndigits in round.  Patch
     by Vajrasky Kok.

   - bpo-23193(8): Add a numeric_owner parameter to
     tarfile.TarFile.extract and tarfile.TarFile.extractall.  Patch by
     Michael Vogt and Eric Smith.

   - bpo-23342(9): Add a subprocess.run() function than returns a
     CalledProcess instance for a more consistent API than the existing
     call* functions.

   - bpo-21217(10): inspect.getsourcelines() now tries to compute the
     start and end lines from the code object, fixing an issue when a
     lambda function is used as decorator argument.  Patch by Thomas
     Ballinger and Allison Kaptur.

   - bpo-24521(11): Fix possible integer overflows in the pickle module.

   - bpo-22931(12): Allow '[' and ']' in cookie values.

   - The keywords attribute of functools.partial is now always a
     dictionary.

   - bpo-23811(13): Add missing newline to the PyCompileError error
     message.  Patch by Alex Shkop.

   - bpo-21116(14): Avoid blowing memory when allocating a
     multiprocessing shared array that's larger than 50% of the
     available RAM. Patch by Médéric Boquien.

   - bpo-22982(15): Improve BOM handling when seeking to multiple
     positions of a writable text file.

   - bpo-23464(16): Removed deprecated asyncio JoinableQueue.

   - bpo-23529(17): Limit the size of decompressed data when reading
     from GzipFile, BZ2File or LZMAFile.  This defeats denial of service
     attacks using compressed bombs (i.e.  compressed payloads which
     decompress to a huge size).  Patch by Martin Panter and Nikolaus
     Rath.

   - bpo-21859(18): Added Python implementation of io.FileIO.

   - bpo-23865(19): close() methods in multiple modules now are
     idempotent and more robust at shutdown.  If they need to release
     multiple resources, all are released even if errors occur.

   - bpo-23400(20): Raise same exception on both Python 2 and 3 if
     sem_open is not available.  Patch by Davin Potts.

   - bpo-10838(21): The subprocess now module includes SubprocessError
     and TimeoutError in its list of exported names for the users wild
     enough to use ‘from subprocess import *’.

   - bpo-23411(22): Added DefragResult, ParseResult, SplitResult,
     DefragResultBytes, ParseResultBytes, and SplitResultBytes to
     urllib.parse.__all__.  Patch by Martin Panter.

   - bpo-23881(23): urllib.request.ftpwrapper constructor now closes the
     socket if the FTP connection failed to fix a ResourceWarning.

   - bpo-23853(24): *note socket.socket.sendall(): fa8. does no more
     reset the socket timeout each time data is sent successfully.  The
     socket timeout is now the maximum total duration to send all data.

   - bpo-22721(25): An order of multiline pprint output of set or dict
     containing orderable and non-orderable elements no longer depends
     on iteration order of set or dict.

   - bpo-15133(26): _tkinter.tkapp.getboolean() now supports Tcl_Obj and
     always returns bool.  tkinter.BooleanVar now validates input values
     (accepted bool, int, str, and Tcl_Obj).  tkinter.BooleanVar.get()
     now always returns bool.

   - bpo-10590(27): xml.sax.parseString() now supports string argument.

   - bpo-23338(28): Fixed formatting ctypes error messages on Cygwin.
     Patch by Makoto Kato.

   - bpo-15582(29): inspect.getdoc() now follows inheritance chains.

   - bpo-2175(30): SAX parsers now support a character stream of
     InputSource object.

   - bpo-16840(31): Tkinter now supports 64-bit integers added in Tcl
     8.4 and arbitrary precision integers added in Tcl 8.5.

   - bpo-23834(32): Fix socket.sendto(), use the C Py_ssize_t type to
     store the result of sendto() instead of the C int type.

   - bpo-23618(33): *note socket.socket.connect(): fa3. now waits until
     the connection completes instead of raising *note InterruptedError:
     f88. if the connection is interrupted by signals, signal handlers
     don't raise an exception and the socket is blocking or has a
     timeout.  *note socket.socket.connect(): fa3. still raise *note
     InterruptedError: f88. for non-blocking sockets.

   - bpo-21526(34): Tkinter now supports new boolean type in Tcl 8.5.

   - bpo-23836(35): Fix the faulthandler module to handle reentrant
     calls to its signal handlers.

   - bpo-23838(36): linecache now clears the cache and returns an empty
     result on MemoryError.

   - bpo-10395(37): Added os.path.commonpath().  Implemented in
     posixpath and ntpath.  Based on patch by Rafik Draoui.

   - bpo-23611(38): Serializing more "lookupable" objects (such as
     unbound methods or nested classes) now are supported with pickle
     protocols < 4.

   - bpo-13583(39): sqlite3.Row now supports slice indexing.

   - bpo-18473(40): Fixed 2to3 and 3to2 compatible pickle mappings.
     Fixed ambiguous reverse mappings.  Added many new mappings.  Import
     mapping is no longer applied to modules already mapped with full
     name mapping.

   - bpo-23485(41): select.select() is now retried automatically with
     the recomputed timeout when interrupted by a signal, except if the
     signal handler raises an exception.  This change is part of the PEP
     475(42).

   - bpo-23752(43): When built from an existing file descriptor,
     io.FileIO() now only calls fstat() once.  Before fstat() was called
     twice, which was not necessary.

   - bpo-23704(44): collections.deque() objects now support __add__,
     __mul__, and __imul__().

   - bpo-23171(45): csv.Writer.writerow() now supports arbitrary
     iterables.

   - bpo-23745(46): The new email header parser now handles duplicate
     MIME parameter names without error, similar to how get_param
     behaves.

   - bpo-22117(47): Fix os.utime(), it now rounds the timestamp towards
     minus infinity (-inf) instead of rounding towards zero.

   - bpo-23310(48): Fix MagicMock's initializer to work with
     __methods__, just like configure_mock().  Patch by Kasia Jachim.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23840

   (2) https://bugs.python.org/issue?@action=redirect&bpo=16914

   (3) https://bugs.python.org/issue?@action=redirect&bpo=7159

   (4) https://bugs.python.org/issue?@action=redirect&bpo=19494

   (5) https://bugs.python.org/issue?@action=redirect&bpo=23703

   (6) https://bugs.python.org/issue?@action=redirect&bpo=4254

   (7) https://bugs.python.org/issue?@action=redirect&bpo=19933

   (8) https://bugs.python.org/issue?@action=redirect&bpo=23193

   (9) https://bugs.python.org/issue?@action=redirect&bpo=23342

   (10) https://bugs.python.org/issue?@action=redirect&bpo=21217

   (11) https://bugs.python.org/issue?@action=redirect&bpo=24521

   (12) https://bugs.python.org/issue?@action=redirect&bpo=22931

   (13) https://bugs.python.org/issue?@action=redirect&bpo=23811

   (14) https://bugs.python.org/issue?@action=redirect&bpo=21116

   (15) https://bugs.python.org/issue?@action=redirect&bpo=22982

   (16) https://bugs.python.org/issue?@action=redirect&bpo=23464

   (17) https://bugs.python.org/issue?@action=redirect&bpo=23529

   (18) https://bugs.python.org/issue?@action=redirect&bpo=21859

   (19) https://bugs.python.org/issue?@action=redirect&bpo=23865

   (20) https://bugs.python.org/issue?@action=redirect&bpo=23400

   (21) https://bugs.python.org/issue?@action=redirect&bpo=10838

   (22) https://bugs.python.org/issue?@action=redirect&bpo=23411

   (23) https://bugs.python.org/issue?@action=redirect&bpo=23881

   (24) https://bugs.python.org/issue?@action=redirect&bpo=23853

   (25) https://bugs.python.org/issue?@action=redirect&bpo=22721

   (26) https://bugs.python.org/issue?@action=redirect&bpo=15133

   (27) https://bugs.python.org/issue?@action=redirect&bpo=10590

   (28) https://bugs.python.org/issue?@action=redirect&bpo=23338

   (29) https://bugs.python.org/issue?@action=redirect&bpo=15582

   (30) https://bugs.python.org/issue?@action=redirect&bpo=2175

   (31) https://bugs.python.org/issue?@action=redirect&bpo=16840

   (32) https://bugs.python.org/issue?@action=redirect&bpo=23834

   (33) https://bugs.python.org/issue?@action=redirect&bpo=23618

   (34) https://bugs.python.org/issue?@action=redirect&bpo=21526

   (35) https://bugs.python.org/issue?@action=redirect&bpo=23836

   (36) https://bugs.python.org/issue?@action=redirect&bpo=23838

   (37) https://bugs.python.org/issue?@action=redirect&bpo=10395

   (38) https://bugs.python.org/issue?@action=redirect&bpo=23611

   (39) https://bugs.python.org/issue?@action=redirect&bpo=13583

   (40) https://bugs.python.org/issue?@action=redirect&bpo=18473

   (41) https://bugs.python.org/issue?@action=redirect&bpo=23485

   (42) https://peps.python.org/pep-0475/

   (43) https://bugs.python.org/issue?@action=redirect&bpo=23752

   (44) https://bugs.python.org/issue?@action=redirect&bpo=23704

   (45) https://bugs.python.org/issue?@action=redirect&bpo=23171

   (46) https://bugs.python.org/issue?@action=redirect&bpo=23745

   (47) https://bugs.python.org/issue?@action=redirect&bpo=22117

   (48) https://bugs.python.org/issue?@action=redirect&bpo=23310


File: python.info,  Node: ビルド<97>,  Next: テスト<86>,  Prev: ライブラリ<204>,  Up: Python 3 5 0 alpha 4

1.24.117.3 ビルド
.................

   - bpo-23817(1): FreeBSD now uses "1.0" in the SOVERSION as other
     operating systems, instead of just "1".

   - bpo-23501(2): Argument Clinic now generates code into separate
     files by default.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23817

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23501


File: python.info,  Node: テスト<86>,  Next: Tools/Demos<59>,  Prev: ビルド<97>,  Up: Python 3 5 0 alpha 4

1.24.117.4 テスト
.................

   - bpo-23799(1): Added test.support.start_threads() for running and
     cleaning up multiple threads.

   - bpo-22390(2): test.regrtest now emits a warning if temporary files
     or directories are left after running a test.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23799

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22390


File: python.info,  Node: Tools/Demos<59>,  Next: C API<77>,  Prev: テスト<86>,  Up: Python 3 5 0 alpha 4

1.24.117.5 Tools/Demos
......................

   - bpo-18128(1): pygettext now uses standard +NNNN format in the
     POT-Creation-Date header.

   - bpo-23935(2): Argument Clinic's understanding of format units
     accepting bytes, bytearrays, and buffers is now consistent with
     both the documentation and the implementation.

   - bpo-23944(3): Argument Clinic now wraps long impl prototypes at
     column 78.

   - bpo-20586(4): Argument Clinic now ensures that functions without
     docstrings have signatures.

   - bpo-23492(5): Argument Clinic now generates argument parsing code
     with PyArg_Parse instead of PyArg_ParseTuple if possible.

   - bpo-23500(6): Argument Clinic is now smarter about generating the
     "#ifndef" (empty) definition of the methoddef macro: it's only
     generated once, even if Argument Clinic processes the same symbol
     multiple times, and it's emitted at the end of all processing
     rather than immediately after the first use.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18128

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23935

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23944

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20586

   (5) https://bugs.python.org/issue?@action=redirect&bpo=23492

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23500


File: python.info,  Node: C API<77>,  Prev: Tools/Demos<59>,  Up: Python 3 5 0 alpha 4

1.24.117.6 C API
................

   - bpo-23998(1): PyImport_ReInitLock() now checks for lock allocation
     error

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23998


File: python.info,  Node: Python 3 5 0 alpha 3,  Next: Python 3 5 0 alpha 2,  Prev: Python 3 5 0 alpha 4,  Up: 変更履歴

1.24.118 Python 3.5.0 alpha 3
-----------------------------

'Release date: 2015-03-28'

* Menu:

* Core and Builtins: Core and Builtins<202>.
* ライブラリ: ライブラリ<205>.
* ビルド: ビルド<98>.
* テスト: テスト<87>.
* Tools/Demos: Tools/Demos<60>.


File: python.info,  Node: Core and Builtins<202>,  Next: ライブラリ<205>,  Up: Python 3 5 0 alpha 3

1.24.118.1 Core and Builtins
............................

   - bpo-23573(1): Increased performance of string search operations
     (str.find, str.index, str.count, the in operator, str.split,
     str.partition) with arguments of different kinds (UCS1, UCS2,
     UCS4).

   - bpo-23753(2): Python doesn't support anymore platforms without
     stat() or fstat(), these functions are always required.

   - bpo-23681(3): The -b option now affects comparisons of bytes with
     int.

   - bpo-23632(4): Memoryviews now allow tuple indexing (including for
     multi-dimensional memoryviews).

   - bpo-23192(5): Fixed generator lambdas.  Patch by Bruno Cauet.

   - bpo-23629(6): Fix the default __sizeof__ implementation for
     variable-sized objects.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23573

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23753

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23681

   (4) https://bugs.python.org/issue?@action=redirect&bpo=23632

   (5) https://bugs.python.org/issue?@action=redirect&bpo=23192

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23629


File: python.info,  Node: ライブラリ<205>,  Next: ビルド<98>,  Prev: Core and Builtins<202>,  Up: Python 3 5 0 alpha 3

1.24.118.2 ライブラリ
.....................

   - bpo-14260(1): The groupindex attribute of regular expression
     pattern object now is non-modifiable mapping.

   - bpo-23792(2): Ignore KeyboardInterrupt when the pydoc pager is
     active.  This mimics the behavior of the standard unix pagers, and
     prevents pipepager from shutting down while the pager itself is
     still running.

   - bpo-23775(3): pprint() of OrderedDict now outputs the same
     representation as repr().

   - bpo-23765(4): Removed IsBadStringPtr calls in ctypes

   - bpo-22364(5): Improved some re error messages using regex for
     hints.

   - bpo-23742(6): ntpath.expandvars() no longer loses unbalanced single
     quotes.

   - bpo-21717(7): The zipfile.ZipFile.open function now supports 'x'
     (exclusive creation) mode.

   - bpo-21802(8): The reader in BufferedRWPair now is closed even when
     closing writer failed in BufferedRWPair.close().

   - bpo-23622(9): Unknown escapes in regular expressions that consist
     of ‘'\'’ and ASCII letter now raise a deprecation warning and will
     be forbidden in Python 3.6.

   - bpo-23671(10): string.Template now allows specifying the "self"
     parameter as a keyword argument.  string.Formatter now allows
     specifying the "self" and the "format_string" parameters as keyword
     arguments.

   - bpo-23502(11): The pprint module now supports mapping proxies.

   - bpo-17530(12): pprint now wraps long bytes objects and bytearrays.

   - bpo-22687(13): Fixed some corner cases in breaking words in
     tetxtwrap.  Got rid of quadratic complexity in breaking long words.

   - bpo-4727(14): The copy module now uses pickle protocol 4 (PEP 3154)
     and supports copying of instances of classes whose __new__ method
     takes keyword-only arguments.

   - bpo-23491(15): Added a zipapp module to support creating executable
     zip file archives of Python code.  Registered ".pyz" and ".pyzw"
     extensions on Windows for these archives (PEP 441).

   - bpo-23657(16): Avoid explicit checks for str in zipapp, adding
     support for pathlib.Path objects as arguments.

   - bpo-23688(17): Added support of arbitrary bytes-like objects and
     avoided unnecessary copying of memoryview in gzip.GzipFile.write().
     Original patch by Wolfgang Maier.

   - bpo-23252(18): Added support for writing ZIP files to unseekable
     streams.

   - bpo-23647(19): Increase imaplib's MAXLINE to accommodate modern
     mailbox sizes.

   - bpo-23539(20): If body is None, http.client.HTTPConnection.request
     now sets Content-Length to 0 for PUT, POST, and PATCH headers to
     avoid 411 errors from some web servers.

   - bpo-22351(21): The nntplib.NNTP constructor no longer leaves the
     connection and socket open until the garbage collector cleans them
     up.  Patch by Martin Panter.

   - bpo-23704(22): collections.deque() objects now support methods for
     index(), insert(), and copy().  This allows deques to be registered
     as a MutableSequence and it improves their substitutability for
     lists.

   - bpo-23715(23): *note signal.sigwaitinfo(): fab. and *note
     signal.sigtimedwait(): faa. are now retried when interrupted by a
     signal not in the 'sigset' parameter, if the signal handler does
     not raise an exception.  signal.sigtimedwait() recomputes the
     timeout with a monotonic clock when it is retried.

   - bpo-23001(24): Few functions in modules mmap, ossaudiodev, socket,
     ssl, and codecs, that accepted only read-only bytes-like object now
     accept writable bytes-like object too.

   - bpo-23646(25): If time.sleep() is interrupted by a signal, the
     sleep is now retried with the recomputed delay, except if the
     signal handler raises an exception (PEP 475).

   - bpo-23136(26): _strptime now uniformly handles all days in week 0,
     including Dec 30 of previous year.  Based on patch by Jim Carroll.

   - bpo-23700(27): Iterator of NamedTemporaryFile now keeps a reference
     to NamedTemporaryFile instance.  Patch by Bohuslav Kabrda.

   - bpo-22903(28): The fake test case created by unittest.loader when
     it fails importing a test module is now picklable.

   - bpo-22181(29): On Linux, os.urandom() now uses the new getrandom()
     syscall if available, syscall introduced in the Linux kernel 3.17.
     It is more reliable and more secure, because it avoids the need of
     a file descriptor and waits until the kernel has enough entropy.

   - bpo-2211(30): Updated the implementation of the http.cookies.Morsel
     class.  Setting attributes key, value and coded_value directly now
     is deprecated.  update() and setdefault() now transform and check
     keys.  Comparing for equality now takes into account attributes
     key, value and coded_value.  copy() now returns a Morsel, not a
     dict.  repr() now contains all attributes.  Optimized checking keys
     and quoting values.  Added new tests.  Original patch by Demian
     Brecht.

   - bpo-18983(31): Allow selection of output units in timeit.  Patch by
     Julian Gindi.

   - bpo-23631(32): Fix traceback.format_list when a traceback has been
     mutated.

   - bpo-23568(33): Add rdivmod support to MagicMock() objects.  Patch
     by Håkan Lövdahl.

   - bpo-2052(34): Add charset parameter to HtmlDiff.make_file().

   - bpo-23668(35): Support os.truncate and os.ftruncate on Windows.

   - bpo-23138(36): Fixed parsing cookies with absent keys or values in
     cookiejar.  Patch by Demian Brecht.

   - bpo-23051(37): multiprocessing.Pool methods imap() and
     imap_unordered() now handle exceptions raised by an iterator.
     Patch by Alon Diamant and Davin Potts.

   - bpo-23581(38): Add matmul support to MagicMock.  Patch by Håkan
     Lövdahl.

   - bpo-23566(39): enable(), register(), dump_traceback() and
     dump_traceback_later() functions of faulthandler now accept file
     descriptors.  Patch by Wei Wu.

   - bpo-22928(40): Disabled HTTP header injections in http.client.
     Original patch by Demian Brecht.

   - bpo-23615(41): Modules bz2, tarfile and tokenize now can be
     reloaded with imp.reload().  Patch by Thomas Kluyver.

   - bpo-23605(42): os.walk() now calls os.scandir() instead of
     os.listdir().  The usage of os.scandir() reduces the number of
     calls to os.stat().  Initial patch written by Ben Hoyt.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14260

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23792

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23775

   (4) https://bugs.python.org/issue?@action=redirect&bpo=23765

   (5) https://bugs.python.org/issue?@action=redirect&bpo=22364

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23742

   (7) https://bugs.python.org/issue?@action=redirect&bpo=21717

   (8) https://bugs.python.org/issue?@action=redirect&bpo=21802

   (9) https://bugs.python.org/issue?@action=redirect&bpo=23622

   (10) https://bugs.python.org/issue?@action=redirect&bpo=23671

   (11) https://bugs.python.org/issue?@action=redirect&bpo=23502

   (12) https://bugs.python.org/issue?@action=redirect&bpo=17530

   (13) https://bugs.python.org/issue?@action=redirect&bpo=22687

   (14) https://bugs.python.org/issue?@action=redirect&bpo=4727

   (15) https://bugs.python.org/issue?@action=redirect&bpo=23491

   (16) https://bugs.python.org/issue?@action=redirect&bpo=23657

   (17) https://bugs.python.org/issue?@action=redirect&bpo=23688

   (18) https://bugs.python.org/issue?@action=redirect&bpo=23252

   (19) https://bugs.python.org/issue?@action=redirect&bpo=23647

   (20) https://bugs.python.org/issue?@action=redirect&bpo=23539

   (21) https://bugs.python.org/issue?@action=redirect&bpo=22351

   (22) https://bugs.python.org/issue?@action=redirect&bpo=23704

   (23) https://bugs.python.org/issue?@action=redirect&bpo=23715

   (24) https://bugs.python.org/issue?@action=redirect&bpo=23001

   (25) https://bugs.python.org/issue?@action=redirect&bpo=23646

   (26) https://bugs.python.org/issue?@action=redirect&bpo=23136

   (27) https://bugs.python.org/issue?@action=redirect&bpo=23700

   (28) https://bugs.python.org/issue?@action=redirect&bpo=22903

   (29) https://bugs.python.org/issue?@action=redirect&bpo=22181

   (30) https://bugs.python.org/issue?@action=redirect&bpo=2211

   (31) https://bugs.python.org/issue?@action=redirect&bpo=18983

   (32) https://bugs.python.org/issue?@action=redirect&bpo=23631

   (33) https://bugs.python.org/issue?@action=redirect&bpo=23568

   (34) https://bugs.python.org/issue?@action=redirect&bpo=2052

   (35) https://bugs.python.org/issue?@action=redirect&bpo=23668

   (36) https://bugs.python.org/issue?@action=redirect&bpo=23138

   (37) https://bugs.python.org/issue?@action=redirect&bpo=23051

   (38) https://bugs.python.org/issue?@action=redirect&bpo=23581

   (39) https://bugs.python.org/issue?@action=redirect&bpo=23566

   (40) https://bugs.python.org/issue?@action=redirect&bpo=22928

   (41) https://bugs.python.org/issue?@action=redirect&bpo=23615

   (42) https://bugs.python.org/issue?@action=redirect&bpo=23605


File: python.info,  Node: ビルド<98>,  Next: テスト<87>,  Prev: ライブラリ<205>,  Up: Python 3 5 0 alpha 3

1.24.118.3 ビルド
.................

   - bpo-23585(1): make patchcheck will ensure the interpreter is built.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23585


File: python.info,  Node: テスト<87>,  Next: Tools/Demos<60>,  Prev: ビルド<98>,  Up: Python 3 5 0 alpha 3

1.24.118.4 テスト
.................

   - bpo-23583(1): Added tests for standard IO streams in IDLE.

   - bpo-22289(2): Prevent test_urllib2net failures due to ftp
     connection timeout.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23583

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22289


File: python.info,  Node: Tools/Demos<60>,  Prev: テスト<87>,  Up: Python 3 5 0 alpha 3

1.24.118.5 Tools/Demos
......................

   - bpo-22826(1): The result of open() in Tools/freeze/bkfile.py is now
     better compatible with regular files (in particular it now supports
     the context management protocol).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22826


File: python.info,  Node: Python 3 5 0 alpha 2,  Next: Python 3 5 0 alpha 1,  Prev: Python 3 5 0 alpha 3,  Up: 変更履歴

1.24.119 Python 3.5.0 alpha 2
-----------------------------

'Release date: 2015-03-09'

* Menu:

* Core and Builtins: Core and Builtins<203>.
* ライブラリ: ライブラリ<206>.
* ビルド: ビルド<99>.
* C API: C API<78>.
* Windows: Windows<82>.


File: python.info,  Node: Core and Builtins<203>,  Next: ライブラリ<206>,  Up: Python 3 5 0 alpha 2

1.24.119.1 Core and Builtins
............................

   - bpo-23571(1): PyObject_Call() and PyCFunction_Call() now raise a
     SystemError if a function returns a result and raises an exception.
     The SystemError is chained to the previous exception.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23571


File: python.info,  Node: ライブラリ<206>,  Next: ビルド<99>,  Prev: Core and Builtins<203>,  Up: Python 3 5 0 alpha 2

1.24.119.2 ライブラリ
.....................

   - bpo-22524(1): New os.scandir() function, part of the PEP 471(2):
     "os.scandir() function - a better and faster directory iterator".
     Patch written by Ben Hoyt.

   - bpo-23103(3): Reduced the memory consumption of IPv4Address and
     IPv6Address.

   - bpo-21793(4): BaseHTTPRequestHandler again logs response code as
     numeric, not as stringified enum.  Patch by Demian Brecht.

   - bpo-23476(5): In the ssl module, enable OpenSSL's
     X509_V_FLAG_TRUSTED_FIRST flag on certificate stores when it is
     available.

   - bpo-23576(6): Avoid stalling in SSL reads when EOF has been reached
     in the SSL layer but the underlying connection hasn't been closed.

   - bpo-23504(7): Added an __all__ to the types module.

   - bpo-23563(8): Optimized utility functions in urllib.parse.

   - bpo-7830(9): Flatten nested functools.partial.

   - bpo-20204(10): Added the __module__ attribute to _tkinter classes.

   - bpo-19980(11): Improved help() for non-recognized strings.
     help('') now shows the help on str.  help('help') now shows the
     help on help().  Original patch by Mark Lawrence.

   - bpo-23521(12): Corrected pure python implementation of timedelta
     division.  Eliminated OverflowError from ‘timedelta * float’ for
     some floats; Corrected rounding in timedelta true division.

   - bpo-21619(13): Popen objects no longer leave a zombie after exit in
     the with statement if the pipe was broken.  Patch by Martin Panter.

   - bpo-22936(14): Make it possible to show local variables in
     tracebacks for both the traceback module and unittest.

   - bpo-15955(15): Add an option to limit the output size in
     bz2.decompress().  Patch by Nikolaus Rath.

   - bpo-6639(16): Module-level turtle functions no longer raise
     TclError after closing the window.

   - bpo-814253(17): Group references and conditional group references
     now work in lookbehind assertions in regular expressions.  (See
     also: bpo-9179(18))

   - bpo-23215(19): Multibyte codecs with custom error handlers that
     ignores errors consumed too much memory and raised SystemError or
     MemoryError.  Original patch by Aleksi Torhamo.

   - bpo-5700(20): io.FileIO() called flush() after closing the file.
     flush() was not called in close() if closefd=False.

   - bpo-23374(21): Fixed pydoc failure with non-ASCII files when stdout
     encoding differs from file system encoding (e.g.  on Mac OS).

   - bpo-23481(22): Remove RC4 from the SSL module's default cipher
     list.

   - bpo-21548(23): Fix pydoc.synopsis() and pydoc.apropos() on modules
     with empty docstrings.

   - bpo-22885(24): Fixed arbitrary code execution vulnerability in the
     dbm.dumb module.  Original patch by Claudiu Popa.

   - bpo-23239(25): ssl.match_hostname() now supports matching of IP
     addresses.

   - bpo-23146(26): Fix mishandling of absolute Windows paths with
     forward slashes in pathlib.

   - bpo-23096(27): Pickle representation of floats with protocol 0 now
     is the same for both Python and C implementations.

   - bpo-19105(28): pprint now more efficiently uses free space at the
     right.

   - bpo-14910(29): Add allow_abbrev parameter to
     argparse.ArgumentParser.  Patch by Jonathan Paugh, Steven Bethard,
     paul j3 and Daniel Eriksson.

   - bpo-21717(30): tarfile.open() now supports 'x' (exclusive creation)
     mode.

   - bpo-23344(31): marshal.dumps() is now 20-25% faster on average.

   - bpo-20416(32): marshal.dumps() with protocols 3 and 4 is now 40-50%
     faster on average.

   - bpo-23421(33): Fixed compression in tarfile CLI. Patch by wdv4758h.

   - bpo-23367(34): Fix possible overflows in the unicodedata module.

   - bpo-23361(35): Fix possible overflow in Windows subprocess creation
     code.

   - logging.handlers.QueueListener now takes a respect_handler_level
     keyword argument which, if set to True, will pass messages to
     handlers taking handler levels into account.

   - bpo-19705(36): turtledemo now has a visual sorting algorithm demo.
     Original patch from Jason Yeo.

   - bpo-23801(37): Fix issue where cgi.FieldStorage did not always
     ignore the entire preamble to a multipart body.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22524

   (2) https://peps.python.org/pep-0471/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23103

   (4) https://bugs.python.org/issue?@action=redirect&bpo=21793

   (5) https://bugs.python.org/issue?@action=redirect&bpo=23476

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23576

   (7) https://bugs.python.org/issue?@action=redirect&bpo=23504

   (8) https://bugs.python.org/issue?@action=redirect&bpo=23563

   (9) https://bugs.python.org/issue?@action=redirect&bpo=7830

   (10) https://bugs.python.org/issue?@action=redirect&bpo=20204

   (11) https://bugs.python.org/issue?@action=redirect&bpo=19980

   (12) https://bugs.python.org/issue?@action=redirect&bpo=23521

   (13) https://bugs.python.org/issue?@action=redirect&bpo=21619

   (14) https://bugs.python.org/issue?@action=redirect&bpo=22936

   (15) https://bugs.python.org/issue?@action=redirect&bpo=15955

   (16) https://bugs.python.org/issue?@action=redirect&bpo=6639

   (17) https://bugs.python.org/issue?@action=redirect&bpo=814253

   (18) https://bugs.python.org/issue?@action=redirect&bpo=9179

   (19) https://bugs.python.org/issue?@action=redirect&bpo=23215

   (20) https://bugs.python.org/issue?@action=redirect&bpo=5700

   (21) https://bugs.python.org/issue?@action=redirect&bpo=23374

   (22) https://bugs.python.org/issue?@action=redirect&bpo=23481

   (23) https://bugs.python.org/issue?@action=redirect&bpo=21548

   (24) https://bugs.python.org/issue?@action=redirect&bpo=22885

   (25) https://bugs.python.org/issue?@action=redirect&bpo=23239

   (26) https://bugs.python.org/issue?@action=redirect&bpo=23146

   (27) https://bugs.python.org/issue?@action=redirect&bpo=23096

   (28) https://bugs.python.org/issue?@action=redirect&bpo=19105

   (29) https://bugs.python.org/issue?@action=redirect&bpo=14910

   (30) https://bugs.python.org/issue?@action=redirect&bpo=21717

   (31) https://bugs.python.org/issue?@action=redirect&bpo=23344

   (32) https://bugs.python.org/issue?@action=redirect&bpo=20416

   (33) https://bugs.python.org/issue?@action=redirect&bpo=23421

   (34) https://bugs.python.org/issue?@action=redirect&bpo=23367

   (35) https://bugs.python.org/issue?@action=redirect&bpo=23361

   (36) https://bugs.python.org/issue?@action=redirect&bpo=19705

   (37) https://bugs.python.org/issue?@action=redirect&bpo=23801


File: python.info,  Node: ビルド<99>,  Next: C API<78>,  Prev: ライブラリ<206>,  Up: Python 3 5 0 alpha 2

1.24.119.3 ビルド
.................

   - bpo-23445(1): pydebug builds now use "gcc -Og" where possible, to
     make the resulting executable faster.

   - bpo-23686(2): Update OS X 10.5 installer build to use OpenSSL
     1.0.2a.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23445

   (2) https://bugs.python.org/issue?@action=redirect&bpo=23686


File: python.info,  Node: C API<78>,  Next: Windows<82>,  Prev: ビルド<99>,  Up: Python 3 5 0 alpha 2

1.24.119.4 C API
................

   - bpo-20204(1): Deprecation warning is now raised for builtin types
     without the __module__ attribute.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20204


File: python.info,  Node: Windows<82>,  Prev: C API<78>,  Up: Python 3 5 0 alpha 2

1.24.119.5 Windows
..................

   - bpo-23465(1): Implement PEP 486(2) - Make the Python Launcher aware
     of virtual environments.  Patch by Paul Moore.

   - bpo-23437(3): Make user scripts directory versioned on Windows.
     Patch by Paul Moore.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23465

   (2) https://peps.python.org/pep-0486/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=23437


File: python.info,  Node: Python 3 5 0 alpha 1,  Prev: Python 3 5 0 alpha 2,  Up: 変更履歴

1.24.120 Python 3.5.0 alpha 1
-----------------------------

'Release date: 2015-02-08'

* Menu:

* Core and Builtins: Core and Builtins<204>.
* ライブラリ: ライブラリ<207>.
* IDLE: IDLE<63>.
* ビルド: ビルド<100>.
* C API: C API<79>.
* ドキュメント: ドキュメント<85>.
* テスト: テスト<88>.
* Tools/Demos: Tools/Demos<61>.
* Windows: Windows<83>.


File: python.info,  Node: Core and Builtins<204>,  Next: ライブラリ<207>,  Up: Python 3 5 0 alpha 1

1.24.120.1 Core and Builtins
............................

   - bpo-23285(1): PEP 475 - EINTR handling.

   - bpo-22735(2): Fix many edge cases (including crashes) involving
     custom mro() implementations.

   - bpo-22896(3): Avoid using PyObject_AsCharBuffer(),
     PyObject_AsReadBuffer() and PyObject_AsWriteBuffer().

   - bpo-21295(4): Revert some changes (bpo-16795(5)) to AST line
     numbers and column offsets that constituted a regression.

   - bpo-22986(6): Allow changing an object's __class__ between a
     dynamic type and static type in some cases.

   - bpo-15859(7): PyUnicode_EncodeFSDefault(), PyUnicode_EncodeMBCS()
     and PyUnicode_EncodeCodePage() now raise an exception if the object
     is not a Unicode object.  For PyUnicode_EncodeFSDefault(), it was
     already the case on platforms other than Windows.  Patch written by
     Campbell Barton.

   - bpo-21408(8): The default __ne__() now returns NotImplemented if
     __eq__() returned NotImplemented.  Original patch by Martin Panter.

   - bpo-23321(9): Fixed a crash in str.decode() when error handler
     returned replacement string longer than malformed input data.

   - bpo-22286(10): The "backslashreplace" error handlers now works with
     decoding and translating.

   - bpo-23253(11): Delay-load ShellExecute[AW] in os.startfile for
     reduced startup overhead on Windows.

   - bpo-22038(12): pyatomic.h now uses stdatomic.h or GCC built-in
     functions for atomic memory access if available.  Patch written by
     Vitor de Lima and Gustavo Temple.

   - bpo-20284(13): %-interpolation (aka printf) formatting added for
     bytes and bytearray.

   - bpo-23048(14): Fix jumping out of an infinite while loop in the
     pdb.

   - bpo-20335(15): bytes constructor now raises TypeError when encoding
     or errors is specified with non-string argument.  Based on patch by
     Renaud Blanch.

   - bpo-22834(16): If the current working directory ends up being set
     to a non-existent directory then import will no longer raise
     FileNotFoundError.

   - bpo-22869(17): Move the interpreter startup & shutdown code to a
     new dedicated pylifecycle.c module

   - bpo-22847(18): Improve method cache efficiency.

   - bpo-22335(19): Fix crash when trying to enlarge a bytearray to
     0x7fffffff bytes on a 32-bit platform.

   - bpo-22653(20): Fix an assertion failure in debug mode when doing a
     reentrant dict insertion in debug mode.

   - bpo-22643(21): Fix integer overflow in Unicode case operations
     (upper, lower, title, swapcase, casefold).

   - bpo-17636(22): Circular imports involving relative imports are now
     supported.

   - bpo-22604(23): Fix assertion error in debug mode when dividing a
     complex number by (nan+0j).

   - bpo-21052(24): Do not raise ImportWarning when sys.path_hooks or
     sys.meta_path are set to None.

   - bpo-16518(25): Use 'bytes-like object required' in error messages
     that previously used the far more cryptic "'x' does not support the
     buffer protocol.

   - bpo-22470(26): Fixed integer overflow issues in "backslashreplace",
     "xmlcharrefreplace", and "surrogatepass" error handlers.

   - bpo-22540(27): speed up ‘PyObject_IsInstance’ and
     ‘PyObject_IsSubclass’ in the common case that the second argument
     has metaclass ‘type’.

   - bpo-18711(28): Add a new ‘PyErr_FormatV’ function, similar to
     ‘PyErr_Format’ but accepting a ‘va_list’ argument.

   - bpo-22520(29): Fix overflow checking when generating the repr of a
     unicode object.

   - bpo-22519(30): Fix overflow checking in PyBytes_Repr.

   - bpo-22518(31): Fix integer overflow issues in latin-1 encoding.

   - bpo-16324(32): _charset parameter of MIMEText now also accepts
     email.charset.Charset instances.  Initial patch by Claude Paroz.

   - bpo-1764286(33): Fix inspect.getsource() to support decorated
     functions.  Patch by Claudiu Popa.

   - bpo-18554(34): os.__all__ includes posix functions.

   - bpo-21391(35): Use os.path.abspath in the shutil module.

   - bpo-11471(36): avoid generating a JUMP_FORWARD instruction at the
     end of an if-block if there is no else-clause.  Original patch by
     Eugene Toder.

   - bpo-22215(37): Now ValueError is raised instead of TypeError when
     str or bytes argument contains not permitted null character or
     byte.

   - bpo-22258(38): Fix the internal function set_inheritable() on
     Illumos.  This platform exposes the function ‘ioctl(FIOCLEX)’, but
     calling it fails with errno is ENOTTY: "Inappropriate ioctl for
     device".  set_inheritable() now falls back to the slower ‘fcntl()’
     (‘F_GETFD’ and then ‘F_SETFD’).

   - bpo-21389(39): Displaying the __qualname__ of the underlying
     function in the repr of a bound method.

   - bpo-22206(40): Using pthread, PyThread_create_key() now sets errno
     to ENOMEM and returns -1 (error) on integer overflow.

   - bpo-20184(41): Argument Clinic based signature introspection added
     for 30 of the builtin functions.

   - bpo-22116(42): C functions and methods (of the
     'builtin_function_or_method' type) can now be weakref'ed.  Patch by
     Wei Wu.

   - bpo-22077(43): Improve index error messages for bytearrays, bytes,
     lists, and tuples by adding 'or slices'.  Added ', not <typename>'
     for bytearrays.  Original patch by Claudiu Popa.

   - bpo-20179(44): Apply Argument Clinic to bytes and bytearray.  Patch
     by Tal Einat.

   - bpo-22082(45): Clear interned strings in slotdefs.

   - Upgrade Unicode database to Unicode 7.0.0.

   - bpo-21897(46): Fix a crash with the f_locals attribute with closure
     variables when frame.clear() has been called.

   - bpo-21205(47): Add a new ‘__qualname__’ attribute to generator, the
     qualified name, and use it in the representation of a generator
     (‘repr(gen)’).  The default name of the generator (‘__name__’
     attribute) is now get from the function instead of the code.  Use
     ‘gen.gi_code.co_name’ to get the name of the code.

   - bpo-21669(48): With the aid of heuristics in SyntaxError.__init__,
     the parser now attempts to generate more meaningful (or at least
     more search engine friendly) error messages when "exec" and "print"
     are used as statements.

   - bpo-21642(49): In the conditional if-else expression, allow an
     integer written with no space between itself and the ‘else’ keyword
     (e.g.  ‘True if 42else False’) to be valid syntax.

   - bpo-21523(50): Fix over-pessimistic computation of the stack effect
     of some opcodes in the compiler.  This also fixes a quadratic
     compilation time issue noticeable when compiling code with a large
     number of "and" and "or" operators.

   - bpo-21418(51): Fix a crash in the builtin function super() when
     called without argument and without current frame (ex: embedded
     Python).

   - bpo-21425(52): Fix flushing of standard streams in the interactive
     interpreter.

   - bpo-21435(53): In rare cases, when running finalizers on objects in
     cyclic trash a bad pointer dereference could occur due to a subtle
     flaw in internal iteration logic.

   - bpo-21377(54): PyBytes_Concat() now tries to concatenate in-place
     when the first argument has a reference count of 1.  Patch by
     Nikolaus Rath.

   - bpo-20355(55): -W command line options now have higher priority
     than the PYTHONWARNINGS environment variable.  Patch by Arfrever.

   - bpo-21274(56): Define PATH_MAX for GNU/Hurd in Python/pythonrun.c.

   - bpo-20904(57): Support setting FPU precision on m68k.

   - bpo-21209(58): Fix sending tuples to custom generator objects with
     the yield from syntax.

   - bpo-21193(59): pow(a, b, c) now raises ValueError rather than
     TypeError when b is negative.  Patch by Josh Rosenberg.

   - bpo-21176(60): PEP 465: Add the '@' operator for matrix
     multiplication.

   - bpo-21134(61): Fix segfault when str is called on an uninitialized
     UnicodeEncodeError, UnicodeDecodeError, or UnicodeTranslateError
     object.

   - bpo-19537(62): Fix PyUnicode_DATA() alignment under m68k.  Patch by
     Andreas Schwab.

   - bpo-20929(63): Add a type cast to avoid shifting a negative number.

   - bpo-20731(64): Properly position in source code files even if they
     are opened in text mode.  Patch by Serhiy Storchaka.

   - bpo-20637(65): Key-sharing now also works for instance dictionaries
     of subclasses.  Patch by Peter Ingebretson.

   - bpo-8297(66): Attributes missing from modules now include the
     module name in the error text.  Original patch by ysj.ray.

   - bpo-19995(67): %c, %o, %x, and %X now raise TypeError on
     non-integer input.

   - bpo-19655(68): The ASDL parser - used by the build process to
     generate code for managing the Python AST in C - was rewritten.
     The new parser is self contained and does not require to carry long
     the spark.py parser-generator library; spark.py was removed from
     the source base.

   - bpo-12546(69): Allow ‘\x00’ to be used as a fill character when
     using str, int, float, and complex __format__ methods.

   - bpo-20480(70): Add ipaddress.reverse_pointer.  Patch by Leon Weber.

   - bpo-13598(71): Modify string.Formatter to support auto-numbering of
     replacement fields.  It now matches the behavior of str.format() in
     this regard.  Patches by Phil Elson and Ramchandra Apte.

   - bpo-8931(72): Make alternate formatting ('#') for type 'c' raise an
     exception.  In versions prior to 3.5, '#' with 'c' had no effect.
     Now specifying it is an error.  Patch by Torsten Landschoff.

   - bpo-23165(73): Perform overflow checks before allocating memory in
     the _Py_char2wchar function.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23285

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22735

   (3) https://bugs.python.org/issue?@action=redirect&bpo=22896

   (4) https://bugs.python.org/issue?@action=redirect&bpo=21295

   (5) https://bugs.python.org/issue?@action=redirect&bpo=16795

   (6) https://bugs.python.org/issue?@action=redirect&bpo=22986

   (7) https://bugs.python.org/issue?@action=redirect&bpo=15859

   (8) https://bugs.python.org/issue?@action=redirect&bpo=21408

   (9) https://bugs.python.org/issue?@action=redirect&bpo=23321

   (10) https://bugs.python.org/issue?@action=redirect&bpo=22286

   (11) https://bugs.python.org/issue?@action=redirect&bpo=23253

   (12) https://bugs.python.org/issue?@action=redirect&bpo=22038

   (13) https://bugs.python.org/issue?@action=redirect&bpo=20284

   (14) https://bugs.python.org/issue?@action=redirect&bpo=23048

   (15) https://bugs.python.org/issue?@action=redirect&bpo=20335

   (16) https://bugs.python.org/issue?@action=redirect&bpo=22834

   (17) https://bugs.python.org/issue?@action=redirect&bpo=22869

   (18) https://bugs.python.org/issue?@action=redirect&bpo=22847

   (19) https://bugs.python.org/issue?@action=redirect&bpo=22335

   (20) https://bugs.python.org/issue?@action=redirect&bpo=22653

   (21) https://bugs.python.org/issue?@action=redirect&bpo=22643

   (22) https://bugs.python.org/issue?@action=redirect&bpo=17636

   (23) https://bugs.python.org/issue?@action=redirect&bpo=22604

   (24) https://bugs.python.org/issue?@action=redirect&bpo=21052

   (25) https://bugs.python.org/issue?@action=redirect&bpo=16518

   (26) https://bugs.python.org/issue?@action=redirect&bpo=22470

   (27) https://bugs.python.org/issue?@action=redirect&bpo=22540

   (28) https://bugs.python.org/issue?@action=redirect&bpo=18711

   (29) https://bugs.python.org/issue?@action=redirect&bpo=22520

   (30) https://bugs.python.org/issue?@action=redirect&bpo=22519

   (31) https://bugs.python.org/issue?@action=redirect&bpo=22518

   (32) https://bugs.python.org/issue?@action=redirect&bpo=16324

   (33) https://bugs.python.org/issue?@action=redirect&bpo=1764286

   (34) https://bugs.python.org/issue?@action=redirect&bpo=18554

   (35) https://bugs.python.org/issue?@action=redirect&bpo=21391

   (36) https://bugs.python.org/issue?@action=redirect&bpo=11471

   (37) https://bugs.python.org/issue?@action=redirect&bpo=22215

   (38) https://bugs.python.org/issue?@action=redirect&bpo=22258

   (39) https://bugs.python.org/issue?@action=redirect&bpo=21389

   (40) https://bugs.python.org/issue?@action=redirect&bpo=22206

   (41) https://bugs.python.org/issue?@action=redirect&bpo=20184

   (42) https://bugs.python.org/issue?@action=redirect&bpo=22116

   (43) https://bugs.python.org/issue?@action=redirect&bpo=22077

   (44) https://bugs.python.org/issue?@action=redirect&bpo=20179

   (45) https://bugs.python.org/issue?@action=redirect&bpo=22082

   (46) https://bugs.python.org/issue?@action=redirect&bpo=21897

   (47) https://bugs.python.org/issue?@action=redirect&bpo=21205

   (48) https://bugs.python.org/issue?@action=redirect&bpo=21669

   (49) https://bugs.python.org/issue?@action=redirect&bpo=21642

   (50) https://bugs.python.org/issue?@action=redirect&bpo=21523

   (51) https://bugs.python.org/issue?@action=redirect&bpo=21418

   (52) https://bugs.python.org/issue?@action=redirect&bpo=21425

   (53) https://bugs.python.org/issue?@action=redirect&bpo=21435

   (54) https://bugs.python.org/issue?@action=redirect&bpo=21377

   (55) https://bugs.python.org/issue?@action=redirect&bpo=20355

   (56) https://bugs.python.org/issue?@action=redirect&bpo=21274

   (57) https://bugs.python.org/issue?@action=redirect&bpo=20904

   (58) https://bugs.python.org/issue?@action=redirect&bpo=21209

   (59) https://bugs.python.org/issue?@action=redirect&bpo=21193

   (60) https://bugs.python.org/issue?@action=redirect&bpo=21176

   (61) https://bugs.python.org/issue?@action=redirect&bpo=21134

   (62) https://bugs.python.org/issue?@action=redirect&bpo=19537

   (63) https://bugs.python.org/issue?@action=redirect&bpo=20929

   (64) https://bugs.python.org/issue?@action=redirect&bpo=20731

   (65) https://bugs.python.org/issue?@action=redirect&bpo=20637

   (66) https://bugs.python.org/issue?@action=redirect&bpo=8297

   (67) https://bugs.python.org/issue?@action=redirect&bpo=19995

   (68) https://bugs.python.org/issue?@action=redirect&bpo=19655

   (69) https://bugs.python.org/issue?@action=redirect&bpo=12546

   (70) https://bugs.python.org/issue?@action=redirect&bpo=20480

   (71) https://bugs.python.org/issue?@action=redirect&bpo=13598

   (72) https://bugs.python.org/issue?@action=redirect&bpo=8931

   (73) https://bugs.python.org/issue?@action=redirect&bpo=23165


File: python.info,  Node: ライブラリ<207>,  Next: IDLE<63>,  Prev: Core and Builtins<204>,  Up: Python 3 5 0 alpha 1

1.24.120.2 ライブラリ
.....................

   - bpo-23399(1): pyvenv creates relative symlinks where possible.

   - bpo-20289(2): cgi.FieldStorage() now supports the context
     management protocol.

   - bpo-13128(3): Print response headers for CONNECT requests when
     debuglevel > 0.  Patch by Demian Brecht.

   - bpo-15381(4): Optimized io.BytesIO to make less allocations and
     copyings.

   - bpo-22818(5): Splitting on a pattern that could match an empty
     string now raises a warning.  Patterns that can only match empty
     strings are now rejected.

   - bpo-23099(6): Closing io.BytesIO with exported buffer is rejected
     now to prevent corrupting exported buffer.

   - bpo-23326(7): Removed __ne__ implementations.  Since fixing default
     __ne__ implementation in bpo-21408(8) they are redundant.

   - bpo-23363(9): Fix possible overflow in itertools.permutations.

   - bpo-23364(10): Fix possible overflow in itertools.product.

   - bpo-23366(11): Fixed possible integer overflow in
     itertools.combinations.

   - bpo-23369(12): Fixed possible integer overflow in
     _json.encode_basestring_ascii.

   - bpo-23353(13): Fix the exception handling of generators in
     PyEval_EvalFrameEx().  At entry, save or swap the exception state
     even if PyEval_EvalFrameEx() is called with throwflag=0.  At exit,
     the exception state is now always restored or swapped, not only if
     why is WHY_YIELD or WHY_RETURN. Patch co-written with Antoine
     Pitrou.

   - bpo-14099(14): Restored support of writing ZIP files to tellable
     but non-seekable streams.

   - bpo-14099(15): Writing to ZipFile and reading multiple ZipExtFiles
     is threadsafe now.

   - bpo-19361(16): JSON decoder now raises JSONDecodeError instead of
     ValueError.

   - bpo-18518(17): timeit now rejects statements which can't be
     compiled outside a function or a loop (e.g.  "return" or "break").

   - bpo-23094(18): Fixed readline with frames in Python implementation
     of pickle.

   - bpo-23268(19): Fixed bugs in the comparison of ipaddress classes.

   - bpo-21408(20): Removed incorrect implementations of __ne__() which
     didn't returned NotImplemented if __eq__() returned NotImplemented.
     The default __ne__() now works correctly.

   - bpo-19996(21): ‘email.feedparser.FeedParser’ now handles
     (malformed) headers with no key rather than assuming the body has
     started.

   - bpo-20188(22): Support Application-Layer Protocol Negotiation
     (ALPN) in the ssl module.

   - bpo-23133(23): Pickling of ipaddress objects now produces more
     compact and portable representation.

   - bpo-23248(24): Update ssl error codes from latest OpenSSL git
     master.

   - bpo-23266(25): Much faster implementation of
     ipaddress.collapse_addresses() when there are many non-consecutive
     addresses.

   - bpo-23098(26): 64-bit dev_t is now supported in the os module.

   - bpo-21817(27): When an exception is raised in a task submitted to a
     ProcessPoolExecutor, the remote traceback is now displayed in the
     parent process.  Patch by Claudiu Popa.

   - bpo-15955(28): Add an option to limit output size when
     decompressing LZMA data.  Patch by Nikolaus Rath and Martin Panter.

   - bpo-23250(29): In the http.cookies module, capitalize "HttpOnly"
     and "Secure" as they are written in the standard.

   - bpo-23063(30): In the distutils' check command, fix parsing of reST
     with code or code-block directives.

   - bpo-23209(31): selectors.BaseSelector.get_key() now raises a
     RuntimeError if the selector is closed.  And
     selectors.BaseSelector.close() now clears its internal reference to
     the selector mapping to break a reference cycle.  Initial patch
     written by Martin Richard.  (See also: bpo-23225(32))

   - bpo-17911(33): Provide a way to seed the linecache for a PEP-302
     module without actually loading the code.

   - bpo-17911(34): Provide a new object API for traceback, including
     the ability to not lookup lines at all until the traceback is
     actually rendered, without any trace of the original objects being
     kept alive.

   - bpo-19777(35): Provide a home() classmethod on Path objects.
     Contributed by Victor Salgado and Mayank Tripathi.

   - bpo-23206(36): Make ‘json.dumps(..., ensure_ascii=False)’ as fast
     as the default case of ‘ensure_ascii=True’.  Patch by Naoki Inada.

   - bpo-23185(37): Add math.inf and math.nan constants.

   - bpo-23186(38): Add ssl.SSLObject.shared_ciphers() and
     ssl.SSLSocket.shared_ciphers() to fetch the client's list ciphers
     sent at handshake.

   - bpo-23143(39): Remove compatibility with OpenSSLs older than 0.9.8.

   - bpo-23132(40): Improve performance and introspection support of
     comparison methods created by functool.total_ordering.

   - bpo-19776(41): Add an expanduser() method on Path objects.

   - bpo-23112(42): Fix SimpleHTTPServer to correctly carry the query
     string and fragment when it redirects to add a trailing slash.

   - bpo-21793(43): Added http.HTTPStatus enums (i.e.  HTTPStatus.OK,
     HTTPStatus.NOT_FOUND). Patch by Demian Brecht.

   - bpo-23093(44): In the io, module allow more operations to work on
     detached streams.

   - bpo-23111(45): In the ftplib, make ssl.PROTOCOL_SSLv23 the default
     protocol version.

   - bpo-22585(46): On OpenBSD 5.6 and newer, os.urandom() now calls
     getentropy(), instead of reading /dev/urandom, to get pseudo-random
     bytes.

   - bpo-19104(47): pprint now produces evaluable output for wrapped
     strings.

   - bpo-23071(48): Added missing names to codecs.__all__.  Patch by
     Martin Panter.

   - bpo-22783(49): Pickling now uses the NEWOBJ opcode instead of the
     NEWOBJ_EX opcode if possible.

   - bpo-15513(50): Added a __sizeof__ implementation for pickle
     classes.

   - bpo-19858(51): pickletools.optimize() now aware of the MEMOIZE
     opcode, can produce more compact result and no longer produces
     invalid output if input data contains MEMOIZE opcodes together with
     PUT or BINPUT opcodes.

   - bpo-22095(52): Fixed HTTPConnection.set_tunnel with default port.
     The port value in the host header was set to "None".  Patch by
     Demian Brecht.

   - bpo-23016(53): A warning no longer produces an AttributeError when
     the program is run with pythonw.exe.

   - bpo-21775(54): shutil.copytree(): fix crash when copying to VFAT.
     An exception handler assumed that OSError objects always have a
     'winerror' attribute.  That is not the case, so the exception
     handler itself raised AttributeError when run on Linux (and,
     presumably, any other non-Windows OS). Patch by Greg Ward.

   - bpo-1218234(55): Fix inspect.getsource() to load updated source of
     reloaded module.  Initial patch by Berker Peksag.

   - bpo-21740(56): Support wrapped callables in doctest.  Patch by
     Claudiu Popa.

   - bpo-23009(57): Make sure selectors.EpollSelector.select() works
     when no FD is registered.

   - bpo-22959(58): In the constructor of http.client.HTTPSConnection,
     prefer the context's check_hostname attribute over the
     'check_hostname' parameter.

   - bpo-22696(59): Add function *note sys.is_finalizing(): c80. to know
     about interpreter shutdown.

   - bpo-16043(60): Add a default limit for the amount of data
     xmlrpclib.gzip_decode will return.  This resolves CVE
     2013-1753(61).

   - bpo-14099(62): ZipFile.open() no longer reopen the underlying file.
     Objects returned by ZipFile.open() can now operate independently of
     the ZipFile even if the ZipFile was created by passing in a
     file-like object as the first argument to the constructor.

   - bpo-22966(63): Fix __pycache__ pyc file name clobber when
     pyc_compile is asked to compile a source file containing multiple
     dots in the source file name.

   - bpo-21971(64): Update turtledemo doc and add module to the index.

   - bpo-21032(65): Fixed socket leak if HTTPConnection.getresponse()
     fails.  Original patch by Martin Panter.

   - bpo-22407(66): Deprecated the use of re.LOCALE flag with str
     patterns or re.ASCII. It was newer worked.

   - bpo-22902(67): The "ip" command is now used on Linux to determine
     MAC address in uuid.getnode().  Patch by Bruno Cauet.

   - bpo-22960(68): Add a context argument to xmlrpclib.ServerProxy
     constructor.

   - bpo-22389(69): Add contextlib.redirect_stderr().

   - bpo-21356(70): Make ssl.RAND_egd() optional to support LibreSSL.
     The availability of the function is checked during the compilation.
     Patch written by Bernard Spil.

   - bpo-22915(71): SAX parser now supports files opened with file
     descriptor or bytes path.

   - bpo-22609(72): Constructors and update methods of mapping classes
     in the collections module now accept the self keyword argument.

   - bpo-22940(73): Add readline.append_history_file.

   - bpo-19676(74): Added the "namereplace" error handler.

   - bpo-22788(75): Add 'context' parameter to
     logging.handlers.HTTPHandler.

   - bpo-22921(76): Allow SSLContext to take the 'hostname' parameter
     even if OpenSSL doesn't support SNI.

   - bpo-22894(77): TestCase.subTest() would cause the test suite to be
     stopped when in failfast mode, even in the absence of failures.

   - bpo-22796(78): HTTP cookie parsing is now stricter, in order to
     protect against potential injection attacks.

   - bpo-22370(79): Windows detection in pathlib is now more robust.

   - bpo-22841(80): Reject coroutines in asyncio add_signal_handler().
     Patch by Ludovic.Gasc.

   - bpo-19494(81): Added urllib.request.HTTPBasicPriorAuthHandler.
     Patch by Matej Cepl.

   - bpo-22578(82): Added attributes to the re.error class.

   - bpo-22849(83): Fix possible double free in the io.TextIOWrapper
     constructor.

   - bpo-12728(84): Different Unicode characters having the same
     uppercase but different lowercase are now matched in
     case-insensitive regular expressions.

   - bpo-22821(85): Fixed fcntl() with integer argument on 64-bit
     big-endian platforms.

   - bpo-21650(86): Add an ‘--sort-keys’ option to ‘json.tool’ CLI.

   - bpo-22824(87): Updated reprlib output format for sets to use set
     literals.  Patch contributed by Berker Peksag.

   - bpo-22824(88): Updated reprlib output format for arrays to display
     empty arrays without an unnecessary empty list.  Suggested by
     Serhiy Storchaka.

   - bpo-22406(89): Fixed the uu_codec codec incorrectly ported to 3.x.
     Based on patch by Martin Panter.

   - bpo-17293(90): uuid.getnode() now determines MAC address on AIX
     using netstat.  Based on patch by Aivars Kalvāns.

   - bpo-22769(91): Fixed ttk.Treeview.tag_has() when called without
     arguments.

   - bpo-22417(92): Verify certificates by default in httplib (PEP 476).

   - bpo-22775(93): Fixed unpickling of http.cookies.SimpleCookie with
     protocol 2 and above.  Patch by Tim Graham.

   - bpo-22776(94): Brought excluded code into the scope of a try block
     in SysLogHandler.emit().

   - bpo-22665(95): Add missing get_terminal_size and SameFileError to
     shutil.__all__.

   - bpo-6623(96): Remove deprecated Netrc class in the ftplib module.
     Patch by Matt Chaput.

   - bpo-17381(97): Fixed handling of case-insensitive ranges in regular
     expressions.

   - bpo-22410(98): Module level functions in the re module now cache
     compiled locale-dependent regular expressions taking into account
     the locale.

   - bpo-22759(99): Query methods on pathlib.Path() (exists(), is_dir(),
     etc.)  now return False when the underlying stat call raises
     NotADirectoryError.

   - bpo-8876(100): distutils now falls back to copying files when hard
     linking doesn't work.  This allows use with special filesystems
     such as VirtualBox shared folders.

   - bpo-22217(101): Implemented reprs of classes in the zipfile module.

   - bpo-22457(102): Honour load_tests in the start_dir of discovery.

   - bpo-18216(103): gettext now raises an error when a .mo file has an
     unsupported major version number.  Patch by Aaron Hill.

   - bpo-13918(104): Provide a locale.delocalize() function which can
     remove locale-specific number formatting from a string representing
     a number, without then converting it to a specific type.  Patch by
     Cédric Krier.

   - bpo-22676(105): Make the pickling of global objects which don't
     have a __module__ attribute less slow.

   - bpo-18853(106): Fixed ResourceWarning in shlex.__nain__.

   - bpo-9351(107): Defaults set with set_defaults on an argparse
     subparser are no longer ignored when also set on the parent parser.

   - bpo-7559(108): unittest test loading ImportErrors are reported as
     import errors with their import exception rather than as attribute
     errors after the import has already failed.

   - bpo-19746(109): Make it possible to examine the errors from
     unittest discovery without executing the test suite.  The new
     ‘errors’ attribute on ‘TestLoader’ exposes these non-fatal errors
     encountered during discovery.

   - bpo-21991(110): Make email.headerregistry's header 'params'
     attributes be read-only (MappingProxyType).  Previously the
     dictionary was modifiable but a new one was created on each access
     of the attribute.

   - bpo-22638(111): SSLv3 is now disabled throughout the standard
     library.  It can still be enabled by instantiating a SSLContext
     manually.

   - bpo-22641(112): In asyncio, the default SSL context for client
     connections is now created using ssl.create_default_context(), for
     stronger security.

   - bpo-17401(113): Include closefd in io.FileIO repr.

   - bpo-21338(114): Add silent mode for compileall.  quiet parameters
     of compile_{dir, file, path} functions now have a multilevel value.
     Also, -q option of the CLI now have a multilevel value.  Patch by
     Thomas Kluyver.

   - bpo-20152(115): Convert the array and cmath modules to Argument
     Clinic.

   - bpo-18643(116): Add socket.socketpair() on Windows.

   - bpo-22435(117): Fix a file descriptor leak when socketserver bind
     fails.

   - bpo-13096(118): Fixed segfault in CTypes POINTER handling of large
     values.

   - bpo-11694(119): Raise ConversionError in xdrlib as documented.
     Patch by Filip Gruszczyński and Claudiu Popa.

   - bpo-19380(120): Optimized parsing of regular expressions.

   - bpo-1519638(121): Now unmatched groups are replaced with empty
     strings in re.sub() and re.subn().

   - bpo-18615(122): sndhdr.what/whathdr now return a namedtuple.

   - bpo-22462(123): Fix pyexpat's creation of a dummy frame to make it
     appear in exception tracebacks.

   - bpo-21965(124): Add support for in-memory SSL to the ssl module.
     Patch by Geert Jansen.

   - bpo-21173(125): Fix len() on a WeakKeyDictionary when .clear() was
     called with an iterator alive.

   - bpo-11866(126): Eliminated race condition in the computation of
     names for new threads.

   - bpo-21905(127): Avoid RuntimeError in pickle.whichmodule() when
     sys.modules is mutated while iterating.  Patch by Olivier Grisel.

   - bpo-11271(128): concurrent.futures.Executor.map() now takes a
     'chunksize' argument to allow batching of tasks in child processes
     and improve performance of ProcessPoolExecutor.  Patch by Dan
     O'Reilly.

   - bpo-21883(129): os.path.join() and os.path.relpath() now raise a
     TypeError with more helpful error message for unsupported or
     mismatched types of arguments.

   - bpo-22219(130): The zipfile module CLI now adds entries for
     directories (including empty directories) in ZIP file.

   - bpo-22449(131): In the ssl.SSLContext.load_default_certs, consult
     the environmental variables SSL_CERT_DIR and SSL_CERT_FILE on
     Windows.

   - bpo-22508(132): The email.__version__ variable has been removed;
     the email code is no longer shipped separately from the stdlib, and
     __version__ hasn't been updated in several releases.

   - bpo-20076(133): Added non derived UTF-8 aliases to locale aliases
     table.

   - bpo-20079(134): Added locales supported in glibc 2.18 to locale
     alias table.

   - bpo-20218(135): Added convenience methods read_text/write_text and
     read_bytes/ write_bytes to pathlib.Path objects.

   - bpo-22396(136): On 32-bit AIX platform, don't expose
     os.posix_fadvise() nor os.posix_fallocate() because their
     prototypes in system headers are wrong.

   - bpo-22517(137): When an io.BufferedRWPair object is deallocated,
     clear its weakrefs.

   - bpo-22437(138): Number of capturing groups in regular expression is
     no longer limited by 100.

   - bpo-17442(139): InteractiveInterpreter now displays the full
     chained traceback in its showtraceback method, to match the built
     in interactive interpreter.

   - bpo-23392(140): Added tests for marshal C API that works with
     FILE*.

   - bpo-10510(141): distutils register and upload methods now use HTML
     standards compliant CRLF line endings.

   - bpo-9850(142): Fixed macpath.join() for empty first component.
     Patch by Oleg Oshmyan.

   - bpo-5309(143): distutils' build and build_ext commands now accept a
     ‘-j’ option to enable parallel building of extension modules.

   - bpo-22448(144): Improve canceled timer handles cleanup to prevent
     unbound memory usage.  Patch by Joshua Moore-Oliva.

   - bpo-22427(145): TemporaryDirectory no longer attempts to clean up
     twice when used in the with statement in generator.

   - bpo-22362(146): Forbidden ambiguous octal escapes out of range
     0-0o377 in regular expressions.

   - bpo-20912(147): Now directories added to ZIP file have correct Unix
     and MS-DOS directory attributes.

   - bpo-21866(148): ZipFile.close() no longer writes ZIP64 central
     directory records if allowZip64 is false.

   - bpo-22278(149): Fix urljoin problem with relative urls, a
     regression observed after changes to issue22118 were submitted.

   - bpo-22415(150): Fixed debugging output of the GROUPREF_EXISTS
     opcode in the re module.  Removed trailing spaces in debugging
     output.

   - bpo-22423(151): Unhandled exception in thread no longer causes
     unhandled AttributeError when sys.stderr is None.

   - bpo-21332(152): Ensure that ‘bufsize=1’ in subprocess.Popen()
     selects line buffering, rather than block buffering.  Patch by
     Akira Li.

   - bpo-21091(153): Fix API bug:
     email.message.EmailMessage.is_attachment is now a method.

   - bpo-21079(154): Fix email.message.EmailMessage.is_attachment to
     return the correct result when the header has parameters as well as
     a value.

   - bpo-22247(155): Add NNTPError to nntplib.__all__.

   - bpo-22366(156): urllib.request.urlopen will accept a context object
     (SSLContext) as an argument which will then be used for HTTPS
     connection.  Patch by Alex Gaynor.

   - bpo-4180(157): The warnings registries are now reset when the
     filters are modified.

   - bpo-22419(158): Limit the length of incoming HTTP request in
     wsgiref server to 65536 bytes and send a 414 error code for higher
     lengths.  Patch contributed by Devin Cook.

   - Lax cookie parsing in http.cookies could be a security issue when
     combined with non-standard cookie handling in some web browsers.
     Reported by Sergey Bobrov.

   - bpo-20537(159): logging methods now accept an exception instance as
     well as a Boolean value or exception tuple.  Thanks to Yury
     Selivanov for the patch.

   - bpo-22384(160): An exception in Tkinter callback no longer crashes
     the program when it is run with pythonw.exe.

   - bpo-22168(161): Prevent turtle AttributeError with non-default
     Canvas on OS X.

   - bpo-21147(162): sqlite3 now raises an exception if the request
     contains a null character instead of truncating it.  Based on patch
     by Victor Stinner.

   - bpo-13968(163): The glob module now supports recursive search in
     subdirectories using the ‘**’ pattern.

   - bpo-21951(164): Fixed a crash in Tkinter on AIX when called Tcl
     command with empty string or tuple argument.

   - bpo-21951(165): Tkinter now most likely raises MemoryError instead
     of crash if the memory allocation fails.

   - bpo-22338(166): Fix a crash in the json module on memory allocation
     failure.

   - bpo-12410(167): imaplib.IMAP4 now supports the context management
     protocol.  Original patch by Tarek Ziadé.

   - bpo-21270(168): We now override tuple methods in mock.call objects
     so that they can be used as normal call attributes.

   - bpo-16662(169): ‘load_tests()’ is now unconditionally run when it
     is present in a package's ‘__init__.py’.
     ‘TestLoader.loadTestsFromModule()’ still accepts use_load_tests,
     but it is deprecated and ignored.  A new keyword-only attribute
     ‘pattern’ is added and documented.  Patch given by Robert Collins,
     tweaked by Barry Warsaw.

   - bpo-22226(170): First letter no longer is stripped from the
     "status" key in the result of Treeview.heading().

   - bpo-19524(171): Fixed resource leak in the HTTP connection when an
     invalid response is received.  Patch by Martin Panter.

   - bpo-20421(172): Add a .version() method to SSL sockets exposing the
     actual protocol version in use.

   - bpo-19546(173): configparser exceptions no longer expose
     implementation details.  Chained KeyErrors are removed, which leads
     to cleaner tracebacks.  Patch by Claudiu Popa.

   - bpo-22051(174): turtledemo no longer reloads examples to re-run
     them.  Initialization of variables and gui setup should be done in
     main(), which is called each time a demo is run, but not on import.

   - bpo-21933(175): Turtledemo users can change the code font size with
     a menu selection or control(command) '-' or '+' or
     control-mousewheel.  Original patch by Lita Cho.

   - bpo-21597(176): The separator between the turtledemo text pane and
     the drawing canvas can now be grabbed and dragged with a mouse.
     The code text pane can be widened to easily view or copy the full
     width of the text.  The canvas can be widened on small screens.
     Original patches by Jan Kanis and Lita Cho.

   - bpo-18132(177): Turtledemo buttons no longer disappear when the
     window is shrunk.  Original patches by Jan Kanis and Lita Cho.

   - bpo-22043(178): time.monotonic() is now always available.
     ‘threading.Lock.acquire()’, ‘threading.RLock.acquire()’ and socket
     operations now use a monotonic clock, instead of the system clock,
     when a timeout is used.

   - bpo-21527(179): Add a default number of workers to
     ThreadPoolExecutor equal to 5 times the number of CPUs.  Patch by
     Claudiu Popa.

   - bpo-22216(180): smtplib now resets its state more completely after
     a quit.  The most obvious consequence of the previous behavior was
     a STARTTLS failure during a connect/starttls/quit/connect/starttls
     sequence.

   - bpo-22098(181): ctypes' BigEndianStructure and
     LittleEndianStructure now define an empty __slots__ so that
     subclasses don't always get an instance dict.  Patch by Claudiu
     Popa.

   - bpo-22185(182): Fix an occasional RuntimeError in
     threading.Condition.wait() caused by mutation of the waiters queue
     without holding the lock.  Patch by Doug Zongker.

   - bpo-22287(183): On UNIX, _PyTime_gettimeofday() now uses
     clock_gettime(CLOCK_REALTIME) if available.  As a side effect,
     Python now depends on the librt library on Solaris and on Linux
     (only with glibc older than 2.17).

   - bpo-22182(184): Use e.args to unpack exceptions correctly in
     distutils.file_util.move_file.  Patch by Claudiu Popa.

   - The webbrowser module now uses subprocess's start_new_session=True
     rather than a potentially risky preexec_fn=os.setsid call.

   - bpo-22042(185): signal.set_wakeup_fd(fd) now raises an exception if
     the file descriptor is in blocking mode.

   - bpo-16808(186): inspect.stack() now returns a named tuple instead
     of a tuple.  Patch by Daniel Shahaf.

   - bpo-22236(187): Fixed Tkinter images copying operations in
     NoDefaultRoot mode.

   - bpo-2527(188): Add a 'globals' argument to timeit functions, in
     order to override the globals namespace in which the timed code is
     executed.  Patch by Ben Roberts.

   - bpo-22118(189): Switch urllib.parse to use RFC 3986 semantics for
     the resolution of relative URLs, rather than RFCs 1808 and 2396.
     Patch by Demian Brecht.

   - bpo-21549(190): Added the "members" parameter to TarFile.list().

   - bpo-19628(191): Allow compileall recursion depth to be specified
     with a -r option.

   - bpo-15696(192): Add a __sizeof__ implementation for mmap objects on
     Windows.

   - bpo-22068(193): Avoided reference loops with Variables and Fonts in
     Tkinter.

   - bpo-22165(194): SimpleHTTPRequestHandler now supports undecodable
     file names.

   - bpo-15381(195): Optimized line reading in io.BytesIO.

   - bpo-8797(196): Raise HTTPError on failed Basic Authentication
     immediately.  Initial patch by Sam Bull.

   - bpo-20729(197): Restored the use of lazy
     iterkeys()/itervalues()/iteritems() in the mailbox module.

   - bpo-21448(198): Changed FeedParser feed() to avoid 'O'('n'^2)
     behavior when parsing long line.  Original patch by Raymond
     Hettinger.

   - bpo-22184(199): The functools LRU Cache decorator factory now gives
     an earlier and clearer error message when the user forgets the
     required parameters.

   - bpo-17923(200): glob() patterns ending with a slash no longer match
     non-dirs on AIX. Based on patch by Delhallt.

   - bpo-21725(201): Added support for RFC 6531 (SMTPUTF8) in smtpd.

   - bpo-22176(202): Update the ctypes module's libffi to v3.1.  This
     release adds support for the Linux AArch64 and POWERPC ELF ABIv2
     little endian architectures.

   - bpo-5411(203): Added support for the "xztar" format in the shutil
     module.

   - bpo-21121(204): Don't force 3rd party C extensions to be built with
     -Werror=declaration-after-statement.

   - bpo-21975(205): Fixed crash when using uninitialized sqlite3.Row
     (in particular when unpickling pickled sqlite3.Row).  sqlite3.Row
     is now initialized in the __new__() method.

   - bpo-20170(206): Convert posixmodule to use Argument Clinic.

   - bpo-21539(207): Add an 'exists_ok' argument to ‘Pathlib.mkdir()’ to
     mimic ‘mkdir -p’ and ‘os.makedirs()’ functionality.  When true,
     ignore ‘FileExistsErrors’.  Patch by Berker Peksag.

   - bpo-22127(208): Bypass IDNA for pure-ASCII host names in the socket
     module (in particular for numeric IPs).

   - bpo-21047(209): set the default value for the 'convert_charrefs'
     argument of HTMLParser to True.  Patch by Berker Peksag.

   - Add an __all__ to html.entities.

   - bpo-15114(210): the strict mode and argument of HTMLParser,
     HTMLParser.error, and the HTMLParserError exception have been
     removed.

   - bpo-22085(211): Dropped support of Tk 8.3 in Tkinter.

   - bpo-21580(212): Now Tkinter correctly handles bytes arguments
     passed to Tk.  In particular this allows initializing images from
     binary data.

   - bpo-22003(213): When initialized from a bytes object, io.BytesIO()
     now defers making a copy until it is mutated, improving performance
     and memory use on some use cases.  Patch by David Wilson.

   - bpo-22018(214): On Windows, signal.set_wakeup_fd() now also
     supports sockets.  A side effect is that Python depends to the
     WinSock library.

   - bpo-22054(215): Add os.get_blocking() and os.set_blocking()
     functions to get and set the blocking mode of a file descriptor
     (False if the O_NONBLOCK flag is set, True otherwise).  These
     functions are not available on Windows.

   - bpo-17172(216): Make turtledemo start as active on OS X even when
     run with subprocess.  Patch by Lita Cho.

   - bpo-21704(217): Fix build error for _multiprocessing when
     semaphores are not available.  Patch by Arfrever Frehtes Taifersar
     Arahesis.

   - bpo-20173(218): Convert sha1, sha256, sha512 and md5 to
     ArgumentClinic.  Patch by Vajrasky Kok.

   - Fix repr(_socket.socket) on Windows 64-bit: don't fail with
     OverflowError on closed socket.  repr(socket.socket) already works
     fine.

   - bpo-22033(219): Reprs of most Python implemented classes now
     contain actual class name instead of hardcoded one.

   - bpo-21947(220): The dis module can now disassemble
     generator-iterator objects based on their gi_code attribute.  Patch
     by Clement Rouault.

   - bpo-16133(221): The asynchat.async_chat.handle_read() method now
     ignores BlockingIOError exceptions.

   - bpo-22044(222): Fixed premature DECREF in call_tzinfo_method.
     Patch by Tom Flanagan.

   - bpo-19884(223): readline: Disable the meta modifier key if stdout
     is not a terminal to not write the ANSI sequence ‘"\033[1034h"’
     into stdout.  This sequence is used on some terminal (ex:
     TERM=xterm-256color") to enable support of 8 bit characters.

   - bpo-4350(224): Removed a number of out-of-dated and non-working for
     a long time Tkinter methods.

   - bpo-6167(225): Scrollbar.activate() now returns the name of active
     element if the argument is not specified.  Scrollbar.set() now
     always accepts only 2 arguments.

   - bpo-15275(226): Clean up and speed up the ntpath module.

   - bpo-21888(227): plistlib's load() and loads() now work if the fmt
     parameter is specified.

   - bpo-22032(228): __qualname__ instead of __name__ is now always used
     to format fully qualified class names of Python implemented
     classes.

   - bpo-22031(229): Reprs now always use hexadecimal format with the
     "0x" prefix when contain an id in form " at 0x...".

   - bpo-22018(230): signal.set_wakeup_fd() now raises an OSError
     instead of a ValueError on ‘fstat()’ failure.

   - bpo-21044(231): tarfile.open() now handles fileobj with an integer
     'name' attribute.  Based on patch by Antoine Pietri.

   - bpo-21966(232): Respect -q command-line option when code module is
     ran.

   - bpo-19076(233): Don't pass the redundant 'file' argument to
     self.error().

   - bpo-16382(234): Improve exception message of warnings.warn() for
     bad category.  Initial patch by Phil Elson.

   - bpo-21932(235): os.read() now uses a *note Py_ssize_t(): c55. type
     instead of int for the size to support reading more than 2 GB at
     once.  On Windows, the size is truncated to INT_MAX. As any call to
     os.read(), the OS may read less bytes than the number of requested
     bytes.

   - bpo-21942(236): Fixed source file viewing in pydoc's server mode on
     Windows.

   - bpo-11259(237): asynchat.async_chat().set_terminator() now raises a
     ValueError if the number of received bytes is negative.

   - bpo-12523(238): asynchat.async_chat.push() now raises a TypeError
     if it doesn't get a bytes string

   - bpo-21707(239): Add missing kwonlyargcount argument to
     ModuleFinder.replace_paths_in_code().

   - bpo-20639(240): calling Path.with_suffix('') allows removing the
     suffix again.  Patch by July Tikhonov.

   - bpo-21714(241): Disallow the construction of invalid paths using
     Path.with_name().  Original patch by Antony Lee.

   - bpo-15014(242): Added 'auth' method to smtplib to make implementing
     auth mechanisms simpler, and used it internally in the login
     method.

   - bpo-21151(243): Fixed a segfault in the winreg module when ‘None’
     is passed as a ‘REG_BINARY’ value to SetValueEx.  Patch by John
     Ehresman.

   - bpo-21090(244): io.FileIO.readall() does not ignore I/O errors
     anymore.  Before, it ignored I/O errors if at least the first C
     call read() succeed.

   - bpo-5800(245): headers parameter of wsgiref.headers.Headers is now
     optional.  Initial patch by Pablo Torres Navarrete and SilentGhost.

   - bpo-21781(246): ssl.RAND_add() now supports strings longer than 2
     GB.

   - bpo-21679(247): Prevent extraneous fstat() calls during open().
     Patch by Bohuslav Kabrda.

   - bpo-21863(248): cProfile now displays the module name of C
     extension functions, in addition to their own name.

   - bpo-11453(249): asyncore: emit a ResourceWarning when an unclosed
     file_wrapper object is destroyed.  The destructor now closes the
     file if needed.  The close() method can now be called twice: the
     second call does nothing.

   - bpo-21858(250): Better handling of Python exceptions in the sqlite3
     module.

   - bpo-21476(251): Make sure the email.parser.BytesParser
     TextIOWrapper is discarded after parsing, so the input file isn't
     unexpectedly closed.

   - bpo-20295(252): imghdr now recognizes OpenEXR format images.

   - bpo-21729(253): Used the "with" statement in the dbm.dumb module to
     ensure files closing.  Patch by Claudiu Popa.

   - bpo-21491(254): socketserver: Fix a race condition in child
     processes reaping.

   - bpo-21719(255): Added the ‘st_file_attributes’ field to
     os.stat_result on Windows.

   - bpo-21832(256): Require named tuple inputs to be exact strings.

   - bpo-21722(257): The distutils "upload" command now exits with a
     non-zero return code when uploading fails.  Patch by Martin
     Dengler.

   - bpo-21723(258): asyncio.Queue: support any type of number (ex:
     float) for the maximum size.  Patch written by Vajrasky Kok.

   - bpo-21711(259): support for "site-python" directories has now been
     removed from the site module (it was deprecated in 3.4).

   - bpo-17552(260): new socket.sendfile() method allowing a file to be
     sent over a socket by using high-performance os.sendfile() on UNIX.
     Patch by Giampaolo Rodola'.

   - bpo-18039(261): dbm.dump.open() now always creates a new database
     when the flag has the value 'n'.  Patch by Claudiu Popa.

   - bpo-21326(262): Add a new is_closed() method to
     asyncio.BaseEventLoop.  run_forever() and run_until_complete()
     methods of asyncio.BaseEventLoop now raise an exception if the
     event loop was closed.

   - bpo-21766(263): Prevent a security hole in CGIHTTPServer by URL
     unquoting paths before checking for a CGI script at that path.

   - bpo-21310(264): Fixed possible resource leak in failed open().

   - bpo-21256(265): Printout of keyword args should be in deterministic
     order in a mock function call.  This will help to write better
     doctests.

   - bpo-21677(266): Fixed chaining nonnormalized exceptions in io
     close() methods.

   - bpo-11709(267): Fix the pydoc.help function to not fail when
     sys.stdin is not a valid file.

   - bpo-21515(268): tempfile.TemporaryFile now uses os.O_TMPFILE flag
     is available.

   - bpo-13223(269): Fix pydoc.writedoc so that the HTML documentation
     for methods that use 'self' in the example code is generated
     correctly.

   - bpo-21463(270): In urllib.request, fix pruning of the FTP cache.

   - bpo-21618(271): The subprocess module could fail to close open fds
     that were inherited by the calling process and already higher than
     POSIX resource limits would otherwise allow.  On systems with a
     functioning /proc/self/fd or /dev/fd interface the max is now
     ignored and all fds are closed.

   - bpo-20383(272): Introduce importlib.util.module_from_spec() as the
     preferred way to create a new module.

   - bpo-21552(273): Fixed possible integer overflow of too long string
     lengths in the tkinter module on 64-bit platforms.

   - bpo-14315(274): The zipfile module now ignores extra fields in the
     central directory that are too short to be parsed instead of
     letting a struct.unpack error bubble up as this "bad data" appears
     in many real world zip files in the wild and is ignored by other
     zip tools.

   - bpo-13742(275): Added "key" and "reverse" parameters to
     heapq.merge().  (First draft of patch contributed by Simon Sapin.)

   - bpo-21402(276): tkinter.ttk now works when default root window is
     not set.

   - bpo-3015(277): ‘_tkinter.create()’ now creates ‘tkapp’ object with
     ‘wantobjects=1’ by default.

   - bpo-10203(278): sqlite3.Row now truly supports sequence protocol.
     In particular it supports reverse() and negative indices.  Original
     patch by Claudiu Popa.

   - bpo-18807(279): If copying (no symlinks) specified for a venv, then
     the python interpreter aliases (python, python3) are now created by
     copying rather than symlinking.

   - bpo-20197(280): Added support for the WebP image type in the imghdr
     module.  Patch by Fabrice Aneche and Claudiu Popa.

   - bpo-21513(281): Speedup some properties of IP addresses
     (IPv4Address, IPv6Address) such as .is_private or .is_multicast.

   - bpo-21137(282): Improve the repr for threading.Lock() and its
     variants by showing the "locked" or "unlocked" status.  Patch by
     Berker Peksag.

   - bpo-21538(283): The plistlib module now supports loading of binary
     plist files when reference or offset size is not a power of two.

   - bpo-21455(284): Add a default backlog to socket.listen().

   - bpo-21525(285): Most Tkinter methods which accepted tuples now
     accept lists too.

   - bpo-22166(286): With the assistance of a new internal
     _codecs._forget_codec helping function, test_codecs now clears the
     encoding caches to avoid the appearance of a reference leak

   - bpo-22236(287): Tkinter tests now don't reuse default root window.
     New root window is created for every test class.

   - bpo-10744(288): Fix PEP 3118(289) format strings on ctypes objects
     with a nontrivial shape.

   - bpo-20826(290): Optimize ipaddress.collapse_addresses().

   - bpo-21487(291): Optimize ipaddress.summarize_address_range() and
     ipaddress.{IPv4Network,IPv6Network}.subnets().

   - bpo-21486(292): Optimize parsing of netmasks in
     ipaddress.IPv4Network and ipaddress.IPv6Network.

   - bpo-13916(293): Disallowed the surrogatepass error handler for non
     UTF-* encodings.

   - bpo-20998(294): Fixed re.fullmatch() of repeated single character
     pattern with ignore case.  Original patch by Matthew Barnett.

   - bpo-21075(295): fileinput.FileInput now reads bytes from standard
     stream if binary mode is specified.  Patch by Sam Kimbrel.

   - bpo-19775(296): Add a samefile() method to pathlib Path objects.
     Initial patch by Vajrasky Kok.

   - bpo-21226(297): Set up modules properly in
     PyImport_ExecCodeModuleObject (and friends).

   - bpo-21398(298): Fix a unicode error in the pydoc pager when the
     documentation contains characters not encodable to the stdout
     encoding.

   - bpo-16531(299): ipaddress.IPv4Network and ipaddress.IPv6Network now
     accept an (address, netmask) tuple argument, so as to easily
     construct network objects from existing addresses.

   - bpo-21156(300): importlib.abc.InspectLoader.source_to_code() is now
     a staticmethod.

   - bpo-21424(301): Simplified and optimized heaqp.nlargest() and
     nmsmallest() to make fewer tuple comparisons.

   - bpo-21396(302): Fix TextIOWrapper(..., write_through=True) to not
     force a flush() on the underlying binary stream.  Patch by akira.

   - bpo-18314(303): Unlink now removes junctions on Windows.  Patch by
     Kim Gräsman

   - bpo-21088(304): Bugfix for curses.window.addch() regression in
     3.4.0.  In porting to Argument Clinic, the first two arguments were
     reversed.

   - bpo-21407(305): _decimal: The module now supports function
     signatures.

   - bpo-10650(306): Remove the non-standard 'watchexp' parameter from
     the Decimal.quantize() method in the Python version.  It had never
     been present in the C version.

   - bpo-21469(307): Reduced the risk of false positives in robotparser
     by checking to make sure that robots.txt has been read or does not
     exist prior to returning True in can_fetch().

   - bpo-19414(308): Have the OrderedDict mark deleted links as
     unusable.  This gives an early failure if the link is deleted
     during iteration.

   - bpo-21421(309): Add __slots__ to the MappingViews ABC. Patch by
     Josh Rosenberg.

   - bpo-21101(310): Eliminate double hashing in the C speed-up code for
     collections.Counter().

   - bpo-21321(311): itertools.islice() now releases the reference to
     the source iterator when the slice is exhausted.  Patch by Anton
     Afanasyev.

   - bpo-21057(312): TextIOWrapper now allows the underlying binary
     stream's read() or read1() method to return an arbitrary bytes-like
     object (such as a memoryview).  Patch by Nikolaus Rath.

   - bpo-20951(313): SSLSocket.send() now raises either SSLWantReadError
     or SSLWantWriteError on a non-blocking socket if the operation
     would block.  Previously, it would return 0.  Patch by Nikolaus
     Rath.

   - bpo-13248(314): removed previously deprecated asyncore.dispatcher
     __getattr__ cheap inheritance hack.

   - bpo-9815(315): assertRaises now tries to clear references to local
     variables in the exception's traceback.

   - bpo-19940(316): ssl.cert_time_to_seconds() now interprets the given
     time string in the UTC timezone (as specified in RFC 5280), not the
     local timezone.

   - bpo-13204(317): Calling sys.flags.__new__ would crash the
     interpreter, now it raises a TypeError.

   - bpo-19385(318): Make operations on a closed dbm.dumb database
     always raise the same exception.

   - bpo-21207(319): Detect when the os.urandom cached fd has been
     closed or replaced, and open it anew.

   - bpo-21291(320): subprocess's Popen.wait() is now thread safe so
     that multiple threads may be calling wait() or poll() on a Popen
     instance at the same time without losing the Popen.returncode
     value.

   - bpo-21127(321): Path objects can now be instantiated from str
     subclass instances (such as ‘numpy.str_’).

   - bpo-15002(322): urllib.response object to use _TemporaryFileWrapper
     (and _TemporaryFileCloser) facility.  Provides a better way to
     handle file descriptor close.  Patch contributed by Christian
     Theune.

   - bpo-12220(323): mindom now raises a custom ValueError indicating it
     doesn't support spaces in URIs instead of letting a 'split'
     ValueError bubble up.

   - bpo-21068(324): The ssl.PROTOCOL* constants are now enum members.

   - bpo-21276(325): posixmodule: Don't define USE_XATTRS on KFreeBSD
     and the Hurd.

   - bpo-21262(326): New method assert_not_called for Mock.  It raises
     AssertionError if the mock has been called.

   - bpo-21238(327): New keyword argument ‘unsafe’ to Mock.  It raises
     ‘AttributeError’ in case of an attribute startswith assert or
     assret.

   - bpo-20896(328): ssl.get_server_certificate() now uses
     PROTOCOL_SSLv23, not PROTOCOL_SSLv3, for maximum compatibility.

   - bpo-21239(329): patch.stopall() didn't work deterministically when
     the same name was patched more than once.

   - bpo-21203(330): Updated fileConfig and dictConfig to remove
     inconsistencies.  Thanks to Jure Koren for the patch.

   - bpo-21222(331): Passing name keyword argument to
     mock.create_autospec now works.

   - bpo-21197(332): Add lib64 -> lib symlink in venvs on 64-bit non-OS
     X POSIX.

   - bpo-17498(333): Some SMTP servers disconnect after certain errors,
     violating strict RFC conformance.  Instead of losing the error code
     when we issue the subsequent RSET, smtplib now returns the error
     code and defers raising the SMTPServerDisconnected error until the
     next command is issued.

   - bpo-17826(334): setting an iterable side_effect on a mock function
     created by create_autospec now works.  Patch by Kushal Das.

   - bpo-7776(335): Fix ‘Host:’ header and reconnection when using
     http.client.HTTPConnection.set_tunnel().  Patch by Nikolaus Rath.

   - bpo-20968(336): unittest.mock.MagicMock now supports division.
     Patch by Johannes Baiter.

   - bpo-21529(337): Fix arbitrary memory access in
     JSONDecoder.raw_decode with a negative second parameter.  Bug
     reported by Guido Vranken.  (See also: CVE 2014-4616(338))

   - bpo-21169(339): getpass now handles non-ascii characters that the
     input stream encoding cannot encode by re-encoding using the
     replace error handler.

   - bpo-21171(340): Fixed undocumented filter API of the rot13 codec.
     Patch by Berker Peksag.

   - bpo-20539(341): Improved math.factorial error message for large
     positive inputs and changed exception type (OverflowError ->
     ValueError) for large negative inputs.

   - bpo-21172(342): isinstance check relaxed from dict to
     collections.Mapping.

   - bpo-21155(343): asyncio.EventLoop.create_unix_server() now raises a
     ValueError if path and sock are specified at the same time.

   - bpo-21136(344): Avoid unnecessary normalization of Fractions
     resulting from power and other operations.  Patch by Raymond
     Hettinger.

   - bpo-17621(345): Introduce importlib.util.LazyLoader.

   - bpo-21076(346): signal module constants were turned into enums.
     Patch by Giampaolo Rodola'.

   - bpo-20636(347): Improved the repr of Tkinter widgets.

   - bpo-19505(348): The items, keys, and values views of OrderedDict
     now support reverse iteration using reversed().

   - bpo-21149(349): Improved thread-safety in logging cleanup during
     interpreter shutdown.  Thanks to Devin Jeanpierre for the patch.

   - bpo-21058(350): Fix a leak of file descriptor in *note
     tempfile.NamedTemporaryFile(): 6ed, close the file descriptor if
     *note io.open(): 740. fails

   - bpo-21200(351): Return None from pkgutil.get_loader() when __spec__
     is missing.

   - bpo-21013(352): Enhance ssl.create_default_context() when used for
     server side sockets to provide better security by default.

   - bpo-20145(353): ‘assertRaisesRegex’ and ‘assertWarnsRegex’ now
     raise a ‘TypeError’ if the second argument is not a string or
     compiled regex.

   - bpo-20633(354): Replace relative import by absolute import.

   - bpo-20980(355): Stop wrapping exception when using ThreadPool.

   - bpo-21082(356): In os.makedirs, do not set the process-wide umask.
     Note this changes behavior of makedirs when exist_ok=True.

   - bpo-20990(357): Fix issues found by pyflakes for multiprocessing.

   - bpo-21015(358): SSL contexts will now automatically select an
     elliptic curve for ECDH key exchange on OpenSSL 1.0.2 and later,
     and otherwise default to "prime256v1".

   - bpo-21000(359): Improve the command-line interface of json.tool.

   - bpo-20995(360): Enhance default ciphers used by the ssl module to
     enable better security and prioritize perfect forward secrecy.

   - bpo-20884(361): Don't assume that __file__ is defined on
     importlib.__init__.

   - bpo-21499(362): Ignore __builtins__ in several
     test_importlib.test_api tests.

   - bpo-20627(363): xmlrpc.client.ServerProxy is now a context manager.

   - bpo-19165(364): The formatter module now raises DeprecationWarning
     instead of PendingDeprecationWarning.

   - bpo-13936(365): Remove the ability of datetime.time instances to be
     considered false in boolean contexts.

   - bpo-18931(366): selectors module now supports /dev/poll on Solaris.
     Patch by Giampaolo Rodola'.

   - bpo-19977(367): When the ‘LC_TYPE’ locale is the POSIX locale (‘C’
     locale), *note sys.stdin: 75f. and *note sys.stdout: ccd. are now
     using the ‘surrogateescape’ error handler, instead of the ‘strict’
     error handler.

   - bpo-20574(368): Implement incremental decoder for cp65001 code
     (Windows code page 65001, Microsoft UTF-8).

   - bpo-20879(369): Delay the initialization of encoding and decoding
     tables for base32, ascii85 and base85 codecs in the base64 module,
     and delay the initialization of the unquote_to_bytes() table of the
     urllib.parse module, to not waste memory if these modules are not
     used.

   - bpo-19157(370): Include the broadcast address in the usable hosts
     for IPv6 in ipaddress.

   - bpo-11599(371): When an external command (e.g.  compiler) fails,
     distutils now prints out the whole command line (instead of just
     the command name) if the environment variable DISTUTILS_DEBUG is
     set.

   - bpo-4931(372): distutils should not produce unhelpful "error: None"
     messages anymore.  distutils.util.grok_environment_error is kept
     but doc-deprecated.

   - bpo-20875(373): Prevent possible gzip "'read' is not defined"
     NameError.  Patch by Claudiu Popa.

   - bpo-11558(374): ‘email.message.Message.attach’ now returns a more
     useful error message if ‘attach’ is called on a message for which
     ‘is_multipart’ is False.

   - bpo-20283(375): RE pattern methods now accept the string keyword
     parameters as documented.  The pattern and source keyword
     parameters are left as deprecated aliases.

   - bpo-20778(376): Fix modulefinder to work with bytecode-only
     modules.

   - bpo-20791(377): copy.copy() now doesn't make a copy when the input
     is a bytes object.  Initial patch by Peter Otten.

   - bpo-19748(378): On AIX, time.mktime() now raises an OverflowError
     for year outsize range [1902; 2037].

   - bpo-19573(379): inspect.signature: Use enum for parameter kind
     constants.

   - bpo-20726(380): inspect.signature: Make Signature and Parameter
     picklable.

   - bpo-17373(381): Add inspect.Signature.from_callable method.

   - bpo-20378(382): Improve repr of inspect.Signature and
     inspect.Parameter.

   - bpo-20816(383): Fix inspect.getcallargs() to raise correct
     TypeError for missing keyword-only arguments.  Patch by Jeremiah
     Lowin.

   - bpo-20817(384): Fix inspect.getcallargs() to fail correctly if more
     than 3 arguments are missing.  Patch by Jeremiah Lowin.

   - bpo-6676(385): Ensure a meaningful exception is raised when
     attempting to parse more than one XML document per pyexpat
     xmlparser instance.  (Original patches by Hirokazu Yamamoto and
     Amaury Forgeot d'Arc, with suggested wording by David Gutteridge)

   - bpo-21117(386): Fix inspect.signature to better support
     functools.partial.  Due to the specifics of functools.partial
     implementation, positional-or-keyword arguments passed as keyword
     arguments become keyword-only.

   - bpo-20334(387): inspect.Signature and inspect.Parameter are now
     hashable.  Thanks to Antony Lee for bug reports and suggestions.

   - bpo-15916(388): doctest.DocTestSuite returns an empty
     unittest.TestSuite instead of raising ValueError if it finds no
     tests

   - bpo-21209(389): Fix asyncio.tasks.CoroWrapper to workaround a bug
     in yield-from implementation in CPythons prior to 3.4.1.

   - asyncio: Add gi_{frame,running,code} properties to CoroWrapper
     (upstream bpo-163(390)).

   - bpo-21311(391): Avoid exception in _osx_support with non-standard
     compiler configurations.  Patch by John Szakmeister.

   - bpo-11571(392): Ensure that the turtle window becomes the topmost
     window when launched on OS X.

   - bpo-21801(393): Validate that __signature__ is None or an instance
     of Signature.

   - bpo-21923(394): Prevent AttributeError in
     distutils.sysconfig.customize_compiler due to possible
     uninitialized _config_vars.

   - bpo-21323(395): Fix http.server to again handle scripts in CGI
     subdirectories, broken by the fix for security bpo-19435(396).
     Patch by Zach Byrne.

   - bpo-22733(397): Fix ffi_prep_args not zero-extending argument
     values correctly on 64-bit Windows.

   - bpo-23302(398): Default to TCP_NODELAY=1 upon establishing an
     HTTPConnection.  Removed use of hard-coded MSS as it's an
     optimization that's no longer needed with Nagle disabled.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23399

   (2) https://bugs.python.org/issue?@action=redirect&bpo=20289

   (3) https://bugs.python.org/issue?@action=redirect&bpo=13128

   (4) https://bugs.python.org/issue?@action=redirect&bpo=15381

   (5) https://bugs.python.org/issue?@action=redirect&bpo=22818

   (6) https://bugs.python.org/issue?@action=redirect&bpo=23099

   (7) https://bugs.python.org/issue?@action=redirect&bpo=23326

   (8) https://bugs.python.org/issue?@action=redirect&bpo=21408

   (9) https://bugs.python.org/issue?@action=redirect&bpo=23363

   (10) https://bugs.python.org/issue?@action=redirect&bpo=23364

   (11) https://bugs.python.org/issue?@action=redirect&bpo=23366

   (12) https://bugs.python.org/issue?@action=redirect&bpo=23369

   (13) https://bugs.python.org/issue?@action=redirect&bpo=23353

   (14) https://bugs.python.org/issue?@action=redirect&bpo=14099

   (15) https://bugs.python.org/issue?@action=redirect&bpo=14099

   (16) https://bugs.python.org/issue?@action=redirect&bpo=19361

   (17) https://bugs.python.org/issue?@action=redirect&bpo=18518

   (18) https://bugs.python.org/issue?@action=redirect&bpo=23094

   (19) https://bugs.python.org/issue?@action=redirect&bpo=23268

   (20) https://bugs.python.org/issue?@action=redirect&bpo=21408

   (21) https://bugs.python.org/issue?@action=redirect&bpo=19996

   (22) https://bugs.python.org/issue?@action=redirect&bpo=20188

   (23) https://bugs.python.org/issue?@action=redirect&bpo=23133

   (24) https://bugs.python.org/issue?@action=redirect&bpo=23248

   (25) https://bugs.python.org/issue?@action=redirect&bpo=23266

   (26) https://bugs.python.org/issue?@action=redirect&bpo=23098

   (27) https://bugs.python.org/issue?@action=redirect&bpo=21817

   (28) https://bugs.python.org/issue?@action=redirect&bpo=15955

   (29) https://bugs.python.org/issue?@action=redirect&bpo=23250

   (30) https://bugs.python.org/issue?@action=redirect&bpo=23063

   (31) https://bugs.python.org/issue?@action=redirect&bpo=23209

   (32) https://bugs.python.org/issue?@action=redirect&bpo=23225

   (33) https://bugs.python.org/issue?@action=redirect&bpo=17911

   (34) https://bugs.python.org/issue?@action=redirect&bpo=17911

   (35) https://bugs.python.org/issue?@action=redirect&bpo=19777

   (36) https://bugs.python.org/issue?@action=redirect&bpo=23206

   (37) https://bugs.python.org/issue?@action=redirect&bpo=23185

   (38) https://bugs.python.org/issue?@action=redirect&bpo=23186

   (39) https://bugs.python.org/issue?@action=redirect&bpo=23143

   (40) https://bugs.python.org/issue?@action=redirect&bpo=23132

   (41) https://bugs.python.org/issue?@action=redirect&bpo=19776

   (42) https://bugs.python.org/issue?@action=redirect&bpo=23112

   (43) https://bugs.python.org/issue?@action=redirect&bpo=21793

   (44) https://bugs.python.org/issue?@action=redirect&bpo=23093

   (45) https://bugs.python.org/issue?@action=redirect&bpo=23111

   (46) https://bugs.python.org/issue?@action=redirect&bpo=22585

   (47) https://bugs.python.org/issue?@action=redirect&bpo=19104

   (48) https://bugs.python.org/issue?@action=redirect&bpo=23071

   (49) https://bugs.python.org/issue?@action=redirect&bpo=22783

   (50) https://bugs.python.org/issue?@action=redirect&bpo=15513

   (51) https://bugs.python.org/issue?@action=redirect&bpo=19858

   (52) https://bugs.python.org/issue?@action=redirect&bpo=22095

   (53) https://bugs.python.org/issue?@action=redirect&bpo=23016

   (54) https://bugs.python.org/issue?@action=redirect&bpo=21775

   (55) https://bugs.python.org/issue?@action=redirect&bpo=1218234

   (56) https://bugs.python.org/issue?@action=redirect&bpo=21740

   (57) https://bugs.python.org/issue?@action=redirect&bpo=23009

   (58) https://bugs.python.org/issue?@action=redirect&bpo=22959

   (59) https://bugs.python.org/issue?@action=redirect&bpo=22696

   (60) https://bugs.python.org/issue?@action=redirect&bpo=16043

   (61) https://www.cve.org/CVERecord?id=CVE-2013-1753

   (62) https://bugs.python.org/issue?@action=redirect&bpo=14099

   (63) https://bugs.python.org/issue?@action=redirect&bpo=22966

   (64) https://bugs.python.org/issue?@action=redirect&bpo=21971

   (65) https://bugs.python.org/issue?@action=redirect&bpo=21032

   (66) https://bugs.python.org/issue?@action=redirect&bpo=22407

   (67) https://bugs.python.org/issue?@action=redirect&bpo=22902

   (68) https://bugs.python.org/issue?@action=redirect&bpo=22960

   (69) https://bugs.python.org/issue?@action=redirect&bpo=22389

   (70) https://bugs.python.org/issue?@action=redirect&bpo=21356

   (71) https://bugs.python.org/issue?@action=redirect&bpo=22915

   (72) https://bugs.python.org/issue?@action=redirect&bpo=22609

   (73) https://bugs.python.org/issue?@action=redirect&bpo=22940

   (74) https://bugs.python.org/issue?@action=redirect&bpo=19676

   (75) https://bugs.python.org/issue?@action=redirect&bpo=22788

   (76) https://bugs.python.org/issue?@action=redirect&bpo=22921

   (77) https://bugs.python.org/issue?@action=redirect&bpo=22894

   (78) https://bugs.python.org/issue?@action=redirect&bpo=22796

   (79) https://bugs.python.org/issue?@action=redirect&bpo=22370

   (80) https://bugs.python.org/issue?@action=redirect&bpo=22841

   (81) https://bugs.python.org/issue?@action=redirect&bpo=19494

   (82) https://bugs.python.org/issue?@action=redirect&bpo=22578

   (83) https://bugs.python.org/issue?@action=redirect&bpo=22849

   (84) https://bugs.python.org/issue?@action=redirect&bpo=12728

   (85) https://bugs.python.org/issue?@action=redirect&bpo=22821

   (86) https://bugs.python.org/issue?@action=redirect&bpo=21650

   (87) https://bugs.python.org/issue?@action=redirect&bpo=22824

   (88) https://bugs.python.org/issue?@action=redirect&bpo=22824

   (89) https://bugs.python.org/issue?@action=redirect&bpo=22406

   (90) https://bugs.python.org/issue?@action=redirect&bpo=17293

   (91) https://bugs.python.org/issue?@action=redirect&bpo=22769

   (92) https://bugs.python.org/issue?@action=redirect&bpo=22417

   (93) https://bugs.python.org/issue?@action=redirect&bpo=22775

   (94) https://bugs.python.org/issue?@action=redirect&bpo=22776

   (95) https://bugs.python.org/issue?@action=redirect&bpo=22665

   (96) https://bugs.python.org/issue?@action=redirect&bpo=6623

   (97) https://bugs.python.org/issue?@action=redirect&bpo=17381

   (98) https://bugs.python.org/issue?@action=redirect&bpo=22410

   (99) https://bugs.python.org/issue?@action=redirect&bpo=22759

   (100) https://bugs.python.org/issue?@action=redirect&bpo=8876

   (101) https://bugs.python.org/issue?@action=redirect&bpo=22217

   (102) https://bugs.python.org/issue?@action=redirect&bpo=22457

   (103) https://bugs.python.org/issue?@action=redirect&bpo=18216

   (104) https://bugs.python.org/issue?@action=redirect&bpo=13918

   (105) https://bugs.python.org/issue?@action=redirect&bpo=22676

   (106) https://bugs.python.org/issue?@action=redirect&bpo=18853

   (107) https://bugs.python.org/issue?@action=redirect&bpo=9351

   (108) https://bugs.python.org/issue?@action=redirect&bpo=7559

   (109) https://bugs.python.org/issue?@action=redirect&bpo=19746

   (110) https://bugs.python.org/issue?@action=redirect&bpo=21991

   (111) https://bugs.python.org/issue?@action=redirect&bpo=22638

   (112) https://bugs.python.org/issue?@action=redirect&bpo=22641

   (113) https://bugs.python.org/issue?@action=redirect&bpo=17401

   (114) https://bugs.python.org/issue?@action=redirect&bpo=21338

   (115) https://bugs.python.org/issue?@action=redirect&bpo=20152

   (116) https://bugs.python.org/issue?@action=redirect&bpo=18643

   (117) https://bugs.python.org/issue?@action=redirect&bpo=22435

   (118) https://bugs.python.org/issue?@action=redirect&bpo=13096

   (119) https://bugs.python.org/issue?@action=redirect&bpo=11694

   (120) https://bugs.python.org/issue?@action=redirect&bpo=19380

   (121) https://bugs.python.org/issue?@action=redirect&bpo=1519638

   (122) https://bugs.python.org/issue?@action=redirect&bpo=18615

   (123) https://bugs.python.org/issue?@action=redirect&bpo=22462

   (124) https://bugs.python.org/issue?@action=redirect&bpo=21965

   (125) https://bugs.python.org/issue?@action=redirect&bpo=21173

   (126) https://bugs.python.org/issue?@action=redirect&bpo=11866

   (127) https://bugs.python.org/issue?@action=redirect&bpo=21905

   (128) https://bugs.python.org/issue?@action=redirect&bpo=11271

   (129) https://bugs.python.org/issue?@action=redirect&bpo=21883

   (130) https://bugs.python.org/issue?@action=redirect&bpo=22219

   (131) https://bugs.python.org/issue?@action=redirect&bpo=22449

   (132) https://bugs.python.org/issue?@action=redirect&bpo=22508

   (133) https://bugs.python.org/issue?@action=redirect&bpo=20076

   (134) https://bugs.python.org/issue?@action=redirect&bpo=20079

   (135) https://bugs.python.org/issue?@action=redirect&bpo=20218

   (136) https://bugs.python.org/issue?@action=redirect&bpo=22396

   (137) https://bugs.python.org/issue?@action=redirect&bpo=22517

   (138) https://bugs.python.org/issue?@action=redirect&bpo=22437

   (139) https://bugs.python.org/issue?@action=redirect&bpo=17442

   (140) https://bugs.python.org/issue?@action=redirect&bpo=23392

   (141) https://bugs.python.org/issue?@action=redirect&bpo=10510

   (142) https://bugs.python.org/issue?@action=redirect&bpo=9850

   (143) https://bugs.python.org/issue?@action=redirect&bpo=5309

   (144) https://bugs.python.org/issue?@action=redirect&bpo=22448

   (145) https://bugs.python.org/issue?@action=redirect&bpo=22427

   (146) https://bugs.python.org/issue?@action=redirect&bpo=22362

   (147) https://bugs.python.org/issue?@action=redirect&bpo=20912

   (148) https://bugs.python.org/issue?@action=redirect&bpo=21866

   (149) https://bugs.python.org/issue?@action=redirect&bpo=22278

   (150) https://bugs.python.org/issue?@action=redirect&bpo=22415

   (151) https://bugs.python.org/issue?@action=redirect&bpo=22423

   (152) https://bugs.python.org/issue?@action=redirect&bpo=21332

   (153) https://bugs.python.org/issue?@action=redirect&bpo=21091

   (154) https://bugs.python.org/issue?@action=redirect&bpo=21079

   (155) https://bugs.python.org/issue?@action=redirect&bpo=22247

   (156) https://bugs.python.org/issue?@action=redirect&bpo=22366

   (157) https://bugs.python.org/issue?@action=redirect&bpo=4180

   (158) https://bugs.python.org/issue?@action=redirect&bpo=22419

   (159) https://bugs.python.org/issue?@action=redirect&bpo=20537

   (160) https://bugs.python.org/issue?@action=redirect&bpo=22384

   (161) https://bugs.python.org/issue?@action=redirect&bpo=22168

   (162) https://bugs.python.org/issue?@action=redirect&bpo=21147

   (163) https://bugs.python.org/issue?@action=redirect&bpo=13968

   (164) https://bugs.python.org/issue?@action=redirect&bpo=21951

   (165) https://bugs.python.org/issue?@action=redirect&bpo=21951

   (166) https://bugs.python.org/issue?@action=redirect&bpo=22338

   (167) https://bugs.python.org/issue?@action=redirect&bpo=12410

   (168) https://bugs.python.org/issue?@action=redirect&bpo=21270

   (169) https://bugs.python.org/issue?@action=redirect&bpo=16662

   (170) https://bugs.python.org/issue?@action=redirect&bpo=22226

   (171) https://bugs.python.org/issue?@action=redirect&bpo=19524

   (172) https://bugs.python.org/issue?@action=redirect&bpo=20421

   (173) https://bugs.python.org/issue?@action=redirect&bpo=19546

   (174) https://bugs.python.org/issue?@action=redirect&bpo=22051

   (175) https://bugs.python.org/issue?@action=redirect&bpo=21933

   (176) https://bugs.python.org/issue?@action=redirect&bpo=21597

   (177) https://bugs.python.org/issue?@action=redirect&bpo=18132

   (178) https://bugs.python.org/issue?@action=redirect&bpo=22043

   (179) https://bugs.python.org/issue?@action=redirect&bpo=21527

   (180) https://bugs.python.org/issue?@action=redirect&bpo=22216

   (181) https://bugs.python.org/issue?@action=redirect&bpo=22098

   (182) https://bugs.python.org/issue?@action=redirect&bpo=22185

   (183) https://bugs.python.org/issue?@action=redirect&bpo=22287

   (184) https://bugs.python.org/issue?@action=redirect&bpo=22182

   (185) https://bugs.python.org/issue?@action=redirect&bpo=22042

   (186) https://bugs.python.org/issue?@action=redirect&bpo=16808

   (187) https://bugs.python.org/issue?@action=redirect&bpo=22236

   (188) https://bugs.python.org/issue?@action=redirect&bpo=2527

   (189) https://bugs.python.org/issue?@action=redirect&bpo=22118

   (190) https://bugs.python.org/issue?@action=redirect&bpo=21549

   (191) https://bugs.python.org/issue?@action=redirect&bpo=19628

   (192) https://bugs.python.org/issue?@action=redirect&bpo=15696

   (193) https://bugs.python.org/issue?@action=redirect&bpo=22068

   (194) https://bugs.python.org/issue?@action=redirect&bpo=22165

   (195) https://bugs.python.org/issue?@action=redirect&bpo=15381

   (196) https://bugs.python.org/issue?@action=redirect&bpo=8797

   (197) https://bugs.python.org/issue?@action=redirect&bpo=20729

   (198) https://bugs.python.org/issue?@action=redirect&bpo=21448

   (199) https://bugs.python.org/issue?@action=redirect&bpo=22184

   (200) https://bugs.python.org/issue?@action=redirect&bpo=17923

   (201) https://bugs.python.org/issue?@action=redirect&bpo=21725

   (202) https://bugs.python.org/issue?@action=redirect&bpo=22176

   (203) https://bugs.python.org/issue?@action=redirect&bpo=5411

   (204) https://bugs.python.org/issue?@action=redirect&bpo=21121

   (205) https://bugs.python.org/issue?@action=redirect&bpo=21975

   (206) https://bugs.python.org/issue?@action=redirect&bpo=20170

   (207) https://bugs.python.org/issue?@action=redirect&bpo=21539

   (208) https://bugs.python.org/issue?@action=redirect&bpo=22127

   (209) https://bugs.python.org/issue?@action=redirect&bpo=21047

   (210) https://bugs.python.org/issue?@action=redirect&bpo=15114

   (211) https://bugs.python.org/issue?@action=redirect&bpo=22085

   (212) https://bugs.python.org/issue?@action=redirect&bpo=21580

   (213) https://bugs.python.org/issue?@action=redirect&bpo=22003

   (214) https://bugs.python.org/issue?@action=redirect&bpo=22018

   (215) https://bugs.python.org/issue?@action=redirect&bpo=22054

   (216) https://bugs.python.org/issue?@action=redirect&bpo=17172

   (217) https://bugs.python.org/issue?@action=redirect&bpo=21704

   (218) https://bugs.python.org/issue?@action=redirect&bpo=20173

   (219) https://bugs.python.org/issue?@action=redirect&bpo=22033

   (220) https://bugs.python.org/issue?@action=redirect&bpo=21947

   (221) https://bugs.python.org/issue?@action=redirect&bpo=16133

   (222) https://bugs.python.org/issue?@action=redirect&bpo=22044

   (223) https://bugs.python.org/issue?@action=redirect&bpo=19884

   (224) https://bugs.python.org/issue?@action=redirect&bpo=4350

   (225) https://bugs.python.org/issue?@action=redirect&bpo=6167

   (226) https://bugs.python.org/issue?@action=redirect&bpo=15275

   (227) https://bugs.python.org/issue?@action=redirect&bpo=21888

   (228) https://bugs.python.org/issue?@action=redirect&bpo=22032

   (229) https://bugs.python.org/issue?@action=redirect&bpo=22031

   (230) https://bugs.python.org/issue?@action=redirect&bpo=22018

   (231) https://bugs.python.org/issue?@action=redirect&bpo=21044

   (232) https://bugs.python.org/issue?@action=redirect&bpo=21966

   (233) https://bugs.python.org/issue?@action=redirect&bpo=19076

   (234) https://bugs.python.org/issue?@action=redirect&bpo=16382

   (235) https://bugs.python.org/issue?@action=redirect&bpo=21932

   (236) https://bugs.python.org/issue?@action=redirect&bpo=21942

   (237) https://bugs.python.org/issue?@action=redirect&bpo=11259

   (238) https://bugs.python.org/issue?@action=redirect&bpo=12523

   (239) https://bugs.python.org/issue?@action=redirect&bpo=21707

   (240) https://bugs.python.org/issue?@action=redirect&bpo=20639

   (241) https://bugs.python.org/issue?@action=redirect&bpo=21714

   (242) https://bugs.python.org/issue?@action=redirect&bpo=15014

   (243) https://bugs.python.org/issue?@action=redirect&bpo=21151

   (244) https://bugs.python.org/issue?@action=redirect&bpo=21090

   (245) https://bugs.python.org/issue?@action=redirect&bpo=5800

   (246) https://bugs.python.org/issue?@action=redirect&bpo=21781

   (247) https://bugs.python.org/issue?@action=redirect&bpo=21679

   (248) https://bugs.python.org/issue?@action=redirect&bpo=21863

   (249) https://bugs.python.org/issue?@action=redirect&bpo=11453

   (250) https://bugs.python.org/issue?@action=redirect&bpo=21858

   (251) https://bugs.python.org/issue?@action=redirect&bpo=21476

   (252) https://bugs.python.org/issue?@action=redirect&bpo=20295

   (253) https://bugs.python.org/issue?@action=redirect&bpo=21729

   (254) https://bugs.python.org/issue?@action=redirect&bpo=21491

   (255) https://bugs.python.org/issue?@action=redirect&bpo=21719

   (256) https://bugs.python.org/issue?@action=redirect&bpo=21832

   (257) https://bugs.python.org/issue?@action=redirect&bpo=21722

   (258) https://bugs.python.org/issue?@action=redirect&bpo=21723

   (259) https://bugs.python.org/issue?@action=redirect&bpo=21711

   (260) https://bugs.python.org/issue?@action=redirect&bpo=17552

   (261) https://bugs.python.org/issue?@action=redirect&bpo=18039

   (262) https://bugs.python.org/issue?@action=redirect&bpo=21326

   (263) https://bugs.python.org/issue?@action=redirect&bpo=21766

   (264) https://bugs.python.org/issue?@action=redirect&bpo=21310

   (265) https://bugs.python.org/issue?@action=redirect&bpo=21256

   (266) https://bugs.python.org/issue?@action=redirect&bpo=21677

   (267) https://bugs.python.org/issue?@action=redirect&bpo=11709

   (268) https://bugs.python.org/issue?@action=redirect&bpo=21515

   (269) https://bugs.python.org/issue?@action=redirect&bpo=13223

   (270) https://bugs.python.org/issue?@action=redirect&bpo=21463

   (271) https://bugs.python.org/issue?@action=redirect&bpo=21618

   (272) https://bugs.python.org/issue?@action=redirect&bpo=20383

   (273) https://bugs.python.org/issue?@action=redirect&bpo=21552

   (274) https://bugs.python.org/issue?@action=redirect&bpo=14315

   (275) https://bugs.python.org/issue?@action=redirect&bpo=13742

   (276) https://bugs.python.org/issue?@action=redirect&bpo=21402

   (277) https://bugs.python.org/issue?@action=redirect&bpo=3015

   (278) https://bugs.python.org/issue?@action=redirect&bpo=10203

   (279) https://bugs.python.org/issue?@action=redirect&bpo=18807

   (280) https://bugs.python.org/issue?@action=redirect&bpo=20197

   (281) https://bugs.python.org/issue?@action=redirect&bpo=21513

   (282) https://bugs.python.org/issue?@action=redirect&bpo=21137

   (283) https://bugs.python.org/issue?@action=redirect&bpo=21538

   (284) https://bugs.python.org/issue?@action=redirect&bpo=21455

   (285) https://bugs.python.org/issue?@action=redirect&bpo=21525

   (286) https://bugs.python.org/issue?@action=redirect&bpo=22166

   (287) https://bugs.python.org/issue?@action=redirect&bpo=22236

   (288) https://bugs.python.org/issue?@action=redirect&bpo=10744

   (289) https://peps.python.org/pep-3118/

   (290) https://bugs.python.org/issue?@action=redirect&bpo=20826

   (291) https://bugs.python.org/issue?@action=redirect&bpo=21487

   (292) https://bugs.python.org/issue?@action=redirect&bpo=21486

   (293) https://bugs.python.org/issue?@action=redirect&bpo=13916

   (294) https://bugs.python.org/issue?@action=redirect&bpo=20998

   (295) https://bugs.python.org/issue?@action=redirect&bpo=21075

   (296) https://bugs.python.org/issue?@action=redirect&bpo=19775

   (297) https://bugs.python.org/issue?@action=redirect&bpo=21226

   (298) https://bugs.python.org/issue?@action=redirect&bpo=21398

   (299) https://bugs.python.org/issue?@action=redirect&bpo=16531

   (300) https://bugs.python.org/issue?@action=redirect&bpo=21156

   (301) https://bugs.python.org/issue?@action=redirect&bpo=21424

   (302) https://bugs.python.org/issue?@action=redirect&bpo=21396

   (303) https://bugs.python.org/issue?@action=redirect&bpo=18314

   (304) https://bugs.python.org/issue?@action=redirect&bpo=21088

   (305) https://bugs.python.org/issue?@action=redirect&bpo=21407

   (306) https://bugs.python.org/issue?@action=redirect&bpo=10650

   (307) https://bugs.python.org/issue?@action=redirect&bpo=21469

   (308) https://bugs.python.org/issue?@action=redirect&bpo=19414

   (309) https://bugs.python.org/issue?@action=redirect&bpo=21421

   (310) https://bugs.python.org/issue?@action=redirect&bpo=21101

   (311) https://bugs.python.org/issue?@action=redirect&bpo=21321

   (312) https://bugs.python.org/issue?@action=redirect&bpo=21057

   (313) https://bugs.python.org/issue?@action=redirect&bpo=20951

   (314) https://bugs.python.org/issue?@action=redirect&bpo=13248

   (315) https://bugs.python.org/issue?@action=redirect&bpo=9815

   (316) https://bugs.python.org/issue?@action=redirect&bpo=19940

   (317) https://bugs.python.org/issue?@action=redirect&bpo=13204

   (318) https://bugs.python.org/issue?@action=redirect&bpo=19385

   (319) https://bugs.python.org/issue?@action=redirect&bpo=21207

   (320) https://bugs.python.org/issue?@action=redirect&bpo=21291

   (321) https://bugs.python.org/issue?@action=redirect&bpo=21127

   (322) https://bugs.python.org/issue?@action=redirect&bpo=15002

   (323) https://bugs.python.org/issue?@action=redirect&bpo=12220

   (324) https://bugs.python.org/issue?@action=redirect&bpo=21068

   (325) https://bugs.python.org/issue?@action=redirect&bpo=21276

   (326) https://bugs.python.org/issue?@action=redirect&bpo=21262

   (327) https://bugs.python.org/issue?@action=redirect&bpo=21238

   (328) https://bugs.python.org/issue?@action=redirect&bpo=20896

   (329) https://bugs.python.org/issue?@action=redirect&bpo=21239

   (330) https://bugs.python.org/issue?@action=redirect&bpo=21203

   (331) https://bugs.python.org/issue?@action=redirect&bpo=21222

   (332) https://bugs.python.org/issue?@action=redirect&bpo=21197

   (333) https://bugs.python.org/issue?@action=redirect&bpo=17498

   (334) https://bugs.python.org/issue?@action=redirect&bpo=17826

   (335) https://bugs.python.org/issue?@action=redirect&bpo=7776

   (336) https://bugs.python.org/issue?@action=redirect&bpo=20968

   (337) https://bugs.python.org/issue?@action=redirect&bpo=21529

   (338) https://www.cve.org/CVERecord?id=CVE-2014-4616

   (339) https://bugs.python.org/issue?@action=redirect&bpo=21169

   (340) https://bugs.python.org/issue?@action=redirect&bpo=21171

   (341) https://bugs.python.org/issue?@action=redirect&bpo=20539

   (342) https://bugs.python.org/issue?@action=redirect&bpo=21172

   (343) https://bugs.python.org/issue?@action=redirect&bpo=21155

   (344) https://bugs.python.org/issue?@action=redirect&bpo=21136

   (345) https://bugs.python.org/issue?@action=redirect&bpo=17621

   (346) https://bugs.python.org/issue?@action=redirect&bpo=21076

   (347) https://bugs.python.org/issue?@action=redirect&bpo=20636

   (348) https://bugs.python.org/issue?@action=redirect&bpo=19505

   (349) https://bugs.python.org/issue?@action=redirect&bpo=21149

   (350) https://bugs.python.org/issue?@action=redirect&bpo=21058

   (351) https://bugs.python.org/issue?@action=redirect&bpo=21200

   (352) https://bugs.python.org/issue?@action=redirect&bpo=21013

   (353) https://bugs.python.org/issue?@action=redirect&bpo=20145

   (354) https://bugs.python.org/issue?@action=redirect&bpo=20633

   (355) https://bugs.python.org/issue?@action=redirect&bpo=20980

   (356) https://bugs.python.org/issue?@action=redirect&bpo=21082

   (357) https://bugs.python.org/issue?@action=redirect&bpo=20990

   (358) https://bugs.python.org/issue?@action=redirect&bpo=21015

   (359) https://bugs.python.org/issue?@action=redirect&bpo=21000

   (360) https://bugs.python.org/issue?@action=redirect&bpo=20995

   (361) https://bugs.python.org/issue?@action=redirect&bpo=20884

   (362) https://bugs.python.org/issue?@action=redirect&bpo=21499

   (363) https://bugs.python.org/issue?@action=redirect&bpo=20627

   (364) https://bugs.python.org/issue?@action=redirect&bpo=19165

   (365) https://bugs.python.org/issue?@action=redirect&bpo=13936

   (366) https://bugs.python.org/issue?@action=redirect&bpo=18931

   (367) https://bugs.python.org/issue?@action=redirect&bpo=19977

   (368) https://bugs.python.org/issue?@action=redirect&bpo=20574

   (369) https://bugs.python.org/issue?@action=redirect&bpo=20879

   (370) https://bugs.python.org/issue?@action=redirect&bpo=19157

   (371) https://bugs.python.org/issue?@action=redirect&bpo=11599

   (372) https://bugs.python.org/issue?@action=redirect&bpo=4931

   (373) https://bugs.python.org/issue?@action=redirect&bpo=20875

   (374) https://bugs.python.org/issue?@action=redirect&bpo=11558

   (375) https://bugs.python.org/issue?@action=redirect&bpo=20283

   (376) https://bugs.python.org/issue?@action=redirect&bpo=20778

   (377) https://bugs.python.org/issue?@action=redirect&bpo=20791

   (378) https://bugs.python.org/issue?@action=redirect&bpo=19748

   (379) https://bugs.python.org/issue?@action=redirect&bpo=19573

   (380) https://bugs.python.org/issue?@action=redirect&bpo=20726

   (381) https://bugs.python.org/issue?@action=redirect&bpo=17373

   (382) https://bugs.python.org/issue?@action=redirect&bpo=20378

   (383) https://bugs.python.org/issue?@action=redirect&bpo=20816

   (384) https://bugs.python.org/issue?@action=redirect&bpo=20817

   (385) https://bugs.python.org/issue?@action=redirect&bpo=6676

   (386) https://bugs.python.org/issue?@action=redirect&bpo=21117

   (387) https://bugs.python.org/issue?@action=redirect&bpo=20334

   (388) https://bugs.python.org/issue?@action=redirect&bpo=15916

   (389) https://bugs.python.org/issue?@action=redirect&bpo=21209

   (390) https://bugs.python.org/issue?@action=redirect&bpo=163

   (391) https://bugs.python.org/issue?@action=redirect&bpo=21311

   (392) https://bugs.python.org/issue?@action=redirect&bpo=11571

   (393) https://bugs.python.org/issue?@action=redirect&bpo=21801

   (394) https://bugs.python.org/issue?@action=redirect&bpo=21923

   (395) https://bugs.python.org/issue?@action=redirect&bpo=21323

   (396) https://bugs.python.org/issue?@action=redirect&bpo=19435

   (397) https://bugs.python.org/issue?@action=redirect&bpo=22733

   (398) https://bugs.python.org/issue?@action=redirect&bpo=23302


File: python.info,  Node: IDLE<63>,  Next: ビルド<100>,  Prev: ライブラリ<207>,  Up: Python 3 5 0 alpha 1

1.24.120.3 IDLE
...............

   - bpo-20577(1): Configuration of the max line length for the
     FormatParagraph extension has been moved from the General tab of
     the Idle preferences dialog to the FormatParagraph tab of the
     Config Extensions dialog.  Patch by Tal Einat.

   - bpo-16893(2): Update Idle doc chapter to match current Idle and add
     new information.

   - bpo-3068(3): Add Idle extension configuration dialog to Options
     menu.  Changes are written to HOME/.idlerc/config-extensions.cfg.
     Original patch by Tal Einat.

   - bpo-16233(4): A module browser (File : Class Browser, Alt+C)
     requires an editor window with a filename.  When Class Browser is
     requested otherwise, from a shell, output window, or 'Untitled'
     editor, Idle no longer displays an error box.  It now pops up an
     Open Module box (Alt+M). If a valid name is entered and a module is
     opened, a corresponding browser is also opened.

   - bpo-4832(5): Save As to type Python files automatically adds .py to
     the name you enter (even if your system does not display it).  Some
     systems automatically add .txt when type is Text files.

   - bpo-21986(6): Code objects are not normally pickled by the pickle
     module.  To match this, they are no longer pickled when running
     under Idle.

   - bpo-17390(7): Adjust Editor window title; remove 'Python', move
     version to end.

   - bpo-14105(8): Idle debugger breakpoints no longer disappear when
     inserting or deleting lines.

   - bpo-17172(9): Turtledemo can now be run from Idle.  Currently, the
     entry is on the Help menu, but it may move to Run.  Patch by
     Ramchandra Apt and Lita Cho.

   - bpo-21765(10): Add support for non-ascii identifiers to
     HyperParser.

   - bpo-21940(11): Add unittest for WidgetRedirector.  Initial patch by
     Saimadhav Heblikar.

   - bpo-18592(12): Add unittest for SearchDialogBase.  Patch by Phil
     Webster.

   - bpo-21694(13): Add unittest for ParenMatch.  Patch by Saimadhav
     Heblikar.

   - bpo-21686(14): add unittest for HyperParser.  Original patch by
     Saimadhav Heblikar.

   - bpo-12387(15): Add missing upper(lower)case versions of default
     Windows key bindings for Idle so Caps Lock does not disable them.
     Patch by Roger Serwy.

   - bpo-21695(16): Closing a Find-in-files output window while the
     search is still in progress no longer closes Idle.

   - bpo-18910(17): Add unittest for textView.  Patch by Phil Webster.

   - bpo-18292(18): Add unittest for AutoExpand.  Patch by Saihadhav
     Heblikar.

   - bpo-18409(19): Add unittest for AutoComplete.  Patch by Phil
     Webster.

   - bpo-21477(20): htest.py - Improve framework, complete set of tests.
     Patches by Saimadhav Heblikar

   - bpo-18104(21): Add idlelib/idle_test/htest.py with a few sample
     tests to begin consolidating and improving human-validated tests of
     Idle.  Change other files as needed to work with htest.  Running
     the module as __main__ runs all tests.

   - bpo-21139(22): Change default paragraph width to 72, the PEP 8(23)
     recommendation.

   - bpo-21284(24): Paragraph reformat test passes after user changes
     reformat width.

   - bpo-17654(25): Ensure IDLE menus are customized properly on OS X
     for non-framework builds and for all variants of Tk.

   - bpo-23180(26): Rename IDLE "Windows" menu item to "Window".  Patch
     by Al Sweigart.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=20577

   (2) https://bugs.python.org/issue?@action=redirect&bpo=16893

   (3) https://bugs.python.org/issue?@action=redirect&bpo=3068

   (4) https://bugs.python.org/issue?@action=redirect&bpo=16233

   (5) https://bugs.python.org/issue?@action=redirect&bpo=4832

   (6) https://bugs.python.org/issue?@action=redirect&bpo=21986

   (7) https://bugs.python.org/issue?@action=redirect&bpo=17390

   (8) https://bugs.python.org/issue?@action=redirect&bpo=14105

   (9) https://bugs.python.org/issue?@action=redirect&bpo=17172

   (10) https://bugs.python.org/issue?@action=redirect&bpo=21765

   (11) https://bugs.python.org/issue?@action=redirect&bpo=21940

   (12) https://bugs.python.org/issue?@action=redirect&bpo=18592

   (13) https://bugs.python.org/issue?@action=redirect&bpo=21694

   (14) https://bugs.python.org/issue?@action=redirect&bpo=21686

   (15) https://bugs.python.org/issue?@action=redirect&bpo=12387

   (16) https://bugs.python.org/issue?@action=redirect&bpo=21695

   (17) https://bugs.python.org/issue?@action=redirect&bpo=18910

   (18) https://bugs.python.org/issue?@action=redirect&bpo=18292

   (19) https://bugs.python.org/issue?@action=redirect&bpo=18409

   (20) https://bugs.python.org/issue?@action=redirect&bpo=21477

   (21) https://bugs.python.org/issue?@action=redirect&bpo=18104

   (22) https://bugs.python.org/issue?@action=redirect&bpo=21139

   (23) https://peps.python.org/pep-0008/

   (24) https://bugs.python.org/issue?@action=redirect&bpo=21284

   (25) https://bugs.python.org/issue?@action=redirect&bpo=17654

   (26) https://bugs.python.org/issue?@action=redirect&bpo=23180


File: python.info,  Node: ビルド<100>,  Next: C API<79>,  Prev: IDLE<63>,  Up: Python 3 5 0 alpha 1

1.24.120.4 ビルド
.................

   - bpo-15506(1): Use standard PKG_PROG_PKG_CONFIG autoconf macro in
     the configure script.

   - bpo-22935(2): Allow the ssl module to be compiled if openssl
     doesn't support SSL 3.

   - bpo-22592(3): Drop support of the Borland C compiler to build
     Python.  The distutils module still supports it to build
     extensions.

   - bpo-22591(4): Drop support of MS-DOS, especially of the DJGPP
     compiler (MS-DOS port of GCC).

   - bpo-16537(5): Check whether self.extensions is empty in setup.py.
     Patch by Jonathan Hosmer.

   - bpo-22359(6): Remove incorrect uses of recursive make.  Patch by
     Jonas Wagner.

   - bpo-21958(7): Define HAVE_ROUND when building with Visual Studio
     2013 and above.  Patch by Zachary Turner.

   - bpo-18093(8): the programs that embed the CPython runtime are now
     in a separate "Programs" directory, rather than being kept in the
     Modules directory.

   - bpo-15759(9): "make suspicious", "make linkcheck" and "make
     doctest" in Doc/ now display special message when and only when
     there are failures.

   - bpo-21141(10): The Windows build process no longer attempts to find
     Perl, instead relying on OpenSSL source being configured and ready
     to build.  The ‘PCbuild\build_ssl.py’ script has been re-written
     and re-named to ‘PCbuild\prepare_ssl.py’, and takes care of
     configuring OpenSSL source for both 32 and 64 bit platforms.
     OpenSSL sources obtained from svn.python.org will always be
     pre-configured and ready to build.

   - bpo-21037(11): Add a build option to enable AddressSanitizer
     support.

   - bpo-19962(12): The Windows build process now creates "python.bat"
     in the root of the source tree, which passes all arguments through
     to the most recently built interpreter.

   - bpo-21285(13): Refactor and fix curses configure check to always
     search in a ncursesw directory.

   - bpo-15234(14): For BerkeleyDB and Sqlite, only add the found
     library and include directories if they aren't already being
     searched.  This avoids an explicit runtime library dependency.

   - bpo-17861(15): Tools/scripts/generate_opcode_h.py automatically
     regenerates Include/opcode.h from Lib/opcode.py if the latter gets
     any change.

   - bpo-20644(16): OS X installer build support for documentation build
     changes in 3.4.1: assume externally supplied sphinx-build is
     available in /usr/bin.

   - bpo-20022(17): Eliminate use of deprecated bundlebuilder in OS X
     builds.

   - bpo-15968(18): Incorporated Tcl, Tk, and Tix builds into the
     Windows build solution.

   - bpo-17095(19): Fix Modules/Setup 'shared' support.

   - bpo-21811(20): Anticipated fixes to support OS X versions > 10.9.

   - bpo-21166(21): Prevent possible segfaults and other random failures
     of python -generate-posix-vars in pybuilddir.txt build target.

   - bpo-18096(22): Fix library order returned by python-config.

   - bpo-17219(23): Add library build dir for Python extension
     cross-builds.

   - bpo-22919(24): Windows build updated to support VC 14.0 (Visual
     Studio 2015), which will be used for the official release.

   - bpo-21236(25): Build _msi.pyd with cabinet.lib instead of fci.lib

   - bpo-17128(26): Use private version of OpenSSL for OS X 10.5+
     installer.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=15506

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22935

   (3) https://bugs.python.org/issue?@action=redirect&bpo=22592

   (4) https://bugs.python.org/issue?@action=redirect&bpo=22591

   (5) https://bugs.python.org/issue?@action=redirect&bpo=16537

   (6) https://bugs.python.org/issue?@action=redirect&bpo=22359

   (7) https://bugs.python.org/issue?@action=redirect&bpo=21958

   (8) https://bugs.python.org/issue?@action=redirect&bpo=18093

   (9) https://bugs.python.org/issue?@action=redirect&bpo=15759

   (10) https://bugs.python.org/issue?@action=redirect&bpo=21141

   (11) https://bugs.python.org/issue?@action=redirect&bpo=21037

   (12) https://bugs.python.org/issue?@action=redirect&bpo=19962

   (13) https://bugs.python.org/issue?@action=redirect&bpo=21285

   (14) https://bugs.python.org/issue?@action=redirect&bpo=15234

   (15) https://bugs.python.org/issue?@action=redirect&bpo=17861

   (16) https://bugs.python.org/issue?@action=redirect&bpo=20644

   (17) https://bugs.python.org/issue?@action=redirect&bpo=20022

   (18) https://bugs.python.org/issue?@action=redirect&bpo=15968

   (19) https://bugs.python.org/issue?@action=redirect&bpo=17095

   (20) https://bugs.python.org/issue?@action=redirect&bpo=21811

   (21) https://bugs.python.org/issue?@action=redirect&bpo=21166

   (22) https://bugs.python.org/issue?@action=redirect&bpo=18096

   (23) https://bugs.python.org/issue?@action=redirect&bpo=17219

   (24) https://bugs.python.org/issue?@action=redirect&bpo=22919

   (25) https://bugs.python.org/issue?@action=redirect&bpo=21236

   (26) https://bugs.python.org/issue?@action=redirect&bpo=17128


File: python.info,  Node: C API<79>,  Next: ドキュメント<85>,  Prev: ビルド<100>,  Up: Python 3 5 0 alpha 1

1.24.120.5 C API
................

   - bpo-14203(1): Remove obsolete support for view==NULL in
     PyBuffer_FillInfo(), bytearray_getbuffer(), bytesiobuf_getbuffer()
     and array_buffer_getbuf().  All functions now raise BufferError in
     that case.

   - bpo-22445(2): PyBuffer_IsContiguous() now implements precise
     contiguity tests, compatible with NumPy's
     NPY_RELAXED_STRIDES_CHECKING compilation flag.  Previously the
     function reported false negatives for corner cases.

   - bpo-22079(3): PyType_Ready() now checks that statically allocated
     type has no dynamically allocated bases.

   - bpo-22453(4): Removed non-documented macro PyObject_REPR().

   - bpo-18395(5): Rename ‘_Py_char2wchar()’ to *note Py_DecodeLocale():
     dc0, rename ‘_Py_wchar2char()’ to *note Py_EncodeLocale(): dc1, and
     document these functions.

   - bpo-21233(6): Add new C functions: PyMem_RawCalloc(),
     PyMem_Calloc(), PyObject_Calloc(), _PyObject_GC_Calloc().
     bytes(int) is now using ‘calloc()’ instead of ‘malloc()’ for large
     objects which is faster and use less memory.

   - bpo-20942(7): PyImport_ImportFrozenModuleObject() no longer sets
     __file__ to match what importlib does; this affects
     _frozen_importlib as well as any module loaded using
     imp.init_frozen().

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=14203

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22445

   (3) https://bugs.python.org/issue?@action=redirect&bpo=22079

   (4) https://bugs.python.org/issue?@action=redirect&bpo=22453

   (5) https://bugs.python.org/issue?@action=redirect&bpo=18395

   (6) https://bugs.python.org/issue?@action=redirect&bpo=21233

   (7) https://bugs.python.org/issue?@action=redirect&bpo=20942


File: python.info,  Node: ドキュメント<85>,  Next: テスト<88>,  Prev: C API<79>,  Up: Python 3 5 0 alpha 1

1.24.120.6 ドキュメント
.......................

   - bpo-19548(1): Update the codecs module documentation to better
     cover the distinction between text encodings and other codecs,
     together with other clarifications.  Patch by Martin Panter.

   - bpo-22394(2): Doc/Makefile now supports ‘make venv
     PYTHON=../python’ to create a venv for generating the
     documentation, e.g., ‘make html PYTHON=venv/bin/python3’.

   - bpo-21514(3): The documentation of the json module now refers to
     new JSON RFC 7159 instead of obsoleted RFC 4627.

   - bpo-21777(4): The binary sequence methods on bytes and bytearray
     are now documented explicitly, rather than assuming users will be
     able to derive the expected behaviour from the behaviour of the
     corresponding str methods.

   - bpo-6916(5): undocument deprecated asynchat.fifo class.

   - bpo-17386(6): Expanded functionality of the ‘Doc/make.bat’ script
     to make it much more comparable to ‘Doc/Makefile’.

   - bpo-21312(7): Update the thread_foobar.h template file to include
     newer threading APIs.  Patch by Jack McCracken.

   - bpo-21043(8): Remove the recommendation for specific CA
     organizations and to mention the ability to load the OS
     certificates.

   - bpo-20765(9): Add missing documentation for PurePath.with_name()
     and PurePath.with_suffix().

   - bpo-19407(10): New package installation and distribution guides
     based on the Python Packaging Authority tools.  Existing guides
     have been retained as legacy links from the distutils docs, as they
     still contain some required reference material for tool developers
     that isn't recorded anywhere else.

   - bpo-19697(11): Document cases where __main__.__spec__ is None.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=19548

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22394

   (3) https://bugs.python.org/issue?@action=redirect&bpo=21514

   (4) https://bugs.python.org/issue?@action=redirect&bpo=21777

   (5) https://bugs.python.org/issue?@action=redirect&bpo=6916

   (6) https://bugs.python.org/issue?@action=redirect&bpo=17386

   (7) https://bugs.python.org/issue?@action=redirect&bpo=21312

   (8) https://bugs.python.org/issue?@action=redirect&bpo=21043

   (9) https://bugs.python.org/issue?@action=redirect&bpo=20765

   (10) https://bugs.python.org/issue?@action=redirect&bpo=19407

   (11) https://bugs.python.org/issue?@action=redirect&bpo=19697


File: python.info,  Node: テスト<88>,  Next: Tools/Demos<61>,  Prev: ドキュメント<85>,  Up: Python 3 5 0 alpha 1

1.24.120.7 テスト
.................

   - bpo-18982(1): Add tests for CLI of the calendar module.

   - bpo-19548(2): Added some additional checks to test_codecs to ensure
     that statements in the updated documentation remain accurate.
     Patch by Martin Panter.

   - bpo-22838(3): All test_re tests now work with unittest test
     discovery.

   - bpo-22173(4): Update lib2to3 tests to use unittest test discovery.

   - bpo-16000(5): Convert test_curses to use unittest.

   - bpo-21456(6): Skip two tests in test_urllib2net.py if _ssl module
     not present.  Patch by Remi Pointel.

   - bpo-20746(7): Fix test_pdb to run in refleak mode (-R). Patch by
     Xavier de Gaye.

   - bpo-22060(8): test_ctypes has been somewhat cleaned up and
     simplified; it now uses unittest test discovery to find its tests.

   - bpo-22104(9): regrtest.py no longer holds a reference to the suite
     of tests loaded from test modules that don't define test_main().

   - bpo-22111(10): Assorted cleanups in test_imaplib.  Patch by Milan
     Oberkirch.

   - bpo-22002(11): Added ‘load_package_tests’ function to test.support
     and used it to implement/augment test discovery in test_asyncio,
     test_email, test_importlib, test_json, and test_tools.

   - bpo-21976(12): Fix test_ssl to accept LibreSSL version strings.
     Thanks to William Orr.

   - bpo-21918(13): Converted test_tools from a module to a package
     containing separate test files for each tested script.

   - bpo-9554(14): Use modern unittest features in test_argparse.
     Initial patch by Denver Coneybeare and Radu Voicilas.

   - bpo-20155(15): Changed HTTP method names in failing tests in
     test_httpservers so that packet filtering software (specifically
     Windows Base Filtering Engine) does not interfere with the
     transaction semantics expected by the tests.

   - bpo-19493(16): Refactored the ctypes test package to skip tests
     explicitly rather than silently.

   - bpo-18492(17): All resources are now allowed when tests are not run
     by regrtest.py.

   - bpo-21634(18): Fix pystone micro-benchmark: use floor division
     instead of true division to benchmark integers instead of
     floating-point numbers.  Set pystone version to 1.2.  Patch written
     by Lennart Regebro.

   - bpo-21605(19): Added tests for Tkinter images.

   - bpo-21493(20): Added test for ntpath.expanduser().  Original patch
     by Claudiu Popa.

   - bpo-19925(21): Added tests for the spwd module.  Original patch by
     Vajrasky Kok.

   - bpo-21522(22): Added Tkinter tests for Listbox.itemconfigure(),
     PanedWindow.paneconfigure(), and Menu.entryconfigure().

   - bpo-17756(23): Fix test_code test when run from the installed
     location.

   - bpo-17752(24): Fix distutils tests when run from the installed
     location.

   - bpo-18604(25): Consolidated checks for GUI availability.  All
     platforms now at least check whether Tk can be instantiated when
     the GUI resource is requested.

   - bpo-21275(26): Fix a socket test on KFreeBSD.

   - bpo-21223(27): Pass test_site/test_startup_imports when some of the
     extensions are built as builtins.

   - bpo-20635(28): Added tests for Tk geometry managers.

   - Add test case for freeze.

   - bpo-20743(29): Fix a reference leak in test_tcl.

   - bpo-21097(30): Move test_namespace_pkgs into test_importlib.

   - bpo-21503(31): Use test_both() consistently in test_importlib.

   - bpo-20939(32): Avoid various network test failures due to new
     redirect of ‘http://www.python.org/’ to ‘https://www.python.org’:
     use ‘http://www.example.com’ instead.

   - bpo-20668(33): asyncio tests no longer rely on tests.txt file.
     (Patch by Vajrasky Kok)

   - bpo-21093(34): Prevent failures of ctypes test_macholib on OS X if
     a copy of libz exists in $HOME/lib or /usr/local/lib.

   - bpo-22770(35): Prevent some Tk segfaults on OS X when running gui
     tests.

   - bpo-23211(36): Workaround test_logging failure on some OS X 10.6
     systems.

   - bpo-23345(37): Prevent test_ssl failures with large OpenSSL patch
     level values (like 0.9.8zc).

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18982

   (2) https://bugs.python.org/issue?@action=redirect&bpo=19548

   (3) https://bugs.python.org/issue?@action=redirect&bpo=22838

   (4) https://bugs.python.org/issue?@action=redirect&bpo=22173

   (5) https://bugs.python.org/issue?@action=redirect&bpo=16000

   (6) https://bugs.python.org/issue?@action=redirect&bpo=21456

   (7) https://bugs.python.org/issue?@action=redirect&bpo=20746

   (8) https://bugs.python.org/issue?@action=redirect&bpo=22060

   (9) https://bugs.python.org/issue?@action=redirect&bpo=22104

   (10) https://bugs.python.org/issue?@action=redirect&bpo=22111

   (11) https://bugs.python.org/issue?@action=redirect&bpo=22002

   (12) https://bugs.python.org/issue?@action=redirect&bpo=21976

   (13) https://bugs.python.org/issue?@action=redirect&bpo=21918

   (14) https://bugs.python.org/issue?@action=redirect&bpo=9554

   (15) https://bugs.python.org/issue?@action=redirect&bpo=20155

   (16) https://bugs.python.org/issue?@action=redirect&bpo=19493

   (17) https://bugs.python.org/issue?@action=redirect&bpo=18492

   (18) https://bugs.python.org/issue?@action=redirect&bpo=21634

   (19) https://bugs.python.org/issue?@action=redirect&bpo=21605

   (20) https://bugs.python.org/issue?@action=redirect&bpo=21493

   (21) https://bugs.python.org/issue?@action=redirect&bpo=19925

   (22) https://bugs.python.org/issue?@action=redirect&bpo=21522

   (23) https://bugs.python.org/issue?@action=redirect&bpo=17756

   (24) https://bugs.python.org/issue?@action=redirect&bpo=17752

   (25) https://bugs.python.org/issue?@action=redirect&bpo=18604

   (26) https://bugs.python.org/issue?@action=redirect&bpo=21275

   (27) https://bugs.python.org/issue?@action=redirect&bpo=21223

   (28) https://bugs.python.org/issue?@action=redirect&bpo=20635

   (29) https://bugs.python.org/issue?@action=redirect&bpo=20743

   (30) https://bugs.python.org/issue?@action=redirect&bpo=21097

   (31) https://bugs.python.org/issue?@action=redirect&bpo=21503

   (32) https://bugs.python.org/issue?@action=redirect&bpo=20939

   (33) https://bugs.python.org/issue?@action=redirect&bpo=20668

   (34) https://bugs.python.org/issue?@action=redirect&bpo=21093

   (35) https://bugs.python.org/issue?@action=redirect&bpo=22770

   (36) https://bugs.python.org/issue?@action=redirect&bpo=23211

   (37) https://bugs.python.org/issue?@action=redirect&bpo=23345


File: python.info,  Node: Tools/Demos<61>,  Next: Windows<83>,  Prev: テスト<88>,  Up: Python 3 5 0 alpha 1

1.24.120.8 Tools/Demos
......................

   - bpo-22314(1): pydoc now works when the LINES environment variable
     is set.

   - bpo-22615(2): Argument Clinic now supports the "type" argument for
     the int converter.  This permits using the int converter with enums
     and typedefs.

   - bpo-20076(3): The makelocalealias.py script no longer ignores UTF-8
     mapping.

   - bpo-20079(4): The makelocalealias.py script now can parse the
     SUPPORTED file from glibc sources and supports command line options
     for source paths.

   - bpo-22201(5): Command-line interface of the zipfile module now
     correctly extracts ZIP files with directory entries.  Patch by Ryan
     Wilson.

   - bpo-22120(6): For functions using an unsigned integer return
     converter, Argument Clinic now generates a cast to that type for
     the comparison to -1 in the generated code.  (This suppresses a
     compilation warning.)

   - bpo-18974(7): Tools/scripts/diff.py now uses argparse instead of
     optparse.

   - bpo-21906(8): Make Tools/scripts/md5sum.py work in Python 3.  Patch
     by Zachary Ware.

   - bpo-21629(9): Fix Argument Clinic's "-converters" feature.

   - Add support for ‘yield from’ to 2to3.

   - Add support for the PEP 465(10) matrix multiplication operator to
     2to3.

   - bpo-16047(11): Fix module exception list and __file__ handling in
     freeze.  Patch by Meador Inge.

   - bpo-11824(12): Consider ABI tags in freeze.  Patch by Meador Inge.

   - bpo-20535(13): PYTHONWARNING no longer affects the run_tests.py
     script.  Patch by Arfrever Frehtes Taifersar Arahesis.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=22314

   (2) https://bugs.python.org/issue?@action=redirect&bpo=22615

   (3) https://bugs.python.org/issue?@action=redirect&bpo=20076

   (4) https://bugs.python.org/issue?@action=redirect&bpo=20079

   (5) https://bugs.python.org/issue?@action=redirect&bpo=22201

   (6) https://bugs.python.org/issue?@action=redirect&bpo=22120

   (7) https://bugs.python.org/issue?@action=redirect&bpo=18974

   (8) https://bugs.python.org/issue?@action=redirect&bpo=21906

   (9) https://bugs.python.org/issue?@action=redirect&bpo=21629

   (10) https://peps.python.org/pep-0465/

   (11) https://bugs.python.org/issue?@action=redirect&bpo=16047

   (12) https://bugs.python.org/issue?@action=redirect&bpo=11824

   (13) https://bugs.python.org/issue?@action=redirect&bpo=20535


File: python.info,  Node: Windows<83>,  Prev: Tools/Demos<61>,  Up: Python 3 5 0 alpha 1

1.24.120.9 Windows
..................

   - bpo-23260(1): Update Windows installer

   - The bundled version of Tcl/Tk has been updated to 8.6.3.  The most
     visible result of this change is the addition of new native file
     dialogs when running on Windows Vista or newer.  See Tcl/Tk's TIP
     432 for more information.  Also, this version of Tcl/Tk includes
     support for Windows 10.

   - bpo-17896(2): The Windows build scripts now expect external library
     sources to be in ‘PCbuild\..\externals’ rather than
     ‘PCbuild\..\..’.

   - bpo-17717(3): The Windows build scripts now use a copy of NASM
     pulled from svn.python.org to build OpenSSL.

   - bpo-21907(4): Improved the batch scripts provided for building
     Python.

   - bpo-22644(5): The bundled version of OpenSSL has been updated to
     1.0.1j.

   - bpo-10747(6): Use versioned labels in the Windows start menu.
     Patch by Olive Kilburn.

   - bpo-22980(7): .pyd files with a version and platform tag (for
     example, ".cp35-win32.pyd") will now be loaded in preference to
     those without tags.

'(For information about older versions, consult the HISTORY file.)'

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=23260

   (2) https://bugs.python.org/issue?@action=redirect&bpo=17896

   (3) https://bugs.python.org/issue?@action=redirect&bpo=17717

   (4) https://bugs.python.org/issue?@action=redirect&bpo=21907

   (5) https://bugs.python.org/issue?@action=redirect&bpo=22644

   (6) https://bugs.python.org/issue?@action=redirect&bpo=10747

   (7) https://bugs.python.org/issue?@action=redirect&bpo=22980


File: python.info,  Node: Python チュートリアル,  Next: Python のセットアップと利用,  Prev: What's New in Python,  Up: Top

2 Python チュートリアル
***********************

     Tip: このチュートリアルはPython言語を初めて使う 'プログラマー' 向け
     に設計されており、プログラミングが初めの '初心者' 向け 'ではありま
     せん' 。

Python は強力で、学びやすいプログラミング言語です。効率的な高レベルデー
タ構造と、シンプルで効果的なオブジェクト指向プログラミング機構を備えてい
ます。 Python は、洗練された文法・動的なデータ型付け・インタープリタであ
ることなどから、スクリプティングや高速アプリケーション開発(Rapid
Application Development: RAD)に理想的なプログラミング言語となっています
。

Python Web サイト(‘https://www.python.org’) は、 Python インタープリタと
標準ライブラリのソースコードと、主要プラットフォームごとにコンパイル済み
のバイナリファイルを無料で配布しています。また、Python Web サイトには、
無料のサードパーティモジュールやプログラム、ツール、ドキュメントなども紹
介しています。

Python インタプリタは、簡単に C/C++ 言語などで実装された関数やデータ型を
組み込み、拡張できます。また、アプリケーションのカスタマイズを行う、拡張
言語としても適しています。

このチュートリアルは、Python 言語の基本的な概念と機能を、形式ばらずに紹
介します。一般的なプログラミンの基礎知識があることを前提として書かれてい
ることに注意してください。読むだけではなく、Pythonインタープリタで実際に
サンプルを実行すると理解が深まりますが、サンプルはそれぞれ独立しています
ので、ただ読むだけでも良いでしょう。

標準オブジェクトやモジュールの詳細は、 *note Python 標準ライブラリ: 149.
を参照してください。 また、正式な言語定義は、 *note Python
言語リファレンス: 14a. にあります。 C 言語や C++ 言語で拡張モジュールを
書くなら、 *note Python インタプリタの拡張と埋め込み: 1fbd. や *note
Python/C API リファレンスマニュアル: 1fbe. を参照してください。Python の
解説書も販売されています。

このチュートリアルは、Python全体を対象とした、包括的な解説書ではありませ
ん。よく使われる機能に限っても、全ては紹介していません。その代わり、この
チュートリアルでは、Pythonのもっとも特徴的な機能を中心に紹介して、この言
語の持ち味や、スタイルを感じられるようにしています。このチュートリアルを
読み終えると、Python のモジュールやプログラムを読み書きできるようになっ
ているでしょう。また、*note Python 標準ライブラリ: 149. のさまざまな
Python ライブラリモジュールを、詳しく調べられるようになっているはずです
。

*note 用語集: 1fbf. にも目を通しておくと良いでしょう。

* Menu:

* やる気を高めよう::
* Python インタプリタを使う::
* 形式ばらない Python の紹介::
* その他の制御フローツール::
* データ構造::
* モジュール: モジュール<2>.
* 入力と出力::
* エラーと例外::
* クラス::
* 標準ライブラリミニツアー::
* 標準ライブラリミニツアー: 標準ライブラリミニツアー --- その 2. その 2
* 仮想環境とパッケージ::
* さあ何を？::
* 対話入力編集と履歴置換::
* 浮動小数点演算、その問題と制限::
* 付録::


File: python.info,  Node: やる気を高めよう,  Next: Python インタプリタを使う,  Up: Python チュートリアル

2.1 やる気を高めよう
====================

コンピュータを使っていろいろな作業をしていると、自動化したい作業が出てく
るでしょう。たとえば、たくさんのテキストファイルで検索-置換操作を行いた
い、大量の写真ファイルを込み入ったやりかたでファイル名を整理して変更した
り、などです。ちょっとした専用のデータベースや、何か専用のGUIアプリケー
ション、シンプルなゲームを作りたいかもしれません。

あなたがプロのソフト開発者として、C/C++/Java ライブラリを扱う必要がある
けども、通常の編集/コンパイル/テスト/再コンパイルのサイクルを遅すぎると
感じているかもしれません。上記ライブラリのためのテストを書くことにうんざ
りしているかもしれません。または、拡張言語を持つアプリケーションを書いて
いるなら、そのために新しい言語一式の設計と実装をしたくないでしょう。

Pythonはそんなあなたのための言語です。

そういった処理は、Unix シェルスクリプトや Windows バッチファイルで書くこ
ともできます。しかし、シェルスクリプトはファイル操作やテキストデータの操
作には向いていますが、GUIアプリケーションやゲームにはむいていません。
C/C++/Java プログラムを書くこともできますが、最初の試し書きだけでもかな
りの時間がかかってしまいます。Pythonはもっと簡単に利用でき、Windows、
macOS、そして Unix オペレーティングシステムで動作し、あなたの仕事をすば
やく片付ける助けになるでしょう。

Python は簡単に利用できますが、本物のプログラミング言語であり、シェルス
クリプトやバッチファイルよりも多くの機構があり、大きなプログラムの開発に
も適しています。一方では、Python は C よりたくさんのエラーチェックを実行
時に行っており、また可変長配列や辞書などの高級な型を組込みで持つ '超高級
言語(very-high-level language)' です。Python は Awk や Perl などよりも汎
用的なデータ型を備えており、より多くの領域で利用できます。また、Pythonは
これらの言語と比べても、少なくとも同じぐらいには簡単です。

Python では、プログラムをモジュールに分割して、他の Python プログラムで
再利用できます。Python には膨大な標準モジュールが付属していて、プログラ
ムを作る上での基盤として、あるいは Python プログラミングを学ぶためのサン
プルとして利用できます。標準モジュールには、ファイル I/O、システムコール
、ソケットといった機能や、Tk のようなグラフィカルユーザインターフェース
ツールキットを使うためのインターフェイスなども提供しています。

Python はインタプリタ言語です。コンパイルやリンクの必要がないので、プロ
グラムを開発する際にかなりの時間を節約できます。インタプリタは対話的にも
使えるので、言語の様々な機能について実験してみたり、書き捨てのプログラム
を書いたり、ボトムアップでプログラムを開発する際に、関数をテストしたりと
いったことが簡単にできます。便利な電卓にもなります。

Python では、とてもコンパクトで読みやすいプログラムを書けます。Python で
書かれたプログラムは大抵、同じ機能の C 言語, C++ 言語や Java のプログラ
ムよりもはるかに短くなります。これには以下のようないくつかの理由がありま
す:

   * 高レベルのデータ型によって、複雑な操作を一つの実行文で表現できます
     。

   * 実行文のグループ化を、グループの開始や終了の括弧ではなくインデント
     で行えます。

   * 変数や引数の宣言が不要です。

Python には '拡張性' があります: C 言語でプログラムを書く方法を知ってい
るなら、簡単に新たな組み込み関数やモジュールを、簡単にインタプリタに追加
できます。これによって、いちばん時間のかかる処理を高速化したり、ベンダ特
有のグラフィクスライブラリなどの、 バイナリ形式でしか手に入らないライブ
ラリを Python にリンクしたりできます。その気になれば、Python インタプリ
タを C で書かれたアプリケーションにリンクして、アプリケーションに対する
拡張言語や命令言語としても使えます。

ところで、この言語は BBC のショー番組、"モンティパイソンの空飛ぶサーカス
(Monty Python's Flying Circus)" から取ったもので、爬虫類とは関係ありませ
ん。このドキュメントでは、モンティパイソンの寸劇への参照が許可されている
だけでなく、むしろ推奨されています！

さて、皆さんはもう Python にワクワクして、もうちょっと詳しく調べてみたく
なったはずです。プログラミング言語を習得する最良の方法は使ってみることで
すから、このチュートリアルではみなさんが読んだ内容を Python インタプリタ
で試してみることをおすすめします。

次の章では、まずインタプリタの使い方を説明します。これはわかりきった内容
かもしれませんが、後に説明する例題を試してみる上で不可欠なことです。

チュートリアルの残りの部分では、Python プログラム言語と実行システムの様
々な機能を例題を交えて紹介します。単純な式、実行文、データ型から始めて、
関数とモジュールを経て、最後には例外処理やユーザ定義クラスといったやや高
度な概念にも触れます。


File: python.info,  Node: Python インタプリタを使う,  Next: 形式ばらない Python の紹介,  Prev: やる気を高めよう,  Up: Python チュートリアル

2.2 Python インタプリタを使う
=============================

* Menu:

* インタプリタを起動する::
* インタプリタとその環境::


File: python.info,  Node: インタプリタを起動する,  Next: インタプリタとその環境,  Up: Python インタプリタを使う

2.2.1 インタプリタを起動する
----------------------------

Python が使用可能な環境では、インタプリタは一般的に
‘/usr/local/bin/python3.14’ にインストールされています。使用している
Unix シェルの検索パスに ‘/usr/local/bin’ を追加すると、次のコマンドでイ
ンタプリタを開始できます:

     python3.14

(1) どのディレクトリに Python インタプリタをインストールするかはインスト
ール時に選択できるので、インタプリタは他のディレクトリにあるかもしれませ
ん; 身近な Python に詳しい人か、システム管理者に聞いてみてください。 (例
えば、その他の場所としては ‘/usr/local/python’ が一般的です。)

*note Microsoft ストア: 1fc9. からPythonのインストールを行った Windows マ
シンでは、 ‘python3.14’ コマンドが利用できます。 *note py.exe ランチャ:
7da. をインストールした場合、 ‘py’ コマンドが使えます。 Python を起動す
る他の方法については *note Python install manager: 1fca. を参照してくだ
さい。

ファイル終端文字 (Unixでは ‘Control’-‘D’ 、DOS や Windows では
‘Control’-‘Z’) を一次プロンプト (訳注: '>>>' のこと) に入力すると、イン
タプリタが終了ステータス 0 で終了します。もしこの操作がうまく働かないな
ら、コマンド: ‘quit()’ と入力すればインタプリタを終了できます。

The interpreter's line-editing features include interactive editing,
history substitution and code completion on most systems.  Perhaps the
quickest check to see whether command line editing is supported is
typing a word in on the Python prompt, then pressing Left arrow (or
‘Control’-‘b’).  If the cursor moves, you have command line editing; see
Appendix *note 対話入力編集と履歴置換: 1fcb. for an introduction to the
keys.  If nothing appears to happen, or if a sequence like ‘^[[D’ or
‘^B’ appears, command line editing isn't available; you'll only be able
to use backspace to remove characters from the current line.

インタプリタは Unix シェルと同じように使えます。標準入力が端末に接続され
た状態では、コマンドを対話的に読み込んで実行します。ファイル名を引数に指
定するか、‘python3 < filename’ のように標準入力ファイルとして指定すると
、インタプリタはファイルから 'スクリプト' を読み込んで実行します。

インタプリタを ‘python -c command [arg] ...’ のように起動する方法もあり
ます。この形式では、シェルの *note -c: 1a8. オプションと同じように、
'command' に指定した文を実行します。 Python 文には、スペースなどのシェル
にとって特殊な意味をもつ文字がしばしば含まれるので、 'command' 全体をク
ォート(訳注: ‘'’)で囲っておいたほうが良いでしょう。

Python のモジュールには、スクリプトとしても便利に使えるものがあります。
‘python -m module [arg] ...’ のように起動すると、 'module' のソースファ
イルを、フルパスを指定して起動したかのように実行できます。

スクリプトファイルを使用する場合、スクリプトの実行が完了した後、そのまま
対話モードに入れると便利なことがあります。これには *note -i: 16f4. をス
クリプト名の前に追加します。

全てのコマンドラインオプションは *note コマンドラインと環境: 1da7. で説
明されています。

* Menu:

* 引数の受け渡し::
* 対話モード::

   ---------- Footnotes ----------

   (1) Unixでは、Python 3.x インタープリタの実行ファイルはデフォルトでは
‘python’ という名前ではインストールされません。同時にインストールされた
Python 2.x 実行ファイルと衝突させないためです。


File: python.info,  Node: 引数の受け渡し,  Next: 対話モード,  Up: インタプリタを起動する

2.2.1.1 引数の受け渡し
......................

スクリプト名と引数を指定してインタプリタを起動した場合、スクリプト名やス
クリプト名以後に指定した引数は、文字列のリストに変換されて ‘sys’ モジュ
ールの ‘argv’ 変数に格納されます。 ‘import sys’ とすることでこのリストに
アクセスできます。 ‘sys.argv’ には少なくとも一つ要素が入っています。スク
リプト名も引数も指定しなければ、 ‘sys.argv[0]’ は空の文字列になります。
スクリプト名の代わりに ‘'-'’ (標準入力を意味します) を指定すると、
‘sys.argv[0]’ は ‘'-'’ になります。 *note -c: 1a8. 'command' を使うと、
‘sys.argv[0]’ は ‘'-c'’ になります。 *note -m: 23c. 'module' を使った場
合、 ‘sys.argv[0]’ はモジュールのフルパスになります。 Python インタープ
リタは、*note -c: 1a8. 'command' や *note -m: 23c. 'module' の後ろに指定
したオプションは無視します。無視された引数は、‘sys.argv’ を使って
'command' や 'module' から参照できます。


File: python.info,  Node: 対話モード,  Prev: 引数の受け渡し,  Up: インタプリタを起動する

2.2.1.2 対話モード
..................

インタプリタが命令を端末 (tty) やコマンドプロンプトから読み取っている場
合、インタプリタは '対話モード (interactive mode)' で動作しているといい
ます。 このモードでは、インタプリタは '一次プロンプト (primary prompt)'
を表示して、ユーザにコマンドを入力するよう促します。一次プロンプトは普通
、三つの「大なり記号」 (‘>>>’) です。継続行では、インタプリタは '二次プ
ロンプト (secondary prompt)' を表示します。二次プロンプトは、デフォルト
では三つのドット (‘...’) です。 インタプリタは、最初のプロンプトを出す前
にバージョン番号と著作権表示から始まる起動メッセージを出力します:

     $ python3.14
     Python 3.14 (default, April 4 2024, 09:25:04)
     [GCC 10.2.0] on linux
     Type "help", "copyright", "credits" or "license" for more information.
     >>>

継続行は、複数行の構文を入力するときに使います。例えば、 *note if: 181.
文は継続行を使用します

     >>> the_world_is_flat = True
     >>> if the_world_is_flat:
     ...     print("Be careful not to fall off!")
     ...
     Be careful not to fall off!

対話モードについての詳細は *note 対話モード: 494. を参照してください。


File: python.info,  Node: インタプリタとその環境,  Prev: インタプリタを起動する,  Up: Python インタプリタを使う

2.2.2 インタプリタとその環境
----------------------------

* Menu:

* ソースコードの文字コード::


File: python.info,  Node: ソースコードの文字コード,  Up: インタプリタとその環境

2.2.2.1 ソースコードの文字コード
................................

デフォルトでは、Python のソースコードは UTF-8 でエンコードされているもの
として扱われます。UTF-8 では、世界中のほとんどの言語の文字を、同時に文字
列リテラル、識別子、コメントなどに書けます。-- ただし、標準ライブラリは
識別子に ASCII 文字のみを利用していて、その他のポータブルなコードもその
慣習に従うべきです。それらの文字を正しく表示するためには、エディターはそ
のファイルが UTF-8 である事を識別して、そのファイルに含まれている文字を
全てサポートしたフォントを使わなければなりません。

デフォルトエンコーディング以外のエンコーディングを使用するには、ファイル
の '先頭' の行に特別なコメントを追加しなければなりません。書式は以下の通
りです:

     # -*- coding: encoding -*-

'encoding' には、Python が *note codecs: 1c. でサポートしている有効なエ
ンコーディングを指定します。

例えば、Windows-1252 エンコーディングを使用するには、ソースコードファイ
ルの先頭行は下記のようにします:

     # -*- coding: cp1252 -*-

ソースコードが *note UNIX "shebang" 行: 1fd3. で始まる場合には、'先頭行'
のルールは当てはまりません。 この場合には、エンコーディングの宣言はファ
イルの2行目に追加します。 例えば以下のようになります:

     #!/usr/bin/env python3
     # -*- coding: cp1252 -*-

脚注
....


File: python.info,  Node: 形式ばらない Python の紹介,  Next: その他の制御フローツール,  Prev: Python インタプリタを使う,  Up: Python チュートリアル

2.3 形式ばらない Python の紹介
==============================

以下のサンプルでは、入力と出力はプロンプト (*note >>>: 492. や *note
...: 493.) の有無で区別します: 例を実際に試す場合は、プロンプトが表示さ
れているときに、サンプル中のプロンプトから後ろの内容全てを入力します。

このマニュアルにあるサンプルの多くは、対話プロンプトで入力されるものでも
コメントを含んでいます。 Python におけるコメント文は、ハッシュ文字 ‘#’ で
始まり、物理行の終わりまで続きます。コメントは行の先頭にも、空白やコード
の後にも書くことができますが、文字列リテラルの内部に置くことはできません
。文字列リテラル中のハッシュ文字はただのハッシュ文字です。コメントはコー
ドを明快にするためのものであり、Pythonはコメントを解釈しません。なので、
サンプルコードを実際に入力して試して見るときは、コメントを省いても大丈夫
です。

いくつかの例です:

     # これは最初のコメント
     spam = 1  # そしてこれは2つめのコメント
               # ...そして3つめ!
     text = "# これはクォーテーションの間なのでコメントではない。"

* Menu:

* Python を電卓として使う::
* プログラミングへの第一歩::


File: python.info,  Node: Python を電卓として使う,  Next: プログラミングへの第一歩,  Up: 形式ばらない Python の紹介

2.3.1 Python を電卓として使う
-----------------------------

それでは、簡単な Python コマンドをいくつか試してみましょう。インタプリタ
を起動して、一次プロンプト、 ‘>>>’ が現れるのを待ちます。 (そう長くはか
からないはずです)

* Menu:

* 数::
* テキスト::
* リスト型 (list): リスト型 list.


File: python.info,  Node: 数,  Next: テキスト,  Up: Python を電卓として使う

2.3.1.1 数
..........

インタプリタは、簡単な電卓のように動作します: 式を入力すると、その結果が
表示されます。 式の文法は素直なものです: 演算子 ‘+’ 、 ‘-’ 、 ‘*’ 、 ‘/’
によって算術演算を行うことができ、丸括弧 (‘()’) をグループ化に使うことが
できます。 例えば:

     >>> 2 + 2
     4
     >>> 50 - 5*6
     20
     >>> (50 - 5*6) / 4
     5.0
     >>> 8 / 5  # 除算は常に浮動小数点数(float)を返す
     1.6

整数 (例えば、 ‘2’ 、 ‘4’ 、 ‘20’) は *note int: 19b. 型であり、小数部を
持つ数 (例えば、 ‘5.0’ 、 ‘1.6’) は *note float: 196. 型です。数値型につ
いては後のチュートリアルでさらに見ていきます。

除算 (‘/’) は常に浮動小数点数を返します。 ‘//’ 演算子は *note 整数除算:
b3e. を行い、整数値を返します; 剰余は、‘%’ で求めます。:

     >>> 17 / 3  # 除算は浮動小数点数を返す
     5.666666666666667
     >>>
     >>> 17 // 3  # 整数除算は小数部を破棄する
     5
     >>> 17 % 3  # % 演算子は剰余を返す
     2
     >>> 5 * 3 + 2  # 切り捨てられた商 * 除数 + 剰余
     17

Python では、冪乗を計算するのに ‘**’ 演算子が使えます (1):

     >>> 5 ** 2  # 5の2乗
     25
     >>> 2 ** 7  # 2の7乗
     128

等号 (‘=’) は変数に値を代入するときに使います。代入を行っても、結果は出
力されず、次の入力プロンプトが表示されます。:

     >>> width = 20
     >>> height = 5 * 9
     >>> width * height
     900

変数が "定義" されていない (つまり値が代入されていない) 場合、その変数を
使おうとするとエラーが発生します:

     >>> n  # 未定義の変数にアクセスする
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     NameError: name 'n' is not defined

浮動小数点を完全にサポートしています。演算対象の値(オペランド)に複数の型
が入り混じっている場合、演算子は整数のオペランドを浮動小数点型に変換しま
す:

     >>> 4 * 3.75 - 1
     14.0

対話モードでは、最後に表示された結果は変数 ‘_’ に代入されます。このこと
を利用すると、Python を電卓として使うときに、計算を連続して行う作業が多
少楽になります。以下に例を示します:

     >>> tax = 12.5 / 100
     >>> price = 100.50
     >>> price * tax
     12.5625
     >>> price + _
     113.0625
     >>> round(_, 2)
     113.06

この変数には読取りだけを行い、明示的な代入を行ってはいけません -- そんな
ことをすれば、同じ名前で別のローカル変数が生成され、元の特別な動作をする
組み込み変数を覆い隠してしておかしなことになってしまうかもしれません。

*note int: 19b. と *note float: 196. に加え、 Python は *note Decimal:
1fe. や *note Fraction: 213. などの他の数値型もサポートしています。
*note 複素数: 1fdc. も組み込み型としてサポートしており、 ‘j’ もしくは
‘J’ 接尾辞を使って虚部を示します (例: ‘3+5j’)。

   ---------- Footnotes ----------

   (1) ‘**’ は ‘-’ より優先順位が高いので、‘-3**2’ は ‘-(3**2)’ と解釈さ
れ、計算結果は ‘-9’ になります。これを避けて ‘9’ を得たければ、‘(-3)**2’
と書きます。


File: python.info,  Node: テキスト,  Next: リスト型 list,  Prev: 数,  Up: Python を電卓として使う

2.3.1.2 テキスト
................

Python は数値だけでなくテキスト (いわゆる「文字列」である *note str:
169. 型によって表現されます) を扱うことができます。 ‘!’ のような文字や
‘rabbit’ のような単語、 ‘Paris’ のような名前、 ‘Got your back.’ ような文
もすべて文字列です。 文字列はシングルクォート (‘'...'’) またはダブルクォ
ート (‘"..."’) で囲み、どちらを使っても違いはありません (1) 。

     >>> 'spam eggs'  # シングルクォート
     'spam eggs'
     >>> "Paris rabbit got your back :)! Yay!"  # ダブルクォート
     'Paris rabbit got your back :)! Yay!'
     >>> '1975'  # クォートに囲まれた数字も文字列
     '1975'

クォートの中でクォートを使いたい場合、 ‘\’ を前に付け加えることで「エス
ケープ」をする必要があります。 もしくは、文字列で使用したいクォートとは
別の方のクォートで囲むこともできます。

     >>> 'doesn\'t'  #  \' を使用してシングルクォートをエスケープする
     "doesn't"
     >>> "doesn't"  # または代わりにダブルクォートを使用する
     "doesn't"
     >>> '"Yes," they said.'
     '"Yes," they said.'
     >>> "\"Yes,\" they said."
     '"Yes," they said.'
     >>> '"Isn\'t," they said.'
     '"Isn\'t," they said.'

Python シェルでは、文字列を定義するときと文字列が出力されるときでは見え
方が異なることがあります。 *note print(): 1177. 関数を使うと、両端のクォ
ートがなくなり、エスケープされた文字や特殊文字が表示されるため、より読み
やすい形で出力できます。

     >>> s = 'First line.\nSecond line.'  # \n は改行を意味する
     >>> s  # print() を使用しない場合、特殊文字が文字列に含まれる
     'First line.\nSecond line.'
     >>> print(s)  # print() では特殊文字は解釈されるため、\n は改行となる
     First line.
     Second line.

‘\’ に続く文字を特殊文字として解釈されたくない場合は、最初の引用符の前に
‘r’ を付けた 'raw strings' が使えます:

     >>> print('C:\some\name')  # ここでは \n は改行を意味する!
     C:\some
     ame
     >>> print(r'C:\some\name')  # 引用符の前 r に注目
     C:\some\name

raw文字列には微妙な面があります: raw文字列は奇数個の'''' 文字では終了で
きません。詳細と解決方法については *note the FAQ entry: 1fdf. を参照して
ください。

文字列リテラルは複数行にまたがって書けます。1 つの方法は三連引用符
(‘"""..."""’ や ‘'''...'''’) を使うことです。改行文字は自動的に文字列に
含まれますが、行末に ‘\’ を付けることで含めないようにすることもできます
。次の例では最初の改行は含まれません:

     >>> print("""\
     ... Usage: thingy [OPTIONS]
     ...      -h                        Display this usage message
     ...      -H hostname               Hostname to connect to
     ... """)
     Usage: thingy [OPTIONS]
          -h                        Display this usage message
          -H hostname               Hostname to connect to

     >>>

文字列は ‘+’ 演算子で連結させる (くっつけて一つにする) ことができ、‘*’ 演
算子で反復させることができます:

     >>> # 'un' を3回繰り返し、その後に 'ium'
     >>> 3 * 'un' + 'ium'
     'unununium'

連続して並んでいる複数の '文字列リテラル' (つまり、引用符に囲われた文字
列) は、自動的に連結されます。

     >>> 'Py' 'thon'
     'Python'

この機能は、長い文字列を改行したいときにとても役に立ちます:

     >>> text = ('複数の文字列を丸括弧で囲むと'
     ...         '連結される。')
     >>> text
     '複数の文字列を丸括弧で囲むと連結される。'

これは 2 つのリテラルどうしに対してのみ働き、変数や式には働きません:

     >>> prefix = 'Py'
     >>> prefix 'thon'  # 変数と文字列リテラルは連結できない
       File "<stdin>", line 1
         prefix 'thon'
                ^^^^^^
     SyntaxError: invalid syntax
     >>> ('un' * 3) 'ium'
       File "<stdin>", line 1
         ('un' * 3) 'ium'
                    ^^^^^
     SyntaxError: invalid syntax

変数どうしや変数とリテラルを連結したい場合は、‘+’ を使ってください:

     >>> prefix + 'thon'
     'Python'

文字列は 'インデックス' (添字) を指定して文字を取得できます。最初の文字
のインデックスは 0 になります。文字を表す、専用のデータ型は用意されてい
ません; 文字とは、単に長さが 1 の文字列です:

     >>> word = 'Python'
     >>> word[0]  # 0番目の文字
     'P'
     >>> word[5]  # 5番目の文字
     'n'

インデックスには、負の値も指定できまます。この場合、右から数えていきます
:

     >>> word[-1]  # 最後の文字
     'n'
     >>> word[-2]  # 後ろから2番目の文字
     'o'
     >>> word[-6]
     'P'

-0 は 0 と区別できないので、負のインデックスは -1 から始まります。

インデクス表記に加え、 'スライス' もサポートされています。インデクス表記
は個々の文字を取得するのに使いますが、 'スライス' を使うと部分文字列を取
得することができます:

     >>> word[0:2]  # 0番目(含む)から2番目(含めない)までの文字
     'Py'
     >>> word[2:5]  #  2番目(含む)から5番目(含めない)までの文字
     'tho'

スライスのインデックスには、便利なデフォルト値があります; 最初のインデッ
クスを省略すると、0 と見なされます。二番め のインデックスを省略すると、
スライスする文字列のサイズとみなされます。

     >>> word[:2]   # 最初から2番目(含めない)までの文字
     'Py'
     >>> word[4:]   # 4番目(含む)から最後までの文字
     'on'
     >>> word[-2:]  # 後ろから2番目(含む)から最後までの文字
     'on'

開始値は常に含まれ、終了値は常に含まれないことに注意してください。なので
‘s[:i] + s[i:]’ は常に ‘s’ と等しくなります:

     >>> word[:2] + word[2:]
     'Python'
     >>> word[:4] + word[4:]
     'Python'

スライスの使い方をおぼえる良い方法は、インデックスが文字と文字の 'あいだ
(between)' を指しており、最初の文字の左端が 0 になっていると考えることで
す。そうすると、 'n' 文字からなる文字列中の最後の文字の右端はインデック
ス 'n' となります。例えばこうです:

      +---+---+---+---+---+---+
      | P | y | t | h | o | n |
      +---+---+---+---+---+---+
      0   1   2   3   4   5   6
     -6  -5  -4  -3  -2  -1

1行目の数字は文字列の 0 から 6 までのインデックスの位置を示しています;
2行目は対応する負のインデックスを示しています。'i' から 'j' までのスライ
スは、それぞれ 'i' と付いた境界から 'j' と付いた境界までの全ての文字から
成っています。

正のインデックスの場合、スライスされたシーケンスの長さは、スライスの両端
のインデックスが範囲内にあるかぎり、インデックス間の差になります。例えば
、 ‘word[1:3]’ の長さは 2 になります。

大き過ぎるインデックスを使おうとするとエラーが発生します:

     >>> word[42]  # the word only has 6 characters
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     IndexError: string index out of range

しかし、スライスで範囲外のインデックスを使ったときは、上手く対応して扱っ
てくれます:

     >>> word[4:42]
     'on'
     >>> word[42:]
     ''

Python の文字列は変更できません - つまり *note 不変: 15b9. です。従って
、文字列のインデックスで指定したある場所に代入を行うとエラーが発生します
:

     >>> word[0] = 'J'
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: 'str' object does not support item assignment
     >>> word[2:] = 'py'
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: 'str' object does not support item assignment

元の文字列と別の文字列が必要な場合は、新しく文字列を作成してください:

     >>> 'J' + word[1:]
     'Jython'
     >>> word[:2] + 'py'
     'Pypy'

組込み関数 *note len(): 840. は文字列の長さ (length) を返します:

     >>> s = 'supercalifragilisticexpialidocious'
     >>> len(s)
     34

参考
....

*note テキストシーケンス型 -- str: 1fe0.

     文字列は代表的な 'シーケンス型' で、シーケンス型でサポートされてい
     る共通の操作をサポートしています。

*note 文字列メソッド: 1fe1.

     文字列は、基本的な変換や検索を行うための数多くのメソッドをサポート
     しています。

*note f-strings: 19a.

     式の埋め込みをサポートした文字列リテラル

*note 書式指定文字列の文法: 15b3.

     *note str.format(): 833. を使った文字列のフォーマットについての情報
     があります。

*note printf 形式の文字列書式化: 8db.

     文字列が ‘%’ 演算子の左オペランドである場合に呼び出される古いフォー
     マット操作について、詳しく記述されています。

   ---------- Footnotes ----------

   (1) 他の言語と違って、‘\n’ のような特殊文字は、単引用符 (‘'...'’) と
二重引用符 (‘"..."’) で同じ意味を持ちます。両者の唯一の違いは、単引用符
で囲われた箇所では ‘"’ をエスケープする必要がない (ただし ‘\'’ はエスケ
ープする必要がある) ことで、逆もまた同様です。


File: python.info,  Node: リスト型 list,  Prev: テキスト,  Up: Python を電卓として使う

2.3.1.3 リスト型 (list)
.......................

Pythonは多くの '複合 (compound)' データ型を備えており、複数の値をまとめ
るのに使われます。最も汎用性が高いのは 'リスト (list)' で、コンマ区切り
の値 (要素) の並びを角括弧で囲んだものとして書き表されます。リストは異な
る型の要素を含むこともありますが、通常は同じ型の要素のみを持ちます。

     >>> squares = [1, 4, 9, 16, 25]
     >>> squares
     [1, 4, 9, 16, 25]

文字列 (や他の全ての組み込みの *note シーケンス: 716. 型) のように、リス
トはインデックスやスライスができます:

     >>> squares[0]  # インデックス指定は要素を返す
     1
     >>> squares[-1]
     25
     >>> squares[-3:]  # スライスは新しいリストを返す
     [9, 16, 25]

リストは、リストの連結などもサポートしています:

     >>> squares + [36, 49, 64, 81, 100]
     [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]

*note 不変: 15b9. な文字列とは違って、リストは *note 可変: 15ba. 型です
ので、要素を入れ替えられます:

     >>> cubes = [1, 8, 27, 65, 125]  # 何かがおかしい
     >>> 4 ** 3  # 4の3乗は65ではなく64!
     64
     >>> cubes[3] = 64  # 誤った値を置き換える
     >>> cubes
     [1, 8, 27, 64, 125]

*note list.append(): 8dc. 'メソッド' を使って、リストの末尾に新しい要素
を追加できます (メソッドについては後で詳しく見ていきます):

     >>> cubes.append(216)  # 6の3乗を追加
     >>> cubes.append(7 ** 3)  # 7の3乗を追加
     >>> cubes
     [1, 8, 27, 64, 125, 216, 343]

単純な代入ではPythonは決してデータをコピーしません。リストを変数に代入す
ると、その変数は '既存のリスト' を参照します。ある変数を通してリストに任
意の変更を行うと、そのリストを参照したすべての他の変数を通して確認できま
す。:

     >>> rgb = ["Red", "Green", "Blue"]
     >>> rgba = rgb
     >>> id(rgb) == id(rgba)  # 同じオブジェクトを参照している
     True
     >>> rgba.append("Alph")
     >>> rgb
     ["Red", "Green", "Blue", "Alph"]

全てのスライス操作は、指定された要素を含む新しいリストを返します。例えば
、次のスライスは、リストの *note 浅いコピー: 1fe4. を返します。:

     >>> correct_rgba = rgba[:]
     >>> correct_rgba[-1] = "Alpha"
     >>> correct_rgba
     ["Red", "Green", "Blue", "Alpha"]
     >>> rgba
     ["Red", "Green", "Blue", "Alph"]

スライスには、代入もできます。スライスの代入で、リストのサイズを変更した
り、全てを削除したりもできます:

     >>> letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
     >>> letters
     ['a', 'b', 'c', 'd', 'e', 'f', 'g']
     >>> # 一部の値を置き換える
     >>> letters[2:5] = ['C', 'D', 'E']
     >>> letters
     ['a', 'b', 'C', 'D', 'E', 'f', 'g']
     >>> # 一部の値を削除する
     >>> letters[2:5] = []
     >>> letters
     ['a', 'b', 'f', 'g']
     >>> # 要素全体を空のリストに置き換えてリストをクリアする
     >>> letters[:] = []
     >>> letters
     []

組込み関数 *note len(): 840. はリストにも使えます:

     >>> letters = ['a', 'b', 'c', 'd']
     >>> len(letters)
     4

リストを入れ子 (ほかのリストを含むリストを造る) にできます。例えば:

     >>> a = ['a', 'b', 'c']
     >>> n = [1, 2, 3]
     >>> x = [a, n]
     >>> x
     [['a', 'b', 'c'], [1, 2, 3]]
     >>> x[0]
     ['a', 'b', 'c']
     >>> x[0][1]
     'b'


File: python.info,  Node: プログラミングへの第一歩,  Prev: Python を電卓として使う,  Up: 形式ばらない Python の紹介

2.3.2 プログラミングへの第一歩
------------------------------

もちろん、2 たす 2 よりももっと複雑な課題にも Python を使えます。 例えば
、Fibonacci series(1) の先頭の部分列は次のように書けます:

     >>> # フィボナッチ数列:
     >>> # 2つの要素の和で次の値を定義する
     >>> a, b = 0, 1
     >>> while a < 10:
     ...     print(a)
     ...     a, b = b, a+b
     ...
     0
     1
     1
     2
     3
     5
     8

上の例では、いくつか新しい機能を使用しています。

   * 最初の行には '複数同時の代入 (multiple assignment)' が入っています:
     変数 ‘a’ と ‘b’ は、それぞれ同時に新しい値 0 と 1 になっています。
     この代入は、最後の行でも使われています。代入文では、まず右辺の式が
     すべて評価され、次に代入が行われます。右辺の式は、左から右へと順番
     に評価されます。

   * *note while: 1973. は、条件 (ここでは '' a < 10'') が真である限り実
     行を繰り返し (ループし) ます。Python では、C 言語と同様に、ゼロでな
     い整数値は真となり、ゼロは偽です。条件式には、文字列値やリスト値な
     ども使えます。それ以外のシーケンスも、条件式として使用できます。長
     さが 1 以上のシーケンスは真で、空のシーケンスは偽になります。サンプ
     ルで使われている条件テストはシンプルな比較です。標準的な比較演算子
     は C 言語と同様です: すなわち、 ‘<’ (より小さい)、 ‘>’ (より大きい
     )、 ‘==’ (等しい)、 ‘<=’ (より小さいか等しい)、 ‘>=’ (より大きいか
     等しい)、および ‘!=’ (等しくない)、です。

   * ループの '本体 (body)' は、 'インデント (indent, 字下げ)' されてい
     ます: インデントは Python において、実行文をグループにまとめる方法
     です。対話的プロンプトでは、インデントされた各行を入力するにはタブ
     や (複数個の) スペースを使わなければなりません。実用的には、もっと
     複雑な処理を入力する場合はテキストエディタを使うことになるでしょう
     。 ほとんどのテキストエディタは、自動インデント機能を持っています。
     複合文を対話的に入力するときには、入力完了のしるしとして最後に空行
     を入力します。これは、パーザはどれが最後の行を入力なのか、判断でき
     ないためです。基本的なブロック内では、全ての行は同じだけインデント
     されていなければならないので注意してください。

   * *note print(): 1177. 関数は、与えられた引数の値を書き出します。これ
     は (前に電卓の例でやったような) 単に出力したい式を書くのとは、複数
     の引数や浮動小数点量や文字列に対する扱い方が違います。*note
     print(): 1177. 関数では、文字列は引用符無しで出力され、要素の間に空
     白が挿入されて、このように出力の書式が整えられます:

          >>> i = 256*256
          >>> print('The value of i is', i)
          The value of i is 65536

     キーワード引数 'end' を使うと、出力の末尾に改行文字を出力しないよう
     にしたり、別の文字列を末尾に出力したりできます:

          >>> a, b = 0, 1
          >>> while a < 1000:
          ...     print(a, end=',')
          ...     a, b = b, a+b
          ...
          0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,

脚注
....

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Fibonacci_sequence


File: python.info,  Node: その他の制御フローツール,  Next: データ構造,  Prev: 形式ばらない Python の紹介,  Up: Python チュートリアル

2.4 その他の制御フローツール
============================

前章で紹介した *note while: 1973. 文の他にも、 Python にはいくつか制御フ
ローツールがあり、本章で説明します。

* Menu:

* if 文::
* for 文::
* range() 関数: range 関数.
* break 文と continue 文::
* ループの else 節::
* pass 文::
* match 文::
* 関数を定義する::
* 関数定義についてもう少し::
* 間奏曲; コーディングスタイル: 間奏曲 コーディングスタイル.


File: python.info,  Node: if 文,  Next: for 文,  Up: その他の制御フローツール

2.4.1 ‘if’ 文
-------------

おそらく最もおなじみの文型は *note if: 181. 文でしょう。例えば:

     >>> x = int(input("Please enter an integer: "))
     Please enter an integer: 42
     >>> if x < 0:
     ...     x = 0
     ...     print('Negative changed to zero')
     ... elif x == 0:
     ...     print('Zero')
     ... elif x == 1:
     ...     print('Single')
     ... else:
     ...     print('More')
     ...
     More

ゼロ個以上の *note elif: 17b. 部を使うことができ、 *note else: 17c. 部を
付けることもできます。キーワード '‘elif’' は 'else if' を短くしたもので
、過剰なインデントを避けるのに役立ちます。一連の ‘if’ ...  ‘elif’ ...
‘elif’ ...  は、他の言語における ‘switch’ 文や ‘case’ 文の代用となります
。

いくつかの定数と同じ値かを比較する場合や、特定の型や属性かを確認する場合
には、‘match’ 文が便利です。詳細は *note match 文: 1fed. を参照してくだ
さい。


File: python.info,  Node: for 文,  Next: range 関数,  Prev: if 文,  Up: その他の制御フローツール

2.4.2 ‘for’ 文
--------------

Python の *note for: 34a. 文は、読者が C 言語や Pascal 言語で使いなれて
いるかもしれない *note for: 34a. 文とは少し違います。 (Pascal のように)
常に算術型の数列にわたる反復を行ったり、 (C のように) 繰返しステップと停
止条件を両方ともユーザが定義できるようにするのとは違い、Python の ‘for’
文は、任意のシーケンス型 (リストまたは文字列) にわたって反復を行います。
反復の順番はシーケンス中に要素が現れる順番です。例えば:

     >>> # 文字列の長さを計測:
     >>> words = ['cat', 'window', 'defenestrate']
     >>> for w in words:
     ...     print(w, len(w))
     ...
     cat 3
     window 6
     defenestrate 12

コレクションオブジェクトの値を反復処理をしているときに、そのコレクション
オブジェクトを変更するコードは理解するのが面倒になり得ます。 そうするよ
りも、コレクションオブジェクトのコピーに対して反復処理をするか、新しいコ
レクションオブジェクトを作成する方が通常は理解しやすいです:

     # コレクション作成
     users = {'Hans': 'active', 'Éléonore': 'inactive', '景太郎': 'active'}

     # 方針:  コピーを反復
     for user, status in users.copy().items():
         if status == 'inactive':
             del users[user]

     # 方針:  新コレクション作成
     active_users = {}
     for user, status in users.items():
         if status == 'active':
             active_users[user] = status


File: python.info,  Node: range 関数,  Next: break 文と continue 文,  Prev: for 文,  Up: その他の制御フローツール

2.4.3 ‘range()’ 関数
--------------------

数列にわたって反復を行う必要がある場合、組み込み関数 *note range(): b3d.
が便利です。この関数は算術型の数列を生成します:

     >>> for i in range(5):
     ...     print(i)
     ...
     0
     1
     2
     3
     4

指定した終端値は生成されるシーケンスには入りません。‘range(10)’ は 10 個
の値を生成し、長さ 10 のシーケンスにおける各項目のインデクスとなります。
range を別の数から開始したり、他の増加量 (負でも; 増加量は時に 'ステップ
(step)' と呼ばれることもあります) を指定することもできます:

     >>> list(range(5, 10))
     [5, 6, 7, 8, 9]

     >>> list(range(0, 10, 3))
     [0, 3, 6, 9]

     >>> list(range(-10, -100, -30))
     [-10, -40, -70]

あるシーケンスにわたってインデクスで反復を行うには、 *note range(): b3d.
と *note len(): 840. を次のように組み合わせられます:

     >>> a = ['Mary', 'had', 'a', 'little', 'lamb']
     >>> for i in range(len(a)):
     ...     print(i, a[i])
     ...
     0 Mary
     1 had
     2 a
     3 little
     4 lamb

しかし、多くの場合は *note enumerate(): 169a. 関数を使う方が便利です。
*note ループのテクニック: 1ff2. を参照してください。

range を直接出力すると変なことになります:

     >>> range(10)
     range(0, 10)

*note range(): b3d. が返すオブジェクトは、いろいろな点でリストであるかの
ように振る舞いますが、本当はリストではありません。これは、イテレートした
時に望んだ数列の連続した要素を返すオブジェクトです。しかし実際にリストを
作るわけではないので、スペースの節約になります。

このようなオブジェクトは *note イテラブル: 12f1. と呼ばれます。 これらは
関数や構成物のターゲットとして、あるだけの項目を逐次与えるのに適していま
す。 *note for: 34a. 文がそのような構成物であることはすでに見てきており
、イテラブルを受け取る関数の例には *note sum(): 695. があります:

     >>> sum(range(4))  # 0 + 1 + 2 + 3
     6

Later we will see more functions that return iterables and take
iterables as arguments.  In chapter *note データ構造: 1ff3, we will
discuss *note list(): 24d. in more detail.


File: python.info,  Node: break 文と continue 文,  Next: ループの else 節,  Prev: range 関数,  Up: その他の制御フローツール

2.4.4 ‘break’ 文と ‘continue’ 文
--------------------------------

*note break: 17f. 文は、その ‘break’ 文を内包している最も内側にある
*note for: 34a. 文または *note while: 1973. 文から抜け出すことができます
:

     >>> for n in range(2, 10):
     ...     for x in range(2, n):
     ...         if n % x == 0:
     ...             print(f"{n} は {x} * {n//x} と等しい")
     ...             break
     ...
     4 は 2 * 2 と等しい
     6 は 2 * 3 と等しい
     8 は 2 * 4 と等しい
     9 は 3 * 3 と等しい

*note continue: 180. 文はループの次のイテレーションを実行します:

     >>> for num in range(2, 10):
     ...     if num % 2 == 0:
     ...         print(f"偶数 {num} を見つけた")
     ...         continue
     ...     print(f"奇数 {num} を見つけた")
     ...
     偶数 2 を見つけた
     奇数 3 を見つけた
     偶数 4 を見つけた
     奇数 5 を見つけた
     偶数 6 を見つけた
     奇数 7 を見つけた
     偶数 8 を見つけた
     奇数 9 を見つけた


File: python.info,  Node: ループの else 節,  Next: pass 文,  Prev: break 文と continue 文,  Up: その他の制御フローツール

2.4.5 ループの ‘else’ 節
------------------------

‘for’ または ‘while’ ループ中の ‘break’ 文は ‘else’ 節と対になる場合があ
ります。‘break’ を実行せずにループが終了すると、‘else’ 節が実行されます
。

*note for: 34a. 文の場合、 ‘else’ 節はループ処理の最後のイテレーションが
実行されたあと、つまりbreakが発生しなかった場合に実行されます。

*note while: 1973. 文の場合は、ループ条件が偽となったあとに実行されます
。

どちらのループでも、ループが *note break: 17f. によって終了した場合は
‘else’ 句は '実行されません'。当然、 *note return: 1af. や例外の発生によ
ってループが途中で終了した場合にも、*note else: 17c. 節の実行はスキップ
されます。

その例として、素数を探索する ‘for’ 文を以下に示します:

     >>> for n in range(2, 10):
     ...     for x in range(2, n):
     ...         if n % x == 0:
     ...             print(n, 'は', x, '*', n//x, 'と等しい')
     ...             break
     ...     else:
     ...         # 因数が見つからないとループは最後まで実行される
     ...         print(n, 'は素数です')
     ...
     2 is a prime number
     3 is a prime number
     4 equals 2 * 2
     5 is a prime number
     6 equals 2 * 3
     7 is a prime number
     8 equals 2 * 4
     9 equals 3 * 3

(そう、これは正しいコードです。よく見てください: ‘else’ 節は ‘if’ 文 'で
はなく' 、 ‘for’ ループに属しています。)

One way to think of the else clause is to imagine it paired with the
‘if’ inside the loop.  As the loop executes, it will run a sequence like
if/if/if/else.  The ‘if’ is inside the loop, encountered a number of
times.  If the condition is ever true, a ‘break’ will happen.  If the
condition is never true, the ‘else’ clause outside the loop will
execute.

ループの ‘else’ 句は、 ‘if’ 文の ‘else’ よりも *note try: 8f8. 文の
‘else’ に似ています。 文の ‘else’ 句は例外が発生しなかった時に実行され、
ループの ‘else’ 句は ‘break’ されなかった場合に実行されます。 ‘try’ 文と
例外についての詳細は *note 例外を処理する: 1ff9. を参照してください。


File: python.info,  Node: pass 文,  Next: match 文,  Prev: ループの else 節,  Up: その他の制御フローツール

2.4.6 ‘pass’ 文
---------------

*note pass: 17e. 文は何もしません。 *note pass: 17e. は、文を書くことが
構文上要求されているが、プログラム上何の動作もする必要がない時に使われま
す:

     >>> while True:
     ...     pass  # キーボード割り込み(Ctrl+C)のためのビジーウェイト
     ...

これは最小のクラスを作るときによく使われる方法です:

     >>> class MyEmptyClass:
     ...     pass
     ...

*note pass: 17e. のもう 1 つの使い道は、新しいコードを書いているときの関
数や条件文の仮置きの本体としてです。こうすることで、より抽象的なレベルで
考え続けられます。 ‘pass’ は何事も無く無視されます

     >>> def initlog(*args):
     ...     pass   # ここを忘れずに実装すること!
     ...

この最後の例で、多くの人は ‘pass’ ではなく省略記号リテラル ‘...’ を使い
ます。 この使い方は Python に対して特別な意味はなく、言語定義の一部でも
ありません（ここにはどんな定数式でも使えます）が、 ‘...’ は慣例的にプレ
ースホルダ本体としても使われています。 *note Ellipsis オブジェクト:
1ffc. を参照してください。


File: python.info,  Node: match 文,  Next: 関数を定義する,  Prev: pass 文,  Up: その他の制御フローツール

2.4.7 ‘match’ 文
----------------

*note match: a0e. 文は1つの式を指定し、その値と次に続く1つ以上のcaseブロ
ックに指定されたパターンを比較します。この機能はCやJava、JavaScript(や他
の多数の言語)のswitch文と表面的には似ていますが、RustやHaskellのパターン
マッチングにより似ています。最初にマッチしたパターンのみが実行され、コン
ポーネント(シーケンスの要素やオブジェクトの属性)から値を取り出して変数に
代入することもできます。どのcaseにもマッチしない場合はどの分岐も実行され
ません。

最も単純な形式は、対象の値に対して1つ以上のリテラルです:

     def http_error(status):
         match status:
             case 400:
                 return "Bad request"
             case 404:
                 return "Not found"
             case 418:
                 return "I'm a teapot"
             case _:
                 return "Something's wrong with the internet"

最後のブロックについて: 変数名 ‘_’ は 'ワイルドカード' の働きをし、マッ
チに絶対失敗しません。

複数のリテラルを ‘|’ ("or")を使用して組み合わせて1つのパターンにできます
:

     case 401 | 403 | 404:
         return "Not allowed"

パターンはアンパック代入ができ、変数に結びつけられます:

     # point(座標) は (x, y) のタプル
     match point:
         case (0, 0):
             print("原点")
         case (0, y):
             print(f"Y={y}")
         case (x, 0):
             print(f"X={x}")
         case (x, y):
             print(f"X={x}, Y={y}")
         case _:
             raise ValueError("座標ではない")

このコードは注意して見てください！ 最初のパターンには2つのリテラルがあり
、上で示したリテラルパターンの拡張と考えることができます。 しかし次の2つ
のパターンはリテラルと変数の組み合わせのため、対象(‘point’)から値を取り
出して変数に '結びつけ' ます。 4番目のパターンは2つの値を取り込みます。
これは、アンパック代入 ‘(x, y) = point’ と概念的に似ています。

データを構造化するためにクラスを使っている場合は、クラス名の後ろにコンス
トラクターのように引数のリストを指定できます。属性の値は変数に取り込まれ
ます。

     class Point:
         def __init__(self, x, y):
             self.x = x
             self.y = y

     def where_is(point):
         match point:
             case Point(x=0, y=0):
                 print("原点")
             case Point(x=0, y=y):
                 print(f"Y={y}")
             case Point(x=x, y=0):
                 print(f"X={x}")
             case Point():
                 print("それ以外のどこか")
             case _:
                 print("座標ではない")

いくつかの組み込みクラスでは位置引数が使用でき、属性の順番を提供します
(例: データクラス)。クラスの ‘__match_args__’ 特殊属性によって、パターン
の中で属性の明確な位置を定義することもできます。("x", "y")が設定された場
合、以下のすべてのパターンは等価です(すべて属性 ‘y’ が ‘var’ 変数に結び
つけられます):

     Point(1, var)
     Point(1, y=var)
     Point(x=1, y=var)
     Point(y=var, x=1)

おすすめのパターンの読み方は、パターンが、代入文の左辺に配置するものを拡
張した形式であるとみなすことです。 これにより、どの変数になにが代入され
るかが分かります。 単独の名前（上記の ‘var’ など）だけがマッチ文で値が代
入されます。ドット付きの名前（‘foo.bar’ など）、属性名（上記の ‘x=’、
‘y=’ など ）、クラス名（名前の後ろの "(...)"  によって判別される。上記の
‘Point’ など）には値は代入されません。

パターンはいくらでも入れ子 (ネスト) にすることができます。例えば、
‘__match_args__’ を追加した Point クラスのリストに対して次のようにマッチ
を行うことができます:

     class Point:
         __match_args__ = ('x', 'y')
         def __init__(self, x, y):
             self.x = x
             self.y = y

     match points:
         case []:
             print("座標が存在しない")
         case [Point(0, 0)]:
             print("原点")
         case [Point(x, y)]:
             print(f"1つの座標 {x}, {y}")
         case [Point(0, y1), Point(0, y2)]:
             print(f"Y軸の {y1}, {y2} に2つの座標")
         case _:
             print("それ以外のどこか")

パターンに ‘if’ 節を追加できます。これは "ガード" と呼ばれます。ガードが
falseの場合、‘match’ は次のcaseブロックの処理に移動します。ガードを評価
する前に値が取り込まれることに注意してください:

     match point:
         case Point(x, y) if x == y:
             print(f"Y=X at {x}")
         case Point(x, y):
             print(f"対角線上ではない")

この文のその他のいくつか重要な特徴:

   - アンパック代入のように、タプルとリストのパターンでは正確に同じ意味
     で、任意のシーケンスと一致します。重要な例外として、イテレーターや
     文字列ではマッチしません。

   - シーケンスパターンは拡張アンパックをサポート: ‘[x, y, *rest]’ と
     ‘(x, y, *rest)’ はアンパック代入として同じように動作します。‘*’ の
     あとの変数名は ‘_’ でもよく、そのため ‘(x, y, *_)’ は最低でも2つの
     アイテムを持つシーケンスにマッチし、残りのアイテムは変数に結びつけ
     られません。

   - マッピングパターン: ‘{"bandwidth": b, "latency": l}’ は辞書から
     ‘"bandwidth"’ と ‘"latency"’ の値を取り込みます。シーケンスパターン
     とは異なり、それ以外のキーは無視されます。アンパッキングのような
     ‘**rest’ もサポートされています（しかし、 ‘**_’ は冗長なため禁止さ
     れています）。

   - サブパターンでは ‘as’ キーワードを使用して値を取り込みます:

          case (Point(x1, y1), Point(x2, y2) as p2): ...

     この例では入力から2番目の要素を ‘p2’ として取り込みます（入力が2つ
     のポイントのシーケンスである場合）

   - ほとんどのリテラルは同一性を比較しますが、シングルトンの ‘True’、
     ‘False’、‘None’ では識別値を比較します。

   - Patterns may use named constants.  These must be dotted names to
     prevent them from being interpreted as capture variables:

          from enum import Enum
          class Color(Enum):
              RED = 'red'
              GREEN = 'green'
              BLUE = 'blue'

          color = Color(input("Enter your choice of 'red', 'blue' or 'green': "))

          match color:
              case Color.RED:
                  print("I see red!")
              case Color.GREEN:
                  print("Grass is green")
              case Color.BLUE:
                  print("I'm feeling the blues :(")

より詳細な説明と追加の例は PEP 636(1) にチュートリアル形式で記述してあり
ます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0636/


File: python.info,  Node: 関数を定義する,  Next: 関数定義についてもう少し,  Prev: match 文,  Up: その他の制御フローツール

2.4.8 関数を定義する
--------------------

フィボナッチ数列 (Fibonacci series) を任意の上限値まで書き出すような関数
を作成できます:

     >>> def fib(n):    # nまでのフィボナッチ数を出力する
     ...     """nまでのフィボナッチ数をprintする。"""
     ...     a, b = 0, 1
     ...     while a < n:
     ...         print(a, end=' ')
     ...         a, b = b, a+b
     ...     print()
     ...
     >>> # 定義した関数を呼び出す:
     >>> fib(2000)
     0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597

*note def: 1673. は関数の '定義 (definition)' を導くキーワードです。
*note def: 1673. の後には、関数名と仮引数を丸括弧で囲んだリストを続けな
ければなりません。関数の実体を構成する実行文は次の行から始め、インデント
されていなければなりません。

関数の本体の記述する文の最初の行は文字列リテラルにすることもできます。そ
の場合、この文字列は関数のドキュメンテーション文字列 (documentation
string)、または 'docstring' と呼ばれます。 (docstring については *note
ドキュメンテーション文字列: 2000. でさらに扱っています。) ドキュメンテー
ション文字列を使ったツールには、オンライン文書や印刷文書を自動的に生成し
たり、ユーザが対話的にコードから直接閲覧できるようにするものがあります。
自分が書くコードにドキュメンテーション文字列を入れるのはよい習慣です。書
く癖をつけてください。

関数を '実行 (execution)' するとき、関数のローカル変数のために使われる新
たなシンボルテーブル (symbol table) が用意されます。 もっと正確にいうと
、関数内で変数への代入を行うと、その値はすべてこのローカルなシンボルテー
ブルに記憶されます。 一方、変数の参照を行うと、まずローカルなシンボルテ
ーブルが検索され、次にさらに外側の関数のローカルなシンボルテーブルを検索
し、その後グローバルなシンボルテーブルを調べ、最後に組み込みの名前テーブ
ルを調べます。 従って、関数の中では (グローバル変数が *note global: 4ac.
文で指定されていたり、外側の関数の変数が *note nonlocal: 14bf. 文で指定
されていない限り) グローバル変数や外側の関数の変数に直接値を代入できませ
んが、参照することはできます。

関数を呼び出す際の実際の引数 (実引数) は、関数が呼び出されるときに関数の
ローカルなシンボルテーブル内に取り込まれます。そうすることで、実引数は
'値渡し (call by value)' で関数に渡されることになります (ここでの '値
(value)' とは常にオブジェクトへの '参照(reference)' をいい、オブジェクト
の値そのものではありません) (1)。ある関数がほかの関数を呼び出すときや、
自身を再帰的に呼び出すときには、新たな呼び出しのためにローカルなシンボル
テーブルが新たに作成されます。

関数の定義を行うと、関数名は関数オブジェクトとともに現在のシンボルテーブ
ル内に取り入れられます。インタープリタはその名前が指すオブジェクトをユー
ザ定義関数 (user-defined function) として認識します。他の名前も同じ関数
オブジェクトを指すことができ、またその関数にアクセスするために使用するこ
とができます:

     >>> fib
     <function fib at 10042ed0>
     >>> f = fib
     >>> f(100)
     0 1 1 2 3 5 8 13 21 34 55 89

他の言語出身の人からは、 ‘fib’ は値を返さないので関数ではなく手続き
(procedure) だと異論があるかもしれませんね。技術的に言えば、実際には
*note return: 1af. 文を持たない関数もややつまらない値ですが値を返してい
ます。この値は ‘None’ と呼ばれます (これは組み込みの名前です)。 ‘None’ だ
けを書き出そうとすると、インタプリタは通常出力を抑制します。本当に出力し
たいのなら、以下のように *note print(): 1177. を使うと見ることができます
:

     >>> fib(0)
     >>> print(fib(0))
     None

フィボナッチ数列の数からなるリストを出力する代わりに、値を返すような関数
を書くのは簡単です:

     >>> def fib2(n):  # nまでのフィボナッチ数を返す
     ...     """nまでのフィボナッチ数を含むリストを返す。"""
     ...     result = []
     ...     a, b = 0, 1
     ...     while a < n:
     ...         result.append(a)    # 以下参照
     ...         a, b = b, a+b
     ...     return result
     ...
     >>> f100 = fib2(100)    # 関数を呼び出す
     >>> f100                # 結果を出力する
     [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]

この例は Python の新しい機能を示しています:

   * *note return: 1af. 文では、関数から一つ値を返します。 ‘return’ の引
     数となる式がない場合、 ‘None’ が返ります。関数が終了したときにも
     ‘None’ が返ります。

   * 文 ‘result.append(a)’ では、リストオブジェクト ‘result’ の 'メソッ
     ド (method)' を呼び出しています。メソッドとは、オブジェクトに '属し
     ている' 関数のことで、 ‘obj’ を何らかのオブジェクト (式であっても構
     いません)、 ‘methodname’ をそのオブジェクトで定義されているメソッド
     名とすると、 ‘obj.methodname’ と書き表されます。異なる型は異なるメ
     ソッドを定義しています。異なる型のメソッドで同じ名前のメソッドを持
     つことができ、あいまいさを生じることはありません。 ('クラス
     (class)' を使うことで、自前のオブジェクト型とメソッドを定義すること
     もできます。 *note クラス: 2001. 参照) 例で示されているメソッド
     ‘append()’ は、リストオブジェクトで定義されています; このメソッドは
     リストの末尾に新たな要素を追加します。この例での *note append():
     8dc. は ‘result = result + [a]’ と等価ですが、より効率的です。

   ---------- Footnotes ----------

   (1) 実のところ、'オブジェクトへの参照渡し (call by object reference)'
という言ったほうがより正確です。というのは、変更可能なオブジェクトが渡さ
れると、呼び出された側の関数がオブジェクトに行った変更 (例えばリストに挿
入された要素) はすべて、関数の呼び出し側にも反映されるからです。


File: python.info,  Node: 関数定義についてもう少し,  Next: 間奏曲 コーディングスタイル,  Prev: 関数を定義する,  Up: その他の制御フローツール

2.4.9 関数定義についてもう少し
------------------------------

可変個の引数を伴う関数を定義することもできます。引数の定義方法には 3 つ
の形式があり、それらを組み合わせることができます。

* Menu:

* デフォルトの引数値::
* キーワード引数::
* 特殊なパラメータ::
* 任意引数リスト::
* 引数リストのアンパック::
* ラムダ式::
* ドキュメンテーション文字列::
* 関数のアノテーション::


File: python.info,  Node: デフォルトの引数値,  Next: キーワード引数,  Up: 関数定義についてもう少し

2.4.9.1 デフォルトの引数値
..........................

もっとも便利なのは、一つ以上の引数に対してデフォルトの値を指定する形式で
す。この形式を使うと、定義されている引数より少ない個数の引数で呼び出せる
関数を作成します:

     def ask_ok(prompt, retries=4, reminder='再試行してください!'):
         while True:
             reply = input(prompt)
             if reply in {'y', 'ye', 'yes'}:
                 return True
             if reply in {'n', 'no', 'nop', 'nope'}:
                 return False
             retries = retries - 1
             if retries < 0:
                 raise ValueError('無効なユーザーの入力')
             print(reminder)

この関数はいくつかの方法で呼び出せます:

   * 必須の引数のみ与える: ‘ask_ok('Do you really want to quit?')’

   * 一つのオプション引数を与える: ‘ask_ok('OK to overwrite the file?',
     2)’

   * 全ての引数を与える: ‘ask_ok('OK to overwrite the file?', 2, 'Come
     on, only yes or no!')’

この例では *note in: 34b. キーワードが導入されています。このキーワードは
シーケンスが特定の値を含んでいるかどうか調べるのに使われます。

デフォルト値は、関数が定義された時点で、関数を '定義している' 側のスコー
プ (scope) で評価されるので

     i = 5

     def f(arg=i):
         print(arg)

     i = 6
     f()

は ‘5’ を出力します。

'重要な警告:' デフォルト値は 1 度だけしか評価されません。デフォルト値が
リストや辞書のような変更可能なオブジェクトの時にはその影響がでます。例え
ば以下の関数は、後に続く関数呼び出しで関数に渡されている引数を累積します
:

     def f(a, L=[]):
         L.append(a)
         return L

     print(f(1))
     print(f(2))
     print(f(3))

このコードは、以下を出力します

     [1]
     [1, 2]
     [1, 2, 3]

後続の関数呼び出しでデフォルト値を共有したくなければ、代わりに以下のよう
に関数を書くことができます:

     def f(a, L=None):
         if L is None:
             L = []
         L.append(a)
         return L


File: python.info,  Node: キーワード引数,  Next: 特殊なパラメータ,  Prev: デフォルトの引数値,  Up: 関数定義についてもう少し

2.4.9.2 キーワード引数
......................

関数を ‘kwarg=value’ という形式の *note キーワード引数: f0e. を使って呼
び出すこともできます。例えば、以下の関数:

     def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):
         print("-- This parrot wouldn't", action, end=' ')
         print("if you put", voltage, "volts through it.")
         print("-- Lovely plumage, the", type)
         print("-- It's", state, "!")

は、必須引数 (‘voltage’) とオプション引数 (‘state’、‘action’、‘type’) を
受け付けます。この関数は以下のいずれかの方法で呼び出せます:

     parrot(1000)                                          # 1つの位置引数
     parrot(voltage=1000)                                  # 1つのキーワード引数
     parrot(voltage=1000000, action='VOOOOOM')             # 2つのキーワード引数
     parrot(action='VOOOOOM', voltage=1000000)             # 2つのキーワード引数
     parrot('a million', 'bereft of life', 'jump')         # 3つの位置引数
     parrot('a thousand', state='pushing up the daisies')  # 1との位置引数と1つのキーワード引数

が、以下の呼び出しは不適切です:

     parrot()                     # 必須の引数がない
     parrot(voltage=5.0, 'dead')  # キーワード引数の後ろにキーワードのない引数
     parrot(110, voltage=220)     # 同じ引数に対して2つの値を指定
     parrot(actor='John Cleese')  # 未知のキーワード引数

関数の呼び出しにおいて、キーワード引数は位置引数の後でなければなりません
。渡されるキーワード引数は全て、関数で受け付けられる引数のいずれかに対応
していなければならず (例えば、‘actor’ はこの ‘parrot’ 関数の引数として適
切ではありません)、順序は重要ではありません。これはオプションでない引数
でも同様です (例えば、‘parrot(voltage=1000)’ も適切です)。いかなる引数も
値を複数回は受け取れません。この制限により失敗する例は:

     >>> def function(a):
     ...     pass
     ...
     >>> function(0, a=0)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: function() got multiple values for argument 'a'

仮引数の最後に ‘**name’ の形式のものがあると、それまでの仮引数に対応した
ものを除くすべてのキーワード引数が入った辞書 (*note マッピング型 --
dict: cbd. を参照) を受け取ります。 ‘**name’ は ‘*name’ の形式をとる、仮
引数のリストを超えた位置引数の入った *note タプル: 2008. を受け取る引数
(次の小節で述べます) と組み合わせられます。 (‘*name’ は ‘**name’ より前
になければなりません)。 例えば、ある関数の定義を以下のようにすると:

     def cheeseshop(kind, *arguments, **keywords):
         print("-- Do you have any", kind, "?")
         print("-- I'm sorry, we're all out of", kind)
         for arg in arguments:
             print(arg)
         print("-" * 40)
         for kw in keywords:
             print(kw, ":", keywords[kw])

呼び出しは以下のようになり:

     cheeseshop("Limburger", "It's very runny, sir.",
                "It's really very, VERY runny, sir.",
                shopkeeper="Michael Palin",
                client="John Cleese",
                sketch="Cheese Shop Sketch")

もちろん以下のように出力されます:

     -- Do you have any Limburger ?
     -- I'm sorry, we're all out of Limburger
     It's very runny, sir.
     It's really very, VERY runny, sir.
     ----------------------------------------
     shopkeeper : Michael Palin
     client : John Cleese
     sketch : Cheese Shop Sketch

なお、複数のキーワード引数を与えた場合に、それらが出力される順序は、関数
呼び出しで与えられた順序と同じになります。


File: python.info,  Node: 特殊なパラメータ,  Next: 任意引数リスト,  Prev: キーワード引数,  Up: 関数定義についてもう少し

2.4.9.3 特殊なパラメータ
........................

デフォルトでは、引数は位置またはキーワードによる明示で Python 関数に渡さ
れます。 可読性とパフォーマンスのために、その引数が位置、位置またはキー
ワード、キーワードのどれで渡されるかを開発者が判定するのに関数定義だけを
見ればよいように、引数の渡され方を制限することには意味があります。

関数定義は次のようになります:

     def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):
           -----------    ----------     ----------
             |             |                  |
             |        位置またはキーワード    |
             |                                - キーワード専用
              -- 位置専用

ここで、‘/’ と ‘*’ はオプションです。使用された場合、これらの記号は、引
数が関数に渡される方法、すなわち、位置専用、位置またはキーワード、キーワ
ード専用、といった引数の種類を示します。キーワード引数は、名前付き引数と
も呼ばれます。

* Menu:

* 位置またはキーワード引数::
* 位置専用引数: 位置専用引数<2>.
* キーワード専用引数::
* 関数の例::
* 要約::


File: python.info,  Node: 位置またはキーワード引数,  Next: 位置専用引数<2>,  Up: 特殊なパラメータ

2.4.9.4 位置またはキーワード引数
................................

関数定義に ‘/’ も ‘*’ もない場合は、引数は位置またはキーワードで関数に渡
されます。


File: python.info,  Node: 位置専用引数<2>,  Next: キーワード専用引数,  Prev: 位置またはキーワード引数,  Up: 特殊なパラメータ

2.4.9.5 位置専用引数
....................

これをもう少し詳しく見てみると、特定の引数を '位置専用' と印を付けられま
す。 '位置専用' の場合、引数の順序が重要であり、キーワードで引数を渡せま
せん。 位置専用引数は ‘/’ （スラッシュ）の前に配置されます。 ‘/’ は、位
置専用引数を残りの引数から論理的に分離するために使用されます。 関数定義
に ‘/’ がない場合、位置専用引数はありません。

‘/’ の後の引数は、 '位置またはキーワード' 、もしくは、 'キーワード専用'
です。


File: python.info,  Node: キーワード専用引数,  Next: 関数の例,  Prev: 位置専用引数<2>,  Up: 特殊なパラメータ

2.4.9.6 キーワード専用引数
..........................

引数をキーワード引数で渡す必要があることを示す 'キーワード専用' として引
数をマークするには、引数リストの最初の 'キーワード専用' 引数の直前に ‘*’
を配置します。


File: python.info,  Node: 関数の例,  Next: 要約,  Prev: キーワード専用引数,  Up: 特殊なパラメータ

2.4.9.7 関数の例
................

‘/’ および ‘*’ といったマーカーに注意を払って、次の関数定義の例を見てく
ださい:

     >>> def standard_arg(arg):
     ...     print(arg)
     ...
     >>> def pos_only_arg(arg, /):
     ...     print(arg)
     ...
     >>> def kwd_only_arg(*, arg):
     ...     print(arg)
     ...
     >>> def combined_example(pos_only, /, standard, *, kwd_only):
     ...     print(pos_only, standard, kwd_only)

最も馴染みのある形式の最初の関数定義 ‘standard_arg’ は、呼び出し規約に制
限を設けておらず、引数は位置またはキーワードで渡されます:

     >>> standard_arg(2)
     2

     >>> standard_arg(arg=2)
     2

2番目の関数の ‘pos_only_arg’ は、 ‘/’ が関数定義にあるので、引数は位置専
用になります:

     >>> pos_only_arg(1)
     1

     >>> pos_only_arg(arg=1)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: pos_only_arg() got some positional-only arguments passed as keyword arguments: 'arg'

3番目の関数 ‘kwd_only_arg’ は、関数定義に ‘*’ があるので、引数はキーワー
ド専用になります:

     >>> kwd_only_arg(3)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: kwd_only_arg() takes 0 positional arguments but 1 was given

     >>> kwd_only_arg(arg=3)
     3

そして最後の関数は3つの引数の種類を一つの関数定義の中で使用しています:

     >>> combined_example(1, 2, 3)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: combined_example() takes 2 positional arguments but 3 were given

     >>> combined_example(1, 2, kwd_only=3)
     1 2 3

     >>> combined_example(1, standard=2, kwd_only=3)
     1 2 3

     >>> combined_example(pos_only=1, standard=2, kwd_only=3)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: combined_example() got some positional-only arguments passed as keyword arguments: 'pos_only'

最後に、位置引数 ‘name’ と ‘name’ をキーとして持つ ‘**kwds’ の間に潜在的
な衝突がある関数定義を考えてみましょう。

     def foo(name, **kwds):
         return 'name' in kwds

キーワードに ‘'name'’ を入れても、先頭の引数と同じになってしまうため、こ
の関数が ‘True’ を返すような呼び出しの方法はありません。例えば、次のよう
になってしまいます:

     >>> foo(1, **{'name': 2})
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: foo() got multiple values for argument 'name'
     >>>

しかし位置専用を示す ‘/’ を使用すれば可能になります。 ‘name’ は位置引数
として、そして ‘'name'’ はキーワード引数のキーワードとして認識されるから
です:

     >>> def foo(name, /, **kwds):
     ...     return 'name' in kwds
     ...
     >>> foo(1, **{'name': 2})
     True

言い換えると、位置専用引数であれば、その名前を ‘**kwds’ の中で使用しても
、曖昧にならないということです。


File: python.info,  Node: 要約,  Prev: 関数の例,  Up: 特殊なパラメータ

2.4.9.8 要約
............

使用例で、関数定義でどの種類の引数を使うかべきかがわかると思います:

     def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):

ガイドとしては、

   * もし引数の名前をユーザーに知らせる必要がないなら、位置専用引数を使
     用しましょう。これは引数の名前がユーザーにとって意味がなく、関数が
     呼ばれたときの引数の順序が問題であり、または、位置引数と任意のキー
     ワードを使用する必要がある場合に便利です。

   * 引数の名前に意味があり、それにより関数の定義がより明らかになる、ま
     たは、ユーザーが引数の順番に縛られることを避けたほうがいいと考える
     のなら、キーワード専用引数を使用しましょう。

   * APIの場合、将来引数の名前が変更された場合にAPIの変更ができなくなる
     ことを防ぐために、位置専用引数を使用しましょう。


File: python.info,  Node: 任意引数リスト,  Next: 引数リストのアンパック,  Prev: 特殊なパラメータ,  Up: 関数定義についてもう少し

2.4.9.9 任意引数リスト
......................

最後に、最も使うことの少ない選択肢として、関数が任意の個数の引数で呼び出
せるよう指定する方法があります。これらの引数はタプル (*note
タプルとシーケンス: 2008. を参照) に格納されます。可変個の引数の前に、ゼ
ロ個かそれ以上の引数があっても構いません。

     def write_multiple_items(file, separator, *args):
         file.write(separator.join(args))

通常このような '可変' 引数は、関数に渡される入力引数の残りを全て掬い取る
ために、仮引数リストの最後に置かれます。 ‘*args’ 引数の後にある仮引数は
'キーワード専用' 引数で、位置引数ではなくキーワード引数としてのみ使える
ことを意味します。

     >>> def concat(*args, sep="/"):
     ...     return sep.join(args)
     ...
     >>> concat("earth", "mars", "venus")
     'earth/mars/venus'
     >>> concat("earth", "mars", "venus", sep=".")
     'earth.mars.venus'


File: python.info,  Node: 引数リストのアンパック,  Next: ラムダ式,  Prev: 任意引数リスト,  Up: 関数定義についてもう少し

2.4.9.10 引数リストのアンパック
...............................

引数がすでにリストやタプルになっていて、個別な位置引数を要求する関数呼び
出しに渡すためにアンパックする必要がある場合には、逆の状況が起こります。
例えば、組み込み関数 *note range(): b3d. は引数 'start' と 'stop' を別に
与える必要があります。個別に引数を与えることができない場合、関数呼び出し
を ‘*’ 演算子を使って書き、リストやタプルから引数をアンパックします:

     >>> list(range(3, 6))            # 個別に引数を指定する通常の関数呼び出し
     [3, 4, 5]
     >>> args = [3, 6]
     >>> list(range(*args))            # 引数リストをアンパックして関数呼び出し
     [3, 4, 5]

同じやりかたで、‘**’ オペレータを使って辞書でもキーワード引数を渡すこと
ができます:

     >>> def parrot(voltage, state='a stiff', action='voom'):
     ...     print("-- This parrot wouldn't", action, end=' ')
     ...     print("if you put", voltage, "volts through it.", end=' ')
     ...     print("E's", state, "!")
     ...
     >>> d = {"voltage": "four million", "state": "bleedin' demised", "action": "VOOM"}
     >>> parrot(**d)
     -- This parrot wouldn't VOOM if you put four million volts through it. E's bleedin' demised !


File: python.info,  Node: ラムダ式,  Next: ドキュメンテーション文字列,  Prev: 引数リストのアンパック,  Up: 関数定義についてもう少し

2.4.9.11 ラムダ式
.................

キーワード *note lambda: 14b5. を使うと、名前のない小さな関数を生成でき
ます。例えば ‘lambda a, b: a+b’ は、二つの引数の和を返す関数です。ラムダ
式の関数は、関数オブジェクトが要求されている場所にならどこでも使うことが
できます。ラムダ式は、構文上単一の式に制限されています。意味付け的には、
ラムダ形式は単に通常の関数定義に構文的な糖衣をかぶせたものに過ぎません。
入れ子構造になった関数定義と同様、ラムダ式もそれを取り囲むスコープから変
数を参照することができます:

     >>> def make_incrementor(n):
     ...     return lambda x: x + n
     ...
     >>> f = make_incrementor(42)
     >>> f(0)
     42
     >>> f(1)
     43

上記の例ではラムダ式を使って関数を返しています。 別の使い方としては、小
さな関数を引数として渡すこともできます。 たとえば、 *note list.sort():
dc8. はソートキー関数 'key' を受け取りますが、これにはラムダ関数を渡せま
す:

     >>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]
     >>> pairs.sort(key=lambda pair: pair[1])
     >>> pairs
     [(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]


File: python.info,  Node: ドキュメンテーション文字列,  Next: 関数のアノテーション,  Prev: ラムダ式,  Up: 関数定義についてもう少し

2.4.9.12 ドキュメンテーション文字列
...................................

ドキュメンテーション文字列については、その内容と書式に関する慣習をいくつ
か挙げます。

最初の行は、常に対象物の目的を短く簡潔にまとめたものでなくてはなりません
。簡潔に書くために、対象物の名前や型を明示する必要はありません。名前や型
は他の方法でも得られるからです (名前がたまたま関数の演算内容を記述する動
詞である場合は例外です)。最初の行は大文字で始まり、ピリオドで終わってい
なければなりません。

ドキュメンテーション文字列中にさらに記述すべき行がある場合、二行目は空行
にし、まとめの行と残りの記述部分を視覚的に分離します。つづく行は一つまた
はそれ以上の段落で、対象物の呼び出し規約や副作用について記述します。

The Python parser strips indentation from multi-line string literals
when they serve as module, class, or function docstrings.

以下に複数行のドキュメンテーション文字列の例を示します:

     >>> def my_function():
     ...     """なにもしないがドキュメントは書く。
     ...
     ...     本当になにもしない。
     ...
     ...         >>> my_function()
     ...         >>>
     ...     """
     ...     pass
     ...
     >>> print(my_function.__doc__)
     なにもしないがドキュメントは書く。

     本当になにもしない。

         >>> my_function()
         >>>


File: python.info,  Node: 関数のアノテーション,  Prev: ドキュメンテーション文字列,  Up: 関数定義についてもう少し

2.4.9.13 関数のアノテーション
.............................

*note 関数アノテーション: 2018. はユーザ定義関数で使用される型についての
完全にオプションなメタデータ情報です (詳細は PEP 3107(1) と PEP 484(2) を
参照してください)。

*note アノテーション: 2019. は関数の *note __annotations__: 458. 属性に
辞書として格納され、関数の他の部分には何も影響を与えません。パラメータア
ノテーションは、パラメータ名の後にコロンを続けることによって定義され、そ
の後にアノテーションの値として評価される式が置かれます。戻り値アノテーシ
ョンは、パラメータリストと *note def: 1673. 文の終わりを表すコロンの間に
置かれたリテラル ‘->’ によって定義され、その後に式が続きます。次の例は必
須の引数とオプション引数、そして戻り値のアノテーションを持っています:

     >>> def f(ham: str, eggs: str = 'eggs') -> str:
     ...     print("Annotations:", f.__annotations__)
     ...     print("Arguments:", ham, eggs)
     ...     return ham + ' and ' + eggs
     ...
     >>> f('spam')
     アノテーション: {'ham': <class 'str'>, 'return': <class 'str'>, 'eggs': <class 'str'>}
     引数: spam eggs
     'spam and eggs'

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3107/

   (2) https://peps.python.org/pep-0484/


File: python.info,  Node: 間奏曲 コーディングスタイル,  Prev: 関数定義についてもう少し,  Up: その他の制御フローツール

2.4.10 間奏曲: コーディングスタイル
-----------------------------------

Now that you are about to write longer, more complex pieces of Python,
it is a good time to talk about 'coding style'.  Most languages can be
written (or more concisely, 'formatted') in different styles; some are
more readable than others.  Making it easy for others to read your code
is always a good idea, and adopting a nice coding style helps
tremendously for that.

Python には、ほとんどのプロジェクトが守っているスタイルガイドとして PEP
8(1) があります。それは非常に読み易く目に優しいコーディングスタイルを推
奨しています。全ての Python 開発者はある時点でそれを読むべきです。ここに
最も重要な点を抜き出しておきます:

   * インデントには空白 4 つを使い、タブは使わないこと。

     空白 4 つは (深くネストできる) 小さいインデントと (読み易い) 大きい
     インデントのちょうど中間に当たります。タブは混乱させるので、使わず
     におくのが良いです。

   * ソースコードの幅が 79 文字を越えないように行を折り返すこと。

     こうすることで小さいディスプレイを使っているユーザも読み易くなり、
     大きなディスプレイではソースコードファイルを並べることもできるよう
     になります。

   * 関数やクラスや関数内の大きめのコードブロックの区切りに空行を使うこ
     と。

   * 可能なら、コメントは行に独立で書くこと。

   * docstring を使うこと。

   * 演算子の前後とコンマの後には空白を入れ、括弧類のすぐ内側には空白を
     入れないこと: ‘a = f(1, 2) + g(3, 4)’。

   * クラスや関数に一貫性のある名前を付けること。慣習では
     ‘UpperCamelCase’ をクラス名に使い、 ‘lowercase_with_underscores’ を
     関数名やメソッド名に使います。常に ‘self’ をメソッドの第 1 引数の名
     前 (クラスやメソッドについては *note クラス初見: 201c. を見よ) とし
     て使うこと。

   * あなたのコードを世界中で使ってもらうつもりなら、風変りなエンコーデ
     ィングは使わないこと。どんな場合でも、Python のデフォルト UTF-8 ま
     たはプレーン ASCII が最も上手くいきます。

   * 同様に、ほんの少しでも他の言語を話す人がコードを読んだりメンテナン
     スする可能性があるのであれば、非 ASCII 文字も識別子に使うべきではあ
     りません。

脚注
....

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0008/


File: python.info,  Node: データ構造,  Next: モジュール<2>,  Prev: その他の制御フローツール,  Up: Python チュートリアル

2.5 データ構造
==============

この章では、すでに学んだことについてより詳しく説明するとともに、いくつか
新しいことを追加します。

* Menu:

* リスト型についてもう少し::
* del 文::
* タプルとシーケンス::
* 集合型::
* 辞書型 (dictionary): 辞書型 dictionary.
* ループのテクニック::
* 条件についてもう少し::
* シーケンスとその他の型の比較::


File: python.info,  Node: リスト型についてもう少し,  Next: del 文,  Up: データ構造

2.5.1 リスト型についてもう少し
------------------------------

*note list: 2022. 型には、他にもいくつかメソッドがあります。リストオブジ
ェクトのすべてのメソッドを以下に示します:

 -- メソッド: list.append (x)

     リストの末尾に要素を一つ追加します。‘a[len(a):] = [x]’ と同様です。

 -- メソッド: list.extend (iterable)

     イテラブルのすべての要素を対象のリストに追加し、リストを拡張します
     。‘a[len(a):] = iterable’ と同様です。

 -- メソッド: list.insert (i, x)

     指定した位置に要素を挿入します。第 1 引数は、リストのインデクスで、
     そのインデクスを持つ要素の直前に挿入が行われます。従って、
     ‘a.insert(0, x)’ はリストの先頭に挿入を行います。また
     ‘a.insert(len(a), x)’ は ‘a.append(x)’ と等価です。

 -- メソッド: list.remove (x)

     リスト中で 'x' と等しい値を持つ最初の要素を削除します。該当する要素
     がなければ *note ValueError: 2ec. が送出されます。

 -- メソッド: list.pop ([i])

     指定された位置の要素をリストから取り除き、それを返します。インデッ
     クスが指定されていない場合、 ‘a.pop()’ はリスト末尾の要素を取り除い
     て返します。リストが空であるか、インデックスがリストの範囲外の場合
     は、*note IndexError: 174e. を送出します。

 -- メソッド: list.clear ()

     リスト中の全ての要素を削除します。‘del a[:]’ と同様です。

 -- メソッド: list.index (x[, start[, end]])

     リスト中に最初に現れる 'x' の位置をゼロから始まるインデックスで返し
     ます。 該当する要素がなければ *note ValueError: 2ec. が送出されます
     。

     任意の引数である 'start' と 'end' はスライス記法として解釈され、リ
     ストの探索範囲を指定できます。返される添字は、'start' 引数からの相
     対位置ではなく、リスト全体の先頭からの位置になります。

 -- メソッド: list.count (x)

     リストでの 'x' の出現回数を返します。

 -- メソッド: list.sort (*, key=None, reverse=False)

     リストの項目を、インプレース演算 (in place、元のデータを演算結果で
     置き換えるやりかた) でソートします。引数はソート方法のカスタマイズ
     に使えます。 *note sorted(): dc7. の説明を参照してください。

 -- メソッド: list.reverse ()

     リストの要素を、インプレース演算で逆順にします。

 -- メソッド: list.copy ()

     リストの浅い (shallow) コピーを返します。‘a[:]’ と同様です。

以下にリストのメソッドをほぼ全て使った例を示します:

     >>> fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', 'banana']
     >>> fruits.count('apple')
     2
     >>> fruits.count('tangerine')
     0
     >>> fruits.index('banana')
     3
     >>> fruits.index('banana', 4)  # インデックス4から数えて次の banana の位置
     6
     >>> fruits.reverse()
     >>> fruits
     ['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange']
     >>> fruits.append('grape')
     >>> fruits
     ['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange', 'grape']
     >>> fruits.sort()
     >>> fruits
     ['apple', 'apple', 'banana', 'banana', 'grape', 'kiwi', 'orange', 'pear']
     >>> fruits.pop()
     'pear'

‘insert’, ‘remove’, ‘sort’ などのリストを操作するメソッドの戻り値が表示
されていないことに気が付いたかもしれません。これらのメソッドは ‘None’ を
返しています。(1) これは Python の変更可能なデータ構造全てについての設計
上の原則となっています。

もうひとつ気付くとしたら、すべてのデータでソートや比較できるわけではない
ということです。 例えば、 ‘[None, 'hello', 10]’ はソートされません。なぜ
なら整数は文字列と比べられませんし、 ‘None’ は他の型と比べられないからで
す。 また、順序関係が定義されていない型もあります。 例えば、 ‘3+4j <
5+7j’ は有効な比較ではありません。

* Menu:

* リストをスタックとして使う::
* リストをキューとして使う::
* リストの内包表記: リストの内包表記<2>.
* ネストしたリストの内包表記::

   ---------- Footnotes ----------

   (1) 他の言語では変更可能なオブジェクトを返して、
‘d->insert("a")->remove("b")->sort();’ のようなメソッドチェインを許して
いる場合もあります。


File: python.info,  Node: リストをスタックとして使う,  Next: リストをキューとして使う,  Up: リスト型についてもう少し

2.5.1.1 リストをスタックとして使う
..................................

リスト型のメソッドのおかげで、簡単にリストをスタックとして使えます。スタ
ックでは、最後に追加された要素が最初に取り出されます ("last-in,
first-out")。スタックの一番上に要素を追加するには *note append(): 8dc. を
使います。スタックの一番上から要素を取り出すには *note pop(): 2025. をイ
ンデックスを指定せずに使います。例えば以下のようにします:

     >>> stack = [3, 4, 5]
     >>> stack.append(6)
     >>> stack.append(7)
     >>> stack
     [3, 4, 5, 6, 7]
     >>> stack.pop()
     7
     >>> stack
     [3, 4, 5, 6]
     >>> stack.pop()
     6
     >>> stack.pop()
     5
     >>> stack
     [3, 4]


File: python.info,  Node: リストをキューとして使う,  Next: リストの内包表記<2>,  Prev: リストをスタックとして使う,  Up: リスト型についてもう少し

2.5.1.2 リストをキューとして使う
................................

リストをキュー (queue) として使うことも可能です。この場合、最初に追加し
た要素を最初に取り出します ("first-in, first-out")。しかし、リストでは効
率的にこの目的を達成することが出来ません。追加（append）や取り出し（
pop）をリストの末尾に対して行うと速いのですが、挿入（insert）や取り出し
（pop）をリストの先頭に対して行うと遅くなってしまいます（他の要素をひと
つずつずらす必要があるからです）。

キューの実装には、 *note collections.deque: 7f4. を使うと良いでしょう。
このクラスは良く設計されていて、高速な追加（append）と取り出し（pop）を
両端に対して実現しています。例えば以下のようにします:

     >>> from collections import deque
     >>> queue = deque(["Eric", "John", "Michael"])
     >>> queue.append("Terry")           # Terry が到着
     >>> queue.append("Graham")          # Graham が到着
     >>> queue.popleft()                 # 最初に到着した人が去って行った
     'Eric'
     >>> queue.popleft()                 # 2番目の人も去って行った
     'John'
     >>> queue                           # キューに残っているものは到着順
     deque(['Michael', 'Terry', 'Graham'])


File: python.info,  Node: リストの内包表記<2>,  Next: ネストしたリストの内包表記,  Prev: リストをキューとして使う,  Up: リスト型についてもう少し

2.5.1.3 リストの内包表記
........................

リスト内包表記はリストを生成する簡潔な手段を提供しています。主な利用場面
は、あるシーケンスや iterable (イテレート可能オブジェクト) のそれぞれの
要素に対してある操作を行った結果を要素にしたリストを作ったり、ある条件を
満たす要素だけからなる部分シーケンスを作成することです。

例えば、次のような平方のリストを作りたいとします:

     >>> squares = []
     >>> for x in range(10):
     ...     squares.append(x**2)
     ...
     >>> squares
     [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

これはループが終了した後にも存在する ‘x’ という名前の変数を作る (または
上書きする) ことに注意してください。以下のようにして平方のリストをいかな
る副作用もなく計算することができます:

     squares = list(map(lambda x: x**2, range(10)))

もしくは、以下でも同じです:

     squares = [x**2 for x in range(10)]

これはより簡潔で読みやすいです。

リスト内包表記は、括弧の中の 式、 ‘for’ 句、そして0個以上の ‘for’ か
‘if’ 句で構成されます。 リスト内包表記の実行結果は、 ‘for’ と ‘if’ 句の
コンテキスト中で式を評価した結果からなる新しいリストです。 例えば、次の
リスト内包表記は2つのリストの要素から、違うもの同士をペアにします。

     >>> [(x, y) for x in [1,2,3] for y in [3,1,4] if x != y]
     [(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)]

これは次のコードと等価です:

     >>> combs = []
     >>> for x in [1,2,3]:
     ...     for y in [3,1,4]:
     ...         if x != y:
     ...             combs.append((x, y))
     ...
     >>> combs
     [(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)]

*note for: 34a. と *note if: 181. 文が両方のコードで同じ順序になっている
ことに注目してください。

式がタプルの場合 (例: 上の例で式が ‘(x, y)’ の場合) は、タプルに円括弧が
必要です。

     >>> vec = [-4, -2, 0, 2, 4]
     >>> # 値を2倍にした新しいリストを作成
     >>> [x*2 for x in vec]
     [-8, -4, 0, 4, 8]
     >>> # フィルターでリストから負の数値を除外
     >>> [x for x in vec if x >= 0]
     [0, 2, 4]
     >>> # 全ての要素に関数を適用
     >>> [abs(x) for x in vec]
     [4, 2, 0, 2, 4]
     >>> # 各要素に対してメソッド呼び出し
     >>> freshfruit = ['  banana', '  loganberry ', 'passion fruit  ']
     >>> [weapon.strip() for weapon in freshfruit]
     ['banana', 'loganberry', 'passion fruit']
     >>> # (number, square) という2要素のタプルのリストを作成
     >>> [(x, x**2) for x in range(6)]
     [(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), (5, 25)]
     >>> # タプルは丸括弧で囲まないといけない、そうでなければエラーが発生する
     >>> [x, x**2 for x in range(6)]
       File "<stdin>", line 1
         [x, x**2 for x in range(6)]
          ^^^^^^^
     SyntaxError: did you forget parentheses around the comprehension target?
     >>> # リスト内包表記で2つの 'for' を使って、リストをフラットにする
     >>> vec = [[1,2,3], [4,5,6], [7,8,9]]
     >>> [num for elem in vec for num in elem]
     [1, 2, 3, 4, 5, 6, 7, 8, 9]

リスト内包表記の式には、複雑な式や関数呼び出しのネストができます:

     >>> from math import pi
     >>> [str(round(pi, i)) for i in range(1, 6)]
     ['3.1', '3.14', '3.142', '3.1416', '3.14159']


File: python.info,  Node: ネストしたリストの内包表記,  Prev: リストの内包表記<2>,  Up: リスト型についてもう少し

2.5.1.4 ネストしたリストの内包表記
..................................

リスト内包表記中の最初の式は任意の式なので、そこに他のリスト内包表記を書
くこともできます。

次の、長さ4のリスト3つからなる、3x4 の matrix について考えます:

     >>> matrix = [
     ...     [1, 2, 3, 4],
     ...     [5, 6, 7, 8],
     ...     [9, 10, 11, 12],
     ... ]

次のリスト内包表記は、matrix の行と列を入れ替えます:

     >>> [[row[i] for row in matrix] for i in range(4)]
     [[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]

前の節で見たように、内側のリスト内包表記は、続く *note for: 34a. のコン
テキストの中で評価されます。そのため、この例は次のコードと等価です:

     >>> transposed = []
     >>> for i in range(4):
     ...     transposed.append([row[i] for row in matrix])
     ...
     >>> transposed
     [[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]

これをもう一度変換すると、次のコードと等価になります:

     >>> transposed = []
     >>> for i in range(4):
     ...     # 以下の3行はネストされたリスト内包表記と同じ実装
     ...     transposed_row = []
     ...     for row in matrix:
     ...         transposed_row.append(row[i])
     ...     transposed.append(transposed_row)
     ...
     >>> transposed
     [[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]

実際には複雑な流れの式よりも組み込み関数を使う方が良いです。この場合
*note zip(): 1a0. 関数が良い仕事をしてくれるでしょう:

     >>> list(zip(*matrix))
     [(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]

この行にあるアスタリスクの詳細については *note 引数リストのアンパック:
2011. を参照してください。


File: python.info,  Node: del 文,  Next: タプルとシーケンス,  Prev: リスト型についてもう少し,  Up: データ構造

2.5.2 ‘del’ 文
--------------

リストから要素を削除する際、値を指定する代わりにインデックスを指定する方
法があります。それが *note del: 1b1f. 文です。これは *note pop(): 2025.
メソッドと違い、値を返しません。 ‘del’ 文はリストからスライスを除去した
り、リスト全体を削除することもできます(以前はスライスに空のリストを代入
して行っていました)。例えば以下のようにします:

     >>> a = [-1, 1, 66.25, 333, 333, 1234.5]
     >>> del a[0]
     >>> a
     [1, 66.25, 333, 333, 1234.5]
     >>> del a[2:4]
     >>> a
     [1, 66.25, 1234.5]
     >>> del a[:]
     >>> a
     []

*note del: 1b1f. は変数全体の削除にも使えます:

     >>> del a

この文の後で名前 ‘a’ を参照すると、(別の値を ‘a’ に代入するまで) エラー
になります。 *note del: 1b1f. の別の用途についてはまた後で取り上げます。


File: python.info,  Node: タプルとシーケンス,  Next: 集合型,  Prev: del 文,  Up: データ構造

2.5.3 タプルとシーケンス
------------------------

リストや文字列には、インデクスやスライスを使った演算のように、数多くの共
通の性質があることを見てきました。これらは 'シーケンス (sequence)' デー
タ型 (*note シーケンス型 -- list, tuple, range: 202e. を参照) の二つの例
です。 Python はまだ進歩の過程にある言語なので、他のシーケンスデータ型が
追加されるかもしれません。標準のシーケンス型はもう一つあります: 'タプル
(tuple)' 型です。

タプルはコンマで区切られたいくつかの値からなります。例えば以下のように書
きます:

     >>> t = 12345, 54321, 'hello!'
     >>> t[0]
     12345
     >>> t
     (12345, 54321, 'hello!')
     >>> # タプルは入れ子にできる:
     >>> u = t, (1, 2, 3, 4, 5)
     >>> u
     ((12345, 54321, 'hello!'), (1, 2, 3, 4, 5))
     >>> # タプルは不変(イミュータブル):
     >>> t[0] = 88888
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: 'tuple' object does not support item assignment
     >>> # しかし、可変(ミュータブル)オブジェクトを含むことができる:
     >>> v = ([1, 2, 3], [3, 2, 1])
     >>> v
     ([1, 2, 3], [3, 2, 1])

ご覧のとおり、タプルの表示には常に丸括弧がついていて、タプルのネストが正
しく解釈されるようになっています。タプルを書くときは必ずしも丸括弧で囲ま
なくてもいいですが、(タプルが大きな式の一部だった場合は) 丸括弧が必要な
場合もあります。タプルの要素を代入することはできません。しかし、タプルに
リストのような変更可能型を含めることはできます。

タプルはリストと似ていますが、たいてい異なる場面と異なる目的で利用されま
す。タプルは *note 不変: 15b9. で、複数の型の要素からなることもあり、要
素はアンパック(この節の後半に出てきます)操作やインデックス (あるいは
*note namedtuples: 4e0. の場合は属性)でアクセスすることが多いです。一方
、リストは *note 可変: 15ba. で、要素はたいてい同じ型のオブジェクトであ
り、たいていイテレートによってアクセスします。

問題は 0 個または 1 個の項目からなるタプルの構築です。これらの操作を行う
ため、構文には特別な細工がされています。空のタプルは空の丸括弧ペアで構築
できます。一つの要素を持つタプルは、値の後ろにコンマを続ける (単一の値を
丸括弧で囲むだけでは不十分です) ことで構築できます。美しくはないけれども
、効果的です。例えば以下のようにします:

     >>> empty = ()
     >>> singleton = 'hello',    # <-- 末尾のカンマに注意
     0
     >>> len(singleton)
     1
     >>> singleton
     ('hello',)

文 ‘t = 12345, 54321, 'hello!'’ は 'タプルのパック (tuple packing)' の例
です。値 ‘12345’, ‘54321’, ‘'hello!'’ が一つのタプルにパックされます。逆
の演算も可能です:

     >>> x, y, z = t

この操作は、'シーケンスのアンパック (sequence unpacking)' とでも呼ぶべき
もので、右辺には全てのシーケンス型を使うことができます。シーケンスのアン
パックでは、等号の左辺に列挙されている変数が、右辺のシーケンスの長さと同
じ数だけあることが要求されます。複数同時の代入が実はタプルのパックとシー
ケンスのアンパックを組み合わせたものに過ぎないことに注意してください。


File: python.info,  Node: 集合型,  Next: 辞書型 dictionary,  Prev: タプルとシーケンス,  Up: データ構造

2.5.4 集合型
------------

Python には、 *note sets: 2031. を扱うためのデータ型もあります。集合とは
、重複する要素をもたない、順序づけられていない要素の集まりです。 Set オ
ブジェクトは、和 (union)、積 (intersection)、差 (difference)、対称差
(symmetric difference)といった数学的な演算もサポートしています。

中括弧、または *note set(): 184. 関数は set を生成するために使用すること
ができます。注: 空集合を作成するためには ‘set()’ を使用しなければなりま
せん (‘{}’ ではなく)。後者は空の辞書を作成します。辞書は次のセクションで
議論するデータ構造です。

簡単なデモンストレーションを示します:

     >>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}
     >>> print(basket)                      # 重複が削除されていることを確認
     {'orange', 'banana', 'pear', 'apple'}
     >>> 'orange' in basket                 # 高速なメンバー判定
     True
     >>> 'crabgrass' in basket
     False

     >>> # Demonstrate set operations on unique letters from two words
     >>>
     >>> a = set('abracadabra')
     >>> b = set('alacazam')
     >>> a                                  # aのユニークな文字
     {'a', 'r', 'b', 'c', 'd'}
     >>> a - b                              # aにあってbにない文字
     {'r', 'd', 'b'}
     >>> a | b                              # aまたはbまたは両方に存在する文字
     {'a', 'c', 'r', 'd', 'b', 'm', 'z', 'l'}
     >>> a & b                              # aとbの両方に存在する文字
     {'a', 'c'}
     >>> a ^ b                              # aまたはbにあるが、両方にはない文字
     {'r', 'd', 'b', 'm', 'z', 'l'}

*note リスト内包: 2029. と同様に、 set 内包もサポートされています:

     >>> a = {x for x in 'abracadabra' if x not in 'abc'}
     >>> a
     {'r', 'd'}


File: python.info,  Node: 辞書型 dictionary,  Next: ループのテクニック,  Prev: 集合型,  Up: データ構造

2.5.5 辞書型 (dictionary)
-------------------------

もう一つ、有用な型が Python に組み込まれています。それは '辞書
(dictionary)' (*note マッピング型 -- dict: cbd. を参照)です。辞書は他の
言語にも "連想記憶 (associated memory)" や "連想配列 (associative
array)" という名前で存在することがあります。ある範囲の数でインデックス化
されているシーケンスと異なり、辞書は 'キー (key)' でインデックス化されて
います。このキーは何らかの変更不能な型になります。文字列、数値は常にキー
にすることができます。タプルは、文字列、数値、その他のタプルのみを含む場
合はキーにすることができます。直接、あるいは間接的に変更可能なオブジェク
トを含むタプルはキーにできません。リストをキーとして使うことはできません
。これは、リストにスライスやインデックス指定の代入を行ったり、 *note
append(): 8dc. や *note extend(): 602. のようなメソッドを使うと、インプ
レースで変更することができるためです。

辞書は 'キー(key): 値(value)' のペアの集合であり、キーが (辞書の中で)一
意でなければならない、と考えるとよいでしょう。波括弧 (brace) のペア:
‘{}’ は空の辞書を生成します。カンマで区切られた key: value のペアを波括
弧ペアの間に入れると、辞書の初期値となる key: value が追加されます; この
表現方法は出力時に辞書が書き出されるのと同じ方法です。

辞書での主な操作は、ある値を何らかのキーを付けて記憶することと、キーを指
定して値を取り出すことです。 ‘del’ で key: value のペアを削除することも
できます。すでに使われているキーを使って値を記憶すると、以前そのキーに関
連づけられていた値は忘れ去られてしまいます。

存在しないキーの値をインデックス指定(‘d[key]’)で取り出すと *note
KeyError: 5e7. が発生します。存在しない可能性のあるキーへのアクセス時に
このエラーを回避するには、代わりに *note get(): 2034. メソッドを使用しま
す。このメソッドは辞書にキーが存在しない場合に ‘None’ (または指定された
デフォルト値)を返します。

辞書オブジェクトに対し ‘list(d)’ を実行すると、辞書で使われている全ての
キーからなるリストをキーが挿入された順番で返します (ソートされたリストが
欲しい場合は、代わりに ‘sorted(d)’ を使ってください)。ある単一のキーが辞
書にあるかどうか調べるには、 *note in: 34b. キーワードを使います。

以下に、辞書を使った簡単な例を示します:

     >>> tel = {'jack': 4098, 'sape': 4139}
     >>> tel['guido'] = 4127
     >>> tel
     {'jack': 4098, 'sape': 4139, 'guido': 4127}
     >>> tel['jack']
     4098
     >>> tel['irv']
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     KeyError: 'irv'
     >>> print(tel.get('irv'))
     None
     >>> del tel['sape']
     >>> tel['irv'] = 4127
     >>> tel
     {'jack': 4098, 'guido': 4127, 'irv': 4127}
     >>> list(tel)
     ['jack', 'guido', 'irv']
     >>> sorted(tel)
     ['guido', 'irv', 'jack']
     >>> 'guido' in tel
     True
     >>> 'jack' not in tel
     False

*note dict(): 183. コンストラクタは、キーと値のペアのタプルを含むリスト
から辞書を生成します:

     >>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)])
     {'sape': 4139, 'guido': 4127, 'jack': 4098}

さらに、辞書内包表現を使って、任意のキーと値のペアから辞書を作れます:

     >>> {x: x**2 for x in (2, 4, 6)}
     {2: 4, 4: 16, 6: 36}

キーが単純な文字列の場合、キーワード引数を使って定義する方が単純な場合も
あります:

     >>> dict(sape=4139, guido=4127, jack=4098)
     {'sape': 4139, 'guido': 4127, 'jack': 4098}


File: python.info,  Node: ループのテクニック,  Next: 条件についてもう少し,  Prev: 辞書型 dictionary,  Up: データ構造

2.5.6 ループのテクニック
------------------------

辞書に対してループを行う際、 *note items(): 9d2. メソッドを使うと、キー
とそれに対応する値を同時に取り出せます。

     >>> knights = {'gallahad': 'the pure', 'robin': 'the brave'}
     >>> for k, v in knights.items():
     ...     print(k, v)
     ...
     gallahad the pure
     robin the brave

シーケンスにわたるループを行う際、 *note enumerate(): 169a. 関数を使うと
、要素のインデックスと要素を同時に取り出すことができます。

     >>> for i, v in enumerate(['tic', 'tac', 'toe']):
     ...     print(i, v)
     ...
     0 tic
     1 tac
     2 toe

二つまたはそれ以上のシーケンス型を同時にループするために、関数 *note
zip(): 1a0. を使って各要素をひと組みにすることができます。

     >>> questions = ['name', 'quest', 'favorite color']
     >>> answers = ['lancelot', 'the holy grail', 'blue']
     >>> for q, a in zip(questions, answers):
     ...     print('What is your {0}?  It is {1}.'.format(q, a))
     ...
     What is your name?  It is lancelot.
     What is your quest?  It is the holy grail.
     What is your favorite color?  It is blue.

シーケンスを逆方向に渡ってループするには、まずシーケンスの範囲を順方向に
指定し、次いで関数 *note reversed(): a65. を呼び出します。

     >>> for i in reversed(range(1, 10, 2)):
     ...     print(i)
     ...
     9
     7
     5
     3
     1

シーケンスをソートされた順序でループするには、 *note sorted(): dc7. 関数
を使います。この関数は元の配列を変更せず、ソート済みの新たな配列を返しま
す。

     >>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
     >>> for i in sorted(basket):
     ...     print(i)
     ...
     apple
     apple
     banana
     orange
     orange
     pear

シーケンスに *note set(): 184. を使うと、重複要素が除去されます。 シーケ
ンスに *note set(): 184. を使った上で、 *note sorted(): dc7. を使うとい
う組み合わせ方は、順番が整列されているシーケンスで、同一要素に 1 度のみ
ループでアクセスする慣用的な方法です。

     >>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
     >>> for f in sorted(set(basket)):
     ...     print(f)
     ...
     apple
     banana
     orange
     pear

ときどきループ内でリストを変更したい誘惑に駆られるでしょうが、代わりに新
しいリストを作ってしまうほうがより簡単で安全なことが、ままあります

     >>> import math
     >>> raw_data = [56.2, float('NaN'), 51.7, 55.3, 52.5, float('NaN'), 47.8]
     >>> filtered_data = []
     >>> for value in raw_data:
     ...     if not math.isnan(value):
     ...         filtered_data.append(value)
     ...
     >>> filtered_data
     [56.2, 51.7, 55.3, 52.5, 47.8]


File: python.info,  Node: 条件についてもう少し,  Next: シーケンスとその他の型の比較,  Prev: ループのテクニック,  Up: データ構造

2.5.7 条件についてもう少し
--------------------------

‘while’ や ‘if’ 文で使った条件 (condition) には、値の比較だけでなく、他
の演算子も使うことができます。

比較演算子 ‘in’ および ‘not in’ は、ある値があるコンテナーの中に存在する
か (または存在しないか) どうかを確認するメンバーシップテストです。演算子
‘is’ および ‘is not’ は、二つのオブジェクトが実際に同じオブジェクトであ
るかどうかを調べます。全ての比較演算子は同じ優先順位を持っており、ともに
数値演算子よりも低い優先順位となります。

比較は連結させることができます。例えば、 ‘a < b == c’ は、 ‘a’ が ‘b’ よ
り小さく、かつ ‘b’ と ‘c’ が等しいかどうかをテストします。

ブール演算子 ‘and’ や ‘or’ で比較演算を組み合わせることができます。そし
て、比較演算 (あるいは何らかのブール式) の結果の否定は ‘not’ でとれます
。これらの演算子は全て、比較演算子よりも低い優先順位になっています。 ‘A
and not B or C’ と ‘(A and (not B)) or C’ が等価になるように、ブール演算
子の中で、 ‘not’ の優先順位が最も高く、 ‘or’ が最も低くなっています。も
ちろん、丸括弧を使えば望みの組み合わせを表現できます。

ブール演算子 ‘and’ と ‘or’ は、いわゆる '短絡 (short-circuit)' 演算子で
す。これらの演算子の引数は左から右へと順に評価され、結果が確定した時点で
評価を止めます。例えば、 ‘A’ と ‘C’ は真で ‘B’ が偽のとき、 ‘A and B and
C’ は式 ‘C’ を評価しません。一般に、短絡演算子の戻り値をブール値ではなく
て一般的な値として用いると、値は最後に評価された引数になります。

比較や他のブール式の結果を変数に代入することもできます。例えば、

     >>> string1, string2, string3 = '', 'Trondheim', 'Hammer Dance'
     >>> non_null = string1 or string2 or string3
     >>> non_null
     'Trondheim'

Pythonでは、Cとは異なり、式の中での代入は *note セイウチ演算子: 2038.
‘:=’ を使用して明示的に行う必要があることに注意してください。これにより
、 ‘==’ が意図されていたところに ‘=’ を入力してしまうという、Cプログラム
で発生する一般的なクラスの問題を回避できます。


File: python.info,  Node: シーケンスとその他の型の比較,  Prev: 条件についてもう少し,  Up: データ構造

2.5.8 シーケンスとその他の型の比較
----------------------------------

概して、シーケンスオブジェクトは、同じシーケンス型の他のオブジェクトと比
較できます。比較には '辞書的な (lexicographical)' 順序が用いられます。ま
ず、最初の二つの要素を比較し、その値が等しくなければその時点で比較結果が
決まります。等しければ次の二つの要素を比較し、以降シーケンスの要素が尽き
るまで続けます。比較しようとする二つの要素がいずれも同じシーケンス型であ
れば、そのシーケンス間での辞書比較を再帰的に行います。二つのシーケンスの
全ての要素の比較結果が等しくなれば、シーケンスは等しいとみなされます。片
方のシーケンスがもう一方の先頭部分にあたる部分シーケンスならば、短い方の
シーケンスが小さいシーケンスとみなされます。文字列に対する辞書的な順序づ
けには、個々の文字ごとに ASCII 順序を用います。以下に、同じ型のオブジェ
クトを持つシーケンス間での比較を行った例を示します:

     (1, 2, 3)              < (1, 2, 4)
     [1, 2, 3]              < [1, 2, 4]
     'ABC' < 'C' < 'Pascal' < 'Python'
     (1, 2, 3, 4)           < (1, 2, 4)
     (1, 2)                 < (1, 2, -1)
     (1, 2, 3)             == (1.0, 2.0, 3.0)
     (1, 2, ('aa', 'ab'))   < (1, 2, ('abc', 'a'), 4)

違う型のオブジェクト同士を ‘<’ や ‘>’ で比較することも、それらのオブジェ
クトが適切な比較メソッドを提供しているのであれば許可されます。例えば、異
なる数値型同士の比較では、その数値によって比較が行われます。例えば、 0 と
0.0 は等価です。一方、適切な比較順序がない場合は、インタープリターは
*note TypeError: 198. 例外を発生させます。

脚注
....


File: python.info,  Node: モジュール<2>,  Next: 入力と出力,  Prev: データ構造,  Up: Python チュートリアル

2.6 モジュール
==============

Python インタプリタを終了させ、再び起動すると、これまでに行ってきた定義
(関数や変数) は失われています。ですから、より長いプログラムを書きたいな
ら、テキストエディタを使ってインタプリタへの入力を用意しておき、手作業の
代わりにファイルを入力に使って動作させるとよいでしょう。この作業を 'スク
リプト (script)' の作成と言います。プログラムが長くなるにつれ、メンテナ
ンスを楽にするために、スクリプトをいくつかのファイルに分割したくなるかも
しれません。また、いくつかのプログラムで書いてきた便利な関数について、そ
の定義をコピーすることなく個々のプログラムで使いたいと思うかもしれません
。

こういった要求をサポートするために、Python では定義をファイルに書いてお
き、スクリプトの中やインタプリタの対話インスタンス上で使う方法があります
。このファイルを 'モジュール (module)' と呼びます。モジュールにある定義
は、他のモジュールや 'main' モジュール (実行のトップレベルや電卓モードで
アクセスできる変数の集まりを指します) に 'import' (取り込み) することが
できます。

モジュールは Python の定義や文が入ったファイルです。ファイル名はモジュー
ル名に接尾語 ‘.py’ がついたものになります。モジュールの中では、(文字列の
) モジュール名をグローバル変数 ‘__name__’ で取得できます。例えば、お気に
入りのテキストエディタを使って、現在のディレクトリに以下の内容のファイル
‘fibo.py’ を作成してみましょう:

     # フィボナッチ数のモジュール

     def fib(n):
         """nまでのフィボナッチ数を出力する"""
         a, b = 0, 1
         while a < n:
             print(a, end=' ')
             a, b = b, a+b
         print()

     def fib2(n):
         """nまでのフィボナッチ数を返す"""
         result = []
         a, b = 0, 1
         while a < n:
             result.append(a)
             a, b = b, a+b
         return result

次に Python インタプリタに入り、モジュールを以下のコマンドで import しま
しょう:

     >>> import fibo

この操作では、‘fibo’ で定義された関数の名前を直接現在の *note namespace:
203f. (詳細は *note Python のスコープと名前空間: 2040. を参照してくださ
い)に追加することはありません。単にモジュール名 ‘fibo’ だけを名前空間に
追加します。関数にはモジュール名を使ってアクセスします:

     >>> fibo.fib(1000)
     0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987
     >>> fibo.fib2(100)
     [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
     >>> fibo.__name__
     'fibo'

関数を度々使うのなら、ローカルな名前に代入できます:

     >>> fib = fibo.fib
     >>> fib(500)
     0 1 1 2 3 5 8 13 21 34 55 89 144 233 377

* Menu:

* モジュールについてもうすこし::
* 標準モジュール::
* dir() 関数: dir 関数.
* パッケージ::


File: python.info,  Node: モジュールについてもうすこし,  Next: 標準モジュール,  Up: モジュール<2>

2.6.1 モジュールについてもうすこし
----------------------------------

モジュールには、関数定義に加えて実行文を入れることができます。これらの実
行文はモジュールを初期化するためのものです。これらの実行文は、インポート
文の中で '最初に' モジュール名が見つかったときにだけ実行されます。(1) (フ
ァイルがスクリプトとして実行される場合も実行されます。)

各々のモジュールは、自分のプライベートな名前空間を持っていて、モジュール
で定義されている関数はこのテーブルをグローバルな名前空間として使います。
したがって、モジュールの作者は、ユーザのグローバル変数と偶然的な衝突が起
こる心配をせずに、グローバルな変数をモジュールで使うことができます。一方
、自分が行っている操作をきちんと理解していれば、モジュール内の関数を参照
するのと同じ表記法 ‘modname.itemname’ で、モジュールのグローバル変数をい
じることもできます。

モジュールは他のモジュールをインポートできます。 *note import: 7f8. 文は
モジュール（さらに言えばスクリプトでも）の先頭に置きますが、これは慣習で
あって必須ではありません。インポートされたモジュール名は、モジュールのト
ップレベル（関数やクラスの外）に書いてあれば、モジュールのグローバルな名
前空間に置かれます。

*note import: 7f8. 文には、あるモジュール内の名前を、import を実行してい
るモジュールの名前空間内に直接取り込むという変型があります。例えば:

     >>> from fibo import fib, fib2
     >>> fib(500)
     0 1 1 2 3 5 8 13 21 34 55 89 144 233 377

この操作は、import の対象となるモジュール名をローカルな名前空間内に取り
入れることはありません (従って上の例では、 ‘fibo’ は定義されません)。

モジュールで定義されている名前を全て import するという変型もあります:

     >>> from fibo import *
     >>> fib(500)
     0 1 1 2 3 5 8 13 21 34 55 89 144 233 377

この書き方ではアンダースコア (‘_’) で始まるものを除いてすべての名前をイ
ンポートします。殆どの場面で、Python プログラマーはこの書き方を使いませ
ん。未知の名前がインタープリターに読み込まれ、定義済みの名前を上書きして
しまう可能性があるからです。

一般的には、モジュールやパッケージから ‘*’ を import するというやり方に
は賛同できません。というのは、この操作を行うとしばしば可読性に乏しいコー
ドになるからです。しかし、対話セッションでキータイプの量を減らすために使
うのは構わないでしょう。

モジュール名の後に ‘as’ が続いていた場合は、 ‘as’ の後ろの名前を直接、イ
ンポートされたモジュールが束縛します。

     >>> import fibo as fib
     >>> fib.fib(500)
     0 1 1 2 3 5 8 13 21 34 55 89 144 233 377

これは実質的には ‘import fibo’ と同じ方法でモジュールをインポートしてい
て、唯一の違いはインポートしたモジュールが ‘fib’ という名前で取り扱える
ようになっていることです。

このインポート方法は *note from: 14c3. が付いていても使え、同じ効果が得
られます:

     >>> from fibo import fib as fibonacci
     >>> fibonacci(500)
     0 1 1 2 3 5 8 13 21 34 55 89 144 233 377

     注釈: 実行効率上の理由で、各モジュールはインタープリタの 1 セッショ
     ンごとに 1 回だけ import されます。従って、モジュールを修正した場合
     には、インタープリタを再起動させなければなりません - もしくは、その
     場で手直ししてテストしたいモジュールが 1 つだった場合には、例えば
     ‘import importlib; importlib.reload(modulename)’ のように *note
     importlib.reload(): 73d. を使ってください。

* Menu:

* モジュールをスクリプトとして実行する::
* モジュール検索パス::
* "コンパイル" された Python ファイル::

   ---------- Footnotes ----------

   (1) 実際には、関数定義も '実行' される '文' です。モジュールレベルの
関数定義を実行すると、関数名はモジュールのグローバルな名前空間に追加され
ます。


File: python.info,  Node: モジュールをスクリプトとして実行する,  Next: モジュール検索パス,  Up: モジュールについてもうすこし

2.6.1.1 モジュールをスクリプトとして実行する
............................................

Python モジュールを

     python fibo.py <arguments>

と実行すると、‘__name__’ に ‘__main__’ が設定されている点を除いて import
したときと同じようにモジュール内のコードが実行されます。つまりモジュール
の末尾に:

     if __name__ == "__main__":
         import sys
         fib(int(sys.argv[1]))

このコードを追加することで、このファイルが import できるモジュールである
と同時にスクリプトとしても使えるようになります。なぜならモジュールが
"main" ファイルとして起動されたときだけ、コマンドラインを解釈するコード
が実行されるからです:

     $ python fibo.py 50
     0 1 1 2 3 5 8 13 21 34

モジュールが import された場合は、そのコードは実行されません:

     >>> import fibo
     >>>

この方法はモジュールに便利なユーザインターフェースを提供したり、テストの
ために (スクリプトをモジュールとして起動しテストスイートを実行して) 使わ
れます。


File: python.info,  Node: モジュール検索パス,  Next: "コンパイル" された Python ファイル,  Prev: モジュールをスクリプトとして実行する,  Up: モジュールについてもうすこし

2.6.1.2 モジュール検索パス
..........................

‘spam’ という名前のモジュールをインポートするとき、インタープリタはまず
その名前の組み込みモジュールを探します。モジュール名の一覧は *note
sys.builtin_module_names: 2047. にあります。見つからなかった場合は、
‘spam.py’ という名前のファイルを *note sys.path: 3e4. にあるディレクトリ
のリストから探します。 *note sys.path: 3e4. は以下の場所に初期化されます
:

   * 入力されたスクリプトのあるディレクトリ (あるいはファイルが指定され
     なかったときはカレントディレクトリ)。

   * *note PYTHONPATH: 121f. (ディレクトリ名のリスト。シェル変数の
     ‘PATH’ と同じ構文)。

   * インストール方法に依存したデフォルト（慣例として ‘site-packages’ デ
     ィレクトリーが含まれ、*note site: cc. モジュールによって処理される
     ）。

詳細は *note sys.path モジュール検索パスの初期化: 18dc. を参照してくださ
い。

     注釈: シンボリックリンクをサポートするファイルシステム上では、入力
     されたスクリプトのあるディレクトリはシンボリックリンクをたどった後
     に計算されます。言い換えるとシンボリックリンクを含むディレクトリは
     モジュール検索パスに追加 'されません'。

初期化された後、 Python プログラムは *note sys.path: 3e4. を修正すること
ができます。スクリプトファイルを含むディレクトリが検索パスの先頭、標準ラ
イブラリパスよりも前に追加されます。なので、ライブラリのディレクトリにあ
るファイルよりも、そのディレクトリにある同じ名前のスクリプトが優先してイ
ンポートされます。これは、標準ライブラリを意図して置き換えているのでない
限りは間違いのもとです。より詳しい情報は *note 標準モジュール: 2048. を
参照してください。


File: python.info,  Node: "コンパイル" された Python ファイル,  Prev: モジュール検索パス,  Up: モジュールについてもうすこし

2.6.1.3 "コンパイル" された Python ファイル
...........................................

モジュールの読み込みを高速化するため、Python はコンパイル済みの各モジュ
ールを ‘__pycache__’ ディレクトリの ‘module.`version'.pyc’ ファイルとし
てキャッシュします。ここで version はコンパイルされたファイルのフォーマ
ットを表すもので、一般的には Python のバージョン番号です。例えば、
CPython のリリース 3.3 の、コンパイル済みの spam.py は
‘__pycache__/spam.cpython-33.pyc’ としてキャッシュされるでしょう。この命
名の慣習により、Python の異なる複数のリリースやバージョンのコンパイル済
みモジュールが共存できます。

Python はソースの変更日時をコンパイル済みのものと比較し、コンパイル済み
のものが最新でなくなり再コンパイルが必要になっていないかを確認します。こ
れは完全に自動で処理されます。また、コンパイル済みモジュールはプラットフ
ォーム非依存なため、アーキテクチャの異なるシステム間で同一のライブラリを
共有することもできます。

Python は2つの場合にキャッシュのチェックを行いません。ひとつは、コマンド
ラインから直接モジュールが読み込まれた場合で、常に再コンパイルされ、結果
を保存することはありません。2つめは、ソース・モジュールのない場合で、キ
ャッシュの確認を行いません。ソースのない (コンパイル済みのもののみの) 配
布をサポートするには、コンパイル済みモジュールはソース・ディレクトリにな
くてはならず、ソース・ディレクトリにソース・モジュールがあってはいけませ
ん。

エキスパート向けのTips:

   * コンパイル済みモジュールのサイズを小さくするために、Python コマンド
     に *note -O: 18c. または *note -OO: fb5. スイッチを使うことができま
     す。‘-O’ スイッチは assert ステートメントを除去し、‘-OO’ スイッチは
     assert ステートメントと __doc__ 文字列を除去します。いくつかのプロ
     グラムはこれらの除去されるものに依存している可能性があるため、自分
     が何をしているかを理解しているときに限ってこれらのオプションを使う
     べきです。"最適化" されたモジュールは ‘opt-’ タグを持ち、通常のコン
     パイル済みモジュールよりサイズが小さくなります。将来のリリースでは
     最適化の影響が変わる可能性があります。

   * ‘.pyc’ ファイルや ‘.pyo’ ファイルから読み出されたとしても、プログラ
     ムは ‘.py’ ファイルから読み出されたときより何ら高速に動作するわけで
     はありません。‘.pyc’ ファイルで高速化されるのは、読み込みにかかる時
     間だけです。

   * *note compileall: 21. モジュールを使ってディレクトリ内の全てのモジ
     ュールに対して .pyc ファイルを作ることができます。

   * この処理に関する詳細は、判定のフローチャートを含めて、 PEP 3147(1)
     に記載されています。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3147/


File: python.info,  Node: 標準モジュール,  Next: dir 関数,  Prev: モジュールについてもうすこし,  Up: モジュール<2>

2.6.2 標準モジュール
--------------------

Python は標準モジュールライブラリを同梱していて、別の Python ライブラリ
リファレンスというドキュメントで解説しています。幾つかのモジュールは言語
のコアにはアクセスしないものの、効率や、システムコールなどOSの機能を利用
するために、インタープリター内部にビルトインされています。そういったモジ
ュールセットはまたプラットフォームに依存した構成オプションです。例えば、
*note winreg: 11c. モジュールは Windows システムでのみ提供されています。
1つ注目に値するモジュールとして、 *note sys: df. モジュールは、全ての
Python インタープリターにビルトインされています。 ‘sys.ps1’ と ‘sys.ps2’
という変数は一次プロンプトと二次プロンプトに表示する文字列を定義していま
す:

     >>> import sys
     >>> sys.ps1
     '>>> '
     >>> sys.ps2
     '... '
     >>> sys.ps1 = 'C> '
     C> print('Yuck!')
     Yuck!
     C>

これらの二つの変数は、インタプリタが対話モードにあるときだけ定義されてい
ます。

変数 ‘sys.path’ は文字列からなるリストで、インタプリタがモジュールを検索
するときのパスを決定します。 ‘sys.path’ は環境変数 *note PYTHONPATH:
121f. から得たデフォルトパスに、 *note PYTHONPATH: 121f. が設定されてい
なければ組み込みのデフォルト値に設定されます。標準的なリスト操作で変更す
ることができます:

     >>> import sys
     >>> sys.path.append('/ufs/guido/lib/python')


File: python.info,  Node: dir 関数,  Next: パッケージ,  Prev: 標準モジュール,  Up: モジュール<2>

2.6.3 ‘dir()’ 関数
------------------

組込み関数 *note dir(): 844. は、あるモジュールがどんな名前を定義してい
るか調べるために使われます。 *note dir(): 844. はソートされた文字列のリ
ストを返します:

     >>> import fibo, sys
     >>> dir(fibo)
     ['__name__', 'fib', 'fib2']
     >>> dir(sys)
     ['__breakpointhook__', '__displayhook__', '__doc__', '__excepthook__',
      '__interactivehook__', '__loader__', '__name__', '__package__', '__spec__',
      '__stderr__', '__stdin__', '__stdout__', '__unraisablehook__',
      '_clear_type_cache', '_current_frames', '_debugmallocstats', '_framework',
      '_getframe', '_git', '_home', '_xoptions', 'abiflags', 'addaudithook',
      'api_version', 'argv', 'audit', 'base_exec_prefix', 'base_prefix',
      'breakpointhook', 'builtin_module_names', 'byteorder', 'call_tracing',
      'callstats', 'copyright', 'displayhook', 'dont_write_bytecode', 'exc_info',
      'excepthook', 'exec_prefix', 'executable', 'exit', 'flags', 'float_info',
      'float_repr_style', 'get_asyncgen_hooks', 'get_coroutine_origin_tracking_depth',
      'getallocatedblocks', 'getdefaultencoding', 'getdlopenflags',
      'getfilesystemencodeerrors', 'getfilesystemencoding', 'getprofile',
      'getrecursionlimit', 'getrefcount', 'getsizeof', 'getswitchinterval',
      'gettrace', 'hash_info', 'hexversion', 'implementation', 'int_info',
      'intern', 'is_finalizing', 'last_traceback', 'last_type', 'last_value',
      'maxsize', 'maxunicode', 'meta_path', 'modules', 'path', 'path_hooks',
      'path_importer_cache', 'platform', 'prefix', 'ps1', 'ps2', 'pycache_prefix',
      'set_asyncgen_hooks', 'set_coroutine_origin_tracking_depth', 'setdlopenflags',
      'setprofile', 'setrecursionlimit', 'setswitchinterval', 'settrace', 'stderr',
      'stdin', 'stdout', 'thread_info', 'unraisablehook', 'version', 'version_info',
      'warnoptions']

引数がなければ、 *note dir(): 844. は現在定義している名前を列挙します:

     >>> a = [1, 2, 3, 4, 5]
     >>> import fibo
     >>> fib = fibo.fib
     >>> dir()
     ['__builtins__', '__name__', 'a', 'fib', 'fibo', 'sys']

変数、モジュール、関数、その他の、すべての種類の名前をリストすることに注
意してください。

*note dir(): 844. は、組込みの関数や変数の名前はリストしません。これらの
名前からなるリストが必要なら、標準モジュール *note builtins: 13. で定義
されています:

     >>> import builtins
     >>> dir(builtins)
     ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException',
      'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning',
      'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError',
      'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning',
      'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False',
      'FileExistsError', 'FileNotFoundError', 'FloatingPointError',
      'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError',
      'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError',
      'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError',
      'MemoryError', 'NameError', 'None', 'NotADirectoryError', 'NotImplemented',
      'NotImplementedError', 'OSError', 'OverflowError',
      'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError',
      'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning',
      'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError',
      'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError',
      'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError',
      'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning',
      'ValueError', 'Warning', 'ZeroDivisionError', '_', '__build_class__',
      '__debug__', '__doc__', '__import__', '__name__', '__package__', 'abs',
      'all', 'any', 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'callable',
      'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits',
      'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'exec', 'exit',
      'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr',
      'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass',
      'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview',
      'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property',
      'quit', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice',
      'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars',
      'zip']


File: python.info,  Node: パッケージ,  Prev: dir 関数,  Up: モジュール<2>

2.6.4 パッケージ
----------------

パッケージ (package) は、Python のモジュール名前空間を "ドット付きモジュ
ール名" を使って構造化する手段です。例えば、モジュール名 ‘A.B’ は、 ‘A’
というパッケージのサブモジュール ‘B’ を表します。ちょうど、モジュールを
利用すると、別々のモジュールの著者が互いのグローバル変数名について心配し
なくても済むようになるのと同じように、ドット付きモジュール名を利用すると
、 NumPy や Pillow のように複数モジュールからなるパッケージの著者が、互
いのモジュール名について心配しなくても済むようになります。

音声ファイルや音声データを一様に扱うためのモジュールのコレクション ("パ
ッケージ") を設計したいと仮定しましょう。 音声ファイルには多くの異なった
形式がある (通常は拡張子、 例えば ‘.wav’, ‘.aiff’, ‘.au’ などで認識され
ます) ので、増え続ける様々なファイル形式を相互変換するモジュールを、 作
成したりメンテナンスしたりする必要があるかもしれません。 また、 音声デー
タに対して実行したい様々な独自の操作 (ミキシング、 エコーの追加、 イコラ
イザ関数の適用、 人工的なステレオ効果の作成など) があるかもしれません。
そうなると、 こうした操作を実行するモジュールを果てしなく書くことになる
でしょう。 以下に (階層的なファイルシステムで表現した) パッケージの構造
案を示します:

     sound/                          トップレベルのパッケージ
           __init__.py               soundパッケージの初期化
           formats/                  ファイルフォーマットの変換用サブパッケージ
                   __init__.py
                   wavread.py
                   wavwrite.py
                   aiffread.py
                   aiffwrite.py
                   auread.py
                   auwrite.py
                   ...
           effects/                  サウンドエフェクトのサブパッケージ
                   __init__.py
                   echo.py
                   surround.py
                   reverse.py
                   ...
           filters/                  フィルターのサブパッケージ
                   __init__.py
                   equalizer.py
                   vocoder.py
                   karaoke.py
                   ...

パッケージを import する際、 Python は ‘sys.path’ 上のディレクトリを検索
して、トップレベルのパッケージの入ったサブディレクトリを探します。

ファイルを含むディレクトリをパッケージとしてPython に扱わせるには、ファ
イル ‘__init__.py’ が必要です(より高度な機能 *note namespace package:
2b2. を使う場合を除く)。 これにより、 ‘string’ のようなよくある名前のデ
ィレクトリにより、モジュール検索パスの後の方で見つかる正しいモジュールが
意図せず隠蔽されてしまうのを防ぐためです。 最も簡単なケースでは
‘__init__.py’ はただの空ファイルで構いませんが、 ‘__init__.py’ ではパッ
ケージのための初期化コードを実行したり、後述の ‘__all__’ 変数を設定して
もかまいません。

パッケージのユーザは、個々のモジュールをパッケージから import することが
できます。例えば:

     import sound.effects.echo

この操作はサブモジュール ‘sound.effects.echo’ をロードします。このモジュ
ールは、以下のように完全な名前で参照しなければなりません。

     sound.effects.echo.echofilter(input, output, delay=0.7, atten=4)

サブモジュールを import するもう一つの方法を示します:

     from sound.effects import echo

これもサブモジュール ‘echo’ をロードし、パッケージ名なしで利用可能にしま
す。なのでこう使えます:

     echo.echofilter(input, output, delay=0.7, atten=4)

さらにもう一つのバリエーションとして、必要な関数や変数を直接 import する
方法があります:

     from sound.effects.echo import echofilter

また、これもサブモジュール ‘echo’ をロードしますが、 ‘echofilter()’ 関数
を直接利用可能にします:

     echofilter(input, output, delay=0.7, atten=4)

‘from package import item’ を使う場合、 'item' はパッケージ 'package' の
サブモジュール (またはサブパッケージ) でもかまいませんし、関数やクラス、
変数のような、 'package' で定義されている別の名前でもかまわないことに注
意してください。 ‘import’ 文はまず、 'item' がパッケージ内で定義されてい
るかどうか調べます。定義されていなければ、 'item' はモジュール名であると
仮定して、モジュールをロードしようと試みます。もしモジュールが見つからな
ければ、 *note ImportError: 65b. が送出されます。

反対に、 ‘import item.subitem.subsubitem’ のような構文を使った場合、最後
の ‘subsubitem’ を除く各要素はパッケージでなければなりません。最後の要素
はモジュールかパッケージにできますが、一つ前の要素で定義されているクラス
や関数や変数にはできません。

* Menu:

* パッケージから * を import する::
* パッケージ内参照::
* 複数ディレクトリ中のパッケージ::


File: python.info,  Node: パッケージから * を import する,  Next: パッケージ内参照,  Up: パッケージ

2.6.4.1 パッケージから * を import する
.......................................

それでは、ユーザが ‘from sound.effects import *’ と書いたら、どうなるの
でしょうか？理想的には、何らかの方法でファイルシステムが調べられ、そのパ
ッケージにどんなサブモジュールがあるかを調べ上げ、全てを import する、と
いう処理を望むことでしょう。これには長い時間がかかってしまうこともありま
すし、あるサブモジュールを import することで、そのモジュールが明示的に
import されたときのみ発生して欲しい副作用が起きてしまうかもしれません。

唯一の解決策は、パッケージの作者にパッケージの索引を明示的に提供させる と
いうものです。 *note import: 7f8. 文の使う規約は、パッケージの
‘__init__.py’ コードに ‘__all__’ という名前のリストが定義されていれば、
‘from package import *’ が現れたときに import すべきモジュール名のリスト
として使う、というものです。 パッケージの新バージョンがリリースされると
きにリストを最新の状態に更新するのは パッケージの作者の責任となります。
自分のパッケージから * を import するという使い方が考えられないならば、
パッケージの作者はこの使い方をサポートしないことにしてもかまいません。 例
えば、ファイル ‘sound/effects/__init__.py’ には、次のような コードを入れ
てもよいかもしれません:

     __all__ = ["echo", "surround", "reverse"]

これが意味するのは、 ‘from sound.effects import *’ とすると、名前の挙が
った 3つのサブモジュールが ‘sound.effects’ パッケージから import される
、ということです。

注意点として、サブモジュールはローカルな名前で隠されることがあります。例
として、 ‘reverse’ 関数を ‘sound/effects/__init__.py’ に足すと、 ‘from
sound.effects import *’ では ‘echo’ と ‘surround’ の２サブモジュールだけ
import されます。 ‘reverse’ サブモジュールは import 'されません' 。それ
はローカルに定義された ‘reverse’ 関数で隠されたので:

     __all__ = [
         "echo",      # 'echo.py' ファイルを参照する
         "surround",  # 'surround.py' ファイルを参照する
         "reverse",   # !!! 'reverse' 関数を参照する !!!
     ]

     def reverse(msg: str):  # <-- この名前は 'from sound.effects import *' を実行したときに
         return msg[::-1]    #     サブモジュールの 'reverse.py' を隠してしまう

もしも ‘__all__’ が定義されていなければ、実行文 ‘from sound.effects
import *’ は、パッケージ ‘sound.effects’ の全てのサブモジュールを現在の
名前空間の中へ import 'しません' 。この文は単に(場合によっては初期化コー
ド ‘__init__.py’ を実行して) パッケージ ‘sound.effects’ が import された
ということを確認し、そのパッケージで定義されている名前を全て import する
だけです。 import される名前には、 ‘__init__.py’ で定義された名前 (と、
明示的にロードされたサブモジュール) が含まれます。パッケージのサブモジュ
ールで、以前の *note import: 7f8. 文で明示的にロードされたものも含みます
。以下のコードを考えてください:

     import sound.effects.echo
     import sound.effects.surround
     from sound.effects import *

上の例では、 ‘echo’ と ‘surround’ モジュールが現在の名前空間に import さ
れます。これらのモジュールは ‘from...import’ 文が実行された際に
‘sound.effects’ 内で定義されているからです。 (この機構は ‘__all__’ が定
義されているときにも働きます。)

特定のモジュールでは ‘import *’ を使ったときに、特定のパターンに従った名
前のみを公開 (export) するように設計されてはいますが、それでもやはり製品
のコードでは良いことではないと考えます。

‘from package import specific_submodule’ を使っても何も問題はないことに
留意してください！実際この表記法は、import を行うモジュールが他のパッケ
ージと同じ名前を持つサブモジュールを使わなければならない場合を除いて推奨
される方式です。


File: python.info,  Node: パッケージ内参照,  Next: 複数ディレクトリ中のパッケージ,  Prev: パッケージから * を import する,  Up: パッケージ

2.6.4.2 パッケージ内参照
........................

パッケージが (前述の例の ‘sound’ パッケージのように) サブパッケージの集
まりに構造化されている場合、絶対 import を使って兄弟関係にあるパッケージ
を参照できます。例えば、モジュール ‘sound.filters.vocoder’ で
‘sound.effects’ パッケージの ‘echo’ モジュールが必要な場合、 ‘from
sound.effects import echo’ が使えます。

また、明示的な相対importを ‘from module import name’ の形式の import 文
で利用できます。この明示的な相対 import では、先頭のドットで現在および親
パッケージを指定します。 ‘surround’ モジュールの例では、以下のように記述
できます:

     from . import echo
     from .. import formats
     from ..filters import equalizer

相対 import は現在のモジュールのパッケージ名をベースにすることに注意して
ください。メインモジュールはパッケージがないため、Python アプリケーショ
ンのメインモジュールとして利用されることを意図しているモジュールでは絶対
import を利用するべきです。


File: python.info,  Node: 複数ディレクトリ中のパッケージ,  Prev: パッケージ内参照,  Up: パッケージ

2.6.4.3 複数ディレクトリ中のパッケージ
......................................

パッケージはもう一つ特別な属性として *note __path__: 2054. をサポートし
ています。この属性は、パッケージの ‘__init__.py’ 中のコードが実行される
よりも前に、 ‘__init__.py’ の収められているディレクトリ名の文字列を含ん
だ 入った *note sequence: 716. になるよう初期化されます。この変数は変更
することができます。変更を加えると、以降そのパッケージに入っているモジュ
ールやサブパッケージの検索に影響します。

この機能はほとんど必要にはならないのですが、パッケージ内存在するモジュー
ル群を拡張するために使うことができます。

脚注
....


File: python.info,  Node: 入力と出力,  Next: エラーと例外,  Prev: モジュール<2>,  Up: Python チュートリアル

2.7 入力と出力
==============

プログラムの出力方法にはいくつかの種類があります。 データを人間が読める
形で出力することもあれば、将来使うためにファイルに書くこともあります。 こ
の章では、こうした幾つかの出力の方法について話します。

* Menu:

* 出力を見やすくフォーマットする::
* ファイルを読み書きする::


File: python.info,  Node: 出力を見やすくフォーマットする,  Next: ファイルを読み書きする,  Up: 入力と出力

2.7.1 出力を見やすくフォーマットする
------------------------------------

これまでに、値を出力する二つの方法: '式文 (expression statement)' と
*note print(): 1177. 関数が出てきました。 (第三はファイルオブジェクトの
*note write(): 205b. メソッドを使う方法です。標準出力を表すファイルは
‘sys.stdout’ で参照できます。詳細はライブラリリファレンスを参照してくだ
さい。)

単に空白区切りで値を並べただけの出力よりも、フォーマットを制御したいと思
うことはよくあることでしょう。 出力をフォーマットする方法はいくつかあり
ます。

   * *note フォーマット済み文字列リテラル: 205c. を使うには、開き引用符
     や三重の開き引用符の前に ‘f’ あるいは ‘F’ を付けて文字列を始めます
     。 この文字列の内側では、文字 ‘{’ と文字 ‘}’ の間に Python の式が書
     け、その式から変数やリテラル値が参照できます。

          >>> year = 2016
          >>> event = '国民投票'
          >>> f'{year}年の{event}の結果'
          '2016年の国民投票の結果'

   * 文字列の *note str.format(): 833. メソッドは、もう少し手間がかかり
     ます。 ここでも ‘{’ と ‘}’ を使って変数に代入する場所の印を付けて、
     細かいフォーマットの指示を出せますが、フォーマットされる対象の情報
     を与える必要があります。次のコードには、変数をフォーマットする方法
     の例が二つあります:

          >>> yes_votes = 42_572_654
          >>> total_votes = 85_705_149
          >>> percentage = yes_votes / total_votes
          >>> '{:-9} 賛成票  {:2.2%}'.format(yes_votes, percentage)
          ' 42572654 賛成票  49.67%'

     ‘yes_votes’ が、スペースと、負数の場合は負符号で埋められていること
     に注意してください。この例では、100を掛けた ‘percentage’ を、パーセ
     ント記号付きで小数点以下2桁で表示することも行っています。 (詳細は、
     *note 書式指定ミニ言語仕様: 4f9. を参照してください。)

   * 最後に、文字列のスライス操作や結合操作を使い、全ての文字列を自分で
     処理し、思い通りのレイアウトを作成できます。 文字列型には、文字列の
     間隔を調整して指定されたカラム幅に揃えるのに便利な操作を行うメソッ
     ドがいくつかあります。

凝った出力である必要は無いけれど、デバッグ目的で変数をすばやく表示したい
ときは、 *note repr(): 1c1. 関数か *note str(): 169. 関数でどんな値も文
字列に変換できます。

*note str(): 169. 関数は値の人間に読める表現を返すためのもので、 *note
repr(): 1c1. 関数はインタープリタに読める (あるいは同値となる構文がない
場合は必ず *note SyntaxError: 18e. になるような) 表現を返すためのもので
す。人間が読むのに適した特定の表現を持たないオブジェクトにおいては、
*note str(): 169. は *note repr(): 1c1. と同じ値を返します。数値や、リス
トや辞書を始めとするデータ構造など、多くの値がどちらの関数に対しても同じ
表現を返します。一方、文字列は、2つの異なる表現を持っています。

いくつかの例です:

     >>> s = 'Hello, world.'
     >>> str(s)
     'Hello, world.'
     >>> repr(s)
     "'Hello, world.'"
     >>> str(1/7)
     '0.14285714285714285'
     >>> x = 10 * 3.25
     >>> y = 200 * 200
     >>> s = 'The value of x is ' + repr(x) + ', and y is ' + repr(y) + '...'
     >>> print(s)
     The value of x is 32.5, and y is 40000...
     >>> # 文字列に repr() を使うとクォートとバックスラッシュが追加される:
     >>> hello = 'hello, world\n'
     >>> hellos = repr(hello)
     >>> print(hellos)
     'hello, world\n'
     >>> # repr() の引数はどんな Python オブジェクトでも可:
     >>> repr((x, y, ('spam', 'eggs')))
     "(32.5, 40000, ('spam', 'eggs'))"

The *note string: d8. module contains support for a simple templating
approach based upon regular expressions, via *note string.Template: 897.
This offers yet another way to substitute values into strings, using
placeholders like ‘$x’ and replacing them with values from a dictionary.
This syntax is easy to use, although it offers much less control for
formatting.

* Menu:

* フォーマット済み文字列リテラル::
* 文字列の format() メソッド: 文字列の format メソッド.
* 文字列の手作業でのフォーマット::
* 古い文字列書式設定方法::


File: python.info,  Node: フォーマット済み文字列リテラル,  Next: 文字列の format メソッド,  Up: 出力を見やすくフォーマットする

2.7.1.1 フォーマット済み文字列リテラル
......................................

*note フォーマット済み文字リテラル: 19a. (短くして f-string とも呼びます
) では、文字列の頭に ‘f’ か ‘F’ を付け、式を ‘{expression}’ と書くことで
、 Python の式の値を文字列の中に入れ込めます。

オプションのフォーマット指定子を式の後ろに付けられます。 このフォーマッ
ト指定子によって値のフォーマット方式を制御できます。 次の例では、円周率
πを小数点以下3桁に丸めてフォーマットしています:

     >>> import math
     >>> print(f'πの値はだいたい {math.pi:.3f} です。')
     πの値はだいたい 3.142 です。

‘':'’ の後ろに整数をつけると、そのフィールドの最小の文字幅を指定できます
。 この機能は縦を揃えるのに便利です。

     >>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 7678}
     >>> for name, phone in table.items():
     ...     print(f'{name:10} ==> {phone:10d}')
     ...
     Sjoerd     ==>       4127
     Jack       ==>       4098
     Dcab       ==>       7678

他の修飾子は、フォーマットする前に値を変換するのに使えます。 ‘'!a'’ は
*note ascii(): 15ff. を、 ‘'!s'’ は *note str(): 169. を、 ‘'!r'’ は
*note repr(): 1c1. を適用します:

     >>> animals = 'ウナギ'
     >>> print(f'私のホバークラフトは {animals} でいっぱいです。')
     私のホバークラフトは ウナギ でいっぱいです。
     >>> print(f'私のホバークラフトは {animals!r} でいっぱいです。')
     私のホバークラフトは 'ウナギ' でいっぱいです。

‘=’ 指定子を使用すると式を展開して、式、イコール記、式を評価した文字列表
現、の形式で表示されます。

     >>> bugs = 'roaches'
     >>> count = 13
     >>> area = 'living room'
     >>> print(f'Debugging {bugs=} {count=} {area=}')
     Debugging bugs='roaches' count=13 area='living room'

‘=’ 指定子の詳細については *note self-documenting expressions: b9f. を参
照してください。 フォーマットについての仕様は *note
書式指定ミニ言語仕様: 4f9. のリファレンスガイドを参照してください。


File: python.info,  Node: 文字列の format メソッド,  Next: 文字列の手作業でのフォーマット,  Prev: フォーマット済み文字列リテラル,  Up: 出力を見やすくフォーマットする

2.7.1.2 文字列の format() メソッド
..................................

*note str.format(): 833. メソッドの基本的な使い方は次のようなものです:

     >>> print('We are the {} who say "{}!"'.format('knights', 'Ni'))
     We are the knights who say "Ni!"

括弧とその中の文字(これをフォーマットフィールドと呼びます)は、 *note
str.format(): 833. メソッドに渡されたオブジェクトに置換されます。括弧の
中の数字は *note str.format(): 833. メソッドに渡されたオブジェクトの位置
を表すのに使えます。

     >>> print('{0} and {1}'.format('spam', 'eggs'))
     spam and eggs
     >>> print('{1} and {0}'.format('spam', 'eggs'))
     eggs and spam

*note str.format(): 833. メソッドにキーワード引数が渡された場合、その値
はキーワード引数の名前によって参照されます。

     >>> print('This {food} is {adjective}.'.format(
     ...       food='spam', adjective='absolutely horrible'))
     This spam is absolutely horrible.

順序引数とキーワード引数を組み合わせて使うこともできます:

     >>> print('The story of {0}, {1}, and {other}.'.format('Bill', 'Manfred',
     ...                                                    other='Georg'))
     The story of Bill, Manfred, and Georg.

もしも長い書式文字列があり、それを分割したくない場合には、変数を引数の位
置ではなく変数の名前で参照できるとよいでしょう。これは、辞書を引数に渡し
て、角括弧 ‘'[]'’ を使って辞書のキーを参照することで可能です。

     >>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}
     >>> print('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; '
     ...       'Dcab: {0[Dcab]:d}'.format(table))
     Jack: 4098; Sjoerd: 4127; Dcab: 8637678

辞書 ‘table’ を ‘**’ 記法を使ってキーワード引数として渡す方法もあります
。

     >>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}
     >>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'.format(**table))
     Jack: 4098; Sjoerd: 4127; Dcab: 8637678

全てのローカルな変数が入った辞書を返す組み込み関数 *note vars(): 1e23. と
組み合わせると特に便利です。

     >>> table = {k: str(v) for k, v in vars().items()}>>> message = " ".join([f'{k}: ' + '{' + k +'};' for k in table.keys()])>>> print(message.format(**table))__name__: __main__; __doc__: None; __package__: None; __loader__: ...

例として、下のコード行は与えられた整数とその2乗と3乗がきちんと揃った列を
生成します:

     >>> for x in range(1, 11):
     ...     print('{0:2d} {1:3d} {2:4d}'.format(x, x*x, x*x*x))
     ...
      1   1    1
      2   4    8
      3   9   27
      4  16   64
      5  25  125
      6  36  216
      7  49  343
      8  64  512
      9  81  729
     10 100 1000

*note str.format(): 833. による文字列書式設定の完全な解説は、 *note
書式指定文字列の文法: 15b3. を参照してください。


File: python.info,  Node: 文字列の手作業でのフォーマット,  Next: 古い文字列書式設定方法,  Prev: 文字列の format メソッド,  Up: 出力を見やすくフォーマットする

2.7.1.3 文字列の手作業でのフォーマット
......................................

次は 2 乗と 3 乗の値からなる同じ表を手作業でフォーマットしたものです:

     >>> for x in range(1, 11):
     ...     print(repr(x).rjust(2), repr(x*x).rjust(3), end=' ')
     ...     # 上の行で end を使用していることに注意
     ...     print(repr(x*x*x).rjust(4))
     ...
      1   1    1
      2   4    8
      3   9   27
      4  16   64
      5  25  125
      6  36  216
      7  49  343
      8  64  512
      9  81  729
     10 100 1000

(各カラムの間のスペース一個分は *note print(): 1177. の動作で追加されて
いることに注意してください。 *note print(): 1177. は常に引数間に空白を追
加します。)

文字列オブジェクトの *note str.rjust(): 2061. メソッドは、指定された幅の
フィールド内に文字列が右寄せで入るように左側に空白を追加します。 同様の
メソッドとして、 *note str.ljust(): 2062. と *note str.center(): 2063. が
あります。 これらのメソッドは何か出力を行うわけではなく、ただ新しい文字
列を返します。 入力文字列が長すぎる場合、文字列を切り詰めることはせず、
値をそのまま返します。この仕様のためにカラムのレイアウトが滅茶苦茶になる
かもしれませんが、嘘の値が代わりに書き出されるよりはましです。 (本当に切
り詰めを行いたいのなら、全てのカラムに ‘x.ljust(n)[:n]’ のようにスライス
表記を加えることもできます。)

もう一つのメソッド、 *note str.zfill(): 16cb. は、数値文字列の左側をゼロ
詰めします。このメソッドは正と負の符号を正しく扱います:

     >>> '12'.zfill(5)
     '00012'
     >>> '-3.14'.zfill(7)
     '-003.14'
     >>> '3.14159265359'.zfill(5)
     '3.14159265359'


File: python.info,  Node: 古い文字列書式設定方法,  Prev: 文字列の手作業でのフォーマット,  Up: 出力を見やすくフォーマットする

2.7.1.4 古い文字列書式設定方法
..............................

% 演算子 (剰余) は文字列のフォーマットでも使えます。 ‘format % values’
('format' は文字列) という文字列が与えられた場合、 'format' 中の ‘%’ 変
換指定はゼロあるいは 'values' の余りの要素に置換えられます。この操作は文
字列補間として知られています。例えば:

     >>> import math
     >>> print('πの値はだいたい %5.3f です。' % math.pi)
     πの値はだいたい 3.142 です。

より詳しい情報は *note printf 形式の文字列書式化: 8db. にあります。


File: python.info,  Node: ファイルを読み書きする,  Prev: 出力を見やすくフォーマットする,  Up: 入力と出力

2.7.2 ファイルを読み書きする
----------------------------

*note open(): 316. は *note file object: 13db. を返します。大抵、
‘open(filename, mode, encoding=None)’ のように2つの位置引数と1つのキーワ
ード引数を伴って呼び出されます。

     >>> f = open('workfile', 'w', encoding="utf-8")

最初の引数はファイル名の入った文字列です。二つめの引数も文字列で、ファイ
ルをどのように使うかを示す数個の文字が入っています。 'mode' は、ファイル
が読み出し専用なら ‘'r'’ 、書き込み専用 (同名の既存のファイルがあれば消
去されます) なら ‘'w'’ とします。 ‘'a'’ はファイルを追記用に開きます。フ
ァイルに書き込まれた内容は自動的にファイルの終端に追加されます。 ‘'r+'’
はファイルを読み書き両用に開きます。 'mode' 引数は省略可能で、省略された
場合には ‘'r'’ であると仮定します。

通常、ファイルはテキストモード ('text mode') で開かれ、特定の 'エンコー
ディング' でエンコードされたファイルに対して文字列を読み書きします。'エ
ンコーディング' が指定されなければ、デフォルトはプラットフォーム依存です
(*note open(): 316. を参照してください)。UTF-8は現在の事実上の標準のため
、異なるエンコーディングを指定したい場合以外は ‘encoding="utf-8"’ の指定
がおすすめです。モードに ‘'b'’ をつけるとファイルを 'binary mode' で開き
ます。バイナリーモードでのデータは *note bytes: 192. オブジェクトで読み
書きします。ファイルをバイナリーモードで開くときは 'エンコーディング' は
指定できません。

テキストモードの読み取りでは、プラットフォーム固有の行末記号 (Unix では
‘\n’ 、Windows では ‘\r\n’) をただの ‘\n’ に変換するのがデフォルトの動作
です。テキストモードの書き込みでは、 ‘\n’ が出てくる箇所をプラットフォー
ム固有の行末記号に戻すのがデフォルトの動作です。この裏で行われるファイル
データの変換はテキストファイルには上手く働きますが、 ‘JPEG’ ファイルや
‘EXE’ ファイルのようなバイナリデータを破壊する恐れがあります。そのような
ファイルを読み書きする場合には注意して、バイナリモードを使うようにしてく
ださい。

ファイルオブジェクトを扱うときに *note with: 186. キーワードを使うのは良
い習慣です。 その利点は、処理中に例外が発生しても必ず最後にファイルをち
ゃんと閉じることです。 ‘with’ を使うと、同じことを *note try: 8f8.-*note
finally: 1b0. ブロックを使って書くよりずっと簡潔に書けます:

     >>> with open('workfile', encoding="utf-8") as f:
     ...     read_data = f.read()

     >>> # ファイルが自動でクローズされたことが確認できる
     >>> f.closed
     True

もし *note with: 186. キーワードを使用しない場合は、ファイルを閉じ、この
ファイルのために利用されたシステムのリソースを直ちに解放するために
‘f.close()’ を呼び出してください。

     警告: ‘f.write()’ を ‘with’ キーワードや ‘f.close()’ を使わずに呼び
     出した場合、プログラムが正常に終了した場合でも、 ‘f.write()’ の実引
     数がディスクに完全に '書き込まれないことがあります' 。

*note with: 186. 文や ‘f.close()’ の呼び出しによって閉じられた後にファイ
ルオブジェクトを使おうとするとそこで処理が失敗します。:

     >>> f.close()
     >>> f.read()
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     ValueError: I/O operation on closed file.

* Menu:

* ファイルオブジェクトのメソッド::
* json による構造化されたデータの保存::


File: python.info,  Node: ファイルオブジェクトのメソッド,  Next: json による構造化されたデータの保存,  Up: ファイルを読み書きする

2.7.2.1 ファイルオブジェクトのメソッド
......................................

この節の以降の例は、 ‘f’ というファイルオブジェクトが既に生成されている
ものと仮定します。

ファイルの内容を読み出すには、 ‘f.read(size)’ を呼び出します。このメソッ
ドはある量のデータを読み出して、文字列 (テキストモードの場合) か bytes オ
ブジェクト (バイナリーモードの場合) として返します。 'size' はオプション
の数値引数です。 'size' が省略されたり負の数であった場合、ファイルの内容
全てを読み出して返します。ただし、ファイルがマシンのメモリの二倍の大きさ
もある場合にはどうなるかわかりません。 'size' が負でない数ならば、最大で
(テキストモードの場合) 'size' 文字、(バイナリモードの場合) 'size' バイト
を読み出して返します。ファイルの終端にすでに達していた場合、 ‘f.read()’
は空の文字列 (‘''’) を返します。

     >>> f.read()
     'これがファイル全体です。\n'
     >>> f.read()
     ''

‘f.readline()’ はファイルから 1 行だけを読み取ります。改行文字 (‘\n’) は
読み出された文字列の終端に残ります。改行が省略されるのは、ファイルが改行
で終わっていない場合の最終行のみです。これは、戻り値があいまいでないよう
にするためです; ‘f.readline()’ が空の文字列を返したら、ファイルの終端に
達したことが分かります。一方、空行は ‘'\n'’、すなわち改行 1 文字だけから
なる文字列で表現されます。

     >>> f.readline()
     'これがファイルの最初の行です。\n'
     >>> f.readline()
     'ファイルの2行目です。\n'
     >>> f.readline()
     ''

ファイルから複数行を読み取るには、ファイルオブジェクトに対してループを書
く方法があります。この方法はメモリを効率的に使え、高速で、簡潔なコードに
なります:

     >>> for line in f:
     ...     print(line, end='')
     ...
     これがファイルの最初の行です。
     ファイルの2行目です。

ファイルのすべての行をリスト形式で読み取りたいなら、‘list(f)’ や
‘f.readlines()’ を使うこともできます。

‘f.write(string)’ は、'string' の内容をファイルに書き込み、書き込まれた
文字数を返します。

     >>> f.write('This is a test\n')
     15

オブジェクトの他の型は、書き込む前に変換しなければなりません - 文字列 (テ
キストモード) と bytes オブジェクト (バイナリーモード) のいずれかです:

     >>> value = ('the answer', 42)
     >>> s = str(value)  # タプルを文字列に変換
     >>> f.write(s)
     18

‘f.tell()’ は、ファイルオブジェクトのファイル中における現在の位置を示す
整数を返します。ファイル中の現在の位置は、バイナリモードではファイルの先
頭からのバイト数で、テキストモードでは不明瞭な値で表されます。

ファイルオブジェクトの位置を変更するには、‘f.seek(offset, whence)’ を使
います。ファイル位置は基準点 (reference point) にオフセット値 'offset' を
足して計算されます。参照点は 'whence' 引数で選びます。'whence' の値が 0
ならばファイルの 先頭から測り、1 ならば現在のファイル位置を使い、2 なら
ばファイルの終端を参照点として使います。'whence' は省略することができ、
デフォルトの値は 0、すなわち参照点としてファイルの先頭を使います。

     >>> f = open('workfile', 'rb+')
     >>> f.write(b'0123456789abcdef')
     16
     >>> f.seek(5)      # ファイル内の6番目のバイトまで移動
     5
     >>> f.read(1)
     b'5'
     >>> f.seek(-3, 2)  # 末尾から３番目のバイトに移動
     13
     >>> f.read(1)
     b'd'

テキストファイル (mode 文字列に ‘b’ を付けなかった場合) では、ファイルの
先頭からの相対位置に対するシークだけが許可されています (例外として、
‘seek(0, 2)’ でファイルの末尾へのシークは可能です)。また、唯一の有効な
'offset' 値は ‘f.tell()’ から返された値か、0 のいずれかです。それ以外の
'offset' 値は未定義の振る舞いを引き起こします。

ファイルオブジェクトには、他にも *note isatty(): 2069. や *note
truncate(): 1528. といった、あまり使われないメソッドがあります。ファイル
オブジェクトについての完全なガイドは、ライブラリリファレンスを参照してく
ださい。


File: python.info,  Node: json による構造化されたデータの保存,  Prev: ファイルオブジェクトのメソッド,  Up: ファイルを読み書きする

2.7.2.2 ‘json’ による構造化されたデータの保存
.............................................

文字列は簡単にファイルに読み書きできます。数値の場合には少し努力が必要で
す。というのも、 *note read(): 206c. メソッドは文字列しか返さないため、
*note int(): 19b. のような関数にその文字列を渡して、たとえば文字列
‘'123'’ のような文字列を、数値 123 に変換しなくてはならないからです。も
っと複雑なデータ型、例えば入れ子になったリストや辞書の場合、手作業でのパ
ースやシリアライズは困難になります。

ユーザが毎回コードを書いたりデバッグしたりして複雑なデータ型をファイルに
保存するかわりに、Python では一般的なデータ交換形式である JSON
(JavaScript Object Notation)(1) を使うことができます。この標準モジュール
*note json: 86. は、Python のデータ 階層を取り、文字列表現に変換します。
この処理は 'シリアライズ (serializing)' と呼ばれます。文字列表現からデー
タを再構築することは、'デシリアライズ (deserializing)' と呼ばれます。シ
リアライズされてからデシリアライズされるまでの間に、オブジェクトの文字列
表現はファイルやデータの形で保存したり、ネットワークを通じて離れたマシン
に送ったりすることができます。

     注釈: JSON 形式は現代的なアプリケーションでデータをやりとりする際に
     よく使われます。多くのプログラマーが既に JSON に詳しいため、JSON は
     データの相互交換をする場合の良い選択肢です。

オブジェクト ‘x’ があり、その JSON 形式の文字列表現を見るには、単純な1行
のコードを書くだけです:

     >>> import json
     >>> x = [1, 'simple', 'list']
     >>> json.dumps(x)
     '[1, "simple", "list"]'

*note dumps(): f41. に似た関数に、*note dump(): f40. があり、こちらは単
純にオブジェクトを *note text file: 206d. にシリアライズします。‘f’ が書
き込み用に開かれた *note text file: 206d. だとすると、次のように書くこと
ができます:

     json.dump(x, f)

逆にデシリアライズするには、‘f’ が読み込み用に開かれた *note binary
file: 206e. か *note text file: 206d. だとすると、次のようになります:

     x = json.load(f)

     注釈: JSONファイルは必ずUTF-8でエンコードします。JSONファイルを
     *note text file: 206d. として読み込み、書き込みで開くときには、
     ‘encoding="utf-8"’ を指定します。

このような単純なシリアライズをする手法は、リストや辞書を扱うことはできま
すが、任意のクラス・インスタンスを JSON にシリアライズするにはもう少し努
力しなくてはなりません。*note json: 86. モジュールのリファレンスにこれに
ついての解説があります。

参考
....

*note pickle: ab. - pickle モジュール

*note JSON: 206b. とは対照的に、 'pickle' は任意の複雑な Python オブジェ
クトをシリアライズ可能なプロトコルです。しかし、Python に特有のプロトコ
ルで、他の言語で記述されたアプリケーションと通信するのには使えません。さ
らに、デフォルトでは安全でなく、信頼できない送信元から送られてきた、スキ
ルのある攻撃者によって生成された pickle データをデシリアライズすると、攻
撃者により任意のコードが実行されてしまいます。

   ---------- Footnotes ----------

   (1) https://json.org


File: python.info,  Node: エラーと例外,  Next: クラス,  Prev: 入力と出力,  Up: Python チュートリアル

2.8 エラーと例外
================

これまでエラーメッセージについては簡単に触れるだけでしたが、チュートリア
ル中の例を自分で試していたら、実際にいくつかのエラーメッセージを見ている
ことでしょう。エラーには (少なくとも) 二つのはっきり異なる種類があります
。それは '構文エラー (syntax error)' と '例外 (exception)' です。

* Menu:

* 構文エラー::
* 例外::
* 例外を処理する::
* 例外を送出する::
* 例外の連鎖::
* ユーザー定義例外::
* クリーンアップ動作を定義する::
* 定義済みクリーンアップ処理::
* 複数の関連しない例外の送出と処理::
* ノートによって例外を充実させる::


File: python.info,  Node: 構文エラー,  Next: 例外,  Up: エラーと例外

2.8.1 構文エラー
----------------

構文エラーは構文解析エラー (parsing error) としても知られており、Python
を勉強している間に最もよく遭遇する問題の一つでしょう:

     >>> while True print('Hello world')
       File "<stdin>", line 1
         while True print('Hello world')
                    ^^^^^
     SyntaxError: invalid syntax

パーサが構文解析エラーと判断した行が表示されるとともに、エラーが検出され
た部分に矢印 (^) が表示されます。ただし、この部分が本当に修正すべき箇所
とは限らないので注意してください。上記の例では、エラーは関数 *note
print(): 1177. のところで検出されており、これはその前にコロン (‘':'’) が
抜けているためです。

ファイルに書かれたコードの場合、ファイル名 (上の例では ‘<stdin>’) と行番
号が表示されるので、どこを見ればよいかが分かるようになっています。


File: python.info,  Node: 例外,  Next: 例外を処理する,  Prev: 構文エラー,  Up: エラーと例外

2.8.2 例外
----------

たとえ文や式が構文的に正しくても、実行しようとしたときにエラーが発生する
かもしれません。実行中に検出されたエラーは '例外 (exception)' と呼ばれ、
常に致命的とは限りません。これから、Python プログラムで例外をどのように
扱うかを学んでいきます。ほとんどの例外はプログラムで処理されず、以下に示
されるようなメッセージになります:

     >>> 10 * (1/0)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
         10 * (1/0)
               ~^~
     ZeroDivisionError: division by zero
     >>> 4 + spam*3
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
         4 + spam*3
             ^^^^
     NameError: name 'spam' is not defined
     >>> '2' + 2
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
         '2' + 2
         ~~~~^~~
     TypeError: can only concatenate str (not "int") to str

エラーメッセージの最終行は何が起こったかを示しています。例外は様々な型
(type) で起こり、その型がエラーメッセージの一部として出力されます。上の
例での型は *note ZeroDivisionError: b3f, *note NameError: 452, *note
TypeError: 198. です。例外型として出力される文字列は、発生した例外の組み
込み名です。これは全ての組み込み例外について成り立ちますが、ユーザ定義の
例外では (成り立つようにするのは有意義な慣習ですが) 必ずしも成り立ちませ
ん。標準例外の名前は組み込みの識別子です (予約語ではありません)。

残りの行は例外の詳細で、その例外の型と何が起きたかに依存します。

エラーメッセージの先頭部分では、例外が発生した実行コンテキスト (context)
を、スタックのトレースバック (stack traceback) の形式で示しています。一
般には、この部分にはソースコード行をリストしたトレースバックが表示されま
す。しかし、標準入力から読み取られたコードは表示されません。

*note 組み込み例外: 1c27. には、組み込み例外とその意味がリストされていま
す。


File: python.info,  Node: 例外を処理する,  Next: 例外を送出する,  Prev: 例外,  Up: エラーと例外

2.8.3 例外を処理する
--------------------

例外を選別して処理するようなプログラムを書くことができます。以下の例を見
てください。この例では、有効な文字列が入力されるまでユーザに入力を促しま
すが、ユーザがプログラムに (‘Control’-‘C’ か、またはオペレーティングシス
テムがサポートしている何らかのキーを使って) 割り込みをかけてプログラムを
中断させることができるようにしています。ユーザが生成した割り込みは、
*note KeyboardInterrupt: bc5. 例外が送出されることで通知されるということ
に注意してください。

     >>> while True:
     ...     try:
     ...         x = int(input("数字を入力してください: "))
     ...         break
     ...     except ValueError:
     ...         print("おっと!それは数字ではないようです。もう一度入力してください...")
     ...

*note try: 8f8. 文は下記のように動作します。

   * まず、 'try 節 (try clause)' (キーワード *note try: 8f8. と *note
     except: 1ab. の間の文) が実行されます。

   * 何も例外が発生しなければ、 'except 節' をスキップして *note try:
     8f8. 文の実行を終えます。

   * *note try: 8f8. 節内の実行中に例外が発生すると、その節の残りは飛ば
     されます。次に、例外型が *note except: 1ab. キーワードの後に指定さ
     れている例外に一致する場合、except 節が実行された後、 try/except ブ
     ロックの後ろへ実行が継続されます。

   * もしも 'except 節' で指定された例外と一致しない例外が発生すると、そ
     の例外は *note try: 8f8. 文の外側に渡されます。例外に対するハンドラ
     (handler、処理部) がどこにもなければ、 '処理されない例外 (unhandled
     exception)' となり、エラーメッセージを出して実行を停止します。

一つの *note try: 8f8. 文には複数の 'except 節' が付けられ、別々の例外に
対するハンドラを指定できます。 多くとも一つのハンドラしか実行されません
。 ハンドラは対応する 'try 節' 内で発生した例外だけを処理し、同じ ‘try’
節内の別の例外ハンドラで起きた例外は処理しません。 'except 節' では丸括
弧で囲ったタプルという形で複数の例外を指定できます。例えば次のようにしま
す:

     ... except (RuntimeError, TypeError, NameError):
     ...     pass

*note except: 1ab. 節 内のクラスは、そのクラスや派生クラスのインスタンス
である例外とマッチします（その逆はありません -- 派生クラスが書かれた
'except節' は、その基底クラスのインスタンスにはマッチしません）。例えば
、次のコードは B, C, D の順に出力されます:

     class B(Exception):
         pass

     class C(B):
         pass

     class D(C):
         pass

     for cls in [B, C, D]:
         try:
             raise cls()
         except D:
             print("D")
         except C:
             print("C")
         except B:
             print("B")

'except 節' が逆に並んでいた場合 (‘except B’ が最初にくる場合)、 B, B, B
と出力されるはずだったことに注意してください -- 最初に一致した 'except 節
' が駆動されるのです。

例外が発生するとき、例外は関連付けられた値を持つことができます。この値は
例外の '引数 (arguments)' とも呼ばれます。引数の有無および引数の型は、例
外の型に依存します。

except節は例外名の後に変数を指定できます。その変数は例外インスタンスに紐
付けられ、一般的には引数を保持する ‘args’ 属性を持ちます。利便性のため、
組み込み例外型には *note __str__(): 830. が定義されており、明示的に
‘.args’ を参照せずとも すべての引数を表示できます。

     >>> try:
     ...     raise Exception('spam', 'eggs')
     ... except Exception as inst:
     ...     print(type(inst))    # 例外の型
     ...     print(inst.args)     # 引数は .args に格納される
     ...     print(inst)          # __str__ は args を直接出力しますが、
     ...                          # 例外のサブクラスで上書きされる場合もあります
     ...     x, y = inst.args     # args をアンパックする
     ...     print('x =', x)
     ...     print('y =', y)
     ...
     <class 'Exception'>
     ('spam', 'eggs')
     ('spam', 'eggs')
     x = spam
     y = eggs

例外の *note __str__(): 830. 出力は、処理されない例外のメッセージ末尾
('詳細') として表示されます。

*note BaseException: 7d6. はすべての例外に共通する基底クラスです。そのサ
ブクラスの一つである *note Exception: bcd. は、致命的でない例外すべての
基底クラスです。 *note Exception: bcd. のサブクラスではない例外は、一般
的にプログラムが終了することを示すために使われているため処理されません。
例えば、*note sys.exit(): 277. によって送出される *note SystemExit: f3c.
や、ユーザーがプログラムを中断させたいときに送出される *note
KeyboardInterrupt: bc5. があります。

*note Exception: bcd. はほぼすべての例外を捕捉するワイルドカードとして使
えます。しかし良い例外処理の手法とは、処理対象の例外の型をできる限り詳細
に書き、予期しない例外はそのまま伝わるようにすることです。

*note Exception: bcd. に対する最も一般的な例外処理のパターンでは、例外を
表示あるいはログ出力してから再度送出します(呼び出し側でも例外を処理でき
るようにします):

     import sys

     try:
         f = open('myfile.txt')
         s = f.readline()
         i = int(s.strip())
     except OSError as err:
         print("OSエラー:", err)
     except ValueError:
         print("データを整数に変換できません。")
     except Exception as err:
         print(f"予期せぬエラー {err=}, {type(err)=}")
         raise

*note try: 8f8. ...  *note except: 1ab. 文には、オプションで 'else 節
(else clause)' を設けることができます。 *note else: 17c. 節を設ける場合
、全ての *note except: 1ab. 節よりも後ろに置かなければなりません。 *note
else: 17c. 節は 'try 節' で全く例外が送出されなかったときに実行されるコ
ードを書くのに役立ちます。例えば次のようにします:

     for arg in sys.argv[1:]:
         try:
             f = open(arg, 'r')
         except OSError:
             print(arg, 'が開けません')
         else:
             print(arg, 'は', len(f.readlines()), '行です')
             f.close()

追加のコードを付け加えるのは *note try: 8f8. 節よりも ‘else’ 節の方がよ
いでしょう。 なぜなら、そうすることで ‘try’ ...  ‘except’ 文で保護された
コードから送出されたもの以外の例外を過って捕捉してしまうという事態を避け
られるからです。

例外ハンドラは、'try 節' の直接内側で発生した例外を処理するだけではなく
その 'try 節' から (たとえ間接的にでも) 呼び出された関数の内部で発生した
例外も処理します。例えば:

     >>> def this_fails():
     ...     x = 1/0
     ...
     >>> try:
     ...     this_fails()
     ... except ZeroDivisionError as err:
     ...     print('実行時エラーを処理:', err)
     ...
     実行時エラーを処理: division by zero


File: python.info,  Node: 例外を送出する,  Next: 例外の連鎖,  Prev: 例外を処理する,  Up: エラーと例外

2.8.4 例外を送出する
--------------------

*note raise: 803. 文を使って、特定の例外を発生させることができます。例え
ば:

     >>> raise NameError('HiThere')
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
         raise NameError('HiThere')
     NameError: HiThere

*note raise: 803. の唯一の引数は送出される例外を指し示します。 これは例
外インスタンスか例外クラス(*note BaseException: 7d6. を継承したクラス、
たとえば *note Exception: bcd. やそのサブクラス)でなければなりません。 例
外クラスが渡された場合は、引数無しのコンストラクタが呼び出され、暗黙的に
インスタンス化されます:

     raise ValueError  # 'raise ValueError()' の省略記法

例外が発生したかどうかを判定したいだけで、その例外を処理するつもりがなけ
れば、単純な形式の *note raise: 803. 文を使って例外を再送出させることが
できます:

     >>> try:
     ...     raise NameError('HiThere')
     ... except NameError:
     ...     print('例外が通り過ぎました!')
     ...     raise
     ...
     例外が通り過ぎました!
     Traceback (most recent call last):
       File "<stdin>", line 2, in <module>
         raise NameError('HiThere')
     NameError: HiThere


File: python.info,  Node: 例外の連鎖,  Next: ユーザー定義例外,  Prev: 例外を送出する,  Up: エラーと例外

2.8.5 例外の連鎖
----------------

*note except: 1ab. 節の中で未処理の例外が発生した場合、その未処理の例外
は処理された例外のエラーメッセージに含まれます:

     >>> try:
     ...     open("database.sqlite")
     ... except OSError:
     ...     raise RuntimeError("unable to handle error")
     ...
     Traceback (most recent call last):
       File "<stdin>", line 2, in <module>
         open("database.sqlite")
         ~~~~^^^^^^^^^^^^^^^^^^^
     FileNotFoundError: [Errno 2] No such file or directory: 'database.sqlite'

     During handling of the above exception, another exception occurred:

     Traceback (most recent call last):
       File "<stdin>", line 4, in <module>
         raise RuntimeError("unable to handle error")
     RuntimeError: unable to handle error

ある例外が他の例外から直接影響されていることを示すために、*note raise:
803. 文にオプションの *note from: 803. 句を指定します:

     # exc must be exception instance or None.
     raise RuntimeError from exc

これは例外を変換するときに便利です。例えば:

     >>> def func():
     ...     raise ConnectionError
     ...
     >>> try:
     ...     func()
     ... except ConnectionError as exc:
     ...     raise RuntimeError('Failed to open database') from exc
     ...
     Traceback (most recent call last):
       File "<stdin>", line 2, in <module>
         func()
         ~~~~^^
       File "<stdin>", line 2, in func
     ConnectionError

     The above exception was the direct cause of the following exception:

     Traceback (most recent call last):
       File "<stdin>", line 4, in <module>
         raise RuntimeError('Failed to open database') from exc
     RuntimeError: Failed to open database

また、自動的な例外の連鎖を無効にするには ‘from None’ を指定します。

     >>> try:
     ...     open('database.sqlite')
     ... except OSError:
     ...     raise RuntimeError from None
     ...
     Traceback (most recent call last):
       File "<stdin>", line 4, in <module>
         raise RuntimeError from None
     RuntimeError

例外の連鎖の仕組みに関して、詳しくは *note 組み込み例外: 1c27. を参照し
てください。


File: python.info,  Node: ユーザー定義例外,  Next: クリーンアップ動作を定義する,  Prev: 例外の連鎖,  Up: エラーと例外

2.8.6 ユーザー定義例外
----------------------

プログラム上で新しい例外クラスを作成することで、独自の例外を指定すること
ができます (Python のクラスについては *note クラス: 2001. 参照)。例外は
、典型的に *note Exception: bcd. クラスから、直接または間接的に派生した
ものです。

例外クラスでは、普通のクラスができることなら何でも定義することができます
が、通常は単純なものにしておきます。大抵は、いくつかの属性だけを提供し、
例外が発生したときにハンドラがエラーに関する情報を取り出せるようにする程
度にとどめます。

ほとんどの例外は、標準の例外の名前付けと同様に、"Error" で終わる名前で定
義されています。

多くの標準モジュールでは、モジュールで定義されている関数内で発生する可能
性のあるエラーを報告させるために、独自の例外を定義しています。


File: python.info,  Node: クリーンアップ動作を定義する,  Next: 定義済みクリーンアップ処理,  Prev: ユーザー定義例外,  Up: エラーと例外

2.8.7 クリーンアップ動作を定義する
----------------------------------

*note try: 8f8. 文にはもう一つオプションの節があります。この節はクリーン
アップ動作を定義するためのもので、どんな状況でも必ず実行されます。例を示
します:

     >>> try:
     ...     raise KeyboardInterrupt
     ... finally:
     ...     print('Goodbye, world!')
     ...
     Goodbye, world!
     Traceback (most recent call last):
       File "<stdin>", line 2, in <module>
         raise KeyboardInterrupt
     KeyboardInterrupt

もし *note finally: 1b0. 節がある場合、 *note try: 8f8. 文が終わる前の最
後の処理を、 ‘finally’ 節が実行します。 ‘try’ 文が例外を発生させるか否か
に関わらず、 ‘finally’ 節は実行されます。以下では、例外が発生するという
更に複雑なケースを議論します:

   * もし ‘try’ 文の実行中に例外が発生したら、その例外は *note except:
     1ab. 節によって処理されるでしょう。もしその例外が ‘except’ 節によっ
     て処理されなければ、 ‘finally’ 節が実行された後に、その例外が再送出
     されます。

   * ‘except’ 節または ‘else’ 節の実行中に例外が発生することがあり得ます
     。その場合も、 ‘finally’ 節が実行された後に例外が再送出されます。

   * If the ‘finally’ clause executes a *note break: 17f, *note
     continue: 180. or *note return: 1af. statement, exceptions are not
     re-raised.  This can be confusing and is therefore discouraged.
     From version 3.14 the compiler emits a *note SyntaxWarning: 1ae.
     for it (see PEP 765(1)).

   * もし ‘try’ 文が *note break: 17f. 文、 *note continue: 180. 文また
     は *note return: 1af. 文のいずれかに達すると、その ‘break’ 文、
     ‘continue’ 文または ‘return’ 文の実行の直前に ‘finally’ 節が実行さ
     れます。

   * If a ‘finally’ clause includes a ‘return’ statement, the returned
     value will be the one from the ‘finally’ clause's ‘return’
     statement, not the value from the ‘try’ clause's ‘return’
     statement.  This can be confusing and is therefore discouraged.
     From version 3.14 the compiler emits a *note SyntaxWarning: 1ae.
     for it (see PEP 765(2)).

例えば:

     >>> def bool_return():
     ...     try:
     ...         return True
     ...     finally:
     ...         return False
     ...
     >>> bool_return()
     False

より複雑な例:

     >>> def divide(x, y):
     ...     try:
     ...         result = x / y
     ...     except ZeroDivisionError:
     ...         print("division by zero!")
     ...     else:
     ...         print("result is", result)
     ...     finally:
     ...         print("executing finally clause")
     ...
     >>> divide(2, 1)
     result is 2.0
     executing finally clause
     >>> divide(2, 0)
     division by zero!
     executing finally clause
     >>> divide("2", "1")
     executing finally clause
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
         divide("2", "1")
         ~~~~~~^^^^^^^^^^
       File "<stdin>", line 3, in divide
         result = x / y
                  ~~^~~
     TypeError: unsupported operand type(s) for /: 'str' and 'str'

見てわかるとおり、 *note finally: 1b0. 節はどの場合にも実行されています
。 文字列で割り算をすることで発生した *note TypeError: 198. は *note
except: 1ab. 節で処理されていないので、 ‘finally’ 節実行後に再度送出され
ています。

実世界のアプリケーションでは、 *note finally: 1b0. 節は(ファイルやネット
ワーク接続などの)外部リソースを、利用が成功したかどうかにかかわらず解放
するために便利です。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0765/

   (2) https://peps.python.org/pep-0765/


File: python.info,  Node: 定義済みクリーンアップ処理,  Next: 複数の関連しない例外の送出と処理,  Prev: クリーンアップ動作を定義する,  Up: エラーと例外

2.8.8 定義済みクリーンアップ処理
--------------------------------

オブジェクトのなかには、その利用の成否にかかわらず、不要になった際に実行
される標準的なクリーンアップ処理が定義されているものがあります。以下の、
ファイルをオープンして内容を画面に表示する例をみてください。

     for line in open("myfile.txt"):
         print(line, end="")

このコードの問題点は、コードの実行が終わった後に不定の時間ファイルを開い
たままでいることです。これは単純なスクリプトでは問題になりませんが、大き
なアプリケーションでは問題になりえます。 *note with: 186. 文はファイルの
ようなオブジェクトが常に、即座に正しくクリーンアップされることを保証しま
す。

     with open("myfile.txt") as f:
         for line in f:
             print(line, end="")

この文が実行されたあとで、たとえ行の処理中に問題があったとしても、ファイ
ル 'f' は常に close されます。ファイルなどの、定義済みクリーンアップ処理
を持つオブジェクトについては、それぞれのドキュメントで示されます。


File: python.info,  Node: 複数の関連しない例外の送出と処理,  Next: ノートによって例外を充実させる,  Prev: 定義済みクリーンアップ処理,  Up: エラーと例外

2.8.9 複数の関連しない例外の送出と処理
--------------------------------------

いくつか発生した例外の報告が必要な状況があります。並列処理のフレームワー
クでは、複数のタスクが平行して失敗することがたびたびあります。他にも最初
の例外を送出するよりも、処理を継続して複数の例外を集約した方が望ましいユ
ースケースもあります。

組み込みの *note ExceptionGroup: 4d2. は例外インスタンスのリストをまとめ
、同時に送出できるようにします。ExceptionGroupも例外なので、他の例外と同
じように捕捉できます。:

     >>> def f():
     ...     excs = [OSError('error 1'), SystemError('error 2')]
     ...     raise ExceptionGroup('there were problems', excs)
     ...
     >>> f()
       + Exception Group Traceback (most recent call last):
       |   File "<stdin>", line 1, in <module>
       |     f()
       |     ~^^
       |   File "<stdin>", line 3, in f
       |     raise ExceptionGroup('there were problems', excs)
       | ExceptionGroup: there were problems (2 sub-exceptions)
       +-+---------------- 1 ----------------
         | OSError: error 1
         +---------------- 2 ----------------
         | SystemError: error 2
         +------------------------------------
     >>> try:
     ...     f()
     ... except Exception as e:
     ...     print(f'caught {type(e)}: e')
     ...
     caught <class 'ExceptionGroup'>: e
     >>>

‘except’ の代わりに ‘except*’ を使用すると、グループの中にある特定の型に
一致した例外だけを選択して処理できます。以下の例では、ネストした例外グル
ープに対して各 ‘except*’ 節で特定の型の例外を取り出し、それ以外の例外は
他の節に伝えられ、最終的に例外が送出されます。:

     >>> def f():
     ...     raise ExceptionGroup(
     ...         "group1",
     ...         [
     ...             OSError(1),
     ...             SystemError(2),
     ...             ExceptionGroup(
     ...                 "group2",
     ...                 [
     ...                     OSError(3),
     ...                     RecursionError(4)
     ...                 ]
     ...             )
     ...         ]
     ...     )
     ...
     >>> try:
     ...     f()
     ... except* OSError as e:
     ...     print("There were OSErrors")
     ... except* SystemError as e:
     ...     print("There were SystemErrors")
     ...
     There were OSErrors
     There were SystemErrors
       + Exception Group Traceback (most recent call last):
       |   File "<stdin>", line 2, in <module>
       |     f()
       |     ~^^
       |   File "<stdin>", line 2, in f
       |     raise ExceptionGroup(
       |     ...<12 lines>...
       |     )
       | ExceptionGroup: group1 (1 sub-exception)
       +-+---------------- 1 ----------------
         | ExceptionGroup: group2 (1 sub-exception)
         +-+---------------- 1 ----------------
           | RecursionError: 4
           +------------------------------------
     >>>

例外グループの中に含める例外は、型ではなくインスタンスである必要があるこ
とに注意してください。これは一般的に、以下のパターンようにプログラムで送
出された複数の例外を捕捉することが多いためです。:

     >>> excs = []
     ... for test in tests:
     ...     try:
     ...         test.run()
     ...     except Exception as e:
     ...         excs.append(e)
     ...
     >>> if excs:
     ...    raise ExceptionGroup("Test Failures", excs)
     ...


File: python.info,  Node: ノートによって例外を充実させる,  Prev: 複数の関連しない例外の送出と処理,  Up: エラーと例外

2.8.10 ノートによって例外を充実させる
-------------------------------------

例外を送出するために生成するときに、通常は発生したエラーを説明する情報で
初期化されます。例外を受け取ったあとに情報を追加すると便利な場合がありま
す。この目的のために、例外は ‘add_note(note)’ メソッドを持ちます。このメ
ソッドは文字列を受け取り、例外のノートのリストに追加します。標準のトレー
スバックでは例外の後に、全てのノートが追加した順番に出力されます。:

     >>> try:
     ...     raise TypeError('bad type')
     ... except Exception as e:
     ...     e.add_note('Add some information')
     ...     e.add_note('Add some more information')
     ...     raise
     ...
     Traceback (most recent call last):
       File "<stdin>", line 2, in <module>
         raise TypeError('bad type')
     TypeError: bad type
     Add some information
     Add some more information
     >>>

たとえば、複数の例外を1つの例外グループにまとめるときに、各エラーのコン
テキスト情報を追加したい場合があります。以下のグループ内の各例外が持つノ
ートは、エラーがいつ発生したかを示しています。:

     >>> def f():
     ...     raise OSError('operation failed')
     ...
     >>> excs = []
     >>> for i in range(3):
     ...     try:
     ...         f()
     ...     except Exception as e:
     ...         e.add_note(f'Happened in Iteration {i+1}')
     ...         excs.append(e)
     ...
     >>> raise ExceptionGroup('We have some problems', excs)
       + Exception Group Traceback (most recent call last):
       |   File "<stdin>", line 1, in <module>
       |     raise ExceptionGroup('We have some problems', excs)
       | ExceptionGroup: We have some problems (3 sub-exceptions)
       +-+---------------- 1 ----------------
         | Traceback (most recent call last):
         |   File "<stdin>", line 3, in <module>
         |     f()
         |     ~^^
         |   File "<stdin>", line 2, in f
         |     raise OSError('operation failed')
         | OSError: operation failed
         | Happened in Iteration 1
         +---------------- 2 ----------------
         | Traceback (most recent call last):
         |   File "<stdin>", line 3, in <module>
         |     f()
         |     ~^^
         |   File "<stdin>", line 2, in f
         |     raise OSError('operation failed')
         | OSError: operation failed
         | Happened in Iteration 2
         +---------------- 3 ----------------
         | Traceback (most recent call last):
         |   File "<stdin>", line 3, in <module>
         |     f()
         |     ~^^
         |   File "<stdin>", line 2, in f
         |     raise OSError('operation failed')
         | OSError: operation failed
         | Happened in Iteration 3
         +------------------------------------
     >>>


File: python.info,  Node: クラス,  Next: 標準ライブラリミニツアー,  Prev: エラーと例外,  Up: Python チュートリアル

2.9 クラス
==========

クラスはデータと機能を組み合わせる方法を提供します。 新規にクラスを作成
することで、新しいオブジェクトの '型' を作成し、その型を持つ新しい 'イン
スタンス' が作れます。 クラスのそれぞれのインスタンスは自身の状態を保持
する属性を持てます。 クラスのインスタンスは、その状態を変更するための (そ
のクラスが定義する) メソッドも持てます。

Python は、他のプログラミング言語と比較して、最小限の構文と意味付けを使
ってクラスを言語に追加しています。Python のクラスは、C++ と Modula-3 の
クラスメカニズムを混ぜたものです。Python のクラス機構はオブジェクト指向
プログラミングの標準的な機能を全て提供しています。クラスの継承メカニズム
は、複数の基底クラスを持つことができ、派生クラスで基底クラスの任意のメソ
ッドをオーバライドすることができます。メソッドでは、基底クラスのメソッド
を同じ名前で呼び出すことができます。オブジェクトには任意の種類と数のデー
タを格納することができます。モジュールと同じく、クラス機構も Python の動
的な性質に従うように設計されています。クラスは実行時に生成され、生成後に
変更することができます。

C++ の用語で言えば、通常のクラスメンバ (データメンバも含む) は (*note
プライベート変数: 2089. に書かれている例外を除いて) 'public' であり、メ
ンバ関数はすべて '仮想関数(virtual)' です。 Modula-3 にあるような、オブ
ジェクトのメンバをメソッドから参照するための短縮した記法は使えません: メ
ソッド関数の宣言では、オブジェクト自体を表す第一引数を明示しなければなり
ません。第一引数のオブジェクトはメソッド呼び出しの際に暗黙の引数として渡
されます。 Smalltalk に似て、クラスはそれ自体がオブジェクトです。そのた
め、 import や名前変更といった操作が可能です。 C++ や Modula-3 と違って
、ユーザーは組込み型を基底クラスにして拡張を行えます。また、C++ とは同じ
で Modula-3 とは違う点として、特別な構文を伴うほとんどの組み込み演算子
(算術演算子 (arithmetic operator) や添字表記) はクラスインスタンスで使う
ために再定義できます。

(クラスに関して普遍的な用語定義がないので、 Smalltalk と C++ の用語を場
合に応じて使っていくことにします。 C++ よりも Modula-3 の方がオブジェク
ト指向の意味論が Python に近いので、 Modula-3 の用語を使いたいのですが、
ほとんどの読者は Modula-3 についてしらないでしょうから。)

* Menu:

* 名前とオブジェクトについて::
* Python のスコープと名前空間::
* クラス初見::
* いろいろな注意点::
* 継承::
* プライベート変数::
* 残りのはしばし::
* イテレータ (iterator): イテレータ iterator.
* ジェネレータ (generator): ジェネレータ generator.
* ジェネレータ式::


File: python.info,  Node: 名前とオブジェクトについて,  Next: Python のスコープと名前空間,  Up: クラス

2.9.1 名前とオブジェクトについて
--------------------------------

オブジェクトには個体性があり、同一のオブジェクトに(複数のスコープから) 複
数の名前を割り当てることができます。この機能は他の言語では別名づけ
(alias) として知られています。 Python を一見しただけでは、別名づけの重要
性は分からないことが多く、変更不能な基本型 (数値、文字列、タプル)を扱う
ときには無視して差し支えありません。しかしながら、別名付けは、リストや辞
書や他の多くの型など、変更可能な型を扱う Python コード上で驚くべき効果が
あります。別名付けはいくつかの点でポインタのように振舞い、このことは通常
はプログラムに利するように使われます。例えば、オブジェクトの受け渡しは、
実装上はポインタが渡されるだけなのでコストの低い操作になります。また、関
数があるオブジェクトを引数として渡されたとき、関数の呼び出し側からオブジ
ェクトに対する変更を見ることができます -- これにより、 Pascal にあるよう
な二つの引数渡し機構をもつ必要をなくしています。


File: python.info,  Node: Python のスコープと名前空間,  Next: クラス初見,  Prev: 名前とオブジェクトについて,  Up: クラス

2.9.2 Python のスコープと名前空間
---------------------------------

クラスを紹介する前に、Python のスコープのルールについてあることを話して
おかなければなりません。クラス定義は巧みなトリックを名前空間に施すので、
何が起こっているのかを完全に理解するには、スコープと名前空間がどのように
動作するかを理解する必要があります。ちなみに、この問題に関する知識は全て
の Python プログラマにとって有用です。

まず定義から始めましょう。

'名前空間 (namespace)' とは、名前からオブジェクトへの対応付け (mapping)
です。ほとんどの名前空間は、現状では Python の辞書として実装されています
が、そのことは通常は (パフォーマンス以外では) 目立つことはないし、将来は
変更されるかもしれません。名前空間の例には、組込み名の集合 (*note abs():
208d. 等の関数や組込み例外名)、モジュール内のグローバルな名前、関数を呼
び出したときのローカルな名前があります。オブジェクトの属性からなる集合も
また、ある意味では名前空間です。名前空間について知っておくべき重要なこと
は、異なった名前空間にある名前の間には全く関係がないということです。例え
ば、二つの別々のモジュールの両方で関数 ‘maximize’ という関数を定義するこ
とができ、定義自体は混同されることはありません -- モジュールのユーザは名
前の前にモジュール名をつけなければなりません。

ところで、 '属性' という言葉は、ドットに続く名前すべてに対して使っていま
す -- 例えば式 ‘z.real’ で、 ‘real’ はオブジェクト ‘z’ の属性です。厳密
にいえば、モジュール内の名前に対する参照は属性の参照です。式
‘modname.funcname’ では、 ‘modname’ はあるモジュールオブジェクトで、
‘funcname’ はその属性です。この場合には、モジュールの属性とモジュールの
中で定義されているグローバル名の間には、直接的な対応付けがされます。これ
らの名前は同じ名前空間を共有しているのです！ (1)

属性は読取り専用にも、書込み可能にもできます。書込み可能であれば、属性に
代入することができます。モジュール属性は書込み可能で、
‘modname.the_answer = 42’ と書くことができます。書込み可能な属性は、
*note del: 1b1f. 文で削除することもできます。例えば、 ‘del
modname.the_answer’ は、 ‘modname’ で指定されたオブジェクトから属性
‘the_answer’ を除去します。

名前空間は様々な時点で作成され、その寿命も様々です。組み込みの名前が入っ
た名前空間は Python インタプリタが起動するときに作成され、決して削除され
ることはありません。モジュールのグローバルな名前空間は、モジュール定義が
読み込まれたときに作成されます。通常、モジュールの名前空間は、インタプリ
タが終了するまで残ります。インタプリタのトップレベルで実行された文は、ス
クリプトファイルから読み出されたものでも対話的に読み出されたものでも、
*note __main__: 1. という名前のモジュールの一部分であるとみなされるので
、独自の名前空間を持つことになります。 (組み込みの名前は実際にはモジュー
ル内に存在します。そのモジュールは *note builtins: 13. と呼ばれています
。)

関数のローカルな名前空間は、関数が呼び出されたときに作成され、関数から戻
ったときや、関数内で例外が送出され、かつ関数内で処理されなかった場合に削
除されます。 (実際には、忘れられる、と言ったほうが起きていることをよく表
しています。) もちろん、再帰呼出しのときには、各々の呼び出しで各自のロー
カルな名前空間があります。

'スコープ (scope)' とは、ある名前空間が直接アクセスできるような、 Python
プログラムのテキスト上の領域です。 "直接アクセス可能" とは、修飾なしに
(訳注: ‘spam.egg’ ではなく単に ‘egg’ のように) 名前を参照した際に、その
名前空間から名前を見つけようと試みることを意味します。

スコープは静的に決定されますが、動的に使用されます。実行中はいつでも、直
接名前空間にアクセス可能な、3つまたは4つの入れ子になったスコープがありま
す:

   * 最初に探される、最も内側のスコープは、ローカルな名前を持っています
     。

   * 外側の(enclosing)関数のスコープは、近いほうから順に探され、ローカル
     でもグローバルでもない名前を持っています。

   * 次のスコープは、現在のモジュールのグローバルな名前を持っています。

   * 一番外側の(最後に検索される)スコープはビルトイン名を持っています。

名前が global と宣言されている場合、その名前に対する参照や代入は全て、モ
ジュールのグローバルな名前の入った最後から2番目のスコープに対して直接行
われます。最内スコープの外側にある変数に再束縛するには、 *note nonlocal:
14bf. 文が使えます。nonlocal と宣言されなかった変数は、全て読み出し専用
となります (そのような変数に対する書き込みは、単に '新しい' ローカル変数
をもっとも内側のスコープで作成し、外部のスコープの値は変化しません)。

通常、ローカルスコープは (プログラムテキスト上の) 現在の関数のローカルな
名前を参照します。関数の外側では、ローカルスコープはグローバルな名前空間
と同じ名前空間、モジュールの名前空間を参照します。クラス定義では、ローカ
ルスコープの中にもう一つ名前空間が置かれます。

スコープはテキスト上で決定されていると理解することが重要です。モジュール
内で定義される関数のグローバルなスコープは、関数がどこから呼び出されても
、どんな別名をつけて呼び出されても、そのモジュールの名前空間になります。
反対に、実際の名前の検索は実行時に動的に行われます -- とはいえ、言語の定
義は、"コンパイル" 時の静的な名前解決の方向に進化しているので、動的な名
前解決に頼ってはいけません！ (事実、ローカルな変数は既に静的に決定されて
います。)

Python の特徴として、*note global: 4ac. や *note nonlocal: 14bf. 文が有
効でない場合は、名前に対する参照は常に最も内側のスコープに対して有効にな
ります。 代入はデータをコピーしません。オブジェクトを名前に束縛するだけ
です。削除も同様で、‘del x’ は、ローカルスコープの名前空間から ‘x’ に対
する拘束を取り除きます。 つまるところ、新しい名前を与えるようなすべての
操作は、ローカルスコープを使って行われます。 *note import: 7f8. 文、関数
の定義は、モジュールや関数名をローカルスコープの名前に拘束します。

*note global: 4ac. 文を使うと、特定の変数がグローバルスコープに存在し、
そこで再束縛されることを指示できます。 *note nonlocal: 14bf. 文は、特定
の変数が外側のスコープに存在し、そこで再束縛されることを指示します。

* Menu:

* スコープと名前空間の例::

   ---------- Footnotes ----------

   (1) 例外が一つあります。モジュールオブジェクトには、秘密の読取り専用
の属性 *note __dict__: 77d. があり、モジュールの名前空間を実装するために
使われている辞書を返します; ‘__dict__’ という名前は属性ですが、グローバ
ルな名前ではありません。この属性を利用すると名前空間の実装に対する抽象化
を侵すことになるので、プログラムを検死するデバッガのような用途に限るべき
です。


File: python.info,  Node: スコープと名前空間の例,  Up: Python のスコープと名前空間

2.9.2.1 スコープと名前空間の例
..............................

異なるスコープと名前空間がどのように参照されるか、また *note global:
4ac. および *note nonlocal: 14bf. が変数の束縛にどう影響するか、この例で
実演します:

     def scope_test():
         def do_local():
             spam = "local spam"

         def do_nonlocal():
             nonlocal spam
             spam = "nonlocal spam"

         def do_global():
             global spam
             spam = "global spam"

         spam = "test spam"
         do_local()
         print("After local assignment:", spam)
         do_nonlocal()
         print("After nonlocal assignment:", spam)
         do_global()
         print("After global assignment:", spam)

     scope_test()
     print("In global scope:", spam)

このコード例の出力は:

     After local assignment: test spam
     After nonlocal assignment: nonlocal spam
     After global assignment: nonlocal spam
     In global scope: global spam

このとおり、(デフォルトの) 'ローカルな' 代入は 'scope_test' 上の 'spam'
への束縛を変更しませんでした。 *note nonlocal: 14bf. 代入は 'scope_test'
上の 'spam' への束縛を変更し、 *note global: 4ac. 代入はモジュールレベル
の束縛を変更しました。

またここから、 *note global: 4ac. 代入の前には 'spam' に何も束縛されてい
なかったことも分かります。


File: python.info,  Node: クラス初見,  Next: いろいろな注意点,  Prev: Python のスコープと名前空間,  Up: クラス

2.9.3 クラス初見
----------------

クラスでは、新しい構文を少しと、三つの新たなオブジェクト型、そして新たな
意味付けをいくつか取り入れています。

* Menu:

* クラス定義の構文::
* クラスオブジェクト::
* インスタンスオブジェクト::
* メソッドオブジェクト::
* クラスとインスタンス変数::


File: python.info,  Node: クラス定義の構文,  Next: クラスオブジェクト,  Up: クラス初見

2.9.3.1 クラス定義の構文
........................

クラス定義の最も単純な形式は、次のようになります:

     class ClassName:
         <statement-1>
         .
         .
         .
         <statement-N>

関数定義 (*note def: 1673. 文) と同様、クラス定義が効果をもつにはまず実
行しなければなりません。 (クラス定義を *note if: 181. 文の分岐先や関数内
部に置くことも、考え方としてはありえます。)

実際には、クラス定義の内側にある文は、通常は関数定義になりますが、他の文
を書くこともでき、それが役に立つこともあります -- これについては後で述べ
ます。クラス内の関数定義は通常、メソッドの呼び出し規約で決められた独特の
形式の引数リストを持ちます -- これについても後で述べます。

クラス定義に入ると、新たな名前空間が作成され、ローカルな名前空間として使
われます -- 従って、ローカルな変数に対する全ての代入はこの新たな名前空間
に入ります。特に、関数定義を行うと、新たな関数の名前はこの名前空間に結び
付けられます。

クラス定義から普通に (定義の終端に到達して) 抜けると、 'クラスオブジェク
ト (class object)' が生成されます。クラスオブジェクトは、基本的にはクラ
ス定義で作成された名前空間の内容をくるむラッパー (wrapper) です。クラス
オブジェクトについては次の節で詳しく学ぶことにします。 (クラス定義に入る
前に有効だった) 元のローカルスコープが復帰し、生成されたクラスオブジェク
トは復帰したローカルスコープにクラス定義のヘッダで指定した名前 (上の例で
は ‘ClassName’) で結び付けられます。


File: python.info,  Node: クラスオブジェクト,  Next: インスタンスオブジェクト,  Prev: クラス定義の構文,  Up: クラス初見

2.9.3.2 クラスオブジェクト
..........................

クラスオブジェクトでは２種類の演算、属性参照とインスタンス生成をサポート
しています。

'属性参照 (attribute reference)' は、Python におけるすべての属性参照で使
われている標準的な構文、 ‘obj.name’ を使います。クラスオブジェクトが生成
された際にクラスの名前空間にあった名前すべてが有効な属性名です。従って、
以下のようなクラス定義では:

     class MyClass:
         """A simple example class"""
         i = 12345

         def f(self):
             return 'hello world'

‘MyClass.i’ と ‘MyClass.f’ は有効な属性参照であり、それぞれ整数と関数オ
ブジェクトを返します。クラス属性も代入できるため、代入により ‘MyClass.i’
の値を変えられます。 *note __doc__: 2095. も有効な属性で、そのクラスに属
しているドキュメンテーション文字列(docstring) 、この場合は ‘"A simple
example class"’ を返します。

クラスの 'インスタンス化 (instantiation)' には関数記法を使います。クラス
オブジェクトのことを、クラスの新しいインスタンスを返す、引数のない関数の
ように扱ってください。上記クラスで例示すると:

     x = MyClass()

は、クラスの新しい 'インスタンス (instance)' を生成し、そのオブジェクト
をローカル変数 ‘x’ へ代入します。

インスタンス化操作 (クラスオブジェクトの "呼出し") では、空のオブジェク
トが作られます。多くのクラスでは、特定の初期状態にカスタマイズされたオブ
ジェクトを作りたいです。そのために、クラスには *note __init__(): 8bf. と
いう名前の特殊メソッドを定義できます。例えば次のようにします:

     def __init__(self):
         self.data = []

クラスが *note __init__(): 8bf. メソッドを定義している場合、クラスをイン
スタンス化すると、新しく作られたクラスインスタンスに対して自動的に
‘__init__()’ を呼び出します。 従って この例では、新たな初期済みインスタ
ンスを次のようにして得られます:

     x = MyClass()

もちろん、より大きな柔軟性を持たせるために、 *note __init__(): 8bf. メソ
ッドに複数の引数をもたせることができます。その場合、次の例のように、クラ
スのインスタンス化操作に渡された引数は ‘__init__()’ に渡されます。例えば
、

     >>> class Complex:
     ...     def __init__(self, realpart, imagpart):
     ...         self.r = realpart
     ...         self.i = imagpart
     ...
     >>> x = Complex(3.0, -4.5)
     >>> x.r, x.i
     (3.0, -4.5)


File: python.info,  Node: インスタンスオブジェクト,  Next: メソッドオブジェクト,  Prev: クラスオブジェクト,  Up: クラス初見

2.9.3.3 インスタンスオブジェクト
................................

ところで、インスタンスオブジェクトを使うと何ができるのでしょうか？インス
タンスオブジェクトが理解できる唯一の操作は、属性の参照です。有効な属性名
には (データ属性およびメソッドの) 二種類あります。

'データ属性 (Data attribute)' は、 Smalltalk の "インスタンス変数" や
C++の "データメンバ" に相当します。データ属性を宣言する必要はありません
。ローカル変数と同様に、これらの属性は最初に代入された時点で湧き出てきま
す。例えば、上で生成した ‘MyClass’ のインスタンス ‘x’ に対して、次のコー
ドを実行すると、跡を残さず値 ‘16’ を印字します:

     x.counter = 1
     while x.counter < 10:
         x.counter = x.counter * 2
     print(x.counter)
     del x.counter

もう一つのインスタンス属性の参照は、 'メソッド' です。メソッドとは、オブ
ジェクトに "属する" 関数のことです。

インスタンスオブジェクトで有効なメソッド名は、そのクラスによります。定義
により、クラスの全ての関数オブジェクトである属性がインスタンスオブジェク
トの妥当なメソッド名に決まります。従って、例では、‘MyClass.f’ は関数なの
で、‘x.f’ はメソッドの参照として有効です。しかし、‘MyClass.i’ は関数では
ないので、‘x.i’ はメソッドの参照として有効ではありません。‘x.f’ は
‘MyClass.f’ と同じものではありません -- 関数オブジェクトではなく、'メソ
ッドオブジェクト (method object)' です。


File: python.info,  Node: メソッドオブジェクト,  Next: クラスとインスタンス変数,  Prev: インスタンスオブジェクト,  Up: クラス初見

2.9.3.4 メソッドオブジェクト
............................

普通、メソッドはバインドされた直後に呼び出されます:

     x.f()

もし ‘x = MyClass()’ であれば、上記のコードは文字列 ‘'hello world'’ を返
すでしょう。しかしながら、必ずしもメソッドをその場で呼び出さなければなら
ないわけではありません。 ‘x.f’ はメソッドオブジェクトであり、どこかに記
憶しておいて後で呼び出すことができます。例えば次のコードは:

     xf = x.f
     while True:
         print(xf())

‘hello world’ を時が終わるまで印字し続けるでしょう。

メソッドが呼び出されるときには実際には何が起きているのでしょうか？ ‘f()’
の関数定義では引数を一つ指定していたにもかかわらず、上の例では ‘x.f()’ が
引数なしで呼び出されています。引数はどうなったのでしょうか？たしか、引数
が必要な関数を引数無しで呼び出すと、 Python が例外を送出するはずです --
たとえその引数が実際には使われなくても…。

もう答は想像できているかもしれませんね: メソッドについて特別なこととして
、インスタンスオブジェクトが関数の第1引数として渡されます。 例では、
‘x.f()’ という呼び出しは、 ‘MyClass.f(x)’ と厳密に等価なものです。 一般
に、 'n' 個の引数リストもったメソッドの呼出しは、そのメソッドのインスタ
ンスオブジェクトを最初の引数の前に挿入した引数リストで、メソッドに対応す
る関数を呼び出すことと等価です。

一般的に、メソッドは以下のように動作します。インスタンスの非データ属性が
参照されたときは、そのインスタンスのクラスが検索されます。その名前が有効
なクラス属性を表している関数オブジェクトなら、インスタンスオブジェクトと
関数オブジェクトの両方への参照がメソッドオブジェクトにパックされます。メ
ソッドオブジェクトが引数リストと共に呼び出されるとき、インスタンスオブジ
ェクトと渡された引数リストから新しい引数リストを作成して、元の関数オブジ
ェクトを新しい引数リストで呼び出します。


File: python.info,  Node: クラスとインスタンス変数,  Prev: メソッドオブジェクト,  Up: クラス初見

2.9.3.5 クラスとインスタンス変数
................................

一般的に、インスタンス変数はそれぞれのインスタンスについて固有のデータの
ためのもので、クラス変数はそのクラスのすべてのインスタンスによって共有さ
れる属性やメソッドのためのものです:

     class Dog:

         kind = 'canine'         # 全インスタンスで共有されるクラス変数

         def __init__(self, name):
             self.name = name    # インスタンスごとに固有のインスタンス変数

     >>> d = Dog('Fido')
     >>> e = Dog('Buddy')
     >>> d.kind                  # すべての犬で共有
     'canine'
     >>> e.kind                  # すべての犬で共有
     'canine'
     >>> d.name                  # d 固有
     'Fido'
     >>> e.name                  # e 固有
     'Buddy'

As discussed in *note 名前とオブジェクトについて: 208b, shared data can
have possibly surprising effects involving *note mutable: 15ba. objects
such as lists and dictionaries.  For example, the 'tricks' list in the
following code should not be used as a class variable because just a
single list would be shared by all 'Dog' instances:

     class Dog:

         tricks = []             # クラス変数の間違った使用

         def __init__(self, name):
             self.name = name

         def add_trick(self, trick):
             self.tricks.append(trick)

     >>> d = Dog('Fido')
     >>> e = Dog('Buddy')
     >>> d.add_trick('roll over')
     >>> e.add_trick('play dead')
     >>> d.tricks                # 意図せず すべての犬で共有
     ['roll over', 'play dead']

このクラスの正しい設計ではインスタンス変数を代わりに使用するべきです:

     class Dog:

         def __init__(self, name):
             self.name = name
             self.tricks = []    # 犬ごとに新しい空リストを作る

         def add_trick(self, trick):
             self.tricks.append(trick)

     >>> d = Dog('Fido')
     >>> e = Dog('Buddy')
     >>> d.add_trick('roll over')
     >>> e.add_trick('play dead')
     >>> d.tricks
     ['roll over']
     >>> e.tricks
     ['play dead']


File: python.info,  Node: いろいろな注意点,  Next: 継承,  Prev: クラス初見,  Up: クラス

2.9.4 いろいろな注意点
----------------------

インスタンスとクラスの両方で同じ属性名が使用されている場合、属性検索はイ
ンスタンスが優先されます。

     >>> class Warehouse:
     ...    purpose = 'storage'
     ...    region = 'west'
     ...
     >>> w1 = Warehouse()
     >>> print(w1.purpose, w1.region)
     storage west
     >>> w2 = Warehouse()
     >>> w2.region = 'east'
     >>> print(w2.purpose, w2.region)
     storage east

データ属性は、メソッドから参照できると同時に、通常のオブジェクトのユーザ
("クライアント") からも参照できます。言い換えると、クラスは純粋な抽象デ
ータ型として使うことができません。実際、 Python では、データ隠蔽を補強す
るための機構はなにもありません -- データの隠蔽はすべて規約に基づいていま
す。 (逆に、C 言語で書かれた Python の実装では実装の詳細を完全に隠蔽し、
必要に応じてオブジェクトへのアクセスを制御できます。この機構は C 言語で
書かれた Python 拡張で使うことができます。)

クライアントはデータ属性を注意深く扱うべきです -- クライアントは、メソッ
ドが維持しているデータ属性の不変式を踏みにじり、台無しにするかもしれませ
ん。クライアントは、名前の衝突が回避されている限り、メソッドの有効性に影
響を及ぼすことなくインスタンスに独自の属性を追加することができる、という
ことに注意してください -- ここでも、名前付けの規約は頭痛の種を無くしてく
れます。

メソッドの中から、データ属性を (または別のメソッドも！) 参照するための短
縮された記法はありません。私は、この仕様がメソッドの可読性を高めていると
感じています。あるメソッドを眺めているときにローカルな変数とインスタンス
変数をはっきり区別できるからです。

よく、メソッドの最初の引数を ‘self’ と呼びます。この名前付けは単なる慣習
でしかありません。 ‘self’ という名前は、 Python では何ら特殊な意味を持ち
ません。とはいえ、この慣行に従わないと、コードは他の Python プログラマに
とってやや読みにくいものとなります。また、 'クラスブラウザ (class
browser)' プログラムがこの慣行をあてにして書かれているかもしれません。

クラス属性である関数オブジェクトはいずれも、そのクラスのインスタンスのた
めのメソッドを定義しています。関数定義は、テキスト上でクラス定義の中に入
っている必要はありません。関数オブジェクトをクラスのローカルな変数の中に
代入するのも OK です。例えば以下のコードのようにします:

     # クラス外で定義された関数
     def f1(self, x, y):
         return min(x, x+y)

     class C:
         f = f1

         def g(self):
             return 'hello world'

         h = g

これで、 ‘f’ 、 ‘g’ 、および ‘h’ は、すべて ‘C’ の属性であり関数オブジェ
クトを参照しています。従って、これらは、すべて ‘C’ のインスタンスのメソ
ッドとなります -- ‘h’ は ‘g’ と全く等価です。これを実践しても、大抵は単
にプログラムの読者に混乱をもたらすだけなので注意してください。

メソッドは、 ‘self’ 引数のメソッド属性を使って、他のメソッドを呼び出すこ
とができます:

     class Bag:
         def __init__(self):
             self.data = []

         def add(self, x):
             self.data.append(x)

         def addtwice(self, x):
             self.add(x)
             self.add(x)

メソッドは、通常の関数と同じようにしてグローバルな名前を参照します。ある
メソッドに関するグローバルスコープは、その定義を含むモジュールです。(ク
ラスはグローバルなスコープとして用いられることはありません。) メソッドで
グローバルなデータを使う良い理由はほとんどありませんが、グローバルなスコ
ープを使うべき場面は多々あります。一つ挙げると、メソッド内から、グローバ
ルなスコープに import された関数やモジュールや、そのモジュール中で定義さ
れた関数やクラスを使うことができます。通常、メソッドの入っているクラス自
体はグローバルなスコープ内で定義されています。次の節では、メソッドが自分
のクラスを参照する理由として正当なものを見てみましょう。

個々の値はオブジェクトなので、 'クラス' ('型' とも言います) を持っていま
す。それは ‘object.__class__’ に保持されています。


File: python.info,  Node: 継承,  Next: プライベート変数,  Prev: いろいろな注意点,  Up: クラス

2.9.5 継承
----------

言うまでもなく、継承の概念をサポートしない言語機能は "クラス" と呼ぶに値
しません。派生クラス (derived class) を定義する構文は次のようになります:

     class DerivedClassName(BaseClassName):
         <statement-1>
         .
         .
         .
         <statement-N>

基底クラス (base class) の名前 ‘BaseClassName’ は、派生クラス定義の入っ
ているスコープからアクセスできる名前空間で定義されていなければなりません
。基底クラス名のかわりに任意の式を入れることもできます。これは次の例のよ
うに、基底クラスが別モジュールで定義されているときに便利なことがあります
:

     class DerivedClassName(modname.BaseClassName):

派生クラス定義の実行は、基底クラスの場合と同じように進められます。クラス
オブジェクトが構築される時、基底クラスが記憶されます。記憶された基底クラ
スは、属性参照を解決するために使われます。要求された属性がクラスに見つか
らなかった場合、基底クラスに検索が進みます。この規則は、基底クラスが他の
何らかのクラスから派生したものであった場合、再帰的に適用されます。

派生クラスのインスタンス化では、特別なことは何もありません。
‘DerivedClassName()’ はクラスの新たなインスタンスを生成します。メソッド
の参照は次のようにして解決されます。まず対応するクラス属性が検索されます
。検索は、必要に応じ、基底クラス連鎖を下って行われ、検索の結果として何ら
かの関数オブジェクトがもたらされた場合、メソッド参照は有効なものとなりま
す。

派生クラスは基底クラスのメソッドを上書き (override) することができます。
メソッドは同じオブジェクトの別のメソッドを呼び出す際に何ら特殊な権限を持
ちません。このため、ある基底クラスのメソッドが、同じ基底クラスで定義され
ているもう一つのメソッド呼び出しを行っている場合、派生クラスで上書きされ
た何らかのメソッドが呼び出されることになるかもしれません。 (C++ プログラ
マへ: Python では、すべてのメソッドは事実上 ‘virtual’ です。)

派生クラスで上書きしているメソッドでは、基底クラスの同名のメソッドを置き
換えるのではなく、拡張したいのかもしれません。基底クラスのメソッドを直接
呼び出す簡単な方法があります。単に ‘BaseClassName.methodname(self,
arguments)’ を呼び出すだけです。この仕様は、場合によってはクライアントで
も役に立ちます。 (この呼び出し方が動作するのは、基底クラスがグローバルス
コープの ‘BaseClassName’ という名前でアクセスできるときだけです。)

Python には継承に関係する 2 つの組み込み関数があります:

   * *note isinstance(): 2ad. を使うとインスタンスの型が調べられます。
     ‘isinstance(obj, int)’ は ‘obj.__class__’ が *note int: 19b. や
     *note int: 19b. の派生クラスの場合に限り ‘True’ になります。

   * *note issubclass(): 9c4. を使うとクラスの継承関係が調べられます。
     *note bool: 3c3. は *note int: 19b. のサブクラスなので
     ‘issubclass(bool, int)’ は ‘True’ です。しかし、 *note float: 196.
     は *note int: 19b. のサブクラスではないので ‘issubclass(float,
     int)’ は ‘False’ です。

* Menu:

* 多重継承::


File: python.info,  Node: 多重継承,  Up: 継承

2.9.5.1 多重継承
................

Python では、多重継承 (multiple inheritance) の形式もサポートしています
。複数の基底クラスをもつクラス定義は次のようになります:

     class DerivedClassName(Base1, Base2, Base3):
         <statement-1>
         .
         .
         .
         <statement-N>

ほとんどのシンプルな多重継承において、親クラスから継承される属性の検索は
、深さ優先で、左から右に、そして継承の階層の中で同じクラスが複数出てくる
（訳注: ダイアモンド継承と呼ばれます）場合に２度探索をしない、と考えるこ
とができます。なので、ある属性が ‘DerivedClassName’ で見つからない場合、
まず ‘Base1’ から検索され、そして（再帰的に） ‘Base1’ の基底クラスから検
索され、それでも見つからなかった場合は ‘Base2’ から検索される、といった
具合になります。

実際には、それよりもう少しだけ複雑です。協調的な *note super(): 1a6. の
呼び出しのためにメソッドの解決順序は動的に変更されます。このアプローチは
他の多重継承のある言語で call-next-method として知られており、単一継承し
かない言語の super 呼び出しよりも強力です。

動的順序付けが必要なのは、すべての多重継承で１つ以上のダイヤモンド継承
(少なくとも 1 つの祖先クラスに対して最下位クラスから到達する経路が複数あ
る状態) が見られるためです。例えば、全ての新形式のクラスは *note object:
c7e. を継承しているので、どの多重継承でも *note object: c7e. への到達経
路が複数あります。基底クラスが複数回アクセスされないようにするために、動
的アルゴリズムで検索順序を線形化します。それは、各クラスで指定されている
左から右への順序は崩さず、各々の祖先クラスを一度だけ呼び出し、かつ単調に
なる (つまり祖先クラスの検索順序に影響を与えずにクラスをサブクラス化でき
る) ように行います。まとめると、これらの特徴のおかげで信頼性と拡張性のあ
る多重継承したクラスを設計することができるのです。詳細は、 *note The
Python 2.3 Method Resolution Order: 16c3. を見てください。


File: python.info,  Node: プライベート変数,  Next: 残りのはしばし,  Prev: 継承,  Up: クラス

2.9.6 プライベート変数
----------------------

オブジェクトの中からしかアクセス出来ない "プライベート" インスタンス変数
は、 Python にはありません。しかし、ほとんどの Python コードが従っている
慣習があります。アンダースコアで始まる名前 (例えば ‘_spam’) は、 (関数で
あれメソッドであれデータメンバであれ) 非 public なAPIとして扱います。こ
れらは、予告なく変更されるかもしれない実装の詳細として扱われるべきです。

クラスのプライベートメンバについて適切なユースケース(特にサブクラスで定
義された名前との衝突を避ける場合)があるので、名前マングリング ('name
mangling') と呼ばれる、限定されたサポート機構があります。 ‘__spam’ (先頭
に二個以上の下線文字、末尾に一個以下の下線文字) という形式の識別子は、
‘_classname__spam’ へとテキスト置換されるようになりました。ここで
‘classname’ は、現在のクラス名から先頭の下線文字をはぎとった名前になりま
す。このような難号化 (mangle) は、識別子の文法的な位置にかかわらず行われ
るので、クラス定義内に現れた識別子全てに対して実行されます。

参考
....

詳細と特例は、 *note private name mangling specifications: 20a3. 。

名前マングリングは、サブクラスが内部のメソッド呼び出しを壊さずにメソッド
をオーバーライドするのに便利です。例えば:

     class Mapping:
         def __init__(self, iterable):
             self.items_list = []
             self.__update(iterable)

         def update(self, iterable):
             for item in iterable:
                 self.items_list.append(item)

         __update = update   # 元の update() メソッドのプライベートコピー

     class MappingSubclass(Mapping):

         def update(self, keys, values):
             # update() への新シグネチャ導入
             # しかし __init__() は壊さない
             for item in zip(keys, values):
                 self.items_list.append(item)

上の例は、もし仮に ‘MappingSubclass’ に ‘__update’ 識別子を実装したとし
てもきちんと動きます。 その理由は、 ‘Mapping’ クラスではその識別子を
‘_Mapping__update’ に、 ‘MappingSubclass’ クラスでは
‘_MappingSubclass__update’ にそれぞれ置き換えるからです。

難号化の規則は主に不慮の事故を防ぐためのものだということに注意してくださ
い; 確信犯的な方法で、プライベートとされている変数にアクセスしたり変更す
ることは依然として可能なのです。デバッガのような特殊な状況では、この仕様
は便利ですらあります。

‘exec()’ や ‘eval()’ へ渡されたコードでは、呼出し元のクラス名を現在のク
ラスと見なさないことに注意してください。この仕様は ‘global’ 文の効果と似
ており、その効果もまた同様に、バイトコンパイルされたコードに制限されてい
ます。同じ制約が ‘getattr()’ と ‘setattr()’ と ‘delattr()’ にも適用され
ます。また、‘__dict__’ を直接参照するときにも適用されます。


File: python.info,  Node: 残りのはしばし,  Next: イテレータ iterator,  Prev: プライベート変数,  Up: クラス

2.9.7 残りのはしばし
--------------------

Pascal の "レコード (record)" や、C 言語の "構造体 (struct)" のような、
名前つきのデータ要素を一まとめにするデータ型があると便利なことがあります
。慣用的な手法として、この目的のために *note dataclasses: 33. を使用しま
す。

     from dataclasses import dataclass

     @dataclass
     class Employee:
         name: str
         dept: str
         salary: int

     >>> john = Employee('john', 'computer lab', 1000)
     >>> john.dept
     'computer lab'
     >>> john.salary
     1000

ある特定の抽象データ型を要求する Python コードの断片に、そのデータ型のメ
ソッドをエミュレーションするクラスを代わりに渡すことができます。例えば、
ファイルオブジェクトから何らかのデータを構築する関数がある場合、 *note
read(): 206c. と *note readline(): 20a6. を持つクラスを定義して、ファイ
ルではなく文字列バッファからデータを取得するようにしておき、引数として渡
すことができます。

*note Instance method objects: 20a7. にも属性があります。 *note
m.__self__: 15e2. はメソッド ‘m()’ の属しているインスタンスオブジェクト
で、*note m.__func__: 1514. はそのメソッドに対応する *note function
object: 59c. です。


File: python.info,  Node: イテレータ iterator,  Next: ジェネレータ generator,  Prev: 残りのはしばし,  Up: クラス

2.9.8 イテレータ (iterator)
---------------------------

すでに気づいているでしょうが、 *note for: 34a. 文を使うとほとんどのコン
テナオブジェクトにわたってループを行うことができます:

     for element in [1, 2, 3]:
         print(element)
     for element in (1, 2, 3):
         print(element)
     for key in {'one':1, 'two':2}:
         print(key)
     for char in "123":
         print(char)
     for line in open("myfile.txt"):
         print(line, end='')

こういう要素へのアクセス方法は明確で簡潔で使い易いものです。イテレータの
活用は Python へ広く行き渡り、統一感を持たせています。裏では ‘for’ 文は
コンテナオブジェクトに対して *note iter(): 9d7. 関数を呼んでいます。関数
は、コンテナの中の要素に1つずつアクセスする *note __next__(): 14e5. メソ
ッドが定義されているイテレータオブジェクトを返します。これ以上要素が無い
場合は、 *note __next__(): 14e5. メソッドは *note StopIteration: df5. 例
外を送出し、その通知を受け *note for: 34a. ループは終了します。組み込み
の *note next(): 9d8. 関数を使って *note __next__(): 14e5. メソッドを直
接呼ぶこともできます; この例は関数がどう働くのかを示しています:

     >>> s = 'abc'
     >>> it = iter(s)
     >>> it
     <str_iterator object at 0x10c90e650>
     >>> next(it)
     'a'
     >>> next(it)
     'b'
     >>> next(it)
     'c'
     >>> next(it)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
         next(it)
     StopIteration

イテレータプロトコルの裏にある仕組みを観察していれば、自作のクラスにイテ
レータとしての振舞いを追加するのは簡単です。 *note __next__(): 14e5. メ
ソッドを持つオブジェクトを返す *note __iter__(): 20aa. メソッドを定義す
るのです。クラスが ‘__next__()’ メソッドを定義している場合、
‘__iter__()’ メソッドは単に ‘self’ を返すことも可能です:

     class Reverse:
         """シーケンスを後ろからまわるイテレータ."""
         def __init__(self, data):
             self.data = data
             self.index = len(data)

         def __iter__(self):
             return self

         def __next__(self):
             if self.index == 0:
                 raise StopIteration
             self.index = self.index - 1
             return self.data[self.index]

     >>> rev = Reverse('spam')
     >>> iter(rev)
     <__main__.Reverse object at 0x00A1DB50>
     >>> for char in rev:
     ...     print(char)
     ...
     m
     a
     p
     s


File: python.info,  Node: ジェネレータ generator,  Next: ジェネレータ式,  Prev: イテレータ iterator,  Up: クラス

2.9.9 ジェネレータ (generator)
------------------------------

*note ジェネレータ: 126c. は、イテレータを作成するための簡潔で強力なツー
ルです。ジェネレータは通常の関数のように書かれますが、何らかのデータを返
すときには *note yield: bc2. 文を使います。そのジェネレータに対して
*note next(): 9d8. が呼び出されるたびに、ジェネレータは以前に中断した処
理を再開します (ジェネレータは、全てのデータ値と最後にどの文が実行された
かを記憶しています)。以下の例を見れば、ジェネレータがとても簡単に作成で
きることがわかります:

     def reverse(data):
         for index in range(len(data)-1, -1, -1):
             yield data[index]

     >>> for char in reverse('golf'):
     ...     print(char)
     ...
     f
     l
     o
     g

ジェネレータでできることは、前の節で解説したクラスを使ったイテレータでも
実現できます。ジェネレータの定義がコンパクトになるのは *note __iter__():
20ad. メソッドと *note __next__(): 20ae. メソッドが自動で作成されるから
です。

ジェネレータのもう一つの重要な機能は、呼び出しごとにローカル変数と実行状
態が自動的に保存されるということです。これにより、 ‘self.index’ や
‘self.data’ といったインスタンス変数を使ったアプローチよりも簡単に関数を
書くことができるようになります。

メソッドを自動生成したりプログラムの実行状態を自動保存するほかに、ジェネ
レータは終了時に自動的に *note StopIteration: df5. を送出します。これら
の機能を組み合わせると、通常の関数を書くのと同じ労力で、簡単にイテレータ
を生成できます。


File: python.info,  Node: ジェネレータ式,  Prev: ジェネレータ generator,  Up: クラス

2.9.10 ジェネレータ式
---------------------

単純なジェネレータなら式として簡潔にコーディングできます。 その式はリス
ト内包表記に似た構文を使いますが、角括弧ではなく丸括弧で囲います。 ジェ
ネレータ式は、関数の中でジェネレータをすぐに使いたいような状況のために用
意されています。 ジェネレータ式は完全なジェネレータの定義よりコンパクト
ですが、ちょっと融通の効かないところがあります。 同じ内容を返すリスト内
包表記よりはメモリに優しいことが多いという利点があります。

例:

     >>> sum(i*i for i in range(10))                 # 平方和
     285

     >>> xvec = [10, 20, 30]
     >>> yvec = [7, 5, 3]
     >>> sum(x*y for x,y in zip(xvec, yvec))         # ドット積
     260

     >>> unique_words = set(word for line in page  for word in line.split())

     >>> valedictorian = max((student.gpa, student.name) for student in graduates)

     >>> data = 'golf'
     >>> list(data[i] for i in range(len(data)-1, -1, -1))
     ['f', 'l', 'o', 'g']

脚注
....


File: python.info,  Node: 標準ライブラリミニツアー,  Next: 標準ライブラリミニツアー --- その 2,  Prev: クラス,  Up: Python チュートリアル

2.10 標準ライブラリミニツアー
=============================

* Menu:

* OSへのインターフェース::
* ファイルのワイルドカード表記::
* コマンドライン引数::
* エラー出力のリダイレクトとプログラムの終了::
* 文字列のパターンマッチング::
* 数学::
* インターネットへのアクセス::
* 日付と時刻::
* データ圧縮::
* パフォーマンスの計測::
* 品質管理::
* バッテリー同梱::


File: python.info,  Node: OSへのインターフェース,  Next: ファイルのワイルドカード表記,  Up: 標準ライブラリミニツアー

2.10.1 OSへのインターフェース
-----------------------------

*note os: a5. モジュールは、オペレーティングシステムと対話するための多く
の関数を提供しています:

     >>> import os
     >>> os.getcwd()      # Return the current working directory
     'C:\\Python314'
     >>> os.chdir('/server/accesslogs')   # Change current working directory
     >>> os.system('mkdir today')   # Run the command mkdir in the system shell
     0

‘from os import *’ ではなく、 ‘import os’ 形式を使うようにしてください。
そうすることで、動作が大きく異なる組み込み関数 *note open(): 316. が
*note os.open(): f92. で遮蔽されるのを避けられます。

組み込み関数 *note dir(): 844. および *note help(): ad4. は、 *note os:
a5. のような大規模なモジュールで作業をするときに、対話的な操作上の助けに
なります:

     >>> import os
     >>> dir(os)
     <OSモジュールの関数すべてのリストを返す>
     >>> help(os)
     <モジュールの docstring から生成された詳細なマニュアルを返す>

ファイルやディレクトリの日常的な管理作業のために、より簡単に使える高水準
のインターフェースが *note shutil: ca. モジュールで提供されています:

     >>> import shutil
     >>> shutil.copyfile('data.db', 'archive.db')
     'archive.db'
     >>> shutil.move('/build/executables', 'installdir')
     'installdir'


File: python.info,  Node: ファイルのワイルドカード表記,  Next: コマンドライン引数,  Prev: OSへのインターフェース,  Up: 標準ライブラリミニツアー

2.10.2 ファイルのワイルドカード表記
-----------------------------------

*note glob: 68. モジュールでは、ディレクトリのワイルドカード検索からファ
イルのリストを生成するための関数を提供しています:

     >>> import glob
     >>> glob.glob('*.py')
     ['primes.py', 'random.py', 'quote.py']


File: python.info,  Node: コマンドライン引数,  Next: エラー出力のリダイレクトとプログラムの終了,  Prev: ファイルのワイルドカード表記,  Up: 標準ライブラリミニツアー

2.10.3 コマンドライン引数
-------------------------

一般的なユーティリティスクリプトでは、よくコマンドライン引数を扱う必要が
あります。コマンドライン引数は モジュールの 'argv' 属性にリストとして保
存されています。例として以下の ‘demo.py’ ファイルを見てみましょう:

     # File demo.py
     import sys
     print(sys.argv)

以下は、コマンドライン上で ‘python demo.py one two three’ と実行した時の
出力です:

     ['demo.py', 'one', 'two', 'three']

*note argparse: 7. モジュールは、コマンドライン引数を処理するための更に
洗練された仕組みを提供します。次のスクリプトは1つ以上のファイル名を抽出
し、オプションで行数を表示します。

     import argparse

     parser = argparse.ArgumentParser(
         prog='top',
         description='Show top lines from each file')
     parser.add_argument('filenames', nargs='+')
     parser.add_argument('-l', '--lines', type=int, default=10)
     args = parser.parse_args()
     print(args)

コマンドラインで ‘python top.py --lines=5 alpha.txt beta.txt’ を実行する
と、上のスクリプトは ‘args.lines’ を ‘5’ 、 ‘args.filenames’ を
‘['alpha.txt', 'beta.txt']’ に設定します。


File: python.info,  Node: エラー出力のリダイレクトとプログラムの終了,  Next: 文字列のパターンマッチング,  Prev: コマンドライン引数,  Up: 標準ライブラリミニツアー

2.10.4 エラー出力のリダイレクトとプログラムの終了
-------------------------------------------------

*note sys: df. モジュールには、 'stdin', 'stdout', 'stderr' を表す属性も
存在します。 'stderr' は、警告やエラーメッセージを出力して、 'stdout' が
リダイレクトされた場合でも読めるようにするために便利です:

     >>> sys.stderr.write('Warning, log file not found starting a new one\n')
     Warning, log file not found starting a new one

‘sys.exit()’ は、スクリプトを終了させるもっとも直接的な方法です。


File: python.info,  Node: 文字列のパターンマッチング,  Next: 数学,  Prev: エラー出力のリダイレクトとプログラムの終了,  Up: 標準ライブラリミニツアー

2.10.5 文字列のパターンマッチング
---------------------------------

*note re: be. モジュールでは、より高度な文字列処理のための正規表現を提供
しています。正規表現は複雑な一致検索や操作に対して簡潔で最適化された解決
策を提供します:

     >>> import re
     >>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest')
     ['foot', 'fell', 'fastest']
     >>> re.sub(r'(\b[a-z]+) \1', r'\1', 'cat in the the hat')
     'cat in the hat'

最小限の機能だけが必要なら、読みやすくデバッグしやすい文字列メソッドの方
がお勧めです:

     >>> 'tea for too'.replace('too', 'two')
     'tea for two'


File: python.info,  Node: 数学,  Next: インターネットへのアクセス,  Prev: 文字列のパターンマッチング,  Up: 標準ライブラリミニツアー

2.10.6 数学
-----------

*note math: 92. モジュールは、浮動小数点演算のための C 言語ライブラリ関
数にアクセスする手段を提供しています:

     >>> import math
     >>> math.cos(math.pi / 4)
     0.70710678118654757
     >>> math.log(1024, 2)
     10.0

*note random: bd. モジュールは、乱数に基づいた要素選択のためのツールを提
供しています:

     >>> import random
     >>> random.choice(['apple', 'pear', 'banana'])
     'apple'
     >>> random.sample(range(100), 10)   # 重複なしでサンプリング
     [30, 83, 16, 4, 8, 81, 41, 50, 18, 33]
     >>> random.random()    # [0.0, 1.0) の区間内のランダムな float
     0.17970987693706186
     >>> random.randrange(6)    # range(6) からランダムに選ばれた integer
     4

*note statistics: d7. モジュールは数値データの基礎的な統計的特性（平均、
中央値、分散等）を計算します:

     >>> import statistics
     >>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]
     >>> statistics.mean(data)
     1.6071428571428572
     >>> statistics.median(data)
     1.25
     >>> statistics.variance(data)
     1.3720238095238095

SciPy プロジェクト <‘https://scipy.org’> は数値処理のための多くのモジュ
ールを提供しています。


File: python.info,  Node: インターネットへのアクセス,  Next: 日付と時刻,  Prev: 数学,  Up: 標準ライブラリミニツアー

2.10.7 インターネットへのアクセス
---------------------------------

インターネットにアクセスしたりインターネットプロトコルを処理したりするた
めの多くのモジュールがあります。最も単純な2つのモジュールは、 URL からデ
ータを取得するための *note urllib.request: 111. と、メールを送るための
*note smtplib: cf. です:

     >>> from urllib.request import urlopen
     >>> with urlopen('https://docs.python.org/3/') as response:
     ...     for line in response:
     ...         line = line.decode()             # Convert bytes to a str
     ...         if 'updated' in line:
     ...             print(line.rstrip())         # Remove trailing newline
     ...
           Last updated on Nov 11, 2025 (20:11 UTC).

     >>> import smtplib
     >>> server = smtplib.SMTP('localhost')
     >>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org',
     ... """To: jcaesar@example.org
     ... From: soothsayer@example.org
     ...
     ... Beware the Ides of March.
     ... """)
     >>> server.quit()

(2つ目の例は localhost でメールサーバーが動いている必要があることに注意
してください。)


File: python.info,  Node: 日付と時刻,  Next: データ圧縮,  Prev: インターネットへのアクセス,  Up: 標準ライブラリミニツアー

2.10.8 日付と時刻
-----------------

*note datetime: 34. モジュールは、日付や時刻を操作するためのクラスを、単
純な方法と複雑な方法の両方で提供しています。日付や時刻に対する算術がサポ
ートされている一方、実装では出力のフォーマットや操作のための効率的なデー
タメンバ抽出に重点を置いています。このモジュールでは、タイムゾーンに対応
したオブジェクトもサポートしています。

     >>> # 日付 (date) は容易に作成・フォーマットが可能
     >>> from datetime import date
     >>> now = date.today()
     >>> now
     datetime.date(2003, 12, 2)
     >>> now.strftime("%m-%d-%y. %d %b %Y is a %A on the %d day of %B.")
     '12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December.'

     >>> # date で日付の演算が可能
     >>> birthday = date(1964, 7, 31)
     >>> age = now - birthday
     >>> age.days
     14368


File: python.info,  Node: データ圧縮,  Next: パフォーマンスの計測,  Prev: 日付と時刻,  Up: 標準ライブラリミニツアー

2.10.9 データ圧縮
-----------------

一般的なデータアーカイブと圧縮形式は、以下のようなモジュールによって直接
的にサポートされます: *note zlib: 139, *note gzip: 6b, *note bz2: 14,
*note lzma: 8e, *note zipfile: 137, *note tarfile: e4.。

     >>> import zlib
     >>> s = b'witch which has which witches wrist watch'
     >>> len(s)
     41
     >>> t = zlib.compress(s)
     >>> len(t)
     37
     >>> zlib.decompress(t)
     b'witch which has which witches wrist watch'
     >>> zlib.crc32(s)
     226805979


File: python.info,  Node: パフォーマンスの計測,  Next: 品質管理,  Prev: データ圧縮,  Up: 標準ライブラリミニツアー

2.10.10 パフォーマンスの計測
----------------------------

Python ユーザの中には、同じ問題を異なったアプローチで解いた際の相対的な
パフォーマンスについて知りたいという深い興味を持っている人がいます。
Python は、そういった疑問に即座に答える計測ツールを提供しています。

例えば、引数の入れ替え操作に対して、伝統的なアプローチの代わりにタプルの
パックやアンパックを使ってみたいと思うかもしれません。 *note timeit: f5.
モジュールを使えば、パフォーマンスがほんの少し良いことがすぐに分かります
:

     >>> from timeit import Timer
     >>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit()
     0.57535828626024577
     >>> Timer('a,b = b,a', 'a=1; b=2').timeit()
     0.54962537085770791

*note timeit: f5. では小さい粒度を提供しているのに対し、 *note profile:
b4. や *note pstats: b5. モジュールではより大きなコードブロックにおいて
律速となる部分を判定するためのツールを提供しています。


File: python.info,  Node: 品質管理,  Next: バッテリー同梱,  Prev: パフォーマンスの計測,  Up: 標準ライブラリミニツアー

2.10.11 品質管理
----------------

高い品質のソフトウェアを開発するための一つのアプローチは、各関数に対して
開発と同時にテストを書き、開発の過程で頻繁にテストを走らせるというもので
す。

*note doctest: 3e. モジュールでは、モジュールを検索してプログラムの
docstring に埋め込まれたテストの評価を行うためのツールを提供しています。
テストの作り方は単純で、典型的な呼び出し例とその結果を docstring にカッ
ト&ペーストするだけです。この作業は、ユーザに使用例を与えるという意味で
ドキュメントの情報を増やすと同時に、ドキュメントに書かれているコードが正
しい事を確認できるようになります:

     def average(values):
         """数値のリストの算術平均を計算する。

         >>> print(average([20, 30, 70]))
         40.0
         """
         return sum(values) / len(values)

     import doctest
     doctest.testmod()   # docstring に埋め込まれたテストを自動的に評価

*note unittest: 10c. モジュールは *note doctest: 3e. モジュールほど気楽
に使えるものではありませんが、より網羅的なテストセットを別のファイルで管
理することができます:

     import unittest

     class TestStatisticalFunctions(unittest.TestCase):

         def test_average(self):
             self.assertEqual(average([20, 30, 70]), 40.0)
             self.assertEqual(round(average([1, 5, 7]), 1), 4.3)
             with self.assertRaises(ZeroDivisionError):
                 average([])
             with self.assertRaises(TypeError):
                 average(20, 30, 70)

     unittest.main()  # コマンドラインからこれを呼び出すとテストがすべて実行される


File: python.info,  Node: バッテリー同梱,  Prev: 品質管理,  Up: 標準ライブラリミニツアー

2.10.12 バッテリー同梱
----------------------

Python には "バッテリー同梱 (batteries included)" 哲学があります。この哲
学は、洗練され、安定した機能を持つ Python の膨大なパッケージ群に如実に表
れています。例えば:

   * *note xmlrpc.client: 134. および *note xmlrpc.server: 135. モジュー
     ルは、遠隔手続き呼び出し (remote procedure call) を全く大したことの
     ない作業に変えてしまいます。モジュール名とは違い、XML を扱うための
     直接的な知識は必要ありません。

   * *note email: 3f. パッケージは、MIME やその他の RFC 5322(1) に基づく
     メッセージ文書を含む電子メールメッセージを管理するためのライブラリ
     です。実際にメッセージを送信したり受信したりする *note smtplib: cf.
     や *note poplib: b1. と違って、email パッケージには (添付文書を含む
     ) 複雑なメッセージ構造の構築やデコードを行ったり、インターネット標
     準のエンコードやヘッダプロトコルの実装を行ったりするための完全なツ
     ールセットを備えています。

   * *note json: 86. パッケージはこの一般的なデータ交換形式のパースをロ
     バストにサポートしています。*note csv: 2d. モジュールはデータベース
     や表計算で一般的にサポートされている CSV ファイルを直接読み書きする
     のをサポートしています。*note xml.etree.ElementTree: 12b.、*note
     xml.dom: 127. ならびに *note xml.sax: 12f. パッケージは XML の処理
     をサポートしています。総合すると、これらのモジュールによって Python
     アプリケーションと他のツールの間でとても簡単にデータを受け渡すこと
     が出来ます。

   * *note sqlite3: d4. モジュールは SQLite データベースライブラリのラッ
     パーです。若干非標準の SQL シンタックスを用いて更新や接続出来る永続
     的なデータベースを提供します。

   * 国際化に関する機能は、 *note gettext: 67, *note locale: 8a, *note
     codecs: 1c. パッケージといったモジュール群でサポートされています。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc5322.html


File: python.info,  Node: 標準ライブラリミニツアー --- その 2,  Next: 仮想環境とパッケージ,  Prev: 標準ライブラリミニツアー,  Up: Python チュートリアル

2.11 標準ライブラリミニツアー -- その 2
=======================================

ツアーの第2部では、プロフェッショナルプログラミングを支えるもっと高度な
モジュールをカバーします。ここで挙げるモジュールは、小さなスクリプトの開
発ではほとんど使いません。

* Menu:

* 出力のフォーマット::
* 文字列テンプレート::
* バイナリデータレコードの操作::
* マルチスレッディング: マルチスレッディング<2>.
* ログ記録::
* 弱参照::
* リスト操作のためのツール::
* 10 進浮動小数演算::


File: python.info,  Node: 出力のフォーマット,  Next: 文字列テンプレート,  Up: 標準ライブラリミニツアー --- その 2

2.11.1 出力のフォーマット
-------------------------

*note reprlib: c0. モジュールは、大きなコンテナや、深くネストしたコンテ
ナを省略して表示するバージョンの *note repr(): 1c1. を提供しています:

     >>> import reprlib
     >>> reprlib.repr(set('supercalifragilisticexpialidocious'))
     "{'a', 'c', 'd', 'e', 'f', 'g', ...}"

*note pprint: b3. モジュールは、組み込み型やユーザ定義型をわかりやすく表
示するための洗練された制御手段を提供しています。表示結果が複数行にわたる
場合は、 "pretty printer" と呼ばれるものが改行やインデントを追加して、デ
ータ構造がより明確になるように印字します:

     >>> import pprint
     >>> t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta',
     ...     'yellow'], 'blue']]]
     ...
     >>> pprint.pprint(t, width=30)
     [[[['black', 'cyan'],
        'white',
        ['green', 'red']],
       [['magenta', 'yellow'],
        'blue']]]

*note textwrap: f2. モジュールは、段落で構成された文章を、指定したスクリ
ーン幅にぴったり収まるように調整します:

     >>> import textwrap
     >>> doc = """The wrap() method is just like fill() except that it returns
     ... a list of strings instead of one big string with newlines to separate
     ... the wrapped lines."""
     ...
     >>> print(textwrap.fill(doc, width=40))
     The wrap() method is just like fill()
     except that it returns a list of strings
     instead of one big string with newlines
     to separate the wrapped lines.

*note locale: 8a. モジュールは、文化により異なるデータ表現形式のデータベ
ースにアクセスします。 *note locale: 8a. の *note format(): 199. 関数の
grouping 属性を使えば、数値を適切な桁区切り文字によりグループ化された形
式に変換できます:

     >>> import locale
     >>> locale.setlocale(locale.LC_ALL, 'English_United States.1252')
     'English_United States.1252'
     >>> conv = locale.localeconv()          # get a mapping of conventions
     >>> x = 1234567.8
     >>> locale.format_string("%d", x, grouping=True)
     '1,234,567'
     >>> locale.format_string("%s%.*f", (conv['currency_symbol'],
     ...                      conv['frac_digits'], x), grouping=True)
     '$1,234,567.80'


File: python.info,  Node: 文字列テンプレート,  Next: バイナリデータレコードの操作,  Prev: 出力のフォーマット,  Up: 標準ライブラリミニツアー --- その 2

2.11.2 文字列テンプレート
-------------------------

*note string: d8. モジュールには、柔軟で、エンドユーザが簡単に編集できる
簡単な構文を備えた *note Template: 897. クラスが入っています。このクラス
を使うと、ユーザがアプリケーションを修正することなしにアプリケーションの
出力をカスタマイズできるようになります。

テンプレートでは、‘$’ と有効な Python 識別子名 (英数字とアンダースコア)
からなるプレースホルダ名を使います。プレースホルダの周りを {} で囲えば、
プレースホルダの後ろにスペースを挟まず、英数文字を続けることができます。
‘$$’ のようにすると、‘$’ 自体をエスケープできます:

     >>> from string import Template
     >>> t = Template('${village}folk send $$10 to $cause.')
     >>> t.substitute(village='Nottingham', cause='the ditch fund')
     'Nottinghamfolk send $10 to the ditch fund.'

*note substitute(): 20d5. メソッドは、プレースホルダに相当する値が辞書や
キーワード引数にない場合に *note KeyError: 5e7. を送出します。メールマー
ジ機能のようなアプリケーションの場合、ユーザが入力するデータは不完全なこ
とがあるので、欠落したデータがあるとプレースホルダをそのままにして出力す
る *note safe_substitute(): 20d6. メソッドを使う方が適切かもしれません:

     >>> t = Template('Return the $item to $owner.')
     >>> d = dict(item='unladen swallow')
     >>> t.substitute(d)
     Traceback (most recent call last):
       ...
     KeyError: 'owner'
     >>> t.safe_substitute(d)
     'Return the unladen swallow to $owner.'

区切り文字はデフォルトは ‘$’ ですが、*note Template: 897. のサブクラスを
派生すると変更することができます。例えば、画像ブラウザ用に一括で名前を変
更するユーティリティを作っていたとして、現在の日付や画像のシーケンス番号
、ファイル形式といったプレースホルダにパーセント記号を使うことにしたら、
次のようになります:

     >>> import time, os.path
     >>> photofiles = ['img_1074.jpg', 'img_1076.jpg', 'img_1077.jpg']
     >>> class BatchRename(Template):
     ...     delimiter = '%'
     ...
     >>> fmt = input('Enter rename style (%d-date %n-seqnum %f-format):  ')
     Enter rename style (%d-date %n-seqnum %f-format):  Ashley_%n%f

     >>> t = BatchRename(fmt)
     >>> date = time.strftime('%d%b%y')
     >>> for i, filename in enumerate(photofiles):
     ...     base, ext = os.path.splitext(filename)
     ...     newname = t.substitute(d=date, n=i, f=ext)
     ...     print('{0} --> {1}'.format(filename, newname))

     img_1074.jpg --> Ashley_0.jpg
     img_1076.jpg --> Ashley_1.jpg
     img_1077.jpg --> Ashley_2.jpg

テンプレートのもう一つの用途は、複数ある出力フォーマットからのプログラム
ロジックの分離です。これにより、XMLファイル用、プレーンテキストのレポー
ト用、HTMLのwebレポート用のテンプレートに、同じプログラムロジックから値
を埋め込むことができます。


File: python.info,  Node: バイナリデータレコードの操作,  Next: マルチスレッディング<2>,  Prev: 文字列テンプレート,  Up: 標準ライブラリミニツアー --- その 2

2.11.3 バイナリデータレコードの操作
-----------------------------------

*note struct: db. モジュールでは、様々な長さのバイナリレコード形式を操作
する *note pack(): 148e. や *note unpack(): 185a. といった関数を提供して
います。 以下の例では、 *note zipfile: 137. モジュールを使わずに、ZIP フ
ァイルのヘッダ情報を巡回する方法を示しています。‘"H"’ と ‘"I"’ というパ
ック符号は、それぞれ2バイトと4バイトの符号無し 整数を表しています。
‘"<"’ は、そのパック符号が standard サイズであり、バイトオーダーがリトル
エンディアンであることを示しています:

     import struct

     with open('myfile.zip', 'rb') as f:
         data = f.read()

     start = 0
     for i in range(3):                      # show the first 3 file headers
         start += 14
         fields = struct.unpack('<IIIHH', data[start:start+16])
         crc32, comp_size, uncomp_size, filenamesize, extra_size = fields

         start += 16
         filename = data[start:start+filenamesize]
         start += filenamesize
         extra = data[start:start+extra_size]
         print(filename, hex(crc32), comp_size, uncomp_size)

         start += extra_size + comp_size     # skip to the next header


File: python.info,  Node: マルチスレッディング<2>,  Next: ログ記録,  Prev: バイナリデータレコードの操作,  Up: 標準ライブラリミニツアー --- その 2

2.11.4 マルチスレッディング
---------------------------

スレッド処理 (threading) とは、順序的な依存関係にない複数のタスクを分割
するテクニックです。スレッドは、ユーザの入力を受け付けつつ、背後で別のタ
スクを動かすようなアプリケーションの応答性を高めます。同じような使用例と
して、I/O を別のスレッドの計算処理と並列して動作させるというものがありま
す。

以下のコードでは、高水準のモジュール *note threading: f3. でメインのプロ
グラムを動かしながら背後で別のタスクを動作させられるようにする方法を示し
ています:

     import threading, zipfile

     class AsyncZip(threading.Thread):
         def __init__(self, infile, outfile):
             threading.Thread.__init__(self)
             self.infile = infile
             self.outfile = outfile

         def run(self):
             f = zipfile.ZipFile(self.outfile, 'w', zipfile.ZIP_DEFLATED)
             f.write(self.infile)
             f.close()
             print('Finished background zip of:', self.infile)

     background = AsyncZip('mydata.txt', 'myarchive.zip')
     background.start()
     print('The main program continues to run in foreground.')

     background.join()    # Wait for the background task to finish
     print('Main program waited until background was done.')

マルチスレッドアプリケーションを作る上で最も難しい問題は、データやリソー
スを共有するスレッド間の調整 (coordination)です。この問題を解決するため
、*note threading: f3. モジュールではロックやイベント、状態変数、セマフ
ォといった数々の同期プリミティブを提供しています。

こうしたツールは強力な一方、ちょっとした設計上の欠陥で再現困難な問題を引
き起こすことがあります。したがって、タスク間調整では *note queue: bb. モ
ジュールを使って他の複数のスレッドからのリクエストを一つのスレッドに送り
込み、一つのリソースへのアクセスをできるだけ一つのスレッドに集中させるほ
うが良いでしょう。スレッド間の通信や調整に *note Queue: 15ac. オブジェク
トを使うと、設計が容易になり、可読性が高まり、信頼性が増します。


File: python.info,  Node: ログ記録,  Next: 弱参照,  Prev: マルチスレッディング<2>,  Up: 標準ライブラリミニツアー --- その 2

2.11.5 ログ記録
---------------

*note logging: 8b. モジュールでは、数多くの機能をそなえた柔軟性のあるロ
グ記録システムを提供しています。最も簡単な使い方では、ログメッセージをフ
ァイルや ‘sys.stderr’ に送信します:

     import logging
     logging.debug('Debugging information')
     logging.info('Informational message')
     logging.warning('Warning:config file %s not found', 'server.conf')
     logging.error('Error occurred')
     logging.critical('Critical error -- shutting down')

これは以下の出力を生成します:

     WARNING:root:Warning:config file server.conf not found
     ERROR:root:Error occurred
     CRITICAL:root:Critical error -- shutting down

デフォルトでは、*note info(): 20dd. と *note debug(): 102b. による出力は
抑制され、出力は標準エラーに送信されます。選択可能な送信先には、email、
データグラム、ソケット、HTTP サーバへの送信などがあります。新たにフィル
タを作成すると、*note DEBUG: 20de.、*note INFO: 20df.、*note WARNING:
20e0.、*note ERROR: 20e1.、*note CRITICAL: 20e2. といったメッセージのプ
ライオリティによって異なる送信先を選択することができます。

ログ記録システムは Python から直接設定することもできますし、アプリケーシ
ョンを変更しなくてもカスタマイズできるよう、ユーザが編集可能な設定ファイ
ルによって設定することもできます。


File: python.info,  Node: 弱参照,  Next: リスト操作のためのツール,  Prev: ログ記録,  Up: 標準ライブラリミニツアー --- その 2

2.11.6 弱参照
-------------

Python は自動的にメモリを管理します (ほとんどのオブジェクトは参照カウン
ト方式で管理し、 *note ガベージコレクション: 17d8. で循環参照を除去しま
す)。オブジェクトに対する最後の参照がなくなってしばらくするとメモリは解
放されます。

このようなアプローチはほとんどのアプリケーションでうまく動作しますが、中
にはオブジェクトをどこか別の場所で利用している間だけ追跡しておきたい場合
もあります。残念ながら、オブジェクトを追跡するだけでオブジェクトに対する
恒久的な参照を作ることになってしまいます。 *note weakref: 11a. モジュー
ルでは、オブジェクトへの参照を作らずに追跡するためのツールを提供していま
す。弱参照オブジェクトが不要になると、弱参照 (weakref) テーブルから自動
的に除去され、コールバック関数がトリガされます。弱参照を使う典型的な応用
例には、作成コストの大きいオブジェクトのキャッシュがあります:

     >>> import weakref, gc
     >>> class A:
     ...     def __init__(self, value):
     ...         self.value = value
     ...     def __repr__(self):
     ...         return str(self.value)
     ...
     >>> a = A(10)                   # create a reference
     >>> d = weakref.WeakValueDictionary()
     >>> d['primary'] = a            # does not create a reference
     >>> d['primary']                # fetch the object if it is still alive
     10
     >>> del a                       # remove the one reference
     >>> gc.collect()                # run garbage collection right away
     0
     >>> d['primary']                # entry was automatically removed
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
         d['primary']                # entry was automatically removed
       File "C:/python314/lib/weakref.py", line 46, in __getitem__
         o = self.data[key]()
     KeyError: 'primary'


File: python.info,  Node: リスト操作のためのツール,  Next: 10 進浮動小数演算,  Prev: 弱参照,  Up: 標準ライブラリミニツアー --- その 2

2.11.7 リスト操作のためのツール
-------------------------------

多くのデータ構造は、組み込みリスト型を使った実装で事足ります。とはいえ、
時には組み込みリストとは違うパフォーマンス上のトレードオフを持つような実
装が必要になこともあります。

*note array: 8. (配列) モジュールでは、*note array: 4be. オブジェクトを
提供しています。配列はリストに似ていますが、同種のデータのみを よりコン
パクトに格納します。 以下の例に示すのは、通常 1 要素あたり 16 バイト使う
Python の int オブジェクトのリストではなく、2 バイト使う符号無しバイナリ
整数 (タイプコード ‘"H"’) の配列です:

     >>> from array import array
     >>> a = array('H', [4000, 10, 700, 22222])
     >>> sum(a)
     26932
     >>> a[1:3]
     array('H', [10, 700])

*note collections: 1e. モジュールでは、 *note deque: 7f4. オブジェクトを
提供しています。リスト型に似ていますが、データの追加と左端からの取り出し
が速く、その一方で中間にある値の参照は遅くなります。こうしたオブジェクト
はキューや木構造の幅優先探索の実装に向いています:

     >>> from collections import deque
     >>> d = deque(["task1", "task2", "task3"])
     >>> d.append("task4")
     >>> print("Handling", d.popleft())
     Handling task1

     unsearched = deque([starting_node])
     def breadth_first_search(unsearched):
         node = unsearched.popleft()
         for m in gen_moves(node):
             if is_goal(m):
                 return m
             unsearched.append(m)

リストの代わりの実装以外にも、標準ライブラリにはソート済みのリストを操作
するための関数を備えた *note bisect: 12. のようなツールも提供しています:

     >>> import bisect
     >>> scores = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')]
     >>> bisect.insort(scores, (300, 'ruby'))
     >>> scores
     [(100, 'perl'), (200, 'tcl'), (300, 'ruby'), (400, 'lua'), (500, 'python')]

*note heapq: 6d. モジュールは、通常のリストでヒープを実装するための関数
を提供しています。ヒープでは、最も低い値をもつエントリがつねにゼロの位置
に配置されます。ヒープは、毎回リストをソートすることなく、最小の値をもつ
要素に繰り返しアクセスするようなアプリケーションで便利です:

     >>> from heapq import heapify, heappop, heappush
     >>> data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]
     >>> heapify(data)                      # rearrange the list into heap order
     >>> heappush(data, -5)                 # add a new entry
     >>> [heappop(data) for i in range(3)]  # fetch the three smallest entries
     [-5, 0, 1]


File: python.info,  Node: 10 進浮動小数演算,  Prev: リスト操作のためのツール,  Up: 標準ライブラリミニツアー --- その 2

2.11.8 10 進浮動小数演算
------------------------

*note decimal: 3a. モジュールでは、 10 進浮動小数の算術演算をサポートす
る *note Decimal: 1fe. データ型を提供しています。組み込みの 2 進浮動小数
の実装である *note float: 196. に比べて、このクラスがとりわけ便利なのは
、以下の場合です

   * 財務アプリケーションやその他の正確な10進表記が必要なアプリケーショ
     ン、

   * 精度の制御、

   * 法的または規制上の理由に基づく値丸めの制御、

   * 有効桁数の追跡が必要になる場合

   * ユーザが手計算の結果と同じ演算結果を期待するようなアプリケーション
     。

例えば、70 セントの電話代にかかる 5% の税金を計算しようとすると、10 進の
浮動小数点値と 2 進の浮動小数点値では違う結果になってしまいます。計算結
果を四捨五入してセント単位にしようとすると、以下のように違いがはっきり現
れます:

     >>> from decimal import *
     >>> round(Decimal('0.70') * Decimal('1.05'), 2)
     Decimal('0.74')
     >>> round(.70 * 1.05, 2)
     0.73

上の例で、*note Decimal: 1fe. を使った計算では、末尾桁のゼロが保存されて
おり、有効数字2桁の被乗数から自動的に有効数字を 4 桁と判断しています。
*note Decimal: 1fe. は手計算と 同じ方法で計算を行い、2 進浮動小数が 10 進
小数成分を正確に表現できないことに よって起きる問題を回避しています。

*note Decimal: 1fe. クラスは厳密な値を表現できるため、2 進浮動小数点数で
は 期待通りに計算できないような剰余の計算や等値テストも実現できます:

     >>> Decimal('1.00') % Decimal('.10')
     Decimal('0.00')
     >>> 1.00 % 0.10
     0.09999999999999995

     >>> sum([Decimal('0.1')]*10) == Decimal('1.0')
     True
     >>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0
     False

*note decimal: 3a. モジュールを使うと、必要なだけの精度で算術演算を行え
ます:

     >>> getcontext().prec = 36
     >>> Decimal(1) / Decimal(7)
     Decimal('0.142857142857142857142857142857142857')


File: python.info,  Node: 仮想環境とパッケージ,  Next: さあ何を？,  Prev: 標準ライブラリミニツアー --- その 2,  Up: Python チュートリアル

2.12 仮想環境とパッケージ
=========================

* Menu:

* はじめに: はじめに<4>.
* 仮想環境の作成::
* pip を使ったパッケージ管理::


File: python.info,  Node: はじめに<4>,  Next: 仮想環境の作成,  Up: 仮想環境とパッケージ

2.12.1 はじめに
---------------

Python アプリケーションはよく標準ライブラリ以外のパッケージやモジュール
を利用します。またアプリケーションがあるバグ修正を必要としていたり、過去
のバージョンのインターフェイスに依存しているために、ライブラリの特定のバ
ージョンを必要とすることもあります。

そのため、1つのインストールされたPythonが全てのアプリケーションの要求に
対応することは不可能です。もしアプリケーションAがあるモジュールのバージ
ョン 1.0 を要求していて、別のアプリケーションBが同じモジュールのバージョ
ン 2.0 を要求している場合、2つの要求は衝突していて、1.0 と 2.0 のどちら
かのバージョンをインストールしても片方のアプリケーションが動きません。

この問題の解決策は *note 仮想環境: 20ee. を作ることです。仮想環境とは、
特定のバージョンの Python と幾つかの追加パッケージを含んだ Python インス
トールを構成するディレクトリです。

別のアプリケーションはそれぞれ別の仮想環境を使うことができます。先の例に
あった要求の衝突を解決する場合、アプリケーションAが固有の仮想環境を持っ
てそこにライブラリのバージョン 1.0 をインストールし、アプリケーションBが
持つ別の仮想環境にライブラリのバージョン 2.0 をインストールすることがで
きます。そしてアプリケーションBがライブラリのバージョンを 3.0 に更新する
ことを要求する場合も、アプリケーションAに影響しません。


File: python.info,  Node: 仮想環境の作成,  Next: pip を使ったパッケージ管理,  Prev: はじめに<4>,  Up: 仮想環境とパッケージ

2.12.2 仮想環境の作成
---------------------

仮想環境の作成・管理に使われるモジュールは、 *note venv: 117. と呼ばれま
す。 *note venv: 117. は、コマンドが実行された Python のバージョン
(*note -version: f17. オプションで表示される) をインストールします。例え
ば、 ‘python3.12’ でコマンドを実行すると、バージョン 3.12 がインストール
されます。

仮想環境を作るには、仮想環境を置くディレクトリを決めて、 そのディレクト
リのパスを指定して、 *note venv: 117. をスクリプトとして実行します:

     python -m venv tutorial-env

これは ‘tutorial-env’ ディレクトリがなければ作成して、その中に Python イ
ンタプリタ、その他関連するファイルのコピーを含むサブディレクトリを作りま
す。

仮想環境の一般的なディレクトリの場所は ‘.venv’ です。この名前は、通常は
シェルで隠されているため、ディレクトリが存在する理由を説明する名前を付け
ても、邪魔にはなりません。また、一部のツールでサポートされている ‘.env’
環境変数定義ファイルによるクラッシュも防止します。

仮想環境を作ったら、それを有効化する必要があります。

Windows の場合:

     tutorial-env\Scripts\activate

Unix や Mac OS の場合:

     source tutorial-env/bin/activate

(このスクリプトは bash shell で書かれています。 ‘csh’ や ‘fish’ を利用し
ている場合、代わりに利用できる ‘activate.csh’ と ‘activate.fish’ スクリ
プトがあります。)

仮想環境を有効化すると、シェルのプロンプトに利用中の仮想環境が表示される
ようになり、‘python’ を実行するとその仮想環境の Python を実行するように
なります:

     $ source ~/envs/tutorial-env/bin/activate
     (tutorial-env) $ python
     Python 3.5.1 (default, May  6 2016, 10:59:36)
       ...
     >>> import sys
     >>> sys.path
     ['', '/usr/local/lib/python35.zip', ...,
     '~/envs/tutorial-env/lib/python3.5/site-packages']
     >>>

仮想環境を無効化するには、ターミナルに:

     deactivate

と入力します。


File: python.info,  Node: pip を使ったパッケージ管理,  Prev: 仮想環境の作成,  Up: 仮想環境とパッケージ

2.12.3 pip を使ったパッケージ管理
---------------------------------

　‘pip’ と呼ばれるプログラムでパッケージをインストール、アップグレード、
削除することができます。デフォルトでは ‘pip’ は Python Package Index(1)
からパッケージをインストールします。ブラウザを使って Python Package
Index を閲覧することができます。

‘pip’ は "install" 、 "uninstall" 、 "freeze" など、いくつかのサブコマン
ドを持っています。 (‘pip’ の完全なドキュメントは *note Python
モジュールのインストール: 10f8. ガイドを参照してください。)

パッケージ名を指定してそのパッケージの最新版をインストールすることができ
ます:

     (tutorial-env) $ python -m pip install novas
     Collecting novas
       Downloading novas-3.1.1.3.tar.gz (136kB)
     Installing collected packages: novas
       Running setup.py install for novas
     Successfully installed novas-3.1.1.3

パッケージ名のあとに ‘==’ とバージョン番号を付けることで、特定のバージョ
ンのパッケージをインストールすることもできます:

     (tutorial-env) $ python -m pip install requests==2.6.0
     Collecting requests==2.6.0
       Using cached requests-2.6.0-py2.py3-none-any.whl
     Installing collected packages: requests
     Successfully installed requests-2.6.0

同じコマンドを再び実行した場合、‘pip’ は要求されたバージョンがインストー
ル済みだと表示して何もしません。別のバージョン番号を指定すればそのバージ
ョンをインストールしますし、‘python -m pip install --upgrade’ を実行すれ
ばそのパッケージを最新版に更新します:

     (tutorial-env) $ python -m pip install --upgrade requests
     Collecting requests
     Installing collected packages: requests
       Found existing installation: requests 2.6.0
         Uninstalling requests-2.6.0:
           Successfully uninstalled requests-2.6.0
     Successfully installed requests-2.7.0

‘python -m pip uninstall’ コマンドに削除するパッケージ名を1つ以上指定し
ます。

‘python -m pip show’ は指定されたパッケージの情報を表示します:

     (tutorial-env) $ python -m pip show requests
     ---
     Metadata-Version: 2.0
     Name: requests
     Version: 2.7.0
     Summary: Python HTTP for Humans.
     Home-page: http://python-requests.org
     Author: Kenneth Reitz
     Author-email: me@kennethreitz.com
     License: Apache 2.0
     Location: /Users/akuchling/envs/tutorial-env/lib/python3.4/site-packages
     Requires:

‘python -m pip list’ は仮想環境にインストールされた全てのパッケージを表
示します:

     (tutorial-env) $ python -m pip list
     novas (3.1.1.3)
     numpy (1.9.2)
     pip (7.0.3)
     requests (2.7.0)
     setuptools (16.0)

‘python -m pip freeze’ はインストールされたパッケージ一覧を、‘python -m
pip install’ が解釈するフォーマットで生成します。一般的な慣習として、こ
のリストを ‘requirements.txt’ というファイルに保存します:

     (tutorial-env) $ python -m pip freeze > requirements.txt
     (tutorial-env) $ cat requirements.txt
     novas==3.1.1.3
     numpy==1.9.2
     requests==2.7.0

‘requirements.txt’ をバージョン管理システムにコミットして、アプリケーシ
ョンの一部として配布することができます。ユーザーは必要なパッケージを
‘install -r’ でインストールできます:

     (tutorial-env) $ python -m pip install -r requirements.txt
     Collecting novas==3.1.1.3 (from -r requirements.txt (line 1))
       ...
     Collecting numpy==1.9.2 (from -r requirements.txt (line 2))
       ...
     Collecting requests==2.7.0 (from -r requirements.txt (line 3))
       ...
     Installing collected packages: novas, numpy, requests
       Running setup.py install for novas
     Successfully installed novas-3.1.1.3 numpy-1.9.2 requests-2.7.0

‘pip’ にはたくさんのオプションがあります。 ‘pip’ の完全なドキュメントは
*note Python モジュールのインストール: 10f8. を参照してください。パッケ
ージを作成してそれを Python Package Index で公開したい場合、 Python
packaging user guide(2) を参照してください。

   ---------- Footnotes ----------

   (1) https://pypi.org

   (2) 
https://packaging.python.org/en/latest/tutorials/packaging-projects/


File: python.info,  Node: さあ何を？,  Next: 対話入力編集と履歴置換,  Prev: 仮想環境とパッケージ,  Up: Python チュートリアル

2.13 さあ何を？
===============

このチュートリアルを読んだことで、おそらく Python を使ってみようという関
心はますます強くなったことでしょう -- 現実世界の問題を解決するために、
Python を適用してみたくなったはずです。さて、それではどこで勉強をしたら
よいのでしょうか？

このチュートリアルは Python のドキュメンテーションセットの一部です。セッ
トの中の他のドキュメンテーションをいくつか紹介します:

   * *note Python 標準ライブラリ: 149.:

     このマニュアルをざっと眺めておくと便利です。このマニュアルは型、関
     数、標準ライブラリのモジュールについての完全なリファレンスです。標
     準的なPython配布物は 'たくさんの' 追加コードを含んでいます。Unix メ
     ールボックスの読み込み、HTTPによるドキュメント取得、乱数の生成、コ
     マンドラインオプションの構文解析、データ圧縮やその他たくさんのタス
     クのためのモジュールがあります。ライブラリリファレンスをざっと見る
     ことで、何が利用できるかのイメージをつかむことができます。

   * *note Python モジュールのインストール: 10f8. は、他のPythonユーザに
     よって書かれた追加モジュールをどうやってインストールするかを説明し
     ています。

   * *note Python 言語リファレンス: 14a.: Pythonの文法とセマンティクスを
     詳しく説明しています。読むのは大変ですが、言語の完全なガイドとして
     有用です。

さらなる Python に関するリソース:

   * ‘https://www.python.org’: 有名なPythonのWebサイト。コードやドキュメ
     ント、Pythonに関するWebページへのポインターを含んでいます。

   * ‘https://docs.python.org’: Pythonドキュメントへの素早いアクセスを提
     供します。

   * ‘https://pypi.org’: Python パッケージインデックス、以前は Cheese
     Shop (1) という愛称でも呼ばれていました。これは、ユーザ作成のダウン
     ロードできる Python モジュールの索引です。コードのリリースをしたら
     、ここに登録することで他の人が見つけられます。

   * ‘https://code.activestate.com/recipes/langs/python/’: Python クック
     ブックはコード例、モジュール、実用的なスクリプトの巨大なコレクショ
     ンです。主要なものは同名の本Python Cookbook (O'Reilly & Associates,
     ISBN 0-596-00797-3)に収録されています。

   * ‘https://pyvideo.org’ は学会やユーザグループの会合から Python 関連
     のビデオのリンクを集めています。

   * ‘https://scipy.org’: Scientific Python プロジェクトは配列の高速な計
     算・操作モジュールに加え、線形代数、フーリエ変換、非線形ソルバー、
     乱数分布、統計分析などの多くのパッケージを提供しています。

Python 関連の質問や問題の報告については、ニュースグループ
‘comp.lang.python’ に投稿するか、またはメーリングリスト
<python-list@python.org> に送ることができます。ニュースグループとメーリ
ングリストはゲートウェイされます。したがって、片方に投稿されたメッセージ
は、もう片方へ自動的に転送されます。質問(と回答)、新しい機能の提案、新し
いモジュールの発表などで、1日に数百通の投稿があります。メーリングリスト
のアーカイブは ‘https://mail.python.org/pipermail/’ で利用可能です。

投稿の前に、必ず *note よくある質問: 20f5. (FAQとも呼ばれます) のリスト
をチェックしてください。 FAQ は繰り返し取り上げられる多くの質問に答えて
います。あなたの問題に対する解決が既に含まれているかもしれません。

脚注
....

   ---------- Footnotes ----------

   (1) "Cheese Shop" is a Monty Python sketch: a customer enters a
cheese shop, but whatever cheese he asks for, the clerk says it's
missing.


File: python.info,  Node: 対話入力編集と履歴置換,  Next: 浮動小数点演算、その問題と制限,  Prev: さあ何を？,  Up: Python チュートリアル

2.14 対話入力編集と履歴置換
===========================

いくつかのバージョンの Python インタプリタでは、Korn シェルや GNU Bash シ
ェルに見られる機能に似た、現在の入力行に対する編集機能や履歴置換機能をサ
ポートしています。この機能は様々な編集スタイルをサポートしている、GNU
Readline(1) ライブラリを使って実装されています。このライブラリには独自の
ドキュメントがあり、ここでそれを繰り返すつもりはありません。

* Menu:

* タブ補完と履歴編集::
* 対話的インタープリタの代替::

   ---------- Footnotes ----------

   (1) https://tiswww.case.edu/php/chet/readline/rltop.html


File: python.info,  Node: タブ補完と履歴編集,  Next: 対話的インタープリタの代替,  Up: 対話入力編集と履歴置換

2.14.1 タブ補完と履歴編集
-------------------------

変数とモジュール名の補完はインタプリタの起動時に *note
自動的に有効化されます: 11cb. 。 従って ‘Tab’ キーは補完機能を呼び出し、
Python の文の名前、現在のローカル変数、および利用可能なモジュール名を検
索します。 ‘string.a’ のようなドットで区切られた式については、最後の
‘'.'’ までの式を評価し、結果として得られたオブジェクトの属性から補完候補
を示します。 *note __getattr__(): 6fa. メソッドを持ったオブジェクトが式
に含まれている場合、 *note __getattr__(): 6fa. がアプリケーション定義の
コードを実行するかもしれないので注意してください。デフォルトの設定ではあ
なたのユーザーディレクトリの ‘.python_history’ という名前のファイルに履
歴を保存します。 履歴は次回の対話的なインタプリタのセッションで再び利用
することができます。


File: python.info,  Node: 対話的インタープリタの代替,  Prev: タブ補完と履歴編集,  Up: 対話入力編集と履歴置換

2.14.2 対話的インタープリタの代替
---------------------------------

この機能は、初期の版のインタープリタに比べれば大きな進歩です。とはいえ、
まだいくつかの要望が残されています。例えば、行を継続するときに正しいイン
デントが提示されたら快適でしょう (パーサは次の行で *note INDENT: 20fd. ト
ークンが必要かどうかを知っています)。補完機構がインタープリタのシンボル
テーブルを使ってもよいかもしれません。括弧やクォートなどの対応をチェック
する (あるいは指示する) コマンドも有用でしょう。

より優れた対話的インタープリタの代替の一つに IPython(1) があります。この
インタープリタは、様々なところで使われていて、タブ補完、オブジェクト探索
や先進的な履歴管理といった機能を持っています。他のアプリケーションにカス
タマイズされたり、組込まれこともあります。別の優れたインタラクティブ環境
としては bpython(2) があります。

   ---------- Footnotes ----------

   (1) https://ipython.org/

   (2) https://bpython-interpreter.org/


File: python.info,  Node: 浮動小数点演算、その問題と制限,  Next: 付録,  Prev: 対話入力編集と履歴置換,  Up: Python チュートリアル

2.15 浮動小数点演算、その問題と制限
===================================

浮動小数点数はコンピューターのハードウェア上は2進数(binary)の分数で表さ
れます。 たとえば、'10進数' の分数では ‘0.625’ は 6/10 + 2/100 + 5/1000
という値を持ち、'2進数' の分数では ‘0.101’ は 1/2 + 0/4 + 1/8 という値を
持ちます。 この2つの分数はまったく同じ値を持ち、唯一異なる点は1つ目が
10進数の分数で書かれており、2つ目は2進数の分数で書かれているということで
す。

残念なことに、ほとんどの小数は 2 進法の分数として正確に表わすことができ
ません。その結果、一般に、入力した 10 進の浮動小数点数は、 2 進法の浮動
小数点数で近似された後、実際にマシンに記憶されます。

最初は基数 10 を使うと問題を簡単に理解できます。分数 1/3 を考えてみまし
ょう。分数 1/3 は、基数 10 の分数として、以下のように近似することができ
ます:

     0.3

さらに正確な近似は、

     0.33

さらに正確な近似は、

     0.333

となり、以後同様です。何個桁数を増やして書こうが、結果は決して厳密な 1/3
にはなりません。しかし、少しづつ正確な近似にはなっていくでしょう。

同様に、基数を 2 とした表現で何桁使おうとも、10 進数の 0.1 は基数を 2 と
した小数で正確に表現することはできません。基数 2 では、1/10 は循環小数
(repeating fraction) となります

     0.0001100110011001100110011001100110011001100110011...

どこか有限の桁で止めると、近似値を得ることになります。近年の殆どのコンピ
ュータでは float 型は、最上位ビットから数えて最初の 53 ビットを分子、2 の
冪乗を分母とした、二進小数で近似されます。1/10 の場合は、二進小数は
‘3602879701896397 / 2 ** 55’ となります。これは、1/10 に近いですが、厳密
に同じ値ではありません。

値が表示される方法のために、ほとんどのユーザは、近似に気づきません。
Python はマシンに格納されている二進近似値の10進小数での近似値を表示する
ので、格納されている値が元の10進小数の近似値でしか無いことを忘れがちです
。ほとんどのマシンで、もし Python が2進数で近似された 0.1 の近似値をその
まま10進数で表示していたら、その結果は次のようになったでしょう:

     >>> 0.1
     0.1000000000000000055511151231257827021181583404541015625

これは、ほとんどの人が必要と感じるよりも多すぎる桁数です。なので、Python
は丸めた値を表示することで、桁数を扱いやすい範囲にとどめます:

     >>> 1 / 10
     0.1

表示された結果が正確に 1/10 であるように見えたとしても、実際に格納されて
いる値は最も近く表現できる二進小数であるということだけは覚えておいてくだ
さい。

幾つかの異なる10進数の値が、同じ2進有理数の近似値を共有しています。例え
ば、‘0.1’ と ‘0.10000000000000001’ と
‘0.1000000000000000055511151231257827021181583404541015625’ はどれも
‘3602879701896397 / 2 ** 55’ に近似されます。同じ近似値を共有しているの
で、どの10進数の値も ‘eval(repr(x)) == x’ という条件を満たしたまま同じよ
うに表示されます。

昔の Python は、プロンプトと *note repr(): 1c1. ビルトイン関数は 17 桁の
有効数字を持つ ‘0.10000000000000001’ のような10進数の値を選んで表示して
いました。 Python 3.1 からは、ほとんどの場面で ‘0.1’ のような最も短い桁
数の10進数の値を選ぶようになりました。

この動作は2進数の浮動小数点にとってはごく自然なものです。これは Python の
バグではありませんし、あなたのコードのバグでもありません。ハードウェアの
浮動小数点演算をサポートしている全ての言語で同じ種類の問題を見つけること
ができます (いくつかの言語ではデフォルトの、あるいはどの出力モードを選ん
でも、この差を '表示' しないかもしれませんが)。

よりよい出力のために、文字列フォーマットを利用して有効桁数を制限した10進
数表現を得ることができます:

     >>> format(math.pi, '.12g')  # give 12 significant digits
     '3.14159265359'

     >>> format(math.pi, '.2f')   # give 2 digits after the point
     '3.14'

     >>> repr(math.pi)
     '3.141592653589793'

これが、実際のコンピューター上の値の '表示' を丸めているだけの、いわば錯
覚だということを認識しておいてください。

もう一つの錯覚を紹介します。例えば、0.1 が正確には 1/10 ではないために、
それを3回足した値もまた正確には 0.3 ではありません:

     >>> 0.1 + 0.1 + 0.1 == 0.3
     False

0.1 はこれ以上 1/10 に近くなることができない値で、 0.3 もまた 3/10 に一
番近い値なので、 *note round(): 14f2. 関数を使って計算前に丸めを行なって
も意味がありません:

     >>> round(0.1, 1) + round(0.1, 1) + round(0.1, 1) == round(0.3, 1)
     False

数値を意図した正確な値に近づけることはできませんが、 *note
math.isclose(): fb0. 関数は不正確な値を比べるのに便利です:

     >>> math.isclose(0.1 + 0.1 + 0.1, 0.3)
     True

あるいは、 *note round(): 14f2. 関数を粗い近似値比較に使うこともできます
:

     >>> round(math.pi, ndigits=2) == round(22 / 7, ndigits=2)
     True

このように2進数の浮動小数点の演算には多くの驚きがあります。「0.1」の問題
について詳しい説明は、「表現エラー」セクションで行います。2進数の浮動小
数点の仕組みと、実際によく遭遇する問題各種についての分かりやすい概要は、
Examples of Floating Point Problems(1) を参照してください。その他よくあ
る驚きの より詳細な説明は The Perils of Floating Point(2) も参照してくだ
さい。

究極的にいうと、"容易な答えはありません"。ですが、浮動小数点数のことを過
度に警戒しないでください！ Python の float 型操作におけるエラーは浮動小
数点処理ハードウェアから受けついたものであり、ほとんどのマシン上では一つ
の演算あたり高々 2**53 分の 1 です。この誤差はほとんどの作業で充分以上の
ものですが、浮動小数点演算は 10 進の演算ではなく、浮動小数点の演算を新た
に行うと、新たな丸め誤差の影響を受けることを心にとどめておいてください。

異常なケースが存在する一方で、普段の浮動小数点演算の利用では、単に最終的
な結果の値を必要な 10 進の桁数に丸めて表示するのなら、最終的には期待通り
の結果を得ることになるでしょう。たいては *note str(): 169. で十分ですが
、きめ細かな制御をしたければ、 *note 書式指定文字列の文法: 15b3. にある
*note str.format(): 833. メソッドのフォーマット仕様を参照してください。

正確な10進数表現が必要となるような場合には、 *note decimal: 3a. モジュー
ルを利用してみてください。このモジュールは会計アプリケーションや高精度の
計算が求められるアプリケーションに適した、10進数の計算を実装しています。

別の正確な計算方法として、 *note fractions: 61. モジュールが有理数に基づ
く計算を実装しています (1/3 のような数を正確に表すことができます)。

あなたが浮動小数点演算のヘビーユーザーなら、SciPy プロジェクトが提供して
いる NumPy パッケージやその他の数学用パッケージを調べてみるべきです。
<‘https://scipy.org’> を参照してください。

Python は '本当に' float の正確な値が必要なレアケースに対応するためのツ
ールを提供しています。 *note float.as_integer_ratio(): 2102. メソッドは
float の値を有理数として表現します:

     >>> x = 3.14159
     >>> x.as_integer_ratio()
     (3537115888337719, 1125899906842624)

この分数は正確なので、元の値を完全に復元することができます:

     >>> x == 3537115888337719 / 1125899906842624
     True

*note float.hex(): 2103. メソッドは float の値を16進数で表現します。この
値もコンピューターが持っている正確な値を表現できます:

     >>> x.hex()
     '0x1.921f9f01b866ep+1'

この正確な16進数表現はもとの float 値を正確に復元するために使うことがで
きます:

     >>> x == float.fromhex('0x1.921f9f01b866ep+1')
     True

この16進数表現は正確なので、値を (プラットフォームにも依存せず) バージョ
ンの異なるPython 間でやり取りしたり、他のこのフォーマットをサポートした
言語 (Java や C99 など) と正確にやり取りするのに利用することができます。

別の便利なツールとして、合計処理における精度のロスを緩和してくれる *note
sum(): 695. 関数があります。これは累計加算中の丸めに拡張精度を使います。
これにより、誤差が最終的な合計値に影響を与えるまで蓄積されなくなり、結果
が改善されます:

     >>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0
     False
     >>> sum([0.1] * 10) == 1.0
     True

The *note math.fsum(): 15ed. goes further and tracks all of the "lost
digits" as values are added onto a running total so that the result has
only a single rounding.  This is slower than *note sum(): 695. but will
be more accurate in uncommon cases where large magnitude inputs mostly
cancel each other out leaving a final sum near zero:

     >>> arr = [-0.10430216751806065, -266310978.67179024, 143401161448607.16,
     ...        -143401161400469.7, 266262841.31058735, -0.003244936839808227]
     >>> float(sum(map(Fraction, arr)))   # Exact summation with single rounding
     8.042173697819788e-13
     >>> math.fsum(arr)                   # Single rounding
     8.042173697819788e-13
     >>> sum(arr)                         # Multiple roundings in extended precision
     8.042178034628478e-13
     >>> total = 0.0
     >>> for x in arr:
     ...     total += x                   # Multiple roundings in standard precision
     ...
     >>> total                            # Straight addition has no correct digits!
     -0.0051575902860057365

* Menu:

* 表現エラー::

   ---------- Footnotes ----------

   (1) 
https://jvns.ca/blog/2023/01/13/examples-of-floating-point-problems/

   (2) http://www.indowsway.com/floatingpoint.htm


File: python.info,  Node: 表現エラー,  Up: 浮動小数点演算、その問題と制限

2.15.1 表現エラー
-----------------

この章では、"0.1" の例について詳細に説明し、このようなケースに対してどの
ようにすれば正確な分析を自分で行えるかを示します。ここでは、 2 進法表現
の浮動小数点数についての基礎的な知識があるものとして話を進めます。

表現エラー('Representation error')は、いくつかの (実際にはほとんどの) 10
進の小数が 2 進法 (基数 2)の分数として表現できないという事実に関係してい
ます。これは Python (あるいは Perl, C, C++, Java, Fortran.  およびその他
多く) が期待通りの正確な 10 進数を表示できない主要な理由です。

なぜそうなるのでしょう？ 1/10 は２進法の小数で厳密に表現できません。少な
くとも2000年以降、ほぼすべてのマシンは IEEE 754 2進数の浮動小数点演算を
用いており、ほぼすべてのプラットフォームでは Python の浮動小数点を IEEE
754 binary64 "倍精度 (double precision)" 値に対応付けます。 IEEE 754
binary64 値は 53 ビットの精度を持つため、計算機に入力を行おうとすると、
可能な限り 0.1 を最も近い値の分数に変換し、'J'/2**'N' の形式にしようと努
力します。'J' はちょうど 53 ビットの精度の整数です。

     1 / 10 ~= J / (2**N)

を書き直すと

     J ~= 2**N / 10

となります。 'J' は厳密に 53 ビットの精度を持っている (‘>= 2**52’ だが
‘< 2**53’ ) ことを思い出すと、 'N' として最適な値は 56 になります:

     >>> 2**52 <=  2**56 // 10  < 2**53
     True

すなわち、56 は 'J' をちょうど 53 ビットの精度のままに保つ 'N' の唯一の
値です。'J' の取りえる値はその商を丸めたものです:

     >>> q, r = divmod(2**56, 10)
     >>> r
     6

剰余が 10 の半分以上なので、最良の近似は切り上げて丸めたものになります。
:

     >>> q+1
     7205759403792794

従って、IEEE 754の倍精度における 1/10 の取りえる最良の近似は:

     7205759403792794 / 2 ** 56

分子と分母を2で割って分数を小さくします:

     3602879701896397 / 2 ** 55

丸めたときに切り上げたので、この値は実際には 1/10 より少し大きいことに注
目してください。 もし切り捨てをした場合は、商は 1/10 よりもわずかに小さ
くなります。どちらにしろ '厳密な' 1/10 ではありません！

つまり、計算機は 1/10 を "理解する" ことは決してありません。計算機が理解
できるのは、上記のような厳密な分数であり、IEEE 754 の倍精度浮動小数点数
で得られるもっともよい近似は以下になります:

     >>> 0.1 * 2 ** 55
     3602879701896397.0

この分数に 10**55 を掛ければ、55 桁の十進数の値を見ることができます:

     >>> 3602879701896397 * 10 ** 55 // 2 ** 55
     1000000000000000055511151231257827021181583404541015625

これは、計算機が記憶している正確な数値が、10 進数値
0.1000000000000000055511151231257827021181583404541015625 にほぼ等しいと
いうことです。多くの言語 (古いバージョンの Python を含む) では、完全な
10 進値を表示するのではなく、結果を有効数字 17 桁に丸めます:

     >>> format(0.1, '.17f')
     '0.10000000000000001'

*note fractions: 61. モジュールと *note decimal: 3a. モジュールを使うと
これらの計算を簡単に行えます:

     >>> from decimal import Decimal
     >>> from fractions import Fraction

     >>> Fraction.from_float(0.1)
     Fraction(3602879701896397, 36028797018963968)

     >>> (0.1).as_integer_ratio()
     (3602879701896397, 36028797018963968)

     >>> Decimal.from_float(0.1)
     Decimal('0.1000000000000000055511151231257827021181583404541015625')

     >>> format(Decimal.from_float(0.1), '.17')
     '0.10000000000000001'


File: python.info,  Node: 付録,  Prev: 浮動小数点演算、その問題と制限,  Up: Python チュートリアル

2.16 付録
=========

* Menu:

* 対話モード: 対話モード<2>.


File: python.info,  Node: 対話モード<2>,  Up: 付録

2.16.1 対話モード
-----------------

対話型の *note REPL: 491. は2種類あります。 クラシックな基本インタープリ
タは最低限の行制御機能を持つ全プラットフォームでサポートされています。

Since Python 3.13, a new interactive shell is used by default.  This one
supports color, multiline editing, history browsing, and paste mode.  To
disable color, see *note 色の制御: 1b7. for details.  Function keys
provide some additional functionality.  ‘F1’ enters the interactive help
browser *note pydoc: ba.  ‘F2’ allows for browsing command-line history
with neither output nor the *note >>>: 492. and *note ...: 493. prompts.
‘F3’ enters "paste mode", which makes pasting larger blocks of code
easier.  Press ‘F3’ to return to the regular prompt.

新しい対話型シェルでは、 ‘exit’ または ‘quit’ と打ってシェルを終えます。
これらのコマンドの後に呼び出し括弧を追加する必要はありません。

新しい対話型シェルを望まない場合は、環境変数 *note PYTHON_BASIC_REPL:
1b6. で無効にできます。

* Menu:

* エラー処理::
* 実行可能な Python スクリプト::
* 対話モード用の起動時実行ファイル::
* カスタマイズ用モジュール::


File: python.info,  Node: エラー処理,  Next: 実行可能な Python スクリプト,  Up: 対話モード<2>

2.16.1.1 エラー処理
...................

エラーが発生すると、インタープリタはエラーメッセージとスタックトレースを
表示します。対話モードでは、それから元のプロンプトに戻ります; ファイルか
ら実行した場合は、スタックトレースを表示してゼロ以外の終了ステータスで終
了します（*note try: 8f8. 文の *note except: 1ab. 節で処理された例外は、
ここでいうエラーにはあたりません。）一部のエラーは無条件に致命的であり、
ゼロ以外の終了ステータスで終了します; これは内部の不整合やある種のメモリ
不足の場合に適用されます。エラーメッセージは全て標準エラー出力に書き込ま
れます; これに対して、通常は実行した命令から出力される内容は標準出力に書
き込まれます。

割り込み文字 (interrupt character、普通は ‘Control’-‘C’ か ‘Delete’) を
一次または二次プロンプトに対してタイプすると、入力が取り消されて一次プロ
ンプトに戻ります。 (1) コマンドの実行中に割り込み文字をタイプすると
*note KeyboardInterrupt: bc5. 例外が送出されます。この例外は *note try:
8f8. 文で処理できます。

   ---------- Footnotes ----------

   (1) GNU Readline パッケージに関する問題のせいで妨げられることがありま
す。


File: python.info,  Node: 実行可能な Python スクリプト,  Next: 対話モード用の起動時実行ファイル,  Prev: エラー処理,  Up: 対話モード<2>

2.16.1.2 実行可能な Python スクリプト
.....................................

BSD 風の Unix システムでは、Python スクリプトはシェルスクリプトのように
直接実行可能にできます。これを行うには、以下の行

     #!/usr/bin/env python3

(ここではインタプリタがユーザの ‘PATH’ 上にあると仮定しています) をスク
リプトの先頭に置き、スクリプトファイルに実行可能モードを設定します。
‘#!’ はファイルの最初の２文字でなければなりません。プラットフォームによ
っては、この最初の行を終端する改行文字が Windows 形式 (‘'\r\n'’) ではな
く、 Unix形式(‘'\n'’)でなければならないことがあります。ハッシュまたはポ
ンド文字、すなわち ‘'#'’ は、Python ではコメントを書き始めるために使われ
ていることに注意してください。

‘chmod’ コマンドを使えば、スクリプトに実行モードや実行権限を与えることが
できます。

     $ chmod +x myscript.py

Windows では、"実行モード" のような概念はありません。Python のインストー
ラーは自動的に ‘.py’ ファイルを ‘python.exe’ に関連付けるので、Python フ
ァイルをダブルクリックするとそれをスクリプトとして実行します。‘.pyw’ 拡
張子も(訳注: ‘pythonw.exe’ に)関連付けられ、通常コンソールウィンドウを抑
制して実行します。


File: python.info,  Node: 対話モード用の起動時実行ファイル,  Next: カスタマイズ用モジュール,  Prev: 実行可能な Python スクリプト,  Up: 対話モード<2>

2.16.1.3 対話モード用の起動時実行ファイル
.........................................

Python を対話的に使うときには、インタプリタが起動する度に実行される何ら
かの標準的なコマンドがあると便利なことがよくあります。これを行うには、
*note PYTHONSTARTUP: 1b8. と呼ばれる環境変数を、インタプリタ起動時に実行
されるコマンドが入ったファイル名に設定します。この機能は Unix シェルの
‘.profile’ に似ています。

このファイルは対話セッションのときだけ読み出されます。 Python がコマンド
をスクリプトから読み出しているときや、 ‘/dev/tty’ がコマンドの入力元とし
て明示的に指定されている(この場合対話的セッションのように動作します) 'わ
けではない' 場合にはこのファイルは読み出されません。ファイル内のコマンド
は、対話的コマンドが実行される名前空間と同じ名前空間内で実行されます。こ
のため、ファイル内で定義されていたり import されたオブジェクトは、そのま
ま対話セッション内で使うことができます。また、このファイル内で ‘sys.ps1’
や ‘sys.ps2’ を変更して、プロンプトを変更することもできます。

もし現在のディレクトリから追加でスタートアップファイルを読み出したいのな
ら、グローバルのスタートアップファイルの中に ‘if
os.path.isfile('.pythonrc.py'): exec(open('.pythonrc.py').read())’ のよ
うなプログラムを書くことができます。スクリプト中でスタートアップファイル
を使いたいのなら、以下のようにしてスクリプト中で明示的に実行しなければな
りません:

     import os
     filename = os.environ.get('PYTHONSTARTUP')
     if filename and os.path.isfile(filename):
         with open(filename) as fobj:
             startup_file = fobj.read()
         exec(startup_file)


File: python.info,  Node: カスタマイズ用モジュール,  Prev: 対話モード用の起動時実行ファイル,  Up: 対話モード<2>

2.16.1.4 カスタマイズ用モジュール
.................................

Python はユーザーが Python をカスタマイズするための2つのフック、
sitecustomize と usercustomize を提供しています。これがどのように動作し
ているかを知るには、まずはユーザーの site-packages ディレクトリの場所を
見つける必要があります。Python を起動して次のコードを実行してください:

     >>> import site
     >>> site.getusersitepackages()
     '/home/user/.local/lib/python3.x/site-packages'

‘usercustomize.py’ をそのディレクトリに作成して、そこでやりたいことをす
べて書くことができます。このファイルは自動インポートを無効にする *note
-s: 15a6. オプションを使わない限り、全ての Python の起動時に実行されます
。

sitecustomize モジュールも同じように動作しますが、一般的にコンピューター
の管理者によって、グローバルの site-packages ディレクトリに作成され、
usercustomize より先にインポートされます。詳細は *note site: cc. モジュ
ールのドキュメントを参照してください。

脚注
....


File: python.info,  Node: Python のセットアップと利用,  Next: Python 言語リファレンス,  Prev: Python チュートリアル,  Up: Top

3 Python のセットアップと利用
*****************************

このドキュメントでは 異なるプラットフォームでのPython環境のセットアップ
の一般的な方法、インタプリタの起動とPythonでの作業を楽にする方法を説明し
ます。

* Menu:

* コマンドラインと環境: コマンドラインと環境<2>.
* Unix プラットフォームで Python を使う::
* Python を構成する::
* Windows で Python を使う::
* macOS で Python を使う::
* Android で Python を使う::
* iOS で Python を使う::
* エディタと IDE::


File: python.info,  Node: コマンドラインと環境<2>,  Next: Unix プラットフォームで Python を使う,  Up: Python のセットアップと利用

3.1 コマンドラインと環境
========================

CPython インタプリタはコマンドラインと環境を読み取って様々な設定を行ない
ます。

他の実装のコマンドラインスキームは CPython とは異なります。さらなる情報
は *note 別のPythonの実装: 2118. を参照してください。

* Menu:

* コマンドライン::
* 環境変数::


File: python.info,  Node: コマンドライン,  Next: 環境変数,  Up: コマンドラインと環境<2>

3.1.1 コマンドライン
--------------------

Python を起動するとき、以下のうち任意のオプションを指定できます:

     python [-bBdEhiIOPqRsSuvVWx?] [-c command | -m module-name | script | - ] [args]

もちろん、もっとも一般的な利用方法は、単純にスクリプトを起動することです
:

     python myscript.py

* Menu:

* インターフェイスオプション::
* 一般オプション::
* その他のオプション::
* 色の制御::


File: python.info,  Node: インターフェイスオプション,  Next: 一般オプション,  Up: コマンドライン

3.1.1.1 インターフェイスオプション
..................................

インタプリタのインターフェイスは UNIX シェルのものに似ていますが、より多
くの起動方法を提供しています:

   * When called with standard input connected to a tty device, it
     prompts for commands and executes them until an EOF (an end-of-file
     character, you can produce that with ‘Ctrl’-‘D’ on UNIX or
     ‘Ctrl’-‘Z,’ ‘Enter’ on Windows) is read.  For more on interactive
     mode, see *note 対話モード: 494.

   * ファイル名引数か、標準入力としてファイルを渡された場合、そのファイ
     ルからスクリプトを読み込んで実行します。

   * ディレクトリ名を引数に受け取った場合、そのディレクトリから適切な名
     前のスクリプトファイルを読み込んで実行します。

   * ‘-c コマンド’ オプションを利用して起動された場合、 'コマンド' とし
     て渡された Python の文を実行します。 'コマンド' の部分には改行で区
     切られた複数行を指定することもできます。行の先頭の空白文字は Python
     文の重要要素です！

   * ‘-m モジュール名’ として Python モジュールパスにあるモジュールを指
     定された場合、そのモジュールをスクリプトとして実行します。

非インタラクティブモードでは、入力の全体が実行前にパースされます。

インタプリタによって消費されるオプションリストが終了したあと、継続する全
ての引数は *note sys.argv: 147c. に渡ります。 - ただし、添字 0 の先頭要
素(‘sys.argv[0]’) はプログラムのソース自体を示す文字列です。

 -- Option: -c <command>

     'command' 内の Python コードを実行します。 'command' は改行によって
     区切られた1行以上の文です。通常のモジュールのコードと同じく、行頭の
     空白文字は意味を持ちます。

     このオプションが指定された場合、 *note sys.argv: 147c. の最初の要素
     は ‘"-c"’ になり、カレントディレクトリが *note sys.path: 3e4. の先
     頭に追加されます (そのディレクトリにあるモジュールをトップレベルモ
     ジュールとして import 出来るようになります)。

     引数 ‘command’ を指定して *note 監査イベント: 1c6e.
     ‘cpython.run_command’ を送出します。

     バージョン 3.14 で変更: 'command' is automatically dedented before
     execution.

 -- Option: -m <module-name>

     *note sys.path: 3e4. から指定されたモジュール名のモジュールを探し、
     その内容を *note __main__: 1. モジュールとして実行します。

     引数は 'module' 名なので、拡張子 (‘.py’) を含めてはいけません。モジ
     ュール名は有効な Python の絶対モジュール名 (absolute module name) で
     あるべきですが、実装がそれを強制しているとは限りません (例えば、ハ
     イフンを名前に含める事を許可するかもしれません)。

     パッケージ名 (名前空間パッケージも含む) でも構いません。通常のモジ
     ュールの代わりにパッケージ名が与えられた場合、インタプリタは
     ‘<pkg>.__main__’ を main モジュールとして実行します。この挙動はスク
     リプト引数として渡されたディレクトリや zip ファイルをインタプリタが
     処理するのと意図的に同じにしています。

          注釈: このオプションは組み込みモジュールや C で書かれた拡張モ
          ジュールには利用できません。 Python モジュールファイルを持って
          いないからです。しかし、コンパイル済みのモジュールは、たとえ元
          のソースファイルがなくても利用可能です。

     このオプションが指定された場合、 *note sys.argv: 147c. の最初の要素
     はモジュールファイルのフルパスになります (モジュールファイルを検索
     している間、最初の要素は ‘"-m"’ に設定されます)。 *note -c: 1a8. オ
     プションと同様に、カレントディレクトリが *note sys.path: 3e4. の先
     頭に追加されます。

     *note -I: b57. option can be used to run the script in isolated
     mode where *note sys.path: 3e4. contains neither the current
     directory nor the user's site-packages directory.  All ‘PYTHON*’
     environment variables are ignored, too.

     多くの標準ライブラリモジュールにはスクリプトとして実行された時のた
     めのコードがあります。例えば、 *note timeit: f5. モジュールは次のよ
     うに実行可能です:

          python -m timeit -s "setup here" "benchmarked code here"
          python -m timeit -h # for details

     引数 ‘module-name’ を指定して *note 監査イベント: 1c6e.
     ‘cpython.run_module’ を送出します。

     参考
     ....

     *note runpy.run_module(): 1b97.

          Python コードで直接使える等価な機能

     PEP 338(1) - モジュールをスクリプトとして実行する

     バージョン 3.1 で変更: ‘__main__’ サブモジュールを実行するパッケー
     ジ名が提供されました。

     バージョン 3.4 で変更: 名前空間パッケージもサポートされました

 -- Describe: -

     標準入力 (*note sys.stdin: 75f.) からコマンドを読み込みます。標準入
     力がターミナルだった場合、暗黙的に *note -i: 16f4. オプションが指定
     されます。

     このオプションが指定された場合、 *note sys.argv: 147c. の最初の要素
     は ‘"-"’ で、カレントディレクトリが *note sys.path: 3e4. の先頭に追
     加されます。

     引数無しで *note 監査イベント: 1c6e. ‘cpython.run_stdin’ を送出しま
     す。

 -- Describe: <script>

     'script' 内の Python コードを実行します。 'script' は、Python ファ
     イル、 ‘__main__.py’ ファイルがあるディレクトリ、 ‘__main__.py’ フ
     ァイルがある zip ファイルのいずれかの、ファイルシステム上の (絶対ま
     たは相対) パスでなければなりません。

     このオプションが指定された場合、 *note sys.argv: 147c. の最初の要素
     はコマンドラインで指定されたスクリプト名になります。

     スクリプト名が Python ファイルを直接指定していた場合、そのファイル
     を含むディレクトリが *note sys.path: 3e4. の先頭に追加され、そのフ
     ァイルは *note __main__: 1. モジュールとして実行されます。

     スクリプト名がディレクトリか zip ファイルを指定していた場合、スクリ
     プト名が *note sys.path: 3e4. に追加され、その中の ‘__main__.py’ フ
     ァイルが *note __main__: 1. モジュールとして実行されます。

     *note -I: b57. option can be used to run the script in isolated
     mode where *note sys.path: 3e4. contains neither the script's
     directory nor the user's site-packages directory.  All ‘PYTHON*’
     environment variables are ignored, too.

     引数 ‘filename’ を指定して *note 監査イベント: 1c6e.
     ‘cpython.run_file’ を送出します。

     参考
     ....

     *note runpy.run_path(): 4a4.

          Python コードで直接使える等価な機能

インターフェイスオプションが与えられなかった場合、*note -i: 16f4. が暗黙
的に指定され、‘sys.argv[0]’ が空の文字列 (‘""’) になり、 現在のディレク
トリが *note sys.path: 3e4. の先頭に追加されます。また、利用可能であれば
タブ補完と履歴編集が自動的に有効化されます (*note readline の設定: 11cb.
を参照してください)。

参考
....

*note インタプリタを起動する: 1fc8.

バージョン 3.4 で変更: タブ補完と履歴の編集が自動的に有効化されます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0338/


File: python.info,  Node: 一般オプション,  Next: その他のオプション,  Prev: インターフェイスオプション,  Up: コマンドライン

3.1.1.2 一般オプション
......................

 -- Option: -?
 -- Option: -h
 -- Option: --help

     Print a short description of all command line options and
     corresponding environment variables and exit.

 -- Option: --help-env

     Print a short description of Python-specific environment variables
     and exit.

     Added in version 3.11.

 -- Option: --help-xoptions

     Print a description of implementation-specific *note -X: 16f.
     options and exit.

     Added in version 3.11.

 -- Option: --help-all

     Print complete usage information and exit.

     Added in version 3.11.

 -- Option: -V
 -- Option: --version

     Python のバージョン番号を表示して終了します。出力の例:

          Python 3.8.0b2+

     2つ指定すると、次のようにより多くのビルドの情報を表示します:

          Python 3.8.0b2+ (3.8:0c076caaa8, Apr 20 2019, 21:55:00)
          [GCC 6.2.0 20161005]

     Added in version 3.6: ‘-VV’ オプション。


File: python.info,  Node: その他のオプション,  Next: 色の制御,  Prev: 一般オプション,  Up: コマンドライン

3.1.1.3 その他のオプション
..........................

 -- Option: -b

     Issue a warning when converting *note bytes: 192. or *note
     bytearray: 344. to *note str: 169. without specifying encoding or
     comparing ‘bytes’ or ‘bytearray’ with ‘str’ or ‘bytes’ with *note
     int: 19b.  Issue an error when the option is given twice (‘-bb’).

     バージョン 3.5 で変更: Affects also comparisons of *note bytes:
     192. with *note int: 19b.

 -- Option: -B

     与えられた場合、Python はソースモジュールのインポート時に ‘.pyc’ フ
     ァイルの作成を試みません。 *note PYTHONDONTWRITEBYTECODE: 15e7. 環
     境変数も参照してください。

 -- Option: --check-hash-based-pycs default|always|never

     Control the validation behavior of hash-based ‘.pyc’ files.  See
     *note キャッシュされたバイトコードの無効化: 802.  When set to
     ‘default’, checked and unchecked hash-based bytecode cache files
     are validated according to their default semantics.  When set to
     ‘always’, all hash-based ‘.pyc’ files, whether checked or
     unchecked, are validated against their corresponding source file.
     When set to ‘never’, hash-based ‘.pyc’ files are not validated
     against their corresponding source files.

     The semantics of timestamp-based ‘.pyc’ files are unaffected by
     this option.

 -- Option: -d

     Turn on parser debugging output (for expert only).  See also the
     *note PYTHONDEBUG: 2124. environment variable.

     This option requires a *note debug build of Python: 509, otherwise
     it's ignored.

 -- Option: -E

     Ignore all ‘PYTHON*’ environment variables, e.g.  *note PYTHONPATH:
     121f. and *note PYTHONHOME: 3f0, that might be set.

     See also the *note -P: 7c1. and *note -I: b57. (isolated) options.

 -- Option: -i

     Enter interactive mode after execution.

     Using the *note -i: 16f4. option will enter interactive mode in any
     of the following circumstances:

        * When a script is passed as first argument

        * When the *note -c: 1a8. option is used

        * When the *note -m: 23c. option is used

     Interactive mode will start even when *note sys.stdin: 75f. does
     not appear to be a terminal.  The *note PYTHONSTARTUP: 1b8. file is
     not read.

     このオプションはグローバル変数や、スクリプトが例外を発生させるとき
     にそのスタックトレースを調べるのに便利です。 *note PYTHONINSPECT:
     16f3. も参照してください。

 -- Option: -I

     Python を隔離モードで実行します。*note -E: b56.、*note -P: 7c1.、お
     よび *note -s: 15a6. オプションも暗黙的に指定されます。

     In isolated mode *note sys.path: 3e4. contains neither the script's
     directory nor the user's site-packages directory.  All ‘PYTHON*’
     environment variables are ignored, too.  Further restrictions may
     be imposed to prevent the user from injecting malicious code.

     Added in version 3.4.

 -- Option: -O

     Remove assert statements and any code conditional on the value of
     *note __debug__: 9da.  Augment the filename for compiled (*note
     bytecode: 4aa.) files by adding ‘.opt-1’ before the ‘.pyc’
     extension (see PEP 488(1)).  See also *note PYTHONOPTIMIZE: 2125.

     バージョン 3.5 で変更: PEP 488(2) に従って ‘.pyc’ ファイル名を変更
     します。

 -- Option: -OO

     Do *note -O: 18c. and also discard docstrings.  Augment the
     filename for compiled (*note bytecode: 4aa.) files by adding
     ‘.opt-2’ before the ‘.pyc’ extension (see PEP 488(3)).

     バージョン 3.5 で変更: PEP 488(4) に従って ‘.pyc’ ファイル名を変更
     します。

 -- Option: -P

     Don't prepend a potentially unsafe path to *note sys.path: 3e4.:

        * ‘python -m module’ command line: Don't prepend the current
          working directory.

        * ‘python script.py’ command line: Don't prepend the script's
          directory.  If it's a symbolic link, resolve symbolic links.

        * ‘python -c code’ and ‘python’ (REPL) command lines: Don't
          prepend an empty string, which means the current working
          directory.

     See also the *note PYTHONSAFEPATH: 7c2. environment variable, and
     *note -E: b56. and *note -I: b57. (isolated) options.

     Added in version 3.11.

 -- Option: -q

     インタラクティブモードでも copyright とバージョンのメッセージを表示
     しません。

     Added in version 3.2.

 -- Option: -R

     Turn on hash randomization.  This option only has an effect if the
     *note PYTHONHASHSEED: 1289. environment variable is set to anything
     other than ‘random’, since hash randomization is enabled by
     default.

     On previous versions of Python, this option turns on hash
     randomization, so that the *note __hash__(): cf3. values of str and
     bytes objects are "salted" with an unpredictable random value.
     Although they remain constant within an individual Python process,
     they are not predictable between repeated invocations of Python.

     Hash randomization is intended to provide protection against a
     denial-of-service caused by carefully chosen inputs that exploit
     the worst case performance of a dict construction, 'O'('n'^2)
     complexity.  See ‘http://ocert.org/advisories/ocert-2011-003.html’
     for details.

     *note PYTHONHASHSEED: 1289. によってハッシュシードの固定値を秘密に
     することが出来ます。

     Added in version 3.2.3.

     バージョン 3.7 で変更: このオプションが無視されなくなりました.

 -- Option: -s

     *note ユーザのサイトパッケージのディレクトリ: 2126. を *note
     sys.path: 3e4. に追加しません。

     See also *note PYTHONNOUSERSITE: 15a7.

     参考
     ....

     PEP 370(5) - ユーザごとの ‘site-packages’ ディレクトリ

 -- Option: -S

     *note site: cc. モジュールの import と、そのモジュールが行なってい
     た site ごとの *note sys.path: 3e4. への操作を無効にします。後で
     *note site: cc. を明示的に import しても、これらの操作は実行されま
     せん (実行したい場合は、 *note site.main(): 2127. を呼び出してくだ
     さい)。

 -- Option: -u

     Force the stdout and stderr streams to be unbuffered.  This option
     has no effect on the stdin stream.

     *note PYTHONUNBUFFERED: 1d8e. も参照してください。

     バージョン 3.7 で変更: The text layer of the stdout and stderr
     streams now is unbuffered.

 -- Option: -v

     モジュールが初期化されるたびにメッセージを出力し、それがどこ (ファ
     イル名やビルトインモジュール) からロードされたのかを表示します。 二
     回与えられた場合 (‘-vv’) は、モジュールを検索するときにチェックした
     ファイルごとにメッセージを出力します。また、終了時のモジュールクリ
     ーンアップに関する情報も提供します。

     バージョン 3.10 で変更: The *note site: cc. module reports the
     site-specific paths and ‘.pth’ files being processed.

     *note PYTHONVERBOSE: 2128. も参照してください。

 -- Option: -W arg

     警告制御。 Python の警告機構はデフォルトでは警告メッセージを *note
     sys.stderr: b33. に表示します。

     The simplest settings apply a particular action unconditionally to
     all warnings emitted by a process (even those that are otherwise
     ignored by default):

          -Wdefault  # Warn once per call location
          -Werror    # Convert to exceptions
          -Walways   # Warn every time
          -Wall      # Same as -Walways
          -Wmodule   # Warn once per calling module
          -Wonce     # Warn once per Python process
          -Wignore   # Never warn

     The action names can be abbreviated as desired and the interpreter
     will resolve them to the appropriate action name.  For example,
     ‘-Wi’ is the same as ‘-Wignore’.

     引数の完全形は次のようになります:

          action:message:category:module:lineno

     Empty fields match all values; trailing empty fields may be
     omitted.  For example ‘-W ignore::DeprecationWarning’ ignores all
     DeprecationWarning warnings.

     The 'action' field is as explained above but only applies to
     warnings that match the remaining fields.

     The 'message' field must match the whole warning message; this
     match is case-insensitive.

     The 'category' field matches the warning category (ex:
     ‘DeprecationWarning’).  This must be a class name; the match test
     whether the actual warning category of the message is a subclass of
     the specified warning category.

     The 'module' field matches the (fully qualified) module name; this
     match is case-sensitive.

     The 'lineno' field matches the line number, where zero matches all
     line numbers and is thus equivalent to an omitted line number.

     複数の *note -W: ac6. オプションを指定することができます。警告が1つ
     以上のオプションとマッチしたときは、最後にマッチしたオプションのア
     クションが有効になります。不正な *note -W: ac6. オプションは無視さ
     れます (最初の警告が発生したときに、不正なオプションに対する警告メ
     ッセージが表示されます)。

     Warnings can also be controlled using the *note PYTHONWARNINGS:
     da3. environment variable and from within a Python program using
     the *note warnings: 118. module.  For example, the *note
     warnings.filterwarnings(): 16c2. function can be used to use a
     regular expression on the warning message.

     詳しくは *note 警告フィルタ: 1b1. と *note Describing Warning
     Filters: 212a. を参照してください。

 -- Option: -x

     Unix 以外の形式の ‘#!cmd’ を使うために、ソースの最初の行をスキップ
     します。これは、DOS専用のハックのみを目的としています。

 -- Option: -X

     様々な実装固有のオプションのために予約されています。現在のところ
     CPython は以下の値を定義しています:

        * ‘-X faulthandler’ to enable *note faulthandler: 5c.  See also
          *note PYTHONFAULTHANDLER: 1291.

          Added in version 3.3.

        * ‘-X showrefcount’ to output the total reference count and
          number of used memory blocks when the program finishes or
          after each statement in the interactive interpreter.  This
          only works on *note debug builds: 509.

          Added in version 3.4.

        * ‘-X tracemalloc’ to start tracing Python memory allocations
          using the *note tracemalloc: 105. module.  By default, only
          the most recent frame is stored in a traceback of a trace.
          Use ‘-X tracemalloc=NFRAME’ to start tracing with a traceback
          limit of 'NFRAME' frames.  See *note tracemalloc.start():
          212c. and *note PYTHONTRACEMALLOC: 212d. for more information.

          Added in version 3.4.

        * ‘-X int_max_str_digits’ configures the *note integer string
          conversion length limitation: 80b.  See also *note
          PYTHONINTMAXSTRDIGITS: 1b3a.

          Added in version 3.11.

        * ‘-X importtime’ to show how long each import takes.  It shows
          module name, cumulative time (including nested imports) and
          self time (excluding nested imports).  Note that its output
          may be broken in multi-threaded application.  Typical usage is
          ‘python -X importtime -c 'import asyncio'’.

          ‘-X importtime=2’ enables additional output that indicates
          when an imported module has already been loaded.  In such
          cases, the string ‘cached’ will be printed in both time
          columns.

          See also *note PYTHONPROFILEIMPORTTIME: ced.

          Added in version 3.7.

          バージョン 3.14 で変更: Added ‘-X importtime=2’ to also trace
          imports of loaded modules, and reserved values other than ‘1’
          and ‘2’ for future use.

        * ‘-X dev’: enable *note Python Development Mode: 508,
          introducing additional runtime checks that are too expensive
          to be enabled by default.  See also *note PYTHONDEVMODE: ce7.

          Added in version 3.7.

        * ‘-X utf8’ enables the *note Python UTF-8 Mode: 866.  ‘-X
          utf8=0’ explicitly disables *note Python UTF-8 Mode: 866.
          (even when it would otherwise activate automatically).  See
          also *note PYTHONUTF8: ccf.

          Added in version 3.7.

        * ‘-X pycache_prefix=PATH’ enables writing ‘.pyc’ files to a
          parallel tree rooted at the given directory instead of to the
          code tree.  See also *note PYTHONPYCACHEPREFIX: b9b.

          Added in version 3.8.

        * ‘-X warn_default_encoding’ issues a *note EncodingWarning:
          212e. when the locale-specific default encoding is used for
          opening files.  See also *note PYTHONWARNDEFAULTENCODING: 9bf.

          Added in version 3.10.

        * ‘-X no_debug_ranges’ disables the inclusion of the tables
          mapping extra location information (end line, start column
          offset and end column offset) to every instruction in code
          objects.  This is useful when smaller code objects and pyc
          files are desired as well as suppressing the extra visual
          location indicators when the interpreter displays tracebacks.
          See also *note PYTHONNODEBUGRANGES: 7d3.

          Added in version 3.11.

        * ‘-X frozen_modules’ determines whether or not frozen modules
          are ignored by the import machinery.  A value of ‘on’ means
          they get imported and ‘off’ means they are ignored.  The
          default is ‘on’ if this is an installed Python (the normal
          case).  If it's under development (running from the source
          tree) then the default is ‘off’.  Note that the
          ‘importlib_bootstrap’ and ‘importlib_bootstrap_external’
          frozen modules are always used, even if this flag is set to
          ‘off’.  See also *note PYTHON_FROZEN_MODULES: 4ad.

          Added in version 3.11.

        * ‘-X perf’ enables support for the Linux ‘perf’ profiler.  When
          this option is provided, the ‘perf’ profiler will be able to
          report Python calls.  This option is only available on some
          platforms and will do nothing if is not supported on the
          current system.  The default value is "off".  See also *note
          PYTHONPERFSUPPORT: 699. and *note Python support for the Linux
          perf profiler: 4ae.

          Added in version 3.12.

        * ‘-X perf_jit’ enables support for the Linux ‘perf’ profiler
          with DWARF support.  When this option is provided, the ‘perf’
          profiler will be able to report Python calls using DWARF
          information.  This option is only available on some platforms
          and will do nothing if is not supported on the current system.
          The default value is "off".  See also *note
          PYTHON_PERF_JIT_SUPPORT: 4af. and *note Python support for the
          Linux perf profiler: 4ae.

          Added in version 3.13.

        * ‘-X disable_remote_debug’ disables the remote debugging
          support as described in PEP 768(6).  This includes both the
          functionality to schedule code for execution in another
          process and the functionality to receive code for execution in
          the current process.

          This option is only available on some platforms and will do
          nothing if is not supported on the current system.  See also
          *note PYTHON_DISABLE_REMOTE_DEBUG: 16e. and PEP 768(7).

          Added in version 3.14.

        * ‘-X cpu_count=N’ overrides *note os.cpu_count(): 4db, *note
          os.process_cpu_count(): 4da, and *note
          multiprocessing.cpu_count(): 1171.  'n' must be greater than
          or equal to 1.  This option may be useful for users who need
          to limit CPU resources of a container system.  See also *note
          PYTHON_CPU_COUNT: 51e.  If 'n' is ‘default’, nothing is
          overridden.

          Added in version 3.13.

        * ‘-X presite=PACKAGE.MODULE’ specifies a module that should be
          imported before the *note site: cc. module is executed and
          before the *note __main__: 1. module exists.  Therefore, the
          imported module isn't *note __main__: 1.  This can be used to
          execute code early during Python initialization.  Python needs
          to be *note built in debug mode: 509. for this option to
          exist.  See also *note PYTHON_PRESITE: 212f.

          Added in version 3.13.

        * ‘-X gil=0,1’ forces the GIL to be disabled or enabled,
          respectively.  Setting to ‘0’ is only available in builds
          configured with *note -disable-gil: 499.  See also *note
          PYTHON_GIL: 49a. and *note フリースレッドの CPython: 46d.

          Added in version 3.13.

        * ‘-X thread_inherit_context=0,1’ causes *note Thread: 176. to,
          by default, use a copy of context of the caller of
          ‘Thread.start()’ when starting.  Otherwise, threads will start
          with an empty context.  If unset, the value of this option
          defaults to ‘1’ on free-threaded builds and to ‘0’ otherwise.
          See also *note PYTHON_THREAD_INHERIT_CONTEXT: 1868.

          Added in version 3.14.

        * ‘-X context_aware_warnings=0,1’ causes the *note
          warnings.catch_warnings: 179. context manager to use a *note
          ContextVar: 1875. to store warnings filter state.  If unset,
          the value of this option defaults to ‘1’ on free-threaded
          builds and to ‘0’ otherwise.  See also *note
          PYTHON_CONTEXT_AWARE_WARNINGS: 185b.

          Added in version 3.14.

        * ‘-X tlbc=0,1’ enables (1, the default) or disables (0)
          thread-local bytecode in builds configured with *note
          -disable-gil: 499.  When disabled, this also disables the
          specializing interpreter.  See also *note PYTHON_TLBC: 2130.

          Added in version 3.14.

     任意の値を渡し、 *note sys._xoptions: 2131. 辞書から取り出すことも
     出来ます。

     Added in version 3.2.

     バージョン 3.9 で変更: Removed the ‘-X showalloccount’ option.

     バージョン 3.10 で変更: Removed the ‘-X oldparser’ option.

Removed in version 3.14: ‘-J’ is no longer reserved for use by
Jython(8), and now has no special meaning.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0488/

   (2) https://peps.python.org/pep-0488/

   (3) https://peps.python.org/pep-0488/

   (4) https://peps.python.org/pep-0488/

   (5) https://peps.python.org/pep-0370/

   (6) https://peps.python.org/pep-0768/

   (7) https://peps.python.org/pep-0768/

   (8) https://www.jython.org/


File: python.info,  Node: 色の制御,  Prev: その他のオプション,  Up: コマンドライン

3.1.1.4 色の制御
................

デフォルトでは、 Python インタープリターは、トレースバックの表示などの特
定の状況で、出力を色でハイライトするように構成されています。この振る舞い
は、異なる環境変数を設定することで制御できます。

環境変数 ‘TERM’ を ‘dumb’ に設定することで、色付けを無効にできます。

FORCE_COLOR(1) 環境変数が設定されている場合、 TERM の値にかかわらず、色
付けは有効になります。これは、ターミナルではないが ANSI エスケープシーケ
ンスを表示できる CI システムで有効です。

NO_COLOR(2) 環境変数が設定されている場合、 Python は出力のすべての色を無
効にします。これは ‘FORCE_COLOR’ よりも優先されます。

これらのすべての環境変数は、色の出力の制御のために他のツールにも使用され
ます。 Python インタープリターでのみ色の出力を制御するには、 *note
PYTHON_COLORS: 476. 環境変数を使用できます。この変数は、 ‘FORCE_COLOR’ よ
りも優先される ‘NO_COLOR’ よりも、さらに優先されます。

   ---------- Footnotes ----------

   (1) https://force-color.org/

   (2) https://no-color.org/


File: python.info,  Node: 環境変数,  Prev: コマンドライン,  Up: コマンドラインと環境<2>

3.1.2 環境変数
--------------

以下の環境変数は Python の挙動に影響します。環境変数は -E や -I 以外のコ
マンドラインスイッチの前に処理されます。衝突したときにコマンドラインスイ
ッチが環境変数をオーバーライドするのは慣例です。

 -- 環境変数: PYTHONHOME

     標準 Python ライブラリの場所を変更します。デフォルトでは、ライブラ
     リは ‘`prefix'/lib/python`version'’ と
     ‘`exec_prefix'/lib/python`version'’ から検索されます。ここで、
     ‘`prefix'’ と ‘`exec_prefix'’ はインストール依存のディレクトリで、
     両方共デフォルトでは ‘/usr/local’ です。

     *note PYTHONHOME: 3f0. が1つのディレクトリに設定されている場合、そ
     の値は ‘`prefix'’ と ‘`exec_prefix'’ の両方を置き換えます。それらに
     別々の値を指定したい場合は、 *note PYTHONHOME: 3f0. を
     ‘`prefix':`exec_prefix'’ のように指定します。

 -- 環境変数: PYTHONPATH

     モジュールファイルのデフォルトの検索パスを追加します。この環境変数
     のフォーマットはシェルの ‘PATH’ と同じで、 *note os.pathsep: 2134.
     (Unix ならコロン、 Windows ならセミコロン) で区切られた1つ以上のデ
     ィレクトリパスです。存在しないディレクトリは警告なしに無視されます
     。

     通常のディレクトリに加えて、 *note PYTHONPATH: 121f. のエントリはピ
     ュアPython モジュール(ソース形式でもコンパイルされた形式でも) を含
     む zip ファイルを参照することもできます。拡張モジュールは zip ファ
     イルの中から import することはできません。

     デフォルトの検索パスはインストール依存ですが、通常は
     ‘`prefix'/lib/python`version'’ で始まります。 (上の *note
     PYTHONHOME: 3f0. を参照してください。) これは '常に' *note
     PYTHONPATH: 121f. に追加されます。

     上の *note インターフェイスオプション: 211b. で説明されているように
     、追加の検索パスディレクトリが *note PYTHONPATH: 121f. の手前に追加
     されます。検索パスは Python プログラムから *note sys.path: 3e4. 変
     数として操作することができます。

 -- 環境変数: PYTHONSAFEPATH

     If this is set to a non-empty string, don't prepend a potentially
     unsafe path to *note sys.path: 3e4.: see the *note -P: 7c1. option
     for details.

     Added in version 3.11.

 -- 環境変数: PYTHONPLATLIBDIR

     If this is set to a non-empty string, it overrides the *note
     sys.platlibdir: b32. value.

     Added in version 3.9.

 -- 環境変数: PYTHONSTARTUP

     この変数が読み込み可能なファイル名の場合、対話モードで最初のプロン
     プトが表示される前にそのファイルの Python コマンドが実行されます。
     ファイル内で定義されているオブジェクトやインポートされたオブジェク
     トを対話セッションで修飾せずに使用するために、ファイルは対話的なコ
     マンドと同じ名前空間で実行されます。 このファイルの中で、プロンプト
     *note sys.ps1: 2135. や *note sys.ps2: 2136.、ならびにフック *note
     sys.__interactivehook__: 11ca. も変更できます。

     Raises an *note auditing event: 1c6e. ‘cpython.run_startup’ with
     the filename as the argument when called on startup.

 -- 環境変数: PYTHONOPTIMIZE

     この変数に空でない文字列を設定するのは *note -O: 18c. オプションを
     指定するのと等価です。整数を設定した場合、 *note -O: 18c. を複数回
     指定したのと同じになります。

 -- 環境変数: PYTHONBREAKPOINT

     If this is set, it names a callable using dotted-path notation.
     The module containing the callable will be imported and then the
     callable will be run by the default implementation of *note
     sys.breakpointhook(): cd1. which itself is called by built-in *note
     breakpoint(): 271.  If not set, or set to the empty string, it is
     equivalent to the value "pdb.set_trace".  Setting this to the
     string "0" causes the default implementation of *note
     sys.breakpointhook(): cd1. to do nothing but return immediately.

     Added in version 3.7.

 -- 環境変数: PYTHONDEBUG

     この変数に空でない文字列を設定するのは *note -d: 2123. オプションを
     指定するのと等価です。整数を指定した場合、 *note -d: 2123. を複数回
     指定したのと同じになります。

     This environment variable requires a *note debug build of Python:
     509, otherwise it's ignored.

 -- 環境変数: PYTHONINSPECT

     この変数に空でない文字列を設定するのは *note -i: 16f4. オプションを
     指定するのと等価です。

     この変数は Python コードから *note os.environ: 259. を使って変更し
     て、プログラム終了時のインスペクトモードを強制することができます。

     引数無しで *note 監査イベント: 1c6e. ‘cpython.run_stdin’ を送出しま
     す。

     バージョン 3.12.5 で変更: (also 3.11.10, 3.10.15, 3.9.20, and
     3.8.20) Emits audit events.

     バージョン 3.13 で変更: Uses PyREPL if possible, in which case
     *note PYTHONSTARTUP: 1b8. is also executed.  Emits audit events.

 -- 環境変数: PYTHONUNBUFFERED

     この変数に空でない文字列を設定するのは *note -u: 1d8d. オプションを
     指定するのと等価です。

 -- 環境変数: PYTHONVERBOSE

     この変数に空でない文字列を設定するのは *note -v: 163e. オプションを
     指定するのと等価です。整数を設定した場合、 *note -v: 163e. を複数回
     指定したのと同じになります。

 -- 環境変数: PYTHONCASEOK

     この環境変数が設定されている場合、 Python は *note import: 7f8. 文
     で大文字/小文字を区別しません。 これは Windows と macOS でのみ動作
     します。

 -- 環境変数: PYTHONDONTWRITEBYTECODE

     この変数に空でない文字列を設定した場合、 Python はソースモジュール
     のインポート時に ‘.pyc’ ファイルを作成しようとはしなくなります。
     *note -B: 15e6. オプションを指定するのと等価です。

 -- 環境変数: PYTHONPYCACHEPREFIX

     If this is set, Python will write ‘.pyc’ files in a mirror
     directory tree at this path, instead of in ‘__pycache__’
     directories within the source tree.  This is equivalent to
     specifying the *note -X: 16f. ‘pycache_prefix=PATH’ option.

     Added in version 3.8.

 -- 環境変数: PYTHONHASHSEED

     この変数が設定されていない場合や ‘random’ に設定された場合、乱数値
     が str、bytes オブジェクトのハッシュのシードに使われます。

     *note PYTHONHASHSEED: 1289. が整数値に設定された場合、その値はハッ
     シュランダム化が扱う型の hash() 生成の固定シードに使われます。

     その目的は再現性のあるハッシュを可能にすることです。例えばインター
     プリタ自身の自己テストや Python プロセスのクラスタでハッシュ値を共
     有するのに用います。

     整数は [0,4294967295] の十進数でなければなりません。0 を指定すると
     ハッシュランダム化は無効化されます。

     Added in version 3.2.3.

 -- 環境変数: PYTHONINTMAXSTRDIGITS

     If this variable is set to an integer, it is used to configure the
     interpreter's global *note integer string conversion length
     limitation: 80b.

     Added in version 3.11.

 -- 環境変数: PYTHONIOENCODING

     この変数がインタープリタ実行前に設定されていた場合、
     ‘encodingname:errorhandler’ という文法で標準入力/標準出力/標準エラ
     ー出力のエンコードを上書きします。 ‘encodingname’ と
     ‘:errorhandler’ の部分はどちらも任意で、*note str.encode(): ad2. と
     同じ意味を持ちます。

     標準エラー出力の場合、‘:errorhandler’ の部分は無視されます; ハンド
     ラは常に ‘'backslashreplace'’ です。

     バージョン 3.4 で変更: ‘encodingname’ の部分が任意になりました。

     バージョン 3.6 で変更: On Windows, the encoding specified by this
     variable is ignored for interactive console buffers unless *note
     PYTHONLEGACYWINDOWSSTDIO: e55. is also specified.  Files and pipes
     redirected through the standard streams are not affected.

 -- 環境変数: PYTHONNOUSERSITE

     この環境変数が設定されている場合、 Python は *note ユーザ
     site-packages ディレクトリ: 2126. を *note sys.path: 3e4. に追加し
     ません。

     参考
     ....

     PEP 370(1) - ユーザごとの ‘site-packages’ ディレクトリ

 -- 環境変数: PYTHONUSERBASE

     Defines the *note user base directory: 1534, which is used to
     compute the path of the *note user site-packages directory: 2126.
     and *note installation paths: 2137. for ‘python -m pip install
     --user’.

     参考
     ....

     PEP 370(2) - ユーザごとの ‘site-packages’ ディレクトリ

 -- 環境変数: PYTHONEXECUTABLE

     この環境変数が設定された場合、 ‘sys.argv[0]’ に、C ランタイムから取
     得した値の代わりにこの環境変数の値が設定されます。macOS でのみ動作
     します。

 -- 環境変数: PYTHONWARNINGS

     This is equivalent to the *note -W: ac6. option.  If set to a comma
     separated string, it is equivalent to specifying *note -W: ac6.
     multiple times, with filters later in the list taking precedence
     over those earlier in the list.

     The simplest settings apply a particular action unconditionally to
     all warnings emitted by a process (even those that are otherwise
     ignored by default):

          PYTHONWARNINGS=default  # Warn once per call location
          PYTHONWARNINGS=error    # Convert to exceptions
          PYTHONWARNINGS=always   # Warn every time
          PYTHONWARNINGS=all      # Same as PYTHONWARNINGS=always
          PYTHONWARNINGS=module   # Warn once per calling module
          PYTHONWARNINGS=once     # Warn once per Python process
          PYTHONWARNINGS=ignore   # Never warn

     詳しくは *note 警告フィルタ: 1b1. と *note Describing Warning
     Filters: 212a. を参照してください。

 -- 環境変数: PYTHONFAULTHANDLER

     If this environment variable is set to a non-empty string, *note
     faulthandler.enable(): 20f. is called at startup: install a handler
     for *note SIGSEGV: 128c, *note SIGFPE: 128d, *note SIGABRT: 128e,
     *note SIGBUS: 128f. and *note SIGILL: 1290. signals to dump the
     Python traceback.  This is equivalent to *note -X: 16f.
     ‘faulthandler’ option.

     Added in version 3.3.

 -- 環境変数: PYTHONTRACEMALLOC

     If this environment variable is set to a non-empty string, start
     tracing Python memory allocations using the *note tracemalloc: 105.
     module.  The value of the variable is the maximum number of frames
     stored in a traceback of a trace.  For example,
     ‘PYTHONTRACEMALLOC=1’ stores only the most recent frame.  See the
     *note tracemalloc.start(): 212c. function for more information.
     This is equivalent to setting the *note -X: 16f. ‘tracemalloc’
     option.

     Added in version 3.4.

 -- 環境変数: PYTHONPROFILEIMPORTTIME

     If this environment variable is set to ‘1’, Python will show how
     long each import takes.  If set to ‘2’, Python will include output
     for imported modules that have already been loaded.  This is
     equivalent to setting the *note -X: 16f. ‘importtime’ option.

     Added in version 3.7.

     バージョン 3.14 で変更: Added ‘PYTHONPROFILEIMPORTTIME=2’ to also
     trace imports of loaded modules.

 -- 環境変数: PYTHONASYNCIODEBUG

     この環境変数が空でない文字列に設定された場合、*note asyncio: b. モ
     ジュールの *note デバッグモード: 213a. が有効化されます。

     Added in version 3.4.

 -- 環境変数: PYTHONMALLOC

     Set the Python memory allocators and/or install debug hooks.

     Set the family of memory allocators used by Python:

        * ‘default’: use the *note default memory allocators: 213b.

        * ‘malloc’: use the ‘malloc()’ function of the C library for all
          domains (*note PYMEM_DOMAIN_RAW: 213c, *note PYMEM_DOMAIN_MEM:
          e63, *note PYMEM_DOMAIN_OBJ: e61.).

        * ‘pymalloc’: use the *note pymalloc allocator: f0b. for *note
          PYMEM_DOMAIN_MEM: e63. and *note PYMEM_DOMAIN_OBJ: e61.
          domains and use the ‘malloc()’ function for the *note
          PYMEM_DOMAIN_RAW: 213c. domain.

        * ‘mimalloc’: use the *note mimalloc allocator: 213d. for *note
          PYMEM_DOMAIN_MEM: e63. and *note PYMEM_DOMAIN_OBJ: e61.
          domains and use the ‘malloc()’ function for the *note
          PYMEM_DOMAIN_RAW: 213c. domain.

     Install *note debug hooks: 213e.:

        * ‘debug’: install debug hooks on top of the *note default
          memory allocators: 213b.

        * ‘malloc_debug’: same as ‘malloc’ but also install debug hooks.

        * ‘pymalloc_debug’: same as ‘pymalloc’ but also install debug
          hooks.

        * ‘mimalloc_debug’: same as ‘mimalloc’ but also install debug
          hooks.

     Added in version 3.6.

     バージョン 3.7 で変更: Added the ‘"default"’ allocator.

 -- 環境変数: PYTHONMALLOCSTATS

     空でない文字列に設定されると、Python は新たなオブジェクトアリーナが
     生成される時と、シャットダウン時に *note pymalloc メモリアロケータ:
     f0b. の統計情報を表示します。

     This variable is ignored if the *note PYTHONMALLOC: e5e.
     environment variable is used to force the ‘malloc()’ allocator of
     the C library, or if Python is configured without ‘pymalloc’
     support.

     バージョン 3.6 で変更: This variable can now also be used on Python
     compiled in release mode.  It now has no effect if set to an empty
     string.

 -- 環境変数: PYTHONLEGACYWINDOWSFSENCODING

     If set to a non-empty string, the default *note filesystem encoding
     and error handler: 75d. mode will revert to their pre-3.6 values of
     'mbcs' and 'replace', respectively.  Otherwise, the new defaults
     'utf-8' and 'surrogatepass' are used.

     This may also be enabled at runtime with *note
     sys._enablelegacywindowsfsencoding(): 33e.

     *note Availability: 213f.: Windows.

     Added in version 3.6: より詳しくは PEP 529(3) を参照してください。

 -- 環境変数: PYTHONLEGACYWINDOWSSTDIO

     If set to a non-empty string, does not use the new console reader
     and writer.  This means that Unicode characters will be encoded
     according to the active console code page, rather than using utf-8.

     This variable is ignored if the standard streams are redirected (to
     files or pipes) rather than referring to console buffers.

     *note Availability: 213f.: Windows.

     Added in version 3.6.

 -- 環境変数: PYTHONCOERCECLOCALE

     If set to the value ‘0’, causes the main Python command line
     application to skip coercing the legacy ASCII-based C and POSIX
     locales to a more capable UTF-8 based alternative.

     If this variable is 'not' set (or is set to a value other than
     ‘0’), the ‘LC_ALL’ locale override environment variable is also not
     set, and the current locale reported for the ‘LC_CTYPE’ category is
     either the default ‘C’ locale, or else the explicitly ASCII-based
     ‘POSIX’ locale, then the Python CLI will attempt to configure the
     following locales for the ‘LC_CTYPE’ category in the order listed
     before loading the interpreter runtime:

        * ‘C.UTF-8’

        * ‘C.utf8’

        * ‘UTF-8’

     If setting one of these locale categories succeeds, then the
     ‘LC_CTYPE’ environment variable will also be set accordingly in the
     current process environment before the Python runtime is
     initialized.  This ensures that in addition to being seen by both
     the interpreter itself and other locale-aware components running in
     the same process (such as the GNU ‘readline’ library), the updated
     setting is also seen in subprocesses (regardless of whether or not
     those processes are running a Python interpreter), as well as in
     operations that query the environment rather than the current C
     locale (such as Python's own *note locale.getdefaultlocale():
     326.).

     Configuring one of these locales (either explicitly or via the
     above implicit locale coercion) automatically enables the
     ‘surrogateescape’ *note error handler: 1b6f. for *note sys.stdin:
     75f. and *note sys.stdout: ccd. (*note sys.stderr: b33. continues
     to use ‘backslashreplace’ as it does in any other locale).  This
     stream handling behavior can be overridden using *note
     PYTHONIOENCODING: 120c. as usual.

     For debugging purposes, setting ‘PYTHONCOERCECLOCALE=warn’ will
     cause Python to emit warning messages on ‘stderr’ if either the
     locale coercion activates, or else if a locale that 'would' have
     triggered coercion is still active when the Python runtime is
     initialized.

     Also note that even when locale coercion is disabled, or when it
     fails to find a suitable target locale, *note PYTHONUTF8: ccf. will
     still activate by default in legacy ASCII-based locales.  Both
     features must be disabled in order to force the interpreter to use
     ‘ASCII’ instead of ‘UTF-8’ for system interfaces.

     *note Availability: 213f.: Unix.

     Added in version 3.7: より詳しくは PEP 538(4) を参照をしてください
     。

 -- 環境変数: PYTHONDEVMODE

     If this environment variable is set to a non-empty string, enable
     *note Python Development Mode: 508, introducing additional runtime
     checks that are too expensive to be enabled by default.  This is
     equivalent to setting the *note -X: 16f. ‘dev’ option.

     Added in version 3.7.

 -- 環境変数: PYTHONUTF8

     If set to ‘1’, enable the *note Python UTF-8 Mode: 866.

     If set to ‘0’, disable the *note Python UTF-8 Mode: 866.

     Setting any other non-empty string causes an error during
     interpreter initialisation.

     Added in version 3.7.

 -- 環境変数: PYTHONWARNDEFAULTENCODING

     If this environment variable is set to a non-empty string, issue a
     *note EncodingWarning: 212e. when the locale-specific default
     encoding is used.

     詳細は *note Opt-in EncodingWarning: 2140. を参照してください。

     Added in version 3.10.

 -- 環境変数: PYTHONNODEBUGRANGES

     If this variable is set, it disables the inclusion of the tables
     mapping extra location information (end line, start column offset
     and end column offset) to every instruction in code objects.  This
     is useful when smaller code objects and pyc files are desired as
     well as suppressing the extra visual location indicators when the
     interpreter displays tracebacks.

     Added in version 3.11.

 -- 環境変数: PYTHONPERFSUPPORT

     If this variable is set to a nonzero value, it enables support for
     the Linux ‘perf’ profiler so Python calls can be detected by it.

     If set to ‘0’, disable Linux ‘perf’ profiler support.

     See also the *note -X perf: 16f. command-line option and *note
     Python support for the Linux perf profiler: 4ae.

     Added in version 3.12.

 -- 環境変数: PYTHON_PERF_JIT_SUPPORT

     If this variable is set to a nonzero value, it enables support for
     the Linux ‘perf’ profiler so Python calls can be detected by it
     using DWARF information.

     If set to ‘0’, disable Linux ‘perf’ profiler support.

     See also the *note -X perf_jit: 16f. command-line option and *note
     Python support for the Linux perf profiler: 4ae.

     Added in version 3.13.

 -- 環境変数: PYTHON_DISABLE_REMOTE_DEBUG

     If this variable is set to a non-empty string, it disables the
     remote debugging feature described in PEP 768(5).  This includes
     both the functionality to schedule code for execution in another
     process and the functionality to receive code for execution in the
     current process.

     See also the *note -X disable_remote_debug: 16f. command-line
     option.

     Added in version 3.14.

 -- 環境変数: PYTHON_CPU_COUNT

     If this variable is set to a positive integer, it overrides the
     return values of *note os.cpu_count(): 4db. and *note
     os.process_cpu_count(): 4da.

     See also the *note -X cpu_count: 16f. command-line option.

     Added in version 3.13.

 -- 環境変数: PYTHON_FROZEN_MODULES

     If this variable is set to ‘on’ or ‘off’, it determines whether or
     not frozen modules are ignored by the import machinery.  A value of
     ‘on’ means they get imported and ‘off’ means they are ignored.  The
     default is ‘on’ for non-debug builds (the normal case) and ‘off’
     for debug builds.  Note that the ‘importlib_bootstrap’ and
     ‘importlib_bootstrap_external’ frozen modules are always used, even
     if this flag is set to ‘off’.

     See also the *note -X frozen_modules: 16f. command-line option.

     Added in version 3.13.

 -- 環境変数: PYTHON_COLORS

     If this variable is set to ‘1’, the interpreter will colorize
     various kinds of output.  Setting it to ‘0’ deactivates this
     behavior.  See also *note 色の制御: 1b7.

     Added in version 3.13.

 -- 環境変数: PYTHON_BASIC_REPL

     If this variable is set to any value, the interpreter will not
     attempt to load the Python-based *note REPL: 491. that requires
     *note readline: bf, and will instead use the traditional
     parser-based *note REPL: 491.

     Added in version 3.13.

 -- 環境変数: PYTHON_HISTORY

     This environment variable can be used to set the location of a
     ‘.python_history’ file (by default, it is ‘.python_history’ in the
     user's home directory).

     Added in version 3.13.

 -- 環境変数: PYTHON_GIL

     If this variable is set to ‘1’, the global interpreter lock (GIL)
     will be forced on.  Setting it to ‘0’ forces the GIL off (needs
     Python configured with the *note -disable-gil: 499. build option).

     See also the *note -X gil: 16f. command-line option, which takes
     precedence over this variable, and *note フリースレッドの CPython:
     46d.

     Added in version 3.13.

 -- 環境変数: PYTHON_THREAD_INHERIT_CONTEXT

     If this variable is set to ‘1’ then *note Thread: 176. will, by
     default, use a copy of context of the caller of ‘Thread.start()’
     when starting.  Otherwise, new threads will start with an empty
     context.  If unset, this variable defaults to ‘1’ on free-threaded
     builds and to ‘0’ otherwise.  See also *note -X
     thread_inherit_context: 16f.

     Added in version 3.14.

 -- 環境変数: PYTHON_CONTEXT_AWARE_WARNINGS

     If set to ‘1’ then the *note warnings.catch_warnings: 179. context
     manager will use a *note ContextVar: 1875. to store warnings filter
     state.  If unset, this variable defaults to ‘1’ on free-threaded
     builds and to ‘0’ otherwise.  See *note -X context_aware_warnings:
     16f.

     Added in version 3.14.

 -- 環境変数: PYTHON_JIT

     On builds where experimental just-in-time compilation is available,
     this variable can force the JIT to be disabled (‘0’) or enabled
     (‘1’) at interpreter startup.

     Added in version 3.13.

 -- 環境変数: PYTHON_TLBC

     If set to ‘1’ enables thread-local bytecode.  If set to ‘0’
     thread-local bytecode and the specializing interpreter are
     disabled.  Only applies to builds configured with *note
     -disable-gil: 499.

     See also the *note -X tlbc: 16f. command-line option.

     Added in version 3.14.

* Menu:

* デバッグモード変数::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0370/

   (2) https://peps.python.org/pep-0370/

   (3) https://peps.python.org/pep-0529/

   (4) https://peps.python.org/pep-0538/

   (5) https://peps.python.org/pep-0768/


File: python.info,  Node: デバッグモード変数,  Up: 環境変数

3.1.2.1 デバッグモード変数
..........................

 -- 環境変数: PYTHONDUMPREFS

     設定された場合、 Python はインタプリタのシャットダウン後に残ってい
     るオブジェクトと参照カウントをダンプします。

     Needs Python configured with the *note -with-trace-refs: 636. build
     option.

 -- 環境変数: PYTHONDUMPREFSFILE

     If set, Python will dump objects and reference counts still alive
     after shutting down the interpreter into a file under the path
     given as the value to this environment variable.

     Needs Python configured with the *note -with-trace-refs: 636. build
     option.

     Added in version 3.11.

 -- 環境変数: PYTHON_PRESITE

     If this variable is set to a module, that module will be imported
     early in the interpreter lifecycle, before the *note site: cc.
     module is executed, and before the *note __main__: 1. module is
     created.  Therefore, the imported module is not treated as *note
     __main__: 1.

     This can be used to execute code early during Python
     initialization.

     To import a submodule, use ‘package.module’ as the value, like in
     an import statement.

     See also the *note -X presite: 16f. command-line option, which
     takes precedence over this variable.

     Needs Python configured with the *note -with-pydebug: 666. build
     option.

     Added in version 3.13.


File: python.info,  Node: Unix プラットフォームで Python を使う,  Next: Python を構成する,  Prev: コマンドラインと環境<2>,  Up: Python のセットアップと利用

3.2 Unix プラットフォームで Python を使う
=========================================

* Menu:

* 最新バージョンの Python の取得とインストール::
* Python のビルド::
* Python に関係するパスとファイル::
* その他: その他<2>.
* カスタムの OpenSSL::


File: python.info,  Node: 最新バージョンの Python の取得とインストール,  Next: Python のビルド,  Up: Unix プラットフォームで Python を使う

3.2.1 最新バージョンの Python の取得とインストール
--------------------------------------------------

* Menu:

* Linux::
* FreeBSD と OpenBSD::


File: python.info,  Node: Linux,  Next: FreeBSD と OpenBSD,  Up: 最新バージョンの Python の取得とインストール

3.2.1.1 Linux
.............

Python comes preinstalled on most Linux distributions, and is available
as a package on all others.  However there are certain features you
might want to use that are not available on your distro's package.  You
can compile the latest version of Python from source.

In the event that the latest version of Python doesn't come preinstalled
and isn't in the repositories as well, you can make packages for your
own distro.  Have a look at the following links:

参考
....

‘https://www.debian.org/doc/manuals/maint-guide/first.en.html’

     Debian ユーザー向け

‘https://en.opensuse.org/Portal:Packaging’

     OpenSuse ユーザー向け

‘https://docs.fedoraproject.org/en-US/package-maintainers/Packaging_Tutorial_GNU_Hello/’

     Fedora ユーザー向け

‘https://slackbook.org/html/package-management-making-packages.html’

     Slackware ユーザー向け

* Menu:

* IDLE のインストール::


File: python.info,  Node: IDLE のインストール,  Up: Linux

3.2.1.2 IDLE のインストール
...........................

場合によっては、 IDLE は Python インストールに含まれていない可能性があり
ます。

   * Debian と Ubuntu ユーザー:

          sudo apt update
          sudo apt install idle

   * Fedora や RHEL 、 CentOS ユーザーは:

          sudo dnf install python3-idle

   * SUSE と OpenSUSE ユーザーは:

          sudo zypper install python3-idle

   * Alpine Linux ユーザーは:

          sudo apk add python3-idle


File: python.info,  Node: FreeBSD と OpenBSD,  Prev: Linux,  Up: 最新バージョンの Python の取得とインストール

3.2.1.3 FreeBSD と OpenBSD
..........................

   * FreeBSD ユーザーが Python パッケージを追加するには次のようにしてく
     ださい:

          pkg install python3

   * OpenBSD ユーザーが Python パッケージを追加するには次のようにしてく
     ださい:

          pkg_add -r python

          pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/<ここにアーキテクチャを挿入>/python-<バージョン>.tgz

     例えば、i386 ユーザーが Python 2.5.1 を取得するには次のようにします
     :

          pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/python-2.5.1p2.tgz


File: python.info,  Node: Python のビルド,  Next: Python に関係するパスとファイル,  Prev: 最新バージョンの Python の取得とインストール,  Up: Unix プラットフォームで Python を使う

3.2.2 Python のビルド
---------------------

参考
....

If you want to contribute to CPython, refer to the devguide(1), which
includes build instructions and other tips on setting up environment.

If you want to compile CPython yourself, first thing you should do is
get the source(2).  You can download either the latest release's source
or grab a fresh clone(3).  You will also need to install the *note build
requirements: 214c.

ビルド手順は通常のコマンドで行います

     ./configure
     make
     make install

*note Configure のオプション: 214d. や特定の Unix プラットフォームにおけ
る注意点は Python ソースツリーのルートにある README.rst(4) に細かく記載
されています。

     警告: ‘make install’ は ‘python3’ バイナリを上書きまたはリンクを破
     壊してしまうかもしれません。そのため、‘make install’ の代わりに
     ‘`exec_prefix'/bin/python`version'’ のみインストールする ‘make
     altinstall’ が推奨されています。

   ---------- Footnotes ----------

   (1) https://devguide.python.org/getting-started/setup-building/

   (2) https://www.python.org/downloads/source/

   (3) https://devguide.python.org/setup/#get-the-source-code

   (4) https://github.com/python/cpython/tree/3.14/README.rst


File: python.info,  Node: Python に関係するパスとファイル,  Next: その他<2>,  Prev: Python のビルド,  Up: Unix プラットフォームで Python を使う

3.2.3 Python に関係するパスとファイル
-------------------------------------

これらはローカルインストールの慣例に応じて変化します; *note prefix:
214f. と *note exec_prefix: 2150. はインストール状況に依存していて、GNU
ソフトウェアによって解釈されます; この二つは同じである場合があります。

例えば、ほとんどの Linux システムでは、両方のデフォルトが ‘/usr’ です。

ファイル/ディレクトリ                               意味
                                                    
---------------------------------------------------------------------------------------------------
                                                    
‘`exec_prefix'/bin/python3’                         インタプリタの推奨される場所
                                                    
                                                    
‘`prefix'/lib/python`version'’,                     標準モジュールを格納するディレクトリの、推奨
‘`exec_prefix'/lib/python`version'’                 される場所。
                                                    
                                                    
‘`prefix'/include/python`version'’,                 Python 拡張や Python の埋込みに必要となる
‘`exec_prefix'/include/python`version'’             include ファイルを格納するディレクトリの推奨
                                                    される場所。
                                                    


File: python.info,  Node: その他<2>,  Next: カスタムの OpenSSL,  Prev: Python に関係するパスとファイル,  Up: Unix プラットフォームで Python を使う

3.2.4 その他
------------

Python スクリプトを Unix で簡単に使うためには、例えば次のようにしてスク
リプトを実行可能ファイルにし、

     $ chmod +x script

適切な shebang 行をスクリプトの先頭に置きます。たいていの場合良い方法は

     #!/usr/bin/env python3

で、 ‘PATH’ 全体から Python インタープリターを探します。しかし、いくつか
の Unix は ‘env’ コマンドを持たないので、インタープリターのパスを
‘/usr/bin/python3’ のようにハードコードしなければならないかもしれません
。

シェルコマンドを Python スクリプトから使うには、 *note subprocess: dc. モ
ジュールを参照してください。


File: python.info,  Node: カスタムの OpenSSL,  Prev: その他<2>,  Up: Unix プラットフォームで Python を使う

3.2.5 カスタムの OpenSSL
------------------------

  1. To use your vendor's OpenSSL configuration and system trust store,
     locate the directory with ‘openssl.cnf’ file or symlink in ‘/etc’.
     On most distribution the file is either in ‘/etc/ssl’ or
     ‘/etc/pki/tls’.  The directory should also contain a ‘cert.pem’
     file and/or a ‘certs’ directory.

          $ find /etc/ -name openssl.cnf -printf "%h\n"
          /etc/ssl

  2. Download, build, and install OpenSSL. Make sure you use
     ‘install_sw’ and not ‘install’.  The ‘install_sw’ target does not
     override ‘openssl.cnf’.

          $ curl -O https://www.openssl.org/source/openssl-VERSION.tar.gz
          $ tar xzf openssl-VERSION
          $ pushd openssl-VERSION
          $ ./config \
              --prefix=/usr/local/custom-openssl \
              --libdir=lib \
              --openssldir=/etc/ssl
          $ make -j1 depend
          $ make -j8
          $ make install_sw
          $ popd

  3. Build Python with custom OpenSSL (see the configure
     ‘--with-openssl’ and ‘--with-openssl-rpath’ options)

          $ pushd python-3.x.x
          $ ./configure -C \
              --with-openssl=/usr/local/custom-openssl \
              --with-openssl-rpath=auto \
              --prefix=/usr/local/python-3.x.x
          $ make -j8
          $ make altinstall

     注釈: Patch releases of OpenSSL have a backwards compatible ABI.
     You don't need to recompile Python to update OpenSSL. It's
     sufficient to replace the custom OpenSSL installation with a newer
     version.


File: python.info,  Node: Python を構成する,  Next: Windows で Python を使う,  Prev: Unix プラットフォームで Python を使う,  Up: Python のセットアップと利用

3.3 Python を構成する
=====================

* Menu:

* ビルド要件::
* 生成されるファイル::
* Configureオプション::
* Python ビルドシステム::
* Compiler and linker flags::


File: python.info,  Node: ビルド要件,  Next: 生成されるファイル,  Up: Python を構成する

3.3.1 ビルド要件
----------------

CPython をビルドするためには、次のものが必要です:

   * C11(1) コンパイラ。 C11 オプション機能(2) は不要です。

   * Windows では、 Microsoft Visual Studio 2017 以降が必要です。

   * IEEE 754(3) 浮動小数点数と 浮動小数点 Not-a-Number (NaN)(4) のサポ
     ート。

   * スレッドのサポート。

バージョン 3.5 で変更: Windows では、 Visual Studio 2015 以降が必要とな
りました。

バージョン 3.6 で変更: Selected C99 features, like ‘<stdint.h>’ and
‘static inline’ functions, are now required.

バージョン 3.7 で変更: Thread support is now required.

バージョン 3.11 で変更: C11 compiler, IEEE 754 and NaN support are now
required.  On Windows, Visual Studio 2017 or later is required.

See also PEP 7(5) "Style Guide for C Code" and PEP 11(6) "CPython
platform support".

* Menu:

* オプションのモジュールの要件::

   ---------- Footnotes ----------

   (1) https://en.cppreference.com/w/c/11

   (2) 
https://en.wikipedia.org/wiki/C11_(C_standard_revision)#Optional_features

   (3) https://en.wikipedia.org/wiki/IEEE_754

   (4) https://en.wikipedia.org/wiki/NaN#Floating_point

   (5) https://peps.python.org/pep-0007/

   (6) https://peps.python.org/pep-0011/


File: python.info,  Node: オプションのモジュールの要件,  Up: ビルド要件

3.3.1.1 オプションのモジュールの要件
....................................

Some *note optional modules: 215a. of the standard library require
third-party libraries installed for development (for example, header
files must be available).

Missing requirements are reported in the ‘configure’ output.  Modules
that are missing due to missing dependencies are listed near the end of
the ‘make’ output, sometimes using an internal name, for example,
‘_ctypes’ for *note ctypes: 2e. module.

If you distribute a CPython interpreter without optional modules, it's
best practice to advise users, who generally expect that standard
library modules are available.

Dependencies to build optional modules are:

依存関係                              最小バージョン                        Python モジュール
                                                                            
------------------------------------------------------------------------------------------------------------------
                                                                            
libbz2(1)                                                                   *note bz2: 14.
                                                                            
                                                                            
libffi(2)                             3.3.0 推奨                            *note ctypes: 2e.
                                                                            
                                                                            
liblzma(3)                                                                  *note lzma: 8e.
                                                                            
                                                                            
libmpdec(4)                           2.5.0                                 *note decimal: 3a. (5)
                                                                            
                                                                            
libreadline(6) または libedit(7)                                            *note readline: bf.
(8)                                                                         

libuuid(9)                                                                  ‘_uuid’ (10)
                                                                            
                                                                            
ncurses(11) (12)                                                            *note curses: 2f.
                                                                            
                                                                            
OpenSSL(13)                                3.0.18 推奨                      *note ssl: d5, *note hashlib: 6c.
                                           (1.1.1 最小)                     (14)
                                                                            
                                                                            
SQLite(15)                            3.15.2                                *note sqlite3: d4.
                                                                            
                                                                            
Tcl/Tk(16)                            8.5.12                                *note tkinter: f6,
                                                                            *note IDLE: 1217,
                                                                            *note turtle: 107.
                                                                            
                                                                            
zlib(17)                              1.2.2.1                               *note zlib: 139, *note gzip: 6b,
                                                                            *note ensurepip: 59.
                                                                            
                                                                            
zstd(18)                              1.4.5                                 *note compression.zstd: 23.
                                                                            

Note that the table does not include all optional modules; in
particular, platform-specific modules like *note winreg: 11c. are not
listed here.

参考
....

   * The devguide(19) includes a full list of dependencies required to
     build all modules and instructions on how to install them on common
     platforms.

   * *note -with-system-expat: 1b2d. allows building with an external
     libexpat(20) library.

   * *note サードパーティ依存関係のオプション: 215d.

バージョン 3.1 で変更: *note tkinter: f6. には Tcl/Tk バージョン 8.3.1 が
必要となりました。

バージョン 3.5 で変更: *note tkinter: f6. には Tck/Tk バージョン 8.4 が
必要となりました。

バージョン 3.7 で変更: *note hashlib: 6c. と *note ssl: d5. には OpenSSL
1.0.2 が必要となりました。

バージョン 3.10 で変更: *note hashlib: 6c. と *note ssl: d5. には
OpenSSL 1.1.1 が必要となりました。 *note sqlite3: d4. には SQLite 3.7.15
が必要となりました。

バージョン 3.11 で変更: *note tkinter: f6. には Tcl/Tk バージョン 8.5.12
が必要となりました。

バージョン 3.13 で変更: *note sqlite3: d4. にはSQLite 3.15.2 が必要とな
りました。

   ---------- Footnotes ----------

   (1) https://sourceware.org/bzip2/

   (2) https://sourceware.org/libffi/

   (3) https://tukaani.org/xz/

   (4) https://www.bytereef.org/mpdecimal/doc/libmpdec/

   (5) If 'libmpdec' is not available, the *note decimal: 3a. module
will use a pure-Python implementation.  See *note -with-system-libmpdec:
657. for details.

   (6) https://tiswww.case.edu/php/chet/readline/rltop.html

   (7) https://www.thrysoee.dk/editline/

   (8) See *note -with-readline: 215b. for choosing the backend for the
*note readline: bf. module.

   (9) https://linux.die.net/man/3/libuuid

   (10) The *note uuid: 116. module uses ‘_uuid’ to generate "safe"
UUIDs.  See the module documentation for details.

   (11) https://gnu.org/software/ncurses/ncurses.html

   (12) The *note curses: 2f. module requires the ‘libncurses’ or
‘libncursesw’ library.  The *note curses.panel: 31. module additionally
requires the ‘libpanel’ or ‘libpanelw’ library.

   (13) https://openssl-library.org/

   (14) If OpenSSL is not available, the *note hashlib: 6c. module will
use bundled implementations of several hash functions.  See *note
-with-builtin-hashlib-hashes: 215c. for 'forcing' usage of OpenSSL.

   (15) https://sqlite.org/

   (16) https://www.tcl-lang.org/

   (17) https://www.zlib.net

   (18) https://facebook.github.io/zstd/

   (19) 
https://devguide.python.org/getting-started/setup-building/#install-dependencies

   (20) https://libexpat.github.io/


File: python.info,  Node: 生成されるファイル,  Next: Configureオプション,  Prev: ビルド要件,  Up: Python を構成する

3.3.2 生成されるファイル
------------------------

To reduce build dependencies, Python source code contains multiple
generated files.  Commands to regenerate all generated files:

     make regen-all
     make regen-stdlib-module-names
     make regen-limited-abi
     make regen-configure

The ‘Makefile.pre.in’ file documents generated files, their inputs, and
tools used to regenerate them.  Search for ‘regen-*’ make targets.

* Menu:

* 構成スクリプト::


File: python.info,  Node: 構成スクリプト,  Up: 生成されるファイル

3.3.2.1 構成スクリプト
......................

The ‘make regen-configure’ command regenerates the ‘aclocal.m4’ file and
the ‘configure’ script using the ‘Tools/build/regen-configure.sh’ shell
script which uses an Ubuntu container to get the same tools versions and
have a reproducible output.

The container is optional, the following command can be run locally:

     autoreconf -ivf -Werror

The generated files can change depending on the exact versions of the
tools used.  The container that CPython uses has Autoconf(1) 2.72,
‘aclocal’ from Automake(2) 1.16.5, and pkg-config(3) 1.8.1.

バージョン 3.13 で変更: Autoconf 2.71 and aclocal 1.16.5 and are now
used to regenerate ‘configure’.

バージョン 3.14 で変更: Autoconf 2.72 is now used to regenerate
‘configure’.

   ---------- Footnotes ----------

   (1) https://gnu.org/software/autoconf

   (2) https://www.gnu.org/software/automake

   (3) https://www.freedesktop.org/wiki/Software/pkg-config/


File: python.info,  Node: Configureオプション,  Next: Python ビルドシステム,  Prev: 生成されるファイル,  Up: Python を構成する

3.3.3 Configureオプション
-------------------------

次のコマンドを使用して、全ての ‘configure’ スクリプトのオプションを表示
できます:

     ./configure --help

Pythonのソース配布の中の ‘Misc/SpecialBuilds.txt’ も参照してください。

* Menu:

* 一般的なオプション::
* C コンパイラのオプション::
* リンカのオプション::
* サードパーティ依存関係のオプション::
* WebAssembly オプション::
* インストールオプション::
* パフォーマンスに関するオプション::
* Python デバッグビルド::
* Debug options::
* リンカのオプション: リンカのオプション<2>.
* Libraries options::
* Security Options::
* macOS のオプション::
* iOS のオプション::
* クロスコンパイルのオプション::


File: python.info,  Node: 一般的なオプション,  Next: C コンパイラのオプション,  Up: Configureオプション

3.3.3.1 一般的なオプション
..........................

 -- Option: --enable-loadable-sqlite-extensions

     Support loadable extensions in the ‘_sqlite’ extension module
     (default is no) of the *note sqlite3: d4. module.

     *note sqlite3: d4. モジュールの *note
     sqlite3.Connection.enable_load_extension(): a3f. メソッドを参照して
     ください。

     Added in version 3.6.

 -- Option: --disable-ipv6

     IPv6サポートを無効にします(サポートされている場合はデフォルトで有効
     )、 *note socket: d1. モジュールを参照してください。

 -- Option: --enable-big-digits=[15|30]

     Python *note int: 19b. の桁の大きさをビット単位で定義します: 15ビッ
     トまたは30ビットです。

     デフォルトでは、桁の大きさは30です。

     ‘PYLONG_BITS_IN_DIGIT’ を ‘15’ または ‘30’ に定義します。

     *note sys.int_info.bits_per_digit: 14ab. を参照してください。

 -- Option: --with-suffix=SUFFIX

     Python の実行ファイルの接尾辞を 'SUFFIX' に設定します。

     デフォルトの接尾辞は、 Windows と macOS では ‘.exe’ ( ‘python.exe’
     実行ファイル)、 Emscripten node では ‘.js’ 、 Emscripten browser で
     は ‘.html’ 、 WASI では ‘.wasm’ 、その他のプラットフォームでは空文
     字列になります ( ‘python’ 実行ファイル)。

     バージョン 3.11 で変更: WASM プラットフォームのデフォルトの接頭辞は
     、 ‘.js’ 、 ‘.html’ 、 ‘.wasm’ のうちの1つです。

 -- Option: --with-tzpath=<list of absolute paths separated by pathsep>

     デフォルトのタイムゾーン検索パスを *note zoneinfo.TZPATH: 2166. に
     設定します。*note zoneinfo: 13a. モジュールの *note Compile-time
     configuration: 2167. を参照してください。

     デフォルト:
     ‘/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/zoneinfo’

     *note os.pathsep: 2134. パスセパレータを参照してください。

     Added in version 3.9.

 -- Option: --without-decimal-contextvar

     コルーチンローカルコンテキスト(デフォルト)ではなく、スレッドローカ
     ルコンテキストを使用して ‘_decimal’ 拡張モジュールをビルドします。
     *note decimal: 3a. モジュールを参照してください。

     *note decimal.HAVE_CONTEXTVAR: 2169. および *note contextvars: 28.
     モジュールを参照してください。

     Added in version 3.9.

 -- Option: --with-dbmliborder=<list of backend names>

     *note dbm: 35. モジュールの DB バックエンドをチェックする順序をオー
     バーライドします。

     有効な値は、バックエンド名をコロン( ‘:’ )で区切った文字列です:

        * ‘ndbm’;

        * ‘gdbm’;

        * ‘bdb’。

 -- Option: --without-c-locale-coercion

     UTF-8 ベースのロケールへの C ロケールの強制を無効にします(デフォル
     トで有効)。

     ‘PY_COERCE_C_LOCALE’ マクロは定義しないでください。

     *note PYTHONCOERCECLOCALE: ccc. および PEP 538(1) を参照してくださ
     い。

 -- Option: --with-platlibdir=DIRNAME

     Python のライブラリディレクトリ名(デフォルトは ‘lib’ )。

     Fedora と SuSE は64ビットプラットフォームで ‘lib64’ を使用します。

     *note sys.platlibdir: b32. を参照してください。

     Added in version 3.9.

 -- Option: --with-wheel-pkg-dir=PATH

     *note ensurepip: 59. モジュールが使用する wheel パッケージのディレ
     クトリです(デフォルトはなし)。

     Linux ディストリビューションのパッケージングポリシーの中には、依存
     関係をバンドルすることを推奨しているものがあります。例えば、 Fedora
     は wheel パッケージを ‘/usr/share/python-wheels/’ ディレクトリにイ
     ンストールし、 ‘ensurepip._bundled’ パッケージはインストールしませ
     ん。

     Added in version 3.10.

 -- Option: --with-pkg-config=[check|yes|no]

     configure がビルドの依存関係を検出するために ‘pkg-config’ を使用す
     るかどうかを設定します。

        * ‘check’ (デフォルト): ‘pkg-config’ はオプションです。

        * ‘yes’ : ‘pkg-config’ は必須です。

        * ‘no’ : ‘pkg-config’ が存在しても、 configure は使用しません。

     Added in version 3.11.

 -- Option: --enable-pystats

     Turn on internal Python performance statistics gathering.

     By default, statistics gathering is off.  Use ‘python3 -X pystats’
     command or set ‘PYTHONSTATS=1’ environment variable to turn on
     statistics gathering at Python startup.

     At Python exit, dump statistics if statistics gathering was on and
     not cleared.

     Effects:

        * Add *note -X pystats: 16f. command line option.

        * Add ‘PYTHONSTATS’ environment variable.

        * Define the ‘Py_STATS’ macro.

        * Add functions to the *note sys: df. module:

             * ‘sys._stats_on()’: Turns on statistics gathering.

             * ‘sys._stats_off()’: Turns off statistics gathering.

             * ‘sys._stats_clear()’: Clears the statistics.

             * ‘sys._stats_dump()’: Dump statistics to file, and clears
               the statistics.

     The statistics will be dumped to a arbitrary (probably unique) file
     in ‘/tmp/py_stats/’ (Unix) or ‘C:\temp\py_stats\’ (Windows).  If
     that directory does not exist, results will be printed on stderr.

     統計情報を読むには ‘Tools/scripts/summarize_stats.py’ を使用してく
     ださい。

     統計:

        * Opcode:

             * Specialization: success, failure, hit, deferred, miss,
               deopt, failures;

             * Execution count;

             * Pair count.

        * Call:

             * Inlined Python calls;

             * PyEval calls;

             * Frames pushed;

             * Frame object created;

             * Eval calls: vector, generator, legacy, function
               VECTORCALL, build class, slot, function "ex", API,
               method.

        * Object:

             * incref and decref;

             * interpreter incref and decref;

             * allocations: all, 512 bytes, 4 kiB, big;

             * free;

             * to/from free lists;

             * dictionary materialized/dematerialized;

             * type cache;

             * optimization attempts;

             * optimization traces created/executed;

             * uops executed.

        * Garbage collector:

             * Garbage collections;

             * Objects visited;

             * Objects collected.

     Added in version 3.11.

 -- Option: --disable-gil

     Enables support for running Python without the *note global
     interpreter lock: 474. (GIL): *note free-threaded build: 176d.

     Defines the ‘Py_GIL_DISABLED’ macro and adds ‘"t"’ to *note
     sys.abiflags: c59.

     See *note フリースレッドの CPython: 46d. for more detail.

     Added in version 3.13.

 -- Option: --enable-experimental-jit=[no|yes|yes-off|interpreter]

     Indicate how to integrate the *note experimental just-in-time
     compiler: 159.

        * ‘no’: Don't build the JIT.

        * ‘yes’: Enable the JIT. To disable it at runtime, set the
          environment variable *note PYTHON_JIT=0: 44d.

        * ‘yes-off’: Build the JIT, but disable it by default.  To
          enable it at runtime, set the environment variable *note
          PYTHON_JIT=1: 44d.

        * ‘interpreter’: Enable the "JIT interpreter" (only useful for
          those debugging the JIT itself).  To disable it at runtime,
          set the environment variable *note PYTHON_JIT=0: 44d.

     ‘--enable-experimental-jit=no’ is the default behavior if the
     option is not provided, and ‘--enable-experimental-jit’ is
     shorthand for ‘--enable-experimental-jit=yes’.  See
     ‘Tools/jit/README.md’ for more information, including how to
     install the necessary build-time dependencies.

          注釈: When building CPython with JIT enabled, ensure that your
          system has Python 3.11 or later installed.

     Added in version 3.13.

 -- Option: PKG_CONFIG

     Path to ‘pkg-config’ utility.

 -- Option: PKG_CONFIG_LIBDIR

 -- Option: PKG_CONFIG_PATH

     ‘pkg-config’ options.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0538/


File: python.info,  Node: C コンパイラのオプション,  Next: リンカのオプション,  Prev: 一般的なオプション,  Up: Configureオプション

3.3.3.2 C コンパイラのオプション
................................

 -- Option: CC

     C コンパイラのコマンド。

 -- Option: CFLAGS

     C コンパイラのフラグ。

 -- Option: CPP

     C プリプロセッサのコマンド。

 -- Option: CPPFLAGS

     C プリプロセッサのフラグ。 (‘-IINCLUDE_DIR’ など)


File: python.info,  Node: リンカのオプション,  Next: サードパーティ依存関係のオプション,  Prev: C コンパイラのオプション,  Up: Configureオプション

3.3.3.3 リンカのオプション
..........................

 -- Option: LDFLAGS

     リンカのフラグ。 (‘-LLIBRARY_DIRECTORY’ など)

 -- Option: LIBS

     リンカに渡すライブラリ。 (‘-lLIBRARY’ など)

 -- Option: MACHDEP

     マシン依存のライブラリファイルの名前。


File: python.info,  Node: サードパーティ依存関係のオプション,  Next: WebAssembly オプション,  Prev: リンカのオプション,  Up: Configureオプション

3.3.3.4 サードパーティ依存関係のオプション
..........................................

Added in version 3.11.

 -- Option: BZIP2_CFLAGS

 -- Option: BZIP2_LIBS

     C compiler and linker flags to link Python to ‘libbz2’, used by
     *note bz2: 14. module, overriding ‘pkg-config’.

 -- Option: CURSES_CFLAGS

 -- Option: CURSES_LIBS

     C compiler and linker flags for ‘libncurses’ or ‘libncursesw’, used
     by *note curses: 2f. module, overriding ‘pkg-config’.

 -- Option: GDBM_CFLAGS

 -- Option: GDBM_LIBS

     C compiler and linker flags for ‘gdbm’.

 -- Option: LIBEDIT_CFLAGS

 -- Option: LIBEDIT_LIBS

     C compiler and linker flags for ‘libedit’, used by *note readline:
     bf. module, overriding ‘pkg-config’.

 -- Option: LIBFFI_CFLAGS

 -- Option: LIBFFI_LIBS

     C compiler and linker flags for ‘libffi’, used by *note ctypes: 2e.
     module, overriding ‘pkg-config’.

 -- Option: LIBMPDEC_CFLAGS

 -- Option: LIBMPDEC_LIBS

     C compiler and linker flags for ‘libmpdec’, used by *note decimal:
     3a. module, overriding ‘pkg-config’.

          注釈: These environment variables have no effect unless *note
          -with-system-libmpdec: 657. is specified.

 -- Option: LIBLZMA_CFLAGS

 -- Option: LIBLZMA_LIBS

     C compiler and linker flags for ‘liblzma’, used by *note lzma: 8e.
     module, overriding ‘pkg-config’.

 -- Option: LIBREADLINE_CFLAGS

 -- Option: LIBREADLINE_LIBS

     C compiler and linker flags for ‘libreadline’, used by *note
     readline: bf. module, overriding ‘pkg-config’.

 -- Option: LIBSQLITE3_CFLAGS

 -- Option: LIBSQLITE3_LIBS

     C compiler and linker flags for ‘libsqlite3’, used by *note
     sqlite3: d4. module, overriding ‘pkg-config’.

 -- Option: LIBUUID_CFLAGS

 -- Option: LIBUUID_LIBS

     C compiler and linker flags for ‘libuuid’, used by *note uuid: 116.
     module, overriding ‘pkg-config’.

 -- Option: LIBZSTD_CFLAGS

 -- Option: LIBZSTD_LIBS

     C compiler and linker flags for ‘libzstd’, used by *note
     compression.zstd: 23. module, overriding ‘pkg-config’.

     Added in version 3.14.

 -- Option: PANEL_CFLAGS

 -- Option: PANEL_LIBS

     C compiler and linker flags for PANEL, overriding ‘pkg-config’.

     C compiler and linker flags for ‘libpanel’ or ‘libpanelw’, used by
     *note curses.panel: 31. module, overriding ‘pkg-config’.

 -- Option: TCLTK_CFLAGS

 -- Option: TCLTK_LIBS

     C compiler and linker flags for TCLTK, overriding ‘pkg-config’.

 -- Option: ZLIB_CFLAGS

 -- Option: ZLIB_LIBS

     C compiler and linker flags for ‘libzlib’, used by *note gzip: 6b.
     module, overriding ‘pkg-config’.


File: python.info,  Node: WebAssembly オプション,  Next: インストールオプション,  Prev: サードパーティ依存関係のオプション,  Up: Configureオプション

3.3.3.5 WebAssembly オプション
..............................

 -- Option: --enable-wasm-dynamic-linking

     WASM のダイナミックリンクサポートをオンにします。

     ダイナミックリンクにより ‘dlopen’ が可能になります。デッドコードの
     排除や機能追加に制限があるため、実行ファイルのファイルサイズが大き
     くなります。

     Added in version 3.11.

 -- Option: --enable-wasm-pthreads

     WASM の pthreads サポートをオンにします。

     Added in version 3.11.


File: python.info,  Node: インストールオプション,  Next: パフォーマンスに関するオプション,  Prev: WebAssembly オプション,  Up: Configureオプション

3.3.3.6 インストールオプション
..............................

 -- Option: --prefix=PREFIX

     アーキテクチャに依存しないファイルを PREFIX にインストールします。
     Unix の場合、デフォルトは ‘/usr/local’ です。

     この値は、実行時に *note sys.prefix: 3e7. を使って取得することがで
     きます。

     例として、 ‘--prefix="$HOME/.local/"’ を使用すると、 Python をその
     ホームディレクトリにインストールすることができます。

 -- Option: --exec-prefix=EPREFIX

     アーキテクチャ依存のファイルを EPREFIX にインストールします。デフォ
     ルトは *note -prefix: 214f. です。

     この値は、実行時に *note sys.exec_prefix: 3eb. を使って取得すること
     ができます。

 -- Option: --disable-test-modules

     *note test: e8. パッケージや ‘_testcapi’ 拡張モジュール(デフォルト
     でビルド、インストールされます)のようなテストモジュールをビルド、イ
     ンストールしないようにします。

     Added in version 3.10.

 -- Option: --with-ensurepip=[upgrade|install|no]

     Python のインストール時に実行される *note ensurepip: 59. コマンドを
     選択します:

        * ‘upgrade’ (デフォルト): ‘python -m ensurepip --altinstall
          --upgrade’ コマンドを実行します。

        * ‘install’: ‘python -m ensurepip --altinstall’ コマンドを実行し
          ます。

        * ‘no’: ensurepip を実行しない;

     Added in version 3.6.


File: python.info,  Node: パフォーマンスに関するオプション,  Next: Python デバッグビルド,  Prev: インストールオプション,  Up: Configureオプション

3.3.3.7 パフォーマンスに関するオプション
........................................

Configuring Python using ‘--enable-optimizations --with-lto’ (PGO + LTO)
is recommended for best performance.  The experimental ‘--enable-bolt’
flag can also be used to improve performance.

 -- Option: --enable-optimizations

     *note PROFILE_TASK: 1a7e. を使用して Profile Guided Optimization
     (PGO) を有効にします(デフォルトでは無効です)。

     Cコンパイラの Clang では、 PGO のために ‘llvm-profdata’ プログラム
     が必要です。macOS では、 GCC もこれを必要とします: GCC は macOS の
     Clang のエイリアスにすぎません。

     Disable also semantic interposition in libpython if
     ‘--enable-shared’ and GCC is used: add
     ‘-fno-semantic-interposition’ to the compiler and linker flags.

          注釈: During the build, you may encounter compiler warnings
          about profile data not being available for some source files.
          These warnings are harmless, as only a subset of the code is
          exercised during profile data acquisition.  To disable these
          warnings on Clang, manually suppress them by adding
          ‘-Wno-profile-instr-unprofiled’ to *note CFLAGS: 16d0.

     Added in version 3.6.

     バージョン 3.10 で変更: GCC で ‘-fno-semantic-interposition’ を使用
     する。

 -- 環境変数: PROFILE_TASK

     Environment variable used in the Makefile: Python command line
     arguments for the PGO generation task.

     デフォルト: ‘-m test --pgo --timeout=$(TESTTIMEOUT)’

     Added in version 3.8.

     バージョン 3.13 で変更: Task failure is no longer ignored silently.

 -- Option: --with-lto=[full|thin|no|yes]

     Enable Link Time Optimization (LTO) in any build (disabled by
     default).

     The C compiler Clang requires ‘llvm-ar’ for LTO (‘ar’ on macOS), as
     well as an LTO-aware linker (‘ld.gold’ or ‘lld’).

     Added in version 3.6.

     Added in version 3.11: To use ThinLTO feature, use
     ‘--with-lto=thin’ on Clang.

     バージョン 3.12 で変更: Use ThinLTO as the default optimization
     policy on Clang if the compiler accepts the flag.

 -- Option: --enable-bolt

     Enable usage of the BOLT post-link binary optimizer(1) (disabled by
     default).

     BOLT is part of the LLVM project but is not always included in
     their binary distributions.  This flag requires that ‘llvm-bolt’
     and ‘merge-fdata’ are available.

     BOLT is still a fairly new project so this flag should be
     considered experimental for now.  Because this tool operates on
     machine code its success is dependent on a combination of the build
     environment + the other optimization configure args + the CPU
     architecture, and not all combinations are supported.  BOLT
     versions before LLVM 16 are known to crash BOLT under some
     scenarios.  Use of LLVM 16 or newer for BOLT optimization is
     strongly encouraged.

     The ‘BOLT_INSTRUMENT_FLAGS’ and ‘BOLT_APPLY_FLAGS’ ‘configure’
     variables can be defined to override the default set of arguments
     for ‘llvm-bolt’ to instrument and apply BOLT data to binaries,
     respectively.

     Added in version 3.12.

 -- Option: BOLT_APPLY_FLAGS

     Arguments to ‘llvm-bolt’ when creating a BOLT optimized binary(2).

     Added in version 3.12.

 -- Option: BOLT_INSTRUMENT_FLAGS

     Arguments to ‘llvm-bolt’ when instrumenting binaries.

     Added in version 3.12.

 -- Option: --with-computed-gotos

     Enable computed gotos in evaluation loop (enabled by default on
     supported compilers).

 -- Option: --with-tail-call-interp

     Enable interpreters using tail calls in CPython.  If enabled,
     enabling PGO (*note -enable-optimizations: a62.) is highly
     recommended.  This option specifically requires a C compiler with
     proper tail call support, and the preserve_none(3) calling
     convention.  For example, Clang 19 and newer supports this feature.

     Added in version 3.14.

 -- Option: --without-mimalloc

     Disable the fast *note mimalloc: 213d. allocator (enabled by
     default).

     See also *note PYTHONMALLOC: e5e. environment variable.

 -- Option: --without-pymalloc

     Disable the specialized Python memory allocator *note pymalloc:
     f0b. (enabled by default).

     See also *note PYTHONMALLOC: e5e. environment variable.

 -- Option: --without-doc-strings

     Disable static documentation strings to reduce the memory footprint
     (enabled by default).  Documentation strings defined in Python are
     not affected.

     Don't define the ‘WITH_DOC_STRINGS’ macro.

     See the ‘PyDoc_STRVAR()’ macro.

 -- Option: --enable-profiling

     Enable C-level code profiling with ‘gprof’ (disabled by default).

 -- Option: --with-strict-overflow

     Add ‘-fstrict-overflow’ to the C compiler flags (by default we add
     ‘-fno-strict-overflow’ instead).

 -- Option: --without-remote-debug

     Deactivate remote debugging support described in PEP 768(4)
     (enabled by default).  When this flag is provided the code that
     allows the interpreter to schedule the execution of a Python file
     in a separate process as described in PEP 768(5) is not compiled.
     This includes both the functionality to schedule code to be
     executed and the functionality to receive code to be executed.

      -- C のマクロ: Py_REMOTE_DEBUG

          This macro is defined by default, unless Python is configured
          with *note -without-remote-debug: 170.

          Note that even if the macro is defined, remote debugging may
          not be available (for example, on an incompatible platform).

     Added in version 3.14.

   ---------- Footnotes ----------

   (1) https://github.com/llvm/llvm-project/tree/main/bolt

   (2) https://github.com/facebookarchive/BOLT

   (3) https://clang.llvm.org/docs/AttributeReference.html#preserve-none

   (4) https://peps.python.org/pep-0768/

   (5) https://peps.python.org/pep-0768/


File: python.info,  Node: Python デバッグビルド,  Next: Debug options,  Prev: パフォーマンスに関するオプション,  Up: Configureオプション

3.3.3.8 Python デバッグビルド
.............................

デバッグビルドは、 *note -with-pydebug: 666. 構成オプション付きでビルド
された Python です。

デバッグビルドの影響:

   * Display all warnings by default: the list of default warning
     filters is empty in the *note warnings: 118. module.

   * Add ‘d’ to *note sys.abiflags: c59.

   * Add ‘sys.gettotalrefcount()’ function.

   * Add *note -X showrefcount: 16f. command line option.

   * Add *note -d: 2123. command line option and *note PYTHONDEBUG:
     2124. environment variable to debug the parser.

   * Add support for the ‘__lltrace__’ variable: enable low-level
     tracing in the bytecode evaluation loop if the variable is defined.

   * Install *note debug hooks on memory allocators: 213b. to detect
     buffer overflow and other memory errors.

   * Define ‘Py_DEBUG’ and ‘Py_REF_DEBUG’ macros.

   * Add runtime checks: code surrounded by ‘#ifdef Py_DEBUG’ and
     ‘#endif’.  Enable ‘assert(...)’ and ‘_PyObject_ASSERT(...)’
     assertions: don't set the ‘NDEBUG’ macro (see also the *note
     -with-assertions: 62d. configure option).  Main runtime checks:

        * Add sanity checks on the function arguments.

        * Unicode and int objects are created with their memory filled
          with a pattern to detect usage of uninitialized objects.

        * Ensure that functions which can clear or replace the current
          exception are not called with an exception raised.

        * Check that deallocator functions don't change the current
          exception.

        * The garbage collector (*note gc.collect(): 1b3. function) runs
          some basic checks on objects consistency.

        * The ‘Py_SAFE_DOWNCAST()’ macro checks for integer underflow
          and overflow when downcasting from wide types to narrow types.

See also the *note Python Development Mode: 508. and the *note
-with-trace-refs: 636. configure option.

バージョン 3.8 で変更: Release builds and debug builds are now ABI
compatible: defining the ‘Py_DEBUG’ macro no longer implies the
‘Py_TRACE_REFS’ macro (see the *note -with-trace-refs: 636. option).


File: python.info,  Node: Debug options,  Next: リンカのオプション<2>,  Prev: Python デバッグビルド,  Up: Configureオプション

3.3.3.9 Debug options
.....................

 -- Option: --with-pydebug

     *note Build Python in debug mode: 509.: define the ‘Py_DEBUG’ macro
     (disabled by default).

 -- Option: --with-trace-refs

     Enable tracing references for debugging purpose (disabled by
     default).

     Effects:

        * Define the ‘Py_TRACE_REFS’ macro.

        * Add *note sys.getobjects(): 28e. function.

        * Add *note PYTHONDUMPREFS: b9e. environment variable.

     The *note PYTHONDUMPREFS: b9e. environment variable can be used to
     dump objects and reference counts still alive at Python exit.

     *note Statically allocated objects: 983. are not traced.

     Added in version 3.8.

     バージョン 3.13 で変更: This build is now ABI compatible with
     release build and *note debug build: 509.

 -- Option: --with-assertions

     Build with C assertions enabled (default is no): ‘assert(...);’ and
     ‘_PyObject_ASSERT(...);’.

     If set, the ‘NDEBUG’ macro is not defined in the *note OPT: 21a7.
     compiler variable.

     See also the *note -with-pydebug: 666. option (*note debug build:
     509.) which also enables assertions.

     Added in version 3.6.

 -- Option: --with-valgrind

     Enable Valgrind support (default is no).

 -- Option: --with-dtrace

     Enable DTrace support (default is no).

     See *note Instrumenting CPython with DTrace and SystemTap: e66.

     Added in version 3.6.

 -- Option: --with-address-sanitizer

     Enable AddressSanitizer memory error detector, ‘asan’ (default is
     no).  To improve ASan detection capabilities you may also want to
     combine this with *note -without-pymalloc: 21a1. to disable the
     specialized small-object allocator whose allocations are not
     tracked by ASan.

     Added in version 3.6.

 -- Option: --with-memory-sanitizer

     Enable MemorySanitizer allocation error detector, ‘msan’ (default
     is no).

     Added in version 3.6.

 -- Option: --with-undefined-behavior-sanitizer

     Enable UndefinedBehaviorSanitizer undefined behaviour detector,
     ‘ubsan’ (default is no).

     Added in version 3.6.

 -- Option: --with-thread-sanitizer

     Enable ThreadSanitizer data race detector, ‘tsan’ (default is no).

     Added in version 3.13.


File: python.info,  Node: リンカのオプション<2>,  Next: Libraries options,  Prev: Debug options,  Up: Configureオプション

3.3.3.10 リンカのオプション
...........................

 -- Option: --enable-shared

     Enable building a shared Python library: ‘libpython’ (default is
     no).

 -- Option: --without-static-libpython

     Do not build ‘libpythonMAJOR.MINOR.a’ and do not install ‘python.o’
     (built and enabled by default).

     Added in version 3.10.


File: python.info,  Node: Libraries options,  Next: Security Options,  Prev: リンカのオプション<2>,  Up: Configureオプション

3.3.3.11 Libraries options
..........................

 -- Option: --with-libs='lib1 ...'

     Link against additional libraries (default is no).

 -- Option: --with-system-expat

     Build the ‘pyexpat’ module using an installed ‘expat’ library
     (default is no).

 -- Option: --with-system-libmpdec

     Build the ‘_decimal’ extension module using an installed
     ‘mpdecimal’ library, see the *note decimal: 3a. module (default is
     yes).

     Added in version 3.3.

     バージョン 3.13 で変更: Default to using the installed ‘mpdecimal’
     library.

     バージョン 3.15 で変更: A bundled copy of the library will no
     longer be selected implicitly if an installed ‘mpdecimal’ library
     is not found.  In Python 3.15 only, it can still be selected
     explicitly using ‘--with-system-libmpdec=no’ or
     ‘--without-system-libmpdec’.

     Deprecated since version 3.13, will be removed in version 3.16: A
     copy of the ‘mpdecimal’ library sources will no longer be
     distributed with Python 3.16.

     参考
     ....

     *note LIBMPDEC_CFLAGS: 2186. and *note LIBMPDEC_LIBS: 2187.

 -- Option: --with-readline=readline|editline

     Designate a backend library for the *note readline: bf. module.

        * readline: Use readline as the backend.

        * editline: Use editline as the backend.

     Added in version 3.10.

 -- Option: --without-readline

     Don't build the *note readline: bf. module (built by default).

     Don't define the ‘HAVE_LIBREADLINE’ macro.

     Added in version 3.10.

 -- Option: --with-libm=STRING

     Override ‘libm’ math library to 'STRING' (default is
     system-dependent).

 -- Option: --with-libc=STRING

     Override ‘libc’ C library to 'STRING' (default is
     system-dependent).

 -- Option: --with-openssl=DIR

     Root of the OpenSSL directory.

     Added in version 3.7.

 -- Option: --with-openssl-rpath=[no|auto|DIR]

     Set runtime library directory (rpath) for OpenSSL libraries:

        * ‘no’ (default): don't set rpath;

        * ‘auto’: auto-detect rpath from *note -with-openssl: 21b4. and
          ‘pkg-config’;

        * 'DIR': set an explicit rpath.

     Added in version 3.10.


File: python.info,  Node: Security Options,  Next: macOS のオプション,  Prev: Libraries options,  Up: Configureオプション

3.3.3.12 Security Options
.........................

 -- Option: --with-hash-algorithm=[fnv|siphash13|siphash24]

     Select hash algorithm for use in ‘Python/pyhash.c’:

        * ‘siphash13’ (default);

        * ‘siphash24’;

        * ‘fnv’.

     Added in version 3.4.

     Added in version 3.11: ‘siphash13’ is added and it is the new
     default.

 -- Option:
          --with-builtin-hashlib-hashes=md5,sha1,sha256,sha512,sha3,blake2

     Built-in hash modules:

        * ‘md5’;

        * ‘sha1’;

        * ‘sha256’;

        * ‘sha512’;

        * ‘sha3’ (with shake);

        * ‘blake2’.

     Added in version 3.9.

 -- Option: --with-ssl-default-suites=[python|openssl|STRING]

     Override the OpenSSL default cipher suites string:

        * ‘python’ (default): use Python's preferred selection;

        * ‘openssl’: leave OpenSSL's defaults untouched;

        * 'STRING': use a custom string

     See the *note ssl: d5. module.

     Added in version 3.7.

     バージョン 3.10 で変更: The settings ‘python’ and 'STRING' also set
     TLS 1.2 as minimum protocol version.

 -- Option: --disable-safety

     Disable compiler options that are recommended by OpenSSF(1) for
     security reasons with no performance overhead.  If this option is
     not enabled, CPython will be built based on safety compiler options
     with no slow down.  When this option is enabled, CPython will not
     be built with the compiler options listed below.

     The following compiler options are disabled with
     ‘--disable-safety’:

        * -fstack-protector-strong(2): Enable run-time checks for
          stack-based buffer overflows.

        * -Wtrampolines(3): Enable warnings about trampolines that
          require executable stacks.

     Added in version 3.14.

 -- Option: --enable-slower-safety

     Enable compiler options that are recommended by OpenSSF(4) for
     security reasons which require overhead.  If this option is not
     enabled, CPython will not be built based on safety compiler options
     which performance impact.  When this option is enabled, CPython
     will be built with the compiler options listed below.

     The following compiler options are enabled with
     ‘--enable-slower-safety’:

        * -D_FORTIFY_SOURCE=3(5): Fortify sources with compile- and
          run-time checks for unsafe libc usage and buffer overflows.

     Added in version 3.14.

   ---------- Footnotes ----------

   (1) 
https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md

   (2) 
https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md#enable-run-time-checks-for-stack-based-buffer-overflows

   (3) 
https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md#enable-warning-about-trampolines-that-require-executable-stacks

   (4) 
https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md

   (5) 
https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md#fortify-sources-for-unsafe-libc-usage-and-buffer-overflows


File: python.info,  Node: macOS のオプション,  Next: iOS のオプション,  Prev: Security Options,  Up: Configureオプション

3.3.3.13 macOS のオプション
...........................

Mac/README.rst(1) を参照。

 -- Option: --enable-universalsdk

 -- Option: --enable-universalsdk=SDKDIR

     ユニバーサルバイナリビルドを作成します。 'SDKDIR' はビルドの実行に
     どの macOS SDK が使用されるべきかを指定します (デフォルトでは指定し
     ません) 。

 -- Option: --enable-framework

 -- Option: --enable-framework=INSTALLDIR

     従来の Unix インストールではなく、 Python.framework を作成します。
     オプションの 'INSTALLDIR' はインストール先のパスを指定します (デフ
     ォルトでは指定しません) 。

 -- Option: --with-universal-archs=ARCH

     作成するユニバーサルバイナリの種類を指定します。このオプションは、
     *note -enable-universalsdk: b63. が指定された場合のみ有効です。

     オプション:

        * ‘universal2’ (x86-64 and arm64);

        * ‘32-bit’ (PPC and i386);

        * ‘64-bit’ (PPC64 and x86-64);

        * ‘3-way’ (i386, PPC and x86-64);

        * ‘intel’ (i386 and x86-64);

        * ‘intel-32’ (i386);

        * ‘intel-64’ (x86-64);

        * ‘all’ (PPC, i386, PPC64 and x86-64).

     Note that values for this configuration item are 'not' the same as
     the identifiers used for universal binary wheels on macOS. See the
     Python Packaging User Guide for details on the packaging platform
     compatibility tags used on macOS(2)

 -- Option: --with-framework-name=FRAMEWORK

     macOS の Python フレームワークの名前を指定します。 *note
     -enable-framework: 21ba. が指定された場合のみ有効です (デフォルトで
     は ‘Python’) 。

 -- Option: --with-app-store-compliance

 -- Option: --with-app-store-compliance=PATCH-FILE

     Python 標準ライブラリは、 macOS と iOS の App Store による配布用に
     送信された場合に、自動検査ツールのエラーを発生させることが知られて
     いる文字列を含んでいます。このオプションを有効にした場合、 App
     Store コンプライアンスに合わせて修正することが知られているパッチの
     リストを適用します。カスタムのパッチファイルを指定することもできま
     す。このオプションはデフォルトでは無効になっています。

     Added in version 3.13.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Mac/README.rst

   (2) 
https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#macos


File: python.info,  Node: iOS のオプション,  Next: クロスコンパイルのオプション,  Prev: macOS のオプション,  Up: Configureオプション

3.3.3.14 iOS のオプション
.........................

iOS/README.rst(1) を参照。

 -- Option: --enable-framework=INSTALLDIR

     Python.framework を作成します。 macOS とは違い、インストールパスを
     指定する 'INSTALLDIR' 引数は必須です。

 -- Option: --with-framework-name=FRAMEWORK

     フレームワークの名前を指定します (デフォルト: ‘Python’) 。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/iOS/README.rst


File: python.info,  Node: クロスコンパイルのオプション,  Prev: iOS のオプション,  Up: Configureオプション

3.3.3.15 クロスコンパイルのオプション
.....................................

クロスコンパイル、またはクロスビルドは、異なる CPU アーキテクチャやプラ
ットフォーム用に Python をビルドするために使用できます。クロスコンパイル
には、ビルドプラットフォーム用の Python インタープリターが必要です。ビル
ドする Python のバージョンは、クロスコンパイルされたホスト Python のバー
ジョンと一致する必要があります。

 -- Option: --build=BUILD

     BUILD でビルドするための設定です。通常は、 ‘config.guess’ により推
     測されます。

 -- Option: --host=HOST

     HOST (ターゲットプラットフォーム) で動作するプログラムをビルドする
     ためのクロスコンパイル。

 -- Option: --with-build-python=path/to/python

     クロスコンパイル用のビルド ‘python’ バイナリへのパス。

     Added in version 3.11.

 -- Option: CONFIG_SITE=file

     構成をオーバーライドするファイルを指す環境変数。

     'config.site' ファイルの例:

          # config.site-aarch64
          ac_cv_buggy_getaddrinfo=no
          ac_cv_file__dev_ptmx=yes
          ac_cv_file__dev_ptc=no

 -- Option: HOSTRUNNER

     クロスコンパイル用にホストプラットフォームの CPython を実行するプロ
     グラム。

     Added in version 3.11.

クロスコンパイルの例:

     CONFIG_SITE=config.site-aarch64 ../configure \
         --build=x86_64-pc-linux-gnu \
         --host=aarch64-unknown-linux-gnu \
         --with-build-python=../x86_64/python


File: python.info,  Node: Python ビルドシステム,  Next: Compiler and linker flags,  Prev: Configureオプション,  Up: Python を構成する

3.3.4 Python ビルドシステム
---------------------------

* Menu:

* ビルドシステムの主要なファイル::
* 主要なビルドステップ::
* Main Makefile targets::
* C extensions::


File: python.info,  Node: ビルドシステムの主要なファイル,  Next: 主要なビルドステップ,  Up: Python ビルドシステム

3.3.4.1 ビルドシステムの主要なファイル
......................................

   * ‘configure.ac’ => ‘configure’;

   * ‘Makefile.pre.in’ => ‘Makefile’ (‘configure’ により作成されます);

   * ‘pyconfig.h’ (‘configure’ により作成されます);

   * ‘Modules/Setup’: ‘Module/makesetup’ シェルスクリプトを使用して
     Makefile がビルドする C 拡張。


File: python.info,  Node: 主要なビルドステップ,  Next: Main Makefile targets,  Prev: ビルドシステムの主要なファイル,  Up: Python ビルドシステム

3.3.4.2 主要なビルドステップ
............................

   * C files (‘.c’) are built as object files (‘.o’).

   * A static ‘libpython’ library (‘.a’) is created from objects files.

   * ‘python.o’ and the static ‘libpython’ library are linked into the
     final ‘python’ program.

   * C extensions are built by the Makefile (see ‘Modules/Setup’).


File: python.info,  Node: Main Makefile targets,  Next: C extensions,  Prev: 主要なビルドステップ,  Up: Python ビルドシステム

3.3.4.3 Main Makefile targets
.............................

* Menu:

* make::
* make platform::
* make profile-opt::
* make clean::
* make distclean::
* make install::
* make test::
* make ci::
* make buildbottest::
* make regen-all::


File: python.info,  Node: make,  Next: make platform,  Up: Main Makefile targets

3.3.4.4 make
............

For the most part, when rebuilding after editing some code or refreshing
your checkout from upstream, all you need to do is execute ‘make’, which
(per Make's semantics) builds the default target, the first one defined
in the Makefile.  By tradition (including in the CPython project) this
is usually the ‘all’ target.  The ‘configure’ script expands an
‘autoconf’ variable, ‘@DEF_MAKE_ALL_RULE@’ to describe precisely which
targets ‘make all’ will build.  The three choices are:

   * ‘profile-opt’ (configured with ‘--enable-optimizations’)

   * ‘build_wasm’ (chosen if the host platform matches ‘wasm32-wasi*’ or
     ‘wasm32-emscripten’)

   * ‘build_all’ (configured without explicitly using either of the
     others)

Depending on the most recent source file changes, Make will rebuild any
targets (object files and executables) deemed out-of-date, including
running ‘configure’ again if necessary.  Source/target dependencies are
many and maintained manually however, so Make sometimes doesn't have all
the information necessary to correctly detect all targets which need to
be rebuilt.  Depending on which targets aren't rebuilt, you might
experience a number of problems.  If you have build or test problems
which you can't otherwise explain, ‘make clean && make’ should work
around most dependency problems, at the expense of longer build times.


File: python.info,  Node: make platform,  Next: make profile-opt,  Prev: make,  Up: Main Makefile targets

3.3.4.5 make platform
.....................

Build the ‘python’ program, but don't build the standard library
extension modules.  This generates a file named ‘platform’ which
contains a single line describing the details of the build platform,
e.g., ‘macosx-14.3-arm64-3.12’ or ‘linux-x86_64-3.13’.


File: python.info,  Node: make profile-opt,  Next: make clean,  Prev: make platform,  Up: Main Makefile targets

3.3.4.6 make profile-opt
........................

Build Python using profile-guided optimization (PGO). You can use the
configure *note -enable-optimizations: a62. option to make this the
default target of the ‘make’ command (‘make all’ or just ‘make’).


File: python.info,  Node: make clean,  Next: make distclean,  Prev: make profile-opt,  Up: Main Makefile targets

3.3.4.7 make clean
..................

Remove built files.


File: python.info,  Node: make distclean,  Next: make install,  Prev: make clean,  Up: Main Makefile targets

3.3.4.8 make distclean
......................

In addition to the work done by ‘make clean’, remove files created by
the configure script.  ‘configure’ will have to be run before building
again.  (1)

   ---------- Footnotes ----------

   (1) ‘git clean -fdx’ is an even more extreme way to "clean" your
checkout.  It removes all files not known to Git.  When bug hunting
using ‘git bisect’, this is recommended between probes
(https://github.com/python/cpython/issues/114505#issuecomment-1907021718)
to guarantee a completely clean build.  'Use with care', as it will
delete all files not checked into Git, including your new, uncommitted
work.


File: python.info,  Node: make install,  Next: make test,  Prev: make distclean,  Up: Main Makefile targets

3.3.4.9 make install
....................

Build the ‘all’ target and install Python.


File: python.info,  Node: make test,  Next: make ci,  Prev: make install,  Up: Main Makefile targets

3.3.4.10 make test
..................

Build the ‘all’ target and run the Python test suite with the
‘--fast-ci’ option without GUI tests.  Variables:

   * ‘TESTOPTS’: additional regrtest command-line options.

   * ‘TESTPYTHONOPTS’: additional Python command-line options.

   * ‘TESTTIMEOUT’: timeout in seconds (default: 10 minutes).


File: python.info,  Node: make ci,  Next: make buildbottest,  Prev: make test,  Up: Main Makefile targets

3.3.4.11 make ci
................

This is similar to ‘make test’, but uses the ‘-ugui’ to also run GUI
tests.

Added in version 3.14.


File: python.info,  Node: make buildbottest,  Next: make regen-all,  Prev: make ci,  Up: Main Makefile targets

3.3.4.12 make buildbottest
..........................

This is similar to ‘make test’, but uses the ‘--slow-ci’ option and
default timeout of 20 minutes, instead of ‘--fast-ci’ option.


File: python.info,  Node: make regen-all,  Prev: make buildbottest,  Up: Main Makefile targets

3.3.4.13 make regen-all
.......................

Regenerate (almost) all generated files.  These include (but are not
limited to) bytecode cases, and parser generator file.  ‘make
regen-stdlib-module-names’ and ‘autoconf’ must be run separately for the
remaining *note generated files: 215e.


File: python.info,  Node: C extensions,  Prev: Main Makefile targets,  Up: Python ビルドシステム

3.3.4.14 C extensions
.....................

Some C extensions are built as built-in modules, like the ‘sys’ module.
They are built with the ‘Py_BUILD_CORE_BUILTIN’ macro defined.  Built-in
modules have no ‘__file__’ attribute:

     >>> import sys
     >>> sys
     <module 'sys' (built-in)>
     >>> sys.__file__
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     AttributeError: module 'sys' has no attribute '__file__'

Other C extensions are built as dynamic libraries, like the ‘_asyncio’
module.  They are built with the ‘Py_BUILD_CORE_MODULE’ macro defined.
Example on Linux x86-64:

     >>> import _asyncio
     >>> _asyncio
     <module '_asyncio' from '/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'>
     >>> _asyncio.__file__
     '/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'

‘Modules/Setup’ is used to generate Makefile targets to build C
extensions.  At the beginning of the files, C extensions are built as
built-in modules.  Extensions defined after the ‘*shared*’ marker are
built as dynamic libraries.

The ‘PyAPI_FUNC()’, ‘PyAPI_DATA()’ and *note PyMODINIT_FUNC: 16ec.
macros of ‘Include/exports.h’ are defined differently depending if the
‘Py_BUILD_CORE_MODULE’ macro is defined:

   * Use ‘Py_EXPORTED_SYMBOL’ if the ‘Py_BUILD_CORE_MODULE’ is defined

   * Use ‘Py_IMPORTED_SYMBOL’ otherwise.

If the ‘Py_BUILD_CORE_BUILTIN’ macro is used by mistake on a C extension
built as a shared library, its ‘PyInit_XXX()’ function is not exported,
causing an *note ImportError: 65b. on import.


File: python.info,  Node: Compiler and linker flags,  Prev: Python ビルドシステム,  Up: Python を構成する

3.3.5 Compiler and linker flags
-------------------------------

Options set by the ‘./configure’ script and environment variables and
used by ‘Makefile’.

* Menu:

* Preprocessor flags::
* Compiler flags::
* Linker flags::


File: python.info,  Node: Preprocessor flags,  Next: Compiler flags,  Up: Compiler and linker flags

3.3.5.1 Preprocessor flags
..........................

 -- 環境変数: CONFIGURE_CPPFLAGS

     Value of *note CPPFLAGS: 16d2. variable passed to the ‘./configure’
     script.

     Added in version 3.6.

 -- 環境変数: CPPFLAGS

     (Objective) C/C++ preprocessor flags, e.g.  ‘-IINCLUDE_DIR’ if you
     have headers in a nonstandard directory 'include_dir'.

     Both *note CPPFLAGS: 16d2. and *note LDFLAGS: 16d1. need to contain
     the shell's value to be able to build extension modules using the
     directories specified in the environment variables.

 -- 環境変数: BASECPPFLAGS

     Added in version 3.4.

 -- 環境変数: PY_CPPFLAGS

     Extra preprocessor flags added for building the interpreter object
     files.

     Default: ‘$(BASECPPFLAGS) -I. -I$(srcdir)/Include
     $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)’.

     Added in version 3.2.


File: python.info,  Node: Compiler flags,  Next: Linker flags,  Prev: Preprocessor flags,  Up: Compiler and linker flags

3.3.5.2 Compiler flags
......................

 -- 環境変数: CC

     C コンパイラのコマンド。

     Example: ‘gcc -pthread’.

 -- 環境変数: CXX

     C++ compiler command.

     Example: ‘g++ -pthread’.

 -- 環境変数: CFLAGS

     C コンパイラのフラグ。

 -- 環境変数: CFLAGS_NODIST

     *note CFLAGS_NODIST: 21de. is used for building the interpreter and
     stdlib C extensions.  Use it when a compiler flag should 'not' be
     part of *note CFLAGS: 16d0. once Python is installed (gh-65320(1)).

     In particular, *note CFLAGS: 16d0. should not contain:

        * the compiler flag ‘-I’ (for setting the search path for
          include files).  The ‘-I’ flags are processed from left to
          right, and any flags in *note CFLAGS: 16d0. would take
          precedence over user- and package-supplied ‘-I’ flags.

        * hardening flags such as ‘-Werror’ because distributions cannot
          control whether packages installed by users conform to such
          heightened standards.

     Added in version 3.5.

 -- 環境変数: COMPILEALL_OPTS

     Options passed to the *note compileall: 21. command line when
     building PYC files in ‘make install’.  Default: ‘-j0’.

     Added in version 3.12.

 -- 環境変数: EXTRA_CFLAGS

     Extra C compiler flags.

 -- 環境変数: CONFIGURE_CFLAGS

     Value of *note CFLAGS: 16d0. variable passed to the ‘./configure’
     script.

     Added in version 3.2.

 -- 環境変数: CONFIGURE_CFLAGS_NODIST

     Value of *note CFLAGS_NODIST: 21de. variable passed to the
     ‘./configure’ script.

     Added in version 3.5.

 -- 環境変数: BASECFLAGS

     Base compiler flags.

 -- 環境変数: OPT

     Optimization flags.

 -- 環境変数: CFLAGS_ALIASING

     Strict or non-strict aliasing flags used to compile
     ‘Python/dtoa.c’.

     Added in version 3.7.

 -- 環境変数: CCSHARED

     Compiler flags used to build a shared library.

     For example, ‘-fPIC’ is used on Linux and on BSD.

 -- 環境変数: CFLAGSFORSHARED

     Extra C flags added for building the interpreter object files.

     Default: ‘$(CCSHARED)’ when *note -enable-shared: a63. is used, or
     an empty string otherwise.

 -- 環境変数: PY_CFLAGS

     Default: ‘$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS)
     $(EXTRA_CFLAGS)’.

 -- 環境変数: PY_CFLAGS_NODIST

     Default: ‘$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST)
     -I$(srcdir)/Include/internal’.

     Added in version 3.5.

 -- 環境変数: PY_STDMODULE_CFLAGS

     C flags used for building the interpreter object files.

     Default: ‘$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS)
     $(CFLAGSFORSHARED)’.

     Added in version 3.7.

 -- 環境変数: PY_CORE_CFLAGS

     Default: ‘$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE’.

     Added in version 3.2.

 -- 環境変数: PY_BUILTIN_MODULE_CFLAGS

     Compiler flags to build a standard library extension module as a
     built-in module, like the *note posix: b2. module.

     Default: ‘$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN’.

     Added in version 3.8.

 -- 環境変数: PURIFY

     Purify command.  Purify is a memory debugger program.

     Default: empty string (not used).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/65320


File: python.info,  Node: Linker flags,  Prev: Compiler flags,  Up: Compiler and linker flags

3.3.5.3 Linker flags
....................

 -- 環境変数: LINKCC

     Linker command used to build programs like ‘python’ and
     ‘_testembed’.

     Default: ‘$(PURIFY) $(CC)’.

 -- 環境変数: CONFIGURE_LDFLAGS

     Value of *note LDFLAGS: 16d1. variable passed to the ‘./configure’
     script.

     Avoid assigning *note CFLAGS: 16d0, *note LDFLAGS: 16d1, etc.  so
     users can use them on the command line to append to these values
     without stomping the pre-set values.

     Added in version 3.2.

 -- 環境変数: LDFLAGS_NODIST

     *note LDFLAGS_NODIST: 21f0. is used in the same manner as *note
     CFLAGS_NODIST: 21de.  Use it when a linker flag should 'not' be
     part of *note LDFLAGS: 16d1. once Python is installed
     (gh-65320(1)).

     In particular, *note LDFLAGS: 16d1. should not contain:

        * the compiler flag ‘-L’ (for setting the search path for
          libraries).  The ‘-L’ flags are processed from left to right,
          and any flags in *note LDFLAGS: 16d1. would take precedence
          over user- and package-supplied ‘-L’ flags.

 -- 環境変数: CONFIGURE_LDFLAGS_NODIST

     Value of *note LDFLAGS_NODIST: 21f0. variable passed to the
     ‘./configure’ script.

     Added in version 3.8.

 -- 環境変数: LDFLAGS

     Linker flags, e.g.  ‘-LLIB_DIR’ if you have libraries in a
     nonstandard directory 'lib_dir'.

     Both *note CPPFLAGS: 16d2. and *note LDFLAGS: 16d1. need to contain
     the shell's value to be able to build extension modules using the
     directories specified in the environment variables.

 -- 環境変数: LIBS

     Linker flags to pass libraries to the linker when linking the
     Python executable.

     Example: ‘-lrt’.

 -- 環境変数: LDSHARED

     Command to build a shared library.

     Default: ‘@LDSHARED@ $(PY_LDFLAGS)’.

 -- 環境変数: BLDSHARED

     Command to build ‘libpython’ shared library.

     Default: ‘@BLDSHARED@ $(PY_CORE_LDFLAGS)’.

 -- 環境変数: PY_LDFLAGS

     Default: ‘$(CONFIGURE_LDFLAGS) $(LDFLAGS)’.

 -- 環境変数: PY_LDFLAGS_NODIST

     Default: ‘$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)’.

     Added in version 3.8.

 -- 環境変数: PY_CORE_LDFLAGS

     Linker flags used for building the interpreter object files.

     Added in version 3.8.

脚注
....

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/65320


File: python.info,  Node: Windows で Python を使う,  Next: macOS で Python を使う,  Prev: Python を構成する,  Up: Python のセットアップと利用

3.4 Windows で Python を使う
============================

このドキュメントは、 Python を Microsoft Windows で使うときに知っておく
べき、 Windows 固有の動作についての概要を伝えることを目的としています。

Unlike most Unix systems and services, Windows does not include a system
supported installation of Python.  Instead, Python can be obtained from
a number of distributors, including directly from the CPython team.
Each Python distribution will have its own benefits and drawbacks,
however, consistency with other tools you are using is generally a
worthwhile benefit.  Before committing to the process described here, we
recommend investigating your existing tools to see if they can provide
Python directly.

To obtain Python from the CPython team, use the Python Install Manager.
This is a standalone tool that makes Python available as global commands
on your Windows machine, integrates with the system, and supports
updates over time.  You can download the Python Install Manager from
python.org/downloads(1) or through the Microsoft Store app(2).

Once you have installed the Python Install Manager, the global ‘python’
command can be used from any terminal to launch your current latest
version of Python.  This version may change over time as you add or
remove different versions, and the ‘py list’ command will show which is
current.

In general, we recommend that you create a *note virtual environment:
20eb. for each project and run ‘<env>\Scripts\Activate’ in your terminal
to use it.  This provides isolation between projects, consistency over
time, and ensures that additional commands added by packages are also
available in your session.  Create a virtual environment using ‘python
-m venv <env path>’.

If the ‘python’ or ‘py’ commands do not seem to be working, please see
the *note Troubleshooting: 21fb. section below.  There are sometimes
additional manual steps required to configure your PC.

Apart from using the Python install manager, Python can also be obtained
as NuGet packages.  See *note nuget.org パッケージ: 21fc. below for more
information on these packages.

The embeddable distros are minimal packages of Python suitable for
embedding into larger applications.  They can be installed using the
Python install manager.  See *note 埋め込み可能なパッケージ: 21fd. below
for more information on these packages.
* Menu:

* Python install manager::
* 埋め込み可能なパッケージ::
* nuget.org パッケージ: nuget org パッケージ.
* 別のバンドル::
* Supported Windows versions::
* Removing the MAX_PATH limitation::
* UTF-8 モード::
* モジュールの検索::
* 追加のモジュール::
* Windows 上で Python をコンパイルする::
* The full installer (deprecated): The full installer deprecated.
* Python launcher for Windows (deprecated): Python launcher for Windows deprecated.

   ---------- Footnotes ----------

   (1) https://www.python.org/downloads/

   (2) https://apps.microsoft.com/detail/9NQ7512CXL7T


File: python.info,  Node: Python install manager,  Next: 埋め込み可能なパッケージ,  Up: Windows で Python を使う

3.4.1 Python install manager
----------------------------

* Menu:

* Installation::
* 基本的な使い方::
* Command help::
* Listing runtimes::
* Installing runtimes::
* Offline installs::
* Uninstalling runtimes::
* Configuration::
* Shebang lines::
* Advanced installation::
* Administrative configuration::
* Installing free-threaded binaries::
* Troubleshooting::


File: python.info,  Node: Installation,  Next: 基本的な使い方,  Up: Python install manager

3.4.1.1 Installation
....................

The Python install manager can be installed from the Microsoft Store
app(1) or downloaded and installed from python.org/downloads(2).  The
two versions are identical.

To install through the Store, simply click "Install".  After it has
completed, open a terminal and type ‘python’ to get started.

To install the file downloaded from python.org, either double-click and
select "Install", or run ‘Add-AppxPackage <path to MSIX>’ in Windows
Powershell.

After installation, the ‘python’, ‘py’, and ‘pymanager’ commands should
be available.  If you have existing installations of Python, or you have
modified your ‘PATH’ variable, you may need to remove them or undo the
modifications.  See *note Troubleshooting: 21fb. for more help with
fixing non-working commands.

When you first install a runtime, you will likely be prompted to add a
directory to your ‘PATH’.  This is optional, if you prefer to use the
‘py’ command, but is offered for those who prefer the full range of
aliases (such as ‘python3.14.exe’) to be available.  The directory will
be ‘%LocalAppData%\Python\bin’ by default, but may be customized by an
administrator.  Click Start and search for "Edit environment variables
for your account" for the system settings page to add the path.

Each Python runtime you install will have its own directory for scripts.
These also need to be added to ‘PATH’ if you want to use them.

The Python install manager will be automatically updated to new
releases.  This does not affect any installs of Python runtimes.
Uninstalling the Python install manager does not uninstall any Python
runtimes.

If you are not able to install an MSIX in your context, for example, you
are using automated deployment software that does not support it, or are
targeting Windows Server 2019, please see *note Advanced installation:
2201. below for more information.

   ---------- Footnotes ----------

   (1) https://apps.microsoft.com/detail/9NQ7512CXL7T

   (2) https://www.python.org/downloads/


File: python.info,  Node: 基本的な使い方,  Next: Command help,  Prev: Installation,  Up: Python install manager

3.4.1.2 基本的な使い方
......................

The recommended command for launching Python is ‘python’, which will
either launch the version requested by the script being launched, an
active virtual environment, or the default installed version, which will
be the latest stable release unless configured otherwise.  If no version
is specifically requested and no runtimes are installed at all, the
current latest release will be installed automatically.

For all scenarios involving multiple runtime versions, the recommended
command is ‘py’.  This may be used anywhere in place of ‘python’ or the
older ‘py.exe’ launcher.  By default, ‘py’ matches the behaviour of
‘python’, but also allows command line options to select a specific
version as well as subcommands to manage installations.  These are
detailed below.

Because the ‘py’ command may already be taken by the previous version,
there is also an unambiguous ‘pymanager’ command.  Scripted installs
that are intending to use Python install manager should consider using
‘pymanager’, due to the lower chance of encountering a conflict with
existing installs.  The only difference between the two commands is when
running without any arguments: ‘py’ will launch your default
interpreter, while ‘pymanager’ will display help (‘pymanager exec ...’
provides equivalent behaviour to ‘py ...’).

Each of these commands also has a windowed version that avoids creating
a console window.  These are ‘pyw’, ‘pythonw’ and ‘pymanagerw’.  A
‘python3’ command is also included that mimics the ‘python’ command.  It
is intended to catch accidental uses of the typical POSIX command on
Windows, but is not meant to be widely used or recommended.

To launch your default runtime, run ‘python’ or ‘py’ with the arguments
you want to be passed to the runtime (such as script files or the module
to launch):

     $> py
     ...
     $> python my-script.py
     ...
     $> py -m this
     ...

The default runtime can be overridden with the *note
PYTHON_MANAGER_DEFAULT: 2203. environment variable, or a configuration
file.  See *note Configuration: 2204. for information about
configuration settings.

To launch a specific runtime, the ‘py’ command accepts a ‘-V:<TAG>’
option.  This option must be specified before any others.  The tag is
part or all of the identifier for the runtime; for those from the
CPython team, it looks like the version, potentially with the platform.
For compatibility, the ‘V:’ may be omitted in cases where the tag refers
to an official release and starts with ‘3’.

     $> py -V:3.14 ...
     $> py -V:3-arm64 ...

Runtimes from other distributors may require the 'company' to be
included as well.  This should be separated from the tag by a slash, and
may be a prefix.  Specifying the company is optional when it is
‘PythonCore’, and specifying the tag is optional (but not the slash)
when you want the latest release from a specific company.

     $> py -V:Distributor\1.0 ...
     $> py -V:distrib/ ...

If no version is specified, but a script file is passed, the script will
be inspected for a 'shebang line'.  This is a special format for the
first line in a file that allows overriding the command.  See *note
Shebang lines: 2205. for more information.  When there is no shebang
line, or it cannot be resolved, the script will be launched with the
default runtime.

If you are running in an active virtual environment, have not requested
a particular version, and there is no shebang line, the default runtime
will be that virtual environment.  In this scenario, the ‘python’
command was likely already overridden and none of these checks occurred.
However, this behaviour ensures that the ‘py’ command can be used
interchangeably.

When no runtimes are installed, any launch command will try to install
the requested version and launch it.  However, after any version is
installed, only the ‘py exec ...’ and ‘pymanager exec ...’ commands will
install if the requested version is absent.  Other forms of commands
will display an error and direct you to use ‘py install’ first.


File: python.info,  Node: Command help,  Next: Listing runtimes,  Prev: 基本的な使い方,  Up: Python install manager

3.4.1.3 Command help
....................

The ‘py help’ command will display the full list of supported commands,
along with their options.  Any command may be passed the ‘-?’ option to
display its help, or its name passed to ‘py help’.

     $> py help
     $> py help install
     $> py install /?

All commands support some common options, which will be shown by ‘py
help’.  These options must be specified after any subcommand.
Specifying ‘-v’ or ‘--verbose’ will increase the amount of output shown,
and ‘-vv’ will increase it further for debugging purposes.  Passing ‘-q’
or ‘--quiet’ will reduce output, and ‘-qq’ will reduce it further.

The ‘--config=<PATH>’ option allows specifying a configuration file to
override multiple settings at once.  See *note Configuration: 2204.
below for more information about these files.


File: python.info,  Node: Listing runtimes,  Next: Installing runtimes,  Prev: Command help,  Up: Python install manager

3.4.1.4 Listing runtimes
........................

     $> py list [-f=|--format=<FMT>] [-1|--one] [--online|-s=|--source=<URL>] [<TAG>...]

The list of installed runtimes can be seen using ‘py list’.  A filter
may be added in the form of one or more tags (with or without company
specifier), and each may include a ‘<’, ‘<=’, ‘>=’ or ‘>’ prefix to
restrict to a range.

A range of formats are supported, and can be passed as the
‘--format=<FMT>’ or ‘-f <FMT>’ option.  Formats include ‘table’ (a user
friendly table view), ‘csv’ (comma-separated table), ‘json’ (a single
JSON blob), ‘jsonl’ (one JSON blob per result), ‘exe’ (just the
executable path), ‘prefix’ (just the prefix path).

The ‘--one’ or ‘-1’ option only displays a single result.  If the
default runtime is included, it will be the one.  Otherwise, the "best"
result is shown ("best" is deliberately vaguely defined, but will
usually be the most recent version).  The result shown by ‘py list --one
<TAG>’ will match the runtime that would be launched by ‘py -V:<TAG>’.

The ‘--only-managed’ option excludes results that were not installed by
the Python install manager.  This is useful when determining which
runtimes may be updated or uninstalled through the ‘py’ command.

The ‘--online’ option is short for passing ‘--source=<URL>’ with the
default source.  Passing either of these options will search the online
index for runtimes that can be installed.  The result shown by ‘py list
--online --one <TAG>’ will match the runtime that would be installed by
‘py install <TAG>’.

     $> py list --online 3.14

For compatibility with the old launcher, the ‘--list’, ‘--list-paths’,
‘-0’ and ‘-0p’ commands (e.g.  ‘py -0p’) are retained.  They do not
allow additional options, and will produce legacy formatted output.


File: python.info,  Node: Installing runtimes,  Next: Offline installs,  Prev: Listing runtimes,  Up: Python install manager

3.4.1.5 Installing runtimes
...........................

     $> py install [-s=|--source=<URL>] [-f|--force] [-u|--update] [--dry-run] [<TAG>...]

New runtime versions may be added using ‘py install’.  One or more tags
may be specified, and the special tag ‘default’ may be used to select
the default.  Ranges are not supported for installation.

The ‘--source=<URL>’ option allows overriding the online index that is
used to obtain runtimes.  This may be used with an offline index, as
shown in *note Offline installs: 2209.

Passing ‘--force’ will ignore any cached files and remove any existing
install to replace it with the specified one.

Passing ‘--update’ will replace existing installs if the new version is
newer.  Otherwise, they will be left.  If no tags are provided with
‘--update’, all installs managed by the Python install manager will be
updated if newer versions are available.  Updates will remove any
modifications made to the install, including globally installed
packages, but virtual environments will continue to work.

Passing ‘--dry-run’ will generate output and logs, but will not modify
any installs.

In addition to the above options, the ‘--target’ option will extract the
runtime to the specified directory instead of doing a normal install.
This is useful for embedding runtimes into larger applications.  Unlike
a normal install, ‘py’ will not be aware of the extracted runtime, and
no Start menu or other shortcuts will be created.  To launch the
runtime, directly execute the main executable (typically ‘python.exe’)
in the target directory.

     $> py install ... [-t=|--target=<PATH>] <TAG>

The ‘py exec’ command will install the requested runtime if it is not
already present.  This is controlled by the ‘automatic_install’
configuration ( *note PYTHON_MANAGER_AUTOMATIC_INSTALL: 220a.), and is
enabled by default.  If no runtimes are available at all, all launch
commands will do an automatic install if the configuration setting
allows.  This is to ensure a good experience for new users, but should
not generally be relied on rather than using the ‘py exec’ command or
explicit install commands.


File: python.info,  Node: Offline installs,  Next: Uninstalling runtimes,  Prev: Installing runtimes,  Up: Python install manager

3.4.1.6 Offline installs
........................

To perform offline installs of Python, you will need to first create an
offline index on a machine that has network access.

     $> py install --download=<PATH> ... <TAG>...

The ‘--download=<PATH>’ option will download the packages for the listed
tags and create a directory containing them and an ‘index.json’ file
suitable for later installation.  This entire directory can be moved to
the offline machine and used to install one or more of the bundled
runtimes:

     $> py install --source="<PATH>\index.json" <TAG>...

The Python install manager can be installed by downloading its installer
and moving it to another machine before installing.

Alternatively, the ZIP files in an offline index directory can simply be
transferred to another machine and extracted.  This will not register
the install in any way, and so it must be launched by directly
referencing the executables in the extracted directory, but it is
sometimes a preferable approach in cases where installing the Python
install manager is not possible or convenient.

In this way, Python runtimes can be installed and managed on a machine
without access to the internet.


File: python.info,  Node: Uninstalling runtimes,  Next: Configuration,  Prev: Offline installs,  Up: Python install manager

3.4.1.7 Uninstalling runtimes
.............................

     $> py uninstall [-y|--yes] <TAG>...

Runtimes may be removed using the ‘py uninstall’ command.  One or more
tags must be specified.  Ranges are not supported here.

The ‘--yes’ option bypasses the confirmation prompt before uninstalling.

Instead of passing tags individually, the ‘--purge’ option may be
specified.  This will remove all runtimes managed by the Python install
manager, including cleaning up the Start menu, registry, and any
download caches.  Runtimes that were not installed by the Python install
manager will not be impacted, and neither will manually created
configuration files.

     $> py uninstall [-y|--yes] --purge

The Python install manager can be uninstalled through the Windows
"Installed apps" settings page.  This does not remove any runtimes, and
they will still be usable, though the global ‘python’ and ‘py’ commands
will be removed.  Reinstalling the Python install manager will allow you
to manage these runtimes again.  To completely clean up all Python
runtimes, run with ‘--purge’ before uninstalling the Python install
manager.


File: python.info,  Node: Configuration,  Next: Shebang lines,  Prev: Uninstalling runtimes,  Up: Python install manager

3.4.1.8 Configuration
.....................

Python install manager is configured with a hierarchy of configuration
files, environment variables, command-line options, and registry
settings.  In general, configuration files have the ability to configure
everything, including the location of other configuration files, while
registry settings are administrator-only and will override configuration
files.  Command-line options override all other settings, but not every
option is available.

This section will describe the defaults, but be aware that modified or
overridden installs may resolve settings differently.

A global configuration file may be configured by an administrator, and
would be read first.  The user configuration file is stored at
‘%AppData%\Python\pymanager.json’ (note that this location is under
‘Roaming’, not ‘Local’) and is read next, overwriting any settings from
earlier files.  An additional configuration file may be specified as the
‘PYTHON_MANAGER_CONFIG’ environment variable or the ‘--config’ command
line option (but not both).  These locations may be modified by
administrative customization options listed later.

The following settings are those that are considered likely to be
modified in normal use.  Later sections list those that are intended for
administrative customization.

Standard configuration options
..............................

Config Key                            Environment Variable                  説明
                                                                            
------------------------------------------------------------------------------------------------------------------
                                                                            
‘default_tag’                          -- 環境変数:                         The preferred default version to
                                                PYTHON_MANAGER_DEFAULT      launch or install.  By default,
                                                                            this is interpreted as the most
                                                                            recent non-prerelease version from
                                                                            the CPython team.
                                                                            
                                                                            
‘default_platform’                    ‘PYTHON_MANAGER_DEFAULT_PLATFORM’     The preferred default platform to
                                                                            launch or install.  This is treated
                                                                            as a suffix to the specified tag,
                                                                            such that ‘py -V:3.14’ would prefer
                                                                            an install for ‘3.14-64’ if it
                                                                            exists (and ‘default_platform’ is
                                                                            ‘-64’), but will use ‘3.14’ if no
                                                                            tagged install exists.
                                                                            
                                                                            
‘logs_dir’                            ‘PYTHON_MANAGER_LOGS’                 The location where log files are
                                                                            written.  By default, ‘%TEMP%’.
                                                                            
                                                                            
‘automatic_install’                    -- 環境変数:                         True to allow automatic installs
                                                PYTHON_MANAGER_AUTOMATIC_INSTALLwhen using ‘py exec’ to launch (or
                                                                            ‘py’ when no runtimes are installed
                                                                            yet).  Other commands will not
                                                                            automatically install, regardless
                                                                            of this setting.  By default, true.
                                                                            
                                                                            
‘include_unmanaged’                   ‘PYTHON_MANAGER_INCLUDE_UNMANAGED’    True to allow listing and launching
                                                                            runtimes that were not installed by
                                                                            the Python install manager, or
                                                                            false to exclude them.  By default,
                                                                            true.
                                                                            
                                                                            
‘shebang_can_run_anything’            ‘PYTHON_MANAGER_SHEBANG_CAN_RUN_ANYTHING’True to allow shebangs in ‘.py’
                                                                            files to launch applications other
                                                                            than Python runtimes, or false to
                                                                            prevent it.  By default, true.
                                                                            
                                                                            
‘log_level’                           ‘PYMANAGER_VERBOSE’,                  Set the default level of output
                                      ‘PYMANAGER_DEBUG’                     (0-50).  By default, 20.  Lower
                                                                            values produce more output.  The
                                                                            environment variables are boolean,
                                                                            and may produce additional output
                                                                            during startup that is later
                                                                            suppressed by other configuration.
                                                                            
                                                                            
‘confirm’                             ‘PYTHON_MANAGER_CONFIRM’              True to confirm certain actions
                                                                            before taking them (such as
                                                                            uninstall), or false to skip the
                                                                            confirmation.  By default, true.
                                                                            
                                                                            
‘install.source’                      ‘PYTHON_MANAGER_SOURCE_URL’           Override the index feed to obtain
                                                                            new installs from.
                                                                            
                                                                            
‘list.format’                         ‘PYTHON_MANAGER_LIST_FORMAT’          Specify the default format used by
                                                                            the ‘py list’ command.  By default,
                                                                            ‘table’.
                                                                            
                                                                            
‘install_dir’                         (none)                                Specify the root directory that
                                                                            runtimes will be installed into.
                                                                            If you change this setting,
                                                                            previously installed runtimes will
                                                                            not be usable unless you move them
                                                                            to the new location.
                                                                            
                                                                            
‘global_dir’                          (none)                                Specify the directory where global
                                                                            commands (such as ‘python3.14.exe’)
                                                                            are stored.  This directory should
                                                                            be added to your ‘PATH’ to make the
                                                                            commands available from your
                                                                            terminal.
                                                                            
                                                                            
‘download_dir’                        (none)                                Specify the directory where
                                                                            downloaded files are stored.  This
                                                                            directory is a temporary cache, and
                                                                            can be cleaned up from time to
                                                                            time.
                                                                            

Dotted names should be nested inside JSON objects, for example,
‘list.format’ would be specified as ‘{"list": {"format": "table"}}’.


File: python.info,  Node: Shebang lines,  Next: Advanced installation,  Prev: Configuration,  Up: Python install manager

3.4.1.9 Shebang lines
.....................

If the first line of a script file starts with ‘#!’, it is known as a
"shebang" line.  Linux and other Unix like operating systems have native
support for such lines and they are commonly used on such systems to
indicate how a script should be executed.  The ‘python’ and ‘py’
commands allow the same facilities to be used with Python scripts on
Windows.

To allow shebang lines in Python scripts to be portable between Unix and
Windows, a number of 'virtual' commands are supported to specify which
interpreter to use.  The supported virtual commands are:

   * ‘/usr/bin/env <ALIAS>’

   * ‘/usr/bin/env -S <ALIAS>’

   * ‘/usr/bin/<ALIAS>’

   * ‘/usr/local/bin/<ALIAS>’

   * ‘<ALIAS>’

具体的に、もしスクリプトの1行目が

     #! /usr/bin/python

で始まっていたら、デフォルトの Python またはアクティブな仮想環境の位置が
特定され、使用されます。多くの Unix 上で動作する Python スクリプトにはす
でにこの行が存在する傾向がありますので、ランチャによりそれらのスクリプト
を修正なしで使うことができるはずです。あなたが新しいスクリプトを Windows
上で書いていて、Unix 上でも有用であってほしいと思うなら、シェバン行のう
ち ‘/usr’ で始まるものを使用すべきです。

Any of the above virtual commands can have ‘<ALIAS>’ replaced by an
alias from an installed runtime.  That is, any command generated in the
global aliases directory (which you may have added to your ‘PATH’
environment variable) can be used in a shebang, even if it is not on
your ‘PATH’.  This allows the use of shebangs like ‘/usr/bin/python3.12’
to select a particular runtime.

If no runtimes are installed, or if automatic installation is enabled,
the requested runtime will be installed if necessary.  See *note
Configuration: 2204. for information about configuration settings.

The ‘/usr/bin/env’ form of shebang line will also search the ‘PATH’
environment variable for unrecognized commands.  This corresponds to the
behaviour of the Unix ‘env’ program, which performs the same search, but
prefers launching known Python commands.  A warning may be displayed
when searching for arbitrary executables, and this search may be
disabled by the ‘shebang_can_run_anything’ configuration option.

Shebang lines that do not match any of patterns are treated as 'Windows'
executable paths that are absolute or relative to the directory
containing the script file.  This is a convenience for Windows-only
scripts, such as those generated by an installer, since the behavior is
not compatible with Unix-style shells.  These paths may be quoted, and
may include multiple arguments, after which the path to the script and
any additional arguments will be appended.  This functionality may be
disabled by the ‘shebang_can_run_anything’ configuration option.

     注釈: The behaviour of shebangs in the Python install manager is
     subtly different from the previous ‘py.exe’ launcher, and the old
     configuration options no longer apply.  If you are specifically
     reliant on the old behaviour or configuration, we recommend
     installing the legacy launcher(1).  The legacy launcher's ‘py’
     command will override PyManager's one by default, and you will need
     to use ‘pymanager’ commands for installing and uninstalling.

   ---------- Footnotes ----------

   (1) https://www.python.org/ftp/python/3.14.0/win32/launcher.msi


File: python.info,  Node: Advanced installation,  Next: Administrative configuration,  Prev: Shebang lines,  Up: Python install manager

3.4.1.10 Advanced installation
..............................

For situations where an MSIX cannot be installed, such as some older
administrative distribution platforms, there is an MSI available from
the python.org downloads page.  This MSI has no user interface, and can
only perform per-machine installs to its default location in Program
Files.  It will attempt to modify the system ‘PATH’ environment variable
to include this install location, but be sure to validate this on your
configuration.

     注釈: Windows Server 2019 is the only version of Windows that
     CPython supports that does not support MSIX. For Windows Server
     2019, you should use the MSI.

Be aware that the MSI package does not bundle any runtimes, and so is
not suitable for installs into offline environments without also
creating an offline install index.  See *note Offline installs: 2209.
and *note Administrative configuration: 2210. for information on
handling these scenarios.

Runtimes installed by the MSI are shared with those installed by the
MSIX, and are all per-user only.  The Python install manager does not
support installing runtimes per-machine.  To emulate a per-machine
install, you can use ‘py install --target=<shared location>’ as
administrator and add your own system-wide modifications to ‘PATH’, the
registry, or the Start menu.

When the MSIX is installed, but commands are not available in the ‘PATH’
environment variable, they can be found under
‘%LocalAppData%\Microsoft\WindowsApps\PythonSoftwareFoundation.PythonManager_3847v3x7pw1km’
or
‘%LocalAppData%\Microsoft\WindowsApps\PythonSoftwareFoundation.PythonManager_qbz5n2kfra8p0’,
depending on whether it was installed from python.org or through the
Windows Store.  Attempting to run the executable directly from Program
Files is not recommended.

To programmatically install the Python install manager, it is easiest to
use WinGet, which is included with all supported versions of Windows:

     $> winget install 9NQ7512CXL7T -e --accept-package-agreements --disable-interactivity

     # Optionally run the configuration checker and accept all changes
     $> py install --configure -y

To download the Python install manager and install on another machine,
the following WinGet command will download the required files from the
Store to your Downloads directory (add ‘-d <location>’ to customize the
output location).  This also generates a YAML file that appears to be
unnecessary, as the downloaded MSIX can be installed by launching or
using the commands below.

     $> winget download 9NQ7512CXL7T -e --skip-license --accept-package-agreements --accept-source-agreements

To programmatically install or uninstall an MSIX using only PowerShell,
the Add-AppxPackage(1) and Remove-AppxPackage(2) PowerShell cmdlets are
recommended:

     $> Add-AppxPackage C:\Downloads\python-manager-25.0.msix
     ...
     $> Get-AppxPackage PythonSoftwareFoundation.PythonManager | Remove-AppxPackage

The latest release can be downloaded and installed by Windows by passing
the AppInstaller file to the Add-AppxPackage command.  This installs
using the MSIX on python.org, and is only recommended for cases where
installing via the Store (interactively or using WinGet) is not
possible.

     $> Add-AppxPackage -AppInstallerFile https://www.python.org/ftp/python/pymanager/pymanager.appinstaller

Other tools and APIs may also be used to provision an MSIX package for
all users on a machine, but Python does not consider this a supported
scenario.  We suggest looking into the PowerShell
Add-AppxProvisionedPackage(3) cmdlet, the native Windows
PackageManager(4) class, or the documentation and support for your
deployment tool.

Regardless of the install method, users will still need to install their
own copies of Python itself, as there is no way to trigger those
installs without being a logged in user.  When using the MSIX, the
latest version of Python will be available for all users to install
without network access.

Note that the MSIX downloadable from the Store and from the Python
website are subtly different and cannot be installed at the same time.
Wherever possible, we suggest using the above WinGet commands to
download the package from the Store to reduce the risk of setting up
conflicting installs.  There are no licensing restrictions on the Python
install manager that would prevent using the Store package in this way.

   ---------- Footnotes ----------

   (1) 
https://learn.microsoft.com/powershell/module/appx/add-appxpackage

   (2) 
https://learn.microsoft.com/powershell/module/appx/remove-appxpackage

   (3) 
https://learn.microsoft.com/powershell/module/dism/add-appxprovisionedpackage

   (4) 
https://learn.microsoft.com/uwp/api/windows.management.deployment.packagemanager


File: python.info,  Node: Administrative configuration,  Next: Installing free-threaded binaries,  Prev: Advanced installation,  Up: Python install manager

3.4.1.11 Administrative configuration
.....................................

There are a number of options that may be useful for administrators to
override configuration of the Python install manager.  These can be used
to provide local caching, disable certain shortcut types, override
bundled content.  All of the above configuration options may be set, as
well as those below.

Configuration options may be overridden in the registry by setting
values under ‘HKEY_LOCAL_MACHINE\Software\Policies\Python\PyManager’,
where the value name matches the configuration key and the value type is
‘REG_SZ’.  Note that this key can itself be customized, but only by
modifying the core config file distributed with the Python install
manager.  We recommend, however, that registry values are used only to
set ‘base_config’ to a JSON file containing the full set of overrides.
Registry key overrides will replace any other configured setting, while
‘base_config’ allows users to further modify settings they may need.

Note that most settings with environment variables support those
variables because their default setting specifies the variable.  If you
override them, the environment variable will no longer work, unless you
override it with another one.  For example, the default value of
‘confirm’ is literally ‘%PYTHON_MANAGER_CONFIRM%’, which will resolve
the variable at load time.  If you override the value to ‘yes’, then the
environment variable will no longer be used.  If you override the value
to ‘%CONFIRM%’, then that environment variable will be used instead.

Configuration settings that are paths are interpreted as relative to the
directory containing the configuration file that specified them.

Administrative configuration options
....................................

Config Key                                             説明
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
‘base_config’                                          The highest priority configuration file to read.
                                                       Note that only the built-in configuration file and
                                                       the registry can modify this setting.
                                                       
                                                       
‘user_config’                                          The second configuration file to read.
                                                       
                                                       
‘additional_config’                                    The third configuration file to read.
                                                       
                                                       
‘registry_override_key’                                Registry location to check for overrides.  Note that
                                                       only the built-in configuration file can modify this
                                                       setting.
                                                       
                                                       
‘bundled_dir’                                          Read-only directory containing locally cached files.
                                                       
                                                       
‘install.fallback_source’                              Path or URL to an index to consult when the main
                                                       index cannot be accessed.
                                                       
                                                       
‘install.enable_shortcut_kinds’                        Comma-separated list of shortcut kinds to allow
                                                       (e.g.  ‘"pep514,start"’).  Enabled shortcuts may
                                                       still be disabled by ‘disable_shortcut_kinds’.
                                                       
                                                       
‘install.disable_shortcut_kinds’                       Comma-separated list of shortcut kinds to exclude
                                                       (e.g.  ‘"pep514,start"’).  Disabled shortcuts are
                                                       not reactivated by ‘enable_shortcut_kinds’.
                                                       
                                                       
‘pep514_root’                                          Registry location to read and write PEP 514 entries
                                                       into.  By default,
                                                       ‘HKEY_CURRENT_USER\Software\Python’.
                                                       
                                                       
‘start_folder’                                         Start menu folder to write shortcuts into.  By
                                                       default, ‘Python’.  This path is relative to the
                                                       user's Programs folder.
                                                       
                                                       
‘virtual_env’                                          Path to the active virtual environment.  By default,
                                                       this is ‘%VIRTUAL_ENV%’, but may be set empty to
                                                       disable venv detection.
                                                       
                                                       
‘shebang_can_run_anything_silently’                    True to suppress visible warnings when a shebang
                                                       launches an application other than a Python runtime.
                                                       


File: python.info,  Node: Installing free-threaded binaries,  Next: Troubleshooting,  Prev: Administrative configuration,  Up: Python install manager

3.4.1.12 Installing free-threaded binaries
..........................................

Added in version 3.13.

Pre-built distributions of the free-threaded build are available by
installing tags with the ‘t’ suffix.

     $> py install 3.14t
     $> py install 3.14t-arm64
     $> py install 3.14t-32

This will install and register as normal.  If you have no other runtimes
installed, then ‘python’ will launch this one.  Otherwise, you will need
to use ‘py -V:3.14t ...’ or, if you have added the global aliases
directory to your ‘PATH’ environment variable, the ‘python3.14t.exe’
commands.


File: python.info,  Node: Troubleshooting,  Prev: Installing free-threaded binaries,  Up: Python install manager

3.4.1.13 Troubleshooting
........................

If your Python install manager does not seem to be working correctly,
please work through these tests and fixes to see if it helps.  If not,
please report an issue at our bug tracker(1), including any relevant log
files (written to your ‘%TEMP%’ directory by default).

Troubleshooting
...............

Symptom                                                Things to try
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
‘python’ gives me a "command not found" error or       Did you
opens the Store app when I type it in my terminal.     *note install the Python install manager: 21fe.?
                                                       
                                                       
                                                       Click Start, open "Manage app execution aliases",
                                                       and check that the aliases for "Python (default)"
                                                       are enabled.  If they already are, try disabling and
                                                       re-enabling to refresh the command.  The "Python
                                                       (default windowed)" and "Python install manager"
                                                       commands may also need refreshing.
                                                       
                                                       
                                                       Check that the ‘py’ and ‘pymanager’ commands work.
                                                       
                                                       
                                                       Ensure your ‘PATH’ variable contains the entry for
                                                       ‘%UserProfile%\AppData\Local\Microsoft\WindowsApps’.
                                                       The operating system includes this entry once by
                                                       default, after other user paths.  If removed,
                                                       shortcuts will not be found.
                                                       
                                                       
‘py’ gives me a "command not found" error when I       Did you
type it in my terminal.                                *note install the Python install manager: 21fe.?
                                                       
                                                       
                                                       Click Start, open "Manage app execution aliases",
                                                       and check that the aliases for "Python (default)"
                                                       are enabled.  If they already are, try disabling and
                                                       re-enabling to refresh the command.  The "Python
                                                       (default windowed)" and "Python install manager"
                                                       commands may also need refreshing.
                                                       
                                                       
                                                       Ensure your ‘PATH’ variable contains the entry for
                                                       ‘%UserProfile%\AppData\Local\Microsoft\WindowsApps’.
                                                       The operating system includes this entry once by
                                                       default, after other user paths.  If removed,
                                                       shortcuts will not be found.
                                                       
                                                       
‘py’ gives me a "can't open file" error when I type    This usually means you have the legacy launcher
commands in my terminal.                               installed and it has priority over the Python
                                                       install manager.  To remove, click Start, open
                                                       "Installed apps", search for "Python launcher" and
                                                       uninstall it.
                                                       
                                                       
‘python’ doesn't launch the same runtime as ‘py’       Click Start, open "Installed apps", look for any
                                                       existing Python runtimes, and either remove them or
                                                       Modify and disable the ‘PATH’ options.
                                                       
                                                       
                                                       Click Start, open "Manage app execution aliases",
                                                       and check that your ‘python.exe’ alias is set to
                                                       "Python (default)"
                                                       
                                                       
‘python’ and ‘py’ don't launch the runtime I expect    Check your *note PYTHON_MANAGER_DEFAULT: 2203.
                                                       environment variable or ‘default_tag’ configuration.
                                                       The ‘py list’ command will show your default based
                                                       on these settings.
                                                       
                                                       
                                                       Installs that are managed by the Python install
                                                       manager will be chosen ahead of unmanaged installs.
                                                       Use ‘py install’ to install the runtime you expect,
                                                       or configure your default tag.
                                                       
                                                       
                                                       Prerelease and experimental installs that are not
                                                       managed by the Python install manager may be chosen
                                                       ahead of stable releases.  Configure your default
                                                       tag or uninstall the prerelease runtime and
                                                       reinstall it using ‘py install’.
                                                       
                                                       
‘pythonw’ or ‘pyw’ don't launch the same runtime as    Click Start, open "Manage app execution aliases",
‘python’ or ‘py’                                       and check that your ‘pythonw.exe’ and ‘pyw.exe’
                                                       aliases are consistent with your others.
                                                       
                                                       
‘pip’ gives me a "command not found" error when I      Have you activated a virtual environment?  Run the
type it in my terminal.                                ‘.venv\Scripts\activate’ script in your terminal to
                                                       activate.
                                                       
                                                       
                                                       The package may be available but missing the
                                                       generated executable.  We recommend using the
                                                       ‘python -m pip’ command instead, or alternatively
                                                       the ‘python -m pip install --force pip’ command will
                                                       recreate the executables and show you the path to
                                                       add to ‘PATH’.  These scripts are separated for each
                                                       runtime, and so you may need to add multiple paths.
                                                       
                                                       
Typing ‘script-name.py’ in the terminal opens in a     This is a known limitation of the operating system.
new window.                                            Either specify ‘py’ before the script name, create a
                                                       batch file containing ‘@py "%~dpn0.py" %*’ with the
                                                       same name as the script, or install the legacy
                                                       launcher(2) and select it as the association for
                                                       scripts.
                                                       
                                                       
Drag-dropping files onto a script doesn't work         This is a known limitation of the operating system.
                                                       It is supported with the legacy launcher(3), or with
                                                       the Python install manager when installed from the
                                                       MSI.
                                                       
                                                       
I have installed the Python install manager multiple   It is possible to install from the Store or WinGet,
times.                                                 from the MSIX on the Python website, and from the
                                                       MSI, all at once.  They are all compatible and will
                                                       share configuration and runtimes.
                                                       
                                                       
                                                       See the earlier *note Advanced installation: 2201.
                                                       section for ways to uninstall the install manager
                                                       other than the typical Installed Apps (Add and
                                                       Remove Programs) settings page.
                                                       
                                                       
My old ‘py.ini’ settings no longer work.               The new Python install manager no longer supports
                                                       this configuration file or its settings, and so it
                                                       will be ignored.  See *note Configuration: 2204. for
                                                       information about configuration settings.
                                                       

   ---------- Footnotes ----------

   (1) https://github.com/python/pymanager/issues

   (2) https://www.python.org/ftp/python/3.14.0/win32/launcher.msi

   (3) https://www.python.org/ftp/python/3.14.0/win32/launcher.msi


File: python.info,  Node: 埋め込み可能なパッケージ,  Next: nuget org パッケージ,  Prev: Python install manager,  Up: Windows で Python を使う

3.4.2 埋め込み可能なパッケージ
------------------------------

Added in version 3.5.

埋め込み用の配布 (embedded distribution) は、最小限の Python 環境を含ん
だ ZIP ファイルです。これは、エンドユーザから直接的にアクセスされるので
はなく何かアプリケーションの一部として動作することを意図したものです。

To install an embedded distribution, we recommend using ‘py install’
with the ‘--target’ option:

     $> py install 3.14-embed --target=<directory>

When extracted, the embedded distribution is (almost) fully isolated
from the user's system, including environment variables, system registry
settings, and installed packages.  The standard library is included as
pre-compiled and optimized ‘.pyc’ files in a ZIP, and ‘python3.dll’,
‘python313.dll’, ‘python.exe’ and ‘pythonw.exe’ are all provided.
Tcl/tk (including all dependents, such as Idle), pip and the Python
documentation are not included.

A default ‘._pth’ file is included, which further restricts the default
search paths (as described below in *note モジュールの検索: e1a.).  This
file is intended for embedders to modify as necessary.

サードパーティのパッケージはアプリケーションのインストーラによって、埋め
込み用配布と同じ場所にインストールされるべきです。通常の Python インスト
レーションのように依存性管理に pip を使うことは、この配布ではサポートさ
れません。ですが、ちょっとした注意を払えば、自動更新のために pip を含め
て利用することはできるかもしれません。一般的には、ユーザに更新を提供する
前に開発者が新しいバージョンとの互換性を保証できるよう、サードパーティー
のパッケージはアプリケーションの一部として扱われるべきです
("vendoring")。

この配布の 2 つのお勧めできるユースケースを、以下で説明します。

* Menu:

* Python application::
* Python の埋め込み::


File: python.info,  Node: Python application,  Next: Python の埋め込み,  Up: 埋め込み可能なパッケージ

3.4.2.1 Python application
..........................

Python で記述された、必ずしもユーザにその事実を意識させる必要のないアプ
リケーションです。埋め込み用配布はこのケースで、インストールパッケージ内
に Python のプライベートバージョンを含めるのに使えるでしょう。その事実が
どのように透過的であるべきかに依存して (あるいは逆に、どのようにプロフェ
ッショナルにみえるべきか)、2 つの選択肢があります。

ランチャとなる特別な実行ファイルを使うことはちょっとしたコーディングを必
要としますが、ユーザにとっては最も透過的なユーザ体験となります。カスタマ
イズされたランチャでは、何もしなければ Python で実行されるプログラムの明
白な目印はありません; アイコンはカスタマイズし、会社名やバージョン情報を
指定し、ファイルの関連付けがそれに相応しく振舞うようにできます。ほとんど
のケースではカスタムランチャは、ハードコードされたコマンドライン文字列で
単純に ‘Py_Main’ を呼び出すので済むはずです。

より簡単なアプローチは、 ‘python.exe’ または ‘pythonw.exe’ を必要なコマ
ンドライン引数とともに直接呼び出すバッチファイルかショートカットを提供す
ることです。この場合、そのアプリケーションは実際の名前ではなく Python で
あるようにみえるので、ほかに動作している Python プロセスやファイルの関連
付けと区別するのにユーザが困るかもしれません。

後者のアプローチではパッケージは、パス上で利用可能であることを保証するた
めに、Python 実行ファイルと同じディレクトリにインストールされるべきです
。特別なランチャの場合はアプリケーション起動前に検索パスを指定する機会が
あるので、パッケージはほかの場所に配置できます。


File: python.info,  Node: Python の埋め込み,  Prev: Python application,  Up: 埋め込み可能なパッケージ

3.4.2.2 Python の埋め込み
.........................

ネイティブコードで書かれ、時々スクリプト言語のようなものを必要とするよう
なアプリケーションです。Python 埋め込み用の配布はこの目的に使えます。一
般的に、アプリケーションの大半がネイティブコード内にあり、一部が
‘python.exe’ を呼び出すか、直接的に ‘python3.dll’ を使います。どちらのケ
ースでも、ロード可能な Python インタプリタを提供するのには、埋め込み用の
配布を展開してアプリケーションのインストレーションのサブディレクトリに置
くことで十分です。

アプリケーションが使うパッケージは、インタプリタ初期化前に検索パスを指定
する機会があるので、任意の場所にインストールできます。また、埋め込み用配
布を使うのと通常の Python インストレーションを使うのとでの根本的な違いは
ありません。


File: python.info,  Node: nuget org パッケージ,  Next: 別のバンドル,  Prev: 埋め込み可能なパッケージ,  Up: Windows で Python を使う

3.4.3 nuget.org パッケージ
--------------------------

Added in version 3.5.2.

nuget.org パッケージはサイズを縮小した Python 環境で、システム全体で使え
る Python が無い継続的インテグレーションやビルドシステムで使うことを意図
しています。 nuget は ".NET のためのパッケージマネージャ" ですが、ビルド
時に使うツールを含んだパッケージに対しても非常に上手く動作します。

nuget の使用方法についての最新の情報を得るには nuget.org(1) に行ってくだ
さい。 ここから先は Python 開発者にとって十分な要約です。

‘nuget.exe’ コマンドラインツールは、例えば curl や PowerShell を使って
‘https://aka.ms/nugetclidl’ から直接ダウンロードできるでしょう。 このツ
ールを次のように使って、 64 bit あるいは 32 bit のマシン向けの最新バージ
ョンの Python がインストールできます:

     nuget.exe install python -ExcludeVersion -OutputDirectory .
     nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory .

特定のバージョンを選択するには、 ‘-Version 3.x.y’ を追加してください。 出
力ディレクトリは ‘.’ から変更されることがあり、パッケージはサブディレク
トリにインストールされます。 デフォルトではサブディレクトリはパッケージ
と同じ名前になり、 ‘-ExcludeVersion’ オプションを付けないとこの名前はイ
ンストールされたバージョンを含みます。 サブディレクトリの中にはインスト
ールされた Python を含んでいる ‘tools’ ディレクトリがあります:

     # Without -ExcludeVersion
     > .\python.3.5.2\tools\python.exe -V
     Python 3.5.2

     # With -ExcludeVersion
     > .\python\tools\python.exe -V
     Python 3.5.2

一般的には、 nuget パッケージはアップグレードできず、より新しいバージョ
ンは横並びにインストールされ、フルパスで参照されます。 そうする代わりに
、手動で直接パッケージを削除し、再度インストールすることもできます。 多
くの CI システムは、ビルド間でファイルを保存しておかない場合、この作業を
自動的に行います。

‘tools’ ディレクトリと同じ場所に ‘build\native’ ディレクトリがあります。
このディレクトリは、インストールされた Python を参照する C++ プロジェク
トで使える MSBuild プロパティファイル ‘python.props’ を含みます。 ここに
設定を入れると自動的にヘッダを使い、ビルド時にライプラリをインポートしま
す。

The package information pages on nuget.org are
www.nuget.org/packages/python(2) for the 64-bit version,
www.nuget.org/packages/pythonx86(3) for the 32-bit version, and
www.nuget.org/packages/pythonarm64(4) for the ARM64 version

* Menu:

* フリースレッドパッケージ (Free-threaded packages): フリースレッドパッケージ Free-threaded packages.

   ---------- Footnotes ----------

   (1) https://www.nuget.org/

   (2) https://www.nuget.org/packages/python

   (3) https://www.nuget.org/packages/pythonx86

   (4) https://www.nuget.org/packages/pythonarm64


File: python.info,  Node: フリースレッドパッケージ Free-threaded packages,  Up: nuget org パッケージ

3.4.3.1 フリースレッドパッケージ (Free-threaded packages)
.........................................................

Added in version 3.13.

フリースレッドバイナリ (free-threaded binaries) を含むパッケージは、
64-bit 版では python-freethreaded(1) 、 32-bit 版では
pythonx86-freethreaded(2) 、 ARM64 版では pythonarm64-freethreaded(3) と
命名されます。これらのパッケージはともに ‘python3.13t.exe’ と
‘python.exe’ エントリーポイントを含み、どちらもフリースレッドで実行され
ます。

   ---------- Footnotes ----------

   (1) https://www.nuget.org/packages/python-freethreaded

   (2) https://www.nuget.org/packages/pythonx86-freethreaded

   (3) https://www.nuget.org/packages/pythonarm64-freethreaded


File: python.info,  Node: 別のバンドル,  Next: Supported Windows versions,  Prev: nuget org パッケージ,  Up: Windows で Python を使う

3.4.4 別のバンドル
------------------

標準の CPython の配布物の他に、追加の機能を持っている修正されたパッケー
ジがあります。以下は人気のあるバージョンとそのキーとなる機能です:

ActivePython(1)

     マルチプラットフォーム互換のインストーラー、ドキュメント、 PyWin32

Anaconda(2)

     人気のある (numpy, scipy や pandas のような) 科学系モジュールと、パ
     ッケージマネージャ ‘conda’ 。

Enthought Deployment Manager(3)

     "次世代の Python 環境とパッケージマネージャー" ("The Next
     Generation Python Environment and Package Manager")。

     以前は Enthought が Canopy を提供していましたが、これは 2016 年にサ
     ポートが終了しました(4)。

WinPython(5)

     ビルド済みの科学系パッケージと、パッケージのビルドのためのツールを
     含む、Windows 固有のディストリビューション。

これらパッケージは Python や他のライブラリの最新バージョンが含まれるとは
限りませんし、コア Python チームはこれらを保守もしませんしサポートもしま
せんのでご理解ください。

   ---------- Footnotes ----------

   (1) https://www.activestate.com/products/python/

   (2) https://www.anaconda.com/download/

   (3) https://assets.enthought.com/downloads/edm/

   (4) 
https://support.enthought.com/hc/en-us/articles/360038600051-Canopy-GUI-end-of-life-transition-to-the-Enthought-Deployment-Manager-EDM-and-Visual-Studio-Code

   (5) https://winpython.github.io/


File: python.info,  Node: Supported Windows versions,  Next: Removing the MAX_PATH limitation,  Prev: 別のバンドル,  Up: Windows で Python を使う

3.4.5 Supported Windows versions
--------------------------------

As specified in PEP 11(1), a Python release only supports a Windows
platform while Microsoft considers the platform under extended support.
This means that Python 3.14 supports Windows 10 and newer.  If you
require Windows 7 support, please install Python 3.8.  If you require
Windows 8.1 support, please install Python 3.12.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0011/


File: python.info,  Node: Removing the MAX_PATH limitation,  Next: UTF-8 モード,  Prev: Supported Windows versions,  Up: Windows で Python を使う

3.4.6 Removing the MAX_PATH limitation
--------------------------------------

Windows は歴史的にパスの長さが 260 文字に制限されています。 つまり、これ
より長いパスは解決できず結果としてエラーになるということです。

In the latest versions of Windows, this limitation can be expanded to
over 32,000 characters.  Your administrator will need to activate the
"Enable Win32 long paths" group policy, or set ‘LongPathsEnabled’ to ‘1’
in the registry key
‘HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem’.

これにより、 *note open(): 316. 関数や *note os: a5. モジュール、他のほ
とんどのパスの機能が 260 文字より長いパスを受け入れ、返すことができるよ
うになります。

After changing the above option and rebooting, no further configuration
is required.


File: python.info,  Node: UTF-8 モード,  Next: モジュールの検索,  Prev: Removing the MAX_PATH limitation,  Up: Windows で Python を使う

3.4.7 UTF-8 モード
------------------

Added in version 3.7.

Windows still uses legacy encodings for the system encoding (the ANSI
Code Page).  Python uses it for the default encoding of text files (e.g.
*note locale.getencoding(): 329.).

This may cause issues because UTF-8 is widely used on the internet and
most Unix systems, including WSL (Windows Subsystem for Linux).

You can use the *note Python UTF-8 Mode: 866. to change the default text
encoding to UTF-8.  You can enable the *note Python UTF-8 Mode: 866. via
the ‘-X utf8’ command line option, or the ‘PYTHONUTF8=1’ environment
variable.  See *note PYTHONUTF8: ccf. for enabling UTF-8 mode, and *note
Python install manager: 1fca. for how to modify environment variables.

When the *note Python UTF-8 Mode: 866. is enabled, you can still use the
system encoding (the ANSI Code Page) via the "mbcs" codec.

Note that adding ‘PYTHONUTF8=1’ to the default environment variables
will affect all Python 3.7+ applications on your system.  If you have
any Python 3.7+ applications which rely on the legacy system encoding,
it is recommended to set the environment variable temporarily or use the
‘-X utf8’ command line option.

     注釈: Even when UTF-8 mode is disabled, Python uses UTF-8 by
     default on Windows for:

        * Console I/O including standard I/O (see PEP 528(1) for
          details).

        * The *note filesystem encoding: 75d. (see PEP 529(2) for
          details).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0528/

   (2) https://peps.python.org/pep-0529/


File: python.info,  Node: モジュールの検索,  Next: 追加のモジュール,  Prev: UTF-8 モード,  Up: Windows で Python を使う

3.4.8 モジュールの検索
----------------------

These notes supplement the description at *note sys.path
モジュール検索パスの初期化: 18dc. with detailed Windows notes.

‘._pth’ ファイルが見付からなかったときは、 Windows では *note sys.path:
3e4. は次のように設定されます:

   * 最初に空のエントリが追加されます。これはカレントディレクトリを指し
     ています。

   * その次に、 *note PYTHONPATH: 121f. 環境変数が存在するとき、 *note
     環境変数: 807. で解説されているように追加されます。 Windows ではド
     ライブ識別子 (‘C:\’ など)と区別するために、この環境変数に含まれるパ
     スの区切り文字はセミコロンでなければならない事に注意してください。

   * 追加で "アプリケーションのパス" を ‘HKEY_CURRENT_USER’ か
     ‘HKEY_LOCAL_MACHINE’ の中の
     ‘\SOFTWARE\Python\PythonCore{version}\PythonPath’ のサブキーとして
     登録することができます。サブキーはデフォルト値としてセミコロンで区
     切られたパス文字列を持つことができ、書くパスが *note sys.path: 3e4.
     に追加されます。 (既存のインストーラーはすべて HKLM しか利用しない
     ので、 HKCU は通常空です)

   * *note PYTHONHOME: 3f0. が設定されている場合、それが "Python Home" と
     して扱われます。 それ以外の場合、 "Python Home" を推定するために
     Python の実行ファイルのパスから "目印ファイル" (‘Lib\os.py’ または
     ‘pythonXY.zip’) が探されます。 Python home が見つかった場合、そこか
     らいくつかのサブディレクトリ (‘Lib’, ‘plat-win’ など) が *note
     sys.path: 3e4. に追加されます。 見つからなかった場合、コアとなる
     Python path はレジストリに登録された PythonPath から構築されます。

   * Python Home が見つからず、環境変数 *note PYTHONPATH: 121f. が指定さ
     れず、レジストリエントリが見つからなかった場合、関連するデフォルト
     のパスが利用されます (例: ‘.\Lib;.\plat-win’ など)。

メインの実行ファイルと同じ場所か一つ上のディレクトリに ‘pyvenv.cfg’ があ
る場合、以下の異なった規則が適用されます:

   * *note PYTHONHOME: 3f0. が設定されておらず、 ‘home’ が絶対パスの場合
     、home 推定の際メインの実行ファイルから推定するのではなくこのパスを
     使います。

結果としてこうなります:

   * ‘python.exe’ かそれ以外の Python ディレクトリにある .exe ファイルを
     実行したとき (インストールされている場合でも PCbuild から直接実行さ
     れている場合でも) core path が利用され、レジストリ内の core path は
     無視されます。それ以外のレジストリの "application paths" は常に読み
     込まれます。

   * Python が他の .exe ファイル (他のディレクトリに存在する場合や、
     COM経由で組み込まれる場合など) にホストされている場合は、 "Python
     Home" は推定されず、レジストリにある core path が利用されます。それ
     以外のレジストリの "application paths" は常に読み込まれます。

   * Python がその home を見つけられず、レジストリの値もない場合 (これは
     いくつかのとてもおかしなインストレーションセットアップの凍結された
     .exe)、パスは最小限のデフォルトとして相対パスが使われます。

自身のアプリケーションや配布物に Python をバンドルしたい場合には、以下の
助言 (のいずれかまたは組合せ) によりほかのインストレーションとの衝突を避
けることができます:

   * Include a ‘._pth’ file alongside your executable containing the
     directories to include.  This will ignore paths listed in the
     registry and environment variables, and also ignore *note site: cc.
     unless ‘import site’ is listed.

   * If you are loading ‘python3.dll’ or ‘python37.dll’ in your own
     executable, explicitly set *note PyConfig.module_search_paths: 643.
     before *note Py_InitializeFromConfig(): 3f6.

   * 自身のアプリケーションから ‘python.exe’ を起動する前に、 *note
     PYTHONPATH: 121f. をクリアしたり上書きし、 *note PYTHONHOME: 3f0. を
     セットしてください。

   * If you cannot use the previous suggestions (for example, you are a
     distribution that allows people to run ‘python.exe’ directly),
     ensure that the landmark file (‘Lib\os.py’) exists in your install
     directory.  (Note that it will not be detected inside a ZIP file,
     but a correctly named ZIP file will be detected instead.)

これらはシステムワイドにインストールされたファイルが、あなたのアプリケー
ションにバンドルされた標準ライブラリのコピーに優先しないようにします。こ
れをしなければあなたのアプリケーションのユーザは、何かしら問題を抱えるか
もしれません。上で列挙した最初の提案が最善です。ほかのものはレジストリ内
の非標準のパスやユーザの site-packages の影響を少し受けやすいからです。

バージョン 3.6 で変更: Add ‘._pth’ file support and removes ‘applocal’
option from ‘pyvenv.cfg’.

バージョン 3.6 で変更: Add ‘python`XX'.zip’ as a potential landmark when
directly adjacent to the executable.

バージョン 3.6 で非推奨: Modules specified in the registry under
‘Modules’ (not ‘PythonPath’) may be imported by *note
importlib.machinery.WindowsRegistryFinder: f26.  This finder is enabled
on Windows in 3.6.0 and earlier, but may need to be explicitly added to
*note sys.meta_path: f27. in the future.


File: python.info,  Node: 追加のモジュール,  Next: Windows 上で Python をコンパイルする,  Prev: モジュールの検索,  Up: Windows で Python を使う

3.4.9 追加のモジュール
----------------------

Python は全プラットフォーム互換を目指していますが、 Windows にしかないユ
ニークな機能もあります。標準ライブラリと外部のライブラリの両方で、幾つか
のモジュールと、そういった機能を使うためのスニペットがあります。

Windows 固有の標準モジュールは、 *note MS Windows 固有のサービス: 2220.
に書かれています。

* Menu:

* PyWin32::
* cx_Freeze::


File: python.info,  Node: PyWin32,  Next: cx_Freeze,  Up: 追加のモジュール

3.4.9.1 PyWin32
...............

The PyWin32(1) module by Mark Hammond is a collection of modules for
advanced Windows-specific support.  This includes utilities for:

   * Component Object Model(2) (COM)

   * Win32 API 呼び出し

   * レジストリ

   * イベントログ

   * Microsoft Foundation Classes(3) (MFC) user interfaces

PythonWin(4) は PyWin32 に付属している、サンプルのMFCアプリケーションで
す。これはビルトインのデバッガを含む、組み込み可能なIDEです。

参考
....

Win32 How Do I...?(5)

     by Tim Golden

Python and COM(6)

     by David and Paul Boddie

   ---------- Footnotes ----------

   (1) https://pypi.org/project/PyWin32/

   (2) 
https://learn.microsoft.com/windows/win32/com/component-object-model-com-portal

   (3) https://learn.microsoft.com/cpp/mfc/mfc-desktop-applications

   (4) 
https://web.archive.org/web/20060524042422/https://www.python.org/windows/pythonwin/

   (5) https://timgolden.me.uk/python/win32_how_do_i.html

   (6) https://www.boddie.org.uk/python/COM.html


File: python.info,  Node: cx_Freeze,  Prev: PyWin32,  Up: 追加のモジュール

3.4.9.2 cx_Freeze
.................

cx_Freeze(1) wraps Python scripts into executable Windows programs
(‘`*'.exe’ files).  When you have done this, you can distribute your
application without requiring your users to install Python.

   ---------- Footnotes ----------

   (1) https://cx-freeze.readthedocs.io/en/latest/


File: python.info,  Node: Windows 上で Python をコンパイルする,  Next: The full installer deprecated,  Prev: 追加のモジュール,  Up: Windows で Python を使う

3.4.10 Windows 上で Python をコンパイルする
-------------------------------------------

CPython を自分でコンパイルしたい場合、最初にすべきことは ソース(1) を取
得することです。最新リリース版のソースか、新しい チェックアウト(2) をダ
ウンロードできます。

ソースツリーには Microsoft Visual Studio でのビルドのソリューションファ
イルとプロジェクトファイルが含まれていて、これが公式の Python リリースに
使われているコンパイラです。これらファイルは ‘PCbuild’ ディレクトリ内に
あります。

ビルドプロセスについての一般的な情報は、‘PCbuild/readme.txt’ にあります
。

拡張モジュールについては、 *note Windows 上での C および C++
拡張モジュールのビルド: 2224. を参照してください。

   ---------- Footnotes ----------

   (1) https://www.python.org/downloads/source/

   (2) https://devguide.python.org/setup/#get-the-source-code


File: python.info,  Node: The full installer deprecated,  Next: Python launcher for Windows deprecated,  Prev: Windows 上で Python をコンパイルする,  Up: Windows で Python を使う

3.4.11 The full installer (deprecated)
--------------------------------------

バージョン 3.14 で非推奨: This installer is deprecated since 3.14 and
will not be produced for Python 3.16 or later.  See *note Python install
manager: 21fe. for the modern installer.

* Menu:

* インストール手順::
* Removing the MAX_PATH limitation: Removing the MAX_PATH limitation<2>.
* Installing without UI::
* Installing without downloading::
* インストール後の変更::
* Installing free-threaded binaries: Installing free-threaded binaries<2>.


File: python.info,  Node: インストール手順,  Next: Removing the MAX_PATH limitation<2>,  Up: The full installer deprecated

3.4.11.1 インストール手順
.........................

ダウンロードできる Python 3.14 のインストーラは 4 つあります。 インタプ
リタの 32 ビット版、64 ビット版がそれぞれ 2 つずつあります。 'WEB インス
トーラ' は最初のダウンロードサイズは小さく、必要なコンポーネントはインス
トーラ実行時に必要に応じて自動的にダウンロードします。 'オフラインインス
トーラ' にはデフォルトインストールに必要なコンポーネントが含まれていて、
インターネット接続はオプショナルな機能のためにだけに必要となります。 イ
ンストール時にダウンロードを避けるほかの方法については *note Installing
without downloading: 2228. を参照して下さい。

インストーラを開始すると、2つの選択肢からひとつを選べます:

[image src="python-figures/win_installer.png"]


"Install Now" を選択した場合:

   * 管理者権限は '不要です' (ただし C ランタイムライブラリのシステム更
     新が必要であったり、 *note Python install manager: 7da. をすべての
     ユーザ向けにインストールする場合は必要です)。

   * Python はあなたのユーザディレクトリにインストールされます。

   * *note Python install manager: 7da. はこのインストールウィザード最初
     のページの下部のチェックボックス指定に従ってインストールされます。

   * 標準ライブラリ、テストスイート、ランチャ、pip がインストールされま
     す。

   * このインストールウィザード最初の下部のチェックボックスをチェックす
     れば、環境変数 ‘PATH’ にインストールディレクトリが追加されます。

   * ショートカットはカレントユーザだけに可視になります。

"Customize installation" を選択すると、インストール場所、その他オプショ
ンやインストール後のアクションの変更などのインストールの有りようを選べま
す。デバッグシンボルやデバッグバイナリをインストールするならこちらを選択
する必要があるでしょう。

すべてのユーザのためのインストールのためには "Customize installation" を
選んでください。この場合:

   * 管理者資格か承認が必要かもしれません。

   * Python は Program Files ディレクトリにインストールされます。

   * *note Python install manager: 7da. は Windows ディレクトリにインス
     トールされます。

   * オプショナルな機能はインストール中に選択できます。

   * 標準ライブラリをバイトコードにプリコンパイルできます。

   * そう選択すれば、インストールディレクトリはシステム環境変数 ‘PATH’ に
     追加されます。

   * ショートカットがすべてのユーザで利用できるようになります。


File: python.info,  Node: Removing the MAX_PATH limitation<2>,  Next: Installing without UI,  Prev: インストール手順,  Up: The full installer deprecated

3.4.11.2 Removing the MAX_PATH limitation
.........................................

Windows は歴史的にパスの長さが 260 文字に制限されています。 つまり、これ
より長いパスは解決できず結果としてエラーになるということです。

Windows の最新版では、この制限は約 32,000 文字まで拡張できます。 管理者
が、グループポリシーの "Win32 の長いパスを有効にする (Enable Win32 long
paths)" を有効にするか、レジストリキー
‘HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem’ の
‘LongPathsEnabled’ の値を ‘1’ に設定する必要があります。

これにより、 *note open(): 316. 関数や *note os: a5. モジュール、他のほ
とんどのパスの機能が 260 文字より長いパスを受け入れ、返すことができるよ
うになります。

これらのオプションを変更したら、それ以上の設定は必要ありません。

バージョン 3.6 で変更: Python で長いパスのサポートが可能になりました。


File: python.info,  Node: Installing without UI,  Next: Installing without downloading,  Prev: Removing the MAX_PATH limitation<2>,  Up: The full installer deprecated

3.4.11.3 Installing without UI
..............................

インストーラの GUI で利用できるすべてのオプションは、コマンドラインから
も指定できます。これによりユーザとの対話なしで数多くの機器に同じインスト
ールを行うような、スクリプト化されたインストールを行うことができます。ち
ょっとしたデフォルトの変更のために、GUI を抑制することなしにこれらコマン
ドラインオプションをセットすることもできます。

インストーラーには、以下のオプション (‘/?’ でインストーラを実行すること
で確認できます) を渡すことができます:

名前                      説明
                          
---------------------------------------------------------------------------------------
                          
/passive                  ユーザーの操作なしでも進捗を表示する
                          
                          
/quiet                    UI を表示せずにインストール・アンインストールする
                          
                          
/simple                   ユーザーによるカスタマイズができないようにする
                          
                          
/uninstall                (確認無しで) Python を削除する
                          
                          
/layout [ディレクトリ]    すべてのコンポーネントを事前にダウンロードする
                          
                          
/log [ファイル名]         ログファイルの場所を指定する
                          

ほかのすべてのオプションは ‘name=value’ の形で渡します。value は大抵 ‘0’
で機能を無効化、 ‘1’ で機能を有効化、であるとかパスの指定です。利用可能
なオプションの完全なリストは以下の通りです。

名前                            説明                                       デフォルト
                                                                           
----------------------------------------------------------------------------------------------------------
                                                                           
InstallAllUsers                 システムワイドなインストールを実行する。   0
                                                                           
                                                                           
TargetDir                       インストール先ディレクトリ。               InstallAllUsers に基いて選択
                                                                           されます。
                                                                           
                                                                           
DefaultAllUsersTargetDir        すべてのユーザ向けインストールのためのデ   ‘%ProgramFiles%\Python X.Y’
                                フォルトインストール先ディレクトリ。       または
                                                                           ‘%ProgramFiles(x86)%\Python
                                                                           X.Y’
                                                                           
                                                                           
DefaultJustForMeTargetDir       自分一人用インストールのためのデフォルト   ‘%LocalAppData%\Programs\Python\PythonXY’
                                インストール先ディレクトリ。               または
                                                                           ‘%LocalAppData%\Programs\Python\PythonXY-32’
                                                                           または
                                                                           ‘%LocalAppData%\Programs\Python\PythonXY-64’
                                                                           
                                                                           
DefaultCustomTargetDir          カスタムインストールディレクトリとしてデ   (空)
                                フォルトで GUI に表示される値。            
                                
                                                                           
AssociateFiles                  ランチャもインストールする場合に、ファイ   1
                                ルの関連付けを行う。                       
                                
                                                                           
CompileAll                      すべての ‘.py’ ファイルをバイトコンパイ    0
                                ルして ‘.pyc’ を作る。                     
                                
                                                                           
PrependPath                     ‘PATH’ にインストールディレクトリと        0
                                Scripts ディレクトリを先頭に追加し、       
                                ‘PATHEXT’ に ‘.PY’ を追加する。
                                
                                                                           
AppendPath                      ‘PATH’ にインストールディレクトリと        0
                                Scripts ディレクトリを追加し、 ‘PATHEXT’   
                                に ‘.PY’ を追加する。
                                
                                                                           
Shortcuts                       インストールするインタプリタ、ドキュメン   1
                                ト、IDLE へのショートカットを作る。        
                                
                                                                           
Include_doc                     Python マニュアルをインストールする。      1
                                                                           
                                                                           
Include_debug                   デバッグバイナリをインストールする。       0
                                                                           
                                                                           
Include_dev                     開発者用ヘッダーとライブラリをインストー   1
                                ルする。これを省略すると、使用不可能なイ   
                                ンストールになる可能性があります。
                                
                                                                           
Include_exe                     ‘python.exe’ と関連するファイルをインス    1
                                トールする。これを省略すると、使用不可能   
                                なインストールになる可能性があります。
                                
                                                                           
Include_launcher                *note Python install manager: 7da. をイ    1
                                ンストールする。                           
                                
                                                                           
InstallLauncherAllUsers         すべてのユーザーにランチャーをインストー   1
                                ルする。 ‘Include_launcher’ が 1 に設定    
                                されている必要があります。
                                
                                                                           
Include_lib                     標準ライブラリと拡張モジュールをインスト   1
                                ールする。これを省略すると、使用不可能な   
                                インストールになる可能性があります。
                                
                                                                           
Include_pip                     バンドル版の pip と setuptools をインス    1
                                トールする。                               
                                
                                                                           
Include_symbols                 デバッグシンボル (‘*.pdb’) をインストー    0
                                ルする。                                   
                                
                                                                           
Include_tcltk                   Tcl/Tk サポートと IDLE をインストールす    1
                                る。                                       
                                
                                                                           
Include_test                    標準ライブラリのテストスイートをインスト   1
                                ールする。                                 
                                
                                                                           
Include_tools                   ユーティリティスクリプトをインストールす   1
                                る。                                       
                                
                                                                           
LauncherOnly                    ランチャのみをインストールする。これは他   0
                                のほとんどのオプションを上書きします。     
                                
                                                                           
SimpleInstall                   最大限のインストーラ GUI を無効にする。    0
                                                                           
                                                                           
SimpleInstallDescription        単純化されたインストーラ GUI を使う際に    (空)
                                表示するカスタムメッセージ。               
                                

例えばデフォルトでシステムワイドな Python インストレーションを静かに行う
には、以下コマンドを使えます (コマンドプロンプトより):

     python-3.9.0.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0

テストスイートなしの Python のパーソナルなコピーのインストールをユーザに
簡単に行わせるには、以下コマンドのショートカットを作れば良いです。これは
インストーラの最初のページを単純化して表示し、また、カスタマイズできない
ようにします:

     python-3.9.0.exe InstallAllUsers=0 Include_launcher=0 Include_test=0
         SimpleInstall=1 SimpleInstallDescription="Just for me, no test suite."

(ランチャのインストールを省略するとファイルの関連付けも省略されるので、
これはランチャインストールを含めたシステムワイドなインストールをした場合
のユーザごとインストールに限った場合のお勧めです。)

上でリストしたオプションは、実行ファイルと同じ場所の ‘unattend.xml’ と名
付けられたファイルで与えることもできます。このファイルはオプションとその
値のリストを指定します。値がアトリビュートとして与えられた場合、それは数
値であれば数値に変換されます。エレメントテキストで与える場合は常に文字列
のままです。以下は、先の例と同じオプションをセットするファイルの実例です
:

     <Options>
         <Option Name="InstallAllUsers" Value="no" />
         <Option Name="Include_launcher" Value="0" />
         <Option Name="Include_test" Value="no" />
         <Option Name="SimpleInstall" Value="yes" />
         <Option Name="SimpleInstallDescription">Just for me, no test suite</Option>
     </Options>


File: python.info,  Node: Installing without downloading,  Next: インストール後の変更,  Prev: Installing without UI,  Up: The full installer deprecated

3.4.11.4 Installing without downloading
.......................................

Python のいくつかの機能は最初にダウンロードしたインストーラには含まれて
いないため、それらの機能をインストールしようと選択するとインターネット接
続が必要になります。 インターネット接続が必要にならないように、全てのコ
ンポーネントをすぐにできる限りダウンロードして、完全な '配置構成
(layout)' を作成し、どんな機能が選択されたかに関わらず、それ以上インター
ネット接続を必要がないようにします。 この方法のダウンロードサイズは必要
以上に大きくなるかもしれませんが、たくさんの回数インストールしようとする
場合には、ローカルにキャッシュされたコピーを持つことはとても有用です。

コマンドプロンプトから以下のコマンドを実行して、必要なファイルをできる限
り全てダウンロードします。 ‘python-3.9.0.exe’ 部分は実際のインストーラの
名前に置き換え、同名のファイルどうしの衝突が起こらないように、個別のディ
レクトリ内に配置構成を作るのを忘れないようにしてください。

     python-3.9.0.exe /layout [optional target directory]

進捗表示を隠すのに ‘/quiet’ オプションを指定することもできます。


File: python.info,  Node: インストール後の変更,  Next: Installing free-threaded binaries<2>,  Prev: Installing without downloading,  Up: The full installer deprecated

3.4.11.5 インストール後の変更
.............................

いったん Python がインストールされたら、Windows のシステム機能の「プログ
ラムと機能」ツールから機能の追加や削除ができます。Python のエントリを選
択して「アンインストールと変更」を選ぶことで、インストーラをメンテナンス
モードで開きます。

インストーラ GUI で "Modify" を選ぶと、チェックボックスの選択を変えるこ
とで機能の追加削除ができます - チェックボックスの選択を変えなければ、何
かがインストールされたり削除されたりはしません。いくつかのオプションはこ
のモードでは変更することはできません。インストールディレクトリなどです。
それらを変えたいのであれば、完全に削除してから再インストールする必要があ
ります。

"Repair" では、現在の設定で本来インストールされるべきすべてのファイルを
検証し、削除されていたり更新されていたりするファイルを修正します。

"Uninstall" は Python を完全に削除します。「プログラムと機能」内の自身の
エントリを持つ *note Python install manager: 7da. の例外が起こります。


File: python.info,  Node: Installing free-threaded binaries<2>,  Prev: インストール後の変更,  Up: The full installer deprecated

3.4.11.6 Installing free-threaded binaries
..........................................

Added in version 3.13.

To install pre-built binaries with free-threading enabled (see PEP
703(1)), you should select "Customize installation".  The second page of
options includes the "Download free-threaded binaries" checkbox.

[image src="python-figures/win_install_freethreaded.png"]


Selecting this option will download and install additional binaries to
the same location as the main Python install.  The main executable is
called ‘python3.13t.exe’, and other binaries either receive a ‘t’ suffix
or a full ABI suffix.  Python source files and bundled third-party
dependencies are shared with the main install.

The free-threaded version is registered as a regular Python install with
the tag ‘3.13t’ (with a ‘-32’ or ‘-arm64’ suffix as normal for those
platforms).  This allows tools to discover it, and for the *note Python
install manager: 7da. to support ‘py.exe -3.13t’.  Note that the
launcher will interpret ‘py.exe -3’ (or a ‘python3’ shebang) as "the
latest 3.x install", which will prefer the free-threaded binaries over
the regular ones, while ‘py.exe -3.13’ will not.  If you use the short
style of option, you may prefer to not install the free-threaded
binaries at this time.

To specify the install option at the command line, use
‘Include_freethreaded=1’.  See *note Installing without downloading:
2228. for instructions on pre-emptively downloading the additional
binaries for offline install.  The options to include debug symbols and
binaries also apply to the free-threaded builds.

Free-threaded binaries are also available *note on nuget.org: 21fc.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0703/


File: python.info,  Node: Python launcher for Windows deprecated,  Prev: The full installer deprecated,  Up: Windows で Python を使う

3.4.12 Python launcher for Windows (deprecated)
-----------------------------------------------

バージョン 3.14 で非推奨: The launcher and this documentation have been
superseded by the Python Install Manager described above.  This is
preserved temporarily for historical interest.

Added in version 3.3.

Windows の Python ランチャは、異なる Python のバージョンの位置の特定と実
行を助けるユーティリティです。スクリプト (またはコマンドライン) で特定の
Python のバージョンの設定を与えられると、位置を特定し、そのバージョンを
実行します。

環境変数 ‘PATH’ による方法と違って、このランチャは Python の一番適切なバ
ージョンを、正しく選択します。このランチャはシステムワイドなものよりもユ
ーザごとのインストレーションの方を優先し、また、新しくインストールされた
順よりも言語のバージョンを優先します。

ランチャのオリジナルの仕様は PEP 397(1) にあります。

* Menu:

* 最初に::
* Shebang lines: Shebang lines<2>.
* シェバン行の引数::
* カスタマイズ::
* 診断::
* Dry run::
* Install on demand::
* Return codes::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0397/


File: python.info,  Node: 最初に,  Next: Shebang lines<2>,  Up: Python launcher for Windows deprecated

3.4.12.1 最初に
...............

* Menu:

* コマンドラインから起動する::
* 仮想環境 (Virtual environments): 仮想環境 Virtual environments.
* スクリプトから起動する::
* ファイルの関連付けから起動する::


File: python.info,  Node: コマンドラインから起動する,  Next: 仮想環境 Virtual environments,  Up: 最初に

3.4.12.2 コマンドラインから起動する
...................................

バージョン 3.6 で変更.

Python 3.3 とそれ以降のシステムワイドなインストールでは、ランチャーが
‘PATH’ に追加されます。ランチャーは、入手可能なあらゆる Python のバージ
ョンに互換性があるため、実際にどのバージョンの Python がインストールされ
ているのかは重要ではありません。ランチャーが使えるかを確認するには以下の
コマンドをコマンドプロンプトで実行してください:

     py

インストールされている最新バージョンの Python が起動するはずです。 通常
どおりに終了することもできますし、追加のコマンドライン引数を指定して直接
Python に渡すこともできます。

複数のバージョンの Python (たとえば 3.7 と 3.14) がインストールされてい
る場合は、Python 3.14 が起動することになります。Python 3.7 を起動したい
なら、次のコマンドを実行してみてください:

     py -3.7

インストールしてある Python 2 の最新バージョンを起動したい場合は、次のコ
マンドを実行してみてください:

     py -2

以下のようなエラーが出るようであれば、ランチャはインストールされていませ
ん:

     'py' is not recognized as an internal or external command,
     operable program or batch file.

このコマンド:

     py --list

これは、現在インストールされている Python のバージョンを表示します。

The ‘-x.y’ argument is the short form of the ‘-V:Company/Tag’ argument,
which allows selecting a specific Python runtime, including those that
may have come from somewhere other than python.org.  Any runtime
registered by following PEP 514(1) will be discoverable.  The ‘--list’
command lists all available runtimes using the ‘-V:’ format.

When using the ‘-V:’ argument, specifying the Company will limit
selection to runtimes from that provider, while specifying only the Tag
will select from all providers.  Note that omitting the slash implies a
tag:

     # Select any '3.*' tagged runtime
     py -V:3

     # Select any 'PythonCore' released runtime
     py -V:PythonCore/

     # Select PythonCore's latest Python 3 runtime
     py -V:PythonCore/3

The short form of the argument (‘-3’) only ever selects from core Python
releases, and not other distributions.  However, the longer form
(‘-V:3’) will select from any.

The Company is matched on the full string, case-insensitive.  The Tag is
matched on either the full string, or a prefix, provided the next
character is a dot or a hyphen.  This allows ‘-V:3.1’ to match ‘3.1-32’,
but not ‘3.10’.  Tags are sorted using numerical ordering (‘3.10’ is
newer than ‘3.1’), but are compared using text (‘-V:3.01’ does not match
‘3.1’).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0514/


File: python.info,  Node: 仮想環境 Virtual environments,  Next: スクリプトから起動する,  Prev: コマンドラインから起動する,  Up: 最初に

3.4.12.3 仮想環境 (Virtual environments)
........................................

Added in version 3.5.

(標準ライブラリの *note venv: 117. モジュールか外部ツール ‘virtualenv’ で
作った) 仮想環境がアクティブな状態で Python の明示的なバージョンを指定せ
ずにランチャを起動すると、ランチャはグローバルなインタプリタではなくその
仮想環境のものを実行します。グローバルなほうのインタプリタを実行するには
、仮想環境の動作を停止するか、または明示的にグローバルな Python バージョ
ンを指定してください。


File: python.info,  Node: スクリプトから起動する,  Next: ファイルの関連付けから起動する,  Prev: 仮想環境 Virtual environments,  Up: 最初に

3.4.12.4 スクリプトから起動する
...............................

テスト用の Python スクリプトを作成しましょう。‘hello.py’ という名前で以
下の内容のファイルを作成してください

     #! python
     import sys
     sys.stdout.write("hello from Python %s\n" % (sys.version,))

hello.py が存在するディレクトリで、下記コマンドを実行してください:

     py hello.py

インストールされている最新の Python 2.x のバージョン番号が表示されるはず
です。では、1行目を以下のように変更してみてください:

     #! python3

コマンドを再実行すると、今度は最新の Python 3.x の情報が表示されるはずで
す。これまでのコマンドラインの例と同様に、より細かいバージョン修飾子を指
定することもできます。Python 3.7 がインストールされている場合、最初の行
を ‘#! python3.7’ に変更すると、3.7 のバージョン情報が表示されるはずです
。

コマンドからの呼び出しとは異なり、後ろに何もつかない "python" はインスト
ールされている Python2.x の最新バージョンを利用することに注意してくださ
い。これは後方互換性と、 ‘python’ が一般的に Python 2 を指すUnix との互
換性のためです。


File: python.info,  Node: ファイルの関連付けから起動する,  Prev: スクリプトから起動する,  Up: 最初に

3.4.12.5 ファイルの関連付けから起動する
.......................................

インストール時に、ランチャは Python ファイル (すなわち ‘.py’, ‘.pyw’,
‘.pyc’ ファイル) に関連付けられたはずです。そのため、これらのファイルを
Windows のエクスプローラーでダブルクリックした際はランチャが使われ、上で
述べたのと同じ機能を使ってスクリプトが使われるべきバージョンを指定できる
ようになります。

このことによる重要な利点は、単一のランチャが先頭行の内容によって複数の
Python バージョンを同時にサポートできることです。


File: python.info,  Node: Shebang lines<2>,  Next: シェバン行の引数,  Prev: 最初に,  Up: Python launcher for Windows deprecated

3.4.12.6 Shebang lines
......................

スクリプトファイルの先頭の行が ‘#!’ で始まっている場合は、その行はシェバ
ン (shebang) 行として知られています。 Linux や他の Unix 系 OS はこうした
行をもともとサポートしているため、それらのシステムでは、スクリプトがどの
ように実行されるかを示すために広く使われます。 Windows の Python ランチ
ャは、Windows 上の Python スクリプトが同じ機能を使用できるようにし、上の
例ではそれらの機能の使用法を示しています。

Python スクリプトのシェバン行を Unix-Windows 間で移植可能にするため、こ
のランチャは、どのインタプリタが使われるかを指定するための大量の '仮想'
コマンドをサポートしています。サポートされる仮想コマンドには以下のものが
あります:

   * ‘/usr/bin/env’

   * ‘/usr/bin/python’

   * ‘/usr/local/bin/python’

   * ‘python’

具体的に、もしスクリプトの1行目が

     #! /usr/bin/python

で始まっていたら、デフォルトの Python またはアクティブな仮想環境の位置が
特定され、使用されます。多くの Unix 上で動作する Python スクリプトにはす
でにこの行が存在する傾向がありますので、ランチャによりそれらのスクリプト
を修正なしで使うことができるはずです。あなたが新しいスクリプトを Windows
上で書いていて、Unix 上でも有用であってほしいと思うなら、シェバン行のう
ち ‘/usr’ で始まるものを使用すべきです。

上記のどの仮想コマンドでも、(メジャーバージョンだけや、メジャー・マイナ
ーバージョンの両方で) 明示的にバージョンを指定できます。 さらに、 "-32"
をマイナーバージョンの後ろに追加して 32-bit 版を要求できます。 例えば、
‘/usr/bin/python3.7-32’ は 32-bit の Python 3.7 を使うよう要求します。仮
想環境がアクティブになっている場合は、バージョンは無視され、その環境が使
用されます。

Added in version 3.7: python ランチャの 3.7 からは、末尾に "-64" を付け
て 64-bit 版を要求できます。 さらに、マイナーバージョン無しのメジャーバ
ージョンとアーキテクチャだけ (例えば、 ‘/usr/bin/python3-64’) で指定でき
ます。

バージョン 3.11 で変更: The "-64" suffix is deprecated, and now implies
"any architecture that is not provably i386/32-bit".  To request a
specific environment, use the new ‘-V:TAG’ argument with the complete
tag.

バージョン 3.13 で変更: Virtual commands referencing ‘python’ now prefer
an active virtual environment rather than searching ‘PATH’.  This
handles cases where the shebang specifies ‘/usr/bin/env python3’ but
‘python3.exe’ is not present in the active environment.

The ‘/usr/bin/env’ form of shebang line has one further special
property.  Before looking for installed Python interpreters, this form
will search the executable ‘PATH’ for a Python executable matching the
name provided as the first argument.  This corresponds to the behaviour
of the Unix ‘env’ program, which performs a ‘PATH’ search.  If an
executable matching the first argument after the ‘env’ command cannot be
found, but the argument starts with ‘python’, it will be handled as
described for the other virtual commands.  The environment variable
‘PYLAUNCHER_NO_SEARCH_PATH’ may be set (to any value) to skip this
search of ‘PATH’.

Shebang lines that do not match any of these patterns are looked up in
the ‘[commands]’ section of the launcher's *note .INI file: 2235.  This
may be used to handle certain commands in a way that makes sense for
your system.  The name of the command must be a single argument (no
spaces in the shebang executable), and the value substituted is the full
path to the executable (additional arguments specified in the .INI will
be quoted as part of the filename).

     [commands]
     /bin/xpython=C:\Program Files\XPython\python.exe

Any commands not found in the .INI file are treated as 'Windows'
executable paths that are absolute or relative to the directory
containing the script file.  This is a convenience for Windows-only
scripts, such as those generated by an installer, since the behavior is
not compatible with Unix-style shells.  These paths may be quoted, and
may include multiple arguments, after which the path to the script and
any additional arguments will be appended.


File: python.info,  Node: シェバン行の引数,  Next: カスタマイズ,  Prev: Shebang lines<2>,  Up: Python launcher for Windows deprecated

3.4.12.7 シェバン行の引数
.........................

シェバン行では Python インタプリタに渡される追加の引数を指定することもで
きます。たとえば、シェバン行に以下のように書かれているとしましょう:

     #! /usr/bin/python -v

この場合、Python は ‘-v’ オプション付きで起動するでしょう


File: python.info,  Node: カスタマイズ,  Next: 診断,  Prev: シェバン行の引数,  Up: Python launcher for Windows deprecated

3.4.12.8 カスタマイズ
.....................

* Menu:

* INI ファイルによるカスタマイズ::
* デフォルトのPythonバージョンのカスタマイズ::


File: python.info,  Node: INI ファイルによるカスタマイズ,  Next: デフォルトのPythonバージョンのカスタマイズ,  Up: カスタマイズ

3.4.12.9 INI ファイルによるカスタマイズ
.......................................

ランチャは2つの .ini ファイルを探しに行きます。具体的には、現在のユーザ
ーのアプリケーションデータディレクトリ (‘%LOCALAPPDATA%’ または
‘$env:LocalAppData’) の ‘py.ini’ と、ランチャと同じディレクトリにある
‘py.ini’ です。'コンソール' 版のランチャ (つまり py.exe) と 'Windows' 版
のランチャ (つまり pyw.exe) は同一の .ini ファイルを使用します。

"application data" ディレクトリで指定された設定は、実行ファイルの隣にあ
るものより優先されます。そのため、ランチャの隣にある .ini ファイルへの書
き込みアクセスができないユーザは、グローバルな .ini ファイル内のコマンド
を上書き (override) できます。


File: python.info,  Node: デフォルトのPythonバージョンのカスタマイズ,  Prev: INI ファイルによるカスタマイズ,  Up: カスタマイズ

3.4.12.10 デフォルトのPythonバージョンのカスタマイズ
....................................................

どのバージョンの Python をコマンドで使用するかを定めるため、バージョン修
飾子がコマンドに含められることがあります。 バージョン修飾子はメジャーバ
ージョン番号で始まり、オプションのピリオド ('.')  とマイナーバージョン指
定子がそれに続きます。 さらに、 "-32" や "-64" を追記して 32-bit あるい
は 64-bit のどちらの実装が要求されるかを指示できます。

たとえば、‘#!python’ というシェバン行はバージョン修飾子を含みませんが、
‘#!python3’ はメジャーバージョンを指定するバージョン修飾子を含みます。

If no version qualifiers are found in a command, the environment
variable ‘PY_PYTHON’ can be set to specify the default version
qualifier.  If it is not set, the default is "3".  The variable can
specify any value that may be passed on the command line, such as "3",
"3.7", "3.7-32" or "3.7-64".  (Note that the "-64" option is only
available with the launcher included with Python 3.7 or newer.)

マイナーバージョン修飾子が見つからない場合、環境変数 ‘PY_PYTHON{major}’
(ここで ‘{major}’ は、上記で決定された現在のメジャーバージョン修飾子) を
設定して完全なバージョンを指定することができます。そういったオプションが
見つからなければ、ランチャはインストール済みの Python バージョンを列挙し
て、見つかったそのメジャーバージョン向けマイナーリリースのうち最新のもの
を使用します。保証されているわけではありませんが、通常はそのメジャーバー
ジョン系で最も後にインストールしたバージョンになります。

64-bit Windows で、同一の (major.minor) Python バージョンの 32-bit と
64-bit の両方の実装がインストールされていた場合、64-bit バージョンのほう
が常に優先されます。これはランチャが 32-bit と 64-bit のどちらでも言える
ことで、32-bit のランチャは、指定されたバージョンが使用可能であれば、
64-bit の Python を優先して実行します。これは、どのバージョンが PC にイ
ンストールされているかのみでランチャの挙動を予見でき、それらがインストー
ルされた順番に関係なくなる (つまり最後にインストールされた Python とラン
チャが 32-bit か 64-bit かを知らなくともよい) ようにするためです。上に記
したとおり、オプションの "-32", "-64" サフィックスでこの挙動を変更できま
す。

例:

   * 関連するオプションが設定されていない場合、‘python’ および ‘python2’
     コマンドはインストールされている最新の Python 2.x バージョンを使用
     し、‘python3’ コマンドはインストールされている最新の Python 3.x を
     使用します。

   * ‘python3.7’ コマンドは、バージョンが完全に指定されているため、全く
     オプションを参照しません。

   * ‘PY_PYTHON=3’ の場合、‘python’ および ‘python3’ コマンドはともにイ
     ンストールされている最新の Python 3 を使用します。

   * ‘PY_PYTHON=3.7-32’ の場合、‘python’ コマンドは 32-bit 版の 3.7 を使
     用しますが、‘python3’ コマンドはインストールされている最新の Python
     を使用します (メジャーバージョンが指定されているため、PY_PYTHON は
     全く考慮されません。)

   * ‘PY_PYTHON=3’ で ‘PY_PYTHON3=3.7’ の場合、‘python’ および ‘python3’
     はどちらも 3.7 を使用します

環境変数に加え、同じ設定をランチャが使う INI ファイルで構成することがで
きます。INI ファイルの該当するセクションは ‘[defaults]’ と呼ばれ、キー名
は環境変数のキー名から ‘PY_’ という接頭辞を取ったものと同じです (INI フ
ァイルのキー名は大文字小文字を区別しないことにご注意ください)。環境変数
の内容は INI ファイルでの指定を上書きします。

例えば:

   * ‘PY_PYTHON=3.7’ と設定することは、INI ファイルに下記が含まれること
     と等価です:

     [defaults]
     python=3.7

   * ‘PY_PYTHON=3’ と ‘PY_PYTHON3=3.7’ を設定することは、INI ファイルに
     下記が含まれることと等価です:

     [defaults]
     python=3
     python3=3.7


File: python.info,  Node: 診断,  Next: Dry run,  Prev: カスタマイズ,  Up: Python launcher for Windows deprecated

3.4.12.11 診断
..............

If an environment variable ‘PYLAUNCHER_DEBUG’ is set (to any value), the
launcher will print diagnostic information to stderr (i.e.  to the
console).  While this information manages to be simultaneously verbose
'and' terse, it should allow you to see what versions of Python were
located, why a particular version was chosen and the exact command-line
used to execute the target Python.  It is primarily intended for testing
and debugging.


File: python.info,  Node: Dry run,  Next: Install on demand,  Prev: 診断,  Up: Python launcher for Windows deprecated

3.4.12.12 Dry run
.................

If an environment variable ‘PYLAUNCHER_DRYRUN’ is set (to any value),
the launcher will output the command it would have run, but will not
actually launch Python.  This may be useful for tools that want to use
the launcher to detect and then launch Python directly.  Note that the
command written to standard output is always encoded using UTF-8, and
may not render correctly in the console.


File: python.info,  Node: Install on demand,  Next: Return codes,  Prev: Dry run,  Up: Python launcher for Windows deprecated

3.4.12.13 Install on demand
...........................

If an environment variable ‘PYLAUNCHER_ALLOW_INSTALL’ is set (to any
value), and the requested Python version is not installed but is
available on the Microsoft Store, the launcher will attempt to install
it.  This may require user interaction to complete, and you may need to
run the command again.

An additional ‘PYLAUNCHER_ALWAYS_INSTALL’ variable causes the launcher
to always try to install Python, even if it is detected.  This is mainly
intended for testing (and should be used with ‘PYLAUNCHER_DRYRUN’).


File: python.info,  Node: Return codes,  Prev: Install on demand,  Up: Python launcher for Windows deprecated

3.4.12.14 Return codes
......................

The following exit codes may be returned by the Python launcher.
Unfortunately, there is no way to distinguish these from the exit code
of Python itself.

The names of codes are as used in the sources, and are only for
reference.  There is no way to access or resolve them apart from reading
this page.  Entries are listed in alphabetical order of names.

名前                    値          説明
                                    
----------------------------------------------------------------------------------------
                                    
RC_BAD_VENV_CFG         107         A ‘pyvenv.cfg’ was found but is corrupt.
                                    
                                    
RC_CREATE_PROCESS       101         Failed to launch Python.
                                    
                                    
RC_INSTALLING           111         An install was started, but the command will need
                                    to be re-run after it completes.
                                    
                                    
RC_INTERNAL_ERROR       109         Unexpected error.  Please report a bug.
                                    
                                    
RC_NO_COMMANDLINE       108         Unable to obtain command line from the operating
                                    system.
                                    
                                    
RC_NO_PYTHON            103         Unable to locate the requested version.
                                    
                                    
RC_NO_VENV_CFG          106         A ‘pyvenv.cfg’ was required but not found.
                                    


File: python.info,  Node: macOS で Python を使う,  Next: Android で Python を使う,  Prev: Windows で Python を使う,  Up: Python のセットアップと利用

3.5 macOS で Python を使う
==========================

This document aims to give an overview of macOS-specific behavior you
should know about to get started with Python on Mac computers.  Python
on a Mac running macOS is very similar to Python on other Unix-derived
platforms, but there are some differences in installation and some
features.

There are various ways to obtain and install Python for macOS. Pre-built
versions of the most recent versions of Python are available from a
number of distributors.  Much of this document describes use of the
Pythons provided by the CPython release team for download from the
python.org website(1).  See *note Alternative Distributions: 2242. for
some other options.
* Menu:

* Using Python for macOS from python.org: Using Python for macOS from python org.
* Alternative Distributions::
* 追加の Python パッケージのインストール::
* GUI プログラミング::
* 高度なトピック::
* 他のリソース::

   ---------- Footnotes ----------

   (1) https://www.python.org/downloads/


File: python.info,  Node: Using Python for macOS from python org,  Next: Alternative Distributions,  Up: macOS で Python を使う

3.5.1 Using Python for macOS from ‘python.org’
----------------------------------------------

* Menu:

* インストール手順: インストール手順<2>.
* Python スクリプトの実行方法::


File: python.info,  Node: インストール手順<2>,  Next: Python スクリプトの実行方法,  Up: Using Python for macOS from python org

3.5.1.1 インストール手順
........................

For current Python versions(1) (other than those in ‘security’ status),
the release team produces a 'Python for macOS' installer package for
each new release.  A list of available installers is available here(2).
We recommend using the most recent supported Python version where
possible.  Current installers provide a universal2 binary(3) build of
Python which runs natively on all Macs (Apple Silicon and Intel) that
are supported by a wide range of macOS versions, currently typically
from at least 'macOS 10.15 Catalina' on.

The downloaded file is a standard macOS installer package file (‘.pkg’).
File integrity information (checksum, size, sigstore signature, etc) for
each file is included on the release download page.  Installer packages
and their contents are signed and notarized with ‘Python Software
Foundation’ Apple Developer ID certificates to meet macOS Gatekeeper
requirements(4).

For a default installation, double-click on the downloaded installer
package file.  This should launch the standard macOS Installer app and
display the first of several installer windows steps.

[image src="python-figures/mac_installer_01_introduction.png"]


Clicking on the 'Continue' button brings up the 'Read Me' for this
installer.  Besides other important information, the 'Read Me' documents
which Python version is going to be installed and on what versions of
macOS it is supported.  You may need to scroll through to read the whole
file.  By default, this 'Read Me' will also be installed in
‘/Applications/Python 3.14/’ and available to read anytime.

[image src="python-figures/mac_installer_02_readme.png"]


Clicking on 'Continue' proceeds to display the license for Python and
for other included software.  You will then need to 'Agree' to the
license terms before proceeding to the next step.  This license file
will also be installed and available to be read later.

[image src="python-figures/mac_installer_03_license.png"]


After the license terms are accepted, the next step is the 'Installation
Type' display.  For most uses, the standard set of installation
operations is appropriate.

[image src="python-figures/mac_installer_04_installation_type.png"]


By pressing the 'Customize' button, you can choose to omit or select
certain package components of the installer.  Click on each package name
to see a description of what it installs.  To also install support for
the optional free-threaded feature, see *note フリースレッドバイナリ
(Free-threaded Binaries) のインストール: 498.

[image src="python-figures/mac_installer_05_custom_install.png"]


In either case, clicking 'Install' will begin the install process by
asking permission to install new software.  A macOS user name with
‘Administrator’ privilege is needed as the installed Python will be
available to all users of the Mac.

When the installation is complete, the 'Summary' window will appear.

[image src="python-figures/mac_installer_06_summary.png"]


Double-click on the ‘Install Certificates.command’ icon or file in the
‘/Applications/Python 3.14/’ window to complete the installation.

[image src="python-figures/mac_installer_07_applications.png"]


This will open a temporary ‘Terminal’ shell window that will use the new
Python to download and install SSL root certificates for its use.

[image src="python-figures/mac_installer_08_install_certificates.png"]


If ‘Successfully installed certifi’ and ‘update complete’ appears in the
terminal window, the installation is complete.  Close this terminal
window and the installer window.

A default install will include:

   * A ‘Python 3.14’ folder in your ‘Applications’ folder.  In here you
     find ‘IDLE’, the development environment that is a standard part of
     official Python distributions; and ‘Python Launcher’, which handles
     double-clicking Python scripts from the macOS Finder(5).

   * A framework ‘/Library/Frameworks/Python.framework’, which includes
     the Python executable and libraries.  The installer adds this
     location to your shell path.  To uninstall Python, you can remove
     these three things.  Symlinks to the Python executable are placed
     in ‘/usr/local/bin/’.

     注釈: Recent versions of macOS include a ‘python3’ command in
     ‘/usr/bin/python3’ that links to a usually older and incomplete
     version of Python provided by and for use by the Apple development
     tools, ‘Xcode’ or the ‘Command Line Tools for Xcode’.  You should
     never modify or attempt to delete this installation, as it is
     Apple-controlled and is used by Apple-provided or third-party
     software.  If you choose to install a newer Python version from
     ‘python.org’, you will have two different but functional Python
     installations on your computer that can co-exist.  The default
     installer options should ensure that its ‘python3’ will be used
     instead of the system ‘python3’.

   ---------- Footnotes ----------

   (1) https://www.python.org/downloads/

   (2) https://www.python.org/downloads/macos/

   (3) https://en.wikipedia.org/wiki/Universal_binary

   (4) https://support.apple.com/en-us/102445

   (5) https://support.apple.com/en-us/HT201732


File: python.info,  Node: Python スクリプトの実行方法,  Prev: インストール手順<2>,  Up: Using Python for macOS from python org

3.5.1.2 Python スクリプトの実行方法
...................................

There are two ways to invoke the Python interpreter.  If you are
familiar with using a Unix shell in a terminal window, you can invoke
‘python3.14’ or ‘python3’ optionally followed by one or more command
line options (described in *note コマンドラインと環境: 1da7.).  The
Python tutorial also has a useful section on *note using Python
interactively from a shell: 494.

You can also invoke the interpreter through an integrated development
environment.  *note IDLE -- Python のエディタとシェル: 1217. is a basic
editor and interpreter environment which is included with the standard
distribution of Python.  ‘IDLE’ includes a Help menu that allows you to
access Python documentation.  If you are completely new to Python, you
can read the tutorial introduction in that document.

There are many other editors and IDEs available, see *note エディタと
IDE: 2248. for more information.

To run a Python script file from the terminal window, you can invoke the
interpreter with the name of the script file:

     ‘python3.14’ ‘myscript.py’

To run your script from the Finder, you can either:

   * Drag it to ‘Python Launcher’.

   * Select ‘Python Launcher’ as the default application to open your
     script (or any ‘.py’ script) through the Finder Info window and
     double-click it.  ‘Python Launcher’ has various preferences to
     control how your script is launched.  Option-dragging allows you to
     change these for one invocation, or use its ‘Preferences’ menu to
     change things globally.

Be aware that running the script directly from the macOS Finder might
produce different results than when running from a terminal window as
the script will not be run in the usual shell environment including any
setting of environment variables in shell profiles.  And, as with any
other script or program, be certain of what you are about to run.


File: python.info,  Node: Alternative Distributions,  Next: 追加の Python パッケージのインストール,  Prev: Using Python for macOS from python org,  Up: macOS で Python を使う

3.5.2 Alternative Distributions
-------------------------------

Besides the standard ‘python.org’ for macOS installer, there are
third-party distributions for macOS that may include additional
functionality.  Some popular distributions and their key features:

ActivePython(1)

     Installer with multi-platform compatibility, documentation

Anaconda(2)

     Popular scientific modules (such as numpy, scipy, and pandas) and
     the ‘conda’ package manager.

Homebrew(3)

     Package manager for macOS including multiple versions of Python and
     many third-party Python-based packages (including numpy, scipy, and
     pandas).

MacPorts(4)

     Another package manager for macOS including multiple versions of
     Python and many third-party Python-based packages.  May include
     pre-built versions of Python and many packages for older versions
     of macOS.

Note that distributions might not include the latest versions of Python
or other libraries, and are not maintained or supported by the core
Python team.

   ---------- Footnotes ----------

   (1) https://www.activestate.com/products/python/

   (2) https://www.anaconda.com/download/

   (3) https://brew.sh

   (4) https://www.macports.org


File: python.info,  Node: 追加の Python パッケージのインストール,  Next: GUI プログラミング,  Prev: Alternative Distributions,  Up: macOS で Python を使う

3.5.3 追加の Python パッケージのインストール
--------------------------------------------

Refer to the Python Packaging User Guide(1) for more information.

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/en/latest/tutorials/installing-packages/


File: python.info,  Node: GUI プログラミング,  Next: 高度なトピック,  Prev: 追加の Python パッケージのインストール,  Up: macOS で Python を使う

3.5.4 GUI プログラミング
------------------------

Python で Mac 上の GUI アプリケーションをビルドする方法がいくつかありま
す。

The standard Python GUI toolkit is *note tkinter: f6, based on the
cross-platform Tk toolkit (‘https://www.tcl.tk’).  A macOS-native
version of Tk is included with the installer.

'PyObjC' is a Python binding to Apple's Objective-C/Cocoa framework.
Information on PyObjC is available from pyobjc(1).

A number of alternative macOS GUI toolkits are available including:

   * PySide(2): Official Python bindings to the Qt GUI toolkit(3).

   * PyQt(4): Alternative Python bindings to Qt.

   * Kivy(5): A cross-platform GUI toolkit that supports desktop and
     mobile platforms.

   * Toga(6): Part of the BeeWare Project(7); supports desktop, mobile,
     web and console apps.

   * wxPython(8): A cross-platform toolkit that supports desktop
     operating systems.

   ---------- Footnotes ----------

   (1) https://pypi.org/project/pyobjc/

   (2) https://www.qt.io/qt-for-python

   (3) https://wiki.qt.io/Qt_for_Python

   (4) https://riverbankcomputing.com/software/pyqt/

   (5) https://kivy.org

   (6) https://toga.readthedocs.io

   (7) https://beeware.org

   (8) https://wxpython.org


File: python.info,  Node: 高度なトピック,  Next: 他のリソース,  Prev: GUI プログラミング,  Up: macOS で Python を使う

3.5.5 高度なトピック
--------------------

* Menu:

* フリースレッドバイナリ (Free-threaded Binaries) のインストール: フリースレッドバイナリ Free-threaded Binaries のインストール.
* Installing using the command line::
* Python アプリケーションの配布::
* App Store コンプライアンス::


File: python.info,  Node: フリースレッドバイナリ Free-threaded Binaries のインストール,  Next: Installing using the command line,  Up: 高度なトピック

3.5.5.1 フリースレッドバイナリ (Free-threaded Binaries) のインストール
......................................................................

Added in version 3.13.

The ‘python.org’ *note Python for macOS: 2244. installer package can
optionally install an additional build of Python 3.14 that supports PEP
703(1), the free-threading feature (running with the *note global
interpreter lock: 474. disabled).  Check the release page on
‘python.org’ for possible updated information.

The free-threaded mode is working and continues to be improved, but
there is some additional overhead in single-threaded workloads compared
to the regular build.  Additionally, third-party packages, in particular
ones with an *note extension module: 2251, may not be ready for use in a
free-threaded build, and will re-enable the *note GIL: 164.  Therefore,
the support for free-threading is not installed by default.  It is
packaged as a separate install option, available by clicking the
'Customize' button on the 'Installation Type' step of the installer as
described above.

[image src="python-figures/mac_installer_09_custom_install_free_threaded.png"]


If the box next to the 'Free-threaded Python' package name is checked, a
separate ‘PythonT.framework’ will also be installed alongside the normal
‘Python.framework’ in ‘/Library/Frameworks’.  This configuration allows
a free-threaded Python 3.14 build to co-exist on your system with a
traditional (GIL only) Python 3.14 build with minimal risk while
installing or testing.  This installation layout may change in future
releases.

Known cautions and limitations:

   - The 'UNIX command-line tools' package, which is selected by
     default, will install links in ‘/usr/local/bin’ for ‘python3.14t’,
     the free-threaded interpreter, and ‘python3.14t-config’, a
     configuration utility which may be useful for package builders.
     Since ‘/usr/local/bin’ is typically included in your shell ‘PATH’,
     in most cases no changes to your ‘PATH’ environment variables
     should be needed to use ‘python3.14t’.

   - For this release, the 'Shell profile updater' package and the
     ‘Update Shell Profile.command’ in ‘/Applications/Python 3.14/’ do
     not support the free-threaded package.

   - The free-threaded build and the traditional build have separate
     search paths and separate ‘site-packages’ directories so, by
     default, if you need a package available in both builds, it may
     need to be installed in both.  The free-threaded package will
     install a separate instance of ‘pip’ for use with ‘python3.14t’.

        - To install a package using ‘pip’ without a ‘venv’:

               python3.14t -m pip install <package_name>

   - When working with multiple Python environments, it is usually
     safest and easiest to *note create and use virtual environments:
     20eb.  This can avoid possible command name conflicts and confusion
     about which Python is in use:

          python3.14t -m venv <venv_name>

     then ‘activate’.

   - To run a free-threaded version of IDLE:

          python3.14t -m idlelib

   - The interpreters in both builds respond to the same *note PYTHON
     environment variables: 807. which may have unexpected results, for
     example, if you have ‘PYTHONPATH’ set in a shell profile.  If
     necessary, there are *note command line options: 211b. like ‘-E’ to
     ignore these environment variables.

   - The free-threaded build links to the third-party shared libraries,
     such as ‘OpenSSL’ and ‘Tk’, installed in the traditional framework.
     This means that both builds also share one set of trust
     certificates as installed by the ‘Install Certificates.command’
     script, thus it only needs to be run once.

   - If you cannot depend on the link in ‘/usr/local/bin’ pointing to
     the ‘python.org’ free-threaded ‘python3.14t’ (for example, if you
     want to install your own version there or some other distribution
     does), you can explicitly set your shell ‘PATH’ environment
     variable to include the ‘PythonT’ framework ‘bin’ directory:

          export PATH="/Library/Frameworks/PythonT.framework/Versions/3.14/bin":"$PATH"

     The traditional framework installation by default does something
     similar, except for ‘Python.framework’.  Be aware that having both
     framework ‘bin’ directories in ‘PATH’ can lead to confusion if
     there are duplicate names like ‘python3.14’ in both; which one is
     actually used depends on the order they appear in ‘PATH’.  The
     ‘which python3.x’ or ‘which python3.xt’ commands can show which
     path is being used.  Using virtual environments can help avoid such
     ambiguities.  Another option might be to create a shell ‘alias’ to
     the desired interpreter, like:

          alias py3.14="/Library/Frameworks/Python.framework/Versions/3.14/bin/python3.14"
          alias py3.14t="/Library/Frameworks/PythonT.framework/Versions/3.14/bin/python3.14t"

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0703/


File: python.info,  Node: Installing using the command line,  Next: Python アプリケーションの配布,  Prev: フリースレッドバイナリ Free-threaded Binaries のインストール,  Up: 高度なトピック

3.5.5.2 Installing using the command line
.........................................

If you want to use automation to install the ‘python.org’ installer
package (rather than by using the familiar macOS ‘Installer’ GUI app),
the macOS command line ‘installer’ utility lets you select non-default
options, too.  If you are not familiar with ‘installer’, it can be
somewhat cryptic (see ‘man installer’ for more information).  As an
example, the following shell snippet shows one way to do it, using the
‘3.14.0b2’ release and selecting the free-threaded interpreter option:

     RELEASE="python-3.140b2-macos11.pkg"

     # download installer pkg
     curl -O https://www.python.org/ftp/python/3.14.0/${RELEASE}

     # create installer choicechanges to customize the install:
     #    enable the PythonTFramework-3.14 package
     #    while accepting the other defaults (install all other packages)
     cat > ./choicechanges.plist <<EOF
     <?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     <plist version="1.0">
     <array>
             <dict>
                     <key>attributeSetting</key>
                     <integer>1</integer>
                     <key>choiceAttribute</key>
                     <string>selected</string>
                     <key>choiceIdentifier</key>
                     <string>org.python.Python.PythonTFramework-3.14</string>
             </dict>
     </array>
     </plist>
     EOF

     sudo installer -pkg ./${RELEASE} -applyChoiceChangesXML ./choicechanges.plist -target /

You can then test that both installer builds are now available with
something like:

     $ # test that the free-threaded interpreter was installed if the Unix Command Tools package was enabled
     $ /usr/local/bin/python3.14t -VV
     Python 3.14.0b2 free-threading build (v3.14.0b2:3a83b172af, Jun  5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]
     $ #    and the traditional interpreter
     $ /usr/local/bin/python3.14 -VV
     Python 3.14.0b2 (v3.14.0b2:3a83b172af, Jun  5 2024, 12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]
     $ # test that they are also available without the prefix if /usr/local/bin is on $PATH
     $ python3.14t -VV
     Python 3.14.0b2 free-threading build (v3.14.0b2:3a83b172af, Jun  5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]
     $ python3.14 -VV
     Python 3.14.0b2 (v3.14.0b2:3a83b172af, Jun  5 2024, 12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]

     注釈: Current ‘python.org’ installers only install to fixed
     locations like ‘/Library/Frameworks/’, ‘/Applications’, and
     ‘/usr/local/bin’.  You cannot use the ‘installer’ ‘-domain’ option
     to install to other locations.


File: python.info,  Node: Python アプリケーションの配布,  Next: App Store コンプライアンス,  Prev: Installing using the command line,  Up: 高度なトピック

3.5.5.3 Python アプリケーションの配布
.....................................

Python コードをスタンドアローンな配布アプリケーションに変換するツールに
は様々なものがあります:

   * py2app(1): Supports creating macOS ‘.app’ bundles from a Python
     project.

   * Briefcase(2): Part of the BeeWare Project(3); a cross-platform
     packaging tool that supports creation of ‘.app’ bundles on macOS,
     as well as managing signing and notarization.

   * PyInstaller(4): A cross-platform packaging tool that creates a
     single file or folder as a distributable artifact.

   ---------- Footnotes ----------

   (1) https://pypi.org/project/py2app/

   (2) https://briefcase.readthedocs.io

   (3) https://beeware.org

   (4) https://pyinstaller.org/


File: python.info,  Node: App Store コンプライアンス,  Prev: Python アプリケーションの配布,  Up: 高度なトピック

3.5.5.4 App Store コンプライアンス
..................................

Apps submitted for distribution through the macOS App Store must pass
Apple's app review process.  This process includes a set of automated
validation rules that inspect the submitted application bundle for
problematic code.

The Python standard library contains some code that is known to violate
these automated rules.  While these violations appear to be false
positives, Apple's review rules cannot be challenged.  Therefore, it is
necessary to modify the Python standard library for an app to pass App
Store review.

The Python source tree contains a patch file(1) that will remove all
code that is known to cause issues with the App Store review process.
This patch is applied automatically when CPython is configured with the
*note -with-app-store-compliance: 1997. option.

This patch is not normally required to use CPython on a Mac; nor is it
required if you are distributing an app 'outside' the macOS App Store.
It is 'only' required if you are using the macOS App Store as a
distribution channel.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Mac/Resources/app-store-compliance.patch


File: python.info,  Node: 他のリソース,  Prev: 高度なトピック,  Up: macOS で Python を使う

3.5.6 他のリソース
------------------

The python.org Help page(1) has links to many useful resources.  The
Pythonmac-SIG mailing list(2) is another support resource specifically
for Python users and developers on the Mac.

   ---------- Footnotes ----------

   (1) https://www.python.org/about/help/

   (2) https://www.python.org/community/sigs/current/pythonmac-sig/


File: python.info,  Node: Android で Python を使う,  Next: iOS で Python を使う,  Prev: macOS で Python を使う,  Up: Python のセットアップと利用

3.6 Android で Python を使う
============================

Android における Pythonは、デスクトッププラットフォームにおける Python と
は異なります。 デスクトッププラットフォームでは、 Python は一般的にコン
ピューターのどのユーザーでも使えるシステムリソースとしてインストールされ
ます。そして、ユーザーは ‘python’ 実行可能ファイルを実行して対話型プロン
プトにコマンドを入力したり、 Python スクリプトを実行したりして、 Python
を使用することができるのです。

Android においては、システムリソースとしてのインストールという概念はあり
ません。ソフトウェア配布が可能なのは、 "アプリ" だけです。また、
‘python’ 実行可能ファイルの実行したり、 Python の REPL を使用したりする
、コンソールも存在しません。

このため、 Python を Android 上で使うただ一つの方法は、埋め込みモード、
つまり、ネイティブ Android アプリケーションを書き、 ‘libpython’ を使用し
て Python インタープリタを埋め込み、そして *note Python 埋め込み API:
225b. を使用して Python コードを呼び出すことです。 それにより、完全な
Python インタープリタ、標準ライブラリ、及び Python のコードが、アプリに
パッケージ化され、独自の私的用途に使用されます。

Python の 標準ライブラリには、 Android におけるいくつかの重要な省略や制
限があります。詳細は *note API 利用可能性ガイド: 225c. を参照してくださ
い。

* Menu:

* Android アプリに Python を追加する::
* Android 向けの Python パッケージをビルドする::


File: python.info,  Node: Android アプリに Python を追加する,  Next: Android 向けの Python パッケージをビルドする,  Up: Android で Python を使う

3.6.1 Android アプリに Python を追加する
----------------------------------------

ほとんどのアプリ開発者は、次のツールの一つを使用するべきです。これにより
、はるかに簡単な体験が提供されます:

   * BeeWare プロジェクトの Briefcase(1)

   * Kivy プロジェクトの Buildozer(2)

   * Chaquopy(3)

   * pyqtdeploy(4)

   * Termux(5)

If you're sure you want to do all of this manually, read on.  You can
use the testbed app(6) as a guide; each step below contains a link to
the relevant file.

   * First, acquire a build of Python for Android:

        * The easiest way is to download an Android release from
          python.org(7).  The ‘prefix’ directory mentioned below is at
          the top level of the package.

        * Or if you want to build it yourself, follow the instructions
          in Android/README.md(8).  The ‘prefix’ directory will be
          created under ‘cross-build/HOST’.

   * Add code to your build.gradle(9) file to copy the following items
     into your project.  All except your own Python code can be copied
     from ‘prefix/lib’:

        * In your JNI libraries:

             * ‘libpython*.*.so’

             * ‘lib*_python.so’ (external libraries such as OpenSSL)

        * In your assets:

             * ‘python*.*’ (the Python standard library)

             * ‘python*.*/site-packages’ (your own Python code)

   * Add code to your app to extract the assets to the filesystem(10).

   * Add code to your app to start Python in embedded mode(11).  This
     will need to be C code called via JNI.

   ---------- Footnotes ----------

   (1) https://briefcase.readthedocs.io

   (2) https://buildozer.readthedocs.io

   (3) https://chaquo.com/chaquopy

   (4) https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/

   (5) https://termux.dev/en/

   (6) https://github.com/python/cpython/tree/3.14/Android/testbed

   (7) https://www.python.org/downloads/android/

   (8) https://github.com/python/cpython/tree/3.14/Android/README.md

   (9) 
https://github.com/python/cpython/tree/3.14/Android/testbed/app/build.gradle.kts

   (10) 
https://github.com/python/cpython/tree/3.14/Android/testbed/app/src/main/java/org/python/testbed/MainActivity.kt

   (11) 
https://github.com/python/cpython/tree/3.14/Android/testbed/app/src/main/c/main_activity.c


File: python.info,  Node: Android 向けの Python パッケージをビルドする,  Prev: Android アプリに Python を追加する,  Up: Android で Python を使う

3.6.2 Android 向けの Python パッケージをビルドする
--------------------------------------------------

Python packages can be built for Android as wheels and released on PyPI.
The recommended tool for doing this is cibuildwheel(1), which automates
all the details of setting up a cross-compilation environment, building
the wheel, and testing it on an emulator.

   ---------- Footnotes ----------

   (1) https://cibuildwheel.pypa.io/en/stable/platforms/#android


File: python.info,  Node: iOS で Python を使う,  Next: エディタと IDE,  Prev: Android で Python を使う,  Up: Python のセットアップと利用

3.7 iOS で Python を使う
========================


著者: Russell Keith-Magee (2024-03)

iOS における Pythonは、デスクトッププラットフォームにおける Python とは
異なります。 デスクトッププラットフォームでは、 Python は一般的にコンピ
ューターのどのユーザーでも使えるシステムリソースとしてインストールされま
す。そして、ユーザーは ‘python’ 実行可能ファイルを実行して対話型プロンプ
トにコマンドを入力したり、 Python スクリプトを実行したりして、 Python を
使用することができるのです。

iOS においては、システムリソースとしてのインストールという概念はありませ
ん。ソフトウェア配布が可能なのは、 "アプリ" だけです。また、 ‘python’ 実
行可能ファイルを実行したり、 Python の REPL を使用したりする、コンソール
も存在しません。

このため、 Python を iOS 上で使うただ一つの方法は、埋め込みモード、つま
り、ネイティブ iOS アプリケーションを書き、 ‘libPython’ を使用して
Python インタープリタを埋め込み、そして *note Python 埋め込み API: 225b.
を使用して Python コードを呼び出すことです。 それにより、完全な Python イ
ンタープリタ、標準ライブラリ、 及び Python のコードが、 iOS App Store を
経由して配布可能なスタンドアローンなバンドルとしてパッケージ化されます。

もし、初めて iOS アプリを Python で書くことを試みているなら、 BeeWare(1)
や Kivy(2) といったプロジェクトは、よりわかりやすいユーザー体験を提供す
るでしょう。これらのプロジェクトは iOS プロジェクトを実行することに関連
する複雑なことを管理するので、あなたは Python のコードに集中するだけで良
くなります。

* Menu:

* iOS ランタイムでの Python::
* iOS での Python のインストール::
* App Store コンプライアンス: App Store コンプライアンス<2>.

   ---------- Footnotes ----------

   (1) https://beeware.org

   (2) https://kivy.org


File: python.info,  Node: iOS ランタイムでの Python,  Next: iOS での Python のインストール,  Up: iOS で Python を使う

3.7.1 iOS ランタイムでの Python
-------------------------------

* Menu:

* iOS のバージョン互換性::
* プラットフォームの識別::
* 標準ライブラリの利用可能性::
* バイナリ拡張モジュール::
* コンパイラスタブバイナリ::


File: python.info,  Node: iOS のバージョン互換性,  Next: プラットフォームの識別,  Up: iOS ランタイムでの Python

3.7.1.1 iOS のバージョン互換性
..............................

サポートされる最小の iOS バージョンは、コンパイル時に ‘configure’ の
*note -host: 21c4. オプションを使用して指定できます。デフォルトでは、
iOS 用にコンパイルする場合、 Python は最小で 13.0 の iOS バージョンをサ
ポートするようにコンパイルされます。異なる最小 iOS バージョンを使用する
には、 ‘--host’ 引数の一部としてバージョン番号を提供します。例えば
‘--host=arm64-apple-ios15.4-simulator’ とすると、 ARM64 シミュレーター用
のビルドを Deployment Target 15.4 でコンパイルします。


File: python.info,  Node: プラットフォームの識別,  Next: 標準ライブラリの利用可能性,  Prev: iOS のバージョン互換性,  Up: iOS ランタイムでの Python

3.7.1.2 プラットフォームの識別
..............................

iOS 上で実行している場合、 ‘sys.platform’ は ‘ios’ となります。アプリが
シミュレーターで実行されているか、物理デバイスで実行されているかにかかわ
らず、 iPhone または iPad ではこの値となります。

iOS バージョンやデバイスのモデル、デバイスがシミュレーターであるかどうか
を含めた、特定のランタイム環境についての情報は、 *note
platform.ios_ver(): 2266. を使用して取得できます。 *note
platform.system(): 2267. は、デバイスにより ‘iOS’ または ‘iPadOS’ を報告
します。

*note os.uname(): 132e. は、カーネルレベルの詳細を報告します。これは
‘Darwin’ の名前を報告します。


File: python.info,  Node: 標準ライブラリの利用可能性,  Next: バイナリ拡張モジュール,  Prev: プラットフォームの識別,  Up: iOS ランタイムでの Python

3.7.1.3 標準ライブラリの利用可能性
..................................

Python の 標準ライブラリには、 iOS におけるいくつかの重要な省略や制限が
あります。詳細は *note iOS 向けの API 利用可能性ガイド: 225c. を参照して
ください。


File: python.info,  Node: バイナリ拡張モジュール,  Next: コンパイラスタブバイナリ,  Prev: 標準ライブラリの利用可能性,  Up: iOS ランタイムでの Python

3.7.1.4 バイナリ拡張モジュール
..............................

プラットフォームとしての iOS についての重要な違いの一つは、 App Store で
の配布がアプリケーションのパッケージングに厳しい条件を課すということです
。 これらの条件の一つは、バイナリ拡張モジュールの配布方法を規定します。

iOS App Store では、 iOS アプリの全てのバイナリモジュールが、パッケージ
化されたアプリの ‘Frameworks’ フォルダに保存された、適切なメタデータ付き
のフレームワークに含まれる動的ライブラリである必要があります。フレームワ
ークごとにバイナリは一つだけで、 ‘Frameworks’ フォルダの外に実行可能バイ
ナリデータを設置することはできません。

これは、バイナリ拡張モジュールが ‘sys.path’ 上のどの場所からでも読み込み
可能な、通常の Python のバイナリ配布のアプローチと衝突します。 確実に
App Store ポリシーに従うために、 iOS プロジェクトはいずれの Python パッ
ケージにも、 ‘.so’ バイナリモジュールを、個別の、スタンドアローンで、適
切なメタデータと署名付きのフレームワークに変換する後処理を行わなければな
りません。どのように後処理を行うかの詳細は、 *note プロジェクトに Python
を追加する: 226a. のガイドを参照してください。

Python が新しい場所にあるバイナリを見つけることを助けるために、
‘sys.path’ にある元の ‘.so’ ファイルは ‘.fwork’ ファイルに置き換えられま
す。 このファイルは、アプリバンドルからのレームワークバイナリの相対パス
を含むテキストファイルです。フレームワークが元の場所に解決できるようにす
るためには、フレームワークは、アプリバンドルからの ‘.fwork’ ファイルの相
対パスが含まれた、 ‘.origin’ ファイルを含む必要があります。

例えば、‘from foo.bar import _whiz’ をインポートする場合を考えてみましょ
う。 ‘_whiz’ がバイナリモジュール ‘sources/foo/bar/_whiz.abi3.so’ で実装
されており、 ‘sources’ のアプリケーションバンドルからの相対パスが
‘sys.path’ に登録されています。このモジュールは
‘Frameworks/foo.bar._whiz.framework/foo.bar._whiz’ (フレームワーク名はモ
ジュールの完全なインポートパスから命名されています) として、バイナリをフ
レームワークとして識別する ‘Info.plist’ ファイルを ‘.framework’ ディレク
トリ内に設置して配布しなければなりません。 ‘foo.bar._whiz’ モジュールは
、元の場所で、 ‘Frameworks/foo.bar._whiz/foo.bar._whiz’ のパスを含む
‘sources/foo/bar/_whiz.abi3.fwork’ マーカーファイルに記述されます。 また
、フレームワークは、 ‘.fwork’ へのパスを含む
‘Frameworks/foo.bar._whiz.framework/foo.bar._whiz.origin’ も含まなければ
なりません。

iOS 上で実行している場合、 Python インタープリタは ‘.fwork’ ファイルを読
み込んでインポートすることができる *note AppleFrameworkLoader: 226b. を
インストールします。インポートされると、バイナリモジュールの ‘__file__’
属性は ‘.fwork’ ファイルの場所を返します。一方、読み込まれたモジュールの
*note ModuleSpec: 226c. はフレームワークフォルダのバイナリの場所として
‘origin’ を返します。


File: python.info,  Node: コンパイラスタブバイナリ,  Prev: バイナリ拡張モジュール,  Up: iOS ランタイムでの Python

3.7.1.5 コンパイラスタブバイナリ
................................

Xcode は、 iOS 用の明示的なコンパイラを提供していません。代わりに、完全
なコンパイラのパスを解決する ‘xcrun’ スクリプトを使用します (たとえば
‘xcrun --sdk iphoneos clang’ は iPhone デバイス用の ‘clang’ を取得します
) 。しかし、これは2つの問題を引き起こします:

   * ‘xcrun’ の出力はマシン固有のパスを含み、ユーザー間で共有できない
     sysconfig モジュールにつながり、

   * これにより、 ‘CC’/‘CPP’/‘LD’/‘AR’ 定義にスペースが含まれることにな
     ります。多くの C エコシステムツールが、最初のスペースでコマンドライ
     ンを分割し、コンパイラ実行ファイルを取得できることを前提としていま
     す。しかし、 ‘xcrun’ を使用する場合はそうではありません。

これらの問題を避けるため、 Python はこれらのツール用のスタブを提供しまし
た。これらのスタブは、コンパイルされた iOS フレームワークとともに配布さ
れる ‘bin’ フォルダで配布される、基礎の ‘xcrun’ ツールのシェルスクリプト
ラッパーです。これらのスクリプトは再配置可能で、常に適切なローカルシステ
ムパスに解決されます。これらのスクリプトをフレームワークを伴う bin フォ
ルダーに含めることで、 ‘sysconfig’ モジュールはエンドユーザーが自身のモ
ジュールをコンパイルするのに有用になります。iOS 用の サードパーティの
Python モジュールをコンパイルするときは、これらのスタブバイナリがパス上
にあることを確認するべきです。


File: python.info,  Node: iOS での Python のインストール,  Next: App Store コンプライアンス<2>,  Prev: iOS ランタイムでの Python,  Up: iOS で Python を使う

3.7.2 iOS での Python のインストール
------------------------------------

* Menu:

* iOS アプリビルド用のツール::
* iOS プロジェクトに Python を追加する::
* Python パッケージのテスト::


File: python.info,  Node: iOS アプリビルド用のツール,  Next: iOS プロジェクトに Python を追加する,  Up: iOS での Python のインストール

3.7.2.1 iOS アプリビルド用のツール
..................................

iOS 向けのビルドには、 Apple の Xcode のツールを使用します。Xcode の最新
の安定リリースを使用することを強く推奨します。Apple は古い macOS のバー
ジョン向けには Xcode をメンテナンスしないため、これには最も (または二番
目に) 最近にリリースされた macOS のバージョンが必要です。 Xcode コマンド
ラインツールは iOS 開発には不十分であり、完全な Xcode のインストールが必
要です。

iOS シミュレーター上でコードを実行したい場合は、 iOS Simulator プラット
フォームもインストールする必要があります。 Xcode を初めて実行したとき、
iOS Simulator プラットフォームを選択するプロンプトが表示されるはずです。
代わりに、 Xcode の Settings パネルの Platforms タブから iOS Simulator プ
ラットフォームを選択して追加することもできます。


File: python.info,  Node: iOS プロジェクトに Python を追加する,  Next: Python パッケージのテスト,  Prev: iOS アプリビルド用のツール,  Up: iOS での Python のインストール

3.7.2.2 iOS プロジェクトに Python を追加する
............................................

Python は、 Swift または Objective-C を使って、どの iOS プロジェクトにで
も追加できます。以下の例では、 Objective-C を使用しています。 Swift を使
う場合は、 PythonKit(1) のようなライブラリが役に立つかもしれません。

Python を iOS Xcode プロジェクトに追加するには:

  1. Python の ‘XCFramework’ をビルドまたは取得します。 Python の
     ‘XCFramework’ をビルドする方法についての詳細は、
     Apple/iOS/README.md(2) (CPython のソースコードにあります) の説明を
     参照してください。最低でも、 ‘arm64-apple-ios’ に加えて
     ‘arm64-apple-ios-simulator’ または ‘x86_64-apple-ios-simulator’ の
     どちらかをサポートするビルドが必要です。

  2. ‘XCframework’ を iOS プロジェクトにドラッグします。以降の説明では、
     プロジェクトのルートに ‘XCframework’ を設置したものと仮定しますが、
     パスを必要に応じて調整することで、他の場所を使用することも出来ます
     。

  3. アプリケーションのコードを、 Xcode プロジェクトにフォルダーとして追
     加します。以降の説明では、 プロジェクトのルートに ‘app’ という名前
     のユーザーコードが入ったフォルダを設置したものと仮定しますが、パス
     を必要に応じて調整することで、他の場所を使用することも出来ます。フ
     ォルダがアプリのターゲットに関連付けられていることを確認してくださ
     い。

  4. Xcode プロジェクトのルートノードを選択することで、アプリのターゲッ
     トを選択してください。すると、ターゲット名がサイドバーに現れるはず
     です。

  5. "General" の設定の "Frameworks, Libraries and Embedded Content" に
     、 "Embed & Sign" を選択して ‘Python.xcframework’ を追加してくださ
     い。

  6. "Build Settings" タブで、次の項目を修正してください:

        - Build Options

             * User Script Sandboxing: No

             * Enable Testability: Yes

        - Search Paths

             * Framework Search Paths: ‘$(PROJECT_DIR)’

             * Header Search Paths:
               ‘"$(BUILT_PRODUCTS_DIR)/Python.framework/Headers"’

        - Apple Clang - Warnings - All languages

             * Quoted Include In Framework Header: No

  7. Python の標準ライブラリおよび独自の Python バイナリ依存関係を処理す
     るビルドステップを追加します。 "Build Phases" タブで、新しい "Run
     Script" ビルドステップを "Embed Frameworks" ステップの前に追加して
     ください。ステップの名前は "Process Python libraries" にして、
     "Based on dependency analysis" のチェックボックスを外し、スクリプト
     の内容を次のように設定してください:

          set -e
          source $PROJECT_DIR/Python.xcframework/build/build_utils.sh
          install_python Python.xcframework app

     もし XCFramework をプロジェクトのルート以外のどこかに設置した場合は
     、一つ目の引数へのパスを修正してください。

  8. Python インタープリタを埋め込みモードで初期化・使用する Objective C
     コードを追加します。次のことを確認する必要があります:

        * UTF-8 モード (*note PyPreConfig.utf8_mode: 41d.) が '有効' に
          なっていること

        * Buffered stdio (*note PyConfig.buffered_stdio: 411.) が '無効'
          になっていること

        * バイトコードの書き込み (*note PyConfig.write_bytecode: 40d.) が
          '無効' になっていること

        * シグナルハンドラ (*note PyConfig.install_signal_handlers:
          abb.) が '有効' になっていること

        * システムログ (*note PyConfig.use_system_logger: 2271.) が '有
          効' になっていること (オプションですが、強く推奨され、デフォル
          トで有効化されています)

        * インタープリタの *note PYTHONHOME: 3f0. がアプリバンドルの
          ‘python’ サブフォルダを指すように構成されていること

        * インタープリタの *note PYTHONPATH: 121f. が次のものを含むこと

             - アプリのバンドルの ‘python/lib/python3.X’ サブフォルダ

             - アプリのバンドルの ‘python/lib/python3.X/lib-dynload’ サ
               ブフォルダ

             - アプリのバンドルの ‘app’ サブフォルダ

     アプリのバンドルの場所は ‘[[NSBundle mainBundle] resourcePath]’ を
     用いて取得できます。

これらの説明の手順 7, 8 は ‘app’ という名前のただ一つの純粋な Python ア
プリケーションのコードのフォルダがあることを前提としています。もしサード
パーティのバイナリモジュールがアプリに含まれる場合は、いくつかの追加の手
順が必要です:

   * サードパーティのバイナリを含むフォルダが、アプリのターゲットに関連
     付けられている、または手順 7 の一部として明示的にコピーされているこ
     とを確認する必要があります。手順 7 では、特定のビルドがターゲットと
     するプラットフォームに適切でないバイナリを取り除く(つまり、もしシミ
     ュレーターをターゲットとするアプリをビルドしている場合は、デバイス
     バイナリを削除する)ことも必要です。

   * サードパーティのパッケージに別のフォルダを使用している場合は、手順
     7 でフォルダが ‘install_python’ の呼び出しの末尾に追加され、手順 8
     の *note PYTHONPATH: 121f. 設定の一つとして追加されていることを確認
     してください。

   * サードパーティパッケージを含むフォルダが ‘.pth’ ファイルを含む場合
     、直接 *note PYTHONPATH: 121f. や *note sys.path: 3e4. に追加するの
     ではなく、そのフォルダを (*note site.addsitedir(): 2272. を使用して
     ) サイトディレクトリとして追加する必要があります。

   ---------- Footnotes ----------

   (1) https://github.com/pvieito/PythonKit

   (2) https://github.com/python/cpython/tree/3.14/Apple/iOS/README.md


File: python.info,  Node: Python パッケージのテスト,  Prev: iOS プロジェクトに Python を追加する,  Up: iOS での Python のインストール

3.7.2.3 Python パッケージのテスト
.................................

CPython ソースツリーには、 iOS シミュレーター上で CPython テストスイート
を実行するために使用される テストベッドプロジェクト(1) が含まれています
。このテストベッドは、 iOSで Python ライブラリのテストスイートを実行する
ためのテストベッドプロジェクトとしても使用できます。

iOS XCFramework (詳細は Apple/iOS/README.md(2) を参照) をビルドまたは取
得した後は、 Python iOS テストベッドプロジェクトの複製を作成してください
。 XCFramework をビルドする ‘Apple’ ビルドスクリプトを使用して場合は、次
のコマンドを実行して行えます:

     $ python cross-build/iOS/testbed clone --app <module1 のパス> --app <module2 のパス> app-testbed

もしくは、独自の XCFramework を調達した場合は、次のコマンドを実行して行
えます:

     $ python Apple/testbed clone --platform iOS --framework <Python.xcframework のパス> --app <module1 のパス> --app <module2 のパス> app-testbed

‘--app’ フラグで指定されたフォルダは、複製されたテストベッドプロジェクト
にコピーされます。結果として得られるテストベッドは、 ‘app-testbed’ フォ
ルダの中に作成されます。この例では、 ‘module1’ と ‘module2’ が、実行時に
インポート可能なモジュールとなります。プロジェクトに追加の依存関係がある
場合は、 (‘pip install --target app-testbed/Testbed/app_packages’ をなど
使用して) それらは ‘app-testbed/Testbed/app_packages’ フォルダの中にイン
ストールできます。

You can then use the ‘app-testbed’ folder to run the test suite for your
app, For example, if ‘module1.tests’ was the entry point to your test
suite, you could run:

     $ python app-testbed run -- module1.tests

This is the equivalent of running ‘python -m module1.tests’ on a desktop
Python build.  Any arguments after the ‘--’ will be passed to the
testbed as if they were arguments to ‘python -m’ on a desktop machine.

You can also open the testbed project in Xcode by running:

     $ open app-testbed/iOSTestbed.xcodeproj

This will allow you to use the full Xcode suite of tools for debugging.

The arguments used to run the test suite are defined as part of the test
plan.  To modify the test plan, select the test plan node of the project
tree (it should be the first child of the root node), and select the
"Configurations" tab.  Modify the "Arguments Passed On Launch" value to
change the testing arguments.

The test plan also disables parallel testing, and specifies the use of
the ‘Testbed.lldbinit’ file for providing configuration of the debugger.
The default debugger configuration disables automatic breakpoints on the
‘SIGINT’, ‘SIGUSR1’, ‘SIGUSR2’, and ‘SIGXFSZ’ signals.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Apple/iOS/testbed

   (2) https://github.com/python/cpython/tree/3.14/Apple/iOS/README.md


File: python.info,  Node: App Store コンプライアンス<2>,  Prev: iOS での Python のインストール,  Up: iOS で Python を使う

3.7.3 App Store コンプライアンス
--------------------------------

The only mechanism for distributing apps to third-party iOS devices is
to submit the app to the iOS App Store; apps submitted for distribution
must pass Apple's app review process.  This process includes a set of
automated validation rules that inspect the submitted application bundle
for problematic code.  There are some steps that must be taken to ensure
that your app will be able to pass these validation steps.

* Menu:

* 標準ライブラリ内の互換性のないコード::
* プライバシーマニフェスト::


File: python.info,  Node: 標準ライブラリ内の互換性のないコード,  Next: プライバシーマニフェスト,  Up: App Store コンプライアンス<2>

3.7.3.1 標準ライブラリ内の互換性のないコード
............................................

Python の標準ライブラリには、これらの自動ルールに違反することが知られて
いるコードがいくつか含まれています。これらの違反は誤検出であると思われま
すが、 Apple の審査ルールに異議を唱えることはできません。そのため、
Python の標準ライブラリを、アプリが App Store 審査に合格するよう修正する
必要があります。

Python のソースツリーは、 App Store 審査プロセスで問題を引き起こすことが
知られているすべてのコードを削除する パッチファイル(1) を含んでいます。
このパッチは iOS 用のビルド時に自動的に適用されます。

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Mac/Resources/app-store-compliance.patch


File: python.info,  Node: プライバシーマニフェスト,  Prev: 標準ライブラリ内の互換性のないコード,  Up: App Store コンプライアンス<2>

3.7.3.2 プライバシーマニフェスト
................................

In April 2025, Apple introduced a requirement for certain third-party
libraries to provide a Privacy Manifest(1).  As a result, if you have a
binary module that uses one of the affected libraries, you must provide
an ‘.xcprivacy’ file for that library.  OpenSSL is one library affected
by this requirement, but there are others.

If you produce a binary module named ‘mymodule.so’, and use you the
Xcode build script described in step 7 above, you can place a
‘mymodule.xcprivacy’ file next to ‘mymodule.so’, and the privacy
manifest will be installed into the required location when the binary
module is converted into a framework.

   ---------- Footnotes ----------

   (1) https://developer.apple.com/support/third-party-SDK-requirements


File: python.info,  Node: エディタと IDE,  Prev: iOS で Python を使う,  Up: Python のセットアップと利用

3.8 エディタと IDE
==================

Python プログラミング言語をサポートする IDE はたくさんあります。 多くの
エディタや IDE にはシンタックスハイライト機能、デバッグツール、 PEP 8(1)
チェック機能があります。

* Menu:

* IDLE: IDLE --- Python のエディタとシェル. Python のエディタとシェル
* Other Editors and IDEs::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0008/


File: python.info,  Node: IDLE --- Python のエディタとシェル,  Next: Other Editors and IDEs,  Up: エディタと IDE

3.8.1 IDLE -- Python のエディタとシェル
---------------------------------------

IDLE is Python’s Integrated Development and Learning Environment and is
generally bundled with Python installs.  If you are on Linux and do not
have IDLE installed see *note Installing IDLE on Linux: 2149.  For more
information see the *note IDLE docs: 1217.


File: python.info,  Node: Other Editors and IDEs,  Prev: IDLE --- Python のエディタとシェル,  Up: エディタと IDE

3.8.2 Other Editors and IDEs
----------------------------

Python's community wiki has information submitted by the community on
Editors and IDEs.  Please go to Python Editors(1) and Integrated
Development Environments(2) for a comprehensive list.

   ---------- Footnotes ----------

   (1) https://wiki.python.org/moin/PythonEditors

   (2) https://wiki.python.org/moin/IntegratedDevelopmentEnvironments


File: python.info,  Node: Python 言語リファレンス,  Next: Python 標準ライブラリ,  Prev: Python のセットアップと利用,  Up: Top

4 Python 言語リファレンス
*************************

このリファレンスマニュアルでは、Python 言語の文法と、 "コアとなるセマン
ティクス" について記述します。このマニュアルはそっけない書き方かもしれま
せんが、正確さと完全さを優先しています。必須でない組み込みオブジェクト型
や組み込み関数、組み込みモジュールに関するセマンティクスは、 *note
Python 標準ライブラリ: 149. で述べられています。形式ばらない Python 言語
入門には、 *note Python チュートリアル: 1fbc. を参照してください。 C 言
語あるいはC++プログラマ向けには、このマニュアルとは別に二つのマニュアル
があります。 *note Python インタプリタの拡張と埋め込み: 1fbd. では、
Python 拡張モジュールを書くための高レベルな様式について述べています。ま
た、 *note Python/C API リファレンスマニュアル: 1fbe. では、C/C++ プログ
ラマが利用できるインターフェースについて詳細に記述しています。

* Menu:

* はじめに: はじめに<5>.
* 字句解析::
* データモデル::
* 実行モデル::
* インポートシステム::
* 式 (expression): 式 expression.
* 単純文 (simple statement): 単純文 simple statement.
* 複合文 (compound statement): 複合文 compound statement.
* トップレベル要素::
* 完全な文法仕様::


File: python.info,  Node: はじめに<5>,  Next: 字句解析,  Up: Python 言語リファレンス

4.1 はじめに
============

このリファレンスマニュアルは、Python プログラミング言語自体に関する記述
です。チュートリアルとして書かれたものではありません。

私は本マニュアルをできるだけ正確に書こうとする一方で、文法や字句解析以外
の全てについて、形式化された仕様記述ではなく英語を使うことにしました。そ
うすることで、このドキュメントが平均的な読者にとってより読みやすくなって
いるはずですが、ややあいまいな部分も残っていることでしょう。従って、もし
読者のあなたが火星から来ている人で、このドキュメントだけから Python を再
度実装しようとしているのなら、色々と推測しなければならないことがあり、実
際にはおそらく全く別の言語を実装する羽目になるでしょう。逆に、あなたが
Python を利用しており、Python 言語のある特定の領域において、厳密な規則が
何か疑問に思った場合、その答えはこのドキュメントで確実に見つけられること
でしょう。もしより形式化された言語定義をお望みなら、あなたの時間を提供し
ていただいてかまいません -- もしくは、クローン生成装置でも発明してくださ
い :-)。

実装に関する詳細を言語リファレンスのドキュメントに載せすぎるのは危険なこ
とです -- 実装は変更されるかもしれず、同じ言語でも異なる実装は異なった動
作をするかもしれないからです。一方、CPython が広く使われている一つの
Python 実装 (別の実装も支持され続けていますが) なので、特定のクセについ
ては、特に実装によって何らかの制限が加えられている場合には、触れておく価
値があります。従って、このテキスト全体にわたって短い "実装に関する注釈
(imprementation notes)" がちりばめられています。

Python 実装はいずれも、数々の組み込みモジュールと標準モジュールが付属し
ます。それらについては、 *note Python 標準ライブラリ: 149. でドキュメン
ト化されています。いくつかの組み込みモジュールについては、言語定義と重要
なかかわりをもっているときについて触れています。

* Menu:

* 別のPythonの実装::
* 本マニュアルにおける表記法::


File: python.info,  Node: 別のPythonの実装,  Next: 本マニュアルにおける表記法,  Up: はじめに<5>

4.1.1 別のPythonの実装
----------------------

Pythonの実装としては、群を抜いて有名な実装がひとつ存在しています。それ以
外の実装に関しても、特定のユーザ間で興味が持たれています。

よく知られている実装には以下のものがあります:

CPython

     これは最も保守されている初代のPython実装で、C言語で書かれています。
     ほとんどの場合、言語の新機能がいち早く実装されます。

Jython

     Javaで実装されたPythonです。この実装はJavaアプリケーションのための
     スクリプト言語として、もしくはJavaクラスライブラリを使ったアプリケ
     ーションを作成するために使用することができます。また、Javaライブラ
     リのテストを作成するためにもしばしば使用されています。さらなる情報
     については the Jython website(1) を参照してください。

Python for .NET

     この実装は内部ではCPythonを使用していますが、 .NETアプリケーション
     によって管理されているので、 .NETライブラリを参照することが可能です
     。この実装はBrian Lloydによって作成されました。さらなる情報について
     は、 Python for .NET home page(2) を参照してください。

IronPython

     .NETでPythonを使用するためのもう一つの実装です。Python.NETとは異な
     り、完全にILを生成することができるPythonの実装あり、直接Pythonコー
     ドを.NETアセンブリにコンパイルします。これはJythonの初代の開発者で
     あるJim Huguninによって作られました。さらなる情報については the
     IronPython website(3) を参照してください。

PyPy

     完全にPythonで書かれたPythonの実装です。他の実装には見られない、ス
     タックレスのサポートや、実行時 (Just in Time) コンパイラなどの高度
     な機能をサポートしています。このプロジェクトの一つの目的は、（
     Pythonで書かれていることによって、）インタプリタを簡単に修正できる
     ようにして、言語自体での実験を後押しすることです。さらなる情報は
     the PyPy project's home page(4) にあります。

これらの各実装はこのマニュアルで文書化された言語とは多少異なっている、も
しくは、標準のPythonドキュメントと何処が異なっているかを定めた情報が公開
されているでしょう。あなたが使用している実装上で、代替手段を使う必要があ
るかどうかを判断するためには、各実装の仕様書を参照してください。

   ---------- Footnotes ----------

   (1) https://www.jython.org/

   (2) https://pythonnet.github.io/

   (3) https://ironpython.net/

   (4) https://pypy.org/


File: python.info,  Node: 本マニュアルにおける表記法,  Prev: 別のPythonの実装,  Up: はじめに<5>

4.1.2 本マニュアルにおける表記法
--------------------------------

The descriptions of lexical analysis and syntax use a grammar notation
that is a mixture of EBNF(1) and PEG(2). For example:

     name:   *note letter: 2286. (*note letter: 2286. | *note digit: 2287. | "_")*
     letter: "a"..."z" | "A"..."Z"
     digit:  "0"..."9"

In this example, the first line says that a ‘name’ is a ‘letter’
followed by a sequence of zero or more ‘letter’s, ‘digit’s, and
underscores.  A ‘letter’ in turn is any of the single characters ‘'a'’
through ‘'z'’ and ‘A’ through ‘Z’; a ‘digit’ is a single character from
‘0’ to ‘9’.

Each rule begins with a name (which identifies the rule that's being
defined) followed by a colon, ‘:’.  The definition to the right of the
colon uses the following syntax elements:

   * ‘name’: A name refers to another rule.  Where possible, it is a
     link to the rule's definition.

        * ‘TOKEN’: An uppercase name refers to a *note token: 2288.  For
          the purposes of grammar definitions, tokens are the same as
          rules.

   * ‘"text"’, ‘'text'’: Text in single or double quotes must match
     literally (without the quotes).  The type of quote is chosen
     according to the meaning of ‘text’:

        * ‘'if'’: A name in single quotes denotes a *note keyword: 2289.

        * ‘"case"’: A name in double quotes denotes a *note
          soft-keyword: a0d.

        * ‘'@'’: A non-letter symbol in single quotes denotes an *note
          OP: 228a. token, that is, a *note delimiter: 228b. or *note
          operator: 228c.

   * ‘e1 e2’: Items separated only by whitespace denote a sequence.
     Here, ‘e1’ must be followed by ‘e2’.

   * ‘e1 | e2’: A vertical bar is used to separate alternatives.  It
     denotes PEG's "ordered choice": if ‘e1’ matches, ‘e2’ is not
     considered.  In traditional PEG grammars, this is written as a
     slash, ‘/’, rather than a vertical bar.  See PEP 617(3) for more
     background and details.

   * ‘e*’: A star means zero or more repetitions of the preceding item.

   * ‘e+’: Likewise, a plus means one or more repetitions.

   * ‘[e]’: A phrase enclosed in square brackets means zero or one
     occurrences.  In other words, the enclosed phrase is optional.

   * ‘e?’: A question mark has exactly the same meaning as square
     brackets: the preceding item is optional.

   * ‘(e)’: Parentheses are used for grouping.

The following notation is only used in *note lexical definitions: 228d.

   * ‘"a"..."z"’: Two literal characters separated by three dots mean a
     choice of any single character in the given (inclusive) range of
     ASCII characters.

   * ‘<...>’: A phrase between angular brackets gives an informal
     description of the matched symbol (for example, ‘<any ASCII
     character except "\">’), or an abbreviation that is defined in
     nearby text (for example, ‘<Lu>’).
Some definitions also use 'lookaheads', which indicate that an element
must (or must not) match at a given position, but without consuming any
input:

   * ‘&e’: a positive lookahead (that is, ‘e’ is required to match)

   * ‘!e’: a negative lookahead (that is, ‘e’ is required 'not' to
     match)

The unary operators (‘*’, ‘+’, ‘?’) bind as tightly as possible; the
vertical bar (‘|’) binds most loosely.

White space is only meaningful to separate tokens.

Rules are normally contained on a single line, but rules that are too
long may be wrapped:

     literal: stringliteral | bytesliteral
              | integer | floatnumber | imagnumber

Alternatively, rules may be formatted with the first line ending at the
colon, and each alternative beginning with a vertical bar on a new line.
For example:

     literal:
        | stringliteral
        | bytesliteral
        | integer
        | floatnumber
        | imagnumber

This does 'not' mean that there is an empty first alternative.

* Menu:

* Lexical and Syntactic definitions::

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form

   (2) https://en.wikipedia.org/wiki/Parsing_expression_grammar

   (3) https://peps.python.org/pep-0617/


File: python.info,  Node: Lexical and Syntactic definitions,  Up: 本マニュアルにおける表記法

4.1.2.1 Lexical and Syntactic definitions
.........................................

There is some difference between 'lexical' and 'syntactic' analysis: the
*note lexical analyzer: 2292. operates on the individual characters of
the input source, while the 'parser' (syntactic analyzer) operates on
the stream of *note tokens: 2288. generated by the lexical analysis.
However, in some cases the exact boundary between the two phases is a
CPython implementation detail.

The practical difference between the two is that in 'lexical'
definitions, all whitespace is significant.  The lexical analyzer *note
discards: 2293. all whitespace that is not converted to tokens like
*note token.INDENT: 20fd. or *note NEWLINE: 2294.  'Syntactic'
definitions then use these tokens, rather than source characters.

This documentation uses the same BNF grammar for both styles of
definitions.  All uses of BNF in the next chapter (*note 字句解析:
2295.) are lexical definitions; uses in subsequent chapters are
syntactic definitions.


File: python.info,  Node: 字句解析,  Next: データモデル,  Prev: はじめに<5>,  Up: Python 言語リファレンス

4.2 字句解析
============

A Python program is read by a 'parser'.  Input to the parser is a stream
of *note tokens: 2288, generated by the 'lexical analyzer' (also known
as the 'tokenizer').  This chapter describes how the lexical analyzer
produces these tokens.

The lexical analyzer determines the program text's *note encoding: 2299.
(UTF-8 by default), and decodes the text into *note source characters:
229a.  If the text cannot be decoded, a *note SyntaxError: 18e. is
raised.

Next, the lexical analyzer uses the source characters to generate a
stream of tokens.  The type of a generated token generally depends on
the next source character to be processed.  Similarly, other special
behavior of the analyzer depends on the first source character that
hasn't yet been processed.  The following table gives a quick summary of
these source characters, with links to sections that contain more
information.

文字                                                   Next token (or other relevant documentation)
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
   * 空白                                                 * *note Whitespace: 2293.
                                                       
   * タブ

   * formfeed

   * CR, LF                                               * *note New line: 229b.
                                                       
                                                          * *note Indentation: 229c.
                                                       
                                                       
   * backslash (‘\’)                                      * *note Explicit line joining: 229d.
                                                       
                                                          * (Also significant in
                                                            *note string escape sequences: 687.)
                                                       
                                                       
   * hash (‘#’)                                           * *note Comment: 229e.
                                                       
                                                       
   * quote (‘'’, ‘"’)                                     * *note String literal: 229f.
                                                       
                                                       
   * ASCII letter (‘a’-‘z’, ‘A’-‘Z’)                      * *note Name: 22a0.
                                                       
   * non-ASCII character                                  * Prefixed *note string or bytes literal: 229f.
                                                       
                                                       
   * underscore (‘_’)                                     * *note Name: 22a0.
                                                       
                                                          * (Can also be part of
                                                            *note numeric literals: 22a1.)
                                                       
                                                       
   * number (‘0’-‘9’)                                     * *note Numeric literal: 22a1.
                                                       
                                                       
   * dot (‘.’)                                            * *note Numeric literal: 22a1.
                                                       
                                                          * *note Operator: 228c.
                                                       
                                                       
   * question mark (‘?’)                                  * Error (outside string literals and comments)
                                                       
   * dollar (‘$’)

   * 
     backquote (‘​`​’)

   * control character

   * other printing character                             * *note Operator or delimiter: 228c.
                                                       
                                                       
   * end of file                                          * *note End marker: 22a2.
                                                       

* Menu:

* 行構造::
* その他のトークン::
* Names (identifiers and keywords): Names identifiers and keywords.
* リテラル::
* 文字列およびバイト列リテラル::
* 数値リテラル::
* Operators and delimiters::


File: python.info,  Node: 行構造,  Next: その他のトークン,  Up: 字句解析

4.2.1 行構造
------------

Python プログラムは多数の '論理行 (logical lines)' に分割されます。

* Menu:

* 論理行 (logical line): 論理行 logical line.
* 物理行 (physical line): 物理行 physical line.
* コメント (Comments): コメント Comments.
* エンコード宣言 (encoding declaration): エンコード宣言 encoding declaration.
* 明示的な行継続::
* 非明示的な行継続::
* 空行::
* インデント::
* トークン間の空白::
* End marker::


File: python.info,  Node: 論理行 logical line,  Next: 物理行 physical line,  Up: 行構造

4.2.1.1 論理行 (logical line)
.............................

The end of a logical line is represented by the token *note NEWLINE:
2294.  Statements cannot cross logical line boundaries except where
‘NEWLINE’ is allowed by the syntax (e.g., between statements in compound
statements).  A logical line is constructed from one or more 'physical
lines' by following the *note explicit: 229d. or *note implicit: 22a6.
'line joining' rules.


File: python.info,  Node: 物理行 physical line,  Next: コメント Comments,  Prev: 論理行 logical line,  Up: 行構造

4.2.1.2 物理行 (physical line)
..............................

A physical line is a sequence of characters terminated by one the
following end-of-line sequences:

   * the Unix form using ASCII LF (linefeed),

   * the Windows form using the ASCII sequence CR LF (return followed by
     linefeed),

   * the 'Classic Mac OS(1)' form using the ASCII CR (return) character.

Regardless of platform, each of these sequences is replaced by a single
ASCII LF (linefeed) character.  (This is done even inside *note string
literals: 229f.)  Each line can use any of the sequences; they do not
need to be consistent within a file.

The end of input also serves as an implicit terminator for the final
physical line.

Formally:

     newline: <ASCII LF> | <ASCII CR> <ASCII LF> | <ASCII CR>

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Classic_Mac_OS


File: python.info,  Node: コメント Comments,  Next: エンコード宣言 encoding declaration,  Prev: 物理行 physical line,  Up: 行構造

4.2.1.3 コメント (Comments)
...........................

コメントは文字列リテラル内に入っていないハッシュ文字 (‘#’) から始まり、
同じ物理行の末端で終わります。 非明示的な行継続規則が適用されていない限
り、コメントは論理行を終端させます。 コメントは構文上無視されます。


File: python.info,  Node: エンコード宣言 encoding declaration,  Next: 明示的な行継続,  Prev: コメント Comments,  Up: 行構造

4.2.1.4 エンコード宣言 (encoding declaration)
.............................................

Python スクリプト中の一行目か二行目にあるコメントが正規表現
‘coding[=:]\s*([-\w.]+)’ にマッチする場合、コメントはエンコード宣言とし
て処理されます; この表現の最初のグループがソースコードファイルのエンコー
ドを指定します。エンコード宣言は自身の行になければなりません。二行目にあ
る場合、一行目もコメントのみの行でなければなりません。エンコード宣言式と
して推奨する形式は

     # -*- coding: <encoding-name> -*-

これは GNU Emacs で認識できます。または

     # vim:fileencoding=<encoding-name>

これは、Bram Moolenar による VIM が認識できる形式です。

If no encoding declaration is found, the default encoding is UTF-8.  If
the implicit or explicit encoding of a file is UTF-8, an initial UTF-8
byte-order mark (‘b'\xef\xbb\xbf'’) is ignored rather than being a
syntax error.

エンコーディングが宣言される場合、そのエンコーディング名は Python によっ
て認識できなければなりません (*note 標準エンコーディング: fb8. を参照し
てください)。宣言されたエンコーディングは、例えば文字列リテラル、コメン
ト、識別子などの、全ての字句解析に使われます。 All lexical analysis,
including string literals, comments and identifiers, works on Unicode
text decoded using the source encoding.  Any Unicode code point, except
the NUL control character, can appear in Python source.

     source_character:  <any Unicode code point, except NUL>


File: python.info,  Node: 明示的な行継続,  Next: 非明示的な行継続,  Prev: エンコード宣言 encoding declaration,  Up: 行構造

4.2.1.5 明示的な行継続
......................

二つまたはそれ以上の物理行を論理行としてつなげるためには、バックスラッシ
ュ文字 (‘\’) を使って以下のようにします: 物理行が文字列リテラルやコメン
ト中の文字でないバックスラッシュで終わっている場合、後続する行とつなげて
一つの論理行を構成し、バックスラッシュおよびバックスラッシュの後ろにある
行末文字を削除します。例えば:

     if 1900 < year < 2100 and 1 <= month <= 12 \
        and 1 <= day <= 31 and 0 <= hour < 24 \
        and 0 <= minute < 60 and 0 <= second < 60:   # Looks like a valid date
             return 1

バックスラッシュで終わる行にはコメントを入れることはできません。また、バ
ックスラッシュを使ってコメントを継続することはできません。バックスラッシ
ュが文字列リテラル中にある場合を除き、バックスラッシュの後ろにトークンを
継続することはできません (すなわち、物理行内の文字列リテラル以外のトーク
ンをバックスラッシュを使って分断することはできません)。上記以外の場所で
は、文字列リテラル外にあるバックスラッシュはどこにあっても不正となります
。


File: python.info,  Node: 非明示的な行継続,  Next: 空行,  Prev: 明示的な行継続,  Up: 行構造

4.2.1.6 非明示的な行継続
........................

丸括弧 (parentheses)、角括弧 (square bracket) 、および波括弧 (curly
brace) 内の式は、バックスラッシュを使わずに一行以上の物理行に分割するこ
とができます。例えば:

     month_names = ['Januari', 'Februari', 'Maart',      # These are the
                    'April',   'Mei',      'Juni',       # Dutch names
                    'Juli',    'Augustus', 'September',  # for the months
                    'Oktober', 'November', 'December']   # of the year

非明示的に継続された行にはコメントを含めることができます。継続行のインデ
ントは重要ではありません。空の継続行を書くことができます。非明示的な継続
行中には、NEWLINE トークンは存在しません。非明示的な行の継続は、三重クオ
ートされた文字列 (下記参照) でも発生します; この場合には、コメントを含め
ることができません。


File: python.info,  Node: 空行,  Next: インデント,  Prev: 非明示的な行継続,  Up: 行構造

4.2.1.7 空行
............

A logical line that contains only spaces, tabs, formfeeds and possibly a
comment, is ignored (i.e., no *note NEWLINE: 2294. token is generated).
During interactive input of statements, handling of a blank line may
differ depending on the implementation of the read-eval-print loop.  In
the standard interactive interpreter, an entirely blank logical line
(that is, one containing not even whitespace or a comment) terminates a
multi-line statement.


File: python.info,  Node: インデント,  Next: トークン間の空白,  Prev: 空行,  Up: 行構造

4.2.1.8 インデント
..................

論理行の行頭にある、先頭の空白 (スペースおよびタブ) の連なりは、その行の
インデントレベルを計算するために使われます。インデントレベルは、実行文の
グループ化方法を決定するために用いられます。

タブは (左から右の方向に) 1 つにつき 8 つのスペースで置き換えられ、置き
換え後の文字数は 8 の倍数になります (Unix で使われている規則と同じになる
よう意図されています)。そして、最初の非空白文字までのスペースの総数が、
その行のインデントを決定します。インデントは、バックスラッシュで複数の物
理行に分割できません; 最初のバックスラッシュまでの空白がインデントを決定
します。

ソースファイルがタブとスペースを混在させ、その意味づけがタブのスペース換
算数に依存するようなら、インデントは不合理なものとして却下されます。その
場合は *note TabError: 765. が送出されます。

'プラットフォーム間の互換性に関する注意:' 非 UNIX プラットフォームにおけ
るテキストエディタの性質上、一つのソースファイル内でタブとインデントを混
在させて使うのは賢明ではありません。また、プラットフォームによっては、最
大インデントレベルを明示的に制限しているかもしれません。

フォームフィード文字が行の先頭にあっても構いません; フォームフィード文字
は上のインデントレベル計算時には無視されます。フォームフィード文字が先頭
の空白中の他の場所にある場合、その影響は未定義です (例えば、スペースの数
を 0 にリセットするかもしれません)。

The indentation levels of consecutive lines are used to generate *note
INDENT: 20fd. and *note DEDENT: 22b2. tokens, using a stack, as follows.

Before the first line of the file is read, a single zero is pushed on
the stack; this will never be popped off again.  The numbers pushed on
the stack will always be strictly increasing from bottom to top.  At the
beginning of each logical line, the line's indentation level is compared
to the top of the stack.  If it is equal, nothing happens.  If it is
larger, it is pushed on the stack, and one ‘INDENT’ token is generated.
If it is smaller, it 'must' be one of the numbers occurring on the
stack; all numbers on the stack that are larger are popped off, and for
each number popped off a ‘DEDENT’ token is generated.  At the end of the
file, a ‘DEDENT’ token is generated for each number remaining on the
stack that is larger than zero.

以下の例に正しく (しかし当惑させるように) インデントされた Python コード
の一部を示します:

     def perm(l):
             # Compute the list of all permutations of l
         if len(l) <= 1:
                       return [l]
         r = []
         for i in range(len(l)):
                  s = l[:i] + l[i+1:]
                  p = perm(s)
                  for x in p:
                   r.append(l[i:i+1] + x)
         return r

以下の例は、様々なインデントエラーになります:

      def perm(l):                       # error: first line indented
     for i in range(len(l)):             # error: not indented
         s = l[:i] + l[i+1:]
             p = perm(l[:i] + l[i+1:])   # error: unexpected indent
             for x in p:
                     r.append(l[i:i+1] + x)
                 return r                # error: inconsistent dedent

(実際は、最初の 3 つのエラーはパーザによって検出されます; 最後のエラーの
みが字句解析器で見つかります -- ‘return r’ のインデントは、スタックから
逐次除去されていくどのインデントレベル値とも一致しません)


File: python.info,  Node: トークン間の空白,  Next: End marker,  Prev: インデント,  Up: 行構造

4.2.1.9 トークン間の空白
........................

Except at the beginning of a logical line or in string literals, the
whitespace characters space, tab and formfeed can be used
interchangeably to separate tokens:

     whitespace:  ' ' | tab | formfeed

Whitespace is needed between two tokens only if their concatenation
could otherwise be interpreted as a different token.  For example, ‘ab’
is one token, but ‘a b’ is two tokens.  However, ‘+a’ and ‘+ a’ both
produce two tokens, ‘+’ and ‘a’, as ‘+a’ is not a valid token.


File: python.info,  Node: End marker,  Prev: トークン間の空白,  Up: 行構造

4.2.1.10 End marker
...................

At the end of non-interactive input, the lexical analyzer generates an
*note ENDMARKER: 22b6. token.


File: python.info,  Node: その他のトークン,  Next: Names identifiers and keywords,  Prev: 行構造,  Up: 字句解析

4.2.2 その他のトークン
----------------------

Besides *note NEWLINE: 2294, *note INDENT: 20fd. and *note DEDENT: 22b2,
the following categories of tokens exist: 'identifiers' and 'keywords'
(*note NAME: 22b9.), 'literals' (such as *note NUMBER: 22ba. and *note
STRING: 22bb.), and other symbols ('operators' and 'delimiters', *note
OP: 228a.).  Whitespace characters (other than logical line terminators,
discussed earlier) are not tokens, but serve to delimit tokens.  Where
ambiguity exists, a token comprises the longest possible string that
forms a legal token, when read from left to right.


File: python.info,  Node: Names identifiers and keywords,  Next: リテラル,  Prev: その他のトークン,  Up: 字句解析

4.2.3 Names (identifiers and keywords)
--------------------------------------

*note NAME: 22b9. tokens represent 'identifiers', 'keywords', and 'soft
keywords'.

Names are composed of the following characters:

   * uppercase and lowercase letters (‘A-Z’ and ‘a-z’),

   * the underscore (‘_’),

   * digits (‘0’ through ‘9’), which cannot appear as the first
     character, and

   * non-ASCII characters.  Valid names may only contain "letter-like"
     and "digit-like" characters; see *note Non-ASCII characters in
     names: 22bd. for details.

Names must contain at least one character, but have no upper length
limit.  Case is significant.

Formally, names are described by the following lexical definitions:

     NAME:          *note name_start: 22bf. *note name_continue: 22c0.*
     name_start:    "a"..."z" | "A"..."Z" | "_" | <non-ASCII character>
     name_continue: name_start | "0"..."9"
     identifier:    <*note NAME: 22be, except keywords>

Note that not all names matched by this grammar are valid; see *note
Non-ASCII characters in names: 22bd. for details.

* Menu:

* キーワード (keyword): キーワード keyword.
* ソフトキーワード::
* 予約済みの識別子種 (reserved classes of identifiers): 予約済みの識別子種 reserved classes of identifiers.
* Non-ASCII characters in names::


File: python.info,  Node: キーワード keyword,  Next: ソフトキーワード,  Up: Names identifiers and keywords

4.2.3.1 キーワード (keyword)
............................

The following names are used as reserved words, or 'keywords' of the
language, and cannot be used as ordinary identifiers.  They must be
spelled exactly as written here:

     False      await      else       import     pass
     None       break      except     in         raise
     True       class      finally    is         return
     and        continue   for        lambda     try
     as         def        from       nonlocal   while
     assert     del        global     not        with
     async      elif       if         or         yield


File: python.info,  Node: ソフトキーワード,  Next: 予約済みの識別子種 reserved classes of identifiers,  Prev: キーワード keyword,  Up: Names identifiers and keywords

4.2.3.2 ソフトキーワード
........................

Added in version 3.10.

Some names are only reserved under specific contexts.  These are known
as 'soft keywords':

   - ‘match’, ‘case’, and ‘_’, when used in the *note match: a0e.
     statement.

   - ‘type’, when used in the *note type: 66d. statement.

These syntactically act as keywords in their specific contexts, but this
distinction is done at the parser level, not when tokenizing.

As soft keywords, their use in the grammar is possible while still
preserving compatibility with existing code that uses these names as
identifier names.

バージョン 3.12 で変更: ‘type’ is now a soft keyword.


File: python.info,  Node: 予約済みの識別子種 reserved classes of identifiers,  Next: Non-ASCII characters in names,  Prev: ソフトキーワード,  Up: Names identifiers and keywords

4.2.3.3 予約済みの識別子種 (reserved classes of identifiers)
............................................................

ある種の (キーワードを除く) 識別子には、特殊な意味があります。これらの識
別子種は、先頭や末尾にあるアンダースコア文字のパターンで区別されます:

‘_*’

     Not imported by ‘from module import *’.

‘_’

     In a ‘case’ pattern within a *note match: a0e. statement, ‘_’ is a
     *note soft keyword: a0d. that denotes a *note wildcard: a0f.

     Separately, the interactive interpreter makes the result of the
     last evaluation available in the variable ‘_’.  (It is stored in
     the *note builtins: 13. module, alongside built-in functions like
     ‘print’.)

     Elsewhere, ‘_’ is a regular identifier.  It is often used to name
     "special" items, but it is not special to Python itself.

          注釈: 名前 ‘_’ は、しばしば国際化 (internationalization) と共
          に用いられます; この慣習についての詳しい情報は、 *note
          gettext: 67. を参照してください。

          It is also commonly used for unused variables.

‘__*__’

     システムで定義された (system-defined) 名前です。非公式には
     "dunder"な名前と呼ばれます(訳注: double underscoresの略)。これらの
     名前はインタープリタと (標準ライブラリを含む) 実装上で定義されてい
     ます。 現行のシステムでの名前は *note 特殊メソッド名: e68. などで話
     題に挙げられています。 Python の将来のバージョンではより多くの名前
     が定義されることになります。このドキュメントで明記されている用法に
     従わない、 'あらゆる' ‘__*__’ の名前は、いかなるコンテキストにおけ
     る利用でも、警告無く損害を引き起こすことがあります。

‘__*’

     クラスプライベート (class-private) な名前です。このカテゴリに属する
     名前は、クラス定義のコンテキスト上で用いられた場合、基底クラスと派
     生クラスの "プライベートな" 属性間で名前衝突が起こるのを防ぐために
     書き直されます。 *note 識別子 (identifier、または名前 (name)):
     22c6. を参照してください。


File: python.info,  Node: Non-ASCII characters in names,  Prev: 予約済みの識別子種 reserved classes of identifiers,  Up: Names identifiers and keywords

4.2.3.4 Non-ASCII characters in names
.....................................

Names that contain non-ASCII characters need additional normalization
and validation beyond the rules and grammar explained *note above: 22a0.
For example, ‘ř_1’, ‘蛇’, or ‘साँप’ are valid names, but ‘r〰2’, ‘€’, or
‘🐍’ are not.

This section explains the exact rules.

All names are converted into the normalization form(1) NFKC while
parsing.  This means that, for example, some typographic variants of
characters are converted to their "basic" form.  For example,
‘ﬁⁿₐˡᵢᶻₐᵗᵢᵒₙ’ normalizes to ‘finalization’, so Python treats them as the
same name:

     >>> ﬁⁿₐˡᵢᶻₐᵗᵢᵒₙ = 3
     >>> finalization
     3

     注釈: Normalization is done at the lexical level only.  Run-time
     functions that take names as 'strings' generally do not normalize
     their arguments.  For example, the variable defined above is
     accessible at run time in the *note globals(): 1c0a. dictionary as
     ‘globals()["finalization"]’ but not ‘globals()["ﬁⁿₐˡᵢᶻₐᵗᵢᵒₙ"]’.

Similarly to how ASCII-only names must contain only letters, digits and
the underscore, and cannot start with a digit, a valid name must start
with a character in the "letter-like" set ‘xid_start’, and the remaining
characters must be in the "letter- and digit-like" set ‘xid_continue’.

These sets based on the 'XID_Start' and 'XID_Continue' sets as defined
by the Unicode standard annex UAX-31(2).  Python's ‘xid_start’
additionally includes the underscore (‘_’).  Note that Python does not
necessarily conform to UAX-31(3).

A non-normative listing of characters in the 'XID_Start' and
'XID_Continue' sets as defined by Unicode is available in the
DerivedCoreProperties.txt(4) file in the Unicode Character Database.
For reference, the construction rules for the ‘xid_*’ sets are given
below.

The set ‘id_start’ is defined as the union of:

   * Unicode category ‘<Lu>’ - uppercase letters (includes ‘A’ to ‘Z’)

   * Unicode category ‘<Ll>’ - lowercase letters (includes ‘a’ to ‘z’)

   * Unicode category ‘<Lt>’ - titlecase letters

   * Unicode category ‘<Lm>’ - modifier letters

   * Unicode category ‘<Lo>’ - other letters

   * Unicode category ‘<Nl>’ - letter numbers

   * {‘"_"’} - the underscore

   * ‘<Other_ID_Start>’ - an explicit set of characters in
     PropList.txt(5) to support backwards compatibility

The set ‘xid_start’ then closes this set under NFKC normalization, by
removing all characters whose normalization is not of the form ‘id_start
id_continue*’.

The set ‘id_continue’ is defined as the union of:

   * ‘id_start’ (see above)

   * Unicode category ‘<Nd>’ - decimal numbers (includes ‘0’ to ‘9’)

   * Unicode category ‘<Pc>’ - connector punctuations

   * Unicode category ‘<Mn>’ - nonspacing marks

   * Unicode category ‘<Mc>’ - spacing combining marks

   * ‘<Other_ID_Continue>’ - another explicit set of characters in
     PropList.txt(6) to support backwards compatibility

Again, ‘xid_continue’ closes this set under NFKC normalization.

Unicode categories use the version of the Unicode Character Database as
included in the *note unicodedata: 10b. module.

参考
....

   * PEP 3131(7) - Supporting Non-ASCII Identifiers

   * PEP 672(8) - Unicode-related Security Considerations for Python

   ---------- Footnotes ----------

   (1) https://www.unicode.org/reports/tr15/#Norm_Forms

   (2) https://www.unicode.org/reports/tr31/

   (3) https://www.unicode.org/reports/tr31/

   (4) 
https://www.unicode.org/Public/16.0.0/ucd/DerivedCoreProperties.txt

   (5) https://www.unicode.org/Public/16.0.0/ucd/PropList.txt

   (6) https://www.unicode.org/Public/16.0.0/ucd/PropList.txt

   (7) https://peps.python.org/pep-3131/

   (8) https://peps.python.org/pep-0672/


File: python.info,  Node: リテラル,  Next: 文字列およびバイト列リテラル,  Prev: Names identifiers and keywords,  Up: 字句解析

4.2.4 リテラル
--------------

リテラル (literal) とは、いくつかの組み込み型の定数を表記したものです。

In terms of lexical analysis, Python has *note string, bytes: 229f. and
*note numeric: 22a1. literals.

Other "literals" are lexically denoted using *note keywords: 2289.
(‘None’, ‘True’, ‘False’) and the special *note ellipsis token: 22ca.
(‘...’).


File: python.info,  Node: 文字列およびバイト列リテラル,  Next: 数値リテラル,  Prev: リテラル,  Up: 字句解析

4.2.5 文字列およびバイト列リテラル
----------------------------------

String literals are text enclosed in single quotes (‘'’) or double
quotes (‘"’).  For example:

     "spam"
     'eggs'

The quote used to start the literal also terminates it, so a string
literal can only contain the other quote (except with escape sequences,
see below).  For example:

     'Say "Hello", please.'
     "Don't do that!"

Except for this limitation, the choice of quote character (‘'’ or ‘"’)
does not affect how the literal is parsed.

Inside a string literal, the backslash (‘\’) character introduces an
'escape sequence', which has special meaning depending on the character
after the backslash.  For example, ‘\"’ denotes the double quote
character, and does 'not' end the string:

     >>> print("Say \"Hello\" to everyone!")
     Say "Hello" to everyone!

See *note escape sequences: 687. below for a full list of such
sequences, and more details.

* Menu:

* Triple-quoted strings::
* String prefixes::
* Formal grammar::
* Escape sequences::
* Bytes literals::
* Raw string literals::
* f-strings::
* t-strings::
* Formal grammar for f-strings::


File: python.info,  Node: Triple-quoted strings,  Next: String prefixes,  Up: 文字列およびバイト列リテラル

4.2.5.1 Triple-quoted strings
.............................

Strings can also be enclosed in matching groups of three single or
double quotes.  These are generally referred to as 'triple-quoted
strings':

     """This is a triple-quoted string."""

In triple-quoted literals, unescaped quotes are allowed (and are
retained), except that three unescaped quotes in a row terminate the
literal, if they are of the same kind (‘'’ or ‘"’) used at the start:

     """This string has "quotes" inside."""

Unescaped newlines are also allowed and retained:

     '''This triple-quoted string
     continues on the next line.'''


File: python.info,  Node: String prefixes,  Next: Formal grammar,  Prev: Triple-quoted strings,  Up: 文字列およびバイト列リテラル

4.2.5.2 String prefixes
.......................

String literals can have an optional 'prefix' that influences how the
content of the literal is parsed, for example:

     b"data"
     f'{result=}'

The allowed prefixes are:

   * ‘b’: *note Bytes literal: 22ce.

   * ‘r’: *note Raw string: 22cf.

   * ‘f’: *note Formatted string literal: 19a. ("f-string")

   * ‘t’: *note Template string literal: 17fa. ("t-string")

   * ‘u’: No effect (allowed for backwards compatibility)

See the linked sections for details on each type.

Prefixes are case-insensitive (for example, '‘B’' works the same as
'‘b’').  The '‘r’' prefix can be combined with '‘f’', '‘t’' or '‘b’', so
'‘fr’', '‘rf’', '‘tr’', '‘rt’', '‘br’', and '‘rb’' are also valid
prefixes.

Added in version 3.3: raw バイト列リテラルの ‘'rb'’ プレフィックスが
‘'br'’ の同義語として追加されました。

Python 2.x と 3.x 両対応のコードベースのメンテナンスを単純化するために、
レガシー unicode リテラル (‘u'value'’) のサポートが再び導入されました。
詳細は PEP 414(1) を参照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0414/


File: python.info,  Node: Formal grammar,  Next: Escape sequences,  Prev: String prefixes,  Up: 文字列およびバイト列リテラル

4.2.5.3 Formal grammar
......................

String literals, except *note "f-strings": 19a. and *note "t-strings":
17fa, are described by the following lexical definitions.

These definitions use *note negative lookaheads: 228e. (‘!’) to indicate
that an ending quote ends the literal.

     STRING:          [*note stringprefix: 22d2.] (*note stringcontent: 22d3.)
     stringprefix:    <("r" | "u" | "b" | "br" | "rb"), case-insensitive>
     stringcontent:
        | "'''" ( !"'''" *note longstringitem: 22d4.)* "'''"
        | '"""' ( !'"""' *note longstringitem: 22d4.)* '"""'
        | "'" ( !"'" *note stringitem: 22d5.)* "'"
        | '"' ( !'"' *note stringitem: 22d5.)* '"'
     stringitem:      *note stringchar: 22d6. | *note stringescapeseq: 22d7.
     stringchar:      <any *note source_character: 22ac, except backslash and newline>
     longstringitem:  *note stringitem: 22d5. | newline
     stringescapeseq: "\" <any *note source_character: 22ac.>

Note that as in all lexical definitions, whitespace is significant.  In
particular, the prefix (if any) must be immediately followed by the
starting quote.


File: python.info,  Node: Escape sequences,  Next: Bytes literals,  Prev: Formal grammar,  Up: 文字列およびバイト列リテラル

4.2.5.4 Escape sequences
........................

Unless an '‘r’' or '‘R’' prefix is present, escape sequences in string
and bytes literals are interpreted according to rules similar to those
used by Standard C. The recognized escape sequences are:

エスケープシーケンス                                   意味
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
‘\’<newline>                                           *note Ignored end of line: 22d9.
                                                       
                                                       
‘\\’                                                   *note Backslash: 22da.
                                                       
                                                       
‘\'’                                                   *note Single quote: 22da.
                                                       
                                                       
‘\"’                                                   *note Double quote: 22da.
                                                       
                                                       
‘\a’                                                   ASCII 端末ベル (BEL)
                                                       
                                                       
‘\b’                                                   ASCII バックスペース (BS)
                                                       
                                                       
‘\f’                                                   ASCII フォームフィード (FF)
                                                       
                                                       
‘\n’                                                   ASCII 行送り (LF)
                                                       
                                                       
‘\r’                                                   ASCII 復帰 (CR)
                                                       
                                                       
‘\t’                                                   ASCII 水平タブ (TAB)
                                                       
                                                       
‘\v’                                                   ASCII 垂直タブ (VT)
                                                       
                                                       
‘\OOO’                                                 *note Octal character: 22db.
                                                       
                                                       
‘\xHH’                                                 *note Hexadecimal character: 22dc.
                                                       
                                                       
‘\N{NAME}’                                             *note Named Unicode character: 22dd.
                                                       
                                                       
‘\uXXXX’                                               *note Hexadecimal Unicode character: 22de.
                                                       
                                                       
‘\UXXXXXXXX’                                           *note Hexadecimal Unicode character: 22de.
                                                       

* Menu:

* Ignored end of line::
* Escaped characters::
* Octal character::
* Hexadecimal character::
* Named Unicode character::
* Hexadecimal Unicode characters::
* Unrecognized escape sequences::


File: python.info,  Node: Ignored end of line,  Next: Escaped characters,  Up: Escape sequences

4.2.5.5 Ignored end of line
...........................

A backslash can be added at the end of a line to ignore the newline:

     >>> 'This string will not include \
     ... backslashes or newline characters.'
     'This string will not include backslashes or newline characters.'

The same result can be achieved using *note triple-quoted strings: 229f,
or parentheses and *note string literal concatenation: 22e0.


File: python.info,  Node: Escaped characters,  Next: Octal character,  Prev: Ignored end of line,  Up: Escape sequences

4.2.5.6 Escaped characters
..........................

To include a backslash in a non-*note raw: 22cf. Python string literal,
it must be doubled.  The ‘\\’ escape sequence denotes a single backslash
character:

     >>> print('C:\\Program Files')
     C:\Program Files

Similarly, the ‘\'’ and ‘\"’ sequences denote the single and double
quote character, respectively:

     >>> print('\' and \"')
     ' and "


File: python.info,  Node: Octal character,  Next: Hexadecimal character,  Prev: Escaped characters,  Up: Escape sequences

4.2.5.7 Octal character
.......................

The sequence ‘\OOO’ denotes a 'character' with the octal (base 8) value
'ooo':

     >>> '\120'
     'P'

Up to three octal digits (0 through 7) are accepted.

In a bytes literal, 'character' means a 'byte' with the given value.  In
a string literal, it means a Unicode character with the given value.

バージョン 3.11 で変更: Octal escapes with value larger than ‘0o377’
(255) produce a *note DeprecationWarning: 1a3.

バージョン 3.12 で変更: Octal escapes with value larger than ‘0o377’
(255) produce a *note SyntaxWarning: 1ae.  In a future Python version
they will raise a *note SyntaxError: 18e.


File: python.info,  Node: Hexadecimal character,  Next: Named Unicode character,  Prev: Octal character,  Up: Escape sequences

4.2.5.8 Hexadecimal character
.............................

The sequence ‘\xHH’ denotes a 'character' with the hex (base 16) value
'hh':

     >>> '\x50'
     'P'

標準 C とは違い、ちょうど 2 桁の 16 進数しか受理されません。

In a bytes literal, 'character' means a 'byte' with the given value.  In
a string literal, it means a Unicode character with the given value.


File: python.info,  Node: Named Unicode character,  Next: Hexadecimal Unicode characters,  Prev: Hexadecimal character,  Up: Escape sequences

4.2.5.9 Named Unicode character
...............................

The sequence ‘\N{NAME}’ denotes a Unicode character with the given
'name':

     >>> '\N{LATIN CAPITAL LETTER P}'
     'P'
     >>> '\N{SNAKE}'
     '🐍'

This sequence cannot appear in *note bytes literals: 22ce.

バージョン 3.3 で変更: Support for name aliases(1) has been added.

   ---------- Footnotes ----------

   (1) https://www.unicode.org/Public/16.0.0/ucd/NameAliases.txt


File: python.info,  Node: Hexadecimal Unicode characters,  Next: Unrecognized escape sequences,  Prev: Named Unicode character,  Up: Escape sequences

4.2.5.10 Hexadecimal Unicode characters
.......................................

These sequences ‘\uXXXX’ and ‘\UXXXXXXXX’ denote the Unicode character
with the given hex (base 16) value.  Exactly four digits are required
for ‘\u’; exactly eight digits are required for ‘\U’.  The latter can
encode any Unicode character.

     >>> '\u1234'
     'ሴ'
     >>> '\U0001f40d'
     '🐍'

These sequences cannot appear in *note bytes literals: 22ce.


File: python.info,  Node: Unrecognized escape sequences,  Prev: Hexadecimal Unicode characters,  Up: Escape sequences

4.2.5.11 Unrecognized escape sequences
......................................

Unlike in Standard C, all unrecognized escape sequences are left in the
string unchanged, that is, 'the backslash is left in the result':

     >>> print('\q')
     \q
     >>> list('\q')
     ['\\', 'q']

Note that for bytes literals, the escape sequences only recognized in
string literals (‘\N...’, ‘\u...’, ‘\U...’) fall into the category of
unrecognized escapes.

バージョン 3.6 で変更: Unrecognized escape sequences produce a *note
DeprecationWarning: 1a3.

バージョン 3.12 で変更: Unrecognized escape sequences produce a *note
SyntaxWarning: 1ae.  In a future Python version they will raise a *note
SyntaxError: 18e.


File: python.info,  Node: Bytes literals,  Next: Raw string literals,  Prev: Escape sequences,  Up: 文字列およびバイト列リテラル

4.2.5.12 Bytes literals
.......................

'Bytes literals' are always prefixed with '‘b’' or '‘B’'; they produce
an instance of the *note bytes: 192. type instead of the *note str: 169.
type.  They may only contain ASCII characters; bytes with a numeric
value of 128 or greater must be expressed with escape sequences
(typically *note Hexadecimal character: 22dc. or *note Octal character:
22db.):

     >>> b'\x89PNG\r\n\x1a\n'
     b'\x89PNG\r\n\x1a\n'
     >>> list(b'\x89PNG\r\n\x1a\n')
     [137, 80, 78, 71, 13, 10, 26, 10]

Similarly, a zero byte must be expressed using an escape sequence
(typically ‘\0’ or ‘\x00’).


File: python.info,  Node: Raw string literals,  Next: f-strings,  Prev: Bytes literals,  Up: 文字列およびバイト列リテラル

4.2.5.13 Raw string literals
............................

Both string and bytes literals may optionally be prefixed with a letter
'‘r’' or '‘R’'; such constructs are called 'raw string literals' and
'raw bytes literals' respectively and treat backslashes as literal
characters.  As a result, in raw string literals, *note escape
sequences: 687. are not treated specially:

     >>> r'\d{4}-\d{2}-\d{2}'
     '\\d{4}-\\d{2}-\\d{2}'

raw リテラルでも、引用符はバックスラッシュでエスケープできますが、バック
スラッシュ自体も文字列に残ります; 例えば、‘r"\""’ は有効な文字列リテラル
で、バックスラッシュと二重引用符からなる文字列を表します; ‘r"\"’ は無効
な文字列リテラルです (raw リテラルを奇数個連なったバックスラッシュで終わ
らせることはできません)。具体的には、(バックスラッシュが直後のクオート文
字をエスケープしてしまうので) 'raw文字列を単一のバックスラッシュで終わら
せることはできません' さらに、バックスラッシュの直後に改行がきても、行継
続を意味する 'のではなく'、リテラルの一部であるそれら二つの文字として解
釈されます。


File: python.info,  Node: f-strings,  Next: t-strings,  Prev: Raw string literals,  Up: 文字列およびバイト列リテラル

4.2.5.14 f-strings
..................

Added in version 3.6.

バージョン 3.7 で変更: The *note await: 18d. and *note async for: ca1.
can be used in expressions within f-strings.

バージョン 3.8 で変更: Added the debug specifier (‘=’)

バージョン 3.12 で変更: Many restrictions on expressions within
f-strings have been removed.  Notably, nested strings, comments, and
backslashes are now permitted.

A 'formatted string literal' or 'f-string' is a string literal that is
prefixed with '‘f’' or '‘F’'.  Unlike other string literals, f-strings
do not have a constant value.  They may contain 'replacement fields'
delimited by curly braces ‘{}’.  Replacement fields contain expressions
which are evaluated at run time.  For example:

     >>> who = 'nobody'
     >>> nationality = 'Spanish'
     >>> f'{who.title()} expects the {nationality} Inquisition!'
     'Nobody expects the Spanish Inquisition!'

Any doubled curly braces (‘{{’ or ‘}}’) outside replacement fields are
replaced with the corresponding single curly brace:

     >>> print(f'{{...}}')
     {...}

Other characters outside replacement fields are treated like in ordinary
string literals.  This means that escape sequences are decoded (except
when a literal is also marked as a raw string), and newlines are
possible in triple-quoted f-strings:

     >>> name = 'Galahad'
     >>> favorite_color = 'blue'
     >>> print(f'{name}:\t{favorite_color}')
     Galahad:       blue
     >>> print(rf"C:\Users\{name}")
     C:\Users\Galahad
     >>> print(f'''Three shall be the number of the counting
     ... and the number of the counting shall be three.''')
     Three shall be the number of the counting
     and the number of the counting shall be three.

Expressions in formatted string literals are treated like regular Python
expressions.  Each expression is evaluated in the context where the
formatted string literal appears, in order from left to right.  An empty
expression is not allowed, and both *note lambda: 14b5. and assignment
expressions ‘:=’ must be surrounded by explicit parentheses:

     >>> f'{(half := 1/2)}, {half * 42}'
     '0.5, 21.0'

Reusing the outer f-string quoting type inside a replacement field is
permitted:

     >>> a = dict(x=2)
     >>> f"abc {a["x"]} def"
     'abc 2 def'

Backslashes are also allowed in replacement fields and are evaluated the
same way as in any other context:

     >>> a = ["a", "b", "c"]
     >>> print(f"List a contains:\n{"\n".join(a)}")
     List a contains:
     a
     b
     c

It is possible to nest f-strings:

     >>> name = 'world'
     >>> f'Repeated:{f' hello {name}' * 3}'
     'Repeated: hello world hello world hello world'

Portable Python programs should not use more than 5 levels of nesting.

'CPython 実装の詳細:' CPython does not limit nesting of f-strings.

Replacement expressions can contain newlines in both single-quoted and
triple-quoted f-strings and they can contain comments.  Everything that
comes after a ‘#’ inside a replacement field is a comment (even closing
braces and quotes).  This means that replacement fields with comments
must be closed in a different line:

     >>> a = 2
     >>> f"abc{a  # This comment  }"  continues until the end of the line
     ...       + 3}"
     'abc5'

After the expression, replacement fields may optionally contain:

   * a 'debug specifier' - an equal sign (‘=’), optionally surrounded by
     whitespace on one or both sides;

   * a 'conversion specifier' - ‘!s’, ‘!r’ or ‘!a’; and/or

   * a 'format specifier' prefixed with a colon (‘:’).

See the *note Standard Library section on f-strings: 22eb. for details
on how these fields are evaluated.

As that section explains, 'format specifiers' are passed as the second
argument to the *note format(): 199. function to format a replacement
field value.  For example, they can be used to specify a field width and
padding characters using the *note Format Specification Mini-Language:
4f9.:

     >>> number = 14.3
     >>> f'{number:20.7f}'
     '          14.3000000'

Top-level format specifiers may include nested replacement fields:

     >>> field_size = 20
     >>> precision = 7
     >>> f'{number:{field_size}.{precision}f}'
     '          14.3000000'

These nested fields may include their own conversion fields and *note
format specifiers: 4f9.:

     >>> number = 3
     >>> f'{number:{field_size}}'
     '                   3'
     >>> f'{number:{field_size:05}}'
     '00000000000000000003'

However, these nested fields may not include more deeply nested
replacement fields.

Formatted string literals cannot be used as *note docstrings: 22ec, even
if they do not include expressions:

     >>> def foo():
     ...     f"Not a docstring"
     ...
     >>> print(foo.__doc__)
     None

参考
....

   * PEP 498(1) - Literal String Interpolation

   * PEP 701(2) - Syntactic formalization of f-strings

   * *note str.format(): 833, which uses a related format string
     mechanism.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0498/

   (2) https://peps.python.org/pep-0701/


File: python.info,  Node: t-strings,  Next: Formal grammar for f-strings,  Prev: f-strings,  Up: 文字列およびバイト列リテラル

4.2.5.15 t-strings
..................

Added in version 3.14.

A 'template string literal' or 't-string' is a string literal that is
prefixed with '‘t’' or '‘T’'.  These strings follow the same syntax
rules as *note formatted string literals: 19a.  For differences in
evaluation rules, see the *note Standard Library section on t-strings:
22ef.


File: python.info,  Node: Formal grammar for f-strings,  Prev: t-strings,  Up: 文字列およびバイト列リテラル

4.2.5.16 Formal grammar for f-strings
.....................................

F-strings are handled partly by the *note lexical analyzer: 2292, which
produces the tokens *note FSTRING_START: 22f1, *note FSTRING_MIDDLE:
22f2. and *note FSTRING_END: 22f3, and partly by the parser, which
handles expressions in the replacement field.  The exact way the work is
split is a CPython implementation detail.

Correspondingly, the f-string grammar is a mix of *note lexical and
syntactic definitions: 228d.

Whitespace is significant in these situations:

   * There may be no whitespace in *note FSTRING_START: 22f1. (between
     the prefix and quote).

   * Whitespace in *note FSTRING_MIDDLE: 22f2. is part of the literal
     string contents.

   * In ‘fstring_replacement_field’, if ‘f_debug_specifier’ is present,
     all whitespace after the opening brace until the
     ‘f_debug_specifier’, as well as whitespace immediately following
     ‘f_debug_specifier’, is retained as part of the expression.

     'CPython 実装の詳細:' The expression is not handled in the
     tokenization phase; it is retrieved from the source code using
     locations of the ‘{’ token and the token after ‘=’.

The ‘FSTRING_MIDDLE’ definition uses *note negative lookaheads: 228e.
(‘!’) to indicate special characters (backslash, newline, ‘{’, ‘}’) and
sequences (‘f_quote’).

     fstring:    *note FSTRING_START: 22f5. *note fstring_middle: 22f6.* *note FSTRING_END: 22f7.

     FSTRING_START:      *note fstringprefix: 22f8. ("'" | '"' | "'''" | '"""')
     FSTRING_END:        *note f_quote: 22f9.
     fstringprefix:      <("f" | "fr" | "rf"), case-insensitive>
     f_debug_specifier:  '='
     f_quote:            <the quote character(s) used in FSTRING_START>

     fstring_middle:
        | *note fstring_replacement_field: 22fb.
        | *note FSTRING_MIDDLE: 22fc.
     FSTRING_MIDDLE:
        | (!"\" !*note newline: 22a9. !'{' !'}' !*note f_quote: 22f9.) *note source_character: 22ac.
        | *note stringescapeseq: 22d7.
        | "{{"
        | "}}"
        | <newline, in triple-quoted f-strings only>
     fstring_replacement_field:
        | '{' *note f_expression: 22fd. [*note f_debug_specifier: 22fa.] [*note fstring_conversion: 22fe.]
              [*note fstring_full_format_spec: 22ff.] '}'
     fstring_conversion:
        | "!" ("s" | "r" | "a")
     fstring_full_format_spec:
        | ':' *note fstring_format_spec: 2300.*
     fstring_format_spec:
        | *note FSTRING_MIDDLE: 22fc.
        | *note fstring_replacement_field: 22fb.
     f_expression:
        | ','.(*note conditional_expression: 2301. | "*" *note or_expr: 2302.)+ [","]
        | *note yield_expression: 2303.

     注釈: In the above grammar snippet, the ‘f_quote’ and
     ‘FSTRING_MIDDLE’ rules are context-sensitive - they depend on the
     contents of ‘FSTRING_START’ of the nearest enclosing ‘fstring’.

     Constructing a more traditional formal grammar from this template
     is left as an exercise for the reader.

The grammar for t-strings is identical to the one for f-strings, with
't' instead of 'f' at the beginning of rule and token names and in the
prefix.

     tstring:    TSTRING_START tstring_middle* TSTRING_END

     <rest of the t-string grammar is omitted; see above>


File: python.info,  Node: 数値リテラル,  Next: Operators and delimiters,  Prev: 文字列およびバイト列リテラル,  Up: 字句解析

4.2.6 数値リテラル
------------------

*note NUMBER: 22ba. tokens represent numeric literals, of which there
are three types: integers, floating-point numbers, and imaginary
numbers.

     NUMBER: *note integer: 2307. | *note floatnumber: 2308. | *note imagnumber: 2309.

The numeric value of a numeric literal is the same as if it were passed
as a string to the *note int: 19b, *note float: 196. or *note complex:
197. class constructor, respectively.  Note that not all valid inputs
for those constructors are also valid literals.

Numeric literals do not include a sign; a phrase like ‘-1’ is actually
an expression composed of the unary operator '‘-’' and the literal ‘1’.

* Menu:

* 整数リテラル::
* Floating-point literals::
* 虚数 (imaginary) リテラル: 虚数 imaginary リテラル.


File: python.info,  Node: 整数リテラル,  Next: Floating-point literals,  Up: 数値リテラル

4.2.6.1 整数リテラル
....................

Integer literals denote whole numbers.  For example:

     7
     3
     2147483647

There is no limit for the length of integer literals apart from what can
be stored in available memory:

     7922816251426433759354395033679228162514264337593543950336

Underscores can be used to group digits for enhanced readability, and
are ignored for determining the numeric value of the literal.  For
example, the following literals are equivalent:

     100_000_000_000
     100000000000
     1_00_00_00_00_000

Underscores can only occur between digits.  For example, ‘_123’, ‘321_’,
and ‘123__321’ are 'not' valid literals.

Integers can be specified in binary (base 2), octal (base 8), or
hexadecimal (base 16) using the prefixes ‘0b’, ‘0o’ and ‘0x’,
respectively.  Hexadecimal digits 10 through 15 are represented by
letters ‘A’-‘F’, case-insensitive.  For example:

     0b100110111
     0b_1110_0101
     0o177
     0o377
     0xdeadbeef
     0xDead_Beef

An underscore can follow the base specifier.  For example, ‘0x_1f’ is a
valid literal, but ‘0_x1f’ and ‘0x__1f’ are not.

Leading zeros in a non-zero decimal number are not allowed.  For
example, ‘0123’ is not a valid literal.  This is for disambiguation with
C-style octal literals, which Python used before version 3.0.

Formally, integer literals are described by the following lexical
definitions:

     integer:      *note decinteger: 230c. | *note bininteger: 230d. | *note octinteger: 230e. | *note hexinteger: 230f. | *note zerointeger: 2310.
     decinteger:   *note nonzerodigit: 2311. (["_"] *note digit: 2312.)*
     bininteger:   "0" ("b" | "B") (["_"] *note bindigit: 2313.)+
     octinteger:   "0" ("o" | "O") (["_"] *note octdigit: 2314.)+
     hexinteger:   "0" ("x" | "X") (["_"] *note hexdigit: 2315.)+
     zerointeger:  "0"+ (["_"] "0")*
     nonzerodigit: "1"..."9"
     digit:        "0"..."9"
     bindigit:     "0" | "1"
     octdigit:     "0"..."7"
     hexdigit:     *note digit: 2312. | "a"..."f" | "A"..."F"

バージョン 3.6 で変更: グループ化を目的としたリテラル中のアンダースコア
が許されるようになりました。


File: python.info,  Node: Floating-point literals,  Next: 虚数 imaginary リテラル,  Prev: 整数リテラル,  Up: 数値リテラル

4.2.6.2 Floating-point literals
...............................

Floating-point (float) literals, such as ‘3.14’ or ‘1.5’, denote *note
approximations of real numbers: 2318.

They consist of 'integer' and 'fraction' parts, each composed of decimal
digits.  The parts are separated by a decimal point, ‘.’:

     2.71828
     4.0

Unlike in integer literals, leading zeros are allowed.  For example,
‘077.010’ is legal, and denotes the same number as ‘77.01’.

As in integer literals, single underscores may occur between digits to
help readability:

     96_485.332_123
     3.14_15_93

Either of these parts, but not both, can be empty.  For example:

     10.  # (equivalent to 10.0)
     .001  # (equivalent to 0.001)

Optionally, the integer and fraction may be followed by an 'exponent':
the letter ‘e’ or ‘E’, followed by an optional sign, ‘+’ or ‘-’, and a
number in the same format as the integer and fraction parts.  The ‘e’ or
‘E’ represents "times ten raised to the power of":

     1.0e3  # (represents 1.0×10³, or 1000.0)
     1.166e-5  # (represents 1.166×10⁻⁵, or 0.00001166)
     6.02214076e+23  # (represents 6.02214076×10²³, or 602214076000000000000000.)

In floats with only integer and exponent parts, the decimal point may be
omitted:

     1e3  # (equivalent to 1.e3 and 1.0e3)
     0e0  # (equivalent to 0.)

Formally, floating-point literals are described by the following lexical
definitions:

     floatnumber:
        | *note digitpart: 2319. "." [*note digitpart: 2319.] [*note exponent: 231a.]
        | "." *note digitpart: 2319. [*note exponent: 231a.]
        | *note digitpart: 2319. *note exponent: 231a.
     digitpart: *note digit: 2312. (["_"] *note digit: 2312.)*
     exponent:  ("e" | "E") ["+" | "-"] *note digitpart: 2319.

バージョン 3.6 で変更: グループ化を目的としたリテラル中のアンダースコア
が許されるようになりました。


File: python.info,  Node: 虚数 imaginary リテラル,  Prev: Floating-point literals,  Up: 数値リテラル

4.2.6.3 虚数 (imaginary) リテラル
.................................

Python has *note complex number: 1fdc. objects, but no complex literals.
Instead, 'imaginary literals' denote complex numbers with a zero real
part.

For example, in math, the complex number 3+4.2'i' is written as the real
number 3 added to the imaginary number 4.2'i'.  Python uses a similar
syntax, except the imaginary unit is written as ‘j’ rather than 'i':

     3+4.2j

This is an expression composed of the *note integer literal: 230b. ‘3’,
the *note operator: 228c. '‘+’', and the *note imaginary literal: 231b.
‘4.2j’.  Since these are three separate tokens, whitespace is allowed
between them:

     3 + 4.2j

No whitespace is allowed 'within' each token.  In particular, the ‘j’
suffix, may not be separated from the number before it.

The number before the ‘j’ has the same syntax as a floating-point
literal.  Thus, the following are valid imaginary literals:

     4.2j
     3.14j
     10.j
     .001j
     1e100j
     3.14e-10j
     3.14_15_93j

Unlike in a floating-point literal the decimal point can be omitted if
the imaginary number only has an integer part.  The number is still
evaluated as a floating-point number, not an integer:

     10j
     0j
     1000000000000000000000000j   # equivalent to 1e+24j

The ‘j’ suffix is case-insensitive.  That means you can use ‘J’ instead:

     3.14J   # equivalent to 3.14j

Formally, imaginary literals are described by the following lexical
definition:

     imagnumber: (*note floatnumber: 2308. | *note digitpart: 2319.) ("j" | "J")


File: python.info,  Node: Operators and delimiters,  Prev: 数値リテラル,  Up: 字句解析

4.2.7 Operators and delimiters
------------------------------

The following grammar defines 'operator' and 'delimiter' tokens, that
is, the generic *note OP: 228a. token type.  A *note list of these
tokens and their names: 231e. is also available in the ‘token’ module
documentation.

     OP:
        | assignment_operator
        | bitwise_operator
        | comparison_operator
        | enclosing_delimiter
        | other_delimiter
        | arithmetic_operator
        | "..."
        | other_op

     assignment_operator:   "+=" | "-=" | "*=" | "**=" | "/="  | "//=" | "%=" |
                            "&=" | "|=" | "^=" | "<<=" | ">>=" | "@="  | ":="
     bitwise_operator:      "&"  | "|"  | "^"  | "~"   | "<<"  | ">>"
     comparison_operator:   "<=" | ">=" | "<"  | ">"   | "=="  | "!="
     enclosing_delimiter:   "("  | ")"  | "["  | "]"   | "{"   | "}"
     other_delimiter:       ","  | ":"  | "!"  | ";"   | "="   | "->"
     arithmetic_operator:   "+"  | "-"  | "**" | "*"   | "//"  | "/"   | "%"
     other_op:              "."  | "@"

     注釈: Generally, 'operators' are used to combine *note expressions:
     2327, while 'delimiters' serve other purposes.  However, there is
     no clear, formal distinction between the two categories.

     Some tokens can serve as either operators or delimiters, depending
     on usage.  For example, ‘*’ is both the multiplication operator and
     a delimiter used for sequence unpacking, and ‘@’ is both the matrix
     multiplication and a delimiter that introduces decorators.

     For some tokens, the distinction is unclear.  For example, some
     people consider ‘.’, ‘(’, and ‘)’ to be delimiters, while others
     see the *note getattr(): dca. operator and the function call
     operator(s).

     Some of Python's operators, like ‘and’, ‘or’, and ‘not in’, use
     *note keyword: 2289. tokens rather than "symbols" (operator
     tokens).

A sequence of three consecutive periods (‘...’) has a special meaning as
an *note Ellipsis: 2328. literal.


File: python.info,  Node: データモデル,  Next: 実行モデル,  Prev: 字句解析,  Up: Python 言語リファレンス

4.3 データモデル
================

* Menu:

* オブジェクト、値、および型::
* 標準型の階層::
* 特殊メソッド名::
* コルーチン::


File: python.info,  Node: オブジェクト、値、および型,  Next: 標準型の階層,  Up: データモデル

4.3.1 オブジェクト、値、および型
--------------------------------

'Objects' are Python's abstraction for data.  All data in a Python
program is represented by objects or by relations between objects.  Even
code is represented by objects.

すべてのオブジェクトは、同一性 (identity)、型、値をもっています。 '同一
性' は生成されたあとは変更されません。これはオブジェクトのアドレスのよう
なものだと考えられるかもしれません。 *note is: 34c. 演算子は2つのオブジ
ェクトの同一性を比較します。 *note id(): 163c. 関数は同一性を表す整数を
返します。

CPython では、‘id(x)’ は ‘x’ が格納されているメモリ上のアドレスを返しま
す。

オブジェクトの型はオブジェクトがサポートする操作 (例: *note len(): 840.
をサポートするか) と、オブジェクトが取りうる値を決定します。 *note
type(): f44. 関数はオブジェクトの型 (型自体もオブジェクトです) を返しま
す。同一性と同じく、オブジェクトの型('type') も変更不可能です。 (1)

オブジェクトによっては '値' を変更することが可能です。値を変更できるオブ
ジェクトのことを 'mutable' と呼びます。生成後に値を変更できないオブジェ
クトのことを 'immutable' と呼びます。(mutable なオブジェクトへの参照を格
納している immutableなコンテナオブジェクトの値は、その格納しているオブジ
ェクトの値が変化した時に変化しますが、コンテナがどのオブジェクトを格納し
ているのかが変化しないのであれば immutable だと考えることができます。し
たがって、immutable かどうかは値が変更可能かどうかと完全に一致するわけで
はありません) オブジェクトが mutable かどうかはその型によって決まります
。例えば、数値型、文字列型とタプル型のインスタンスは immutable で、dict
や list は mutable です。

オブジェクトを明示的に破壊することはできません; しかし、オブジェクトに到
達不能 (unreachable) になると、ガベージコレクション (garbage-collection)
によって処理されるかもしれません。ガベージコレクションを遅らせたり、全く
行わない実装も許されています -- 到達可能なオブジェクトを処理してしまわな
いかぎり、ガベージコレクションをどう実装するかは実装品質の問題です。

現在の CPython 実装では参照カウント (reference-counting) 方式を使ってお
り、(オプションとして) 循環参照を行っているガベージオブジェクトを遅延検
出します。この実装ではほとんどのオブジェクトを到達不能になると同時に処理
することができますが、循環参照を含むガベージオブジェクトの収集が確実に行
われるよう保証しているわけではありません。循環参照を持つガベージオブジェ
クト収集の制御については、 *note gc: 64. モジュールを参照してください。
CPython以外の実装は別の方式を使っており、CPythonも将来は別の方式を使うか
もしれません。オブジェクトが到達不能になったときに即座に終了処理されるこ
とに頼らないでください (ですからファイルは必ず明示的に閉じてください)。

Note that the use of the implementation's tracing or debugging
facilities may keep objects alive that would normally be collectable.
Also note that catching an exception with a *note try: 8f8...*note
except: 1ab. statement may keep objects alive.

Some objects contain references to "external" resources such as open
files or windows.  It is understood that these resources are freed when
the object is garbage-collected, but since garbage collection is not
guaranteed to happen, such objects also provide an explicit way to
release the external resource, usually a ‘close()’ method.  Programs are
strongly recommended to explicitly close such objects.  The *note try:
8f8...*note finally: 1b0. statement and the *note with: 186. statement
provide convenient ways to do this.

他のオブジェクトに対する参照をもつオブジェクトもあります; これらは 'コン
テナ (container)' と呼ばれます。コンテナオブジェクトの例として、タプル、
リスト、および辞書が挙げられます。オブジェクトへの参照自体がコンテナの値
の一部です。ほとんどの場合、コンテナの値というと、コンテナに入っているオ
ブジェクトの値のことを指し、それらオブジェクトのアイデンティティではあり
ません; しかしながら、コンテナの変更可能性について述べる場合、今まさにコ
ンテナに入っているオブジェクトのアイデンティティのことを指します。したが
って、 (タプルのように) 変更不能なオブジェクトが変更可能なオブジェクトへ
の参照を含む場合、その値が変化するのは変更可能なオブジェクトが変更された
時、ということになります。

Types affect almost all aspects of object behavior.  Even the importance
of object identity is affected in some sense: for immutable types,
operations that compute new values may actually return a reference to
any existing object with the same type and value, while for mutable
objects this is not allowed.  For example, after ‘a = 1; b = 1’, 'a' and
'b' may or may not refer to the same object with the value one,
depending on the implementation.  This is because *note int: 19b. is an
immutable type, so the reference to ‘1’ can be reused.  This behaviour
depends on the implementation used, so should not be relied upon, but is
something to be aware of when making use of object identity tests.
However, after ‘c = []; d = []’, 'c' and 'd' are guaranteed to refer to
two different, unique, newly created empty lists.  (Note that ‘e = f =
[]’ assigns the 'same' object to both 'e' and 'f'.)

   ---------- Footnotes ----------

   (1) 特定の条件が満たされた場合、オブジェクトの type を変更することが
'できます' 。これは、正しく扱われなかった場合にとても奇妙な動作を引き起
こすので、一般的には良い考えではありません。


File: python.info,  Node: 標準型の階層,  Next: 特殊メソッド名,  Prev: オブジェクト、値、および型,  Up: データモデル

4.3.2 標準型の階層
------------------

以下は Python に組み込まれている型のリストです。(実装によって、C、Java、
またはその他の言語で書かれた) 拡張モジュールで、その他の型が定義されてい
ることがあります。新たな型 (有理数や、整数を効率的に記憶する配列、など)
の追加は、たいてい標準ライブラリを通して提供されますが、将来のバージョン
の Python では、型の階層構造にこのような追加がなされるかもしれません。

以下に説明する型のいくつかには、 '特殊属性 (special attribute)' を列挙し
た段落があります。これらの属性は実装へのアクセス手段を提供するもので、一
般的な用途に利用するためのものではありません。特殊属性の定義は将来変更さ
れる可能性があります。

* Menu:

* None::
* NotImplemented::
* Ellipsis::
* numbers.Number: numbers Number.
* シーケンス型 (sequence): シーケンス型 sequence.
* 集合型: 集合型<2>.
* マッピング型 (mapping): マッピング型 mapping.
* 呼び出し可能型 (callable type): 呼び出し可能型 callable type.
* モジュール: モジュール<3>.
* カスタムクラス型::
* クラスインスタンス (class instance): クラスインスタンス class instance.
* I/O オブジェクト (ファイルオブジェクトの別名): I/O オブジェクト ファイルオブジェクトの別名.
* 内部型 (internal type): 内部型 internal type.


File: python.info,  Node: None,  Next: NotImplemented,  Up: 標準型の階層

4.3.2.1 None
............

この型には単一の値しかありません。この値を持つオブジェクトはただ一つしか
存在しません。このオブジェクトは組み込み名 ‘None’ でアクセスされます。こ
のオブジェクトは、様々な状況で値が存在しないことをしめします。例えば、明
示的に値を返さない関数は ‘None’ を返します。 ‘None’ の真値 (truth value)
は偽 (false) です。


File: python.info,  Node: NotImplemented,  Next: Ellipsis,  Prev: None,  Up: 標準型の階層

4.3.2.2 NotImplemented
......................

This type has a single value.  There is a single object with this value.
This object is accessed through the built-in name *note NotImplemented:
1a2.  Numeric methods and rich comparison methods should return this
value if they do not implement the operation for the operands provided.
(The interpreter will then try the reflected operation, or some other
fallback, depending on the operator.)  It should not be evaluated in a
boolean context.

詳細は *note 算術演算の実装: 2332. を参照してください。

バージョン 3.9 で変更: Evaluating *note NotImplemented: 1a2. in a
boolean context was deprecated.

バージョン 3.14 で変更: Evaluating *note NotImplemented: 1a2. in a
boolean context now raises a *note TypeError: 198.  It previously
evaluated to *note True: e07. and emitted a *note DeprecationWarning:
1a3. since Python 3.9.


File: python.info,  Node: Ellipsis,  Next: numbers Number,  Prev: NotImplemented,  Up: 標準型の階層

4.3.2.3 Ellipsis
................

この型には単一の値しかありません。この値を持つオブジェクトはただ一つしか
存在しません。このオブジェクトはリテラル ‘...’ またはPythonで決められて
いる名前 ‘Ellipsis’ でアクセスされます。真理値は真 (true)です。


File: python.info,  Node: numbers Number,  Next: シーケンス型 sequence,  Prev: Ellipsis,  Up: 標準型の階層

4.3.2.4 ‘numbers.Number’
........................

数値リテラルによって作成されたり、算術演算や組み込みの算術関数によって返
されるオブジェクトです。数値オブジェクトは変更不能です; 一度値が生成され
ると、二度と変更されることはありません。Python の数値オブジェクトはいう
までもなく数学で言うところの数値と強く関係していますが、コンピュータ内で
数値を表現する際に伴う制限を受けています。

*note __repr__(): 82f. と *note __str__(): 830. から計算された数値クラス
の文字列表現には次のような特性があります:

   * その文字列は、クラスコンストラクタに渡したときに、元の数値の値を持
     つオブジェクトを生成する有効な数値リテラルです。

   * できるなら、10を底として表現されます。

   * 小数点の前にある 1 つのゼロを除いて、上に連なるゼロは表示されません
     。

   * 小数点の後にある 1 つのゼロを除いて、下に連なるゼロは表示されません
     。

   * 符号は数値が負数のときのみ表示されます。

Python distinguishes between integers, floating-point numbers, and
complex numbers:

* Menu:

* numbers.Integral (整数): numbers Integral 整数.
* numbers.Real (float) (実数): numbers Real float 実数.
* numbers.Complex (complex): numbers Complex complex.


File: python.info,  Node: numbers Integral 整数,  Next: numbers Real float 実数,  Up: numbers Number

4.3.2.5 ‘numbers.Integral’ (整数)
.................................

整数型は、整数(正の数および負の数)を表す数学的集合内における要素を表現す
る型です。

     注釈: 
     整数表現に関する規則は、負の整数を含むシフト演算やマスク演算におい
     て、最も有意義な解釈ができるように意図されています。

整数には 2 種類あります:

整数 (*note int: 19b.)

     無制限の範囲の数を表現しますが、利用可能な (仮想) メモリサイズの制
     限のみを受けます。シフト演算やマスク演算のために2進数表現を持つと想
     定されます。負の数は符号ビットが左に無限に延びているような錯覚を与
     える 2 の補数表現の変型で表されます。

ブール値 (*note bool: 3c3.)

     真偽値の False と True を表します。‘False’ と ‘True’ を表す 2 つの
     オブジェクトのみがブール値オブジェクトです。ブール型は整数型の派生
     型であり、ほとんどの状況でそれぞれ 0 と 1 のように振る舞いますが、
     例外として文字列に変換されたときはそれぞれ ‘"False"’ および
     ‘"True"’ という文字列が返されます。


File: python.info,  Node: numbers Real float 実数,  Next: numbers Complex complex,  Prev: numbers Integral 整数,  Up: numbers Number

4.3.2.6 ‘numbers.Real’ (‘float’) (実数)
.......................................

These represent machine-level double precision floating-point numbers.
You are at the mercy of the underlying machine architecture (and C or
Java implementation) for the accepted range and handling of overflow.
Python does not support single-precision floating-point numbers; the
savings in processor and memory usage that are usually the reason for
using these are dwarfed by the overhead of using objects in Python, so
there is no reason to complicate the language with two kinds of
floating-point numbers.


File: python.info,  Node: numbers Complex complex,  Prev: numbers Real float 実数,  Up: numbers Number

4.3.2.7 ‘numbers.Complex’ (‘complex’)
.....................................

These represent complex numbers as a pair of machine-level double
precision floating-point numbers.  The same caveats apply as for
floating-point numbers.  The real and imaginary parts of a complex
number ‘z’ can be retrieved through the read-only attributes ‘z.real’
and ‘z.imag’.


File: python.info,  Node: シーケンス型 sequence,  Next: 集合型<2>,  Prev: numbers Number,  Up: 標準型の階層

4.3.2.8 シーケンス型 (sequence)
...............................

These represent finite ordered sets indexed by non-negative numbers.
The built-in function *note len(): 840. returns the number of items of a
sequence.  When the length of a sequence is 'n', the index set contains
the numbers 0, 1, ..., 'n'-1.  Item 'i' of sequence 'a' is selected by
‘a[i]’.  Some sequences, including built-in sequences, interpret
negative subscripts by adding the sequence length.  For example, ‘a[-2]’
equals ‘a[n-2]’, the second to last item of sequence a with length ‘n’.

The resulting value must be a nonnegative integer less than the number
of items in the sequence.  If it is not, an *note IndexError: 174e. is
raised.

Sequences also support slicing: ‘a[start:stop]’ selects all items with
index 'k' such that 'start' ‘<=’ 'k' ‘<’ 'stop'.  When used as an
expression, a slice is a sequence of the same type.  The comment above
about negative subscripts also applies to negative slice positions.
Note that no error is raised if a slice position is less than zero or
larger than the length of the sequence.

If 'start' is missing or *note None: 885, slicing behaves as if 'start'
was zero.  If 'stop' is missing or ‘None’, slicing behaves as if 'stop'
was equal to the length of the sequence.

シーケンスによっては、第三の "ステップ (step)" パラメタを持つ "拡張スラ
イス (extended slice)" もサポートしています: ‘a[i:j:k]’ は、 ‘x = i +
n*k’, 'n' ‘>=’ ‘0’ かつ 'i' ‘<=’ 'x' ‘<’ 'j' であるようなインデクス 'x'
を持つような 'a' 全ての要素を選択します。

シーケンスは、変更可能なものか、そうでないかで区別されています:

* Menu:

* 変更不能なシーケンス (immutable sequence): 変更不能なシーケンス immutable sequence.
* 変更可能なシーケンス型 (mutable sequence): 変更可能なシーケンス型 mutable sequence.


File: python.info,  Node: 変更不能なシーケンス immutable sequence,  Next: 変更可能なシーケンス型 mutable sequence,  Up: シーケンス型 sequence

4.3.2.9 変更不能なシーケンス (immutable sequence)
.................................................

変更不能なシーケンス型のオブジェクトは、一度生成されるとその値を変更する
ことができません。 (オブジェクトに他のオブジェクトへの参照が入っている場
合、参照されているオブジェクトは変更可能なオブジェクトでもよく、その値は
変更される可能性があります; しかし、変更不能なオブジェクトが直接参照して
いるオブジェクトの集合自体は、変更することができません。)

以下の型は変更不能なシーケンス型です:

文字列型 (string)

     A string (*note str: 169.) is a sequence of values that represent
     'characters', or more formally, 'Unicode code points'.  All the
     code points in the range ‘0’ to ‘0x10FFFF’ can be represented in a
     string.

     Python doesn't have a dedicated 'character' type.  Instead, every
     code point in the string is represented as a string object with
     length ‘1’.

     The built-in function *note ord(): 233b. converts a code point from
     its string form to an integer in the range ‘0’ to ‘0x10FFFF’; *note
     chr(): 19ef. converts an integer in the range ‘0’ to ‘0x10FFFF’ to
     the corresponding length ‘1’ string object.  *note str.encode():
     ad2. can be used to convert a *note str: 169. to *note bytes: 192.
     using the given text encoding, and *note bytes.decode(): ad3. can
     be used to achieve the opposite.

タプル型 (tuple)

     The items of a *note tuple: 614. are arbitrary Python objects.
     Tuples of two or more items are formed by comma-separated lists of
     expressions.  A tuple of one item (a 'singleton') can be formed by
     affixing a comma to an expression (an expression by itself does not
     create a tuple, since parentheses must be usable for grouping of
     expressions).  An empty tuple can be formed by an empty pair of
     parentheses.

bytes

     A *note bytes: 192. object is an immutable array.  The items are
     8-bit bytes, represented by integers in the range 0 <= x < 256.
     Bytes literals (like ‘b'abc'’) and the built-in *note bytes(): 192.
     constructor can be used to create bytes objects.  Also, bytes
     objects can be decoded to strings via the *note decode(): ad3.
     method.


File: python.info,  Node: 変更可能なシーケンス型 mutable sequence,  Prev: 変更不能なシーケンス immutable sequence,  Up: シーケンス型 sequence

4.3.2.10 変更可能なシーケンス型 (mutable sequence)
..................................................

変更可能なシーケンスは、作成した後で変更することができます。変更可能なシ
ーケンスでは、添字表記やスライス表記を使って指定された要素に代入を行うこ
とができ、 *note del: 1b1f. (delete) 文を使って要素を削除することができ
ます。

     注釈: 
     The *note collections: 1e. and *note array: 8. module provide
     additional examples of mutable sequence types.

Python に最初から組み込まれている変更可能なシーケンス型は、今のところ二
つです:

リスト型 (list)

     リストの要素は任意の Python オブジェクトにできます。リストは、角括
     弧の中にカンマで区切られた式を並べて作ります。 (長さが 0 や 1 のシ
     ーケンスを作るために特殊な場合分けは必要ないことに注意してください
     。)

バイト配列

     bytearray オブジェクトは変更可能な配列です。組み込みの *note
     bytearray(): 344. コンストラクタによって作成されます。変更可能なこ
     とを除けば (つまりハッシュ化できない)、 byte array は変更不能な
     *note bytes: 192. オブジェクトと同じインターフェースと機能を提供し
     ます。


File: python.info,  Node: 集合型<2>,  Next: マッピング型 mapping,  Prev: シーケンス型 sequence,  Up: 標準型の階層

4.3.2.11 集合型
...............

集合型は、順序のない、ユニークで不変なオブジェクトの有限集合を表現します
。そのため、(配列の)添字を使ったインデックスアクセスはできません。ただし
、イテレートは可能で、組み込み関数 *note len(): 840. は集合の要素数を返
します。集合型の一般的な使い方は、集合に属しているかの高速なテスト、シー
ケンスからの重複の排除、共通集合・和集合・差・対称差といった数学的な演算
の計算です。

集合の要素には、辞書のキーと同じ普遍性に関するルールが適用されます。数値
型は通常の数値比較のルールに従うことに注意してください。もし2つの数値の
比較結果が同値である(例えば、 ‘1’ と ‘1.0’)なら、そのうちの1つのみを集合
に含めることができます。

現在、2つの組み込み集合型があります:

集合型

     可変な集合型です。組み込みの *note set(): 184. コンストラクタで作成
     され、後から *note add(): 233e. などのいくつかのメソッドで更新でき
     ます。

Frozen set 型

     不変な集合型です。組み込みの *note frozenset(): 7f2. コンストラクタ
     によって作成されます。 frozenset は不変で *note ハッシュ可能: 824.
     なので、別の集合型の要素になったり、辞書のキーにすることができます
     。


File: python.info,  Node: マッピング型 mapping,  Next: 呼び出し可能型 callable type,  Prev: 集合型<2>,  Up: 標準型の階層

4.3.2.12 マッピング型 (mapping)
...............................

任意のインデクス集合でインデクス化された、オブジェクトからなる有限の集合
を表現します。添字表記 ‘a[k]’ は、 ‘k’ でインデクス指定された要素を ‘a’
から選択します; 選択された要素は式の中で使うことができ、代入や *note
del: 1b1f. 文の対象にすることができます。組み込み関数 *note len(): 840.
は、マッピング内の要素数を返します。

Python に最初から組み込まれているマッピング型は、今のところ一つだけです:

* Menu:

* 辞書型 (dictionary): 辞書型 dictionary<2>.


File: python.info,  Node: 辞書型 dictionary<2>,  Up: マッピング型 mapping

4.3.2.13 辞書型 (dictionary)
............................

ほぼ任意の値でインデクスされたオブジェクトからなる有限の集合を表します。
キー (key) として使えない値の唯一の型は、リストや辞書、そしてオブジェク
トの同一性でなく値で比較されるその他の変更可能な型です。 これは、辞書型
を効率的に実装する上で、キーのハッシュ値が不変である必要があるためです。
数値型をキーに使う場合、キー値は通常の数値比較における規則に従います: 二
つの値が等しくなる場合 (例えば ‘1’ と ‘1.0’)、互いに同じ辞書のエントリを
表すインデクスとして使うことができます。

辞書は挿入の順序を保持します。つまり、キーは辞書に追加された順番に生成さ
れていきます。既存のキーを置き換えても、キーの順序は変わりません。キーを
削除したのちに再挿入すると、元の場所ではなく辞書の最後に追加されます。

Dictionaries are mutable; they can be created by the ‘{}’ notation (see
section *note 辞書表示: f7f.).

拡張モジュール *note dbm.ndbm: 38. 、 *note dbm.gnu: 37. は、 *note
collections: 1e. モジュールのように、別のマッピング型の例を提供していま
す。

バージョン 3.7 で変更: Pythonのバージョン3.6では、辞書は挿入順序を保持し
ませんでした。CPython 3.6では挿入順序は保持されましたが、それは策定され
た言語の仕様というより、その当時の実装の細部とみなされていました。


File: python.info,  Node: 呼び出し可能型 callable type,  Next: モジュール<3>,  Prev: マッピング型 mapping,  Up: 標準型の階層

4.3.2.14 呼び出し可能型 (callable type)
.......................................

関数呼び出し操作 (*note 呼び出し (call): f7d. 参照) を行うことができる型
です:

* Menu:

* ユーザ定義関数 (user-defined function): ユーザ定義関数 user-defined function.
* インスタンスメソッド::
* ジェネレータ関数 (generator function): ジェネレータ関数 generator function.
* コルーチン関数 (coroutine function): コルーチン関数 coroutine function.
* 非同期ジェネレータ関数 (asynchronous generator function): 非同期ジェネレータ関数 asynchronous generator function.
* 組み込み関数 (built-in function): 組み込み関数 built-in function.
* 組み込みメソッド (built-in method): 組み込みメソッド built-in method.
* クラス: クラス<2>.
* クラスのインスタンス::


File: python.info,  Node: ユーザ定義関数 user-defined function,  Next: インスタンスメソッド,  Up: 呼び出し可能型 callable type

4.3.2.15 ユーザ定義関数 (user-defined function)
...............................................

ユーザ定義関数オブジェクトは、関数定義を行うことで生成されます (*note
関数定義: 2018. 参照)。関数は、仮引数 (formal parameter) リストと同じ数
の要素が入った引数リストとともに呼び出されます。

* Menu:

* Special read-only attributes::
* Special writable attributes::


File: python.info,  Node: Special read-only attributes,  Next: Special writable attributes,  Up: ユーザ定義関数 user-defined function

4.3.2.16 Special read-only attributes
.....................................

属性                                                   意味
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
 -- の属性: function.__builtins__                      A reference to the *note dictionary: 183. that holds
                                                       the function's builtins namespace.
                                                       
                                                       Added in version 3.10.
                                                       
                                                       
 -- の属性: function.__globals__                       A reference to the *note dictionary: 183. that holds
                                                       the function's *note global variables: 2346. - the
                                                       global namespace of the module in which the function
                                                       was defined.
                                                       
                                                       
 -- の属性: function.__closure__                       ‘None’ or a *note tuple: 614. of cells that contain
                                                       bindings for the names specified in the
                                                       *note co_freevars: 2347. attribute of the function's
                                                       *note code object: 59d.
                                                       
                                                       セルオブジェクトは属性 ‘cell_contents’ を持っていま
                                                       す。 これはセルの値を設定するのに加えて、セルの値を
                                                       得るのにも使えます。
                                                       


File: python.info,  Node: Special writable attributes,  Prev: Special read-only attributes,  Up: ユーザ定義関数 user-defined function

4.3.2.17 Special writable attributes
....................................

Most of these attributes check the type of the assigned value:

属性                                                   意味
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
 -- の属性: function.__doc__                           関数のドキュメンテーション文字列です。ドキュメンテー
                                                       ションがない場合は ‘None’ になります。
                                                       
                                                       
 -- の属性: function.__name__                          The function's name.  See also:
                                                       *note __name__ attributes: 1272.
                                                       
                                                       
 -- の属性: function.__qualname__                      The function's *note qualified name: 1d24.  See
                                                       also: *note __qualname__ attributes: 1271.
                                                       
                                                       Added in version 3.3.
                                                       
                                                       
 -- の属性: function.__module__                        関数が定義されているモジュールの名前です。モジュール
                                                       名がない場合は ‘None’ になります。
                                                       
                                                       
 -- の属性: function.__defaults__                      A *note tuple: 614. containing default
                                                       *note parameter: 234b. values for those parameters
                                                       that have defaults, or ‘None’ if no parameters have
                                                       a default value.
                                                       
                                                       
 -- の属性: function.__code__                          The *note code object: 4e6. representing the
                                                       compiled function body.
                                                       
                                                       
 -- の属性: function.__dict__                          The namespace supporting arbitrary function
                                                       attributes.  See also:
                                                       *note __dict__ attributes: 77d.
                                                       
                                                       
 -- の属性: function.__annotations__                   A *note dictionary: 183. containing annotations of
                                                       *note parameters: 234b.  The keys of the dictionary
                                                       are the parameter names, and ‘'return'’ for the
                                                       return annotation, if provided.  See also:
                                                       *note object.__annotations__: 458.
                                                       
                                                       バージョン 3.14 で変更: Annotations are now
                                                       *note lazily evaluated: 685.  See PEP 649(1).
                                                       
                                                       
 -- の属性: function.__annotate__                      The *note annotate function: 15d. for this function,
                                                       or ‘None’ if the function has no annotations.  See
                                                       *note object.__annotate__: 1983.
                                                       
                                                       Added in version 3.14.
                                                       
                                                       
 -- の属性: function.__kwdefaults__                    A *note dictionary: 183. containing defaults for
                                                       keyword-only *note parameters: 234b.
                                                       
                                                       
 -- の属性: function.__type_params__                   A *note tuple: 614. containing the
                                                       *note type parameters: 5ad. of a
                                                       *note generic function: 682.
                                                       
                                                       Added in version 3.12.
                                                       

Function objects also support getting and setting arbitrary attributes,
which can be used, for example, to attach metadata to functions.
Regular attribute dot-notation is used to get and set such attributes.

'CPython 実装の詳細:' CPython's current implementation only supports
function attributes on user-defined functions.  Function attributes on
*note built-in functions: 234e. may be supported in the future.

Additional information about a function's definition can be retrieved
from its *note code object: 4e6. (accessible via the *note __code__:
59d. attribute).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0649/


File: python.info,  Node: インスタンスメソッド,  Next: ジェネレータ関数 generator function,  Prev: ユーザ定義関数 user-defined function,  Up: 呼び出し可能型 callable type

4.3.2.18 インスタンスメソッド
.............................

インスタンスメソッドオブジェクトは、クラス、クラスインスタンスと任意の呼
び出し可能オブジェクト (通常はユーザ定義関数) を結びつけます。

Special read-only attributes:

 -- の属性: method.__self__                            Refers to the class instance object to which the
                                                       method is *note bound: 2350.
                                                       
                                                       
 -- の属性: method.__func__                            Refers to the original *note function object: 59c.
                                                       
                                                       
 -- の属性: method.__doc__                             The method's documentation (same as
                                                       *note method.__func__.__doc__: 13f1.).  A
                                                       *note string: 169. if the original function had a
                                                       docstring, else ‘None’.
                                                       
                                                       
 -- の属性: method.__name__                            The name of the method (same as
                                                       *note method.__func__.__name__: 14ec.)
                                                       
                                                       
 -- の属性: method.__module__                          The name of the module the method was defined in, or
                                                       ‘None’ if unavailable.
                                                       

Methods also support accessing (but not setting) the arbitrary function
attributes on the underlying *note function object: 59c.

User-defined method objects may be created when getting an attribute of
a class (perhaps via an instance of that class), if that attribute is a
user-defined *note function object: 59c. or a *note classmethod: 48e.
object.  When an instance method object is created by retrieving a
user-defined *note function object: 59c. from a class via one of its
instances, its *note __self__: 15e2. attribute is the instance, and the
method object is said to be 'bound'.  The new method's *note __func__:
1514. attribute is the original function object.

When an instance method object is created by retrieving a *note
classmethod: 48e. object from a class or instance, its *note __self__:
15e2. attribute is the class itself, and its *note __func__: 1514.
attribute is the function object underlying the class method.

When an instance method object is called, the underlying function (*note
__func__: 1514.) is called, inserting the class instance (*note
__self__: 15e2.) in front of the argument list.  For instance, when ‘C’
is a class which contains a definition for a function ‘f()’, and ‘x’ is
an instance of ‘C’, calling ‘x.f(1)’ is equivalent to calling ‘C.f(x,
1)’.

When an instance method object is derived from a *note classmethod: 48e.
object, the "class instance" stored in *note __self__: 15e2. will
actually be the class itself, so that calling either ‘x.f(1)’ or
‘C.f(1)’ is equivalent to calling ‘f(C,1)’ where ‘f’ is the underlying
function.

It is important to note that user-defined functions which are attributes
of a class instance are not converted to bound methods; this 'only'
happens when the function is an attribute of the class.


File: python.info,  Node: ジェネレータ関数 generator function,  Next: コルーチン関数 coroutine function,  Prev: インスタンスメソッド,  Up: 呼び出し可能型 callable type

4.3.2.19 ジェネレータ関数 (generator function)
..............................................

*note yield: bc2. 文 (*note yield 文: bc2. の節を参照) を使う関数もしく
はメソッドは 'ジェネレータ関数' と呼ばれます。 そのような関数が呼び出さ
れたときは常に、関数の本体を実行するのに使える *note イテレータ: 4c8. オ
ブジェクトを返します: イテレータの *note iterator.__next__(): 14e5. メソ
ッドを呼び出すと、 ‘yield’ 文を使って値が提供されるまで関数を実行します
。 関数の *note return: 1af. 文を実行するか終端に達したときは、 *note
StopIteration: df5. 例外が送出され、イテレータが返すべき値の最後まで到達
しています。


File: python.info,  Node: コルーチン関数 coroutine function,  Next: 非同期ジェネレータ関数 asynchronous generator function,  Prev: ジェネレータ関数 generator function,  Up: 呼び出し可能型 callable type

4.3.2.20 コルーチン関数 (coroutine function)
............................................

*note async def: 7ed. を使用して定義された関数やメソッドを 'コルーチン関
数 (coroutine function)' と呼びます。 呼び出された時、そのような関数は
*note coroutine: 6b9. オブジェクトを返します。 コルーチン関数は *note
async with: 185. や *note async for: ca1. 文だけでなく *note await: 18d.
式を持つことが出来ます。 *note コルーチンオブジェクト: 2356. を参照して
ください。


File: python.info,  Node: 非同期ジェネレータ関数 asynchronous generator function,  Next: 組み込み関数 built-in function,  Prev: コルーチン関数 coroutine function,  Up: 呼び出し可能型 callable type

4.3.2.21 非同期ジェネレータ関数 (asynchronous generator function)
.................................................................

*note async def: 7ed. を使って定義され、 *note yield: bc2. 文を使用して
いる関数やメソッドを 'asynchronous generator function' と呼びます。 その
ような関数は、呼び出されたとき、*note 非同期イテレータ: 4c7. オブジェク
トを返します。 このオブジェクトは *note async for: ca1. 文で関数の本体を
実行するのに使えます。

非同期イテレータの *note aiterator.__anext__: 1882. メソッドを呼び出すと
、他の処理が待たされているときに、 *note yield: bc2. 式を使い値を提供す
るところまで処理を進める *note awaitable: 4c9. を返します。 その関数が空
の *note return: 1af. 文を実行する、もしくは処理の終わりに到達したときは
、 *note StopAsyncIteration: 1e0f. 例外が送出され、非同期イテレータは出
力すべき値の最後に到達したことになります。


File: python.info,  Node: 組み込み関数 built-in function,  Next: 組み込みメソッド built-in method,  Prev: 非同期ジェネレータ関数 asynchronous generator function,  Up: 呼び出し可能型 callable type

4.3.2.22 組み込み関数 (built-in function)
.........................................

A built-in function object is a wrapper around a C function.  Examples
of built-in functions are *note len(): 840. and *note math.sin(): 16d7.
(*note math: 92. is a standard built-in module).  The number and type of
the arguments are determined by the C function.  Special read-only
attributes:

   * ‘__doc__’ is the function's documentation string, or ‘None’ if
     unavailable.  See *note function.__doc__: 13f1.

   * ‘__name__’ is the function's name.  See *note function.__name__:
     14ec.

   * ‘__self__’ is set to ‘None’ (but see the next item).

   * ‘__module__’ is the name of the module the function was defined in
     or ‘None’ if unavailable.  See *note function.__module__: 234a.


File: python.info,  Node: 組み込みメソッド built-in method,  Next: クラス<2>,  Prev: 組み込み関数 built-in function,  Up: 呼び出し可能型 callable type

4.3.2.23 組み込みメソッド (built-in method)
...........................................

This is really a different disguise of a built-in function, this time
containing an object passed to the C function as an implicit extra
argument.  An example of a built-in method is ‘alist.append()’, assuming
'alist' is a list object.  In this case, the special read-only attribute
‘__self__’ is set to the object denoted by 'alist'.  (The attribute has
the same semantics as it does with *note other instance methods: 15e2.)


File: python.info,  Node: クラス<2>,  Next: クラスのインスタンス,  Prev: 組み込みメソッド built-in method,  Up: 呼び出し可能型 callable type

4.3.2.24 クラス
...............

Classes are callable.  These objects normally act as factories for new
instances of themselves, but variations are possible for class types
that override *note __new__(): 7a0.  The arguments of the call are
passed to ‘__new__()’ and, in the typical case, to *note __init__():
8bf. to initialize the new instance.


File: python.info,  Node: クラスのインスタンス,  Prev: クラス<2>,  Up: 呼び出し可能型 callable type

4.3.2.25 クラスのインスタンス
.............................

任意のクラスのインスタンスは、クラスで *note __call__(): 77a. メソッドを
定義することで呼び出し可能になります。


File: python.info,  Node: モジュール<3>,  Next: カスタムクラス型,  Prev: 呼び出し可能型 callable type,  Up: 標準型の階層

4.3.2.26 モジュール
...................

Modules are a basic organizational unit of Python code, and are created
by the *note import system: 2360. as invoked either by the *note import:
7f8. statement, or by calling functions such as *note
importlib.import_module(): 73c. and built-in *note __import__(): ad1.  A
module object has a namespace implemented by a *note dictionary: 183.
object (this is the dictionary referenced by the *note __globals__:
14eb. attribute of functions defined in the module).  Attribute
references are translated to lookups in this dictionary, e.g., ‘m.x’ is
equivalent to ‘m.__dict__["x"]’.  A module object does not contain the
code object used to initialize the module (since it isn't needed once
the initialization is done).

属性の代入を行うと、モジュールの名前空間辞書の内容を更新します。例えば、
‘m.x = 1’ は ‘m.__dict__["x"] = 1’ と同じです。

* Menu:

* Import-related attributes on module objects::
* Other writable attributes on module objects::
* Module dictionaries::


File: python.info,  Node: Import-related attributes on module objects,  Next: Other writable attributes on module objects,  Up: モジュール<3>

4.3.2.27 Import-related attributes on module objects
....................................................

Module objects have the following attributes that relate to the *note
import system: 2360.  When a module is created using the machinery
associated with the import system, these attributes are filled in based
on the module's *note spec: 2363, before the *note loader: 1a28.
executes and loads the module.

To create a module dynamically rather than using the import system, it's
recommended to use *note importlib.util.module_from_spec(): 1013, which
will set the various import-controlled attributes to appropriate values.
It's also possible to use the *note types.ModuleType: 1014. constructor
to create modules directly, but this technique is more error-prone, as
most attributes must be manually set on the module object after it has
been created when using this approach.

     注意: With the exception of *note __name__: 15a3, it is 'strongly'
     recommended that you rely on *note __spec__: 2364. and its
     attributes instead of any of the other individual attributes listed
     in this subsection.  Note that updating an attribute on ‘__spec__’
     will not update the corresponding attribute on the module itself:

          >>> import typing
          >>> typing.__name__, typing.__spec__.name
          ('typing', 'typing')
          >>> typing.__spec__.name = 'spelling'
          >>> typing.__name__, typing.__spec__.name
          ('typing', 'spelling')
          >>> typing.__name__ = 'keyboard_smashing'
          >>> typing.__name__, typing.__spec__.name
          ('keyboard_smashing', 'spelling')

 -- の属性: module.__name__

     The name used to uniquely identify the module in the import system.
     For a directly executed module, this will be set to ‘"__main__"’.

     This attribute must be set to the fully qualified name of the
     module.  It is expected to match the value of *note
     module.__spec__.name: 2365.

 -- の属性: module.__spec__

     A record of the module's import-system-related state.

     Set to the *note module spec: 226c. that was used when importing
     the module.  See *note Module specs: 2366. for more details.

     Added in version 3.4.

 -- の属性: module.__package__

     The *note package: 233. a module belongs to.

     If the module is top-level (that is, not a part of any specific
     package) then the attribute should be set to ‘''’ (the empty
     string).  Otherwise, it should be set to the name of the module's
     package (which can be equal to *note module.__name__: 15a3. if the
     module itself is a package).  See PEP 366(1) for further details.

     This attribute is used instead of *note __name__: 15a3. to
     calculate explicit relative imports for main modules.  It defaults
     to ‘None’ for modules created dynamically using the *note
     types.ModuleType: 1014. constructor; use *note
     importlib.util.module_from_spec(): 1013. instead to ensure the
     attribute is set to a *note str: 169.

     It is 'strongly' recommended that you use *note
     module.__spec__.parent: 324. instead of ‘module.__package__’.
     *note __package__: 323. is now only used as a fallback if
     ‘__spec__.parent’ is not set, and this fallback path is deprecated.

     バージョン 3.4 で変更: This attribute now defaults to ‘None’ for
     modules created dynamically using the *note types.ModuleType: 1014.
     constructor.  Previously the attribute was optional.

     バージョン 3.6 で変更: The value of ‘__package__’ is expected to be
     the same as *note __spec__.parent: 324.  *note __package__: 323. is
     now only used as a fallback during import resolution if
     ‘__spec__.parent’ is not defined.

     バージョン 3.10 で変更: *note ImportWarning: 71e. is raised if an
     import resolution falls back to ‘__package__’ instead of *note
     __spec__.parent: 324.

     バージョン 3.12 で変更: Raise *note DeprecationWarning: 1a3.
     instead of *note ImportWarning: 71e. when falling back to
     ‘__package__’ during import resolution.

     Deprecated since version 3.13, will be removed in version 3.15:
     ‘__package__’ will cease to be set or taken into consideration by
     the import system or standard library.

 -- の属性: module.__loader__

     The *note loader: 1a28. object that the import machinery used to
     load the module.

     This attribute is mostly useful for introspection, but can be used
     for additional loader-specific functionality, for example getting
     data associated with a loader.

     ‘__loader__’ defaults to ‘None’ for modules created dynamically
     using the *note types.ModuleType: 1014. constructor; use *note
     importlib.util.module_from_spec(): 1013. instead to ensure the
     attribute is set to a *note loader: 1a28. object.

     It is 'strongly' recommended that you use *note
     module.__spec__.loader: 33c. instead of ‘module.__loader__’.

     バージョン 3.4 で変更: This attribute now defaults to ‘None’ for
     modules created dynamically using the *note types.ModuleType: 1014.
     constructor.  Previously the attribute was optional.

     Deprecated since version 3.12, will be removed in version 3.16:
     Setting ‘__loader__’ on a module while failing to set
     ‘__spec__.loader’ is deprecated.  In Python 3.16, ‘__loader__’ will
     cease to be set or taken into consideration by the import system or
     the standard library.

 -- の属性: module.__path__

     A (possibly empty) *note sequence: 716. of strings enumerating the
     locations where the package's submodules will be found.
     Non-package modules should not have a ‘__path__’ attribute.  See
     *note __path__ attributes on modules: 2367. for more details.

     It is 'strongly' recommended that you use *note
     module.__spec__.submodule_search_locations: 2368. instead of
     ‘module.__path__’.

 -- の属性: module.__file__

 -- の属性: module.__cached__

     ‘__file__’ and ‘__cached__’ are both optional attributes that may
     or may not be set.  Both attributes should be a *note str: 169.
     when they are available.

     ‘__file__’ indicates the pathname of the file from which the module
     was loaded (if loaded from a file), or the pathname of the shared
     library file for extension modules loaded dynamically from a shared
     library.  It might be missing for certain types of modules, such as
     C modules that are statically linked into the interpreter, and the
     *note import system: 2360. may opt to leave it unset if it has no
     semantic meaning (for example, a module loaded from a database).

     If ‘__file__’ is set then the ‘__cached__’ attribute might also be
     set, which is the path to any compiled version of the code (for
     example, a byte-compiled file).  The file does not need to exist to
     set this attribute; the path can simply point to where the compiled
     file 'would' exist (see PEP 3147(2)).

     Note that ‘__cached__’ may be set even if ‘__file__’ is not set.
     However, that scenario is quite atypical.  Ultimately, the *note
     loader: 1a28. is what makes use of the module spec provided by the
     *note finder: 236a. (from which ‘__file__’ and ‘__cached__’ are
     derived).  So if a loader can load from a cached module but
     otherwise does not load from a file, that atypical scenario may be
     appropriate.

     It is 'strongly' recommended that you use *note
     module.__spec__.cached: 322. instead of ‘module.__cached__’.

     Deprecated since version 3.13, will be removed in version 3.15:
     Setting ‘__cached__’ on a module while failing to set
     ‘__spec__.cached’ is deprecated.  In Python 3.15, ‘__cached__’ will
     cease to be set or taken into consideration by the import system or
     standard library.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0366/

   (2) https://peps.python.org/pep-3147/


File: python.info,  Node: Other writable attributes on module objects,  Next: Module dictionaries,  Prev: Import-related attributes on module objects,  Up: モジュール<3>

4.3.2.28 Other writable attributes on module objects
....................................................

As well as the import-related attributes listed above, module objects
also have the following writable attributes:

 -- の属性: module.__doc__

     The module's documentation string, or ‘None’ if unavailable.  See
     also: *note __doc__ attributes: b21.

 -- の属性: module.__annotations__

     A dictionary containing *note variable annotations: f51. collected
     during module body execution.  For best practices on working with
     ‘__annotations__’, see *note annotationlib: 6.

     バージョン 3.14 で変更: Annotations are now *note lazily evaluated:
     685.  See PEP 649(1).

 -- の属性: module.__annotate__

     The *note annotate function: 15d. for this module, or ‘None’ if the
     module has no annotations.  See also: *note __annotate__: 1983.
     attributes.

     Added in version 3.14.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0649/


File: python.info,  Node: Module dictionaries,  Prev: Other writable attributes on module objects,  Up: モジュール<3>

4.3.2.29 Module dictionaries
............................

Module objects also have the following special read-only attribute:

 -- の属性: module.__dict__

     The module's namespace as a dictionary object.  Uniquely among the
     attributes listed here, ‘__dict__’ cannot be accessed as a global
     variable from within a module; it can only be accessed as an
     attribute on module objects.

     CPython がモジュール辞書を削除する方法により、モジュール辞書が生き
     た参照を持っていたとしてもその辞書はモジュールがスコープから外れた
     時に削除されます。これを避けるには、辞書をコピーするか、辞書を直接
     使っている間モジュールを保持してください。


File: python.info,  Node: カスタムクラス型,  Next: クラスインスタンス class instance,  Prev: モジュール<3>,  Up: 標準型の階層

4.3.2.30 カスタムクラス型
.........................

Custom class types are typically created by class definitions (see
section *note クラス定義: 14ef.).  A class has a namespace implemented
by a dictionary object.  Class attribute references are translated to
lookups in this dictionary, e.g., ‘C.x’ is translated to
‘C.__dict__["x"]’ (although there are a number of hooks which allow for
other means of locating attributes).  When the attribute name is not
found there, the attribute search continues in the base classes.  This
search of the base classes uses the C3 method resolution order which
behaves correctly even in the presence of 'diamond' inheritance
structures where there are multiple inheritance paths leading back to a
common ancestor.  Additional details on the C3 MRO used by Python can be
found at *note The Python 2.3 Method Resolution Order: 16c3.

When a class attribute reference (for class ‘C’, say) would yield a
class method object, it is transformed into an instance method object
whose *note __self__: 15e2. attribute is ‘C’.  When it would yield a
*note staticmethod: 453. object, it is transformed into the object
wrapped by the static method object.  See section *note デスクリプタ
(descriptor) の実装: e49. for another way in which attributes retrieved
from a class may differ from those actually contained in its *note
__dict__: 77d.

クラス属性を代入すると、そのクラスの辞書だけが更新され、基底クラスの辞書
は更新しません。

クラスオブジェクトを呼び出す (上記を参照) と、クラスインスタンスを生成し
ます (下記を参照)。

* Menu:

* Special attributes::
* Special methods::


File: python.info,  Node: Special attributes,  Next: Special methods,  Up: カスタムクラス型

4.3.2.31 Special attributes
...........................

属性                                                   意味
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
 -- の属性: type.__name__                              The class's name.  See also:
                                                       *note __name__ attributes: 1272.
                                                       
                                                       
 -- の属性: type.__qualname__                          The class's *note qualified name: 1d24.  See also:
                                                       *note __qualname__ attributes: 1271.
                                                       
                                                       
 -- の属性: type.__module__                            クラスが定義されているモジュールの名前。
                                                       
                                                       
 -- の属性: type.__dict__                              A *note mapping proxy: 698. providing a read-only
                                                       view of the class's namespace.  See also:
                                                       *note __dict__ attributes: 77d.
                                                       
                                                       
 -- の属性: type.__bases__                             A *note tuple: 614. containing the class's bases.
                                                       In most cases, for a class defined as ‘class X(A, B,
                                                       C)’, ‘X.__bases__’ will be exactly equal to ‘(A, B,
                                                       C)’.
                                                       
                                                       
 -- の属性: type.__base__                              'CPython 実装の詳細:' The single base class in the
                                                       inheritance chain that is responsible for the memory
                                                       layout of instances.  This attribute corresponds to
                                                       *note tp_base: 2375. at the C level.
                                                       
                                                       
 -- の属性: type.__doc__                               The class's documentation string, or ‘None’ if
                                                       undefined.  Not inherited by subclasses.
                                                       
                                                       
 -- の属性: type.__annotations__                       A dictionary containing
                                                       *note variable annotations: f51. collected during
                                                       class body execution.  See also:
                                                       *note __annotations__ attributes: 458.
                                                       
                                                       For best practices on working with
                                                       *note __annotations__: 458, please see
                                                       *note annotationlib: 6.  Use
                                                       *note annotationlib.get_annotations(): 459. instead
                                                       of accessing this attribute directly.
                                                       
                                                            警告: Accessing the ‘__annotations__’ attribute
                                                            directly on a class object may return
                                                            annotations for the wrong class, specifically
                                                            in certain cases where the class, its base
                                                            class, or a metaclass is defined under ‘from
                                                            __future__ import annotations’.  See 749(1) for
                                                            details.
                                                       
                                                            This attribute does not exist on certain
                                                            builtin classes.  On user-defined classes
                                                            without ‘__annotations__’, it is an empty
                                                            dictionary.
                                                       
                                                       バージョン 3.14 で変更: Annotations are now
                                                       *note lazily evaluated: 685.  See PEP 649(2).
                                                       
                                                       
 -- メソッド: type.__annotate__ ()                     The *note annotate function: 15d. for this class, or
                                                       ‘None’ if the class has no annotations.  See also:
                                                       *note __annotate__ attributes: 1983.
                                                       
                                                       Added in version 3.14.
                                                       
                                                       
 -- の属性: type.__type_params__                       A *note tuple: 614. containing the
                                                       *note type parameters: 5ad. of a
                                                       *note generic class: 2377.
                                                       
                                                       Added in version 3.12.
                                                       
                                                       
 -- の属性: type.__static_attributes__                 A *note tuple: 614. containing names of attributes
                                                       of this class which are assigned through ‘self.X’
                                                       from any function in its body.
                                                       
                                                       Added in version 3.13.
                                                       
                                                       
 -- の属性: type.__firstlineno__                       The line number of the first line of the class
                                                       definition, including decorators.  Setting the
                                                       *note __module__: 617. attribute removes the
                                                       ‘__firstlineno__’ item from the type's dictionary.
                                                       
                                                       Added in version 3.13.
                                                       
                                                       
 -- の属性: type.__mro__                               The *note tuple: 614. of classes that are considered
                                                       when looking for base classes during method
                                                       resolution.
                                                       

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0749/#pep749-metaclasses

   (2) https://peps.python.org/pep-0649/


File: python.info,  Node: Special methods,  Prev: Special attributes,  Up: カスタムクラス型

4.3.2.32 Special methods
........................

In addition to the special attributes described above, all Python
classes also have the following two methods available:

 -- メソッド: type.mro ()

     This method can be overridden by a metaclass to customize the
     method resolution order for its instances.  It is called at class
     instantiation, and its result is stored in *note __mro__: 2378.

 -- メソッド: type.__subclasses__ ()

     Each class keeps a list of weak references to its immediate
     subclasses.  This method returns a list of all those references
     still alive.  The list is in definition order.  Example:

          >>> class A: pass
          >>> class B(A): pass
          >>> A.__subclasses__()
          [<class 'B'>]


File: python.info,  Node: クラスインスタンス class instance,  Next: I/O オブジェクト ファイルオブジェクトの別名,  Prev: カスタムクラス型,  Up: 標準型の階層

4.3.2.33 クラスインスタンス (class instance)
............................................

A class instance is created by calling a class object (see above).  A
class instance has a namespace implemented as a dictionary which is the
first place in which attribute references are searched.  When an
attribute is not found there, and the instance's class has an attribute
by that name, the search continues with the class attributes.  If a
class attribute is found that is a user-defined function object, it is
transformed into an instance method object whose *note __self__: 15e2.
attribute is the instance.  Static method and class method objects are
also transformed; see above under "Classes".  See section *note
デスクリプタ (descriptor) の実装: e49. for another way in which
attributes of a class retrieved via its instances may differ from the
objects actually stored in the class's *note __dict__: 77d.  If no class
attribute is found, and the object's class has a *note __getattr__():
6fa. method, that is called to satisfy the lookup.

属性の代入や削除を行うと、インスタンスの辞書を更新しますが、クラスの辞書
を更新することはありません。クラスで *note __setattr__(): 237c. や *note
__delattr__(): 237d. メソッドが定義されている場合、直接インスタンスの辞
書を更新する代わりにこれらのメソッドが呼び出されます。

クラスインスタンスは、ある特定の名前のメソッドを持っている場合、数値型や
シーケンス型、あるいはマップ型のように振舞うことができます。 *note
特殊メソッド名: e68. を参照してください。

* Menu:

* Special attributes: Special attributes<2>.


File: python.info,  Node: Special attributes<2>,  Up: クラスインスタンス class instance

4.3.2.34 Special attributes
...........................

 -- の属性: object.__class__

     クラスインスタンスが属しているクラスです。

 -- の属性: object.__dict__

     A dictionary or other mapping object used to store an object's
     (writable) attributes.  Not all instances have a ‘__dict__’
     attribute; see the section on *note __slots__: 237f. for more
     details.


File: python.info,  Node: I/O オブジェクト ファイルオブジェクトの別名,  Next: 内部型 internal type,  Prev: クラスインスタンス class instance,  Up: 標準型の階層

4.3.2.35 I/O オブジェクト (ファイルオブジェクトの別名)
......................................................

*note file object: 13db. は開かれたファイルを表します。ファイルオブジェ
クトを作るための様々なショートカットがあります: *note open(): 316. 組み
込み関数、 *note os.popen(): 31a. 、 *note os.fdopen(): 2381. 、ソケット
オブジェクトの *note makefile(): 13b7. メソッド (あるいは拡張モジュール
から提供される他の関数やメソッド) 。

オブジェクト ‘sys.stdin’ 、 ‘sys.stdout’ および ‘sys.stderr’ は、インタ
プリタの標準入力、標準出力、および標準エラー出力ストリームに対応するファ
イルオブジェクトに初期化されます。これらはすべてテキストモードで開かれ、
*note io.TextIOBase: 8a4. 抽象クラスによって定義されたインターフェースに
従います。


File: python.info,  Node: 内部型 internal type,  Prev: I/O オブジェクト ファイルオブジェクトの別名,  Up: 標準型の階層

4.3.2.36 内部型 (internal type)
...............................

インタプリタが内部的に使っているいくつかの型は、ユーザに公開されています
。これらの定義は将来のインタプリタのバージョンでは変更される可能性があり
ますが、ここでは記述の完全性のために触れておきます。

* Menu:

* コードオブジェクト::
* フレーム (frame) オブジェクト: フレーム frame オブジェクト.
* トレースバック (traceback) オブジェクト: トレースバック traceback オブジェクト.
* スライス (slice) オブジェクト: スライス slice オブジェクト.
* 静的メソッド (static method) オブジェクト: 静的メソッド static method オブジェクト.
* クラスメソッドオブジェクト::


File: python.info,  Node: コードオブジェクト,  Next: フレーム frame オブジェクト,  Up: 内部型 internal type

4.3.2.37 コードオブジェクト
...........................

コードオブジェクトは 'バイトコンパイルされた (byte-compiled)' 実行可能な
Python コード、別名 *note バイトコード: 4aa. を表現します。コードオブジ
ェクトと関数オブジェクトの違いは、関数オブジェクトが関数のグローバル変数
(関数を定義しているモジュールのグローバル) に対して明示的な参照を持って
いるのに対し、コードオブジェクトにはコンテキストがないということです; ま
た、関数オブジェクトではデフォルト引数値を記憶できますが、コードオブジェ
クトではできません (実行時に計算される値を表現するため)。関数オブジェク
トと違い、コードオブジェクトは変更不可能で、変更可能なオブジェクトへの参
照を (直接、間接に関わらず) 含みません。

* Menu:

* Special read-only attributes: Special read-only attributes<2>.
* Methods on code objects::


File: python.info,  Node: Special read-only attributes<2>,  Next: Methods on code objects,  Up: コードオブジェクト

4.3.2.38 Special read-only attributes
.....................................

 -- の属性: codeobject.co_name                         The function name
                                                       
                                                       
 -- の属性: codeobject.co_qualname                     The fully qualified function name
                                                       
                                                       Added in version 3.11.
                                                       
                                                       
 -- の属性: codeobject.co_argcount                     The total number of positional
                                                       *note parameters: 234b. (including positional-only
                                                       parameters and parameters with default values) that
                                                       the function has
                                                       
                                                       
 -- の属性: codeobject.co_posonlyargcount              The number of positional-only
                                                       *note parameters: 234b. (including arguments with
                                                       default values) that the function has
                                                       
                                                       
 -- の属性: codeobject.co_kwonlyargcount               The number of keyword-only *note parameters: 234b.
                                                       (including arguments with default values) that the
                                                       function has
                                                       
                                                       
 -- の属性: codeobject.co_nlocals                      The number of *note local variables: 2346. used by
                                                       the function (including parameters)
                                                       
                                                       
 -- の属性: codeobject.co_varnames                     A *note tuple: 614. containing the names of the
                                                       local variables in the function (starting with the
                                                       parameter names)
                                                       
                                                       
 -- の属性: codeobject.co_cellvars                     A *note tuple: 614. containing the names of
                                                       *note local variables: 2346. that are referenced
                                                       from at least one *note nested scope: 238d. inside
                                                       the function
                                                       
                                                       
 -- の属性: codeobject.co_freevars                     A *note tuple: 614. containing the names of
                                                       *note free (closure) variables: 1893. that a
                                                       *note nested scope: 238d. references in an outer
                                                       scope.  See also *note function.__closure__: 14e8.
                                                       
                                                       Note: references to global and builtin names are
                                                       'not' included.
                                                       
                                                       
 -- の属性: codeobject.co_code                         A string representing the sequence of
                                                       *note bytecode: 4aa. instructions in the function
                                                       
                                                       
 -- の属性: codeobject.co_consts                       A *note tuple: 614. containing the literals used by
                                                       the *note bytecode: 4aa. in the function
                                                       
                                                       
 -- の属性: codeobject.co_names                        A *note tuple: 614. containing the names used by the
                                                       *note bytecode: 4aa. in the function
                                                       
                                                       
 -- の属性: codeobject.co_filename                     The name of the file from which the code was
                                                       compiled
                                                       
                                                       
 -- の属性: codeobject.co_firstlineno                  The line number of the first line of the function
                                                       
                                                       
 -- の属性: codeobject.co_lnotab                       A string encoding the mapping from
                                                       *note bytecode: 4aa. offsets to line numbers.  For
                                                       details, see the source code of the interpreter.
                                                       
                                                       バージョン 3.12 で非推奨: This attribute of code
                                                       objects is deprecated, and may be removed in Python
                                                       3.15.
                                                       
                                                       
 -- の属性: codeobject.co_stacksize                    The required stack size of the code object
                                                       
                                                       
 -- の属性: codeobject.co_flags                        An *note integer: 19b. encoding a number of flags
                                                       for the interpreter.
                                                       

The following flag bits are defined for *note co_flags: 18db.: bit
‘0x04’ is set if the function uses the ‘*arguments’ syntax to accept an
arbitrary number of positional arguments; bit ‘0x08’ is set if the
function uses the ‘**keywords’ syntax to accept arbitrary keyword
arguments; bit ‘0x20’ is set if the function is a generator.  See *note
Code Objects Bit Flags: 2392. for details on the semantics of each flags
that might be present.

Future feature declarations (for example, ‘from __future__ import
division’) also use bits in *note co_flags: 18db. to indicate whether a
code object was compiled with a particular feature enabled.  See *note
compiler_flag: 2393.

Other bits in *note co_flags: 18db. are reserved for internal use.

If a code object represents a function and has a docstring, the *note
CO_HAS_DOCSTRING: 2394. bit is set in *note co_flags: 18db. and the
first item in *note co_consts: 189b. is the docstring of the function.


File: python.info,  Node: Methods on code objects,  Prev: Special read-only attributes<2>,  Up: コードオブジェクト

4.3.2.39 Methods on code objects
................................

 -- メソッド: codeobject.co_positions ()

     Returns an iterable over the source code positions of each *note
     bytecode: 4aa. instruction in the code object.

     The iterator returns *note tuple: 614.s containing the
     ‘(start_line, end_line, start_column, end_column)’.  The 'i-th'
     tuple corresponds to the position of the source code that compiled
     to the 'i-th' code unit.  Column information is 0-indexed utf-8
     byte offsets on the given source line.

     This positional information can be missing.  A non-exhaustive lists
     of cases where this may happen:

        - Running the interpreter with *note -X: 16f. ‘no_debug_ranges’.

        - Loading a pyc file compiled while using *note -X: 16f.
          ‘no_debug_ranges’.

        - Position tuples corresponding to artificial instructions.

        - Line and column numbers that can't be represented due to
          implementation specific limitations.

     When this occurs, some or all of the tuple elements can be *note
     None: 885.

     Added in version 3.11.

          注釈: This feature requires storing column positions in code
          objects which may result in a small increase of disk usage of
          compiled Python files or interpreter memory usage.  To avoid
          storing the extra information and/or deactivate printing the
          extra traceback information, the *note -X: 16f.
          ‘no_debug_ranges’ command line flag or the *note
          PYTHONNODEBUGRANGES: 7d3. environment variable can be used.

 -- メソッド: codeobject.co_lines ()

     Returns an iterator that yields information about successive ranges
     of *note bytecode: 4aa.s.  Each item yielded is a ‘(start, end,
     lineno)’ *note tuple: 614.:

        * ‘start’ (an *note int: 19b.) represents the offset (inclusive)
          of the start of the *note bytecode: 4aa. range

        * ‘end’ (an *note int: 19b.) represents the offset (exclusive)
          of the end of the *note bytecode: 4aa. range

        * ‘lineno’ is an *note int: 19b. representing the line number of
          the *note bytecode: 4aa. range, or ‘None’ if the bytecodes in
          the given range have no line number

     The items yielded will have the following properties:

        * The first range yielded will have a ‘start’ of 0.

        * The ‘(start, end)’ ranges will be non-decreasing and
          consecutive.  That is, for any pair of *note tuple: 614.s, the
          ‘start’ of the second will be equal to the ‘end’ of the first.

        * No range will be backwards: ‘end >= start’ for all triples.

        * The last *note tuple: 614. yielded will have ‘end’ equal to
          the size of the *note bytecode: 4aa.

     Zero-width ranges, where ‘start == end’, are allowed.  Zero-width
     ranges are used for lines that are present in the source code, but
     have been eliminated by the *note bytecode: 4aa. compiler.

     Added in version 3.10.

     参考
     ....

     PEP 626(1) - Precise line numbers for debugging and other tools.

          The PEP that introduced the ‘co_lines()’ method.

 -- メソッド: codeobject.replace (**kwargs)

     Return a copy of the code object with new values for the specified
     fields.

     Code objects are also supported by the generic function *note
     copy.replace(): 1c0.

     Added in version 3.8.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0626/


File: python.info,  Node: フレーム frame オブジェクト,  Next: トレースバック traceback オブジェクト,  Prev: コードオブジェクト,  Up: 内部型 internal type

4.3.2.40 フレーム (frame) オブジェクト
......................................

Frame objects represent execution frames.  They may occur in *note
traceback objects: cec, and are also passed to registered trace
functions.

* Menu:

* Special read-only attributes: Special read-only attributes<3>.
* Special writable attributes: Special writable attributes<2>.
* Frame object methods::


File: python.info,  Node: Special read-only attributes<3>,  Next: Special writable attributes<2>,  Up: フレーム frame オブジェクト

4.3.2.41 Special read-only attributes
.....................................

 -- の属性: frame.f_back                               Points to the previous stack frame (towards the
                                                       caller), or ‘None’ if this is the bottom stack frame
                                                       
                                                       
 -- の属性: frame.f_code                               The *note code object: 4e6. being executed in this
                                                       frame.  Accessing this attribute raises an
                                                       *note auditing event: 1c6e. ‘object.__getattr__’
                                                       with arguments ‘obj’ and ‘"f_code"’.
                                                       
                                                       
 -- の属性: frame.f_locals                             The mapping used by the frame to look up
                                                       *note local variables: 2346.  If the frame refers to
                                                       an *note optimized scope: 4a1, this may return a
                                                       write-through proxy object.
                                                       
                                                       バージョン 3.13 で変更: Return a proxy for optimized
                                                       scopes.
                                                       
                                                       
 -- の属性: frame.f_globals                            The dictionary used by the frame to look up
                                                       *note global variables: 2346.
                                                       
                                                       
 -- の属性: frame.f_builtins                           The dictionary used by the frame to look up
                                                       *note built-in (intrinsic) names: 2346.
                                                       
                                                       
 -- の属性: frame.f_lasti                              The "precise instruction" of the frame object (this
                                                       is an index into the *note bytecode: 4aa. string of
                                                       the *note code object: 4e6.)
                                                       
                                                       
 -- の属性: frame.f_generator                          The *note generator: 126c. or *note coroutine: 6b9.
                                                       object that owns this frame, or ‘None’ if the frame
                                                       is a normal function.
                                                       
                                                       Added in version 3.14.
                                                       


File: python.info,  Node: Special writable attributes<2>,  Next: Frame object methods,  Prev: Special read-only attributes<3>,  Up: フレーム frame オブジェクト

4.3.2.42 Special writable attributes
....................................

 -- の属性: frame.f_trace                              If not ‘None’, this is a function called for various
                                                       events during code execution (this is used by
                                                       debuggers).  Normally an event is triggered for each
                                                       new source line (see *note f_trace_lines: dd6.).
                                                       
                                                       
 -- の属性: frame.f_trace_lines                        Set this attribute to *note False: d2b. to disable
                                                       triggering a tracing event for each source line.
                                                       
                                                       
 -- の属性: frame.f_trace_opcodes                      Set this attribute to *note True: e07. to allow
                                                       per-opcode events to be requested.  Note that this
                                                       may lead to undefined interpreter behaviour if
                                                       exceptions raised by the trace function escape to
                                                       the function being traced.
                                                       
                                                       
 -- の属性: frame.f_lineno                             The current line number of the frame - writing to
                                                       this from within a trace function jumps to the given
                                                       line (only for the bottom-most frame).  A debugger
                                                       can implement a Jump command (aka Set Next
                                                       Statement) by writing to this attribute.
                                                       


File: python.info,  Node: Frame object methods,  Prev: Special writable attributes<2>,  Up: フレーム frame オブジェクト

4.3.2.43 Frame object methods
.............................

フレームオブジェクトはメソッドを一つサポートします:

 -- メソッド: frame.clear ()

     This method clears all references to *note local variables: 2346.
     held by the frame.  Also, if the frame belonged to a *note
     generator: 126c, the generator is finalized.  This helps break
     reference cycles involving frame objects (for example when catching
     an *note exception: 1c27. and storing its *note traceback: cec. for
     later use).

     *note RuntimeError: 244. is raised if the frame is currently
     executing or suspended.

     Added in version 3.4.

     バージョン 3.13 で変更: Attempting to clear a suspended frame
     raises *note RuntimeError: 244. (as has always been the case for
     executing frames).


File: python.info,  Node: トレースバック traceback オブジェクト,  Next: スライス slice オブジェクト,  Prev: フレーム frame オブジェクト,  Up: 内部型 internal type

4.3.2.44 トレースバック (traceback) オブジェクト
................................................

Traceback objects represent the stack trace of an *note exception: 2072.
A traceback object is implicitly created when an exception occurs, and
may also be explicitly created by calling *note types.TracebackType:
cea.

バージョン 3.7 で変更: Traceback objects can now be explicitly
instantiated from Python code.

For implicitly created tracebacks, when the search for an exception
handler unwinds the execution stack, at each unwound level a traceback
object is inserted in front of the current traceback.  When an exception
handler is entered, the stack trace is made available to the program.
(See section *note try 文: 8f8.)  It is accessible as the third item of
the tuple returned by *note sys.exc_info(): 89a, and as the *note
__traceback__: 14de. attribute of the caught exception.

When the program contains no suitable handler, the stack trace is
written (nicely formatted) to the standard error stream; if the
interpreter is interactive, it is also made available to the user as
*note sys.last_traceback: 6e8.

For explicitly created tracebacks, it is up to the creator of the
traceback to determine how the *note tb_next: ceb. attributes should be
linked to form a full stack trace.

Special read-only attributes:

 -- の属性: traceback.tb_frame                         Points to the execution *note frame: 8ef. of the
                                                       current level.
                                                       
                                                       Accessing this attribute raises an
                                                       *note auditing event: 1c6e. ‘object.__getattr__’
                                                       with arguments ‘obj’ and ‘"tb_frame"’.
                                                       
                                                       
 -- の属性: traceback.tb_lineno                        Gives the line number where the exception occurred
                                                       
                                                       
 -- の属性: traceback.tb_lasti                         Indicates the "precise instruction".
                                                       

The line number and last instruction in the traceback may differ from
the line number of its *note frame object: 8ef. if the exception
occurred in a *note try: 8f8. statement with no matching except clause
or with a *note finally: 1b0. clause.

 -- の属性: traceback.tb_next

     The special writable attribute ‘tb_next’ is the next level in the
     stack trace (towards the frame where the exception occurred), or
     ‘None’ if there is no next level.

     バージョン 3.7 で変更: This attribute is now writable


File: python.info,  Node: スライス slice オブジェクト,  Next: 静的メソッド static method オブジェクト,  Prev: トレースバック traceback オブジェクト,  Up: 内部型 internal type

4.3.2.45 スライス (slice) オブジェクト
......................................

スライスオブジェクトは、 *note __getitem__(): 588. メソッドのためのスラ
イスを表すのに使われます。スライスオブジェクトは組み込みの *note
slice(): 694. 関数でも生成されます。

読み出し専用の特殊属性: *note start: 23a5. は下限です; *note stop: 23a6.
は上限です; *note step: 23a7. はステップの値です; それぞれ省略された場合
は ‘None’ となっています。これらの属性は任意の型を持てます。

スライスオブジェクトはメソッドを一つサポートします:

 -- メソッド: slice.indices (self, length)

     このメソッドは単一の整数引数 'length' を取り、スライスオブジェクト
     が 'length' 要素のシーケンスに適用されたときに表現する、スライスに
     関する情報を計算します。このメソッドは 3 つの整数からなるタプルを返
     します; それぞれ 'start' および 'stop' のインデックスと、'step' す
     なわちスライスのまたぎ幅です。インデックス値がないか、範囲外の値で
     あれば、通常のスライスと変わらないやりかたで扱われます。


File: python.info,  Node: 静的メソッド static method オブジェクト,  Next: クラスメソッドオブジェクト,  Prev: スライス slice オブジェクト,  Up: 内部型 internal type

4.3.2.46 静的メソッド (static method) オブジェクト
..................................................

静的メソッドは、上で説明したような関数オブジェクトからメソッドオブジェク
トへの変換を阻止するための方法を提供します。静的メソッドオブジェクトは他
の何らかのオブジェクト、通常はユーザ定義メソッドオブジェクトを包むラッパ
です。静的メソッドをクラスやクラスインスタンスから取得すると、実際に返さ
れるオブジェクトはラップされたオブジェクトになり、それ以上は変換の対象に
はなりません。静的メソッドオブジェクトは通常呼び出し可能なオブジェクトを
ラップしますが、静的オブジェクト自体は呼び出し可能です。静的オブジェクト
は組み込みコンストラクタ *note staticmethod(): 453. で生成されます。


File: python.info,  Node: クラスメソッドオブジェクト,  Prev: 静的メソッド static method オブジェクト,  Up: 内部型 internal type

4.3.2.47 クラスメソッドオブジェクト
...................................

A class method object, like a static method object, is a wrapper around
another object that alters the way in which that object is retrieved
from classes and class instances.  The behaviour of class method objects
upon such retrieval is described above, under *note "instance methods":
20a7.  Class method objects are created by the built-in *note
classmethod(): 48e. constructor.


File: python.info,  Node: 特殊メソッド名,  Next: コルーチン,  Prev: 標準型の階層,  Up: データモデル

4.3.3 特殊メソッド名
--------------------

クラスは、特殊な名前のメソッドを定義して、特殊な構文 (算術演算や添え字表
記、スライス表記など) による特定の演算を実装できます。これは、Python の
演算子オーバロード ('operator overloading') へのアプローチです。これによ
り、クラスは言語の演算子に対する独自の振る舞いを定義できます。例えば、あ
るクラスが *note __getitem__(): 588. という名前のメソッドを定義しており
、 ‘x’ がこのクラスのインスタンスであるとすると、 ‘x[i]’ は
‘type(x).__getitem__(x, i)’ とほぼ等価です。特に注釈のない限り、適切なメ
ソッドが定義されていないとき、このような演算を試みると例外 (たいていは
*note AttributeError: 5f0. か *note TypeError: 198.) が送出されます。

特殊メソッドに ‘None’ を設定することは、それに対応する演算が利用できない
ことを意味します。 例えば、クラスの *note __iter__(): e69. を ‘None’ に
設定した場合、そのクラスはイテラブルにはならず、そのインスタンスに対し
*note iter(): 9d7. を呼び出すと (*note __getitem__(): 588. に処理が戻さ
れずに) *note TypeError: 198. を送出します。 (1)

When implementing a class that emulates any built-in type, it is
important that the emulation only be implemented to the degree that it
makes sense for the object being modelled.  For example, some sequences
may work well with retrieval of individual elements, but extracting a
slice may not make sense.  (One example of this is the *note NodeList:
23ab. interface in the W3C's Document Object Model.)

* Menu:

* 基本的なカスタマイズ::
* 属性値アクセスをカスタマイズする::
* クラス生成をカスタマイズする::
* インスタンスのカスタマイズとサブクラスチェック::
* ジェネリック型をエミュレートする::
* 呼び出し可能オブジェクトをエミュレートする::
* コンテナをエミュレートする::
* 数値型をエミュレートする::
* with文とコンテキストマネージャ::
* クラスパターンマッチの位置引数のカスタマイズ::
* Emulating buffer types::
* Annotations::
* 特殊メソッド検索::

   ---------- Footnotes ----------

   (1) The *note __hash__(): cf3, *note __iter__(): e69, *note
__reversed__(): e86, *note __contains__(): 15d3, *note
__class_getitem__(): 943. and *note __fspath__(): e4c. methods have
special handling for this.  Others will still raise a *note TypeError:
198, but may do so by relying on the behavior that ‘None’ is not
callable.


File: python.info,  Node: 基本的なカスタマイズ,  Next: 属性値アクセスをカスタマイズする,  Up: 特殊メソッド名

4.3.3.1 基本的なカスタマイズ
............................

 -- メソッド: object.__new__ (cls[, ...])

     クラス 'cls' の新しいインスタンスを作るために呼び出されます。 *note
     __new__(): 7a0. は静的メソッドで (このメソッドは特別扱いされている
     ので、明示的に静的メソッドと宣言する必要はありません)、インスタンス
     を生成するよう要求されているクラスを第一引数にとります。残りの引数
     はオブジェクトのコンストラクタの式 (クラスの呼び出し文) に渡されま
     す。 *note __new__(): 7a0. の戻り値は新しいオブジェクトのインスタン
     ス (通常は 'cls' のインスタンス) でなければなりません。

     典型的な実装では、クラスの新たなインスタンスを生成するときには
     ‘super().__new__(cls[, ...])’ に適切な引数を指定してスーパクラスの
     *note __new__(): 7a0. メソッドを呼び出し、新たに生成されたインスタ
     ンスに必要な変更を加えてから返します。

     もし *note __new__(): 7a0. が オブジェクトの作成中に呼び出され、
     'cls' のインスタンスを返した場合には、 ‘__init__(self[, ...])’ のよ
     うにして新しいインスタンスの *note __init__(): 8bf. が呼び出されま
     す。このとき、 'self' は新たに生成されたインスタンスで、残りの引数
     はオブジェクトコンストラクタに渡された引数と同じになります。

     *note __new__(): 7a0. が 'cls' のインスタンスを返さない場合、インス
     タンスの *note __init__(): 8bf. メソッドは呼び出されません。

     *note __new__(): 7a0. の主な目的は、変更不能な型 (int, str, tuple な
     ど) のサブクラスでインスタンス生成をカスタマイズすることにあります
     。また、クラス生成をカスタマイズするために、カスタムのメタクラスで
     よくオーバーライドされます。

 -- メソッド: object.__init__ (self[, ...])

     インスタンスが (*note __new__(): 7a0. によって) 生成された後、それ
     が呼び出し元に返される前に呼び出されます。引数はクラスのコンストラ
     クタ式に渡したものです。基底クラスとその派生クラスがともに *note
     __init__(): 8bf. メソッドを持つ場合、派生クラスの *note __init__():
     8bf. メソッドは基底クラスの *note __init__(): 8bf. メソッドを明示的
     に呼び出して、インスタンスの基底クラス部分が適切に初期化されること
     保証しなければなりません。例えば、 ‘super().__init__([args...])’ 。

     *note __new__(): 7a0. と *note __init__(): 8bf. は連携してオブジェ
     クトを構成する (*note __new__(): 7a0. が作成し、 *note __init__():
     8bf. がそれをカスタマイズする) ので、 *note __init__(): 8bf. から非
     ‘None’ 値を返してはいけません; そうしてしまうと、実行時に *note
     TypeError: 198. が送出されてしまいます。

 -- メソッド: object.__del__ (self)

     インスタンスが破棄されるときに呼び出されます。 これはファイナライザ
     や (適切ではありませんが) デストラクタとも呼ばれます。 基底クラスが
     *note __del__(): 11ff. メソッドを持っている場合は、派生クラスの
     *note __del__(): 11ff. メソッドは何であれ、基底クラスの *note
     __del__(): 11ff. メソッドを明示的に呼び出して、インスタンスの基底ク
     ラス部分をきちんと確実に削除しなければなりません。

     *note __del__(): 11ff. メソッドが破棄しようとしているインスタンスへ
     の新しい参照を作り、破棄を送らせることは (推奨されないものの) 可能
     です。 これはオブジェクトの '復活' と呼ばれます。 復活したオブジェ
     クトが再度破棄される直前に *note __del__(): 11ff. が呼び出されるか
     どうかは実装依存です; 現在の *note CPython: 905. の実装では最初の一
     回しか呼び出されません。

     It is not guaranteed that *note __del__(): 11ff. methods are called
     for objects that still exist when the interpreter exits.  *note
     weakref.finalize: c6f. provides a straightforward way to register a
     cleanup function to be called when an object is garbage collected.

          注釈: ‘del x’ は直接 ‘x.__del__()’ を呼び出しません -- 前者は
          ‘x’ の参照カウントを 1 つ減らし、後者は ‘x’ の参照カウントが 0
          まで落ちたときのみ呼び出されます。

     'CPython 実装の詳細:' It is possible for a reference cycle to
     prevent the reference count of an object from going to zero.  In
     this case, the cycle will be later detected and deleted by the
     *note cyclic garbage collector: 17d8.  A common cause of reference
     cycles is when an exception has been caught in a local variable.
     The frame's locals then reference the exception, which references
     its own traceback, which references the locals of all frames caught
     in the traceback.

     参考
     ....

     *note gc: 64. モジュールのドキュメント。

          警告: メソッド *note __del__(): 11ff. は不安定な状況で呼び出さ
          れるため、実行中に発生した例外は無視され、代わりに
          ‘sys.stderr’ に警告が表示されます。特に:

             * *note __del__(): 11ff. は、任意のコードが実行されていると
               きに、任意のスレッドから呼び出せます。 *note __del__():
               11ff. で、ロックを取ったり、ブロックするリソースを呼び出
               したりする必要がある場合、 *note __del__(): 11ff. の実行
               により中断されたコードにより、そのリソースが既に取得され
               ていて、デッドロックが起きるかもしれません。

             * *note __del__(): 11ff. は、インタプリタのシャットダウン中
               に実行できます。 従って、(他のモジュールも含めた) アクセ
               スする必要があるグローバル変数はすでに削除されているか、
               ‘None’ に設定されているかもしれません。 Python は、単一の
               アンダースコアで始まる名前のグローバルオブジェクトは、他
               のグローバル変数が削除される前にモジュールから削除される
               ことを保証します; そのようなグローバル変数への他からの参
               照が存在しない場合、*note __del__(): 11ff. メソッドが呼ば
               れた時点で、インポートされたモジュールがまだ利用可能であ
               ることを保証するのに役立つかもしれません。

 -- メソッド: object.__repr__ (self)

     *note repr(): 1c1. 組み込み関数によって呼び出され、オブジェクトを表
     す「公式の (official)」文字列を計算します。可能なら、これは (適切な
     環境が与えられれば) 同じ値のオブジェクトを再生成するのに使える、有
     効な Python 式のようなものであるべきです。できないなら、 ‘<...some
     useful description...>’ 形式の文字列が返されるべきです。戻り値は文
     字列オブジェクトでなければなりません。クラスが *note __repr__():
     82f. を定義していて *note __str__(): 830. は定義していなければ、そ
     のクラスのインスタンスの「非公式の (informal)」文字列表現が要求され
     たときにも *note __repr__(): 82f. が使われます。

     This is typically used for debugging, so it is important that the
     representation is information-rich and unambiguous.  A default
     implementation is provided by the *note object: c7e. class itself.

 -- メソッド: object.__str__ (self)

     Called by *note str(object): 169, the default *note __format__():
     831. implementation, and the built-in function *note print(): 1177,
     to compute the "informal" or nicely printable string representation
     of an object.  The return value must be a *note str: 1fe0. object.

     *note __str__(): 830. が有効な Python 表現を返すことが期待されない
     という点で、このメソッドは *note object.__repr__(): 82f. とは異なり
     ます: より便利な、または簡潔な表現を使用することができます。

     組み込み型 *note object: c7e. によって定義されたデフォルト実装は、
     *note object.__repr__(): 82f. を呼び出します。

 -- メソッド: object.__bytes__ (self)

     Called by *note bytes: 1e9a. to compute a byte-string
     representation of an object.  This should return a *note bytes:
     192. object.  The *note object: c7e. class itself does not provide
     this method.

 -- メソッド: object.__format__ (self, format_spec)

     *note format(): 199. 組み込み関数、さらには *note
     フォーマット済み文字列リテラル: 19a. の評価、 *note str.format():
     833. メソッドによって呼び出され、オブジェクトの "フォーマット化され
     た (formatted)" 文字列表現を作ります。 'format_spec' 引数は、 必要
     なフォーマット化オプションの記述を含む文字列です。 'format_spec' 引
     数の解釈は、 *note __format__(): 831. を実装する型によりますが、 ほ
     とんどのクラスは組み込み型のいずれかにフォーマット化を委譲したり、
     同じようなフォーマット化オプション構文を使います。

     標準のフォーマット構文の解説は、 *note 書式指定ミニ言語仕様: 4f9. を
     参照してください。

     戻り値は文字列オブジェクトでなければなりません。

     The default implementation by the *note object: c7e. class should
     be given an empty 'format_spec' string.  It delegates to *note
     __str__(): 830.

     バージョン 3.4 で変更: 空でない文字列が渡された場合 ‘object’ 自身の
     __format__ メソッドは *note TypeError: 198. を送出します。

     バージョン 3.7 で変更: ‘object.__format__(x, '')’ は
     ‘format(str(x), '')’ ではなく ‘str(x)’ と等価になりました。

 -- メソッド: object.__lt__ (self, other)
 -- メソッド: object.__le__ (self, other)
 -- メソッド: object.__eq__ (self, other)
 -- メソッド: object.__ne__ (self, other)
 -- メソッド: object.__gt__ (self, other)
 -- メソッド: object.__ge__ (self, other)

     これらはいわゆる "拡張比較 (rich comparison)" メソッドです。演算子
     シンボルとメソッド名の対応は以下の通りです: ‘x<y’ は ‘x.__lt__(y)’
     を呼び出します; ‘x<=y’ は ‘x.__le__(y)’ を呼び出します; ‘x==y’ は
     ‘x.__eq__(y)’ を呼び出します; ‘x!=y’ は ‘x.__ne__(y)’ を呼び出しま
     す; ‘x>y’ は ‘x.__gt__(y)’ を呼び出します; ‘x>=y’ は ‘x.__ge__(y)’
     を呼び出します。

     A rich comparison method may return the singleton *note
     NotImplemented: 1a2. if it does not implement the operation for a
     given pair of arguments.  By convention, ‘False’ and ‘True’ are
     returned for a successful comparison.  However, these methods can
     return any value, so if the comparison operator is used in a
     Boolean context (e.g., in the condition of an ‘if’ statement),
     Python will call *note bool(): 3c3. on the value to determine if
     the result is true or false.

     By default, ‘object’ implements *note __eq__(): cf2. by using ‘is’,
     returning *note NotImplemented: 1a2. in the case of a false
     comparison: ‘True if x is y else NotImplemented’.  For *note
     __ne__(): 1730, by default it delegates to *note __eq__(): cf2. and
     inverts the result unless it is ‘NotImplemented’.  There are no
     other implied relationships among the comparison operators or
     default implementations; for example, the truth of ‘(x<y or x==y)’
     does not imply ‘x<=y’.  To automatically generate ordering
     operations from a single root operation, see *note
     functools.total_ordering(): 1144.

     By default, the *note object: c7e. class provides implementations
     consistent with *note 値の比較: 1c20.: equality compares according
     to object identity, and order comparisons raise *note TypeError:
     198.  Each default method may generate these results directly, but
     may also return *note NotImplemented: 1a2.

     カスタムの比較演算をサポートしていて、辞書のキーに使うことができる
     *note ハッシュ可能: 824. オブジェクトを作るときの重要な注意点につい
     て、 *note __hash__(): cf3. のドキュメント内に書かれているので参照
     してください。

     There are no swapped-argument versions of these methods (to be used
     when the left argument does not support the operation but the right
     argument does); rather, *note __lt__(): 14b8. and *note __gt__():
     1523. are each other's reflection, *note __le__(): 1522. and *note
     __ge__(): 1524. are each other's reflection, and *note __eq__():
     cf2. and *note __ne__(): 1730. are their own reflection.  If the
     operands are of different types, and the right operand's type is a
     direct or indirect subclass of the left operand's type, the
     reflected method of the right operand has priority, otherwise the
     left operand's method has priority.  Virtual subclassing is not
     considered.

     When no appropriate method returns any value other than *note
     NotImplemented: 1a2, the ‘==’ and ‘!=’ operators will fall back to
     ‘is’ and ‘is not’, respectively.

 -- メソッド: object.__hash__ (self)

     組み込みの *note hash(): 801. 関数や、 *note set: 184, *note
     frozenset: 7f2, *note dict: 183. のようなハッシュを使ったコレクショ
     ン型の要素に対する操作から呼び出されます。 ‘__hash__()’ メソッドは
     整数を返さなければなりません。 このメソッドに必要な性質は、比較結果
     が等しいオブジェクトは同じハッシュ値を持つということです; オブジェ
     クトを比較するときでも利用される要素をタプルに詰めてハッシュ値を計
     算することで、それぞれの要素のハッシュ値を混合することをおすすめし
     ます。

          def __hash__(self):
              return hash((self.name, self.nick, self.color))

          注釈: *note hash(): 801. はオブジェクト独自の *note
          __hash__(): cf3. メソッドが返す値を *note Py_ssize_t: c55. の
          サイズに切り詰めます。 これは 64-bit でビルドされていると 8 バ
          イトで、 32-bit でビルドされていると 4 バイトです。 オブジェク
          トの *note __hash__(): cf3. が異なる bit サイズのビルドでも可
          搬性が必要である場合は、必ず全てのサポートするビルドの bit 幅
          をチェックしてください。 そうする簡単な方法は ‘python -c
          "import sys; print(sys.hash_info.width)"’ を実行することです。

     クラスが *note __eq__(): cf2. メソッドを定義していないなら、 *note
     __hash__(): cf3. メソッドも定義してはなりません; クラスが *note
     __eq__(): cf2. を定義していても *note __hash__(): cf3. を定義してい
     ないなら、そのインスタンスはハッシュ可能コレクションの要素として使
     えません。クラスがミュータブルなオブジェクトを定義しており、 *note
     __eq__(): cf2. メソッドを実装しているなら、 *note __hash__(): cf3.
     を定義してはなりません。これは、*note ハッシュ可能: 824. コレクショ
     ンの実装においてキーのハッシュ値がイミュータブルであることが要求さ
     れているからです (オブジェクトのハッシュ値が変化すると、誤ったハッ
     シュバケツ: hash bucket に入ってしまいます)。

     User-defined classes have *note __eq__(): cf2. and *note
     __hash__(): cf3. methods by default (inherited from the *note
     object: c7e. class); with them, all objects compare unequal (except
     with themselves) and ‘x.__hash__()’ returns an appropriate value
     such that ‘x == y’ implies both that ‘x is y’ and ‘hash(x) ==
     hash(y)’.

     *note __eq__(): cf2. をオーバーライドしていて *note __hash__():
     cf3. を定義していないクラスでは、 *note __hash__(): cf3. は暗黙的に
     ‘None’ に設定されます。 クラスの *note __hash__(): cf3. メソッドが
     ‘None’ の場合、そのクラスのインスタンスのハッシュ値を取得しようとす
     ると適切な *note TypeError: 198. が送出され、 ‘isinstance(obj,
     collections.abc.Hashable)’ でチェックするとハッシュ不能なものとして
     正しく認識されます。

     *note __eq__(): cf2. をオーバーライドしたクラスが親クラスからの
     *note __hash__(): cf3. の 実装を保持したいなら、明示的に ‘__hash__
     = <ParentClass>.__hash__’ を設定することで、それをインタプリタに伝
     えなければなりません。

     *note __eq__(): cf2. をオーバーライドしていないクラスがハッシュサポ
     ートを抑制したい場合、クラス定義に ‘__hash__ = None’ を含めてくださ
     い。クラス自身で明示的に *note TypeError: 198. を送出する *note
     __hash__(): cf3. を定義すると、 ‘isinstance(obj,
     collections.abc.Hashable)’ 呼び出しで誤ってハッシュ可能と識別される
     でしょう。

          注釈: デフォルトでは、文字列とバイト列の *note __hash__():
          cf3. 値は予測不可能なランダム値で "ソルト" されます。 ハッシュ
          値は単独の Python プロセス内では定数であり続けますが、Python を
          繰り返し起動する毎に、予測できなくなります。

          This is intended to provide protection against a
          denial-of-service caused by carefully chosen inputs that
          exploit the worst case performance of a dict insertion,
          'O'('n'^2) complexity.  See
          ‘http://ocert.org/advisories/ocert-2011-003.html’ for details.

          ハッシュ値の変更は、集合のイテレーション順序に影響します。
          Python はこの順序付けを保証していません (そして通常 32-bit と
          64-bit の間でも異なります)。

          *note PYTHONHASHSEED: 1289. も参照してください。

     バージョン 3.3 で変更: ハッシュのランダム化がデフォルトで有効になり
     ました。

 -- メソッド: object.__bool__ (self)

     Called to implement truth value testing and the built-in operation
     ‘bool()’; should return ‘False’ or ‘True’.  When this method is not
     defined, *note __len__(): 178f. is called, if it is defined, and
     the object is considered true if its result is nonzero.  If a class
     defines neither ‘__len__()’ nor ‘__bool__()’ (which is true of the
     *note object: c7e. class itself), all its instances are considered
     true.


File: python.info,  Node: 属性値アクセスをカスタマイズする,  Next: クラス生成をカスタマイズする,  Prev: 基本的なカスタマイズ,  Up: 特殊メソッド名

4.3.3.2 属性値アクセスをカスタマイズする
........................................

以下のメソッドを定義して、クラスインスタンスへの属性アクセス ( ‘x.name’
の使用、 ‘x.name’ への代入、 ‘x.name’ の削除) の意味をカスタマイズするこ
とができます。

 -- メソッド: object.__getattr__ (self, name)

     Called when the default attribute access fails with an *note
     AttributeError: 5f0. (either *note __getattribute__(): dcb. raises
     an *note AttributeError: 5f0. because 'name' is not an instance
     attribute or an attribute in the class tree for ‘self’; or *note
     __get__(): 1701. of a 'name' property raises *note AttributeError:
     5f0.).  This method should either return the (computed) attribute
     value or raise an *note AttributeError: 5f0. exception.  The *note
     object: c7e. class itself does not provide this method.

     Note that if the attribute is found through the normal mechanism,
     *note __getattr__(): 6fa. is not called.  (This is an intentional
     asymmetry between *note __getattr__(): 6fa. and *note
     __setattr__(): 237c.)  This is done both for efficiency reasons and
     because otherwise *note __getattr__(): 6fa. would have no way to
     access other attributes of the instance.  Note that at least for
     instance variables, you can take total control by not inserting any
     values in the instance attribute dictionary (but instead inserting
     them in another object).  See the *note __getattribute__(): dcb.
     method below for a way to actually get total control over attribute
     access.

 -- メソッド: object.__getattribute__ (self, name)

     クラスのインスタンスに対する属性アクセスを実装するために、無条件に
     呼び出されます。クラスが *note __getattr__(): 6fa. も定義している場
     合、 *note __getattr__(): 6fa. は、 *note __getattribute__(): dcb.
     で明示的に呼び出すか、 *note AttributeError: 5f0. 例外を送出しない
     限り呼ばれません。このメソッドは (計算された) 属性値を返すか、
     *note AttributeError: 5f0. 例外を送出します。このメソッドが再帰的に
     際限なく呼び出されてしまうのを防ぐため、実装の際には常に、必要な属
     性全てへのアクセスで、例えば ‘object.__getattribute__(self, name)’
     のように基底クラスのメソッドを同じ属性名を使って呼び出さなければな
     りません。

          注釈: This method may still be bypassed when looking up
          special methods as the result of implicit invocation via
          language syntax or *note built-in functions: 234e.  See *note
          特殊メソッド検索: 23b1.

     セキュリティに関わるような ‘obj’ と ‘name’ を渡しての
     ‘object.__getattr__’ を使った属性アクセスは *note 監査イベント:
     1c6e. を送出します。

 -- メソッド: object.__setattr__ (self, name, value)

     属性の代入が試みられた際に呼び出されます。これは通常の代入の過程 (す
     なわち、インスタンス辞書への値の代入) の代わりに呼び出されます。
     'name' は属性名で、'value' はその属性に代入する値です。

     *note __setattr__(): 237c. の中でインスタンス属性への代入が必要なら
     、基底クラスのこれと同じ名前のメソッドを呼び出さなければなりません
     。例えば、 ‘object.__setattr__(self, name, value)’ とします。

     セキュリティに関わるような ‘obj’ と ‘name’ と ‘value’ を渡しての
     ‘object.__setattr__’ を使った属性のアサインは *note 監査イベント:
     1c6e. を送出します。

 -- メソッド: object.__delattr__ (self, name)

     *note __setattr__(): 237c. に似ていますが、代入ではなく値の削除を行
     います。このメソッドを実装するのは、オブジェクトにとって ‘del
     obj.name’ が意味がある場合だけにしなければなりません。

     セキュリティに関わるような ‘obj’ と ‘name’ を渡しての
     ‘object.__getattr__’ を使った属性の削除は *note 監査イベント: 1c6e.
     を送出します。

 -- メソッド: object.__dir__ (self)

     Called when *note dir(): 844. is called on the object.  An iterable
     must be returned.  *note dir(): 844. converts the returned iterable
     to a list and sorts it.

* Menu:

* モジュールの属性値アクセスをカスタマイズする::
* デスクリプタ (descriptor) の実装: デスクリプタ descriptor の実装.
* デスクリプタの呼び出し::
* __slots__: __slots__<2>.


File: python.info,  Node: モジュールの属性値アクセスをカスタマイズする,  Next: デスクリプタ descriptor の実装,  Up: 属性値アクセスをカスタマイズする

4.3.3.3 モジュールの属性値アクセスをカスタマイズする
....................................................

 -- メソッド: module.__getattr__ ()
 -- メソッド: module.__dir__ ()

特殊な名前の ‘__getattr__’ と ‘__dir__’ も、モジュール属性へのアクセスを
カスタマイズするのに使えます。 モジュールレベルの ‘__getattr__’ 関数は属
性名である 1 引数を受け取り、計算した値を返すか *note AttributeError:
5f0. を送出します。 属性がモジュールオブジェクトから、通常の検索、つまり
*note object.__getattribute__(): dcb. で見付からなかった場合は、 *note
AttributeError: 5f0. を送出する前に、モジュールの ‘__dict__’ から
‘__getattr__’ が検索されます。 見付かった場合は、その属性名で呼び出され
、結果が返されます。

The ‘__dir__’ function should accept no arguments, and return an
iterable of strings that represents the names accessible on module.  If
present, this function overrides the standard *note dir(): 844. search
on a module.

 -- の属性: module.__class__

より細かい粒度でのモジュールの動作 (属性やプロパティの設定など) のカスタ
マイズのために、モジュールオブジェクトの ‘__class__’ 属性に *note
types.ModuleType: 1014. のサブクラスが設定できます。 例えば次のようにな
ります:

     import sys
     from types import ModuleType

     class VerboseModule(ModuleType):
         def __repr__(self):
             return f'Verbose {self.__name__}'

         def __setattr__(self, attr, value):
             print(f'Setting {attr}...')
             super().__setattr__(attr, value)

     sys.modules[__name__].__class__ = VerboseModule

     注釈: モジュールの ‘__getattr__’ を定義したり ‘__class__’ を設定し
     たりしても、影響があるのは属性アクセスの構文が使われる検索だけです
     - モジュールの globals への直接アクセスは (モジュール内のコードから
     とモジュールの globals のどちらでも) 影響を受けません。

バージョン 3.5 で変更: モジュールの属性 ‘__class__’ が書き込み可能になり
ました。

Added in version 3.7: ‘__getattr__’ モジュール属性と ‘__dir__’ モジュー
ル属性。

参考
....

PEP 562(1) - モジュールの __getattr__ と __dir__

     モジュールの ‘__getattr__’ 関数および ‘__dir__’ 関数の説明。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0562/


File: python.info,  Node: デスクリプタ descriptor の実装,  Next: デスクリプタの呼び出し,  Prev: モジュールの属性値アクセスをカスタマイズする,  Up: 属性値アクセスをカスタマイズする

4.3.3.4 デスクリプタ (descriptor) の実装
........................................

The following methods only apply when an instance of the class
containing the method (a so-called 'descriptor' class) appears in an
'owner' class (the descriptor must be in either the owner's class
dictionary or in the class dictionary for one of its parents).  In the
examples below, "the attribute" refers to the attribute whose name is
the key of the property in the owner class' *note __dict__: 77d.  The
*note object: c7e. class itself does not implement any of these
protocols.

 -- メソッド: object.__get__ (self, instance, owner=None)

     オーナークラス（クラス属性アクセスの場合）や、クラスのインスタンス
     （インスタンス属性アクセスの場合）の属性取得時に呼び出されます。
     'instance' を通じて属性をアクセスする時に、オプションの 'owner' 引
     数はオーナークラスです。 'owner' を通じて属性アクセスするときは
     ‘None’ です。

     このメソッドは、算出された属性値を返すか、 *note AttributeError:
     5f0. 例外を送出します。

     PEP 252(1) は *note __get__(): 1701. は1つや2つの引数を持つ呼び出し
     可能オブジェクトであると定義しています。Pythonの組み込みのデスクリ
     プタはこの仕様をサポートしていますが、サードパーティ製のツールの中
     には両方の引数を必要とするものもあります。Pythonの *note
     __getattribute__(): dcb. 実装は必要かどうかに関わらず、両方の引数を
     常に渡します。

 -- メソッド: object.__set__ (self, instance, value)

     オーナークラスのインスタンス 'instance' 上の属性を新たな値 'value'
     に設定する際に呼び出されます。

     *note __set__(): 23b5. あるいは *note __delete__(): 194f. を追加す
     ると、デスクリプタは「データデスクリプタ」に変わります。詳細は
     *note デスクリプタの呼び出し: 23b6. を参照してください。

 -- メソッド: object.__delete__ (self, instance)

     オーナークラスのインスタンス 'instance' 上の属性を削除する際に呼び
     出されます。

Instances of descriptors may also have the ‘__objclass__’ attribute
present:

 -- の属性: object.__objclass__

     The attribute ‘__objclass__’ is interpreted by the *note inspect:
     82. module as specifying the class where this object was defined
     (setting this appropriately can assist in runtime introspection of
     dynamic class attributes).  For callables, it may indicate that an
     instance of the given type (or a subclass) is expected or required
     as the first positional argument (for example, CPython sets this
     attribute for unbound methods that are implemented in C).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0252/


File: python.info,  Node: デスクリプタの呼び出し,  Next: __slots__<2>,  Prev: デスクリプタ descriptor の実装,  Up: 属性値アクセスをカスタマイズする

4.3.3.5 デスクリプタの呼び出し
..............................

一般にデスクリプタとは、特殊な "束縛に関する動作 (binding behaviour)" を
もつオブジェクト属性のことです。デスクリプタは、デスクリプタプロトコル
(descriptor protocol) のメソッド: *note __get__(): 1701, *note
__set__(): 23b5, および *note __delete__(): 194f. を使って、属性アクセス
をオーバーライドしているものです。これらのメソッドのいずれかがオブジェク
トに対して定義されている場合、オブジェクトはデスクリプタであるといいます
。

属性アクセスのデフォルトの動作は、オブジェクトの辞書から値を取り出したり
、値を設定したり、削除したりするというものです。例えば、 ‘a.x’ による属
性の検索では、まず ‘a.__dict__['x']’ 、次に ‘type(a).__dict__['x']’ 、そ
して ‘type(a)’ の基底クラスでメタクラスでないものに続く、といった具合に
連鎖が起こります。

しかし、検索対象の値が、デスクリプタメソッドのいずれかを定義しているオブ
ジェクトであれば、Python はデフォルトの動作をオーバーライドして、代わり
にデスクリプタメソッドを呼び出します。先述の連鎖の中のどこでデスクリプタ
メソッドが呼び出されるかは、どのデスクリプタメソッドが定義されていて、ど
のように呼び出されたかに依存します。

デスクリプタ呼び出しの基点となるのは、属性名への束縛 (binding) 、すなわ
ち ‘a.x’ です。引数がどのようにデスクリプタに結合されるかは ‘a’ に依存し
ます:

直接呼び出し (Direct Call)

     最も単純で、かつめったに使われない呼び出し操作は、コード中で直接デ
     スクリプタメソッドの呼び出し: ‘x.__get__(a)’ を行うというものです。

インスタンス束縛 (Instance Binding)

     オブジェクトインスタンスへ束縛すると、‘a.x’ は呼び出し
     ‘type(a).__dict__['x'].__get__(a, type(a))’ に変換されます。

クラス束縛 (Class Binding)

     クラスへ束縛すると、‘A.x’ は呼び出し ‘A.__dict__['x'].__get__(None,
     A)’ に変換されます。

super 束縛 (Super Binding)

     ‘super(A, a).x’ のようなドットを使ったルックアップは
     ‘a.__class__.__mro__’ を探索して、 ‘A’ の前のクラス ‘B’ をまず探し
     、 ‘B.__dict__['x'].__get__(a, A)’ を返します。もしデスクリプタでな
     ければ ‘x’ を変更せずに返します。

For instance bindings, the precedence of descriptor invocation depends
on which descriptor methods are defined.  A descriptor can define any
combination of *note __get__(): 1701, *note __set__(): 23b5. and *note
__delete__(): 194f.  If it does not define ‘__get__()’, then accessing
the attribute will return the descriptor object itself unless there is a
value in the object's instance dictionary.  If the descriptor defines
‘__set__()’ and/or ‘__delete__()’, it is a data descriptor; if it
defines neither, it is a non-data descriptor.  Normally, data
descriptors define both ‘__get__()’ and ‘__set__()’, while non-data
descriptors have just the ‘__get__()’ method.  Data descriptors with
‘__get__()’ and ‘__set__()’ (and/or ‘__delete__()’) defined always
override a redefinition in an instance dictionary.  In contrast,
non-data descriptors can be overridden by instances.

Python methods (including those decorated with *note @staticmethod: 453.
and *note @classmethod: 48e.) are implemented as non-data descriptors.
Accordingly, instances can redefine and override methods.  This allows
individual instances to acquire behaviors that differ from other
instances of the same class.

*note property(): 4b3. 関数はデータデスクリプタとして実装されています。
従って、インスタンスはあるプロパティの動作をオーバーライドすることができ
ません。


File: python.info,  Node: __slots__<2>,  Prev: デスクリプタの呼び出し,  Up: 属性値アクセスをカスタマイズする

4.3.3.6 __slots__
.................

'__slots__' を使うと、(プロパティのように) データメンバを明示的に宣言し
、 (明示的に '__slots__' で宣言しているか親クラスに存在しているかでない
限り) *note __dict__: 77d. や '__weakref__' を作成しないようにできます。

*note __dict__: 77d. を使うのに比べて、節約できるメモリ空間はかなり大き
いです。 属性探索のスピードもかなり向上できます。

 -- データ: object.__slots__

     このクラス変数には、インスタンスが用いる変数名を表す、文字列、イテ
     ラブル、または文字列のシーケンスを代入できます。'__slots__' は、各
     インスタンスに対して宣言された変数に必要な記憶領域を確保し、*note
     __dict__: 77d. と '__weakref__' が自動的に生成されないようにします
     。
Notes on using '__slots__':

   * '__slots__' を持たないクラスから継承するとき、インスタンスの *note
     __dict__: 77d. 属性と '__weakref__' 属性は常に利用可能です。

   * *note __dict__: 77d. 変数がない場合、 '__slots__' に列挙されていな
     い新たな変数をインスタンスに代入することはできません。列挙されてい
     ない変数名を使って代入しようとした場合、 *note AttributeError: 5f0.
     が送出されます。新たな変数を動的に代入したいのなら、 '__slots__' を
     宣言する際に ‘'__dict__'’ を変数名のシーケンスに追加してください。

   * '__slots__' を定義しているクラスの各インスタンスに '__weakref__' 変
     数がない場合、インスタンスに対する弱参照 (*note weak references:
     11a.) はサポートされません。弱参照のサポートが必要なら、
     '__slots__' を宣言する際に ‘'__weakref__'’ を変数名のシーケンスに追
     加してください。

   * '__slots__' は、クラスのレベルで各変数に対する *note デスクリプタ:
     e49. を使って実装されます。その結果、 '__slots__' に定義されている
     インスタンス変数のデフォルト値はクラス属性を使って設定できなくなっ
     ています; そうしないと、デスクリプタによる代入をクラス属性が上書き
     してしまうからです。

   * The action of a '__slots__' declaration is not limited to the class
     where it is defined.  '__slots__' declared in parents are available
     in child classes.  However, instances of a child subclass will get
     a *note __dict__: 77d. and '__weakref__' unless the subclass also
     defines '__slots__' (which should only contain names of any
     'additional' slots).

   * あるクラスで、基底クラスですでに定義されているスロットを定義した場
     合、基底クラスのスロットで定義されているインスタンス変数は (デスク
     リプタを基底クラスから直接取得しない限り) アクセスできなくなります
     。これにより、プログラムの趣意が不定になってしまいます。将来は、こ
     の問題を避けるために何らかのチェックが追加されるかもしれません。

   * *note TypeError: 198. will be raised if nonempty '__slots__' are
     defined for a class derived from a *note "variable-length" built-in
     type: 23bb. such as *note int: 19b, *note bytes: 192, and *note
     tuple: 614.

   * Any non-string *note iterable: 12f1. may be assigned to
     '__slots__'.

   * If a *note dictionary: 183. is used to assign '__slots__', the
     dictionary keys will be used as the slot names.  The values of the
     dictionary can be used to provide per-attribute docstrings that
     will be recognised by *note inspect.getdoc(): bed. and displayed in
     the output of *note help(): ad4.

   * *note __class__: 16c6. assignment works only if both classes have
     the same '__slots__'.

   * 複数のスロットを持つ親クラスを使った *note 多重継承: 20a1. はできま
     すが、スロットで作成された属性を持つ親クラスは 1 つに限られます (他
     の基底クラスのスロットは空でなければなりません) - それに違反すると
     *note TypeError: 198. が送出されます。

   * もし '__slots__' に対して *note イテレータ: 4c8. を使用すると、イテ
     レータの値ごとに *note デスクリプタ: 1881. が作られます。しかし、
     '__slots__' 属性は空のイテレータとなります。


File: python.info,  Node: クラス生成をカスタマイズする,  Next: インスタンスのカスタマイズとサブクラスチェック,  Prev: 属性値アクセスをカスタマイズする,  Up: 特殊メソッド名

4.3.3.7 クラス生成をカスタマイズする
....................................

クラスが他のクラスを継承するときに必ず、親クラスの *note
__init_subclass__(): 843. が呼び出されます。これを利用すると、サブクラス
の挙動を変更するクラスを書くことができます。これは、クラスデコレータとと
ても良く似ていますが、クラスデコレータが、それが適用された特定のクラスに
のみに影響するのに対して、 ‘__init_subclass__’ は、もっぱら、このメソッ
ドを定義したクラスの将来のサブクラスに適用されます。

 -- メソッド: classmethod object.__init_subclass__ (cls)

     このメソッドは、それが定義されたクラスが継承された際に必ず呼び出さ
     れます。'cls' は新しいサブクラスです。もし、このメソッドがインスタ
     ンスメソッドとして定義されると、暗黙的にクラスメソッドに変換されま
     す。

     Keyword arguments which are given to a new class are passed to the
     parent class's ‘__init_subclass__’.  For compatibility with other
     classes using ‘__init_subclass__’, one should take out the needed
     keyword arguments and pass the others over to the base class, as
     in:

          class Philosopher:
              def __init_subclass__(cls, /, default_name, **kwargs):
                  super().__init_subclass__(**kwargs)
                  cls.default_name = default_name

          class AustralianPhilosopher(Philosopher, default_name="Bruce"):
              pass

     ‘object.__init_subclass__’ のデフォルト実装は何も行いませんが、何ら
     かの引数とともに呼び出された場合は、エラーを送出します。

          注釈: メタクラスのヒント ‘metaclass’ は残りの型機構によって消
          費され、 ‘__init_subclass__’ 実装に渡されることはありません。
          実際のメタクラス (明示的なヒントではなく) は、 ‘type(cls)’ と
          してアクセスできます。

     Added in version 3.6.

When a class is created, ‘type.__new__()’ scans the class variables and
makes callbacks to those with a *note __set_name__(): e48. hook.

 -- メソッド: object.__set_name__ (self, owner, name)

     オーナーとなるクラス 'owner' が作成された時点で自動的に呼び出されま
     す。 オブジェクトはそのクラスの 'name' に割り当てられます。

          class A:
              x = C()  # Automatically calls: x.__set_name__(A, 'x')

     If the class variable is assigned after the class is created, *note
     __set_name__(): e48. will not be called automatically.  If needed,
     *note __set_name__(): e48. can be called directly:

          class A:
             pass

          c = C()
          A.x = c                  # The hook is not called
          c.__set_name__(A, 'x')   # Manually invoke the hook

     詳細は *note クラスオブジェクトの作成: e44. を参照してください。

     Added in version 3.6.

* Menu:

* メタクラス::
* MRO エントリの解決::
* 適切なメタクラスの決定::
* クラスの名前空間の準備::
* クラス本体の実行::
* クラスオブジェクトの作成::
* メタクラスの用途::


File: python.info,  Node: メタクラス,  Next: MRO エントリの解決,  Up: クラス生成をカスタマイズする

4.3.3.8 メタクラス
..................

デフォルトでは、クラスは *note type(): f44. を使って構築されます。 クラ
ス本体は新しい名前空間で実行され、クラス名が ‘type(name, bases,
namespace)’ の結果にローカルに束縛されます。

クラス生成プロセスはカスタマイズできます。 そのためにはクラス定義行で
‘metaclass’ キーワード引数を渡すか、そのような引数を定義行に含む既存のク
ラスを継承します。 次の例で ‘MyClass’ と ‘MySubclass’ は両方とも ‘Meta’
のインスタンスです:

     class Meta(type):
         pass

     class MyClass(metaclass=Meta):
         pass

     class MySubclass(MyClass):
         pass

クラス定義の中で指定された他のキーワード引数は、後述するすべてのメタクラ
ス操作に渡されます。

クラス定義が実行される際に、以下のステップが生じます:

   * MRO エントリの解決が行われる;

   * 適切なメタクラスが決定される;

   * クラスの名前空間が準備される;

   * クラスの本体が実行される;

   * クラスオブジェクトが作られる。


File: python.info,  Node: MRO エントリの解決,  Next: 適切なメタクラスの決定,  Prev: メタクラス,  Up: クラス生成をカスタマイズする

4.3.3.9 MRO エントリの解決
..........................

 -- メソッド: object.__mro_entries__ (self, bases)

     If a base that appears in a class definition is not an instance of
     *note type: f44, then an ‘__mro_entries__()’ method is searched on
     the base.  If an ‘__mro_entries__()’ method is found, the base is
     substituted with the result of a call to ‘__mro_entries__()’ when
     creating the class.  The method is called with the original bases
     tuple passed to the 'bases' parameter, and must return a tuple of
     classes that will be used instead of the base.  The returned tuple
     may be empty: in these cases, the original base is ignored.

参考
....

*note types.resolve_bases(): d95.

     Dynamically resolve bases that are not instances of *note type:
     f44.

*note types.get_original_bases(): 6f5.

     Retrieve a class's "original bases" prior to modifications by *note
     __mro_entries__(): ce3.

PEP 560(1)

     Core support for typing module and generic types.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0560/


File: python.info,  Node: 適切なメタクラスの決定,  Next: クラスの名前空間の準備,  Prev: MRO エントリの解決,  Up: クラス生成をカスタマイズする

4.3.3.10 適切なメタクラスの決定
...............................

クラス定義に対して適切なメタクラスは、以下のように決定されます:

   * 基底も明示的なメタクラスも与えられていない場合は、 *note type():
     f44. が使われます;

   * 明示的なメタクラスが与えられていて、それが *note type(): f44. のイ
     ンスタンス 'ではない' 場合、それをメタクラスとして直接使います;

   * 明示的なメタクラスとして *note type(): f44. のインスタンスが与えら
     れたか、基底が定義されていた場合は、最も派生した (継承関係で最も下
     の) メタクラスが使われます。

最も派生的なメタクラスは、(もしあれば) 明示的に指定されたメタクラスと、
指定されたすべてのベースクラスのメタクラスから選ばれます。最も派生的なメ
タクラスは、これらのメタクラス候補のすべてのサブタイプであるようなもので
す。メタクラス候補のどれもその基準を満たさなければ、クラス定義は
‘TypeError’ で失敗します。


File: python.info,  Node: クラスの名前空間の準備,  Next: クラス本体の実行,  Prev: 適切なメタクラスの決定,  Up: クラス生成をカスタマイズする

4.3.3.11 クラスの名前空間の準備
...............................

適切なメタクラスが指定されると、クラスの名前空間が用意されます。もしメタ
クラスが ‘__prepare__’ 属性を持っている場合、 ‘namespace =
metaclass.__prepare__(name, bases, **kwds)’ が呼ばれます。追加のキーワー
ド引数は、もしクラス定義にあれば設定されます。 ‘__prepare__’ メソッドは
*note クラスメソッド: 48e. として実装する必要があります。 ‘__prepare__’
が作成して返した名前空間は ‘__new__’ に渡されますが、最終的なクラスオブ
ジェクトは新しい ‘dict’ にコピーして作成されます。

メタクラスに ‘__prepare__’ 属性がない場合、クラスの名前空間は空の 順序付
きマッピングとして初期化されます。

参考
....

PEP 3115(1) - Metaclasses in Python 3000

     ‘__prepare__’ 名前空間フックの導入

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3115/


File: python.info,  Node: クラス本体の実行,  Next: クラスオブジェクトの作成,  Prev: クラスの名前空間の準備,  Up: クラス生成をカスタマイズする

4.3.3.12 クラス本体の実行
.........................

クラス本体が (大まかには) ‘exec(body, globals(), namespace)’ として実行
されます。通常の呼び出しと *note exec(): 4a2. の重要な違いは、クラス定義
が関数内部で行われる場合、レキシカルスコープによってクラス本体 (任意のメ
ソッドを含む) が現在のスコープと外側のスコープから名前を参照できるという
点です。

しかし、クラス定義が関数内部で行われる時でさえ、クラス内部で定義されたメ
ソッドはクラススコープで定義された名前を見ることはできません。クラス変数
はインスタンスメソッドかクラスメソッドの最初のパラメータからアクセスする
か、次の節で説明する、暗黙的に静的スコープが切られている ‘__class__’ 参
照からアクセスしなければなりません。


File: python.info,  Node: クラスオブジェクトの作成,  Next: メタクラスの用途,  Prev: クラス本体の実行,  Up: クラス生成をカスタマイズする

4.3.3.13 クラスオブジェクトの作成
.................................

クラス本体の実行によってクラスの名前空間が初期化されたら、
‘metaclass(name, bases, namespace, **kwds)’ を呼び出すことでクラスオブジ
ェクトが作成されます (ここで渡される追加のキーワードは ‘__prepare__’ に
渡されるものと同じです)。

このクラスオブジェクトは、 *note super(): 1a6. の無引数形式によって参照
されるものです。 ‘__class__’ は、クラス本体中のメソッドが ‘__class__’ ま
たは ‘super’ のいずれかを参照している場合に、コンパイラによって作成され
る暗黙のクロージャー参照です。これは、メソッドに渡された最初の引数に基づ
いて現在の呼び出しを行うために使用されるクラスまたはインスタンスが識別さ
れる一方、 *note super(): 1a6. の無引数形式がレキシカルスコープに基づい
て定義されているクラスを正確に識別することを可能にします。

CPython 3.6 以降では、 ‘__class__’ セルは、クラス名前空間にある
‘__classcell__’ エントリーとしてメタクラスに渡されます。 ‘__class__’ セ
ルが存在していた場合は、そのクラスが正しく初期化されるために、
‘type.__new__’ の呼び出しに到達するまで上に伝搬されます。 失敗した場合は
、Python 3.8 では *note RuntimeError: 244. になります。

デフォルトのメタクラス *note type: f44. や最終的には ‘type.__new__’ を呼
び出すメタクラスを使っているときは、クラスオブジェクトを作成した後に次の
カスタム化の手順が起動されます:

  1. ‘type.__new__’ メソッドが *note __set_name__(): e48. が定義されてい
     るクラスの名前空間にある全ての属性を収集します;

  2. それらの ‘__set_name__’ メソッドが、そのメソッドが定義されているク
     ラス、およびそこに属する属性に割り当てられている名前を引数として呼
     び出されます;

  3. 新しいクラスのメソッド解決順序ですぐ上に位置する親クラスで *note
     __init_subclass__(): 843. フックが呼び出されます。

クラスオブジェクトが作成された後には、クラス定義に含まれているクラスデコ
レータ (もしあれば) にクラスオブジェクトが渡され、デコレータが返すオブジ
ェクトがここで定義されたクラスとしてローカルの名前空間に束縛されます。

When a new class is created by ‘type.__new__’, the object provided as
the namespace parameter is copied to a new ordered mapping and the
original object is discarded.  The new copy is wrapped in a read-only
proxy, which becomes the *note __dict__: e57. attribute of the class
object.

参考
....

PEP 3135(1) - New super

     暗黙の ‘__class__’ クロージャ参照について記述しています

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3135/


File: python.info,  Node: メタクラスの用途,  Prev: クラスオブジェクトの作成,  Up: クラス生成をカスタマイズする

4.3.3.14 メタクラスの用途
.........................

メタクラスは限りない潜在的利用価値を持っています。これまで試されてきたア
イデアには、列挙型、ログ記録、インターフェースのチェック、 自動デリゲー
ション、自動プロパティ生成、プロキシ、フレームワーク、そして自動リソース
ロック／同期といったものがあります。


File: python.info,  Node: インスタンスのカスタマイズとサブクラスチェック,  Next: ジェネリック型をエミュレートする,  Prev: クラス生成をカスタマイズする,  Up: 特殊メソッド名

4.3.3.15 インスタンスのカスタマイズとサブクラスチェック
.......................................................

以下のメソッドは組み込み関数 *note isinstance(): 2ad. と *note
issubclass(): 9c4. のデフォルトの動作を上書きするのに利用します。

特に、 *note abc.ABCMeta: 111c. メタクラスは、抽象基底クラス (ABCs) を
"仮想基底クラス (virtual base classes)" として、他の ABC を含む、任意の
クラスや (組み込み型を含む) 型に追加するために、これらのメソッドを実装し
ています。

 -- メソッド: type.__instancecheck__ (self, instance)

     'instance' が (直接、または間接的に) 'class' のインスタンスと考えら
     れる場合に true を返します。定義されていれば、
     ‘isinstance(instance, class)’ の実装のために呼び出されます。

 -- メソッド: type.__subclasscheck__ (self, subclass)

     'subclass' が (直接、または間接的に) 'class' のサブクラスと考えられ
     る場合に true を返します。定義されていれば、 ‘issubclass(subclass,
     class)’ の実装のために呼び出されます。

なお、これらのメソッドは、クラスの型 (メタクラス) 上で検索されます。実際
のクラスにクラスメソッドとして定義することはできません。これは、インスタ
ンスそれ自体がクラスであるこの場合にのみ、インスタンスに呼び出される特殊
メソッドの検索と一貫しています。

参考
....

PEP 3119(1) - 抽象基底クラスの導入

     Includes the specification for customizing *note isinstance(): 2ad.
     and *note issubclass(): 9c4. behavior through *note
     __instancecheck__(): 23c6. and *note __subclasscheck__(): 23c7,
     with motivation for this functionality in the context of adding
     Abstract Base Classes (see the *note abc: 4. module) to the
     language.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3119/


File: python.info,  Node: ジェネリック型をエミュレートする,  Next: 呼び出し可能オブジェクトをエミュレートする,  Prev: インスタンスのカスタマイズとサブクラスチェック,  Up: 特殊メソッド名

4.3.3.16 ジェネリック型をエミュレートする
.........................................

When using *note type annotations: 15c, it is often useful to
'parameterize' a *note generic type: 1a1. using Python's square-brackets
notation.  For example, the annotation ‘list[int]’ might be used to
signify a *note list: 24d. in which all the elements are of type *note
int: 19b.

参考
....

PEP 484(1) - 型ヒント

     Introducing Python's framework for type annotations

*note Generic Alias Types: 8c1.

     Documentation for objects representing parameterized generic
     classes

*note ジェネリクス: 23c9, *note user-defined generics: 6f6. and *note typing.Generic: 17b6.

     実行時にパラメータ設定が可能であり、かつ静的な型チェッカーが理解で
     きるジェネリッククラスを実装する方法のドキュメントです。

A class can 'generally' only be parameterized if it defines the special
class method ‘__class_getitem__()’.

 -- メソッド: classmethod object.__class_getitem__ (cls, key)

     'key' にある型引数で特殊化されたジェネリッククラスを表すオブジェク
     トを返します。

     When defined on a class, ‘__class_getitem__()’ is automatically a
     class method.  As such, there is no need for it to be decorated
     with *note @classmethod: 48e. when it is defined.

* Menu:

* The purpose of __class_getitem__::
* __class_getitem__ versus __getitem__::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/


File: python.info,  Node: The purpose of __class_getitem__,  Next: __class_getitem__ versus __getitem__,  Up: ジェネリック型をエミュレートする

4.3.3.17 The purpose of '__class_getitem__'
...........................................

The purpose of *note __class_getitem__(): 943. is to allow runtime
parameterization of standard-library generic classes in order to more
easily apply *note type hints: 23cb. to these classes.

To implement custom generic classes that can be parameterized at runtime
and understood by static type-checkers, users should either inherit from
a standard library class that already implements *note
__class_getitem__(): 943, or inherit from *note typing.Generic: 17b6,
which has its own implementation of ‘__class_getitem__()’.

Custom implementations of *note __class_getitem__(): 943. on classes
defined outside of the standard library may not be understood by
third-party type-checkers such as mypy.  Using ‘__class_getitem__()’ on
any class for purposes other than type hinting is discouraged.


File: python.info,  Node: __class_getitem__ versus __getitem__,  Prev: The purpose of __class_getitem__,  Up: ジェネリック型をエミュレートする

4.3.3.18 '__class_getitem__' versus '__getitem__'
.................................................

Usually, the *note subscription: 23ce. of an object using square
brackets will call the *note __getitem__(): 588. instance method defined
on the object's class.  However, if the object being subscribed is
itself a class, the class method *note __class_getitem__(): 943. may be
called instead.  ‘__class_getitem__()’ should return a *note
GenericAlias: 8c1. object if it is properly defined.

Presented with the *note expression: 23cf. ‘obj[x]’, the Python
interpreter follows something like the following process to decide
whether *note __getitem__(): 588. or *note __class_getitem__(): 943.
should be called:

     from inspect import isclass

     def subscribe(obj, x):
         """Return the result of the expression 'obj[x]'"""

         class_of_obj = type(obj)

         # If the class of obj defines __getitem__,
         # call class_of_obj.__getitem__(obj, x)
         if hasattr(class_of_obj, '__getitem__'):
             return class_of_obj.__getitem__(obj, x)

         # Else, if obj is a class and defines __class_getitem__,
         # call obj.__class_getitem__(x)
         elif isclass(obj) and hasattr(obj, '__class_getitem__'):
             return obj.__class_getitem__(x)

         # Else, raise an exception
         else:
             raise TypeError(
                 f"'{class_of_obj.__name__}' object is not subscriptable"
             )

In Python, all classes are themselves instances of other classes.  The
class of a class is known as that class's *note metaclass: 23d0, and
most classes have the *note type: f44. class as their metaclass.  *note
type: f44. does not define *note __getitem__(): 588, meaning that
expressions such as ‘list[int]’, ‘dict[str, float]’ and ‘tuple[str,
bytes]’ all result in *note __class_getitem__(): 943. being called:

     >>> # list has class "type" as its metaclass, like most classes:
     >>> type(list)
     <class 'type'>
     >>> type(dict) == type(list) == type(tuple) == type(str) == type(bytes)
     True
     >>> # "list[int]" calls "list.__class_getitem__(int)"
     >>> list[int]
     list[int]
     >>> # list.__class_getitem__ returns a GenericAlias object:
     >>> type(list[int])
     <class 'types.GenericAlias'>

However, if a class has a custom metaclass that defines *note
__getitem__(): 588, subscribing the class may result in different
behaviour.  An example of this can be found in the *note enum: 5a.
module:

     >>> from enum import Enum
     >>> class Menu(Enum):
     ...     """A breakfast menu"""
     ...     SPAM = 'spam'
     ...     BACON = 'bacon'
     ...
     >>> # Enum classes have a custom metaclass:
     >>> type(Menu)
     <class 'enum.EnumMeta'>
     >>> # EnumMeta defines __getitem__,
     >>> # so __class_getitem__ is not called,
     >>> # and the result is not a GenericAlias object:
     >>> Menu['SPAM']
     <Menu.SPAM: 'spam'>
     >>> type(Menu['SPAM'])
     <enum 'Menu'>

参考
....

PEP 560(1) - typing モジュールとジェネリック型に対する言語コアによるサポート

     Introducing *note __class_getitem__(): 943, and outlining when a
     *note subscription: 23ce. results in ‘__class_getitem__()’ being
     called instead of *note __getitem__(): 588.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0560/


File: python.info,  Node: 呼び出し可能オブジェクトをエミュレートする,  Next: コンテナをエミュレートする,  Prev: ジェネリック型をエミュレートする,  Up: 特殊メソッド名

4.3.3.19 呼び出し可能オブジェクトをエミュレートする
...................................................

 -- メソッド: object.__call__ (self[, args...])

     Called when the instance is "called" as a function; if this method
     is defined, ‘x(arg1, arg2, ...)’ roughly translates to
     ‘type(x).__call__(x, arg1, ...)’.  The *note object: c7e. class
     itself does not provide this method.


File: python.info,  Node: コンテナをエミュレートする,  Next: 数値型をエミュレートする,  Prev: 呼び出し可能オブジェクトをエミュレートする,  Up: 特殊メソッド名

4.3.3.20 コンテナをエミュレートする
...................................

The following methods can be defined to implement container objects.
None of them are provided by the *note object: c7e. class itself.
Containers usually are *note sequences: 716. (such as *note lists: 24d.
or *note tuples: 614.) or *note mappings: 13d3. (like *note
dictionaries: 23d5.), but can represent other containers as well.  The
first set of methods is used either to emulate a sequence or to emulate
a mapping; the difference is that for a sequence, the allowable keys
should be the integers 'k' for which ‘0 <= k < N’ where 'N' is the
length of the sequence, or *note slice: 694. objects, which define a
range of items.  It is also recommended that mappings provide the
methods ‘keys()’, ‘values()’, ‘items()’, ‘get()’, ‘clear()’,
‘setdefault()’, ‘pop()’, ‘popitem()’, ‘copy()’, and ‘update()’ behaving
similar to those for Python's standard *note dictionary: 183. objects.
The *note collections.abc: 1f. module provides a *note MutableMapping:
12c0. *note abstract base class: 13ce. to help create those methods from
a base set of *note __getitem__(): 588, *note __setitem__(): 14e3, *note
__delitem__(): 14e4, and ‘keys()’.

Mutable sequences should provide methods *note append(): 23d6, *note
clear(): 23d7, *note count(): 23d8, *note extend(): 23d9, *note index():
1979, *note insert(): 23da, *note pop(): 23db, *note remove(): 197a, and
*note reverse(): 23dc, like Python standard *note list: 24d. objects.
Finally, sequence types should implement addition (meaning
concatenation) and multiplication (meaning repetition) by defining the
methods *note __add__(): 23dd, *note __radd__(): 23de, *note __iadd__():
23df, *note __mul__(): 23e0, *note __rmul__(): 23e1. and *note
__imul__(): 23e2. described below; they should not define other
numerical operators.

It is recommended that both mappings and sequences implement the *note
__contains__(): 15d3. method to allow efficient use of the ‘in’
operator; for mappings, ‘in’ should search the mapping's keys; for
sequences, it should search through the values.  It is further
recommended that both mappings and sequences implement the *note
__iter__(): e69. method to allow efficient iteration through the
container; for mappings, ‘__iter__()’ should iterate through the
object's keys; for sequences, it should iterate through the values.

 -- メソッド: object.__len__ (self)

     Called to implement the built-in function *note len(): 840.  Should
     return the length of the object, an integer ‘>=’ 0.  Also, an
     object that doesn't define a *note __bool__(): 14ed. method and
     whose ‘__len__()’ method returns zero is considered to be false in
     a Boolean context.

     'CPython 実装の詳細:' In CPython, the length is required to be at
     most *note sys.maxsize: 13dd.  If the length is larger than
     ‘sys.maxsize’ some features (such as *note len(): 840.) may raise
     *note OverflowError: a81.  To prevent raising ‘OverflowError’ by
     truth value testing, an object must define a *note __bool__():
     14ed. method.

 -- メソッド: object.__length_hint__ (self)

     Called to implement *note operator.length_hint(): 116f.  Should
     return an estimated length for the object (which may be greater or
     less than the actual length).  The length must be an integer ‘>=’
     0.  The return value may also be *note NotImplemented: 1a2, which
     is treated the same as if the ‘__length_hint__’ method didn't exist
     at all.  This method is purely an optimization and is never
     required for correctness.

     Added in version 3.4.

     注釈: スライシングは、以下の 3 メソッドによって排他的に行われます。
     次のような呼び出しは

          a[1:2] = b

     次のように翻訳され

          a[slice(1, 2, None)] = b

     以下も同様です。存在しないスライスの要素は ‘None’ で埋められます。

 -- メソッド: object.__getitem__ (self, subscript)

     Called to implement 'subscription', that is, ‘self[subscript]’.
     See *note Subscriptions and slicings: 23ce. for details on the
     syntax.

     There are two types of built-in objects that support subscription
     via ‘__getitem__()’:

        - 'sequences', where 'subscript' (also called *note index:
          23e3.) should be an integer or a *note slice: 694. object.
          See the *note sequence documentation: 2338. for the expected
          behavior, including handling *note slice: 694. objects and
          negative indices.

        - 'mappings', where 'subscript' is also called the *note key:
          23e4.  See *note mapping documentation: 233f. for the expected
          behavior.

     If 'subscript' is of an inappropriate type, ‘__getitem__()’ should
     raise *note TypeError: 198.  If 'subscript' has an inappropriate
     value, ‘__getitem__()’ should raise an *note LookupError: 23e5. or
     one of its subclasses (*note IndexError: 174e. for sequences; *note
     KeyError: 5e7. for mappings).

          注釈: The sequence iteration protocol (used, for example, in
          *note for: 34a. loops), expects that an *note IndexError:
          174e. will be raised for illegal indexes to allow proper
          detection of the end of a sequence.

          注釈: When *note subscripting: 23ce. a 'class', the special
          class method *note __class_getitem__(): 943. may be called
          instead of ‘__getitem__()’.  See *note __class_getitem__
          versus __getitem__: 23cd. for more details.

 -- メソッド: object.__setitem__ (self, key, value)

     ‘self[key]’ に対する代入を実装するために呼び出されます。 *note
     __getitem__(): 588. と同じ注意事項があてはまります。このメソッドを
     実装できるのは、あるキーに対する値の変更をサポートしているか、新た
     なキーを追加できるようなマップの場合と、ある要素を置き換えることが
     できるシーケンスの場合だけです。不正な 'key' に対しては、 *note
     __getitem__(): 588. メソッドと同様の例外の送出を行わなければなりま
     せん。

 -- メソッド: object.__delitem__ (self, key)

     ‘self[key]’ の削除を実装するために呼び出されます。 *note
     __getitem__(): 588. と同じ注意事項があてはまります。このメソッドを
     実装できるのは、キーの削除をサポートしているマップの場合と、要素を
     削除できるシーケンスの場合だけです。不正な 'key' に対しては、 *note
     __getitem__(): 588. メソッドと同様の例外の送出を行わなければなりま
     せん。

 -- メソッド: object.__missing__ (self, key)

     ‘self[key]’ の実装において辞書内にキーが存在しなかった場合に、 dict
     のサブクラスのために *note dict: 183.*note __getitem__(): 588. によ
     って呼び出されます。

 -- メソッド: object.__iter__ (self)

     このメソッドは、コンテナに対して *note イテレータ: 4c8. が要求され
     た際に呼び出されます。このメソッドは、コンテナ内の全てのオブジェク
     トに渡って反復処理できるような、新たなイテレータオブジェクトを返さ
     なければなりません。マッピングでは、コンテナ内のキーに渡って反復処
     理しなければなりません。

 -- メソッド: object.__reversed__ (self)

     *note reversed(): a65. 組み込み関数が逆方向イテレーションを実装する
     ために、(存在すれば)呼び出します。コンテナ内の全要素を逆順にイテレ
     ートする、新しいイテレータを返すべきです。

     *note __reversed__(): e86. メソッドが定義されていない場合、 *note
     reversed(): a65. 組込み関数は sequence プロトコル (*note __len__():
     178f. と *note __getitem__(): 588.) を使った方法にフォールバックし
     ます。 sequence プロトコルをサポートしたオブジェクトは、 *note
     reversed(): a65. よりも効率のいい実装を提供できる場合にのみ *note
     __reversed__(): e86. を定義するべきです。

帰属テスト演算子 (*note in: 34b. および *note not in: 841.) は通常、コン
テナの要素に対する反復処理のように実装されます。しかし、コンテナオブジェ
クトで以下の特殊メソッドを定義して、より効率的な実装を行ったり、オブジェ
クトがイテラブルでなくてもよいようにできます。

 -- メソッド: object.__contains__ (self, item)

     帰属テスト演算を実装するために呼び出されます。 'item' が 'self' 内
     に存在する場合には真を、そうでない場合には偽を返さなければなりませ
     ん。マップオブジェクトの場合、値やキーと値の組ではなく、キーに対す
     る帰属テストを考えなければなりません。

     *note __contains__(): 15d3. を定義しないオブジェクトに対しては、メ
     ンバシップテストはまず、 *note __iter__(): e69. を使った反復を試み
     ます、次に古いシーケンス反復プロトコル *note __getitem__(): 588. を
     使います、 *note 言語レファレンスのこの節: 23e6. を参照して下さい。


File: python.info,  Node: 数値型をエミュレートする,  Next: with文とコンテキストマネージャ,  Prev: コンテナをエミュレートする,  Up: 特殊メソッド名

4.3.3.21 数値型をエミュレートする
.................................

以下のメソッドを定義して、数値型オブジェクトをエミュレートすることができ
ます。特定の種類の数値型ではサポートされていないような演算に対応するメソ
ッド (非整数の数値に対するビット単位演算など) は、未定義のままにしておか
なければなりません。

 -- メソッド: object.__add__ (self, other)
 -- メソッド: object.__sub__ (self, other)
 -- メソッド: object.__mul__ (self, other)
 -- メソッド: object.__matmul__ (self, other)
 -- メソッド: object.__truediv__ (self, other)
 -- メソッド: object.__floordiv__ (self, other)
 -- メソッド: object.__mod__ (self, other)
 -- メソッド: object.__divmod__ (self, other)
 -- メソッド: object.__pow__ (self, other[, modulo])
 -- メソッド: object.__lshift__ (self, other)
 -- メソッド: object.__rshift__ (self, other)
 -- メソッド: object.__and__ (self, other)
 -- メソッド: object.__xor__ (self, other)
 -- メソッド: object.__or__ (self, other)

     These methods are called to implement the binary arithmetic
     operations (‘+’, ‘-’, ‘*’, ‘@’, ‘/’, ‘//’, ‘%’, *note divmod():
     b99, *note pow(): 1a4, ‘**’, ‘<<’, ‘>>’, ‘&’, ‘^’, ‘|’).  For
     instance, to evaluate the expression ‘x + y’, where 'x' is an
     instance of a class that has an *note __add__(): 23dd. method,
     ‘type(x).__add__(x, y)’ is called.  The *note __divmod__(): 1091.
     method should be the equivalent to using *note __floordiv__():
     170d. and *note __mod__(): 23ea.; it should not be related to *note
     __truediv__(): 1090.  Note that *note __pow__(): 9d4. should be
     defined to accept an optional third argument if the three-argument
     version of the built-in *note pow(): 1a4. function is to be
     supported.

     If one of those methods does not support the operation with the
     supplied arguments, it should return *note NotImplemented: 1a2.

 -- メソッド: object.__radd__ (self, other)
 -- メソッド: object.__rsub__ (self, other)
 -- メソッド: object.__rmul__ (self, other)
 -- メソッド: object.__rmatmul__ (self, other)
 -- メソッド: object.__rtruediv__ (self, other)
 -- メソッド: object.__rfloordiv__ (self, other)
 -- メソッド: object.__rmod__ (self, other)
 -- メソッド: object.__rdivmod__ (self, other)
 -- メソッド: object.__rpow__ (self, other[, modulo])
 -- メソッド: object.__rlshift__ (self, other)
 -- メソッド: object.__rrshift__ (self, other)
 -- メソッド: object.__rand__ (self, other)
 -- メソッド: object.__rxor__ (self, other)
 -- メソッド: object.__ror__ (self, other)

     These methods are called to implement the binary arithmetic
     operations (‘+’, ‘-’, ‘*’, ‘@’, ‘/’, ‘//’, ‘%’, *note divmod():
     b99, *note pow(): 1a4, ‘**’, ‘<<’, ‘>>’, ‘&’, ‘^’, ‘|’) with
     reflected (swapped) operands.  These functions are only called if
     the operands are of different types, when the left operand does not
     support the corresponding operation (1), or the right operand's
     class is derived from the left operand's class.  (2)  For instance,
     to evaluate the expression ‘x - y’, where 'y' is an instance of a
     class that has an *note __rsub__(): 23f0. method,
     ‘type(y).__rsub__(y, x)’ is called if ‘type(x).__sub__(x, y)’
     returns *note NotImplemented: 1a2. or ‘type(y)’ is a subclass of
     ‘type(x)’.  (3)

     Note that *note __rpow__(): 1a5. should be defined to accept an
     optional third argument if the three-argument version of the
     built-in *note pow(): 1a4. function is to be supported.

     バージョン 3.14 で変更: Three-argument *note pow(): 1a4. now try
     calling *note __rpow__(): 1a5. if necessary.  Previously it was
     only called in two-argument ‘pow()’ and the binary power operator.

          注釈: 右側の被演算子の型が左側の被演算子の型のサブクラスであり
          、このサブクラスであるメソッドに対する反射メソッドと異なる実装
          が定義されている場合には、左側の被演算子の非反射メソッドが呼ば
          れる前に、このメソッドが呼ばれます。この振る舞いにより、サブク
          ラスが親の演算をオーバーライドすることが可能になります。

 -- メソッド: object.__iadd__ (self, other)
 -- メソッド: object.__isub__ (self, other)
 -- メソッド: object.__imul__ (self, other)
 -- メソッド: object.__imatmul__ (self, other)
 -- メソッド: object.__itruediv__ (self, other)
 -- メソッド: object.__ifloordiv__ (self, other)
 -- メソッド: object.__imod__ (self, other)
 -- メソッド: object.__ipow__ (self, other[, modulo])
 -- メソッド: object.__ilshift__ (self, other)
 -- メソッド: object.__irshift__ (self, other)
 -- メソッド: object.__iand__ (self, other)
 -- メソッド: object.__ixor__ (self, other)
 -- メソッド: object.__ior__ (self, other)

     These methods are called to implement the augmented arithmetic
     assignments (‘+=’, ‘-=’, ‘*=’, ‘@=’, ‘/=’, ‘//=’, ‘%=’, ‘**=’,
     ‘<<=’, ‘>>=’, ‘&=’, ‘^=’, ‘|=’).  These methods should attempt to
     do the operation in-place (modifying 'self') and return the result
     (which could be, but does not have to be, 'self').  If a specific
     method is not defined, or if that method returns *note
     NotImplemented: 1a2, the augmented assignment falls back to the
     normal methods.  For instance, if 'x' is an instance of a class
     with an *note __iadd__(): 23df. method, ‘x += y’ is equivalent to
     ‘x = x.__iadd__(y)’ .  If *note __iadd__(): 23df. does not exist,
     or if ‘x.__iadd__(y)’ returns ‘NotImplemented’, ‘x.__add__(y)’ and
     ‘y.__radd__(x)’ are considered, as with the evaluation of ‘x + y’.
     In certain situations, augmented assignment can result in
     unexpected errors (see *note なぜ加算はされるのに a_tuple[i] +=
     ['item'] は例外を送出するのですか?: 2402.), but this behavior is in
     fact part of the data model.

 -- メソッド: object.__neg__ (self)
 -- メソッド: object.__pos__ (self)
 -- メソッド: object.__abs__ (self)
 -- メソッド: object.__invert__ (self)

     呼び出して単項算術演算 (‘-’, ‘+’, *note abs(): 208d. および ‘~’) を
     実装します。

 -- メソッド: object.__complex__ (self)
 -- メソッド: object.__int__ (self)
 -- メソッド: object.__float__ (self)

     組み込み関数の *note complex(): 197, *note int(): 19b, *note
     float(): 196. の実装から呼び出されます。 適切な型の値を返さなければ
     なりません。

 -- メソッド: object.__index__ (self)

     呼び出して *note operator.index(): 1cd2. を実装します。 Python が数
     値オブジェクトを整数オブジェクトに損失なく変換する必要がある場合 (た
     とえばスライシングや、組み込みの *note bin(): 14c0. 、 *note hex():
     14e7. 、 *note oct(): 14e6. 関数) は常に呼び出されます。 このメソッ
     ドがあるとその数値オブジェクトが整数型であることが示唆されます。 整
     数を返さなければなりません。

     もし *note __int__(): 19d, *note __float__(): bc1, *note
     __complex__(): 7fd. が定義されていない場合、組み込み関数の *note
     int(): 19b, *note float(): 196, *note complex(): 197. は *note
     __index__(): 19e. にフォールバックします。

 -- メソッド: object.__round__ (self[, ndigits])
 -- メソッド: object.__trunc__ (self)
 -- メソッド: object.__floor__ (self)
 -- メソッド: object.__ceil__ (self)

     組み込み関数の *note round(): 14f2. と *note math: 92. モジュール関
     数の *note trunc(): 15d9, *note floor(): 15d7, *note ceil(): 15d8.
     の実装から呼び出されます。 'ndigits' が ‘__round__()’ に渡されない
     限りは、これらの全てのメソッドは *note Integral: 240a. (たいていは
     *note int: 19b.) に切り詰められたオブジェクトの値を返すべきです。

     バージョン 3.14 で変更: *note int(): 19b. no longer delegates to
     the *note __trunc__(): 19c. method.

   ---------- Footnotes ----------

   (1) "Does not support" here means that the class has no such method,
or the method returns *note NotImplemented: 1a2.  Do not set the method
to ‘None’ if you want to force fallback to the right operand's reflected
method—that will instead have the opposite effect of explicitly
'blocking' such fallback.

   (2) For operands of the same type, it is assumed that if the
non-reflected method (such as *note __add__(): 23dd.) fails then the
operation is not supported, which is why the reflected method is not
called.

   (3) If the right operand's type is a subclass of the left operand's
type, the reflected method having precedence allows subclasses to
override their ancestors' operations.


File: python.info,  Node: with文とコンテキストマネージャ,  Next: クラスパターンマッチの位置引数のカスタマイズ,  Prev: 数値型をエミュレートする,  Up: 特殊メソッド名

4.3.3.22 with文とコンテキストマネージャ
.......................................

コンテキストマネージャ('context manager') とは、 *note with: 186. 文の実
行時にランタイムコンテキストを定義するオブジェクトです。コンテキストマネ
ージャは、コードブロックを実行するために必要な入り口および出口の処理を扱
います。コンテキストマネージャは通常、 ‘with’ 文（ *note with 文: 186. の
章を参照）により起動されますが、これらのメソッドを直接呼び出すことで起動
することもできます。

コンテキストマネージャの代表的な使い方としては、様々なグローバル情報の保
存および更新、リソースのロックとアンロック、ファイルのオープンとクローズ
などが挙げられます。

For more information on context managers, see *note
コンテキストマネージャ型: 240d.  The *note object: c7e. class itself
does not provide the context manager methods.

 -- メソッド: object.__enter__ (self)

     コンテキストマネージャのの入り口で実行される処理です。 *note with:
     186. 文は、文の ‘as’ 節で規定された値を返すこのメソッドを呼び出しま
     す。

 -- メソッド: object.__exit__ (self, exc_type, exc_value, traceback)

     コンテキストマネージャの出口で実行される処理です。パラメータは、コ
     ンテキストが終了した原因となった例外について説明しています。コンテ
     キストが例外を送出せず終了した場合は、全ての引き数に *note None:
     885. が設定されます。

     もし、例外が送出され、かつメソッドが例外を抑制したい場合（すなわち
     、例外が伝播されるのを防ぎたい場合）、このメソッドは True を返す必
     要があります。そうでなければ、このメソッドの終了後、例外は通常通り
     伝播することになります。

     Note that *note __exit__(): 1518. methods should not reraise the
     passed-in exception; this is the caller's responsibility.

参考
....

PEP 343(1) - "with" ステートメント

     Python の *note with: 186. 文の仕様、背景、および例が記載されていま
     す。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0343/


File: python.info,  Node: クラスパターンマッチの位置引数のカスタマイズ,  Next: Emulating buffer types,  Prev: with文とコンテキストマネージャ,  Up: 特殊メソッド名

4.3.3.23 クラスパターンマッチの位置引数のカスタマイズ
.....................................................

パターンの中でクラス名を利用する場合、位置引数はデフォルトでは利用できま
せん。 ‘MyClass’ で特別なサポートがないと、 ‘case MyClass(x, y)’ は通常
無効です。このようなパターンを利用するには、 '__match_args__' 属性をクラ
スに定義する必要があります。

 -- データ: object.__match_args__

     このクラス変数には文字列のタプルがアサイン可能です。このクラスがク
     ラスパターンの位置引数の中で利用されると、それぞれの位置引数は対応
     する '__match_args__' の中の値をキーワードとする、キーワード引数に
     変換されます。この属性がない時は、 ‘()’ が設定されているのと同義で
     す。

例えば、もし ‘MyClass.__match_args__’ に ‘("left", "center", "right")’ が
定義されていた場合、 ‘case MyClass(x, y)’ は ‘case MyClass(left=x,
center=y)’ と同義です。パターンの引数の数は、 '__match_args__' の要素数
と同等かそれ以下でなければならない点に注意してください。もし、多かった場
合には、パターンマッチは *note TypeError: 198. を送出します。

Added in version 3.10.

参考
....

PEP 634(1) - 構造的パターンマッチ

     ‘match’ 文の詳細。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0634/


File: python.info,  Node: Emulating buffer types,  Next: Annotations,  Prev: クラスパターンマッチの位置引数のカスタマイズ,  Up: 特殊メソッド名

4.3.3.24 Emulating buffer types
...............................

The *note buffer protocol: 260. provides a way for Python objects to
expose efficient access to a low-level memory array.  This protocol is
implemented by builtin types such as *note bytes: 192. and *note
memoryview: 165, and third-party libraries may define additional buffer
types.

While buffer types are usually implemented in C, it is also possible to
implement the protocol in Python.

 -- メソッド: object.__buffer__ (self, flags)

     Called when a buffer is requested from 'self' (for example, by the
     *note memoryview: 165. constructor).  The 'flags' argument is an
     integer representing the kind of buffer requested, affecting for
     example whether the returned buffer is read-only or writable.
     *note inspect.BufferFlags: 68d. provides a convenient way to
     interpret the flags.  The method must return a *note memoryview:
     165. object.

 -- メソッド: object.__release_buffer__ (self, buffer)

     Called when a buffer is no longer needed.  The 'buffer' argument is
     a *note memoryview: 165. object that was previously returned by
     *note __buffer__(): 68c.  The method must release any resources
     associated with the buffer.  This method should return ‘None’.
     Buffer objects that do not need to perform any cleanup are not
     required to implement this method.

Added in version 3.12.

参考
....

PEP 688(1) - Making the buffer protocol accessible in Python

     Introduces the Python ‘__buffer__’ and ‘__release_buffer__’
     methods.

*note collections.abc.Buffer: 343.

     ABC for buffer types.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0688/


File: python.info,  Node: Annotations,  Next: 特殊メソッド検索,  Prev: Emulating buffer types,  Up: 特殊メソッド名

4.3.3.25 Annotations
....................

Functions, classes, and modules may contain *note annotations: 15c,
which are a way to associate information (usually *note type hints:
23cb.) with a symbol.

 -- の属性: object.__annotations__

     This attribute contains the annotations for an object.  It is *note
     lazily evaluated: 685, so accessing the attribute may execute
     arbitrary code and raise exceptions.  If evaluation is successful,
     the attribute is set to a dictionary mapping from variable names to
     annotations.

     バージョン 3.14 で変更: Annotations are now lazily evaluated.

 -- メソッド: object.__annotate__ (format)

     An *note annotate function: 15d.  Returns a new dictionary object
     mapping attribute/parameter names to their annotation values.

     Takes a format parameter specifying the format in which annotations
     values should be provided.  It must be a member of the *note
     annotationlib.Format: 230. enum, or an integer with a value
     corresponding to a member of the enum.

     If an annotate function doesn't support the requested format, it
     must raise *note NotImplementedError: 36b.  Annotate functions must
     always support *note VALUE: 15e. format; they must not raise *note
     NotImplementedError(): 36b. when called with this format.

     When called with *note VALUE: 15e. format, an annotate function may
     raise *note NameError: 452.; it must not raise ‘NameError’ when
     called requesting any other format.

     If an object does not have any annotations, *note __annotate__:
     1983. should preferably be set to ‘None’ (it can’t be deleted),
     rather than set to a function that returns an empty dict.

     Added in version 3.14.

参考
....

PEP 649(1) -- Deferred evaluation of annotation using descriptors

     Introduces lazy evaluation of annotations and the ‘__annotate__’
     function.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0649/


File: python.info,  Node: 特殊メソッド検索,  Prev: Annotations,  Up: 特殊メソッド名

4.3.3.26 特殊メソッド検索
.........................

カスタムクラスでは、特殊メソッドの暗黙の呼び出しは、オブジェクトのインス
タンス辞書ではなく、オブジェクトの型で定義されているときにのみ正しく動作
することが保証されます。この動作のため、以下のコードは例外を送出します:

     >>> class C:
     ...     pass
     ...
     >>> c = C()
     >>> c.__len__ = lambda: 5
     >>> len(c)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: object of type 'C' has no len()

この動作の背景となる理由は、 *note __hash__(): cf3. と *note __repr__():
82f. といった type オブジェクトを含むすべてのオブジェクトで定義されてい
る特殊メソッドにあります。これらのメソッドの暗黙の検索が通常の検索プロセ
スを使った場合、 type オブジェクト自体に対して実行されたときに失敗してし
まいます:

     >>> 1 .__hash__() == hash(1)
     True
     >>> int.__hash__() == hash(int)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: descriptor '__hash__' of 'int' object needs an argument

クラスの非結合メソッドをこのようにして実行しようとすることは、'metaclass
confusion' と呼ばれることもあり、特殊メソッドを検索するときはインスタン
スをバイパスすることで回避されます:

     >>> type(1).__hash__(1) == hash(1)
     True
     >>> type(int).__hash__(int) == hash(int)
     True

正確性のためにインスタンス属性をスキップするのに加えて、特殊メソッド検索
はオブジェクトのメタクラスを含めて、 *note __getattribute__(): dcb. メソ
ッドもバイパスします:

     >>> class Meta(type):
     ...     def __getattribute__(*args):
     ...         print("Metaclass getattribute invoked")
     ...         return type.__getattribute__(*args)
     ...
     >>> class C(object, metaclass=Meta):
     ...     def __len__(self):
     ...         return 10
     ...     def __getattribute__(*args):
     ...         print("Class getattribute invoked")
     ...         return object.__getattribute__(*args)
     ...
     >>> c = C()
     >>> c.__len__()                 # Explicit lookup via instance
     Class getattribute invoked
     10
     >>> type(c).__len__(c)          # Explicit lookup via type
     Metaclass getattribute invoked
     10
     >>> len(c)                      # Implicit lookup
     10

このように *note __getattribute__(): dcb. 機構をバイパスすることで、特殊
メソッドの扱いに関するある程度の自由度と引き換えに (特殊メソッドはインタ
プリタから一貫して実行されるためにクラスオブジェクトに設定 'しなければな
らない')、インタープリタを高速化するための大きな余地が手に入ります。


File: python.info,  Node: コルーチン,  Prev: 特殊メソッド名,  Up: データモデル

4.3.4 コルーチン
----------------

* Menu:

* 待機可能オブジェクト (Awaitable Object): 待機可能オブジェクト Awaitable Object.
* コルーチンオブジェクト::
* 非同期イテレータ (Asynchronous Iterator): 非同期イテレータ Asynchronous Iterator.
* 非同期コンテキストマネージャ (Asynchronous Context Manager): 非同期コンテキストマネージャ Asynchronous Context Manager.


File: python.info,  Node: 待機可能オブジェクト Awaitable Object,  Next: コルーチンオブジェクト,  Up: コルーチン

4.3.4.1 待機可能オブジェクト (Awaitable Object)
...............................................

*note awaitable: 4c9. オブジェクトは一般的には *note __await__(): f75. メ
ソッドが実装されています。 *note async def: 7ed. 関数が返す *note
Coroutineオブジェクト: 6b9. は待機可能です。

     注釈: *note types.coroutine(): 1088. デコレータでデコレータが付けら
     れたジェネレータから返される *note generator iterator: dd9. オブジ
     ェクトも待機可能ですが、 *note __await__(): f75. は実装されていませ
     ん。

 -- メソッド: object.__await__ (self)

     Must return an *note iterator: 4c8.  Should be used to implement
     *note awaitable: 4c9. objects.  For instance, *note asyncio.Future:
     dc6. implements this method to be compatible with the *note await:
     18d. expression.  The *note object: c7e. class itself is not
     awaitable and does not provide this method.

          注釈: The language doesn't place any restriction on the type
          or value of the objects yielded by the iterator returned by
          ‘__await__’, as this is specific to the implementation of the
          asynchronous execution framework (e.g.  *note asyncio: b.)
          that will be managing the *note awaitable: 4c9. object.

Added in version 3.5.

参考
....

待機可能オブジェクトについてより詳しくは PEP 492(1) を参照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0492/


File: python.info,  Node: コルーチンオブジェクト,  Next: 非同期イテレータ Asynchronous Iterator,  Prev: 待機可能オブジェクト Awaitable Object,  Up: コルーチン

4.3.4.2 コルーチンオブジェクト
..............................

*note Coroutineオブジェクト: 6b9. は *note awaitable: 4c9. オブジェクト
です。*note __await__(): f75. を呼び出し、その返り値に対し反復処理をする
ことでコルーチンの実行を制御できます。コルーチンの実行が完了し制御を戻し
たとき、イテレータは *note StopIteration: df5. を送出し、その例外の
*note value: 2417. 属性に返り値を持たせます。コルーチンが例外を送出した
場合は、イテレータにより伝搬されます。コルーチンから *note
StopIteration: df5. 例外を外に送出すべきではありません。

コルーチンには以下に挙げるメソッドもあり、これらはジェネレータのメソッド
からの類似です (*note ジェネレータ-イテレータメソッド: 2418. を参照して
ください)。 ただし、ジェネレータと違って、コルーチンは反復処理を直接はサ
ポートしていません。

バージョン 3.5.2 で変更: コルーチンで2回以上待機 (await) すると *note
RuntimeError: 244. となります。

 -- メソッド: coroutine.send (value)

     Starts or resumes execution of the coroutine.  If 'value' is
     ‘None’, this is equivalent to advancing the iterator returned by
     *note __await__(): f75.  If 'value' is not ‘None’, this method
     delegates to the *note send(): 126d. method of the iterator that
     caused the coroutine to suspend.  The result (return value, *note
     StopIteration: df5, or other exception) is the same as when
     iterating over the ‘__await__()’ return value, described above.

 -- メソッド: coroutine.throw (value)

 -- メソッド: coroutine.throw (type[, value[, traceback]])

     コルーチンで指定された例外を送出します。 このメソッドは、イテレータ
     にコルーチンを一時停止する *note throw(): 71c. メソッドがある場合に
     処理を委任します。 そうでない場合には、中断した地点から例外が送出さ
     れます。 結果 (返り値か *note StopIteration: df5. かその他の例外) は
     、上で解説したような *note __await__(): f75. の返り値に対して反復処
     理を行ったときと同じです。 例外がコルーチンの中で捕捉されなかった場
     合、呼び出し元へ伝搬されます。

     バージョン 3.12 で変更: The second signature (type[, value[,
     traceback]]) is deprecated and may be removed in a future version
     of Python.

 -- メソッド: coroutine.close ()

     コルーチンが自分自身の後片付けをし終了します。 コルーチンが一時停止
     している場合は、コルーチンを一時停止させたイテレータに *note
     close(): 1793. メソッドがあれば、まずはそれに処理を委任します。 そ
     して一時停止した地点から *note GeneratorExit: 15e1. が送出され、た
     だちにコルーチンが自分自身の後片付けを行います。 最後に、実行が開始
     されていなかった場合でも、コルーチンに実行が完了した印を付けます。

     コルーチンオブジェクトが破棄されるときには、上記の手順を経て自動的
     に閉じられます。


File: python.info,  Node: 非同期イテレータ Asynchronous Iterator,  Next: 非同期コンテキストマネージャ Asynchronous Context Manager,  Prev: コルーチンオブジェクト,  Up: コルーチン

4.3.4.3 非同期イテレータ (Asynchronous Iterator)
................................................

'非同期イテレータ' の ‘__anext__’ メソッドからは非同期のコードが呼べます
。

非同期イテレータは *note async for: ca1. 文の中で使えます。

The *note object: c7e. class itself does not provide these methods.

 -- メソッド: object.__aiter__ (self)

     '非同期イテレータ' オブジェクトを返さなくてはなりません。

 -- メソッド: object.__anext__ (self)

     イテレータの次の値を返す '待機可能オブジェクト' を返さなければなり
     ません。 反復処理が終了したときには *note StopAsyncIteration: 1e0f.
     エラーを送出すべきです。

非同期イテラブルオブジェクトの例:

     class Reader:
         async def readline(self):
             ...

         def __aiter__(self):
             return self

         async def __anext__(self):
             val = await self.readline()
             if val == b'':
                 raise StopAsyncIteration
             return val

Added in version 3.5.

バージョン 3.7 で変更: Python 3.7 より前では、 *note __aiter__(): df6. は
*note 非同期イテレータ: 4c7. になる 'awaitable' を返せました。

Python 3.7 からは、 *note __aiter__(): df6. は非同期イテレータオブジェク
トを返さなければなりません。 それ以外のものを返すと *note TypeError:
198. になります。


File: python.info,  Node: 非同期コンテキストマネージャ Asynchronous Context Manager,  Prev: 非同期イテレータ Asynchronous Iterator,  Up: コルーチン

4.3.4.4 非同期コンテキストマネージャ (Asynchronous Context Manager)
...................................................................

'非同期コンテキストマネージャ' は、 ‘__aenter__’ メソッドと ‘__aexit__’
メソッド内部で実行を一時停止できる 'コンテキストマネージャ' です。

非同期コンテキストマネージャは *note async with: 185. 文の中で使えます。

The *note object: c7e. class itself does not provide these methods.

 -- メソッド: object.__aenter__ (self)

     Semantically similar to *note __enter__(): 7e4, the only difference
     being that it must return an 'awaitable'.

 -- メソッド: object.__aexit__ (self, exc_type, exc_value, traceback)

     Semantically similar to *note __exit__(): 1518, the only difference
     being that it must return an 'awaitable'.

非同期コンテキストマネージャクラスの例:

     class AsyncContextManager:
         async def __aenter__(self):
             await log('entering context')

         async def __aexit__(self, exc_type, exc, tb):
             await log('exiting context')

Added in version 3.5.

脚注
....


File: python.info,  Node: 実行モデル,  Next: インポートシステム,  Prev: データモデル,  Up: Python 言語リファレンス

4.4 実行モデル
==============

* Menu:

* プログラムの構造::
* 名前づけと束縛 (naming and binding): 名前づけと束縛 naming and binding.
* 例外: 例外<2>.
* Runtime Components::


File: python.info,  Node: プログラムの構造,  Next: 名前づけと束縛 naming and binding,  Up: 実行モデル

4.4.1 プログラムの構造
----------------------

Python プログラムはコードブロックから構成されます。 ブロック ('block') は
、一つのまとまりとして実行される Python プログラムテキストの断片です。 モ
ジュール、関数本体、そしてクラス定義はブロックであり、対話的に入力された
個々のコマンドもブロックです。 スクリプトファイル (インタープリタに標準
入力として与えられたり、インタープリタにコマンドライン引数として与えられ
たファイル) もコードブロックです。 スクリプトコマンド (インタープリタの
コマンドライン上で *note -c: 1a8. オプションで指定されたコマンド) もコー
ドブロックです。 引数 *note -m: 23c. を使用して、コマンドラインからトッ
プレベルスクリプト(すなわちモジュール ‘__main__’ )として実行されるモジュ
ールもまたコードブロックです。組み込み関数 *note eval(): 4a3. や *note
exec(): 4a2. に渡された文字列引数もコードブロックです。

コードブロックは、実行フレーム ('execution frame') 上で実行されます。実
行フレームには、 (デバッグに使われる) 管理情報が収められています。また、
現在のコードブロックの実行が完了した際に、どのようにプログラムの実行を継
続するかを決定しています。


File: python.info,  Node: 名前づけと束縛 naming and binding,  Next: 例外<2>,  Prev: プログラムの構造,  Up: 実行モデル

4.4.2 名前づけと束縛 (naming and binding)
-----------------------------------------

* Menu:

* 名前の束縛::
* 名前解決::
* Annotation scopes::
* Lazy evaluation::
* 組み込みと制限付きの実行::
* 動的な機能とのやりとり::


File: python.info,  Node: 名前の束縛,  Next: 名前解決,  Up: 名前づけと束縛 naming and binding

4.4.2.1 名前の束縛
..................

'名前 (name)' は、オブジェクトを参照します。名前を導入するには、名前への
束縛 (name binding) 操作を行います。

以下の構文が名前を束縛します:

   * formal parameters to functions,

   * クラス定義,

   * 関数定義,

   * 代入式,

   * *note targets: 2427. that are identifiers if occurring in an
     assignment:

        + *note for: 34a. loop header,

        + after ‘as’ in a *note with: 186. statement, *note except: 1ab.
          clause, *note except*: 1ac. clause, or in the as-pattern in
          structural pattern matching,

        + in a capture pattern in structural pattern matching

   * *note import: 7f8. 文.

   * *note type: 66d. statements.

   * *note type parameter lists: 5ad.

The ‘import’ statement of the form ‘from ... import *’ binds all names
defined in the imported module, except those beginning with an
underscore.  This form may only be used at the module level.

*note del: 1b1f. 文で指定される対象は、(*note del: 1b1f. の意味付けは、
実際は名前の解放 (unbind) ですが) 文の目的上、束縛済みのものとみなされま
す。

代入文や import 文はいずれも、クラスや関数定義、モジュールレベル (トップ
レベルのコードブロック) 内で起こります。

If a name is bound in a block, it is a local variable of that block,
unless declared as *note nonlocal: 14bf. or *note global: 4ac.  If a
name is bound at the module level, it is a global variable.  (The
variables of the module code block are local and global.)  If a variable
is used in a code block but not defined there, it is a *note free
variable: 2428.

プログラムテキスト中に名前が出現するたびに、その名前が使われている最も内
側の関数ブロック中で作成された '束縛 (binding)' を使って名前の参照が行わ
れます。


File: python.info,  Node: 名前解決,  Next: Annotation scopes,  Prev: 名前の束縛,  Up: 名前づけと束縛 naming and binding

4.4.2.2 名前解決
................

スコープ ('scope') は、ブロック内の名前の可視性を決めます。 ローカル変数
があるブロック内で定義されている場合、変数のスコープはそのブロックを含み
ます。 関数ブロック内で名前の定義を行った場合、その中のブロックが名前に
別の束縛を行わない限り、定義ブロック内の全てのブロックを含むようにスコー
プが拡張されます。

ある名前がコードブロック内で使われると、その名前を最も近傍から囲うような
スコープ (最内スコープ: nearest enclosing scope) を使って束縛の解決を行
います。こうしたスコープからなる、あるコードブロック内で参照できるスコー
プ全ての集合は、ブロックの環境('environment')と呼ばれます。

名前が全く見付からなかったときは、 *note NameError: 452. 例外が送出され
ます。 現在のスコープが関数のもので、名前が使われる場所でローカル変数が
まだ値に束縛されていない場合、 *note UnboundLocalError: 174f. 例外が送出
されます。 *note UnboundLocalError: 174f. は *note NameError: 452. の子
クラスです。

ある名前がコードブロック内のどこかで束縛操作されていたら、そのブロック内
で使われるその名前はすべて、現在のブロックへの参照として扱われます。この
ため、ある名前がそのブロック内で束縛される前に使われるとエラーにつながり
ます。この規則は敏感です。Python には宣言がなく、コードブロックのどこで
も名前束縛操作ができます。あるコードブロックにおけるローカル変数は、ブロ
ックのテキスト全体から名前束縛操作を走査することで決定されます。例は
*note UnboundLocalError についての FAQ 項目: 242b. を参照してください。

If the *note global: 4ac. statement occurs within a block, all uses of
the names specified in the statement refer to the bindings of those
names in the top-level namespace.  Names are resolved in the top-level
namespace by searching the global namespace, i.e.  the namespace of the
module containing the code block, and the builtins namespace, the
namespace of the module *note builtins: 13.  The global namespace is
searched first.  If the names are not found there, the builtins
namespace is searched next.  If the names are also not found in the
builtins namespace, new variables are created in the global namespace.
The global statement must precede all uses of the listed names.

*note global: 4ac. 文は、同じブロックの束縛操作と同じスコープを持ちます
。ある自由変数の最内スコープに global 文がある場合、その自由変数はグロー
バル変数とみなされます。

The *note nonlocal: 14bf. statement causes corresponding names to refer
to previously bound variables in the nearest enclosing function scope.
*note SyntaxError: 18e. is raised at compile time if the given name does
not exist in any enclosing function scope.  *note Type parameters: 5ad.
cannot be rebound with the ‘nonlocal’ statement.

あるモジュールの名前空間は、そのモジュールが最初に import された時に自動
的に作成されます。スクリプトの主モジュール (main module) は常に *note
__main__: 1. と呼ばれます。

Class definition blocks and arguments to *note exec(): 4a2. and *note
eval(): 4a3. are special in the context of name resolution.  A class
definition is an executable statement that may use and define names.
These references follow the normal rules for name resolution with an
exception that unbound local variables are looked up in the global
namespace.  The namespace of the class definition becomes the attribute
dictionary of the class.  The scope of names defined in a class block is
limited to the class block; it does not extend to the code blocks of
methods.  This includes comprehensions and generator expressions, but it
does not include *note annotation scopes: 4ab, which have access to
their enclosing class scopes.  This means that the following will fail:

     class A:
         a = 42
         b = list(a + i for i in range(10))

However, the following will succeed:

     class A:
         type Alias = Nested
         class Nested: pass

     print(A.Alias.__value__)  # <type 'A.Nested'>


File: python.info,  Node: Annotation scopes,  Next: Lazy evaluation,  Prev: 名前解決,  Up: 名前づけと束縛 naming and binding

4.4.2.3 Annotation scopes
.........................

*note Annotations: 15c, *note type parameter lists: 5ad. and *note type:
66d. statements introduce 'annotation scopes', which behave mostly like
function scopes, but with some exceptions discussed below.

Annotation scopes are used in the following contexts:

   * *note Function annotations: 2019.

   * *note Variable annotations: f51.

   * Type parameter lists for *note generic type aliases: 684.

   * Type parameter lists for *note generic functions: 682.  A generic
     function's annotations are executed within the annotation scope,
     but its defaults and decorators are not.

   * Type parameter lists for *note generic classes: 2377.  A generic
     class's base classes and keyword arguments are executed within the
     annotation scope, but its decorators are not.

   * The bounds, constraints, and default values for type parameters
     (*note lazily evaluated: 685.).

   * The value of type aliases (*note lazily evaluated: 685.).

Annotation scopes differ from function scopes in the following ways:

   * Annotation scopes have access to their enclosing class namespace.
     If an annotation scope is immediately within a class scope, or
     within another annotation scope that is immediately within a class
     scope, the code in the annotation scope can use names defined in
     the class scope as if it were executed directly within the class
     body.  This contrasts with regular functions defined within
     classes, which cannot access names defined in the class scope.

   * Expressions in annotation scopes cannot contain *note yield: bc2,
     ‘yield from’, *note await: 18d, or *note ;=: 242d. expressions.
     (These expressions are allowed in other scopes contained within the
     annotation scope.)

   * Names defined in annotation scopes cannot be rebound with *note
     nonlocal: 14bf. statements in inner scopes.  This includes only
     type parameters, as no other syntactic elements that can appear
     within annotation scopes can introduce new names.

   * While annotation scopes have an internal name, that name is not
     reflected in the *note qualified name: 1d24. of objects defined
     within the scope.  Instead, the *note __qualname__: 1271. of such
     objects is as if the object were defined in the enclosing scope.

Added in version 3.12: Annotation scopes were introduced in Python 3.12
as part of PEP 695(1).

バージョン 3.13 で変更: Annotation scopes are also used for type
parameter defaults, as introduced by PEP 696(2).

バージョン 3.14 で変更: Annotation scopes are now also used for
annotations, as specified in PEP 649(3) and PEP 749(4).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0695/

   (2) https://peps.python.org/pep-0696/

   (3) https://peps.python.org/pep-0649/

   (4) https://peps.python.org/pep-0749/


File: python.info,  Node: Lazy evaluation,  Next: 組み込みと制限付きの実行,  Prev: Annotation scopes,  Up: 名前づけと束縛 naming and binding

4.4.2.4 Lazy evaluation
.......................

Most annotation scopes are 'lazily evaluated'.  This includes
annotations, the values of type aliases created through the *note type:
66d. statement, and the bounds, constraints, and default values of type
variables created through the *note type parameter syntax: 5ad.  This
means that they are not evaluated when the type alias or type variable
is created, or when the object carrying annotations is created.
Instead, they are only evaluated when necessary, for example when the
‘__value__’ attribute on a type alias is accessed.

例:

     >>> type Alias = 1/0
     >>> Alias.__value__
     Traceback (most recent call last):
       ...
     ZeroDivisionError: division by zero
     >>> def func[T: 1/0](): pass
     >>> T = func.__type_params__[0]
     >>> T.__bound__
     Traceback (most recent call last):
       ...
     ZeroDivisionError: division by zero

Here the exception is raised only when the ‘__value__’ attribute of the
type alias or the ‘__bound__’ attribute of the type variable is
accessed.

This behavior is primarily useful for references to types that have not
yet been defined when the type alias or type variable is created.  For
example, lazy evaluation enables creation of mutually recursive type
aliases:

     from typing import Literal

     type SimpleExpr = int | Parenthesized
     type Parenthesized = tuple[Literal["("], Expr, Literal[")"]]
     type Expr = SimpleExpr | tuple[SimpleExpr, Literal["+", "-"], Expr]

Lazily evaluated values are evaluated in *note annotation scope: 4ab,
which means that names that appear inside the lazily evaluated value are
looked up as if they were used in the immediately enclosing scope.

Added in version 3.12.


File: python.info,  Node: 組み込みと制限付きの実行,  Next: 動的な機能とのやりとり,  Prev: Lazy evaluation,  Up: 名前づけと束縛 naming and binding

4.4.2.5 組み込みと制限付きの実行
................................

ユーザは ‘__builtins__’ に触れるべきではありません; これは厳密に実装の詳
細です。組み込みの名前空間の中の値をオーバーライドしたいユーザは、 *note
builtins: 13. モジュールを *note import: 7f8. して、その属性を適切に変更
するべきです。

あるコードブロックの実行に関連する組み込み名前空間は、実際にはコードブロ
ックのグローバル名前空間から名前 ‘__builtins__’ を検索することで見つかり
ます; ‘__builtins__’ は辞書かモジュールでなければなりません (後者の場合
はモジュールの辞書が使われます)。デフォルトでは、 *note __main__: 1. モ
ジュール中においては、 ‘__builtins__’ は組み込みモジュール *note
builtins: 13. です; それ以外の任意のモジュールにおいては、
‘__builtins__’ は *note builtins: 13. モジュール自身の辞書のエイリアスで
す。


File: python.info,  Node: 動的な機能とのやりとり,  Prev: 組み込みと制限付きの実行,  Up: 名前づけと束縛 naming and binding

4.4.2.6 動的な機能とのやりとり
..............................

自由変数の名前解決はコンパイル時でなく実行時に行われます。つまり、以下の
コードは42を出力します:

     i = 10
     def f():
         print(i)
     i = 42
     f()

*note eval(): 4a3. と *note exec(): 4a2. 関数は、名前の解決に、現在の環
境の全てを使えるわけではありません。名前は呼び出し側のローカルやグローバ
ル名前空間で解決できます。自由変数は最内名前空間ではなく、グローバル名前
空間から解決されます。 (1) *note exec(): 4a2. と *note eval(): 4a3. 関数
にはオプションの引数があり、グローバルとローカル名前空間をオーバライドで
きます。名前空間が一つしか指定されなければ、両方の名前空間として使われま
す。

   ---------- Footnotes ----------

   (1) この制限は、上記の操作によって実行されるコードが、モジュールをコ
ンパイルしたときには利用できないために起こります。


File: python.info,  Node: 例外<2>,  Next: Runtime Components,  Prev: 名前づけと束縛 naming and binding,  Up: 実行モデル

4.4.3 例外
----------

例外とは、コードブロックの通常の制御フローを中断して、エラーやその他の例
外的な状況を処理できるようにするための手段です。例外はエラーが検出された
時点で '送出 (raise)' されます; 例外は、エラーが発生部の周辺のコードブロ
ックか、エラーが発生したコードブロック直接または間接的に呼び出しているコ
ードブロックで '処理 (handle)' することができます。

Python インタプリタは、ランタイムエラー (ゼロ除算など) が検出されると例
外を送出します。Python プログラムから、 *note raise: 803. 文を使って明示
的に例外を送出することもできます。例外ハンドラ (exception handler) は、
*note try: 8f8. ...  *note except: 1ab. 文で指定することができます。
*note try: 8f8. 文の *note finally: 1b0. 節を使うとクリーンアップコード
(cleanup code) を指定できます。このコードは例外は処理しませんが、先行す
るコードブロックで例外が起きても起きなくても実行されます。

Python は、エラー処理に "プログラムの終了 (termination)" モデルを用いて
います: 例外ハンドラは、プログラムに何が発生したかを把握することができ、
ハンドラの外側のレベルに処理を継続することはできますが、(問題のあったコ
ード部分を最初から実行しなおすのでない限り) エラーの原因を修復したり、実
行に失敗した操作をやり直すことはできません。

例外が全く処理されないとき、インタプリタはプログラムの実行を終了させるか
、対話メインループに処理を戻します。 どちらの場合も、例外が *note
SystemExit: f3c. でなければ、スタックのトレースバックを出力します。

例外は、クラスインスタンスによって識別されます。 *note except: 1ab. 節は
インスタンスのクラスにもとづいて選択されます: これはインスタンスのクラス
か、その *note 非仮想基底クラス: 13ce. を参照します。このインスタンスは
ハンドラによって受け取られ、例外条件に関する追加情報を伝えることができま
す。

     注釈: 例外のメッセージは、Python API 仕様には含まれていません。メッ
     セージの内容は、ある Python のバージョンと次のバージョンの間で警告
     なしに変更される可能性があるので、複数バージョンのインタプリタで動
     作するようなコードは、例外メッセージの内容に依存させるべきではあり
     ません。

*note try: 8f8. 文については、 *note try 文: 8f8. 節、 *note raise: 803.
文については *note raise 文: 803. 節も参照してください。


File: python.info,  Node: Runtime Components,  Prev: 例外<2>,  Up: 実行モデル

4.4.4 Runtime Components
------------------------

* Menu:

* General Computing Model::
* Python Runtime Model::


File: python.info,  Node: General Computing Model,  Next: Python Runtime Model,  Up: Runtime Components

4.4.4.1 General Computing Model
...............................

Python's execution model does not operate in a vacuum.  It runs on a
host machine and through that host's runtime environment, including its
operating system (OS), if there is one.  When a program runs, the
conceptual layers of how it runs on the host look something like this:

          'host machine'
               'process' (global resources)
                    'thread' (runs machine code)

Each process represents a program running on the host.  Think of each
process itself as the data part of its program.  Think of the process'
threads as the execution part of the program.  This distinction will be
important to understand the conceptual Python runtime.

The process, as the data part, is the execution context in which the
program runs.  It mostly consists of the set of resources assigned to
the program by the host, including memory, signals, file handles,
sockets, and environment variables.

Processes are isolated and independent from one another.  (The same is
true for hosts.)  The host manages the process' access to its assigned
resources, in addition to coordinating between processes.

Each thread represents the actual execution of the program's machine
code, running relative to the resources assigned to the program's
process.  It's strictly up to the host how and when that execution takes
place.

From the point of view of Python, a program always starts with exactly
one thread.  However, the program may grow to run in multiple
simultaneous threads.  Not all hosts support multiple threads per
process, but most do.  Unlike processes, threads in a process are not
isolated and independent from one another.  Specifically, all threads in
a process share all of the process' resources.

The fundamental point of threads is that each one does 'run'
independently, at the same time as the others.  That may be only
conceptually at the same time ("concurrently") or physically ("in
parallel").  Either way, the threads effectively run at a
non-synchronized rate.

     注釈: That non-synchronized rate means none of the process' memory
     is guaranteed to stay consistent for the code running in any given
     thread.  Thus multi-threaded programs must take care to coordinate
     access to intentionally shared resources.  Likewise, they must take
     care to be absolutely diligent about not accessing any 'other'
     resources in multiple threads; otherwise two threads running at the
     same time might accidentally interfere with each other's use of
     some shared data.  All this is true for both Python programs and
     the Python runtime.

     The cost of this broad, unstructured requirement is the tradeoff
     for the kind of raw concurrency that threads provide.  The
     alternative to the required discipline generally means dealing with
     non-deterministic bugs and data corruption.


File: python.info,  Node: Python Runtime Model,  Prev: General Computing Model,  Up: Runtime Components

4.4.4.2 Python Runtime Model
............................

The same conceptual layers apply to each Python program, with some extra
data layers specific to Python:

          'host machine'
               'process' (global resources)
                    Python global runtime ('state')
                         Python interpreter ('state')
                              'thread' (runs Python bytecode and "C-API")
                                   Python thread 'state'

At the conceptual level: when a Python program starts, it looks exactly
like that diagram, with one of each.  The runtime may grow to include
multiple interpreters, and each interpreter may grow to include multiple
thread states.

     注釈: A Python implementation won't necessarily implement the
     runtime layers distinctly or even concretely.  The only exception
     is places where distinct layers are directly specified or exposed
     to users, like through the *note threading: f3. module.

     注釈: The initial interpreter is typically called the "main"
     interpreter.  Some Python implementations, like CPython, assign
     special roles to the main interpreter.

     Likewise, the host thread where the runtime was initialized is
     known as the "main" thread.  It may be different from the process'
     initial thread, though they are often the same.  In some cases
     "main thread" may be even more specific and refer to the initial
     thread state.  A Python runtime might assign specific
     responsibilities to the main thread, such as handling signals.

As a whole, the Python runtime consists of the global runtime state,
interpreters, and thread states.  The runtime ensures all that state
stays consistent over its lifetime, particularly when used with multiple
host threads.

The global runtime, at the conceptual level, is just a set of
interpreters.  While those interpreters are otherwise isolated and
independent from one another, they may share some data or other
resources.  The runtime is responsible for managing these global
resources safely.  The actual nature and management of these resources
is implementation-specific.  Ultimately, the external utility of the
global runtime is limited to managing interpreters.

In contrast, an "interpreter" is conceptually what we would normally
think of as the (full-featured) "Python runtime".  When machine code
executing in a host thread interacts with the Python runtime, it calls
into Python in the context of a specific interpreter.

     注釈: The term "interpreter" here is not the same as the "bytecode
     interpreter", which is what regularly runs in threads, executing
     compiled Python code.

     In an ideal world, "Python runtime" would refer to what we
     currently call "interpreter".  However, it's been called
     "interpreter" at least since introduced in 1997
     (CPython:a027efa5b(1)).

Each interpreter completely encapsulates all of the non-process-global,
non-thread-specific state needed for the Python runtime to work.
Notably, the interpreter's state persists between uses.  It includes
fundamental data like *note sys.modules: 17e6.  The runtime ensures
multiple threads using the same interpreter will safely share it between
them.

A Python implementation may support using multiple interpreters at the
same time in the same process.  They are independent and isolated from
one another.  For example, each interpreter has its own *note
sys.modules: 17e6.

For thread-specific runtime state, each interpreter has a set of thread
states, which it manages, in the same way the global runtime contains a
set of interpreters.  It can have thread states for as many host threads
as it needs.  It may even have multiple thread states for the same host
thread, though that isn't as common.

Each thread state, conceptually, has all the thread-specific runtime
data an interpreter needs to operate in one host thread.  The thread
state includes the current raised exception and the thread's Python call
stack.  It may include other thread-specific resources.

     注釈: The term "Python thread" can sometimes refer to a thread
     state, but normally it means a thread created using the *note
     threading: f3. module.

Each thread state, over its lifetime, is always tied to exactly one
interpreter and exactly one host thread.  It will only ever be used in
that thread and with that interpreter.

Multiple thread states may be tied to the same host thread, whether for
different interpreters or even the same interpreter.  However, for any
given host thread, only one of the thread states tied to it can be used
by the thread at a time.

Thread states are isolated and independent from one another and don't
share any data, except for possibly sharing an interpreter and objects
or other resources belonging to that interpreter.

Once a program is running, new Python threads can be created using the
*note threading: f3. module (on platforms and Python implementations
that support threads).  Additional processes can be created using the
*note os: a5, *note subprocess: dc, and *note multiprocessing: 98.
modules.  Interpreters can be created and used with the *note
interpreters: 25. module.  Coroutines (async) can be run using *note
asyncio: b. in each interpreter, typically only in a single thread
(often the main thread).

脚注
....

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/commit/a027efa5b


File: python.info,  Node: インポートシステム,  Next: 式 expression,  Prev: 実行モデル,  Up: Python 言語リファレンス

4.5 インポートシステム
======================

ある 1 つの *note module: 19de. にある Python コードから他のモジュールを
*note インポート: 243c. することで、そこにあるコードへアクセスできるよう
になります。 *note import: 7f8. 文はインポート機構を動かす最も一般的な方
法ですが、それが唯一の方法ではありません。 *note
importlib.import_module(): 73c. や組み込みの *note __import__(): ad1. と
いった関数を使っても、インポート機構を動かすことができます。

*note import: 7f8. 文は 2 つの処理を連続して行っています; ある名前のモジ
ュールを探し、その検索結果をローカルスコープの名前に束縛します。
‘import’ 文の検索処理は、適切な引数で *note __import__(): ad1. 関数を呼
び出すこととして定義されています。 *note __import__(): ad1. の戻り値は
‘import’ 文の名前束縛処理の実行で使われます。名前束縛処理の厳密な詳細は
‘import’ 文を参照してください。

*note __import__(): ad1. を直接呼び出すとモジュールの検索のみが行われ、
見つかった場合、モジュールの作成処理が行われます。親パッケージのインポー
トや (*note sys.modules: 17e6. を含む) 様々なキャッシュの更新などの副作
用は起きるかもしれませんが、 *note import: 7f8. 文のみが名前束縛処理を行
います。

*note import: 7f8. 文が実行されるときには、標準の組み込み関数 *note
__import__(): ad1. が呼ばれます。インポートシステムを呼び出すその他の
(*note importlib.import_module(): 73c. 関数のような) メカニズムは、*note
__import__(): ad1. の呼び出しをバイパスして独自のインポート・セマンティ
クスを実装している可能性があります。

モジュールが初めてインポートされるとき、 Python はそのモジュールを検索し
、見付かった場合、モジュールオブジェクトを作成し、初期化します (1) 。そ
の名前のモジュールが見付からなかった場合、 *note ModuleNotFoundError:
d3d. が送出されます。 Python には、インポート機構が実行されたときに名前
からモジュールを検索する様々な戦略が実装されています。これらの戦略は、こ
れ以降の節で解説される様々なフックを使って、修正したり拡張したりできます
。

バージョン 3.3 で変更: インポートシステムが PEP 302(2) の第 2 フェーズの
完全な実装へ更新されました。もはや暗黙的なインポート機構はありません - イ
ンポート機構全体は *note sys.meta_path: f27. を通して公開されています。
加えて、ネイティブの名前空間パッケージのサポートは実装されています ( PEP
420(3) を参照) 。

* Menu:

* importlib: importlib<10>.
* パッケージ: パッケージ<2>.
* 検索::
* ロード::
* パスベース・ファインダー::
* 標準のインポートシステムを置き換える::
* Package Relative Imports::
* __main__ に対する特別な考慮::
* 参考資料::

   ---------- Footnotes ----------

   (1) *note types.ModuleType: 1014. を参照してください。

   (2) https://peps.python.org/pep-0302/

   (3) https://peps.python.org/pep-0420/


File: python.info,  Node: importlib<10>,  Next: パッケージ<2>,  Up: インポートシステム

4.5.1 ‘importlib’
-----------------

*note importlib: 7b. モジュールはインポート機構とやり取りするための便利
な API を提供します。例えば *note importlib.import_module(): 73c. は、イ
ンポート機構を実行するための組み込みの *note __import__(): ad1. よりもシ
ンプルで推奨される API を提供します。より詳細なことは *note importlib:
7b. ライブラリのドキュメントを参照してください。


File: python.info,  Node: パッケージ<2>,  Next: 検索,  Prev: importlib<10>,  Up: インポートシステム

4.5.2 パッケージ
----------------

Python にはモジュールオブジェクトの種類は 1 種類しかなく、 Python 、 C 、
それ以外のもののどれで実装されているかに関係なく、すべてのモジュールはこ
の種類になります。モジュールの組織化を助け、名前階層を提供するために、
Python には *note パッケージ: 233. という概念があります。

パッケージはファイルシステムのディレクトリ、モジュールはディレクトリにあ
るファイルと考えることができますが、パッケージやモジュールはファイルシス
テムから生まれる必要はないので、この比喩を額面通りに受け取ってはいけませ
ん。この文書の目的のために、ディレクトリとファイルという便利な比喩を使う
ことにします。ファイルシステムのディレクトリのように、パッケージは階層構
造を成し、通常のモジュールだけでなく、サブパッケージを含むこともあります
。

すべてのパッケージはモジュールですが、すべてのモジュールがパッケージとは
限らないことを心に留めておくのが重要です。もしくは他の言い方をすると、パ
ッケージは単なる特別な種類のモジュールであると言えます。特に、‘__path__’
属性を持つ任意のモジュールはパッケージと見なされます。

すべてのモジュールは名前を持ちます。Python の属性アクセスの文法と同様に
、サブパッケージの名前は親パッケージ名とドット記号で区切られます。したが
って、*note email: 3f. という名前のパッケージや、それが含む *note
email.mime: 49. という名前のサブパッケージ、さらにそれに含まれる *note
email.mime.text: 51. と言う名前のモジュールを考えることができます。

* Menu:

* 通常のパッケージ::
* 名前空間パッケージ::


File: python.info,  Node: 通常のパッケージ,  Next: 名前空間パッケージ,  Up: パッケージ<2>

4.5.2.1 通常のパッケージ
........................

Python では、 *note 通常のパッケージ: 2440. と *note 名前空間パッケージ:
2b2. の 2 種類のパッケージが定義されています。通常のパッケージは Python
3.2 以前から存在する伝統的なパッケージです。典型的な通常のパッケージは
‘__init__.py’ ファイルを含むディレクトリとして実装されます。通常のパッケ
ージがインポートされたとき、この ‘__init__.py’ ファイルが暗黙的に実行さ
れ、それで定義しているオブジェクトがパッケージ名前空間にある名前に束縛さ
れます。 ‘__init__.py’ ファイルは、他のモジュールに書ける Python コード
と同じものを含むことができ、モジュールがインポートされたときに Python は
モジュールに属性を追加したりします。

例えば、以下のようなファイルシステム配置は、3 つのサブパッケージを持つ最
上位の ‘parent’ パッケージを定義します:

     parent/
         __init__.py
         one/
             __init__.py
         two/
             __init__.py
         three/
             __init__.py

‘parent.one’ をインポートすると暗黙的に ‘parent/__init__.py’ と
‘parent/one/__init__.py’ が実行されます。その後に ‘parent.two’ もしくは
‘parent.three’ をインポートすると、それぞれ ‘parent/two/__init__.py’ や
‘parent/three/__init__.py’ が実行されます。


File: python.info,  Node: 名前空間パッケージ,  Prev: 通常のパッケージ,  Up: パッケージ<2>

4.5.2.2 名前空間パッケージ
..........................

名前空間パッケージは様々な *note ポーション: 2443. を寄せ集めたもので、
それぞれのポーションはサブパッケージを親パッケージに提供します。ポーショ
ンはファイルシステムの別々の場所にあることもあります。ポーションは、 zip
ファイルの中やネットワーク上や、それ以外のインポート時に Python が探すど
こかの場所で見つかることもあります。名前空間パッケージはファイルシステム
上のオブジェクトに対応することもあるし、そうでないこともあります; それら
は実際の実体のない仮想モジュールです。

名前空間パッケージは、 ‘__path__’ 属性に普通のリストは使いません。その代
わりに独自の iterable 型を使っていて、ポーションの親パッケージのパス (も
しくは最上位パッケージのための *note sys.path: 3e4.) が変わった場合、そ
のパッケージでの次のインポートの際に、新たに自動でパッケージポーションを
検索します。

名前空間パッケージには ‘parent/__init__.py’ ファイルはありません。それど
ころか、異なるポーションがそれぞれ提供する複数の ‘parent’ ディレクトリが
インポート検索の際に見つかることもあります。したがって ‘parent/one’ は物
理的に ‘parent/two’ の隣りにあるとは限りません。その場合、そのパッケージ
かサブパッケージのうち 1 つがインポートされたとき、Python は最上位の
‘parent’ パッケージのための名前空間パッケージを作成します。

名前空間パッケージの仕様については PEP 420(1) も参照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0420/


File: python.info,  Node: 検索,  Next: ロード,  Prev: パッケージ<2>,  Up: インポートシステム

4.5.3 検索
----------

検索を始めるためには、 Python はインポートされるモジュール (もしくはパッ
ケージですが、ここでの議論の目的においてはささいな違いです) の *note
完全修飾: 1d24. 名を必要とします。この名前は、 *note import: 7f8. 文の様
々な引数や *note importlib.import_module(): 73c. および *note
__import__(): ad1. 関数のパラメータから得られます。

この名前はインポート検索の様々なフェーズで使われ、これは例えば
‘foo.bar.baz’ のようなドットで区切られたサブモジュールへのパスだったりし
ます。この場合、 Python は最初に ‘foo’ を、次に ‘foo.bar’ 、そして最後に
‘foo.bar.baz’ をインポートしようとします。中間のいずれかのインポートに失
敗した場合は、 *note ModuleNotFoundError: d3d. が送出されます。

* Menu:

* モジュールキャッシュ::
* ファインダーとローダー::
* インポートフック::
* メタパス::


File: python.info,  Node: モジュールキャッシュ,  Next: ファインダーとローダー,  Up: 検索

4.5.3.1 モジュールキャッシュ
............................

インポート検索で最初に調べる場所は *note sys.modules: 17e6. です。このマ
ッピングは、中間のパスを含む、これまでにインポートされたすべてのモジュー
ルのキャッシュを提供します。なので ‘foo.bar.baz’ がインポート済みの場合
、 *note sys.modules: 17e6. は ‘foo’ 、 ‘foo.bar’ 、 ‘foo.bar.baz’ のエ
ントリーを含みます。それぞれのキーはその値として対応するモジュールオブジ
ェクトを持ちます。

インポートではモジュール名は *note sys.modules: 17e6. から探され、存在し
た場合は、対応する値がインポートされるべきモジュールであり、この処理は完
了します。しかし値が ‘None’ だった場合、 *note ModuleNotFoundError: d3d.
が送出されます。モジュール名が見付からなかった場合は、 Python はモジュー
ルの検索を続けます。

*note sys.modules: 17e6. は書き込み可能です。キーの削除は対応するモジュ
ールを破壊しない (他のモジュールがそのモジュールへの参照を持っている) か
もしれませんが、指定されたモジュールのキャッシュされたエントリーを無効に
し、それが次にインポートされたとき Python にそのモジュールを改めて検索さ
せることになります。キーを ‘None’ に対応付けることもできますが、次にその
モジュールがインポートされるときに *note ModuleNotFoundError: d3d. とな
ってしまいます。

たとえモジュールオブジェクトへの参照を保持しておいて、 *note
sys.modules: 17e6. にキャッシュされたエントリーを無効にし、その指定した
モジュールを再インポートしたとしても、 2 つのモジュールオブジェクトは同
じでは 'ない' ことに注意してください。それとは対照的に、 *note
importlib.reload(): 73d. は '同じ' モジュールオブジェクトを再利用し、モ
ジュールのコードを再実行することで単にモジュールの内容を再初期化するだけ
です。


File: python.info,  Node: ファインダーとローダー,  Next: インポートフック,  Prev: モジュールキャッシュ,  Up: 検索

4.5.3.2 ファインダーとローダー
..............................

*note sys.modules: 17e6. に指定されたモジュールが見つからなかった場合は
、 Python のインポートプロトコルが起動され、モジュールを見つけロードしま
す。このプロトコルは 2 つの概念的なオブジェクト、 *note ファインダー:
236a. と *note ローダー: 1a28. から成ります。ファインダーの仕事は、知っ
ている戦略を使って指定されたモジュールを見つけられるかどうか判断すること
です。両方のインターフェースを実装しているオブジェクトは *note
インポーター: 2448. と呼ばれます - インポーターは要求されたモジュールが
ロードできると分かったとき、自分自身を返します。

Python にはデフォルトのファインダーとインポーターがいくつかあります。 1
つ目のものは組み込みモジュールの見つけ方を知っていて、 2 つ目のものは凍
結されたモジュール (訳注: freeze ツールで処理されたモジュールのこと。
*note プログラミング FAQ: 2449. の「どうしたら Python スクリプトからスタ
ンドアロンバイナリを作れますか？」の項目を参照) の見つけ方を知っています
。 3 つ目のものは *note インポートパス: 244a. からモジュールを探します。
*note インポートパス: 244a. はファイルシステムのパスや zip ファイルの位
置を示すリストです。このリストは、 URL で特定できるもののような、位置を
示すことのできる任意のリソースの検索にまで拡張することもできます。

インポート機構は拡張可能なので、モジュール検索の範囲とスコープを拡張する
ために新しいファインダーを付け加えることができます。

ファインダーは実際にはモジュールをロードしません。指定されたモジュールが
見つかった場合、ファインダーは 'module spec' (モジュール仕様)、すなわち
モジュールのインポート関連の情報をカプセル化したものを返します。モジュー
ルのロード時にインポート機構はそれを利用します。

次の節では、インポート機構を拡張するための新しいファインダーやローダーの
作成と登録を含め、ファインダーとローダーのプロトコルについてより詳しく解
説します。

バージョン 3.4 で変更: Python の以前のバージョンでは、ファインダーは直接
*note ローダー: 1a28. を返していましたが、現在はローダーを '含む' モジュ
ール仕様を返します。ローダーはインポート中はまだ使われていますが、責任は
減りました。


File: python.info,  Node: インポートフック,  Next: メタパス,  Prev: ファインダーとローダー,  Up: 検索

4.5.3.3 インポートフック
........................

インポート機構は拡張可能なように設計されています; その主となる仕組みは
'インポートフック' です。インポートフックには 2 種類あります: 'メタフッ
ク' と 'インポートパスフック' です。

メタフックはインポート処理の最初、 *note sys.modules: 17e6. キャッシュの
検索以外のインポート処理より前に呼び出されます。これにより、 *note
sys.path: 3e4. の処理や凍結されたモジュールや組み込みのモジュールでさえ
も、メタフックで上書きすることができます。メタフックは以下で解説するよう
に、 *note sys.meta_path: f27. に新しいファインダーオブジェクトを追加す
ることで登録されます。

インポートパスフックは、 *note sys.path: 3e4. (もしくは
‘package.__path__’) の処理の一部として、対応するパス要素を取り扱うところ
で呼び出されます。インポートパスフックは以下で解説するように、新しい呼び
出し可能オブジェクトを *note sys.path_hooks: 1225. に追加することで登録
されます。


File: python.info,  Node: メタパス,  Prev: インポートフック,  Up: 検索

4.5.3.4 メタパス
................

When the named module is not found in *note sys.modules: 17e6, Python
next searches *note sys.meta_path: f27, which contains a list of meta
path finder objects.  These finders are queried in order to see if they
know how to handle the named module.  Meta path finders must implement a
method called *note find_spec(): a68. which takes three arguments: a
name, an import path, and (optionally) a target module.  The meta path
finder can use any strategy it wants to determine whether it can handle
the named module or not.

meta path finder が指定されたモジュールの扱い方を知っている場合は、ファ
インダは spec オブジェクトを返します。指定されたモジュールを扱えない場合
は ‘None’ を返します。 *note sys.meta_path: f27. に対する処理が spec を
返さずにリストの末尾に到達してしまった場合は、 *note
ModuleNotFoundError: d3d. を送出します。その他の送出された例外はそのまま
呼び出し元に伝播され、インポート処理を異常終了させます。

The *note find_spec(): a68. method of meta path finders is called with
two or three arguments.  The first is the fully qualified name of the
module being imported, for example ‘foo.bar.baz’.  The second argument
is the path entries to use for the module search.  For top-level
modules, the second argument is ‘None’, but for submodules or
subpackages, the second argument is the value of the parent package's
‘__path__’ attribute.  If the appropriate ‘__path__’ attribute cannot be
accessed, a *note ModuleNotFoundError: d3d. is raised.  The third
argument is an existing module object that will be the target of loading
later.  The import system passes in a target module only during reload.

メタパスは、1 回のインポート要求で複数回走査される可能性があります。例え
ば、関係するモジュールがどれもまだキャッシュされていないとしたときに
‘foo.bar.baz’ をインポートすると、最初は各メタパス・ファインダー (‘mpf’)
に対して ‘mpf.find_spec("foo", None, None)’ を呼び出して、最上位のインポ
ート処理を行います。‘foo’ がインポートされた後に、
‘mpf.find_spec("foo.bar", foo.__path__, None)’ を呼び出していく 2 回目の
メタパスの走査が行われ、‘foo.bar’ がインポートされます。‘foo.bar’ のイン
ポートまで行われたら、最後の走査で ‘mpf.find_spec("foo.bar.baz",
foo.bar.__path__, None)’ を呼び出していきます。

あるメタパス・ファインダーは最上位のインポートのみサポートしています。こ
れらのインポーターは、2 つ目の引数に ‘None’ 以外のものが渡されたとき、常
に ‘None’ を返します。

Python のデフォルトの *note sys.meta_path: f27. は 3 つのパスファインダ
ーを持っています。組み込みモジュールのインポートの方法を知っているもの、
凍結されたモジュールのインポートの方法を知っているもの、 *note
インポートパス: 244a. からのモジュールのインポートの方法を知っているもの
(つまり *note パスベース・ファインダー: 244d.) があります。

バージョン 3.4 で変更: The *note find_spec(): a68. method of meta path
finders replaced ‘find_module()’, which is now deprecated.  While it
will continue to work without change, the import machinery will try it
only if the finder does not implement *note find_spec(): a68.

バージョン 3.10 で変更: Use of ‘find_module()’ by the import system now
raises *note ImportWarning: 71e.

バージョン 3.12 で変更: ‘find_module()’ has been removed.  Use *note
find_spec(): a68. instead.


File: python.info,  Node: ロード,  Next: パスベース・ファインダー,  Prev: 検索,  Up: インポートシステム

4.5.4 ロード
------------

モジュール仕様が見つかった場合、インポート機構はモジュールをロードする時
にそれ (およびそれに含まれるローダー) を使います。これは、インポートのロ
ード部分で起こることの近似です:

     module = None
     if spec.loader is not None and hasattr(spec.loader, 'create_module'):
         # It is assumed 'exec_module' will also be defined on the loader.
         module = spec.loader.create_module(spec)
     if module is None:
         module = ModuleType(spec.name)
     # The import-related module attributes get set here:
     _init_module_attrs(spec, module)

     if spec.loader is None:
         # unsupported
         raise ImportError
     if spec.origin is None and spec.submodule_search_locations is not None:
         # namespace package
         sys.modules[spec.name] = module
     elif not hasattr(spec.loader, 'exec_module'):
         module = spec.loader.load_module(spec.name)
     else:
         sys.modules[spec.name] = module
         try:
             spec.loader.exec_module(module)
         except BaseException:
             try:
                 del sys.modules[spec.name]
             except KeyError:
                 pass
             raise
     return sys.modules[spec.name]

以下の詳細に注意してください:

   * *note sys.modules: 17e6. の中に与えられた名前を持つ既存のモジュール
     オブジェクトがあるなら、 import は既にそれを返しているでしょう。

   * モジュールは、ローダーがモジュールコードを実行する前に *note
     sys.modules: 17e6. に存在しています。 モジュールコードが (直接的ま
     たは間接的に) 自分自身をインポートする可能性があるので、これは重要
     です; モジュールを *note sys.modules: 17e6. に追加することで、最悪
     のケースでは無限の再帰が、そして最良のケースでは複数回のロードが、
     前もって防止されます。

   * ロード処理に失敗した場合、その失敗したモジュールは - そして、そのモ
     ジュールだけが - *note sys.modules: 17e6. から取り除かれます。
     *note sys.modules: 17e6. キャッシュに既に含まれていたすべてのモジュ
     ールと、副作用としてロードに成功したすべてのモジュールは、常にキャ
     ッシュに残されます。これはリロードとは対照的で、リロードの場合は失
     敗したモジュールも *note sys.modules: 17e6. に残されます。

   * *note 後のセクション: 2361. で要約されるように、モジュールが作られ
     てから実行されるまでの間にインポート機構はインポート関連のモジュー
     ル属性を設定します (上記擬似コード例の "_init_module_attrs")。

   * モジュール実行はモジュールの名前空間が構築されるロードの重要な瞬間
     です。実行はローダーに完全に委任され、ローダーは何をどのように構築
     するかを決定することになります。

   * ロードの間に作成されて exec_module() に渡されたモジュールは、インポ
     ートの終わりに返されるものとは異なるかもしれません (1)。

バージョン 3.4 で変更: インポートシステムはローダーの定型的な責任を引き
継ぎました。これらは以前は *note importlib.abc.Loader.load_module():
a69. メソッドによって実行されました。

* Menu:

* ローダー::
* サブモジュール::
* Module specs::
* __path__ attributes on modules::
* モジュールの repr::
* キャッシュされたバイトコードの無効化::

   ---------- Footnotes ----------

   (1) importlib の実装は、戻り値を直接使うことは避けています。その代わ
りに、モジュール名を調べて *note sys.modules: 17e6. からモジュールオブジ
ェクトを得ます。こうすることの間接的な効果は、インポートされたモジュール
が *note sys.modules: 17e6. にいる自分自身を置き換えることがあるというこ
とです。これは実装依存の動作であり、他の Python 実装では保証されていない
動作です。


File: python.info,  Node: ローダー,  Next: サブモジュール,  Up: ロード

4.5.4.1 ローダー
................

モジュールローダーは、ロードの重要な機能であるモジュール実行機能を提供し
ます。インポート機構は、実行しようとするモジュールオブジェクトを単一の引
数として *note importlib.abc.Loader.exec_module(): a6a. メソッドを呼び出
します。 *note importlib.abc.Loader.exec_module(): a6a. から返された任意
の値は無視されます。

ローダーは以下の仕様を満たしていなければいけません:

   * モジュールが (組み込みモジュールや動的に読み込まれる拡張モジュール
     ではなくて) Python モジュールだった場合、ローダーはモジュールのグロ
     ーバル名前空間 (‘module.__dict__’) で、モジュールのコードを実行すべ
     きです。

   * *note exec_module(): a6a. の呼び出し中に *note ImportError: 65b. 以
     外の例外が送出され、伝播されてきたとしても、モジュールをロードでき
     ない場合は *note ImportError: 65b. を送出すべきです。

多くの場合、ファインダーとローダーは同じオブジェクトで構いません; そのよ
うな場合では *note find_spec(): a68. メソッドは単に ‘self’ (訳注: オブジ
ェクト自身) を返すだけです。

モジュールローダーは、 *note create_module(): eac. メソッドを実装するこ
とでロード中にモジュールオブジェクトを作成することを選択できます。このメ
ソッドは、モジュール仕様を引数に取って、ロード中に使う新しいモジュールオ
ブジェクトを返します。 ‘create_module()’ はモジュールオブジェクトに属性
を設定する必要はありません。もしこのメソッドが ‘None’ を返すなら、インポ
ート機構は新しいモジュールを自身で作成します。

Added in version 3.4: ローダーの *note create_module(): eac. メソッド。

バージョン 3.4 で変更: *note load_module(): a69. メソッドは *note
exec_module(): a6a. によって置き換えられ、インポート機構がロードのすべて
の定型的な処理を引き受けました。

既存のローダーとの互換性のため、もしローダーに ‘load_module()’ メソッド
が存在し、かつローダーが ‘exec_module()’ を実装していなければ、インポー
ト機構はローダーの ‘load_module()’ メソッドを使います。しかし、
‘load_module()’ は deprecated であり、ローダーは代わりに ‘exec_module()’
を実装すべきです。

‘load_module()’ メソッドは、モジュールを実行することに加えて上記で説明さ
れたすべての定型的なロード機能を実施しなければなりません。同じ制約が適用
されます。以下は追加の明確化です:

   * *note sys.modules: 17e6. に与えられた名前のモジュールが存在している
     場合、ローダーはその既存のモジュールを使わなければいけません。 (そ
     うしないと *note importlib.reload(): 73d. は正しく動かないでしょう
     。) 指定されたモジュールが *note sys.modules: 17e6. に存在しない場
     合、ローダーは新しいモジュールオブジェクトを作成し、 *note
     sys.modules: 17e6. に追加しなければいけません。

   * 無限の再帰または複数回のロードを防止するために、ローダーがモジュー
     ルコードを実行する前にモジュールは *note sys.modules: 17e6. に存在
     しなければなりません ('must')。

   * ロード処理に失敗した場合、ローダーは *note sys.modules: 17e6. に追
     加したモジュールを取り除かなければいけませんが、それはロードに失敗
     したモジュール 'のみ' を、そのモジュールがローダー自身に明示的にロ
     ードされた場合に限り、除去しなければなりません。

バージョン 3.5 で変更: ‘exec_module()’ が定義されていて
‘create_module()’ が定義されていない場合、 *note DeprecationWarning:
1a3. が送出されるようになりました。

バージョン 3.6 で変更: ‘exec_module()’ が定義されていて
‘create_module()’ が定義されていない場合、 *note ImportError: 65b. が送
出されるようになりました。

バージョン 3.10 で変更: ‘load_module()’ を使用すると *note
ImportWarning: 71e. が発生します。


File: python.info,  Node: サブモジュール,  Next: Module specs,  Prev: ローダー,  Up: ロード

4.5.4.2 サブモジュール
......................

サブモジュールをロードするのにどのようなメカニズム (例えば、 ‘importlib’
API 、 ‘import’ または ‘import-from’ ステートメント、またはビルトイン関
数の ‘__import__’) が使われた場合でも、バインディングはサブモジュールオ
ブジェクトを親モジュールの名前空間に配置します。例えば、もしパッケージ
‘spam’ がサブモジュール ‘foo’ を持っていた場合、 ‘spam.foo’ をインポート
した後は ‘spam’ は値がサブモジュールに束縛された属性 ‘foo’ を持ちます。
以下のディレクトリ構造を持っているとしましょう:

     spam/
         __init__.py
         foo.py

そして ‘spam/__init__.py’ は以下のようになっているとします:

     from .foo import Foo

このとき、以下を実行することにより ‘spam’ モジュールの中に ‘foo’ と
‘Foo’ に束縛された名前が置かれます:

     >>> import spam
     >>> spam.foo
     <module 'spam.foo' from '/tmp/imports/spam/foo.py'>
     >>> spam.Foo
     <class 'spam.foo.Foo'>

Python の慣れ親しんだ名前束縛ルールからするとこれは驚きかもしれませんが
、それは実際インポートシステムの基本的な機能です。不変に保たなければなら
ないのは (上記のインポートの後などで) ‘sys.modules['spam']’ と
‘sys.modules['spam.foo']’ が存在する場合、後者が前者の ‘foo’ 属性として
存在しなければならないということです。


File: python.info,  Node: Module specs,  Next: __path__ attributes on modules,  Prev: サブモジュール,  Up: ロード

4.5.4.3 Module specs
....................

インポート機構は、インポートの間 (特にロードの前) に、個々のモジュールに
ついてのさまざまな情報を扱います。情報のほとんどはすべてのモジュールで共
通です。モジュール仕様の目的は、このインポート関連の情報をモジュールの単
位でカプセル化することです。

インポートの際にモジュール仕様を使うことは、インポートシステムコンポーネ
ント間、例えばモジュール仕様を作成するファインダーとそれを実行するローダ
ーの間で状態を転送することを可能にします。最も重要なのは、それによってイ
ンポート機構がロードの定型的な作業を実行できるようになるということです。
これに対して、モジュール仕様なしではローダがその責任を担っていました。

The module's spec is exposed as *note module.__spec__: 2364.  Setting
‘__spec__’ appropriately applies equally to *note modules initialized
during interpreter startup: 2452.  The one exception is ‘__main__’,
where ‘__spec__’ is *note set to None in some cases: 2453.

See *note ModuleSpec: 226c. for details on the contents of the module
spec.

Added in version 3.4.


File: python.info,  Node: __path__ attributes on modules,  Next: モジュールの repr,  Prev: Module specs,  Up: ロード

4.5.4.4 __path__ attributes on modules
......................................

The *note __path__: 2054. attribute should be a (possibly empty) *note
sequence: 716. of strings enumerating the locations where the package's
submodules will be found.  By definition, if a module has a ‘__path__’
attribute, it is a *note package: 233.

A package's *note __path__: 2054. attribute is used during imports of
its subpackages.  Within the import machinery, it functions much the
same as *note sys.path: 3e4, i.e.  providing a list of locations to
search for modules during import.  However, ‘__path__’ is typically much
more constrained than ‘sys.path’.

The same rules used for *note sys.path: 3e4. also apply to a package's
‘__path__’.  *note sys.path_hooks: 1225. (described below) are consulted
when traversing a package's ‘__path__’.

A package's ‘__init__.py’ file may set or alter the package's *note
__path__: 2054. attribute, and this was typically the way namespace
packages were implemented prior to PEP 420(1).  With the adoption of PEP
420(2), namespace packages no longer need to supply ‘__init__.py’ files
containing only ‘__path__’ manipulation code; the import machinery
automatically sets ‘__path__’ correctly for the namespace package.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0420/

   (2) https://peps.python.org/pep-0420/


File: python.info,  Node: モジュールの repr,  Next: キャッシュされたバイトコードの無効化,  Prev: __path__ attributes on modules,  Up: ロード

4.5.4.5 モジュールの repr
.........................

デフォルトでは、すべてのモジュールは利用可能な repr を持っています。ただ
しこれは、これまでに説明した属性の設定内容に依存しており、モジュール仕様
によってモジュールオブジェクトの repr をより明示的に制御することができま
す。

もしモジュールが仕様 (‘__spec__’) を持っていれば、インポート機構はそこか
ら repr を生成しようとします。もしそれが失敗するか、または仕様が存在しな
ければ、インポートシステムはモジュールで入手可能なあらゆる情報を使ってデ
フォルトの repr を構築します。それは ‘module.__name__’,
‘module.__file__’, ‘module.__loader__’ を (足りない情報についてはデフォ
ルト値を使って補いながら) repr への入力として使おうと試みます。

これが使われている正確な規則です:

   * モジュールが ‘__spec__’ 属性を持っていれば、仕様に含まれる情報が
     repr を生成するために使われます。 "name", "loader", "origin",
     "has_location" 属性が参照されます。

   * モジュールに ‘__file__’ 属性がある場合は、モジュールの repr の一部
     として使われます。

   * モジュールに ‘__file__’ はないが ‘__loader__’ があり、その値が
     ‘None’ ではない場合は、ローダーの repr がモジュールの repr の一部と
     して使われます。

   * そうでなければ、単にモジュールの ‘__name__’ を repr の中で使います
     。

バージョン 3.12 で変更: Use of ‘module_repr()’, having been deprecated
since Python 3.4, was removed in Python 3.12 and is no longer called
during the resolution of a module's repr.


File: python.info,  Node: キャッシュされたバイトコードの無効化,  Prev: モジュールの repr,  Up: ロード

4.5.4.6 キャッシュされたバイトコードの無効化
............................................

Before Python loads cached bytecode from a ‘.pyc’ file, it checks
whether the cache is up-to-date with the source ‘.py’ file.  By default,
Python does this by storing the source's last-modified timestamp and
size in the cache file when writing it.  At runtime, the import system
then validates the cache file by checking the stored metadata in the
cache file against the source's metadata.

Python also supports "hash-based" cache files, which store a hash of the
source file's contents rather than its metadata.  There are two variants
of hash-based ‘.pyc’ files: checked and unchecked.  For checked
hash-based ‘.pyc’ files, Python validates the cache file by hashing the
source file and comparing the resulting hash with the hash in the cache
file.  If a checked hash-based cache file is found to be invalid, Python
regenerates it and writes a new checked hash-based cache file.  For
unchecked hash-based ‘.pyc’ files, Python simply assumes the cache file
is valid if it exists.  Hash-based ‘.pyc’ files validation behavior may
be overridden with the *note -check-hash-based-pycs: 2122. flag.

バージョン 3.7 で変更: Added hash-based ‘.pyc’ files.  Previously,
Python only supported timestamp-based invalidation of bytecode caches.


File: python.info,  Node: パスベース・ファインダー,  Next: 標準のインポートシステムを置き換える,  Prev: ロード,  Up: インポートシステム

4.5.5 パスベース・ファインダー
------------------------------

上で触れた通り、 Python にはいくつかのデフォルトのメタパス・ファインダー
が備わっています。そのうちの 1 つは *note パスベース・ファインダー:
244d. (*note PathFinder: 1224.) と呼ばれ、 *note パスエントリ: 2458. の
リストである *note インポートパス: 244a. を検索します。それぞれのパスエ
ントリは、モジュールを探す場所を指しています。

パスベース・ファインダー自体は何かのインポート方法を知っているわけではあ
りません。その代わりに、個々のパスエントリを走査し、それぞれに特定の種類
のパスの扱いを知っているパスエントリ・ファインダーを関連付けます。

デフォルトのパスエントリ・ファインダーは、ファイルシステム上のモジュール
を見つけるためのすべてのセマンティクスを実装しています。それは Python ソ
ースコード (‘.py’ ファイル) 、Python バイトコード (‘.pyc’ ファイル) 、共
有ライブラリ (例えば ‘.so’ ファイル) などの特別なファイルタイプを処理し
ます。標準ライブラリの *note zipimport: 138. モジュールによってサポート
される場合は、デフォルトのパスエントリ・ファインダーは (共有ライブラリ以
外の) すべてのファイルタイプの zip ファイルからのロードも扱います。

パスエントリはファイルシステム上の場所に限定される必要はありません。URL
やデータベースクエリやその他文字列で指定できる場所を参照することも可能で
す。

パスベース・ファインダーにはフックやプロトコルを追加することができ、それ
によって検索可能なパスエントリの種類を拡張し、カスタマイズすることができ
ます。例えば、ネットワーク上の URL をパスエントリとしてサポートしたい場
合、 web 上のモジュールを見つけるために HTTP の取り扱い方を実装したフッ
クを書くことができます。この (呼び出し可能オブジェクトである) フックは、
下で解説するプロトコルをサポートする *note パスエントリ・ファインダー:
127d. を返します。このプロトコルは web からモジュールのローダーを取得す
るのに使われます。

警告の言葉: この節と前の節の両方で 'ファインダー' という言葉が、 *note
メタパス・ファインダー: 127c. と *note パスエントリ・ファインダー: 127d.
という用語で区別されて使われています。これら 2 種類のファインダーは非常
に似ており、似たプロトコルをサポートし、インポート処理で同じように機能し
ますが、微妙に異なっているのを心に留めておくのは重要です。特に、メタパス
・ファインダーはインポート処理の開始時、 *note sys.meta_path: f27. の走
査が動くときに動作します。

それとは対照的に、パスエントリ・ファインダーはある意味でパスベース・ファ
インダーの実装詳細であり、実際 *note sys.meta_path: f27. からパスベース
・ファインダーが取り除かれた場合、パスエントリ・ファインダーの実装は何も
実行されないでしょう。

* Menu:

* パスエントリ・ファインダー::
* パスエントリ・ファインダー・プロトコル::


File: python.info,  Node: パスエントリ・ファインダー,  Next: パスエントリ・ファインダー・プロトコル,  Up: パスベース・ファインダー

4.5.5.1 パスエントリ・ファインダー
..................................

*note パスベース・ファインダー: 244d. には、文字列 *note パスエントリ:
2458. で指定された場所の Python モジュールや Python パッケージを見つけ、
ロードする責任があります。ほとんどのパスエントリはファイルシステム上の場
所を指定していますが、そこに制限される必要はありません。

メタパス・ファインダーとして、 *note パスベース・ファインダー: 244d. に
は前に解説した *note find_spec(): a68. プロトコルが実装されていますが、
これに加えて *note インポートパス: 244a. からモジュールを見つけ、ロード
する方法をカスタマイズするために使えるフックを提供しています。

*note パスベース・ファインダー: 244d. は *note sys.path: 3e4. 、 *note
sys.path_hooks: 1225. 、 *note sys.path_importer_cache: 7fa. という 3 つ
の変数を使います。さらにパッケージオブジェクトの ‘__path__’ 属性も使いま
す。これらによって、インポート処理をカスタマイズする方法が提供されます。

*note sys.path: 3e4. contains a list of strings providing search
locations for modules and packages.  It is initialized from the *note
PYTHONPATH: 121f. environment variable and various other installation-
and implementation-specific defaults.  Entries in *note sys.path: 3e4.
can name directories on the file system, zip files, and potentially
other "locations" (see the *note site: cc. module) that should be
searched for modules, such as URLs, or database queries.  Only strings
should be present on *note sys.path: 3e4.; all other data types are
ignored.

*note パスベース・ファインダー: 244d. は *note メタパス・ファインダー:
127c. なので、インポート機構は、前で解説したパスベース・ファインダーの
*note find_spec(): 1213. メソッドを呼び出すことで *note インポートパス:
244a. の検索を始めます。 ‘path’ 引数が *note find_spec(): 1213. に渡され
たときは、それは走査するパス文字列のリスト - 典型的にはそのパッケージの
中でインポートしているパッケージの ‘__path__’ 属性になります。 ‘path’ 引
数が ‘None’ だった場合、それは最上位のインポートであることを示していて、
*note sys.path: 3e4. が使われます。

The path based finder iterates over every entry in the search path, and
for each of these, looks for an appropriate *note path entry finder:
127d. (*note PathEntryFinder: a6f.) for the path entry.  Because this
can be an expensive operation (e.g.  there may be ‘stat()’ call
overheads for this search), the path based finder maintains a cache
mapping path entries to path entry finders.  This cache is maintained in
*note sys.path_importer_cache: 7fa. (despite the name, this cache
actually stores finder objects rather than being limited to *note
importer: 2448. objects).  In this way, the expensive search for a
particular *note path entry: 2458. location's *note path entry finder:
127d. need only be done once.  User code is free to remove cache entries
from *note sys.path_importer_cache: 7fa. forcing the path based finder
to perform the path entry search again.

path entry がキャッシュの中に無かった場合、 path based finder は *note
sys.path_hooks: 1225. の中の呼び出し可能オブジェクトを全て辿ります。 こ
のリストのそれぞれの *note path entry フック: 245a. は、検索する path
entry という引数 1 つを渡して呼び出されます。 その呼び出し可能オブジェク
トは path entry を扱える *note path entry finder: 127d. を返すか、 *note
ImportError: 65b. を送出します。 *note ImportError: 65b. は、フックが
*note path entry: 2458. のための *note path entry finder: 127d. を探せな
いことを報せるために path based finder が使います。 この例外は処理されず
、 *note import path: 244a. を辿っていく処理が続けられます。 フックは引
数として文字列またはバイト列オブジェクトを期待します; バイト列オブジェク
トのエンコーディングはフックに任されていて (例えば、ファイルシステムのエ
ンコーディングの UTF-8 やそれ以外などです) 、フックが引数をデコードでき
なかった場合は *note ImportError: 65b. を送出すべきです。

*note sys.path_hooks: 1225. を辿る処理が *note
パスエントリ・ファインダー: 127d. を何も返さずに終わった場合、パスベース
・ファインダーの *note find_spec(): 1213. メソッドは、 *note
sys.path_importer_cache: 7fa. に (このパスエントリに対するファインダーが
存在しないことを示すために) ‘None’ を保存し、 *note
メタパス・ファインダー: 127c. はモジュールが見つからなかったことを伝える
ために ‘None’ を返します。

*note sys.path_hooks: 1225. 上の *note パスエントリフック: 245a. 呼び出
し可能オブジェクトの戻り値のいずれかが *note パスエントリ・ファインダー:
127d. 'であった' 場合、後で出てくるモジュール仕様を探すためのプロトコル
が使われ、それがモジュールをロードするために使われます。

The current working directory - denoted by an empty string - is handled
slightly differently from other entries on *note sys.path: 3e4.  First,
if the current working directory cannot be determined or is found not to
exist, no value is stored in *note sys.path_importer_cache: 7fa.
Second, the value for the current working directory is looked up fresh
for each module lookup.  Third, the path used for *note
sys.path_importer_cache: 7fa. and returned by *note
importlib.machinery.PathFinder.find_spec(): 1213. will be the actual
current working directory and not the empty string.


File: python.info,  Node: パスエントリ・ファインダー・プロトコル,  Prev: パスエントリ・ファインダー,  Up: パスベース・ファインダー

4.5.5.2 パスエントリ・ファインダー・プロトコル
..............................................

モジュールと初期化されたパッケージのインポートをサポートするため、および
名前空間パッケージのポーションとして提供するために、パスエントリ・ファイ
ンダーは *note find_spec(): a6c. メソッドを実装しなければいけません。

*note find_spec(): a6c. は 2 つの引数を取ります。インポートしようとして
いるモジュールの完全修飾名と、 (オプションの) 対象モジュールです。
‘find_spec()’ はモジュールに対応する完全に初期化 (populated) された仕様
を返します。この仕様は (1つの例外を除いて) 常に "loader" セットを持って
います。

To indicate to the import machinery that the spec represents a namespace
*note portion: 2443, the path entry finder sets
‘submodule_search_locations’ to a list containing the portion.

バージョン 3.4 で変更: *note find_spec(): a6c. replaced ‘find_loader()’
and ‘find_module()’, both of which are now deprecated, but will be used
if ‘find_spec()’ is not defined.

古いパスエントリ・ファインダーの中には、 ‘find_spec()’ の代わりにこれら
2 つの deperecated なメソッドのうちのいずれかを実装しているものがあるか
もしれません。これらのメソッドは後方互換性のためにまだ考慮されています。
しかし、パスエントリ・ファインダーに ‘find_spec()’ が実装されていれば、
古いメソッドは無視されます。

‘find_loader()’ takes one argument, the fully qualified name of the
module being imported.  ‘find_loader()’ returns a 2-tuple where the
first item is the loader and the second item is a namespace *note
portion: 2443.

他のインポート機構の実装に対する後方互換性のために、多くのパスエントリ・
ファインダーは、メタパス・ファインダーがサポートするのと同じ伝統的な
‘find_module()’ メソッドもサポートしています。しかし、パスエントリ・ファ
インダーの ‘find_module()’ メソッドは、決して ‘path’ 引数では呼び出され
ません (このメソッドは、パスフックの最初の呼び出しから適切なパス情報を記
録する動作が期待されています)。

パスエントリ・ファインダーの ‘find_module()’ メソッドは deprecated です
。なぜなら、その方法ではパスエントリ・ファインダーが名前空間パッケージに
対してポーションを提供することができないからです。もし ‘find_loader()’ と
‘find_module()’ の両方がパスエントリ・ファインダーに存在したら、インポー
トシステムは常に ‘find_module()’ よりも ‘find_loader()’ を優先して呼び出
します。

バージョン 3.10 で変更: Calls to ‘find_module()’ and ‘find_loader()’ by
the import system will raise *note ImportWarning: 71e.

バージョン 3.12 で変更: ‘find_module()’ and ‘find_loader()’ have been
removed.


File: python.info,  Node: 標準のインポートシステムを置き換える,  Next: Package Relative Imports,  Prev: パスベース・ファインダー,  Up: インポートシステム

4.5.6 標準のインポートシステムを置き換える
------------------------------------------

インポートシステム全体を置き換えるための最も信頼性のある仕組みは、 *note
sys.meta_path: f27. のデフォルトの内容を削除し、全部をカスタムのメタパス
フックで置き換えるものです。

If it is acceptable to only alter the behaviour of import statements
without affecting other APIs that access the import system, then
replacing the builtin *note __import__(): ad1. function may be
sufficient.

(標準のインポートシステム全体を停止するのではなく) すでにメタパスにいる
フックからあるモジュールのインポートを選択的に防ぐためには、 *note
find_spec(): a68. から ‘None’ を返す代わりに、直接 *note
ModuleNotFoundError: d3d. を送出するだけで十分です。 ‘None’ を返すのはメ
タパスの走査を続けるべきであることを意味しますが、例外を送出するとすぐに
走査を打ち切ります。


File: python.info,  Node: Package Relative Imports,  Next: __main__ に対する特別な考慮,  Prev: 標準のインポートシステムを置き換える,  Up: インポートシステム

4.5.7 Package Relative Imports
------------------------------

Relative imports use leading dots.  A single leading dot indicates a
relative import, starting with the current package.  Two or more leading
dots indicate a relative import to the parent(s) of the current package,
one level per dot after the first.  For example, given the following
package layout:

     package/
         __init__.py
         subpackage1/
             __init__.py
             moduleX.py
             moduleY.py
         subpackage2/
             __init__.py
             moduleZ.py
         moduleA.py

In either ‘subpackage1/moduleX.py’ or ‘subpackage1/__init__.py’, the
following are valid relative imports:

     from .moduleY import spam
     from .moduleY import spam as ham
     from . import moduleY
     from ..subpackage1 import moduleY
     from ..subpackage2.moduleZ import eggs
     from ..moduleA import foo

Absolute imports may use either the ‘import <>’ or ‘from <> import <>’
syntax, but relative imports may only use the second form; the reason
for this is that:

     import XXX.YYY.ZZZ

should expose ‘XXX.YYY.ZZZ’ as a usable expression, but .moduleY is not
a valid expression.


File: python.info,  Node: __main__ に対する特別な考慮,  Next: 参考資料,  Prev: Package Relative Imports,  Up: インポートシステム

4.5.8 __main__ に対する特別な考慮
---------------------------------

*note __main__: 1. モジュールは、 Python のインポートシステムに関連する
特別なケースです。 *note 他の場所: 2452. で言及されているように、
‘__main__’ モジュールは *note sys: df. や *note builtins: 13. などと同様
にインタプリタースタートアップで直接初期化されます。しかし、前者 2 つの
モジュールと違って、 ‘__main__’ は厳密にはビルトインのモジュールとしての
資格を持っていません。これは、 ‘__main__’ が初期化される方法がインタプリ
タが起動されるときのフラグやその他のオプションに依存するためです。

* Menu:

* __main__.__spec__: __main__ __spec__.


File: python.info,  Node: __main__ __spec__,  Up: __main__ に対する特別な考慮

4.5.8.1 __main__.__spec__
.........................

*note __main__: 1. がどのように初期化されるかに依存して、
‘__main__.__spec__’ は適切に設定されることもあれば ‘None’ になることもあ
ります。

Python が *note -m: 23c. オプションを付けて実行された場合には、
‘__spec__’ は対応するモジュールまたはパッケージのモジュール仕様に設定さ
れます。また、ディレクトリや zip ファイル、または他の *note sys.path:
3e4. エントリを実行する処理の一部として ‘__main__’ モジュールがロードさ
れる場合にも ‘__spec__’ が生成 (populate) されます。

*note それ以外のケース: 211b. では、 ‘__main__.__spec__’ は ‘None’ に設
定されます。これは、 *note __main__: 1. を生成 (populate) するために使わ
れたコードがインポート可能なモジュールと直接一致していないためです:

   - 対話プロンプト

   - *note -c: 1a8. オプション

   - stdin から起動された場合

   - ソースファイルやバイトコードファイルから直接起動された場合

最後のケースでは、たとえ技術的にはファイルがモジュールとして直接インポー
トできた 'としても' ‘__main__.__spec__’ は常に ‘None’ になることに注意し
てください。もし *note __main__: 1. において有効なモジュールメタデータが
必要なら *note -m: 23c. スイッチを使ってください。

‘__main__’ がインポート可能なモジュールと一致し、 ‘__main__.__spec__’ が
それに応じて設定されていたとしても、それでもなお、この 2 つのモジュール
は別物とみなされることに注意してください。これは、 ‘if __name__ ==
"__main__":’ チェックによって保証されるブロックは、 ‘__main__’ 名前空間
を生成 (populate) するためにモジュールが使用される時にだけ実行され、通常
のインポート時には実行されない、という事実に起因しています。


File: python.info,  Node: 参考資料,  Prev: __main__ に対する特別な考慮,  Up: インポートシステム

4.5.9 参考資料
--------------

Python の初期の頃からすると、インポート機構は目覚ましい発展を遂げました
。 一部細かいところがドキュメントが書かれたときから変わってはいますが、
最初期の パッケージの仕様(1) はまだ読むことができます。

オリジナルの *note sys.meta_path: f27. の仕様は PEP 302(2) で、その後継
となる拡張が PEP 420(3) です。

PEP 420(4) introduced *note namespace packages: 2b2. for Python 3.3.
PEP 420(5) also introduced the ‘find_loader()’ protocol as an
alternative to ‘find_module()’.

PEP 366(6) は、メインモジュールでの明示的な相対インポートのために追加し
た ‘__package__’ 属性の解説をしています。

PEP 328(7) は絶対インポート、明示的な相対インポート、および、当初
‘__name__’ で提案し、後に PEP 366(8) が ‘__package__’ で定めた仕様を導入
しました。

PEP 338(9) はモジュールをスクリプトとして実行するときの仕様を定めていま
す。

PEP 451(10) は、モジュール仕様オブジェクトにおけるモジュール毎のインポー
ト状態のカプセル化を追加しています。また、ローダーの定型的な責任のほとん
どをインポート機構に肩代わりさせています。これらの変更により、インポート
システムのいくつかの API が deprecate され、またファインダーとローダーに
は新しいメソッドが追加されました。

脚注
....

   ---------- Footnotes ----------

   (1) https://www.python.org/doc/essays/packages/

   (2) https://peps.python.org/pep-0302/

   (3) https://peps.python.org/pep-0420/

   (4) https://peps.python.org/pep-0420/

   (5) https://peps.python.org/pep-0420/

   (6) https://peps.python.org/pep-0366/

   (7) https://peps.python.org/pep-0328/

   (8) https://peps.python.org/pep-0366/

   (9) https://peps.python.org/pep-0338/

   (10) https://peps.python.org/pep-0451/


File: python.info,  Node: 式 expression,  Next: 単純文 simple statement,  Prev: インポートシステム,  Up: Python 言語リファレンス

4.6 式 (expression)
===================

この章では、Python の式における個々の要素の意味について解説します。

'Syntax Notes:' In this and the following chapters, *note grammar
notation: 2284. will be used to describe syntax, not lexical analysis.

When (one alternative of) a syntax rule has the form:

     name: othername

で記述されていて、この構文特有の意味付け (semantics) が記述されていない
場合、 ‘name’ の形式をとる構文の意味付けは ‘othername’ の意味付けと同じ
になります。

* Menu:

* 算術変換 (arithmetic conversion): 算術変換 arithmetic conversion.
* アトム、原子的要素 (atom): アトム、原子的要素 atom.
* プライマリ::
* Await 式::
* べき乗演算 (power operator): べき乗演算 power operator.
* 単項算術演算とビット単位演算 (unary arithmetic and bitwise operation): 単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
* 二項算術演算 (binary arithmetic operation): 二項算術演算 binary arithmetic operation.
* シフト演算 (shifting operation): シフト演算 shifting operation.
* ビット単位演算の二項演算 (binary bitwise operation): ビット単位演算の二項演算 binary bitwise operation.
* 比較::
* ブール演算 (boolean operation): ブール演算 boolean operation.
* 代入式: 代入式<2>.
* 条件式 (Conditional Expressions): 条件式 Conditional Expressions.
* ラムダ (lambda): ラムダ lambda.
* 式のリスト::
* 評価順序::
* 演算子の優先順位::


File: python.info,  Node: 算術変換 arithmetic conversion,  Next: アトム、原子的要素 atom,  Up: 式 expression

4.6.1 算術変換 (arithmetic conversion)
--------------------------------------

When a description of an arithmetic operator below uses the phrase "the
numeric arguments are converted to a common real type", this means that
the operator implementation for built-in numeric types works as
described in the *note Numeric Types: 2469. section of the standard
library documentation.

Some additional rules apply for certain operators and non-numeric
operands (for example, a string as a left argument to the ‘%’ operator).
Extensions must define their own conversion behavior.


File: python.info,  Node: アトム、原子的要素 atom,  Next: プライマリ,  Prev: 算術変換 arithmetic conversion,  Up: 式 expression

4.6.2 アトム、原子的要素 (atom)
-------------------------------

Atoms are the most basic elements of expressions.  The simplest atoms
are *note names: 22a0. or literals.  Forms enclosed in parentheses,
brackets or braces are also categorized syntactically as atoms.

Formally, the syntax for atoms is:

     atom:
        | 'True'
        | 'False'
        | 'None'
        | '...'
        | *note identifier: 22c1.
        | *note literal: 246d.
        | *note enclosure: 246e.
     enclosure:
        | *note parenth_form: 246f.
        | *note list_display: 2470.
        | *note dict_display: 2471.
        | *note set_display: 2472.
        | *note generator_expression: 2473.
        | *note yield_atom: 2474.

* Menu:

* Built-in constants::
* 識別子 (identifier、または名前 (name)): 識別子 identifier、または名前 name.
* リテラル: リテラル<2>.
* 丸括弧形式 (parenthesized form): 丸括弧形式 parenthesized form.
* リスト、集合、辞書の表示::
* リスト表示::
* 集合表示::
* 辞書表示::
* ジェネレータ式: ジェネレータ式<2>.
* Yield 式::


File: python.info,  Node: Built-in constants,  Next: 識別子 identifier、または名前 name,  Up: アトム、原子的要素 atom

4.6.2.1 Built-in constants
..........................

The keywords ‘True’, ‘False’, and ‘None’ name *note built-in constants:
2477.  The token ‘...’ names the *note Ellipsis: 2328. constant.

Evaluation of these atoms yields the corresponding value.

     注釈: Several more built-in constants are available as global
     variables, but only the ones mentioned here are *note keywords:
     2289.  In particular, these names cannot be reassigned or used as
     attributes:

          >>> False = 123
            File "<input>", line 1
             False = 123
             ^^^^^
          SyntaxError: cannot assign to False


File: python.info,  Node: 識別子 identifier、または名前 name,  Next: リテラル<2>,  Prev: Built-in constants,  Up: アトム、原子的要素 atom

4.6.2.2 識別子 (identifier、または名前 (name))
..............................................

アトムの形になっている識別子 (identifier) は名前 (name) です。字句定義に
ついては *note Names (identifiers and keywords): 22a0. 節を、名前付けや
束縛については *note 名前づけと束縛 (naming and binding): 2346. 節を参照
してください。

名前があるオブジェクトに束縛されている場合、名前 atom を評価するとそのオ
ブジェクトになります。名前が束縛されていない場合、 atom を評価しようとす
ると *note NameError: 452. 例外を送出します。

* Menu:

* Private name mangling::


File: python.info,  Node: Private name mangling,  Up: 識別子 identifier、または名前 name

4.6.2.3 Private name mangling
.............................

When an identifier that textually occurs in a class definition begins
with two or more underscore characters and does not end in two or more
underscores, it is considered a 'private name' of that class.

参考
....

The *note class specifications: 14ef.

More precisely, private names are transformed to a longer form before
code is generated for them.  If the transformed name is longer than 255
characters, implementation-defined truncation may happen.

The transformation is independent of the syntactical context in which
the identifier is used but only the following private identifiers are
mangled:

   - Any name used as the name of a variable that is assigned or read or
     any name of an attribute being accessed.

     The *note __name__: 1272. attribute of nested functions, classes,
     and type aliases is however not mangled.

   - The name of imported modules, e.g., ‘__spam’ in ‘import __spam’.
     If the module is part of a package (i.e., its name contains a dot),
     the name is 'not' mangled, e.g., the ‘__foo’ in ‘import __foo.bar’
     is not mangled.

   - The name of an imported member, e.g., ‘__f’ in ‘from spam import
     __f’.

The transformation rule is defined as follows:

   - The class name, with leading underscores removed and a single
     leading underscore inserted, is inserted in front of the
     identifier, e.g., the identifier ‘__spam’ occurring in a class
     named ‘Foo’, ‘_Foo’ or ‘__Foo’ is transformed to ‘_Foo__spam’.

   - If the class name consists only of underscores, the transformation
     is the identity, e.g., the identifier ‘__spam’ occurring in a class
     named ‘_’ or ‘__’ is left as is.


File: python.info,  Node: リテラル<2>,  Next: 丸括弧形式 parenthesized form,  Prev: 識別子 identifier、または名前 name,  Up: アトム、原子的要素 atom

4.6.2.4 リテラル
................

A 'literal' is a textual representation of a value.  Python supports
numeric, string and bytes literals.  *note Format strings: 19a. and
*note template strings: 17fa. are treated as string literals.

Numeric literals consist of a single *note NUMBER: 2306. token, which
names an integer, floating-point number, or an imaginary number.  See
the *note 数値リテラル: 22a1. section in Lexical analysis documentation
for details.

String and bytes literals may consist of several tokens.  See section
*note 文字列リテラルの結合 (concatenation): 22e0. for details.

Note that negative and complex numbers, like ‘-3’ or ‘3+4.2j’, are
syntactically not literals, but *note unary: 247c. or *note binary:
247d. arithmetic operations involving the ‘-’ or ‘+’ operator.

Evaluation of a literal yields an object of the given type (*note int:
19b, *note float: 196, *note complex: 197, *note str: 169, *note bytes:
192, or *note Template: 16a.) with the given value.  The value may be
approximated in the case of floating-point and imaginary literals.

The formal grammar for literals is:

     literal: *note strings: 247e. | *note NUMBER: 2306.

* Menu:

* Literals and object identity::
* 文字列リテラルの結合 (concatenation): 文字列リテラルの結合 concatenation.


File: python.info,  Node: Literals and object identity,  Next: 文字列リテラルの結合 concatenation,  Up: リテラル<2>

4.6.2.5 Literals and object identity
....................................

リテラルは全て変更不能なデータ型に対応します。このため、オブジェクトのア
イデンティティはオブジェクトの値ほど重要ではありません。同じ値を持つ複数
のリテラルを評価した場合、(それらのリテラルがプログラムの同じ場所由来の
ものであっても、そうでなくても) 同じオブジェクトを指しているか、まったく
同じ値を持つ別のオブジェクトになります。

     CPython implementation detail: For example, in CPython, 'small'
     integers with the same value evaluate to the same object:

          >>> x = 7
          >>> y = 7
          >>> x is y
          True

     However, large integers evaluate to different objects:

          >>> x = 123456789
          >>> y = 123456789
          >>> x is y
          False

     This behavior may change in future versions of CPython.  In
     particular, the boundary between "small" and "large" integers has
     already changed in the past.

     CPython will emit a *note SyntaxWarning: 1ae. when you compare
     literals using ‘is’:

          >>> x = 7
          >>> x is 7
          <input>:1: SyntaxWarning: "is" with 'int' literal. Did you mean "=="?
          True

     See *note いつ is 演算子での同一性テストが頼れますか？: 2480. for
     more information.

*note Template strings: 17fa. are immutable but may reference mutable
objects as *note Interpolation: 16b. values.  For the purposes of this
section, two t-strings have the "same value" if both their structure and
the 'identity' of the values match.

'CPython 実装の詳細:' Currently, each evaluation of a template string
results in a different object.


File: python.info,  Node: 文字列リテラルの結合 concatenation,  Prev: Literals and object identity,  Up: リテラル<2>

4.6.2.6 文字列リテラルの結合 (concatenation)
............................................

Multiple adjacent string or bytes literals, possibly using different
quoting conventions, are allowed, and their meaning is the same as their
concatenation:

     >>> "hello" 'world'
     "helloworld"

This feature is defined at the syntactical level, so it only works with
literals.  To concatenate string expressions at run time, the '+'
operator may be used:

     >>> greeting = "Hello"
     >>> space = " "
     >>> name = "Blaise"
     >>> print(greeting + space + name)   # not: print(greeting space name)
     Hello Blaise

Literal concatenation can freely mix raw strings, triple-quoted strings,
and formatted string literals.  For example:

     >>> "Hello" r', ' f"{name}!"
     "Hello, Blaise!"

This feature can be used to reduce the number of backslashes needed, to
split long strings conveniently across long lines, or even to add
comments to parts of strings.  For example:

     re.compile("[A-Za-z_]"       # letter or underscore
                "[A-Za-z0-9_]*"   # letter, digit or underscore
               )

However, bytes literals may only be combined with other byte literals;
not with string literals of any kind.  Also, template string literals
may only be combined with other template string literals:

     >>> t"Hello" t"{name}!"
     Template(strings=('Hello', '!'), interpolations=(...))

Formally:

     strings: (*note STRING: 22d1. | *note fstring: 22f4.)+ | *note tstring: 2304.+


File: python.info,  Node: 丸括弧形式 parenthesized form,  Next: リスト、集合、辞書の表示,  Prev: リテラル<2>,  Up: アトム、原子的要素 atom

4.6.2.7 丸括弧形式 (parenthesized form)
.......................................

丸括弧形式とは、式リストの一形態で、丸括弧で囲ったものです:

     parenth_form: "(" [*note starred_expression: 2484.] ")"

丸括弧で囲われた式のリストは、個々の式が表現するものになります: リスト内
に少なくとも一つのカンマが入っていた場合、タプルになります; そうでない場
合、式のリストを構成している単一の式自体の値になります。

中身が空の丸括弧のペアは、空のタプルオブジェクトを表します。 タプルは変
更不能なので、リテラルと同じ規則が適用されます (すなわち、空のタプルが二
箇所で使われると、それらは同じオブジェクトになることもあるし、ならないこ
ともあります)。

タプルは丸括弧で作成されるのではなく、カンマによって作成されることに注意
してください。例外は空のタプルで、この場合には丸括弧が '必要です' -- 丸
括弧のつかない "何も記述しない式 (nothing)" を使えるようにしてしまうと、
文法があいまいなものになってしまい、よくあるタイプミスが検出されなくなっ
てしまいます。


File: python.info,  Node: リスト、集合、辞書の表示,  Next: リスト表示,  Prev: 丸括弧形式 parenthesized form,  Up: アトム、原子的要素 atom

4.6.2.8 リスト、集合、辞書の表示
................................

リスト、集合、辞書を構築するために、 Python は "表示 (display)" と呼ばれ
る特別な構文を提供していて、次の二種類ずつがあります:

   * コンテナの内容を明示的に列挙する

   * '内包表記 (comprehension)' と呼ばれる、ループ処理とフィルター処理の
     組み合わせを用いた計算結果

内包表記の共通の構文要素は次の通りです:

     comprehension: *note assignment_expression: 242d. *note comp_for: 2487.
     comp_for:      ["async"] "for" *note target_list: 2488. "in" *note or_test: 2489. [*note comp_iter: 248a.]
     comp_iter:     *note comp_for: 2487. | *note comp_if: 248b.
     comp_if:       "if" *note or_test: 2489. [*note comp_iter: 248a.]

内包表記はまず単一の式、続いて少なくとも 1 個の ‘for’ 節、さらに続いて 0
個以上の ‘for’ 節あるいは ‘if’ 節からなります。 この場合、各々の ‘for’ 節
や ‘if’ 節を、左から右へ深くなっていくネストしたブロックとみなし、ネスト
の最内のブロックに到達するごとに内包表記の先頭にある式を評価した結果が、
最終的にできあがるコンテナの各要素になります。

ただし、最も左にある ‘for’ 節のイテラブル式を除いて、内包表記は暗黙的に
ネストされた個別のスコープで実行されます。 この仕組みのおかげで、対象の
リスト内で代入された名前が外側のスコープに "漏れる" ことはありません。

最も左にある ‘for’ 節のイテラブル式は、それを直接囲んでいるスコープでそ
のまま評価され、暗黙的な入れ子のスコープに引数として渡されます。 後に続
く ‘for’ 節と、最も左にある ‘for’ 節のフィルター条件はイテラブル式を直接
囲んでいるスコープでは評価できません。というのは、それらは最も左のイテラ
ブルから得られる値に依存しているかもしれないからです。 例えば次の通りで
す: ‘[x*y for x in range(10) for y in range(x, x+10)]’ 。

内包表記が常に適切な型のコンテナになるのを保証するために、 ‘yield’ 式や
‘yield from’ 式は暗黙的な入れ子のスコープでは禁止されています。

Since Python 3.6, in an *note async def: 7ed. function, an ‘async for’
clause may be used to iterate over a *note asynchronous iterator: 4c7.
A comprehension in an ‘async def’ function may consist of either a ‘for’
or ‘async for’ clause following the leading expression, may contain
additional ‘for’ or ‘async for’ clauses, and may also use *note await:
18d. expressions.

If a comprehension contains ‘async for’ clauses, or if it contains
‘await’ expressions or other asynchronous comprehensions anywhere except
the iterable expression in the leftmost ‘for’ clause, it is called an
'asynchronous comprehension'.  An asynchronous comprehension may suspend
the execution of the coroutine function in which it appears.  See also
PEP 530(1).

Added in version 3.6: 非同期内包表記が導入されました。

バージョン 3.8 で変更: ‘yield’ および ‘yield from’ は暗黙的な入れ子のス
コープでは禁止となりました。

バージョン 3.11 で変更: Asynchronous comprehensions are now allowed
inside comprehensions in asynchronous functions.  Outer comprehensions
implicitly become asynchronous.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0530/


File: python.info,  Node: リスト表示,  Next: 集合表示,  Prev: リスト、集合、辞書の表示,  Up: アトム、原子的要素 atom

4.6.2.9 リスト表示
..................

リスト表示は、角括弧で囲われた式の系列です。系列は空の系列であってもかま
いません:

     list_display: "[" [*note flexible_expression_list: 248e. | *note comprehension: 2486.] "]"

リスト表示は、新しいリストオブジェクトを与えます。リストの内容は、式のリ
ストまたはリスト内包表記 (list comprehension) で指定されます。 カンマで
区切られた式のリストが与えられたときは、それらの各要素は左から右へと順に
評価され、その順にリスト内に配置されます。 内包表記が与えられたときは、
内包表記の結果の要素でリストが構成されます。


File: python.info,  Node: 集合表示,  Next: 辞書表示,  Prev: リスト表示,  Up: アトム、原子的要素 atom

4.6.2.10 集合表示
.................

集合表示は波括弧で表され、キーと値を分けるコロンがないことで辞書表現と区
別されます:

     set_display: "{" (*note flexible_expression_list: 248e. | *note comprehension: 2486.) "}"

集合表示は、新しいミュータブルな集合オブジェクトを与えます。集合の内容は
、式の並びまたは内包表記によって指定されます。 カンマ区切りの式のリスト
が与えられたときは、その要素は左から右へ順に評価され、集合オブジェクトに
加えられます。 内包表記が与えられたときは、内包表記の結果の要素で集合が
構成されます。

空集合は ‘{}’ で構成できません。このリテラルは空の辞書を構成します。


File: python.info,  Node: 辞書表示,  Next: ジェネレータ式<2>,  Prev: 集合表示,  Up: アトム、原子的要素 atom

4.6.2.11 辞書表示
.................

A dictionary display is a possibly empty series of dict items (key/value
pairs) enclosed in curly braces:

     dict_display:       "{" [*note dict_item_list: 2492. | *note dict_comprehension: 2493.] "}"
     dict_item_list:     *note dict_item: 2494. ("," *note dict_item: 2494.)* [","]
     dict_item:          *note expression: 182. ":" *note expression: 182. | "**" *note or_expr: 2302.
     dict_comprehension: *note expression: 182. ":" *note expression: 182. *note comp_for: 2487.

辞書表示は、新たな辞書オブジェクトを表します。

If a comma-separated sequence of dict items is given, they are evaluated
from left to right to define the entries of the dictionary: each key
object is used as a key into the dictionary to store the corresponding
value.  This means that you can specify the same key multiple times in
the dict item list, and the final dictionary's value for that key will
be the last one given.

A double asterisk ‘**’ denotes 'dictionary unpacking'.  Its operand must
be a *note mapping: 13d3.  Each mapping item is added to the new
dictionary.  Later values replace values already set by earlier dict
items and earlier dictionary unpackings.

Added in version 3.5: 辞書表示のアンパックは最初に PEP 448(1) で提案され
ました。

辞書内包表記は、リストや集合の内包表記とは対照的に、通常の "for" や "if"
節の前に、コロンで分けられた 2 つの式が必要です。内包表記が起動すると、
結果のキーと値の要素が、作られた順に新しい辞書に挿入されます。

Restrictions on the types of the key values are listed earlier in
section *note 標準型の階層: 232f.  (To summarize, the key type should be
*note hashable: 824, which excludes all mutable objects.)  Clashes
between duplicate keys are not detected; the last value (textually
rightmost in the display) stored for a given key value prevails.

バージョン 3.8 で変更: Python 3.8 より前のバージョンでは、辞書内包表記に
おいて、キーと値の評価順序は明示されていませんでした。CPython では、値が
キーより先に評価されていました。バージョン 3.8 からは PEP 572(2) で提案
されているように、キーが値より先に評価されます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0448/

   (2) https://peps.python.org/pep-0572/


File: python.info,  Node: ジェネレータ式<2>,  Next: Yield 式,  Prev: 辞書表示,  Up: アトム、原子的要素 atom

4.6.2.12 ジェネレータ式
.......................

ジェネレータ式 (generator expression) とは、丸括弧を使ったコンパクトなジ
ェネレータ表記法です:

     generator_expression: "(" *note expression: 182. *note comp_for: 2487. ")"

ジェネレータ式は新たなジェネレータオブジェクトを与えます。この構文は内包
表記とほぼ同じですが、角括弧や波括弧ではなく、丸括弧で囲まれます。

Variables used in the generator expression are evaluated lazily when the
*note __next__(): 20ae. method is called for the generator object (in
the same fashion as normal generators).  However, the iterable
expression in the leftmost ‘for’ clause is immediately evaluated, and
the *note iterator: 4c8. is immediately created for that iterable, so
that an error produced while creating the iterator will be emitted at
the point where the generator expression is defined, rather than at the
point where the first value is retrieved.  Subsequent ‘for’ clauses and
any filter condition in the leftmost ‘for’ clause cannot be evaluated in
the enclosing scope as they may depend on the values obtained from the
leftmost iterable.  For example: ‘(x*y for x in range(10) for y in
range(x, x+10))’.

関数の唯一の引数として渡す場合には、丸括弧を省略できます。詳しくは *note
呼び出し (call): f7d. 節を参照してください。

ジェネレータ式自身の期待される動作を妨げないために、 ‘yield’ 式や ‘yield
from’ 式は暗黙的に定義されたジェネレータでは禁止されています。

ジェネレータ式が ‘async for’ 節あるいは *note await: 18d. 式を含んでいる
場合、それは '非同期ジェネレータ式' と呼ばれます。 非同期ジェネレータ式
は、非同期イテレータである新しい非同期ジェネレータオブジェクトを返します
(*note 非同期イテレータ (Asynchronous Iterator): f77. を参照してください
)。

Added in version 3.6: 非同期ジェネレータ式が導入されました。

バージョン 3.7 で変更: Python 3.7 より前では、非同期ジェネレータ式は
*note async def: 7ed. コルーチンでしか使えませんでした。 3.7 からは、任
意の関数で非同期ジェネレータ式が使えるようになりました。

バージョン 3.8 で変更: ‘yield’ および ‘yield from’ は暗黙的な入れ子のス
コープでは禁止となりました。


File: python.info,  Node: Yield 式,  Prev: ジェネレータ式<2>,  Up: アトム、原子的要素 atom

4.6.2.13 Yield 式
.................

     yield_atom:       "(" *note yield_expression: 2303. ")"
     yield_from:       "yield" "from" *note expression: 182.
     yield_expression: "yield" *note yield_list: 249a. | *note yield_from: 2499.

yield 式は *note ジェネレータ: 126c. 関数や *note 非同期ジェネレータ:
249b. 関数を定義するときに使われます。従って、関数定義の本体でのみ使えま
す。 関数の本体で yield 式 を使用するとその関数はジェネレータ関数になり
、 *note async def: 7ed. 関数の本体で使用するとそのコルーチン関数は非同
期ジェネレータ関数になります。 例えば次のようになります:

     def gen():  # defines a generator function
         yield 123

     async def agen(): # defines an asynchronous generator function
         yield 123

含まれているスコープの副作用のため、 ‘yield’ 式は暗黙的に定義されたスコ
ープの一部として内包表記やジェネレータ式を実装するのに使うことは許可され
ていません。

バージョン 3.8 で変更: yield 式は、暗黙的な入れ子のスコープで内包表記や
ジェネレータ式を実装するための使用が禁止になりました。

ジェネレータ関数についてはすぐ下で説明されています。非同期ジェネレータ関
数は、 *note 非同期ジェネレータ関数 (asynchronous generator function):
249c. 節に分けて説明されています。

When a generator function is called, it returns an iterator known as a
generator.  That generator then controls the execution of the generator
function.  The execution starts when one of the generator's methods is
called.  At that time, the execution proceeds to the first yield
expression, where it is suspended again, returning the value of *note
yield_list: 249a. to the generator's caller, or ‘None’ if *note
yield_list: 249a. is omitted.  By suspended, we mean that all local
state is retained, including the current bindings of local variables,
the instruction pointer, the internal evaluation stack, and the state of
any exception handling.  When the execution is resumed by calling one of
the generator's methods, the function can proceed exactly as if the
yield expression were just another external call.  The value of the
yield expression after resuming depends on the method which resumed the
execution.  If *note __next__(): 20ae. is used (typically via either a
*note for: 34a. or the *note next(): 9d8. builtin) then the result is
*note None: 885.  Otherwise, if *note send(): 126d. is used, then the
result will be the value passed in to that method.

これまで説明した内容から、ジェネレータ関数はコルーチンにとてもよく似てい
ます。ジェネレータ関数は何度も生成し、1つ以上のエントリポイントを持ち、
その実行は一時停止されます。ジェネレータ関数は yield した後で実行の継続
を制御できないことが唯一の違いです。その制御は常にジェネレータの呼び出し
元へ移されます。

yield 式は *note try: 8f8. 構造内で使用できます。ジェネレータの (参照カ
ウントがゼロに達するか、ガベージコレクションによる) 完了前に再開されない
場合、ジェネレータ-イテレータの *note close(): 1793. メソッドが呼ばれ、
*note finally: 1b0. 節が実行されます。

‘yield from <expr>’ を使用した場合、与えられた式はイテラブルでなければな
りません。そのイテラブルをイテレートすることで生成された値は現在のジェネ
レータのメソッドの呼び出し元へ直接渡されます。*note send(): 126d. で渡さ
れたあらゆる値と *note throw(): 71c. で渡されたあらゆる例外は根底のイテ
レータに適切なメソッドがあれば渡されます。適切なメソッドがない場合、
*note send(): 126d. は *note AttributeError: 5f0. か *note TypeError:
198. を、*note throw(): 71c. は渡された例外を即座に送出します。

根底のイテレータの完了時、引き起こされた *note StopIteration: df5. イン
スタンスの *note value: 2417. 属性はその yield 式の値となります。 *note
StopIteration: df5. を起こす際に明示的にセットされるか、サブイテレータが
ジェネレータであれば (サブイテレータからかえる値で) 自動的にセットされる
かのどちらかです。

バージョン 3.3 で変更: サブイテレータに制御フローを委譲するために ‘yield
from <expr>’ が追加されました。

yield 式が代入文の単独の右辺式であるとき、括弧は省略できます。

参考
....

PEP 255(1) - 単純なジェネレータ

     Python へのジェネレータと *note yield: bc2. 文の導入提案。

PEP 342(2) - 拡張されたジェネレータを用いたコルーチン

     シンプルなコルーチンとして利用できるように、ジェネレータの構文と
     API を拡張する提案。

PEP 380(3) - サブジェネレータへの委譲構文

     サブジェネレータの委譲を簡単にするための、 *note yield_from: 2499.
     構文の導入提案。

PEP 525(4) - 非同期ジェネレータ

     コルーチン関数へのジェネレータの実装能力の追加による PEP 492(5) の
     拡張提案。

* Menu:

* ジェネレータ-イテレータメソッド::
* 使用例::
* 非同期ジェネレータ関数 (asynchronous generator function): 非同期ジェネレータ関数 asynchronous generator function<2>.
* 非同期ジェネレータイテレータメソッド::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0255/

   (2) https://peps.python.org/pep-0342/

   (3) https://peps.python.org/pep-0380/

   (4) https://peps.python.org/pep-0525/

   (5) https://peps.python.org/pep-0492/


File: python.info,  Node: ジェネレータ-イテレータメソッド,  Next: 使用例,  Up: Yield 式

4.6.2.14 ジェネレータ-イテレータメソッド
........................................

この説ではジェネレータイテレータのメソッドについて説明します。これらはジ
ェネレータ関数の実行制御に使用できます。

以下のジェネレータメソッドの呼び出しは、ジェネレータが既に実行中の場合
*note ValueError: 2ec. 例外を送出する点に注意してください。

 -- メソッド: generator.__next__ ()

     Starts the execution of a generator function or resumes it at the
     last executed yield expression.  When a generator function is
     resumed with a *note __next__(): 20ae. method, the current yield
     expression always evaluates to *note None: 885.  The execution then
     continues to the next yield expression, where the generator is
     suspended again, and the value of the *note yield_list: 249a. is
     returned to *note __next__(): 20ae.'s caller.  If the generator
     exits without yielding another value, a *note StopIteration: df5.
     exception is raised.

     このメソッドは通常、例えば *note for: 34a. ループや組み込みの *note
     next(): 9d8. 関数によって暗黙に呼び出されます。

 -- メソッド: generator.send (value)

     ジェネレータ関数の内部へ値を "送り"、実行を再開します。引数の
     'value' はその時点の yield 式の結果になります。 *note send(): 126d.
     メソッドは次にジェネレータが生成した値を返し、ジェネレータが次の値
     を生成することなく終了すると *note StopIteration: df5. を送出します
     。 *note send(): 126d. が呼び出されてジェネレータが開始するときは、
     値を受け取る yield 式が存在しないので、 *note None: 885. を引数とし
     て呼び出さなければなりません。

 -- メソッド: generator.throw (value)

 -- メソッド: generator.throw (type[, value[, traceback]])

     ジェネレータが中断した位置で例外を発生させて、そのジェネレータ関数
     が生成する次の値を返します。ジェネレータが値を生成することなく終了
     すると *note StopIteration: df5. が発生します。ジェネレータ関数が渡
     された例外を捕捉しない、もしくは違う例外を発生させるなら、その例外
     は呼び出し元へ伝搬されます。

     In typical use, this is called with a single exception instance
     similar to the way the *note raise: 803. keyword is used.

     For backwards compatibility, however, the second signature is
     supported, following a convention from older versions of Python.
     The 'type' argument should be an exception class, and 'value'
     should be an exception instance.  If the 'value' is not provided,
     the 'type' constructor is called to get an instance.  If
     'traceback' is provided, it is set on the exception, otherwise any
     existing *note __traceback__: 14de. attribute stored in 'value' may
     be cleared.

     バージョン 3.12 で変更: The second signature (type[, value[,
     traceback]]) is deprecated and may be removed in a future version
     of Python.

 -- メソッド: generator.close ()

     Raises a *note GeneratorExit: 15e1. exception at the point where
     the generator function was paused (equivalent to calling
     ‘throw(GeneratorExit)’).  The exception is raised by the yield
     expression where the generator was paused.  If the generator
     function catches the exception and returns a value, this value is
     returned from *note close(): 1793.  If the generator function is
     already closed, or raises *note GeneratorExit: 15e1. (by not
     catching the exception), *note close(): 1793. returns *note None:
     885.  If the generator yields a value, a *note RuntimeError: 244.
     is raised.  If the generator raises any other exception, it is
     propagated to the caller.  If the generator has already exited due
     to an exception or normal exit, *note close(): 1793. returns *note
     None: 885. and has no other effect.

     バージョン 3.13 で変更: If a generator returns a value upon being
     closed, the value is returned by *note close(): 1793.


File: python.info,  Node: 使用例,  Next: 非同期ジェネレータ関数 asynchronous generator function<2>,  Prev: ジェネレータ-イテレータメソッド,  Up: Yield 式

4.6.2.15 使用例
...............

以下の簡単なサンプルはジェネレータとジェネレータ関数の振る舞いを実際に紹
介します:

     >>> def echo(value=None):
     ...     print("Execution starts when 'next()' is called for the first time.")
     ...     try:
     ...         while True:
     ...             try:
     ...                 value = (yield value)
     ...             except Exception as e:
     ...                 value = e
     ...     finally:
     ...         print("Don't forget to clean up when 'close()' is called.")
     ...
     >>> generator = echo(1)
     >>> print(next(generator))
     Execution starts when 'next()' is called for the first time.
     1
     >>> print(next(generator))
     None
     >>> print(generator.send(2))
     2
     >>> generator.throw(TypeError, "spam")
     TypeError('spam',)
     >>> generator.close()
     Don't forget to clean up when 'close()' is called.

‘yield from’ の使用例は、"What's New in Python."  の *note PEP 380;
サブジェネレータへの委譲構文: 123b. を参照してください。


File: python.info,  Node: 非同期ジェネレータ関数 asynchronous generator function<2>,  Next: 非同期ジェネレータイテレータメソッド,  Prev: 使用例,  Up: Yield 式

4.6.2.16 非同期ジェネレータ関数 (asynchronous generator function)
.................................................................

*note async def: 7ed. を使用して定義された関数やメソッドに yield 式があ
ると、その関数は *note 非同期ジェネレータ: 249b. 関数として定義されます
。

非同期ジェネレータ関数が呼び出されると、非同期ジェネレータオブジェクトと
呼ばれる非同期イテレータが返されます。 そして、そのオブジェクトはジェネ
レータ関数の実行を制御します。 通常、非同期ジェネレータオブジェクトは、
コルーチン関数内の *note async for: ca1. 文で使われ、これはジェネレータ
オブジェクトが *note for: 34a. 文で使われる様子に類似します。

Calling one of the asynchronous generator's methods returns an *note
awaitable: 4c9. object, and the execution starts when this object is
awaited on.  At that time, the execution proceeds to the first yield
expression, where it is suspended again, returning the value of *note
yield_list: 249a. to the awaiting coroutine.  As with a generator,
suspension means that all local state is retained, including the current
bindings of local variables, the instruction pointer, the internal
evaluation stack, and the state of any exception handling.  When the
execution is resumed by awaiting on the next object returned by the
asynchronous generator's methods, the function can proceed exactly as if
the yield expression were just another external call.  The value of the
yield expression after resuming depends on the method which resumed the
execution.  If *note __anext__(): 24a0. is used then the result is *note
None: 885.  Otherwise, if *note asend(): ad6. is used, then the result
will be the value passed in to that method.

If an asynchronous generator happens to exit early by *note break: 17f,
the caller task being cancelled, or other exceptions, the generator's
async cleanup code will run and possibly raise exceptions or access
context variables in an unexpected context-perhaps after the lifetime of
tasks it depends, or during the event loop shutdown when the
async-generator garbage collection hook is called.  To prevent this, the
caller must explicitly close the async generator by calling *note
aclose(): ad5. method to finalize the generator and ultimately detach it
from the event loop.

非同期ジェネレータ関数では、 *note try: 8f8. 構造内の任意の場所で yield
式が使用できます。 ただし、非同期ジェネレータが、(参照カウントがゼロに達
するか、ガベージコレクションによる) 終了処理より前に再開されない場合、
‘try’ 構造内の yield 式は失敗となり、実行待ちだった *note finally: 1b0.
節が実行されます。 このケースでは、非同期ジェネレータが作動しているイベ
ントループやスケジューラの責務は、非同期ジェネレータの *note aclose():
ad5. メソッドを呼び出し、残りのコルーチンオブジェクトを実行し、それによ
って実行待ちだった ‘finally’ 節が実行できるようにします。

To take care of finalization upon event loop termination, an event loop
should define a 'finalizer' function which takes an asynchronous
generator-iterator and presumably calls *note aclose(): ad5. and
executes the coroutine.  This 'finalizer' may be registered by calling
*note sys.set_asyncgen_hooks(): 199d.  When first iterated over, an
asynchronous generator-iterator will store the registered 'finalizer' to
be called upon finalization.  For a reference example of a 'finalizer'
method see the implementation of ‘asyncio.Loop.shutdown_asyncgens’ in
Lib/asyncio/base_events.py(1).

‘yield from <expr>’ 式は、非同期ジェネレータ関数で使われると文法エラーに
なります。

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/base_events.py


File: python.info,  Node: 非同期ジェネレータイテレータメソッド,  Prev: 非同期ジェネレータ関数 asynchronous generator function<2>,  Up: Yield 式

4.6.2.17 非同期ジェネレータイテレータメソッド
.............................................

この小節では、ジェネレータ関数の実行制御に使われる非同期ジェネレータイテ
レータのメソッドについて説明します。

 -- メソッド: async agen.__anext__ ()

     Returns an awaitable which when run starts to execute the
     asynchronous generator or resumes it at the last executed yield
     expression.  When an asynchronous generator function is resumed
     with an *note __anext__(): 24a0. method, the current yield
     expression always evaluates to *note None: 885. in the returned
     awaitable, which when run will continue to the next yield
     expression.  The value of the *note yield_list: 249a. of the yield
     expression is the value of the *note StopIteration: df5. exception
     raised by the completing coroutine.  If the asynchronous generator
     exits without yielding another value, the awaitable instead raises
     a *note StopAsyncIteration: 1e0f. exception, signalling that the
     asynchronous iteration has completed.

     このメソッドは通常、 *note for: 34a. ループによって暗黙に呼び出され
     ます。

 -- メソッド: async agen.asend (value)

     Returns an awaitable which when run resumes the execution of the
     asynchronous generator.  As with the *note send(): 126d. method for
     a generator, this "sends" a value into the asynchronous generator
     function, and the 'value' argument becomes the result of the
     current yield expression.  The awaitable returned by the *note
     asend(): ad6. method will return the next value yielded by the
     generator as the value of the raised *note StopIteration: df5, or
     raises *note StopAsyncIteration: 1e0f. if the asynchronous
     generator exits without yielding another value.  When *note
     asend(): ad6. is called to start the asynchronous generator, it
     must be called with *note None: 885. as the argument, because there
     is no yield expression that could receive the value.

 -- メソッド: async agen.athrow (value)

 -- メソッド: async agen.athrow (type[, value[, traceback]])

     Returns an awaitable that raises an exception of type ‘type’ at the
     point where the asynchronous generator was paused, and returns the
     next value yielded by the generator function as the value of the
     raised *note StopIteration: df5. exception.  If the asynchronous
     generator exits without yielding another value, a *note
     StopAsyncIteration: 1e0f. exception is raised by the awaitable.  If
     the generator function does not catch the passed-in exception, or
     raises a different exception, then when the awaitable is run that
     exception propagates to the caller of the awaitable.

     バージョン 3.12 で変更: The second signature (type[, value[,
     traceback]]) is deprecated and may be removed in a future version
     of Python.

 -- メソッド: async agen.aclose ()

     Returns an awaitable that when run will throw a *note
     GeneratorExit: 15e1. into the asynchronous generator function at
     the point where it was paused.  If the asynchronous generator
     function then exits gracefully, is already closed, or raises *note
     GeneratorExit: 15e1. (by not catching the exception), then the
     returned awaitable will raise a *note StopIteration: df5.
     exception.  Any further awaitables returned by subsequent calls to
     the asynchronous generator will raise a *note StopAsyncIteration:
     1e0f. exception.  If the asynchronous generator yields a value, a
     *note RuntimeError: 244. is raised by the awaitable.  If the
     asynchronous generator raises any other exception, it is propagated
     to the caller of the awaitable.  If the asynchronous generator has
     already exited due to an exception or normal exit, then further
     calls to *note aclose(): ad5. will return an awaitable that does
     nothing.


File: python.info,  Node: プライマリ,  Next: Await 式,  Prev: アトム、原子的要素 atom,  Up: 式 expression

4.6.3 プライマリ
----------------

プライマリは、言語において最も結合の強い操作を表します。文法は以下のよう
になります:

     primary: *note atom: 246c. | *note attributeref: 24a6. | *note subscription: 24a7. | *note call: 24a8.

* Menu:

* 属性参照::
* Subscriptions and slicings::
* 呼び出し (call): 呼び出し call.


File: python.info,  Node: 属性参照,  Next: Subscriptions and slicings,  Up: プライマリ

4.6.3.1 属性参照
................

属性参照は、プライマリの後ろにピリオドと名前を連ねたものです:

     attributeref: *note primary: 24a5. "." *note identifier: 22c1.

The primary must evaluate to an object of a type that supports attribute
references, which most objects do.  This object is then asked to produce
the attribute whose name is the identifier.  The type and value produced
is determined by the object.  Multiple evaluations of the same attribute
reference may yield different objects.

This production can be customized by overriding the *note
__getattribute__(): dcb. method or the *note __getattr__(): 6fa. method.
The ‘__getattribute__()’ method is called first and either returns a
value or raises *note AttributeError: 5f0. if the attribute is not
available.

If an *note AttributeError: 5f0. is raised and the object has a
‘__getattr__()’ method, that method is called as a fallback.


File: python.info,  Node: Subscriptions and slicings,  Next: 呼び出し call,  Prev: 属性参照,  Up: プライマリ

4.6.3.2 Subscriptions and slicings
..................................

The 'subscription' syntax is usually used for selecting an element from
a *note container: 23d4. - for example, to get a value from a *note
dict: 183.:

     >>> digits_by_name = {'one': 1, 'two': 2}
     >>> digits_by_name['two']  # Subscripting a dictionary using the key 'two'
     2

In the subscription syntax, the object being subscribed - a *note
primary: 24a4. - is followed by a 'subscript' in square brackets.  In
the simplest case, the subscript is a single expression.

Depending on the type of the object being subscribed, the subscript is
sometimes called a *note key: 23e4. (for mappings), *note index: 23e3.
(for sequences), or 'type argument' (for *note generic types: 1a1.).
Syntactically, these are all equivalent:

     >>> colors = ['red', 'blue', 'green', 'black']
     >>> colors[3]  # Subscripting a list using the index 3
     'black'

     >>> list[str]  # Parameterizing the list type using the type argument str
     list[str]

At runtime, the interpreter will evaluate the primary and the subscript,
and call the primary's *note __getitem__(): 588. or *note
__class_getitem__(): 943. *note special method: 1c60. with the subscript
as argument.  For more details on which of these methods is called, see
*note __class_getitem__ versus __getitem__: 23cd.

To show how subscription works, we can define a custom object that
implements *note __getitem__(): 588. and prints out the value of the
subscript:

     >>> class SubscriptionDemo:
     ...     def __getitem__(self, key):
     ...         print(f'subscripted with: {key!r}')
     ...
     >>> demo = SubscriptionDemo()
     >>> demo[1]
     subscripted with: 1
     >>> demo['a' * 3]
     subscripted with: 'aaa'

See *note __getitem__(): 588. documentation for how built-in types
handle subscription.

Subscriptions may also be used as targets in *note assignment: 2427. or
*note deletion: 1b1f. statements.  In these cases, the interpreter will
call the subscripted object's *note __setitem__(): 14e3. or *note
__delitem__(): 14e4. *note special method: 1c60, respectively, instead
of *note __getitem__(): 588.

     >>> colors = ['red', 'blue', 'green', 'black']
     >>> colors[3] = 'white'  # Setting item at index
     >>> colors
     ['red', 'blue', 'green', 'white']
     >>> del colors[3]  # Deleting item at index 3
     >>> colors
     ['red', 'blue', 'green']

All advanced forms of 'subscript' documented in the following sections
are also usable for assignment and deletion.

* Menu:

* スライス表記 (slicing): スライス表記 slicing.
* Comma-separated subscripts::
* "Starred" subscriptions::
* Formal subscription grammar::


File: python.info,  Node: スライス表記 slicing,  Next: Comma-separated subscripts,  Up: Subscriptions and slicings

4.6.3.3 スライス表記 (slicing)
..............................

A more advanced form of subscription, 'slicing', is commonly used to
extract a portion of a *note sequence: 2338.  In this form, the
subscript is a *note slice: 24ae.: up to three expressions separated by
colons.  Any of the expressions may be omitted, but a slice must contain
at least one colon:

     >>> number_names = ['zero', 'one', 'two', 'three', 'four', 'five']
     >>> number_names[1:3]
     ['one', 'two']
     >>> number_names[1:]
     ['one', 'two', 'three', 'four', 'five']
     >>> number_names[:3]
     ['zero', 'one', 'two']
     >>> number_names[:]
     ['zero', 'one', 'two', 'three', 'four', 'five']
     >>> number_names[::2]
     ['zero', 'two', 'four']
     >>> number_names[:-3]
     ['zero', 'one', 'two']
     >>> del number_names[4:]
     >>> number_names
     ['zero', 'one', 'two', 'three']

When a slice is evaluated, the interpreter constructs a *note slice:
694. object whose *note start: 23a5, *note stop: 23a6. and *note step:
23a7. attributes, respectively, are the results of the expressions
between the colons.  Any missing expression evaluates to *note None:
885.  This ‘slice’ object is then passed to the *note __getitem__():
588. or *note __class_getitem__(): 943. *note special method: 1c60, as
above.

     # continuing with the SubscriptionDemo instance defined above:
     >>> demo[2:3]
     subscripted with: slice(2, 3, None)
     >>> demo[::'spam']
     subscripted with: slice(None, None, 'spam')


File: python.info,  Node: Comma-separated subscripts,  Next: "Starred" subscriptions,  Prev: スライス表記 slicing,  Up: Subscriptions and slicings

4.6.3.4 Comma-separated subscripts
..................................

The subscript can also be given as two or more comma-separated
expressions or slices:

     # continuing with the SubscriptionDemo instance defined above:
     >>> demo[1, 2, 3]
     subscripted with: (1, 2, 3)
     >>> demo[1:2, 3]
     subscripted with: (slice(1, 2, None), 3)

This form is commonly used with numerical libraries for slicing
multi-dimensional data.  In this case, the interpreter constructs a
*note tuple: 614. of the results of the expressions or slices, and
passes this tuple to the *note __getitem__(): 588. or *note
__class_getitem__(): 943. *note special method: 1c60, as above.

The subscript may also be given as a single expression or slice followed
by a comma, to specify a one-element tuple:

     >>> demo['spam',]
     subscripted with: ('spam',)


File: python.info,  Node: "Starred" subscriptions,  Next: Formal subscription grammar,  Prev: Comma-separated subscripts,  Up: Subscriptions and slicings

4.6.3.5 "Starred" subscriptions
...............................

Added in version 3.11: Expressions in 'tuple_slices' may be starred.
See PEP 646(1).

The subscript can also contain a starred expression.  In this case, the
interpreter unpacks the result into a tuple, and passes this tuple to
*note __getitem__(): 588. or *note __class_getitem__(): 943.:

     # continuing with the SubscriptionDemo instance defined above:
     >>> demo[*range(10)]
     subscripted with: (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)

Starred expressions may be combined with comma-separated expressions and
slices:

     >>> demo['a', 'b', *range(3), 'c']
     subscripted with: ('a', 'b', 0, 1, 2, 'c')

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0646/


File: python.info,  Node: Formal subscription grammar,  Prev: "Starred" subscriptions,  Up: Subscriptions and slicings

4.6.3.6 Formal subscription grammar
...................................

     subscription:     *note primary: 24a5. '[' *note subscript: 24b2. ']'
     subscript:        *note single_subscript: 24b3. | *note tuple_subscript: 24b4.
     single_subscript: *note proper_slice: 24b5. | *note assignment_expression: 242d.
     proper_slice:     [*note expression: 182.] ":" [*note expression: 182.] [ ":" [*note expression: 182.] ]
     tuple_subscript:  ','.(*note single_subscript: 24b3. | *note starred_expression: 2484.)+ [',']

Recall that the ‘|’ operator *note denotes ordered choice: 2284.
Specifically, in ‘subscript’, if both alternatives would match, the
first (‘single_subscript’) has priority.


File: python.info,  Node: 呼び出し call,  Prev: Subscriptions and slicings,  Up: プライマリ

4.6.3.7 呼び出し (call)
.......................

呼び出しは、呼び出し可能オブジェクト (例えば *note function: 24b7.) を
*note arguments: 67b. の系列とともに呼び出します。系列は空の系列であって
もかまいません:

     call:                 *note primary: 24a5. "(" [*note argument_list: 24b8. [","] | *note comprehension: 2486.] ")"
     argument_list:        *note positional_arguments: 24b9. ["," *note starred_and_keywords: 24ba.]
                             ["," *note keywords_arguments: 24bb.]
                           | *note starred_and_keywords: 24ba. ["," *note keywords_arguments: 24bb.]
                           | *note keywords_arguments: 24bb.
     positional_arguments: *note positional_item: 24bc. ("," *note positional_item: 24bc.)*
     positional_item:      *note assignment_expression: 242d. | "*" *note expression: 182.
     starred_and_keywords: ("*" *note expression: 182. | *note keyword_item: 24bd.)
                           ("," "*" *note expression: 182. | "," *note keyword_item: 24bd.)*
     keywords_arguments:   (*note keyword_item: 24bd. | "**" *note expression: 182.)
                           ("," *note keyword_item: 24bd. | "," "**" *note expression: 182.)*
     keyword_item:         *note identifier: 22c1. "=" *note expression: 182.

最後の位置引数やキーワード引数の後にカンマをつけてもかまいません。構文の
意味付けに影響を及ぼすことはありません。

The primary must evaluate to a callable object (user-defined functions,
built-in functions, methods of built-in objects, class objects, methods
of class instances, and all objects having a *note __call__(): 77a.
method are callable).  All argument expressions are evaluated before the
call is attempted.  Please refer to section *note 関数定義: 2018. for
the syntax of formal *note parameter: 234b. lists.

キーワード引数が存在する場合、以下のようにして最初に位置引数 (positional
argument) に変換されます。まず、値の入っていないスロットが仮引数に対して
生成されます。N 個の位置引数がある場合、位置引数は先頭の N スロットに配
置されます。次に、各キーワード引数について、識別子を使って対応するスロッ
トを決定します (識別子が最初の仮引数名と同じなら、最初のスロットを使う、
といった具合です)。スロットがすでにすべて埋まっていたなら *note
TypeError: 198. 例外が送出されます。それ以外の場合、引数をスロットに埋め
ていきます。 (式が ‘None’ であっても、その式でスロットを埋めます)。全て
の引数が処理されたら、まだ埋められていないスロットをそれぞれに対応する関
数定義時のデフォルト値で埋めます。(デフォルト値は、関数が定義されたとき
に一度だけ計算されます; 従って、リストや辞書のような変更可能なオブジェク
トがデフォルト値として使われると、対応するスロットに引数を指定しない限り
、このオブジェクトが全ての呼び出しから共有されます; このような状況は通常
避けるべきです。) デフォルト値が指定されていない、値の埋められていないス
ロットが残っている場合 *note TypeError: 198. 例外が送出されます。そうで
ない場合、値の埋められたスロットからなるリストが呼び出しの引数として使わ
れます。

実装では、名前を持たない位置引数を受け取る組み込み関数を提供されるかもし
れません。そういった引数がドキュメント化のために '名付けられて' いたとし
ても、実際には名付けられていないのでキーワードでは提供されません。
CPython では、C 言語で実装された関数の、名前を持たない位置引数をパースす
るために *note PyArg_ParseTuple(): 3c1. を使用します。

仮引数スロットの数よりも多くの位置引数がある場合、構文 ‘*identifier’ を
使って指定された仮引数がないかぎり、 *note TypeError: 198. 例外が送出さ
れます; 仮引数 ‘*identifier’ がある場合、この仮引数は余分な位置引数が入
ったタプル (もしくは、余分な位置引数がない場合には空のタプル) を受け取り
ます。

キーワード引数のいずれかが仮引数名に対応しない場合、構文 ‘**identifier’
を使って指定された仮引数がない限り、 *note TypeError: 198. 例外が送出さ
れます; 仮引数 ‘**identifier’ がある場合、この仮引数は余分なキーワード引
数が入った (キーワードをキーとし、引数値をキーに対応する値とした) 辞書を
受け取ります。余分なキーワード引数がない場合には、空の (新たな) 辞書を受
け取ります。

関数呼び出しに ‘*expression’ という構文が現れる場合は、 ‘expression’ の
評価結果は *note イテラブル: 12f1. でなければなりません。 そのイテラブル
の要素は、追加の位置引数であるかのように扱われます。 ‘f(x1, x2, *y, x3,
x4)’ という呼び出しにおいて、 'y' の評価結果がシーケンス 'y1', ..., 'yM'
だった場合は、この呼び出しは M+4 個の位置引数 'x1', 'x2', 'y1', ...,
'yM', 'x3', 'x4' での呼び出しと同じになります。

この結論としては、 ‘*expression’ 構文がキーワード引数の '後ろ' に来るこ
ともありますが、キーワード引数 (と任意の ‘**expression’ 引数 - 下を参照)
よりも '前' にあるものとして処理されます。 従って、このような動作になり
ます:

     >>> def f(a, b):
     ...     print(a, b)
     ...
     >>> f(b=1, *(2,))
     2 1
     >>> f(a=1, *(2,))
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: f() got multiple values for keyword argument 'a'
     >>> f(1, *(2,))
     1 2

キーワード引数と ‘*expression’ 構文を同じ呼び出しで一緒に使うことはあま
りないので、実際に上記のような混乱が頻繁に生じることはありません。

関数呼び出しで ‘**expression’ 構文が使われた場合、 ‘expression’ の評価結
果は *note マッピング: 13d3. でなければなりません。その内容は追加のキー
ワード引数として扱われます。 キーにマッチする引数が (明示的なキーワード
引数によって、あるいは他のアンパックの中で) 既に値を与えられていたなら、
*note TypeError: 198. 例外が送出されます。

When ‘**expression’ is used, each key in this mapping must be a string.
Each value from the mapping is assigned to the first formal parameter
eligible for keyword assignment whose name is equal to the key.  A key
need not be a Python identifier (e.g.  ‘"max-temp °F"’ is acceptable,
although it will not match any formal parameter that could be declared).
If there is no match to a formal parameter the key-value pair is
collected by the ‘**’ parameter, if there is one, or if there is not, a
*note TypeError: 198. exception is raised.

‘*identifier’ や ‘**identifier’ 構文を使った仮引数は、位置引数スロットや
キーワード引数名にすることができません。

バージョン 3.5 で変更: 関数呼び出しは任意の数の ‘*’ アンパックと ‘**’ ア
ンパックを受け取り、位置引数はイテラブルアンパック (‘*’) の後ろに置け、
キーワード引数は辞書アンパック (‘**’) の後ろに置けるようになりました。 最
初に PEP 448(1) で提案されました。

呼び出しを行うと、例外を送出しない限り、常に何らかの値を返します。
‘None’ を返す場合もあります。戻り値がどのように算出されるかは、呼び出し
可能オブジェクトの形態によって異なります。

各形態では--

ユーザ定義関数:

     The code block for the function is executed, passing it the
     argument list.  The first thing the code block will do is bind the
     formal parameters to the arguments; this is described in section
     *note 関数定義: 2018.  When the code block executes a *note return:
     1af. statement, this specifies the return value of the function
     call.  If execution reaches the end of the code block without
     executing a *note return: 1af. statement, the return value is
     ‘None’.

組み込み関数またはメソッド:

     結果はインタプリタに依存します; 組み込み関数やメソッドの詳細は
     *note 組み込み関数: 1474. を参照してください。

クラスオブジェクト:

     そのクラスの新しいインスタンスが返されます。

クラスインスタンスメソッド:

     対応するユーザ定義の関数が呼び出されます。このとき、呼び出し時の引
     数リストより一つ長い引数リストで呼び出されます: インスタンスが引数
     リストの先頭に追加されます。

クラスインスタンス:

     The class must define a *note __call__(): 77a. method; the effect
     is then the same as if that method was called.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0448/


File: python.info,  Node: Await 式,  Next: べき乗演算 power operator,  Prev: プライマリ,  Up: 式 expression

4.6.4 Await 式
--------------

*note awaitable: 4c9. オブジェクトでの *note coroutine: 6b9. 実行を一時
停止します。 *note coroutine function: f73. 内でのみ使用できます。

     await_expr: "await" *note primary: 24a5.

Added in version 3.5.


File: python.info,  Node: べき乗演算 power operator,  Next: 単項算術演算とビット単位演算 unary arithmetic and bitwise operation,  Prev: Await 式,  Up: 式 expression

4.6.5 べき乗演算 (power operator)
---------------------------------

べき乗演算は、左側にある単項演算子よりも強い結合優先順位となります。一方
、右側にある単項演算子よりは弱い結合優先順位になっています。構文は以下の
ようになります:

     power: (*note await_expr: 24bf. | *note primary: 24a5.) ["**" *note u_expr: 24c3.]

従って、べき乗演算子と単項演算子からなる演算列が丸括弧で囲われていない場
合、演算子は右から左へと評価されます (この場合は演算子の評価順序を強制し
ません。つまり ‘-1**2’ は ‘-1’ になります)。

The power operator has the same semantics as the built-in *note pow():
1a4. function, when called with two arguments: it yields its left
argument raised to the power of its right argument.  Numeric arguments
are first *note converted to a common type: 2469, and the result is of
that type.

整数の被演算子では、第二引数が負でない限り、結果は被演算子と同じ型になり
ます; 第二引数が負の場合、全ての引数は浮動小数点型に変換され、浮動小数点
型が返されます。例えば ‘10**2’ は ‘100’ を返しますが、‘10**-2’ は ‘0.01’
を返します。

‘0.0’ を負の数でべき乗すると *note ZeroDivisionError: b3f. を送出します
。負の数を小数でべき乗した結果は複素数 (*note complex: 197. number) にな
ります。 (以前のバージョンでは *note ValueError: 2ec. を送出していました
)

This operation can be customized using the special *note __pow__(): 9d4.
and *note __rpow__(): 1a5. methods.


File: python.info,  Node: 単項算術演算とビット単位演算 unary arithmetic and bitwise operation,  Next: 二項算術演算 binary arithmetic operation,  Prev: べき乗演算 power operator,  Up: 式 expression

4.6.6 単項算術演算とビット単位演算 (unary arithmetic and bitwise operation)
---------------------------------------------------------------------------

全ての単項算術演算とビット単位演算は、同じ優先順位を持っています:

     u_expr: *note power: 24c2. | "-" *note u_expr: 24c3. | "+" *note u_expr: 24c3. | "~" *note u_expr: 24c3.

The unary ‘-’ (minus) operator yields the negation of its numeric
argument; the operation can be overridden with the *note __neg__():
2403. special method.

The unary ‘+’ (plus) operator yields its numeric argument unchanged; the
operation can be overridden with the *note __pos__(): 2404. special
method.

The unary ‘~’ (invert) operator yields the bitwise inversion of its
integer argument.  The bitwise inversion of ‘x’ is defined as ‘-(x+1)’.
It only applies to integral numbers or to custom objects that override
the *note __invert__(): 2406. special method.

上記の三つはいずれも、引数が正しい型でない場合には *note TypeError: 198.
例外が送出されます。


File: python.info,  Node: 二項算術演算 binary arithmetic operation,  Next: シフト演算 shifting operation,  Prev: 単項算術演算とビット単位演算 unary arithmetic and bitwise operation,  Up: 式 expression

4.6.7 二項算術演算 (binary arithmetic operation)
------------------------------------------------

二項算術演算は、慣習的な優先順位を踏襲しています。演算子のいずれかは、特
定の非数値型にも適用されるので注意してください。べき乗 (power) 演算子を
除き、演算子には二つのレベル、すなわち乗算的 (multiplicatie) 演算子と加
算的 (additie) 演算子しかありません:

     m_expr: *note u_expr: 24c3. | *note m_expr: 24c6. "*" *note u_expr: 24c3. | *note m_expr: 24c6. "@" *note m_expr: 24c6. |
             *note m_expr: 24c6. "//" *note u_expr: 24c3. | *note m_expr: 24c6. "/" *note u_expr: 24c3. |
             *note m_expr: 24c6. "%" *note u_expr: 24c3.
     a_expr: *note m_expr: 24c6. | *note a_expr: 24c7. "+" *note m_expr: 24c6. | *note a_expr: 24c7. "-" *note m_expr: 24c6.

The ‘*’ (multiplication) operator yields the product of its arguments.
The arguments must either both be numbers, or one argument must be an
integer and the other must be a sequence.  In the former case, the
numbers are *note converted to a common real type: 2469. and then
multiplied together.  In the latter case, sequence repetition is
performed; a negative repetition factor yields an empty sequence.

This operation can be customized using the special *note __mul__():
23e0. and *note __rmul__(): 23e1. methods.

バージョン 3.14 で変更: If only one operand is a complex number, the
other operand is converted to a floating-point number.

‘@’ (at) 演算子は行列の乗算に対し使用されます。 Python の組み込み型はこ
の演算子を実装していません。

This operation can be customized using the special *note __matmul__():
f79. and *note __rmatmul__(): f7a. methods.

Added in version 3.5.

The ‘/’ (division) and ‘//’ (floor division) operators yield the
quotient of their arguments.  The numeric arguments are first *note
converted to a common type: 2469.  Division of integers yields a float,
while floor division of integers results in an integer; the result is
that of mathematical division with the 'floor' function applied to the
result.  Division by zero raises the *note ZeroDivisionError: b3f.
exception.

The division operation can be customized using the special *note
__truediv__(): 1090. and *note __rtruediv__(): 23f1. methods.  The floor
division operation can be customized using the special *note
__floordiv__(): 170d. and *note __rfloordiv__(): 23f2. methods.

The ‘%’ (modulo) operator yields the remainder from the division of the
first argument by the second.  The numeric arguments are first *note
converted to a common type: 2469.  A zero right argument raises the
*note ZeroDivisionError: b3f. exception.  The arguments may be
floating-point numbers, e.g., ‘3.14%0.7’ equals ‘0.34’ (since ‘3.14’
equals ‘4*0.7 + 0.34’.)  The modulo operator always yields a result with
the same sign as its second operand (or zero); the absolute value of the
result is strictly smaller than the absolute value of the second operand
(1).

切り捨て除算演算と剰余演算は、恒等式: ‘x == (x//y)*y + (x%y)’ の関係にあ
ります。切り捨て除算や剰余はまた、組み込み関数 *note divmod(): b99.:
‘divmod(x, y) == (x//y, x%y)’ とも関係しています。 (2) 。

‘%’ 演算子は、数値に対する剰余演算を行うのに加えて、文字列 (string) オブ
ジェクトにオーバーロードされ、旧式の文字列の書式化 (いわゆる補間) を行い
ます。文字列の書式化の構文は Python ライブラリリファレンス *note printf
形式の文字列書式化: 8db. 節を参照してください。

The 'modulo' operation can be customized using the special *note
__mod__(): 23ea. and *note __rmod__(): fd5. methods.

The floor division operator, the modulo operator, and the *note
divmod(): b99. function are not defined for complex numbers.  Instead,
convert to a floating-point number using the *note abs(): 208d. function
if appropriate.

The ‘+’ (addition) operator yields the sum of its arguments.  The
arguments must either both be numbers or both be sequences of the same
type.  In the former case, the numbers are *note converted to a common
real type: 2469. and then added together.  In the latter case, the
sequences are concatenated.

This operation can be customized using the special *note __add__():
23dd. and *note __radd__(): 23de. methods.

バージョン 3.14 で変更: If only one operand is a complex number, the
other operand is converted to a floating-point number.

The ‘-’ (subtraction) operator yields the difference of its arguments.
The numeric arguments are first *note converted to a common real type:
2469.

This operation can be customized using the special *note __sub__():
23e9. and *note __rsub__(): 23f0. methods.

バージョン 3.14 で変更: If only one operand is a complex number, the
other operand is converted to a floating-point number.

   ---------- Footnotes ----------

   (1) ‘abs(x%y) < abs(y)’ は数学的には真となりますが、浮動小数点に対す
る演算の場合には、値丸め (roundoff) のために数値計算的に真にならない場合
があります。例えば、Python の浮動小数点型が IEEE754 倍精度数型になってい
るプラットフォームを仮定すると、 ‘-1e-100 % 1e100’ は ‘1e100’ と同じ符号
になるはずなのに、計算結果は ‘-1e-100 + 1e100’ となります。これは数値計
算的には厳密に ‘1e100’ と等価です。関数 *note math.fmod(): 24c8. は、最
初の引数と符号が一致するような値を返すので、上記の場合には ‘-1e-100’ を
返します。どちらのアプローチが適切かは、アプリケーションに依存します。

   (2) x が y の正確な整数倍に非常に近いと、丸めのために ‘x//y’ が
‘(x-x%y)//y’ よりも 1 だけ大きくなる可能性があります。そのような場合、
Python は ‘divmod(x,y)[0] * y + x % y’ が ‘x’ に非常に近くなるという関係
を保つために、後者の値を返します。


File: python.info,  Node: シフト演算 shifting operation,  Next: ビット単位演算の二項演算 binary bitwise operation,  Prev: 二項算術演算 binary arithmetic operation,  Up: 式 expression

4.6.8 シフト演算 (shifting operation)
-------------------------------------

シフト演算は、算術演算よりも低い優先順位を持っています:

     shift_expr: *note a_expr: 24c7. | *note shift_expr: 24cb. ("<<" | ">>") *note a_expr: 24c7.

これらは整数を引数にとります。引数は共通の型に変換されます。シフト演算は
第一引数を、第二引数で与えられたビット数だけ、左または右にビットシフトし
ます。

The left shift operation can be customized using the special *note
__lshift__(): 23eb. and *note __rlshift__(): 23f4. methods.  The right
shift operation can be customized using the special *note __rshift__():
23ec. and *note __rrshift__(): 23f5. methods.

'n' ビットの右シフトは ‘pow(2,n)’ による除算として定義されます。'n' ビッ
トの左シフトは ‘pow(2,n)’ による乗算として定義されます。


File: python.info,  Node: ビット単位演算の二項演算 binary bitwise operation,  Next: 比較,  Prev: シフト演算 shifting operation,  Up: 式 expression

4.6.9 ビット単位演算の二項演算 (binary bitwise operation)
---------------------------------------------------------

以下の三つのビット単位演算には、それぞれ異なる優先順位レベルがあります:

     and_expr: *note shift_expr: 24cb. | *note and_expr: 24ce. "&" *note shift_expr: 24cb.
     xor_expr: *note and_expr: 24ce. | *note xor_expr: 24cf. "^" *note and_expr: 24ce.
     or_expr:  *note xor_expr: 24cf. | *note or_expr: 2302. "|" *note xor_expr: 24cf.

The ‘&’ operator yields the bitwise AND of its arguments, which must be
integers or one of them must be a custom object overriding *note
__and__(): 23ed. or *note __rand__(): 23f6. special methods.

The ‘^’ operator yields the bitwise XOR (exclusive OR) of its arguments,
which must be integers or one of them must be a custom object overriding
*note __xor__(): 23ee. or *note __rxor__(): 23f7. special methods.

The ‘|’ operator yields the bitwise (inclusive) OR of its arguments,
which must be integers or one of them must be a custom object overriding
*note __or__(): 23ef. or *note __ror__(): 23f8. special methods.


File: python.info,  Node: 比較,  Next: ブール演算 boolean operation,  Prev: ビット単位演算の二項演算 binary bitwise operation,  Up: 式 expression

4.6.10 比較
-----------

C 言語と違って、Python における比較演算子は同じ優先順位をもっており、全
ての算術演算子、シフト演算子、ビット単位演算子よりも低くなっています。ま
た ‘a < b < c’ が数学で伝統的に用いられているのと同じ解釈になる点も C 言
語と違います:

     comparison:    *note or_expr: 2302. (*note comp_operator: 24d3. *note or_expr: 2302.)*
     comp_operator: "<" | ">" | "==" | ">=" | "<=" | "!="
                    | "is" ["not"] | ["not"] "in"

Comparisons yield boolean values: ‘True’ or ‘False’.  Custom 'rich
comparison methods' may return non-boolean values.  In this case Python
will call *note bool(): 3c3. on such value in boolean contexts.

比較はいくらでも連鎖することができます。例えば ‘x < y <= z’ は ‘x < y
and y <= z’ と等価になります。ただしこの場合、前者では ‘y’ はただ一度だ
け評価される点が異なります (どちらの場合でも、 ‘x < y’ が偽になると ‘z’
の値はまったく評価されません)。

形式的には、 'a', 'b', 'c', ..., 'y', 'z' が式で 'op1', 'op2', ...,
'opN' が比較演算子である場合、 ‘a op1 b op2 c ... y opN z’ は ‘a op1 b
and b op2 c and ... y opN z’ と等価になります。ただし、前者では各式は多
くても一度しか評価されません。

‘a op1 b op2 c’ と書いた場合、 'a' から 'c' までの範囲にあるかどうかのテ
ストを指すのではないことに注意してください。例えば ‘x < y > z’ は (きれ
いな書き方ではありませんが) 完全に正しい文法です。

* Menu:

* 値の比較::
* 所属検査演算::
* 同一性の比較::


File: python.info,  Node: 値の比較,  Next: 所属検査演算,  Up: 比較

4.6.10.1 値の比較
.................

演算子 ‘<’, ‘>’, ‘==’, ‘>=’, ‘<=’, および ‘!=’ は2つのオブジェクトの値を
比較します。 オブジェクトが同じ型を持つ必要はりません。

*note オブジェクト、値、および型: 232c. の章では、オブジェクトは (型や
id に加えて) 値を持つことを述べています。 オブジェクトの値は Python では
やや抽象的な概念です: 例えば、オブジェクトの値にアクセスする正統な方法は
ありません。 また、その全てのデータ属性から構成されるなどの特定の方法で
、オブジェクトの値を構築する必要性もありません。 比較演算子は、オブジェ
クトの値とは何かについての特定の概念を実装しています。 この比較の実装に
よって、間接的にオブジェクトの値を定義していると考えることもできます。

Because all types are (direct or indirect) subtypes of *note object:
c7e, they inherit the default comparison behavior from *note object:
c7e.  Types can customize their comparison behavior by implementing
'rich comparison methods' like *note __lt__(): 14b8, described in *note
基本的なカスタマイズ: 23ad.

等価比較 (‘==’ および ‘!=’) のデフォルトの振る舞いは、オブジェクトの同一
性に基づいています。 従って、同一のインスタンスの等価比較の結果は等しい
となり、同一でないインスタンスの等価比較の結果は等しくないとなります。 デ
フォルトの振る舞いをこのようにしたのは、全てのオブジェクトを反射的
(reflexive つまり ‘x is y’ ならば ‘x == y’) なものにしたかったからです。

デフォルトの順序比較 (‘<’, ‘>’, ‘<=’, ‘>=’) は提供されません; 比較しよう
とすると *note TypeError: 198. が送出されます。 この振る舞いをデフォルト
の振る舞いにした動機は、等価性と同じような不変性が欠けているからです。

同一でないインスタンスは常に等価でないとする等価比較のデフォルトの振る舞
いは、型が必要とするオブジェクトの値や値に基づいた等価性の実用的な定義と
は対照的に思えるでしょう。 そのような型では比較の振る舞いをカスタマイズ
する必要が出てきて、実際にたくさんの組み込み型でそれが行われています。

次のリストでは、最重要の組み込み型の比較の振る舞いを解説しています。

   * いくつかの組み込みの数値型 (*note 数値型 int, float, complex:
     1fdc.) と標準ライブラリの型 *note fractions.Fraction: 213. および
     *note decimal.Decimal: 1fe. は、これらの型の範囲で異なる型とも比較
     できますが、複素数では順序比較がサポートされていないという制限があ
     ります。 関わる型の制限の範囲内では、精度のロス無しに数学的に (アル
     ゴリズム的に) 正しい比較が行われます。

     非数値である ‘float('NaN')’ と ‘decimal.Decimal('NaN')’ は特別です
     。 数と非数値との任意の順序比較は偽です。 直観に反する帰結として、
     非数値は自分自身と等価ではないことになります。 例えば ‘x =
     float('NaN')’ ならば、 ‘3 < x’, ‘x < 3’, ‘x == x’ は全て偽で、‘x !=
     x’ は真です。 この振る舞いは IEEE 754 に従ったものです。

   * ‘None’ and *note NotImplemented: 1a2. are singletons.  PEP 8(1)
     advises that comparisons for singletons should always be done with
     ‘is’ or ‘is not’, never the equality operators.

   * バイナリシーケンス (*note bytes: 192. または *note bytearray: 344.
     のインスタンス) は、これらの型の範囲で異なる型とも比較できます。 比
     較は要素の数としての値を使った辞書式順序で行われます。

   * 文字列 (*note str: 169. のインスタンス) の比較は、文字の Unicode の
     コードポイントの数としての値 (組み込み関数 *note ord(): 233b. の返
     り値) を使った辞書式順序で行われます。 (2)

     文字列とバイナリシーケンスは直接には比較できません。

   * シーケンス (*note tuple: 614, *note list: 24d, or *note range: b3d.
     のインスタンス) の比較は、同じ型どうしでしか行えず、 range は順序比
     較をサポートしていません。 異なる型どうしの等価比較の結果は等価でな
     いとなり、異なる型どうしの順序比較は *note TypeError: 198. を送出し
     ます。

     Sequences compare lexicographically using comparison of
     corresponding elements.  The built-in containers typically assume
     identical objects are equal to themselves.  That lets them bypass
     equality tests for identical objects to improve performance and to
     maintain their internal invariants.

     組み込みのコレクションどうしの辞書式比較は次のように動作します:

        - 比較の結果が等価となる2つのコレクションは、同じ型、同じ長さ、
          対応する要素どうしの比較の結果が等価でなければなりません (例え
          ば、 ‘[1,2] == (1,2)’ は型が同じでないので偽です)。

        - 順序比較をサポートしているコレクションの順序は、最初の等価でな
          い要素の順序と同じになります (例えば、 ‘[1,2,x] <= [1,2,y]’ は
          ‘x <= y’ と同じ値になります)。 対応する要素が存在しない場合、
          短い方のコレクションの方が先の順序となります (例えば、 ‘[1,2]
          < [1,2,3]’ は真です)。

   * マッピング (*note dict: 183. のインスタンス) の比較の結果が等価とな
     るのは、同じ ‘(key, value)’ を持っているときかつそのときに限ります
     。 キーと値の等価比較では反射性が強制されます。

     順序比較 (‘<’, ‘>’, ‘<=’, ‘>=’) は *note TypeError: 198. を送出しま
     す。

   * 集合 (*note set: 184. または *note frozenset: 7f2. のインスタンス)
     の比較は、これらの型の範囲で異なる型とも行えます。

     集合には、部分集合あるいは上位集合かどうかを基準とする順序比較が定
     義されています。 この関係は全順序を定義しません (例えば、 ‘{1,2}’ と
     ‘{2,3}’ という2つの集合は片方がもう一方の部分集合でもなく上位集合で
     もありません)。 従って、集合は全順序性に依存する関数の引数として適
     切ではありません (例えば、 *note min(): 110b, *note max(): 110c,
     *note sorted(): dc7. は集合のリストを入力として与えると未定義な結果
     となります)。

     集合の比較では、その要素の反射性が強制されます。

   * 他の組み込み型のほとんどは比較メソッドが実装されておらず、デフォル
     トの比較の振る舞いを継承します。

比較の振る舞いをカスタマイズしたユーザ定義クラスは、可能なら次の一貫性の
規則に従う必要があります:

   * 等価比較は反射的でなければなりません。 つまり、同一のオブジェクトは
     等しくなければなりません:

          ‘x is y’ ならば ‘x == y’

   * 比較は対称的でなければなりません。 つまり、以下の式の結果は同じでな
     ければなりません:

          ‘x == y’ と ‘y == x’

          ‘x != y’ と ‘y != x’

          ‘x < y’ と ‘y > x’

          ‘x <= y’ と ‘y >= x’

   * 比較は推移的でなければなりません。 以下の (包括的でない) 例がその説
     明です:

          ‘x > y and y > z’ ならば ‘x > z’

          ‘x < y and y <= z’ ならば ‘x < z’

   * 比較の逆は真偽値の否定でなければなりません。 つまり、以下の式の結果
     は同じでなければなりません:

          ‘x == y’ と ‘not x != y’

          ‘x < y’ と ‘not x >= y’ (全順序の場合)

          ‘x > y’ と ‘not x <= y’ (全順序の場合)

     最後の2式は全順序コレクションに当てはまります (たとえばシーケンスに
     は当てはまりますが、集合やマッピングには当てはまりません)。 *note
     total_ordering(): 1144. デコレータも参照してください。

   * *note hash(): 801. の結果は等価性と一貫している必要があります。 等
     価なオブジェクトどうしは同じハッシュ値を持つか、ハッシュ値が計算で
     きないものとされる必要があります。

Python はこの一貫性規則を強制しません。 事実、非数値がこの規則に従わない
例となります。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0008/

   (2) Unicode 標準では、 'コードポイント (code point)' (例えば、U+0041)
と '抽象文字 (abstract character)' (例えば、"LATIN CAPITAL LETTER A") を
区別します。 Unicode のほとんどの抽象文字は 1 つのコードポイントだけを使
って表現されますが、複数のコードポイントの列を使っても表現できる抽象文字
もたくさんあります。 例えば、抽象文字 "LATIN CAPITAL LETTER C WITH
CEDILLA" はコード位置 U+00C7 にある '合成済み文字 (precomposed
character)' 1 つだけでも表現できますし、コード位置 U+0043 (LATIN CAPITAL
LETTER C) にある '基底文字 (base character)' の後ろに、コード位置 U+0327
(COMBINING CEDILLA) にある '結合文字 (combining character)' が続く列とし
ても表現できます。

文字列の比較操作は Unicode のコードポイントのレベルで行われます。 これは
人間にとっては直感的ではないかもしれません。 例えば、 ‘"\u00C7" ==
"\u0043\u0327"’ は、どちらの文字も同じ抽象文字 "LATIN CAPITAL LETTER C
WITH CEDILLA" を表現しているにもかかわらず、その結果は ‘False’ となりま
す。

抽象文字のレベルで (つまり、人間にとって直感的な方法で) 文字列を比較する
には *note unicodedata.normalize(): 8e4. を使ってください。


File: python.info,  Node: 所属検査演算,  Next: 同一性の比較,  Prev: 値の比較,  Up: 比較

4.6.10.2 所属検査演算
.....................

演算子 *note in: 34b. および *note not in: 841. は所属関係を調べます。
‘x in s’ の評価は、 'x' が 's' の要素であれば ‘True’ となり、そうでなけ
れば ‘False’ となります。 ‘x not in s’ は ‘x in s’ の否定を返します。 す
べての組み込みのシーケンス型と集合型に加えて、辞書も ‘in’ を辞書が与えら
れたキーを持っているかを調べる演算子としてサポートしています。 リスト、
タプル、集合、凍結集合、辞書、 collections.deque のようなコンテナ型にお
いて、式 ‘x in y’ は ‘any(x is e or x == e for e in y)’ と等価です。

文字列やバイト列型については、 ‘x in y’ は 'x' が 'y' の部分文字列である
とき、かつそのときに限り ‘True’ になります。これは ‘y.find(x) != -1’ と
等価です。空文字列は、他の任意の文字列の部分文字列とみなされます。従って
‘"" in "abc"’ は ‘True’ を返すことになります。

For user-defined classes which define the *note __contains__(): 15d3.
method, ‘x in y’ returns ‘True’ if ‘y.__contains__(x)’ returns a true
value, and ‘False’ otherwise.

For user-defined classes which do not define *note __contains__(): 15d3.
but do define *note __iter__(): e69, ‘x in y’ is ‘True’ if some value
‘z’, for which the expression ‘x is z or x == z’ is true, is produced
while iterating over ‘y’.  If an exception is raised during the
iteration, it is as if *note in: 34b. raised that exception.

Lastly, the old-style iteration protocol is tried: if a class defines
*note __getitem__(): 588, ‘x in y’ is ‘True’ if and only if there is a
non-negative integer index 'i' such that ‘x is y[i] or x == y[i]’, and
no lower integer index raises the *note IndexError: 174e. exception.
(If any other exception is raised, it is as if *note in: 34b. raised
that exception).

演算子 *note not in: 841. は *note in: 34b. の真理値を反転した値として定
義されています。


File: python.info,  Node: 同一性の比較,  Prev: 所属検査演算,  Up: 比較

4.6.10.3 同一性の比較
.....................

演算子 *note is: 34c. および *note is not: 24d7. は、オブジェクトの同一
性に対するテストを行います: ‘x is y’ は、 'x' と 'y' が同じオブジェクト
を指すとき、かつそのときに限り真になります。 オブジェクトの同一性は
*note id(): 163c. 関数を使って判定されます。 ‘x is not y’ は *note is:
34c. の真値を反転したものになります。 (1)

   ---------- Footnotes ----------

   (1) 自動的なガベージコレクション、フリーリスト、ディスクリプタの動的
特性のために、インスタンスメソッドや定数の比較を行うようなときに *note
is: 34c. 演算子の利用は、一見すると普通ではない振る舞いだと気付くかもし
れません。詳細はそれぞれのドキュメントを確認してください。


File: python.info,  Node: ブール演算 boolean operation,  Next: 代入式<2>,  Prev: 比較,  Up: 式 expression

4.6.11 ブール演算 (boolean operation)
-------------------------------------

     or_test:  *note and_test: 24db. | *note or_test: 2489. "or" *note and_test: 24db.
     and_test: *note not_test: 24dc. | *note and_test: 24db. "and" *note not_test: 24dc.
     not_test: *note comparison: 24d2. | "not" *note not_test: 24dc.

In the context of Boolean operations, and also when expressions are used
by control flow statements, the following values are interpreted as
false: ‘False’, ‘None’, numeric zero of all types, and empty strings and
containers (including strings, tuples, lists, dictionaries, sets and
frozensets).  All other values are interpreted as true.  User-defined
objects can customize their truth value by providing a *note __bool__():
14ed. method.

演算子 *note not: 24da. は、引数が偽である場合には ‘True’ を、それ以外の
場合には ‘False’ になります。

式 ‘x and y’ は、まず 'x' を評価します; 'x' が偽なら 'x' の値を返します;
それ以外の場合には、 'y' を評価した結果値を返します。

式 ‘x or y’ は、まず 'x' を評価します; 'x' が真なら 'x' の値を返します;
それ以外の場合には、 'y' を評価した結果値を返します。

なお、 *note and: 349. も *note or: 34d. も、返す値を ‘True’ や ‘False’
に制限せず、最後に評価した引数を返します。 この仕様が便利なときもありま
す。例えば ‘s’ が文字列で、空文字列ならデフォルトの値に置き換えたいとき
、式 ‘s or 'foo'’ は望んだ値を与えます。 *note not: 24da. は必ず新しい値
を作成するので、引数の型に関係なくブール値を返します (例えば、 ‘not
'foo'’ は ‘''’ ではなく ‘False’ になります)。


File: python.info,  Node: 代入式<2>,  Next: 条件式 Conditional Expressions,  Prev: ブール演算 boolean operation,  Up: 式 expression

4.6.12 代入式
-------------

     assignment_expression: [*note identifier: 22c1. ":="] *note expression: 182.

An assignment expression (sometimes also called a "named expression" or
"walrus") assigns an *note expression: 182. to an *note identifier:
22c1, while also returning the value of the *note expression: 182.

One common use case is when handling matched regular expressions:

     if matching := pattern.search(data):
         do_something(matching)

Or, when processing a file stream in chunks:

     while chunk := file.read(9000):
         process(chunk)

Assignment expressions must be surrounded by parentheses when used as
expression statements and when used as sub-expressions in slicing,
conditional, lambda, keyword-argument, and comprehension-if expressions
and in ‘assert’, ‘with’, and ‘assignment’ statements.  In all other
places where they can be used, parentheses are not required, including
in ‘if’ and ‘while’ statements.

Added in version 3.8: 代入式に関してより詳しくは PEP 572(1) を参照してく
ださい。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0572/


File: python.info,  Node: 条件式 Conditional Expressions,  Next: ラムダ lambda,  Prev: 代入式<2>,  Up: 式 expression

4.6.13 条件式 (Conditional Expressions)
---------------------------------------

     conditional_expression: *note or_test: 2489. ["if" *note or_test: 2489. "else" *note expression: 182.]
     expression:             *note conditional_expression: 2301. | *note lambda_expr: 24e0.

A conditional expression (sometimes called a "ternary operator") is an
alternative to the if-else statement.  As it is an expression, it
returns a value and can appear as a sub-expression.

‘x if C else y’ という式は最初に 'x' ではなく条件 'C' を評価します。 'C'
が true の場合 'x' が評価され値が返されます。 それ以外の場合には 'y' が
評価され返されます。

条件演算に関してより詳しくは PEP 308(1) を参照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0308/


File: python.info,  Node: ラムダ lambda,  Next: 式のリスト,  Prev: 条件式 Conditional Expressions,  Up: 式 expression

4.6.14 ラムダ (lambda)
----------------------

     lambda_expr: "lambda" [*note parameter_list: 24e3.] ":" *note expression: 182.

ラムダ式 (ラムダ形式とも呼ばれます) は無名関数を作成するのに使います。 式
‘lambda parameters: expression’ は関数オブジェクトになります。 この無名
オブジェクトは以下に定義されている関数オブジェクト同様に動作します:

     def <lambda>(parameters):
         return expression

引数の一覧の構文は *note 関数定義: 2018. を参照してください。ラムダ式で
作成された関数は文やアノテーションを含むことができない点に注意してくださ
い。


File: python.info,  Node: 式のリスト,  Next: 評価順序,  Prev: ラムダ lambda,  Up: 式 expression

4.6.15 式のリスト
-----------------

     starred_expression:       "*" *note or_expr: 2302. | *note expression: 182.
     flexible_expression:      *note assignment_expression: 242d. | *note starred_expression: 2484.
     flexible_expression_list: *note flexible_expression: 24e5. ("," *note flexible_expression: 24e5.)* [","]
     starred_expression_list:  *note starred_expression: 2484. ("," *note starred_expression: 2484.)* [","]
     expression_list:          *note expression: 182. ("," *note expression: 182.)* [","]
     yield_list:               *note expression_list: 24e7. | *note starred_expression: 2484. "," [*note starred_expression_list: 24e6.]

リスト表示や辞書表示の一部になっているものを除き、少なくとも一つのカンマ
を含む式のリストはタプルになります。 タプルの長さは、リストにある式の数
に等しくなります。 式は左から右へ評価されます。

アスタリスク ‘*’ は 'イテラブルのアンパック' を意味します。 この被演算子
は *note イテラブル: 12f1. でなければなりません。 このイテラブルはアンパ
ックされた位置で要素のシーケンスに展開され、新しいタプル、リスト、集合に
入れ込まれます。

Added in version 3.5: 式リストでのイテラブルのアンパックは最初に PEP
448(1) で提案されました。

Added in version 3.11: Any item in an expression list may be starred.
See PEP 646(2).

A trailing comma is required only to create a one-item tuple, such as
‘1,’; it is optional in all other cases.  A single expression without a
trailing comma doesn't create a tuple, but rather yields the value of
that expression.  (To create an empty tuple, use an empty pair of
parentheses: ‘()’.)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0448/

   (2) https://peps.python.org/pep-0646/


File: python.info,  Node: 評価順序,  Next: 演算子の優先順位,  Prev: 式のリスト,  Up: 式 expression

4.6.16 評価順序
---------------

Python は、式を左から右へと順に評価します。 ただし、代入式を評価するとき
は、右辺が左辺よりも先に評価されます。

以下に示す実行文の各行での評価順序は、添え字の数字順序と同じになります:

     expr1, expr2, expr3, expr4
     (expr1, expr2, expr3, expr4)
     {expr1: expr2, expr3: expr4}
     expr1 + expr2 * (expr3 - expr4)
     expr1(expr2, expr3, *expr4, **expr5)
     expr3, expr4 = expr1, expr2


File: python.info,  Node: 演算子の優先順位,  Prev: 評価順序,  Up: 式 expression

4.6.17 演算子の優先順位
-----------------------

以下の表は Python における演算子の優先順位を要約したものです。優先順位の
最も高い (結合が最も強い) ものから最も低い (結合が最も弱い) ものに並べて
あります。同じボックス内の演算子の優先順位は同じです。構文が明示的に示さ
れていないものは二項演算子です。同じボックス内の演算子は、左から右へとグ
ループ化されます (例外として、べき乗および条件式は右から左にグループ化さ
れます)。

*note 比較: 24d0. 節で述べられているように、比較、所属、同一性のテストは
全てが同じ優先順位を持っていて、左から右に連鎖するという特徴を持っている
ことに注意してください。

演算子                                              説明
                                                    
----------------------------------------------------------------------------------------------
                                                    
‘(expressions...)’,                                 結合式または括弧式、リスト表示、辞書表
                                                    示、集合表示
‘[expressions...]’, ‘{key: value...}’,              
‘{expressions...}’

‘x[index]’, ‘x[index:index]’ ‘x(arguments...)’,     Subscription (including slicing), call,
‘x.attribute’                                       attribute reference
                                                    
                                                    
*note await x: 18d.                                 Await 式
                                                    
                                                    
‘**’                                                べき乗 (1)
                                                    
                                                    
‘+x’, ‘-x’, ‘~x’                                    正数、負数、ビット単位 NOT
                                                    
                                                    
‘*’, ‘@’, ‘/’, ‘//’, ‘%’                            乗算、行列乗算、除算、切り捨て除算、剰
                                                    余 (2)
                                                    
                                                    
‘+’, ‘-’                                            加算および減算
                                                    
                                                    
‘<<’, ‘>>’                                          シフト演算
                                                    
                                                    
‘&’                                                 ビット単位 AND
                                                    
                                                    
‘^’                                                 ビット単位 XOR
                                                    
                                                    
‘|’                                                 ビット単位 OR
                                                    
                                                    
*note in: 34b, *note not in: 841, *note is: 34c,    所属や同一性のテストを含む比較
*note is not: 24d7, ‘<’, ‘<=’, ‘>’, ‘>=’, ‘!=’,     
‘==’

*note not x: 24da.                                  ブール演算 NOT
                                                    
                                                    
*note and: 349.                                     ブール演算 AND
                                                    
                                                    
*note or: 34d.                                      ブール演算 OR
                                                    
                                                    
*note if: 17d. - ‘else’                             条件式
                                                    
                                                    
*note lambda: 14b5.                                 ラムダ式
                                                    
                                                    
‘:=’                                                代入式
                                                    

脚注
....

   ---------- Footnotes ----------

   (1) べき乗演算子 ‘**’ は、右側にある単項算術演算子あるいは単項ビット
演算子より弱い結合優先順位となります。 つまり ‘2**-1’ は ‘0.5’ になりま
す。

   (2) ‘%’ 演算子は文字列フォーマットにも使われ、同じ優先順位が当てはま
ります。


File: python.info,  Node: 単純文 simple statement,  Next: 複合文 compound statement,  Prev: 式 expression,  Up: Python 言語リファレンス

4.7 単純文 (simple statement)
=============================

単純文とは、単一の論理行内に収められる文です。単一の行内には、複数の単純
文をセミコロンで区切って入れることができます。単純文の構文は以下の通りで
す:

     simple_stmt: *note expression_stmt: 24f1.
                  | *note assert_stmt: 24f2.
                  | *note assignment_stmt: 24f3.
                  | *note augmented_assignment_stmt: 24f4.
                  | *note annotated_assignment_stmt: 24f5.
                  | *note pass_stmt: 24f6.
                  | *note del_stmt: 24f7.
                  | *note return_stmt: 24f8.
                  | *note yield_stmt: 24f9.
                  | *note raise_stmt: 24fa.
                  | *note break_stmt: 24fb.
                  | *note continue_stmt: 24fc.
                  | *note import_stmt: 24fd.
                  | *note future_stmt: 24fe.
                  | *note global_stmt: 24ff.
                  | *note nonlocal_stmt: 2500.
                  | *note type_stmt: 2501.

* Menu:

* 式文 (expression statement): 式文 expression statement.
* 代入文 (assignment statement): 代入文 assignment statement.
* assert 文::
* pass 文: pass 文<2>.
* del 文: del 文<2>.
* return 文::
* yield 文::
* raise 文::
* break 文::
* continue 文::
* import 文::
* global 文::
* nonlocal 文::
* The type statement::


File: python.info,  Node: 式文 expression statement,  Next: 代入文 assignment statement,  Up: 単純文 simple statement

4.7.1 式文 (expression statement)
---------------------------------

式文は、(主に対話的な使い方では) 値を計算して出力するために使ったり、(通
常は) プロシジャ (procedure: 有意な結果を返さない関数のことです; Python
では、プロシジャは値 ‘None’ を返します) を呼び出すために使います。その他
の使い方でも式文を使うことができますし、有用なこともあります。式文の構文
は以下の通りです:

     expression_stmt: *note starred_expression: 2484.

式文は式のリスト (単一の式のこともあります) を値評価します。

対話モードでは、値が ‘None’ でなければ、値を組み込み関数 *note repr():
1c1. で文字列に変換して、その結果の文字列を標準出力に一行使って書き出し
ます。 (‘None’ になる式文の値は書き出されないので、プロシジャの呼び出し
を行っても出力は得られません。)


File: python.info,  Node: 代入文 assignment statement,  Next: assert 文,  Prev: 式文 expression statement,  Up: 単純文 simple statement

4.7.2 代入文 (assignment statement)
-----------------------------------

代入文は、名前を値に (再) 束縛したり、変更可能なオブジェクトの属性や要素
を変更したりするために使われます:

     assignment_stmt: (*note target_list: 2488. "=")+ (*note starred_expression: 2484. | *note yield_expression: 2303.)
     target_list:     *note target: 2505. ("," *note target: 2505.)* [","]
     target:          *note identifier: 22c1.
                      | "(" [*note target_list: 2488.] ")"
                      | "[" [*note target_list: 2488.] "]"
                      | *note attributeref: 24a6.
                      | *note subscription: 24a7.
                      | "*" *note target: 2505.

(See section *note プライマリ: 24a4. for the syntax definitions for
'attributeref' and 'subscription'.)

代入文は式のリスト (これは単一の式でも、カンマで区切られた式リストでもよ
く、後者はタプルになることを思い出してください) を評価し、得られたそれぞ
れのオブジェクトをターゲット (target) のリストに対して左から右へと代入し
てゆきます。

Assignment is defined recursively depending on the form of the target
(list).  When a target is part of a mutable object (an attribute
reference or subscription), the mutable object must ultimately perform
the assignment and decide about its validity, and may raise an exception
if the assignment is unacceptable.  The rules observed by various types
and the exceptions raised are given with the definition of the object
types (see section *note 標準型の階層: 232f.).

ターゲットリストは、丸括弧や角括弧で囲まれていてもよく、それに対するオブ
ジェクトの代入は、以下のように再帰的に定義されています。

   * ターゲットリストのターゲットが1つだけでコンマが続いておらず、任意に
     丸括弧で囲われている場合、オブジェクトはそのターゲットに代入されま
     す。

   * その他:

        * "星付き"のターゲットと呼ばれる、頭にアスタリスクが一つ付いたタ
          ーゲットがターゲットリストに一つだけ含まれている場合: オブジェ
          クトはイテラブルで、少なくともターゲットリストのターゲットの数
          よりも一つ少ない要素を持たなければなりません。 星付きのターゲ
          ットより前のターゲットに、イテラブルの先頭の要素が左から右へ代
          入されます。 星付きのターゲットより後ろのターゲットに、イテラ
          ブルの末尾の要素が代入されます。 星付きのターゲットに、イテラ
          ブルの残った要素のリストが代入されます (リスト空でもかまいませ
          ん)。

        * そうでない場合: オブジェクトは、ターゲットリストのターゲットと
          同じ数の要素を持つイテラブルでなければならず、要素は左から右へ
          対応するターゲットに代入されます。

単一のターゲットへの単一のオブジェクトの代入は、以下のようにして再帰的に
定義されています。

   * ターゲットが識別子 (名前) の場合:

        * 名前が現在のコードブロック内の *note global: 4ac. や *note
          nonlocal: 14bf. 文に書かれていないければ: 名前は現在のローカル
          名前空間内のオブジェクトに束縛されます。

        * そうでなければ: 名前はそれぞれグローバル名前空間内か、 *note
          nonlocal: 14bf. で決められた外側の名前空間内のオブジェクトに束
          縛されます。

     名前がすでに束縛済みの場合、再束縛 (rebind) がおこなわれます。再束
     縛によって、以前その名前に束縛されていたオブジェクトの参照カウント
     (reference count) がゼロになった場合、オブジェクトは解放
     (deallocate) され、デストラクタ (destructor) が (存在すれば) 呼び出
     されます。

   * ターゲットが属性参照の場合: 参照されている一次語の式が値評価されま
     す。値は代入可能な属性を伴うオブジェクトでなければなりません; そう
     でなければ、 *note TypeError: 198. が送出されます。次に、このオブジ
     ェクトに対して、被代入オブジェクトを指定した属性に代入してよいか問
     い合わせます; 代入を実行できない場合、例外 (通常は *note
     AttributeError: 5f0. ですが、必然ではありません) を送出します。 注
     意: オブジェクトがクラスインスタンスで、代入演算子の両辺に属性参照
     があるとき、右辺式の ‘a.x’ はインスタンスの属性と (インスタンスの属
     性が存在しなければ) クラス属性のどちらにもアクセスする可能性があり
     ます。左辺のターゲット ‘a.x’ は常にインスタンスの属性として割り当て
     られ、必要ならば生成されます。このとおり、現れる二つの ‘a.x’ は同じ
     値を参照するとは限りません: 右辺式はクラス属性を参照し、左辺は新し
     いインスタンス属性を代入のターゲットとして生成するようなとき:

          class Cls:
              x = 3             # class variable
          inst = Cls()
          inst.x = inst.x + 1   # writes inst.x as 4 leaving Cls.x as 3

     このことは、 *note property(): 4b3. で作成されたプロパティのような
     デスクリプタ属性に対しては、必ずしもあてはまるとは限りません。

   * If the target is a subscription: The primary expression in the
     reference is evaluated.  Next, the subscript expression is
     evaluated.  Then, the primary's *note __setitem__(): 14e3. method
     is called with two arguments: the subscript and the assigned
     object.

     Typically, *note __setitem__(): 14e3. is defined on mutable
     sequence objects (such as lists) and mapping objects (such as
     dictionaries), and behaves as follows.

     一次語が (リストのような) ミュータブルなシーケンスオブジェクトであ
     れば、添字表記は整数を与えなければなりません。整数が負なら、シーケ
     ンスの長さが加算されます。整数は最終的に、シーケンスの長さよりも小
     さな非負の整数でなくてはならず、シーケンスは、そのインデクスに持つ
     要素に被代入オブジェクトを代入してよいか問い合わせられます。インデ
     クスが範囲外なら、 *note IndexError: 174e. が送出されます (添字指定
     されたシーケンスに代入を行っても、リスト要素の新たな追加はできませ
     ん)。

     If the primary is a mapping object (such as a dictionary), the
     subscript must have a type compatible with the mapping's key type,
     and the mapping is then asked to create a key/value pair which maps
     the subscript to the assigned object.  This can either replace an
     existing key/value pair with the same key value, or insert a new
     key/value pair (if no key with the same value existed).

     If the target is a slicing: The primary expression should evaluate
     to a mutable sequence object (such as a list).  The assigned object
     should be *note iterable: 12f1.  The slicing's lower and upper
     bounds should be integers; if they are ‘None’ (or not present), the
     defaults are zero and the sequence's length.  If either bound is
     negative, the sequence's length is added to it.  The resulting
     bounds are clipped to lie between zero and the sequence's length,
     inclusive.  Finally, the sequence object is asked to replace the
     slice with the items of the assigned sequence.  The length of the
     slice may be different from the length of the assigned sequence,
     thus changing the length of the target sequence, if the target
     sequence allows it.

代入の定義によれば、左辺と右辺のオーバーラップは '同時 (simultaneous)' で
す (例えば ‘a, b = b, a’ は二つの変数を入れ替えます) が、代入対象となる
変数群 'どうし' のオーバーラップは左から右へ起こり、混乱の元です。例えば
、以下のプログラムは ‘[0, 2]’ を出力してしまいます:

     x = [0, 1]
     i = 0
     i, x[i] = 1, 2         # i is updated, then x[i] is updated
     print(x)

参考
....

PEP 3132(1) - Extended Iterable Unpacking

     ‘*target’ の指定機能。

* Menu:

* 累算代入文 (augmented assignment statement): 累算代入文 augmented assignment statement.
* 注釈付き代入文 (annotated assignment statements): 注釈付き代入文 annotated assignment statements.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3132/


File: python.info,  Node: 累算代入文 augmented assignment statement,  Next: 注釈付き代入文 annotated assignment statements,  Up: 代入文 assignment statement

4.7.2.1 累算代入文 (augmented assignment statement)
...................................................

累算代入文は、二項演算と代入文を組み合わせて一つの文にしたものです:

     augmented_assignment_stmt: *note augtarget: 2509. *note augop: 250a. (*note expression_list: 24e7. | *note yield_expression: 2303.)
     augtarget:                 *note identifier: 22c1. | *note attributeref: 24a6. | *note subscription: 24a7.
     augop:                     "+=" | "-=" | "*=" | "@=" | "/=" | "//=" | "%=" | "**="
                                | ">>=" | "<<=" | "&=" | "^=" | "|="

(最後の3つの構文定義については *note プライマリ: 24a4. を参照してくださ
い。)

累算代入文は、ターゲット (通常の代入文と違って、アンパックは起こりません
) と式リストを評価し、それら二つの被演算子間で特定の累算代入型の二項演算
を行い、結果をもとのターゲットに代入します。ターゲットは一度しか評価され
ません。

An augmented assignment statement like ‘x += 1’ can be rewritten as ‘x =
x + 1’ to achieve a similar, but not exactly equal effect.  In the
augmented version, ‘x’ is only evaluated once.  Also, when possible, the
actual operation is performed 'in-place', meaning that rather than
creating a new object and assigning that to the target, the old object
is modified instead.

通常の代入とは違い、累算代入文は右辺を評価する '前に' 左辺を評価します。
たとえば、‘a[i] += f(x)’ はまず ‘a[i]’ を調べ、‘f(x)’ を評価して加算を行
い、最後に結果を ‘a[i]’ に割り当てます。

累算代入文で行われる代入は、タプルへの代入や、一文中に複数のターゲットが
存在する場合を除き、通常の代入と同じように扱われます。同様に、累算代入で
行われる二項演算は、場合によって 'インプレース演算' が行われることを除き
、通常の二項演算と同じです。

属性参照のターゲットの場合、 *note
クラス属性とインスタンス属性についての注意: 2506. と同様に通常の代入が適
用されます。


File: python.info,  Node: 注釈付き代入文 annotated assignment statements,  Prev: 累算代入文 augmented assignment statement,  Up: 代入文 assignment statement

4.7.2.2 注釈付き代入文 (annotated assignment statements)
........................................................

*note 注釈: f51. 代入は、1 つの文の中で変数や属性のアノテーションとオプ
ションの代入文を組み合わせたものです:

     annotated_assignment_stmt: *note augtarget: 2509. ":" *note expression: 182.
                                ["=" (*note starred_expression: 2484. | *note yield_expression: 2303.)]

通常の *note 代入文 (assignment statement): 2427. との違いは、代入先が 1
つに限定されることだけです。

The assignment target is considered "simple" if it consists of a single
name that is not enclosed in parentheses.  For simple assignment
targets, if in class or module scope, the annotations are gathered in a
lazily evaluated *note annotation scope: 4ab.  The annotations can be
evaluated using the *note __annotations__: 458. attribute of a class or
module, or using the facilities in the *note annotationlib: 6. module.

If the assignment target is not simple (an attribute, subscript node, or
parenthesized name), the annotation is never evaluated.

関数スコープで名前に注釈が付いていた場合は、その名前はその関数スコープで
ローカルなものになります。 注釈は絶対に評価されず、関数スコープにも格納
されません。

If the right hand side is present, an annotated assignment performs the
actual assignment as if there was no annotation present.  If the right
hand side is not present for an expression target, then the interpreter
evaluates the target except for the last *note __setitem__(): 14e3. or
*note __setattr__(): 237c. call.

参考
....

PEP 526(1) - Syntax for Variable Annotations

     (クラス変数やインスタンス変数を含んだ) 変数の型注釈を付ける、コメン
     トで表現するのではない文法の追加提案。

PEP 484(2) - Type hints

     *note typing: 10a. モジュールを追加し、静的解析ツールや IDE で使え
     る型アノテーションの標準的な文法を提供する提案。

バージョン 3.8 で変更: Now annotated assignments allow the same
expressions in the right hand side as regular assignments.  Previously,
some expressions (like un-parenthesized tuple expressions) caused a
syntax error.

バージョン 3.14 で変更: Annotations are now lazily evaluated in a
separate *note annotation scope: 4ab.  If the assignment target is not
simple, annotations are never evaluated.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0526/

   (2) https://peps.python.org/pep-0484/


File: python.info,  Node: assert 文,  Next: pass 文<2>,  Prev: 代入文 assignment statement,  Up: 単純文 simple statement

4.7.3 ‘assert’ 文
-----------------

assert 文は、プログラム内にデバッグ用アサーション (debugging assertion)
を仕掛けるための便利な方法です:

     assert_stmt: "assert" *note expression: 182. ["," *note expression: 182.]

単純な形式 ‘assert expression’ は

     if __debug__:
         if not expression: raise AssertionError

と等価です。拡張形式 ‘assert expression1, expression2’ は、これと等価で
す

     if __debug__:
         if not expression1: raise AssertionError(expression2)

These equivalences assume that *note __debug__: 9da. and *note
AssertionError: 8b8. refer to the built-in variables with those names.
In the current implementation, the built-in variable ‘__debug__’ is
‘True’ under normal circumstances, ‘False’ when optimization is
requested (command line option *note -O: 18c.).  The current code
generator emits no code for an *note assert: b60. statement when
optimization is requested at compile time.  Note that it is unnecessary
to include the source code for the expression that failed in the error
message; it will be displayed as part of the stack trace.

*note __debug__: 9da. への代入は不正な操作です。組み込み変数の値は、イン
タプリタが開始するときに決定されます。


File: python.info,  Node: pass 文<2>,  Next: del 文<2>,  Prev: assert 文,  Up: 単純文 simple statement

4.7.4 ‘pass’ 文
---------------

     pass_stmt: "pass"

*note pass: 17e. はヌル操作 (null operation) です -- *note pass: 17e. が
実行されても、何も起きません。 *note pass: 17e. は、構文法的には文が必要
だが、コードとしては何も実行したくない場合のプレースホルダとして有用です
。例えば:

     def f(arg): pass    # a function that does nothing (yet)

     class C: pass       # a class with no methods (yet)


File: python.info,  Node: del 文<2>,  Next: return 文,  Prev: pass 文<2>,  Up: 単純文 simple statement

4.7.5 ‘del’ 文
--------------

     del_stmt: "del" *note target_list: 2488.

オブジェクトの削除 (deletion) は、代入の定義と非常に似た方法で再帰的に定
義されています。ここでは完全な詳細は記述せず、いくつかのヒントを述べるに
とどめます。

ターゲットリストに対する削除は、各々のターゲットを左から右へと順に再帰的
に削除します。

Deletion of a name removes the binding of that name from the local or
global namespace, depending on whether the name occurs in a *note
global: 4ac. statement in the same code block.  Trying to delete an
unbound name raises a *note NameError: 452. exception.

Deletion of attribute references and subscriptions is passed to the
primary object involved; deletion of a slicing is in general equivalent
to assignment of an empty slice of the right type (but even this is
determined by the sliced object).

バージョン 3.2 で変更: 以前は、ある名前がネストしたブロックの自由変数と
して表れる場合は、ローカル名前空間からその名前を削除することは不正な処理
でした。


File: python.info,  Node: return 文,  Next: yield 文,  Prev: del 文<2>,  Up: 単純文 simple statement

4.7.6 ‘return’ 文
-----------------

     return_stmt: "return" [*note expression_list: 24e7.]

*note return: 1af. は、関数定義内で構文法的にネストして現れますが、ネス
トしたクラス定義内には現れません。

式リストがある場合、リストが値評価されます。それ以外の場合は ‘None’ で置
き換えられます。

*note return: 1af. を使うと、式リスト (または ‘None’) を戻り値として、現
在の関数呼び出しから抜け出します。

*note return: 1af. によって、 *note finally: 1b0. 節をともなう *note
try: 8f8. 文の外に処理が引き渡されると、実際に関数から抜ける前に
‘finally’ 節が実行されます。

ジェネレータ関数では、 *note return: 1af. 文はジェネレータの終わりを示し
、 *note StopIteration: df5. 例外を送出させます。返された値は (あれば)、
*note StopIteration: df5. を構成する引数に使われ、 *note
StopIteration.value: 2417. 属性になります。

非同期ジェネレータ関数では、引数無しの *note return: 1af. 文は非同期ジェ
ネレータの終わりを示し、 *note StopAsyncIteration: 1e0f. を送出させます
。 引数ありの ‘return’ 文は、非同期ジェネレータ関数では文法エラーです。


File: python.info,  Node: yield 文,  Next: raise 文,  Prev: return 文,  Up: 単純文 simple statement

4.7.7 ‘yield’ 文
----------------

     yield_stmt: *note yield_expression: 2303.

A *note yield: bc2. statement is semantically equivalent to a *note
yield expression: 2498.  The ‘yield’ statement can be used to omit the
parentheses that would otherwise be required in the equivalent yield
expression statement.  For example, the yield statements

     yield <expr>
     yield from <expr>

は以下の yield 式文と等価です

     (yield <expr>)
     (yield from <expr>)

Yield expressions and statements are only used when defining a *note
generator: 126c. function, and are only used in the body of the
generator function.  Using *note yield: bc2. in a function definition is
sufficient to cause that definition to create a generator function
instead of a normal function.

*note yield: bc2. の意味の完全な説明は、 *note Yield 式: 2498. 節を参照
してください。


File: python.info,  Node: raise 文,  Next: break 文,  Prev: yield 文,  Up: 単純文 simple statement

4.7.8 ‘raise’ 文
----------------

     raise_stmt: "raise" [*note expression: 182. ["from" *note expression: 182.]]

If no expressions are present, *note raise: 803. re-raises the exception
that is currently being handled, which is also known as the 'active
exception'.  If there isn't currently an active exception, a *note
RuntimeError: 244. exception is raised indicating that this is an error.

そうでなければ、 *note raise: 803. は最初の式を、例外オブジェクトとして
評価します。これは、 *note BaseException: 7d6. のサブクラスまたはインス
タンスでなければなりません。クラスなら、例外インスタンスが必要なとき、ク
ラスを無引数でインスタンス化することで得られます。

例外の '型' は例外インスタンスのクラスで、 '値' はインスタンスそのもので
す。

A traceback object is normally created automatically when an exception
is raised and attached to it as the *note __traceback__: 14de.
attribute.  You can create an exception and set your own traceback in
one step using the *note with_traceback(): 2513. exception method (which
returns the same exception instance, with its traceback set to its
argument), like so:

     raise Exception("foo occurred").with_traceback(tracebackobj)

The ‘from’ clause is used for exception chaining: if given, the second
'expression' must be another exception class or instance.  If the second
expression is an exception instance, it will be attached to the raised
exception as the *note __cause__: 14e0. attribute (which is writable).
If the expression is an exception class, the class will be instantiated
and the resulting exception instance will be attached to the raised
exception as the ‘__cause__’ attribute.  If the raised exception is not
handled, both exceptions will be printed:

     >>> try:
     ...     print(1 / 0)
     ... except Exception as exc:
     ...     raise RuntimeError("Something bad happened") from exc
     ...
     Traceback (most recent call last):
       File "<stdin>", line 2, in <module>
         print(1 / 0)
               ~~^~~
     ZeroDivisionError: division by zero

     The above exception was the direct cause of the following exception:

     Traceback (most recent call last):
       File "<stdin>", line 4, in <module>
         raise RuntimeError("Something bad happened") from exc
     RuntimeError: Something bad happened

A similar mechanism works implicitly if a new exception is raised when
an exception is already being handled.  An exception may be handled when
an *note except: 1ab. or *note finally: 1b0. clause, or a *note with:
186. statement, is used.  The previous exception is then attached as the
new exception's *note __context__: 14df. attribute:

     >>> try:
     ...     print(1 / 0)
     ... except:
     ...     raise RuntimeError("Something bad happened")
     ...
     Traceback (most recent call last):
       File "<stdin>", line 2, in <module>
         print(1 / 0)
               ~~^~~
     ZeroDivisionError: division by zero

     During handling of the above exception, another exception occurred:

     Traceback (most recent call last):
       File "<stdin>", line 4, in <module>
         raise RuntimeError("Something bad happened")
     RuntimeError: Something bad happened

Exception chaining can be explicitly suppressed by specifying *note
None: 885. in the ‘from’ clause:

     >>> try:
     ...     print(1 / 0)
     ... except:
     ...     raise RuntimeError("Something bad happened") from None
     ...
     Traceback (most recent call last):
       File "<stdin>", line 4, in <module>
     RuntimeError: Something bad happened

例外に関する追加情報は *note 例外: 2433. 節にあります。また、例外処理に
関する情報は *note try 文: 8f8. 節にあります。

バージョン 3.3 で変更: *note None: 885. が ‘raise X from Y’ の ‘Y’ とし
て使えるようになりました。

Added the *note __suppress_context__: 2514. attribute to suppress
automatic display of the exception context.

バージョン 3.11 で変更: If the traceback of the active exception is
modified in an *note except: 1ab. clause, a subsequent ‘raise’ statement
re-raises the exception with the modified traceback.  Previously, the
exception was re-raised with the traceback it had when it was caught.


File: python.info,  Node: break 文,  Next: continue 文,  Prev: raise 文,  Up: 単純文 simple statement

4.7.9 ‘break’ 文
----------------

     break_stmt: "break"

*note break: 17f. 文は、構文としては *note for: 34a. ループや *note
while: 1973. ループの内側でのみ出現することができますが、ループ内の関数
定義やクラス定義の内側には出現できません。

*note break: 17f. 文は、文を囲う最も内側のループを終了させ、ループにオプ
ションの ‘else’ 節がある場合にはそれをスキップします。

*note for: 34a. ループを *note break: 17f. によって終了すると、ループ制
御ターゲットはその時の値を保持します。

*note break: 17f. が *note finally: 1b0. 節を伴う *note try: 8f8. 文の外
側に処理を渡す際には、ループを実際に抜ける前にその ‘finally’ 節が実行さ
れます。


File: python.info,  Node: continue 文,  Next: import 文,  Prev: break 文,  Up: 単純文 simple statement

4.7.10 ‘continue’ 文
--------------------

     continue_stmt: "continue"

*note continue: 180. 文は *note for: 34a. ループや *note while: 1973. ル
ープ内のネストで構文法的にのみ現れますが、ループ内の関数定義やクラス定義
の中には現れません。 *note continue: 180. 文は、文を囲う最も内側のループ
の次の周期に処理を継続します。

*note continue: 180. が *note finally: 1b0. 句を持った *note try: 8f8. 文
を抜けるとき、その ‘finally’ 句が次のループサイクルを始める前に実行され
ます。


File: python.info,  Node: import 文,  Next: global 文,  Prev: continue 文,  Up: 単純文 simple statement

4.7.11 ‘import’ 文
------------------

     import_stmt:     "import" *note module: 2518. ["as" *note identifier: 22c1.] ("," *note module: 2518. ["as" *note identifier: 22c1.])*
                      | "from" *note relative_module: 2519. "import" *note identifier: 22c1. ["as" *note identifier: 22c1.]
                      ("," *note identifier: 22c1. ["as" *note identifier: 22c1.])*
                      | "from" *note relative_module: 2519. "import" "(" *note identifier: 22c1. ["as" *note identifier: 22c1.]
                      ("," *note identifier: 22c1. ["as" *note identifier: 22c1.])* [","] ")"
                      | "from" *note relative_module: 2519. "import" "*"
     module:          (*note identifier: 22c1. ".")* *note identifier: 22c1.
     relative_module: "."* *note module: 2518. | "."+

(*note from: 14c3. 節が無い) 基本の import 文は 2 つのステップで実行され
ます:

  1. モジュールを見付け出し、必要であればロードし初期化する

  2. *note import: 7f8. 文が表れるスコープのローカル名前空間で名前を定義
     する。

文が (カンマで区切られた) 複数の節を含んでいるときは、ちょうどその節が個
別の import 文に分割されたかのように、2つのステップが節ごとに個別に実行
されます。

モジュールを見付け、ロードする 1 つ目のステップの詳細については、 *note
インポートシステム: 2360. の節により詳しく書かれています。そこでは、イン
ポートシステムの動作をカスタマイズするのに使える全てのフックの仕組みだけ
でなく、様々な種類のインポートできるパッケージとモジュールについても解説
されています。このステップが失敗するということは、おそらくモジュールが見
付からないか、 'あるいは' モジュールにあるコードの実行を含め、モジュール
の初期化の途中でエラーが起きるかのどちらかが起きていることに注意してくだ
さい。

要求したモジュールが無事に取得できた場合、次の 3 つのうちの 1 つの方法で
ローカル名前空間で使えるようになります:

   * モジュール名の後に ‘as’ が続いていた場合は、 ‘as’ の後ろの名前を直
     接、インポートされたモジュールが束縛します。

   * 他の名前が指定されておらず、インポートされているモジュールが最上位
     のモジュールだった場合、そのモジュール名がインポートされたモジュー
     ルへの参照として、ローカル名前空間で束縛されます

   * インポートされているモジュールが最上位のモジュール 'でない' 場合、
     モジュールを含む最上位のパッケージ名が、そのパッケージへの参照とし
     て、ローカル名前空間で束縛されます。インポートされたモジュールには
     、直接ではなく完全修飾名を使ってアクセスしなければなりません

*note from: 14c3. 形式ではもう少し複雑な手順を踏みます:

  1. *note from: 14c3. 節で指定されたモジュールを見付け出し、必要であれ
     ばロードし初期化する;

  2. *note import: 7f8. 節で指定されたそれぞれの識別子に対し以下の処理を
     行う:

       1. インポートされたモジュールがその識別子名の属性を持っているかを
          確認する

       2. その識別子名の属性を持っていなかった場合は、その識別子名でサブ
          モジュールのインポートを試み、インポートされたモジュールにその
          属性があるか再度確認する

       3. 属性が見付からない場合は、 *note ImportError: 65b. を送出する
          。

       4. 属性が見付かった場合は、 ‘as’ 節があるならそこの名前、そうでな
          いなら属性名を使って、その値への参照がローカル名前空間に保存さ
          れる

例:

     import foo                 # foo imported and bound locally
     import foo.bar.baz         # foo, foo.bar, and foo.bar.baz imported, foo bound locally
     import foo.bar.baz as fbb  # foo, foo.bar, and foo.bar.baz imported, foo.bar.baz bound as fbb
     from foo.bar import baz    # foo, foo.bar, and foo.bar.baz imported, foo.bar.baz bound as baz
     from foo import attr       # foo imported and foo.attr bound as attr

識別子のリストが星 (‘'*'’) に置き換わっている場合は、モジュールで定義さ
れている公開された全ての名前が、 *note import: 7f8. 文がいるスコープのロ
ーカル名前空間に束縛されます。

The 'public names' defined by a module are determined by checking the
module's namespace for a variable named ‘__all__’; if defined, it must
be a sequence of strings which are names defined or imported by that
module.  Names containing non-ASCII characters must be in the
normalization form(1) NFKC; see *note Non-ASCII characters in names:
22bd. for details.  The names given in ‘__all__’ are all considered
public and are required to exist.  If ‘__all__’ is not defined, the set
of public names includes all names found in the module's namespace which
do not begin with an underscore character (‘'_'’).  ‘__all__’ should
contain the entire public API. It is intended to avoid accidentally
exporting items that are not part of the API (such as library modules
which were imported and used within the module).

インポートのワイルドカード形式 -- ‘from module import *’ -- は、モジュー
ルレベルでのみ許されます。クラスや関数定義でこの形式を使おうとすると、
*note SyntaxError: 18e. が送出されます。

インポートするモジュールを指定するとき、そのモジュールの絶対名 (absolute
name) を指定する必要はありません。モジュールやパッケージが他のパッケージ
に含まれている場合、共通のトップパッケージからそのパッケージ名を記述する
ことなく相対インポートすることができます。 *note from: 14c3. の後に指定
されるモジュールやパッケージの先頭に複数個のドットを付けることで、正確な
名前を指定することなしに現在のパッケージ階層からいくつ上の階層へ行くかを
指定することができます。先頭のドットが 1 つの場合、 import をおこなって
いるモジュールが存在する現在のパッケージを示します。 3 つのドットは 2 つ
上のレベルを示します。なので、 ‘pkg’ パッケージの中のモジュールで ‘from
. import mod’ を実行すると、 ‘pkg.mod’ をインポートすることになります。
‘pkg.subpkg1’ の中から ‘from ..subpkg2 import mod’ を実行すると、
‘pkg.subpkg2.mod’ をインポートします。相対インポートの仕様は *note
Package Relative Imports: 245e. の節に含まれています。

どのモジュールがロードされるべきかを動的に決めたいアプリケーションのため
に、組み込み関数 *note importlib.import_module(): 73c. が提供されていま
す。

Raises an *note auditing event: 1c6e. ‘import’ with arguments ‘module’,
‘filename’, ‘sys.path’, ‘sys.meta_path’, ‘sys.path_hooks’.

* Menu:

* future 文 (future statement): future 文 future statement.

   ---------- Footnotes ----------

   (1) https://www.unicode.org/reports/tr15/#Norm_Forms


File: python.info,  Node: future 文 future statement,  Up: import 文

4.7.11.1 future 文 (future statement)
.....................................

'future 文' は、将来の特定の新たな機能が標準化された Python のリリースで
利用可能になるような構文や意味付けを使って、特定のモジュールをコンパイル
させるための、コンパイラに対する指示句 (directive) です。

future 文は互換性のない変更がされた将来の Python のバージョンに容易に移
行するためのものです。future 文によって新機能が標準となるリリースの前に
それをモジュール単位で使用することが出来ます。

     future_stmt: "from" "__future__" "import" *note feature: 251b. ["as" *note identifier: 22c1.]
                  ("," *note feature: 251b. ["as" *note identifier: 22c1.])*
                  | "from" "__future__" "import" "(" *note feature: 251b. ["as" *note identifier: 22c1.]
                  ("," *note feature: 251b. ["as" *note identifier: 22c1.])* [","] ")"
     feature:     *note identifier: 22c1.

future 文は、モジュールの先頭周辺に書かなければなりません。 future 文の
前に書いてよい内容は以下です :

   * モジュールのドキュメンテーション文字列 ( あれば )

   * コメント ,

   * 空行 ,

   * その他の future 文。

future 文を使う必要がある唯一の機能は ‘annotations’ です ( PEP 563(1) を
参照してください)。

future 文で有効にできる歴史的な機能は、今でも Python 3 が認識します。 そ
のリストは ‘absolute_import’, ‘division’, ‘generator_stop’,
‘generators’, ‘unicode_literals’, ‘print_function’, ‘nested_scopes’,
‘with_statement’ です。 これらは既に全てが有効になっていて、後方互換性の
ためだけに残されているため、冗長なだけです。

future 文は、コンパイル時に特別なやり方で認識され、扱われます: 言語の中
核をなす構文構成 (construct) に対する意味付けが変更されている場合、変更
部分はしばしば異なるコードを生成することで実現されています。新たな機能に
よって、(新たな予約語のような) 互換性のない新たな構文が取り入れられるこ
とさえあります。この場合、コンパイラはモジュールを別のやりかたで解析する
必要があるかもしれません。こうしたコード生成に関する決定は、実行時まで先
延ばしすることはできません。

これまでの全てのリリースにおいて、コンパイラはどの機能が定義済みかを知っ
ており、 future 文に未知の機能が含まれている場合にはコンパイル時エラーを
送出します。

future 文の実行時における直接的な意味付けは、 import 文と同じです。標準
モジュール *note __future__: 0. があり、これについては後で述べます。
*note __future__: 0. は、 future 文が実行される際に通常の方法で import さ
れます。

future 文の実行時における特別な意味付けは、 future 文で有効化される特定
の機能によって変わります。

以下の文には、何ら特殊な意味はないので注意してください:

     import __future__ [as name]

これは future 文ではありません; この文は通常の import 文であり、その他の
特殊な意味付けや構文的な制限はありません。

Code compiled by calls to the built-in functions *note exec(): 4a2. and
*note compile(): 4b1. that occur in a module ‘M’ containing a future
statement will, by default, use the new syntax or semantics associated
with the future statement.  This can be controlled by optional arguments
to *note compile(): 4b1. -- see the documentation of that function for
details.

対話的インタプリタのプロンプトでタイプ入力した future 文は、その後のイン
タプリタセッション中で有効になります。インタプリタを *note -i: 16f4. オ
プションで起動して実行すべきスクリプト名を渡し、スクリプト中に future 文
を入れておくと、新たな機能はスクリプトが実行された後に開始する対話セッシ
ョンで有効になります。

参考
....

PEP 236(2) - Back to the __future__

     __future__ 機構の原案

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0563/

   (2) https://peps.python.org/pep-0236/


File: python.info,  Node: global 文,  Next: nonlocal 文,  Prev: import 文,  Up: 単純文 simple statement

4.7.12 ‘global’ 文
------------------

     global_stmt: "global" *note identifier: 22c1. ("," *note identifier: 22c1.)*

The *note global: 4ac. statement causes the listed identifiers to be
interpreted as globals.  It would be impossible to assign to a global
variable without ‘global’, although free variables may refer to globals
without being declared global.

The ‘global’ statement applies to the entire current scope (module,
function body or class definition).  A *note SyntaxError: 18e. is raised
if a variable is used or assigned to prior to its global declaration in
the scope.

At the module level, all variables are global, so a ‘global’ statement
has no effect.  However, variables must still not be used or assigned to
prior to their ‘global’ declaration.  This requirement is relaxed in the
interactive prompt (*note REPL: 491.).

'プログラマのための注意点:' *note global: 4ac. はパーザに対する指示句
(directive) です。この指示句は、 ‘global’ 文と同時に読み込まれたコードに
対してのみ適用されます。特に、組み込みの *note exec(): 4a2. 関数内に入っ
ている ‘global’ 文は、関数の呼び出しを '含んでいる' コードブロック内に効
果を及ぼすことはなく、そのような文字列に含まれているコードは、関数の呼び
出しを含むコード内の ‘global’ 文に影響を受けません。同様のことが、関数
*note eval(): 4a3. および *note compile(): 4b1. にも当てはまります。


File: python.info,  Node: nonlocal 文,  Next: The type statement,  Prev: global 文,  Up: 単純文 simple statement

4.7.13 ‘nonlocal’ 文
--------------------

     nonlocal_stmt: "nonlocal" *note identifier: 22c1. ("," *note identifier: 22c1.)*

When the definition of a function or class is nested (enclosed) within
the definitions of other functions, its nonlocal scopes are the local
scopes of the enclosing functions.  The *note nonlocal: 14bf. statement
causes the listed identifiers to refer to names previously bound in
nonlocal scopes.  It allows encapsulated code to rebind such nonlocal
identifiers.  If a name is bound in more than one nonlocal scope, the
nearest binding is used.  If a name is not bound in any nonlocal scope,
or if there is no nonlocal scope, a *note SyntaxError: 18e. is raised.

The *note nonlocal: 14bf. statement applies to the entire scope of a
function or class body.  A *note SyntaxError: 18e. is raised if a
variable is used or assigned to prior to its nonlocal declaration in the
scope.

参考
....

PEP 3104(1) - Access to Names in Outer Scopes

     *note nonlocal: 14bf. 文の詳細。

'Programmer's note:' *note nonlocal: 14bf. is a directive to the parser
and applies only to code parsed along with it.  See the note for the
*note global: 4ac. statement.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3104/


File: python.info,  Node: The type statement,  Prev: nonlocal 文,  Up: 単純文 simple statement

4.7.14 The ‘type’ statement
---------------------------

     type_stmt: 'type' *note identifier: 22c1. [*note type_params: 251f.] "=" *note expression: 182.

The ‘type’ statement declares a type alias, which is an instance of
*note typing.TypeAliasType: 2ae.

For example, the following statement creates a type alias:

     type Point = tuple[float, float]

This code is roughly equivalent to:

     annotation-def VALUE_OF_Point():
         return tuple[float, float]
     Point = typing.TypeAliasType("Point", VALUE_OF_Point())

‘annotation-def’ indicates an *note annotation scope: 4ab, which behaves
mostly like a function, but with several small differences.

The value of the type alias is evaluated in the annotation scope.  It is
not evaluated when the type alias is created, but only when the value is
accessed through the type alias's ‘__value__’ attribute (see *note Lazy
evaluation: 685.).  This allows the type alias to refer to names that
are not yet defined.

Type aliases may be made generic by adding a *note type parameter list:
5ad. after the name.  See *note Generic type aliases: 684. for more.

‘type’ is a *note soft keyword: a0d.

Added in version 3.12.

参考
....

PEP 695(1) - Type Parameter Syntax

     Introduced the ‘type’ statement and syntax for generic classes and
     functions.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0695/


File: python.info,  Node: 複合文 compound statement,  Next: トップレベル要素,  Prev: 単純文 simple statement,  Up: Python 言語リファレンス

4.8 複合文 (compound statement)
===============================

複合文には、他の文 (のグループ) が入ります; 複合文は、中に入っている他の
文の実行の制御に何らかのやり方で影響を及ぼします。一般的には、複合文は複
数行にまたがって書かれますが、全部の文を一行に連ねた単純な書き方もありま
す。

*note if: 181. 、 *note while: 1973. 、および *note for: 34a. 文は、伝統
的な制御フロー構成を実現します。 *note try: 8f8. は例外処理および/または
一連の文に対するクリーンアップコードを指定します。それに対して、 *note
with: 186. 文はコードのかたまりの前後でコードの初期化と終了処理を実行で
きるようにします。関数とクラス定義もまた、構文的には複合文です。

複合文は、一つ以上の '節 (clause)' からなります。節は、ヘッダと 'スイー
ト (suite)' からなります。一つの複合文を成す各節のヘッダは、全て同じイン
デントレベルに置かれます。各節のヘッダは一意に識別するキーワードで始まり
、コロンで終わります。スイートは、節によって制御される文の集まりです。ス
イートは、ヘッダがある行のコロンの後にセミコロンで区切って置かれた一つ以
上の単純文、または、ヘッダに続く行で一つ多くインデントされた文の集まりで
す。後者の形式のスイートに限り、さらに複合文をネストできます; 以下の文は
、 *note else: 17c. 節がどちらの *note if: 181. 節に属するかがはっきりし
ないなどの理由から不正になります:

     if test1: if test2: print(x)

また、このコンテキスト中では、セミコロンによる結合はコロンより強いです。
従って、以下の例では、 *note print(): 1177. の呼び出しはは全て実行される
か、全く実行されないかのどちらかです:

     if x < y < z: print(x); print(y); print(z)

まとめると、以下のようになります:

     compound_stmt: *note if_stmt: 2525.
                    | *note while_stmt: 2526.
                    | *note for_stmt: 2527.
                    | *note try_stmt: 2528.
                    | *note with_stmt: 2529.
                    | *note match_stmt: 252a.
                    | *note funcdef: 252b.
                    | *note classdef: 252c.
                    | *note async_with_stmt: 252d.
                    | *note async_for_stmt: 252e.
                    | *note async_funcdef: 252f.
     suite:         *note stmt_list: 2531. NEWLINE | NEWLINE INDENT *note statement: 2532.+ DEDENT
     statement:     *note stmt_list: 2531. NEWLINE | *note compound_stmt: 2524.
     stmt_list:     *note simple_stmt: 24f0. (";" *note simple_stmt: 24f0.)* [";"]

なお、文は常に ‘NEWLINE’ か、その後に ‘DEDENT’ が続いたもので終了します
。また、オプションの継続節は必ず、文を開始できない予約語で始まるので、曖
昧さは存在しません。 (Python では、 'ぶら下がり (dangling) *note else:
17c.' 問題は、ネストされた *note if: 181. 文をインデントさせることで解決
されます)。

以下の節における文法規則の記述方式は、明確さのために、各節を別々の行に書
くようにしています。
* Menu:

* if 文: if 文<2>.
* while 文::
* for 文: for 文<2>.
* try 文::
* with 文::
* match 文: match 文<2>.
* 関数定義::
* クラス定義::
* コルーチン: コルーチン<2>.
* Type parameter lists::
* Annotations: Annotations<2>.


File: python.info,  Node: if 文<2>,  Next: while 文,  Up: 複合文 compound statement

4.8.1 ‘if’ 文
-------------

*note if: 181. 文は、条件分岐を実行するために使われます:

     if_stmt: "if" *note assignment_expression: 242d. ":" *note suite: 2530.
              ("elif" *note assignment_expression: 242d. ":" *note suite: 2530.)*
              ["else" ":" *note suite: 2530.]

*note if: 181. 文は、式を一つ一つ評価してゆき、真になるまで続けて、真に
なった節のスイートだけを選択します (真: true と偽: false の定義について
は、 *note ブール演算 (boolean operation): 24d8. 節を参照してください);
次に、選択したスイートを実行します (そして、 *note if: 181. 文の他の部分
は、実行や評価をされません)。全ての式が偽になった場合、 *note else: 17c.
節があれば、そのスイートが実行されます。


File: python.info,  Node: while 文,  Next: for 文<2>,  Prev: if 文<2>,  Up: 複合文 compound statement

4.8.2 ‘while’ 文
----------------

*note while: 1973. 文は、式の値が真である間、実行を繰り返すために使われ
ます:

     while_stmt: "while" *note assignment_expression: 242d. ":" *note suite: 2530.
                 ["else" ":" *note suite: 2530.]

*note while: 1973. 文は式を繰り返し真偽評価し、真であれば最初のスイート
を実行します。式が偽であれば (最初から偽になっていることもありえます)、
‘else’ 節がある場合にはそれを実行し、ループを終了します。

最初のスイート内で *note break: 17f. 文が実行されると、 ‘else’ 節のスイ
ートを実行することなくループを終了します。 *note continue: 180. 文が最初
のスイート内で実行されると、スイート内にある残りの文の実行をスキップして
、式の真偽評価に戻ります。


File: python.info,  Node: for 文<2>,  Next: try 文,  Prev: while 文,  Up: 複合文 compound statement

4.8.3 ‘for’ 文
--------------

*note for: 34a. 文は、シーケンス (文字列、タプルまたはリスト) や、その他
の反復可能なオブジェクト (iterable object) 内の要素に渡って反復処理を行
うために使われます:

     for_stmt: "for" *note target_list: 2488. "in" *note starred_expression_list: 24e6. ":" *note suite: 2530.
               ["else" ":" *note suite: 2530.]

The *note starred_expression_list: 24e6. expression is evaluated once;
it should yield an *note iterable: 12f1. object.  An *note iterator:
4c8. is created for that iterable.  The first item provided by the
iterator is then assigned to the target list using the standard rules
for assignments (see *note 代入文 (assignment statement): 2427.), and
the suite is executed.  This repeats for each item provided by the
iterator.  When the iterator is exhausted, the suite in the ‘else’
clause, if present, is executed, and the loop terminates.

最初のスイートの中で *note break: 17f. 文が実行されると、 ‘else’ 節のス
イートを実行することなくループを終了します。 *note continue: 180. 文が最
初のスイート内で実行されると、スイート内にある残りの文の実行をスキップし
て、次の要素の処理に移るか、これ以上次の要素が無い場合は ‘else’ 節の処理
に移ります。

for ループはターゲットリスト内の変数への代入を行います。 これにより、for
ループ内も含めて、それ以前の全ての代入は上書きされます:

     for i in range(10):
         print(i)
         i = 5             # this will not affect the for-loop
                           # because i will be overwritten with the next
                           # index in the range

ループが終了してもターゲットリスト内の名前は削除されませんが、イテラブル
が空の場合には、ループでの代入は全く行われません。ヒント: 組み込み型
*note range(): b3d. は、 整数の不変算術列を表します。例えば、 ‘range(3)’
を反復すると0、1そして2の順に結果を返します。

バージョン 3.11 で変更: 式のリストの中でアスタリスク付きの式 (starred
elements) を指定できるようになりました。


File: python.info,  Node: try 文,  Next: with 文,  Prev: for 文<2>,  Up: 複合文 compound statement

4.8.4 ‘try’ 文
--------------

‘try’ 文は、ひとまとめの文に対して、例外処理および/またはクリーンアップ
コードを指定します:

     try_stmt:  *note try1_stmt: 2537. | *note try2_stmt: 2538. | *note try3_stmt: 2539.
     try1_stmt: "try" ":" *note suite: 2530.
                ("except" [*note expression: 182. ["as" *note identifier: 22c1.]] ":" *note suite: 2530.)+
                ["else" ":" *note suite: 2530.]
                ["finally" ":" *note suite: 2530.]
     try2_stmt: "try" ":" *note suite: 2530.
                ("except" "*" *note expression: 182. ["as" *note identifier: 22c1.] ":" *note suite: 2530.)+
                ["else" ":" *note suite: 2530.]
                ["finally" ":" *note suite: 2530.]
     try3_stmt: "try" ":" *note suite: 2530.
                "finally" ":" *note suite: 2530.

例外に関するその他の情報は *note 例外: 2433. 節にあります。また、 *note
raise: 803. 文の使用による例外の生成に関する情報は、 *note raise 文:
803. 節にあります。

バージョン 3.14 で変更: Support for optionally dropping grouping
parentheses when using multiple exception types.  See PEP 758(1).

* Menu:

* except 節::
* except* 節::
* else 節::
* finally 節::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0758/


File: python.info,  Node: except 節,  Next: except* 節,  Up: try 文

4.8.4.1 ‘except’ 節
...................

The ‘except’ clause(s) specify one or more exception handlers.  When no
exception occurs in the *note try: 8f8. clause, no exception handler is
executed.  When an exception occurs in the ‘try’ suite, a search for an
exception handler is started.  This search inspects the ‘except’ clauses
in turn until one is found that matches the exception.  An
expression-less ‘except’ clause, if present, must be last; it matches
any exception.

For an ‘except’ clause with an expression, the expression must evaluate
to an exception type or a tuple of exception types.  Parentheses can be
dropped if multiple exception types are provided and the ‘as’ clause is
not used.  The raised exception matches an ‘except’ clause whose
expression evaluates to the class or a *note non-virtual base class:
13ce. of the exception object, or to a tuple that contains such a class.

例外がどの ‘except’ 節にも合致しなかった場合、現在のコードを囲うさらに外
側、そして呼び出しスタックへと検索を続けます。 (1)

‘except’ 節のヘッダにある式を値評価するときに例外が発生すると、元々のハ
ンドラ検索はキャンセルされ、新たな例外に対する例外ハンドラの検索を現在の
*note except: 1ab. 節の外側のコードや呼び出しスタックに対して行います
(*note try: 8f8. 文全体が例外を発行したかのように扱われます)。

対応する ‘except’ 節が見つかると、‘except’ 節のスイートが実行されます。
その際、 ‘as’ キーワードが ‘except’ 節に存在すれば、その後で指定されてい
るターゲットに例外が代入されます。全ての ‘except’ 節は実行可能なブロック
を持っていなければなりません。このブロックの末尾に到達すると、通常は
*note try: 8f8. 文全体の直後から実行を継続します。(このことは、ネストさ
れた二つの例外ハンドラが同じ例外に対して存在し、内側のハンドラ内の ‘try’
節で例外が発生した場合、外側のハンドラはその例外を処理しないことを意味し
ます。)

例外が ‘as target’ を使って代入されたとき、それは ‘except’ 節の終わりに
消去されます。これはちょうど、以下のコード:

     except E as N:
         foo

が、以下のコードに翻訳されたかのようなものです:

     except E as N:
         try:
             foo
         finally:
             del N

よって、例外を ‘except’ 節以降で参照できるようにするためには、別の名前に
代入されなければなりません。例外が削除されるのは、トレースバックが付与さ
れると、そのスタックフレームと循環参照を形作り、次のガベージ収集までその
フレーム内のすべての局所変数を生存させてしまうからです。

‘except’ 節のスイートが実行される前に、例外が *note sys: df. モジュール
に格納されます。 ‘except’ 節の中では、 *note sys.exception(): 89b. を呼
び出す事によってこの例外にアクセスすることができます。 例外ハンドラを抜
けると、 *note sys: df. モジュールに格納されている例外の値が、一つ前の値
に戻ります:

     >>> print(sys.exception())
     None
     >>> try:
     ...     raise TypeError
     ... except:
     ...     print(repr(sys.exception()))
     ...     try:
     ...          raise ValueError
     ...     except:
     ...         print(repr(sys.exception()))
     ...     print(repr(sys.exception()))
     ...
     TypeError()
     ValueError()
     TypeError()
     >>> print(sys.exception())
     None

   ---------- Footnotes ----------

   (1) 例外は、別の例外を送出するような *note finally: 1b0. 節が無い場合
にのみ呼び出しスタックへ伝わります。新しい例外によって、古い例外は失われ
ます。


File: python.info,  Node: except* 節,  Next: else 節,  Prev: except 節,  Up: try 文

4.8.4.2 ‘except*’ 節
....................

The ‘except*’ clause(s) specify one or more handlers for groups of
exceptions (*note BaseExceptionGroup: 566. instances).  A *note try:
8f8. statement can have either *note except: 1ab. or ‘except*’ clauses,
but not both.  The exception type for matching is mandatory in the case
of ‘except*’, so ‘except*:’ is a syntax error.  The type is interpreted
as in the case of ‘except’, but matching is performed on the exceptions
contained in the group that is being handled.  An *note TypeError: 198.
is raised if a matching type is a subclass of ‘BaseExceptionGroup’,
because that would have ambiguous semantics.

When an exception group is raised in the try block, each ‘except*’
clause splits (see *note split(): 18d8.) it into the subgroups of
matching and non-matching exceptions.  If the matching subgroup is not
empty, it becomes the handled exception (the value returned from *note
sys.exception(): 89b.) and assigned to the target of the ‘except*’
clause (if there is one).  Then, the body of the ‘except*’ clause
executes.  If the non-matching subgroup is not empty, it is processed by
the next ‘except*’ in the same manner.  This continues until all
exceptions in the group have been matched, or the last ‘except*’ clause
has run.

After all ‘except*’ clauses execute, the group of unhandled exceptions
is merged with any exceptions that were raised or re-raised from within
‘except*’ clauses.  This merged exception group propagates on.:

     >>> try:
     ...     raise ExceptionGroup("eg",
     ...         [ValueError(1), TypeError(2), OSError(3), OSError(4)])
     ... except* TypeError as e:
     ...     print(f'caught {type(e)} with nested {e.exceptions}')
     ... except* OSError as e:
     ...     print(f'caught {type(e)} with nested {e.exceptions}')
     ...
     caught <class 'ExceptionGroup'> with nested (TypeError(2),)
     caught <class 'ExceptionGroup'> with nested (OSError(3), OSError(4))
       + Exception Group Traceback (most recent call last):
       |   File "<doctest default[0]>", line 2, in <module>
       |     raise ExceptionGroup("eg",
       |         [ValueError(1), TypeError(2), OSError(3), OSError(4)])
       | ExceptionGroup: eg (1 sub-exception)
       +-+---------------- 1 ----------------
         | ValueError: 1
         +------------------------------------

If the exception raised from the *note try: 8f8. block is not an
exception group and its type matches one of the ‘except*’ clauses, it is
caught and wrapped by an exception group with an empty message string.
This ensures that the type of the target ‘e’ is consistently *note
BaseExceptionGroup: 566.:

     >>> try:
     ...     raise BlockingIOError
     ... except* BlockingIOError as e:
     ...     print(repr(e))
     ...
     ExceptionGroup('', (BlockingIOError(),))

*note break: 17f, *note continue: 180. and *note return: 1af. cannot
appear in an ‘except*’ clause.


File: python.info,  Node: else 節,  Next: finally 節,  Prev: except* 節,  Up: try 文

4.8.4.3 ‘else’ 節
.................

オプションの ‘else’ 節は、コントロールフローが *note try: 8f8. スイート
を抜け、例外が送出されず、 *note return: 1af. 文、 *note continue: 180.
文、 *note break: 17f. 文のいずれもが実行されなかった場合に実行されます
。 ‘else’ 節で起きた例外は、手前にある *note except: 1ab. 節では処理され
ません。


File: python.info,  Node: finally 節,  Prev: else 節,  Up: try 文

4.8.4.4 ‘finally’ 節
....................

If ‘finally’ is present, it specifies a 'cleanup' handler.  The *note
try: 8f8. clause is executed, including any *note except: 1ab. and *note
else: 253d. clauses.  If an exception occurs in any of the clauses and
is not handled, the exception is temporarily saved.  The ‘finally’
clause is executed.  If there is a saved exception it is re-raised at
the end of the ‘finally’ clause.  If the ‘finally’ clause raises another
exception, the saved exception is set as the context of the new
exception.  If the ‘finally’ clause executes a *note return: 1af, *note
break: 17f. or *note continue: 180. statement, the saved exception is
discarded.  For example, this function returns 42.

     def f():
         try:
             1/0
         finally:
             return 42

‘finally’ 節を実行している間は、プログラムからは例外情報は利用できません
。

*note try: 8f8...‘finally’ 文の *note try: 8f8. スイート内で *note
return: 1af. 、 *note break: 17f. 、または *note continue: 180. 文が実行
された場合、 ‘finally’ 節も、この文を '抜け出る途中に' 実行されます。

The return value of a function is determined by the last *note return:
1af. statement executed.  Since the ‘finally’ clause always executes, a
‘return’ statement executed in the ‘finally’ clause will always be the
last one executed.  The following function returns 'finally'.

     def foo():
         try:
             return 'try'
         finally:
             return 'finally'

バージョン 3.8 で変更: Python3.8 以前では、実装上の問題により ‘finally’
節での *note continue: 180. 文は不正でした。

バージョン 3.14 で変更: The compiler emits a *note SyntaxWarning: 1ae.
when a *note return: 1af, *note break: 17f. or *note continue: 180.
appears in a ‘finally’ block (see PEP 765(1)).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0765/


File: python.info,  Node: with 文,  Next: match 文<2>,  Prev: try 文,  Up: 複合文 compound statement

4.8.5 ‘with’ 文
---------------

*note with: 186. 文は、ブロックの実行を、コンテキストマネージャによって
定義されたメソッドでラップするために使われます (*note
with文とコンテキストマネージャ: 240b. セクションを参照してください)。こ
れにより、よくある *note try: 8f8...*note except: 1ab...*note finally:
1b0. 利用パターンをカプセル化して便利に再利用することができます。

     with_stmt:          "with" ( "(" *note with_stmt_contents: 2541. ","? ")" | *note with_stmt_contents: 2541. ) ":" *note suite: 2530.
     with_stmt_contents: *note with_item: 2542. ("," *note with_item: 2542.)*
     with_item:          *note expression: 182. ["as" *note target: 2505.]

一つの "要素" を持つ *note with: 186. 文の実行は以下のように進行します:

  1. コンテキスト式 (*note with_item: 2542. で与えられた式) を評価するこ
     とで、コンテキストマネージャを取得します。

  2. コンテキストマネージャの *note __enter__(): 7e4. メソッドが、後で使
     うためにロードされます。

  3. コンテキストマネージャの *note __exit__(): 1518. メソッドが、後で使
     うためにロードされます。

  4. コンテキストマネージャの *note __enter__(): 7e4. メソッドが呼ばれま
     す。

  5. *note with: 186. 文にターゲットが含まれていたら、それに *note
     __enter__(): 7e4. からの戻り値が代入されます。

          注釈: *note with: 186. 文は、 *note __enter__(): 7e4. メソッド
          がエラーなく終了した場合には *note __exit__(): 1518. が常に呼
          ばれることを保証します。ですので、もしターゲットリストへの代入
          中にエラーが発生した場合には、これはそのスイートの中で発生した
          エラーと同じように扱われます。以下のステップ 7 を参照してくだ
          さい。

  6. スイートが実行されます。

  7. コンテキストマネージャの *note __exit__(): 1518. メソッドが呼ばれま
     す。スイートが例外によって終了されたのなら、その例外の型、値、トレ
     ースバックが *note __exit__(): 1518. に引数として渡されます。そうで
     なければ、 3 つの *note None: 885. 引数が与えられます。

     スイートが例外により終了され、 *note __exit__(): 1518. メソッドから
     の戻り値が偽（false）ならば、例外が再送出されます。この戻り値が真（
     true）ならば例外は抑制され、実行は *note with: 186. 文の次の文から
     続きます。

     もしそのスイートが例外でない何らかの理由で終了した場合、その *note
     __exit__(): 1518. からの戻り値は無視されて、実行は発生した終了の種
     類に応じた通常の位置から継続します。

以下のコード:

     with EXPRESSION as TARGET:
         SUITE

これは次と等価です:

     manager = (EXPRESSION)
     enter = manager.__enter__
     exit = manager.__exit__
     value = enter()
     hit_except = False

     try:
         TARGET = value
         SUITE
     except:
         hit_except = True
         if not exit(*sys.exc_info()):
             raise
     finally:
         if not hit_except:
             exit(None, None, None)

except that implicit *note special method lookup: 23b1. is used for
*note __enter__(): 7e4. and *note __exit__(): 1518.

複数の要素があるとき、コンテキストマネージャは複数の *note with: 186. 文
がネストされたかのように進行します:

     with A() as a, B() as b:
         SUITE

これは次と等価です:

     with A() as a:
         with B() as b:
             SUITE

括弧で囲むことにより、複数のコンテキストマネージャを複数行に渡って書くこ
とができます。 例:

     with (
         A() as a,
         B() as b,
     ):
         SUITE

バージョン 3.1 で変更: 複数のコンテキスト式をサポートしました。

バージョン 3.10 で変更: 括弧で囲むことで、文を複数行に分割して書けるよう
になりました。

参考
....

PEP 343(1) - "with" ステートメント

     Python の *note with: 186. 文の仕様、背景、および例が記載されていま
     す。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0343/


File: python.info,  Node: match 文<2>,  Next: 関数定義,  Prev: with 文,  Up: 複合文 compound statement

4.8.6 ‘match’ 文
----------------

Added in version 3.10.

match 文はパターンマッチングを行う目的で使われます。 構文:

     match_stmt:   'match' *note subject_expr: 2545. ":" NEWLINE INDENT *note case_block: 2546.+ DEDENT
     subject_expr: `!star_named_expression` "," `!star_named_expressions`?
                   | `!named_expression`
     case_block:   'case' *note patterns: 2547. [*note guard: 2548.] ":" `!block`

     注釈: このセクションでは、一重引用符で囲まれているものは *note
     ソフトキーワード: a0d. を表します。

パターンマッチングは、パターン (‘case’ の後ろ) とマッチング対象の値
(‘match’ の後ろ)を入力とします。 パターン (サブパターンを含みうる) は、
マッチング対象の値に対して、マッチするかどうかの判定が行われます。結果と
して次のことが起こります:

   * マッチ成功、もしくはマッチ失敗 (パターン成功・失敗とも呼ばれます)。

   * マッチした値の名前への束縛。必要な条件は後述します。

‘match’ と ‘case’ キーワードは *note ソフトキーワード: a0d. です。

参考
....

   * PEP 634(1) - 構造的パターンマッチ: 仕様

   * PEP 636(2) - 構造的パターンマッチ: チュートリアル

* Menu:

* 概要::
* ガード: ガード<2>.
* 論駁不可能なケースブロック::
* パターン::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0634/

   (2) https://peps.python.org/pep-0636/


File: python.info,  Node: 概要,  Next: ガード<2>,  Up: match 文<2>

4.8.6.1 概要
............

match 文の論理的な動作の流れの概要は次の通りです:

  1. サブジェクト式 ‘subject_expr’ が評価され、サブジェクト値が得られま
     す。 サブジェクト式がコンマを含む場合、 *note 通常のルール: 254a. に
     従ってタプルが作成されます。

  2. ‘case_block’ 内の各パターンに対して、サブジェクト値がマッチするかど
     うかをチェックします。 マッチ成功・失敗の具体的なルールは後述します
     。 マッチングのチェックにより、パターン内の名前の一部あるいはすべて
     に値が束縛されます。 具体的な束縛ルールはパターンの種類によって異な
     るため、後述します。 'マッチが成功したパターンの中で束縛された名前
     は、そのパターンのブロック内だけでなく、 match 文の後でも使用するこ
     とができます'。

          注釈: パターンマッチが全体として失敗しても、その中に含まれるサ
          ブパターンが成功する可能性があります。 失敗したマッチで発生す
          る名前束縛を前提としたコードを書かないように気をつけてください
          。 逆に、マッチが失敗したあとで変数の値が変わっていないという
          のも前提にしないでください。 実際どういう振る舞いになるかは
          Python の実装依存であり、実装間で異なる可能性があります。 色々
          な実装が最適化を行えるよう、意図的に実装依存としています。

  3. パターンが成功した場合、該当のガードが (もしあれば) 評価されます。
     この場合、パターン内の名前がすべて束縛されていることが保証されてい
     ます。

        * ガードの評価値が真であるか、もしくはガードがなければ、
          ‘case_block’ 内の ‘block’ が実行されます。

        * そうでなければ、次の ‘case_block’ に対して再び上記の処理が実行
          されます。

        * これ以上 case block が存在しない場合は、 match 文が終了します
          。

     注釈: 基本的に、 match 文のパターンが評価されるという前提でコードを
     書くべきではありません。 インタープリタの実装によっては、結果をキャ
     ッシュするなどの最適化を行い、評価をスキップする可能性があります。

簡単な match 文の例:

     >>> flag = False
     >>> match (100, 200):
     ...    case (100, 300):  # Mismatch: 200 != 300
     ...        print('Case 1')
     ...    case (100, 200) if flag:  # Successful match, but guard fails
     ...        print('Case 2')
     ...    case (100, y):  # Matches and binds y to 200
     ...        print(f'Case 3, y: {y}')
     ...    case _:  # Pattern not attempted
     ...        print('Case 4, I match anything!')
     ...
     Case 3, y: 200

この例では、 ‘if flag’ がガードです。 ガードについては次のセクションを参
照してください。


File: python.info,  Node: ガード<2>,  Next: 論駁不可能なケースブロック,  Prev: 概要,  Up: match 文<2>

4.8.6.2 ガード
..............

     guard: "if" `!named_expression`

‘guard’ (‘case’ 一部として現れる) が成功してはじめて、その ‘case’ ブロッ
クのコードが実行されます。 ガードは *note if: 181. の後に式を書く形で表
記されます。

‘guard’ 付きの ‘case’ ブロックの処理の流れは次のとおりです:

  1. ‘case’ ブロックのパターンが成功するかどうかをチェックする。 失敗し
     た場合は、 ‘guard’ は評価されず、次の ‘case’ ブロックのチェックに進
     む。

  2. パターンが成功した場合は、 ‘guard’ の評価が行われます。

        * ‘guard’ 条件の評価値が真である場合、該当の case ブロックが選択
          されます。

        * ‘guard’ 条件の評価値が偽の場合、該当の case ブロックは選択され
          ません。

        * ‘guard’ の評価中に例外が送出された場合は、その例外がそのまま送
          出されます。

ガードは式であるため、副作用を起こすことができます。 ガードの評価は、最
初の case ブロックから順に、パターンが失敗した case ブロックは飛ばしつつ
、一つづつ評価されなければいけません (つまり、ガードの評価は書かれている
順番で実行される必要があります)。 また、case ブロックが選択された時点で
、ガードの評価をそれ以上行ってはいけません。


File: python.info,  Node: 論駁不可能なケースブロック,  Next: パターン,  Prev: ガード<2>,  Up: match 文<2>

4.8.6.3 論駁不可能なケースブロック
..................................

論駁不可能なケースブロックとは、何にでもマッチするケースブロックのことで
す。 match 文の中で、論駁不可能なケースブロックは最大一つまで、かつ最後
に位置する必要があります。

ケースブロックが論駁不可能であるためには、ガードがなく、パターンが論駁不
可能である必要があります。 パターンが論駁不可能であるためには、その文法
上の構造のみから、それが常に成功することが証明できる必要があります。 論
駁不可能なパターンは以下のようなもののみです:

   * 左辺が論駁不可能である *note AS パターン: 254e.

   * 含まれるパターンのうち少なくとも一つが論駁不可能である *note OR
     パターン: 254f.

   * *note キャプチャパターン: 2550.

   * *note ワイルドカードパターン: a0f.

   * 括弧で囲われた、論駁不可能なパターン


File: python.info,  Node: パターン,  Prev: 論駁不可能なケースブロック,  Up: match 文<2>

4.8.6.4 パターン
................

     注釈: このセクションでは、通常のEBNFを拡張した文法記法を使用します
     。

        * ‘SEP.RULE+’ という表記は ‘RULE (SEP RULE)*’ の略です。

        * ‘!RULE’ は否定先読みの条件を表します。

‘patterns’ のトップレベルの構文は以下の通りです:

     patterns:       *note open_sequence_pattern: 2552. | *note pattern: 2553.
     pattern:        *note as_pattern: 2554. | *note or_pattern: 2555.
     closed_pattern: | *note literal_pattern: 2557.
                     | *note capture_pattern: 2558.
                     | *note wildcard_pattern: 2559.
                     | *note value_pattern: 255a.
                     | *note group_pattern: 255b.
                     | *note sequence_pattern: 255c.
                     | *note mapping_pattern: 255d.
                     | *note class_pattern: 255e.

以下の説明では分かりやすさのため、パターンの振る舞いを簡単に言い表した場
合の説明を「簡単に言うと」の後に書いています (そのほとんどは、Raymond
Hettinger 氏のドキュメントに影響を受けてのものです)。 ただし、これはあく
まで理解を助けるためのであり、内部的な実装を必ずしも反映したものでは 'あ
りません' 。 また、使用可能なすべてのパターン構造を網羅しているわけでは
ありません。

* Menu:

* OR パターン::
* AS パターン::
* リテラルパターン::
* キャプチャパターン::
* ワイルドカードパターン::
* 値パターン::
* グループパターン::
* シーケンスパターン::
* マッピングパターン::
* クラスパターン::


File: python.info,  Node: OR パターン,  Next: AS パターン,  Up: パターン

4.8.6.5 OR パターン
...................

OR パターンは、縦線 ‘|’ で区切られた複数のパターンからなります。 構文:

     or_pattern: "|".*note closed_pattern: 2556.+

最後のサブパターン以外、 *note 論駁不可能: 254c. であってはいけません。
また、曖昧さ回避のため、各サブパターンが束縛する名前の組み合わせは、すべ
て同じである必要があります。

OR パターンでは、サブジェクト値に対して順に各サブパターンのマッチングが
行われます。 マッチが成功するとそこで終了し、この OR パターンは成功した
とみなされます。 一方、どのサブパターンも成功しなければ、この OR パター
ンは失敗したことになります。

簡単に言うと、 ‘P1 | P2 | ...’ というパターンは ‘P1’ をマッチしようとし
、失敗すれば ‘P2’ を試します。 いずれかのパターンがマッチが成功すれば直
ちに成功となり、それ以外の場合は失敗となります。


File: python.info,  Node: AS パターン,  Next: リテラルパターン,  Prev: OR パターン,  Up: パターン

4.8.6.6 AS パターン
...................

AS パターンはサブジェクト値に対して、 *note as: 253f. キーワードの左側に
ある OR パターンをマッチさせます。 構文:

     as_pattern: *note or_pattern: 2555. "as" *note capture_pattern: 2558.

OR パターンが失敗すれば、この AS パターンは失敗となります。 成功すれば、
サブジェクト値が as キーワードの右側の名前に束縛され、この AS パターンは
成功となります。 ‘capture_pattern’ として ‘_’ を指定することはできません
。

簡単に言うと、 ‘P as NAME’ は ‘P’ をマッチさせ、成功した場合に ‘NAME =
<subject>’ の代入を行います。


File: python.info,  Node: リテラルパターン,  Next: キャプチャパターン,  Prev: AS パターン,  Up: パターン

4.8.6.7 リテラルパターン
........................

リテラルパターンは、一部を除く Python の *note リテラル: 22c9. に対応し
ます。 構文:

     literal_pattern: *note signed_number: 2563.
                      | *note signed_number: 2563. "+" NUMBER
                      | *note signed_number: 2563. "-" NUMBER
                      | *note strings: 247e.
                      | "None"
                      | "True"
                      | "False"
     signed_number:   ["-"] NUMBER

The rule ‘strings’ and the token ‘NUMBER’ are defined in the *note
standard Python grammar: 2564.  Triple-quoted strings are supported.
Raw strings and byte strings are supported.  *note f-strings: 19a. and
*note t-strings: 17fa. are not supported.

‘signed_number '+' NUMBER’ と ‘signed_number '-' NUMBER’ という構文は
*note 複素数: 231b. を表現するためのものです。 そのため、左側には実数、
右側には虚数を書く必要があります。 例: ‘3 + 4j’ 。

簡単に言うと、 ‘LITERAL’ は ‘<subject> == LITERAL’ であるときのみ成功す
るパターンです。 シングルトンである ‘None’ と ‘True’ 、 ‘False’ は *note
is: 34c. 演算子を使って比較されます。


File: python.info,  Node: キャプチャパターン,  Next: ワイルドカードパターン,  Prev: リテラルパターン,  Up: パターン

4.8.6.8 キャプチャパターン
..........................

キャプチャパターンは、サブジェクト値を名前に束縛します。 構文:

     capture_pattern: !'_' NAME

アンダースコア一文字の ‘_’ はキャプチャパターンではありません (‘!'_'’ が
表しているのはこの条件です) 。 *note wildcard_pattern: 2559. として扱わ
れます。

パターン一つの中で、一つの名前は一度しか束縛することができません。 例え
ば、 ‘case x, x: ...’ は間違いですが、 ‘case [x] | x: ...’ は正しいです
。

キャプチャパターンは常に成功します。 束縛された名前のスコープは、 PEP
572(1) で確立された代入式演算子のスコープルールと同じです。 すなわち、当
てはまる *note global: 4ac. 文 か *note nonlocal: 14bf. 文がない限り、そ
の局所変数のスコープは、該当の match 文を包む最も内側の関数となります。

簡単に言うと、 ‘NAME’ は常に成功し、 ‘NAME = <subject>’ の代入が行われま
す。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0572/


File: python.info,  Node: ワイルドカードパターン,  Next: 値パターン,  Prev: キャプチャパターン,  Up: パターン

4.8.6.9 ワイルドカードパターン
..............................

ワイルドカードパターンは常に成功 (何に対してもマッチする) し、名前の束縛
はしません。 構文:

     wildcard_pattern: '_'

‘_’ は、パターンの中で使用された場合は常に *note ソフトキーワード: a0d.
です。 しかし、パターンの中でない場合はソフトキーワードではありません。
たとえサブジェクト式や ‘guard’ 、 ‘case’ ブロックの中でも、通常の変数と
なります。

簡単に言うと、 ‘_’ は常に成功します。


File: python.info,  Node: 値パターン,  Next: グループパターン,  Prev: ワイルドカードパターン,  Up: パターン

4.8.6.10 値パターン
...................

値パターンは Python で名前の付けられた値を表します。 構文:

     value_pattern: *note attr: 2569.
     attr:          *note name_or_attr: 256a. "." NAME
     name_or_attr:  *note attr: 2569. | NAME

ドットがついたこの名前は、Python 標準の *note 名前解決ルール: 242a. によ
って解決されます。 このパターンは、解決された値がサブジェクト値と等しい
(比較演算子 ‘==’ に基づく) ときに成功となります。

簡単に言うと、 ‘NAME1.NAME2’ は ‘<subject> == NAME1.NAME2’ であるときの
み成功します。

     注釈: 一つの match 文で同じ値が複数回出現する場合は、インタープリタ
     が最初に解決された値をキャッシュし、名前解決を何度も行うことなく値
     を再利用する可能性があります。 このキャッシュは、その match 文のそ
     の実行一回の間だけで再利用されます。


File: python.info,  Node: グループパターン,  Next: シーケンスパターン,  Prev: 値パターン,  Up: パターン

4.8.6.11 グループパターン
.........................

A group pattern allows users to add parentheses around patterns to
emphasize the intended grouping.  Otherwise, it has no additional
syntax.  Syntax:

     group_pattern: "(" *note pattern: 2553. ")"

In simple terms ‘(P)’ has the same effect as ‘P’.


File: python.info,  Node: シーケンスパターン,  Next: マッピングパターン,  Prev: グループパターン,  Up: パターン

4.8.6.12 シーケンスパターン
...........................

A sequence pattern contains several subpatterns to be matched against
sequence elements.  The syntax is similar to the unpacking of a list or
tuple.

     sequence_pattern:       "[" [*note maybe_sequence_pattern: 256f.] "]"
                             | "(" [*note open_sequence_pattern: 2552.] ")"
     open_sequence_pattern:  *note maybe_star_pattern: 2570. "," [*note maybe_sequence_pattern: 256f.]
     maybe_sequence_pattern: ",".*note maybe_star_pattern: 2570.+ ","?
     maybe_star_pattern:     *note star_pattern: 2571. | *note pattern: 2553.
     star_pattern:           "*" (*note capture_pattern: 2558. | *note wildcard_pattern: 2559.)

There is no difference if parentheses or square brackets are used for
sequence patterns (i.e.  ‘(...)’ vs ‘[...]’ ).

     注釈: A single pattern enclosed in parentheses without a trailing
     comma (e.g.  ‘(3 | 4)’) is a *note group pattern: 256b.  While a
     single pattern enclosed in square brackets (e.g.  ‘[3 | 4]’) is
     still a sequence pattern.

At most one star subpattern may be in a sequence pattern.  The star
subpattern may occur in any position.  If no star subpattern is present,
the sequence pattern is a fixed-length sequence pattern; otherwise it is
a variable-length sequence pattern.

The following is the logical flow for matching a sequence pattern
against a subject value:

  1. If the subject value is not a sequence (1), the sequence pattern
     fails.

  2. If the subject value is an instance of ‘str’, ‘bytes’ or
     ‘bytearray’ the sequence pattern fails.

  3. The subsequent steps depend on whether the sequence pattern is
     fixed or variable-length.

     If the sequence pattern is fixed-length:

       1. If the length of the subject sequence is not equal to the
          number of subpatterns, the sequence pattern fails

       2. Subpatterns in the sequence pattern are matched to their
          corresponding items in the subject sequence from left to
          right.  Matching stops as soon as a subpattern fails.  If all
          subpatterns succeed in matching their corresponding item, the
          sequence pattern succeeds.

     Otherwise, if the sequence pattern is variable-length:

       1. If the length of the subject sequence is less than the number
          of non-star subpatterns, the sequence pattern fails.

       2. The leading non-star subpatterns are matched to their
          corresponding items as for fixed-length sequences.

       3. If the previous step succeeds, the star subpattern matches a
          list formed of the remaining subject items, excluding the
          remaining items corresponding to non-star subpatterns
          following the star subpattern.

       4. Remaining non-star subpatterns are matched to their
          corresponding subject items, as for a fixed-length sequence.

          注釈: The length of the subject sequence is obtained via *note
          len(): 840. (i.e.  via the *note __len__(): 178f. protocol).
          This length may be cached by the interpreter in a similar
          manner as *note value patterns: 2568.

In simple terms ‘[P1, P2, P3,’ ...  ‘, P<N>]’ matches only if all the
following happens:

   * ‘<subject>’ がシーケンスかをチェックする

   * ‘len(subject) == <N>’

   * ‘P1’ matches ‘<subject>[0]’ (note that this match can also bind
     names)

   * ‘P2’ matches ‘<subject>[1]’ (note that this match can also bind
     names)

   * ...  and so on for the corresponding pattern/element.

   ---------- Footnotes ----------

   (1) In pattern matching, a sequence is defined as one of the
following:

   * *note collections.abc.Sequence: 13dc. を継承したクラス。

   * *note collections.abc.Sequence: 13dc. として登録されたPythonクラス
     。

   * a builtin class that has its (CPython) *note Py_TPFLAGS_SEQUENCE:
     1c59. bit set

   * a class that inherits from any of the above

The following standard library classes are sequences:

   * *note array.array: 4be.

   * *note collections.deque: 7f4.

   * *note list: 24d.

   * *note memoryview: 165.

   * *note range: b3d.

   * *note tuple: 614.

     注釈: Subject values of type ‘str’, ‘bytes’, and ‘bytearray’ do not
     match sequence patterns.


File: python.info,  Node: マッピングパターン,  Next: クラスパターン,  Prev: シーケンスパターン,  Up: パターン

4.8.6.13 マッピングパターン
...........................

A mapping pattern contains one or more key-value patterns.  The syntax
is similar to the construction of a dictionary.  Syntax:

     mapping_pattern:     "{" [*note items_pattern: 2574.] "}"
     items_pattern:       ",".*note key_value_pattern: 2575.+ ","?
     key_value_pattern:   (*note literal_pattern: 2557. | *note value_pattern: 255a.) ":" *note pattern: 2553.
                          | *note double_star_pattern: 2576.
     double_star_pattern: "**" *note capture_pattern: 2558.

At most one double star pattern may be in a mapping pattern.  The double
star pattern must be the last subpattern in the mapping pattern.

Duplicate keys in mapping patterns are disallowed.  Duplicate literal
keys will raise a *note SyntaxError: 18e.  Two keys that otherwise have
the same value will raise a *note ValueError: 2ec. at runtime.

The following is the logical flow for matching a mapping pattern against
a subject value:

  1. If the subject value is not a mapping (1),the mapping pattern
     fails.

  2. If every key given in the mapping pattern is present in the subject
     mapping, and the pattern for each key matches the corresponding
     item of the subject mapping, the mapping pattern succeeds.

  3. If duplicate keys are detected in the mapping pattern, the pattern
     is considered invalid.  A *note SyntaxError: 18e. is raised for
     duplicate literal values; or a *note ValueError: 2ec. for named
     keys of the same value.

     注釈: Key-value pairs are matched using the two-argument form of
     the mapping subject's ‘get()’ method.  Matched key-value pairs must
     already be present in the mapping, and not created on-the-fly via
     *note __missing__(): 13d5. or *note __getitem__(): 588.

In simple terms ‘{KEY1: P1, KEY2: P2, ... }’ matches only if all the
following happens:

   * ‘<subject>’ がマッピングかをチェックする

   * ‘KEY1 in <subject>’

   * ‘P1’ は ‘<subject>[KEY1]’ にマッチする

   * ...  and so on for the corresponding KEY/pattern pair.

   ---------- Footnotes ----------

   (1) In pattern matching, a mapping is defined as one of the
following:

   * a class that inherits from *note collections.abc.Mapping: ac7.

   * a Python class that has been registered as *note
     collections.abc.Mapping: ac7.

   * a builtin class that has its (CPython) *note Py_TPFLAGS_MAPPING:
     1c58. bit set

   * a class that inherits from any of the above

The standard library classes *note dict: 183. and *note
types.MappingProxyType: 698. are mappings.


File: python.info,  Node: クラスパターン,  Prev: マッピングパターン,  Up: パターン

4.8.6.14 クラスパターン
.......................

A class pattern represents a class and its positional and keyword
arguments (if any).  Syntax:

     class_pattern:       *note name_or_attr: 256a. "(" [*note pattern_arguments: 2579. ","?] ")"
     pattern_arguments:   *note positional_patterns: 257a. ["," *note keyword_patterns: 257b.]
                          | *note keyword_patterns: 257b.
     positional_patterns: ",".*note pattern: 2553.+
     keyword_patterns:    ",".*note keyword_pattern: 257c.+
     keyword_pattern:     NAME "=" *note pattern: 2553.

The same keyword should not be repeated in class patterns.

The following is the logical flow for matching a class pattern against a
subject value:

  1. If ‘name_or_attr’ is not an instance of the builtin *note type:
     f44. , raise *note TypeError: 198.

  2. If the subject value is not an instance of ‘name_or_attr’ (tested
     via *note isinstance(): 2ad.), the class pattern fails.

  3. If no pattern arguments are present, the pattern succeeds.
     Otherwise, the subsequent steps depend on whether keyword or
     positional argument patterns are present.

     For a number of built-in types (specified below), a single
     positional subpattern is accepted which will match the entire
     subject; for these types keyword patterns also work as for other
     types.

     If only keyword patterns are present, they are processed as
     follows, one by one:

       1. The keyword is looked up as an attribute on the subject.

             * If this raises an exception other than *note
               AttributeError: 5f0, the exception bubbles up.

             * If this raises *note AttributeError: 5f0, the class
               pattern has failed.

             * Else, the subpattern associated with the keyword pattern
               is matched against the subject's attribute value.  If
               this fails, the class pattern fails; if this succeeds,
               the match proceeds to the next keyword.

       2. If all keyword patterns succeed, the class pattern succeeds.

     If any positional patterns are present, they are converted to
     keyword patterns using the *note __match_args__: 1c75. attribute on
     the class ‘name_or_attr’ before matching:

       1. The equivalent of ‘getattr(cls, "__match_args__", ())’ is
          called.

             * If this raises an exception, the exception bubbles up.

             * If the returned value is not a tuple, the conversion
               fails and *note TypeError: 198. is raised.

             * If there are more positional patterns than
               ‘len(cls.__match_args__)’, *note TypeError: 198. is
               raised.

             * Otherwise, positional pattern ‘i’ is converted to a
               keyword pattern using ‘__match_args__[i]’ as the keyword.
               ‘__match_args__[i]’ must be a string; if not *note
               TypeError: 198. is raised.

             * If there are duplicate keywords, *note TypeError: 198. is
               raised.

          参考
          ....

          *note クラスパターンマッチの位置引数のカスタマイズ: 240e.

       2. Once all positional patterns have been converted to keyword
          patterns, the match proceeds as if there were only keyword
          patterns.

     For the following built-in types the handling of positional
     subpatterns is different:

        * *note bool: 3c3.

        * *note bytearray: 344.

        * *note bytes: 192.

        * *note dict: 183.

        * *note float: 196.

        * *note frozenset: 7f2.

        * *note int: 19b.

        * *note list: 24d.

        * *note set: 184.

        * *note str: 169.

        * *note tuple: 614.

     These classes accept a single positional argument, and the pattern
     there is matched against the whole object rather than an attribute.
     For example ‘int(0|1)’ matches the value ‘0’, but not the value
     ‘0.0’.

In simple terms ‘CLS(P1, attr=P2)’ matches only if the following
happens:

   * ‘isinstance(<subject>, CLS)’

   * convert ‘P1’ to a keyword pattern using ‘CLS.__match_args__’

   * For each keyword argument ‘attr=P2’:

        * ‘hasattr(<subject>, "attr")’

        * ‘P2’ は ‘<subject>.attr’ にマッチする

   * ...  and so on for the corresponding keyword argument/pattern pair.

参考
....

   * PEP 634(1) - 構造的パターンマッチ: 仕様

   * PEP 636(2) - 構造的パターンマッチ: チュートリアル

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0634/

   (2) https://peps.python.org/pep-0636/


File: python.info,  Node: 関数定義,  Next: クラス定義,  Prev: match 文<2>,  Up: 複合文 compound statement

4.8.7 関数定義
--------------

関数定義は、ユーザ定義関数オブジェクトを定義します (*note 標準型の階層:
232f. 節参照):

     funcdef:                   [*note decorators: 257e.] "def" *note funcname: 257f. [*note type_params: 251f.] "(" [*note parameter_list: 24e3.] ")"
                                ["->" *note expression: 182.] ":" *note suite: 2530.
     decorators:                *note decorator: 2580.+
     decorator:                 "@" *note assignment_expression: 242d. NEWLINE
     parameter_list:            *note defparameter: 2581. ("," *note defparameter: 2581.)* "," "/" ["," [*note parameter_list_no_posonly: 2582.]]
                                  | *note parameter_list_no_posonly: 2582.
     parameter_list_no_posonly: *note defparameter: 2581. ("," *note defparameter: 2581.)* ["," [*note parameter_list_starargs: 2583.]]
                                | *note parameter_list_starargs: 2583.
     parameter_list_starargs:   "*" [*note star_parameter: 2584.] ("," *note defparameter: 2581.)* ["," [*note parameter_star_kwargs: 2585.]]
                                | "*" ("," *note defparameter: 2581.)+ ["," [*note parameter_star_kwargs: 2585.]]
                                | *note parameter_star_kwargs: 2585.
     parameter_star_kwargs:     "**" *note parameter: 2586. [","]
     parameter:                 *note identifier: 22c1. [":" *note expression: 182.]
     star_parameter:            *note identifier: 22c1. [":" ["*"] *note expression: 182.]
     defparameter:              *note parameter: 2586. ["=" *note expression: 182.]
     funcname:                  *note identifier: 22c1.

関数定義は実行可能な文です。関数定義を実行すると、現在のローカルな名前空
間内で関数名を関数オブジェクト (関数の実行可能コードをくるむラッパー) に
束縛します。この関数オブジェクトには、関数が呼び出された際に使われるグロ
ーバルな名前空間として、現在のグローバルな名前空間への参照が入っています
。

関数定義は関数本体を実行しません; 関数本体は関数が呼び出された時にのみ実
行されます。 (1)

関数定義は一つ以上の *note デコレータ: 93a. 式でラップできます。デコレー
タ式は関数を定義するとき、関数定義の入っているスコープで評価されます。そ
の結果は、関数オブジェクトを唯一の引数にとる呼び出し可能オブジェクトでな
ければなりません。関数オブジェクトの代わりに、返された値が関数名に束縛さ
れます。複数のデコレータはネストして適用されます。例えば、以下のようなコ
ード:

     @f1(arg)
     @f2
     def func(): pass

は、だいたい次と等価です

     def func(): pass
     func = f1(arg)(f2(func))

ただし、前者のコードでは元々の関数を ‘func’ という名前へ一時的に束縛する
ことはない、というところを除きます。

バージョン 3.9 で変更: Functions may be decorated with any valid *note
assignment_expression: 242d.  Previously, the grammar was much more
restrictive; see PEP 614(2) for details.

A list of *note type parameters: 5ad. may be given in square brackets
between the function's name and the opening parenthesis for its
parameter list.  This indicates to static type checkers that the
function is generic.  At runtime, the type parameters can be retrieved
from the function's *note __type_params__: 234d. attribute.  See *note
Generic functions: 682. for more.

バージョン 3.12 で変更: Type parameter lists are new in Python 3.12.

1 つ以上の *note 仮引数: 234b. が 'parameter' ‘=’ 'expression' の形を取
っているとき、関数は "デフォルト引数値" を持つと言います。デフォルト値を
持つ仮引数では、呼び出し時にそれに対応する *note 実引数: 67b. は省略でき
、その場合は仮引数のデフォルト値が使われます。ある引数がデフォルト値を持
っている場合、それ以降 "‘*’" が出てくるまでの引数は全てデフォルト値を持
っていなければなりません - これは文法定義では表現されていない構文的制限
です。

'デフォルト引数値は関数定義が実行されるときに左から右へ評価されます。' こ
れは、デフォルト引数の式は関数が定義されるときにただ一度だけ評価され、同
じ "計算済みの" 値が呼び出しのたびに使用されることを意味します。この仕様
を理解しておくことは特に、デフォルト引数値がリストや辞書のようなミュータ
ブルなオブジェクトであるときに重要です: 関数がこのオブジェクトを変更 (例
えばリストに要素を追加) すると、このデフォルト引数値が変更の影響を受けて
しまします。一般には、これは意図しない動作です。このような動作を避けるに
は、デフォルト値として ‘None’ を使い、この値を関数本体の中で明示的にテス
トします。例えば以下のようにします:

     def whats_on_the_telly(penguin=None):
         if penguin is None:
             penguin = []
         penguin.append("property of the zoo")
         return penguin

関数呼び出しの意味付けに関する詳細は、 *note 呼び出し (call): f7d. 節で
述べられています。 関数呼び出しを行うと、パラメタリストに記述された全て
のパラメタに、位置引数、キーワード引数、デフォルト値のいずれかから値が代
入されます。 "‘*identifier’" 形式が存在すれば、余ったすべての位置引数を
受け取ったタプルに初期化されます。 このデフォルト値は空のタプルです。
"‘**identifier’" 形式が存在すれば、余ったすべてのキーワード引数を受け取
った順序付きのマッピングオブジェクトに初期化されます。 このデフォルト値
は同じ型の空のマッピングオブジェクトです。 "‘*’" や "‘*identifier’" の後
のパラメタはキーワード専用パラメータで、キーワード引数によってのみ渡され
ます。 "‘/’" の前のパラメタは位置専用パラメータで、位置引数によってのみ
渡されます。

バージョン 3.8 で変更: The ‘/’ function parameter syntax may be used to
indicate positional-only parameters.  See PEP 570(3) for details.

Parameters may have an *note annotation: 2019. of the form "‘:
expression’" following the parameter name.  Any parameter may have an
annotation, even those of the form ‘*identifier’ or ‘**identifier’.  (As
a special case, parameters of the form ‘*identifier’ may have an
annotation "‘: *expression’".)  Functions may have "return" annotation
of the form "‘-> expression’" after the parameter list.  These
annotations can be any valid Python expression.  The presence of
annotations does not change the semantics of a function.  See *note
Annotations: 2587. for more information on annotations.

バージョン 3.11 で変更: Parameters of the form "‘*identifier’" may have
an annotation "‘: *expression’".  See PEP 646(4).

式を即時に使用するために、無名関数 (名前に束縛されていない関数) を作成す
ることもできます。 これは *note ラムダ (lambda): 14b5. の節で解説されて
いるラムダ式を使います。 ラムダ式は簡略化された関数定義の簡略表現に過ぎ
ないことに注意してください; "*note def: 1673." 文で定義された関数もラム
ダ式で作成された関数のように、引数として渡せたり、他の名前に割り当てるこ
とができます。 複数の式とアノテーションが実行できるので、 "‘def’" 形式の
方がより強力です。

'プログラマへのメモ:' 関数は第一級オブジェクトです。関数定義内で実行され
た "‘def’" 文は、返り値や引数として渡せるローカル関数を定義します。ネス
トした関数内で使われる自由変数は、 def を含んでいる関数のローカル変数に
アクセスできます。詳細は *note 名前づけと束縛 (naming and binding):
2346. 節を参照してください。

参考
....

PEP 3107(5) - Function Annotations

     関数アノテーションの元の仕様書。

PEP 484(6) - 型ヒント

     アノテーションの標準的な意味付けである型ヒントの定義。

PEP 526(7) - Syntax for Variable Annotations

     Ability to type hint variable declarations, including class
     variables and instance variables.

PEP 563(8) - アノテーションの遅延評価

     実行時にアノテーションを貪欲評価するのではなく文字列形式で保持する
     ことによる、アノテーションにおける前方参照のサポート

PEP 318(9) - Decorators for Functions and Methods

     Function and method decorators were introduced.  Class decorators
     were introduced in PEP 3129(10).

   ---------- Footnotes ----------

   (1) A string literal appearing as the first statement in the function
body is transformed into the function's *note __doc__: 13f1. attribute
and therefore the function's *note docstring: 22ec.

   (2) https://peps.python.org/pep-0614/

   (3) https://peps.python.org/pep-0570/

   (4) https://peps.python.org/pep-0646/

   (5) https://peps.python.org/pep-3107/

   (6) https://peps.python.org/pep-0484/

   (7) https://peps.python.org/pep-0526/

   (8) https://peps.python.org/pep-0563/

   (9) https://peps.python.org/pep-0318/

   (10) https://peps.python.org/pep-3129/


File: python.info,  Node: クラス定義,  Next: コルーチン<2>,  Prev: 関数定義,  Up: 複合文 compound statement

4.8.8 クラス定義
----------------

クラス定義は、クラスオブジェクトを定義します (*note 標準型の階層: 232f.
節参照):

     classdef:    [*note decorators: 257e.] "class" *note classname: 2589. [*note type_params: 251f.] [*note inheritance: 258a.] ":" *note suite: 2530.
     inheritance: "(" [*note argument_list: 24b8.] ")"
     classname:   *note identifier: 22c1.

クラス定義は実行可能な文です。継承リストは通常、基底クラスリストを与えま
す (より高度な使い方は、 *note メタクラス: 23be. を参照してください)。で
すから、リストのそれぞれの要素の評価はサブクラス化しても良いクラスである
べきです。継承リストのないクラスは、デフォルトで、基底クラス *note
object: c7e. を継承するので:

     class Foo:
         pass

は、以下と同等です

     class Foo(object):
         pass

次にクラスのスイートが、新たな実行フレーム (*note 名前づけと束縛 (naming
and binding): 2346. を参照してください) 内で、新たに作られたローカル名前
空間と元々のグローバル名前空間を使って実行されます (通常、このスイートに
は主に関数定義が含まれます)。クラスのスイートが実行し終えると、実行フレ
ームは破棄されますが、ローカルな名前空間は保存されます。(1) 次に、継承リ
ストを基底クラスに、保存されたローカル名前空間を属性値辞書に、それぞれ使
ってクラスオブジェクトが生成されます。最後に、もとのローカル名前空間にお
いて、クラス名がこのクラスオブジェクトに束縛されます。

The order in which attributes are defined in the class body is preserved
in the new class's *note __dict__: e57.  Note that this is reliable only
right after the class is created and only for classes that were defined
using the definition syntax.

クラス作成は、 *note メタクラス: 23be. を利用して大幅にカスタマイズでき
ます。

関数をデコレートするのと同じように、クラスもデコレートすることが出来ます
、

     @f1(arg)
     @f2
     class Foo: pass

は、だいたい次と等価です

     class Foo: pass
     Foo = f1(arg)(f2(Foo))

デコレータ式の評価規則は関数デコレータと同じです。結果はクラス名に束縛さ
れます。

バージョン 3.9 で変更: Classes may be decorated with any valid *note
assignment_expression: 242d.  Previously, the grammar was much more
restrictive; see PEP 614(2) for details.

A list of *note type parameters: 5ad. may be given in square brackets
immediately after the class's name.  This indicates to static type
checkers that the class is generic.  At runtime, the type parameters can
be retrieved from the class's *note __type_params__: 2376. attribute.
See *note Generic classes: 2377. for more.

バージョン 3.12 で変更: Type parameter lists are new in Python 3.12.

'プログラマのための注釈:' クラス定義内で定義された変数はクラス属性であり
、全てのインスタンス間で共有されます。インスタンス属性は、メソッドの中で
‘self.name = value’ とすることで設定できます。クラス属性もインスタンス属
性も "‘self.name’" 表記でアクセスでき、この表記でアクセスしたとき、イン
スタンス属性は同名のクラス属性を隠蔽します。クラス属性は、インスタンス属
性のデフォルト値として使えますが、そこにミュータブルな値を使うと予期せぬ
結果につながります。 *note 記述子: e49. を使うと、詳細な実装が異なるイン
スタンス変数を作成できます。

参考
....

PEP 3115(3) - Metaclasses in Python 3000

     メタクラスの宣言を現在の文法と、メタクラス付きのクラスがどのように
     構築されるかの意味論を変更した提案

PEP 3129(4) - クラスデコレータ

     クラスデコレータを追加した提案。 関数デコレータとメソッドデコレータ
     は PEP 318(5) で導入されました。

   ---------- Footnotes ----------

   (1) A string literal appearing as the first statement in the class
body is transformed into the namespace's *note __doc__: 2095. item and
therefore the class's *note docstring: 22ec.

   (2) https://peps.python.org/pep-0614/

   (3) https://peps.python.org/pep-3115/

   (4) https://peps.python.org/pep-3129/

   (5) https://peps.python.org/pep-0318/


File: python.info,  Node: コルーチン<2>,  Next: Type parameter lists,  Prev: クラス定義,  Up: 複合文 compound statement

4.8.9 コルーチン
----------------

Added in version 3.5.

* Menu:

* コルーチン関数定義::
* async for 文::
* async with 文::


File: python.info,  Node: コルーチン関数定義,  Next: async for 文,  Up: コルーチン<2>

4.8.9.1 コルーチン関数定義
..........................

     async_funcdef: [*note decorators: 257e.] "async" "def" *note funcname: 257f. "(" [*note parameter_list: 24e3.] ")"
                    ["->" *note expression: 182.] ":" *note suite: 2530.

Python で実行しているコルーチンは多くの時点で一時停止と再開ができます
(*note coroutine: 6b9. を参照)。*note await: 18d. 式である *note async
for: ca1. と *note async with: 185. はコルーチン関数の本体でしか使えませ
ん。

Functions defined with ‘async def’ syntax are always coroutine
functions, even if they do not contain ‘await’ or ‘async’ keywords.

コルーチン関数の本体の中で ‘yield from’ 式を使用すると *note
SyntaxError: 18e. になります。

コルーチン関数の例:

     async def func(param1, param2):
         do_stuff()
         await some_coroutine()

バージョン 3.7 で変更: ‘await’ and ‘async’ are now keywords; previously
they were only treated as such inside the body of a coroutine function.


File: python.info,  Node: async for 文,  Next: async with 文,  Prev: コルーチン関数定義,  Up: コルーチン<2>

4.8.9.2 ‘async for’ 文
......................

     async_for_stmt: "async" *note for_stmt: 2527.

*note asynchronous iterable: f74. は、その ‘__anext__’ メソッドで非同期
なコードを実行可能な、*note asynchronous iterator: 4c7. を直接返す
‘__aiter__’ メソッドを提供しています。

‘async for’ 文によって非同期なイテラブルを簡単にイテレーションすることが
できます。

以下のコード:

     async for TARGET in ITER:
         SUITE
     else:
         SUITE2

は意味論的に以下と等価です:

     iter = (ITER).__aiter__()
     running = True

     while running:
         try:
             TARGET = await iter.__anext__()
         except StopAsyncIteration:
             running = False
         else:
             SUITE
     else:
         SUITE2

except that implicit *note special method lookup: 23b1. is used for
*note __aiter__(): df6. and *note __anext__(): 1882.

コルーチン関数の本体の外で ‘async for’ 文を使用すると *note SyntaxError:
18e. になります。


File: python.info,  Node: async with 文,  Prev: async for 文,  Up: コルーチン<2>

4.8.9.3 ‘async with’ 文
.......................

     async_with_stmt: "async" *note with_stmt: 2529.

*note asynchronous context manager: 7f0. は、 'enter' メソッドと 'exit'
メソッド内部で実行を一時停止できる *note context manager: 1e1. です。

以下のコード:

     async with EXPRESSION as TARGET:
         SUITE

これは次と等価です:

     manager = (EXPRESSION)
     aenter = manager.__aenter__
     aexit = manager.__aexit__
     value = await aenter()
     hit_except = False

     try:
         TARGET = value
         SUITE
     except:
         hit_except = True
         if not await aexit(*sys.exc_info()):
             raise
     finally:
         if not hit_except:
             await aexit(None, None, None)

except that implicit *note special method lookup: 23b1. is used for
*note __aenter__(): 241d. and *note __aexit__(): 19a1.

コルーチン関数の本体の外で ‘async with’ 文を使用すると *note
SyntaxError: 18e. になります。

参考
....

PEP 492(1) - async 構文および await 構文付きのコルーチン

     コルーチンを Python のまともな独り立ちした概念にし、サポートする構
     文を追加した提案。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0492/


File: python.info,  Node: Type parameter lists,  Next: Annotations<2>,  Prev: コルーチン<2>,  Up: 複合文 compound statement

4.8.10 Type parameter lists
---------------------------

Added in version 3.12.

バージョン 3.13 で変更: Support for default values was added (see PEP
696(1)).

     type_params:  "[" *note type_param: 2590. ("," *note type_param: 2590.)* "]"
     type_param:   *note typevar: 2591. | *note typevartuple: 2592. | *note paramspec: 2593.
     typevar:      *note identifier: 22c1. (":" *note expression: 182.)? ("=" *note expression: 182.)?
     typevartuple: "*" *note identifier: 22c1. ("=" *note expression: 182.)?
     paramspec:    "**" *note identifier: 22c1. ("=" *note expression: 182.)?

*note Functions: 1673. (including *note coroutines: 7ed.), *note
classes: 14ef. and *note type aliases: 66d. may contain a type parameter
list:

     def max[T](args: list[T]) -> T:
         ...

     async def amax[T](args: list[T]) -> T:
         ...

     class Bag[T]:
         def __iter__(self) -> Iterator[T]:
             ...

         def add(self, arg: T) -> None:
             ...

     type ListOrSet[T] = list[T] | set[T]

Semantically, this indicates that the function, class, or type alias is
generic over a type variable.  This information is primarily used by
static type checkers, and at runtime, generic objects behave much like
their non-generic counterparts.

Type parameters are declared in square brackets (‘[]’) immediately after
the name of the function, class, or type alias.  The type parameters are
accessible within the scope of the generic object, but not elsewhere.
Thus, after a declaration ‘def func[T](): pass’, the name ‘T’ is not
available in the module scope.  Below, the semantics of generic objects
are described with more precision.  The scope of type parameters is
modeled with a special function (technically, an *note annotation scope:
4ab.) that wraps the creation of the generic object.

Generic functions, classes, and type aliases have a *note
__type_params__: 2594. attribute listing their type parameters.

Type parameters come in three kinds:

   * *note typing.TypeVar: 486, introduced by a plain name (e.g., ‘T’).
     Semantically, this represents a single type to a type checker.

   * *note typing.TypeVarTuple: 488, introduced by a name prefixed with
     a single asterisk (e.g., ‘*Ts’).  Semantically, this stands for a
     tuple of any number of types.

   * *note typing.ParamSpec: 487, introduced by a name prefixed with two
     asterisks (e.g., ‘**P’).  Semantically, this stands for the
     parameters of a callable.

*note typing.TypeVar: 486. declarations can define 'bounds' and
'constraints' with a colon (‘:’) followed by an expression.  A single
expression after the colon indicates a bound (e.g.  ‘T: int’).
Semantically, this means that the ‘typing.TypeVar’ can only represent
types that are a subtype of this bound.  A parenthesized tuple of
expressions after the colon indicates a set of constraints (e.g.  ‘T:
(str, bytes)’).  Each member of the tuple should be a type (again, this
is not enforced at runtime).  Constrained type variables can only take
on one of the types in the list of constraints.

For ‘typing.TypeVar’s declared using the type parameter list syntax, the
bound and constraints are not evaluated when the generic object is
created, but only when the value is explicitly accessed through the
attributes ‘__bound__’ and ‘__constraints__’.  To accomplish this, the
bounds or constraints are evaluated in a separate *note annotation
scope: 4ab.

*note typing.TypeVarTuple: 488.s and *note typing.ParamSpec: 487.s
cannot have bounds or constraints.

All three flavors of type parameters can also have a 'default value',
which is used when the type parameter is not explicitly provided.  This
is added by appending a single equals sign (‘=’) followed by an
expression.  Like the bounds and constraints of type variables, the
default value is not evaluated when the object is created, but only when
the type parameter's ‘__default__’ attribute is accessed.  To this end,
the default value is evaluated in a separate *note annotation scope:
4ab.  If no default value is specified for a type parameter, the
‘__default__’ attribute is set to the special sentinel object *note
typing.NoDefault: 569.

The following example indicates the full set of allowed type parameter
declarations:

     def overly_generic[
        SimpleTypeVar,
        TypeVarWithDefault = int,
        TypeVarWithBound: int,
        TypeVarWithConstraints: (str, bytes),
        *SimpleTypeVarTuple = (int, float),
        **SimpleParamSpec = (str, bytearray),
     ](
        a: SimpleTypeVar,
        b: TypeVarWithDefault,
        c: TypeVarWithBound,
        d: Callable[SimpleParamSpec, TypeVarWithConstraints],
        *e: SimpleTypeVarTuple,
     ): ...

* Menu:

* Generic functions::
* Generic classes::
* Generic type aliases::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0696/


File: python.info,  Node: Generic functions,  Next: Generic classes,  Up: Type parameter lists

4.8.10.1 Generic functions
..........................

Generic functions are declared as follows:

     def func[T](arg: T): ...

This syntax is equivalent to:

     annotation-def TYPE_PARAMS_OF_func():
         T = typing.TypeVar("T")
         def func(arg: T): ...
         func.__type_params__ = (T,)
         return func
     func = TYPE_PARAMS_OF_func()

Here ‘annotation-def’ indicates an *note annotation scope: 4ab, which is
not actually bound to any name at runtime.  (One other liberty is taken
in the translation: the syntax does not go through attribute access on
the *note typing: 10a. module, but creates an instance of *note
typing.TypeVar: 486. directly.)

The annotations of generic functions are evaluated within the annotation
scope used for declaring the type parameters, but the function's
defaults and decorators are not.

The following example illustrates the scoping rules for these cases, as
well as for additional flavors of type parameters:

     @decorator
     def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):
         ...

Except for the *note lazy evaluation: 685. of the *note TypeVar: 486.
bound, this is equivalent to:

     DEFAULT_OF_arg = some_default

     annotation-def TYPE_PARAMS_OF_func():

         annotation-def BOUND_OF_T():
             return int
         # In reality, BOUND_OF_T() is evaluated only on demand.
         T = typing.TypeVar("T", bound=BOUND_OF_T())

         Ts = typing.TypeVarTuple("Ts")
         P = typing.ParamSpec("P")

         def func(*args: *Ts, arg: Callable[P, T] = DEFAULT_OF_arg):
             ...

         func.__type_params__ = (T, Ts, P)
         return func
     func = decorator(TYPE_PARAMS_OF_func())

The capitalized names like ‘DEFAULT_OF_arg’ are not actually bound at
runtime.


File: python.info,  Node: Generic classes,  Next: Generic type aliases,  Prev: Generic functions,  Up: Type parameter lists

4.8.10.2 Generic classes
........................

Generic classes are declared as follows:

     class Bag[T]: ...

This syntax is equivalent to:

     annotation-def TYPE_PARAMS_OF_Bag():
         T = typing.TypeVar("T")
         class Bag(typing.Generic[T]):
             __type_params__ = (T,)
             ...
         return Bag
     Bag = TYPE_PARAMS_OF_Bag()

Here again ‘annotation-def’ (not a real keyword) indicates an *note
annotation scope: 4ab, and the name ‘TYPE_PARAMS_OF_Bag’ is not actually
bound at runtime.

Generic classes implicitly inherit from *note typing.Generic: 17b6.  The
base classes and keyword arguments of generic classes are evaluated
within the type scope for the type parameters, and decorators are
evaluated outside that scope.  This is illustrated by this example:

     @decorator
     class Bag(Base[T], arg=T): ...

これは次と等価です:

     annotation-def TYPE_PARAMS_OF_Bag():
         T = typing.TypeVar("T")
         class Bag(Base[T], typing.Generic[T], arg=T):
             __type_params__ = (T,)
             ...
         return Bag
     Bag = decorator(TYPE_PARAMS_OF_Bag())


File: python.info,  Node: Generic type aliases,  Prev: Generic classes,  Up: Type parameter lists

4.8.10.3 Generic type aliases
.............................

The *note type: 66d. statement can also be used to create a generic type
alias:

     type ListOrSet[T] = list[T] | set[T]

Except for the *note lazy evaluation: 685. of the value, this is
equivalent to:

     annotation-def TYPE_PARAMS_OF_ListOrSet():
         T = typing.TypeVar("T")

         annotation-def VALUE_OF_ListOrSet():
             return list[T] | set[T]
         # In reality, the value is lazily evaluated
         return typing.TypeAliasType("ListOrSet", VALUE_OF_ListOrSet(), type_params=(T,))
     ListOrSet = TYPE_PARAMS_OF_ListOrSet()

Here, ‘annotation-def’ (not a real keyword) indicates an *note
annotation scope: 4ab.  The capitalized names like
‘TYPE_PARAMS_OF_ListOrSet’ are not actually bound at runtime.


File: python.info,  Node: Annotations<2>,  Prev: Type parameter lists,  Up: 複合文 compound statement

4.8.11 Annotations
------------------

バージョン 3.14 で変更: Annotations are now lazily evaluated by default.

Variables and function parameters may carry *note annotations: 15c,
created by adding a colon after the name, followed by an expression:

     x: annotation = 1
     def f(param: annotation): ...

Functions may also carry a return annotation following an arrow:

     def f() -> annotation: ...

Annotations are conventionally used for *note type hints: 23cb, but this
is not enforced by the language, and in general annotations may contain
arbitrary expressions.  The presence of annotations does not change the
runtime semantics of the code, except if some mechanism is used that
introspects and uses the annotations (such as *note dataclasses: 33. or
*note functools.singledispatch(): 84b.).

By default, annotations are lazily evaluated in an *note annotation
scope: 4ab.  This means that they are not evaluated when the code
containing the annotation is evaluated.  Instead, the interpreter saves
information that can be used to evaluate the annotation later if
requested.  The *note annotationlib: 6. module provides tools for
evaluating annotations.

If the *note future statement: 45d. ‘from __future__ import annotations’
is present, all annotations are instead stored as strings:

     >>> from __future__ import annotations
     >>> def f(param: annotation): ...
     >>> f.__annotations__
     {'param': 'annotation'}

This future statement will be deprecated and removed in a future version
of Python, but not before Python 3.13 reaches its end of life (see PEP
749(1)).  When it is used, introspection tools like *note
annotationlib.get_annotations(): 459. and *note typing.get_type_hints():
8c0. are less likely to be able to resolve annotations at runtime.

脚注
....

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0749/


File: python.info,  Node: トップレベル要素,  Next: 完全な文法仕様,  Prev: 複合文 compound statement,  Up: Python 言語リファレンス

4.9 トップレベル要素
====================

Python インタプリタは、標準入力や、プログラムの引数として与えられたスク
リプト、対話的にタイプ入力された命令、モジュールのソースファイルなど、様
々な入力源から入力を得ることができます。この章では、それぞれの場合に用い
られる構文法について説明しています。

* Menu:

* 完全な Python プログラム::
* ファイル入力::
* 対話的入力::
* 式入力::


File: python.info,  Node: 完全な Python プログラム,  Next: ファイル入力,  Up: トップレベル要素

4.9.1 完全な Python プログラム
------------------------------

言語仕様の中では、その言語を処理するインタプリタがどのように起動されるか
まで規定する必要はないのですが、完全な Python プログラムの概念を知ってお
くと役に立ちます。完全な Python プログラムは、最小限に初期化された環境:
全ての組み込み変数と標準モジュールが利用可能で、かつ *note sys: df. (様
々なシステムサービス)、 *note builtins: 13. (組み込み関数、例外、および
‘None’)、 *note __main__: 1. の 3 つを除く全てのモジュールが初期化されて
いない状態で動作します。 *note __main__: 1. は、完全なプログラムを実行す
る際に、ローカルおよびグローバルな名前空間を提供するために用いられます。

完全な Python プログラムの構文は、下の節で述べるファイル入力のためのもの
です。

インタプリタは、対話的モード (interactive mode) で起動されることもありま
す; この場合、インタプリタは完全なプログラムを読んで実行するのではなく、
一度に単一の実行文 (複合文のときもあります) を読み込んで実行します。初期
状態の環境は、完全なプログラムを実行するときの環境と同じです; 各実行文は
、 *note __main__: 1. の名前空間内で実行されます。

完全なプログラムは3つの形式でインタープリタに渡せます: *note -c: 1a8.
'string' コマンドラインオプションで、コマンドラインの第 1 引数で渡される
ファイル、あるいは標準入力として渡します。 ファイルや標準入力が tty デバ
イスだった場合、インタープリタは対話モードに入ります。 それ以外の場合は
、ファイルを完全なプログラムとして実行します。


File: python.info,  Node: ファイル入力,  Next: 対話的入力,  Prev: 完全な Python プログラム,  Up: トップレベル要素

4.9.2 ファイル入力
------------------

非対話的なファイルから読み出された入力は、全て同じ形式:

     file_input: (NEWLINE | *note statement: 2532.)* ENDMARKER

をとります。この構文法は、以下の状況で用いられます:

   * (ファイルや文字列内の) 完全な Python プログラムを構文解析するとき;

   * モジュールを構文解析するとき;

   * *note exec(): 4a2. で渡された文字列を構文解析するとき;


File: python.info,  Node: 対話的入力,  Next: 式入力,  Prev: ファイル入力,  Up: トップレベル要素

4.9.3 対話的入力
----------------

対話モードでの入力は、以下の文法の下に構文解析されます:

     interactive_input: [*note stmt_list: 2531.] NEWLINE | *note compound_stmt: 2524. NEWLINE | ENDMARKER

対話モードでは、(トップレベルの) 複合文の最後に空白行を入れなくてはなら
ないことに注意してください; これは、複合文の終端をパーザが検出するための
手がかりとして必要です。


File: python.info,  Node: 式入力,  Prev: 対話的入力,  Up: トップレベル要素

4.9.4 式入力
------------

式入力には *note eval(): 4a3. が使われます。これは先頭の空白を無視します
。 *note eval(): 4a3. に対する文字列引数は、以下の形式をとらなければなり
ません:

     eval_input: *note expression_list: 24e7. NEWLINE* ENDMARKER


File: python.info,  Node: 完全な文法仕様,  Prev: トップレベル要素,  Up: Python 言語リファレンス

4.10 完全な文法仕様
===================

以下に示すのは Python の完全な文法です。CPython のパーサを生成するための
文法定義から直接導かれたものです (Grammar/python.gram(1) を参照のこと)。
ここに示すのは、コード生成およびエラー処理に関係する部分を省略したバージ
ョンです。

The notation used here is the same as in the preceding docs, and is
described in the *note notation: 2284. section, except for an extra
complication:

   * ‘~’ ("cut"): commit to the current alternative; fail the rule if
     the alternative fails to parse

     Python mainly uses cuts for optimizations or improved error
     messages.  They often appear to be useless in the listing below.

     Cuts currently don't appear inside parentheses, brackets,
     lookaheads and similar.  Their behavior in these contexts is
     deliberately left unspecified.

     # PEG grammar for Python

     @trailer '''
     void *
     _PyPegen_parse(Parser *p)
     {
         // Initialize keywords
         p->keywords = reserved_keywords;
         p->n_keyword_lists = n_keyword_lists;
         p->soft_keywords = soft_keywords;

         // Run parser
         void *result = NULL;
         if (p->start_rule == Py_file_input) {
             result = file_rule(p);
         } else if (p->start_rule == Py_single_input) {
             result = interactive_rule(p);
         } else if (p->start_rule == Py_eval_input) {
             result = eval_rule(p);
         } else if (p->start_rule == Py_func_type_input) {
             result = func_type_rule(p);
         }

         return result;
     }
     '''

     # ========================= START OF THE GRAMMAR =========================

     # General grammatical elements and rules:
     #
     # * Strings with double quotes (") denote SOFT KEYWORDS
     # * Strings with single quotes (') denote KEYWORDS
     # * Upper case names (NAME) denote tokens in the Grammar/Tokens file
     # * Rule names starting with "invalid_" are used for specialized syntax errors
     #     - These rules are NOT used in the first pass of the parser.
     #     - Only if the first pass fails to parse, a second pass including the invalid
     #       rules will be executed.
     #     - If the parser fails in the second phase with a generic syntax error, the
     #       location of the generic failure of the first pass will be used (this avoids
     #       reporting incorrect locations due to the invalid rules).
     #     - The order of the alternatives involving invalid rules matter
     #       (like any rule in PEG).
     #
     # Grammar Syntax (see PEP 617 for more information):
     #
     # rule_name: expression
     #   Optionally, a type can be included right after the rule name, which
     #   specifies the return type of the C or Python function corresponding to the
     #   rule:
     # rule_name[return_type]: expression
     #   If the return type is omitted, then a void * is returned in C and an Any in
     #   Python.
     # e1 e2
     #   Match e1, then match e2.
     # e1 | e2
     #   Match e1 or e2.
     #   The first alternative can also appear on the line after the rule name for
     #   formatting purposes. In that case, a | must be used before the first
     #   alternative, like so:
     #       rule_name[return_type]:
     #            | first_alt
     #            | second_alt
     # ( e )
     #   Match e (allows also to use other operators in the group like '(e)*')
     # [ e ] or e?
     #   Optionally match e.
     # e*
     #   Match zero or more occurrences of e.
     # e+
     #   Match one or more occurrences of e.
     # s.e+
     #   Match one or more occurrences of e, separated by s. The generated parse tree
     #   does not include the separator. This is otherwise identical to (e (s e)*).
     # &e
     #   Succeed if e can be parsed, without consuming any input.
     # !e
     #   Fail if e can be parsed, without consuming any input.
     # ~
     #   Commit to the current alternative, even if it fails to parse.
     # &&e
     #   Eager parse e. The parser will not backtrack and will immediately
     #   fail with SyntaxError if e cannot be parsed.
     #

     # STARTING RULES
     # ==============

     file[mod_ty]: a=[statements] ENDMARKER { _PyPegen_make_module(p, a) }
     interactive[mod_ty]: a=statement_newline { _PyAST_Interactive(a, p->arena) }
     eval[mod_ty]: a=expressions NEWLINE* ENDMARKER { _PyAST_Expression(a, p->arena) }
     func_type[mod_ty]: '(' a=[type_expressions] ')' '->' b=expression NEWLINE* ENDMARKER { _PyAST_FunctionType(a, b, p->arena) }

     # GENERAL STATEMENTS
     # ==================

     statements[asdl_stmt_seq*]: a=statement+ { (asdl_stmt_seq*)_PyPegen_seq_flatten(p, a) }

     statement[asdl_stmt_seq*]:
         | a=compound_stmt { _PyPegen_register_stmts(p ,
                                (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a)
                             ) }
         | a[asdl_stmt_seq*]=simple_stmts { a }

     single_compound_stmt[asdl_stmt_seq*]:
         | a=compound_stmt {
             _PyPegen_register_stmts(p, (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a)) }

     statement_newline[asdl_stmt_seq*]:
         | a=single_compound_stmt NEWLINE { a }
         | simple_stmts
         | NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, CHECK(stmt_ty, _PyAST_Pass(EXTRA))) }
         | ENDMARKER { _PyPegen_interactive_exit(p) }

     simple_stmts[asdl_stmt_seq*]:
         | a=simple_stmt !';' NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } # Not needed, there for speedup
         | a[asdl_stmt_seq*]=';'.simple_stmt+ [';'] NEWLINE { a }

     # NOTE: assignment MUST precede expression, else parsing a simple assignment
     # will throw a SyntaxError.
     simple_stmt[stmt_ty] (memo):
         | assignment
         | &"type" type_alias
         | e=star_expressions { _PyAST_Expr(e, EXTRA) }
         | &'return' return_stmt
         | &('import' | 'from') import_stmt
         | &'raise' raise_stmt
         | &'pass' pass_stmt
         | &'del' del_stmt
         | &'yield' yield_stmt
         | &'assert' assert_stmt
         | &'break' break_stmt
         | &'continue' continue_stmt
         | &'global' global_stmt
         | &'nonlocal' nonlocal_stmt

     compound_stmt[stmt_ty]:
         | &('def' | '@' | 'async') function_def
         | &'if' if_stmt
         | &('class' | '@') class_def
         | &('with' | 'async') with_stmt
         | &('for' | 'async') for_stmt
         | &'try' try_stmt
         | &'while' while_stmt
         | match_stmt

     # SIMPLE STATEMENTS
     # =================

     # NOTE: annotated_rhs may start with 'yield'; yield_expr must start with 'yield'
     assignment[stmt_ty]:
         | a=NAME ':' b=expression c=['=' d=annotated_rhs { d }] {
             CHECK_VERSION(
                 stmt_ty,
                 6,
                 "Variable annotation syntax is",
                 _PyAST_AnnAssign(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, Store)), b, c, 1, EXTRA)
             ) }
         | a=('(' b=single_target ')' { b }
              | single_subscript_attribute_target) ':' b=expression c=['=' d=annotated_rhs { d }] {
             CHECK_VERSION(stmt_ty, 6, "Variable annotations syntax is", _PyAST_AnnAssign(a, b, c, 0, EXTRA)) }
         | a[asdl_expr_seq*]=(z=star_targets '=' { z })+ b=annotated_rhs !'=' tc=[TYPE_COMMENT] {
              _PyAST_Assign(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
         | a=single_target b=augassign ~ c=annotated_rhs {
              _PyAST_AugAssign(a, b->kind, c, EXTRA) }
         | invalid_assignment

     annotated_rhs[expr_ty]: yield_expr | star_expressions

     augassign[AugOperator*]:
         | '+=' { _PyPegen_augoperator(p, Add) }
         | '-=' { _PyPegen_augoperator(p, Sub) }
         | '*=' { _PyPegen_augoperator(p, Mult) }
         | '@=' { CHECK_VERSION(AugOperator*, 5, "The '@' operator is", _PyPegen_augoperator(p, MatMult)) }
         | '/=' { _PyPegen_augoperator(p, Div) }
         | '%=' { _PyPegen_augoperator(p, Mod) }
         | '&=' { _PyPegen_augoperator(p, BitAnd) }
         | '|=' { _PyPegen_augoperator(p, BitOr) }
         | '^=' { _PyPegen_augoperator(p, BitXor) }
         | '<<=' { _PyPegen_augoperator(p, LShift) }
         | '>>=' { _PyPegen_augoperator(p, RShift) }
         | '**=' { _PyPegen_augoperator(p, Pow) }
         | '//=' { _PyPegen_augoperator(p, FloorDiv) }

     return_stmt[stmt_ty]:
         | 'return' a=[star_expressions] { _PyAST_Return(a, EXTRA) }

     raise_stmt[stmt_ty]:
         | 'raise' a=expression b=['from' z=expression { z }] { _PyAST_Raise(a, b, EXTRA) }
         | 'raise' { _PyAST_Raise(NULL, NULL, EXTRA) }

     pass_stmt[stmt_ty]:
         | 'pass' { _PyAST_Pass(EXTRA) }

     break_stmt[stmt_ty]:
         | 'break' { _PyAST_Break(EXTRA) }

     continue_stmt[stmt_ty]:
         | 'continue' { _PyAST_Continue(EXTRA) }

     global_stmt[stmt_ty]: 'global' a[asdl_expr_seq*]=','.NAME+ {
         _PyAST_Global(CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p, a)), EXTRA) }

     nonlocal_stmt[stmt_ty]: 'nonlocal' a[asdl_expr_seq*]=','.NAME+ {
         _PyAST_Nonlocal(CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p, a)), EXTRA) }

     del_stmt[stmt_ty]:
         | 'del' a=del_targets &(';' | NEWLINE) { _PyAST_Delete(a, EXTRA) }
         | invalid_del_stmt

     yield_stmt[stmt_ty]: y=yield_expr { _PyAST_Expr(y, EXTRA) }

     assert_stmt[stmt_ty]: 'assert' a=expression b=[',' z=expression { z }] { _PyAST_Assert(a, b, EXTRA) }

     import_stmt[stmt_ty]:
         | invalid_import
         | import_name
         | import_from

     # Import statements
     # -----------------

     import_name[stmt_ty]: 'import' a=dotted_as_names { _PyAST_Import(a, EXTRA) }
     # note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS
     import_from[stmt_ty]:
         | 'from' a=('.' | '...')* b=dotted_name 'import' c=import_from_targets {
             _PyPegen_checked_future_import(p, b->v.Name.id, c, _PyPegen_seq_count_dots(a), EXTRA) }
         | 'from' a=('.' | '...')+ 'import' b=import_from_targets {
             _PyAST_ImportFrom(NULL, b, _PyPegen_seq_count_dots(a), EXTRA) }
     import_from_targets[asdl_alias_seq*]:
         | '(' a=import_from_as_names [','] ')' { a }
         | import_from_as_names !','
         | '*' { (asdl_alias_seq*)_PyPegen_singleton_seq(p, CHECK(alias_ty, _PyPegen_alias_for_star(p, EXTRA))) }
         | invalid_import_from_targets
     import_from_as_names[asdl_alias_seq*]:
         | a[asdl_alias_seq*]=','.import_from_as_name+ { a }
     import_from_as_name[alias_ty]:
         | invalid_import_from_as_name
         | a=NAME b=['as' z=NAME { z }] { _PyAST_alias(
             a->v.Name.id, (b) ? ((expr_ty) b)->v.Name.id : NULL, EXTRA) }

     dotted_as_names[asdl_alias_seq*]:
         | a[asdl_alias_seq*]=','.dotted_as_name+ { a }
     dotted_as_name[alias_ty]:
         | invalid_dotted_as_name
         | a=dotted_name b=['as' z=NAME { z }] { _PyAST_alias(
             a->v.Name.id, (b) ? ((expr_ty) b)->v.Name.id : NULL, EXTRA) }

     dotted_name[expr_ty]:
         | a=dotted_name '.' b=NAME { _PyPegen_join_names_with_dot(p, a, b) }
         | NAME

     # COMPOUND STATEMENTS
     # ===================

     # Common elements
     # ---------------

     block[asdl_stmt_seq*] (memo):
         | NEWLINE INDENT a=statements DEDENT { a }
         | simple_stmts
         | invalid_block

     decorators[asdl_expr_seq*]: a[asdl_expr_seq*]=('@' f=named_expression NEWLINE { f })+ { a }

     # Class definitions
     # -----------------

     class_def[stmt_ty]:
         | a=decorators b=class_def_raw { _PyPegen_class_def_decorators(p, a, b) }
         | class_def_raw

     class_def_raw[stmt_ty]:
         | invalid_class_def_raw
         | 'class' a=NAME t=[type_params] b=['(' z=[arguments] ')' { z }] ':' c=block {
             _PyAST_ClassDef(a->v.Name.id,
                          (b) ? ((expr_ty) b)->v.Call.args : NULL,
                          (b) ? ((expr_ty) b)->v.Call.keywords : NULL,
                          c, NULL, t, EXTRA) }

     # Function definitions
     # --------------------

     function_def[stmt_ty]:
         | d=decorators f=function_def_raw { _PyPegen_function_def_decorators(p, d, f) }
         | function_def_raw

     function_def_raw[stmt_ty]:
         | invalid_def_raw
         | 'def' n=NAME t=[type_params] '(' params=[params] ')' a=['->' z=expression { z }] ':' tc=[func_type_comment] b=block {
             _PyAST_FunctionDef(n->v.Name.id,
                             (params) ? params : CHECK(arguments_ty, _PyPegen_empty_arguments(p)),
                             b, NULL, a, NEW_TYPE_COMMENT(p, tc), t, EXTRA) }
         | 'async' 'def' n=NAME t=[type_params] '(' params=[params] ')' a=['->' z=expression { z }] ':' tc=[func_type_comment] b=block {
             CHECK_VERSION(
                 stmt_ty,
                 5,
                 "Async functions are",
                 _PyAST_AsyncFunctionDef(n->v.Name.id,
                                 (params) ? params : CHECK(arguments_ty, _PyPegen_empty_arguments(p)),
                                 b, NULL, a, NEW_TYPE_COMMENT(p, tc), t, EXTRA)
             ) }

     # Function parameters
     # -------------------

     params[arguments_ty]:
         | invalid_parameters
         | parameters

     parameters[arguments_ty]:
         | a=slash_no_default b[asdl_arg_seq*]=param_no_default* c=param_with_default* d=[star_etc] {
             CHECK_VERSION(arguments_ty, 8, "Positional-only parameters are", _PyPegen_make_arguments(p, a, NULL, b, c, d)) }
         | a=slash_with_default b=param_with_default* c=[star_etc] {
             CHECK_VERSION(arguments_ty, 8, "Positional-only parameters are", _PyPegen_make_arguments(p, NULL, a, NULL, b, c)) }
         | a[asdl_arg_seq*]=param_no_default+ b=param_with_default* c=[star_etc] {
             _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }
         | a=param_with_default+ b=[star_etc] { _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)}
         | a=star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, a) }

     # Some duplication here because we can't write (',' | &')'),
     # which is because we don't support empty alternatives (yet).

     slash_no_default[asdl_arg_seq*]:
         | a[asdl_arg_seq*]=param_no_default+ '/' ',' { a }
         | a[asdl_arg_seq*]=param_no_default+ '/' &')' { a }
     slash_with_default[SlashWithDefault*]:
         | a=param_no_default* b=param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
         | a=param_no_default* b=param_with_default+ '/' &')' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }

     star_etc[StarEtc*]:
         | invalid_star_etc
         | '*' a=param_no_default b=param_maybe_default* c=[kwds] {
             _PyPegen_star_etc(p, a, b, c) }
         | '*' a=param_no_default_star_annotation b=param_maybe_default* c=[kwds] {
             _PyPegen_star_etc(p, a, b, c) }
         | '*' ',' b=param_maybe_default+ c=[kwds] {
             _PyPegen_star_etc(p, NULL, b, c) }
         | a=kwds { _PyPegen_star_etc(p, NULL, NULL, a) }

     kwds[arg_ty]:
         | invalid_kwds
         | '**' a=param_no_default { a }

     # One parameter.  This *includes* a following comma and type comment.
     #
     # There are three styles:
     # - No default
     # - With default
     # - Maybe with default
     #
     # There are two alternative forms of each, to deal with type comments:
     # - Ends in a comma followed by an optional type comment
     # - No comma, optional type comment, must be followed by close paren
     # The latter form is for a final parameter without trailing comma.
     #

     param_no_default[arg_ty]:
         | a=param ',' tc=TYPE_COMMENT? { _PyPegen_add_type_comment_to_arg(p, a, tc) }
         | a=param tc=TYPE_COMMENT? &')' { _PyPegen_add_type_comment_to_arg(p, a, tc) }
     param_no_default_star_annotation[arg_ty]:
         | a=param_star_annotation ',' tc=TYPE_COMMENT? { _PyPegen_add_type_comment_to_arg(p, a, tc) }
         | a=param_star_annotation tc=TYPE_COMMENT? &')' { _PyPegen_add_type_comment_to_arg(p, a, tc) }
     param_with_default[NameDefaultPair*]:
         | a=param c=default ',' tc=TYPE_COMMENT? { _PyPegen_name_default_pair(p, a, c, tc) }
         | a=param c=default tc=TYPE_COMMENT? &')' { _PyPegen_name_default_pair(p, a, c, tc) }
     param_maybe_default[NameDefaultPair*]:
         | a=param c=default? ',' tc=TYPE_COMMENT? { _PyPegen_name_default_pair(p, a, c, tc) }
         | a=param c=default? tc=TYPE_COMMENT? &')' { _PyPegen_name_default_pair(p, a, c, tc) }
     param[arg_ty]: a=NAME b=annotation? { _PyAST_arg(a->v.Name.id, b, NULL, EXTRA) }
     param_star_annotation[arg_ty]: a=NAME b=star_annotation { _PyAST_arg(a->v.Name.id, b, NULL, EXTRA) }
     annotation[expr_ty]: ':' a=expression { a }
     star_annotation[expr_ty]: ':' a=star_expression { a }
     default[expr_ty]: '=' a=expression { a } | invalid_default

     # If statement
     # ------------

     if_stmt[stmt_ty]:
         | invalid_if_stmt
         | 'if' a=named_expression ':' b=block c=elif_stmt {
             _PyAST_If(a, b, CHECK(asdl_stmt_seq*, _PyPegen_singleton_seq(p, c)), EXTRA) }
         | 'if' a=named_expression ':' b=block c=[else_block] { _PyAST_If(a, b, c, EXTRA) }
     elif_stmt[stmt_ty]:
         | invalid_elif_stmt
         | 'elif' a=named_expression ':' b=block c=elif_stmt {
             _PyAST_If(a, b, CHECK(asdl_stmt_seq*, _PyPegen_singleton_seq(p, c)), EXTRA) }
         | 'elif' a=named_expression ':' b=block c=[else_block] { _PyAST_If(a, b, c, EXTRA) }
     else_block[asdl_stmt_seq*]:
         | invalid_else_stmt
         | 'else' &&':' b=block { b }

     # While statement
     # ---------------

     while_stmt[stmt_ty]:
         | invalid_while_stmt
         | 'while' a=named_expression ':' b=block c=[else_block] { _PyAST_While(a, b, c, EXTRA) }

     # For statement
     # -------------

     for_stmt[stmt_ty]:
         | invalid_for_stmt
         | 'for' t=star_targets 'in' ~ ex=star_expressions ':' tc=[TYPE_COMMENT] b=block el=[else_block] {
             _PyAST_For(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA) }
         | 'async' 'for' t=star_targets 'in' ~ ex=star_expressions ':' tc=[TYPE_COMMENT] b=block el=[else_block] {
             CHECK_VERSION(stmt_ty, 5, "Async for loops are", _PyAST_AsyncFor(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA)) }
         | invalid_for_target

     # With statement
     # --------------

     with_stmt[stmt_ty]:
         | invalid_with_stmt_indent
         | 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' tc=[TYPE_COMMENT] b=block {
            _PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
         | 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
             _PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
         | 'async' 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' b=block {
            CHECK_VERSION(stmt_ty, 5, "Async with statements are", _PyAST_AsyncWith(a, b, NULL, EXTRA)) }
         | 'async' 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
            CHECK_VERSION(stmt_ty, 5, "Async with statements are", _PyAST_AsyncWith(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA)) }
         | invalid_with_stmt

     with_item[withitem_ty]:
         | e=expression 'as' t=star_target &(',' | ')' | ':') { _PyAST_withitem(e, t, p->arena) }
         | invalid_with_item
         | e=expression { _PyAST_withitem(e, NULL, p->arena) }

     # Try statement
     # -------------

     try_stmt[stmt_ty]:
         | invalid_try_stmt
         | 'try' &&':' b=block f=finally_block { _PyAST_Try(b, NULL, NULL, f, EXTRA) }
         | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_block+ el=[else_block] f=[finally_block] { _PyAST_Try(b, ex, el, f, EXTRA) }
         | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_star_block+ el=[else_block] f=[finally_block] {
             CHECK_VERSION(stmt_ty, 11, "Exception groups are",
                           _PyAST_TryStar(b, ex, el, f, EXTRA)) }


     # Except statement
     # ----------------

     except_block[excepthandler_ty]:
         | invalid_except_stmt_indent
         | 'except' e=expression ':' b=block {
             _PyAST_ExceptHandler(e, NULL, b, EXTRA) }
         | 'except' e=expression 'as' t=NAME ':' b=block {
             _PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }
         | 'except' e=expressions ':' b=block {
             CHECK_VERSION(
                 excepthandler_ty,
                 14,
                 "except expressions without parentheses are",
                 _PyAST_ExceptHandler(e, NULL, b, EXTRA)) }
         | 'except' ':' b=block { _PyAST_ExceptHandler(NULL, NULL, b, EXTRA) }
         | invalid_except_stmt
     except_star_block[excepthandler_ty]:
         | invalid_except_star_stmt_indent
         | 'except' '*' e=expression ':' b=block {
             _PyAST_ExceptHandler(e, NULL, b, EXTRA) }
         | 'except' '*' e=expression 'as' t=NAME ':' b=block {
             _PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }
         | 'except' '*' e=expressions ':' b=block {
             CHECK_VERSION(
                 excepthandler_ty,
                 14,
                 "except expressions without parentheses are",
                 _PyAST_ExceptHandler(e,  NULL, b, EXTRA)) }
         | invalid_except_star_stmt
     finally_block[asdl_stmt_seq*]:
         | invalid_finally_stmt
         | 'finally' &&':' a=block { a }

     # Match statement
     # ---------------

     match_stmt[stmt_ty]:
         | "match" subject=subject_expr ':' NEWLINE INDENT cases[asdl_match_case_seq*]=case_block+ DEDENT {
             CHECK_VERSION(stmt_ty, 10, "Pattern matching is", _PyAST_Match(subject, cases, EXTRA)) }
         | invalid_match_stmt

     subject_expr[expr_ty]:
         | value=star_named_expression ',' values=star_named_expressions? {
             _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, value, values)), Load, EXTRA) }
         | named_expression

     case_block[match_case_ty]:
         | invalid_case_block
         | "case" pattern=patterns guard=guard? ':' body=block {
             _PyAST_match_case(pattern, guard, body, p->arena) }

     guard[expr_ty]: 'if' guard=named_expression { guard }

     patterns[pattern_ty]:
         | patterns[asdl_pattern_seq*]=open_sequence_pattern {
             _PyAST_MatchSequence(patterns, EXTRA) }
         | pattern

     pattern[pattern_ty]:
         | as_pattern
         | or_pattern

     as_pattern[pattern_ty]:
         | pattern=or_pattern 'as' target=pattern_capture_target {
             _PyAST_MatchAs(pattern, target->v.Name.id, EXTRA) }
         | invalid_as_pattern

     or_pattern[pattern_ty]:
         | patterns[asdl_pattern_seq*]='|'.closed_pattern+ {
             asdl_seq_LEN(patterns) == 1 ? asdl_seq_GET(patterns, 0) : _PyAST_MatchOr(patterns, EXTRA) }

     closed_pattern[pattern_ty] (memo):
         | literal_pattern
         | capture_pattern
         | wildcard_pattern
         | value_pattern
         | group_pattern
         | sequence_pattern
         | mapping_pattern
         | class_pattern

     # Literal patterns are used for equality and identity constraints
     literal_pattern[pattern_ty]:
         | value=signed_number !('+' | '-') { _PyAST_MatchValue(value, EXTRA) }
         | value=complex_number { _PyAST_MatchValue(value, EXTRA) }
         | value=strings { _PyAST_MatchValue(value, EXTRA) }
         | 'None' { _PyAST_MatchSingleton(Py_None, EXTRA) }
         | 'True' { _PyAST_MatchSingleton(Py_True, EXTRA) }
         | 'False' { _PyAST_MatchSingleton(Py_False, EXTRA) }

     # Literal expressions are used to restrict permitted mapping pattern keys
     literal_expr[expr_ty]:
         | signed_number !('+' | '-')
         | complex_number
         | &(STRING|FSTRING_START|TSTRING_START) strings
         | 'None' { _PyAST_Constant(Py_None, NULL, EXTRA) }
         | 'True' { _PyAST_Constant(Py_True, NULL, EXTRA) }
         | 'False' { _PyAST_Constant(Py_False, NULL, EXTRA) }

     complex_number[expr_ty]:
         | real=signed_real_number '+' imag=imaginary_number {
             _PyAST_BinOp(real, Add, imag, EXTRA) }
         | real=signed_real_number '-' imag=imaginary_number  {
             _PyAST_BinOp(real, Sub, imag, EXTRA) }

     signed_number[expr_ty]:
         | NUMBER
         | '-' number=NUMBER { _PyAST_UnaryOp(USub, number, EXTRA) }

     signed_real_number[expr_ty]:
         | real_number
         | '-' real=real_number { _PyAST_UnaryOp(USub, real, EXTRA) }

     real_number[expr_ty]:
         | real=NUMBER { _PyPegen_ensure_real(p, real) }

     imaginary_number[expr_ty]:
         | imag=NUMBER { _PyPegen_ensure_imaginary(p, imag) }

     capture_pattern[pattern_ty]:
         | target=pattern_capture_target { _PyAST_MatchAs(NULL, target->v.Name.id, EXTRA) }

     pattern_capture_target[expr_ty]:
         | !"_" name=NAME !('.' | '(' | '=') {
             _PyPegen_set_expr_context(p, name, Store) }

     wildcard_pattern[pattern_ty]:
         | "_" { _PyAST_MatchAs(NULL, NULL, EXTRA) }

     value_pattern[pattern_ty]:
         | attr=attr !('.' | '(' | '=') { _PyAST_MatchValue(attr, EXTRA) }

     attr[expr_ty]:
         | value=name_or_attr '.' attr=NAME {
             _PyAST_Attribute(value, attr->v.Name.id, Load, EXTRA) }

     name_or_attr[expr_ty]:
         | attr
         | NAME

     group_pattern[pattern_ty]:
         | '(' pattern=pattern ')' { pattern }

     sequence_pattern[pattern_ty]:
         | '[' patterns=maybe_sequence_pattern? ']' { _PyAST_MatchSequence(patterns, EXTRA) }
         | '(' patterns=open_sequence_pattern? ')' { _PyAST_MatchSequence(patterns, EXTRA) }

     open_sequence_pattern[asdl_seq*]:
         | pattern=maybe_star_pattern ',' patterns=maybe_sequence_pattern? {
             _PyPegen_seq_insert_in_front(p, pattern, patterns) }

     maybe_sequence_pattern[asdl_seq*]:
         | patterns=','.maybe_star_pattern+ ','? { patterns }

     maybe_star_pattern[pattern_ty]:
         | star_pattern
         | pattern

     star_pattern[pattern_ty] (memo):
         | '*' target=pattern_capture_target {
             _PyAST_MatchStar(target->v.Name.id, EXTRA) }
         | '*' wildcard_pattern {
             _PyAST_MatchStar(NULL, EXTRA) }

     mapping_pattern[pattern_ty]:
         | '{' '}' {
             _PyAST_MatchMapping(NULL, NULL, NULL, EXTRA) }
         | '{' rest=double_star_pattern ','? '}' {
             _PyAST_MatchMapping(NULL, NULL, rest->v.Name.id, EXTRA) }
         | '{' items=items_pattern ',' rest=double_star_pattern ','? '}' {
             _PyAST_MatchMapping(
                 CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, items)),
                 CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, items)),
                 rest->v.Name.id,
                 EXTRA) }
         | '{' items=items_pattern ','? '}' {
             _PyAST_MatchMapping(
                 CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, items)),
                 CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, items)),
                 NULL,
                 EXTRA) }

     items_pattern[asdl_seq*]:
         | ','.key_value_pattern+

     key_value_pattern[KeyPatternPair*]:
         | key=(literal_expr | attr) ':' pattern=pattern {
             _PyPegen_key_pattern_pair(p, key, pattern) }

     double_star_pattern[expr_ty]:
         | '**' target=pattern_capture_target { target }

     class_pattern[pattern_ty]:
         | cls=name_or_attr '(' ')' {
             _PyAST_MatchClass(cls, NULL, NULL, NULL, EXTRA) }
         | cls=name_or_attr '(' patterns=positional_patterns ','? ')' {
             _PyAST_MatchClass(cls, patterns, NULL, NULL, EXTRA) }
         | cls=name_or_attr '(' keywords=keyword_patterns ','? ')' {
             _PyAST_MatchClass(
                 cls, NULL,
                 CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p,
                     CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, keywords)))),
                 CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, keywords)),
                 EXTRA) }
         | cls=name_or_attr '(' patterns=positional_patterns ',' keywords=keyword_patterns ','? ')' {
             _PyAST_MatchClass(
                 cls,
                 patterns,
                 CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p,
                     CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, keywords)))),
                 CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, keywords)),
                 EXTRA) }
         | invalid_class_pattern

     positional_patterns[asdl_pattern_seq*]:
         | args[asdl_pattern_seq*]=','.pattern+ { args }

     keyword_patterns[asdl_seq*]:
         | ','.keyword_pattern+

     keyword_pattern[KeyPatternPair*]:
         | arg=NAME '=' value=pattern { _PyPegen_key_pattern_pair(p, arg, value) }

     # Type statement
     # ---------------

     type_alias[stmt_ty]:
         | "type" n=NAME t=[type_params] '=' b=expression {
             CHECK_VERSION(stmt_ty, 12, "Type statement is",
             _PyAST_TypeAlias(CHECK(expr_ty, _PyPegen_set_expr_context(p, n, Store)), t, b, EXTRA)) }

     # Type parameter declaration
     # --------------------------

     type_params[asdl_type_param_seq*]:
         | invalid_type_params
         | '[' t=type_param_seq ']' {
             CHECK_VERSION(asdl_type_param_seq *, 12, "Type parameter lists are", t) }

     type_param_seq[asdl_type_param_seq*]: a[asdl_type_param_seq*]=','.type_param+ [','] { a }

     type_param[type_param_ty] (memo):
         | a=NAME b=[type_param_bound] c=[type_param_default] { _PyAST_TypeVar(a->v.Name.id, b, c, EXTRA) }
         | invalid_type_param
         | '*' a=NAME b=[type_param_starred_default] { _PyAST_TypeVarTuple(a->v.Name.id, b, EXTRA) }
         | '**' a=NAME b=[type_param_default] { _PyAST_ParamSpec(a->v.Name.id, b, EXTRA) }

     type_param_bound[expr_ty]: ':' e=expression { e }
     type_param_default[expr_ty]: '=' e=expression {
         CHECK_VERSION(expr_ty, 13, "Type parameter defaults are", e) }
     type_param_starred_default[expr_ty]: '=' e=star_expression {
         CHECK_VERSION(expr_ty, 13, "Type parameter defaults are", e) }

     # EXPRESSIONS
     # -----------

     expressions[expr_ty]:
         | a=expression b=(',' c=expression { c })+ [','] {
             _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)), Load, EXTRA) }
         | a=expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_singleton_seq(p, a)), Load, EXTRA) }
         | expression

     expression[expr_ty] (memo):
         | invalid_expression
         | invalid_legacy_expression
         | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, a, c, EXTRA) }
         | disjunction
         | lambdef

     yield_expr[expr_ty]:
         | 'yield' 'from' a=expression { _PyAST_YieldFrom(a, EXTRA) }
         | 'yield' a=[star_expressions] { _PyAST_Yield(a, EXTRA) }

     star_expressions[expr_ty]:
         | a=star_expression b=(',' c=star_expression { c })+ [','] {
             _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)), Load, EXTRA) }
         | a=star_expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_singleton_seq(p, a)), Load, EXTRA) }
         | star_expression

     star_expression[expr_ty] (memo):
         | '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }
         | expression

     star_named_expressions[asdl_expr_seq*]: a[asdl_expr_seq*]=','.star_named_expression+ [','] { a }

     star_named_expression[expr_ty]:
         | '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }
         | named_expression

     assignment_expression[expr_ty]:
         | a=NAME ':=' ~ b=expression {
             CHECK_VERSION(expr_ty, 8, "Assignment expressions are",
             _PyAST_NamedExpr(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, Store)), b, EXTRA)) }

     named_expression[expr_ty]:
         | assignment_expression
         | invalid_named_expression
         | expression !':='

     disjunction[expr_ty] (memo):
         | a=conjunction b=('or' c=conjunction { c })+ { _PyAST_BoolOp(
             Or,
             CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)),
             EXTRA) }
         | conjunction

     conjunction[expr_ty] (memo):
         | a=inversion b=('and' c=inversion { c })+ { _PyAST_BoolOp(
             And,
             CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)),
             EXTRA) }
         | inversion

     inversion[expr_ty] (memo):
         | 'not' a=inversion { _PyAST_UnaryOp(Not, a, EXTRA) }
         | comparison

     # Comparison operators
     # --------------------

     comparison[expr_ty]:
         | a=bitwise_or b=compare_op_bitwise_or_pair+ {
             _PyAST_Compare(
                 a,
                 CHECK(asdl_int_seq*, _PyPegen_get_cmpops(p, b)),
                 CHECK(asdl_expr_seq*, _PyPegen_get_exprs(p, b)),
                 EXTRA) }
         | bitwise_or

     compare_op_bitwise_or_pair[CmpopExprPair*]:
         | eq_bitwise_or
         | noteq_bitwise_or
         | lte_bitwise_or
         | lt_bitwise_or
         | gte_bitwise_or
         | gt_bitwise_or
         | notin_bitwise_or
         | in_bitwise_or
         | isnot_bitwise_or
         | is_bitwise_or

     eq_bitwise_or[CmpopExprPair*]: '==' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, Eq, a) }
     noteq_bitwise_or[CmpopExprPair*]:
         | (tok='!=' { _PyPegen_check_barry_as_flufl(p, tok) ? NULL : tok}) a=bitwise_or {_PyPegen_cmpop_expr_pair(p, NotEq, a) }
     lte_bitwise_or[CmpopExprPair*]: '<=' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, LtE, a) }
     lt_bitwise_or[CmpopExprPair*]: '<' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, Lt, a) }
     gte_bitwise_or[CmpopExprPair*]: '>=' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, GtE, a) }
     gt_bitwise_or[CmpopExprPair*]: '>' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, Gt, a) }
     notin_bitwise_or[CmpopExprPair*]: 'not' 'in' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, NotIn, a) }
     in_bitwise_or[CmpopExprPair*]: 'in' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, In, a) }
     isnot_bitwise_or[CmpopExprPair*]: 'is' 'not' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, IsNot, a) }
     is_bitwise_or[CmpopExprPair*]: 'is' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, Is, a) }

     # Bitwise operators
     # -----------------

     bitwise_or[expr_ty]:
         | a=bitwise_or '|' b=bitwise_xor { _PyAST_BinOp(a, BitOr, b, EXTRA) }
         | bitwise_xor

     bitwise_xor[expr_ty]:
         | a=bitwise_xor '^' b=bitwise_and { _PyAST_BinOp(a, BitXor, b, EXTRA) }
         | bitwise_and

     bitwise_and[expr_ty]:
         | a=bitwise_and '&' b=shift_expr { _PyAST_BinOp(a, BitAnd, b, EXTRA) }
         | shift_expr

     shift_expr[expr_ty]:
         | a=shift_expr '<<' b=sum { _PyAST_BinOp(a, LShift, b, EXTRA) }
         | a=shift_expr '>>' b=sum { _PyAST_BinOp(a, RShift, b, EXTRA) }
         | invalid_arithmetic
         | sum

     # Arithmetic operators
     # --------------------

     sum[expr_ty]:
         | a=sum '+' b=term { _PyAST_BinOp(a, Add, b, EXTRA) }
         | a=sum '-' b=term { _PyAST_BinOp(a, Sub, b, EXTRA) }
         | term

     term[expr_ty]:
         | a=term '*' b=factor { _PyAST_BinOp(a, Mult, b, EXTRA) }
         | a=term '/' b=factor { _PyAST_BinOp(a, Div, b, EXTRA) }
         | a=term '//' b=factor { _PyAST_BinOp(a, FloorDiv, b, EXTRA) }
         | a=term '%' b=factor { _PyAST_BinOp(a, Mod, b, EXTRA) }
         | a=term '@' b=factor { CHECK_VERSION(expr_ty, 5, "The '@' operator is", _PyAST_BinOp(a, MatMult, b, EXTRA)) }
         | invalid_factor
         | factor

     factor[expr_ty] (memo):
         | '+' a=factor { _PyAST_UnaryOp(UAdd, a, EXTRA) }
         | '-' a=factor { _PyAST_UnaryOp(USub, a, EXTRA) }
         | '~' a=factor { _PyAST_UnaryOp(Invert, a, EXTRA) }
         | power

     power[expr_ty]:
         | a=await_primary '**' b=factor { _PyAST_BinOp(a, Pow, b, EXTRA) }
         | await_primary

     # Primary elements
     # ----------------

     # Primary elements are things like "obj.something.something", "obj[something]", "obj(something)", "obj" ...

     await_primary[expr_ty] (memo):
         | 'await' a=primary { CHECK_VERSION(expr_ty, 5, "Await expressions are", _PyAST_Await(a, EXTRA)) }
         | primary

     primary[expr_ty]:
         | a=primary '.' b=NAME { _PyAST_Attribute(a, b->v.Name.id, Load, EXTRA) }
         | a=primary b=genexp { _PyAST_Call(a, CHECK(asdl_expr_seq*, (asdl_expr_seq*)_PyPegen_singleton_seq(p, b)), NULL, EXTRA) }
         | a=primary '(' b=[arguments] ')' {
             _PyAST_Call(a,
                      (b) ? ((expr_ty) b)->v.Call.args : NULL,
                      (b) ? ((expr_ty) b)->v.Call.keywords : NULL,
                      EXTRA) }
         | a=primary '[' b=slices ']' { _PyAST_Subscript(a, b, Load, EXTRA) }
         | atom

     slices[expr_ty]:
         | a=slice !',' { a }
         | a[asdl_expr_seq*]=','.(slice | starred_expression)+ [','] { _PyAST_Tuple(a, Load, EXTRA) }

     slice[expr_ty]:
         | a=[expression] ':' b=[expression] c=[':' d=[expression] { d }] { _PyAST_Slice(a, b, c, EXTRA) }
         | a=named_expression { a }

     atom[expr_ty]:
         | NAME
         | 'True' { _PyAST_Constant(Py_True, NULL, EXTRA) }
         | 'False' { _PyAST_Constant(Py_False, NULL, EXTRA) }
         | 'None' { _PyAST_Constant(Py_None, NULL, EXTRA) }
         | &(STRING|FSTRING_START|TSTRING_START) strings
         | NUMBER
         | &'(' (tuple | group | genexp)
         | &'[' (list | listcomp)
         | &'{' (dict | set | dictcomp | setcomp)
         | '...' { _PyAST_Constant(Py_Ellipsis, NULL, EXTRA) }

     group[expr_ty]:
         | '(' a=(yield_expr | named_expression) ')' { a }
         | invalid_group

     # Lambda functions
     # ----------------

     lambdef[expr_ty]:
         | 'lambda' a=[lambda_params] ':' b=expression {
             _PyAST_Lambda((a) ? a : CHECK(arguments_ty, _PyPegen_empty_arguments(p)), b, EXTRA) }

     lambda_params[arguments_ty]:
         | invalid_lambda_parameters
         | lambda_parameters

     # lambda_parameters etc. duplicates parameters but without annotations
     # or type comments, and if there's no comma after a parameter, we expect
     # a colon, not a close parenthesis.  (For more, see parameters above.)
     #
     lambda_parameters[arguments_ty]:
         | a=lambda_slash_no_default b[asdl_arg_seq*]=lambda_param_no_default* c=lambda_param_with_default* d=[lambda_star_etc] {
             CHECK_VERSION(arguments_ty, 8, "Positional-only parameters are", _PyPegen_make_arguments(p, a, NULL, b, c, d)) }
         | a=lambda_slash_with_default b=lambda_param_with_default* c=[lambda_star_etc] {
             CHECK_VERSION(arguments_ty, 8, "Positional-only parameters are", _PyPegen_make_arguments(p, NULL, a, NULL, b, c)) }
         | a[asdl_arg_seq*]=lambda_param_no_default+ b=lambda_param_with_default* c=[lambda_star_etc] {
             _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }
         | a=lambda_param_with_default+ b=[lambda_star_etc] { _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)}
         | a=lambda_star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, a) }

     lambda_slash_no_default[asdl_arg_seq*]:
         | a[asdl_arg_seq*]=lambda_param_no_default+ '/' ',' { a }
         | a[asdl_arg_seq*]=lambda_param_no_default+ '/' &':' { a }

     lambda_slash_with_default[SlashWithDefault*]:
         | a=lambda_param_no_default* b=lambda_param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
         | a=lambda_param_no_default* b=lambda_param_with_default+ '/' &':' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }

     lambda_star_etc[StarEtc*]:
         | invalid_lambda_star_etc
         | '*' a=lambda_param_no_default b=lambda_param_maybe_default* c=[lambda_kwds] {
             _PyPegen_star_etc(p, a, b, c) }
         | '*' ',' b=lambda_param_maybe_default+ c=[lambda_kwds] {
             _PyPegen_star_etc(p, NULL, b, c) }
         | a=lambda_kwds { _PyPegen_star_etc(p, NULL, NULL, a) }

     lambda_kwds[arg_ty]:
         | invalid_lambda_kwds
         | '**' a=lambda_param_no_default { a }

     lambda_param_no_default[arg_ty]:
         | a=lambda_param ',' { a }
         | a=lambda_param &':' { a }
     lambda_param_with_default[NameDefaultPair*]:
         | a=lambda_param c=default ',' { _PyPegen_name_default_pair(p, a, c, NULL) }
         | a=lambda_param c=default &':' { _PyPegen_name_default_pair(p, a, c, NULL) }
     lambda_param_maybe_default[NameDefaultPair*]:
         | a=lambda_param c=default? ',' { _PyPegen_name_default_pair(p, a, c, NULL) }
         | a=lambda_param c=default? &':' { _PyPegen_name_default_pair(p, a, c, NULL) }
     lambda_param[arg_ty]: a=NAME { _PyAST_arg(a->v.Name.id, NULL, NULL, EXTRA) }

     # LITERALS
     # ========

     fstring_middle[expr_ty]:
         | fstring_replacement_field
         | t=FSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) }
     fstring_replacement_field[expr_ty]:
         | '{' a=annotated_rhs debug_expr='='? conversion=[fstring_conversion] format=[fstring_full_format_spec] rbrace='}' {
             _PyPegen_formatted_value(p, a, debug_expr, conversion, format, rbrace, EXTRA) }
         | invalid_fstring_replacement_field
     fstring_conversion[ResultTokenWithMetadata*]:
         | conv_token="!" conv=NAME { _PyPegen_check_fstring_conversion(p, conv_token, conv) }
     fstring_full_format_spec[ResultTokenWithMetadata*]:
         | colon=':' spec=fstring_format_spec* { _PyPegen_setup_full_format_spec(p, colon, (asdl_expr_seq *) spec, EXTRA) }
     fstring_format_spec[expr_ty]:
         | t=FSTRING_MIDDLE { _PyPegen_decoded_constant_from_token(p, t) }
         | fstring_replacement_field
     fstring[expr_ty]:
         | a=FSTRING_START b=fstring_middle* c=FSTRING_END { _PyPegen_joined_str(p, a, (asdl_expr_seq*)b, c) }

     tstring_format_spec_replacement_field[expr_ty]:
         | '{' a=annotated_rhs debug_expr='='? conversion=[fstring_conversion] format=[tstring_full_format_spec] rbrace='}' {
             _PyPegen_formatted_value(p, a, debug_expr, conversion, format, rbrace, EXTRA) }
         | invalid_tstring_replacement_field
     tstring_format_spec[expr_ty]:
         | t=TSTRING_MIDDLE { _PyPegen_decoded_constant_from_token(p, t) }
         | tstring_format_spec_replacement_field
     tstring_full_format_spec[ResultTokenWithMetadata*]:
         | colon=':' spec=tstring_format_spec* { _PyPegen_setup_full_format_spec(p, colon, (asdl_expr_seq *) spec, EXTRA) }
     tstring_replacement_field[expr_ty]:
         | '{' a=annotated_rhs debug_expr='='? conversion=[fstring_conversion] format=[tstring_full_format_spec] rbrace='}' {
             _PyPegen_interpolation(p, a, debug_expr, conversion, format, rbrace, EXTRA) }
         | invalid_tstring_replacement_field
     tstring_middle[expr_ty]:
         | tstring_replacement_field
         | t=TSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) }
     tstring[expr_ty] (memo):
         | a=TSTRING_START b=tstring_middle* c=TSTRING_END {
             CHECK_VERSION(
                 expr_ty,
                 14,
                 "t-strings are",
                 _PyPegen_template_str(p, a, (asdl_expr_seq*)b, c)) }

     string[expr_ty]: s[Token*]=STRING { _PyPegen_constant_from_string(p, s) }
     strings[expr_ty] (memo):
         | invalid_string_tstring_concat
         | a[asdl_expr_seq*]=(fstring|string)+ { _PyPegen_concatenate_strings(p, a, EXTRA) }
         | a[asdl_expr_seq*]=tstring+ { _PyPegen_concatenate_tstrings(p, a, EXTRA) }

     list[expr_ty]:
         | '[' a=[star_named_expressions] ']' { _PyAST_List(a, Load, EXTRA) }

     tuple[expr_ty]:
         | '(' a=[y=star_named_expression ',' z=[star_named_expressions] { _PyPegen_seq_insert_in_front(p, y, z) } ] ')' {
             _PyAST_Tuple(a, Load, EXTRA) }

     set[expr_ty]: '{' a=star_named_expressions '}' { _PyAST_Set(a, EXTRA) }

     # Dicts
     # -----

     dict[expr_ty]:
         | '{' a=[double_starred_kvpairs] '}' {
             _PyAST_Dict(
                 CHECK(asdl_expr_seq*, _PyPegen_get_keys(p, a)),
                 CHECK(asdl_expr_seq*, _PyPegen_get_values(p, a)),
                 EXTRA) }
         | '{' invalid_double_starred_kvpairs '}'

     double_starred_kvpairs[asdl_seq*]: a=','.double_starred_kvpair+ [','] { a }

     double_starred_kvpair[KeyValuePair*]:
         | '**' a=bitwise_or { _PyPegen_key_value_pair(p, NULL, a) }
         | kvpair

     kvpair[KeyValuePair*]: a=expression ':' b=expression { _PyPegen_key_value_pair(p, a, b) }

     # Comprehensions & Generators
     # ---------------------------

     for_if_clauses[asdl_comprehension_seq*]:
         | a[asdl_comprehension_seq*]=for_if_clause+ { a }

     for_if_clause[comprehension_ty]:
         | 'async' 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' z=disjunction { z })* {
             CHECK_VERSION(comprehension_ty, 6, "Async comprehensions are", _PyAST_comprehension(a, b, c, 1, p->arena)) }
         | 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' z=disjunction { z })* {
             _PyAST_comprehension(a, b, c, 0, p->arena) }
         | invalid_for_if_clause
         | invalid_for_target

     listcomp[expr_ty]:
         | '[' a=named_expression b=for_if_clauses ']' { _PyAST_ListComp(a, b, EXTRA) }
         | invalid_comprehension

     setcomp[expr_ty]:
         | '{' a=named_expression b=for_if_clauses '}' { _PyAST_SetComp(a, b, EXTRA) }
         | invalid_comprehension

     genexp[expr_ty]:
         | '(' a=( assignment_expression | expression !':=') b=for_if_clauses ')' { _PyAST_GeneratorExp(a, b, EXTRA) }
         | invalid_comprehension

     dictcomp[expr_ty]:
         | '{' a=kvpair b=for_if_clauses '}' { _PyAST_DictComp(a->key, a->value, b, EXTRA) }
         | invalid_dict_comprehension

     # FUNCTION CALL ARGUMENTS
     # =======================

     arguments[expr_ty] (memo):
         | a=args [','] &')' { a }
         | invalid_arguments

     args[expr_ty]:
         | a[asdl_expr_seq*]=','.(starred_expression | ( assignment_expression | expression !':=') !'=')+ b=[',' k=kwargs {k}] {
             _PyPegen_collect_call_seqs(p, a, b, EXTRA) }
         | a=kwargs { _PyAST_Call(_PyPegen_dummy_name(p),
                               CHECK_NULL_ALLOWED(asdl_expr_seq*, _PyPegen_seq_extract_starred_exprs(p, a)),
                               CHECK_NULL_ALLOWED(asdl_keyword_seq*, _PyPegen_seq_delete_starred_exprs(p, a)),
                               EXTRA) }

     kwargs[asdl_seq*]:
         | a=','.kwarg_or_starred+ ',' b=','.kwarg_or_double_starred+ { _PyPegen_join_sequences(p, a, b) }
         | ','.kwarg_or_starred+
         | ','.kwarg_or_double_starred+

     starred_expression[expr_ty]:
         | invalid_starred_expression_unpacking
         | '*' a=expression { _PyAST_Starred(a, Load, EXTRA) }
         | invalid_starred_expression

     kwarg_or_starred[KeywordOrStarred*]:
         | invalid_kwarg
         | a=NAME '=' b=expression {
             _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v.Name.id, b, EXTRA)), 1) }
         | a=starred_expression { _PyPegen_keyword_or_starred(p, a, 0) }

     kwarg_or_double_starred[KeywordOrStarred*]:
         | invalid_kwarg
         | a=NAME '=' b=expression {
             _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v.Name.id, b, EXTRA)), 1) }
         | '**' a=expression { _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(NULL, a, EXTRA)), 1) }

     # ASSIGNMENT TARGETS
     # ==================

     # Generic targets
     # ---------------

     # NOTE: star_targets may contain *bitwise_or, targets may not.
     star_targets[expr_ty]:
         | a=star_target !',' { a }
         | a=star_target b=(',' c=star_target { c })* [','] {
             _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)), Store, EXTRA) }

     star_targets_list_seq[asdl_expr_seq*]: a[asdl_expr_seq*]=','.star_target+ [','] { a }

     star_targets_tuple_seq[asdl_expr_seq*]:
         | a=star_target b=(',' c=star_target { c })+ [','] { (asdl_expr_seq*) _PyPegen_seq_insert_in_front(p, a, b) }
         | a=star_target ',' { (asdl_expr_seq*) _PyPegen_singleton_seq(p, a) }

     star_target[expr_ty] (memo):
         | '*' a=(!'*' star_target) {
             _PyAST_Starred(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, Store)), Store, EXTRA) }
         | target_with_star_atom

     target_with_star_atom[expr_ty] (memo):
         | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, Store, EXTRA) }
         | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, Store, EXTRA) }
         | star_atom

     star_atom[expr_ty]:
         | a=NAME { _PyPegen_set_expr_context(p, a, Store) }
         | '(' a=target_with_star_atom ')' { _PyPegen_set_expr_context(p, a, Store) }
         | '(' a=[star_targets_tuple_seq] ')' { _PyAST_Tuple(a, Store, EXTRA) }
         | '[' a=[star_targets_list_seq] ']' { _PyAST_List(a, Store, EXTRA) }

     single_target[expr_ty]:
         | single_subscript_attribute_target
         | a=NAME { _PyPegen_set_expr_context(p, a, Store) }
         | '(' a=single_target ')' { a }

     single_subscript_attribute_target[expr_ty]:
         | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, Store, EXTRA) }
         | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, Store, EXTRA) }

     t_primary[expr_ty]:
         | a=t_primary '.' b=NAME &t_lookahead { _PyAST_Attribute(a, b->v.Name.id, Load, EXTRA) }
         | a=t_primary '[' b=slices ']' &t_lookahead { _PyAST_Subscript(a, b, Load, EXTRA) }
         | a=t_primary b=genexp &t_lookahead {
             _PyAST_Call(a, CHECK(asdl_expr_seq*, (asdl_expr_seq*)_PyPegen_singleton_seq(p, b)), NULL, EXTRA) }
         | a=t_primary '(' b=[arguments] ')' &t_lookahead {
             _PyAST_Call(a,
                      (b) ? ((expr_ty) b)->v.Call.args : NULL,
                      (b) ? ((expr_ty) b)->v.Call.keywords : NULL,
                      EXTRA) }
         | a=atom &t_lookahead { a }

     t_lookahead: '(' | '[' | '.'

     # Targets for del statements
     # --------------------------

     del_targets[asdl_expr_seq*]: a[asdl_expr_seq*]=','.del_target+ [','] { a }

     del_target[expr_ty] (memo):
         | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, Del, EXTRA) }
         | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, Del, EXTRA) }
         | del_t_atom

     del_t_atom[expr_ty]:
         | a=NAME { _PyPegen_set_expr_context(p, a, Del) }
         | '(' a=del_target ')' { _PyPegen_set_expr_context(p, a, Del) }
         | '(' a=[del_targets] ')' { _PyAST_Tuple(a, Del, EXTRA) }
         | '[' a=[del_targets] ']' { _PyAST_List(a, Del, EXTRA) }

     # TYPING ELEMENTS
     # ---------------

     # type_expressions allow */** but ignore them
     type_expressions[asdl_expr_seq*]:
         | a=','.expression+ ',' '*' b=expression ',' '**' c=expression {
             (asdl_expr_seq*)_PyPegen_seq_append_to_end(
                 p,
                 CHECK(asdl_seq*, _PyPegen_seq_append_to_end(p, a, b)),
                 c) }
         | a=','.expression+ ',' '*' b=expression { (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }
         | a=','.expression+ ',' '**' b=expression { (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }
         | '*' a=expression ',' '**' b=expression {
             (asdl_expr_seq*)_PyPegen_seq_append_to_end(
                 p,
                 CHECK(asdl_seq*, _PyPegen_singleton_seq(p, a)),
                 b) }
         | '*' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }
         | '**' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }
         | a[asdl_expr_seq*]=','.expression+ {a}

     func_type_comment[Token*]:
         | NEWLINE t=TYPE_COMMENT &(NEWLINE INDENT) { t }  # Must be followed by indented block
         | invalid_double_type_comments
         | TYPE_COMMENT

     # ========================= END OF THE GRAMMAR ===========================



     # ========================= START OF INVALID RULES =======================

     # From here on, there are rules for invalid syntax with specialised error messages
     invalid_arguments:
         | ((','.(starred_expression | ( assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) a=',' ','.(starred_expression !'=')+ {
             RAISE_SYNTAX_ERROR_STARTING_FROM(a, "iterable argument unpacking follows keyword argument unpacking") }
         | a=expression b=for_if_clauses ',' [args | expression for_if_clauses] {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, _PyPegen_get_last_comprehension_item(PyPegen_last_item(b, comprehension_ty)), "Generator expression must be parenthesized") }
         | a=NAME b='=' expression for_if_clauses {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "invalid syntax. Maybe you meant '==' or ':=' instead of '='?")}
         | (args ',')? a=NAME b='=' &(',' | ')') {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "expected argument value expression")}
         | a=args b=for_if_clauses { _PyPegen_nonparen_genexp_in_call(p, a, b) }
         | args ',' a=expression b=for_if_clauses {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, _PyPegen_get_last_comprehension_item(PyPegen_last_item(b, comprehension_ty)), "Generator expression must be parenthesized") }
         | a=args ',' args { _PyPegen_arguments_parsing_error(p, a) }
     invalid_kwarg:
         | a[Token*]=('True'|'False'|'None') b='=' {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "cannot assign to %s", PyBytes_AS_STRING(a->bytes)) }
         | a=NAME b='=' expression for_if_clauses {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "invalid syntax. Maybe you meant '==' or ':=' instead of '='?")}
         | !(NAME '=') a=expression b='=' {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(
                 a, b, "expression cannot contain assignment, perhaps you meant \"==\"?") }
         | a='**' expression '=' b=expression {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "cannot assign to keyword argument unpacking") }

     # IMPORTANT: Note that the "_without_invalid" suffix causes the rule to not call invalid rules under it
     expression_without_invalid[expr_ty]:
         | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, a, c, EXTRA) }
         | disjunction
         | lambdef
     invalid_legacy_expression:
         | a=NAME !'(' b=star_expressions {
             _PyPegen_check_legacy_stmt(p, a) ? RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b,
                 "Missing parentheses in call to '%U'. Did you mean %U(...)?", a->v.Name.id, a->v.Name.id) : NULL}

     invalid_type_param:
         | '*' a=NAME colon=':' e=expression {
                 RAISE_SYNTAX_ERROR_STARTING_FROM(colon, e->kind == Tuple_kind
                     ? "cannot use constraints with TypeVarTuple"
                     : "cannot use bound with TypeVarTuple")
             }
         | '**' a=NAME colon=':' e=expression {
                 RAISE_SYNTAX_ERROR_STARTING_FROM(colon, e->kind == Tuple_kind
                     ? "cannot use constraints with ParamSpec"
                     : "cannot use bound with ParamSpec")
             }

     invalid_expression:
        |  STRING a=(!STRING expression_without_invalid)+ STRING {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE( PyPegen_first_item(a, expr_ty), PyPegen_last_item(a, expr_ty),
             "invalid syntax. Is this intended to be part of the string?") }
         # !(NAME STRING) is not matched so we don't show this error with some invalid string prefixes like: kf"dsfsdf"
         # Soft keywords need to also be ignored because they can be parsed as NAME NAME
        | !(NAME STRING | SOFT_KEYWORD) a=disjunction b=expression_without_invalid {
             _PyPegen_check_legacy_stmt(p, a) ? NULL : p->tokens[p->mark-1]->level == 0 ? NULL :
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "invalid syntax. Perhaps you forgot a comma?") }
        | a=disjunction 'if' b=disjunction !('else'|':') { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "expected 'else' after 'if' expression") }
        | a=disjunction 'if' b=disjunction 'else' !expression {
             RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("expected expression after 'else', but statement is given") }
        | a[stmt_ty]=(pass_stmt|break_stmt|continue_stmt) 'if' b=disjunction 'else' c=simple_stmt {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION (a, "expected expression before 'if', but statement is given") }
        | a='lambda' [lambda_params] b=':' &FSTRING_MIDDLE  {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "f-string: lambda expressions are not allowed without parentheses") }
        | a='lambda' [lambda_params] b=':' &TSTRING_MIDDLE  {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "t-string: lambda expressions are not allowed without parentheses") }

     invalid_named_expression(memo):
         | a=expression ':=' expression {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
                 a, "cannot use assignment expressions with %s", _PyPegen_get_expr_name(a)) }
         | a=NAME '=' b=bitwise_or !('='|':=') {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "invalid syntax. Maybe you meant '==' or ':=' instead of '='?") }
         | !(list|tuple|genexp|'True'|'None'|'False') a=bitwise_or b='=' bitwise_or !('='|':=') {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot assign to %s here. Maybe you meant '==' instead of '='?",
                                               _PyPegen_get_expr_name(a)) }

     invalid_assignment:
         | a=invalid_ann_assign_target ':' expression {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
                 a,
                 "only single target (not %s) can be annotated",
                 _PyPegen_get_expr_name(a)
             )}
         | a=star_named_expression ',' star_named_expressions* ':' expression {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "only single target (not tuple) can be annotated") }
         | a=expression ':' expression {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "illegal target for annotation") }
         | (star_targets '=')* a=star_expressions '=' {
             RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }
         | (star_targets '=')* a=yield_expr '=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "assignment to yield expression not possible") }
         | a=star_expressions augassign annotated_rhs {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
                 a,
                 "'%s' is an illegal expression for augmented assignment",
                 _PyPegen_get_expr_name(a)
             )}
     invalid_ann_assign_target[expr_ty]:
         | list
         | tuple
         | '(' a=invalid_ann_assign_target ')' { a }
     invalid_del_stmt:
         | 'del' a=star_expressions {
             RAISE_SYNTAX_ERROR_INVALID_TARGET(DEL_TARGETS, a) }
     invalid_block:
         | NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block") }
     invalid_comprehension:
         | ('[' | '(' | '{') a=starred_expression for_if_clauses {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "iterable unpacking cannot be used in comprehension") }
         | ('[' | '{') a=star_named_expression ',' b=star_named_expressions for_if_clauses {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, PyPegen_last_item(b, expr_ty),
             "did you forget parentheses around the comprehension target?") }
         | ('[' | '{') a=star_named_expression b=',' for_if_clauses {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "did you forget parentheses around the comprehension target?") }
     invalid_dict_comprehension:
         | '{' a='**' bitwise_or for_if_clauses '}' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "dict unpacking cannot be used in dict comprehension") }
     invalid_parameters:
         | a="/" ',' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "at least one argument must precede /") }
         | (slash_no_default | slash_with_default) param_maybe_default* a='/' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "/ may appear only once") }
         | slash_no_default? param_no_default* invalid_parameters_helper a=param_no_default {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "parameter without a default follows parameter with a default") }
         | param_no_default* a='(' param_no_default+ ','? b=')' {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "Function parameters cannot be parenthesized") }
         | (slash_no_default | slash_with_default)? param_maybe_default* '*' (',' | param_no_default) param_maybe_default* a='/' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "/ must be ahead of *") }
         | param_maybe_default+ '/' a='*' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "expected comma between / and *") }
     invalid_default:
         | a='=' &(')'|',') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "expected default value expression") }
     invalid_star_etc:
         | a='*' (')' | ',' (')' | '**')) { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "named arguments must follow bare *") }
         | '*' ',' TYPE_COMMENT { RAISE_SYNTAX_ERROR("bare * has associated type comment") }
         | '*' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-positional argument cannot have default value") }
         | '*' (param_no_default | ',') param_maybe_default* a='*' (param_no_default | ',') {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "* argument may appear only once") }
     invalid_kwds:
         | '**' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-keyword argument cannot have default value") }
         | '**' param ',' a=param { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "arguments cannot follow var-keyword argument") }
         | '**' param ',' a[Token*]=('*'|'**'|'/') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "arguments cannot follow var-keyword argument") }
     invalid_parameters_helper: # This is only there to avoid type errors
         | a=slash_with_default { _PyPegen_singleton_seq(p, a) }
         | param_with_default+
     invalid_lambda_parameters:
         | a="/" ',' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "at least one argument must precede /") }
         | (lambda_slash_no_default | lambda_slash_with_default) lambda_param_maybe_default* a='/' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "/ may appear only once") }
         | lambda_slash_no_default? lambda_param_no_default* invalid_lambda_parameters_helper a=lambda_param_no_default {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "parameter without a default follows parameter with a default") }
         | lambda_param_no_default* a='(' ','.lambda_param+ ','? b=')' {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "Lambda expression parameters cannot be parenthesized") }
         | (lambda_slash_no_default | lambda_slash_with_default)? lambda_param_maybe_default* '*' (',' | lambda_param_no_default) lambda_param_maybe_default* a='/' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "/ must be ahead of *") }
         | lambda_param_maybe_default+ '/' a='*' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "expected comma between / and *") }
     invalid_lambda_parameters_helper:
         | a=lambda_slash_with_default { _PyPegen_singleton_seq(p, a) }
         | lambda_param_with_default+
     invalid_lambda_star_etc:
         | '*' (':' | ',' (':' | '**')) { RAISE_SYNTAX_ERROR("named arguments must follow bare *") }
         | '*' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-positional argument cannot have default value") }
         | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* a='*' (lambda_param_no_default | ',') {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "* argument may appear only once") }
     invalid_lambda_kwds:
         | '**' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-keyword argument cannot have default value") }
         | '**' lambda_param ',' a=lambda_param { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "arguments cannot follow var-keyword argument") }
         | '**' lambda_param ',' a[Token*]=('*'|'**'|'/') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "arguments cannot follow var-keyword argument") }
     invalid_double_type_comments:
         | TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT {
             RAISE_SYNTAX_ERROR("Cannot have two type comments on def") }
     invalid_with_item:
         | expression 'as' a=expression &(',' | ')' | ':') {
             RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }

     invalid_for_if_clause:
         | 'async'? 'for' (bitwise_or (',' bitwise_or)* [',']) !'in' {
             RAISE_SYNTAX_ERROR("'in' expected after for-loop variables") }

     invalid_for_target:
         | 'async'? 'for' a=star_expressions {
             RAISE_SYNTAX_ERROR_INVALID_TARGET(FOR_TARGETS, a) }

     invalid_group:
         | '(' a=starred_expression ')' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot use starred expression here") }
         | '(' a='**' expression ')' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot use double starred expression here") }
     invalid_import:
         | a='import' ','.dotted_name+ 'from' dotted_name {
             RAISE_SYNTAX_ERROR_STARTING_FROM(a, "Did you mean to use 'from ... import ...' instead?") }
         | 'import' token=NEWLINE {
             RAISE_SYNTAX_ERROR_STARTING_FROM(token, "Expected one or more names after 'import'") }
     invalid_dotted_as_name:
         | dotted_name 'as' !(NAME (',' | ')' | ';' | NEWLINE)) a=expression {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,
                 "cannot use %s as import target", _PyPegen_get_expr_name(a)) }
     invalid_import_from_as_name:
         | NAME 'as' !(NAME (',' | ')' | ';' | NEWLINE)) a=expression {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,
                 "cannot use %s as import target", _PyPegen_get_expr_name(a)) }

     invalid_import_from_targets:
         | import_from_as_names ',' NEWLINE {
             RAISE_SYNTAX_ERROR("trailing comma not allowed without surrounding parentheses") }
         | token=NEWLINE {
             RAISE_SYNTAX_ERROR_STARTING_FROM(token, "Expected one or more names after 'import'") }

     invalid_with_stmt:
         | ['async'] 'with' ','.(expression ['as' star_target])+ NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
         | ['async'] 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
     invalid_with_stmt_indent:
         | ['async'] a='with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT {
             RAISE_INDENTATION_ERROR("expected an indented block after 'with' statement on line %d", a->lineno) }
         | ['async'] a='with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT {
             RAISE_INDENTATION_ERROR("expected an indented block after 'with' statement on line %d", a->lineno) }

     invalid_try_stmt:
         | a='try' ':' NEWLINE !INDENT {
             RAISE_INDENTATION_ERROR("expected an indented block after 'try' statement on line %d", a->lineno) }
         | 'try' ':' block !('except' | 'finally') { RAISE_SYNTAX_ERROR("expected 'except' or 'finally' block") }
         | 'try' ':' block* except_block+ a='except' b='*' expression ['as' NAME] ':' {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "cannot have both 'except' and 'except*' on the same 'try'") }
         | 'try' ':' block* except_star_block+ a='except' [expression ['as' NAME]] ':' {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot have both 'except' and 'except*' on the same 'try'") }
     invalid_except_stmt:
         | 'except' a=expression ',' expressions 'as' NAME  ':' {
             RAISE_SYNTAX_ERROR_STARTING_FROM(a, "multiple exception types must be parenthesized when using 'as'") }
         | a='except' expression ['as' NAME ] NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
         | a='except' NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
         | 'except' expression 'as' a=expression ':' block {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
                 a, "cannot use except statement with %s", _PyPegen_get_expr_name(a)) }
     invalid_except_star_stmt:
         | 'except' '*' a=expression ',' expressions 'as' NAME  ':' {
             RAISE_SYNTAX_ERROR_STARTING_FROM(a, "multiple exception types must be parenthesized when using 'as'") }
         | a='except' '*' expression ['as' NAME ] NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
         | a='except' '*' (NEWLINE | ':') { RAISE_SYNTAX_ERROR("expected one or more exception types") }
         | 'except' '*' expression 'as' a=expression ':' block {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
                 a, "cannot use except* statement with %s", _PyPegen_get_expr_name(a)) }
     invalid_finally_stmt:
         | a='finally' ':' NEWLINE !INDENT {
             RAISE_INDENTATION_ERROR("expected an indented block after 'finally' statement on line %d", a->lineno) }
     invalid_except_stmt_indent:
         | a='except' expression ['as' NAME ] ':' NEWLINE !INDENT {
             RAISE_INDENTATION_ERROR("expected an indented block after 'except' statement on line %d", a->lineno) }
         | a='except' ':' NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block after 'except' statement on line %d", a->lineno) }
     invalid_except_star_stmt_indent:
         | a='except' '*' expression ['as' NAME ] ':' NEWLINE !INDENT {
             RAISE_INDENTATION_ERROR("expected an indented block after 'except*' statement on line %d", a->lineno) }
     invalid_match_stmt:
         | "match" subject_expr NEWLINE { CHECK_VERSION(void*, 10, "Pattern matching is", RAISE_SYNTAX_ERROR("expected ':'") ) }
         | a="match" subject=subject_expr ':' NEWLINE !INDENT {
             RAISE_INDENTATION_ERROR("expected an indented block after 'match' statement on line %d", a->lineno) }
     invalid_case_block:
         | "case" patterns guard? NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
         | a="case" patterns guard? ':' NEWLINE !INDENT {
             RAISE_INDENTATION_ERROR("expected an indented block after 'case' statement on line %d", a->lineno) }
     invalid_as_pattern:
         | or_pattern 'as' a="_" { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "cannot use '_' as a target") }
         | or_pattern 'as' a=expression {
             RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
                 a, "cannot use %s as pattern target", _PyPegen_get_expr_name(a)) }
     invalid_class_pattern:
         | name_or_attr '(' a=invalid_class_argument_pattern  { RAISE_SYNTAX_ERROR_KNOWN_RANGE(
             PyPegen_first_item(a, pattern_ty),
             PyPegen_last_item(a, pattern_ty),
             "positional patterns follow keyword patterns") }
     invalid_class_argument_pattern[asdl_pattern_seq*]:
         | [positional_patterns ','] keyword_patterns ',' a=positional_patterns { a }
     invalid_if_stmt:
         | 'if' named_expression NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
         | a='if' a=named_expression ':' NEWLINE !INDENT {
             RAISE_INDENTATION_ERROR("expected an indented block after 'if' statement on line %d", a->lineno) }
     invalid_elif_stmt:
         | 'elif' named_expression NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
         | a='elif' named_expression ':' NEWLINE !INDENT {
             RAISE_INDENTATION_ERROR("expected an indented block after 'elif' statement on line %d", a->lineno) }
     invalid_else_stmt:
         | a='else' ':' NEWLINE !INDENT {
             RAISE_INDENTATION_ERROR("expected an indented block after 'else' statement on line %d", a->lineno) }
         | 'else' ':' block 'elif' { RAISE_SYNTAX_ERROR("'elif' block follows an 'else' block")}
     invalid_while_stmt:
         | 'while' named_expression NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
         | a='while' named_expression ':' NEWLINE !INDENT {
             RAISE_INDENTATION_ERROR("expected an indented block after 'while' statement on line %d", a->lineno) }
     invalid_for_stmt:
         | ['async'] 'for' star_targets 'in' star_expressions NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
         | ['async'] a='for' star_targets 'in' star_expressions ':' NEWLINE !INDENT {
             RAISE_INDENTATION_ERROR("expected an indented block after 'for' statement on line %d", a->lineno) }
     invalid_def_raw:
         | ['async'] a='def' NAME [type_params] '(' [params] ')' ['->' expression] ':' NEWLINE !INDENT {
             RAISE_INDENTATION_ERROR("expected an indented block after function definition on line %d", a->lineno) }
         | ['async'] 'def' NAME [type_params] &&'(' [params] ')' ['->' expression] &&':' [func_type_comment] block
     invalid_class_def_raw:
         | 'class' NAME [type_params] ['(' [arguments] ')'] NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
         | a='class' NAME [type_params] ['(' [arguments] ')'] ':' NEWLINE !INDENT {
             RAISE_INDENTATION_ERROR("expected an indented block after class definition on line %d", a->lineno) }

     invalid_double_starred_kvpairs:
         | ','.double_starred_kvpair+ ',' invalid_kvpair
         | expression ':' a='*' bitwise_or { RAISE_SYNTAX_ERROR_STARTING_FROM(a, "cannot use a starred expression in a dictionary value") }
         | expression a=':' &('}'|',') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "expression expected after dictionary key and ':'") }
     invalid_kvpair:
         | a=expression !(':') {
             RAISE_ERROR_KNOWN_LOCATION(p, PyExc_SyntaxError, a->lineno, a->end_col_offset - 1, a->end_lineno, -1, "':' expected after dictionary key") }
         | expression ':' a='*' bitwise_or { RAISE_SYNTAX_ERROR_STARTING_FROM(a, "cannot use a starred expression in a dictionary value") }
         | expression a=':' &('}'|',') {RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "expression expected after dictionary key and ':'") }
     invalid_starred_expression_unpacking:
         | a='*' expression '=' b=expression { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "cannot assign to iterable argument unpacking") }
     invalid_starred_expression:
         | '*' { RAISE_SYNTAX_ERROR("Invalid star expression") }

     invalid_fstring_replacement_field:
         | '{' a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "f-string: valid expression required before '='") }
         | '{' a='!' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "f-string: valid expression required before '!'") }
         | '{' a=':' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "f-string: valid expression required before ':'") }
         | '{' a='}' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "f-string: valid expression required before '}'") }
         | '{' !annotated_rhs { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting a valid expression after '{'") }
         | '{' annotated_rhs !('=' | '!' | ':' | '}') {
             PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting '=', or '!', or ':', or '}'") }
         | '{' annotated_rhs '=' !('!' | ':' | '}') {
             PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting '!', or ':', or '}'") }
         | '{' annotated_rhs '='? invalid_fstring_conversion_character
         | '{' annotated_rhs '='? ['!' NAME] !(':' | '}') {
             PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting ':' or '}'") }
         | '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}' {
             PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting '}', or format specs") }
         | '{' annotated_rhs '='? ['!' NAME] !'}' {
             PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: expecting '}'") }

     invalid_fstring_conversion_character:
         | '!' &(':' | '}') { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: missing conversion character") }
         | '!' !NAME { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("f-string: invalid conversion character") }

     invalid_tstring_replacement_field:
         | '{' a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "t-string: valid expression required before '='") }
         | '{' a='!' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "t-string: valid expression required before '!'") }
         | '{' a=':' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "t-string: valid expression required before ':'") }
         | '{' a='}' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "t-string: valid expression required before '}'") }
         | '{' !annotated_rhs { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("t-string: expecting a valid expression after '{'") }
         | '{' annotated_rhs !('=' | '!' | ':' | '}') {
             PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("t-string: expecting '=', or '!', or ':', or '}'") }
         | '{' annotated_rhs '=' !('!' | ':' | '}') {
             PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("t-string: expecting '!', or ':', or '}'") }
         | '{' annotated_rhs '='? invalid_tstring_conversion_character
         | '{' annotated_rhs '='? ['!' NAME] !(':' | '}') {
             PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("t-string: expecting ':' or '}'") }
         | '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}' {
             PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("t-string: expecting '}', or format specs") }
         | '{' annotated_rhs '='? ['!' NAME] !'}' {
             PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("t-string: expecting '}'") }

     invalid_tstring_conversion_character:
         | '!' &(':' | '}') { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("t-string: missing conversion character") }
         | '!' !NAME { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("t-string: invalid conversion character") }

     invalid_string_tstring_concat:
         | a=(fstring|string)+ b[expr_ty]=tstring {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(PyPegen_last_item(a, expr_ty), b, "cannot mix t-string literals with string or bytes literals") }
         | a=tstring+ b[expr_ty]=(fstring|string) {
             RAISE_SYNTAX_ERROR_KNOWN_RANGE(PyPegen_last_item(a, expr_ty), b, "cannot mix t-string literals with string or bytes literals") }

     invalid_arithmetic:
         | sum ('+'|'-'|'*'|'/'|'%'|'//'|'@') a='not' b=inversion { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "'not' after an operator must be parenthesized") }
     invalid_factor:
         | ('+' | '-' | '~') a='not' b=factor { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "'not' after an operator must be parenthesized") }

     invalid_type_params:
         | '[' token=']' {
             RAISE_SYNTAX_ERROR_STARTING_FROM(
                 token,
                 "Type parameter list cannot be empty")}

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Grammar/python.gram


File: python.info,  Node: Python 標準ライブラリ,  Next: Python インタプリタの拡張と埋め込み,  Prev: Python 言語リファレンス,  Up: Top

5 Python 標準ライブラリ
***********************

*note Python 言語リファレンス: 14a. ではプログラミング言語 Python の厳密
な構文とセマンティクスについて説明されていますが、このライブラリリファレ
ンスマニュアルでは Python とともに配付されている標準ライブラリについて説
明します。また Python 配布物に収められていることの多いオプションのコンポ
ーネントについても説明します。

Python の標準ライブラリはとても拡張性があり、下の長い目次のリストで判る
ように幅広いものを用意しています。このライブラリには、例えばファイル I/O
のように、Python プログラマが直接アクセスできないシステム機能へのアクセ
ス機能を提供する (Cで書かれた) 組み込みモジュールや、日々のプログラミン
グで生じる多くの問題に標準的な解決策を提供するPython で書かれたモジュー
ルが入っています。これら数多くのモジュールには、プラットフォーム固有の事
情をプラットフォーム独立な API へと昇華させることにより、Pythonプログラ
ムに移植性を持たせ、それを高めるという明確な意図があります。

Windows 向けの Python インストーラはたいてい標準ライブラリのすべてを含み
、しばしばそれ以外の追加のコンポーネントも含んでいます。Unix 系のオペレ
ーティングシステムの場合は Python は一揃いのパッケージとして提供されるの
が普通で、オプションのコンポーネントを手に入れるにはオペレーティングシス
テムのパッケージツールを使うことになるでしょう。

標準ライブラリに加えて、数10万のコンポーネントが (独立したプログラムやモ
ジュールからパッケージ、アプリケーション開発フレームワークまで) 活動して
いるコレクションとしてPython Package Index(1) から入手可能です。

* Menu:

* はじめに: はじめに<6>.
* 組み込み関数::
* 組み込み定数::
* 組み込み型::
* 組み込み例外::
* テキスト処理サービス::
* バイナリデータ処理::
* データ型::
* 数値と数学モジュール::
* 関数型プログラミング用モジュール::
* ファイルとディレクトリへのアクセス::
* データの永続化::
* データ圧縮とアーカイブ::
* ファイルフォーマット::
* 暗号関連のサービス::
* 汎用オペレーティングシステムサービス::
* コマンドラインインターフェースライブラリ::
* 並行実行::
* ネットワーク通信とプロセス間通信::
* インターネット上のデータの操作::
* 構造化マークアップツール::
* インターネットプロトコルとサポート::
* マルチメディアサービス::
* 国際化::
* Graphical user interfaces with Tk::
* 開発ツール::
* デバッグとプロファイル::
* ソフトウェア・パッケージと配布::
* Python ランタイムサービス::
* カスタム Python インタプリタ::
* モジュールのインポート::
* Python言語サービス::
* MS Windows 固有のサービス::
* Unix-specific services::
* モジュールのコマンドラインインターフェース (CLI): モジュールのコマンドラインインターフェース CLI.
* 取って代わられたモジュール群::
* 削除されたモジュール::
* セキュリティで考慮すべき点: セキュリティで考慮すべき点<6>.

   ---------- Footnotes ----------

   (1) https://pypi.org


File: python.info,  Node: はじめに<6>,  Next: 組み込み関数,  Up: Python 標準ライブラリ

5.1 はじめに
============

この "Python ライブラリ" には様々な内容が収録されています。

このライブラリには、数値型やリスト型のような、通常は言語の "核" をなす部
分とみなされるデータ型が含まれています。Python 言語のコア部分では、これ
らの型に対してリテラル表現形式を与え、意味づけ上のいくつかの制約を与えて
いますが、完全にその意味づけを定義しているわけではありません。(一方で、
言語のコア部分では演算子のスペルや優先順位のような構文法的な属性を定義し
ています。)

このライブラリにはまた、組み込み関数と例外が納められています -- 組み込み
関数および例外は、全ての Python で書かれたコード上で、 *note import:
7f8. 文を使わずに使うことができるオブジェクトです。これらの組み込み要素
のうちいくつかは言語のコア部分で定義されていますが、大半は言語コアの意味
づけ上不可欠なものではないのでここでしか記述されていません。

とはいえ、このライブラリの大部分に収録されているのはモジュールのコレクシ
ョンです。このコレクションを細分化する方法はいろいろあります。あるモジュ
ールは C 言語で書かれ、Python インタプリタに組み込まれています; 一方別の
モジュールは Python で書かれ、ソースコードの形式で取り込まれます。またあ
るモジュールは、例えば実行スタックの追跡結果を出力するといった、Python に
非常に特化したインターフェースを提供し、一方他のモジュールでは、特定のハ
ードウェアにアクセスするといった、特定のオペレーティングシステムに特化し
たインターフェースを提供し、さらに別のモジュールでは WWW (ワールドワイド
ウェブ) のような特定のアプリケーション分野に特化したインターフェースを提
供しています。モジュールによっては全てのバージョン、全ての移植版の
Python で利用することができたり、背後にあるシステムがサポートしている場
合にのみ使えたり、Python をコンパイルしてインストールする際に特定の設定
オプションを選んだときにのみ利用できたりします。

このマニュアルは "内部から外部へ" と構成されています。つまり、最初に組み
込みの関数を記述し、組み込みのデータ型、例外、そして最後に各モジュールと
続きます。モジュールは関係のあるものでグループ化して一つの章にしています
。

つまり、このマニュアルを最初から読み始め、読み飽きたところで次の章に進め
ば、 Python ライブラリで利用できるモジュールやサポートしているアプリケー
ション領域の概要をそこそこ理解できるということです。もちろん、このマニュ
アルを小説のように読む必要は 'ありません' -- (マニュアルの先頭部分にある
) 目次にざっと目を通したり、 (最後尾にある) 索引でお目当ての関数やモジュ
ール、用語を探すことだってできます。もしランダムな項目について勉強してみ
たいのなら、ランダムにページを選び (*note random: bd. 参照)、そこから 1,
2 節読むこともできます。このマニュアルの各節をどんな順番で読むかに関わら
ず、 *note 組み込み関数: 1474. の章から始めるとよいでしょう。マニュアル
の他の部分は、この節の内容について知っているものとして書かれているからで
す。

それでは、ショーの始まりです！

* Menu:

* 利用可能性について::


File: python.info,  Node: 利用可能性について,  Up: はじめに<6>

5.1.1 利用可能性について
------------------------

   * 「利用できる環境 : Unix 」の意味はこの関数が Unix システムにあるこ
     とが多いということです。このことは特定の OS における存在を主張する
     ものではありません。

   * 特に記述がない場合、「利用できる環境 : Unix 」と書かれている関数は
     、 Unix をコアにしているmacOS、iOS、Androidでも利用することができま
     す。

   * 利用可能性の注釈に最小カーネルバージョンと最小 libc バージョンの両
     方が含まれている場合は、両方の条件を満たさなければなりません。例え
     ば、 'Availability: Linux >= 3.17 with glibc >= 2.27' という注釈付
     きの機能には、 Linux 3.17 以上と、 glibc 2.27 以上の両方が必要です
     。

* Menu:

* WebAssembly プラットフォーム::
* モバイルプラットフォーム::


File: python.info,  Node: WebAssembly プラットフォーム,  Next: モバイルプラットフォーム,  Up: 利用可能性について

5.1.1.1 WebAssembly プラットフォーム
....................................

WebAssembly(1) プラットフォームである ‘wasm32-emscripten’
(Emscripten(2)) と ‘wasm32-wasi’ (WASI(3)) は、 POSIX API のサブセットを
提供します。 WebAssembly ランタイムとブラウザーはサンドボックス化されて
おり、ホストや外部リソースへのアクセスが制限されています。プロセス、スレ
ッド、ネットワーク、シグナル、または他の形のプロセス間通信 (IPC) を使用
する標準ライブラリモジュールは、利用不可か、他の Unix ライクなシステムの
ようには動作しません。ファイル I/O 、ファイルシステム、 Unix の権限関係
の機能も制限されています。 Emscripten はブロッキング I/O を許可しません
。 *note sleep(): 8ac. のような他のブロッキング操作は、ブラウザーのイベ
ントループをブロックします。

WebAssembly プラットフォーム上での Python の 性質と振る舞いは、
Emscripten(4)-SDK や WASI(5)-SDK のバージョン、 WASM ランタイム (ブラウ
ザ、 NodeJS 、 wasmtime(6)) 、Python のビルド時フラグによって決まります
。 WebAssembly や Emscripten 、 WASI は標準を発展させており、ネットワー
クなどの機能は将来的にサポートされるかもしれません

ブラウザ上の Python では、ユーザーは Pyodide(7) や PyScript(8) を検討す
べきでしょう。 PyScript は、 Pyodide をもとにして構築されており、
Pyodide 自体は CPython や Emscripten 上に構築されています。 Pyodide は、
ブラウザの JavaScript と DOM API だけでなく、 JavaScript の
‘XMLHttpRequest’ や ‘Fetch’ API による制限されたネットワーク機能へのアク
セスを提供します。

   * プロセス関連の API は利用不可能か、常にエラーにより失敗します。これ
     には、新しいプロセスを作成 (*note fork(): 4b5. や *note execve():
     1311.) 、プロセスを待機 (*note waitpid(): f9a.) 、シグナルを送信
     (*note kill(): 157f.) 、もしくはプロセスと通信する API が含まれます
     。 *note subprocess: dc. はインポート可能ですが、機能しません。

   * The *note socket: d1. module is available, but is limited and
     behaves differently from other platforms.  On Emscripten, sockets
     are always non-blocking and require additional JavaScript code and
     helpers on the server to proxy TCP through WebSockets; see
     Emscripten Networking(9) for more information.  WASI snapshot
     preview 1 only permits sockets from an existing file descriptor.

   * Some functions are stubs that either don't do anything and always
     return hardcoded values.

   * Functions related to file descriptors, file permissions, file
     ownership, and links are limited and don't support some operations.
     For example, WASI does not permit symlinks with absolute file
     names.

   ---------- Footnotes ----------

   (1) https://webassembly.org/

   (2) https://emscripten.org/

   (3) https://wasi.dev/

   (4) https://emscripten.org/

   (5) https://wasi.dev/

   (6) https://wasmtime.dev/

   (7) https://pyodide.org/

   (8) https://pyscript.net/

   (9) https://emscripten.org/docs/porting/networking.html


File: python.info,  Node: モバイルプラットフォーム,  Prev: WebAssembly プラットフォーム,  Up: 利用可能性について

5.1.1.2 モバイルプラットフォーム
................................

Android and iOS are, in most respects, POSIX operating systems.  File
I/O, socket handling, and threading all behave as they would on any
POSIX operating system.  However, there are several major differences:

   * Mobile platforms can only use Python in "embedded" mode.  There is
     no Python REPL, and no ability to use separate executables such as
     ‘python’ or ‘pip’.  To add Python code to your mobile app, you must
     use the *note Python embedding API: 225b.  For more details, see
     *note Android で Python を使う: 2259. and *note iOS で Python
     を使う: 2261.

   * サブプロセス:

        * On Android, creating subprocesses is possible but officially
          unsupported(1).  In particular, Android does not support any
          part of the System V IPC API, so *note multiprocessing: 98. is
          not available.

        * An iOS app cannot use any form of subprocessing,
          multiprocessing, or inter-process communication.  If an iOS
          app attempts to create a subprocess, the process creating the
          subprocess will either lock up, or crash.  An iOS app has no
          visibility of other applications that are running, nor any
          ability to communicate with other running applications,
          outside of the iOS-specific APIs that exist for this purpose.

   * Mobile apps have limited access to modify system resources (such as
     the system clock).  These resources will often be 'readable', but
     attempts to modify those resources will usually fail.

   * Console input and output:

        * On Android, the native ‘stdout’ and ‘stderr’ are not connected
          to anything, so Python installs its own streams which redirect
          messages to the system log.  These can be seen under the tags
          ‘python.stdout’ and ‘python.stderr’ respectively.

        * iOS apps have a limited concept of console output.  ‘stdout’
          and ‘stderr’ 'exist', and content written to ‘stdout’ and
          ‘stderr’ will be visible in logs when running in Xcode, but
          this content 'won't' be recorded in the system log.  If a user
          who has installed your app provides their app logs as a
          diagnostic aid, they will not include any detail written to
          ‘stdout’ or ‘stderr’.

        * Mobile apps have no usable ‘stdin’ at all.  While apps can
          display an on-screen keyboard, this is a software feature, not
          something that is attached to ‘stdin’.

          As a result, Python modules that involve console manipulation
          (such as *note curses: 2f. and *note readline: bf.) are not
          available on mobile platforms.

   ---------- Footnotes ----------

   (1) https://issuetracker.google.com/issues/128554619#comment4


File: python.info,  Node: 組み込み関数,  Next: 組み込み定数,  Prev: はじめに<6>,  Up: Python 標準ライブラリ

5.2 組み込み関数
================

Python インタプリタには数多くの関数と型が組み込まれており、いつでも利用
できます。それらをここにアルファベット順に挙げます。

組み込み関数

--------------------------------------------------------------------------------------------------------------------
                                                                                      
     'A'                           'E'                         'L'                         'R'
     *note abs(): 208d.            *note enumerate(): 169a.     *note len(): 840.          *note range(): 25bc.
     *note aiter(): 9d5.           *note eval(): 4a3.          *note list(): 25ba.         *note repr(): 1c1.
     *note all(): 163b.            *note exec(): 4a2.          *note locals(): 46f.        *note reversed(): a65.
     *note anext(): 9d6.                                                                   *note round(): 14f2.
     *note any(): 163a.            'F'                         'M'                         
     *note ascii(): 15ff.          *note filter(): a64.        *note map(): 19f.           'S'
                                   *note float(): 196.         *note max(): 110c.          *note set(): 25bd.
     'B'                           *note format(): 199.        *note memoryview(): 25bb.     *note setattr(): 25be.
     *note bin(): 14c0.            *note frozenset(): 25b9.     *note min(): 110b.         *note slice(): 694.
     *note bool(): 3c3.                                                                    *note sorted(): dc7.
     *note breakpoint(): 271.      'G'                         'N'                         *note staticmethod(): 453.
     *note bytearray(): 1e9b.      *note getattr(): dca.       *note next(): 9d8.          *note str(): 25bf.
     *note bytes(): 1e9a.          *note globals(): 1c0a.                                  *note sum(): 695.
                                                               'O'                         *note super(): 1a6.
     'C'                           'H'                         *note object(): c7e.        
     *note callable(): 13de.       *note hasattr(): 6f9.       *note oct(): 14e6.          'T'
     *note chr(): 19ef.            *note hash(): 801.          *note open(): 316.          *note tuple(): 25c0.
     *note classmethod(): 48e.     *note help(): ad4.          *note ord(): 233b.          *note type(): f44.
     *note compile(): 4b1.         *note hex(): 14e7.                                      
     *note complex(): 197.                                     'P'                         'V'
                                   'I'                         *note pow(): 1a4.           *note vars(): 1e23.
     'D'                           *note id(): 163c.           *note print(): 1177.        
     *note delattr(): 25b7.        *note input(): 14f0.        *note property(): 4b3.      'Z'
     *note dict(): 25b8.           *note int(): 19b.                                       *note zip(): 1a0.
     *note dir(): 844.             *note isinstance(): 2ad.                                
     *note divmod(): b99.          *note issubclass(): 9c4.                                '_'
                                   *note iter(): 9d7.                                      *note __import__(): ad1.
                                                                                      

 -- の関数: abs (number, /)

     数の絶対値を返します。引数は整数、浮動小数点数または *note
     __abs__(): 2405. が実装されたオブジェクトです。引数が複素数なら、そ
     の絶対値 (magnitude) が返されます。

 -- の関数: aiter (async_iterable, /)

     *note asynchronous iterable: f74. から *note asynchronous iterator:
     4c7. を返します。 ‘x.__aiter__()’ を呼び出すのと等価です。

     なお、 *note iter(): 9d7. とは異なり、 *note aiter(): 9d5. は第二引
     数を持ちません。

     Added in version 3.10.

 -- の関数: all (iterable, /)

     'iterable' の全ての要素が真ならば (もしくは 'iterable' が空ならば)
     ‘True’ を返します。以下のコードと等価です:

          def all(iterable):
              for element in iterable:
                  if not element:
                      return False
              return True

 -- の関数: awaitable anext (async_iterator, /)

 -- の関数: awaitable anext (async_iterator, default, /)

     待ち受け中に、与えられた非同期イテレータ (*note asynchronous
     iterator: 4c7.) を返します。イテレータが枯渇した場合、 'default' が
     与えられていれば 'default' を返します。

     これは組み込みの *note next(): 9d8. 関数の非同期版であり、同じよう
     に動作します。

     これは 'async_iterator' の *note __anext__(): 1882. メソッドを呼び
     出し、待ち受け可能オブジェクト (*note awaitable: 4c9.) を返します。
     待ち受けることによりイテレータの次の値を返します。 'default' が与え
     られた場合、イテレータが枯渇したときにその値が返されます。
     'default' が与えられない場合は *note StopAsyncIteration: 1e0f. が送
     出されます。

     Added in version 3.10.

 -- の関数: any (iterable, /)

     'iterable' のいずれかの要素が真ならば ‘True’ を返します。'iterable'
     が空なら ‘False’ を返します。以下のコードと等価です:

          def any(iterable):
              for element in iterable:
                  if element:
                      return True
              return False

 -- の関数: ascii (object, /)

     *note repr(): 1c1. と同様、オブジェクトの印字可能な表現を含む文字列
     を返しますが、*note repr(): 1c1. によって返された文字列中の非 ASCII
     文字は ‘\x’ 、 ‘\u’ 、 ‘\U’ エスケープを使ってエスケープされます。
     これは Python 2 の *note repr(): 1c1. によって返されるのと同じ文字
     列を作ります。

 -- の関数: bin (integer, /)

     整数を先頭に "0b" が付いた 2 進文字列に変換します。 結果は Python の
     式としても使える形式になります。 'integer' が Python の *note int:
     19b. オブジェクトでない場合、整数を返す *note __index__(): 19e. メ
     ソッドが定義されていなければなりません。 いくつかの例を示します:

          >>> bin(3)
          '0b11'
          >>> bin(-10)
          '-0b1010'

     先頭に "0b" が付いて欲しい、もしくは付いて欲しくない場合には、次の
     方法のどちらでも使えます。

          >>> format(14, '#b'), format(14, 'b')
          ('0b1110', '1110')
          >>> f'{14:#b}', f'{14:b}'
          ('0b1110', '1110')

     See also *note enum.bin(): 178d. to represent negative values as
     twos-complement.

     より詳しいことは *note format(): 199. も参照してください。

 -- クラス: bool (object=False, /)

     真偽値、すなわち ‘True’ か ‘False’ のいずれかを返します。引数は標準
     の *note 真偽値判定手続き: 1858. を用いて変換されます。引数が偽かま
     たは省略された場合、この関数は ‘False’ を返します。それ以外の場合は
     ‘True’ を返します。 *note bool: 3c3. クラスは *note int: 19b. クラ
     スの派生クラスです (*note 数値型 int, float, complex: 1fdc. を参照
     してください)。このクラスからさらに派生することはできません。このク
     ラスのインスタンスは ‘False’ と ‘True’ のみです (*note ブーリアン型
     - bool: 25c1. を参照してください)。

     バージョン 3.7 で変更: 引数は位置専用になりました。

 -- の関数: breakpoint (*args, **kws)

     この関数は、呼び出された箇所にて処理をデバッガに移行します。具体的
     には、 *note sys.breakpointhook(): cd1. を呼び出し、 ‘args’ と
     ‘kws’ をそのまま渡します。デフォルトでは、 ‘sys.breakpointhook()’ は
     引数なしで *note pdb.set_trace(): 272. を呼び出すだけです。その場合
     、これは単なる便利関数でデバッガに入るために *note pdb: aa. を明示
     的にインポートしたり多くのコードを書いたりせずに済むだけです。です
     が、 *note sys.breakpointhook(): cd1. は別の関数に設定でき、 *note
     breakpoint(): 271. はそれを自動で呼び出すため、自分好みのデバッガに
     処理を移行させることができます。 *note sys.breakpointhook(): cd1. に
     アクセスできない場合、この関数は *note RuntimeError: 244. を送出し
     ます。

     デフォルトでは、環境変数 *note PYTHONBREAKPOINT: cd2. をセットする
     ことで *note breakpoint(): 271. の動作を変えることができます。 使い
     方の詳細は *note sys.breakpointhook(): cd1. を参照してください。

     ただし、 *note sys.breakpointhook(): cd1. が別の関数で置き換えられ
     ている場合、上記の環境変数によって必ずしも動作を変えることができな
     いことに注意してください。

     引数 ‘breakpointhook’ 付きで *note 監査イベント: 1c6e.
     ‘builtins.breakpoint’ を送出します。

     Added in version 3.7.

 -- クラス: bytearray (source=b'')

 -- クラス: bytearray (source, encoding, errors='strict')

     新しいバイト配列を返します。*note bytearray: 344. クラスは0 <= x <
     256の範囲の整数からなる変更可能な配列です。*note
     ミュータブルなシーケンス型: 25c2. に記述されている変更可能な配列に
     対する普通のメソッドの大半を備えています。また、*note bytes: 192. 型
     が持つメソッドの大半も備えています（see *note bytes と bytearray
     の操作: 25c3.)。

     オプションの 'source' 引数は、配列を異なる方法で初期化するのに使わ
     れます:

        * '文字列' の場合、 'encoding' (と、オプションの 'errors') 引数
          も与えなければなりません。このとき *note bytearray(): 344. は
          文字列を *note str.encode(): ad2. でバイトに変換して返します。

        * '整数' の場合、配列はそのサイズになり、null バイトで初期化され
          ます。

        * *note バッファインターフェース: 260. に適合するオブジェクトの
          場合、そのオブジェクトの読み出し専用バッファがバイト配列の初期
          化に使われます。

        * 'イテラブル' の場合、範囲 ‘0 <= x < 256’ 内の整数のイテラブル
          でなければならず、それらが配列の初期の内容として使われます。

     引数がなければ、長さ 0 の配列が生成されます。

     *note バイナリシーケンス型 -- bytes, bytearray, memoryview: 25c4. と
     *note bytearray オブジェクト: 25c5. も参照してください。

 -- クラス: bytes (source=b'')

 -- クラス: bytes (source, encoding, errors='strict')

     範囲 ‘0 <= x < 256’ の整数のイミュータブルなシーケンスである
     "bytes" オブジェクトを返します。 *note bytes: 192. は *note
     bytearray: 344. のイミュータブル版であり、オブジェクトを変化させな
     いメソッドや、インデックス指定、オブジェクトのスライスについてのふ
     るまいは同じです。

     従って、コンストラクタ引数は *note bytearray(): 344. のものと同様に
     解釈されます。

     バイト列オブジェクトはリテラルでも生成できます。 *note
     文字列およびバイト列リテラル: 229f. を参照してください。

     *note バイナリシーケンス型 -- bytes, bytearray, memoryview: 25c4,
     *note バイトオブジェクト: 25c6, *note bytes と bytearray の操作:
     25c3. も参照してください。

 -- の関数: callable (object, /)

     'object' 引数が呼び出し可能オブジェクトであれば *note True: e07. を
     、そうでなければ *note False: d2b. を返します。この関数が ‘True’ を
     返しても、呼び出しは失敗する可能性がありますが、‘False’ であれば、
     'object' の呼び出しは決して成功しません。なお、クラスは呼び出し可能
     (クラスを呼び出すと新しいインスタンスを返します) です。また、インス
     タンスはクラスが *note __call__(): 77a. メソッドを持つなら呼び出し
     可能です。

     Added in version 3.2: この関数は Python 3.0 で一度取り除かれました
     が、Python 3.2 で復活しました。

 -- の関数: chr (codepoint, /)

     指定されたUnicode コードポイントが文字を表す文字列を返します。例え
     ば ‘chr(97)’ は文字列 ‘'a'’ を、 ‘chr(8364)’ は文字列 ‘'€'’ を返し
     ます。 *note ord(): 233b. の逆です。

     引数の有効な範囲は 0 から 1,114,111 (16 進数で 0x10FFFF) です。引数
     が範囲外の場合 *note ValueError: 2ec. が送出されます。

 -- の関数: @classmethod

     メソッドをクラスメソッドへ変換します。

     クラスメソッドは、インスタンスメソッドが暗黙の第一引数としてインス
     タンスをとるように、第一引数としてクラスをとります。クラスメソッド
     を宣言するには、以下のイディオムを使います:

          class C:
              @classmethod
              def f(cls, arg1, arg2): ...

     ‘@classmethod’ 形式は関数 *note デコレータ: 93a. です。詳しくは
     *note 関数定義: 2018. を参照してください。

     クラスメソッドは、(‘C.f()’ のように) クラスから呼び出すことも、
     (‘C().f()’ のように) インスタンスから呼び出すこともできます。 イン
     スタンスはそのクラスが何であるかを除いて無視されます。 クラスメソッ
     ドが派生クラスから呼び出される場合は、その派生クラスオブジェクトが
     暗黙の第一引数として渡されます。

     クラスメソッドは C++ や Java の静的メソッドとは異なります。静的メソ
     ッドは、この節の *note staticmethod(): 453. を参照してください。ク
     ラスメソッドについてより詳しいことは *note 標準型の階層: 232f. を参
     照してください。

     バージョン 3.9 で変更: クラスメソッドは *note property(): 4b3. など
     、他の *note デスクリプタ: 1881. をラップすることができるようになり
     ました。

     バージョン 3.10 で変更: クラスメソッドはメソッド属性 (*note
     __module__: 234a, *note __name__: 14ec, *note __qualname__: 2349,
     *note __doc__: 13f1. と *note __annotations__: 13f0.) を継承するよ
     うになりました。また、新たに ‘__wrapped__’ 属性を持つようになりまし
     た。

     Deprecated since version 3.11, removed in version 3.13: クラスメソ
     ッドは *note property(): 4b3. など、他の *note デスクリプタ: 1881.
     をラップすることができなくなりました。

 -- の関数: compile (source, filename, mode, flags=0,
          dont_inherit=False, optimize=-1)

     'source' をコードオブジェクト、もしくは、 AST オブジェクトにコンパ
     イルします。 コードオブジェクトは *note exec(): 4a2. 文で実行したり
     、 *note eval(): 4a3. 呼び出しで評価できます。 'source' は通常の文
     字列、 バイト列、 AST オブジェクトのいずれでもかまいません。 AST オ
     ブジェクトへの、また、 AST オブジェクトからのコンパイルの方法は、
     *note ast: 9. モジュールのドキュメントを参照してください。

     'filename' 引数には、コードの読み出し元のファイルを与えなければなり
     ません; ファイルから読み出されるのでなければ、認識可能な値を渡して
     下さい (‘'<string>'’ が一般的に使われます)。

     'mode' 引数は、コンパイルされるコードの種類を指定します; 'source' が
     一連の文から成るなら ‘'exec'’ 、単一の式から成るなら ‘'eval'’ 、単
     一の対話的文の場合 ‘'single'’ です。(後者の場合、評価が ‘None’ 以外
     である式文が印字されます)。

     オプション引数 'flags' と 'dont_inherit' は、どの *note
     コンパイラオプション: 25c7. を有効化するか、 *note 将来の機能: 45d.
     のどれを許可するかを制御します。どちらの引数も存在しない (またはど
     ちらもゼロである) 場合は、 *note compile(): 4b1. の呼び出し元のコー
     ドに作用したものと同じフラグでコンパイルされます。 'flags' 引数が与
     えられて 'dont_inherit' が与えられない (またはゼロ) の場合、上記に
     加えて 'flags' 引数で与えられたコンパイラオプションと future 文が使
     われます。 'dont_inherit' がゼロでない整数の場合、 'flags' 引数で指
     定されたオプションだけが有効です - 呼び出し元コードに適用されたフラ
     グ (将来の機能とコンパイラオプション) は無視されます。

     有効化するコンパイラオプションと future 文はビットフィールドで指定
     可能で、ビット単位の OR をとることで複数のオプションを一緒に指定す
     ることができます。特定の future 機能を指定するために必要なビットフ
     ィールドの情報は、 *note __future__: 0. モジュールにおける *note
     _Feature: 25c8. インスタンスの *note compiler_flag: 2393. 属性で得
     ることができます。 *note コンパイラフラグ: 25c7. の情報は *note
     ast: 9. モジュールの ‘PyCF_’ で始まるフラグで得ることができます。

     引数 'optimize' は、コンパイラの最適化レベルを指定します; デフォル
     トの値 ‘-1’ は、インタプリタの *note -O: 18c. オプションで与えられ
     るのと同じ最適化レベルを選びます。明示的なレベルは、 ‘0’ (最適化な
     し、 ‘__debug__’ は真)、 ‘1’ (assert は取り除かれ、 ‘__debug__’ は
     偽)、 ‘2’ (docstring も取り除かれる) です。

     この関数は、コンパイルされたソースが不正である場合 *note
     SyntaxError: 18e. または *note ValueError: 2ec. を送出します。

     Python コードをパースしてその AST 表現を得たいのであれば、 *note
     ast.parse(): 1c2. を参照してください。

     引数 ‘source’ と ‘filename’ を指定して *note 監査イベント: 1c6e.
     ‘compile’ を送出します。これは、暗黙に行われるコンパイルでも送出さ
     れる可能性があります。

          注釈: 複数行に渡るコードの文字列を ‘'single'’ や ‘'eval'’ モー
          ドでコンパイルするとき、入力は一つ以上の改行文字で終端されなけ
          ればなりません。これは、 *note code: 1b. モジュールで不完全な
          文と完全な文を検知しやすくするためです。

          警告: AST オブジェクトにコンパイルしているときに、十分に大きい
          文字列や複雑な文字列によって Python の抽象構文木コンパイラのス
          タックが深さの限界を越えることで、 Python インタプリタをクラッ
          シュさせられます。

     バージョン 3.2 で変更: Windows や Mac の改行も受け付けます。また
     ‘'exec'’ モードでの入力が改行で終わっている必要もありません。
     'optimize' 引数が追加されました。

     バージョン 3.5 で変更: 以前は 'source' にヌルバイトがあったときに
     *note TypeError: 198. を送出していました。

     Added in version 3.8: ‘ast.PyCF_ALLOW_TOP_LEVEL_AWAIT’ フラグを渡し
     てトップレベルの ‘await’, ‘async for’, および ‘async with’ のサポー
     トを有効化することができるようになりました。

 -- クラス: complex (number=0, /)

 -- クラス: complex (string, /)

 -- クラス: complex (real=0, imag=0)

     単一の文字列や数値を複素数に変換する、あるいは実部と虚部から複素数
     を作成します。

     例:

          >>> complex('+1.23')
          (1.23+0j)
          >>> complex('-4.5j')
          -4.5j
          >>> complex('-1.23+4.5j')
          (-1.23+4.5j)
          >>> complex('\t( -1.23+4.5J )\n')
          (-1.23+4.5j)
          >>> complex('-Infinity+NaNj')
          (-inf+nanj)
          >>> complex(1.23)
          (1.23+0j)
          >>> complex(imag=-4.5)
          -4.5j
          >>> complex(-1.23, 4.5)
          (-1.23+4.5j)

     引数が文字列の場合、実数部（ *note float(): 196. と同じ形式）、虚数
     部（同様の形式で ‘'j'’ または ‘'J'’ 接尾辞）どちらか、あるいは両方
     （この場合、虚数部の符号は必須）を含まなければなりません。文字列 は
     空白や括弧 ‘'('’ と''')''' で囲むこともできますが、無視されます。文
     字列は、 ‘'+'’ 、‘'-'’ 、 ‘'j'’ または ‘'J'’ 接尾辞 、そして10進数
     の間に空白を含んではなりません。たとえば ‘complex('1+2j')’ はよいで
     すが、 ‘complex('1 + 2j')’ は *note ValueError: 2ec. を送出します。
     より正確には、入力は括弧および先頭と末尾の空白文字を除去した後、以
     下の文法における *note complexvalue: 25c9. の生成規則を満たす必要が
     あります:

          complexvalue: *note floatvalue: 25ca. |
                        *note floatvalue: 25ca. ("j" | "J") |
                        *note floatvalue: 25ca. *note sign: 25cb. *note absfloatvalue: 25cc. ("j" | "J")

     引数が数値の場合、コンストラクタは *note int: 19b. や *note float:
     196. のように数値変換します。一般的な Python オブジェクト ‘x’ では
     、 ‘complex(x)’ は ‘x.__complex__()’ に委譲します。 *note
     __complex__(): 7fd. が定義されていない場合は *note __float__():
     bc1. にフォールバックします。 ‘__float__()’ も定義されていない場合
     には、 *note __index__(): 19e. にフォールバックします。

     ２引数が指定されるかキーワード引数が使われている場合、各引数は任意
     の数値型（複素数を含む）となります。両方の引数が実数の場合には、実
     数成分 'real' と虚数成分 'imag' を持つ複素数を返します。引数が両方
     とも複素数の場合、実数成分 ‘real.real-imag.imag’ と虚数成分
     ‘real.imag+imag.real’ を持つ複素数を返します。引数の片方が実数の場
     合、前述の式ではその実数成分のみ使われます。

     See also *note complex.from_number(): 195. which only accepts a
     single numeric argument.

     引数がすべて省略された場合は、 ‘0j’ を返します。

     複素数型については *note 数値型 int, float, complex: 1fdc. に説明が
     あります。

     バージョン 3.6 で変更: コードリテラル中で桁をグループ化するのにアン
     ダースコアを利用できます。

     バージョン 3.8 で変更: *note __complex__(): 7fd. と *note
     __float__(): bc1. が定義されていない場合、 *note __index__(): 19e.
     へフォールバックします。

     バージョン 3.14 で非推奨: Passing a complex number as the 'real' or
     'imag' argument is now deprecated; it should only be passed as a
     single positional argument.

 -- の関数: delattr (object, name, /)

     *note setattr(): 25be. の親戚です。引数はオブジェクトと文字列です。
     文字列はオブジェクトの属性名のいずれかでなければなりません。対象の
     オブジェクトが許可する場合に限り、この関数は指定された名前の属性を
     削除します。たとえば、 ‘delattr(x, 'foobar')’ は ‘del x.foobar’ と
     等価です。 'name' は Python の識別子である必要はありません (*note
     setattr(): 25be. を参照してください)。

 -- クラス: dict (**kwargs)

 -- クラス: dict (mapping, /, **kwargs)

 -- クラス: dict (iterable, /, **kwargs)

     新しい辞書を作成します。 *note dict: 183. オブジェクトは辞書クラス
     です。このクラスに関するドキュメンテーションは *note dict: 183. と
     *note マッピング型 -- dict: cbd. を参照してください。

     他のコンテナについては、 ビルトインの *note list: 24d, *note set:
     184, *note tuple: 614. クラスおよび *note collections: 1e. モジュー
     ルを参照してください。

 -- の関数: dir ()

 -- の関数: dir (object, /)

     引数がない場合、現在のローカルスコープにある名前のリストを返します
     。引数がある場合、そのオブジェクトの有効な属性のリストを返そうと試
     みます。

     オブジェクトが *note __dir__(): 17e2. という名のメソッドを持つなら
     、そのメソッドが呼び出され、属性のリストを返さなければなりません。
     これにより、カスタムの *note __getattr__(): 6fa. や *note
     __getattribute__(): dcb. 関数を実装するオブジェクトは、*note dir():
     844. が属性を報告するやり方をカスタマイズできます。

     オブジェクトが *note __dir__(): 17e2. を提供しない場合、その型オブ
     ジェクトと、定義されていればオブジェクトの *note __dict__: 77d. 属
     性から、できるだけ情報を集めようとします。結果のリストは必ずしも完
     全ではなく、カスタムの *note __getattr__(): 6fa. を持つ場合は不正確
     かもしれません。

     デフォルトの *note dir(): 844. メカニズムは、完全というより最重要な
     情報を作成しようとするため、異なる型のオブジェクトでは異なって振る
     舞います:

        * オブジェクトがモジュールオブジェクトの場合、リストにはモジュー
          ルの属性の名前が含まれます。

        * オブジェクトが型オブジェクトやクラスオブジェクトの場合、リスト
          にはその属性の名前と、再帰的にたどったその基底クラスの属性が含
          まれます。

        * それ以外の場合には、リストにはオブジェクトの属性名、クラス属性
          名、再帰的にたどった基底クラスの属性名が含まれます。

     返されるリストはアルファベット順に並べられています。例えば:

          >>> import struct
          >>> dir()   # show the names in the module namespace
          ['__builtins__', '__name__', 'struct']
          >>> dir(struct)   # show the names in the struct module
          ['Struct', '__all__', '__builtins__', '__cached__', '__doc__', '__file__',
           '__initializing__', '__loader__', '__name__', '__package__',
           '_clearcache', 'calcsize', 'error', 'pack', 'pack_into',
           'unpack', 'unpack_from']
          >>> class Shape:
          ...     def __dir__(self):
          ...         return ['area', 'perimeter', 'location']
          ...
          >>> s = Shape()
          >>> dir(s)
          ['area', 'location', 'perimeter']

          注釈: *note dir(): 844. は主に対話プロンプトでの使用に便利なよ
          うに提供されているので、厳密性や一貫性を重視して定義された名前
          のセットというよりも、むしろ興味を引くような名前のセットを返そ
          うとします。また、この関数の細かい動作はリリース間で変わる可能
          性があります。例えば、引数がクラスであるとき、メタクラス属性は
          結果のリストに含まれません。

 -- の関数: divmod (a, b, /)

     2つの (複素数でない) 数を引数としてとり、整数の除法を行ったときの商
     と剰余からなる2つの数のペアを返します。被演算子の型が異なる場合、二
     項算術演算子での規則が適用されます。整数に対する結果は ‘(a // b, a
     % b)’ と同じです。浮動小数点数では、結果は ‘(q, a % b)’ とあらわさ
     れます。 'q' は通常 ‘math.floor(a / b)’ ですが、それより 1 少ないこ
     ともあります。いずれにせよ ‘q * b + a % b’ は 'a' に非常に近い値に
     なります。もし ‘a % b’ がゼロでないときは、その符号は 'b' と同じで
     あり、かつ ‘0 <= abs(a % b) < abs(b)’ を満たします。

 -- の関数: enumerate (iterable, start=0)

     enumerate オブジェクトを返します。 'iterable' は、シーケンスか
     *note iterator: 4c8. か、あるいはイテレーションをサポートするその他
     のオブジェクトでなければなりません。 *note enumerate(): 169a. によ
     って返されたイテレータの *note __next__(): 14e5. メソッドは、 (デフ
     ォルトでは 0 となる 'start' からの) カウントと、 'iterable' 上のイ
     テレーションによって得られた値を含むタプルを返します。

          >>> seasons = ['Spring', 'Summer', 'Fall', 'Winter']
          >>> list(enumerate(seasons))
          [(0, 'Spring'), (1, 'Summer'), (2, 'Fall'), (3, 'Winter')]
          >>> list(enumerate(seasons, start=1))
          [(1, 'Spring'), (2, 'Summer'), (3, 'Fall'), (4, 'Winter')]

     次と等価です:

          def enumerate(iterable, start=0):
              n = start
              for elem in iterable:
                  yield n, elem
                  n += 1

 -- の関数: eval (source, /, globals=None, locals=None)


     パラメータ:

        * ‘source’ (*note str: 169. | *note code object: 4e6.) - Python
          式。

        * ‘globals’ (*note dict: 183. | ‘None’) - グローバル名前空間
          (default: ‘None’) 。

        * ‘locals’ (*note mapping: 13d3. | ‘None’) - ローカル名前空間
          (default: ‘None’) 。


     戻り値: 評価された式の結果。


     例外: 構文エラーは例外として報告されます。

          警告: この関数は任意のコードを実行します。ユーザが入力した文字
          列を引数としてこの関数を呼び出すと、セキュリティの脆弱性につな
          がる可能性があります。

     'source' 引数のパースと評価は、 'globals' / 'locals' のマッピング（
     訳注：dict相当）をグローバル / ローカルの名前空間とした Python 式
     (技術的な言葉では式のリスト - 訳注：詳細は言語リファレンス６章参照)
     として行われます。 'globals' 辞書が渡され それが ‘__builtins__’ を
     キーとして持たない場合は、そのキーの下に組み込みモジュール *note
     builtins: 13. の辞書への参照が挿入されてから、'source' が解析されま
     す。 つまり、 'globals' に独自の ‘__builtins__’ 辞書を含めて *note
     eval(): 4a3. に渡すことで、実行されるコードで有効となる組み込み関数
     を統制できます。 'locals' マッピングが省略された場合、 'globals' 辞
     書がデフォルトとして使われます。どちらのマッピングも省略された場合
     、 *note eval(): 4a3. が呼び出された環境における 'globals' と
     'locals' のもとで式が評価されます。 注意点として、'eval()' は、
     *note eval(): 4a3. を呼び出したスコープからすでに参照されている場合
     （例： *note nonlocal: 14bf. 文より）のみ *note
     ネストされたスコープ: 238d. (ローカルでないオブジェクト) へのアクセ
     スを持ちます。

     例:

          >>> x = 1
          >>> eval('x+1')
          2

     この関数は (*note compile(): 4b1. で生成されるような) 任意のコード
     オブジェクトを実行するのにも利用できます。この場合、文字列の代わり
     にコードオブジェクトを渡してください。このコードオブジェクトが、引
     数 'mode' を ‘'exec'’ としてコンパイルされている場合、 *note
     eval(): 4a3. の戻り値は ‘None’ になります。

     ヒント: *note exec(): 4a2. 関数により文の動的な実行がサポートされて
     います。*note globals(): 1c0a. および *note locals(): 46f. 関数は、
     それぞれ現在のグローバルおよびローカルな辞書を返すので、それらを
     *note eval(): 4a3. や *note exec(): 4a2. に渡して使うことができます
     。

     ソースコードとして文字列が与えられた場合、先頭と末尾の空白文字およ
     びタブは取り去られます。

     リテラルだけを含む式の文字列を安全に評価できる関数、 *note
     ast.literal_eval(): e12. も参照してください。

     コードオブジェクトを引数として *note 監査イベント: 1c6e. ‘exec’ を
     送出します。コードコンパイルのイベントも送出されることがあります。

     バージョン 3.13 で変更: 'globals' と 'locals' 引数 はキーワードとし
     て渡せるようになった。

     バージョン 3.13 で変更: デフォルトの 'locals' 名前空間のセマンティ
     クスは、 組み込み *note locals(): 46f. の説明のように調整された。

 -- の関数: exec (source, /, globals=None, locals=None, *, closure=None)

          警告: この関数は任意のコードを実行します。ユーザが入力した文字
          列を引数としてこの関数を呼び出すと、セキュリティの脆弱性につな
          がる可能性があります。

     この関数は Python コードの動的な実行をサポートします。 'source' は
     文字列かコードオブジェクトでなければなりません。文字列の場合、その
     文字列は一連の Python 文として解析され、そして (構文エラーにならな
     い限り) 実行されます。 (1) コードオブジェクトの場合は、単純に実行さ
     れます。どの場合でも、実行されるコードはファイル入力形式として有効
     であることが期待されます (リファレンスマニュアルの *note
     ファイル入力: 259e. 節を参照してください)。 *note nonlocal: 14bf,
     *note yield: bc2, および *note return: 1af. 文は、 *note exec():
     4a2. 関数に渡されたコードの文脈中でさえ、関数定義の外側で使うことは
     できません。戻り値は ‘None’ です。

     どの場合でも、オプションの部分が省略されると、コードは現在のスコー
     プ内で実行されます。 'globals' だけが与えられた場合、その値は辞書で
     なければならず (かつ辞書のサブクラスであってはならず)、グローバル変
     数とローカル変数の両方に使われます。 'globals' と 'locals' の両方が
     与えられた場合、それぞれグローバル変数とローカル変数に使われます。
     'locals' を指定する場合、その値はマップ型オブジェクトでなければなり
     ません。モジュールレベルでは globals と locals は同じ辞書であること
     に留意してください。

          注釈: ‘exec’ が 'globals' と 'locals' 2つ別々のオブジェクトを
          取る場合、コードはクラス定義に埋め込まれたかのように実行されま
          す。これは、実行されたコードで定義された関数とクラスが、トップ
          レベルで割り当てられた変数にアクセスできないことを意味します（
          「トップレベル」変数はクラス定義にてクラス変数として扱われるた
          め）。

     'globals' 辞書がキー ‘__builtins__’ に対する値を含まなければ、その
     キーに対して、組み込みモジュール *note builtins: 13. の辞書への参照
     が挿入されます。ですから、実行されるコードを *note exec(): 4a2. に
     渡す前に、 'globals' に自作の ‘__builtins__’ 辞書を挿入することで、
     コードがどの組み込みを利用できるか制御できます。

     The 'closure' argument specifies a closure-a tuple of cellvars.
     It's only valid when the 'object' is a code object containing *note
     free (closure) variables: 1893.  The length of the tuple must
     exactly match the length of the code object's *note co_freevars:
     2347. attribute.

     コードオブジェクトを引数として *note 監査イベント: 1c6e. ‘exec’ を
     送出します。コードコンパイルのイベントも送出されることがあります。

          注釈: 組み込み関数 *note globals(): 1c0a. および *note
          locals(): 46f. は、それぞれ現在のグローバルおよびローカルの名
          前空間を返すので、それらを *note exec(): 4a2. の第二、第三引数
          にそのまま渡して使うと便利なことがあります。

          注釈: 標準では 'locals' は後に述べる関数 *note locals(): 46f.
          のように動作します。 *note exec(): 4a2. の呼び出しが返る時にコ
          ードが 'locals' に与える影響を知りたいなら、明示的に 'locals'
          辞書を渡してください。

     バージョン 3.11 で変更: 'closure' パラメータが追加されました。

     バージョン 3.13 で変更: 'globals' と 'locals' 引数 はキーワードとし
     て渡せるようになった。

     バージョン 3.13 で変更: デフォルトの 'locals' 名前空間のセマンティ
     クスは、 組み込み *note locals(): 46f. の説明のように調整された。

 -- の関数: filter (function, iterable, /)

     'iterable' の要素のうち、 'function' が真であるものからイテレータを
     構築します。 'iterable' にはシーケンスか、イテレーションをサポート
     するコンテナか、イテレータを渡せます。 'function' が ‘None’ のとき
     は恒等関数が指定されたものとして扱われ、 'iterable' のうち偽である
     ものがすべて取り除かれます。

     なお、‘filter(function, iterable)’ は、関数が ‘None’ でなければジェ
     ネレータ式 ‘(item for item in iterable if function(item))’ と同等で
     、関数が ‘None’ なら ‘(item for item in iterable if item)’ と同等で
     す。

     逆の働きをする関数については、 *note itertools.filterfalse(): 25ce.
     を参照してください。 'iterable' の要素のうち、 'function' が偽であ
     るものを返します。

 -- クラス: float (number=0.0, /)

 -- クラス: float (string, /)

     数または文字列から生成された浮動小数点数を返します。

     例:

          >>> float('+1.23')
          1.23
          >>> float('   -12345\n')
          -12345.0
          >>> float('1e-003')
          0.001
          >>> float('+1E6')
          1000000.0
          >>> float('-Infinity')
          -inf

     引数が文字列の場合、10進数でなければなりません。先頭に符号または空
     白を含んでもかまいません。符号は ‘'+'’ か ‘'-'’ のいずれかです。正
     符号 ‘'+'’ は生成される値に対して何の効果もありません。引数は NaN
     (not-a-number) や正または負の無限大をあらわす文字列でもかまいません
     。より正確にいうと、入力は先頭と末尾の空白文字を除き、以下に示す
     *note floatvalue: 25ca. の生成規則に従う必要があります:

          sign:          "+" | "-"
          infinity:      "Infinity" | "inf"
          nan:           "nan"
          digit:         <a Unicode decimal digit, i.e. characters in Unicode general category Nd>
          digitpart:     *note digit: 25d1. (["_"] *note digit: 25d1.)*
          number:        [*note digitpart: 25d2.] "." *note digitpart: 25d2. | *note digitpart: 25d2. ["."]
          exponent:      ("e" | "E") [*note sign: 25cb.] *note digitpart: 25d2.
          floatnumber:   *note number: 25d3. [*note exponent: 25d4.]
          absfloatvalue: *note floatnumber: 25d5. | *note infinity: 25cf. | *note nan: 25d0.
          floatvalue:    [*note sign: 25cb.] *note absfloatvalue: 25cc.

     大文字と小文字は重要ではないので、例えば、 "inf", "Inf",
     "INFINITY", "iNfINity" はすべて正の無限大を表す綴りとして受け入れら
     れます。

     また、引数が整数または浮動小数点数なら、 (Python の浮動小数点数の精
     度で) 同じ値の浮動小数点数が返されます。 引数が Python の浮動小数点
     数の範囲外なら、 *note OverflowError: a81. が送出されます。

     一般の Python オブジェクト ‘x’ に対して、‘float(x)’ は
     ‘x.__float__()’ に委譲します。 *note __float__(): bc1. が定義されて
     いない場合、*note __index__(): 19e. へフォールバックします。

     See also *note float.from_number(): 194. which only accepts a
     numeric argument.

     引数が与えられなければ、‘0.0’ が返されます。

     浮動小数点数型については、 *note 数値型 int, float, complex: 1fdc.
     も参照してください。

     バージョン 3.6 で変更: コードリテラル中で桁をグループ化するのにアン
     ダースコアを利用できます。

     バージョン 3.7 で変更: 引数は位置専用になりました。

     バージョン 3.8 で変更: *note __float__(): bc1. が定義されていない場
     合、 *note __index__(): 19e. へフォールバックします。

 -- の関数: format (value, format_spec='', /)

     'value' を 'format_spec' で指示された通りに "整形" した文字列表現に
     変換します。 'format_spec' の解釈は 'value' 引数の型に依存しますが
     、ほとんどの組み込み型で使われる標準的な構文が存在します: *note
     書式指定ミニ言語仕様: 4f9.。

     デフォルトの 'format_spec' は空の文字列です。それは通常 *note
     str(value): 169. の呼び出しと同じ結果になります。

     ‘format(value, format_spec)’ の呼び出しは、
     ‘type(value).__format__(value, format_spec)’ に翻訳され、これは
     value の *note __format__(): 831. メソッドの検索をするとき、インス
     タンス辞書を回避します。このメソッドの探索が *note object: c7e. に
     到達しても 'format_spec' が空にならなかったり、 'format_spec' や返
     り値が文字列でなかったりした場合、 *note TypeError: 198. が送出され
     ます。

     バージョン 3.4 で変更: 'format_spec' が空の文字列でない場合
     ‘object().__format__(format_spec)’ は *note TypeError: 198. を送出
     します。

 -- クラス: frozenset (iterable=(), /)

     新しい *note frozenset: 7f2. オブジェクトを返します。オプションで
     'iterable' から得られた要素を含みます。 ‘frozenset’ はビルトインク
     ラスです。このクラスに関するドキュメントは *note frozenset: 7f2. と
     *note set（集合）型 -- set, frozenset: 2031. を参照してください。

     他のコンテナについては、ビルトインクラス *note set: 184, *note
     list: 24d, *note tuple: 614, *note dict: 183. や *note collections:
     1e. モジュールを見てください。

 -- の関数: getattr (object, name, /)

 -- の関数: getattr (object, name, default, /)

     'object' の指定された属性の値を返します。 'name' は文字列でなければ
     なりません。与えられた文字列がオブジェクトの属性名のうちいずれかに
     一致すれば、戻り値はその属性の値になります。たとえば、 ‘getattr(x,
     'foobar')’ は ‘x.foobar’ と等価です。もし指定された属性が存在しない
     場合、 'default' が指定されていればその値が返されます。そうでない場
     合は *note AttributeError: 5f0. が送出されます。 'name' は Python 識
     別子である必要はありません (*note setattr(): 25be. を参照してくださ
     い)。

          注釈: *note プライベートな名前のマングリング: 20a3. はコンパイ
          ル時に行われます。そのため、プライベートな属性 (先頭に2つのア
          ンダースコアを伴う名前を持つ属性) の値を *note getattr(): dca.
          で取り出すためには、属性名を手動でマングリングする必要がありま
          す。

 -- の関数: globals ()

     現在のモジュールの名前空間を実装した辞書を返します。関数内のコード
     に対しては、関数が定義されるときに辞書が設定され、その関数がどこか
     ら呼ばれたかにかかわらず同じ内容になります。

 -- の関数: hasattr (object, name, /)

     引数はオブジェクトと文字列です。文字列がオブジェクトの属性名の一つ
     であった場合 ‘True’ を、そうでない場合 ‘False’ を返します。 (この関
     数は、 ‘getattr(object, name)’ を呼び出して *note AttributeError:
     5f0. を送出するかどうかを見ることで実装されています。)

 -- の関数: hash (object, /)

     オブジェクトのハッシュ値を (存在すれば) 返します。ハッシュ値は整数
     です。これらは辞書を検索する際に辞書のキーを高速に比較するために使
     われます。等しい値となる数値は等しいハッシュ値を持ちます (1 と 1.0
     のように型が異なっていてもです)。

          注釈: 独自の *note __hash__(): cf3. メソッドを実装したオブジェ
          クトを使う場合、*note hash(): 801. が実行するマシンのビット幅
          に合わせて戻り値を切り捨てることに注意してください。

 -- の関数: help ()

 -- の関数: help (request)

     組み込みヘルプシステムを起動します。(この関数は対話的な使用のための
     ものです。) 引数が与えられていない場合、対話的ヘルプシステムはイン
     タプリタコンソール上で起動します。引数が文字列の場合、文字列はモジ
     ュール、関数、クラス、メソッド、キーワード、またはドキュメントの項
     目名として検索され、ヘルプページがコンソール上に印字されます。引数
     がその他のオブジェクトの場合、そのオブジェクトに関するヘルプページ
     が生成されます。

     *note help(): ad4. を呼び出したときに関数の引数リストにスラッシュ
     (/) が現れた場合は、スラッシュより前の引数が位置専用引数だという意
     味であることに注意してください。より詳しい情報は、 *note
     位置専用引数についての FAQ の項目: 25d6. を参照してください。

     この関数は、 *note site: cc. モジュールから、組み込みの名前空間に移
     されました。

     バージョン 3.4 で変更: *note pydoc: ba. と *note inspect: 82. への
     変更により、呼び出し可能オブジェクトの報告されたシグニチャがより包
     括的で一貫性のあるものになりました。

 -- の関数: hex (integer, /)

     整数を先頭に "0x" が付いた小文字の 16 進文字列に変換します。
     'integer' が Python の *note int: 19b. オブジェクトでない場合、整数
     を返す *note __index__(): 19e. メソッドが定義されていなければなりま
     せん。 いくつかの例を示します:

          >>> hex(255)
          '0xff'
          >>> hex(-42)
          '-0x2a'

     整数を大文字の 16 進文字列や小文字の 16 進文字列、先頭の "0x" 付き
     や "0x" 無しに変換したい場合は、次に挙げる方法が使えます:

          >>> '%#x' % 255, '%x' % 255, '%X' % 255
          ('0xff', 'ff', 'FF')
          >>> format(255, '#x'), format(255, 'x'), format(255, 'X')
          ('0xff', 'ff', 'FF')
          >>> f'{255:#x}', f'{255:x}', f'{255:X}'
          ('0xff', 'ff', 'FF')

     より詳しいことは *note format(): 199. も参照してください。

     16を底として16進数文字列を整数に変換するには *note int(): 19b. も参
     照してください。

          注釈: 浮動小数点数の16進文字列表記を得たい場合には、 *note
          float.hex(): 2103. メソッドを使って下さい。

 -- の関数: id (object, /)

     オブジェクトの "識別値" を返します。この値は整数で、このオブジェク
     トの有効期間中は一意かつ定数であることが保証されています。有効期間
     が重ならない 2 つのオブジェクトは同じ *note id(): 163c. 値を持つか
     もしれません。

     これはオブジェクトのメモリアドレスです。

     引数 ‘id’ を指定して *note 監査イベント: 1c6e. ‘builtins.id’ を送出
     します。

 -- の関数: input ()

 -- の関数: input (prompt, /)

     引数 'prompt' が存在すれば、それが末尾の改行を除いて標準出力に書き
     出されます。次に、この関数は入力から 1 行を読み込み、文字列に変換し
     て (末尾の改行を除いて) 返します。 EOF が読み込まれたとき、 *note
     EOFError: 14f1. が送出されます。例:

          >>> s = input('--> ')
          --> Monty Python's Flying Circus
          >>> s
          "Monty Python's Flying Circus"

     *note readline: bf. モジュールが読み込まれていれば、 *note input():
     14f0. はそれを使って精緻な行編集やヒストリ機能を提供します。

     入力を読み込む前に、引数 ‘prompt’ 付きで *note 監査イベント: 1c6e.
     ‘builtins.input’ を送出します。

     入力の読み込みに成功した後に、その結果付きで *note 監査イベント:
     1c6e. ‘builtins.input/result’ を送出します。

 -- クラス: int (number=0, /)

 -- クラス: int (string, /, base=10)

     数または文字列から生成された整数オブジェクトを返します。引数が指定
     されない場合は ‘0’ を返します。

     例:

          >>> int(123.45)
          123
          >>> int('123')
          123
          >>> int('   -12_345\n')
          -12345
          >>> int('FACE', 16)
          64206
          >>> int('0xface', 0)
          64206
          >>> int('01110011', base=2)
          115

     引数に *note __int__(): 19d. が定義されている場合は、 ‘int(x)’ は
     ‘x.__int__()’ を返します。引数に *note __index__(): 19e. が定義され
     ている場合は、 ‘x.__index__()’ を返します。浮動小数点数については、
     これは 0 に近い側へ切り捨てます。

     引数が数値でないか、または 'base' が与えられた場合、引数は 'base' を
     基数とした整数を表現する文字列、 *note bytes: 192. インスタンス、ま
     たは *note bytearray: 344. インスタンスのいずれかでなければなりませ
     ん。文字列は先頭に ‘+’ または ‘-’ を伴ったり (符号と数値の間に空白
     文字を入れてはいけません)、数値の先頭に任意の数のゼロを付けたり、前
     後に空白文字を付けたり、各桁を単一の下線で区切ったりしても有効です
     。

     n-進数の整数文字列は、各桁が0から n-1 の数値で表されます。ユニコー
     ドの10進数では、各桁は0から9のいずれかです。また10から35までの値は
     ‘a’ から ‘z’ (または ‘A’ から ‘Z’) で表されます。デフォルトの
     'base' は10です。基数に指定可能な値は0および2から36までの整数です。
     2進数、8進数、16進数の文字列は、整数リテラルと同様に、それぞれ
     ‘0b’/‘0B’, ‘0o’/‘0O’, または ‘0x’/‘0X’ をプレフィックスとして追加す
     ることができます。基数を0に指定した場合、文字列は *note
     コードにおける整数リテラル: 230b. と同じように解釈されます。すなわ
     ち、プレフィックスによって基数が2, 8, 10, または 16 のどれになるか
     が決まります。基数を0にした場合先頭にゼロを追加することはできません
     : すなわち ‘int('010', 0)’ は基数を0に指定しているため不正ですが、
     ‘int('010')’ や ‘int('010', 8)’ は有効です。

     整数型については、 *note 数値型 int, float, complex: 1fdc. も参照し
     てください。

     バージョン 3.4 で変更: 'base' が *note int: 19b. のインスタンスでな
     く、'base' オブジェクトが *note base.__index__: 19e. メソッドを持っ
     ている場合、そのメソッドを呼んで底に対する整数を得ることができます
     。以前のバージョンでは *note base.__index__: 19e. ではなく *note
     base.__int__: 19d. を使用していました。

     バージョン 3.6 で変更: コードリテラル中で桁をグループ化するのにアン
     ダースコアを利用できます。

     バージョン 3.7 で変更: 第1引数は位置専用になりました。

     バージョン 3.8 で変更: *note __int__(): 19d. が定義されていない場合
     、 *note __index__(): 19e. へフォールバックします。

     バージョン 3.11 で変更: *note int: 19b. への文字列入力やその文字列
     表現は、サービス拒否攻撃 (DoS 攻撃) を避けるために制限されることが
     あります。文字列を *note int: 19b. に変換したり *note int: 19b. を
     文字列に変換したりする際にその制限を超えた場合、 *note ValueError:
     2ec. が送出されます。詳しくは *note
     整数文字列の変換における長さ制限: 80b. を参照してください。

     バージョン 3.14 で変更: *note int(): 19b. no longer delegates to
     the *note __trunc__(): 19c. method.

 -- の関数: isinstance (object, classinfo, /)

     'object' 引数が 'classinfo' 引数に指定した型、またはその (直接、間
     接、または *note 仮想: 13ce. の) サブクラスのインスタンスである場合
     に ‘True’ を返します。 'object' が与えられた型のオブジェクトでない
     場合、この関数は常に ‘False’ を返します。 'classinfo' が型オブジェ
     クトのタプル (または再帰的にそのようなタプルを含むタプル) や複数の
     型の *note Union 型: 9c5. である場合、 'object' がそれらの型のいず
     れかのインスタンスであれば ‘True’ を返します。 'classinfo' が型や型
     からなるタプルまたは再帰的タプルのいずれでもない場合、 *note
     TypeError: 198. 例外が送出されます。タプルの中で先行する型に対する
     チェックが成功した場合、後続の不正な型に対して *note TypeError:
     198. が送出されないことがあります。

     バージョン 3.10 で変更: 'classinfo' に *note Union 型: 9c5. を指定
     できるようになりました。

 -- の関数: issubclass (class, classinfo, /)

     'class' が 'classinfo' の (直接、間接、または *note 仮想: 13ce. の)
     サブクラスである場合に ‘True’ を返します。クラスは自身のサブクラス
     とみなされます。 'classinfo' はクラスオブジェクトのタプル (または再
     帰的にそのようなタプルを含むタプル) やクラスオブジェクトの *note
     Union 型: 9c5. でもよく、この場合は 'class' が 'classinfo' のいずれ
     かのクラスのサブクラスであれば ‘True’ を返します。上記以外の値が指
     定された場合、 *note TypeError: 198. 例外が送出されます。

     バージョン 3.10 で変更: 'classinfo' に *note Union 型: 9c5. を指定
     できるようになりました。

 -- の関数: iter (iterable, /)

 -- の関数: iter (callable, sentinel, /)

     *note iterator: 4c8. オブジェクトを返します。第二引数があるかどうか
     によって第一引数の解釈は大きく異なります。第二引数がない場合、単一
     の引数は *note iterable: 12f1. プロトコル (*note __iter__(): e69. メ
     ソッド) をサポートするコレクションオブジェクトか、またはシーケンス
     プロトコル (‘0’ から始まる整数を引数にとる *note __getitem__():
     588. メソッド) をサポートするオブジェクトでなければなりません。第一
     引数がどちらのプロトコルもサポートしない場合は *note TypeError:
     198. 例外が送出されます。第二引数 'sentinel' が与えられた場合、第一
     引数は呼び出し可能オブジェクトでなければなりません。この場合に生成
     されるイテレータは *note __next__(): 14e5. メソッドを呼び出すごとに
     引数なしで 'callable' を呼び出します; 戻り値が 'sentinel' と等しけ
     れば、 *note StopIteration: df5. が送出されます。それ以外の場合は戻
     り値がそのまま返されます。

     *note イテレータ型: 25d7. も見てください。

     2引数形式の *note iter(): 9d7. の便利な利用方法の1つは、ブロックリ
     ーダーの構築です。 例えば、バイナリのデータベースファイルから固定幅
     のブロックをファイルの終端に到達するまで読み出すには次のようにしま
     す:

          from functools import partial
          with open('mydata.db', 'rb') as f:
              for block in iter(partial(f.read, 64), b''):
                  process_block(block)

 -- の関数: len (object, /)

     オブジェクトの長さ (要素の数) を返します。引数はシーケンス (文字列
     、バイト列、タプル、リスト、range 等) かコレクション (辞書、集合、
     凍結集合等) です。

     ‘len’ は、例えば *note range(2 ** 100): b3d. のような、 *note
     sys.maxsize: 13dd. を超える長さに対して *note OverflowError: a81. を
     送出します。

 -- クラス: list (iterable=(), /)

     *note list: 24d. は、実際には関数ではなくミュータブルなシーケンス型
     で、 *note リスト型 (list): 2022. と *note シーケンス型 -- list,
     tuple, range: 202e. にドキュメント化されています。

 -- の関数: locals ()

     現在のローカル シンボル テーブルを表すマッピング オブジェクトを返し
     ます。これは変数名をキーとし、現在バインドされている参照を値としま
     す。

     モジュール スコープでは、単一の名前空間で *note exec(): 4a2. や
     *note eval(): 4a3. を使う場合と同じく、この関数は *note globals():
     1c0a. と同じ名前空間を返します。

     クラス スコープでは、メタクラス コンストラクタに渡された名前空間を
     返します。

     ‘exec()’ や ‘eval()’ が引数 local と global が分けて使われてる場合
     では、関数の呼び出しで渡されたローカル名前空間を返します。

     上記どの場合でも、特定の実行フレーム内での各 ‘locals()’ は '同じ' マ
     ッピング オブジェクトを返します。 ‘locals()’ から返されたマッピング
     オブジェクトを通じて行われた変更は、代入、再代入、または削除された
     ローカル変数として可視化されます。そしてローカル変数の代入、再代入
     、または削除は、返されたマッピング オブジェクトの内容へ直ちに反映さ
     れます。

     *note optimized scope: 4a1. （関数、ジェネレーター、コルーチンを含
     む）では、 ‘locals()’ を呼び出すと、代わりに関数のローカル変数と非
     ローカル セル参照の現在のバインディングを含んだ新しい辞書を返します
     。この場合、返された辞書を使って行われた変更は、対応するローカル変
     数や非ローカル セル参照には '書き戻されません' 。また、ローカル変数
     や非ローカル セル参照へ代入、再代入、削除を行っても、以前に返された
     辞書の内容には '影響しません' 。

     ‘locals()’ 呼び出しが関数、ジェネレータ、コルーチン内の内包表記内に
     あれば、これはそれを含むスコープから呼び出すことと同等です。ただし
     内包表記の初期化された反復変数が含まれます。他のスコープでは、内包
     表記がネストされた関数として実行されているかのように振舞います。

     ‘locals()’ 呼び出しがジェネレータ式の一部であれば、ネストされたジェ
     ネレータ関数内の呼び出しと同等です。

     バージョン 3.12 で変更: 内包表記における ‘locals()’ の振る舞い は、
     PEP 709(2) で説明されているように更新されました。

     バージョン 3.13 で変更: PEP 667(3) の一部として、この関数から返され
     るマッピングオブジェクトを変更するセマンティクスが定義されました。
     *note optimized scopes: 4a1. の振る舞いは上記のようになりました。定
     義されただけで、その他のスコープの振る舞いは以前のバージョンのまま
     です。

 -- の関数: map (function, iterable, /, *iterables, strict=False)

     Return an iterator that applies 'function' to every item of
     'iterable', yielding the results.  If additional 'iterables'
     arguments are passed, 'function' must take that many arguments and
     is applied to the items from all iterables in parallel.  With
     multiple iterables, the iterator stops when the shortest iterable
     is exhausted.  If 'strict' is ‘True’ and one of the iterables is
     exhausted before the others, a *note ValueError: 2ec. is raised.
     For cases where the function inputs are already arranged into
     argument tuples, see *note itertools.starmap(): 12fa.

     バージョン 3.14 で変更: 'strict' パラメータが追加されました。

 -- の関数: max (iterable, /, *, key=None)

 -- の関数: max (iterable, /, *, default, key=None)

 -- の関数: max (arg1, arg2, /, *args, key=None)

     iterable の中で最大の要素、または2つ以上の引数の中で最大のものを返
     します。

     位置引数が1つだけ与えられた場合、それは空でない *note iterable:
     12f1. でなくてはいけません。その iterable の最大の要素が返されます
     。2 つ以上のキーワード無しの位置引数が与えられた場合、その位置引数
     の中で最大のものが返されます。

     任意のキーワード専用引数が 2 つあります。 'key' 引数は引数を 1 つ取
     る順序関数 (*note list.sort(): dc8. のもののように) を指定します。
     'default' 引数は与えられたイテラブルが空の場合に返すオブジェクトを
     指定します。 イテラブルが空で 'default' が与えられていない場合
     *note ValueError: 2ec. が送出されます。

     最大の要素が複数あるとき、この関数はそのうち最初に現れたものを返し
     ます。これは、‘sorted(iterable, key=keyfunc, reverse=True)[0]’ や
     ‘heapq.nlargest(1, iterable, key=keyfunc)’ のような、他のソート安定
     性を維持するツールと両立します。

     バージョン 3.4 で変更: キーワード専用引数 'default' が追加されまし
     た。

     バージョン 3.8 で変更: 'key' 引数が ‘None’ であることを許容します。

 -- クラス: memoryview (object)

     与えられたオブジェクトから作られた "メモリビュー" オブジェクトを返
     します。詳しくは *note メモリビュー: 25d8. を参照してください。

 -- の関数: min (iterable, /, *, key=None)

 -- の関数: min (iterable, /, *, default, key=None)

 -- の関数: min (arg1, arg2, /, *args, key=None)

     iterable の中で最小の要素、または2つ以上の引数の中で最小のものを返
     します。

     位置引数が1つだけ与えられた場合、それは空でない *note iterable:
     12f1. でなくてはいけません。その iterable の最小の要素が返されます
     。2 つ以上のキーワード無しの位置引数が与えられた場合、その位置引数
     の中で最小のものが返されます。

     任意のキーワード専用引数が 2 つあります。 'key' 引数は引数を 1 つ取
     る順序関数 (*note list.sort(): dc8. のもののように) を指定します。
     'default' 引数は与えられたイテラブルが空の場合に返すオブジェクトを
     指定します。 イテラブルが空で 'default' が与えられていない場合
     *note ValueError: 2ec. が送出されます。

     最小の要素が複数あるとき、この関数はそのうち最初に現れたものを返し
     ます。これは、‘sorted(iterable, key=keyfunc)[0]’ や
     ‘heapq.nsmallest(1, iterable, key=keyfunc)’ のような、他のソート安
     定性を維持するツールと両立します。

     バージョン 3.4 で変更: キーワード専用引数 'default' が追加されまし
     た。

     バージョン 3.8 で変更: 'key' 引数が ‘None’ であることを許容します。

 -- の関数: next (iterator, /)

 -- の関数: next (iterator, default, /)

     *note iterator: 4c8. の *note __next__(): 14e5. メソッドを呼び出す
     ことにより、次の要素を取得します。イテレータが使い尽くされた場合、
     'default' が与えられていればその値が返されます。そうでない場合は
     *note StopIteration: df5. が送出されます。

 -- クラス: object

     This is the ultimate base class of all other classes.  It has
     methods that are common to all instances of Python classes.  When
     the constructor is called, it returns a new featureless object.
     The constructor does not accept any arguments.

          注釈: *note object: c7e. インスタンスは *note __dict__: 77d. 属
          性を '持たない' ので、 *note object: c7e. クラスのインスタンス
          に任意の属性を代入することはできません。

 -- の関数: oct (integer, /)

     整数を先頭に "0o" が付いた 8 進文字列に変換します。 結果は Python の
     式としても使える形式になります。 'integer' が Python の *note int:
     19b. オブジェクトでない場合、整数を返す *note __index__(): 19e. メ
     ソッドが定義されていなければなりません。 例えば、次のようになります
     :

          >>> oct(8)
          '0o10'
          >>> oct(-56)
          '-0o70'

     整数を接頭辞 "0o" 付きや "0o" 無しの 8 進文字列に変換したい場合は、
     次に挙げる方法のいずれかを使ってください。

          >>> '%#o' % 10, '%o' % 10
          ('0o12', '12')
          >>> format(10, '#o'), format(10, 'o')
          ('0o12', '12')
          >>> f'{10:#o}', f'{10:o}'
          ('0o12', '12')

     より詳しいことは *note format(): 199. も参照してください。

 -- の関数: open (file, mode='r', buffering=-1, encoding=None,
          errors=None, newline=None, closefd=True, opener=None)

     'file' を開き、対応する *note ファイルオブジェクト: 13db. を返しま
     す。ファイルを開くことができなければ、*note OSError: 2c0. が送出さ
     れます。 この関数の利用例について、 *note ファイルを読み書きする:
     2066. を参照してください。

     'file' は *note path-like object: 5a1. で、開くファイルのパス名 (絶
     対パスまたは現在の作業ディレクトリからの相対パス) あるいはラップす
     るファイルの整数のファイルデスクリプタを与えます。 (ファイルデスク
     リプタが与えられた場合、 'closefd' が ‘False’ に設定されていないか
     ぎり、この関数が返す I/O オブジェクトがクローズされるときにファイル
     デスクリプタもクローズされます。)

     'mode' オプション文字列はファイルが開かれる際のモードを指定します。
     デフォルトは ‘'r'’ で、読み込み用にテキストモードで開くという意味で
     す。その他によく使われるモードとして、書き込み用の ‘'w'’ (ファイル
     が既に存在する場合は上書きします) 、排他的な生成をあらわす ‘'x'’ 、
     そして追記用の ‘'a'’ ( 'いくつかの' Unix システムでは、 'すべての'
     書き込みは現在のシーク位置にかかわらずファイルの末尾に追記する、と
     いう意味です) です。テキストモードで 'encoding' が指定されない場合
     に使われるエンコーディングは、プラットフォーム依存です: 現在のロケ
     ールエンコーディングを取得するために *note locale.getencoding():
     329. が呼ばれます。 (生のバイトデータを読み書きする際にはバイナリモ
     ードを使い、 'encoding' は指定しません。) 指定できるモードは以下の
     通りです:

     文字          意味
                   
     ----------------------------------------------------------------------------------
                   
     ‘'r'’         読み込み用に開く (デフォルト)
                   
                   
     ‘'w'’         書き込み用に開き、まずファイルを切り詰める
                   
                   
     ‘'x'’         排他的な生成に開き、ファイルが存在する場合は失敗する
                   
                   
     ‘'a'’         書き込み用に開き、ファイルが存在する場合には末尾に追記する
                   
                   
     ‘'b'’         バイナリモード
                   
                   
     ‘'t'’         テキストモード (デフォルト)
                   
                   
     ‘'+'’         更新用に開く (読み込み・書き込み用)
                   

     デフォルトのモードは ‘'r'’ (テキストの読み込み用に開く、 ‘'rt'’ と
     同義) です。 ‘'w+'’ と ‘'w+b'’ はファイルを開いて上書きします。
     ‘'r+'’ と ‘'r+b'’ はファイルを上書きせずに開きます。

     *note 概要: 25da. で触れられているように、Python はバイナリとテキス
     トの I/O を区別します。('mode' 引数に ‘'b'’ を含めて) バイナリモー
     ドで開かれたファイルは、内容をいかなるデコーディングもせずに *note
     bytes: 192. オブジェクトとして返します。(デフォルトや、 'mode' 引数
     に ‘'t'’ が含まれたときの) テキストモードでは、ファイルの内容は
     *note str: 169. として返され、バイト列はまず、プラットフォーム依存
     のエンコーディングか、'encoding' が指定された場合は指定されたエンコ
     ーディングを使ってデコードされます。

          注釈: Python は、下層のオペレーティングシステムがテキストファ
          イルをどう認識するかには依存しません; すべての処理は Python 自
          身で行われ、よってプラットフォーム非依存です。

     'buffering' はオプションの整数で、バッファリングのポリシーを設定す
     るために使われます。 バッファリングを無効化するためには0を渡してく
     ださい (バイナリモードでのみ設定可能です)。また行単位でのバッファリ
     ングには1を設定してください (テキストモードでの書き込み時のみ有効で
     す)。固定サイズのチャンクバッファに対するサイズをバイト単位で指定し
     たい場合は、1より大きい整数を渡してください。この形式でバッファサイ
     ズを指定した場合、バイナリ形式でバッファリングをサポートする I/O
     (buffered I/O) にはそのまま適用されますが、 ‘TextIOWrapper’ (すなわ
     ち ‘mode='r+'’ のモードでオープンされたファイル) では別のバッファリ
     ングを行うかもしれません。 ‘TextIOWrapper’ でバッファリングを無効化
     するには、 *note io.TextIOWrapper.reconfigure(): d40. で
     ‘write_through’ フラグを使うことを検討してください。 'buffering' 引
     数が与えられなかった場合、デフォルトのバッファリングポリシーは以下
     のように動作します:

        * Binary files are buffered in fixed-size chunks; the size of
          the buffer is ‘max(min(blocksize, 8 MiB),
          DEFAULT_BUFFER_SIZE)’ when the device block size is available.
          On most systems, the buffer will typically be 128 kilobytes
          long.

        * 「対話的な」テキストファイル (*note isatty(): 2069. が ‘True’
          を返すファイル) は行バッファリングを使用します。 その他のテキ
          ストファイルは、上で説明したバイナリファイル用の方針を使用しま
          す。

     'encoding' はファイルのエンコードやデコードに使われる *note text
     encoding: 25db. の名前です。このオプションはテキストモードでのみ使
     用してください。デフォルトエンコーディングはプラットフォーム依存
     (*note locale.getencoding(): 329. が返すもの) ですが、Pythonでサポ
     ートされているエンコーディングはどれでも使えます。詳しくは *note
     codecs: 1c. モジュール内のサポートしているエンコーディングのリスト
     を参照してください。

     'errors' はオプションの文字列で、エンコードやデコードでのエラーをど
     のように扱うかを指定するものです。バイナリモードでは使用できません
     。様々な標準のエラーハンドラが使用可能です (*note エラーハンドラ:
     1b6f. に列記されています) が、 *note codecs.register_error(): 16b4.
     に登録されているエラー処理の名前も使用可能です。標準のエラーハンド
     ラの名前には、以下のようなものがあります:

        * ‘'strict'’ はエンコーディングエラーがあると例外 *note
          ValueError: 2ec. を発生させます。デフォルト値である ‘None’ も
          同じ効果です。

        * ‘'ignore'’ はエラーを無視します。エンコーディングエラーを無視
          することで、データが失われる可能性があることに注意してください
          。

        * ‘'replace'’ は、不正な形式のデータが存在した場所に(‘'?'’ のよ
          うな) 置換マーカーを挿入します。

        * ‘'surrogateescape'’ は正しくないバイト列をユニコードの下位サロ
          ゲート領域のうち U+DC80 から U+DCFF の範囲のコードユニットであ
          らわします。データの書き込み時に ‘surrogateescape’ エラーハン
          ドラが使われると、これらのサロゲートコードユニットは元と同じバ
          イト列に変換されます。これはエンコーディングが不明なファイルを
          処理するのに便利です。

        * ‘'xmlcharrefreplace'’ はファイルへの書き込み時のみサポートされ
          ます。そのエンコーディングでサポートされない文字は、‘&#NNN;’ 形
          式の適切な XML 文字参照で置換されます。

        * ‘'backslashreplace'’ は不正なデータを Python のバックスラッシ
          ュ付きのエスケープシーケンスで置換します。

        * ‘'namereplace'’ (書き込み時のみサポートされています) はサポー
          トされていない文字を ‘\N{...}’ エスケープシーケンスで置換しま
          す。

     'newline' はストリームから受け取った改行文字をどのようにパースする
     かを決定します。 ‘None’, ‘''’, ‘'\n'’, ‘'\r'’, または ‘'\r\n'’ のい
     ずれかを指定できます。これは以下のように動作します:

        * ストリームからの入力の読み込み時、'newline' が ‘None’ の場合、
          ユニバーサル改行モードが有効になります。入力中の行は ‘'\n'’,
          ‘'\r'’, または ‘'\r\n'’ で終わり、呼び出し元に返される前に
          ‘'\n'’ に変換されます。 ‘''’ の場合、ユニバーサル改行モードは
          有効になりますが、行末は変換されずに呼び出し元に返されます。そ
          の他の正当な値の場合、入力行は与えられた文字列でのみ終わり、行
          末は変換されずに呼び出し元に返されます。

        * ストリームへの出力の書き込み時、'newline' が ‘None’ の場合、全
          ての ‘'\n'’ 文字はシステムのデフォルトの行セパレータ *note
          os.linesep: 25dc. に変換されます。 'newline' が ‘''’ または
          ‘'\n'’ の場合は変換されません。'newline' がその他の正当な値の
          場合、全ての ‘'\n'’ 文字は与えられた文字列に変換されます。

     'closefd' が ‘False’ で、ファイル名ではなくてファイル記述子が与えら
     れた場合、下層のファイル記述子はファイルが閉じられた後も開いたまま
     となります。 ファイル名が与えられた場合、'closefd' は ‘True’ (デフ
     ォルト値) でなければなりません。 そうでない場合エラーが送出されます
     。

     呼び出し可能オブジェクトを 'opener' として与えることで、カスタムの
     オープナーが使えます。そしてファイルオブジェクトの下層のファイル記
     述子は、'opener' を ('file', 'flags') で呼び出して得られます。
     'opener' は開いたファイル記述子を返さなければなりません。 (*note
     os.open: f92. を 'opener' として渡すと、‘None’ を渡したのと同様の機
     能になります)。

     新たに作成されたファイルは *note 継承不可: 10fc. です。

     次の例は *note os.open(): f92. 関数の *note dir_fd: 1302. 引数を使
     い、与えられたディレクトリからの相対パスで指定されたファイルを開き
     ます:

          >>> import os
          >>> dir_fd = os.open('somedir', os.O_RDONLY)
          >>> def opener(path, flags):
          ...     return os.open(path, flags, dir_fd=dir_fd)
          ...
          >>> with open('spamspam.txt', 'w', opener=opener) as f:
          ...     print('This will be written to somedir/spamspam.txt', file=f)
          ...
          >>> os.close(dir_fd)  # ファイル記述子の解放漏れがないように

     *note open(): 316. 関数が返す *note file object: 13db. の型はモード
     に依存します。 *note open(): 316. をファイルをテキストモード
     (‘'w'’, ‘'r'’, ‘'wt'’, ‘'rt'’, など) で開くのに使ったときは *note
     io.TextIOBase: 8a4. (特に *note io.TextIOWrapper: 9be.) のサブクラ
     スを返します。 ファイルをバッファリング付きのバイナリモードで開くの
     に使ったときは *note io.BufferedIOBase: 8a3. のサブクラスを返します
     。 実際のクラスは様々です。 読み込みバイナリモードでは *note
     io.BufferedReader: 1427. を返します。 書き込みバイナリモードや追記
     バイナリモードでは *note io.BufferedWriter: 15cb. を返します。 読み
     書きモードでは *note io.BufferedRandom: 15cc. を返します。 バッファ
     リングが無効なときはrawストリーム、すなわち *note io.RawIOBase:
     12e7. のサブクラスである *note io.FileIO: 1527. を返します。

     *note fileinput: 5f. 、(*note open(): 316. が宣言された場所である)
     *note io: 83. 、 *note os: a5. 、 *note os.path: a6. 、 *note
     tempfile: e6. 、 *note shutil: ca. などの、ファイル操作モジュールも
     参照してください。

     引数 ‘path’, ‘mode’, ‘flags’ を指定して *note 監査イベント: 1c6e.
     ‘open’ を送出します。

     ‘mode’ と ‘flags’ の2つの引数は呼び出し時の値から修正されたり、推量
     により設定されたりする可能性があります。

     バージョン 3.3 で変更:

        * 'opener' 引数を追加しました。

        * ‘'x'’ モードを追加しました。

        * 以前は *note IOError: 125e. が送出されました; それは現在 *note
          OSError: 2c0. のエイリアスです。

        * 既存のファイルを 排他的生成モード(‘'x'’)で開いた場合、 *note
          FileExistsError: 1221. を送出するようになりました。

     バージョン 3.4 で変更:

        * ファイルが継承不可になりました。

     バージョン 3.5 で変更:

        * システムコールが中断されシグナルハンドラが例外を送出しなかった
          場合、この関数は *note InterruptedError: f88. 例外を送出する代
          わりにシステムコールを再試行するようになりました (論拠について
          は PEP 475(4) を参照してください)。

        * ‘'namereplace'’ エラーハンドラが追加されました。

     バージョン 3.6 で変更:

        * *note os.PathLike: e4b. を実装したオブジェクトを受け入れるよう
          になりました。

        * Windowsでは、コンソールバッファのオープンは、*note io.FileIO:
          1527. ではなく、*note io.RawIOBase: 12e7. のサブクラスを返すで
          しょう。

     バージョン 3.11 で変更: ‘'U'’ モードは削除されました。

 -- の関数: ord (character, /)

     Return the ordinal value of a character.

     If the argument is a one-character string, return the Unicode code
     point of that character.  For example, ‘ord('a')’ returns the
     integer ‘97’ and ‘ord('€')’ (Euro sign) returns ‘8364’.  This is
     the inverse of *note chr(): 19ef.

     If the argument is a *note bytes: 192. or *note bytearray: 344.
     object of length 1, return its single byte value.  For example,
     ‘ord(b'a')’ returns the integer ‘97’.

 -- の関数: pow (base, exp, mod=None)

     'base' の 'exp' 乗を返します; 'mod' があれば、'base' の 'exp' 乗に
     対する 'mod' の剰余を返します (‘pow(base, exp) % mod’ より効率よく
     計算されます)。二引数の形式 ‘pow(base, exp)’ は、冪乗演算子を使った
     ‘base**exp’ と等価です。

     When arguments are builtin numeric types with mixed operand types,
     the coercion rules for binary arithmetic operators apply.  For
     *note int: 19b. operands, the result has the same type as the
     operands (after coercion) unless the second argument is negative;
     in that case, all arguments are converted to float and a float
     result is delivered.  For example, ‘pow(10, 2)’ returns ‘100’, but
     ‘pow(10, -2)’ returns ‘0.01’.  For a negative base of type *note
     int: 19b. or *note float: 196. and a non-integral exponent, a
     complex result is delivered.  For example, ‘pow(-9, 0.5)’ returns a
     value close to ‘3j’.  Whereas, for a negative base of type *note
     int: 19b. or *note float: 196. with an integral exponent, a float
     result is delivered.  For example, ‘pow(-9, 2.0)’ returns ‘81.0’.

     'base' と 'exp' が *note int: 19b. オペランドで 'mod' が存在すると
     き、 'mod' もまた整数型でなければならず、かつゼロであってはいけませ
     ん。 'mod' が存在して 'exp' が負の整数の場合、 'base' は 'mod' と互
     いに素 (最大公約数が1) でなければなりません。この場合、 'inv_base'
     を 'base' に対する 'mod' を法とするモジュラ逆数 ('base' と
     'inv_base' の積を 'mod' で割った余りが1になるような数) として、
     ‘pow(inv_base, -exp, mod)’ が返されます。

     以下は ‘97’ を法とする ‘38’ のモジュラ逆数の計算例です:

          >>> pow(38, -1, mod=97)
          23
          >>> 23 * 38 % 97 == 1
          True

     バージョン 3.8 で変更: *note int: 19b. オペランドに対して、三引数形
     式の ‘pow’ で第二引数に負の値を取ることができるようになりました。こ
     れによりモジュラ逆数の計算が可能になります。

     バージョン 3.8 で変更: キーワード引数を取ることができるようになりま
     した。以前は位置引数だけがサポートされていました。

 -- の関数: print (*objects, sep=' ', end='\n', file=None, flush=False)

     'objects' を 'sep' で区切りながらテキストストリーム 'file' に表示し
     、最後に 'end' を表示します。'sep' 、 'end' 、 'file' 、 'flush' を
     与える場合、キーワード引数として与える必要があります。

     キーワードなしの引数はすべて、 *note str(): 169. がするように文字列
     に変換され、 'sep' で区切られながらストリームに書き出され、最後に
     'end' が続きます。 'sep' と 'end' の両方とも、文字列でなければなり
     ません。これらを ‘None’ にすると、デフォルトの値が使われます。
     'objects' が与えられなければ、 *note print(): 1177. は 'end' だけを
     書き出します。

     'file' 引数は、 ‘write(string)’ メソッドを持つオブジェクトでなけれ
     ばなりません。指定されないか、 ‘None’ である場合、 *note
     sys.stdout: ccd. が使われます。表示される引数は全てテキスト文字列に
     変換されますから、 *note print(): 1177. はバイナリモードファイルオ
     ブジェクトには使用できません。代わりに ‘file.write(...)’ を使ってく
     ださい。

     出力がバッファ化されるかどうかは通常 'file' で決まりますが、'flush'
     キーワード引数が真ならストリームは強制的にフラッシュされます。

     バージョン 3.3 で変更: キーワード引数 'flush' が追加されました。

 -- クラス: property (fget=None, fset=None, fdel=None, doc=None)

     property 属性を返します。

     'fget' は属性値を取得するための関数です。'fset' は属性値を設定する
     ための関数です。'fdel' は属性値を削除するための関数です。'doc' は属
     性の docstring を作成します。

     典型的な使用法は、属性 ‘x’ の処理の定義です:

          class C:
              def __init__(self):
                  self._x = None

              def getx(self):
                  return self._x

              def setx(self, value):
                  self._x = value

              def delx(self):
                  del self._x

              x = property(getx, setx, delx, "I'm the 'x' property.")

     'c' が 'C' のインスタンスならば、‘c.x’ は getter を呼び出し、‘c.x =
     value’ は setter を、‘del c.x’ は deleter を呼び出します。

     'doc' は、与えられれば property 属性のドキュメント文字列になります
     。 与えられなければ、 property は 'fget' のドキュメント文字列 (もし
     あれば) をコピーします。 そのため *note property(): 4b3. を *note
     デコレータ: 93a. として使えば、読み出し専用 property を作るのは容易
     です:

          class Parrot:
              def __init__(self):
                  self._voltage = 100000

              @property
              def voltage(self):
                  """Get the current voltage."""
                  return self._voltage

     ‘@property’ デコレータは ‘voltage()’ を同じ名前のまま 読み出し専用
     属性の "getter" にし、'voltage' のドキュメント文字列を "Get the
     current voltage."  に設定します。

      -- の関数: @getter

      -- の関数: @setter

      -- の関数: @deleter

          property オブジェクトは ‘getter’, ‘setter’, ‘deleter’ メソッド
          を持っています。これらのメソッドをデコレータとして使うと、対応
          するアクセサ関数がデコレートされた関数に設定された、 property
          のコピーを作成できます。 これを一番分かりやすく説明する例があ
          ります:

               class C:
                   def __init__(self):
                       self._x = None

                   @property
                   def x(self):
                       """I'm the 'x' property."""
                       return self._x

                   @x.setter
                   def x(self, value):
                       self._x = value

                   @x.deleter
                   def x(self):
                       del self._x

          このコードは最初の例と等価です。追加の関数には、必ず元の
          property と同じ名前 (この例では ‘x’) を与えて下さい。

          返される property オブジェクトも、コンストラクタの引数に対応し
          た ‘fget’, ‘fset’, および ‘fdel’ 属性を持ちます。

     バージョン 3.5 で変更: 属性オブジェクトのドックストリングが書き込み
     可能になりました。

      -- の属性: __name__

          プロパティ名を保持する属性。プロパティ名は実行時に変更できます
          。

          Added in version 3.13.

 -- クラス: range (stop, /)

 -- クラス: range (start, stop, step=1, /)

     *note range: b3d. は、実際には関数ではなくイミュータブルなシーケン
     ス型で、 *note range: 25dd. と *note シーケンス型 -- list, tuple,
     range: 202e. にドキュメント化されています。

 -- の関数: repr (object, /)

     オブジェクトの印字可能な表現を含む文字列を返します。この関数は多く
     の型について、 *note eval(): 4a3. に渡されたときと同じ値を持つよう
     なオブジェクトを表す文字列を生成しようとします。そうでない場合は、
     山括弧に囲まれたオブジェクトの型の名前と追加の情報 (大抵の場合はオ
     ブジェクトの名前とアドレスを含みます) を返します。クラスは、 *note
     __repr__(): 82f. メソッドを定義することで、この関数によりそのクラス
     のインスタンスが返すものを制御することができます。*note
     sys.displayhook(): 1738. にアクセスできない場合、この関数は *note
     RuntimeError: 244. を送出します。

     このクラスは、eval 評価可能な独自の representation を持ちます:

          class Person:
             def __init__(self, name, age):
                self.name = name
                self.age = age

             def __repr__(self):
                return f"Person('{self.name}', {self.age})"

 -- の関数: reversed (object, /)

     要素を逆順に取り出すイテレータ (reverse *note iterator: 4c8.) を返
     します。引数は *note __reversed__(): e86. メソッドを持つか、シーケ
     ンス型プロトコル ( *note __len__(): 178f. メソッド、および、 ‘0’ 以
     上の整数を引数とする *note __getitem__(): 588. メソッド) をサポート
     するオブジェクトでなければなりません。

 -- の関数: round (number, ndigits=None)

     'number' を小数点以下 'ndigits' 桁の精度で丸めた値を返します。
     'ndigits' が省略されたり、‘None’ だった場合、入力値に最も近い整数を
     返します。

     *note round(): 14f2. をサポートする組み込み型では、値は 10 のマイナ
     ス 'ndigits' 乗の倍数の中で最も近いものに丸められます; 二つの倍数が
     同じだけ近いなら、偶数を選ぶ方に (そのため、例えば ‘round(0.5)’ と
     ‘round(-0.5)’ は両方とも ‘0’ に、 ‘round(1.5)’ は ‘2’ に) 丸められ
     ます。 'ndigits' には任意の整数値が有効となります (正の整数、ゼロ、
     負の整数)。 返り値は 'ndigits' が指定されていないか ‘None’ の場合は
     整数、そうでなければ返り値は 'number' と同じ型です。

     一般的な Python オブジェクト ‘number’ に対して、‘round’ は処理を
     ‘number.__round__’ に移譲します。

          注釈: 浮動小数点数に対する *note round(): 14f2. の振る舞いは意
          外なものかもしれません: 例えば、 ‘round(2.675, 2)’ は予想通り
          の ‘2.68’ ではなく ‘2.67’ を与えます。これはバグではありません
          : これはほとんどの小数が浮動小数点数で正確に表せないことの結果
          です。詳しくは *note 浮動小数点演算、その問題と制限: 2101. を
          参照してください。

 -- クラス: set (iterable=(), /)

     オプションで 'iterable' の要素を持つ、新しい *note set: 184. オブジ
     ェクトを返します。 ‘set’ は組み込みクラスです。このクラスについて詳
     しい情報は *note set: 184. や *note set（集合）型 -- set,
     frozenset: 2031. を参照してください。

     他のコンテナについては *note collections: 1e. モジュールや組み込み
     の *note frozenset: 7f2. 、 *note list: 24d. 、 *note tuple: 614. 、
     *note dict: 183. クラスを参照してください。

 -- の関数: setattr (object, name, value, /)

     *note getattr(): dca. の相方です。引数はオブジェクト、文字列、それ
     から任意の値です。文字列は既存の属性または新たな属性の名前にできま
     す。この関数は指定したオブジェクトが許せば、値を属性に関連付けます
     。例えば、 ‘setattr(x, 'foobar', 123)’ は ‘x.foobar = 123’ と等価で
     す。

     *note __getattribute__(): dcb. のカスタマイズや *note __slots__:
     1704. を通じてオブジェクトが強制していない限り、 'name' は *note
     Names (identifiers and keywords): 22a0. で定義されている Python 識
     別子である必要はありません。属性名が識別子でない場合、ドットを使っ
     た属性へのアクセスはできませんが、 *note getattr(): dca. などを通じ
     てアクセス可能です。

          注釈: *note プライベートな名前のマングリング: 20a3. はコンパイ
          ル時に行われます。そのため、プライベートな属性 (先頭に2つのア
          ンダースコアを伴う名前を持つ属性) の値を *note setattr():
          25be. でセットするためには、属性名を手動でマングリングする必要
          があります。

 -- クラス: slice (stop, /)

 -- クラス: slice (start, stop, step=None, /)

     ‘range(start, stop, step)’ で指定されたインデックスのセットを表す
     *note slice: 24ae. オブジェクトを返します。 引数 'start' と 'step'
     のデフォルトは ‘None’ です。

     Slice objects are also generated when *note slicing syntax: 24ad.
     is used.  For example: ‘a[start:stop:step]’ or ‘a[start:stop, i]’.

     See *note itertools.islice(): d43. for an alternate version that
     returns an *note iterator: 4c8.

      -- の属性: start
      -- の属性: stop
      -- の属性: step

          These read-only attributes are set to the argument values (or
          their default).  They have no other explicit functionality;
          however, they are used by NumPy and other third-party
          packages.

     バージョン 3.12 で変更: スライスオブジェクトが *note hashable: 824.
     (ハッシュ可能) となりました (ただし、属性 *note start: 23a5. 、
     *note stop: 23a6. 、 *note step: 23a7. がすべてハッシュ可能である場
     合に限ります)。

 -- の関数: sorted (iterable, /, *, key=None, reverse=False)

     'iterable' の要素を並べ替えた新たなリストを返します。

     2 つのオプション引数があり、これらはキーワード引数として指定されな
     ければなりません。

     'key' には 1 引数関数を指定します。これは 'iterable' の各要素から比
     較キーを展開するのに使われます (例えば、 ‘key=str.lower’ のように指
     定します)。 デフォルト値は ‘None’ です (要素を直接比較します)。

     'reverse' は真偽値です。 ‘True’ がセットされた場合、リストの要素は
     個々の比較が反転したものとして並び替えられます。

     旧式の 'cmp' 関数を 'key' 関数に変換するには *note
     functools.cmp_to_key(): 13f2. を使用してください。

     組み込みの *note sorted(): dc7. 関数は安定なことが保証されています
     。同等な要素の相対順序を変更しないことが保証されていれば、ソートは
     安定です。これは複数のパスでソートを行なうのに役立ちます（例えば部
     署でソートしてから給与の等級でソートする場合）。

     ソートアルゴリズムは、要素間の比較に ‘<’ 演算子だけを使います。した
     がってソートのためには *note __lt__(): 14b8. メソッドを定義すれば十
     分なはずですが、 PEP 8(5) は6つの *note 比較演算子: 24d0. を全て実
     装することを推奨しています。これにより、異なるメソッドを必要とする
     *note max(): 110c. のような他のソートツールを、同じデータに対して適
     用することによって起こりうるバグを避ける助けになります。6つの比較演
     算子を全て実装することは、リフレクションによって *note __gt__():
     1523. メソッドを呼び出す可能性のある型混合の比較での混乱を避けるこ
     とにも役立ちます。

     ソートの例と簡単なチュートリアルは *note ソートのテクニック: 13f3.
     を参照して下さい。

 -- の関数: @staticmethod

     メソッドを静的メソッドへ変換します。

     静的メソッドは暗黙の第一引数を受け取りません。静的メソッドを宣言す
     るには、このイディオムを使ってください:

          class C:
              @staticmethod
              def f(arg1, arg2, argN): ...

     ‘@staticmethod’ 形式は関数 *note デコレータ: 93a. です。詳しくは
     *note 関数定義: 2018. を参照してください。

     静的メソッドは (‘C.f()’ のように) クラスに対して呼び出すことも、
     (‘C().f()’ のように) インスタンスに対して呼び出すこともできます。さ
     らに、静的メソッド *note descriptor: 1881. は呼び出し可能でもあるた
     め、(‘f()’ のように) クラス定義の中でも使用できます。

     Python における静的メソッドは Java や C++ における静的メソッドと類
     似しています。クラスコンストラクタの代替を生成するのに役立つ変種、
     *note classmethod(): 48e. も参照してください。

     あらゆるデコレータと同じく、 ‘staticmethod’ は普通の関数のように呼
     べ、その返り値で処理が行えます。 この機能は、クラス本体から関数を参
     照する必要があり、かつ、インスタンスメソッドに自動変換されるのを避
     けたいケースで必要になります。 そのようなケースでは、このイディオム
     が使えます:

          def regular_function():
              ...

          class C:
              method = staticmethod(regular_function)

     静的メソッドについて詳しい情報は *note 標準型の階層: 232f. を参照し
     てください。

     バージョン 3.10 で変更: Static methods now inherit the method
     attributes (*note __module__: 234a, *note __name__: 14ec, *note
     __qualname__: 2349, *note __doc__: 13f1. and *note __annotations__:
     13f0.), have a new ‘__wrapped__’ attribute, and are now callable as
     regular functions.

 -- クラス: str (*, encoding='utf-8', errors='strict')

 -- クラス: str (object)

 -- クラス: str (object, encoding, errors='strict')

 -- クラス: str (object, *, errors)

     'object' の *note str: 169. 版を返します。詳細は *note str(): 169.
     を参照してください。

     ‘str’ は組み込みの文字列 *note クラス: 1cfd. です。文字列に関する一
     般的な情報は、*note テキストシーケンス型 -- str: 1fe0. を参照してく
     ださい。

 -- の関数: sum (iterable, /, start=0)

     'start' と 'iterable' の要素を左から右へ合計し、総和を返します。
     'iterable' の要素は通常は数値で、start の値は文字列であってはなりま
     せん。

     使う場面によっては、 *note sum(): 695. よりもいい選択肢があります。
     文字列からなるシーケンスを結合する高速かつ望ましい方法は
     ‘''.join(sequence)’ を呼ぶことです。浮動小数点数値を拡張された精度
     で加算するには、 *note math.fsum(): 15ed. を参照してください。一連
     のイテラブルを連結するには、 *note itertools.chain(): 25de. の使用
     を考えてください。

     バージョン 3.8 で変更: 'start' パラメータをキーワード引数として指定
     することができるようになりました。

     バージョン 3.12 で変更: 浮動小数点数の総和を計算するとき、ほとんど
     の環境でより高精度な結果とより良い互換性が得られるアルゴリズムを使
     用するようになりました。

     バージョン 3.14 で変更: Added specialization for summation of
     complexes, using same algorithm as for summation of floats.

 -- クラス: super

 -- クラス: super (type, object_or_type=None, /)

     メソッドの呼び出しを 'type' の親または兄弟クラスに委譲するプロキシ
     オブジェクトを返します。これはクラスの中でオーバーライドされた継承
     メソッドにアクセスするのに便利です。

     'object_or_type' はメソッドの検索のための *note method resolution
     order: 25df. (メソッド解決順序) を決定します。検索は 'type' 直後の
     クラスから開始します。

     例えば 'object_or_type' の *note __mro__: 2378. 属性が ‘D -> B -> C
     -> A -> object’ であり、 'type' の値が ‘B’ だとすると、 *note
     super(): 1a6. は ‘C -> A -> object’ の順番でメソッドを検索します。

     The *note __mro__: 2378. attribute of the class corresponding to
     'object_or_type' lists the method resolution search order used by
     both *note getattr(): dca. and *note super(): 1a6.  The attribute
     is dynamic and can change whenever the inheritance hierarchy is
     updated.

     第 2 引数が省かれたなら、返されるスーパーオブジェクトは束縛されませ
     ん。第 2 引数がオブジェクトであれば、 ‘isinstance(obj, type)’ は真
     でなければなりません。第 2 引数が型であれば、 ‘issubclass(type2,
     type)’ は真でなければなりません (これはクラスメソッドに役に立つでし
     ょう)。

     クラスの通常のメソッド中で直接呼び出される場合、どちらの引数も省け
     ます (「ゼロ引数 ‘super()’ 」) 。この場合、 'type' はその囲んでいる
     クラスとなり、 'obj' は直接囲んでいる関数の第一引数 (通常は ‘self’
     ) となります。 (つまり、ゼロ引数 ‘super()’ は、ネストされた関数では
     期待どおりに動作しません。これには 暗にネストされた関数を作るジェネ
     レータ式も含まれます)

     'super' の典型的な用途は 2 つあります。第一に、単継承のクラス階層構
     造で 'super' は名前を明示することなく親クラスを参照するのに使え、そ
     れゆえコードをメンテナンスしやすくなります。この用途は他のプログラ
     ミング言語で見られる 'super' の用途によく似ています。

     2つ目の用途は動的な実行環境において協調的 (cooperative) な多重継承
     をサポートすることです。これは Python に特有の用途で、静的にコンパ
     イルされる言語や、単継承のみをサポートする言語には見られないもので
     す。この機能により、同じ名前のメソッドを実装する複数の基底クラスを
     使った "ダイヤモンド型* の継承構造を実装することができます。良い設
     計は、そのような実装において、どのような場合でも同じ呼び出しシグネ
     チャを持つように強制します。 (理由は呼び出しの順序が実行時に決定さ
     れること、呼び出し順序はクラス階層構造の変化に順応すること、そして
     呼び出し順序が実行時まで未知の兄弟クラスが含まれる場合があることで
     す)。

     両方の用途において、典型的なスーパークラスの呼び出しは次のようにな
     ります:

          class C(B):
              def method(self, arg):
                  super().method(arg)    # これは次と同じことを行います:
                                         # super(C, self).method(arg)

     メソッドのルックアップに加えて、 *note super(): 1a6. は属性のルック
     アップに対しても同様に動作します。考えうる用途のひとつは親クラスや
     兄弟クラスの *note descriptors: 1881. (デスクリプタ) を呼び出すこと
     です。

     なお、*note super(): 1a6. は ‘super().__getitem__(name)’ のような明
     示的なドット表記属性探索の束縛処理の一部として実装されています。こ
     れは、 *note __getattribute__(): dcb. メソッドを予測可能な順序でク
     ラスを検索するように実装し、協調的な多重継承をサポートすることで実
     現されています。従って、 *note super(): 1a6. は文や ‘super()[name]’
     のような演算子を使った暗黙の探索向けには定義されていません。

     また、 *note super(): 1a6. の使用は引数無しの形式を除きメソッド内部
     に限定されないことにも注目して下さい。2引数の形式は、必要な要素を正
     確に指定するので、適当な参照を作ることができます。クラス定義中にお
     ける引数無しの形式は、定義されているクラスを取り出すのに必要な詳細
     を、通常の方法で現在のインスタンスにアクセスするようにコンパイラが
     埋めるのではたらきます。

     *note super(): 1a6. を用いて協調的なクラスを設計する方法の実践的な
     提案は、 guide to using super()(6) を参照してください。

     バージョン 3.14 で変更: *note super: 1a6. オブジェクトは pickle 可
     能 かつ コピー可能 になりました。

 -- クラス: tuple (iterable=(), /)

     *note tuple: 614. は、実際は関数ではなくイミュータブルなシーケンス
     型で、*note タプル型 (tuple): 254a. と *note シーケンス型 -- list,
     tuple, range: 202e. にドキュメント化されています。

 -- クラス: type (object, /)

 -- クラス: type (name, bases, dict, /, **kwargs)

     引数が1つだけの場合、'object' の型を返します。返り値は型オブジェク
     トで、一般に *note object.__class__: 16c6. によって返されるのと同じ
     オブジェクトです。

     オブジェクトの型の判定には、 *note isinstance(): 2ad. 組み込み関数
     を使うことが推奨されます。これはサブクラスを考慮するからです。

     引数が3つの場合、新しい型オブジェクトを返します。これは本質的には
     *note class: 14ef. 文の動的な書式です。 'name' 文字列はクラス名で、
     *note __name__: 16c4. 属性になります。 'bases' 基底クラスのタプルで
     、 *note __bases__: 16c5. 属性になります; 空の場合は全てのクラスの
     基底クラスである *note object: c7e. が追加されます。 'dict' は、ク
     ラス本体の属性とメソッドの定義を含む辞書です; 辞書は *note
     __dict__: e57. 属性になる前にコピーされたり、ラップされることがあり
     ます。以下の2つの文は同じ ‘type’ オブジェクトを生成します:

          >>> class X:
          ...     a = 1
          ...
          >>> X = type('X', (), dict(a=1))

     下記を参照してください。

        * *note Documentation on attributes and methods on classes:
          2370.

        * *note 型オブジェクト: 25e0.

     三引数形式の呼び出しに与えられたキーワード引数は、('metaclass' を除
     く) クラス定義におけるキーワード引数と同様に、適切なメタクラスの機
     構 (通常は *note __init_subclass__(): 843.) に渡されます。

     *note クラス生成をカスタマイズする: e45. も参照してください。

     バージョン 3.6 で変更: ‘type.__new__’ をオーバーライドしていない
     ‘type’ のサブクラスは、オブジェクトの型を得るのに１引数形式を利用す
     ることができません。

 -- の関数: vars ()

 -- の関数: vars (object, /)

     モジュール、クラス、インスタンス、あるいはそれ以外の ‘__dict__’ 属
     性を持つオブジェクトの、 *note __dict__: 77d. 属性を返します。

     モジュールやインスタンスのようなオブジェクトは、更新可能な *note
     __dict__: 77d. 属性を持っています。ただし、それ以外のオブジェクトで
     は ‘__dict__’ 属性への書き込みが制限されている場合があります。書き
     込みに制限がある例としては、辞書を直接更新されることを防ぐために
     *note types.MappingProxyType: 698. を使っているクラスがあります。

     引数がない場合 *note vars(): 1e23. は *note locals(): 46f. のように
     動作します。

     指定されたオブジェクトに *note __dict__: 77d. 属性がない場合 (たと
     えばそのクラスが *note __slots__: 1704. 属性を定義している場合)、
     *note TypeError: 198. 例外が送出されます。

     バージョン 3.13 で変更: この関数を引数なしで呼び出したときの返り値
     は、 *note locals(): 46f. 組み込み関数での説明に更新されました。

 -- の関数: zip (*iterables, strict=False)

     複数のイテラブルを並行に反復処理し、各イテラブルの要素からなるタプ
     ルを生成します。

     以下はプログラム例です:

          >>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):
          ...     print(item)
          ...
          (1, 'sugar')
          (2, 'spice')
          (3, 'everything nice')

     より正式な定義: *note zip(): 1a0. は、 'i' 番目のタプルが 引数に与
     えた各イテラブルの 'i' 番目の要素を含むような、タプルのイテレータを
     返します。

     *note zip(): 1a0. に対する別の考え方は、この関数は行を列に、また列
     を行に変換するということです。これは 行列の転置(7) とよく似ています
     。

     *note zip(): 1a0. は遅延評価です: イテラブルが ‘for’ ループに渡され
     たり、 *note list: 24d. でラップされたりするなどして反復処理される
     まで、要素が実際に処理されることはありません。

     ここで考慮すべきことは、 *note zip(): 1a0. に渡されるイテラブルが異
     なる長さを持つことがあるという点です; ときには意図的な場合もあり、
     またときにはイテラブルを準備するコードにおけるバグのこともあるでし
     ょう。 Python はこの問題に対して3つの異なるアプローチを提供します:

        * デフォルトでは、 *note zip(): 1a0. は最も短いイテラブルが消費
          しきった時点で停止します。より繰り返し数の長いイテラブルの残り
          の要素は無視して、結果を最も短いイテラブルの長さに切り詰めます
          :

               >>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))
               [(0, 'fee'), (1, 'fi'), (2, 'fo')]

        * *note zip(): 1a0. は、しばしば受け取ったイテラブルが全て同じ長
          さであるという想定の下で使われます。そのような場合、
          ‘strict=True’ オプションの利用が推奨されます。その出力は通常の
          *note zip(): 1a0. と同じです:

               >>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))
               [('a', 1), ('b', 2), ('c', 3)]

          しかし、デフォルトの動作と異なり、あるイテラブルが他のイテラブ
          ルよりも先に消費しきった場合に *note ValueError: 2ec. 例外を送
          出します:

               >>> for item in zip(range(3), ['fee', 'fi', 'fo', 'fum'], strict=True):
               ...     print(item)
               ...
               (0, 'fee')
               (1, 'fi')
               (2, 'fo')
               Traceback (most recent call last):
                 ...
               ValueError: zip() argument 2 is longer than argument 1

          ‘strict=True’ 引数なしの場合、長さの異なるイテラブルを生じる原
          因となるいかなるバグも、この時点では問題なく処理されます。そし
          て代わりにプログラムの別の場所で、原因を特定しにくいバグとして
          検出されることになるでしょう。

        * 短いイテラブルを一定の値でパディングして全てのイテラブルが同じ
          長さになるようにすることもできます。この機能は *note
          itertools.zip_longest(): 14b6. で提供されます。

     エッジケース: 引数としてイテラブルをひとつだけ渡した場合、 *note
     zip(): 1a0. は 1 タプルのイテレータを返します。引数なしの場合は空の
     イテレータを返します。

     ヒントとコツ:

        * イテラブルの左から右への評価順序は保証されています。そのため
          ‘zip(*[iter(s)]*n, strict=True)’ を使ってデータ系列を長さ n の
          グループにクラスタリングするイディオムが使えます。これは、各出
          力タプルがイテレータを ‘n’ 回呼び出した結果となるよう、 '同じ'
          イテレータを ‘n’ 回繰り返します。これは入力を長さ n のチャンク
          に分割する効果があります。

        * *note zip(): 1a0. に続けて ‘*’ 演算子を使うと、zip したリスト
          を元に戻せます:

               >>> x = [1, 2, 3]
               >>> y = [4, 5, 6]
               >>> list(zip(x, y))
               [(1, 4), (2, 5), (3, 6)]
               >>> x2, y2 = zip(*zip(x, y))
               >>> x == list(x2) and y == list(y2)
               True

     バージョン 3.10 で変更: ‘strict’ 引数が追加されました。

 -- の関数: __import__ (name, globals=None, locals=None, fromlist=(),
          level=0)

          注釈: これは *note importlib.import_module(): 73c. とは違い、
          日常の Python プログラミングでは必要ない高等な関数です。

     この関数は *note import: 7f8. 文により呼び出されます。 (*note
     builtins: 13. モジュールをインポートして ‘builtins.__import__’ に代
     入することで) この関数を置き換えて ‘import’ 文のセマンティクスを変
     更することができますが、同様のことをするのに通常はインポートフック
     ( PEP 302(8) 参照) を利用する方が簡単で、かつデフォルトのインポート
     実装が使用されていることを仮定するコードとの間で問題が起きないので
     、このやり方は '強く' 推奨されません。 *note __import__(): ad1. を
     直接使用することも推奨されず、 *note importlib.import_module():
     73c. の方が好まれます。

     この関数は、モジュール 'name' をインポートし、 'globals' と
     'locals' が与えられれば、パッケージのコンテキストで名前をどう解釈す
     るか決定するのに使います。 'fromlist' は 'name' で与えられるモジュ
     ールからインポートされるべきオブジェクトまたはサブモジュールの名前
     を与ます。標準の実装では 'locals' 引数はまったく使われず、
     'globals' は *note import: 7f8. 文のパッケージコンテキストを決定す
     るためにのみ使われます。

     'level' は絶対と相対どちらのインポートを使うかを指定します。 ‘0’ (デ
     フォルト) は絶対インポートのみ実行します。正の 'level' の値は、
     *note __import__(): ad1. を呼び出したディレクトリから検索対象となる
     親ディレクトリの数を示します (詳細は PEP 328(9) を参照してください
     )。

     'name' 変数が ‘package.module’ 形式であるとき、通常は、'name' で指
     名されたモジュール 'ではなく'、最上位のパッケージ (最初のドットまで
     の名前) が返されます。しかしながら、空でない 'fromlist' 引数が与え
     られると、 'name' で指名されたモジュールが返されます。

     例えば、文 ‘import spam’ は、以下のコードのようなバイトコードに帰結
     します:

          spam = __import__('spam', globals(), locals(), [], 0)

     文 ‘import spam.ham’ は、この呼び出しになります:

          spam = __import__('spam.ham', globals(), locals(), [], 0)

     ここで *note __import__(): ad1. がどのように最上位モジュールを返し
     ているかに注意して下さい。 *note import: 7f8. 文により名前が束縛さ
     れたオブジェクトになっています。

     一方で、文 ‘from spam.ham import eggs, sausage as saus’ は、以下と
     なります

          _temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)
          eggs = _temp.eggs
          saus = _temp.sausage

     ここで、*note __import__(): ad1. から ‘spam.ham’ モジュールが返され
     ます。このオブジェクトから、インポートされる名前が取り出され、それ
     ぞれの名前として代入されます。

     単純に名前からモジュール (パッケージの範囲内であるかも知れません) を
     インポートしたいなら、 *note importlib.import_module(): 73c. を使っ
     てください。

     バージョン 3.3 で変更: 負の 'level' の値はサポートされなくなりまし
     た (デフォルト値の 0 に変更されます)。

     バージョン 3.9 で変更: コマンドラインオプション *note -E: b56. or
     *note -I: b57. が指定された場合、環境変数 *note PYTHONCASEOK: b55.
     は無視されるようになりました。

脚注
....

   ---------- Footnotes ----------

   (1) なお、パーサは Unix スタイルの行末の記法しか受け付けません。コー
ドをファイルから読んでいるなら、必ず、改行変換モードで Windows や Mac ス
タイルの改行を変換してください。

   (2) https://peps.python.org/pep-0709/

   (3) https://peps.python.org/pep-0667/

   (4) https://peps.python.org/pep-0475/

   (5) https://peps.python.org/pep-0008/

   (6) 
https://rhettinger.wordpress.com/2011/05/26/super-considered-super/

   (7) https://en.wikipedia.org/wiki/Transpose

   (8) https://peps.python.org/pep-0302/

   (9) https://peps.python.org/pep-0328/


File: python.info,  Node: 組み込み定数,  Next: 組み込み型,  Prev: 組み込み関数,  Up: Python 標準ライブラリ

5.3 組み込み定数
================

組み込み名前空間にはいくつかの定数があります。定数の一覧:

 -- データ: False

     *note bool: 3c3. 型の偽値です。‘False’ への代入は不正で、*note
     SyntaxError: 18e. を送出します。

 -- データ: True

     *note bool: 3c3. 型の真値です。‘True’ への代入は不正で、*note
     SyntaxError: 18e. を送出します。

 -- データ: None

     関数にデフォルト引数が渡されなかったときなどに、値の非存在を表すの
     に頻繁に用いられるオブジェクトです。‘None’ への代入は不正で、*note
     SyntaxError: 18e. を送出します。‘None’ が *note NoneType: a52. 型の
     唯一のインスタンスです。

 -- データ: NotImplemented

     特殊な二項演算のメソッド (e.g.  *note __eq__(): cf2, *note
     __lt__(): 14b8, *note __add__(): 23dd, *note __rsub__(): 23f0,
     etc.)  が、他の型に対して演算が実装されていないことを示すために返す
     特殊値です。インプレースの特殊な二項演算のメソッド (e.g.  *note
     __imul__(): 23e2, *note __iand__(): 23ff, etc.)  も同じ理由でこの値
     を返すことがあります。この処理では真偽値コンテキストでの評価はして
     はいけません。‘NotImplemented’ が *note types.NotImplementedType:
     a53. 型の唯一のインスタンスです。

          注釈: 二項演算の (あるいはインプレースの) メソッドが
          ‘NotImplemented’ を返した場合、インタープリタはもう一方の型で
          定義された対の演算で代用を試みます (あるいは演算によっては他の
          代替手段も試みます)。試行された演算全てが ‘NotImplemented’ を
          返した場合、インタープリタは適切な例外を送出します。
          ‘NotImplemented’ を正しく返さないと、誤解を招きかねないエラー
          メッセージになったり、 ‘NotImplemented’ が Python コードに返さ
          れるようなことになります。

          例として *note 算術演算の実装: 2332. を参照してください。

          注意: ‘NotImplemented’ and ‘NotImplementedError’ are not
          interchangeable.  This constant should only be used as
          described above; see *note NotImplementedError: 36b. for
          details on correct usage of the exception.

     バージョン 3.9 で変更: Evaluating ‘NotImplemented’ in a boolean
     context was deprecated.

     バージョン 3.14 で変更: Evaluating ‘NotImplemented’ in a boolean
     context now raises a *note TypeError: 198.  It previously evaluated
     to *note True: e07. and emitted a *note DeprecationWarning: 1a3.
     since Python 3.9.

 -- データ: Ellipsis

     The same as the ellipsis literal "‘...’", an object frequently used
     to indicate that something is omitted.  Assignment to ‘Ellipsis’ is
     possible, but assignment to ‘...’ raises a *note SyntaxError: 18e.
     ‘Ellipsis’ is the sole instance of the *note types.EllipsisType:
     a51. type.

 -- データ: __debug__

     この定数は、Python が *note -O: 18c. オプションを有効にして開始され
     たのでなければ真です。 *note assert: b60. 文も参照して下さい。

     注釈: 名前 *note None: 885. 、 *note False: d2b. 、 *note True:
     e07. 、 *note __debug__: 9da. は再代入できない (これらに対する代入
     は、たとえ属性名としてであっても *note SyntaxError: 18e. が送出され
     ます) ので、これらは「真の」定数であると考えられます。

* Menu:

* site モジュールで追加される定数::


File: python.info,  Node: site モジュールで追加される定数,  Up: 組み込み定数

5.3.1 ‘site’ モジュールで追加される定数
---------------------------------------

*note site: cc. モジュール (*note -S: 13c0. コマンドラインオプションが指
定されない限り、スタートアップ時に自動的にインポートされます) は組み込み
名前空間にいくつかの定数を追加します。それらは対話的インタープリタシェル
で有用ですが、プログラム中では使うべきではありません。

 -- データ: quit (code=None)
 -- データ: exit (code=None)

     Objects that when printed, print a message like "Use quit() or
     Ctrl-D (i.e.  EOF) to exit", and when accessed directly in the
     interactive interpreter or called as functions, raise *note
     SystemExit: f3c. with the specified exit code.

 -- データ: help

     Object that when printed, prints the message "Type help() for
     interactive help, or help(object) for help about object.", and when
     accessed directly in the interactive interpreter, invokes the
     built-in help system (see *note help(): ad4.).

 -- データ: copyright
 -- データ: credits

     表示あるいは呼び出されたときに、それぞれ著作権あるいはクレジットの
     テキストが表示されるオブジェクトです。

 -- データ: license

     表示されたときに "Type license() to see the full license text" とい
     うメッセージを表示し、呼び出されたときには完全なライセンスのテキス
     トをページャのような形式で (1画面分づつ) 表示するオブジェクトです。


File: python.info,  Node: 組み込み型,  Next: 組み込み例外,  Prev: 組み込み定数,  Up: Python 標準ライブラリ

5.4 組み込み型
==============

以下のセクションでは、インタプリタに組み込まれている標準型について記述し
ます。

主要な組み込み型は、数値、シーケンス、マッピング、クラス、インスタンス、
および例外です。

コレクションクラスには、ミュータブルなものがあります。コレクションのメン
バをインプレースに足し、引き、または並べ替えて、特定の要素を返さないメソ
ッドは、コレクション自身ではなく ‘None’ を返します。

演算には、複数の型でサポートされているものがあります; 特に、ほぼ全てのオ
ブジェクトは、等価比較でき、真理値を判定でき、 (*note repr(): 1c1. 関数
や、わずかに異なる *note str(): 169. 関数によって) 文字列に変換できます
。オブジェクトが *note print(): 1177. 関数で印字されるとき、文字列に変換
する関数が暗黙に使われます。

* Menu:

* 真理値判定::
* ブール演算: ブール演算 --- and or not. and, or, not
* 比較: 比較<2>.
* 数値型 int, float, complex: 数値型 int float complex.
* ブーリアン型 - bool::
* イテレータ型::
* シーケンス型: シーケンス型 --- list tuple range. list, tuple, range
* Text and Binary Sequence Type Methods Summary::
* テキストシーケンス型: テキストシーケンス型 --- str. str
* バイナリシーケンス型: バイナリシーケンス型 --- bytes bytearray memoryview. bytes, bytearray, memoryview
* set（集合）型: set（集合）型 --- set frozenset. set, frozenset
* マッピング型: マッピング型 --- dict. dict
* コンテキストマネージャ型::
* 型アノテーション型: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン. ジェネリックエイリアス 、 ユニオン
* その他の組み込み型::
* 特殊属性::
* 整数と文字列の変換での長さ制限::


File: python.info,  Node: 真理値判定,  Next: ブール演算 --- and or not,  Up: 組み込み型

5.4.1 真理値判定
----------------

どのようなオブジェクトでも真理値として判定でき、 *note if: 181. や *note
while: 1973. の条件あるいは以下のブール演算の被演算子として使えます。

By default, an object is considered true unless its class defines either
a *note __bool__(): 14ed. method that returns ‘False’ or a *note
__len__(): 178f. method that returns zero, when called with the object.
(1)  If one of the methods raises an exception when called, the
exception is propagated and the object does not have a truth value (for
example, *note NotImplemented: 1a2.).  Here are most of the built-in
objects considered false:

   * 偽であると定義されている定数: ‘None’ と ‘False’

   * 数値型におけるゼロ: ‘0’, ‘0.0’, ‘0j’, ‘Decimal(0)’, ‘Fraction(0,
     1)’

   * 空のシーケンスまたはコレクション: ‘''’, ‘()’, ‘[]’, ‘{}’, ‘set()’,
     ‘range(0)’

ブール値の結果を返す演算および組み込み関数は、特に注釈のない限り常に偽値
として ‘0’ または ‘False’ を返し、真値として ‘1’ または ‘True’ を返しま
す。 (重要な例外: ブール演算 ‘or’ および ‘and’ は常に被演算子のうちの一
つを返します。)

   ---------- Footnotes ----------

   (1) これらの特殊なメソッドのさらなる情報については、 Python リファレ
ンスマニュアル (*note 基本的なカスタマイズ: 23ad.) を参照してください。


File: python.info,  Node: ブール演算 --- and or not,  Next: 比較<2>,  Prev: 真理値判定,  Up: 組み込み型

5.4.2 ブール演算 -- ‘and’, ‘or’, ‘not’
--------------------------------------

以下にブール演算を、優先順位が低い順に示します:

演算              結果                                  注釈
                                                        
--------------------------------------------------------------------
                                                        
‘x or y’          'x' が真なら 'x', そうでなければ      (1)
                  'y'                                   
                  
                                                        
‘x and y’         'x' が偽なら 'x', そうでなければ      (2)
                  'y'                                   
                  
                                                        
‘not x’           'x' が偽なら ‘True’, そうでなければ   (3)
                  ‘False’                               
                  

注釈:

  1. この演算子は短絡評価されます。つまり第一引数が偽のときにのみ、第二
     引数が評価されます。

  2. この演算子は短絡評価されます。つまり第一引数が真のときにのみ、第二
     引数が評価されます。

  3. ‘not’ は非ブール演算子よりも優先度が低いので、 ‘not a == b’ は ‘not
     (a == b)’ と解釈され、 ‘a == not b’ は構文エラーです。


File: python.info,  Node: 比較<2>,  Next: 数値型 int float complex,  Prev: ブール演算 --- and or not,  Up: 組み込み型

5.4.3 比較
----------

Python には 8 種の比較演算があります。比較演算の優先順位は全て同じです
(ブール演算より高い優先順位です)。比較は任意に連鎖できます; 例えば、 ‘x
< y <= z’ は ‘x < y and y <= z’ とほぼ等価ですが、この 'y' は一度だけし
か評価されません (どちらにしても、 ‘x < y’ が偽となれば 'z' は評価されま
せん)。

以下の表に比較演算をまとめます:

演算             意味
                 
-----------------------------------------------
                 
‘<’              より小さい
                 
                 
‘<=’             以下
                 
                 
‘>’              より大きい
                 
                 
‘>=’             以上
                 
                 
‘==’             等しい
                 
                 
‘!=’             等しくない
                 
                 
‘is’             同一のオブジェクトである
                 
                 
‘is not’         同一のオブジェクトでない
                 

明記されている場合を除き、異なる型のオブジェクト同士は等価になることはあ
りません。 ‘==’ 演算子は常に定義されていますが、いくつかのオブジェクト型
(たとえばクラスオブジェクト) では *note is: 34c. と同等になります。 ‘<’,
‘<=’, ‘>’ および ‘>=’ 演算子は、それらの意味が明快である場合に限って定義
されます; たとえば、オペランドのいずれかが複素数である場合、これらの演算
子は *note TypeError: 198. 例外を送出します。

あるクラスの同一でないインスタンスは、通常等価でないとされますが、そのク
ラスが *note __eq__(): cf2. メソッドを定義している場合は除きます。

クラスのインスタンスは、そのクラスがメソッド *note __lt__(): 14b8. 、
*note __le__(): 1522. 、 *note __gt__(): 1523. 、 *note __ge__(): 1524.
のうち十分なものを定義していない限り、同じクラスの別のインスタンスや他の
型のオブジェクトとは順序付けできません (一般に、比較演算子の通常の意味を
求めるなら、 *note __lt__(): 14b8. と *note __eq__(): cf2. だけで十分で
す)。

*note is: 34c. および *note is not: 24d7. 演算子の振る舞いはカスタマイズ
できません。また、これらはいかなる 2 つのオブジェクトにも適用でき、決し
て例外を送出しません。

*note in: 34b. と *note not in: 841. という構文上で同じ優先度を持つ演算
子がさらに 2 つあり、 *note iterable: 12f1. または *note __contains__():
15d3. を実装した型でサポートされています。


File: python.info,  Node: 数値型 int float complex,  Next: ブーリアン型 - bool,  Prev: 比較<2>,  Up: 組み込み型

5.4.4 数値型 ‘int’, ‘float’, ‘complex’
--------------------------------------

数値型には 3 種類あります: '整数' 、 '浮動小数点数' 、 '複素数' です。さ
らに、ブール型は整数のサブタイプです。整数には精度の制限がありません。浮
動小数点型はたいていは C の double を使って実装されています; あなたのプ
ログラムが動作するマシンでの浮動小数点型の精度と内部表現は、 *note
sys.float_info: 1dcf. から入手可能です。複素数は実部と虚部を持ち、それぞ
れが浮動小数点数です。複素数 'z' から実部および虚部を取り出すには、
‘z.real’ および ‘z.imag’ を使ってください。 (標準ライブラリには、さらに
分数のための数値型 *note fractions.Fraction: 213. や、ユーザによる精度の
定義が可能な浮動小数点数のための *note decimal.Decimal: 1fe. があります
。)

数値は、数値リテラルによって、あるいは組み込み関数や演算子の戻り値として
生成されます。 (十六進、八進、二進数を含む) 修飾のない整数リテラルは、整
数を生成します。小数点または指数表記を含む数値リテラルは浮動小数点数を生
成します。数値リテラルに ‘'j'’ または ‘'J'’ をつけると純虚数 (実部がゼロ
の複素数) を生成し、それに整数や浮動小数点数を加えることにより実部と虚部
を持つ複素数を得ることができます。

コンストラクタ *note int(): 19b. 、 *note float(): 196. 、 *note
complex(): 197. で、特定の型の数を生成できます。

Python fully supports mixed arithmetic: when a binary arithmetic
operator has operands of different built-in numeric types, the operand
with the "narrower" type is widened to that of the other:

   * If both arguments are complex numbers, no conversion is performed;

   * if either argument is a complex or a floating-point number, the
     other is converted to a floating-point number;

   * otherwise, both must be integers and no conversion is necessary.

Arithmetic with complex and real operands is defined by the usual
mathematical formula, for example:

     x + complex(u, v) = complex(x + u, v)x * complex(u, v) = complex(x * u, x * v)

A comparison between numbers of different types behaves as though the
exact values of those numbers were being compared.  (1)

全ての (複素数を除く) 組み込み数値型は以下の演算に対応しています (演算の
優先順位については、 *note 演算子の優先順位: 24eb. を参照してください):

演算                      結果                                  注釈          完全なドキュメント
                                                                              
-------------------------------------------------------------------------------------------------------
                                                                              
‘x + y’                   'x' と 'y' の和
                          
                                                                              
‘x - y’                   'x' と 'y' の差
                          
                                                                              
‘x * y’                   'x' と 'y' の積
                          
                                                                              
‘x / y’                   'x' と 'y' の商
                          
                                                                              
‘x // y’                  'x' と 'y' の商を切り下げたもの       (1)(2)
                                                                
                                                                              
‘x % y’                   ‘x / y’ の剰余                        (2)
                                                                
                                                                              
‘-x’                      'x' の符号反転
                          
                                                                              
‘+x’                      'x' そのまま
                          
                                                                              
‘abs(x)’                  'x' の絶対値または大きさ                            *note abs(): 208d.
                                                                              
                                                                              
‘int(x)’                  'x' の整数への変換                    (3)(6)        *note int(): 19b.
                                                                              
                                                                              
‘float(x)’                'x' の浮動小数点数への変換            (4)(6)        *note float(): 196.
                                                                              
                                                                              
‘complex(re, im)’         実部 're', 虚部 'im' の複素数。       (6)           *note complex(): 197.
                          'im' の既定値はゼロ。                               
                          
                                                                              
‘c.conjugate()’           複素数 'c' の共役複素数
                          
                                                                              
‘divmod(x, y)’            ‘(x // y, x % y)’ からなるペア        (2)           *note divmod(): b99.
                                                                              
                                                                              
‘pow(x, y)’               'x' の 'y' 乗                         (5)           *note pow(): 1a4.
                                                                              
                                                                              
‘x ** y’                  'x' の 'y' 乗                         (5)
                                                                

注釈:

  1. 整数の除算とも呼ばれます。 *note int: 19b. 型のオペランドに対しては
     、結果は *note int: 19b. 型になります。 *note float: 196. 型のオペ
     ランドに対しては、結果は *note float: 196. 型になります。一般に結果
     の型は必ずしも *note int: 19b. 型ではありませんが、結果は常に整数で
     す。結果は常に負の無限大の方向に丸められます: ‘1//2’ は ‘0’ 、
     ‘(-1)//2’ は ‘-1’ 、 ‘1//(-2)’ は ‘-1’ 、そして ‘(-1)//(-2)’ は ‘0’
     です。

  2. 複素数型には使えません。適用可能な場合には代わりに *note abs():
     208d. で浮動小数点型に変換してください。

  3. 
     *note float: 196. から *note int: 19b. への変換は小数点以下を切り捨
     てます。別の変換方法については関数 *note math.floor(): 15d7. や
     *note math.ceil(): 15d8. を参照してください。

  4. 浮動小数点数は、文字列 "nan" と "inf" を、オプションの接頭辞 "+" ま
     たは "-" と共に、非数 (Not a Number (NaN)) や正、負の無限大として受
     け付けます。

  5. Python は、プログラム言語一般でそうであるように、 ‘pow(0, 0)’ およ
     び ‘0 ** 0’ を ‘1’ と定義します。

  6. 受け付けられる数値リテラルは数字 ‘0’ から ‘9’ または等価な Unicode
     (‘Nd’ プロパティを持つコードポイント) を含みます。

     ‘Nd’ プロパティを持つコードポイントの完全なリストは Unicode 標準(2)
     をご覧ください。

全ての *note numbers.Real: 25f2. 型 (*note int: 19b. 、 *note float:
196.) は以下の演算も含みます:

演算                     結果
                         
---------------------------------------------------------------------------
                         
*note math.trunc(x): 15d9.'x' を *note Integral: 240a. (整数) に切り捨て
                         ます
                         
                         
*note round(x[, n]): 14f2.'x' を 'n' 桁に丸めます。丸め方は偶数丸めです。
                         'n' が省略されれば 0 がデフォルトとなります。
                         
                         
*note math.floor(x): 15d7.'x' 以下の最大の *note Integral: 240a. (整数) を
                         返します
                         
                         
*note math.ceil(x): 15d8.'x' 以上の最小の *note Integral: 240a. (整数) を
                         返します
                         

その他の数値演算は、 *note math: 92. や *note cmath: 19. モジュールをご
覧ください。

* Menu:

* 整数型におけるビット単位演算::
* 整数型における追加のメソッド::
* 浮動小数点数に対する追加のメソッド::
* 複素数に対する追加のメソッド::
* 数値型のハッシュ化::

   ---------- Footnotes ----------

   (1) この結果として、リスト ‘[1, 2]’ は ‘[1.0, 2.0]’ と等しいと見なさ
れます。タプルの場合も同様です。

   (2) 
https://unicode.org/Public/UNIDATA/extracted/DerivedNumericType.txt


File: python.info,  Node: 整数型におけるビット単位演算,  Next: 整数型における追加のメソッド,  Up: 数値型 int float complex

5.4.4.1 整数型におけるビット単位演算
....................................

ビット単位演算は整数についてのみ意味を持ちます。 ビット単位演算の結果は
、あたかも両方の値の先頭を無限個の符号ビットで埋めたものに対して計算した
かのような値になります。

二項ビット単位演算の優先順位は全て、数値演算よりも低く、比較よりも高くな
っています; 単項演算 ‘~’ の優先順位は他の単項数値演算 (‘+’ および ‘-’) と
同じです。

以下の表では、ビット単位演算を優先順位が低い順に並べています:

演算             結果                                 注釈
                                                      
---------------------------------------------------------------------
                                                      
‘x | y’          'x' と 'y' のビット単位 '論理和'     (4)
                                                      
                                                      
‘x ^ y’          'x' と 'y' のビット単位 '排他的論    (4)
                 理和'                                
                 
                                                      
‘x & y’          'x' と 'y' のビット単位 '論理積'     (4)
                                                      
                                                      
‘x << n’         'x' の 'n' ビット左シフト            (1)(2)
                                                      
                                                      
‘x >> n’         'x' の 'n' ビット右シフト            (1)(3)
                                                      
                                                      
‘~x’             'x' のビット反転
                 

注釈:

  1. 負値のシフト数は不正であり、 *note ValueError: 2ec. が送出されます
     。

  2. 'n' ビットの左シフトは、 ‘pow(2, n)’ による乗算と等価です。

  3. 'n' ビットの右シフトは、 ‘pow(2, n)’ による切り捨て除算と等価です。

  4. 桁の長い方の値に少なくとも 1 つ余計に符号ビットを付け加えた幅 (計算
     するビット幅は ‘1 + max(x.bit_length(), y.bit_length())’ かそれ以上
     ) でこれらの計算を行えば、無限個の符号ビットがあるかのように計算し
     たのと同じ結果を得るのに十分です。


File: python.info,  Node: 整数型における追加のメソッド,  Next: 浮動小数点数に対する追加のメソッド,  Prev: 整数型におけるビット単位演算,  Up: 数値型 int float complex

5.4.4.2 整数型における追加のメソッド
....................................

整数型は *note numbers.Integral: 240a. *note 抽象基底クラス: 13ce. を実
装します。さらに、追加のメソッドをいくつか提供します:

 -- メソッド: int.bit_length ()

     整数を、符号と先頭の 0 は除いて二進法で表すために必要なビットの数を
     返します:

          >>> n = -37>>> bin(n)'-0b100101'>>> n.bit_length()6

     正確には、 ‘x’ が非 0 なら、 ‘x.bit_length()’ は ‘2**(k-1) <=
     abs(x) < 2**k’ を満たす唯一の正の整数 ‘k’ です。同様に、 ‘abs(x)’ が
     十分小さくて対数を適切に丸められるとき、 ‘k = 1 + int(log(abs(x),
     2))’ です。 ‘x’ が 0 なら、 ‘x.bit_length()’ は ‘0’ を返します。

     次と等価です:

          def bit_length(self):
              s = bin(self)       # binary representation:  bin(-37) --> '-0b100101'
              s = s.lstrip('-0b') # remove leading zeros and minus sign
              return len(s)       # len('100101') --> 6

     Added in version 3.1.

 -- メソッド: int.bit_count ()

     整数の絶対値の二進数表現における 1 の数を返します。これは
     population count としても知られています。 例:

          >>> n = 19>>> bin(n)'0b10011'>>> n.bit_count()3>>> (-n).bit_count()3

     次と等価です:

          def bit_count(self):
              return bin(self).count("1")

     Added in version 3.10.

 -- メソッド: int.to_bytes (length=1, byteorder='big', *, signed=False)

     整数を表すバイト列を返します。

          >>> (1024).to_bytes(2, byteorder='big')
          b'\x04\x00'
          >>> (1024).to_bytes(10, byteorder='big')
          b'\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00'
          >>> (-1024).to_bytes(10, byteorder='big', signed=True)
          b'\xff\xff\xff\xff\xff\xff\xff\xff\xfc\x00'
          >>> x = 1000
          >>> x.to_bytes((x.bit_length() + 7) // 8, byteorder='little')
          b'\xe8\x03'

     整数は 'length' バイトで表されます、デフォルト値は 1 です。整数が与
     えられた数のバイトで表せなければ、 *note OverflowError: a81. が送出
     されます。

     'byteorder' 引数は、整数を表すのに使われるバイトオーダーを決定しま
     す。デフォルト値は ‘"big"’ です。 'byteorder' が ‘"big"’ なら、最上
     位のバイトがバイト配列の最初に来ます。 'byteorder' が ‘"little"’ な
     ら、最上位のバイトがバイト配列の最後に来ます。

     'signed' 引数は、整数を表すのに 2 の補数を使うかどうかを決定します
     。 'signed' が ‘False’ で、負の整数が与えられたなら、 *note
     OverflowError: a81. が送出されます。 'signed' のデフォルト値は
     ‘False’ です。

     上記のデフォルト値は整数を 1 バイトのオブジェクトに適切に変換するの
     に使うことができます:

          >>> (65).to_bytes()
          b'A'

     ただし、デフォルト引数で 255 より大きな整数を変換しないでください。
     そうでなければ *note OverflowError: a81. 例外を引き起こします。

     次と等価です:

          def to_bytes(n, length=1, byteorder='big', signed=False):
              if byteorder == 'little':
                  order = range(length)
              elif byteorder == 'big':
                  order = reversed(range(length))
              else:
                  raise ValueError("byteorder must be either 'little' or 'big'")

              return bytes((n >> i*8) & 0xff for i in order)

     Added in version 3.2.

     バージョン 3.11 で変更: ‘length’ と ‘byteorder’ 引数にデフォルト値
     を追加しました。

 -- メソッド: classmethod int.from_bytes (bytes, byteorder='big', *,
          signed=False)

     与えられたバイト列の整数表現を返します。

          >>> int.from_bytes(b'\x00\x10', byteorder='big')
          16
          >>> int.from_bytes(b'\x00\x10', byteorder='little')
          4096
          >>> int.from_bytes(b'\xfc\x00', byteorder='big', signed=True)
          -1024
          >>> int.from_bytes(b'\xfc\x00', byteorder='big', signed=False)
          64512
          >>> int.from_bytes([255, 0, 0], byteorder='big')
          16711680

     引数 'bytes' は *note bytes-like object: 193. か、または bytes を生
     成する iterable でなければなりません。

     'byteorder' 引数は、整数を表すのに使われるバイトオーダーを決定しま
     す。デフォルト値は ‘"big"’ です。 'byteorder' が ‘"big"’ なら、最上
     位のバイトがバイト配列の最初に来ます。 'byteorder' が ‘"little"’ な
     ら、最上位のバイトがバイト配列の最後に来ます。ホストシステムにネイ
     ティブのバイトオーダーを要求するには、 *note sys.byteorder: 25f7. を
     バイトオーダーの値として使ってください。

     'signed' 引数は、整数を表すのに 2 の補数を使うかどうかを決定します
     。

     次と等価です:

          def from_bytes(bytes, byteorder='big', signed=False):
              if byteorder == 'little':
                  little_ordered = list(bytes)
              elif byteorder == 'big':
                  little_ordered = list(reversed(bytes))
              else:
                  raise ValueError("byteorder must be either 'little' or 'big'")

              n = sum(b << i*8 for i, b in enumerate(little_ordered))
              if signed and little_ordered and (little_ordered[-1] & 0x80):
                  n -= 1 << 8*len(little_ordered)

              return n

     Added in version 3.2.

     バージョン 3.11 で変更: ‘byteorder’ 引数にデフォルト値を追加しまし
     た。

 -- メソッド: int.as_integer_ratio ()

     比が元の数と等しくなるような整数のペアを返します。戻り値の分母に相
     当する数は正の整数です。元の数が整数の場合の比は、常にその整数が分
     子であり、分母は ‘1’ です。

     Added in version 3.8.

 -- メソッド: int.is_integer ()

     常に ‘True’ を返します。 *note float.is_integer(): 25f8. に対するダ
     ックタイピングの互換性のために存在しています。

     Added in version 3.12.


File: python.info,  Node: 浮動小数点数に対する追加のメソッド,  Next: 複素数に対する追加のメソッド,  Prev: 整数型における追加のメソッド,  Up: 数値型 int float complex

5.4.4.3 浮動小数点数に対する追加のメソッド
..........................................

浮動小数点数型は、 *note numbers.Real: 25f2. *note 抽象基底クラス: 13ce.
を実装しています。浮動小数点型はまた、以下の追加のメソッドを持ちます。

 -- メソッド: classmethod float.from_number (x)

     数 'x' から生成された浮動小数点数を返すクラスメソッドです。

     引数が整数または浮動小数点数の場合、(Python の浮動小数点数の精度で)
     同じ値の浮動小数点数が返されます。 引数が Python の浮動小数点数の範
     囲外なら、 *note OverflowError: a81. が送出されます。

     一般の Python オブジェクト ‘x’ に対して、‘float.from_number(x)’ は
     ‘x.__float__()’ に委譲します。 *note __float__(): bc1. が定義されて
     いない場合、*note __index__(): 19e. へフォールバックします。

     Added in version 3.14.

 -- メソッド: float.as_integer_ratio ()

     比が厳密に元の浮動小数点数であるような一対の整数を返します。比は既
     約分数として与えられ、分母は正の値です。無限大に対しては *note
     OverflowError: a81. を、非数 (NaN) に対しては *note ValueError:
     2ec. を送出します。

 -- メソッド: float.is_integer ()

     浮動小数点数インスタンスが有限の整数値なら ‘True’ を、そうでなけれ
     ば ‘False’ を返します:

          >>> (-2.0).is_integer()True>>> (3.2).is_integer()False

16 進表記の文字列へ、または、 16 進表記からの変換をサポートする二つのメ
ソッドがあります。 Python の浮動小数点数は内部的には2進数で保持されるの
で、浮動小数点数の '10進数' へまたは '10進数' からの変換には若干の丸め誤
差があります。それに対し、16 進表記では、浮動小数点数を正確に表現できま
す。これはデバッグのときや、数学的な用途 (numerical work) に便利でしょう
。

 -- メソッド: float.hex ()

     浮動小数点数の 16 進文字列表現を返します。有限の浮動小数点数に対し
     、この表現は常に ‘0x’ で始まり ‘p’ と指数が続きます。

 -- メソッド: classmethod float.fromhex (s)

     16 進文字列表現 's' で表される、浮動小数点数を返すクラスメソッドで
     す。文字列 's' は、前や後にホワイトスペースを含んでいても構いません
     。

*note float.fromhex(): 25fa. はクラスメソッドですが、 *note float.hex():
2103. はインスタンスメソッドであることに注意して下さい。

16 進文字列表現は以下の書式となります:

     [sign] ['0x'] integer ['.' fraction] ['p' exponent]

‘sign’ は必須ではなく、 ‘+’ と ‘-’ のどちらかです。 ‘integer’ と
‘fraction’ は 16 進数の文字列で、 ‘exponent’ は 10 進数で符号もつけられ
ます。大文字・小文字は区別されず、最低でも 1 つの 16 進数文字を整数部も
しくは小数部に含む必要があります。この制限は C99 規格のセクション
6.4.4.2 で規定されていて、 Java 1.5 以降でも使われています。特に、 *note
float.hex(): 2103. の出力は C や Java コード中で、浮動小数点数の 16 進表
記として役に立つでしょう。また、 C の ‘%a’ 書式や、 Java の
‘Double.toHexString’ で書きだされた文字列は *note float.fromhex(): 25fa.
で受け付けられます。

なお、指数部は 16 進数ではなく 10 進数で書かれ、係数に掛けられる 2 の累
乗を与えます。例えば、16 進文字列 ‘0x3.a7p10’ は浮動小数点数 ‘(3 +
10./16 + 7./16**2) * 2.0**10’ すなわち ‘3740.0’ を表します:

     >>> float.fromhex('0x3.a7p10')3740.0

逆変換を ‘3740.0’ に適用すると、同じ数を表す異なる 16 進文字列表現を返し
ます:

     >>> float.hex(3740.0)'0x1.d380000000000p+11'


File: python.info,  Node: 複素数に対する追加のメソッド,  Next: 数値型のハッシュ化,  Prev: 浮動小数点数に対する追加のメソッド,  Up: 数値型 int float complex

5.4.4.4 複素数に対する追加のメソッド
....................................

‘complex’ 型は、 *note numbers.Complex: 25fc. *note 抽象基底クラス:
13ce. を実装しています。‘complex’ 型はまた、以下の追加のメソッドを持ちま
す。

 -- メソッド: classmethod complex.from_number (x)

     数値を複素数に変換するクラスメソッドです。

     一般的な Python オブジェクト ‘x’ に対して、
     ‘complex.from_number(x)’ は ‘x.__complex__()’ に処理を委譲します。
     *note __complex__(): 7fd. が定義されていない場合は *note
     __float__(): bc1. にフォールバックします。 ‘__float__()’ も定義され
     ていない場合は *note __index__(): 19e. にフォールバックします。

     Added in version 3.14.


File: python.info,  Node: 数値型のハッシュ化,  Prev: 複素数に対する追加のメソッド,  Up: 数値型 int float complex

5.4.4.5 数値型のハッシュ化
..........................

数 ‘x’ と ‘y’ に対して、型が異なっていたとしても、 ‘x == y’ であれば必ず
‘hash(x) == hash(y)’ であることが要請されます (詳細は *note __hash__():
cf3. メソッドドキュメントを参照してください)。実装の簡単さと 複数の数値
型 (*note int: 19b. 、 *note float: 196. 、 *note decimal.Decimal: 1fe.
、 *note fractions.Fraction: 213. を含みます) 間の効率のため、Python の
数値型に対するハッシュ値はある単一の数学的関数に基づいていて、 その関数
はすべての有理数に対し定義されているため、 *note int: 19b. と *note
fractions.Fraction: 213. のすべてのインスタンスと、 *note float: 196. と
*note decimal.Decimal: 1fe. のすべての有限なインスタンスに 対して適用さ
れます。本質的には、この関数は定数の素数 ‘P’ に対して ‘P’ を法とする還元
で与えられます。 値 ‘P’ は、 *note sys.hash_info: 1201. の *note
modulus: 25ff. 属性として Python で利用できます。

現在使われている素数は、32 bit C long のマシンでは ‘P = 2**31 - 1’ 、
64-bit C long のマシンでは ‘P = 2**61 - 1’ です。

詳細な規則はこうです:

   - ‘x = m / n’ が非負の有理数で、 ‘n’ が ‘P’ で割り切れないなら、
     ‘invmod(n, P)’ を ‘n’ を ‘P’ で割った剰余の (剰余演算の意味での) 逆
     数を与えるものとして、 ‘hash(x)’ を ‘m * invmod(n, P) % P’ と定義し
     ます。

   - ‘x = m / n’ が非負の有理数で、 ‘n’ が ‘P’ で割り切れる (が ‘m’ は割
     り切れない) なら、 ‘n’ は ‘P’ で割った余りの逆数を持たず、上の規則
     は適用できません。この場合、 ‘hash(x)’ を定数 ‘sys.hash_info.inf’ と
     定義します。

   - ‘x = m / n’ が負の有理数なら、 ‘hash(x)’ を ‘-hash(-x)’ と定義しま
     す。その結果のハッシュが ‘-1’ なら、 ‘-2’ に置き換えます。

   - 特定の値 ‘sys.hash_info.inf’ 、 ‘-sys.hash_info.inf’ は、正の無限大
     、負の無限大のハッシュ値を (それぞれ) 表すのに使われます。

   - 複素 (*note complex: 197.) 数 ‘z’ に対して、実部と虚部のハッシュ値
     は、 ‘hash(z.real) + sys.hash_info.imag * hash(z.imag)’ の
     ‘2**sys.hash_info.width’ を法とする還元を計算することにより組み合わ
     せられ、よってこれは ‘range(-2**(sys.hash_info.width - 1),
     2**(sys.hash_info.width - 1))’ に収まります。再び、結果が ‘-1’ なら
     、 ‘-2’ で置き換えられます。

上述の規則をわかりやすくするため、有理数 *note float: 196. や、 *note
complex: 197. のハッシュを計算する組み込みのハッシュと等価な Python コー
ドの例を挙げます:

     import sys, math

     def hash_fraction(m, n):
         """Compute the hash of a rational number m / n.

         Assumes m and n are integers, with n positive.
         Equivalent to hash(fractions.Fraction(m, n)).

         """
         P = sys.hash_info.modulus
         # Remove common factors of P.  (Unnecessary if m and n already coprime.)
         while m % P == n % P == 0:
             m, n = m // P, n // P

         if n % P == 0:
             hash_value = sys.hash_info.inf
         else:
             # Fermat's Little Theorem: pow(n, P-1, P) is 1, so
             # pow(n, P-2, P) gives the inverse of n modulo P.
             hash_value = (abs(m) % P) * pow(n, P - 2, P) % P
         if m < 0:
             hash_value = -hash_value
         if hash_value == -1:
             hash_value = -2
         return hash_value

     def hash_float(x):
         """Compute the hash of a float x."""

         if math.isnan(x):
             return object.__hash__(x)
         elif math.isinf(x):
             return sys.hash_info.inf if x > 0 else -sys.hash_info.inf
         else:
             return hash_fraction(*x.as_integer_ratio())

     def hash_complex(z):
         """Compute the hash of a complex number z."""

         hash_value = hash_float(z.real) + sys.hash_info.imag * hash_float(z.imag)
         # do a signed reduction modulo 2**sys.hash_info.width
         M = 2**(sys.hash_info.width - 1)
         hash_value = (hash_value & (M - 1)) - (hash_value & M)
         if hash_value == -1:
             hash_value = -2
         return hash_value


File: python.info,  Node: ブーリアン型 - bool,  Next: イテレータ型,  Prev: 数値型 int float complex,  Up: 組み込み型

5.4.5 ブーリアン型 - ‘bool’
---------------------------

ブーリアン型は真理値を表現します。 *note bool: 3c3. 型はただ2つの定数イ
ンスタンス ‘True’ と ‘False’ を持ちます。

組み込み関数 *note bool(): 3c3. は、もしその値が真理値として解釈可能なら
ば、任意の値を真偽値に変換します (上記 *note 真理値判定: 1858. 節を参照
してください)。

論理演算には *note ブーリアン演算子: 25ed. ‘and’, ‘or’ および ‘not’ を使
ってください。2つの真偽値に対してビット演算子 ‘&’, ‘|’, ‘^’ を適用した場
合は、それぞれ論理演算 "and", "or", "xor" に相当するブール値を返します。
しかしながら、論理演算子 ‘and’, ‘or’ および ‘!=’ を使うほうが ‘&’, ‘|’ や
‘^’ を使うよりも好ましいです。

バージョン 3.12 で非推奨: The use of the bitwise inversion operator ‘~’
is deprecated and will raise an error in Python 3.16.

*note bool: 3c3. は *note int: 19b. のサブクラスです (*note 数値型 int,
float, complex: 1fdc. を参照してください)。多くの数値的なコンテキストに
おいて、 ‘False’ と ‘True’ はそれぞれ整数 0 と 1 であるかのように振る舞
います。しかし、そのような振る舞いを信頼することは推奨されません; *note
int(): 19b. を使って明示的に整数値に変換してください。


File: python.info,  Node: イテレータ型,  Next: シーケンス型 --- list tuple range,  Prev: ブーリアン型 - bool,  Up: 組み込み型

5.4.6 イテレータ型
------------------

Python はコンテナでの反復処理の概念をサポートしています。この概念は 2 つ
の別々のメソッドを使って実装されています; これらのメソッドを使ってユーザ
定義のクラスで反復を行えるようにできます。後に詳しく述べるシーケンスは、
必ず反復処理メソッドをサポートしています。

コンテナオブジェクトが *note イテラブル: 12f1. のサポートを提供するため
には、一つのメソッドが定義されていなければなりません:

 -- メソッド: container.__iter__ ()

     *note iterator: 4c8. オブジェクトを返します。オブジェクトは後述する
     イテレータプロトコルをサポートする必要があります。もしコンテナが異
     なる種類の反復処理をサポートするなら、それぞれの反復処理のためのイ
     テレータを要求するメソッドをそれぞれ提供しても構いません 。(複数の
     形式の反復処理を提供するオブジェクトの例として、幅優先探索と深さ優
     先探索をサポートする木構造が挙げられます。)このメソッドは Python/C
     API での Python オブジェクトの型構造体の *note tp_iter: 1708. スロ
     ットに対応します。

イテレータオブジェクト自体は以下の 2 つのメソッドをサポートする必要があ
ります。これらのメソッドは 2 つ合わせて 'iterator protocol': (イテレータ
プロトコル) を成します:

 -- メソッド: iterator.__iter__ ()

     *note iterator: 4c8. オブジェクト自体を返します。このメソッドはコン
     テナとイテレータの両方を *note for: 34a. および *note in: 34b. 文で
     使えるようにするために必要です。このメソッドは Python/C API におい
     て Python オブジェクトを表す型構造体の *note tp_iter: 1708. スロッ
     トに対応します。

 -- メソッド: iterator.__next__ ()

     *note iterator: 4c8. の次のアイテムを返します。もしそれ以上アイテム
     が無ければ *note StopIteration: df5. 例外を送出します。 このメソッ
     ドは Python/C APIでのPythonオブジェクトの型構造体の *note
     tp_iternext: 1709. スロットに対応します。

Python では、いくつかのイテレータオブジェクトを定義して、一般のシーケン
ス型、特殊なシーケンス型、辞書型、その他の特殊な形式に渡って反復をサポー
トしています。特殊型は、イテレータプロトコルの実装以外では重要ではありま
せん。

イテレータの *note __next__(): 14e5. メソッドが一旦 *note StopIteration:
df5. を送出したなら、以降の呼び出しでも例外を送出し続けなければなりませ
ん。この特性に従わない実装は壊れているとみなされます。

* Menu:

* ジェネレータ型::


File: python.info,  Node: ジェネレータ型,  Up: イテレータ型

5.4.6.1 ジェネレータ型
......................

Python における *note generator: 126c. (ジェネレータ) は、イテレータプロ
トコルを実装する便利な方法を提供します。コンテナオブジェクトの *note
__iter__(): e69. メソッドがジェネレータとして実装されていれば、そのメソ
ッドは *note __iter__(): 20ad. および *note __next__(): 20ae. メソッドを
提供するイテレータオブジェクト (厳密にはジェネレータオブジェクト) を自動
的に返します。ジェネレータに関する詳細な情報は、 *note yield
式のドキュメント: 2498. にあります。


File: python.info,  Node: シーケンス型 --- list tuple range,  Next: Text and Binary Sequence Type Methods Summary,  Prev: イテレータ型,  Up: 組み込み型

5.4.7 シーケンス型 -- ‘list’, ‘tuple’, ‘range’
----------------------------------------------

基本的なシーケンス型は 3 つあります: リスト、タプル、range オブジェクト
です。*note バイナリデータ: 25c4. や *note テキスト文字列: 1fe0. を処理
するように仕立てられたシーケンス型は、セクションを割いて解説します。

* Menu:

* 共通のシーケンス演算::
* イミュータブルなシーケンス型::
* ミュータブルなシーケンス型::
* リスト型 (list): リスト型 list<2>.
* タプル型 (tuple): タプル型 tuple.
* range::


File: python.info,  Node: 共通のシーケンス演算,  Next: イミュータブルなシーケンス型,  Up: シーケンス型 --- list tuple range

5.4.7.1 共通のシーケンス演算
............................

以下の表にある演算は、ほとんどのミュータブル、イミュータブル両方のシーケ
ンスでサポートされています。カスタムのシーケンス型にこれらの演算を完全に
実装するのが簡単になるように、 *note collections.abc.Sequence: 13dc. ABC
が提供されています。

以下のテーブルで、シーケンス演算を優先順位が低い順に挙げます。表内で、
's' と 't' は同じ型のシーケンス、 'n'、 'i'、 'j' 、 'k' は整数、'x' は
's' に課された型と値の条件を満たす任意のオブジェクトです。

‘in’ および ‘not in’ 演算の優先順位は比較演算と同じです。‘+’ (結合) およ
び ‘*’ (繰り返し)の優先順位は対応する数値演算と同じです。 (1)

演算                           結果                                 注釈
                                                                    
-----------------------------------------------------------------------------------
                                                                    
‘x in s’                       's' のある要素が 'x' と等しければ    (1)
                               ‘True’ , そうでなければ ‘False’      
                               
                                                                    
‘x not in s’                   's' のある要素が 'x' と等しければ    (1)
                               ‘False’, そうでなければ ‘True’       
                               
                                                                    
‘s + t’                        's' と 't' の結合                    (6)(7)
                                                                    
                                                                    
‘s * n’ または ‘n * s’         's' 自身を 'n' 回足すのと同じ        (2)(7)
                                                                    
                                                                    
‘s[i]’                         's' の 0 から数えて 'i' 番目の要素   (3)(8)
                                                                    
                                                                    
‘s[i:j]’                       's' の 'i' から 'j' までのスライス   (3)(4)
                                                                    
                                                                    
‘s[i:j:k]’                     's' の 'i' から 'j' まで、 'k' 毎    (3)(5)
                               のスライス                           
                               
                                                                    
‘len(s)’                       's' の長さ
                               
                                                                    
‘min(s)’                       's' の最小の要素
                               
                                                                    
‘max(s)’                       's' の最大の要素
                               

同じ型のシーケンスは比較もサポートしています。特に、タプルとリストは対応
する要素を比較することで辞書式順序で比較されます。つまり、等しいとされる
ためには、すべての要素が等しく、両シーケンスの型も長さも等しくなければな
りません。(完全な詳細は言語リファレンスの *note 比較: 24d0. を参照してく
ださい。)

ミュータブルなシーケンスに対する前方および逆方向イテレータはインデックス
を使って要素にアクセスします。インデックスは、仮に参照するシーケンスが変
化したとしても前方 (または後方) に進み続けます。イテレータは *note
IndexError: 174e. または *note StopIteration: df5. に出会った場合 (また
はインデックスがゼロより小さくなった場合) にのみ終了します。

注釈:

  1. ‘in’ および ‘not in’ 演算は、一般に単純な包含判定にのみ使われますが
     、(*note str: 169, *note bytes: 192, *note bytearray: 344. のような
     ) 特殊なシーケンスでは部分シーケンス判定にも使われます:

          >>> "gg" in "eggs"True

  2. ‘0’ 未満の値 'n' は ‘0’ として扱われます (これは 's' と同じ型の空の
     シーケンスを表します)。シーケンス 's' の要素はコピーされないので注
     意してください; コピーではなく要素に対する参照カウントが増えます。
     これは Python に慣れていないプログラマをよく悩ませます。例えば以下
     のコードを考えます:

          >>> lists = [[]] * 3
          >>> lists
          [[], [], []]
          >>> lists[0].append(3)
          >>> lists
          [[3], [3], [3]]

     ここで、‘[[]]’ が空リストを含む 1 要素のリストなので、‘[[]] * 3’ の
     3 要素はこの一つの空リスト (への参照) です。‘lists’ のいずれかの要
     素を変更すると、その一つのリストが変更されます。別々のリストのリス
     トを作るにはこうします:

          >>> lists = [[] for i in range(3)]
          >>> lists[0].append(3)
          >>> lists[1].append(5)
          >>> lists[2].append(7)
          >>> lists
          [[3], [5], [7]]

     別の説明が FAQ エントリ *note
     多次元のリストを作るにはどうしますか？: 2608. にあります。

  3. 'i' または 'j' が負の数の場合、インデックスはシーケンスの末端からの
     相対インデックスになります: ‘len(s) + i’ または ‘len(s) + j’ が代わ
     りに使われます。 ただし ‘-0’ はやはり ‘0’ であることに注意してくだ
     さい。

  4. The slice of 's' from 'i' to 'j' is defined as the sequence of
     items with index 'k' such that ‘i <= k < j’.

        * If 'i' is omitted or ‘None’, use ‘0’.

        * If 'j' is omitted or ‘None’, use ‘len(s)’.

        * If 'i' or 'j' is less than ‘-len(s)’, use ‘0’.

        * If 'i' or 'j' is greater than ‘len(s)’, use ‘len(s)’.

        * If 'i' is greater than or equal to 'j', the slice is empty.

  5. 's' の「 'i' から 'j' まででステップが 'k' のスライス」は、インデッ
     クス ‘x = i + n*k’ （ただし n は ‘0 <= n < (j-i)/k’ を満たす任意の
     整数）を持つ要素からなるシーケンスとして定義されます。言い換えると
     インデックスは ‘i’, ‘i+k’, ‘i+2*k’, ‘i+3*k’ と続き、 'j' に達したと
     ころでストップします (ただし 'j' は含みません)。 'k' が正の数である
     場合、 'i' または 'j' が ‘len(s)’ より大きければ ‘len(s)’ を代わり
     に使用します。 'k' が負の数である場合、 'i' または 'j' が ‘len(s) -
     1’ より大きければ ‘len(s) - 1’ を代わりに使用します。 'i' または
     'j' を省略または ‘None’ を指定すると、 "端" (どちらの端かは 'k' の
     符号に依存) の値を代わりに使用します。なお 'k' はゼロにできないので
     注意してください。また 'k' に ‘None’ を指定すると、 ‘1’ が指定され
     たものとして扱われます。

  6. イミュータブルなシーケンスの結合は、常に新しいオブジェクトを返しま
     す。これは、結合の繰り返しでシーケンスを構築する実行時間コストがシ
     ーケンスの長さの合計の二次式になることを意味します。実行時間コスト
     を線形にするには、代わりに以下のいずれかにしてください:

        * *note str: 169. オブジェクトを結合するには、リストを構築して最
          後に *note str.join(): 2609. を使うか、 *note io.StringIO:
          112a. インスタンスに書き込んで完成してから値を取得してください

        * *note bytes: 192. オブジェクトを結合するなら、同様に *note
          bytes.join(): 260a. や *note io.BytesIO: 10a4. を使うか、
          *note bytearray: 344. オブジェクトでインプレースに結合できます
          。 *note bytearray: 344. オブジェクトはミュータブルで、効率の
          いい割り当て超過機構を備えています

        * *note tuple: 614. オブジェクトを結合するなら、代わりに *note
          list: 24d. を拡張してください

        * その他の型については、関連するクラスのドキュメントを調べてくだ
          さい

  7. シーケンス型には、 (*note range: b3d. のように) 特殊なパターンに従
     う項目のシーケンスのみをサポートするものがあり、それらはシーケンス
     の結合や繰り返しをサポートしません。

  8. An *note IndexError: 174e. is raised if 'i' is outside the sequence
     range.

シーケンスのメソッド
....................

シーケンス型は以下のようなメソッドをサポートしています:

 -- メソッド: sequence.count (value, /)

     'sequence' の中に 'value' が出現する回数を返します。

 -- メソッド: sequence.index (value[, start[, stop])

     'sequence' で最初に 'value' が出現する場所のインデックスを返します
     。

     'sequence' に 'value' が見つからなければ *note ValueError: 2ec. を
     送出します。

     The 'start' or 'stop' arguments allow for efficient searching of
     subsections of the sequence, beginning at 'start' and ending at
     'stop'.  This is roughly equivalent to ‘start +
     sequence[start:stop].index(value)’, only without copying any data.

          注意: Not all sequence types support passing the 'start' and
          'stop' arguments.

   ---------- Footnotes ----------

   (1) パーザが演算対象の型を識別できるようにするために、このような優先
順位でなければならないのです。


File: python.info,  Node: イミュータブルなシーケンス型,  Next: ミュータブルなシーケンス型,  Prev: 共通のシーケンス演算,  Up: シーケンス型 --- list tuple range

5.4.7.2 イミュータブルなシーケンス型
....................................

イミュータブルなシーケンス型が一般に実装している演算のうち、ミュータブル
なシーケンス型がサポートしていないのは、組み込みの *note hash(): 801. だ
けです。

このサポートにより、*note tuple: 614. インスタンスのようなイミュータブル
なシーケンスは、 *note dict: 183. のキーとして使え、 *note set: 184. や
*note frozenset: 7f2. インスタンスに保存できます。

ハッシュ不可能な値を含むイミュータブルなシーケンスをハッシュ化しようとす
ると、 *note TypeError: 198. となります。


File: python.info,  Node: ミュータブルなシーケンス型,  Next: リスト型 list<2>,  Prev: イミュータブルなシーケンス型,  Up: シーケンス型 --- list tuple range

5.4.7.3 ミュータブルなシーケンス型
..................................

以下のテーブルにある演算は、ほとんどのミュータブルなシーケンスでサポート
されています。カスタムのシーケンス型にこれらの演算を完全に実装するのが簡
単になるように、 *note collections.abc.MutableSequence: 4bf. ABC が提供
されています。

このテーブルで、 's' はミュータブルなシーケンス型のインスタンス、 't' は
任意のイテラブルオブジェクト、 'x' は 's' に課された型と値の条件を満たす
任意のオブジェクト (例えば、 *note bytearray: 344. は値の制限 ‘0 <= x <=
255’ に合う整数のみを受け付けます) です。

演算                               結果                                 注釈
                                                                        
--------------------------------------------------------------------------------------------------
                                                                        
‘s[i] = x’                         's' の要素 'i' を 'x' と入れ替えま
                                   す
                                   
                                                                        
‘del s[i]’                         's' の要素 'i' を削除します
                                   
                                                                        
‘s[i:j] = t’                       's' の 'i' から 'j' 番目までのスラ
                                   イスをイテラブル 't' の内容に入れ
                                   替えます
                                   
                                                                        
‘del s[i:j]’                       リストから ‘s[i:j]’ の要素を削除し
                                   ます(‘s[i:j] = []’ と同様です)
                                   
                                                                        
‘s[i:j:k] = t’                     ‘s[i:j:k]’ の要素を 't' の要素と入   (1)
                                   れ替えます                           
                                   
                                                                        
‘del s[i:j:k]’                     リストから ‘s[i:j:k]’ の要素を削除
                                   します
                                   
                                                                        
‘s += t’                           's' を 't' の内容で拡張します (ほ
                                   とんど ‘s[len(s):len(s)] = t’ と同
                                   じ)
                                   
                                                                        
‘s *= n’                           's' をその内容を 'n' 回繰り返した    (2)
                                   もので更新                           
                                   

注釈:

  1. 'k' が ‘1’ と等しくない場合、 't' はそれが入れ替えるスライスと同じ
     長さでなければなりません。

  2. 値 'n' は整数であるか、*note __index__(): 19e. を実装したオブジェク
     トです。 'n' の値がゼロまたは負数の場合、シーケンスをクリアします。
     *note 共通のシーケンス演算: 2607. で ‘s * n’ について説明したとおり
     、シーケンスの要素はコピーされないので注意してください; コピーでは
     なく要素に対する参照カウントが増えます。

ミュータブルなシーケンスのメソッド
..................................

ミュータブルなシーケンス型は以下のようなメソッドをサポートしています:

 -- メソッド: sequence.append (value, /)

     Append 'value' to the end of the sequence This is equivalent to
     writing ‘seq[len(seq):len(seq)] = [value]’.

 -- メソッド: sequence.clear ()

     Added in version 3.3.

     Remove all items from 'sequence'.  This is equivalent to writing
     ‘del sequence[:]’.

 -- メソッド: sequence.copy ()

     Added in version 3.3.

     Create a shallow copy of 'sequence'.  This is equivalent to writing
     ‘sequence[:]’.

          ヒント: The ‘copy()’ method is not part of the *note
          MutableSequence: 4bf. *note ABC: 111b, but most concrete
          mutable sequence types provide it.

 -- メソッド: sequence.extend (iterable, /)

     Extend 'sequence' with the contents of 'iterable'.  For the most
     part, this is the same as writing ‘seq[len(seq):len(seq)] =
     iterable’.

 -- メソッド: sequence.insert (index, value, /)

     Insert 'value' into 'sequence' at the given 'index'.  This is
     equivalent to writing ‘sequence[index:index] = [value]’.

 -- メソッド: sequence.pop (index=-1, /)

     Retrieve the item at 'index' and also removes it from 'sequence'.
     By default, the last item in 'sequence' is removed and returned.

 -- メソッド: sequence.remove (value, /)

     Remove the first item from 'sequence' where ‘sequence[i] == value’.

     'sequence' に 'value' が見つからなければ *note ValueError: 2ec. を
     送出します。

 -- メソッド: sequence.reverse ()

     Reverse the items of 'sequence' in place.  This method maintains
     economy of space when reversing a large sequence.  To remind users
     that it operates by side-effect, it returns ‘None’.


File: python.info,  Node: リスト型 list<2>,  Next: タプル型 tuple,  Prev: ミュータブルなシーケンス型,  Up: シーケンス型 --- list tuple range

5.4.7.4 リスト型 (list)
.......................

リストはミュータブルなシーケンスで、一般的に同種の項目の集まりを格納する
ために使われます (厳密な類似の度合いはアプリケーションによって異なる場合
があります)。

 -- クラス: list (iterable=(), /)

     リストの構成にはいくつかの方法があります:

        * 角括弧の対を使い、空のリストを表す: ‘[]’

        * 角括弧を使い、項目をカンマで区切る: ‘[a]’、‘[a, b, c]’

        * リスト内包表記を使う: ‘[x for x in iterable]’

        * 型コンストラクタを使う: ‘list()’ または ‘list(iterable)’

     コンストラクタは、 'iterable' の項目と同じ項目で同じ順のリストを構
     築します。 'iterable' は、シーケンス、イテレートをサポートするコン
     テナ、またはイテレータオブジェクトです。 'iterable' が既にリストな
     ら、 ‘iterable[:]’ と同様にコピーが作られて返されます。例えば、
     ‘list('abc')’ は ‘['a', 'b', 'c']’ を、 ‘list( (1, 2, 3) )’ は ‘[1,
     2, 3]’ を返します。引数が与えられなければ、このコンストラクタは新し
     い空のリスト ‘[]’ を作成します。

     リストを作る方法は、他にも組み込み関数 *note sorted(): dc7. などい
     ろいろあります。

     リストは *note 共通の: 2607. および *note ミュータブルの: 25c2. シ
     ーケンス演算をすべて実装します。リストは、更に以下のメソッドも提供
     します:

      -- メソッド: sort (*, key=None, reverse=False)

          このメソッドは、項目間の ‘<’ 比較のみを用いてリストをインプレ
          ースにソートします。例外は抑制されません。比較演算がどこかで失
          敗したら、ソート演算自体が失敗します (そしてリストは部分的に変
          更された状態で残されるでしょう)。

          *note sort(): dc8. は、キーワードでしか渡せない 2 つの引数
          (*note キーワード専用引数: 5a5.) を受け付けます:

          'key' は一引数をとる関数を指定し、リストのそれぞれの要素から比
          較キーを取り出すのに使います (例えば、 ‘key=str.lower’)。それ
          ぞれの項目に対応するキーは一度計算され、ソート処理全体に使われ
          ます。デフォルトの値 ‘None’ は、別のキー値を計算せず、リストの
          値が直接ソートされることを意味します。

          2.x 形式の 'cmp' 関数を 'key' 関数に変換するために、*note
          functools.cmp_to_key(): 13f2. ユーティリティが利用できます。

          'reverse' は真偽値です。 ‘True’ がセットされた場合、リストの要
          素は個々の比較が反転したものとして並び替えられます。

          このメソッドは、大きなシーケンスをソートするときの容量の節約の
          ため、シーケンスをインプレースに変化させます。副作用としてこの
          演算が行われることをユーザに気づかせるために、これはソートした
          シーケンスを返しません (新しいリストインスタンスを明示的に要求
          するには *note sorted(): dc7. を使ってください)。

          *note sort(): dc8. メソッドは安定していることが保証されていま
          す。ソートは、等しい要素の相対順序が変更されないことが保証され
          ていれば、安定しています。これは複数パスのソートを行なう (例え
          ば部署でソートして、それから給与の等級でソートする) のに役立ち
          ます。

          ソートの例と簡単なチュートリアルは *note ソートのテクニック:
          13f3. を参照して下さい。

          リストがソートされている間、または変更しようとする試みの影響中
          、あるいは検査中でさえ、リストは未定義です。Python の C 実装で
          は、それらが続いている間、リストは空として出力され、リストがソ
          ート中に変更されていることを検知できたら *note ValueError:
          2ec. を送出します。

Thread safety for list objects
..............................

Reading a single element from a *note list: 24d. is *note atomic: 2615.:

     lst[i]   # list.__getitem__

The following methods traverse the list and use *note atomic: 2615.
reads of each item to perform their function.  That means that they may
return results affected by concurrent modifications:

     item in lst
     lst.index(item)
     lst.count(item)

All of the above operations avoid acquiring *note per-object locks:
2616.  They do not block concurrent modifications.  Other operations
that hold a lock will not block these from observing intermediate
states.

All other operations from here on block using the *note per-object lock:
2616.

Writing a single item via ‘lst[i] = x’ is safe to call from multiple
threads and will not corrupt the list.

The following operations return new objects and appear *note atomic:
2615. to other threads:

     lst1 + lst2    # concatenates two lists into a new list
     x * lst        # repeats lst x times into a new list
     lst.copy()     # returns a shallow copy of the list

The following methods that only operate on a single element with no
shifting required are *note atomic: 2615.:

     lst.append(x)  # append to the end of the list, no shifting required
     lst.pop()      # pop element from the end of the list, no shifting required

The *note clear(): 603. method is also *note atomic: 2615.  Other
threads cannot observe elements being removed.

The *note sort(): dc8. method is not *note atomic: 2615.  Other threads
cannot observe intermediate states during sorting, but the list appears
empty for the duration of the sort.

The following operations may allow *note lock-free: 2617. operations to
observe intermediate states since they modify multiple elements in
place:

     lst.insert(idx, item)  # shifts elements
     lst.pop(idx)           # idx not at the end of the list, shifts elements
     lst *= x               # copies elements in place

The *note remove(): 1a5b. method may allow concurrent modifications
since element comparison may execute arbitrary Python code (via *note
__eq__(): cf2.).

*note extend(): 602. is safe to call from multiple threads.  However,
its guarantees depend on the iterable passed to it.  If it is a *note
list: 24d, a *note tuple: 614, a *note set: 184, a *note frozenset: 7f2,
a *note dict: 183. or a *note dictionary view object: 2618. (but not
their subclasses), the ‘extend’ operation is safe from concurrent
modifications to the iterable.  Otherwise, an iterator is created which
can be concurrently modified by another thread.  The same applies to
inplace concatenation of a list with other iterables when using ‘lst +=
iterable’.

Similarly, assigning to a list slice with ‘lst[i:j] = iterable’ is safe
to call from multiple threads, but ‘iterable’ is only locked when it is
also a *note list: 24d. (but not its subclasses).

Operations that involve multiple accesses, as well as iteration, are
never atomic.  For example:

     # NOT atomic: read-modify-write
     lst[i] = lst[i] + 1

     # NOT atomic: check-then-act
     if lst:
           item = lst.pop()

     # NOT thread-safe: iteration while modifying
     for item in lst:
           process(item)  # another thread may modify lst

Consider external synchronization when sharing *note list: 24d.
instances across threads.  See *note Python support for free threading:
2619. for more information.


File: python.info,  Node: タプル型 tuple,  Next: range,  Prev: リスト型 list<2>,  Up: シーケンス型 --- list tuple range

5.4.7.5 タプル型 (tuple)
........................

タプルはイミュータブルなシーケンスで、一般的に異種のデータの集まり (組み
込みの *note enumerate(): 169a. で作られた 2-タプルなど) を格納するため
に使われます。タプルはまた、同種のデータのイミュータブルなシーケンスが必
要な場合 (*note set: 184. インスタンスや *note dict: 183. インスタンスに
保存できるようにするためなど) にも使われます。

 -- クラス: tuple (iterable=(), /)

     タプルの構成にはいくつかの方法があります:

        * 丸括弧の対を使い、空のタプルを表す: ‘()’

        * カンマを使い、単要素のタプルを表す: ‘a,’ または ‘(a,)’

        * 項目をカンマで区切る: ‘a, b, c’ または ‘(a, b, c)’

        * 組み込みの *note tuple(): 614. を使う: ‘tuple()’ または
          ‘tuple(iterable)’

     コンストラクタは、 'iterable' の項目と同じ項目で同じ順のタプルを構
     築します。 'iterable' は、シーケンス、イテレートをサポートするコン
     テナ、またはイテレータオブジェクトです。 'iterable' が既にタプルな
     ら、そのまま返されます。例えば、 ‘tuple('abc')’ は ‘('a', 'b',
     'c')’ を、 ‘tuple( [1, 2, 3] )’ は ‘(1, 2, 3)’ を返します。引数が与
     えられなければ、このコンストラクタは新しい空のタプル ‘()’ を作成し
     ます。

     なお、タプルを作るのはカンマであり、丸括弧ではありません。丸括弧は
     省略可能ですが、空のタプルの場合や構文上の曖昧さを避けるのに必要な
     時は例外です。例えば、 ‘f(a, b, c)’ は三引数の関数呼び出しですが、
     ‘f((a, b, c))’ は 3-タプルを唯一の引数とする関数の呼び出しです。

     タプルは *note 共通の: 2607. シーケンス演算をすべて実装します。

異種のデータの集まりで、インデックスによってアクセスするよりも名前によっ
てアクセスしたほうが明確になるものには、単純なタプルオブジェクトよりも
*note collections.namedtuple(): 4e0. が向いているかもしれません。


File: python.info,  Node: range,  Prev: タプル型 tuple,  Up: シーケンス型 --- list tuple range

5.4.7.6 range
.............

*note range: b3d. 型は、数のイミュータブルなシーケンスを表し、一般に
*note for: 34a. ループにおいて特定の回数のループに使われます。

 -- クラス: range (stop, /)

 -- クラス: range (start, stop, step=1, /)

     range コンストラクタの引数は整数 (組み込みの *note int: 19b. または
     *note __index__(): 19e. 特殊メソッドを実装するオブジェクト) でなけ
     ればなりません。'step' 引数が省略された場合のデフォルト値は ‘1’ で
     す。'start' 引数が省略された場合のデフォルト値は ‘0’ です。 'step'
     が 0 の場合、*note ValueError: 2ec. が送出されます。

     'step' が正の場合、range ‘r’ の内容は式 ‘r[i] = start + step*i’ で
     決定されます。ここで、 ‘i >= 0’ かつ ‘r[i] < stop’ です。

     'step' が負の場合も、range ‘r’ の内容は式 ‘r[i] = start + step*i’ で
     決定されます。ただし、制約条件は ‘i >= 0’ かつ ‘r[i] > stop’ です。

     ‘r[0]’ が値の制約を満たさない場合、range オブジェクトは空になります
     。range は負のインデックスをサポートしますが、これらは正のインデッ
     クスにより決定されるシーケンスの末尾からのインデックス指定として解
     釈されます。

     range は *note sys.maxsize: 13dd. より大きい絶対値を含むことができ
     ますが、いくつかの機能 (*note len(): 840. など) は *note
     OverflowError: a81. を送出することがあります。

     range の例:

          >>> list(range(10))
          [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
          >>> list(range(1, 11))
          [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
          >>> list(range(0, 30, 5))
          [0, 5, 10, 15, 20, 25]
          >>> list(range(0, 10, 3))
          [0, 3, 6, 9]
          >>> list(range(0, -10, -1))
          [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]
          >>> list(range(0))
          []
          >>> list(range(1, 0))
          []

     range は *note 共通の: 2607. シーケンス演算を、結合と繰り返し以外す
     べて実装します (range オブジェクトは厳格なパターンに従うシーケンス
     のみを表せ、繰り返しと結合はたいていそのパターンを破るという事実に
     よります)。

      -- の属性: start

          引数 'start' の値 (この引数が与えられていない場合は ‘0’)

      -- の属性: stop

          引数 'stop' の値

      -- の属性: step

          引数 'step' の値 (この引数が与えられていない場合は ‘1’)

*note range: b3d. 型が通常の *note list: 24d. や *note tuple: 614. にま
さる点は、*note range: b3d. オブジェクトがサイズや表す範囲にかかわらず常
に一定の (小さな) 量のメモリを使うことです (‘start’、‘stop’、‘step’ の値
のみを保存し、後は必要に応じて個々の項目や部分 range を計算するためです
)。

range オブジェクトは *note collections.abc.Sequence: 13dc. ABC を実装し
、包含判定、要素インデックス検索、スライシングのような機能を提供し、負の
インデックスをサポートします (*note シーケンス型 -- list, tuple, range:
202e. を参照):

     >>> r = range(0, 20, 2)
     >>> r
     range(0, 20, 2)
     >>> 11 in r
     False
     >>> 10 in r
     True
     >>> r.index(10)
     5
     >>> r[5]
     10
     >>> r[:5]
     range(0, 10, 2)
     >>> r[-1]
     18

‘==’ および ‘!=’ による range オブジェクトの等価性の判定は、これらをシー
ケンスとして比較します。つまり、二つの range オブジェクトは同じ値のシー
ケンスを表すなら等しいとみなされます。(なお、二つの等しいとされる range
オブジェクトが異なる *note start: 261c, *note stop: 261d. および *note
step: 261e. 属性を持つことがあります。例えば ‘range(0) == range(2, 1,
3)’ や ‘range(0, 3, 2) == range(0, 4, 2)’。)

バージョン 3.2 で変更: シーケンス ABC を実装。スライスと負のインデックス
のサポート。*note int: 19b. オブジェクトの帰属判定を、すべてのアイテムを
イテレートする代わりに、定数時間で行います。

バージョン 3.3 で変更: (オブジェクトの同一性に基づいて比較する代わりに)
range オブジェクトをそれらが定義する値のシーケンスに基づいて比較するよう
に '==' と '!=' を定義しました。

属性 *note start: 261c, *note stop: 261d. および *note step: 261e. が追
加。

参考
....

   * linspace レシピ(1) は浮動小数点数向けの遅延評価版 range を実装する
     方法を紹介しています。

   ---------- Footnotes ----------

   (1) 
https://code.activestate.com/recipes/579000-equally-spaced-numbers-linspace/


File: python.info,  Node: Text and Binary Sequence Type Methods Summary,  Next: テキストシーケンス型 --- str,  Prev: シーケンス型 --- list tuple range,  Up: 組み込み型

5.4.8 Text and Binary Sequence Type Methods Summary
---------------------------------------------------

The following table summarizes the text and binary sequence types
methods by category.

カテゴリ                       *note str: 169. メソ                                        *note bytes: 192. また
                               ッド                                                        は
                                                                                           *note bytearray: 344.
                                                                                           メソッド
                                                                                           
---------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                                                                                              
Formatting                     *note str.format(): 833.
                               
                                                                                                                         
*note str.format_map(): fd7.

*note f-strings: 19a.

*note printf 形式の文字列書式化: 8db.                           *note printf 形式での bytes の書式化: f81.
                                                                
                                                                                                                              
Searching and Replacing        *note str.find(): 10a8.*note str.rfind(): 10a9.             *note bytes.find(): 1bd4.*note bytes.rfind(): 1bd5.
                                                                                                                    
                                                                                                                         
*note str.index(): 19bc.       *note str.rindex(): 146f.        *note bytes.index(): 2621. *note bytes.rindex(): 2622.
                                                                                           
                                                                                                                         
*note str.startswith(): 10cb.                                   *note bytes.startswith(): 2623.
                                                                
                                                                                                                         
*note str.endswith(): 10cc.                                     *note bytes.endswith(): 2624.
                                                                
                                                                                                                         
*note str.count(): 1981.                                        *note bytes.count(): 1982.
                                                                
                                                                                                                         
*note str.replace(): 4b8.                                       *note bytes.replace(): 2625.
                                                                
                                                                                                                              
Splitting and Joining          *note str.split(): 10aa.    *note str.rsplit(): 146d.       *note bytes.split(): 2626.    *note bytes.rsplit(): 2627.
                                                                                                                         
                                                                                                                         
*note str.splitlines(): 146e.                                   *note bytes.splitlines(): 2628.
                                                                
                                                                                                                         
*note str.partition(): 10ab.                                    *note bytes.partition(): 2629.
                                                                
                                                                                                                         
*note str.rpartition(): 1470.                                   *note bytes.rpartition(): 262a.
                                                                
                                                                                                                         
*note str.join(): 2609.                                         *note bytes.join(): 260a.
                                                                
                                                                                                                              
String Classification          *note str.isalpha(): 262b.                                  *note bytes.isalpha(): 262c.
                                                                                           
                                                                                                                         
*note str.isdecimal(): 262d.

*note str.isdigit(): 262e.                                      *note bytes.isdigit(): 262f.
                                                                
                                                                                                                         
*note str.isnumeric(): 2630.

*note str.isalnum(): 2631.                                      *note bytes.isalnum(): 2632.
                                                                
                                                                                                                         
*note str.isidentifier(): 1d46.

*note str.islower(): 2633.                                      *note bytes.islower(): 2634.
                                                                
                                                                                                                         
*note str.isupper(): 2635.                                      *note bytes.isupper(): 2636.
                                                                
                                                                                                                         
*note str.istitle(): 2637.                                      *note bytes.istitle(): 2638.
                                                                
                                                                                                                         
*note str.isspace(): 2639.                                      *note bytes.isspace(): 263a.
                                                                
                                                                                                                         
*note str.isprintable(): fd8.

Case Manipulation              *note str.lower(): 1b76.                                    *note bytes.lower(): 263b.
                                                                                           
                                                                                                                         
*note str.upper(): 263c.                                        *note bytes.upper(): 263d.
                                                                
                                                                                                                         
*note str.casefold(): fd6.

*note str.capitalize(): 263e.                                   *note bytes.capitalize(): 263f.
                                                                
                                                                                                                         
*note str.title(): 2640.                                        *note bytes.title(): 2641.
                                                                
                                                                                                                         
*note str.swapcase(): 2642.                                     *note bytes.swapcase(): 2643.
                                                                
                                                                                                                              
Padding and Stripping          *note str.ljust(): 2062.    *note str.rjust(): 2061.        *note bytes.ljust(): 2644.    *note bytes.rjust(): 2645.
                                                                                                                         
                                                                                                                         
*note str.center(): 2063.                                       *note bytes.center(): 2646.
                                                                
                                                                                                                         
*note str.expandtabs(): 2647.                                   *note bytes.expandtabs(): 2648.
                                                                
                                                                                                                         
*note str.strip(): 16c8.                                        *note bytes.strip(): 2649.
                                                                
                                                                                                                         
*note str.lstrip(): 16c9.                                  *note str.rstrip(): 16ca.*note bytes.lstrip(): 264a.          *note bytes.rstrip(): 264b.
                                                                                                                         
                                                                                                                              
Translation and Encoding       *note str.translate(): 264c.                                *note bytes.translate(): 264d.
                                                                                           
                                                                                                                         
*note str.maketrans(): fd9.                                     *note bytes.maketrans(): 148c.
                                                                
                                                                                                                         
*note str.encode(): ad2.

                                                                *note bytes.decode(): ad3.
                                                                


File: python.info,  Node: テキストシーケンス型 --- str,  Next: バイナリシーケンス型 --- bytes bytearray memoryview,  Prev: Text and Binary Sequence Type Methods Summary,  Up: 組み込み型

5.4.9 テキストシーケンス型 -- ‘str’
-----------------------------------

Python のテキストデータは *note str: 169. オブジェクト、すなわち '文字列
' として扱われます。文字列は Unicode コードポイントのイミュータブルな
*note シーケンス: 202e. です。文字列リテラルには様々な記述方法があります
:

   * シングルクォート: ‘'"ダブル" クォートを埋め込むことができます'’

   * ダブルクォート: ‘"'シングル' クォートを埋め込むことができます"’。

   * 三重引用符: ‘'''三つのシングルクォート'''’, ‘"""三つのダブルクォー
     ト"""’

三重引用符文字列は、複数行に分けることができます。関連付けられる空白はす
べて文字列リテラルに含まれます。

単式の一部であり間に空白のみを含む文字列リテラルは、一つの文字列リテラル
に暗黙に変換されます。つまり、‘("spam " "eggs") == "spam eggs"’ です。

サポートされている *note エスケープシーケンス: 687. や、ほとんどのエスケ
ープシーケンスの処理を無効化する ‘r’ ("raw") 接頭辞など、文字列リテラル
のさまざまな形式についての詳細は *note 文字列およびバイト列リテラル:
229f. を参照してください。

文字列は他のオブジェクトに *note str: 169. コンストラクタを使うことでも
生成できます。

"character" 型が特別に用意されているわけではないので、文字列のインデック
ス指定を行うと長さ 1 の文字列を作成します。つまり、空でない文字列 's' に
対し、‘s[0] == s[0:1]’ です。

ミュータブルな文字列型もありませんが、ミュータブルな断片から効率よく文字
列を構成するのに *note str.join(): 2609. や *note io.StringIO: 112a. が
使えます。

バージョン 3.3 で変更: Python 2 シリーズとの後方互換性のため、文字列リテ
ラルの ‘u’ 接頭辞が改めて許可されました。それは文字列リテラルとしての意
味には影響がなく、 ‘r’ 接頭辞と結合することはできません。

 -- クラス: str (*, encoding='utf-8', errors='strict')

 -- クラス: str (object)

 -- クラス: str (object, encoding, errors='strict')

 -- クラス: str (object, *, errors)

     'object' の *note 文字列: 1fe0. 版を返します。 'object' が与えられ
     なかった場合、空文字列が返されます。それ以外の場合 ‘str()’ の動作は
     、 'encoding' や 'errors' が与えられたかどうかによって次のように変
     わります。

     'encoding' も 'errors' も与えられない場合、 ‘str(object)’ は "形式
     ばらず"、 表示用にきれいに整えられた 'object' の文字列表現である
     *note type(object).__str__(object): 830. を返します。文字列オブジェ
     クトに対しては、文字列そのものです。 'object' が *note __str__():
     830. メソッドを持たない場合、 *note str(): 169. は代わりに *note
     repr(object): 1c1. の結果を返します。

     'encoding' か 'errors' の少なくとも一方が与えられた場合、 'object'
     は *note bytes-like object: 193. (たとえば *note bytes: 192. や
     *note bytearray: 344.) でなくてはなりません。'object' が *note
     bytes: 192. (もしくは *note bytearray: 344.) オブジェクトである場合
     は、 ‘str(bytes, encoding, errors)’ は *note bytes.decode(encoding,
     errors): ad3. と等価です。そうでない場合は、 *note bytes.decode():
     ad3. が呼ばれる前に buffer オブジェクトの下層にある bytes オブジェ
     クトが取得されます。 buffer オブジェクトについて詳しい情報は、
     *note バイナリシーケンス型 -- bytes, bytearray, memoryview: 25c4. や
     *note バッファプロトコル (buffer Protocol): 260. を参照してください
     。

     'encoding' 引数や 'errors' 引数無しに *note bytes: 192. オブジェク
     トを *note str(): 169. に渡すと、略式の文字列表現を返す 1 つ目の場
     合に該当します。(Python のコマンドラインオプション *note -b: 7f9. も
     参照してください) 例えば:

          >>> str(b'Zoot!')
          "b'Zoot!'"

     ‘str’ クラスとそのメソッドについて詳しくは、 *note
     テキストシーケンス型 — str: 1fe0. や *note 文字列メソッド: 1fe1. の
     節を参照してください。フォーマットされた文字列を出力するには、
     *note f-strings: 19a. と *note カスタムの文字列書式化: 264f. の節を
     参照してください。加えて、 *note テキスト処理サービス: 2650. の節も
     参照してください。

* Menu:

* 文字列メソッド: 文字列メソッド<2>.
* Formatted String Literals (f-strings): Formatted String Literals f-strings.
* Template String Literals (t-strings): Template String Literals t-strings.
* printf 形式の文字列書式化::


File: python.info,  Node: 文字列メソッド<2>,  Next: Formatted String Literals f-strings,  Up: テキストシーケンス型 --- str

5.4.9.1 文字列メソッド
......................

文字列は *note 共通の: 2607. シーケンス演算全てに加え、以下に述べるメソ
ッドを実装します。

文字列は、二形式の文字列書式化をサポートします。一方は柔軟さが高くカスタ
マイズできます (*note str.format(): 833.、 *note 書式指定文字列の文法:
15b3. 、および *note カスタムの文字列書式化: 264f. を参照してください)。
他方は C 言語の ‘printf’ 形式の書式化に基づいてより狭い範囲と型を扱うも
ので、正しく扱うのは少し難しいですが、扱える場合ではたいていこちらのほう
が高速です (*note printf 形式の文字列書式化: 8db.)。

標準ライブラリの *note テキスト処理サービス: 2652. 節は、その他テキスト
に関する様々なユーティリティ (*note re: be. モジュールによる正規表現サポ
ートなど) を提供するいくつかのモジュールをカバーしています。

 -- メソッド: str.capitalize ()

     最初の文字を大文字にし、残りを小文字にした文字列のコピーを返します
     。

     バージョン 3.8 で変更: 最初の文字が大文字ではなくタイトルケースに置
     き換えられるようになりました。つまり二重音字のような文字はすべての
     文字が大文字にされるのではなく、最初の文字だけ大文字にされるように
     なります。

 -- メソッド: str.casefold ()

     文字列の casefold されたコピーを返します。casefold された文字列は、
     大文字小文字に関係ないマッチに使えます。

     Casefolding is similar to lowercasing but more aggressive because
     it is intended to remove all case distinctions in a string.  For
     example, the German lowercase letter ‘'ß'’ is equivalent to ‘"ss"’.
     Since it is already lowercase, *note lower(): 1b76. would do
     nothing to ‘'ß'’; *note casefold(): fd6. converts it to ‘"ss"’.
     For example:

          >>> 'straße'.lower()
          'straße'
          >>> 'straße'.casefold()
          'strasse'

     The casefolding algorithm is described in section 3.13 'Default
     Case Folding' of the Unicode Standard(1).

     Added in version 3.3.

 -- メソッド: str.center (width, fillchar=' ', /)

     Return centered in a string of length 'width'.  Padding is done
     using the specified 'fillchar' (default is an ASCII space).  The
     original string is returned if 'width' is less than or equal to
     ‘len(s)’.  For example:

          >>> 'Python'.center(10)
          '  Python  '
          >>> 'Python'.center(10, '-')
          '--Python--'
          >>> 'Python'.center(4)
          'Python'

 -- メソッド: str.count (sub[, start[, end]])

     ['start', 'end'] の範囲に、部分文字列 'sub' が重複せず出現する回数
     を返します。オプション引数 'start' および 'end' はスライス表記と同
     じように解釈されます。

     If 'sub' is empty, returns the number of empty strings between
     characters which is the length of the string plus one.  For
     example:

          >>> 'spam, spam, spam'.count('spam')
          3
          >>> 'spam, spam, spam'.count('spam', 5)
          2
          >>> 'spam, spam, spam'.count('spam', 5, 10)
          1
          >>> 'spam, spam, spam'.count('eggs')
          0
          >>> 'spam, spam, spam'.count('')
          17

 -- メソッド: str.encode (encoding='utf-8', errors='strict')

     *note bytes: 192. にエンコードされた文字列を返します。

     'encoding' のデフォルト値は ‘'utf-8'’ です; 指定可能な値については
     *note 標準エンコーディング: fb8. を参照してください。

     'errors' はエンコーディングエラーをどのように取り扱うかを制御します
     。 ‘'strict'’ (デフォルト) では *note UnicodeError: 462. 例外が送出
     されます。そのほかに指定可能な値は ‘'ignore'’, ‘'replace'’,
     ‘'xmlcharrefreplace'’, ‘'backslashreplace'’ と、そして *note
     codecs.register_error(): 16b4. で登録された名前です。詳しくは *note
     エラーハンドラ: 1b6f. を参照してください。

     For performance reasons, the value of 'errors' is not checked for
     validity unless an encoding error actually occurs, *note Python
     開発モード: 508. is enabled or a *note debug build: 509. is used.
     For example:

          >>> encoded_str_to_bytes = 'Python'.encode()
          >>> type(encoded_str_to_bytes)
          <class 'bytes'>
          >>> encoded_str_to_bytes
          b'Python'

     バージョン 3.1 で変更: キーワード引数のサポートが追加されました。

     バージョン 3.9 で変更: 'errors' 引数の値は *note Python 開発モード:
     508. と *note デバッグモード: 509. でチェックされるようになりました
     。

 -- メソッド: str.endswith (suffix[, start[, end]])

     Return ‘True’ if the string ends with the specified 'suffix',
     otherwise return ‘False’.  'suffix' can also be a tuple of suffixes
     to look for.  With optional 'start', test beginning at that
     position.  With optional 'end', stop comparing at that position.
     Using 'start' and 'end' is equivalent to
     ‘str[start:end].endswith(suffix)’.  For example:

          >>> 'Python'.endswith('on')
          True
          >>> 'a tuple of suffixes'.endswith(('at', 'in'))
          False
          >>> 'a tuple of suffixes'.endswith(('at', 'es'))
          True
          >>> 'Python is amazing'.endswith('is', 0, 9)
          True

     See also *note startswith(): 10cb. and *note removesuffix(): acd.

 -- メソッド: str.expandtabs (tabsize=8)

     Return a copy of the string where all tab characters are replaced
     by one or more spaces, depending on the current column and the
     given tab size.  Tab positions occur every 'tabsize' characters
     (default is 8, giving tab positions at columns 0, 8, 16 and so on).
     To expand the string, the current column is set to zero and the
     string is examined character by character.  If the character is a
     tab (‘\t’), one or more space characters are inserted in the result
     until the current column is equal to the next tab position.  (The
     tab character itself is not copied.)  If the character is a newline
     (‘\n’) or return (‘\r’), it is copied and the current column is
     reset to zero.  Any other character is copied unchanged and the
     current column is incremented by one regardless of how the
     character is represented when printed.  For example:

          >>> '01\t012\t0123\t01234'.expandtabs()
          '01      012     0123    01234'
          >>> '01\t012\t0123\t01234'.expandtabs(4)
          '01  012 0123    01234'
          >>> print('01\t012\n0123\t01234'.expandtabs(4))
          01  012
          0123    01234

 -- メソッド: str.find (sub[, start[, end]])

     Return the lowest index in the string where substring 'sub' is
     found within the slice ‘s[start:end]’.  Optional arguments 'start'
     and 'end' are interpreted as in slice notation.  Return ‘-1’ if
     'sub' is not found.  For example:

          >>> 'spam, spam, spam'.find('sp')
          0
          >>> 'spam, spam, spam'.find('sp', 5)
          6

     See also *note rfind(): 10a9. and *note index(): 19bc.

          注釈: *note find(): 10a8. メソッドは、 'sub' の位置を知りたい
          ときにのみ使うべきです。 'sub' が部分文字列であるかどうかのみ
          を調べるには、 *note in: 34b. 演算子を使ってください:

               >>> 'Py' in 'Python'
               True

 -- メソッド: str.format (*args, **kwargs)

     Perform a string formatting operation.  The string on which this
     method is called can contain literal text or replacement fields
     delimited by braces ‘{}’.  Each replacement field contains either
     the numeric index of a positional argument, or the name of a
     keyword argument.  Returns a copy of the string where each
     replacement field is replaced with the string value of the
     corresponding argument.  For example:

          >>> "The sum of 1 + 2 is {0}".format(1+2)
          'The sum of 1 + 2 is 3'
          >>> "The sum of {a} + {b} is {answer}".format(answer=1+2, a=1, b=2)
          'The sum of 1 + 2 is 3'
          >>> "{1} expects the {0} Inquisition!".format("Spanish", "Nobody")
          'Nobody expects the Spanish Inquisition!'

     書式指定のオプションについては、書式指定文字列を規定する *note
     書式指定文字列の文法: 15b3. を参照してください。

          注釈: 数値 (*note int: 19b, *note float: 196, *note complex:
          197, *note decimal.Decimal: 1fe. とサブクラス) を ‘n’ の整数表
          現型 (例: ‘'{:n}'.format(1234)’) でフォーマットするとき、
          ‘LC_CTYPE’ ロケールと ‘LC_NUMERIC’ ロケールの一方または両方が
          1 バイトより長い非 ASCII 文字であると同時に異なる値である場合
          、この関数は ‘localeconv()’ の ‘decimal_point’ と
          ‘thousands_sep’ フィールドを読み取るため一時的に ‘LC_CTYPE’ ロ
          ケールに ‘LC_NUMERIC’ のロケール値を設定します。この一時的な変
          更は他のスレッドの動作に影響します。

     バージョン 3.7 で変更: 数値を ‘n’ の整数表現型でフォーマットすると
     き、この関数は一時的に ‘LC_CTYPE’ ロケールに ‘LC_NUMERIC’ のロケー
     ル値を設定する場合があります。

 -- メソッド: str.format_map (mapping, /)

     ‘str.format(**mapping)’ と似ていますが、 ‘mapping’ は *note dict:
     183. にコピーされず、直接使われます。これは例えば ‘mapping’ が dict
     のサブクラスであるときに便利です:

          >>> class Default(dict):
          ...     def __missing__(self, key):
          ...         return key
          ...
          >>> '{name} was born in {country}'.format_map(Default(name='Guido'))
          'Guido was born in country'

     Added in version 3.2.

 -- メソッド: str.index (sub[, start[, end]])

     Like *note find(): 10a8, but raise *note ValueError: 2ec. when the
     substring is not found.  For example:

          >>> 'spam, spam, spam'.index('spam')
          0
          >>> 'spam, spam, spam'.index('eggs')
          Traceback (most recent call last):
            File "<python-input-0>", line 1, in <module>
              'spam, spam, spam'.index('eggs')
              ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
          ValueError: substring not found

     See also *note rindex(): 146f.

 -- メソッド: str.isalnum ()

     Return ‘True’ if all characters in the string are alphanumeric and
     there is at least one character, ‘False’ otherwise.  A character
     ‘c’ is alphanumeric if one of the following returns ‘True’:
     ‘c.isalpha()’, ‘c.isdecimal()’, ‘c.isdigit()’, or ‘c.isnumeric()’.
     For example:

          .. doctest::

          >>> 'abc123'.isalnum()
          True
          >>> 'abc123!@#'.isalnum()
          False
          >>> ''.isalnum()
          False
          >>> ' '.isalnum()
          False

 -- メソッド: str.isalpha ()

     Return ‘True’ if all characters in the string are alphabetic and
     there is at least one character, ‘False’ otherwise.  Alphabetic
     characters are those characters defined in the Unicode character
     database as "Letter", i.e., those with general category property
     being one of "Lm", "Lt", "Lu", "Ll", or "Lo".  Note that this is
     different from the Alphabetic property defined in the section 4.10
     'Letters, Alphabetic, and Ideographic' of the Unicode Standard(2).
     For example:

          >>> 'Letters and spaces'.isalpha()
          False
          >>> 'LettersOnly'.isalpha()
          True
          >>> 'µ'.isalpha()  # non-ASCII characters can be considered alphabetical too
          True

     See *note Unicode プロパティ: 2653.

 -- メソッド: str.isascii ()

     Return ‘True’ if the string is empty or all characters in the
     string are ASCII, ‘False’ otherwise.  ASCII characters have code
     points in the range U+0000-U+007F. For example:

          >>> 'ASCII characters'.isascii()
          True
          >>> 'µ'.isascii()
          False

     Added in version 3.7.

 -- メソッド: str.isdecimal ()

     Return ‘True’ if all characters in the string are decimal
     characters and there is at least one character, ‘False’ otherwise.
     Decimal characters are those that can be used to form numbers in
     base 10, such as U+0660, ARABIC-INDIC DIGIT ZERO. Formally a
     decimal character is a character in the Unicode General Category
     "Nd".  For example:

          >>> '0123456789'.isdecimal()
          True
          >>> '٠١٢٣٤٥٦٧٨٩'.isdecimal()  # Arabic-Indic digits zero to nine
          True
          >>> 'alphabetic'.isdecimal()
          False

 -- メソッド: str.isdigit ()

     文字列中の全ての文字が数字で、かつ 1 文字以上あるなら ‘True’ を、そ
     うでなければ ‘False’ を返します。ここでの数字とは、十進数字に加えて
     、互換上付き数字のような特殊操作を必要とする数字を含みます。また 10
     を基数とした表現ができないカローシュティー数字のような体系の文字も
     含みます。正式には、数字とは、プロパティ値 Numeric_Type=Digit また
     は Numeric_Type=Decimal を持つ文字です。

 -- メソッド: str.isidentifier ()

     文字列が、 *note Names (identifiers and keywords): 22a0. 節の言語定
     義における有効な識別子であれば ‘True’ を返します。

     *note keyword.iskeyword(): 2654. は、文字列 ‘s’ が *note def: 1673.
     や *note class: 14ef. のような予約済みの識別子かどうかを調べるのに
     使うことができます。

     例:

          >>> from keyword import iskeyword

          >>> 'hello'.isidentifier(), iskeyword('hello')
          (True, False)
          >>> 'def'.isidentifier(), iskeyword('def')
          (True, True)

 -- メソッド: str.islower ()

     文字列中の大小文字の区別のある文字 (3) 全てが小文字で、かつ大小文字
     の区別のある文字が 1 文字以上あるなら ‘True’ を、そうでなければ
     ‘False’ を返します。

 -- メソッド: str.isnumeric ()

     Return ‘True’ if all characters in the string are numeric
     characters, and there is at least one character, ‘False’ otherwise.
     Numeric characters include digit characters, and all characters
     that have the Unicode numeric value property, e.g.  U+2155, VULGAR
     FRACTION ONE FIFTH. Formally, numeric characters are those with the
     property value Numeric_Type=Digit, Numeric_Type=Decimal or
     Numeric_Type=Numeric.  For example:

          >>> '0123456789'.isnumeric()
          True
          >>> '٠١٢٣٤٥٦٧٨٩'.isnumeric()  # Arabic-indic digit zero to nine
          True
          >>> '⅕'.isnumeric()  # Vulgar fraction one fifth
          True
          >>> '²'.isdecimal(), '²'.isdigit(),  '²'.isnumeric()
          (False, True, True)

     See also *note isdecimal(): 262d. and *note isdigit(): 262e.
     Numeric characters are a superset of decimal numbers.

 -- メソッド: str.isprintable ()

     Return ‘True’ if all characters in the string are printable,
     ‘False’ if it contains at least one non-printable character.

     Here "printable" means the character is suitable for *note repr():
     1c1. to use in its output; "non-printable" means that *note repr():
     1c1. on built-in types will hex-escape the character.  It has no
     bearing on the handling of strings written to *note sys.stdout:
     ccd. or *note sys.stderr: b33.

     The printable characters are those which in the Unicode character
     database (see *note unicodedata: 10b.) have a general category in
     group Letter, Mark, Number, Punctuation, or Symbol (L, M, N, P, or
     S); plus the ASCII space 0x20.  Nonprintable characters are those
     in group Separator or Other (Z or C), except the ASCII space.

     例えば:

          >>> ''.isprintable(), ' '.isprintable()
          (True, True)
          >>> '\t'.isprintable(), '\n'.isprintable()
          (False, False)

 -- メソッド: str.isspace ()

     文字列が空白文字だけからなり、かつ 1 文字以上ある場合には ‘True’ を
     返し、そうでない場合は ‘False’ を返します。

     Unicode 文字データベース (*note unicodedata: 10b. を参照) で一般カ
     テゴリが ‘Zs’ ("Seperator, space") であるか、 双方向クラスが　
     ‘WS’、‘B’、 ‘S’ のいずれかである場合、その文字は '空白文字
     (whitespace)' です。

 -- メソッド: str.istitle ()

     文字列がタイトルケース文字列であり、かつ 1 文字以上ある場合、例えば
     大文字は大小文字の区別のない文字の後にのみ続き、小文字は大小文字の
     区別のある文字の後ろにのみ続く場合には ‘True’ を返します。そうでな
     い場合は ‘False’ を返します。

     例えば:

          >>> 'Spam, Spam, Spam'.istitle()
          True
          >>> 'spam, spam, spam'.istitle()
          False
          >>> 'SPAM, SPAM, SPAM'.istitle()
          False

     See also *note title(): 2640.

 -- メソッド: str.isupper ()

     文字列中の大小文字の区別のある文字 (4) 全てが大文字で、かつ大小文字
     の区別のある文字が 1 文字以上あるなら ‘True’ を、そうでなければ
     ‘False’ を返します。

          >>> 'BANANA'.isupper()
          True
          >>> 'banana'.isupper()
          False
          >>> 'baNana'.isupper()
          False
          >>> ' '.isupper()
          False

 -- メソッド: str.join (iterable, /)

     Return a string which is the concatenation of the strings in
     'iterable'.  A *note TypeError: 198. will be raised if there are
     any non-string values in 'iterable', including *note bytes: 192.
     objects.  The separator between elements is the string providing
     this method.  For example:

          >>> ', '.join(['spam', 'spam', 'spam'])
          'spam, spam, spam'
          >>> '-'.join('Python')
          'P-y-t-h-o-n'

     See also *note split(): 10aa.

 -- メソッド: str.ljust (width, fillchar=' ', /)

     長さ 'width' の左揃えした文字列を返します。パディングは指定された
     'fillchar' (デフォルトでは ASCII スペース) を使って行われます。
     'width' が ‘len(s)’ 以下ならば、元の文字列が返されます。

     例えば:

          >>> 'Python'.ljust(10)
          'Python    '
          >>> 'Python'.ljust(10, '.')
          'Python....'
          >>> 'Monty Python'.ljust(10, '.')
          'Monty Python'

     See also *note rjust(): 2061.

 -- メソッド: str.lower ()

     Return a copy of the string with all the cased characters (5)
     converted to lowercase.  For example:

          >>> 'Lower Method Example'.lower()
          'lower method example'

     The lowercasing algorithm used is described in section 3.13
     'Default Case Folding' of the Unicode Standard(6).

 -- メソッド: str.lstrip (chars=None, /)

     文字列の先頭の文字を除去したコピーを返します。引数 'chars' は除去さ
     れる文字の集合を指定する文字列です。 'chars' が省略されるか ‘None’
     の場合、空白文字が除去されます。 'chars' 文字列は接頭辞ではなく、そ
     の値に含まれる文字の組み合わせ全てがはぎ取られます:

          >>> '   spacious   '.lstrip()
          'spacious   '
          >>> 'www.example.com'.lstrip('cmowz.')
          'example.com'

     文字の集合全てではなく、指定した文字列そのものを接頭辞として削除す
     るメソッドについては、 *note str.removeprefix(): acc. を参照してく
     ださい。使用例:

          >>> 'Arthur: three!'.lstrip('Arthur: ')
          'ee!'
          >>> 'Arthur: three!'.removeprefix('Arthur: ')
          'three!'

 -- メソッド: static str.maketrans (dict, /)

 -- メソッド: static str.maketrans (from, to, remove='', /)

     この静的メソッドは *note str.translate(): 264c. に使える変換テーブ
     ルを返します。

     引数を 1 つだけ与える場合、それは Unicode 序数 (整数) または文字 (長
     さ 1 の文字列) を、Unicode 序数、(任意長の) 文字列、または ‘None’ に
     対応づける辞書でなければなりません。このとき、文字で指定したキーは
     序数に変換されます。

     If there are two arguments, they must be strings of equal length,
     and in the resulting dictionary, each character in 'from' will be
     mapped to the character at the same position in 'to'.  If there is
     a third argument, it must be a string, whose characters will be
     mapped to ‘None’ in the result.

 -- メソッド: str.partition (sep, /)

     文字列を 'sep' の最初の出現位置で区切り、 3 要素のタプルを返します
     。タプルの内容は、区切りの前の部分、区切り文字列そのもの、そして区
     切りの後ろの部分です。もし区切れなければ、タプルには元の文字列その
     ものとその後ろに二つの空文字列が入ります。

     例えば:

          >>> 'Monty Python'.partition(' ')
          ('Monty', ' ', 'Python')
          >>> "Monty Python's Flying Circus".partition(' ')
          ('Monty', ' ', "Python's Flying Circus")
          >>> 'Monty Python'.partition('-')
          ('Monty Python', '', '')

     See also *note rpartition(): 1470.

 -- メソッド: str.removeprefix (prefix, /)

     If the string starts with the 'prefix' string, return
     ‘string[len(prefix):]’.  Otherwise, return a copy of the original
     string:

          >>> 'TestHook'.removeprefix('Test')
          'Hook'
          >>> 'BaseTestCase'.removeprefix('Test')
          'BaseTestCase'

     Added in version 3.9.

     See also *note removesuffix(): acd. and *note startswith(): 10cb.

 -- メソッド: str.removesuffix (suffix, /)

     If the string ends with the 'suffix' string and that 'suffix' is
     not empty, return ‘string[:-len(suffix)]’.  Otherwise, return a
     copy of the original string:

          >>> 'MiscTests'.removesuffix('Tests')
          'Misc'
          >>> 'TmpDirMixin'.removesuffix('Tests')
          'TmpDirMixin'

     Added in version 3.9.

     See also *note removeprefix(): acc. and *note endswith(): 10cc.

 -- メソッド: str.replace (old, new, /, count=-1)

     Return a copy of the string with all occurrences of substring 'old'
     replaced by 'new'.  If 'count' is given, only the first 'count'
     occurrences are replaced.  If 'count' is not specified or ‘-1’,
     then all occurrences are replaced.  For example:

          >>> 'spam, spam, spam'.replace('spam', 'eggs')
          'eggs, eggs, eggs'
          >>> 'spam, spam, spam'.replace('spam', 'eggs', 1)
          'eggs, spam, spam'

     バージョン 3.13 で変更: 'count' はキーワード引数として指定可能にな
     りました。

 -- メソッド: str.rfind (sub[, start[, end]])

     Return the highest index in the string where substring 'sub' is
     found, such that 'sub' is contained within ‘s[start:end]’.
     Optional arguments 'start' and 'end' are interpreted as in slice
     notation.  Return ‘-1’ on failure.  For example:

          >>> 'spam, spam, spam'.rfind('sp')
          12
          >>> 'spam, spam, spam'.rfind('sp', 0, 10)
          6

     See also *note find(): 10a8. and *note rindex(): 146f.

 -- メソッド: str.rindex (sub[, start[, end]])

     Like *note rfind(): 10a9. but raises *note ValueError: 2ec. when
     the substring 'sub' is not found.  For example:

          >>> 'spam, spam, spam'.rindex('spam')
          12
          >>> 'spam, spam, spam'.rindex('eggs')
          Traceback (most recent call last):
            File "<stdin-0>", line 1, in <module>
              'spam, spam, spam'.rindex('eggs')
              ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
          ValueError: substring not found

     See also *note index(): 19bc. and *note find(): 10a8.

 -- メソッド: str.rjust (width, fillchar=' ', /)

     'width' の長さをもつ右寄せした文字列を返します。パディングには
     'fillchar' で指定された文字(デフォルトでは ASCII スペース)が使われ
     ます。 'width' が ‘len(s)’ 以下の場合、元の文字列が返されます。

 -- メソッド: str.rpartition (sep, /)

     文字列を 'sep' の最後の出現位置で区切り、 3 要素のタプルを返します
     。タプルの内容は、区切りの前の部分、区切り文字列そのもの、そして区
     切りの後ろの部分です。もし区切れなければ、タプルには二つの空文字列
     とその後ろに元の文字列そのものが入ります。

     例えば:

          >>> 'Monty Python'.rpartition(' ')
          ('Monty', ' ', 'Python')
          >>> "Monty Python's Flying Circus".rpartition(' ')
          ("Monty Python's Flying", ' ', 'Circus')
          >>> 'Monty Python'.rpartition('-')
          ('', '', 'Monty Python')

     See also *note partition(): 10ab.

 -- メソッド: str.rsplit (sep=None, maxsplit=-1)

     'sep' を区切り文字とした、文字列中の単語のリストを返します。
     'maxsplit' が与えられた場合、文字列の '右端' から最大 'maxsplit' 回
     分割を行います。'sep' が指定されていない、あるいは ‘None’ のとき、
     全ての空白文字が区切り文字となります。右から分割していくことを除け
     ば、 *note rsplit(): 146d. は後ほど詳しく述べる *note split():
     10aa. と同様に振る舞います。

 -- メソッド: str.rstrip (chars=None, /)

     Return a copy of the string with trailing characters removed.  The
     'chars' argument is a string specifying the set of characters to be
     removed.  If omitted or ‘None’, the 'chars' argument defaults to
     removing whitespace.  The 'chars' argument is not a suffix; rather,
     all combinations of its values are stripped.  For example:

          >>> '   spacious   '.rstrip()
          '   spacious'
          >>> 'mississippi'.rstrip('ipz')
          'mississ'

     See *note removesuffix(): acd. for a method that will remove a
     single suffix string rather than all of a set of characters.  For
     example:

          >>> 'Monty Python'.rstrip(' Python')
          'M'
          >>> 'Monty Python'.removesuffix(' Python')
          'Monty'

     See also *note strip(): 16c8.

 -- メソッド: str.split (sep=None, maxsplit=-1)

     文字列を 'sep' をデリミタ文字列として区切った単語のリストを返します
     。'maxsplit' が与えられていれば、最大で 'maxsplit' 回分割されます
     (つまり、リストは最大 ‘maxsplit+1’ 要素になります)。 'maxsplit' が
     与えられないか ‘-1’ なら、分割の回数に制限はありません (可能なだけ
     分割されます)。

     'sep' が与えられた場合、連続した区切り文字はまとめられず、空の文字
     列を区切っていると判断されます(例えば ‘'1,,2'.split(',')’ は ‘['1',
     '', '2']’ を返します)。引数 'sep' は複数の文字を1つの区切り文字にも
     できます (複数の区切り文字で分割するには *note re.split(): 5a2. を
     使用します)。区切り文字を指定して空の文字列を分割すると、 ‘['']’ を
     返します。

     例えば:

          >>> '1,2,3'.split(',')
          ['1', '2', '3']
          >>> '1,2,3'.split(',', maxsplit=1)
          ['1', '2,3']
          >>> '1,2,,3,'.split(',')
          ['1', '2', '', '3', '']
          >>> '1<>2<>3<4'.split('<>')
          ['1', '2', '3<4']

     'sep' が指定されていないか ‘None’ の場合、異なる分割アルゴリズムが
     適用されます。連続する空白文字はひとつのデリミタとみなされます。ま
     た、文字列の先頭や末尾に空白があっても、結果の最初や最後に空文字列
     は含まれません。よって、空文字列や空白だけの文字列を ‘None’ デリミ
     タで分割すると ‘[]’ が返されます。

     例えば:

          >>> '1 2 3'.split()
          ['1', '2', '3']
          >>> '1 2 3'.split(maxsplit=1)
          ['1', '2 3']
          >>> '   1   2   3   '.split()
          ['1', '2', '3']

     If 'sep' is not specified or is ‘None’ and 'maxsplit' is ‘0’, only
     leading runs of consecutive whitespace are considered.

     例えば:

          >>> "".split(None, 0)
          []
          >>> "   ".split(None, 0)
          []
          >>> "   foo   ".split(maxsplit=0)
          ['foo   ']

     See also *note join(): 2609.

 -- メソッド: str.splitlines (keepends=False)

     文字列を改行部分で分解し、各行からなるリストを返します。 'keepends'
     に真が与えらない限り、返されるリストに改行は含まれません。

     このメソッドは以下の行境界で分解します。特に、以下の境界は *note
     universal newlines: f35. のスーパーセットです。

     表現                        説明
                                 
     --------------------------------------------------------------
                                 
     ‘\n’                        改行
                                 
                                 
     ‘\r’                        復帰
                                 
                                 
     ‘\r\n’                      改行 + 復帰
                                 
                                 
     ‘\v’ or ‘\x0b’              垂直タブ
                                 
                                 
     ‘\f’ or ‘\x0c’              改ページ
                                 
                                 
     ‘\x1c’                      ファイル区切り
                                 
                                 
     ‘\x1d’                      グループ区切り
                                 
                                 
     ‘\x1e’                      レコード区切り
                                 
                                 
     ‘\x85’                      改行 (C1 制御コード)
                                 
                                 
     ‘\u2028’                    行区切り
                                 
                                 
     ‘\u2029’                    段落区切り
                                 

     バージョン 3.2 で変更: ‘\v’ と ‘\f’ が行境界のリストに追加されまし
     た。

     例えば:

          >>> 'ab c\n\nde fg\rkl\r\n'.splitlines()
          ['ab c', '', 'de fg', 'kl']
          >>> 'ab c\n\nde fg\rkl\r\n'.splitlines(keepends=True)
          ['ab c\n', '\n', 'de fg\r', 'kl\r\n']

     *note split(): 10aa. とは違って、デリミタ文字列 'sep' が与えられた
     とき、このメソッドは空文字列に空リストを返し、終末の改行は結果に行
     を追加しません:

          >>> "".splitlines()
          []
          >>> "One line\n".splitlines()
          ['One line']

     比較のために ‘split('\n')’ は以下のようになります:

          >>> ''.split('\n')
          ['']
          >>> 'Two lines\n'.split('\n')
          ['Two lines', '']

 -- メソッド: str.startswith (prefix[, start[, end]])

     文字列が指定された 'prefix' で始まるなら ‘True’ を、そうでなければ
     ‘False’ を返します。 'prefix' は見つけたい複数の接頭語のタプルでも
     構いません。オプションの 'start' があれば、その位置から判定を始めま
     す。オプションの 'end' があれば、その位置で比較を止めます。

     例えば:

          >>> 'Python'.startswith('Py')
          True
          >>> 'a tuple of prefixes'.startswith(('at', 'a'))
          True
          >>> 'Python is amazing'.startswith('is', 7)
          True

     See also *note endswith(): 10cc. and *note removeprefix(): acc.

 -- メソッド: str.strip (chars=None, /)

     Return a copy of the string with the leading and trailing
     characters removed.  The 'chars' argument is a string specifying
     the set of characters to be removed.  If omitted or ‘None’, the
     'chars' argument defaults to removing whitespace.  The 'chars'
     argument is not a prefix or suffix; rather, all combinations of its
     values are stripped.

     例えば:

          >>> '   spacious   '.strip()
          'spacious'
          >>> 'www.example.com'.strip('cmowz.')
          'example'

     The outermost leading and trailing 'chars' argument values are
     stripped from the string.  Characters are removed from the leading
     end until reaching a string character that is not contained in the
     set of characters in 'chars'.  A similar action takes place on the
     trailing end.

     例えば:

          >>> comment_string = '#....... Section 3.2.1 Issue #32 .......'
          >>> comment_string.strip('.#! ')
          'Section 3.2.1 Issue #32'

     See also *note rstrip(): 16ca.

 -- メソッド: str.swapcase ()

     大文字が小文字に、小文字が大文字に変換された、文字列のコピーを返し
     ます。なお、 ‘s.swapcase().swapcase() == s’ が真であるとは限りませ
     ん。

 -- メソッド: str.title ()

     文字列を、単語ごとに大文字から始まり、残りの文字のうち大小文字の区
     別があるものは全て小文字にする、タイトルケースにして返します。

     例えば:

          >>> 'Hello world'.title()
          'Hello World'

     このアルゴリズムは、連続した文字の集まりという、言語から独立した単
     純な単語の定義を使います。この定義は多くの状況ではうまく機能します
     が、短縮形や所有格のアポストロフィが単語の境界になってしまい、望み
     の結果を得られない場合があります:

          >>> "they're bill's friends from the UK".title()
          "They'Re Bill'S Friends From The Uk"

     *note string.capwords(): 2656. 関数は単語をスペースでのみ分割するた
     め、この問題はありません。

     または、正規表現を使うことでアポストロフィに対応できます:

          >>> import re
          >>> def titlecase(s):
          ...     return re.sub(r"[A-Za-z]+('[A-Za-z]+)?",
          ...                   lambda mo: mo.group(0).capitalize(),
          ...                   s)
          ...
          >>> titlecase("they're bill's friends.")
          "They're Bill's Friends."

     See also *note istitle(): 2637.

 -- メソッド: str.translate (table, /)

     与えられた変換テーブルに基づいて文字列を構成する各文字をマッピング
     し、マッピング後の文字列のコピーを返します。変換テーブルは、*note
     __getitem__(): 588. によるインデックス指定を実装するオブジェクトで
     ある必要があります。一般的には、 *note mapping: 13d3. または *note
     sequence: 716. です。Unicode 序数 (整数) でインデックス指定する場合
     、変換テーブルのオブジェクトは次のいずれも行うことができます。
     Unicode 序数または文字列を返して文字を 1 文字以上の別の文字にマッピ
     ングすること、‘None’ を返して返り値の文字列から指定した文字を削除す
     ること、例外 *note LookupError: 23e5. を送出して文字をその文字自身
     にマッピングすること。

     文字から文字への異なる形式のマッピングから変換マップを作成するため
     に、 *note str.maketrans(): fd9. が使えます。

     文字のマッピングを好みに合わせてより柔軟に変更する方法については、
     *note codecs: 1c. モジュールも参照してください。

 -- メソッド: str.upper ()

     全ての大小文字の区別のある文字 (7) が大文字に変換された、文字列のコ
     ピーを返します。なお ‘s.upper().isupper()’ は、 ‘s’ が大小文字の区
     別のある文字を含まなかったり、結果の文字の Unicode カテゴリが "Lu"
     ではなく例えば "Lt" (Letter, titlecase) などであったら、 ‘False’ に
     なりえます。

     The uppercasing algorithm used is described in section 3.13
     'Default Case Folding' of the Unicode Standard(8).

 -- メソッド: str.zfill (width, /)

     長さが 'width' になるよう ASCII ‘'0'’ で左詰めした文字列のコピーを
     返します。先頭が符号接頭辞 (‘'+'’/‘'-'’) だった場合、 ‘'0'’ は符号
     の前ではなく '後' に挿入されます。'width' が ‘len(s)’ 以下の場合元
     の文字列を返します。

     例えば:

          >>> "42".zfill(5)
          '00042'
          >>> "-42".zfill(5)
          '-0042'

   ---------- Footnotes ----------

   (1) 
https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-3/#G33992

   (2) 
https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-4/#G91002

   (3) 大小文字の区別のある文字とは、一般カテゴリプロパティが "Lu"
(Letter, uppercase (大文字))、 "Ll" (Letter, lowercase (小文字))、 "Lt"
(Letter、titlecase (先頭が大文字)) のいずれかであるものです。

   (4) 大小文字の区別のある文字とは、一般カテゴリプロパティが "Lu"
(Letter, uppercase (大文字))、 "Ll" (Letter, lowercase (小文字))、 "Lt"
(Letter、titlecase (先頭が大文字)) のいずれかであるものです。

   (5) 大小文字の区別のある文字とは、一般カテゴリプロパティが "Lu"
(Letter, uppercase (大文字))、 "Ll" (Letter, lowercase (小文字))、 "Lt"
(Letter、titlecase (先頭が大文字)) のいずれかであるものです。

   (6) 
https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-3/#G33992

   (7) 大小文字の区別のある文字とは、一般カテゴリプロパティが "Lu"
(Letter, uppercase (大文字))、 "Ll" (Letter, lowercase (小文字))、 "Lt"
(Letter、titlecase (先頭が大文字)) のいずれかであるものです。

   (8) 
https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-3/#G33992


File: python.info,  Node: Formatted String Literals f-strings,  Next: Template String Literals t-strings,  Prev: 文字列メソッド<2>,  Up: テキストシーケンス型 --- str

5.4.9.2 Formatted String Literals (f-strings)
.............................................

Added in version 3.6.

バージョン 3.7 で変更: The *note await: 18d. and *note async for: ca1.
can be used in expressions within f-strings.

バージョン 3.8 で変更: Added the debug specifier (‘=’)

バージョン 3.12 で変更: Many restrictions on expressions within
f-strings have been removed.  Notably, nested strings, comments, and
backslashes are now permitted.

An 'f-string' (formally a 'formatted string literal') is a string
literal that is prefixed with ‘f’ or ‘F’.  This type of string literal
allows embedding the results of arbitrary Python expressions within
'replacement fields', which are delimited by curly brackets (‘{}’).
Each replacement field must contain an expression, optionally followed
by:

   * a 'debug specifier' - an equal sign (‘=’);

   * a 'conversion specifier' - ‘!s’, ‘!r’ or ‘!a’; and/or

   * a 'format specifier' prefixed with a colon (‘:’).

See the *note Lexical Analysis section on f-strings: 19a. for details on
the syntax of these fields.

* Menu:

* Debug specifier::
* Conversion specifier::
* Format specifier::


File: python.info,  Node: Debug specifier,  Next: Conversion specifier,  Up: Formatted String Literals f-strings

5.4.9.3 Debug specifier
.......................

Added in version 3.8.

If a debug specifier - an equal sign (‘=’) - appears after the
replacement field expression, the resulting f-string will contain the
expression's source, the equal sign, and the value of the expression.
This is often useful for debugging:

     >>> number = 14.3
     >>> f'{number=}'
     'number=14.3'

Whitespace before, inside and after the expression, as well as
whitespace after the equal sign, is significant -- it is retained in the
result:

     >>> f'{ number  -  4  = }'
     ' number  -  4  = 10.3'


File: python.info,  Node: Conversion specifier,  Next: Format specifier,  Prev: Debug specifier,  Up: Formatted String Literals f-strings

5.4.9.4 Conversion specifier
............................

By default, the value of a replacement field expression is converted to
a string using *note str(): 169.:

     >>> from fractions import Fraction
     >>> one_third = Fraction(1, 3)
     >>> f'{one_third}'
     '1/3'

When a debug specifier but no format specifier is used, the default
conversion instead uses *note repr(): 1c1.:

     >>> f'{one_third = }'
     'one_third = Fraction(1, 3)'

The conversion can be specified explicitly using one of these
specifiers:

   * ‘!s’ for *note str(): 169.

   * ‘!r’ for *note repr(): 1c1.

   * ‘!a’ for *note ascii(): 15ff.

例えば:

     >>> str(one_third)
     '1/3'
     >>> repr(one_third)
     'Fraction(1, 3)'

     >>> f'{one_third!s} is {one_third!r}'
     '1/3 is Fraction(1, 3)'

     >>> string = "¡kočka 😸!"
     >>> ascii(string)
     "'\\xa1ko\\u010dka \\U0001f638!'"

     >>> f'{string = !a}'
     "string = '\\xa1ko\\u010dka \\U0001f638!'"


File: python.info,  Node: Format specifier,  Prev: Conversion specifier,  Up: Formatted String Literals f-strings

5.4.9.5 Format specifier
........................

After the expression has been evaluated, and possibly converted using an
explicit conversion specifier, it is formatted using the *note format():
199. function.  If the replacement field includes a 'format specifier'
introduced by a colon (‘:’), the specifier is passed to ‘format()’ as
the second argument.  The result of ‘format()’ is then used as the final
value for the replacement field.  For example:

     >>> from fractions import Fraction
     >>> one_third = Fraction(1, 3)
     >>> f'{one_third:.6f}'
     '0.333333'
     >>> f'{one_third:_^+10}'
     '___+1/3___'
     >>> >>> f'{one_third!r:_^20}'
     '___Fraction(1, 3)___'
     >>> f'{one_third = :~>10}~'
     'one_third = ~~~~~~~1/3~'


File: python.info,  Node: Template String Literals t-strings,  Next: printf 形式の文字列書式化,  Prev: Formatted String Literals f-strings,  Up: テキストシーケンス型 --- str

5.4.9.6 Template String Literals (t-strings)
............................................

An 't-string' (formally a 'template string literal') is a string literal
that is prefixed with ‘t’ or ‘T’.

These strings follow the same syntax and evaluation rules as *note
formatted string literals: 22eb, with for the following differences:

   * Rather than evaluating to a ‘str’ object, template string literals
     evaluate to a *note string.templatelib.Template: 16a. object.

   * The *note format(): 199. protocol is not used.  Instead, the format
     specifier and conversions (if any) are passed to a new *note
     Interpolation: 16b. object that is created for each evaluated
     expression.  It is up to code that processes the resulting *note
     Template: 16a. object to decide how to handle format specifiers and
     conversions.

   * Format specifiers containing nested replacement fields are
     evaluated eagerly, prior to being passed to the *note
     Interpolation: 16b. object.  For instance, an interpolation of the
     form ‘{amount:.{precision}f}’ will evaluate the inner expression
     ‘{precision}’ to determine the value of the ‘format_spec’
     attribute.  If ‘precision’ were to be ‘2’, the resulting format
     specifier would be ‘'.2f'’.

   * When the equals sign ‘'='’ is provided in an interpolation
     expression, the text of the expression is appended to the literal
     string that precedes the relevant interpolation.  This includes the
     equals sign and any surrounding whitespace.  The ‘Interpolation’
     instance for the expression will be created as normal, except that
     *note conversion: 265c. will be set to '‘r’' (*note repr(): 1c1.)
     by default.  If an explicit conversion or format specifier are
     provided, this will override the default behaviour.


File: python.info,  Node: printf 形式の文字列書式化,  Prev: Template String Literals t-strings,  Up: テキストシーケンス型 --- str

5.4.9.7 ‘printf’ 形式の文字列書式化
...................................

     注釈: The formatting operations described here exhibit a variety of
     quirks that lead to a number of common errors (such as failing to
     display tuples and dictionaries correctly).

     Using *note formatted string literals: 19a, the *note str.format():
     833. interface, or *note string.Template: 897. may help avoid these
     errors.  Each of these alternatives provides their own trade-offs
     and benefits of simplicity, flexibility, and/or extensibility.

文字列オブジェクトには独特の組み込み演算子: ‘%’ 演算子 (モジュロ) があり
ます。これは 文字列の '書式化' あるいは '補間' 演算子としても知られてい
ます。 ‘format % values’ ('format' は文字列とします) が与えられると、
'format' の中の ‘%’ による変換の指定は0こ以上の 'values' の要素で置き換
えられます。この動作は C 言語における ‘sprintf()’ 関数の利用方法に似てい
ます。使用例:

     >>> print('%s has %d quote types.' % ('Python', 2))
     Python has 2 quote types.

'format' が単一の引数しか要求しない場合、 'values' はタプルでない単一の
オブジェクトでもかまいません。 (1) それ以外の場合、 'values' はフォーマ
ット文字列中で指定された項目と正確に同じ数の要素からなるタプルか、単一の
マップオブジェクトでなければなりません。

一つの変換指定子は 2 またはそれ以上の文字を含み、その構成要素は以下から
なりますが、示した順に出現しなければなりません:

  1. 指定子の開始を示す文字 ‘'%'’ 。

  2. マップキー (オプション)。丸括弧で囲った文字列からなります (例えば
     ‘(somename)’) 。

  3. 変換フラグ (オプション)。一部の変換型の結果に影響します。

  4. 最小のフィールド幅 (オプション)。 ‘'*'’ (アスタリスク) を指定した場
     合、実際の文字列幅が 'values' タプルの次の要素から読み出されます。
     タプルには最小フィールド幅やオプションの精度指定の後に変換したいオ
     ブジェクトがくるようにします。

  5. 精度 (オプション)。 ‘'.'’ (ドット) とその後に続く精度で与えられます
     。 ‘'*'’ (アスタリスク) を指定した場合、精度の桁数は 'values' タプ
     ルの次の要素から読み出されます。タプルには精度指定の後に変換したい
     値がくるようにします。

  6. 精度長変換子 (オプション)。

  7. 変換型。

‘%’ 演算子の右側の引数が辞書の場合 (またはその他のマップ型の場合), 文字
列中のフォーマットには、辞書に挿入されているキーを丸括弧で囲い、文字
‘'%'’ の直後にくるようにしたものが含まれていなければ 'なりません' 。マッ
プキーはフォーマット化したい値をマップから選び出します。例えば:

     >>> print('%(language)s has %(number)03d quote types.' %
     ...       {'language': "Python", "number": 2})
     Python has 002 quote types.

この場合、 ‘*’ 指定子をフォーマットに含めてはいけません (‘*’ 指定子は順
番付けされたパラメタのリストが必要だからです)。

変換フラグ文字を以下に示します:

Flag          意味
              
----------------------------------------------------------------------------------------
              
‘'#'’         値の変換に (下で定義されている) "別の形式" を使います。
              
              
‘'0'’         数値型に対してゼロによるパディングを行います。
              
              
‘'-'’         変換された値を左寄せにします (‘'0'’ と同時に与えた場合、 ‘'0'’ を上書き
              します) 。
              
              
‘' '’         (スペース) 符号付きの変換で正の数の場合、前に一つスペースを空けます (そ
              うでない場合は空文字になります) 。
              
              
‘'+'’         変換の先頭に符号文字 (‘'+'’ または ‘'-'’) を付けます("スペース" フラグ
              を上書きします) 。
              

精度長変換子(‘h’, ‘l’,または ‘L’) を使うことができますが、 Python では必
要ないため無視されます。 - つまり、例えば ‘%ld’ は ‘%d’ と等価です。

変換型を以下に示します:

変換             意味                                                      注釈
                                                                           
---------------------------------------------------------------------------------------
                                                                           
‘'d'’            符号付き 10 進整数。
                 
                                                                           
‘'i'’            符号付き 10 進整数。
                 
                                                                           
‘'o'’            符号付き 8 進数。                                         (1)
                                                                           
                                                                           
‘'u'’            旧式の型 - ‘'d'’ と同じです。                             (6)
                                                                           
                                                                           
‘'x'’            符号付き 16 進数 (小文字)。                               (2)
                                                                           
                                                                           
‘'X'’            符号付き 16 進数 (大文字)。                               (2)
                                                                           
                                                                           
‘'e'’            指数表記の浮動小数点数 (小文字)。                         (3)
                                                                           
                                                                           
‘'E'’            指数表記の浮動小数点数 (大文字)。                         (3)
                                                                           
                                                                           
‘'f'’            10 進浮動小数点数。                                       (3)
                                                                           
                                                                           
‘'F'’            10 進浮動小数点数。                                       (3)
                                                                           
                                                                           
‘'g'’            浮動小数点数。指数部が -4 以上または精度以下の場合には    (4)
                 小文字指数表記、それ以外の場合には10進表記。              
                 
                                                                           
‘'G'’            浮動小数点数。指数部が -4 以上または精度以下の場合には    (4)
                 大文字指数表記、それ以外の場合には10進表記。              
                 
                                                                           
‘'c'’            文字一文字 (整数または一文字からなる文字列を受理します
                 )。
                 
                                                                           
‘'r'’            文字列 (Python オブジェクトを *note repr(): 1c1. で変換   (5)
                 します)。                                                 
                 
                                                                           
‘'s'’            文字列 (Python オブジェクトを *note str(): 169. で変換    (5)
                 します)。                                                 
                 
                                                                           
‘'a'’            文字列 (Python オブジェクトを *note ascii(): 15ff. で変   (5)
                 換します)。                                               
                 
                                                                           
‘'%'’            引数を変換せず、返される文字列中では文字 ‘'%'’ になりま
                 す。
                 

注釈:

  1. 別の形式を指定（訳注: 変換フラグ ‘#’ を使用）すると 8 進数を表す接
     頭辞 (‘'0o'’) が最初の数字の前に挿入されます。

  2. 別の形式を指定（訳注: 変換フラグ ‘#’ を使用）すると 16 進数を表す接
     頭辞 ‘'0x'’ または ‘'0X'’ (使用するフォーマット文字が ‘'x'’ か
     ‘'X'’ に依存します) が最初の数字の前に挿入されます。

  3. この形式にした場合、変換結果には常に小数点が含まれ、それはその後ろ
     に数字が続かない場合にも適用されます。

     指定精度は小数点の後の桁数を決定し、そのデフォルトは 6 です。

  4. この形式にした場合、変換結果には常に小数点が含まれ他の形式とは違っ
     て末尾の 0 は取り除かれません。

     指定精度は小数点の前後の有効桁数を決定し、そのデフォルトは 6 です。

  5. 精度が ‘N’ なら、出力は ‘N’ 文字に切り詰められます。

  6. PEP 237(2) を参照してください。

Python 文字列には明示的な長さ情報があるので、 ‘%s’ 変換において ‘'\0'’ を
文字列の末端と仮定したりはしません。

バージョン 3.1 で変更: 絶対値が 1e50 を超える数値の ‘%f’ 変換が ‘%g’ 変
換に置き換えられなくなりました。

   ---------- Footnotes ----------

   (1) 従って、一個のタプルだけをフォーマット出力したい場合には出力した
いタプルを唯一の要素とする単一のタプルを 'values' に与えなくてはなりませ
ん。

   (2) https://peps.python.org/pep-0237/


File: python.info,  Node: バイナリシーケンス型 --- bytes bytearray memoryview,  Next: set（集合）型 --- set frozenset,  Prev: テキストシーケンス型 --- str,  Up: 組み込み型

5.4.10 バイナリシーケンス型 -- ‘bytes’, ‘bytearray’, ‘memoryview’
-----------------------------------------------------------------

バイナリデータを操作するためのコア組み込み型は *note bytes: 192. および
*note bytearray: 344. です。これらは、別のバイナリオブジェクトのメモリに
コピーを作成すること無くアクセスするための *note バッファプロトコル:
260. を利用する *note memoryview: 165. でサポートされています。

*note array: 8. モジュールは、32 ビット整数や IEEE754 倍精度浮動小数点値
のような基本データ型の、効率的な保存をサポートしています。

* Menu:

* バイトオブジェクト::
* bytearray オブジェクト::
* bytes と bytearray の操作::
* printf 形式での bytes の書式化::
* メモリビュー::


File: python.info,  Node: バイトオブジェクト,  Next: bytearray オブジェクト,  Up: バイナリシーケンス型 --- bytes bytearray memoryview

5.4.10.1 バイトオブジェクト
...........................

bytes はバイトの不変なシーケンスです。多くのメジャーなプロトコルが
ASCIIテキストエンコーディングをベースにしているので、 bytes オブジェクト
は ASCII 互換のデータに対してのみ動作する幾つかのメソッドを提供していて
、文字列オブジェクトと他の多くの点で近いです。

 -- クラス: bytes (source=b'')

 -- クラス: bytes (source, encoding, errors='strict')

     まず、 bytes リテラルの構文は文字列リテラルとほぼ同じで、 ‘b’ とい
     うプリフィックスを付けます:

        * シングルクォート: ‘b'still allows embedded "double" quotes'’

        * ダブルクォート: ‘b"still allows embedded 'single' quotes"’.

        * 3重クォート: ‘b'''3 single quotes'''’, ‘b"""3 double
          quotes"""’

     bytes リテラルでは (ソースコードのエンコーディングに関係なく)
     ASCII文字のみが許可されています。 127より大きい値を bytes リテラル
     に記述する場合は適切なエスケープシーケンスを書く必要があります。

     文字列リテラルと同じく、 bytes リテラルでも ‘r’ プリフィックスを用
     いてエスケープシーケンスの処理を無効にすることができます。 bytes リ
     テラルの様々な形式やサポートされているエスケープシーケンスについて
     は *note 文字列およびバイト列リテラル: 229f. を参照してください。

     bytesリテラルと repr 出力は ASCII テキストをベースにしたものですが
     、 bytes オブジェクトは、各値が ‘0 <= x < 256’ の範囲に収まるような
     整数 (この制限に違反しようとすると *note ValueError: 2ec. が発生し
     ます) の不変なシーケンスとして振る舞います。多くのバイナリフォーマ
     ットがASCIIテキストを元にした要素を持っていたり何らかのテキスト操作
     アルゴリズムによって操作されるものの、任意のバイナリデータが一般に
     テキストになっているわけではないことを強調するためにこのように設計
     されました (何も考えずにテキスト操作アルゴリズムをASCII非互換なバイ
     ナリデータフォーマットに対して行うとデータを破壊することがあります
     )。

     リテラル以外に、幾つかの方法で bytes オブジェクトを作ることができま
     す:

        * 指定された長さの、0で埋められた bytes オブジェクト:
          ‘bytes(10)’

        * 整数の iterable から: ‘bytes(range(20))’

        * 既存のバイナリデータからバッファプロトコルでコピーする:
          ‘bytes(obj)’

     *note bytes: 1e9a. ビルトイン関数も参照してください。

     16 進数で 2 桁の数は正確に 1 バイトに相当するため、16 進整はバイナ
     リデータを表現する形式として広く使われています。 従って、 bytes 型
     にはその形式でデータを読み取るための追加のクラスメソッドがあります
     。

      -- メソッド: classmethod fromhex (string, /)

          この *note bytes: 192. のクラスメソッドは、与えられた文字列オ
          ブジェクトをデコードして bytes オブジェクトを返します。それぞ
          れのバイトを 16 進数 2 桁で表現した文字列を指定しなければなり
          ません。ASCII 空白文字は無視されます。

               >>> bytes.fromhex('2Ef0 F1f2  ')
               b'.\xf0\xf1\xf2'

          バージョン 3.7 で変更: *note bytes.fromhex(): 190. は文字列に
          ある空白だけでなく、 ASCII の空白文字全てをスキップするように
          なりました。

          バージョン 3.14 で変更: *note bytes.fromhex(): 190. now
          accepts ASCII *note bytes: 192. and *note bytes-like objects:
          193. as input.

     bytes オブジェクトをその 16 進表記に変換するための、反対向きの変換
     関数があります。

      -- メソッド: hex (*, bytes_per_sep=1)

      -- メソッド: hex (sep, bytes_per_sep=1)

          インスタンス内の 1 バイトにつき 2 つの 16 進数を含む、文字列オ
          ブジェクトを返します。

               >>> b'\xf0\xf1\xf2'.hex()
               'f0f1f2'

          16進数文字列を読みやすく表示したい場合、単一文字パラメータ
          'sep' を指定してセパレータを出力に含めることができます。デフォ
          ルトでは、セパレータはバイトごとに表示が区切られるように追加さ
          れます。2つ目のオプションパラメータ 'bytes_per_sep' はセパレー
          タを入れる間隔を制御します。正の整数値はセパレータの位置を右か
          ら計算し、負の整数値は左から計算します。

               >>> value = b'\xf0\xf1\xf2'
               >>> value.hex('-')
               'f0-f1-f2'
               >>> value.hex('_', 2)
               'f0_f1f2'
               >>> b'UUDDLRLRAB'.hex(' ', -4)
               '55554444 4c524c52 4142'

          Added in version 3.5.

          バージョン 3.8 で変更: *note bytes.hex(): f65. が、16進数出力
          の各バイトを分割するセパレータを挿入するためのオプションパラメ
          ータ 'sep' と 'bytes_per_sep' をサポートするようになりました。

bytes オブジェクトは (タプルに似た) 整数のシーケンスなので、 bytes オブ
ジェクト 'b' について、 ‘b[0]’ は整数になり、 ‘b[0:1]’ は長さ 1 の bytes
オブジェクトになります。 (この動作は、文字列に対するインデックス指定もス
ライスも長さ 1 の文字列を返すのと対照的です。)

bytes オブジェクトの repr 出力はリテラル形式 (‘b'...'’) になります。
‘bytes([46, 46, 46])’ などの形式よりも便利な事が多いからです。 bytes オ
ブジェクトはいつでも ‘list(b)’ で整数のリストに変換できます。


File: python.info,  Node: bytearray オブジェクト,  Next: bytes と bytearray の操作,  Prev: バイトオブジェクト,  Up: バイナリシーケンス型 --- bytes bytearray memoryview

5.4.10.2 bytearray オブジェクト
...............................

*note bytearray: 344. オブジェクトは *note bytes: 192. オブジェクトの可
変なバージョンです。

 -- クラス: bytearray (source=b'')

 -- クラス: bytearray (source, encoding, errors='strict')

     bytearray に専用のリテラル構文はないので、コンストラクタを使って作
     成します:

        * 空のインスタンスを作る: ‘bytearray()’

        * 指定された長さの0で埋められたインスタンスを作る:
          ‘bytearray(10)’

        * 整数の iterable から: ‘bytearray(range(20))’

        * 既存のバイナリデータからバッファプロトコルを通してコピーする:
          ‘bytearray(b'Hi!')’

     bytearray オブジェクトは可変なので、 *note bytes と bytearray
     の操作: 25c3. で解説されている bytes オブジェクトと共通の操作に加え
     て、 *note mutable: 25c2. シーケンス操作もサポートしています。

     *note bytearray: 1e9b. ビルトイン関数も参照してください。

     16 進数で 2 桁の数は正確に 1 バイトに相当するため、16 進整はバイナ
     リデータを表現する形式として広く使われています。 従って、 bytearray
     型にはその形式でデータを読み取るための追加のクラスメソッドがありま
     す。

      -- メソッド: classmethod fromhex (string, /)

          この *note bytearray: 344. のクラスメソッドは、与えられた文字
          列オブジェクトをデコードして bytearray オブジェクトを返します
          。それぞれのバイトを 16 進数 2 桁で表現した文字列を指定しなけ
          ればなりません。ASCII 空白文字は無視されます。

               >>> bytearray.fromhex('2Ef0 F1f2  ')
               bytearray(b'.\xf0\xf1\xf2')

          バージョン 3.7 で変更: *note bytearray.fromhex(): 191. は文字
          列にある空白だけでなく、 ASCII の空白文字全てをスキップするよ
          うになりました。

          バージョン 3.14 で変更: *note bytearray.fromhex(): 191. now
          accepts ASCII *note bytes: 192. and *note bytes-like objects:
          193. as input.

     bytearray オブジェクトをその 16 進表記に変換するための、反対向きの
     変換関数があります。

      -- メソッド: hex (*, bytes_per_sep=1)

      -- メソッド: hex (sep, bytes_per_sep=1)

          インスタンス内の 1 バイトにつき 2 つの 16 進数を含む、文字列オ
          ブジェクトを返します。

               >>> bytearray(b'\xf0\xf1\xf2').hex()
               'f0f1f2'

          Added in version 3.5.

          バージョン 3.8 で変更: *note bytes.hex(): f65. と同様に、
          *note bytearray.hex(): f66. が、16進数出力の各バイトを分割する
          セパレータを挿入するためのオプションパラメータ 'sep' と
          'bytes_per_sep' をサポートするようになりました。

      -- メソッド: resize (size, /)

          Resize the *note bytearray: 344. to contain 'size' bytes.
          'size' must be greater than or equal to 0.

          If the *note bytearray: 344. needs to shrink, bytes beyond
          'size' are truncated.

          If the *note bytearray: 344. needs to grow, all new bytes,
          those beyond 'size', will be set to null bytes.

          This is equivalent to:

               >>> def resize(ba, size):
               ...     if len(ba) > size:
               ...         del ba[size:]
               ...     else:
               ...         ba += b'\0' * (size - len(ba))

          例:

               >>> shrink = bytearray(b'abc')
               >>> shrink.resize(1)
               >>> (shrink, len(shrink))
               (bytearray(b'a'), 1)
               >>> grow = bytearray(b'abc')
               >>> grow.resize(5)
               >>> (grow, len(grow))
               (bytearray(b'abc\x00\x00'), 5)

          Added in version 3.14.

bytearray オブジェクトは整数のシーケンス (リストのようなもの) なので、
bytearray オブジェクト 'b' について、 ‘b[0]’ は整数になり、 ‘b[0:1]’ は
長さ 1 の bytearray オブジェクトになります。(これは、文字列においてイン
デックス指定もスライスも長さ 1 の文字列を返すのと対照的です。)

bytearray オブジェクトの表記はバイトのリテラル形式 (‘bytearray(b'...')’)
を使用します。これは ‘bytearray([46, 46, 46])’ などの形式よりも便利な事
が多いためです。 bytearray オブジェクトはいつでも ‘list(b)’ で整数のリス
トに変換できます。


File: python.info,  Node: bytes と bytearray の操作,  Next: printf 形式での bytes の書式化,  Prev: bytearray オブジェクト,  Up: バイナリシーケンス型 --- bytes bytearray memoryview

5.4.10.3 bytes と bytearray の操作
..................................

bytes と bytearray は両方共 *note 一般のシーケンス操作: 2607. をサポート
しています。また、両方とも *note bytes-like object: 193. をサポートして
いる任意のオブジェクトを対象に操作することもできます。この柔軟性により
bytes と bytearray を自由に混ぜてもエラーを起こすことなく扱うことができ
ます。ただし、操作の結果のオブジェクトはその操作の順序に依存することにな
ります。

     注釈: 文字列のメソッドが引数として bytes を受け付けないのと同様、
     bytes オブジェクトと bytearray オブジェクトのメソッドは引数として文
     字列を受け付けません。例えば、以下のように書かなければなりません:

          a = "abc"
          b = a.replace("a", "f")

     および:

          a = b"abc"
          b = a.replace(b"a", b"f")

いくつかの bytes と bytearray の操作は ASCII と互換性のあるバイナリフォ
ーマットが使われていると仮定していますので、フォーマットの不明なバイナリ
データに対して使うことは避けるべきです。こうした制約については以下で説明
します。

     注釈: これらの ASCII ベースの演算を使って ASCII ベースではないバイ
     ナリデータを操作すると、データを破壊する恐れがあります。

以下の bytes および bytearray オブジェクトのメソッドは、任意のバイナリデ
ータに対して使用できます。

 -- メソッド: bytes.count (sub[, start[, end]])
 -- メソッド: bytearray.count (sub[, start[, end]])

     ['start', 'end'] の範囲に、部分シーケンス 'sub' が重複せず出現する
     回数を返します。オプション引数 'start' および 'end' はスライス表記
     と同じように解釈されます。

     検索対象の部分シーケンスは、任意の *note bytes-like object: 193. ま
     たは 0 から 255 の範囲の整数にできます。

     'sub' が空の場合は、文字と文字の間にある空のスライスの数、すなわち
     bytesオブジェクトの長さに1を加えたものを返します。

     バージョン 3.3 で変更: 部分シーケンスとして 0 から 255 の範囲の整数
     も受け取れるようになりました。

 -- メソッド: bytes.removeprefix (prefix, /)
 -- メソッド: bytearray.removeprefix (prefix, /)

     バリナリーデータが文字列 'prefix' で始まる場合、
     ‘bytes[len(prefix):]’ を返します。それ以外の場合、元のバイナリーデ
     ータのコピーを返します:

          >>> b'TestHook'.removeprefix(b'Test')
          b'Hook'
          >>> b'BaseTestCase'.removeprefix(b'Test')
          b'BaseTestCase'

     'prefix' は、任意の *note bytes-like object: 193. にできます。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

     Added in version 3.9.

 -- メソッド: bytes.removesuffix (suffix, /)
 -- メソッド: bytearray.removesuffix (suffix, /)

     バイナリーデータが文字列 'suffix' で終わり、 'suffix' が空でない場
     合、 ‘bytes[:-len(suffix)]’ を返します。それ以外の場合、元のバイナ
     リーデータのコピーを返します:

          >>> b'MiscTests'.removesuffix(b'Tests')
          b'Misc'
          >>> b'TmpDirMixin'.removesuffix(b'Tests')
          b'TmpDirMixin'

     'suffix' は、任意の *note bytes-like object: 193. にできます。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

     Added in version 3.9.

 -- メソッド: bytes.decode (encoding='utf-8', errors='strict')
 -- メソッド: bytearray.decode (encoding='utf-8', errors='strict')

     *note str: 169. にデコードされたbytesを返します。

     'encoding' のデフォルト値は ‘'utf-8'’ です; 指定可能な値については
     *note 標準エンコーディング: fb8. を参照してください。

     'errors' はデコーディングエラーをどのように取り扱うかを制御します。
     ‘'strict'’ (デフォルト) では *note UnicodeError: 462. 例外が送出さ
     れます。そのほかに指定可能な値は ‘'ignore'’, ‘'replace'’ と、そして
     *note codecs.register_error(): 16b4. で登録された名前です。詳しくは
     *note エラーハンドラ: 1b6f. を参照してください。

     パフォーマンス上の理由から、 'errors' の値の妥当性は、デコーディン
     グエラーが実際に発生するか、 *note Python 開発モード: 508. が有効に
     なっているか、もしくは *note デバッグビルド: 509. が使われていない
     限りチェックされません。

          注釈: 引数 'encoding' を *note str: 169. に渡すと *note
          bytes-like object: 193. を直接デコードすることができます。つま
          り、一時的な ‘bytes’ や ‘bytearray’ オブジェクトを作成する必要
          はありません。

     バージョン 3.1 で変更: キーワード引数のサポートが追加されました。

     バージョン 3.9 で変更: 'errors' 引数の値は *note Python 開発モード:
     508. と *note デバッグモード: 509. でチェックされるようになりました
     。

 -- メソッド: bytes.endswith (suffix[, start[, end]])
 -- メソッド: bytearray.endswith (suffix[, start[, end]])

     バイナリデータが指定された 'suffix' で終わる場合は ‘True’ を、そう
     でなければ ‘False’ を返します。 'suffix' は見つけたい複数の接尾語の
     タプルでも構いません。オプションの 'start' が指定されている場合、そ
     の位置から判定を開始します。オプションの 'end' が指定されている場合
     、その位置で比較を終了します。

     検索対象の接尾語 (複数も可) は、任意の *note bytes-like object:
     193. にできます。

 -- メソッド: bytes.find (sub[, start[, end]])
 -- メソッド: bytearray.find (sub[, start[, end]])

     スライス ‘s[start:end]’ に部分シーケンス 'sub' が含まれる場合、デー
     タ中のその 'sub' の最小のインデックスを返します。オプション引数
     'start' および 'end' はスライス表記と同様に解釈されます。 'sub' が
     見つからなかった場合、 ‘-1’ を返します。

     検索対象の部分シーケンスは、任意の *note bytes-like object: 193. ま
     たは 0 から 255 の範囲の整数にできます。

          注釈: *note find(): 1bd4. メソッドは、 'sub' の位置を知りたい
          ときにのみ使うべきです。 'sub' が部分文字列 (訳注: おそらく原
          文の誤り、正しくは部分シーケンス) であるかどうかのみを調べるに
          は、 *note in: 34b. 演算子を使ってください:

               >>> b'Py' in b'Python'
               True

     バージョン 3.3 で変更: 部分シーケンスとして 0 から 255 の範囲の整数
     も受け取れるようになりました。

 -- メソッド: bytes.index (sub[, start[, end]])
 -- メソッド: bytearray.index (sub[, start[, end]])

     *note find(): 1bd4. と同様ですが、部分シーケンスが見つからなかった
     場合 *note ValueError: 2ec. を送出します。

     検索対象の部分シーケンスは、任意の *note bytes-like object: 193. ま
     たは 0 から 255 の範囲の整数にできます。

     バージョン 3.3 で変更: 部分シーケンスとして 0 から 255 の範囲の整数
     も受け取れるようになりました。

 -- メソッド: bytes.join (iterable, /)
 -- メソッド: bytearray.join (iterable, /)

     'iterable' 中のバイナリデータを結合した bytes または bytearray オブ
     ジェクトを返します。 'iterable' に *note str: 169. オブジェクトなど
     *note bytes-like objects: 193. ではない値が含まれている場合、 *note
     TypeError: 198. が送出されます。なお要素間のセパレータは、このメソ
     ッドを提供する bytes または bytearray オブジェクトとなります。

 -- メソッド: static bytes.maketrans (from, to, /)
 -- メソッド: static bytearray.maketrans (from, to, /)

     この静的メソッドは、 *note bytes.translate(): 264d. に渡すのに適し
     た変換テーブルを返します。このテーブルは、 'from' 中の各バイトを
     'to' の同じ位置にあるバイトにマッピングします。 'from' と 'to' は両
     方とも同じ長さの *note bytes-like objects: 193. でなければなりませ
     ん。

     Added in version 3.1.

 -- メソッド: bytes.partition (sep, /)
 -- メソッド: bytearray.partition (sep, /)

     区切り 'sep' が最初に出現する位置でシーケンスを分割し、 3 要素のタ
     プルを返します。タプルの内容は、区切りの前の部分、その区切りオブジ
     ェクトまたはその bytearray 型のコピー、そして区切りの後ろの部分です
     。もし区切りが見つからなければ、タプルには元のシーケンスのコピーと
     、その後ろに二つの空の bytes または bytearray オブジェクトが入りま
     す。

     検索する区切りとしては、任意の *note bytes-like object: 193. を指定
     できます。

 -- メソッド: bytes.replace (old, new, count=-1, /)
 -- メソッド: bytearray.replace (old, new, count=-1, /)

     部分シーケンス 'old' を全て 'new' に置換したシーケンスを返します。
     オプション引数 'count' が与えられている場合、先頭から 'count' 個の
     'old' だけを置換します。

     検索する部分シーケンスおよび置換後の部分シーケンスとしては、任意の
     *note bytes-like object: 193. を指定できます。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.rfind (sub[, start[, end]])
 -- メソッド: bytearray.rfind (sub[, start[, end]])

     シーケンス中の領域 ‘s[start:end]’ に 'sub' が含まれる場合、その最大
     のインデックスを返します。オプション引数 'start' および 'end' はス
     ライス表記と同様に解釈されます。 'sub' が見つからなかった場合 ‘-1’
     を返します。

     検索対象の部分シーケンスは、任意の *note bytes-like object: 193. ま
     たは 0 から 255 の範囲の整数にできます。

     バージョン 3.3 で変更: 部分シーケンスとして 0 から 255 の範囲の整数
     も受け取れるようになりました。

 -- メソッド: bytes.rindex (sub[, start[, end]])
 -- メソッド: bytearray.rindex (sub[, start[, end]])

     *note rfind(): 1bd5. と同様ですが、部分シーケンス 'sub' が見つから
     なかった場合 *note ValueError: 2ec. を送出します。

     検索対象の部分シーケンスは、任意の *note bytes-like object: 193. ま
     たは 0 から 255 の範囲の整数にできます。

     バージョン 3.3 で変更: 部分シーケンスとして 0 から 255 の範囲の整数
     も受け取れるようになりました。

 -- メソッド: bytes.rpartition (sep, /)
 -- メソッド: bytearray.rpartition (sep, /)

     区切り 'sep' が最後に出現する位置でシーケンスを分割し、 3 要素のタ
     プルを返します。タプルの内容は、区切りの前の部分、その区切りオブジ
     ェクトまたはその bytearray 型のコピー、そして区切りの後ろの部分です
     。もし区切れなければ、タプルには二つの空の bytes または bytearray オ
     ブジェクトと、その後ろに元のシーケンスのコピーが入ります。

     検索する区切りとしては、任意の *note bytes-like object: 193. を指定
     できます。

 -- メソッド: bytes.startswith (prefix[, start[, end]])
 -- メソッド: bytearray.startswith (prefix[, start[, end]])

     バイナリデータが指定された 'prefix' で始まる場合は ‘True’ を、そう
     でなければ ‘False’ を返します。 'prefix' は見つけたい複数の接頭語の
     タプルでも構いません。オプションの 'start' が指定されている場合、そ
     の位置から判定を開始します。オプションの 'end' が指定されている場合
     、その位置で比較を終了します。

     検索対象の接頭語 (複数も可) は、任意の *note bytes-like object:
     193. にできます。

 -- メソッド: bytes.translate (table, /, delete=b'')
 -- メソッド: bytearray.translate (table, /, delete=b'')

     オプション引数 'delete' に現れるすべてのバイトを除去し、残ったバイ
     トを与えられた変換テーブルに従ってマップした、バイト列やバイト配列
     オブジェクトのコピーを返します。変換テーブルは長さ 256 のバイト列オ
     ブジェクトでなければなりません。

     変換テーブルの作成に、 *note bytes.maketrans(): 148c. メソッドを使
     うこともできます。

     文字を削除するだけの変換には、 'table' 引数を ‘None’ に設定してくだ
     さい:

          >>> b'read this short text'.translate(None, b'aeiou')
          b'rd ths shrt txt'

     バージョン 3.6 で変更: 'delete' はキーワード引数として指定可能にな
     りました。

以下の bytes および bytearray オブジェクトのメソッドは、 ASCII と互換性
のあるバイナリフォーマットが使われていると仮定していますが、適切な引数を
指定すれば任意のバイナリデータに使用できます。なお、このセクションで紹介
する bytearray のメソッドはすべてインプレースで動作 'せず' 、新しいオブ
ジェクトを生成します。

 -- メソッド: bytes.center (width, fillbyte=b' ', /)
 -- メソッド: bytearray.center (width, fillbyte=b' ', /)

     長さ 'width' の中央寄せされたシーケンスのコピーを返します。パディン
     グには 'fillbyte' で指定された値 (デフォルトでは ASCII スペース) が
     使われます。 *note bytes: 192. オブジェクトの場合、 'width' が
     ‘len(s)’ 以下なら元のシーケンスが返されます。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.ljust (width, fillbyte=b' ', /)
 -- メソッド: bytearray.ljust (width, fillbyte=b' ', /)

     長さ 'width' の左寄せされたシーケンスのコピーを返します。パディング
     には 'fillbyte' で指定された値 (デフォルトでは ASCII スペース) が使
     われます。 *note bytes: 192. オブジェクトの場合、 'width' が
     ‘len(s)’ 以下なら元のシーケンスが返されます。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.lstrip (bytes=None, /)
 -- メソッド: bytearray.lstrip (bytes=None, /)

     Return a copy of the sequence with specified leading bytes removed.
     The 'bytes' argument is a binary sequence specifying the set of
     byte values to be removed.  If omitted or ‘None’, the 'bytes'
     argument defaults to removing ASCII whitespace.  The 'bytes'
     argument is not a prefix; rather, all combinations of its values
     are stripped:

          >>> b'   spacious   '.lstrip()
          b'spacious   '
          >>> b'www.example.com'.lstrip(b'cmowz.')
          b'example.com'

     削除したいバイト値のバイナリシーケンスには、 *note bytes-like
     object: 193. を指定することができます。バイナリシーケンスで指定した
     文字の集合全てではなく、指定した文字列そのものを接頭辞として削除す
     るメソッドについては、 *note removeprefix(): 2662. を参照してくださ
     い。使用例:

          >>> b'Arthur: three!'.lstrip(b'Arthur: ')
          b'ee!'
          >>> b'Arthur: three!'.removeprefix(b'Arthur: ')
          b'three!'

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.rjust (width, fillbyte=b' ', /)
 -- メソッド: bytearray.rjust (width, fillbyte=b' ', /)

     長さ 'width' の右寄せされたシーケンスのコピーを返します。パディング
     には 'fillbyte' で指定された値 (デフォルトでは ASCII スペース) が使
     われます。 *note bytes: 192. オブジェクトの場合、 'width' が
     ‘len(s)’ 以下なら元のシーケンスが返されます。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.rsplit (sep=None, maxsplit=-1)
 -- メソッド: bytearray.rsplit (sep=None, maxsplit=-1)

     'sep' を区切りとして、同じ型の部分シーケンスに分割します。
     'maxsplit' が与えられた場合、シーケンスの '右端' から最大
     'maxsplit' 回だけ分割を行います。 'sep' が指定されていないか ‘None’
     のとき、 ASCII 空白文字の組み合わせで作られる部分シーケンスすべてが
     区切りとなります。右から分割していくことを除けば、 *note rsplit():
     1799. は後ほど詳しく述べる *note split(): 1798. と同様に振る舞いま
     す。

 -- メソッド: bytes.rstrip (bytes=None, /)
 -- メソッド: bytearray.rstrip (bytes=None, /)

     Return a copy of the sequence with specified trailing bytes
     removed.  The 'bytes' argument is a binary sequence specifying the
     set of byte values to be removed.  If omitted or ‘None’, the
     'bytes' argument defaults to removing ASCII whitespace.  The
     'bytes' argument is not a suffix; rather, all combinations of its
     values are stripped:

          >>> b'   spacious   '.rstrip()
          b'   spacious'
          >>> b'mississippi'.rstrip(b'ipz')
          b'mississ'

     削除したいバイト値のバイナリシーケンスには、 *note bytes-like
     object: 193. を指定することができます。バイナリシーケンスで指定した
     文字の集合全てではなく、指定した文字列そのものを接尾辞として削除す
     るメソッドについては、 *note removesuffix(): 2664. を参照してくださ
     い。使用例:

          >>> b'Monty Python'.rstrip(b' Python')
          b'M'
          >>> b'Monty Python'.removesuffix(b' Python')
          b'Monty'

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.split (sep=None, maxsplit=-1)
 -- メソッド: bytearray.split (sep=None, maxsplit=-1)

     'sep' を区切りとして、同じ型の部分シーケンスに分割します。
     'maxsplit' が与えられ、かつ負の数でない場合、シーケンスの '左端' か
     ら最大 'maxsplit' 回だけ分割を行います (したがって結果のリストの要
     素数は最大で ‘maxsplit+1’ になります)。 'maxsplit' が指定されていな
     いか ‘-1’ のとき、分割の回数に制限はありません (可能なだけ分割され
     ます)。

     'sep' が与えられた場合、連続した区切り用バイト値はまとめられず、空
     の部分シーケンスを区切っていると判断されます(例えば
     ‘b'1,,2'.split(b',')’ は ‘[b'1', b'', b'2']’ を返します)。引数
     'sep' は複数バイトのシーケンスを1つの区切り文字にもできます。空のシ
     ーケンスを分割すると、分割するオブジェクトの型によって ‘[b'']’ また
     は ‘[bytearray(b'')]’ が返ります。引数 'sep' には、あらゆる *note
     bytes-like object: 193. を指定できます。

     例えば:

          >>> b'1,2,3'.split(b',')
          [b'1', b'2', b'3']
          >>> b'1,2,3'.split(b',', maxsplit=1)
          [b'1', b'2,3']
          >>> b'1,2,,3,'.split(b',')
          [b'1', b'2', b'', b'3', b'']
          >>> b'1<>2<>3<4'.split(b'<>')
          [b'1', b'2', b'3<4']

     'sep' が指定されていないか ‘None’ の場合、異なる分割アルゴリズムが
     適用されます。連続する ASCII 空白文字はひとつの区切りとみなされ、ま
     たシーケンスの先頭や末尾に空白があっても、結果の最初や最後に空のシ
     ーケンスは含まれません。したがって区切りを指定せずに空のシーケンス
     や ASCII 空白文字だけのシーケンスを分割すると、 ‘[]’ が返されます。

     例えば:

          >>> b'1 2 3'.split()
          [b'1', b'2', b'3']
          >>> b'1 2 3'.split(maxsplit=1)
          [b'1', b'2 3']
          >>> b'   1   2   3   '.split()
          [b'1', b'2', b'3']

 -- メソッド: bytes.strip (bytes=None, /)
 -- メソッド: bytearray.strip (bytes=None, /)

     Return a copy of the sequence with specified leading and trailing
     bytes removed.  The 'bytes' argument is a binary sequence
     specifying the set of byte values to be removed.  If omitted or
     ‘None’, the 'bytes' argument defaults to removing ASCII whitespace.
     The 'bytes' argument is not a prefix or suffix; rather, all
     combinations of its values are stripped:

          >>> b'   spacious   '.strip()
          b'spacious'
          >>> b'www.example.com'.strip(b'cmowz.')
          b'example'

     除去対象のバイト値を含むバイナリシーケンスには、任意の *note
     bytes-like object: 193. を指定できます。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

以下の bytes および bytearray オブジェクトのメソッドは、 ASCII と互換性
のあるバイナリフォーマットが使われていると仮定しており、任意のバイナリデ
ータに対して使用すべきではありません。なお、このセクションで紹介する
bytearray のメソッドはすべてインプレースで動作 'せず' 、新しいオブジェク
トを生成します。

 -- メソッド: bytes.capitalize ()
 -- メソッド: bytearray.capitalize ()

     各バイトを ASCII 文字と解釈して、最初のバイトを大文字にし、残りを小
     文字にしたシーケンスのコピーを返します。 ASCII 文字と解釈できないバ
     イト値は、変更されません。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.expandtabs (tabsize=8)
 -- メソッド: bytearray.expandtabs (tabsize=8)

     桁 (column) 位置と指定されたタブ幅 (tab size) に応じて、全ての
     ASCII タブ文字を 1 つ以上の ASCII スペース文字に置換したシーケンス
     のコピーを返します。ここで 'tabsize' バイトごとの桁位置をタブ位置と
     します (デフォルト値である 8 の場合、タブ位置は 0 桁目、 8 桁目、
     16 桁目、と続いていきます)。シーケンスを展開するにあたって、まず現
     桁位置をゼロに設定し、シーケンスを 1 バイトずつ調べていきます。もし
     バイト値が ASCII タブ文字 (‘b'\t'’) であれば、現桁位置が次のタブ位
     置と一致するまで 1 つ以上の ASCII スペース文字を結果のシーケンスに
     挿入していきます（ASCII タブ文字自体はコピーしません）。もしバイト
     値が ASCII 改行文字 (‘b'\n'’ もしくは ‘b'\r'’) であれば、そのままコ
     ピーした上で現桁位置を 0 にリセットします。その他のバイト値について
     は変更せずにコピーし、そのバイト値の表示のされ方（訳注: 全角、半角
     など）に関わらず現桁位置を 1 つ増加させます:

          >>> b'01\t012\t0123\t01234'.expandtabs()
          b'01      012     0123    01234'
          >>> b'01\t012\t0123\t01234'.expandtabs(4)
          b'01  012 0123    01234'

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.isalnum ()
 -- メソッド: bytearray.isalnum ()

     シーケンスが空でなく、かつ全てのバイト値が ASCII 文字のアルファベッ
     トまたは数字である場合は ‘True’ を、そうでなければ ‘False’ を返しま
     す。ここでの ASCII 文字のアルファベットとはシーケンス
     ‘b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'’ に含まれ
     るバイト値です。 ASCII 文字の数字とは ‘b'0123456789'’ に含まれるバ
     イト値です。

     例えば:

          >>> b'ABCabc1'.isalnum()
          True
          >>> b'ABC abc1'.isalnum()
          False

 -- メソッド: bytes.isalpha ()
 -- メソッド: bytearray.isalpha ()

     シーケンスが空でなく、かつ全てのバイト値が ASCII 文字のアルファベッ
     トである場合は ‘True’ を、そうでなければ ‘False’ を返します。ここで
     の ASCII 文字のアルファベットとはシーケンス
     ‘b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'’ に含まれ
     るバイト値です。

     例えば:

          >>> b'ABCabc'.isalpha()
          True
          >>> b'ABCabc1'.isalpha()
          False

 -- メソッド: bytes.isascii ()
 -- メソッド: bytearray.isascii ()

     シーケンスが空であるか、シーケンスの全てのバイトが ASCII である場合
     に ‘True’ を、それ以外の場合に ‘False’ を返します。 ASCII バイトは
     0-0x7F の範囲にあります。

     Added in version 3.7.

 -- メソッド: bytes.isdigit ()
 -- メソッド: bytearray.isdigit ()

     シーケンスが空でなく、かつ全てのバイト値が ASCII 文字の数字である場
     合は ‘True’ を、そうでなければ ‘False’ を返します。ここでの ASCII 文
     字の数字とは ‘b'0123456789'’ に含まれるバイト値です。

     例えば:

          >>> b'1234'.isdigit()
          True
          >>> b'1.23'.isdigit()
          False

 -- メソッド: bytes.islower ()
 -- メソッド: bytearray.islower ()

     シーケンス中に小文字アルファベットの ASCII 文字が一つ以上あり、かつ
     大文字アルファベットの ASCII 文字が一つも無い場合に ‘True’ を返しま
     す。そうでなければ ‘False’ を返します。

     例えば:

          >>> b'hello world'.islower()
          True
          >>> b'Hello world'.islower()
          False

     ここでの小文字の ASCII 文字とは ‘b'abcdefghijklmnopqrstuvwxyz'’ に
     含まれるバイト値です。また大文字の ASCII 文字とは
     ‘b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'’ に含まれるバイト値です。

 -- メソッド: bytes.isspace ()
 -- メソッド: bytearray.isspace ()

     シーケンスが空でなく、かつ全てのバイト値が ASCII 空白文字である場合
     は ‘True’ を、そうでなければ ‘False’ を返します。ここでの ASCII 空
     白文字とはシーケンス ‘b' \t\n\r\x0b\f'’ に含まれるバイト値です (半
     角スペース、タブ、ラインフィード、キャリッジリターン、垂直タブ、フ
     ォームフィード) 。

 -- メソッド: bytes.istitle ()
 -- メソッド: bytearray.istitle ()

     シーケンスが空でなく、かつ ASCII のタイトルケース文字列になっている
     場合は ‘True’ を、そうでなければ ‘False’ を返します。「タイトルケー
     ス文字列」の定義については *note bytes.title(): 2641. を参照してく
     ださい。

     例えば:

          >>> b'Hello World'.istitle()
          True
          >>> b'Hello world'.istitle()
          False

 -- メソッド: bytes.isupper ()
 -- メソッド: bytearray.isupper ()

     シーケンス中に大文字アルファベットの ASCII 文字が一つ以上あり、かつ
     小文字アルファベットの ASCII 文字が一つも無い場合に ‘True’ を返しま
     す。そうでなければ ‘False’ を返します。

     例えば:

          >>> b'HELLO WORLD'.isupper()
          True
          >>> b'Hello world'.isupper()
          False

     ここでの小文字の ASCII 文字とは ‘b'abcdefghijklmnopqrstuvwxyz'’ に
     含まれるバイト値です。また大文字の ASCII 文字とは
     ‘b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'’ に含まれるバイト値です。

 -- メソッド: bytes.lower ()
 -- メソッド: bytearray.lower ()

     シーケンスに含まれる大文字アルファベットの ASCII 文字を全て小文字ア
     ルファベットに変換したシーケンスのコピーを返します。

     例えば:

          >>> b'Hello World'.lower()
          b'hello world'

     ここでの小文字の ASCII 文字とは ‘b'abcdefghijklmnopqrstuvwxyz'’ に
     含まれるバイト値です。また大文字の ASCII 文字とは
     ‘b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'’ に含まれるバイト値です。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.splitlines (keepends=False)
 -- メソッド: bytearray.splitlines (keepends=False)

     バイナリシーケンスを ASCII の改行コードで分割し、各行をリストにして
     返します。このメソッドは *note universal newlines: f35. アプローチ
     で行を分割します。 'keepends' 引数に真を与えた場合を除き、改行コー
     ドは結果のリストに含まれません。

     例えば:

          >>> b'ab c\n\nde fg\rkl\r\n'.splitlines()
          [b'ab c', b'', b'de fg', b'kl']
          >>> b'ab c\n\nde fg\rkl\r\n'.splitlines(keepends=True)
          [b'ab c\n', b'\n', b'de fg\r', b'kl\r\n']

     *note split(): 2626. とは違って、空シーケンスに対して区切り 'sep' を
     与えて呼び出すと空のリストを返します。またシーケンス末尾に改行コー
     ドがある場合、（訳註: その後ろに空行があるとは判断せず）余分な行を
     生成することはありません:

          >>> b"".split(b'\n'), b"Two lines\n".split(b'\n')
          ([b''], [b'Two lines', b''])
          >>> b"".splitlines(), b"One line\n".splitlines()
          ([], [b'One line'])

 -- メソッド: bytes.swapcase ()
 -- メソッド: bytearray.swapcase ()

     シーケンスに含まれる小文字アルファベットの ASCII 文字を全て大文字ア
     ルファベットに変換し、さらに大文字アルファベットを同様に小文字アル
     ファベットに変換したシーケンスのコピーを返します。

     例えば:

          >>> b'Hello World'.swapcase()
          b'hELLO wORLD'

     ここでの小文字の ASCII 文字とは ‘b'abcdefghijklmnopqrstuvwxyz'’ に
     含まれるバイト値です。また大文字の ASCII 文字とは
     ‘b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'’ に含まれるバイト値です。

     Unlike *note str.swapcase(): 2642, it is always the case that
     ‘bin.swapcase().swapcase() == bin’ for the binary versions.  Case
     conversions are symmetrical in ASCII, even though that is not
     generally true for arbitrary Unicode code points.

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.title ()
 -- メソッド: bytearray.title ()

     タイトルケース化したバイナリシーケンスを返します。具体的には、各単
     語が大文字アルファベットの ASCII 文字で始まり、かつ残りの文字が小文
     字アルファベットになっているシーケンスが返ります。大文字小文字の区
     別が無いバイト値については変更されずそのままになります。

     例えば:

          >>> b'Hello world'.title()
          b'Hello World'

     ここでの小文字の ASCII 文字とは ‘b'abcdefghijklmnopqrstuvwxyz'’ に
     含まれるバイト値です。また大文字の ASCII 文字とは
     ‘b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'’ に含まれるバイト値です。その他のバ
     イト値については、大文字小文字の区別はありません。

     このアルゴリズムは、連続した文字の集まりという、言語から独立した単
     純な単語の定義を使います。この定義は多くの状況ではうまく機能します
     が、短縮形や所有格のアポストロフィが単語の境界になってしまい、望み
     の結果を得られない場合があります:

          >>> b"they're bill's friends from the UK".title()
          b"They'Re Bill'S Friends From The Uk"

     正規表現を使うことでアポストロフィに対応できます:

          >>> import re
          >>> def titlecase(s):
          ...     return re.sub(rb"[A-Za-z]+('[A-Za-z]+)?",
          ...                   lambda mo: mo.group(0)[0:1].upper() +
          ...                              mo.group(0)[1:].lower(),
          ...                   s)
          ...
          >>> titlecase(b"they're bill's friends.")
          b"They're Bill's Friends."

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.upper ()
 -- メソッド: bytearray.upper ()

     シーケンスに含まれる小文字アルファベットの ASCII 文字を全て大文字ア
     ルファベットに変換したシーケンスのコピーを返します。

     例えば:

          >>> b'Hello World'.upper()
          b'HELLO WORLD'

     ここでの小文字の ASCII 文字とは ‘b'abcdefghijklmnopqrstuvwxyz'’ に
     含まれるバイト値です。また大文字の ASCII 文字とは
     ‘b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'’ に含まれるバイト値です。

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。

 -- メソッド: bytes.zfill (width, /)
 -- メソッド: bytearray.zfill (width, /)

     長さが 'width' になるよう ASCII ‘b'0'’ で左詰めしたシーケンスのコピ
     ーを返します。先頭が符号接頭辞 (‘b'+'’/‘b'-'’) だった場合、 ‘b'0'’
     は符号の前ではなく '後' に挿入されます。 *note bytes: 192. オブジェ
     クトの場合、 'width' が ‘len(seq)’ 以下であれば元のシーケンスが返り
     ます。

     例えば:

          >>> b"42".zfill(5)
          b'00042'
          >>> b"-42".zfill(5)
          b'-0042'

          注釈: bytearray のこのメソッドはインプレースでは動作 'しません
          ' - 一切変化が無い場合でも、常に新しいオブジェクトを生成します
          。


File: python.info,  Node: printf 形式での bytes の書式化,  Next: メモリビュー,  Prev: bytes と bytearray の操作,  Up: バイナリシーケンス型 --- bytes bytearray memoryview

5.4.10.4 ‘printf’ 形式での bytes の書式化
.........................................

     注釈: ここで述べる書式化演算には様々な癖があり、よく間違いの元にな
     っています (タプルや辞書を正しく表示できないなど)。もし表示する値が
     タプルや辞書かもしれない場合、それをタプルに包むようにしてください
     。

bytes オブジェクト (‘bytes’/‘bytearray’) には固有の操作: ‘%’ 演算子 (モ
ジュロ) があります。この演算子は bytes の '書式化' または '補間' 演算子
とも呼ばれます。‘format % values’ ('format' は bytes オブジェクト) とす
ると、'format' 中の ‘%’ 変換指定は 'values' 中のゼロ個またはそれ以上の要
素で置換されます。この動作は C 言語における ‘sprintf()’ に似ています。

'format' が単一の引数しか要求しない場合、 'values' はタプルではない単一
のオブジェクトで問題ありません。 (1) それ以外の場合、 'values' は書式シ
ーケンス（訳註: 先の例での 'format' ）中で指定された項目と正確に同じ数の
要素を含むタプルか、単一のマッピング型のオブジェクト (たとえば辞書) でな
ければなりません。

一つの変換指定子は 2 またはそれ以上の文字を含み、その構成要素は以下から
なりますが、示した順に出現しなければなりません:

  1. 指定子の開始を示す文字 ‘'%'’ 。

  2. マップキー (オプション)。丸括弧で囲った文字列からなります (例えば
     ‘(somename)’) 。

  3. 変換フラグ (オプション)。一部の変換型の結果に影響します。

  4. 最小のフィールド幅 (オプション)。 ‘'*'’ (アスタリスク) を指定した場
     合、実際の文字列幅が 'values' タプルの次の要素から読み出されます。
     タプルには最小フィールド幅やオプションの精度指定の後に変換したいオ
     ブジェクトがくるようにします。

  5. 精度 (オプション)。 ‘'.'’ (ドット) とその後に続く精度で与えられます
     。 ‘'*'’ (アスタリスク) を指定した場合、精度の桁数は 'values' タプ
     ルの次の要素から読み出されます。タプルには精度指定の後に変換したい
     値がくるようにします。

  6. 精度長変換子 (オプション)。

  7. 変換型。

‘%’ 演算子の右側の引数が辞書の場合 (またはその他のマッピング型の場合) 、
bytes オブジェクト中のフォーマットには、辞書のキーを丸括弧で囲って文字
‘'%'’ の直後に書いたものが含まれていなければ 'なりません' 。マップキーは
書式化したい値をマッピングから選び出します。例えば:

     >>> print(b'%(language)s has %(number)03d quote types.' %
     ...       {b'language': b"Python", b"number": 2})
     b'Python has 002 quote types.'

この場合、 ‘*’ 指定子をフォーマットに含めてはいけません (‘*’ 指定子は順
番付けされたパラメタのリストが必要だからです)。

変換フラグ文字を以下に示します:

Flag          意味
              
----------------------------------------------------------------------------------------
              
‘'#'’         値の変換に (下で定義されている) "別の形式" を使います。
              
              
‘'0'’         数値型に対してゼロによるパディングを行います。
              
              
‘'-'’         変換された値を左寄せにします (‘'0'’ と同時に与えた場合、 ‘'0'’ を上書き
              します) 。
              
              
‘' '’         (スペース) 符号付きの変換で正の数の場合、前に一つスペースを空けます (そ
              うでない場合は空文字になります) 。
              
              
‘'+'’         変換の先頭に符号文字 (‘'+'’ または ‘'-'’) を付けます("スペース" フラグ
              を上書きします) 。
              

精度長変換子(‘h’, ‘l’,または ‘L’) を使うことができますが、 Python では必
要ないため無視されます。 - つまり、例えば ‘%ld’ は ‘%d’ と等価です。

変換型を以下に示します:

変換             意味                                                      注釈
                                                                           
---------------------------------------------------------------------------------------
                                                                           
‘'d'’            符号付き 10 進整数。
                 
                                                                           
‘'i'’            符号付き 10 進整数。
                 
                                                                           
‘'o'’            符号付き 8 進数。                                         (1)
                                                                           
                                                                           
‘'u'’            旧式の型 - ‘'d'’ と同じです。                             (8)
                                                                           
                                                                           
‘'x'’            符号付き 16 進数 (小文字)。                               (2)
                                                                           
                                                                           
‘'X'’            符号付き 16 進数 (大文字)。                               (2)
                                                                           
                                                                           
‘'e'’            指数表記の浮動小数点数 (小文字)。                         (3)
                                                                           
                                                                           
‘'E'’            指数表記の浮動小数点数 (大文字)。                         (3)
                                                                           
                                                                           
‘'f'’            10 進浮動小数点数。                                       (3)
                                                                           
                                                                           
‘'F'’            10 進浮動小数点数。                                       (3)
                                                                           
                                                                           
‘'g'’            浮動小数点数。指数部が -4 以上または精度以下の場合には    (4)
                 小文字指数表記、それ以外の場合には10進表記。              
                 
                                                                           
‘'G'’            浮動小数点数。指数部が -4 以上または精度以下の場合には    (4)
                 大文字指数表記、それ以外の場合には10進表記。              
                 
                                                                           
‘'c'’            1 バイト (整数または要素 1 つの ‘bytes’/‘bytearray’ オ
                 ブジェクトを受理します)
                 
                                                                           
‘'b'’            バイナリシーケンス (*note buffer protocol: 260. をサポ    (5)
                 ートするか、 *note __bytes__(): 7fe. メソッドがあるオブ   
                 ジェクト)
                 
                                                                           
‘'s'’            ‘'s'’ は ‘'b'’ の別名です。Python 2/3 の両方を対象とし    (6)
                 たコードでのみ使用すべきです。                            
                 
                                                                           
‘'a'’            バイナリシーケンス (Python オブジェクトを                 (5)
                 ‘repr(obj).encode('ascii', 'backslashreplace')’ で変換    
                 します)。
                 
                                                                           
‘'r'’            ‘'r'’ は ‘'a'’ の別名です。Python 2/3 の両方を対象とし    (7)
                 たコードでのみ使用すべきです。                            
                 
                                                                           
‘'%'’            引数を変換せず、返される文字列中では文字 ‘'%'’ になりま
                 す。
                 

注釈:

  1. 別の形式を指定（訳注: 変換フラグ ‘#’ を使用）すると 8 進数を表す接
     頭辞 (‘'0o'’) が最初の数字の前に挿入されます。

  2. 別の形式を指定（訳注: 変換フラグ ‘#’ を使用）すると 16 進数を表す接
     頭辞 ‘'0x'’ または ‘'0X'’ (使用するフォーマット文字が ‘'x'’ か
     ‘'X'’ に依存します) が最初の数字の前に挿入されます。

  3. この形式にした場合、変換結果には常に小数点が含まれ、それはその後ろ
     に数字が続かない場合にも適用されます。

     指定精度は小数点の後の桁数を決定し、そのデフォルトは 6 です。

  4. この形式にした場合、変換結果には常に小数点が含まれ他の形式とは違っ
     て末尾の 0 は取り除かれません。

     指定精度は小数点の前後の有効桁数を決定し、そのデフォルトは 6 です。

  5. 精度が ‘N’ なら、出力は ‘N’ 文字に切り詰められます。

  6. ‘b'%s'’ は非推奨ですが、3.x 系では削除されません。

  7. ‘b'%r'’ は非推奨ですが、3.x 系では削除されません。

  8. PEP 237(2) を参照してください。

     注釈: bytearray のこのメソッドはインプレースでは動作 'しません' - 一
     切変化が無い場合でも、常に新しいオブジェクトを生成します。

参考
....

PEP 461(3) - bytes と bytearray への % 書式化の追加

Added in version 3.5.

   ---------- Footnotes ----------

   (1) 従って、一個のタプルだけをフォーマット出力したい場合には出力した
いタプルを唯一の要素とする単一のタプルを 'values' に与えなくてはなりませ
ん。

   (2) https://peps.python.org/pep-0237/

   (3) https://peps.python.org/pep-0461/


File: python.info,  Node: メモリビュー,  Prev: printf 形式での bytes の書式化,  Up: バイナリシーケンス型 --- bytes bytearray memoryview

5.4.10.5 メモリビュー
.....................

*note memoryview: 165. オブジェクトは、Python コードが *note
バッファプロトコル: 260. をサポートするオブジェクトの内部データへ、コピ
ーすることなくアクセスすることを可能にします。

 -- クラス: memoryview (object)

          'object' を参照する *note memoryview: 165. を作成します。
          'object' はバッファプロトコルをサポートしていなければなりませ
          ん。バッファプロトコルをサポートする組み込みオブジェクトには、
          *note bytes: 192. 、 *note bytearray: 344. などがあります。

          *note memoryview: 165. は元となる 'object' が扱うメモリーの最
          小単位を '要素' として扱います。多くの単純なオブジェクト、例え
          ば *note bytes: 192. や *note bytearray: 344. では、要素は単バ
          イトになりますが、他の *note array.array: 4be. 等の型では、要
          素はより大きくなりえます。

          ‘len(view)’ はビューの入れ子になったリスト表現である *note
          tolist: 2685. の長さと等しくなります。ビューが ‘view.ndim = 1’
          を満たす場合はビューの要素数とも等しくなります。

          バージョン 3.12 で変更: ‘view.ndim == 0’ で ‘len(view)’ の場合
          、1の代わりに *note TypeError: 198. を返すようになりました。

          *note itemsize: 2686. 属性は各要素のバイト数を与えます。

          *note memoryview: 165. はスライスおよびインデックス指定で内容
          を取得できます。一次元のスライスは部分ビューになります:

               >>> v = memoryview(b'abcefg')
               >>> v[1]
               98
               >>> v[-1]
               103
               >>> v[1:4]
               <memory at 0x7f3ddc9f4350>
               >>> bytes(v[1:4])
               b'bce'

          もしメモリビューの *note format: 124c. が *note struct: db. モ
          ジュールによって定義されているネイティブのフォーマット指定子で
          あれば、整数または整数のタプルでのインデックス指定により適切な
          型の '要素1つ' を得ることができます。一次元のメモリビューでは
          、整数または整数 1 つのタプルでインデックス指定できます。多次
          元のメモリビューでは、その次元数を 'ndim' としたとき、ちょうど
          'ndim' 個の整数からなるタプルでインデックス指定できます。ゼロ
          次元のメモリビューでは、空のタプルでインデックス指定できます。

          *note format: 124c. が単バイト単位ではない例を示します:

               >>> import array
               >>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])
               >>> m = memoryview(a)
               >>> m[0]
               -11111111
               >>> m[-1]
               44444444
               >>> m[::2].tolist()
               [-11111111, -33333333]

          メモリビューの参照しているオブジェクトが書き込み可能であれば、
          一次元スライスでの代入が可能です。ただしサイズの変更はできませ
          ん:

               >>> data = bytearray(b'abcefg')
               >>> v = memoryview(data)
               >>> v.readonly
               False
               >>> v[0] = ord(b'z')
               >>> data
               bytearray(b'zbcefg')
               >>> v[1:4] = b'123'
               >>> data
               bytearray(b'z123fg')
               >>> v[2:3] = b'spam'
               Traceback (most recent call last):
                 File "<stdin>", line 1, in <module>
               ValueError: memoryview assignment: lvalue and rvalue have different structures
               >>> v[2:6] = b'spam'
               >>> data
               bytearray(b'z1spam')

          'B', 'b', 'c' いずれかのフォーマットの *note ハッシュ可能:
          824. な (読み出し専用の) 型の1次元メモリビューもまた、ハッシュ
          可能です。ハッシュは ‘hash(m) == hash(m.tobytes())’ として定義
          されています:

               >>> v = memoryview(b'abcefg')
               >>> hash(v) == hash(b'abcefg')
               True
               >>> hash(v[2:4]) == hash(b'ce')
               True
               >>> hash(v[::-2]) == hash(b'abcefg'[::-2])
               True

          バージョン 3.3 で変更: 1 次元のメモリビューがスライス可能にな
          りました。 'B', 'b', 'c' いずれかのフォーマットの 1 次元のメモ
          リビューが *note ハッシュ可能: 824. になりました。

          バージョン 3.4 で変更: memoryview は自動的に *note
          collections.abc.Sequence: 13dc. へ登録されるようになりました。

          バージョン 3.5 で変更: メモリビューは整数のタプルでインデック
          ス指定できるようになりました。

          バージョン 3.14 で変更: memoryview is now a *note generic
          type: 1a1.

          *note memoryview: 165. にはいくつかのメソッドがあります:

           -- メソッド: __eq__ (exporter)

               memoryview と PEP 3118(1) エクスポーターは、 shape が同じ
               で、 *note struct: db. のフォーマットで解釈したときの値が
               同じ場合に同値になります。

               *note tolist(): 2685. がサポートしている *note struct:
               db. フォーマットの一部では、 ‘v.tolist() == w.tolist()’ が
               成り立つときに ‘v’ == ‘w’ になります:

                    >>> import array
                    >>> a = array.array('I', [1, 2, 3, 4, 5])
                    >>> b = array.array('d', [1.0, 2.0, 3.0, 4.0, 5.0])
                    >>> c = array.array('b', [5, 3, 1])
                    >>> x = memoryview(a)
                    >>> y = memoryview(b)
                    >>> x == a == y == b
                    True
                    >>> x.tolist() == a.tolist() == y.tolist() == b.tolist()
                    True
                    >>> z = y[::-2]
                    >>> z == c
                    True
                    >>> z.tolist() == c.tolist()
                    True

               どちらかの書式文字列が *note struct: db. モジュールにサポ
               ートされていなければ、 (書式文字列とバッファの内容が同一
               でも) オブジェクトは常に等しくないものとして比較されます:

                    >>> from ctypes import BigEndianStructure, c_long
                    >>> class BEPoint(BigEndianStructure):
                    ...     _fields_ = [("x", c_long), ("y", c_long)]
                    ...
                    >>> point = BEPoint(100, 200)
                    >>> a = memoryview(point)
                    >>> b = memoryview(point)
                    >>> a == point
                    False
                    >>> a == b
                    False

               浮動小数点数の場合と同様 memoryview オブジェクトに対する
               ‘v is w’ は ‘v == w’ を意味 'しない' ことに注意してくださ
               い。

               バージョン 3.3 で変更: 以前のバージョンは、要素フォーマッ
               トと論理的な配列構造を無視して生のメモリを比較していまし
               た。

           -- メソッド: tobytes (order='C')

               バッファ中のデータをバイト文字列として返します。これはメ
               モリビューに対して *note bytes: 192. コンストラクタを呼び
               出すのと同等です。

                    >>> m = memoryview(b"abc")
                    >>> m.tobytes()
                    b'abc'
                    >>> bytes(m)
                    b'abc'

               連続でない配列については、結果はすべての要素がバイトに変
               換されたものを含むフラットなリスト表現に等しくなります。
               *note tobytes(): 2688. は、 *note struct: db. モジュール
               文法にないものを含むすべての書式文字列をサポートします。

               Added in version 3.8: 'order' は {'C', 'F', 'A'} のいずれ
               かを取ることができます。 'order' が 'C' か 'F' の場合、元
               の配列は C または Fortran のデータ並びにそれぞれ変換され
               ます。連続したデータに対するビューの場合、 'A' は物理メモ
               リ上のデータの正確なコピーを返します。特に、メモリ上にお
               ける Fortran のデータ並びは保存されます。不連続なデータに
               対するビューの場合、データはまず C のデータ並びに変換され
               ます。 'order=None' は 'order='C" と同じです。

           -- メソッド: hex (*, bytes_per_sep=1)

           -- メソッド: hex (sep, bytes_per_sep=1)

               バッファ中の各バイトを 2 つの 16 進数で表した文字列を返し
               ます:

                    >>> m = memoryview(b"abc")
                    >>> m.hex()
                    '616263'

               Added in version 3.5.

               バージョン 3.8 で変更: *note bytes.hex(): f65. と同様に、
               *note memoryview.hex(): f67. は、16進数出力のバイト文字列
               を分割するセパレータを挿入するためのオプションパラメータ
               'sep' と 'bytes_per_sep' をサポートするようになりました。

           -- メソッド: tolist ()

               バッファ中のデータを要素のリストとして返します。

                    >>> memoryview(b'abc').tolist()
                    [97, 98, 99]
                    >>> import array
                    >>> a = array.array('d', [1.1, 2.2, 3.3])
                    >>> m = memoryview(a)
                    >>> m.tolist()
                    [1.1, 2.2, 3.3]

               バージョン 3.3 で変更: *note tolist(): 2685. が *note
               struct: db. モジュール文法に含まれるすべての単一文字の
               native フォーマットと多次元の表現をサポートするようになり
               ました。

           -- メソッド: toreadonly ()

               読み込み専用のメモリビューオブジェクトを返します。元のメ
               モリビューオブジェクトは変更されません。

                    >>> m = memoryview(bytearray(b'abc'))
                    >>> mm = m.toreadonly()
                    >>> mm.tolist()
                    [97, 98, 99]
                    >>> mm[0] = 42
                    Traceback (most recent call last):
                      File "<stdin>", line 1, in <module>
                    TypeError: cannot modify read-only memory
                    >>> m[0] = 43
                    >>> mm.tolist()
                    [43, 98, 99]

               Added in version 3.8.

           -- メソッド: release ()

               memoryview オブジェクトによって晒されている、元になるバッ
               ファを解放します。多くのオブジェクトはビューに支配されて
               いるときに特殊なふるまいをします (例えば、 *note
               bytearray: 344. は大きさの変更を一時的に禁止します)。です
               から、release() を呼び出すことは、これらの制約をできるだ
               け早く取り除く (そしてぶら下がったリソースをすべて解放す
               る) のに便利です。

               After this method has been called, any further operation
               on the view raises a *note ValueError: 2ec. (except *note
               release(): 13d6. itself which can be called multiple
               times):

                    >>> m = memoryview(b'abc')
                    >>> m.release()
                    >>> m[0]
                    Traceback (most recent call last):
                      File "<stdin>", line 1, in <module>
                    ValueError: operation forbidden on released memoryview object

               コンテキストマネージャプロトコルは、 ‘with’ 文を使って同
               様の効果を得るのに使えます:

                    >>> with memoryview(b'abc') as m:
                    ...     m[0]
                    ...
                    97
                    >>> m[0]
                    Traceback (most recent call last):
                      File "<stdin>", line 1, in <module>
                    ValueError: operation forbidden on released memoryview object

               Added in version 3.2.

           -- メソッド: cast (format, /)

           -- メソッド: cast (format, shape, /)

               memoryview を新しいフォーマットか shape にキャストします
               。 'shape' はデフォルトで ‘[byte_length//new_itemsize]’ で
               、 1次元配列になります。戻り値は memoryview ですが、バッ
               ファー自体はコピーされません。サポートされている変換は 1次
               元配列 -> C言語型の連続配列 と C言語型の連続配列 -> 1次元
               配列 です（参考: *note contiguous: 124e.）。

               キャスト後のフォーマットは単一要素のネイティブフォーマッ
               トに限定され、 *note struct: db. の文法で指定します。利用
               可能なフォーマットのひとつはバイトフォーマット ('B', 'b'
               または 'c') です。キャスト後のバイト長は元の長さと同じで
               なければなりません。全てのフォーマットのバイト長は、オペ
               レーティングシステムに依存することに注意してください。

               1次元 long から 1次元 unsigned byte へのキャスト:

                    >>> import array
                    >>> a = array.array('l', [1,2,3])
                    >>> x = memoryview(a)
                    >>> x.format
                    'l'
                    >>> x.itemsize
                    8
                    >>> len(x)
                    3
                    >>> x.nbytes
                    24
                    >>> y = x.cast('B')
                    >>> y.format
                    'B'
                    >>> y.itemsize
                    1
                    >>> len(y)
                    24
                    >>> y.nbytes
                    24

               1次元 unsigned byte から 1次元 char へのキャスト:

                    >>> b = bytearray(b'zyz')
                    >>> x = memoryview(b)
                    >>> x[0] = b'a'
                    Traceback (most recent call last):
                      ...
                    TypeError: memoryview: invalid type for format 'B'
                    >>> y = x.cast('c')
                    >>> y[0] = b'a'
                    >>> b
                    bytearray(b'ayz')

               1次元 byte から 3次元 int へ、そして 1次元 signed char へ
               のキャスト:

                    >>> import struct
                    >>> buf = struct.pack("i"*12, *list(range(12)))
                    >>> x = memoryview(buf)
                    >>> y = x.cast('i', shape=[2,2,3])
                    >>> y.tolist()
                    [[[0, 1, 2], [3, 4, 5]], [[6, 7, 8], [9, 10, 11]]]
                    >>> y.format
                    'i'
                    >>> y.itemsize
                    4
                    >>> len(y)
                    2
                    >>> y.nbytes
                    48
                    >>> z = y.cast('b')
                    >>> z.format
                    'b'
                    >>> z.itemsize
                    1
                    >>> len(z)
                    48
                    >>> z.nbytes
                    48

               1次元 unsigned long から 2次元 unsigned long へのキャスト
               :

                    >>> buf = struct.pack("L"*6, *list(range(6)))
                    >>> x = memoryview(buf)
                    >>> y = x.cast('L', shape=[2,3])
                    >>> len(y)
                    2
                    >>> y.nbytes
                    48
                    >>> y.tolist()
                    [[0, 1, 2], [3, 4, 5]]

               Added in version 3.3.

               バージョン 3.5 で変更: 単バイトのビューへキャストする場合
               、キャスト元のフォーマットについて制約は無くなりました。

           -- メソッド: count (value, /)

               Count the number of occurrences of 'value'.

               Added in version 3.14.

      -- メソッド: index (value, start=0, stop=sys.maxsize, /)

               Return the index of the first occurrence of 'value' (at
               or after index 'start' and before index 'stop').

               Raises a *note ValueError: 2ec. if 'value' cannot be
               found.

               Added in version 3.14.

          読み出し専用の属性もいくつか使えます:

           -- の属性: obj

               memoryview が参照しているオブジェクト:

                    >>> b  = bytearray(b'xyz')
                    >>> m = memoryview(b)
                    >>> m.obj is b
                    True

               Added in version 3.3.

           -- の属性: nbytes

               ‘nbytes == product(shape) * itemsize ==
               len(m.tobytes())’.  その配列が連続表現において利用するス
               ペースです。これは ‘len(m)’ と一致するとは限りません:

                    >>> import array
                    >>> a = array.array('i', [1,2,3,4,5])
                    >>> m = memoryview(a)
                    >>> len(m)
                    5
                    >>> m.nbytes
                    20
                    >>> y = m[::2]
                    >>> len(y)
                    3
                    >>> y.nbytes
                    12
                    >>> len(y.tobytes())
                    12

               多次元配列:

                    >>> import struct
                    >>> buf = struct.pack("d"*12, *[1.5*x for x in range(12)])
                    >>> x = memoryview(buf)
                    >>> y = x.cast('d', shape=[3,4])
                    >>> y.tolist()
                    [[0.0, 1.5, 3.0, 4.5], [6.0, 7.5, 9.0, 10.5], [12.0, 13.5, 15.0, 16.5]]
                    >>> len(y)
                    3
                    >>> y.nbytes
                    96

               Added in version 3.3.

           -- の属性: readonly

               メモリが読み出し専用かどうかを示す真偽値です。

           -- の属性: format

               ビューの中の各要素に対する (*note struct: db. モジュール
               スタイルの) フォーマットを含む文字列。 memoryview は、任
               意のフォーマット文字列を使ってエクスポーターから作成する
               ことができます。しかし、いくつかのメソッド(例えば *note
               tolist(): 2685.) はネイティブの単一要素フォーマットに制限
               されます。

               バージョン 3.3 で変更: フォーマット ‘'B'’ は struct モジ
               ュール構文で扱われるようになりました。これは
               ‘memoryview(b'abc')[0] == b'abc'[0] == 97’ ということを意
               味します。

           -- の属性: itemsize

               memoryview の各要素のバイト単位の大きさ:

                    >>> import array, struct
                    >>> m = memoryview(array.array('H', [32000, 32001, 32002]))
                    >>> m.itemsize
                    2
                    >>> m[0]
                    32000
                    >>> struct.calcsize('H') == m.itemsize
                    True

           -- の属性: ndim

               メモリが表す多次元配列が何次元かを示す整数です。

           -- の属性: shape

               メモリが表している N 次元配列の形状を表す、長さ *note
               ndim: 1250. の整数のタプルです。

               バージョン 3.3 で変更: ndim = 0 の場合は ‘None’ ではなく
               空のタプルとなるよう変更されました。

           -- の属性: strides

               配列のそれぞれの次元に対して、それぞれの要素にアクセスす
               るのに必要なバイト数を表す、長さ *note ndim: 1250. の整数
               のタプルです。

               バージョン 3.3 で変更: ndim = 0 の場合は ‘None’ ではなく
               空のタプルとなるよう変更されました。

           -- の属性: suboffsets

               PILスタイルの配列の内部で利用している値。この値はただの情
               報として公開されています。

           -- の属性: c_contiguous

               メモリーが C 形式の順序で連続しているかどうかを示す真偽値
               （参考: *note contiguous: 124e. ）。

               Added in version 3.3.

           -- の属性: f_contiguous

               メモリーがFortran形式の順序で連続しているかどうかを示す真
               偽値（参考: *note contiguous: 124e. ）。

               Added in version 3.3.

           -- の属性: contiguous

               メモリーが連続しているかどうかを示す真偽値（参考: *note
               contiguous: 124e. ）。

               Added in version 3.3.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3118/


File: python.info,  Node: set（集合）型 --- set frozenset,  Next: マッピング型 --- dict,  Prev: バイナリシーケンス型 --- bytes bytearray memoryview,  Up: 組み込み型

5.4.11 set（集合）型 -- ‘set’, ‘frozenset’
------------------------------------------

'set' オブジェクトは、固有の *note hashable: 824. オブジェクトの順序なし
コレクションです。通常の用途には、帰属テスト、シーケンスからの重複除去、
積集合、和集合、差集合、対称差 (排他的論理和) のような数学的演算の計算が
含まれます。(他のコンテナについては組み込みの *note dict: 183, *note
list: 24d, *note tuple: 614. クラスや *note collections: 1e. モジュール
を参照してください。)

集合は、他のコレクションと同様、 ‘x in set’, ‘len(set)’, ‘for x in set’
をサポートします。コレクションには順序がないので、集合は挿入の順序や要素
の位置を記録しません。従って、集合はインデクシング、スライシング、その他
のシーケンス的な振舞いをサポートしません。

There are currently two built-in set types, *note set: 184. and *note
frozenset: 7f2.  The *note set: 184. type is mutable -- the contents can
be changed using methods like *note add(): 233e. and *note remove():
2691.  Since it is mutable, it has no hash value and cannot be used as
either a dictionary key or as an element of another set.  The *note
frozenset: 7f2. type is immutable and *note hashable: 824. -- its
contents cannot be altered after it is created; it can therefore be used
as a dictionary key or as an element of another set.

空でない *note set: 184. (*note frozenset: 7f2. ではない) は、*note set:
184. コンストラクタに加え、要素を波括弧中にカンマで区切って列挙すること
でも生成できます。例: ‘{'jack', 'sjoerd'}’。

どちらのクラスのコンストラクタも同様に働きます:

 -- クラス: set (iterable=(), /)
 -- クラス: frozenset (iterable=(), /)

     'iterable' から要素を取り込んだ、新しい *note set: 184. もしくは
     *note frozenset: 7f2. オブジェクトを返します。 集合の要素は *note
     ハッシュ可能: 824. なものでなくてはなりません。集合の集合を表現する
     ためには、内側の集合は *note frozenset: 7f2. オブジェクトでなくては
     なりません。'iterable' が指定されない場合、新しい空の集合が返されま
     す。

集合はいくつかの方法で生成できます:

   * 波括弧内にカンマ区切りで要素を列挙する: ‘{'jack', 'sjoerd'}’

   * 集合内包表記を使う: ‘{c for c in 'abracadabra' if c not in 'abc'}’

   * 型コンストラクタを使う: ‘set()’, ‘set('foobar')’, ‘set(['a', 'b',
     'foo'])’

*note set: 184. および *note frozenset: 7f2. のインスタンスは以下の操作
を提供します:

 -- Describe: len(s)

     集合 's' の要素数 ('s' の濃度) を返します。

 -- Describe: x in s

     'x' が 's' のメンバーに含まれるか判定します。

 -- Describe: x not in s

     'x' が 's' のメンバーに含まれていないことを判定します。

 -- メソッド: frozenset.isdisjoint (other, /)
 -- メソッド: set.isdisjoint (other, /)

     集合が 'other' と共通の要素を持たないとき、‘True’ を返します。集合
     はそれらの積集合が空集合となるときのみ、互いに素 (disjoint) となり
     ます。

 -- メソッド: frozenset.issubset (other, /)
 -- メソッド: set.issubset (other, /)

 -- Describe: set <= other

     set の全ての要素が 'other' に含まれるか判定します。

 -- Describe: set < other

     set が 'other' の真部分集合であるかを判定します。つまり、 ‘set <=
     other and set != other’ と等価です。

 -- メソッド: frozenset.issuperset (other, /)
 -- メソッド: set.issuperset (other, /)

 -- Describe: set >= other

     'other' の全ての要素が set に含まれるか判定します。

 -- Describe: set > other

     set が 'other' の真上位集合であるかを判定します。つまり、 ‘set >=
     other and set != other’ と等価です。

 -- メソッド: frozenset.union (*others)
 -- メソッド: set.union (*others)

 -- Describe: set | other | ...

     set と全ての other の要素からなる新しい集合を返します。

 -- メソッド: frozenset.intersection (*others)
 -- メソッド: set.intersection (*others)

 -- Describe: set & other & ...

     set と全ての other に共通する要素を持つ、新しい集合を返します。

 -- メソッド: frozenset.difference (*others)
 -- メソッド: set.difference (*others)

 -- Describe: set - other - ...

     set に含まれて、かつ、全ての other に含まれない要素を持つ、新しい集
     合を返します。

 -- メソッド: frozenset.symmetric_difference (other, /)
 -- メソッド: set.symmetric_difference (other, /)

 -- Describe: set ^ other

     set と 'other' のいずれか一方だけに含まれる要素を持つ新しい集合を返
     します。

 -- メソッド: frozenset.copy ()
 -- メソッド: set.copy ()

     集合の浅いコピーを返します。

Note, the non-operator versions of *note union(): 169c, *note
intersection(): 169d, *note difference(): 2698, *note
symmetric_difference(): 269a, *note issubset(): 2694, and *note
issuperset(): 2696. methods will accept any iterable as an argument.  In
contrast, their operator based counterparts require their arguments to
be sets.  This precludes error-prone constructions like ‘set('abc') &
'cbs'’ in favor of the more readable ‘set('abc').intersection('cbs')’.

*note set: 184. と *note frozenset: 7f2. のどちらも、集合同士の比較をサ
ポートします。二つの集合は、それぞれの集合の要素全てが他方にも含まれてい
る (互いに他方の部分集合である) とき、かつそのときに限り等しいです。一方
の集合が他方の集合の真部分集合である (部分集合であるが等しくない) とき、
かつそのときに限り一方の集合は他方の集合より小さいです。一方の集合が他方
の集合の真上位集合である (上位集合であるが等しくない) とき、かつそのとき
に限り一方の集合は他方の集合より大きいです。

*note set: 184. のインスタンスは、 *note frozenset: 7f2. のインスタンス
と、要素に基づいて比較されます。例えば、 ‘set('abc') ==
frozenset('abc')’ や ‘set('abc') in set([frozenset('abc')])’ は ‘True’ を
返します。

部分集合と等価性の比較は全順序付けを行う関数へと一般化することはできませ
ん。例えば、互いに素である二つの非空集合は、等しくなく、他方の部分集合で
もありませんから、以下の 'すべて' に ‘False’ を返します: ‘a<b’, ‘a==b’,
そして ‘a>b’.

集合は半順序（部分集合関係）しか定義しないので、集合のリストにおける
*note list.sort(): dc8. メソッドの出力は未定義です。

集合の要素は、辞書のキーのように、 *note ハッシュ可能: 824. でなければな
りません。

*note set: 184. インスタンスと *note frozenset: 7f2. インスタンスを取り
混ぜての二項演算は、第一被演算子の型を返します。例えば: ‘frozenset('ab')
| set('bc')’ は *note frozenset: 7f2. インスタンスを返します。

以下の表に挙げる演算は *note set: 184. に適用されますが、*note
frozenset: 7f2. のイミュータブルなインスタンスには適用されません:

 -- メソッド: set.update (*others)

 -- Describe: set |= other | ...

     全ての other の要素を追加し、 set を更新します。

 -- メソッド: set.intersection_update (*others)

 -- Describe: set &= other & ...

     元の set と全ての other に共通する要素だけを残して set を更新します
     。

 -- メソッド: set.difference_update (*others)

 -- Describe: set -= other | ...

     'other' に含まれる要素を取り除き、 set を更新します。

 -- メソッド: set.symmetric_difference_update (other, /)

 -- Describe: set ^= other

     どちらかにのみ含まれて、共通には持たない要素のみで set を更新します
     。

 -- メソッド: set.add (elem, /)

     要素 'elem' を set に追加します。

 -- メソッド: set.remove (elem, /)

     要素 'elem' を set から取り除きます。'elem' が set に含まれていなけ
     れば *note KeyError: 5e7. を送出します。

 -- メソッド: set.discard (elem, /)

     要素 'elem' が set に含まれていれば、取り除きます。

 -- メソッド: set.pop ()

     's' から任意の要素を取り除き、それを返します。集合が空の場合、
     *note KeyError: 5e7. を送出します

 -- メソッド: set.clear ()

     set の全ての要素を取り除きます。

Note, the non-operator versions of the *note update(): 269e, *note
intersection_update(): 169e, *note difference_update(): 269f, and *note
symmetric_difference_update(): 169f. methods will accept any iterable as
an argument.

Note, the 'elem' argument to the *note __contains__(): 15d3, *note
remove(): 2691, and *note discard(): 26a0. methods may be a set.  To
support searching for an equivalent frozenset, a temporary one is
created from 'elem'.


File: python.info,  Node: マッピング型 --- dict,  Next: コンテキストマネージャ型,  Prev: set（集合）型 --- set frozenset,  Up: 組み込み型

5.4.12 マッピング型 -- ‘dict’
-----------------------------

*note マッピング: 13d3. オブジェクトは、 *note ハッシュ可能: 824. な値を
任意のオブジェクトに対応付けます。マッピングはミュータブルなオブジェクト
です。現在、標準のマッピング型は辞書 ('dictionary') だけです。 (他のコン
テナについては組み込みの *note list: 24d, *note set: 184, および *note
tuple: 614. クラスと、 *note collections: 1e. モジュールを参照してくださ
い。)

辞書のキーには、 'ほぼ' どんな値も使うことができます。 キーとして使えな
いのは、 *note hashable: 824. (ハッシュ可能) でない値、すなわちリストや
辞書のようなミュータブルな型 (内包する値ではなくオブジェクト自体が同一で
あるかによって比較が行われるような型)です。 比較した際に等しいとみなされ
る値 (例えば ‘1’ と ‘1.0’ と ‘True’) は、どれを使っても同じエントリーに
関連付けられます。

 -- クラス: dict (**kwargs)

 -- クラス: dict (mapping, /, **kwargs)

 -- クラス: dict (iterable, /, **kwargs)

     オプションの位置引数と空の可能性もあるキーワード引数の集合により初
     期化された新しい辞書を返します。

     辞書はいくつかの方法で生成できます:

        * 波括弧内にカンマ区切りで ‘key: value’ 対を列挙する: ‘{'jack':
          4098, 'sjoerd': 4127}’ あるいは ‘{4098: 'jack', 4127:
          'sjoerd'}’

        * 辞書内包表記を使う: ‘{}’, ‘{x: x ** 2 for x in range(10)}’

        * 型コンストラクタを使う: ‘dict()’, ‘dict([('foo', 100), ('bar',
          200)])’, ‘dict(foo=100, bar=200)’

     If no positional argument is given, an empty dictionary is created.
     If a positional argument is given and it defines a ‘keys()’ method,
     a dictionary is created by calling *note __getitem__(): 588. on the
     argument with each returned key from the method.  Otherwise, the
     positional argument must be an *note iterable: 12f1. object.  Each
     item in the iterable must itself be an iterable with exactly two
     elements.  The first element of each item becomes a key in the new
     dictionary, and the second element the corresponding value.  If a
     key occurs more than once, the last value for that key becomes the
     corresponding value in the new dictionary.

     キーワード引数が与えられた場合、キーワード引数とその値が位置引数か
     ら作られた辞書に追加されます。既に存在しているキーが追加された場合
     、キーワード引数の値は位置引数の値を置き換えます。

     Dictionaries compare equal if and only if they have the same ‘(key,
     value)’ pairs (regardless of ordering).  Order comparisons ('<',
     '<=', '>=', '>') raise *note TypeError: 198.  To illustrate
     dictionary creation and equality, the following examples all return
     a dictionary equal to ‘{"one": 1, "two": 2, "three": 3}’:

          >>> a = dict(one=1, two=2, three=3)
          >>> b = {'one': 1, 'two': 2, 'three': 3}
          >>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))
          >>> d = dict([('two', 2), ('one', 1), ('three', 3)])
          >>> e = dict({'three': 3, 'one': 1, 'two': 2})
          >>> f = dict({'one': 1, 'three': 3}, two=2)
          >>> a == b == c == d == e == f
          True

     最初の例のようにキーワード引数を与える方法では、キーは有効な Python
     の識別子でなければなりません。それ以外の方法では、辞書のキーとして
     有効などんなキーでも使えます。

     辞書は挿入順序を保存するようになりました。 キーの更新は順序には影響
     が無いことに注意してください。 いったん削除されてから再度追加された
     キーは末尾に挿入されます。:

          >>> d = {"one": 1, "two": 2, "three": 3, "four": 4}
          >>> d
          {'one': 1, 'two': 2, 'three': 3, 'four': 4}
          >>> list(d)
          ['one', 'two', 'three', 'four']
          >>> list(d.values())
          [1, 2, 3, 4]
          >>> d["one"] = 42
          >>> d
          {'one': 42, 'two': 2, 'three': 3, 'four': 4}
          >>> del d["two"]
          >>> d["two"] = None
          >>> d
          {'one': 42, 'three': 3, 'four': 4, 'two': None}

     バージョン 3.7 で変更: 辞書の順序が挿入順序であることが保証されるよ
     うになりました。この振る舞いは CPython 3.6 の実装詳細でした。

     以下は辞書型がサポートする操作です (それゆえ、カスタムのマップ型も
     これらの操作をサポートするべきです):

      -- Describe: list(d)

          辞書 'd' で使われている全てのキーのリストを返します。

      -- Describe: len(d)

          辞書 'd' の項目数を返します。

      -- Describe: d[key]

          'd' のキー 'key' の項目を返します。マップに 'key' が存在しなけ
          れば、 *note KeyError: 5e7. を送出します。

          If a subclass of dict defines a method *note __missing__():
          13d5. and 'key' is not present, the ‘d[key]’ operation calls
          that method with the key 'key' as argument.  The ‘d[key]’
          operation then returns or raises whatever is returned or
          raised by the ‘__missing__(key)’ call.  No other operations or
          methods invoke *note __missing__(): 13d5.  If *note
          __missing__(): 13d5. is not defined, *note KeyError: 5e7. is
          raised.  *note __missing__(): 13d5. must be a method; it
          cannot be an instance variable:

               >>> class Counter(dict):
               ...     def __missing__(self, key):
               ...         return 0
               ...
               >>> c = Counter()
               >>> c['red']
               0
               >>> c['red'] += 1
               >>> c['red']
               1

          The example above shows part of the implementation of *note
          collections.Counter: 12a3.  A different ‘__missing__()’ method
          is used by *note collections.defaultdict: 13d4.

      -- Describe: d[key] = value

          ‘d[key]’ に 'value' を設定します。

      -- Describe: del d[key]

          'd' から ‘d[key]’ を削除します。マップに 'key' が存在しなけれ
          ば、 *note KeyError: 5e7. を送出します。

      -- Describe: key in d

          'd' がキー 'key' を持っていれば ‘True’ を、そうでなければ、
          ‘False’ を返します。

      -- Describe: key not in d

          ‘not key in d’ と等価です。

      -- Describe: iter(d)

          辞書のキーに渡るイテレータを返します。これは ‘iter(d.keys())’
          へのショートカットです。

      -- メソッド: clear ()

          辞書の全ての項目を消去します。

      -- メソッド: copy ()

          辞書の浅いコピーを返します。

      -- メソッド: classmethod fromkeys (iterable, value=None, /)

          'iterable' からキーを取り、値を 'value' に設定した、新しい辞書
          を作成します。

          *note fromkeys(): 24e. は新しい辞書を返すクラスメソッドです。
          'value' はデフォルトで ‘None’ となります。 作られる辞書内のす
          べての値が同一のインスタンスを指すことになるため、'value' にミ
          ュータブルなオブジェクト (例えば空のリスト) を指定しても通常意
          味はありません。 別々の値を指すようにしたい場合は、代わりに
          *note 辞書内包表記: f7f. を使用してください。

      -- メソッド: get (key, default=None, /)

          'key' が辞書にあれば 'key' に対する値を、そうでなければ
          'default' を返します。 'default' が与えられなかった場合、デフ
          ォルトでは ‘None’ となります。そのため、このメソッドは *note
          KeyError: 5e7. を送出することはありません。

      -- メソッド: items ()

          辞書の項目 (‘(key, value)’ 対) の新しいビューを返します。*note
          ビューオブジェクトのドキュメント: 2618. を参照してください。

      -- メソッド: keys ()

          辞書のキーの新しいビューを返します。*note
          ビューオブジェクトのドキュメント: 2618. を参照してください。

      -- メソッド: pop (key, /)

      -- メソッド: pop (key, default, /)

          'key' が辞書に存在すればその値を辞書から消去して返し、そうでな
          ければ 'default' を返します。 'default' が与えられず、かつ
          'key' が辞書に存在しなければ *note KeyError: 5e7. を送出します
          。

      -- メソッド: popitem ()

          任意の ‘(key, value)’ 対を辞書から消去して返します。 対は LIFO
          (後入れ、先出し) の順序で返却されます。

          集合のアルゴリズムで使われるのと同じように、 *note popitem():
          173f. は辞書に繰り返し適用して消去するのに便利です。辞書が空で
          あれば、 *note popitem(): 173f. の呼び出しは *note KeyError:
          5e7. を送出します。

          バージョン 3.7 で変更: LIFO 順序が保証されるようになりました。
          以前のバージョンでは、 *note popitem(): 173f. は任意の
          key/value 対を返していました。

      -- Describe: reversed(d)

          辞書のキーに渡る逆イテレータを返します。これは
          ‘reversed(d.keys())’ へのショートカットです。

          Added in version 3.8.

      -- メソッド: setdefault (key, default=None, /)

          もし、 'key' が辞書に存在すれば、その値を返します。そうでなけ
          れば、値を 'default' として 'key' を挿入し、 'default' を返し
          ます。 'default' のデフォルトは ‘None’ です。

      -- メソッド: update (**kwargs)

      -- メソッド: update (mapping, /, **kwargs)

      -- メソッド: update (iterable, /, **kwargs)

          Update the dictionary with the key/value pairs from 'mapping'
          or 'iterable' and 'kwargs', overwriting existing keys.  Return
          ‘None’.

          *note update(): 167e. accepts either another object with a
          ‘keys()’ method (in which case *note __getitem__(): 588. is
          called with every key returned from the method) or an iterable
          of key/value pairs (as tuples or other iterables of length
          two).  If keyword arguments are specified, the dictionary is
          then updated with those key/value pairs: ‘d.update(red=1,
          blue=2)’.

      -- メソッド: values ()

          辞書の値の新しいビューを返します。*note
          ビューオブジェクトのドキュメント: 2618. を参照してください。

          ‘dict.values()’ で得られた２つのビューの等しさを比較すると、必
          ず ‘False’ が返ります。 ‘dict.values()’ どうしを比較したときも
          同様です:

               >>> d = {'a': 1}
               >>> d.values() == d.values()
               False

      -- Describe: d | other

          'd' と 'other' のキーと値を統合した新しい辞書を作成します。
          'd' と 'other' のキーに重複がある場合は、 'other' の方の値が優
          先されます。

          Added in version 3.9.

      -- Describe: d |= other

          辞書 'd' のキーと値を 'other' で更新します。 'other' は *note
          マッピング: 13d3. か、またはキーと値のペアの *note イテラブル:
          12f1. です。 'd' と 'other' のキーに重複がある場合は、 'other'
          の方の値が優先されます。

          Added in version 3.9.

     辞書と辞書のビューは ‘reversed()’ で順序を逆にすることができます:

          >>> d = {"one": 1, "two": 2, "three": 3, "four": 4}
          >>> d
          {'one': 1, 'two': 2, 'three': 3, 'four': 4}
          >>> list(reversed(d))
          ['four', 'three', 'two', 'one']
          >>> list(reversed(d.values()))
          [4, 3, 2, 1]
          >>> list(reversed(d.items()))
          [('four', 4), ('three', 3), ('two', 2), ('one', 1)]

     バージョン 3.8 で変更: 辞書がリバース可能になりました。

参考
....

*note dict: 183. の読み出し専用ビューを作るために *note
types.MappingProxyType: 698. を使うことができます。

Thread safety for dict objects
..............................

Creating a dictionary with the *note dict: 183. constructor is atomic
when the argument to it is a *note dict: 183. or a *note tuple: 614.
When using the *note dict.fromkeys(): 24e. method, dictionary creation
is atomic when the argument is a *note dict: 183, *note tuple: 614,
*note set: 184. or *note frozenset: 7f2.

The following operations and functions are *note lock-free: 2617. and
*note atomic: 2615.

     d[key]       # dict.__getitem__
     d.get(key)   # dict.get
     key in d     # dict.__contains__
     len(d)       # dict.__len__

All other operations from here on hold the *note per-object lock: 2616.

Writing or removing a single item is safe to call from multiple threads
and will not corrupt the dictionary:

     d[key] = value        # write
     del d[key]            # delete
     d.pop(key)            # remove and return
     d.popitem()           # remove and return last item
     d.setdefault(key, v)  # insert if missing

These operations may compare keys using *note __eq__(): cf2, which can
execute arbitrary Python code.  During such comparisons, the dictionary
may be modified by another thread.  For built-in types like *note str:
169, *note int: 19b, and *note float: 196, that implement *note
__eq__(): cf2. in C, the underlying lock is not released during
comparisons and this is not a concern.

The following operations return new objects and hold the *note
per-object lock: 2616. for the duration of the operation:

     d.copy()      # returns a shallow copy of the dictionary
     d | other     # merges two dicts into a new dict
     d.keys()      # returns a new dict_keys view object
     d.values()    # returns a new dict_values view object
     d.items()     # returns a new dict_items view object

The *note clear(): 17d6. method holds the lock for its duration.  Other
threads cannot observe elements being removed.

The following operations lock both dictionaries.  For *note update():
167e. and ‘|=’, this applies only when the other operand is a *note
dict: 183. that uses the standard dict iterator (but not subclasses that
override iteration).  For equality comparison, this applies to *note
dict: 183. and its subclasses:

     d.update(other_dict)  # both locked when other_dict is a dict
     d |= other_dict       # both locked when other_dict is a dict
     d == other_dict       # both locked for dict and subclasses

All comparison operations also compare values using *note __eq__(): cf2,
so for non-built-in types the lock may be released during comparison.

*note fromkeys(): 24e. locks both the new dictionary and the iterable
when the iterable is exactly a *note dict: 183, *note set: 184, or *note
frozenset: 7f2. (not subclasses):

     dict.fromkeys(a_dict)      # locks both
     dict.fromkeys(a_set)       # locks both
     dict.fromkeys(a_frozenset) # locks both

When updating from a non-dict iterable, only the target dictionary is
locked.  The iterable may be concurrently modified by another thread:

     d.update(iterable)        # iterable is not a dict: only d locked
     d |= iterable             # iterable is not a dict: only d locked
     dict.fromkeys(iterable)   # iterable is not a dict/set/frozenset: only result locked

Operations that involve multiple accesses, as well as iteration, are
never atomic:

     # NOT atomic: read-modify-write
     d[key] = d[key] + 1

     # NOT atomic: check-then-act (TOCTOU)
     if key in d:
           del d[key]

     # NOT thread-safe: iteration while modifying
     for key, value in d.items():
           process(key)  # another thread may modify d

To avoid time-of-check to time-of-use (TOCTOU) issues, use atomic
operations or handle exceptions:

     # Use pop() with default instead of check-then-delete
     d.pop(key, None)

     # Or handle the exception
     try:
           del d[key]
     except KeyError:
           pass

To safely iterate over a dictionary that may be modified by another
thread, iterate over a copy:

     # Make a copy to iterate safely
     for key, value in d.copy().items():
           process(key)

Consider external synchronization when sharing *note dict: 183.
instances across threads.  See *note Python support for free threading:
2619. for more information.

* Menu:

* 辞書ビューオブジェクト::


File: python.info,  Node: 辞書ビューオブジェクト,  Up: マッピング型 --- dict

5.4.12.1 辞書ビューオブジェクト
...............................

*note dict.keys(): 9d0, *note dict.values(): 9d1, *note dict.items():
9d2. によって返されるオブジェクトは、 'ビューオブジェクト' です。これら
は、辞書の項目の動的なビューを提供し、辞書が変更された時、ビューはその変
更を反映します。

辞書ビューは、イテレートすることで対応するデータを yield できます。また
、帰属判定をサポートします:

 -- Describe: len(dictview)

     辞書の項目数を返します。

 -- Describe: iter(dictview)

     辞書のキー、値、または (‘(key, value)’ のタプルとして表される) 項目
     に渡るイテレータを返します。

     キーと値は挿入順序で反復されます。 これにより、 ‘(value, key)’ の対
     の列を ‘pairs = zip(d.values(), d.keys())’ のように *note zip():
     1a0. で作成できます。 同じリストを作成する他の方法は、 ‘pairs =
     [(v, k) for (k, v) in d.items()]’ です。

     辞書の項目の追加や削除中にビューをイテレートすると、 *note
     RuntimeError: 244. を送出したり、すべての項目に渡ってイテレートでき
     なかったりします。

     バージョン 3.7 で変更: 辞書の順序が挿入順序であると保証されるように
     なりました。

 -- Describe: x in dictview

     'x' が元の辞書のキー、値、または項目 (項目の場合、 'x' は ‘(key,
     value)’ タプルです) にあるとき ‘True’ を返します。

 -- Describe: reversed(dictview)

     辞書のキーもしくは値、項目の順序を逆にしたイテレーターを返します。
     戻り値のビューは、挿入された順とは逆の順でイテレートします。

     バージョン 3.8 で変更: 辞書のビューがリバース可能になりました。

 -- Describe: dictview.mapping

     ビューの参照先の辞書をラップする *note types.MappingProxyType: 698.
     オブジェクト を返します。

     Added in version 3.10.

キーのビューは要素に重複がなくハッシュ可能 (*note hashable: 824.) である
ため、集合の特性を持ちます。項目のビューも、 キーと値の対に重複がなく、
かつキーがハッシュ可能であるため、集合的な演算を持っています。もし項目の
全ての値がハッシュ可能ならば、項目のビューは集合と相互に演算することが可
能です。 (値のビューは一般に要素に重複があるため、集合の特性を持つとはみ
なされません。) 集合の特性を持つビューに対しては、 *note
collections.abc.Set: 26a6. 抽象基底クラスで定義された全ての演算が利用可
能です (たとえば ‘==’, ‘<’ や ‘^’ など)。 集合演算に対しては、集合はオペ
ランドとして集合しか取ることができないのに対して、これら集合の特性を持つ
ビューはオペランドとして任意のイテラブルを取ることができます。

辞書ビューの使用法の例:

     >>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}
     >>> keys = dishes.keys()
     >>> values = dishes.values()

     >>> # iteration
     >>> n = 0
     >>> for val in values:
     ...     n += val
     ...
     >>> print(n)
     504

     >>> # keys and values are iterated over in the same order (insertion order)
     >>> list(keys)
     ['eggs', 'sausage', 'bacon', 'spam']
     >>> list(values)
     [2, 1, 1, 500]

     >>> # view objects are dynamic and reflect dict changes
     >>> del dishes['eggs']
     >>> del dishes['sausage']
     >>> list(keys)
     ['bacon', 'spam']

     >>> # set operations
     >>> keys & {'eggs', 'bacon', 'salad'}
     {'bacon'}
     >>> keys ^ {'sausage', 'juice'} == {'juice', 'sausage', 'bacon', 'spam'}
     True
     >>> keys | ['juice', 'juice', 'juice'] == {'bacon', 'spam', 'juice'}
     True

     >>> # get back a read-only proxy for the original dictionary
     >>> values.mapping
     mappingproxy({'bacon': 1, 'spam': 500})
     >>> values.mapping['spam']
     500


File: python.info,  Node: コンテキストマネージャ型,  Next: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン,  Prev: マッピング型 --- dict,  Up: 組み込み型

5.4.13 コンテキストマネージャ型
-------------------------------

Python の *note with: 186. 文は、コンテキストマネージャによって定義され
る実行時コンテキストの概念をサポートします。これは、文の本体が実行される
前に進入し文の終わりで脱出する実行時コンテキストを、ユーザ定義クラスが定
義できるようにする一対のメソッドで実装されます:

 -- メソッド: contextmanager.__enter__ ()

     実行時コンテキストに入り、このオブジェクトまたは他の実行時コンテキ
     ストに関連したオブジェクトを返します。このメソッドが返す値はこのコ
     ンテキストマネージャを使う *note with: 186. 文の ‘as’ 節の識別子に
     束縛されます。

     自分自身を返すコンテキストマネージャの例として *note
     ファイルオブジェクト: 13db. があります。ファイルオブジェクトは
     __enter__() から自分自身を返し、 *note open(): 316. が *note with:
     186. 文のコンテキスト式として使われるようにします。

     関連オブジェクトを返すコンテキストマネージャの例としては *note
     decimal.localcontext(): 159e. が返すものがあります。このマネージャ
     はアクティブな10進数コンテキストをオリジナルのコンテキストのコピー
     にセットしてそのコピーを返します。こうすることで, *note with: 186.
     文の本体の内部で、‘with’ 文の外側のコードに影響を与えずに、 10進数
     コンテキストを変更できます。

 -- メソッド: contextmanager.__exit__ (exc_type, exc_val, exc_tb)

     実行時コンテキストから抜け、(発生していた場合) 例外を抑制するかどう
     かを示すブール値フラグを返します。 *note with: 186. 文の本体の実行
     中に例外が発生した場合、引数にはその例外の型と値とトレースバック情
     報を渡します。そうでない場合、引数は全て ‘None’ となります。

     Returning a true value from this method will cause the *note with:
     186. statement to suppress the exception and continue execution
     with the statement immediately following the ‘with’ statement.
     Otherwise the exception continues propagating after this method has
     finished executing.

     If this method raises an exception while handling an earlier
     exception from the *note with: 186. block, the new exception is
     raised, and the original exception is stored in its *note
     __context__: 14df. attribute.

     渡された例外を明示的に再送出すべきではありません。その代わりに、こ
     のメソッドが偽の値を返すことでメソッドの正常終了と送出された例外を
     抑制しないことを伝えるべきです。このようにすればコンテキストマネー
     ジャは *note __exit__(): 1518. メソッド自体が失敗したのかどうかを簡
     単に見分けることができます。

Python は、易しいスレッド同期、ファイルなどのオブジェクトの即時クローズ
、アクティブな小数算術コンテキストの単純な操作をサポートするために、いく
つかのコンテキストマネージャを用意しています。各型はコンテキスト管理プロ
トコルを実装しているという以上の特別の取り扱いを受けるわけではありません
。例については *note contextlib: 27. モジュールを参照してください。

Python の *note ジェネレータ: 126c. と *note contextlib.contextmanager:
141b. *note デコレータ: 93a. はこのプロトコルの簡便な実装方法を提供しま
す。ジェネレータ関数を *note contextlib.contextmanager: 141b. デコレータ
でデコレートすると、デコレートされないジェネレータ関数が作成するイテレー
タの代わりに、必要な *note __enter__(): 26a8. および *note __exit__():
26a9. メソッドを実装したコンテキストマネージャを返すようになります。

これらのメソッドのために Python/C API の中の Python オブジェクトの型構造
体に特別なスロットが作られたわけではないことに注意してください。これらの
メソッドを定義したい拡張型はこれらを通常の Python からアクセスできるメソ
ッドとして提供しなければなりません。実行時コンテキストを準備するオーバー
ヘッドに比べたら、一回のクラス辞書の探索のオーバーヘッドは無視できます。


File: python.info,  Node: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン,  Next: その他の組み込み型,  Prev: コンテキストマネージャ型,  Up: 組み込み型

5.4.14 型アノテーション型 -- ジェネリックエイリアス 、 ユニオン
---------------------------------------------------------------

*note 型アノテーション: 15c. の中心となる組み込みの型は *note
ジェネリックエイリアス: 8c1. と *note ユニオン: 9c5. です。

* Menu:

* ジェネリックエイリアス型::
* Union 型::


File: python.info,  Node: ジェネリックエイリアス型,  Next: Union 型,  Up: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン

5.4.14.1 ジェネリックエイリアス型
.................................

‘GenericAlias’ オブジェクトは一般的に、クラスに *note 添字表記: 23ce. を
することで作られます。 *note list: 24d. や *note dict: 183. のような
*note コンテナ系のクラス: 23d4. に対して使われることがほとんどです。 例
えば、 ‘list[int]’ は ‘list’ クラスに *note int: 19b. という引数を与えた
添字表記をすることで作られる ‘GenericAlias’ オブジェクトです。
‘GenericAlias’ オブジェクトは主に *note 型アノテーション: 15c. の用途で
使われます。

     注釈: 一般に、クラスへの添字表記は、そのクラスが特殊メソッド *note
     __class_getitem__(): 943. を実装しているときに限り可能です。

‘GenericAlias’ オブジェクトは 'パラメータ付きジェネリック型' を実装した
ジェネリック型 (*note generic type: 1a1.) の代用として振る舞います。

コンテナクラスに対してクラスの *note 添字表記: 23ce. に与えられた単一ま
たは複数の引数は、そのオブジェクトが包含する要素の型をあらわします。たと
えば ‘set[bytes]’ という表記は、全ての要素が *note bytes: 192. であるよ
うな *note set: 184. をあらわす型アノテーションとして使うことができます
。

*note __class_getitem__(): 943. メソッドを定義しているけれどもコンテナで
ないクラスに対しては、クラスの添字表記に与えられた単一または複数の引数は
、しばしばオブジェクトに定義された単一または複数のメソッドの戻り値の型を
あらわします。たとえば、 *note 正規表現操作: be. は *note str: 169. と
*note bytes: 192. の両方のデータ型に対して使うことができます:

   * ‘x = re.search('foo', 'foo')’ とした場合、 ‘x’ は *note re.Match:
     118a. オブジェクトとなり、 ‘x.group(0)’ と ‘x[0]’ の戻り値はどちら
     も *note str: 169. となります。このようなオブジェクトは、
     ‘GenericAlias’ を使った型アノテーション ‘re.Match[str]’ で表現する
     ことができます。

   * ‘y = re.search(b'bar', b'bar')’ (ここで ‘b’ は *note bytes: 192. 型
     をあらわします) とした場合、‘y’ もまた ‘re.Match’ のインスタンスと
     なりますが、 ‘y.group(0)’ と ‘y[0]’ の戻り値はどちらも *note bytes:
     192. 型になります。型アノテーションでは、このような *note re.Match:
     118a. オブジェクトは ‘re.Match[bytes]’ と表現することになるでしょう
     。

‘GenericAlias’ オブジェクトは *note types.GenericAlias: 9ec. クラスのイ
ンスタンスです。このクラスは直接 ‘GenericAlias’ オブジェクトを生成するの
に使うこともできます。

 -- Describe: T[X, Y, ...]

     型 "X", "Y", またはさらに多くの引数でパラメータ化される型 ‘T’ を表
     現する ‘GenericAlias’ を生成します。引数の数は ‘T’ の使われ方によっ
     て決まります。たとえば、 *note float: 196. 型の要素を含む *note
     list: 24d. を引数にとる関数の型アノテーションは次のようになります:

          def average(values: list[float]) -> float:
              return sum(values) / len(values)

     もうひとつの例として *note mapping: 13d3. オブジェクトの場合を示し
     ます。ここではキーと値の2つの型をパラメータとするジェネリック型であ
     る *note dict: 183. を使っています。この例では、関数はキーが *note
     str: 169. 型、値が *note int: 19b. 型であるような ‘dict’ を引数にと
     ります:

          def send_post_request(url: str, body: dict[str, int]) -> None:
              ...

組み込み関数 *note isinstance(): 2ad. と *note issubclass(): 9c4. は第二
引数として ‘GenericAlias’ 型を指定することはできません:

     >>> isinstance([1, 2], list[str])
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: isinstance() argument 2 cannot be a parameterized generic

Python 実行時には *note 型アノテーション: 15c. は強制されません。この性
質はジェネリック型とその型パラメータにもおよびます。 ‘GenericAlias’ から
コンテナオブジェクトを生成した場合、コンテナ内の要素は型のチェックを受け
ません。たとえば、以下のコードは推奨されませんが、エラーになることなく実
行できます:

     >>> t = list[str]
     >>> t([1, 2, 3])
     [1, 2, 3]

しかも、パラメータ付きジェネリック型は、オブジェクト生成時にパラメータの
型情報を削除します:

     >>> t = list[str]
     >>> type(t)
     <class 'types.GenericAlias'>

     >>> l = t()
     >>> type(l)
     <class 'list'>

*note repr(): 1c1. や *note str(): 169. のジェネリック型に対する呼び出し
は、パラメータ型を表示します:

     >>> repr(list[int])
     'list[int]'

     >>> str(list[int])
     'list[int]'

ジェネリックコンテナ型の *note __getitem__(): 588. メソッドは、
‘dict[str][str]’ のようなミスを許さないように、例外を送出します:

     >>> dict[str][str]
     Traceback (most recent call last):
       ...
     TypeError: dict[str] is not a generic class

一方で、同様の式は *note 型変数: 23c9. が使われた場合は有効です。添字の
数は''GenericAlias'' オブジェクトの *note __args__: 26ac. 属性における型
変数の数と同じでなければなりません:

     >>> from typing import TypeVar
     >>> Y = TypeVar('Y')
     >>> dict[str, Y][int]
     dict[str, int]

* Menu:

* 標準ジェネリッククラス::
* GenericAlias オブジェクトの特別な属性::


File: python.info,  Node: 標準ジェネリッククラス,  Next: GenericAlias オブジェクトの特別な属性,  Up: ジェネリックエイリアス型

5.4.14.2 標準ジェネリッククラス
...............................

以下の標準ライブラリクラスは、パラメータ付きジェネリック型をサポートしま
す。このリストは完全に網羅されていない可能性があります。

   * *note tuple: 614.

   * *note list: 24d.

   * *note dict: 183.

   * *note set: 184.

   * *note frozenset: 7f2.

   * *note type: f44.

   * *note asyncio.Future: dc6.

   * *note asyncio.Task: 1c7.

   * *note collections.deque: 7f4.

   * *note collections.defaultdict: 13d4.

   * *note collections.OrderedDict: 7f3.

   * *note collections.Counter: 12a3.

   * *note collections.ChainMap: e16.

   * ’’*note collections.abc.Awaitable: fdc.

   * *note collections.abc.Coroutine: fdd.

   * *note collections.abc.AsyncIterable: fdf.

   * *note collections.abc.AsyncIterator: fde.

   * *note collections.abc.AsyncGenerator: e87.

   * *note collections.abc.Iterable: 26ae.

   * *note collections.abc.Iterator: 26af.

   * *note collections.abc.Generator: fdb.

   * *note collections.abc.Reversible: e85.

   * *note collections.abc.Container: 26b0.

   * *note collections.abc.Collection: e84.

   * *note collections.abc.Callable: 9eb.

   * *note collections.abc.Set: 26a6.

   * *note collections.abc.MutableSet: 26b1.

   * *note collections.abc.Mapping: ac7.

   * *note collections.abc.MutableMapping: 12c0.

   * *note collections.abc.Sequence: 13dc.

   * *note collections.abc.MutableSequence: 4bf.

   * *note collections.abc.ByteString: 342.

   * *note collections.abc.MappingView: 26b2.

   * *note collections.abc.KeysView: 26b3.

   * *note collections.abc.ItemsView: 26b4.

   * *note collections.abc.ValuesView: 26b5.

   * *note contextlib.AbstractContextManager: e8a.

   * *note contextlib.AbstractAsyncContextManager: d20.

   * *note dataclasses.Field: 195b.

   * *note functools.cached_property: 763.

   * *note functools.partialmethod: 218.

   * *note os.PathLike: e4b.

   * *note queue.LifoQueue: 26b6.

   * *note queue.Queue: 15ac.

   * *note queue.PriorityQueue: 26b7.

   * *note queue.SimpleQueue: d61.

   * *note re.Pattern: 1189.

   * *note re.Match: 118a.

   * *note shelve.BsdDbShelf: 26b8.

   * *note shelve.DbfilenameShelf: 26b9.

   * *note shelve.Shelf: 119d.

   * *note types.MappingProxyType: 698.

   * *note weakref.WeakKeyDictionary: 1929.

   * *note weakref.WeakMethod: 11f1.

   * *note weakref.WeakSet: 7f5.

   * *note weakref.WeakValueDictionary: 192a.


File: python.info,  Node: GenericAlias オブジェクトの特別な属性,  Prev: 標準ジェネリッククラス,  Up: ジェネリックエイリアス型

5.4.14.3 ‘GenericAlias’ オブジェクトの特別な属性
................................................

全てのパラメータ付きジェネリック型は、下記に示す読み出し専用の属性を実装
しています。

 -- の属性: genericalias.__origin__

     この属性は、対応するパラメータ付きでないジェネリッククラスを指しま
     す:

          >>> list[int].__origin__
          <class 'list'>

 -- の属性: genericalias.__args__

     この属性は、ジェネリッククラスの元の *note __class_getitem__():
     943. に渡された *note tuple: 614. です (長さが1の場合もあります):

          >>> dict[str, list[int]].__args__
          (<class 'str'>, list[int])

 -- の属性: genericalias.__parameters__

     この属性は、 ‘__args__’ にある固有の型変数のタプルで、必要に応じて
     遅延計算されます (空の可能性もあります):

          >>> from typing import TypeVar

          >>> T = TypeVar('T')
          >>> list[T].__parameters__
          (~T,)

          注釈: *note typing.ParamSpec: 487. パラメータを含む
          ‘GenericAlias’ オブジェクトは、代入後に正しい ‘__parameters__’
          を持たない可能性があります。これは *note typing.ParamSpec:
          487. が主に静的な型チェックを目的としているためです。

 -- の属性: genericalias.__unpacked__

     これは、型エイリアスが ‘*’ 演算子を使って取り出された場合に真となる
     真偽値です (*note TypeVarTuple: 488. を参照してください)。

     Added in version 3.11.

参考
....

PEP 484(1) - 型ヒント

     型アノテーションのための Python のフレームワークへの導入です。

PEP 585(2) - 標準コレクション型の型ヒントにおける総称型 (generics) の使用

     特殊なクラスメソッド *note __class_getitem__(): 943. を実装している
     場合に、標準ライブラリのクラスに対してネイティブにパラメータ表記を
     可能にする機能への導入です。

*note ジェネリクス: 23c9, *note ユーザー定義のジェネリック型: 6f6, および *note typing.Generic: 17b6.

     実行時にパラメータ設定が可能であり、かつ静的な型チェッカーが理解で
     きるジェネリッククラスを実装する方法のドキュメントです。

Added in version 3.9.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/

   (2) https://peps.python.org/pep-0585/


File: python.info,  Node: Union 型,  Prev: ジェネリックエイリアス型,  Up: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン

5.4.14.4 Union 型
.................

A union object holds the value of the ‘|’ (bitwise or) operation on
multiple *note type objects: 25e0.  These types are intended primarily
for *note type annotations: 15c.  The union type expression enables
cleaner type hinting syntax compared to subscripting *note typing.Union:
2a8.

 -- Describe: X | Y | ...

     'X' と 'Y' などの型を保持するUnionオブジェクトを定義すします。‘X |
     Y’ はXとYのいずれかを意味します。これは ‘typing.Union[X, Y]’ と等価
     です。たとえば、以下の関数は引数として *note int: 19b. 型または
     *note float: 196. 型を想定しています。:

          def square(number: int | float) -> int | float:
              return number ** 2

          注釈: ‘|’ のオペランドは、実行時に1つ以上の前方参照をメンバー
          として含むようなユニオンを定義するために使うことはできません。
          たとえば、 ‘"Foo"’ がまだ定義されていないクラスへの参照である
          場合、 ‘int | "Foo"’ は実行時に失敗します。前方参照を含むユニ
          オンは、 ‘"int | Foo"’ のように、ユニオン全体を文字列としてあ
          らわしてください。

 -- Describe: union_object == other

     Unionオブジェクトは他のUnionオブジェクトとの等価性をテストできます
     。以下は詳細です:

        * ユニオン型のユニオン型は平滑化されます:

               (int | str) | float == int | str | float

        * 余分な型は削除されます:

               int | str | int == int | str

        * ユニオン型を比較すると順序は無視されます:

               int | str == str | int

        * It creates instances of *note typing.Union: 2a8.:

               int | str == typing.Union[int, str]
               type(int | str) is typing.Union

        * Optional型は ‘None’ とのUnion型で記述できます:

               str | None == typing.Optional[str]

 -- Describe: isinstance(obj, union_object)

 -- Describe: issubclass(obj, union_object)

     *note isinstance(): 2ad. と *note issubclass(): 9c4. の呼び出しはど
     ちらもUnionオブジェクトをサポートしています。

          >>> isinstance("", int | str)
          True

     しかし、Unionオブジェクトの中の *note parameterized generics: 8c1.
     はチェックできません:

          >>> isinstance(1, int | list[int])  # short-circuit evaluation
          True
          >>> isinstance([1], int | list[int])
          Traceback (most recent call last):
            ...
          TypeError: isinstance() argument 2 cannot be a parameterized generic

The user-exposed type for the union object can be accessed from *note
typing.Union: 2a8. and used for *note isinstance(): 2ad. checks:

     >>> import typing
     >>> isinstance(int | str, typing.Union)
     True
     >>> typing.Union()
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: cannot create 'typing.Union' instances

     注釈: ‘X | Y’ 構文をサポートするために、型オブジェクトに ‘__or__()’
     メソッドが追加されました。メタクラスで ‘__or__()’ を実装すると
     Unionをオーバーライドする場合があります:

          >>> class M(type):
          ...     def __or__(self, other):
          ...         return "Hello"
          ...
          >>> class C(metaclass=M):
          ...     pass
          ...
          >>> C | int
          'Hello'
          >>> int | C
          int | C

参考
....

PEP 604(1) - ‘X | Y’ 構文とUnion型を提案しているPEP

Added in version 3.10.

バージョン 3.14 で変更: Union objects are now instances of *note
typing.Union: 2a8.  Previously, they were instances of *note
types.UnionType: 2a7, which remains an alias for *note typing.Union:
2a8.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0604/


File: python.info,  Node: その他の組み込み型,  Next: 特殊属性,  Prev: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン,  Up: 組み込み型

5.4.15 その他の組み込み型
-------------------------

インタプリタは、その他いくつかの種類のオブジェクトをサポートしています。
これらのほとんどは 1 つまたは 2 つの演算だけをサポートしています。

* Menu:

* モジュール: モジュール<4>.
* クラスおよびクラスインスタンス::
* 関数::
* メソッド::
* コードオブジェクト: コードオブジェクト<2>.
* 型オブジェクト::
* ヌルオブジェクト::
* Ellipsis オブジェクト::
* NotImplemented オブジェクト::
* 内部オブジェクト::


File: python.info,  Node: モジュール<4>,  Next: クラスおよびクラスインスタンス,  Up: その他の組み込み型

5.4.15.1 モジュール
...................

モジュールに対する唯一の特殊な演算は属性アクセス: ‘m.name’ です。ここで
'm' はモジュールで、 'name' は 'm' のシンボルテーブル上に定義された名前
にアクセスします。モジュール属性に代入することもできます。 (なお、*note
import: 7f8. 文は、厳密にいえば、モジュールオブジェクトに対する演算では
ありません; ‘import foo’ は 'foo' と名づけられたモジュールオブジェクトの
存在を必要とはせず、'foo' と名づけられたモジュールの (外部の) '定義' を
必要とします。)

全てのモジュールにある特殊属性が *note __dict__: 77d. です。これはモジュ
ールのシンボルテーブルを含む辞書です。この辞書を書き換えると実際にモジュ
ールのシンボルテーブルを変更することができますが、*note __dict__: 77d. 属
性を直接代入することはできません (‘m.__dict__['a'] = 1’ と書いて ‘m.a’ を
‘1’ に定義することはできますが、‘m.__dict__ = {}’ と書くことはできません
)。 *note __dict__: 77d. を直接書き換えることは推奨されません。

インタプリタ内に組み込まれたモジュールは、 ‘<module 'sys' (built-in)>’ の
ように書かれます。ファイルから読み出された場合、 ‘<module 'os' from
'/usr/local/lib/pythonX.Y/os.pyc'>’ と書かれます。


File: python.info,  Node: クラスおよびクラスインスタンス,  Next: 関数,  Prev: モジュール<4>,  Up: その他の組み込み型

5.4.15.2 クラスおよびクラスインスタンス
.......................................

これらについては *note オブジェクト、値、および型: 232c. および *note
クラス定義: 14ef. を参照してください。


File: python.info,  Node: 関数,  Next: メソッド,  Prev: クラスおよびクラスインスタンス,  Up: その他の組み込み型

5.4.15.3 関数
.............

関数オブジェクトは関数定義によって生成されます。関数オブジェクトに対する
唯一の操作は、それを呼び出すことです: ‘func(argument-list)’ 。

関数オブジェクトには実際には二種類あります: 組み込み関数とユーザ定義関数
です。どちらも同じ操作 (関数の呼び出し) をサポートしますが、実装は異なる
ので、オブジェクトの型も異なります。

詳細は、 *note 関数定義: 2018. を参照してください。


File: python.info,  Node: メソッド,  Next: コードオブジェクト<2>,  Prev: 関数,  Up: その他の組み込み型

5.4.15.4 メソッド
.................

Methods are functions that are called using the attribute notation.
There are two flavors: *note built-in methods: 235a. (such as *note
append(): 8dc. on lists) and *note class instance method: 20a7.
Built-in methods are described with the types that support them.

インスタンスを通してメソッド (クラスの名前空間内で定義された関数) にアク
セスすると、特殊なオブジェクトが得られます。それは束縛メソッド ('bound
method') オブジェクトで、インスタンスメソッド (*note instance method:
20a7.) とも呼ばれます。呼び出された時、引数リストに ‘self’ 引数が追加さ
れます。束縛メソッドには 2 つの特殊読み出し専用属性があります。 *note
m.__self__: 15e2. はそのメソッドが操作するオブジェクトで、*note
m.__func__: 1514. はそのメソッドを実装している関数です。 ‘m(arg-1,
arg-2, ..., arg-n)’ の呼び出しは、 ‘m.__func__(m.__self__, arg-1, arg-2,
..., arg-n)’ の呼び出しと完全に等価です。

*note function objects: 59c. と同様に、メソッドオブジェクトは任意の属性
の取得をサポートしています。しかし、メソッド属性は実際には下層の関数オブ
ジェクト (*note method.__func__: 1514.) に記憶されているので、バインドさ
れるメソッドにメソッド属性を設定することは許されていません。メソッドに属
性を設定しようとすると *note AttributeError: 5f0. が送出されます。メソッ
ドの属性を設定するためには、次のようにその下層の関数オブジェクトに明示的
に設定する必要があります:

     >>> class C:
     ...     def method(self):
     ...         pass
     ...
     >>> c = C()
     >>> c.method.whoami = 'my name is method'  # can't set on the method
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     AttributeError: 'method' object has no attribute 'whoami'
     >>> c.method.__func__.whoami = 'my name is method'
     >>> c.method.whoami
     'my name is method'

詳細は *note インスタンスメソッド: 20a7. を参照してください。


File: python.info,  Node: コードオブジェクト<2>,  Next: 型オブジェクト,  Prev: メソッド,  Up: その他の組み込み型

5.4.15.5 コードオブジェクト
...........................

コードオブジェクトは、関数本体のような "擬似コンパイルされた" Python の
実行可能コードを表すために実装系によって使われます。コードオブジェクトは
グローバルな実行環境への参照を持たない点で関数オブジェクトとは異なります
。コードオブジェクトは組み込み関数 *note compile(): 4b1. によって返され
、また関数オブジェクトの *note __code__: 59d. 属性として取り出せます。
*note code: 1b. モジュールも参照してください。

*note __code__: 59d. へのアクセスは ‘object.__getattr__’ に ‘obj’ と
‘"__code__"’ を渡して行いますが、 *note 監査イベント: 1c6e. を送出します
。

コードオブジェクトは、組み込み関数 *note exec(): 4a2. や *note eval():
4a3. に (ソース文字列の代わりに) 渡すことで、実行や評価できます。

詳細は、 *note 標準型の階層: 232f. を参照してください。


File: python.info,  Node: 型オブジェクト,  Next: ヌルオブジェクト,  Prev: コードオブジェクト<2>,  Up: その他の組み込み型

5.4.15.6 型オブジェクト
.......................

型オブジェクトは様々なオブジェクト型を表します。オブジェクトの型は組み込
み関数 *note type(): f44. でアクセスされます。型オブジェクトには特有の操
作はありません。標準モジュール *note types: 109. には全ての組み込み型名
が定義されています。

型はこのように書き表されます: ‘<class 'int'>’ 。


File: python.info,  Node: ヌルオブジェクト,  Next: Ellipsis オブジェクト,  Prev: 型オブジェクト,  Up: その他の組み込み型

5.4.15.7 ヌルオブジェクト
.........................

このオブジェクトは明示的に値を返さない関数によって返されます。このオブジ
ェクトには特有の操作はありません。ヌルオブジェクトは一つだけで、 ‘None’
(組み込み名) と名づけられています。 ‘type(None)()’ は同じシングルトンを
作成します。

‘None’ と書き表されます。


File: python.info,  Node: Ellipsis オブジェクト,  Next: NotImplemented オブジェクト,  Prev: ヌルオブジェクト,  Up: その他の組み込み型

5.4.15.8 Ellipsis オブジェクト
..............................

This object is commonly used to indicate that something is omitted.  It
supports no special operations.  There is exactly one ellipsis object,
named *note Ellipsis: 2328. (a built-in name).  ‘type(Ellipsis)()’
produces the *note Ellipsis: 2328. singleton.

‘Ellipsis’ または ‘...’ と書き表されます。

In typical use, ‘...’ as the ‘Ellipsis’ object appears in a few
different places, for instance:

   - In type annotations, such as *note callable arguments: 26cf. or
     *note tuple elements: 26d0.

   - As the body of a function instead of a *note pass statement: 1ffb.

   - In third-party libraries, such as Numpy's slicing and striding(1).

Python also uses three dots in ways that are not ‘Ellipsis’ objects, for
instance:

   - Doctest's *note ELLIPSIS: 1687, as a pattern for missing content.

   - The default Python prompt of the *note interactive: 1b5. shell when
     partial input is incomplete.

Lastly, the Python documentation often uses three dots in conventional
English usage to mean omitted content, even in code examples that also
use them as the ‘Ellipsis’.

   ---------- Footnotes ----------

   (1) 
https://numpy.org/doc/stable/user/basics.indexing.html#slicing-and-striding


File: python.info,  Node: NotImplemented オブジェクト,  Next: 内部オブジェクト,  Prev: Ellipsis オブジェクト,  Up: その他の組み込み型

5.4.15.9 NotImplemented オブジェクト
....................................

このオブジェクトは、対応していない型に対して比較演算や二項演算が求められ
たとき、それらの演算から返されます。詳細は *note 比較: 24d0. を参照して
ください。 *note NotImplemented: 1a2. オブジェクトは一つだけです。
‘type(NotImplemented)()’ はこの単一のインスタンスを作成します。

‘NotImplemented’ と書き表されます。


File: python.info,  Node: 内部オブジェクト,  Prev: NotImplemented オブジェクト,  Up: その他の組み込み型

5.4.15.10 内部オブジェクト
..........................

この情報は *note 標準型の階層: 232f. を参照してください。*note stack
frame objects: 8ef.、*note traceback objects: cec.、スライスオブジェクト
について記述されています。


File: python.info,  Node: 特殊属性,  Next: 整数と文字列の変換での長さ制限,  Prev: その他の組み込み型,  Up: 組み込み型

5.4.16 特殊属性
---------------

実装は、いくつかのオブジェクト型に対して、適切な場合には特殊な読み出し専
用の属性を追加します。そのうちいくつかは *note dir(): 844. 組込み関数で
報告されません。

 -- の属性: definition.__name__

     クラス、関数、メソッド、デスクリプタ、ジェネレータインスタンスの名
     前です。

 -- の属性: definition.__qualname__

     クラス、関数、メソッド、デスクリプタ、ジェネレータインスタンスの
     *note 修飾名: 1d24. です。

     Added in version 3.3.

 -- の属性: definition.__module__

     The name of the module in which a class or function was defined.

 -- の属性: definition.__doc__

     The documentation string of a class or function, or ‘None’ if
     undefined.

 -- の属性: definition.__type_params__

     The *note type parameters: 5ad. of generic classes, functions, and
     *note type aliases: 683.  For classes and functions that are not
     generic, this will be an empty tuple.

     Added in version 3.12.


File: python.info,  Node: 整数と文字列の変換での長さ制限,  Prev: 特殊属性,  Up: 組み込み型

5.4.17 整数と文字列の変換での長さ制限
-------------------------------------

CPythonはDoS(サービス妨害攻撃)を軽減するために *note int: 19b. と *note
str: 169. の間の変換に全体的な制限を設けました。この制限は10進数や2のべ
き乗以外の基数に 'のみ' 適用されます。16進数、8進数と2進数は制限がありま
せん。上限値は設定できます。

CPython の *note int: 19b. 型は、任意の長さの数をバイナリ形式で保存した
ものです (一般に "bignum" または多倍長整数として知られています)。基数が
2のべき乗でない限り、線形の時間で文字列をバイナリ整数に、あるいはバイナ
リ整数を文字列に変換できるアルゴリズムは存在しません。10進数に対するアル
ゴリズムでは、最もよく知られているものでさえ、2次に近い (sub-quadratic)
複雑さになります。高速な CPU でも、 ‘int('1' * 500_000)’ のような大きな
数の変換は1秒以上かかる可能性があります。

変換するサイズを制限することは、 CVE 2020-10735(1) を回避する実践的な方
法を提供します。

制限は、非線形な変換アルゴリズムが必要とされる場合に、入力または出力文字
列の桁数に対して適用されます。アンダースコアや正負の符号はカウントされま
せん。

演算の結果が制限を超えると、*note ValueError: 2ec. が送出されます:

     >>> import sys
     >>> sys.set_int_max_str_digits(4300)  # Illustrative, this is the default.
     >>> _ = int('2' * 5432)
     Traceback (most recent call last):
     ...
     ValueError: Exceeds the limit (4300 digits) for integer string conversion: value has 5432 digits; use sys.set_int_max_str_digits() to increase the limit
     >>> i = int('2' * 4300)
     >>> len(str(i))
     4300
     >>> i_squared = i*i
     >>> len(str(i_squared))
     Traceback (most recent call last):
     ...
     ValueError: Exceeds the limit (4300 digits) for integer string conversion; use sys.set_int_max_str_digits() to increase the limit
     >>> len(hex(i_squared))
     7144
     >>> assert int(hex(i_squared), base=16) == i*i  # Hexadecimal is unlimited.

デフォルトの上限値は4,300桁で、*note
sys.int_info.default_max_str_digits: 14ab. で定義されています。設定可能
な最小の上限値は 640 桁で、 *note
sys.int_info.str_digits_check_threshold: 14ab. で定義されています。

確認:

     >>> import sys
     >>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info
     >>> assert sys.int_info.str_digits_check_threshold == 640, sys.int_info
     >>> msg = int('578966293710682886880994035146873798396722250538762761564'
     ...           '9252925514383915483333812743580549779436104706260696366600'
     ...           '571186405732').to_bytes(53, 'big')
     ...

Added in version 3.11.

* Menu:

* 影響のあるAPI::
* 上限値を設定する::
* 推奨設定::

   ---------- Footnotes ----------

   (1) https://www.cve.org/CVERecord?id=CVE-2020-10735


File: python.info,  Node: 影響のあるAPI,  Next: 上限値を設定する,  Up: 整数と文字列の変換での長さ制限

5.4.17.1 影響のあるAPI
......................

制限は *note int: 19b. と *note str: 169. または *note bytes: 192. の間
での変換で時間がかかる可能性があると適用されます:

   * ‘int(string)’ でデフォルトの基数10。

   * ‘int(string, base)’ で2のべき乗以外のすべての基数。

   * ‘str(integer)’

   * ‘repr(integer)’

   * 他の10進数での文字列変換。たとえば ‘f"{integer}"’、
     ‘"{}".format(integer)’ や ‘b"%d" % integer’。

制限は、線形アルゴリズムの関数では適用されません。

   * ‘int(string, base)’ で基数が2、4、8、16または32。

   * *note int.from_bytes(): 1be9. と *note int.to_bytes(): 1c32. 。

   * *note hex(): 14e7, *note oct(): 14e6, *note bin(): 14c0.

   * *note 書式指定ミニ言語仕様: 4f9. での16進数、8進数、2進数での表現。

   * *note str: 169. から *note float: 196.。

   * *note str: 169. から *note decimal.Decimal: 1fe.。


File: python.info,  Node: 上限値を設定する,  Next: 推奨設定,  Prev: 影響のあるAPI,  Up: 整数と文字列の変換での長さ制限

5.4.17.2 上限値を設定する
.........................

Pythonを起動する前に環境変数またはインタープリタのコマンドラインのフラグ
で上限値を設定できます。

   * *note PYTHONINTMAXSTRDIGITS: 1b3a.、たとえば
     ‘PYTHONINTMAXSTRDIGITS=640 python3’ は上限値を640に設定し、
     ‘PYTHONINTMAXSTRDIGITS=0 python3’ は制限を無効化します。

   * *note -X int_max_str_digits: 16f.、たとえば ‘python3 -X
     int_max_str_digits=640’

   * *note sys.flags.int_max_str_digits: 26db. には *note
     PYTHONINTMAXSTRDIGITS: 1b3a. または *note -X int_max_str_digits:
     16f. の値が設定されます。環境変数と ‘-X’ オプションの両方が指定され
     た場合は ‘-X’ オプションが優先されます。 '-1' という値はどちらも未
     設定であることを表し、その場合は *note
     sys.int_info.default_max_str_digits: 26dc. の値が初期化時に使用され
     ます。

コードでは、以下の *note sys: df. APIを使用して現在の上限値を調べ、新し
い値を設定できます。

   * *note sys.get_int_max_str_digits(): 1818. と *note
     sys.set_int_max_str_digits(): 18f1. はインタープリタ全体での上限値
     を取得、設定できます。サブインタープリタはそれぞれの上限値を持ちま
     す。

デフォルト値と最小値に関する情報は *note sys.int_info: 14ab. で参照でき
ます:

   * *note sys.int_info.default_max_str_digits: 14ab. はコンパイル時のデ
     フォルト上限値です。

   * *note sys.int_info.str_digits_check_threshold: 14ab. は上限値として
     指定できる最低の値です(0の場合は無効になります)。

Added in version 3.11.

     注意: 小さな上限値を設定することで、問題が起きる '可能性があります'
     。まれではありますが、ソースコード内で閾値を超える定数が10進数の整
     数として存在するコードが存在します。値に制限をつけることの帰結は、
     10進数の整数リテラルで制限を超える長さを持つ定数を含むコードのパー
     ス時、すなわち通常は起動時、モジュールのインポート時、またはインス
     トール時など、そのコードのための ‘.pyc’ ファイルが作られるまでのど
     こかの時点でのエラーです。大きな定数を含むソースコードに対する回避
     策は、その定数を、 ‘0x’ を使って値の制限を持たない16進数の値に変換
     することです。

     小さな上限値を使う場合、アプリケーションを徹底的にテストしてくださ
     い。環境変数やフラグを使って、制限が起動時や、さらにはインストール
     の段階で Python が ‘.py’ ファイルを事前にコンパイルして ‘.pyc’ ファ
     イルを作成する際にも適用されるようにした状態で、確実にテストが実行
     されるようにしてください。


File: python.info,  Node: 推奨設定,  Prev: 上限値を設定する,  Up: 整数と文字列の変換での長さ制限

5.4.17.3 推奨設定
.................

デフォルトの *note sys.int_info.default_max_str_digits: 26dc. は、ほとん
どのアプリケーションで適切な値であると期待されます。もしあなたのアプリケ
ーションが異なる制限値を必要とする場合は、メインのエントリーポイントから
、 Python バージョンに依存しないコードを使って制限値を設定してください。
こうしなければならない理由は、これらの API が 3.12 以前のセキュリテイパ
ッチリリースで追加されたためです。

以下はプログラム例です:

     >>> import sys
     >>> if hasattr(sys, "set_int_max_str_digits"):
     ...     upper_bound = 68000
     ...     lower_bound = 4004
     ...     current_limit = sys.get_int_max_str_digits()
     ...     if current_limit == 0 or current_limit > upper_bound:
     ...         sys.set_int_max_str_digits(upper_bound)
     ...     elif current_limit < lower_bound:
     ...         sys.set_int_max_str_digits(lower_bound)

完全に無効にするには、‘0’ に設定します。

脚注
....


File: python.info,  Node: 組み込み例外,  Next: テキスト処理サービス,  Prev: 組み込み型,  Up: Python 標準ライブラリ

5.5 組み込み例外
================

Python において、すべての例外は *note BaseException: 7d6. から派生したク
ラスのインスタンスでなければなりません。特定のクラスを言及する *note
except: 1ab. 節を伴う *note try: 8f8. 文において、その節はそのクラスから
派生した例外クラスも処理しますが、そのクラスの派生 '元' の例外クラスは処
理しません。サブクラス化の関係にない 2 つの例外クラスは、それらが同じ名
前だった場合でも等しくなりえません。

この章で挙げる組み込み例外は、インタプリタや組み込み関数によって生成され
ます。特に注記しないかぎり、これらはエラーの詳しい原因を示す "関連値
(associated value)" を持ちます。この値は、複数の情報 (エラーコードや、そ
のコードを説明する文字列など) の文字列かタプルです。関連値は通常、例外ク
ラスのコンストラクタに引数として渡されます。

ユーザによるコードも組み込み例外を送出できます。これを使って、例外ハンド
ラをテストしたり、インタプリタが同じ例外を送出する状況と "ちょうど同じよ
うな" エラー条件であることを報告したりできます。しかし、ユーザのコードが
適切でないエラーを送出するのを妨げる方法はないので注意してください。

組み込み例外クラスは新たな例外を定義するためにサブクラス化することができ
ます。新しい例外は、*note Exception: bcd. クラスかそのサブクラスの一つか
ら派生することをお勧めします。 *note BaseException: 7d6. からは派生しな
いで下さい。例外を定義する上での詳しい情報は、 Python チュートリアルの
*note ユーザー定義例外: 207c. の項目にあります。

* Menu:

* 例外コンテキスト::
* 組み込み例外から継承する::
* 基底クラス::
* 具象例外::
* 警告::
* 例外グループ::
* 例外のクラス階層::


File: python.info,  Node: 例外コンテキスト,  Next: 組み込み例外から継承する,  Up: 組み込み例外

5.5.1 例外コンテキスト
----------------------

例外オブジェクトの3つの属性は、例外が送出された常用に関する情報を提供し
ます:

 -- の属性: BaseException.__context__
 -- の属性: BaseException.__cause__
 -- の属性: BaseException.__suppress_context__

     When raising a new exception while another exception is already
     being handled, the new exception's ‘__context__’ attribute is
     automatically set to the handled exception.  An exception may be
     handled when an *note except: 1ab. or *note finally: 1b0. clause,
     or a *note with: 186. statement, is used.

     This implicit exception context can be supplemented with an
     explicit cause by using ‘from’ with *note raise: 803.:

          raise new_exc from original_exc

     *note from: 803. に続く式は例外か ‘None’ でなくてはなりません。 式
     は送出される例外の ‘__cause__’ として設定されます。 ‘__cause__’ を
     設定することは、 ‘__suppress_context__’ 属性を暗黙的に ‘True’ に設
     定することにもなるので、 ‘raise new_exc from None’ を使うことで効率
     的に古い例外を新しいもので置き換えて表示する (例えば、 *note
     KeyError: 5e7. を *note AttributeError: 5f0. に置き換え)、古い例外
     はデバッグ時の調査で使えるよう ‘__context__’ に残すことができます。

     デフォルトの traceback 表示コードは、例外自体の traceback に加え、
     これらの連鎖された例外を表示します。‘__cause__’ で明示的に連鎖させ
     た例外は、存在するならば常に表示されます。‘__context__’ で暗黙に連
     鎖させた例外は、‘__cause__’ が *note None: 885. かつ
     ‘__suppress_context__’ が false の場合にのみ表示されます。

     いずれにせよ、連鎖された例外に続いて、その例外自体は常に表示されま
     す。そのため、traceback の最終行には、常に送出された最後の例外が表
     示されます。


File: python.info,  Node: 組み込み例外から継承する,  Next: 基底クラス,  Prev: 例外コンテキスト,  Up: 組み込み例外

5.5.2 組み込み例外から継承する
------------------------------

User code can create subclasses that inherit from an exception type.
It's recommended to only subclass one exception type at a time to avoid
any possible conflicts between how the bases handle the ‘args’
attribute, as well as due to possible memory layout incompatibilities.

'CPython 実装の詳細:' Most built-in exceptions are implemented in C for
efficiency, see: Objects/exceptions.c(1).  Some have custom memory
layouts which makes it impossible to create a subclass that inherits
from multiple exception types.  The memory layout of a type is an
implementation detail and might change between Python versions, leading
to new conflicts in the future.  Therefore, it's recommended to avoid
subclassing multiple exception types altogether.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Objects/exceptions.c


File: python.info,  Node: 基底クラス,  Next: 具象例外,  Prev: 組み込み例外から継承する,  Up: 組み込み例外

5.5.3 基底クラス
----------------

以下の例外は、主に他の例外の基底クラスとして使われます。

 -- 例外: BaseException

     全ての組み込み例外の基底クラスです。ユーザ定義の例外に直接継承され
     ることは意図されていません (継承には *note Exception: bcd. を使って
     ください)。このクラスのインスタンスに *note str(): 169. が呼ばれた
     場合、インスタンスへの引数の表現か、引数が無い場合には空文字列が返
     されます。

      -- の属性: args

          例外コンストラクタに与えられた引数のタプルです。組み込み例外は
          普通、エラーメッセージを与える一つの文字列だけを引数として呼ば
          れますが、中には (*note OSError: 2c0. など) いくつかの引数を必
          要とし、このタプルの要素に特別な意味を込めるものもあります。

      -- メソッド: with_traceback (tb)

          This method sets 'tb' as the new traceback for the exception
          and returns the exception object.  It was more commonly used
          before the exception chaining features of PEP 3134(1) became
          available.  The following example shows how we can convert an
          instance of ‘SomeException’ into an instance of
          ‘OtherException’ while preserving the traceback.  Once raised,
          the current frame is pushed onto the traceback of the
          ‘OtherException’, as would have happened to the traceback of
          the original ‘SomeException’ had we allowed it to propagate to
          the caller.

               try:
                   ...
               except SomeException:
                   tb = sys.exception().__traceback__
                   raise OtherException(...).with_traceback(tb)

      -- の属性: __traceback__

          A writable field that holds the *note traceback object: cec.
          associated with this exception.  See also: *note raise 文:
          803.

      -- メソッド: add_note (note)

          例外のノートとして文字列 ‘note’ を追加します。ノートは標準のト
          レースバックで例外文字列の後に表示されます。‘note’ が文字列以
          外の場合 *note TypeError: 198. が送出されます。

          Added in version 3.11.

      -- の属性: __notes__

          *note add_note(): 7d7. で追加された例外のノートのリスト。この
          属性は *note add_note(): 7d7. を呼び出すと生成されます。

          Added in version 3.11.

 -- 例外: Exception

     システム終了以外の全ての組み込み例外はこのクラスから派生しています
     。全てのユーザ定義例外もこのクラスから派生させるべきです。

 -- 例外: ArithmeticError

     算術上の様々なエラーに対して送出される組み込み例外 *note
     OverflowError: a81, *note ZeroDivisionError: b3f, *note
     FloatingPointError: 26e6. の基底クラスです。

 -- 例外: BufferError

     *note バッファ: 260. に関連する操作が行えなかったときに送出されます
     。

 -- 例外: LookupError

     マッピングまたはシーケンスで使われたキーやインデクスが無効な場合に
     送出される例外 *note IndexError: 174e. および *note KeyError: 5e7.
     の基底クラスです。 *note codecs.lookup(): b5c. によって直接送出され
     ることもあります。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3134/


File: python.info,  Node: 具象例外,  Next: 警告,  Prev: 基底クラス,  Up: 組み込み例外

5.5.4 具象例外
--------------

以下の例外は、通常送出される例外です。

 -- 例外: AssertionError

     *note assert: b60. 文が失敗した場合に送出されます。

 -- 例外: AttributeError

     属性参照 (*note 属性参照: 24a9. を参照) や代入が失敗した場合に送出
     されます (オブジェクトが属性の参照や属性の代入をまったくサポートし
     ていない場合には *note TypeError: 198. が送出されます)。

     The optional 'name' and 'obj' keyword-only arguments set the
     corresponding attributes:

      -- の属性: name

          The name of the attribute that was attempted to be accessed.

      -- の属性: obj

          The object that was accessed for the named attribute.

     バージョン 3.10 で変更: *note name: 26e8. および *note obj: 26e9. 属
     性が追加されました。

 -- 例外: EOFError

     Raised when the *note input(): 14f0. function hits an end-of-file
     condition (EOF) without reading any data.  (Note: the
     ‘io.IOBase.read()’ and *note io.IOBase.readline(): 1541. methods
     return an empty string when they hit EOF.)

 -- 例外: FloatingPointError

     現在は使われていません。

 -- 例外: GeneratorExit

     *note ジェネレータ: 126c. や *note コルーチン: 6b9. が閉じられたと
     きに送出されます。 *note generator.close(): 1793. と *note
     coroutine.close(): 241a. を参照してください。この例外は厳密に言えば
     エラーではないので、 *note Exception: bcd. ではなく *note
     BaseException: 7d6. を直接継承しています。

 -- 例外: ImportError

     *note import: 7f8. 文でモジュールをロードしようとして問題が発生する
     と送出されます。 ‘from ... import’ の中の"from list" (訳注：‘...’ の
     部分)の名前が見つからないときにも送出されます。

     オブションのキーワード専用引数 'name' と 'path' は、対応する属性に
     設定されます:

      -- の属性: name

          インポートを試みたモジュールの名前。

      -- の属性: path

          例外を引き起こしたファイルのパス。

     バージョン 3.3 で変更: *note name: 26ea. および *note path: 26eb. 属
     性が追加されました。

 -- 例外: ModuleNotFoundError

     *note ImportError: 65b. のサブクラスで、*note import: 7f8. 文でモジ
     ュールが見つからない場合に送出されます。また、 *note sys.modules:
     17e6. に ‘None’ が含まれる場合にも送出されます。

     Added in version 3.6.

 -- 例外: IndexError

     シーケンスの添字が範囲外の場合に送出されます。 (スライスのインデク
     スはシーケンスの範囲に収まるように暗黙のうちに調整されます; インデ
     クスが整数でない場合、 *note TypeError: 198. が送出されます。)

 -- 例外: KeyError

     マッピング (辞書) のキーが、既存のキーの集合内に見つからなかった場
     合に送出されます。

 -- 例外: KeyboardInterrupt

     ユーザが割り込みキー (通常は ‘Control’-‘C’ または ‘Delete’) を押し
     た場合に送出されます。実行中、割り込みは定期的に監視されます。*note
     Exception: bcd. を捕捉するコードに誤って捕捉されてインタプリタの終
     了が阻害されないように、この例外は *note BaseException: 7d6. を継承
     しています。

          注釈: Catching a *note KeyboardInterrupt: bc5. requires
          special consideration.  Because it can be raised at
          unpredictable points, it may, in some circumstances, leave the
          running program in an inconsistent state.  It is generally
          best to allow *note KeyboardInterrupt: bc5. to end the program
          as quickly as possible or avoid raising it entirely.  (See
          *note Note on Signal Handlers and Exceptions: 26ec.)

 -- 例外: MemoryError

     ある操作中にメモリが不足したが、その状況は (オブジェクトをいくつか
     消去することで) まだ復旧可能かもしれない場合に送出されます。この例
     外の関連値は、メモリ不足になった (内部) 操作の種類を示す文字列です
     。下層のメモリ管理アーキテクチャ (C の ‘malloc()’ 関数) のために、
     インタプリタが現状から完璧に復旧できるとはかぎらないので注意してく
     ださい。それでも、プログラムの暴走が原因の場合に備えて実行スタック
     のトレースバックを出力できるように、例外が送出されます。

 -- 例外: NameError

     ローカルまたはグローバルの名前が見つからなかった場合に送出されます
     。これは非修飾の (訳注: ‘spam.egg’ ではなく単に ‘egg’ のような) 名
     前のみに適用されます。関連値は見つからなかった名前を含むエラーメッ
     セージです。

     The optional 'name' keyword-only argument sets the attribute:

      -- の属性: name

          The name of the variable that was attempted to be accessed.

     バージョン 3.10 で変更: *note name: 26ed. 属性が追加されました。

 -- 例外: NotImplementedError

     この例外は *note RuntimeError: 244. から派生しています。ユーザ定義
     の基底クラスにおいて、抽象メソッドが派生クラスでオーバライドされる
     ことを要求する場合にこの例外を送出しなくてはなりません。またはクラ
     スは実装中であり本来の実装を追加する必要があることを示します。

          注釈: 演算子やメソッドがサポートされていないことを示す目的でこ
          の例外を使用するべきではありません。そのようなケースではオペレ
          ータやメソッドを未定義のままとするか、サブクラスの場合は *note
          None: 885. を設定してください。

          注意: ‘NotImplementedError’ and ‘NotImplemented’ are not
          interchangeable.  This exception should only be used as
          described above; see *note NotImplemented: 1a2. for details on
          correct usage of the built-in constant.

 -- 例外: OSError ([arg])

 -- 例外: OSError (errno, strerror[, filename[, winerror[, filename2]]])

     この例外はシステム関数がシステム関連のエラーを返した場合に送出され
     ます。例えば "file not found" や "disk full" のような I/O の失敗が
     発生したときです (引数の型が不正な場合や、他の偶発的なエラーは除き
     ます)。

     コンストラクタの2番目の形式は下記の対応する属性を設定します。指定さ
     れなかった場合属性はデフォルトで *note None: 885. です。後方互換性
     のために、引数が3つ渡された場合、*note args: 78d. 属性は最初の2つの
     要素のみからなるタプルを持ちます。

     コンストラクタは実際には、 *note OS exceptions: 26ee. で述べられて
     いる *note OSError: 2c0. のサブクラスを返すことがよくあります。特定
     のサブクラスは最終的な *note errno: 17b3. 値によります。この挙動は
     *note OSError: 2c0. を直接またはエイリアスで構築し、サブクラス化時
     に継承されなかった場合にのみ発生します。

      -- の属性: errno

          C 変数 ‘errno’ に由来する数値エラーコードです。

      -- の属性: winerror

          Windows において、ネイティブ Windows エラーコードを与えます。
          そして *note errno: 17b3. 属性は POSIX でいうネイティブエラー
          コードへのおよその翻訳です。

          Windows では、'winerror' コンストラクタ引数が整数の場合 *note
          errno: 17b3. 属性は Windows エラーコードから決定され、'errno'
          引数は無視されます。他のプラットフォームでは 'winerror' 引数は
          無視され、 *note winerror: 26ef. 属性は存在しません。

      -- の属性: strerror

          The corresponding error message, as provided by the operating
          system.  It is formatted by the C functions ‘perror()’ under
          POSIX, and ‘FormatMessage()’ under Windows.

      -- の属性: filename
      -- の属性: filename2

          ファイルシステムパスが1つ関与する例外 (例えば *note open():
          316. や *note os.unlink(): 130d.) の場合、*note filename:
          26f1. は関数に渡されたファイル名です。 ファイルシステムパスが
          2つ関与する関数 (例えば *note os.rename(): 1309.) の場合、
          *note filename2: 26f2. は関数に渡された2つ目のファイル名です。

     バージョン 3.3 で変更: *note EnvironmentError: 125f, *note IOError:
     125e, *note WindowsError: 1260, *note socket.error: 1261, *note
     select.error: 1262. and ‘mmap.error’ have been merged into *note
     OSError: 2c0, and the constructor may return a subclass.

     バージョン 3.4 で変更: *note filename: 26f1. 属性が *note
     filesystem encoding and error handler: 75d. のエンコーディングでエ
     ンコードやデコードされた名前から、関数に渡された元々のファイル名に
     なりました。 また、'filename2' コンストラクタ引数が追加されました。

 -- 例外: OverflowError

     算術演算の結果が表現できない大きな値になった場合に送出されます。こ
     れは整数では起こりません (むしろ *note MemoryError: 179e. が送出さ
     れることになるでしょう)。しかし、歴史的な理由のため、要求された範囲
     の外の整数に対して OverflowError が送出されることがあります。C の浮
     動小数点演算の例外処理は標準化されていないので、ほとんどの浮動小数
     点演算もチェックされません。

 -- 例外: PythonFinalizationError

     This exception is derived from *note RuntimeError: 244.  It is
     raised when an operation is blocked during interpreter shutdown
     also known as *note Python finalization: 479.

     Examples of operations which can be blocked with a *note
     PythonFinalizationError: 47a. during the Python finalization:

        * Creating a new Python thread.

        * *note Joining: 13fd. a running daemon thread.

        * *note os.fork(): 4b5.

     *note sys.is_finalizing(): c80. 関数も参照してください。

     Added in version 3.13: 以前は *note RuntimeError: 244. をそのまま送
     出していました。

     バージョン 3.14 で変更: *note threading.Thread.join(): 13fd. can
     now raise this exception.

 -- 例外: RecursionError

     この例外は *note RuntimeError: 244. を継承しています。インタープリ
     タが最大再帰深度 (*note sys.getrecursionlimit(): 6eb. を参照) の超
     過を検出すると送出されます。

     Added in version 3.5: 以前は *note RuntimeError: 244. をそのまま送
     出していました。

 -- 例外: ReferenceError

     *note weakref.proxy(): c46. によって生成された弱参照 (weak
     reference) プロキシを使って、ガーベジコレクションによって回収された
     後の参照対象オブジェクトの属性にアクセスした場合に送出されます。弱
     参照については *note weakref: 11a. モジュールを参照してください。

 -- 例外: RuntimeError

     他のカテゴリに分類できないエラーが検出された場合に送出されます。関
     連値は、何が問題だったのかをより詳細に示す文字列です。

 -- 例外: StopIteration

     組込み関数 *note next(): 9d8. と *note iterator: 4c8. の *note
     __next__(): 14e5. メソッドによって、そのイテレータが生成するアイテ
     ムがこれ以上ないことを伝えるために送出されます。

      -- の属性: value

          この例外オブジェクトには一つの属性 ‘value’ があり、例外を構成
          する際に引数として与えられ、デフォルトは *note None: 885. です
          。

     *note generator: 126c. や *note coroutine: 6b9. 関数が返るとき、新
     しい *note StopIteration: df5. インスタンスが送出されます。 関数の
     返り値は例外のコンストラクタの *note value: 2417. 引数として使われ
     ます。

     ジェネレータのコードが直接的あるいは間接的に *note StopIteration:
     df5. を送出する場合は、 *note RuntimeError: 244. に変換されます
     (*note StopIteration: df5. は変換後の例外の原因として保持されます
     )。

     バージョン 3.3 で変更: ‘value’ 属性とジェネレータ関数が値を返すため
     にそれを使う機能が追加されました。

     バージョン 3.5 で変更: ‘from __future__ import generator_stop’ によ
     る RuntimeError への変換が導入されました。 PEP 479(1) を参照してく
     ださい。

     バージョン 3.7 で変更: PEP 479(2) が全てのコードでデフォルトで有効
     化されました: ジェネレータから送出された *note StopIteration: df5.
     は *note RuntimeError: 244. に変換されます。

 -- 例外: StopAsyncIteration

     イテレーションを停止するために、 *note asynchronous iterator: 4c7.
     オブジェクトの *note __anext__(): 1882. メソッドによって返される必
     要があります。

     Added in version 3.5.

 -- 例外: SyntaxError (message, details)

     パーザが構文エラーに遭遇した場合に送出されます。この例外は *note
     import: 7f8. 文、組み込み関数 *note compile(): 4b1.、*note exec():
     4a2. や *note eval(): 4a3. 、初期化スクリプトの読み込みや標準入力で
     (対話的な実行時にも) 起こる可能性があります。

     例外インスタンスの *note str(): 169. はエラーメッセージのみを返しま
     す。詳細はタプルで、個々の属性としても利用できます。

      -- の属性: filename

          構文エラーが発生したファイルの名前。

      -- の属性: lineno

          ファイルのエラーが発生した行番号。1から数えはじめるため、ファ
          イルの最初の行の ‘lineno’ は1です。

      -- の属性: offset

          行のエラーが発生した列番号。1から数えはじめるため、行の最初の
          文字の ‘offset’ は1です。

      -- の属性: text

          エラーを含むソースコードのテキスト。

      -- の属性: end_lineno

          ファイルのエラーが発生した最後の行番号。1から数えはじめるため
          、ファイルの最初の行の ‘lineno’ は1です。

      -- の属性: end_offset

          行のエラーが発生した最後の列番号。1から数えはじめるため、行の
          最初の文字の ‘offset’ は1です。

     For errors in f-string fields, the message is prefixed by
     "f-string: " and the offsets are offsets in a text constructed from
     the replacement expression.  For example, compiling f'Bad {a b}
     field' results in this args attribute: ('f-string: ...', ('', 1, 2,
     '(a b)n', 1, 5)).

     バージョン 3.10 で変更: *note end_lineno: 26f7. および *note
     end_offset: 26f8. 属性が追加されました。

 -- 例外: IndentationError

     正しくないインデントに関する構文エラーの基底クラスです。これは
     *note SyntaxError: 18e. のサブクラスです。

 -- 例外: TabError

     タブとスペースを一貫しない方法でインデントに使っているときに送出さ
     れます。これは *note IndentationError: 1750. のサブクラスです。

 -- 例外: SystemError

     Raised when the interpreter finds an internal error, but the
     situation does not look so serious to cause it to abandon all hope.
     The associated value is a string indicating what went wrong (in
     low-level terms).  In *note CPython: 905, this could be raised by
     incorrectly using Python's C API, such as returning a ‘NULL’ value
     without an exception set.

     If you're confident that this exception wasn't your fault, or the
     fault of a package you're using, you should report this to the
     author or maintainer of your Python interpreter.  Be sure to report
     the version of the Python interpreter (‘sys.version’; it is also
     printed at the start of an interactive Python session), the exact
     error message (the exception's associated value) and if possible
     the source of the program that triggered the error.

 -- 例外: SystemExit

     This exception is raised by the *note sys.exit(): 277. function.
     It inherits from *note BaseException: 7d6. instead of *note
     Exception: bcd. so that it is not accidentally caught by code that
     catches *note Exception: bcd.  This allows the exception to
     properly propagate up and cause the interpreter to exit.  When it
     is not handled, the Python interpreter exits; no stack traceback is
     printed.  The constructor accepts the same optional argument passed
     to *note sys.exit(): 277.  If the value is an integer, it specifies
     the system exit status (passed to C's ‘exit()’ function); if it is
     ‘None’, the exit status is zero; if it has another type (such as a
     string), the object's value is printed and the exit status is one.

     *note sys.exit(): 277. は、クリーンアップのための処理 (*note try:
     8f8. 文の *note finally: 1b0. 節) が実行されるようにするため、また
     デバッガが制御不能になるリスクを冒さずにスクリプトを実行できるよう
     にするために例外に変換されます。即座に終了することが真に強く必要で
     あるとき (例えば、*note os.fork(): 4b5. を呼んだ後の子プロセス内) に
     は *note os._exit(): 26f9. 関数を使うことができます。

      -- の属性: code

          コンストラクタに渡された終了ステータス又はエラーメッセージ。
          (デフォルトは ‘None’)

 -- 例外: TypeError

     組み込み演算または関数が適切でない型のオブジェクトに対して適用され
     た際に送出されます。関連値は型の不整合に関して詳細を述べた文字列で
     す。

     この例外は、そのオブジェクトで実行しようとした操作がサポートされて
     おらず、その予定もない場合にユーザーコードから送出されるかもしれま
     せん。オブジェクトでその操作をサポートするつもりだが、まだ実装を提
     供していないのであれば、送出する適切な例外は *note
     NotImplementedError: 36b. です。

     誤った型の引数が渡された場合は (例えば、*note int: 19b. が期待され
     るのに、*note list: 24d. が渡された) *note TypeError: 198. となるべ
     きです。しかし、誤った値(例えば、期待する範囲外の数)が引数として渡
     された場合は、 *note ValueError: 2ec. となるべきです。

 -- 例外: UnboundLocalError

     関数やメソッド内のローカルな変数に対して参照を行ったが、その変数に
     は値が代入されていなかった場合に送出されます。 *note NameError:
     452. のサブクラスです。

 -- 例外: UnicodeError

     Unicode に関するエンコードまたはデコードのエラーが発生した際に送出
     されます。 *note ValueError: 2ec. のサブクラスです。

     *note UnicodeError: 462. はエンコードまたはデコードのエラーの説明を
     属性として持っています。例えば、 ‘err.object[err.start:err.end]’ は
     、無効な入力のうちコーデックが処理に失敗した箇所を表します。

      -- の属性: encoding

          エラーを送出したエンコーディングの名前です。

      -- の属性: reason

          そのコーデックエラーを説明する文字列です。

      -- の属性: object

          コーデックがエンコードまたはデコードしようとしたオブジェクトで
          す。

      -- の属性: start

          *note object: c7e. の最初の無効なデータのインデクスです。

          This value should not be negative as it is interpreted as an
          absolute offset but this constraint is not enforced at
          runtime.

      -- の属性: end

          *note object: c7e. の最後の無効なデータの次のインデクスです。

          This value should not be negative as it is interpreted as an
          absolute offset but this constraint is not enforced at
          runtime.

 -- 例外: UnicodeEncodeError

     Unicode 関連のエラーがエンコード中に発生した際に送出されます。
     *note UnicodeError: 462. のサブクラスです。

 -- 例外: UnicodeDecodeError

     Unicode 関連のエラーがデコード中に発生した際に送出されます。 *note
     UnicodeError: 462. のサブクラスです。

 -- 例外: UnicodeTranslateError

     Unicode 関連のエラーが変換中に発生した際に送出されます。 *note
     UnicodeError: 462. のサブクラスです。

 -- 例外: ValueError

     演算子や関数が、正しい型だが適切でない値を持つ引数を受け取ったとき
     や、 *note IndexError: 174e. のようなより詳細な例外では記述できない
     状況で送出されます。

 -- 例外: ZeroDivisionError

     除算や剰余演算の第二引数が 0 であった場合に送出されます。関連値は文
     字列で、その演算における被演算子と演算子の型を示します。

以下の例外は、過去のバージョンとの後方互換性のために残されています;
Python 3.3 より、これらは *note OSError: 2c0. のエイリアスです。

 -- 例外: EnvironmentError

 -- 例外: IOError

 -- 例外: WindowsError

     Windows でのみ利用できます。

* Menu:

* OS 例外::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0479/

   (2) https://peps.python.org/pep-0479/


File: python.info,  Node: OS 例外,  Up: 具象例外

5.5.4.1 OS 例外
...............

以下の例外は *note OSError: 2c0. のサブクラスで、システムエラーコードに
依存して送出されます。

 -- 例外: BlockingIOError

     ある操作が、ノンブロッキング操作に設定されたオブジェクト (例えばソ
     ケット) をブロックしそうになった場合に送出されます。‘errno’ *note
     EAGAIN: 26fd, *note EALREADY: 26fe, *note EWOULDBLOCK: 26ff. および
     *note EINPROGRESS: 2700. に対応します。

     *note BlockingIOError: 235. は、 *note OSError: 2c0. の属性に加えて
     一つの属性を持ちます:

      -- の属性: characters_written

          An integer containing the number of 'bytes' written to the
          stream before it blocked.  This attribute is available when
          using the buffered I/O classes from the *note io: 83. module.

 -- 例外: ChildProcessError

     子プロセスの操作が失敗した場合に送出されます。‘errno’ *note ECHILD:
     2702. に対応します。

 -- 例外: ConnectionError

     コネクション関係の問題の基底クラス。

     サブクラスは *note BrokenPipeError: 1267, *note
     ConnectionAbortedError: 1268, *note ConnectionRefusedError: 1269,
     *note ConnectionResetError: 126a. です。

 -- 例外: BrokenPipeError

     *note ConnectionError: 100b. のサブクラスで、もう一方の端が閉じられ
     たパイプに書き込こもうとするか、書き込みのためにシャットダウンされ
     たソケットに書き込こもうとした場合に発生します。 ‘errno’ *note
     EPIPE: 2703. と *note ESHUTDOWN: 2704. に対応します。

 -- 例外: ConnectionAbortedError

     *note ConnectionError: 100b. のサブクラスで、接続の試行が通信相手に
     よって中断された場合に発生します。 ‘errno’ *note ECONNABORTED:
     2705. に対応します。

 -- 例外: ConnectionRefusedError

     *note ConnectionError: 100b. のサブクラスで、接続の試行が通信相手に
     よって拒否された場合に発生します。 ‘errno’ *note ECONNREFUSED:
     2706. に対応します。

 -- 例外: ConnectionResetError

     *note ConnectionError: 100b. のサブクラスで、接続が通信相手によって
     リセットされた場合に発生します。 ‘errno’ *note ECONNRESET: 2707. に
     対応します。

 -- 例外: FileExistsError

     すでに存在するファイルやディレクトリを作成しようとした場合に送出さ
     れます。‘errno’ *note EEXIST: 2708. に対応します。

 -- 例外: FileNotFoundError

     要求されたファイルやディレクトリが存在しない場合に送出されます。
     ‘errno’ *note ENOENT: 2709. に対応します。

 -- 例外: InterruptedError

     システムコールが入力信号によって中断された場合に送出されます。
     ‘errno’ *note EINTR: f87. に対応します。

     バージョン 3.5 で変更: シグナルハンドラが例外を送出せず、システムコ
     ールが信号で中断された場合 Python は *note InterruptedError: f88. を
     送出する代わりにシステムコールを再試行するようになりました (論拠に
     ついては PEP 475(1) を参照してください) 。

 -- 例外: IsADirectoryError

     ディレクトリに (*note os.remove(): 1308. などの) ファイル操作が要求
     された場合に送出されます。‘errno’ *note EISDIR: 270a. に対応します
     。

 -- 例外: NotADirectoryError

     ディレクトリへの操作(たとえば *note os.listdir(): 1312.)をディレク
     トリ以外に対して要求された場合に送出されます。多くのPOSIXプラットフ
     ォームではディレクトリではないファイルをディレクトリとして開いたり
     移動するときにも発生する場合があります。‘errno’ *note ENOTDIR:
     270b. に対応します。

 -- 例外: PermissionError

     十分なアクセス権、例えばファイルシステム権限のない操作が試みられた
     場合に送出されます。‘errno’ *note EACCES: 270c.、*note EPERM: 1b56.
     および *note ENOTCAPABLE: 1b3f. に対応します。

     バージョン 3.11.1 で変更: WASIの *note ENOTCAPABLE: 1b3f. は *note
     PermissionError: f3e. にマップされました。

 -- 例外: ProcessLookupError

     与えられたプロセスが存在しない場合に送出されます。‘errno’ *note
     ESRCH: 270d. に対応します。

 -- 例外: TimeoutError

     システム関数がシステムレベルでタイムアウトした場合に送出されます。
     ‘errno’ *note ETIMEDOUT: 270e. に対応します。

Added in version 3.3: 上記のすべての *note OSError: 2c0. サブクラスが追
加されました。

参考
....

PEP 3151(2) - OS および IO 例外階層の手直し

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/

   (2) https://peps.python.org/pep-3151/


File: python.info,  Node: 警告,  Next: 例外グループ,  Prev: 具象例外,  Up: 組み込み例外

5.5.5 警告
----------

次の例外は警告カテゴリとして使われます。詳細については *note
警告カテゴリ: 2711. のドキュメントを参照してください。

 -- 例外: Warning

     警告カテゴリの基底クラスです。

 -- 例外: UserWarning

     ユーザコードによって生成される警告の基底クラスです。

 -- 例外: DeprecationWarning

     他の Python 開発者へ向けて警告を発するときの、廃止予定の機能につい
     ての警告の基底クラスです。

     ‘__main__’ モジュールを除いて( PEP 565(1))、デフォルトの警告フィル
     ターで無効化されています。*note Python Development Mode: 508. を有
     効にするとこの警告が表示されます。

     The deprecation policy is described in PEP 387(2).

 -- 例外: PendingDeprecationWarning

     古くなって将来的に廃止される予定だが、今のところは廃止されていない
     機能についての警告の基底クラスです。

     近々起こる可能性のある機能廃止について警告を発することはまれなので
     、このクラスはめったに使われず、既に決まっている廃止については
     *note DeprecationWarning: 1a3. が望ましいです。

     デフォルトの警告フィルターで無効化されています。*note Python
     Development Mode: 508. を有効にするとこの警告が表示されます。

     The deprecation policy is described in PEP 387(3).

 -- 例外: SyntaxWarning

     曖昧な構文に対する警告の基底クラスです。

     This warning is typically emitted when compiling Python source
     code, and usually won't be reported when running already compiled
     code.

 -- 例外: RuntimeWarning

     あいまいなランタイム挙動に対する警告の基底クラスです。

 -- 例外: FutureWarning

     Python で書かれたアプリケーションのエンドユーザーへ向けて警告を発す
     るときの、廃止予定の機能についての警告の基底クラスです。

 -- 例外: ImportWarning

     モジュールインポートの誤りと思われるものに対する警告の基底クラスで
     す。

     デフォルトの警告フィルターで無効化されています。*note Python
     Development Mode: 508. を有効にするとこの警告が表示されます。

 -- 例外: UnicodeWarning

     Unicode に関連した警告の基底クラスです。

 -- 例外: EncodingWarning

     エンコーディングに関連した警告の基底クラスです。

     詳細は *note Opt-in EncodingWarning: 2140. を参照してください。

     Added in version 3.10.

 -- 例外: BytesWarning

     *note bytes: 192. や *note bytearray: 344. に関連した警告の基底クラ
     スです。

 -- 例外: ResourceWarning

     リソースの使用に関連した警告の基底クラスです。

     デフォルトの警告フィルターで無効化されています。*note Python
     Development Mode: 508. を有効にするとこの警告が表示されます。

     Added in version 3.2.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0565/

   (2) https://peps.python.org/pep-0387/

   (3) https://peps.python.org/pep-0387/


File: python.info,  Node: 例外グループ,  Next: 例外のクラス階層,  Prev: 警告,  Up: 組み込み例外

5.5.6 例外グループ
------------------

以下は関係がない複数の例外を送出する必要があるときに使用します。例外グル
ープは例外の階層構造の一部のため、他の例外と同様 *note except: 1ab. で処
理できます。また、*note except*: 1ac. によって判別でき、例外グループに含
まれている例外の型に基づいてサブグループにマッチします。

 -- 例外: ExceptionGroup (msg, excs)

 -- 例外: BaseExceptionGroup (msg, excs)

     この2つの例外型は一連の例外 ‘excs’ を包含します。‘msg’ 引数は文字列
     の必要があります。2つのクラスの異なる点は、*note BaseException:
     7d6. は *note BaseExceptionGroup: 566. を拡張して任意の例外を含めら
     れますが、*note ExceptionGroup: 4d2. は *note Exception: bcd. を拡
     張して *note Exception: bcd. のサブクラスのみを含められます。この設
     計により ‘except Exception’ は *note ExceptionGroup: 4d2. をキャッ
     チしますが、*note BaseExceptionGroup: 566. はキャッチしません。

     *note BaseExceptionGroup: 566. のコンストラクターは含まれる例外がす
     べて *note Exception: bcd. の場合は *note BaseExceptionGroup: 566.
     ではなく *note ExceptionGroup: 4d2. を返すように自動的に選択されま
     す。一方 *note ExceptionGroup: 4d2. コンストラクタは、*note
     Exception: bcd. サブクラス以外の例外を含む場合は *note TypeError:
     198. を送出します。

      -- の属性: message

          コンストラクタの ‘msg’ 引数。この属性は読み込み専用です。

      -- の属性: exceptions

          コンストラクタに渡された一連の ‘excs’ に含まれる例外のタプルで
          す。この属性は読み込み専用です。

      -- メソッド: subgroup (condition)

          現在のグループで '条件' にマッチする礼儀のみを含む例外グループ
          を返します。結果が空の場合は ‘None’ を返します。

          The condition can be an exception type or tuple of exception
          types, in which case each exception is checked for a match
          using the same check that is used in an ‘except’ clause.  The
          condition can also be a callable (other than a type object)
          that accepts an exception as its single argument and returns
          true for the exceptions that should be in the subgroup.

          The nesting structure of the current exception is preserved in
          the result, as are the values of its *note message: 2716,
          *note __traceback__: 14de, *note __cause__: 14e0, *note
          __context__: 14df. and *note __notes__: 26e4. fields.  Empty
          nested groups are omitted from the result.

          The condition is checked for all exceptions in the nested
          exception group, including the top-level and any nested
          exception groups.  If the condition is true for such an
          exception group, it is included in the result in full.

          Added in version 3.13: ‘condition’ can be any callable which
          is not a type object.

      -- メソッド: split (condition)

          *note subgroup(): 1a38. と似てますが ‘(match, rest)’ のペアを
          返します。‘match’ は ‘subgroup(condition)’ で ‘rest’ は残りの
          マッチしない部分です。

      -- メソッド: derive (excs)

          同じ *note message: 2716. の例外グループを返しますが、‘excs’ の
          例外を含んでいます。

          This method is used by *note subgroup(): 1a38. and *note
          split(): 18d8, which are used in various contexts to break up
          an exception group.  A subclass needs to override it in order
          to make *note subgroup(): 1a38. and *note split(): 18d8.
          return instances of the subclass rather than *note
          ExceptionGroup: 4d2.

          *note subgroup(): 1a38. と *note split(): 18d8. は *note
          __traceback__: 14de.、*note __cause__: 14e0.、*note
          __context__: 14df. と *note __notes__: 26e4. フィールドを元の
          例外グループから *note derive(): 1a37. が返す例外グループにコ
          ピーするため、*note derive(): 1a37. ではこれらのフィールドを更
          新する必要がありません。

               >>> class MyGroup(ExceptionGroup):
               ...     def derive(self, excs):
               ...         return MyGroup(self.message, excs)
               ...
               >>> e = MyGroup("eg", [ValueError(1), TypeError(2)])
               >>> e.add_note("a note")
               >>> e.__context__ = Exception("context")
               >>> e.__cause__ = Exception("cause")
               >>> try:
               ...    raise e
               ... except Exception as e:
               ...    exc = e
               ...
               >>> match, rest = exc.split(ValueError)
               >>> exc, exc.__context__, exc.__cause__, exc.__notes__
               (MyGroup('eg', [ValueError(1), TypeError(2)]), Exception('context'), Exception('cause'), ['a note'])
               >>> match, match.__context__, match.__cause__, match.__notes__
               (MyGroup('eg', [ValueError(1)]), Exception('context'), Exception('cause'), ['a note'])
               >>> rest, rest.__context__, rest.__cause__, rest.__notes__
               (MyGroup('eg', [TypeError(2)]), Exception('context'), Exception('cause'), ['a note'])
               >>> exc.__traceback__ is match.__traceback__ is rest.__traceback__
               True

     Note that *note BaseExceptionGroup: 566. defines *note __new__():
     7a0, so subclasses that need a different constructor signature need
     to override that rather than *note __init__(): 8bf.  For example,
     the following defines an exception group subclass which accepts an
     exit_code and constructs the group's message from it.

          class Errors(ExceptionGroup):
             def __new__(cls, errors, exit_code):
                self = super().__new__(Errors, f"exit code: {exit_code}", errors)
                self.exit_code = exit_code
                return self

             def derive(self, excs):
                return Errors(excs, self.exit_code)

     Like *note ExceptionGroup: 4d2, any subclass of *note
     BaseExceptionGroup: 566. which is also a subclass of *note
     Exception: bcd. can only wrap instances of *note Exception: bcd.

     Added in version 3.11.


File: python.info,  Node: 例外のクラス階層,  Prev: 例外グループ,  Up: 組み込み例外

5.5.7 例外のクラス階層
----------------------

組み込み例外のクラス階層は以下のとおりです:

     BaseException
      ├── BaseExceptionGroup
      ├── GeneratorExit
      ├── KeyboardInterrupt
      ├── SystemExit
      └── Exception
           ├── ArithmeticError
           │    ├── FloatingPointError
           │    ├── OverflowError
           │    └── ZeroDivisionError
           ├── AssertionError
           ├── AttributeError
           ├── BufferError
           ├── EOFError
           ├── ExceptionGroup [BaseExceptionGroup]
           ├── ImportError
           │    └── ModuleNotFoundError
           ├── LookupError
           │    ├── IndexError
           │    └── KeyError
           ├── MemoryError
           ├── NameError
           │    └── UnboundLocalError
           ├── OSError
           │    ├── BlockingIOError
           │    ├── ChildProcessError
           │    ├── ConnectionError
           │    │    ├── BrokenPipeError
           │    │    ├── ConnectionAbortedError
           │    │    ├── ConnectionRefusedError
           │    │    └── ConnectionResetError
           │    ├── FileExistsError
           │    ├── FileNotFoundError
           │    ├── InterruptedError
           │    ├── IsADirectoryError
           │    ├── NotADirectoryError
           │    ├── PermissionError
           │    ├── ProcessLookupError
           │    └── TimeoutError
           ├── ReferenceError
           ├── RuntimeError
           │    ├── NotImplementedError
           │    ├── PythonFinalizationError
           │    └── RecursionError
           ├── StopAsyncIteration
           ├── StopIteration
           ├── SyntaxError
           │    └── IndentationError
           │         └── TabError
           ├── SystemError
           ├── TypeError
           ├── ValueError
           │    └── UnicodeError
           │         ├── UnicodeDecodeError
           │         ├── UnicodeEncodeError
           │         └── UnicodeTranslateError
           └── Warning
                ├── BytesWarning
                ├── DeprecationWarning
                ├── EncodingWarning
                ├── FutureWarning
                ├── ImportWarning
                ├── PendingDeprecationWarning
                ├── ResourceWarning
                ├── RuntimeWarning
                ├── SyntaxWarning
                ├── UnicodeWarning
                └── UserWarning


File: python.info,  Node: テキスト処理サービス,  Next: バイナリデータ処理,  Prev: 組み込み例外,  Up: Python 標準ライブラリ

5.6 テキスト処理サービス
========================

この章で説明するモジュールは幅広い文字列操作や様々なテキスト処理サービス
を提供しています。

*note codecs: 1c. モジュールはテキスト処理と高い関連性を持った *note
バイナリデータ処理: 271c. のなかで説明されています。加えて Python の組み
込み文字列型の *note テキストシーケンス型 -- str: 1fe0. のドキュメントも
参照して下さい。

* Menu:

* string: string --- 一般的な文字列操作. 一般的な文字列操作
* string.templatelib: string templatelib --- テンプレート文字列リテラルのサポート. テンプレート文字列リテラルのサポート
* re: re --- 正規表現操作. 正規表現操作
* difflib: difflib --- 差分の計算の補助. 差分の計算の補助
* textwrap: textwrap --- テキストの折り返しと詰め込み. テキストの折り返しと詰め込み
* unicodedata: unicodedata --- Unicode データベース. Unicode データベース
* stringprep: stringprep --- インターネットの文字列調製. インターネットの文字列調製
* readline: readline --- GNU readline のインターフェース. GNU readline のインターフェース
* rlcompleter: rlcompleter --- GNU readline の補完機能. GNU readline の補完機能


File: python.info,  Node: string --- 一般的な文字列操作,  Next: string templatelib --- テンプレート文字列リテラルのサポート,  Up: テキスト処理サービス

5.6.1 ‘string’ -- 一般的な文字列操作
------------------------------------

'Source code:' Lib/string/__init__.py(1)

__________________________________________________________________

参考
....

*note テキストシーケンス型 -- str: 1fe0.

*note 文字列メソッド: 1fe1.

* Menu:

* 文字列定数::
* カスタムの文字列書式化::
* 書式指定文字列の文法::
* Template strings ($-strings): Template strings $-strings.
* ヘルパー関数::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/string/__init__.py


File: python.info,  Node: 文字列定数,  Next: カスタムの文字列書式化,  Up: string --- 一般的な文字列操作

5.6.1.1 文字列定数
..................

このモジュールで定義されている定数は以下の通りです:

 -- データ: string.ascii_letters

     後述の *note ascii_lowercase: 2720. と *note ascii_uppercase: 2721.
     を合わせたもの。この値はロケールに依存しません。

 -- データ: string.ascii_lowercase

     小文字 ‘'abcdefghijklmnopqrstuvwxyz'’ 。この値はロケールに依存せず
     、固定です。

 -- データ: string.ascii_uppercase

     大文字 ‘'ABCDEFGHIJKLMNOPQRSTUVWXYZ'’ 。この値はロケールに依存せず
     、固定です。

 -- データ: string.digits

     文字列 ‘'0123456789'’ です。

 -- データ: string.hexdigits

     文字列 ‘'0123456789abcdefABCDEF'’ です。

 -- データ: string.octdigits

     文字列 ‘'01234567'’ です。

 -- データ: string.punctuation

     ‘C’ ロケールにおいて、区切り文字 (punctuation characters) として扱
     われる ASCII 文字の文字列です: ‘!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~’.

 -- データ: string.printable

     String of ASCII characters which are considered printable by
     Python.  This is a combination of *note digits: 2722, *note
     ascii_letters: 14db, *note punctuation: 2725, and *note whitespace:
     2726.

          注釈: By design, *note string.printable.isprintable(): fd8.
          returns *note False: d2b.  In particular, ‘string.printable’
          is not printable in the POSIX sense (see ‘LC_CTYPE(1)’).

 -- データ: string.whitespace

     空白 (whitespace) として扱われる ASCII 文字全てを含む文字列です。ほ
     とんどのシステムでは、これはスペース (space)、タブ (tab)、改行
     (linefeed)、復帰 (return)、改頁 (formfeed)、垂直タブ (vertical tab)
     です。

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/locale(5)


File: python.info,  Node: カスタムの文字列書式化,  Next: 書式指定文字列の文法,  Prev: 文字列定数,  Up: string --- 一般的な文字列操作

5.6.1.2 カスタムの文字列書式化
..............................

The built-in string class provides the ability to do complex variable
substitutions and value formatting via the *note format(): 833. method
described in PEP 3101(1).  The *note Formatter: 10bd. class in the
‘string’ module allows you to create and customize your own string
formatting behaviors using the same implementation as the built-in *note
format(): 833. method.

 -- クラス: string.Formatter

     *note Formatter: 10bd. クラスは、以下のメソッドを持ちます:

      -- メソッド: format (format_string, /, *args, **kwargs)

          主要な API メソッドです。書式文字列と、任意の位置引数およびキ
          ーワード引数のセットを取ります。これは、*note vformat(): 2728.
          を呼び出す単なるラッパーです。

          バージョン 3.7 で変更: 書式文字列は *note 位置専用: c78. の引
          数となりました。

      -- メソッド: vformat (format_string, args, kwargs)

          この関数はフォーマットの実際の仕事をします。この関数は、
          ‘*args’ および ‘**kwargs’ シンタックスを使用して、辞書を個々の
          引数として unpack してから再度 pack するのではなく、引数として
          あらかじめ用意した辞書を渡したい場合のために、独立した関数とし
          て公開されます。 *note vformat(): 2728. は、書式文字列を文字デ
          ータと置換フィールドに分解する仕事をします。それは、以下に記述
          する様々なメソッドを呼び出します。

     さらに、 *note Formatter: 10bd. ではサブクラスによって置き換えられ
     ることを意図した次のようないくつかのメソッドが定義されています。

      -- メソッド: parse (format_string)

          format_stringを探査し、タプル、 ('literal_text', 'field_name',
          'format_spec', 'conversion') のイテラブルを返します。これは
          *note vformat(): 2728. が文字列を文字としての文字データや置換
          フィールドに展開するために使用されます。

          The values in the tuple conceptually represent a span of
          literal text followed by a single replacement field.  If there
          is no literal text (which can happen if two replacement fields
          occur consecutively), then 'literal_text' will be a
          zero-length string.  If there is no replacement field, then
          the values of 'field_name', 'format_spec' and 'conversion'
          will be ‘None’.  The value of 'field_name' is unmodified and
          auto-numbering of non-numbered positional fields is done by
          *note vformat(): 2728.

      -- メソッド: get_field (field_name, args, kwargs)

          Given 'field_name', convert it to an object to be formatted.
          Auto-numbering of 'field_name' returned from *note parse():
          2729. is done by *note vformat(): 2728. before calling this
          method.  Returns a tuple (obj, used_key).  The default version
          takes strings of the form defined in PEP 3101(2), such as
          "0[name]" or "label.title".  'args' and 'kwargs' are as passed
          in to *note vformat(): 2728.  The return value 'used_key' has
          the same meaning as the 'key' parameter to *note get_value():
          272b.

      -- メソッド: get_value (key, args, kwargs)

          与えられたフィールドの値を取り出します。 'key' 引数は整数でも
          文字列でも構いません。整数の場合は、位置引数 'args' のインデッ
          クス番号を示します。文字列の場合は、名前付きの引数 'kwargs' を
          意味します。

          'args' 引数は、 *note vformat(): 2728. への位置引数のリストに
          設定され、 'kwargs' 引数は、キーワード引数の辞書に設定されます
          。

          フィールド名が (ピリオドで区切られた) いくつかの要素からなって
          いる場合、最初の要素のみがこれらの関数に渡されます。残りの要素
          に関しては、通常の属性またはインデックスアクセスと同様に処理さ
          れます。

          つまり、例えば、フィールドが '0.name' と表現されるとき、 *note
          get_value(): 272b. は、 'key' 引数が 0 として呼び出されます。
          属性 ‘name’ は、組み込みの *note getattr(): dca. 関数が呼び出
          され、 *note get_value(): 272b. が返されたのちに検索されます。

          インデックスまたはキーワードが存在しないアイテムを参照した場合
          、 *note IndexError: 174e. または *note KeyError: 5e7. が送出
          されます。

      -- メソッド: check_unused_args (used_args, args, kwargs)

          希望に応じて未使用の引数がないか確認する機能を実装します。この
          関数への引数は、書式指定文字列で実際に参照されるすべての引数の
          キーの set (位置引数の整数、名前付き引数の文字列) と、vformat
          に渡される 'args' と 'kwargs' への参照です。使用されない引数の
          set は、これらのパラメータから計算されます。 *note
          check_unused_args(): 272c. は、確認の結果が偽である場合に例外
          を送出するものとみなされます。

      -- メソッド: format_field (value, format_spec)

          *note format_field(): 272d. は単純に組み込みのグローバル関数
          *note format(): 199. を呼び出します。このメソッドは、サブクラ
          スをオーバーライドするために提供されます。

      -- メソッド: convert_field (value, conversion)

          (*note get_field(): 272a. が返す) 値を (*note parse(): 2729. メ
          ソッドが返すタプルの形式で) 与えられた変換タイプとして変換しま
          す。デフォルトバージョンは 's' (str), 'r' (repr), 'a' (ascii)
          変換タイプを理解します。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3101/

   (2) https://peps.python.org/pep-3101/


File: python.info,  Node: 書式指定文字列の文法,  Next: Template strings $-strings,  Prev: カスタムの文字列書式化,  Up: string --- 一般的な文字列操作

5.6.1.3 書式指定文字列の文法
............................

The *note str.format(): 833. method and the *note Formatter: 10bd. class
share the same syntax for format strings (although in the case of *note
Formatter: 10bd, subclasses can define their own format string syntax).
The syntax is related to that of *note formatted string literals: 19a.
and *note template string literals: 17fa, but it is less sophisticated
and, in particular, does not support arbitrary expressions in
interpolations.

書式指定文字列は波括弧 ‘{}’ に囲まれた "置換フィールド" を含みます。波括
弧に囲まれた部分以外は全て単純な文字として扱われ、変更を加えることなく出
力へコピーされます。波括弧を文字として扱う必要がある場合は、二重にするこ
とでエスケープすることができます: ‘{{’ および ‘}}’ 。

置換フィールドの文法は以下です:

     replacement_field: "{" [*note field_name: 2731.] ["!" *note conversion: 2732.] [":" *note format_spec: 2733.] "}"
     field_name:        *note arg_name: 2734. ("." *note attribute_name: 2735. | "[" *note element_index: 2736. "]")*
     arg_name:          [*note identifier: 22c1. | *note digit: 2312.+]
     attribute_name:    *note identifier: 22c1.
     element_index:     *note digit: 2312.+ | *note index_string: 2737.
     index_string:      <any source character except "]"> +
     conversion:        "r" | "s" | "a"
     format_spec:       *note format-spec;format_spec: 2738.

もっと簡単にいうと、置換フィールドは 'field_name' で始められます。これに
よって指定したオブジェクトの値が、置換フィールドの代わりに書式化され出力
に挿入されます。'field_name' の後に、感嘆符 ‘'!'’ を挟んで 'conversion'
フィールドを続けることができます。最後にコロン ‘':'’ を挟んで、
'format_spec' を書くことができます。これは、置換される値の非デフォルトの
書式を指定します。

*note 書式指定ミニ言語仕様: 4f9. 節も参照して下さい。

'field_name' それ自身は、数かキーワードのいずれかである 'arg_name' から
始まります。それが数である場合、位置引数を参照します。また、それがキーワ
ードである場合、指定されたキーワード引数を参照します。文字列に対して
*note str.isdecimal(): 262d. を呼び出した結果が真の場合、 'arg_name' は
数として扱われます。書式文字列中で数の arg_names が順に 0, 1, 2, ...  で
ある場合、それらはすべて (いくつかではありません) 省略することができます
。そして数 0, 1, 2, ...  は、自動的にその順で挿入されます。 'arg_name' は
引用符で区切られていないので、書式文字列内の任意の辞書キー (例えば文字列
‘'10'’ や ‘':-]'’ など) を指定することはできません。 'arg_name' の後に任
意の数のインデックス式または属性式を続けることができます。 ‘'.name'’ 形
式の式は *note getattr(): dca. を使用して指定された属性を選択します。一
方、 ‘'[index]'’ 形式の式は *note __getitem__(): 588. を使用してインデッ
クス参照を行います。

バージョン 3.1 で変更: *note str.format(): 833. を使い、位置引数指定を省
略することができます。 ‘'{} {}'.format(a, b)’ は ‘'{0} {1}'.format(a,
b)’ と同じになります。

バージョン 3.4 で変更: *note Formatter: 10bd. を使い、位置引数指定を省略
することができます。

簡単な書式指定文字列の例を挙げます:

     "First, thou shalt count to {0}"  # References first positional argument
     "Bring me a {}"                   # Implicitly references the first positional argument
     "From {} to {}"                   # Same as "From {0} to {1}"
     "My quest is {name}"              # References keyword argument 'name'
     "Weight in tons {0.weight}"       # 'weight' attribute of first positional arg
     "Units destroyed: {players[0]}"   # First element of keyword argument 'players'.
'置換 (conversion)' フィールドにより書式変換前に型の強制変換が実施されま
す。通常、値の書式変換は *note __format__(): 831. によって実施されます。
しかしながら、場合によっては、文字列として変換することを強制したり、書式
指定の定義をオーバーライドしたくなることもあります。 *note __format__():
831. の呼び出し前に値を文字列に変換すると、通常の書式変換の処理は飛ばさ
れます。

現在 3つの変換フラグがサポートされています: 値に対して *note str(): 169.
を呼ぶ ‘'!s'’ 、 *note repr(): 1c1. を呼ぶ ‘'!r'’ 、 *note ascii():
15ff. を呼ぶ ‘'!a'’。

いくつかの例です:

     "Harold's a clever {0!s}"        # Calls str() on the argument first
     "Bring out the holy {name!r}"    # Calls repr() on the argument first
     "More {!a}"                      # Calls ascii() on the argument first

'format_spec' フィールドは、フィールド幅、文字揃え、埋め方、精度などの、
値を表現する仕様を含みます。それぞれの値の型は、 "formatting
mini-language" 、または、 'format_spec' の実装で定義されます。

ほとんどの組み込み型は、次のセクションに記載された共通の formatting
mini-language をサポートします。

'format_spec' フィールド内には入れ子になった置換フィールドを含めることも
できます。入れ子になった置換フィールドにはフィールド名、変換フラグ、書式
指定を含めることができますが、さらに入れ子の階層を含めることはできません
。 format_spec 中の置換フィールドは 'format_spec' 文字列が解釈される前に
置き換えられます。これにより、値の書式を動的に指定することができます。

*note 書式指定例: 273a. のいくつかの例も参照して下さい。

* Menu:

* 書式指定ミニ言語仕様::
* 書式指定例::


File: python.info,  Node: 書式指定ミニ言語仕様,  Next: 書式指定例,  Up: 書式指定文字列の文法

5.6.1.4 書式指定ミニ言語仕様
............................

"Format specifications" are used within replacement fields contained
within a format string to define how individual values are presented
(see *note 書式指定文字列の文法: 15b3, *note f-strings: 19a, and *note
t-strings: 17fa.).  They can also be passed directly to the built-in
*note format(): 199. function.  Each formattable type may define how the
format specification is to be interpreted.

多くの組み込み型は、書式指定に関して以下のオプションを実装します。しかし
ながら、いくつかの書式指定オプションは数値型でのみサポートされます。

一般的な取り決めとして、空の書式指定は、値に対して *note str(): 169. を
呼び出したときと同じ結果を与えます。通常、空でない書式指定はその結果を変
更します。

一般的な書式指定子 ('standard format specifier') の書式は以下です:

     format_spec:             [*note options: 273c.][*note width_and_precision: 273d.][*note type: 273e.]
     options:                 [[*note fill: 273f.]*note align: 2740.][*note sign: 2741.]["z"]["#"]["0"]
     fill:                    <any character>
     align:                   "<" | ">" | "=" | "^"
     sign:                    "+" | "-" | " "
     width_and_precision:     [*note width_with_grouping: 2742.][*note precision_with_grouping: 2743.]
     width_with_grouping:     [*note width: 2744.][*note grouping: 2745.]
     precision_with_grouping: "." [*note precision: 2746.][*note grouping: 2745.] | "." *note grouping: 2745.
     width:                   *note digit: 2312.+
     precision:               *note digit: 2312.+
     grouping:                "," | "_"
     type:                    "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g"
                              | "G" | "n" | "o" | "s" | "x" | "X" | "%"

有効な 'align' 値を指定する場合、その前に 'fill' 文字を付けることができ
ます。 この文字には任意の文字を指定でき、省略された場合はデフォルトの空
白文字となります。 *note formatted string literal: 19a. の中や *note
str.format(): 833. メソッドを使う場合はリテラルの波括弧 ("‘{’" と "‘}’")
を 'fill' 文字として使えないことに注意してください。 ただし、波括弧を入
れ子になった置換フィールド内に挿入することはできます。 この制限は *note
format(): 199. 関数には影響しません。

様々な align オプションの意味は以下のとおりです:

オプション    意味
              
-----------------------------------------------------------------------------
              
‘'<'’         利用可能なスペースにおいて、左詰めを強制します (ほとんどのオ
              ブジェクトにおいてのデフォルト)。
              
              
‘'>'’         利用可能なスペースにおいて、右詰めを強制します (いくつかのオ
              ブジェクトにおいてのデフォルト)。
              
              
‘'='’         Forces the padding to be placed after the sign (if any) but
              before the digits.  This is used for printing fields in the
              form '+000000120'.  This alignment option is only valid for
              numeric types, excluding *note complex: 197.  It becomes the
              default for numbers when '0' immediately precedes the field
              width.
              
              
‘'^'’         利用可能なスペースにおいて、中央寄せを強制します。
              

最小のフィールド幅が定義されない限り、フィールド幅はデータを表示するため
に必要な幅と同じになることに注意して下さい。そのため、その場合には、
align オプションは意味を持ちません。

'sign' オプションは数値型に対してのみ有効であり、以下のうちのひとつとな
ります:

オプション    意味
              
-----------------------------------------------------------------------------
              
‘'+'’         Indicates that a sign should be used for both positive as
              well as negative numbers.
              
              
‘'-'’         Indicates that a sign should be used only for negative
              numbers (this is the default behavior).
              
              
空白          Indicates that a leading space should be used on positive
              numbers, and a minus sign on negative numbers.
              

‘'z'’ オプションはマイナス0の浮動小数点数をフォーマットの制度で丸めたあ
とにプラス0に強制的に変換します。このオプションは浮動小数点数型に対して
のみ有効です。

バージョン 3.11 で変更: ‘'z'’ オプションが追加されました ( PEP 682(1) も
参照)。

‘'#'’ オプションは、変換に「別形式」を使用します。別形式は、異なる型に対
して違った風に定義されます。このオプションは、整数、浮動小数点数、複素数
でのみ有効です。整数に対して2進法、8進法、または16進法の出力が使用される
場合、このオプションは出力される値にそれぞれ ‘'0b'’, ‘'0o'’, ‘'0x'’,
‘'0X'’ 接頭辞を加えます。浮動小数点数、複素数については、別形式では、小
数点文字の後に数字がなくても変換結果には常に小数点文字が含まれます。通常
は、数字が続く場合にのみ小数点文字がこれらの変換結果に現われます。さらに
、‘'g'’ と ‘'G'’ の変換については、最後の 0 は結果から取り除かれません。

The 'width' is a decimal integer defining the minimum total field width,
including any prefixes, separators, and other formatting characters.  If
not specified, then the field width will be determined by the content.

When no explicit alignment is given, preceding the 'width' field by a
zero (‘'0'’) character enables sign-aware zero-padding for numeric
types, excluding *note complex: 197.  This is equivalent to a 'fill'
character of ‘'0'’ with an 'alignment' type of ‘'='’.

バージョン 3.10 で変更: 'width' フィールドに ‘'0'’ を前置することは、文
字列に対するデフォルトの整列に影響を与えなくなりました。

'precision' は、表現型 ‘'f'’ または ‘'F'’ の場合小数点以下、表現型 ‘'g'’
または ‘'G'’ の場合は小数点以上と以下が何桁で表示されるべきかを示す10進
整数です。文字列の表現型の場合は最大フィールド幅、言い換えるとフィールド
の内容から何文字が使用されるかを示します。'precision' は整数の表現型には
使用できません。

The 'grouping' option after 'width' and 'precision' fields specifies a
digit group separator for the integral and fractional parts of a number
respectively.  It can be one of the following:

オプション    意味
              
-----------------------------------------------------------------------------
              
‘','’         Inserts a comma every 3 digits for integer presentation type
              ‘'d'’ and floating-point presentation types, excluding
              ‘'n'’.  For other presentation types, this option is not
              supported.
              
              
‘'_'’         Inserts an underscore every 3 digits for integer
              presentation type ‘'d'’ and floating-point presentation
              types, excluding ‘'n'’.  For integer presentation types
              ‘'b'’, ‘'o'’, ‘'x'’, and ‘'X'’, underscores are inserted
              every 4 digits.  For other presentation types, this option
              is not supported.
              

For a locale aware separator, use the ‘'n'’ presentation type instead.

バージョン 3.1 で変更: ‘','’ オプションが追加されました ( PEP 378(2) も
参照)。

バージョン 3.6 で変更: ‘'_'’ オプションが追加されました ( PEP 515(3) も
参照)。

バージョン 3.14 で変更: Support the 'grouping' option for the fractional
part.

最後に、'type' は、データがどのように表現されるかを決定します。

利用可能な文字列の表現型は以下です:

     型            意味
                   
     -----------------------------------------------------------------------------
                   
     ‘'s'’         文字列。これがデフォルトの値で、多くの場合省略されます。
                   
                   
     None          ‘'s'’ と同じです。
                   

利用可能な整数の表現型は以下です:

     型            意味
                   
     -----------------------------------------------------------------------------
                   
     ‘'b'’         2進数。出力される数値は2を基数とします。
                   
                   
     ‘'c'’         文字。数値を対応する Unicode 文字に変換します。
                   
                   
     ‘'d'’         10進数。出力される数値は10を基数とします。
                   
                   
     ‘'o'’         8進数。出力される数値は8を基数とします。
                   
                   
     ‘'x'’         16進数。出力される数値は16を基数とします。 10進で9を超える数
                   字には小文字が使われます。
                   
                   
     ‘'X'’         16進数。出力される数値は16を基数とします。10進で9を超える数
                   字には大文字が使われます。‘'#'’ が指定された場合、接頭辞
                   ‘'0x'’ も大文字 ‘'0X'’ になります
                   
                   
     ‘'n'’         Number.  This is the same as ‘'d'’, except that it uses the
                   current locale setting to insert the appropriate digit group
                   separators.
                   
                   
     None          ‘'d'’ と同じです。
                   

これらの表現型に加えて、整数は (‘'n'’ と ‘None’ を除く) 以下の浮動小数点
数の表現型で書式指定できます。 そうすることで整数は書式変換される前に
*note float(): 196. を使って浮動小数点数に変換されます。

利用可能な *note float: 196. と *note Decimal: 1fe. の表現型は以下です:

     型            意味
                   
     -----------------------------------------------------------------------------
                   
     ‘'e'’         Scientific notation.  For a given precision ‘p’, formats the
                   number in scientific notation with the letter 'e' separating
                   the coefficient from the exponent.  The coefficient has one
                   digit before and ‘p’ digits after the decimal point, for a
                   total of ‘p + 1’ significant digits.  With no precision
                   given, uses a precision of ‘6’ digits after the decimal
                   point for *note float: 196, and shows all coefficient digits
                   for *note Decimal: 1fe.  If ‘p=0’, the decimal point is
                   omitted unless the ‘#’ option is used.
                   
                   For *note float: 196, the exponent always contains at least
                   two digits, and is zero if the value is zero.
                   
                   
     ‘'E'’         指数表記です。大文字の 'E' を使うことを除いては、 ‘'e'’ と同
                   じです。
                   
                   
     ‘'f'’         Fixed-point notation.  For a given precision ‘p’, formats
                   the number as a decimal number with exactly ‘p’ digits
                   following the decimal point.  With no precision given, uses
                   a precision of ‘6’ digits after the decimal point for
                   *note float: 196, and uses a precision large enough to show
                   all coefficient digits for *note Decimal: 1fe.  If ‘p=0’,
                   the decimal point is omitted unless the ‘#’ option is used.
                   
                   
     ‘'F'’         固定小数点数表記です。‘nan’ が ‘NAN’ に、‘inf’ が ‘INF’ に変
                   換されることを除き ‘'f'’ と同じです。
                   
                   
     ‘'g'’         汎用表記です。与えられた精度 ‘p >= 1’ に対して、この表記では
                   数値を有効桁数 ‘p’ に丸めた上で、数値の大きさに応じて固定小
                   数点表記または科学的表記で表します。精度 ‘0’ は精度 ‘1’ と同
                   じものと取り扱われます。
                   
                   正確なルールは次の通りです: 書式 ‘'e'’ 型および精度 ‘p-1’ 桁
                   で数値をフォーマットした結果、指数部が ‘exp’ になったと仮定
                   します。このとき ‘m <= exp < p’ ならば、数値は書式 ‘'f'’ 型
                   および精度 ‘p-1-exp’ 桁でフォーマットされます。ただし ‘m’ は
                   浮動小数点数では -4 であり、 *note Decimals: 1fe. に対しては
                   -6 です。それ以外の場合、数値は書式 ‘'e'’ 型および精度 ‘p-1’
                   桁でフォーマットされます。どちらの場合でも、仮数部の有効でな
                   い末尾のゼロは取り除かれます。また小数点以下に表示する桁が無
                   い場合、 ‘'#'’ オプションが使われた場合をのぞき、小数点は除
                   去されます。
                   
                   精度が指定されない場合、 *note float: 196. に対しては有効桁
                   数として ‘6’ 桁を適用します。 *note Decimal: 1fe. では、フォ
                   ーマット結果の係数部は実際の値の桁数によって決まります; 絶対
                   値が ‘1e-6’ より小さい値や、最下位桁の値が1より大きい値では
                   科学的表記が使われます。それ以外の場合は固定小数点表記が使わ
                   れます。
                   
                   正と負の無限大と 0 および NaN は精度に関係なくそれぞれ
                   ‘inf’, ‘-inf’, ‘0’, ‘-0’ および ‘nan’ となります。
                   
                   
     ‘'G'’         汎用フォーマットです。数値が大きくなったとき、 ‘'E'’ に切り
                   替わることを除き、 ‘'g'’ と同じです。無限大と NaN の表示も大
                   文字になります。
                   
                   
     ‘'n'’         Number.  This is the same as ‘'g'’, except that it uses the
                   current locale setting to insert the appropriate digit group
                   separators for the integral part of a number.
                   
                   
     ‘'%'’         パーセンテージです。数値は 100 倍され、固定小数点数フォーマ
                   ット (‘'f'’) でパーセント記号付きで表示されます。
                   
                   
     None          For *note float: 196. this is like the ‘'g'’ type, except
                   that when fixed-point notation is used to format the result,
                   it always includes at least one digit past the decimal
                   point, and switches to the scientific notation when ‘exp >=
                   p - 1’.  When the precision is not specified, the latter
                   will be as large as needed to represent the given value
                   faithfully.
                   
                   *note Decimal: 1fe. に対しては、現在の decimal コンテキスト
                   における ‘context.capitals’ の値に応じて、 ‘'g'’ か ‘'G'’ の
                   どちらかと同じになります。
                   
                   全体として、他の書式修正指定によって変更された
                   *note str(): 169. の出力に一致するような結果になります。
                   

The result should be correctly rounded to a given precision ‘p’ of
digits after the decimal point.  The rounding mode for *note float: 196.
matches that of the *note round(): 14f2. builtin.  For *note Decimal:
1fe, the rounding mode of the current *note context: 2747. will be used.

The available presentation types for *note complex: 197. are the same as
those for *note float: 196. (‘'%'’ is not allowed).  Both the real and
imaginary components of a complex number are formatted as floating-point
numbers, according to the specified presentation type.  They are
separated by the mandatory sign of the imaginary part, the latter being
terminated by a ‘j’ suffix.  If the presentation type is missing, the
result will match the output of *note str(): 169. (complex numbers with
a non-zero real part are also surrounded by parentheses), possibly
altered by other format modifiers.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0682/

   (2) https://peps.python.org/pep-0378/

   (3) https://peps.python.org/pep-0515/


File: python.info,  Node: 書式指定例,  Prev: 書式指定ミニ言語仕様,  Up: 書式指定文字列の文法

5.6.1.5 書式指定例
..................

この節では、 *note str.format(): 833. 構文の例を紹介し、さらに従来の
‘%’-書式と比較します。

多くの場合、新構文に ‘{}’ を加え、 ‘%’ の代わりに ‘:’ を使うことで、古い
‘%’-書式に類似した書式になります。例えば、‘'%03.2f'’ は ‘'{:03.2f}'’ と
変換できます。

以下の例で示すように、新構文はさらに新たに様々なオプションもサポートして
います。

位置引数を使ったアクセス:

     >>> '{0}, {1}, {2}'.format('a', 'b', 'c')
     'a, b, c'
     >>> '{}, {}, {}'.format('a', 'b', 'c')  # 3.1+ only
     'a, b, c'
     >>> '{2}, {1}, {0}'.format('a', 'b', 'c')
     'c, b, a'
     >>> '{2}, {1}, {0}'.format(*'abc')      # unpacking argument sequence
     'c, b, a'
     >>> '{0}{1}{0}'.format('abra', 'cad')   # arguments' indices can be repeated
     'abracadabra'

名前を使ったアクセス:

     >>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', longitude='-115.81W')
     'Coordinates: 37.24N, -115.81W'
     >>> coord = {'latitude': '37.24N', 'longitude': '-115.81W'}
     >>> 'Coordinates: {latitude}, {longitude}'.format(**coord)
     'Coordinates: 37.24N, -115.81W'

引数の属性へのアクセス:

     >>> c = 3-5j
     >>> ('The complex number {0} is formed from the real part {0.real} '
     ...  'and the imaginary part {0.imag}.').format(c)
     'The complex number (3-5j) is formed from the real part 3.0 and the imaginary part -5.0.'
     >>> class Point:
     ...     def __init__(self, x, y):
     ...         self.x, self.y = x, y
     ...     def __str__(self):
     ...         return 'Point({self.x}, {self.y})'.format(self=self)
     ...
     >>> str(Point(4, 2))
     'Point(4, 2)'

引数の要素へのアクセス:

     >>> coord = (3, 5)
     >>> 'X: {0[0]};  Y: {0[1]}'.format(coord)
     'X: 3;  Y: 5'

‘%s’ と ‘%r’ の置き換え:

     >>> "repr() shows quotes: {!r}; str() doesn't: {!s}".format('test1', 'test2')
     "repr() shows quotes: 'test1'; str() doesn't: test2"

テキストの幅を指定した整列:

     >>> '{:<30}'.format('left aligned')
     'left aligned                  '
     >>> '{:>30}'.format('right aligned')
     '                 right aligned'
     >>> '{:^30}'.format('centered')
     '           centered           '
     >>> '{:*^30}'.format('centered')  # use '*' as a fill char
     '***********centered***********'

‘%+f’ と ‘%-f’, ‘% f’ の置換、そして符号の指定:

     >>> '{:+f}; {:+f}'.format(3.14, -3.14)  # show it always
     '+3.140000; -3.140000'
     >>> '{: f}; {: f}'.format(3.14, -3.14)  # show a space for positive numbers
     ' 3.140000; -3.140000'
     >>> '{:-f}; {:-f}'.format(3.14, -3.14)  # show only the minus -- same as '{:f}; {:f}'
     '3.140000; -3.140000'

‘%x’ と ‘%o’ の置換、そして値に対する異なる底の変換:

     >>> # format also supports binary numbers
     >>> "int: {0:d};  hex: {0:x};  oct: {0:o};  bin: {0:b}".format(42)
     'int: 42;  hex: 2a;  oct: 52;  bin: 101010'
     >>> # with 0x, 0o, or 0b as prefix:
     >>> "int: {0:d};  hex: {0:#x};  oct: {0:#o};  bin: {0:#b}".format(42)
     'int: 42;  hex: 0x2a;  oct: 0o52;  bin: 0b101010'

Using the comma or the underscore as a digit group separator:

     >>> '{:,}'.format(1234567890)
     '1,234,567,890'
     >>> '{:_}'.format(1234567890)
     '1_234_567_890'
     >>> '{:_b}'.format(1234567890)
     '100_1001_1001_0110_0000_0010_1101_0010'
     >>> '{:_x}'.format(1234567890)
     '4996_02d2'
     >>> '{:_}'.format(123456789.123456789)
     '123_456_789.12345679'
     >>> '{:.,}'.format(123456789.123456789)
     '123456789.123,456,79'
     >>> '{:,._}'.format(123456789.123456789)
     '123,456,789.123_456_79'

パーセントを表示する:

     >>> points = 19
     >>> total = 22
     >>> 'Correct answers: {:.2%}'.format(points/total)
     'Correct answers: 86.36%'

型特有の書式指定を使う:

     >>> import datetime
     >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)
     >>> '{:%Y-%m-%d %H:%M:%S}'.format(d)
     '2010-07-04 12:15:58'

引数をネストする、さらに複雑な例:

     >>> for align, text in zip('<^>', ['left', 'center', 'right']):
     ...     '{0:{fill}{align}16}'.format(text, fill=align, align=align)
     ...
     'left<<<<<<<<<<<<'
     '^^^^^center^^^^^'
     '>>>>>>>>>>>right'
     >>>
     >>> octets = [192, 168, 0, 1]
     >>> '{:02X}{:02X}{:02X}{:02X}'.format(*octets)
     'C0A80001'
     >>> int(_, 16)
     3232235521
     >>>
     >>> width = 5
     >>> for num in range(5,12):
     ...     for base in 'dXob':
     ...         print('{0:{width}{base}}'.format(num, base=base, width=width), end=' ')
     ...     print()
     ...
         5     5     5   101
         6     6     6   110
         7     7     7   111
         8     8    10  1000
         9     9    11  1001
        10     A    12  1010
        11     B    13  1011


File: python.info,  Node: Template strings $-strings,  Next: ヘルパー関数,  Prev: 書式指定文字列の文法,  Up: string --- 一般的な文字列操作

5.6.1.6 Template strings ($-strings)
....................................

     注釈: The feature described here was introduced in Python 2.4; a
     simple templating method based upon regular expressions.  It
     predates *note str.format(): 833, *note formatted string literals:
     19a, and *note template string literals: 274b.

     It is unrelated to template string literals (t-strings), which were
     introduced in Python 3.14.  These evaluate to *note
     string.templatelib.Template: 16a. objects, found in the *note
     string.templatelib: d9. module.

テンプレート文字列では PEP 292(1) で解説されている単純な文字列置換ができ
ます。 テンプレート文字列の主な使い道は国際化 (i18n) です。というのは、
その国際化の文脈において、より簡潔な文法と機能を持つテンプレート文字列を
使うと、 Python にある他の組み込みの文字列フォーマット機能よりも翻訳がし
やすいからです。 テンプレート文字列の上に構築された国際化のためのライプ
ラリの例として、 flufl.i18n(2) を調べてみてください。

テンプレート文字列は ‘$’ に基づいた置換をサポートしていて、次の規則が使
われています:

   * ‘$$’ はエスケープ文字です; ‘$’ 一つに置換されます。

   * ‘$identifier’ は ‘"identifier"’ のマッピングキーに合致する置換プレ
     ースホルダーを指定します。デフォルトでは、 ‘"identifier"’ は大文字
     と小文字を区別しない ASCII 英数字 (アンダースコアを含む) からなら文
     字列に制限されています。文字列はアンダースコアか ASCII 文字から始ま
     るものでなければなりません。‘$’ の後に識別子に使えない文字が出現す
     ると、そこでプレースホルダ名の指定が終わります。

   * ‘${identifier}’ は ‘$identifier’ と同じです。プレースホルダ名の後ろ
     に識別子として使える文字列が続いていて、それをプレースホルダ名の一
     部として扱いたくない場合、例えば ‘"${noun}ification"’ のような場合
     に必要な書き方です。

上記以外の書き方で文字列中に ‘$’ を使うと *note ValueError: 2ec. を送出
します。

The ‘string’ module provides a *note Template: 897. class that
implements these rules.  The methods of *note Template: 897. are:

 -- クラス: string.Template (template)

     コンストラクタはテンプレート文字列になる引数を一つだけ取ります。

      -- メソッド: substitute (mapping={}, /, **kwds)

          テンプレート置換を行い、新たな文字列を生成して返します。
          'mapping' はテンプレート中のプレースホルダに対応するキーを持つ
          ような任意の辞書類似オブジェクトです。辞書を指定する代わりに、
          キーワード引数も指定でき、その場合にはキーワードをプレースホル
          ダ名に対応させます。'mapping' と 'kwds' の両方が指定され、内容
          が重複した場合には、'kwds' に指定したプレースホルダを優先しま
          す。

      -- メソッド: safe_substitute (mapping={}, /, **kwds)

          *note substitute(): 20d5. と同じですが、プレースホルダに対応す
          るものを 'mapping' や 'kwds' から見つけられなかった場合に、
          *note KeyError: 5e7. 例外を送出する代わりにもとのプレースホル
          ダがそのまま入ります。また、 *note substitute(): 20d5. とは違
          い、規則外の書き方で ‘$’ を使った場合でも、 *note ValueError:
          2ec. を送出せず単に ‘$’ を返します。

          その他の例外も発生し得る一方で、このメソッドが「安全 (safe) 」
          と呼ばれているのは、置換操作は常に、例外を送出する代わりに利用
          可能な文字列を返そうとするからです。別の見方をすれば、 *note
          safe_substitute(): 20d6. は区切り間違いによるぶら下がり
          (dangling delimiter) や波括弧の非対応、 Python の識別子として
          無効なプレースホルダ名を含むような不正なテンプレートを何も警告
          せずに無視するため、安全とはいえないのです。

      -- メソッド: is_valid ()

          Returns ‘False’ if the template has invalid placeholders that
          will cause *note substitute(): 20d5. to raise *note
          ValueError: 2ec.

          Added in version 3.11.

      -- メソッド: get_identifiers ()

          テンプレート内の有効な識別子のリストを、その識別子が最初に現れ
          る順番で返します。不正な識別子は無視されます。

          Added in version 3.11.

     *note Template: 897. のインスタンスは、次のような public な属性を提
     供しています:

      -- の属性: template

          コンストラクタの引数 'template' に渡されたオブジェクトです。通
          常、この値を変更すべきではありませんが、読み出し専用アクセスを
          強制しているわけではありません。

Templateの使い方の例を以下に示します:

     >>> from string import Template
     >>> s = Template('$who likes $what')
     >>> s.substitute(who='tim', what='kung pao')
     'tim likes kung pao'
     >>> d = dict(who='tim')
     >>> Template('Give $who $100').substitute(d)
     Traceback (most recent call last):
     ...
     ValueError: Invalid placeholder in string: line 1, col 11
     >>> Template('$who likes $what').substitute(d)
     Traceback (most recent call last):
     ...
     KeyError: 'what'
     >>> Template('$who likes $what').safe_substitute(d)
     'tim likes $what'

さらに進んだ使い方: *note Template: 897. のサブクラスを派生して、プレー
スホルダの書式、区切り文字、テンプレート文字列の解釈に使われている正規表
現全体をカスタマイズできます。こうした作業には、以下のクラス属性をオーバ
ライドします:

   * 'delimiter' - プレースホルダの開始を示すリテラル文字列です。 デフォ
     ルトの値は ‘$’ です。 実装系はこの文字列に対して必要に応じて *note
     re.escape(): e03. を呼び出すので、正規表現になってしまうような文字
     列にしては 'なりません' 。 さらにクラスを作成した後に delimiter を
     変更できない (つまり、別の delimiter を設定したいのであれば、サブク
     ラスの名前空間で行わなければならない) ことに注意してください。

   * 'idpattern' - これは波括弧なしのプレースホルダーを記述する正規表現
     です。デフォルト値は正規表現 ‘(?a:[_a-z][_a-z0-9]*)’ です。
     'idpattern' が与えられており、かつ 'braceidpattern' が ‘None’ の場
     合、このパターンは波括弧付きのプレースホルダーにも適用されます。

          注釈: 'flags' のデフォルトは ‘re.IGNORECASE’ なので、 ‘[a-z]’
          というパターンはいくつかの非 ASCII 文字に適合できます。 そのた
          め、ここではローカルの ‘a’ フラグを使っています。

     バージョン 3.7 で変更: 'braceidpattern' を使用すると、中括弧の内側
     と外側で使用する別々のパターンを定義できます。

   * 'braceidpattern' - これは 'idpattern' に似ていますが、波括弧付きプ
     レースホルダーのパターンを記述します。デフォルトは ‘None’ で、
     'idpattern' が適用されます (すなわち、波括弧の内側と外側の両方に同
     じパターンが使われます) 。 'braceidpattern' を使うと、波括弧付きと
     波括弧なしのプレースホルダーにそれぞれ異なるパターンを定義すること
     ができます。

     Added in version 3.7.

   * 'flags' - 代入の認識のために使用される正規表現をコンパイルする際に
     適用される正規表現フラグ。デフォルト値は ‘re.IGNORECASE’ です。
     ‘re.VERBOSE’ が常にフラグに追加されるということに注意してください。
     したがって、カスタムな 'idpattern' は verbose 正規表現の規約に従わ
     なければなりません。

     Added in version 3.2.

他にも、クラス属性 'pattern' をオーバライドして、正規表現パターン全体を
指定できます。オーバライドを行う場合、 'pattern' の値は 4 つの名前つきキ
ャプチャグループ (capturing group) を持った正規表現オブジェクトでなけれ
ばなりません。これらのキャプチャグループは、上で説明した規則と、無効なプ
レースホルダに対する規則に対応しています:

   * 'escaped' - このグループはエスケープシーケンス、すなわちデフォルト
     パターンにおける ‘$$’ に対応します。

   * 'named' - このグループは波括弧でくくらないプレースホルダ名に対応し
     ます; キャプチャグループに区切り文字を含めてはなりません。

   * 'braced' - このグループは波括弧でくくったプレースホルダ名に対応しま
     す; キャプチャグループに区切り文字を含めてはなりません。

   * 'invalid' - このグループはそのほかの区切り文字のパターン (通常は区
     切り文字一つ) に対応し、正規表現の末尾に出現しなければなりません。

このクラスのメソッドは、これらの名前付きグループに1つもマッチすることな
くパターンがテンプレートにマッチした場合、 *note ValueError: 2ec. を送出
します。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0292/

   (2) https://flufli18n.readthedocs.io/en/latest/


File: python.info,  Node: ヘルパー関数,  Prev: Template strings $-strings,  Up: string --- 一般的な文字列操作

5.6.1.7 ヘルパー関数
....................

 -- の関数: string.capwords (s, sep=None)

     *note str.split(): 10aa. を使って引数を単語に分割し、 *note
     str.capitalize(): 263e. を使ってそれぞれの単語の先頭の文字を大文字
     に変換し、 *note str.join(): 2609. を使ってつなぎ合わせます。オプシ
     ョンの第2引数 'sep' が与えられないか ‘None’ の場合、この置換処理は
     文字列中の連続する空白文字をスペース一つに置き換え、先頭と末尾の空
     白を削除します、それ以外の場合には 'sep' は split と join に使われ
     ます。


File: python.info,  Node: string templatelib --- テンプレート文字列リテラルのサポート,  Next: re --- 正規表現操作,  Prev: string --- 一般的な文字列操作,  Up: テキスト処理サービス

5.6.2 ‘string.templatelib’ -- テンプレート文字列リテラルのサポート
------------------------------------------------------------------

'ソースコード:' Lib/string/templatelib.py(1)

__________________________________________________________________

参考
....

   * *note フォーマット済み文字列リテラル: 19a.

   * *note テンプレート文字列リテラル(t-string)の構文: 17fa.

   * PEP 750(2)

* Menu:

* テンプレート文字列::
* 型::
* ヘルパー関数: ヘルパー関数<2>.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/string/templatelib.py

   (2) https://peps.python.org/pep-0750/


File: python.info,  Node: テンプレート文字列,  Next: 型,  Up: string templatelib --- テンプレート文字列リテラルのサポート

5.6.2.1 テンプレート文字列
..........................

Added in version 3.14.

Template strings are a mechanism for custom string processing.  They
have the full flexibility of Python's *note f-strings: 19a, but return a
*note Template: 16a. instance that gives access to the static and
interpolated (in curly brackets) parts of a string 'before' they are
combined.

t-stringを書くには、このようにプレフィックスとして ‘'f'’ の代わりに
‘'t'’ を使用します:

     >>> pi = 3.14
     >>> t't-strings are new in Python {pi!s}!'
     Template(
        strings=('t-strings are new in Python ', '!'),
        interpolations=(Interpolation(3.14, 'pi', 's', ''),)
     )


File: python.info,  Node: 型,  Next: ヘルパー関数<2>,  Prev: テンプレート文字列,  Up: string templatelib --- テンプレート文字列リテラルのサポート

5.6.2.2 型
..........

 -- クラス: string.templatelib.Template

     The ‘Template’ class describes the contents of a template string.
     It is immutable, meaning that attributes of a template cannot be
     reassigned.

     The most common way to create a ‘Template’ instance is to use the
     *note template string literal syntax: 17fa.  This syntax is
     identical to that of *note f-strings: 19a, except that it uses a
     ‘t’ prefix in place of an ‘f’:

          >>> cheese = 'Red Leicester'
          >>> template = t"We're fresh out of {cheese}, sir."
          >>> type(template)
          <class 'string.templatelib.Template'>

     Templates are stored as sequences of literal *note strings: 2753.
     and dynamic *note interpolations: 2754.  A *note values: 2755.
     attribute holds the values of the interpolations:

          >>> cheese = 'Camembert'
          >>> template = t'Ah! We do have {cheese}.'
          >>> template.strings
          ('Ah! We do have ', '.')
          >>> template.interpolations
          (Interpolation('Camembert', ...),)
          >>> template.values
          ('Camembert',)

     The ‘strings’ tuple has one more element than ‘interpolations’ and
     ‘values’; the interpolations “belong” between the strings.  This
     may be easier to understand when tuples are aligned

          template.strings:  ('Ah! We do have ',              '.')
          template.values:   (                   'Camembert',    )

     属性
     ....

      -- の属性: strings: *note tuple: 614.[*note str: 169, ...]

          A *note tuple: 614. of the static strings in the template.

               >>> cheese = 'Camembert'
               >>> template = t'Ah! We do have {cheese}.'
               >>> template.strings
               ('Ah! We do have ', '.')

          Empty strings 'are' included in the tuple:

               >>> response = 'We do have '
               >>> cheese = 'Camembert'
               >>> template = t'Ah! {response}{cheese}.'
               >>> template.strings
               ('Ah! ', '', '.')

          The ‘strings’ tuple is never empty, and always contains one
          more string than the ‘interpolations’ and ‘values’ tuples:

               >>> t''.strings
               ('',)
               >>> t''.values
               ()
               >>> t'{'cheese'}'.strings
               ('', '')
               >>> t'{'cheese'}'.values
               ('cheese',)

      -- の属性: interpolations: *note tuple: 614.[*note Interpolation:
               16b, ...]

          A *note tuple: 614. of the interpolations in the template.

               >>> cheese = 'Camembert'
               >>> template = t'Ah! We do have {cheese}.'
               >>> template.interpolations
               (Interpolation('Camembert', 'cheese', None, ''),)

          The ‘interpolations’ tuple may be empty and always contains
          one fewer values than the ‘strings’ tuple:

               >>> t'Red Leicester'.interpolations
               ()

      -- の属性: values: *note tuple: 614.[*note object: c7e, ...]

          A tuple of all interpolated values in the template.

               >>> cheese = 'Camembert'
               >>> template = t'Ah! We do have {cheese}.'
               >>> template.values
               ('Camembert',)

          The ‘values’ tuple always has the same length as the
          ‘interpolations’ tuple.  It is always equivalent to
          ‘tuple(i.value for i in template.interpolations)’.

     メソッド
     ........

      -- メソッド: __new__ (*args: str | Interpolation)

          While literal syntax is the most common way to create a
          ‘Template’, it is also possible to create them directly using
          the constructor:

               >>> from string.templatelib import Interpolation, Template
               >>> cheese = 'Camembert'
               >>> template = Template(
               ...     'Ah! We do have ', Interpolation(cheese, 'cheese'), '.'
               ... )
               >>> list(template)
               ['Ah! We do have ', Interpolation('Camembert', 'cheese', None, ''), '.']

          If multiple strings are passed consecutively, they will be
          concatenated into a single value in the *note strings: 2753.
          attribute.  For example, the following code creates a *note
          Template: 16a. with a single final string:

               >>> from string.templatelib import Template
               >>> template = Template('Ah! We do have ', 'Camembert', '.')
               >>> template.strings
               ('Ah! We do have Camembert.',)

          If multiple interpolations are passed consecutively, they will
          be treated as separate interpolations and an empty string will
          be inserted between them.  For example, the following code
          creates a template with empty placeholders in the *note
          strings: 2753. attribute:

               >>> from string.templatelib import Interpolation, Template
               >>> template = Template(
               ...     Interpolation('Camembert', 'cheese'),
               ...     Interpolation('.', 'punctuation'),
               ... )
               >>> template.strings
               ('', '', '')

      -- Describe: iter(template)

          Iterate over the template, yielding each non-empty string and
          *note Interpolation: 16b. in the correct order:

               >>> cheese = 'Camembert'
               >>> list(t'Ah! We do have {cheese}.')
               ['Ah! We do have ', Interpolation('Camembert', 'cheese', None, ''), '.']

               注意: Empty strings are 'not' included in the iteration:

                    >>> response = 'We do have '
                    >>> cheese = 'Camembert'
                    >>> list(t'Ah! {response}{cheese}.')
                    ['Ah! ',
                     Interpolation('We do have ', 'response', None, ''),
                     Interpolation('Camembert', 'cheese', None, ''),
                     '.']

      -- Describe: template + other

      -- Describe: template += other

          Concatenate this template with another, returning a new
          ‘Template’ instance:

               >>> cheese = 'Camembert'
               >>> list(t'Ah! ' + t'We do have {cheese}.')
               ['Ah! We do have ', Interpolation('Camembert', 'cheese', None, ''), '.']

          Concatenating a ‘Template’ and a ‘str’ is 'not' supported.
          This is because it is unclear whether the string should be
          treated as a static string or an interpolation.  If you want
          to concatenate a ‘Template’ with a string, you should either
          wrap the string directly in a ‘Template’ (to treat it as a
          static string) or use an ‘Interpolation’ (to treat it as
          dynamic):

               >>> from string.templatelib import Interpolation, Template
               >>> template = t'Ah! '
               >>> # Treat 'We do have ' as a static string
               >>> template += Template('We do have ')
               >>> # Treat cheese as an interpolation
               >>> cheese = 'Camembert'
               >>> template += Template(Interpolation(cheese, 'cheese'))
               >>> list(template)
               ['Ah! We do have ', Interpolation('Camembert', 'cheese', None, '')]

 -- クラス: string.templatelib.Interpolation

     The ‘Interpolation’ type represents an expression inside a template
     string.  It is immutable, meaning that attributes of an
     interpolation cannot be reassigned.

     Interpolations support pattern matching, allowing you to match
     against their attributes with the *note match statement: a0e.:

          >>> from string.templatelib import Interpolation
          >>> interpolation = t'{1. + 2.:.2f}'.interpolations[0]
          >>> interpolation
          Interpolation(3.0, '1. + 2.', None, '.2f')
          >>> match interpolation:
          ...     case Interpolation(value, expression, conversion, format_spec):
          ...         print(value, expression, conversion, format_spec, sep=' | ')
          ...
          3.0 | 1. + 2. | None | .2f

     属性
     ....

      -- の属性: value: *note object: c7e.

          The evaluated value of the interpolation.

               >>> t'{1 + 2}'.interpolations[0].value
               3

      -- の属性: expression: *note str: 169.

          For interpolations created by t-string literals, ‘expression’
          is the expression text found inside the curly brackets (‘{’ &
          ‘}’), including any whitespace, excluding the curly brackets
          themselves, and ending before the first ‘!’, ‘:’, or ‘=’ if
          any is present.  For manually created interpolations,
          ‘expression’ is the arbitrary string provided when
          constructing the interpolation instance.

          We recommend using valid Python expressions or the empty
          string for the ‘expression’ field of manually created
          ‘Interpolation’ instances, although this is not enforced at
          runtime.

               >>> t'{1 + 2}'.interpolations[0].expression
               '1 + 2'

      -- の属性: conversion: *note Literal: a55.['a', 'r', 's'] | *note
               None: 885.

          The conversion to apply to the value, or ‘None’.

          The ‘conversion’ is the optional conversion to apply to the
          value:

               >>> t'{1 + 2!a}'.interpolations[0].conversion
               'a'

               注釈: Unlike f-strings, where conversions are applied
               automatically, the expected behavior with t-strings is
               that code that 'processes' the ‘Template’ will decide how
               to interpret and whether to apply the ‘conversion’.  For
               convenience, the *note convert(): 2759. function can be
               used to mimic f-string conversion semantics.

      -- の属性: format_spec: *note str: 169.

          The format specification to apply to the value.

          The ‘format_spec’ is an optional, arbitrary string used as the
          format specification to present the value:

               >>> t'{1 + 2:.2f}'.interpolations[0].format_spec
               '.2f'

               注釈: Unlike f-strings, where format specifications are
               applied automatically via the *note format(): 199.
               protocol, the expected behavior with t-strings is that
               code that 'processes' the interpolation will decide how
               to interpret and whether to apply the format
               specification.  As a result, ‘format_spec’ values in
               interpolations can be arbitrary strings, including those
               that do not conform to the *note format(): 199. protocol.

     メソッド
     ........

      -- メソッド: __new__ (value: object, expression: str, conversion:
               Literal['a', 'r', 's'] | None = None, format_spec: str =
               '')

          Create a new ‘Interpolation’ object from component parts.


          パラメータ:

             * ‘value’ - The evaluated, in-scope result of the
               interpolation.

             * ‘expression’ - The text of a valid Python expression, or
               an empty string.

             * ‘conversion’ - The *note conversion: 15b3. to be used,
               one of ‘None’, ‘'a'’, ‘'r'’, or ‘'s'’.

             * ‘format_spec’ - An optional, arbitrary string used as the
               *note format specification: 4f9. to present the value.


File: python.info,  Node: ヘルパー関数<2>,  Prev: 型,  Up: string templatelib --- テンプレート文字列リテラルのサポート

5.6.2.3 ヘルパー関数
....................

 -- の関数: string.templatelib.convert (obj, /, conversion)

     Applies formatted string literal *note conversion: 2739. semantics
     to the given object 'obj'.  This is frequently useful for custom
     template string processing logic.

     Three conversion flags are currently supported:

        * ‘'s'’ which calls *note str(): 169. on the value (like ‘!s’),

        * ‘'r'’ which calls *note repr(): 1c1. (like ‘!r’), and

        * ‘'a'’ which calls *note ascii(): 15ff. (like ‘!a’).

     If the conversion flag is ‘None’, 'obj' is returned unchanged.


File: python.info,  Node: re --- 正規表現操作,  Next: difflib --- 差分の計算の補助,  Prev: string templatelib --- テンプレート文字列リテラルのサポート,  Up: テキスト処理サービス

5.6.3 ‘re’ -- 正規表現操作
--------------------------

'ソースコード:' Lib/re/(1)

__________________________________________________________________

このモジュールは Perl に見られる正規表現マッチング操作と同様のものを提供
します。

パターンおよび検索される文字列には、Unicode 文字列 (*note str: 169.) や
8 ビット文字列 (*note bytes: 192.) を使います。ただし、Unicode 文字列と
8 ビット文字列の混在はできません。つまり、Unicode 文字列にバイト列のパタ
ーンでマッチングしたり、その逆はできません。同様に、置換時の置換文字列は
パターンおよび検索文字列の両方と同じ型でなくてはなりません。

正規表現では、特殊な形式を表すためや、特殊文字をその特殊な意味を発動させ
ず使うために、バックスラッシュ文字 (‘'\'’) を使います。こうしたバックス
ラッシュの使い方は、 Python の文字列リテラルにおける同じ文字の使い方と衝
突します。例えば、リテラルのバックスラッシュにマッチさせるには、パターン
文字列として ‘'\\\\'’ と書かなければなりません。なぜなら、正規表現は
‘\\’ でなければならないうえ、それぞれのバックスラッシュは標準の Python 文
字列リテラルで ‘\\’ と表現せねばならないからです。 Python の文字列リテラ
ルにおいて、バックスラッシュの使用による不正なエスケープ文字がある場合は
、*note SyntaxWarning: 1ae. が発生し、将来的には *note SyntaxError: 18e.
になることにも注意してください。この動作は、正規表現として有効な文字列に
対しても同様です。

これを解決するには、正規表現パターンに Python の raw 文字列記法を使いま
す。 ‘'r'’ を前置した文字列リテラル内ではバックスラッシュが特別扱いされ
ません。従って ‘"\n"’ が改行一文字からなる文字列であるのに対して、
‘r"\n"’ は ‘'\'’ と ‘'n'’ の二文字からなる文字列です。通常、 Python コー
ド中では、パターンをこの raw 文字列記法を使って表現します。

重要なこととして、大抵の正規表現操作は、モジュールレベルの関数としても、
*note コンパイル済み正規表現: 1189. のメソッドとしても利用できます。関数
は正規表現オブジェクトを前もってコンパイルする必要がない近道ですが、微調
整のための変数が減ります。

参考
....

The third-party regex(2) module, which has an API compatible with the
standard library ‘re’ module, but offers additional functionality and a
more thorough Unicode support.

* Menu:

* 正規表現のシンタックス::
* モジュールコンテンツ::
* 正規表現オブジェクト::
* マッチオブジェクト::
* 正規表現の例::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/re/

   (2) https://pypi.org/project/regex/


File: python.info,  Node: 正規表現のシンタックス,  Next: モジュールコンテンツ,  Up: re --- 正規表現操作

5.6.3.1 正規表現のシンタックス
..............................

正規表現 (または RE) は、その表現にマッチ (match) する文字列の集合を指定
します。このモジュールの関数を使えば、ある文字列が与えられた正規表現にマ
ッチするか (または、与えられた正規表現がある文字列にマッチするか、と言い
換えても同じことになります) を検査できます。

正規表現を連結することで新しい正規表現を作れます。'A' と 'B' がともに正
規表現であれば 'AB' も正規表現です。一般的に、ある文字列 'p' が 'A' にマ
ッチし、別の文字列 'q' が 'B' にマッチするなら、文字列 'pq' は AB にマッ
チします。ただし、 'A' または 'B' に優先度の低い演算が含まれる場合や、
'A' と 'B' との間に境界条件がある場合や、番号付けされたグループ参照をし
ている場合、を除きます。こうして、ここで述べるような簡単な基本表現から、
複雑な表現を容易に構築できます。正規表現に関する理論と実装の詳細について
は Friedl 本 *note [Frie09]: 2761. か、コンパイラの構築に関するテキスト
を参照してください。

以下で正規表現の形式を簡単に説明します。詳細な情報ややさしい説明は、
*note 正規表現 HOWTO: 2762. を参照してください。

正規表現には、特殊文字と通常文字の両方を含められます。 ‘'A'’ 、 ‘'a'’ 、
または ‘'0'’ のようなほとんどの通常文字は、最も単純な正規表現です。これ
は単純に、その文字自体にマッチします。通常文字は連結できるので、 ‘last’
は文字列 ‘'last'’ にマッチします。 (この節では以降、正規表現は一般にクオ
ートを使わず ‘この特殊スタイルで’ 表記し、マッチ対象の文字列は、 ‘'シン
グルクオートで括って'’ 表記します。)

‘'|'’ や ‘'('’ といったいくつかの文字は特殊です。特殊文字は通常文字の種
別を表したり、周辺の通常文字に対する解釈方法に影響します。

繰り返しの演算子または修飾子 (‘*’、 ‘+’、 ‘?’、 ‘{m,n}’ など) は直接入れ
子にはできません。これは、非貪欲な修飾子の接尾辞 ‘?’ や他の実装での他の
修飾子との曖昧さを回避します。内側で繰り返したものをさらに繰り返すには、
丸括弧が使えます。例えば、正規表現 ‘(?:a{6})*’ は 6 の倍数個の ‘'a'’ 文
字にマッチします。

特殊文字を以下に示します:

‘.’

     (ドット) デフォルトのモードでは改行以外の任意の文字にマッチします。
     *note DOTALL: 2763. フラグが指定されていれば改行も含む全ての文字に
     マッチします。‘(?s:.)’ はフラグにかかわらず全ての文字にマッチします
     。

‘^’

     (キャレット) 文字列の先頭にマッチし、 *note MULTILINE: 2764. モード
     では各改行の直後にもマッチします。

‘$’

     文字列の末尾、あるいは文字列の末尾の改行の直前にマッチし、 *note
     MULTILINE: 2764. モードでは改行の前にもマッチします。 ‘foo’ は
     'foo' と 'foobar' の両方にマッチしますが、正規表現 ‘foo$’ は 'foo'
     だけにマッチします。興味深いことに、 ‘'foo1\nfoo2\n'’ を ‘foo.$’ で
     検索した場合、通常は 'foo2' だけにマッチしますが、 *note MULTILINE:
     2764. モードでは 'foo1' にもマッチします。 ‘$’ だけで ‘'foo\n'’ を
     検索した場合、2 つの (空の) マッチを見つけます: 1つは改行の直前で、
     もう1つは文字列の末尾です。

‘*’

     直前の正規表現を 0 回以上、できるだけ多く繰り返したものにマッチさせ
     る結果の正規表現にします。例えば ‘ab*’ は 'a'、'ab'、または 'a' に
     任意個数の 'b' を続けたものにマッチします。

‘+’

     直前の正規表現を 1 回以上繰り返したものにマッチさせる結果の正規表現
     にします。例えば ‘ab+’ は 'a' に 1 つ以上の 'b' が続いたものにマッ
     チし、単なる 'a' にはマッチしません。

‘?’

     直前の正規表現を 0 回か 1 回繰り返したものにマッチさせる結果の正規
     表現にします。例えば ‘ab?’ は 'a' あるいは 'ab' にマッチします。

‘*?’, ‘+?’, ‘??’

     ‘'*'’ 、 ‘'+'’ 、および ‘'?'’ 修飾子は全て '貪欲 (greedy)' マッチで
     、できるだけ多くのテキストにマッチします。この挙動が望ましくない時
     もあります。例えば正規表現 ‘<.*>’ が ‘'<a> b <c>'’ に対してマッチさ
     れると、 ‘'<a>'’ だけでなく文字列全体にマッチしてしまいます。修飾子
     の後に ‘?’ を追加すると、 '非貪欲 (non-greedy)' あるいは '最小
     (minimal)' のマッチが行われ、できるだけ '少ない' 文字にマッチします
     。正規表現 ‘<.*?>’ を使うと ‘'<a>'’ だけにマッチします。

‘*+’, ‘++’, ‘?+’

     Like the ‘'*'’, ‘'+'’, and ‘'?'’ quantifiers, those where ‘'+'’ is
     appended also match as many times as possible.  However, unlike the
     true greedy quantifiers, these do not allow back-tracking when the
     expression following it fails to match.  These are known as
     'possessive' quantifiers.  For example, ‘a*a’ will match ‘'aaaa'’
     because the ‘a*’ will match all 4 ‘'a'’s, but, when the final ‘'a'’
     is encountered, the expression is backtracked so that in the end
     the ‘a*’ ends up matching 3 ‘'a'’s total, and the fourth ‘'a'’ is
     matched by the final ‘'a'’.  However, when ‘a*+a’ is used to match
     ‘'aaaa'’, the ‘a*+’ will match all 4 ‘'a'’, but when the final
     ‘'a'’ fails to find any more characters to match, the expression
     cannot be backtracked and will thus fail to match.  ‘x*+’, ‘x++’
     and ‘x?+’ are equivalent to ‘(?>x*)’, ‘(?>x+)’ and ‘(?>x?)’
     correspondingly.

     Added in version 3.11.

‘{m}’

     直前の正規表現をちょうど 'm' 回繰り返したものにマッチさせるよう指定
     します。それより少ないマッチでは正規表現全体がマッチしません。例え
     ば、 ‘a{6}’ は 6 個ちょうどの ‘'a'’ 文字にマッチしますが、 5 個では
     マッチしません。

‘{m,n}’

     直前の正規表現を 'm' 回から 'n' 回、できるだけ多く繰り返したものに
     マッチさせる結果の正規表現にします。例えば、‘a{3,5}’ は、3 個から 5
     個の ‘'a'’ 文字にマッチします。'm' を省略すると下限は 0 に指定され
     、'n' を省略すると上限は無限に指定されます。例として、 ‘a{4,}b’ は
     ‘'aaaab'’ や、1,000 個の ‘'a'’ 文字に ‘'b'’ が続いたものにマッチし
     ますが、‘'aaab'’ にはマッチしません。コンマは省略できません、省略す
     ると修飾子が上で述べた形式と混同されてしまうからです。

‘{m,n}?’

     結果の正規表現は、前にある正規表現を、'm' 回から 'n' 回まで繰り返し
     たものにマッチし、できるだけ '少なく' 繰り返したものにマッチするよ
     うにします。これは、前の数量詞の非貪欲版です。例えば、 6 文字文字列
     ‘'aaaaaa'’ では、 ‘a{3,5}’ は、5 個の ‘'a'’ 文字にマッチしますが、
     ‘a{3,5}?’ は 3 個の文字にマッチするだけです。

‘{m,n}+’

     Causes the resulting RE to match from 'm' to 'n' repetitions of the
     preceding RE, attempting to match as many repetitions as possible
     'without' establishing any backtracking points.  This is the
     possessive version of the quantifier above.  For example, on the
     6-character string ‘'aaaaaa'’, ‘a{3,5}+aa’ attempt to match 5 ‘'a'’
     characters, then, requiring 2 more ‘'a'’s, will need more
     characters than available and thus fail, while ‘a{3,5}aa’ will
     match with ‘a{3,5}’ capturing 5, then 4 ‘'a'’s by backtracking and
     then the final 2 ‘'a'’s are matched by the final ‘aa’ in the
     pattern.  ‘x{m,n}+’ is equivalent to ‘(?>x{m,n})’.

     Added in version 3.11.

‘\’

     特殊文字をエスケープ ( ‘'*'’ や ‘'?'’ などの文字にマッチできるよう
     にする) し、または特殊シーケンスを合図します。特殊シーケンスは後で
     議論します。

     パターンを表現するのに raw 文字列を使っていないのであれば、 Python
     ももまた、バックスラッシュを文字列リテラルでエスケープシーケンスと
     して使うことを思い出して下さい。そのエスケープシーケンスを Python の
     パーザが認識しないなら、そのバックスラッシュとそれに続く文字が結果
     の文字列に含まれます。しかし、Python が結果のシーケンスを認識するな
     ら、そのバックスラッシュは 2 回繰り返さなければいけません。これは複
     雑で理解しにくいので、ごく単純な表現以外は、全て raw 文字列を使うこ
     とを強く推奨します。

‘[]’

     文字の集合を指定するのに使います。集合の中では:

        * 文字を個別に指定できます。 ‘[amk]’ は ‘'a'’ 、 ‘'m'’ または
          ‘'k'’ にマッチします。

        * 連続した文字の範囲を、 ‘'-'’ を2 つの文字で挟んで指定できます
          。例えば、 ‘[a-z]’ はあらゆる小文字の ASCII 文字にマッチします
          。‘[0-5][0-9]’ は ‘00’ から ‘59’ まで全ての 2 桁の数字にマッチ
          します。‘[0-9A-Fa-f]’ は任意の 16 進数字にマッチします。‘-’ が
          エスケープされているか (例: ‘[a\-z]’)、先頭や末尾の文字にされ
          ていると (例: ‘[-a]’ や ‘[a-]’)、リテラル ‘'-'’ にマッチします
          。

        * Special characters except backslash lose their special meaning
          inside sets.  For example, ‘[(+*)]’ will match any of the
          literal characters ‘'('’, ‘'+'’, ‘'*'’, or ‘')'’.

        * Backslash either escapes characters which have special meaning
          in a set such as ‘'-'’, ‘']'’, ‘'^'’ and ‘'\\'’ itself or
          signals a special sequence which represents a single character
          such as ‘\xa0’ or ‘\n’ or a character class such as ‘\w’ or
          ‘\S’ (defined below).  Note that ‘\b’ represents a single
          "backspace" character, not a word boundary as outside a set,
          and numeric escapes such as ‘\1’ are always octal escapes, not
          group references.  Special sequences which do not match a
          single character such as ‘\A’ and ‘\z’ are not allowed.

        * '補集合' をとって範囲内にない文字にマッチできます。集合の最初
          の文字が ‘'^'’ なら、集合に '含まれない' 全ての文字にマッチし
          ます。例えば、 ‘[^5]’ は ‘'5'’ を除くあらゆる文字にマッチし、
          ‘[^^]’ は ‘'^'’ を除くあらゆる文字にマッチします。 ‘^’ は集合
          の最初の文字でなければ特別の意味を持ちません。

        * 集合の中でリテラル ‘']'’ にマッチさせるには、その前にバックス
          ラッシュをつけるか、集合の先頭に置きます。例えば、 ‘[()[\]{}]’
          と ‘[]()[{}]’ はどちらも閉じ角括弧、開き角括弧、波括弧、丸括弧
          にマッチします。

        * Unicode Technical Standard #18(1) にあるような集合の入れ子や集
          合操作が将来追加される可能性があります。これは構文を変化させる
          もので、この変化を容易にするために、さしあたって曖昧な事例には
          *note FutureWarning: 659. が送出されます。これはリテラル ‘'['’
          で始まる集合や、リテラル文字の連続 ‘'--'’ 、 ‘'&&'’ 、 ‘'~~'’
          および ‘'||'’ を含む集合を含みます。警告を避けるにはバックスラ
          ッシュでエスケープしてください。

     バージョン 3.7 で変更: 文字セットが将来意味論的に変化する構造を含む
     なら *note FutureWarning: 659. が送出されます。

‘|’

     'A' と 'B' を任意の正規表現として、 ‘A|B’ は 'A' と 'B' のいずれか
     にマッチする正規表現を作成します。この方法で任意の数の正規表現を
     ‘'|'’ で分離できます。これはグループ (下記参照) 中でも使えます。対
     象文字列を走査するとき、‘'|'’ で分離された正規表現は左から右へ順に
     試されます。一つのパターンが完全にマッチしたとき、そのパターン枝が
     受理されます。つまり、ひとたび 'A' がマッチしてしまえば、例え 'B' に
     よって全体のマッチが長くなるとしても、 'B' はもはや走査されません。
     言いかえると、 ‘'|'’ 演算子は決して貪欲にはなりません。リテラル
     ‘'|'’ にマッチするには、 ‘\|’ を使うか、 ‘[|]’ のように文字クラス中
     に囲みます。

‘(...)’

     丸括弧で囲まれた正規表現にマッチするとともに、グループの開始と終了
     を表します。グループの中身は以下で述べるように、マッチが実行された
     後で回収したり、その文字列中で以降 ‘\number’ 特殊シーケンスでマッチ
     したりできます。リテラル ‘'('’ や ‘')'’ にマッチするには、‘\(’ や
     ‘\)’ を使うか、文字クラス中に囲みます: ‘[(]’、 ‘[)]’ 。

‘(?...)’

     これは拡張記法です (‘'('’ に続く ‘'?'’ はそれ以上の意味を持ちません
     ) 。 ‘'?'’ に続く最初の文字がこの構造の意味と特有の構文を決定します
     。拡張は一般に新しいグループを作成しません。ただし ‘(?P<name>...)’
     はこの法則の唯一の例外です。現在サポートされている拡張は以下の通り
     です。

‘(?aiLmsux)’

     (One or more letters from the set ‘'a'’, ‘'i'’, ‘'L'’, ‘'m'’,
     ‘'s'’, ‘'u'’, ‘'x'’.)  The group matches the empty string; the
     letters set the corresponding flags for the entire regular
     expression:

        * *note re.A: 2765. (ASCIIのみにマッチ)

        * *note re.I: 2766. (大文字小文字を無視)

        * *note re.L: 2767. (ロケール依存)

        * *note re.M: 2768. (マルチライン)

        * *note re.S: 2769. (ドットはすべてにマッチ)

        * *note re.U: 276a. (Unicodeマッチ)

        * *note re.X: 276b. (冗長)

     (The flags are described in *note モジュールコンテンツ: 276c.)
     This is useful if you wish to include the flags as part of the
     regular expression, instead of passing a 'flag' argument to the
     *note re.compile(): dce. function.  Flags should be used first in
     the expression string.

     バージョン 3.11 で変更: This construction can only be used at the
     start of the expression.

‘(?:...)’

     普通の丸括弧の、キャプチャしない版です。丸括弧で囲まれた正規表現に
     マッチしますが、このグループがマッチした部分文字列は、マッチを実行
     したあとで回収することも、そのパターン中で以降参照することも 'でき
     ません' 。

‘(?aiLmsux-imsx:...)’

     (Zero or more letters from the set ‘'a'’, ‘'i'’, ‘'L'’, ‘'m'’,
     ‘'s'’, ‘'u'’, ‘'x'’, optionally followed by ‘'-'’ followed by one
     or more letters from the ‘'i'’, ‘'m'’, ‘'s'’, ‘'x'’.)  The letters
     set or remove the corresponding flags for the part of the
     expression:

        * *note re.A: 2765. (ASCIIのみにマッチ)

        * *note re.I: 2766. (大文字小文字を無視)

        * *note re.L: 2767. (ロケール依存)

        * *note re.M: 2768. (マルチライン)

        * *note re.S: 2769. (ドットはすべてにマッチ)

        * *note re.U: 276a. (Unicodeマッチ)

        * *note re.X: 276b. (冗長)

     (The flags are described in *note モジュールコンテンツ: 276c.)

     文字 ‘'a'’ 、 ‘'L'’ および ‘'u'’ は相互に排他であり、組み合わせるこ
     とも ‘'-'’ に続けることもできません。その代わり、これらの内一つがイ
     ンライングループ中に現れると、外側のグループでのマッチングモードを
     上書きします。 Unicode パターン中では ‘(?a:...)’ は ASCII 限定マッ
     チングに切り替え、 ‘(?u:...)’ は Unicode マッチング (デフォルト) に
     切り替えます。バイト列パターン中では、 ‘(?L:...)’ はロケール依存マ
     ッチングに切り替え、 ‘(?a:...)’ は ASCII 限定マッチング (デフォルト
     ) に切り替えます。この上書きは狭いインライングループにのみ影響し、
     元のマッチングモードはグループ外では復元されます。

     Added in version 3.6.

     バージョン 3.7 で変更: 文字 ‘'a'’ 、 ‘'L'’ および ‘'u'’ もグループ
     中で使えます。

‘(?>...)’

     Attempts to match ‘...’ as if it was a separate regular expression,
     and if successful, continues to match the rest of the pattern
     following it.  If the subsequent pattern fails to match, the stack
     can only be unwound to a point 'before' the ‘(?>...)’ because once
     exited, the expression, known as an 'atomic group', has thrown away
     all stack points within itself.  Thus, ‘(?>.*).’ would never match
     anything because first the ‘.*’ would match all characters
     possible, then, having nothing left to match, the final ‘.’ would
     fail to match.  Since there are no stack points saved in the Atomic
     Group, and there is no stack point before it, the entire expression
     would thus fail to match.

     Added in version 3.11.

‘(?P<name>...)’

     通常の丸括弧に似ていますが、このグループがマッチした部分文字列はシ
     ンボリックグループ名 'name' でアクセスできます。グループ名は有効な
     Python 識別子でなければならず、*note bytes: 192. パターンでは
     ASCIIの範囲のバイトのみを含めることができます。各グループ名は 1 個
     の正規表現内で一度だけ定義されていなければなりません。シンボリック
     グループは、そのグループが名前付けされていなかったかのように番号付
     けされたグループでもあります。

     名前付きグループは 3 つのコンテキストで参照できます。パターンが
     ‘(?P<quote>['\"]).*?(?P=quote)’ (シングルまたはダブルクオートで囲ま
     れた文字列にマッチ) ならば:

     グループ "quote" を参照するコンテキスト     参照する方法
                                                 
     -----------------------------------------------------------------------------------
                                                 
     その同じパターン中                             * ‘(?P=quote)’ (示したとおり)
                                                 
                                                    * ‘\1’
                                                 
                                                 
     マッチオブジェクト 'm' の処理時                * ‘m.group('quote')’
                                                 
                                                    * ‘m.end('quote')’ (など)
                                                 
                                                 
     ‘re.sub()’ の 'repl' 引数へ渡される文字列      * ‘\g<quote>’
     中                                          
                                                    * ‘\g<1>’
                                                 
                                                    * ‘\1’
                                                 

     バージョン 3.12 で変更: *note bytes: 192. パターンではグループの '名
     前' にASCIIの範囲(‘b'\x00'’-‘b'\x7f'’)のバイトのみを含めることがで
     きます。

‘(?P=name)’

     名前付きグループへの後方参照です。これは 'name' という名前の既出の
     グループがマッチした文字列にマッチします。

‘(?#...)’

     コメントです。括弧の中身は単純に無視されます。

‘(?=...)’

     ‘...’ が次に続くものにマッチすればマッチしますが、文字列をまったく
     消費しません。これは '先読みアサーション (lookahead assertion)' と
     呼ばれます。例えば、‘Isaac (?=Asimov)’ は ‘'Isaac '’ に、その後に
     ‘'Asimov'’ が続く場合にのみ、マッチします。

‘(?!...)’

     ‘...’ が次に続くものにマッチしなければマッチします。これは '否定先
     読みアサーション (negative lookahead assertion)' です。例えば、
     ‘Isaac (?!Asimov)’ は ‘'Isaac '’ に、その後に ‘'Asimov'’ が続か 'な
     い' 場合にのみ、マッチします。

‘(?<=...)’

     その文字列における現在位置の前に、現在位置で終わる ‘...’ とのマッチ
     があれば、マッチします。これは '後読みアサーション' と呼ばれます。
     ‘(?<=abc)def’ は、後読みは 3 文字をバックアップし、含まれているパタ
     ーンがマッチするか検査するので ‘'abcdef'’ にマッチを見つけます。含
     まれるパターンは、固定長の文字列にのみマッチしなければなりません。
     すなわち、 ‘abc’ や ‘a|b’ は許されますが、‘a*’ や ‘a{3,4}’ は許され
     ません。肯定後読みアサーションで始まるパターンは、検索される文字列
     の先頭とは決してマッチしないことに注意して下さい。*note match():
     1445. 関数ではなく *note search(): 1444. 関数を使う方が望ましいでし
     ょう:

          >>> import re
          >>> m = re.search('(?<=abc)def', 'abcdef')
          >>> m.group(0)
          'def'

     この例ではハイフンに続く単語を探します:

          >>> m = re.search(r'(?<=-)\w+', 'spam-egg')
          >>> m.group(0)
          'egg'

     バージョン 3.5 で変更: 固定長のグループ参照をサポートするようになり
     ました。

‘(?<!...)’

     その文字列における現在位置の前に ‘...’ とのマッチがなければ、マッチ
     します。これは '否定後読みアサーション(negative lookbehind
     assertion)' と呼ばれます。肯定後読みアサーションと同様に、含まれる
     パターンは固定長の文字列にのみマッチしなければなりません。否定後読
     みアサーションで始まるパターンは検索される文字列の先頭でマッチでき
     ます。

‘(?(id/name)yes-pattern|no-pattern)’

     与えられた 'id' や 'name' のグループが存在すれば ‘yes-pattern’ との
     、存在しなければ ‘no-pattern’ とのマッチを試みます。‘no-pattern’ は
     オプションであり省略できます。例えば、
     ‘(<)?(\w+@\w+(?:\.\w+)+)(?(1)>|$)’ は貧弱な E-mail マッチングパター
     ンで、‘'<user@host.com>'’ や ‘'user@host.com'’ にはマッチしますが、
     ‘'<user@host.com'’ や ‘'user@host.com>'’ にはマッチしません。

     バージョン 3.12 で変更: グループ 'id' にはASCIIの数字のみを含めるこ
     とができます。*note bytes: 192. パターンではグループの '名前' に
     ASCIIの範囲(‘b'\x00'’-‘b'\x7f'’)のバイトのみを含めることができます
     。

特殊シーケンスは ‘'\'’ と以下のリストの文字から構成されます。通常文字が
ASCII 数字でも ASCII 文字でもなければ、結果の正規表現は 2 番目の文字にマ
ッチします。例えば、‘\$’ は文字 ‘'$'’ にマッチします。

‘\number’

     同じ番号のグループの中身にマッチします。グループは 1 から始まる番号
     をつけられます。例えば、 ‘(.+) \1’ は、 ‘'the the'’ あるいは ‘'55
     55'’ にマッチしますが、 ‘'thethe'’ にはマッチしません(グループの後
     のスペースに注意して下さい)。この特殊シーケンスは最初の 99 グループ
     のうちの一つとのマッチにのみ使えます。 'number' の最初の桁が 0 であ
     るか、 'number' が 3 桁の 8 進数であれば、それはグループのマッチと
     してではなく、 8 進値 'number' を持つ文字として解釈されます。文字ク
     ラスの ‘'['’ と ‘']'’ の間では全ての数値エスケープが文字として扱わ
     れます。

‘\A’

     文字列の先頭でのみマッチします。

‘\b’

     空文字列にマッチしますが、単語の先頭か末尾でのみです。単語は単語文
     字の並びとして定義されます。形式的には、 ‘\b’ は ‘\w’ と ‘\W’ 文字
     (またはその逆) との、あるいは ‘\w’ と文字列の先頭・末尾との境界とし
     て定義されます。例えば、 ‘r'\bat\b'’ は ‘'at'’ 、 ‘'at.'’、
     ‘'(at)'’ や ‘'as at ay'’ にはマッチしますが、 ‘'attempt'’ や
     ‘'atlas'’ にはマッチしません。

     The default word characters in Unicode (str) patterns are Unicode
     alphanumerics and the underscore, but this can be changed by using
     the *note ASCII: 83e. flag.  Word boundaries are determined by the
     current locale if the *note LOCALE: d63. flag is used.

          注釈: Inside a character range, ‘\b’ represents the backspace
          character, for compatibility with Python's string literals.

‘\B’

     空文字列にマッチしますが、それが単語の先頭か末尾 'でない' ときのみ
     です。つまり ‘r'at\B'’ は ‘'athens'’、 ‘'atom'’、‘'attorney'’ にマ
     ッチしますが、 ‘'at'’、 ‘'at.'’ や ‘'at!'’ にはマッチしません。
     ‘\B’ は ‘\b’ のちょうど反対で、 Unicode パターンにおける単語文字は
     Unicode 英数字およびアンダースコアですが、 これは *note ASCII: 83e.
     フラグを使って変更できます。 *note LOCALE: d63. フラグが使われてい
     るなら単語の境界は現在のロケールによって決定されます。

     バージョン 3.14 で変更: ‘\B’ now matches empty input string.

‘\d’

     Unicode (str) パターンでは:

          任意の Unicode 10 進数字 (Unicode 文字カテゴリ [Nd](2))にマッ
          チします。これは ‘[0-9]’ とその他多数の数字を含みます。

          *note ASCII: 83e. フラグを使用すると ‘[0-9]’ にマッチします。

     8 ビット (bytes) パターンでは:

          任意のASCII文字の 10 進数字にマッチします。これは ‘[0-9]’ と等
          価です。

‘\D’

     Matches any character which is not a decimal digit.  This is the
     opposite of ‘\d’.

     *note ASCII: 83e. フラグを使用すると ‘[^0-9]’ にマッチします。

‘\s’

     Unicode (str) パターンでは:

          Matches Unicode whitespace characters (as defined by *note
          str.isspace(): 2639.).  This includes ‘[ \t\n\r\f\v]’, and
          also many other characters, for example the non-breaking
          spaces mandated by typography rules in many languages.

          *note ASCII: 83e. フラグを使用すると ‘[ \t\n\r\f\v]’ にマッチ
          します。

     8 ビット (bytes) パターンでは:

          ASCII 文字セットで空白文字と見なされる文字にマッチします。これ
          は ‘[ \t\n\r\f\v]’ と等価です。

‘\S’

     Matches any character which is not a whitespace character.  This is
     the opposite of ‘\s’.

     *note ASCII: 83e. フラグを使用すると ‘[^ \t\n\r\f\v]’ にマッチしま
     す。

‘\w’

     Unicode (str) パターンでは:

          Matches Unicode word characters; this includes all Unicode
          alphanumeric characters (as defined by *note str.isalnum():
          2631.), as well as the underscore (‘_’).

          *note ASCII: 83e. フラグを使用すると ‘[a-zA-Z0-9_]’ にマッチし
          ます。

     8 ビット (bytes) パターンでは:

          ASCII 文字セットで英数字と見なされる文字にマッチします。これは
          ‘[a-zA-Z0-9_]’ と等価です。*note LOCALE: d63. フラグが使われて
          いるなら、現在のロケールで英数字と見なされる文字およびアンダー
          スコアにマッチします。

‘\W’

     Matches any character which is not a word character.  This is the
     opposite of ‘\w’.  By default, matches non-underscore (‘_’)
     characters for which *note str.isalnum(): 2631. returns ‘False’.

     *note ASCII: 83e. フラグを使用すると ‘[^a-zA-Z0-9_]’ にマッチします
     。

     If the *note LOCALE: d63. flag is used, matches characters which
     are neither alphanumeric in the current locale nor the underscore.

‘\z’

     文字列の末尾でのみマッチします。

     Added in version 3.14.

‘\Z’

     The same as ‘\z’.  For compatibility with old Python versions.

Python 文字列リテラルでサポートされている *note エスケープシーケンス:
687. のほとんども正規表現パーザで受理されます:

     \a      \b      \f      \n
     \N      \r      \t      \u
     \U      \v      \x      \\

(‘\b’ は単語の境界を表すのに使われ、文字クラス中でのみ "後退
(backspace)" 文字を意味することに注意してください。)

‘'\u'’、‘'\U'’ および ‘'\N'’ エスケープシーケンスは、Unicode (str)パター
ン内でのみ認識されます。バイト列ではエラーとなります。ASCII 文字のエスケ
ープで未知のものは将来使うために予約されていて、エラーとして扱われます。

8 進エスケープは限られた形式でのみ含まれます。その最初の桁が 0 であるか
、それが 3 桁の 8 進数であるならば、それは 8 進エスケープと見なされます
。そうでなければ、それはグループ参照です。文字列リテラルでは、8 進エスケ
ープは常にたかだか 3 桁長です。

バージョン 3.3 で変更: ‘'\u'’ と ‘'\U'’ エスケープシーケンスが追加されま
した。

バージョン 3.6 で変更: ‘'\'’ と ASCII 文字からなる未知のエスケープはエラ
ーになります。

バージョン 3.8 で変更: ‘'\N{NAME}'’ エスケープシーケンスが追加されました
。文字列リテラルでは、同名のUnicode 文字に展開されます。(‘'\N{EM DASH}'’
など)

   ---------- Footnotes ----------

   (1) https://unicode.org/reports/tr18/

   (2) https://www.unicode.org/versions/Unicode15.0.0/ch04.pdf#G134153


File: python.info,  Node: モジュールコンテンツ,  Next: 正規表現オブジェクト,  Prev: 正規表現のシンタックス,  Up: re --- 正規表現操作

5.6.3.2 モジュールコンテンツ
............................

このモジュールはいくつかの関数、定数、例外を定義します。このうちいくつか
の関数は、コンパイル済み正規表現がそなえる完全な機能のメソッドを簡易にし
たものです。些細なものを除くほとんどのアプリケーションは常にコンパイル済
み形式を使います。

* Menu:

* フラグ::
* 関数: 関数<2>.
* 例外: 例外<3>.


File: python.info,  Node: フラグ,  Next: 関数<2>,  Up: モジュールコンテンツ

5.6.3.3 フラグ
..............

バージョン 3.6 で変更: フラグ定数は、*note enum.IntFlag: e9a. のサブクラ
スである *note RegexFlag: 83f. のインスタンスになりました。

 -- クラス: re.RegexFlag

     An *note enum.IntFlag: e9a. class containing the regex options
     listed below.

     Added in version 3.11: - added to ‘__all__’

 -- データ: re.A
 -- データ: re.ASCII

     ‘\w’、‘\W’、‘\b’、‘\B’、‘\d’、‘\D’、‘\s’、および ‘\S’ において、
     ASCII 文字のみでマッチングを行います。これは Unicode(str) パターン
     でのみ意味があり、バイト列パターンでは無視されます。

     インラインフラグの ‘(?a)’ に相当します。

          注釈: The *note U: 276a. flag still exists for backward
          compatibility, but is redundant in Python 3 since matches are
          Unicode by default for ‘str’ patterns, and Unicode matching
          isn't allowed for bytes patterns.  *note UNICODE: d64. and the
          inline flag ‘(?u)’ are similarly redundant.

 -- データ: re.DEBUG

     コンパイルした表現に関するデバッグ情報を出力します。

     対応するインラインフラグはありません。

 -- データ: re.I
 -- データ: re.IGNORECASE

     Perform case-insensitive matching; expressions like ‘[A-Z]’ will
     also match lowercase letters.  Full Unicode matching (such as ‘Ü’
     matching ‘ü’) also works unless the *note ASCII: 83e. flag is used
     to disable non-ASCII matches.  The current locale does not change
     the effect of this flag unless the *note LOCALE: d63. flag is also
     used.

     インラインフラグの ‘(?i)’ に相当します。

     Unicode パターン ‘[a-z]’ または ‘[A-Z]’ が *note IGNORECASE: 1a96.
     フラグとあわせて使われたとき、52 の ASCII 文字に加えて 4 の非 ASCII
     文字 'İ' (U+0130, Latin capital letter I with dot above) 、 'ı'
     (U+0131, Latin small letter dotless i) 、 'ſ' (U+017F, Latin small
     letter long s) および 'K' (U+212A, Kelvin sign) にマッチすることに
     注意してください。 *note ASCII: 83e. フラグが使われているなら、文字
     'a' から 'z' および 'A' から 'Z' にのみマッチします。

 -- データ: re.L
 -- データ: re.LOCALE

     Make ‘\w’, ‘\W’, ‘\b’, ‘\B’ and case-insensitive matching dependent
     on the current locale.  This flag can be used only with bytes
     patterns.

     インラインフラグの ‘(?L)’ に相当します。

          警告: This flag is discouraged; consider Unicode matching
          instead.  The locale mechanism is very unreliable as it only
          handles one "culture" at a time and only works with 8-bit
          locales.  Unicode matching is enabled by default for Unicode
          (str) patterns and it is able to handle different locales and
          languages.

     バージョン 3.6 で変更: *note LOCALE: d63. はバイト列パターンにのみ
     使え、*note ASCII: 83e. と互換ではありません。

     バージョン 3.7 で変更: *note LOCALE: d63. フラグがあるコンパイル済
     み正規表現オブジェクトはコンパイル時のロケールに依存しなくなりまし
     た。マッチング時のロケールのみがマッチングの結果に影響します。

 -- データ: re.M
 -- データ: re.MULTILINE

     指定されると、パターン文字 ‘'^'’ は、文字列の先頭および各行の先頭
     (各改行の直後)とマッチします；そしてパターン文字 ‘'$'’ は文字列の末
     尾および各行の末尾 (改行の直前) とマッチします。デフォルトでは、
     ‘'^'’ は、文字列の先頭とだけマッチし、 ‘'$'’ は、文字列の末尾および
     文字列の末尾の改行の直前(がもしあれば)とマッチします。

     インラインフラグの ‘(?m)’ に相当します。

 -- データ: re.NOFLAG

     Indicates no flag being applied, the value is ‘0’.  This flag may
     be used as a default value for a function keyword argument or as a
     base value that will be conditionally ORed with other flags.
     Example of use as a default value:

          def myfunc(text, flag=re.NOFLAG):
              return re.match(text, flag)

     Added in version 3.11.

 -- データ: re.S
 -- データ: re.DOTALL

     特殊文字 ‘'.'’ を、改行を含む任意の文字と、とにかくマッチさせます；
     このフラグがなければ、 ‘'.'’ は、改行 '以外の' 任意の文字とマッチし
     ます。

     インラインフラグの ‘(?s)’ に相当します。

 -- データ: re.U
 -- データ: re.UNICODE

     In Python 3, Unicode characters are matched by default for ‘str’
     patterns.  This flag is therefore redundant with 'no effect' and is
     only kept for backward compatibility.

     See *note ASCII: 83e. to restrict matching to ASCII characters
     instead.

 -- データ: re.X
 -- データ: re.VERBOSE

     このフラグは正規表現を、パターンの論理的な節を視覚的に分割し、コメ
     ントを加えることで、見た目よく読みやすく書けるようにします。パター
     ン中の空白は、文字クラス中にあるときと、エスケープされていないバッ
     クスラッシュの後にあるときと、 ‘*?’ 、 ‘(?:’ や ‘(?P<...>’ のような
     トークン中を除いて無視されます。たとえば、 ‘(? :’ and ‘* ?’ は許さ
     れません。ある行が文字クラス中でもエスケープされていないバックスラ
     ッシュの後でもない ‘#’ を含むなら、一番左のそのような ‘#’ から行末
     までの全ての文字は無視されます。

     つまり、10 進数字にマッチする下記のふたつの正規表現オブジェクトは、
     機能的に等価です:

          a = re.compile(r"""\d +  # the integral part
                             \.    # the decimal point
                             \d *  # some fractional digits""", re.X)
          b = re.compile(r"\d+\.\d*")

     インラインフラグの ‘(?x)’ に相当します。


File: python.info,  Node: 関数<2>,  Next: 例外<3>,  Prev: フラグ,  Up: モジュールコンテンツ

5.6.3.4 関数
............

 -- の関数: re.compile (pattern, flags=0)

     正規表現パターンを *note 正規表現オブジェクト: 1189. にコンパイルし
     、以下に述べる *note match(): 2774. 、 *note search(): 2775. その他
     のメソッドを使ってマッチングに使えるようにします。

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 276f. variables,
     combined using bitwise OR (the ‘|’ operator).

     シーケンス

          prog = re.compile(pattern)
          result = prog.match(string)

     は、以下と同等です

          result = re.match(pattern, string)

     が、 *note re.compile(): dce. を使い、結果の正規表現オブジェクトを
     保存して再利用するほうが、一つのプログラムでその表現を何回も使うと
     きに効率的です。

          注釈: *note re.compile(): dce. やモジュールレベルのマッチング
          関数に渡された最新のパターンはコンパイル済みのものがキャッシュ
          されるので、一度に正規表現を少ししか使わないプログラムでは正規
          表現をコンパイルする必要はありません。

 -- の関数: re.search (pattern, string, flags=0)

     'string' 全体を走査して、正規表現 'pattern' がマッチを発生する最初
     の位置を探して、対応する *note Match: ec3. を返します。もし文字列内
     に、そのパターンとマッチする位置がないならば、 ‘None’ を返します；
     これは、文字列内のある点で長さゼロのマッチを探すこととは異なること
     に注意して下さい。

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 276f. variables,
     combined using bitwise OR (the ‘|’ operator).

 -- の関数: re.match (pattern, string, flags=0)

     もし 'string' の先頭で 0 個以上の文字が正規表現 'pattern' とマッチ
     すれば、対応する *note Match: ec3. を返します。もし文字列がパターン
     とマッチしなければ、 ‘None’ を返します；これは長さゼロのマッチとは
     異なることに注意して下さい。

     *note MULTILINE: 2764. モードにおいても、*note re.match(): 1445. は
     各行の先頭でマッチするのではなく、文字列の先頭でのみマッチすること
     に注意してください。

     'string' 中のどこででもマッチさせたいなら、代わりに *note search():
     1444. を使ってください (*note search() vs.  match(): 2776. も参照し
     てください)。

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 276f. variables,
     combined using bitwise OR (the ‘|’ operator).

 -- の関数: re.fullmatch (pattern, string, flags=0)

     'string' 全体が正規表現 'pattern' にマッチするなら、対応する *note
     Match: ec3. を返します。文字列がパターンにマッチしないなら ‘None’ を
     返します。これは長さ 0 のマッチとは異なることに注意して下さい。

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 276f. variables,
     combined using bitwise OR (the ‘|’ operator).

     Added in version 3.4.

 -- の関数: re.split (pattern, string, maxsplit=0, flags=0)

     'string' を、出現した 'pattern' で分割します。 'pattern' 中でキャプ
     チャの丸括弧が使われていれば、パターン中の全てのグループのテキスト
     も結果のリストの一部として返されます。'maxsplit' が 0 でなければ、
     分割は最大 'maxsplit' 回起こり、残りの文字列はリストの最終要素とし
     て返されます。

          >>> re.split(r'\W+', 'Words, words, words.')
          ['Words', 'words', 'words', '']
          >>> re.split(r'(\W+)', 'Words, words, words.')
          ['Words', ', ', 'words', ', ', 'words', '.', '']
          >>> re.split(r'\W+', 'Words, words, words.', maxsplit=1)
          ['Words', 'words, words.']
          >>> re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE)
          ['0', '3', '9']

     セパレータ中にキャプチャグループがあり、それが文字列の先頭にマッチ
     するなら、結果は空文字列で始まります。同じことが文字列の末尾にも言
     えます。

          >>> re.split(r'(\W+)', '...words, words...')
          ['', '...', 'words', ', ', 'words', '...', '']

     そうして、結果のリストにおいて、セパレータの構成要素は常に同じ相対
     的インデックスに見つかります。

     Adjacent empty matches are not possible, but an empty match can
     occur immediately after a non-empty match.

          >>> re.split(r'\b', 'Words, words, words.')
          ['', 'Words', ', ', 'words', ', ', 'words', '.']
          >>> re.split(r'\W*', '...words...')
          ['', '', 'w', 'o', 'r', 'd', 's', '', '']
          >>> re.split(r'(\W*)', '...words...')
          ['', '...', '', '', 'w', '', 'o', '', 'r', '', 'd', '', 's', '...', '', '', '']

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 276f. variables,
     combined using bitwise OR (the ‘|’ operator).

     バージョン 3.1 で変更: オプションの flags 引数が追加されました。

     バージョン 3.7 で変更: 空文字列にマッチしうるパターンでの分割をサポ
     ートするようになりました。

     バージョン 3.13 で非推奨: Passing 'maxsplit' and 'flags' as
     positional arguments is deprecated.  In future Python versions they
     will be *note keyword-only parameters: 5a5.

 -- の関数: re.findall (pattern, string, flags=0)

     Return all non-overlapping matches of 'pattern' in 'string', as a
     list of strings or tuples.  The 'string' is scanned left-to-right,
     and matches are returned in the order found.  Empty matches are
     included in the result.

     The result depends on the number of capturing groups in the
     pattern.  If there are no groups, return a list of strings matching
     the whole pattern.  If there is exactly one group, return a list of
     strings matching that group.  If multiple groups are present,
     return a list of tuples of strings matching the groups.
     Non-capturing groups do not affect the form of the result.

          >>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest')
          ['foot', 'fell', 'fastest']
          >>> re.findall(r'(\w+)=(\d+)', 'set width=20 and height=10')
          [('width', '20'), ('height', '10')]

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 276f. variables,
     combined using bitwise OR (the ‘|’ operator).

     バージョン 3.7 で変更: 空でないマッチが前の空マッチの直後から始めら
     れるようになりました。

 -- の関数: re.finditer (pattern, string, flags=0)

     'string' 中の正規表現 'pattern' の重複しないマッチ全てに渡る *note
     Match: ec3. オブジェクトを yield する *note イテレータ: 4c8. を返し
     ます。 'string' は左から右へ走査され、マッチは見つかった順で返され
     ます。空マッチは結果に含まれます。

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 276f. variables,
     combined using bitwise OR (the ‘|’ operator).

     バージョン 3.7 で変更: 空でないマッチが前の空マッチの直後から始めら
     れるようになりました。

 -- の関数: re.sub (pattern, repl, string, count=0, flags=0)

     'string' 中に出現する最も左の重複しない 'pattern' を置換 'repl' で
     置換することで得られる文字列を返します。 パターンが見つからない場合
     、 'string' がそのまま返されます。 'repl' は文字列または関数です。
     'repl' が文字列の場合は、その中の全てのバックスラッシュエスケープが
     処理されます。 ‘\n’ は 1 つの改行文字に変換され、 ‘\r’ はキャリッジ
     リターンに変換される、などです。 ASCII 文字のエスケープで未知のもの
     は将来使うために予約されていて、エラーとして扱われます。 それ以外の
     ‘\&’ のような未知のエスケープは残されます。 ‘\6’ のような後方参照は
     、パターンのグループ 6 がマッチした部分文字列で置換されます。 例え
     ば:

          >>> re.sub(r'def\s+([a-zA-Z_][a-zA-Z_0-9]*)\s*\(\s*\):',
          ...        r'static PyObject*\npy_\1(void)\n{',
          ...        'def myfunc():')
          'static PyObject*\npy_myfunc(void)\n{'

     もし 'repl' が関数であれば、重複しない 'pattern' が発生するたびにそ
     の関数が呼ばれます。この関数は一つの *note Match: ec3. 引数を取り、
     置換文字列を返します。例えば:

          >>> def dashrepl(matchobj):
          ...     if matchobj.group(0) == '-': return ' '
          ...     else: return '-'
          ...
          >>> re.sub('-{1,2}', dashrepl, 'pro----gram-files')
          'pro--gram files'
          >>> re.sub(r'\sAND\s', ' & ', 'Baked Beans And Spam', flags=re.IGNORECASE)
          'Baked Beans & Spam'

     パターンは、文字列でも *note Pattern: 1b67. でも構いません。

     The optional argument 'count' is the maximum number of pattern
     occurrences to be replaced; 'count' must be a non-negative integer.
     If omitted or zero, all occurrences will be replaced.

     Adjacent empty matches are not possible, but an empty match can
     occur immediately after a non-empty match.  As a result, ‘sub('x*',
     '-', 'abxd')’ returns ‘'-a-b--d-'’ instead of ‘'-a-b-d-'’.

     文字列型 'repl' 引数では、上で述べた文字エスケープや後方参照に加え
     て、 ‘\g<name>’ は ‘(?P<name>...)’ 構文で定義された ‘name’ という名
     前のグループがマッチした部分文字列を使い、 ‘\g<number>’ は対応する
     グループ番号を使います。よって ‘\g<2>’ は ‘\2’ と等価ですが、
     ‘\g<2>0’ のような置換においても曖昧になりません。 ‘\20’ は、グルー
     プ 20 への参照として解釈され、グループ 2 への参照にリテラル文字
     ‘'0'’ が続いたものとしては解釈されません。後方参照 ‘\g<0>’ は正規表
     現とマッチした部分文字列全体で置き換わります。

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 276f. variables,
     combined using bitwise OR (the ‘|’ operator).

     バージョン 3.1 で変更: オプションの flags 引数が追加されました。

     バージョン 3.5 で変更: マッチしなかったグループは空文字列に置き換え
     られます。

     バージョン 3.6 で変更: 'pattern' 中に ‘'\'’ と ASCII 文字からなる未
     知のエスケープがあると、エラーになります。

     バージョン 3.7 で変更: Unknown escapes in 'repl' consisting of
     ‘'\'’ and an ASCII letter now are errors.  An empty match can occur
     immediately after a non-empty match.

     バージョン 3.12 で変更: Group 'id' can only contain ASCII digits.
     In *note bytes: 192. replacement strings, group 'name' can only
     contain bytes in the ASCII range (‘b'\x00'’-‘b'\x7f'’).

     バージョン 3.13 で非推奨: Passing 'count' and 'flags' as positional
     arguments is deprecated.  In future Python versions they will be
     *note keyword-only parameters: 5a5.

 -- の関数: re.subn (pattern, repl, string, count=0, flags=0)

     *note sub(): 5a3. と同じ操作を行いますが、タプル ‘(new_string、
     number_of_subs_made)’ を返します。

     The expression's behaviour can be modified by specifying a 'flags'
     value.  Values can be any of the *note flags: 276f. variables,
     combined using bitwise OR (the ‘|’ operator).

 -- の関数: re.escape (pattern)

     'pattern' 中の特殊文字をエスケープします。これは正規表現メタ文字を
     含みうる任意のリテラル文字列にマッチしたい時に便利です。

          >>> print(re.escape('https://www.python.org'))
          https://www\.python\.org

          >>> legal_chars = string.ascii_lowercase + string.digits + "!#$%&'*+-.^_`|~:"
          >>> print('[%s]+' % re.escape(legal_chars))
          [abcdefghijklmnopqrstuvwxyz0123456789!\#\$%\&'\*\+\-\.\^_`\|\~:]+

          >>> operators = ['+', '-', '*', '/', '**']
          >>> print('|'.join(map(re.escape, sorted(operators, reverse=True))))
          /|\-|\+|\*\*|\*

     この関数は、バックスラッシュのみをエスケープするべき *note sub():
     5a3. および *note subn(): 5a4. における置換文字列に使われてはなりま
     せん。例えば:

          >>> digits_re = r'\d+'
          >>> sample = '/usr/sbin/sendmail - 0 errors, 12 warnings'
          >>> print(re.sub(digits_re, digits_re.replace('\\', r'\\'), sample))
          /usr/sbin/sendmail - \d+ errors, \d+ warnings

     バージョン 3.3 で変更: ‘'_'’ 文字がエスケープされなくなりました。

     バージョン 3.7 で変更: 正規表現で特別な意味を持つ文字だけがエスケー
     プされます。結果として、 ‘'!'’、 ‘'"'’、 ‘'%'’、 ‘"'"’、 ‘','’、
     ‘'/'’、 ‘':'’、 ‘';'’、 ‘'<'’、 ‘'='’、 ‘'>'’、 ‘'@'’、 と ‘"`"’ は
     もはやエスケープされません。

 -- の関数: re.purge ()

     正規表現キャッシュをクリアします。


File: python.info,  Node: 例外<3>,  Prev: 関数<2>,  Up: モジュールコンテンツ

5.6.3.5 例外
............

 -- 例外: re.PatternError (msg, pattern=None, pos=None)

     Exception raised when a string passed to one of the functions here
     is not a valid regular expression (for example, it might contain
     unmatched parentheses) or when some other error occurs during
     compilation or matching.  It is never an error if a string contains
     no match for a pattern.  The ‘PatternError’ instance has the
     following additional attributes:

      -- の属性: msg

          フォーマットされていないエラーメッセージです。

      -- の属性: pattern

          正規表現のパターンです。

      -- の属性: pos

          'pattern' のコンパイルに失敗した場所のインデックスです (‘None’
          の場合もあります)。

      -- の属性: lineno

          'pos' に対応する行です (‘None’ の場合もあります)。

      -- の属性: colno

          'pos' に対応する列です (‘None’ の場合もあります)。

     バージョン 3.5 で変更: 追加の属性が追加されました。

     バージョン 3.13 で変更: ‘PatternError’ was originally named
     ‘error’; the latter is kept as an alias for backward compatibility.


File: python.info,  Node: 正規表現オブジェクト,  Next: マッチオブジェクト,  Prev: モジュールコンテンツ,  Up: re --- 正規表現操作

5.6.3.6 正規表現オブジェクト
............................

 -- クラス: re.Pattern

     Compiled regular expression object returned by *note re.compile():
     dce.

     バージョン 3.9 で変更: *note re.Pattern: 1b67. supports ‘[]’ to
     indicate a Unicode (str) or bytes pattern.  See *note
     ジェネリックエイリアス型: 8c1.

 -- メソッド: Pattern.search (string[, pos[, endpos]])

     'string' 全体を走査して、この正規表現がマッチを発生する最初の位置を
     探して、対応する *note Match: ec3. を返します。もし文字列内に、その
     パターンとマッチする位置がないならば、 ‘None’ を返します；これは、
     文字列内のある点で長さゼロのマッチを探すこととは異なることに注意し
     て下さい。

     オプションの第二引数 'pos' は、文字列のどこから探し始めるかを指定す
     るインデックスで、デフォルトでは 0 です。これは文字列のスライスと完
     全には同じではありません。パターン文字 ‘'^'’ は本当の文字列の先頭と
     改行の直後でマッチしますが、検索を開始するインデックスでマッチする
     とは限りません。

     オプションの引数 'endpos' は文字列がどこまで検索されるかを制限しま
     す。文字列の長さが 'endpos' 文字だったかのようになるので、'pos' か
     ら ‘endpos - 1’ の文字に対してだけマッチを探します。'endpos' が
     'pos' よりも小さいと、マッチは見つかりません。そうでなければ、'rx'
     をコンパイル済み正規表現オブジェクトとして、‘rx.search(string, 0,
     50)’ は ‘rx.search(string[:50], 0)’ と等価です。

          >>> pattern = re.compile("d")
          >>> pattern.search("dog")     # Match at index 0
          <re.Match object; span=(0, 1), match='d'>
          >>> pattern.search("dog", 1)  # No match; search doesn't include the "d"

 -- メソッド: Pattern.match (string[, pos[, endpos]])

     もし 'string' の先頭で 0 個以上の文字がこの正規表現とマッチすれば、
     対応する *note Match: ec3. を返します。もし文字列がパターンとマッチ
     しなければ、 ‘None’ を返します；これは長さゼロのマッチとは異なるこ
     とに注意して下さい。

     オプションの 'pos' および 'endpos' 引数は *note search(): 2775. メ
     ソッドのものと同じ意味です。

          >>> pattern = re.compile("o")
          >>> pattern.match("dog")      # No match as "o" is not at the start of "dog".
          >>> pattern.match("dog", 1)   # Match as "o" is the 2nd character of "dog".
          <re.Match object; span=(1, 2), match='o'>

     'string' 中のどこででもマッチさせたいなら、代わりに *note search():
     2775. を使ってください (*note search() vs.  match(): 2776. も参照し
     てください)。

 -- メソッド: Pattern.fullmatch (string[, pos[, endpos]])

     'string' 全体がこの正規表現にマッチするなら、対応する *note Match:
     ec3. を返します。文字列がパターンにマッチしないなら ‘None’ を返しま
     す。これは長さ 0 のマッチとは異なることに注意して下さい。

     オプションの 'pos' および 'endpos' 引数は *note search(): 2775. メ
     ソッドのものと同じ意味です。

          >>> pattern = re.compile("o[gh]")
          >>> pattern.fullmatch("dog")      # No match as "o" is not at the start of "dog".
          >>> pattern.fullmatch("ogre")     # No match as not the full string matches.
          >>> pattern.fullmatch("doggie", 1, 3)   # Matches within given limits.
          <re.Match object; span=(1, 3), match='og'>

     Added in version 3.4.

 -- メソッド: Pattern.split (string, maxsplit=0)

     *note split(): 5a2. 関数にこのコンパイル済みパターンを使うのと同じ
     です。

 -- メソッド: Pattern.findall (string[, pos[, endpos]])

     *note findall(): 122b. 関数にこのコンパイル済みパターンを使うのと似
     ていますが、オプションの 'pos' および 'endpos' 引数で *note
     search(): 1444. のように検索範囲を制限できます。

 -- メソッド: Pattern.finditer (string[, pos[, endpos]])

     *note finditer(): 1713. 関数にこのコンパイル済みパターンを使うのと
     似ていますが、オプションの 'pos' および 'endpos' 引数で *note
     search(): 1444. のように検索範囲を制限できます。

 -- メソッド: Pattern.sub (repl, string, count=0)

     *note sub(): 5a3. 関数にこのコンパイル済みパターンを使うのと同じで
     す。

 -- メソッド: Pattern.subn (repl, string, count=0)

     *note subn(): 5a4. 関数にこのコンパイル済みパターンを使うのと同じで
     す。

 -- の属性: Pattern.flags

     正規表現のマッチングフラグです。これは *note compile(): dce. に与え
     られたフラグ、パターン中の ‘(?...)’ インラインフラグ、およびパター
     ンが Unicode 文字列だった時の *note UNICODE: d64. のような暗黙のフ
     ラグの組み合わせです。

 -- の属性: Pattern.groups

     パターン中のキャプチャグループの数です。

 -- の属性: Pattern.groupindex

     ‘(?P<id>)’ で定義されたあらゆるシンボリックグループ名をグループ番号
     へ写像する辞書です。シンボリックグループがパターン中で全く使われて
     いなければ、この辞書は空です。

 -- の属性: Pattern.pattern

     パターンオブジェクトがコンパイルされた元のパターン文字列です。

バージョン 3.7 で変更: *note copy.copy(): 757. および *note
copy.deepcopy(): d65. をサポートするようになりました。コンパイル済み正規
表現オブジェクトはアトミックであると見なされます。


File: python.info,  Node: マッチオブジェクト,  Next: 正規表現の例,  Prev: 正規表現オブジェクト,  Up: re --- 正規表現操作

5.6.3.7 マッチオブジェクト
..........................

マッチオブジェクトのブール値は常に ‘True’ です。 *note match(): 2774. お
よび *note search(): 2775. はマッチがないとき ‘None’ を返すので、マッチ
があるか単純な ‘if’ 文で判定できます。

     match = re.search(pattern, string)
     if match:
         process(match)

 -- クラス: re.Match

     Match object returned by successful ‘match’es and ‘search’es.

     バージョン 3.9 で変更: *note re.Match: ec3. supports ‘[]’ to
     indicate a Unicode (str) or bytes match.  See *note
     ジェネリックエイリアス型: 8c1.

 -- メソッド: Match.expand (template)

     Return the string obtained by doing backslash substitution on the
     template string 'template', as done by the *note sub(): 277d.
     method.  Escapes such as ‘\n’ are converted to the appropriate
     characters, and numeric backreferences (‘\1’, ‘\2’) and named
     backreferences (‘\g<1>’, ‘\g<name>’) are replaced by the contents
     of the corresponding group.  The backreference ‘\g<0>’ will be
     replaced by the entire match.

     バージョン 3.5 で変更: マッチしなかったグループは空文字列に置き換え
     られます。

 -- メソッド: Match.group ([group1, ...])

     このマッチの 1 つ以上のサブグループを返します。引数が 1 つなら結果
     は 1 つの文字列です。複数の引数があれば、結果は引数ごとに 1 項目の
     タプルです。引数がなければ、 'group1' はデフォルトで 0 (マッチ全体
     が返される) です。 'groupN' 引数が 0 なら、対応する返り値はマッチし
     た文字列全体です。1 以上 99 以下なら、丸括弧による対応するグループ
     にマッチする文字列です。グループ番号が負であるかパターン中で定義さ
     れたグループの数より大きければ、 *note IndexError: 174e. 例外が送出
     されます。あるグループがパターンのマッチしなかった部分に含まれてい
     るなら、対応する結果は ‘None’ です。あるグループがパターンの複数回
     マッチした部分に含まれているなら、最後のマッチが返されます。

          >>> m = re.match(r"(\w+) (\w+)", "Isaac Newton, physicist")
          >>> m.group(0)       # The entire match
          'Isaac Newton'
          >>> m.group(1)       # The first parenthesized subgroup.
          'Isaac'
          >>> m.group(2)       # The second parenthesized subgroup.
          'Newton'
          >>> m.group(1, 2)    # Multiple arguments give us a tuple.
          ('Isaac', 'Newton')

     正規表現が ‘(?P<name>...)’ 構文を使うなら、 'groupN' 引数はグループ
     名でグループを識別する文字列でも構いません。文字列引数がパターン中
     でグループ名として使われていなければ、 *note IndexError: 174e. 例外
     が送出されます。

     やや複雑な例:

          >>> m = re.match(r"(?P<first_name>\w+) (?P<last_name>\w+)", "Malcolm Reynolds")
          >>> m.group('first_name')
          'Malcolm'
          >>> m.group('last_name')
          'Reynolds'

     名前付きグループはインデックスでも参照できます:

          >>> m.group(1)
          'Malcolm'
          >>> m.group(2)
          'Reynolds'

     あるグループが複数回マッチすると、その最後のマッチにのみアクセスで
     きます:

          >>> m = re.match(r"(..)+", "a1b2c3")  # Matches 3 times.
          >>> m.group(1)                        # Returns only the last match.
          'c3'

 -- メソッド: Match.__getitem__ (g)

     これは ‘m.group(g)’ と同等です。これでマッチの個別のグループに簡単
     にアクセスできます:

          >>> m = re.match(r"(\w+) (\w+)", "Isaac Newton, physicist")
          >>> m[0]       # The entire match
          'Isaac Newton'
          >>> m[1]       # The first parenthesized subgroup.
          'Isaac'
          >>> m[2]       # The second parenthesized subgroup.
          'Newton'

     Named groups are supported as well:

          >>> m = re.match(r"(?P<first_name>\w+) (?P<last_name>\w+)", "Isaac Newton")
          >>> m['first_name']
          'Isaac'
          >>> m['last_name']
          'Newton'

     Added in version 3.6.

 -- メソッド: Match.groups (default=None)

     このマッチの、1 からパターン中のグループ数まで、全てのサブグループ
     を含むタプルを返します。'default' 引数はマッチに関係しなかったグル
     ープに使われます。デフォルトでは ‘None’ です。

     例えば:

          >>> m = re.match(r"(\d+)\.(\d+)", "24.1632")
          >>> m.groups()
          ('24', '1632')

     少数位およびその後の全てをオプションにすると、全てのグループがマッ
     チに関係するとは限りません。そういったグループは 'default' 引数が与
     えられない限りデフォルトで ‘None’ になります。

          >>> m = re.match(r"(\d+)\.?(\d+)?", "24")
          >>> m.groups()      # Second group defaults to None.
          ('24', None)
          >>> m.groups('0')   # Now, the second group defaults to '0'.
          ('24', '0')

 -- メソッド: Match.groupdict (default=None)

     このマッチの、全ての '名前付き' サブグループを含む、サブグループ名
     をキーとする辞書を返します。 'default' 引数はマッチに関係しなかった
     グループに使われます。デフォルトは ‘None’ です。例えば:

          >>> m = re.match(r"(?P<first_name>\w+) (?P<last_name>\w+)", "Malcolm Reynolds")
          >>> m.groupdict()
          {'first_name': 'Malcolm', 'last_name': 'Reynolds'}

 -- メソッド: Match.start ([group])
 -- メソッド: Match.end ([group])

     'group' がマッチした部分文字列の先頭と末尾のインデックスを返します
     。 'group' はデフォルトで 0 (マッチした部分文字列全体という意味) で
     す。 'group' が存在してかつマッチには寄与していなかったなら ‘-1’ を
     返します。マッチオブジェクト 'm' と、マッチに寄与したグループ 'g' に
     対して、グループ 'g' がマッチした部分文字列 (‘m.group(g)’ と等価で
     す) は以下の通りです

          m.string[m.start(g):m.end(g)]

     'group' が空文字列にマッチしていたら ‘m.start(group)’ は
     ‘m.end(group)’ と等しくなることに注意して下さい。例えば、 ‘m =
     re.search('b(c?)', 'cba')’ とすると、 ‘m.start(0)’ は 1 で、
     ‘m.end(0)’ は 2 で、 ‘m.start(1)’ と ‘m.end(1)’ はともに 2 であり、
     ‘m.start(2)’ は *note IndexError: 174e. 例外を発生します。

     メールアドレスから 'remove_this' を取り除く例:

          >>> email = "tony@tiremove_thisger.net"
          >>> m = re.search("remove_this", email)
          >>> email[:m.start()] + email[m.end():]
          'tony@tiger.net'

 -- メソッド: Match.span ([group])

     マッチ 'm' について、2 タプル ‘(m.start(group), m.end(group))’ を返
     します。 'group' がマッチに寄与していなければ、これは ‘(-1, -1)’ で
     す。 'group' はデフォルトで 0 、マッチ全体です。

 -- の属性: Match.pos

     *note 正規表現オブジェクト: 1189. の *note search(): 2775. や *note
     match(): 2774. に渡された 'pos' の値です。これは正規表現エンジンが
     マッチを探し始める位置の文字列のインデックスです。

 -- の属性: Match.endpos

     *note 正規表現オブジェクト: 1189. の *note search(): 2775. や *note
     match(): 2774. に渡された 'endpos' の値です。これは正規表現エンジン
     がそれ以上は進まない文字列のインデックスです。

 -- の属性: Match.lastindex

     最後にマッチしたキャプチャグループの整数インデックスです。どのグル
     ープも全くマッチしなければ ‘None’ です。例えば、表現 ‘(a)b’ 、
     ‘((a)(b))’ や ‘((ab))’ が ‘'ab'’ に適用されると ‘lastindex == 1’ と
     なり、同じ文字列に ‘(a)(b)’ が適用されると ‘lastindex == 2’ となり
     ます。

 -- の属性: Match.lastgroup

     最後にマッチしたキャプチャグループの名前です。そのグループに名前が
     ないか、どのグループも全くマッチしていなければ ‘None’ です。

 -- の属性: Match.re

     このマッチインスタンスを生じさせた *note match(): 2774. または
     *note search(): 2775. メソッドの属する *note 正規表現オブジェクト:
     1189. です。

 -- の属性: Match.string

     *note match(): 2774. や *note search(): 2775. へ渡された文字列です
     。

バージョン 3.7 で変更: *note copy.copy(): 757. および *note
copy.deepcopy(): d65. をサポートするようになりました。マッチオブジェクト
はアトミックであると見なされます。


File: python.info,  Node: 正規表現の例,  Prev: マッチオブジェクト,  Up: re --- 正規表現操作

5.6.3.8 正規表現の例
....................

* Menu:

* ペアの確認::
* scanf() をシミュレートする: scanf をシミュレートする.
* search() vs. match(): search vs match.
* 電話帳を作る::
* テキストの秘匿::
* 全ての副詞を見つける::
* 全ての副詞とその位置を見つける::
* Raw 文字列記法::
* トークナイザを書く::


File: python.info,  Node: ペアの確認,  Next: scanf をシミュレートする,  Up: 正規表現の例

5.6.3.9 ペアの確認
..................

この例では、マッチオブジェクトをより美しく表示するために、この補助関数を
使用します:

     def displaymatch(match):
         if match is None:
             return None
         return '<Match: %r, groups=%r>' % (match.group(), match.groups())

あなたがポーカープログラムを書いているとします。プレイヤーの手札は 5 文
字の文字列によって表され、それぞれの文字が 1 枚のカードを表します。 "a"
はエース、 "k" はキング、 "q" はクイーン、 "j" はジャック、 "t" は 10、
そして "2" から "9" はその数字のカードを表します。

与えられた文字列が有効な手札であるか見るには、以下のようにできます:

     >>> valid = re.compile(r"^[a2-9tjqk]{5}$")
     >>> displaymatch(valid.match("akt5q"))  # Valid.
     "<Match: 'akt5q', groups=()>"
     >>> displaymatch(valid.match("akt5e"))  # Invalid.
     >>> displaymatch(valid.match("akt"))    # Invalid.
     >>> displaymatch(valid.match("727ak"))  # Valid.
     "<Match: '727ak', groups=()>"

最後の手札、 ‘"727ak"’ 、はペア、すなわち同じ値の 2 枚のカードを含みます
。正規表現でこれにマッチするには、このように後方参照を使えます:

     >>> pair = re.compile(r".*(.).*\1")
     >>> displaymatch(pair.match("717ak"))     # Pair of 7s.
     "<Match: '717', groups=('7',)>"
     >>> displaymatch(pair.match("718ak"))     # No pairs.
     >>> displaymatch(pair.match("354aa"))     # Pair of aces.
     "<Match: '354aa', groups=('a',)>"

ペアになっているのがどのカードか調べるには、このようにマッチオブジェクト
の *note group(): 122c. メソッドを使えます:

     >>> pair = re.compile(r".*(.).*\1")
     >>> pair.match("717ak").group(1)
     '7'

     # Error because re.match() returns None, which doesn't have a group() method:
     >>> pair.match("718ak").group(1)
     Traceback (most recent call last):
       File "<pyshell#23>", line 1, in <module>
         re.match(r".*(.).*\1", "718ak").group(1)
     AttributeError: 'NoneType' object has no attribute 'group'

     >>> pair.match("354aa").group(1)
     'a'


File: python.info,  Node: scanf をシミュレートする,  Next: search vs match,  Prev: ペアの確認,  Up: 正規表現の例

5.6.3.10 scanf() をシミュレートする
...................................

Python には現在のところ、 ‘scanf()’ に相当するものがありません。正規表現
は一般的に、 ‘scanf()’ のフォーマット文字列より強力ですが、冗長でもあり
ます。以下の表に、 ‘scanf()’ のフォーマットトークンと正規表現のおおよそ
の対応付けを示します。

‘scanf()’ トークン                   正規表現
                                     
---------------------------------------------------------------------------------------
                                     
‘%c’                                 ‘.’
                                     
                                     
‘%5c’                                ‘.{5}’
                                     
                                     
‘%d’                                 ‘[-+]?\d+’
                                     
                                     
‘%e’, ‘%E’, ‘%f’, ‘%g’               ‘[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?’
                                     
                                     
‘%i’                                 ‘[-+]?(0[xX][\dA-Fa-f]+|0[0-7]*|\d+)’
                                     
                                     
‘%o’                                 ‘[-+]?[0-7]+’
                                     
                                     
‘%s’                                 ‘\S+’
                                     
                                     
‘%u’                                 ‘\d+’
                                     
                                     
‘%x’, ‘%X’                           ‘[-+]?(0[xX])?[\dA-Fa-f]+’
                                     

以下のような文字列からファイル名と数を抽出するには

     /usr/sbin/sendmail - 0 errors, 4 warnings

以下のように ‘scanf()’ フォーマットを使えます

     %s - %d errors, %d warnings

等価な正規表現はこうです

     (\S+) - (\d+) errors, (\d+) warnings


File: python.info,  Node: search vs match,  Next: 電話帳を作る,  Prev: scanf をシミュレートする,  Up: 正規表現の例

5.6.3.11 search() vs. match()
.............................

Python offers different primitive operations based on regular
expressions:

   + *note re.match(): 1445. checks for a match only at the beginning of
     the string

   + *note re.search(): 1444. checks for a match anywhere in the string
     (this is what Perl does by default)

   + *note re.fullmatch(): 1187. checks for entire string to be a match

例えば:

     >>> re.match("c", "abcdef")    # No match
     >>> re.search("c", "abcdef")   # Match
     <re.Match object; span=(2, 3), match='c'>
     >>> re.fullmatch("p.*n", "python") # Match
     <re.Match object; span=(0, 6), match='python'>
     >>> re.fullmatch("r.*n", "python") # No match

‘'^'’ で始まる正規表現を *note search(): 1444. で使って、マッチを文字列
の先頭でのみに制限できます:

     >>> re.match("c", "abcdef")    # No match
     >>> re.search("^c", "abcdef")  # No match
     >>> re.search("^a", "abcdef")  # Match
     <re.Match object; span=(0, 1), match='a'>

ただし、 *note MULTILINE: 2764. モードにおいて *note match(): 1445. は文
字列の先頭でのみマッチし、 ‘'^'’ で始まる正規表現で *note search():
1444. を使うと各行の先頭でマッチすることに注意してください。

     >>> re.match("X", "A\nB\nX", re.MULTILINE)  # No match
     >>> re.search("^X", "A\nB\nX", re.MULTILINE)  # Match
     <re.Match object; span=(4, 5), match='X'>


File: python.info,  Node: 電話帳を作る,  Next: テキストの秘匿,  Prev: search vs match,  Up: 正規表現の例

5.6.3.12 電話帳を作る
.....................

*note split(): 5a2. は渡されたパターンで文字列を分割してリストにします。
このメソッドは、テキストデータをデータ構造に変換して、読みやすくしたり、
以下の例で実演する電話帳作成のように Python で編集したりしやすくするのに
、非常に役に立ちます。

最初に、入力を示します。通常、これはファイルからの入力になるでしょう。こ
こでは、3重引用符の書式とします。

     >>> text = """Ross McFluff: 834.345.1254 155 Elm Street
     ...
     ... Ronald Heathmore: 892.345.3428 436 Finley Avenue
     ... Frank Burger: 925.541.7625 662 South Dogwood Way
     ...
     ...
     ... Heather Albrecht: 548.326.4584 919 Park Place"""

各項目は 1 つ以上の改行で区切られています。まずは文字列を変換して、空行
でない各行を項目とするリストにします:

     >>> entries = re.split("\n+", text)
     >>> entries
     ['Ross McFluff: 834.345.1254 155 Elm Street',
     'Ronald Heathmore: 892.345.3428 436 Finley Avenue',
     'Frank Burger: 925.541.7625 662 South Dogwood Way',
     'Heather Albrecht: 548.326.4584 919 Park Place']

そして各項目を、ファーストネーム、ラストネーム、電話番号、住所に分割して
リストにします。分割パターンである空白文字は住所にも含まれるので、 *note
split(): 5a2. の ‘maxsplit’ 引数を使います:

     >>> [re.split(":? ", entry, maxsplit=3) for entry in entries]
     [['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],
     ['Ronald', 'Heathmore', '892.345.3428', '436 Finley Avenue'],
     ['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],
     ['Heather', 'Albrecht', '548.326.4584', '919 Park Place']]

この ‘:?’ パターンはラストネームの次のコロンにマッチして、分割結果のリス
トに出てこないようにします。 ‘maxsplit’ を ‘4’ にすれば、家屋番号とスト
リート名を分割できます:

     >>> [re.split(":? ", entry, maxsplit=4) for entry in entries]
     [['Ross', 'McFluff', '834.345.1254', '155', 'Elm Street'],
     ['Ronald', 'Heathmore', '892.345.3428', '436', 'Finley Avenue'],
     ['Frank', 'Burger', '925.541.7625', '662', 'South Dogwood Way'],
     ['Heather', 'Albrecht', '548.326.4584', '919', 'Park Place']]


File: python.info,  Node: テキストの秘匿,  Next: 全ての副詞を見つける,  Prev: 電話帳を作る,  Up: 正規表現の例

5.6.3.13 テキストの秘匿
.......................

*note sub(): 5a3. は出現する各パターンを文字列で、または関数の返り値で置
き換えます。この例ではテキストを「秘匿」する関数と合わせて *note sub():
5a3. を使うところを実演します。具体的には、文中の各単語について、最初と
最後の文字を除く全ての文字をランダムに並び替えます:

     >>> def repl(m):
     ...     inner_word = list(m.group(2))
     ...     random.shuffle(inner_word)
     ...     return m.group(1) + "".join(inner_word) + m.group(3)
     ...
     >>> text = "Professor Abdolmalek, please report your absences promptly."
     >>> re.sub(r"(\w)(\w+)(\w)", repl, text)
     'Poefsrosr Aealmlobdk, pslaee reorpt your abnseces plmrptoy.'
     >>> re.sub(r"(\w)(\w+)(\w)", repl, text)
     'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.'


File: python.info,  Node: 全ての副詞を見つける,  Next: 全ての副詞とその位置を見つける,  Prev: テキストの秘匿,  Up: 正規表現の例

5.6.3.14 全ての副詞を見つける
.............................

*note search(): 1444. は最初のパターンにのみマッチしますが、 *note
findall(): 122b. は出現する '全ての' パターンにマッチします。例えば、ラ
イターがあるテキストの全ての副詞を見つけたいなら、以下のように *note
findall(): 122b. を使えます:

     >>> text = "He was carefully disguised but captured quickly by police."
     >>> re.findall(r"\w+ly\b", text)
     ['carefully', 'quickly']


File: python.info,  Node: 全ての副詞とその位置を見つける,  Next: Raw 文字列記法,  Prev: 全ての副詞を見つける,  Up: 正規表現の例

5.6.3.15 全ての副詞とその位置を見つける
.......................................

パターンの全てのマッチについて、マッチしたテキスト以上の情報が必要なら、
文字列ではなく *note Match: ec3. を返す *note finditer(): 1713. が便利で
す。先の例に続いて、ライターがあるテキストの全ての副詞 'およびその位置'
を見つけたいなら、以下のように *note finditer(): 1713. を使えます:

     >>> text = "He was carefully disguised but captured quickly by police."
     >>> for m in re.finditer(r"\w+ly\b", text):
     ...     print('%02d-%02d: %s' % (m.start(), m.end(), m.group(0)))
     07-16: carefully
     40-47: quickly


File: python.info,  Node: Raw 文字列記法,  Next: トークナイザを書く,  Prev: 全ての副詞とその位置を見つける,  Up: 正規表現の例

5.6.3.16 Raw 文字列記法
.......................

Raw 文字列記法 (‘r"text"’) で正規表現をまともに保てます。それがなければ
、正規表現中のバックスラッシュ (‘'\'’) を個々にバックスラッシュを前置し
てエスケープしなければなりません。例えば、以下の 2 行のコードは機能的に
等価です:

     >>> re.match(r"\W(.)\1\W", " ff ")
     <re.Match object; span=(0, 4), match=' ff '>
     >>> re.match("\\W(.)\\1\\W", " ff ")
     <re.Match object; span=(0, 4), match=' ff '>

リテラルのバックスラッシュにマッチさせたいなら、正規表現中ではエスケープ
する必要があります。Raw 文字列記法では、‘r"\\"’ になります。Raw 文字列記
法を用いないと、‘"\\\\"’ としなくてはならず、以下のコードは機能的に等価
です:

     >>> re.match(r"\\", r"\\")
     <re.Match object; span=(0, 1), match='\\'>
     >>> re.match("\\\\", r"\\")
     <re.Match object; span=(0, 1), match='\\'>


File: python.info,  Node: トークナイザを書く,  Prev: Raw 文字列記法,  Up: 正規表現の例

5.6.3.17 トークナイザを書く
...........................

トークナイザやスキャナ(1) は文字列を解析し、文字のグループにカテゴリ分け
します。これはコンパイラやインタプリタを書くうえで役立つ第一段階です。

テキストのカテゴリは正規表現で指定されます。この技法では、それらを一つの
マスター正規表現に結合し、マッチの連続についてループします:

     from typing import NamedTuple
     import re

     class Token(NamedTuple):
         type: str
         value: str
         line: int
         column: int

     def tokenize(code):
         keywords = {'IF', 'THEN', 'ENDIF', 'FOR', 'NEXT', 'GOSUB', 'RETURN'}
         token_specification = [
             ('NUMBER',   r'\d+(\.\d*)?'),  # Integer or decimal number
             ('ASSIGN',   r':='),           # Assignment operator
             ('END',      r';'),            # Statement terminator
             ('ID',       r'[A-Za-z]+'),    # Identifiers
             ('OP',       r'[+\-*/]'),      # Arithmetic operators
             ('NEWLINE',  r'\n'),           # Line endings
             ('SKIP',     r'[ \t]+'),       # Skip over spaces and tabs
             ('MISMATCH', r'.'),            # Any other character
         ]
         tok_regex = '|'.join('(?P<%s>%s)' % pair for pair in token_specification)
         line_num = 1
         line_start = 0
         for mo in re.finditer(tok_regex, code):
             kind = mo.lastgroup
             value = mo.group()
             column = mo.start() - line_start
             if kind == 'NUMBER':
                 value = float(value) if '.' in value else int(value)
             elif kind == 'ID' and value in keywords:
                 kind = value
             elif kind == 'NEWLINE':
                 line_start = mo.end()
                 line_num += 1
                 continue
             elif kind == 'SKIP':
                 continue
             elif kind == 'MISMATCH':
                 raise RuntimeError(f'{value!r} unexpected on line {line_num}')
             yield Token(kind, value, line_num, column)

     statements = '''
         IF quantity THEN
             total := total + price * quantity;
             tax := price * 0.05;
         ENDIF;
     '''

     for token in tokenize(statements):
         print(token)

このトークナイザは以下の出力を作成します:

     Token(type='IF', value='IF', line=2, column=4)
     Token(type='ID', value='quantity', line=2, column=7)
     Token(type='THEN', value='THEN', line=2, column=16)
     Token(type='ID', value='total', line=3, column=8)
     Token(type='ASSIGN', value=':=', line=3, column=14)
     Token(type='ID', value='total', line=3, column=17)
     Token(type='OP', value='+', line=3, column=23)
     Token(type='ID', value='price', line=3, column=25)
     Token(type='OP', value='*', line=3, column=31)
     Token(type='ID', value='quantity', line=3, column=33)
     Token(type='END', value=';', line=3, column=41)
     Token(type='ID', value='tax', line=4, column=8)
     Token(type='ASSIGN', value=':=', line=4, column=12)
     Token(type='ID', value='price', line=4, column=15)
     Token(type='OP', value='*', line=4, column=21)
     Token(type='NUMBER', value=0.05, line=4, column=23)
     Token(type='END', value=';', line=4, column=27)
     Token(type='ENDIF', value='ENDIF', line=5, column=4)
     Token(type='END', value=';', line=5, column=9)

(Frie09) Friedl, Jeffrey.  Mastering Regular Expressions.  3rd ed.,
O'Reilly Media, 2009.  当書の第三版ではもはや Python についてまったく取
り扱っていませんが、初版では良い正規表現を書くことを綿密に取り扱っていま
した。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Lexical_analysis


File: python.info,  Node: difflib --- 差分の計算の補助,  Next: textwrap --- テキストの折り返しと詰め込み,  Prev: re --- 正規表現操作,  Up: テキスト処理サービス

5.6.4 ‘difflib’ -- 差分の計算の補助
-----------------------------------

'ソースコード:' Lib/difflib.py(1)

__________________________________________________________________

このモジュールは、シーケンスを比較するためのクラスや関数を提供しています
。例えば、ファイルの差分を計算して、それを HTML や context diff, unified
diff などいろいろなフォーマットで出力するために、このモジュールを利用で
きます。ディレクトリやファイル群を比較するためには、 *note filecmp: 5e.
モジュールも参照してください。

 -- クラス: difflib.SequenceMatcher

     柔軟性のあるクラスで、二つのシーケンスの要素が *note ハッシュ可能:
     824. な型であれば、どの型の要素を含むシーケンスも比較可能です。基本
     的なアルゴリズムは、1980年代の後半に発表された Ratcliff と
     Obershelp による"ゲシュタルトパターンマッチング"と大げさに名づけら
     れたアルゴリズム以前から知られている、やや凝ったアルゴリズムです。
     その考え方は、"junk" 要素を含まない最も長い互いに隣接したマッチ列を
     探すことです。ここで、 "junk" 要素とは、空行や空白などの、意味を持
     たない要素のことです。 (junk を処理するのは、Ratcliff と Obershelp
     のアルゴリズムに追加された拡張です。)この考え方は、マッチ列の左右に
     隣接するシーケンスの断片に対して再帰的にあてはめられます。この方法
     では編集を最小にするシーケンスは生まれませんが、人間の目からみて「
     正しい感じ」にマッチする傾向があります。

     '実行時間:' 基本的な Ratcliff-Obershelp アルゴリズムは、最悪の場合
     3乗、期待値で2乗となります。 *note SequenceMatcher: 121b. オブジェ
     クトでは、最悪のケースで2乗、期待値は比較されるシーケンス中に共通に
     現れる要素数に非常にややこしく依存しています。最良の場合は線形時間
     になります。

     '自動 junk ヒューリスティック:' *note SequenceMatcher: 121b. は、シ
     ーケンスの特定の要素を自動的に junk として扱うヒューリスティックを
     サポートしています。このヒューリスティックは、各個要素がシーケンス
     内に何回現れるかを数えます。ある要素の重複数が (最初のものは除いて)
     合計でシーケンスの 1% 以上になり、そのシーケンスが 200 要素以上なら
     、その要素は "popular" であるものとしてマークされ、シーケンスのマッ
     チングの目的からは junk として扱われます。このヒューリスティックは
     、 *note SequenceMatcher: 121b. の作成時に ‘autojunk’ パラメタを
     ‘False’ に設定することで無効化できます。

     バージョン 3.2 で変更: Added the 'autojunk' parameter.

 -- クラス: difflib.Differ

     テキスト行からなるシーケンスを比較するクラスです。人が読むことので
     きる差分を作成します。 Differ クラスは *note SequenceMatcher: 121b.
     クラスを利用して、行からなるシーケンスを比較したり、(ほぼ)同一の行
     内の文字を比較したりします。

     *note Differ: 279d. クラスによる差分の各行は、2文字のコードで始まり
     ます:

     コード         意味
                    
     ---------------------------------------------------------------
                    
     ‘'- '’         行はシーケンス1にのみ存在する
                    
                    
     ‘'+ '’         行はシーケンス2にのみ存在する
                    
                    
     ‘' '’          行は両方のシーケンスで同一
                    
                    
     ‘'? '’         行は入力シーケンスのどちらにも存在しない
                    

     Lines beginning with '‘?’' attempt to guide the eye to intraline
     differences, and were not present in either input sequence.  These
     lines can be confusing if the sequences contain whitespace
     characters, such as spaces, tabs or line breaks.

 -- クラス: difflib.HtmlDiff

     このクラスは、二つのテキストを左右に並べて比較表示し、行間あるいは
     行内の変更点を強調表示するような HTML テーブル (またはテーブルの入
     った完全な HTML ファイル) を生成するために使います。テーブルは完全
     差分モード、コンテキスト差分モードのいずれでも生成できます。

     このクラスのコンストラクタは以下のようになっています:

      -- メソッド: __init__ (tabsize=8, wrapcolumn=None, linejunk=None,
               charjunk=IS_CHARACTER_JUNK)

          *note HtmlDiff: 201. のインスタンスを初期化します。

          'tabsize' はオプションのキーワード引数で、タブストップ幅を指定
          します。デフォルトは ‘8’ です。

          'wrapcolumn' はオプションのキーワード引数で、テキストを折り返
          すカラム幅を指定します。デフォルトは ‘None’ で折り返しを行いま
          せん。

          'linejunk' および 'charjunk' はオプションのキーワード引数で、
          *note ndiff(): 279f. (*note HtmlDiff: 201. はこの関数を使って
          左右のテキストの差分を HTML で生成します) に渡されます。それぞ
          れの引数のデフォルト値および説明は *note ndiff(): 279f. のドキ
          ュメントを参照してください。

     以下のメソッドが public になっています:

      -- メソッド: make_file (fromlines, tolines, fromdesc='',
               todesc='', context=False, numlines=5, *, charset='utf-8')

          'fromlines' と 'tolines' (いずれも文字列のリスト) を比較し、行
          間または行内の変更点が強調表示された行差分の入った表を持つ完全
          な HTML ファイルを文字列で返します。

          'fromdesc' および 'todesc' はオプションのキーワード引数で、差
          分表示テーブルにおけるそれぞれ差分元、差分先ファイルのカラムの
          ヘッダになる文字列を指定します (いずれもデフォルト値は空文字列
          です)。

          'context' および 'numlines' はともにオプションのキーワード引数
          です。'context' を ‘True’ にするとコンテキスト差分を表示し、デ
          フォルトの ‘False’ にすると完全なファイル差分を表示します。
          'numlines' のデフォルト値は ‘5’ で、'context' が ‘True’ の場合
          、'numlines' は強調部分の前後にあるコンテキスト行の数を制御し
          ます。'context' が ‘False’ の場合、'numlines' は "next" と書か
          れたハイパーリンクをたどった時に到達する場所が次の変更部分より
          何行前にあるかを制御します (値をゼロにした場合、"next" ハイパ
          ーリンクを辿ると変更部分の強調表示がブラウザの最上部に表示され
          るようになります)。

               注釈: 'fromdesc' と 'todesc' はエスケープされていない
               HTMLとして解釈されます。信頼できないソースからの入力を受
               け取る際には適切にエスケープされるべきです。

          バージョン 3.5 で変更: 'charset' キーワード専用引数が追加され
          ました。HTML 文書のデフォルトの文字集合が ‘'ISO-8859-1'’ から
          ‘'utf-8'’ に変更されました。

      -- メソッド: make_table (fromlines, tolines, fromdesc='',
               todesc='', context=False, numlines=5)

          'fromlines' と 'tolines' (いずれも文字列のリスト) を比較し、行
          間または行内の変更点が強調表示された行差分の入った完全な HTML
          テーブルを文字列で返します。

          このメソッドの引数は、 *note make_file(): ff0. メソッドの引数
          と同じです。

 -- の関数: difflib.context_diff (a, b, fromfile='', tofile='',
          fromfiledate='', tofiledate='', n=3, lineterm='\n')

     'a' と 'b' (文字列のリスト) を比較し、差分 (差分形式の行を生成する
     *note ジェネレータ: 126c.) を、 context diff のフォーマット(以下「
     コンテキスト形式」)で返します。

     コンテキスト形式は、変更があった行に前後数行を加えてある、コンパク
     トな表現方法です。変更箇所は、変更前/変更後に分けて表します。コンテ
     キスト (変更箇所前後の行) の行数は 'n' で指定し、デフォルト値は 3 で
     す。

     デフォルトで、 diff 制御行 (‘***’ や ‘---’ を含む行) は改行付きで生
     成されます。 *note io.IOBase.readlines(): 27a1. で作られた入力が
     *note io.IOBase.writelines(): 177a. で扱うのに適した diff になるの
     で (なぜなら入力と出力の両方が改行付きのため) 、これは有用です。

     行末に改行文字を持たない入力に対しては、出力でも改行文字を付加しな
     いように 'lineterm' 引数に ‘""’ を渡してください。

     コンテキスト形式は、通常、ヘッダにファイル名と変更時刻を持っていま
     す。この情報は、文字列 'fromfile', 'tofile', 'fromfiledate',
     'tofiledate' で指定できます。変更時刻の書式は、通常、ISO 8601 フォ
     ーマットで表されます。指定しなかった場合のデフォルト値は、空文字列
     です。

          >>> import sys
          >>> from difflib import *
          >>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']
          >>> s2 = ['python\n', 'eggy\n', 'hamster\n', 'guido\n']
          >>> sys.stdout.writelines(context_diff(s1, s2, fromfile='before.py',
          ...                        tofile='after.py'))
          *** before.py
          --- after.py
          ***************
          *** 1,4 ****
          ! bacon
          ! eggs
          ! ham
            guido
          --- 1,4 ----
          ! python
          ! eggy
          ! hamster
            guido

     より詳細な例は、 *note difflib のコマンドラインインターフェース:
     27a2. を参照してください。

 -- の関数: difflib.get_close_matches (word, possibilities, n=3,
          cutoff=0.6)

     「十分」なマッチの上位のリストを返します。'word' はマッチさせたいシ
     ーケンス (大概は文字列) です。'possibilities' は 'word' にマッチさ
     せるシーケンスのリスト (大概は文字列のリスト) です。

     オプションの引数 'n' (デフォルトでは ‘3’)はメソッドの返すマッチの最
     大数です。'n' は ‘0’ より大きくなければなりません。

     オプションの引数 'cutoff' (デフォルトでは ‘0.6’)は、区間 [0, 1] に
     入る小数の値です。'word' との一致率がそれ未満の 'possibilities' の
     要素は無視されます。

     'possibilities' の要素でマッチした上位(多くても 'n' 個)は、類似度の
     スコアに応じて(一番似たものを先頭に)ソートされたリストとして返され
     ます。

          >>> get_close_matches('appel', ['ape', 'apple', 'peach', 'puppy'])
          ['apple', 'ape']
          >>> import keyword
          >>> get_close_matches('wheel', keyword.kwlist)
          ['while']
          >>> get_close_matches('pineapple', keyword.kwlist)
          []
          >>> get_close_matches('accept', keyword.kwlist)
          ['except']

 -- の関数: difflib.ndiff (a, b, linejunk=None,
          charjunk=IS_CHARACTER_JUNK)

     'a' と 'b' (文字列のリスト) を比較し、差分 (差分形式の行を生成する
     *note ジェネレータ: 126c.) を、 *note Differ: 279d. のスタイルで返
     します。

     オプションのキーワード引数 'linejunk' と 'charjunk' には、フィルタ
     関数 (または ‘None’) を渡します。

     'linejunk': A function that accepts a single string argument, and
     returns true if the string is junk, or false if not.  The default
     is ‘None’.  There is also a module-level function *note
     IS_LINE_JUNK(): 2d7, which filters out lines without visible
     characters, except for at most one hash character (‘'#'’) - however
     the underlying *note SequenceMatcher: 121b. class does a dynamic
     analysis of which lines are so frequent as to constitute noise, and
     this usually works better than using this function.

     'charjunk': 文字 (長さ1の文字列) を受け取る関数です。文字列が junk
     の場合は真を、そうでない場合は偽を返します。デフォルトでは、モジュ
     ールレべルの関数 *note IS_CHARACTER_JUNK(): 27a4. であり、これは空
     白文字類 (空白またはタブ、改行文字をこれに含めてはいけません) をフ
     ィルタして排除します。

          >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
          ...              'ore\ntree\nemu\n'.splitlines(keepends=True))
          >>> print(''.join(diff), end="")
          - one
          ?  ^
          + ore
          ?  ^
          - two
          - three
          ?  -
          + tree
          + emu

 -- の関数: difflib.restore (sequence, which)

     差分を生成した元の二つのシーケンスのうち一つを返します。

     *note Differ.compare(): 27a6. または *note ndiff(): 279f. によって
     生成された 'sequence' を与えられると、行頭のプレフィクスを取りのぞ
     いてファイル 1 または 2 (引数 'which' で指定される) に由来する行を
     復元します。

     例:

          >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
          ...              'ore\ntree\nemu\n'.splitlines(keepends=True))
          >>> diff = list(diff) # materialize the generated delta into a list
          >>> print(''.join(restore(diff, 1)), end="")
          one
          two
          three
          >>> print(''.join(restore(diff, 2)), end="")
          ore
          tree
          emu

 -- の関数: difflib.unified_diff (a, b, fromfile='', tofile='',
          fromfiledate='', tofiledate='', n=3, lineterm='\n')

     'a' と 'b' (文字列のリスト) を比較し、差分 (差分形式の行を生成する
     *note ジェネレータ: 126c.) を、 unified diff フォーマット(以下「ユ
     ニファイド形式」)で返します。

     ユニファイド形式は変更があった行にコンテキストとなる前後数行を加え
     た、コンパクトな表現方法です。変更箇所は (変更前/変更後を分離したブ
     ロックではなく) インラインスタイルで表されます。コンテキストの行数
     は、'n' で指定し、デフォルト値は 3 です。

     デフォルトで、 diff 制御行 (‘---’, ‘+++’, ‘@@’ を含む行) は改行付き
     で生成されます。 *note io.IOBase.readlines(): 27a1. で作られた入力
     が *note io.IOBase.writelines(): 177a. で扱うのに適した diff になる
     ので (なぜなら入力と出力の両方が改行付きのため) 、これは有用です。

     行末に改行文字を持たない入力に対しては、出力でも改行文字を付加しな
     いように 'lineterm' 引数に ‘""’ を渡してください。

     The unified diff format normally has a header for filenames and
     modification times.  Any or all of these may be specified using
     strings for 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.
     The modification times are normally expressed in the ISO 8601
     format.  If not specified, the strings default to blanks.

          >>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']
          >>> s2 = ['python\n', 'eggy\n', 'hamster\n', 'guido\n']
          >>> sys.stdout.writelines(unified_diff(s1, s2, fromfile='before.py', tofile='after.py'))
          --- before.py
          +++ after.py
          @@ -1,4 +1,4 @@
          -bacon
          -eggs
          -ham
          +python
          +eggy
          +hamster
           guido

     より詳細な例は、 *note difflib のコマンドラインインターフェース:
     27a2. を参照してください。

 -- の関数: difflib.diff_bytes (dfunc, a, b, fromfile=b'', tofile=b'',
          fromfiledate=b'', tofiledate=b'', n=3, lineterm=b'\n')

     'dfunc' を使用して 'a' と 'b' (bytes オブジェクトのリスト) を比較し
     て、差分形式の行 (これも bytes オブジェクトです) を*dfunc* の戻り値
     の形式で返します。'dfunc' は、呼び出し可能である必要があります。一
     般に、これは *note unified_diff(): 1985. または *note
     context_diff(): 1986. です。

     未知のエンコーディングまたは一貫性のないエンコーディングのデータ同
     士を比較できます。'n' 以外のすべての入力は、bytes オブジェクトであ
     る必要があります。'n' 以外のすべての入力を損失なく str に変換して、
     ‘dfunc(a, b, fromfile, tofile, fromfiledate, tofiledate, n,
     lineterm)’ を呼び出すことにより動作します。'dfunc' の出力は、bytes
     型に変換されます。これにより、受け取る差分形式の行のエンコーディン
     グは、'a' と 'b' の未知または一貫性のないエンコーディングと同一にな
     ります。

     Added in version 3.5.

 -- の関数: difflib.IS_LINE_JUNK (line)

     無視できる行のとき ‘True’ を返します。行 'line' は空白、または
     ‘'#'’ ひとつのときに無視できます。それ以外のときには無視できません
     。古いバージョンでは *note ndiff(): 279f. の引数 'linejunk' にデフ
     ォルトで使用されました。

 -- の関数: difflib.IS_CHARACTER_JUNK (ch)

     無視できる文字のとき ‘True’ を返します。文字 'ch' が空白、またはタ
     ブ文字のときには無視できます。それ以外の時には無視できません。
     *note ndiff(): 279f. の引数 'charjunk' としてデフォルトで使用されま
     す。

参考
....

Pattern Matching: The Gestalt Approach(2)

     Discussion of a similar algorithm by John W. Ratcliff and D. E.
     Metzener.  This was published in Dr.  Dobb's Journal in July, 1988.

* Menu:

* SequenceMatcherオブジェクト::
* SequenceMatcher の例::
* Differ オブジェクト::
* Differ の例::
* difflib のコマンドラインインターフェース::
* ndiff example::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/difflib.py

   (2) 
https://jacobfilipp.com/DrDobbs/articles/DDJ/1988/8807/8807c/8807c.htm


File: python.info,  Node: SequenceMatcherオブジェクト,  Next: SequenceMatcher の例,  Up: difflib --- 差分の計算の補助

5.6.4.1 SequenceMatcherオブジェクト
...................................

*note SequenceMatcher: 121b. クラスには、以下のようなコンストラクタがあ
ります:

 -- クラス: difflib.SequenceMatcher (isjunk=None, a='', b='',
          autojunk=True)

     オプションの引数 'isjunk' は、‘None’ (デフォルトの値です) にするか
     、単一の引数をとる関数でなければなりません。後者の場合、関数はシー
     ケンスの要素を受け取り、要素が junk であり、無視すべきである場合に
     限り真を返すようにしなければなりません。'isjunk' に ‘None’ を渡すと
     、‘lambda x: False’ を渡したのと同じになります; すなわち、いかなる
     要素も無視しなくなります。例えば以下のような引数を渡すと:

          lambda x: x in " \t"

     空白とタブ文字を無視して文字のシーケンスを比較します。

     オプションの引数 'a' と 'b' は、比較される文字列で、デフォルトでは
     空の文字列です。両方のシーケンスの要素は、 *note ハッシュ可能: 824.
     である必要があります。

     オプションの引数 'autojunk' は、自動 junk ヒューリスティックを無効
     にするために使えます。

     バージョン 3.2 で変更: Added the 'autojunk' parameter.

     SequenceMatcher オブジェクトは3つのデータ属性を持っています:
     'bjunk' は、 'isjunk' が ‘True’ であるような 'b' の要素の集合です;
     'bpopular' は、 (無効でなければ) ヒューリスティックによって popular
     であると考えられる非ジャンク要素の集合です; 'b2j' は、 'b' の残りの
     要素をそれらが生じる位置のリストに写像する dict です。この 3 つは
     *note set_seqs(): 27a9. または *note set_seq2(): 27aa. で 'b' がリ
     セットされる場合は常にリセットされます。

     Added in version 3.2: 'bjunk' および 'bpopular' 属性。

     *note SequenceMatcher: 121b. オブジェクトは以下のメソッドを持ちます
     :

      -- メソッド: set_seqs (a, b)

          比較される2つの文字列を設定します。

     *note SequenceMatcher: 121b. オブジェクトは、2つ目のシーケンスにつ
     いての詳細な情報を計算し、キャッシュします。 1つのシーケンスをいく
     つものシーケンスと比較する場合、まず *note set_seq2(): 27aa. を使っ
     て文字列を設定しておき、別の文字列を1つずつ比較するために、繰り返し
     *note set_seq1(): 27ab. を呼び出します。

      -- メソッド: set_seq1 (a)

          比較を行う1つ目のシーケンスを設定します。比較される2つ目のシー
          ケンスは変更されません。

      -- メソッド: set_seq2 (b)

          比較を行う2つ目のシーケンスを設定します。比較される1つ目のシー
          ケンスは変更されません。

      -- メソッド: find_longest_match (alo=0, ahi=None, blo=0, bhi=None)

          ‘a[alo:ahi]’ と ‘b[blo:bhi]’ の中から、最長のマッチ列を探しま
          す。

          'isjunk' が省略されたか ‘None’ の時、 *note
          find_longest_match(): 1d4b. は ‘a[i:i+k]’ が ‘b[j:j+k]’ と等し
          いような ‘(i, j, k)’ を返します。その値は ‘alo <= i <= i+k <=
          ahi’ かつ ‘blo <= j <= j+k <= bhi’ となります。 ‘(i', j', k')’
          でも、同じようになります。さらに ‘k >= k'’, ‘i <= i'’ が ‘i ==
          i'’, ‘j <= j'’ でも同様です。言い換えると、いくつものマッチ列
          すべてのうち、 'a' 内で最初に始まるものを返します。そしてその
          'a' 内で最初のマッチ列すべてのうち 'b' 内で最初に始まるものを
          返します。

               >>> s = SequenceMatcher(None, " abcd", "abcd abcd")
               >>> s.find_longest_match(0, 5, 0, 9)
               Match(a=0, b=4, size=5)

          引数 'isjunk' が与えられている場合、上記の通り、はじめに最長の
          マッチ列を判定します。ブロック内に junk 要素が見当たらないよう
          な追加条件の際はこれに該当しません。次にそのマッチ列を、その両
          側の junk 要素にマッチするよう、できる限り広げていきます。その
          ため結果となる列は、探している列のたまたま直前にあった同一の
          junk 以外の junk にはマッチしません。

          以下は前と同じサンプルですが、空白を junk とみなしています。こ
          れは ‘' abcd'’ が2つ目の列の末尾にある ‘' abcd'’ にマッチしな
          いようにしています。代わりに ‘'abcd'’ にはマッチします。そして
          2つ目の文字列中、一番左の ‘'abcd'’ にマッチします:

               >>> s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd")
               >>> s.find_longest_match(0, 5, 0, 9)
               Match(a=1, b=0, size=4)

          どんな列にもマッチしない時は、‘(alo, blo, 0)’ を返します。

          このメソッドは *note named tuple: 85e. ‘Match(a, b, size)’ を
          返します。

          バージョン 3.9 で変更: デフォルト引数が追加されました。

      -- メソッド: get_matching_blocks ()

          マッチした互いに重複の無いシーケンスを表す、3つ組の値のリスト
          を返します。 それぞれの値は ‘(i, j, n)’ という形式で表され、
          ‘a[i:i+n] == b[j:j+n]’ という関係を意味します。3つの値は 'i' と
          'j' の間で単調に増加します。

          最後の3つ組はダミーで、‘(len(a), len(b), 0)’ という値を持ちま
          す。これは ‘n == 0’ である唯一のタプルです。もし ‘(i, j, n)’ と
          ‘(i', j', n')’ がリストで並んでいる3つ組で、2つ目が最後の3つ組
          でなければ、‘i+n < i'’ または ‘j+n < j'’ です。言い換えると並
          んでいる3つ組は常に隣接していない同じブロックを表しています。

               >>> s = SequenceMatcher(None, "abxcd", "abcd")
               >>> s.get_matching_blocks()
               [Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)]

      -- メソッド: get_opcodes ()

          'a' を 'b' にするための方法を記述する5つのタプルを返します。そ
          れぞれのタプルは ‘(tag, i1, i2, j1, j2)’ という形式であらわさ
          れます。最初のタプルは ‘i1 == j1 == 0’ であり、'i1' はその前に
          あるタプルの 'i2' と同じ値です。同様に 'j1' は前の 'j2' と同じ
          値になります。

          'tag' の値は文字列であり、次のような意味です:

          値                  意味
                              
          ----------------------------------------------------------------------
                              
          ‘'replace'’         ‘a[i1:i2]’ は ‘b[j1:j2]’ に置き換えられる。
                              
                              
          ‘'delete'’          ‘a[i1:i2]’ は削除される。この時、‘j1 == j2’ で
                              ある。
                              
                              
          ‘'insert'’          ‘b[j1:j2]’ が ‘a[i1:i1]’ に挿入される。この時
                              ‘i1 == i2’ である。
                              
                              
          ‘'equal'’           ‘a[i1:i2] == b[j1:j2]’ (サブシーケンスは等しい
                              ).
                              

          例えば:

               >>> a = "qabxcd"
               >>> b = "abycdf"
               >>> s = SequenceMatcher(None, a, b)
               >>> for tag, i1, i2, j1, j2 in s.get_opcodes():
               ...     print('{:7}   a[{}:{}] --> b[{}:{}] {!r:>8} --> {!r}'.format(
               ...         tag, i1, i2, j1, j2, a[i1:i2], b[j1:j2]))
               delete    a[0:1] --> b[0:0]      'q' --> ''
               equal     a[1:3] --> b[0:2]     'ab' --> 'ab'
               replace   a[3:4] --> b[2:3]      'x' --> 'y'
               equal     a[4:6] --> b[3:5]     'cd' --> 'cd'
               insert    a[6:6] --> b[5:6]       '' --> 'f'

      -- メソッド: get_grouped_opcodes (n=3)

          最大 'n' 行までのコンテキストを含むグループを生成するような、
          *note ジェネレータ: 126c. を返します。

          このメソッドは、 *note get_opcodes(): 27ad. で返されるグループ
          の中から、似たような差異のかたまりに分け、間に挟まっている変更
          の無い部分を省きます。

          グループは *note get_opcodes(): 27ad. と同じ書式で返されます。

      -- メソッド: ratio ()

          [0, 1] の範囲の浮動小数点数で、シーケンスの類似度を測る値を返
          します。

          T が2つのシーケンスの要素数の総計だと仮定し、M をマッチした数
          とすると、この値は 2.0*M / T であらわされます。もしシーケンス
          がまったく同じ場合、値は ‘1.0’ となり、まったく異なる場合には
          ‘0.0’ となります。

          このメソッドは *note get_matching_blocks(): 27ac. または *note
          get_opcodes(): 27ad. がまだ呼び出されていない場合には非常にコ
          ストが高いです。この場合、上限を素早く計算するために、 *note
          quick_ratio(): 27b0. もしくは *note real_quick_ratio(): 27b1.
          を最初に試してみる方がいいかもしれません。

               注釈: 注意: *note ratio(): 27af. の呼び出しの結果は引数の
               順序に依存します。例えば次の通りです:

                    >>> SequenceMatcher(None, 'tide', 'diet').ratio()
                    0.25
                    >>> SequenceMatcher(None, 'diet', 'tide').ratio()
                    0.5

      -- メソッド: quick_ratio ()

          *note ratio(): 27af. の上界を、より高速に計算します。

      -- メソッド: real_quick_ratio ()

          *note ratio(): 27af. の上界を、非常に高速に計算します。

The three methods that return the ratio of matching to total characters
can give different results due to differing levels of approximation,
although *note quick_ratio(): 27b0. and *note real_quick_ratio(): 27b1.
are always at least as large as *note ratio(): 27af.:

     >>> s = SequenceMatcher(None, "abcd", "bcde")
     >>> s.ratio()
     0.75
     >>> s.quick_ratio()
     0.75
     >>> s.real_quick_ratio()
     1.0


File: python.info,  Node: SequenceMatcher の例,  Next: Differ オブジェクト,  Prev: SequenceMatcherオブジェクト,  Up: difflib --- 差分の計算の補助

5.6.4.2 SequenceMatcher の例
............................

この例は2つの文字列を比較します。空白を "junk" とします:

     >>> s = SequenceMatcher(lambda x: x == " ",
     ...                     "private Thread currentThread;",
     ...                     "private volatile Thread currentThread;")

*note ratio(): 27af. returns a float in [0, 1], measuring the similarity
of the sequences.  As a rule of thumb, a *note ratio(): 27af. value over
0.6 means the sequences are close matches:

     >>> print(round(s.ratio(), 3))
     0.866

If you're only interested in where the sequences match, *note
get_matching_blocks(): 27ac. is handy:

     >>> for block in s.get_matching_blocks():
     ...     print("a[%d] and b[%d] match for %d elements" % block)
     a[0] and b[0] match for 8 elements
     a[8] and b[17] match for 21 elements
     a[29] and b[38] match for 0 elements

Note that the last tuple returned by *note get_matching_blocks(): 27ac.
is always a dummy, ‘(len(a), len(b), 0)’, and this is the only case in
which the last tuple element (number of elements matched) is ‘0’.

If you want to know how to change the first sequence into the second,
use *note get_opcodes(): 27ad.:

     >>> for opcode in s.get_opcodes():
     ...     print("%6s a[%d:%d] b[%d:%d]" % opcode)
      equal a[0:8] b[0:8]
     insert a[8:8] b[8:17]
      equal a[8:29] b[17:38]

参考
....

   * *note SequenceMatcher: 121b. を使った、シンプルで使えるコードを知る
     には、このモジュールの関数 *note get_close_matches(): 27a3. を参照
     してください。

   * Simple version control recipe(1) for a small application built with
     *note SequenceMatcher: 121b.

   ---------- Footnotes ----------

   (1) 
https://code.activestate.com/recipes/576729-simple-version-control/


File: python.info,  Node: Differ オブジェクト,  Next: Differ の例,  Prev: SequenceMatcher の例,  Up: difflib --- 差分の計算の補助

5.6.4.3 Differ オブジェクト
...........................

*note Differ: 279d. オブジェクトによって生成された差分が '最小' であるな
どとは言いません。むしろ、最小の差分はしばしば直観に反しています。その理
由は、どこでもできるとなれば一致を見いだしてしまうからで、ときには思いが
けなく100ページも離れたマッチになってしまうのです。一致点を互いに隣接し
たマッチに制限することで、場合によって長めの差分を出力するというコストを
掛けることにはなっても、ある種の局所性を保つことができるのです。

*note Differ: 279d. は、以下のようなコンストラクタを持ちます:

 -- クラス: difflib.Differ (linejunk=None, charjunk=None)

     オプションのキーワードパラメータ 'linejunk' と 'charjunk' は、フィ
     ルタ関数を渡します (使わないときは ‘None’):

     'linejunk': ひとつの文字列引数を受け取る関数です。文字列が junk の
     ときに真を返します。デフォルトでは、‘None’ であり、どんな行であって
     も junk とは見なされません。

     'charjunk': この関数は文字(長さ1の文字列)を引数として受け取り、文字
     が junk であるときに真を返します。デフォルトは ‘None’ であり、どん
     な文字も junk とは見なされません。

     これらの junk フィルター関数により、差分を発見するマッチングが高速
     化し、差分の行や文字が無視されることがなくなります。説明については
     、 *note find_longest_match(): 1d4b. メソッドの 'isjunk' 引数の説明
     をご覧ください。

     *note Differ: 279d. オブジェクトは、以下の1つのメソッドを通して利用
     されます。（差分を生成します）:

      -- メソッド: compare (a, b)

          文字列からなる2つのシーケンスを比較し、差分（を表す文字列から
          なるシーケンス）を生成します。

          各シーケンスの要素は、改行で終わる独立した単一行からなる文字列
          でなければなりません。そのようなシーケンスは、ファイル風オブジ
          ェクトの *note readlines(): 27a1. メソッドによって得ることがで
          きます。（得られる）差分は改行文字で終了する文字列のシーケンス
          として得られ、ファイル風オブジェクトの *note writelines():
          177a. メソッドによって出力できる形になっています。


File: python.info,  Node: Differ の例,  Next: difflib のコマンドラインインターフェース,  Prev: Differ オブジェクト,  Up: difflib --- 差分の計算の補助

5.6.4.4 Differ の例
...................

This example compares two texts.  First we set up the texts, sequences
of individual single-line strings ending with newlines (such sequences
can also be obtained from the *note readlines(): 27a1. method of
file-like objects):

     >>> text1 = '''  1. Beautiful is better than ugly.
     ...   2. Explicit is better than implicit.
     ...   3. Simple is better than complex.
     ...   4. Complex is better than complicated.
     ... '''.splitlines(keepends=True)
     >>> len(text1)
     4
     >>> text1[0][-1]
     '\n'
     >>> text2 = '''  1. Beautiful is better than ugly.
     ...   3.   Simple is better than complex.
     ...   4. Complicated is better than complex.
     ...   5. Flat is better than nested.
     ... '''.splitlines(keepends=True)

次に Differ オブジェクトをインスタンス化します:

     >>> d = Differ()

注意: *note Differ: 279d. オブジェクトをインスタンス化するとき、行 junk
と文字 junk をフィルタリングする関数を渡すことができます。詳細は *note
Differ(): 279d. コンストラクタを参照してください。

最後に、2つを比較します:

     >>> result = list(d.compare(text1, text2))

‘result’ は文字列のリストなので、pretty-printしてみましょう:

     >>> from pprint import pprint
     >>> pprint(result)
     ['    1. Beautiful is better than ugly.\n',
      '-   2. Explicit is better than implicit.\n',
      '-   3. Simple is better than complex.\n',
      '+   3.   Simple is better than complex.\n',
      '?     ++\n',
      '-   4. Complex is better than complicated.\n',
      '?            ^                     ---- ^\n',
      '+   4. Complicated is better than complex.\n',
      '?           ++++ ^                      ^\n',
      '+   5. Flat is better than nested.\n']

これは、複数行の文字列として、次のように出力されます:

     >>> import sys
     >>> sys.stdout.writelines(result)
         1. Beautiful is better than ugly.
     -   2. Explicit is better than implicit.
     -   3. Simple is better than complex.
     +   3.   Simple is better than complex.
     ?     ++
     -   4. Complex is better than complicated.
     ?            ^                     ---- ^
     +   4. Complicated is better than complex.
     ?           ++++ ^                      ^
     +   5. Flat is better than nested.


File: python.info,  Node: difflib のコマンドラインインターフェース,  Next: ndiff example,  Prev: Differ の例,  Up: difflib --- 差分の計算の補助

5.6.4.5 difflib のコマンドラインインターフェース
................................................

This example shows how to use difflib to create a ‘diff’-like utility.

     """ Command line interface to difflib.py providing diffs in four formats:

     * ndiff:    lists every line and highlights interline changes.
     * context:  highlights clusters of changes in a before/after format.
     * unified:  highlights clusters of changes in an inline format.
     * html:     generates side by side comparison with change highlights.

     """

     import sys, os, difflib, argparse
     from datetime import datetime, timezone

     def file_mtime(path):
         t = datetime.fromtimestamp(os.stat(path).st_mtime,
                                    timezone.utc)
         return t.astimezone().isoformat()

     def main():

         parser = argparse.ArgumentParser()
         parser.add_argument('-c', action='store_true', default=False,
                             help='Produce a context format diff (default)')
         parser.add_argument('-u', action='store_true', default=False,
                             help='Produce a unified format diff')
         parser.add_argument('-m', action='store_true', default=False,
                             help='Produce HTML side by side diff '
                                  '(can use -c and -l in conjunction)')
         parser.add_argument('-n', action='store_true', default=False,
                             help='Produce a ndiff format diff')
         parser.add_argument('-l', '--lines', type=int, default=3,
                             help='Set number of context lines (default 3)')
         parser.add_argument('fromfile')
         parser.add_argument('tofile')
         options = parser.parse_args()

         n = options.lines
         fromfile = options.fromfile
         tofile = options.tofile

         fromdate = file_mtime(fromfile)
         todate = file_mtime(tofile)
         with open(fromfile) as ff:
             fromlines = ff.readlines()
         with open(tofile) as tf:
             tolines = tf.readlines()

         if options.u:
             diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)
         elif options.n:
             diff = difflib.ndiff(fromlines, tolines)
         elif options.m:
             diff = difflib.HtmlDiff().make_file(fromlines,tolines,fromfile,tofile,context=options.c,numlines=n)
         else:
             diff = difflib.context_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)

         sys.stdout.writelines(diff)

     if __name__ == '__main__':
         main()


File: python.info,  Node: ndiff example,  Prev: difflib のコマンドラインインターフェース,  Up: difflib --- 差分の計算の補助

5.6.4.6 ndiff example
.....................

This example shows how to use *note difflib.ndiff(): 279f.

     """ndiff [-q] file1 file2
         or
     ndiff (-r1 | -r2) < ndiff_output > file1_or_file2

     Print a human-friendly file difference report to stdout.  Both inter-
     and intra-line differences are noted.  In the second form, recreate file1
     (-r1) or file2 (-r2) on stdout, from an ndiff report on stdin.

     In the first form, if -q ("quiet") is not specified, the first two lines
     of output are

     -: file1
     +: file2

     Each remaining line begins with a two-letter code:

         "- "    line unique to file1
         "+ "    line unique to file2
         "  "    line common to both files
         "? "    line not present in either input file

     Lines beginning with "? " attempt to guide the eye to intraline
     differences, and were not present in either input file.  These lines can be
     confusing if the source files contain tab characters.

     The first file can be recovered by retaining only lines that begin with
     "  " or "- ", and deleting those 2-character prefixes; use ndiff with -r1.

     The second file can be recovered similarly, but by retaining only "  " and
     "+ " lines; use ndiff with -r2; or, on Unix, the second file can be
     recovered by piping the output through

         sed -n '/^[+ ] /s/^..//p'
     """

     __version__ = 1, 7, 0

     import difflib, sys

     def fail(msg):
         out = sys.stderr.write
         out(msg + "\n\n")
         out(__doc__)
         return 0

     # open a file & return the file object; gripe and return 0 if it
     # couldn't be opened
     def fopen(fname):
         try:
             return open(fname)
         except IOError as detail:
             return fail("couldn't open " + fname + ": " + str(detail))

     # open two files & spray the diff to stdout; return false iff a problem
     def fcompare(f1name, f2name):
         f1 = fopen(f1name)
         f2 = fopen(f2name)
         if not f1 or not f2:
             return 0

         a = f1.readlines(); f1.close()
         b = f2.readlines(); f2.close()
         for line in difflib.ndiff(a, b):
             print(line, end=' ')

         return 1

     # crack args (sys.argv[1:] is normal) & compare;
     # return false iff a problem

     def main(args):
         import getopt
         try:
             opts, args = getopt.getopt(args, "qr:")
         except getopt.error as detail:
             return fail(str(detail))
         noisy = 1
         qseen = rseen = 0
         for opt, val in opts:
             if opt == "-q":
                 qseen = 1
                 noisy = 0
             elif opt == "-r":
                 rseen = 1
                 whichfile = val
         if qseen and rseen:
             return fail("can't specify both -q and -r")
         if rseen:
             if args:
                 return fail("no args allowed with -r option")
             if whichfile in ("1", "2"):
                 restore(whichfile)
                 return 1
             return fail("-r value must be 1 or 2")
         if len(args) != 2:
             return fail("need 2 filename args")
         f1name, f2name = args
         if noisy:
             print('-:', f1name)
             print('+:', f2name)
         return fcompare(f1name, f2name)

     # read ndiff output from stdin, and print file1 (which=='1') or
     # file2 (which=='2') to stdout

     def restore(which):
         restored = difflib.restore(sys.stdin.readlines(), which)
         sys.stdout.writelines(restored)

     if __name__ == '__main__':
         main(sys.argv[1:])


File: python.info,  Node: textwrap --- テキストの折り返しと詰め込み,  Next: unicodedata --- Unicode データベース,  Prev: difflib --- 差分の計算の補助,  Up: テキスト処理サービス

5.6.5 ‘textwrap’ -- テキストの折り返しと詰め込み
------------------------------------------------

'ソースコード:' Lib/textwrap.py(1)

__________________________________________________________________

The ‘textwrap’ module provides some convenience functions, as well as
*note TextWrapper: 11cf, the class that does all the work.  If you're
just wrapping or filling one or two text strings, the convenience
functions should be good enough; otherwise, you should use an instance
of *note TextWrapper: 11cf. for efficiency.

 -- の関数: textwrap.wrap (text, width=70, *, initial_indent='',
          subsequent_indent='', expand_tabs=True,
          replace_whitespace=True, fix_sentence_endings=False,
          break_long_words=True, drop_whitespace=True,
          break_on_hyphens=True, tabsize=8, max_lines=None,
          placeholder=' [...]')

     'text' (文字列)内の段落を一つだけ折り返しを行います。したがって、す
     べての行が高々 'width' 文字の長さになります。最後に改行が付かない出
     力行のリストを返します。

     オプションのキーワード引数は、以下で説明する *note TextWrapper:
     11cf. のインスタンス属性に対応しています。

     *note wrap(): 16e0. の動作についての詳細は *note
     TextWrapper.wrap(): 27bd. メソッドを参照してください。

 -- の関数: textwrap.fill (text, width=70, *, initial_indent='',
          subsequent_indent='', expand_tabs=True,
          replace_whitespace=True, fix_sentence_endings=False,
          break_long_words=True, drop_whitespace=True,
          break_on_hyphens=True, tabsize=8, max_lines=None,
          placeholder=' [...]')

     'text' 内の段落を一つだけ折り返しを行い、折り返しが行われた段落を含
     む一つの文字列を返します。 *note fill(): 16df. はこれの省略表現です

          "\n".join(wrap(text, ...))

     特に、 *note fill(): 16df. は *note wrap(): 16e0. とまったく同じ名
     前のキーワード引数を受け取ります。

 -- の関数: textwrap.shorten (text, width, *,
          fix_sentence_endings=False, break_long_words=True,
          break_on_hyphens=True, placeholder=' [...]')

     与えられた 'text' を折りたたみ、切り詰めて、与えられた 'width' に収
     まるようにします。

     最初に、'text' 内の空白が折りたたまれます (すべての空白を、1 文字の
     空白文字で置き換えます)。結果が 'width' 内に収まった場合、その結果
     が返されます。width に収まらない場合、残りの文字数と 'placeholder'
     との和が 'width' 内に収まるように、末尾から単語が切り捨てられます:

          >>> textwrap.shorten("Hello  world!", width=12)
          'Hello world!'
          >>> textwrap.shorten("Hello  world!", width=11)
          'Hello [...]'
          >>> textwrap.shorten("Hello world", width=10, placeholder="...")
          'Hello...'

     オプションのキーワード引数は、以下で説明する *note TextWrapper:
     11cf. インスタンスの属性に対応します。文字列が *note TextWrapper:
     11cf. の *note fill(): 16df. 関数に渡される前に、空白が折りたたまれ
     ます。そのため、*note tabsize: 27be.、*note expand_tabs: 27bf.、
     *note drop_whitespace: 27c0.、*note replace_whitespace: 27c1. の値
     を変更しても、意味がありません。

     Added in version 3.4.

 -- の関数: textwrap.dedent (text)

     'text' の各行に対し、共通して現れる先頭の空白を削除します。

     この関数は通常、三重引用符で囲われた文字列をスクリーン/その他の左端
     にそろえ、なおかつソースコード中ではインデントされた形式を損なわな
     いようにするために使われます。

     タブとスペースはともにホワイトスペースとして扱われますが、同じでは
     ないことに注意してください: ‘" hello"’ という行と ‘"\thello"’ は、
     同じ先頭の空白文字をもっていないとみなされます。

     空白文字しか含まない行は入力の際に無視され、出力の際に単一の改行文
     字に正規化されます。

     例えば:

          def test():
              # end first line with \ to avoid the empty line!
              s = '''\
              hello
                world
              '''
              print(repr(s))          # prints '    hello\n      world\n    '
              print(repr(dedent(s)))  # prints 'hello\n  world\n'

     バージョン 3.14 で変更: The ‘dedent()’ function now correctly
     normalizes blank lines containing only whitespace characters.
     Previously, the implementation only normalized blank lines
     containing tabs and spaces.

 -- の関数: textwrap.indent (text, prefix, predicate=None)

     'text' の中の選択された行の先頭に 'prefix' を追加します。

     行の分割は ‘text.splitlines(True)’ で行います。

     デフォルトでは、(改行文字を含む)空白文字だけの行を除いてすべての行
     に 'prefix' を追加します。

     例えば:

          >>> s = 'hello\n\n \nworld'
          >>> indent(s, '  ')
          '  hello\n\n \n  world'

     省略可能な 'predicate' 引数を使って、どの行をインデントするかを制御
     することができます。例えば、空行や空白文字のみの行にも 'prefix' を
     追加するのは簡単です:

          >>> print(indent(s, '+ ', lambda line: True))
          + hello
          +
          +
          + world

     Added in version 3.3.

*note wrap(): 16e0.、*note fill(): 16df.、*note shorten(): 11d2. は
*note TextWrapper: 11cf. インスタンスを作成し、その一つのメソッドを呼び
出すことで機能します。そのインスタンスは再利用されません。したがって、
*note wrap(): 16e0. や *note fill(): 16df. を使用して多くのテキスト文字
列を処理するアプリケーションについては、独自の *note TextWrapper: 11cf.
オブジェクトを作成する方が効率が良い方法でしょう。

テキストはなるべく空白か、ハイフンを含む語のハイフンの直後で折り返されま
す。 *note TextWrapper.break_long_words: 27c2. が偽に設定されていなけれ
ば、必要な場合に長い語が分解されます。

 -- クラス: textwrap.TextWrapper (**kwargs)

     *note TextWrapper: 11cf. コンストラクタはたくさんのオプションのキー
     ワード引数を受け取ります。それぞれのキーワード引数は一つのインスタ
     ンス属性に対応します。したがって、例えば

          wrapper = TextWrapper(initial_indent="* ")

     はこれと同じです

          wrapper = TextWrapper()
          wrapper.initial_indent = "* "

     同じ *note TextWrapper: 11cf. オブジェクトは何回も再利用できます。
     また、使用中にインスタンス属性へ代入することでそのオプションのどれ
     でも変更できます。

     *note TextWrapper: 11cf. インスタンス属性(とコンストラクタのキーワ
     ード引数)は以下の通りです:

      -- の属性: width

          (デフォルト: ‘70’) 折り返しが行われる行の最大の長さ。入力行に
          *note width: 27c3. より長い単一の語が無い限り、 *note
          TextWrapper: 11cf. は *note width: 27c3. 文字より長い出力行が
          無いことを保証します。

      -- の属性: expand_tabs

          (デフォルト: ‘True’) もし真ならば、そのときは 'text' 内のすべ
          てのタブ文字は 'text' の *note expandtabs(): 2647. メソッドを
          用いて空白に展開されます。

      -- の属性: tabsize

          (デフォルト: ‘8’) *note expand_tabs: 27bf. が真の場合、 'text'
          の中のすべてのTAB文字は tabsize と現在のカラムに応じて、ゼロ以
          上のスペースに展開されます。

          Added in version 3.3.

      -- の属性: replace_whitespace

          (デフォルト: ‘True’) 真の場合、 *note wrap(): 16e0. メソッドは
          タブの展開の後、 wrap 処理の前に各種空白文字をスペース1文字に
          置換します。置換される空白文字は: TAB, 改行, 垂直TAB, FF, CR
          (‘'\t\n\v\f\r'’) です。

               注釈: *note expand_tabs: 27bf. が偽で *note
               replace_whitespace: 27c1. が真ならば、各タブ文字は1つの空
               白に置き換えられます。それはタブ展開と同じでは 'ありませ
               ん' 。

               注釈: *note replace_whitespace: 27c1. が偽の場合、改行が
               行の途中で現れることで出力がおかしくなることがあります。
               このため、テキストを(*note str.splitlines(): 146e. などを
               使って)段落ごとに分けて別々に wrap する必要があります。

      -- の属性: drop_whitespace

          (デフォルト: ‘True’) 真の場合、(wrap 処理のあとインデント処理
          の前に) 各行の最初と最後の空白文字を削除します。ただし、段落の
          最初の空白については、次の文字が空白文字でない場合は削除されま
          せん。削除される空白文字が行全体に及ぶ場合は、行自体を削除しま
          す。

      -- の属性: initial_indent

          (default: ‘''’) wrap の出力の最初の行の先頭に付与する文字列。
          最初の行の長さに加算されます。空文字列の場合インデントされませ
          ん。

      -- の属性: subsequent_indent

          (デフォルト: ‘''’) 一行目以外の折り返しが行われる出力のすべて
          の行の先頭に付けられる文字列。一行目以外の各行の折り返しまでの
          長さにカウントされます。

      -- の属性: fix_sentence_endings

          (デフォルト: ‘False’) もし真ならば、 *note TextWrapper: 11cf.
          は文の終わりを見つけようとし、確実に文がちょうど二つの空白で常
          に区切られているようにします。これは一般的に固定スペースフォン
          トのテキストに対して望ましいです。しかし、文の検出アルゴリズム
          は完全ではありません: 文の終わりには、後ろに空白がある ‘'.'’,
          ‘'!'’ または ‘'?'’ の中の一つ、ことによると ‘'"'’ あるいは
          ‘"'"’ が付随する小文字があると仮定しています。このアルゴリズム
          に伴う一つの問題は下記の"Dr."と

               [...] Dr. Frankenstein's monster [...]

          下記の"Spot."の間の差異を検出できないことです

               [...] See Spot. See Spot run [...]

          *note fix_sentence_endings: 27c6. はデフォルトで偽です。

          文検出アルゴリズムは"小文字"の定義のために ‘string.lowercase’
          に依存し、同一行の文を区切るためにピリオドの後に二つの空白を使
          う慣習に依存しているため、英文テキストに限定されたものです。

      -- の属性: break_long_words

          (デフォルト: ‘True’) もし真ならば、そのとき *note width: 27c3.
          より長い行が確実にないようにするために、 *note width: 27c3. よ
          り長い語は切られます。偽ならば、長い語は切られないでしょう。そ
          して、 *note width: 27c3. より長い行があるかもしれません。
          (*note width: 27c3. を超える分を最小にするために、長い語は単独
          で一行に置かれるでしょう。)

      -- の属性: break_on_hyphens

          (デフォルト: ‘True’) 真の場合、英語で一般的なように、ラップ処
          理は空白か合成語に含まれるハイフンの直後で行われます。偽の場合
          、空白だけが改行に適した位置として判断されます。ただし、本当に
          語の途中で改行が行われないようにするためには、 *note
          break_long_words: 27c2. 属性を真に設定する必要があります。過去
          のバージョンでのデフォルトの振る舞いは、常にハイフンの直後での
          改行を許していました。

      -- の属性: max_lines

          (デフォルト ‘None’) ‘None’ 以外の場合、出力は行数 'max_lines'
          を超えないようにされ、切り詰める際には出力の最後の行を
          'placeholder' に置き換えます。

          Added in version 3.4.

      -- の属性: placeholder

          (デフォルト: ‘' [...]'’) 切り詰める場合に出力の最後の行に置く
          文字列です。

          Added in version 3.4.

     *note TextWrapper: 11cf. はモジュールレベルの簡易関数に類似したいく
     つかの公開メソッドも提供します:

      -- メソッド: wrap (text)

          1段落の文字列 'text' を、各行が *note width: 27c3. 文字以下に
          なるように wrap します。 wrap のすべてのオプションは *note
          TextWrapper: 11cf. インスタンスの属性から取得します。結果の、
          行末に改行のない行のリストを返します。出力の内容が空になる場合
          は、返すリストも空になります。

      -- メソッド: fill (text)

          'text' 内の段落を一つだけ折り返しを行い、折り返しが行われた段
          落を含む一つの文字列を返します。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/textwrap.py


File: python.info,  Node: unicodedata --- Unicode データベース,  Next: stringprep --- インターネットの文字列調製,  Prev: textwrap --- テキストの折り返しと詰め込み,  Up: テキスト処理サービス

5.6.6 ‘unicodedata’ -- Unicode データベース
-------------------------------------------

__________________________________________________________________

This module provides access to the Unicode Character Database (UCD)
which defines character properties for all Unicode characters.  The data
contained in this database is compiled from the UCD version 16.0.0(1).

このモジュールは、ユニコード標準付録 #44 「 ユニコード文字データベース
(2) 」で定義されているのと同じ名前およびシンボルを使用します。このモジュ
ールは次のような関数を定義します:

参考
....

The *note Unicode HOWTO: 14bc. for more information about Unicode and
how to use this module.

 -- の関数: unicodedata.lookup (name)

     Look up character by name.  If a character with the given name is
     found, return the corresponding character.  If not found, *note
     KeyError: 5e7. is raised.  For example:

          >>> unicodedata.lookup('LEFT CURLY BRACKET')
          '{'

     The characters returned by this function are the same as those
     produced by ‘\N’ escape sequence in string literals.  For example:

          >>> unicodedata.lookup('MIDDLE DOT') == '\N{MIDDLE DOT}'
          True

     バージョン 3.3 で変更: name aliases (3) と named sequences (4) のサ
     ポートが追加されました。

 -- の関数: unicodedata.name (chr, default=None, /)

     Returns the name assigned to the character 'chr' as a string.  If
     no name is defined, 'default' is returned, or, if not given, *note
     ValueError: 2ec. is raised.  For example:

          >>> unicodedata.name('½')
          'VULGAR FRACTION ONE HALF'
          >>> unicodedata.name('\uFFFF', 'fallback')
          'fallback'

 -- の関数: unicodedata.decimal (chr, default=None, /)

     Returns the decimal value assigned to the character 'chr' as
     integer.  If no such value is defined, 'default' is returned, or,
     if not given, *note ValueError: 2ec. is raised.  For example:

          >>> unicodedata.decimal('\N{ARABIC-INDIC DIGIT NINE}')
          9
          >>> unicodedata.decimal('\N{SUPERSCRIPT NINE}', -1)
          -1

 -- の関数: unicodedata.digit (chr, default=None, /)

     Returns the digit value assigned to the character 'chr' as integer.
     If no such value is defined, 'default' is returned, or, if not
     given, *note ValueError: 2ec. is raised:

          >>> unicodedata.digit('\N{SUPERSCRIPT NINE}')
          9

 -- の関数: unicodedata.numeric (chr, default=None, /)

     Returns the numeric value assigned to the character 'chr' as float.
     If no such value is defined, 'default' is returned, or, if not
     given, *note ValueError: 2ec. is raised:

          >>> unicodedata.numeric('½')
          0.5

 -- の関数: unicodedata.category (chr)

     Returns the general category assigned to the character 'chr' as
     string.  General category names consist of two letters.  See the
     General Category Values section of the Unicode Character Database
     documentation(5) for a list of category codes.  For example:

          >>> unicodedata.category('A')  # 'L'etter, 'u'ppercase
          'Lu'

 -- の関数: unicodedata.bidirectional (chr)

     Returns the bidirectional class assigned to the character 'chr' as
     string.  If no such value is defined, an empty string is returned.
     See the Bidirectional Class Values section of the Unicode Character
     Database(6) documentation for a list of bidirectional codes.  For
     example:

          >>> unicodedata.bidirectional('\N{ARABIC-INDIC DIGIT SEVEN}') # 'A'rabic, 'N'umber
          'AN'

 -- の関数: unicodedata.combining (chr)

     Returns the canonical combining class assigned to the character
     'chr' as integer.  Returns ‘0’ if no combining class is defined.
     See the Canonical Combining Class Values section of the Unicode
     Character Database(7) for more information.

 -- の関数: unicodedata.east_asian_width (chr)

     Returns the east asian width assigned to the character 'chr' as
     string.  For a list of widths and or more information, see the
     Unicode Standard Annex #11(8).

 -- の関数: unicodedata.mirrored (chr)

     Returns the mirrored property assigned to the character 'chr' as
     integer.  Returns ‘1’ if the character has been identified as a
     "mirrored" character in bidirectional text, ‘0’ otherwise.  For
     example:

          >>> unicodedata.mirrored('>')
          1

 -- の関数: unicodedata.decomposition (chr)

     Returns the character decomposition mapping assigned to the
     character 'chr' as string.  An empty string is returned in case no
     such mapping is defined.  For example:

          >>> unicodedata.decomposition('Ã')
          '0041 0303'

 -- の関数: unicodedata.normalize (form, unistr)

     Unicode 文字列 'unistr' の正規形 'form' を返します。 'form' の有効
     な値は、'NFC'、'NFKC'、'NFD'、'NFKD' です。

     Unicode 規格は標準等価性 (canonical equivalence) と互換等価性
     (compatibility equivalence) に基づいて、様々な Unicode文字列の正規
     形を定義します。Unicode では、複数の方法で表現できる文字があります
     。たとえば、文字 U+00C7 (LATIN CAPITAL LETTER C WITH CEDILLA) は、
     U+0043 (LATIN CAPITAL LETTER C) U+0327 (COMBINING CEDILLA) というシ
     ーケンスとしても表現できます。

     各文字には2つの正規形があり、それぞれ正規形 C と正規形 D といいます
     。正規形 D (NFD) は標準分解 (canonical decomposition) としても知ら
     れており、各文字を分解された形に変換します。正規形 C (NFC) は標準分
     解を適用した後、結合済文字を再構成します。

     In addition to these two forms, there are two additional normal
     forms based on compatibility equivalence.  In Unicode, certain
     characters are supported which normally would be unified with other
     characters.  For example, U+2160 (ROMAN NUMERAL ONE) is really the
     same thing as U+0049 (LATIN CAPITAL LETTER I). However, it is
     supported in Unicode for compatibility with existing character sets
     (for example, gb2312).

     The normal form KD (NFKD) will apply the compatibility
     decomposition, that is, replace all compatibility characters with
     their equivalents.  The normal form KC (NFKC) first applies the
     compatibility decomposition, followed by the canonical composition.

     2つのunicode文字列が正規化されていて人間の目に同じに見えても、片方
     が結合文字を持っていてもう片方が持っていない場合、それらは完全に同
     じではありません。

 -- の関数: unicodedata.is_normalized (form, unistr)

     Unicode 文字列 'unistr' が正規形 'form' かどうかを返します。 'form'
     の有効な値は、'NFC'、'NFKC'、'NFD'、'NFKD' です。

     Added in version 3.8.

更に、本モジュールは以下の定数を公開します:

 -- データ: unicodedata.unidata_version

     このモジュールで使われている Unicode データベースのバージョン。

 -- データ: unicodedata.ucd_3_2_0

     これはモジュール全体と同じメソッドを具えたオブジェクトですが、
     Unicode データベースバージョン 3.2 を代わりに使っており、この特定の
     バージョンの Unicode データベースを必要とするアプリケーション(IDNA
     など)のためものです。

脚注
....

   ---------- Footnotes ----------

   (1) https://www.unicode.org/Public/16.0.0/ucd

   (2) https://www.unicode.org/reports/tr44/

   (3) ‘https://www.unicode.org/Public/16.0.0/ucd/NameAliases.txt’

   (4) ‘https://www.unicode.org/Public/16.0.0/ucd/NamedSequences.txt’

   (5) 
https://www.unicode.org/reports/tr44/tr44-34.html#General_Category_Values

   (6) 
https://www.unicode.org/reports/tr44/tr44-34.html#Bidi_Class_Values

   (7) 
https://www.unicode.org/reports/tr44/tr44-34.html#Canonical_Combining_Class_Values

   (8) https://www.unicode.org/reports/tr11/tr11-43.html


File: python.info,  Node: stringprep --- インターネットの文字列調製,  Next: readline --- GNU readline のインターフェース,  Prev: unicodedata --- Unicode データベース,  Up: テキスト処理サービス

5.6.7 ‘stringprep’ -- インターネットの文字列調製
------------------------------------------------

'ソースコード:' Lib/stringprep.py(1)

__________________________________________________________________

(ホスト名のような) インターネット上にある存在に識別名をつける際、しばし
ば識別名間の "等価性" 比較を行う必要があります。厳密には、例えば大小文字
の区別をするかしないかいったように、比較をどのように行うかはアプリケーシ
ョンの領域に依存します。また、例えば "印字可能な" 文字で構成された識別名
だけを許可するといったように、可能な識別名を制限することも必要となるかも
しれません。

RFC 3454(2) では、インターネットプロトコル上で Unicode 文字列を "調製
(prepare)" するためのプロシジャを定義しています。文字列は通信路に載せら
れる前に調製プロシジャで処理され、その結果ある正規化された形式になります
。RFC ではあるテーブルの集合を定義しており、それらはプロファイルにまとめ
られています。各プロファイルでは、どのテーブルを使い、 ‘stringprep’ プロ
シジャのどのオプション部分がプロファイルの一部になっているかを定義してい
ます。 ‘stringprep’ プロファイルの一つの例は ‘nameprep’ で、国際化された
ドメイン名に使われます。

The module ‘stringprep’ only exposes the tables from RFC 3454(3).  As
these tables would be very large to represent as dictionaries or lists,
the module uses the Unicode character database internally.  The module
source code itself was generated using the ‘mkstringprep.py’ utility.

As a result, these tables are exposed as functions, not as data
structures.  There are two kinds of tables in the RFC: sets and
mappings.  For a set, ‘stringprep’ provides the "characteristic
function", i.e.  a function that returns ‘True’ if the parameter is part
of the set.  For mappings, it provides the mapping function: given the
key, it returns the associated value.  Below is a list of all functions
available in the module.

 -- の関数: stringprep.in_table_a1 (code)

     'code' がテーブル A.1 (Unicode 3.2 における未割り当てコードポイント
     : unassigned code point) かどうか判定します。

 -- の関数: stringprep.in_table_b1 (code)

     'code' がテーブル B.1 (一般には何にも対応付けられていない: commonly
     mapped to nothing) かどうか判定します。

 -- の関数: stringprep.map_table_b2 (code)

     テーブル B.2 (NFKC で用いられる大小文字の対応付け) に従って、'code'
     に対応付けられた値を返します。

 -- の関数: stringprep.map_table_b3 (code)

     テーブル B.3 (正規化を伴わない大小文字の対応付け) に従って、'code'
     に対応付けられた値を返します。

 -- の関数: stringprep.in_table_c11 (code)

     'code' がテーブル C.1.1 (ASCII スペース文字) かどうか判定します。

 -- の関数: stringprep.in_table_c12 (code)

     'code' がテーブル C.1.2 (非 ASCII スペース文字) かどうか判定します
     。

 -- の関数: stringprep.in_table_c11_c12 (code)

     'code' がテーブル C.1 (スペース文字、C.1.1 および C.1.2 の和集合) か
     どうか判定します。

 -- の関数: stringprep.in_table_c21 (code)

     'code' がテーブル C.2.1 (ASCII 制御文字) かどうか判定します。

 -- の関数: stringprep.in_table_c22 (code)

     'code' がテーブル C.2.2 (非 ASCII 制御文字) かどうか判定します。

 -- の関数: stringprep.in_table_c21_c22 (code)

     'code' がテーブル C.2 (制御文字、C.2.1 および C.2.2 の和集合) かど
     うか判定します。

 -- の関数: stringprep.in_table_c3 (code)

     'code' がテーブル C.3 (プライベート利用) かどうか判定します。

 -- の関数: stringprep.in_table_c4 (code)

     'code' がテーブル C.4 (非文字コードポイント: non-character code
     points) かどうか判定します。

 -- の関数: stringprep.in_table_c5 (code)

     'code' がテーブル C.5 (サロゲーションコード) かどうか判定します。

 -- の関数: stringprep.in_table_c6 (code)

     'code' がテーブル C.6 (平文:plain text として不適切) かどうか判定し
     ます。

 -- の関数: stringprep.in_table_c7 (code)

     'code' がテーブル C.7 (標準表現:canonical representation として不適
     切) かどうか判定します。

 -- の関数: stringprep.in_table_c8 (code)

     'code' がテーブル C.8 (表示プロパティの変更または撤廃) かどうか判定
     します。

 -- の関数: stringprep.in_table_c9 (code)

     'code' がテーブル C.9 (タグ文字) かどうか判定します。

 -- の関数: stringprep.in_table_d1 (code)

     'code' がテーブル D.1 (双方向プロパティ "R" または "AL" を持つ文字)
     かどうか判定します。

 -- の関数: stringprep.in_table_d2 (code)

     'code' がテーブル D.2 (双方向プロパティ "L" を持つ文字) かどうか判
     定します。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/stringprep.py

   (2) https://datatracker.ietf.org/doc/html/rfc3454.html

   (3) https://datatracker.ietf.org/doc/html/rfc3454.html


File: python.info,  Node: readline --- GNU readline のインターフェース,  Next: rlcompleter --- GNU readline の補完機能,  Prev: stringprep --- インターネットの文字列調製,  Up: テキスト処理サービス

5.6.8 ‘readline’ -- GNU readline のインターフェース
---------------------------------------------------

__________________________________________________________________

The ‘readline’ module defines a number of functions to facilitate
completion and reading/writing of history files from the Python
interpreter.  This module can be used directly, or via the *note
rlcompleter: c2. module, which supports completion of Python identifiers
at the interactive prompt.  Settings made using this module affect the
behaviour of both the interpreter's interactive prompt and the prompts
offered by the built-in *note input(): 14f0. function.

readline のキーバインディングは初期化ファイルで設定できます。 このファイ
ルは、たいていはホームディレクトリに ‘.inputrc’ という名前で置いてありま
す。 GNU Readline マニュアルの Readline Init File(1) を参照して、そのフ
ァイルの形式や可能な構成、 Readline ライブラリ全体の機能を知ってください
。

*note Availability: 213f.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 225c. と *note
WebAssemblyプラットフォーム: 1b6a. をサポートしません。

This is an *note optional module: 215a.  If it is missing from your copy
of CPython, look for documentation from your distributor (that is,
whoever provided Python to you).  If you are the distributor, see *note
オプションのモジュールの要件: 2158.

*note Availability: 213f.: Unix.

     注釈: The underlying Readline library API may be implemented by the
     ‘editline’ (‘libedit’) library instead of GNU readline.  On macOS
     the ‘readline’ module detects which library is being used at run
     time.

     The configuration file for ‘editline’ is different from that of GNU
     readline.  If you programmatically load configuration strings you
     can use *note backend: 1a27. to determine which library is being
     used.

     If you use ‘editline’/‘libedit’ readline emulation on macOS, the
     initialization file located in your home directory is named
     ‘.editrc’.  For example, the following content in ‘~/.editrc’ will
     turn ON 'vi' keybindings and TAB completion:

          python:bind -v
          python:bind ^I rl_complete

     Also note that different libraries may use different history file
     formats.  When switching the underlying library, existing history
     files may become unusable.

 -- データ: readline.backend

     The name of the underlying Readline library being used, either
     ‘"readline"’ or ‘"editline"’.

     Added in version 3.13.

* Menu:

* 初期化ファイル::
* 行バッファ::
* 履歴ファイル::
* 履歴リスト::
* 開始フック::
* 補完::
* 使用例: 使用例<2>.

   ---------- Footnotes ----------

   (1) 
https://tiswww.cwru.edu/php/chet/readline/rluserman.html#Readline-Init-File


File: python.info,  Node: 初期化ファイル,  Next: 行バッファ,  Up: readline --- GNU readline のインターフェース

5.6.8.1 初期化ファイル
......................

以下の関数は初期化ファイルならびにユーザ設定関連のものです:

 -- の関数: readline.parse_and_bind (string)

     Execute the init line provided in the 'string' argument.  This
     calls ‘rl_parse_and_bind()’ in the underlying library.

 -- の関数: readline.read_init_file ([filename])

     Execute a readline initialization file.  The default filename is
     the last filename used.  This calls ‘rl_read_init_file()’ in the
     underlying library.  It raises an *note auditing event: 1c6e.
     ‘open’ with the file name if given, and ‘"<readline_init_file>"’
     otherwise, regardless of which file the library resolves.

     バージョン 3.14 で変更: The auditing event was added.


File: python.info,  Node: 行バッファ,  Next: 履歴ファイル,  Prev: 初期化ファイル,  Up: readline --- GNU readline のインターフェース

5.6.8.2 行バッファ
..................

以下の関数は行バッファを操作します:

 -- の関数: readline.get_line_buffer ()

     Return the current contents of the line buffer (‘rl_line_buffer’ in
     the underlying library).

 -- の関数: readline.insert_text (string)

     Insert text into the line buffer at the cursor position.  This
     calls ‘rl_insert_text()’ in the underlying library, but ignores the
     return value.

 -- の関数: readline.redisplay ()

     Change what's displayed on the screen to reflect the current
     contents of the line buffer.  This calls ‘rl_redisplay()’ in the
     underlying library.


File: python.info,  Node: 履歴ファイル,  Next: 履歴リスト,  Prev: 行バッファ,  Up: readline --- GNU readline のインターフェース

5.6.8.3 履歴ファイル
....................

以下の関数は履歴ファイルを操作します:

 -- の関数: readline.read_history_file ([filename])

     Load a readline history file, and append it to the history list.
     The default filename is ‘~/.history’.  This calls ‘read_history()’
     in the underlying library and raises an *note auditing event: 1c6e.
     ‘open’ with the file name if given and ‘"~/.history"’ otherwise.

     バージョン 3.14 で変更: The auditing event was added.

 -- の関数: readline.write_history_file ([filename])

     Save the history list to a readline history file, overwriting any
     existing file.  The default filename is ‘~/.history’.  This calls
     ‘write_history()’ in the underlying library and raises an *note
     auditing event: 1c6e. ‘open’ with the file name if given and
     ‘"~/.history"’ otherwise.

     バージョン 3.14 で変更: The auditing event was added.

 -- の関数: readline.append_history_file (nelements[, filename])

     Append the last 'nelements' items of history to a file.  The
     default filename is ‘~/.history’.  The file must already exist.
     This calls ‘append_history()’ in the underlying library.  This
     function only exists if Python was compiled for a version of the
     library that supports it.  It raises an *note auditing event: 1c6e.
     ‘open’ with the file name if given and ‘"~/.history"’ otherwise.

     Added in version 3.5.

     バージョン 3.14 で変更: The auditing event was added.

 -- の関数: readline.get_history_length ()
 -- の関数: readline.set_history_length (length)

     Set or return the desired number of lines to save in the history
     file.  The *note write_history_file(): 17dc. function uses this
     value to truncate the history file, by calling
     ‘history_truncate_file()’ in the underlying library.  Negative
     values imply unlimited history file size.


File: python.info,  Node: 履歴リスト,  Next: 開始フック,  Prev: 履歴ファイル,  Up: readline --- GNU readline のインターフェース

5.6.8.4 履歴リスト
..................

以下の関数はグローバルな履歴リストを操作します:

 -- の関数: readline.clear_history ()

     Clear the current history.  This calls ‘clear_history()’ in the
     underlying library.  The Python function only exists if Python was
     compiled for a version of the library that supports it.

 -- の関数: readline.get_current_history_length ()

     履歴に現在ある項目の数を返します。 (*note get_history_length():
     27f5. は履歴ファイルに書かれる最大行数を返します。)

 -- の関数: readline.get_history_item (index)

     Return the current contents of history item at 'index'.  The item
     index is one-based.  This calls ‘history_get()’ in the underlying
     library.

 -- の関数: readline.remove_history_item (pos)

     Remove history item specified by its position from the history.
     The position is zero-based.  This calls ‘remove_history()’ in the
     underlying library.

 -- の関数: readline.replace_history_item (pos, line)

     Replace history item specified by its position with 'line'.  The
     position is zero-based.  This calls ‘replace_history_entry()’ in
     the underlying library.

 -- の関数: readline.add_history (line)

     Append 'line' to the history buffer, as if it was the last line
     typed.  This calls ‘add_history()’ in the underlying library.

 -- の関数: readline.set_auto_history (enabled)

     Enable or disable automatic calls to ‘add_history()’ when reading
     input via readline.  The 'enabled' argument should be a Boolean
     value that when true, enables auto history, and that when false,
     disables auto history.

     Added in version 3.6.

     'CPython 実装の詳細:' Auto history is enabled by default, and
     changes to this do not persist across multiple sessions.


File: python.info,  Node: 開始フック,  Next: 補完,  Prev: 履歴リスト,  Up: readline --- GNU readline のインターフェース

5.6.8.5 開始フック
..................

 -- の関数: readline.set_startup_hook ([function])

     Set or remove the function invoked by the ‘rl_startup_hook’
     callback of the underlying library.  If 'function' is specified, it
     will be used as the new hook function; if omitted or ‘None’, any
     function already installed is removed.  The hook is called with no
     arguments just before readline prints the first prompt.

 -- の関数: readline.set_pre_input_hook ([function])

     Set or remove the function invoked by the ‘rl_pre_input_hook’
     callback of the underlying library.  If 'function' is specified, it
     will be used as the new hook function; if omitted or ‘None’, any
     function already installed is removed.  The hook is called with no
     arguments after the first prompt has been printed and just before
     readline starts reading input characters.  This function only
     exists if Python was compiled for a version of the library that
     supports it.


File: python.info,  Node: 補完,  Next: 使用例<2>,  Prev: 開始フック,  Up: readline --- GNU readline のインターフェース

5.6.8.6 補完
............

The following functions relate to implementing a custom word completion
function.  This is typically operated by the Tab key, and can suggest
and automatically complete a word being typed.  By default, Readline is
set up to be used by *note rlcompleter: c2. to complete Python
identifiers for the interactive interpreter.  If the ‘readline’ module
is to be used with a custom completer, a different set of word
delimiters should be set.

 -- の関数: readline.set_completer ([function])

     completer 関数を設定または削除します。'function' が指定された場合、
     新たな completer 関数として用いられます; 省略された場合や ‘None’ の
     場合、現在インストールされている completer 関数は削除されます。
     completer 関数は ‘function(text, state)’ の形式で、関数が文字列でな
     い値を返すまで 'state' を ‘0’, ‘1’, ‘2’, ..., にして呼び出します。
     この関数は 'text' から始まる補完結果として次に来そうなものを返さな
     ければなりません。

     The installed completer function is invoked by the 'entry_func'
     callback passed to ‘rl_completion_matches()’ in the underlying
     library.  The 'text' string comes from the first parameter to the
     ‘rl_attempted_completion_function’ callback of the underlying
     library.

 -- の関数: readline.get_completer ()

     completer 関数を取得します。completer 関数が設定されていなければ
     ‘None’ を返します。

 -- の関数: readline.get_completion_type ()

     Get the type of completion being attempted.  This returns the
     ‘rl_completion_type’ variable in the underlying library as an
     integer.

 -- の関数: readline.get_begidx ()
 -- の関数: readline.get_endidx ()

     Get the beginning or ending index of the completion scope.  These
     indexes are the 'start' and 'end' arguments passed to the
     ‘rl_attempted_completion_function’ callback of the underlying
     library.  The values may be different in the same input editing
     scenario based on the underlying C readline implementation.  Ex:
     libedit is known to behave differently than libreadline.

 -- の関数: readline.set_completer_delims (string)
 -- の関数: readline.get_completer_delims ()

     Set or get the word delimiters for completion.  These determine the
     start of the word to be considered for completion (the completion
     scope).  These functions access the
     ‘rl_completer_word_break_characters’ variable in the underlying
     library.

 -- の関数: readline.set_completion_display_matches_hook ([function])

     Set or remove the completion display function.  If 'function' is
     specified, it will be used as the new completion display function;
     if omitted or ‘None’, any completion display function already
     installed is removed.  This sets or clears the
     ‘rl_completion_display_matches_hook’ callback in the underlying
     library.  The completion display function is called as
     ‘function(substitution, [matches], longest_match_length)’ once each
     time matches need to be displayed.


File: python.info,  Node: 使用例<2>,  Prev: 補完,  Up: readline --- GNU readline のインターフェース

5.6.8.7 使用例
..............

The following example demonstrates how to use the ‘readline’ module's
history reading and writing functions to automatically load and save a
history file named ‘.python_history’ from the user's home directory.
The code below would normally be executed automatically during
interactive sessions from the user's *note PYTHONSTARTUP: 1b8. file.

     import atexit
     import os
     import readline

     histfile = os.path.join(os.path.expanduser("~"), ".python_history")
     try:
         readline.read_history_file(histfile)
         # default history len is -1 (infinite), which may grow unruly
         readline.set_history_length(1000)
     except FileNotFoundError:
         pass

     atexit.register(readline.write_history_file, histfile)

Python が *note 対話モード: 443. で実行される時、このコードは実際には自
動的に実行されます ( *note readline の設定: 11cb. を参照してください)。

次の例では上記と同じ目的を達成できますが、ここでは新規の履歴のみを追加す
ることで、並行して対話セッションがサポートされます:

     import atexit
     import os
     import readline
     histfile = os.path.join(os.path.expanduser("~"), ".python_history")

     try:
         readline.read_history_file(histfile)
         h_len = readline.get_current_history_length()
     except FileNotFoundError:
         open(histfile, 'wb').close()
         h_len = 0

     def save(prev_h_len, histfile):
         new_h_len = readline.get_current_history_length()
         readline.set_history_length(1000)
         readline.append_history_file(new_h_len - prev_h_len, histfile)
     atexit.register(save, h_len, histfile)

次の例では *note code.InteractiveConsole: 2807. クラスを拡張し、履歴の保
存・復旧をサポートします。

     import atexit
     import code
     import os
     import readline

     class HistoryConsole(code.InteractiveConsole):
         def __init__(self, locals=None, filename="<console>",
                      histfile=os.path.expanduser("~/.console-history")):
             code.InteractiveConsole.__init__(self, locals, filename)
             self.init_history(histfile)

         def init_history(self, histfile):
             readline.parse_and_bind("tab: complete")
             if hasattr(readline, "read_history_file"):
                 try:
                     readline.read_history_file(histfile)
                 except FileNotFoundError:
                     pass
                 atexit.register(self.save_history, histfile)

         def save_history(self, histfile):
             readline.set_history_length(1000)
             readline.write_history_file(histfile)

     注釈: The new *note REPL: 491. introduced in version 3.13 doesn't
     support readline.  However, readline can still be used by setting
     the *note PYTHON_BASIC_REPL: 1b6. environment variable.


File: python.info,  Node: rlcompleter --- GNU readline の補完機能,  Prev: readline --- GNU readline のインターフェース,  Up: テキスト処理サービス

5.6.9 ‘rlcompleter’ -- GNU readline の補完機能
----------------------------------------------

'ソースコード:' Lib/rlcompleter.py(1)

__________________________________________________________________

The ‘rlcompleter’ module defines a completion function suitable to be
passed to *note set_completer(): 2800. in the *note readline: bf.
module.

When this module is imported on a Unix platform with the *note readline:
bf. module available, an instance of the *note Completer: 1d2b. class is
automatically created and its *note complete(): 280b. method is set as
the *note readline completer: 27ff.  The method provides completion of
valid Python *note identifiers and keywords: 22a0.

以下はプログラム例です:

     >>> import rlcompleter
     >>> import readline
     >>> readline.parse_and_bind("tab: complete")
     >>> readline. <TAB PRESSED>
     readline.__doc__          readline.get_line_buffer(  readline.read_init_file(
     readline.__file__         readline.insert_text(      readline.set_completer(
     readline.__name__         readline.parse_and_bind(
     >>> readline.

The ‘rlcompleter’ module is designed for use with Python's *note
interactive mode: 443.  Unless Python is run with the *note -S: 13c0.
option, the module is automatically imported and configured (see *note
readline の設定: 11cb.).

*note readline: bf. のないプラットフォームでも、このモジュールで定義され
る *note Completer: 1d2b. クラスは独自の目的に使えます。

 -- クラス: rlcompleter.Completer

     Completerオブジェクトは以下のメソッドを持っています:

      -- メソッド: complete (text, state)

          Return the next possible completion for 'text'.

          When called by the *note readline: bf. module, this method is
          called successively with ‘state == 0, 1, 2, ...’ until the
          method returns ‘None’.

          もし 'text' がピリオド(‘'.'’)を含まない場合、 *note __main__:
          1. 、 *note builtins: 13. で定義されている名前か、キーワード
          (*note keyword: 88. モジュールで定義されている) から補完されま
          す。

          If called for a dotted name, it will try to evaluate anything
          without obvious side-effects (functions will not be evaluated,
          but it can generate calls to *note __getattr__(): 6fa.) up to
          the last part, and find matches for the rest via the *note
          dir(): 844. function.  Any exception raised during the
          evaluation of the expression is caught, silenced and *note
          None: 885. is returned.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/rlcompleter.py


File: python.info,  Node: バイナリデータ処理,  Next: データ型,  Prev: テキスト処理サービス,  Up: Python 標準ライブラリ

5.7 バイナリデータ処理
======================

この章で紹介されているモジュールはバイナリデータを扱うための基本的な処理
を提供しています。ファイルフォーマットやネットワークプロトコルなど、その
他のバイナリデータ処理については、それぞれの節で解説されています。

*note テキスト処理サービス: 2652. で紹介する一部のライブラリには、 ASCII
互換のバイナリフォーマットで利用できるもの (例: *note re: be.) や 、すべ
てのバイナリデータで利用できるもの (例: *note difflib: 3b.) があります。

加えて、 *note バイナリシーケンス型 -- bytes, bytearray, memoryview:
25c4. に書かれているPythonビルトインデータ型についても参照してください。

* Menu:

* struct: struct --- バイト列をパックされたバイナリデータとして解釈する. バイト列をパックされたバイナリデータとして解釈する
* codecs: codecs --- codec レジストリと基底クラス. codec レジストリと基底クラス


File: python.info,  Node: struct --- バイト列をパックされたバイナリデータとして解釈する,  Next: codecs --- codec レジストリと基底クラス,  Up: バイナリデータ処理

5.7.1 ‘struct’ -- バイト列をパックされたバイナリデータとして解釈する
--------------------------------------------------------------------

'ソースコード:' Lib/struct.py(1)

__________________________________________________________________

This module converts between Python values and C structs represented as
Python *note bytes: 192. objects.  Compact *note format strings: 2812.
describe the intended conversions to/from Python values.  The module's
functions and objects can be used for two largely distinct applications,
data exchange with external sources (files or network connections), or
data transfer between the Python application and the C layer.

     注釈: When no prefix character is given, native mode is the
     default.  It packs or unpacks data based on the platform and
     compiler on which the Python interpreter was built.  The result of
     packing a given C struct includes pad bytes which maintain proper
     alignment for the C types involved; similarly, alignment is taken
     into account when unpacking.  In contrast, when communicating data
     between external sources, the programmer is responsible for
     defining byte ordering and padding between elements.  See *note
     バイトオーダ、サイズ、アラインメント: 2813. for details.

Several ‘struct’ functions (and methods of *note Struct: 1778.) take a
'buffer' argument.  This refers to objects that implement the *note
バッファプロトコル (buffer Protocol): 260. and provide either a readable
or read-writable buffer.  The most common types used for that purpose
are *note bytes: 192. and *note bytearray: 344, but many other types
that can be viewed as an array of bytes implement the buffer protocol,
so that they can be read/filled without additional copying from a *note
bytes: 192. object.

* Menu:

* 関数と例外::
* 書式文字列::
* アプリケーション::
* クラス: クラス<3>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/struct.py


File: python.info,  Node: 関数と例外,  Next: 書式文字列,  Up: struct --- バイト列をパックされたバイナリデータとして解釈する

5.7.1.1 関数と例外
..................

このモジュールは以下の例外と関数を定義しています:

 -- 例外: struct.error

     様々な状況で送出される例外です。引数は何が問題なのかを記述する文字
     列です。

 -- の関数: struct.pack (format, v1, v2, ...)

     フォーマット文字列 'format' に従い値 'v1', 'v2', ...  をパックして
     、バイト列オブジェクトを返します。引数は指定したフォーマットが要求
     する型と正確に一致していなければなりません。

 -- の関数: struct.pack_into (format, buffer, offset, v1, v2, ...)

     フォーマット文字列 'format' に従い値 'v1', 'v2', ...  をパックして
     バイト列にし、書き込み可能な 'buffer' のオフセット 'offset' 位置よ
     り書き込みます。オフセットは省略出来ません。

 -- の関数: struct.unpack (format, buffer)

     (‘pack(format, ...)’ でパックされたであろう) バッファ 'buffer' を、
     書式文字列 'format' に従ってアンパックします。 値が一つしかない場合
     を含め、結果はタプルで返されます。 バッファのバイトサイズは、 *note
     calcsize(): 1da9. の返り値である書式文字列が要求するサイズと一致し
     なければなりません。

 -- の関数: struct.unpack_from (format, /, buffer, offset=0)

     バッファ 'buffer' を、 'offset' の位置から書式文字列 'format' に従
     ってアンパックします。 値が一つしかない場合を含め、結果はタプルで返
     されます。 'offset' を始点とするバッファのバイトサイズは、少なくと
     も *note calcsize(): 1da9. の返り値である書式文字列が要求するサイズ
     でなければなりません。

 -- の関数: struct.iter_unpack (format, buffer)

     バッファ 'buffer' を、書式文字列 'format' に従ってイテレータ形式で
     アンパックします。 この関数が返すイテレータは、すべての内容を読み終
     わるまでバッファから一定の大きさのチャンクを読み取ります。 バッファ
     のバイトサイズは、 *note calcsize(): 1da9. の返り値である書式文字列
     が要求するサイズの倍数でなければなりません。

     イテレーション毎に書式文字列で指定されたタプルを yield します。

     Added in version 3.4.

 -- の関数: struct.calcsize (format)

     書式文字列 'format' に従って、構造体 (それと ‘pack(format, ...)’ に
     よって作成されるバイト列オブジェクト) のサイズを返します。


File: python.info,  Node: 書式文字列,  Next: アプリケーション,  Prev: 関数と例外,  Up: struct --- バイト列をパックされたバイナリデータとして解釈する

5.7.1.2 書式文字列
..................

Format strings describe the data layout when packing and unpacking data.
They are built up from *note format characters: 124b, which specify the
type of data being packed/unpacked.  In addition, special characters
control the *note byte order, size and alignment: 2813.  Each format
string consists of an optional prefix character which describes the
overall properties of the data and one or more format characters which
describe the actual data values and padding.

* Menu:

* バイトオーダ、サイズ、アラインメント::
* 書式指定文字::
* 使用例: 使用例<3>.


File: python.info,  Node: バイトオーダ、サイズ、アラインメント,  Next: 書式指定文字,  Up: 書式文字列

5.7.1.3 バイトオーダ、サイズ、アラインメント
............................................

By default, C types are represented in the machine's native format and
byte order, and properly aligned by skipping pad bytes if necessary
(according to the rules used by the C compiler).  This behavior is
chosen so that the bytes of a packed struct correspond exactly to the
memory layout of the corresponding C struct.  Whether to use native byte
ordering and padding or standard formats depends on the application.

これに代わって、フォーマット文字列の最初の文字を使って、バイトオーダやサ
イズ、アラインメントを指定することができます。指定できる文字を以下のテー
ブルに示します:

文字            バイトオーダ                 サイズ         アラインメン
                                                            ト
                                                            
----------------------------------------------------------------------------
                                                            
‘@’             native                       native         native
                                                            
                                                            
‘=’             native                       standard       none
                                                            
                                                            
‘<’             リトルエンディアン           standard       none
                                                            
                                                            
‘>’             ビッグエンディアン           standard       none
                                                            
                                                            
‘!’             ネットワーク (= ビッグエン   standard       none
                ディアン)                                   
                

フォーマット文字列の最初の文字が上のいずれかでない場合、‘'@'’ であるとみ
なされます。

     注釈: The number 1023 (‘0x3ff’ in hexadecimal) has the following
     byte representations:

        * ‘03 ff’ in big-endian (‘>’)

        * ‘ff 03’ in little-endian (‘<’)

     Python の例:

          >>> import struct
          >>> struct.pack('>h', 1023)
          b'\x03\xff'
          >>> struct.pack('<h', 1023)
          b'\xff\x03'

ネイティブのバイトオーダはビッグエンディアンかリトルエンディアンで、ホス
トシステムに依存します。例えば、Intel x86、AMD64 (x86-64) および Apple
M1 はリトルエンディアンです。IBM z および多くの古いアーキテクチャはビッ
グエンディアンです。使っているシステムでのエンディアンは *note
sys.byteorder: 25f7. を使って調べて下さい。

ネイティブのサイズおよびアラインメントは C コンパイラの ‘sizeof’ 式で決
定されます。ネイティブのサイズおよびアラインメントはネイティブのバイトオ
ーダと同時に使われます。

標準のサイズはフォーマット文字だけで決まります。 *note 書式指定文字:
124b. の表を参照して下さい。

‘'@'’ と ‘'='’ の違いに注意してください: 両方ともネイティブのバイトオー
ダですが、後者のバイトサイズとアラインメントは標準のものに合わせてありま
す。

The form ‘'!'’ represents the network byte order which is always
big-endian as defined in IETF RFC 1700(1).

バイトオーダに関して、「(強制的にバイトスワップを行う)ネイティブの逆」を
指定する方法はありません。‘'<'’ または ‘'>'’ のうちふさわしい方を選んで
ください。

注釈:

  1. パディングは構造体のメンバの並びの中にだけ自動で追加されます。最初
     や最後にパディングが追加されることはありません。

  2. ネイティブでないサイズおよびアラインメントが使われる場合にはパディ
     ングは行われません (たとえば '<', '>', '=', '!'  を使った場合です
     )。

  3. 特定の型によるアラインメント要求に従うように構造体の末端をそろえる
     には、繰り返し回数をゼロにした特定の型でフォーマットを終端します。
     *note 使用例: 2819. を参照して下さい。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc1700


File: python.info,  Node: 書式指定文字,  Next: 使用例<3>,  Prev: バイトオーダ、サイズ、アラインメント,  Up: 書式文字列

5.7.1.4 書式指定文字
....................

フォーマット文字 (format character) は以下の意味を持っています; C と
Python の間の変換では、値は正確に以下に指定された型でなくてはなりません:
「標準のサイズ」列は standard サイズ使用時にパックされた値が何バイトかを
示します。つまり、フォーマット文字列が ‘'<'’, ‘'>'’, ‘'!'’, ‘'='’ のいず
れかで始まっている場合のものです。native サイズ使用時にはパックされた値
の大きさはプラットフォーム依存です。

フォーマッ   C の型                         Python の型              標準のサイズ         注釈
ト                                                                                        

-----------------------------------------------------------------------------------------------------------
                                                                                          
‘x’          パディングバイト               値なし                                        (7)
                                                                                          
                                                                                          
‘c’          char                           長さ 1 のバイト列        1
                                                                     
                                                                                          
‘b’          signed char                    整数                     1                    (1), (2)
                                                                                          
                                                                                          
‘B’          unsigned char                  整数                     1                    (2)
                                                                                          
                                                                                          
‘?’          _Bool                          真偽値型(bool)           1                    (1)
                                                                                          
                                                                                          
‘h’          short                          整数                     2                    (2)
                                                                                          
                                                                                          
‘H’          unsigned short                 整数                     2                    (2)
                                                                                          
                                                                                          
‘i’          int                            整数                     4                    (2)
                                                                                          
                                                                                          
‘I’          unsigned int                   整数                     4                    (2)
                                                                                          
                                                                                          
‘l’          long                           整数                     4                    (2)
                                                                                          
                                                                                          
‘L’          unsigned long                  整数                     4                    (2)
                                                                                          
                                                                                          
‘q’          long long                      整数                     8                    (2)
                                                                                          
                                                                                          
‘Q’          unsigned long long             整数                     8                    (2)
                                                                                          
                                                                                          
‘n’          ‘ssize_t’                      整数                                          (3)
                                                                                          
                                                                                          
‘N’          ‘size_t’                       整数                                          (3)
                                                                                          
                                                                                          
‘e’          (6)                            浮動小数点数             2                    (4)
                                                                                          
                                                                                          
‘f’          float                          浮動小数点数             4                    (4)
                                                                                          
                                                                                          
‘d’          double                         浮動小数点数             8                    (4)
                                                                                          
                                                                                          
‘F’          float complex                  複素数                   8                    (10)
                                                                                          
                                                                                          
‘D’          double complex                 複素数                   16                   (10)
                                                                                          
                                                                                          
‘s’          char[]                         bytes                                         (9)
                                                                                          
                                                                                          
‘p’          char[]                         bytes                                         (8)
                                                                                          
                                                                                          
‘P’          void*                          整数                                          (5)
                                                                                          

バージョン 3.3 で変更: ‘'n'’ および ‘'N'’ フォーマットのサポートが追加さ
れました。

バージョン 3.6 で変更: ‘'e'’ フォーマットのサポートが追加されました。

バージョン 3.14 で変更: Added support for the ‘'F'’ and ‘'D'’ formats.

注釈:

  1. 
     The ‘'?'’ conversion code corresponds to the _Bool type defined by
     C standards since C99.  In standard mode, it is represented by one
     byte.

  2. When attempting to pack a non-integer using any of the integer
     conversion codes, if the non-integer has a *note __index__(): 19e.
     method then that method is called to convert the argument to an
     integer before packing.

     バージョン 3.2 で変更: Added use of the *note __index__(): 19e.
     method for non-integers.

  3. ‘'n'’ および ‘'N'’ 変換コードは (デフォルトもしくはバイトオーダ文字
     ‘'@'’ 付きで選択される) native サイズ使用時のみ利用できます。
     standard サイズ使用時には、自身のアプリケーションに適する他の整数フ
     ォーマットを使うことができます。

  4. ‘'f'’ 、 ‘'d'’ および ‘'e'’ 変換コードについて、パックされた表現は
     IEEE 754 binary32 (‘'f'’ の場合) 、 binary64 (‘'d'’ の場合) 、また
     はbinary16(‘'e'’ の場合) フォーマットが、プラットフォームにおける浮
     動小数点数のフォーマットに関係なく使われます。

  5. ‘'P'’ フォーマット文字はネイティブバイトオーダでのみ利用可能です (デ
     フォルトのネットワークバイトオーダに設定するか、‘'@'’ バイトオーダ
     指定文字を指定しなければなりません)。‘'='’ を指定した場合、ホスト計
     算機のバイトオーダに基づいてリトルエンディアンとビッグエンディアン
     のどちらを使うかを決めます。struct モジュールはこの設定をネイティブ
     のオーダ設定として解釈しないので、‘'P'’ を使うことはできません。

  6. IEEE 754 の binary16 "半精度" 型は、 IEEE 754 standard(1) の2008 年
     の改訂で導入されました。 半精度型は、符号 bit 、5 bit の指数部、 11
     bit の精度 (明示的には 10 bit が保存される) を持ち、おおよそ
     ‘6.1e-05’ から ‘6.5e+04’ までの数を完全な精度で表現できます。 この
     型は C コンパイラでは広くはサポートされていません: たいていのマシン
     では、保存するのに unsigned short が使えますが、数学の演算には使え
     ません。 詳しいことは Wikipedia の half-precision floating-point
     format(2) のページを参照してください。

  7. When packing, ‘'x'’ inserts one NUL byte.

  8. フォーマット文字 ‘'p'’ は "Pascal 文字列 (pascal string)" をコード
     します。Pascal 文字列は count で与えられる '固定長のバイト列' に収
     められた短い可変長の文字列です。このデータの先頭の 1 バイトには文字
     列の長さか255 のうち、小さい方の数が収められます。その後に文字列の
     バイトデータが続きます。 *note pack(): 148e. に渡された Pascal 文字
     列の長さが長すぎた (count-1 よりも長い) 場合、先頭の ‘count-1’ バイ
     トが書き込まれます。文字列が ‘count-1’ よりも短い場合、指定した
     count バイトに達するまでの残りの部分はヌルで埋められます。 *note
     unpack(): 185a. では、フォーマット文字 ‘'p'’ は指定された ‘count’ バ
     イトだけデータを読み込みますが、返される文字列は決して 255 文字を超
     えることはないので注意してください。

  9. For the ‘'s'’ format character, the count is interpreted as the
     length of the bytes, not a repeat count like for the other format
     characters; for example, ‘'10s'’ means a single 10-byte string
     mapping to or from a single Python byte string, while ‘'10c'’ means
     10 separate one byte character elements (e.g., ‘cccccccccc’)
     mapping to or from ten different Python byte objects.  (See *note
     使用例: 2819. for a concrete demonstration of the difference.)  If
     a count is not given, it defaults to 1.  For packing, the string is
     truncated or padded with null bytes as appropriate to make it fit.
     For unpacking, the resulting bytes object always has exactly the
     specified number of bytes.  As a special case, ‘'0s'’ means a
     single, empty string (while ‘'0c'’ means 0 characters).

  10. For the ‘'F'’ and ‘'D'’ format characters, the packed
     representation uses the IEEE 754 binary32 and binary64 format for
     components of the complex number, regardless of the floating-point
     format used by the platform.  Note that complex types (‘F’ and ‘D’)
     are available unconditionally, despite complex types being an
     optional feature in C. As specified in the C11 standard, each
     complex type is represented by a two-element C array containing,
     respectively, the real and imaginary parts.

フォーマット文字の前に整数をつけ、繰り返し回数 (count) を指定することが
できます。例えば、フォーマット文字列 ‘'4h'’ は ‘'hhhh'’ と全く同じ意味で
す。

フォーマット文字間の空白文字は無視されます; count とフォーマット文字の間
にはスペースを入れてはいけません。

整数フォーマット (‘'b'’, ‘'B'’, ‘'h'’, ‘'H'’, ‘'i'’, ‘'I'’, ‘'l'’,
‘'L'’, ‘'q'’, ‘'Q'’) のいずれかを使って値 ‘x’ をパックするとき ‘x’ がフ
ォーマットの適切な値の範囲に無い場合、 *note struct.error: 153b. が送出
されます。

バージョン 3.1 で変更: 以前は、いくつかの整数フォーマットが適切な範囲に
ない値を覆い隠して、 *note struct.error: 153b. の代わりに *note
DeprecationWarning: 1a3. を送出していました。

‘'?'’ フォーマット文字では、返り値は *note True: e07. または *note
False: d2b. です。パックするときには、引数オブジェクトの論理値としての値
が使われます。 0 または 1 のネイティブや標準の真偽値表現でパックされ、ア
ンパックされるときはゼロでない値は ‘True’ になります。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/IEEE_754-2008_revision

   (2) 
https://en.wikipedia.org/wiki/Half-precision_floating-point_format


File: python.info,  Node: 使用例<3>,  Prev: 書式指定文字,  Up: 書式文字列

5.7.1.5 使用例
..............

     注釈: Native byte order examples (designated by the ‘'@'’ format
     prefix or lack of any prefix character) may not match what the
     reader's machine produces as that depends on the platform and
     compiler.

Pack and unpack integers of three different sizes, using big endian
ordering:

     >>> from struct import *
     >>> pack(">bhl", 1, 2, 3)
     b'\x01\x00\x02\x00\x00\x00\x03'
     >>> unpack('>bhl', b'\x01\x00\x02\x00\x00\x00\x03')
     (1, 2, 3)
     >>> calcsize('>bhl')
     7

Attempt to pack an integer which is too large for the defined field:

     >>> pack(">h", 99999)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     struct.error: 'h' format requires -32768 <= number <= 32767

Demonstrate the difference between ‘'s'’ and ‘'c'’ format characters:

     >>> pack("@ccc", b'1', b'2', b'3')
     b'123'
     >>> pack("@3s", b'123')
     b'123'

アンパックした結果のフィールドは、変数に割り当てるか named tuple でラッ
プすることによって名前を付けることができます:

     >>> record = b'raymond   \x32\x12\x08\x01\x08'
     >>> name, serialnum, school, gradelevel = unpack('<10sHHb', record)

     >>> from collections import namedtuple
     >>> Student = namedtuple('Student', 'name serialnum school gradelevel')
     >>> Student._make(unpack('<10sHHb', record))
     Student(name=b'raymond   ', serialnum=4658, school=264, gradelevel=8)

The ordering of format characters may have an impact on size in native
mode since padding is implicit.  In standard mode, the user is
responsible for inserting any desired padding.  Note in the first ‘pack’
call below that three NUL bytes were added after the packed ‘'#'’ to
align the following integer on a four-byte boundary.  In this example,
the output was produced on a little endian machine:

     >>> pack('@ci', b'#', 0x12131415)
     b'#\x00\x00\x00\x15\x14\x13\x12'
     >>> pack('@ic', 0x12131415, b'#')
     b'\x15\x14\x13\x12#'
     >>> calcsize('@ci')
     8
     >>> calcsize('@ic')
     5

The following format ‘'llh0l'’ results in two pad bytes being added at
the end, assuming the platform's longs are aligned on 4-byte boundaries:

     >>> pack('@llh0l', 1, 2, 3)
     b'\x00\x00\x00\x01\x00\x00\x00\x02\x00\x03\x00\x00'

参考
....

*note array: 8. モジュール

     一様なデータ型からなるバイナリ記録データのパック。

*note json: 86. モジュール

     JSON encoder and decoder.

*note pickle: ab. モジュール

     Python object serialization.


File: python.info,  Node: アプリケーション,  Next: クラス<3>,  Prev: 書式文字列,  Up: struct --- バイト列をパックされたバイナリデータとして解釈する

5.7.1.6 アプリケーション
........................

Two main applications for the ‘struct’ module exist, data interchange
between Python and C code within an application or another application
compiled using the same compiler (*note native formats: 281e.), and data
interchange between applications using agreed upon data layout (*note
standard formats: 281f.).  Generally speaking, the format strings
constructed for these two domains are distinct.

* Menu:

* Native Formats::
* Standard Formats::


File: python.info,  Node: Native Formats,  Next: Standard Formats,  Up: アプリケーション

5.7.1.7 Native Formats
......................

When constructing format strings which mimic native layouts, the
compiler and machine architecture determine byte ordering and padding.
In such cases, the ‘@’ format character should be used to specify native
byte ordering and data sizes.  Internal pad bytes are normally inserted
automatically.  It is possible that a zero-repeat format code will be
needed at the end of a format string to round up to the correct byte
boundary for proper alignment of consecutive chunks of data.

Consider these two simple examples (on a 64-bit, little-endian machine):

     >>> calcsize('@lhl')
     24
     >>> calcsize('@llh')
     18

Data is not padded to an 8-byte boundary at the end of the second format
string without the use of extra padding.  A zero-repeat format code
solves that problem:

     >>> calcsize('@llh0l')
     24

The ‘'x'’ format code can be used to specify the repeat, but for native
formats it is better to use a zero-repeat format like ‘'0l'’.

By default, native byte ordering and alignment is used, but it is better
to be explicit and use the ‘'@'’ prefix character.


File: python.info,  Node: Standard Formats,  Prev: Native Formats,  Up: アプリケーション

5.7.1.8 Standard Formats
........................

When exchanging data beyond your process such as networking or storage,
be precise.  Specify the exact byte order, size, and alignment.  Do not
assume they match the native order of a particular machine.  For
example, network byte order is big-endian, while many popular CPUs are
little-endian.  By defining this explicitly, the user need not care
about the specifics of the platform their code is running on.  The first
character should typically be ‘<’ or ‘>’ (or ‘!’).  Padding is the
responsibility of the programmer.  The zero-repeat format character
won't work.  Instead, the user must explicitly add ‘'x'’ pad bytes where
needed.  Revisiting the examples from the previous section, we have:

     >>> calcsize('<qh6xq')
     24
     >>> pack('<qh6xq', 1, 2, 3) == pack('@lhl', 1, 2, 3)
     True
     >>> calcsize('@llh')
     18
     >>> pack('@llh', 1, 2, 3) == pack('<qqh', 1, 2, 3)
     True
     >>> calcsize('<qqh6x')
     24
     >>> calcsize('@llh0l')
     24
     >>> pack('@llh0l', 1, 2, 3) == pack('<qqh6x', 1, 2, 3)
     True

The above results (executed on a 64-bit machine) aren't guaranteed to
match when executed on different machines.  For example, the examples
below were executed on a 32-bit machine:

     >>> calcsize('<qqh6x')
     24
     >>> calcsize('@llh0l')
     12
     >>> pack('@llh0l', 1, 2, 3) == pack('<qqh6x', 1, 2, 3)
     False


File: python.info,  Node: クラス<3>,  Prev: アプリケーション,  Up: struct --- バイト列をパックされたバイナリデータとして解釈する

5.7.1.9 クラス
..............

The ‘struct’ module also defines the following type:

 -- クラス: struct.Struct (format)

     フォーマット文字列 'format' に従ってバイナリデータを読み書きする、
     新しい Struct オブジェクトを返します。 ‘Struct’ オブジェクトを一度
     作ってからそのメソッドを呼び出すと、フォーマット文字列のコンパイル
     が一度だけになるので、モジュールレベルの関数を同じフォーマットで呼
     び出すよりも効率的です。

          注釈: The compiled versions of the most recent format strings
          passed to the module-level functions are cached, so programs
          that use only a few format strings needn't worry about reusing
          a single *note Struct: 1778. instance.

     コンパイルされた Struct オブジェクトは以下のメソッドと属性をサポー
     トします:

      -- メソッド: pack (v1, v2, ...)

          *note pack(): 148e. 関数と同じ、コンパイルされたフォーマットを
          利用するメソッドです。 (‘len(result)’ は *note size: 2825. と
          等しいでしょう)

      -- メソッド: pack_into (buffer, offset, v1, v2, ...)

          *note pack_into(): 2815. 関数と同じ、コンパイルされたフォーマ
          ットを利用するメソッドです。

      -- メソッド: unpack (buffer)

          *note unpack(): 185a. 関数と同じ、コンパイルされたフォーマット
          を利用するメソッドです。 (buffer のバイト数は *note size:
          2825. と等しくなければなりません)。

      -- メソッド: unpack_from (buffer, offset=0)

          *note unpack_from(): 2816. 関数と同じ、コンパイルされたフォー
          マットを利用するメソッドです。 ('offset' を始点とする buffer の
          バイト数は少なくとも *note size: 2825. 以上でなければなりませ
          ん)。

      -- メソッド: iter_unpack (buffer)

          *note iter_unpack(): 11c1. 関数と同じ、コンパイルされたフォー
          マットを利用するメソッドです。 (buffer のバイト数は *note
          size: 2825. の倍数でなければなりません)。

          Added in version 3.4.

      -- の属性: format

          この Struct オブジェクトを作成する時に利用されたフォーマット文
          字列です。

          バージョン 3.7 で変更: The format string type is now *note
          str: 169. instead of *note bytes: 192.

      -- の属性: size

          *note format: 199. 属性に対応する構造体の (従って *note
          pack(): 148e. メソッドによって作成されるバイト列オブジェクトの
          ) サイズです。

     バージョン 3.13 で変更: The 'repr()' of structs has changed.  It is
     now:

          >>> Struct('i')
          Struct('i')


File: python.info,  Node: codecs --- codec レジストリと基底クラス,  Prev: struct --- バイト列をパックされたバイナリデータとして解釈する,  Up: バイナリデータ処理

5.7.2 ‘codecs’ -- codec レジストリと基底クラス
----------------------------------------------

'ソースコード:' Lib/codecs.py(1)

__________________________________________________________________

このモジュールは、標準的な Python codec (エンコーダとデコーダ) 用の基底
クラスを定義し、codec とエラー処理検索プロセスを管理する内部の Python
codec レジストリへのアクセスを提供します。多くの codec はテキストをバイ
トにエンコードする (そしてバイトをテキストにデコードする) *note
テキストエンコーディング: 25db. ですが、テキストをテキストに、またはバイ
トをバイトにエンコードする codec も提供されています。カスタムの codec は
任意の型間でエンコードとデコードを行えますが、一部のモジュール機能は
*note テキストエンコーディング: 25db. か *note bytes: 192. へのエンコー
ドのみに制限されています。

このモジュールでは、任意の codec でエンコードやデコードを行うための、以
下の関数が定義されています。

 -- の関数: codecs.encode (obj, encoding='utf-8', errors='strict')

     'encoding' に記載された codec を使用して 'obj' をエンコードします。

     希望のエラー処理スキームを 'errors' に設定することができます。デフ
     ォルトのエラーハンドラ (エラー処理関数) は ‘'strict'’ です。これは
     エンコードエラーは *note ValueError: 2ec. (もしくは *note
     UnicodeEncodeError: 887. のような、より codec に固有のサブクラス) を
     送出することを意味します。codec エラー処理についてのより詳しい情報
     は *note Codec 基底クラス: 282c. を参照してください。

 -- の関数: codecs.decode (obj, encoding='utf-8', errors='strict')

     'encoding' に記載された codec を使用して 'obj' をデコードします。

     希望のエラー処理スキームを 'errors' に設定することができます。デフ
     ォルトのエラーハンドラは ‘'strict'’ です。これはデコードエラーは
     *note ValueError: 2ec. (もしくは *note UnicodeDecodeError: c08. の
     ような、より codec に固有のサブクラス) を送出することを意味します。
     codec エラー処理についてのより詳しい情報は *note Codec 基底クラス:
     282c. を参照してください。

 -- の関数: codecs.charmap_build (string)

     Return a mapping suitable for encoding with a custom single-byte
     encoding.  Given a *note str: 169. 'string' of up to 256 characters
     representing a decoding table, returns either a compact internal
     mapping object ‘EncodingMap’ or a *note dictionary: 183. mapping
     character ordinals to byte values.  Raises a *note TypeError: 198.
     on invalid input.

各 codec についての詳細も、次のようにして直接調べることができます。

 -- の関数: codecs.lookup (encoding, /)

     Python codec レジストリから codec 情報を探し、以下で定義するような
     *note CodecInfo: 1a6c. オブジェクトを返します。

     エンコーディングの検索は、まずレジストリのキャッシュから行います。
     見つからなければ、登録されている検索関数のリストから探します。
     *note CodecInfo: 1a6c. オブジェクトが一つも見つからなければ *note
     LookupError: 23e5. を送出します。見つかったら、その *note
     CodecInfo: 1a6c. オブジェクトはキャッシュに保存され、呼び出し側に返
     されます。

 -- クラス: codecs.CodecInfo (encode, decode, streamreader=None,
          streamwriter=None, incrementalencoder=None,
          incrementaldecoder=None, name=None)

     codec レジストリ内を検索する場合の、codec の詳細です。コントラクタ
     引数は、次の同名の属性に保存されます。

      -- の属性: name

          エンコーディングの名前です。

      -- の属性: encode
      -- の属性: decode

          ステートレスなエンコーディングとデコーディングの関数です。これ
          らは、Codec インスタンスの *note encode(): 2831. メソッドと
          *note decode(): 2832. メソッドと同じインターフェースを持ってい
          る必要があります (see *note Codec のインターフェース: 2833. を
          参照)。この関数またはメソッドは、ステートレスモードで動作する
          ことが想定されています。

      -- の属性: incrementalencoder
      -- の属性: incrementaldecoder

          インクリメンタル・エンコーダとデコーダのクラスまたはファクトリ
          関数です。これらは、基底クラスの *note IncrementalEncoder:
          2836. と *note IncrementalDecoder: 2837. が定義するインターフ
          ェースをそれぞれ提供する必要があります。インクリメンタルな
          codec は、ステート (内部状態) を保持することができます。

      -- の属性: streamwriter
      -- の属性: streamreader

          ストリームライターとリーダーのクラスまたはファクトリ関数です。
          これらは、基底クラスの *note StreamWriter: 283a. と *note
          StreamReader: 283b. が定義するインターフェースをそれぞれ提供す
          る必要があります。ストリーム codec は、ステートを保持すること
          ができます。

さまざまな codec 構成要素へのアクセスを簡便化するために、このモジュール
は以下のような関数を提供しています。これらの関数は、 codec の検索に
*note lookup(): b5c. を使います:

 -- の関数: codecs.getencoder (encoding)

     与えられたエンコーディングに対する codec を検索し、エンコーダ関数を
     返します。

     エンコーディングが見つからなければ *note LookupError: 23e5. を送出
     します。

 -- の関数: codecs.getdecoder (encoding)

     与えられたエンコーディングに対する codec を検索し、デコーダ関数を返
     します。

     エンコーディングが見つからなければ *note LookupError: 23e5. を送出
     します。

 -- の関数: codecs.getincrementalencoder (encoding)

     与えられたエンコーディングに対する codec を検索し、インクリメンタル
     ・エンコーダクラスまたはファクトリ関数を返します。

     エンコーディングが見つからないか、 codec がインクリメンタル・エンコ
     ーダをサポートしなければ *note LookupError: 23e5. を送出します。

 -- の関数: codecs.getincrementaldecoder (encoding)

     与えられたエンコーディングに対する codec を検索し、インクリメンタル
     ・デコーダクラスまたはファクトリ関数を返します。

     エンコーディングが見つからないか、 codec がインクリメンタル・デコー
     ダをサポートしなければ *note LookupError: 23e5. を送出します。

 -- の関数: codecs.getreader (encoding)

     与えられたエンコーディングに対する codec を検索し、*note
     StreamReader: 283b. クラスまたはファクトリ関数を返します。

     エンコーディングが見つからなければ *note LookupError: 23e5. を送出
     します。

 -- の関数: codecs.getwriter (encoding)

     与えられたエンコーディングに対する codec を検索し、*note
     StreamWriter: 283a. クラスまたはファクトリ関数を返します。

     エンコーディングが見つからなければ *note LookupError: 23e5. を送出
     します。

次のように、適切な codec 検索関数を登録することで、カスタムの codecs を
利用することができます。

 -- の関数: codecs.register (search_function, /)

     Register a codec search function.  Search functions are expected to
     take one argument, being the encoding name in all lower case
     letters with hyphens and spaces converted to underscores, and
     return a *note CodecInfo: 1a6c. object.  In case a search function
     cannot find a given encoding, it should return ‘None’.

     バージョン 3.9 で変更: Hyphens and spaces are converted to
     underscore.

 -- の関数: codecs.unregister (search_function, /)

     Unregister a codec search function and clear the registry's cache.
     If the search function is not registered, do nothing.

     Added in version 3.10.

エンコードされたテキストファイルを処理する場合、組み込みの *note open():
316. とそれに関連付けられた *note io: 83. モジュールの使用が推奨されてい
ますが、このモジュールは追加のユーティリティ関数とクラスを提供し、バイナ
リファイルを処理する場合に幅広い codecs を利用できるようにします。

 -- の関数: codecs.open (filename, mode='r', encoding=None,
          errors='strict', buffering=-1)

     エンコードされたファイルを 'mode' を使って開き、透過的なエンコード
     /デコードを提供する *note StreamReaderWriter: 2843. のインスタンス
     を返します。デフォルトのファイルモードは ‘'r'’ 、つまり、読み出しモ
     ードでファイルを開きます。

          注釈: 'encoding' が ‘None’ でなければ、下層のエンコードされた
          ファイルは、常にバイナリモードで開きます。読み書き時に、
          ‘'\n'’ の自動変換は行われません。'mode' 引数は、組み込みの
          *note open(): 316. 関数が受け入れる任意のバイナリモードにする
          ことができます。‘'b'’ が自動的に付加されます。

     'encoding' は、そのファイルに対して使用されるエンコーディングを指定
     します。バイトにエンコードする、あるいはバイトからデコードするすべ
     てのエンコーディングが許可されます。ファイルメソッドがサポートする
     データ型は、使用される codec によって異なります。

     エラーハンドリングのために 'errors' を渡すことができます。これはデ
     フォルトでは ‘'strict'’ で、エンコード時にエラーがあれば *note
     ValueError: 2ec. を送出します。

     'buffering' has the same meaning as for the built-in *note open():
     316. function.  It defaults to -1 which means that the default
     buffer size will be used.

     バージョン 3.11 で変更: ‘'U'’ モードは削除されました。

     バージョン 3.14 で非推奨: *note codecs.open(): 315. has been
     superseded by *note open(): 316.

 -- の関数: codecs.EncodedFile (file, data_encoding, file_encoding=None,
          errors='strict')

     透過的なエンコード変換を行うファイルのラップされたバージョンである
     、*note StreamRecoder: 1dd4. インスタンスを返します。元のファイルは
     、ラップされたバージョンが閉じられる時に、閉じられます。

     ラップされたファイルに書き込まれたデータは、指定された
     'data_encoding' に従ってデコードされ、次に 'file_encoding' を使用し
     て元のファイルにバイトとして書き出されます。元のファイルから読み出
     されたバイトは、'file_encoding' に従ってデコードされ、結果は
     'data_encoding' を使用してエンコードされます。

     'file_encoding' が与えられなければ、'data_encoding' がデフォルトに
     なります。

     エラーハンドリングのために 'errors' を渡すことができます。これはデ
     フォルトでは ‘'strict'’ で、エンコード時にエラーがあれば *note
     ValueError: 2ec. を送出します。

 -- の関数: codecs.iterencode (iterator, encoding, errors='strict',
          **kwargs)

     Uses an incremental encoder to iteratively encode the input
     provided by 'iterator'.  'iterator' must yield *note str: 169.
     objects.  This function is a *note generator: 126c.  The 'errors'
     argument (as well as any other keyword argument) is passed through
     to the incremental encoder.

     この関数では、コーデックはエンコードするテキストの *note str: 169.
     オブジェクトを受け付ける必要があります。 従って、 ‘base64_codec’ の
     ようなバイトからバイトへのエンコーダはサポートしていません。

 -- の関数: codecs.iterdecode (iterator, encoding, errors='strict',
          **kwargs)

     Uses an incremental decoder to iteratively decode the input
     provided by 'iterator'.  'iterator' must yield *note bytes: 192.
     objects.  This function is a *note generator: 126c.  The 'errors'
     argument (as well as any other keyword argument) is passed through
     to the incremental decoder.

     この関数では、コーデックはエンコードする *note bytes: 192. オブジェ
     クトを受け付ける必要があります。 従って、 ‘rot_13’ のようなテキスト
     からテキストへのエンコーダが *note iterencode(): 2845. で同等に使え
     るとしても、この関数ではサポートしていません。

 -- の関数: codecs.readbuffer_encode (buffer, errors=None, /)

     Return a *note tuple: 614. containing the raw bytes of 'buffer', a
     *note buffer-compatible object: 260. or *note str: 169. (encoded to
     UTF-8 before processing), and their length in bytes.

     The 'errors' argument is ignored.

          >>> codecs.readbuffer_encode(b"Zito")
          (b'Zito', 4)

このモジュールは以下のような定数も定義しています。プラットフォーム依存な
ファイルを読み書きするのに役立ちます:

 -- データ: codecs.BOM
 -- データ: codecs.BOM_BE
 -- データ: codecs.BOM_LE
 -- データ: codecs.BOM_UTF8
 -- データ: codecs.BOM_UTF16
 -- データ: codecs.BOM_UTF16_BE
 -- データ: codecs.BOM_UTF16_LE
 -- データ: codecs.BOM_UTF32
 -- データ: codecs.BOM_UTF32_BE
 -- データ: codecs.BOM_UTF32_LE

     これらの定数は、いくつかのエンコーディングの Unicode のバイトオーダ
     マーク (BOM) で、様々なバイトシーケンスを定義します。これらは、
     UTF-16 と UTF-32 のデータストリームで使用するバイトオーダを指定した
     り、 UTF-8 で Unicode シグネチャとして使われます。 *note BOM_UTF16:
     284c. は、プラットフォームのネイティブバイトオーダによって *note
     BOM_UTF16_BE: 284d. または *note BOM_UTF16_LE: 284e. です。 *note
     BOM: 2848. は *note BOM_UTF16: 284c. のエイリアスです。同様に、
     *note BOM_LE: 284a. は *note BOM_UTF16_LE: 284e. の、 *note BOM_BE:
     2849. は *note BOM_UTF16_BE: 284d. のエイリアスです。その他の定数は
     UTF-8 と UTF-32 エンコーディングの BOM を表します。

* Menu:

* Codec 基底クラス::
* エンコーディングと Unicode::
* 標準エンコーディング::
* Python 特有のエンコーディング::
* encodings: encodings --- Encodings package. Encodings package
* encodings.idna: encodings idna --- Internationalized Domain Names in Applications. Internationalized Domain Names in Applications
* encodings.mbcs: encodings mbcs --- Windows ANSI codepage. Windows ANSI codepage
* encodings.utf_8_sig: encodings utf_8_sig --- UTF-8 codec with BOM signature. UTF-8 codec with BOM signature

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/codecs.py


File: python.info,  Node: Codec 基底クラス,  Next: エンコーディングと Unicode,  Up: codecs --- codec レジストリと基底クラス

5.7.2.1 Codec 基底クラス
........................

The ‘codecs’ module defines a set of base classes which define the
interfaces for working with codec objects, and can also be used as the
basis for custom codec implementations.

Python で codec として使えるようにするには、ステートレスエンコーダ、ステ
ートレスデコーダ、ストリームリーダ、ストリームライタの 4 つのインターフ
ェースを定義する必要があります。通常は、ストリームリーダとライタはステー
トレスエンコーダとデコーダを再利用して、ファイルプロトコルを実装します。
codec の作者は、codec がエンコードとデコードのエラーの処理方法も定義する
必要があります。
* Menu:

* エラーハンドラ::
* ステートレスなエンコードとデコード::
* インクリメンタルなエンコードとデコード::
* ストリームのエンコードとデコード::


File: python.info,  Node: エラーハンドラ,  Next: ステートレスなエンコードとデコード,  Up: Codec 基底クラス

5.7.2.2 エラーハンドラ
......................

エラー処理の簡便化と標準化のため、コーデックは、'errors' 文字列引数を指
定した場合に別のエラー処理を行うような仕組みを実装してもかまいません:

     >>> 'German ß, ♬'.encode(encoding='ascii', errors='backslashreplace')
     b'German \\xdf, \\u266c'
     >>> 'German ß, ♬'.encode(encoding='ascii', errors='xmlcharrefreplace')
     b'German &#223;, &#9836;'

The following error handlers can be used with all Python *note
標準エンコーディング: fb8. codecs:

値                            意味
                              
----------------------------------------------------------------------------------
                              
‘'strict'’                    *note UnicodeError: 462. (または、そのサブクラス)
                              を送出します。これがデフォルトの動作です。
                              *note strict_errors(): 2855. で実装されています。
                              
                              
‘'ignore'’                    不正な形式のデータを無視し、何も通知することなく
                              処理を継続します。*note ignore_errors(): 2856. で
                              実装されています。
                              
                              
‘'replace'’                   Replace with a replacement marker.  On encoding,
                              use ‘?’ (ASCII character).  On decoding, use ‘�’
                              (U+FFFD, the official REPLACEMENT CHARACTER).
                              Implemented in *note replace_errors(): 18c2.
                              
                              
‘'backslashreplace'’          Replace with backslashed escape sequences.  On
                              encoding, use hexadecimal form of Unicode code
                              point with formats ‘\xHH’ ‘\uXXXX’ ‘\UXXXXXXXX’.
                              On decoding, use hexadecimal form of byte value
                              with format ‘\xHH’.  Implemented in
                              *note backslashreplace_errors(): 18c3.
                              
                              
‘'surrogateescape'’           デコード時には、バイト列を ‘U+DC80’ から ‘U+DCFF’
                              の範囲の個々のサロゲートコードで置き換えます。デ
                              ータのエンコード時に ‘'surrogateescape'’ エラーハ
                              ンドラが使用されると、このコードは同じバイト列に
                              戻されます。 (詳しくは PEP 383(1) を参照。)
                              

The following error handlers are only applicable to encoding (within
*note text encodings: 25db.):

値                            意味
                              
----------------------------------------------------------------------------------
                              
‘'xmlcharrefreplace'’         Replace with XML/HTML numeric character
                              reference, which is a decimal form of Unicode
                              code point with format ‘&#NUM;’.  Implemented in
                              *note xmlcharrefreplace_errors(): 18c4.
                              
                              
‘'namereplace'’               Replace with ‘\N{...}’ escape sequences, what
                              appears in the braces is the Name property from
                              Unicode Character Database.  Implemented in
                              *note namereplace_errors(): 2857.
                              

さらに、次のエラーハンドラは与えられた codec に特有です:

値                      Codecs                       意味
                                                     
-----------------------------------------------------------------------------------------------------
                                                     
‘'surrogatepass'’       utf-8, utf-16, utf-32,       Allow encoding and decoding surrogate code
                        utf-16-be, utf-16-le,        point (‘U+D800’ - ‘U+DFFF’) as normal code
                        utf-32-be, utf-32-le         point.  Otherwise these codecs treat the
                                                     presence of surrogate code point in
                                                     *note str: 169. as an error.
                                                     

Added in version 3.1: ‘'surrogateescape'’ および ‘'surrogatepass'’ エラ
ーハンドラ。

バージョン 3.4 で変更: The ‘'surrogatepass'’ error handler now works
with utf-16* and utf-32* codecs.

Added in version 3.5: ‘'namereplace'’ エラーハンドラです。

バージョン 3.5 で変更: The ‘'backslashreplace'’ error handler now works
with decoding and translating.

次のように、名前付きの新しいエラーハンドラを登録することで、許可される値
の集合を拡張することができます。

 -- の関数: codecs.register_error (name, error_handler, /)

     エラーハンドラ 'error_handler' を名前 'name' で登録します。エンコー
     ド中およびデコード中にエラーが送出された場合、'name' が errors 引数
     として指定されていれば 'error_handler' が呼び出されます。

     'error_handler' はエラーの場所に関する情報の入った *note
     UnicodeEncodeError: 887. インスタンスとともに呼び出されます。エラー
     処理関数はこの例外を送出するか、別の例外を送出するか、入力のエンコ
     ードできなかった部分の代替文字列とエンコードを再開する場所が入った
     タプルを返す必要があります。代替文字列は *note str: 169. または
     *note bytes: 192. のいずれかにすることができます。代替文字列がバイ
     ト列である場合、エンコーダは単に出力バッファにそれをコピーします。
     代替文字列が文字列である場合、エンコーダは代替文字列をエンコードし
     ます。元の入力中の指定位置からエンコードが再開されます。位置を負の
     値にすると、入力文字列の末端からの相対位置として扱われます。境界の
     外側にある位置を返した場合には *note IndexError: 174e. が送出されま
     す。

     デコードと翻訳の動作は似ていますが、エラーハンドラに渡されるのが
     *note UnicodeDecodeError: c08. か *note UnicodeTranslateError:
     18fd. である点と、エラーハンドラの置換した内容が直接出力されるとい
     う点が異なります。

登録済みのエラーハンドラ (標準エラーハンドラを含む) は、次のようにその名
前で検索することができます。

 -- の関数: codecs.lookup_error (name, /)

     名前 'name' で登録済みのエラーハンドラを返します。

     エラーハンドラが見つからなければ *note LookupError: 23e5. を送出し
     ます。

以下の標準エラーハンドラも、モジュールレベルの関数として利用できます。

 -- の関数: codecs.strict_errors (exception)

     Implements the ‘'strict'’ error handling.

     Each encoding or decoding error raises a *note UnicodeError: 462.

 -- の関数: codecs.ignore_errors (exception)

     Implements the ‘'ignore'’ error handling.

     Malformed data is ignored; encoding or decoding is continued
     without further notice.

 -- の関数: codecs.replace_errors (exception)

     Implements the ‘'replace'’ error handling.

     Substitutes ‘?’ (ASCII character) for encoding errors or ‘�’
     (U+FFFD, the official REPLACEMENT CHARACTER) for decoding errors.

 -- の関数: codecs.backslashreplace_errors (exception)

     Implements the ‘'backslashreplace'’ error handling.

     Malformed data is replaced by a backslashed escape sequence.  On
     encoding, use the hexadecimal form of Unicode code point with
     formats ‘\xHH’ ‘\uXXXX’ ‘\UXXXXXXXX’.  On decoding, use the
     hexadecimal form of byte value with format ‘\xHH’.

     バージョン 3.5 で変更: Works with decoding and translating.

 -- の関数: codecs.xmlcharrefreplace_errors (exception)

     Implements the ‘'xmlcharrefreplace'’ error handling (for encoding
     within *note text encoding: 25db. only).

     The unencodable character is replaced by an appropriate XML/HTML
     numeric character reference, which is a decimal form of Unicode
     code point with format ‘&#NUM;’ .

 -- の関数: codecs.namereplace_errors (exception)

     Implements the ‘'namereplace'’ error handling (for encoding within
     *note text encoding: 25db. only).

     The unencodable character is replaced by a ‘\N{...}’ escape
     sequence.  The set of characters that appear in the braces is the
     Name property from Unicode Character Database.  For example, the
     German lowercase letter ‘'ß'’ will be converted to byte sequence
     ‘\N{LATIN SMALL LETTER SHARP S}’ .

     Added in version 3.5.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0383/


File: python.info,  Node: ステートレスなエンコードとデコード,  Next: インクリメンタルなエンコードとデコード,  Prev: エラーハンドラ,  Up: Codec 基底クラス

5.7.2.3 ステートレスなエンコードとデコード
..........................................

基底の *note Codec: 2859. クラスは以下のメソッドを定義します。これらのメ
ソッドは、内部状態を持たないエンコーダ／デコーダ関数のインターフェースを
定義します:

 -- クラス: codecs.Codec

      -- メソッド: encode (input, errors='strict')

          オブジェクト 'input' エンコードし、(出力オブジェクト, 消費した
          長さ) のタプルを返します。例えば、 *note
          テキストエンコーディング: 25db. は文字列オブジェクトを特有の文
          字セット (例えば ‘cp1252’ や ‘iso-8859-1’) を用いてバイト列オ
          ブジェクトに変換します。

          'errors' 引数は適用するエラー処理を定義します。‘'strict'’ 処理
          がデフォルトです。

          このメソッドは *note Codec: 2859. に内部状態を保存してはなりま
          せん。効率よくエンコードするために状態を保持しなければならない
          ような codecs には *note StreamWriter: 283a. を使ってください
          。

          エンコーダは長さが 0 の入力を処理できなければなりません。この
          場合、空のオブジェクトを出力オブジェクトとして返さなければなり
          ません。

      -- メソッド: decode (input, errors='strict')

          オブジェクト 'input' をデコードし、(出力オブジェクト, 消費した
          長さ) のタプルを返します。例えば、 *note
          テキストエンコーディング: 25db. は、特定の文字集合エンコーディ
          ングでエンコードされたバイト列オブジェクトを文字列オブジェクト
          に変換します。

          テキストエンコーディングとバイト列からバイト列への codec では
          、'input' は bytes オブジェクト、または読み出し専用のバッファ
          インターフェースを提供するオブジェクトである必要があります。例
          えば、buffer オブジェクトやメモリマップドファイルでなければな
          りません。

          'errors' 引数は適用するエラー処理を定義します。‘'strict'’ 処理
          がデフォルトです。

          このメソッドは、 *note Codec: 2859. インスタンスに内部状態を保
          存してはなりません。効率よくエンコード／デコードするために状態
          を保持しなければならないような codecs には *note StreamReader:
          283b. を使ってください。

          デコーダは長さが 0 の入力を処理できなければなりません。この場
          合、空のオブジェクトを出力オブジェクトとして返さなければなりま
          せん。


File: python.info,  Node: インクリメンタルなエンコードとデコード,  Next: ストリームのエンコードとデコード,  Prev: ステートレスなエンコードとデコード,  Up: Codec 基底クラス

5.7.2.4 インクリメンタルなエンコードとデコード
..............................................

*note IncrementalEncoder: 2836. クラスおよび *note IncrementalDecoder:
2837. クラスはそれぞれインクリメンタル・エンコードおよびデコードのための
基本的なインターフェースを提供します。エンコード／デコードは内部状態を持
たないエンコーダ／デコーダを一度呼び出すことで行なわれるのではなく、イン
クリメンタル・エンコーダ／デコーダの *note encode(): 285b./*note
decode(): 285c. メソッドを複数回呼び出すことで行なわれます。インクリメン
タル・エンコーダ／デコーダはメソッド呼び出しの間エンコード／デコード処理
の進行を管理します。

*note encode(): 285b./*note decode(): 285c. メソッド呼び出しの出力結果を
まとめたものは、入力をひとまとめにして内部状態を持たないエンコーダ／デコ
ーダでエンコード／デコードしたものと同じになります。

* Menu:

* IncrementalEncoder オブジェクト::
* IncrementalDecoder オブジェクト::


File: python.info,  Node: IncrementalEncoder オブジェクト,  Next: IncrementalDecoder オブジェクト,  Up: インクリメンタルなエンコードとデコード

5.7.2.5 IncrementalEncoder オブジェクト
.......................................

*note IncrementalEncoder: 2836. クラスは入力を複数ステップでエンコードす
るのに使われます。全てのインクリメンタル・エンコーダが Python codec レジ
ストリと互換性を持つために定義すべきメソッドとして、このクラスには以下の
メソッドが定義されています。

 -- クラス: codecs.IncrementalEncoder (errors='strict')

     *note IncrementalEncoder: 2836. インスタンスのコンストラクタ。

     全てのインクリメンタル・エンコーダはこのコンストラクタインターフェ
     ースを提供しなければなりません。さらにキーワード引数を付け加えるの
     は構いませんが、Python codec レジストリで利用されるのはここで定義さ
     れているものだけです。

     *note IncrementalEncoder: 2836. は、 'errors' キーワード引数を提供
     することで、様々なエラー取扱方法を実装することができます。取り得る
     値については *note エラーハンドラ: 1b6f. を参照してください。

     'errors' 引数は、同名の属性に代入されます。この属性を変更すると、
     *note IncrementalEncoder: 2836. オブジェクトが生きている間に、異な
     るエラー処理方法に切り替えることができるようになります。

      -- メソッド: encode (object, final=False)

          'object' を(エンコーダの現在の状態を考慮に入れて)エンコードし
          、得られたエンコードされたオブジェクトを返します。 *note
          encode(): 1104. 呼び出しがこれで最後という時には 'final' は真
          でなければなりません(デフォルトは偽です)。

      -- メソッド: reset ()

          エンコーダを初期状態にリセットします。出力は破棄されます。
          ‘.encode(object, final=True)’ を呼び出して、必要に応じて空バイ
          ト列またはテキスト文字列を渡すことにより、エンコーダをリセット
          し、出力を取得します。

      -- メソッド: getstate ()

          エンコーダの現在の状態を返します。それは必ず整数でなければなり
          ません。実装は、‘0’ が最も一般的な状態であることを保証すべきで
          す。 (整数より複雑な状態は、状態を marshal/pickle して生じた文
          字列のバイトを整数にコード化することによって整数に変換すること
          ができます。)

      -- メソッド: setstate (state)

          エンコーダの状態を 'state' にセットします。 'state' は *note
          getstate(): 2860. によって返されたエンコーダ状態でなければなり
          ません。


File: python.info,  Node: IncrementalDecoder オブジェクト,  Prev: IncrementalEncoder オブジェクト,  Up: インクリメンタルなエンコードとデコード

5.7.2.6 IncrementalDecoder オブジェクト
.......................................

*note IncrementalDecoder: 2837. クラスは入力を複数ステップでデコードする
のに使われます。全てのインクリメンタル・デコーダが Python codec レジスト
リと互換性を持つために定義すべきメソッドとして、このクラスには以下のメソ
ッドが定義されています。

 -- クラス: codecs.IncrementalDecoder (errors='strict')

     *note IncrementalDecoder: 2837. インスタンスのコンストラクタ。

     全てのインクリメンタル・デコーダはこのコンストラクタインターフェー
     スを提供しなければなりません。さらにキーワード引数を付け加えるのは
     構いませんが、Python codec レジストリで利用されるのはここで定義され
     ているものだけです。

     *note IncrementalDecoder: 2837. は、 'errors' キーワード引数を提供
     することで、様々なエラー取扱方法を実装することができます。取り得る
     値については *note エラーハンドラ: 1b6f. を参照してください。

     'errors' 引数は、同名の属性に代入されます。この属性を変更すると、
     *note IncrementalDecoder: 2837. オブジェクトが生きている間に、異な
     るエラー処理方法に切り替えることができるようになります。

      -- メソッド: decode (object, final=False)

          'object' を(デコーダの現在の状態を考慮に入れて)デコードし、得
          られたデコードされたオブジェクトを返します。 *note decode():
          1105. 呼び出しがこれで最後という時には 'final' は真でなければ
          なりません(デフォルトは偽です)。もし 'final' が真ならばデコー
          ダは入力をデコードし切り全てのバッファをフラッシュしなければな
          りません。そうできない場合(たとえば入力の最後に不完全なバイト
          列があるから)、デコーダは内部状態を持たない場合と同じようにエ
          ラーの取り扱いを開始しなければなりません(例外を送出するかもし
          れません)。

      -- メソッド: reset ()

          デコーダを初期状態にリセットします。

      -- メソッド: getstate ()

          デコーダの現在の状態を返します。これは2要素を含むタプルでなけ
          ればなりません。1番目はまだデコードされていない入力を含むバッ
          ファです。2番目は整数で、付加的な状態情報です (実装は ‘0’ が最
          も一般的な付加的な状態情報であることを保証すべきです)。この付
          加的な状態情報が ‘0’ である場合、デコーダを入力がバッファされ
          ていない状態に戻して、付加的な状態情報を ‘0’ にセットすること
          が可能でなければなりません。その結果、以前バッファされた入力を
          デコーダに与えることで、何の出力もせずにデコーダを前の状態に戻
          します。 (整数より複雑な付加的な状態情報は、情報を
          marshal/pickle して、結果として生じる文字列のバイト列を整数に
          エンコードすることで、整数に変換することができます。)

      -- メソッド: setstate (state)

          デコーダの状態を 'state' にセットします。 'state' は *note
          getstate(): 2865. によって返されたデコーダの状態でなければなり
          ません。


File: python.info,  Node: ストリームのエンコードとデコード,  Prev: インクリメンタルなエンコードとデコード,  Up: Codec 基底クラス

5.7.2.7 ストリームのエンコードとデコード
........................................

The *note StreamWriter: 283a. and *note StreamReader: 283b. classes
provide generic working interfaces which can be used to implement new
encoding submodules very easily.  See ‘encodings.utf_8’ for an example
of how this is done.

* Menu:

* StreamWriter オブジェクト::
* StreamReader オブジェクト::
* StreamReaderWriter オブジェクト::
* StreamRecoder オブジェクト::


File: python.info,  Node: StreamWriter オブジェクト,  Next: StreamReader オブジェクト,  Up: ストリームのエンコードとデコード

5.7.2.8 StreamWriter オブジェクト
.................................

*note StreamWriter: 283a. クラスは *note Codec: 2859. のサブクラスで、以
下のメソッドを定義しています。全てのストリームライタは、 Python の codec
レジストリとの互換性を保つために、これらのメソッドを定義する必要がありま
す。

 -- クラス: codecs.StreamWriter (stream, errors='strict')

     *note StreamWriter: 283a. インスタンスのコンストラクタです。

     全てのストリームライタはコンストラクタとしてこのインターフェースを
     提供しなければなりません。キーワード引数を追加しても構いませんが、
     Python の codec レジストリはここで定義されている引数だけを使います
     。

     'stream' 引数は、特定の codec に対応して、テキストまたはバイナリデ
     ータの書き込みが可能なファイルライクオブジェクトである必要がありま
     す。

     *note StreamWriter: 283a. は、 'errors' キーワード引数を提供するこ
     とで、様々なエラー取扱方法を実装することができます。下層のストリー
     ム codec がサポートできる標準エラーハンドラについては *note
     エラーハンドラ: 1b6f. を参照してください。

     'errors' 引数は、同名の属性に代入されます。この属性を変更すると、
     *note StreamWriter: 283a. オブジェクトが生きている間に、異なるエラ
     ー処理に変更できます。

      -- メソッド: write (object)

          'object' の内容をエンコードしてストリームに書き出します。

      -- メソッド: writelines (list)

          Writes the concatenated iterable of strings to the stream
          (possibly by reusing the *note write(): 286a. method).
          Infinite or very large iterables are not supported.  The
          standard bytes-to-bytes codecs do not support this method.

      -- メソッド: reset ()

          内部状態保持に使われた codec のバッファをリセットします。

          このメソッドが呼び出された場合、出力先データをきれいな状態にし
          、わざわざストリーム全体を再スキャンして状態を元に戻さなくても
          新しくデータを追加できるようにしなければなりません。

ここまでで挙げたメソッドの他にも、 *note StreamWriter: 283a. では背後に
あるストリームの他の全てのメソッドや属性を継承しなければなりません。


File: python.info,  Node: StreamReader オブジェクト,  Next: StreamReaderWriter オブジェクト,  Prev: StreamWriter オブジェクト,  Up: ストリームのエンコードとデコード

5.7.2.9 StreamReader オブジェクト
.................................

*note StreamReader: 283b. クラスは *note Codec: 2859. のサブクラスで、以
下のメソッドを定義しています。全てのストリームリーダは、 Python の codec
レジストリとの互換性を保つために、これらのメソッドを定義する必要がありま
す。

 -- クラス: codecs.StreamReader (stream, errors='strict')

     *note StreamReader: 283b. インスタンスのコンストラクタです。

     全てのストリームリーダはコンストラクタとしてこのインターフェースを
     提供しなければなりません。キーワード引数を追加しても構いませんが、
     Python の codec レジストリはここで定義されている引数だけを使います
     。

     'stream' 引数は、特定の codec に対応して、テキストまたはバイナリデ
     ータの読み出しが可能なファイルライクオブジェクトである必要がありま
     す。

     *note StreamReader: 283b. は、 'errors' キーワード引数を提供するこ
     とで、様々なエラー取扱方法を実装することができます。下層のストリー
     ム codec がサポートできる標準エラーハンドラについては *note
     エラーハンドラ: 1b6f. を参照してください。

     'errors' 引数は、同名の属性に代入されます。この属性を変更すると、
     *note StreamReader: 283b. オブジェクトが生きている間に、異なるエラ
     ー処理に変更できます。

     'errors' 引数に許される値の集合は *note register_error(): 16b4. で
     拡張できます。

      -- メソッド: read (size=-1, chars=-1, firstline=False)

          ストリームからのデータをデコードし、デコード済のオブジェクトを
          返します。

          'chars' 引数は、いくつのデコードされたコードポイントまたはバイ
          ト列を返すかを表します。 *note read(): 286f. メソッドは、要求
          された数以上のデータを返すことはありませんが、データがそれより
          少ない場合には要求された数未満のデータを返す場合があります。

          'size' 引数は、デコード用に読み込むエンコードされたバイト列ま
          たはコードポイントの、およその最大バイト数を表します。デコーダ
          はこの値を適切な値に変更できます。デフォルト値 -1 の場合、可能
          な限り多くのデータを読み込みます。この引数の目的は、巨大なファ
          イルの一括デコードを防ぐことにあります。

          'firstline' フラグは、1行目さえ返せばその後の行でデコードエラ
          ーがあっても無視して十分だ、ということを示します。

          このメソッドは貪欲な読み込み戦略を取るべきです。すなわち、エン
          コーディング定義と size の値が許す範囲で、できるだけ多くのデー
          タを読むべきだということです。たとえば、ストリーム上にエンコー
          ディングの終端や状態の目印があれば、それも読み込みます。

      -- メソッド: readline (size=None, keepends=True)

          入力ストリームから1行読み込み、デコード済みのデータを返します
          。

          'size' が与えられた場合、ストリームの *note read(): 286f. メソ
          ッドに size 引数として渡されます。

          'keepends' が偽の場合には行末の改行が削除された行が返ります。

      -- メソッド: readlines (sizehint=None, keepends=True)

          入力ストリームから全ての行を読み込み、行のリストとして返します
          。

          'keepends' が真なら、改行は、codec の *note decode(): 1105. メ
          ソッドを使って実装され、リスト要素の中に含まれます。

          'sizehint' が与えられた場合、ストリームの *note read(): 286f.
          メソッドに 'size' 引数として渡されます。

      -- メソッド: reset ()

          内部状態保持に使われた codec のバッファをリセットします。

          ストリームの読み位置を再設定してはならないので注意してください
          。このメソッドはデコードの際にエラーから復帰できるようにするた
          めのものです。

ここまでで挙げたメソッドの他にも、 *note StreamReader: 283b. では背後に
あるストリームの他の全てのメソッドや属性を継承しなければなりません。


File: python.info,  Node: StreamReaderWriter オブジェクト,  Next: StreamRecoder オブジェクト,  Prev: StreamReader オブジェクト,  Up: ストリームのエンコードとデコード

5.7.2.10 StreamReaderWriter オブジェクト
........................................

*note StreamReaderWriter: 2843. は、読み書き両方に使えるストリームをラッ
プできる便利なクラスです。

*note lookup(): b5c. 関数が返すファクトリ関数を使って、インスタンスを生
成するという設計です。

 -- クラス: codecs.StreamReaderWriter (stream, Reader, Writer,
          errors='strict')

     *note StreamReaderWriter: 2843. インスタンスを生成します。 'stream'
     はファイル類似のオブジェクトです。 'Reader' と 'Writer' は、それぞ
     れ *note StreamReader: 283b. と *note StreamWriter: 283a. インター
     フェースを提供するファクトリ関数かファクトリクラスでなければなりま
     せん。エラー処理は、ストリームリーダとライタで定義したものと同じよ
     うに行われます。

*note StreamReaderWriter: 2843. インスタンスは、 *note StreamReader:
283b. クラスと *note StreamWriter: 283a. クラスを合わせたインターフェー
スを継承します。元になるストリームからは、他のメソッドや属性を継承します
。


File: python.info,  Node: StreamRecoder オブジェクト,  Prev: StreamReaderWriter オブジェクト,  Up: ストリームのエンコードとデコード

5.7.2.11 StreamRecoder オブジェクト
...................................

*note StreamRecoder: 1dd4. はデータをあるエンコーディングから別のエンコ
ーディングに変換します。異なるエンコーディング環境を扱うとき、便利な場合
があります。

*note lookup(): b5c. 関数が返すファクトリ関数を使って、インスタンスを生
成するという設計です。

 -- クラス: codecs.StreamRecoder (stream, encode, decode, Reader,
          Writer, errors='strict')

     Creates a *note StreamRecoder: 1dd4. instance which implements a
     two-way conversion: 'encode' and 'decode' work on the frontend —
     the data visible to code calling *note read(): 286f. and *note
     write(): 286a, while 'Reader' and 'Writer' work on the backend —
     the data in 'stream'.

     これらのオブジェクトを使って、たとえば、 Latin-1 から UTF-8 への変
     換、あるいは逆向きの変換を、透過的に行うことができます。

     'stream' 引数はファイルライクオブジェクトでなくてはなりません。

     'encode' 引数と 'decode' 引数は *note Codec: 2859. のインターフェー
     スに忠実でなくてはなりません。'Reader' と 'Writer' は、それぞれ
     *note StreamReader: 283b. と *note StreamWriter: 283a. のインターフ
     ェースを提供するオブジェクトのファクトリ関数かクラスでなくてはなり
     ません。

     エラー処理はストリーム・リーダやライタで定義されている方法と同じよ
     うに行われます。

*note StreamRecoder: 1dd4. インスタンスは、 *note StreamReader: 283b. と
*note StreamWriter: 283a. クラスを合わせたインターフェースを定義します。
また、元のストリームのメソッドと属性も継承します。


File: python.info,  Node: エンコーディングと Unicode,  Next: 標準エンコーディング,  Prev: Codec 基底クラス,  Up: codecs --- codec レジストリと基底クラス

5.7.2.12 エンコーディングと Unicode
...................................

文字列は内部的に ‘U+0000’-‘U+10FFFF’ の範囲のコードポイントのシーケンス
として格納されます (実装に関する詳細については PEP 393(1) を参照してくだ
さい)。 文字列オブジェクトが CPU とメモリの外で使用されるようになると、
エンディアンやこれらの配列をバイト列として格納する方法が問題になります。
他のコーデックでも同様ですが、文字列オブジェクトをバイト列に変換すること
は 'エンコード' と呼ばれます。 また、バイト列から文字列オブジェクトを再
生成することは 'デコード' と呼ばれます。 テキストをシリアライズするコー
デックには多くの種類があります。 それらは、集合的に term:‘テキストエンコ
ーディング <text encoding>’ と呼ばれます。

最も単純なテキストエンコーディング (‘'latin-1'’ または ‘'iso-8859-1'’) で
は、0-255 の範囲にあるコードポイントを ‘0x0’-‘0xff’ のバイトにマップしま
す。 つまり、この codec では ‘U+00FF’ 以上のコードポイントを含む文字列オ
ブジェクトをエンコードすることはできません。 このようなエンコード処理を
しようとすると、次のように *note UnicodeEncodeError: 887. が送出されます
(エラーメッセージの細かところは異なる場合があります。):
‘UnicodeEncodeError: 'latin-1' codec can't encode character '\u1234' in
position 3: ordinal not in range(256)’ 。

他のエンコーディングの一群 (charmap エンコーディングと呼ばれます) があり
、 Unicode コードポイントの別の部分集合と、それらから ‘0x0’-‘0xff’ のバ
イトへの対応付けを選択したものです。 これがどのように行なわれるかを知る
には、単にたとえば ‘encodings/cp1252.py’ (主に Windows で使われるエンコ
ーディングです) を開いてみてください。 256 文字のひとつの文字列定数があ
り、どの文字がどのバイト値へ対応付けられるかが示されています。

All of these encodings can only encode 256 of the 1114112 code points
defined in Unicode.  A simple and straightforward way that can store
each Unicode code point, is to store each code point as four consecutive
bytes.  There are two possibilities: store the bytes in big endian or in
little endian order.  These two encodings are called ‘UTF-32-BE’ and
‘UTF-32-LE’ respectively.  Their disadvantage is that if, for example,
you use ‘UTF-32-BE’ on a little endian machine you will always have to
swap bytes on encoding and decoding.  Python's ‘UTF-16’ and ‘UTF-32’
codecs avoid this problem by using the platform's native byte order when
no BOM is present.  Python follows prevailing platform practice, so
native-endian data round-trips without redundant byte swapping, even
though the Unicode Standard defaults to big-endian when the byte order
is unspecified.  When these bytes are read by a CPU with a different
endianness, the bytes have to be swapped.  To be able to detect the
endianness of a ‘UTF-16’ or ‘UTF-32’ byte sequence, a BOM ("Byte Order
Mark") is used.  This is the Unicode character ‘U+FEFF’.  This character
can be prepended to every ‘UTF-16’ or ‘UTF-32’ byte sequence.  The byte
swapped version of this character (‘0xFFFE’) is an illegal character
that may not appear in a Unicode text.  When the first character of a
‘UTF-16’ or ‘UTF-32’ byte sequence is ‘U+FFFE’, the bytes have to be
swapped on decoding.

Unfortunately the character ‘U+FEFF’ had a second purpose as a ‘ZERO
WIDTH NO-BREAK SPACE’: a character that has no width and doesn't allow a
word to be split.  It can e.g.  be used to give hints to a ligature
algorithm.  With Unicode 4.0 using ‘U+FEFF’ as a ‘ZERO WIDTH NO-BREAK
SPACE’ has been deprecated (with ‘U+2060’ (‘WORD JOINER’) assuming this
role).  Nevertheless Unicode software still must be able to handle
‘U+FEFF’ in both roles: as a BOM it's a device to determine the storage
layout of the encoded bytes, and vanishes once the byte sequence has
been decoded into a string; as a ‘ZERO WIDTH NO-BREAK SPACE’ it's a
normal character that will be decoded like any other.

さらにもう一つ Unicode 文字全てをエンコードできるエンコーディングがあり
、UTF-8 と呼ばれています。UTF-8 は8ビットエンコーディングで、したがって
UTF-8 にはバイト順の問題はありません。UTF-8 バイト列の各バイトは二つのパ
ートから成ります。二つはマーカ(上位数ビット)とペイロードです。マーカは
0ビットから4ビットの ‘1’ の列に ‘0’ のビットが一つ続いたものです。
Unicode 文字は次のようにエンコードされます (x はペイロードを表わし、連結
されると一つの Unicode 文字を表わします):

範囲                                    エンコーディング
                                        
-------------------------------------------------------------------------------------------
                                        
‘U-00000000’ ...  ‘U-0000007F’          0xxxxxxx
                                        
                                        
‘U-00000080’ ...  ‘U-000007FF’          110xxxxx 10xxxxxx
                                        
                                        
‘U-00000800’ ...  ‘U-0000FFFF’          1110xxxx 10xxxxxx 10xxxxxx
                                        
                                        
‘U-00010000’ ...  ‘U-0010FFFF’          11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
                                        

Unicode 文字の最下位ビットとは最も右にある x のビットです。

UTF-8 は8ビットエンコーディングなので BOM は必要とせず、デコードされた文
字列中の ‘U+FEFF’ は(たとえ最初の文字であったとしても) ‘ZERO WIDTH
NO-BREAK SPACE’ として扱われます。

外部からの情報無しには、文字列のエンコーディングにどのエンコーディングが
使われたのか信頼できる形で決定することは不可能です。どの charmap エンコ
ーディングもどんなランダムなバイト列でもデコードできます。しかし UTF-8 で
はそれは可能ではありません。任意のバイト列を許さないような構造を持ってい
るからです。UTF-8 エンコーディングであることを検知する信頼性を向上させる
ために、Microsoft は Notepad プログラム用に UTF-8 の変種 (Python では
‘"utf-8-sig"’ と呼んでいます) を考案しました。Unicode 文字がファイルに書
き込まれる前に UTF-8 でエンコードした BOM (バイト列では ‘0xef’, ‘0xbb’,
‘0xbf’ のように見えます) が書き込まれます。このようなバイト値で charmap
エンコードされたファイルが始まることはほとんどあり得ない (たとえば
iso-8859-1 では

          LATIN SMALL LETTER I WITH DIAERESIS
          RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
          INVERTED QUESTION MARK

のようになる)ので、‘utf-8-sig’ エンコーディングがバイト列から正しく推測
される確率を高めます。つまりここでは BOM はバイト列を生成する際のバイト
順を決定できるように使われているのではなく、エンコーディングを推測する助
けになる印として使われているのです。‘utf-8-sig’ codec はエンコーディング
の際ファイルに最初の3文字として ‘0xef’, ‘0xbb’, ‘0xbf’ を書き込みます。
デコーディングの際はファイルの先頭に現れたこれら3バイトはスキップします
。UTF-8 では BOM の使用は推奨されておらず、一般的には避けるべきです。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0393/


File: python.info,  Node: 標準エンコーディング,  Next: Python 特有のエンコーディング,  Prev: エンコーディングと Unicode,  Up: codecs --- codec レジストリと基底クラス

5.7.2.13 標準エンコーディング
.............................

Python comes with a number of codecs built-in, either implemented as C
functions or with dictionaries as mapping tables.  The following table
lists the codecs by name, together with a few common aliases, and the
languages for which the encoding is likely used.  Neither the list of
aliases nor the list of languages is meant to be exhaustive.  Notice
that spelling alternatives that only differ in case or use a hyphen
instead of an underscore are also valid aliases because they are
equivalent when normalized by *note normalize_encoding(): 9fd.  For
example, ‘'utf-8'’ is a valid alias for the ‘'utf_8'’ codec.

     注釈: The below table lists the most common aliases, for a complete
     list refer to the source aliases.py(1) file.

On Windows, ‘cpXXX’ codecs are available for all code pages.  But only
codecs listed in the following table are guarantead to exist on other
platforms.

いくつかの一般的なエンコーディングは、パフォーマンスを改善するために
codec の検索機構を回避することがあります。 このような最適化の機会を認識
するのは、 CPython の限定された (大文字小文字を区別しない) 別名に対して
のみです: utf-8, utf8, latin-1, latin1, iso-8859-1, iso8859-1, mbcs
(Windows のみ), ascii, us-ascii, utf-16, utf16, utf-32, utf32 およびダッ
シュの代わりにアンダースコアを用いたもの。 これらのエンコーディングの別
のつづりを使用すると実行時間の低下を招くかもしれません。

バージョン 3.6 で変更: us-ascii に対して最適化の機会が認識されるようにな
りました。

多くの文字セットは同じ言語をサポートしています。これらの文字セットは個々
の文字 (例えば、EURO SIGN がサポートされているかどうか) や、文字のコード
部分への割り付けが異なります。特に欧州言語では、典型的に以下の変種が存在
します:

   * ISO 8859 コードセット

   * Microsoft Windows コードページで、8859 コード形式から導出されている
     が、制御文字を追加のグラフィック文字と置き換えたもの

   * IBM EBCDIC コードページ

   * ASCII 互換の IBM PC コードページ

Codec                 別名                                 言語
                                                           
------------------------------------------------------------------------------------------------
                                                           
ascii                 646, us-ascii                        英語
                                                           
                                                           
big5                  big5-tw, csbig5                      繁体字中国語
                                                           
                                                           
big5hkscs             big5-hkscs, hkscs                    繁体字中国語
                                                           
                                                           
cp037                 IBM037, IBM039                       英語
                                                           
                                                           
cp273                 273, IBM273, csIBM273                ドイツ語
                                                           
                                                           Added in version 3.4.
                                                           
                                                           
cp424                 EBCDIC-CP-HE, IBM424                 ヘブライ語
                                                           
                                                           
cp437                 437, IBM437                          英語
                                                           
                                                           
cp500                 EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500   西ヨーロッパ言語
                                                           
                                                           
cp720                                                      アラビア語
                                                           
                                                           
cp737                                                      ギリシャ語
                                                           
                                                           
cp775                 IBM775                               バルト沿岸国
                                                           
                                                           
cp850                 850, IBM850                          西ヨーロッパ言語
                                                           
                                                           
cp852                 852, IBM852                          中央および東ヨーロッパ
                                                           
                                                           
cp855                 855, IBM855                          Belarusian, Bulgarian, Macedonian,
                                                           Russian, Serbian
                                                           
                                                           
cp856                                                      ヘブライ語
                                                           
                                                           
cp857                 857, IBM857                          トルコ語
                                                           
                                                           
cp858                 858, IBM858                          西ヨーロッパ言語
                                                           
                                                           
cp860                 860, IBM860                          ポルトガル語
                                                           
                                                           
cp861                 861, CP-IS, IBM861                   アイスランド語
                                                           
                                                           
cp862                 862, IBM862                          ヘブライ語
                                                           
                                                           
cp863                 863, IBM863                          カナダ
                                                           
                                                           
cp864                 IBM864                               アラビア語
                                                           
                                                           
cp865                 865, IBM865                          デンマーク、ノルウェー
                                                           
                                                           
cp866                 866, IBM866                          ロシア語
                                                           
                                                           
cp869                 869, CP-GR, IBM869                   ギリシャ語
                                                           
                                                           
cp874                                                      タイ語
                                                           
                                                           
cp875                                                      ギリシャ語
                                                           
                                                           
cp932                 932, ms932, mskanji, ms-kanji,       日本語
                      windows-31j                          
                      
                                                           
cp949                 949, ms949, uhc                      韓国語
                                                           
                                                           
cp950                 950, ms950                           繁体字中国語
                                                           
                                                           
cp1006                                                     Urdu
                                                           
                                                           
cp1026                ibm1026                              トルコ語
                                                           
                                                           
cp1125                1125, ibm1125, cp866u, ruscii        ウクライナ語
                                                           
                                                           Added in version 3.4.
                                                           
                                                           
cp1140                ibm1140                              西ヨーロッパ言語
                                                           
                                                           
cp1250                windows-1250                         中央および東ヨーロッパ
                                                           
                                                           
cp1251                windows-1251                         Belarusian, Bulgarian, Macedonian,
                                                           Russian, Serbian
                                                           
                                                           
cp1252                windows-1252                         西ヨーロッパ言語
                                                           
                                                           
cp1253                windows-1253                         ギリシャ語
                                                           
                                                           
cp1254                windows-1254                         トルコ語
                                                           
                                                           
cp1255                windows-1255                         ヘブライ語
                                                           
                                                           
cp1256                windows-1256                         アラビア語
                                                           
                                                           
cp1257                windows-1257                         バルト沿岸国
                                                           
                                                           
cp1258                windows-1258                         ベトナム
                                                           
                                                           
euc_jp                eucjp, ujis, u-jis                   日本語
                                                           
                                                           
euc_jis_2004          jisx0213, eucjis2004                 日本語
                                                           
                                                           
euc_jisx0213          eucjisx0213                          日本語
                                                           
                                                           
euc_kr                euckr, korean, ksc5601, ks_c-5601,   韓国語
                      ks_c-5601-1987, ksx1001, ks_x-1001   
                      
                                                           
gb2312                chinese, csiso58gb231280, euc-cn,    簡体字中国語
                      euccn, eucgb2312-cn, gb2312-1980,    
                      gb2312-80, iso-ir-58
                      
                                                           
gbk                   936, cp936, ms936                    Unified Chinese
                                                           
                                                           
gb18030               gb18030-2000                         Unified Chinese
                                                           
                                                           
hz                    hzgb, hz-gb, hz-gb-2312              簡体字中国語
                                                           
                                                           
iso2022_jp            csiso2022jp, iso2022jp,              日本語
                      iso-2022-jp                          
                      
                                                           
iso2022_jp_1          iso2022jp-1, iso-2022-jp-1           日本語
                                                           
                                                           
iso2022_jp_2          iso2022jp-2, iso-2022-jp-2           日本語, 韓国語, 簡体字中国語, 西欧
                                                           , ギリシャ語
                                                           
                                                           
iso2022_jp_2004       iso2022jp-2004, iso-2022-jp-2004     日本語
                                                           
                                                           
iso2022_jp_3          iso2022jp-3, iso-2022-jp-3           日本語
                                                           
                                                           
iso2022_jp_ext        iso2022jp-ext, iso-2022-jp-ext       日本語
                                                           
                                                           
iso2022_kr            csiso2022kr, iso2022kr,              韓国語
                      iso-2022-kr                          
                      
                                                           
latin_1               iso-8859-1, iso8859-1, 8859,         西ヨーロッパ言語
                      cp819, latin, latin1, L1             
                      
                                                           
iso8859_2             iso-8859-2, latin2, L2               中央および東ヨーロッパ
                                                           
                                                           
iso8859_3             iso-8859-3, latin3, L3               エスペラント、マルタ
                                                           
                                                           
iso8859_4             iso-8859-4, latin4, L4               Northern Europe
                                                           
                                                           
iso8859_5             iso-8859-5, cyrillic                 Belarusian, Bulgarian, Macedonian,
                                                           Russian, Serbian
                                                           
                                                           
iso8859_6             iso-8859-6, arabic                   アラビア語
                                                           
                                                           
iso8859_7             iso-8859-7, greek, greek8            ギリシャ語
                                                           
                                                           
iso8859_8             iso-8859-8, hebrew                   ヘブライ語
                                                           
                                                           
iso8859_9             iso-8859-9, latin5, L5               トルコ語
                                                           
                                                           
iso8859_10            iso-8859-10, latin6, L6              北欧語
                                                           
                                                           
iso8859_11            iso-8859-11, thai                    タイ語
                                                           
                                                           
iso8859_13            iso-8859-13, latin7, L7              バルト沿岸国
                                                           
                                                           
iso8859_14            iso-8859-14, latin8, L8              ケルト語
                                                           
                                                           
iso8859_15            iso-8859-15, latin9, L9              西ヨーロッパ言語
                                                           
                                                           
iso8859_16            iso-8859-16, latin10, L10            南東ヨーロッパ
                                                           
                                                           
johab                 cp1361, ms1361                       韓国語
                                                           
                                                           
koi8_r                                                     ロシア語
                                                           
                                                           
koi8_t                                                     タジク
                                                           
                                                           Added in version 3.5.
                                                           
                                                           
koi8_u                                                     ウクライナ語
                                                           
                                                           
kz1048                kz_1048, strk1048_2002, rk1048       カザフ
                                                           
                                                           Added in version 3.5.
                                                           
                                                           
mac_cyrillic          maccyrillic                          Belarusian, Bulgarian, Macedonian,
                                                           Russian, Serbian
                                                           
                                                           
mac_greek             macgreek                             ギリシャ語
                                                           
                                                           
mac_iceland           maciceland                           アイスランド語
                                                           
                                                           
mac_latin2            maclatin2, maccentraleurope,         中央および東ヨーロッパ
                      mac_centeuro                         
                      
                                                           
mac_roman             macroman, macintosh                  西ヨーロッパ言語
                                                           
                                                           
mac_turkish           macturkish                           トルコ語
                                                           
                                                           
ptcp154               csptcp154, pt154, cp154,             カザフ
                      cyrillic-asian                       
                      
                                                           
shift_jis             csshiftjis, shiftjis, sjis, s_jis    日本語
                                                           
                                                           
shift_jis_2004        shiftjis2004, sjis_2004, sjis2004    日本語
                                                           
                                                           
shift_jisx0213        shiftjisx0213, sjisx0213,            日本語
                      s_jisx0213                           
                      
                                                           
utf_32                U32, utf32                           全ての言語
                                                           
                                                           
utf_32_be             UTF-32BE                             全ての言語
                                                           
                                                           
utf_32_le             UTF-32LE                             全ての言語
                                                           
                                                           
utf_16                U16, utf16                           全ての言語
                                                           
                                                           
utf_16_be             UTF-16BE                             全ての言語
                                                           
                                                           
utf_16_le             UTF-16LE                             全ての言語
                                                           
                                                           
utf_7                 U7, unicode-1-1-utf-7                全ての言語
                                                           
                                                           
utf_8                 U8, UTF, utf8, cp65001               全ての言語
                                                           
                                                           
utf_8_sig                                                  全ての言語
                                                           

バージョン 3.4 で変更: utf-16* と utf-32* のエンコーダは、サロゲートコー
ドポイント (‘U+D800’-‘U+DFFF’) がエンコードされることを許可しなくなりま
した。utf-32* デコーダは、サロゲートコードポイントに対応するバイト列をデ
コードしなくなりました。

バージョン 3.8 で変更: ‘cp65001’ is now an alias to ‘utf_8’.

バージョン 3.14 で変更: On Windows, ‘cpXXX’ codecs are now available for
all code pages.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/encodings/aliases.py


File: python.info,  Node: Python 特有のエンコーディング,  Next: encodings --- Encodings package,  Prev: 標準エンコーディング,  Up: codecs --- codec レジストリと基底クラス

5.7.2.14 Python 特有のエンコーディング
......................................

予め定義された codec のいくつかは Python 特有のものなので、それらの
codec 名は Python の外では無意味なものとなります。以下に、想定されている
入出力のタイプに基づいて、それらを表にしました（テキストエンコーディング
は codec の最も一般的な使用例ですが、その根底にある codec 基盤は、ただの
テキストエンコーディングというよりも、任意のデータの変換をサポートしてい
ることに注意してください）。非対称的な codec については、記載された意味
がエンコーディングの方向を説明しています。

* Menu:

* テキストエンコーディング::
* バイナリ変換 (Binary Transforms): バイナリ変換 Binary Transforms.
* Standalone Codec Functions::
* テキスト変換 (Text Transforms): テキスト変換 Text Transforms.


File: python.info,  Node: テキストエンコーディング,  Next: バイナリ変換 Binary Transforms,  Up: Python 特有のエンコーディング

5.7.2.15 テキストエンコーディング
.................................

次の codec では、 Unicode におけるテキストエンコーディングと同様に、
*note str: 169. から *note bytes: 192. へのエンコードと、 *note
bytes-like object: 193. から *note str: 169. へのデコードを提供します。

Codec                    別名          意味
                                       
-----------------------------------------------------------------------
                                       
idna                                   RFC 3490(1) の実装です。
                                       *note encodings.idna: 56. も
                                       参照してください。
                                       ‘errors='strict'’ のみがサポ
                                       ートされています。
                                       
                                       
mbcs                     ansi, dbcs    Windows のみ: 被演算子を ANSI
                                       コードページ (CP_ACP) に従っ
                                       てエンコードします。
                                       
                                       
oem                                    Windows のみ: 被演算子を OEM
                                       コードページ (CP_OEMCP) に従
                                       ってエンコードします。
                                       
                                       Added in version 3.6.
                                       
                                       
palmos                                 PalmOS 3.5 のエンコーディング
                                       です。
                                       
                                       
punycode                               RFC 3492(2) の実装です。ステ
                                       ートフル codecs は、サポート
                                       されません。
                                       
                                       
raw_unicode_escape                     Latin-1 encoding with
                                       ‘\uXXXX’ and ‘\UXXXXXXXX’ for
                                       other code points.  Existing
                                       backslashes are not escaped
                                       in any way.  It is used in
                                       the Python pickle protocol.
                                       
                                       
undefined                              This Codec should only be
                                       used for testing purposes.
                                       
                                       空文字列を含む全ての変換に対
                                       して例外を送出します。エラー
                                       ハンドラは無視されます。
                                       
                                       
unicode_escape                         ASCII でエンコードされた
                                       Python ソースコード内の、
                                       Unicode リテラルに適したエン
                                       コーディングです。ただし、引
                                       用符はエスケープされません。
                                       Latin-1 ソースコードからデコ
                                       ードします。実際には、Python
                                       のソースコードはデフォルトで
                                       は UTF-8 を使用することに注意
                                       してください。
                                       

バージョン 3.8 で変更: "unicode_internal" codec is removed.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc3490.html

   (2) https://datatracker.ietf.org/doc/html/rfc3492.html


File: python.info,  Node: バイナリ変換 Binary Transforms,  Next: Standalone Codec Functions,  Prev: テキストエンコーディング,  Up: Python 特有のエンコーディング

5.7.2.16 バイナリ変換 (Binary Transforms)
.........................................

以下の codec は、*note bytes-like object: 193. から *note bytes: 192. マ
ッピングへのバイナリ変換を提供します。*note bytes.decode(): ad3. はこの
変換をサポートしておらず、 *note str: 169. を出力するだけです。

Codec                      別名                   意味                               エンコーダ / デコーダ
                                                                                     
------------------------------------------------------------------------------------------------------------------------
                                                                                     
base64_codec (1)           base64, base_64        被演算子をマルチラインの MIME      *note base64.encodebytes(): b4c.
                                                  base64 に変換します (結果は常に    /
                                                  末尾の ‘'\n'’ を含みます)。        *note base64.decodebytes(): b4d.
                                                                                     
                                                  バージョン 3.4 で変更: 任意の
                                                  *note bytes-like object: 193. を
                                                  エンコードとデコード用の入力とし
                                                  て受け取ります。
                                                  
                                                                                     
bz2_codec                  bz2                    被演算子をbz2を使って圧縮します    *note bz2.compress(): 287d. /
                                                  。                                 *note bz2.decompress(): 12a0.
                                                                                     
                                                                                     
hex_codec                  hex                    被演算子をバイトあたり 2 桁の 16   *note binascii.b2a_hex(): 287e.
                                                  進数の表現に変換します。           /
                                                                                     *note binascii.a2b_hex(): 287f.
                                                                                     
                                                                                     
quopri_codec               quopri,                被演算子を MIME quoted printable   ‘quotetabs=True’ を指定した
                           quotedprintable,       形式に変換します。                 *note quopri.encode(): 2880. /
                           quoted_printable                                          *note quopri.decode(): 2881.
                                                                                     
                                                                                     
uu_codec                   uu                     被演算子を uuencode を用いて変換
                                                  します。
                                                  
                                                                                     
zlib_codec                 zip, zlib              被演算子を gzip を用いて圧縮しま   *note zlib.compress(): 84f. /
                                                  す。                               *note zlib.decompress(): f09.
                                                                                     

Added in version 3.2: バイナリ変換が復活しました。(訳注: 2.x にはあった
ものが 3.0 で削除されていた。)

バージョン 3.4 で変更: バイナリ変換のエイリアスが復活しました。(訳注:
2.x にはあったエイリアス。3.2 でエイリアスは復活しなかった。)

   ---------- Footnotes ----------

   (1) *note バイト様オブジェクト: 193. に加えて、‘'base64_codec'’ も
*note str: 169. の ASCII のみのインスタンスをデコード用に受け入れるよう
になりました


File: python.info,  Node: Standalone Codec Functions,  Next: テキスト変換 Text Transforms,  Prev: バイナリ変換 Binary Transforms,  Up: Python 特有のエンコーディング

5.7.2.17 Standalone Codec Functions
...................................

The following functions provide encoding and decoding functionality
similar to codecs, but are not available as named codecs through *note
codecs.encode(): 1104. or *note codecs.decode(): 1105.  They are used
internally (for example, by *note pickle: ab.) and behave similarly to
the ‘string_escape’ codec that was removed in Python 3.

 -- の関数: codecs.escape_encode (input, errors=None)

     Encode 'input' using escape sequences.  Similar to how *note
     repr(): 1c1. on bytes produces escaped byte values.

     'input' must be a *note bytes: 192. object.

     Returns a tuple ‘(output, length)’ where 'output' is a *note bytes:
     192. object and 'length' is the number of bytes consumed.

 -- の関数: codecs.escape_decode (input, errors=None)

     Decode 'input' from escape sequences back to the original bytes.

     'input' must be a *note bytes-like object: 193.

     Returns a tuple ‘(output, length)’ where 'output' is a *note bytes:
     192. object and 'length' is the number of bytes consumed.


File: python.info,  Node: テキスト変換 Text Transforms,  Prev: Standalone Codec Functions,  Up: Python 特有のエンコーディング

5.7.2.18 テキスト変換 (Text Transforms)
.......................................

以下の codec は、*note str: 169. から *note str: 169. マッピングへのテキ
スト変換を提供します。*note str.encode(): ad2. はこの変換をサポートして
おらず、 *note bytes: 192. を出力するだけです。

Codec                    別名          意味
                                       
-----------------------------------------------------------------------
                                       
rot_13                   rot13         被演算子のシーザー暗号
                                       (Caesar-cypher) を返します。
                                       

Added in version 3.2: ‘rot_13’ テキスト変換が復活しました。(訳注: 2.x に
はあったものが 3.0 で削除されていた。)

バージョン 3.4 で変更: ‘rot13’ エイリアスが復活しました。(訳注: 2.x には
あったエイリアス。3.2 でエイリアスは復活しなかった。)


File: python.info,  Node: encodings --- Encodings package,  Next: encodings idna --- Internationalized Domain Names in Applications,  Prev: Python 特有のエンコーディング,  Up: codecs --- codec レジストリと基底クラス

5.7.2.19 ‘encodings’ -- Encodings package
.........................................

This module implements the following functions:

 -- の関数: encodings.normalize_encoding (encoding)

     Normalize encoding name 'encoding'.

     Normalization works as follows: all non-alphanumeric characters
     except the dot used for Python package names are collapsed and
     replaced with a single underscore, leading and trailing underscores
     are removed.  For example, ‘' -;#'’ becomes ‘'_'’.

     Note that 'encoding' should be ASCII only.

     注釈: The following functions should not be used directly, except
     for testing purposes; *note codecs.lookup(): b5c. should be used
     instead.

 -- の関数: encodings.search_function (encoding)

     Search for the codec module corresponding to the given encoding
     name 'encoding'.

     This function first normalizes the 'encoding' using *note
     normalize_encoding(): 9fd, then looks for a corresponding alias.
     It attempts to import a codec module from the encodings package
     using either the alias or the normalized name.  If the module is
     found and defines a valid ‘getregentry()’ function that returns a
     *note codecs.CodecInfo: 1a6c. object, the codec is cached and
     returned.

     If the codec module defines a ‘getaliases()’ function any returned
     aliases are registered for future use.

 -- の関数: encodings.win32_code_page_search_function (encoding)

     Search for a Windows code page encoding 'encoding' of the form
     ‘cpXXXX’.

     If the code page is valid and supported, return a *note
     codecs.CodecInfo: 1a6c. object for it.

     *note Availability: 213f.: Windows.

     Added in version 3.14.

This module implements the following exception:

 -- 例外: encodings.CodecRegistryError

     Raised when a codec is invalid or incompatible.


File: python.info,  Node: encodings idna --- Internationalized Domain Names in Applications,  Next: encodings mbcs --- Windows ANSI codepage,  Prev: encodings --- Encodings package,  Up: codecs --- codec レジストリと基底クラス

5.7.2.20 ‘encodings.idna’ -- Internationalized Domain Names in Applications
...........................................................................

このモジュールでは RFC 3490(1) (アプリケーションにおける国際化ドメイン名
、 IDNA: Internationalized Domain Names in Applications) および RFC
3492(2) (Nameprep: 国際化ドメイン名 (IDN) のための stringprep プロファイ
ル) を実装しています。このモジュールは ‘punycode’ エンコーディングおよび
*note stringprep: da. の上に構築されています。

If you need the IDNA 2008 standard from RFC 5891(3) and RFC 5895(4), use
the third-party idna(5) module.

これらの RFC はともに、非 ASCII 文字の入ったドメイン名をサポートするため
のプロトコルを定義しています。 (‘www.Alliancefrançaise.nu’ のような) 非
ASCII 文字を含むドメイン名は、 ASCII と互換性のあるエンコーディング
(ACE、 ‘www.xn--alliancefranaise-npb.nu’ のような形式) に変換されます。
ドメイン名の ACE 形式は、 DNS クエリ、 HTTP ‘Host’ フィールドなどといっ
た、プロトコル中で任意の文字を使えないような全ての局面で用いられます。こ
の変換はアプリケーション内で行われます; 可能ならユーザからは不可視となり
ます: アプリケーションは Unicode ドメインラベルをネットワークに載せる際
に IDNA に、 ACE ドメインラベルをユーザに提供する前に Unicode に、それぞ
れ透過的に変換しなければなりません。

Python ではこの変換をいくつかの方法でサポートします: ‘idna’ codec は
Unicode と ACE 間の変換を行い、入力文字列を RFC 3490 の section 3.1(6) で
定義されている区切り文字に基づいてラベルに分解し、各ラベルを要求通りに
ACE に変換します。逆に、入力のバイト文字列を ‘.’ 区切り文字でラベルに分
解し、 ACE ラベルを Unicode に変換します。さらに、 *note socket: d1. モ
ジュールは Unicode ホスト名を ACE に透過的に変換するため、アプリケーショ
ンはホスト名を *note socket: d1. モジュールに渡す際にホスト名の変換に煩
わされることがありません。その上で、ホスト名を関数パラメタとして持つ、
*note http.client: 73. や *note ftplib: 62. のようなモジュールでは
Unicode ホスト名を受理します (*note http.client: 73. でもまた、 ‘Host’ フ
ィールドにある IDNA ホスト名を、フィールド全体を送信する場合に透過的に送
信します)。

(逆引きなどによって) ネットワーク越しにホスト名を受信する際、Unicode へ
の自動変換は行われません: こうしたホスト名をユーザに提供したいアプリケー
ションでは、Unicode にデコードしてやる必要があります。

The module ‘encodings.idna’ also implements the nameprep procedure,
which performs certain normalizations on host names, to achieve
case-insensitivity of international domain names, and to unify similar
characters.  The nameprep functions can be used directly if desired.

 -- の関数: encodings.idna.nameprep (label)

     'label' を nameprep したバージョンを返します。現在の実装ではクエリ
     文字列を仮定しているので、‘AllowUnassigned’ は真です。

 -- の関数: encodings.idna.ToASCII (label)

     RFC 3490(7) 仕様に従ってラベルを ASCIIに変換します。
     ‘UseSTD3ASCIIRules’ は偽であると仮定します。

 -- の関数: encodings.idna.ToUnicode (label)

     RFC 3490(8) 仕様に従ってラベルを Unicode に変換します。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc3490.html

   (2) https://datatracker.ietf.org/doc/html/rfc3492.html

   (3) https://datatracker.ietf.org/doc/html/rfc5891.html

   (4) https://datatracker.ietf.org/doc/html/rfc5895.html

   (5) https://pypi.org/project/idna/

   (6) https://datatracker.ietf.org/doc/html/rfc3490.html#section-3.1

   (7) https://datatracker.ietf.org/doc/html/rfc3490.html

   (8) https://datatracker.ietf.org/doc/html/rfc3490.html


File: python.info,  Node: encodings mbcs --- Windows ANSI codepage,  Next: encodings utf_8_sig --- UTF-8 codec with BOM signature,  Prev: encodings idna --- Internationalized Domain Names in Applications,  Up: codecs --- codec レジストリと基底クラス

5.7.2.21 ‘encodings.mbcs’ -- Windows ANSI codepage
..................................................

This module implements the ANSI codepage (CP_ACP).

*note Availability: 213f.: Windows.

バージョン 3.2 で変更: 3.2 以前は 'errors' 引数は無視されました; エンコ
ードには常に ‘'replace'’ が、デコードには ‘'ignore'’ が使われました。

バージョン 3.3 で変更: 任意のエラーハンドラのサポート。


File: python.info,  Node: encodings utf_8_sig --- UTF-8 codec with BOM signature,  Prev: encodings mbcs --- Windows ANSI codepage,  Up: codecs --- codec レジストリと基底クラス

5.7.2.22 ‘encodings.utf_8_sig’ -- UTF-8 codec with BOM signature
................................................................

このモジュールは UTF-8 codec の変種を実装します。エンコーディング時は、
UTF-8 でエンコードしたバイト列の前に UTF-8 でエンコードした BOM を追加し
ます。これは内部状態を持つエンコーダで、この動作は (バイトストリームの最
初の書き込み時に) 一度だけ行なわれます。デコーディング時は、データの最初
に UTF-8 でエンコードされた BOM があれば、それをスキップします。


File: python.info,  Node: データ型,  Next: 数値と数学モジュール,  Prev: バイナリデータ処理,  Up: Python 標準ライブラリ

5.8 データ型
============

この章で解説されるモジュールは日付や時間、型が固定された配列、ヒープキュ
ー、両端キュー、列挙型のような種々の特殊なデータ型を提供します。

Python にはその他にもいくつかの組み込みデータ型があります。特に、 *note
dict: 183. 、 *note list: 24d. 、 *note set: 184. 、 *note frozenset:
7f2. 、そして *note tuple: 614. があります。 *note str: 169. クラスは
Unicode データを扱うことができ、 *note bytes: 192. と *note bytearray:
344. クラスはバイナリデータを扱うことができます。

この章では以下のモジュールが記述されています:

* Menu:

* datetime: datetime --- 基本的な日付と時間の型. 基本的な日付と時間の型
* zoneinfo: zoneinfo --- IANA タイムゾーンのサポート. IANA タイムゾーンのサポート
* calendar: calendar --- 一般的なカレンダーに関係する機能群. 一般的なカレンダーに関係する機能群
* collections: collections --- コンテナデータ型. コンテナデータ型
* collections.abc: collections abc --- コンテナの抽象基底クラス. コンテナの抽象基底クラス
* heapq: heapq --- ヒープキューアルゴリズム. ヒープキューアルゴリズム
* bisect: bisect --- 配列二分法アルゴリズム. 配列二分法アルゴリズム
* array: array --- 効率的な数値配列. 効率的な数値配列
* weakref: weakref --- Weak references. Weak references
* types: types --- 動的な型生成と組み込み型の名前. 動的な型生成と組み込み型の名前
* copy: copy --- 浅いコピーおよび深いコピー操作. 浅いコピーおよび深いコピー操作
* pprint: pprint --- データの整形表示. データの整形表示
* reprlib: reprlib --- もう一つの repr の実装. もう一つの repr() の実装
* enum: enum --- 列挙型のサポート. 列挙型のサポート
* graphlib: graphlib --- グラフ構造を操作する機能. グラフ構造を操作する機能


File: python.info,  Node: datetime --- 基本的な日付と時間の型,  Next: zoneinfo --- IANA タイムゾーンのサポート,  Up: データ型

5.8.1 ‘datetime’ -- 基本的な日付と時間の型
------------------------------------------

'ソースコード:' Lib/datetime.py(1)

__________________________________________________________________

‘datetime’ モジュールは、日付や時刻を操作するためのクラスを提供していま
す。

日付や時刻に対する算術がサポートされている一方、実装では出力のフォーマッ
トや操作のための効率的な属性の抽出に重点を置いています。

     Tip: *note 書式コード: 2897. に飛ぶ。

参考
....

*note calendar: 15. モジュール

     汎用のカレンダー関連関数。

*note time: f4. モジュール

     時刻へのアクセスと変換。

*note zoneinfo: 13a. モジュール

     IANAタイムゾーンデータベースを表す具体的なタイムゾーン。

dateutil(2) パッケージ

     拡張タイムゾーンと構文解析サポートのあるサードパーティーライブラリ
     。

DateType(3) パッケージ

     Third-party library that introduces distinct static types to for
     example, allow *note static type checkers: 574. to differentiate
     between naive and aware datetimes.

* Menu:

* Aware and naive objects::
* 定数::
* Available types::
* timedelta objects::
* date objects::
* datetime objects::
* time objects::
* tzinfo objects::
* timezone objects::
* strftime() and strptime() behavior: strftime and strptime behavior.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/datetime.py

   (2) https://dateutil.readthedocs.io/en/stable/

   (3) https://pypi.org/project/DateType/


File: python.info,  Node: Aware and naive objects,  Next: 定数,  Up: datetime --- 基本的な日付と時間の型

5.8.1.1 Aware and naive objects
...............................

日時のオブジェクトは、それらがタイムゾーンの情報を含んでいるかどうかによ
って "aware" あるいは "naive" に分類されます。

タイムゾーンや夏時間の情報のような、アルゴリズム的で政治的な適用可能な時
間調節に関する知識を持っているため、 'aware' オブジェクトは他の aware オ
ブジェクトとの相対関係を特定できます。 aware オブジェクトは解釈の余地の
ない特定の実時刻を表現します。 (1)

'naive' オブジェクトには他の日付時刻オブジェクトとの相対関係を把握するの
に足る情報が含まれません。あるプログラム内の数字がメートルを表わしている
のか、マイルなのか、それとも質量なのかがプログラムによって異なるように、
naive オブジェクトが協定世界時 (UTC) なのか、現地時間なのか、それとも他
のタイムゾーンなのかはそのプログラムに依存します。Naive オブジェクトはい
くつかの現実的な側面を無視してしまうというコストを無視すれば、簡単に理解
でき、うまく利用することができます。

aware オブジェクトを必要とするアプリケーションのために、 *note datetime:
4e2. と *note time: 1fb. オブジェクトは追加のタイムゾーン情報の属性
‘tzinfo’ を持ちます。 *note tzinfo: 7f6. には抽象クラス *note tzinfo:
7f6. のサブクラスのインスタンスを設定できます。 これらの *note tzinfo:
7f6. オブジェクトは UTC 時間からのオフセットやタイムゾーンの名前、夏時間
が実施されるかどうかの情報を保持しています。

ただ一つの具象 *note tzinfo: 7f6. クラスである *note timezone: 12d5. ク
ラスが ‘datetime’ モジュールで提供されています。 ‘timezone’ クラスは、
UTCからのオフセットが固定である単純なタイムゾーン（例えばUTCそれ自体）、
および北アメリカにおける東部標準時（EST）／東部夏時間（EDT）のような単純
ではないタイムゾーンの両方を表現できます。より深く詳細までタイムゾーンを
サポートするかはアプリケーションに依存します。世界中の時刻の調整を決める
ルールは合理的というよりかは政治的なもので、頻繁に変わり、UTC を除くと都
合のよい基準というものはありません。

   ---------- Footnotes ----------

   (1) もし相対性理論の効果を無視するならば、ですが


File: python.info,  Node: 定数,  Next: Available types,  Prev: Aware and naive objects,  Up: datetime --- 基本的な日付と時間の型

5.8.1.2 定数
............

‘datetime’ モジュールでは以下の定数を公開しています:

 -- データ: datetime.MINYEAR

     *note date: 1fa. や *note datetime: 4e2. オブジェクトで許されている
     、年を表現する最小の数字です。 *note MINYEAR: 289b. は1です。

 -- データ: datetime.MAXYEAR

     *note date: 1fa. や *note datetime: 4e2. オブジェクトで許されている
     、年を表現する最大の数字です。 *note MAXYEAR: 289c. は9999です。

 -- データ: datetime.UTC

     UTCタイムゾーンシングルトン *note datetime.timezone.utc: 827. の別
     名。

     Added in version 3.11.


File: python.info,  Node: Available types,  Next: timedelta objects,  Prev: 定数,  Up: datetime --- 基本的な日付と時間の型

5.8.1.3 Available types
.......................

 -- クラス: datetime.date

     理想的な naive な日付で、これまでもこれからも現在のグレゴリオ暦
     (Gregorian calender) が有効であることを仮定しています。 属性は
     *note year: 289e, *note month: 289f,および *note day: 28a0. です。

 -- クラス: datetime.time

     理想的な時刻で、特定の日から独立しており、毎日が厳密に 24*60*60 秒
     であると仮定しています。("うるう秒: leap seconds" の概念はありませ
     ん。) 属性は *note hour: 28a1, *note minute: 28a2, *note second:
     28a3, *note microsecond: 28a4, および *note tzinfo: 28a5. です。

 -- クラス: datetime.datetime

     日付と時刻を組み合わせたものです。 属性は *note year: 28a6, *note
     month: 28a7, *note day: 28a8, *note hour: 28a9, *note minute: 28aa,
     *note second: 28ab, *note microsecond: 28ac, および *note tzinfo:
     28ad. です。

 -- クラス: datetime.timedelta

     *note datetime: 4e2. あるいは *note date: 1fa. クラスの二つのインス
     タンス間の時間差をマイクロ秒精度で表す経過時間値です。

 -- クラス: datetime.tzinfo

     タイムゾーン情報オブジェクトの抽象基底クラスです。 *note datetime:
     4e2. および *note time: 1fb. クラスで用いられ、カスタマイズ可能な時
     刻修正の概念 (たとえばタイムゾーンや夏時間の計算) を提供します。

 -- クラス: datetime.timezone

     *note tzinfo: 7f6. 抽象基底クラスを UTC からの固定オフセットとして
     実装するクラスです。

     Added in version 3.2.

これらの型のオブジェクトは変更不可能 (immutable) です。

Subclass relationships:

[image src="python-figures/datetime-inheritance.svg" alt="timedelta, tzinfo, time, and date inherit from object; timezone inherits from tzinfo; and datetime inherits from date."]


Figure
* Menu:

* Common properties::
* Determining if an object is aware or naive::


File: python.info,  Node: Common properties,  Next: Determining if an object is aware or naive,  Up: Available types

5.8.1.4 Common properties
.........................

*note date: 1fa. 型、*note datetime: 4e2. 型、*note time: 1fb. 型、*note
timezone: 12d5. 型には共通する特徴があります:

   - これらの型のオブジェクトは変更不可能 (immutable) です。

   - これらの型のオブジェクトは *note ハッシュ可能: 824. であり、辞書の
     キーとして使えることになります。

   - これらの型のオブジェクトは *note pickle: ab. モジュールを利用して効
     率的な pickle 化をサポートしています。


File: python.info,  Node: Determining if an object is aware or naive,  Prev: Common properties,  Up: Available types

5.8.1.5 Determining if an object is aware or naive
..................................................

*note date: 1fa. 型のオブジェクトは常に naive です。

*note time: 1fb. 型あるいは *note datetime: 4e2. 型のオブジェクトは
aware か naive のどちらかです。

次の条件を両方とも満たす場合、 *note datetime: 4e2. オブジェクト ‘d’ は
aware です:

  1. ‘d.tzinfo’ が ‘None’ でない

  2. ‘d.tzinfo.utcoffset(d)’ が ‘None’ を返さない

どちらかを満たさない場合は、 ‘d’ は naive です。

次の条件を両方とも満たす場合、 *note time: 1fb. オブジェクト ‘t’ は
aware です:

  1. ‘t.tzinfo’ が ‘None’ でない

  2. ‘t.tzinfo.utcoffset(None)’ が ‘None’ を返さない

どちらかを満たさない場合は、 ‘t’ は naive です。

aware なオブジェクトと naive なオブジェクトの区別は *note timedelta:
bc3. オブジェクトにはあてはまりません。


File: python.info,  Node: timedelta objects,  Next: date objects,  Prev: Available types,  Up: datetime --- 基本的な日付と時間の型

5.8.1.6 ‘timedelta’ objects
...........................

*note timedelta: bc3. オブジェクトは経過時間、すなわち二つの *note
datetime: 4e2. または *note date: 1fa. のインスタンスの差を表します。

 -- クラス: datetime.timedelta (days=0, seconds=0, microseconds=0,
          milliseconds=0, minutes=0, hours=0, weeks=0)

     全ての引数がオプションで、デフォルト値は0です。 引数は整数、浮動小
     数点数でもよく、正でも負でもかまいません。

     'days', 'seconds', 'microseconds' だけが内部的に保持されます。 引数
     は以下のようにして変換されます:

        * 1 ミリ秒は 1000 マイクロ秒に変換されます。

        * 1 分は 60 秒に変換されます。

        * 1 時間は 3600 秒に変換されます。

        * 1 週間は 7 日に変換されます。

     さらに、値が一意に表されるように days, seconds, microseconds が以下
     のように正規化されます

        * ‘0 <= microseconds < 1000000’

        * ‘0 <= seconds < 3600*24’ (一日中の秒数)

        * ‘-999999999 <= days <= 999999999’

     次の例は、 'days', 'seconds', 'microseconds' に加えて任意の引数がど
     う "集約" され、最終的に3つの属性に正規化されるかの説明をしています
     :

          >>> from datetime import timedelta
          >>> delta = timedelta(
          ...     days=50,
          ...     seconds=27,
          ...     microseconds=10,
          ...     milliseconds=29000,
          ...     minutes=5,
          ...     hours=8,
          ...     weeks=2
          ... )
          >>> # Only days, seconds, and microseconds remain
          >>> delta
          datetime.timedelta(days=64, seconds=29156, microseconds=10)

     引数のいずれかが浮動小数点であり、小数のマイクロ秒が存在する場合、
     小数のマイクロ秒は全ての引数から一度取り置かれ、それらの和は最近接
     偶数のマイクロ秒に丸められます。浮動小数点の引数がない場合、値の変
     換と正規化の過程は厳密な (失われる情報がない) ものとなります。

     日の値を正規化した結果、指定された範囲の外側になった場合には、
     *note OverflowError: a81. が送出されます。

     負の値を正規化すると、最初は混乱するような値になります。例えば:

          >>> from datetime import timedelta
          >>> d = timedelta(microseconds=-1)
          >>> (d.days, d.seconds, d.microseconds)
          (-1, 86399, 999999)

     Since the string representation of ‘timedelta’ objects can be
     confusing, use the following recipe to produce a more readable
     format:

          >>> def pretty_timedelta(td):
          ...     if td.days >= 0:
          ...         return str(td)
          ...     return f'-({-td!s})'
          ...
          >>> d = timedelta(hours=-1)
          >>> str(d)  # not human-friendly
          '-1 day, 23:00:00'
          >>> pretty_timedelta(d)
          '-(1:00:00)'

以下にクラス属性を示します:

 -- の属性: timedelta.min

     最小の値を表す *note timedelta: bc3. オブジェクトで、
     ‘timedelta(-999999999)’ です。

 -- の属性: timedelta.max

     最大の値を表す *note timedelta: bc3. オブジェクトで、
     ‘timedelta(days=999999999, hours=23, minutes=59, seconds=59,
     microseconds=999999)’ です。

 -- の属性: timedelta.resolution

     *note timedelta: bc3. オブジェクトが等しくならない最小の時間差で、
     ‘timedelta(microseconds=1)’ です。

正規化のために、 ‘timedelta.max’ は ‘-timedelta.min’ より大きいことに注
意してください。 ‘-timedelta.max’ は *note timedelta: bc3. オブジェクト
として表現することができません。

インスタンスの属性 (読み出しのみ):

 -- の属性: timedelta.days

     両端値を含む-999,999,999 から 999,999,999 の間

 -- の属性: timedelta.seconds

     両端値を含む 0 から 86,399 の間

          注意: It is a somewhat common bug for code to unintentionally
          use this attribute when it is actually intended to get a *note
          total_seconds(): 151d. value instead:

               >>> from datetime import timedelta
               >>> duration = timedelta(seconds=11235813)
               >>> duration.days, duration.seconds
               (130, 3813)
               >>> duration.total_seconds()
               11235813.0

 -- の属性: timedelta.microseconds

     両端値を含む 0 から 999,999 の間

サポートされている演算を以下に示します:

演算                                 結果
                                     
-----------------------------------------------------------------------------------------
                                     
‘t1 = t2 + t3’                       ‘t2’ と ‘t3’ の和。演算後、‘t1 - t2 == t3’ および
                                     ‘t1 - t3 == t2’ は真になります。(1)
                                     
                                     
‘t1 = t2 - t3’                       ‘t2’ と ‘t3’ の差。演算後、‘t1 == t2 - t3’ および
                                     ‘t2 == t1 + t3’ は真になります。 (1)(6)
                                     
                                     
‘t1 = t2 * i または t1 = i * t2’     時間差と整数の積。演算後、‘t1 // i == t2’ は ‘i
                                     != 0’ であれば真となります。
                                     
                                     
                                     一般的に、‘t1 * i == t1 * (i-1) + t1’ は真となり
                                     ます。(1)
                                     
                                     
‘t1 = t2 * f’ または ‘t1 = f * t2’   時間差と浮動小数点の積。結果は最近接偶数への丸め
                                     を利用して最も近い timedelta.resolution の倍数に
                                     丸められます。
                                     
                                     
‘f = t2 / t3’                        ‘t2’ を ‘t3’ で除算 (3) したもの。
                                     *note float: 196. オブジェクトを返します。
                                     
                                     
‘t1 = t2 / f’ または ‘t1 = t2 / i’   時間差を浮動小数点や整数で除したもの。結果は最近
                                     接偶数への丸めを利用して最も近い
                                     timedelta.resolution の倍数に丸められます。
                                     
                                     
‘t1 = t2 // i’ または ‘t1 = t2 //    floor が計算され、余りは (もしあれば) 捨てられま
t3’                                  す。後者の場合、整数が返されます。(3)
                                     
                                     
‘t1 = t2 % t3’                       剰余が *note timedelta: bc3. オブジェクトとして計
                                     算されます。(3)
                                     
                                     
‘q, r = divmod(t1, t2)’              商と剰余が計算されます: ‘q = t1 // t2’ (3) と ‘r
                                     = t1 % t2’ 。‘q’ は整数で ‘r’ は
                                     *note timedelta: bc3. オブジェクトです。
                                     
                                     
‘+t1’                                同じ値を持つ *note timedelta: bc3. オブジェクトを
                                     返します。(2)
                                     
                                     
‘-t1’                                ‘timedelta(-t1.days, -t1.seconds,
                                     -t1.microseconds)’、および ‘t1 * -1’ と同じです。
                                     (1)(4)
                                     
                                     
‘abs(t)’                             ‘t.days >= 0’ のときには ‘+t’, ‘t.days < 0’ のと
                                     きには ‘-t’ となります。(2)
                                     
                                     
‘str(t)’                             ‘[D day[s], ][H]H:MM:SS[.UUUUUU]’ という形式の文
                                     字列を返します。‘t’ が負の値の場合は ‘D’ は負の値
                                     となります。(5)
                                     
                                     
‘repr(t)’                            *note timedelta: bc3. オブジェクトの文字列表現を
                                     返します。その文字列は、正規の属性値を持つコンス
                                     トラクタ呼び出しのコードになっています。
                                     

注釈:

  1. この演算は正確ですが、オーバフローするかもしれません。

  2. この演算は正確であり、オーバフローし得ません。

  3. 0 による除算は *note ZeroDivisionError: b3f. を送出します。

  4. ‘-timedelta.max’ は *note timedelta: bc3. オブジェクトで表現するこ
     とができません。

  5. *note timedelta: bc3. オブジェクトの文字列表現は内部表現に類似した
     形に正規化されます。そのため負の timedelta は少し変な結果になります
     。例えば:

          >>> timedelta(hours=-5)
          datetime.timedelta(days=-1, seconds=68400)
          >>> print(_)
          -1 day, 19:00:00

  6. t3 が ‘timedelta.max’ のときを除けば、式 ‘t2 - t3’ は常に、式 ‘t2 +
     (-t3)’ と同等です。t3 が ‘timedelta.max’ の場合、前者の式は結果の値
     が出ますが、後者はオーバーフローを起こします。

上に列挙した操作に加え *note timedelta: bc3. オブジェクトは *note date:
1fa. および *note datetime: 4e2. オブジェクトとの間で加減算をサポートし
ています (下を参照してください)。

バージョン 3.2 で変更: *note timedelta: bc3. オブジェクトの別の *note
timedelta: bc3. オブジェクトによる、切り捨て除算と真の除算、および剰余演
算と *note divmod(): b99. 関数がサポートされるようになりました。 *note
timedelta: bc3. オブジェクトと *note float: 196. オブジェクトの真の除算
と掛け算がサポートされるようになりました。

*note timedelta: bc3. オブジェクトは等価性と順序の比較をサポートします。

ブール演算コンテキストでは、 *note timedelta: bc3. オブジェクトは
‘timedelta(0)’ に等しくない場合かつそのときに限り真となります。

インスタンスメソッド:

 -- メソッド: timedelta.total_seconds ()

     Return the total number of seconds contained in the duration.
     Equivalent to ‘td / timedelta(seconds=1)’.  For interval units
     other than seconds, use the division form directly (for example,
     ‘td / timedelta(microseconds=1)’).

     非常に長い期間 (多くのプラットフォームでは270年以上) については、こ
     のメソッドはマイクロ秒の精度を失うことがあることに注意してください
     。

     Added in version 3.2.

* Menu:

* Examples of usage; timedelta: Examples of usage timedelta.


File: python.info,  Node: Examples of usage timedelta,  Up: timedelta objects

5.8.1.7 Examples of usage: ‘timedelta’
......................................

正規化の追加の例です:

     >>> # Components of another_year add up to exactly 365 days
     >>> from datetime import timedelta
     >>> year = timedelta(days=365)
     >>> another_year = timedelta(weeks=40, days=84, hours=23,
     ...                          minutes=50, seconds=600)
     >>> year == another_year
     True
     >>> year.total_seconds()
     31536000.0

*note timedelta: bc3. の計算の例です:

     >>> from datetime import timedelta
     >>> year = timedelta(days=365)
     >>> ten_years = 10 * year
     >>> ten_years
     datetime.timedelta(days=3650)
     >>> ten_years.days // 365
     10
     >>> nine_years = ten_years - year
     >>> nine_years
     datetime.timedelta(days=3285)
     >>> three_years = nine_years // 3
     >>> three_years, three_years.days // 365
     (datetime.timedelta(days=1095), 3)


File: python.info,  Node: date objects,  Next: datetime objects,  Prev: timedelta objects,  Up: datetime --- 基本的な日付と時間の型

5.8.1.8 ‘date’ objects
......................

*note date: 1fa. オブジェクトは、両方向に無期限に拡張された現在のグレゴ
リオ暦という理想化された暦の日付 (年月日) を表します。

1 年 1 月 1 日は日番号 1、1 年 1 月 2 日は日番号 2 と呼ばれ、他も同様で
す。 (1)

 -- クラス: datetime.date (year, month, day)

     全ての引数が必須です。 引数は整数で、次の範囲に収まっていなければな
     りません:

        * ‘MINYEAR <= year <= MAXYEAR’

        * ‘1 <= month <= 12’

        * ‘1 <= day <= 指定された月と年における日数’

     範囲を超えた引数を与えた場合、 *note ValueError: 2ec. が送出されま
     す。

他のコンストラクタ、および全てのクラスメソッドを以下に示します:

 -- メソッド: classmethod date.today ()

     現在のローカルな日付を返します。

     ‘date.fromtimestamp(time.time())’ と等価です。

 -- メソッド: classmethod date.fromtimestamp (timestamp)

     Return the local date corresponding to the POSIX 'timestamp', such
     as is returned by *note time.time(): 55d.

     timestamp がプラットフォームの C 関数 ‘localtime()’ がサポートする
     値の範囲から外れていた場合、 *note OverflowError: a81. を送出するか
     もしれません。また ‘localtime()’ 呼び出しが失敗した場合には *note
     OSError: 2c0. を送出するかもしれません。この範囲は通常は 1970 年か
     ら 2038 年までに制限されています。タイムスタンプの表記にうるう秒を
     含める非 POSIX なシステムでは、うるう秒は *note fromtimestamp():
     dcd. では無視されます。

     バージョン 3.3 で変更: timestamp がプラットフォームの C 関数
     ‘localtime()’ のサポートする値の範囲から外れていた場合、 *note
     ValueError: 2ec. ではなく *note OverflowError: a81. を送出するよう
     になりました。 ‘localtime()’ の呼び出し失敗で *note ValueError:
     2ec. ではなく *note OSError: 2c0. を送出するようになりました。

 -- メソッド: classmethod date.fromordinal (ordinal)

     Return the date corresponding to the proleptic Gregorian 'ordinal',
     where January 1 of year 1 has ordinal 1.

     ‘1 <= ordinal <= date.max.toordinal()’ でない場合、 *note
     ValueError: 2ec. が送出されます。 任意の日付 ‘d’ に対し、
     ‘date.fromordinal(d.toordinal()) == d’ となります。

 -- メソッド: classmethod date.fromisoformat (date_string)

     以下の例外を除く、有効な ISO 8601 フォーマットで与えられた
     'date_string' に対応する *note date: 1fa. を返します :

       1. 精度の低い日付は現在サポートされていません(‘YYYY-MM’, ‘YYYY’)。

       2. 拡張された日付表現は現在サポートされていません
          (‘±YYYYYY-MM-DD’)。

       3. 序数の日付は現在サポートされていません(‘YYYY-OOO’)。

     例:

          >>> from datetime import date
          >>> date.fromisoformat('2019-12-04')
          datetime.date(2019, 12, 4)
          >>> date.fromisoformat('20191204')
          datetime.date(2019, 12, 4)
          >>> date.fromisoformat('2021-W01-1')
          datetime.date(2021, 1, 4)

     Added in version 3.7.

     バージョン 3.11 で変更: 以前はこのメソッドは ‘YYYY-MM-DD’ フォーマ
     ットのみをサポートしていました。

 -- メソッド: classmethod date.fromisocalendar (year, week, day)

     Return a *note date: 1fa. corresponding to the ISO calendar date
     specified by 'year', 'week' and 'day'.  This is the inverse of the
     function *note date.isocalendar(): af1.

     Added in version 3.8.

 -- メソッド: classmethod date.strptime (date_string, format)

     Return a *note date: 1fa. corresponding to 'date_string', parsed
     according to 'format'.  This is equivalent to:

          date(*(time.strptime(date_string, format)[0:3]))

     date_string と format が *note time.strptime(): 1646. で構文解析で
     きない場合や、この関数が時刻タプルを返してこない場合には *note
     ValueError: 2ec. を送出します。*note strftime() and strptime()
     behavior: 1b54. および *note date.fromisoformat(): 828. も参照して
     ください。

          注釈: If 'format' specifies a day of month without a year a
          *note DeprecationWarning: 1a3. is emitted.  This is to avoid a
          quadrennial leap year bug in code seeking to parse only a
          month and day as the default year used in absence of one in
          the format is not a leap year.  Such 'format' values may raise
          an error as of Python 3.15.  The workaround is to always
          include a year in your 'format'.  If parsing 'date_string'
          values that do not have a year, explicitly add a year that is
          a leap year before parsing:

               >>> from datetime import date
               >>> date_string = "02/29"
               >>> when = date.strptime(f"{date_string};1984", "%m/%d;%Y")  # Avoids leap year bug.
               >>> when.strftime("%B %d")
               'February 29'

     Added in version 3.14.

以下にクラス属性を示します:

 -- の属性: date.min

     表現できる最も古い日付で、‘date(MINYEAR, 1, 1)’ です。

 -- の属性: date.max

     表現できる最も新しい日付で、‘date(MAXYEAR, 12, 31)’ です。

 -- の属性: date.resolution

     等しくない日付オブジェクト間の最小の差で、‘timedelta(days=1)’ です
     。

インスタンスの属性 (読み出しのみ):

 -- の属性: date.year

     両端値を含む *note MINYEAR: 289b. から *note MAXYEAR: 289c. までの
     値です。

 -- の属性: date.month

     両端値を含む 1 から 12 までの値です。

 -- の属性: date.day

     1 から与えられた月と年における日数までの値です。

サポートされている演算を以下に示します:

演算                                結果
                                    
---------------------------------------------------------------------------------------
                                    
‘date2 = date1 + timedelta’         ‘date2’ は ‘date1’ の ‘timedelta.days’ 日後にな
                                    ります。(1)
                                    
                                    
‘date2 = date1 - timedelta’         ‘date2 + timedelta == date1’ であるような日付
                                    ‘date2’ を計算します。(2)
                                    
                                    
‘timedelta = date1 - date2’         (3)
                                    
                                    
     ‘date1 == date2’               等価性の比較。(4)
     ‘date1 != date2’               

     ‘date1 < date2’                順序の比較。(5)
     ‘date1 > date2’                
     ‘date1 <= date2’
     ‘date1 >= date2’

注釈:

  1. 'date2' は、 ‘timedelta.days > 0’ の場合は進む方向に、
     ‘timedelta.days < 0’ の場合は戻る方向に移動します。 演算後は ‘date2
     - date1 == timedelta.days’ が成立します。 ‘timedelta.seconds’ およ
     び ‘timedelta.microseconds’ は無視されます。 ‘date2.year’ が *note
     MINYEAR: 289b. になってしまったり、 *note MAXYEAR: 289c. より大きく
     なってしまう場合には *note OverflowError: a81. が送出されます。

  2. ‘timedelta.seconds’ と ‘timedelta.microseconds’ は無視されます。

  3. この演算は厳密で、オーバフローしません。‘timedelta.seconds’ および
     ‘timedelta.microseconds’ は 0 で、演算後には ‘date2 + timedelta ==
     date1’ となります。

  4. 同じ日を表す *note date: 1fa. オブジェクトは等しいです。

     *note datetime: 4e2. のインスタンスではない ‘date’ オブジェクトは、
     同じ日を表していても、‘datetime’ オブジェクトとは決して等価にはなり
     ません。

  5. 'date1' is considered less than 'date2' when 'date1' precedes
     'date2' in time.  In other words, ‘date1 < date2’ if and only if
     ‘date1.toordinal() < date2.toordinal()’.

     Order comparison between a ‘date’ object that is not also a *note
     datetime: 4e2. instance and a ‘datetime’ object raises *note
     TypeError: 198.

バージョン 3.13 で変更: Comparison between *note datetime: 4e2. object
and an instance of the *note date: 1fa. subclass that is not a
‘datetime’ subclass no longer converts the latter to ‘date’, ignoring
the time part and the time zone.  The default behavior can be changed by
overriding the special comparison methods in subclasses.

ブール演算コンテキストでは、全ての *note time: 1fb. オブジェクトは真とみ
なされます。

インスタンスメソッド:

 -- メソッド: date.replace (year=self.year, month=self.month,
          day=self.day)

     Return a new *note date: 1fa. object with the same values, but with
     specified parameters updated.

     以下はプログラム例です:

          >>> from datetime import date
          >>> d = date(2002, 12, 31)
          >>> d.replace(day=26)
          datetime.date(2002, 12, 26)

     The generic function *note copy.replace(): 1c0. also supports *note
     date: 1fa. objects.

 -- メソッド: date.timetuple ()

     *note time.localtime(): 1712. が返すような *note time.struct_time:
     ee6. を返します。

     時分秒が 0 で、 DST フラグが -1 です。

     ‘d.timetuple()’ は次の式と等価です:

          time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))

     ここで、 ‘yday = d.toordinal() - date(d.year, 1, 1).toordinal() +
     1’ は本年の 1 月 1 日を 1 としたときの日付番号です。

 -- メソッド: date.toordinal ()

     先発グレゴリオ暦における日付序数を返します。 1 年の 1 月 1 日が序数
     1 となります。任意の *note date: 1fa. オブジェクト ‘d’ について、
     ‘date.fromordinal(d.toordinal()) == d’ となります。

 -- メソッド: date.weekday ()

     月曜日を 0、日曜日を 6 として、曜日を整数で返します。例えば、
     ‘date(2002, 12, 4).weekday() == 2’ であり、水曜日を示します。 *note
     isoweekday(): 28c1. も参照してください。

 -- メソッド: date.isoweekday ()

     月曜日を 1,日曜日を 7 として、曜日を整数で返します。例えば、
     ‘date(2002, 12, 4).isoweekday() == 3’ であり、水曜日を示します。
     *note weekday(): 28c0, *note isocalendar(): af1. も参照してください
     。

 -- メソッド: date.isocalendar ()

     ‘year’、‘week’、‘weekday’ の3つで構成された *note named tuple: 85e.
     を返します。

     ISO 暦はグレゴリオ暦の変種として広く用いられています。 (2)

     ISO 年は完全な週が 52 週または 53 週あり、週は月曜から始まって日曜
     に終わります。ISO 年でのある年における最初の週は、その年の木曜日を
     含む最初の (グレゴリオ暦での) 週となります。この週は週番号 1 と呼ば
     れ、この木曜日での ISO 年はグレゴリオ暦における年と等しくなります。

     例えば、2004 年は木曜日から始まるため、ISO 年の最初の週は 2003 年
     12 月 29 日、月曜日から始まり、2004 年 1 月 4 日、日曜日に終わりま
     す

          >>> from datetime import date
          >>> date(2003, 12, 29).isocalendar()
          datetime.IsoCalendarDate(year=2004, week=1, weekday=1)
          >>> date(2004, 1, 4).isocalendar()
          datetime.IsoCalendarDate(year=2004, week=1, weekday=7)

     バージョン 3.9 で変更: 結果が タプル から *note named tuple: 85e. へ
     変更されました。

 -- メソッド: date.isoformat ()

     日付を ISO 8601 書式の ‘YYYY-MM-DD’ で表した文字列を返します:

          >>> from datetime import date
          >>> date(2002, 12, 4).isoformat()
          '2002-12-04'

 -- メソッド: date.__str__ ()

     For a date ‘d’, ‘str(d)’ is equivalent to ‘d.isoformat()’.

 -- メソッド: date.ctime ()

     日付を表す文字列を返します:

          >>> from datetime import date
          >>> date(2002, 12, 4).ctime()
          'Wed Dec  4 00:00:00 2002'

     ‘d.ctime()’ は次の式と等価です:

          time.ctime(time.mktime(d.timetuple()))

     これが等価になるのは、 (*note time.ctime(): 28c5. に呼び出され、
     *note date.ctime(): 28c4. に呼び出されない) ネイティブの C 関数
     ‘ctime()’ が C 標準に準拠しているプラットフォーム上でです。

 -- メソッド: date.strftime (format)

     明示的な書式文字列で制御された、日付を表現する文字列を返します。 時
     間、分、秒を表す書式コードは値 0 になります。 *note strftime() and
     strptime() behavior: 1b54. および *note date.isoformat(): 28c2. も
     参照してください。

 -- メソッド: date.__format__ (format)

     *note date.strftime(): e8f. と等価です。 これにより、 *note
     フォーマット済み文字列リテラル: 19a. の中や *note str.format():
     833. を使っているときに *note date: 1fa. オブジェクトの書式文字列を
     指定できます。 *note strftime() and strptime() behavior: 1b54. およ
     び *note date.isoformat(): 28c2. も参照してください。

* Menu:

* Examples of usage; date: Examples of usage date.

   ---------- Footnotes ----------

   (1) この暦法は、全ての計算における基本カレンダーである、 Dershowitz と
Reingold の書籍 'Calendrical Calculations' における先発グレゴリオ暦
("proleptic Gregorian") の定義に一致します。 先発グレゴリオ暦の序数とそ
の他多くの暦法どうしの変換アルゴリズムについては、この書籍を参照してくだ
さい。

   (2) 優れた説明は R. H. van Gent の guide to the mathematics of the
ISO 8601 calendar
(https://web.archive.org/web/20220531051136/https://webspace.science.uu.nl/~gent0113/calendar/isocalendar.htm)
を参照してください。


File: python.info,  Node: Examples of usage date,  Up: date objects

5.8.1.9 Examples of usage: ‘date’
.................................

イベントまでの日数を数える例を示します:

     >>> import time
     >>> from datetime import date
     >>> today = date.today()
     >>> today
     datetime.date(2007, 12, 5)
     >>> today == date.fromtimestamp(time.time())
     True
     >>> my_birthday = date(today.year, 6, 24)
     >>> if my_birthday < today:
     ...     my_birthday = my_birthday.replace(year=today.year + 1)
     ...
     >>> my_birthday
     datetime.date(2008, 6, 24)
     >>> time_to_birthday = abs(my_birthday - today)
     >>> time_to_birthday.days
     202

さらなる *note date: 1fa. を使う例:

     >>> from datetime import date
     >>> d = date.fromordinal(730920) # 730920th day after 1. 1. 0001
     >>> d
     datetime.date(2002, 3, 11)

     >>> # Methods related to formatting string output
     >>> d.isoformat()
     '2002-03-11'
     >>> d.strftime("%d/%m/%y")
     '11/03/02'
     >>> d.strftime("%A %d. %B %Y")
     'Monday 11. March 2002'
     >>> d.ctime()
     'Mon Mar 11 00:00:00 2002'
     >>> 'The {1} is {0:%d}, the {2} is {0:%B}.'.format(d, "day", "month")
     'The day is 11, the month is March.'

     >>> # Methods for extracting 'components' under different calendars
     >>> t = d.timetuple()
     >>> for i in t:
     ...     print(i)
     2002                # year
     3                   # month
     11                  # day
     0
     0
     0
     0                   # weekday (0 = Monday)
     70                  # 70th day in the year
     -1
     >>> ic = d.isocalendar()
     >>> for i in ic:
     ...     print(i)
     2002                # ISO year
     11                  # ISO week number
     1                   # ISO day number ( 1 = Monday )

     >>> # A date object is immutable; all operations produce a new object
     >>> d.replace(year=2005)
     datetime.date(2005, 3, 11)


File: python.info,  Node: datetime objects,  Next: time objects,  Prev: date objects,  Up: datetime --- 基本的な日付と時間の型

5.8.1.10 ‘datetime’ objects
...........................

*note datetime: 4e2. オブジェクトは *note date: 1fa. オブジェクトおよび
*note time: 1fb. オブジェクトの全ての情報が入っている単一のオブジェクト
です。

*note date: 1fa. オブジェクトと同様に、 *note datetime: 4e2. は現在のグ
レゴリオ暦が両方向に延長されているものと仮定します。また、 *note time:
1fb. オブジェクトと同様に、 *note datetime: 4e2. は毎日が厳密に 3600*24
秒であると仮定します。

以下にコンストラクタを示します:

 -- クラス: datetime.datetime (year, month, day, hour=0, minute=0,
          second=0, microsecond=0, tzinfo=None, *, fold=0)

     'year', 'month', 'day' 引数は必須です。 'tzinfo' は ‘None’ または
     *note tzinfo: 7f6. サブクラスのインスタンスです。 残りの引数は次の
     範囲の整数でなければなりません:

        * ‘MINYEAR <= year <= MAXYEAR’,

        * ‘1 <= month <= 12’,

        * ‘1 <= day <= 指定された月と年における日数’,

        * ‘0 <= hour < 24’,

        * ‘0 <= minute < 60’,

        * ‘0 <= second < 60’,

        * ‘0 <= microsecond < 1000000’,

        * ‘fold in [0, 1]’.

     範囲を超えた引数を与えた場合、 *note ValueError: 2ec. が送出されま
     す。

     バージョン 3.6 で変更: 'fold' パラメータが追加されました。

他のコンストラクタ、および全てのクラスメソッドを以下に示します:

 -- メソッド: classmethod datetime.today ()

     *note tzinfo: 28ad. が ‘None’ である現在のローカルの日付および時刻
     を返します。

     次と等価です:

          datetime.fromtimestamp(time.time())

     *note now(): 711, *note fromtimestamp(): 712. も参照してください。

     このメソッドの機能は *note now(): 711. と等価ですが、 ‘tz’ 引数はあ
     りません。

 -- メソッド: classmethod datetime.now (tz=None)

     現在のローカルな日時を返します。

     オプションの引数 'tz' が ‘None’ であるか指定されていない場合、この
     メソッドは *note today(): 28ca. と同様ですが、可能ならば *note
     time.time(): 55d. タイムスタンプを通じて得ることができる、より高い
     精度で時刻を提供します (例えば、プラットフォームが C 関数
     ‘gettimeofday()’ をサポートする場合には可能なことがあります)。

     'tz' が ‘None’ でない場合、 'tz' は *note tzinfo: 7f6. のサブクラス
     のインスタンスでなければならず、現在の日付および時刻は 'tz' のタイ
     ムゾーンに変換されます。

     *note today(): 28ca. および *note utcnow(): 351. よりもこの関数を使
     う方が好ましいです。

          注釈: Subsequent calls to ‘datetime.now()’ may return the same
          instant depending on the precision of the underlying clock.

 -- メソッド: classmethod datetime.utcnow ()

     *note tzinfo: 28ad. が ‘None’ である現在の UTC の日付および時刻を返
     します。

     このメソッドは *note now(): 711. と似ていますが、 naive な *note
     datetime: 4e2. オブジェクトとして現在の UTC 日付および時刻を返しま
     す。 aware な現在の UTC datetime は ‘datetime.now(timezone.utc)’ を
     呼び出すことで取得できます。 *note now(): 711. も参照してください。

          警告: naive な ‘datetime’ オブジェクトは多くの ‘datetime’ メソ
          ッドでローカルな時間として扱われるため、 aware な datetime を
          使って UTC の時刻を表すのが好ましいです。 そのため、 UTC での
          現在の時刻を表すオブジェクトの作成では
          ‘datetime.now(timezone.utc)’ を呼び出す方法が推奨されます。

     バージョン 3.12 で非推奨: Use *note datetime.now(): 711. with *note
     UTC: 713. instead.

 -- メソッド: classmethod datetime.fromtimestamp (timestamp, tz=None)

     *note time.time(): 55d. が返すような、 POSIX タイムスタンプに対応す
     るローカルな日付と時刻を返します。オプションの引数 'tz' が ‘None’ で
     あるか、指定されていない場合、タイムスタンプはプラットフォームのロ
     ーカルな日付および時刻に変換され、返される *note datetime: 4e2. オ
     ブジェクトは naive なものになります。

     'tz' が ‘None’ でない場合、 'tz' は *note tzinfo: 7f6. のサブクラス
     のインスタンスでなければならず、タイムスタンプは 'tz' のタイムゾー
     ンに変換されます。

     タイムスタンプがプラットフォームの C 関数 ‘localtime()’ や
     ‘gmtime()’ でサポートされている範囲を超えた場合、 *note
     fromtimestamp(): 712. は *note OverflowError: a81. を送出することが
     あります。この範囲はよく 1970 年から 2038 年に制限されています。 ま
     た ‘localtime()’ や ‘gmtime()’ が失敗した際は *note OSError: 2c0. を
     送出します。 うるう秒がタイムスタンプの概念に含まれている非 POSIX シ
     ステムでは、 *note fromtimestamp(): 712. はうるう秒を無視します。 こ
     のため、秒の異なる二つのタイムスタンプが同一の *note datetime: 4e2.
     オブジェクトとなることが起こり得ます。 *note utcfromtimestamp():
     352. よりも、このメソッドの方が好ましいです。

     バージョン 3.3 で変更: timestamp がプラットフォームの C 関数
     ‘localtime()’ もしくは ‘gmtime()’ のサポートする値の範囲から外れて
     いた場合、 *note ValueError: 2ec. ではなく *note OverflowError:
     a81. を送出するようになりました。 ‘localtime()’ もしくは ‘gmtime()’
     の呼び出し失敗で *note ValueError: 2ec. ではなく *note OSError:
     2c0. を送出するようになりました。

     バージョン 3.6 で変更: *note fromtimestamp(): 712. は *note fold:
     e51. を1にしてインスタンスを返します。

 -- メソッド: classmethod datetime.utcfromtimestamp (timestamp)

     POSIX タイムスタンプに対応する、*note tzinfo: 28ad. が ‘None’ の
     UTC での *note datetime: 4e2. を返します。(返されるオブジェクトは
     naive です。)

     タイムスタンプがプラットフォームにおける C 関数 ‘localtime()’ でサ
     ポートされている範囲を超えている場合には *note OverflowError: a81.
     を、‘gmtime()’ が失敗した場合には *note OSError: 2c0. を送出します
     。 これはたいてい 1970 年から 2038 年に制限されています。

     aware な *note datetime: 4e2. オブジェクトを得るには *note
     fromtimestamp(): 712. を呼んでください:

          datetime.fromtimestamp(timestamp, timezone.utc)

     POSIX 互換プラットフォームでは、これは以下の表現と等価です:

          datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)

     後者を除き、式は常に年の全範囲 (*note MINYEAR: 289b. から *note
     MAXYEAR: 289c. を含みます) をサポートします。

          警告: naive な ‘datetime’ オブジェクトは多くの ‘datetime’ メソ
          ッドでローカルな時間として扱われるため、 aware な datetime を
          使って UTC の時刻を表すのが好ましいです。 そのため、 UTC での
          ある特定のタイムスタンプを表すオブジェクトの作成では
          ‘datetime.fromtimestamp(timestamp, tz=timezone.utc)’ を呼び出
          す方法が推奨されます。

     バージョン 3.3 で変更: timestamp がプラットフォームの C 関数
     ‘gmtime()’ のサポートする値の範囲から外れていた場合、 *note
     ValueError: 2ec. ではなく *note OverflowError: a81. を送出するよう
     になりました。 ‘gmtime()’ の呼び出し失敗で *note ValueError: 2ec. で
     はなく *note OSError: 2c0. を送出するようになりました。

     バージョン 3.15 で変更: Accepts any real number as 'timestamp', not
     only integer or float.

     バージョン 3.12 で非推奨: Use *note datetime.fromtimestamp(): 712.
     with *note UTC: 713. instead.

 -- メソッド: classmethod datetime.fromordinal (ordinal)

     1 年 1 月 1 日を序数 1 とする早期グレゴリオ暦序数に対応する *note
     datetime: 4e2. オブジェクトを返します。 ‘1 <= ordinal <=
     datetime.max.toordinal()’ でなければ *note ValueError: 2ec. が送出
     されます。 返されるオブジェクトの時間、分、秒、およびマイクロ秒はす
     べて 0 で、 *note tzinfo: 28ad. は ‘None’ となっています。

 -- メソッド: classmethod datetime.combine (date, time,
          tzinfo=time.tzinfo)

     日付部分と与えられた *note date: 1fa. オブジェクトとが等しく、時刻
     部分と与えられた *note time: 1fb. オブジェクトとが等しい、新しい
     *note datetime: 4e2. オブジェクトを返します。 'tzinfo' 引数が与えら
     れた場合、その値は返り値の *note tzinfo: 28ad. 属性に設定するのに使
     われます。そうでない場合、 'time' 引数の *note tzinfo: 28a5. 属性が
     使われます。'date' 引数に *note datetime: 4e2. オブジェクトが与えら
     れた場合、その時刻部分と *note tzinfo: 28ad. 属性は無視されます。

     For any *note datetime: 4e2. object ‘d’, ‘d ==
     datetime.combine(d.date(), d.time(), d.tzinfo)’.

     バージョン 3.6 で変更: 'tzinfo' 引数が追加されました。

 -- メソッド: classmethod datetime.fromisoformat (date_string)

     以下の例外を除く、有効な ISO 8601 フォーマットで与えられた
     'date_string' に対応する *note datetime: 4e2. を返します :

       1. 小数の秒があるタイムゾーンオフセット。

       2. ‘T’ セパレーターを他の1文字のユニコードに置き換えたもの。

       3. 少数の時と分はサポートされていません。

       4. 精度の低い日付は現在サポートされていません(‘YYYY-MM’, ‘YYYY’)。

       5. 拡張された日付表現は現在サポートされていません
          (‘±YYYYYY-MM-DD’)。

       6. 序数の日付は現在サポートされていません(‘YYYY-OOO’)。

     例:

          >>> from datetime import datetime
          >>> datetime.fromisoformat('2011-11-04')
          datetime.datetime(2011, 11, 4, 0, 0)
          >>> datetime.fromisoformat('20111104')
          datetime.datetime(2011, 11, 4, 0, 0)
          >>> datetime.fromisoformat('2011-11-04T00:05:23')
          datetime.datetime(2011, 11, 4, 0, 5, 23)
          >>> datetime.fromisoformat('2011-11-04T00:05:23Z')
          datetime.datetime(2011, 11, 4, 0, 5, 23, tzinfo=datetime.timezone.utc)
          >>> datetime.fromisoformat('20111104T000523')
          datetime.datetime(2011, 11, 4, 0, 5, 23)
          >>> datetime.fromisoformat('2011-W01-2T00:05:23.283')
          datetime.datetime(2011, 1, 4, 0, 5, 23, 283000)
          >>> datetime.fromisoformat('2011-11-04 00:05:23.283')
          datetime.datetime(2011, 11, 4, 0, 5, 23, 283000)
          >>> datetime.fromisoformat('2011-11-04 00:05:23.283+00:00')
          datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, tzinfo=datetime.timezone.utc)
          >>> datetime.fromisoformat('2011-11-04T00:05:23+04:00')
          datetime.datetime(2011, 11, 4, 0, 5, 23,
              tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))

     Added in version 3.7.

     バージョン 3.11 で変更: Previously, this method only supported
     formats that could be emitted by *note date.isoformat(): 28c2. or
     *note datetime.isoformat(): d25.

 -- メソッド: classmethod datetime.fromisocalendar (year, week, day)

     Return a *note datetime: 4e2. corresponding to the ISO calendar
     date specified by 'year', 'week' and 'day'.  The non-date
     components of the datetime are populated with their normal default
     values.  This is the inverse of the function *note
     datetime.isocalendar(): af2.

     Added in version 3.8.

 -- メソッド: classmethod datetime.strptime (date_string, format)

     'date_string' に対応した *note datetime: 4e2. を返します。 'format'
     にしたがって構文解析されます。

     'format' がマイクロ秒やタイムゾーン情報を含まない場合は、以下と等価
     です:

          datetime(*(time.strptime(date_string, format)[0:6]))

     date_string と format が *note time.strptime(): 1646. で構文解析で
     きない場合や、この関数が時刻タプルを返してこない場合には *note
     ValueError: 2ec. を送出します。*note strftime() and strptime()
     behavior: 1b54. および *note datetime.fromisoformat(): 82a. も参照
     してください。

     バージョン 3.13 で変更: If 'format' specifies a day of month
     without a year a *note DeprecationWarning: 1a3. is now emitted.
     This is to avoid a quadrennial leap year bug in code seeking to
     parse only a month and day as the default year used in absence of
     one in the format is not a leap year.  Such 'format' values may
     raise an error as of Python 3.15.  The workaround is to always
     include a year in your 'format'.  If parsing 'date_string' values
     that do not have a year, explicitly add a year that is a leap year
     before parsing:

          >>> from datetime import datetime
          >>> date_string = "02/29"
          >>> when = datetime.strptime(f"{date_string};1984", "%m/%d;%Y")  # Avoids leap year bug.
          >>> when.strftime("%B %d")
          'February 29'

以下にクラス属性を示します:

 -- の属性: datetime.min

     表現できる最も古い *note datetime: 4e2. で、 ‘datetime(MINYEAR, 1,
     1, tzinfo=None)’ です。

 -- の属性: datetime.max

     表現できる最も新しい *note datetime: 4e2. で、 ‘datetime(MAXYEAR,
     12, 31, 23, 59, 59, 999999, tzinfo=None)’ です。

 -- の属性: datetime.resolution

     等しくない *note datetime: 4e2. オブジェクト間の最小の差で、
     ‘timedelta(microseconds=1)’ です。

インスタンスの属性 (読み出しのみ):

 -- の属性: datetime.year

     両端値を含む *note MINYEAR: 289b. から *note MAXYEAR: 289c. までの
     値です。

 -- の属性: datetime.month

     両端値を含む 1 から 12 までの値です。

 -- の属性: datetime.day

     1 から与えられた月と年における日数までの値です。

 -- の属性: datetime.hour

     in ‘range(24)’ を満たします。

 -- の属性: datetime.minute

     in ‘range(60)’ を満たします。

 -- の属性: datetime.second

     in ‘range(60)’ を満たします。

 -- の属性: datetime.microsecond

     in ‘range(1000000)’ を満たします。

 -- の属性: datetime.tzinfo

     *note datetime: 4e2. コンストラクタに 'tzinfo' 引数として与えられた
     オブジェクトになり、何も渡されなかった場合には ‘None’ になります。

 -- の属性: datetime.fold

     ‘[0, 1]’ のどちらかです。 繰り返し期間中の実時間の曖昧さ除去に使わ
     れます。 (繰り返し期間は、夏時間の終わりに時計が巻き戻るときや、現
     在のゾーンの UTC オフセットが政治的な理由で減少するときに発生します
     。) 0または1という値は、同じ実時間で表現される 2 つの時刻のうちのそ
     れぞれ早い方または遅い方を表します。

     Added in version 3.6.

サポートされている演算を以下に示します:

演算                                        結果
                                            
---------------------------------------------------------------------------------
                                            
‘datetime2 = datetime1 + timedelta’         (1)
                                            
                                            
‘datetime2 = datetime1 - timedelta’         (2)
                                            
                                            
‘timedelta = datetime1 - datetime2’         (3)
                                            
                                            
     ‘datetime1 == datetime2’               等価性の比較。(4)
     ‘datetime1 != datetime2’               

     ‘datetime1 < datetime2’                順序の比較。(5)
     ‘datetime1 > datetime2’                
     ‘datetime1 <= datetime2’
     ‘datetime1 >= datetime2’

  1. ‘datetime2’ は ‘datetime1’ から時間 ‘timedelta’ 移動したもので、
     ‘timedelta.days > 0’ の場合未来へ、‘timedelta.days < 0’ の場合過去
     へ移動します。 結果は入力の datetime と同じ *note tzinfo: 28ad. 属
     性を持ち、演算後には ‘datetime2 - datetime1 == timedelta’ となりま
     す。 ‘datetime2.year’ が *note MINYEAR: 289b. よりも小さいか、
     *note MAXYEAR: 289c. より大きい場合には *note OverflowError: a81. が
     送出されます。 入力が aware なオブジェクトの場合でもタイムゾーン修
     正は全く行われません。

  2. ‘datetime2 + timedelta == datetime1’ となるような ‘datetime2’ を計
     算します。 ちなみに、結果は入力の datetime と同じ *note tzinfo:
     28ad. 属性を持ち、入力が aware だとしてもタイムゾーン修正は全く行わ
     れません。

  3. *note datetime: 4e2. から *note datetime: 4e2. の減算は両方の被演算
     子が naive であるか、両方とも aware である場合にのみ定義されていま
     す。片方が aware でもう一方が naive の場合、 *note TypeError: 198.
     が送出されます。

     If both are naive, or both are aware and have the same *note
     tzinfo: 28ad. attribute, the *note tzinfo: 28ad. attributes are
     ignored, and the result is a *note timedelta: bc3. object ‘t’ such
     that ‘datetime2 + t == datetime1’.  No time zone adjustments are
     done in this case.

     If both are aware and have different *note tzinfo: 28ad.
     attributes, ‘a-b’ acts as if ‘a’ and ‘b’ were first converted to
     naive UTC datetimes.  The result is ‘(a.replace(tzinfo=None) -
     a.utcoffset()) - (b.replace(tzinfo=None) - b.utcoffset())’ except
     that the implementation never overflows.

  4. *note datetime: 4e2. オブジェクトはタイムゾーンを考慮して同じ日付と
     時刻を表す場合、等しいです。

     Naive and aware ‘datetime’ objects are never equal.

     If both comparands are aware, and have the same ‘tzinfo’ attribute,
     the ‘tzinfo’ and *note fold: e51. attributes are ignored and the
     base datetimes are compared.  If both comparands are aware and have
     different *note tzinfo: 28ad. attributes, the comparison acts as
     comparands were first converted to UTC datetimes except that the
     implementation never overflows.  ‘datetime’ instances in a repeated
     interval are never equal to ‘datetime’ instances in other time
     zone.

  5. タイムゾーンを考慮して、'datetime1' が時刻として 'datetime2' よりも
     前を表す場合に、'datetime1' は 'datetime2' よりも小さいと見なされま
     す。

     Order comparison between naive and aware *note datetime: 4e2.
     objects raises *note TypeError: 198.

     If both comparands are aware, and have the same ‘tzinfo’ attribute,
     the ‘tzinfo’ and *note fold: e51. attributes are ignored and the
     base datetimes are compared.  If both comparands are aware and have
     different *note tzinfo: 28ad. attributes, the comparison acts as
     comparands were first converted to UTC datetimes except that the
     implementation never overflows.

バージョン 3.3 で変更: aware な *note datetime: 4e2. インスタンスと
naive な *note datetime: 4e2. インスタンスの等価比較では *note
TypeError: 198. は送出されません。

バージョン 3.13 で変更: Comparison between *note datetime: 4e2. object
and an instance of the *note date: 1fa. subclass that is not a
‘datetime’ subclass no longer converts the latter to ‘date’, ignoring
the time part and the time zone.  The default behavior can be changed by
overriding the special comparison methods in subclasses.

インスタンスメソッド:

 -- メソッド: datetime.date ()

     同じ年、月、日の *note date: 1fa. オブジェクトを返します。

 -- メソッド: datetime.time ()

     同じhour、minute、second、microsecond 及び foldを持つ *note time:
     1fb. オブジェクトを返します。 *note tzinfo: 28ad. は ‘None’ です。
     *note timetz(): 28d0. も参照してください。

     バージョン 3.6 で変更: 値 foldは返される *note time: 1fb. オブジェ
     クトにコピーされます。

 -- メソッド: datetime.timetz ()

     同じhour、minute、second、microsecond、fold および tzinfo 属性を持
     つ *note time: 1fb. オブジェクトを返します。 *note time(): f4. メソ
     ッドも参照してください。

     バージョン 3.6 で変更: 値 foldは返される *note time: 1fb. オブジェ
     クトにコピーされます。

 -- メソッド: datetime.replace (year=self.year, month=self.month,
          day=self.day, hour=self.hour, minute=self.minute,
          second=self.second, microsecond=self.microsecond,
          tzinfo=self.tzinfo, *, fold=0)

     Return a new *note datetime: 34. object with the same attributes,
     but with specified parameters updated.  Note that ‘tzinfo=None’ can
     be specified to create a naive datetime from an aware datetime with
     no conversion of date and time data.

     *note datetime: 4e2. オブジェクトは汎用的な関数 *note
     copy.replace(): 1c0. にもサポートされています。

     バージョン 3.6 で変更: 'fold' パラメータが追加されました。

 -- メソッド: datetime.astimezone (tz=None)

     'tz' を新たに *note tzinfo: 28ad. 属性 として持つ *note datetime:
     4e2. オブジェクトを返します。 日付および時刻データを調整して、返り
     値が 'self' と同じ UTC 時刻を持ち、 'tz' におけるローカルな時刻を表
     すようにします。

     もし与えられた場合、 'tz' は *note tzinfo: 7f6. のサブクラスのイン
     スタンスでなければならず、 インスタンスの *note utcoffset(): 28d1.
     および *note dst(): 28d2. メソッドは ‘None’ を返してはなりません。
     もし 'self' が naive ならば、おそらくシステムのタイムゾーンで時間を
     表現します。

     引数無し (もしくは ‘tz=None’ の形 ) で呼び出された場合、システムの
     ローカルなタイムゾーンが変更先のタイムゾーンだと仮定されます。 変換
     後の datetime インスタンスの ‘.tzinfo’ 属性には、 OS から取得したゾ
     ーン名とオフセットを持つ *note timezone: 12d5. インスタンスが設定さ
     れます。

     ‘self.tzinfo’ が 'tz' の場合、 ‘self.astimezone(tz)’ は 'self' に等
     しくなります。つまり、date および time に対する調整は行われません。
     そうでない場合、結果はタイムゾーン 'tz' におけるローカル時刻で、
     'self' と同じ UTC 時刻を表すようになります。これは、‘astz =
     dt.astimezone(tz)’ とした後、 ‘astz - astz.utcoffset()’ は通常 ‘dt
     - dt.utcoffset()’ と同じ date および time を持つことを示します。

     単に *note timezone: 12d5. オブジェクト 'tz' を *note datetime: 34.
     オブジェクト 'dt' に追加したいだけで、日付や時刻データへの調整を行
     わないのなら、‘dt.replace(tzinfo=tz)’ を使ってください。単に aware
     な *note datetime: 34. オブジェクト 'dt' から ‘timezone’ オブジェク
     トを除去したいだけで、日付や時刻データの変換を行わないのなら、
     ‘dt.replace(tzinfo=None)’ を使ってください。

     デフォルトの *note tzinfo.fromutc(): 28d3. メソッドを *note tzinfo:
     7f6. のサブクラスで上書きして, *note astimezone(): bc4. が返す結果
     に影響を及ぼすことができます。エラーの場合を無視すると、 *note
     astimezone(): bc4. は以下のように動作します:

          def astimezone(self, tz):
              if self.tzinfo is tz:
                  return self
              # Convert self to UTC, and attach the new timezone object.
              utc = (self - self.utcoffset()).replace(tzinfo=tz)
              # Convert from UTC to tz's local time.
              return tz.fromutc(utc)

     バージョン 3.3 で変更: 'tz' が省略可能になりました。

     バージョン 3.6 で変更: *note datetime.datetime.astimezone(): bc4. メ
     ソッドを naive なインスタンスに対して呼び出せるようになりました。こ
     れは、システムのローカルな時間を表現していると想定されます。

 -- メソッド: datetime.utcoffset ()

     *note tzinfo: 28ad. が ‘None’ の場合、 ‘None’ を返し、そうでない場
     合には ‘self.tzinfo.utcoffset(self)’ を返します。 後者の式が ‘None’
     あるいは 1 日以下の大きさを持つ *note timedelta: bc3. オブジェクト
     のいずれかを返さない場合には例外を送出します。

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: datetime.dst ()

     *note tzinfo: 28ad. が ‘None’ の場合 ‘None’ を返し、そうでない場合
     には ‘self.tzinfo.dst(self)’ を返します。 後者の式が ‘None’ もしく
     は、1 日未満の大きさを持つ *note timedelta: bc3. オブジェクトのいず
     れかを返さない場合には例外を送出します。

     バージョン 3.7 で変更: DST オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: datetime.tzname ()

     *note tzinfo: 28ad. が ‘None’ の場合 ‘None’ を返し、そうでない場合
     には ‘self.tzinfo.tzname(self)’ を返します。 後者の式が ‘None’ か文
     字列オブジェクトのいずれかを返さない場合には例外を送出します。

 -- メソッド: datetime.timetuple ()

     *note time.localtime(): 1712. が返すような *note time.struct_time:
     ee6. を返します。

     ‘d.timetuple()’ は次の式と等価です:

          time.struct_time((d.year, d.month, d.day,
                            d.hour, d.minute, d.second,
                            d.weekday(), yday, dst))

     ここで ‘yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1’
     はその年の1月1日を 1 としたときのその日の位置です。 返されるタプル
     の *note tm_isdst: 28d6. フラグは *note dst(): 28d2. メソッドに従っ
     て設定されます: *note tzinfo: 28ad. が ‘None’ か *note dst(): 28d2.
     が ‘None’ を返す場合、 ‘tm_isdst’ は ‘-1’ に設定されます; そうでな
     い場合、 *note dst(): 28d2. がゼロでない値を返すと ‘tm_isdst’ は1と
     なります; それ以外の場合には ‘tm_isdst’ は0に設定されます。

 -- メソッド: datetime.utctimetuple ()

     If *note datetime: 4e2. instance ‘d’ is naive, this is the same as
     ‘d.timetuple()’ except that *note tm_isdst: 28d6. is forced to 0
     regardless of what ‘d.dst()’ returns.  DST is never in effect for a
     UTC time.

     If ‘d’ is aware, ‘d’ is normalized to UTC time, by subtracting
     ‘d.utcoffset()’, and a *note time.struct_time: ee6. for the
     normalized time is returned.  ‘tm_isdst’ is forced to 0.  Note that
     an *note OverflowError: a81. may be raised if ‘d.year’ was
     ‘MINYEAR’ or ‘MAXYEAR’ and UTC adjustment spills over a year
     boundary.

          警告: naive な ‘datetime’ オブジェクトは多くの ‘datetime’ メソ
          ッドでローカルな時間として扱われるため、 aware な datetime を
          使って UTC の時刻を表すのが好ましいです。結果として、 *note
          datetime.utctimetuple(): 28d7. は誤解を招きやすい返り値を返す
          かもしれません。 UTC を表す naive な ‘datetime’ があった場合、
          *note datetime.timetuple(): 28d5. が使えるところでは
          ‘datetime.replace(tzinfo=timezone.utc)’ で aware にします。

 -- メソッド: datetime.toordinal ()

     先発グレゴリオ暦における日付序数を返します。
     ‘self.date().toordinal()’ と同じです。

 -- メソッド: datetime.timestamp ()

     *note datetime: 4e2. インスタンスに対応する POSIX タイムスタンプを
     返します。 返り値は *note time.time(): 55d. で返される値に近い
     *note float: 196. です。

     このメソッドでは naive な *note datetime: 4e2. インスタンスはローカ
     ル時刻とし、プラットフォームの C 関数 ‘mktime()’ に頼って変換を行い
     ます。 *note datetime: 4e2. は多くのプラットフォームの ‘mktime()’ よ
     り広い範囲の値をサポートしているので、遥か過去の時刻や遥か未来の時
     刻に対し、このメソッドは *note OverflowError: a81. または *note
     OSError: 2c0. を送出するかもしれません。

     aware な *note datetime: 4e2. インスタンスに対しては以下のように返
     り値が計算されます:

          (dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()

          注釈: UTC 時刻を表す naive な *note datetime: 4e2. インスタン
          スから直接 POSIX タイムスタンプを取得するメソッドはありません
          。 アプリケーションがその変換を使っており、システムのタイムゾ
          ーンが UTC に設定されていなかった場合、 ‘tzinfo=timezone.utc’
          を引数に与えることで POSIX タイムスタンプを取得できます:

               timestamp = dt.replace(tzinfo=timezone.utc).timestamp()

          もしくは直接タイムスタンプを計算することもできます:

               timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)

     Added in version 3.3.

     バージョン 3.6 で変更: The *note timestamp(): 12ac. method uses the
     *note fold: e51. attribute to disambiguate the times during a
     repeated interval.

 -- メソッド: datetime.weekday ()

     月曜日を 0、日曜日を 6 として、曜日を整数で返します。
     ‘self.date().weekday()’ と同じです。 *note isoweekday(): 28da. も参
     照してください。

 -- メソッド: datetime.isoweekday ()

     月曜日を 1、日曜日を 7 として、曜日を整数で返します。
     ‘self.date().isoweekday()’ と等価です。 *note weekday(): 28d9. 、
     *note isocalendar(): af2. も参照してください。

 -- メソッド: datetime.isocalendar ()

     ‘year’、‘week’、‘weekday’ の3つで構成された *note named tuple: 85e.
     を返します。 ‘self.date().isocalendar()’ と等価です。

 -- メソッド: datetime.isoformat (sep='T', timespec='auto')

     日時を ISO 8601 書式で表した文字列で返します:

        - *note microsecond: 28ac. が 0 でない場合は
          ‘YYYY-MM-DDTHH:MM:SS.ffffff’

        - *note microsecond: 28ac. が 0 の場合は ‘YYYY-MM-DDTHH:MM:SS’

     *note utcoffset(): 28d1. が ‘None’ を返さない場合は、文字列の後ろに
     UTC オフセットが追記されます:

        - *note microsecond: 28ac. が 0 でない場合は
          ‘YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]’

        - *note microsecond: 28ac. が 0 の場合は
          ‘YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]’

     例:

          >>> from datetime import datetime, timezone
          >>> datetime(2019, 5, 18, 15, 17, 8, 132263).isoformat()
          '2019-05-18T15:17:08.132263'
          >>> datetime(2019, 5, 18, 15, 17, tzinfo=timezone.utc).isoformat()
          '2019-05-18T15:17:00+00:00'

     オプションの引数 'sep' (デフォルトでは ‘'T'’ です) は 1 文字のセパ
     レータで、結果の文字列の日付と時刻の間に置かれます。例えば:

          >>> from datetime import tzinfo, timedelta, datetime
          >>> class TZ(tzinfo):
          ...     """A time zone with an arbitrary, constant -06:39 offset."""
          ...     def utcoffset(self, dt):
          ...         return timedelta(hours=-6, minutes=-39)
          ...
          >>> datetime(2002, 12, 25, tzinfo=TZ()).isoformat(' ')
          '2002-12-25 00:00:00-06:39'
          >>> datetime(2009, 11, 27, microsecond=100, tzinfo=TZ()).isoformat()
          '2009-11-27T00:00:00.000100-06:39'

     オプション引数 'timespec' は、含める追加の時間の要素の数を指定しま
     す(デフォルトでは ‘'auto'’ です)。以下の内一つを指定してください。

        - ‘'auto'’: *note microsecond: 28ac. が0である場合 ‘'seconds'’ と
          等しく、そうでない場合は ‘'microseconds'’ と等しくなります。

        - ‘'hours'’: *note hour: 28a9. を2桁の ‘HH’ 書式で含めます。

        - ‘'minutes'’: *note hour: 28a9. および *note minute: 28aa. を
          ‘HH:MM’ の書式で含めます。

        - ‘'seconds'’: *note hour: 28a9. 、 *note minute: 28aa. 、 *note
          second: 28ab. を ‘HH:MM:SS’ の書式で含めます。

        - ‘'milliseconds'’: 全ての時刻を含みますが、小数第二位をミリ秒に
          切り捨てます。 ‘HH:MM:SS.sss’ の書式で表現します。

        - ‘'microseconds'’: 全ての時刻を ‘HH:MM:SS.mmmmmm’ の書式で含め
          ます。

          注釈: 除外された要素は丸め込みではなく、切り捨てされます。

     不正な 'timespec' 引数には *note ValueError: 2ec. があげられます:

          >>> from datetime import datetime
          >>> datetime.now().isoformat(timespec='minutes')
          '2002-12-25T00:00'
          >>> dt = datetime(2015, 1, 1, 12, 30, 59, 0)
          >>> dt.isoformat(timespec='microseconds')
          '2015-01-01T12:30:59.000000'

     バージョン 3.6 で変更: 'timespec' パラメータを追加しました.

 -- メソッド: datetime.__str__ ()

     For a *note datetime: 4e2. instance ‘d’, ‘str(d)’ is equivalent to
     ‘d.isoformat(' ')’.

 -- メソッド: datetime.ctime ()

     日付および時刻を表す文字列を返します:

          >>> from datetime import datetime
          >>> datetime(2002, 12, 4, 20, 30, 40).ctime()
          'Wed Dec  4 20:30:40 2002'

     出力文字列は入力が aware であれ naive であれ、タイムゾーン情報を含
     み 'ません'。

     ‘d.ctime()’ は次の式と等価です:

          time.ctime(time.mktime(d.timetuple()))

     これが等価になるのは、 (*note time.ctime(): 28c5. に呼び出され、
     *note datetime.ctime(): 28dc. に呼び出されない) ネイティブの C 関数
     ‘ctime()’ が C 標準に準拠しているプラットフォーム上でです。

 -- メソッド: datetime.strftime (format)

     明示的な書式文字列で制御された、日付および時刻を表現する文字列を返
     します。*note strftime() and strptime() behavior: 1b54. および
     *note datetime.isoformat(): d25. も参照してください。

 -- メソッド: datetime.__format__ (format)

     *note datetime.strftime(): e8e. と等価です。 これにより、 *note
     フォーマット済み文字列リテラル: 19a. の中や *note str.format():
     833. を使っているときに *note datetime: 4e2. オブジェクトの書式文字
     列を指定できます。 *note strftime() and strptime() behavior: 1b54.
     および *note datetime.isoformat(): d25. も参照してください。

* Menu:

* Examples of usage; datetime: Examples of usage datetime.


File: python.info,  Node: Examples of usage datetime,  Up: datetime objects

5.8.1.11 Examples of usage: ‘datetime’
......................................

*note datetime: 4e2. オブジェクトを使う例:

     >>> from datetime import datetime, date, time, timezone

     >>> # Using datetime.combine()
     >>> d = date(2005, 7, 14)
     >>> t = time(12, 30)
     >>> datetime.combine(d, t)
     datetime.datetime(2005, 7, 14, 12, 30)

     >>> # Using datetime.now()
     >>> datetime.now()
     datetime.datetime(2007, 12, 6, 16, 29, 43, 79043)   # GMT +1
     >>> datetime.now(timezone.utc)
     datetime.datetime(2007, 12, 6, 15, 29, 43, 79060, tzinfo=datetime.timezone.utc)

     >>> # Using datetime.strptime()
     >>> dt = datetime.strptime("21/11/06 16:30", "%d/%m/%y %H:%M")
     >>> dt
     datetime.datetime(2006, 11, 21, 16, 30)

     >>> # Using datetime.timetuple() to get tuple of all attributes
     >>> tt = dt.timetuple()
     >>> for it in tt:
     ...     print(it)
     ...
     2006    # year
     11      # month
     21      # day
     16      # hour
     30      # minute
     0       # second
     1       # weekday (0 = Monday)
     325     # number of days since 1st January
     -1      # dst - method tzinfo.dst() returned None

     >>> # Date in ISO format
     >>> ic = dt.isocalendar()
     >>> for it in ic:
     ...     print(it)
     ...
     2006    # ISO year
     47      # ISO week
     2       # ISO weekday

     >>> # Formatting a datetime
     >>> dt.strftime("%A, %d. %B %Y %I:%M%p")
     'Tuesday, 21. November 2006 04:30PM'
     >>> 'The {1} is {0:%d}, the {2} is {0:%B}, the {3} is {0:%I:%M%p}.'.format(dt, "day", "month", "time")
     'The day is 21, the month is November, the time is 04:30PM.'

下にある例では、1945年までは +4 UTC 、それ以降は +4:30 UTC を使用してい
るアフガニスタンのカブールのタイムゾーン情報を表現する *note tzinfo:
7f6. のサブクラスを定義しています:

     from datetime import timedelta, datetime, tzinfo, timezone

     class KabulTz(tzinfo):
         # Kabul used +4 until 1945, when they moved to +4:30
         UTC_MOVE_DATE = datetime(1944, 12, 31, 20, tzinfo=timezone.utc)

         def utcoffset(self, dt):
             if dt.year < 1945:
                 return timedelta(hours=4)
             elif (1945, 1, 1, 0, 0) <= dt.timetuple()[:5] < (1945, 1, 1, 0, 30):
                 # An ambiguous ("imaginary") half-hour range representing
                 # a 'fold' in time due to the shift from +4 to +4:30.
                 # If dt falls in the imaginary range, use fold to decide how
                 # to resolve. See PEP495.
                 return timedelta(hours=4, minutes=(30 if dt.fold else 0))
             else:
                 return timedelta(hours=4, minutes=30)

         def fromutc(self, dt):
             # Follow same validations as in datetime.tzinfo
             if not isinstance(dt, datetime):
                 raise TypeError("fromutc() requires a datetime argument")
             if dt.tzinfo is not self:
                 raise ValueError("dt.tzinfo is not self")

             # A custom implementation is required for fromutc as
             # the input to this function is a datetime with utc values
             # but with a tzinfo set to self.
             # See datetime.astimezone or fromtimestamp.
             if dt.replace(tzinfo=timezone.utc) >= self.UTC_MOVE_DATE:
                 return dt + timedelta(hours=4, minutes=30)
             else:
                 return dt + timedelta(hours=4)

         def dst(self, dt):
             # Kabul does not observe daylight saving time.
             return timedelta(0)

         def tzname(self, dt):
             if dt >= self.UTC_MOVE_DATE:
                 return "+04:30"
             return "+04"

上に出てきた ‘KabulTz’ の使い方:

     >>> tz1 = KabulTz()

     >>> # Datetime before the change
     >>> dt1 = datetime(1900, 11, 21, 16, 30, tzinfo=tz1)
     >>> print(dt1.utcoffset())
     4:00:00

     >>> # Datetime after the change
     >>> dt2 = datetime(2006, 6, 14, 13, 0, tzinfo=tz1)
     >>> print(dt2.utcoffset())
     4:30:00

     >>> # Convert datetime to another time zone
     >>> dt3 = dt2.astimezone(timezone.utc)
     >>> dt3
     datetime.datetime(2006, 6, 14, 8, 30, tzinfo=datetime.timezone.utc)
     >>> dt2
     datetime.datetime(2006, 6, 14, 13, 0, tzinfo=KabulTz())
     >>> dt2 == dt3
     True


File: python.info,  Node: time objects,  Next: tzinfo objects,  Prev: datetime objects,  Up: datetime --- 基本的な日付と時間の型

5.8.1.12 ‘time’ objects
.......................

*note time: 1fb. オブジェクトは (ローカルの) 日中時刻を表現します。 この
時刻表現は特定の日の影響を受けず、 *note tzinfo: 7f6. オブジェクトを介し
た修正の対象となります。

 -- クラス: datetime.time (hour=0, minute=0, second=0, microsecond=0,
          tzinfo=None, *, fold=0)

     全ての引数はオプションです。 'tzinfo' は ‘None’ または *note
     tzinfo: 7f6. クラスのサブクラスのインスタンスにすることができます。
     残りの引数は整数で、以下のような範囲に入らなければなりません:

        * ‘0 <= hour < 24’,

        * ‘0 <= minute < 60’,

        * ‘0 <= second < 60’,

        * ‘0 <= microsecond < 1000000’,

        * ‘fold in [0, 1]’.

     引数がこれらの範囲外にある場合、 *note ValueError: 2ec. が送出され
     ます。 'tzinfo' のデフォルト値が ‘None’ である以外のデフォルト値は
     0です。

以下にクラス属性を示します:

 -- の属性: time.min

     表現できる最も古い *note time: 1fb. で、 ‘time(0, 0, 0, 0)’ です。

 -- の属性: time.max

     表現できる最も新しい *note time: 1fb. で、 ‘time(23, 59, 59,
     999999)’ です。

 -- の属性: time.resolution

     等しくない *note time: 1fb. オブジェクト間の最小の差で、
     ‘timedelta(microseconds=1)’ ですが, *note time: 1fb. オブジェクト間
     の四則演算はサポートされていないので注意してください。

インスタンスの属性 (読み出しのみ):

 -- の属性: time.hour

     in ‘range(24)’ を満たします。

 -- の属性: time.minute

     in ‘range(60)’ を満たします。

 -- の属性: time.second

     in ‘range(60)’ を満たします。

 -- の属性: time.microsecond

     in ‘range(1000000)’ を満たします。

 -- の属性: time.tzinfo

     *note time: 1fb. コンストラクタに 'tzinfo' 引数として与えられたオブ
     ジェクトになり、何も渡されなかった場合には ‘None’ になります。

 -- の属性: time.fold

     ‘[0, 1]’ のどちらかです。 繰り返し期間中の実時間の曖昧さ除去に使わ
     れます。 (繰り返し期間は、夏時間の終わりに時計が巻き戻るときや、現
     在のゾーンの UTC オフセットが政治的な理由で減少するときに発生します
     。) 0または1という値は、同じ実時間で表現される 2 つの時刻のうちのそ
     れぞれ早い方または遅い方を表します。

     Added in version 3.6.

*note time: 1fb. objects support equality and order comparisons, where
‘a’ is considered less than ‘b’ when ‘a’ precedes ‘b’ in time.

Naive and aware ‘time’ objects are never equal.  Order comparison
between naive and aware ‘time’ objects raises *note TypeError: 198.

比較対象が両方とも aware であり、同じ *note tzinfo: 28a5. 属性を持つ場合
、 ‘tzinfo’ と ‘fold’ 属性は無視され時間だけで比較が行われます。比較対象
が両方とも aware であり、異なる ‘tzinfo’ 属性を持つ場合、まず最初に
(‘self.utcoffset()’ で取得できる) それぞれの UTC オフセットを引く調整が
行われます。

バージョン 3.3 で変更: aware な インスタンスと naive な *note time: 1fb.
インスタンスの等価比較では *note TypeError: 198. は送出されません。

ブール値の文脈では、 *note time: 1fb. オブジェクトは常に真とみなされます
。

バージョン 3.5 で変更: Before Python 3.5, a *note time: 1fb. object was
considered to be false if it represented midnight in UTC. This behavior
was considered obscure and error-prone and has been removed in Python
3.5.  See bpo-13936(1) for more information.

Other constructors:

 -- メソッド: classmethod time.fromisoformat (time_string)

     以下の例外を除く、有効な ISO 8601 フォーマットで与えられた
     'time_string' に対応する *note time: 1fb. を返します :

       1. 小数の秒があるタイムゾーンオフセット。

       2. The leading ‘T’, normally required in cases where there may be
          ambiguity between a date and a time, is not required.

       3. Fractional seconds may have any number of digits (anything
          beyond 6 will be truncated).

       4. 少数の時と分はサポートされていません。

     例:

          >>> from datetime import time
          >>> time.fromisoformat('04:23:01')
          datetime.time(4, 23, 1)
          >>> time.fromisoformat('T04:23:01')
          datetime.time(4, 23, 1)
          >>> time.fromisoformat('T042301')
          datetime.time(4, 23, 1)
          >>> time.fromisoformat('04:23:01.000384')
          datetime.time(4, 23, 1, 384)
          >>> time.fromisoformat('04:23:01,000384')
          datetime.time(4, 23, 1, 384)
          >>> time.fromisoformat('04:23:01+04:00')
          datetime.time(4, 23, 1, tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))
          >>> time.fromisoformat('04:23:01Z')
          datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)
          >>> time.fromisoformat('04:23:01+00:00')
          datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)

     Added in version 3.7.

     バージョン 3.11 で変更: Previously, this method only supported
     formats that could be emitted by *note time.isoformat(): 28e4.

 -- メソッド: classmethod time.strptime (date_string, format)

     Return a *note time: 1fb. corresponding to 'date_string', parsed
     according to 'format'.

     'format' がマイクロ秒やタイムゾーン情報を含まない場合は、以下と等価
     です:

          time(*(time.strptime(date_string, format)[3:6]))

     *note ValueError: 2ec. is raised if the 'date_string' and 'format'
     cannot be parsed by *note time.strptime(): 1646. or if it returns a
     value which is not a time tuple.  See also *note strftime() and
     strptime() behavior: 1b54. and *note time.fromisoformat(): 829.

     Added in version 3.14.

インスタンスメソッド:

 -- メソッド: time.replace (hour=self.hour, minute=self.minute,
          second=self.second, microsecond=self.microsecond,
          tzinfo=self.tzinfo, *, fold=0)

     Return a new *note time: 1fb. with the same values, but with
     specified parameters updated.  Note that ‘tzinfo=None’ can be
     specified to create a naive *note time: 1fb. from an aware *note
     time: 1fb, without conversion of the time data.

     *note time: 1fb. オブジェクトは汎用的な関数 *note copy.replace():
     1c0. にもサポートされています。

     バージョン 3.6 で変更: 'fold' パラメータが追加されました。

 -- メソッド: time.isoformat (timespec='auto')

     時刻を ISO 8601 書式で表した次の文字列のうち1つを返します:

        - *note microsecond: 28a4. が 0 でない場合は ‘HH:MM:SS.ffffff’

        - *note microsecond: 28a4. が 0 の場合は ‘HH:MM:SS’

        - *note utcoffset(): 28e5. が ‘None’ を返さない場合、
          ‘HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]’

        - *note microsecond: 28a4. が 0 で *note utcoffset(): 28e5. が
          ‘None’ を返さない場合、 ‘HH:MM:SS+HH:MM[:SS[.ffffff]]’

     オプション引数 'timespec' は、含める追加の時間の要素の数を指定しま
     す(デフォルトでは ‘'auto'’ です)。以下の内一つを指定してください。

        - ‘'auto'’: *note microsecond: 28a4. が0である場合 ‘'seconds'’ と
          等しく、そうでない場合は ‘'microseconds'’ と等しくなります。

        - ‘'hours'’: *note hour: 28a1. を2桁の ‘HH’ 書式で含めます。

        - ‘'minutes'’: *note hour: 28a1. および *note minute: 28a2. を
          ‘HH:MM’ の書式で含めます。

        - ‘'seconds'’: *note hour: 28a1. 、 *note minute: 28a2. 、 *note
          second: 28a3. を ‘HH:MM:SS’ の書式で含めます。

        - ‘'milliseconds'’: 全ての時刻を含みますが、小数第二位をミリ秒に
          切り捨てます。 ‘HH:MM:SS.sss’ の書式で表現します。

        - ‘'microseconds'’: 全ての時刻を ‘HH:MM:SS.mmmmmm’ の書式で含め
          ます。

          注釈: 除外された要素は丸め込みではなく、切り捨てされます。

     不正な 'timespec' 引数には *note ValueError: 2ec. があげられます。

     以下はプログラム例です:

          >>> from datetime import time
          >>> time(hour=12, minute=34, second=56, microsecond=123456).isoformat(timespec='minutes')
          '12:34'
          >>> dt = time(hour=12, minute=34, second=56, microsecond=0)
          >>> dt.isoformat(timespec='microseconds')
          '12:34:56.000000'
          >>> dt.isoformat(timespec='auto')
          '12:34:56'

     バージョン 3.6 で変更: 'timespec' パラメータを追加しました.

 -- メソッド: time.__str__ ()

     For a time ‘t’, ‘str(t)’ is equivalent to ‘t.isoformat()’.

 -- メソッド: time.strftime (format)

     明示的な書式文字列で制御された、時刻を表現する文字列を返します。
     *note strftime() and strptime() behavior: 1b54. および *note
     time.isoformat(): 28e4. も参照してください。

 -- メソッド: time.__format__ (format)

     *note time.strftime(): 1af8. と等価です。 これにより、 *note
     フォーマット済み文字列リテラル: 19a. の中や *note str.format():
     833. を使っているときに *note time: 1fb. オブジェクトの書式文字列を
     指定できます。 *note strftime() and strptime() behavior: 1b54. およ
     び *note time.isoformat(): 28e4. も参照してください。

 -- メソッド: time.utcoffset ()

     *note tzinfo: 28a5. が ‘None’ の場合、 ‘None’ を返し、そうでない場
     合には ‘self.tzinfo.utcoffset(None)’ を返します。 後者の式が ‘None’
     あるいは 1 日以下の大きさを持つ *note timedelta: bc3. オブジェクト
     のいずれかを返さない場合には例外を送出します。

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: time.dst ()

     *note tzinfo: 28a5. が ‘None’ の場合 ‘None’ を返し、そうでない場合
     には ‘self.tzinfo.dst(None)’ を返します。 後者の式が ‘None’ もしく
     は、1 日未満の大きさを持つ *note timedelta: bc3. オブジェクトのいず
     れかを返さない場合には例外を送出します。

     バージョン 3.7 で変更: DST オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: time.tzname ()

     *note tzinfo: 28a5. が ‘None’ の場合 ‘None’ を返し、そうでない場合
     には ‘self.tzinfo.tzname(None)’ を返します。 後者の式が ‘None’ か文
     字列オブジェクトのいずれかを返さない場合には例外を送出します。

* Menu:

* Examples of usage; time: Examples of usage time.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=13936


File: python.info,  Node: Examples of usage time,  Up: time objects

5.8.1.13 Examples of usage: ‘time’
..................................

*note time: 1fb. オブジェクトを使う例:

     >>> from datetime import time, tzinfo, timedelta
     >>> class TZ1(tzinfo):
     ...     def utcoffset(self, dt):
     ...         return timedelta(hours=1)
     ...     def dst(self, dt):
     ...         return timedelta(0)
     ...     def tzname(self,dt):
     ...         return "+01:00"
     ...     def  __repr__(self):
     ...         return f"{self.__class__.__name__}()"
     ...
     >>> t = time(12, 10, 30, tzinfo=TZ1())
     >>> t
     datetime.time(12, 10, 30, tzinfo=TZ1())
     >>> t.isoformat()
     '12:10:30+01:00'
     >>> t.dst()
     datetime.timedelta(0)
     >>> t.tzname()
     '+01:00'
     >>> t.strftime("%H:%M:%S %Z")
     '12:10:30 +01:00'
     >>> 'The {} is {:%H:%M}.'.format("time", t)
     'The time is 12:10.'


File: python.info,  Node: tzinfo objects,  Next: timezone objects,  Prev: time objects,  Up: datetime --- 基本的な日付と時間の型

5.8.1.14 ‘tzinfo’ objects
.........................

 -- クラス: datetime.tzinfo

     This is an *note abstract base class: 13ce, meaning that this class
     should not be instantiated directly.  Define a subclass of *note
     tzinfo: 7f6. to capture information about a particular time zone.

     *note tzinfo: 7f6. (の具体的なサブクラス) のインスタンスは *note
     datetime: 4e2. および *note time: 1fb. オブジェクトのコンストラクタ
     に渡すことができます。後者のオブジェクトでは、データ属性をローカル
     時刻におけるものとして見ており、 *note tzinfo: 7f6. オブジェクトは
     ローカル時刻の UTC からのオフセット、タイムゾーンの名前、 DST オフ
     セットを、渡された日付および時刻オブジェクトからの相対で示すための
     メソッドを提供します。

     具象サブクラスを作成し、(少なくとも) 使いたい *note datetime: 4e2.
     のメソッドが必要とする *note tzinfo: 7f6. のメソッドを実装する必要
     があります。 ‘datetime’ モジュールは *note tzinfo: 7f6. のシンプル
     な具象サブクラス *note timezone: 12d5. を提供します。 これは UTC そ
     のものか北アメリカの EST と EDT のような UTC からの固定されたオフセ
     ットを持つタイムゾーンを表せます。

     pickle 化についての特殊な要求事項: *note tzinfo: 7f6. のサブクラス
     は引数なしで呼び出すことのできる *note __init__(): 8bf. メソッドを
     持たなければなりません。そうでなければ、 pickle 化することはできま
     すがおそらく unpickle 化することはできないでしょう。これは技術的な
     側面からの要求であり、将来緩和されるかもしれません。

     *note tzinfo: 7f6. の具体的なサブクラスでは、以下のメソッドを実装す
     る必要があります。厳密にどのメソッドが必要なのかは、 aware な
     ‘datetime’ オブジェクトがこのサブクラスのインスタンスをどのように使
     うかに依存します。不確かならば、単に全てを実装してください。

 -- メソッド: tzinfo.utcoffset (dt)

     ローカル時間の UTC からのオフセットを、 UTC から東向きを正とした
     *note timedelta: bc3. オブジェクトで返します。ローカル時間が UTC の
     西側にある場合、この値は負になります。

     このメソッドは UTC からのオフセットの '総計' を表しています。例えば
     、 *note tzinfo: 7f6. オブジェクトがタイムゾーンと DST 修正の両方を
     表現する場合、 *note utcoffset(): 28ed. はそれらの合計を返さなけれ
     ばなりません。 UTC オフセットが未知である場合、 ‘None’ を返します。
     そうでない場合には、返される値は ‘-timedelta(hours=24)’ から
     ‘timedelta(hours=24)’ までの *note timedelta: bc3. 境界を含まないオ
     ブジェクトでなければなりません (オフセットの大きさは 1 日より短くな
     ければなりません)。 ほとんどの *note utcoffset(): 28ed. 実装は、お
     そらく以下の二つのうちの一つに似たものになるでしょう:

          return CONSTANT                 # fixed-offset class
          return CONSTANT + self.dst(dt)  # daylight-aware class

     *note utcoffset(): 28ed. が ‘None’ を返さない場合、 *note dst():
     28ee. も ‘None’ を返してはなりません。

     *note utcoffset(): 28ed. のデフォルトの実装は *note
     NotImplementedError: 36b. を送出します。

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: tzinfo.dst (dt)

     夏時間 (DST) 修正を、 *note timedelta: bc3. オブジェクトで返します
     。 DST 情報が未知の場合、 ‘None’ が返されます。

     DST が有効でない場合には ‘timedelta(0)’ を返します。 DST が有効の場
     合、オフセットは *note timedelta: bc3. オブジェクトで返します (詳細
     は *note utcoffset(): 28ed. を参照してください)。 DST オフセットが
     利用可能な場合、この値は *note utcoffset(): 28ed. が返す UTC からの
     オフセットには既に加算されているため、 DST を個別に取得する必要がな
     い限り *note dst(): 28ee. を使って問い合わせる必要はないので注意し
     てください。 例えば、 *note datetime.timetuple(): 28d5. は *note
     tzinfo: 28ad. 属性の *note dst(): 28ee. メソッドを呼んで *note
     tm_isdst: 28d6. フラグがセットされているかどうか判断し、 *note
     tzinfo.fromutc(): 28d3. は *note dst(): 28ee. タイムゾーンを移動す
     る際に DST による変更があるかどうかを調べます。

     標準および夏時間の両方をモデル化している *note tzinfo: 7f6. サブク
     ラスのインスタンス 'tz' は以下の式:

     ‘tz.utcoffset(dt) - tz.dst(dt)’

     が、 ‘dt.tzinfo == tz’ 全ての *note datetime: 4e2. オブジェクト
     'dt' について常に同じ結果を返さなければならないという点で、一貫性を
     持っていなければなりません。正常に実装された *note tzinfo: 7f6. の
     サブクラスでは、この式はタイムゾーンにおける "標準オフセット
     (standard offset)" を表し、特定の日や時刻の事情ではなく地理的な位置
     にのみ依存していなくてはなりません。 *note datetime.astimezone():
     bc4. の実装はこの事実に依存していますが、違反を検出することができま
     せん; 正しく実装するのはプログラマの責任です。 *note tzinfo: 7f6. の
     サブクラスでこれを保証することができない場合、 *note
     tzinfo.fromutc(): 28d3. の実装をオーバライドして、 ‘astimezone()’ に
     関わらず正しく動作するようにしてもかまいません。

     ほとんどの *note dst(): 28ee. 実装は、おそらく以下の二つのうちの一
     つに似たものになるでしょう:

          def dst(self, dt):
              # a fixed-offset class:  doesn't account for DST
              return timedelta(0)

     もしくは:

          def dst(self, dt):
              # Code to set dston and dstoff to the time zone's DST
              # transition times based on the input dt.year, and expressed
              # in standard local time.

              if dston <= dt.replace(tzinfo=None) < dstoff:
                  return timedelta(hours=1)
              else:
                  return timedelta(0)

     デフォルトの *note dst(): 28ee. 実装は *note NotImplementedError:
     36b. を送出します。

     バージョン 3.7 で変更: DST オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: tzinfo.tzname (dt)

     *note datetime: 4e2. オブジェクト 'dt' に対応するタイムゾーン名を文
     字列で返します。 ‘datetime’ モジュールでは文字列名について何も定義
     しておらず、特に何かを意味するといった要求仕様もまったくありません
     。例えば、‘"GMT"’, ‘"UTC"’, ‘"-500"’, ‘"-5:00"’, ‘"EDT"’,
     ‘"US/Eastern"’, ‘"America/New York"’ は全て有効な応答となります。文
     字列名が未知の場合には ‘None’ を返してください。 *note tzinfo: 7f6.
     のサブクラスでは、特に, *note tzinfo: 7f6. クラスが夏時間について記
     述している場合のように、渡された 'dt' の特定の値によって異なった名
     前を返したい場合があるため、文字列値ではなくメソッドとなっているこ
     とに注意してください。

     デフォルトの *note tzname(): 28ef. 実装は *note
     NotImplementedError: 36b. を送出します。

以下のメソッドは *note datetime: 4e2. や *note time: 1fb. オブジェクトに
おいて、同名のメソッドが呼び出された際に応じて呼び出されます。 *note
datetime: 4e2. オブジェクトは自身を引数としてメソッドに渡し、 *note
time: 1fb. オブジェクトは引数として ‘None’ をメソッドに渡します。従って
、 *note tzinfo: 7f6. のサブクラスにおけるメソッドは引数 'dt' が ‘None’
の場合と、 *note datetime: 4e2. の場合を受理するように用意しなければなり
ません。

‘None’ が渡された場合、最良の応答方法を決めるのはクラス設計者次第です。
例えば、このクラスが *note tzinfo: 7f6. プロトコルと関係をもたないという
ことを表明させたければ、 ‘None’ が適切です。標準時のオフセットを見つける
他の手段がない場合には、標準 UTC オフセットを返すために
‘utcoffset(None)’ を使うともっと便利かもしれません。

*note datetime: 4e2. オブジェクトが ‘datetime()’ メソッドの応答として返
された場合、 ‘dt.tzinfo’ は 'self' と同じオブジェクトになります。ユーザ
が直接 *note tzinfo: 7f6. メソッドを呼び出さないかぎり、 *note tzinfo:
7f6. メソッドは ‘dt.tzinfo’ と 'self' が同じであることに依存します。その
結果 *note tzinfo: 7f6. メソッドは 'dt' がローカル時間であると解釈するの
で、他のタイムゾーンでのオブジェクトの振る舞いについて心配する必要があり
ません。

サブクラスでオーバーライドすると良い、もう 1 つの *note tzinfo: 7f6. の
メソッドがあります:

 -- メソッド: tzinfo.fromutc (dt)

     デフォルトの 実装で呼び出されます。 *note datetime.astimezone():
     bc4. から呼ばれた場合、 ‘dt.tzinfo’ は 'self' であり、 'dt' の日付
     および時刻データは UTC 時刻を表しているものとして見えます。 *note
     fromutc(): 28d3. の目的は、 'self' のローカル時刻に等しい *note
     datetime: 34. オブジェクトを返すことにより日付と時刻データメンバを
     修正することにあります。

     ほとんどの *note tzinfo: 7f6. サブクラスではデフォルトの *note
     fromutc(): 28d3. 実装を問題なく継承できます。デフォルトの実装は、固
     定オフセットのタイムゾーンや、標準時と夏時間の両方について記述して
     いるタイムゾーン、そして DST 移行時刻が年によって異なる場合でさえ、
     扱えるくらい強力なものです。デフォルトの *note fromutc(): 28d3. 実
     装が全ての場合に対して正しく扱うことができないような例は、標準時の
     (UTCからの) オフセットが引数として渡された特定の日や時刻に依存する
     もので、これは政治的な理由によって起きることがあります。デフォルト
     の *note astimezone(): bc4. や *note fromutc(): 28d3. の実装は、結
     果が標準時オフセットの変化にまたがる何時間かの中にある場合、期待通
     りの結果を生成しないかもしれません。

     エラーの場合のためのコードを除き、デフォルトの *note fromutc():
     28d3. の実装は以下のように動作します:

          def fromutc(self, dt):
              # raise ValueError error if dt.tzinfo is not self
              dtoff = dt.utcoffset()
              dtdst = dt.dst()
              # raise ValueError if dtoff is None or dtdst is None
              delta = dtoff - dtdst  # this is self's standard offset
              if delta:
                  dt += delta   # convert to standard local time
                  dtdst = dt.dst()
                  # raise ValueError if dtdst is None
              if dtdst:
                  return dt + dtdst
              else:
                  return dt

次の ‘tzinfo_examples.py’ ファイルには、 *note tzinfo: 7f6. クラスの例が
いくつか載っています:

     from datetime import tzinfo, timedelta, datetime

     ZERO = timedelta(0)
     HOUR = timedelta(hours=1)
     SECOND = timedelta(seconds=1)

     # A class capturing the platform's idea of local time.
     # (May result in wrong values on historical times in
     #  timezones where UTC offset and/or the DST rules had
     #  changed in the past.)
     import time as _time

     STDOFFSET = timedelta(seconds = -_time.timezone)
     if _time.daylight:
         DSTOFFSET = timedelta(seconds = -_time.altzone)
     else:
         DSTOFFSET = STDOFFSET

     DSTDIFF = DSTOFFSET - STDOFFSET

     class LocalTimezone(tzinfo):

         def fromutc(self, dt):
             assert dt.tzinfo is self
             stamp = (dt - datetime(1970, 1, 1, tzinfo=self)) // SECOND
             args = _time.localtime(stamp)[:6]
             dst_diff = DSTDIFF // SECOND
             # Detect fold
             fold = (args == _time.localtime(stamp - dst_diff))
             return datetime(*args, microsecond=dt.microsecond,
                             tzinfo=self, fold=fold)

         def utcoffset(self, dt):
             if self._isdst(dt):
                 return DSTOFFSET
             else:
                 return STDOFFSET

         def dst(self, dt):
             if self._isdst(dt):
                 return DSTDIFF
             else:
                 return ZERO

         def tzname(self, dt):
             return _time.tzname[self._isdst(dt)]

         def _isdst(self, dt):
             tt = (dt.year, dt.month, dt.day,
                   dt.hour, dt.minute, dt.second,
                   dt.weekday(), 0, 0)
             stamp = _time.mktime(tt)
             tt = _time.localtime(stamp)
             return tt.tm_isdst > 0

     Local = LocalTimezone()


     # A complete implementation of current DST rules for major US time zones.

     def first_sunday_on_or_after(dt):
         days_to_go = 6 - dt.weekday()
         if days_to_go:
             dt += timedelta(days_to_go)
         return dt


     # US DST Rules
     #
     # This is a simplified (i.e., wrong for a few cases) set of rules for US
     # DST start and end times. For a complete and up-to-date set of DST rules
     # and timezone definitions, visit the Olson Database (or try pytz):
     # http://www.twinsun.com/tz/tz-link.htm
     # https://sourceforge.net/projects/pytz/ (might not be up-to-date)
     #
     # In the US, since 2007, DST starts at 2am (standard time) on the second
     # Sunday in March, which is the first Sunday on or after Mar 8.
     DSTSTART_2007 = datetime(1, 3, 8, 2)
     # and ends at 2am (DST time) on the first Sunday of Nov.
     DSTEND_2007 = datetime(1, 11, 1, 2)
     # From 1987 to 2006, DST used to start at 2am (standard time) on the first
     # Sunday in April and to end at 2am (DST time) on the last
     # Sunday of October, which is the first Sunday on or after Oct 25.
     DSTSTART_1987_2006 = datetime(1, 4, 1, 2)
     DSTEND_1987_2006 = datetime(1, 10, 25, 2)
     # From 1967 to 1986, DST used to start at 2am (standard time) on the last
     # Sunday in April (the one on or after April 24) and to end at 2am (DST time)
     # on the last Sunday of October, which is the first Sunday
     # on or after Oct 25.
     DSTSTART_1967_1986 = datetime(1, 4, 24, 2)
     DSTEND_1967_1986 = DSTEND_1987_2006

     def us_dst_range(year):
         # Find start and end times for US DST. For years before 1967, return
         # start = end for no DST.
         if 2006 < year:
             dststart, dstend = DSTSTART_2007, DSTEND_2007
         elif 1986 < year < 2007:
             dststart, dstend = DSTSTART_1987_2006, DSTEND_1987_2006
         elif 1966 < year < 1987:
             dststart, dstend = DSTSTART_1967_1986, DSTEND_1967_1986
         else:
             return (datetime(year, 1, 1), ) * 2

         start = first_sunday_on_or_after(dststart.replace(year=year))
         end = first_sunday_on_or_after(dstend.replace(year=year))
         return start, end


     class USTimeZone(tzinfo):

         def __init__(self, hours, reprname, stdname, dstname):
             self.stdoffset = timedelta(hours=hours)
             self.reprname = reprname
             self.stdname = stdname
             self.dstname = dstname

         def __repr__(self):
             return self.reprname

         def tzname(self, dt):
             if self.dst(dt):
                 return self.dstname
             else:
                 return self.stdname

         def utcoffset(self, dt):
             return self.stdoffset + self.dst(dt)

         def dst(self, dt):
             if dt is None or dt.tzinfo is None:
                 # An exception may be sensible here, in one or both cases.
                 # It depends on how you want to treat them.  The default
                 # fromutc() implementation (called by the default astimezone()
                 # implementation) passes a datetime with dt.tzinfo is self.
                 return ZERO
             assert dt.tzinfo is self
             start, end = us_dst_range(dt.year)
             # Can't compare naive to aware objects, so strip the timezone from
             # dt first.
             dt = dt.replace(tzinfo=None)
             if start + HOUR <= dt < end - HOUR:
                 # DST is in effect.
                 return HOUR
             if end - HOUR <= dt < end:
                 # Fold (an ambiguous hour): use dt.fold to disambiguate.
                 return ZERO if dt.fold else HOUR
             if start <= dt < start + HOUR:
                 # Gap (a non-existent hour): reverse the fold rule.
                 return HOUR if dt.fold else ZERO
             # DST is off.
             return ZERO

         def fromutc(self, dt):
             assert dt.tzinfo is self
             start, end = us_dst_range(dt.year)
             start = start.replace(tzinfo=self)
             end = end.replace(tzinfo=self)
             std_time = dt + self.stdoffset
             dst_time = std_time + HOUR
             if end <= dst_time < end + HOUR:
                 # Repeated hour
                 return std_time.replace(fold=1)
             if std_time < start or dst_time >= end:
                 # Standard time
                 return std_time
             if start <= std_time < end - HOUR:
                 # Daylight saving time
                 return dst_time


     Eastern  = USTimeZone(-5, "Eastern",  "EST", "EDT")
     Central  = USTimeZone(-6, "Central",  "CST", "CDT")
     Mountain = USTimeZone(-7, "Mountain", "MST", "MDT")
     Pacific  = USTimeZone(-8, "Pacific",  "PST", "PDT")

標準時および夏時間の両方を記述している *note tzinfo: 7f6. のサブクラスで
は、夏時間の移行のときに、回避不能の難解な問題が年に 2 度あるので注意し
てください。 具体的な例として、東部アメリカ時刻 (US Eastern, UTC -0500)
を考えます。 EDT は 3 月の第二日曜日の 1:59 (EST) の 1 分後に開始し、11
月の最初の日曜日の (EDTの) 1:59 に終了します:

       UTC   3:MM  4:MM  5:MM  6:MM  7:MM  8:MM
       EST  22:MM 23:MM  0:MM  1:MM  2:MM  3:MM
       EDT  23:MM  0:MM  1:MM  2:MM  3:MM  4:MM

     start  22:MM 23:MM  0:MM  1:MM  3:MM  4:MM

       end  23:MM  0:MM  1:MM  1:MM  2:MM  3:MM

DSTの開始 ("start" ライン) で、ローカルの実時間は 1:59 から 3:00 に飛び
ます。 この日には、 2:MM という形式の実時間は意味をなさないので、 DST が
始まった日に ‘astimezone(Eastern)’ は ‘hour == 2’ となる結果を返すことは
ありません。 例として、 2016 年の春方向の移行では、次のような結果になり
ます:

     >>> from datetime import datetime, timezone
     >>> from tzinfo_examples import HOUR, Eastern
     >>> u0 = datetime(2016, 3, 13, 5, tzinfo=timezone.utc)
     >>> for i in range(4):
     ...     u = u0 + i*HOUR
     ...     t = u.astimezone(Eastern)
     ...     print(u.time(), 'UTC =', t.time(), t.tzname())
     ...
     05:00:00 UTC = 00:00:00 EST
     06:00:00 UTC = 01:00:00 EST
     07:00:00 UTC = 03:00:00 EDT
     08:00:00 UTC = 04:00:00 EDT

DST が終了 ("end" ライン) で、更なる問題が潜んでいます: ローカルの実時間
で、曖昧さ無しに時を綴れない 1 時間が存在します: それは夏時間の最後の 1
時間です。 東部では、夏時間が終了する日の UTC での 5:MM 形式の時間がそれ
です。 ローカルの実時間は (夏時間の) 1:59 から (標準時の) 1:00 に再び巻
き戻されます。 ローカルの時刻における 1:MM は曖昧です。 そして *note
astimezone(): bc4. は 2 つの隣り合う UTC 時間を同じローカルの時間に対応
付けて、ローカルの時計の振る舞いを真似ます。 東部の例では、 5:MM および
6:MM という形式の UTC 時刻は両方とも東部時刻に変換された際に 1:MM に対応
付けられますが、それ以前の時間は *note fold: e51. 属性を 0 にし、以降の
時間では 1 にします。例えば、 2016 年での秋方向の移行では、次のような結
果になります:

     >>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)
     >>> for i in range(4):
     ...     u = u0 + i*HOUR
     ...     t = u.astimezone(Eastern)
     ...     print(u.time(), 'UTC =', t.time(), t.tzname(), t.fold)
     ...
     04:00:00 UTC = 00:00:00 EDT 0
     05:00:00 UTC = 01:00:00 EDT 0
     06:00:00 UTC = 01:00:00 EST 1
     07:00:00 UTC = 02:00:00 EST 0

*note fold: e51. 属性が異なるだけの *note datetime: 4e2. インスタンスは
比較において等しいとみなされることに注意してください。

壁時間に関する曖昧さは、明示的に *note fold: e51. 属性を検証するか、
*note timezone: 12d5. が使用されたハイブリッドな *note tzinfo: 7f6. サブ
クラスか、そのほかの絶対時間差を示す *note tzinfo: 7f6. サブクラス(EST
(-5 時間の絶対時間差) のみを表すクラスや、 EDT (-4 時間の絶対時間差) の
みを表すクラス)を使用すると回避できます。 このような曖昧さを許容できない
アプリケーションは、このような手法によって回避すべきです。

参考
....

     *note zoneinfo: 13a.

          ‘datetime’ モジュールには (UTC からの任意の固定オフセットを扱
          う) 基本的な *note timezone: 12d5. クラスと、(UTC ‘timezone’ の
          インスタンスである) *note timezone.utc: 827. 属性があります。

          ‘zoneinfo’ は Python に 'IANA タイムゾーンデータベース' (オル
          ソンデータベースとしても知られています) を導入するもので、これ
          を使うことが推奨されています。

IANA タイムゾーンデータベース(1)

     (しばしば tz、tzdata や zoneinfo と呼ばれる) タイムゾーンデータベー
     スはコードとデータを保持しており、それらは地球全体にわたる多くの代
     表的な場所のローカル時刻の履歴を表しています。政治団体によるタイム
     ゾーンの境界、UTC オフセット、夏時間のルールの変更を反映するため、
     定期的にデータベースが更新されます。

   ---------- Footnotes ----------

   (1) https://www.iana.org/time-zones


File: python.info,  Node: timezone objects,  Next: strftime and strptime behavior,  Prev: tzinfo objects,  Up: datetime --- 基本的な日付と時間の型

5.8.1.15 ‘timezone’ objects
...........................

*note timezone: 12d5. クラスは *note tzinfo: 7f6. のサブクラスで、各イン
スタンスは UTC からの固定されたオフセットで定義されたタイムゾーンを表し
ています。

このクラスのオブジェクトは、一年のうち異なる日に異なるオフセットが使われ
ていたり、常用時 (civil time) に歴史的な変化が起きた場所のタイムゾーン情
報を表すのには使えないので注意してください。

 -- クラス: datetime.timezone (offset, name=None)

     ローカル時刻と UTC の差分を表す *note timedelta: bc3. オブジェクト
     を 'offset' 引数に指定しなくてはいけません。これは
     ‘-timedelta(hours=24)’ から ‘timedelta(hours=24)’ までの両端を含ま
     ない範囲に収まっていなくてはなりません。そうでない場合 *note
     ValueError: 2ec. が送出されます。

     'name' 引数は必須ではありません。もし指定された場合、その値は *note
     datetime.tzname(): 28d4. メソッドの返り値として使われる文字列でなけ
     ればなりません。

     Added in version 3.2.

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: timezone.utcoffset (dt)

     *note timezone: 12d5. インスタンスが構築されたときに指定された固定
     値を返します。

     'dt' 引数は無視されます。 返り値は、ローカル時刻と UTC の差分に等し
     い *note timedelta: bc3. インスタンスです。

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

 -- メソッド: timezone.tzname (dt)

     *note timezone: 12d5. インスタンスが構築されたときに指定された固定
     値を返します。

     'name' が構築時に与えられなかった場合、 ‘tzname(dt)’ によって返され
     る name は以下の様に ‘offset’ の値から生成されます。 'offset' が
     ‘timedelta(0)’ であった場合、 name は "UTC"になります。 それ以外の
     場合、 'UTC±HH:MM' という書式の文字列になり、± は ‘offset’ を、HH と
     MM はそれぞれ二桁の ‘offset.hours’ と ‘offset.minutes’ を表現します
     。

     バージョン 3.6 で変更: ‘offset=timedelta(0)’ によって生成される名前
     はプレーンな ‘'UTC'’ であり ‘'UTC+00:00'’ ではありません。

 -- メソッド: timezone.dst (dt)

     常に ‘None’ を返します。

 -- メソッド: timezone.fromutc (dt)

     ‘dt + offset’ を返します。 'dt' 引数は ‘tzinfo’ が ‘self’ になって
     いる aware な *note datetime: 4e2. インスタンスでなければなりません
     。

以下にクラス属性を示します:

 -- の属性: timezone.utc

     UTC タイムゾーン ‘timezone(timedelta(0))’ です。


File: python.info,  Node: strftime and strptime behavior,  Prev: timezone objects,  Up: datetime --- 基本的な日付と時間の型

5.8.1.16 ‘strftime()’ and ‘strptime()’ behavior
...............................................

*note date: 1fa, *note datetime: 4e2, *note time: 1fb. オブジェクトは全
て ‘strftime(format)’ メソッドをサポートし、時刻を表現する文字列を明示的
な書式文字列で統制して作成しています。

Conversely, the *note date.strptime(): 1f9, *note datetime.strptime():
1950. and *note time.strptime(): 1646. class methods create an object
from a string representing the time and a corresponding format string.

下の表は *note strftime(): e8e. と *note strptime(): 1950. との高レベル
の対比を表しています。

                     ‘strftime’                                                   ‘strptime’
                                                                                  
---------------------------------------------------------------------------------------------------------------------------------------------------
                                                                                  
使用法               オブジェクトを与えられた書式に従って文字列に変換する         Parse a string into an object given a corresponding format
                                                                                  
                                                                                  
メソッドの種類       インスタンスメソッド                                         クラスメソッド
                                                                                  
                                                                                  
シグネチャ           ‘strftime(format)’                                           ‘strptime(date_string, format)’
                                                                                  

* Menu:

* strftime() and strptime() format codes: strftime and strptime format codes.
* Technical detail::


File: python.info,  Node: strftime and strptime format codes,  Next: Technical detail,  Up: strftime and strptime behavior

5.8.1.17 ‘strftime()’ and ‘strptime()’ format codes
...................................................

These methods accept format codes that can be used to parse and format
dates:

     >>> datetime.strptime('31/01/22 23:59:59.999999',
     ...                   '%d/%m/%y %H:%M:%S.%f')
     datetime.datetime(2022, 1, 31, 23, 59, 59, 999999)
     >>> _.strftime('%a %d %b %Y, %I:%M%p')
     'Mon 31 Jan 2022, 11:59PM'

以下のリストは 1989 C 標準が要求する全ての書式コードで、標準 C 実装があ
れば全ての環境で動作します。

ディレクティ    意味                                 使用例                       注釈
ブ                                                                                

----------------------------------------------------------------------------------------------
                                                                                  
‘%a’            ロケールの曜日名を短縮形で表示しま        Sun, Mon, ..., Sat (en_US);(1)
                す。                                      So, Mo, ..., Sa (de_DE) 
                                                     
                                                                                  
‘%A’            ロケールの曜日名を表示します。            Sunday, Monday, ..., Saturday (en_US);(1)
                                                          Sonntag, Montag, ..., Samstag (de_DE)
                                                     
                                                                                  
‘%w’            曜日を10進表記した文字列を表示しま   0, 1, ..., 6
                す。0 が日曜日で、6 が土曜日を表し   
                ます。
                
                                                                                  
‘%d’            0埋めした10進数で表記した月中の日    01, 02, ..., 31              (9)
                にち。                                                            
                
                                                                                  
‘%b’            ロケールの月名を短縮形で表示します        Jan, Feb, ..., Dec (en_US);(1)
                。                                        Jan, Feb, ..., Dez (de_DE)
                                                     
                                                                                  
‘%B’            ロケールの月名を表示します。              January, February, ..., December (en_US);(1)
                                                          Januar, Februar, ..., Dezember (de_DE)
                                                     
                                                                                  
‘%m’            0埋めした10進数で表記した月。        01, 02, ..., 12              (9)
                                                                                  
                                                                                  
‘%y’            0埋めした10進数で表記した世紀無し    00, 01, ..., 99              (9)
                の年。                                                            
                
                                                                                  
‘%Y’            西暦 ( 4桁) の 10 進表記を表します   0001, 0002, ..., 2013,       (2)
                。                                   2014, ..., 9998, 9999        
                                                     
                                                                                  
‘%H’            0埋めした10進数で表記した時 (24時    00, 01, ..., 23              (9)
                間表記)。                                                         
                
                                                                                  
‘%I’            0埋めした10進数で表記した時 (12時    01, 02, ..., 12              (9)
                間表記)。                                                         
                
                                                                                  
‘%p’            ロケールの AM もしくは PM と等価な        AM, PM (en_US);         (1), (3)
                文字列になります。                        am, pm (de_DE)          
                                                     
                                                                                  
‘%M’            0埋めした10進数で表記した分。        00, 01, ..., 59              (9)
                                                                                  
                                                                                  
‘%S’            0埋めした10進数で表記した秒。        00, 01, ..., 59              (4), (9)
                                                                                  
                                                                                  
‘%f’            10進数で表記したマイクロ秒 (6桁に    000000, 000001, ...,         (5)
                0埋めされます)。                     999999                       
                                                     
                                                                                  
‘%z’            UTCオフセットを                      (空文字列), +0000, -0400,    (6)
                ‘±HHMM[SS[.ffffff]]’ の形式で表示    +1030, +063415,              
                します (オブジェクトがnaiveであれ    -030712.345216
                ば空文字列)。                        
                
                                                                                  
‘%Z’            タイムゾーンの名前を表示します (オ   (空文字列), UTC, GMT         (6)
                ブジェクトがnaiveであれば空文字列                                 
                )。
                
                                                                                  
‘%j’            0埋めした10進数で表記した年中の日    001, 002, ..., 366           (9)
                にち。                                                            
                
                                                                                  
‘%U’            0埋めした10進数で表記した年中の週    00, 01, ..., 53              (7), (9)
                番号 (週の始まりは日曜日とする)。                                 
                新年の最初の日曜日に先立つ日は 0週
                に属するとします。
                
                                                                                  
‘%W’            0埋めした10進数で表記した年中の週    00, 01, ..., 53              (7), (9)
                番号 (週の始まりは月曜日とする)。                                 
                新年の最初の月曜日に先立つ日は 0週
                に属するとします。
                
                                                                                  
‘%c’            ロケールの日時を適切な形式で表しま        Tue Aug 16 21:30:00 1988 (en_US);(1)
                す。                                      Di 16 Aug 21:30:00 1988 (de_DE)
                                                     
                                                                                  
‘%x’            ロケールの日付を適切な形式で表しま        08/16/88 (None);        (1)
                す。                                      08/16/1988 (en_US);     
                                                          16.08.1988 (de_DE)
                                                     
                                                                                  
‘%X’            ロケールの時間を適切な形式で表しま        21:30:00 (en_US);       (1)
                す。                                      21:30:00 (de_DE)        
                                                     
                                                                                  
‘%%’            文字 ‘'%'’ を表します。              %
                                                     

C89規格により要求されない幾つかの追加のコードが便宜上含まれています。こ
れらのパラメータはすべてISO 8601の日付値に対応しています。

ディレクティ    意味                                 使用例                       注釈
ブ                                                                                

----------------------------------------------------------------------------------------------
                                                                                  
‘%G’            ISO week(‘%V’)の内過半数を含む西暦   0001, 0002, ..., 2013,       (8)
                表記の ISO 8601 year です。          2014, ..., 9998, 9999        
                                                     
                                                                                  
‘%u’            1 を月曜日を表す 10進数表記の ISO    1, 2, ..., 7
                8601 weekday です。                  
                
                                                                                  
‘%V’            週で最初の月曜日を始めとする ISO     01, 02, ..., 53              (8), (9)
                8601 week です。Week 01 は 1月4日                                 
                を含みます。
                
                                                                                  
‘%:z’           UTCオフセットを                      (空文字列), +00:00,          (6)
                ‘±HH:MM[:SS[.ffffff]]’ の形式で表    -04:00, +10:30, +06:34:15,   
                示します (オブジェクトがnaiveであ    -03:07:12.345216
                れば空文字列)。                      
                

これらが *note strftime(): e8e. メソッドと一緒に使用された場合、すべての
プラットフォームで利用できるわけではありません。 ISO 8601 year 指定子お
よびISO 8601 week 指定子は、上記のyear および week number 指定子と互換性
がありません。不完全またはあいまいなISO 8601 指定子で *note strptime():
1950. を呼び出すと、 *note ValueError: 2ec. が送出されます。

Python はプラットフォームの C ライブラリの ‘strftime()’ 関数を呼び出して
いて、プラットフォームごとにその実装が異なるのはよくあることなので、サポ
ートされる書式コード全体はプラットフォームごとに様々です。 手元のプラッ
トフォームでサポートされているフォーマット記号全体を見るには、
‘strftime(3)(1)’ のドキュメントを参照してください。 サポートされていない
フォーマット指定子の扱いもプラットフォーム間で差異があります。

Added in version 3.6: ‘%G’, ‘%u’ および ‘%V’ が追加されました。

Added in version 3.12: ‘%:z’ が追加されました。

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/strftime(3)


File: python.info,  Node: Technical detail,  Prev: strftime and strptime format codes,  Up: strftime and strptime behavior

5.8.1.18 Technical detail
.........................

大雑把にいうと、 ‘d.strftime(fmt)’ は *note time: f4. モジュールの
‘time.strftime(fmt, d.timetuple())’ のように動作します。ただし全てのオブ
ジェクトが *note timetuple(): 28be. メソッドをサポートしているわけではあ
りません。

For the *note datetime.strptime(): 1950. and *note date.strptime(): 1f9.
class methods, the default value is ‘1900-01-01T00:00:00.000’: any
components not specified in the format string will be pulled from the
default value.

     注釈: Format strings without separators can be ambiguous for
     parsing.  For example, with ‘%Y%m%d’, the string ‘2026111’ may be
     parsed either as ‘2026-11-01’ or as ‘2026-01-11’.  Use separators
     to ensure the input is parsed as intended.

     注釈: When used to parse partial dates lacking a year, *note
     datetime.strptime(): 1950. and *note date.strptime(): 1f9. will
     raise when encountering February 29 because the default year of
     1900 is 'not' a leap year.  Always add a default leap year to
     partial date strings before parsing.

     >>> from datetime import datetime
     >>> value = "2/29"
     >>> datetime.strptime(value, "%m/%d")
     Traceback (most recent call last):
     ...
     ValueError: day 29 must be in range 1..28 for month 2 in year 1900
     >>> datetime.strptime(f"1904 {value}", "%Y %m/%d")
     datetime.datetime(1904, 2, 29, 0, 0)

‘datetime.strptime(date_string, format)’ は次の式と等価です:

     datetime(*(time.strptime(date_string, format)[0:6]))

ただし、 ‘datetime.strptime’ はサポートしているが ‘time.strptime’ には無
い、秒未満の単位やタイムゾーンオフセットの情報が format に 含まれている
ときは除きます。

*note time: 1fb. オブジェクトには、年、月、日の値がないため、それらを書
式コードを使うことができません。 無理矢理使った場合、年は1900に置き換え
られ、月と日は1に置き換えられます。

*note date: 1fa. オブジェクトには、時、分、秒、マイクロ秒の値がないため
、それらの書式コードを使うことができません。 無理矢理使った場合、これら
の値は0に置き換えられます。

同じ理由で、現在のロケールの文字集合で表現できない Unicode コードポイン
トを含む書式文字列の対処もプラットフォーム依存です。 あるプラットフォー
ムではそういったコードポイントはそのまま出力に出される一方、他のプラット
フォームでは ‘strftime’ が *note UnicodeError: 462. を送出したり、その代
わりに空文字列を返したりするかもしれません。

注釈:

  1. Because the format depends on the current locale, care should be
     taken when making assumptions about the output value.  Field
     orderings will vary (for example, "month/day/year" versus
     "day/month/year"), and the output may contain non-ASCII characters.

  2. *note strptime(): 1950. メソッドは [1, 9999] の範囲の年数全てを構文
     解析できますが、 year < 1000 の範囲の年数は 0 埋めされた 4 桁の数字
     でなければなりません。

     バージョン 3.2 で変更: 以前のバージョンでは、 *note strftime():
     e8e. メソッドは years >= 1900 の範囲の年数しか扱えませんでした。

     バージョン 3.3 で変更: バージョン 3.2 では、 *note strftime(): e8e.
     メソッドは years >= 1000 の範囲の年数しか扱えませんでした。

  3. *note strptime(): 1950. メソッドと共に使われた場合、 ‘%p’ 指定子は
     出力の時間フィールドのみに影響し、 ‘%I’ 指定子が使われたかのように
     振る舞います。

  4. *note time: f4. モジュールと違い、 ‘datetime’ モジュールはうるう秒
     をサポートしていません。

  5. *note strptime(): 1950. メソッドと共に使われた場合、 ‘%f’ 指定子は
     1 桁から 6 桁の数字を受け付け、右側から0埋めされます。 ‘%f’ は C 標
     準規格の書式文字セットの拡張です (とは言え、 datetime モジュールの
     オブジェクトそれぞれに実装されているので、どれででも使えます)。

  6. naive オブジェクトでは、書式コード ‘%z’、‘%:z’ および ‘%Z’ は空文字
     列に置き換えられます。

     aware オブジェクトでは次のようになります:

     ‘%z’

          *note utcoffset(): 28d1. は ‘±HHMM[SS[.ffffff]]’ 形式の文字列
          に変換されます。ここで、 ‘HH’ は UTC オフセットの時間を表す 2
          桁の文字列、 ‘MM’ は UTC オフセットの分数を表す 2 桁の文字列、
          ‘SS’ は UTC オフセットの秒数を表す 2 桁の文字列、 ‘ffffff’ は
          UTC オフセットのマイクロ秒数を表す 6 桁の文字列です。 オフセッ
          トに秒未満の端数が無いときは ‘ffffff’ 部分は省略され、オフセッ
          トに分未満の端数が無いときは ‘ffffff’ 部分も ‘SS’ 部分も省略さ
          れます。 例えば、 *note utcoffset(): 28d1. が
          ‘timedelta(hours=-3, minutes=-30)’ を返す場合、 ‘%z’ は文字列
          ‘'-0330'’ に置き換えられます。

     バージョン 3.7 で変更: UTC オフセットが分単位でなければならない制限
     が無くなりました。

     バージョン 3.7 で変更: ‘%z’ 指定子が *note strptime(): 1950. メソッ
     ドに渡されたときは、時分秒のセパレータとしてコロンが UTC オフセット
     で使えます。 例えば、 ‘'+01:00:00'’ は 1 時間のオフセットだと構文解
     析されます。 加えて、 ‘'Z'’ を渡すことは ‘'+00:00'’ を渡すことと同
     等です。

     ‘%:z’

          Behaves exactly as ‘%z’, but has a colon separator added
          between hours, minutes and seconds.

     ‘%Z’

          In *note strftime(): e8e, ‘%Z’ is replaced by an empty string
          if *note tzname(): 28d4. returns ‘None’; otherwise ‘%Z’ is
          replaced by the returned value, which must be a string.

          *note strptime(): 1950. は ‘%Z’ に特定の値のみを受け入れます:

            1. 使用しているマシンのロケールによる ‘time.tzname’ の任意の
               値

            2. ハードコードされた値 ‘UTC’ または ‘GMT’

          つまり、日本に住んでいる場合は ‘JST’, ‘UTC’ と ‘GMT’ が有効な
          値であり、 ‘EST’ はおそらく無効な値となります。無効な値の場合
          は ‘ValueError’ を送出します。

     バージョン 3.2 で変更: ‘%z’ 指定子が *note strptime(): 1950. メソッ
     ドに与えられた場合、 aware な *note datetime: 4e2. オブジェクトが作
     成されます。返り値の ‘tzinfo’ は *note timezone: 12d5. インスタンス
     になっています。

  7. *note strptime(): 1950. メソッドと共に使われた場合、 ‘%U’ と ‘%W’ 指
     定子は、曜日と年(‘%Y’)が指定された場合の計算でのみ使われます。

  8. ‘%U’ および ‘%W’ と同様に、 ‘%V’ は曜日と ISO 年 (‘%G’) が *note
     strptime(): 1950. の書式文字列の中で指定された場合に計算でのみ使わ
     れます。 ‘%G’ と ‘%Y’ は互いに完全な互換性を持たないことにも注意し
     てください。

  9. *note strptime(): 1950. メソッドと共に使われるとき、書式 ‘%d’,
     ‘%m’, ‘%H’, ‘%I’, ‘%M’, ‘%S’, ‘%j’, ‘%U’, ‘%W’, ‘%V’ では先行ゼロは
     任意です。 書式 ‘%y’ では先行ゼロは必須です。

  10. When parsing a month and day using *note strptime(): 1950, always
     include a year in the format.  If the value you need to parse lacks
     a year, append an explicit dummy leap year.  Otherwise your code
     will raise an exception when it encounters leap day because the
     default year used by the parser (1900) is not a leap year.  Users
     run into that bug every leap year.

          >>> month_day = "02/29"
          >>> datetime.strptime(f"{month_day};1984", "%m/%d;%Y")  # No leap year bug.
          datetime.datetime(1984, 2, 29, 0, 0)

     Deprecated since version 3.13, will be removed in version 3.15:
     *note strptime(): 1950. calls using a format string containing a
     day of month without a year now emit a *note DeprecationWarning:
     1a3.  In 3.15 or later we may change this into an error or change
     the default year to a leap year.  See gh-70647(1).

脚注
....

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/70647


File: python.info,  Node: zoneinfo --- IANA タイムゾーンのサポート,  Next: calendar --- 一般的なカレンダーに関係する機能群,  Prev: datetime --- 基本的な日付と時間の型,  Up: データ型

5.8.2 ‘zoneinfo’ -- IANA タイムゾーンのサポート
-----------------------------------------------

Added in version 3.9.

'ソースコード:' Lib/zoneinfo(1)

__________________________________________________________________

The ‘zoneinfo’ module provides a concrete time zone implementation to
support the IANA time zone database as originally specified in PEP
615(2).  By default, ‘zoneinfo’ uses the system's time zone data if
available; if no system time zone data is available, the library will
fall back to using the first-party tzdata(3) package available on PyPI.

参考
....

モジュール: *note datetime: 34.

     *note ZoneInfo: adc. クラスを使用するように設計されたデータ型 *note
     time: 1fb. と *note datetime: 4e2. を提供します。

tzdata(4) パッケージ

     CPythonコアデベロッパーによってメンテナンスされているファーストパー
     ティーのパッケージ。タイムゾーンデータを供給し、PyPIで配布されてい
     る。

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

* Menu:

* ZoneInfo を使用する::
* データソース::
* ZoneInfo クラス::
* 関数: 関数<3>.
* Globals::
* 例外と警告::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/zoneinfo

   (2) https://peps.python.org/pep-0615/

   (3) https://pypi.org/project/tzdata/

   (4) https://pypi.org/project/tzdata/


File: python.info,  Node: ZoneInfo を使用する,  Next: データソース,  Up: zoneinfo --- IANA タイムゾーンのサポート

5.8.2.1 ‘ZoneInfo’ を使用する
.............................

*note ZoneInfo: adc. は *note datetime.tzinfo: 7f6. 抽象基底クラスの具体
的な実装であり、‘tzinfo’ に指定することを想定しています。コンストラクタ
、*note datetime.replace: 16e4. メソッド、*note datetime.astimezone:
bc4. メソッドのいずれかで指定します。

     >>> from zoneinfo import ZoneInfo
     >>> from datetime import datetime, timedelta

     >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
     >>> print(dt)
     2020-10-31 12:00:00-07:00

     >>> dt.tzname()
     'PDT'

Datetimes constructed in this way are compatible with datetime
arithmetic and handle daylight saving time transitions with no further
intervention:

     >>> dt_add = dt + timedelta(days=1)

     >>> print(dt_add)
     2020-11-01 12:00:00-08:00

     >>> dt_add.tzname()
     'PST'

These time zones also support the *note fold: e51. attribute introduced
in PEP 495(1).  During offset transitions which induce ambiguous times
(such as a daylight saving time to standard time transition), the offset
from 'before' the transition is used when ‘fold=0’, and the offset
'after' the transition is used when ‘fold=1’, for example:

     >>> dt = datetime(2020, 11, 1, 1, tzinfo=ZoneInfo("America/Los_Angeles"))
     >>> print(dt)
     2020-11-01 01:00:00-07:00

     >>> print(dt.replace(fold=1))
     2020-11-01 01:00:00-08:00

When converting from another time zone, the fold will be set to the
correct value:

     >>> from datetime import timezone
     >>> LOS_ANGELES = ZoneInfo("America/Los_Angeles")
     >>> dt_utc = datetime(2020, 11, 1, 8, tzinfo=timezone.utc)

     >>> # Before the PDT -> PST transition
     >>> print(dt_utc.astimezone(LOS_ANGELES))
     2020-11-01 01:00:00-07:00

     >>> # After the PDT -> PST transition
     >>> print((dt_utc + timedelta(hours=1)).astimezone(LOS_ANGELES))
     2020-11-01 01:00:00-08:00

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0495/


File: python.info,  Node: データソース,  Next: ZoneInfo クラス,  Prev: ZoneInfo を使用する,  Up: zoneinfo --- IANA タイムゾーンのサポート

5.8.2.2 データソース
....................

The ‘zoneinfo’ module does not directly provide time zone data, and
instead pulls time zone information from the system time zone database
or the first-party PyPI package tzdata(1), if available.  Some systems,
including notably Windows systems, do not have an IANA database
available, and so for projects targeting cross-platform compatibility
that require time zone data, it is recommended to declare a dependency
on tzdata.  If neither system data nor tzdata are available, all calls
to *note ZoneInfo: adc. will raise *note ZoneInfoNotFoundError: 1816.

* Menu:

* Configuring the data sources::

   ---------- Footnotes ----------

   (1) https://pypi.org/project/tzdata/


File: python.info,  Node: Configuring the data sources,  Up: データソース

5.8.2.3 Configuring the data sources
....................................

When ‘ZoneInfo(key)’ is called, the constructor first searches the
directories specified in *note TZPATH: 2166. for a file matching ‘key’,
and on failure looks for a match in the tzdata package.  This behavior
can be configured in three ways:

  1. The default *note TZPATH: 2166. when not otherwise specified can be
     configured at *note compile time: 2167.

  2. *note TZPATH: 2166. can be configured using *note an environment
     variable: 2900.

  3. At *note runtime: 2901, the search path can be manipulated using
     the *note reset_tzpath(): 17c0. function.

* Menu:

* Compile-time configuration::
* Environment configuration::
* Runtime configuration::


File: python.info,  Node: Compile-time configuration,  Next: Environment configuration,  Up: Configuring the data sources

5.8.2.4 Compile-time configuration
..................................

The default *note TZPATH: 2166. includes several common deployment
locations for the time zone database (except on Windows, where there are
no "well-known" locations for time zone data).  On POSIX systems,
downstream distributors and those building Python from source who know
where their system time zone data is deployed may change the default
time zone path by specifying the compile-time option ‘TZPATH’ (or, more
likely, the *note configure flag -with-tzpath: 2165.), which should be a
string delimited by *note os.pathsep: 2134.

On all platforms, the configured value is available as the ‘TZPATH’ key
in *note sysconfig.get_config_var(): 174.


File: python.info,  Node: Environment configuration,  Next: Runtime configuration,  Prev: Compile-time configuration,  Up: Configuring the data sources

5.8.2.5 Environment configuration
.................................

When initializing *note TZPATH: 2166. (either at import time or whenever
*note reset_tzpath(): 17c0. is called with no arguments), the ‘zoneinfo’
module will use the environment variable ‘PYTHONTZPATH’, if it exists,
to set the search path.

 -- 環境変数: PYTHONTZPATH

     This is an *note os.pathsep: 2134.-separated string containing the
     time zone search path to use.  It must consist of only absolute
     rather than relative paths.  Relative components specified in
     ‘PYTHONTZPATH’ will not be used, but otherwise the behavior when a
     relative path is specified is implementation-defined; CPython will
     raise *note InvalidTZPathWarning: 2905, but other implementations
     are free to silently ignore the erroneous component or raise an
     exception.

To set the system to ignore the system data and use the tzdata package
instead, set ‘PYTHONTZPATH=""’.


File: python.info,  Node: Runtime configuration,  Prev: Environment configuration,  Up: Configuring the data sources

5.8.2.6 Runtime configuration
.............................

The TZ search path can also be configured at runtime using the *note
reset_tzpath(): 17c0. function.  This is generally not an advisable
operation, though it is reasonable to use it in test functions that
require the use of a specific time zone path (or require disabling
access to the system time zones).


File: python.info,  Node: ZoneInfo クラス,  Next: 関数<3>,  Prev: データソース,  Up: zoneinfo --- IANA タイムゾーンのサポート

5.8.2.7 ‘ZoneInfo’ クラス
.........................

 -- クラス: zoneinfo.ZoneInfo (key)

     文字列 ‘key’ でIANAタイムゾーンを指定した、具体的な *note
     datetime.tzinfo: 7f6. のサブクラス。Calls to the primary
     constructor will always return objects that compare identically;
     put another way, barring cache invalidation via *note
     ZoneInfo.clear_cache(): 2908, for all values of ‘key’, the
     following assertion will always be true:

          a = ZoneInfo(key)
          b = ZoneInfo(key)
          assert a is b

     ‘key’ must be in the form of a relative, normalized POSIX path,
     with no up-level references.  The constructor will raise *note
     ValueError: 2ec. if a non-conforming key is passed.

     ‘key’ に一致するファイルが見つからない場合、コンストラクタは *note
     ZoneInfoNotFoundError: 1816. を送出します。

‘ZoneInfo’ クラスには2つの別のコンストラクターがあります:

 -- メソッド: classmethod ZoneInfo.from_file (file_obj, /, key=None)

     file-like オブジェクトが返すbytes（バイナリーモードで開いたファイル
     や *note io.BytesIO: 10a4. オブジェクト）から ‘ZoneInfo’ オブジェク
     トを構築します。一次コンストラクタと異なり、常に新規オブジェクトを
     構築します。

     The ‘key’ parameter sets the name of the zone for the purposes of
     *note __str__(): 830. and *note __repr__(): 82f.

     このコンストラクタで生成したオブジェクトはpickle化できません（*note
     pickling: 2909. を参照）。

     *note ValueError: 2ec. is raised if the data read from 'file_obj'
     is not a valid TZif file.

 -- メソッド: classmethod ZoneInfo.no_cache (key)

     An alternate constructor that bypasses the constructor's cache.  It
     is identical to the primary constructor, but returns a new object
     on each call.  This is most likely to be useful for testing or
     demonstration purposes, but it can also be used to create a system
     with a different cache invalidation strategy.

     Objects created via this constructor will also bypass the cache of
     a deserializing process when unpickled.

          注意: Using this constructor may change the semantics of your
          datetimes in surprising ways, only use it if you know that you
          need to.

次のクラスメソッドもサポートされています:

 -- メソッド: classmethod ZoneInfo.clear_cache (*, only_keys=None)

     A method for invalidating the cache on the ‘ZoneInfo’ class.  If no
     arguments are passed, all caches are invalidated and the next call
     to the primary constructor for each key will return a new instance.

     If an iterable of key names is passed to the ‘only_keys’ parameter,
     only the specified keys will be removed from the cache.  Keys
     passed to ‘only_keys’ but not found in the cache are ignored.

          警告: Invoking this function may change the semantics of
          datetimes using ‘ZoneInfo’ in surprising ways; this modifies
          module state and thus may have wide-ranging effects.  Only use
          it if you know that you need to.

The class has one attribute:

 -- の属性: ZoneInfo.key

     This is a read-only *note attribute: 290c. that returns the value
     of ‘key’ passed to the constructor, which should be a lookup key in
     the IANA time zone database (e.g.  ‘America/New_York’,
     ‘Europe/Paris’ or ‘Asia/Tokyo’).

     For zones constructed from file without specifying a ‘key’
     parameter, this will be set to ‘None’.

          注釈: Although it is a somewhat common practice to expose
          these to end users, these values are designed to be primary
          keys for representing the relevant zones and not necessarily
          user-facing elements.  Projects like CLDR (the Unicode Common
          Locale Data Repository) can be used to get more user-friendly
          strings from these keys.

* Menu:

* 文字列表現::
* Pickle serialization::


File: python.info,  Node: 文字列表現,  Next: Pickle serialization,  Up: ZoneInfo クラス

5.8.2.8 文字列表現
..................

The string representation returned when calling *note str: 169. on a
*note ZoneInfo: adc. object defaults to using the *note ZoneInfo.key:
290b. attribute (see the note on usage in the attribute documentation):

     >>> zone = ZoneInfo("Pacific/Kwajalein")
     >>> str(zone)
     'Pacific/Kwajalein'

     >>> dt = datetime(2020, 4, 1, 3, 15, tzinfo=zone)
     >>> f"{dt.isoformat()} [{dt.tzinfo}]"
     '2020-04-01T03:15:00+12:00 [Pacific/Kwajalein]'

For objects constructed from a file without specifying a ‘key’
parameter, ‘str’ falls back to calling *note repr(): 1c1.  ‘ZoneInfo’'s
‘repr’ is implementation-defined and not necessarily stable between
versions, but it is guaranteed not to be a valid ‘ZoneInfo’ key.


File: python.info,  Node: Pickle serialization,  Prev: 文字列表現,  Up: ZoneInfo クラス

5.8.2.9 Pickle serialization
............................

Rather than serializing all transition data, ‘ZoneInfo’ objects are
serialized by key, and ‘ZoneInfo’ objects constructed from files (even
those with a value for ‘key’ specified) cannot be pickled.

The behavior of a ‘ZoneInfo’ file depends on how it was constructed:

  1. ‘ZoneInfo(key)’: When constructed with the primary constructor, a
     ‘ZoneInfo’ object is serialized by key, and when deserialized, the
     deserializing process uses the primary and thus it is expected that
     these are the same object as other references to the same time
     zone.  For example, if ‘europe_berlin_pkl’ is a string containing a
     pickle constructed from ‘ZoneInfo("Europe/Berlin")’, one would
     expect the following behavior:

          >>> a = ZoneInfo("Europe/Berlin")
          >>> b = pickle.loads(europe_berlin_pkl)
          >>> a is b
          True

  2. ‘ZoneInfo.no_cache(key)’: When constructed from the cache-bypassing
     constructor, the ‘ZoneInfo’ object is also serialized by key, but
     when deserialized, the deserializing process uses the cache
     bypassing constructor.  If ‘europe_berlin_pkl_nc’ is a string
     containing a pickle constructed from
     ‘ZoneInfo.no_cache("Europe/Berlin")’, one would expect the
     following behavior:

          >>> a = ZoneInfo("Europe/Berlin")
          >>> b = pickle.loads(europe_berlin_pkl_nc)
          >>> a is b
          False

  3. ‘ZoneInfo.from_file(file_obj, /, key=None)’: When constructed from
     a file, the ‘ZoneInfo’ object raises an exception on pickling.  If
     an end user wants to pickle a ‘ZoneInfo’ constructed from a file,
     it is recommended that they use a wrapper type or a custom
     serialization function: either serializing by key or storing the
     contents of the file object and serializing that.

This method of serialization requires that the time zone data for the
required key be available on both the serializing and deserializing
side, similar to the way that references to classes and functions are
expected to exist in both the serializing and deserializing
environments.  It also means that no guarantees are made about the
consistency of results when unpickling a ‘ZoneInfo’ pickled in an
environment with a different version of the time zone data.


File: python.info,  Node: 関数<3>,  Next: Globals,  Prev: ZoneInfo クラス,  Up: zoneinfo --- IANA タイムゾーンのサポート

5.8.2.10 関数
.............

 -- の関数: zoneinfo.available_timezones ()

     Get a set containing all the valid keys for IANA time zones
     available anywhere on the time zone path.  This is recalculated on
     every call to the function.

     This function only includes canonical zone names and does not
     include "special" zones such as those under the ‘posix/’ and
     ‘right/’ directories, or the ‘posixrules’ zone.

          注意: This function may open a large number of files, as the
          best way to determine if a file on the time zone path is a
          valid time zone is to read the "magic string" at the
          beginning.

          注釈: These values are not designed to be exposed to
          end-users; for user facing elements, applications should use
          something like CLDR (the Unicode Common Locale Data
          Repository) to get more user-friendly strings.  See also the
          cautionary note on *note ZoneInfo.key: 290b.

 -- の関数: zoneinfo.reset_tzpath (to=None)

     Sets or resets the time zone search path (*note TZPATH: 2166.) for
     the module.  When called with no arguments, *note TZPATH: 2166. is
     set to the default value.

     Calling ‘reset_tzpath’ will not invalidate the *note ZoneInfo: adc.
     cache, and so calls to the primary ‘ZoneInfo’ constructor will only
     use the new ‘TZPATH’ in the case of a cache miss.

     The ‘to’ parameter must be a *note sequence: 716. of strings or
     *note os.PathLike: e4b. and not a string, all of which must be
     absolute paths.  *note ValueError: 2ec. will be raised if something
     other than an absolute path is passed.


File: python.info,  Node: Globals,  Next: 例外と警告,  Prev: 関数<3>,  Up: zoneinfo --- IANA タイムゾーンのサポート

5.8.2.11 Globals
................

 -- データ: zoneinfo.TZPATH

     A read-only sequence representing the time zone search path - when
     constructing a ‘ZoneInfo’ from a key, the key is joined to each
     entry in the ‘TZPATH’, and the first file found is used.

     ‘TZPATH’ may contain only absolute paths, never relative paths,
     regardless of how it is configured.

     The object that ‘zoneinfo.TZPATH’ points to may change in response
     to a call to *note reset_tzpath(): 17c0, so it is recommended to
     use ‘zoneinfo.TZPATH’ rather than importing ‘TZPATH’ from
     ‘zoneinfo’ or assigning a long-lived variable to ‘zoneinfo.TZPATH’.

     For more information on configuring the time zone search path, see
     *note Configuring the data sources: 28ff.


File: python.info,  Node: 例外と警告,  Prev: Globals,  Up: zoneinfo --- IANA タイムゾーンのサポート

5.8.2.12 例外と警告
...................

 -- 例外: zoneinfo.ZoneInfoNotFoundError

     Raised when construction of a *note ZoneInfo: adc. object fails
     because the specified key could not be found on the system.  This
     is a subclass of *note KeyError: 5e7.

 -- 例外: zoneinfo.InvalidTZPathWarning

     Raised when *note PYTHONTZPATH: 2904. contains an invalid component
     that will be filtered out, such as a relative path.


File: python.info,  Node: calendar --- 一般的なカレンダーに関係する機能群,  Next: collections --- コンテナデータ型,  Prev: zoneinfo --- IANA タイムゾーンのサポート,  Up: データ型

5.8.3 ‘calendar’ -- 一般的なカレンダーに関係する機能群
------------------------------------------------------

'ソースコード:' Lib/calendar.py(1)

__________________________________________________________________

このモジュールは Unix の ‘cal’ プログラムのようなカレンダー出力を行い、
それに加えてカレンダーに関する有益な関数群を提供します。標準ではこれらの
カレンダーは（ヨーロッパの慣例に従って）月曜日を週の始まりとし、日曜日を
最後の日としています。 *note setfirstweekday(): 2915. を用いることで、日
曜日(6)や他の曜日を週の始まりに設定することができます。日付を表す引数は
整数値で与えます。関連する機能として、 *note datetime: 34. と *note
time: f4. モジュールも参照してください。

このモジュールに定義された関数やクラスは理想化されたカレンダー、つまり現
在のグレゴリオ暦を過去と未来両方に無限に拡張したものを使っています。これ
はすべての計算の基礎のカレンダーとなっている、 Dershowitz と Reingold の
本 "Calendrical Calculations" 中の "proleptic Gregorian" のカレンダーの
定義に合致します。ゼロと負の年は ISO 8601 の基準に定められている通りに扱
われます。0 年は 1 BC、-1 年は 2 BC、のように続きます。

 -- クラス: calendar.Calendar (firstweekday=0)

     *note Calendar: 2916. オブジェクトを作ります。 'firstweekday' は整
     数で週の始まりの曜日を指定するものです。*note MONDAY: 2917. が ‘0’
     (デフォルト)、*note SUNDAY: 2918. なら ‘6’ です。

     *note Calendar: 2916. オブジェクトは整形されるカレンダーのデータを
     準備するために使えるいくつかのメソッドを提供しています。しかし整形
     機能そのものは提供していません。それはサブクラスの仕事なのです。

     *note Calendar: 2916. instances have the following methods and
     attributes:

      -- の属性: firstweekday

          The first weekday as an integer (0-6).

          This property can also be set and read using *note
          setfirstweekday(): 291a. and *note getfirstweekday(): 291b.
          respectively.

      -- メソッド: getfirstweekday ()

          Return an *note int: 19b. for the current first weekday (0-6).

          Identical to reading the *note firstweekday: 2919. property.

      -- メソッド: setfirstweekday (firstweekday)

          Set the first weekday to 'firstweekday', passed as an *note
          int: 19b. (0-6)

          Identical to setting the *note firstweekday: 2919. property.

      -- メソッド: iterweekdays ()

          Return an iterator for the week day numbers that will be used
          for one week.  The first value from the iterator will be the
          same as the value of the *note firstweekday: 2919. property.

      -- メソッド: itermonthdates (year, month)

          'year' 年 'month' (1-12) 月に対するイテレータを返します。 この
          イテレータはその月の全ての日、およびその月が始まる前の日とその
          月が終わった後の日のうち、週の欠けを埋めるために必要な日を
          (*note datetime.date: 1fa. オブジェクトとして) 返します。

      -- メソッド: itermonthdays (year, month)

          Return an iterator for the month 'month' in the year 'year'
          similar to *note itermonthdates(): e13, but not restricted by
          the *note datetime.date: 1fa. range.  Days returned will
          simply be day of the month numbers.  For the days outside of
          the specified month, the day number is ‘0’.

      -- メソッド: itermonthdays2 (year, month)

          Return an iterator for the month 'month' in the year 'year'
          similar to *note itermonthdates(): e13, but not restricted by
          the *note datetime.date: 1fa. range.  Days returned will be
          tuples consisting of a day of the month number and a week day
          number.

      -- メソッド: itermonthdays3 (year, month)

          Return an iterator for the month 'month' in the year 'year'
          similar to *note itermonthdates(): e13, but not restricted by
          the *note datetime.date: 1fa. range.  Days returned will be
          tuples consisting of a year, a month and a day of the month
          numbers.

          Added in version 3.7.

      -- メソッド: itermonthdays4 (year, month)

          Return an iterator for the month 'month' in the year 'year'
          similar to *note itermonthdates(): e13, but not restricted by
          the *note datetime.date: 1fa. range.  Days returned will be
          tuples consisting of a year, a month, a day of the month, and
          a day of the week numbers.

          Added in version 3.7.

      -- メソッド: monthdatescalendar (year, month)

          'year' 年 'month' 月の週のリストを返します。週は全て七つの
          *note datetime.date: 1fa. オブジェクトからなるリストです。

      -- メソッド: monthdays2calendar (year, month)

          'year' 年 'month' 月の週のリストを返します。週は全て七つの日付
          の数字と曜日を表す数字のタプルからなるリストです。

      -- メソッド: monthdayscalendar (year, month)

          'year' 年 'month' 月の週のリストを返します。週は全て七つの日付
          の数字からなるリストです。

      -- メソッド: yeardatescalendar (year, width=3)

          指定された年のデータを整形に向く形で返します。返される値は月の
          並びのリストです。月の並びは最大で 'width' ヶ月(デフォルトは
          3ヶ月)分です。各月は4ないし6週からなり、各週は1ないし7日からな
          ります。各日は *note datetime.date: 1fa. オブジェクトです。

      -- メソッド: yeardays2calendar (year, width=3)

          指定された年のデータを整形に向く形で返します (*note
          yeardatescalendar(): 2922. と同様です)。週のリストの中が日付の
          数字と曜日の数字のタプルになります。月の範囲外の部分の日付はゼ
          ロです。

      -- メソッド: yeardayscalendar (year, width=3)

          指定された年のデータを整形に向く形で返します (*note
          yeardatescalendar(): 2922. と同様です)。週のリストの中が日付の
          数字になります。月の範囲外の日付はゼロです。

 -- クラス: calendar.TextCalendar (firstweekday=0)

     このクラスはプレインテキストのカレンダーを生成するのに使えます。

     *note TextCalendar: 18aa. インスタンスには以下のメソッドがあります:

      -- メソッド: formatday (theday, weekday, width)

          Return a string representing a single day formatted with the
          given 'width'.  If 'theday' is ‘0’, return a string of spaces
          of the specified width, representing an empty day.  The
          'weekday' parameter is unused.

      -- メソッド: formatweek (theweek, w=0)

          Return a single week in a string with no newline.  If 'w' is
          provided, it specifies the width of the date columns, which
          are centered.  Depends on the first weekday as specified in
          the constructor or set by the *note setfirstweekday(): 2915.
          method.

      -- メソッド: formatweekday (weekday, width)

          Return a string representing the name of a single weekday
          formatted to the specified 'width'.  The 'weekday' parameter
          is an integer representing the day of the week, where ‘0’ is
          Monday and ‘6’ is Sunday.

      -- メソッド: formatweekheader (width)

          Return a string containing the header row of weekday names,
          formatted with the given 'width' for each column.  The names
          depend on the locale settings and are padded to the specified
          width.

      -- メソッド: formatmonth (theyear, themonth, w=0, l=0)

          ひと月分のカレンダーを複数行の文字列で返します。 'w' により日
          の列幅を変えることができ、それらは中央揃えされます。 'l' によ
          り各週の表示される行数を変えることができます。 *note
          setfirstweekday(): 2915. メソッドでセットされた週の最初の曜日
          に依存します。

      -- メソッド: formatmonthname (theyear, themonth, width=0,
               withyear=True)

          Return a string representing the month's name centered within
          the specified 'width'.  If 'withyear' is ‘True’, include the
          year in the output.  The 'theyear' and 'themonth' parameters
          specify the year and month for the name to be formatted
          respectively.

      -- メソッド: prmonth (theyear, themonth, w=0, l=0)

          *note formatmonth(): 2929. で返されるひと月分のカレンダーを出
          力します。

      -- メソッド: formatyear (theyear, w=2, l=1, c=6, m=3)

          'm' 列からなる一年間のカレンダーを複数行の文字列で返します。任
          意の引数 'w', 'l', 'c' はそれぞれ、日付列の表示幅、各週の行数
          及び月と月の間のスペースの数を変更するためのものです。 *note
          setfirstweekday(): 2915. メソッドでセットされた週の最初の曜日
          に依存します。カレンダーを出力できる最初の年はプラットフォーム
          に依存します。

      -- メソッド: pryear (theyear, w=2, l=1, c=6, m=3)

          *note formatyear(): 292c. で返される一年間のカレンダーを出力し
          ます。

 -- クラス: calendar.HTMLCalendar (firstweekday=0)

     このクラスは HTML のカレンダーを生成するのに使えます。

     ‘HTMLCalendar’ インスタンスには以下のメソッドがあります:

      -- メソッド: formatmonth (theyear, themonth, withyear=True)

          ひと月分のカレンダーを HTML のテーブルとして返します。
          'withyear' が真であればヘッダには年も含まれます。そうでなけれ
          ば月の名前だけが使われます。

      -- メソッド: formatyear (theyear, width=3)

          一年分のカレンダーを HTML のテーブルとして返します。'width' の
          値 (デフォルトでは 3 です) は何ヶ月分を一行に収めるかを指定し
          ます。

      -- メソッド: formatyearpage (theyear, width=3, css='calendar.css',
               encoding=None)

          一年分のカレンダーを一つの完全な HTML ページとして返します。
          'width' の値(デフォルトでは 3 です) は何ヶ月分を一行に収めるか
          を指定します。 'css' は使われるカスケーディングスタイルシート
          の名前です。スタイルシートを使わないようにするために *note
          None: 885. を渡すこともできます。 'encoding' には出力に使うエ
          ンコーディングを指定します (デフォルトではシステムデフォルトの
          エンコーディングです)。

      -- メソッド: formatmonthname (theyear, themonth, withyear=True)

          Return a month name as an HTML table row.  If 'withyear' is
          true the year will be included in the row, otherwise just the
          month name will be used.

     ‘HTMLCalendar’ has the following attributes you can override to
     customize the CSS classes used by the calendar:

      -- の属性: cssclasses

          A list of CSS classes used for each weekday.  The default
          class list is:

               cssclasses = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]

          more styles can be added for each day:

               cssclasses = ["mon text-bold", "tue", "wed", "thu", "fri", "sat", "sun red"]

          Note that the length of this list must be seven items.

      -- の属性: cssclass_noday

          The CSS class for a weekday occurring in the previous or
          coming month.

          Added in version 3.7.

      -- の属性: cssclasses_weekday_head

          A list of CSS classes used for weekday names in the header
          row.  The default is the same as *note cssclasses: 2932.

          Added in version 3.7.

      -- の属性: cssclass_month_head

          The month's head CSS class (used by *note formatmonthname():
          2931.).  The default value is ‘"month"’.

          Added in version 3.7.

      -- の属性: cssclass_month

          The CSS class for the whole month's table (used by *note
          formatmonth(): 292e.).  The default value is ‘"month"’.

          Added in version 3.7.

      -- の属性: cssclass_year

          The CSS class for the whole year's table of tables (used by
          *note formatyear(): 292f.).  The default value is ‘"year"’.

          Added in version 3.7.

      -- の属性: cssclass_year_head

          The CSS class for the table head for the whole year (used by
          *note formatyear(): 292f.).  The default value is ‘"year"’.

          Added in version 3.7.

     Note that although the naming for the above described class
     attributes is singular (e.g.  ‘cssclass_month’ ‘cssclass_noday’),
     one can replace the single CSS class with a space separated list of
     CSS classes, for example:

          "text-bold text-red"

     Here is an example how ‘HTMLCalendar’ can be customized:

          class CustomHTMLCal(calendar.HTMLCalendar):
              cssclasses = [style + " text-nowrap" for style in
                            calendar.HTMLCalendar.cssclasses]
              cssclass_month_head = "text-center month-head"
              cssclass_month = "text-center month"
              cssclass_year = "text-italic lead"

 -- クラス: calendar.LocaleTextCalendar (firstweekday=0, locale=None)

     This subclass of *note TextCalendar: 18aa. can be passed a locale
     name in the constructor and will return month and weekday names in
     the specified locale.

 -- クラス: calendar.LocaleHTMLCalendar (firstweekday=0, locale=None)

     This subclass of *note HTMLCalendar: d18. can be passed a locale
     name in the constructor and will return month and weekday names in
     the specified locale.

     注釈: The constructor, ‘formatweekday()’ and ‘formatmonthname()’
     methods of these two classes temporarily change the ‘LC_TIME’
     locale to the given 'locale'.  Because the current locale is a
     process-wide setting, they are not thread-safe.

単純なテキストのカレンダーに関して、このモジュールには以下のような関数が
提供されています。

 -- の関数: calendar.setfirstweekday (weekday)

     週の最初の曜日(‘0’ は月曜日, ‘6’ は日曜日)を設定します。定数 *note
     MONDAY: 2917, *note TUESDAY: 2939, *note WEDNESDAY: 293a, *note
     THURSDAY: 293b, *note FRIDAY: 293c, *note SATURDAY: 293d. 及び
     *note SUNDAY: 2918. は便宜上提供されています。例えば、日曜日を週の
     開始日に設定するときは:

          import calendar
          calendar.setfirstweekday(calendar.SUNDAY)

 -- の関数: calendar.firstweekday ()

     現在設定されている週の最初の曜日を返します。

 -- の関数: calendar.isleap (year)

     'year' が閏年なら *note True: e07. を、そうでなければ *note False:
     d2b. を返します。

 -- の関数: calendar.leapdays (y1, y2)

     範囲('y1' ...  'y2')指定された期間の閏年の回数を返します。ここで
     'y1' や 'y2' は年を表します。

     この関数は、世紀の境目をまたぐ範囲でも正しく動作します。

 -- の関数: calendar.weekday (year, month, day)

     'year' (‘1970’-...), 'month' (‘1’-‘12’), 'day' (‘1’-‘31’) で与えら
     れた日の曜日(‘0’ は月曜日)を返します。

 -- の関数: calendar.weekheader (n)

     短縮された曜日名を含むヘッダを返します。'n' は各曜日を何文字で表す
     かを指定します。

 -- の関数: calendar.monthrange (year, month)

     'year' と 'month' で指定された月の一日の曜日と日数を返します。

 -- の関数: calendar.monthcalendar (year, month)

     月のカレンダーを行列で返します。各行が週を表し、月の範囲外の日は0に
     なります。それぞれの週は *note setfirstweekday(): 2915. で設定をし
     ていない限り月曜日から始まります。

 -- の関数: calendar.prmonth (theyear, themonth, w=0, l=0)

     *note month(): 190b. 関数によって返される月のカレンダーを出力します
     。

 -- の関数: calendar.month (theyear, themonth, w=0, l=0)

     Returns a month's calendar in a multi-line string using the *note
     formatmonth(): 2929. of the *note TextCalendar: 18aa. class.

 -- の関数: calendar.prcal (year, w=0, l=0, c=6, m=3)

     *note calendar(): 15. 関数で返される一年間のカレンダーを出力します
     。

 -- の関数: calendar.calendar (year, w=2, l=1, c=6, m=3)

     Returns a 3-column calendar for an entire year as a multi-line
     string using the *note formatyear(): 292c. of the *note
     TextCalendar: 18aa. class.

 -- の関数: calendar.timegm (tuple)

     カレンダーと直接は関係無いが、 *note time: f4. モジュールの *note
     gmtime(): 13d8. 関数が返す形式の時刻を表すタプルを引数に取り、1970
     を基点とするエポック時刻で POSIX エンコーディングであると仮定して、
     対応する Unix タイムスタンプの値を返します。実際には、 *note
     time.gmtime(): 13d8. と *note timegm(): 2948. はお互いの逆関数です
     。

The ‘calendar’ module exports the following data attributes:

 -- データ: calendar.day_name

     A sequence that represents the days of the week in the current
     locale, where Monday is day number 0.

          >>> import calendar
          >>> list(calendar.day_name)
          ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']

 -- データ: calendar.day_abbr

     A sequence that represents the abbreviated days of the week in the
     current locale, where Mon is day number 0.

          >>> import calendar
          >>> list(calendar.day_abbr)
          ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']

 -- データ: calendar.MONDAY
 -- データ: calendar.TUESDAY
 -- データ: calendar.WEDNESDAY
 -- データ: calendar.THURSDAY
 -- データ: calendar.FRIDAY
 -- データ: calendar.SATURDAY
 -- データ: calendar.SUNDAY

     Aliases for the days of the week, where ‘MONDAY’ is ‘0’ and
     ‘SUNDAY’ is ‘6’.

     Added in version 3.12.

 -- クラス: calendar.Day

     Enumeration defining days of the week as integer constants.  The
     members of this enumeration are exported to the module scope as
     *note MONDAY: 2917. through *note SUNDAY: 2918.

     Added in version 3.12.

 -- データ: calendar.month_name

     A sequence that represents the months of the year in the current
     locale.  This follows normal convention of January being month
     number 1, so it has a length of 13 and ‘month_name[0]’ is the empty
     string.

          >>> import calendar
          >>> list(calendar.month_name)
          ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']

 -- データ: calendar.month_abbr

     A sequence that represents the abbreviated months of the year in
     the current locale.  This follows normal convention of January
     being month number 1, so it has a length of 13 and ‘month_abbr[0]’
     is the empty string.

          >>> import calendar
          >>> list(calendar.month_abbr)
          ['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']

 -- データ: calendar.JANUARY
 -- データ: calendar.FEBRUARY
 -- データ: calendar.MARCH
 -- データ: calendar.APRIL
 -- データ: calendar.MAY
 -- データ: calendar.JUNE
 -- データ: calendar.JULY
 -- データ: calendar.AUGUST
 -- データ: calendar.SEPTEMBER
 -- データ: calendar.OCTOBER
 -- データ: calendar.NOVEMBER
 -- データ: calendar.DECEMBER

     Aliases for the months of the year, where ‘JANUARY’ is ‘1’ and
     ‘DECEMBER’ is ‘12’.

     Added in version 3.12.

 -- クラス: calendar.Month

     Enumeration defining months of the year as integer constants.  The
     members of this enumeration are exported to the module scope as
     *note JANUARY: 34e. through *note DECEMBER: 2956.

     Added in version 3.12.

The ‘calendar’ module defines the following exceptions:

 -- 例外: calendar.IllegalMonthError (month)

     A subclass of *note ValueError: 2ec, raised when the given month
     number is outside of the range 1-12 (inclusive).

      -- の属性: month

          The invalid month number.

 -- 例外: calendar.IllegalWeekdayError (weekday)

     A subclass of *note ValueError: 2ec, raised when the given weekday
     number is outside of the range 0-6 (inclusive).

      -- の属性: weekday

          The invalid weekday number.

参考
....

*note datetime: 34. モジュール

     *note time: f4. モジュールと似た機能を持った日付と時間用のオブジェ
     クト指向インターフェース。

*note time: f4. モジュール

     時間に関連した低水準の関数群。

* Menu:

* コマンドラインでの使用::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/calendar.py


File: python.info,  Node: コマンドラインでの使用,  Up: calendar --- 一般的なカレンダーに関係する機能群

5.8.3.1 コマンドラインでの使用
..............................

Added in version 2.5.

The ‘calendar’ module can be executed as a script from the command line
to interactively print a calendar.

     python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]
                        [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]
                        [-f FIRST_WEEKDAY] [year] [month]

For example, to print a calendar for the year 2000:

     $ python -m calendar 2000
                                       2000

           January                   February                   March
     Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su
                     1  2          1  2  3  4  5  6             1  2  3  4  5
      3  4  5  6  7  8  9       7  8  9 10 11 12 13       6  7  8  9 10 11 12
     10 11 12 13 14 15 16      14 15 16 17 18 19 20      13 14 15 16 17 18 19
     17 18 19 20 21 22 23      21 22 23 24 25 26 27      20 21 22 23 24 25 26
     24 25 26 27 28 29 30      28 29                     27 28 29 30 31
     31

            April                      May                       June
     Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su
                     1  2       1  2  3  4  5  6  7                1  2  3  4
      3  4  5  6  7  8  9       8  9 10 11 12 13 14       5  6  7  8  9 10 11
     10 11 12 13 14 15 16      15 16 17 18 19 20 21      12 13 14 15 16 17 18
     17 18 19 20 21 22 23      22 23 24 25 26 27 28      19 20 21 22 23 24 25
     24 25 26 27 28 29 30      29 30 31                  26 27 28 29 30

             July                     August                  September
     Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su
                     1  2          1  2  3  4  5  6                   1  2  3
      3  4  5  6  7  8  9       7  8  9 10 11 12 13       4  5  6  7  8  9 10
     10 11 12 13 14 15 16      14 15 16 17 18 19 20      11 12 13 14 15 16 17
     17 18 19 20 21 22 23      21 22 23 24 25 26 27      18 19 20 21 22 23 24
     24 25 26 27 28 29 30      28 29 30 31               25 26 27 28 29 30
     31

           October                   November                  December
     Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su
                        1             1  2  3  4  5                   1  2  3
      2  3  4  5  6  7  8       6  7  8  9 10 11 12       4  5  6  7  8  9 10
      9 10 11 12 13 14 15      13 14 15 16 17 18 19      11 12 13 14 15 16 17
     16 17 18 19 20 21 22      20 21 22 23 24 25 26      18 19 20 21 22 23 24
     23 24 25 26 27 28 29      27 28 29 30               25 26 27 28 29 30 31
     30 31

以下のオプションが使用できます:

 -- Option: --help, -h

     ヘルプメッセージを表示して終了します。

 -- Option: --locale LOCALE, -L LOCALE

     The locale to use for month and weekday names.  Defaults to
     English.

 -- Option: --encoding ENCODING, -e ENCODING

     The encoding to use for output.  *note -encoding: 295f. is required
     if *note -locale: 295d. is set.

 -- Option: --type {text,html}, -t {text,html}

     Print the calendar to the terminal as text, or as an HTML document.

 -- Option: --first-weekday FIRST_WEEKDAY, -f FIRST_WEEKDAY

     The weekday to start each week.  Must be a number between 0
     (Monday) and 6 (Sunday).  Defaults to 0.

     Added in version 3.13.

 -- Option: year

     The year to print the calendar for.  Defaults to the current year.

 -- Option: month

     The month of the specified *note year: 2965. to print the calendar
     for.  Must be a number between 1 and 12, and may only be used in
     text mode.  Defaults to printing a calendar for the full year.

'Text-mode options:'

 -- Option: --width WIDTH, -w WIDTH

     The width of the date column in terminal columns.  The date is
     printed centred in the column.  Any value lower than 2 is ignored.
     Defaults to 2.

 -- Option: --lines LINES, -l LINES

     The number of lines for each week in terminal rows.  The date is
     printed top-aligned.  Any value lower than 1 is ignored.  Defaults
     to 1.

 -- Option: --spacing SPACING, -s SPACING

     The space between months in columns.  Any value lower than 2 is
     ignored.  Defaults to 6.

 -- Option: --months MONTHS, -m MONTHS

     The number of months printed per row.  Defaults to 3.

バージョン 3.14 で変更: By default, today's date is highlighted in color
and can be *note controlled using environment variables: 1b7.

'HTML-mode options:'

 -- Option: --css CSS, -c CSS

     The path of a CSS stylesheet to use for the calendar.  This must
     either be relative to the generated HTML, or an absolute HTTP or
     ‘file:///’ URL.


File: python.info,  Node: collections --- コンテナデータ型,  Next: collections abc --- コンテナの抽象基底クラス,  Prev: calendar --- 一般的なカレンダーに関係する機能群,  Up: データ型

5.8.4 ‘collections’ -- コンテナデータ型
---------------------------------------

'ソースコード:' Lib/collections/__init__.py(1)

__________________________________________________________________

このモジュールは、汎用の Python 組み込みコンテナ *note dict: 183, *note
list: 24d, *note set: 184, および *note tuple: 614. に代わる、特殊なコン
テナデータ型を実装しています。

*note namedtuple(): 4e0.  名前付きフィールドを持つタプルのサブクラスを作成するファクトリ関数
                          
                          
*note deque: 7f4.         両端における append や pop を高速に行えるリスト風のコンテナ
                          
                          
*note ChainMap: e16.      複数のマッピングの一つのビューを作成する辞書風のクラス
                          
                          
*note Counter: 12a3.      *note ハッシュ可能: 824. なオブジェクトを数え上げる辞書のサブクラス
                          
                          
*note OrderedDict: 7f3.   項目が追加された順序を記憶する辞書のサブクラス
                          
                          
*note defaultdict: 13d4.  ファクトリ関数を呼び出して存在しない値を供給する辞書のサブクラス
                          
                          
*note UserDict: 1d7d.     辞書のサブクラス化を簡単にする辞書オブジェクトのラッパ
                          
                          
*note UserList: 16fd.     リストのサブクラス化を簡単にするリストオブジェクトのラッパ
                          
                          
*note UserString: fd3.    文字列のサブクラス化を簡単にする文字列オブジェクトのラッパ
                          

* Menu:

* ChainMap オブジェクト::
* Counter オブジェクト::
* deque オブジェクト::
* defaultdict オブジェクト::
* namedtuple() 名前付きフィールドを持つタプルのファクトリ関数: namedtuple 名前付きフィールドを持つタプルのファクトリ関数.
* OrderedDict オブジェクト::
* UserDict オブジェクト::
* UserList オブジェクト::
* UserString オブジェクト::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/collections/__init__.py


File: python.info,  Node: ChainMap オブジェクト,  Next: Counter オブジェクト,  Up: collections --- コンテナデータ型

5.8.4.1 ‘ChainMap’ オブジェクト
...............................

Added in version 3.3.

*note ChainMap: e16. クラスは、複数のマッピングを素早く連結し、一つの単
位として扱うために提供されています。これはたいてい、新しい辞書を作成して
*note update(): 167e. を繰り返すよりも早いです。

このクラスはネストされたスコープをシミュレートするのに使え、テンプレート
化に便利です。

 -- クラス: collections.ChainMap (*maps)

     *note ChainMap: e16. は、複数の辞書やその他のマッピングをまとめて、
     一つの、更新可能なビューを作成します。 'maps' が指定されないなら、
     一つの空辞書が与えられますから、新しいチェーンは必ず一つ以上のマッ
     ピングをもちます。

     根底のマッピングはリストに保存されます。このリストはパブリックで、
     'maps' 属性を使ってアクセスや更新できます。それ以外に状態はありませ
     ん。

     探索は、根底のマッピングをキーが見つかるまで引き続き探します。対し
     て、書き込み、更新、削除は、最初のマッピングのみ操作します。

     *note ChainMap: e16. は、根底のマッピングを参照によって組み込みます
     。ですから、根底のマッピングの一つが更新されると、その変更は *note
     ChainMap: e16. に反映されます。

     通常の辞書のメソッドすべてがサポートされています。さらに、'maps' 属
     性、新しいサブコンテキストを作成するメソッド、最初のマッピング以外
     のすべてにアクセスするためのプロパティがあります:

      -- の属性: maps

          マッピングのユーザがアップデートできるリストです。このリストは
          最初に探されるものから最後に探されるものの順に並んでいます。こ
          れが唯一のソートされた状態であり、変更してマッピングが探される
          順番を変更できます。このリストは常に一つ以上のマッピングを含ん
          でいなければなりません。

      -- メソッド: new_child (m=None, **kwargs)

          新しいマッピングに現在のインスタンスが持つ全てのマッピングを追
          加したものを持つ新しい *note ChainMap: e16. インスタンスを返し
          ます。 ‘m’ が指定された場合、新しいマッピングのリストの先頭部
          分になります; 指定されない場合は空の辞書が使われます。すなわち
          ‘d.new_child()’ は ‘ChainMap({}, *d.maps)’ と等価になります。
          キーワード引数が指定された場合、それらによって指定されたマッピ
          ングまたは空の辞書が更新されます。このメソッドは、元のマッピン
          グに変更を加えることなく値を更新できるサブコンテキストを生成す
          るのに使われます。

          バージョン 3.4 で変更: オプションの ‘m’ 引数が追加されました。

          バージョン 3.10 で変更: キーワード引数のサポートが追加されまし
          た。

      -- の属性: parents

          現在のインスタンスの最初のマッピング以外のすべてのマッピングを
          含む新しい *note ChainMap: e16. を返すプロパティです。これは最
          初のマッピングを検索から飛ばすのに便利です。使用例は *note
          nonlocal: 14bf. キーワードを *note ネストされたスコープ: 238d.
          に使う例と似ています。この使用例はまた、組み込み *note
          super(): 1a6. 関数にも似ています。 ‘d.parents’ への参照は
          ‘ChainMap(*d.maps[1:])’ と等価です。

     *note ChainMap: e16. の反復順序は、マッピングを最後から最初へスキャ
     ンして決定されることに注意してください。

          >>> baseline = {'music': 'bach', 'art': 'rembrandt'}
          >>> adjustments = {'art': 'van gogh', 'opera': 'carmen'}
          >>> list(ChainMap(adjustments, baseline))
          ['music', 'art', 'opera']

     これは、末尾のマッピングオブジェクトから始めた一連の *note
     dict.update(): 167e. の呼び出しと同じ順序になります。

          >>> combined = baseline.copy()
          >>> combined.update(adjustments)
          >>> list(combined)
          ['music', 'art', 'opera']

     バージョン 3.9 で変更: PEP 584(1) で規定されている ‘|’ 演算子と
     ‘|=’ 演算子のサポートを追加しました。

参考
....

   * Enthought 社の CodeTools パッケージ(2) に含まれる MultiContext クラ
     ス(3) は、チェーン内のすべてのマッピングへの書き込みをサポートする
     オプションを持ちます。

   * Django のテンプレート用の Context class(4) は、読み出し専用のマッピ
     ングのチェーンです。 *note new_child(): 1126. メソッドや *note
     parents: 2976. プロパティに似た push や pop の機能もあります。

   * Nested Contexts recipe(5) は、書き込み・その他の変更が最初のマッピ
     ングにのみ適用されるか、チェーンのすべてのマッピングに適用されるか
     、制御するオプションを持ちます。

   * 非常に単純化した読み出し専用バージョンの Chainmap(6)。

* Menu:

* ChainMap の例とレシピ::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0584/

   (2) https://github.com/enthought/codetools

   (3) 
https://github.com/enthought/codetools/blob/4.0.0/codetools/contexts/multi_context.py

   (4) 
https://github.com/django/django/blob/main/django/template/context.py

   (5) 
https://code.activestate.com/recipes/577434-nested-contexts-a-chain-of-mapping-objects/

   (6) https://code.activestate.com/recipes/305268/


File: python.info,  Node: ChainMap の例とレシピ,  Up: ChainMap オブジェクト

5.8.4.2 ‘ChainMap’ の例とレシピ
...............................

この節では、チェーンされたマッピングを扱う様々な手法を示します。

Python の内部探索チェーンをシミュレートする例:

     import builtins
     pylookup = ChainMap(locals(), globals(), vars(builtins))

ユーザ指定のコマンドライン引数、環境変数、デフォルト値、の順に優先させる
例:

     import os, argparse

     defaults = {'color': 'red', 'user': 'guest'}

     parser = argparse.ArgumentParser()
     parser.add_argument('-u', '--user')
     parser.add_argument('-c', '--color')
     namespace = parser.parse_args()
     command_line_args = {k: v for k, v in vars(namespace).items() if v is not None}

     combined = ChainMap(command_line_args, os.environ, defaults)
     print(combined['color'])
     print(combined['user'])

*note ChainMap: e16. を使ってネストされたコンテキストをシミュレートする
パターンの例:

     c = ChainMap()        # Create root context
     d = c.new_child()     # Create nested child context
     e = c.new_child()     # Child of c, independent from d
     e.maps[0]             # Current context dictionary -- like Python's locals()
     e.maps[-1]            # Root context -- like Python's globals()
     e.parents             # Enclosing context chain -- like Python's nonlocals

     d['x'] = 1            # Set value in current context
     d['x']                # Get first key in the chain of contexts
     del d['x']            # Delete from current context
     list(d)               # All nested values
     k in d                # Check all nested values
     len(d)                # Number of nested values
     d.items()             # All nested items
     dict(d)               # Flatten into a regular dictionary

*note ChainMap: e16. クラスは、探索はチェーン全体に対して行いますが、更
新 (書き込みと削除) は最初のマッピングに対してのみ行います。しかし、深い
書き込みと削除を望むなら、チェーンの深いところで見つかったキーを更新する
サブクラスを簡単に作れます:

     class DeepChainMap(ChainMap):
         'Variant of ChainMap that allows direct updates to inner scopes'

         def __setitem__(self, key, value):
             for mapping in self.maps:
                 if key in mapping:
                     mapping[key] = value
                     return
             self.maps[0][key] = value

         def __delitem__(self, key):
             for mapping in self.maps:
                 if key in mapping:
                     del mapping[key]
                     return
             raise KeyError(key)

     >>> d = DeepChainMap({'zebra': 'black'}, {'elephant': 'blue'}, {'lion': 'yellow'})
     >>> d['lion'] = 'orange'         # update an existing key two levels down
     >>> d['snake'] = 'red'           # new keys get added to the topmost dict
     >>> del d['elephant']            # remove an existing key one level down
     >>> d                            # display result
     DeepChainMap({'zebra': 'black', 'snake': 'red'}, {}, {'lion': 'orange'})


File: python.info,  Node: Counter オブジェクト,  Next: deque オブジェクト,  Prev: ChainMap オブジェクト,  Up: collections --- コンテナデータ型

5.8.4.3 ‘Counter’ オブジェクト
..............................

便利で迅速な検数をサポートするカウンタツールが提供されています。例えば:

     >>> # Tally occurrences of words in a list
     >>> cnt = Counter()
     >>> for word in ['red', 'blue', 'red', 'green', 'blue', 'blue']:
     ...     cnt[word] += 1
     ...
     >>> cnt
     Counter({'blue': 3, 'red': 2, 'green': 1})

     >>> # Find the ten most common words in Hamlet
     >>> import re
     >>> words = re.findall(r'\w+', open('hamlet.txt').read().lower())
     >>> Counter(words).most_common(10)
     [('the', 1143), ('and', 966), ('to', 762), ('of', 669), ('i', 631),
      ('you', 554),  ('a', 546), ('my', 514), ('hamlet', 471), ('in', 451)]

 -- クラス: collections.Counter ([iterable-or-mapping])

     *note Counter: 12a3. は *note ハッシュ可能: 824. なオブジェクトをカ
     ウントする *note dict: 183. のサブクラスです。これは、要素を辞書の
     キーとして保存し、そのカウントを辞書の値として保存するコレクション
     です。カウントは、0 や負のカウントを含む整数値をとれます。 *note
     Counter: 12a3. クラスは、他の言語のバッグや多重集合のようなものです
     。

     要素は、 'iterable' から数え上げられたり、他の 'mapping' (やカウン
     タ) から初期化されます:

          >>> c = Counter()                           # a new, empty counter
          >>> c = Counter('gallahad')                 # a new counter from an iterable
          >>> c = Counter({'red': 4, 'blue': 2})      # a new counter from a mapping
          >>> c = Counter(cats=4, dogs=8)             # a new counter from keyword args

     カウンタオブジェクトは辞書のインターフェースを持ちますが、存在しな
     い要素に対して *note KeyError: 5e7. を送出する代わりに 0 を返すとい
     う違いがあります:

          >>> c = Counter(['eggs', 'ham'])
          >>> c['bacon']                              # count of a missing element is zero
          0

     カウントを 0 に設定しても、要素はカウンタから取り除かれません。完全
     に取り除くには、 ‘del’ を使ってください:

          >>> c['sausage'] = 0                        # counter entry with a zero count
          >>> del c['sausage']                        # del actually removes the entry

     Added in version 3.1.

     バージョン 3.7 で変更: *note Counter: 12a3. は *note dict: 183. の
     サブクラスとして要素の挿入順を維持する機能を継承しました。
     'Counter' オブジェクトに対する数学演算も順序を維持します。結果の順
     序はまず左の被演算子における要素の出現順に従い、その後右の被演算子
     において要素が出現する順序になります。

     カウンタオブジェクトは全ての辞書で利用できるメソッドに加えて、以下
     に示す追加のメソッドをサポートしています。

      -- メソッド: elements ()

          それぞれの要素を、そのカウント分の回数だけ繰り返すイテレータを
          返します。要素は挿入した順番で返されます。ある要素のカウントが
          1 未満なら、 *note elements(): 151b. はそれを無視します。

               >>> c = Counter(a=4, b=2, c=0, d=-2)
               >>> sorted(c.elements())
               ['a', 'a', 'a', 'a', 'b', 'b']

      -- メソッド: most_common ([n])

          最も多い 'n' 要素を、カウントが多いものから少ないものまで順に
          並べたリストを返します。 'n' が省略されるか ‘None’ であれば、
          *note most_common(): 151a. はカウンタの 'すべての' 要素を返し
          ます。等しいカウントの要素は挿入順に並べられます:

               >>> Counter('abracadabra').most_common(3)
               [('a', 5), ('b', 2), ('r', 2)]

      -- メソッド: subtract ([iterable-or-mapping])

          要素から 'iterable' の要素または 'mapping' の要素が引かれます
          。 *note dict.update(): 167e. に似ていますが、カウントを置き換
          えるのではなく引きます。入力も出力も、 0 や負になりえます。

               >>> c = Counter(a=4, b=2, c=0, d=-2)
               >>> d = Counter(a=1, b=2, c=3, d=4)
               >>> c.subtract(d)
               >>> c
               Counter({'a': 3, 'b': 0, 'c': -3, 'd': -6})

          Added in version 3.2.

      -- メソッド: total ()

          カウントの合計を計算します。

               >>> c = Counter(a=10, b=5, c=0)
               >>> c.total()
               15

          Added in version 3.10.

     普通の辞書のメソッドは、以下の 2 つのメソッドがカウンタに対して異な
     る振る舞いをするのを除き、 *note Counter: 12a3. オブジェクトにも利
     用できます。

      -- メソッド: fromkeys (iterable)

          このクラスメソッドは *note Counter: 12a3. オブジェクトには実装
          されていません。

      -- メソッド: update ([iterable-or-mapping])

          要素が 'iterable' からカウントされるか、別の 'mapping' (やカウ
          ンタ) が追加されます。 *note dict.update(): 167e. に似ています
          が、カウントを置き換えるのではなく追加します。また、
          'iterable' には ‘(key, value)’ 対のシーケンスではなく、要素の
          シーケンスが求められます。

カウンタオブジェクトは等価、部分集合、上位集合のための次の拡張比較 (rich
comparison) 演算子をサポートします: ‘==’, ‘!=’, ‘<’, ‘<=’, ‘>’, ‘>=’。こ
れらの比較は、存在しない要素をカウントがゼロであるとみなします。すなわち
、 ‘Counter(a=1) == Counter(a=1, b=0)’ は真を返します。

バージョン 3.10 で変更: 拡張比較 (rich comparison) 演算が追加されました
。

バージョン 3.10 で変更: 等価比較において、存在しない要素はカウントがゼロ
であるとみなされるようになりました。かつては ‘Counter(a=3)’ と
‘Counter(a=3, b=0)’ は異なるとみなされていました。

*note Counter: 12a3. オブジェクトを使ったよくあるパターン:

     c.total()                       # total of all counts
     c.clear()                       # reset all counts
     list(c)                         # list unique elements
     set(c)                          # convert to a set
     dict(c)                         # convert to a regular dictionary
     c.items()                       # access the (elem, cnt) pairs
     Counter(dict(list_of_pairs))    # convert from a list of (elem, cnt) pairs
     c.most_common()[:-n-1:-1]       # n least common elements
     +c                              # remove zero and negative counts

*note Counter: 12a3. オブジェクトを組み合わせて多重集合 (0より大きいカウ
ントを持つカウンタ) を作るためのいくつかの数学演算が提供されています。加
算と減算はそれぞれの要素のカウンタを加算または減算することによりカウンタ
オブジェクトを組み合わせます。積集合と和集合は、それぞれのカウントの最大
値と最小値を返します。等価と包含はそれぞれのカウントを比較します。それぞ
れの演算は符号付きカウントを持った入力を受け付けますが、カウントが0以下
の要素は結果から取り除かれます。

     >>> c = Counter(a=3, b=1)
     >>> d = Counter(a=1, b=2)
     >>> c + d                       # add two counters together:  c[x] + d[x]
     Counter({'a': 4, 'b': 3})
     >>> c - d                       # subtract (keeping only positive counts)
     Counter({'a': 2})
     >>> c & d                       # intersection:  min(c[x], d[x])
     Counter({'a': 1, 'b': 1})
     >>> c | d                       # union:  max(c[x], d[x])
     Counter({'a': 3, 'b': 2})
     >>> c == d                      # equality:  c[x] == d[x]
     False
     >>> c <= d                      # inclusion:  c[x] <= d[x]
     False

単項加算および減算は、空カウンタの加算や空カウンタからの減算へのショート
カットです。

     >>> c = Counter(a=2, b=-4)
     >>> +c
     Counter({'a': 2})
     >>> -c
     Counter({'b': 4})

Added in version 3.3: 単項加算、単項減算、in-place の多重集合操作のサポ
ートが追加されました。

     注釈: カウンタはもともと、推移するカウントを正の整数で表すために設
     計されました。しかし、他の型や負の値を必要とするユースケースを不必
     要に排除することがないように配慮されています。このようなユースケー
     スの助けになるように、この節で最低限の範囲と型の制限について記述し
     ます。

        * *note Counter: 12a3. クラス自体は辞書のサブクラスで、キーと値
          に制限はありません。値はカウントを表す数であることを意図してい
          ますが、値フィールドに任意のものを保存 'できます' 。

        * *note most_common(): 151a. メソッドが要求するのは、値が順序付
          け可能なことだけです。

        * ‘c[key] += 1’ のようなインプレース演算では、値の型に必要なのは
          足し算と引き算ができることだけです。よって分数、浮動小数点数、
          小数も使え、負の値がサポートされています。これと同じことが、 負
          や 0 の値を入力と出力に許す *note update(): 177d. と *note
          subtract(): 13f7. メソッド にも言えます。

        * 多重集合メソッドは正の値を扱うユースケースに対してのみ設計され
          ています。入力は負や 0 に出来ますが、正の値の出力のみが生成さ
          れます。型の制限はありませんが、値の型は足し算、引き算、比較を
          サポートしている必要があります。

        * *note elements(): 151b. メソッドは整数のカウントを要求します。
          これは 0 と負のカウントを無視します。

参考
....

   * Smalltalk の Bag class(1) 。

   * Wikipedia の Multisets(2) の項目。

   * C++ multisets(3) の例を交えたチュートリアル。

   * 数学的な多重集合の演算とそのユースケースは、 'Knuth, Donald.  The
     Art of Computer Programming Volume II, Section 4.6.3, Exercise 19'
     を参照してください。

   * 与えられた要素の集まりからなる与えられた大きさの相違なる多重集合を
     すべて数え上げるには、 *note
     itertools.combinations_with_replacement(): 1499. を参照してください
     :

          map(Counter, combinations_with_replacement('ABC', 2)) # --> AA AB AC BB BC CC

   ---------- Footnotes ----------

   (1) 
https://www.gnu.org/software/smalltalk/manual-base/html_node/Bag.html

   (2) https://en.wikipedia.org/wiki/Multiset

   (3) 
http://www.java2s.com/Tutorial/Cpp/0380__set-multiset/Catalog0380__set-multiset.htm


File: python.info,  Node: deque オブジェクト,  Next: defaultdict オブジェクト,  Prev: Counter オブジェクト,  Up: collections --- コンテナデータ型

5.8.4.4 ‘deque’ オブジェクト
............................

 -- クラス: collections.deque ([iterable[, maxlen]])

     'iterable' で与えられるデータから、新しい deque オブジェクトを
     (*note append(): 297c. をつかって) 左から右に初期化して返します。
     'iterable' が指定されない場合、新しい deque オブジェクトは空になり
     ます。

     Deque とは、スタックとキューを一般化したものです (この名前は「デッ
     ク」と発音され、これは「double-ended queue」の省略形です)。Deque は
     どちらの側からも append と pop が可能で、スレッドセーフでメモリ効率
     がよく、どちらの方向からもおよそ 'O'(1) のパフォーマンスで実行でき
     ます。

     *note list: 24d. オブジェクトでも同様の操作を実現できますが、これは
     高速な固定長の操作に特化されており、基礎のデータ表現形式のサイズと
     位置を両方変えるような ‘pop(0)’ や ‘insert(0, v)’ などの操作ではメ
     モリ移動のために 'O'('n') のコストを必要とします。

     'maxlen' が指定されなかったり ‘None’ だった場合、 deque は任意のサ
     イズまで大きくなります。 そうでない場合、 deque のサイズは指定され
     た最大長に制限されます。 長さが制限された deque がいっぱいになると
     、新しい要素を追加するときに追加した要素数分だけ追加したのと反対側
     から要素が捨てられます。 長さが制限された deque は Unix における
     ‘tail’ フィルタと似た機能を提供します。 トランザクションの tracking
     や最近使った要素だけを残したいデータプール (pool of data) などにも
     便利です。

     Deque オブジェクトは以下のようなメソッドをサポートしています:

      -- メソッド: append (x)

          'x' を deque の右側につけ加えます。

      -- メソッド: appendleft (x)

          'x' を deque の左側につけ加えます。

      -- メソッド: clear ()

          deque からすべての要素を削除し、長さを 0 にします。

      -- メソッド: copy ()

          deque の浅いコピーを作成します。

          Added in version 3.5.

      -- メソッド: count (x)

          deque の 'x' に等しい要素を数え上げます。

          Added in version 3.2.

      -- メソッド: extend (iterable)

          イテラブルな引数 iterable から得られる要素を deque の右側に追
          加し拡張します。

      -- メソッド: extendleft (iterable)

          イテラブルな引数 iterable から得られる要素を deque の左側に追
          加し拡張します。注意: 左から追加した結果は、イテラブルな引数の
          順序とは逆になります。

      -- メソッド: index (x[, start[, stop]])

          deque 内の 'x' の位置を返します (インデックス 'start' からイン
          デックス 'stop' の両端を含む範囲で)。最初のマッチを返すか、見
          つからない場合には *note ValueError: 2ec. を発生させます。

          Added in version 3.5.

      -- メソッド: insert (i, x)

          'x' を deque の位置 'i' に挿入します。

          挿入によって、長さに制限のある deque の長さが 'maxlen' を超え
          る場合、*note IndexError: 174e. が発生します。

          Added in version 3.5.

      -- メソッド: pop ()

          deque の右側から要素をひとつ削除し、その要素を返します。要素が
          ひとつも存在しない場合は *note IndexError: 174e. を発生させま
          す。

      -- メソッド: popleft ()

          deque の左側から要素をひとつ削除し、その要素を返します。要素が
          ひとつも存在しない場合は *note IndexError: 174e. を発生させま
          す。

      -- メソッド: remove (value)

          'value' の最初に現れるものを削除します。要素が見付からないない
          場合は *note ValueError: 2ec. を送出します。

      -- メソッド: reverse ()

          deque の要素をインプレースに反転し、‘None’ を返します。

          Added in version 3.2.

      -- メソッド: rotate (n=1)

          deque の要素を全体で 'n' ステップだけ右にローテートします。'n'
          が負の値の場合は、左にローテートします。

          deque が空でないときは、 deque をひとつ右にローテートすること
          は ‘d.appendleft(d.pop())’ と同じで、 deque をひとつ左にローテ
          ートすることは ‘d.append(d.popleft())’ と同じです。

     deque オブジェクトは読み出し専用属性も 1 つ提供しています:

      -- の属性: maxlen

          deque の最大長で、制限されていなければ ‘None’ です。

          Added in version 3.1.

上記に加え、 deque はイテレーション, pickle 化, ‘len(d)’, ‘reversed(d)’,
‘copy.copy(d)’, ‘copy.deepcopy(d)’, *note in: 34b. 演算子による包含の検
査, ‘d[0]’ のような添字による参照をサポートしています。添字によるアクセ
スは、両端の要素では 'O'(1) ですが、中央部分の要素では 'O'('n') と遅くな
ります。高速なランダムアクセスのためには、代わりにリストを使ってください
。

バージョン 3.5 から deque は ‘__add__()’, ‘__mul__()’, ‘__imul__()’ をサ
ポートしました。

例:

     >>> from collections import deque
     >>> d = deque('ghi')                 # make a new deque with three items
     >>> for elem in d:                   # iterate over the deque's elements
     ...     print(elem.upper())
     G
     H
     I

     >>> d.append('j')                    # add a new entry to the right side
     >>> d.appendleft('f')                # add a new entry to the left side
     >>> d                                # show the representation of the deque
     deque(['f', 'g', 'h', 'i', 'j'])

     >>> d.pop()                          # return and remove the rightmost item
     'j'
     >>> d.popleft()                      # return and remove the leftmost item
     'f'
     >>> list(d)                          # list the contents of the deque
     ['g', 'h', 'i']
     >>> d[0]                             # peek at leftmost item
     'g'
     >>> d[-1]                            # peek at rightmost item
     'i'

     >>> list(reversed(d))                # list the contents of a deque in reverse
     ['i', 'h', 'g']
     >>> 'h' in d                         # search the deque
     True
     >>> d.extend('jkl')                  # add multiple elements at once
     >>> d
     deque(['g', 'h', 'i', 'j', 'k', 'l'])
     >>> d.rotate(1)                      # right rotation
     >>> d
     deque(['l', 'g', 'h', 'i', 'j', 'k'])
     >>> d.rotate(-1)                     # left rotation
     >>> d
     deque(['g', 'h', 'i', 'j', 'k', 'l'])

     >>> deque(reversed(d))               # make a new deque in reverse order
     deque(['l', 'k', 'j', 'i', 'h', 'g'])
     >>> d.clear()                        # empty the deque
     >>> d.pop()                          # cannot pop from an empty deque
     Traceback (most recent call last):
         File "<pyshell#6>", line 1, in -toplevel-
             d.pop()
     IndexError: pop from an empty deque

     >>> d.extendleft('abc')              # extendleft() reverses the input order
     >>> d
     deque(['c', 'b', 'a'])

* Menu:

* deque のレシピ::


File: python.info,  Node: deque のレシピ,  Up: deque オブジェクト

5.8.4.5 ‘deque’ のレシピ
........................

この節では deque を使った様々なアプローチを紹介します。

長さが制限された deque は Unix における ‘tail’ フィルタに相当する機能を
提供します:

     def tail(filename, n=10):
         'Return the last n lines of a file'
         with open(filename) as f:
             return deque(f, n)

deque を使用する別のアプローチは、右に要素を追加し左から要素を取り出すこ
とで最近追加した要素のシーケンスを保持することです:

     def moving_average(iterable, n=3):
         # moving_average([40, 30, 50, 46, 39, 44]) --> 40.0 42.0 45.0 43.0
         # https://en.wikipedia.org/wiki/Moving_average
         it = iter(iterable)
         d = deque(itertools.islice(it, n-1))
         d.appendleft(0)
         s = sum(d)
         for elem in it:
             s += elem - d.popleft()
             d.append(elem)
             yield s / n

ラウンドロビンスケジューラ(1) は、入力されたイテレータを *note deque:
7f4. に格納することで実装できます。 値は、位置0にある選択中のイテレータ
から取り出されます。 そのイテレータが値を出し切った場合は、 *note
popleft(): 2982. で除去できます; そうでない場合は、 *note rotate():
1c90. メソッドで末尾に回せます:

     def roundrobin(*iterables):
         "roundrobin('ABC', 'D', 'EF') --> A D E B F C"
         iterators = deque(map(iter, iterables))
         while iterators:
             try:
                 while True:
                     yield next(iterators[0])
                     iterators.rotate(-1)
             except StopIteration:
                 # Remove an exhausted iterator.
                 iterators.popleft()

*note rotate(): 1c90. メソッドは、 *note deque: 7f4. のスライスや削除の
機能を提供します。 例えば、 純粋な Python 実装の ‘del d[n]’ は
‘rotate()’ メソッドを頼りに、pop される要素の位置を割り出します:

     def delete_nth(d, n):
         d.rotate(-n)
         d.popleft()
         d.rotate(n)

*note deque: 7f4. のスライスの実装でも、同様のアプローチを使います。まず
対象となる要素を *note rotate(): 1c90. によって deque の左端まで移動させ
てから、 *note popleft(): 2982. で古い要素を削除します。そして、 *note
extend(): 297f. で新しい要素を追加したのち、循環を逆にします。このアプロ
ーチをやや変えたものとして、Forth スタイルのスタック操作、つまり ‘dup’,
‘drop’, ‘swap’, ‘over’, ‘pick’, ‘rot’, および ‘roll’ を実装するのも簡単
です。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Round-robin_scheduling


File: python.info,  Node: defaultdict オブジェクト,  Next: namedtuple 名前付きフィールドを持つタプルのファクトリ関数,  Prev: deque オブジェクト,  Up: collections --- コンテナデータ型

5.8.4.6 ‘defaultdict’ オブジェクト
..................................

 -- クラス: collections.defaultdict (default_factory=None, /[, ...])

     新しい辞書に似たオブジェクトを返します。 *note defaultdict: 13d4. は
     組み込みの *note dict: 183. クラスのサブクラスです。これはメソッド
     をひとつオーバーライドし、書き込み可能なインスタンス変数をひとつ追
     加しています。それ以外の機能は *note dict: 183. クラスと同じですの
     で、ここでは説明しません。

     1つ目の引数は *note default_factory: 2985. 属性の初期値です。デフォ
     ルトは ‘None’ です。残りの引数はキーワード引数も含め、 *note dict:
     183. のコンストラクタに与えられた場合と同様に扱われます。

     *note defaultdict: 13d4. オブジェクトは標準の *note dict: 183. に加
     えて、以下のメソッドを実装しています:

      -- メソッド: __missing__ (key)

          もし *note default_factory: 2985. 属性が ‘None’ であれば、この
          メソッドは *note KeyError: 5e7. 例外を、 'key' を引数として発
          生させます。

          もし *note default_factory: 2985. 属性が ‘None’ でない場合、こ
          のメソッドは引数なしで呼び出され、与えらえた 'key' に対応する
          デフォルト値を提供します。この値は、辞書内に 'key' に対応して
          登録され、最後に返されます。

          もし *note default_factory: 2985. の呼出が例外を発生させた場合
          には、変更せずそのまま例外を投げます。

          このメソッドは *note dict: 183. クラスの *note __getitem__():
          588. メソッドで、キーが存在しなかった場合によびだされます。値
          を返すか例外を発生させるのどちらにしても、 *note
          __getitem__(): 588. からもそのまま値が返るか例外が発生します。

          なお、 *note __missing__(): 2986. は *note __getitem__(): 588.
          以外のいかなる演算に対しても呼び出され 'ません' 。よって *note
          get(): 2034. は、普通の辞書と同様に、 *note default_factory:
          2985. を使うのではなくデフォルトとして ‘None’ を返します。

     *note defaultdict: 13d4. オブジェクトは以下のインスタンス変数をサポ
     ートしています:

      -- の属性: default_factory

          この属性は *note __missing__(): 2986. メソッドによって使われま
          す。これは存在すればコンストラクタの第1引数によって初期化され
          、そうでなければ ‘None’ になります。

     バージョン 3.9 で変更: PEP 584(1) で規定されている合成演算子 (‘|’)
     と更新演算子 (‘|=’)が追加されました。

* Menu:

* defaultdict の使用例::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0584/


File: python.info,  Node: defaultdict の使用例,  Up: defaultdict オブジェクト

5.8.4.7 ‘defaultdict’ の使用例
..............................

*note list: 24d. を *note default_factory: 2985. とすることで、キー=値ペ
アのシーケンスをリストの辞書へ簡単にグループ化できます。:

     >>> s = [('yellow', 1), ('blue', 2), ('yellow', 3), ('blue', 4), ('red', 1)]
     >>> d = defaultdict(list)
     >>> for k, v in s:
     ...     d[k].append(v)
     ...
     >>> sorted(d.items())
     [('blue', [2, 4]), ('red', [1]), ('yellow', [1, 3])]

それぞれのキーが最初に登場したとき、マッピングにはまだ存在しません。その
ためエントリは *note default_factory: 2985. 関数が返す空の *note list:
24d. を使って自動的に作成されます。 *note list.append(): 8dc. 操作は新し
いリストに紐付けられます。キーが再度出現した場合には、通常の参照動作が行
われます(そのキーに対応するリストが返ります)。そして *note
list.append(): 8dc. 操作で別の値をリストに追加します。このテクニックは
*note dict.setdefault(): 1285. を使った等価なものよりシンプルで速いです:

     >>> d = {}
     >>> for k, v in s:
     ...     d.setdefault(k, []).append(v)
     ...
     >>> sorted(d.items())
     [('blue', [2, 4]), ('red', [1]), ('yellow', [1, 3])]

*note default_factory: 2985. を *note int: 19b. にすると、 *note
defaultdict: 13d4. を(他の言語の bag や multisetのように)要素の数え上げ
に便利に使うことができます:

     >>> s = 'mississippi'
     >>> d = defaultdict(int)
     >>> for k in s:
     ...     d[k] += 1
     ...
     >>> sorted(d.items())
     [('i', 4), ('m', 1), ('p', 2), ('s', 4)]

最初に文字が出現したときは、マッピングが存在しないので *note
default_factory: 2985. 関数が *note int(): 19b. を呼んでデフォルトのカウ
ント0を生成します。インクリメント操作が各文字を数え上げます。

常に0を返す *note int(): 19b. は特殊な関数でした。定数を生成するより速く
て柔軟な方法は、 0に限らず何でも定数を生成するラムダ関数を使うことです:

     >>> def constant_factory(value):
     ...     return lambda: value
     ...
     >>> d = defaultdict(constant_factory('<missing>'))
     >>> d.update(name='John', action='ran')
     >>> '%(name)s %(action)s to %(object)s' % d
     'John ran to <missing>'

*note default_factory: 2985. を *note set: 184. に設定することで、 *note
defaultdict: 13d4. をセットの辞書を作るために利用することができます:

     >>> s = [('red', 1), ('blue', 2), ('red', 3), ('blue', 4), ('red', 1), ('blue', 4)]
     >>> d = defaultdict(set)
     >>> for k, v in s:
     ...     d[k].add(v)
     ...
     >>> sorted(d.items())
     [('blue', {2, 4}), ('red', {1, 3})]


File: python.info,  Node: namedtuple 名前付きフィールドを持つタプルのファクトリ関数,  Next: OrderedDict オブジェクト,  Prev: defaultdict オブジェクト,  Up: collections --- コンテナデータ型

5.8.4.8 ‘namedtuple()’ 名前付きフィールドを持つタプルのファクトリ関数
.....................................................................

名前付きタプルは、タプルの中のすべての場所に意味を割り当てて、より読みや
すく自己解説的なコードを書けるようにします。通常のタプルが利用される場所
ならどこでも利用でき、場所に対するインデックスの代わりに名前を使ってフィ
ールドにアクセスできるようになります。

 -- の関数: collections.namedtuple (typename, field_names, *,
          rename=False, defaults=None, module=None)

     'typename' という名前の tuple の新しいサブクラスを返します。新しい
     サブクラスは、 tuple に似ているけれどもインデックスやイテレータだけ
     でなく属性名によるアクセスもできるオブジェクトを作るのに使います。
     このサブクラスのインスタンスは、わかりやすい docstring (型名と属性
     名が入っています) や、 tuple の内容を ‘name=value’ という形のリスト
     で返す使いやすい *note __repr__(): 82f. も持っています。

     'field_names' は ‘['x', 'y']’ のような文字列のシーケンスです。
     'field_names' には、代わりに各属性名を空白文字 (whitespace) および
     /またはカンマ (,) で区切った文字列を渡すこともできます。例えば、
     ‘'x y'’ や ‘'x, y'’ です。

     アンダースコア (_) で始まる名前を除いて、 Python の正しい識別子
     (identifier) ならなんでも属性名として使うことができます。正しい識別
     子とはアルファベット(letters), 数字(digits), アンダースコア(_) を含
     みますが、数字やアンダースコアで始まる名前や、 'class', 'for',
     'return', 'global', 'pass', 'raise' などといった *note keyword: 88.
     は使えません。

     'rename' が真の場合、不適切なフィールド名は自動的に位置を示す名前に
     置き換えられます。例えば ‘['abc', 'def', 'ghi', 'abc']’ は、予約語
     の ‘def’ と、重複しているフィールド名の ‘abc’ が除去され、‘['abc',
     '_1', 'ghi', '_3']’ に変換されます。

     'defaults' には ‘None’ あるいはデフォルト値の *note iterable: 12f1.
     が指定できます。 デフォルト値を持つフィールドはデフォルト値を持たな
     いフィールドより後ろに来なければならないので、 'defaults' は最も右
     にある変数に適用されます。 例えば、 field_names が ‘['x', 'y',
     'z']’ で defaults が ‘(1, 2)’ の場合、 ‘x’ は必須の引数、 ‘y’ は
     ‘1’ がデフォルト、 ‘z’ は ‘2’ がデフォルトとなります。

     もし 'module' が指定されていれば、名前付きタプルの *note
     __module__: 617. 属性は、指定された値に設定されます

     名前付きタプルのインスタンスはインスタンスごとの辞書を持たないので
     、軽量で、普通のタプル以上のメモリを使用しません。

     pickle 化をサポートするには、名前付きタプルのクラス定義は
     'typename' と同じ名前の変数に割り当てなければなりません。

     バージョン 3.1 で変更: 'rename' のサポートが追加されました。

     バージョン 3.6 で変更: 'verbose' と 'rename' 引数が *note
     キーワード専用引数: 5a5. になりました.

     バージョン 3.6 で変更: 'module' 引数が追加されました。

     バージョン 3.7 で変更: 'verbose' 引数と ‘_source’ 属性が削除されま
     した。

     バージョン 3.7 で変更: 'defaults' 引数と *note _field_defaults:
     2989. 属性が追加されました。

     >>> # Basic example
     >>> Point = namedtuple('Point', ['x', 'y'])
     >>> p = Point(11, y=22)     # instantiate with positional or keyword arguments
     >>> p[0] + p[1]             # indexable like the plain tuple (11, 22)
     33
     >>> x, y = p                # unpack like a regular tuple
     >>> x, y
     (11, 22)
     >>> p.x + p.y               # fields also accessible by name
     33
     >>> p                       # readable __repr__ with a name=value style
     Point(x=11, y=22)

名前付きタプルは *note csv: 2d. や *note sqlite3: d4. モジュールが返すタ
プルのフィールドに名前を付けるときにとても便利です:

     EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, paygrade')

     import csv
     for emp in map(EmployeeRecord._make, csv.reader(open("employees.csv", "rb"))):
         print(emp.name, emp.title)

     import sqlite3
     conn = sqlite3.connect('/companydata')
     cursor = conn.cursor()
     cursor.execute('SELECT name, age, title, department, paygrade FROM employees')
     for emp in map(EmployeeRecord._make, cursor.fetchall()):
         print(emp.name, emp.title)

タプルから継承したメソッドに加えて、名前付きタプルは3つの追加メソッドと
2つの属性をサポートしています。フィールド名との衝突を避けるために、メソ
ッド名と属性名はアンダースコアで始まります。

 -- メソッド: classmethod somenamedtuple._make (iterable)

     既存の sequence や Iterable から新しいインスタンスを作るクラスメソ
     ッド.

          >>> t = [11, 22]
          >>> Point._make(t)
          Point(x=11, y=22)

 -- メソッド: somenamedtuple._asdict ()

     フィールド名を対応する値にマッピングする新しい *note dict: 183. を
     返します:

          >>> p = Point(x=11, y=22)
          >>> p._asdict()
          {'x': 11, 'y': 22}

     バージョン 3.1 で変更: 通常の *note dict: 183. の代わりに *note
     OrderedDict: 7f3. を返すようになりました。

     バージョン 3.8 で変更: *note collections.OrderedDict: 7f3. ではなく
     *note dict: 183. を返すようになりました。Python 3.7以降は、通常の辞
     書で順番が保証されています。 *note OrderedDict: 7f3. 特有の機能を使
     いたい場合は、結果を ‘OrderedDict(nt._asdict())’ 型にキャストして使
     用することを推奨します。

 -- メソッド: somenamedtuple._replace (**kwargs)

     指定されたフィールドを新しい値で置き換えた、新しい名前付きタプルを
     作って返します:

          >>> p = Point(x=11, y=22)
          >>> p._replace(x=33)
          Point(x=33, y=22)

          >>> for partnum, record in inventory.items():
          ...     inventory[partnum] = record._replace(price=newprices[partnum], timestamp=time.now())

     名前付きタプルは汎用的な関数 *note copy.replace(): 1c0. にもサポー
     トされています。

     バージョン 3.13 で変更: キーワード引数が無効な場合は *note
     ValueError: 2ec. のかわりに *note TypeError: 198. が発生します。

 -- の属性: somenamedtuple._fields

     フィールド名をリストにしたタプルです。内省 (introspection) したり、
     既存の名前付きタプルをもとに新しい名前つきタプルを作成する時に便利
     です。

          >>> p._fields            # view the field names
          ('x', 'y')

          >>> Color = namedtuple('Color', 'red green blue')
          >>> Pixel = namedtuple('Pixel', Point._fields + Color._fields)
          >>> Pixel(11, 22, 128, 255, 0)
          Pixel(x=11, y=22, red=128, green=255, blue=0)

 -- の属性: somenamedtuple._field_defaults

     フィールド名からデフォルト値への対応を持つ辞書です。

          >>> Account = namedtuple('Account', ['type', 'balance'], defaults=[0])
          >>> Account._field_defaults
          {'balance': 0}
          >>> Account('premium')
          Account(type='premium', balance=0)

文字列に格納された名前を使って名前つきタプルから値を取得するには *note
getattr(): dca. 関数を使います:

     >>> getattr(p, 'x')
     11

辞書を名前付きタプルに変換するには、 ‘**’ 演算子 (double-star-operator,
*note 引数リストのアンパック: 2011. で説明しています) を使います。:

     >>> d = {'x': 11, 'y': 22}
     >>> Point(**d)
     Point(x=11, y=22)

名前付きタプルは通常の Python クラスなので、継承して機能を追加したり変更
するのは容易です。次の例では計算済みフィールドと固定幅の print format を
追加しています:

     >>> class Point(namedtuple('Point', ['x', 'y'])):
     ...     __slots__ = ()
     ...     @property
     ...     def hypot(self):
     ...         return (self.x ** 2 + self.y ** 2) ** 0.5
     ...     def __str__(self):
     ...         return 'Point: x=%6.3f  y=%6.3f  hypot=%6.3f' % (self.x, self.y, self.hypot)

     >>> for p in Point(3, 4), Point(14, 5/7):
     ...     print(p)
     Point: x= 3.000  y= 4.000  hypot= 5.000
     Point: x=14.000  y= 0.714  hypot=14.018

このサブクラスは ‘__slots__’ に空のタプルをセットしています。これにより
、インスタンス辞書の作成を抑制してメモリ使用量を低く保つのに役立ちます。

サブクラス化は新しいフィールドを追加するのには適していません。代わりに、
新しい名前付きタプルを *note _fields: 298c. 属性を元に作成してください:

     >>> Point3D = namedtuple('Point3D', Point._fields + ('z',))

‘__doc__’ フィールドに直接代入することでドックストリングをカスタマイズす
ることが出来ます:

     >>> Book = namedtuple('Book', ['id', 'title', 'authors'])
     >>> Book.__doc__ += ': Hardcover book in active collection'
     >>> Book.id.__doc__ = '13-digit ISBN'
     >>> Book.title.__doc__ = 'Title of first printing'
     >>> Book.authors.__doc__ = 'List of authors sorted by last name'

バージョン 3.5 で変更: 属性ドックストリングが書き込み可能になりました。

参考
....

   * 名前付きタプルに型ヒントを追加する方法については、 *note
     typing.NamedTuple: 331. を参照してください。 *note class: 14ef. キ
     ーワードを使った洗練された記法も紹介されています:

          class Component(NamedTuple):
              part_number: int
              weight: float
              description: Optional[str] = None

   * タプルではなく、辞書をもとにした変更可能な名前空間を作成するには
     *note types.SimpleNamespace(): 4e5. を参照してください。

   * *note dataclasses: 33. モジュールは、生成される特殊メソッドをユーザ
     ー定義クラスに自動的に追加するためのデコレータや関数を提供していま
     す。


File: python.info,  Node: OrderedDict オブジェクト,  Next: UserDict オブジェクト,  Prev: namedtuple 名前付きフィールドを持つタプルのファクトリ関数,  Up: collections --- コンテナデータ型

5.8.4.9 ‘OrderedDict’ オブジェクト
..................................

順序付き辞書は普通の辞書のようですが、順序操作に関係する追加の機能があり
ます。 組み込みの *note dict: 183. クラスが挿入順序を記憶しておく機能 (こ
の新しい振る舞いは Python 3.7 で保証されるようになりました) を獲得した今
となっては、順序付き辞書の重要性は薄れました。

いまだ残っている *note dict: 183. との差分:

   * 通常の *note dict: 183. は対応付けに向いているように設計されました
     。 挿入順序の追跡は二の次です。

   * *note OrderedDict: 7f3. は並べ替え操作に向いているように設計されま
     した。 空間効率、反復処理の速度、更新操作のパフォーマンスは二の次で
     す。

   * *note OrderedDict: 7f3. のアルゴリズムは、頻繁な並べ替え処理を
     *note dict: 183. よりもうまく扱うことができます。後述のレシピに示さ
     れている通り、この性質はさまざまな種類の LRU キャッシュの実装に適し
     ています。

   * *note OrderedDict: 7f3. に対する等価演算は突き合わせ順序もチェック
     します。

     組み込みの *note dict: 183. では、順序を考慮した等価演算は ‘p == q
     and all(k1 == k2 for k1, k2 in zip(p, q))’ で実現することができます
     。

   * *note OrderedDict: 7f3. の *note popitem(): 1505. メソッドはシグネ
     チャが異なります。 どの要素を取り出すかを指定するオプション引数を受
     け付けます。

     組み込みの *note dict: 183. の場合、 OrderedDict の
     ‘od.popitem(last=True)’ と同じ機能は、最も右側の (最後の) 要素を取
     り出すことが保証されている ‘d.popitem()’ が果たします。

     組み込みの *note dict: 183. の場合、 OrderedDict の
     ‘od.popitem(last=False)’ は ‘(k := next(iter(d)), d.pop(k))’ で実現
     できます。これにより、該当する要素のうちで最も左側の (先頭の) もの
     を辞書から削除して返すことができます。

   * *note OrderedDict: 7f3. には、 効率的に要素を末尾に置き直す *note
     move_to_end(): 13f8. メソッドがあります。

     組み込みの *note dict: 183. の場合、キーと値のペアを最も右側 (末尾)
     に移動する OrderedDict の ‘od.move_to_end(k, last=True)’ は ‘d[k] =
     d.pop(k)’ で実現できます。

     組み込みの *note dict: 183. では、キーと値のペアを最も左側 (先頭) に
     移動する OrderedDict の ‘od.move_to_end(k, last=False)’ を実現する
     効率の良い方法はありません。

   * Python 3.8 以前は、 *note dict: 183. には *note __reversed__():
     e86. メソッドが欠けています。

 -- クラス: collections.OrderedDict ([items])

     辞書の順序を並べ直すためのメソッドを持つ *note dict: 183. のサブク
     ラスのインスタンスを返します。

     Added in version 3.1.

      -- メソッド: popitem (last=True)

          順序付き辞書の *note popitem(): 1505. メソッドは、(key, value)
          対を返して消去します。この対は 'last' が真なら LIFO で、偽なら
          FIFO (first-in, first-out, 先入先出) で返されます。

      -- メソッド: move_to_end (key, last=True)

          存在する 'key' を順序付き辞書の先頭または末尾に移動します。要
          素は 'last' が真 (デフォルト) の場合に最も右側すなわち末尾に移
          動します。また 'last' が偽の場合には先頭に移動します。指定した
          'key' が存在しない場合は *note KeyError: 5e7. を送出します。

               >>> d = OrderedDict.fromkeys('abcde')
               >>> d.move_to_end('b')
               >>> ''.join(d)
               'acdeb'
               >>> d.move_to_end('b', last=False)
               >>> ''.join(d)
               'bacde'

          Added in version 3.2.

通常のマッピングのメソッドに加え、順序付き辞書は *note reversed(): a65.
による逆順の反復もサポートしています。 Equality tests between *note
OrderedDict: 7f3. objects are order-sensitive and are roughly equivalent
to ‘list(od1.items())==list(od2.items())’.

Equality tests between *note OrderedDict: 7f3. objects and other *note
Mapping: ac7. objects are order-insensitive like regular dictionaries.
This allows *note OrderedDict: 7f3. objects to be substituted anywhere a
regular dictionary is used.

バージョン 3.5 で変更: *note OrderedDict: 7f3. の項目、キー、値の *note
ビュー: 298e. が *note reversed(): a65. による逆順の反復をサポートするよ
うになりました。

バージョン 3.6 で変更: PEP 468(1) の受理によって、*note OrderedDict:
7f3. のコンストラクタと、*note update(): 167e. メソッドに渡したキーワー
ド引数の順序は保持されます。

バージョン 3.9 で変更: PEP 584(2) で規定されている合成演算子 (‘|’) と更
新演算子 (‘|=’)が追加されました。

* Menu:

* OrderedDict の例とレシピ::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0468/

   (2) https://peps.python.org/pep-0584/


File: python.info,  Node: OrderedDict の例とレシピ,  Up: OrderedDict オブジェクト

5.8.4.10 ‘OrderedDict’ の例とレシピ
...................................

キーが '最後に' 追加されたときの順序を記憶する、順序付き辞書の変種を作る
のは簡単です。 新しい値が既存の値を上書きする場合、元々の挿入位置が最後
尾へ変更されます:

     class LastUpdatedOrderedDict(OrderedDict):
         'Store items in the order the keys were last added'

         def __setitem__(self, key, value):
             super().__setitem__(key, value)
             self.move_to_end(key)

*note OrderedDict: 7f3. は *note functools.lru_cache(): be2. の変種を実
装するのにも役に立ちます:

     from collections import OrderedDict
     from time import time

     class TimeBoundedLRU:
         "LRU Cache that invalidates and refreshes old entries."

         def __init__(self, func, maxsize=128, maxage=30):
             self.cache = OrderedDict()      # { args : (timestamp, result)}
             self.func = func
             self.maxsize = maxsize
             self.maxage = maxage

         def __call__(self, *args):
             if args in self.cache:
                 self.cache.move_to_end(args)
                 timestamp, result = self.cache[args]
                 if time() - timestamp <= self.maxage:
                     return result
             result = self.func(*args)
             self.cache[args] = time(), result
             if len(self.cache) > self.maxsize:
                 self.cache.popitem(last=False)
             return result

     class MultiHitLRUCache:
         """ LRU cache that defers caching a result until
             it has been requested multiple times.

             To avoid flushing the LRU cache with one-time requests,
             we don't cache until a request has been made more than once.

         """

         def __init__(self, func, maxsize=128, maxrequests=4096, cache_after=1):
             self.requests = OrderedDict()   # { uncached_key : request_count }
             self.cache = OrderedDict()      # { cached_key : function_result }
             self.func = func
             self.maxrequests = maxrequests  # max number of uncached requests
             self.maxsize = maxsize          # max number of stored return values
             self.cache_after = cache_after

         def __call__(self, *args):
             if args in self.cache:
                 self.cache.move_to_end(args)
                 return self.cache[args]
             result = self.func(*args)
             self.requests[args] = self.requests.get(args, 0) + 1
             if self.requests[args] <= self.cache_after:
                 self.requests.move_to_end(args)
                 if len(self.requests) > self.maxrequests:
                     self.requests.popitem(last=False)
             else:
                 self.requests.pop(args, None)
                 self.cache[args] = result
                 if len(self.cache) > self.maxsize:
                     self.cache.popitem(last=False)
             return result


File: python.info,  Node: UserDict オブジェクト,  Next: UserList オブジェクト,  Prev: OrderedDict オブジェクト,  Up: collections --- コンテナデータ型

5.8.4.11 ‘UserDict’ オブジェクト
................................

クラス *note UserDict: 1d7d. は、辞書オブジェクトのラッパとしてはたらき
ます。このクラスの必要性は、 *note dict: 183. から直接的にサブクラス化で
きる能力に部分的に取って代わられました; しかし、根底の辞書に属性としてア
クセスできるので、このクラスを使った方が簡単になることもあります。

 -- クラス: collections.UserDict ([initialdata])

     辞書をシミュレートするクラスです。インスタンスの内容は通常の辞書に
     保存され、 *note UserDict: 1d7d. インスタンスの *note data: 2991. 属
     性を通してアクセスできます。 'initialdata' が与えられれば、 *note
     data: 2991. はその内容で初期化されます。他の目的のために使えるよう
     に、 'initialdata' への参照が保存されないことに注意してください。

     マッピングのメソッドと演算をサポートするのに加え、 *note UserDict:
     1d7d. インスタンスは以下の属性を提供します:

      -- の属性: data

          *note UserDict: 1d7d. クラスの内容を保存するために使われる実際
          の辞書です。


File: python.info,  Node: UserList オブジェクト,  Next: UserString オブジェクト,  Prev: UserDict オブジェクト,  Up: collections --- コンテナデータ型

5.8.4.12 ‘UserList’ オブジェクト
................................

このクラスはリストオブジェクトのラッパとしてはたらきます。これは独自のリ
スト風クラスの基底クラスとして便利で、既存のメソッドをオーバーライドした
り新しいメソッドを加えたりできます。こうして、リストに新しい振る舞いを加
えられます。

このクラスの必要性は、 *note list: 24d. から直接的にサブクラス化できる能
力に部分的に取って代わられました; しかし、根底のリストに属性としてアクセ
スできるので、このクラスを使った方が簡単になることもあります。

 -- クラス: collections.UserList ([list])

     リストをシミュレートするクラスです。インスタンスの内容は通常のリス
     トに保存され、 *note UserList: 16fd. インスタンスの *note data:
     2993. 属性を通してアクセスできます。インスタンスの内容は最初に
     'list' のコピーに設定されますが、デフォルトでは空リスト ‘[]’ です。
     'list' は何らかのイテラブル、例えば通常の Python リストや *note
     UserList: 16fd. オブジェクト、です。

     ミュータブルシーケンスのメソッドと演算をサポートするのに加え、
     *note UserList: 16fd. インスタンスは以下の属性を提供します:

      -- の属性: data

          *note UserList: 16fd. クラスの内容を保存するために使われる実際
          の *note list: 24d. オブジェクトです。

'サブクラス化の要件:' *note UserList: 16fd. のサブクラスは引数なしか、あ
るいは一つの引数のどちらかとともに呼び出せるコンストラクタを提供すること
が期待されています。新しいシーケンスを返すリスト演算は現在の実装クラスの
インスタンスを作成しようとします。そのために、データ元として使われるシー
ケンスオブジェクトである一つのパラメータとともにコンストラクタを呼び出せ
ると想定しています。

派生クラスがこの要求に従いたくないならば、このクラスがサポートしているす
べての特殊メソッドはオーバーライドされる必要があります。その場合に提供さ
れる必要のあるメソッドについての情報は、ソースを参考にしてください。


File: python.info,  Node: UserString オブジェクト,  Prev: UserList オブジェクト,  Up: collections --- コンテナデータ型

5.8.4.13 ‘UserString’ オブジェクト
..................................

クラス *note UserString: fd3. は、文字列オブジェクトのラッパとしてはたら
きます。このクラスの必要性は、 *note str: 169. から直接的にサブクラス化
できる能力に部分的に取って代わられました; しかし、根底の文字列に属性とし
てアクセスできるので、このクラスを使った方が簡単になることもあります。

 -- クラス: collections.UserString (seq)

     文字列オブジェクトをシミュレートするクラスです。 インスタンスの内容
     は通常の文字列に保存され、 *note UserString: fd3. インスタンスの
     *note data: 2995. 属性を通してアクセスできます。 インスタンスの内容
     には最初に 'seq' のコピーが設定されます。 'seq' 引数は、組み込みの
     *note str(): 169. 関数で文字列に変換できる任意のオブジェクトです。

     文字列のメソッドと演算をサポートするのに加え、 *note UserString:
     fd3. インスタンスは次の属性を提供します:

      -- の属性: data

          *note UserString: fd3. クラスの内容を保存するために使われる実
          際の *note str: 169. オブジェクトです。

     バージョン 3.5 で変更: 新たなメソッド ‘__getnewargs__’, ‘__rmod__’,
     ‘casefold’, ‘format_map’, ‘isprintable’, ‘maketrans’。


File: python.info,  Node: collections abc --- コンテナの抽象基底クラス,  Next: heapq --- ヒープキューアルゴリズム,  Prev: collections --- コンテナデータ型,  Up: データ型

5.8.5 ‘collections.abc’ -- コンテナの抽象基底クラス
---------------------------------------------------

Added in version 3.3: 以前はこのモジュールは *note collections: 1e. モジ
ュールの一部でした。

'ソースコード:' Lib/_collections_abc.py(1)

__________________________________________________________________

このモジュールは、 *note 抽象基底クラス: 13ce. を提供します。抽象基底ク
ラスは、クラスが特定のインターフェースを提供しているか、例えば *note
ハッシュ可能: 824. であるかや *note マッピング: 13d3. であるかを判定しま
す。

*note issubclass(): 9c4. や *note isinstance(): 2ad. を使ったインターフ
ェースに対するテストは、以下の3つのいずれかの方法で動作します。

  1. A newly written class can inherit directly from one of the abstract
     base classes.  The class must supply the required abstract methods.
     The remaining mixin methods come from inheritance and can be
     overridden if desired.  Other methods may be added as needed:

          class C(Sequence):                      # Direct inheritance
              def __init__(self): ...             # Extra method not required by the ABC
              def __getitem__(self, index):  ...  # Required abstract method
              def __len__(self):  ...             # Required abstract method
              def count(self, value): ...         # Optionally override a mixin method

          >>> issubclass(C, Sequence)
          True
          >>> isinstance(C(), Sequence)
          True

  2. Existing classes and built-in classes can be registered as "virtual
     subclasses" of the ABCs.  Those classes should define the full API
     including all of the abstract methods and all of the mixin methods.
     This lets users rely on *note issubclass(): 9c4. or *note
     isinstance(): 2ad. tests to determine whether the full interface is
     supported.  The exception to this rule is for methods that are
     automatically inferred from the rest of the API:

          class D:                                 # No inheritance
              def __init__(self): ...              # Extra method not required by the ABC
              def __getitem__(self, index):  ...   # Abstract method
              def __len__(self):  ...              # Abstract method
              def count(self, value): ...          # Mixin method
              def index(self, value): ...          # Mixin method

          Sequence.register(D)                     # Register instead of inherit

          >>> issubclass(D, Sequence)
          True
          >>> isinstance(D(), Sequence)
          True

     この例では、クラス ‘D’ は ‘__contains__’, ‘__iter__’,
     ‘__reversed__’ を定義する必要がありません。なぜなら *note in
     演算子: 24d0, the *note 反復: 12f1. ロジック, および *note
     reversed(): a65. 関数は自動的に ‘__getitem__’ と ‘__len__’ を使うよ
     うにフォールバックするからです。

  3. Some simple interfaces are directly recognizable by the presence of
     the required methods (unless those methods have been set to *note
     None: 885.):

          class E:
              def __iter__(self): ...
              def __next__(self): ...

          >>> issubclass(E, Iterable)
          True
          >>> isinstance(E(), Iterable)
          True

     複雑なインターフェースは、単に特定のメソッドが存在すること以上の定
     義を持つため、3番目のテクニックをサポートしていません。それらのイン
     ターフェースはメソッドの意味やメソッド間の関係まで指定するので、特
     定のメソッド名の存在からだけではインターフェースの推測ができません
     。たとえば、あるクラスが ‘__getitem__’, ‘__len__’, および
     ‘__iter__’ を提供するというだけでは、 *note Sequence: 13dc. と
     *note Mapping: ac7. を区別するには不十分です。

Added in version 3.9: これらの抽象クラスは ‘[]’ をサポートするようになり
ました。 *note ジェネリックエイリアス型: 8c1. および PEP 585(2) を参照し
てください。

* Menu:

* コレクション抽象基底クラス::
* コレクションの抽象基底クラス: コレクションの抽象基底クラス -- 詳細な説明. 詳細な説明
* 例とレシピ::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/_collections_abc.py

   (2) https://peps.python.org/pep-0585/


File: python.info,  Node: コレクション抽象基底クラス,  Next: コレクションの抽象基底クラス -- 詳細な説明,  Up: collections abc --- コンテナの抽象基底クラス

5.8.5.1 コレクション抽象基底クラス
..................................

collections モジュールは以下の *note ABC (抽象基底クラス): 13ce. を提供
します:

ABC                                継承しているクラス         抽象メソッド                mixin メソッド
                                                                                          
---------------------------------------------------------------------------------------------------------------------------------------------------
                                                                                          
*note Container: 26b0. (1)                                    ‘__contains__’
                                                              
                                                                                          
*note Hashable: 719. (2)                                      ‘__hash__’
                                                              
                                                                                          
*note Iterable: 26ae. (3) (4)                                 ‘__iter__’
                                                              
                                                                                          
*note Iterator: 26af. (5)          *note Iterable: 26ae.      ‘__next__’                  ‘__iter__’
                                                                                          
                                                                                          
*note Reversible: e85. (6)         *note Iterable: 26ae.      ‘__reversed__’
                                                              
                                                                                          
*note Generator: fdb. (7)          *note Iterator: 26af.      ‘send’, ‘throw’             ‘close’, ‘__iter__’, ‘__next__’
                                                                                          
                                                                                          
*note Sized: 71a. (8)                                         ‘__len__’
                                                              
                                                                                          
*note Callable: 9eb. (9)                                      ‘__call__’
                                                              
                                                                                          
*note Collection: e84. (10)        *note Sized: 71a,          ‘__contains__’,
                                   *note Iterable: 26ae,      ‘__iter__’, ‘__len__’
                                   *note Container: 26b0.     
                                   
                                                                                          
*note Sequence: 13dc.              *note Reversible: e85,     ‘__getitem__’, ‘__len__’    ‘__contains__’, ‘__iter__’, ‘__reversed__’, ‘index’,
                                   *note Collection: e84.                                 ‘count’
                                                                                          
                                                                                          
*note MutableSequence: 4bf.        *note Sequence: 13dc.      ‘__getitem__’,              *note Sequence: 13dc. から継承したメソッドと、
                                                              ‘__setitem__’,              ‘append’, ‘clear’, ‘reverse’, ‘extend’, ‘pop’,
                                                              ‘__delitem__’, ‘__len__’,   ‘remove’, ‘__iadd__’
                                                              ‘insert’                    
                                                              
                                                                                          
*note ByteString: 342.             *note Sequence: 13dc.      ‘__getitem__’, ‘__len__’    *note Sequence: 13dc. から継承したメソッド
                                                                                          
                                                                                          
*note Set: 26a6.                   *note Collection: e84.     ‘__contains__’,             ‘__le__’, ‘__lt__’, ‘__eq__’, ‘__ne__’, ‘__gt__’,
                                                              ‘__iter__’, ‘__len__’       ‘__ge__’, ‘__and__’, ‘__or__’, ‘__sub__’, ‘__rsub__’,
                                                                                          ‘__xor__’, ‘__rxor__’ and ‘isdisjoint’
                                                                                          
                                                                                          
*note MutableSet: 26b1.            *note Set: 26a6.           ‘__contains__’,             *note Set: 26a6. から継承したメソッドと、 ‘clear’,
                                                              ‘__iter__’, ‘__len__’,      ‘pop’, ‘remove’, ‘__ior__’, ‘__iand__’, ‘__ixor__’,
                                                              ‘add’, ‘discard’            ‘__isub__’
                                                                                          
                                                                                          
*note Mapping: ac7.                *note Collection: e84.     ‘__getitem__’,              ‘__contains__’, ‘keys’, ‘items’, ‘values’, ‘get’,
                                                              ‘__iter__’, ‘__len__’       ‘__eq__’, ‘__ne__’
                                                                                          
                                                                                          
*note MutableMapping: 12c0.        *note Mapping: ac7.        ‘__getitem__’,              *note Mapping: ac7. から継承したメソッドと、 ‘pop’,
                                                              ‘__setitem__’,              ‘popitem’, ‘clear’, ‘update’, ‘setdefault’
                                                              ‘__delitem__’,              
                                                              ‘__iter__’, ‘__len__’
                                                              
                                                                                          
*note MappingView: 26b2.           *note Sized: 71a.                                      ‘__init__’, ‘__len__’ and ‘__repr__’
                                                                                          
                                                                                          
*note ItemsView: 26b4.             *note MappingView: 26b2,                               ‘__contains__’, ‘__iter__’
                                   *note Set: 26a6.                                       
                                   
                                                                                          
*note KeysView: 26b3.              *note MappingView: 26b2,                               ‘__contains__’, ‘__iter__’
                                   *note Set: 26a6.                                       
                                   
                                                                                          
*note ValuesView: 26b5.            *note MappingView: 26b2,                               ‘__contains__’, ‘__iter__’
                                   *note Collection: e84.                                 
                                   
                                                                                          
*note Awaitable: fdc. (11)                                    ‘__await__’
                                                              
                                                                                          
*note Coroutine: fdd. (12)         *note Awaitable: fdc.      ‘send’, ‘throw’             ‘close’
                                                                                          
                                                                                          
*note AsyncIterable: fdf. (13)                                ‘__aiter__’
                                                              
                                                                                          
*note AsyncIterator: fde. (14)     *note AsyncIterable: fdf.  ‘__anext__’                 ‘__aiter__’
                                                                                          
                                                                                          
*note AsyncGenerator: e87. (15)    *note AsyncIterator: fde.  ‘asend’, ‘athrow’           ‘aclose’, ‘__aiter__’, ‘__anext__’
                                                                                          
                                                                                          
*note Buffer: 343. (16)                                       ‘__buffer__’
                                                              

脚注
....

   ---------- Footnotes ----------

   (1) これらの抽象基底クラスは *note __subclasshook__(): 299a. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 885. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (2) これらの抽象基底クラスは *note __subclasshook__(): 299a. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 885. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (3) これらの抽象基底クラスは *note __subclasshook__(): 299a. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 885. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (4) ‘isinstance(obj, Iterable)’ によるチェックは *note Iterable:
26ae. として登録されたクラスや *note __iter__(): 20aa. メソッドを持つク
ラスを検出しますが、 *note __getitem__(): 588. メソッドにより反復処理を
行うクラスは検出しません。オブジェクトがイテラブル (*note iterable:
12f1.) かどうかを確認する唯一の信頼できる方法は ‘iter(obj)’ を呼び出すこ
とです。

   (5) これらの抽象基底クラスは *note __subclasshook__(): 299a. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 885. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (6) これらの抽象基底クラスは *note __subclasshook__(): 299a. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 885. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (7) これらの抽象基底クラスは *note __subclasshook__(): 299a. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 885. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (8) これらの抽象基底クラスは *note __subclasshook__(): 299a. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 885. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (9) これらの抽象基底クラスは *note __subclasshook__(): 299a. をオーバ
ーライドして、必要なメソッドが存在し、かつ *note None: 885. に指定されて
いないことを確かめることによってインターフェースをテストすることをサポー
トします。このテストは単純なインターフェースに対してのみ有効に働きます。
より複雑なインターフェースは基底クラスへの登録や直接派生することが必要に
なります。

   (10) これらの抽象基底クラスは *note __subclasshook__(): 299a. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: 885. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (11) これらの抽象基底クラスは *note __subclasshook__(): 299a. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: 885. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (12) これらの抽象基底クラスは *note __subclasshook__(): 299a. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: 885. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (13) これらの抽象基底クラスは *note __subclasshook__(): 299a. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: 885. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (14) これらの抽象基底クラスは *note __subclasshook__(): 299a. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: 885. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (15) これらの抽象基底クラスは *note __subclasshook__(): 299a. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: 885. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。

   (16) これらの抽象基底クラスは *note __subclasshook__(): 299a. をオー
バーライドして、必要なメソッドが存在し、かつ *note None: 885. に指定され
ていないことを確かめることによってインターフェースをテストすることをサポ
ートします。このテストは単純なインターフェースに対してのみ有効に働きます
。より複雑なインターフェースは基底クラスへの登録や直接派生することが必要
になります。


File: python.info,  Node: コレクションの抽象基底クラス -- 詳細な説明,  Next: 例とレシピ,  Prev: コレクション抽象基底クラス,  Up: collections abc --- コンテナの抽象基底クラス

5.8.5.2 コレクションの抽象基底クラス - 詳細な説明
.................................................

 -- クラス: collections.abc.Container

     *note __contains__(): 15d3. メソッドを提供するクラスの ABC です。

 -- クラス: collections.abc.Hashable

     *note __hash__(): cf3. メソッドを提供するクラスの ABC です。

 -- クラス: collections.abc.Sized

     *note __len__(): 178f. メソッドを提供するクラスの ABC です。

 -- クラス: collections.abc.Callable

     *note __call__(): 77a. メソッドを提供するクラスの ABC です。

     ‘Callable’ を型アノテーションで使う方法の詳細は、 *note
     呼び出し可能オブジェクトのアノテーション: 26cf. を参照してください
     。

 -- クラス: collections.abc.Iterable

     *note __iter__(): 20aa. メソッドを提供するクラスの ABC です。

     ‘isinstance(obj, Iterable)’ によるチェックは *note Iterable: 26ae.
     として登録されたクラスや *note __iter__(): 20aa. メソッドを持つクラ
     スを検出しますが、 *note __getitem__(): 588. メソッドにより反復処理
     を行うクラスは検出しません。オブジェクトがイテラブル (*note
     iterable: 12f1.) かどうかを確認する唯一の信頼できる方法は
     ‘iter(obj)’ を呼び出すことです。

 -- クラス: collections.abc.Collection

     サイズ付きのイテラブルなコンテナクラスの ABC です。

     Added in version 3.6.

 -- クラス: collections.abc.Iterator

     *note __iter__(): 20ad. メソッドと *note __next__(): 14e5. メソッド
     を提供するクラスの ABC です。 *note iterator: 4c8. の定義も参照して
     ください。

 -- クラス: collections.abc.Reversible

     *note __reversed__(): e86. メソッドを提供するイテラブルクラスの ABC
     です。

     Added in version 3.6.

 -- クラス: collections.abc.Generator

     PEP 342(1) で定義された、*note イテレータ: 4c8. を *note send():
     126d, *note throw(): 71c, *note close(): 1793. の各メソッドに拡張す
     るプロトコルを実装する、*note ジェネレータ: 126c. クラスの ABC です
     。

     ‘Generator’ を型アノテーションで使う方法の詳細は、 *note Annotating
     generators and coroutines: 299c. を参照してください。

     Added in version 3.5.

 -- クラス: collections.abc.Sequence
 -- クラス: collections.abc.MutableSequence
 -- クラス: collections.abc.ByteString

     読み出し専用の *note シーケンス: 716. およびミュータブルな *note
     シーケンス: 716. の ABC です。

     Implementation note: Some of the mixin methods, such as *note
     __iter__(): 20aa, *note __reversed__(): e86, and *note index():
     1979. make repeated calls to the underlying *note __getitem__():
     588. method.  Consequently, if *note __getitem__(): 588. is
     implemented with constant access speed, the mixin methods will have
     linear performance; however, if the underlying method is linear (as
     it would be with a linked list), the mixins will have quadratic
     performance and will likely need to be overridden.

      -- メソッド: index (value, start=0, stop=None)

          Return first index of 'value'.

          Raises *note ValueError: 2ec. if the value is not present.

          Supporting the 'start' and 'stop' arguments is optional, but
          recommended.

          バージョン 3.5 で変更: The *note index(): 1979. method gained
          support for the 'stop' and 'start' arguments.

     Deprecated since version 3.12, will be removed in version 3.17: The
     *note ByteString: 342. ABC has been deprecated.

     Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
     implements the *note buffer protocol: 260. at runtime.  For use in
     type annotations, either use *note Buffer: 343. or a union that
     explicitly specifies the types your code supports (e.g., ‘bytes |
     bytearray | memoryview’).

     ‘ByteString’ was originally intended to be an abstract class that
     would serve as a supertype of both *note bytes: 192. and *note
     bytearray: 344.  However, since the ABC never had any methods,
     knowing that an object was an instance of ‘ByteString’ never
     actually told you anything useful about the object.  Other common
     buffer types such as *note memoryview: 165. were also never
     understood as subtypes of ‘ByteString’ (either at runtime or by
     static type checkers).

     See PEP 688(2) for more details.

 -- クラス: collections.abc.Set
 -- クラス: collections.abc.MutableSet

     読み出し専用でミュータブルな *note 集合: 2031. の ABC です。

 -- クラス: collections.abc.Mapping
 -- クラス: collections.abc.MutableMapping

     読み出し専用の *note マッピング: 13d3. およびミュータブルな *note
     マッピング: 13d3. の ABC です。

 -- クラス: collections.abc.MappingView
 -- クラス: collections.abc.ItemsView
 -- クラス: collections.abc.KeysView
 -- クラス: collections.abc.ValuesView

     マッピング、要素、キー、値の *note ビュー: 298e. の ABC です。

 -- クラス: collections.abc.Awaitable

     *note await: 18d. で使用できる *note awaitable: 4c9. オブジェクトの
     ABC です。カスタムの実装は、*note __await__(): f75. メソッドを提供
     しなければなりません。

     *note Coroutine: fdd. ABC の *note Coroutine: 6b9. オブジェクトとイ
     ンスタンスは、すべてこの ABC のインスタンスです。

          注釈: In CPython, generator-based coroutines (*note
          generators: 126c. decorated with *note @types.coroutine:
          1088.) are 'awaitables', even though they do not have an *note
          __await__(): f75. method.  Using ‘isinstance(gencoro,
          Awaitable)’ for them will return ‘False’.  Use *note
          inspect.isawaitable(): 1018. to detect them.

     Added in version 3.5.

 -- クラス: collections.abc.Coroutine

     *note コルーチン: 6b9. と互換性のあるクラスの ABC です。これらは、
     *note コルーチンオブジェクト: 2356. で定義された *note send():
     2419, *note throw(): 71b, *note close(): 241a. のメソッドを実装しま
     す。カスタムの実装は、*note __await__(): f75. も実装しなければなり
     ません。*note Coroutine: fdd. のすべてのインスタンスは、 *note
     Awaitable: fdc. のインスタンスでもあります。

          注釈: In CPython, generator-based coroutines (*note
          generators: 126c. decorated with *note @types.coroutine:
          1088.) are 'awaitables', even though they do not have an *note
          __await__(): f75. method.  Using ‘isinstance(gencoro,
          Coroutine)’ for them will return ‘False’.  Use *note
          inspect.isawaitable(): 1018. to detect them.

     ‘Coroutine’ を型アノテーションで使う方法の詳細は、 *note Annotating
     generators and coroutines: 299c. を参照してください。型パラメータの
     意味と順序は *note Generator: fdb. と同様です。

     Added in version 3.5.

 -- クラス: collections.abc.AsyncIterable

     ‘__aiter__’ メソッドを提供するクラスの ABC です。*note asynchronous
     iterable: f74. の定義も参照してください。

     Added in version 3.5.

 -- クラス: collections.abc.AsyncIterator

     ‘__aiter__’ および ‘__anext__’ メソッドを提供するクラスの ABC です
     。*note asynchronous iterator: 4c7. の定義も参照してください。

     Added in version 3.5.

 -- クラス: collections.abc.AsyncGenerator

     PEP 525(3) と PEP 492(4) に定義されているプロトコルを実装した *note
     非同期ジェネレータ: 249b. クラスの ABC です。

     ‘AsyncGenerator’ を型アノテーションで使う方法の詳細は、 *note
     Annotating generators and coroutines: 299c. を参照してください。

     Added in version 3.6.

 -- クラス: collections.abc.Buffer

     *note buffer protocol: 260. を実装する *note __buffer__(): 68c. メ
     ソッドを提供するクラスのABCです。 PEP 688(5) を参照してください。

     Added in version 3.12.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0342/

   (2) https://peps.python.org/pep-0688/#current-options

   (3) https://peps.python.org/pep-0525/

   (4) https://peps.python.org/pep-0492/

   (5) https://peps.python.org/pep-0688/


File: python.info,  Node: 例とレシピ,  Prev: コレクションの抽象基底クラス -- 詳細な説明,  Up: collections abc --- コンテナの抽象基底クラス

5.8.5.3 例とレシピ
..................

抽象基底クラスは、クラスやインスタンスが特定の機能を提供しているかどうか
を調べることを可能にします。例えば:

     size = None
     if isinstance(myvar, collections.abc.Sized):
         size = len(myvar)

幾つかの ABC はコンテナ型 API を提供するクラスを開発するのを助ける mixin
型としても使えます。例えば、 *note Set: 26a6. API を提供するクラスを作る
場合、3つの基本になる抽象メソッド *note __contains__(): 15d3, *note
__iter__(): 20aa, *note __len__(): 178f. だけが必要です。ABC が残りの
‘__and__()’ や *note isdisjoint(): 2692. といったメソッドを提供します:

     class ListBasedSet(collections.abc.Set):
         ''' Alternate set implementation favoring space over speed
             and not requiring the set elements to be hashable. '''
         def __init__(self, iterable):
             self.elements = lst = []
             for value in iterable:
                 if value not in lst:
                     lst.append(value)

         def __iter__(self):
             return iter(self.elements)

         def __contains__(self, value):
             return value in self.elements

         def __len__(self):
             return len(self.elements)

     s1 = ListBasedSet('abcdef')
     s2 = ListBasedSet('defghi')
     overlap = s1 & s2            # The __and__() method is supported automatically

*note Set: 26a6. と *note MutableSet: 26b1. を mixin 型として利用すると
きの注意点:

  1. 幾つかの set の操作は新しい set を作るので、デフォルトの mixin メソ
     ッドは *note イテラブル: 12f1. から新しいインスタンスを作成する方法
     を必要とします。クラスのコンストラクタは ‘ClassName(iterable)’ の形
     のシグネチャを持つと仮定されます。内部の ‘_from_iterable()’ という
     *note classmethod: 48e. が ‘cls(iterable)’ を呼び出して新しい set を
     作る部分でこの仮定が使われています。コンストラクタのシグネチャが異
     なるクラスで *note Set: 26a6. を使う場合は、 iterable 引数から新し
     いインスタンスを生成できるクラスメソッドあるいは仕様に沿ったメソッ
     ドで ‘_from_iterable()’ をオーバーライドする必要があります。

  2. (たぶん意味はそのままに速度を向上する目的で)比較をオーバーライドす
     る場合、 *note __le__(): 1522. と *note __ge__(): 1524. だけを再定
     義すれば、その他の演算は自動的に追随します。

  3. *note Set: 26a6. mixin型は set のハッシュ値を計算する ‘_hash()’ メ
     ソッドを提供しますが、すべての set が *note hashable: 824. や
     immutable とは限らないので、 *note __hash__(): cf3. は提供しません
     。 mixin を使ってハッシュ可能な set を作る場合は、 *note Set: 26a6.
     と *note Hashable(): 719. の両方を継承して、 ‘__hash__ = Set._hash’
     と定義してください。

参考
....

   * *note MutableSet: 26b1. を使った例として OrderedSet recipe(1)。

   * ABCs についての詳細は、 *note abc: 4. モジュールと PEP 3119(2) を参
     照してください。

   ---------- Footnotes ----------

   (1) https://code.activestate.com/recipes/576694/

   (2) https://peps.python.org/pep-3119/


File: python.info,  Node: heapq --- ヒープキューアルゴリズム,  Next: bisect --- 配列二分法アルゴリズム,  Prev: collections abc --- コンテナの抽象基底クラス,  Up: データ型

5.8.6 ‘heapq’ -- ヒープキューアルゴリズム
-----------------------------------------

'ソースコード:' Lib/heapq.py(1)

__________________________________________________________________

このモジュールではヒープキューアルゴリズムの一実装を提供しています。優先
度キューアルゴリズムとしても知られています。

Min-heaps are binary trees for which every parent node has a value less
than or equal to any of its children.  We refer to this condition as the
heap invariant.

For min-heaps, this implementation uses lists for which ‘heap[k] <=
heap[2*k+1]’ and ‘heap[k] <= heap[2*k+2]’ for all 'k' for which the
compared elements exist.  Elements are counted from zero.  The
interesting property of a min-heap is that its smallest element is
always the root, ‘heap[0]’.

Max-heaps satisfy the reverse invariant: every parent node has a value
'greater' than any of its children.  These are implemented as lists for
which ‘maxheap[2*k+1] <= maxheap[k]’ and ‘maxheap[2*k+2] <= maxheap[k]’
for all 'k' for which the compared elements exist.  The root,
‘maxheap[0]’, contains the 'largest' element; ‘heap.sort(reverse=True)’
maintains the max-heap invariant.

The ‘heapq’ API differs from textbook heap algorithms in two aspects:
(a) We use zero-based indexing.  This makes the relationship between the
index for a node and the indexes for its children slightly less obvious,
but is more suitable since Python uses zero-based indexing.  (b)
Textbooks often focus on max-heaps, due to their suitability for
in-place sorting.  Our implementation favors min-heaps as they better
correspond to Python *note lists: 24d.

These two aspects make it possible to view the heap as a regular Python
list without surprises: ‘heap[0]’ is the smallest item, and
‘heap.sort()’ maintains the heap invariant!

Like *note list.sort(): dc8, this implementation uses only the ‘<’
operator for comparisons, for both min-heaps and max-heaps.

In the API below, and in this documentation, the unqualified term 'heap'
generally refers to a min-heap.  The API for max-heaps is named using a
‘_max’ suffix.

To create a heap, use a list initialized as ‘[]’, or transform an
existing list into a min-heap or max-heap using the *note heapify():
29a2. or *note heapify_max(): 221. functions, respectively.

The following functions are provided for min-heaps:

 -- の関数: heapq.heapify (x)

     Transform list 'x' into a min-heap, in-place, in linear time.

 -- の関数: heapq.heappush (heap, item)

     Push the value 'item' onto the 'heap', maintaining the min-heap
     invariant.

 -- の関数: heapq.heappop (heap)

     Pop and return the smallest item from the 'heap', maintaining the
     min-heap invariant.  If the heap is empty, *note IndexError: 174e.
     is raised.  To access the smallest item without popping it, use
     ‘heap[0]’.

 -- の関数: heapq.heappushpop (heap, item)

     'item' を 'heap' に push した後、pop を行って 'heap' から最初の要素
     を返します。この一続きの動作を *note heappush(): 16d5. に引き続いて
     *note heappop(): 16d6. を別々に呼び出すよりも効率的に実行します。

 -- の関数: heapq.heapreplace (heap, item)

     'heap' から最小の要素を pop して返し、新たに 'item' を push します
     。ヒープのサイズは変更されません。ヒープが空の場合、 *note
     IndexError: 174e. が送出されます。

     この一息の演算は *note heappop(): 16d6. に次いで *note heappush():
     16d5. を送出するよりも効率的で、固定サイズのヒープを用いている場合
     にはより適しています。 pop/push の組み合わせは必ずヒープから要素を
     一つ返し、それを 'item' と置き換えます。

     返される値は加えられた 'item' よりも大きくなるかもしれません。それ
     を望まないなら、代わりに *note heappushpop(): 29a3. を使うことを考
     えてください。この push/pop の組み合わせは二つの値の小さい方を返し
     、大きい方の値をヒープに残します。

For max-heaps, the following functions are provided:

 -- の関数: heapq.heapify_max (x)

     Transform list 'x' into a max-heap, in-place, in linear time.

     Added in version 3.14.

 -- の関数: heapq.heappush_max (heap, item)

     Push the value 'item' onto the max-heap 'heap', maintaining the
     max-heap invariant.

     Added in version 3.14.

 -- の関数: heapq.heappop_max (heap)

     Pop and return the largest item from the max-heap 'heap',
     maintaining the max-heap invariant.  If the max-heap is empty,
     *note IndexError: 174e. is raised.  To access the largest item
     without popping it, use ‘maxheap[0]’.

     Added in version 3.14.

 -- の関数: heapq.heappushpop_max (heap, item)

     Push 'item' on the max-heap 'heap', then pop and return the largest
     item from 'heap'.  The combined action runs more efficiently than
     *note heappush_max(): 222. followed by a separate call to *note
     heappop_max(): 223.

     Added in version 3.14.

 -- の関数: heapq.heapreplace_max (heap, item)

     Pop and return the largest item from the max-heap 'heap' and also
     push the new 'item'.  The max-heap size doesn't change.  If the
     max-heap is empty, *note IndexError: 174e. is raised.

     The value returned may be smaller than the 'item' added.  Refer to
     the analogous function *note heapreplace(): 29a4. for detailed
     usage notes.

     Added in version 3.14.

このモジュールではさらに3つのヒープに基く汎用関数を提供します。

 -- の関数: heapq.merge (*iterables, key=None, reverse=False)

     複数のソートされた入力をマージ(merge)して一つのソートされた出力にし
     ます (たとえば、複数のログファイルの時刻の入ったエントリーをマージ
     します)。ソートされた値にわたる *note iterator: 4c8. を返します。

     ‘sorted(itertools.chain(*iterables))’ と似ていますが、イテレータを
     返し、一度にはデータをメモリに読み込まず、それぞれの入力ストリーム
     が予め(最小から最大へ)ソートされていることを仮定します。

     2 つのオプション引数があり、これらはキーワード引数として指定されな
     ければなりません。

     'key' は 1 つの引数からなる *note key function: 1006. を指定します
     。この関数は、入力の各要素から比較のキーを取り出すのに使われます。
     デフォルト値は ‘None’ です (要素を直接比較します)。

     'reverse' は真偽値です。 ‘True’ を設定した場合、挿入要素は逆向きに
     比較されたかのように結合されます。
     ‘sorted(itertools.chain(*iterables), reverse=True)’ でこれに似た挙
     動を実現するには、全てのイテラブルは降順で並んでいなければなりませ
     ん。

     バージョン 3.5 で変更: オプションの 'key' 引数および 'reverse' 引数
     を追加.

 -- の関数: heapq.nlargest (n, iterable, key=None)

     'iterable' で定義されるデータセットのうち、最大値から降順に 'n' 個
     の値のリストを返します。(あたえられた場合) 'key' は、引数を一つとる
     、'iterable' のそれぞれの要素から比較キーを生成する関数を指定します
     (例 ‘key=str.lower’)。以下のコードと同等です: ‘sorted(iterable,
     key=key, reverse=True)[:n]’

 -- の関数: heapq.nsmallest (n, iterable, key=None)

     'iterable' で定義されるデータセットのうち、最小値から昇順に 'n' 個
     の値のリストを返します。(あたえられた場合) 'key' は、引数を一つとる
     、'iterable' のそれぞれの要素から比較キーを生成する関数を指定します
     (例 ‘key=str.lower’)。以下のコードと同等です: ‘sorted(iterable,
     key=key)[:n]’

後ろ二つの関数は 'n' の値が小さな場合に最適な動作をします。大きな値の時
には *note sorted(): dc7. 関数の方が効率的です。さらに、 ‘n==1’ の時には
*note min(): 110b. および *note max(): 110c. 関数の方が効率的です。この
関数を繰り返し使うことが必要なら、iterable を実際のヒープに変えることを
考えてください。

* Menu:

* 基本的な例::
* Other Applications::
* 優先度キュー実装の注釈::
* 理論::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/heapq.py


File: python.info,  Node: 基本的な例,  Next: Other Applications,  Up: heapq --- ヒープキューアルゴリズム

5.8.6.1 基本的な例
..................

すべての値をヒープに push してから最小値を 1 つずつ pop することで、ヒー
プソート(1) を実装できます:

     >>> def heapsort(iterable):
     ...     h = []
     ...     for value in iterable:
     ...         heappush(h, value)
     ...     return [heappop(h) for i in range(len(h))]
     ...
     >>> heapsort([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])
     [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

これは ‘sorted(iterable)’ に似ていますが、 *note sorted(): dc7. とは異な
り、この実装はステーブルソートではありません。

ヒープの要素はタプルに出来ます。これは、追跡される主レコードとは別に (タ
スクの優先度のような) 比較値を指定するときに便利です:

     >>> h = []
     >>> heappush(h, (5, 'write code'))
     >>> heappush(h, (7, 'release product'))
     >>> heappush(h, (1, 'write spec'))
     >>> heappush(h, (3, 'create tests'))
     >>> heappop(h)
     (1, 'write spec')

   ---------- Footnotes ----------

   (1) 
https://ja.wikipedia.org/wiki/%E3%83%92%E3%83%BC%E3%83%97%E3%82%BD%E3%83%BC%E3%83%88


File: python.info,  Node: Other Applications,  Next: 優先度キュー実装の注釈,  Prev: 基本的な例,  Up: heapq --- ヒープキューアルゴリズム

5.8.6.2 Other Applications
..........................

Medians(1) are a measure of central tendency for a set of numbers.  In
distributions skewed by outliers, the median provides a more stable
estimate than an average (arithmetic mean).  A running median is an
online algorithm(2) that updates continuously as new data arrives.

A running median can be efficiently implemented by balancing two heaps,
a max-heap for values at or below the midpoint and a min-heap for values
above the midpoint.  When the two heaps have the same size, the new
median is the average of the tops of the two heaps; otherwise, the
median is at the top of the larger heap:

     def running_median(iterable):
         "Yields the cumulative median of values seen so far."

         lo = []  # max-heap
         hi = []  # min-heap (same size as or one smaller than lo)

         for x in iterable:
             if len(lo) == len(hi):
                 heappush_max(lo, heappushpop(hi, x))
                 yield lo[0]
             else:
                 heappush(hi, heappushpop_max(lo, x))
                 yield (lo[0] + hi[0]) / 2

例えば:

     >>> list(running_median([5.0, 9.0, 4.0, 12.0, 8.0, 9.0]))
     [5.0, 7.0, 5.0, 7.0, 8.0, 8.5]

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Median

   (2) https://en.wikipedia.org/wiki/Online_algorithm


File: python.info,  Node: 優先度キュー実装の注釈,  Next: 理論,  Prev: Other Applications,  Up: heapq --- ヒープキューアルゴリズム

5.8.6.3 優先度キュー実装の注釈
..............................

優先度つきキュー(1) は、ヒープの一般的な使い方で、実装にはいくつか困難な
点があります:

   * ソート安定性: 優先度が等しい二つのタスクが、もともと追加された順序
     で返されるためにはどうしたらいいでしょうか？

   * (priority, task) ペアに対するタプルの比較は、priority が同じで task
     がデフォルトの比較順を持たないときに破綻します。

   * あるタスクの優先度が変化したら、どうやってそれをヒープの新しい位置
     に移動させるのでしょうか？

   * 未解決のタスクが削除される必要があるとき、どのようにそれをキューか
     ら探して削除するのでしょうか？

最初の二つの困難の解決策は、項目を優先度、項目番号、そしてタスクを含む 3
要素のリストとして保存することです。この項目番号は、同じ優先度の二つのタ
スクが、追加された順序で返されるようにするための同点決勝戦として働きます
。そして二つの項目番号が等しくなることはありませんので、タプルの比較が二
つのタスクを直接比べようとすることはありえません。

比較できないタスク問題のもう一つの解決法は、タスクアイテムを無視して優先
順序フィールドだけで比較するラッパークラスです:

     from dataclasses import dataclass, field
     from typing import Any

     @dataclass(order=True)
     class PrioritizedItem:
         priority: int
         item: Any=field(compare=False)

残りの困難は主に、未解決のタスクを探して、その優先度を変更したり、完全に
削除することです。タスクを探すことは、キュー内の項目を指し示す辞書によっ
てなされます。

項目を削除したり、優先度を変更することは、ヒープ構造の不変関係を壊すこと
になるので、もっと難しいです。ですから、可能な解決策は、その項目が無効で
あるものとしてマークし、必要なら変更された優先度の項目を加えることです:

     pq = []                         # list of entries arranged in a heap
     entry_finder = {}               # mapping of tasks to entries
     REMOVED = '<removed-task>'      # placeholder for a removed task
     counter = itertools.count()     # unique sequence count

     def add_task(task, priority=0):
         'Add a new task or update the priority of an existing task'
         if task in entry_finder:
             remove_task(task)
         count = next(counter)
         entry = [priority, count, task]
         entry_finder[task] = entry
         heappush(pq, entry)

     def remove_task(task):
         'Mark an existing task as REMOVED.  Raise KeyError if not found.'
         entry = entry_finder.pop(task)
         entry[-1] = REMOVED

     def pop_task():
         'Remove and return the lowest priority task. Raise KeyError if empty.'
         while pq:
             priority, count, task = heappop(pq)
             if task is not REMOVED:
                 del entry_finder[task]
                 return task
         raise KeyError('pop from an empty priority queue')

   ---------- Footnotes ----------

   (1) 
https://ja.wikipedia.org/wiki/%E5%84%AA%E5%85%88%E5%BA%A6%E3%81%A4%E3%81%8D%E3%82%AD%E3%83%A5%E3%83%BC


File: python.info,  Node: 理論,  Prev: 優先度キュー実装の注釈,  Up: heapq --- ヒープキューアルゴリズム

5.8.6.4 理論
............

ヒープとは、全ての 'k' について、要素を 0 から数えたときに、‘a[k] <=
a[2*k+1]’ かつ ‘a[k] <= a[2*k+2]’ となる配列です。比較のために、存在しな
い要素を無限大と考えます。ヒープの興味深い属性は ‘a[0]’ が常に最小の要素
になることです。

上記の奇妙な不変式は、勝ち抜き戦判定の際に効率的なメモリ表現を行うための
ものです。以下の番号は ‘a[k]’ ではなく 'k' とします:

                                    0

                   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

上の木構造では、各セル 'k' は ‘2*k+1’ および ‘2*k+2’ を最大値としていま
す。スポーツに見られるような通常の 2 つ組勝ち抜き戦では、各セルはその下
にある二つのセルに対する勝者となっていて、個々のセルの勝者を追跡していく
ことにより、そのセルに対する全ての相手を見ることができます。しかしながら
、このような勝ち抜き戦を使う計算機アプリケーションの多くでは、勝歴を追跡
する必要はりません。メモリ効率をより高めるために、勝者が上位に進級した際
、下のレベルから持ってきて置き換えることにすると、あるセルとその下位にあ
る二つのセルは異なる三つの要素を含み、かつ上位のセルは二つの下位のセルに
対して "勝者と" なります。

このヒープ不変式が常に守られれば、インデックス 0 は明らかに最勝者となり
ます。最勝者の要素を除去し、"次の" 勝者を見つけるための最も単純なアルゴ
リズム的手法は、ある敗者要素 (ここでは上図のセル 30 とします) を 0 の場
所に持っていき、この新しい 0 を濾過するようにしてツリーを下らせて値を交
換してゆきます。不変関係が再構築されるまでこれを続けます。この操作は明ら
かに、ツリー内の全ての要素数に対して対数的な計算量となります。全ての要素
について繰り返すと、 'O'('n' log 'n') のソートになります。

このソートの良い点は、新たに挿入する要素が、最後に取り出された 0 番目の
要素よりも "良い値" でない限り、ソートを行っている最中に新たな要素を効率
的に追加できるというところです。この性質は、シミュレーション的な状況で、
ツリーで全ての入力イベントを保持し、"勝者" の状況を最小のスケジュール時
刻にするような場合に特に便利です。あるイベントが他のイベント群の実行をス
ケジュールする際、それらは未来にスケジュールされることになるので、それら
のイベント群を容易にヒープに積むことができます。すなわち、ヒープはスケジ
ューラを実装する上で良いデータ構造であるといえます (私はこれを MIDI シー
ケンサで使っています :-)。

これまで、スケジューラを実装するための様々なデータ構造が広範に研究されて
きました。ヒープは、十分高速で、速度はおおむね一定であり、最悪の場合でも
平均的な速度とさほど変わらないため、良いデータ構造といえます。しかし、最
悪の場合にひどい速度になるとしても、全体的にはより効率の高い他のデータ構
造表現も存在します。

ヒープはまた、巨大なディスクのソートでも非常に有用です。おそらくご存知の
ように、巨大なソートを行うと、複数の "ラン (run)" (予めソートされた配列
で、そのサイズは通常 CPU メモリの量に関係しています) が生成され、続いて
統合処理 (merging) がこれらのランを判定します。この統合処理はしばしば非
常に巧妙に組織されています (1)。重要なのは、最初のソートが可能な限り長い
ランを生成することです。勝ち抜き戦はこれを達成するための良い方法です。も
し利用可能な全てのメモリを使って勝ち抜き戦を行い、要素を置換および濾過処
理して現在のランに収めれば、ランダムな入力に対してメモリの二倍のサイズの
ランを生成することになり、大体順序づけがなされている入力に対してはもっと
高い効率になります。

さらに、ディスク上の 0 番目の要素を出力して、現在の勝ち抜き戦に (最後に
出力した値に "勝って" しまうために) 収められない入力を得たなら、ヒープに
は収まらないため、ヒープのサイズは減少します。解放されたメモリは二つ目の
ヒープを段階的に構築するために巧妙に再利用することができ、この二つ目のヒ
ープは最初のヒープが崩壊していくのと同じ速度で成長します。最初のヒープが
完全に消滅したら、ヒープを切り替えて新たなランを開始します。なんと巧妙で
効率的なのでしょう！

一言で言うと、ヒープは知って得するメモリ構造です。私はいくつかのアプリケ
ーションでヒープを使っていて、'ヒープ' モジュールを常備するのはいい事だ
と考えています。:-)

脚注
....

   ---------- Footnotes ----------

   (1) 現在使われているディスクバランス化アルゴリズムは、最近ではもはや
巧妙というよりも目障りになっています。これは、ディスクのシーク機能が向上
した結果です。巨大な容量を持つテープドライブなど、シーク不能なデバイスで
は、事情は全く異なります。テープの 1 つ 1 つの動きが可能な限り効率的に行
われるように非常に巧妙な処理を (相当前もって) 確保しなければなりません
(統合処理の "進行" に最も多く使用させます)。テープによっては逆方向に読む
ことさえでき、巻き戻しに時間を取られるのを避けるために使うこともできます
。正直、本当に良いテープソートは見ていて素晴らしく驚異的なものです！ソー
トというのは常に偉大な芸術なのです！:-)


File: python.info,  Node: bisect --- 配列二分法アルゴリズム,  Next: array --- 効率的な数値配列,  Prev: heapq --- ヒープキューアルゴリズム,  Up: データ型

5.8.7 ‘bisect’ -- 配列二分法アルゴリズム
----------------------------------------

'ソースコード:' Lib/bisect.py(1)

__________________________________________________________________

このモジュールは、挿入のたびにリストをソートすることなく、ソートされた順
序でリストを維持するためのサポートを提供します。 コストのかかる比較演算
を伴う長いリストの場合、これは線形検索や頻繁な並べ替えよりも改善される可
能性があります。

The module is called ‘bisect’ because it uses a basic bisection
algorithm to do its work.  Unlike other bisection tools that search for
a specific value, the functions in this module are designed to locate an
insertion point.  Accordingly, the functions never call an *note
__eq__(): cf2. method to determine whether a value has been found.
Instead, the functions only call the *note __lt__(): 14b8. method and
will return an insertion point between values in an array.

     注釈: The functions in this module are not thread-safe.  If
     multiple threads concurrently use ‘bisect’ functions on the same
     sequence, this may result in undefined behaviour.  Likewise, if the
     provided sequence is mutated by a different thread while a ‘bisect’
     function is operating on it, the result is undefined.  For example,
     using *note insort_left(): 29ae. on the same list from multiple
     threads may result in the list becoming unsorted.
次の関数が用意されています:

 -- の関数: bisect.bisect_left (a, x, lo=0, hi=len(a), *, key=None)

     ソートされた順序を保ったまま 'x' を 'a' に挿入できる点を探し当てま
     す。リストの中から検索する部分集合を指定するには、パラメータの 'lo'
     と 'hi' を使います。デフォルトでは、リスト全体が使われます。'x' が
     すでに 'a' に含まれている場合、挿入点は既存のどのエントリーよりも前
     (左)になります。戻り値は、‘list.insert()’ の第一引数として使うのに
     適しています。'a' はすでにソートされているものとします。

     返された挿入点 'ip' パーティションは、左のスライスでは ‘all(elem <
     x for elem in a[lo : ip])’ が真となり、右のスライスでは ‘all(elem
     >= x for elem in a[ip : hi])’ が真となるように、配列 'a' を2つのス
     ライスに分割します。

     'key' specifies a *note key function: 1006. of one argument that is
     used to extract a comparison key from each element in the array.
     To support searching complex records, the key function is not
     applied to the 'x' value.

     If 'key' is ‘None’, the elements are compared directly and no key
     function is called.

     バージョン 3.10 で変更: 'key' パラメータが追加されました。

 -- の関数: bisect.bisect_right (a, x, lo=0, hi=len(a), *, key=None)
 -- の関数: bisect.bisect (a, x, lo=0, hi=len(a), *, key=None)

     *note bisect_left(): 29b0. と似ていますが、 'a' に含まれる 'x' のう
     ち、どのエントリーよりも後ろ(右)にくるような挿入点を返します。

     返された挿入点 'ip' パーティションは、左のスライスでは ‘all(elem <=
     x for elem in a[lo : ip])’ が真となり、右のスライスでは ‘all(elem >
     x for elem in a[ip : hi])’ が真となるように、配列 'a' を2つのスライ
     スに分割します。

     バージョン 3.10 で変更: 'key' パラメータが追加されました。

 -- の関数: bisect.insort_left (a, x, lo=0, hi=len(a), *, key=None)

     'x' を 'a' にソート順で挿入します。

     This function first runs *note bisect_left(): 29b0. to locate an
     insertion point.  Next, it runs the *note insert(): 23da. method on
     'a' to insert 'x' at the appropriate position to maintain sort
     order.

     To support inserting records in a table, the 'key' function (if
     any) is applied to 'x' for the search step but not for the
     insertion step.

     Keep in mind that the 'O'(log 'n') search is dominated by the slow
     'O'('n') insertion step.

     バージョン 3.10 で変更: 'key' パラメータが追加されました。

 -- の関数: bisect.insort_right (a, x, lo=0, hi=len(a), *, key=None)
 -- の関数: bisect.insort (a, x, lo=0, hi=len(a), *, key=None)

     *note insort_left(): 29ae. と似ていますが、 'a' に含まれる 'x' のう
     ち、どのエントリーよりも後ろに 'x' を挿入します。

     This function first runs *note bisect_right(): 29b1. to locate an
     insertion point.  Next, it runs the *note insert(): 23da. method on
     'a' to insert 'x' at the appropriate position to maintain sort
     order.

     To support inserting records in a table, the 'key' function (if
     any) is applied to 'x' for the search step but not for the
     insertion step.

     Keep in mind that the 'O'(log 'n') search is dominated by the slow
     'O'('n') insertion step.

     バージョン 3.10 で変更: 'key' パラメータが追加されました。

* Menu:

* パフォーマンスに関するメモ::
* ソート済みリストの探索::
* 使用例: 使用例<4>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/bisect.py


File: python.info,  Node: パフォーマンスに関するメモ,  Next: ソート済みリストの探索,  Up: bisect --- 配列二分法アルゴリズム

5.8.7.1 パフォーマンスに関するメモ
..................................

'bisect()' と 'insort()' を使って時間的制約のあるコードを書くときは、以
下のことを念頭に置いてください:

   * 二分法は、値の範囲を検索するのに有効です。 特定の値を検索する場合は
     、辞書の方が効率的です。

   * The 'insort()' functions are 'O'('n') because the logarithmic
     search step is dominated by the linear time insertion step.

   * The search functions are stateless and discard key function results
     after they are used.  Consequently, if the search functions are
     used in a loop, the key function may be called again and again on
     the same array elements.  If the key function isn't fast, consider
     wrapping it with *note functools.cache(): 17c8. to avoid duplicate
     computations.  Alternatively, consider searching an array of
     precomputed keys to locate the insertion point (as shown in the
     examples section below).

参考
....

   * Sorted Collections(1) is a high performance module that uses
     'bisect' to managed sorted collections of data.

   * bisect を利用して、直接の探索ができ、キー関数をサポートする、完全な
     機能を持つコレクションクラスを組み立てる SortedCollection
     recipe(2)。キーは、探索中に不必要な呼び出しをさせないために、予め計
     算しておきます。

   ---------- Footnotes ----------

   (1) https://grantjenks.com/docs/sortedcollections/

   (2) https://code.activestate.com/recipes/577197-sortedcollection/


File: python.info,  Node: ソート済みリストの探索,  Next: 使用例<4>,  Prev: パフォーマンスに関するメモ,  Up: bisect --- 配列二分法アルゴリズム

5.8.7.2 ソート済みリストの探索
..............................

上記の *note bisect 関数: 29af. は挿入点を見つけるには便利ですが、一般的
な検索タスクに使うには厄介であったり、使いにくい場合があります。 以下の
5つの関数は、それらをソートされたリストの標準的な検索に変換する方法を示
しています:

     def index(a, x):
         'xにちょうど等しい左端の値を見つける'
         i = bisect_left(a, x)
         if i != len(a) and a[i] == x:
             return i
         raise ValueError

     def find_lt(a, x):
         'xより小さい右端の値を見つける'
         i = bisect_left(a, x)
         if i:
             return a[i-1]
         raise ValueError

     def find_le(a, x):
         'x以下の右端の値を見つける'
         i = bisect_right(a, x)
         if i:
             return a[i-1]
         raise ValueError

     def find_gt(a, x):
         'xより大きい左端の値を見つける'
         i = bisect_right(a, x)
         if i != len(a):
             return a[i]
         raise ValueError

     def find_ge(a, x):
         '左端の項目がx以上であることを確認する'
         i = bisect_left(a, x)
         if i != len(a):
             return a[i]
         raise ValueError


File: python.info,  Node: 使用例<4>,  Prev: ソート済みリストの探索,  Up: bisect --- 配列二分法アルゴリズム

5.8.7.3 使用例
..............

*note bisect(): 29b2. 関数は数値テーブルの探索に役に立ちます。この例では
、 *note bisect(): 29b2. を使って、(たとえば)順序のついた数値の区切り点
の集合に基づいて、試験の成績の等級を表す文字を調べます。区切り点は 90 以
上は 'A'、 80 から 89 は 'B'、などです:

     >>> def grade(score, breakpoints=[60, 70, 80, 90], grades='FDCBA'):
     ...     i = bisect(breakpoints, score)
     ...     return grades[i]
     ...
     >>> [grade(score) for score in [33, 99, 77, 70, 89, 90, 100]]
     ['F', 'A', 'C', 'C', 'B', 'A', 'A']

*note bisect(): 29b2. と *note insort(): 29b4. 関数もタプルのリストで動
作します。 引数 'key' はテーブルのレコードの順序付けに使用されるフィール
ドを抽出します:

     >>> from collections import namedtuple
     >>> from operator import attrgetter
     >>> from bisect import bisect, insort
     >>> from pprint import pprint

     >>> Movie = namedtuple('Movie', ('name', 'released', 'director'))

     >>> movies = [
     ...     Movie('Jaws', 1975, 'Spielberg'),
     ...     Movie('Titanic', 1997, 'Cameron'),
     ...     Movie('The Birds', 1963, 'Hitchcock'),
     ...     Movie('Aliens', 1986, 'Cameron')
     ... ]

     >>> # Find the first movie released after 1960
     >>> by_year = attrgetter('released')
     >>> movies.sort(key=by_year)
     >>> movies[bisect(movies, 1960, key=by_year)]
     Movie(name='The Birds', released=1963, director='Hitchcock')

     >>> # Insert a movie while maintaining sort order
     >>> romance = Movie('Love Story', 1970, 'Hiller')
     >>> insort(movies, romance, key=by_year)
     >>> pprint(movies)
     [Movie(name='The Birds', released=1963, director='Hitchcock'),
      Movie(name='Love Story', released=1970, director='Hiller'),
      Movie(name='Jaws', released=1975, director='Spielberg'),
      Movie(name='Aliens', released=1986, director='Cameron'),
      Movie(name='Titanic', released=1997, director='Cameron')]

キー関数がコストがかかる場合は、レコードのインデックスを見つけるために事
前に計算されたキーのリストを検索することにより、関数呼び出しの繰り返しを
回避することが可能です:

     >>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)]
     >>> data.sort(key=lambda r: r[1])       # Or use operator.itemgetter(1).
     >>> keys = [r[1] for r in data]         # Precompute a list of keys.
     >>> data[bisect_left(keys, 0)]
     ('black', 0)
     >>> data[bisect_left(keys, 1)]
     ('blue', 1)
     >>> data[bisect_left(keys, 5)]
     ('red', 5)
     >>> data[bisect_left(keys, 8)]
     ('yellow', 8)


File: python.info,  Node: array --- 効率的な数値配列,  Next: weakref --- Weak references,  Prev: bisect --- 配列二分法アルゴリズム,  Up: データ型

5.8.8 ‘array’ -- 効率的な数値配列
---------------------------------

__________________________________________________________________

This module defines an object type which can compactly represent an
array of basic values: characters, integers, floating-point numbers.
Arrays are mutable *note sequence: 716. types and behave very much like
lists, except that the type of objects stored in them is constrained.
The type is specified at object creation time by using a 'type code',
which is a single character.  The following type codes are defined:

型コード        C の型                   Python の型             最小サイズ (バイト単位)     注釈
                                                                                             
---------------------------------------------------------------------------------------------------------
                                                                                             
‘'b'’           signed char              int                     1
                                                                 
                                                                                             
‘'B'’           unsigned char            int                     1
                                                                 
                                                                                             
‘'u'’           wchar_t                  Unicode文字(unicode型   2                           (1)
                                         )                                                   
                                         
                                                                                             
‘'w'’           Py_UCS4                  Unicode文字(unicode型   4                           (2)
                                         )                                                   
                                         
                                                                                             
‘'h'’           signed short             int                     2
                                                                 
                                                                                             
‘'H'’           unsigned short           int                     2
                                                                 
                                                                                             
‘'i'’           signed int               int                     2
                                                                 
                                                                                             
‘'I'’           unsigned int             int                     2
                                                                 
                                                                                             
‘'l'’           signed long              int                     4
                                                                 
                                                                                             
‘'L'’           unsigned long            int                     4
                                                                 
                                                                                             
‘'q'’           signed long long         int                     8
                                                                 
                                                                                             
‘'Q'’           unsigned long long       int                     8
                                                                 
                                                                                             
‘'f'’           浮動小数点数             浮動小数点数            4
                                                                 
                                                                                             
‘'d'’           double                   浮動小数点数            8
                                                                 

注釈:

  1. It can be 16 bits or 32 bits depending on the platform.

     バージョン 3.9 で変更: ‘array('u')’ now uses ‘wchar_t’ as C type
     instead of deprecated ‘Py_UNICODE’.  This change doesn't affect its
     behavior because ‘Py_UNICODE’ is alias of ‘wchar_t’ since Python
     3.3.

     Deprecated since version 3.3, will be removed in version 3.16:
     Please migrate to ‘'w'’ typecode.

  2. 
     Added in version 3.13.

値の実際の表現はマシンアーキテクチャ (厳密に言うとCの実装) によって決ま
ります。値の実際のサイズは *note array.itemsize: 29bc. 属性から得られま
す。

このモジュールは以下の項目を定義しています:

 -- データ: array.typecodes

     すべての利用可能なタイプコードを含む文字列

このモジュールでは次の型を定義しています:

 -- クラス: array.array (typecode[, initializer])

     A new array whose items are restricted by 'typecode', and
     initialized from the optional 'initializer' value, which must be a
     *note bytes: 192. or *note bytearray: 344. object, a Unicode
     string, or iterable over elements of the appropriate type.

     If given a *note bytes: 192. or *note bytearray: 344. object, the
     initializer is passed to the new array's *note frombytes(): 1489.
     method; if given a Unicode string, the initializer is passed to the
     *note fromunicode(): 29be. method; otherwise, the initializer's
     iterator is passed to the *note extend(): 29bf. method to add
     initial items to the array.

     Array objects support the ordinary *note mutable: 25c2. *note
     sequence: 716. operations of indexing, slicing, concatenation, and
     multiplication.  When using slice assignment, the assigned value
     must be an array object with the same type code; in all other
     cases, *note TypeError: 198. is raised.  Array objects also
     implement the buffer interface, and may be used wherever *note
     bytes-like objects: 193. are supported.

     引数 ‘typecode’, ‘initializer’ 付きで *note 監査イベント: 1c6e.
     ‘array.__new__’ を送出します。

      -- の属性: typecode

          アレイを作るときに使う型コード文字です。

      -- の属性: itemsize

          アレイの要素 1 つの内部表現に使われるバイト長です。

      -- メソッド: append (x)

          値 'x' の新たな要素をアレイの末尾に追加します。

      -- メソッド: buffer_info ()

          アレイの内容を記憶するために使っているバッファの、現在のメモリ
          アドレスと要素数の入ったタプル ‘(address, length)’ を返します
          。バイト単位で表したメモリバッファの大きさは
          ‘array.buffer_info()[1] * array.itemsize’ で計算できます。例え
          ば ‘ioctl()’ 操作のような、メモリアドレスを必要とする低レベル
          な (そして、本質的に危険な) I/Oインターフェースを使って作業す
          る場合に、ときどき便利です。アレイ自体が存在し、長さを変えるよ
          うな演算を適用しない限り、有効な値を返します。

               注釈: C やC++ で書いたコードからアレイオブジェクトを使う
               場合 (‘buffer_info()’ の情報を使う意味のある唯一の方法で
               す) は、アレイオブジェクトでサポートしているバッファイン
               ターフェースを使う方がより理にかなっています。このメソッ
               ドは後方互換性のために保守されており、新しいコードでの使
               用は避けるべきです。バッファインターフェースの説明は
               *note バッファプロトコル (buffer Protocol): 260. にありま
               す。

      -- メソッド: byteswap ()

          アレイのすべての要素に対して「バイトスワップ」 (リトルエンディ
          アンとビッグエンディアンの変換) を行います。このメソッドは大き
          さが 1、2、4 および 8 バイトの値のみをサポートしています。他の
          種類の値に使うと *note RuntimeError: 244. を送出します。異なる
          バイトオーダを使うマシンで書かれたファイルからデータを読み込む
          ときに役に立ちます。

      -- メソッド: count (x)

          シーケンス中の 'x' の出現回数を返します。

      -- メソッド: extend (iterable)

          'iterable' から要素を取り出し、アレイの末尾に要素を追加します
          。 'iterable' が別のアレイ型である場合、二つのアレイは '全く'
          同じ型コードでなければなりません。それ以外の場合には *note
          TypeError: 198. を送出します。 'iterable' がアレイでない場合、
          アレイに値を追加できるような正しい型の要素からなるイテレーショ
          ン可能オブジェクトでなければなりません。

      -- メソッド: frombytes (buffer)

          Appends items from the *note bytes-like object: 193,
          interpreting its content as an array of machine values (as if
          it had been read from a file using the *note fromfile(): 14d8.
          method).

          Added in version 3.2: 明確化のため ‘fromstring()’ の名前が
          *note frombytes(): 1489. に変更されました。

      -- メソッド: fromfile (f, n)

          *note ファイルオブジェクト: 13db. 'f' から (マシンのデータ形式
          そのままで) 'n' 個の要素を読み出し、アレイの末尾に要素を追加し
          ます。 'n' 個未満の要素しか読めなかった場合は *note EOFError:
          14f1. を送出しますが、それまでに読み出せた値はアレイに追加され
          ます。

      -- メソッド: fromlist (list)

          リストから要素を追加します。型に関するエラーが発生した場合にア
          レイが変更されないことを除き、 ‘for x in list: a.append(x)’ と
          同じです。

      -- メソッド: fromunicode (s)

          Extends this array with data from the given Unicode string.
          The array must have type code ‘'u'’ or ‘'w'’; otherwise a
          *note ValueError: 2ec. is raised.  Use
          ‘array.frombytes(unicodestring.encode(enc))’ to append Unicode
          data to an array of some other type.

      -- メソッド: index (x[, start[, stop]])

          Return the smallest 'i' such that 'i' is the index of the
          first occurrence of 'x' in the array.  The optional arguments
          'start' and 'stop' can be specified to search for 'x' within a
          subsection of the array.  Raise *note ValueError: 2ec. if 'x'
          is not found.

          バージョン 3.10 で変更: Added optional 'start' and 'stop'
          parameters.

      -- メソッド: insert (i, x)

          アレイ中の位置 'i' の前に値 'x' をもつ新しい要素を挿入します。
          'i' の値が負の場合、アレイの末尾からの相対位置として扱います。

      -- メソッド: pop ([i])

          アレイからインデクスが 'i' の要素を取り除いて返します。オプシ
          ョンの引数はデフォルトで ‘-1’ になっていて、最後の要素を取り除
          いて返すようになっています。

      -- メソッド: remove (x)

          アレイ中の 'x' のうち、最初に現れたものを取り除きます。

      -- メソッド: clear ()

          Remove all elements from the array.

          Added in version 3.13.

      -- メソッド: reverse ()

          アレイの要素の順番を逆にします。

      -- メソッド: tobytes ()

          array をマシンの値の array に変換して、 bytes の形で返します
          (*note tofile(): 14d9. メソッドを使ってファイルに書かれるバイ
          ト列と同じです)。

          Added in version 3.2: ‘tostring()’ is renamed to *note
          tobytes(): 1488. for clarity.

      -- メソッド: tofile (f)

          すべての要素を (マシンの値の形式で) *note file object: 13db.
          'f' に書き込みます。

      -- メソッド: tolist ()

          アレイを同じ要素を持つ普通のリストに変換します。

      -- メソッド: tounicode ()

          Convert the array to a Unicode string.  The array must have a
          type ‘'u'’ or ‘'w'’; otherwise a *note ValueError: 2ec. is
          raised.  Use ‘array.tobytes().decode(enc)’ to obtain a Unicode
          string from an array of some other type.

The string representation of array objects has the form ‘array(typecode,
initializer)’.  The 'initializer' is omitted if the array is empty,
otherwise it is a Unicode string if the 'typecode' is ‘'u'’ or ‘'w'’,
otherwise it is a list of numbers.  The string representation is
guaranteed to be able to be converted back to an array with the same
type and value using *note eval(): 4a3, so long as the *note array: 4be.
class has been imported using ‘from array import array’.  Variables
‘inf’ and ‘nan’ must also be defined if it contains corresponding
floating-point values.  Examples:

     array('l')
     array('w', 'hello \u2641')
     array('l', [1, 2, 3, 4, 5])
     array('d', [1.0, 2.0, 3.14, -inf, nan])

参考
....

*note struct: db. モジュール

     異なる種類のバイナリデータのパックおよびアンパック。

NumPy(1)

     NumPy パッケージは、別の配列型を定義しています。

   ---------- Footnotes ----------

   (1) https://numpy.org/


File: python.info,  Node: weakref --- Weak references,  Next: types --- 動的な型生成と組み込み型の名前,  Prev: array --- 効率的な数値配列,  Up: データ型

5.8.9 ‘weakref’ -- Weak references
----------------------------------

'ソースコード:' Lib/weakref.py(1)

__________________________________________________________________

The ‘weakref’ module allows the Python programmer to create 'weak
references' to objects.

以下では、用語リファレント('referent') は弱参照が参照するオブジェクトを
意味します。

オブジェクトへの弱参照があることは、そのオブジェクトを生かしておくのには
不十分です。リファレントへの参照が弱参照しか残っていない場合、 *note
garbage collection: 17d8. はリファレントを自由に破棄し、メモリを別のもの
に再利用することができます。しかし、オブジェクトへの強参照がなくても、オ
ブジェクトが実際に破棄されるまでは、弱参照はオブジェクトを返す場合があり
ます。

弱参照の主な用途は、巨大なオブジェクトを保持するキャッシュやマッピングを
実装することです。ここで、キャッシュやマッピングに保持されているからとい
う理由だけで、巨大なオブジェクトが生き続けることは望ましくありません。

For example, if you have a number of large binary image objects, you may
wish to associate a name with each.  If you used a Python dictionary to
map names to images, or images to names, the image objects would remain
alive just because they appeared as values or keys in the dictionaries.
The *note WeakKeyDictionary: 1929. and *note WeakValueDictionary: 192a.
classes supplied by the ‘weakref’ module are an alternative, using weak
references to construct mappings that don't keep objects alive solely
because they appear in the mapping objects.  If, for example, an image
object is a value in a *note WeakValueDictionary: 192a, then when the
last remaining references to that image object are the weak references
held by weak mappings, garbage collection can reclaim the object, and
its corresponding entries in weak mappings are simply deleted.

*note WeakKeyDictionary: 1929. と *note WeakValueDictionary: 192a. はそ
の実装に弱参照を使用しており、キーや値がガーベジコレクションによって回収
されたことを弱参照辞書に通知するコールバック関数を設定しています。 *note
WeakSet: 7f5. は *note set: 184. インターフェースを実装していますが、
*note WeakKeyDictionary: 1929. のように要素への弱参照を持ちます。

*note finalize: c6f. は、オブジェクトのガベージコレクションの実行時にク
リーンアップ関数が呼び出されるように登録する、単純な方法を提供します。こ
れは、未加工の弱参照上にコールバック関数を設定するよりも簡単です。なぜな
ら、オブジェクトのコレクションが完了するまでファイナライザが生き続けるこ
とを、モジュールが自動的に保証するからです。

Most programs should find that using one of these weak container types
or *note finalize: c6f. is all they need - it's not usually necessary to
create your own weak references directly.  The low-level machinery is
exposed by the ‘weakref’ module for the benefit of advanced uses.

全てのオブジェクトが弱参照で参照できるわけではありません。弱参照をサポー
トするオブジェクトは、クラスインスタンス、(C ではなく) Python で書かれた
関数、インスタンスメソッド、set オブジェクト、frozenset オブジェクト、
*note file オブジェクト: 13db. 、 *note generators: 126c. 型のオブジェク
ト、socket オブジェクト、array オジェクト、deque オブジェクト、正規表現
パターンオブジェクト、code オブジェクトです。

バージョン 3.2 で変更: thread.lock, threading.Lock, code オブジェクトの
サポートが追加されました。

*note list: 24d. や *note dict: 183. など、いくつかの組み込み型は弱参照
を直接サポートしませんが、以下のようにサブクラス化を行えばサポートを追加
できます:

     class Dict(dict):
         pass

     obj = Dict(red=1, green=2, blue=3)   # this object is weak referenceable

*note tuple: 614. や *note int: 19b. など、他の組み込み型はサブクラス化
しても弱参照をサポートしません。

拡張型は、簡単に弱参照をサポートできます。詳細については、 *note
弱参照(Weak Reference)のサポート: 29cf. を参照してください。

When ‘__slots__’ are defined for a given type, weak reference support is
disabled unless a ‘'__weakref__'’ string is also present in the sequence
of strings in the ‘__slots__’ declaration.  See *note __slots__
documentation: 237f. for details.

 -- クラス: weakref.ref (object[, callback])

     'object' への弱参照を返します。リファレントがまだ生きているならば、
     元のオブジェクトは参照オブジェクトの呼び出しで取り出せす。リファレ
     ントがもはや生きていないならば、参照オブジェクトを呼び出したときに
     *note None: 885. を返します。 'callback' に *note None: 885. 以外の
     値を与えた場合、オブジェクトをまさに後始末処理しようとするときに呼
     び出します。このとき弱参照オブジェクトは 'callback' の唯一のパラメ
     タとして渡されます。リファレントはもはや利用できません。

     同じオブジェクトに対してたくさんの弱参照を作れます。それぞれの弱参
     照に対して登録されたコールバックは、もっとも新しく登録されたコール
     バックからもっとも古いものへと呼び出されます。

     Exceptions raised by the callback will be noted on the standard
     error output, but cannot be propagated; they are handled in exactly
     the same way as exceptions raised from an object's *note __del__():
     11ff. method.

     'object' が *note ハッシュ可能: 824. ならば、弱参照はハッシュ可能で
     す。それらは 'object' が削除された後でもそれらのハッシュ値を保持し
     ます。 'object' が削除されてから初めて *note hash(): 801. が呼び出
     された場合に、その呼び出しは *note TypeError: 198. を発生させます。

     弱参照は等価性のテストをサポートしていますが、順序をサポートしてい
     ません。参照がまだ生きているならば、 'callback' に関係なく二つの参
     照はそれらのリファレントと同じ等価関係を持ちます。リファレントのど
     ちらか一方が削除された場合、参照オブジェクトが同一である場合に限り
     、その参照は等価です。

     これはサブクラス化可能な型というよりファクトリ関数です。

      -- の属性: __callback__

          この読み出し専用の属性は、現在弱参照に関連付けられているコール
          バックを返します。コールバックが存在しないか、弱参照のリファレ
          ントが生きていない場合、この属性の値は ‘None’ になります。

     バージョン 3.4 で変更: *note __callback__: 11f3. 属性が追加されまし
     た。

 -- の関数: weakref.proxy (object[, callback])

     弱参照を使う 'object' へのプロキシを返します。弱参照オブジェクトを
     明示的な参照外しをしながら利用する代わりに、多くのケースでプロキシ
     を利用することができます。返されるオブジェクトは、 'object' が呼び
     出し可能かどうかによって、 ‘ProxyType’ または ‘CallableProxyType’ の
     どちらかの型を持ちます。プロキシオブジェクトはリファレントに関係な
     く *note ハッシュ可能: 824. ではありません。これによって、それらの
     基本的な変更可能という性質による多くの問題を避けています。そして、
     辞書のキーとしての利用を妨げます。 'callback' は *note ref(): 11f2.
     関数の同じ名前のパラメータと同じものです。(-- 訳注: リファレントが
     変更不能型であっても、プロキシはリファレントが消えるという状態の変
     更があるために、変更可能型です。--)

     Accessing an attribute of the proxy object after the referent is
     garbage collected raises *note ReferenceError: 1726.

     バージョン 3.8 で変更: Extended the operator support on proxy
     objects to include the matrix multiplication operators ‘@’ and
     ‘@=’.

 -- の関数: weakref.getweakrefcount (object)

     'object' を参照する弱参照とプロキシの数を返します。

 -- の関数: weakref.getweakrefs (object)

     'object' を参照するすべての弱参照とプロキシオブジェクトのリストを返
     します。

 -- クラス: weakref.WeakKeyDictionary ([dict])

     キーを弱参照するマッピングクラス。キーへの強参照がなくなったときに
     、辞書のエントリは捨てられます。アプリケーションの他の部分が所有す
     るオブジェクトへ属性を追加することもなく、それらのオブジェクトに追
     加データを関連づけるために使うことができます。これは属性へのアクセ
     スをオーバーライドするオブジェクトに特に便利です。

     Note that when a key with equal value to an existing key (but not
     equal identity) is inserted into the dictionary, it replaces the
     value but does not replace the existing key.  Due to this, when the
     reference to the original key is deleted, it also deletes the entry
     in the dictionary:

          >>> class T(str): pass
          ...
          >>> k1, k2 = T(), T()
          >>> d = weakref.WeakKeyDictionary()
          >>> d[k1] = 1   # d = {k1: 1}
          >>> d[k2] = 2   # d = {k1: 2}
          >>> del k1      # d = {}

     A workaround would be to remove the key prior to reassignment:

          >>> class T(str): pass
          ...
          >>> k1, k2 = T(), T()
          >>> d = weakref.WeakKeyDictionary()
          >>> d[k1] = 1   # d = {k1: 1}
          >>> del d[k1]
          >>> d[k2] = 2   # d = {k2: 2}
          >>> del k1      # d = {k2: 2}

     バージョン 3.9 で変更: PEP 584(2) で規定されている ‘|’ 演算子と
     ‘|=’ 演算子のサポートを追加しました。

*note WeakKeyDictionary: 1929. オブジェクトは、追加のメソッドを持ちます
。このメソッドは、内部の参照を直接公開します。その参照は、利用される時に
生存しているとは限りません。なので、参照を利用する前に、その参照をチェッ
クする必要があります。これにより、必要なくなったキーの参照が残っているた
めに、ガベージコレクタがそのキーを削除できなくなる事態を避ける事ができま
す。

 -- メソッド: WeakKeyDictionary.keyrefs ()

     キーへの弱参照を持つ iterable オブジェクトを返します。

 -- クラス: weakref.WeakValueDictionary ([dict])

     値を弱参照するマッピングクラス。値への強参照が存在しなくなったとき
     に、辞書のエントリは捨てられます。

     バージョン 3.9 で変更: PEP 584(3) で規定されている ‘|’ 演算子と
     ‘|=’ 演算子のサポートを追加しました。

*note WeakValueDictionary: 192a. objects have an additional method that
has the same issues as the *note WeakKeyDictionary.keyrefs(): 29d2.
method.

 -- メソッド: WeakValueDictionary.valuerefs ()

     値への弱参照を持つ iterable オブジェクトを返します。

 -- クラス: weakref.WeakSet ([elements])

     要素への弱参照を持つ集合型。要素への強参照が無くなったときに、その
     要素は削除されます。

 -- クラス: weakref.WeakMethod (method[, callback])

     拡張された *note ref: 11f2. のサブクラスで、束縛されたメソッドへの
     弱参照をシミュレートします (つまり、クラスで定義され、インスタンス
     にあるメソッド)。 束縛されたメソッドは短命なので、標準の弱参照では
     保持し続けられません。 *note WeakMethod: 11f1. には、オブジェクトと
     元々の関数が死ぬまで束縛されたメソッドを再作成する特別なコードがあ
     ります:

          >>> class C:
          ...     def method(self):
          ...         print("method called!")
          ...
          >>> c = C()
          >>> r = weakref.ref(c.method)
          >>> r()
          >>> r = weakref.WeakMethod(c.method)
          >>> r()
          <bound method C.method of <__main__.C object at 0x7fc859830220>>
          >>> r()()
          method called!
          >>> del c
          >>> gc.collect()
          0
          >>> r()
          >>>

     'callback' is the same as the parameter of the same name to the
     *note ref(): 11f2. function.

     Added in version 3.4.

 -- クラス: weakref.finalize (obj, func, /, *args, **kwargs)

     'obj' がガベージコレクションで回収されるときに呼び出される、呼び出
     し可能なファイナライザオブジェクトを返します。 通常の弱参照とは異な
     り、ファイナライザは参照しているオブジェクトが回収されるまで必ず生
     き残り、そのおかげでライフサイクル管理が大いに簡単になります。

     ファイナライザは (直接もしくはガベージコレクションのときに) 呼び出
     されるまで '生きている' と見なされ、呼び出された後には '死んでいま
     す' 。 生きているファイナライザを呼び出すと、 ‘func(*arg,
     **kwargs)’ を評価した結果を返します。一方、死んでいるファイナライザ
     を呼び出すと *note None: 885. を返します。

     Exceptions raised by finalizer callbacks during garbage collection
     will be shown on the standard error output, but cannot be
     propagated.  They are handled in the same way as exceptions raised
     from an object's *note __del__(): 11ff. method or a weak
     reference's callback.

     プログラムが終了するとき、生き残ったそれぞれのファイナライザは、自
     身の *note atexit: d. 属性が偽に設定されるまで呼び出され続けます。
     ファイナライザは生成された順序の逆順で呼び出されます。

     A finalizer will never invoke its callback during the later part of
     the *note interpreter shutdown: 479. when module globals are liable
     to have been replaced by *note None: 885.

      -- メソッド: __call__ ()

          If 'self' is alive then mark it as dead and return the result
          of calling ‘func(*args, **kwargs)’.  If 'self' is dead then
          return *note None: 885.

      -- メソッド: detach ()

          If 'self' is alive then mark it as dead and return the tuple
          ‘(obj, func, args, kwargs)’.  If 'self' is dead then return
          *note None: 885.

      -- メソッド: peek ()

          If 'self' is alive then return the tuple ‘(obj, func, args,
          kwargs)’.  If 'self' is dead then return *note None: 885.

      -- の属性: alive

          ファイナライザが生きている場合には真、そうでない場合には偽のプ
          ロパティです。

      -- の属性: atexit

          A writable boolean property which by default is true.  When
          the program exits, it calls all remaining live finalizers for
          which *note atexit: 29d8. is true.  They are called in reverse
          order of creation.

          注釈: It is important to ensure that 'func', 'args' and
          'kwargs' do not own any references to 'obj', either directly
          or indirectly, since otherwise 'obj' will never be garbage
          collected.  In particular, 'func' should not be a bound method
          of 'obj'.

     Added in version 3.4.

 -- データ: weakref.ReferenceType

     弱参照オブジェクトのための型オブジェクト。

 -- データ: weakref.ProxyType

     呼び出し可能でないオブジェクトのプロキシのための型オブジェクト。

 -- データ: weakref.CallableProxyType

     呼び出し可能なオブジェクトのプロキシのための型オブジェクト。

 -- データ: weakref.ProxyTypes

     プロキシのためのすべての型オブジェクトを含むシーケンス。これは両方
     のプロキシ型の名前付けに依存しないで、オブジェクトがプロキシかどう
     かのテストをより簡単にできます。

参考
....

PEP 205(4) - 弱参照

     この機能の提案と理論的根拠。初期の実装と他の言語における類似の機能
     についての情報へのリンクを含んでいます。

* Menu:

* 弱参照オブジェクト::
* 使用例: 使用例<5>.
* ファイナライザオブジェクト::
* Comparing finalizers with __del__() methods: Comparing finalizers with __del__ methods.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/weakref.py

   (2) https://peps.python.org/pep-0584/

   (3) https://peps.python.org/pep-0584/

   (4) https://peps.python.org/pep-0205/


File: python.info,  Node: 弱参照オブジェクト,  Next: 使用例<5>,  Up: weakref --- Weak references

5.8.9.1 弱参照オブジェクト
..........................

Weak reference objects have no methods and no attributes besides *note
ref.__callback__: 11f3.  A weak reference object allows the referent to
be obtained, if it still exists, by calling it:

     >>> import weakref
     >>> class Object:
     ...     pass
     ...
     >>> o = Object()
     >>> r = weakref.ref(o)
     >>> o2 = r()
     >>> o is o2
     True

リファレントがもはや存在しないならば、参照オブジェクトの呼び出しは *note
None: 885. を返します:

     >>> del o, o2
     >>> print(r())
     None

弱参照オブジェクトがまだ生きているかどうかのテストは、式 ‘ref() is not
None’ を用いて行われます。通常、参照オブジェクトを使う必要があるアプリケ
ーションコードはこのパターンに従います:

     # r is a weak reference object
     o = r()
     if o is None:
         # referent has been garbage collected
         print("Object has been deallocated; can't frobnicate.")
     else:
         print("Object is still live!")
         o.do_something_useful()

"生存性(liveness)"のテストを分割すると、スレッド化されたアプリケーション
において競合状態を作り出します。 (訳注:‘if r() is not None:
r().do_something()’ では、2度目のr()がNoneを返す可能性があります) 弱参照
が呼び出される前に、他のスレッドは弱参照が無効になる原因となり得ます。上
で示したイディオムは、シングルスレッドのアプリケーションと同じくマルチス
レッド化されたアプリケーションにおいても安全です。

サブクラス化を行えば、 *note ref: 11f2. オブジェクトの特殊なバージョンを
作成できます。これは *note WeakValueDictionary: 192a. の実装で使われてお
り、マップ内の各エントリによるメモリのオーバヘッドを減らしています。こう
した実装は、ある参照に追加情報を関連付けたい場合に便利ですし、リファレン
トを取り出すための呼び出し時に何らかの追加処理を行いたい場合にも使えます
。

以下の例では、 *note ref: 11f2. のサブクラスを使って、あるオブジェクトに
追加情報を保存し、リファレントがアクセスされたときにその値に作用をできる
ようにするための方法を示しています:

     import weakref

     class ExtendedRef(weakref.ref):
         def __init__(self, ob, callback=None, /, **annotations):
             super().__init__(ob, callback)
             self.__counter = 0
             for k, v in annotations.items():
                 setattr(self, k, v)

         def __call__(self):
             """Return a pair containing the referent and the number of
             times the reference has been called.
             """
             ob = super().__call__()
             if ob is not None:
                 self.__counter += 1
                 ob = (ob, self.__counter)
             return ob


File: python.info,  Node: 使用例<5>,  Next: ファイナライザオブジェクト,  Prev: 弱参照オブジェクト,  Up: weakref --- Weak references

5.8.9.2 使用例
..............

この簡単な例では、アプリケーションが以前に参照したオブジェクトを取り出す
ためにオブジェクトIDを利用する方法を示します。オブジェクトに生きたままで
あることを強制することなく、オブジェクトの IDを他のデータ構造の中で使う
ことができ、必要に応じてIDからオブジェクトを取り出せます。

     import weakref

     _id2obj_dict = weakref.WeakValueDictionary()

     def remember(obj):
         oid = id(obj)
         _id2obj_dict[oid] = obj
         return oid

     def id2obj(oid):
         return _id2obj_dict[oid]


File: python.info,  Node: ファイナライザオブジェクト,  Next: Comparing finalizers with __del__ methods,  Prev: 使用例<5>,  Up: weakref --- Weak references

5.8.9.3 ファイナライザオブジェクト
..................................

The main benefit of using *note finalize: c6f. is that it makes it
simple to register a callback without needing to preserve the returned
finalizer object.  For instance

     >>> import weakref
     >>> class Object:
     ...     pass
     ...
     >>> kenny = Object()
     >>> weakref.finalize(kenny, print, "You killed Kenny!")
     <finalize object at ...; for 'Object' at ...>
     >>> del kenny
     You killed Kenny!

ファイナライザは直接呼び出すこともできます。ただし、ファイナライザはコー
ルバックを最大でも一度しか呼び出しません。

     >>> def callback(x, y, z):
     ...     print("CALLBACK")
     ...     return x + y + z
     ...
     >>> obj = Object()
     >>> f = weakref.finalize(obj, callback, 1, 2, z=3)
     >>> assert f.alive
     >>> assert f() == 6
     CALLBACK
     >>> assert not f.alive
     >>> f()                     # callback not called because finalizer dead
     >>> del obj                 # callback not called because finalizer dead

You can unregister a finalizer using its *note detach(): 29d5. method.
This kills the finalizer and returns the arguments passed to the
constructor when it was created.

     >>> obj = Object()
     >>> f = weakref.finalize(obj, callback, 1, 2, z=3)
     >>> f.detach()
     (<...Object object ...>, <function callback ...>, (1, 2), {'z': 3})
     >>> newobj, func, args, kwargs = _
     >>> assert not f.alive
     >>> assert newobj is obj
     >>> assert func(*args, **kwargs) == 6
     CALLBACK

Unless you set the *note atexit: 29d8. attribute to *note False: d2b, a
finalizer will be called when the program exits if it is still alive.
For instance

     >>> obj = Object()
     >>> weakref.finalize(obj, print, "obj dead or exiting")
     <finalize object at ...; for 'Object' at ...>
     >>> exit()
     obj dead or exiting


File: python.info,  Node: Comparing finalizers with __del__ methods,  Prev: ファイナライザオブジェクト,  Up: weakref --- Weak references

5.8.9.4 Comparing finalizers with ‘__del__()’ methods
.....................................................

インスタンスが一時ディレクトリを表す、クラスを作成するとします。そのディ
レクトリは、次のイベントのいずれかが起きた時に、そのディレクトリの内容と
ともに削除されるべきです。

   * オブジェクトのガベージコレクションが行われた場合

   * the object's ‘remove()’ method is called, or

   * プログラムが終了した場合

We might try to implement the class using a *note __del__(): 11ff.
method as follows:

     class TempDir:
         def __init__(self):
             self.name = tempfile.mkdtemp()

         def remove(self):
             if self.name is not None:
                 shutil.rmtree(self.name)
                 self.name = None

         @property
         def removed(self):
             return self.name is None

         def __del__(self):
             self.remove()

Starting with Python 3.4, *note __del__(): 11ff. methods no longer
prevent reference cycles from being garbage collected, and module
globals are no longer forced to *note None: 885. during *note
interpreter shutdown: 479.  So this code should work without any issues
on CPython.

However, handling of *note __del__(): 11ff. methods is notoriously
implementation specific, since it depends on internal details of the
interpreter's garbage collector implementation.

A more robust alternative can be to define a finalizer which only
references the specific functions and objects that it needs, rather than
having access to the full state of the object:

     class TempDir:
         def __init__(self):
             self.name = tempfile.mkdtemp()
             self._finalizer = weakref.finalize(self, shutil.rmtree, self.name)

         def remove(self):
             self._finalizer()

         @property
         def removed(self):
             return not self._finalizer.alive

Defined like this, our finalizer only receives a reference to the
details it needs to clean up the directory appropriately.  If the object
never gets garbage collected the finalizer will still be called at exit.

The other advantage of weakref based finalizers is that they can be used
to register finalizers for classes where the definition is controlled by
a third party, such as running code when a module is unloaded:

     import weakref, sys
     def unloading_module():
         # implicit reference to the module globals from the function body
     weakref.finalize(sys.modules[__name__], unloading_module)

     注釈: If you create a finalizer object in a daemonic thread just as
     the program exits then there is the possibility that the finalizer
     does not get called at exit.  However, in a daemonic thread *note
     atexit.register(): a7e, ‘try: ... finally: ...’ and ‘with: ...’ do
     not guarantee that cleanup occurs either.


File: python.info,  Node: types --- 動的な型生成と組み込み型の名前,  Next: copy --- 浅いコピーおよび深いコピー操作,  Prev: weakref --- Weak references,  Up: データ型

5.8.10 ‘types’ -- 動的な型生成と組み込み型の名前
------------------------------------------------

'ソースコード:' Lib/types.py(1)

__________________________________________________________________

このモジュールは新しい型の動的な生成を支援するユーティリティ関数を定義し
ます。

さらに、標準の Python インタプリタによって使用されているものの、 *note
int: 19b. や *note str: 169. のように組み込みとして公開されていないよう
ないくつかのオブジェクト型の名前を定義しています。

最後に、組み込みになるほど基本的でないような追加の型関連のユーティリティ
と関数をいくつか提供しています。

* Menu:

* 動的な型生成::
* 標準的なインタプリタ型::
* 追加のユーティリティクラスと関数::
* コルーチンユーティリティ関数::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/types.py


File: python.info,  Node: 動的な型生成,  Next: 標準的なインタプリタ型,  Up: types --- 動的な型生成と組み込み型の名前

5.8.10.1 動的な型生成
.....................

 -- の関数: types.new_class (name, bases=(), kwds=None, exec_body=None)

     適切なメタクラスを使用して動的にクラスオブジェクトを生成します。

     最初の3つの引数はクラス定義ヘッダーを構成する—クラス名、基底クラス
     (順番に)、キーワード引数 (例えば ‘metaclass’)—です。

     'exec_body' 引数は、新規に生成されたクラスの名前空間を構築するため
     に使用されるコールバックです。それは唯一の引数としてクラスの名前空
     間を受け取り、クラスの内容で名前空間を直接更新します。コールバック
     が渡されない場合、それは ‘lambda ns: None’ を渡すことと同じ効果があ
     ります。

     Added in version 3.3.

 -- の関数: types.prepare_class (name, bases=(), kwds=None)

     適切なメタクラスを計算してクラスの名前空間を生成します。

     引数はクラス定義ヘッダーを構成する要素—クラス名、基底クラス (順番に
     )、キーワード引数 (例えば ‘metaclass’)—です。

     返り値は ‘metaclass, namespace, kwds’ の3要素のタプルです

     'metaclass' は適切なメタクラスです。'namespace' は用意されたクラス
     の名前空間です。また 'kwds' は、‘'metaclass'’ エントリが削除された
     、渡された 'kwds' 引数の更新されたコピーです。'kwds' 引数が渡されな
     ければ、これは空の dict になります。

     Added in version 3.3.

     バージョン 3.6 で変更: 返されるタプルの ‘namespace’ 要素のデフォル
     ト値が変更されました。 現在では、メタクラスが ‘__prepare__’ メソッ
     ドを持っていないときは、挿入順序を保存するマッピングが使われます。

参考
....

*note メタクラス: 23be.

     これらの関数によってサポートされるクラス生成プロセスの完全な詳細

PEP 3115(1) - Metaclasses in Python 3000

     ‘__prepare__’ 名前空間フックの導入

 -- の関数: types.resolve_bases (bases)

     Resolve MRO entries dynamically as specified by PEP 560(2).

     This function looks for items in 'bases' that are not instances of
     *note type: f44, and returns a tuple where each such object that
     has an *note __mro_entries__(): ce3. method is replaced with an
     unpacked result of calling this method.  If a 'bases' item is an
     instance of *note type: f44, or it doesn't have an
     ‘__mro_entries__()’ method, then it is included in the return tuple
     unchanged.

     Added in version 3.7.

 -- の関数: types.get_original_bases (cls, /)

     Return the tuple of objects originally given as the bases of 'cls'
     before the *note __mro_entries__(): ce3. method has been called on
     any bases (following the mechanisms laid out in PEP 560(3)).  This
     is useful for introspecting *note Generics: 6f6.

     For classes that have an ‘__orig_bases__’ attribute, this function
     returns the value of ‘cls.__orig_bases__’.  For classes without the
     ‘__orig_bases__’ attribute, *note cls.__bases__: 16c5. is returned.

     例:

          from typing import TypeVar, Generic, NamedTuple, TypedDict

          T = TypeVar("T")
          class Foo(Generic[T]): ...
          class Bar(Foo[int], float): ...
          class Baz(list[str]): ...
          Eggs = NamedTuple("Eggs", [("a", int), ("b", str)])
          Spam = TypedDict("Spam", {"a": int, "b": str})

          assert Bar.__bases__ == (Foo, float)
          assert get_original_bases(Bar) == (Foo[int], float)

          assert Baz.__bases__ == (list,)
          assert get_original_bases(Baz) == (list[str],)

          assert Eggs.__bases__ == (tuple,)
          assert get_original_bases(Eggs) == (NamedTuple,)

          assert Spam.__bases__ == (dict,)
          assert get_original_bases(Spam) == (TypedDict,)

          assert int.__bases__ == (object,)
          assert get_original_bases(int) == (object,)

     Added in version 3.12.

参考
....

PEP 560(4) - typing モジュールとジェネリック型に対する言語コアによるサポ
ート

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3115/

   (2) https://peps.python.org/pep-0560/

   (3) https://peps.python.org/pep-0560/

   (4) https://peps.python.org/pep-0560/


File: python.info,  Node: 標準的なインタプリタ型,  Next: 追加のユーティリティクラスと関数,  Prev: 動的な型生成,  Up: types --- 動的な型生成と組み込み型の名前

5.8.10.2 標準的なインタプリタ型
...............................

このモジュールは、Python インタプリタを実装するために必要な多くの型に対
して名前を提供します。それは、‘listiterator’ 型のような、単に処理中に付
随的に発生するいくつかの型が含まれることを意図的に避けています。

これらの名前は典型的に *note isinstance(): 2ad. や *note issubclass():
9c4. によるチェックに使われます。

これらのタイプのいずれかをインスタンス化する場合、シグネチャは Python の
バージョンによって異なる可能性があることに注意してください。

以下の型に対して標準的な名前が定義されています:

 -- データ: types.NoneType

     *note None: 885. の型です。

     Added in version 3.10.

 -- データ: types.FunctionType
 -- データ: types.LambdaType

     ユーザ定義の関数と *note lambda: 14b5. 式によって生成された関数の型
     です。

     引数 ‘code’ を指定して *note 監査イベント: 1c6e. ‘function.__new__’
     を送出します。

     この監査イベントは、関数オブジェクトを直接インスタンス化した場合に
     のみ発生し、通常のコンパイル時には発生しません。

 -- データ: types.GeneratorType

     ジェネレータ関数によって生成された *note ジェネレータ: 126c. イテレ
     ータオブジェクトの型です。

 -- データ: types.CoroutineType

     *note async def: 7ed. 関数に生成される *note コルーチン: 6b9. オブ
     ジェクトです。

     Added in version 3.5.

 -- データ: types.AsyncGeneratorType

     非同期ジェネレータ関数によって作成された *note 非同期ジェネレータ:
     249b. イテレータオブジェクトの型です。

     Added in version 3.6.

 -- クラス: types.CodeType (**kwargs)

     The type of *note code objects: 4e6. such as returned by *note
     compile(): 4b1.

     引数 ‘code’, ‘filename’, ‘name’, ‘argcount’, ‘posonlyargcount’,
     ‘kwonlyargcount’, ‘nlocals’, ‘stacksize’, ‘flags’ を指定して *note
     監査イベント: 1c6e. ‘code.__new__’ を送出します。

     Note that the audited arguments may not match the names or
     positions required by the initializer.  The audit event only occurs
     for direct instantiation of code objects, and is not raised for
     normal compilation.

 -- データ: types.CellType

     The type for cell objects: such objects are used as containers for
     a function's *note closure variables: 1893.

     Added in version 3.8.

 -- データ: types.MethodType

     ユーザー定義のクラスのインスタンスのメソッドの型です。

 -- データ: types.BuiltinFunctionType
 -- データ: types.BuiltinMethodType

     *note len(): 840. や *note sys.exit(): 277. のような組み込み関数や
     、組み込み型のメソッドの型です。 (ここでは "組み込み" という単語を
     "Cで書かれた" という意味で使っています)

 -- データ: types.WrapperDescriptorType

     The type of methods of some built-in data types and base classes
     such as *note object.__init__(): 8bf. or *note object.__lt__():
     14b8.

     Added in version 3.7.

 -- データ: types.MethodWrapperType

     The type of 'bound' methods of some built-in data types and base
     classes.  For example it is the type of ‘object().__str__’.

     Added in version 3.7.

 -- データ: types.NotImplementedType

     *note NotImplemented: 1a2. の型です。

     Added in version 3.10.

 -- データ: types.MethodDescriptorType

     The type of methods of some built-in data types such as *note
     str.join(): 2609.

     Added in version 3.7.

 -- データ: types.ClassMethodDescriptorType

     The type of 'unbound' class methods of some built-in data types
     such as ‘dict.__dict__['fromkeys']’.

     Added in version 3.7.

 -- クラス: types.ModuleType (name, doc=None)

     *note module: 19de. の型です。コンストラクタは生成するモジュールの
     名前と任意でその *note docstring: 22ec. を受け取ります。

     参考
     ....

     *note Documentation on module objects: 235e.

          Provides details on the special attributes that can be found
          on instances of ‘ModuleType’.

     *note importlib.util.module_from_spec(): 1013.

          Modules created using the ‘ModuleType’ constructor are created
          with many of their special attributes unset or set to default
          values.  ‘module_from_spec()’ provides a more robust way of
          creating ‘ModuleType’ instances which ensures the various
          attributes are set appropriately.

 -- データ: types.EllipsisType

     *note Ellipsis: 2328. の型です。

     Added in version 3.10.

 -- クラス: types.GenericAlias (t_origin, t_args)

     The type of *note parameterized generics: 8c1. such as ‘list[int]’.

     ‘t_origin’ should be a non-parameterized generic class, such as
     ‘list’, ‘tuple’ or ‘dict’.  ‘t_args’ should be a *note tuple: 614.
     (possibly of length 1) of types which parameterize ‘t_origin’:

          >>> from types import GenericAlias

          >>> list[int] == GenericAlias(list, (int,))
          True
          >>> dict[str, int] == GenericAlias(dict, (str, int))
          True

     Added in version 3.9.

     バージョン 3.9.2 で変更: This type can now be subclassed.

     参考
     ....

     *note Generic Alias Types: 8c1.

          In-depth documentation on instances of ‘types.GenericAlias’

     PEP 585(1) - 標準コレクション型の型ヒントにおける総称型 (generics) の使用

          Introducing the ‘types.GenericAlias’ class

 -- クラス: types.UnionType

     The type of *note union type expressions: 9c5.

     Added in version 3.10.

     バージョン 3.14 で変更: This is now an alias for *note
     typing.Union: 2a8.

 -- クラス: types.TracebackType (tb_next, tb_frame, tb_lasti, tb_lineno)

     ‘sys.exception().__traceback__’ に含まれるようなトレースバックオブ
     ジェクトの型です。

     See *note the language reference: cec. for details of the available
     attributes and operations, and guidance on creating tracebacks
     dynamically.

 -- データ: types.FrameType

     The type of *note frame objects: 8ef. such as found in *note
     tb.tb_frame: 23a1. if ‘tb’ is a traceback object.

 -- データ: types.GetSetDescriptorType

     The type of objects defined in extension modules with
     ‘PyGetSetDef’, such as *note FrameType.f_locals: 4a5. or
     ‘array.array.typecode’.  This type is used as descriptor for object
     attributes; it has the same purpose as the *note property: 4b3.
     type, but for classes defined in extension modules.

 -- データ: types.MemberDescriptorType

     ‘datetime.timedelta.days’ のような、拡張モジュールにおいて
     ‘PyMemberDef’ によって定義されたオブジェクトの型です。この型は、標
     準の変換関数を利用するような、Cのシンプルなデータメンバで利用されま
     す。 *note property: 4b3. 型と同じ目的を持った型ですが、こちらは拡
     張モジュールで定義された型のためのものです。

     In addition, when a class is defined with a *note __slots__: 1704.
     attribute, then for each slot, an instance of
     ‘MemberDescriptorType’ will be added as an attribute on the class.
     This allows the slot to appear in the class's *note __dict__: e57.

     Pythonの他の実装では、この型は ‘GetSetDescriptorType’ と同じかもし
     れません。

 -- クラス: types.MappingProxyType (mapping)

     読み出し専用のマッピングのプロキシです。マッピングのエントリーに関
     する動的なビューを提供します。つまり、マッピングが変わった場合にビ
     ューがこれらの変更を反映するということです。

     Added in version 3.3.

     バージョン 3.9 で変更: Updated to support the new union (‘|’)
     operator from PEP 584(2), which simply delegates to the underlying
     mapping.

      -- Describe: key in proxy

          元になったマッピングが 'key' というキーを持っている場合 ‘True’
          を返します。そうでなければ ‘False’ を返します。

      -- Describe: proxy[key]

          元になったマッピングの 'key' というキーに対応するアイテムを返
          します。 'key' が存在しなければ、 *note KeyError: 5e7. が発生
          します。

      -- Describe: iter(proxy)

          元になったマッピングのキーを列挙するイテレータを返します。これ
          は ‘iter(proxy.keys())’ のショートカットです。

      -- Describe: len(proxy)

          元になったマッピングに含まれるアイテムの数を返します。

      -- メソッド: copy ()

          元になったマッピングの浅いコピーを返します。

      -- メソッド: get (key[, default])

          'key' が元になったマッピングに含まれている場合 'key' に対する
          値を返し、そうでなければ 'default' を返します。もし 'default'
          が与えられない場合は、デフォルト値の ‘None’ になります。そのた
          め、このメソッドが *note KeyError: 5e7. を発生させることはあり
          ません。

      -- メソッド: items ()

          元になったマッピングの items (‘(key, value)’ ペアの列) に対す
          る新しいビューを返します。

      -- メソッド: keys ()

          元になったマッピングの keys に対する新しいビューを返します。

      -- メソッド: values ()

          元になったマッピングの values に対する新しいビューを返します。

      -- Describe: reversed(proxy)

          Return a reverse iterator over the keys of the underlying
          mapping.

          Added in version 3.9.

      -- Describe: hash(proxy)

          Return a hash of the underlying mapping.

          Added in version 3.12.

 -- クラス: types.CapsuleType

     The type of *note capsule objects: 29f3.

     Added in version 3.13.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0585/

   (2) https://peps.python.org/pep-0584/


File: python.info,  Node: 追加のユーティリティクラスと関数,  Next: コルーチンユーティリティ関数,  Prev: 標準的なインタプリタ型,  Up: types --- 動的な型生成と組み込み型の名前

5.8.10.3 追加のユーティリティクラスと関数
.........................................

 -- クラス: types.SimpleNamespace

     名前空間への属性アクセスに加えて意味のある repr を提供するための、
     単純な *note object: c7e. サブクラスです。

     Unlike *note object: c7e, with ‘SimpleNamespace’ you can add and
     remove attributes.

     *note SimpleNamespace: 4e5. objects may be initialized in the same
     way as *note dict: 183.: either with keyword arguments, with a
     single positional argument, or with both.  When initialized with
     keyword arguments, those are directly added to the underlying
     namespace.  Alternatively, when initialized with a positional
     argument, the underlying namespace will be updated with key-value
     pairs from that argument (either a mapping object or an *note
     iterable: 12f1. object producing key-value pairs).  All such keys
     must be strings.

     この型は以下のコードとほぼ等価です:

          class SimpleNamespace:
              def __init__(self, mapping_or_iterable=(), /, **kwargs):
                  self.__dict__.update(mapping_or_iterable)
                  self.__dict__.update(kwargs)

              def __repr__(self):
                  items = (f"{k}={v!r}" for k, v in self.__dict__.items())
                  return "{}({})".format(type(self).__name__, ", ".join(items))

              def __eq__(self, other):
                  if isinstance(self, SimpleNamespace) and isinstance(other, SimpleNamespace):
                     return self.__dict__ == other.__dict__
                  return NotImplemented

     ‘SimpleNamespace’ は ‘class NS: pass’ を置き換えるものとして有用か
     もしれません。ですが、構造化されたレコード型に対しては、これよりは
     むしろ *note namedtuple(): 4e0. を使用してください。

     ‘SimpleNamespace’ objects are supported by *note copy.replace():
     1c0.

     Added in version 3.3.

     バージョン 3.9 で変更: Attribute order in the repr changed from
     alphabetical to insertion (like ‘dict’).

     バージョン 3.13 で変更: Added support for an optional positional
     argument.

 -- の関数: types.DynamicClassAttribute (fget=None, fset=None,
          fdel=None, doc=None)

     クラスの属性アクセスを __getattr__ に振り替えます。

     これは記述子で、インスタンス経由のアクセスとクラス経由のアクセスで
     振る舞いが異なる属性を定義するのに使います。インスタンスアクセスは
     通常通りですが、クラス経由の属性アクセスはクラスの __getattr__ メソ
     ッドに振り替えられます。これは AttributeError の送出により行われま
     す。

     これによって、インスタンス上で有効なプロパティを持ち、クラス上で同
     名の仮想属性を持つことができます (例については *note enum.Enum:
     842. を参照してください)。

     Added in version 3.4.


File: python.info,  Node: コルーチンユーティリティ関数,  Prev: 追加のユーティリティクラスと関数,  Up: types --- 動的な型生成と組み込み型の名前

5.8.10.4 コルーチンユーティリティ関数
.....................................

 -- の関数: types.coroutine (gen_func)

     この関数は、 *note generator: 126c. 関数を、ジェネレータベースのコ
     ルーチンを返す *note coroutine function: f73. に変換します。返され
     るジェネレータベースのコルーチンは依然として *note generator
     iterator: dd9. ですが、同時に *note coroutine: 6b9. オブジェクトか
     つ *note awaitable: 4c9. であるとみなされます。ただし、必ずしも
     *note __await__(): f75. メソッドを実装する必要はありません。

     'gen_func' はジェネレータ関数で、インプレースに変更されます。

     'gen_func' がジェネレータ関数でない場合、この関数はラップされます。
     この関数が *note collections.abc.Generator: fdb. のインスタンスを返
     す場合、このインスタンスは 'awaitable' なプロキシオブジェクトにラッ
     プされます。それ以外のすべての型のオブジェクトは、そのまま返されま
     す。

     Added in version 3.5.


File: python.info,  Node: copy --- 浅いコピーおよび深いコピー操作,  Next: pprint --- データの整形表示,  Prev: types --- 動的な型生成と組み込み型の名前,  Up: データ型

5.8.11 ‘copy’ -- 浅いコピーおよび深いコピー操作
-----------------------------------------------

'ソースコード:' Lib/copy.py(1)

__________________________________________________________________

Python において代入文はオブジェクトをコピーしません。代入はターゲットと
オブジェクトの間に束縛を作ります。ミュータブルなコレクションまたはミュー
タブルなアイテムを含むコレクションについては、元のオブジェクトを変更せず
にコピーを変更できるように、コピーが必要になることが時々あります。このモ
ジュールは、汎用的な浅い (shallow) コピーと深い (deep) コピーの操作 (以
下で説明されます) を提供します。

以下にインターフェースをまとめます:

 -- の関数: copy.copy (obj)

     'obj' の浅い (shallow) コピーを返します。

 -- の関数: copy.deepcopy (obj[, memo])

     'obj' の深い (deep) コピーを返します。

 -- の関数: copy.replace (obj, /, **changes)

     Creates a new object of the same type as 'obj', replacing fields
     with values from 'changes'.

     Added in version 3.13.

 -- 例外: copy.Error

     モジュール特有のエラーを送出します。
浅い (shallow) コピーと深い (deep) コピーの違いが関係するのは、複合オブ
ジェクト (リストやクラスインスタンスのような他のオブジェクトを含むオブジ
ェクト) だけです:

   * '浅いコピー (shallow copy)' は新たな複合オブジェクトを作成し、その
     後 (可能な限り) 元のオブジェクト中に見つかったオブジェクトに対する
     '参照' を挿入します。

   * '深いコピー (deep copy)' は新たな複合オブジェクトを作成し、その後元
     のオブジェクト中に見つかったオブジェクトの 'コピー' を挿入します。

深いコピー操作には、しばしば浅いコピー操作の時には存在しない 2 つの問題
がついてまわります:

   * 再帰的なオブジェクト (直接、間接に関わらず、自分自身に対する参照を
     持つ複合オブジェクト) は再帰ループを引き起こします。

   * 深いコピーは何もかもコピーしてしまうため、例えば複数のコピー間で共
     有するつもりだったデータも余分にコピーしてしまいます。

*note deepcopy(): d65. 関数では、これらの問題を以下のようにして回避して
います:

   * 現時点でのコピー過程ですでにコピーされたオブジェクトの ‘memo’ 辞書
     を保持する。

   * ユーザ定義のクラスでコピー操作やコピーされる内容の集合を上書きでき
     るようにする。

このモジュールでは、モジュール、メソッド、スタックトレース、スタックフレ
ーム、ファイル、ソケット、ウィンドウ、その他これらに類似の型をコピーしま
せん。このモジュールでは元のオブジェクトを変更せずに返すことで関数とクラ
スを (浅くまたは深く)「コピー」します。これは *note pickle: ab. モジュー
ルでの扱われかたと同じです。

辞書型の浅いコピーは *note dict.copy(): dc9. で、リストの浅いコピーはリ
スト全体を指すスライス (例えば ‘copied_list = original_list[:]’) ででき
ます。

Classes can use the same interfaces to control copying that they use to
control pickling.  See the description of module *note pickle: ab. for
information on these methods.  In fact, the ‘copy’ module uses the
registered pickle functions from the *note copyreg: 2a. module.

In order for a class to define its own copy implementation, it can
define special methods *note __copy__(): 17e0. and *note __deepcopy__():
17e1.

 -- メソッド: object.__copy__ (self)

     Called to implement the shallow copy operation; no additional
     arguments are passed.

 -- メソッド: object.__deepcopy__ (self, memo)

     Called to implement the deep copy operation; it is passed one
     argument, the 'memo' dictionary.  If the ‘__deepcopy__’
     implementation needs to make a deep copy of a component, it should
     call the *note deepcopy(): d65. function with the component as
     first argument and the 'memo' dictionary as second argument.  The
     'memo' dictionary should be treated as an opaque object.

Function ‘copy.replace()’ is more limited than *note copy(): 757. and
*note deepcopy(): d65, and only supports named tuples created by *note
namedtuple(): 4e0, *note dataclasses: 33, and other classes which define
method *note __replace__(): 47d.

 -- メソッド: object.__replace__ (self, /, **changes)

     This method should create a new object of the same type, replacing
     fields with values from 'changes'.

     Added in version 3.13.

参考
....

*note pickle: ab. モジュール

     オブジェクト状態の取得と復元をサポートするために使われる特殊メソッ
     ドについて議論されています。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/copy.py


File: python.info,  Node: pprint --- データの整形表示,  Next: reprlib --- もう一つの repr の実装,  Prev: copy --- 浅いコピーおよび深いコピー操作,  Up: データ型

5.8.12 ‘pprint’ -- データの整形表示
-----------------------------------

'ソースコード:' Lib/pprint.py(1)

__________________________________________________________________

The ‘pprint’ module provides a capability to "pretty-print" arbitrary
Python data structures in a form which can be used as input to the
interpreter.  If the formatted structures include objects which are not
fundamental Python types, the representation may not be loadable.  This
may be the case if objects such as files, sockets or classes are
included, as well as many other objects which are not representable as
Python literals.

The formatted representation keeps objects on a single line if it can,
and breaks them onto multiple lines if they don't fit within the allowed
width, adjustable by the 'width' parameter defaulting to 80 characters.

バージョン 3.9 で変更: *note types.SimpleNamespace: 4e5. の pretty-print
サポートが追加されました。

バージョン 3.10 で変更: *note dataclasses.dataclass: 4e1. の
pretty-print サポートが追加されました。

* Menu:

* 関数: 関数<4>.
* PrettyPrinter オブジェクト::
* 使用例: 使用例<6>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/pprint.py


File: python.info,  Node: 関数<4>,  Next: PrettyPrinter オブジェクト,  Up: pprint --- データの整形表示

5.8.12.1 関数
.............

 -- の関数: pprint.pp (object, stream=None, indent=1, width=80,
          depth=None, *, compact=False, sort_dicts=False,
          underscore_numbers=False)

     'object' のフォーマットされた表現を出力して、その後に newline を続
     けます。この関数は、対話型インタプリタの中で値を調査するために
     *note print(): 1177. 関数の代わりに使用されることがあります。Tips：
     さらに、スコープ内で使用するために ‘print = pprint.pp’ を再代入する
     ことができます)。


     パラメータ:

        * ‘object’ - The object to be printed.

        * ‘stream’ (*note file-like object: 17ac. | None) - A file-like
          object to which the output will be written by calling its
          ‘write()’ method.  If ‘None’ (the default), *note sys.stdout:
          ccd. is used.

        * ‘indent’ (*note int: 19b.) - 入れ子レベルごとに追加されるイン
          デントの量を指定します。

        * ‘width’ (*note int: 19b.) - 出力の1行あたり最大文字数を指定し
          ます。構造が幅の制約の中で整形できない場合、最善の努力がなされ
          ます。

        * ‘depth’ (*note int: 19b.‘ | ’‘None’) - 表示される入れ子レベル
          の数を制御します。表示されるデータ構造が深すぎる場合、含まれる
          次のレベルは''...''で置き換えられます。‘None’ （デフォルト）の
          場合、フォーマットされるオブジェクトの深さに制約はありません。

        * ‘compact’ (*note bool: 3c3.) - Control the way long *note
          sequences: 716. are formatted.  If ‘False’ (the default), each
          item of a sequence will be formatted on a separate line,
          otherwise as many items as will fit within the 'width' will be
          formatted on each output line.

        * ‘sort_dicts’ (*note bool: 3c3.) - Trueの場合、辞書は辞書のキー
          順にソートされて整形されます。そうでなければ挿入順に表示されま
          す（デフォルト）。

        * ‘underscore_numbers’ (*note bool: 3c3.) - Trueの場合、整数は
          ''_''で3桁区切りされて表示されます。そうでなければアンダースコ
          アは表示されません（デフォルト）。

          >>> import pprint
          >>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
          >>> stuff.insert(0, stuff)
          >>> pprint.pp(stuff)
          [<Recursion on list with id=...>,
           'spam',
           'eggs',
           'lumberjack',
           'knights',
           'ni']

     Added in version 3.8.

 -- の関数: pprint.pprint (object, stream=None, indent=1, width=80,
          depth=None, *, compact=False, sort_dicts=True,
          underscore_numbers=False)

     Alias for *note pp(): c18. with 'sort_dicts' set to ‘True’ by
     default, which would automatically sort the dictionaries' keys, you
     might want to use *note pp(): c18. instead where it is ‘False’ by
     default.

 -- の関数: pprint.pformat (object, indent=1, width=80, depth=None, *,
          compact=False, sort_dicts=True, underscore_numbers=False)

     Return the formatted representation of 'object' as a string.
     'indent', 'width', 'depth', 'compact', 'sort_dicts' and
     'underscore_numbers' are passed to the *note PrettyPrinter: 1181.
     constructor as formatting parameters and their meanings are as
     described in the documentation above.

 -- の関数: pprint.isreadable (object)

     'object' を書式化して出力できる("readable") か、あるいは *note
     eval(): 4a3. を使って値を再構成できるかを返します。再帰的なオブジェ
     クトに対しては常に ‘False’ を返します。

          >>> pprint.isreadable(stuff)
          False

 -- の関数: pprint.isrecursive (object)

     Determine if 'object' requires a recursive representation.  This
     function is subject to the same limitations as noted in *note
     saferepr(): 2a01. below and may raise an *note RecursionError: f68.
     if it fails to detect a recursive object.

 -- の関数: pprint.saferepr (object)

     Return a string representation of 'object', protected against
     recursion in some common data structures, namely instances of *note
     dict: 183, *note list: 24d. and *note tuple: 614. or subclasses
     whose ‘__repr__’ has not been overridden.  If the representation of
     object exposes a recursive entry, the recursive reference will be
     represented as ‘<Recursion on typename with id=number>’.  The
     representation is not otherwise formatted.

          >>> pprint.saferepr(stuff)
          "[<Recursion on list with id=...>, 'spam', 'eggs', 'lumberjack', 'knights', 'ni']"


File: python.info,  Node: PrettyPrinter オブジェクト,  Next: 使用例<6>,  Prev: 関数<4>,  Up: pprint --- データの整形表示

5.8.12.2 PrettyPrinter オブジェクト
...................................

 -- クラス: pprint.PrettyPrinter (indent=1, width=80, depth=None,
          stream=None, *, compact=False, sort_dicts=True,
          underscore_numbers=False)

     Construct a *note PrettyPrinter: 1181. instance.

     Arguments have the same meaning as for *note pp(): c18.  Note that
     they are in a different order, and that 'sort_dicts' defaults to
     ‘True’.

          >>> import pprint
          >>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
          >>> stuff.insert(0, stuff[:])
          >>> pp = pprint.PrettyPrinter(indent=4)
          >>> pp.pprint(stuff)
          [   ['spam', 'eggs', 'lumberjack', 'knights', 'ni'],
              'spam',
              'eggs',
              'lumberjack',
              'knights',
              'ni']
          >>> pp = pprint.PrettyPrinter(width=41, compact=True)
          >>> pp.pprint(stuff)
          [['spam', 'eggs', 'lumberjack',
            'knights', 'ni'],
           'spam', 'eggs', 'lumberjack', 'knights',
           'ni']
          >>> tup = ('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead',
          ... ('parrot', ('fresh fruit',))))))))
          >>> pp = pprint.PrettyPrinter(depth=6)
          >>> pp.pprint(tup)
          ('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead', (...)))))))

     バージョン 3.4 で変更: 'compact' 引数が追加されました。

     バージョン 3.8 で変更: 'sort_dicts' 引数が追加されました。

     バージョン 3.10 で変更: 'underscore_numbers' 引数が追加されました。

     バージョン 3.11 で変更: No longer attempts to write to ‘sys.stdout’
     if it is ‘None’.

*note PrettyPrinter: 1181. インスタンスには以下のメソッドがあります:

 -- メソッド: PrettyPrinter.pformat (object)

     'object' の書式化した表現を返します。これは *note PrettyPrinter:
     1181. のコンストラクタに渡されたオプションを考慮して書式化されます
     。

 -- メソッド: PrettyPrinter.pprint (object)

     'object' の書式化した表現を指定したストリームに出力し、最後に改行し
     ます。

以下のメソッドは、対応する同じ名前の関数と同じ機能を持っています。以下の
メソッドをインスタンスに対して使うと、新たに *note PrettyPrinter: 1181.
オブジェクトを作る必要がないのでちょっぴり効果的です。

 -- メソッド: PrettyPrinter.isreadable (object)

     'object' を書式化して出力できる（"readable"）か、あるいは *note
     eval(): 4a3. を使って値を再構成できるかを返します。これは再帰的なオ
     ブジェクトに対して ‘False’ を返すことに注意して下さい。もし *note
     PrettyPrinter: 1181. の 'depth' 引数が設定されていて、オブジェクト
     のレベルが設定よりも深かったら、 ‘False’ を返します。

 -- メソッド: PrettyPrinter.isrecursive (object)

     オブジェクトが再帰的な表現かどうかを返します。

このメソッドをフックとして、サブクラスがオブジェクトを文字列に変換する方
法を修正するのが可能になっています。デフォルトの実装では、内部で *note
saferepr(): 2a01. を呼び出しています。

 -- メソッド: PrettyPrinter.format (object, context, maxlevels, level)

     次の3つの値を返します。'object' をフォーマット化して文字列にしたも
     の、その結果が読み込み可能かどうかを示すフラグ、再帰が含まれている
     かどうかを示すフラグ。最初の引数は表示するオブジェクトです。 2つめ
     の引数はオブジェクトの *note id(): 163c. をキーとして含むディクショ
     ナリで、オブジェクトを含んでいる現在の（直接、間接に 'object' のコ
     ンテナとして表示に影響を与える）環境です。ディクショナリ 'context'
     の中でどのオブジェクトが表示されたか表示する必要があるなら、3つめの
     返り値は ‘True’ になります。 *note format(): 1ce7. メソッドの再帰呼
     び出しではこのディクショナリのコンテナに対してさらにエントリを加え
     ます。 3つめの引数 'maxlevels' で再帰呼び出しのレベルを制限します。
     制限しない場合、 ‘0’ になります。この引数は再帰呼び出しでそのまま渡
     されます。 4つめの引数 'level' で現在のレベルを設定します。再帰呼び
     出しでは、現在の呼び出しより小さい値が渡されます。


File: python.info,  Node: 使用例<6>,  Prev: PrettyPrinter オブジェクト,  Up: pprint --- データの整形表示

5.8.12.3 使用例
...............

*note pp(): c18. 関数のいくつかの用途とそのパラメータを実証するために、
PyPI(1) からプロジェクトに関する情報を取って来ましょう:

     >>> import json
     >>> import pprint
     >>> from urllib.request import urlopen
     >>> with urlopen('https://pypi.org/pypi/sampleproject/1.2.0/json') as resp:
     ...     project_info = json.load(resp)['info']

その基本形式では、 *note pp(): c18. はオブジェクト全体を表示します:

     >>> pprint.pp(project_info)
     {'author': 'The Python Packaging Authority',
      'author_email': 'pypa-dev@googlegroups.com',
      'bugtrack_url': None,
      'classifiers': ['Development Status :: 3 - Alpha',
                      'Intended Audience :: Developers',
                      'License :: OSI Approved :: MIT License',
                      'Programming Language :: Python :: 2',
                      'Programming Language :: Python :: 2.6',
                      'Programming Language :: Python :: 2.7',
                      'Programming Language :: Python :: 3',
                      'Programming Language :: Python :: 3.2',
                      'Programming Language :: Python :: 3.3',
                      'Programming Language :: Python :: 3.4',
                      'Topic :: Software Development :: Build Tools'],
      'description': 'A sample Python project\n'
                     '=======================\n'
                     '\n'
                     'This is the description file for the project.\n'
                     '\n'
                     'The file should use UTF-8 encoding and be written using '
                     'ReStructured Text. It\n'
                     'will be used to generate the project webpage on PyPI, and '
                     'should be written for\n'
                     'that purpose.\n'
                     '\n'
                     'Typical contents for this file would include an overview of '
                     'the project, basic\n'
                     'usage examples, etc. Generally, including the project '
                     'changelog in here is not\n'
                     'a good idea, although a simple "What\'s New" section for the '
                     'most recent version\n'
                     'may be appropriate.',
      'description_content_type': None,
      'docs_url': None,
      'download_url': 'UNKNOWN',
      'downloads': {'last_day': -1, 'last_month': -1, 'last_week': -1},
      'home_page': 'https://github.com/pypa/sampleproject',
      'keywords': 'sample setuptools development',
      'license': 'MIT',
      'maintainer': None,
      'maintainer_email': None,
      'name': 'sampleproject',
      'package_url': 'https://pypi.org/project/sampleproject/',
      'platform': 'UNKNOWN',
      'project_url': 'https://pypi.org/project/sampleproject/',
      'project_urls': {'Download': 'UNKNOWN',
                       'Homepage': 'https://github.com/pypa/sampleproject'},
      'release_url': 'https://pypi.org/project/sampleproject/1.2.0/',
      'requires_dist': None,
      'requires_python': None,
      'summary': 'A sample Python project',
      'version': '1.2.0'}

結果をある深さ 'depth' に制限することができます (より深い内容には省略記
号が使用されます):

     >>> pprint.pp(project_info, depth=1)
     {'author': 'The Python Packaging Authority',
      'author_email': 'pypa-dev@googlegroups.com',
      'bugtrack_url': None,
      'classifiers': [...],
      'description': 'A sample Python project\n'
                     '=======================\n'
                     '\n'
                     'This is the description file for the project.\n'
                     '\n'
                     'The file should use UTF-8 encoding and be written using '
                     'ReStructured Text. It\n'
                     'will be used to generate the project webpage on PyPI, and '
                     'should be written for\n'
                     'that purpose.\n'
                     '\n'
                     'Typical contents for this file would include an overview of '
                     'the project, basic\n'
                     'usage examples, etc. Generally, including the project '
                     'changelog in here is not\n'
                     'a good idea, although a simple "What\'s New" section for the '
                     'most recent version\n'
                     'may be appropriate.',
      'description_content_type': None,
      'docs_url': None,
      'download_url': 'UNKNOWN',
      'downloads': {...},
      'home_page': 'https://github.com/pypa/sampleproject',
      'keywords': 'sample setuptools development',
      'license': 'MIT',
      'maintainer': None,
      'maintainer_email': None,
      'name': 'sampleproject',
      'package_url': 'https://pypi.org/project/sampleproject/',
      'platform': 'UNKNOWN',
      'project_url': 'https://pypi.org/project/sampleproject/',
      'project_urls': {...},
      'release_url': 'https://pypi.org/project/sampleproject/1.2.0/',
      'requires_dist': None,
      'requires_python': None,
      'summary': 'A sample Python project',
      'version': '1.2.0'}

それに加えて、最大の文字幅 'width' を指示することもできます。長いオブジ
ェクトを分離することができなければ、指定された幅を超過します:

     >>> pprint.pp(project_info, depth=1, width=60)
     {'author': 'The Python Packaging Authority',
      'author_email': 'pypa-dev@googlegroups.com',
      'bugtrack_url': None,
      'classifiers': [...],
      'description': 'A sample Python project\n'
                     '=======================\n'
                     '\n'
                     'This is the description file for the '
                     'project.\n'
                     '\n'
                     'The file should use UTF-8 encoding and be '
                     'written using ReStructured Text. It\n'
                     'will be used to generate the project '
                     'webpage on PyPI, and should be written '
                     'for\n'
                     'that purpose.\n'
                     '\n'
                     'Typical contents for this file would '
                     'include an overview of the project, '
                     'basic\n'
                     'usage examples, etc. Generally, including '
                     'the project changelog in here is not\n'
                     'a good idea, although a simple "What\'s '
                     'New" section for the most recent version\n'
                     'may be appropriate.',
      'description_content_type': None,
      'docs_url': None,
      'download_url': 'UNKNOWN',
      'downloads': {...},
      'home_page': 'https://github.com/pypa/sampleproject',
      'keywords': 'sample setuptools development',
      'license': 'MIT',
      'maintainer': None,
      'maintainer_email': None,
      'name': 'sampleproject',
      'package_url': 'https://pypi.org/project/sampleproject/',
      'platform': 'UNKNOWN',
      'project_url': 'https://pypi.org/project/sampleproject/',
      'project_urls': {...},
      'release_url': 'https://pypi.org/project/sampleproject/1.2.0/',
      'requires_dist': None,
      'requires_python': None,
      'summary': 'A sample Python project',
      'version': '1.2.0'}

   ---------- Footnotes ----------

   (1) https://pypi.org


File: python.info,  Node: reprlib --- もう一つの repr の実装,  Next: enum --- 列挙型のサポート,  Prev: pprint --- データの整形表示,  Up: データ型

5.8.13 ‘reprlib’ -- もう一つの ‘repr()’ の実装
----------------------------------------------

'ソースコード:' Lib/reprlib.py(1)

__________________________________________________________________

‘reprlib’ モジュールは、結果の文字列のサイズに対する制限付きでオブジェク
ト表現を生成するための手段を提供します。これは Python デバッガの中で使用
されており、他の文脈でも同様に役に立つかもしれません。

このモジュールはクラスとインスタンス、それに関数を提供します:

 -- クラス: reprlib.Repr (*, maxlevel=6, maxtuple=6, maxlist=6,
          maxarray=5, maxdict=4, maxset=6, maxfrozenset=6, maxdeque=6,
          maxstring=30, maxlong=40, maxother=30, fillvalue='...',
          indent=None)

     組み込み関数 *note repr(): 1c1. に似た関数を実装するために役に立つ
     フォーマット用サービスを提供します。 過度に長い表現を作り出さないよ
     うにするための大きさの制限をオブジェクト型ごとに設定できます。

     The keyword arguments of the constructor can be used as a shortcut
     to set the attributes of the *note Repr: 2a0d. instance.  Which
     means that the following initialization:

          aRepr = reprlib.Repr(maxlevel=3)

     は、次のコードと等しいです:

          aRepr = reprlib.Repr()
          aRepr.maxlevel = 3

     See section *note Repr Objects: 2a0e. for more information about
     *note Repr: 2a0d. attributes.

     バージョン 3.12 で変更: Allow attributes to be set via keyword
     arguments.

 -- データ: reprlib.aRepr

     これは下で説明される *note repr(): 2a10. 関数を提供するために使われ
     る *note Repr: 2a0d. のインスタンスです。このオブジェクトの属性を変
     更すると、 *note repr(): 2a10. と Python デバッガが使うサイズ制限に
     影響します。

 -- の関数: reprlib.repr (obj)

     これは ‘aRepr’ の *note repr(): 2a11. メソッドです。同じ名前の組み
     込み関数が返す文字列と似ていますが、最大サイズに制限のある文字列を
     返します。

In addition to size-limiting tools, the module also provides a decorator
for detecting recursive calls to *note __repr__(): 82f. and substituting
a placeholder string instead.

 -- の関数: @reprlib.recursive_repr (fillvalue='...')

     Decorator for *note __repr__(): 82f. methods to detect recursive
     calls within the same thread.  If a recursive call is made, the
     'fillvalue' is returned, otherwise, the usual ‘__repr__()’ call is
     made.  For example:

          >>> from reprlib import recursive_repr
          >>> class MyList(list):
          ...     @recursive_repr()
          ...     def __repr__(self):
          ...         return '<' + '|'.join(map(repr, self)) + '>'
          ...
          >>> m = MyList('abc')
          >>> m.append(m)
          >>> m.append('x')
          >>> print(m)
          <'a'|'b'|'c'|...|'x'>

     Added in version 3.2.

* Menu:

* Reprオブジェクト::
* Reprオブジェクトをサブクラス化する::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/reprlib.py


File: python.info,  Node: Reprオブジェクト,  Next: Reprオブジェクトをサブクラス化する,  Up: reprlib --- もう一つの repr の実装

5.8.13.1 Reprオブジェクト
.........................

*note Repr: 2a0d. インスタンスはオブジェクト型毎に表現する文字列のサイズ
を制限するために使えるいくつかの属性と、特定のオブジェクト型をフォーマッ
トするメソッドを提供します。

 -- の属性: Repr.fillvalue

     This string is displayed for recursive references.  It defaults to
     ‘...’.

     Added in version 3.11.

 -- の属性: Repr.maxlevel

     再帰的な表現を作る場合の深さ制限。デフォルトは ‘6’ です。

 -- の属性: Repr.maxdict
 -- の属性: Repr.maxlist
 -- の属性: Repr.maxtuple
 -- の属性: Repr.maxset
 -- の属性: Repr.maxfrozenset
 -- の属性: Repr.maxdeque
 -- の属性: Repr.maxarray

     指定されたオブジェクト型に対するエントリ表現の数についての制限。
     *note maxdict: 2a15. に対するデフォルトは ‘4’ で、 *note maxarray:
     2a1b. は ‘5’ 、その他に対しては ‘6’ です。

 -- の属性: Repr.maxlong

     整数の表現のおける文字数の最大値。中央の数字が抜け落ちます。デフォ
     ルトは ‘40’ です。

 -- の属性: Repr.maxstring

     文字列の表現における文字数の制限。文字列の"通常の"表現は文字の「元
     」として使われることに注意してください。表現にエスケープシーケンス
     が必要とされる場合、表現が短縮されるときにこれらのエスケープシーケ
     ンスの形式は崩れます。デフォルトは ‘30’ です。

 -- の属性: Repr.maxother

     この制限は *note Repr: 2a0d. オブジェクトに利用できる特定のフォーマ
     ットメソッドがないオブジェクト型のサイズをコントロールするために使
     われます。 *note maxstring: 2a1d. と同じようなやり方で適用されます
     。デフォルトは ‘20’ です。

 -- の属性: Repr.indent

     If this attribute is set to ‘None’ (the default), the output is
     formatted with no line breaks or indentation, like the standard
     *note repr(): 1c1.  For example:

          >>> example = [
          ...     1, 'spam', {'a': 2, 'b': 'spam eggs', 'c': {3: 4.5, 6: []}}, 'ham']
          >>> import reprlib
          >>> aRepr = reprlib.Repr()
          >>> print(aRepr.repr(example))
          [1, 'spam', {'a': 2, 'b': 'spam eggs', 'c': {3: 4.5, 6: []}}, 'ham']

     If *note indent: 2a1f. is set to a string, each recursion level is
     placed on its own line, indented by that string:

          >>> aRepr.indent = '-->'
          >>> print(aRepr.repr(example))
          [
          -->1,
          -->'spam',
          -->{
          -->-->'a': 2,
          -->-->'b': 'spam eggs',
          -->-->'c': {
          -->-->-->3: 4.5,
          -->-->-->6: [],
          -->-->},
          -->},
          -->'ham',
          ]

     Setting *note indent: 2a1f. to a positive integer value behaves as
     if it was set to a string with that number of spaces:

          >>> aRepr.indent = 4
          >>> print(aRepr.repr(example))
          [
              1,
              'spam',
              {
                  'a': 2,
                  'b': 'spam eggs',
                  'c': {
                      3: 4.5,
                      6: [],
                  },
              },
              'ham',
          ]

     Added in version 3.12.

 -- メソッド: Repr.repr (obj)

     このインスタンスで設定されたフォーマットを使う、組み込み *note
     repr(): 1c1. と等価なもの。

 -- メソッド: Repr.repr1 (obj, level)

     *note repr(): 2a11. が使う再帰的な実装。 'obj' の型を使ってどのフォ
     ーマットメソッドを呼び出すかを決定し、それに 'obj' と 'level' を渡
     します。 再帰呼び出しにおいて 'level' の値に対して ‘level - 1’ を与
     える再帰的なフォーマットを実行するために、型に固有のメソッドは
     *note repr1(): 2a20. を呼び出します。

 -- メソッド: Repr.repr_TYPE (obj, level)

     型名に基づく名前をもつメソッドとして、特定の型に対するフォーマット
     メソッドは実装されます。メソッド名では、 'TYPE' は
     ‘'_'.join(type(obj).__name__.split())’ に置き換えられます。これらの
     メソッドへのディスパッチは *note repr1(): 2a20. によって処理されま
     す。再帰的に値をフォーマットする必要がある型固有のメソッドは、
     ‘self.repr1(subobj, level - 1)’ を呼び出します。


File: python.info,  Node: Reprオブジェクトをサブクラス化する,  Prev: Reprオブジェクト,  Up: reprlib --- もう一つの repr の実装

5.8.13.2 Reprオブジェクトをサブクラス化する
...........................................

The use of dynamic dispatching by *note Repr.repr1(): 2a20. allows
subclasses of *note Repr: 2a0d. to add support for additional built-in
object types or to modify the handling of types already supported.  This
example shows how special support for file objects could be added:

     import reprlib
     import sys

     class MyRepr(reprlib.Repr):

         def repr_TextIOWrapper(self, obj, level):
             if obj.name in {'<stdin>', '<stdout>', '<stderr>'}:
                 return obj.name
             return repr(obj)

     aRepr = MyRepr()
     print(aRepr.repr(sys.stdin))         # prints '<stdin>'

     <stdin>


File: python.info,  Node: enum --- 列挙型のサポート,  Next: graphlib --- グラフ構造を操作する機能,  Prev: reprlib --- もう一つの repr の実装,  Up: データ型

5.8.14 ‘enum’ -- 列挙型のサポート
---------------------------------

Added in version 3.4.

'ソースコード:' Lib/enum.py(1)

Important
.........

このページには、リファレンス情報だけが含まれています。チュートリアルは、
以下のページを参照してください

   * *note 基本チュートリアル: 2a26.

   * *note 上級チュートリアル: 2a27.

   * *note Enum クックブック: 2a28.

__________________________________________________________________

列挙型とは:

   * 一意の値に紐付けられたシンボリックな名前の集合です

   * 反復可能であり、定義順にその正規の（エイリアスでない）メンバーを返
     します

   * 値を渡してメンバーを返すために、 '呼び出し' 構文を使用します

   * 名前を受け取ってメンバーを返すために、 'インデックス' 構文を使用し
     ます

列挙型は、*note class: 14ef. 構文を使用するか、関数呼び出し構文を使用し
て作成されます:

     >>> from enum import Enum

     >>> # class syntax
     >>> class Color(Enum):
     ...     RED = 1
     ...     GREEN = 2
     ...     BLUE = 3

     >>> # functional syntax
     >>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])

Enum の作成に *note class: 14ef. 文を使用できるものの、Enum は通常の
Python クラスではありません。詳細は *note Enum はどう違うのか?: 2a29. を
参照してください。

     注釈: 用語

        - クラス ‘Color’ は '列挙型' (または 'Enum') です

        - 属性 ‘Color.RED’, ‘Color.GREEN’ などは '列挙型のメンバー' (ま
          たは 'メンバー') で、機能的には定数です。

        - 列挙型のメンバーは '名前' と '値' を持ちます (‘Color.RED’ の名
          前は ‘RED’ 、 ‘Color.BLUE’ の値は ‘3’ など。)

__________________________________________________________________

* Menu:

* モジュールコンテンツ: モジュールコンテンツ<2>.
* データ型: データ型<2>.
* ユーティリティとデコレータ::
* 注釈::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/enum.py


File: python.info,  Node: モジュールコンテンツ<2>,  Next: データ型<2>,  Up: enum --- 列挙型のサポート

5.8.14.1 モジュールコンテンツ
.............................

     *note EnumType: 4f7.

          Enumおよびそのサブクラスのための ‘type’ です。

     *note Enum: 842.

          列挙型定数を作成する基底クラスです。

     *note IntEnum: edb.

          *note int: 19b. のサブクラスでもある列挙型定数を作成する基底ク
          ラスです。(*note Notes: 2a2b.)

     *note StrEnum: 82d.

          *note str: 169. のサブクラスでもある列挙型定数を作成する基底ク
          ラスです。(*note Notes: 2a2b.)

     *note Flag: 835.

          列挙型定数を作成する基底クラスで、ビット演算を使って組み合わせ
          られ、その結果も *note IntFlag: e9a. メンバーになります。

     *note IntFlag: e9a.

          列挙型定数を作成する基底クラスで、ビット演算子を使って組み合わ
          せられ、その結果も *note IntFlag: e9a. メンバーになります。
          *note IntFlag: e9a. は *note int: 19b. のサブクラスでもありま
          す。(*note Notes: 2a2b.)

     *note ReprEnum: 82e.

          *note IntEnum: edb.、*note StrEnum: 82d.、および *note
          IntFlag: e9a. によって使用され、mix-inされた型の *note str():
          169. を保持します。

     *note EnumCheck: 838.

          ‘CONTINUOUS’、‘NAMED_FLAGS’、‘UNIQUE’ の値を持つ列挙型です。
          *note verify(): 837. と共に使用して、指定された列挙型がさまざ
          まな制約を満たしていることを確認します。

     *note FlagBoundary: 836.

          An enumeration with the values ‘STRICT’, ‘CONFORM’, ‘EJECT’,
          and ‘KEEP’ which allows for more fine-grained control over how
          invalid values are dealt with in an enumeration.

     *note EnumDict: 4f6.

          A subclass of *note dict: 183. for use when subclassing *note
          EnumType: 4f7.

     *note auto: e9b.

          インスタンスは列挙型のメンバーに適切な値で置き換えられます。
          *note StrEnum: 82d. ではデフォルトの値がメンバー名を小文字にし
          たものですが、その他の列挙型のデフォルトは1から連番で増加する
          値となります。

     *note property(): 83b.

          メンバー名との競合を避けながら *note Enum: 842. メンバーに属性
          を持たせます。‘value’ 属性と ‘name’ 属性はこの方法で実装されま
          す。

     *note unique(): 2a2c.

          一つの名前だけがひとつの値に束縛されていることを保証する Enum
          クラスのデコレーターです。

     *note verify(): 837.

          Enum class decorator that checks user-selectable constraints
          on an enumeration.

     *note member(): 839.

          ‘obj’ をメンバーにします。デコレータとして使用できます。

     *note nonmember(): 83a.

          ‘obj’ をメンバーにしません。デコレータとして使用できます。

     *note global_enum(): 83d.

          Modify the *note str(): 169. and *note repr(): 1c1. of an enum
          to show its members as belonging to the module instead of its
          class, and export the enum members to the global namespace.

     *note show_flag_values(): 2a2d.

          フラグに含まれる、全ての2の累乗の整数のリストを返します。

     *note enum.bin(): 178d.

          Like built-in *note bin(): 14c0, except negative values are
          represented in two's complement, and the leading bit always
          indicates sign (‘0’ implies positive, ‘1’ implies negative).

Added in version 3.6: ‘Flag’, ‘IntFlag’, ‘auto’

Added in version 3.11: ‘StrEnum’, ‘EnumCheck’, ‘ReprEnum’,
‘FlagBoundary’, ‘property’, ‘member’, ‘nonmember’, ‘global_enum’,
‘show_flag_values’

Added in version 3.13: ‘EnumDict’

__________________________________________________________________


File: python.info,  Node: データ型<2>,  Next: ユーティリティとデコレータ,  Prev: モジュールコンテンツ<2>,  Up: enum --- 列挙型のサポート

5.8.14.2 データ型
.................

 -- クラス: enum.EnumType

     'EnumType' は 'enum' 列挙型の *note メタクラス: 23d0. です。
     'EnumType' のサブクラスを作成することが可能です - 詳細は *note
     EnumTypeのサブクラスを作る: 2a2f. を参照してください。

     ‘EnumType’ is responsible for setting the correct ‘__repr__()’,
     ‘__str__()’, ‘__format__()’, and ‘__reduce__()’ methods on the
     final 'enum', as well as creating the enum members, properly
     handling duplicates, providing iteration over the enum class, etc.

     Added in version 3.11: Before 3.11 ‘EnumType’ was called
     ‘EnumMeta’, which is still available as an alias.

      -- メソッド: __call__ (cls, value, names=None, *, module=None,
               qualname=None, type=None, start=1, boundary=None)

          このメソッドは2つの異なる方法で呼び出されます。

             * 既存のメンバーを検索する:


                    cls: 呼び出されるenumクラス。


                    value: 検索する値。

             * ‘cls’ を使って新しい列挙型を作成する（既存の列挙型がメン
               バーを持たない場合のみ）:


                    cls: 呼び出されるenumクラス。


                    value: 新しく作成するEnumの名前。


                    names: 新しく作成するEnumのメンバーの名前/値のリスト
                    。


                    module: 新しく作成するEnumの属するモジュール名。


                    qualname: The actual location in the module where
                    this Enum can be found.


                    type: 新しく作成するEnumのmix-in型。


                    start: Enumの最初の整数値（*note auto: e9b. で使用さ
                    れます）。


                    boundary: bit演算での範囲外の値の扱い方（*note Flag:
                    835. のみ）。

      -- メソッド: __contains__ (cls, member)

          メンバーが ‘cls’ に属している場合は ‘True’ を返します:

               >>> some_var = Color.RED
               >>> some_var in Color
               True
               >>> Color.RED.value in Color
               True

          バージョン 3.12 で変更: Python 3.12 以前では、非Enumメンバーの
          包含判定が行われた場合、‘TypeError’ が送出されます。

      -- メソッド: __dir__ (cls)

          ‘['__class__', '__doc__', '__members__', '__module__']’ と、
          'cls' に属するメンバー名を返します:

               >>> dir(Color)
               ['BLUE', 'GREEN', 'RED', '__class__', '__contains__', '__doc__', '__getitem__', '__init_subclass__', '__iter__', '__len__', '__members__', '__module__', '__name__', '__qualname__']

      -- メソッド: __getitem__ (cls, name)

          'cls' 内の一致するメンバーを返すか、*note KeyError: 5e7. を送
          出します:

               >>> Color['BLUE']
               <Color.BLUE: 3>

      -- メソッド: __iter__ (cls)

          Returns each member in 'cls' in definition order:

               >>> list(Color)
               [<Color.RED: 1>, <Color.GREEN: 2>, <Color.BLUE: 3>]

      -- メソッド: __len__ (cls)

          'cls' 内のメンバーの数を返します。:

               >>> len(Color)
               3

      -- の属性: __members__

          Returns a mapping of every enum name to its member, including
          aliases

      -- メソッド: __reversed__ (cls)

          'cls' 内の各メンバー を定義順の逆順で返します:

               >>> list(reversed(Color))
               [<Color.BLUE: 3>, <Color.GREEN: 2>, <Color.RED: 1>]

 -- クラス: enum.Enum

     'Enum' は全ての 'enum' 列挙型の基底クラスです。

      -- の属性: name

          ‘Enum’ メンバーを定義するために使用される名前:

               >>> Color.BLUE.name
               'BLUE'

      -- の属性: value

          ‘Enum’ メンバーに与えられた値:

               >>> Color.RED.value
               1

          Value of the member, can be set in *note __new__(): 2a3a.

               注釈: 列挙型のメンバー値

               メンバー値は何であっても構いません: *note int: 19b, *note
               str: 169. などなど。 正確な値が重要でない場合は、 *note
               auto: e9b. インスタンスを使っておくと、適切な値が選ばれま
               す。 詳細は *note auto: e9b. を参照してください。

               While mutable/unhashable values, such as *note dict: 183,
               *note list: 24d. or a mutable *note dataclass: 4e1, can
               be used, they will have a quadratic performance impact
               during creation relative to the total number of
               mutable/unhashable values in the enum.

      -- の属性: _name_

          Name of the member.

      -- の属性: _value_

          Value of the member, can be set in *note __new__(): 2a3a.

      -- の属性: _order_

          No longer used, kept for backward compatibility.  (class
          attribute, removed during class creation).

      -- の属性: _ignore_

          ‘_ignore_’ は列挙の作成中にのみ使用され、作成が完了すると削除
          されます。

          ‘_ignore_’ は、メンバーにならず、作成された列挙から削除される
          名前のリストです。例については、*note TimePeriod: 2a3f. を参照
          してください。

      -- メソッド: __dir__ (self)

          Returns ‘['__class__', '__doc__', '__module__', 'name',
          'value']’ and any public methods defined on 'self.__class__':

               >>> from enum import Enum
               >>> from datetime import date
               >>> class Weekday(Enum):
               ...     MONDAY = 1
               ...     TUESDAY = 2
               ...     WEDNESDAY = 3
               ...     THURSDAY = 4
               ...     FRIDAY = 5
               ...     SATURDAY = 6
               ...     SUNDAY = 7
               ...     @classmethod
               ...     def today(cls):
               ...         print('today is %s' % cls(date.today().isoweekday()).name)
               ...
               >>> dir(Weekday.SATURDAY)
               ['__class__', '__doc__', '__eq__', '__hash__', '__module__', 'name', 'today', 'value']

      -- メソッド: _generate_next_value_ (name, start, count,
               last_values)


               name: 定義されているメンバーの名前（例：'RED'）。


               start: Enumの開始値。デフォルトは1です。


               count: 定義済みのメンバーの数。現在のメンバーを含めない。


               last_values: 定義済みの値のリスト。

          *note auto: e9b. によって返される次の値を決定するために使用さ
          れる 'staticmethod' です:

               >>> from enum import auto, Enum
               >>> class PowersOfThree(Enum):
               ...     @staticmethod
               ...     def _generate_next_value_(name, start, count, last_values):
               ...         return 3 ** (count + 1)
               ...     FIRST = auto()
               ...     SECOND = auto()
               ...
               >>> PowersOfThree.SECOND.value
               9

      -- メソッド: __init__ (self, *args, **kwds)

          デフォルトでは何もしません。メンバーに複数の値が指定されている
          場合、それらの値は ‘__init__’ の別々の引数となります。例えば、

               >>> from enum import Enum
               >>> class Weekday(Enum):
               ...     MONDAY = 1, 'Mon'

          ‘Weekday.__init__()’ は ‘Weekday.__init__(self, 1, 'Mon')’ と
          して呼び出されます。

      -- メソッド: __init_subclass__ (cls, **kwds)

          サブクラスを更に設定するために使用される 'classmethod' です。
          デフォルトでは何も行いません。

      -- メソッド: _missing_ (cls, value)

          'cls' で見つからない値を検索するための 'classmethod' です。デ
          フォルトでは何もしませんが、カスタムの検索の振る舞いを実装する
          ためにオーバーライドすることができます:

               >>> from enum import auto, StrEnum
               >>> class Build(StrEnum):
               ...     DEBUG = auto()
               ...     OPTIMIZED = auto()
               ...     @classmethod
               ...     def _missing_(cls, value):
               ...         value = value.lower()
               ...         for member in cls:
               ...             if member.value == value:
               ...                 return member
               ...         return None
               ...
               >>> Build.DEBUG.value
               'debug'
               >>> Build('deBUG')
               <Build.DEBUG: 'debug'>

      -- メソッド: __new__ (cls, *args, **kwds)

          デフォルトでは存在しません。指定された場合、列挙型のクラス定義
          またはmix-inクラス（例えば ‘int’ など）のいずれかで、メンバー
          に代入されたすべての値が渡されます。例:

               >>> from enum import Enum
               >>> class MyIntEnum(int, Enum):
               ...     TWENTYSIX = '1a', 16

          results in the call ‘int('1a', 16)’ and a value of ‘26’ for
          the member.

               注釈: When writing a custom ‘__new__’, do not use
               ‘super().__new__’ - call the appropriate ‘__new__’
               instead.

      -- メソッド: __repr__ (self)

          'repr()' の呼び出しに使用される文字列を返します。デフォルトで
          は、 'Enum' 名、メンバー名、および値を返しますが、オーバーライ
          ドすることもできます:

               >>> from enum import auto, Enum
               >>> class OtherStyle(Enum):
               ...     ALTERNATE = auto()
               ...     OTHER = auto()
               ...     SOMETHING_ELSE = auto()
               ...     def __repr__(self):
               ...         cls_name = self.__class__.__name__
               ...         return f'{cls_name}.{self.name}'
               ...
               >>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f"{OtherStyle.ALTERNATE}"
               (OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')

      -- メソッド: __str__ (self)

          'str()' の呼び出しに使用される文字列を返します。デフォルトでは
          、 'Enum' の名前とメンバーの名前を返しますが、オーバーライドす
          ることもできます:

               >>> from enum import auto, Enum
               >>> class OtherStyle(Enum):
               ...     ALTERNATE = auto()
               ...     OTHER = auto()
               ...     SOMETHING_ELSE = auto()
               ...     def __str__(self):
               ...         return f'{self.name}'
               ...
               >>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f"{OtherStyle.ALTERNATE}"
               (<OtherStyle.ALTERNATE: 1>, 'ALTERNATE', 'ALTERNATE')

      -- メソッド: __format__ (self)

          'format()' および 'f-string' の呼び出しに使用される文字列を返
          します。デフォルトでは、*note __str__(): 834. の戻り値を返しま
          すが、オーバーライドすることもできます。:

               >>> from enum import auto, Enum
               >>> class OtherStyle(Enum):
               ...     ALTERNATE = auto()
               ...     OTHER = auto()
               ...     SOMETHING_ELSE = auto()
               ...     def __format__(self, spec):
               ...         return f'{self.name}'
               ...
               >>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f"{OtherStyle.ALTERNATE}"
               (<OtherStyle.ALTERNATE: 1>, 'OtherStyle.ALTERNATE', 'ALTERNATE')

          注釈: *note Enum: 842. で *note auto: e9b. を使用すると、 ‘1’
          から始まりインクリメントする整数が値となります。

     バージョン 3.12 で変更: *note データクラスのサポート: 1af9. の追加

      -- メソッド: _add_alias_ ()

          Adds a new name as an alias to an existing member:

               >>> Color.RED._add_alias_("ERROR")
               >>> Color.ERROR
               <Color.RED: 1>

          Raises a *note NameError: 452. if the name is already assigned
          to a different member.

          Added in version 3.13.

      -- メソッド: _add_value_alias_ ()

          Adds a new value as an alias to an existing member:

               >>> Color.RED._add_value_alias_(42)
               >>> Color(42)
               <Color.RED: 1>

          Raises a *note ValueError: 2ec. if the value is already linked
          with a different member.

          Added in version 3.13.

 -- クラス: enum.IntEnum

     'IntEnum' is the same as *note Enum: 842, but its members are also
     integers and can be used anywhere that an integer can be used.  If
     any integer operation is performed with an 'IntEnum' member, the
     resulting value loses its enumeration status.

          >>> from enum import IntEnum
          >>> class Number(IntEnum):
          ...     ONE = 1
          ...     TWO = 2
          ...     THREE = 3
          ...
          >>> Number.THREE
          <Number.THREE: 3>
          >>> Number.ONE + Number.TWO
          3
          >>> Number.THREE + 5
          8
          >>> Number.THREE == 3
          True

          注釈: *note IntEnum: edb. で *note auto: e9b. を使用すると、
          ‘1’ から始まりインクリメントする整数が値となります。

     バージョン 3.11 で変更: *note __str__(): 830. は、既存の定数を置き
     換えるユースケースをより良くサポートするために ‘int.__str__()’ に変
     更されました。同じ理由で、*note __format__(): 831. は既に
     ‘int.__format__()’ に変更されています。

 -- クラス: enum.StrEnum

     'StrEnum' is the same as *note Enum: 842, but its members are also
     strings and can be used in most of the same places that a string
     can be used.  The result of any string operation performed on or
     with a 'StrEnum' member is not part of the enumeration.

          >>> from enum import StrEnum, auto
          >>> class Color(StrEnum):
          ...     RED = 'r'
          ...     GREEN = 'g'
          ...     BLUE = 'b'
          ...     UNKNOWN = auto()
          ...
          >>> Color.RED
          <Color.RED: 'r'>
          >>> Color.UNKNOWN
          <Color.UNKNOWN: 'unknown'>
          >>> str(Color.UNKNOWN)
          'unknown'

          注釈: There are places in the stdlib that check for an exact
          *note str: 169. instead of a *note str: 169. subclass (i.e.
          ‘type(unknown) == str’ instead of ‘isinstance(unknown, str)’),
          and in those locations you will need to use
          ‘str(MyStrEnum.MY_MEMBER)’.

          注釈: *note StrEnum: 82d. で *note auto: e9b. を使用すると、メ
          ンバー名を小文字に変換したものが値となります。

          注釈: *note __str__(): 830. は '既存の定数の置換' ユースケース
          をより良くサポートするために ‘str.__str__()’ となりました。
          *note __format__(): 831. も同様に、同じ理由で
          ‘str.__format__()’ となりました。

     Added in version 3.11.

 -- クラス: enum.Flag

     ‘Flag’ is the same as *note Enum: 842, but its members support the
     bitwise operators ‘&’ ('AND'), ‘|’ ('OR'), ‘^’ ('XOR'), and ‘~’
     ('INVERT'); the results of those operations are (aliases of)
     members of the enumeration.

      -- メソッド: __contains__ (self, value)

          値を含む場合に 'True' を返します:

               >>> from enum import Flag, auto
               >>> class Color(Flag):
               ...     RED = auto()
               ...     GREEN = auto()
               ...     BLUE = auto()
               ...
               >>> purple = Color.RED | Color.BLUE
               >>> white = Color.RED | Color.GREEN | Color.BLUE
               >>> Color.GREEN in purple
               False
               >>> Color.GREEN in white
               True
               >>> purple in white
               True
               >>> white in purple
               False

      -- メソッド: __iter__(self):

          エイリアスでない、全てのメンバーを返します:

               >>> list(Color.RED)
               [<Color.RED: 1>]
               >>> list(purple)
               [<Color.RED: 1>, <Color.BLUE: 4>]

          Added in version 3.11.

      -- メソッド: __len__(self):

          flag 内のメンバーの数を返します:

               >>> len(Color.GREEN)
               1
               >>> len(white)
               3

          Added in version 3.11.

      -- メソッド: __bool__(self):

          メンバーがflagに含まれている場合は 'True' を返し、それ以外の場
          合は 'False' を返します:

               >>> bool(Color.GREEN)
               True
               >>> bool(white)
               True
               >>> black = Color(0)
               >>> bool(black)
               False

      -- メソッド: __or__ (self, other)

          現在のフラグと他のフラグの論理和となるフラグを返します:

               >>> Color.RED | Color.GREEN
               <Color.RED|GREEN: 3>

      -- メソッド: __and__ (self, other)

          現在のフラグと他のフラグの論理積となるフラグを返します:

               >>> purple & white
               <Color.RED|BLUE: 5>
               >>> purple & Color.GREEN
               <Color: 0>

      -- メソッド: __xor__ (self, other)

          現在のフラグと他のフラグの排他的論理和となるフラグを返します:

               >>> purple ^ white
               <Color.GREEN: 2>
               >>> purple ^ Color.GREEN
               <Color.RED|GREEN|BLUE: 7>

      -- メソッド: __invert__(self):

          Returns all the flags in 'type(self)' that are not in 'self':

               >>> ~white
               <Color: 0>
               >>> ~purple
               <Color.GREEN: 2>
               >>> ~Color.RED
               <Color.GREEN|BLUE: 6>

      -- メソッド: _numeric_repr_ ()

          Function used to format any remaining unnamed numeric values.
          Default is the value's repr; common choices are *note hex():
          14e7. and *note oct(): 14e6.

          注釈: *note auto: e9b. と *note Flag: 835. を一緒に使うと、‘1’
          から始まる2の累乗の整数になります。

     バージョン 3.11 で変更: The 'repr()' of zero-valued flags has
     changed.  It is now:

          >>> Color(0)
          <Color: 0>

 -- クラス: enum.IntFlag

     ‘IntFlag’ is the same as *note Flag: 835, but its members are also
     integers and can be used anywhere that an integer can be used.

          >>> from enum import IntFlag, auto
          >>> class Color(IntFlag):
          ...     RED = auto()
          ...     GREEN = auto()
          ...     BLUE = auto()
          ...
          >>> Color.RED & 2
          <Color: 0>
          >>> Color.RED | 2
          <Color.RED|GREEN: 3>

     'IntFlag' のメンバーと整数の演算が行われた場合、結果は 'IntFlag' で
     はありません:

          >>> Color.RED + 2
          3

     If a *note Flag: 835. operation is performed with an 'IntFlag'
     member and:

        * 結果が有効な 'IntFlag': 'IntFlag' が返されます

        * the result is not a valid 'IntFlag': the result depends on the
          *note FlagBoundary: 836. setting

     The *note repr(): 1c1. of unnamed zero-valued flags has changed.
     It is now:

          >>> Color(0)
          <Color: 0>

          注釈: *note auto: e9b. と *note IntFlag: e9a. を一緒に使うと、
          ‘1’ から始まる2の累乗の整数になります。

     バージョン 3.11 で変更: *note __str__(): 830. は、既存の定数を置き
     換えるユースケースをより良くサポートするために ‘int.__str__()’ に変
     更されました。同じ理由で、*note __format__(): 831. は既に
     ‘int.__format__()’ に変更されています。

     ‘IntFlag’ の反転は、与えられたフラグ以外のすべてのフラグの結合とな
     る正の値を返すようになりました。これは既存の *note Flag: 835. の振
     る舞いに一致します。

 -- クラス: enum.ReprEnum

     ‘ReprEnum’ uses the *note repr(): 1afa. of *note Enum: 842, but the
     *note str(): 169. of the mixed-in data type:

        * ‘int.__str__()’ for *note IntEnum: edb. and *note IntFlag:
          e9a.

        * ‘str.__str__()’ for *note StrEnum: 82d.

     ‘ReprEnum’ を継承することで、*note Enum: 842. デフォルトの *note
     str(): 834. を使用する代わりに、mix-inされたデータ型の *note str():
     169. / *note format(): 199. を使用します。

     Added in version 3.11.

 -- クラス: enum.EnumCheck

     'EnumCheck' には *note verify(): 837. デコレータやさまざまな制約を
     保証するために使用されるオプションが含まれています。制約に違反する
     と *note ValueError: 2ec. が発生します。

      -- の属性: UNIQUE

          それぞれの値が1つの名前しか持たないことを確認します:

               >>> from enum import Enum, verify, UNIQUE
               >>> @verify(UNIQUE)
               ... class Color(Enum):
               ...     RED = 1
               ...     GREEN = 2
               ...     BLUE = 3
               ...     CRIMSON = 1
               Traceback (most recent call last):
               ...
               ValueError: aliases found in <enum 'Color'>: CRIMSON -> RED

      -- の属性: CONTINUOUS

          最小値のメンバーと最大値のメンバーの間に欠損値がないことを確認
          します:

               >>> from enum import Enum, verify, CONTINUOUS
               >>> @verify(CONTINUOUS)
               ... class Color(Enum):
               ...     RED = 1
               ...     GREEN = 2
               ...     BLUE = 5
               Traceback (most recent call last):
               ...
               ValueError: invalid enum 'Color': missing values 3, 4

      -- の属性: NAMED_FLAGS

          任意のフラググループ/マスクが、名前付きフラグのみを含むことを
          確認します - 値を指定するのではなく、*note auto(): e9b. によっ
          て生成される場合に便利です:

               >>> from enum import Flag, verify, NAMED_FLAGS
               >>> @verify(NAMED_FLAGS)
               ... class Color(Flag):
               ...     RED = 1
               ...     GREEN = 2
               ...     BLUE = 4
               ...     WHITE = 15
               ...     NEON = 31
               Traceback (most recent call last):
               ...
               ValueError: invalid Flag 'Color': aliases WHITE and NEON are missing combined values of 0x18 [use enum.show_flag_values(value) for details]

          注釈: CONTINUOUSとNAMED_FLAGSは整数値のメンバーとともに動作す
          るように設計されています。

     Added in version 3.11.

 -- クラス: enum.FlagBoundary

     ‘FlagBoundary’ controls how out-of-range values are handled in
     *note Flag: 835. and its subclasses.

      -- の属性: STRICT

          範囲外の値は *note ValueError: 2ec. を送出します。これは *note
          Flag: 835. のデフォルトです:

               >>> from enum import Flag, STRICT, auto
               >>> class StrictFlag(Flag, boundary=STRICT):
               ...     RED = auto()
               ...     GREEN = auto()
               ...     BLUE = auto()
               ...
               >>> StrictFlag(2**2 + 2**4)
               Traceback (most recent call last):
               ...
               ValueError: <flag 'StrictFlag'> invalid value 20
                   given 0b0 10100
                 allowed 0b0 00111

      -- の属性: CONFORM

          Out-of-range values have invalid values removed, leaving a
          valid *note Flag: 835. value:

               >>> from enum import Flag, CONFORM, auto
               >>> class ConformFlag(Flag, boundary=CONFORM):
               ...     RED = auto()
               ...     GREEN = auto()
               ...     BLUE = auto()
               ...
               >>> ConformFlag(2**2 + 2**4)
               <ConformFlag.BLUE: 4>

      -- の属性: EJECT

          Out-of-range values lose their *note Flag: 835. membership and
          revert to *note int: 19b.

               >>> from enum import Flag, EJECT, auto
               >>> class EjectFlag(Flag, boundary=EJECT):
               ...     RED = auto()
               ...     GREEN = auto()
               ...     BLUE = auto()
               ...
               >>> EjectFlag(2**2 + 2**4)
               20

      -- の属性: KEEP

          Out-of-range values are kept, and the *note Flag: 835.
          membership is kept.  This is the default for *note IntFlag:
          e9a.:

               >>> from enum import Flag, KEEP, auto
               >>> class KeepFlag(Flag, boundary=KEEP):
               ...     RED = auto()
               ...     GREEN = auto()
               ...     BLUE = auto()
               ...
               >>> KeepFlag(2**2 + 2**4)
               <KeepFlag.BLUE|16: 20>

     Added in version 3.11.

 -- クラス: enum.EnumDict

     'EnumDict' is a subclass of *note dict: 183. that is used as the
     namespace for defining enum classes (see *note
     クラスの名前空間の準備: e58.).  It is exposed to allow subclasses
     of *note EnumType: 4f7. with advanced behavior like having multiple
     values per member.  It should be called with the name of the enum
     class being created, otherwise private names and internal classes
     will not be handled correctly.

     Note that only the *note MutableMapping: 12c0. interface (*note
     __setitem__(): 14e3. and *note update(): 167e.) is overridden.  It
     may be possible to bypass the checks using other ‘dict’ operations
     like *note |=: 2401.

      -- の属性: member_names

          A list of member names.

     Added in version 3.13.

__________________________________________________________________

* Menu:

* __dunder__ 名のサポート::
* _sunder_ 名のサポート::


File: python.info,  Node: __dunder__ 名のサポート,  Next: _sunder_ 名のサポート,  Up: データ型<2>

5.8.14.3 ‘__dunder__’ 名のサポート
..................................

*note __members__: 2a36. は読み込み専用の、 ‘member_name’:‘member’ を要
素とする順序付きマッピングです。これはクラスでのみ利用可能です。

*note __new__(): 2a3a, if specified, must create and return the enum
members; it is also a very good idea to set the member's ‘_value_’
appropriately.  Once all the members are created it is no longer used.


File: python.info,  Node: _sunder_ 名のサポート,  Prev: __dunder__ 名のサポート,  Up: データ型<2>

5.8.14.4 ‘_sunder_’ 名のサポート
................................

   - *note _name_: 2a3b. - メンバー名

   - *note _value_: 2a3c. - メンバーの値; ‘__new__’ で設定できます

   - *note _missing_(): 2a43. - 値が見付からなかったときに使われる検索関
     数; オーバーライドされていることがあります

   - *note _ignore_: 2a3e. - 名前のリストで、 *note list: 24d. もしくは
     *note str: 169. です。この名前の要素はメンバーへの変換が行われず、
     最終的なクラスから削除されます。

   - *note _order_: 2a3d. - no longer used, kept for backward
     compatibility (class attribute, removed during class creation)

   - *note _generate_next_value_(): 2a40. - 列挙型のメンバーの適切な値を
     取得するのに使われます。オーバーライドされます。

          注釈: 標準の *note Enum: 842. クラスの場合、次の値として選択さ
          れるのは、定義された最大の値に1を加えたものです。

          *note Flag: 835. クラスでは、次に選ばれる値は、次の最大の2のべ
          き乗となります。

   - *note _add_alias_(): 2a44. - adds a new name as an alias to an
     existing member.

   - *note _add_value_alias_(): 2a45. - adds a new value as an alias to
     an existing member.

   - While ‘_sunder_’ names are generally reserved for the further
     development of the *note Enum: 842. class and can not be used, some
     are explicitly allowed:

        - ‘_repr_*’ (e.g.  ‘_repr_html_’), as used in IPython's rich
          display(1)

Added in version 3.6: ‘_missing_’, ‘_order_’, ‘_generate_next_value_’

Added in version 3.7: ‘_ignore_’

Added in version 3.13: ‘_add_alias_’, ‘_add_value_alias_’, ‘_repr_*’

__________________________________________________________________

   ---------- Footnotes ----------

   (1) 
https://ipython.readthedocs.io/en/stable/config/integrating.html#rich-display


File: python.info,  Node: ユーティリティとデコレータ,  Next: 注釈,  Prev: データ型<2>,  Up: enum --- 列挙型のサポート

5.8.14.5 ユーティリティとデコレータ
...................................

 -- クラス: enum.auto

     'auto' can be used in place of a value.  If used, the 'Enum'
     machinery will call an *note Enum: 842.'s *note
     _generate_next_value_(): 2a40. to get an appropriate value.  For
     *note Enum: 842. and *note IntEnum: edb. that appropriate value
     will be the last value plus one; for *note Flag: 835. and *note
     IntFlag: e9a. it will be the first power-of-two greater than the
     highest value; for *note StrEnum: 82d. it will be the lower-cased
     version of the member's name.  Care must be taken if mixing
     'auto()' with manually specified values.

     'auto' instances are only resolved when at the top level of an
     assignment, either by itself or as part of a tuple:

        * ‘FIRST = auto()’ は動作します（auto() は ‘1’ に置き換えられま
          す）

        * ‘SECOND = auto(), -2’ は動作します（auto は ‘2’ に置き換えられ
          るため、 ‘SECOND’ 列挙型のメンバーには ‘2, -2’ が使用されます
          ）

        * ‘THREE = [auto(), -3]’ will 'not' work (‘[<auto instance>,
          -3]’ is used to create the ‘THREE’ enum member)

     バージョン 3.11.1 で変更: 以前のバージョンでは、 ‘auto()’ は、代入
     行に他のものがあると正しく動作しませんでした。

     ‘_generate_next_value_’ は、 'auto' が使用する値をカスタマイズする
     ためにオーバーライドすることができる。

          注釈: 3.13では、デフォルトの ‘_generate_next_value_’ は常に最
          も高いメンバーの値に1を加えたものを返し、メンバーのいずれかが
          比較できない型である場合には失敗します。

 -- の関数: @enum.property

     A decorator similar to the built-in 'property', but specifically
     for enumerations.  It allows member attributes to have the same
     names as members themselves.

          注釈: the 'property' and the member must be defined in
          separate classes; for example, the 'value' and 'name'
          attributes are defined in the 'Enum' class, and 'Enum'
          subclasses can define members with the names ‘value’ and
          ‘name’.

     Added in version 3.11.

 -- の関数: @enum.unique

     列挙型専用の *note class: 14ef. デコレーターです。列挙型の *note
     __members__: 2a36. に別名がないかどうか検索します; 見つかった場合、
     *note ValueError: 2ec. が詳細情報とともに送出されます:

          >>> from enum import Enum, unique
          >>> @unique
          ... class Mistake(Enum):
          ...     ONE = 1
          ...     TWO = 2
          ...     THREE = 3
          ...     FOUR = 3
          ...
          Traceback (most recent call last):
          ...
          ValueError: duplicate values found in <enum 'Mistake'>: FOUR -> THREE

 -- の関数: @enum.verify

     列挙型専用の *note class: 14ef. デコレーターです。対象の列挙型に対
     してチェックを行う制約の指定には *note EnumCheck: 838. のメンバーが
     使用されます。

     Added in version 3.11.

 -- の関数: @enum.member

     列挙型で使用するデコレータ: 対象は列挙型のメンバー になります。

     Added in version 3.11.

 -- の関数: @enum.nonmember

     列挙型で使用するデコレータ: 対象は列挙型のメンバー になりません。

     Added in version 3.11.

 -- の関数: @enum.global_enum

     A decorator to change the *note str(): 169. and *note repr(): 1c1.
     of an enum to show its members as belonging to the module instead
     of its class.  Should only be used when the enum members are
     exported to the module global namespace (see *note re.RegexFlag:
     83f. for an example).

     Added in version 3.11.

 -- の関数: enum.show_flag_values (value)

     フラグの 'value' に含まれる全ての2の累乗の整数のリストを返します。

     Added in version 3.11.

 -- の関数: enum.bin (num, max_bits=None)

     Like built-in *note bin(): 14c0, except negative values are
     represented in two's complement, and the leading bit always
     indicates sign (‘0’ implies positive, ‘1’ implies negative).

          >>> import enum
          >>> enum.bin(10)
          '0b0 1010'
          >>> enum.bin(~10)   # ~10 is -11
          '0b1 0101'

     Added in version 3.11.

__________________________________________________________________


File: python.info,  Node: 注釈,  Prev: ユーティリティとデコレータ,  Up: enum --- 列挙型のサポート

5.8.14.6 注釈
.............

*note IntEnum: edb. 、 *note StrEnum: 82d. 、 *note IntFlag: e9a.

     これらの3つの列挙型は、既存の整数ベースおよび文字列ベースの値の代替
     として設計されています。そのため、追加の制限があります:

        - ‘__str__’ は、列挙型のメンバーの名前ではなく値を使用します

        - ‘__format__’ は ‘__str__’ を使用するため、列挙型のメンバーの名
          前ではなく値を使用します

     もし、そのような制限が必要でない/望まない場合は、‘int’ または ‘str’
     タイプを継承して、カスタムの基底クラスを作成することができます:

          >>> from enum import Enum
          >>> class MyIntEnum(int, Enum):
          ...     pass

     または列挙型の中で適切な *note str(): 169. などを再代入することもで
     きます:

          >>> from enum import Enum, IntEnum
          >>> class MyIntEnum(IntEnum):
          ...     __str__ = Enum.__str__


File: python.info,  Node: graphlib --- グラフ構造を操作する機能,  Prev: enum --- 列挙型のサポート,  Up: データ型

5.8.15 ‘graphlib’ -- グラフ構造を操作する機能
---------------------------------------------

'ソースコード:' Lib/graphlib.py(1)

__________________________________________________________________

 -- クラス: graphlib.TopologicalSorter (graph=None)

     *note ハッシュ可能: 824. な頂点のグラフをトポロジカルソートする機能
     を提供します。

     トポロジカル順序はグラフの頂点の線形順序で、頂点 u から 頂点 v への
     有向辺 u-> v 全てについて、頂点 u が頂点 v よりも前にくるような順序
     です。例えば、グラフの頂点が実行するタスクを表し、その辺があるタス
     クが別のタスクよりも前に実行されなければならないという制約を表す場
     合、トポロジカル順序は制約を満たすタスクの実行順序のシーケンスにな
     ります。トポロジカル順序が得られるのは、グラフが有向閉路を持たない
     、つまり有向非巡回グラフである場合でかつその時に限ります。

     もしオプションの 'graph' 引数が与えられた場合、その値は有向非巡回グ
     ラフを表す辞書でなければならず、辞書はそのキーがノードで、その値は
     キーのノードの先行ノードのイテラブルとなります（言い換えると、辞書
     の値はそのキーのノードを指す辺を持つノードのイテラブルです） 辺
     *note add(): 2a5a. メソッドを使うことで、さらにノードを追加すること
     ができます。

     一般的に、与えられたグラフのソートの実行に必要なステップは以下のよ
     うになります:

        * *note TopologicalSorter: ade. のインスタンスをオプションの初期
          グラフで生成します。

        * さらにノードをグラフに追加します。

        * *note prepare(): 21f. をグラフ上で呼び出します。

        * *note is_active(): 2a5b. が ‘True’ の間、 *note get_ready():
          2a5c. によって返されたノード群をイテレートし、それらを処理しま
          す。ノードの処理が終わる都度、*note done(): 2a5d. を呼び出しま
          す。

     すぐにグラフのノードをソートした結果が必要で、並行性が不要な場合、
     便利なメソッド *note TopologicalSorter.static_order(): 2a5e. を直接
     呼び出すことができます:

          >>> graph = {"D": {"B", "C"}, "C": {"A"}, "B": {"A"}}
          >>> ts = TopologicalSorter(graph)
          >>> tuple(ts.static_order())
          ('A', 'C', 'B', 'D')

     このクラスは、簡単に準備が整ったノードの並列処理を行えるよう設計さ
     れています。例えば:

          topological_sorter = TopologicalSorter()

          # Add nodes to 'topological_sorter'...

          topological_sorter.prepare()
          while topological_sorter.is_active():
              for node in topological_sorter.get_ready():
                  # Worker threads or processes take nodes to work on off the
                  # 'task_queue' queue.
                  task_queue.put(node)

              # When the work for a node is done, workers put the node in
              # 'finalized_tasks_queue' so we can get more nodes to work on.
              # The definition of 'is_active()' guarantees that, at this point, at
              # least one node has been placed on 'task_queue' that hasn't yet
              # been passed to 'done()', so this blocking 'get()' must (eventually)
              # succeed.  After calling 'done()', we loop back to call 'get_ready()'
              # again, so put newly freed nodes on 'task_queue' as soon as
              # logically possible.
              node = finalized_tasks_queue.get()
              topological_sorter.done(node)

      -- メソッド: add (node, *predecessors)

          新しいノードとその先行ノードをグラフに追加します。 'node' と
          'predecessors' のすべての要素は *note ハッシュ可能: 824. でな
          ければなりません。

          同じ node 引数で複数回呼び出した場合、依存関係の集合は、それま
          でに指定した依存関係の和集合になります。

          It is possible to add a node with no dependencies
          ('predecessors' is not provided) or to provide a dependency
          twice.  If a node that has not been provided before is
          included among 'predecessors' it will be automatically added
          to the graph with no predecessors of its own.

          *note prepare(): 21f. を呼び出した後にこのメソッドを呼び出すと
          、*note ValueError: 2ec. を送出します。

      -- メソッド: prepare ()

          Mark the graph as finished and check for cycles in the graph.
          If any cycle is detected, *note CycleError: 2a5f. will be
          raised, but *note get_ready(): 2a5c. can still be used to
          obtain as many nodes as possible until cycles block more
          progress.  After a call to this function, the graph cannot be
          modified, and therefore no more nodes can be added using *note
          add(): 2a5a.

          A *note ValueError: 2ec. will be raised if the sort has been
          started by *note static_order(): 2a5e. or *note get_ready():
          2a5c.

          バージョン 3.14 で変更: ‘prepare()’ can now be called more
          than once as long as the sort has not started.  Previously
          this raised *note ValueError: 2ec.

      -- メソッド: is_active ()

          Returns ‘True’ if more progress can be made and ‘False’
          otherwise.  Progress can be made if cycles do not block the
          resolution and either there are still nodes ready that haven't
          yet been returned by *note TopologicalSorter.get_ready():
          2a5c. or the number of nodes marked *note
          TopologicalSorter.done(): 2a5d. is less than the number that
          have been returned by *note TopologicalSorter.get_ready():
          2a5c.

          The *note __bool__(): 14ed. method of this class defers to
          this function, so instead of:

               if ts.is_active():
                   ...

          このように簡単に記述できます:

               if ts:
                   ...

          前もって *note prepare(): 21f. を呼び出さずにこの関数を呼び出
          すと *note ValueError: 2ec. を送出します。

      -- メソッド: done (*nodes)

          Marks a set of nodes returned by *note
          TopologicalSorter.get_ready(): 2a5c. as processed, unblocking
          any successor of each node in 'nodes' for being returned in
          the future by a call to *note TopologicalSorter.get_ready():
          2a5c.

          Raises *note ValueError: 2ec. if any node in 'nodes' has
          already been marked as processed by a previous call to this
          method or if a node was not added to the graph by using *note
          TopologicalSorter.add(): 2a5a, if called without calling *note
          prepare(): 21f. or if node has not yet been returned by *note
          get_ready(): 2a5c.

      -- メソッド: get_ready ()

          Returns a ‘tuple’ with all the nodes that are ready.
          Initially it returns all nodes with no predecessors, and once
          those are marked as processed by calling *note
          TopologicalSorter.done(): 2a5d, further calls will return all
          new nodes that have all their predecessors already processed.
          Once no more progress can be made, empty tuples are returned.

          前もって *note prepare(): 21f. を呼び出さずにこの関数を呼び出
          すと *note ValueError: 2ec. を送出します。

      -- メソッド: static_order ()

          Returns an iterator object which will iterate over nodes in a
          topological order.  When using this method, *note prepare():
          21f. and *note done(): 2a5d. should not be called.  This
          method is equivalent to:

               def static_order(self):
                   self.prepare()
                   while self.is_active():
                       node_group = self.get_ready()
                       yield from node_group
                       self.done(*node_group)

          The particular order that is returned may depend on the
          specific order in which the items were inserted in the graph.
          For example:

               >>> ts = TopologicalSorter()
               >>> ts.add(3, 2, 1)
               >>> ts.add(1, 0)
               >>> print([*ts.static_order()])
               [2, 0, 1, 3]

               >>> ts2 = TopologicalSorter()
               >>> ts2.add(1, 0)
               >>> ts2.add(3, 2, 1)
               >>> print([*ts2.static_order()])
               [0, 2, 1, 3]

          This is due to the fact that "0" and "2" are in the same level
          in the graph (they would have been returned in the same call
          to *note get_ready(): 2a5c.) and the order between them is
          determined by the order of insertion.

          If any cycle is detected, *note CycleError: 2a5f. will be
          raised.

     Added in version 3.9.

* Menu:

* 例外: 例外<4>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/graphlib.py


File: python.info,  Node: 例外<4>,  Up: graphlib --- グラフ構造を操作する機能

5.8.15.1 例外
.............

The ‘graphlib’ module defines the following exception classes:

 -- 例外: graphlib.CycleError

     Subclass of *note ValueError: 2ec. raised by *note
     TopologicalSorter.prepare(): 21f. if cycles exist in the working
     graph.  If multiple cycles exist, only one undefined choice among
     them will be reported and included in the exception.

     The detected cycle can be accessed via the second element in the
     *note args: 78d. attribute of the exception instance and consists
     in a list of nodes, such that each node is, in the graph, an
     immediate predecessor of the next node in the list.  In the
     reported list, the first and the last node will be the same, to
     make it clear that it is cyclic.


File: python.info,  Node: 数値と数学モジュール,  Next: 関数型プログラミング用モジュール,  Prev: データ型,  Up: Python 標準ライブラリ

5.9 数値と数学モジュール
========================

この章で記述されているモジュールは、数値に関するあるいは数学関係の関数と
データ型を提供します。 *note numbers: a2. モジュールは、数値の型の抽象的
な階層を定義します。 *note math: 92. と *note cmath: 19. モジュールは、
浮動小数点数と複素数のための様々な数学関数を含んでいます。 *note
decimal: 3a. モジュールは、任意精度の計算を使用して、10進数の正確な表現
をサポートします。

この章では以下のモジュールが記述されています:

* Menu:

* numbers: numbers --- 数の抽象基底クラス. 数の抽象基底クラス
* math: math --- 数学関数. 数学関数
* cmath: cmath --- 複素数用の数学関数. 複素数用の数学関数
* decimal: decimal --- 10進固定小数点と浮動小数点の演算. 10進固定小数点と浮動小数点の演算
* fractions: fractions --- 有理数. 有理数
* random: random --- 疑似乱数を生成する. 疑似乱数を生成する
* statistics: statistics --- 数学的統計関数. 数学的統計関数


File: python.info,  Node: numbers --- 数の抽象基底クラス,  Next: math --- 数学関数,  Up: 数値と数学モジュール

5.9.1 ‘numbers’ -- 数の抽象基底クラス
-------------------------------------

'ソースコード:' Lib/numbers.py(1)

__________________________________________________________________

The ‘numbers’ module ( PEP 3141(2)) defines a hierarchy of numeric *note
abstract base classes: 13ce. which progressively define more operations.
None of the types defined in this module are intended to be
instantiated.

 -- クラス: numbers.Number

     数の階層の根。引数 'x' が、種類は何であれ、数であるということだけチ
     ェックしたい場合、‘isinstance(x, Number)’ が使えます。

* Menu:

* 数値塔::
* Notes for type implementers::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/numbers.py

   (2) https://peps.python.org/pep-3141/


File: python.info,  Node: 数値塔,  Next: Notes for type implementers,  Up: numbers --- 数の抽象基底クラス

5.9.1.1 数値塔
..............

 -- クラス: numbers.Complex

     この型のサブクラスは複素数を表し、組み込みの *note complex: 197. 型
     を受け付ける演算を含みます。それらは: *note complex: 197. および
     *note bool: 3c3. への変換、 *note real: 2a69, *note imag: 2a6a,
     ‘+’, ‘-’, ‘*’, ‘/’, ‘**’, *note abs(): 208d, *note conjugate():
     2a6b, ‘==’, ‘!=’ です。 ‘-’ と ‘!=’ 以外の全てのものは抽象メソッド
     や抽象プロパティです。

      -- の属性: real

          抽象プロパティ。この数の実部を取り出します。

      -- の属性: imag

          抽象プロパティ。この数の虚部を取り出します。

      -- メソッド: abstractmethod conjugate ()

          抽象プロパティ。複素共役を返します。たとえば、
          ‘(1+3j).conjugate() == (1-3j)’ です。

 -- クラス: numbers.Real

     To *note Complex: 25fc, ‘Real’ adds the operations that work on
     real numbers.

     簡潔に言うとそれらは: *note float: 196. への変換, *note
     math.trunc(): 15d9, *note round(): 14f2, *note math.floor(): 15d7,
     *note math.ceil(): 15d8, *note divmod(): b99, ‘//’, ‘%’, ‘<’, ‘<=’,
     ‘>’ および ‘>=’ です。

     Real はまた *note complex(): 197, *note real: 2a69, *note imag:
     2a6a. および *note conjugate(): 2a6b. のデフォルトを提供します。

 -- クラス: numbers.Rational

     *note Real: 25f2. をサブタイプ化し *note numerator: 2a6c. と *note
     denominator: 2a6d. のプロパティを加えたものです。これは *note
     float(): 196. のデフォルトも提供します。

     The *note numerator: 2a6c. and *note denominator: 2a6d. values
     should be instances of *note Integral: 240a. and should be in
     lowest terms with *note denominator: 2a6d. positive.

      -- の属性: numerator

          Abstract.  The numerator of this rational number.

      -- の属性: denominator

          Abstract.  The denominator of this rational number.

 -- クラス: numbers.Integral

     *note Rational: 14d6. をサブタイプ化し *note int: 19b. への変換が加
     わります。 *note float(): 196, *note numerator: 2a6c, *note
     denominator: 2a6d. のデフォルトを提供します。法 (訳注: 割る数、除数
     のこと) を持つ *note pow(): 1a4. に対する抽象メソッドと、ビット列演
     算 ‘<<’, ‘>>’, ‘&’, ‘^’, ‘|’, ‘~’ を追加します。


File: python.info,  Node: Notes for type implementers,  Prev: 数値塔,  Up: numbers --- 数の抽象基底クラス

5.9.1.2 Notes for type implementers
...................................

Implementers should be careful to make equal numbers equal and hash them
to the same values.  This may be subtle if there are two different
extensions of the real numbers.  For example, *note fractions.Fraction:
213. implements *note hash(): 801. as follows:

     def __hash__(self):
         if self.denominator == 1:
             # Get integers right.
             return hash(self.numerator)
         # Expensive check, but definitely correct.
         if self == float(self):
             return hash(float(self))
         else:
             # Use tuple's hash to avoid a high collision rate on
             # simple fractions.
             return hash((self.numerator, self.denominator))

* Menu:

* さらに数のABCを追加する::
* 算術演算の実装::


File: python.info,  Node: さらに数のABCを追加する,  Next: 算術演算の実装,  Up: Notes for type implementers

5.9.1.3 さらに数のABCを追加する
...............................

数に対する ABC が他にも多く存在しうることは、言うまでもありません。それ
らの ABC を階層に追加する可能性が閉ざされるとしたら、その階層は貧相な階
層でしかありません。たとえば、 ‘MyFoo’ を *note Complex: 25fc. と *note
Real: 25f2. の間に付け加えるには、次のようにします:

     class MyFoo(Complex): ...
     MyFoo.register(Real)


File: python.info,  Node: 算術演算の実装,  Prev: さらに数のABCを追加する,  Up: Notes for type implementers

5.9.1.4 算術演算の実装
......................

We want to implement the arithmetic operations so that mixed-mode
operations either call an implementation whose author knew about the
types of both arguments, or convert both to the nearest built in type
and do the operation there.  For subtypes of *note Integral: 240a, this
means that *note __add__(): 23dd. and *note __radd__(): 23de. should be
defined as:

     class MyIntegral(Integral):

         def __add__(self, other):
             if isinstance(other, MyIntegral):
                 return do_my_adding_stuff(self, other)
             elif isinstance(other, OtherTypeIKnowAbout):
                 return do_my_other_adding_stuff(self, other)
             else:
                 return NotImplemented

         def __radd__(self, other):
             if isinstance(other, MyIntegral):
                 return do_my_adding_stuff(other, self)
             elif isinstance(other, OtherTypeIKnowAbout):
                 return do_my_other_adding_stuff(other, self)
             elif isinstance(other, Integral):
                 return int(other) + int(self)
             elif isinstance(other, Real):
                 return float(other) + float(self)
             elif isinstance(other, Complex):
                 return complex(other) + complex(self)
             else:
                 return NotImplemented

ここには5つの異なる *note Complex: 25fc. のサブクラス間の混在型の演算が
あります。上のコードの中で ‘MyIntegral’ と ‘OtherTypeIKnowAbout’ に触れ
ない部分を "ボイラープレート" と呼ぶことにしましょう。 ‘a’ を *note
Complex: 25fc. のサブタイプである ‘A’ のインスタンス (‘a : A <:
Complex’)、同様に ‘b : B <: Complex’ として、 ‘a + b’ を考えます:

  1. If ‘A’ defines an *note __add__(): 23dd. which accepts ‘b’, all is
     well.

  2. If ‘A’ falls back to the boilerplate code, and it were to return a
     value from *note __add__(): 23dd, we'd miss the possibility that
     ‘B’ defines a more intelligent *note __radd__(): 23de, so the
     boilerplate should return *note NotImplemented: 1a2. from
     ‘__add__()’.  (Or ‘A’ may not implement ‘__add__()’ at all.)

  3. Then ‘B’'s *note __radd__(): 23de. gets a chance.  If it accepts
     ‘a’, all is well.

  4. ここでボイラープレートに落ち込むならば、もう他に試すべきメソッドは
     ありませんので、デフォルト実装の出番です。

  5. もし ‘B <: A’ ならば、Python は ‘A.__add__’ の前に ‘B.__radd__’ を
     試します。これで良い理由は、 ‘A’ についての知識を持って実装しており
     、 *note Complex: 25fc. に委ねる前にこれらのインスタンスを扱えるは
     ずだからです。

If ‘A <: Complex’ and ‘B <: Real’ without sharing any other knowledge,
then the appropriate shared operation is the one involving the built in
*note complex: 197, and both *note __radd__(): 23de. s land there, so
‘a+b == b+a’.

ほとんどの演算はどのような型についても非常に良く似ていますので、与えられ
た演算子について順結合(forward)および逆結合(reverse)のメソッドを生成する
支援関数を定義することは役に立ちます。たとえば、 *note
fractions.Fraction: 213. では次のようなものを利用しています:

     def _operator_fallbacks(monomorphic_operator, fallback_operator):
         def forward(a, b):
             if isinstance(b, (int, Fraction)):
                 return monomorphic_operator(a, b)
             elif isinstance(b, float):
                 return fallback_operator(float(a), b)
             elif isinstance(b, complex):
                 return fallback_operator(complex(a), b)
             else:
                 return NotImplemented
         forward.__name__ = '__' + fallback_operator.__name__ + '__'
         forward.__doc__ = monomorphic_operator.__doc__

         def reverse(b, a):
             if isinstance(a, Rational):
                 # Includes ints.
                 return monomorphic_operator(a, b)
             elif isinstance(a, Real):
                 return fallback_operator(float(a), float(b))
             elif isinstance(a, Complex):
                 return fallback_operator(complex(a), complex(b))
             else:
                 return NotImplemented
         reverse.__name__ = '__r' + fallback_operator.__name__ + '__'
         reverse.__doc__ = monomorphic_operator.__doc__

         return forward, reverse

     def _add(a, b):
         """a + b"""
         return Fraction(a.numerator * b.denominator +
                         b.numerator * a.denominator,
                         a.denominator * b.denominator)

     __add__, __radd__ = _operator_fallbacks(_add, operator.add)

     # ...


File: python.info,  Node: math --- 数学関数,  Next: cmath --- 複素数用の数学関数,  Prev: numbers --- 数の抽象基底クラス,  Up: 数値と数学モジュール

5.9.2 ‘math’ -- 数学関数
------------------------

__________________________________________________________________

This module provides access to common mathematical functions and
constants, including those defined by the C standard.

これらの関数で複素数を使うことはできません。複素数に対応する必要があるな
らば、 *note cmath: 19. モジュールにある同じ名前の関数を使ってください。
ほとんどのユーザーは複素数を理解するのに必要なだけの数学を勉強したくない
ので、複素数に対応した関数と対応していない関数の区別がされています。これ
らの関数では複素数が利用できないため、引数に複素数を渡されると、複素数の
結果が返るのではなく例外が発生します。その結果、どういった理由で例外が送
出されたかに早い段階で気づく事ができます。

このモジュールでは次の関数を提供しています。明示的な注記のない限り、戻り
値は全て浮動小数点数になります。

'Number-theoretic functions'

*note comb(n, k): 8df.                                   Number of ways to choose 'k' items from 'n' items without repetition and without order
                                                         
                                                         
*note factorial(n): b41.                                 'n' の階乗
                                                         
                                                         
*note gcd(*integers): b0c.                               整数引数の最大公約数
                                                         
                                                         
*note isqrt(n): bf8.                                     Integer square root of a nonnegative integer 'n'
                                                         
                                                         
*note lcm(*integers): b0d.                               Least common multiple of the integer arguments
                                                         
                                                         
*note perm(n, k): 8e0.                                   Number of ways to choose 'k' items from 'n' items without repetition and with order
                                                         
                                                         
'Floating point arithmetic'

*note ceil(x): 15d8.                                     Ceiling of 'x', the smallest integer greater than or equal to 'x'
                                                         
                                                         
*note fabs(x): 2a74.                                     'x' の絶対値
                                                         
                                                         
*note floor(x): 15d7.                                    Floor of 'x', the largest integer less than or equal to 'x'
                                                         
                                                         
*note fma(x, y, z): 514.                                 Fused multiply-add operation: ‘(x * y) + z’
                                                         
                                                         
*note fmod(x, y): 24c8.                                  ‘x / y’ の剰余
                                                         
                                                         
*note modf(x): 2a75.                                     Fractional and integer parts of 'x'
                                                         
                                                         
*note remainder(x, y): d4a.                              Remainder of 'x' with respect to 'y'
                                                         
                                                         
*note trunc(x): 15d9.                                    'x' の整数部
                                                         
                                                         
'Floating point manipulation functions'

*note copysign(x, y): 15ec.                              Magnitude (absolute value) of 'x' with the sign of 'y'
                                                         
                                                         
*note frexp(x): 2a76.                                    Mantissa and exponent of 'x'
                                                         
                                                         
*note isclose(a, b, rel_tol, abs_tol): fb0.              Check if the values 'a' and 'b' are close to each other
                                                         
                                                         
*note isfinite(x): 1404.                                 Check if 'x' is neither an infinity nor a NaN
                                                         
                                                         
*note isinf(x): 15ea.                                    Check if 'x' is a positive or negative infinity
                                                         
                                                         
*note isnan(x): 15eb.                                    Check if 'x' is a NaN (not a number)
                                                         
                                                         
*note ldexp(x, i): 1840.                                 ‘x * (2**i)’, inverse of function *note frexp(): 2a76.
                                                         
                                                         
*note nextafter(x, y, steps): 6c0.                       Floating-point value 'steps' steps after 'x' towards 'y'
                                                         
                                                         
*note ulp(x): b0e.                                       Value of the least significant bit of 'x'
                                                         
                                                         
'Power, exponential and logarithmic functions'

*note cbrt(x): 871.                                      'x' の立方根
                                                         
                                                         
*note exp(x): 152b.                                      'e' raised to the power 'x'
                                                         
                                                         
*note exp2(x): 870.                                      '2' raised to the power 'x'
                                                         
                                                         
*note expm1(x): 1405.                                    'e' raised to the power 'x', minus 1
                                                         
                                                         
*note log(x, base): 16d9.                                Logarithm of 'x' to the given base ('e' by default)
                                                         
                                                         
*note log1p(x): 15f1.                                    Natural logarithm of '1+x' (base 'e')
                                                         
                                                         
*note log2(x): 12f3.                                     2を底とする 'x' の対数
                                                         
                                                         
*note log10(x): 1948.                                    10を底とする 'x' の対数
                                                         
                                                         
*note pow(x, y): 872.                                    'x' の 'y' 乗
                                                         
                                                         
*note sqrt(x): bf9.                                      'x' の平方根
                                                         
                                                         
'Summation and product functions'

*note dist(p, q): bf5.                                   Euclidean distance between two points 'p' and 'q' given as an iterable of coordinates
                                                         
                                                         
*note fsum(iterable): 15ed.                              Sum of values in the input 'iterable'
                                                         
                                                         
*note hypot(*coordinates): bf6.                          Euclidean norm of an iterable of coordinates
                                                         
                                                         
*note prod(iterable, start): bf7.                        Product of elements in the input 'iterable' with a 'start' value
                                                         
                                                         
*note sumprod(p, q): 6bf.                                Sum of products from two iterables 'p' and 'q'
                                                         
                                                         
'Angular conversion'

*note degrees(x): 2a77.                                  Convert angle 'x' from radians to degrees
                                                         
                                                         
*note radians(x): 2a78.                                  Convert angle 'x' from degrees to radians
                                                         
                                                         
'Trigonometric functions'

*note acos(x): 2a79.                                     'x' の逆余弦
                                                         
                                                         
*note asin(x): 2a7a.                                     'x' の逆正弦
                                                         
                                                         
*note atan(x): 2a7b.                                     'x' の逆正接
                                                         
                                                         
*note atan2(y, x): 2a7c.                                 ‘atan(y / x)’
                                                         
                                                         
*note cos(x): 16d8.                                      'x' の余弦
                                                         
                                                         
*note sin(x): 16d7.                                      'x' の正弦
                                                         
                                                         
*note tan(x): 2a7d.                                      'x' の正接
                                                         
                                                         
'Hyperbolic functions'

*note acosh(x): 15ee.                                    Inverse hyperbolic cosine of 'x'
                                                         
                                                         
*note asinh(x): 15ef.                                    Inverse hyperbolic sine of 'x'
                                                         
                                                         
*note atanh(x): 15f0.                                    Inverse hyperbolic tangent of 'x'
                                                         
                                                         
*note cosh(x): 2a7e.                                     Hyperbolic cosine of 'x'
                                                         
                                                         
*note sinh(x): 2a7f.                                     Hyperbolic sine of 'x'
                                                         
                                                         
*note tanh(x): 2a80.                                     Hyperbolic tangent of 'x'
                                                         
                                                         
'Special functions'

*note erf(x): dd3.                                       Error function(1) at 'x'
                                                         
                                                         
*note erfc(x): dd4.                                      Complementary error function(2) at 'x'
                                                         
                                                         
*note gamma(x): 1406.                                    Gamma function(3) at 'x'
                                                         
                                                         
*note lgamma(x): 1407.                                   Natural logarithm of the absolute value of the Gamma function(4) at 'x'
                                                         
                                                         
'定数'

*note pi: 2a81.                                          'π' = 3.141592...
                                                         
                                                         
*note e: 2a82.                                           'e' = 2.718281...
                                                         
                                                         
*note tau: 2a83.                                         'τ' = 2'π' = 6.283185...
                                                         
                                                         
*note inf: e7e.                                          正の無限大
                                                         
                                                         
*note nan: 873.                                          非数 "Not a number" (NaN)
                                                         

* Menu:

* Number-theoretic functions::
* Floating point arithmetic::
* Floating point manipulation functions::
* Power, exponential and logarithmic functions: Power exponential and logarithmic functions.
* Summation and product functions::
* 角度変換::
* 三角関数::
* 双曲線関数::
* 特殊関数::
* 定数: 定数<2>.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Error_function

   (2) https://en.wikipedia.org/wiki/Error_function

   (3) https://en.wikipedia.org/wiki/Gamma_function

   (4) https://en.wikipedia.org/wiki/Gamma_function


File: python.info,  Node: Number-theoretic functions,  Next: Floating point arithmetic,  Up: math --- 数学関数

5.9.2.1 Number-theoretic functions
..................................

 -- の関数: math.comb (n, k)

     'n' 個の中から 'k' 個を重複無く順序をつけずに選ぶ方法の数を返します
     。

     ‘k <= n’ のとき ‘n! / (k! * (n - k)!)’ と評価し、‘k > n’ のとき 0 と
     評価します。

     これは ‘(1 + x)ⁿ’ の多項式展開における第 k 項の係数と等しいので、二
     項係数とも呼ばれます。

     いずれかの引数が整数でないなら *note TypeError: 198. を送出します。
     いずれかの引数が負であれば *note ValueError: 2ec. を送出します。

     Added in version 3.8.

 -- の関数: math.factorial (n)

     Return factorial of the nonnegative integer 'n'.

     バージョン 3.10 で変更: Floats with integral values (like ‘5.0’)
     are no longer accepted.

 -- の関数: math.gcd (*integers)

     指定された整数引数の最大公約数を返します。0 でない引数があれば、返
     される値は全ての引数の約数である最大の正の整数です。全ての引数が 0
     なら、返される値は ‘0’ です。引数の無い ‘gcd()’ は ‘0’ を返します。

     Added in version 3.5.

     バージョン 3.9 で変更: 任意の数の引数のサポートが追加されました。以
     前は、二つの引数のみがサポートされていました。

 -- の関数: math.isqrt (n)

     非負整数 'n' の整数平方根を返します。これは 'n' の正確な平方根の床
     であり、 'a'² ≤ 'n' を満たす最大の整数 'a' と等価です。

     少し応用すれば、'n' ≤ 'a'² を満たす最小の整数 'a' 、言い換えれば
     'n' の正確な平方根の天井を効率的に得られます。正の 'n' に対して、こ
     れは ‘a = 1 + isqrt(n - 1)’ を使って計算できます。

     Added in version 3.8.

 -- の関数: math.lcm (*integers)

     指定された整数引数の最小公倍数を返します。全ての引数が 0 でなければ
     、返される値は全ての引数の倍数である最小の正の整数です。引数に 0 が
     あれば、返される値は ‘0’ です。引数の無い ‘lcm()’ は ‘1’ を返します
     。

     Added in version 3.9.

 -- の関数: math.perm (n, k=None)

     'n' 個の中から 'k' 個を重複無く順序をつけて選ぶ方法の数を返します。

     ‘k <= n’ のとき ‘n! / (n - k)!’ と評価し、‘k > n’ のとき 0 と評価し
     ます。

     If 'k' is not specified or is ‘None’, then 'k' defaults to 'n' and
     the function returns ‘n!’.

     いずれかの引数が整数でないなら *note TypeError: 198. を送出します。
     いずれかの引数が負であれば *note ValueError: 2ec. を送出します。

     Added in version 3.8.


File: python.info,  Node: Floating point arithmetic,  Next: Floating point manipulation functions,  Prev: Number-theoretic functions,  Up: math --- 数学関数

5.9.2.2 Floating point arithmetic
.................................

 -- の関数: math.ceil (x)

     'x' の「天井」 ('x' 以上の最小の整数) を返します。 'x' が浮動小数点
     数でなければ、内部的に *note x.__ceil__: 2409. が実行され、 *note
     Integral: 240a. 値が返されます。

 -- の関数: math.fabs (x)

     'x' の絶対値を返します。

 -- の関数: math.floor (x)

     'x' の「床」 ('x' 以下の最大の整数) を返します。 'x' が浮動小数点数
     でなければ、内部的に *note x.__floor__: 2408. が実行され、 *note
     Integral: 240a. 値が返されます。

 -- の関数: math.fma (x, y, z)

     Fused multiply-add operation.  Return ‘(x * y) + z’, computed as
     though with infinite precision and range followed by a single round
     to the ‘float’ format.  This operation often provides better
     accuracy than the direct expression ‘(x * y) + z’.

     This function follows the specification of the fusedMultiplyAdd
     operation described in the IEEE 754 standard.  The standard leaves
     one case implementation-defined, namely the result of ‘fma(0, inf,
     nan)’ and ‘fma(inf, 0, nan)’.  In these cases, ‘math.fma’ returns a
     NaN, and does not raise any exception.

     Added in version 3.13.

 -- の関数: math.fmod (x, y)

     Return the floating-point remainder of ‘x / y’, as defined by the
     platform C library function ‘fmod(x, y)’.  Note that the Python
     expression ‘x % y’ may not return the same result.  The intent of
     the C standard is that ‘fmod(x, y)’ be exactly (mathematically; to
     infinite precision) equal to ‘x - n*y’ for some integer 'n' such
     that the result has the same sign as 'x' and magnitude less than
     ‘abs(y)’.  Python's ‘x % y’ returns a result with the sign of 'y'
     instead, and may not be exactly computable for float arguments.
     For example, ‘fmod(-1e-100, 1e100)’ is ‘-1e-100’, but the result of
     Python's ‘-1e-100 % 1e100’ is ‘1e100-1e-100’, which cannot be
     represented exactly as a float, and rounds to the surprising
     ‘1e100’.  For this reason, function *note fmod(): 24c8. is
     generally preferred when working with floats, while Python's ‘x %
     y’ is preferred when working with integers.

 -- の関数: math.modf (x)

     'x' の小数部分と整数部分を返します。両方の結果は 'x' の符号を受け継
     ぎます。整数部はfloat型で返されます。

     Note that *note modf(): 2a75. has a different call/return pattern
     than its C equivalents: it takes a single argument and return a
     pair of values, rather than returning its second return value
     through an 'output parameter' (there is no such thing in Python).

 -- の関数: math.remainder (x, y)

     IEEE 754 標準方式の 'x' を 'y' で割った剰余を返します。 有限な 'x'
     と有限な 'y' では、分数 ‘x / y’ の厳密な値に最も近い整数を ‘n’ とし
     て、 ‘x - n*y’ がこの返り値となります。 ‘x / y’ が隣り合う 2 つの整
     数のちょうど真ん中だった場合は、最も近い '偶数' が ‘n’ として使われ
     ます。 従って、剰余 ‘r = remainder(x, y)’ は常に ‘abs(r) <= 0.5 *
     abs(y)’ を満たします。

     特殊なケースについては IEEE 754 に従います: 任意の有限な 'x' に対す
     る ‘remainder(x, math.inf)’ 、および任意の非 NaN の 'x' に対する
     ‘remainder(x, 0)’ と ‘remainder(math.inf, x)’ は *note ValueError:
     2ec. を送出します。 剰余演算の結果がゼロの場合、そのゼロは 'x' と同
     じ符号を持ちます。

     On platforms using IEEE 754 binary floating point, the result of
     this operation is always exactly representable: no rounding error
     is introduced.

     Added in version 3.7.

 -- の関数: math.trunc (x)

     'x' の小数部を取り除き、残った整数部を返します。これは 0 に向かって
     丸められます: ‘trunc()’ は正の 'x' に対しては *note floor(): 15d7.
     に等しく、負の 'x' に対しては *note ceil(): 15d8. に等しいです。'x'
     が浮動小数点数でなければ、内部的に *note x.__trunc__: 19c. が実行さ
     れ、 *note Integral: 240a. 値が返されます。

*note ceil(): 15d8. 、 *note floor(): 15d7. 、および *note modf(): 2a75.
関数については、非常に大きな浮動小数点数が '全て' 整数そのものになるとい
うことに注意してください。通常、Python の浮動小数点型は 53 ビット以上の
精度をもたない (プラットフォームにおける C double 型と同じ) ので、結果的
に ‘abs(x) >= 2**52’ であるような浮動小数点型 'x' は小数部分を持たなくな
るのです。


File: python.info,  Node: Floating point manipulation functions,  Next: Power exponential and logarithmic functions,  Prev: Floating point arithmetic,  Up: math --- 数学関数

5.9.2.3 Floating point manipulation functions
.............................................

 -- の関数: math.copysign (x, y)

     'x' の大きさ (絶対値) で 'y' と同じ符号の浮動小数点数を返します。符
     号付きのゼロをサポートしているプラットフォームでは、‘copysign(1.0,
     -0.0)’ は '-1.0' を返します。

 -- の関数: math.frexp (x)

     'x' の仮数と指数を ‘(m, e)’ のペアとして返します。'm' はfloat型で、
     'e' は厳密に ‘x == m * 2**e’ であるような整数型です。'x' がゼロの場
     合は、‘(0.0, 0)’ を返し、それ以外の場合は、‘0.5 <= abs(m) < 1’ です
     。これは浮動小数点型の内部表現を可搬性を保ったまま "分解 (pick
     apart)" するために使われます。

     Note that *note frexp(): 2a76. has a different call/return pattern
     than its C equivalents: it takes a single argument and return a
     pair of values, rather than returning its second return value
     through an 'output parameter' (there is no such thing in Python).

 -- の関数: math.isclose (a, b, *, rel_tol=1e-09, abs_tol=0.0)

     値 'a' と 'b' が互いに近い場合 ‘True’ を、そうでない場合は ‘False’
     を返します。

     Whether or not two values are considered close is determined
     according to given absolute and relative tolerances.  If no errors
     occur, the result will be: ‘abs(a-b) <= max(rel_tol * max(abs(a),
     abs(b)), abs_tol)’.

     'rel_tol' is the relative tolerance - it is the maximum allowed
     difference between 'a' and 'b', relative to the larger absolute
     value of 'a' or 'b'.  For example, to set a tolerance of 5%, pass
     ‘rel_tol=0.05’.  The default tolerance is ‘1e-09’, which assures
     that the two values are the same within about 9 decimal digits.
     'rel_tol' must be nonnegative and less than ‘1.0’.

     'abs_tol' is the absolute tolerance; it defaults to ‘0.0’ and it
     must be nonnegative.  When comparing ‘x’ to ‘0.0’, ‘isclose(x, 0)’
     is computed as ‘abs(x) <= rel_tol * abs(x)’, which is ‘False’ for
     any nonzero ‘x’ and 'rel_tol' less than ‘1.0’.  So add an
     appropriate positive 'abs_tol' argument to the call.

     IEEE 754 特殊値 ‘NaN’、‘inf’、‘-inf’ は IEEE の規則に従って処理され
     ます。 具体的には、‘NaN’ は自身を含めたあらゆる値に近いとは見なされ
     ません。 ‘inf’ と ‘-inf’ は自身とのみ近いと見なされます。

     Added in version 3.5.

     参考
     ....

     PEP 485(1) - A function for testing approximate equality

 -- の関数: math.isfinite (x)

     'x' が無限でも NaN でもない場合に ‘True’ を返します。それ以外の時に
     は ‘False’ を返します。 (注意: ‘0.0’ は有限数と扱われます。)

     Added in version 3.2.

 -- の関数: math.isinf (x)

     'x' が正ないし負の無限数ならば ‘True’ を返します。それ以外の時には
     ‘False’ を返します。

 -- の関数: math.isnan (x)

     'x' がNaN (not a number、非数) の時に ‘True’ を返します。それ以外の
     場合には ‘False’ を返します。

 -- の関数: math.ldexp (x, i)

     ‘x * (2**i)’ を返します。これは本質的に *note frexp(): 2a76. の逆関
     数です。

 -- の関数: math.nextafter (x, y, steps=1)

     Return the floating-point value 'steps' steps after 'x' towards
     'y'.

     If 'x' is equal to 'y', return 'y', unless 'steps' is zero.

     例:

        * ‘math.nextafter(x, math.inf)’ goes up: towards positive
          infinity.

        * ‘math.nextafter(x, -math.inf)’ goes down: towards minus
          infinity.

        * ‘math.nextafter(x, 0.0)’ は 0 に近づきます。

        * ‘math.nextafter(x, math.copysign(math.inf, x))’ は 0 から遠ざ
          かります。

     *note math.ulp(): b0e. を参照してください。

     Added in version 3.9.

     バージョン 3.12 で変更: Added the 'steps' argument.

 -- の関数: math.ulp (x)

     浮動小数点数 'x' の最下位ビットの値を返します:

        * 'x' が NaN (非数) なら、'x' を返します。

        * 'x' が負なら、‘ulp(-x)’ を返します。

        * 'x' が正の無限大なら、'x' を返します。

        * 'x' が 0 に等しければ、(最小の正の '正規化' 浮動小数点数 *note
          sys.float_info.min: 1dcf. よりも小さい) 最小の正の表現可能な
          '非正規化' 浮動小数点数を返します。

        * 'x' が表現可能な最大の正の浮動小数点数に等しいなら、'x' より小
          さい最初の浮動小数点数が ‘x - ulp(x)’ であるような、'x' の最下
          位ビットの値を返します。

        * それ以外 ('x' が正の有限な数) なら、'x' より大きい最初の浮動小
          数点数が ‘x + ulp(x)’ であるような、'x' の最下位ビットの値を返
          します。

     ULP は "Unit in the Last Place" の略です。

     *note math.nextafter(): 6c0. および *note sys.float_info.epsilon:
     1dcf. も参照してください。

     Added in version 3.9.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0485/


File: python.info,  Node: Power exponential and logarithmic functions,  Next: Summation and product functions,  Prev: Floating point manipulation functions,  Up: math --- 数学関数

5.9.2.4 Power, exponential and logarithmic functions
....................................................

 -- の関数: math.cbrt (x)

     'x' の立方根を返します。

     Added in version 3.11.

 -- の関数: math.exp (x)

     'e' = 2.718281...  を自然対数の底として、 'e' の 'x' 乗を返します。
     この値は、通常は ‘math.e ** x’ や ‘pow(math.e, x)’ よりも精度が高い
     です。

 -- の関数: math.exp2 (x)

     '2' の 'x' 乗を返します。

     Added in version 3.11.

 -- の関数: math.expm1 (x)

     Return 'e' raised to the power 'x', minus 1.  Here 'e' is the base
     of natural logarithms.  For small floats 'x', the subtraction in
     ‘exp(x) - 1’ can result in a significant loss of precision(1); the
     *note expm1(): 1405. function provides a way to compute this
     quantity to full precision:

          >>> from math import exp, expm1
          >>> exp(1e-5) - 1  # gives result accurate to 11 places
          1.0000050000069649e-05
          >>> expm1(1e-5)    # result accurate to full precision
          1.0000050000166668e-05

     Added in version 3.2.

 -- の関数: math.log (x[, base])

     引数が1つの場合、'x' の ('e' を底とする)自然対数を返します。

     引数が2つの場合、‘log(x)/log(base)’ として求められる 'base' を底と
     した 'x' の対数を返します。

 -- の関数: math.log1p (x)

     '1+x' の自然対数(つまり底 'e' の対数)を返します。結果はゼロに近い
     'x' に対して正確になるような方法で計算されます。

 -- の関数: math.log2 (x)

     2を底とする 'x' の対数を返します。この関数は、一般に ‘log(x, 2)’ よ
     りも正確な値を返します。

     Added in version 3.3.

     参考
     ....

     *note int.bit_length(): 25f6. は、その整数を二進法で表すのに何ビッ
     ト必要かを返す関数です。符号と先頭のゼロは無視されます。

 -- の関数: math.log10 (x)

     'x' の10を底とした対数(常用対数)を返します。この関数は通常、‘log(x,
     10)’ よりも高精度です。

 -- の関数: math.pow (x, y)

     Return 'x' raised to the power 'y'.  Exceptional cases follow the
     IEEE 754 standard as far as possible.  In particular, ‘pow(1.0, x)’
     and ‘pow(x, 0.0)’ always return ‘1.0’, even when 'x' is a zero or a
     NaN. If both 'x' and 'y' are finite, 'x' is negative, and 'y' is
     not an integer then ‘pow(x, y)’ is undefined, and raises *note
     ValueError: 2ec.

     組み込みの ‘**’ 演算子と違って、 *note math.pow(): 872. は両方の引
     数を *note float: 196. 型に変換します。正確な整数の冪乗を計算するに
     は ‘**’ もしくは組み込みの *note pow(): 1a4. 関数を使ってください。

     バージョン 3.11 で変更: IEEE 754 との一貫性のため、特殊な例である
     ‘pow(0.0, -inf)’ および ‘pow(-0.0, -inf)’ は *note ValueError: 2ec.
     を送出する代わりに ‘inf’ を返すように変更されました。

 -- の関数: math.sqrt (x)

     'x' の平方根を返します。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Loss_of_significance


File: python.info,  Node: Summation and product functions,  Next: 角度変換,  Prev: Power exponential and logarithmic functions,  Up: math --- 数学関数

5.9.2.5 Summation and product functions
.......................................

 -- の関数: math.dist (p, q)

     それぞれ座標のシーケンス (またはイテラブル) として与えられる点 'p'
     と 'q' の間のユークリッド距離を返します。二点の次元は同じでなければ
     なりません。

     およそ次と等価です:

          sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))

     Added in version 3.8.

 -- の関数: math.fsum (iterable)

     Return an accurate floating-point sum of values in the iterable.
     Avoids loss of precision by tracking multiple intermediate partial
     sums.

     アルゴリズムの正確性は、 IEEE-754 演算の保証と、丸めモードが偶数丸
     め (half-even) である典型的な場合に依存します。Windows 以外のいくつ
     かのビルドでは、下層の C ライブラリが拡張精度の加算を行い、時々計算
     途中の和を double 型へ丸めてしまうため、最下位ビットが消失すること
     があります。

     For further discussion and two alternative approaches, see the ASPN
     cookbook recipes for accurate floating-point summation(1).

 -- の関数: math.hypot (*coordinates)

     ユークリッドノルム ‘sqrt(sum(x**2 for x in coordinates))’ を返しま
     す。これは原点から座標で与えられる点までのベクトルの長さです。

     二次元の点 ‘(x, y)’ では、これは直角三角形の斜辺をピタゴラスの定理
     ‘sqrt(x*x + y*y)’ を用いて計算することと等価です。

     バージョン 3.8 で変更: n 次元の点のサポートが追加されました。以前は
     、二次元の場合しかサポートされていませんでした。

     バージョン 3.10 で変更: アルゴリズムの精度を改良し、最大の誤差が 1
     ulp (最終桁単位) 未満になりました。より一般的には、結果はほとんどの
     場合に 1/2 ulp 以内に正しく丸められます。

 -- の関数: math.prod (iterable, *, start=1)

     入力 'iterable' の全ての要素の積を計算します。積のデフォルト
     'start' 値は ‘1’ です。

     イテラブルが空のとき、初期値を返します。この関数は特に数値に使うこ
     とを意図されており、非数値を受け付けないことがあります。

     Added in version 3.8.

 -- の関数: math.sumprod (p, q)

     Return the sum of products of values from two iterables 'p' and
     'q'.

     Raises *note ValueError: 2ec. if the inputs do not have the same
     length.

     およそ次と等価です:

          sum(map(operator.mul, p, q, strict=True))

     For float and mixed int/float inputs, the intermediate products and
     sums are computed with extended precision.

     Added in version 3.12.

   ---------- Footnotes ----------

   (1) 
https://code.activestate.com/recipes/393090-binary-floating-point-summation-accurate-to-full-p/


File: python.info,  Node: 角度変換,  Next: 三角関数,  Prev: Summation and product functions,  Up: math --- 数学関数

5.9.2.6 角度変換
................

 -- の関数: math.degrees (x)

     角 'x' をラジアンから度に変換します。

 -- の関数: math.radians (x)

     角 'x' を度からラジアンに変換します。


File: python.info,  Node: 三角関数,  Next: 双曲線関数,  Prev: 角度変換,  Up: math --- 数学関数

5.9.2.7 三角関数
................

 -- の関数: math.acos (x)

     'x' の逆余弦を、ラジアンで返します。結果は ‘0’ と ‘pi’ の間です。

 -- の関数: math.asin (x)

     'x' の逆正弦を、ラジアンで返します。結果は ‘-pi/2’ と ‘pi/2’ の間で
     す。

 -- の関数: math.atan (x)

     'x' の逆正接を、ラジアンで返します。結果は ‘-pi/2’ と ‘pi/2’ の間で
     す。

 -- の関数: math.atan2 (y, x)

     ‘atan(y / x)’ を、ラジアンで返します。戻り値は ‘-pi’ から ‘pi’ の間
     になります。この角度は、極座標平面において原点から ‘(x, y)’ へのベ
     クトルが X 軸の正の方向となす角です。 *note atan2(): 2a7c. のポイン
     トは、両方の入力の符号が既知であるために、位相角の正しい象限を計算
     できることにあります。例えば、 ‘atan(1)’ と ‘atan2(1, 1)’ はいずれ
     も ‘pi/4’ ですが、 ‘atan2(-1, -1)’ は ‘-3*pi/4’ になります。

 -- の関数: math.cos (x)

     'x' ラジアンの余弦を返します。

 -- の関数: math.sin (x)

     'x' ラジアンの正弦を返します。

 -- の関数: math.tan (x)

     'x' ラジアンの正接を返します。


File: python.info,  Node: 双曲線関数,  Next: 特殊関数,  Prev: 三角関数,  Up: math --- 数学関数

5.9.2.8 双曲線関数
..................

Hyperbolic functions(1) are analogs of trigonometric functions that are
based on hyperbolas instead of circles.

 -- の関数: math.acosh (x)

     'x' の逆双曲線余弦を返します。

 -- の関数: math.asinh (x)

     'x' の逆双曲線正弦を返します。

 -- の関数: math.atanh (x)

     'x' の逆双曲線正接を返します。

 -- の関数: math.cosh (x)

     'x' の双曲線余弦を返します。

 -- の関数: math.sinh (x)

     'x' の双曲線正弦を返します。

 -- の関数: math.tanh (x)

     'x' の双曲線正接を返します。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Hyperbolic_functions


File: python.info,  Node: 特殊関数,  Next: 定数<2>,  Prev: 双曲線関数,  Up: math --- 数学関数

5.9.2.9 特殊関数
................

 -- の関数: math.erf (x)

     'x' の 誤差関数(1) を返します。

     The *note erf(): dd3. function can be used to compute traditional
     statistical functions such as the cumulative standard normal
     distribution(2):

          def phi(x):
              'Cumulative distribution function for the standard normal distribution'
              return (1.0 + erf(x / sqrt(2.0))) / 2.0

     Added in version 3.2.

 -- の関数: math.erfc (x)

     'x' の相補誤差関数を返します。相補誤差関数(3) は ‘1.0 - erf(x)’ と
     定義されます。この関数は、1からの引き算が 桁落ち(4) をするような大
     きな 'x' に対し使われます。

     Added in version 3.2.

 -- の関数: math.gamma (x)

     'x' の ガンマ関数(5) を返します。

     Added in version 3.2.

 -- の関数: math.lgamma (x)

     'x' のガンマ関数の絶対値の自然対数を返します。

     Added in version 3.2.

   ---------- Footnotes ----------

   (1) 
https://ja.wikipedia.org/wiki/%E8%AA%A4%E5%B7%AE%E9%96%A2%E6%95%B0

   (2) https://en.wikipedia.org/wiki/Cumulative_distribution_function

   (3) 
https://ja.wikipedia.org/wiki/%E8%AA%A4%E5%B7%AE%E9%96%A2%E6%95%B0

   (4) 
https://ja.wikipedia.org/wiki/%E8%AA%A4%E5%B7%AE#.E6.A1.81.E8.90.BD.E3.81.A1

   (5) 
https://ja.wikipedia.org/wiki/%E3%82%AC%E3%83%B3%E3%83%9E%E9%96%A2%E6%95%B0


File: python.info,  Node: 定数<2>,  Prev: 特殊関数,  Up: math --- 数学関数

5.9.2.10 定数
.............

 -- データ: math.pi

     利用可能なだけの精度の数学定数 'π' = 3.141592...  (円周率)。

 -- データ: math.e

     利用可能なだけの精度の数学定数 'e' = 2.718281...  (自然対数の底)。

 -- データ: math.tau

     The mathematical constant 'τ' = 6.283185..., to available
     precision.  Tau is a circle constant equal to 2'π', the ratio of a
     circle's circumference to its radius.  To learn more about Tau,
     check out Vi Hart's video Pi is (still) Wrong(1), and start
     celebrating Tau day(2) by eating twice as much pie!

     Added in version 3.6.

 -- データ: math.inf

     浮動小数の正の無限大です。(負の無限大には ‘-math.inf’ を使います。)
     ‘float('inf')’ の出力と等価です。

     Added in version 3.5.

 -- データ: math.nan

     A floating-point "not a number" (NaN) value.  Equivalent to the
     output of ‘float('nan')’.  Due to the requirements of the IEEE-754
     standard(3), ‘math.nan’ and ‘float('nan')’ are not considered to
     equal to any other numeric value, including themselves.  To check
     whether a number is a NaN, use the *note isnan(): 15eb. function to
     test for NaNs instead of ‘is’ or ‘==’.  Example:

          >>> import math
          >>> math.nan == math.nan
          False
          >>> float('nan') == float('nan')
          False
          >>> math.isnan(math.nan)
          True
          >>> math.isnan(float('nan'))
          True

     Added in version 3.5.

     バージョン 3.11 で変更: 常に利用出来るようになりました。

'CPython 実装の詳細:' The ‘math’ module consists mostly of thin wrappers
around the platform C math library functions.  Behavior in exceptional
cases follows Annex F of the C99 standard where appropriate.  The
current implementation will raise *note ValueError: 2ec. for invalid
operations like ‘sqrt(-1.0)’ or ‘log(0.0)’ (where C99 Annex F recommends
signaling invalid operation or divide-by-zero), and *note OverflowError:
a81. for results that overflow (for example, ‘exp(1000.0)’).  A NaN will
not be returned from any of the functions above unless one or more of
the input arguments was a NaN; in that case, most functions will return
a NaN, but (again following C99 Annex F) there are some exceptions to
this rule, for example ‘pow(float('nan'), 0.0)’ or ‘hypot(float('nan'),
float('inf'))’.

Python は signaling NaN と quiet NaN を区別せず、signaling NaN に対する
挙動は未定義とされていることに注意してください。典型的な挙動は、全ての
NaN を quiet NaN として扱うことです。

参考
....

*note cmath: 19. モジュール

     これらの多くの関数の複素数版。

   ---------- Footnotes ----------

   (1) https://vimeo.com/147792667

   (2) https://tauday.com/

   (3) https://en.wikipedia.org/wiki/IEEE_754


File: python.info,  Node: cmath --- 複素数用の数学関数,  Next: decimal --- 10進固定小数点と浮動小数点の演算,  Prev: math --- 数学関数,  Up: 数値と数学モジュール

5.9.3 ‘cmath’ -- 複素数用の数学関数
-----------------------------------

__________________________________________________________________

このモジュールは、複素数を扱う数学関数へのアクセスを提供しています。 こ
のモジュール中の関数は整数、浮動小数点数または複素数を引数にとります。 ま
た、 *note __complex__(): 7fd. または *note __float__(): bc1. どちらかの
メソッドを提供している Python オブジェクトも受け付けます。 これらのメソ
ッドはそのオブジェクトを複素数または浮動小数点数に変換するのにそれぞれ使
われ、呼び出された関数はそうして変換された結果を利用します。

     注釈: For functions involving branch cuts, we have the problem of
     deciding how to define those functions on the cut itself.
     Following Kahan's "Branch cuts for complex elementary functions"
     paper, as well as Annex G of C99 and later C standards, we use the
     sign of zero to distinguish one side of the branch cut from the
     other: for a branch cut along (a portion of) the real axis we look
     at the sign of the imaginary part, while for a branch cut along the
     imaginary axis we look at the sign of the real part.

     For example, the *note cmath.sqrt(): 2a91. function has a branch
     cut along the negative real axis.  An argument of ‘-2-0j’ is
     treated as though it lies 'below' the branch cut, and so gives a
     result on the negative imaginary axis:

          >>> cmath.sqrt(-2-0j)
          -1.4142135623730951j

     But an argument of ‘-2+0j’ is treated as though it lies above the
     branch cut:

          >>> cmath.sqrt(-2+0j)
          1.4142135623730951j

'Conversions to and from polar coordinates'

*note phase(z): 2a92.                                    Return the phase of 'z'
                                                         
                                                         
*note polar(z): 2a93.                                    Return the representation of 'z' in polar coordinates
                                                         
                                                         
*note rect(r, phi): 2a94.                                Return the complex number 'z' with polar coordinates 'r' and 'phi'
                                                         
                                                         
'Power and logarithmic functions'

*note exp(z): 2a95.                                      Return 'e' raised to the power 'z'
                                                         
                                                         
*note log(z[, base]): 2a96.                              Return the logarithm of 'z' to the given 'base' ('e' by default)
                                                         
                                                         
*note log10(z): 2a97.                                    Return the base-10 logarithm of 'z'
                                                         
                                                         
*note sqrt(z): 2a91.                                     Return the square root of 'z'
                                                         
                                                         
'Trigonometric functions'

*note acos(z): 2a98.                                     Return the arc cosine of 'z'
                                                         
                                                         
*note asin(z): 2a99.                                     Return the arc sine of 'z'
                                                         
                                                         
*note atan(z): 2a9a.                                     Return the arc tangent of 'z'
                                                         
                                                         
*note cos(z): 2a9b.                                      Return the cosine of 'z'
                                                         
                                                         
*note sin(z): 2a9c.                                      Return the sine of 'z'
                                                         
                                                         
*note tan(z): 2a9d.                                      Return the tangent of 'z'
                                                         
                                                         
'Hyperbolic functions'

*note acosh(z): 2a9e.                                    Return the inverse hyperbolic cosine of 'z'
                                                         
                                                         
*note asinh(z): 2a9f.                                    Return the inverse hyperbolic sine of 'z'
                                                         
                                                         
*note atanh(z): 2aa0.                                    Return the inverse hyperbolic tangent of 'z'
                                                         
                                                         
*note cosh(z): 2aa1.                                     Return the hyperbolic cosine of 'z'
                                                         
                                                         
*note sinh(z): 2aa2.                                     Return the hyperbolic sine of 'z'
                                                         
                                                         
*note tanh(z): 2aa3.                                     Return the hyperbolic tangent of 'z'
                                                         
                                                         
'Classification functions'

*note isfinite(z): 2aa4.                                 Check if all components of 'z' are finite
                                                         
                                                         
*note isinf(z): 2aa5.                                    Check if any component of 'z' is infinite
                                                         
                                                         
*note isnan(z): 2aa6.                                    Check if any component of 'z' is a NaN
                                                         
                                                         
*note isclose(a, b, *, rel_tol, abs_tol): fb1.           Check if the values 'a' and 'b' are close to each other
                                                         
                                                         
'定数'

*note pi: 2aa7.                                          'π' = 3.141592...
                                                         
                                                         
*note e: 2aa8.                                           'e' = 2.718281...
                                                         
                                                         
*note tau: e7d.                                          'τ' = 2'π' = 6.283185...
                                                         
                                                         
*note inf: e7f.                                          正の無限大
                                                         
                                                         
*note infj: e81.                                         Pure imaginary infinity
                                                         
                                                         
*note nan: e80.                                          非数 "Not a number" (NaN)
                                                         
                                                         
*note nanj: e82.                                         Pure imaginary NaN
                                                         

* Menu:

* 極座標変換::
* 指数関数と対数関数::
* 三角関数: 三角関数<2>.
* 双曲線関数: 双曲線関数<2>.
* 類別関数::
* 定数: 定数<3>.


File: python.info,  Node: 極座標変換,  Next: 指数関数と対数関数,  Up: cmath --- 複素数用の数学関数

5.9.3.1 極座標変換
..................

A Python complex number ‘z’ is stored internally using 'rectangular' or
'Cartesian' coordinates.  It is completely determined by its 'real part'
‘z.real’ and its 'imaginary part' ‘z.imag’.

'極座標' は複素数を表現する別の方法です。極座標では、複素数 'z' は半径
'r' と位相角 'phi' で定義されます。半径 'r' は 'z' から原点までの距離で
す。位相 'phi' は x 軸の正の部分から原点と 'z' を結んだ線分までの角度を
反時計回りにラジアンで測った値です。

次の関数はネイティブの直交座標を極座標に変換したりその逆を行うのに使えま
す。

 -- の関数: cmath.phase (z)

     Return the phase of 'z' (also known as the 'argument' of 'z'), as a
     float.  ‘phase(z)’ is equivalent to ‘math.atan2(z.imag, z.real)’.
     The result lies in the range [-'π', 'π'], and the branch cut for
     this operation lies along the negative real axis.  The sign of the
     result is the same as the sign of ‘z.imag’, even when ‘z.imag’ is
     zero:

          >>> phase(-1+0j)
          3.141592653589793
          >>> phase(-1-0j)
          -3.141592653589793

     注釈: The modulus (absolute value) of a complex number 'z' can be
     computed using the built-in *note abs(): 208d. function.  There is
     no separate ‘cmath’ module function for this operation.

 -- の関数: cmath.polar (z)

     Return the representation of 'z' in polar coordinates.  Returns a
     pair ‘(r, phi)’ where 'r' is the modulus of 'z' and 'phi' is the
     phase of 'z'.  ‘polar(z)’ is equivalent to ‘(abs(z), phase(z))’.

 -- の関数: cmath.rect (r, phi)

     Return the complex number 'z' with polar coordinates 'r' and 'phi'.
     Equivalent to ‘complex(r * math.cos(phi), r * math.sin(phi))’.


File: python.info,  Node: 指数関数と対数関数,  Next: 三角関数<2>,  Prev: 極座標変換,  Up: cmath --- 複素数用の数学関数

5.9.3.2 指数関数と対数関数
..........................

 -- の関数: cmath.exp (z)

     Return 'e' raised to the power 'z', where 'e' is the base of
     natural logarithms.

 -- の関数: cmath.log (z[, base])

     Return the logarithm of 'z' to the given 'base'.  If the 'base' is
     not specified, returns the natural logarithm of 'z'.  There is one
     branch cut, from 0 along the negative real axis to -∞.

 -- の関数: cmath.log10 (z)

     Return the base-10 logarithm of 'z'.  This has the same branch cut
     as *note log(): 2a96.

 -- の関数: cmath.sqrt (z)

     Return the square root of 'z'.  This has the same branch cut as
     *note log(): 2a96.


File: python.info,  Node: 三角関数<2>,  Next: 双曲線関数<2>,  Prev: 指数関数と対数関数,  Up: cmath --- 複素数用の数学関数

5.9.3.3 三角関数
................

 -- の関数: cmath.acos (z)

     Return the arc cosine of 'z'.  There are two branch cuts: One
     extends right from 1 along the real axis to ∞.  The other extends
     left from -1 along the real axis to -∞.

 -- の関数: cmath.asin (z)

     Return the arc sine of 'z'.  This has the same branch cuts as *note
     acos(): 2a98.

 -- の関数: cmath.atan (z)

     Return the arc tangent of 'z'.  There are two branch cuts: One
     extends from ‘1j’ along the imaginary axis to ‘∞j’.  The other
     extends from ‘-1j’ along the imaginary axis to ‘-∞j’.

 -- の関数: cmath.cos (z)

     Return the cosine of 'z'.

 -- の関数: cmath.sin (z)

     Return the sine of 'z'.

 -- の関数: cmath.tan (z)

     Return the tangent of 'z'.


File: python.info,  Node: 双曲線関数<2>,  Next: 類別関数,  Prev: 三角関数<2>,  Up: cmath --- 複素数用の数学関数

5.9.3.4 双曲線関数
..................

 -- の関数: cmath.acosh (z)

     Return the inverse hyperbolic cosine of 'z'.  There is one branch
     cut, extending left from 1 along the real axis to -∞.

 -- の関数: cmath.asinh (z)

     Return the inverse hyperbolic sine of 'z'.  There are two branch
     cuts: One extends from ‘1j’ along the imaginary axis to ‘∞j’.  The
     other extends from ‘-1j’ along the imaginary axis to ‘-∞j’.

 -- の関数: cmath.atanh (z)

     Return the inverse hyperbolic tangent of 'z'.  There are two branch
     cuts: One extends from ‘1’ along the real axis to ‘∞’.  The other
     extends from ‘-1’ along the real axis to ‘-∞’.

 -- の関数: cmath.cosh (z)

     Return the hyperbolic cosine of 'z'.

 -- の関数: cmath.sinh (z)

     Return the hyperbolic sine of 'z'.

 -- の関数: cmath.tanh (z)

     Return the hyperbolic tangent of 'z'.


File: python.info,  Node: 類別関数,  Next: 定数<3>,  Prev: 双曲線関数<2>,  Up: cmath --- 複素数用の数学関数

5.9.3.5 類別関数
................

 -- の関数: cmath.isfinite (z)

     Return ‘True’ if both the real and imaginary parts of 'z' are
     finite, and ‘False’ otherwise.

     Added in version 3.2.

 -- の関数: cmath.isinf (z)

     Return ‘True’ if either the real or the imaginary part of 'z' is an
     infinity, and ‘False’ otherwise.

 -- の関数: cmath.isnan (z)

     Return ‘True’ if either the real or the imaginary part of 'z' is a
     NaN, and ‘False’ otherwise.

 -- の関数: cmath.isclose (a, b, *, rel_tol=1e-09, abs_tol=0.0)

     値 'a' と 'b' が互いに近い場合 ‘True’ を、そうでない場合は ‘False’
     を返します。

     Whether or not two values are considered close is determined
     according to given absolute and relative tolerances.  If no errors
     occur, the result will be: ‘abs(a-b) <= max(rel_tol * max(abs(a),
     abs(b)), abs_tol)’.

     'rel_tol' is the relative tolerance - it is the maximum allowed
     difference between 'a' and 'b', relative to the larger absolute
     value of 'a' or 'b'.  For example, to set a tolerance of 5%, pass
     ‘rel_tol=0.05’.  The default tolerance is ‘1e-09’, which assures
     that the two values are the same within about 9 decimal digits.
     'rel_tol' must be nonnegative and less than ‘1.0’.

     'abs_tol' is the absolute tolerance; it defaults to ‘0.0’ and it
     must be nonnegative.  When comparing ‘x’ to ‘0.0’, ‘isclose(x, 0)’
     is computed as ‘abs(x) <= rel_tol * abs(x)’, which is ‘False’ for
     any ‘x’ and rel_tol less than ‘1.0’.  So add an appropriate
     positive abs_tol argument to the call.

     IEEE 754 特殊値 ‘NaN’、‘inf’、‘-inf’ は IEEE の規則に従って処理され
     ます。 具体的には、‘NaN’ は自身を含めたあらゆる値に近いとは見なされ
     ません。 ‘inf’ と ‘-inf’ は自身とのみ近いと見なされます。

     Added in version 3.5.

     参考
     ....

     PEP 485(1) - 近似的に等しいことを調べる関数

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0485/


File: python.info,  Node: 定数<3>,  Prev: 類別関数,  Up: cmath --- 複素数用の数学関数

5.9.3.6 定数
............

 -- データ: cmath.pi

     定数 'π' (円周率)で、浮動小数点数です。

 -- データ: cmath.e

     定数 'e' (自然対数の底)で、浮動小数点数です。

 -- データ: cmath.tau

     数学定数 'τ' で、浮動小数点数です。

     Added in version 3.6.

 -- データ: cmath.inf

     浮動小数点数の正の無限大です。‘float('inf')’ と等価です。

     Added in version 3.6.

 -- データ: cmath.infj

     実部がゼロ、虚部が正の無限大の複素数です。‘complex(0.0,
     float('inf'))’ と等価です。

     Added in version 3.6.

 -- データ: cmath.nan

     A floating-point "not a number" (NaN) value.  Equivalent to
     ‘float('nan')’.  See also *note math.nan: 873.

     Added in version 3.6.

 -- データ: cmath.nanj

     実部がゼロ、虚部が NaN の複素数です。‘complex(0.0, float('nan'))’ と
     等価です。

     Added in version 3.6.

Note that the selection of functions is similar, but not identical, to
that in module *note math: 92.  The reason for having two modules is
that some users aren't interested in complex numbers, and perhaps don't
even know what they are.  They would rather have ‘math.sqrt(-1)’ raise
an exception than return a complex number.  Also note that the functions
defined in ‘cmath’ always return a complex number, even if the answer
can be expressed as a real number (in which case the complex number has
an imaginary part of zero).

分枝切断 (branch cut) に関する注釈: 分枝切断を持つ曲線上では、与えられた
関数は連続ではなくなります。これらは多くの複素関数における必然的な特性で
す。複素関数を計算する必要がある場合、これらの分枝に関して理解しているも
のと仮定しています。悟りに至るために何らかの (到底基礎的とはいえない) 複
素数に関する書をひもといてください。数値計算を目的とした分枝切断の正しい
選択方法についての情報としては、以下がよい参考文献となります:

参考
....

Kahan, W: Branch cuts for complex elementary functions; or, Much ado
about nothings's sign bit.  In Iserles, A., and Powell, M. (eds.), The
state of the art in numerical analysis.  Clarendon Press (1987)
pp165-211.


File: python.info,  Node: decimal --- 10進固定小数点と浮動小数点の演算,  Next: fractions --- 有理数,  Prev: cmath --- 複素数用の数学関数,  Up: 数値と数学モジュール

5.9.4 ‘decimal’ -- 10進固定小数点と浮動小数点の演算
---------------------------------------------------

'ソースコード:' Lib/decimal.py(1)

__________________________________________________________________

The ‘decimal’ module provides support for fast correctly rounded decimal
floating-point arithmetic.  It offers several advantages over the *note
float: 196. datatype:

   * Decimal "is based on a floating-point model(2) which was designed
     with people in mind, and necessarily has a paramount guiding
     principle - computers must provide an arithmetic that works in the
     same way as the arithmetic that people learn at school."  - excerpt
     from the decimal arithmetic specification.

   * 十進数を正確に表現できます。 ‘1.1’ や ‘2.2’ のような数は、二進数の
     浮動小数点型では正しく表現できません。エンドユーザは普通、 二進数に
     おける ‘1.1 + 2.2’ の近似値が ‘3.3000000000000003’ だからといって、
     そのように表示してほしいとは考えないものです。

   * 値の正確さは算術にも及びます。十進の浮動小数点による計算では、 ‘0.1
     + 0.1 + 0.1 - 0.3’ は厳密にゼロに等しくなります。 二進浮動小数点で
     は ‘5.5511151231257827e-017’ になってしまいます。ゼロに近い値とはい
     え、この誤差は数値間の等価性テストの信頼性を阻害します。また、誤差
     が蓄積されることもあります。こうした理由から、数値間の等価性を厳し
     く保たなければならないようなアプリケーションを考えるなら、十進数に
     よる数値表現が望ましいということになります。

   * *note decimal: 3a. モジュールでは、有効桁数の表記が取り入れられてお
     り、例えば ‘1.30 + 1.20’ は ‘2.50’ になります。すなわち、末尾のゼロ
     は有効数字を示すために残されます。こうした仕様は通貨計算を行うアプ
     リケーションでは慣例です。乗算の場合、「教科書的な」アプローチでは
     、乗算の被演算子すべての桁数を使います。例えば、 ‘1.3 * 1.2’ は
     ‘1.56’ になり、 ‘1.30 * 1.20’ は ‘1.5600’ になります。

   * ハードウェアによる 2 進浮動小数点表現と違い、*note decimal: 3a. モ
     ジュールでは計算精度をユーザが変更できます(デフォルトでは 28 桁です
     )。この桁数はほとんどの問題解決に十分な大きさです:

          >>> from decimal import *
          >>> getcontext().prec = 6
          >>> Decimal(1) / Decimal(7)
          Decimal('0.142857')
          >>> getcontext().prec = 28
          >>> Decimal(1) / Decimal(7)
          Decimal('0.1428571428571428571428571429')

   * 二進と十進の浮動小数点は、いずれも広く公開されている標準仕様のもと
     に実装されています。組み込みの浮動小数点型では、標準仕様で提唱され
     ている機能のほんのささやかな部分を利用できるにすぎませんが、*note
     decimal: 3a. では標準仕様が要求している全ての機能を利用できます。必
     要に応じて、プログラマは値の丸めやシグナル処理を完全に制御できます
     。この中には全ての不正確な操作を例外でブロックして正確な算術を遵守
     させるオプションもあります。

   * decimal モジュールは「偏見なく、正確な丸めなしの十進算術(固定小数点
     算術と呼ばれることもある)と丸めありの浮動小数点数算術」(十進数演算
     仕様より引用)をサポートするようにデザインされました。

このモジュールは、十進数型、算術コンテキスト (context for arithmetic)、
そしてシグナル (signal) という三つの概念を中心に設計されています。

十進数型は変更不能です。これは符号、係数部、そして指数を持ちます。有効桁
数を残すために、仮数部の末尾にあるゼロは切り詰められません。 *note
decimal: 3a. では、 ‘Infinity’, ‘-Infinity’, および ‘NaN’ といった特殊な
値も定義されています。標準仕様では ‘-0’ と ‘+0’ も区別します。

算術コンテキストとは、精度や値丸めの規則、指数部の制限を決めている環境で
す。この環境では、演算結果を表すためのフラグや、演算上発生した特定のシグ
ナルを例外として扱うかどうかを決めるトラップイネーブラも定義しています。
丸め規則には *note ROUND_CEILING: 2ab2, *note ROUND_DOWN: 2ab3, *note
ROUND_FLOOR: 2ab4, *note ROUND_HALF_DOWN: 2ab5, *note ROUND_HALF_EVEN:
2ab6, *note ROUND_HALF_UP: 2ab7, *note ROUND_UP: 2ab8, および *note
ROUND_05UP: 2ab9. があります。

シグナルとは、演算の過程で生じる例外的条件です。個々のシグナルは、アプリ
ケーションそれぞれの要求に従って、無視されたり、単なる情報とみなされたり
、例外として扱われたりします。 *note decimal: 3a. モジュールには、 *note
Clamped: 2aba, *note InvalidOperation: 12bc, *note DivisionByZero: 2abb,
*note Inexact: 2abc, *note Rounded: 2abd, *note Subnormal: 2abe, *note
Overflow: 2abf, *note Underflow: 2ac0, および *note FloatOperation:
12af. といったシグナルがあります。

各シグナルには、フラグとトラップイネーブラがあります。演算上何らかのシグ
ナルに遭遇すると、フラグは 1 にセットされます。このとき、もしトラップイ
ネーブラが 1 にセットされていれば、例外を送出します。フラグの値は膠着型
(sticky) なので、演算によるフラグの変化をモニタしたければ、予めフラグを
リセットしておかなければなりません。

参考
....

   * IBM による汎用十進演算仕様、The General Decimal Arithmetic
     Specification(3)。

* Menu:

* Quick-start tutorial::
* Decimal オブジェクト::
* Context オブジェクト::
* 定数: 定数<4>.
* 丸めモード::
* シグナル::
* Floating-point notes::
* スレッドを使った処理::
* レシピ::
* Decimal FAQ::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/decimal.py

   (2) https://speleotrove.com/decimal/damodel.html#refnumber

   (3) https://speleotrove.com/decimal/decarith.html


File: python.info,  Node: Quick-start tutorial,  Next: Decimal オブジェクト,  Up: decimal --- 10進固定小数点と浮動小数点の演算

5.9.4.1 Quick-start tutorial
............................

普通、 *note decimal: 3a. を使うときには、モジュールをインポートし、現在
の演算コンテキストを *note getcontext(): 1937. で調べ、必要なら、精度、
丸め、有効なトラップを設定します:

     >>> from decimal import *
     >>> getcontext()
     Context(prec=28, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999,
             capitals=1, clamp=0, flags=[], traps=[Overflow, DivisionByZero,
             InvalidOperation])

     >>> getcontext().prec = 7       # Set a new precision

*note Decimal: 1fe. インスタンスは、整数、文字列、浮動小数点数、またはタ
プルから構成できます。整数や浮動小数点数からの構成は、整数や浮動小数点数
の値を正確に変換します。 *note Decimal: 1fe. は "非数 (Not a Number)" を
表す ‘NaN’ や正負の ‘Infinity’ (無限大)、 ‘-0’ といった特殊な値も表現で
きます:

     >>> getcontext().prec = 28
     >>> Decimal(10)
     Decimal('10')
     >>> Decimal('3.14')
     Decimal('3.14')
     >>> Decimal(3.14)
     Decimal('3.140000000000000124344978758017532527446746826171875')
     >>> Decimal((0, (3, 1, 4), -2))
     Decimal('3.14')
     >>> Decimal(str(2.0 ** 0.5))
     Decimal('1.4142135623730951')
     >>> Decimal(2) ** Decimal('0.5')
     Decimal('1.414213562373095048801688724')
     >>> Decimal('NaN')
     Decimal('NaN')
     >>> Decimal('-Infinity')
     Decimal('-Infinity')

*note FloatOperation: 12af. シグナルがトラップされる場合、コンストラクタ
や順序比較において誤って decimal と float が混ざると、例外が送出されます
:

     >>> c = getcontext()
     >>> c.traps[FloatOperation] = True
     >>> Decimal(3.14)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     decimal.FloatOperation: [<class 'decimal.FloatOperation'>]
     >>> Decimal('3.5') < 3.7
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     decimal.FloatOperation: [<class 'decimal.FloatOperation'>]
     >>> Decimal('3.5') == 3.5
     True

Added in version 3.3.

新たな *note Decimal: 1fe. の有効桁数は入力の桁数だけで決まります。演算
コンテキストにおける精度や値丸めの設定が影響するのは算術演算の間だけです
。

     >>> getcontext().prec = 6
     >>> Decimal('3.0')
     Decimal('3.0')
     >>> Decimal('3.1415926535')
     Decimal('3.1415926535')
     >>> Decimal('3.1415926535') + Decimal('2.7182818285')
     Decimal('5.85987')
     >>> getcontext().rounding = ROUND_UP
     >>> Decimal('3.1415926535') + Decimal('2.7182818285')
     Decimal('5.85988')

C バージョンの内部制限を超えた場合、decimal の構成は *note
InvalidOperation: 12bc. を送出します:

     >>> Decimal("1e9999999999999999999")
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>]

バージョン 3.3 で変更.

Decimals interact well with much of the rest of Python.  Here is a small
decimal floating-point flying circus:

     >>> data = list(map(Decimal, '1.34 1.87 3.45 2.35 1.00 0.03 9.25'.split()))
     >>> max(data)
     Decimal('9.25')
     >>> min(data)
     Decimal('0.03')
     >>> sorted(data)
     [Decimal('0.03'), Decimal('1.00'), Decimal('1.34'), Decimal('1.87'),
      Decimal('2.35'), Decimal('3.45'), Decimal('9.25')]
     >>> sum(data)
     Decimal('19.29')
     >>> a,b,c = data[:3]
     >>> str(a)
     '1.34'
     >>> float(a)
     1.34
     >>> round(a, 1)
     Decimal('1.3')
     >>> int(a)
     1
     >>> a * 5
     Decimal('6.70')
     >>> a * b
     Decimal('2.5058')
     >>> c % a
     Decimal('0.77')

Decimals can be formatted (with *note format(): 199. built-in or *note
f-strings: 19a.) in fixed-point or scientific notation, using the same
formatting syntax (see *note 書式指定ミニ言語仕様: 4f9.) as builtin
*note float: 196. type:

     >>> format(Decimal('2.675'), "f")
     '2.675'
     >>> format(Decimal('2.675'), ".2f")
     '2.68'
     >>> f"{Decimal('2.675'):.2f}"
     '2.68'
     >>> format(Decimal('2.675'), ".2e")
     '2.68e+0'
     >>> with localcontext() as ctx:
     ...     ctx.rounding = ROUND_DOWN
     ...     print(format(Decimal('2.675'), ".2f"))
     ...
     2.67

いくつかの数学的関数も Decimal には用意されています:

     >>> getcontext().prec = 28
     >>> Decimal(2).sqrt()
     Decimal('1.414213562373095048801688724')
     >>> Decimal(1).exp()
     Decimal('2.718281828459045235360287471')
     >>> Decimal('10').ln()
     Decimal('2.302585092994045684017991455')
     >>> Decimal('10').log10()
     Decimal('1')

*note quantize(): 12c4. メソッドは位を固定して数値を丸めます。このメソッ
ドは、結果を固定の桁数で丸めることがよくある、金融アプリケーションで便利
です:

     >>> Decimal('7.325').quantize(Decimal('.01'), rounding=ROUND_DOWN)
     Decimal('7.32')
     >>> Decimal('7.325').quantize(Decimal('1.'), rounding=ROUND_UP)
     Decimal('8')

前述のように、 *note getcontext(): 1937. 関数を使うと現在の演算コンテキ
ストにアクセスでき、設定を変更できます。ほとんどのアプリケーションはこの
アプローチで十分です。

For more advanced work, it may be useful to create alternate contexts
using the *note Context(): 12c3. constructor.  To make an alternate
active, use the *note setcontext(): 2ac2. function.

In accordance with the standard, the ‘decimal’ module provides two ready
to use standard contexts, *note BasicContext: 12b8. and *note
ExtendedContext: 12b9.  The former is especially useful for debugging
because many of the traps are enabled:

     >>> myothercontext = Context(prec=60, rounding=ROUND_HALF_DOWN)
     >>> setcontext(myothercontext)
     >>> Decimal(1) / Decimal(7)
     Decimal('0.142857142857142857142857142857142857142857142857142857142857')

     >>> ExtendedContext
     Context(prec=9, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999,
             capitals=1, clamp=0, flags=[], traps=[])
     >>> setcontext(ExtendedContext)
     >>> Decimal(1) / Decimal(7)
     Decimal('0.142857143')
     >>> Decimal(42) / Decimal(0)
     Decimal('Infinity')

     >>> setcontext(BasicContext)
     >>> Decimal(42) / Decimal(0)
     Traceback (most recent call last):
       File "<pyshell#143>", line 1, in -toplevel-
         Decimal(42) / Decimal(0)
     DivisionByZero: x / 0

演算コンテキストには、演算中に遭遇した例外的状況をモニタするためのシグナ
ルフラグがあります。フラグが一度セットされると、明示的にクリアするまで残
り続けます。そのため、フラグのモニタを行いたいような演算の前には *note
clear_flags(): 2ac3. メソッドでフラグをクリアしておくのがベストです。

     >>> setcontext(ExtendedContext)
     >>> getcontext().clear_flags()
     >>> Decimal(355) / Decimal(113)
     Decimal('3.14159292')
     >>> getcontext()
     Context(prec=9, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999,
             capitals=1, clamp=0, flags=[Inexact, Rounded], traps=[])

'flags' エントリから、pi の有理数による近似値が丸められた (コンテキスト
内で決められた精度を超えた桁数が捨てられた) ことと、計算結果が厳密でない
(無視された桁の値に非ゼロのものがあった) ことがわかります。

コンテキストの *note traps: 12c2. 属性に入っている辞書を使うと、個々のト
ラップをセットできます:

     >>> setcontext(ExtendedContext)
     >>> Decimal(1) / Decimal(0)
     Decimal('Infinity')
     >>> getcontext().traps[DivisionByZero] = 1
     >>> Decimal(1) / Decimal(0)
     Traceback (most recent call last):
       File "<pyshell#112>", line 1, in -toplevel-
         Decimal(1) / Decimal(0)
     DivisionByZero: x / 0

ほとんどのプログラムでは、開始時に一度だけ現在の演算コンテキストを修正し
ます。また、多くのアプリケーションでは、データから *note Decimal: 1fe. へ
の変換はループ内で一度だけキャストして行います。コンテキストを設定し、
*note Decimal: 1fe. オブジェクトを生成できたら、ほとんどのプログラムは他
の Python 数値型と全く変わらないかのように *note Decimal: 1fe. を操作で
きます。


File: python.info,  Node: Decimal オブジェクト,  Next: Context オブジェクト,  Prev: Quick-start tutorial,  Up: decimal --- 10進固定小数点と浮動小数点の演算

5.9.4.2 Decimal オブジェクト
............................

 -- クラス: decimal.Decimal (value='0', context=None)

     'value' に基づいて新たな *note Decimal: 1fe. オブジェクトを構築しま
     す。

     'value' は整数、文字列、タプル、 *note float: 196. および他の *note
     Decimal: 1fe. オブジェクトにできます。 'value' を指定しない場合、
     ‘Decimal('0')’ を返します。 'value' が文字列の場合、先頭と末尾の空
     白および全てのアンダースコアを取り除いた後には以下の 10進数文字列の
     文法に従わなければなりません:

          sign           ::=  '+' | '-'
          digit          ::=  '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
          indicator      ::=  'e' | 'E'
          digits         ::=  digit [digit]...
          decimal-part   ::=  digits '.' [digits] | ['.'] digits
          exponent-part  ::=  indicator [sign] digits
          infinity       ::=  'Infinity' | 'Inf'
          nan            ::=  'NaN' [digits] | 'sNaN' [digits]
          numeric-value  ::=  decimal-part [exponent-part] | infinity
          numeric-string ::=  [sign] numeric-value | [sign] nan

     Other Unicode decimal digits are also permitted where ‘digit’
     appears above.  These include decimal digits from various other
     alphabets (for example, Arabic-Indic and Devanāgarī digits) along
     with the fullwidth digits ‘'\uff10'’ through ‘'\uff19'’.  Case is
     not significant, so, for example, ‘inf’, ‘Inf’, ‘INFINITY’, and
     ‘iNfINity’ are all acceptable spellings for positive infinity.

     'value' を *note tuple: 614. にする場合、タプルは三つの要素を持ち、
     それぞれ符号 (正なら ‘0’ 、負なら ‘1’)、仮数部を表す数字の *note
     tuple: 614. 、そして指数を表す整数でなければなりません。例えば、
     ‘Decimal((0, (1, 4, 1, 4), -3))’ は ‘Decimal('1.414')’ を返します。

     If 'value' is a *note float: 196, the binary floating-point value
     is losslessly converted to its exact decimal equivalent.  This
     conversion can often require 53 or more digits of precision.  For
     example, ‘Decimal(float('1.1'))’ converts to
     ‘Decimal('1.100000000000000088817841970012523233890533447265625')’.

     'context' の精度 (precision) は、記憶される桁数には影響しません。桁
     数は 'value' に指定した桁数だけから決定されます。例えば、演算コンテ
     キストに指定された精度が 3 桁しかなくても、‘Decimal('3.00000')’ は
     5 つのゼロを全て記憶します。

     'context' 引数の目的は、 'value' が正しくない形式の文字列であった場
     合に行う処理を決めることにあります; 演算コンテキストが *note
     InvalidOperation: 12bc. をトラップするようになっていれば、例外を送
     出します。それ以外の場合には、コンストラクタは値が ‘NaN’ の *note
     Decimal: 1fe. を返します。

     一度生成すると、 *note Decimal: 1fe. オブジェクトは変更不能
     (immutable) になります。

     バージョン 3.2 で変更: コンストラクタに対する引数に *note float:
     196. インスタンスも許されるようになりました。

     バージョン 3.3 で変更: *note FloatOperation: 12af. トラップがセット
     されていた場合 *note float: 196. 引数は例外を送出します。デフォルト
     でトラップはオフです。

     バージョン 3.6 で変更: コード中の整数リテラルや浮動小数点リテラルと
     同様に、アンダースコアを用いて桁をグルーピングできます。

     Decimal floating-point objects share many properties with the other
     built-in numeric types such as *note float: 196. and *note int:
     19b.  All of the usual math operations and special methods apply.
     Likewise, decimal objects can be copied, pickled, printed, used as
     dictionary keys, used as set elements, compared, sorted, and
     coerced to another type (such as *note float: 196. or *note int:
     19b.).

     十進オブジェクトの算術演算と整数や浮動小数点数の算術演算には少々違
     いがあります。十進オブジェクトに対して剰余演算を適用すると、計算結
     果の符号は除数の符号ではなく '被除数' の符号と一致します:

          >>> (-7) % 4
          1
          >>> Decimal(-7) % Decimal(4)
          Decimal('-3')

     整数除算演算子 ‘//’ も同様に、実際の商の切り捨てではなく (0に近付く
     ように丸めた) 整数部分を返します。そのため通常の恒等式 ‘x == (x //
     y) * y + x % y’ が維持されます:

          >>> -7 // 4
          -2
          >>> Decimal(-7) // Decimal(4)
          Decimal('-1')

     演算子 ‘%’ と演算子 ‘//’ は (それぞれ) 仕様にあるような ‘剰余’ 操作
     と ‘整数除算’ 操作を実装しています。

     Decimal オブジェクトは一般に、算術演算で浮動小数点数や *note
     fractions.Fraction: 213. オブジェクトと組み合わせることができません
     。例えば、 *note Decimal: 1fe. に *note float: 196. を足そうとする
     と、 *note TypeError: 198. が送出されます。ただし、Python の比較演
     算子を使って *note Decimal: 1fe. インスタンス ‘x’ と別の数 ‘y’ を比
     較することができます。これにより、異なる型の数間の等価比較の際に、
     紛らわしい結果を避けます。

     バージョン 3.2 で変更: *note Decimal: 1fe. インスタンスと他の数値型
     が混在する比較が完全にサポートされるようになりました。

     In addition to the standard numeric properties, decimal
     floating-point objects also have a number of specialized methods:

      -- メソッド: adjusted ()

          仮数の先頭の一桁だけが残るように右側の数字を追い出す桁シフトを
          行い、その結果の指数部を返します:
          ‘Decimal('321e+5').adjusted()’ は 7 を返します。最上桁の小数点
          からの相対位置を調べる際に使います。

      -- メソッド: as_integer_ratio ()

          与えられた *note Decimal: 1fe. インスタンスを、既約分数で分母
          が正数の分数として表現した整数のペア ‘(n, d)’ を返します。

               >>> Decimal('-3.14').as_integer_ratio()
               (-157, 50)

          変換は正確に行われます。無限大に対してはOverflowErrorを、NaNに
          対してはValueError を送出します。

     Added in version 3.6.

      -- メソッド: as_tuple ()

          数値を表現するための *note 名前付きタプル: 85e.:
          ‘DecimalTuple(sign, digittuple, exponent)’ を返します。

      -- メソッド: canonical ()

          引数の標準的(canonical)エンコーディングを返します。現在のとこ
          ろ、 *note Decimal: 1fe. インスタンスのエンコーディングは常に
          標準的なので、この操作は引数に手を加えずに返します。

      -- メソッド: compare (other, context=None)

          二つの Decimal インスタンスの値を比較します。 *note compare():
          2ac9. は Decimal インスタンスを返し、被演算子のどちらかが NaN
          ならば結果は NaN です:

               a or b is a NaN  ==> Decimal('NaN')
               a < b            ==> Decimal('-1')
               a == b           ==> Decimal('0')
               a > b            ==> Decimal('1')

      -- メソッド: compare_signal (other, context=None)

          この演算は *note compare(): 2ac9. とほとんど同じですが、全ての
          NaN がシグナルを送るところが異なります。すなわち、どちらの比較
          対象も発信 (signaling) NaN でないならば無言 (quiet) NaN である
          比較対象があたかも発信 NaN であるかのように扱われます。

      -- メソッド: compare_total (other, context=None)

          二つの対象を数値によらず抽象表現によって比較します。 *note
          compare(): 2ac9. に似ていますが、結果は *note Decimal: 1fe. に
          全順序を与えます。この順序づけによると、数値的に等しくても異な
          った表現を持つ二つの *note Decimal: 1fe. インスタンスの比較は
          等しくなりません:

               >>> Decimal('12.0').compare_total(Decimal('12'))
               Decimal('-1')

          無言 NaN と発信 NaN もこの全順序に位置付けられます。この関数の
          結果は、もし比較対象が同じ表現を持つならば ‘Decimal('0')’ であ
          り、一つめの比較対象が二つめより下位にあれば ‘Decimal('-1')’、
          上位にあれば ‘Decimal('1')’ です。全順序の詳細については仕様を
          参照してください。

          この演算はコンテキストに影響されず、静かです。すなわち、フラグ
          は変更されず、丸めは行われません。例外として、2番目の比較対象
          の厳密な変換ができない場合、C バージョンのライブラリでは
          InvalidOperation 例外を送出するかもしれません。

      -- メソッド: compare_total_mag (other, context=None)

          二つの対象を *note compare_total(): 2acb. のように数値によらず
          抽象表現によって比較しますが、両者の符号を無視します。
          ‘x.compare_total_mag(y)’ は
          ‘x.copy_abs().compare_total(y.copy_abs())’ と等価です。

          この演算はコンテキストに影響されず、静かです。すなわち、フラグ
          は変更されず、丸めは行われません。例外として、2番目の比較対象
          の厳密な変換ができない場合、C バージョンのライブラリでは
          InvalidOperation 例外を送出するかもしれません。

      -- メソッド: conjugate ()

          self を返すだけです。このメソッドは十進演算仕様に適合するため
          だけのものです。

      -- メソッド: copy_abs ()

          引数の絶対値を返します。この演算はコンテキストに影響されず、静
          かです。すなわち、フラグは変更されず、丸めは行われません。

      -- メソッド: copy_negate ()

          引数の符号を変えて返します。この演算はコンテキストに影響されず
          、静かです。すなわち、フラグは変更されず、丸めは行われません。

      -- メソッド: copy_sign (other, context=None)

          最初の演算対象のコピーに二つめと同じ符号を付けて返します。たと
          えば:

               >>> Decimal('2.3').copy_sign(Decimal('-1.5'))
               Decimal('-2.3')

          この演算はコンテキストに影響されず、静かです。すなわち、フラグ
          は変更されず、丸めは行われません。例外として、2番目の比較対象
          の厳密な変換ができない場合、C バージョンのライブラリでは
          InvalidOperation 例外を送出するかもしれません。

      -- メソッド: exp (context=None)

          与えられた数での(自然)指数関数 ‘e**x’ の値を返します。結果は
          *note ROUND_HALF_EVEN: 2ab6. 丸めモードで正しく丸められます。

               >>> Decimal(1).exp()
               Decimal('2.718281828459045235360287471')
               >>> Decimal(321).exp()
               Decimal('2.561702493119680037517373933E+139')

      -- メソッド: classmethod from_float (f, /)

          Alternative constructor that only accepts instances of *note
          float: 196. or *note int: 19b.

          なお、‘Decimal.from_float(0.1)’ は ‘Decimal('0.1')’ と同じでは
          ありません。0.1 は二進浮動小数点数で正確に表せないので、その値
          は表現できる最も近い値、‘0x1.999999999999ap-4’ として記憶され
          ます。浮動小数点数での等価な値は
          ‘0.1000000000000000055511151231257827021181583404541015625’ で
          す。

               注釈: Python 3.2 以降では、 *note Decimal: 1fe. インスタ
               ンスは *note float: 196. から直接構成できるようになりまし
               た。

               >>> Decimal.from_float(0.1)
               Decimal('0.1000000000000000055511151231257827021181583404541015625')
               >>> Decimal.from_float(float('nan'))
               Decimal('NaN')
               >>> Decimal.from_float(float('inf'))
               Decimal('Infinity')
               >>> Decimal.from_float(float('-inf'))
               Decimal('-Infinity')

          Added in version 3.1.

      -- メソッド: classmethod from_number (number, /)

          Alternative constructor that only accepts instances of *note
          float: 196, *note int: 19b. or *note Decimal: 1fe, but not
          strings or tuples.

               >>> Decimal.from_number(314)
               Decimal('314')
               >>> Decimal.from_number(0.1)
               Decimal('0.1000000000000000055511151231257827021181583404541015625')
               >>> Decimal.from_number(Decimal('3.14'))
               Decimal('3.14')

          Added in version 3.14.

      -- メソッド: fma (other, third, context=None)

          融合積和(fused multiply-add)です。self*other+third を途中結果
          の積 self*other で丸めを行わずに計算して返します。

               >>> Decimal(2).fma(3, 5)
               Decimal('11')

      -- メソッド: is_canonical ()

          引数が標準的(canonical)ならば *note True: e07. を返し、そうで
          なければ *note False: d2b. を返します。現在のところ、 *note
          Decimal: 1fe. のインスタンスは常に標準的なのでこのメソッドの結
          果はいつでも *note True: e07. です。

      -- メソッド: is_finite ()

          引数が有限の数値ならば *note True: e07. を、無限大か NaN なら
          ば *note False: d2b. を返します。

      -- メソッド: is_infinite ()

          引数が正または負の無限大ならば *note True: e07. を、そうでなけ
          れば *note False: d2b. を返します。

      -- メソッド: is_nan ()

          引数が (無言か発信かは問わず) NaN であれば *note True: e07. を
          、そうでなければ *note False: d2b. を返します。

      -- メソッド: is_normal (context=None)

          引数が '正規(normal)' の有限数値ならば *note True: e07. を返し
          ます。引数がゼロ、非正規(subnormal)、無限大または NaN であれば
          *note False: d2b. を返します。

      -- メソッド: is_qnan ()

          引数が無言 NaN であれば *note True: e07. を、そうでなければ
          *note False: d2b. を返します。

      -- メソッド: is_signed ()

          引数に負の符号がついていれば *note True: e07. を、そうでなけれ
          ば *note False: d2b. を返します。注意すべきはゼロや NaN なども
          符号を持ち得ることです。

      -- メソッド: is_snan ()

          引数が発信 NaN であれば *note True: e07. を、そうでなければ
          *note False: d2b. を返します。

      -- メソッド: is_subnormal (context=None)

          引数が非正規数(subnormal)であれば *note True: e07. を、そうで
          なければ *note False: d2b. を返します。

      -- メソッド: is_zero ()

          引数が(正または負の)ゼロであれば *note True: e07. を、そうでな
          ければ *note False: d2b. を返します。

      -- メソッド: ln (context=None)

          演算対象の自然対数(底 e の対数)を返します。結果は *note
          ROUND_HALF_EVEN: 2ab6. 丸めモードで正しく丸められます。

      -- メソッド: log10 (context=None)

          演算対象の底 10 の対数を返します。結果は *note
          ROUND_HALF_EVEN: 2ab6. 丸めモードで正しく丸められます。

      -- メソッド: logb (context=None)

          非零の数値については、 *note Decimal: 1fe. インスタンスとして
          調整された指数を返します。演算対象がゼロだった場合、
          ‘Decimal('-Infinity')’ が返され *note DivisionByZero: 2abb. フ
          ラグが送出されます。演算対象が無限大だった場合、
          ‘Decimal('Infinity')’ が返されます。

      -- メソッド: logical_and (other, context=None)

          *note logical_and(): 2ade. は二つの '論理引数' (*note
          論理引数: 2adf. 参照)を取る論理演算です。結果は二つの引数の数
          字ごとの ‘and’ です。

      -- メソッド: logical_invert (context=None)

          *note logical_invert(): 2ae0. は論理演算です。結果は引数の数字
          ごとの反転です。

      -- メソッド: logical_or (other, context=None)

          *note logical_or(): 2ae1. は二つの '論理引数' (*note 論理引数:
          2adf. 参照)を取る論理演算です。結果は二つの引数の数字ごとの
          ‘or’ です。

      -- メソッド: logical_xor (other, context=None)

          *note logical_xor(): 2ae2. は二つの '論理引数' (*note
          論理引数: 2adf. 参照)を取る論理演算です。結果は二つの引数の数
          字ごとの排他的論理和です。

      -- メソッド: max (other, context=None)

          ‘max(self, other)’ と同じですが、値を返す前に現在のコンテキス
          トに即した丸め規則を適用します。また、 ‘NaN’ に対して、(コンテ
          キストの設定と、発信か無言どちらのタイプであるかに応じて) シグ
          ナルを発行するか無視します。

      -- メソッド: max_mag (other, context=None)

          *note max(): 2ae3. メソッドに似ていますが、比較は絶対値で行わ
          れます。

      -- メソッド: min (other, context=None)

          ‘min(self, other)’ と同じですが、値を返す前に現在のコンテキス
          トに即した丸め規則を適用します。また、 ‘NaN’ に対して、(コンテ
          キストの設定と、発信か無言どちらのタイプであるかに応じて) シグ
          ナルを発行するか無視します。

      -- メソッド: min_mag (other, context=None)

          *note min(): 2ae5. メソッドに似ていますが、比較は絶対値で行わ
          れます。

      -- メソッド: next_minus (context=None)

          与えられたコンテキスト(またはコンテキストが渡されなければ現ス
          レッドのコンテキスト)において表現可能な、操作対象より小さい最
          大の数を返します。

      -- メソッド: next_plus (context=None)

          与えられたコンテキスト(またはコンテキストが渡されなければ現ス
          レッドのコンテキスト)において表現可能な、操作対象より大きい最
          小の数を返します。

      -- メソッド: next_toward (other, context=None)

          二つの比較対象が等しくなければ、一つめの対象に最も近く二つめの
          対象へ近付く方向の数を返します。もし両者が数値的に等しければ、
          二つめの対象の符号を採った一つめの対象のコピーを返します。

      -- メソッド: normalize (context=None)

          Used for producing canonical values of an equivalence class
          within either the current context or the specified context.

          This has the same semantics as the unary plus operation,
          except that if the final result is finite it is reduced to its
          simplest form, with all trailing zeros removed and its sign
          preserved.  That is, while the coefficient is non-zero and a
          multiple of ten the coefficient is divided by ten and the
          exponent is incremented by 1.  Otherwise (the coefficient is
          zero) the exponent is set to 0.  In all cases the sign is
          unchanged.

          For example, ‘Decimal('32.100')’ and ‘Decimal('0.321000e+2')’
          both normalize to the equivalent value ‘Decimal('32.1')’.

          Note that rounding is applied 'before' reducing to simplest
          form.

          In the latest versions of the specification, this operation is
          also known as ‘reduce’.

      -- メソッド: number_class (context=None)

          操作対象の 'クラス' を表す文字列を返します。返されるのは以下の
          10種類のいずれかです。

             * ‘"-Infinity"’, 負の無限大であることを示します。

             * ‘"-Normal"’, 負の通常数であることを示します。

             * ‘"-Subnormal"’, 負の非正規数であることを示します。

             * ‘"-Zero"’, 負のゼロであることを示します。

             * ‘"+Zero"’, 正のゼロであることを示します。

             * ‘"+Subnormal"’, 正の非正規数であることを示します。

             * ‘"+Normal"’, 正の通常数であることを示します。

             * ‘"+Infinity"’, 正の無限大であることを示します。

             * ‘"NaN"’, 無言 (quiet) NaN (Not a Number) であることを示し
               ます。

             * ‘"sNaN"’, 発信(signaling) NaN であることを示します。

      -- メソッド: quantize (exp, rounding=None, context=None)

          二つ目の操作対象と同じ指数を持つように丸めを行った、一つめの操
          作対象と等しい値を返します。

               >>> Decimal('1.41421356').quantize(Decimal('1.000'))
               Decimal('1.414')

          他の操作と違い、打ち切り(quantize)操作後の係数の長さが精度を越
          えた場合には、 *note InvalidOperation: 12bc. がシグナルされま
          す。これによりエラー条件がない限り打ち切られた指数が常に右側の
          引数と同じになることが保証されます。

          同様に、他の操作と違い、quantize は Underflow を、たとえ結果が
          非正規になったり不正確になったとしても、シグナルしません。

          二つ目の演算対象の指数が一つ目のそれよりも大きければ丸めが必要
          かもしれません。この場合、丸めモードは以下のように決められます
          。‘rounding’ 引数が与えられていればそれが使われます。そうでな
          ければ ‘context’ 引数で決まります。どちらの引数も渡されなけれ
          ば現在のスレッドのコンテキストの丸めモードが使われます。

          処理結果の指数が *note Emax: 12ba. よりも大きい場合や *note
          Etiny(): 2aec. よりも小さい場合にエラーが返されます。

      -- メソッド: radix ()

          ‘Decimal(10)’ つまり *note Decimal: 1fe. クラスがその全ての算
          術を実行する基数を返します。仕様との互換性のために取り入れられ
          ています。

      -- メソッド: remainder_near (other, context=None)

          'self' を 'other' で割った剰余を返します。これは ‘self %
          other’ とは違って、剰余の絶対値を小さくするように符号が選ばれ
          ます。より詳しく言うと、‘n’ を ‘self / other’ の正確な値に最も
          近い整数としたときの ‘self - n * other’ が返り値になります。最
          も近い整数が2つある場合には偶数のものが選ばれます。

          結果が0になる場合の符号は 'self' の符号と同じになります。

               >>> Decimal(18).remainder_near(Decimal(10))
               Decimal('-2')
               >>> Decimal(25).remainder_near(Decimal(10))
               Decimal('5')
               >>> Decimal(35).remainder_near(Decimal(10))
               Decimal('-5')

      -- メソッド: rotate (other, context=None)

          一つ目の演算対象の数字を二つ目で指定された量だけ巡回(rotate)し
          た結果を返します。二つめの演算対象は -precision から precision
          までの範囲の整数でなければなりません。この二つ目の演算対象の絶
          対値を何桁ずらすかを決めます。そしてもし正の数ならば巡回の方向
          は左に、そうでなければ右になります。一つ目の演算対象の仮数部は
          必要ならば精度いっぱいまでゼロで埋められます。符号と指数は変え
          られません。

      -- メソッド: same_quantum (other, context=None)

          'self' と 'other' が同じ指数を持っているか、あるいは双方とも
          ‘NaN’ である場合に真を返します。

          この演算はコンテキストに影響されず、静かです。すなわち、フラグ
          は変更されず、丸めは行われません。例外として、2番目の比較対象
          の厳密な変換ができない場合、C バージョンのライブラリでは
          InvalidOperation 例外を送出するかもしれません。

      -- メソッド: scaleb (other, context=None)

          二つ目の演算対象で調整された指数の一つ目の演算対象を返します。
          同じことですが、一つめの演算対象を ‘10**other’ 倍したものを返
          します。二つ目の演算対象は整数でなければなりません。

      -- メソッド: shift (other, context=None)

          一つ目の演算対象の数字を二つ目で指定された量だけシフトした結果
          を返します。二つ目の演算対象は -precision から precision まで
          の範囲の整数でなければなりません。この二つ目の演算対象の絶対値
          が何桁ずらすかを決めます。そしてもし正の数ならばシフトの方向は
          左に、そうでなければ右になります。一つ目の演算対象の係数は必要
          ならば精度いっぱいまでゼロで埋められます。符号と指数は変えられ
          ません。

      -- メソッド: sqrt (context=None)

          引数の平方根を最大精度で求めます。

      -- メソッド: to_eng_string (context=None)

          文字列に変換します。指数が必要なら工学表記が使われます。

          工学表記法では指数は 3 の倍数になります。これにより、基数の小
          数部には最大で 3 桁までの数字が残されるとともに、末尾に 1 つま
          たは 2 つの 0 の付加が必要とされるかもしれません。

          たとえば、‘Decimal('123E+1')’ は ‘Decimal('1.23E+3')’ に変換さ
          れます。

      -- メソッド: to_integral (rounding=None, context=None)

          *note to_integral_value(): 2af6. メソッドと同じです。
          ‘to_integral’ の名前は古いバージョンとの互換性のために残されて
          います。

      -- メソッド: to_integral_exact (rounding=None, context=None)

          最近傍の整数に値を丸め、丸めが起こった場合には *note Inexact:
          2abc. または *note Rounded: 2abd. のシグナルを適切に出します。
          丸めモードは以下のように決められます。 ‘rounding’ 引数が与えら
          れていればそれが使われます。そうでなければ ‘context’ 引数で決
          まります。どちらの引数も渡されなければ現在のスレッドのコンテキ
          ストの丸めモードが使われます。

      -- メソッド: to_integral_value (rounding=None, context=None)

          *note Inexact: 2abc. や *note Rounded: 2abd. といったシグナル
          を出さずに最近傍の整数に値を丸めます。 'rounding' が指定されて
          いれば適用されます; それ以外の場合、値丸めの方法は 'context' の
          設定か現在のコンテキストの設定になります。

     Decimal numbers can be rounded using the *note round(): 14f2.
     function:

      -- Describe: round(number)

      -- Describe: round(number, ndigits)

          If 'ndigits' is not given or ‘None’, returns the nearest *note
          int: 19b. to 'number', rounding ties to even, and ignoring the
          rounding mode of the *note Decimal: 1fe. context.  Raises
          *note OverflowError: a81. if 'number' is an infinity or *note
          ValueError: 2ec. if it is a (quiet or signaling) NaN.

          If 'ndigits' is an *note int: 19b, the context's rounding mode
          is respected and a *note Decimal: 1fe. representing 'number'
          rounded to the nearest multiple of ‘Decimal('1E-ndigits')’ is
          returned; in this case, ‘round(number, ndigits)’ is equivalent
          to ‘self.quantize(Decimal('1E-ndigits'))’.  Returns
          ‘Decimal('NaN')’ if 'number' is a quiet NaN. Raises *note
          InvalidOperation: 12bc. if 'number' is an infinity, a
          signaling NaN, or if the length of the coefficient after the
          quantize operation would be greater than the current context's
          precision.  In other words, for the non-corner cases:

             * if 'ndigits' is positive, return 'number' rounded to
               'ndigits' decimal places;

             * if 'ndigits' is zero, return 'number' rounded to the
               nearest integer;

             * if 'ndigits' is negative, return 'number' rounded to the
               nearest multiple of ‘10**abs(ndigits)’.

          例えば:

               >>> from decimal import Decimal, getcontext, ROUND_DOWN
               >>> getcontext().rounding = ROUND_DOWN
               >>> round(Decimal('3.75'))     # context rounding ignored
               4
               >>> round(Decimal('3.5'))      # round-ties-to-even
               4
               >>> round(Decimal('3.75'), 0)  # uses the context rounding
               Decimal('3')
               >>> round(Decimal('3.75'), 1)
               Decimal('3.7')
               >>> round(Decimal('3.75'), -1)
               Decimal('0E+1')

* Menu:

* 論理引数::


File: python.info,  Node: 論理引数,  Up: Decimal オブジェクト

5.9.4.3 論理引数
................

*note logical_and(): 2ade, *note logical_invert(): 2ae0, *note
logical_or(): 2ae1, および *note logical_xor(): 2ae2. メソッドはその引数
が '論理引数' であると想定しています。 '論理引数' とは *note Decimal:
1fe. インスタンスで指数と符号は共にゼロであり、各桁の数字が ‘0’ か ‘1’ で
あるものです。


File: python.info,  Node: Context オブジェクト,  Next: 定数<4>,  Prev: Decimal オブジェクト,  Up: decimal --- 10進固定小数点と浮動小数点の演算

5.9.4.4 Context オブジェクト
............................

コンテキスト (context) とは、算術演算における環境設定です。コンテキスト
は計算精度を決定し、値丸めの方法を設定し、シグナルのどれが例外になるかを
決め、指数の範囲を制限しています。

多重スレッドで処理を行う場合には各スレッドごとに現在のコンテキストがあり
、 *note getcontext(): 1937. や *note setcontext(): 2ac2. といった関数で
アクセスしたり設定変更できます:

 -- の関数: decimal.getcontext ()

     アクティブなスレッドの現在のコンテキストを返します。

 -- の関数: decimal.setcontext (c, /)

     アクティブなスレッドのコンテキストを 'c' に設定します。

*note with: 186. 文と *note localcontext(): 159e. 関数を使って実行するコ
ンテキストを一時的に変更することもできます。

 -- の関数: decimal.localcontext (ctx=None, **kwargs)

     with 文の入口でアクティブなスレッドのコンテキストを 'ctx' のコピー
     に設定し、with 文を抜ける時に元のコンテキストに復旧する、コンテキス
     トマネージャを返します。コンテキストが指定されなければ、現在のコン
     テキストのコピーが使われます。'kwargs' 引数は新しいコンテキストの属
     性を設定するのに使われます。

     たとえば、以下のコードでは精度を42桁に設定し、計算を実行し、そして
     元のコンテキストに復帰します:

          from decimal import localcontext

          with localcontext() as ctx:
              ctx.prec = 42   # Perform a high precision calculation
              s = calculate_something()
          s = +s  # Round the final result back to the default precision

     Using keyword arguments, the code would be the following:

          from decimal import localcontext

          with localcontext(prec=42) as ctx:
              s = calculate_something()
          s = +s

     Raises *note TypeError: 198. if 'kwargs' supplies an attribute that
     *note Context: 12c3. doesn't support.  Raises either *note
     TypeError: 198. or *note ValueError: 2ec. if 'kwargs' supplies an
     invalid value for an attribute.

     バージョン 3.11 で変更: *note localcontext(): 159e. now supports
     setting context attributes through the use of keyword arguments.

 -- の関数: decimal.IEEEContext (bits)

     Return a context object initialized to the proper values for one of
     the IEEE interchange formats.  The argument must be a multiple of
     32 and less than *note IEEE_CONTEXT_MAX_BITS: 2afa.

     Added in version 3.14.

新たなコンテキストは、以下で説明する *note Context: 12c3. コンストラクタ
を使って生成できます。その他にも、 *note decimal: 3a. モジュールでは作成
済みのコンテキストを提供しています:

 -- データ: decimal.BasicContext

     汎用十進演算仕様で定義されている標準コンテキストの一つです。精度は
     9 桁に設定されています。丸め規則は *note ROUND_HALF_UP: 2ab7. です
     。すべての演算結果フラグはクリアされています。 *note Inexact: 2abc,
     *note Rounded: 2abd, *note Subnormal: 2abe. を除く全ての演算エラー
     トラップが有効 (例外として扱う) になっています。

     多くのトラップが有効になっているので、デバッグの際に便利なコンテキ
     ストです。

 -- データ: decimal.ExtendedContext

     汎用十進演算仕様で定義されている標準コンテキストの一つです。精度は
     9 桁に設定されています。丸め規則は *note ROUND_HALF_EVEN: 2ab6. で
     す。すべての演算結果フラグはクリアされています。トラップは全て無効
     (演算中に一切例外を送出しない) になっています。

     トラップが無効になっているので、エラーの伴う演算結果を ‘NaN’ や
     ‘Infinity’ にし、例外を送出しないようにしたいアプリケーションに向い
     たコンテキストです。このコンテキストを使うと、他の場合にはプログラ
     ムが停止してしまうような状況があっても実行を完了させられます。

 -- データ: decimal.DefaultContext

     *note Context: 12c3. コンストラクタが新たなコンテキストを作成するさ
     いに雛形にするコンテキストです。このコンテキストのフィールド (精度
     の設定など) を変更すると、 *note Context: 12c3. コンストラクタが生
     成する新たなコンテキストに影響を及ぼします。

     このコンテキストは、主に多重スレッド環境で便利です。スレッドを開始
     する前に何らかのフィールドを変更しておくと、システム全体のデフォル
     ト設定に効果を及ぼすことができます。スレッドを開始した後にフィール
     ドを変更すると、競合条件を抑制するためにスレッドを同期化しなければ
     ならないので、推奨しません。

     単一スレッドの環境では、このコンテキストを使わないよう薦めます。下
     で述べるように明示的にコンテキストを作成してください。

     デフォルトの値は、 *note Context.prec: 2afb.=‘28’, *note
     Context.rounding: 2afc.=*note ROUND_HALF_EVEN: 2ab6. で、トラップ
     *note Overflow: 2abf, *note InvalidOperation: 12bc, および *note
     DivisionByZero: 2abb. が有効になっています。

上に挙げた三つのコンテキストに加え、 *note Context: 12c3. コンストラクタ
を使って新たなコンテキストを生成できます。

 -- クラス: decimal.Context (prec=None, rounding=None, Emin=None,
          Emax=None, capitals=None, clamp=None, flags=None, traps=None)

     新たなコンテキストを生成します。あるフィールドが定義されていないか
     *note None: 885. であれば、 *note DefaultContext: 12b7. からデフォ
     ルト値をコピーします。 'flags' フィールドが設定されていいか *note
     None: 885. の場合には、全てのフラグがクリアされます。

      -- の属性: prec

          An integer in the range [‘1’, *note MAX_PREC: 12b4.] that sets
          the precision for arithmetic operations in the context.

      -- の属性: rounding

          One of the constants listed in the section *note Rounding
          Modes: 2afd.

      -- の属性: traps
      -- の属性: flags

          Lists of any signals to be set.  Generally, new contexts
          should only set traps and leave the flags clear.

      -- の属性: Emin
      -- の属性: Emax

          Integers specifying the outer limits allowable for exponents.
          'Emin' must be in the range [*note MIN_EMIN: 12b6, ‘0’],
          'Emax' in the range [‘0’, *note MAX_EMAX: 12b5.].

      -- の属性: capitals

          Either ‘0’ or ‘1’ (the default).  If set to ‘1’, exponents are
          printed with a capital ‘E’; otherwise, a lowercase ‘e’ is
          used: ‘Decimal('6.02e+23')’.

      -- の属性: clamp

          Either ‘0’ (the default) or ‘1’.  If set to ‘1’, the exponent
          ‘e’ of a *note Decimal: 1fe. instance representable in this
          context is strictly limited to the range ‘Emin - prec + 1 <= e
          <= Emax - prec + 1’.  If 'clamp' is ‘0’ then a weaker
          condition holds: the adjusted exponent of the *note Decimal:
          1fe. instance is at most *note Emax: 12ba.  When 'clamp' is
          ‘1’, a large normal number will, where possible, have its
          exponent reduced and a corresponding number of zeros added to
          its coefficient, in order to fit the exponent constraints;
          this preserves the value of the number but loses information
          about significant trailing zeros.  For example:

               >>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')
               Decimal('1.23000E+999')

          'clamp' の値 ‘1’ は、IEEE 754 で規定された固定幅十進交換形式と
          互換にできます。

     *note Context: 12c3. クラスでは、いくつかの汎用のメソッドの他、現在
     のコンテキストで算術演算を直接行うためのメソッドを数多く定義してい
     ます。加えて、 *note Decimal: 1fe. の各メソッドについて(*note
     adjusted(): 2ac6. および *note as_tuple(): 2ac7. メソッドを例外とし
     て)対応する *note Context: 12c3. のメソッドが存在します。たとえば、
     *note Context: 12c3. インスタンス ‘C’ と *note Decimal: 1fe. インス
     タンス ‘x’ に対して、 ‘C.exp(x)’ は ‘x.exp(context=C)’ と等価です。
     それぞれの *note Context: 12c3. メソッドは、Decimal インスタンスが
     受け付けられるところならどこでも、Python の整数 (*note int: 19b. の
     インスタンス) を受け付けます。

      -- メソッド: clear_flags ()

          フラグを全て ‘0’ にリセットします。

      -- メソッド: clear_traps ()

          トラップを全て ‘0’ にリセットします。

          Added in version 3.3.

      -- メソッド: copy ()

          コンテキストの複製を返します。

      -- メソッド: copy_decimal (num, /)

          Decimal インスタンス num のコピーを返します。

      -- メソッド: create_decimal (num='0', /)

          'self' をコンテキストとする新たな Decimal インスタンスを 'num'
          から生成します。 *note Decimal: 1fe. コンストラクタと違い、数
          値を変換する際にコンテキストの精度、値丸め方法、フラグ、トラッ
          プを適用します。

          定数値はしばしばアプリケーションの要求よりも高い精度を持ってい
          るため、このメソッドが役に立ちます。また、値丸めを即座に行うた
          め、例えば以下のように、入力値に値丸めを行わないために合計値に
          ゼロの加算を追加するだけで結果が変わってしまうといった、現在の
          精度よりも細かい値の影響が紛れ込む問題を防げるという恩恵もあり
          ます。以下の例は、丸められていない入力を使うということは和にゼ
          ロを加えると結果が変わり得るという見本です:

               >>> getcontext().prec = 3
               >>> Decimal('3.4445') + Decimal('1.0023')
               Decimal('4.45')
               >>> Decimal('3.4445') + Decimal(0) + Decimal('1.0023')
               Decimal('4.44')

          このメソッドは IBM 仕様の to-number 演算を実装したものです。引
          数が文字列の場合、前や後ろに余計な空白を付けたり、アンダースコ
          アを含めたりすることは許されません。

      -- メソッド: create_decimal_from_float (f, /)

          浮動小数点数 'f' から新しい Decimal インスタンスを生成しますが
          、 'self' をコンテキストとして丸めます。 *note
          Decimal.from_float(): 141d. クラスメソッドとは違い、変換にコン
          テキストの精度、丸めメソッド、フラグ、そしてトラップが適用され
          ます。

               >>> context = Context(prec=5, rounding=ROUND_DOWN)
               >>> context.create_decimal_from_float(math.pi)
               Decimal('3.1415')
               >>> context = Context(prec=5, traps=[Inexact])
               >>> context.create_decimal_from_float(math.pi)
               Traceback (most recent call last):
                   ...
               decimal.Inexact: None

          Added in version 3.1.

      -- メソッド: Etiny ()

          ‘Emin - prec + 1’ に等しい値を返します。演算結果の劣化が起こる
          桁の最小値です。アンダーフローが起きた場合、指数は *note
          Etiny: 2aec. に設定されます。

      -- メソッド: Etop ()

          ‘Emax - prec + 1’ に等しい値を返します。

     *note Decimal: 1fe. を使った処理を行う場合、通常は *note Decimal:
     1fe. インスタンスを生成して、算術演算を適用するというアプローチをと
     ります。演算はアクティブなスレッドにおける現在のコンテキストの下で
     行われます。もう一つのアプローチは、コンテキストのメソッドを使った
     特定のコンテキスト下での計算です。コンテキストのメソッドは *note
     Decimal: 1fe. クラスのメソッドに似ているので、ここでは簡単な説明に
     とどめます。

      -- メソッド: abs (x, /)

          'x' の絶対値を返します。

      -- メソッド: add (x, y, /)

          'x' と 'y' の和を返します。

      -- メソッド: canonical (x, /)

          同じ Decimal オブジェクト 'x' を返します。

      -- メソッド: compare (x, y, /)

          'x' と 'y' を数値として比較します。

      -- メソッド: compare_signal (x, y, /)

          二つの演算対象の値を数値として比較します。

      -- メソッド: compare_total (x, y, /)

          二つの演算対象を抽象的な表現を使って比較します。

      -- メソッド: compare_total_mag (x, y, /)

          二つの演算対象を抽象的な表現を使い符号を無視して比較します。

      -- メソッド: copy_abs (x, /)

          'x' のコピーの符号を 0 にセットして返します。

      -- メソッド: copy_negate (x, /)

          'x' のコピーの符号を反転して返します。

      -- メソッド: copy_sign (x, y, /)

          'y' から 'x' に符号をコピーします。

      -- メソッド: divide (x, y, /)

          'x' を 'y' で除算した値を返します。

      -- メソッド: divide_int (x, y, /)

          'x' を 'y' で除算した値を整数に切り捨てて返します。

      -- メソッド: divmod (x, y, /)

          二つの数値間の除算を行い、結果の整数部を返します。

      -- メソッド: exp (x, /)

          ‘e ** x’ を返します。

      -- メソッド: fma (x, y, z, /)

          'x' を 'y' 倍したものに 'z' を加えて返します。

      -- メソッド: is_canonical (x, /)

          'x' が標準的(canonical)ならば ‘True’ を返します。そうでなけれ
          ば ‘False’ です。

      -- メソッド: is_finite (x, /)

          'x' が有限ならば ‘True’ を返します。そうでなければ ‘False’ で
          す。

      -- メソッド: is_infinite (x, /)

          'x' が無限ならば ‘True’ を返します。そうでなければ ‘False’ で
          す。

      -- メソッド: is_nan (x, /)

          'x' が qNaN か sNaN であれば ‘True’ を返します。そうでなければ
          ‘False’ です。

      -- メソッド: is_normal (x, /)

          'x' が通常の数ならば ‘True’ を返します。そうでなければ ‘False’
          です。

      -- メソッド: is_qnan (x, /)

          'x' が無言 NaN であれば ‘True’ を返します。そうでなければ
          ‘False’ です。

      -- メソッド: is_signed (x, /)

          'x' が負の数であれば ‘True’ を返します。そうでなければ ‘False’
          です。

      -- メソッド: is_snan (x, /)

          'x' が発信 NaN であれば ‘True’ を返します。そうでなければ
          ‘False’ です。

      -- メソッド: is_subnormal (x, /)

          'x' が非正規数であれば ‘True’ を返します。そうでなければ
          ‘False’ です。

      -- メソッド: is_zero (x, /)

          'x' がゼロであれば ‘True’ を返します。そうでなければ ‘False’ で
          す。

      -- メソッド: ln (x, /)

          'x' の自然対数(底 e の対数)を返します。

      -- メソッド: log10 (x, /)

          'x' の底 10 の対数を返します。

      -- メソッド: logb (x, /)

          演算対象の MSD の大きさの指数部を返します。

      -- メソッド: logical_and (x, y, /)

          それぞれの桁に論理演算 'and' を当てはめます。

      -- メソッド: logical_invert (x, /)

          'x' の全ての桁を反転させます。

      -- メソッド: logical_or (x, y, /)

          それぞれの桁に論理演算 'or' を当てはめます。

      -- メソッド: logical_xor (x, y, /)

          それぞれの桁に論理演算 'xor' を当てはめます。

      -- メソッド: max (x, y, /)

          二つの値を数値として比較し、大きいほうを返します。

      -- メソッド: max_mag (x, y, /)

          値を符号を無視して数値として比較します。

      -- メソッド: min (x, y, /)

          二つの値を数値として比較し、小さいほうを返します。

      -- メソッド: min_mag (x, y, /)

          値を符号を無視して数値として比較します。

      -- メソッド: minus (x, /)

          Python における単項マイナス演算子に対応する演算です。

      -- メソッド: multiply (x, y, /)

          'x' と 'y' の積を返します。

      -- メソッド: next_minus (x, /)

          'x' より小さい最大の表現可能な数を返します。

      -- メソッド: next_plus (x, /)

          'x' より大きい最小の表現可能な数を返します。

      -- メソッド: next_toward (x, y, /)

          'x' に 'y' の方向に向かって最も近い数を返します。

      -- メソッド: normalize (x, /)

          'x' をもっとも単純な形にします。

      -- メソッド: number_class (x, /)

          'x' のクラスを指し示すものを返します。

      -- メソッド: plus (x, /)

          Python における単項のプラス演算子に対応する演算です。コンテキ
          ストにおける精度や値丸めを適用するので、等値 (identity) 演算と
          は '違います'。

      -- メソッド: power (x, y, modulo=None)

          ‘x’ の ‘y’ 乗を計算します。‘modulo’ が指定されていればモジュロ
          を取ります。

          引数が 2 つの場合、 ‘x**y’ を計算します。‘x’ が負の場合、 ‘y’
          は整数でなければなりません。‘y’ が整数、結果が有限、結果が
          'precision' 桁で正確に表現できる、という条件をすべて満たさない
          場合、結果は不正確になります。結果はコンテキストの丸めモードを
          使って丸められます。結果は常に、Python バージョンにおいて正し
          く丸められます。

          ‘Decimal(0) ** Decimal(0)’ results in ‘InvalidOperation’, and
          if ‘InvalidOperation’ is not trapped, then results in
          ‘Decimal('NaN')’.

          バージョン 3.3 で変更: C モジュールは *note power(): 2b2e. を
          適切に丸められた *note exp(): 2b10. および *note ln(): 2b1b. 関
          数によって計算します。結果は well-defined ですが、「ほとんどの
          場合には適切に丸められる」だけです。

          引数が 3 つの場合、 ‘(x**y) % modulo’ を計算します。この 3 引
          数の形式の場合、引数には以下の制限が課せられます。

             - 全ての引数は整数

             - ‘y’ は非負でなければならない

             - ‘x’ と ‘y’ の少なくともどちらかはゼロでない

             - ‘modulo’ は非零で大きくても 'precision' 桁

          ‘Context.power(x, y, modulo)’ で得られる値は ‘(x**y) % modulo’
          を精度無制限で計算して得られるものと同じ値ですが、より効率的に
          計算されます。結果の指数は ‘x’, ‘y’, ‘modulo’ の指数に関係なく
          ゼロです。この計算は常に正確です。

      -- メソッド: quantize (x, y, /)

          'x' に値丸めを適用し、指数を 'y' にした値を返します。

      -- メソッド: radix ()

          単に 10 を返します。何せ十進ですから :)

      -- メソッド: remainder (x, y, /)

          整数除算の剰余を返します。

          剰余がゼロでない場合、符号は割られる数の符号と同じになります。

      -- メソッド: remainder_near (x, y, /)

          ‘x - y * n’ を返します。ここで 'n' は ‘x / y’ の正確な値に一番
          近い整数です (この結果が 0 ならばその符号は 'x' の符号と同じで
          す)。

      -- メソッド: rotate (x, y, /)

          'x' の 'y' 回巡回したコピーを返します。

      -- メソッド: same_quantum (x, y, /)

          2つの演算対象が同じ指数を持っている場合に ‘True’ を返します。

      -- メソッド: scaleb (x, y, /)

          一つめの演算対象の指数部に二つめの値を加えたものを返します。

      -- メソッド: shift (x, y, /)

          'x' を 'y' 回シフトしたコピーを返します。

      -- メソッド: sqrt (x, /)

          'x' の平方根を精度いっぱいまで求めます。

      -- メソッド: subtract (x, y, /)

          'x' と 'y' の間の差を返します。

      -- メソッド: to_eng_string (x, /)

          文字列に変換します。指数が必要なら工学表記が使われます。

          工学表記法では指数は 3 の倍数になります。これにより、基数の小
          数部には最大で 3 桁までの数字が残されるとともに、末尾に 1 つま
          たは 2 つの 0 の付加が必要とされるかもしれません。

      -- メソッド: to_integral_exact (x, /)

          最近傍の整数に値を丸めます。

      -- メソッド: to_sci_string (x, /)

          数値を科学表記で文字列に変換します。


File: python.info,  Node: 定数<4>,  Next: 丸めモード,  Prev: Context オブジェクト,  Up: decimal --- 10進固定小数点と浮動小数点の演算

5.9.4.5 定数
............

この節の定数は C モジュールにのみ意味があります。互換性のために、pure
Python 版も含まれます。

                                      32-bit                    64-bit
                                                                
----------------------------------------------------------------------------------------------------
                                                                
 -- データ: decimal.MAX_PREC          ‘425000000’               ‘999999999999999999’
                                                                
                                                                
 -- データ: decimal.MAX_EMAX          ‘425000000’               ‘999999999999999999’
                                                                
                                                                
 -- データ: decimal.MIN_EMIN          ‘-425000000’              ‘-999999999999999999’
                                                                
                                                                
 -- データ: decimal.MIN_ETINY         ‘-849999999’              ‘-1999999999999999997’
                                                                
                                                                
 -- データ:                           ‘256’                     ‘512’
          decimal.IEEE_CONTEXT_MAX_BITS                         

 -- データ: decimal.HAVE_THREADS

     値は ‘True’ です。現在のPythonは常にスレッドを持っているので、非推
     奨になりました。

     バージョン 3.9 で非推奨.

 -- データ: decimal.HAVE_CONTEXTVAR

     The default value is ‘True’.  If Python is *note configured using
     the -without-decimal-contextvar option: 2168, the C version uses a
     thread-local rather than a coroutine-local context and the value is
     ‘False’.  This is slightly faster in some nested context scenarios.

     Added in version 3.8.3.


File: python.info,  Node: 丸めモード,  Next: シグナル,  Prev: 定数<4>,  Up: decimal --- 10進固定小数点と浮動小数点の演算

5.9.4.6 丸めモード
..................

 -- データ: decimal.ROUND_CEILING

     ‘Infinity’ 方向に丸めます。

 -- データ: decimal.ROUND_DOWN

     ゼロ方向に丸めます。

 -- データ: decimal.ROUND_FLOOR

     ‘-Infinity’ 方向に丸めます。

 -- データ: decimal.ROUND_HALF_DOWN

     近い方に、引き分けはゼロ方向に向けて丸めます。

 -- データ: decimal.ROUND_HALF_EVEN

     近い方に、引き分けは偶数整数方向に向けて丸めます。

 -- データ: decimal.ROUND_HALF_UP

     近い方に、引き分けはゼロから遠い方向に向けて丸めます。

 -- データ: decimal.ROUND_UP

     ゼロから遠い方向に丸めます。

 -- データ: decimal.ROUND_05UP

     ゼロ方向に丸めた後の最後の桁が 0 または 5 ならばゼロから遠い方向に
     、そうでなければゼロ方向に丸めます。


File: python.info,  Node: シグナル,  Next: Floating-point notes,  Prev: 丸めモード,  Up: decimal --- 10進固定小数点と浮動小数点の演算

5.9.4.7 シグナル
................

シグナルは、計算中に生じた様々なエラー条件を表現します。各々のシグナルは
一つのコンテキストフラグと一つのトラップイネーブラに対応しています。

コンテキストフラグは、該当するエラー条件に遭遇するたびにセットされます。
演算後にフラグを調べれば、演算に関する情報 (例えば計算が厳密だったかどう
か) がわかります。フラグを調べたら、次の計算を始める前にフラグを全てクリ
アするようにしてください。

あるコンテキストのトラップイネーブラがあるシグナルに対してセットされてい
る場合、該当するエラー条件が生じると Python の例外を送出します。例えば、
*note DivisionByZero: 2abb. が設定されていると、エラー条件が生じた際に
*note DivisionByZero: 2abb. 例外を送出します。

 -- クラス: decimal.Clamped

     値の表現上の制限に沿わせるために指数部が変更されたことを通知します
     。

     通常、クランプ (clamp) は、指数部がコンテキストにおける指数桁の制限
     値 *note Emin: 12bb. および *note Emax: 12ba. を越えた場合に発生し
     ます。可能な場合には、係数部にゼロを加えた表現に合わせて指数部を減
     らします。

 -- クラス: decimal.DecimalException

     他のシグナルの基底クラスで、 *note ArithmeticError: 26e5. のサブク
     ラスです。

 -- クラス: decimal.DivisionByZero

     有限値をゼロで除算したときのシグナルです。

     除算やモジュロ除算、数を負の値で累乗した場合に起きることがあります
     。このシグナルをトラップしない場合、演算結果は ‘Infinity’ または
     ‘-Infinity’ になり、その符号は演算に使った入力に基づいて決まります
     。

 -- クラス: decimal.Inexact

     値の丸めによって演算結果から厳密さが失われたことを通知します。

     このシグナルは値丸め操作中にゼロでない桁を無視した際に生じます。演
     算結果は値丸め後の値です。シグナルのフラグやトラップは、演算結果の
     厳密さが失われたことを検出するために使えるだけです。

 -- クラス: decimal.InvalidOperation

     無効な演算が実行されたことを通知します。

     ユーザが有意な演算結果にならないような操作を要求したことを示します
     。このシグナルをトラップしない場合、 ‘NaN’ を返します。このシグナル
     の発生原因として考えられるのは、以下のような状況です:

          Infinity - Infinity
          0 * Infinity
          Infinity / Infinity
          x % 0
          Infinity % x
          sqrt(-x) and x > 0
          0 ** 0
          x ** (non-integer)
          x ** Infinity

 -- クラス: decimal.Overflow

     数値オーバフローを示すシグナルです。

     このシグナルは、値丸めを行った後の指数部が *note Context.Emax:
     12ba. より大きいことを示します。シグナルをトラップしない場合、演算
     結果は値丸めのモードにより、表現可能な最大の数値になるように内側へ
     引き込んで丸めを行った値か、 ‘Infinity’ になるように外側に丸めた値
     のいずれかになります。いずれの場合も、 *note Inexact: 2abc. および
     *note Rounded: 2abd. が同時にシグナルされます。

 -- クラス: decimal.Rounded

     情報が全く失われていない場合も含み、値丸めが起きたときのシグナルで
     す。

     このシグナルは、値丸めによって桁がなくなると常に発生します。なくな
     った桁がゼロ (例えば ‘5.00’ を丸めて ‘5.0’ になった場合) であっても
     です。このシグナルをトラップしなければ、演算結果をそのまま返します
     。このシグナルは有効桁数の減少を検出する際に使います。

 -- クラス: decimal.Subnormal

     値丸めを行う前に指数部が *note Emin: 12bb. より小さかったことを示す
     シグナルです。

     演算結果が微小である場合 (指数が小さすぎる場合) に発生します。この
     シグナルをトラップしなければ、演算結果をそのまま返します。

 -- クラス: decimal.Underflow

     演算結果が値丸めによってゼロになった場合に生じる数値アンダフローで
     す。

     演算結果が微小なため、値丸めによってゼロになった場合に発生します。
     *note Inexact: 2abc. および *note Subnormal: 2abe. シグナルも同時に
     発生します。

 -- クラス: decimal.FloatOperation

     float と Decimal の混合の厳密なセマンティクスを有効にします。

     シグナルがトラップされなかった場合 (デフォルト)、*note Decimal:
     1fe. コンストラクタ、 *note create_decimal(): 12bd. 、およびすべて
     の比較演算子において float と Decimal の混合が許されます。変換も比
     較も正確です。コンテキストフラグ内に *note FloatOperation: 12af. を
     設定することで、混合操作は現れるたびに暗黙に記録されます。 *note
     from_float(): 141d. や *note create_decimal_from_float(): 2b02. に
     よる明示的な変換はフラグを設定しません。

     そうでなければ (シグナルがトラップされれば)、等価性比較および明示的
     な変換のみが静かにに行われ、その他の混合演算は *note
     FloatOperation: 12af. を送出します。

これらのシグナルの階層構造をまとめると、以下の表のようになります:

     exceptions.ArithmeticError(exceptions.Exception)
         DecimalException
             Clamped
             DivisionByZero(DecimalException, exceptions.ZeroDivisionError)
             Inexact
                 Overflow(Inexact, Rounded)
                 Underflow(Inexact, Rounded, Subnormal)
             InvalidOperation
             Rounded
             Subnormal
             FloatOperation(DecimalException, exceptions.TypeError)


File: python.info,  Node: Floating-point notes,  Next: スレッドを使った処理,  Prev: シグナル,  Up: decimal --- 10進固定小数点と浮動小数点の演算

5.9.4.8 Floating-point notes
............................

* Menu:

* 精度を上げて丸め誤差を抑制する::
* 特殊値::


File: python.info,  Node: 精度を上げて丸め誤差を抑制する,  Next: 特殊値,  Up: Floating-point notes

5.9.4.9 精度を上げて丸め誤差を抑制する
......................................

十進浮動小数点数を使うと、十進数表現による誤差を抑制できます (‘0.1’ を正
確に表現できるようになります); しかし、ゼロでない桁が一定の精度を越えて
いる場合には、演算によっては依然として値丸めによる誤差を引き起こします。

The effects of round-off error can be amplified by the addition or
subtraction of nearly offsetting quantities resulting in loss of
significance.  Knuth provides two instructive examples where rounded
floating-point arithmetic with insufficient precision causes the
breakdown of the associative and distributive properties of addition:

     # Examples from Seminumerical Algorithms, Section 4.2.2.
     >>> from decimal import Decimal, getcontext
     >>> getcontext().prec = 8

     >>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')
     >>> (u + v) + w
     Decimal('9.5111111')
     >>> u + (v + w)
     Decimal('10')

     >>> u, v, w = Decimal(20000), Decimal(-6), Decimal('6.0000003')
     >>> (u*v) + (u*w)
     Decimal('0.01')
     >>> u * (v+w)
     Decimal('0.0060000')

The ‘decimal’ module makes it possible to restore the identities by
expanding the precision sufficiently to avoid loss of significance:

     >>> getcontext().prec = 20
     >>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')
     >>> (u + v) + w
     Decimal('9.51111111')
     >>> u + (v + w)
     Decimal('9.51111111')
     >>>
     >>> u, v, w = Decimal(20000), Decimal(-6), Decimal('6.0000003')
     >>> (u*v) + (u*w)
     Decimal('0.0060000')
     >>> u * (v+w)
     Decimal('0.0060000')


File: python.info,  Node: 特殊値,  Prev: 精度を上げて丸め誤差を抑制する,  Up: Floating-point notes

5.9.4.10 特殊値
...............

The number system for the ‘decimal’ module provides special values
including ‘NaN’, ‘sNaN’, ‘-Infinity’, ‘Infinity’, and two zeros, ‘+0’
and ‘-0’.

無限大 (Infinity) は ‘Decimal('Infinity')’ で直接構築できます。また、
*note DivisionByZero: 2abb. をトラップせずにゼロで除算を行った場合にも出
てきます。同様に、 *note Overflow: 2abf. シグナルをトラップしなければ、
表現可能な最大の数値の制限を越えた値を丸めたときに出てきます。

無限大には符号があり (アフィン: affine であり)、算術演算に使用でき、非常
に巨大で不確定の(indeterminate)値として扱われます。例えば、無限大に何ら
かの定数を加算すると、演算結果は別の無限大になります。

演算によっては結果が不確定になるものがあり、 ‘NaN’ を返します。ただし、
*note InvalidOperation: 12bc. シグナルをトラップするようになっていれば例
外を送出します。例えば、 ‘0/0’ は ‘NaN’ を返します。 ‘NaN’ は「非数値
(not a number)」を表します。このような ‘NaN’ は暗黙のうちに生成され、一
度生成されるとそれを他の計算にも流れてゆき、関係する個々の演算全てが個別
の ‘NaN’ を返すようになります。この挙動は、たまに入力値が欠けるような状
況で一連の計算を行う際に便利です -- 特定の計算に対しては無効な結果を示す
フラグを立てつつ計算を進められるからです。

一方、 ‘NaN’ の変種である ‘sNaN’ は関係する全ての演算で演算後にシグナル
を送出します。 ‘sNaN’ は、無効な演算結果に対して特別な処理を行うために計
算を停止する必要がある場合に便利です。

Python の比較演算は ‘NaN’ が関わってくると少し驚くようなことがあります。
等価性のテストの一方の対象が無言または発信 ‘NaN’ である場合いつでも
*note False: d2b. を返し(たとえ ‘Decimal('NaN')==Decimal('NaN')’ でも)、
一方で不等価をテストするといつでも *note True: e07. を返します。二つの
Decimal を ‘<’, ‘<=’, ‘>’ または ‘>=’ を使って比較する試みは一方が ‘NaN’
である場合には *note InvalidOperation: 12bc. シグナルを送出し、このシグ
ナルをトラップしなければ結果は *note False: d2b. に終わります。汎用十進
演算仕様は直接の比較の振る舞いについて定めていないことに注意しておきまし
ょう。ここでの ‘NaN’ が関係する比較ルールは IEEE 854 標準から持ってきま
した (section 5.7 の Table 3 を見て下さい)。厳格に標準遵守を貫くなら、
*note compare(): 2ac9. および *note compare_signal(): 2aca. メソッドを代
わりに使いましょう。

アンダフローの起きた計算は、符号付きのゼロ (signed zero) を返すことがあ
ります。符号は、より高い精度で計算を行った結果の符号と同じになります。符
号付きゼロの大きさはやはりゼロなので、正のゼロと負のゼロは等しいとみなさ
れ、符号は単なる参考にすぎません。

In addition to the two signed zeros which are distinct yet equal, there
are various representations of zero with differing precisions yet
equivalent in value.  This takes a bit of getting used to.  For an eye
accustomed to normalized floating-point representations, it is not
immediately obvious that the following calculation returns a value equal
to zero:

     >>> 1 / Decimal('Infinity')
     Decimal('0E-1000026')


File: python.info,  Node: スレッドを使った処理,  Next: レシピ,  Prev: Floating-point notes,  Up: decimal --- 10進固定小数点と浮動小数点の演算

5.9.4.11 スレッドを使った処理
.............................

関数 *note getcontext(): 1937. は、スレッド毎に別々の *note Context:
12c3. オブジェクトにアクセスします。別のスレッドコンテキストを持つという
ことは、複数のスレッドが互いに影響を及ぼさずに (‘getcontext().prec=10’ の
ような) 変更を適用できるということです。

同様に、*note setcontext(): 2ac2. 関数は自動的に引数のコンテキストを現在
のスレッドのコンテキストに設定します。

If *note setcontext(): 2ac2. has not been called before *note
getcontext(): 1937, then *note getcontext(): 1937. will automatically
create a new context for use in the current thread.  New context objects
have default values set from the *note decimal.DefaultContext: 12b7.
object.

The *note sys.flags.thread_inherit_context: 175. flag affects the
context for new threads.  If the flag is false, new threads will start
with an empty context.  In this case, *note getcontext(): 1937. will
create a new context object when called and use the default values from
'DefaultContext'.  If the flag is true, new threads will start with a
copy of context from the caller of *note threading.Thread.start(): 178.

To control the defaults so that each thread will use the same values
throughout the application, directly modify the 'DefaultContext' object.
This should be done 'before' any threads are started so that there won't
be a race condition between threads calling *note getcontext(): 1937.
For example:

     # Set applicationwide defaults for all threads about to be launched
     DefaultContext.prec = 12
     DefaultContext.rounding = ROUND_DOWN
     DefaultContext.traps = ExtendedContext.traps.copy()
     DefaultContext.traps[InvalidOperation] = 1
     setcontext(DefaultContext)

     # Afterwards, the threads can be started
     t1.start()
     t2.start()
     t3.start()
      . . .


File: python.info,  Node: レシピ,  Next: Decimal FAQ,  Prev: スレッドを使った処理,  Up: decimal --- 10進固定小数点と浮動小数点の演算

5.9.4.12 レシピ
...............

*note Decimal: 1fe. クラスの利用を実演している例をいくつか示します。これ
らはユーティリティ関数としても利用できます:

     def moneyfmt(value, places=2, curr='', sep=',', dp='.',
                  pos='', neg='-', trailneg=''):
         """Convert Decimal to a money formatted string.

         places:  required number of places after the decimal point
         curr:    optional currency symbol before the sign (may be blank)
         sep:     optional grouping separator (comma, period, space, or blank)
         dp:      decimal point indicator (comma or period)
                  only specify as blank when places is zero
         pos:     optional sign for positive numbers: '+', space or blank
         neg:     optional sign for negative numbers: '-', '(', space or blank
         trailneg:optional trailing minus indicator:  '-', ')', space or blank

         >>> d = Decimal('-1234567.8901')
         >>> moneyfmt(d, curr='$')
         '-$1,234,567.89'
         >>> moneyfmt(d, places=0, sep='.', dp='', neg='', trailneg='-')
         '1.234.568-'
         >>> moneyfmt(d, curr='$', neg='(', trailneg=')')
         '($1,234,567.89)'
         >>> moneyfmt(Decimal(123456789), sep=' ')
         '123 456 789.00'
         >>> moneyfmt(Decimal('-0.02'), neg='<', trailneg='>')
         '<0.02>'

         """
         q = Decimal(10) ** -places      # 2 places --> '0.01'
         sign, digits, exp = value.quantize(q).as_tuple()
         result = []
         digits = list(map(str, digits))
         build, next = result.append, digits.pop
         if sign:
             build(trailneg)
         for i in range(places):
             build(next() if digits else '0')
         if places:
             build(dp)
         if not digits:
             build('0')
         i = 0
         while digits:
             build(next())
             i += 1
             if i == 3 and digits:
                 i = 0
                 build(sep)
         build(curr)
         build(neg if sign else pos)
         return ''.join(reversed(result))

     def pi():
         """Compute Pi to the current precision.

         >>> print(pi())
         3.141592653589793238462643383

         """
         getcontext().prec += 2  # extra digits for intermediate steps
         three = Decimal(3)      # substitute "three=3.0" for regular floats
         lasts, t, s, n, na, d, da = 0, three, 3, 1, 0, 0, 24
         while s != lasts:
             lasts = s
             n, na = n+na, na+8
             d, da = d+da, da+32
             t = (t * n) / d
             s += t
         getcontext().prec -= 2
         return +s               # unary plus applies the new precision

     def exp(x):
         """Return e raised to the power of x.  Result type matches input type.

         >>> print(exp(Decimal(1)))
         2.718281828459045235360287471
         >>> print(exp(Decimal(2)))
         7.389056098930650227230427461
         >>> print(exp(2.0))
         7.38905609893
         >>> print(exp(2+0j))
         (7.38905609893+0j)

         """
         getcontext().prec += 2
         i, lasts, s, fact, num = 0, 0, 1, 1, 1
         while s != lasts:
             lasts = s
             i += 1
             fact *= i
             num *= x
             s += num / fact
         getcontext().prec -= 2
         return +s

     def cos(x):
         """Return the cosine of x as measured in radians.

         The Taylor series approximation works best for a small value of x.
         For larger values, first compute x = x % (2 * pi).

         >>> print(cos(Decimal('0.5')))
         0.8775825618903727161162815826
         >>> print(cos(0.5))
         0.87758256189
         >>> print(cos(0.5+0j))
         (0.87758256189+0j)

         """
         getcontext().prec += 2
         i, lasts, s, fact, num, sign = 0, 0, 1, 1, 1, 1
         while s != lasts:
             lasts = s
             i += 2
             fact *= i * (i-1)
             num *= x * x
             sign *= -1
             s += num / fact * sign
         getcontext().prec -= 2
         return +s

     def sin(x):
         """Return the sine of x as measured in radians.

         The Taylor series approximation works best for a small value of x.
         For larger values, first compute x = x % (2 * pi).

         >>> print(sin(Decimal('0.5')))
         0.4794255386042030002732879352
         >>> print(sin(0.5))
         0.479425538604
         >>> print(sin(0.5+0j))
         (0.479425538604+0j)

         """
         getcontext().prec += 2
         i, lasts, s, fact, num, sign = 1, 0, x, 1, x, 1
         while s != lasts:
             lasts = s
             i += 2
             fact *= i * (i-1)
             num *= x * x
             sign *= -1
             s += num / fact * sign
         getcontext().prec -= 2
         return +s


File: python.info,  Node: Decimal FAQ,  Prev: レシピ,  Up: decimal --- 10進固定小数点と浮動小数点の演算

5.9.4.13 Decimal FAQ
....................

Q: It is cumbersome to type ‘decimal.Decimal('1234.5')’.  Is there a way
to minimize typing when using the interactive interpreter?

A: Some users abbreviate the constructor to just a single letter:

     >>> D = decimal.Decimal
     >>> D('1.23') + D('3.45')
     Decimal('4.68')

Q: In a fixed-point application with two decimal places, some inputs
have many places and need to be rounded.  Others are not supposed to
have excess digits and need to be validated.  What methods should be
used?

A: The *note quantize(): 12c4. method rounds to a fixed number of
decimal places.  If the *note Inexact: 2abc. trap is set, it is also
useful for validation:

     >>> TWOPLACES = Decimal(10) ** -2       # same as Decimal('0.01')

     >>> # Round to two places
     >>> Decimal('3.214').quantize(TWOPLACES)
     Decimal('3.21')

     >>> # Validate that a number does not exceed two places
     >>> Decimal('3.21').quantize(TWOPLACES, context=Context(traps=[Inexact]))
     Decimal('3.21')

     >>> Decimal('3.214').quantize(TWOPLACES, context=Context(traps=[Inexact]))
     Traceback (most recent call last):
        ...
     Inexact: None

Q: Once I have valid two place inputs, how do I maintain that invariant
throughout an application?

A: Some operations like addition, subtraction, and multiplication by an
integer will automatically preserve fixed point.  Others operations,
like division and non-integer multiplication, will change the number of
decimal places and need to be followed-up with a *note quantize(): 12c4.
step:

     >>> a = Decimal('102.72')           # Initial fixed-point values
     >>> b = Decimal('3.17')
     >>> a + b                           # Addition preserves fixed-point
     Decimal('105.89')
     >>> a - b
     Decimal('99.55')
     >>> a * 42                          # So does integer multiplication
     Decimal('4314.24')
     >>> (a * b).quantize(TWOPLACES)     # Must quantize non-integer multiplication
     Decimal('325.62')
     >>> (b / a).quantize(TWOPLACES)     # And quantize division
     Decimal('0.03')

固定小数点のアプリケーションを開発する際は、 *note quantize(): 12c4. の
段階を扱う関数を定義しておくと便利です:

     >>> def mul(x, y, fp=TWOPLACES):
     ...     return (x * y).quantize(fp)
     ...
     >>> def div(x, y, fp=TWOPLACES):
     ...     return (x / y).quantize(fp)

     >>> mul(a, b)                       # Automatically preserve fixed-point
     Decimal('325.62')
     >>> div(b, a)
     Decimal('0.03')

Q: There are many ways to express the same value.  The numbers ‘200’,
‘200.000’, ‘2E2’, and ‘.02E+4’ all have the same value at various
precisions.  Is there a way to transform them to a single recognizable
canonical value?

A: The *note normalize(): 2aea. method maps all equivalent values to a
single representative:

     >>> values = map(Decimal, '200 200.000 2E2 .02E+4'.split())
     >>> [v.normalize() for v in values]
     [Decimal('2E+2'), Decimal('2E+2'), Decimal('2E+2'), Decimal('2E+2')]

Q: When does rounding occur in a computation?

A: It occurs 'after' the computation.  The philosophy of the decimal
specification is that numbers are considered exact and are created
independent of the current context.  They can even have greater
precision than current context.  Computations process with those exact
inputs and then rounding (or other context operations) is applied to the
'result' of the computation:

     >>> getcontext().prec = 5
     >>> pi = Decimal('3.1415926535')   # More than 5 digits
     >>> pi                             # All digits are retained
     Decimal('3.1415926535')
     >>> pi + 0                         # Rounded after an addition
     Decimal('3.1416')
     >>> pi - Decimal('0.00005')        # Subtract unrounded numbers, then round
     Decimal('3.1415')
     >>> pi + 0 - Decimal('0.00005').   # Intermediate values are rounded
     Decimal('3.1416')

Q: Some decimal values always print with exponential notation.  Is there
a way to get a non-exponential representation?

A: For some values, exponential notation is the only way to express the
number of significant places in the coefficient.  For example,
expressing ‘5.0E+3’ as ‘5000’ keeps the value constant but cannot show
the original's two-place significance.

もしアプリケーションが有効数字の追跡を等閑視するならば、指数部や末尾のゼ
ロを取り除き、有効数字を忘れ、しかし値を変えずにおくことは容易です:

     >>> def remove_exponent(d):
     ...     return d.quantize(Decimal(1)) if d == d.to_integral() else d.normalize()

     >>> remove_exponent(Decimal('5E+3'))
     Decimal('5000')

Q: Is there a way to convert a regular float to a *note Decimal: 1fe.?

A: Yes, any binary floating-point number can be exactly expressed as a
Decimal though an exact conversion may take more precision than
intuition would suggest:

     >>> Decimal(math.pi)
     Decimal('3.141592653589793115997963468544185161590576171875')

Q: Within a complex calculation, how can I make sure that I haven't
gotten a spurious result because of insufficient precision or rounding
anomalies.

A: The decimal module makes it easy to test results.  A best practice is
to re-run calculations using greater precision and with various rounding
modes.  Widely differing results indicate insufficient precision,
rounding mode issues, ill-conditioned inputs, or a numerically unstable
algorithm.

Q: I noticed that context precision is applied to the results of
operations but not to the inputs.  Is there anything to watch out for
when mixing values of different precisions?

A: Yes.  The principle is that all values are considered to be exact and
so is the arithmetic on those values.  Only the results are rounded.
The advantage for inputs is that "what you type is what you get".  A
disadvantage is that the results can look odd if you forget that the
inputs haven't been rounded:

     >>> getcontext().prec = 3
     >>> Decimal('3.104') + Decimal('2.104')
     Decimal('5.21')
     >>> Decimal('3.104') + Decimal('0.000') + Decimal('2.104')
     Decimal('5.20')

解決策は、精度を増やすか、単項プラス演算子を使って入力の丸めを強制するこ
とです:

     >>> getcontext().prec = 3
     >>> +Decimal('1.23456789')      # unary plus triggers rounding
     Decimal('1.23')

もしくは、入力を *note Context.create_decimal(): 12bd. を使って生成時に
丸めてしまうこともできます:

     >>> Context(prec=5, rounding=ROUND_DOWN).create_decimal('1.2345678')
     Decimal('1.2345')

Q: Is the CPython implementation fast for large numbers?

A: Yes.  In the CPython and PyPy3 implementations, the C/CFFI versions
of the decimal module integrate the high speed libmpdec(1) library for
arbitrary precision correctly rounded decimal floating-point arithmetic
(2).  ‘libmpdec’ uses Karatsuba multiplication(3) for medium-sized
numbers and the Number Theoretic Transform(4) for very large numbers.

The context must be adapted for exact arbitrary precision arithmetic.
*note Emin: 12bb. and *note Emax: 12ba. should always be set to the
maximum values, *note clamp: 13b6. should always be 0 (the default).
Setting *note prec: 2afb. requires some care.

The easiest approach for trying out bignum arithmetic is to use the
maximum value for *note prec: 2afb. as well (5):

     >>> setcontext(Context(prec=MAX_PREC, Emax=MAX_EMAX, Emin=MIN_EMIN))
     >>> x = Decimal(2) ** 256
     >>> x / 128
     Decimal('904625697166532776746648320380374280103671755200316906558262375061821325312')

For inexact results, *note MAX_PREC: 12b4. is far too large on 64-bit
platforms and the available memory will be insufficient:

     >>> Decimal(1) / 3
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     MemoryError

On systems with overallocation (e.g.  Linux), a more sophisticated
approach is to adjust *note prec: 2afb. to the amount of available RAM.
Suppose that you have 8GB of RAM and expect 10 simultaneous operands
using a maximum of 500MB each:

     >>> import sys
     >>>
     >>> # Maximum number of digits for a single operand using 500MB in 8-byte words
     >>> # with 19 digits per word (4-byte and 9 digits for the 32-bit build):
     >>> maxdigits = 19 * ((500 * 1024**2) // 8)
     >>>
     >>> # Check that this works:
     >>> c = Context(prec=maxdigits, Emax=MAX_EMAX, Emin=MIN_EMIN)
     >>> c.traps[Inexact] = True
     >>> setcontext(c)
     >>>
     >>> # Fill the available precision with nines:
     >>> x = Decimal(0).logical_invert() * 9
     >>> sys.getsizeof(x)
     524288112
     >>> x + 2
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
       decimal.Inexact: [<class 'decimal.Inexact'>]

In general (and especially on systems without overallocation), it is
recommended to estimate even tighter bounds and set the *note Inexact:
2abc. trap if all calculations are expected to be exact.

   ---------- Footnotes ----------

   (1) https://www.bytereef.org/mpdecimal/doc/libmpdec/index.html

   (2) 
Added in version 3.3.

   (3) https://en.wikipedia.org/wiki/Karatsuba_algorithm

   (4) 
https://en.wikipedia.org/wiki/Discrete_Fourier_transform_(general)#Number-theoretic_transform

   (5) 
バージョン 3.9 で変更: This approach now works for all exact results
except for non-integer powers.


File: python.info,  Node: fractions --- 有理数,  Next: random --- 疑似乱数を生成する,  Prev: decimal --- 10進固定小数点と浮動小数点の演算,  Up: 数値と数学モジュール

5.9.5 ‘fractions’ -- 有理数
---------------------------

'ソースコード:' Lib/fractions.py(1)

__________________________________________________________________

The ‘fractions’ module provides support for rational number arithmetic.

A Fraction instance can be constructed from a pair of rational numbers,
from a single number, or from a string.

 -- クラス: fractions.Fraction (numerator=0, denominator=1)

 -- クラス: fractions.Fraction (number)

 -- クラス: fractions.Fraction (string)

     The first version requires that 'numerator' and 'denominator' are
     instances of *note numbers.Rational: 14d6. and returns a new *note
     Fraction: 213. instance with a value equal to
     ‘numerator/denominator’.  If 'denominator' is zero, it raises a
     *note ZeroDivisionError: b3f.

     The second version requires that 'number' is an instance of *note
     numbers.Rational: 14d6. or has the ‘as_integer_ratio()’ method
     (this includes *note float: 196. and *note decimal.Decimal: 1fe.).
     It returns a *note Fraction: 213. instance with exactly the same
     value.  Assumed, that the ‘as_integer_ratio()’ method returns a
     pair of coprime integers and last one is positive.  Note that due
     to the usual issues with binary point (see *note
     浮動小数点演算、その問題と制限: 2101.), the argument to
     ‘Fraction(1.1)’ is not exactly equal to 11/10, and so
     ‘Fraction(1.1)’ does 'not' return ‘Fraction(11, 10)’ as one might
     expect.  (But see the documentation for the *note
     limit_denominator(): 2b4e. method below.)

     The last version of the constructor expects a string.  The usual
     form for this instance is:

          [sign] numerator ['/' denominator]

     ここで、オプションの ‘sign’ は '+' か '-' のどちらかであり、
     ‘numerator’ および (存在する場合) ‘denominator’ は十進数の数字の文
     字列です (コード中の整数リテラルと同様、アンダースコアを使って桁を
     区切れます)。さらに、 *note float: 196. コンストラクタで受け付けら
     れる有限の値を表す文字列は、*note Fraction: 213. コンストラクタでも
     受け付けられます。どちらの形式でも、入力される文字列は前後に空白が
     あって構いません。以下に、いくつかの例を示します:

          >>> from fractions import Fraction
          >>> Fraction(16, -10)
          Fraction(-8, 5)
          >>> Fraction(123)
          Fraction(123, 1)
          >>> Fraction()
          Fraction(0, 1)
          >>> Fraction('3/7')
          Fraction(3, 7)
          >>> Fraction(' -3/7 ')
          Fraction(-3, 7)
          >>> Fraction('1.414213 \t\n')
          Fraction(1414213, 1000000)
          >>> Fraction('-.125')
          Fraction(-1, 8)
          >>> Fraction('7e-6')
          Fraction(7, 1000000)
          >>> Fraction(2.25)
          Fraction(9, 4)
          >>> Fraction(1.1)
          Fraction(2476979795053773, 2251799813685248)
          >>> from decimal import Decimal
          >>> Fraction(Decimal('1.1'))
          Fraction(11, 10)

     *note Fraction: 213. クラスは抽象基底クラス *note numbers.Rational:
     14d6. を継承し、その全てのメソッドと演算を実装します。 *note
     Fraction: 213. インスタンスは *note ハッシュ可能: 824. で、不変
     (immutable) であるものとして扱われます。加えて、 *note Fraction:
     213. には以下のプロパティとメソッドがあります:

     バージョン 3.2 で変更: *note Fraction: 213. のコンストラクタが
     *note float: 196. および *note decimal.Decimal: 1fe. インスタンスを
     受け付けるようになりました。

     バージョン 3.9 で変更: The *note math.gcd(): b0c. function is now
     used to normalize the 'numerator' and 'denominator'.  *note
     math.gcd(): b0c. always returns an *note int: 19b. type.
     Previously, the GCD type depended on 'numerator' and 'denominator'.

     バージョン 3.11 で変更: Underscores are now permitted when creating
     a *note Fraction: 213. instance from a string, following PEP 515(2)
     rules.

     バージョン 3.11 で変更: *note Fraction: 213. implements ‘__int__’
     now to satisfy ‘typing.SupportsInt’ instance checks.

     バージョン 3.12 で変更: Space is allowed around the slash for
     string inputs: ‘Fraction('2 / 3')’.

     バージョン 3.12 で変更: *note Fraction: 213. instances now support
     float-style formatting, with presentation types ‘"e"’, ‘"E"’,
     ‘"f"’, ‘"F"’, ‘"g"’, ‘"G"’ and ‘"%""’.

     バージョン 3.13 で変更: Formatting of *note Fraction: 213.
     instances without a presentation type now supports fill, alignment,
     sign handling, minimum width and grouping.

     バージョン 3.14 で変更: The *note Fraction: 213. constructor now
     accepts any objects with the ‘as_integer_ratio()’ method.

      -- の属性: numerator

          有理数を既約分数で表したときの分子。

      -- の属性: denominator

          Denominator of the Fraction in lowest terms.  Guaranteed to be
          positive.

      -- メソッド: as_integer_ratio ()

          Return a tuple of two integers, whose ratio is equal to the
          original Fraction.  The ratio is in lowest terms and has a
          positive denominator.

          Added in version 3.8.

      -- メソッド: is_integer ()

          Return ‘True’ if the Fraction is an integer.

          Added in version 3.12.

      -- メソッド: classmethod from_float (f)

          Alternative constructor which only accepts instances of *note
          float: 196. or *note numbers.Integral: 240a.  Beware that
          ‘Fraction.from_float(0.3)’ is not the same value as
          ‘Fraction(3, 10)’.

               注釈: Python 3.2 以降では、 *note float: 196. から直接
               *note Fraction: 213. インスタンスを構築できるようになりま
               した。

      -- メソッド: classmethod from_decimal (dec)

          Alternative constructor which only accepts instances of *note
          decimal.Decimal: 1fe. or *note numbers.Integral: 240a.

               注釈: Python 3.2 以降では、 *note decimal.Decimal: 1fe. イ
               ンスタンスから直接 *note Fraction: 213. インスタンスを構
               築できるようになりました。

      -- メソッド: classmethod from_number (number)

          Alternative constructor which only accepts instances of *note
          numbers.Integral: 240a, *note numbers.Rational: 14d6, *note
          float: 196. or *note decimal.Decimal: 1fe, and objects with
          the ‘as_integer_ratio()’ method, but not strings.

          Added in version 3.14.

      -- メソッド: limit_denominator (max_denominator=1000000)

          分母が高々 max_denominator である、 ‘self’ に最も近い *note
          Fraction: 213. を見付けて返します。このメソッドは与えられた浮
          動小数点数の有理数近似を見つけるのに役立ちます:

               >>> from fractions import Fraction
               >>> Fraction('3.1415926535897932').limit_denominator(1000)
               Fraction(355, 113)

          あるいは float で表された有理数を元に戻すのにも使えます:

               >>> from math import pi, cos
               >>> Fraction(cos(pi/3))
               Fraction(4503599627370497, 9007199254740992)
               >>> Fraction(cos(pi/3)).limit_denominator()
               Fraction(1, 2)
               >>> Fraction(1.1).limit_denominator()
               Fraction(11, 10)

      -- メソッド: __floor__ ()

          最大の *note int: 19b. ‘<= self’ を返します。このメソッドは
          *note math.floor(): 15d7. 関数からでもアクセスできます:

               >>> from math import floor
               >>> floor(Fraction(355, 113))
               3

      -- メソッド: __ceil__ ()

          最小の *note int: 19b. ‘>= self’ を返します。このメソッドは
          *note math.ceil(): 15d8. 関数からでもアクセスできます。

      -- メソッド: __round__ ()

      -- メソッド: __round__ (ndigits)

          第一のバージョンは、 ‘self’ に最も近い *note int: 19b. を偶数
          丸めで返します。第二のバージョンは、このメソッドは ‘self’ に最
          も近い ‘Fraction(1, 10**ndigits)’ の倍数 (論理的に、 ‘ndigits’
          が負なら) を、これも偶数丸めで丸めます。 *note round(): 14f2.
          関数からでもアクセスできます。

      -- メソッド: __format__ (format_spec, /)

          Provides support for formatting of *note Fraction: 213.
          instances via the *note str.format(): 833. method, the *note
          format(): 199. built-in function, or *note Formatted string
          literals: 19a.

          If the ‘format_spec’ format specification string does not end
          with one of the presentation types ‘'e'’, ‘'E'’, ‘'f'’, ‘'F'’,
          ‘'g'’, ‘'G'’ or ‘'%'’ then formatting follows the general
          rules for fill, alignment, sign handling, minimum width, and
          grouping as described in the *note format specification
          mini-language: 4f9.  The "alternate form" flag ‘'#'’ is
          supported: if present, it forces the output string to always
          include an explicit denominator, even when the value being
          formatted is an exact integer.  The zero-fill flag ‘'0'’ is
          not supported.

          If the ‘format_spec’ format specification string ends with one
          of the presentation types ‘'e'’, ‘'E'’, ‘'f'’, ‘'F'’, ‘'g'’,
          ‘'G'’ or ‘'%'’ then formatting follows the rules outlined for
          the *note float: 196. type in the *note 書式指定ミニ言語仕様:
          4f9. section.

          ここに例があります:

               >>> from fractions import Fraction
               >>> format(Fraction(103993, 33102), '_')
               '103_993/33_102'
               >>> format(Fraction(1, 7), '.^+10')
               '...+1/7...'
               >>> format(Fraction(3, 1), '')
               '3'
               >>> format(Fraction(3, 1), '#')
               '3/1'
               >>> format(Fraction(1, 7), '.40g')
               '0.1428571428571428571428571428571428571429'
               >>> format(Fraction('1234567.855'), '_.2f')
               '1_234_567.86'
               >>> f"{Fraction(355, 113):*>20.6e}"
               '********3.141593e+00'
               >>> old_price, new_price = 499, 672
               >>> "{:.2%} price increase".format(Fraction(new_price, old_price) - 1)
               '34.67% price increase'

参考
....

*note numbers: a2. モジュール

     数値の塔を作り上げる抽象基底クラス。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/fractions.py

   (2) https://peps.python.org/pep-0515/


File: python.info,  Node: random --- 疑似乱数を生成する,  Next: statistics --- 数学的統計関数,  Prev: fractions --- 有理数,  Up: 数値と数学モジュール

5.9.6 ‘random’ -- 疑似乱数を生成する
------------------------------------

'ソースコード:' Lib/random.py(1)

__________________________________________________________________

このモジュールでは様々な分布をもつ擬似乱数生成器を実装しています。

整数用に、ある範囲からの一様な選択があります。シーケンス用には、シーケン
スからのランダムな要素の一様な選択、リストのランダムな置換をインプレース
に生成する関数、順列を置換せずにランダムサンプリングする関数があります。

実数用としては、一様分布、正規分布 (ガウス分布)、対数正規分布、負の指数
分布、ガンマおよびベータ分布を計算する関数があります。角度の分布を生成す
るにはフォン・ミーゼス分布が利用できます。

ほとんど全てのモジュール関数は、基礎となる関数 *note random(): 94f. に依
存します。この関数はランダムな浮動小数点数を半開区間 ‘0.0 <= X < 1.0’ 内
に一様に生成します。Python は中心となる乱数生成器としてメルセンヌツイス
タを使います。これは 53 ビット精度の浮動小数点を生成し、周期は
2**19937-1 です。本体は C で実装されていて、高速でスレッドセーフです。メ
ルセンヌツイスタは、現存する中で最も広範囲にテストされた乱数生成器のひと
つです。しかしながら、メルセンヌツイスタは完全に決定論的であるため、全て
の目的に合致しているわけではなく、暗号化の目的には全く向いていません。

このモジュールで提供されている関数は、実際には *note random.Random:
1c5c. クラスの隠蔽されたインスタンスのメソッドに束縛されています。内部状
態を共有しない生成器を取得するため、自分で *note Random: 1c5c. のインス
タンスを生成することができます。

Class *note Random: 1c5c. can also be subclassed if you want to use a
different basic generator of your own devising: see the documentation on
that class for more details.

The ‘random’ module also provides the *note SystemRandom: 2b57. class
which uses the system function *note os.urandom(): 746. to generate
random numbers from sources provided by the operating system.

     警告: このモジュールの擬似乱数生成器をセキュリティ目的に使用しては
     いけません。セキュリティや暗号学的な用途については *note secrets:
     c5. モジュールを参照してください。

参考
....

M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-dimensionally
equidistributed uniform pseudorandom number generator", ACM Transactions
on Modeling and Computer Simulation Vol.  8, No.  1, January pp.3-30
1998.

Complementary-Multiply-with-Carry recipe(2) 長い周期と比較的シンプルな更
新操作を備えた互換性のある別の乱数生成器。

     注釈: The global random number generator and instances of *note
     Random: 1c5c. are thread-safe.  However, in the free-threaded
     build, concurrent calls to the global generator or to the same
     instance of *note Random: 1c5c. may encounter contention and poor
     performance.  Consider using separate instances of *note Random:
     1c5c. per thread instead.

* Menu:

* 保守 (bookkeeping) 関数: 保守 bookkeeping 関数.
* バイト列用の関数::
* 整数用の関数::
* シーケンス用の関数::
* Discrete distributions::
* 実数分布::
* 他の生成器::
* 再現性について::
* 使用例: 使用例<7>.
* レシピ: レシピ<2>.
* コマンドラインでの使用: コマンドラインでの使用<2>.
* コマンドラインの例::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/random.py

   (2) 
https://code.activestate.com/recipes/576707-long-period-random-number-generator/


File: python.info,  Node: 保守 bookkeeping 関数,  Next: バイト列用の関数,  Up: random --- 疑似乱数を生成する

5.9.6.1 保守 (bookkeeping) 関数
...............................

 -- の関数: random.seed (a=None, version=2)

     乱数生成器を初期化します。

     'a' が省略されるか ‘None’ の場合、現在のシステム時刻が使用されます
     。乱数のソースがオペレーティングシステムによって提供される場合、シ
     ステム時刻の代わりにそれが使用されます (利用可能性についての詳細は
     *note os.urandom(): 746. 関数を参照)。

     'a' が int の場合は、その絶対値が直接使用されます。

     バージョン2 (デフォルト) では、 *note str: 169, *note bytes: 192,
     *note bytearray: 344. オブジェクトは *note int: 19b. に変換され、そ
     のビットがすべて使用されます。

     バージョン1 (Python の古いバージョンでの乱数列を再現するために提供
     される) では、 *note str: 169. と *note bytes: 192. に対して適用さ
     れるアルゴリズムは、より狭い範囲のシードを生成します。

     バージョン 3.2 で変更: 文字列シードのすべてのビットを使うバージョン
     2スキームに移行。

     バージョン 3.11 で変更: 'seed' は次の型の内のいずれかでなければなり
     ません: ‘None’、*note int: 19b.、*note float: 196.、*note str:
     169.、*note bytes: 192.、*note bytearray: 344.。

 -- の関数: random.getstate ()

     乱数生成器の現在の内部状態を記憶したオブジェクトを返します。このオ
     ブジェクトを *note setstate(): 2b5a. に渡して内部状態を復元すること
     ができます。

 -- の関数: random.setstate (state)

     'state' は予め *note getstate(): 2b59. を呼び出して得ておかなくては
     なりません。 *note setstate(): 2b5a. は *note getstate(): 2b59. が
     呼び出された時の乱数生成器の内部状態を復元します。


File: python.info,  Node: バイト列用の関数,  Next: 整数用の関数,  Prev: 保守 bookkeeping 関数,  Up: random --- 疑似乱数を生成する

5.9.6.2 バイト列用の関数
........................

 -- の関数: random.randbytes (n)

     'n' バイトのランダムなバイト列を生成します。

     セキュリティトークンを生成する目的で、このメソッドを使用しないでく
     ださい。代わりに *note secrets.token_bytes(): 2b5c. を使用してくだ
     さい。

     Added in version 3.9.


File: python.info,  Node: 整数用の関数,  Next: シーケンス用の関数,  Prev: バイト列用の関数,  Up: random --- 疑似乱数を生成する

5.9.6.3 整数用の関数
....................

 -- の関数: random.randrange (stop)

 -- の関数: random.randrange (start, stop[, step])

     ‘range(start, stop, step)’ の要素からランダムに選ばれた要素を返しま
     す。

     This is roughly equivalent to ‘choice(range(start, stop, step))’
     but supports arbitrarily large ranges and is optimized for common
     cases.

     位置引数のパターンは *note range(): b3d. 関数の引数と一致します。

     Keyword arguments should not be used because they can be
     interpreted in unexpected ways.  For example ‘randrange(start=100)’
     is interpreted as ‘randrange(0, 100, 1)’.

     バージョン 3.2 で変更: 一様に分布した値の生成に関して *note
     randrange(): a6b. がより洗練されました。以前は ‘int(random()*n)’ の
     ようなやや一様でない分布を生成するスタイルを使用していました。

     バージョン 3.12 で変更: 整数以外の型の自動変換はサポートされなくな
     りました。‘randrange(10.0)’ や ‘randrange(Fraction(10, 1))’ のよう
     な呼び出しは *note TypeError: 198. を送出します。

 -- の関数: random.randint (a, b)

     ‘a <= N <= b’ であるようなランダムな整数 'N' を返します。
     ‘randrange(a, b+1)’ のエイリアスです。

 -- の関数: random.getrandbits (k)

     'k' 桁の乱数ビットを持つ Python の整数を生成し、返します。このメソ
     ッドはメルセンヌツイスタ生成器で提供されており、その他の乱数生成器
     でもオプションの API として提供されている場合があります。*note
     getrandbits(): 120f. が使用可能な場合、*note randrange(): a6b. は任
     意の範囲の乱数を生成できるようになります。

     バージョン 3.9 で変更: 'k' の値として 0 が許されるようになりました
     。


File: python.info,  Node: シーケンス用の関数,  Next: Discrete distributions,  Prev: 整数用の関数,  Up: random --- 疑似乱数を生成する

5.9.6.4 シーケンス用の関数
..........................

 -- の関数: random.choice (seq)

     空でないシーケンス 'seq' からランダムに要素を返します。 'seq' が空
     のときは、 *note IndexError: 174e. が送出されます。

 -- の関数: random.choices (population, weights=None, *,
          cum_weights=None, k=1)

     'population' から重複ありで選んだ要素からなる大きさ 'k' のリストを
     返します。'population' が空の場合 *note IndexError: 174e. を送出し
     ます。

     'weights' シーケンスが与えられた場合、相対的な重みに基づいて要素が
     選ばれます。あるいは、'cum_weights' シーケンスが与えられた場合、累
     積的な重み (*note itertools.accumulate(): bf0. を用いて計算されるか
     もしれません) で要素が選ばれます。例えば、相対的な重み ‘[10, 5, 30,
     5]’ は累積的な重み ‘[10, 15, 45, 50]’ と等価です。内部的には、相対
     的な重みは要素選択の前に累積的な重みに変換されるため、累積的な重み
     を渡すと手間を省けます。

     'weights' および 'cum_weights' が与えられなかった場合、要素は同じ確
     率で選択されます。重みのシーケンスが与えられた場合、その長さは
     'population' シーケンスと同じでなければなりません。'weights' と
     'cum_weights' を同時に与えると *note TypeError: 198. が送出されます
     。

     'weights' や 'cum_weights' には *note random(): bd. が返す *note
     float: 196. 値と相互に変換できるような、任意の数値型を使用できます
     (int、float、fraction を含みますが、decimal は除きます)。重みには非
     負で有限の値を指定することが規定されます。全ての重みが 0 の場合、例
     外 *note ValueError: 2ec. が送出されます。

     与えられた種に対して、同じ重みを持つ *note choices(): ec1. 関数は、
     一般に *note choice(): 1448. を繰り返し呼び出す場合とは異なるシーケ
     ンスを生成します。 *note choices(): ec1. で使用されるアルゴリズムは
     、内部の一貫性とスピードのために浮動小数点演算を使用します。 *note
     choice(): 1448. で使われるアルゴリズムは、丸め誤差による小さな偏り
     を避けるために、デフォルトでは選択を繰り返す整数演算になっています
     。

     Added in version 3.6.

     バージョン 3.9 で変更: 全ての重みが 0 の場合、例外 *note
     ValueError: 2ec. を送出します。

 -- の関数: random.shuffle (x)

     シーケンス 'x' をインプレースにシャッフルします。

     イミュータブルなシーケンスをシャッフルしてシャッフルされたリストを
     新たに返すには、代わりに ‘sample(x, k=len(x))’ を使用してください。

     たとえ ‘len(x)’ が小さくても、'x' の並べ替えの総数 (訳注: 要素数の
     階乗) は大半の乱数生成器の周期よりもすぐに大きくなることに注意して
     ください。つまり、長いシーケンスの大半の並べ替えは決して生成されな
     いだろう、ということです。例えば、長さ 2080 のシーケンスがメルセン
     ヌツイスタ生成器の周期に収まる中で最大のものになります。

     バージョン 3.11 で変更: オプション引数 'random' が削除されました。

 -- の関数: random.sample (population, k, *, counts=None)

     母集団のシーケンスから選ばれた長さ 'k' の一意な要素からなるリストを
     返します。値の置換を行わないランダムサンプリングに用いられます。

     母集団自体を変更せずに、母集団内の要素を含む新たなリストを返します
     。返されたリストは選択された順に並んでいるので、このリストの部分ス
     ライスもランダムなサンプルになります。これにより、くじの当選者 (サ
     ンプル) を1等賞と2等賞（の部分スライス）に分けることも可能です。

     母集団の要素は *note ハッシュ可能: 824. でなくても、ユニークでなく
     てもかまいません。母集団が繰り返しを含む場合、出現するそれぞれがサ
     ンプルに選択されえます。

     母集団に重複がある場合はその分だけ1つずつ指定するか、キーワード専用
     オプション引数 'counts' で指定することができます。例えば、
     ‘sample(['red', 'blue'], counts=[4, 2], k=5)’ は ‘sample(['red',
     'red', 'red', 'red', 'blue', 'blue'], k=5)’ と等価になります。

     ある範囲の整数からサンプルを取る場合、引数に *note range(): b3d. オ
     ブジェクトを使用してください。大きな母集団の場合、これは特に速く、
     メモリ効率が良いです: ‘sample(range(10000000), k=60)’。

     サンプルの大きさが母集団の大きさより大きい場合 *note ValueError:
     2ec. が送出されます。

     バージョン 3.9 で変更: 'counts' 引数が追加されました。

     バージョン 3.11 で変更: 'population' 変数はシーケンスでなければなり
     ません。 setsのリストへの暗黙の型変換はサポートされていません。


File: python.info,  Node: Discrete distributions,  Next: 実数分布,  Prev: シーケンス用の関数,  Up: random --- 疑似乱数を生成する

5.9.6.5 Discrete distributions
..............................

The following function generates a discrete distribution.

 -- の関数: random.binomialvariate (n=1, p=0.5)

     Binomial distribution(1).  Return the number of successes for 'n'
     independent trials with the probability of success in each trial
     being 'p':

     Mathematically equivalent to:

          sum(random() < p for i in range(n))

     The number of trials 'n' should be a non-negative integer.  The
     probability of success 'p' should be between ‘0.0 <= p <= 1.0’.
     The result is an integer in the range ‘0 <= X <= n’.

     Added in version 3.12.

   ---------- Footnotes ----------

   (1) https://mathworld.wolfram.com/BinomialDistribution.html


File: python.info,  Node: 実数分布,  Next: 他の生成器,  Prev: Discrete distributions,  Up: random --- 疑似乱数を生成する

5.9.6.6 実数分布
................

以下の関数は特定の実数値分布を生成します。関数の引数の名前は、一般的な数
学の慣例で使われている分布の公式の対応する変数から取られています; これら
の公式のほとんどはどんな統計学のテキストにも載っています。

 -- の関数: random.random ()

     ランダムな浮動小数点数（範囲は ‘0.0 <= X < 1.0’）を返します。

 -- の関数: random.uniform (a, b)

     ‘a <= b’ であれば ‘a <= N <= b’ 、‘b < a’ であれば ‘b <= N <= a’ で
     あるようなランダムな浮動小数点数 'N' を返します。

     端点の値 ‘b’ が範囲に含まれるかどうかは、式 ‘a + (b-a) * random()’
     における浮動小数点の丸めに依存します。

 -- の関数: random.triangular (low, high, mode)

     ‘low <= N <= high’ でありこれら境界値の間に指定された最頻値 'mode'
     を持つようなランダムな浮動小数点数 'N' を返します。境界 'low' と
     'high' のデフォルトは 0 と 1 です。最頻値 'mode' 引数のデフォルトは
     両境界値の中点になり、対称な分布を与えます。

 -- の関数: random.betavariate (alpha, beta)

     ベータ分布です。引数の満たすべき条件は ‘alpha > 0’ および ‘beta >
     0’ です。 0 から 1 の範囲の値を返します。

 -- の関数: random.expovariate (lambd=1.0)

     指数分布です。'lambd' は平均にしたい値の逆数です。(この引数は
     "lambda" と呼ぶべきなのですが、Python の予約語なので使えません。) 返
     す値の範囲は 'lambd' が正なら 0 から正の無限大、'lambd' が負なら負
     の無限大から 0 です。

     バージョン 3.12 で変更: ‘lambd’ にデフォルト値を追加しました。

 -- の関数: random.gammavariate (alpha, beta)

     Gamma distribution.  ('Not' the gamma function!)  The shape and
     scale parameters, 'alpha' and 'beta', must have positive values.
     (Calling conventions vary and some sources define 'beta' as the
     inverse of the scale).

     確率分布関数は:

                    x ** (alpha - 1) * math.exp(-x / beta)
          pdf(x) =  --------------------------------------
                      math.gamma(alpha) * beta ** alpha

 -- の関数: random.gauss (mu=0.0, sigma=1.0)

     正規分布、またはガウス分布と呼ばれます。 'mu' は平均であり、
     'sigma' は標準偏差です。この関数は後で定義する関数 *note
     normalvariate(): 1bd9. より少しだけ高速です。

     Multithreading note: When two threads call this function
     simultaneously, it is possible that they will receive the same
     return value.  This can be avoided in three ways.  1) Have each
     thread use a different instance of the random number generator.  2)
     Put locks around all calls.  3) Use the slower, but thread-safe
     *note normalvariate(): 1bd9. function instead.

     バージョン 3.11 で変更: 'mu' と 'sigma' にデフォルト値を追加しまし
     た。

 -- の関数: random.lognormvariate (mu, sigma)

     対数正規分布です。この分布を自然対数を用いた分布にした場合、平均
     'mu' で標準偏差 'sigma' の正規分布になります。 'mu' は任意の値を取
     ることができ、'sigma' はゼロより大きくなければなりません。

 -- の関数: random.normalvariate (mu=0.0, sigma=1.0)

     正規分布です。 'mu' は平均で、 'sigma' は標準偏差です。

     バージョン 3.11 で変更: 'mu' と 'sigma' にデフォルト値を追加しまし
     た。

 -- の関数: random.vonmisesvariate (mu, kappa)

     'mu' は平均の角度で、0 から 2*'pi' までのラジアンで表されます。
     'kappa' は濃度パラメータで、ゼロ以上でなければなりません。'kappa' が
     ゼロに等しい場合、この分布は範囲 0 から 2*'pi' の一様でランダムな角
     度の分布に退化します。

 -- の関数: random.paretovariate (alpha)

     パレート分布です。 'alpha' は形状パラメータです。

 -- の関数: random.weibullvariate (alpha, beta)

     ワイブル分布です。 'alpha' は尺度パラメタで、 'beta' は形状パラメー
     タです。


File: python.info,  Node: 他の生成器,  Next: 再現性について,  Prev: 実数分布,  Up: random --- 疑似乱数を生成する

5.9.6.7 他の生成器
..................

 -- クラス: random.Random ([seed])

     Class that implements the default pseudo-random number generator
     used by the ‘random’ module.

     バージョン 3.11 で変更: 以前は 'seed' は任意のハッシュ可能オブジェ
     クトが設定可能でした。現在は ‘None’, *note int: 19b, *note float:
     196, *note str: 169, *note bytes: 192, *note bytearray: 344. に制限
     されています。

     Subclasses of ‘Random’ should override the following methods if
     they wish to make use of a different basic generator:

      -- メソッド: seed (a=None, version=2)

          Override this method in subclasses to customise the *note
          seed(): 148b. behaviour of ‘Random’ instances.

      -- メソッド: getstate ()

          Override this method in subclasses to customise the *note
          getstate(): 2b59. behaviour of ‘Random’ instances.

      -- メソッド: setstate (state)

          Override this method in subclasses to customise the *note
          setstate(): 2b5a. behaviour of ‘Random’ instances.

      -- メソッド: random ()

          Override this method in subclasses to customise the *note
          random(): 94f. behaviour of ‘Random’ instances.

     Optionally, a custom generator subclass can also supply the
     following method:

      -- メソッド: getrandbits (k)

          Override this method in subclasses to customise the *note
          getrandbits(): 120f. behaviour of ‘Random’ instances.

      -- メソッド: randbytes (n)

          Override this method in subclasses to customise the *note
          randbytes(): 1826. behaviour of ‘Random’ instances.

 -- クラス: random.SystemRandom ([seed])

     オペレーティングシステムの提供する発生源によって乱数を生成する
     *note os.urandom(): 746. 関数を使うクラスです。すべてのシステムで使
     えるメソッドではありません。ソフトウェアの状態に依存してはいけませ
     んし、一連の操作は再現不能です。従って、 *note seed(): 148b. メソッ
     ドは何の影響も及ぼさず、無視されます。 *note getstate(): 2b59. と
     *note setstate(): 2b5a. メソッドが呼び出されると、例外 *note
     NotImplementedError: 36b. が送出されます。


File: python.info,  Node: 再現性について,  Next: 使用例<7>,  Prev: 他の生成器,  Up: random --- 疑似乱数を生成する

5.9.6.8 再現性について
......................

疑似乱数生成器から与えられたシーケンスを再現できると便利なことがあります
。シード値を再利用することで、複数のスレッドが実行されていない限り、実行
ごとに同じシーケンスが再現できます。

random モジュールのアルゴリズムやシード処理関数のほとんどは、Python バー
ジョン間で変更される対象となりますが、次の二点は変更されないことが保証さ
れています:

   * 新しいシード処理メソッドが追加されたら、後方互換なシード処理器が提
     供されます。

   * 生成器の *note random(): 2b6d. メソッドは、互換なシード処理器に同じ
     シードが与えられた場合、引き続き同じシーケンスを生成します。


File: python.info,  Node: 使用例<7>,  Next: レシピ<2>,  Prev: 再現性について,  Up: random --- 疑似乱数を生成する

5.9.6.9 使用例
..............

基礎的な例:

     >>> random()                          # Random float:  0.0 <= x < 1.0
     0.37444887175646646

     >>> uniform(2.5, 10.0)                # Random float:  2.5 <= x <= 10.0
     3.1800146073117523

     >>> expovariate(1 / 5)                # Interval between arrivals averaging 5 seconds
     5.148957571865031

     >>> randrange(10)                     # Integer from 0 to 9 inclusive
     7

     >>> randrange(0, 101, 2)              # Even integer from 0 to 100 inclusive
     26

     >>> choice(['win', 'lose', 'draw'])   # Single random element from a sequence
     'draw'

     >>> deck = 'ace two three four'.split()
     >>> shuffle(deck)                     # Shuffle a list
     >>> deck
     ['four', 'two', 'ace', 'three']

     >>> sample([10, 20, 30, 40, 50], k=4) # Four samples without replacement
     [40, 10, 50, 30]

シミュレーション:

     >>> # Six roulette wheel spins (weighted sampling with replacement)
     >>> choices(['red', 'black', 'green'], [18, 18, 2], k=6)
     ['red', 'green', 'black', 'black', 'red', 'black']

     >>> # Deal 20 cards without replacement from a deck
     >>> # of 52 playing cards, and determine the proportion of cards
     >>> # with a ten-value:  ten, jack, queen, or king.
     >>> deal = sample(['tens', 'low cards'], counts=[16, 36], k=20)
     >>> deal.count('tens') / 20
     0.15

     >>> # Estimate the probability of getting 5 or more heads from 7 spins
     >>> # of a biased coin that settles on heads 60% of the time.
     >>> sum(binomialvariate(n=7, p=0.6) >= 5 for i in range(10_000)) / 10_000
     0.4169

     >>> # Probability of the median of 5 samples being in middle two quartiles
     >>> def trial():
     ...     return 2_500 <= sorted(choices(range(10_000), k=5))[2] < 7_500
     ...
     >>> sum(trial() for i in range(10_000)) / 10_000
     0.7958

サンプルの平均の信頼区間を推定するのに、重複ありでリサンプリングして 統
計的ブートストラップ(1) を行う例:

     # https://www.thoughtco.com/example-of-bootstrapping-3126155
     from statistics import fmean as mean
     from random import choices

     data = [41, 50, 29, 37, 81, 30, 73, 63, 20, 35, 68, 22, 60, 31, 95]
     means = sorted(mean(choices(data, k=len(data))) for i in range(100))
     print(f'The sample mean of {mean(data):.1f} has a 90% confidence '
           f'interval from {means[5]:.1f} to {means[94]:.1f}')

薬と偽薬の間に観察された効果の違いについて、統計的有意性、すなわち p 値
(2) を決定するために、リサンプリング順列試験(3) を行う例:

     # Example from "Statistics is Easy" by Dennis Shasha and Manda Wilson
     from statistics import fmean as mean
     from random import shuffle

     drug = [54, 73, 53, 70, 73, 68, 52, 65, 65]
     placebo = [54, 51, 58, 44, 55, 52, 42, 47, 58, 46]
     observed_diff = mean(drug) - mean(placebo)

     n = 10_000
     count = 0
     combined = drug + placebo
     for i in range(n):
         shuffle(combined)
         new_diff = mean(combined[:len(drug)]) - mean(combined[len(drug):])
         count += (new_diff >= observed_diff)

     print(f'{n} label reshufflings produced only {count} instances with a difference')
     print(f'at least as extreme as the observed difference of {observed_diff:.1f}.')
     print(f'The one-sided p-value of {count / n:.4f} leads us to reject the null')
     print(f'hypothesis that there is no difference between the drug and the placebo.')

マルチサーバーキューにおける到達時間とサービス提供のシミュレーション:

     from heapq import heapify, heapreplace
     from random import expovariate, gauss
     from statistics import mean, quantiles

     average_arrival_interval = 5.6
     average_service_time = 15.0
     stdev_service_time = 3.5
     num_servers = 3

     waits = []
     arrival_time = 0.0
     servers = [0.0] * num_servers  # time when each server becomes available
     heapify(servers)
     for i in range(1_000_000):
         arrival_time += expovariate(1.0 / average_arrival_interval)
         next_server_available = servers[0]
         wait = max(0.0, next_server_available - arrival_time)
         waits.append(wait)
         service_duration = max(0.0, gauss(average_service_time, stdev_service_time))
         service_completed = arrival_time + wait + service_duration
         heapreplace(servers, service_completed)

     print(f'Mean wait: {mean(waits):.1f}   Max wait: {max(waits):.1f}')
     print('Quartiles:', [round(q, 1) for q in quantiles(waits)])

参考
....

Statistics for Hackers(4) Jake Vanderplas(5) による統計解析のビデオ。シ
ミュレーション、サンプリング、シャッフル、交差検定といった基本的な概念の
みを用いています。

Economics Simulation(6) Peter Norvig(7) による市場価格のシミュレーション
。このモジュールが提供する多くのツールや分布 (gauss, uniform, sample,
betavariate, choice, triangular, randrange) の活用法を示しています。

A Concrete Introduction to Probability (using Python)(8) Peter Norvig(9)
によるチュートリアル。確率論の基礎、シミュレーションの書き方、Python を
使用したデータ解析法をカバーしています。

   ---------- Footnotes ----------

   (1) 
https://ja.wikipedia.org/wiki/%E3%83%96%E3%83%BC%E3%83%88%E3%82%B9%E3%83%88%E3%83%A9%E3%83%83%E3%83%97%E6%B3%95

   (2) https://en.wikipedia.org/wiki/P-value

   (3) 
https://en.wikipedia.org/wiki/Resampling_(statistics)#Permutation_tests

   (4) https://www.youtube.com/watch?v=Iq9DzN6mvYA

   (5) https://us.pycon.org/2016/speaker/profile/295/

   (6) https://nbviewer.org/url/norvig.com/ipython/Economics.ipynb

   (7) https://norvig.com/bio.html

   (8) https://nbviewer.org/url/norvig.com/ipython/Probability.ipynb

   (9) https://norvig.com/bio.html


File: python.info,  Node: レシピ<2>,  Next: コマンドラインでの使用<2>,  Prev: 使用例<7>,  Up: random --- 疑似乱数を生成する

5.9.6.10 レシピ
...............

These recipes show how to efficiently make random selections from the
combinatoric iterators in the *note itertools: 85. module:

     import random

     def random_product(*iterables, repeat=1):
         "Random selection from itertools.product(*iterables, repeat=repeat)"
         pools = tuple(map(tuple, iterables)) * repeat
         return tuple(map(random.choice, pools))

     def random_permutation(iterable, r=None):
         "Random selection from itertools.permutations(iterable, r)"
         pool = tuple(iterable)
         r = len(pool) if r is None else r
         return tuple(random.sample(pool, r))

     def random_combination(iterable, r):
         "Random selection from itertools.combinations(iterable, r)"
         pool = tuple(iterable)
         n = len(pool)
         indices = sorted(random.sample(range(n), r))
         return tuple(pool[i] for i in indices)

     def random_combination_with_replacement(iterable, r):
         "Choose r elements with replacement.  Order the result to match the iterable."
         # Result will be in set(itertools.combinations_with_replacement(iterable, r)).
         pool = tuple(iterable)
         n = len(pool)
         indices = sorted(random.choices(range(n), k=r))
         return tuple(pool[i] for i in indices)

     def random_derangement(iterable):
         "Choose a permutation where no element stays in its original position."
         seq = tuple(iterable)
         if len(seq) < 2:
             if not seq:
                 return ()
             raise IndexError('No derangments to choose from')
         perm = list(range(len(seq)))
         start = tuple(perm)
         while True:
             random.shuffle(perm)
             if all(p != q for p, q in zip(start, perm)):
                 return tuple([seq[i] for i in perm])

The default *note random(): 94f. returns multiples of 2⁻⁵³ in the range
'0.0 ≤ x < 1.0'.  All such numbers are evenly spaced and are exactly
representable as Python floats.  However, many other representable
floats in that interval are not possible selections.  For example,
‘0.05954861408025609’ isn't an integer multiple of 2⁻⁵³.

The following recipe takes a different approach.  All floats in the
interval are possible selections.  The mantissa comes from a uniform
distribution of integers in the range '2⁵² ≤ mantissa < 2⁵³'.  The
exponent comes from a geometric distribution where exponents smaller
than '-53' occur half as often as the next larger exponent.

     from random import Random
     from math import ldexp

     class FullRandom(Random):

         def random(self):
             mantissa = 0x10_0000_0000_0000 | self.getrandbits(52)
             exponent = -53
             x = 0
             while not x:
                 x = self.getrandbits(32)
                 exponent += x.bit_length() - 32
             return ldexp(mantissa, exponent)

All *note real valued distributions: 2b61. in the class will use the new
method:

     >>> fr = FullRandom()
     >>> fr.random()
     0.05954861408025609
     >>> fr.expovariate(0.25)
     8.87925541791544

The recipe is conceptually equivalent to an algorithm that chooses from
all the multiples of 2⁻¹⁰⁷⁴ in the range '0.0 ≤ x < 1.0'.  All such
numbers are evenly spaced, but most have to be rounded down to the
nearest representable Python float.  (The value 2⁻¹⁰⁷⁴ is the smallest
positive unnormalized float and is equal to ‘math.ulp(0.0)’.)

参考
....

Generating Pseudo-random Floating-Point Values(1) a paper by Allen B.
Downey describing ways to generate more fine-grained floats than
normally generated by *note random(): 94f.

   ---------- Footnotes ----------

   (1) https://allendowney.com/research/rand/downey07randfloat.pdf


File: python.info,  Node: コマンドラインでの使用<2>,  Next: コマンドラインの例,  Prev: レシピ<2>,  Up: random --- 疑似乱数を生成する

5.9.6.11 コマンドラインでの使用
...............................

Added in version 3.13.

‘random’ モジュールはコマンドラインから実行できます。

     python -m random [-h] [-c CHOICE [CHOICE ...] | -i N | -f N] [input ...]

以下のオプションが使用できます:

 -- Option: -h, --help

     ヘルプメッセージを表示して終了します。

 -- Option: -c CHOICE [CHOICE ...]
 -- Option: --choice CHOICE [CHOICE ...]

     *note choice(): 1448. を使用してランダムに選択して出力します。

 -- Option: -i <N>
 -- Option: --integer <N>

     *note randint(): 1447. を使用して1からNの間(Nを含む)のランダムな整
     数を出力します。

 -- Option: -f <N>
 -- Option: --float <N>

     *note uniform(): 2b62. を使用して0からNの間(Nを含む)のランダムな浮
     動小数点数を出力します。

オプションが指定されない場合、出力は入力に依存します。

   * 文字列または複数: *note -choice: 2b76. と同じ。

   * 整数: *note -integer: 2b78. と同じ。

   * 浮動小数点数: *note -float: 2b7a. と同じ。


File: python.info,  Node: コマンドラインの例,  Prev: コマンドラインでの使用<2>,  Up: random --- 疑似乱数を生成する

5.9.6.12 コマンドラインの例
...........................

以下は ‘random’ のコマンドラインインターフェースの例です:

     $ # Choose one at random
     $ python -m random egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce"
     Lobster Thermidor aux crevettes with a Mornay sauce

     $ # Random integer
     $ python -m random 6
     6

     $ # Random floating-point number
     $ python -m random 1.8
     1.7080016272295635

     $ # With explicit arguments
     $ python  -m random --choice egg bacon sausage spam "Lobster Thermidor aux crevettes with a Mornay sauce"
     egg

     $ python -m random --integer 6
     3

     $ python -m random --float 1.8
     1.5666339105010318

     $ python -m random --integer 6
     5

     $ python -m random --float 6
     3.1942323316565915


File: python.info,  Node: statistics --- 数学的統計関数,  Prev: random --- 疑似乱数を生成する,  Up: 数値と数学モジュール

5.9.7 ‘statistics’ -- 数学的統計関数
------------------------------------

Added in version 3.4.

'ソースコード:' Lib/statistics.py(1)

__________________________________________________________________

このモジュールは、数値 (*note Real: 25f2. 型) データを数学的に統計計算す
るための関数を提供します。

このモジュールは、 NumPy(2), SciPy(3) のような third-party ライブラリや
、Minitab、SAS、Matlab のようなプロ統計家向けのフル装備なプロプライエタ
リ統計パッケージと競合することを意図していません。グラフ関数電卓のレベル
を対象としています。

特に明記しない限り、これらの関数は *note int: 19b, *note float: 196,
*note Decimal: 1fe. そして *note Fraction: 213. をサポートします。他の型
(算術型及びそれ以外) は現在サポートされていません。型が混ざったコレクシ
ョンも未定義で実装依存です。入力データが複数の型からなる場合、*note
map(): 19f. を使用すると正しい結果が得られるでしょう。 例: ‘map(float,
input_data)’。

あるデータセットでは欠損値を表すために ‘NaN’ (not a number) を使います。
NaNは通常と異なる比較セマンティクスを持つため、ソートやカウントを行う統
計関数では、驚きや未定義の振る舞いを引き起こします。 影響を受ける関数は
‘median()’, ‘median_low()’, ‘median_high()’, ‘median_grouped()’,
‘mode()’, ‘multimode()’, そして ‘quantiles()’ です。 これらの関数を呼ぶ
前に、 ‘NaN’ 値を取り除く必要があります:

     >>> from statistics import median
     >>> from math import isnan
     >>> from itertools import filterfalse

     >>> data = [20.7, float('NaN'),19.2, 18.3, float('NaN'), 14.4]
     >>> sorted(data)  # This has surprising behavior
     [20.7, nan, 14.4, 18.3, 19.2, nan]
     >>> median(data)  # This result is unexpected
     16.35

     >>> sum(map(isnan, data))    # Number of missing values
     2
     >>> clean = list(filterfalse(isnan, data))  # Strip NaN values
     >>> clean
     [20.7, 19.2, 18.3, 14.4]
     >>> sorted(clean)  # Sorting now works as expected
     [14.4, 18.3, 19.2, 20.7]
     >>> median(clean)       # This result is now well defined
     18.75

* Menu:

* 平均及び中心位置の測度::
* 分散の測度::
* 2入力間の関係の統計::
* 関数の詳細::
* 例外: 例外<5>.
* NormalDist オブジェクト::
* 例とレシピ: 例とレシピ<2>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/statistics.py

   (2) https://numpy.org

   (3) https://scipy.org/


File: python.info,  Node: 平均及び中心位置の測度,  Next: 分散の測度,  Up: statistics --- 数学的統計関数

5.9.7.1 平均及び中心位置の測度
..............................

これらの関数は母集団または標本の平均値や標準値を計算します。

*note mean(): 8e1.          データの算術平均 (いわゆる「平均」) 。
                            
                            
*note fmean(): c29.         Fast, floating-point arithmetic mean, with optional weighting.
                            
                            
*note geometric_mean(): c2a.データの幾何平均。
                            
                            
*note harmonic_mean(): edd. データの調和平均。
                            
                            
*note kde(): 553.           Estimate the probability density distribution of the data.
                            
                            
*note kde_random(): 554.    Random sampling from the PDF generated by kde().
                            
                            
*note median(): 2b81.       データのメジアン(中央値)。
                            
                            
*note median_low(): 2b82.   データの low median。
                            
                            
*note median_high(): 2b83.  データの high median。
                            
                            
*note median_grouped(): 2b84.Median (50th percentile) of grouped data.
                            
                            
*note mode(): c85.          離散/名義尺度データの最頻値 (single mode) 。
                            
                            
*note multimode(): c2b.     離散/名義尺度データの最頻値 (list of modes) 。
                            
                            
*note quantiles(): c2c.     データの等確率での分割。
                            


File: python.info,  Node: 分散の測度,  Next: 2入力間の関係の統計,  Prev: 平均及び中心位置の測度,  Up: statistics --- 数学的統計関数

5.9.7.2 分散の測度
..................

これらの関数は母集団または標本が標準値や平均値からどれくらい離れているか
について計算します。

*note pstdev(): 17b0.       データの母標準偏差。
                            
                            
*note pvariance(): 2b86.    データの母分散。
                            
                            
*note stdev(): 8e3.         データの標本標準偏差。
                            
                            
*note variance(): 8e2.      データの標本標準分散。
                            


File: python.info,  Node: 2入力間の関係の統計,  Next: 関数の詳細,  Prev: 分散の測度,  Up: statistics --- 数学的統計関数

5.9.7.3 2入力間の関係の統計
...........................

これらの関数は、2つの入力間の関係について統計量を計算します。

*note covariance(): a31.      2変数の標本共分散。
                              
                              
*note correlation(): 6e3.     ピアソンとスピアマンの相関係数。
                              
                              
*note linear_regression(): a32.単回帰の傾きと切片。
                              


File: python.info,  Node: 関数の詳細,  Next: 例外<5>,  Prev: 2入力間の関係の統計,  Up: statistics --- 数学的統計関数

5.9.7.4 関数の詳細
..................

註釈: 関数の引数となるデータをソートしておく必要はありません。例の多くが
ソートされているのは見やすさのためです。

 -- の関数: statistics.mean (data)

     シーケンス型またはイテラブルになり得る 'data' の標本算術平均を返し
     ます。

     算術平均はデータの総和をデータ数で除したものです。単に「平均」と呼
     ばれることも多いですが、数学における平均の一種に過ぎません。データ
     の中心位置の測度の一つです。

     'data' が空の場合 *note StatisticsError: 2b89. を送出します。

     使用例:

          >>> mean([1, 2, 3, 4, 4])
          2.8
          >>> mean([-1.0, 2.5, 3.25, 5.75])
          2.625

          >>> from fractions import Fraction as F
          >>> mean([F(3, 7), F(1, 21), F(5, 3), F(1, 3)])
          Fraction(13, 21)

          >>> from decimal import Decimal as D
          >>> mean([D("0.5"), D("0.75"), D("0.625"), D("0.375")])
          Decimal('0.5625')

          注釈: mean は 外れ値(1) (outliers(2)) の影響を強く受け、必ずし
          もデータ点の典型例とはなりません。効率が悪いものの、より堅牢な
          、 中心的な傾向 (central tendency(3)) の尺度については、 *note
          median(): 2b81. を参照してください。

          標本平均は真の母平均の不偏推定量のため、出来る限り多くの標本か
          ら平均を求めると、‘mean(sample)’ は真の母平均に収束します (訳
          注: 大数の法則)。'data' が標本ではなく母集団全体の場合、
          ‘mean(data)’ は真の母平均 μ を計算することと等価です。

 -- の関数: statistics.fmean (data, weights=None)

     'data' を float に変換し、算術平均を計算します。

     This runs faster than the *note mean(): 8e1. function and it always
     returns a *note float: 196.  The 'data' may be a sequence or
     iterable.  If the input dataset is empty, raises a *note
     StatisticsError: 2b89.

          >>> fmean([3.5, 4.0, 5.25])
          4.25

     Optional weighting is supported.  For example, a professor assigns
     a grade for a course by weighting quizzes at 20%, homework at 20%,
     a midterm exam at 30%, and a final exam at 30%:

          >>> grades = [85, 92, 83, 91]
          >>> weights = [0.20, 0.20, 0.30, 0.30]
          >>> fmean(grades, weights)
          87.6

     If 'weights' is supplied, it must be the same length as the 'data'
     or a *note ValueError: 2ec. will be raised.

     Added in version 3.8.

     バージョン 3.11 で変更: 'weights' のサポートが追加されました。

 -- の関数: statistics.geometric_mean (data)

     Convert 'data' to floats and compute the geometric mean.

     The geometric mean indicates the central tendency or typical value
     of the 'data' using the product of the values (as opposed to the
     arithmetic mean which uses their sum).

     Raises a *note StatisticsError: 2b89. if the input dataset is
     empty, if it contains a zero, or if it contains a negative value.
     The 'data' may be a sequence or iterable.

     No special efforts are made to achieve exact results.  (However,
     this may change in the future.)

          >>> round(geometric_mean([54, 24, 36]), 1)
          36.0

     Added in version 3.8.

 -- の関数: statistics.harmonic_mean (data, weights=None)

     Return the harmonic mean of 'data', a sequence or iterable of
     real-valued numbers.  If 'weights' is omitted or ‘None’, then equal
     weighting is assumed.

     調和平均（harmonic mean）は、データの逆数の算術平均 *note mean():
     8e1. の逆数です。例えば、3つの値 'a', 'b', 'c' の調和平均は''3/(1/a
     + 1/b + 1/c)'' になります。いずれかの値が0の場合、結果は0になります
     。

     調和平均は平均の一種で、データの中心位置の測度です。速度のような比
     (ratios)や率(rates)を平均するときにしばしば適切です。

     Suppose a car travels 10 km at 40 km/hr, then another 10 km at 60
     km/hr.  What is the average speed?

          >>> harmonic_mean([40, 60])
          48.0

     Suppose a car travels 40 km/hr for 5 km, and when traffic clears,
     speeds-up to 60 km/hr for the remaining 30 km of the journey.  What
     is the average speed?

          >>> harmonic_mean([40, 60], weights=[5, 30])
          56.0

     *note StatisticsError: 2b89. is raised if 'data' is empty, any
     element is less than zero, or if the weighted sum isn't positive.

     The current algorithm has an early-out when it encounters a zero in
     the input.  This means that the subsequent inputs are not tested
     for validity.  (This behavior may change in the future.)

     Added in version 3.6.

     バージョン 3.10 で変更: 'weights' のサポートが追加されました。

 -- の関数: statistics.kde (data, h, kernel='normal', *,
          cumulative=False)

     Kernel Density Estimation (KDE)(4): Create a continuous probability
     density function or cumulative distribution function from discrete
     samples.

     The basic idea is to smooth the data using a kernel function(5).
     to help draw inferences about a population from a sample.

     The degree of smoothing is controlled by the scaling parameter 'h'
     which is called the bandwidth.  Smaller values emphasize local
     features while larger values give smoother results.

     The 'kernel' determines the relative weights of the sample data
     points.  Generally, the choice of kernel shape does not matter as
     much as the more influential bandwidth smoothing parameter.

     Kernels that give some weight to every sample point include
     'normal' ('gauss'), 'logistic', and 'sigmoid'.

     Kernels that only give weight to sample points within the bandwidth
     include 'rectangular' ('uniform'), 'triangular', 'parabolic'
     ('epanechnikov'), 'quartic' ('biweight'), 'triweight', and
     'cosine'.

     If 'cumulative' is true, will return a cumulative distribution
     function.

     A *note StatisticsError: 2b89. will be raised if the 'data'
     sequence is empty.

     Wikipedia has an example(6) where we can use *note kde(): 553. to
     generate and plot a probability density function estimated from a
     small sample:

          >>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]
          >>> f_hat = kde(sample, h=1.5)
          >>> xarr = [i/100 for i in range(-750, 1100)]
          >>> yarr = [f_hat(x) for x in xarr]

     The points in ‘xarr’ and ‘yarr’ can be used to make a PDF plot:

[image src="python-figures/kde_example.png" alt="Scatter plot of the estimated probability density function."]


     Added in version 3.13.

 -- の関数: statistics.kde_random (data, h, kernel='normal', *,
          seed=None)

     Return a function that makes a random selection from the estimated
     probability density function produced by ‘kde(data, h, kernel)’.

     Providing a 'seed' allows reproducible selections.  In the future,
     the values may change slightly as more accurate kernel inverse CDF
     estimates are implemented.  The seed may be an integer, float, str,
     or bytes.

     A *note StatisticsError: 2b89. will be raised if the 'data'
     sequence is empty.

     Continuing the example for *note kde(): 553, we can use *note
     kde_random(): 554. to generate new random selections from an
     estimated probability density function:

          >>> data = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]
          >>> rand = kde_random(data, h=1.5, seed=8675309)
          >>> new_selections = [rand() for i in range(10)]
          >>> [round(x, 1) for x in new_selections]
          [0.7, 6.2, 1.2, 6.9, 7.0, 1.8, 2.5, -0.5, -1.8, 5.6]

     Added in version 3.13.

 -- の関数: statistics.median (data)

     一般的な「中央2つの平均をとる」方法を使用して、数値データの中央値（
     中間値）を返します。もし 'data' が空の場合、例外 *note
     StatisticsError: 2b89. が送出されます。'data' はシーケンス型または
     イテラブルにもなれます。

     中央値は外れ値の影響を受けにくいため、中心位置のロバストな測度です
     。データ数が奇数の場合は中央の値を返します:

          >>> median([1, 3, 5])
          3

     データ数が偶数の場合は、中央値は中央に最も近い2値の算術平均で補間さ
     れます:

          >>> median([1, 3, 5, 7])
          4.0

     データが離散的で、中央値がデータ点にない値でも構わない場合に適して
     います。

     もしあなたのデータが（注文操作をサポートする）序数で、（追加操作を
     サポートしない）数値でないならば、代わりに *note median_low():
     2b82. または *note median_high(): 2b83. の使用を検討してください。

 -- の関数: statistics.median_low (data)

     数値データの小さい方の中央値(low median)を返します。もし 'data' が
     空の場合、*note StatisticsError: 2b89. が送出されます。'data' はシ
     ーケンス型またはイテラブルにもなれます。

     low median は必ずデータに含まれています。データ数が奇数の場合は中央
     の値を返し、偶数の場合は中央の2値の小さい方を返します。

          >>> median_low([1, 3, 5])
          3
          >>> median_low([1, 3, 5, 7])
          3

     データが離散的で、中央値が補間値よりもデータ点にある値の方が良い場
     合に用いてください。

 -- の関数: statistics.median_high (data)

     データの大きい方の中央値(high median)を返します。もし 'data' が空の
     場合、*note StatisticsError: 2b89. が送出されます。 'data' はシーケ
     ンス型やイテラブルにもなれます。

     high median は必ずデータに含まれています。データ数が奇数の場合は中
     央の値を返し、偶数の場合は中央の2値の大きい方を返します。

          >>> median_high([1, 3, 5])
          3
          >>> median_high([1, 3, 5, 7])
          5

     データが離散的で、中央値が補間値よりもデータ点にある値の方が良い場
     合に用いてください。

 -- の関数: statistics.median_grouped (data, interval=1.0)

     Estimates the median for numeric data that has been grouped or
     binned(7) around the midpoints of consecutive, fixed-width
     intervals.

     The 'data' can be any iterable of numeric data with each value
     being exactly the midpoint of a bin.  At least one value must be
     present.

     The 'interval' is the width of each bin.

     For example, demographic information may have been summarized into
     consecutive ten-year age groups with each group being represented
     by the 5-year midpoints of the intervals:

          >>> from collections import Counter
          >>> demographics = Counter({
          ...    25: 172,   # 20 to 30 years old
          ...    35: 484,   # 30 to 40 years old
          ...    45: 387,   # 40 to 50 years old
          ...    55:  22,   # 50 to 60 years old
          ...    65:   6,   # 60 to 70 years old
          ... })
          ...

     The 50th percentile (median) is the 536th person out of the 1071
     member cohort.  That person is in the 30 to 40 year old age group.

     The regular *note median(): 2b81. function would assume that
     everyone in the tricenarian age group was exactly 35 years old.  A
     more tenable assumption is that the 484 members of that age group
     are evenly distributed between 30 and 40.  For that, we use *note
     median_grouped(): 2b84.:

          >>> data = list(demographics.elements())
          >>> median(data)
          35
          >>> round(median_grouped(data, interval=10), 1)
          37.5

     The caller is responsible for making sure the data points are
     separated by exact multiples of 'interval'.  This is essential for
     getting a correct result.  The function does not check this
     precondition.

     Inputs may be any numeric type that can be coerced to a float
     during the interpolation step.

 -- の関数: statistics.mode (data)

     Return the single most common data point from discrete or nominal
     'data'.  The mode (when it exists) is the most typical value and
     serves as a measure of central location.

     If there are multiple modes with the same frequency, returns the
     first one encountered in the 'data'.  If the smallest or largest of
     those is desired instead, use ‘min(multimode(data))’ or
     ‘max(multimode(data))’.  If the input 'data' is empty, *note
     StatisticsError: 2b89. is raised.

     ‘mode’ は離散データであることを想定していて、1つの値を返します。こ
     れは学校で教わるような最頻値の標準的な取扱いです:

          >>> mode([1, 1, 2, 3, 3, 3, 3, 4])
          3

     The mode is unique in that it is the only statistic in this package
     that also applies to nominal (non-numeric) data:

          >>> mode(["red", "blue", "blue", "red", "green", "red", "red"])
          'red'

     Only hashable inputs are supported.  To handle type *note set: 184,
     consider casting to *note frozenset: 7f2.  To handle type *note
     list: 24d, consider casting to *note tuple: 614.  For mixed or
     nested inputs, consider using this slower quadratic algorithm that
     only depends on equality tests: ‘max(data, key=data.count)’.

     バージョン 3.8 で変更: Now handles multimodal datasets by returning
     the first mode encountered.  Formerly, it raised *note
     StatisticsError: 2b89. when more than one mode was found.

 -- の関数: statistics.multimode (data)

     Return a list of the most frequently occurring values in the order
     they were first encountered in the 'data'.  Will return more than
     one result if there are multiple modes or an empty list if the
     'data' is empty:

          >>> multimode('aabbbbccddddeeffffgg')
          ['b', 'd', 'f']
          >>> multimode('')
          []

     Added in version 3.8.

 -- の関数: statistics.pstdev (data, mu=None)

     母標準偏差 (母分散の平方根) を返します。引数や詳細は *note
     pvariance(): 2b86. を参照してください。

          >>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])
          0.986893273527251

 -- の関数: statistics.pvariance (data, mu=None)

     'data' の母分散を返します。'data' は実数の空でないシーケンスまたは
     イテラブルです。分散、すなわち2次の中心化モーメントはデータの散らば
     り具合の測度です。分散が大きいデータはばらつきが大きく、分散が小さ
     いデータは平均値のまわりに固まっています。

     If the optional second argument 'mu' is given, it should be the
     'population' mean of the 'data'.  It can also be used to compute
     the second moment around a point that is not the mean.  If it is
     missing or ‘None’ (the default), the arithmetic mean is
     automatically calculated.

     母集団全体から分散を計算する場合に用いてください。標本から分散を推
     定する場合は *note variance(): 8e2. を使いましょう。

     'data' が空の場合 *note StatisticsError: 2b89. を送出します。

     例:

          >>> data = [0.0, 0.25, 0.25, 1.25, 1.5, 1.75, 2.75, 3.25]
          >>> pvariance(data)
          1.25

     既にデータの平均値を計算している場合、それを第2引数 'mu' に渡して再
     計算を避けることが出来ます:

          >>> mu = mean(data)
          >>> pvariance(data, mu)
          1.25

     Decimal と Fraction がサポートされています:

          >>> from decimal import Decimal as D
          >>> pvariance([D("27.5"), D("30.25"), D("30.25"), D("34.5"), D("41.75")])
          Decimal('24.815')

          >>> from fractions import Fraction as F
          >>> pvariance([F(1, 4), F(5, 4), F(1, 2)])
          Fraction(13, 72)

          注釈: 母集団全体で呼んだ場合は母分散 σ² を返します。代わりに標
          本で呼んだ場合は biased variance s²、すなわち自由度 N の分散を
          返します。

          If you somehow know the true population mean μ, you may use
          this function to calculate the variance of a sample, giving
          the known population mean as the second argument.  Provided
          the data points are a random sample of the population, the
          result will be an unbiased estimate of the population
          variance.

 -- の関数: statistics.stdev (data, xbar=None)

     標本標準偏差 (標本分散の平方根) を返します。引数や詳細は *note
     variance(): 8e2. を参照してください。

          >>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])
          1.0810874155219827

 -- の関数: statistics.variance (data, xbar=None)

     'data' の標本分散を返します。'data' は少なくとも2つの実数の
     iterable です。分散、すなわち2次の中心化モーメントはデータの散らば
     り具合の測度です。分散が大きいデータはばらつきが大きく、分散が小さ
     いデータは平均値のまわりに固まっています。

     If the optional second argument 'xbar' is given, it should be the
     'sample' mean of 'data'.  If it is missing or ‘None’ (the default),
     the mean is automatically calculated.

     データが母集団の標本であるときに用いてください。母集団全体から分散
     を計算するには *note pvariance(): 2b86. を参照してください。

     'data' の値が2より少ない場合 *note StatisticsError: 2b89. を送出し
     ます。

     例:

          >>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]
          >>> variance(data)
          1.3720238095238095

     If you have already calculated the sample mean of your data, you
     can pass it as the optional second argument 'xbar' to avoid
     recalculation:

          >>> m = mean(data)
          >>> variance(data, m)
          1.3720238095238095

     この関数は引数として渡した 'xbar' が実際の平均値かどうかチェックし
     ません。任意の値を 'xbar' に渡すと無効な結果やありえない結果が返る
     ことがあります。

     Decimal と Fraction がサポートされています:

          >>> from decimal import Decimal as D
          >>> variance([D("27.5"), D("30.25"), D("30.25"), D("34.5"), D("41.75")])
          Decimal('31.01875')

          >>> from fractions import Fraction as F
          >>> variance([F(1, 6), F(1, 2), F(5, 3)])
          Fraction(67, 108)

          注釈: Bessel 補正済みの標本分散 s²、すなわち自由度 N-1 の分散
          です。与えられたデータ点が代表的 (たとえば独立で均等に分布) な
          場合、戻り値は母分散の不偏推定量になります。

          何らかの方法で真の母平均 μ を知っている場合、それを *note
          pvariance(): 2b86. の引数 'mu' に渡して標本の分散を計算するこ
          とが出来ます。

 -- の関数: statistics.quantiles (data, *, n=4, method='exclusive')

     Divide 'data' into 'n' continuous intervals with equal probability.
     Returns a list of ‘n - 1’ cut points separating the intervals.

     Set 'n' to 4 for quartiles (the default).  Set 'n' to 10 for
     deciles.  Set 'n' to 100 for percentiles which gives the 99 cuts
     points that separate 'data' into 100 equal sized groups.  Raises
     *note StatisticsError: 2b89. if 'n' is not least 1.

     The 'data' can be any iterable containing sample data.  For
     meaningful results, the number of data points in 'data' should be
     larger than 'n'.  Raises *note StatisticsError: 2b89. if there is
     not at least one data point.

     The cut points are linearly interpolated from the two nearest data
     points.  For example, if a cut point falls one-third of the
     distance between two sample values, ‘100’ and ‘112’, the cut-point
     will evaluate to ‘104’.

     The 'method' for computing quantiles can be varied depending on
     whether the 'data' includes or excludes the lowest and highest
     possible values from the population.

     The default 'method' is "exclusive" and is used for data sampled
     from a population that can have more extreme values than found in
     the samples.  The portion of the population falling below the
     'i-th' of 'm' sorted data points is computed as ‘i / (m + 1)’.
     Given nine sample values, the method sorts them and assigns the
     following percentiles: 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%.

     Setting the 'method' to "inclusive" is used for describing
     population data or for samples that are known to include the most
     extreme values from the population.  The minimum value in 'data' is
     treated as the 0th percentile and the maximum value is treated as
     the 100th percentile.  The portion of the population falling below
     the 'i-th' of 'm' sorted data points is computed as ‘(i - 1) / (m -
     1)’.  Given 11 sample values, the method sorts them and assigns the
     following percentiles: 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%,
     90%, 100%.

          # Decile cut points for empirically sampled data
          >>> data = [105, 129, 87, 86, 111, 111, 89, 81, 108, 92, 110,
          ...         100, 75, 105, 103, 109, 76, 119, 99, 91, 103, 129,
          ...         106, 101, 84, 111, 74, 87, 86, 103, 103, 106, 86,
          ...         111, 75, 87, 102, 121, 111, 88, 89, 101, 106, 95,
          ...         103, 107, 101, 81, 109, 104]
          >>> [round(q, 1) for q in quantiles(data, n=10)]
          [81.0, 86.2, 89.0, 99.4, 102.5, 103.6, 106.0, 109.8, 111.0]

     Added in version 3.8.

     バージョン 3.13 で変更: No longer raises an exception for an input
     with only a single data point.  This allows quantile estimates to
     be built up one sample point at a time becoming gradually more
     refined with each new data point.

 -- の関数: statistics.covariance (x, y, /)

     Return the sample covariance of two inputs 'x' and 'y'.  Covariance
     is a measure of the joint variability of two inputs.

     Both inputs must be of the same length (no less than two),
     otherwise *note StatisticsError: 2b89. is raised.

     例:

          >>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9]
          >>> y = [1, 2, 3, 1, 2, 3, 1, 2, 3]
          >>> covariance(x, y)
          0.75
          >>> z = [9, 8, 7, 6, 5, 4, 3, 2, 1]
          >>> covariance(x, z)
          -7.5
          >>> covariance(z, x)
          -7.5

     Added in version 3.10.

 -- の関数: statistics.correlation (x, y, /, *, method='linear')

     Return the Pearson's correlation coefficient(8) for two inputs.
     Pearson's correlation coefficient 'r' takes values between -1 and
     +1.  It measures the strength and direction of a linear
     relationship.

     If 'method' is "ranked", computes Spearman's rank correlation
     coefficient(9) for two inputs.  The data is replaced by ranks.
     Ties are averaged so that equal values receive the same rank.  The
     resulting coefficient measures the strength of a monotonic
     relationship.

     Spearman's correlation coefficient is appropriate for ordinal data
     or for continuous data that doesn't meet the linear proportion
     requirement for Pearson's correlation coefficient.

     Both inputs must be of the same length (no less than two), and need
     not to be constant, otherwise *note StatisticsError: 2b89. is
     raised.

     Example with Kepler's laws of planetary motion(10):

          >>> # Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, and  Neptune
          >>> orbital_period = [88, 225, 365, 687, 4331, 10_756, 30_687, 60_190]    # days
          >>> dist_from_sun = [58, 108, 150, 228, 778, 1_400, 2_900, 4_500] # million km

          >>> # Show that a perfect monotonic relationship exists
          >>> correlation(orbital_period, dist_from_sun, method='ranked')
          1.0

          >>> # Observe that a linear relationship is imperfect
          >>> round(correlation(orbital_period, dist_from_sun), 4)
          0.9882

          >>> # Demonstrate Kepler's third law: There is a linear correlation
          >>> # between the square of the orbital period and the cube of the
          >>> # distance from the sun.
          >>> period_squared = [p * p for p in orbital_period]
          >>> dist_cubed = [d * d * d for d in dist_from_sun]
          >>> round(correlation(period_squared, dist_cubed), 4)
          1.0

     Added in version 3.10.

     バージョン 3.12 で変更: Added support for Spearman's rank
     correlation coefficient.

 -- の関数: statistics.linear_regression (x, y, /, *,
          proportional=False)

     Return the slope and intercept of simple linear regression(11)
     parameters estimated using ordinary least squares.  Simple linear
     regression describes the relationship between an independent
     variable 'x' and a dependent variable 'y' in terms of this linear
     function:

          'y = slope * x + intercept + noise'

     where ‘slope’ and ‘intercept’ are the regression parameters that
     are estimated, and ‘noise’ represents the variability of the data
     that was not explained by the linear regression (it is equal to the
     difference between predicted and actual values of the dependent
     variable).

     Both inputs must be of the same length (no less than two), and the
     independent variable 'x' cannot be constant; otherwise a *note
     StatisticsError: 2b89. is raised.

     For example, we can use the release dates of the Monty Python
     films(12) to predict the cumulative number of Monty Python films
     that would have been produced by 2019 assuming that they had kept
     the pace.

          >>> year = [1971, 1975, 1979, 1982, 1983]
          >>> films_total = [1, 2, 3, 4, 5]
          >>> slope, intercept = linear_regression(year, films_total)
          >>> round(slope * 2019 + intercept)
          16

     If 'proportional' is true, the independent variable 'x' and the
     dependent variable 'y' are assumed to be directly proportional.
     The data is fit to a line passing through the origin.  Since the
     'intercept' will always be 0.0, the underlying linear function
     simplifies to:

          'y = slope * x + noise'

     Continuing the example from *note correlation(): 6e3, we look to
     see how well a model based on major planets can predict the orbital
     distances for dwarf planets:

          >>> model = linear_regression(period_squared, dist_cubed, proportional=True)
          >>> slope = model.slope

          >>> # Dwarf planets:   Pluto,  Eris,    Makemake, Haumea, Ceres
          >>> orbital_periods = [90_560, 204_199, 111_845, 103_410, 1_680]  # days
          >>> predicted_dist = [math.cbrt(slope * (p * p)) for p in orbital_periods]
          >>> list(map(round, predicted_dist))
          [5912, 10166, 6806, 6459, 414]

          >>> [5_906, 10_152, 6_796, 6_450, 414]  # actual distance in million km
          [5906, 10152, 6796, 6450, 414]

     Added in version 3.10.

     バージョン 3.11 で変更: Added support for 'proportional'.

   ---------- Footnotes ----------

   (1) https://ja.wikipedia.org/wiki/外れ値

   (2) https://en.wikipedia.org/wiki/Outlier

   (3) https://en.wikipedia.org/wiki/Central_tendency

   (4) 
https://www.itm-conferences.org/articles/itmconf/pdf/2018/08/itmconf_sam2018_00037.pdf

   (5) https://en.wikipedia.org/wiki/Kernel_(statistics)

   (6) https://en.wikipedia.org/wiki/Kernel_density_estimation#Example

   (7) https://en.wikipedia.org/wiki/Data_binning

   (8) https://en.wikipedia.org/wiki/Pearson_correlation_coefficient

   (9) 
https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient

   (10) https://en.wikipedia.org/wiki/Kepler's_laws_of_planetary_motion

   (11) https://en.wikipedia.org/wiki/Simple_linear_regression

   (12) https://en.wikipedia.org/wiki/Monty_Python#Films


File: python.info,  Node: 例外<5>,  Next: NormalDist オブジェクト,  Prev: 関数の詳細,  Up: statistics --- 数学的統計関数

5.9.7.5 例外
............

例外が1つ定義されています:

 -- 例外: statistics.StatisticsError

     統計関係の例外。*note ValueError: 2ec. の派生クラス。


File: python.info,  Node: NormalDist オブジェクト,  Next: 例とレシピ<2>,  Prev: 例外<5>,  Up: statistics --- 数学的統計関数

5.9.7.6 ‘NormalDist’ オブジェクト
.................................

*note NormalDist: c2d. is a tool for creating and manipulating normal
distributions of a random variable(1).  It is a class that treats the
mean and standard deviation of data measurements as a single entity.

Normal distributions arise from the Central Limit Theorem(2) and have a
wide range of applications in statistics.

 -- クラス: statistics.NormalDist (mu=0.0, sigma=1.0)

     Returns a new 'NormalDist' object where 'mu' represents the
     arithmetic mean(3) and 'sigma' represents the standard
     deviation(4).

     'sigma' が負の数の場合 *note StatisticsError: 2b89. を送出します。

      -- の属性: mean

          A read-only property for the arithmetic mean(5) of a normal
          distribution.

      -- の属性: median

          A read-only property for the median(6) of a normal
          distribution.

      -- の属性: mode

          A read-only property for the mode(7) of a normal distribution.

      -- の属性: stdev

          A read-only property for the standard deviation(8) of a normal
          distribution.

      -- の属性: variance

          A read-only property for the variance(9) of a normal
          distribution.  Equal to the square of the standard deviation.

      -- メソッド: classmethod from_samples (data)

          Makes a normal distribution instance with 'mu' and 'sigma'
          parameters estimated from the 'data' using *note fmean(): c29.
          and *note stdev(): 8e3.

          The 'data' can be any *note iterable: 12f1. and should consist
          of values that can be converted to type *note float: 196.  If
          'data' does not contain at least two elements, raises *note
          StatisticsError: 2b89. because it takes at least one point to
          estimate a central value and at least two points to estimate
          dispersion.

      -- メソッド: samples (n, *, seed=None)

          Generates 'n' random samples for a given mean and standard
          deviation.  Returns a *note list: 24d. of *note float: 196.
          values.

          If 'seed' is given, creates a new instance of the underlying
          random number generator.  This is useful for creating
          reproducible results, even in a multi-threading context.

          バージョン 3.13 で変更.

          Switched to a faster algorithm.  To reproduce samples from
          previous versions, use *note random.seed(): 148b. and *note
          random.gauss(): 1bd8.

      -- メソッド: pdf (x)

          Using a probability density function (pdf)(10), compute the
          relative likelihood that a random variable 'X' will be near
          the given value 'x'.  Mathematically, it is the limit of the
          ratio ‘P(x <= X < x+dx) / dx’ as 'dx' approaches zero.

          The relative likelihood is computed as the probability of a
          sample occurring in a narrow range divided by the width of the
          range (hence the word "density").  Since the likelihood is
          relative to other points, its value can be greater than ‘1.0’.

      -- メソッド: cdf (x)

          Using a cumulative distribution function (cdf)(11), compute
          the probability that a random variable 'X' will be less than
          or equal to 'x'.  Mathematically, it is written ‘P(X <= x)’.

      -- メソッド: inv_cdf (p)

          Compute the inverse cumulative distribution function, also
          known as the quantile function(12) or the percent-point(13)
          function.  Mathematically, it is written ‘x : P(X <= x) = p’.

          Finds the value 'x' of the random variable 'X' such that the
          probability of the variable being less than or equal to that
          value equals the given probability 'p'.

      -- メソッド: overlap (other)

          Measures the agreement between two normal probability
          distributions.  Returns a value between 0.0 and 1.0 giving the
          overlapping area for the two probability density
          functions(14).

      -- メソッド: quantiles (n=4)

          Divide the normal distribution into 'n' continuous intervals
          with equal probability.  Returns a list of (n - 1) cut points
          separating the intervals.

          Set 'n' to 4 for quartiles (the default).  Set 'n' to 10 for
          deciles.  Set 'n' to 100 for percentiles which gives the 99
          cuts points that separate the normal distribution into 100
          equal sized groups.

      -- メソッド: zscore (x)

          Compute the Standard Score(15) describing 'x' in terms of the
          number of standard deviations above or below the mean of the
          normal distribution: ‘(x - mean) / stdev’.

          Added in version 3.9.

     Instances of *note NormalDist: c2d. support addition, subtraction,
     multiplication and division by a constant.  These operations are
     used for translation and scaling.  For example:

          >>> temperature_february = NormalDist(5, 2.5)             # Celsius
          >>> temperature_february * (9/5) + 32                     # Fahrenheit
          NormalDist(mu=41.0, sigma=4.5)

     Dividing a constant by an instance of *note NormalDist: c2d. is not
     supported because the result wouldn't be normally distributed.

     Since normal distributions arise from additive effects of
     independent variables, it is possible to add and subtract two
     independent normally distributed random variables(16) represented
     as instances of *note NormalDist: c2d.  For example:

          >>> birth_weights = NormalDist.from_samples([2.5, 3.1, 2.1, 2.4, 2.7, 3.5])
          >>> drug_effects = NormalDist(0.4, 0.15)
          >>> combined = birth_weights + drug_effects
          >>> round(combined.mean, 1)
          3.1
          >>> round(combined.stdev, 1)
          0.5

     Added in version 3.8.

   ---------- Footnotes ----------

   (1) http://www.stat.yale.edu/Courses/1997-98/101/ranvar.htm

   (2) https://en.wikipedia.org/wiki/Central_limit_theorem

   (3) https://en.wikipedia.org/wiki/Arithmetic_mean

   (4) https://en.wikipedia.org/wiki/Standard_deviation

   (5) https://en.wikipedia.org/wiki/Arithmetic_mean

   (6) https://en.wikipedia.org/wiki/Median

   (7) https://en.wikipedia.org/wiki/Mode_(statistics)

   (8) https://en.wikipedia.org/wiki/Standard_deviation

   (9) https://en.wikipedia.org/wiki/Variance

   (10) https://en.wikipedia.org/wiki/Probability_density_function

   (11) https://en.wikipedia.org/wiki/Cumulative_distribution_function

   (12) https://en.wikipedia.org/wiki/Quantile_function

   (13) 
https://web.archive.org/web/20190203145224/https://www.statisticshowto.datasciencecentral.com/inverse-distribution-function/

   (14) https://www.rasch.org/rmt/rmt101r.htm

   (15) 
https://www.statisticshowto.com/probability-and-statistics/z-score/

   (16) 
https://en.wikipedia.org/wiki/Sum_of_normally_distributed_random_variables


File: python.info,  Node: 例とレシピ<2>,  Prev: NormalDist オブジェクト,  Up: statistics --- 数学的統計関数

5.9.7.7 例とレシピ
..................

* Menu:

* Classic probability problems::
* Monte Carlo inputs for simulations::
* Approximating binomial distributions::
* Naive bayesian classifier::


File: python.info,  Node: Classic probability problems,  Next: Monte Carlo inputs for simulations,  Up: 例とレシピ<2>

5.9.7.8 Classic probability problems
....................................

*note NormalDist: c2d. readily solves classic probability problems.

For example, given historical data for SAT exams(1) showing that scores
are normally distributed with a mean of 1060 and a standard deviation of
195, determine the percentage of students with test scores between 1100
and 1200, after rounding to the nearest whole number:

     >>> sat = NormalDist(1060, 195)
     >>> fraction = sat.cdf(1200 + 0.5) - sat.cdf(1100 - 0.5)
     >>> round(fraction * 100.0, 1)
     18.4

Find the quartiles(2) and deciles(3) for the SAT scores:

     >>> list(map(round, sat.quantiles()))
     [928, 1060, 1192]
     >>> list(map(round, sat.quantiles(n=10)))
     [810, 896, 958, 1011, 1060, 1109, 1162, 1224, 1310]

   ---------- Footnotes ----------

   (1) https://nces.ed.gov/programs/digest/d17/tables/dt17_226.40.asp

   (2) https://en.wikipedia.org/wiki/Quartile

   (3) https://en.wikipedia.org/wiki/Decile


File: python.info,  Node: Monte Carlo inputs for simulations,  Next: Approximating binomial distributions,  Prev: Classic probability problems,  Up: 例とレシピ<2>

5.9.7.9 Monte Carlo inputs for simulations
..........................................

To estimate the distribution for a model that isn't easy to solve
analytically, *note NormalDist: c2d. can generate input samples for a
Monte Carlo simulation(1):

     >>> def model(x, y, z):
     ...     return (3*x + 7*x*y - 5*y) / (11 * z)
     ...
     >>> n = 100_000
     >>> X = NormalDist(10, 2.5).samples(n, seed=3652260728)
     >>> Y = NormalDist(15, 1.75).samples(n, seed=4582495471)
     >>> Z = NormalDist(50, 1.25).samples(n, seed=6582483453)
     >>> quantiles(map(model, X, Y, Z))
     [1.4591308524824727, 1.8035946855390597, 2.175091447274739]

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Monte_Carlo_method


File: python.info,  Node: Approximating binomial distributions,  Next: Naive bayesian classifier,  Prev: Monte Carlo inputs for simulations,  Up: 例とレシピ<2>

5.9.7.10 Approximating binomial distributions
.............................................

Normal distributions can be used to approximate Binomial
distributions(1) when the sample size is large and when the probability
of a successful trial is near 50%.

For example, an open source conference has 750 attendees and two rooms
with a 500 person capacity.  There is a talk about Python and another
about Ruby.  In previous conferences, 65% of the attendees preferred to
listen to Python talks.  Assuming the population preferences haven't
changed, what is the probability that the Python room will stay within
its capacity limits?

     >>> n = 750             # Sample size
     >>> p = 0.65            # Preference for Python
     >>> q = 1.0 - p         # Preference for Ruby
     >>> k = 500             # Room capacity

     >>> # Approximation using the cumulative normal distribution
     >>> from math import sqrt
     >>> round(NormalDist(mu=n*p, sigma=sqrt(n*p*q)).cdf(k + 0.5), 4)
     0.8402

     >>> # Exact solution using the cumulative binomial distribution
     >>> from math import comb, fsum
     >>> round(fsum(comb(n, r) * p**r * q**(n-r) for r in range(k+1)), 4)
     0.8402

     >>> # Approximation using a simulation
     >>> from random import seed, binomialvariate
     >>> seed(8675309)
     >>> mean(binomialvariate(n, p) <= k for i in range(10_000))
     0.8406

   ---------- Footnotes ----------

   (1) https://mathworld.wolfram.com/BinomialDistribution.html


File: python.info,  Node: Naive bayesian classifier,  Prev: Approximating binomial distributions,  Up: 例とレシピ<2>

5.9.7.11 Naive bayesian classifier
..................................

Normal distributions commonly arise in machine learning problems.

Wikipedia has a nice example of a Naive Bayesian Classifier(1).  The
challenge is to predict a person's gender from measurements of normally
distributed features including height, weight, and foot size.

We're given a training dataset with measurements for eight people.  The
measurements are assumed to be normally distributed, so we summarize the
data with *note NormalDist: c2d.:

     >>> height_male = NormalDist.from_samples([6, 5.92, 5.58, 5.92])
     >>> height_female = NormalDist.from_samples([5, 5.5, 5.42, 5.75])
     >>> weight_male = NormalDist.from_samples([180, 190, 170, 165])
     >>> weight_female = NormalDist.from_samples([100, 150, 130, 150])
     >>> foot_size_male = NormalDist.from_samples([12, 11, 12, 10])
     >>> foot_size_female = NormalDist.from_samples([6, 8, 7, 9])

Next, we encounter a new person whose feature measurements are known but
whose gender is unknown:

     >>> ht = 6.0        # height
     >>> wt = 130        # weight
     >>> fs = 8          # foot size

Starting with a 50% prior probability(2) of being male or female, we
compute the posterior as the prior times the product of likelihoods for
the feature measurements given the gender:

     >>> prior_male = 0.5
     >>> prior_female = 0.5
     >>> posterior_male = (prior_male * height_male.pdf(ht) *
     ...                   weight_male.pdf(wt) * foot_size_male.pdf(fs))

     >>> posterior_female = (prior_female * height_female.pdf(ht) *
     ...                     weight_female.pdf(wt) * foot_size_female.pdf(fs))

The final prediction goes to the largest posterior.  This is known as
the maximum a posteriori(3) or MAP:

     >>> 'male' if posterior_male > posterior_female else 'female'
     'female'

   ---------- Footnotes ----------

   (1) 
https://en.wikipedia.org/wiki/Naive_Bayes_classifier#Person_classification

   (2) https://en.wikipedia.org/wiki/Prior_probability

   (3) https://en.wikipedia.org/wiki/Maximum_a_posteriori_estimation


File: python.info,  Node: 関数型プログラミング用モジュール,  Next: ファイルとディレクトリへのアクセス,  Prev: 数値と数学モジュール,  Up: Python 標準ライブラリ

5.10 関数型プログラミング用モジュール
=====================================

この章では、関数型プログラミングスタイルをサポートする呼び出し可能で汎用
な操作を実現する関数やクラスについて説明します。

この章では以下のモジュールが記述されています:

* Menu:

* itertools: itertools --- 効率的なループ用のイテレータ生成関数群. 効率的なループ用のイテレータ生成関数群
* functools: functools --- 高階関数と呼び出し可能オブジェクトの操作. 高階関数と呼び出し可能オブジェクトの操作
* operator: operator --- 関数形式の標準演算子. 関数形式の標準演算子


File: python.info,  Node: itertools --- 効率的なループ用のイテレータ生成関数群,  Next: functools --- 高階関数と呼び出し可能オブジェクトの操作,  Up: 関数型プログラミング用モジュール

5.10.1 ‘itertools’ -- 効率的なループ用のイテレータ生成関数群
------------------------------------------------------------

__________________________________________________________________

このモジュールは *note イテレータ: 4c8. を構築する部品を実装しています。
プログラム言語 APL, Haskell, SML からアイデアを得ていますが、 Python に
適した形に修正されています。

このモジュールは、高速でメモリ効率に優れ、単独でも組合せても使用すること
のできるツールを標準化したものです。同時に、このツール群は "イテレータの
代数" を構成していて、pure Python で簡潔かつ効率的なツールを作れるように
しています。

例えば、SML の作表ツール ‘tabulate(f)’ は ‘f(0), f(1), ...’ のシーケンス
を作成します。同じことを Python では *note map(): 19f. と *note count():
149b. を組合せて ‘map(f, count())’ という形で実現できます。

'無限イテレータ:'

イテレータ             引数                  結果                                                  使用例
                                                                                                   
-------------------------------------------------------------------------------------------------------------------------------------------------
                                                                                                   
*note count(): 149b.   [start[, step]]       start, start+step, start+2*step, ...                  ‘count(10) → 10 11 12 13 14 ...’
                                                                                                   
                                                                                                   
*note cycle(): 2ba2.   p                     p0, p1, ...  plast, p0, p1, ...                       ‘cycle('ABCD') → A B C D A B C D ...’
                                                                                                   
                                                                                                   
*note repeat(): 1859.  elem [,n]             elem, elem, elem, ...  無限もしくは n 回              ‘repeat(10, 3) → 10 10 10’
                                                                                                   

'一番短い入力シーケンスで止まるイテレータ:'

イテレータ                       引数                             結果                                                  使用例
                                                                                                                        
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                                                                                        
*note accumulate(): bf0.         p [,func]                        p0, p0+p1, p0+p1+p2, ...                              ‘accumulate([1,2,3,4,5]) → 1 3 6 10 15’
                                                                                                                        
                                                                                                                        
*note batched(): 511.            p, n                             (p0, p1, ..., p_n-1), ...                             ‘batched('ABCDEFG', n=3) → ABC DEF G’
                                                                                                                        
                                                                                                                        
*note chain(): 25de.             p, q, ...                        p0, p1, ...  plast, q0, q1, ...                       ‘chain('ABC', 'DEF') → A B C D E F’
                                                                                                                        
                                                                                                                        
*note chain.from_iterable(): 2ba3.iterable                        p0, p1, ...  plast, q0, q1, ...                       ‘chain.from_iterable(['ABC', 'DEF']) → A B C D E F’
                                                                                                                        
                                                                                                                        
*note compress(): 149a.          data, selectors                  (d[0] if s[0]), (d[1] if s[1]), ...                   ‘compress('ABCDEF', [1,0,1,0,1,1]) → A C E F’
                                                                                                                        
                                                                                                                        
*note dropwhile(): 2ba4.         predicate, seq                   seq[n], seq[n+1], starting when predicate fails       ‘dropwhile(lambda x: x<5, [1,4,6,3,8]) → 6 3 8’
                                                                                                                        
                                                                                                                        
*note filterfalse(): 25ce.       predicate, seq                   elements of seq where predicate(elem) fails           ‘filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8’
                                                                                                                        
                                                                                                                        
*note groupby(): 2ba5.           iterable[, key]                  key(v) の値でグループ化したサブイテレータ             ‘groupby(['A','B','DEF'], len) → (1, A B) (3, DEF)’
                                                                                                                        
                                                                                                                        
*note islice(): d43.             seq, [start,] stop [, step]      seq[start:stop:step]                                  ‘islice('ABCDEFG', 2, None) → C D E F G’
                                                                                                                        
                                                                                                                        
*note pairwise(): a16.           iterable                         (p[0], p[1]), (p[1], p[2])                            ‘pairwise('ABCDEFG') → AB BC CD DE EF FG’
                                                                                                                        
                                                                                                                        
*note starmap(): 12fa.           func, seq                        func(*seq[0]), func(*seq[1]), ...                     ‘starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000’
                                                                                                                        
                                                                                                                        
*note takewhile(): 2ba6.         predicate, seq                   seq[0], seq[1], until predicate fails                 ‘takewhile(lambda x: x<5, [1,4,6,3,8]) → 1 4’
                                                                                                                        
                                                                                                                        
*note tee(): 2ba7.               it, n                            it1, it2 , ...  itn 一つのイテレータを n 個に分ける   ‘tee('ABC', 2) → A B C, A B C’
                                                                                                                        
                                                                                                                        
*note zip_longest(): 14b6.       p, q, ...                        (p[0], q[0]), (p[1], q[1]), ...                       ‘zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-’
                                                                                                                        

'組合せイテレータ:'

イテレータ                                         引数                     結果
                                                                            
----------------------------------------------------------------------------------------------------------------------------------------------
                                                                            
*note product(): 152a.                             p, q, ...  [repeat=1]    デカルト積、ネストしたforループと等価
                                                                            
                                                                            
*note permutations(): 1cdd.                        p[, r]                   長さrのタプル列、重複なしのあらゆる並び
                                                                            
                                                                            
*note combinations(): 1529.                        p, r                     長さrのタプル列、ソートされた順で重複なし
                                                                            
                                                                            
*note combinations_with_replacement(): 1499.       p, r                     長さrのタプル列、ソートされた順で重複あり
                                                                            

使用例                                             結果
                                                   
---------------------------------------------------------------------------------------------------------------------
                                                   
‘product('ABCD', repeat=2)’                        ‘AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD’
                                                   
                                                   
‘permutations('ABCD', 2)’                          ‘AB AC AD BA BC BD CA CB CD DA DB DC’
                                                   
                                                   
‘combinations('ABCD', 2)’                          ‘AB AC AD BC BD CD’
                                                   
                                                   
‘combinations_with_replacement('ABCD', 2)’         ‘AA AB AC AD BB BC BD CC CD DD’
                                                   

* Menu:

* Itertool関数::
* Itertools レシピ::


File: python.info,  Node: Itertool関数,  Next: Itertools レシピ,  Up: itertools --- 効率的なループ用のイテレータ生成関数群

5.10.1.1 Itertool関数
.....................

The following functions all construct and return iterators.  Some
provide streams of infinite length, so they should only be accessed by
functions or loops that truncate the stream.

 -- の関数: itertools.accumulate (iterable[, function, *, initial=None])

     Make an iterator that returns accumulated sums or accumulated
     results from other binary functions.

     The 'function' defaults to addition.  The 'function' should accept
     two arguments, an accumulated total and a value from the
     'iterable'.

     If an 'initial' value is provided, the accumulation will start with
     that value and the output will have one more element than the input
     iterable.

     およそ次と等価です:

          def accumulate(iterable, function=operator.add, *, initial=None):
              'Return running totals'
              # accumulate([1,2,3,4,5]) → 1 3 6 10 15
              # accumulate([1,2,3,4,5], initial=100) → 100 101 103 106 110 115
              # accumulate([1,2,3,4,5], operator.mul) → 1 2 6 24 120

              iterator = iter(iterable)
              total = initial
              if initial is None:
                  try:
                      total = next(iterator)
                  except StopIteration:
                      return

              yield total
              for element in iterator:
                  total = function(total, element)
                  yield total

     To compute a running minimum, set 'function' to *note min(): 110b.
     For a running maximum, set 'function' to *note max(): 110c.  Or for
     a running product, set 'function' to *note operator.mul(): 2baa.
     To build an amortization table(1), accumulate the interest and
     apply payments:

          >>> data = [3, 4, 6, 2, 1, 9, 0, 7, 5, 8]
          >>> list(accumulate(data, max))              # running maximum
          [3, 4, 6, 6, 6, 9, 9, 9, 9, 9]
          >>> list(accumulate(data, operator.mul))     # running product
          [3, 12, 72, 144, 144, 1296, 0, 0, 0, 0]

          # Amortize a 5% loan of 1000 with 10 annual payments of 90
          >>> update = lambda balance, payment: round(balance * 1.05) - payment
          >>> list(accumulate(repeat(90, 10), update, initial=1_000))
          [1000, 960, 918, 874, 828, 779, 728, 674, 618, 559, 497]

     最終的な累積値だけを返す類似の関数については *note
     functools.reduce(): 21a. を見てください。

     Added in version 3.2.

     バージョン 3.3 で変更: Added the optional 'function' parameter.

     バージョン 3.8 で変更: オプションの 'initial' パラメータが追加され
     ました。

 -- の関数: itertools.batched (iterable, n, *, strict=False)

     'iterable' から得られるデータを 'n' 個ごとに一つのタプルにまとめま
     す。 一番最後のバッチは 'n' 個より少なくなる可能性があります。

     If 'strict' is true, will raise a *note ValueError: 2ec. if the
     final batch is shorter than 'n'.

     入力の iterable から要素を一つづつ取り出し、サイズが 'n' になるまで
     タプルに溜め込みます。 入力の iterable は遅延評価され、次のタプルを
     作るのに必要なだけ要素が取り出されます。 タプルは、個数が 'n' に到
     達するか、入力の iterable が尽きるとすぐに出力されます:

          >>> flattened_data = ['roses', 'red', 'violets', 'blue', 'sugar', 'sweet']
          >>> unflattened = list(batched(flattened_data, 2))
          >>> unflattened
          [('roses', 'red'), ('violets', 'blue'), ('sugar', 'sweet')]

     およそ次と等価です:

          def batched(iterable, n, *, strict=False):
              # batched('ABCDEFG', 3) → ABC DEF G
              if n < 1:
                  raise ValueError('n must be at least one')
              iterator = iter(iterable)
              while batch := tuple(islice(iterator, n)):
                  if strict and len(batch) != n:
                      raise ValueError('batched(): incomplete batch')
                  yield batch

     Added in version 3.12.

     バージョン 3.13 で変更: Added the 'strict' option.

 -- の関数: itertools.chain (*iterables)

     Make an iterator that returns elements from the first iterable
     until it is exhausted, then proceeds to the next iterable, until
     all of the iterables are exhausted.  This combines multiple data
     sources into a single iterator.  Roughly equivalent to:

          def chain(*iterables):
              # chain('ABC', 'DEF') → A B C D E F
              for iterable in iterables:
                  yield from iterable

 -- メソッド: classmethod chain.from_iterable (iterable)

     *note chain(): 25de. のためのもう一つのコンストラクタです。遅延評価
     される iterable 引数一つから連鎖した入力を受け取ります。この関数は
     、以下のコードとほぼ等価です:

          def from_iterable(iterables):
              # chain.from_iterable(['ABC', 'DEF']) → A B C D E F
              for iterable in iterables:
                  yield from iterable

 -- の関数: itertools.combinations (iterable, r)

     入力 'iterable' の要素からなる長さ 'r' の部分列を返します。

     The output is a subsequence of *note product(): 152a. keeping only
     entries that are subsequences of the 'iterable'.  The length of the
     output is given by *note math.comb(): 8df. which computes ‘n! / r!
     / (n - r)!’ when ‘0 ≤ r ≤ n’ or zero when ‘r > n’.

     The combination tuples are emitted in lexicographic order according
     to the order of the input 'iterable'.  If the input 'iterable' is
     sorted, the output tuples will be produced in sorted order.

     Elements are treated as unique based on their position, not on
     their value.  If the input elements are unique, there will be no
     repeated values within each combination.

     およそ次と等価です:

          def combinations(iterable, r):
              # combinations('ABCD', 2) → AB AC AD BC BD CD
              # combinations(range(4), 3) → 012 013 023 123

              pool = tuple(iterable)
              n = len(pool)
              if r > n:
                  return
              indices = list(range(r))

              yield tuple(pool[i] for i in indices)
              while True:
                  for i in reversed(range(r)):
                      if indices[i] != i + n - r:
                          break
                  else:
                      return
                  indices[i] += 1
                  for j in range(i+1, r):
                      indices[j] = indices[j-1] + 1
                  yield tuple(pool[i] for i in indices)

 -- の関数: itertools.combinations_with_replacement (iterable, r)

     入力 'iterable' から、それぞれの要素が複数回現れることを許して、長
     さ 'r' の要素の部分列を返します。

     The output is a subsequence of *note product(): 152a. that keeps
     only entries that are subsequences (with possible repeated
     elements) of the 'iterable'.  The number of subsequence returned is
     ‘(n + r - 1)! / r! / (n - 1)!’ when ‘n > 0’.

     The combination tuples are emitted in lexicographic order according
     to the order of the input 'iterable'.  if the input 'iterable' is
     sorted, the output tuples will be produced in sorted order.

     Elements are treated as unique based on their position, not on
     their value.  If the input elements are unique, the generated
     combinations will also be unique.

     およそ次と等価です:

          def combinations_with_replacement(iterable, r):
              # combinations_with_replacement('ABC', 2) → AA AB AC BB BC CC

              pool = tuple(iterable)
              n = len(pool)
              if not n and r:
                  return
              indices = [0] * r

              yield tuple(pool[i] for i in indices)
              while True:
                  for i in reversed(range(r)):
                      if indices[i] != n - 1:
                          break
                  else:
                      return
                  indices[i:] = [indices[i] + 1] * (r - i)
                  yield tuple(pool[i] for i in indices)

     Added in version 3.1.

 -- の関数: itertools.compress (data, selectors)

     Make an iterator that returns elements from 'data' where the
     corresponding element in 'selectors' is true.  Stops when either
     the 'data' or 'selectors' iterables have been exhausted.  Roughly
     equivalent to:

          def compress(data, selectors):
              # compress('ABCDEF', [1,0,1,0,1,1]) → A C E F
              return (datum for datum, selector in zip(data, selectors) if selector)

     Added in version 3.1.

 -- の関数: itertools.count (start=0, step=1)

     Make an iterator that returns evenly spaced values beginning with
     'start'.  Can be used with *note map(): 19f. to generate
     consecutive data points or with *note zip(): 1a0. to add sequence
     numbers.  Roughly equivalent to:

          def count(start=0, step=1):
              # count(10) → 10 11 12 13 14 ...
              # count(2.5, 0.5) → 2.5 3.0 3.5 ...
              n = start
              while True:
                  yield n
                  n += step

     When counting with floating-point numbers, better accuracy can
     sometimes be achieved by substituting multiplicative code such as:
     ‘(start + step * i for i in count())’.

     バージョン 3.1 で変更: 'step' 引数が追加され、非整数の引数が許され
     るようになりました。

 -- の関数: itertools.cycle (iterable)

     Make an iterator returning elements from the 'iterable' and saving
     a copy of each.  When the iterable is exhausted, return elements
     from the saved copy.  Repeats indefinitely.  Roughly equivalent to:

          def cycle(iterable):
              # cycle('ABCD') → A B C D A B C D A B C D ...

              saved = []
              for element in iterable:
                  yield element
                  saved.append(element)

              while saved:
                  for element in saved:
                      yield element

     This itertool may require significant auxiliary storage (depending
     on the length of the iterable).

 -- の関数: itertools.dropwhile (predicate, iterable)

     Make an iterator that drops elements from the 'iterable' while the
     'predicate' is true and afterwards returns every element.  Roughly
     equivalent to:

          def dropwhile(predicate, iterable):
              # dropwhile(lambda x: x<5, [1,4,6,3,8]) → 6 3 8

              iterator = iter(iterable)
              for x in iterator:
                  if not predicate(x):
                      yield x
                      break

              for x in iterator:
                  yield x

     Note this does not produce 'any' output until the predicate first
     becomes false, so this itertool may have a lengthy start-up time.

 -- の関数: itertools.filterfalse (predicate, iterable)

     Make an iterator that filters elements from the 'iterable'
     returning only those for which the 'predicate' returns a false
     value.  If 'predicate' is ‘None’, returns the items that are false.
     Roughly equivalent to:

          def filterfalse(predicate, iterable):
              # filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8

              if predicate is None:
                  predicate = bool

              for x in iterable:
                  if not predicate(x):
                      yield x

 -- の関数: itertools.groupby (iterable, key=None)

     同じキーをもつような要素からなる 'iterable' 中のグループに対して、
     キーとグループを返すようなイテレータを作成します。'key' は各要素に
     対するキー値を計算する関数です。キーを指定しない場合や ‘None’ にし
     た場合、'key' 関数のデフォルトは恒等関数になり要素をそのまま返しま
     す。通常、'iterable' は同じキー関数でソート済みである必要があります
     。

     *note groupby(): 2ba5. の操作は Unix の ‘uniq’ フィルターと似ていま
     す。 key 関数の値が変わるたびに休止または新しいグループを生成します
     (このために通常同じ key 関数でソートしておく必要があるのです)。この
     動作は SQL の入力順に関係なく共通の要素を集約する GROUP BY とは違い
     ます。

     返されるグループはそれ自体がイテレータで、 *note groupby(): 2ba5. と
     'iterable' を共有しています。もととなる 'iterable' を共有しているた
     め、 *note groupby(): 2ba5. オブジェクトの要素取り出しを先に進める
     と、それ以前の要素であるグループは見えなくなってしまいます。従って
     、データが後で必要な場合にはリストの形で保存しておく必要があります:

          groups = []
          uniquekeys = []
          data = sorted(data, key=keyfunc)
          for k, g in groupby(data, keyfunc):
              groups.append(list(g))      # Store group iterator as a list
              uniquekeys.append(k)

     *note groupby(): 2ba5. はおよそ次と等価です:

          def groupby(iterable, key=None):
              # [k for k, g in groupby('AAAABBBCCDAABBB')] → A B C D A B
              # [list(g) for k, g in groupby('AAAABBBCCD')] → AAAA BBB CC D

              keyfunc = (lambda x: x) if key is None else key
              iterator = iter(iterable)
              exhausted = False

              def _grouper(target_key):
                  nonlocal curr_value, curr_key, exhausted
                  yield curr_value
                  for curr_value in iterator:
                      curr_key = keyfunc(curr_value)
                      if curr_key != target_key:
                          return
                      yield curr_value
                  exhausted = True

              try:
                  curr_value = next(iterator)
              except StopIteration:
                  return
              curr_key = keyfunc(curr_value)

              while not exhausted:
                  target_key = curr_key
                  curr_group = _grouper(target_key)
                  yield curr_key, curr_group
                  if curr_key == target_key:
                      for _ in curr_group:
                          pass

 -- の関数: itertools.islice (iterable, stop)

 -- の関数: itertools.islice (iterable, start, stop[, step])

     Make an iterator that returns selected elements from the iterable.
     Works like sequence slicing but does not support negative values
     for 'start', 'stop', or 'step'.

     If 'start' is zero or ‘None’, iteration starts at zero.  Otherwise,
     elements from the iterable are skipped until 'start' is reached.

     If 'stop' is ‘None’, iteration continues until the input is
     exhausted, if at all.  Otherwise, it stops at the specified
     position.

     If 'step' is ‘None’, the step defaults to one.  Elements are
     returned consecutively unless 'step' is set higher than one which
     results in items being skipped.

     およそ次と等価です:

          def islice(iterable, *args):
              # islice('ABCDEFG', 2) → A B
              # islice('ABCDEFG', 2, 4) → C D
              # islice('ABCDEFG', 2, None) → C D E F G
              # islice('ABCDEFG', 0, None, 2) → A C E G

              s = slice(*args)
              start = 0 if s.start is None else s.start
              stop = s.stop
              step = 1 if s.step is None else s.step
              if start < 0 or (stop is not None and stop < 0) or step <= 0:
                  raise ValueError

              indices = count() if stop is None else range(max(start, stop))
              next_i = start
              for i, element in zip(indices, iterable):
                  if i == next_i:
                      yield element
                      next_i += step

     If the input is an iterator, then fully consuming the 'islice'
     advances the input iterator by ‘max(start, stop)’ steps regardless
     of the 'step' value.

 -- の関数: itertools.pairwise (iterable)

     Return successive overlapping pairs taken from the input
     'iterable'.

     The number of 2-tuples in the output iterator will be one fewer
     than the number of inputs.  It will be empty if the input iterable
     has fewer than two values.

     およそ次と等価です:

          def pairwise(iterable):
              # pairwise('ABCDEFG') → AB BC CD DE EF FG

              iterator = iter(iterable)
              a = next(iterator, None)

              for b in iterator:
                  yield a, b
                  a = b

     Added in version 3.10.

 -- の関数: itertools.permutations (iterable, r=None)

     Return successive 'r' length permutations of elements(2) from the
     'iterable'.

     'r' が指定されない場合や ‘None’ の場合、'r' はデフォルトで
     'iterable' の長さとなり、可能な最長の順列の全てが生成されます。

     The output is a subsequence of *note product(): 152a. where entries
     with repeated elements have been filtered out.  The length of the
     output is given by *note math.perm(): 8e0. which computes ‘n! / (n
     - r)!’ when ‘0 ≤ r ≤ n’ or zero when ‘r > n’.

     The permutation tuples are emitted in lexicographic order according
     to the order of the input 'iterable'.  If the input 'iterable' is
     sorted, the output tuples will be produced in sorted order.

     Elements are treated as unique based on their position, not on
     their value.  If the input elements are unique, there will be no
     repeated values within a permutation.

     およそ次と等価です:

          def permutations(iterable, r=None):
              # permutations('ABCD', 2) → AB AC AD BA BC BD CA CB CD DA DB DC
              # permutations(range(3)) → 012 021 102 120 201 210

              pool = tuple(iterable)
              n = len(pool)
              r = n if r is None else r
              if r > n:
                  return

              indices = list(range(n))
              cycles = list(range(n, n-r, -1))
              yield tuple(pool[i] for i in indices[:r])

              while n:
                  for i in reversed(range(r)):
                      cycles[i] -= 1
                      if cycles[i] == 0:
                          indices[i:] = indices[i+1:] + indices[i:i+1]
                          cycles[i] = n - i
                      else:
                          j = cycles[i]
                          indices[i], indices[-j] = indices[-j], indices[i]
                          yield tuple(pool[i] for i in indices[:r])
                          break
                  else:
                      return

 -- の関数: itertools.product (*iterables, repeat=1)

     Cartesian product(3) of the input iterables.

     ジェネレータ式の入れ子になった for ループとおよそ等価です。たとえば
     ‘product(A, B)’ は ‘((x,y) for x in A for y in B)’ と同じものを返し
     ます。

     入れ子ループは走行距離計と同じように右端の要素がイテレーションごと
     に更新されていきます。このパターンは辞書式順序を作り出し、入力のイ
     テレート可能オブジェクトたちがソートされていれば、直積タプルもソー
     トされた順に出てきます。

     イテラブル自身との直積を計算するためには、オプションの 'repeat' キ
     ーワード引数に繰り返し回数を指定します。たとえば ‘product(A,
     repeat=4)’ は ‘product(A, A, A, A)’ と同じ意味です。

     この関数は以下のコードとおよそ等価ですが、実際の実装ではメモリ中に
     中間結果を作りません:

          def product(*iterables, repeat=1):
              # product('ABCD', 'xy') → Ax Ay Bx By Cx Cy Dx Dy
              # product(range(2), repeat=3) → 000 001 010 011 100 101 110 111

              if repeat < 0:
                  raise ValueError('repeat argument cannot be negative')
              pools = [tuple(pool) for pool in iterables] * repeat

              result = [[]]
              for pool in pools:
                  result = [x+[y] for x in result for y in pool]

              for prod in result:
                  yield tuple(prod)

     *note product(): 152a. は動作する前に、入力のイテラブルを完全に読み
     取り、直積を生成するためにメモリ内に値を蓄えます。したがって、入力
     が有限の場合に限り有用です。

 -- の関数: itertools.repeat (object[, times])

     Make an iterator that returns 'object' over and over again.  Runs
     indefinitely unless the 'times' argument is specified.

     およそ次と等価です:

          def repeat(object, times=None):
              # repeat(10, 3) → 10 10 10
              if times is None:
                  while True:
                      yield object
              else:
                  for i in range(times):
                      yield object

     'repeat' は 'map' や 'zip' に定数のストリームを与えるためによく利用
     されます:

          >>> list(map(pow, range(10), repeat(2)))
          [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

 -- の関数: itertools.starmap (function, iterable)

     Make an iterator that computes the 'function' using arguments
     obtained from the 'iterable'.  Used instead of *note map(): 19f.
     when argument parameters have already been "pre-zipped" into
     tuples.

     The difference between *note map(): 19f. and *note starmap(): 12fa.
     parallels the distinction between ‘function(a,b)’ and
     ‘function(*c)’.  Roughly equivalent to:

          def starmap(function, iterable):
              # starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000
              for args in iterable:
                  yield function(*args)

 -- の関数: itertools.takewhile (predicate, iterable)

     Make an iterator that returns elements from the 'iterable' as long
     as the 'predicate' is true.  Roughly equivalent to:

          def takewhile(predicate, iterable):
              # takewhile(lambda x: x<5, [1,4,6,3,8]) → 1 4
              for x in iterable:
                  if not predicate(x):
                      break
                  yield x

     Note, the element that first fails the predicate condition is
     consumed from the input iterator and there is no way to access it.
     This could be an issue if an application wants to further consume
     the input iterator after 'takewhile' has been run to exhaustion.
     To work around this problem, consider using more-itertools
     before_and_after()(4) instead.

 -- の関数: itertools.tee (iterable, n=2)

     一つの iterable から 'n' 個の独立したイテレータを返します。

     およそ次と等価です:

          def tee(iterable, n=2):
              if n < 0:
                  raise ValueError
              if n == 0:
                  return ()
              iterator = _tee(iterable)
              result = [iterator]
              for _ in range(n - 1):
                  result.append(_tee(iterator))
              return tuple(result)

          class _tee:

              def __init__(self, iterable):
                  it = iter(iterable)
                  if isinstance(it, _tee):
                      self.iterator = it.iterator
                      self.link = it.link
                  else:
                      self.iterator = it
                      self.link = [None, None]

              def __iter__(self):
                  return self

              def __next__(self):
                  link = self.link
                  if link[1] is None:
                      link[0] = next(self.iterator)
                      link[1] = [None, None]
                  value, self.link = link
                  return value

     When the input 'iterable' is already a tee iterator object, all
     members of the return tuple are constructed as if they had been
     produced by the upstream *note tee(): 2ba7. call.  This "flattening
     step" allows nested *note tee(): 2ba7. calls to share the same
     underlying data chain and to have a single update step rather than
     a chain of calls.

     The flattening property makes tee iterators efficiently peekable:

          def lookahead(tee_iterator):
               "Return the next value without moving the input forward"
               [forked_iterator] = tee(tee_iterator, 1)
               return next(forked_iterator)

          >>> iterator = iter('abcdef')
          >>> [iterator] = tee(iterator, 1)   # Make the input peekable
          >>> next(iterator)                  # Move the iterator forward
          'a'
          >>> lookahead(iterator)             # Check next value
          'b'
          >>> next(iterator)                  # Continue moving forward
          'b'

     ‘tee’ iterators are not threadsafe.  A *note RuntimeError: 244. may
     be raised when simultaneously using iterators returned by the same
     *note tee(): 2ba7. call, even if the original 'iterable' is
     threadsafe.

     *note tee(): 2ba7. はかなり大きなメモリ領域を使用するかもしれません
     (使用するメモリ量はiterableの大きさに依存します)。一般には、一つの
     イテレータが他のイテレータよりも先にほとんどまたは全ての要素を消費
     するような場合には、 *note tee(): 2ba7. よりも *note list(): 24d. を
     使った方が高速です。

 -- の関数: itertools.zip_longest (*iterables, fillvalue=None)

     Make an iterator that aggregates elements from each of the
     'iterables'.

     If the iterables are of uneven length, missing values are filled-in
     with 'fillvalue'.  If not specified, 'fillvalue' defaults to
     ‘None’.

     Iteration continues until the longest iterable is exhausted.

     およそ次と等価です:

          def zip_longest(*iterables, fillvalue=None):
              # zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-

              iterators = list(map(iter, iterables))
              num_active = len(iterators)
              if not num_active:
                  return

              while True:
                  values = []
                  for i, iterator in enumerate(iterators):
                      try:
                          value = next(iterator)
                      except StopIteration:
                          num_active -= 1
                          if not num_active:
                              return
                          iterators[i] = repeat(fillvalue)
                          value = fillvalue
                      values.append(value)
                  yield tuple(values)

     If one of the iterables is potentially infinite, then the *note
     zip_longest(): 14b6. function should be wrapped with something that
     limits the number of calls (for example *note islice(): d43. or
     *note takewhile(): 2ba6.).

   ---------- Footnotes ----------

   (1) https://www.ramseysolutions.com/real-estate/amortization-schedule

   (2) https://www.britannica.com/science/permutation

   (3) https://en.wikipedia.org/wiki/Cartesian_product

   (4) 
https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.before_and_after


File: python.info,  Node: Itertools レシピ,  Prev: Itertool関数,  Up: itertools --- 効率的なループ用のイテレータ生成関数群

5.10.1.2 Itertools レシピ
.........................

この節では、既存の itertools を素材としてツールセットを拡張するためのレ
シピを示します。

The primary purpose of the itertools recipes is educational.  The
recipes show various ways of thinking about individual tools — for
example, that ‘chain.from_iterable’ is related to the concept of
flattening.  The recipes also give ideas about ways that the tools can
be combined — for example, how ‘starmap()’ and ‘repeat()’ can work
together.  The recipes also show patterns for using itertools with the
*note operator: a3. and *note collections: 1e. modules as well as with
the built-in itertools such as ‘map()’, ‘filter()’, ‘reversed()’, and
‘enumerate()’.

A secondary purpose of the recipes is to serve as an incubator.  The
‘accumulate()’, ‘compress()’, and ‘pairwise()’ itertools started out as
recipes.  Currently, the ‘sliding_window()’, ‘derangements()’, and
‘sieve()’ recipes are being tested to see whether they prove their
worth.

Substantially all of these recipes and many, many others can be
installed from the more-itertools(1) project found on the Python Package
Index:

     python -m pip install more-itertools

Many of the recipes offer the same high performance as the underlying
toolset.  Superior memory performance is kept by processing elements one
at a time rather than bringing the whole iterable into memory all at
once.  Code volume is kept small by linking the tools together in a
functional style(2).  High speed is retained by preferring "vectorized"
building blocks over the use of for-loops and *note generators: 126c.
which incur interpreter overhead.

     from itertools import (accumulate, batched, chain, combinations, compress,
          count, cycle, filterfalse, groupby, islice, permutations, product,
          repeat, starmap, tee, zip_longest)
     from collections import Counter, deque
     from contextlib import suppress
     from functools import reduce
     from math import comb, isqrt, prod, sumprod
     from operator import getitem, is_not, itemgetter, mul, neg, truediv


     # ==== Basic one liners ====

     def take(n, iterable):
         "Return first n items of the iterable as a list."
         return list(islice(iterable, n))

     def prepend(value, iterable):
         "Prepend a single value in front of an iterable."
         # prepend(1, [2, 3, 4]) → 1 2 3 4
         return chain([value], iterable)

     def running_mean(iterable):
         "Yield the average of all values seen so far."
         # running_mean([8.5, 9.5, 7.5, 6.5]) -> 8.5 9.0 8.5 8.0
         return map(truediv, accumulate(iterable), count(1))

     def repeatfunc(function, times=None, *args):
         "Repeat calls to a function with specified arguments."
         if times is None:
             return starmap(function, repeat(args))
         return starmap(function, repeat(args, times))

     def flatten(list_of_lists):
         "Flatten one level of nesting."
         return chain.from_iterable(list_of_lists)

     def ncycles(iterable, n):
         "Returns the sequence elements n times."
         return chain.from_iterable(repeat(tuple(iterable), n))

     def loops(n):
         "Loop n times. Like range(n) but without creating integers."
         # for _ in loops(100): ...
         return repeat(None, n)

     def tail(n, iterable):
         "Return an iterator over the last n items."
         # tail(3, 'ABCDEFG') → E F G
         return iter(deque(iterable, maxlen=n))

     def consume(iterator, n=None):
         "Advance the iterator n-steps ahead. If n is None, consume entirely."
         # Use functions that consume iterators at C speed.
         if n is None:
             deque(iterator, maxlen=0)
         else:
             next(islice(iterator, n, n), None)

     def nth(iterable, n, default=None):
         "Returns the nth item or a default value."
         return next(islice(iterable, n, None), default)

     def quantify(iterable, predicate=bool):
         "Given a predicate that returns True or False, count the True results."
         return sum(map(predicate, iterable))

     def first_true(iterable, default=False, predicate=None):
         "Returns the first true value or the *default* if there is no true value."
         # first_true([a, b, c], x) → a or b or c or x
         # first_true([a, b], x, f) → a if f(a) else b if f(b) else x
         return next(filter(predicate, iterable), default)

     def all_equal(iterable, key=None):
         "Returns True if all the elements are equal to each other."
         # all_equal('4٤௪౪໔', key=int) → True
         return len(take(2, groupby(iterable, key))) <= 1


     # ==== Data pipelines ====

     def unique_justseen(iterable, key=None):
         "Yield unique elements, preserving order. Remember only the element just seen."
         # unique_justseen('AAAABBBCCDAABBB') → A B C D A B
         # unique_justseen('ABBcCAD', str.casefold) → A B c A D
         if key is None:
             return map(itemgetter(0), groupby(iterable))
         return map(next, map(itemgetter(1), groupby(iterable, key)))

     def unique_everseen(iterable, key=None):
         "Yield unique elements, preserving order. Remember all elements ever seen."
         # unique_everseen('AAAABBBCCDAABBB') → A B C D
         # unique_everseen('ABBcCAD', str.casefold) → A B c D
         seen = set()
         if key is None:
             for element in filterfalse(seen.__contains__, iterable):
                 seen.add(element)
                 yield element
         else:
             for element in iterable:
                 k = key(element)
                 if k not in seen:
                     seen.add(k)
                     yield element

     def unique(iterable, key=None, reverse=False):
        "Yield unique elements in sorted order. Supports unhashable inputs."
        # unique([[1, 2], [3, 4], [1, 2]]) → [1, 2] [3, 4]
        sequenced = sorted(iterable, key=key, reverse=reverse)
        return unique_justseen(sequenced, key=key)

     def sliding_window(iterable, n):
         "Collect data into overlapping fixed-length chunks or blocks."
         # sliding_window('ABCDEFG', 3) → ABC BCD CDE DEF EFG
         iterator = iter(iterable)
         window = deque(islice(iterator, n - 1), maxlen=n)
         for x in iterator:
             window.append(x)
             yield tuple(window)

     def grouper(iterable, n, *, incomplete='fill', fillvalue=None):
         "Collect data into non-overlapping fixed-length chunks or blocks."
         # grouper('ABCDEFG', 3, fillvalue='x')       → ABC DEF Gxx
         # grouper('ABCDEFG', 3, incomplete='strict') → ABC DEF ValueError
         # grouper('ABCDEFG', 3, incomplete='ignore') → ABC DEF
         iterators = [iter(iterable)] * n
         match incomplete:
             case 'fill':
                 return zip_longest(*iterators, fillvalue=fillvalue)
             case 'strict':
                 return zip(*iterators, strict=True)
             case 'ignore':
                 return zip(*iterators)
             case _:
                 raise ValueError('Expected fill, strict, or ignore')

     def roundrobin(*iterables):
         "Visit input iterables in a cycle until each is exhausted."
         # roundrobin('ABC', 'D', 'EF') → A D E B F C
         # Algorithm credited to George Sakkis
         iterators = map(iter, iterables)
         for num_active in range(len(iterables), 0, -1):
             iterators = cycle(islice(iterators, num_active))
             yield from map(next, iterators)

     def subslices(seq):
         "Return all contiguous non-empty subslices of a sequence."
         # subslices('ABCD') → A AB ABC ABCD B BC BCD C CD D
         slices = starmap(slice, combinations(range(len(seq) + 1), 2))
         return map(getitem, repeat(seq), slices)

     def derangements(iterable, r=None):
         "Produce r length permutations without fixed points."
         # derangements('ABCD') → BADC BCDA BDAC CADB CDAB CDBA DABC DCAB DCBA
         # Algorithm credited to Stefan Pochmann
         seq = tuple(iterable)
         pos = tuple(range(len(seq)))
         have_moved = map(map, repeat(is_not), repeat(pos), permutations(pos, r=r))
         valid_derangements = map(all, have_moved)
         return compress(permutations(seq, r=r), valid_derangements)

     def iter_index(iterable, value, start=0, stop=None):
         "Return indices where a value occurs in a sequence or iterable."
         # iter_index('AABCADEAF', 'A') → 0 1 4 7
         seq_index = getattr(iterable, 'index', None)
         if seq_index is None:
             iterator = islice(iterable, start, stop)
             for i, element in enumerate(iterator, start):
                 if element is value or element == value:
                     yield i
         else:
             stop = len(iterable) if stop is None else stop
             i = start
             with suppress(ValueError):
                 while True:
                     yield (i := seq_index(value, i, stop))
                     i += 1

     def iter_except(function, exception, first=None):
         "Convert a call-until-exception interface to an iterator interface."
         # iter_except(d.popitem, KeyError) → non-blocking dictionary iterator
         with suppress(exception):
             if first is not None:
                 yield first()
             while True:
                 yield function()


     # ==== Mathematical operations ====

     def multinomial(*counts):
         "Number of distinct arrangements of a multiset."
         # Counter('abracadabra').values() → 5 2 2 1 1
         # multinomial(5, 2, 2, 1, 1) → 83160
         return prod(map(comb, accumulate(counts), counts))

     def powerset(iterable):
         "Subsequences of the iterable from shortest to longest."
         # powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)
         s = list(iterable)
         return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))

     def sum_of_squares(iterable):
         "Add up the squares of the input values."
         # sum_of_squares([10, 20, 30]) → 1400
         return sumprod(*tee(iterable))


     # ==== Matrix operations ====

     def reshape(matrix, columns):
         "Reshape a 2-D matrix to have a given number of columns."
         # reshape([(0, 1), (2, 3), (4, 5)], 3) →  (0, 1, 2) (3, 4, 5)
         return batched(chain.from_iterable(matrix), columns, strict=True)

     def transpose(matrix):
         "Swap the rows and columns of a 2-D matrix."
         # transpose([(1, 2, 3), (11, 22, 33)]) → (1, 11) (2, 22) (3, 33)
         return zip(*matrix, strict=True)

     def matmul(m1, m2):
         "Multiply two matrices."
         # matmul([(7, 5), (3, 5)], [(2, 5), (7, 9)]) → (49, 80) (41, 60)
         n = len(m2[0])
         return batched(starmap(sumprod, product(m1, transpose(m2))), n)


     # ==== Polynomial arithmetic ====

     def convolve(signal, kernel):
         """Discrete linear convolution of two iterables.
         Equivalent to polynomial multiplication.

         Convolutions are mathematically commutative; however, the inputs are
         evaluated differently.  The signal is consumed lazily and can be
         infinite. The kernel is fully consumed before the calculations begin.

         Article:  https://betterexplained.com/articles/intuitive-convolution/
         Video:    https://www.youtube.com/watch?v=KuXjwB4LzSA
         """
         # convolve([1, -1, -20], [1, -3]) → 1 -4 -17 60
         # convolve(data, [0.25, 0.25, 0.25, 0.25]) → Moving average (blur)
         # convolve(data, [1/2, 0, -1/2]) → 1st derivative estimate
         # convolve(data, [1, -2, 1]) → 2nd derivative estimate
         kernel = tuple(kernel)[::-1]
         n = len(kernel)
         padded_signal = chain(repeat(0, n-1), signal, repeat(0, n-1))
         windowed_signal = sliding_window(padded_signal, n)
         return map(sumprod, repeat(kernel), windowed_signal)

     def polynomial_from_roots(roots):
         """Compute a polynomial's coefficients from its roots.

            (x - 5) (x + 4) (x - 3)  expands to:   x³ -4x² -17x + 60
         """
         # polynomial_from_roots([5, -4, 3]) → [1, -4, -17, 60]
         factors = zip(repeat(1), map(neg, roots))
         return list(reduce(convolve, factors, [1]))

     def polynomial_eval(coefficients, x):
         """Evaluate a polynomial at a specific value.

         Computes with better numeric stability than Horner's method.
         """
         # Evaluate x³ -4x² -17x + 60 at x = 5
         # polynomial_eval([1, -4, -17, 60], x=5) → 0
         n = len(coefficients)
         if not n:
             return type(x)(0)
         powers = map(pow, repeat(x), reversed(range(n)))
         return sumprod(coefficients, powers)

     def polynomial_derivative(coefficients):
         """Compute the first derivative of a polynomial.

            f(x)  =  x³ -4x² -17x + 60
            f'(x) = 3x² -8x  -17
         """
         # polynomial_derivative([1, -4, -17, 60]) → [3, -8, -17]
         n = len(coefficients)
         powers = reversed(range(1, n))
         return list(map(mul, coefficients, powers))


     # ==== Number theory ====

     def sieve(n):
         "Primes less than n."
         # sieve(30) → 2 3 5 7 11 13 17 19 23 29
         if n > 2:
             yield 2
         data = bytearray((0, 1)) * (n // 2)
         for p in iter_index(data, 1, start=3, stop=isqrt(n) + 1):
             data[p*p : n : p+p] = bytes(len(range(p*p, n, p+p)))
         yield from iter_index(data, 1, start=3)

     def factor(n):
         "Prime factors of n."
         # factor(99) → 3 3 11
         # factor(1_000_000_000_000_007) → 47 59 360620266859
         # factor(1_000_000_000_000_403) → 1000000000000403
         for prime in sieve(isqrt(n) + 1):
             while not n % prime:
                 yield prime
                 n //= prime
                 if n == 1:
                     return
         if n > 1:
             yield n

     def is_prime(n):
         "Return True if n is prime."
         # is_prime(1_000_000_000_000_403) → True
         return n > 1 and next(factor(n)) == n

     def totient(n):
         "Count of natural numbers up to n that are coprime to n."
         # https://mathworld.wolfram.com/TotientFunction.html
         # totient(12) → 4 because len([1, 5, 7, 11]) == 4
         for prime in set(factor(n)):
             n -= n // prime
         return n

   ---------- Footnotes ----------

   (1) https://pypi.org/project/more-itertools/

   (2) https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf


File: python.info,  Node: functools --- 高階関数と呼び出し可能オブジェクトの操作,  Next: operator --- 関数形式の標準演算子,  Prev: itertools --- 効率的なループ用のイテレータ生成関数群,  Up: 関数型プログラミング用モジュール

5.10.2 ‘functools’ -- 高階関数と呼び出し可能オブジェクトの操作
--------------------------------------------------------------

'ソースコード:' Lib/functools.py(1)

__________________________________________________________________

The ‘functools’ module is for higher-order functions: functions that act
on or return other functions.  In general, any callable object can be
treated as a function for the purposes of this module.

The ‘functools’ module defines the following functions:

 -- の関数: @functools.cache (user_function)

     簡単で軽量な無制限の関数キャッシュです。 "メモ化 (memoize)"(2) とも
     呼ばれることがあります。

     Returns the same as ‘lru_cache(maxsize=None)’, creating a thin
     wrapper around a dictionary lookup for the function arguments.
     Because it never needs to evict old values, this is smaller and
     faster than *note lru_cache(): be2. with a size limit.

     例えば:

          @cache
          def factorial(n):
              return n * factorial(n-1) if n else 1

          >>> factorial(10)   # no previously cached result, makes 11 recursive calls
          3628800
          >>> factorial(5)    # no new calls, just returns the cached result
          120
          >>> factorial(12)   # two new recursive calls, factorial(10) is cached
          479001600

     The cache is threadsafe so that the wrapped function can be used in
     multiple threads.  This means that the underlying data structure
     will remain coherent during concurrent updates.

     It is possible for the wrapped function to be called more than once
     if another thread makes an additional call before the initial call
     has been completed and cached.

     Added in version 3.9.

 -- の関数: @functools.cached_property (func)

     クラスのメソッドを、値を一度だけ計算して通常の属性としてキャッシュ
     するプロパティに変換します。キャッシュはインスタンスの生存期間にわ
     たって有効です。*note property(): 4b3. に似ていて、さらにキャッシュ
     を行います。計算コストが高く、一度計算すればその後は不変であるよう
     なインスタンスのプロパティに対して有用です。

     以下はプログラム例です:

          class DataSet:

              def __init__(self, sequence_of_numbers):
                  self._data = tuple(sequence_of_numbers)

              @cached_property
              def stdev(self):
                  return statistics.stdev(self._data)

     *note cached_property(): 763. のしくみは *note property(): 4b3. と
     やや異なります。通常のプロパティは、セッター (setter) が定義されな
     い限り書き込みを禁止します。対照的に、 'cached_property' は書き込み
     を許します。

     'cached_property' デコレータはルックアップテーブルで、同名の属性が
     存在しない場合のみ動作します。動作した場合、 'cached_property' は同
     名の属性に書き込みを行います。その後の属性の読み込みと書き込みは
     'cached_property' メソッドより優先され、通常の属性のように働きます
     。

     キャッシュされた値は属性を削除することで取り除くことができます。こ
     れにより 'cached_property' メソッドを再度実行することが可能になりま
     す。

     The 'cached_property' does not prevent a possible race condition in
     multi-threaded usage.  The getter function could run more than once
     on the same instance, with the latest run setting the cached value.
     If the cached property is idempotent or otherwise not harmful to
     run more than once on an instance, this is fine.  If
     synchronization is needed, implement the necessary locking inside
     the decorated getter function or around the cached property access.

     このデコレータは PEP 412(3) のキー共有辞書のインターフェースを持ち
     ます。これは、インスタンス辞書がより多くのスペースを使う可能性があ
     ることを意味します。

     また、このデコレータは各インスタンスの ‘__dict__’ 属性が可変のマッ
     ピングであることを要求します。すなわち、このデコレータはいくつかの
     型、たとえばメタクラス (型インスタンスの ‘__dict__’ 属性はクラスの
     名前空間に対する読み込み専用のプロキシであるため) や、 ‘__slots__’
     を指定していてその中に ‘__dict__’ を含まない型 (それ自体が
     ‘__dict__’ 属性を提供しないため) に対しては動作しないことを意味しま
     す。

     If a mutable mapping is not available or if space-efficient key
     sharing is desired, an effect similar to *note cached_property():
     763. can also be achieved by stacking *note property(): 4b3. on top
     of *note lru_cache(): be2.  See *note
     メソッド呼び出しをキャッシュするには どうしたらいいですか？: 2baf.
     for more details on how this differs from *note cached_property():
     763.

     Added in version 3.8.

     バージョン 3.12 で変更: Prior to Python 3.12, ‘cached_property’
     included an undocumented lock to ensure that in multi-threaded
     usage the getter function was guaranteed to run only once per
     instance.  However, the lock was per-property, not per-instance,
     which could result in unacceptably high lock contention.  In Python
     3.12+ this locking is removed.

 -- の関数: functools.cmp_to_key (func)

     古いスタイルの比較関数を *note key function: 1006. に変換します。
     key 関数を受け取るツール (*note sorted(): dc7, *note min(): 110b,
     *note max(): 110c, *note heapq.nlargest(): 29a5, *note
     heapq.nsmallest(): 29a6, *note itertools.groupby(): 2ba5. など) と
     共に使用します。この関数は、主に比較関数を使っていた Python 2 から
     プログラムの移行のための変換ツールとして使われます。

     比較関数は2つの引数を受け取り、それらを比較し、 "より小さい" 場合は
     負の数を、同値の場合には 0 を、 "より大きい" 場合には正の数を返す、
     あらゆる呼び出し可能オブジェクトです。key 関数は呼び出し可能オブジ
     ェクトで、1つの引数を受け取り、ソートキーとして使われる値を返します
     。

     以下はプログラム例です:

          sorted(iterable, key=cmp_to_key(locale.strcoll))  # locale-aware sort order

     ソートの例と簡単なチュートリアルは *note ソートのテクニック: 13f3.
     を参照して下さい。

     Added in version 3.2.

 -- の関数: @functools.lru_cache (user_function)

 -- の関数: @functools.lru_cache (maxsize=128, typed=False)

     関数をメモ化用の呼び出し可能オブジェクトでラップし、最近の呼び出し
     最大 'maxsize' 回まで保存するするデコレータです。高価な関数や I/O に
     束縛されている関数を定期的に同じ引数で呼び出すときに、時間を節約で
     きます。

     The cache is threadsafe so that the wrapped function can be used in
     multiple threads.  This means that the underlying data structure
     will remain coherent during concurrent updates.

     It is possible for the wrapped function to be called more than once
     if another thread makes an additional call before the initial call
     has been completed and cached.

     結果のキャッシュには辞書が使われるので、関数の位置引数およびキーワ
     ード引数は *note ハッシュ可能: 824. でなくてはなりません。

     引数のパターンが異なる場合は、異なる呼び出しと見なされ別々のキャッ
     シュエントリーとなります。 例えば、 ‘f(a=1, b=2)’ と ‘f(b=2, a=1)’
     はキーワード引数の順序が異なっているので、2つの別個のキャッシュエン
     トリーになります。

     'user_function' が指定された場合、それは呼び出し可能でなければなり
     ません。これにより 'lru_cache' デコレータがユーザー関数に直接適用で
     きるようになります。このとき 'maxsize' の値はデフォルトの 128 とな
     ります:

          @lru_cache
          def count_vowels(sentence):
              return sum(sentence.count(vowel) for vowel in 'AEIOUaeiou')

     'maxsize' が ‘None’ に設定された場合は、LRU 機能は無効化され、キャ
     ッシュは際限無く大きくなります。

     If 'typed' is set to true, function arguments of different types
     will be cached separately.  If 'typed' is false, the implementation
     will usually regard them as equivalent calls and only cache a
     single result.  (Some types such as 'str' and 'int' may be cached
     separately even when 'typed' is false.)

     Note, type specificity applies only to the function's immediate
     arguments rather than their contents.  The scalar arguments,
     ‘Decimal(42)’ and ‘Fraction(42)’ are be treated as distinct calls
     with distinct results.  In contrast, the tuple arguments
     ‘('answer', Decimal(42))’ and ‘('answer', Fraction(42))’ are
     treated as equivalent.

     The wrapped function is instrumented with a ‘cache_parameters()’
     function that returns a new *note dict: 183. showing the values for
     'maxsize' and 'typed'.  This is for information purposes only.
     Mutating the values has no effect.

     To help measure the effectiveness of the cache and tune the
     'maxsize' parameter, the wrapped function is instrumented with a
     ‘cache_info()’ function that returns a *note named tuple: 85e.
     showing 'hits', 'misses', 'maxsize' and 'currsize'.

     The decorator also provides a ‘cache_clear()’ function for clearing
     or invalidating the cache.

     元々の基底の関数には、 ‘__wrapped__’ 属性を通してアクセスできます。
     これはキャッシュを回避して、または関数を別のキャッシュでラップして
     、内観するのに便利です。

     The cache keeps references to the arguments and return values until
     they age out of the cache or until the cache is cleared.

     If a method is cached, the ‘self’ instance argument is included in
     the cache.  See *note メソッド呼び出しをキャッシュするには
     どうしたらいいですか？: 2baf.

     An LRU (least recently used) cache(4) works best when the most
     recent calls are the best predictors of upcoming calls (for
     example, the most popular articles on a news server tend to change
     each day).  The cache's size limit assures that the cache does not
     grow without bound on long-running processes such as web servers.

     In general, the LRU cache should only be used when you want to
     reuse previously computed values.  Accordingly, it doesn't make
     sense to cache functions with side-effects, functions that need to
     create distinct mutable objects on each call (such as generators
     and async functions), or impure functions such as time() or
     random().

     静的 web コンテンツ の LRU キャッシュの例:

          @lru_cache(maxsize=32)
          def get_pep(num):
              'Retrieve text of a Python Enhancement Proposal'
              resource = f'https://peps.python.org/pep-{num:04d}'
              try:
                  with urllib.request.urlopen(resource) as s:
                      return s.read()
              except urllib.error.HTTPError:
                  return 'Not Found'

          >>> for n in 8, 290, 308, 320, 8, 218, 320, 279, 289, 320, 9991:
          ...     pep = get_pep(n)
          ...     print(n, len(pep))

          >>> get_pep.cache_info()
          CacheInfo(hits=3, misses=8, maxsize=32, currsize=8)

     キャッシュを使って 動的計画法(5) の技法を実装し、フィボナッチ数(6)
     を効率よく計算する例:

          @lru_cache(maxsize=None)
          def fib(n):
              if n < 2:
                  return n
              return fib(n-1) + fib(n-2)

          >>> [fib(n) for n in range(16)]
          [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]

          >>> fib.cache_info()
          CacheInfo(hits=28, misses=16, maxsize=None, currsize=16)

     Added in version 3.2.

     バージョン 3.3 で変更: 'typed' オプションが追加されました。

     バージョン 3.8 で変更: 'user_function' オプションが追加されました。

     バージョン 3.9 で変更: Added the function ‘cache_parameters()’

 -- の関数: @functools.total_ordering

     ひとつ以上の拡張順序比較メソッド (rich comparison ordering methods)
     を定義したクラスを受け取り、残りを実装するクラスデコレータです。こ
     のデコレータは全ての拡張順序比較演算をサポートするための労力を軽減
     します:

     The class must define one of *note __lt__(): 14b8, *note __le__():
     1522, *note __gt__(): 1523, or *note __ge__(): 1524.  In addition,
     the class should supply an *note __eq__(): cf2. method.

     例えば:

          @total_ordering
          class Student:
              def _is_valid_operand(self, other):
                  return (hasattr(other, "lastname") and
                          hasattr(other, "firstname"))
              def __eq__(self, other):
                  if not self._is_valid_operand(other):
                      return NotImplemented
                  return ((self.lastname.lower(), self.firstname.lower()) ==
                          (other.lastname.lower(), other.firstname.lower()))
              def __lt__(self, other):
                  if not self._is_valid_operand(other):
                      return NotImplemented
                  return ((self.lastname.lower(), self.firstname.lower()) <
                          (other.lastname.lower(), other.firstname.lower()))

          注釈: このデコレータにより、このデコレータにより、行儀の良い（
          well behaved）全順序型を簡単に作ることができますが、その代償と
          して実行速度は遅く、比較メソッドの演繹によってのスタックトレー
          スは複雑になります。性能ベンチマークにより、これがアプリケーシ
          ョンのボトルネックになっていることがわかった場合は、代わりに 6
          つの拡張比較メソッドをすべて実装すれば、簡単にスピードアップを
          図れるでしょう。

          注釈: This decorator makes no attempt to override methods that
          have been declared in the class 'or its superclasses'.
          Meaning that if a superclass defines a comparison operator,
          'total_ordering' will not implement it again, even if the
          original method is abstract.

     Added in version 3.2.

     バージョン 3.4 で変更: Returning ‘NotImplemented’ from the
     underlying comparison function for unrecognised types is now
     supported.

 -- データ: functools.Placeholder

     A singleton object used as a sentinel to reserve a place for
     positional arguments when calling *note partial(): 217. and *note
     partialmethod(): 218.

     Added in version 3.14.

 -- の関数: functools.partial (func, /, *args, **keywords)

     新しい *note partial オブジェクト: 219. を返します。このオブジェク
     トは呼び出されると位置引数 'args' とキーワード引数 'keywords' 付き
     で呼び出された 'func' のように振る舞います。呼び出しに際してさらな
     る引数が渡された場合、それらは 'args' に付け加えられます。追加のキ
     ーワード引数が渡された場合には、それらで 'keywords' を拡張または上
     書きします。おおよそ次のコードと等価です:

          def partial(func, /, *args, **keywords):
              def newfunc(*more_args, **more_keywords):
                  return func(*args, *more_args, **(keywords | more_keywords))
              newfunc.func = func
              newfunc.args = args
              newfunc.keywords = keywords
              return newfunc

     The ‘partial()’ function is used for partial function application
     which "freezes" some portion of a function's arguments and/or
     keywords resulting in a new object with a simplified signature.
     For example, *note partial(): 217. can be used to create a callable
     that behaves like the *note int(): 19b. function where the 'base'
     argument defaults to ‘2’:

          >>> basetwo = partial(int, base=2)
          >>> basetwo.__doc__ = 'Convert base 2 string to an int.'
          >>> basetwo('10010')
          18

     If *note Placeholder: 216. sentinels are present in 'args', they
     will be filled first when ‘partial()’ is called.  This makes it
     possible to pre-fill any positional argument with a call to
     ‘partial()’; without ‘Placeholder’, only the chosen number of
     leading positional arguments can be pre-filled.

     If any ‘Placeholder’ sentinels are present, all must be filled at
     call time:

          >>> say_to_world = partial(print, Placeholder, Placeholder, "world!")
          >>> say_to_world('Hello', 'dear')
          Hello dear world!

     Calling ‘say_to_world('Hello')’ raises a *note TypeError: 198,
     because only one positional argument is provided, but there are two
     placeholders that must be filled in.

     If ‘partial()’ is applied to an existing ‘partial()’ object,
     ‘Placeholder’ sentinels of the input object are filled in with new
     positional arguments.  A placeholder can be retained by inserting a
     new ‘Placeholder’ sentinel to the place held by a previous
     ‘Placeholder’:

          >>> from functools import partial, Placeholder as _
          >>> remove = partial(str.replace, _, _, '')
          >>> message = 'Hello, dear dear world!'
          >>> remove(message, ' dear')
          'Hello, world!'
          >>> remove_dear = partial(remove, _, ' dear')
          >>> remove_dear(message)
          'Hello, world!'
          >>> remove_first_dear = partial(remove_dear, _, 1)
          >>> remove_first_dear(message)
          'Hello, dear world!'

     ‘Placeholder’ cannot be passed to ‘partial()’ as a keyword
     argument.

     バージョン 3.14 で変更: Added support for *note Placeholder: 216.
     in positional arguments.

 -- クラス: functools.partialmethod (func, /, *args, **keywords)

     *note partial: 217. と似た動作をする新しい *note partialmethod:
     218. 記述子 (デスクリプタ) を返します。直接呼び出しではなく、メソッ
     ド定義としての使用が目的であることのみが、partial とは異なります。

     'func' は、*note descriptor: 1881. または呼び出し可能オブジェクトで
     ある必要があります (通常の関数など、両方の性質を持つオブジェクトは
     記述子として扱われます。)

     When 'func' is a descriptor (such as a normal Python function,
     *note classmethod(): 48e, *note staticmethod(): 453, *note
     abstractmethod(): 1297. or another instance of *note partialmethod:
     218.), calls to ‘__get__’ are delegated to the underlying
     descriptor, and an appropriate *note partial object: 219. returned
     as the result.

     'func' が記述子以外の呼び出し可能オブジェクトである場合、適切な束縛
     メソッドが動的に作成されます。この func は、メソッドとして使用され
     た場合、Python の通常の関数と同様に動作します。 *note
     partialmethod: 218. コンストラクタに 'args' と 'keywords' が渡され
     るよりも前に、 'self' 引数が最初の位置引数として挿入されます。

     以下はプログラム例です:

          >>> class Cell:
          ...     def __init__(self):
          ...         self._alive = False
          ...     @property
          ...     def alive(self):
          ...         return self._alive
          ...     def set_state(self, state):
          ...         self._alive = bool(state)
          ...     set_alive = partialmethod(set_state, True)
          ...     set_dead = partialmethod(set_state, False)
          ...
          >>> c = Cell()
          >>> c.alive
          False
          >>> c.set_alive()
          >>> c.alive
          True

     Added in version 3.4.

 -- の関数: functools.reduce (function, iterable, /[, initial])

     Apply 'function' of two arguments cumulatively to the items of
     'iterable', from left to right, so as to reduce the iterable to a
     single value.  For example, ‘reduce(lambda x, y: x+y, [1, 2, 3, 4,
     5])’ calculates ‘((((1+2)+3)+4)+5)’.  The left argument, 'x', is
     the accumulated value and the right argument, 'y', is the update
     value from the 'iterable'.  If the optional 'initial' is present,
     it is placed before the items of the iterable in the calculation,
     and serves as a default when the iterable is empty.  If 'initial'
     is not given and 'iterable' contains only one item, the first item
     is returned.

     およそ次と等価です:

          initial_missing = object()

          def reduce(function, iterable, /, initial=initial_missing):
              it = iter(iterable)
              if initial is initial_missing:
                  value = next(it)
              else:
                  value = initial
              for element in it:
                  value = function(value, element)
              return value

     全ての中間値を返すイテレータについては *note
     itertools.accumulate(): bf0. を参照してください。

     バージョン 3.14 で変更: 'initial' is now supported as a keyword
     argument.

 -- の関数: @functools.singledispatch

     関数を *note シングルディスパッチ: be3. *note ジェネリック関数:
     be4. に変換します。

     To define a generic function, decorate it with the
     ‘@singledispatch’ decorator.  When defining a function using
     ‘@singledispatch’, note that the dispatch happens on the type of
     the first argument:

          >>> from functools import singledispatch
          >>> @singledispatch
          ... def fun(arg, verbose=False):
          ...     if verbose:
          ...         print("Let me just say,", end=" ")
          ...     print(arg)

     To add overloaded implementations to the function, use the
     ‘register()’ attribute of the generic function, which can be used
     as a decorator.  For functions annotated with types, the decorator
     will infer the type of the first argument automatically:

          >>> @fun.register
          ... def _(arg: int, verbose=False):
          ...     if verbose:
          ...         print("Strength in numbers, eh?", end=" ")
          ...     print(arg)
          ...
          >>> @fun.register
          ... def _(arg: list, verbose=False):
          ...     if verbose:
          ...         print("Enumerate this:")
          ...     for i, elem in enumerate(arg):
          ...         print(i, elem)

     *note typing.Union: 2a8. can also be used:

          >>> @fun.register
          ... def _(arg: int | float, verbose=False):
          ...     if verbose:
          ...         print("Strength in numbers, eh?", end=" ")
          ...     print(arg)
          ...
          >>> from typing import Union
          >>> @fun.register
          ... def _(arg: Union[list, set], verbose=False):
          ...     if verbose:
          ...         print("Enumerate this:")
          ...     for i, elem in enumerate(arg):
          ...         print(i, elem)
          ...

     型アノテーションを使っていないコードについては、デコレータに適切な
     型引数を明示的に渡せます:

          >>> @fun.register(complex)
          ... def _(arg, verbose=False):
          ...     if verbose:
          ...         print("Better than complicated.", end=" ")
          ...     print(arg.real, arg.imag)
          ...

     For code that dispatches on a collections type (e.g., ‘list’), but
     wants to typehint the items of the collection (e.g., ‘list[int]’),
     the dispatch type should be passed explicitly to the decorator
     itself with the typehint going into the function definition:

          >>> @fun.register(list)
          ... def _(arg: list[int], verbose=False):
          ...     if verbose:
          ...         print("Enumerate this:")
          ...     for i, elem in enumerate(arg):
          ...         print(i, elem)

          注釈: At runtime the function will dispatch on an instance of
          a list regardless of the type contained within the list i.e.
          ‘[1,2,3]’ will be dispatched the same as ‘["foo", "bar",
          "baz"]’.  The annotation provided in this example is for
          static type checkers only and has no runtime impact.

     To enable registering *note lambdas: 2bb3. and pre-existing
     functions, the *note register(): 2bb2. attribute can also be used
     in a functional form:

          >>> def nothing(arg, verbose=False):
          ...     print("Nothing.")
          ...
          >>> fun.register(type(None), nothing)

     The *note register(): 2bb2. attribute returns the undecorated
     function.  This enables decorator stacking, *note pickling: ab, and
     the creation of unit tests for each variant independently:

          >>> @fun.register(float)
          ... @fun.register(Decimal)
          ... def fun_num(arg, verbose=False):
          ...     if verbose:
          ...         print("Half of your number:", end=" ")
          ...     print(arg / 2)
          ...
          >>> fun_num is fun
          False

     汎用関数は、呼び出されると 1 つ目の引数の型でディスパッチします:

          >>> fun("Hello, world.")
          Hello, world.
          >>> fun("test.", verbose=True)
          Let me just say, test.
          >>> fun(42, verbose=True)
          Strength in numbers, eh? 42
          >>> fun(['spam', 'spam', 'eggs', 'spam'], verbose=True)
          Enumerate this:
          0 spam
          1 spam
          2 eggs
          3 spam
          >>> fun(None)
          Nothing.
          >>> fun(1.23)
          0.615

     特定の型について登録された実装が存在しない場合、その型のメソッド解
     決順序が、汎用の実装をさらに検索するために使用されます。
     ‘@singledispatch’ でデコレートされた元の関数は基底の *note object:
     c7e. 型に登録されます。これは、他によりよい実装が見つからないことを
     意味します。

     抽象基底クラス (*note abstract base class: 13ce.) に対して実装が登
     録されると、基底クラスの仮想サブクラスに対してもその実装がディスパ
     ッチされます:

          >>> from collections.abc import Mapping
          >>> @fun.register
          ... def _(arg: Mapping, verbose=False):
          ...     if verbose:
          ...         print("Keys & Values")
          ...     for key, value in arg.items():
          ...         print(key, "=>", value)
          ...
          >>> fun({"a": "b"})
          a => b

     指定された型に対して、汎用関数がどの実装を選択するかを確認するには
     、‘dispatch()’ 属性を使用します:

          >>> fun.dispatch(float)
          <function fun_num at 0x1035a2840>
          >>> fun.dispatch(dict)    # note: default implementation
          <function fun at 0x103fe0000>

     登録されたすべての実装にアクセスするには、読み出し専用の ‘registry’
     属性を使用します:

          >>> fun.registry.keys()
          dict_keys([<class 'NoneType'>, <class 'int'>, <class 'object'>,
                    <class 'decimal.Decimal'>, <class 'list'>,
                    <class 'float'>])
          >>> fun.registry[float]
          <function fun_num at 0x1035a2840>
          >>> fun.registry[object]
          <function fun at 0x103fe0000>

     Added in version 3.4.

     バージョン 3.7 で変更: The *note register(): 2bb2. attribute now
     supports using type annotations.

     バージョン 3.11 で変更: The *note register(): 2bb2. attribute now
     supports *note typing.Union: 2a8. as a type annotation.

 -- クラス: functools.singledispatchmethod (func)

     メソッドを *note シングルディスパッチ: be3. *note ジェネリック関数:
     be4. に変換します。

     To define a generic method, decorate it with the
     ‘@singledispatchmethod’ decorator.  When defining a method using
     ‘@singledispatchmethod’, note that the dispatch happens on the type
     of the first non-'self' or non-'cls' argument:

          class Negator:
              @singledispatchmethod
              def neg(self, arg):
                  raise NotImplementedError("Cannot negate a")

              @neg.register
              def _(self, arg: int):
                  return -arg

              @neg.register
              def _(self, arg: bool):
                  return not arg

     ‘@singledispatchmethod’ supports nesting with other decorators such
     as *note @classmethod: 48e.  Note that to allow for
     ‘dispatcher.register’, ‘singledispatchmethod’ must be the 'outer
     most' decorator.  Here is the ‘Negator’ class with the ‘neg’
     methods bound to the class, rather than an instance of the class:

          class Negator:
              @singledispatchmethod
              @classmethod
              def neg(cls, arg):
                  raise NotImplementedError("Cannot negate a")

              @neg.register
              @classmethod
              def _(cls, arg: int):
                  return -arg

              @neg.register
              @classmethod
              def _(cls, arg: bool):
                  return not arg

     The same pattern can be used for other similar decorators: *note
     @staticmethod: 453, *note @~abc.abstractmethod: 1297, and others.

     Added in version 3.8.

 -- の関数: functools.update_wrapper (wrapper, wrapped,
          assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES)

     Update a 'wrapper' function to look like the 'wrapped' function.
     The optional arguments are tuples to specify which attributes of
     the original function are assigned directly to the matching
     attributes on the wrapper function and which attributes of the
     wrapper function are updated with the corresponding attributes from
     the original function.  The default values for these arguments are
     the module level constants ‘WRAPPER_ASSIGNMENTS’ (which assigns to
     the wrapper function's *note __module__: 234a, *note __name__:
     14ec, *note __qualname__: 2349, *note __annotations__: 13f0, *note
     __type_params__: 234d, and *note __doc__: 13f1, the documentation
     string) and ‘WRAPPER_UPDATES’ (which updates the wrapper function's
     *note __dict__: 14ea, i.e.  the instance dictionary).

     内観や別の目的 (例えば、 *note lru_cache(): be2. のようなキャッシュ
     するデコレータの回避) のために元の関数にアクセスできるように、この
     関数はラップされている関数を参照するラッパーに自動的に
     ‘__wrapped__’ 属性を追加します。

     この関数は主に関数を包んでラッパーを返す *note デコレータ: 93a. 関
     数の中で使われるよう意図されています。もしラッパー関数がアップデー
     トされないとすると、返される関数のメタデータは元の関数の定義ではな
     くラッパー関数の定義を反映してしまい、これは通常あまり有益ではあり
     ません。

     *note update_wrapper(): 1223. は、関数以外の呼び出し可能オブジェク
     トにも使えます。 'assigned' または 'updated' で指名され、ラップされ
     るオブジェクトに存在しない属性は、すべて無視されます (すなわち、ラ
     ッパー関数にそれらの属性を設定しようとは試みられません)。しかし、
     'updated' で指名された属性がラッパー関数自身に存在しないなら *note
     AttributeError: 5f0. が送出されます。

     バージョン 3.2 で変更: The ‘__wrapped__’ attribute is now
     automatically added.  The *note __annotations__: 13f0. attribute is
     now copied by default.  Missing attributes no longer trigger an
     *note AttributeError: 5f0.

     バージョン 3.4 で変更: ラップされた関数が ‘__wrapped__’ を定義して
     いない場合でも、 ‘__wrapped__’ が常にラップされた関数を参照するよう
     になりました。(bpo-17482(7) を参照)

     バージョン 3.12 で変更: The *note __type_params__: 234d. attribute
     is now copied by default.

 -- の関数: @functools.wraps (wrapped, assigned=WRAPPER_ASSIGNMENTS,
          updated=WRAPPER_UPDATES)

     これはラッパー関数を定義するときに *note update_wrapper(): 1223. を
     関数デコレータとして呼び出す便宜関数です。これは
     ‘partial(update_wrapper, wrapped=wrapped, assigned=assigned,
     updated=updated)’ と等価です。例えば:

          >>> from functools import wraps
          >>> def my_decorator(f):
          ...     @wraps(f)
          ...     def wrapper(*args, **kwds):
          ...         print('Calling decorated function')
          ...         return f(*args, **kwds)
          ...     return wrapper
          ...
          >>> @my_decorator
          ... def example():
          ...     """Docstring"""
          ...     print('Called example function')
          ...
          >>> example()
          Calling decorated function
          Called example function
          >>> example.__name__
          'example'
          >>> example.__doc__
          'Docstring'

     Without the use of this decorator factory, the name of the example
     function would have been ‘'wrapper'’, and the docstring of the
     original ‘example()’ would have been lost.

* Menu:

* partial オブジェクト::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/functools.py

   (2) https://en.wikipedia.org/wiki/Memoization

   (3) https://peps.python.org/pep-0412/

   (4) 
https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_(LRU)

   (5) https://ja.wikipedia.org/wiki/動的計画法

   (6) https://ja.wikipedia.org/wiki/フィボナッチ数

   (7) https://bugs.python.org/issue?@action=redirect&bpo=17482


File: python.info,  Node: partial オブジェクト,  Up: functools --- 高階関数と呼び出し可能オブジェクトの操作

5.10.2.1 ‘partial’ オブジェクト
...............................

*note partial: 217. オブジェクトは、 *note partial(): 217. 関数によって
作られる呼び出し可能オブジェクトです。オブジェクトには読み出し専用の属性
が三つあります:

 -- の属性: partial.func

     呼び出し可能オブジェクトまたは関数です。 *note partial: 217. オブジ
     ェクトの呼び出しは新しい引数とキーワードと共に *note func: 2bb5. に
     転送されます。

 -- の属性: partial.args

     最左の位置引数で、 *note partial: 217. オブジェクトの呼び出し時にそ
     の呼び出しの際の位置引数の前に追加されます。

 -- の属性: partial.keywords

     *note partial: 217. オブジェクトの呼び出し時に渡されるキーワード引
     数です。

*note partial: 217. objects are like *note function objects: 59c. in
that they are callable, weak referenceable, and can have attributes.
There are some important differences.  For instance, the *note __name__:
1272. and *note __doc__: b21. attributes are not created automatically.


File: python.info,  Node: operator --- 関数形式の標準演算子,  Prev: functools --- 高階関数と呼び出し可能オブジェクトの操作,  Up: 関数型プログラミング用モジュール

5.10.3 ‘operator’ -- 関数形式の標準演算子
-----------------------------------------

'ソースコード:' Lib/operator.py(1)

__________________________________________________________________

The ‘operator’ module exports a set of efficient functions corresponding
to the intrinsic operators of Python.  For example, ‘operator.add(x, y)’
is equivalent to the expression ‘x+y’.  Many function names are those
used for special methods, without the double underscores.  For backward
compatibility, many of these have a variant with the double underscores
kept.  The variants without the double underscores are preferred for
clarity.

これらの関数は、オブジェクト比較、論理演算、数学演算、シーケンス演算をす
るものに分類されます。

オブジェクト比較関数は全てのオブジェクトで有効で、関数の名前はサポートす
る拡張比較演算子からとられています:

 -- の関数: operator.lt (a, b)
 -- の関数: operator.le (a, b)
 -- の関数: operator.eq (a, b)
 -- の関数: operator.ne (a, b)
 -- の関数: operator.ge (a, b)
 -- の関数: operator.gt (a, b)
 -- の関数: operator.__lt__ (a, b)
 -- の関数: operator.__le__ (a, b)
 -- の関数: operator.__eq__ (a, b)
 -- の関数: operator.__ne__ (a, b)
 -- の関数: operator.__ge__ (a, b)
 -- の関数: operator.__gt__ (a, b)

     'a' と 'b' の "拡張比較 (rich comparisons)" を行います。具体的には
     、 ‘lt(a, b)’ は ‘a < b’ 、 ‘le(a, b)’ は ‘a <= b’ 、 ‘eq(a, b)’ は
     ‘a == b’ 、 ‘ne(a, b)’ は ‘a != b’ 、 ‘gt(a, b)’ は ‘a > b’ 、そし
     て ‘ge(a, b)’ は ‘a >= b’ と等価です。これらの関数はどのような値を
     返してもよく、ブール値として解釈できてもできなくてもかまいません。
     拡張比較の詳細については *note 比較: 24d0. を参照してください。

論理演算もまた全てのオブジェクトに対して適用でき、真理値判定、同一性判定
およびブール演算をサポートします:

 -- の関数: operator.not_ (obj)
 -- の関数: operator.__not__ (obj)

     *note not: 24da. 'obj' の結果を返します。(オブジェクトインスタンス
     には ‘__not__()’ メソッドは無いので注意してください; インタープリタ
     ーコアがこの演算を定義しているだけです。結果は *note __bool__():
     14ed. および *note __len__(): 178f. メソッドに影響されます。)

 -- の関数: operator.truth (obj)

     'obj' が真の場合 *note True: e07. を返し、そうでない場合 *note
     False: d2b. を返します。この関数は *note bool: 3c3. のコンストラク
     タ呼び出しと同等です。

 -- の関数: operator.is_ (a, b)

     ‘a is b’ を返します。オブジェクトの同一性を判定します。

 -- の関数: operator.is_not (a, b)

     ‘a is not b’ を返します。オブジェクトの同一性を判定します。

 -- の関数: operator.is_none (a)

     Return ‘a is None’.  Tests object identity.

     Added in version 3.14.

 -- の関数: operator.is_not_none (a)

     Return ‘a is not None’.  Tests object identity.

     Added in version 3.14.

演算子で最も多いのは数学演算およびビット単位の演算です:

 -- の関数: operator.abs (obj)
 -- の関数: operator.__abs__ (obj)

     'obj' の絶対値を返します。

 -- の関数: operator.add (a, b)
 -- の関数: operator.__add__ (a, b)

     数値 'a' および 'b' について ‘a + b’ を返します。

 -- の関数: operator.and_ (a, b)
 -- の関数: operator.__and__ (a, b)

     'a' と 'b' のビット単位論理積を返します。

 -- の関数: operator.floordiv (a, b)
 -- の関数: operator.__floordiv__ (a, b)

     ‘a // b’ を返します。

 -- の関数: operator.index (a)
 -- の関数: operator.__index__ (a)

     整数に変換された 'a' を返します。‘a.__index__()’ と同等です。

     バージョン 3.10 で変更: 結果は常に厳密な *note int: 19b. 型です。 以
     前は、結果は ‘int’ のサブクラスのインスタンスのこともありました。

 -- の関数: operator.inv (obj)
 -- の関数: operator.invert (obj)
 -- の関数: operator.__inv__ (obj)
 -- の関数: operator.__invert__ (obj)

     'obj' のビット単位反転を返します。‘~obj’ と同じです。

 -- の関数: operator.lshift (a, b)
 -- の関数: operator.__lshift__ (a, b)

     'a' の 'b' ビット左シフトを返します。

 -- の関数: operator.mod (a, b)
 -- の関数: operator.__mod__ (a, b)

     ‘a % b’ を返します。

 -- の関数: operator.mul (a, b)
 -- の関数: operator.__mul__ (a, b)

     数値 'a' および 'b' について ‘a * b’ を返します。

 -- の関数: operator.matmul (a, b)
 -- の関数: operator.__matmul__ (a, b)

     ‘a @ b’ を返します。

     Added in version 3.5.

 -- の関数: operator.neg (obj)
 -- の関数: operator.__neg__ (obj)

     負の 'obj' (‘-obj’) を返します。

 -- の関数: operator.or_ (a, b)
 -- の関数: operator.__or__ (a, b)

     'a' と 'b' のビット単位論理和を返します。

 -- の関数: operator.pos (obj)
 -- の関数: operator.__pos__ (obj)

     正の 'obj' (‘+obj’) を返します。

 -- の関数: operator.pow (a, b)
 -- の関数: operator.__pow__ (a, b)

     数値 'a' および 'b' について ‘a ** b’ を返します。

 -- の関数: operator.rshift (a, b)
 -- の関数: operator.__rshift__ (a, b)

     'a' の 'b' ビット右シフトを返します。

 -- の関数: operator.sub (a, b)
 -- の関数: operator.__sub__ (a, b)

     ‘a - b’ を返します。

 -- の関数: operator.truediv (a, b)
 -- の関数: operator.__truediv__ (a, b)

     2/3 が 0 ではなく 0.66 となるような ‘a / b’ を返します。 "真の" 除
     算としても知られています。

 -- の関数: operator.xor (a, b)
 -- の関数: operator.__xor__ (a, b)

     'a' および 'b' のビット単位排他的論理和を返します。

シーケンスを扱う演算子（いくつかの演算子はマッピングも扱います）には以下
のようなものがあります:

 -- の関数: operator.concat (a, b)
 -- の関数: operator.__concat__ (a, b)

     シーケンス 'a' および 'b' について ‘a + b’ を返します。

 -- の関数: operator.contains (a, b)
 -- の関数: operator.__contains__ (a, b)

     ‘b in a’ の判定結果を返します。被演算子が左右反転しているので注意し
     てください。

 -- の関数: operator.countOf (a, b)

     'a' の中に 'b' が出現する回数を返します。

 -- の関数: operator.delitem (a, b)
 -- の関数: operator.__delitem__ (a, b)

     'a' でインデクスが 'b' の値を削除します。

 -- の関数: operator.getitem (a, b)
 -- の関数: operator.__getitem__ (a, b)

     'a' でインデクスが 'b' の値を返します。

 -- の関数: operator.indexOf (a, b)

     'a' で最初に 'b' が出現する場所のインデクスを返します。

 -- の関数: operator.setitem (a, b, c)
 -- の関数: operator.__setitem__ (a, b, c)

     'a' でインデクスが 'b' の値を 'c' に設定します。

 -- の関数: operator.length_hint (obj, default=0)

     オブジェクト 'obj' の概算の長さを返します。最初に実際の長さを、次に
     *note object.__length_hint__(): 110f. を使って概算の長さを、そして
     最後にデフォルトの値を返そうとします。

     Added in version 3.4.

次の操作は呼び出し可能オブジェクト (callable) で動作します。

 -- の関数: operator.call (obj, /, *args, **kwargs)
 -- の関数: operator.__call__ (obj, /, *args, **kwargs)

     ‘obj(*args, **kwargs)’ を返します。

     Added in version 3.11.

The ‘operator’ module also defines tools for generalized attribute and
item lookups.  These are useful for making fast field extractors as
arguments for *note map(): 19f, *note sorted(): dc7, *note
itertools.groupby(): 2ba5, or other functions that expect a function
argument.

 -- の関数: operator.attrgetter (attr)

 -- の関数: operator.attrgetter (*attrs)

     演算対象から 'attr' を取得する呼び出し可能なオブジェクトを返します
     。二つ以上の属性を要求された場合には、属性のタプルを返します。属性
     名はドットを含むこともできます。例えば:

        * ‘f = attrgetter('name')’ とした後で、‘f(b)’ を呼び出すと
          ‘b.name’ を返します。

        * ‘f = attrgetter('name', 'date')’ とした後で、‘f(b)’ を呼び出す
          と ‘(b.name, b.date)’ を返します。

        * ‘f = attrgetter('name.first', 'name.last')’ とした後で、‘f(b)’
          を呼び出すと ‘(b.name.first, b.name.last)’ を返します。

     次と等価です:

          def attrgetter(*items):
              if any(not isinstance(item, str) for item in items):
                  raise TypeError('attribute name must be a string')
              if len(items) == 1:
                  attr = items[0]
                  def g(obj):
                      return resolve_attr(obj, attr)
              else:
                  def g(obj):
                      return tuple(resolve_attr(obj, attr) for attr in items)
              return g

          def resolve_attr(obj, attr):
              for name in attr.split("."):
                  obj = getattr(obj, name)
              return obj

 -- の関数: operator.itemgetter (item)

 -- の関数: operator.itemgetter (*items)

     演算対象からその *note __getitem__(): 588. メソッドを使って 'item'
     を取得する呼び出し可能なオブジェクトを返します。 二つ以上のアイテム
     を要求された場合には、アイテムのタプルを返します。例えば:

        * ‘f = itemgetter(2)’ とした後で、‘f(r)’ を呼び出すと ‘r[2]’ を
          返します。

        * ‘g = itemgetter(2, 5, 3)’ とした後で、‘g(r)’ を呼び出すと
          ‘(r[2], r[5], r[3])’ を返します。

     次と等価です:

          def itemgetter(*items):
              if len(items) == 1:
                  item = items[0]
                  def g(obj):
                      return obj[item]
              else:
                  def g(obj):
                      return tuple(obj[item] for item in items)
              return g

     アイテムは被演算子の *note __getitem__(): 588. メソッドが受け付ける
     どんな型でも構いません。辞書ならば任意の *note ハッシュ可能: 824. な
     値を受け付けます。リスト、タプル、文字列などはインデックスかスライ
     スを受け付けます:

          >>> itemgetter(1)('ABCDEFG')
          'B'
          >>> itemgetter(1, 3, 5)('ABCDEFG')
          ('B', 'D', 'F')
          >>> itemgetter(slice(2, None))('ABCDEFG')
          'CDEFG'
          >>> soldier = dict(rank='captain', name='dotterbart')
          >>> itemgetter('rank')(soldier)
          'captain'

     *note itemgetter(): c57. を使って特定のフィールドをタプルレコードか
     ら取り出す例:

          >>> inventory = [('apple', 3), ('banana', 2), ('pear', 5), ('orange', 1)]
          >>> getcount = itemgetter(1)
          >>> list(map(getcount, inventory))
          [3, 2, 5, 1]
          >>> sorted(inventory, key=getcount)
          [('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)]

 -- の関数: operator.methodcaller (name, /, *args, **kwargs)

     引数の 'name' メソッドを呼び出す呼び出し可能オブジェクトを返します
     。追加の引数および/またはキーワード引数が与えられると、これらもその
     メソッドに引き渡されます。例えば:

        * ‘f = methodcaller('name')’ とした後で、‘f(b)’ を呼び出すと
          ‘b.name()’ を返します。

        * ‘f = methodcaller('name', 'foo', bar=1)’ とした後で、‘f(b)’ を
          呼び出すと ‘b.name('foo', bar=1)’ を返します。

     次と等価です:

          def methodcaller(name, /, *args, **kwargs):
              def caller(obj):
                  return getattr(obj, name)(*args, **kwargs)
              return caller

* Menu:

* 演算子から関数への対応表::
* インプレース (in-place) 演算子: インプレース in-place 演算子.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/operator.py


File: python.info,  Node: 演算子から関数への対応表,  Next: インプレース in-place 演算子,  Up: operator --- 関数形式の標準演算子

5.10.3.1 演算子から関数への対応表
.................................

This table shows how abstract operations correspond to operator symbols
in the Python syntax and the functions in the ‘operator’ module.

演算                        操作                          関数
                                                          
------------------------------------------------------------------------------------------------------
                                                          
加算                        ‘a + b’                       ‘add(a, b)’
                                                          
                                                          
結合                        ‘seq1 + seq2’                 ‘concat(seq1, seq2)’
                                                          
                                                          
包含判定                    ‘obj in seq’                  ‘contains(seq, obj)’
                                                          
                                                          
除算                        ‘a / b’                       ‘truediv(a, b)’
                                                          
                                                          
除算                        ‘a // b’                      ‘floordiv(a, b)’
                                                          
                                                          
ビット単位論理積            ‘a & b’                       ‘and_(a, b)’
                                                          
                                                          
ビット単位排他的論理和      ‘a ^ b’                       ‘xor(a, b)’
                                                          
                                                          
ビット単位反転              ‘~ a’                         ‘invert(a)’
                                                          
                                                          
ビット単位論理和            ‘a | b’                       ‘or_(a, b)’
                                                          
                                                          
冪乗                        ‘a ** b’                      ‘pow(a, b)’
                                                          
                                                          
同一性                      ‘a is b’                      ‘is_(a, b)’
                                                          
                                                          
同一性                      ‘a is not b’                  ‘is_not(a, b)’
                                                          
                                                          
同一性                      ‘a is None’                   ‘is_none(a)’
                                                          
                                                          
同一性                      ‘a is not None’               ‘is_not_none(a)’
                                                          
                                                          
インデクス指定の代入        ‘obj[k] = v’                  ‘setitem(obj, k, v)’
                                                          
                                                          
インデクス指定の削除        ‘del obj[k]’                  ‘delitem(obj, k)’
                                                          
                                                          
インデクス指定              ‘obj[k]’                      ‘getitem(obj, k)’
                                                          
                                                          
左シフト                    ‘a << b’                      ‘lshift(a, b)’
                                                          
                                                          
剰余                        ‘a % b’                       ‘mod(a, b)’
                                                          
                                                          
乗算                        ‘a * b’                       ‘mul(a, b)’
                                                          
                                                          
行列の乗算                  ‘a @ b’                       ‘matmul(a, b)’
                                                          
                                                          
(算術) 負                   ‘- a’                         ‘neg(a)’
                                                          
                                                          
(論理) 否                   ‘not a’                       ‘not_(a)’
                                                          
                                                          
正                          ‘+ a’                         ‘pos(a)’
                                                          
                                                          
右シフト                    ‘a >> b’                      ‘rshift(a, b)’
                                                          
                                                          
スライス指定の代入          ‘seq[i:j] = values’           ‘setitem(seq, slice(i, j), values)’
                                                          
                                                          
スライス指定の削除          ‘del seq[i:j]’                ‘delitem(seq, slice(i, j))’
                                                          
                                                          
スライス指定                ‘seq[i:j]’                    ‘getitem(seq, slice(i, j))’
                                                          
                                                          
文字列書式化                ‘s % obj’                     ‘mod(s, obj)’
                                                          
                                                          
減算                        ‘a - b’                       ‘sub(a, b)’
                                                          
                                                          
真理値判定                  ‘obj’                         ‘truth(obj)’
                                                          
                                                          
順序付け                    ‘a < b’                       ‘lt(a, b)’
                                                          
                                                          
順序付け                    ‘a <= b’                      ‘le(a, b)’
                                                          
                                                          
等価性                      ‘a == b’                      ‘eq(a, b)’
                                                          
                                                          
不等性                      ‘a != b’                      ‘ne(a, b)’
                                                          
                                                          
順序付け                    ‘a >= b’                      ‘ge(a, b)’
                                                          
                                                          
順序付け                    ‘a > b’                       ‘gt(a, b)’
                                                          


File: python.info,  Node: インプレース in-place 演算子,  Prev: 演算子から関数への対応表,  Up: operator --- 関数形式の標準演算子

5.10.3.2 インプレース (in-place) 演算子
.......................................

多くの演算に「インプレース」版があります。 以下の関数はそうした演算子の
通常の文法に比べてより素朴な呼び出し方を提供します。たとえば、 *note 文:
2bfc. ‘x += y’ は ‘x = operator.iadd(x, y)’ と等価です。別の言い方をする
と、 ‘z = operator.iadd(x, y)’ は複合文 ‘z = x; z += y’ と等価です。

なお、これらの例では、インプレースメソッドが呼び出されたとき、計算と代入
は二段階に分けて行われます。以下に挙げるインプレース関数は、インプレース
メソッドを呼び出してその第一段階だけを行います。第二段階の代入は扱われま
せん。

文字列、数、タプルのようなイミュータブルなターゲットでは、更新された値が
計算されますが、入力変数に代入し返されはしません。

     >>> a = 'hello'
     >>> iadd(a, ' world')
     'hello world'
     >>> a
     'hello'

リストや辞書のようなミュータブルなターゲットでは、インプレースメソッドは
更新を行うので、その後に代入をする必要はありません。

     >>> s = ['h', 'e', 'l', 'l', 'o']
     >>> iadd(s, [' ', 'w', 'o', 'r', 'l', 'd'])
     ['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
     >>> s
     ['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']

 -- の関数: operator.iadd (a, b)
 -- の関数: operator.__iadd__ (a, b)

     ‘a = iadd(a, b)’ は ‘a += b’ と等価です。

 -- の関数: operator.iand (a, b)
 -- の関数: operator.__iand__ (a, b)

     ‘a = iand(a, b)’ は ‘a &= b’ と等価です。

 -- の関数: operator.iconcat (a, b)
 -- の関数: operator.__iconcat__ (a, b)

     ‘a = iconcat(a, b)’ は二つのシーケンス 'a' と 'b' に対し ‘a += b’ と
     等価です。

 -- の関数: operator.ifloordiv (a, b)
 -- の関数: operator.__ifloordiv__ (a, b)

     ‘a = ifloordiv(a, b)’ は ‘a //= b’ と等価です。

 -- の関数: operator.ilshift (a, b)
 -- の関数: operator.__ilshift__ (a, b)

     ‘a = ilshift(a, b)’ は ‘a <<= b’ と等価です。

 -- の関数: operator.imod (a, b)
 -- の関数: operator.__imod__ (a, b)

     ‘a = imod(a, b)’ は ‘a %= b’ と等価です。

 -- の関数: operator.imul (a, b)
 -- の関数: operator.__imul__ (a, b)

     ‘a = imul(a, b)’ は ‘a *= b’ と等価です。

 -- の関数: operator.imatmul (a, b)
 -- の関数: operator.__imatmul__ (a, b)

     ‘a = imatmul(a, b)’ は ‘a @= b’ と等価です。

     Added in version 3.5.

 -- の関数: operator.ior (a, b)
 -- の関数: operator.__ior__ (a, b)

     ‘a = ior(a, b)’ は ‘a |= b’ と等価です。

 -- の関数: operator.ipow (a, b)
 -- の関数: operator.__ipow__ (a, b)

     ‘a = ipow(a, b)’ は ‘a **= b’ と等価です。

 -- の関数: operator.irshift (a, b)
 -- の関数: operator.__irshift__ (a, b)

     ‘a = irshift(a, b)’ は ‘a >>= b’ と等価です。

 -- の関数: operator.isub (a, b)
 -- の関数: operator.__isub__ (a, b)

     ‘a = isub(a, b)’ は ‘a -= b’ と等価です。

 -- の関数: operator.itruediv (a, b)
 -- の関数: operator.__itruediv__ (a, b)

     ‘a = itruediv(a, b)’ は ‘a /= b’ と等価です。

 -- の関数: operator.ixor (a, b)
 -- の関数: operator.__ixor__ (a, b)

     ‘a = ixor(a, b)’ は ‘a ^= b’ と等価です。


File: python.info,  Node: ファイルとディレクトリへのアクセス,  Next: データの永続化,  Prev: 関数型プログラミング用モジュール,  Up: Python 標準ライブラリ

5.11 ファイルとディレクトリへのアクセス
=======================================

この章で説明されるモジュールはディスクのファイルやディレクトリを扱います
。たとえば、ファイルの属性を読むためのモジュール、ファイルパスを移植可能
な方式で操作する、テンポラリファイルを作成するためのモジュールです。この
章の完全な一覧は:

* Menu:

* pathlib: pathlib --- オブジェクト指向のファイルシステムパス. オブジェクト指向のファイルシステムパス
* os.path: os path --- 一般的なパス名操作. 一般的なパス名操作
* stat: stat --- stat の結果を解釈する. stat() の結果を解釈する
* filecmp: filecmp --- ファイルとディレクトリの比較. ファイルとディレクトリの比較
* tempfile: tempfile --- 一時ファイルやディレクトリの作成. 一時ファイルやディレクトリの作成
* glob: glob --- Unix 形式のパス名のパターン展開. Unix 形式のパス名のパターン展開
* fnmatch: fnmatch --- Unix のファイル名パターンマッチ. Unix のファイル名パターンマッチ
* linecache: linecache --- テキストラインへのランダムアクセス. テキストラインへのランダムアクセス
* shutil: shutil --- 高水準のファイル操作. 高水準のファイル操作


File: python.info,  Node: pathlib --- オブジェクト指向のファイルシステムパス,  Next: os path --- 一般的なパス名操作,  Up: ファイルとディレクトリへのアクセス

5.11.1 ‘pathlib’ -- オブジェクト指向のファイルシステムパス
----------------------------------------------------------

Added in version 3.4.

'ソースコード:' Lib/pathlib/(1)

__________________________________________________________________

このモジュールはファイルシステムのパスを表すクラスを提供していて、様々な
オペレーティングシステムについての適切な意味論をそれらのクラスに持たせて
います。 Path クラスは *note 純粋パス: 2c1e. と *note 具象パス: 2c1f. か
らなります。 純粋パスは I/O を伴わない純粋な計算操作を提供します。 具象
パスは純粋パスを継承していますが、 I/O 操作も提供しています。

[image src="python-figures/pathlib-inheritance.png" alt="Inheritance diagram showing the classes available in pathlib. The most basic class is PurePath, which has three direct subclasses: PurePosixPath, PureWindowsPath, and Path. Further to these four classes, there are two classes that use multiple inheritance: PosixPath subclasses PurePosixPath and Path, and WindowsPath subclasses PureWindowsPath and Path."]


あなたが今までこのモジュールを使用したことがない場合や、タスクに適してい
るのがどのクラスかわからない場合は、 *note Path: 266. はきっとあなたに必
要なものでしょう。 *note Path: 266. はコードが実行されているプラットフォ
ーム用の *note 具象パス: 2c1f. のインスタンスを作成します。

純粋パスは、以下のようないくつかの特殊なケースで有用です:

  1. Unix マシン上で Windows のパスを扱いたいとき (またはその逆)。Unix 上
     で実行しているときに *note WindowsPath: 2c20. のインスタンスを作成
     することはできませんが、*note PureWindowsPath: 1a75. なら可能になり
     ます。

  2. 実際に OS にアクセスすることなしにパスを操作するだけのコードを確認
     したいとき。この場合、純粋クラスのインスタンスを一つ作成すれば、そ
     れが OS にアクセスすることはないので便利です。

参考
....

PEP 428(2): The pathlib module - オブジェクト指向のファイルシステムパス
。

参考
....

文字列による低水準のパス操作の場合は *note os.path: a6. も使用できます。

* Menu:

* 基本的な使い方: 基本的な使い方<2>.
* 例外: 例外<6>.
* 純粋パス::
* 具象パス::
* Pattern language::
* glob モジュールとの比較::
* os と os.path モジュールの比較: os と os path モジュールの比較.
* プロトコル::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/pathlib/

   (2) https://peps.python.org/pep-0428/


File: python.info,  Node: 基本的な使い方<2>,  Next: 例外<6>,  Up: pathlib --- オブジェクト指向のファイルシステムパス

5.11.1.1 基本的な使い方
.......................

メインクラスをインポートします:

     >>> from pathlib import Path

サブディレクトリの一覧を取得します:

     >>> p = Path('.')
     >>> [x for x in p.iterdir() if x.is_dir()]
     [PosixPath('.hg'), PosixPath('docs'), PosixPath('dist'),
      PosixPath('__pycache__'), PosixPath('build')]

このディレクトリツリー内の Python ソースファイルの一覧を取得します:

     >>> list(p.glob('**/*.py'))
     [PosixPath('test_pathlib.py'), PosixPath('setup.py'),
      PosixPath('pathlib.py'), PosixPath('docs/conf.py'),
      PosixPath('build/lib/pathlib.py')]

ディレクトリツリー内を移動します:

     >>> p = Path('/etc')
     >>> q = p / 'init.d' / 'reboot'
     >>> q
     PosixPath('/etc/init.d/reboot')
     >>> q.resolve()
     PosixPath('/etc/rc.d/init.d/halt')

パスのプロパティを問い合わせます:

     >>> q.exists()
     True
     >>> q.is_dir()
     False

ファイルを開きます:

     >>> with q.open() as f: f.readline()
     ...
     '#!/bin/bash\n'


File: python.info,  Node: 例外<6>,  Next: 純粋パス,  Prev: 基本的な使い方<2>,  Up: pathlib --- オブジェクト指向のファイルシステムパス

5.11.1.2 例外
.............

 -- 例外: pathlib.UnsupportedOperation

     *note NotImplementedError: 36b. を継承した例外です。パスオブジェク
     トがサポートしていない操作を行おうとした時に送出されます。

     Added in version 3.13.


File: python.info,  Node: 純粋パス,  Next: 具象パス,  Prev: 例外<6>,  Up: pathlib --- オブジェクト指向のファイルシステムパス

5.11.1.3 純粋パス
.................

純粋パスオブジェクトは実際にファイルシステムにアクセスしないパス操作処理
を提供します。これらのクラスにアクセスするには 3 つの方法があり、それら
を 'フレーバー' と呼んでいます:

 -- クラス: pathlib.PurePath (*pathsegments)

     システムのパスのフレーバーを表すジェネリッククラスです (インスタン
     スを作成することで *note PurePosixPath: 2c24. または *note
     PureWindowsPath: 1a75. のどちらかが作成されます):

          >>> PurePath('setup.py')      # Running on a Unix machine
          PurePosixPath('setup.py')

     'pathsegments' の各要素は、パスの構成要素を表す文字列か、パスオブジ
     ェクトなどの、 *note os.PathLike: e4b. インターフェースを実装するオ
     ブジェクトである必要があります。 *note os.PathLike: e4b. インターフ
     ェースでは、 *note __fspath__(): e4c. メソッドが文字列を返します:

          >>> PurePath('foo', 'some/path', 'bar')
          PurePosixPath('foo/some/path/bar')
          >>> PurePath(Path('foo'), Path('bar'))
          PurePosixPath('foo/bar')

     'pathsegments' が空のとき、現在のディレクトリとみなされます:

          >>> PurePath()
          PurePosixPath('.')

     あるパス構成要素が絶対パスである場合、それより前の要素はすべて無視
     されます (*note os.path.join(): 19a9. と同様):

          >>> PurePath('/etc', '/usr', 'lib64')
          PurePosixPath('/usr/lib64')
          >>> PureWindowsPath('c:/Windows', 'd:bar')
          PureWindowsPath('d:bar')

     Windowsの場合、ルート相対パス (例えば ‘r'\foo'’) があってもドライブ
     名はそのまま変わりません:

          >>> PureWindowsPath('c:/Windows', '/Program Files')
          PureWindowsPath('c:/Program Files')

     単一スラッシュと等価な複数スラッシュやシングルドットは簡略化されま
     すが、ダブルドット (‘'..'’) や先頭に位置するダブルスラッシュ
     (‘'//'’) は簡略化されません。 これは、様々な理由でパスの意味が簡略
     化した場合と異なってしまうからです (例: シンボリックリンク、UNCパス
     ):

          >>> PurePath('foo//bar')
          PurePosixPath('foo/bar')
          >>> PurePath('//foo/bar')
          PurePosixPath('//foo/bar')
          >>> PurePath('foo/./bar')
          PurePosixPath('foo/bar')
          >>> PurePath('foo/../bar')
          PurePosixPath('foo/../bar')

     (通常 ‘PurePosixPath('foo/../bar')’ は ‘PurePosixPath('bar')’ と等
     価になりますが、‘foo’ が他のディレクトリへのシンボリックリンクの場
     合は等価になりません)

     純粋パスオブジェクトは *note os.PathLike: e4b. インターフェースを実
     装しており、そのインターフェースを受理する箇所ならどこでも使用する
     ことができます。

     バージョン 3.6 で変更: *note os.PathLike: e4b. インターフェースがサ
     ポートされました。

 -- クラス: pathlib.PurePosixPath (*pathsegments)

     *note PurePath: 6cd. のサブクラスです。このパスフレーバーは非
     Windows パスを表します:

          >>> PurePosixPath('/etc/hosts')
          PurePosixPath('/etc/hosts')

     'pathsegments' の指定は *note PurePath: 6cd. と同じです。

 -- クラス: pathlib.PureWindowsPath (*pathsegments)

     *note PurePath: 6cd. のサブクラスです。このパスフレーバー UNC
     paths(1) を含む Windows ファイルシステムパスを表します:

          >>> PureWindowsPath('c:/', 'Users', 'Ximénez')
          PureWindowsPath('c:/Users/Ximénez')
          >>> PureWindowsPath('//server/share/file')
          PureWindowsPath('//server/share/file')

     'pathsegments' の指定は *note PurePath: 6cd. と同じです。

これらクラスはあらゆるシステムコールを行わないため、起動しているシステム
にかかわらずインスタンスを作成できます。

* Menu:

* 全般的な性質::
* 演算子::
* 個別の構成要素へのアクセス::
* メソッドとプロパティ::

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Path_(computing)#UNC


File: python.info,  Node: 全般的な性質,  Next: 演算子,  Up: 純粋パス

5.11.1.4 全般的な性質
.....................

パスオブジェクトはイミュータブルで *note ハッシュ可能: 824. です。同じフ
レーバーのパスオブジェクトは比較ならびに順序付け可能です。これらのプロパ
ティは、フレーバーのケースフォールディング (訳注: 比較のために正規化する
こと、例えば全て大文字にする) のセマンティクスに従います。

     >>> PurePosixPath('foo') == PurePosixPath('FOO')
     False
     >>> PureWindowsPath('foo') == PureWindowsPath('FOO')
     True
     >>> PureWindowsPath('FOO') in { PureWindowsPath('foo') }
     True
     >>> PureWindowsPath('C:') < PureWindowsPath('d:')
     True

異なるフレーバーのパスオブジェクト同士の比較は等価になることはなく、順序
付けもできません:

     >>> PureWindowsPath('foo') == PurePosixPath('foo')
     False
     >>> PureWindowsPath('foo') < PurePosixPath('foo')
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: '<' not supported between instances of 'PureWindowsPath' and 'PurePosixPath'


File: python.info,  Node: 演算子,  Next: 個別の構成要素へのアクセス,  Prev: 全般的な性質,  Up: 純粋パス

5.11.1.5 演算子
...............

スラッシュ演算子を使って、 *note os.path.join(): 19a9. のように子パスを
作成することができます。 スラッシュの右側が絶対パスである場合、左側のパ
スは無視されます。 Windows環境で、右側のパスがルート相対パス (例:
‘r'\foo'’) である場合、ドライブ名はリセットされません:

     >>> p = PurePath('/etc')
     >>> p
     PurePosixPath('/etc')
     >>> p / 'init.d' / 'apache2'
     PurePosixPath('/etc/init.d/apache2')
     >>> q = PurePath('bin')
     >>> '/usr' / q
     PurePosixPath('/usr/bin')
     >>> p / '/an_absolute_path'
     PurePosixPath('/an_absolute_path')
     >>> PureWindowsPath('c:/Windows', '/Program Files')
     PureWindowsPath('c:/Program Files')

*note os.PathLike: e4b. を実装したオブジェクトが受理できる箇所ならどこで
も、パスオブジェクトが使用できます:

     >>> import os
     >>> p = PurePath('/etc')
     >>> os.fspath(p)
     '/etc'

パスオブジェクトの文字列表現はそのシステム自身の Raw ファイルシステムパ
ス (ネイティブの形式、例えば Windows では区切り文字がバックスラッシュ) に
なり、文字列としてファイルパスを取るあらゆる関数に渡すことができます:

     >>> p = PurePath('/etc')
     >>> str(p)
     '/etc'
     >>> p = PureWindowsPath('c:/Program Files')
     >>> str(p)
     'c:\\Program Files'

同様に、パスオブジェクトを *note bytes: 192. で呼び出すと、Raw ファイル
システムパスを *note os.fsencode(): e4f. でエンコードされたバイト列オブ
ジェクトで返します:

     >>> bytes(p)
     b'/etc'

     注釈: *note bytes: 192. での呼び出しは Unix 上での使用のみ推奨しま
     す。Windows では Unicode 形式が標準的なファイルシステムパス表現にな
     ります。


File: python.info,  Node: 個別の構成要素へのアクセス,  Next: メソッドとプロパティ,  Prev: 演算子,  Up: 純粋パス

5.11.1.6 個別の構成要素へのアクセス
...................................

パスの個別の "構成要素" へアクセスするには、以下のプロパティを使用します
:

 -- の属性: PurePath.parts

     パスのさまざまな構成要素へのアクセス手段を提供するタプルになります:

          >>> p = PurePath('/usr/bin/python3')
          >>> p.parts
          ('/', 'usr', 'bin', 'python3')

          >>> p = PureWindowsPath('c:/Program Files/PSF')
          >>> p.parts
          ('c:\\', 'Program Files', 'PSF')

     (ドライブ名とローカルルートは単一要素にまとめられます)


File: python.info,  Node: メソッドとプロパティ,  Prev: 個別の構成要素へのアクセス,  Up: 純粋パス

5.11.1.7 メソッドとプロパティ
.............................

純粋パスは以下のメソッドとプロパティを提供します:

 -- の属性: PurePath.parser

     低レベルのパスのパースと結合に使用される *note os.path: a6. モジュ
     ールの実装。‘posixpath’ または ‘ntpath’。

     Added in version 3.13.

 -- の属性: PurePath.drive

     ドライブ文字または名前を表す文字列があればそれになります:

          >>> PureWindowsPath('c:/Program Files/').drive
          'c:'
          >>> PureWindowsPath('/Program Files/').drive
          ''
          >>> PurePosixPath('/etc').drive
          ''

     UNC 共有名もドライブとみなされます:

          >>> PureWindowsPath('//host/share/foo.txt').drive
          '\\\\host\\share'

 -- の属性: PurePath.root

     ローカルまたはグローバルルートを表す文字列があればそれになります:

          >>> PureWindowsPath('c:/Program Files/').root
          '\\'
          >>> PureWindowsPath('c:Program Files/').root
          ''
          >>> PurePosixPath('/etc').root
          '/'

     UNC 共有名は常にルートを持ちます:

          >>> PureWindowsPath('//host/share').root
          '\\'

     *note PurePosixPath: 2c24. でパスの先頭が３つ以上の連続したスラッシ
     ュである場合、 余分なスラッシュは除去されます:

          >>> PurePosixPath('//etc').root
          '//'
          >>> PurePosixPath('///etc').root
          '/'
          >>> PurePosixPath('////etc').root
          '/'

          注釈: この挙動は、以下に示す、 'The Open Group Base
          Specifications Issue 6' の 4.11 Pathname Resolution(1) に沿っ
          たものです:

          '"A pathname that begins with two successive slashes may be
          interpreted in an implementation-defined manner, although more
          than two leading slashes shall be treated as a single slash."'

 -- の属性: PurePath.anchor

     ドライブとルートを結合した文字列になります:

          >>> PureWindowsPath('c:/Program Files/').anchor
          'c:\\'
          >>> PureWindowsPath('c:Program Files/').anchor
          'c:'
          >>> PurePosixPath('/etc').anchor
          '/'
          >>> PureWindowsPath('//host/share').anchor
          '\\\\host\\share\\'

 -- の属性: PurePath.parents

     パスの論理的な上位パスにアクセスできるイミュータブルなシーケンスに
     なります:

          >>> p = PureWindowsPath('c:/foo/bar/setup.py')
          >>> p.parents[0]
          PureWindowsPath('c:/foo/bar')
          >>> p.parents[1]
          PureWindowsPath('c:/foo')
          >>> p.parents[2]
          PureWindowsPath('c:/')

     バージョン 3.10 で変更: parents シーケンスが、*note スライス: 24ae.
     と負のインデックスをサポートするようになりました。

 -- の属性: PurePath.parent

     パスの論理的な上位パスになります:

          >>> p = PurePosixPath('/a/b/c/d')
          >>> p.parent
          PurePosixPath('/a/b/c')

     アンカーの位置を超えることや空のパスになる位置には対応していません:

          >>> p = PurePosixPath('/')
          >>> p.parent
          PurePosixPath('/')
          >>> p = PurePosixPath('.')
          >>> p.parent
          PurePosixPath('.')

          注釈: これは純粋な字句操作であるため、以下のような挙動になりま
          す:

               >>> p = PurePosixPath('foo/..')
               >>> p.parent
               PurePosixPath('foo')

          任意のファイルシステムパスを上位方向に移動したい場合、シンボリ
          ックリンクの解決や ‘".."’ 要素の除去のため、最初に *note
          Path.resolve(): 1a6d. を呼ぶことを推奨します。

 -- の属性: PurePath.name

     パス要素の末尾を表す文字列があればそれになります。ドライブやルート
     は含まれません:

          >>> PurePosixPath('my/library/setup.py').name
          'setup.py'

     UNC ドライブ名は考慮されません:

          >>> PureWindowsPath('//some/share/setup.py').name
          'setup.py'
          >>> PureWindowsPath('//some/share').name
          ''

 -- の属性: PurePath.suffix

     末尾の要素をドットで分割した最後の部分があれば、それになります:

          >>> PurePosixPath('my/library/setup.py').suffix
          '.py'
          >>> PurePosixPath('my/library.tar.gz').suffix
          '.gz'
          >>> PurePosixPath('my/library').suffix
          ''

     一般的にはファイル拡張子と呼ばれています。

     バージョン 3.14 で変更: A single dot ("‘.’") is considered a valid
     suffix.

 -- の属性: PurePath.suffixes

     パスのサフィックス(ファイル拡張子)のリストです:

          >>> PurePosixPath('my/library.tar.gar').suffixes
          ['.tar', '.gar']
          >>> PurePosixPath('my/library.tar.gz').suffixes
          ['.tar', '.gz']
          >>> PurePosixPath('my/library').suffixes
          []

     バージョン 3.14 で変更: A single dot ("‘.’") is considered a valid
     suffix.

 -- の属性: PurePath.stem

     パス要素の末尾から拡張子を除いたものになります:

          >>> PurePosixPath('my/library.tar.gz').stem
          'library.tar'
          >>> PurePosixPath('my/library.tar').stem
          'library'
          >>> PurePosixPath('my/library').stem
          'library'

     バージョン 3.14 で変更: A single dot ("‘.’") is considered a valid
     suffix.

 -- メソッド: PurePath.as_posix ()

     フォワードスラッシュ (‘/’) を使用したパスを表す文字列を返します:

          >>> p = PureWindowsPath('c:\\windows')
          >>> str(p)
          'c:\\windows'
          >>> p.as_posix()
          'c:/windows'

 -- メソッド: PurePath.is_absolute ()

     パスが絶対パスかどうかを返します。パスが絶対パスとみなされるのは、
     ルートと (フレーバーが許す場合) ドライブとの両方が含まれる場合です:

          >>> PurePosixPath('/a/b').is_absolute()
          True
          >>> PurePosixPath('a/b').is_absolute()
          False

          >>> PureWindowsPath('c:/a/b').is_absolute()
          True
          >>> PureWindowsPath('/a/b').is_absolute()
          False
          >>> PureWindowsPath('c:').is_absolute()
          False
          >>> PureWindowsPath('//some/share').is_absolute()
          True

 -- メソッド: PurePath.is_relative_to (other)

     このパスが 'other' パスに対して相対なのかそうでないのかの結果を返し
     ます。

          >>> p = PurePath('/etc/passwd')
          >>> p.is_relative_to('/etc')
          True
          >>> p.is_relative_to('/usr')
          False

     This method is string-based; it neither accesses the filesystem nor
     treats "‘..’" segments specially.  The following code is
     equivalent:

          >>> u = PurePath('/usr')
          >>> u == p or u in p.parents
          False

     Added in version 3.9.

     Deprecated since version 3.12, removed in version 3.14: 追加の引数
     指定は非推奨となりました。指定された場合は 'other' と連結されます。

 -- メソッド: PurePath.is_reserved ()

     *note PureWindowsPath: 1a75. の場合はパスが Windows 上で予約されて
     いれば ‘True’ を返し、そうでなければ ‘False’ を返します。*note
     PurePosixPath: 2c24. の場合は常に ‘False’ を返します。

     バージョン 3.13 で変更: Windows path names that contain a colon, or
     end with a dot or a space, are considered reserved.  UNC paths may
     be reserved.

     Deprecated since version 3.13, will be removed in version 3.15:
     This method is deprecated; use *note os.path.isreserved(): 32b. to
     detect reserved paths on Windows.

 -- メソッド: PurePath.joinpath (*pathsegments)

     このメソッドの呼び出しは、与えられた 'pathsegments' のパスを順番に
     結合することと等価です。

          >>> PurePosixPath('/etc').joinpath('passwd')
          PurePosixPath('/etc/passwd')
          >>> PurePosixPath('/etc').joinpath(PurePosixPath('passwd'))
          PurePosixPath('/etc/passwd')
          >>> PurePosixPath('/etc').joinpath('init.d', 'apache2')
          PurePosixPath('/etc/init.d/apache2')
          >>> PureWindowsPath('c:').joinpath('/Program Files')
          PureWindowsPath('c:/Program Files')

 -- メソッド: PurePath.full_match (pattern, *, case_sensitive=None)

     現在のパスが glob 形式で与えられたパターンと一致したら ‘True’ を、
     一致しなければ ‘False’ を返します。例:

          >>> PurePath('a/b.py').full_match('a/*.py')
          True
          >>> PurePath('a/b.py').full_match('*.py')
          False
          >>> PurePath('/a/b/c.py').full_match('/a/**')
          True
          >>> PurePath('/a/b/c.py').full_match('**/*.py')
          True

     参考
     ....

     *note Pattern language: 2c31. ドキュメント。

     他のメソッドと同様に、大文字小文字の区別はプラットフォームの設定に
     従います:

          >>> PurePosixPath('b.py').full_match('*.PY')
          False
          >>> PureWindowsPath('b.py').full_match('*.PY')
          True

     Set 'case_sensitive' to ‘True’ or ‘False’ to override this
     behaviour.

     Added in version 3.13.

 -- メソッド: PurePath.match (pattern, *, case_sensitive=None)

     現在のパスが非再帰の glob 形式で与えられたパターンと一致したら
     ‘True’ を、一致しなければ ‘False’ を返します。

     This method is similar to *note full_match(): 535, but empty
     patterns aren't allowed (*note ValueError: 2ec. is raised), the
     recursive wildcard "‘**’" isn't supported (it acts like
     non-recursive "‘*’"), and if a relative pattern is provided, then
     matching is done from the right:

          >>> PurePath('a/b.py').match('*.py')
          True
          >>> PurePath('/a/b/c.py').match('b/*.py')
          True
          >>> PurePath('/a/b/c.py').match('a/*.py')
          False

     バージョン 3.12 で変更: 'pattern' パラメタが *note path-like
     object: 5a1. を受け付けるようになりました。

     バージョン 3.12 で変更: 'case_sensitive' 引数が追加されました。

 -- メソッド: PurePath.relative_to (other, walk_up=False)

     'other' で表されたパスから現在のパスへの相対パスを返します。それが
     不可能だった場合は *note ValueError: 2ec. が送出されます:

          >>> p = PurePosixPath('/etc/passwd')
          >>> p.relative_to('/')
          PurePosixPath('etc/passwd')
          >>> p.relative_to('/etc')
          PurePosixPath('passwd')
          >>> p.relative_to('/usr')
          Traceback (most recent call last):
            File "<stdin>", line 1, in <module>
            File "pathlib.py", line 941, in relative_to
              raise ValueError(error_message.format(str(self), str(formatted)))
          ValueError: '/etc/passwd' is not in the subpath of '/usr' OR one path is relative and the other is absolute.

     'walk_up' がFalseの場合（デフォルト）、パスは 'other' から始まる必
     要があります。引数に True を指定すると ‘..’ を追加して相対パスを作
     成する場合があります。異なるドライブを参照するなど、それ以外のケー
     スでは *note ValueError: 2ec. が送出されます。:

          >>> p.relative_to('/usr', walk_up=True)
          PurePosixPath('../etc/passwd')
          >>> p.relative_to('foo', walk_up=True)
          Traceback (most recent call last):
            File "<stdin>", line 1, in <module>
            File "pathlib.py", line 941, in relative_to
              raise ValueError(error_message.format(str(self), str(formatted)))
          ValueError: '/etc/passwd' is not on the same drive as 'foo' OR one path is relative and the other is absolute.

          警告: This function is part of *note PurePath: 6cd. and works
          with strings.  It does not check or access the underlying file
          structure.  This can impact the 'walk_up' option as it assumes
          that no symlinks are present in the path; call *note
          resolve(): 1a6d. first if necessary to resolve symlinks.

     バージョン 3.12 で変更: 'walk_up' 引数が追加されました（
     ‘walk_up=False’ を指定すると以前の動作と同じになります）。

     Deprecated since version 3.12, removed in version 3.14: 追加の位置
     引数の指定は非推奨となりました。指定された場合は 'other' と連結され
     ます。

 -- メソッド: PurePath.with_name (name)

     現在のパスの *note name: 2c2d. 部分を変更したパスを返します。オリジ
     ナルパスに *note name: 2c2d. 部分がない場合は ValueError が送出され
     ます:

          >>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')
          >>> p.with_name('setup.py')
          PureWindowsPath('c:/Downloads/setup.py')
          >>> p = PureWindowsPath('c:/')
          >>> p.with_name('setup.py')
          Traceback (most recent call last):
            File "<stdin>", line 1, in <module>
            File "/home/antoine/cpython/default/Lib/pathlib.py", line 751, in with_name
              raise ValueError("%r has an empty name" % (self,))
          ValueError: PureWindowsPath('c:/') has an empty name

 -- メソッド: PurePath.with_stem (stem)

     現在のパスの *note stem: 2c2e. 部分を変更したパスを返します。オリジ
     ナルパスに *note stem: 2c2e. 部分がない場合は ValueError が送出され
     ます:

          >>> p = PureWindowsPath('c:/Downloads/draft.txt')
          >>> p.with_stem('final')
          PureWindowsPath('c:/Downloads/final.txt')
          >>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')
          >>> p.with_stem('lib')
          PureWindowsPath('c:/Downloads/lib.gz')
          >>> p = PureWindowsPath('c:/')
          >>> p.with_stem('')
          Traceback (most recent call last):
            File "<stdin>", line 1, in <module>
            File "/home/antoine/cpython/default/Lib/pathlib.py", line 861, in with_stem
              return self.with_name(stem + self.suffix)
            File "/home/antoine/cpython/default/Lib/pathlib.py", line 851, in with_name
              raise ValueError("%r has an empty name" % (self,))
          ValueError: PureWindowsPath('c:/') has an empty name

     Added in version 3.9.

 -- メソッド: PurePath.with_suffix (suffix)

     *note suffix: 1957. を変更した新しいパスを返します。 元のパスに
     suffix が無かった場合、代わりに新しい 'suffix' が追加されます。
     'suffix' が空文字列だった場合、元の suffix は除去されます:

          >>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')
          >>> p.with_suffix('.bz2')
          PureWindowsPath('c:/Downloads/pathlib.tar.bz2')
          >>> p = PureWindowsPath('README')
          >>> p.with_suffix('.txt')
          PureWindowsPath('README.txt')
          >>> p = PureWindowsPath('README.txt')
          >>> p.with_suffix('')
          PureWindowsPath('README')

     バージョン 3.14 で変更: A single dot ("‘.’") is considered a valid
     suffix.  In previous versions, *note ValueError: 2ec. is raised if
     a single dot is supplied.

 -- メソッド: PurePath.with_segments (*pathsegments)

     Create a new path object of the same type by combining the given
     'pathsegments'.  This method is called whenever a derivative path
     is created, such as from *note parent: 1a9d. and *note
     relative_to(): 2fd.  Subclasses may override this method to pass
     information to derivative paths, for example:

          from pathlib import PurePosixPath

          class MyPath(PurePosixPath):
              def __init__(self, *pathsegments, session_id):
                  super().__init__(*pathsegments)
                  self.session_id = session_id

              def with_segments(self, *pathsegments):
                  return type(self)(*pathsegments, session_id=self.session_id)

          etc = MyPath('/etc', session_id=42)
          hosts = etc / 'hosts'
          print(hosts.session_id)  # 42

     Added in version 3.12.

   ---------- Footnotes ----------

   (1) 
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11


File: python.info,  Node: 具象パス,  Next: Pattern language,  Prev: 純粋パス,  Up: pathlib --- オブジェクト指向のファイルシステムパス

5.11.1.8 具象パス
.................

具象パスは純粋パスクラスのサブクラスです。純粋パスが提供する操作に加え、
パスオブジェクト上でシステムコールを呼ぶメソッドも提供しています。具象パ
スのインスタンスを作成するには 3 つの方法があります:

 -- クラス: pathlib.Path (*pathsegments)

     *note PurePath: 6cd. のサブクラスであり、システムのパスフレーバーの
     具象パスを表します (このインスタンスの作成で *note PosixPath: 2c33.
     か *note WindowsPath: 2c20. のどちらかが作成されます):

          >>> Path('setup.py')
          PosixPath('setup.py')

     'pathsegments' の指定は *note PurePath: 6cd. と同じです。

 -- クラス: pathlib.PosixPath (*pathsegments)

     *note Path: 266. および *note PurePosixPath: 2c24. のサブクラスで、
     非 Windows ファイルシステムの具象パスを表します:

          >>> PosixPath('/etc/hosts')
          PosixPath('/etc/hosts')

     'pathsegments' の指定は *note PurePath: 6cd. と同じです。

     バージョン 3.13 で変更: Windows では *note UnsupportedOperation:
     533. を送出します。以前のバージョンでは代わりに *note
     NotImplementedError: 36b. を送出していました。

 -- クラス: pathlib.WindowsPath (*pathsegments)

     *note Path: 266. および *note PureWindowsPath: 1a75. のサブクラスで
     、Windows ファイルシステムの具象パスを表します:

          >>> WindowsPath('c:/', 'Users', 'Ximénez')
          WindowsPath('c:/Users/Ximénez')

     'pathsegments' の指定は *note PurePath: 6cd. と同じです。

     バージョン 3.13 で変更: Windows 以外のプラットフォームでは *note
     UnsupportedOperation: 533. を送出します。以前のバージョンでは代わり
     に *note NotImplementedError: 36b. を送出していました。

インスタンスを作成できるのはシステムと一致するフレーバーのみです (互換性
のないパスフレーバーでのシステムコールの許可はバグやアプリケーションの異
常終了の原因になります):

     >>> import os
     >>> os.name
     'posix'
     >>> Path('setup.py')
     PosixPath('setup.py')
     >>> PosixPath('setup.py')
     PosixPath('setup.py')
     >>> WindowsPath('setup.py')
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
       File "pathlib.py", line 798, in __new__
         % (cls.__name__,))
     UnsupportedOperation: cannot instantiate 'WindowsPath' on your system

Some concrete path methods can raise an *note OSError: 2c0. if a system
call fails (for example because the path doesn't exist).

* Menu:

* URIのパースと生成::
* パスの展開と解決::
* ファイルの種類とステータスを問い合わせる::
* ファイルを読み書きする: ファイルを読み書きする<2>.
* ディレクトリを読む::
* ファイルとディレクトリの作成::
* Copying, moving and deleting: Copying moving and deleting.
* パーミッションと所有者::


File: python.info,  Node: URIのパースと生成,  Next: パスの展開と解決,  Up: 具象パス

5.11.1.9 URIのパースと生成
..........................

Concrete path objects can be created from, and represented as, 'file'
URIs conforming to RFC 8089(1).

     注釈: File URIs are not portable across machines with different
     *note filesystem encodings: 2c35.

 -- メソッド: classmethod Path.from_uri (uri)

     'file' URIをパースして新しいパスオブジェクトを返します。例:

          >>> p = Path.from_uri('file:///etc/hosts')
          PosixPath('/etc/hosts')

     On Windows, DOS device and UNC paths may be parsed from URIs:

          >>> p = Path.from_uri('file:///c:/windows')
          WindowsPath('c:/windows')
          >>> p = Path.from_uri('file://server/share')
          WindowsPath('//server/share')

     Several variant forms are supported:

          >>> p = Path.from_uri('file:////server/share')
          WindowsPath('//server/share')
          >>> p = Path.from_uri('file://///server/share')
          WindowsPath('//server/share')
          >>> p = Path.from_uri('file:c:/windows')
          WindowsPath('c:/windows')
          >>> p = Path.from_uri('file:/c|/windows')
          WindowsPath('c:/windows')

     *note ValueError: 2ec. is raised if the URI does not start with
     ‘file:’, or the parsed path isn't absolute.

     Added in version 3.13.

     バージョン 3.14 で変更: The URL authority is discarded if it
     matches the local hostname.  Otherwise, if the authority isn't
     empty or ‘localhost’, then on Windows a UNC path is returned (as
     before), and on other platforms a *note ValueError: 2ec. is raised.

 -- メソッド: Path.as_uri ()

      'file' URI で表したパスを返します。絶対パスではない場合に *note
     ValueError: 2ec. を送出します。

          >>> p = PosixPath('/etc/passwd')
          >>> p.as_uri()
          'file:///etc/passwd'
          >>> p = WindowsPath('c:/Windows')
          >>> p.as_uri()
          'file:///c:/Windows'

     Deprecated since version 3.14, will be removed in version 3.19:
     Calling this method from *note PurePath: 6cd. rather than *note
     Path: 266. is possible but deprecated.  The method's use of *note
     os.fsencode(): e4f. makes it strictly impure.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc8089.html


File: python.info,  Node: パスの展開と解決,  Next: ファイルの種類とステータスを問い合わせる,  Prev: URIのパースと生成,  Up: 具象パス

5.11.1.10 パスの展開と解決
..........................

 -- メソッド: classmethod Path.home ()

     ユーザーのホームディレクトリ (*note os.path.expanduser(): c09. での
     ‘~’ の返り値) を表す新しいパスオブジェクトを返します。ホームディレ
     クトリが解決できない場合は、 *note RuntimeError: 244. を送出します
     。

          >>> Path.home()
          PosixPath('/home/antoine')

     Added in version 3.5.

 -- メソッド: Path.expanduser ()

     パス要素 ‘~’ および ‘~user’ を *note os.path.expanduser(): c09. が
     返すように展開した新しいパスオブジェクトを返します。ホームディレク
     トリが解決できない場合は、 *note RuntimeError: 244. を送出します。

          >>> p = PosixPath('~/films/Monty Python')
          >>> p.expanduser()
          PosixPath('/home/eric/films/Monty Python')

     Added in version 3.5.

 -- メソッド: classmethod Path.cwd ()

     (*note os.getcwd(): 1909. が返す) 現在のディレクトリを表す新しいパ
     スオブジェクトを返します:

          >>> Path.cwd()
          PosixPath('/home/antoine/pathlib')

 -- メソッド: Path.absolute ()

     正規化やシンボリックリンクの解決をせずに、パスを絶対パスにします。
     新しいパスオブジェクトを返します:

          >>> p = Path('tests')
          >>> p
          PosixPath('tests')
          >>> p.absolute()
          PosixPath('/home/antoine/pathlib/tests')

 -- メソッド: Path.resolve (strict=False)

     パスを絶対パスにし、あらゆるシンボリックリンクを解決します。新しい
     パスオブジェクトが返されます:

          >>> p = Path()
          >>> p
          PosixPath('.')
          >>> p.resolve()
          PosixPath('/home/antoine/pathlib')

     "‘..’" 要素は除去されます (このような挙動を示すのはこのメソッドだけ
     です):

          >>> p = Path('docs/../setup.py')
          >>> p.resolve()
          PosixPath('/home/antoine/pathlib/setup.py')

     If a path doesn't exist or a symlink loop is encountered, and
     'strict' is ‘True’, *note OSError: 2c0. is raised.  If 'strict' is
     ‘False’, the path is resolved as far as possible and any remainder
     is appended without checking whether it exists.

     バージョン 3.6 で変更: 'strict' 引数を追加しました(3.6以前の挙動は
     strict です)。

     バージョン 3.13 で変更: Symlink loops are treated like other
     errors: *note OSError: 2c0. is raised in strict mode, and no
     exception is raised in non-strict mode.  In previous versions,
     *note RuntimeError: 244. is raised no matter the value of 'strict'.

 -- メソッド: Path.readlink ()

     ( *note os.readlink(): b1a. が返す) シンボリックリンクが指すパスを
     返します:

          >>> p = Path('mylink')
          >>> p.symlink_to('setup.py')
          >>> p.readlink()
          PosixPath('setup.py')

     Added in version 3.9.

     バージョン 3.13 で変更: *note os.readlink(): b1a. が利用できない場
     合 *note UnsupportedOperation: 533. を送出します。以前のバージョン
     では *note NotImplementedError: 36b. を送出していました。


File: python.info,  Node: ファイルの種類とステータスを問い合わせる,  Next: ファイルを読み書きする<2>,  Prev: パスの展開と解決,  Up: 具象パス

5.11.1.11 ファイルの種類とステータスを問い合わせる
..................................................

バージョン 3.8 で変更: *note exists(): c0b, *note is_dir(): 53a, *note
is_file(): 539, *note is_mount(): c0c, *note is_symlink(): c0d, *note
is_block_device(): c0e, *note is_char_device(): c0f, *note is_socket():
c11. は、OSレベルで表現不能な文字を含むパスに対して、例外を送出する代わ
りに ‘False’ を返すようになりました。

バージョン 3.14 で変更: The methods given above now return ‘False’
instead of raising any *note OSError: 2c0. exception from the operating
system.  In previous versions, some kinds of *note OSError: 2c0.
exception are raised, and others suppressed.  The new behaviour is
consistent with *note os.path.exists(): c03, *note os.path.isdir(): c05,
etc.  Use *note stat(): a24. to retrieve the file status without
suppressing exceptions.

 -- メソッド: Path.stat (*, follow_symlinks=True)

     (*note os.stat(): 26d. と同様の) 現在のパスについて *note
     os.stat_result: 16da. オブジェクトが含む情報を返します。値はそれぞ
     れのメソッドを呼び出した時点のものになります。

     このメソッドは通常はシンボリックリンクをたどります。シンボリックリ
     ンクに対して stat したい場合は ‘follow_symlinks=False’ とするか、
     *note lstat(): 2c38. を利用してください。

          >>> p = Path('setup.py')
          >>> p.stat().st_size
          956
          >>> p.stat().st_mtime
          1327883547.852554

     バージョン 3.10 で変更: 'follow_symlinks' パラメータが追加されまし
     た。

 -- メソッド: Path.lstat ()

     *note Path.stat(): a24. のように振る舞いますが、パスがシンボリック
     リンクを指していた場合、リンク先ではなくシンボリックリンク自身の情
     報を返します。

 -- メソッド: Path.exists (*, follow_symlinks=True)

     Return ‘True’ if the path points to an existing file or directory.
     ‘False’ will be returned if the path is invalid, inaccessible or
     missing.  Use *note Path.stat(): a24. to distinguish between these
     cases.

     このメソッドは通常はシンボリックリンクをたどります。シンボリックリ
     ンクが存在するかを確認したい場合は ‘follow_symlinks=False’ 引数を追
     加してください。

          >>> Path('.').exists()
          True
          >>> Path('setup.py').exists()
          True
          >>> Path('/etc').exists()
          True
          >>> Path('nonexistentfile').exists()
          False

     バージョン 3.12 で変更: 'follow_symlinks' パラメータが追加されまし
     た。

 -- メソッド: Path.is_file (*, follow_symlinks=True)

     Return ‘True’ if the path points to a regular file.  ‘False’ will
     be returned if the path is invalid, inaccessible or missing, or if
     it points to something other than a regular file.  Use *note
     Path.stat(): a24. to distinguish between these cases.

     このメソッドは通常はシンボリックリンクをたどります。シンボリックリ
     ンクを除外するには ‘follow_symlinks=False’ 引数を追加してください。

     バージョン 3.13 で変更: 'follow_symlinks' パラメータが追加されまし
     た。

 -- メソッド: Path.is_dir (*, follow_symlinks=True)

     Return ‘True’ if the path points to a directory.  ‘False’ will be
     returned if the path is invalid, inaccessible or missing, or if it
     points to something other than a directory.  Use *note Path.stat():
     a24. to distinguish between these cases.

     このメソッドは通常はシンボリックリンクをたどります。ディレクトリへ
     のシンボリックリンクを除外するには ‘follow_symlinks=False’ 引数を追
     加してください。

     バージョン 3.13 で変更: 'follow_symlinks' パラメータが追加されまし
     た。

 -- メソッド: Path.is_symlink ()

     Return ‘True’ if the path points to a symbolic link, even if that
     symlink is broken.  ‘False’ will be returned if the path is
     invalid, inaccessible or missing, or if it points to something
     other than a symbolic link.  Use *note Path.stat(): a24. to
     distinguish between these cases.

 -- メソッド: Path.is_junction ()

     パスがジャンクションを指している場合は ‘True’ を返し、それ以外の場
     合は ‘False’ を返します。現在はWindowsのみジャンクションをサポート
     しています。

     Added in version 3.12.

 -- メソッド: Path.is_mount ()

     パスがマウントポイント 'mount point' (ファイルシステムの中で異なる
     ファイルシステムがマウントされているところ) なら、 ‘True’ を返しま
     す。POSIX では、この関数は 'path' の親ディレクトリである ‘path/..’
     が 'path' と異なるデバイス上にあるか、あるいは ‘path/..’ と 'path'
     が同じデバイス上の同じ i-node を指しているかをチェックします -- こ
     れによって全ての Unix 系システムと POSIX 標準でマウントポイントが検
     出できます。Windowsでは、マウントポイントはドライブレターを持つルー
     ト(e.g.  ‘c:\’)、共有 UNC(e.g.  ‘\\server\share’)またはマウントされ
     たファイルシステムのディレクトリです。

     Added in version 3.7.

     バージョン 3.12 で変更: Windows のサポートが追加されました。

 -- メソッド: Path.is_socket ()

     Return ‘True’ if the path points to a Unix socket.  ‘False’ will be
     returned if the path is invalid, inaccessible or missing, or if it
     points to something other than a Unix socket.  Use *note
     Path.stat(): a24. to distinguish between these cases.

 -- メソッド: Path.is_fifo ()

     Return ‘True’ if the path points to a FIFO. ‘False’ will be
     returned if the path is invalid, inaccessible or missing, or if it
     points to something other than a FIFO. Use *note Path.stat(): a24.
     to distinguish between these cases.

 -- メソッド: Path.is_block_device ()

     Return ‘True’ if the path points to a block device.  ‘False’ will
     be returned if the path is invalid, inaccessible or missing, or if
     it points to something other than a block device.  Use *note
     Path.stat(): a24. to distinguish between these cases.

 -- メソッド: Path.is_char_device ()

     Return ‘True’ if the path points to a character device.  ‘False’
     will be returned if the path is invalid, inaccessible or missing,
     or if it points to something other than a character device.  Use
     *note Path.stat(): a24. to distinguish between these cases.

 -- メソッド: Path.samefile (other_path)

     このパスが参照するファイルが 'other_path' (Path オブジェクトか文字
     列) と同じであれば ‘True’ を、異なるファイルであれば ‘False’ を返し
     ます。意味的には *note os.path.samefile(): 1173. および *note
     os.path.samestat(): 1172. と同じです。

     なんらかの理由でどちらかのファイルにアクセスできない場合は *note
     OSError: 2c0. が送出されます。

          >>> p = Path('spam')
          >>> q = Path('eggs')
          >>> p.samefile(q)
          False
          >>> p.samefile('spam')
          True

     Added in version 3.5.

 -- の属性: Path.info

     A *note PathInfo: 26c. object that supports querying file type
     information.  The object exposes methods that cache their results,
     which can help reduce the number of system calls needed when
     switching on file type.  For example:

          >>> p = Path('src')
          >>> if p.info.is_symlink():
          ...     print('symlink')
          ... elif p.info.is_dir():
          ...     print('directory')
          ... elif p.info.exists():
          ...     print('something else')
          ... else:
          ...     print('not found')
          ...
          directory

     If the path was generated from *note Path.iterdir(): 26e. then this
     attribute is initialized with some information about the file type
     gleaned from scanning the parent directory.  Merely accessing *note
     Path.info: 26b. does not perform any filesystem queries.

     To fetch up-to-date information, it's best to call *note
     Path.is_dir(): 53a, *note is_file(): 539. and *note is_symlink():
     c0d. rather than methods of this attribute.  There is no way to
     reset the cache; instead you can create a new path object with an
     empty info cache via ‘p = Path(p)’.

     Added in version 3.14.


File: python.info,  Node: ファイルを読み書きする<2>,  Next: ディレクトリを読む,  Prev: ファイルの種類とステータスを問い合わせる,  Up: 具象パス

5.11.1.12 ファイルを読み書きする
................................

 -- メソッド: Path.open (mode='r', buffering=-1, encoding=None,
          errors=None, newline=None)

     組み込み関数 *note open(): 316. のようにパスが指しているファイルを
     開きます:

          >>> p = Path('setup.py')
          >>> with p.open() as f:
          ...     f.readline()
          ...
          '#!/usr/bin/env python3\n'

 -- メソッド: Path.read_text (encoding=None, errors=None, newline=None)

     指定されたファイルの内容を文字列としてデコードして返します:

          >>> p = Path('my_text_file')
          >>> p.write_text('Text file contents')
          18
          >>> p.read_text()
          'Text file contents'

     ファイルを開いた後に閉じます。 オプションのパラメーターの意味は
     *note open(): 316. と同じです。

     Added in version 3.5.

     バージョン 3.13 で変更: 'newline' パラメータが追加されました。

 -- メソッド: Path.read_bytes ()

     指定されたファイルの内容をバイナリオブジェクトで返します:

          >>> p = Path('my_binary_file')
          >>> p.write_bytes(b'Binary file contents')
          20
          >>> p.read_bytes()
          b'Binary file contents'

     Added in version 3.5.

 -- メソッド: Path.write_text (data, encoding=None, errors=None,
          newline=None)

     指定されたファイルをテキストモードで開き、'data' を書き込み、ファイ
     ルを閉じます:

          >>> p = Path('my_text_file')
          >>> p.write_text('Text file contents')
          18
          >>> p.read_text()
          'Text file contents'

     同じ名前のファイルが存在する場合は上書きされます。オプションのパラ
     メーターの意味は *note open(): 316. と同じです。

     Added in version 3.5.

     バージョン 3.10 で変更: 'newline' パラメータが追加されました。

 -- メソッド: Path.write_bytes (data)

     指定されたファイルをバイトモードで開き、'data' を書き込み、ファイル
     を閉じます:

          >>> p = Path('my_binary_file')
          >>> p.write_bytes(b'Binary file contents')
          20
          >>> p.read_bytes()
          b'Binary file contents'

     同じ名前のファイルがすでにあれば上書きされます。

     Added in version 3.5.


File: python.info,  Node: ディレクトリを読む,  Next: ファイルとディレクトリの作成,  Prev: ファイルを読み書きする<2>,  Up: 具象パス

5.11.1.13 ディレクトリを読む
............................

 -- メソッド: Path.iterdir ()

     パスがディレクトリを指していた場合、ディレクトリの内容のパスオブジ
     ェクトを yield します:

          >>> p = Path('docs')
          >>> for child in p.iterdir(): child
          ...
          PosixPath('docs/conf.py')
          PosixPath('docs/_templates')
          PosixPath('docs/make.bat')
          PosixPath('docs/index.rst')
          PosixPath('docs/_build')
          PosixPath('docs/_static')
          PosixPath('docs/Makefile')

     子の要素は任意の順番で yield されます。特殊なパスの ‘'.'’ と ‘'..'’
     は含まれません。イテレーターを生成したあとにディレクトリにファイル
     を削除または追加した場合に、そのファイルのパスオブジェクトが含まれ
     るかは定義されていません。

     パスがディレクトリでないかアクセスできない場合は *note OSError:
     2c0. を送出します。

 -- メソッド: Path.glob (pattern, *, case_sensitive=None,
          recurse_symlinks=False)

     現在のパスが表すディレクトリ内で相対 'pattern' に一致する (あらゆる
     種類の) すべてのファイルを yield します:

          >>> sorted(Path('.').glob('*.py'))
          [PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib.py')]
          >>> sorted(Path('.').glob('*/*.py'))
          [PosixPath('docs/conf.py')]
          >>> sorted(Path('.').glob('**/*.py'))
          [PosixPath('build/lib/pathlib.py'),
           PosixPath('docs/conf.py'),
           PosixPath('pathlib.py'),
           PosixPath('setup.py'),
           PosixPath('test_pathlib.py')]

          注釈: The paths are returned in no particular order.  If you
          need a specific order, sort the results.

     参考
     ....

     *note Pattern language: 2c31. ドキュメント。

     デフォルトまたは 'case_sensitive' キーワード専用引数に ‘None’ を指
     定した場合、このメソッドはパスの一致判定にプラットフォームに依存し
     た大文字小文字のルールを使用します。一般的にPOSIXは大文字と小文字を
     区別し、Windowsは区別しません。'case_sensitive' を ‘True’ または
     ‘False’ に設定するとこの動作を上書きします。

     デフォルトまたは 'recurse_symlinks' キーワード専用引数が ‘False’ に
     設定された場合、このメソッドは "‘**’" ワイルドカードの展開時にシン
     ボリックリンクをたどりません。'recurse_symlinks' を ‘True’ に設定す
     ると、つねにシンボリックリンクをたどります。

     引数 ‘self’, ‘pattern’ を指定して *note 監査イベント: 1c6e.
     ‘pathlib.Path.glob’ を送出します。

     バージョン 3.12 で変更: 'case_sensitive' 引数が追加されました。

     バージョン 3.13 で変更: 'recurse_symlinks' パラメータが追加されまし
     た。

     バージョン 3.13 で変更: 'pattern' パラメタが *note path-like
     object: 5a1. を受け付けるようになりました。

     バージョン 3.13 で変更: Any *note OSError: 2c0. exceptions raised
     from scanning the filesystem are suppressed.  In previous versions,
     such exceptions are suppressed in many cases, but not all.

 -- メソッド: Path.rglob (pattern, *, case_sensitive=None,
          recurse_symlinks=False)

     与えられた相対 'pattern' で再帰的に Glob します。*note Path.glob():
     537. で 'pattern' の前に "‘**/’" をつけ呼び出した場合と似ています。

          注釈: The paths are returned in no particular order.  If you
          need a specific order, sort the results.

     参考
     ....

     *note Pattern language: 2c31. と *note Path.glob(): 537. のドキュメ
     ント。

     引数 ‘self’, ‘pattern’ を指定して *note 監査イベント: 1c6e.
     ‘pathlib.Path.rglob’ を送出します。

     バージョン 3.12 で変更: 'case_sensitive' 引数が追加されました。

     バージョン 3.13 で変更: 'recurse_symlinks' パラメータが追加されまし
     た。

     バージョン 3.13 で変更: 'pattern' パラメタが *note path-like
     object: 5a1. を受け付けるようになりました。

 -- メソッド: Path.walk (top_down=True, on_error=None,
          follow_symlinks=False)

     Generate the file names in a directory tree by walking the tree
     either top-down or bottom-up.

     For each directory in the directory tree rooted at 'self'
     (including 'self' but excluding '.'  and '..'), the method yields a
     3-tuple of ‘(dirpath, dirnames, filenames)’.

     'dirpath' is a *note Path: 266. to the directory currently being
     walked, 'dirnames' is a list of strings for the names of
     subdirectories in 'dirpath' (excluding ‘'.'’ and ‘'..'’), and
     'filenames' is a list of strings for the names of the non-directory
     files in 'dirpath'.  To get a full path (which begins with 'self')
     to a file or directory in 'dirpath', do ‘dirpath / name’.  Whether
     or not the lists are sorted is file system-dependent.

     If the optional argument 'top_down' is true (which is the default),
     the triple for a directory is generated before the triples for any
     of its subdirectories (directories are walked top-down).  If
     'top_down' is false, the triple for a directory is generated after
     the triples for all of its subdirectories (directories are walked
     bottom-up).  No matter the value of 'top_down', the list of
     subdirectories is retrieved before the triples for the directory
     and its subdirectories are walked.

     When 'top_down' is true, the caller can modify the 'dirnames' list
     in-place (for example, using *note del: 1b1f. or slice assignment),
     and *note Path.walk(): 6cf. will only recurse into the
     subdirectories whose names remain in 'dirnames'.  This can be used
     to prune the search, or to impose a specific order of visiting, or
     even to inform *note Path.walk(): 6cf. about directories the caller
     creates or renames before it resumes *note Path.walk(): 6cf. again.
     Modifying 'dirnames' when 'top_down' is false has no effect on the
     behavior of *note Path.walk(): 6cf. since the directories in
     'dirnames' have already been generated by the time 'dirnames' is
     yielded to the caller.

     By default, errors from *note os.scandir(): c54. are ignored.  If
     the optional argument 'on_error' is specified, it should be a
     callable; it will be called with one argument, an *note OSError:
     2c0. instance.  The callable can handle the error to continue the
     walk or re-raise it to stop the walk.  Note that the filename is
     available as the ‘filename’ attribute of the exception object.

     By default, *note Path.walk(): 6cf. does not follow symbolic links,
     and instead adds them to the 'filenames' list.  Set
     'follow_symlinks' to true to resolve symlinks and place them in
     'dirnames' and 'filenames' as appropriate for their targets, and
     consequently visit directories pointed to by symlinks (where
     supported).

          注釈: 'follow_symlinks' に True を指定すると、シンボリックリン
          クが親ディレクトリを指していた場合に、無限ループになることに注
          意してください。 *note Path.walk(): 6cf. はすでにたどったディ
          レクトリを管理したりはしません。

          注釈: *note Path.walk(): 6cf. assumes the directories it walks
          are not modified during execution.  For example, if a
          directory from 'dirnames' has been replaced with a symlink and
          'follow_symlinks' is false, *note Path.walk(): 6cf. will still
          try to descend into it.  To prevent such behavior, remove
          directories from 'dirnames' as appropriate.

          注釈: Unlike *note os.walk(): 6d0, *note Path.walk(): 6cf.
          lists symlinks to directories in 'filenames' if
          'follow_symlinks' is false.

     This example displays the number of bytes used by all files in each
     directory, while ignoring ‘__pycache__’ directories:

          from pathlib import Path
          for root, dirs, files in Path("cpython/Lib/concurrent").walk(on_error=print):
            print(
                root,
                "consumes",
                sum((root / file).stat().st_size for file in files),
                "bytes in",
                len(files),
                "non-directory files"
            )
            if '__pycache__' in dirs:
                  dirs.remove('__pycache__')

     This next example is a simple implementation of *note
     shutil.rmtree(): 356.  Walking the tree bottom-up is essential as
     *note rmdir(): 2c3c. doesn't allow deleting a directory before it
     is empty:

          # Delete everything reachable from the directory "top".
          # CAUTION:  This is dangerous! For example, if top == Path('/'),
          # it could delete all of your files.
          for root, dirs, files in top.walk(top_down=False):
              for name in files:
                  (root / name).unlink()
              for name in dirs:
                  (root / name).rmdir()

     Added in version 3.12.


File: python.info,  Node: ファイルとディレクトリの作成,  Next: Copying moving and deleting,  Prev: ディレクトリを読む,  Up: 具象パス

5.11.1.14 ファイルとディレクトリの作成
......................................

 -- メソッド: Path.touch (mode=0o666, exist_ok=True)

     与えられたパスにファイルを作成します。'mode' が与えられた場合、プロ
     セスの ‘umask’ 値と組み合わせてファイルのモードとアクセスフラグが決
     定されます。ファイルがすでに存在した場合、'exist_ok' が真ならばこの
     関数は正常に終了します (そしてファイルの更新日付が現在の日時に変更
     されます)。その他の場合は *note FileExistsError: 1221. が送出されま
     す。

     参考
     ....

     The *note open(): 2c3a, *note write_text(): 1044. and *note
     write_bytes(): 1046. methods are often used to create files.

 -- メソッド: Path.mkdir (mode=0o777, parents=False, exist_ok=False)

     与えられたパスに新しくディレクトリを作成します。'mode' が与えられて
     いた場合、プロセスの ‘umask’ 値と組み合わせてファイルのモードとアク
     セスフラグを決定します。パスがすでに存在していた場合 *note
     FileExistsError: 1221. が送出されます。

     'parents' の値が真の場合、このパスの親ディレクトリを必要に応じて作
     成します; それらのアクセス制限はデフォルト値が取られ、'mode' は使用
     されません (POSIX の ‘mkdir -p’ コマンドを真似ています)。

     'parents' の値が偽の場合 (デフォルト)、親ディレクトリがないと *note
     FileNotFoundError: 264. を送出します。

     'exist_ok' の値が (デフォルトの) 偽の場合、対象のディレクトリがすで
     に存在すると *note FileExistsError: 1221. を送出します。

     If 'exist_ok' is true, *note FileExistsError: 1221. will not be
     raised unless the given path already exists in the file system and
     is not a directory (same behavior as the POSIX ‘mkdir -p’ command).

     バージョン 3.5 で変更: 'exist_ok' 引数が追加されました。

 -- メソッド: Path.symlink_to (target, target_is_directory=False)

     Make this path a symbolic link pointing to 'target'.

     Windows では、シンボリックリンクはファイルかディレクトリのどちらか
     を表しますが、ターゲットに合わせて動的に変化することはありません。
     ターゲットが存在する場合、シンボリックリンクの種類は対象に合わせて
     作成されます。ターゲットが存在せず 'target_is_directory' が真である
     場合、シンボリックリンクはディレクトリのリンクとして作成され、偽で
     ある場合 (デフォルト) はファイルのリンクになります。Windows 以外の
     プラットフォームでは 'target_is_directory' は無視されます。

          >>> p = Path('mylink')
          >>> p.symlink_to('setup.py')
          >>> p.resolve()
          PosixPath('/home/antoine/pathlib/setup.py')
          >>> p.stat().st_size
          956
          >>> p.lstat().st_size
          8

          注釈: 引数の並び (link, target) は *note os.symlink(): 130c. と
          は逆です。

     バージョン 3.13 で変更: *note os.symlink(): 130c. が利用できない場
     合 *note UnsupportedOperation: 533. を送出します。以前のバージョン
     では *note NotImplementedError: 36b. を送出していました。

 -- メソッド: Path.hardlink_to (target)

     このパスを 'target' と同じファイルへのハードリンクにします。

          注釈: 引数の並び (link, target) は *note os.link(): 1307. とは
          逆です。

     Added in version 3.10.

     バージョン 3.13 で変更: *note os.link(): 1307. が利用できない場合
     *note UnsupportedOperation: 533. を送出します。以前のバージョンでは
     *note NotImplementedError: 36b. を送出していました。


File: python.info,  Node: Copying moving and deleting,  Next: パーミッションと所有者,  Prev: ファイルとディレクトリの作成,  Up: 具象パス

5.11.1.15 Copying, moving and deleting
......................................

 -- メソッド: Path.copy (target, *, follow_symlinks=True,
          preserve_metadata=False)

     Copy this file or directory tree to the given 'target', and return
     a new ‘Path’ instance pointing to 'target'.

     If the source is a file, the target will be replaced if it is an
     existing file.  If the source is a symlink and 'follow_symlinks' is
     true (the default), the symlink's target is copied.  Otherwise, the
     symlink is recreated at the destination.

     If 'preserve_metadata' is false (the default), only directory
     structures and file data are guaranteed to be copied.  Set
     'preserve_metadata' to true to ensure that file and directory
     permissions, flags, last access and modification times, and
     extended attributes are copied where supported.  This argument has
     no effect when copying files on Windows (where metadata is always
     preserved).

          注釈: Where supported by the operating system and file system,
          this method performs a lightweight copy, where data blocks are
          only copied when modified.  This is known as copy-on-write.

     Added in version 3.14.

 -- メソッド: Path.copy_into (target_dir, *, follow_symlinks=True,
          preserve_metadata=False)

     Copy this file or directory tree into the given 'target_dir', which
     should be an existing directory.  Other arguments are handled
     identically to *note Path.copy(): 267.  Returns a new ‘Path’
     instance pointing to the copy.

     Added in version 3.14.

 -- メソッド: Path.rename (target)

     このファイルかディレクトリを与えられた 'target' にリネームし、
     'target' を指す新しい ‘Path’ のインスタンスを返します。 Unix では
     'target' が存在するファイルの場合、ユーザにパーミッションがあれば静
     かに置換されます。 Windows では 'target' が存在する場合、*note
     FileExistsError: 1221. が送出されます。 'target' は文字列か別のパス
     オブジェクトです:

          >>> p = Path('foo')
          >>> p.open('w').write('some text')
          9
          >>> target = Path('bar')
          >>> p.rename(target)
          PosixPath('bar')
          >>> target.open().read()
          'some text'

     targetパスは絶対または相対で指定できます。相対パスは現在の作業ディ
     レクトリからの相対パスとして解釈し、‘Path’ オブジェクトのディレクト
     リ 'ではありません'。

     It is implemented in terms of *note os.rename(): 1309. and gives
     the same guarantees.

     バージョン 3.8 で変更: 戻り値を追加し、新しい ‘Path’ インスタンスを
     返します。

 -- メソッド: Path.replace (target)

     現在のファイルまたはディレクトリの名前を 'target' に変更し、
     'target' を指す新しい ‘Path’ のインスタンスを返します。'target' が
     既存のファイルか空のディレクトリを指していた場合、無条件に置き換え
     られます。

     targetパスは絶対または相対で指定できます。相対パスは現在の作業ディ
     レクトリからの相対パスとして解釈し、‘Path’ オブジェクトのディレクト
     リ 'ではありません'。

     バージョン 3.8 で変更: 戻り値を追加し、新しい ‘Path’ インスタンスを
     返します。

 -- メソッド: Path.move (target)

     Move this file or directory tree to the given 'target', and return
     a new ‘Path’ instance pointing to 'target'.

     If the 'target' doesn't exist it will be created.  If both this
     path and the 'target' are existing files, then the target is
     overwritten.  If both paths point to the same file or directory, or
     the 'target' is a non-empty directory, then *note OSError: 2c0. is
     raised.

     If both paths are on the same filesystem, the move is performed
     with *note os.replace(): 130a.  Otherwise, this path is copied
     (preserving metadata and symlinks) and then deleted.

     Added in version 3.14.

 -- メソッド: Path.move_into (target_dir)

     Move this file or directory tree into the given 'target_dir', which
     should be an existing directory.  Returns a new ‘Path’ instance
     pointing to the moved path.

     Added in version 3.14.

 -- メソッド: Path.unlink (missing_ok=False)

     このファイルまたはシンボリックリンクを削除します。パスがディレクト
     リを指している場合は *note Path.rmdir(): 2c3c. を使用してください。

     'missing_ok' の値が (デフォルトの) 偽の場合、対象のファイルが存在し
     ないと *note FileNotFoundError: 264. を送出します。

     'missing_ok' の値が真の場合、 *note FileExistsError: 1221. 例外を送
     出しません (POSIX の ‘rm -f’ コマンドの挙動と同じ)。

     バージョン 3.8 で変更: 'missing_ok' 引数が追加されました。

 -- メソッド: Path.rmdir ()

     現在のディレクトリを削除します。ディレクトリは空でなければなりませ
     ん。


File: python.info,  Node: パーミッションと所有者,  Prev: Copying moving and deleting,  Up: 具象パス

5.11.1.16 パーミッションと所有者
................................

 -- メソッド: Path.owner (*, follow_symlinks=True)

     ファイルの所有者のユーザー名を返します。ファイルのユーザーID(UID)が
     システムのデータベースに見つからない場合 *note KeyError: 5e7. が送
     出されます。

     このメソッドは通常はシンボリックリンクをたどります。シンボリックリ
     ンクの所有者を取得するには ‘follow_symlinks=False’ 引数を追加してく
     ださい。

     バージョン 3.13 で変更: *note pwd: b7. モジュールが利用できない場合
     *note UnsupportedOperation: 533. を送出します。以前のバージョンでは
     *note NotImplementedError: 36b. を送出していました。

     バージョン 3.13 で変更: 'follow_symlinks' パラメータが追加されまし
     た。

 -- メソッド: Path.group (*, follow_symlinks=True)

     ファイルの所有者のグループ名を返します。ファイルのグループID(GID)が
     システムのデータベースに見つからない場合 *note KeyError: 5e7. が送
     出されます。

     このメソッドは通常はシンボリックリンクをたどります。シンボリックリ
     ンクのグループを取得するには ‘follow_symlinks=False’ 引数を追加して
     ください。

     バージョン 3.13 で変更: *note grp: 6a. モジュールが利用できない場合
     *note UnsupportedOperation: 533. を送出します。以前のバージョンでは
     *note NotImplementedError: 36b. を送出していました。

     バージョン 3.13 で変更: 'follow_symlinks' パラメータが追加されまし
     た。

 -- メソッド: Path.chmod (mode, *, follow_symlinks=True)

     *note os.chmod(): 529. のようにファイルのモードとアクセス権限を変更
     します。

     このメソッドは通常シンボリックリンクをたどります。一部のUnixではシ
     ンボリックリンク自体のパーミッション変更をサポートしています。その
     ようなプラットフォームでは引数に''follow_symlinks=False'' を追加す
     るか、*note lchmod(): 2c42. を使用してください。

          >>> p = Path('setup.py')
          >>> p.stat().st_mode
          33277
          >>> p.chmod(0o444)
          >>> p.stat().st_mode
          33060

     バージョン 3.10 で変更: 'follow_symlinks' パラメータが追加されまし
     た。

 -- メソッド: Path.lchmod (mode)

     *note Path.chmod(): a25. のように振る舞いますが、パスがシンボリック
     リンクを指していた場合、リンク先ではなくシンボリックリンク自身のモ
     ードが変更されます。


File: python.info,  Node: Pattern language,  Next: glob モジュールとの比較,  Prev: 具象パス,  Up: pathlib --- オブジェクト指向のファイルシステムパス

5.11.1.17 Pattern language
..........................

The following wildcards are supported in patterns for *note
full_match(): 535, *note glob(): 537. and *note rglob(): 538.:

‘**’ (entire segment)

     Matches any number of file or directory segments, including zero.

‘*’ (entire segment)

     Matches one file or directory segment.

‘*’ (part of a segment)

     Matches any number of non-separator characters, including zero.

‘?’

     Matches one non-separator character.

‘[seq]’

     Matches one character in 'seq', where 'seq' is a sequence of
     characters.  Range expressions are supported; for example, ‘[a-z]’
     matches any lowercase ASCII letter.  Multiple ranges can be
     combined: ‘[a-zA-Z0-9_]’ matches any ASCII letter, digit, or
     underscore.

‘[!seq]’

     Matches one character not in 'seq', where 'seq' follows the same
     rules as above.

リテラルにマッチさせるには、メタ文字を括弧に入れてください。例えば、
‘"[?]"’ は文字 ‘"?"’ にマッチします。

The "‘**’" wildcard enables recursive globbing.  A few examples:

Pattern                       意味
                              
--------------------------------------------------------------------------------------------------------
                              
"‘**/*’"                      1つ以上の要素がある任意のパス。
                              
                              
"‘**/*.py’"                   最後の要素が "‘.py’" で終わる任意のパス。
                              
                              
"‘assets/**’"                 "‘assets/’" で始まる任意のパス。
                              
                              
"‘assets/**/*’"               "‘assets/’" で始まる任意のパス("‘assets/’" 自身を除く)。
                              

     注釈: Globbing with the "‘**’" wildcard visits every directory in
     the tree.  Large directory trees may take a long time to search.

バージョン 3.13 で変更: Globbing with a pattern that ends with "‘**’"
returns both files and directories.  In previous versions, only
directories were returned.

In *note Path.glob(): 537. and *note rglob(): 538, a trailing slash may
be added to the pattern to match only directories.

バージョン 3.11 で変更: Globbing with a pattern that ends with a
pathname components separator (*note sep: 87a. or *note altsep: 87b.)
returns only directories.


File: python.info,  Node: glob モジュールとの比較,  Next: os と os path モジュールの比較,  Prev: Pattern language,  Up: pathlib --- オブジェクト指向のファイルシステムパス

5.11.1.18 ‘glob’ モジュールとの比較
...................................

The patterns accepted and results generated by *note Path.glob(): 537.
and *note Path.rglob(): 538. differ slightly from those by the *note
glob: 68. module:

  1. Files beginning with a dot are not special in pathlib.  This is
     like passing ‘include_hidden=True’ to *note glob.glob(): 5a0.

  2. "‘**’" pattern components are always recursive in pathlib.  This is
     like passing ‘recursive=True’ to *note glob.glob(): 5a0.

  3. "‘**’" pattern components do not follow symlinks by default in
     pathlib.  This behaviour has no equivalent in *note glob.glob():
     5a0, but you can pass ‘recurse_symlinks=True’ to *note Path.glob():
     537. for compatible behaviour.

  4. Like all *note PurePath: 6cd. and *note Path: 266. objects, the
     values returned from *note Path.glob(): 537. and *note
     Path.rglob(): 538. don't include trailing slashes.

  5. The values returned from pathlib's ‘path.glob()’ and ‘path.rglob()’
     include the 'path' as a prefix, unlike the results of
     ‘glob.glob(root_dir=path)’.

  6. The values returned from pathlib's ‘path.glob()’ and ‘path.rglob()’
     may include 'path' itself, for example when globbing "‘**’",
     whereas the results of ‘glob.glob(root_dir=path)’ never include an
     empty string that would correspond to 'path'.


File: python.info,  Node: os と os path モジュールの比較,  Next: プロトコル,  Prev: glob モジュールとの比較,  Up: pathlib --- オブジェクト指向のファイルシステムパス

5.11.1.19 ‘os’ と ‘os.path’ モジュールの比較
............................................

pathlib implements path operations using *note PurePath: 6cd. and *note
Path: 266. objects, and so it's said to be 'object-oriented'.  On the
other hand, the *note os: a5. and *note os.path: a6. modules supply
functions that work with low-level ‘str’ and ‘bytes’ objects, which is a
more 'procedural' approach.  Some users consider the object-oriented
style to be more readable.

Many functions in *note os: a5. and *note os.path: a6. support ‘bytes’
paths and *note paths relative to directory descriptors: 1302.  These
features aren't available in pathlib.

Python's ‘str’ and ‘bytes’ types, and portions of the *note os: a5. and
*note os.path: a6. modules, are written in C and are very speedy.
pathlib is written in pure Python and is often slower, but rarely slow
enough to matter.

pathlib's path normalization is slightly more opinionated and consistent
than *note os.path: a6.  For example, whereas *note os.path.abspath():
1532. eliminates "‘..’" segments from a path, which may change its
meaning if symlinks are involved, *note Path.absolute(): 1a26. preserves
these segments for greater safety.

pathlib's path normalization may render it unsuitable for some
applications:

  1. pathlib normalizes ‘Path("my_folder/")’ to ‘Path("my_folder")’,
     which changes a path's meaning when supplied to various operating
     system APIs and command-line utilities.  Specifically, the absence
     of a trailing separator may allow the path to be resolved as either
     a file or directory, rather than a directory only.

  2. pathlib normalizes ‘Path("./my_program")’ to ‘Path("my_program")’,
     which changes a path's meaning when used as an executable search
     path, such as in a shell or when spawning a child process.
     Specifically, the absence of a separator in the path may force it
     to be looked up in ‘PATH’ rather than the current directory.

As a consequence of these differences, pathlib is not a drop-in
replacement for *note os.path: a6.

* Menu:

* 対応するツール::


File: python.info,  Node: 対応するツール,  Up: os と os path モジュールの比較

5.11.1.20 対応するツール
........................

下にあるのは、様々な *note os: a5. 関数とそれに相当する *note PurePath:
6cd. あるいは *note Path: 266. の同等のものとの対応表です。

*note os: a5. と *note os.path: a6.       ‘pathlib’
                                          
---------------------------------------------------------------------------------------------
                                          
*note os.path.dirname(): 2c47.            *note PurePath.parent: 1a9d.
                                          
                                          
*note os.path.basename(): 2c48.           *note PurePath.name: 2c2d.
                                          
                                          
*note os.path.splitext(): 1959.           *note PurePath.stem: 2c2e,
                                          *note PurePath.suffix: 1957.
                                          
                                          
*note os.path.join(): 19a9.               *note PurePath.joinpath(): 2c30.
                                          
                                          
*note os.path.isabs(): 531.               *note PurePath.is_absolute(): 1a9c.
                                          
                                          
*note os.path.relpath(): 6d1.             *note PurePath.relative_to(): 2fd. (1)
                                          
                                          
*note os.path.expanduser(): c09.          *note Path.expanduser(): 1042. (2)
                                          
                                          
*note os.path.realpath(): 262.            *note Path.resolve(): 1a6d.
                                          
                                          
*note os.path.abspath(): 1532.            *note Path.absolute(): 1a26. (3)
                                          
                                          
*note os.path.exists(): c03.              *note Path.exists(): c0b.
                                          
                                          
*note os.path.isfile(): c06.              *note Path.is_file(): 539.
                                          
                                          
*note os.path.isdir(): c05.               *note Path.is_dir(): 53a.
                                          
                                          
*note os.path.islink(): c01.              *note Path.is_symlink(): c0d.
                                          
                                          
*note os.path.isjunction(): 6ca.          *note Path.is_junction(): 6d2.
                                          
                                          
*note os.path.ismount(): c07.             *note Path.is_mount(): c0c.
                                          
                                          
*note os.path.samefile(): 1173.           *note Path.samefile(): 1040.
                                          
                                          
*note os.getcwd(): 1909.                  *note Path.cwd(): 1a9b.
                                          
                                          
*note os.stat(): 26d.                     *note Path.stat(): a24.
                                          
                                          
*note os.lstat(): 6c8.                    *note Path.lstat(): 2c38.
                                          
                                          
*note os.listdir(): 1312.                 *note Path.iterdir(): 26e.
                                          
                                          
*note os.walk(): 6d0.                     *note Path.walk(): 6cf. (4)
                                          
                                          
*note os.mkdir(): 52b,                    *note Path.mkdir(): 1041.
*note os.makedirs(): 52c.                 

*note os.link(): 1307.                    *note Path.hardlink_to(): a22.
                                          
                                          
*note os.symlink(): 130c.                 *note Path.symlink_to(): a23.
                                          
                                          
*note os.readlink(): b1a.                 *note Path.readlink(): b19.
                                          
                                          
*note os.rename(): 1309.                  *note Path.rename(): 1891.
                                          
                                          
*note os.replace(): 130a.                 *note Path.replace(): 2c40.
                                          
                                          
*note os.remove(): 1308,                  *note Path.unlink(): 1dd5.
*note os.unlink(): 130d.                  

*note os.rmdir(): 130b.                   *note Path.rmdir(): 2c3c.
                                          
                                          
*note os.chmod(): 529.                    *note Path.chmod(): a25.
                                          
                                          
*note os.lchmod(): 528.                   *note Path.lchmod(): 2c42.
                                          

脚注
....

   ---------- Footnotes ----------

   (1) *note os.path.relpath(): 6d1. calls *note abspath(): 1532. to
make paths absolute and remove "‘..’" parts, whereas *note
PurePath.relative_to(): 2fd. is a lexical operation that raises *note
ValueError: 2ec. when its inputs' anchors differ (e.g.  if one path is
absolute and the other relative.)

   (2) *note os.path.expanduser(): c09. returns the path unchanged if
the home directory can't be resolved, whereas *note Path.expanduser():
1042. raises *note RuntimeError: 244.

   (3) *note os.path.abspath(): 1532. removes "‘..’" components without
resolving symlinks, which may change the meaning of the path, whereas
*note Path.absolute(): 1a26. leaves any "‘..’" components in the path.

   (4) *note os.walk(): 6d0. always follows symlinks when categorizing
paths into 'dirnames' and 'filenames', whereas *note Path.walk(): 6cf.
categorizes all symlinks into 'filenames' when 'follow_symlinks' is
false (the default.)


File: python.info,  Node: プロトコル,  Prev: os と os path モジュールの比較,  Up: pathlib --- オブジェクト指向のファイルシステムパス

5.11.1.21 プロトコル
....................

The ‘pathlib.types’ module provides types for static type checking.

Added in version 3.14.

 -- クラス: pathlib.types.PathInfo

     A *note typing.Protocol: 56b. describing the *note Path.info: 26b.
     attribute.  Implementations may return cached results from their
     methods.

      -- メソッド: exists (*, follow_symlinks=True)

          Return ‘True’ if the path is an existing file or directory, or
          any other kind of file; return ‘False’ if the path doesn't
          exist.

          If 'follow_symlinks' is ‘False’, return ‘True’ for symlinks
          without checking if their targets exist.

      -- メソッド: is_dir (*, follow_symlinks=True)

          Return ‘True’ if the path is a directory, or a symbolic link
          pointing to a directory; return ‘False’ if the path is (or
          points to) any other kind of file, or if it doesn't exist.

          If 'follow_symlinks' is ‘False’, return ‘True’ only if the
          path is a directory (without following symlinks); return
          ‘False’ if the path is any other kind of file, or if it
          doesn't exist.

      -- メソッド: is_file (*, follow_symlinks=True)

          Return ‘True’ if the path is a file, or a symbolic link
          pointing to a file; return ‘False’ if the path is (or points
          to) a directory or other non-file, or if it doesn't exist.

          If 'follow_symlinks' is ‘False’, return ‘True’ only if the
          path is a file (without following symlinks); return ‘False’ if
          the path is a directory or other non-file, or if it doesn't
          exist.

      -- メソッド: is_symlink ()

          Return ‘True’ if the path is a symbolic link (even if broken);
          return ‘False’ if the path is a directory or any kind of file,
          or if it doesn't exist.


File: python.info,  Node: os path --- 一般的なパス名操作,  Next: stat --- stat の結果を解釈する,  Prev: pathlib --- オブジェクト指向のファイルシステムパス,  Up: ファイルとディレクトリへのアクセス

5.11.2 ‘os.path’ -- 一般的なパス名操作
--------------------------------------

'ソースコード:' Lib/genericpath.py(1), Lib/posixpath.py(2) (POSIX) 、
Lib/ntpath.py(3) (Windows) 。

__________________________________________________________________

このモジュールはパス名を扱う際に便利な関数を実装しています。ファイルの読
み書きをする際は *note open(): 316. を、ファイルシステムにアクセスするに
は *note os: a5. モジュールをご参照ください。パスの引数は文字列、バイト
列、あるいは *note os.PathLike: e4b. プロトコルを実装するあらゆるオブジ
ェクトとして渡すことができます。

Unix シェルとは異なり、Python はあらゆるパス展開を '自動的には' 行いませ
ん。アプリケーションがシェルのようなパス展開を必要とした場合は、 *note
expanduser(): c09. や *note expandvars(): 15f2. といった関数を明示的に呼
び出すことで行えます。(*note glob: 68. モジュールも参照してください)

参考
....

*note pathlib: a8. モジュールは高水準のパスオブジェクトを提供します。

     注釈: 以下のすべての関数は、そのパラメータにバイト列のみ、あるいは
     文字列のみ受け付けます。パスまたはファイル名を返す場合、返り値は同
     じ型のオブジェクトになります。

     注釈: Since different operating systems have different path name
     conventions, there are several versions of this module in the
     standard library.  The ‘os.path’ module is always the path module
     suitable for the operating system Python is running on, and
     therefore usable for local paths.  However, you can also import and
     use the individual modules if you want to manipulate a path that is
     'always' in one of the different formats.  They all have the same
     interface:

        * UNIX 形式のパスを扱う ‘posixpath’

        * Windows のパスを扱う ‘ntpath’

バージョン 3.8 で変更: *note exists(): c03.、 *note lexists(): c04.、
*note isdir(): c05.、 *note isfile(): c06.、 *note islink(): c01.、およ
び *note ismount(): c07. は、OS レベルで表現できない文字列を含む可能性が
ある例外を送出する代わりに ‘False’ を返すようになりました。

 -- の関数: os.path.abspath (path)

     Return a normalized absolutized version of the pathname 'path'.  On
     most platforms, this is equivalent to calling
     ‘normpath(join(os.getcwd(), path))’.

     参考
     ....

     *note os.path.join(): 19a9. and *note os.path.normpath(): 1531.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.basename (path, /)

     パス名 'path' の末尾のファイル名部分を返します。これは関数 *note
     split(): 2c51. に 'path' を渡した時に返されるペアの 2 番めの要素で
     す。この関数が返すのは Unix の ‘basename’ とは異なります; Unix の
     ‘basename’ は ‘'/foo/bar/'’ に対して ‘'bar'’ を返しますが、関数
     *note basename(): 2c48. は空文字列 (‘''’) を返します。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.commonpath (paths)

     Return the longest common sub-path of each pathname in the iterable
     'paths'.  Raise *note ValueError: 2ec. if 'paths' contain both
     absolute and relative pathnames, if 'paths' are on different
     drives, or if 'paths' is empty.  Unlike *note commonprefix(): 103e,
     this returns a valid path.

     Added in version 3.5.

     バージョン 3.6 で変更: *note path-like objects: 5a1. のシーケンスを
     受け入れるようになりました。

     バージョン 3.13 で変更: Any iterable can now be passed, rather than
     just sequences.

 -- の関数: os.path.commonprefix (list, /)

     Return the longest string prefix (taken character-by-character)
     that is a prefix of all strings in 'list'.  If 'list' is empty,
     return the empty string (‘''’).

          警告: This function may return invalid paths because it works
          a character at a time.  If you need a 'common path prefix',
          then the algorithm implemented in this function is not secure.
          Use *note commonpath(): 103d. for finding a common path
          prefix.

               >>> os.path.commonprefix(['/usr/lib', '/usr/local/lib'])
               '/usr/l'

               >>> os.path.commonpath(['/usr/lib', '/usr/local/lib'])
               '/usr'

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.dirname (path, /)

     パス名 'path' のディレクトリ名を返します。これは関数 *note split():
     2c51. に 'path' を渡した時に返されるペアの 1 番めの要素です。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.exists (path)

     'path' が実在するパスかオープンしているファイル記述子を参照している
     場合 ‘True’ を返します。壊れたシンボリックリンクについては ‘False’
     を返します。一部のプラットフォームでは、たとえ 'path' が物理的に存
     在していたとしても、要求されたファイルに対する *note os.stat():
     26d. の実行権がなければこの関数が ‘False’ を返すことがあります。

     バージョン 3.3 で変更: 'path' は整数でも可能になりました: それがオ
     ープンしているファイル記述子なら ‘True’ が返り、それ以外なら
     ‘False’ が返ります。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.lexists (path)

     Return ‘True’ if 'path' refers to an existing path, including
     broken symbolic links.  Equivalent to *note exists(): c03. on
     platforms lacking *note os.lstat(): 6c8.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.expanduser (path)

     Unix および Windows では、与えられた引数の先頭のパス要素 ‘~’ 、また
     は ‘~user’ を、 'user' のホームディレクトリのパスに置き換えて返しま
     す。

     Unix では、先頭の ‘~’ は、環境変数 ‘HOME’ が設定されているならその
     値に置き換えられます。設定されていない場合は、現在のユーザのホーム
     ディレクトリをビルトインモジュール *note pwd: b7. を使ってパスワー
     ドディレクトリから探して置き換えます。先頭の ‘~user’ については、直
     接パスワードディレクトリから探します。

     On Windows, ‘USERPROFILE’ will be used if set, otherwise a
     combination of ‘HOMEPATH’ and ‘HOMEDRIVE’ will be used.  An initial
     ‘~user’ is handled by checking that the last directory component of
     the current user's home directory matches ‘USERNAME’, and replacing
     it if so.

     置き換えに失敗したり、引数のパスがチルダで始まっていなかった場合は
     、パスをそのまま返します。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.8 で変更: Windowsで ‘HOME’ は参照しなくなりました。

 -- の関数: os.path.expandvars (path)

     引数のパスの環境変数を展開して返します。引数の中の ‘$name’ または
     ‘${name}’ のような形式の文字列は環境変数、 'name' の値に置き換えら
     れます。不正な変数名や存在しない変数名の場合には変換されず、そのま
     ま返します。

     Windows では、 ‘$name’ や ‘${name}’ の形式に加えて、 ‘%name%’ の形
     式もサポートされています。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.getatime (path, /)

     Return the time of last access of 'path'.  The return value is a
     floating-point number giving the number of seconds since the epoch
     (see the *note time: f4. module).  Raise *note OSError: 2c0. if the
     file does not exist or is inaccessible.

 -- の関数: os.path.getmtime (path, /)

     Return the time of last modification of 'path'.  The return value
     is a floating-point number giving the number of seconds since the
     epoch (see the *note time: f4. module).  Raise *note OSError: 2c0.
     if the file does not exist or is inaccessible.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.getctime (path, /)

     システムの ctime、Unix系など一部のシステムでは最後にメタデータが変
     更された時刻、Windows などその他のシステムでは 'path' の作成時刻を
     返します。返り値はエポック (*note time: f4. モジュールを参照) から
     の経過時間を示す秒数になります。ファイルが存在しない、あるいはアク
     セスできなかった場合は *note OSError: 2c0. を送出します。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.getsize (path, /)

     'path' のサイズをバイト数で返します。ファイルが存在しない、あるいは
     アクセスできなかった場合は *note OSError: 2c0. を送出します。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.isabs (path, /)

     Return ‘True’ if 'path' is an absolute pathname.  On Unix, that
     means it begins with a slash, on Windows that it begins with two
     (back)slashes, or a drive letter, colon, and (back)slash together.

     参考
     ....

     *note abspath(): 1532.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.13 で変更: On Windows, returns ‘False’ if the given
     path starts with exactly one (back)slash.

 -- の関数: os.path.isfile (path)

     'path' が *note 存在する: c03. 一般ファイルなら ‘True’ を返します。
     この関数はシンボリックリンクの先を辿るので、同じパスに対して *note
     islink(): c01. と *note isfile(): c06. の両方が真を返すことがありま
     す。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.isdir (path, /)

     'path' が *note 存在する: c03. ディレクトリなら ‘True’ を返します。
     この関数はシンボリックリンクの先を辿るので、同じパスに対して *note
     islink(): c01. と *note isdir(): c05. の両方が真を返すことがありま
     す。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.isjunction (path)

     Return ‘True’ if 'path' refers to an *note existing: c04. directory
     entry that is a junction.  Always return ‘False’ if junctions are
     not supported on the current platform.

     Added in version 3.12.

 -- の関数: os.path.islink (path)

     'path' が *note 存在する: c03. ディレクトリを指すシンボリックリンク
     なら ‘True’ を返します。 Python ランタイムがシンボリックリンクをサ
     ポートしていないプラットフォームでは、常に ‘False’ を返します。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.ismount (path)

     Return ‘True’ if pathname 'path' is a 'mount point': a point in a
     file system where a different file system has been mounted.  On
     POSIX, the function checks whether 'path"s parent, ‘`path'/..’, is
     on a different device than 'path', or whether ‘`path'/..’ and
     'path' point to the same i-node on the same device -- this should
     detect mount points for all Unix and POSIX variants.  It is not
     able to reliably detect bind mounts on the same filesystem.  On
     Linux systems, it will always return ‘True’ for btrfs subvolumes,
     even if they aren't mount points.  On Windows, a drive letter root
     and a share UNC are always mount points, and for any other path
     ‘GetVolumePathName’ is called to see if it is different from the
     input path.

     バージョン 3.4 で変更: Added support for detecting non-root mount
     points on Windows.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.isdevdrive (path)

     Return ‘True’ if pathname 'path' is located on a Windows Dev Drive.
     A Dev Drive is optimized for developer scenarios, and offers faster
     performance for reading and writing files.  It is recommended for
     use for source code, temporary build directories, package caches,
     and other IO-intensive operations.

     May raise an error for an invalid path, for example, one without a
     recognizable drive, but returns ‘False’ on platforms that do not
     support Dev Drives.  See the Windows documentation(4) for
     information on enabling and creating Dev Drives.

     Added in version 3.12.

     バージョン 3.13 で変更: The function is now available on all
     platforms, and will always return ‘False’ on those that have no
     support for Dev Drives

 -- の関数: os.path.isreserved (path)

     Return ‘True’ if 'path' is a reserved pathname on the current
     system.

     On Windows, reserved filenames include those that end with a space
     or dot; those that contain colons (i.e.  file streams such as
     "name:stream"), wildcard characters (i.e.  ‘'*?"<>'’), pipe, or
     ASCII control characters; as well as DOS device names such as
     "NUL", "CON", "CONIN$", "CONOUT$", "AUX", "PRN", "COM1", and
     "LPT1".

          注釈: This function approximates rules for reserved paths on
          most Windows systems.  These rules change over time in various
          Windows releases.  This function may be updated in future
          Python releases as changes to the rules become broadly
          available.

     *note Availability: 213f.: Windows.

     Added in version 3.13.

 -- の関数: os.path.join (path, /, *paths)

     Join one or more path segments intelligently.  The return value is
     the concatenation of 'path' and all members of '*paths', with
     exactly one directory separator following each non-empty part,
     except the last.  That is, the result will only end in a separator
     if the last part is either empty or ends in a separator.

     If a segment is an absolute path (which on Windows requires both a
     drive and a root), then all previous segments are ignored and
     joining continues from the absolute path segment.  On Linux, for
     example:

          >>> os.path.join('/home/foo', 'bar')
          '/home/foo/bar'
          >>> os.path.join('/home/foo', '/home/bar')
          '/home/bar'

     On Windows, the drive is not reset when a rooted path segment
     (e.g., ‘r'\foo'’) is encountered.  If a segment is on a different
     drive or is an absolute path, all previous segments are ignored and
     the drive is reset.  For example:

          >>> os.path.join('c:\\', 'foo')
          'c:\\foo'
          >>> os.path.join('c:\\foo', 'd:\\bar')
          'd:\\bar'

     Note that since there is a current directory for each drive,
     ‘os.path.join("c:", "foo")’ represents a path relative to the
     current directory on drive ‘C:’ (‘c:foo’), not ‘c:\foo’.

     バージョン 3.6 で変更: 'path' と 'paths' が *note path-like object:
     5a1. を受け付けるようになりました。

 -- の関数: os.path.normcase (path, /)

     パス名の大文字・小文字を正規化します。 Windowsでは、パス名にある文
     字を全て小文字に、スラッシュをバックスラッシュに変換します。 他のオ
     ペレーティングシステムでは、パスを変更せずに返します。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.normpath (path)

     パスを正規化します。余分な区切り文字や上位レベル参照を除去し、
     ‘A//B’、‘A/B/’、‘A/./B’ や ‘A/foo/../B’ などはすべて ‘A/B’ になりま
     す。この文字列操作は、シンボリックリンクを含むパスの意味を変えてし
     まう場合があります。Windows では、スラッシュをバックスラッシュに変
     換します。大文字小文字の正規化には *note normcase(): 2c56. を使用し
     てください。

          注釈: On POSIX systems, in accordance with IEEE Std 1003.1
          2013 Edition; 4.13 Pathname Resolution(5), if a pathname
          begins with exactly two slashes, the first component following
          the leading characters may be interpreted in an
          implementation-defined manner, although more than two leading
          characters shall be treated as a single character.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.realpath (path, /, *, strict=False)

     Return the canonical path of the specified filename, eliminating
     any symbolic links encountered in the path (if they are supported
     by the operating system).  On Windows, this function will also
     resolve MS-DOS (also called 8.3) style names such as ‘C:\\PROGRA~1’
     to ‘C:\\Program Files’.

     By default, the path is evaluated up to the first component that
     does not exist, is a symlink loop, or whose evaluation raises *note
     OSError: 2c0.  All such components are appended unchanged to the
     existing part of the path.

     Some errors that are handled this way include "access denied", "not
     a directory", or "bad argument to internal function".  Thus, the
     resulting path may be missing or inaccessible, may still contain
     links or loops, and may traverse non-directories.

     This behavior can be modified by keyword arguments:

     If 'strict' is ‘True’, the first error encountered when evaluating
     the path is re-raised.  In particular, *note FileNotFoundError:
     264. is raised if 'path' does not exist, or another *note OSError:
     2c0. if it is otherwise inaccessible.

     If 'strict' is *note os.path.ALLOW_MISSING: 263, errors other than
     *note FileNotFoundError: 264. are re-raised (as with
     ‘strict=True’).  Thus, the returned path will not contain any
     symbolic links, but the named file and some of its parent
     directories may be missing.

          注釈: This function emulates the operating system's procedure
          for making a path canonical, which differs slightly between
          Windows and UNIX with respect to how links and subsequent path
          components interact.

          Operating system APIs make paths canonical as needed, so it's
          not normally necessary to call this function.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.8 で変更: Windows においてシンボリックリンクとジャンク
     ションが解決されるようになりました。

     バージョン 3.10 で変更: 'strict' 引数が追加されました。

     バージョン 3.14 で変更: The *note ALLOW_MISSING: 263. value for the
     'strict' parameter was added.

 -- データ: os.path.ALLOW_MISSING

     Special value used for the 'strict' argument in *note realpath():
     262.

     Added in version 3.14.

 -- の関数: os.path.relpath (path, start=os.curdir)

     カレントディレクトリあるいはオプションの 'start' ディレクトリからの
     'path' への相対パスを返します。これはパス計算で行っており、ファイル
     システムにアクセスして 'path' や 'start' の存在や性質を確認すること
     はありません。Windowsでは、 'path' と 'start' が異なるドライブの場
     合、 *note ValueError: 2ec. を送出します。

     'start' defaults to *note os.curdir: 2c57.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.samefile (path1, path2, /)

     引数の両パス名が同じファイルまたはディレクトリを参照している場合、
     ‘True’ を返します。これは、デバイス番号と i-node 番号で決定されます
     。どちらかのパス名への *note os.stat(): 26d. 呼び出しが失敗した場合
     、例外が送出されます。

     バージョン 3.2 で変更: Windows サポートを追加しました。

     バージョン 3.4 で変更: Windows が他のプラットフォームと同じ実装を使
     用するようになりました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.sameopenfile (fp1, fp2)

     ファイル記述子 'fp1' と 'fp2' が同じファイルを参照していたら ‘True’
     を返します。

     バージョン 3.2 で変更: Windows サポートを追加しました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.samestat (stat1, stat2, /)

     stat タプル 'stat1' と 'stat2' が同じファイルを参照していれば
     ‘True’ を返します。これらのタプルは *note os.fstat(): f8c. 、 *note
     os.lstat(): 6c8. あるいは *note os.stat(): 26d. の返り値で構いませ
     ん。この関数は *note samefile(): 1173. と *note sameopenfile():
     2c58. を使用した比較に基いて実装しています。

     バージョン 3.4 で変更: Windows サポートを追加しました。

 -- の関数: os.path.split (path, /)

     Split the pathname 'path' into a pair, ‘(head, tail)’ where 'tail'
     is the last pathname component and 'head' is everything leading up
     to that.  The 'tail' part will never contain a slash; if 'path'
     ends in a slash, 'tail' will be empty.  If there is no slash in
     'path', 'head' will be empty.  If 'path' is empty, both 'head' and
     'tail' are empty.  Trailing slashes are stripped from 'head' unless
     it is the root (one or more slashes only).  In all cases,
     ‘join(head, tail)’ returns a path to the same location as 'path'
     (but the strings may differ).  Also see the functions *note join():
     19a9, *note dirname(): 2c47. and *note basename(): 2c48.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.splitdrive (path, /)

     パス名 'path' を ‘(drive, tail)’ のペアに分割します。'drive' はマウ
     ントポイントか空文字列になります。ドライブ指定をサポートしていない
     システムでは、'drive' は常に空文字になります。どの場合でも、‘drive
     + tail’ は 'path' と等しくなります。

     Windows では、パス名はドライブ名/UNC 共有ポイントと相対パスに分割さ
     れます。

     パスがドライブレターを含む場合、ドライブレターにはコロンまでが含ま
     れます:

          >>> splitdrive("c:/dir")
          ("c:", "/dir")

     If the path contains a UNC path, drive will contain the host name
     and share:

          >>> splitdrive("//host/computer/dir")
          ("//host/computer", "/dir")

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.path.splitroot (path, /)

     Split the pathname 'path' into a 3-item tuple ‘(drive, root, tail)’
     where 'drive' is a device name or mount point, 'root' is a string
     of separators after the drive, and 'tail' is everything after the
     root.  Any of these items may be the empty string.  In all cases,
     ‘drive + root + tail’ will be the same as 'path'.

     On POSIX systems, 'drive' is always empty.  The 'root' may be empty
     (if 'path' is relative), a single forward slash (if 'path' is
     absolute), or two forward slashes (implementation-defined per IEEE
     Std 1003.1-2017; 4.13 Pathname Resolution(6).)  For example:

          >>> splitroot('/home/sam')
          ('', '/', 'home/sam')
          >>> splitroot('//home/sam')
          ('', '//', 'home/sam')
          >>> splitroot('///home/sam')
          ('', '/', '//home/sam')

     On Windows, 'drive' may be empty, a drive-letter name, a UNC share,
     or a device name.  The 'root' may be empty, a forward slash, or a
     backward slash.  For example:

          >>> splitroot('C:/Users/Sam')
          ('C:', '/', 'Users/Sam')
          >>> splitroot('//Server/Share/Users/Sam')
          ('//Server/Share', '/', 'Users/Sam')

     Added in version 3.12.

 -- の関数: os.path.splitext (path, /)

     Split the pathname 'path' into a pair ‘(root, ext)’ such that ‘root
     + ext == path’, and the extension, 'ext', is empty or begins with a
     period and contains at most one period.

     If the path contains no extension, 'ext' will be ‘''’:

          >>> splitext('bar')
          ('bar', '')

     If the path contains an extension, then 'ext' will be set to this
     extension, including the leading period.  Note that previous
     periods will be ignored:

          >>> splitext('foo.bar.exe')
          ('foo.bar', '.exe')
          >>> splitext('/foo/bar.exe')
          ('/foo/bar', '.exe')

     Leading periods of the last component of the path are considered to
     be part of the root:

          >>> splitext('.cshrc')
          ('.cshrc', '')
          >>> splitext('/foo/....jpg')
          ('/foo/....jpg', '')

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- データ: os.path.supports_unicode_filenames

     ファイル名に任意の Unicode 文字列を (システムの制限内で) 使用できる
     場合は ‘True’ になります。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/genericpath.py

   (2) https://github.com/python/cpython/tree/3.14/Lib/posixpath.py

   (3) https://github.com/python/cpython/tree/3.14/Lib/ntpath.py

   (4) https://learn.microsoft.com/windows/dev-drive/

   (5) 
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13

   (6) 
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13


File: python.info,  Node: stat --- stat の結果を解釈する,  Next: filecmp --- ファイルとディレクトリの比較,  Prev: os path --- 一般的なパス名操作,  Up: ファイルとディレクトリへのアクセス

5.11.3 ‘stat’ -- ‘stat()’ の結果を解釈する
------------------------------------------

'ソースコード:' Lib/stat.py(1)

__________________________________________________________________

The ‘stat’ module defines constants and functions for interpreting the
results of *note os.stat(): 26d, *note os.fstat(): f8c. and *note
os.lstat(): 6c8. (if they exist).  For complete details about the
‘stat()’, ‘fstat()’ and ‘lstat()’ calls, consult the documentation for
your system.

バージョン 3.4 で変更: stat モジュールは、C 実装に裏付けされるようになり
ました。

The ‘stat’ module defines the following functions to test for specific
file types:

 -- の関数: stat.S_ISDIR (mode)

     ファイルのモードがディレクトリの場合にゼロでない値を返します。

 -- の関数: stat.S_ISCHR (mode)

     ファイルのモードがキャラクタ型の特殊デバイスファイルの場合にゼロで
     ない値を返します。

 -- の関数: stat.S_ISBLK (mode)

     ファイルのモードがブロック型の特殊デバイスファイルの場合にゼロでな
     い値を返します。

 -- の関数: stat.S_ISREG (mode)

     ファイルのモードが通常ファイルの場合にゼロでない値を返します。

 -- の関数: stat.S_ISFIFO (mode)

     ファイルのモードが FIFO (名前つきパイプ) の場合にゼロでない値を返し
     ます。

 -- の関数: stat.S_ISLNK (mode)

     ファイルのモードがシンボリックリンクの場合にゼロでない値を返します
     。

 -- の関数: stat.S_ISSOCK (mode)

     ファイルのモードがソケットの場合にゼロでない値を返します。

 -- の関数: stat.S_ISDOOR (mode)

     ファイルのモードがドアの場合にゼロでない値を返します。

     Added in version 3.4.

 -- の関数: stat.S_ISPORT (mode)

     ファイルのモードがイベントポートの場合にゼロでない値を返します。

     Added in version 3.4.

 -- の関数: stat.S_ISWHT (mode)

     ファイルのモードがホワイトアウトの場合にゼロでない値を返します。

     Added in version 3.4.

より一般的なファイルのモードを操作するための二つの関数が定義されています
:

 -- の関数: stat.S_IMODE (mode)

     *note os.chmod(): 529. で設定することのできる一部のファイルモード
     -- すなわち、ファイルの許可ビット (permission bits) に加え、 (サポ
     ートされているシステムでは) スティッキービット (sticky bit)、実行グ
     ループ ID 設定 (set-group-id) および実行ユーザ ID 設定
     (set-user-id) ビット -- を返します。

 -- の関数: stat.S_IFMT (mode)

     Return the portion of the file's mode that describes the file type
     (used by the ‘S_IS*()’ functions above).

Normally, you would use the ‘os.path.is*()’ functions for testing the
type of a file; the functions here are useful when you are doing
multiple tests of the same file and wish to avoid the overhead of the
‘stat()’ system call for each test.  These are also useful when checking
for information about a file that isn't handled by *note os.path: a6,
like the tests for block and character devices.

以下はプログラム例です:

     import os, sys
     from stat import *

     def walktree(top, callback):
         '''recursively descend the directory tree rooted at top,
            calling the callback function for each regular file'''

         for f in os.listdir(top):
             pathname = os.path.join(top, f)
             mode = os.lstat(pathname).st_mode
             if S_ISDIR(mode):
                 # It's a directory, recurse into it
                 walktree(pathname, callback)
             elif S_ISREG(mode):
                 # It's a file, call the callback function
                 callback(pathname)
             else:
                 # Unknown file type, print a message
                 print('Skipping %s' % pathname)

     def visitfile(file):
         print('visiting', file)

     if __name__ == '__main__':
         walktree(sys.argv[1], visitfile)

ファイルのモードを人間が可読な文字列に変換するために、追加のユーティリテ
ィ関数が提供されています。

 -- の関数: stat.filemode (mode)

     ファイルのモードを '-rwxrwxrwx' 形式の文字列に変換します。

     Added in version 3.3.

     バージョン 3.4 で変更: この関数は、*note S_IFDOOR: 11bd. 、 *note
     S_IFPORT: 11be. 、 *note S_IFWHT: 11bf. をサポートしています。

以下の全ての変数は、 *note os.stat(): 26d. 、 *note os.fstat(): f8c. 、
または *note os.lstat(): 6c8. が返す 10 要素のタプルにおけるインデクスを
単にシンボル定数化したものです。

 -- データ: stat.ST_MODE

     Iノードの保護モード。

 -- データ: stat.ST_INO

     Iノード番号。

 -- データ: stat.ST_DEV

     Iノードが存在するデバイス。

 -- データ: stat.ST_NLINK

     該当する Iノードへのリンク数。

 -- データ: stat.ST_UID

     ファイルの所持者のユーザ ID。

 -- データ: stat.ST_GID

     ファイルの所持者のグループ ID。

 -- データ: stat.ST_SIZE

     通常ファイルではバイトサイズ; いくつかの特殊ファイルでは処理待ちの
     データ量。

 -- データ: stat.ST_ATIME

     最後にアクセスした時刻。

 -- データ: stat.ST_MTIME

     最後に変更された時刻。

 -- データ: stat.ST_CTIME

     オペレーティングシステムから返される"ctime"。あるOS(Unixなど)では最
     後にメタデータが更新された時間となり、別のOS(Windowsなど)では作成時
     間となります(詳細については各プラットフォームのドキュメントを参照し
     てください)。

"ファイルサイズ" の解釈はファイルの型によって異なります。通常のファイル
の場合、サイズはファイルの大きさをバイトで表したものです。ほとんどの
Unix 系 (特に Linux) における FIFO やソケットの場合、"サイズ" は *note
os.stat(): 26d. 、 *note os.fstat(): f8c. 、あるいは *note os.lstat():
6c8. を呼び出した時点で読み出し待ちであったデータのバイト数になります; こ
の値は時に有用で、特に上記の特殊なファイルを非ブロックモードで開いた後に
ポーリングを行いたいといった場合に便利です。他のキャラクタ型およびブロッ
ク型デバイスにおけるサイズフィールドの意味はさらに異なっていて、背後のシ
ステムコールの実装によります。

以下の変数は、 *note ST_MODE: 11bc. フィールドで使用されるフラグを定義し
ています。

最初に挙げる、以下のフラグを使うよりは、上記の関数を使うほうがポータブル
です:

 -- データ: stat.S_IFSOCK

     ソケット。

 -- データ: stat.S_IFLNK

     シンボリックリンク。

 -- データ: stat.S_IFREG

     通常のファイル。

 -- データ: stat.S_IFBLK

     ブロックデバイス。

 -- データ: stat.S_IFDIR

     ディレクトリ。

 -- データ: stat.S_IFCHR

     キャラクターデバイス。

 -- データ: stat.S_IFIFO

     FIFO。

 -- データ: stat.S_IFDOOR

     ドア。

     Added in version 3.4.

 -- データ: stat.S_IFPORT

     イベントポート。

     Added in version 3.4.

 -- データ: stat.S_IFWHT

     ホワイトアウト。

     Added in version 3.4.

     注釈: *note S_IFDOOR: 11bd. 、 *note S_IFPORT: 11be. 、または *note
     S_IFWHT: 11bf. は、プラットフォームがこれらのファイルタイプをサポー
     トしていない場合、0 として定義されます。

以下のフラグは、 *note os.chmod(): 529. の 'mode' 引数に使うこともできま
す:

 -- データ: stat.S_ISUID

     UID ビットを設定する。

 -- データ: stat.S_ISGID

     グループIDビットを設定する。このビットには幾つかの特殊ケースがあり
     ます。ディレクトリに対して設定されていた場合、 BSD のセマンティクス
     が利用される事を示しています。すなわち、そこに作成されるファイルは
     、作成したプロセスの有効グループID (effective group ID) ではなくそ
     のディレクトリのグループIDを継承し、そこに作成されるディレクトリに
     も *note S_ISGID: 2c76. ビットが設定されます。グループ実行ビット
     (*note S_IXGRP: 2c77.) が設定されていないファイルに対してこのビット
     が設定されていた場合、強制ファイル/レコードロックを意味します
     (*note S_ENFMT: 2c78. も参照してください)。

 -- データ: stat.S_ISVTX

     スティッキービット。このビットがディレクトリに対して設定されている
     とき、そのディレクトリ内のファイルは、そのファイルのオーナー、ある
     いはそのディレクトリのオーナーか特権プロセスのみが、リネームや削除
     をすることが出来ることを意味しています。

 -- データ: stat.S_IRWXU

     ファイルオーナーの権限に対するマスク。

 -- データ: stat.S_IRUSR

     オーナーがリード権限を持っている。

 -- データ: stat.S_IWUSR

     オーナーがライト権限を持っている。

 -- データ: stat.S_IXUSR

     オーナーが実行権限を持っている。

 -- データ: stat.S_IRWXG

     グループの権限に対するマスク。

 -- データ: stat.S_IRGRP

     グループがリード権限を持っている。

 -- データ: stat.S_IWGRP

     グループがライト権限を持っている。

 -- データ: stat.S_IXGRP

     グループが実行権限を持っている。

 -- データ: stat.S_IRWXO

     その他 (グループ外) の権限に対するマスク。

 -- データ: stat.S_IROTH

     その他はリード権限を持っている。

 -- データ: stat.S_IWOTH

     その他はライト権限を持っている。

 -- データ: stat.S_IXOTH

     その他は実行権限を持っている。

 -- データ: stat.S_ENFMT

     System V ファイルロック強制。このフラグは *note S_ISGID: 2c76. と共
     有されています。グループ実行ビット (*note S_IXGRP: 2c77.) が設定さ
     れていないファイルでは、ファイル/レコードのロックが強制されます。

 -- データ: stat.S_IREAD

     *note S_IRUSR: 2c7b. の、 Unix V7 のシノニム。

 -- データ: stat.S_IWRITE

     *note S_IWUSR: 2c7c. の、 Unix V7 のシノニム。

 -- データ: stat.S_IEXEC

     *note S_IXUSR: 2c7d. の、 Unix V7 のシノニム。

以下のフラグを *note os.chflags(): 1305. の 'flags' 引数として利用できま
す:

 -- データ: stat.UF_SETTABLE

     All user settable flags.

     Added in version 3.13.

 -- データ: stat.UF_NODUMP

     ファイルをダンプしない。

 -- データ: stat.UF_IMMUTABLE

     ファイルは変更されない。

 -- データ: stat.UF_APPEND

     ファイルは追記しかされない。

 -- データ: stat.UF_OPAQUE

     ユニオンファイルシステムのスタックを通したとき、このディレクトリは
     不透明です。

 -- データ: stat.UF_NOUNLINK

     ファイルはリネームや削除されない。

 -- データ: stat.UF_COMPRESSED

     ファイルは圧縮して保存される (macOS 10.6+)。

 -- データ: stat.UF_TRACKED

     Used for handling document IDs (macOS)

     Added in version 3.13.

 -- データ: stat.UF_DATAVAULT

     The file needs an entitlement for reading or writing (macOS 10.13+)

     Added in version 3.13.

 -- データ: stat.UF_HIDDEN

     ファイルは GUI で表示されるべきでない (macOS 10.5+)。

 -- データ: stat.SF_SETTABLE

     All super-user changeable flags

     Added in version 3.13.

 -- データ: stat.SF_SUPPORTED

     All super-user supported flags

     *note Availability: 213f.: macOS

     Added in version 3.13.

 -- データ: stat.SF_SYNTHETIC

     All super-user read-only synthetic flags

     *note Availability: 213f.: macOS

     Added in version 3.13.

 -- データ: stat.SF_ARCHIVED

     ファイルはアーカイブされているかもしれません。

 -- データ: stat.SF_IMMUTABLE

     ファイルは変更されない。

 -- データ: stat.SF_APPEND

     ファイルは追記しかされない。

 -- データ: stat.SF_RESTRICTED

     The file needs an entitlement to write to (macOS 10.13+)

     Added in version 3.13.

 -- データ: stat.SF_NOUNLINK

     ファイルはリネームや削除されない。

 -- データ: stat.SF_SNAPSHOT

     このファイルはスナップショットファイルです。

 -- データ: stat.SF_FIRMLINK

     The file is a firmlink (macOS 10.15+)

     Added in version 3.13.

 -- データ: stat.SF_DATALESS

     The file is a dataless object (macOS 10.15+)

     Added in version 3.13.

詳しい情報は *BSD か macOS システムの man page ‘chflags(2)(2)’ を参照し
てください。

Windows では、*note os.stat(): 26d. が返す ‘st_file_attributes’ メンバー
内のビットを検証する際に、以下のファイル属性定数を使用できます。これらの
定数の意味について詳しくは、Windows API documentation(3) を参照してくだ
さい。

 -- データ: stat.FILE_ATTRIBUTE_ARCHIVE
 -- データ: stat.FILE_ATTRIBUTE_COMPRESSED
 -- データ: stat.FILE_ATTRIBUTE_DEVICE
 -- データ: stat.FILE_ATTRIBUTE_DIRECTORY
 -- データ: stat.FILE_ATTRIBUTE_ENCRYPTED
 -- データ: stat.FILE_ATTRIBUTE_HIDDEN
 -- データ: stat.FILE_ATTRIBUTE_INTEGRITY_STREAM
 -- データ: stat.FILE_ATTRIBUTE_NORMAL
 -- データ: stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
 -- データ: stat.FILE_ATTRIBUTE_NO_SCRUB_DATA
 -- データ: stat.FILE_ATTRIBUTE_OFFLINE
 -- データ: stat.FILE_ATTRIBUTE_READONLY
 -- データ: stat.FILE_ATTRIBUTE_REPARSE_POINT
 -- データ: stat.FILE_ATTRIBUTE_SPARSE_FILE
 -- データ: stat.FILE_ATTRIBUTE_SYSTEM
 -- データ: stat.FILE_ATTRIBUTE_TEMPORARY
 -- データ: stat.FILE_ATTRIBUTE_VIRTUAL

     Added in version 3.5.

Windows では、*note os.lstat(): 6c8. が返す ‘st_reparse_tag’ メンバーと
の比較に次の定数が 使えます。 これらはよく知られている定数ですが、全てを
網羅したリストではありません。

 -- データ: stat.IO_REPARSE_TAG_SYMLINK
 -- データ: stat.IO_REPARSE_TAG_MOUNT_POINT
 -- データ: stat.IO_REPARSE_TAG_APPEXECLINK

     Added in version 3.8.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/stat.py

   (2) https://manpages.debian.org/chflags(2)

   (3) 
https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117.aspx


File: python.info,  Node: filecmp --- ファイルとディレクトリの比較,  Next: tempfile --- 一時ファイルやディレクトリの作成,  Prev: stat --- stat の結果を解釈する,  Up: ファイルとディレクトリへのアクセス

5.11.4 ‘filecmp’ -- ファイルとディレクトリの比較
------------------------------------------------

'ソースコード:' Lib/filecmp.py(1)

__________________________________________________________________

The ‘filecmp’ module defines functions to compare files and directories,
with various optional time/correctness trade-offs.  For comparing files,
see also the *note difflib: 3b. module.

The ‘filecmp’ module defines the following functions:

 -- の関数: filecmp.cmp (f1, f2, shallow=True)

     名前が 'f1' および 'f2' のファイルを比較し、二つのファイルが同じら
     しければ ‘True’ を返し、そうでなければ ‘False’ を返します。

     If 'shallow' is true and the *note os.stat(): 26d. signatures (file
     type, size, and modification time) of both files are identical, the
     files are taken to be equal.

     Otherwise, the files are treated as different if their sizes or
     contents differ.

     可搬性と効率のために、この関数は外部プログラムを一切呼び出さないの
     で注意してください。

     この関数は過去の比較と結果のキャッシュを使用します。ファイルの
     *note os.stat(): 26d. 情報が変更された場合、キャッシュの項目は無効
     化されます。*note clear_cache(): 1140. を使用して全キャッシュを削除
     することが出来ます。

 -- の関数: filecmp.cmpfiles (dir1, dir2, common, shallow=True)

     'dir1' と 'dir2' ディレクトリの中の、'common' で指定されたファイル
     を比較します。

     ファイル名からなる3つのリスト: 'match', 'mismatch', 'errors' を返し
     ます。'match' には双方のディレクトリで一致したファイルのリストが含
     まれ、'mismatch' にはそうでないファイル名のリストが入ります。そして
     'errors' は比較されなかったファイルが列挙されます。'errors' になる
     のは、片方あるいは両方のディレクトリに存在しなかった、ユーザーにそ
     のファイルを読む権限がなかった、その他何らかの理由で比較を完了する
     ことができなかった場合です。

     引数 'shallow' はその意味も標準の設定も *note filecmp.cmp(): 19dd.
     と同じです。

     例えば、‘cmpfiles('a', 'b', ['c', 'd/e'])’ は ‘a/c’ を ‘b/c’ と、
     ‘a/d/e’ を ‘b/d/e’ と、それぞれ比較します。‘'c'’ と ‘'d/e'’ はそれ
     ぞれ、返される3つのリストのいずれかに登録されます。

 -- の関数: filecmp.clear_cache ()

     filecmp のキャッシュをクリアします。背後のファイルシステムの mtime
     分解能未満でのファイル変更後にすぐに比較するような場合に有用です。

     Added in version 3.4.

* Menu:

* dircmp クラス::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/filecmp.py


File: python.info,  Node: dircmp クラス,  Up: filecmp --- ファイルとディレクトリの比較

5.11.4.1 ‘dircmp’ クラス
........................

 -- クラス: filecmp.dircmp (a, b, ignore=None, hide=None, *,
          shallow=True)

     Construct a new directory comparison object, to compare the
     directories 'a' and 'b'.  'ignore' is a list of names to ignore,
     and defaults to *note filecmp.DEFAULT_IGNORES: 1141.  'hide' is a
     list of names to hide, and defaults to ‘[os.curdir, os.pardir]’.

     The *note dircmp: 1142. class compares files by doing 'shallow'
     comparisons as described for *note filecmp.cmp(): 19dd. by default
     using the 'shallow' parameter.

     バージョン 3.13 で変更: Added the 'shallow' parameter.

     *note dircmp: 1142. クラスは以下のメソッドを提供しています:

      -- メソッド: report ()

          'a' と 'b' の比較を (*note sys.stdout: ccd. に) 表示します。

      -- メソッド: report_partial_closure ()

          'a' および 'b' およびそれらの直下にある共通のサブディレクトリ
          間での比較結果を出力します。

      -- メソッド: report_full_closure ()

          'a' および 'b' およびそれらの共通のサブディレクトリ間での比較
          結果を (再帰的に比較して) 出力します。

     *note dircmp: 1142. クラスは、比較されているディレクトリ階層に関す
     る様々な情報のビットを得るために使用することのできる、興味深い属性
     を数多く提供しています。

     Note that via *note __getattr__(): 6fa. hooks, all attributes are
     computed lazily, so there is no speed penalty if only those
     attributes which are lightweight to compute are used.

      -- の属性: left

          ディレクトリ 'a' です。

      -- の属性: right

          ディレクトリ 'b' です。

      -- の属性: left_list

          'a' にあるファイルおよびサブディレクトリです。'hide' および
          'ignore' でフィルタされています。

      -- の属性: right_list

          'b' にあるファイルおよびサブディレクトリです。'hide' および
          'ignore' でフィルタされています。

      -- の属性: common

          'a' および 'b' の両方にあるファイルおよびサブディレクトリです
          。

      -- の属性: left_only

          'a' だけにあるファイルおよびサブディレクトリです。

      -- の属性: right_only

          'b' だけにあるファイルおよびサブディレクトリです。

      -- の属性: common_dirs

          'a' および 'b' の両方にあるサブディレクトリです。

      -- の属性: common_files

          'a' および 'b' の両方にあるファイルです。

      -- の属性: common_funny

          'a' および 'b' の両方にあり、ディレクトリ間でタイプが異なるか
          、 *note os.stat(): 26d. がエラーを報告するような名前です。

      -- の属性: same_files

          クラスのファイル比較オペレータを用いて 'a' と 'b' の両方におい
          て同一のファイルです。

      -- の属性: diff_files

          'a' と 'b' の両方に存在し、クラスのファイル比較オペレータに基
          づいて内容が異なるファイルです。

      -- の属性: funny_files

          'a' および 'b' 両方にあるが、比較されなかったファイルです。

      -- の属性: subdirs

          A dictionary mapping names in *note common_dirs: 2cc0. to
          *note dircmp: 1142. instances (or MyDirCmp instances if this
          instance is of type MyDirCmp, a subclass of *note dircmp:
          1142.).

          バージョン 3.10 で変更: Previously entries were always *note
          dircmp: 1142. instances.  Now entries are the same type as
          'self', if 'self' is a subclass of *note dircmp: 1142.

 -- データ: filecmp.DEFAULT_IGNORES

     Added in version 3.4.

     デフォルトで *note dircmp: 1142. に無視されるディレクトリのリストで
     す。

これは ‘subdirs’ 属性を使用して 2 つのディレクトリを再帰的に探索して、共
通の異なるファイルを示すための単純化された例です:

     >>> from filecmp import dircmp
     >>> def print_diff_files(dcmp):
     ...     for name in dcmp.diff_files:
     ...         print("diff_file %s found in %s and %s" % (name, dcmp.left,
     ...               dcmp.right))
     ...     for sub_dcmp in dcmp.subdirs.values():
     ...         print_diff_files(sub_dcmp)
     ...
     >>> dcmp = dircmp('dir1', 'dir2')
     >>> print_diff_files(dcmp)


File: python.info,  Node: tempfile --- 一時ファイルやディレクトリの作成,  Next: glob --- Unix 形式のパス名のパターン展開,  Prev: filecmp --- ファイルとディレクトリの比較,  Up: ファイルとディレクトリへのアクセス

5.11.5 ‘tempfile’ -- 一時ファイルやディレクトリの作成
-----------------------------------------------------

'ソースコード:' Lib/tempfile.py(1)

__________________________________________________________________

このモジュールは一時ファイルやディレクトリを作成します。 サポートされて
いる全てのプラットフォームで動作します。 *note TemporaryFile: 2cc9.、
*note NamedTemporaryFile: 6ed.、*note TemporaryDirectory: 144c.、 *note
SpooledTemporaryFile: 8a2. は自動的に後始末をし、*note context managers
コンテキストマネージャ: 1e1. として使うことの出来る高水準のインターフェ
イスです。 *note mkstemp(): 2cca. と *note mkdtemp(): 52d. は手動で後始
末をしなければならない低水準の関数です。

ユーザが呼び出し可能な全ての関数とコンストラクタは追加の引数を受け取りま
す。 その引数によって一時ファイルやディレクトリの場所と名前を直接操作す
ることが出来ます。 このモジュールに使用されるファイル名はランダムな文字
を含みます。そのためファイルは共有された一時ディレクトリに安全に作成され
ます。 後方互換性を保つために引数の順序は若干奇妙です。 分かりやすさのた
めにキーワード引数を使用してください。

このモジュールではユーザが呼び出し可能な以下の項目を定義しています:

 -- の関数: tempfile.TemporaryFile (mode='w+b', buffering=-1,
          encoding=None, newline=None, suffix=None, prefix=None,
          dir=None, *, errors=None)

     一時的な記憶領域として使うことの出来る *note file-like object:
     17ac. を返します。 ファイルは *note mkstemp(): 2cca. と同じルールに
     より安全に作成されます。 オブジェクトは閉じられる (オブジェクトのガ
     ベージコレクションによる暗黙的なものも含みます) とすぐに破壊されま
     す。 Unix では、そのファイルのディレクトリエントリは全く作成されな
     いか、ファイル作成後すぐに削除されます。 これは他のプラットフォーム
     ではサポートされません。 よって、この関数で作成された一時ファイルが
     ファイルシステムで可視な名前を持つかどうかをコードで当てにすべきで
     はありません。

     返されたオブジェクトを :term:コンテキストマネージャ <context
     manager>'として使うことができます （*note 使用例: 2ccb. を参照して
     ください）。 コンテキストの完了やファイルオブジェクトの破壊で、一時
     ファイルはファイルシステムから削除されます。

     作成されたファイルを閉じることなく読み書きできるように、 'mode' 引
     数のデフォルトは ‘'w+b'’ です。 保存されるデータに関わらず全てのプ
     ラットフォーム上で一貫して動作するようにバイナリモードが使用されま
     す。 'buffering'、'encoding'、'errors'、'newline' は、 *note
     open(): 316. に対する引数として解釈されます。

     'dir'、'prefix'、'suffix' 引数の意味とデフォルトは *note mkstemp():
     2cca. のものと同じです。

     返されたオブジェクトは、POSIXプラットフォームでは本物のファイルオブ
     ジェクトです。 それ以外のプラットフォームでは、‘file’ 属性が下層の
     本物のファイルであるファイル様オブジェクトです。

     *note os.O_TMPFILE: 1175. フラグは、利用可能で動作する場合に用いら
     れます (Linux 固有で、Linux kernel 3.11 以降)。

     プラットフォームが Posix でも Cygwin でもない場合は、TemporaryFile
     は NamedTemporaryFile の別名です。

     引数 ‘fullpath’ を指定して *note 監査イベント: 1c6e.
     ‘tempfile.mkstemp’ を送出します。

     バージョン 3.5 で変更: 利用可能であれば *note os.O_TMPFILE: 1175. フ
     ラグが使用されます。

     バージョン 3.8 で変更: 'errors' 引数が追加されました。

 -- の関数: tempfile.NamedTemporaryFile (mode='w+b', buffering=-1,
          encoding=None, newline=None, suffix=None, prefix=None,
          dir=None, delete=True, *, errors=None, delete_on_close=True)

     This function operates exactly as *note TemporaryFile(): 2cc9.
     does, except the following differences:

        * This function returns a file that is guaranteed to have a
          visible name in the file system.

        * To manage the named file, it extends the parameters of *note
          TemporaryFile(): 2cc9. with 'delete' and 'delete_on_close'
          parameters that determine whether and how the named file
          should be automatically deleted.

     The returned object is always a *note file-like object: 17ac. whose
     ‘file’ attribute is the underlying true file object.  This
     file-like object can be used in a *note with: 186. statement, just
     like a normal file.  The name of the temporary file can be
     retrieved from the ‘name’ attribute of the returned file-like
     object.  On Unix, unlike with the *note TemporaryFile(): 2cc9, the
     directory entry does not get unlinked immediately after the file
     creation.

     If 'delete' is true (the default) and 'delete_on_close' is true
     (the default), the file is deleted as soon as it is closed.  If
     'delete' is true and 'delete_on_close' is false, the file is
     deleted on context manager exit only, or else when the *note
     file-like object: 17ac. is finalized.  Deletion is not always
     guaranteed in this case (see *note object.__del__(): 11ff.).  If
     'delete' is false, the value of 'delete_on_close' is ignored.

     Therefore to use the name of the temporary file to reopen the file
     after closing it, either make sure not to delete the file upon
     closure (set the 'delete' parameter to be false) or, in case the
     temporary file is created in a *note with: 186. statement, set the
     'delete_on_close' parameter to be false.  The latter approach is
     recommended as it provides assistance in automatic cleaning of the
     temporary file upon the context manager exit.

     Opening the temporary file again by its name while it is still open
     works as follows:

        * On POSIX the file can always be opened again.

        * On Windows, make sure that at least one of the following
          conditions are fulfilled:

             * 'delete' is false

             * additional open shares delete access (e.g.  by calling
               *note os.open(): f92. with the flag ‘O_TEMPORARY’)

             * 'delete' is true but 'delete_on_close' is false.  Note,
               that in this case the additional opens that do not share
               delete access (e.g.  created via builtin *note open():
               316.) must be closed before exiting the context manager,
               else the *note os.unlink(): 130d. call on context manager
               exit will fail with a *note PermissionError: f3e.

     On Windows, if 'delete_on_close' is false, and the file is created
     in a directory for which the user lacks delete access, then the
     *note os.unlink(): 130d. call on exit of the context manager will
     fail with a *note PermissionError: f3e.  This cannot happen when
     'delete_on_close' is true because delete access is requested by the
     open, which fails immediately if the requested access is not
     granted.

     On POSIX (only), a process that is terminated abruptly with SIGKILL
     cannot automatically delete any NamedTemporaryFiles it created.

     引数 ‘fullpath’ を指定して *note 監査イベント: 1c6e.
     ‘tempfile.mkstemp’ を送出します。

     バージョン 3.8 で変更: 'errors' 引数が追加されました。

     バージョン 3.12 で変更: 'delete_on_close' 引数が追加されました。

 -- クラス: tempfile.SpooledTemporaryFile (max_size=0, mode='w+b',
          buffering=-1, encoding=None, newline=None, suffix=None,
          prefix=None, dir=None, *, errors=None)

     このクラスはファイルサイズが 'max_size' を超えるかファイルの *note
     fileno(): 17ad. メソッドが呼ばれるまで、データがメモリにスプールさ
     れる点以外は *note TemporaryFile(): 2cc9. と正確に同じことを行いま
     す。 上記条件を満たすと内容はディスクに書き込まれ、操作は *note
     TemporaryFile(): 2cc9. と同様に進みます。

      -- メソッド: rollover ()

          この関数が返すファイルは、追加で1つのメソッド ‘rollover()’ を
          持っています。このメソッドが呼ばれると、(サイズに関係なく)メモ
          リからディスクへのロールオーバーが実行されます。

     返されたオブジェクトはファイル様オブジェクトで、その ‘_file’ 属性は
     (バイナリかテキスト 'mode' が指定されたかどうかに依存して) *note
     io.BytesIO: 10a4. か *note io.TextIOWrapper: 9be. オブジェクト、あ
     るいは *note rollover(): 2ccc. が呼ばれたかどうかに依存して本物のフ
     ァイルオブジェクトになります。 このファイル様オブジェクトは、通常の
     ファイルオブジェクトと同じように *note with: 186. 文中で使用するこ
     とが出来ます。

     バージョン 3.3 で変更: truncate メソッドが 'size' 引数を受け取るよ
     うになりました。

     バージョン 3.8 で変更: 'errors' 引数が追加されました。

     バージョン 3.11 で変更: Fully implements the *note
     io.BufferedIOBase: 8a3. and *note io.TextIOBase: 8a4. abstract base
     classes (depending on whether binary or text 'mode' was specified).

 -- クラス: tempfile.TemporaryDirectory (suffix=None, prefix=None,
          dir=None, ignore_cleanup_errors=False, *, delete=True)

     このクラスは *note mkdtemp(): 52d. と同じルールを使用して安全に一時
     ディレクトリを作成します。返されたオブジェクトは、*note
     コンテキストマネージャ: 1e1. として使用することができます (*note
     使用例: 2ccb. を参照)。コンテキストの完了や一時ディレクトリオブジェ
     クトを破壊すると、新規作成された一時ディレクトリとその中身はファイ
     ルシステムから削除されます。

      -- の属性: name

          ディレクトリ名は返されたオブジェクトの ‘name’ 属性から取得でき
          ます。返されたオブジェクトが *note コンテキストマネージャ:
          1e1. として使用された場合、 ‘name’ は *note with: 186. 文内の
          ‘as’ 節のターゲットがあればそれに割り当てられます。

      -- メソッド: cleanup ()

          The directory can be explicitly cleaned up by calling the
          ‘cleanup()’ method.  If 'ignore_cleanup_errors' is true, any
          unhandled exceptions during explicit or implicit cleanup (such
          as a *note PermissionError: f3e. removing open files on
          Windows) will be ignored, and the remaining removable items
          deleted on a "best-effort" basis.  Otherwise, errors will be
          raised in whatever context cleanup occurs (the ‘cleanup()’
          call, exiting the context manager, when the object is
          garbage-collected or during interpreter shutdown).

     The 'delete' parameter can be used to disable cleanup of the
     directory tree upon exiting the context.  While it may seem unusual
     for a context manager to disable the action taken when exiting the
     context, it can be useful during debugging or when you need your
     cleanup behavior to be conditional based on other logic.

     引数 ‘fullpath’ を指定して *note 監査イベント: 1c6e.
     ‘tempfile.mkdtemp’ を送出します。

     Added in version 3.2.

     バージョン 3.10 で変更: 'ignore_cleanup_errors' 引数が追加されまし
     た。

     バージョン 3.12 で変更: 'delete' パラメータが追加されました。

 -- の関数: tempfile.mkstemp (suffix=None, prefix=None, dir=None,
          text=False)

     可能な限り最も安全な手段で一時ファイルを生成します。 プラットフォー
     ムが *note os.open(): f92. の *note os.O_EXCL: 2ccf. フラグを正しく
     実装している限り、ファイルの作成で競合が起こることはありません。 作
     成したユーザのユーザ ID からのみファイルを読み書き出来ます。 プラッ
     トフォームがファイルが実行可能かどうかを示す許可ビットを使用してい
     る場合、ファイルは誰からも実行不可です。

     このファイル記述子は *note 子プロセスに継承されません: 10fc.。

     *note TemporaryFile(): 2cc9. と違って、 *note mkstemp(): 2cca. のユ
     ーザは用済みになった時に一時ファイルを削除しなければなりません。

     'suffix' が ‘None’ でない場合、ファイル名はその接尾辞で終わります。
     そうでない場合、接尾辞はありません。 *note mkstemp(): 2cca. はファ
     イル名と接尾辞の間にドットを追加しません。 必要であれば 'suffix' の
     先頭につけてください。

     'prefix' が ‘None’ でない場合、ファイル名はその接頭辞で始まります。
     そうでない場合、デフォルトの接頭辞が使われます。 必要に応じ、デフォ
     ルトは *note gettempprefix(): 2cd0. または *note gettempprefixb():
     2cd1. の返り値です。

     'dir' が ‘None’ でない場合、ファイルはそのディレクトリ下に作成され
     ます。 ‘None’ の場合、デフォルトのディレクトリが使われます。デフォ
     ルトのディレクトリはプラットフォームに依存するリストから選ばれます
     が、アプリケーションのユーザは 'TMPDIR'、'TEMP'、または 'TMP' 環境
     変数を設定することでディレクトリの場所を管理することができます。そ
     のため、生成されるファイル名が、‘os.popen()’ で外部コマンドにクォー
     ティング無しで渡すことができるなどといった、扱いやすい性質を持つ保
     証はありません。

     'suffix'、'prefix'、'dir' のいずれかが ‘None’ でない場合、それらは
     同じ型でなければなりません。 bytes の場合、返された名前は str でな
     はく bytes です。 他の挙動はデフォルトで返り値を bytes に強制的にし
     たい場合は ‘suffix=b''’ を渡してください。

     'text' に真を指定した場合は、ファイルはテキストモードで開かれます。
     そうでない場合(デフォルト)は、ファイルはバイナリモードで開かれます
     。

     *note mkstemp(): 2cca. は開かれたファイルを扱うための OS レベルのハ
     ンドル (*note os.open(): f92. が返すものと同じ) とファイルの絶対パ
     ス名が順番に並んだタプルを返します。

     引数 ‘fullpath’ を指定して *note 監査イベント: 1c6e.
     ‘tempfile.mkstemp’ を送出します。

     バージョン 3.5 で変更: 'suffix'、'prefix'、'dir' は bytes の返り値
     を得るために bytes で渡すことが出来ます。 それ以前は str のみ許され
     ていました。 適切なデフォルト値を使用するよう、'suffix' と 'prefix'
     は ‘None’ を受け入れ、デフォルトにするようになりました。

     バージョン 3.6 で変更: 'dir' パラメタが *note path-like object:
     5a1. を受け付けるようになりました。

 -- の関数: tempfile.mkdtemp (suffix=None, prefix=None, dir=None)

     可能な限り安全な方法で一時ディレクトリを作成します。 ディレクトリの
     生成で競合は発生しません。 ディレクトリを作成したユーザ ID だけが、
     このディレクトリに対して内容を読み出したり、書き込んだり、検索した
     りすることができます。

     *note mkdtemp(): 52d. のユーザは用済みになった時に一時ディレクトリ
     とその中身を削除しなければなりません。

     'prefix', 'suffix', 'dir' 引数は *note mkstemp(): 2cca. 関数のもの
     と同じです。

     *note mkdtemp(): 52d. は新たに生成されたディレクトリの絶対パス名を
     返します。

     引数 ‘fullpath’ を指定して *note 監査イベント: 1c6e.
     ‘tempfile.mkdtemp’ を送出します。

     バージョン 3.5 で変更: 'suffix'、'prefix'、'dir' は bytes の返り値
     を得るために bytes で渡すことが出来ます。 それ以前は str のみ許され
     ていました。 適切なデフォルト値を使用するよう、'suffix' と 'prefix'
     は ‘None’ を受け入れ、デフォルトにするようになりました。

     バージョン 3.6 で変更: 'dir' パラメタが *note path-like object:
     5a1. を受け付けるようになりました。

     バージョン 3.12 で変更: *note mkdtemp(): 52d. now always returns an
     absolute path, even if 'dir' is relative.

 -- の関数: tempfile.gettempdir ()

     一時ファイルに用いられるディレクトリの名前を返します。 これはモジュ
     ール内の全ての関数の 'dir' 引数のデフォルト値を定義します。

     Python は呼び出したユーザがファイルを作ることの出来るディレクトリを
     検索するのに標準的なリストを使用します。 そのリストは:

       1. 環境変数 ‘TMPDIR’ で与えられているディレクトリ名。

       2. 環境変数 ‘TEMP’ で与えられているディレクトリ名。

       3. 環境変数 ‘TMP’ で与えられているディレクトリ名。

       4. プラットフォーム依存の場所:

             * Windows ではディレクトリ ‘C:\TEMP’ 、 ‘C:\TMP’ 、 ‘\TEMP’
               、および ‘\TMP’ の順。

             * その他の全てのプラットフォームでは、 ‘/tmp’ 、 ‘/var/tmp’
               、および ‘/usr/tmp’ の順。

       5. 最後の手段として、現在の作業ディレクトリ。

     この検索の結果はキャッシュされます。以下の *note tempdir: 1c92. の
     記述を参照してください。

     バージョン 3.10 で変更: Always returns a str.  Previously it would
     return any *note tempdir: 1c92. value regardless of type so long as
     it was not ‘None’.

 -- の関数: tempfile.gettempdirb ()

     *note gettempdir(): 1c93. と同じですが返り値は bytesです。

     Added in version 3.5.

 -- の関数: tempfile.gettempprefix ()

     一時ファイルを生成する際に使われるファイル名の接頭辞を返します。 こ
     れにはディレクトリ部は含まれません。

 -- の関数: tempfile.gettempprefixb ()

     *note gettempprefix(): 2cd0. と同じですが返り値は bytes です。

     Added in version 3.5.

The module uses a global variable to store the name of the directory
used for temporary files returned by *note gettempdir(): 1c93.  It can
be set directly to override the selection process, but this is
discouraged.  All functions in this module take a 'dir' argument which
can be used to specify the directory.  This is the recommended approach
that does not surprise other unsuspecting code by changing global API
behavior.

 -- データ: tempfile.tempdir

     When set to a value other than ‘None’, this variable defines the
     default value for the 'dir' argument to the functions defined in
     this module, including its type, bytes or str.  It cannot be a
     *note path-like object: 5a1.

     ‘tempdir’ が (デフォルトの) ‘None’ の場合、 *note gettempprefix():
     2cd0. を除く上記のいずれかの関数を呼び出す際は常に *note
     gettempdir(): 1c93. で述べられているアルゴリズムによって初期化され
     ます。

          注釈: Beware that if you set ‘tempdir’ to a bytes value, there
          is a nasty side effect: The global default return type of
          *note mkstemp(): 2cca. and *note mkdtemp(): 52d. changes to
          bytes when no explicit ‘prefix’, ‘suffix’, or ‘dir’ arguments
          of type str are supplied.  Please do not write code expecting
          or depending on this.  This awkward behavior is maintained for
          compatibility with the historical implementation.

* Menu:

* 使用例: 使用例<8>.
* 非推奨の関数と変数::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/tempfile.py


File: python.info,  Node: 使用例<8>,  Next: 非推奨の関数と変数,  Up: tempfile --- 一時ファイルやディレクトリの作成

5.11.5.1 使用例
...............

Here are some examples of typical usage of the ‘tempfile’ module:

     >>> import tempfile

     # create a temporary file and write some data to it
     >>> fp = tempfile.TemporaryFile()
     >>> fp.write(b'Hello world!')
     # read data from file
     >>> fp.seek(0)
     >>> fp.read()
     b'Hello world!'
     # close the file, it will be removed
     >>> fp.close()

     # create a temporary file using a context manager
     >>> with tempfile.TemporaryFile() as fp:
     ...     fp.write(b'Hello world!')
     ...     fp.seek(0)
     ...     fp.read()
     b'Hello world!'
     >>>
     # file is now closed and removed

     # create a temporary file using a context manager
     # close the file, use the name to open the file again
     >>> with tempfile.NamedTemporaryFile(delete_on_close=False) as fp:
     ...     fp.write(b'Hello world!')
     ...     fp.close()
     ... # the file is closed, but not removed
     ... # open the file again by using its name
     ...     with open(fp.name, mode='rb') as f:
     ...         f.read()
     b'Hello world!'
     >>>
     # file is now removed

     # create a temporary directory using the context manager
     >>> with tempfile.TemporaryDirectory() as tmpdirname:
     ...     print('created temporary directory', tmpdirname)
     >>>
     # directory and contents have been removed


File: python.info,  Node: 非推奨の関数と変数,  Prev: 使用例<8>,  Up: tempfile --- 一時ファイルやディレクトリの作成

5.11.5.2 非推奨の関数と変数
...........................

一時ファイルを作成する歴史的な手法は、まず *note mktemp(): 1c30. 関数で
ファイル名を作り、その名前を使ってファイルを作成するというものでした。 残
念ながらこの方法は安全ではありません。 なぜなら、*note mktemp(): 1c30. の
呼び出しと最初のプロセスが続いてファイル作成を試みる間に、異なるプロセス
がその名前でファイルを同時に作成するかもしれないからです。 解決策は二つ
のステップを同時に行い、ファイルをすぐに作成するというものです。 この方
法は *note mkstemp(): 2cca. や上述している他の関数で使用されています。

 -- の関数: tempfile.mktemp (suffix='', prefix='tmp', dir=None)

     バージョン 2.3 で非推奨: 代わりに *note mkstemp(): 2cca. を使って下
     さい。

     呼び出し時には存在しなかった、ファイルの絶対パス名を返します。
     'prefix'、'suffix'、'dir' 引数は *note mkstemp(): 2cca. のものと似
     ていますが、bytes のファイル名、‘suffix=None’、そして ‘prefix=None’
     がサポートされていない点で異なります。

          警告: この関数を使うとプログラムのセキュリティホールになる可能
          性があります。この関数がファイル名を返した後、あなたがそのファ
          イル名を使って次に何かをしようとする段階に至る前に、誰か他の人
          間があなたを出し抜くことができてしまいます。 *note mktemp():
          1c30. の利用は、 *note NamedTemporaryFile(): 6ed. に
          ‘delete=False’ 引数を渡すことで、簡単に置き換えることができま
          す:

               >>> f = NamedTemporaryFile(delete=False)
               >>> f.name
               '/tmp/tmptjujjt'
               >>> f.write(b"Hello World!\n")
               13
               >>> f.close()
               >>> os.unlink(f.name)
               >>> os.path.exists(f.name)
               False


File: python.info,  Node: glob --- Unix 形式のパス名のパターン展開,  Next: fnmatch --- Unix のファイル名パターンマッチ,  Prev: tempfile --- 一時ファイルやディレクトリの作成,  Up: ファイルとディレクトリへのアクセス

5.11.6 ‘glob’ -- Unix 形式のパス名のパターン展開
------------------------------------------------

'ソースコード:' Lib/glob.py(1)

__________________________________________________________________

The ‘glob’ module finds pathnames using pattern matching rules similar
to the Unix shell.  No tilde expansion is done, but ‘*’, ‘?’, and
character ranges expressed with ‘[]’ will be correctly matched.  This is
done by using the *note os.scandir(): c54. and *note fnmatch.fnmatch():
1c54. functions in concert, and not by actually invoking a subshell.

     注釈: The pathnames are returned in no particular order.  If you
     need a specific order, sort the results.

Files beginning with a dot (‘.’) can only be matched by patterns that
also start with a dot, unlike *note fnmatch.fnmatch(): 1c54. or *note
pathlib.Path.glob(): 537.  For tilde and shell variable expansion, use
*note os.path.expanduser(): c09. and *note os.path.expandvars(): 15f2.

リテラルにマッチさせるには、メタ文字を括弧に入れてください。例えば、
‘'[?]'’ は文字 ‘'?'’ にマッチします。

The ‘glob’ module defines the following functions:

 -- の関数: glob.glob (pathname, *, root_dir=None, dir_fd=None,
          recursive=False, include_hidden=False)

     パスの仕様を含む文字列 'pathname' にマッチするパス名のリストを返し
     ます。戻り値のリストは空になる可能性があります。 'pathname' は
     (‘/usr/src/Python-1.5/Makefile’ のような) 絶対パスも、
     (‘../../Tools/*/*.gif’ のような) 相対パスもどちらも指定可能で、シェ
     ル形式のワイルドカードを含めることもできます。参照先が存在しない、
     壊れたシンボリックリンクも (シェルの場合と同様に) 結果に含まれます
     。結果がソートされているかどうかはファイルシステムによります。条件
     を満たすファイルがこの関数の呼び出し中に追加または削除された場合、
     それらのファイルに対するパス名が結果に含まれるかどうかはの動作は不
     定です。

     If 'root_dir' is not ‘None’, it should be a *note path-like object:
     5a1. specifying the root directory for searching.  It has the same
     effect on ‘glob()’ as changing the current directory before calling
     it.  If 'pathname' is relative, the result will contain paths
     relative to 'root_dir'.

     この関数は 'dir_fd' パラメタで *note
     ディレクトリ記述子への相対パス: 1302. をサポートしています。

     'recursive' が真の場合、パターン "‘**’" はあらゆるファイルや0個以上
     のディレクトリ、サブディレクトリおよびディレクトリへのシンボリック
     リンクにマッチします。パターンの末尾が *note os.sep: 87a. または
     *note os.altsep: 87b. の場合、ファイルは一致しません。

     'include_hidden' が真の場合、パターン "‘**’" は隠しディレクトリにマ
     ッチします。

     引数 ‘pathname’, ‘recursive’ を指定して *note 監査イベント: 1c6e.
     ‘glob.glob’ を送出します。

     引数 ‘pathname’, ‘recursive’, ‘root_dir’, ‘dir_fd’ を指定して *note
     監査イベント: 1c6e. ‘glob.glob/2’ を送出します。

          注釈: パターン "‘**’" を大きなディレクトリツリーで使用するとと
          てつもなく時間がかかるかもしれません。

          注釈: 'pathname' が複数の "‘**’" パターンを含み、かつ
          'recursive' が真の場合、この関数は同じパスを重複して返す可能性
          があります。

     バージョン 3.5 で変更: "‘**’" を使った再帰的な glob がサポートされ
     ました。

     バージョン 3.10 で変更: 'root_dir' と 'dir_fd' 引数が追加されました
     。

     バージョン 3.11 で変更: 'include_hidden' パラメータが追加されました
     。

 -- の関数: glob.iglob (pathname, *, root_dir=None, dir_fd=None,
          recursive=False, include_hidden=False)

     実際には一度にすべてを格納せずに、*note glob(): 68. と同じ値を順に
     生成する *note イテレーター: 4c8. を返します。

     引数 ‘pathname’, ‘recursive’ を指定して *note 監査イベント: 1c6e.
     ‘glob.glob’ を送出します。

     引数 ‘pathname’, ‘recursive’, ‘root_dir’, ‘dir_fd’ を指定して *note
     監査イベント: 1c6e. ‘glob.glob/2’ を送出します。

          注釈: 'pathname' が複数の "‘**’" パターンを含み、かつ
          'recursive' が真の場合、この関数は同じパスを重複して返す可能性
          があります。

     バージョン 3.5 で変更: "‘**’" を使った再帰的な glob がサポートされ
     ました。

     バージョン 3.10 で変更: 'root_dir' と 'dir_fd' 引数が追加されました
     。

     バージョン 3.11 で変更: 'include_hidden' パラメータが追加されました
     。

 -- の関数: glob.escape (pathname)

     すべての特殊文字 (‘'?'’ 、 ‘'*'’ 、 ‘'['’) をエスケープします。特殊
     文字を含んでいる可能性のある任意のリテラル文字列をマッチさせたいと
     きに便利です。drive/UNC sharepoints の特殊文字はエスケープされませ
     ん。たとえば Windows では ‘escape('//?/c:/Quo vadis?.txt')’ は
     ‘'//?/c:/Quo vadis[?].txt'’ を返します。

     Added in version 3.4.

 -- の関数: glob.translate (pathname, *, recursive=False,
          include_hidden=False, seps=None)

     与えられたパスの仕様を *note re.match(): 1445. で利用するための正規
     表現に変換します。シェル形式のワイルドカードを含めることもできます
     。

     例えば:

          >>> import glob, re
          >>>
          >>> regex = glob.translate('**/*.txt', recursive=True, include_hidden=True)
          >>> regex
          '(?s:(?:.+/)?[^/]*\\.txt)\\z'
          >>> reobj = re.compile(regex)
          >>> reobj.match('foo/bar/baz.txt')
          <re.Match object; span=(0, 15), match='foo/bar/baz.txt'>

     *note fnmatch.translate(): 184f. と違って、この関数ではパスの要素を
     区切るセパレータとセグメントには意味があります。デフォルトでは、ワ
     イルドカードはパスのセパレータにはマッチしません。また ‘*’ パターン
     のセグメントは厳密に単一のパスのセグメントにマッチします。

     'recursive' が真の場合、パターンセグメント "‘**’" は任意の数のパス
     セグメントにマッチします。

     'include_hidden' が真の場合、ワイルドカードはドット (‘.’) で始まる
     パスセグメントにもマッチします。

     パスの要素を区切るセパレータのシーケンスを 'seps' 引数に渡すことが
     できます。渡さない場合は *note os.sep: 87a. と (もしあれば) *note
     altsep: 87b. が使われます。

     参考
     ....

     *note pathlib.PurePath.full_match(): 535. と *note
     pathlib.Path.glob(): 537. の2つのメソッドは、それぞれパターンマッチ
     と glob 相当の操作を実装するためにこの関数を呼んでいます。

     Added in version 3.13.

* Menu:

* 使用例: 使用例<9>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/glob.py


File: python.info,  Node: 使用例<9>,  Up: glob --- Unix 形式のパス名のパターン展開

5.11.6.1 使用例
...............

次のファイルを含むディレクトリを考えます: ‘1.gif’, ‘2.txt’, ‘card.gif’ お
よび:file:‘3.txt’ だけを含む ‘sub’ サブディレクトリ。このとき、 *note
glob(): 68. は以下の結果を返します。パスにおける先頭の要素がどのように保
持されるかに注意してください:

     >>> import glob
     >>> glob.glob('./[0-9].*')
     ['./1.gif', './2.txt']
     >>> glob.glob('*.gif')
     ['1.gif', 'card.gif']
     >>> glob.glob('?.gif')
     ['1.gif']
     >>> glob.glob('**/*.txt', recursive=True)
     ['2.txt', 'sub/3.txt']
     >>> glob.glob('./**/', recursive=True)
     ['./', './sub/']

ディレクトリが ‘.’ で始まるファイルを含んでいる場合、デフォルトでそれら
はマッチしません。例えば、 ‘card.gif’ と ‘.card.gif’ を含むディレクトリ
を考えてください:

     >>> import glob
     >>> glob.glob('*.gif')
     ['card.gif']
     >>> glob.glob('.c*')
     ['.card.gif']

参考
....

*note fnmatch: 60. モジュールは、シェル形式の (パスではなく) ファイル名
の展開機能を提供します。

参考
....

*note pathlib: a8. モジュールは高水準のパスオブジェクトを提供します。


File: python.info,  Node: fnmatch --- Unix のファイル名パターンマッチ,  Next: linecache --- テキストラインへのランダムアクセス,  Prev: glob --- Unix 形式のパス名のパターン展開,  Up: ファイルとディレクトリへのアクセス

5.11.7 ‘fnmatch’ -- Unix のファイル名パターンマッチ
---------------------------------------------------

'ソースコード:' Lib/fnmatch.py(1)

__________________________________________________________________

このモジュールは Unix のシェル形式のワイルドカードに対応しています。これ
らは、 (*note re: be. モジュールでドキュメント化されている) 正規表現とは
'異なります' 。シェル形式のワイルドカードで使われる特殊文字は、次のとお
りです。

Pattern          意味
                 
----------------------------------------------------------
                 
‘*’              すべてにマッチします
                 
                 
‘?’              任意の一文字にマッチします
                 
                 
‘[seq]’          'seq' にある任意の文字にマッチします
                 
                 
‘[!seq]’         'seq' にない任意の文字にマッチします
                 

リテラルにマッチさせるには、メタ文字を括弧に入れてください。例えば、
‘'[?]'’ は文字 ‘'?'’ にマッチします。

ファイル名の区切り文字 (Unixでは ‘'/'’) はこのモジュールに固有なものでは
'ない' ことに注意してください。パス名展開については、 *note glob: 68. モ
ジュールを参照してください (*note glob: 68. はパス名の部分にマッチさせる
のに *note filter(): 1c56. を使っています)。同様に、ピリオドで始まるファ
イル名はこのモジュールに固有ではなくて、 ‘*’ と ‘?’ のパターンでマッチし
ます。

Unless stated otherwise, "filename string" and "pattern string" either
refer to *note str: 169. or ‘ISO-8859-1’ encoded *note bytes: 192.
objects.  Note that the functions documented below do not allow to mix a
‘bytes’ pattern with a ‘str’ filename, and vice-versa.

Finally, note that *note functools.lru_cache(): be2. with a 'maxsize' of
32768 is used to cache the (typed) compiled regex patterns in the
following functions: *note fnmatch(): 60, *note fnmatchcase(): 1c55,
*note filter(): 1c56, *note filterfalse(): 211.

 -- の関数: fnmatch.fnmatch (name, pat)

     ファイルの文字列 'name' がパターン文字列 'pat' にマッチするかテスト
     して、 ‘True’ または ‘False’ のいずれかを返します。どちらの引数とも
     *note os.path.normcase(): 2c56. を使って、大文字、小文字が正規化さ
     れます。オペレーティングシステムが標準でどうなっているかに関係なく
     、大文字、小文字を区別して比較する場合には、 *note fnmatchcase():
     1c55. が使用できます。

     次の例では、カレントディレクトリにある、拡張子が ‘.txt’ である全て
     のファイルを表示しています:

          import fnmatch
          import os

          for file in os.listdir('.'):
              if fnmatch.fnmatch(file, '*.txt'):
                  print(file)

 -- の関数: fnmatch.fnmatchcase (name, pat)

     ファイル名の文字列 'name' がパターン文字列 'pat' にマッチするかテス
     トして、 ‘True’ または ‘False’ を返します。比較は大文字、小文字を区
     別し、 *note os.path.normcase(): 2c56. は適用しません。

 -- の関数: fnmatch.filter (names, pat)

     Construct a list from those elements of the *note iterable: 12f1.
     of filename strings 'names' that match the pattern string 'pat'.
     It is the same as ‘[n for n in names if fnmatch(n, pat)]’, but
     implemented more efficiently.

 -- の関数: fnmatch.filterfalse (names, pat)

     Construct a list from those elements of the *note iterable: 12f1.
     of filename strings 'names' that do not match the pattern string
     'pat'.  It is the same as ‘[n for n in names if not fnmatch(n,
     pat)]’, but implemented more efficiently.

     Added in version 3.14.

 -- の関数: fnmatch.translate (pat)

     Return the shell-style pattern 'pat' converted to a regular
     expression for using with *note re.match(): 1445.  The pattern is
     expected to be a *note str: 169.

     例:

          >>> import fnmatch, re
          >>>
          >>> regex = fnmatch.translate('*.txt')
          >>> regex
          '(?s:.*\\.txt)\\z'
          >>> reobj = re.compile(regex)
          >>> reobj.match('foobar.txt')
          <re.Match object; span=(0, 10), match='foobar.txt'>

参考
....

*note glob: 68. モジュール

     Unix シェル形式のパス展開。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/fnmatch.py


File: python.info,  Node: linecache --- テキストラインへのランダムアクセス,  Next: shutil --- 高水準のファイル操作,  Prev: fnmatch --- Unix のファイル名パターンマッチ,  Up: ファイルとディレクトリへのアクセス

5.11.8 ‘linecache’ -- テキストラインへのランダムアクセス
--------------------------------------------------------

'ソースコード:' Lib/linecache.py(1)

__________________________________________________________________

The ‘linecache’ module allows one to get any line from a Python source
file, while attempting to optimize internally, using a cache, the common
case where many lines are read from a single file.  This is used by the
*note traceback: 104. module to retrieve source lines for inclusion in
the formatted traceback.

*note tokenize.open(): 2cdf. 関数は、ファイルを開くために使用されます。
この関数は、 *note tokenize.detect_encoding(): 17b8. を使用してファイル
のエンコーディングを取得します。エンコーディングトークンが存在しない場合
、デフォルトの UTF-8 になります。

The ‘linecache’ module defines the following functions:

 -- の関数: linecache.getline (filename, lineno, module_globals=None)

     'filename' という名前のファイルから 'lineno' 行目を取得します。この
     関数は決して例外を発生させません -- エラーの際には ‘''’ を返します
     (行末の改行文字は、見つかった行に含まれます)。

     If 'filename' indicates a frozen module (starting with ‘'<frozen
     '’), the function will attempt to get the real file name from
     ‘module_globals['__file__']’ if 'module_globals' is not ‘None’.

     'filename' という名前のファイルが見付からなかった場合、この関数は最
     初に 'module_globals' にある PEP 302(2) ‘__loader__’ を確認します。
     ローダーが存在していて、 ‘get_source’ メソッドが実装されていた場合
     、ソースコードの行を決定します (‘get_source()’ が ‘None’ を返した場
     合は、 ‘''’ が返ります)。 最後に、 'filename' が相対ファイル名だっ
     た場合、モジュール検索パス ‘sys.path’ のエントリからの相対パスを探
     します。

     バージョン 3.14 で変更: Support 'filename' of frozen modules.

 -- の関数: linecache.clearcache ()

     キャッシュをクリアします。それまでに *note getline(): 240. を使って
     読み込んだファイルの行が必要でなくなったら、この関数を使ってくださ
     い。

 -- の関数: linecache.checkcache (filename=None)

     キャッシュが有効かどうかを確認します。キャッシュしたファイルがディ
     スク上で変更された可能性があり、更新後のバージョンが必要な場合にこ
     の関数を使用します。 'filename' が与えられない場合、全てのキャッシ
     ュエントリを確認します。

 -- の関数: linecache.lazycache (filename, module_globals)

     後々の呼び出しで 'module_globals' が ‘None’ となっていても、ファイ
     ルの形式でないモジュールの行を後から *note getline(): 240. で取得す
     るのに十分な詳細を把握しておきます。この関数により、モジュールの
     globals を無限に持ち運ぶ必要無しに、実際に必要な行まで I/O を行う必
     要がなくなります。

     Added in version 3.5.

以下はプログラム例です:

     >>> import linecache
     >>> linecache.getline(linecache.__file__, 8)
     'import sys\n'

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/linecache.py

   (2) https://peps.python.org/pep-0302/


File: python.info,  Node: shutil --- 高水準のファイル操作,  Prev: linecache --- テキストラインへのランダムアクセス,  Up: ファイルとディレクトリへのアクセス

5.11.9 ‘shutil’ -- 高水準のファイル操作
---------------------------------------

'ソースコード:' Lib/shutil.py(1)

__________________________________________________________________

The ‘shutil’ module offers a number of high-level operations on files
and collections of files.  In particular, functions are provided which
support file copying and removal.  For operations on individual files,
see also the *note os: a5. module.

     警告: 高水準のファイルコピー関数 (*note shutil.copy(): c4f, *note
     shutil.copy2(): c50.) でも、ファイルのメタデータの全てをコピーする
     ことはできません。

     POSIXプラットフォームでは、これはACLやファイルのオーナー、グループ
     が失われることを意味しています。 Mac OSでは、リソースフォーク
     (resource fork)やその他のメタデータが利用されません。これは、リソー
     スが失われ、ファイルタイプや生成者コード(creator code)が正しくなく
     なることを意味しています。 Windowsでは、ファイルオーナー、ACL、代替
     データストリームがコピーされません。

* Menu:

* ディレクトリとファイルの操作::
* アーカイブ化操作::
* 出力ターミナルのサイズの取得::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/shutil.py


File: python.info,  Node: ディレクトリとファイルの操作,  Next: アーカイブ化操作,  Up: shutil --- 高水準のファイル操作

5.11.9.1 ディレクトリとファイルの操作
.....................................

 -- の関数: shutil.copyfileobj (fsrc, fdst[, length])

     :term::‘file-like object <file object>’ 'fsrc' の内容を 'fdst' へコ
     ピーします。整数値 'length' は与えられた場合バッファサイズを表しま
     す。特に 'length' が負の場合、チャンク内のソースデータを繰り返し操
     作することなくデータをコピーします。デフォルトでは、制御不能なメモ
     リ消費を避けるためにデータはチャンク内に読み込まれます。 'fsrc' オ
     ブジェクトの現在のファイル位置が0でない場合、現在の位置からファイル
     終端までの内容のみがコピーされることに注意してください。

     *note copyfileobj(): c52. will 'not' guarantee that the destination
     stream has been flushed on completion of the copy.  If you want to
     read from the destination at the completion of the copy operation
     (for example, reading the contents of a temporary file that has
     been copied from a HTTP stream), you must ensure that you have
     called *note flush(): 2ce6. or *note close(): 506. on the file-like
     object before attempting to read the destination file.

 -- の関数: shutil.copyfile (src, dst, *, follow_symlinks=True)

     'src' という名前のファイルの内容 (メタデータを含まない) を 'dst' と
     いう名前のファイルにコピーし、最も効率的な方法で 'dst' を返します。
     'src' と 'dst' は *note path-like object: 5a1. または文字列でパス名
     を指定します。

     'dst' は完全な対象ファイル名でなければなりません。対象としてディレ
     クトリ名を指定したい場合は *note copy(): c4f. を参照してください。
     'src' と 'dst' が同じファイルだった場合、 *note SameFileError:
     11a0. を送出します。

     'dst' は書き込み可能でなければなりません。そうでない場合、 *note
     OSError: 2c0. 例外を送出します。 'dst' がすでに存在する場合、そのフ
     ァイルは置き換えられます。キャラクタデバイスやブロックデバイスなど
     の特殊なファイルとパイプをこの関数でコピーすることはできません。

     'follow_symlinks' が偽で 'src' がシンボリックリンクの場合、 'src' の
     リンク先をコピーする代わりに新しいシンボリックリンクを作成します。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1c6e.
     ‘shutil.copyfile’ を送出します。

     バージョン 3.3 で変更: 以前は *note OSError: 2c0. の代わりに *note
     IOError: 125e. が送出されていました。 'follow_symlinks' 引数が追加
     されました。 'dst' を返すようになりました。

     バージョン 3.4 で変更: *note Error: 119f. の代わりに *note
     SameFileError: 11a0. を送出します。後者は前者のサブクラスなのでこの
     変更は後方互換です。

     バージョン 3.8 で変更: ファイルのコピーをより効率的に行うため、プラ
     ットフォーム特有の高速なコピーを行うシステムコールが利用されること
     があります。 *note プラットフォーム依存の効率的なコピー操作: c53. を
     参照してください。

 -- 例外: shutil.SpecialFileError

     This exception is raised when *note copyfile(): c4e. or *note
     copytree(): c1e. attempt to copy a named pipe.

     Added in version 2.7.

 -- 例外: shutil.SameFileError

     *note copyfile(): c4e. のコピー元と先が同じファイルの場合送出されま
     す。

     Added in version 3.4.

 -- の関数: shutil.copymode (src, dst, *, follow_symlinks=True)

     パーミッションを 'src' から 'dst' にコピーします。ファイルの内容、
     オーナー、グループには影響しません。 'src' と 'dst' は
     :term'path-like object <path-like object>' または文字列でファイルの
     パス名を指定します。 'follow_symlinks' が偽で、'src' および 'dst' が
     シンボリックリンクの場合、 *note copymode(): 1a24. は (リンク先では
     なく) 'dst' 自体のモードを変更します。この機能は全てのプラットフォ
     ームで使えるわけではありません。詳しくは *note copystat(): 1346. を
     参照してください。シンボリックリンクの変更をしようとした時、 *note
     copymode(): 1a24. がローカルのプラットフォームでシンボリックリンク
     を変更できない場合は何もしません。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1c6e.
     ‘shutil.copymode’ を送出します。

     バージョン 3.3 で変更: 'follow_symlinks' 引数が追加されました。

 -- の関数: shutil.copystat (src, dst, *, follow_symlinks=True)

     パーミッション、最終アクセス時間、最終変更時間、その他のフラグを
     'src' から 'dst' にコピーします。 Linux では、 *note copystat():
     1346. は可能なら "拡張属性" もコピーします。ファイルの内容、オーナ
     ー、グループには影響しません。 'src' と 'dst' は *note path-like
     object: 5a1. または文字列でファイルのパス名を指定します。

     'follow_symlinks' が偽の場合、 'src' と 'dst' の両方がシンボリック
     リンクであれば、 *note copystat(): 1346. はリンク先ではなくてシンボ
     リックリンク自体を操作します。 'src' からシンボリックリンクの情報を
     読み込み、 'dst' のシンボリックリンクにその情報を書き込みます。

          注釈: すべてのプラットフォームでシンボリックリンクの検査と変更
          ができるわけではありません。 Python はその機能が利用かどうかを
          調べる方法を用意しています。

             * ‘os.chmod in os.supports_follow_symlinks’ が ‘True’ の場
               合 *note copystat(): 1346. はシンボリックリンクのパーミッ
               ションを変更できます。

             * ‘os.utime in os.supports_follow_symlinks’ が ‘True’ の場
               合 *note copystat(): 1346. はシンボリックリンクの最終アク
               セス時間と最終変更時間を変更できます。

             * ‘os.chflags in os.supports_follow_symlinks’ が ‘True’ の
               場合 *note copystat(): 1346. はシンボリックリンクのフラグ
               を変更できます。 (‘os.chflags’ がないプラットフォームもあ
               ります。)

          機能の幾つか、もしくは全てが利用できないプラットフォームでシン
          ボリックリンクを変更しようとした場合、 *note copystat(): 1346.
          は可能な限り全てをコピーします。*note copystat(): 1346. が失敗
          を返すことはありません。

          より詳しい情報は *note os.supports_follow_symlinks: 1310. を参
          照して下さい。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1c6e.
     ‘shutil.copystat’ を送出します。

     バージョン 3.3 で変更: 'follow_symlinks' 引数と Linux の拡張属性が
     サポートされました。

 -- の関数: shutil.copy (src, dst, *, follow_symlinks=True)

     ファイル 'src' をファイルまたはディレクトリ 'dst' にコピーします。
     'src' と 'dst' は両方共 *note path-like object: 5a1. または文字列で
     なければなりません。 'dst' がディレクトリを指定している場合、ファイ
     ルは 'dst' の中に、 'src' のベースファイル名を使ってコピーされます
     。'dst' が既に存在するファイルを指定している場合、それは置き換えら
     れます。新しく作成したファイルのパスを返します。

     'follow_symlinks' が偽で、 'src' がシンボリックリンクの場合、 'dst'
     はシンボリックリンクとして作成されます。 'follow_symlinks' が真で
     'src' がシンボリックリンクの場合、 'dst' には 'src' のリンク先のフ
     ァイルがコピーされます。

     *note copy(): c4f. はファイルのデータとパーミッションをコピーします
     。 (*note os.chmod(): 529. を参照) その他の、ファイルの作成時間や変
     更時間などのメタデータはコピーしません。 コピー元のファイルのメタデ
     ータを保存したい場合は、 ‘copy2()’ を利用してください。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1c6e.
     ‘shutil.copyfile’ を送出します。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1c6e.
     ‘shutil.copymode’ を送出します。

     バージョン 3.3 で変更: 'follow_symlinks' 引数が追加されました。新し
     く作成されたファイルのパスを返すようになりました。

     バージョン 3.8 で変更: ファイルのコピーをより効率的に行うため、プラ
     ットフォーム特有の高速なコピーを行うシステムコールが利用されること
     があります。 *note プラットフォーム依存の効率的なコピー操作: c53. を
     参照してください。

 -- の関数: shutil.copy2 (src, dst, *, follow_symlinks=True)

     *note copy2(): c50. はファイルのメタデータを保持しようとすることを
     除けば *note copy(): c4f. と等価です。

     'follow_symlinks' が偽でかつ 'src' がシンボリックリンクの場合、
     *note copy2(): c50. は 'src' シンボリックリンク全てのメタデータを新
     たに作成される 'dst' シンボリックリンクにコピーしようとします。しか
     し、この機能は全てのプラットフォームで利用可能なわけではありません
     。この機能の全部または一部が利用可能でないプラットフォームにおいて
     は、 *note copy2(): c50. は可能な限りのメタデータを保存しようとしま
     すが、一方で *note copy2(): c50.　はメタデータを保存できないことを
     理由とする例外を送出しません。

     *note copy2(): c50. はファイルのメタデータをコピーするために *note
     copystat(): 1346. を利用します。シンボリックリンクのメタデータを変
     更するためのプラットフォームサポートについては *note copystat():
     1346. を参照して下さい。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1c6e.
     ‘shutil.copyfile’ を送出します。

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1c6e.
     ‘shutil.copystat’ を送出します。

     バージョン 3.3 で変更: 'follow_symlinks' 引数が追加されました。 拡
     張ファイルシステム属性もコピーしようと試みます (現在は Linux のみ
     )。新しく作成されたファイルへのパスを返すようになりました。

     バージョン 3.8 で変更: ファイルのコピーをより効率的に行うため、プラ
     ットフォーム特有の高速なコピーを行うシステムコールが利用されること
     があります。 *note プラットフォーム依存の効率的なコピー操作: c53. を
     参照してください。

 -- の関数: shutil.ignore_patterns (*patterns)

     このファクトリ関数は、 *note copytree(): c1e. 関数の 'ignore' 引数
     に渡すための呼び出し可能オブジェクトを作成します。 glob形式の
     'patterns' にマッチするファイルやディレクトリが無視されます。下の例
     を参照してください。

 -- の関数: shutil.copytree (src, dst, symlinks=False, ignore=None,
          copy_function=copy2, ignore_dangling_symlinks=False,
          dirs_exist_ok=False)

     Recursively copy an entire directory tree rooted at 'src' to a
     directory named 'dst' and return the destination directory.  All
     intermediate directories needed to contain 'dst' will also be
     created by default.

     各ディレクトリのパーミッション、最終アクセス時間、最終変更時間は
     *note copystat(): 1346. でコピーされます。それぞれのファイルは
     *note copy2(): c50. でコピーされます。

     'symlinks' が真の場合、ソースツリー内のシンボリックリンクは新しいツ
     リーでもシンボリックになり、元のシンボリックリンクのメタデータはプ
     ラットフォームが許す限りコピーされます。偽の場合や省略された場合、
     リンク先のファイルの内容とメタデータが新しいツリーにコピーされます
     。

     'symlinks' が偽の場合、リンク先のファイルが存在しなければ、コピー処
     理終了時に送出される *note Error: 119f. 例外のエラーリストに例外が
     追加されます。オプションの 'ignore_dangling_symlinks' フラグを真に
     設定してこのエラーを送出させないこともできます。このオプションは
     *note os.symlink(): 130c. をサポートしていないプラットフォーム上で
     は効果がないことに注意してください。

     'ignore' は *note copytree(): c1e. が走査しているディレクトリと
     *note os.listdir(): 1312. が返すその内容のリストを引数として受け取
     ることのできる呼び出し可能オブジェクトでなければなりません。 *note
     copytree(): c1e. は再帰的に呼び出されるので、 'ignore' はコピーされ
     る各ディレクトリ毎に呼び出されます。 'ignore' の戻り値はカレントデ
     ィレクトリに相対的なディレクトリ名およびファイル名のシーケンス（す
     なわち第二引数の項目のサブセット）でなければなりません。それらの名
     前はコピー中に無視されます。 *note ignore_patterns(): 2ce7. を用い
     て glob 形式のパターンによって無視する呼び出し可能オブジェクトを作
     成することが出来ます。

     例外が発生した場合、理由のリストとともに *note Error: 119f. を送出
     します。

     'copy_function' は各ファイルをコピーするために利用される呼び出し可
     能オブジェクトでなければなりません。'copy_function' はコピー元のパ
     スとコピー先のパスを引数に呼び出されます。デフォルトでは *note
     copy2(): c50. が利用されますが、同じ特徴を持つ関数 (*note
     shutil.copy(): c4f. など) ならどれでも利用可能です。

     If 'dirs_exist_ok' is false (the default) and 'dst' already exists,
     a *note FileExistsError: 1221. is raised.  If 'dirs_exist_ok' is
     true, the copying operation will continue if it encounters existing
     directories, and files within the 'dst' tree will be overwritten by
     corresponding files from the 'src' tree.

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1c6e.
     ‘shutil.copytree’ を送出します。

     バージョン 3.2 で変更: Added the 'copy_function' argument to be
     able to provide a custom copy function.  Added the
     'ignore_dangling_symlinks' argument to silence dangling symlinks
     errors when 'symlinks' is false.

     バージョン 3.3 で変更: 'symlinks' が偽の場合メタデータをコピーしま
     す。 'dst' を返すようになりました。

     バージョン 3.8 で変更: ファイルのコピーをより効率的に行うため、プラ
     ットフォーム特有の高速なコピーを行うシステムコールが利用されること
     があります。 *note プラットフォーム依存の効率的なコピー操作: c53. を
     参照してください。

     バージョン 3.8 で変更: 引数 'dirs_exist_ok' が追加されました。

 -- の関数: shutil.rmtree (path, ignore_errors=False, onerror=None, *,
          onexc=None, dir_fd=None)

     Delete an entire directory tree; 'path' must point to a directory
     (but not a symbolic link to a directory).  If 'ignore_errors' is
     true, errors resulting from failed removals will be ignored; if
     false or omitted, such errors are handled by calling a handler
     specified by 'onexc' or 'onerror' or, if both are omitted,
     exceptions are propagated to the caller.

     この関数は *note ディレクトリ記述子への相対パス: 1302. をサポートし
     ています。

          注釈: 必要な fd ベースの関数をサポートしているプラットフォーム
          では、 シンボリックリンク攻撃に耐性のあるバージョンの *note
          rmtree(): 356. がデフォルトで利用されます。それ以外のプラット
          フォームでは、 *note rmtree(): 356. の実装はシンボリックリンク
          攻撃の影響を受けます。適当なタイミングと環境で攻撃者はファイル
          システム上のシンボリックリンクを操作して、それ以外の方法ではア
          クセス不可能なファイルを削除することが出来ます。アプリケーショ
          ンは、どちらのバージョンの *note rmtree(): 356. が利用されてい
          るかを知るために関数のデータ属性 *note
          rmtree.avoids_symlink_attacks: 2ce8. を利用することができます
          。

     'onexc' を指定する場合、 'function', 'path', 'excinfo' の3つの引数
     を受け取る呼び出し可能オブジェクトでなければなりません。

     The first parameter, 'function', is the function which raised the
     exception; it depends on the platform and implementation.  The
     second parameter, 'path', will be the path name passed to
     'function'.  The third parameter, 'excinfo', is the exception that
     was raised.  Exceptions raised by 'onexc' will not be caught.

     The deprecated 'onerror' is similar to 'onexc', except that the
     third parameter it receives is the tuple returned from *note
     sys.exc_info(): 89a.

     参考
     ....

     *note rmtree の例: 2ce9. for an example of handling the removal of
     a directory tree that contains read-only files.

     引数 ‘path’, ‘dir_fd’ を指定して *note 監査イベント: 1c6e.
     ‘shutil.rmtree’ を送出します。

     バージョン 3.3 で変更: プラットフォームが fd ベースの関数をサポート
     する場合に自動的に使用されるシンボリックリンク攻撃に耐性のあるバー
     ジョンが追加されました。

     バージョン 3.8 で変更: Windows では、ディレクトリへのジャンクション
     を削除する際にリンク先ディレクトリにあるファイルを削除しなくなりま
     した。

     バージョン 3.11 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.12 で変更: Added the 'onexc' parameter, deprecated
     'onerror'.

     バージョン 3.13 で変更: ‘rmtree()’ now ignores *note
     FileNotFoundError: 264. exceptions for all but the top-level path.
     Exceptions other than *note OSError: 2c0. and subclasses of
     ‘OSError’ are now always propagated to the caller.

      -- の属性: rmtree.avoids_symlink_attacks

          プラットフォームと実装がシンボリックリンク攻撃に耐性のあるバー
          ジョンの *note rmtree(): 356. を提供しているかどうかを示します
          。現在のところ、この属性は fd ベースのディレクトリアクセス関数
          をサポートしているプラットフォームでのみ真になります。

          Added in version 3.3.

 -- の関数: shutil.move (src, dst, copy_function=copy2)

     ファイルまたはディレクトリ ('src') を再帰的に別の場所に移動して、移
     動先を返します。

     If 'dst' is an existing directory or a symlink to a directory, then
     'src' is moved inside that directory.  The destination path in that
     directory must not already exist.

     If 'dst' already exists but is not a directory, it may be
     overwritten depending on *note os.rename(): 1309. semantics.

     If the destination is on the current filesystem, then *note
     os.rename(): 1309. is used.  Otherwise, 'src' is copied to the
     destination using 'copy_function' and then removed.  In case of
     symlinks, a new symlink pointing to the target of 'src' will be
     created as the destination and 'src' will be removed.

     If 'copy_function' is given, it must be a callable that takes two
     arguments, 'src' and the destination, and will be used to copy
     'src' to the destination if *note os.rename(): 1309. cannot be
     used.  If the source is a directory, *note copytree(): c1e. is
     called, passing it the 'copy_function'.  The default
     'copy_function' is *note copy2(): c50.  Using *note copy(): c4f. as
     the 'copy_function' allows the move to succeed when it is not
     possible to also copy the metadata, at the expense of not copying
     any of the metadata.

     引数 ‘src’, ‘dst’ を指定して *note 監査イベント: 1c6e.
     ‘shutil.move’ を送出します。

     バージョン 3.3 で変更: 異なるファイルシステムに対する明示的なシンボ
     リックリンク処理が追加されました。これにより GNU ‘mv’ の振る舞いに
     適応するようになります。 'dst' を返すようになりました。

     バージョン 3.5 で変更: キーワード引数 'copy_function' が追加されま
     した。

     バージョン 3.8 で変更: ファイルのコピーをより効率的に行うため、プラ
     ットフォーム特有の高速なコピーを行うシステムコールが利用されること
     があります。 *note プラットフォーム依存の効率的なコピー操作: c53. を
     参照してください。

     バージョン 3.9 で変更: 'src' と 'dst' が両方とも *note path-like
     object: 5a1. を受け付けるようになりました。

 -- の関数: shutil.disk_usage (path)

     指定されたパスについて、ディスクの利用状況を、名前付きタプル (*note
     named tuple: 85e.) で返します。このタプルには 'total', 'used',
     'free' という属性があり、それぞれトータル、使用中、空きの容量をバイ
     ト単位で示します。 'path' はファイルまたはディレクトリです。

          注釈: On Unix filesystems, 'path' must point to a path within
          a 'mounted' filesystem partition.  On those platforms, CPython
          doesn't attempt to retrieve disk usage information from
          non-mounted filesystems.

     Added in version 3.3.

     バージョン 3.8 で変更: Windowsにおいても 'path' にディレクトリだけ
     でなくファイルを指定できるようになりました。

     *note Availability: 213f.: Unix, Windows.

 -- の関数: shutil.chown (path, user=None, group=None, *, dir_fd=None,
          follow_symlinks=True)

     指定された 'path' のオーナー 'user' と/または 'group' を変更します
     。

     'user' はシステムのユーザー名か uid です。 'group' も同じです。少な
     くともどちらかの引数を指定する必要があります。

     内部で利用している *note os.chown(): 1306. も参照してください。

     引数 ‘path’, ‘user’, ‘group’ を指定して *note 監査イベント: 1c6e.
     ‘shutil.chown’ を送出します。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

     バージョン 3.13 で変更: 引数 'dir_fd' および 'follow_symlinks' が追
     加されました。

 -- の関数: shutil.which (cmd, mode=os.F_OK | os.X_OK, path=None)

     'cmd' を実行しようとした時に実行される実行ファイルのパスを返します
     。 'cmd' を呼び出せない場合は ‘None’ を返します。

     'mode' は *note os.access(): 1304. に渡すパーミッションマスクで、デ
     フォルトではファイルが存在して実行可能であることを確認します。

     'path' is a "‘PATH’ string" specifying the directories to look in,
     delimited by *note os.pathsep: 2134.  When no 'path' is specified,
     the ‘PATH’ environment variable is read from *note os.environ: 259,
     falling back to *note os.defpath: 1de4. if it is not set.

     If 'cmd' contains a directory component, ‘which()’ only checks the
     specified path directly and does not search the directories listed
     in 'path' or in the system's ‘PATH’ environment variable.

     On Windows, the current directory is prepended to the 'path' if
     'mode' does not include ‘os.X_OK’.  When the 'mode' does include
     ‘os.X_OK’, the Windows API ‘NeedCurrentDirectoryForExePathW’ will
     be consulted to determine if the current directory should be
     prepended to 'path'.  To avoid consulting the current working
     directory for executables: set the environment variable
     ‘NoDefaultCurrentDirectoryInExePath’.

     Also on Windows, the ‘PATHEXT’ environment variable is used to
     resolve commands that may not already include an extension.  For
     example, if you call ‘shutil.which("python")’, *note which(): 6db.
     will search ‘PATHEXT’ to know that it should look for ‘python.exe’
     within the 'path' directories.  For example, on Windows:

          >>> shutil.which("python")
          'C:\\Python33\\python.EXE'

     This is also applied when 'cmd' is a path that contains a directory
     component:

          >>> shutil.which("C:\\Python33\\python")
          'C:\\Python33\\python.EXE'

     Added in version 3.3.

     バージョン 3.8 で変更: *note bytes: 192. 型も使用できるようになりま
     した。 'cmd' が *note bytes: 192. 型の場合、戻り値も *note bytes:
     192. 型です。

     バージョン 3.12 で変更: On Windows, the current directory is no
     longer prepended to the search path if 'mode' includes ‘os.X_OK’
     and WinAPI ‘NeedCurrentDirectoryForExePathW(cmd)’ is false, else
     the current directory is prepended even if it is already in the
     search path; ‘PATHEXT’ is used now even when 'cmd' includes a
     directory component or ends with an extension that is in ‘PATHEXT’;
     and filenames that have no extension can now be found.

 -- 例外: shutil.Error

     この例外は複数ファイルの操作を行っているときに生じる例外をまとめた
     ものです。 *note copytree(): c1e. に対しては例外の引数は3つのタプル
     ('srcname', 'dstname', 'exception')からなるリストです。

* Menu:

* プラットフォーム依存の効率的なコピー操作::
* copytree の例::
* rmtree の例::


File: python.info,  Node: プラットフォーム依存の効率的なコピー操作,  Next: copytree の例,  Up: ディレクトリとファイルの操作

5.11.9.2 プラットフォーム依存の効率的なコピー操作
.................................................

Python 3.8 から、ファイルのコピーを伴う全ての関数 (*note copyfile():
c4e, *note copy(): c4f, *note copy2(): c50, *note copytree(): c1e, およ
び *note move(): c51.) はより効率的なファイルのコピーのためにプラットフ
ォーム特有の "高速なコピー" を行うことがあります (bpo-33671(1) を参照し
てください).  ここで "高速なコピー" とは、 "‘outfd.write(infd.read())’"
のようにPython が管理するユーザー空間のバッファを利用することを避け、コ
ピー操作がカーネル空間内で行われることを意味します。

macOS では fcopyfile(2) がファイルの内容（メタデータを除く）をコピーする
ために利用されます。

Linux では *note os.copy_file_range(): 18b4. または *note os.sendfile():
d05. が利用されます。

Solaris では *note os.sendfile(): d05. が利用されます。

Windows では *note shutil.copyfile(): c4e. はより大きなバッファサイズを
デフォルトとして使います (6 KiB の代わりに 1 MiB が使われます)。また、
*note memoryview(): 165. ベースの変形である *note shutil.copyfileobj():
c52. が使われます。

If the fast-copy operation fails and no data was written in the
destination file then shutil will silently fall back to less efficient
*note copyfileobj(): c52. function internally.

バージョン 3.8 で変更.

バージョン 3.14 で変更: Solaris now uses *note os.sendfile(): d05.

バージョン 3.14 で変更: Copy-on-write or server-side copy may be used
internally via *note os.copy_file_range(): 18b4. on supported Linux
filesystems.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33671

   (2) http://www.manpagez.com/man/3/copyfile/


File: python.info,  Node: copytree の例,  Next: rmtree の例,  Prev: プラットフォーム依存の効率的なコピー操作,  Up: ディレクトリとファイルの操作

5.11.9.3 copytree の例
......................

*note ignore_patterns(): 2ce7. ヘルパ関数を利用する例です:

     from shutil import copytree, ignore_patterns

     copytree(source, destination, ignore=ignore_patterns('*.pyc', 'tmp*'))

この例では、 ‘.pyc’ ファイルと、 ‘tmp’ で始まる全てのファイルやディレク
トリを除いて、全てをコピーします。

'ignore' 引数にロギングさせる別の例です。

     from shutil import copytree
     import logging

     def _logpath(path, names):
         logging.info('Working in %s', path)
         return []   # nothing will be ignored

     copytree(source, destination, ignore=_logpath)


File: python.info,  Node: rmtree の例,  Prev: copytree の例,  Up: ディレクトリとファイルの操作

5.11.9.4 rmtree の例
....................

次の例は、Windows で一部のファイルが読み取り専用のビットセットを含む場合
に、ディレクトリツリーを削除する方法を示します。onexc コールバックを使用
して、読み取り専用のビットを消去し、削除を再試行します。結果として失敗が
発生した場合、それらは伝搬されます:

     import os, stat
     import shutil

     def remove_readonly(func, path, _):
         "Clear the readonly bit and reattempt the removal"
         os.chmod(path, stat.S_IWRITE)
         func(path)

     shutil.rmtree(directory, onexc=remove_readonly)


File: python.info,  Node: アーカイブ化操作,  Next: 出力ターミナルのサイズの取得,  Prev: ディレクトリとファイルの操作,  Up: shutil --- 高水準のファイル操作

5.11.9.5 アーカイブ化操作
.........................

Added in version 3.2.

バージョン 3.5 で変更: 'xztar' 形式のサポートが追加されました。

圧縮とアーカイブ化されているファイルの読み書きの高水準なユーティリティも
提供されています。これらは *note zipfile: 137. 、 *note tarfile: e4. モ
ジュールに依拠しています。

 -- の関数: shutil.make_archive (base_name, format[, root_dir[,
          base_dir[, verbose[, dry_run[, owner[, group[, logger]]]]]]])

     アーカイブファイル (zip や tar) を作成してその名前を返します。

     'base_name' is the name of the file to create, including the path,
     minus any format-specific extension.

     'format' is the archive format: one of "zip" (if the *note zlib:
     139. module is available), "tar", "gztar" (if the *note zlib: 139.
     module is available), "bztar" (if the *note bz2: 14. module is
     available), "xztar" (if the *note lzma: 8e. module is available),
     or "zstdtar" (if the *note compression.zstd: 23. module is
     available).

     'root_dir' はアーカイブファイルのルートとなるディレクトリです。アー
     カイブに含まれる全てのパスは 'root_dir' からの相対パスになります。
     これは、アーカイブファイルを生成する前に 'root_dir' へ移動すること
     に相当します。

     'base_dir' はアーカイブを開始するディレクトリです。すなわち、
     'base_dir' アーカイブに含まれるファイルとディレクトリに対する共通の
     プレフィックスになります。 'base_dir' は 'root_dir' からの相対パス
     でなければなりません。 'base_dir' と 'root_dir' を組み合わせて使う
     方法については *note base_dir を使ったアーカイブ化の例: 2cef. を参
     照してください。

     'root_dir' と 'base_dir' のどちらも、デフォルトはカレントディレクト
     リです。

     'dry_run' が真の場合、アーカイブは作成されませんが実行される操作は
     'logger' に記録されます。

     'owner' と 'group' は、tar アーカイブを作成するときに使われます。デ
     フォルトでは、カレントのオーナーとグループを使います。

     'logger' は PEP 282(1) に互換なオブジェクトでなければなりません。こ
     れは普通は *note logging.Logger: d46. のインスタンスです。

     'verbose' 引数は使用されず、非推奨です。

     引数 ‘base_name’, ‘format’, ‘root_dir’, ‘base_dir’ を指定して *note
     監査イベント: 1c6e. ‘shutil.make_archive’ を送出します。

          注釈: This function is not thread-safe when custom archivers
          registered with *note register_archive_format(): 2cf0. do not
          support the 'root_dir' argument.  In this case it temporarily
          changes the current working directory of the process to
          'root_dir' to perform archiving.

     バージョン 3.8 で変更: ‘format="tar"’ で作成されたアーカイブでは、
     レガシーなGNU形式に代わってモダンな pax (POSIX.1-2001) 形式が使われ
     ます。

     バージョン 3.10.6 で変更: This function is now made thread-safe
     during creation of standard ‘.zip’ and tar archives.

 -- の関数: shutil.get_archive_formats ()

     アーカイブ化をサポートしているフォーマットのリストを返します。返さ
     れるシーケンスのそれぞれの要素は、タプル ‘(name, description)’ です
     。

     By default ‘shutil’ provides these formats:

        - 'zip': ZIP ファイル (*note zlib: 139. モジュールが利用可能な場
          合)。

        - 'tar': 非圧縮の tar ファイル。 POSIX.1-2001 pax 形式が使われま
          す。

        - 'gztar': gzip で圧縮された tar ファイル (*note zlib: 139. モジ
          ュールが利用可能な場合)。

        - 'bztar': bzip2 で圧縮された tar ファイル (*note bz2: 14. モジ
          ュールが利用可能な場合)。

        - 'xztar': xz で圧縮された tar ファイル (*note lzma: 8e. モジュ
          ールが利用可能な場合)。

        - 'zstdtar': Zstandard で圧縮された tar ファイル (*note
          compression.zstd: 23. モジュールが利用可能な場合)。

     *note register_archive_format(): 2cf0. を使って、新しいフォーマット
     を登録したり、既存のフォーマットに独自のアーカイバを提供したりでき
     ます。

 -- の関数: shutil.register_archive_format (name, function[,
          extra_args[, description]])

     アーカイバをフォーマット 'name' に登録します。

     'function' はアーカイブのアンパックに使用される呼び出し可能オブジェ
     クトです。'funciton' は作成するファイルの 'base_name'、続いてアーカ
     イブを開始する元の 'base_dir' (デフォルトは *note os.curdir: 2c57.)
     を受け取ります。さらなる引数は、次のキーワード引数として渡されます:
     'owner', 'group', 'dry_run' ならびに 'logger' (*note
     make_archive(): 6da. に渡されます)。

     If 'function' has the custom attribute ‘function.supports_root_dir’
     set to ‘True’, the 'root_dir' argument is passed as a keyword
     argument.  Otherwise the current working directory of the process
     is temporarily changed to 'root_dir' before calling 'function'.  In
     this case *note make_archive(): 6da. is not thread-safe.

     'extra_args' は、与えられた場合、 ‘(name, value)’ の対のシーケンス
     で、アーカイバ呼び出し可能オブジェクトが使われるときに追加のキーワ
     ード引数として使われます。

     'description' は、アーカイバのリストを返す *note
     get_archive_formats(): 2cf1. で使われます。デフォルトでは空の文字列
     です。

     バージョン 3.12 で変更: Added support for functions supporting the
     'root_dir' argument.

 -- の関数: shutil.unregister_archive_format (name)

     アーカイブフォーマット 'name' を、サポートされているフォーマットの
     リストから取り除きます。

 -- の関数: shutil.unpack_archive (filename[, extract_dir[, format[,
          filter]]])

     アーカイブをアンパックします。 'filename' はアーカイブのフルパスで
     す。

     'extract_dir' はアーカイブをアンパックする先のディレクトリ名です。
     指定されなかった場合は現在の作業ディレクトリを利用します。

     'format' はアーカイブフォーマットで、 "zip", "tar", "gztar",
     "bztar", "xztar", "zstdtar" あるいは *note
     register_unpack_format(): 2cf3. で登録したその他のフォーマットのど
     れかです。 指定されなかった場合、 *note unpack_archive(): 696. はア
     ーカイブファイル名の拡張子に対して登録されたアンパッカーを利用しま
     す。 アンパッカーが見つからなかった場合、 *note ValueError: 2ec. を
     発生させます。

     The keyword-only 'filter' argument is passed to the underlying
     unpacking function.  For zip files, 'filter' is not accepted.  For
     tar files, it is recommended to use ‘'data'’ (default since Python
     3.14), unless using features specific to tar and UNIX-like
     filesystems.  (See *note Extraction filters: 697. for details.)

     引数 ‘filename’, ‘extract_dir’, ‘format’ を指定して *note
     監査イベント: 1c6e. ‘shutil.unpack_archive’ を送出します。

          警告: Never extract archives from untrusted sources without
          prior inspection.  It is possible that files are created
          outside of the path specified in the 'extract_dir' argument,
          e.g.  members that have absolute filenames starting with "/"
          or filenames with two dots "..".

          Since Python 3.14, the defaults for both built-in formats (zip
          and tar files) will prevent the most dangerous of such
          security issues, but will not prevent 'all' unintended
          behavior.  Read the *note Hints for further verification:
          2cf4. section for tar-specific details.

     バージョン 3.7 で変更: 'filename' と 'extract_dir' が *note
     path-like object: 5a1. を受け付けるようになりました。

     バージョン 3.12 で変更: 'filter' 引数が追加されました。

 -- の関数: shutil.register_unpack_format (name, extensions, function[,
          extra_args[, description]])

     アンパック用のフォーマットを登録します。 'name' はフォーマット名で
     、 'extensions' はそのフォーマットに対応する拡張子 (例えば Zip ファ
     イルに対して ‘.zip’) のリストです。

     'function' is the callable that will be used to unpack archives.
     The callable will receive:

        - the path of the archive, as a positional argument;

        - the directory the archive must be extracted to, as a
          positional argument;

        - possibly a 'filter' keyword argument, if it was given to *note
          unpack_archive(): 696.;

        - additional keyword arguments, specified by 'extra_args' as a
          sequence of ‘(name, value)’ tuples.

     フォーマットの説明として 'description' を指定することができます。こ
     れは *note get_unpack_formats(): 2cf5. 関数によって返されます。

 -- の関数: shutil.unregister_unpack_format (name)

     アンパックフォーマットを登録解除します。 'name' はフォーマットの名
     前です。

 -- の関数: shutil.get_unpack_formats ()

     登録されているすべてのアンパックフォーマットをリストで返します。戻
     り値のリストの各要素は ‘(name, extensions, description)’ の形のタプ
     ルです。

     By default ‘shutil’ provides these formats:

        - 'zip': ZIP ファイル (対応するモジュールが利用可能な場合にのみ
          圧縮ファイルはアンパックされます)。

        - 'tar': 圧縮されていない tar ファイル。

        - 'gztar': gzip で圧縮された tar ファイル (*note zlib: 139. モジ
          ュールが利用可能な場合)。

        - 'bztar': bzip2 で圧縮された tar ファイル (*note bz2: 14. モジ
          ュールが利用可能な場合)。

        - 'xztar': xz で圧縮された tar ファイル (*note lzma: 8e. モジュ
          ールが利用可能な場合)。

        - 'zstdtar': Zstandard で圧縮された tar ファイル (*note
          compression.zstd: 23. モジュールが利用可能な場合)。

     *note register_unpack_format(): 2cf3. を使って新しいフォーマットや
     既存のフォーマットに対する別のアンパッカーを登録することができます
     。

* Menu:

* アーカイブ化の例::
* base_dir を使ったアーカイブ化の例::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0282/


File: python.info,  Node: アーカイブ化の例,  Next: base_dir を使ったアーカイブ化の例,  Up: アーカイブ化操作

5.11.9.6 アーカイブ化の例
.........................

この例では、ユーザの ‘.ssh’ ディレクトリにあるすべてのファイルを含む、
gzip された tar ファイルアーカイブを作成します:

     >>> from shutil import make_archive
     >>> import os
     >>> archive_name = os.path.expanduser(os.path.join('~', 'myarchive'))
     >>> root_dir = os.path.expanduser(os.path.join('~', '.ssh'))
     >>> make_archive(archive_name, 'gztar', root_dir)
     '/Users/tarek/myarchive.tar.gz'

結果のアーカイブは、以下のものを含みます:

     $ tar -tzvf /Users/tarek/myarchive.tar.gz
     drwx------ tarek/staff       0 2010-02-01 16:23:40 ./
     -rw-r--r-- tarek/staff     609 2008-06-09 13:26:54 ./authorized_keys
     -rwxr-xr-x tarek/staff      65 2008-06-09 13:26:54 ./config
     -rwx------ tarek/staff     668 2008-06-09 13:26:54 ./id_dsa
     -rwxr-xr-x tarek/staff     609 2008-06-09 13:26:54 ./id_dsa.pub
     -rw------- tarek/staff    1675 2008-06-09 13:26:54 ./id_rsa
     -rw-r--r-- tarek/staff     397 2008-06-09 13:26:54 ./id_rsa.pub
     -rw-r--r-- tarek/staff   37192 2010-02-06 18:23:10 ./known_hosts


File: python.info,  Node: base_dir を使ったアーカイブ化の例,  Prev: アーカイブ化の例,  Up: アーカイブ化操作

5.11.9.7 'base_dir' を使ったアーカイブ化の例
............................................

この例では、 *note 上記の例: 2cf8. と同じく *note make_archive(): 6da. の
使い方を示しますが、ここでは特に 'base_dir' の使い方を説明します。以下の
ようなディレクトリ構造があるとします。

     $ tree tmp
     tmp
     └── root
         └── structure
             ├── content
                 └── please_add.txt
             └── do_not_add.txt

作成するアーカイブには ‘please_add.txt’ が含まれますが、いっぽう
‘do_not_add.txt’ は含まないようにします。この場合以下のようにします。

     >>> from shutil import make_archive
     >>> import os
     >>> archive_name = os.path.expanduser(os.path.join('~', 'myarchive'))
     >>> make_archive(
     ...     archive_name,
     ...     'tar',
     ...     root_dir='tmp/root',
     ...     base_dir='structure/content',
     ... )
     '/Users/tarek/myarchive.tar'

アーカイブに含まれるファイルをリストすると、以下のようになります。

     $ python -m tarfile -l /Users/tarek/myarchive.tar
     structure/content/
     structure/content/please_add.txt


File: python.info,  Node: 出力ターミナルのサイズの取得,  Prev: アーカイブ化操作,  Up: shutil --- 高水準のファイル操作

5.11.9.8 出力ターミナルのサイズの取得
.....................................

 -- の関数: shutil.get_terminal_size (fallback=(columns, lines))

     ターミナルウィンドウのサイズを取得します。

     幅と高さについて、それぞれ ‘COLUMNS’ と ‘LINES’ という環境変数をチ
     ェックします。その変数が定義されていて値が正の整数であればそれを利
     用します。

     典型的な ‘COLUMNS’ や ‘LINES’ が定義されていない場合には、 *note
     sys.__stdout__: 2cfb. に接続されているターミナルに *note
     os.get_terminal_size(): 131a. を呼び出して問い合わせます。

     システムが対応していない場合やターミナルに接続していないなどの理由
     でターミナルサイズの問い合わせに失敗した場合、 ‘fallback’ 引数に与
     えられた値を利用します。 ‘fallback’ のデフォルト値は ‘(80, 24)’ で
     、これは多くのターミナルエミュレーターが利用しているデフォルトサイ
     ズです。

     戻り値は *note os.terminal_size: 2cfc. 型の名前付きタプルです。

     参考: The Single UNIX Specification, Version 2, Other Environment
     Variables(1).

     Added in version 3.3.

     バージョン 3.11 で変更: The ‘fallback’ values are also used if
     *note os.get_terminal_size(): 131a. returns zeroes.

参考
....

*note os: a5. モジュール

     オペレーティングシステムのインターフェース、Python の *note
     ファイルオブジェクト: 13db. より低レベルでのファイル操作を含みます
     。

*note io: 83. モジュール

     Python 組み込みの I/O ライブラリで、抽象クラスとファイル I/O のよう
     ないくつかの具象クラスを含みます。

*note open(): 316. 組み込み関数

     Python で読み書きのためにファイルを開く標準的な方法です。

   ---------- Footnotes ----------

   (1) 
https://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html#tag_002_003


File: python.info,  Node: データの永続化,  Next: データ圧縮とアーカイブ,  Prev: ファイルとディレクトリへのアクセス,  Up: Python 標準ライブラリ

5.12 データの永続化
===================

この章で解説されるモジュール群は Python データをディスクに永続的な形式で
保存します。モジュール *note pickle: ab. とモジュール *note marshal: 91.
は多くの Python データ型をバイト列に変換し、バイト列から再生成します。様
々な DBM 関連モジュールはハッシュを基にした、文字列から他の文字列へのマ
ップを保存するファイルフォーマット群をサポートします。

この章で解説されるモジュールのリスト:

* Menu:

* pickle: pickle --- Python オブジェクトの直列化. Python オブジェクトの直列化
* copyreg: copyreg --- pickle サポート関数を登録する. pickle サポート関数を登録する
* shelve: shelve --- Python オブジェクトの永続化. Python オブジェクトの永続化
* marshal: marshal --- 内部使用向けの Python オブジェクト直列化. 内部使用向けの Python オブジェクト直列化
* dbm: dbm --- Unix "データベース" へのインターフェース. Unix "データベース" へのインターフェース
* sqlite3: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース. SQLite データベース用の DB-API 2.0 インターフェース


File: python.info,  Node: pickle --- Python オブジェクトの直列化,  Next: copyreg --- pickle サポート関数を登録する,  Up: データの永続化

5.12.1 ‘pickle’ -- Python オブジェクトの直列化
----------------------------------------------

'ソースコード:' Lib/pickle.py(1)

__________________________________________________________________

The ‘pickle’ module implements binary protocols for serializing and
de-serializing a Python object structure.  '"Pickling"' is the process
whereby a Python object hierarchy is converted into a byte stream, and
'"unpickling"' is the inverse operation, whereby a byte stream (from a
*note binary file: 206e. or *note bytes-like object: 193.) is converted
back into an object hierarchy.  Pickling (and unpickling) is
alternatively known as "serialization", "marshalling," (2) or
"flattening"; however, to avoid confusion, the terms used here are
"pickling" and "unpickling".

     警告: ‘pickle’ モジュールは '安全ではありません' 。信頼できるデータ
     のみを非 pickle 化してください。

     '非 pickle 化の過程で任意のコードを実行する' ような、悪意ある
     pickle オブジェクトを生成することが可能です。信頼できない提供元から
     のデータや、改竄された可能性のあるデータの非 pickle 化は絶対に行わ
     ないでください。

     データが改竄されていないことを保証したい場合は、 *note hmac: 6e. に
     よる鍵付きハッシュ化を検討してください。

     信頼できないデータを処理する場合 *note json: 86. のようなより安全な
     直列化形式の方が適切でしょう。 *note json との比較: 2d03. を参照し
     てください。

* Menu:

* 他の Python モジュールとの関係::
* データストリームの形式::
* モジュールインターフェース::
* pickle 化、非 pickle 化できるもの::
* クラスインスタンスの pickle 化::
* 型、関数、その他のオブジェクトに対するリダクションのカスタマイズ::
* アウトオブバウンドバッファ::
* グローバル変数を制限する::
* 性能: 性能<2>.
* 使用例: 使用例<11>.
* コマンドライン・インターフェース::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/pickle.py

   (2) *note marshal: 91. モジュールと間違えないように注意してください。


File: python.info,  Node: 他の Python モジュールとの関係,  Next: データストリームの形式,  Up: pickle --- Python オブジェクトの直列化

5.12.1.1 他の Python モジュールとの関係
.......................................

* Menu:

* marshal との比較::
* json との比較::


File: python.info,  Node: marshal との比較,  Next: json との比較,  Up: 他の Python モジュールとの関係

5.12.1.2 ‘marshal’ との比較
...........................

Python has a more primitive serialization module called *note marshal:
91, but in general ‘pickle’ should always be the preferred way to
serialize Python objects.  *note marshal: 91. exists primarily to
support Python's ‘.pyc’ files.

The ‘pickle’ module differs from *note marshal: 91. in several
significant ways:

   * *note marshal: 91. cannot be used to serialize user-defined classes
     and their instances.  ‘pickle’ can save and restore class instances
     transparently, however the class definition must be importable and
     live in the same module as when the object was stored.

   * The *note marshal: 91. serialization format is not guaranteed to be
     portable across Python versions.  Because its primary job in life
     is to support ‘.pyc’ files, the Python implementers reserve the
     right to change the serialization format in non-backwards
     compatible ways should the need arise.  The ‘pickle’ serialization
     format is guaranteed to be backwards compatible across Python
     releases provided a compatible pickle protocol is chosen and
     pickling and unpickling code deals with Python 2 to Python 3 type
     differences if your data is crossing that unique breaking change
     language boundary.


File: python.info,  Node: json との比較,  Prev: marshal との比較,  Up: 他の Python モジュールとの関係

5.12.1.3 ‘json’ との比較
........................

pickle プロトコルと JSON (JavaScript Object Notation)(1) との基本的な違
いは以下のとおりです:

   * JSON はテキストの直列化フォーマット (大抵の場合 ‘utf-8’ にエンコー
     ドされますが、その出力は Unicode 文字列です) で、pickle はバイナリ
     の直列化フォーマットです;

   * JSON は人間が読める形式ですが、pickle はそうではありません;

   * JSON は相互運用可能で Python 以外でも広く使用されていますが、pickle
     は Python 固有です;

   * JSON は、デフォルトでは Python の組み込み型の一部しか表現することが
     できず、カスタムクラスに対しても行えません; pickle は極めて多くの
     Python 組み込み型を表現できます (その多くは賢い Python 内省機構によ
     って自動的に行われます; 複雑なケースでは *note 固有のオブジェクト
     API: 2d07. によって対応できます)。

   * pickleとは異なり、信頼できないJSONを復元するだけでは、任意のコード
     を実行できる脆弱性は発生しません。

参考
....

*note json: 86. モジュール: JSON への直列化および復元を行うための標準ラ
イブラリモジュール。

   ---------- Footnotes ----------

   (1) https://json.org


File: python.info,  Node: データストリームの形式,  Next: モジュールインターフェース,  Prev: 他の Python モジュールとの関係,  Up: pickle --- Python オブジェクトの直列化

5.12.1.4 データストリームの形式
...............................

The data format used by ‘pickle’ is Python-specific.  This has the
advantage that there are no restrictions imposed by external standards
such as JSON (which can't represent pointer sharing); however it means
that non-Python programs may not be able to reconstruct pickled Python
objects.

By default, the ‘pickle’ data format uses a relatively compact binary
representation.  If you need optimal size characteristics, you can
efficiently *note compress: 2d09. pickled data.

The module *note pickletools: ac. contains tools for analyzing data
streams generated by ‘pickle’.  *note pickletools: ac. source code has
extensive comments about opcodes used by pickle protocols.

現在 pickle 化には 6 種類のプロトコルを使用できます。より高いプロトコル
を使用するほど、作成された pickle を読み込むためにより高い Python のバー
ジョンが必要になります。

   * プロトコルバージョン 0 はオリジナルの「人間に判読可能な」プロトコル
     で、Python の初期のバージョンとの後方互換性を持ちます。

   * プロトコルバージョン 1 は旧形式のバイナリフォーマットで、これも
     Python の初期バージョンと互換性があります。

   * プロトコルバージョン 2 は Python 2.3 で導入されました。このバージョ
     ンでは *note 新方式のクラス: 2d0a. のより効率的な pickle 化を提供し
     ました。プロトコル 2 による改良に関する情報は PEP 307(1) を参照して
     ください。

   * プロトコルバージョン 3 は Python 3 で追加されました。 *note bytes:
     192. オブジェクトを明示的にサポートしており、 Python 2.x で
     unpickle することはできません。これは Python 3.0から3.7のデフォルト
     プロトコルでした。

   * プロトコルバージョン 4 は Python 3.4 で追加されました。このバージョ
     ンでは巨大なオブジェクトのサポート、より多くの種類のオブジェクトの
     pickle 化、および一部のデータ形式の最適化が行われました。これは
     Python 3.8から3.13 までのデフォルトプロトコルでした。プロトコル 4 に
     よる改良に関する情報は PEP 3154(2) を参照してください。

   * プロトコルバージョン 5 は Python 3.8 で追加されました。このバージョ
     ンでは帯域外データのサポートが追加され、また帯域内データに対するパ
     フォーマンスが向上します。これはPython 3.14からのデフォルトプロトコ
     ルです。プロトコルバージョン 5 によってもたらされる改善についての情
     報は PEP 574(3) を参照してください。

     注釈: Serialization is a more primitive notion than persistence;
     although ‘pickle’ reads and writes file objects, it does not handle
     the issue of naming persistent objects, nor the (even more
     complicated) issue of concurrent access to persistent objects.  The
     ‘pickle’ module can transform a complex object into a byte stream
     and it can transform the byte stream into an object with the same
     internal structure.  Perhaps the most obvious thing to do with
     these byte streams is to write them onto a file, but it is also
     conceivable to send them across a network or store them in a
     database.  The *note shelve: c8. module provides a simple interface
     to pickle and unpickle objects on DBM-style database files.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0307/

   (2) https://peps.python.org/pep-3154/

   (3) https://peps.python.org/pep-0574/


File: python.info,  Node: モジュールインターフェース,  Next: pickle 化、非 pickle 化できるもの,  Prev: データストリームの形式,  Up: pickle --- Python オブジェクトの直列化

5.12.1.5 モジュールインターフェース
...................................

オブジェクト階層を直列化するには、*note dumps(): 16bd. 関数を呼ぶだけで
す。同様に、データストリームを復元するには、*note loads(): f0d. 関数を呼
びます。しかし、直列化および復元に対してより多くのコントロールを行いたい
場合、それぞれ *note Pickler: c13. または *note Unpickler: 1777. オブジ
ェクトを作成することができます。

The ‘pickle’ module provides the following constants:

 -- データ: pickle.HIGHEST_PROTOCOL

     利用可能なうち最も高い *note プロトコルバージョン: 27b. (整数)。こ
     の値は 'protocol' 値として関数 *note dump(): 2d0c. および *note
     dumps(): 16bd. と、*note Pickler: c13. コンストラクターに渡すことが
     できます。

 -- データ: pickle.DEFAULT_PROTOCOL

     An integer, the default *note protocol version: 27b. used for
     pickling.  May be less than *note HIGHEST_PROTOCOL: 16be.
     Currently the default protocol is 5, introduced in Python 3.8 and
     incompatible with previous versions.  This version introduces
     support for out-of-band buffers, where PEP 3118(1)-compatible data
     can be transmitted separately from the main pickle stream.

     バージョン 3.0 で変更: デフォルトプロトコルは 3 です。

     バージョン 3.8 で変更: デフォルトプロトコルは 4 です。

     バージョン 3.14 で変更: デフォルトプロトコルは 5 です。

The ‘pickle’ module provides the following functions to make the
pickling process more convenient:

 -- の関数: pickle.dump (obj, file, protocol=None, *, fix_imports=True,
          buffer_callback=None)

     オブジェクト 'obj' を pickle 化し、すでにオープンしている *note
     ファイルオブジェクト: 13db. 'file' に書き込みます。‘Pickler(file,
     protocol).dump(obj)’ と等価です。

     引数 'file', 'protocol', 'fix_imports' および 'buffer_callback' は
     *note Pickler: c13. のコンストラクタと同じ意味になります。

     バージョン 3.8 で変更: 'buffer_callback' 引数が追加されました。

 -- の関数: pickle.dumps (obj, protocol=None, *, fix_imports=True,
          buffer_callback=None)

     ファイルに書く代わりに、*note bytes: 192. オブジェクトとしてオブジ
     ェクト 'obj' の pickle 表現を返します。

     引数 'protocol', 'fix_imports' および 'buffer_callback' は *note
     Pickler: c13. のコンストラクタと同じ意味になります。

     バージョン 3.8 で変更: 'buffer_callback' 引数が追加されました。

 -- の関数: pickle.load (file, *, fix_imports=True, encoding='ASCII',
          errors='strict', buffers=None)

     あるオブジェクトの pickle 化表現を、オープンしている *note
     ファイルオブジェクト: 13db. 'file' から読み込み、その中で指定されて
     いるオブジェクト階層に再構成して返します。これは
     ‘Unpickler(file).load()’ と等価です。

     pickle のプロトコルバージョンは自動的に検出されます。したがって
     protocol 引数は必要ありません。pickle 化オブジェクト表現より後のバ
     イト列は無視されます。

     引数 'file', 'fix_imports', 'encoding', 'errors', 'strict' および
     'buffers' は *note Unpickler: 1777. のコンストラクタと同じ意味にな
     ります。

     バージョン 3.8 で変更: 'buffers' 引数が追加されました。

 -- の関数: pickle.loads (data, /, *, fix_imports=True,
          encoding='ASCII', errors='strict', buffers=None)

     オブジェクトのピックル化表現 'data' から再構成されたオブジェクト階
     層を返します。 'data' は バイトライクオブジェクト (*note bytes-like
     object: 193.) でなければなりません。

     pickle のプロトコルバージョンは自動的に検出されます。したがって
     protocol 引数は必要ありません。pickle 化オブジェクト表現より後のバ
     イト列は無視されます。

     引数 'fix_imports', 'encoding', 'errors', 'strict' および 'buffers'
     は *note Unpickler: 1777. のコンストラクタと同じ意味になります。

     バージョン 3.8 で変更: 'buffers' 引数が追加されました。

The ‘pickle’ module defines three exceptions:

 -- 例外: pickle.PickleError

     他の pickle 化例外の共通基底クラス。*note Exception: bcd. を継承し
     ています。

 -- 例外: pickle.PicklingError

     *note Pickler: c13. が pickle 化不可能なオブジェクトに遭遇したとき
     に送出されるエラー。*note PickleError: 2d0d. を継承しています。

     どんな種類のオブジェクトが pickle 化できるのか確認するには *note
     pickle 化、非 pickle 化できるもの: 2d0e. を参照してください。

 -- 例外: pickle.UnpicklingError

     データ破損やセキュリティ違反のような、オブジェクトを非 pickle 化す
     るのに問題がある場合に送出されるエラー。*note PickleError: 2d0d. を
     継承します。

     非 picke 化の最中に他の例外が送出されることもあるので注意してくださ
     い。これには AttributeError, EOFError, ImportError, IndexError が含
     まれます (ただし必ずしもこれらに限定されません)。

The ‘pickle’ module exports three classes, *note Pickler: c13, *note
Unpickler: 1777. and *note PickleBuffer: 177b.:

 -- クラス: pickle.Pickler (file, protocol=None, *, fix_imports=True,
          buffer_callback=None)

     pickle 化されたオブジェクトのデータストリームを書き込むためのバイナ
     リファイルを引数にとります。

     任意の引数 'protocol' は、整数で、pickle 化で使用するプロトコルを指
     定します; サポートされているプロトコルは 0 から *note
     HIGHEST_PROTOCOL: 16be. までになります。指定されない場合、*note
     DEFAULT_PROTOCOL: a2f. が使用されます。負数が与えられた場合、*note
     HIGHEST_PROTOCOL: 16be. が使用されます。

     引数 'file' は、1 バイトの引数一つを受け付ける write() メソッドを持
     たなければなりません。すなわち、'file' には、バイナリの書き込み用に
     オープンされたファイルオブジェクト、*note io.BytesIO: 10a4. オブジ
     ェクト、このインターフェースに適合するその他のカスタムオブジェクト
     をとることができます。

     'fix_imports' が真であり、かつ、'protocol' が 3 未満の場合、pickle
     は新しい Python 3 の名前と Python 2 で使用されていた古いモジュール
     名との対応付けを試みるので、pickle データストリームは Python 2 でも
     読み込み可能です。

     'buffer_callback' が ‘None’ (デフォルト) の場合、バッファビューはス
     トリームの一部として*file* 中に直列化されます。

     'buffer_callback' が ‘None’ でない場合、バッファビューを引数として
     何度でも呼び出すことができる関数です。コールバック関数が偽値
     (‘None’ など) を返すと、与えられたバッファは *note
     アウトオブバウンド管理 (out-of-band): 2d10. となります; そうでない
     場合はインバンドで、すなわち pickle ストリーム内で、直列化されます
     。

     'buffer_callback' が ‘None’ でなく、かつ 'protocol' が ‘None’ また
     は 5 より小さい場合はエラーとなります。

     バージョン 3.8 で変更: 'buffer_callback' 引数が追加されました。

      -- メソッド: dump (obj)

          'obj' の pickle 化表現を、コンストラクターで与えられた、すでに
          オープンしているファイルオブジェクトに書き込みます。

      -- メソッド: persistent_id (obj)

          デフォルトでは何もしません。このメソッドはサブクラスがオーバー
          ライドできるように存在します。

          *note persistent_id(): 190c. が ‘None’ を返す場合、通常通り
          'obj' が pickle 化されます。それ以外の値を返した場合、*note
          Pickler: c13. がその値を 'obj' のために永続的な ID として出力
          するようになります。この永続的な ID の意味は *note
          Unpickler.persistent_load(): 1914. によって定義されています。
          *note persistent_id(): 190c. によって返された値自身は永続的な
          ID を持つことができないことに注意してください。

          詳細および使用例については *note 外部オブジェクトの永続化:
          2d11. を参照してください。

          バージョン 3.13 で変更: Add the default implementation of this
          method in the C implementation of ‘Pickler’.

      -- の属性: dispatch_table

          pickler オブジェクトのディスパッチテーブルは *note
          copyreg.pickle(): 2d12. を使用して宣言できる種類の 'reduction
          functions' のレジストリです。これはキーがクラスでその値が減少
          関数のマッピング型オブジェクトです。減少関数は関連するクラスの
          引数を 1 個とり、*note __reduce__(): bc6. メソッドと同じインタ
          ーフェースでなければなりません。

          デフォルトでは、pickler オブジェクトは *note dispatch_table:
          133a. 属性を持たず、代わりに *note copyreg: 2a. モジュールによ
          って管理されるグローバルなディスパッチテーブルを使用します。し
          かし、特定の pickler オブジェクトによる pickle 化をカスタマイ
          ズするために *note dispatch_table: 133a. 属性に dict-like オブ
          ジェクトを設定することができます。あるいは、*note Pickler:
          c13. のサブクラスが *note dispatch_table: 133a. 属性を持てば、
          そのクラスのインスタンスに対するデフォルトのディスパッチテーブ
          ルとして使用されます。

          使用例については *note ディスパッチテーブル: 2d13. を参照して
          ください。

          Added in version 3.3.

      -- メソッド: reducer_override (obj)

          *note Pickler: c13. のサブクラスで定義可能な特殊なリデューサ
          (reducer) です。このメソッドは *note dispatch_table: 133a. 内
          のいかなるリデューサよりも優先されます。このメソッドは *note
          __reduce__(): bc6. メソッドのインターフェースと適合していなけ
          ればなりません。また、メソッドが *note NotImplemented: 1a2. を
          返すことにより、 *note dispatch_table: 133a. に登録されたリデ
          ューサにフォールバックして ‘obj’ を直列化することもできます。

          詳細な例については、 *note
          型、関数、その他のオブジェクトに対するリダクションのカスタマイズ:
          2d14. を参照してください。

          Added in version 3.8.

      -- の属性: fast

          廃止予定です。真値が設定されれば高速モードを有効にします。高速
          モードは、メモの使用を無効にします。それにより余分な PUT 命令
          コードを生成しなくなるので pickle 化処理が高速化します。自己参
          照オブジェクトに対しては使用すべきではありません。さもなければ
          *note Pickler: c13. に無限再帰を起こさせるでしょう。

          よりコンパクトな pickle 化を必要とする場合は、*note
          pickletools.optimize(): 2d16. を使用してください。

      -- メソッド: clear_memo ()

          Clears the pickler's "memo".

          The memo is the data structure that remembers which objects
          the pickler has already seen, so that shared or recursive
          objects are pickled by reference and not by value.  This
          method is useful when re-using picklers.

 -- クラス: pickle.Unpickler (file, *, fix_imports=True,
          encoding='ASCII', errors='strict', buffers=None)

     これは pickle データストリームの読み込みのためにバイナリファイルを
     とります。

     pickle のプロトコルバージョンは自動的に検出されます。したがって
     protocol 引数は必要ありません。

     引数 'file' は *note io.BufferedIOBase: 8a3. のインターフェースと同
     様に、整数を引数にとる read() 、バッファを引数にとる readinto() 、
     引数を取らない readline() の3つのメソッドを持たなければなりません。
     したがって、 'file' はバイナリ読み込みモードでオープンされたディス
     ク上のファイル、 *note io.BytesIO: 10a4. オブジェクト、または上記イ
     ンターフェース要件を満たす任意のカスタムオブジェクトのいずれかです
     。

     オプション引数 'fix_imports', 'encoding' および 'errors' はPython
     2で生成された pickle ストリームに対する互換性サポートを制御するため
     に使われます。 'fix_imports' が真の場合、 pickle は古い Python 2 の
     名前を Python 3 の新しい名前に対応づけようとします。 'encoding' と
     'errors' は pickle に Python 2 で pickle 化された 8 ビット文字列を
     デコードする方法を指定します; これらの引数のデフォルト値はそれぞれ
     'ASCII' と 'strict' です。 'encoding' は 8 ビット文字列インスタンス
     をバイトオブジェクトとして読み込む場合は 'bytes' を指定します。
     Python 2 で pickle 化された NumPy 配列および *note datetime: 4e2,
     *note date: 1fa, *note time: 1fb. の各インスタンスを非 pickle 化す
     るためには ‘encoding='latin1'’ を使う必要があります。

     'buffers' が ‘None’ (デフォルト値) の場合、非直列化に必要な全てのデ
     ータは pickle ストリームに含まれている必要があります。これは *note
     Pickler: c13. がインスタンス化されたとき (または *note dump():
     2d0c. や *note dumps(): 16bd. が呼び出されたとき) に
     'buffer_callback' 引数に ‘None’ を指定したことに相当します。

     'buffers' が ‘None’ でない場合、各イテレーションで *note
     アウトオブバウンド (out-of-band): 2d10. のバッファビューを参照する
     pickle ストリームを消費する、バッファ対応のイテラブルでなければなり
     ません。ここに指定するバッファは Pickler オブジェクトの
     'buffer_callback' に順番に渡されたものです。

     バージョン 3.8 で変更: 'buffers' 引数が追加されました。

      -- メソッド: load ()

          コンストラクターで与えられたオープンしたファイルオブジェクトか
          らオブジェクトの pickle 化表現を読み込み、その中で指定されたオ
          ブジェクト階層に再構成して返します。オブジェクトの pickle 化表
          現より後のバイト列は無視されます。

      -- メソッド: persistent_load (pid)

          デフォルトで *note UnpicklingError: 2d0f. を送出します。

          もし定義されていれば、*note persistent_load(): 1914. は永続的
          な ID 'pid' によって指定されたオブジェクトを返す必要があります
          。永続的な ID が無効な場合、*note UnpicklingError: 2d0f. を送
          出しなければなりません。

          詳細および使用例については *note 外部オブジェクトの永続化:
          2d11. を参照してください。

          バージョン 3.13 で変更: Add the default implementation of this
          method in the C implementation of ‘Unpickler’.

      -- メソッド: find_class (module, name)

          必要なら 'module' をインポートして、そこから 'name' という名前
          のオブジェクトを返します。ここで 'module' および 'name' 引数は
          *note str: 169. オブジェクトです。その名前が示唆することに反し
          て *note find_class(): 2d19. は関数を探すためにも使われること
          に注意してください。

          サブクラスは、どんな型のオブジェクトを、どのようにロードするか
          (潜在的にはセキュリティリスクの減少) に関する制御を得るために
          これをオーバーライドすることができます。詳細に関しては *note
          グローバル変数を制限する: 2d1a. を参照してください。

          引数 ‘modulet’, ‘name’ を指定して *note 監査イベント: 1c6e.
          ‘pickle.find_class’ を送出します。

 -- クラス: pickle.PickleBuffer (buffer)

     pickle 可能なデータをあらわすバッファのラッパーです。 'buffer' はバ
     ッファライクなオブジェクト (*note bytes-like object: 193.) や N 次
     元配列のような *note バッファ機能を提供する: 260. オブジェクトでな
     ければなりません。

     *note PickleBuffer: 177b. はそれ自身バッファ機能を提供します。した
     がってこのクラスのインスタンスを、バッファ機能を提供するオブジェク
     トを期待する *note memoryview: 165. など他の API に渡すことが可能で
     す。

     *note PickleBuffer: 177b. オブジェクトはプロトコル 5 以上でのみ直列
     化可能で、 *note アウトオブバウンド (out-of-band) の直列化: 2d10. に
     対応しています。

     Added in version 3.8.

      -- メソッド: raw ()

          このバッファの背後にあるメモリ領域への *note memoryview: 165.
          を返します。戻り値のオブジェクトはフォーマット ‘B’ (符号なしバ
          イト) の C-連続な1次元のメモリビューです。バッファが C-連続で
          も Fortran-連続でもない場合 *note BufferError: 1797. 例外が送
          出されます。

      -- メソッド: release ()

          PickleBuffer オブジェクトを通じてアクセスされる背後のバッファ
          を解放します。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3118/


File: python.info,  Node: pickle 化、非 pickle 化できるもの,  Next: クラスインスタンスの pickle 化,  Prev: モジュールインターフェース,  Up: pickle --- Python オブジェクトの直列化

5.12.1.6 pickle 化、非 pickle 化できるもの
..........................................

以下の型は pickle 化できます:

   * 組み込み定数(‘None’, ‘True’, ‘False’, ‘Ellipsis’, と *note
     NotImplemented: 1a2.)

   * 整数、浮動小数点数、複素数

   * 文字列、バイト列、バイト配列

   * pickle 化可能なオブジェクトからなるタプル、リスト、集合および辞書

   * モジュールのトップレベルで定義された関数 (*note def: 1673. で定義さ
     れたもののみで *note lambda: 14b5. で定義されたものは含まない)

   * モジュールのトップレベルで定義されているクラス

   * instances of such classes for which the result of calling *note
     __getstate__(): 7f1. is picklable (see section *note
     クラスインスタンスの pickle 化: 2d07. for details).

pickle 化できないオブジェクトを pickle 化しようとすると、*note
PicklingError: 1942. 例外が送出されます。この例外が起きたとき、すでに元
のファイルには未知の長さのバイト列が書き込まれている場合があります。極端
に再帰的なデータ構造を pickle 化しようとした場合には再帰の深さ制限を越え
てしまうかもしれず、この場合には *note RecursionError: f68. が送出されま
す。この制限は、*note sys.setrecursionlimit(): 6ea. で慎重に上げていくこ
とは可能です。

関数 (組込みおよびユーザー定義) は、値ではなく、完全 *note 修飾名: 1d24.
で pickle 化されます。(1) これは、関数名のみがそれを含んでいるモジュール
およびクラスの名前をともなって pickle 化されることを意味します。関数のコ
ードやその属性は pickle 化されません。すなわち、非 pickle 化する環境で定
義したモジュールがインポート可能な状態になっており、そのモジュール内に関
数名のオブジェクトが含まれていなければなりません。この条件を満たさなかっ
た場合は例外が送出されます。(2)

クラスも同様に完全修飾名で pickle 化されるので、unpickle 化環境には同じ
制限が課せられます。クラス中のコードやデータは何も pickle 化されないので
、以下の例ではクラス属性 ‘attr’ が unpickle 化環境で復元されないことに注
意してください:

     class Foo:
         attr = 'A class attribute'

     picklestring = pickle.dumps(Foo)

pickle 化可能な関数やクラスがモジュールのトップレベルで定義されていなけ
ればならないのはこれらの制限のためです。

同様に、クラスのインスタンスが pickle 化された際、そのクラスのコードおよ
びデータはオブジェクトと一緒に pickle 化されることはありません。インスタ
ンスのデータのみが pickle 化されます。この仕様は、クラス内のバグを修正し
たりメソッドを追加した後でも、そのクラスの以前のバージョンで作られたオブ
ジェクトを読み出せるように意図的に行われています。あるクラスの多くのバー
ジョンで使われるような長命なオブジェクトを作ろうと計画しているなら、その
クラスの *note __setstate__(): bc7. メソッドによって適切な変換が行われる
ようにオブジェクトのバージョン番号を入れておくとよいかもしれません。

   ---------- Footnotes ----------

   (1) なぜ *note lambda: 14b5. 関数を pickle 化できないかというと、すべ
ての ‘lambda’ 関数は同じ名前: ‘<lambda>’ を共有しているからです。

   (2) 送出される例外は *note ImportError: 65b. や *note AttributeError:
5f0. になるはずですが、他の例外も起こりえます。


File: python.info,  Node: クラスインスタンスの pickle 化,  Next: 型、関数、その他のオブジェクトに対するリダクションのカスタマイズ,  Prev: pickle 化、非 pickle 化できるもの,  Up: pickle --- Python オブジェクトの直列化

5.12.1.7 クラスインスタンスの pickle 化
.......................................

この節では、クラスインスタンスがどのように pickle 化または非 pickle 化さ
れるのかを定義したり、カスタマイズしたり、コントロールしたりするのに利用
可能な一般的機構について説明します。

ほとんどの場合、インスタンスを pickle 化できるようにするために追加のコー
ドは必要ありません。デフォルトで、pickle はインスタンスのクラスと属性を
内省によって検索します。クラスインスタンスが非 pickle 化される場合、通常
その *note __init__(): 8bf. メソッドは実行 'されません' 。デフォルトの振
る舞いは、最初に初期化されていないインスタンスを作成して、次に保存された
属性を復元します。次のコードはこの振る舞いの実装を示しています:

     def save(obj):
         return (obj.__class__, obj.__dict__)

     def restore(cls, attributes):
         obj = cls.__new__(cls)
         obj.__dict__.update(attributes)
         return obj

クラスは、いくつかの特殊メソッドを提供することによって、デフォルトの振る
舞いを変更することができます:

 -- メソッド: object.__getnewargs_ex__ ()

     In protocols 2 and newer, classes that implement the *note
     __getnewargs_ex__(): 2d1f. method can dictate the values passed to
     the *note __new__(): 7a0. method upon unpickling.  The method must
     return a pair ‘(args, kwargs)’ where 'args' is a tuple of
     positional arguments and 'kwargs' a dictionary of named arguments
     for constructing the object.  Those will be passed to the *note
     __new__(): 7a0. method upon unpickling.

     クラスの *note __new__(): 7a0. メソッドがキーワード専用引数を求める
     場合はこのメソッドを実装すべきです。 そうしない場合、互換性のため
     *note __getnewargs__(): fd4. メソッドの実装を推奨します。

     バージョン 3.6 で変更: *note __getnewargs_ex__(): 2d1f. がプロトコ
     ル 2 と 3 でも使われるようになりました。

 -- メソッド: object.__getnewargs__ ()

     このメソッドは *note __getnewargs_ex__(): 2d1f. と同じような機能を
     提供しますが、位置引数のみをサポートします。このメソッドは引数のタ
     プル ‘args’ を返さなければならず、戻り値は非 pickle 化に際して
     *note __new__(): 7a0. メソッドに渡されます。

     *note __getnewargs_ex__(): 2d1f. が定義されていると *note
     __getnewargs__(): fd4. は呼び出しません。

     バージョン 3.6 で変更: Python 3.6以前のプロトコル 2 と 3 では、
     *note __getnewargs_ex__(): 2d1f. の代わりに *note __getnewargs__():
     fd4. が呼び出されていました。

 -- メソッド: object.__getstate__ ()

     Classes can further influence how their instances are pickled by
     overriding the method *note __getstate__(): 7f1.  It is called and
     the returned object is pickled as the contents for the instance,
     instead of a default state.  There are several cases:

        * For a class that has no instance *note __dict__: 77d. and no
          *note __slots__: 1704, the default state is ‘None’.

        * For a class that has an instance *note __dict__: 77d. and no
          *note __slots__: 1704, the default state is ‘self.__dict__’.

        * For a class that has an instance *note __dict__: 77d. and
          *note __slots__: 1704, the default state is a tuple consisting
          of two dictionaries: ‘self.__dict__’, and a dictionary mapping
          slot names to slot values.  Only slots that have a value are
          included in the latter.

        * For a class that has *note __slots__: 1704. and no instance
          *note __dict__: 77d, the default state is a tuple whose first
          item is ‘None’ and whose second item is a dictionary mapping
          slot names to slot values described in the previous bullet.

     バージョン 3.11 で変更: Added the default implementation of the
     ‘__getstate__()’ method in the *note object: c7e. class.

 -- メソッド: object.__setstate__ (state)

     非 pickle 化に際して、クラスが *note __setstate__(): bc7. を定義し
     ている場合、それは非 pickle 化された状態とともに呼び出されます。そ
     の場合、状態オブジェクトが辞書でなければならないという要求はありま
     せん。そうでなければ、 pickle された状態は辞書で、その要素は新しい
     インスタンスの辞書に割り当てられます。

          注釈: If *note __reduce__(): bc6. returns a state with value
          ‘None’ at pickling, the *note __setstate__(): bc7. method will
          not be called upon unpickling.

*note __getstate__(): 7f1. および *note __setstate__(): bc7. メソッドの
使い方に関する詳細な情報については *note 状態を持つオブジェクトの扱い:
2d20. 節を参照してください。

     注釈: 非 pickle 化に際しては、 *note __getattr__(): 6fa, *note
     __getattribute__(): dcb, または *note __setattr__(): 237c. といった
     メソッドがインスタンスに対して呼ばれることがあります。これらのメソ
     ッドが何らかの内部の不変な条件が真であることを必要とする場合、その
     型は *note __new__(): 7a0. メソッドを実装してそのような不変な条件を
     構築すべきです。なぜならばインスタンスの非 pickle 化においては
     *note __init__(): 8bf. メソッドは呼ばれないからです。

これらから見るように、pickle は上記のメソッドを直接使用しません。実際に
は、これらのメソッドは *note __reduce__(): bc6. 特殊メソッドを実装するコ
ピープロトコルの一部です。コピープロトコルは、pickle 化とオブジェクトの
コピーに必要な、データを取得するための統一されたインターフェースを提供し
ます。 (1)

強力ですが、クラスに *note __reduce__(): bc6. メソッドを直接実装すること
はエラーを起こしやすくなります。この理由のため、クラスの設計者は可能なか
ぎり高レベルインターフェース (*note __getnewargs_ex__(): 2d1f.、*note
__getstate__(): 7f1. および *note __setstate__(): bc7.) を使用するべきで
す。公開はしているものの、‘__reduce__()’ の使用は、あくまでオプションと
して、より効果的な pickle 化につながる場合、あるいはその両方の場合のみに
してください。

 -- メソッド: object.__reduce__ ()

     このインターフェースは現在、以下のように定義されています。 *note
     __reduce__(): bc6. メソッドは引数を取らず、文字列あるいは (こちらの
     方が好まれますが) タプルのいずれかを返すべきです (返されたオブジェ
     クトは、しばしば "reduce value" と呼ばれます)。

     文字列が返された場合、その文字列はグローバル変数の名前として解釈さ
     れます。それはオブジェクトのモジュールから見たローカル名であるべき
     です; pickle モジュールは、オブジェクトのモジュールを決定するために
     モジュールの名前空間を検索します。この振る舞いは、典型的にシングル
     トンで便利です。

     タプルが返された場合、それは 2〜6 要素長でなければなりません。オプ
     ションのアイテムは省略することができます。あるいはそれらの値として
     ‘None’ を渡すことができます。各要素の意味は順に:

        * オブジェクトの初期バージョンを作成するために呼ばれる呼び出し可
          能オブジェクト。

        * 呼出し可能オブジェクトに対する引数のタプル。呼出し可能オブジェ
          クトが引数を受け取らない場合、空のタプルが与えられなければなり
          ません。

        * 任意で、前述のオブジェクトの *note __setstate__(): bc7. メソッ
          ドに渡されるオブジェクトの状態。オブジェクトがそのようなメソッ
          ドを持たない場合、値は辞書でなければならず、それはオブジェクト
          の *note __dict__: 77d. 属性に追加されます。

        * 任意で、連続した要素を yield する (シーケンスではなく) イテレ
          ーター。これらの要素は ‘obj.append(item)’ を使用して、あるいは
          バッチでは ‘obj.extend(list_of_items)’ を使用して、オブジェク
          トに追加されます。これは主としてリストのサブクラスに対して使用
          されますが、適切なシグネチャを持つ *note append(): 23d6. およ
          び *note extend(): 23d9. メソッドがあるかぎり、他のクラスで使
          用することもできます。 (‘append()’ または ‘extend()’ のどちら
          が使用されるかは、どの pickle プロトコルバージョンが使われるか
          に加えて追加されるアイテムの数にも依存します。したがって、両方
          をサポートする必要があります)

        * 任意で、連続する key-value ペアを yield する (シーケンスでなく
          ) イテレーター。これらの要素は ‘obj[key] = value’ を使用して、
          オブジェクトに格納されます。これは主として辞書のサブクラスに対
          して使用されますが、*note __setitem__(): 14e3. を実装している
          かぎり他のクラスで使用することもできます。

        * 任意で、シグネチャが ‘(obj, state)’ である呼び出し可能オブジェ
          クト。このオブジェクトは、 ‘obj’ のスタティックな *note
          __setstate__(): bc7. メソッドの代わりに、ユーザーがオブジェク
          トの状態を更新する方法をプログラム的に制御することを許します。
          ‘None’ 以外の場合、この呼び出し可能オブジェクトは ‘obj’ の
          *note __setstate__(): bc7. メソッドに優先します。

          Added in version 3.8: 任意の6番目のタプル要素 ‘(obj, state)’ が
          追加されました。

 -- メソッド: object.__reduce_ex__ (protocol)

     別の方法として、*note __reduce_ex__(): 196b. メソッドを定義すること
     もできます。唯一の違いは、このメソッドは単一の整数引数、プロトコル
     バージョンを取る必要があるということです。もし定義された場合、
     pickle は *note __reduce__(): bc6. メソッドよりもこのメソッドを優先
     します。さらに、*note __reduce__(): bc6. は自動的に拡張版の同義語に
     なります。このメソッドの主な用途は、古い Python リリースに対して後
     方互換性のある reduce value を提供することです。

* Menu:

* 外部オブジェクトの永続化::
* ディスパッチテーブル::
* 状態を持つオブジェクトの扱い::

   ---------- Footnotes ----------

   (1) *note copy: 29. モジュールは、浅いコピーと深いコピーの操作にこの
プロトコルを使用します。


File: python.info,  Node: 外部オブジェクトの永続化,  Next: ディスパッチテーブル,  Up: クラスインスタンスの pickle 化

5.12.1.8 外部オブジェクトの永続化
.................................

For the benefit of object persistence, the ‘pickle’ module supports the
notion of a reference to an object outside the pickled data stream.
Such objects are referenced by a persistent ID, which should be either a
string of alphanumeric characters (for protocol 0) (1) or just an
arbitrary object (for any newer protocol).

The resolution of such persistent IDs is not defined by the ‘pickle’
module; it will delegate this resolution to the user-defined methods on
the pickler and unpickler, *note persistent_id(): 190c. and *note
persistent_load(): 1914. respectively.

外部の永続的 ID を持つ pickle オブジェクトの pickler は、引数にオブジェ
クトを取り、‘None’ かオブジェクトの永続的 ID を返すカスタム *note
persistent_id(): 190c. メソッドを持たなくてはなりません。‘None’ を返す場
合、pickler は通常通りマーカーとともにオブジェクトを pickle 化するため、
unpickler はそれを永続的 ID として認識します。

外部オブジェクトを非 pickle 化するには、unpickler は永続的 ID オブジェク
トを取り被参照オブジェクトを返すカスタム *note persistent_load(): 1914.
メソッドを持たなくてはなりません。

これは、外部のオブジェクトを参照によって pickle 化するために永続的 ID を
どのように使用するかを示す包括的な例です。

     # Simple example presenting how persistent ID can be used to pickle
     # external objects by reference.

     import pickle
     import sqlite3
     from collections import namedtuple

     # Simple class representing a record in our database.
     MemoRecord = namedtuple("MemoRecord", "key, task")

     class DBPickler(pickle.Pickler):

         def persistent_id(self, obj):
             # Instead of pickling MemoRecord as a regular class instance, we emit a
             # persistent ID.
             if isinstance(obj, MemoRecord):
                 # Here, our persistent ID is simply a tuple, containing a tag and a
                 # key, which refers to a specific record in the database.
                 return ("MemoRecord", obj.key)
             else:
                 # If obj does not have a persistent ID, return None. This means obj
                 # needs to be pickled as usual.
                 return None


     class DBUnpickler(pickle.Unpickler):

         def __init__(self, file, connection):
             super().__init__(file)
             self.connection = connection

         def persistent_load(self, pid):
             # This method is invoked whenever a persistent ID is encountered.
             # Here, pid is the tuple returned by DBPickler.
             cursor = self.connection.cursor()
             type_tag, key_id = pid
             if type_tag == "MemoRecord":
                 # Fetch the referenced record from the database and return it.
                 cursor.execute("SELECT * FROM memos WHERE key=?", (str(key_id),))
                 key, task = cursor.fetchone()
                 return MemoRecord(key, task)
             else:
                 # Always raises an error if you cannot return the correct object.
                 # Otherwise, the unpickler will think None is the object referenced
                 # by the persistent ID.
                 raise pickle.UnpicklingError("unsupported persistent object")


     def main():
         import io
         import pprint

         # Initialize and populate our database.
         conn = sqlite3.connect(":memory:")
         cursor = conn.cursor()
         cursor.execute("CREATE TABLE memos(key INTEGER PRIMARY KEY, task TEXT)")
         tasks = (
             'give food to fish',
             'prepare group meeting',
             'fight with a zebra',
             )
         for task in tasks:
             cursor.execute("INSERT INTO memos VALUES(NULL, ?)", (task,))

         # Fetch the records to be pickled.
         cursor.execute("SELECT * FROM memos")
         memos = [MemoRecord(key, task) for key, task in cursor]
         # Save the records using our custom DBPickler.
         file = io.BytesIO()
         DBPickler(file).dump(memos)

         print("Pickled records:")
         pprint.pprint(memos)

         # Update a record, just for good measure.
         cursor.execute("UPDATE memos SET task='learn italian' WHERE key=1")

         # Load the records from the pickle data stream.
         file.seek(0)
         memos = DBUnpickler(file, conn).load()

         print("Unpickled records:")
         pprint.pprint(memos)


     if __name__ == '__main__':
         main()

   ---------- Footnotes ----------

   (1) 英数文字に関する制限は、プロトコル 0 では永続的な ID が改行文字に
よって区切られるという事実によります。そのため、永続的な ID に何らかの改
行文字が含まれると、結果として生じる pickle 化されたデータは判読不能にな
ります。


File: python.info,  Node: ディスパッチテーブル,  Next: 状態を持つオブジェクトの扱い,  Prev: 外部オブジェクトの永続化,  Up: クラスインスタンスの pickle 化

5.12.1.9 ディスパッチテーブル
.............................

pickle 化に依存する他のコードの邪魔をせずに、一部のクラスの pickle 化だ
けをカスタマイズしたい場合、プライベートのディスパッチテーブルを持つ
pickler を作成することができます。

*note copyreg: 2a. モジュールによって管理されるグローバルなディスパッチ
テーブルは ‘copyreg.dispatch_table’ として利用可能です。したがって、
‘copyreg.dispatch_table’ の修正済のコピーをプライベートのディスパッチテ
ーブルとして使用することを選択できます。

例えば

     f = io.BytesIO()
     p = pickle.Pickler(f)
     p.dispatch_table = copyreg.dispatch_table.copy()
     p.dispatch_table[SomeClass] = reduce_SomeClass

これは ‘SomeClass’ クラスを特別に扱うプライベートのディスパッチテーブル
を持つ *note pickle.Pickler: c13. のインスタンスを作成します。あるいは、
次のコード

     class MyPickler(pickle.Pickler):
         dispatch_table = copyreg.dispatch_table.copy()
         dispatch_table[SomeClass] = reduce_SomeClass
     f = io.BytesIO()
     p = MyPickler(f)

does the same but all instances of ‘MyPickler’ will by default share the
private dispatch table.  On the other hand, the code

     copyreg.pickle(SomeClass, reduce_SomeClass)
     f = io.BytesIO()
     p = pickle.Pickler(f)

modifies the global dispatch table shared by all users of the *note
copyreg: 2a. module.


File: python.info,  Node: 状態を持つオブジェクトの扱い,  Prev: ディスパッチテーブル,  Up: クラスインスタンスの pickle 化

5.12.1.10 状態を持つオブジェクトの扱い
......................................

Here's an example that shows how to modify pickling behavior for a
class.  The ‘TextReader’ class below opens a text file, and returns the
line number and line contents each time its ‘readline()’ method is
called.  If a ‘TextReader’ instance is pickled, all attributes 'except'
the file object member are saved.  When the instance is unpickled, the
file is reopened, and reading resumes from the last location.  The
‘__setstate__()’ and ‘__getstate__()’ methods are used to implement this
behavior.

     class TextReader:
         """Print and number lines in a text file."""

         def __init__(self, filename):
             self.filename = filename
             self.file = open(filename)
             self.lineno = 0

         def readline(self):
             self.lineno += 1
             line = self.file.readline()
             if not line:
                 return None
             if line.endswith('\n'):
                 line = line[:-1]
             return "%i: %s" % (self.lineno, line)

         def __getstate__(self):
             # Copy the object's state from self.__dict__ which contains
             # all our instance attributes. Always use the dict.copy()
             # method to avoid modifying the original state.
             state = self.__dict__.copy()
             # Remove the unpicklable entries.
             del state['file']
             return state

         def __setstate__(self, state):
             # Restore instance attributes (i.e., filename and lineno).
             self.__dict__.update(state)
             # Restore the previously opened file's state. To do so, we need to
             # reopen it and read from it until the line count is restored.
             file = open(self.filename)
             for _ in range(self.lineno):
                 file.readline()
             # Finally, save the file.
             self.file = file

使用例は以下のようになるでしょう:

     >>> reader = TextReader("hello.txt")
     >>> reader.readline()
     '1: Hello world!'
     >>> reader.readline()
     '2: I am line number two.'
     >>> new_reader = pickle.loads(pickle.dumps(reader))
     >>> new_reader.readline()
     '3: Goodbye!'


File: python.info,  Node: 型、関数、その他のオブジェクトに対するリダクションのカスタマイズ,  Next: アウトオブバウンドバッファ,  Prev: クラスインスタンスの pickle 化,  Up: pickle --- Python オブジェクトの直列化

5.12.1.11 型、関数、その他のオブジェクトに対するリダクションのカスタマイズ
..........................................................................

Added in version 3.8.

*note dispatch_table: 133a. は、ときにその柔軟性が十分でないがことありま
す。特に、オブジェクトの型以外の別の条件で pickle 化をカスタマイズしたい
場合や、関数やクラスを使って pickle 化をカスタマイズしたい場合などです。

そのような場合、 *note Pickler: c13. クラスから派生したサブクラスで
*note reducer_override(): c14. メソッドを実装することができます。このメ
ソッドは任意のリダクション用タプルを返すことができます (*note
__reduce__(): bc6. を参照してください)。もしくは、従来の振る舞いにフォー
ルバックするために *note NotImplemented: 1a2. を返すこともできます。

*note dispatch_table: 133a. と *note reducer_override(): c14. の両方が定
義されている場合、 *note reducer_override(): c14. メソッドが優先されます
。

     注釈: パフォーマンス上の理由により、次に挙げるオブジェクトに対して
     は *note reducer_override(): c14. が呼ばれないことがあります:
     ‘None’, ‘True’, ‘False’, および *note int: 19b, *note float: 196,
     *note bytes: 192, *note str: 169, *note dict: 183, *note set: 184,
     *note frozenset: 7f2, *note list: 24d, *note tuple: 614. の厳密なイ
     ンスタンス。

以下は特定のクラスを pickle 化して再構成する単純な例です:

     import io
     import pickle

     class MyClass:
         my_attribute = 1

     class MyPickler(pickle.Pickler):
         def reducer_override(self, obj):
             """Custom reducer for MyClass."""
             if getattr(obj, "__name__", None) == "MyClass":
                 return type, (obj.__name__, obj.__bases__,
                               {'my_attribute': obj.my_attribute})
             else:
                 # For any other object, fallback to usual reduction
                 return NotImplemented

     f = io.BytesIO()
     p = MyPickler(f)
     p.dump(MyClass)

     del MyClass

     unpickled_class = pickle.loads(f.getvalue())

     assert isinstance(unpickled_class, type)
     assert unpickled_class.__name__ == "MyClass"
     assert unpickled_class.my_attribute == 1


File: python.info,  Node: アウトオブバウンドバッファ,  Next: グローバル変数を制限する,  Prev: 型、関数、その他のオブジェクトに対するリダクションのカスタマイズ,  Up: pickle --- Python オブジェクトの直列化

5.12.1.12 アウトオブバウンドバッファ
....................................

Added in version 3.8.

In some contexts, the ‘pickle’ module is used to transfer massive
amounts of data.  Therefore, it can be important to minimize the number
of memory copies, to preserve performance and resource consumption.
However, normal operation of the ‘pickle’ module, as it transforms a
graph-like structure of objects into a sequential stream of bytes,
intrinsically involves copying data to and from the pickle stream.

この制約は、生産者 'provider' (変換されるオブジェクトの型の実装) と消費
者 'consumer' (通信システムの実装) が pickle プロトコル5以上で提供される
アウトオブバウンドのデータ転送機能をサポートしていれば回避できます。

* Menu:

* 生産者 API::
* 消費者 API::
* 使用例: 使用例<10>.


File: python.info,  Node: 生産者 API,  Next: 消費者 API,  Up: アウトオブバウンドバッファ

5.12.1.13 生産者 API
....................

pickle 化される大きなサイズのデータオブジェクトは、プロトコル5以上でサポ
ートされた *note __reduce_ex__(): 196b. メソッドを実装しなければなりませ
ん。このメソッドは大きなデータに対して (*note bytes: 192. オブジェクトな
どの代わりに) *note PickleBuffer: 177b. インスタンスを返します。

A *note PickleBuffer: 177b. object 'signals' that the underlying buffer
is eligible for out-of-band data transfer.  Those objects remain
compatible with normal usage of the ‘pickle’ module.  However, consumers
can also opt-in to tell ‘pickle’ that they will handle those buffers by
themselves.


File: python.info,  Node: 消費者 API,  Next: 使用例<10>,  Prev: 生産者 API,  Up: アウトオブバウンドバッファ

5.12.1.14 消費者 API
....................

通信システムは、オブジェクトグラフを直列化するときに生成された *note
PickleBuffer: 177b. オブジェクトのカスタマイズされた処理を有効化すること
ができます。

送信側は 'buffer_callback' 引数を *note Pickler: c13. (または *note
dump(): 2d0c. や *note dumps(): 16bd. 関数) に渡す必要があります。この関
数はオブジェクトグラフを pickle 化するときに生成されるそれぞれの *note
PickleBuffer: 177b. を引数として呼ばれます。 'buffer_callback' によって
蓄積されたバッファは、それが保持するデータのコピーを pickle ストリームに
送らず、軽量なマーカーが挿入されるだけです。

受信側は 'buffers' 引数を *note Unpickler: 1777. (または *note load():
f0c. や *note loads(): f0d. 関数) に渡す必要があります。これは
'buffer_callback' に渡されたバッファのイテラブルです。このイテラブルは
'buffer_callback' に渡されたのと同じ順番でバッファを返さなければなりませ
ん。これらのバッファは、pickle 化処理によって *note PickleBuffer: 177b.
オブジェクトを生成したオブジェクトの再構築処理で期待されるデータを提供し
ます。

送信側と受信側の間で、通信システムはアウトオブバウンドバッファの独自の転
送メカニズムを自由に実装することができます。見込みのある最適化としては、
共有メモリの利用や、データタイプ依存のデータ圧縮などが考えられます。


File: python.info,  Node: 使用例<10>,  Prev: 消費者 API,  Up: アウトオブバウンドバッファ

5.12.1.15 使用例
................

以下は、アウトオブバウンドのバッファを使った pickle 処理に関与することが
できるサブクラス *note bytearray: 344. を実装したささいな例です:

     class ZeroCopyByteArray(bytearray):

         def __reduce_ex__(self, protocol):
             if protocol >= 5:
                 return type(self)._reconstruct, (PickleBuffer(self),), None
             else:
                 # PickleBuffer is forbidden with pickle protocols <= 4.
                 return type(self)._reconstruct, (bytearray(self),)

         @classmethod
         def _reconstruct(cls, obj):
             with memoryview(obj) as m:
                 # Get a handle over the original buffer object
                 obj = m.obj
                 if type(obj) is cls:
                     # Original buffer object is a ZeroCopyByteArray, return it
                     # as-is.
                     return obj
                 else:
                     return cls(obj)

再構成関数 (‘_reconstruct’ クラスメソッド) は、受け取ったバッファが持っ
ているオブジェクトを、それが正しい型であれば、そのまま返します。これは、
このおもちゃのような例において、ゼロコピーの挙動を模擬的に行う簡単な方法
です。

消費者側では、これらのオブジェクトを通常の方法で pickle 化することができ
ます。この場合非直列化処理は元のオブジェクトのコピーを返します:

     b = ZeroCopyByteArray(b"abc")
     data = pickle.dumps(b, protocol=5)
     new_b = pickle.loads(data)
     print(b == new_b)  # True
     print(b is new_b)  # False: a copy was made

いっぽう直列化において 'buffer_callback' を設定し、非直列化において蓄積
されたバッファを渡した場合、コピーではなく元のオブジェクトを得ることがで
きます:

     b = ZeroCopyByteArray(b"abc")
     buffers = []
     data = pickle.dumps(b, protocol=5, buffer_callback=buffers.append)
     new_b = pickle.loads(data, buffers=buffers)
     print(b == new_b)  # True
     print(b is new_b)  # True: no copy was made

この例では *note bytearray: 344. がそれ自身メモリを割り当てるという性質
による制限があります: すなわち、他のオブジェクトのメモリを参照する *note
bytearray: 344. を生成することはできません。しかし、 NumPy 配列のような
サードパーティのデータ型ではそのような制限はなく、異なるプロセス間または
異なるシステム間で、ゼロコピー (または最小限のコピー) でのpickle 処理の
利用が可能です。

参考
....

PEP 574(1) - Pickle プロトコルバージョン 5 による帯域外データ

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0574/


File: python.info,  Node: グローバル変数を制限する,  Next: 性能<2>,  Prev: アウトオブバウンドバッファ,  Up: pickle --- Python オブジェクトの直列化

5.12.1.16 グローバル変数を制限する
..................................

デフォルトで、非 pickle 化は pickle データ内で見つけたあらゆるクラスや関
数をインポートします。多くのアプリケーションでは、この振る舞いは受け入れ
られません。なぜなら、それによって unpickler が任意のコードをインポート
して実行することが可能になるからです。この手の巧妙に作られた pickle デー
タストリームがロードされたときに何を行うかをちょっと考えてみてください:

     >>> import pickle
     >>> pickle.loads(b"cos\nsystem\n(S'echo hello world'\ntR.")
     hello world
     0

この例において、unpickler は *note os.system(): 1676. 関数をインポートし
て、次に文字列の引数 "echo hello world" を適用しています。この例は無害で
すが、システムを破壊する例を想像するのは難しくありません。

この理由のため、*note Unpickler.find_class(): 2d19. をカスタマイズするこ
とで非 pickle 化で何を得るかを制御したくなるかもしれません。その名前が示
唆するのと異なり、*note Unpickler.find_class(): 2d19. はグローバル (クラ
スや関数) が必要とした時にはいつでも呼びだされます。したがって、グローバ
ルを完全に禁止することも安全なサブセットに制限することも可能です。

これは、一部の安全なクラスについてのみ *note builtins: 13. モジュールか
らロードすることを許可する unpickler の例です:

     import builtins
     import io
     import pickle

     safe_builtins = {
         'range',
         'complex',
         'set',
         'frozenset',
         'slice',
     }

     class RestrictedUnpickler(pickle.Unpickler):

         def find_class(self, module, name):
             # Only allow safe classes from builtins.
             if module == "builtins" and name in safe_builtins:
                 return getattr(builtins, name)
             # Forbid everything else.
             raise pickle.UnpicklingError("global '%s.%s' is forbidden" %
                                          (module, name))

     def restricted_loads(s):
         """Helper function analogous to pickle.loads()."""
         return RestrictedUnpickler(io.BytesIO(s)).load()

この unpickler が働く使用例は次のように意図されます:

     >>> restricted_loads(pickle.dumps([1, 2, range(15)]))
     [1, 2, range(0, 15)]
     >>> restricted_loads(b"cos\nsystem\n(S'echo hello world'\ntR.")
     Traceback (most recent call last):
       ...
     pickle.UnpicklingError: global 'os.system' is forbidden
     >>> restricted_loads(b'cbuiltins\neval\n'
     ...                  b'(S\'getattr(__import__("os"), "system")'
     ...                  b'("echo hello world")\'\ntR.')
     Traceback (most recent call last):
       ...
     pickle.UnpicklingError: global 'builtins.eval' is forbidden

この例が示すように、非 pickle 化を認めるものに注意しなければなりません。
したがって、セキュリティが重要な場合は *note xmlrpc.client: 134. の
marshal API や、サードパーティのソリューションのような別の選択肢を考慮し
た方がよいでしょう。


File: python.info,  Node: 性能<2>,  Next: 使用例<11>,  Prev: グローバル変数を制限する,  Up: pickle --- Python オブジェクトの直列化

5.12.1.17 性能
..............

Recent versions of the pickle protocol (from protocol 2 and upwards)
feature efficient binary encodings for several common features and
built-in types.  Also, the ‘pickle’ module has a transparent optimizer
written in C.


File: python.info,  Node: 使用例<11>,  Next: コマンドライン・インターフェース,  Prev: 性能<2>,  Up: pickle --- Python オブジェクトの直列化

5.12.1.18 使用例
................

最も単純なコードでは、*note dump(): 2d0c. および *note load(): f0c. 関数
を使用してください。

     import pickle

     # An arbitrary collection of objects supported by pickle.
     data = {
         'a': [1, 2.0, 3+4j],
         'b': ("character string", b"byte string"),
         'c': {None, True, False}
     }

     with open('data.pickle', 'wb') as f:
         # Pickle the 'data' dictionary using the highest protocol available.
         pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)

次の例は、pickle 化されたデータを読み込みます。

     import pickle

     with open('data.pickle', 'rb') as f:
         # The protocol version used is detected automatically, so we do not
         # have to specify it.
         data = pickle.load(f)


File: python.info,  Node: コマンドライン・インターフェース,  Prev: 使用例<11>,  Up: pickle --- Python オブジェクトの直列化

5.12.1.19 コマンドライン・インターフェース
..........................................

The ‘pickle’ module can be invoked as a script from the command line, it
will display contents of the pickle files.  However, when the pickle
file that you want to examine comes from an untrusted source, ‘-m
pickletools’ is a safer option because it does not execute pickle
bytecode, see *note pickletools CLI usage: 2d2f.

     python -m pickle pickle_file [pickle_file ...]

The following option is accepted:

 -- Option: pickle_file

     A pickle file to read, or ‘-’ to indicate reading from standard
     input.

参考
....

*note copyreg: 2a. モジュール

     拡張型を登録するための Pickle インターフェース構成機構。

*note pickletools: ac. モジュール

     pickle データの処理や分析を行うためのツール。

*note shelve: c8. モジュール

     Indexed databases of objects; uses ‘pickle’.

*note copy: 29. モジュール

     オブジェクトの浅いコピーおよび深いコピー。

*note marshal: 91. モジュール

     組み込み型の高性能な直列化。

脚注
....


File: python.info,  Node: copyreg --- pickle サポート関数を登録する,  Next: shelve --- Python オブジェクトの永続化,  Prev: pickle --- Python オブジェクトの直列化,  Up: データの永続化

5.12.2 ‘copyreg’ -- ‘pickle’ サポート関数を登録する
---------------------------------------------------

'ソースコード:' Lib/copyreg.py(1)

__________________________________________________________________

The ‘copyreg’ module offers a way to define functions used while
pickling specific objects.  The *note pickle: ab. and *note copy: 29.
modules use those functions when pickling/copying those objects.  The
module provides configuration information about object constructors
which are not classes.  Such constructors may be factory functions or
class instances.

 -- の関数: copyreg.constructor (object)

     'object' を有効なコンストラクタであると宣言します。 'object' が呼び
     出し可能でなければ(したがってコンストラクタとして有効でなければ)、
     *note TypeError: 198. を発生します。

 -- の関数: copyreg.pickle (type, function, constructor_ob=None)

     'function' が型 'type' のオブジェクトに対する"リダクション"関数とし
     て使われるように宣言します。 'function' は文字列か、2要素から6要素
     を含んだタプルを返さなければなりません。 'function' のインターフェ
     ースについての詳細は *note dispatch_table: 133a. を参照してください
     。

     'constructor_ob' は古い機能で、現在は無視されますが、値を渡す場合は
     呼び出し可能 (callable) でなければなりません。

     pickler オブジェクトまたは *note pickle.Pickler: c13. のサブクラス
     の *note dispatch_table: 133a. 属性を、リダクション関数の宣言のため
     に使うこともできるということは覚えておいてください。

* Menu:

* 使用例: 使用例<12>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/copyreg.py


File: python.info,  Node: 使用例<12>,  Up: copyreg --- pickle サポート関数を登録する

5.12.2.1 使用例
...............

下記の例は、pickle 関数を登録する方法と、それがどのように使用されるかを
示そうとしています:

     >>> import copyreg, copy, pickle
     >>> class C:
     ...     def __init__(self, a):
     ...         self.a = a
     ...
     >>> def pickle_c(c):
     ...     print("pickling a C instance...")
     ...     return C, (c.a,)
     ...
     >>> copyreg.pickle(C, pickle_c)
     >>> c = C(1)
     >>> d = copy.copy(c)
     pickling a C instance...
     >>> p = pickle.dumps(c)
     pickling a C instance...


File: python.info,  Node: shelve --- Python オブジェクトの永続化,  Next: marshal --- 内部使用向けの Python オブジェクト直列化,  Prev: copyreg --- pickle サポート関数を登録する,  Up: データの永続化

5.12.3 ‘shelve’ -- Python オブジェクトの永続化
----------------------------------------------

'ソースコード:' Lib/shelve.py(1)

__________________________________________________________________

"シェルフ (shelf, 棚)" は辞書に似た永続性を持つオブジェクトです。 "dbm"
データベースとの違いは、シェルフの値 (キーではありません！) は実質上どん
な Python オブジェクトにも -- *note pickle: ab. モジュールが扱えるなら何
でも -- できるということです。これにはほとんどのクラスインスタンス、再帰
的なデータ型、沢山の共有されたサブオブジェクトを含むオブジェクトが含まれ
ます。キーは通常の文字列です。

 -- の関数: shelve.open (filename, flag='c', protocol=None,
          writeback=False)

     永続的な辞書を開きます。指定された 'filename' は、根底にあるデータ
     ベースの基本ファイル名となります。副作用として、 'filename' には拡
     張子がつけられる場合があり、ひとつ以上のファイルが生成される可能性
     もあります。デフォルトでは、根底にあるデータベースファイルは読み書
     き可能なように開かれます。オプションの 'flag' パラメータは *note
     dbm.open(): 112d. における 'flag' パラメータと同様に解釈されます。

     By default, pickles created with *note pickle.DEFAULT_PROTOCOL:
     a2f. are used to serialize values.  The version of the pickle
     protocol can be specified with the 'protocol' parameter.

     Python の意味論により、シェルフには永続的な辞書の可変エントリがいつ
     変更されたかを知る術がありません。 デフォルトでは、変更されたオブジ
     ェクトはシェルフに代入されたとき 'だけ' 書き込まれます (*note
     使用例: 2d39. 参照)。 オプションの 'writeback' パラメータが ‘True’
     に設定されている場合は、アクセスされたすべてのエントリはメモリ上に
     キャッシュされ、 *note sync(): 2d3a. および *note close(): 2d3b. を
     呼び出した際に書き戻されます; この機能は永続的な辞書上の可変の要素
     に対する変更を容易にしますが、多数のエントリがアクセスされた場合、
     膨大な量のメモリがキャッシュのために消費され、アクセスされた全ての
     エントリを書き戻す (アクセスされたエントリが可変であるか、あるいは
     実際に変更されたかを決定する方法は存在しないのです) ために、ファイ
     ルを閉じる操作が非常に低速になります。

     バージョン 3.10 で変更: *note pickle.DEFAULT_PROTOCOL: a2f. is now
     used as the default pickle protocol.

     バージョン 3.11 で変更: Accepts *note path-like object: 5a1. for
     filename.

          注釈: シェルフが自動的に閉じることに依存しないでください; それ
          がもう必要ない場合は常に *note close(): 2d3b. を明示的に呼ぶか
          、 *note shelve.open(): 1a71. をコンテキストマネージャとして使
          用してください:

               with shelve.open('spam') as db:
                   db['eggs'] = 'eggs'
     警告: Because the ‘shelve’ module is backed by *note pickle: ab, it
     is insecure to load a shelf from an untrusted source.  Like with
     pickle, loading a shelf can execute arbitrary code.

Shelf objects support most of the methods and operations supported by
dictionaries (except copying, constructors and operators ‘|’ and ‘|=’).
This eases the transition from dictionary based scripts to those
requiring persistent storage.

追加でサポートされるメソッドが二つあります:

 -- メソッド: Shelf.sync ()

     シェルフが 'writeback' を *note True: e07. にセットして開かれている
     場合に、キャッシュ中の全てのエントリを書き戻します。また可能な場合
     は、キャッシュを空にしてディスク上の永続的な辞書を同期します。この
     メソッドはシェルフを *note close(): 2d3b. によって閉じるとき自動的
     に呼び出されます。

 -- メソッド: Shelf.close ()

     永続的な '辞書' オブジェクトを同期して閉じます。既に閉じられている
     シェルフに対して呼び出すと *note ValueError: 2ec. を出し失敗します
     。

参考
....

Persistent dictionary recipe(2) with widely supported storage formats
and having the speed of native dictionaries.

* Menu:

* 制限事項::
* 使用例: 使用例<13>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/shelve.py

   (2) 
https://code.activestate.com/recipes/576642-persistent-dict-with-multiple-standard-file-format/


File: python.info,  Node: 制限事項,  Next: 使用例<13>,  Up: shelve --- Python オブジェクトの永続化

5.12.3.1 制限事項
.................

   * どのデータベースパッケージが使われるか (例えば *note dbm.ndbm: 38.
     、 *note dbm.gnu: 37.) は、どのインターフェースが利用可能かに依存し
     ます。従って、データベースを *note dbm: 35. を使って直接開く方法は
     安全ではありません。データベースはまた、 *note dbm: 35. が使われた
     場合 (不幸なことに) その制約に縛られます -- これはデータベースに記
     録されたオブジェクト (の pickle 化された表現) はかなり小さくなけれ
     ばならず、キー衝突が生じた場合に、稀にデータベースを更新することが
     できなくなることを意味します。

   * The ‘shelve’ module does not support 'concurrent' read/write access
     to shelved objects.  (Multiple simultaneous read accesses are
     safe.)  When a program has a shelf open for writing, no other
     program should have it open for reading or writing.  Unix file
     locking can be used to solve this, but this differs across Unix
     versions and requires knowledge about the database implementation
     used.

   * On macOS *note dbm.ndbm: 38. can silently corrupt the database file
     on updates, which can cause hard crashes when trying to read from
     the database.

 -- クラス: shelve.Shelf (dict, protocol=None, writeback=False,
          keyencoding='utf-8')

     *note collections.abc.MutableMapping: 12c0. のサブクラスで、 'dict'
     オブジェクト内にpickle化された値を保持します。

     By default, pickles created with *note pickle.DEFAULT_PROTOCOL:
     a2f. are used to serialize values.  The version of the pickle
     protocol can be specified with the 'protocol' parameter.  See the
     *note pickle: ab. documentation for a discussion of the pickle
     protocols.

     'writeback' パラメータが ‘True’ に設定されていれば、アクセスされた
     すべてのエントリはメモリ上にキャッシュされ、ファイルを閉じる際に
     'dict' に書き戻されます; この機能により、可変のエントリに対して自然
     な操作が可能になりますが、さらに多くのメモリを消費し、辞書をファイ
     ルと同期して閉じる際に長い時間がかかるようになります。

     'keyencoding' パラメータは、shelf の背後にある dict に対して使われ
     る前にキーをエンコードするのに使用されるエンコーディングです。

     *note Shelf: 119d. オブジェクトは、コンテキストマネージャとしても使
     用できます。この場合、 *note with: 186. ブロックが終了する際に、自
     動的に閉じられます。

     バージョン 3.2 で変更: 'keyencoding' パラメータを追加; 以前はキーは
     常に UTF-8 でエンコードされていました。

     バージョン 3.4 で変更: コンテキストマネージャーサポートが追加されま
     した。

     バージョン 3.10 で変更: *note pickle.DEFAULT_PROTOCOL: a2f. is now
     used as the default pickle protocol.

 -- クラス: shelve.BsdDbShelf (dict, protocol=None, writeback=False,
          keyencoding='utf-8')

     A subclass of *note Shelf: 119d. which exposes ‘first()’, ‘next()’,
     ‘previous()’, ‘last()’ and ‘set_location()’ methods.  These are
     available in the third-party ‘bsddb’ module from pybsddb(1) but not
     in other database modules.  The 'dict' object passed to the
     constructor must support those methods.  This is generally
     accomplished by calling one of ‘bsddb.hashopen()’, ‘bsddb.btopen()’
     or ‘bsddb.rnopen()’.  The optional 'protocol', 'writeback', and
     'keyencoding' parameters have the same interpretation as for the
     *note Shelf: 119d. class.

 -- クラス: shelve.DbfilenameShelf (filename, flag='c', protocol=None,
          writeback=False)

     *note Shelf: 119d. のサブクラスで、辞書に似たオブジェクトの代わりに
     'filename' を受理します。根底にあるファイルは *note dbm.open():
     112d. を使って開かれます。デフォルトでは、ファイルは読み書き可能な
     状態で開かれます。オプションの 'flag' パラメータは *note open():
     1a71. 関数におけるパラメータと同様に解釈されます。オプションの
     'protocol' および 'writeback' パラメータは *note Shelf: 119d. クラ
     スにおけるパラメータと同様に解釈されます。

   ---------- Footnotes ----------

   (1) https://www.jcea.es/programacion/pybsddb.htm


File: python.info,  Node: 使用例<13>,  Prev: 制限事項,  Up: shelve --- Python オブジェクトの永続化

5.12.3.2 使用例
...............

インターフェースは以下のコードに集約されています (‘key’ は文字列で、
‘data’ は任意のオブジェクトです):

     import shelve

     d = shelve.open(filename)  # open -- file may get suffix added by low-level
                                # library

     d[key] = data              # store data at key (overwrites old data if
                                # using an existing key)
     data = d[key]              # retrieve a COPY of data at key (raise KeyError
                                # if no such key)
     del d[key]                 # delete data stored at key (raises KeyError
                                # if no such key)

     flag = key in d            # true if the key exists
     klist = list(d.keys())     # a list of all existing keys (slow!)

     # as d was opened WITHOUT writeback=True, beware:
     d['xx'] = [0, 1, 2]        # this works as expected, but...
     d['xx'].append(3)          # *this doesn't!* -- d['xx'] is STILL [0, 1, 2]!

     # having opened d without writeback=True, you need to code carefully:
     temp = d['xx']             # extracts the copy
     temp.append(5)             # mutates the copy
     d['xx'] = temp             # stores the copy right back, to persist it

     # or, d=shelve.open(filename,writeback=True) would let you just code
     # d['xx'].append(5) and have it work as expected, BUT it would also
     # consume more memory and make the d.close() operation slower.

     d.close()                  # close it

参考
....

*note dbm: 35. モジュール

     ‘dbm’ スタイルのデータベースに対する共通インターフェース。

*note pickle: ab. モジュール

     Object serialization used by ‘shelve’.


File: python.info,  Node: marshal --- 内部使用向けの Python オブジェクト直列化,  Next: dbm --- Unix "データベース" へのインターフェース,  Prev: shelve --- Python オブジェクトの永続化,  Up: データの永続化

5.12.4 ‘marshal’ -- 内部使用向けの Python オブジェクト直列化
------------------------------------------------------------

__________________________________________________________________

This module contains functions that can read and write Python values in
a binary format.  The format is specific to Python, but independent of
machine architecture issues (e.g., you can write a Python value to a
file on a PC, transport the file to a Mac, and read it back there).
Details of the format are undocumented on purpose; it may change between
Python versions (although it rarely does).  (1)

This is not a general "persistence" module.  For general persistence and
transfer of Python objects through RPC calls, see the modules *note
pickle: ab. and *note shelve: c8.  The ‘marshal’ module exists mainly to
support reading and writing the "pseudo-compiled" code for Python
modules of ‘.pyc’ files.  Therefore, the Python maintainers reserve the
right to modify the marshal format in backward incompatible ways should
the need arise.  The format of code objects is not compatible between
Python versions, even if the version of the format is the same.
De-serializing a code object in the incorrect Python version has
undefined behavior.  If you're serializing and de-serializing Python
objects, use the *note pickle: ab. module instead - the performance is
comparable, version independence is guaranteed, and pickle supports a
substantially wider range of objects than marshal.

     警告: The ‘marshal’ module is not intended to be secure against
     erroneous or maliciously constructed data.  Never unmarshal data
     received from an untrusted or unauthenticated source.

bytes-like オブジェクトを操作する関数と同様に、ファイルの読み書きを行う
関数が提供されています。

Not all Python object types are supported; in general, only objects
whose value is independent from a particular invocation of Python can be
written and read by this module.  The following types are supported:

   * Numeric types: *note int: 19b, *note bool: 3c3, *note float: 196,
     *note complex: 197.

   * Strings (*note str: 169.) and *note bytes: 192.  *note Bytes-like
     objects: 193. like *note bytearray: 344. are marshalled as ‘bytes’.

   * Containers: *note tuple: 614, *note list: 24d, *note set: 184,
     *note frozenset: 7f2, and (since *note version: 2d42. 5), *note
     slice: 694.  It should be understood that these are supported only
     if the values contained therein are themselves supported.
     Recursive containers are supported since *note version: 2d42. 3.

   * The singletons *note None: 885, *note Ellipsis: 2328. and *note
     StopIteration: df5.

   * *note code: 1b. objects, if 'allow_code' is true.  See note above
     about version dependence.

バージョン 3.4 で変更:

   * Added format version 3, which supports marshalling recursive lists,
     sets and dictionaries.

   * Added format version 4, which supports efficient representations of
     short strings.

バージョン 3.14 で変更: Added format version 5, which allows marshalling
slices.

このモジュールでは、以下の関数が定義されています。

 -- の関数: marshal.dump (value, file, version=version, /, *,
          allow_code=True)

     開かれたファイルに値を書き込みます。値はサポートされている型でなく
     てはなりません。file は書き込み可能な *note バイナリファイル: 206e.
     である必要があります。

     If the value has (or contains an object that has) an unsupported
     type, a *note ValueError: 2ec. exception is raised -- but garbage
     data will also be written to the file.  The object will not be
     properly read back by *note load(): 1df6.  *note Code objects: 4e6.
     are only supported if 'allow_code' is true.

     'version' 引数は ‘dump’ が使用するデータフォーマットを指定します (下
     記を参照してください)。

     引数 ‘value’, ‘version’ を指定して *note 監査イベント: 1c6e.
     ‘marshal.dumps’ を送出します。

     バージョン 3.13 で変更: Added the 'allow_code' parameter.

 -- の関数: marshal.load (file, /, *, allow_code=True)

     Read one value from the open file and return it.  If no valid value
     is read (e.g.  because the data has a different Python version's
     incompatible marshal format), raise *note EOFError: 14f1, *note
     ValueError: 2ec. or *note TypeError: 198.  *note Code objects: 4e6.
     are only supported if 'allow_code' is true.  The file must be a
     readable *note binary file: 206e.

     引数無しで *note 監査イベント: 1c6e. ‘marshal.load’ を送出します。

          注釈: サポートされていない型を含むオブジェクトが *note dump():
          2d43. で整列化されている場合、 *note load(): 1df6. は整列化不
          能な値を ‘None’ で置き換えます。

     バージョン 3.10 で変更: This call used to raise a ‘code.__new__’
     audit event for each code object.  Now it raises a single
     ‘marshal.load’ event for the entire load operation.

     バージョン 3.13 で変更: Added the 'allow_code' parameter.

 -- の関数: marshal.dumps (value, version=version, /, *,
          allow_code=True)

     Return the bytes object that would be written to a file by
     ‘dump(value, file)’.  The value must be a supported type.  Raise a
     *note ValueError: 2ec. exception if value has (or contains an
     object that has) an unsupported type.  *note Code objects: 4e6. are
     only supported if 'allow_code' is true.

     'version' 引数は ‘dumps’ が使用するデータフォーマットを指定します
     (下記を参照してください)。

     引数 ‘value’, ‘version’ を指定して *note 監査イベント: 1c6e.
     ‘marshal.dumps’ を送出します。

     バージョン 3.13 で変更: Added the 'allow_code' parameter.

 -- の関数: marshal.loads (bytes, /, *, allow_code=True)

     Convert the *note bytes-like object: 193. to a value.  If no valid
     value is found, raise *note EOFError: 14f1, *note ValueError: 2ec.
     or *note TypeError: 198.  *note Code objects: 4e6. are only
     supported if 'allow_code' is true.  Extra bytes in the input are
     ignored.

     引数 ‘bytes’ を指定して *note 監査イベント: 1c6e. ‘marshal.loads’ を
     送出します。

     バージョン 3.10 で変更: This call used to raise a ‘code.__new__’
     audit event for each code object.  Now it raises a single
     ‘marshal.loads’ event for the entire load operation.

     バージョン 3.13 で変更: Added the 'allow_code' parameter.

これに加えて、以下の定数が定義されています:

 -- データ: marshal.version

     Indicates the format that the module uses.  Version 0 is the
     historical first version; subsequent versions add new features.
     Generally, a new version becomes the default when it is introduced.

     Version     Available since     新しい機能
                                     
     -----------------------------------------------------------------------------------------
                                     
     1           Python 2.4          Sharing interned strings
                                     
                                     
     2           Python 2.5          Binary representation of floats
                                     
                                     
     3           Python 3.4          Support for object instancing and recursion
                                     
                                     
     4           Python 3.4          Efficient representation of short strings
                                     
                                     
     5           Python 3.14         Support for *note slice: 694. objects
                                     

脚注
....

   ---------- Footnotes ----------

   (1) このモジュールの名前は (特に) Modula-3 の設計者の間で使われていた
用語の一つに由来しています。彼らはデータを自己充足的な形式で輸送する操作
に "整列化 (marshalling)" という用語を使いました。厳密に言えば、"整列さ
せる (to marshal)" とは、あるデータを (例えば RPC バッファのように) 内部
表現形式から外部表現形式に変換することを意味し、"非整列化
(unmarshalling)" とはその逆を意味します。


File: python.info,  Node: dbm --- Unix "データベース" へのインターフェース,  Next: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース,  Prev: marshal --- 内部使用向けの Python オブジェクト直列化,  Up: データの永続化

5.12.5 ‘dbm’ -- Unix "データベース" へのインターフェース
--------------------------------------------------------

'ソースコード:' Lib/dbm/__init__.py(1)

__________________________________________________________________

‘dbm’ is a generic interface to variants of the DBM database:

   * *note dbm.sqlite3: 39.

   * *note dbm.gnu: 37.

   * *note dbm.ndbm: 38.

If none of these modules are installed, the slow-but-simple
implementation in module *note dbm.dumb: 36. will be used.  There is a
third party interface(2) to the Oracle Berkeley DB.

 -- 例外: dbm.error

     サポートされているモジュールそれぞれによって送出される可能性のある
     例外を含むタプル。これにはユニークな例外があり、最初の要素として同
     じく *note dbm.error: 2d48. という名前の例外が含まれます -- *note
     dbm.error: 2d48. が送出される場合、後者(訳注:タプルの ‘dbm.error’ で
     はなく例外 *note dbm.error: 2d48.)が使用されます。

 -- の関数: dbm.whichdb (filename)

     This function attempts to guess which of the several simple
     database modules available -- *note dbm.sqlite3: 39, *note dbm.gnu:
     37, *note dbm.ndbm: 38, or *note dbm.dumb: 36. -- should be used to
     open a given file.

     Return one of the following values:

        * ‘None’ if the file can't be opened because it's unreadable or
          doesn't exist

        * the empty string (‘''’) if the file's format can't be guessed

        * a string containing the required module name, such as
          ‘'dbm.ndbm'’ or ‘'dbm.gnu'’

     バージョン 3.11 で変更: 'filename' accepts a *note path-like
     object: 5a1.

 -- の関数: dbm.open (file, flag='r', mode=0o666)

     Open a database and return the corresponding database object.


     パラメータ:

        * ‘file’ (*note path-like object: 5a1.) - The database file to
          open.

          If the database file already exists, the *note whichdb():
          2d49. function is used to determine its type and the
          appropriate module is used; if it does not exist, the first
          submodule listed above that can be imported is used.

        * ‘flag’ (*note str: 169.) -

             * ‘'r'’ (default): Open existing database for reading only.

             * ‘'w'’: Open existing database for reading and writing.

             * ‘'c'’: Open database for reading and writing, creating it
               if it doesn't exist.

             * ‘'n'’: Always create a new, empty database, open for
               reading and writing.

        * ‘mode’ (*note int: 19b.) - The Unix file access mode of the
          file (default: octal ‘0o666’), used only when the database has
          to be created.

     バージョン 3.11 で変更: 'file' accepts a *note path-like object:
     5a1.

The object returned by *note open(): 112d. supports the basic
functionality of mutable *note mappings: 13d3.; keys and their
corresponding values can be stored, retrieved, and deleted, and
iteration, the *note in: 34b. operator and methods ‘keys()’, ‘get()’,
‘setdefault()’ and ‘clear()’ are available.  The ‘keys()’ method returns
a list instead of a view object.  The ‘setdefault()’ method requires two
arguments.

Key and values are always stored as *note bytes: 192.  This means that
when strings are used they are implicitly converted to the default
encoding before being stored.

これらのオブジェクトは、 *note with: 186. 文での使用にも対応しています。
with 文を使用した場合、終了時に自動的に閉じられます。

バージョン 3.2 で変更: ‘get()’ and ‘setdefault()’ methods are now
available for all ‘dbm’ backends.

バージョン 3.4 で変更: Added native support for the context management
protocol to the objects returned by *note open(): 112d.

バージョン 3.8 で変更: Deleting a key from a read-only database raises a
database module specific exception instead of *note KeyError: 5e7.

バージョン 3.13 で変更: ‘clear()’ methods are now available for all
‘dbm’ backends.

以下の例ではホスト名と対応するタイトルをいくつか記録し、データベースの内
容を出力します:

     import dbm

     # Open database, creating it if necessary.
     with dbm.open('cache', 'c') as db:

         # Record some values
         db[b'hello'] = b'there'
         db['www.python.org'] = 'Python Website'
         db['www.cnn.com'] = 'Cable News Network'

         # Note that the keys are considered bytes now.
         assert db[b'www.python.org'] == b'Python Website'
         # Notice how the value is now in bytes.
         assert db['www.cnn.com'] == b'Cable News Network'

         # Often-used methods of the dict interface work too.
         print(db.get('python.org', b'not present'))

         # Storing a non-string key or value will raise an exception (most
         # likely a TypeError).
         db['www.yahoo.com'] = 4

     # db is automatically closed when leaving the with statement.

参考
....

*note shelve: c8. モジュール

     非文字列データを記録する永続化モジュール。

個々のサブモジュールは以降の節で説明されます。

* Menu:

* dbm.sqlite3: dbm sqlite3 --- SQLite backend for dbm. SQLite backend for dbm
* dbm.gnu: dbm gnu --- GNU database manager. GNU database manager
* dbm.ndbm: dbm ndbm --- New Database Manager. New Database Manager
* dbm.dumb: dbm dumb --- Portable DBM implementation. Portable DBM implementation

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/dbm/__init__.py

   (2) https://www.jcea.es/programacion/pybsddb.htm


File: python.info,  Node: dbm sqlite3 --- SQLite backend for dbm,  Next: dbm gnu --- GNU database manager,  Up: dbm --- Unix "データベース" へのインターフェース

5.12.5.1 ‘dbm.sqlite3’ -- SQLite backend for dbm
................................................

Added in version 3.13.

'Source code:' Lib/dbm/sqlite3.py(1)

__________________________________________________________________

This module uses the standard library *note sqlite3: d4. module to
provide an SQLite backend for the ‘dbm’ module.  The files created by
‘dbm.sqlite3’ can thus be opened by *note sqlite3: d4, or any other
SQLite browser, including the SQLite CLI.

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

 -- の関数: dbm.sqlite3.open (filename, /, flag='r', mode=0o666)

     Open an SQLite database.


     パラメータ:

        * ‘filename’ (*note path-like object: 5a1.) - The path to the
          database to be opened.

        * ‘flag’ (*note str: 169.) -

             * ‘'r'’ (default): Open existing database for reading only.

             * ‘'w'’: Open existing database for reading and writing.

             * ‘'c'’: Open database for reading and writing, creating it
               if it doesn't exist.

             * ‘'n'’: Always create a new, empty database, open for
               reading and writing.

        * ‘mode’ - The Unix file access mode of the file (default: octal
          ‘0o666’), used only when the database has to be created.

     The returned database object behaves similar to a mutable *note
     mapping: 13d3, but the ‘keys()’ method returns a list, and the
     ‘setdefault()’ method requires two arguments.  It also supports a
     "closing" context manager via the *note with: 186. keyword.

     次のメソッドを提供しています:

      -- メソッド: sqlite3.close ()

          Close the SQLite database.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/dbm/sqlite3.py


File: python.info,  Node: dbm gnu --- GNU database manager,  Next: dbm ndbm --- New Database Manager,  Prev: dbm sqlite3 --- SQLite backend for dbm,  Up: dbm --- Unix "データベース" へのインターフェース

5.12.5.2 ‘dbm.gnu’ -- GNU database manager
..........................................

'ソースコード:' Lib/dbm/gnu.py(1)

__________________________________________________________________

The ‘dbm.gnu’ module provides an interface to the GDBM (GNU dbm)
library, similar to the *note dbm.ndbm: 38. module, but with additional
functionality like crash tolerance.

     注釈: The file formats created by ‘dbm.gnu’ and *note dbm.ndbm: 38.
     are incompatible and can not be used interchangeably.

*note Availability: 213f.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 225c. と *note
WebAssemblyプラットフォーム: 1b6a. をサポートしません。

*note Availability: 213f.: Unix.

 -- 例外: dbm.gnu.error

     Raised on ‘dbm.gnu’-specific errors, such as I/O errors.  *note
     KeyError: 5e7. is raised for general mapping errors like specifying
     an incorrect key.

 -- データ: dbm.gnu.open_flags

     A string of characters the 'flag' parameter of *note open(): 1e20.
     supports.

 -- の関数: dbm.gnu.open (filename, flag='r', mode=0o666, /)

     Open a GDBM database and return a ‘gdbm’ object.


     パラメータ:

        * ‘filename’ (*note path-like object: 5a1.) - The database file
          to open.

        * ‘flag’ (*note str: 169.) -

             * ‘'r'’ (default): Open existing database for reading only.

             * ‘'w'’: Open existing database for reading and writing.

             * ‘'c'’: Open database for reading and writing, creating it
               if it doesn't exist.

             * ‘'n'’: Always create a new, empty database, open for
               reading and writing.

          The following additional characters may be appended to control
          how the database is opened:

             * ‘'f'’: Open the database in fast mode.  Writes to the
               database will not be synchronized.

             * ‘'s'’: Synchronized mode.  Changes to the database will
               be written immediately to the file.

             * ‘'u'’: Do not lock database.

          Not all flags are valid for all versions of GDBM. See the
          *note open_flags: 2d4e. member for a list of supported flag
          characters.

        * ‘mode’ (*note int: 19b.) - The Unix file access mode of the
          file (default: octal ‘0o666’), used only when the database has
          to be created.


     例外: *note error: c91. - If an invalid 'flag' argument is passed.

     バージョン 3.11 で変更: 'filename' accepts a *note path-like
     object: 5a1.

     ‘gdbm’ objects behave similar to mutable *note mappings: 13d3, but
     methods ‘items()’, ‘values()’, ‘pop()’, ‘popitem()’, and ‘update()’
     are not supported, the ‘keys()’ method returns a list, and the
     ‘setdefault()’ method requires two arguments.  It also supports a
     "closing" context manager via the *note with: 186. keyword.

     バージョン 3.2 で変更: Added the ‘get()’ and ‘setdefault()’
     methods.

     バージョン 3.13 で変更: Added the ‘clear()’ method.

     The following methods are also provided:

      -- メソッド: gdbm.close ()

          Close the GDBM database.

      -- メソッド: gdbm.firstkey ()

          It's possible to loop over every key in the database using
          this method and the *note nextkey(): 2d51. method.  The
          traversal is ordered by GDBM's internal hash values, and won't
          be sorted by the key values.  This method returns the starting
          key.

      -- メソッド: gdbm.nextkey (key)

          データベースの順方向探索において、'key' よりも後に来るキーを返
          します。以下のコードはデータベース ‘db’ について、キー全てを含
          むリストをメモリ上に生成することなく全てのキーを出力します:

               k = db.firstkey()
               while k is not None:
                   print(k)
                   k = db.nextkey(k)

      -- メソッド: gdbm.reorganize ()

          If you have carried out a lot of deletions and would like to
          shrink the space used by the GDBM file, this routine will
          reorganize the database.  ‘gdbm’ objects will not shorten the
          length of a database file except by using this reorganization;
          otherwise, deleted file space will be kept and reused as new
          (key, value) pairs are added.

      -- メソッド: gdbm.sync ()

          データベースが高速モードで開かれていた場合、このメソッドはディ
          スクにまだ書き込まれていないデータを全て書き込ませます。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/dbm/gnu.py


File: python.info,  Node: dbm ndbm --- New Database Manager,  Next: dbm dumb --- Portable DBM implementation,  Prev: dbm gnu --- GNU database manager,  Up: dbm --- Unix "データベース" へのインターフェース

5.12.5.3 ‘dbm.ndbm’ -- New Database Manager
...........................................

'ソースコード:' Lib/dbm/ndbm.py(1)

__________________________________________________________________

The ‘dbm.ndbm’ module provides an interface to the NDBM (New Database
Manager) library.  This module can be used with the "classic" NDBM
interface or the GDBM compatibility interface.

     注釈: The file formats created by *note dbm.gnu: 37. and ‘dbm.ndbm’
     are incompatible and can not be used interchangeably.

     警告: The NDBM library shipped as part of macOS has an undocumented
     limitation on the size of values, which can result in corrupted
     database files when storing values larger than this limit.  Reading
     such corrupted files can result in a hard crash (segmentation
     fault).

*note Availability: 213f.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 225c. と *note
WebAssemblyプラットフォーム: 1b6a. をサポートしません。

*note Availability: 213f.: Unix.

 -- 例外: dbm.ndbm.error

     Raised on ‘dbm.ndbm’-specific errors, such as I/O errors.  *note
     KeyError: 5e7. is raised for general mapping errors like specifying
     an incorrect key.

 -- データ: dbm.ndbm.library

     Name of the NDBM implementation library used.

 -- の関数: dbm.ndbm.open (filename, flag='r', mode=0o666, /)

     Open an NDBM database and return an ‘ndbm’ object.


     パラメータ:

        * ‘filename’ (*note path-like object: 5a1.) - The basename of
          the database file (without the ‘.dir’ or ‘.pag’ extensions).

        * ‘flag’ (*note str: 169.) -

             * ‘'r'’ (default): Open existing database for reading only.

             * ‘'w'’: Open existing database for reading and writing.

             * ‘'c'’: Open database for reading and writing, creating it
               if it doesn't exist.

             * ‘'n'’: Always create a new, empty database, open for
               reading and writing.

        * ‘mode’ (*note int: 19b.) - The Unix file access mode of the
          file (default: octal ‘0o666’), used only when the database has
          to be created.

     バージョン 3.11 で変更: Accepts *note path-like object: 5a1. for
     filename.

     ‘ndbm’ objects behave similar to mutable *note mappings: 13d3, but
     methods ‘items()’, ‘values()’, ‘pop()’, ‘popitem()’, and ‘update()’
     are not supported, the ‘keys()’ method returns a list, and the
     ‘setdefault()’ method requires two arguments.  It also supports a
     "closing" context manager via the *note with: 186. keyword.

     バージョン 3.2 で変更: Added the ‘get()’ and ‘setdefault()’
     methods.

     バージョン 3.13 で変更: Added the ‘clear()’ method.

     次のメソッドを提供しています:

      -- メソッド: ndbm.close ()

          Close the NDBM database.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/dbm/ndbm.py


File: python.info,  Node: dbm dumb --- Portable DBM implementation,  Prev: dbm ndbm --- New Database Manager,  Up: dbm --- Unix "データベース" へのインターフェース

5.12.5.4 ‘dbm.dumb’ -- Portable DBM implementation
..................................................

'ソースコード:' Lib/dbm/dumb.py(1)

     注釈: The ‘dbm.dumb’ module is intended as a last resort fallback
     for the ‘dbm’ module when a more robust module is not available.
     The ‘dbm.dumb’ module is not written for speed and is not nearly as
     heavily used as the other database modules.

__________________________________________________________________

The ‘dbm.dumb’ module provides a persistent *note dict: 183.-like
interface which is written entirely in Python.  Unlike other ‘dbm’
backends, such as *note dbm.gnu: 37, no external library is required.

The ‘dbm.dumb’ module defines the following:

 -- 例外: dbm.dumb.error

     Raised on ‘dbm.dumb’-specific errors, such as I/O errors.  *note
     KeyError: 5e7. is raised for general mapping errors like specifying
     an incorrect key.

 -- の関数: dbm.dumb.open (filename, flag='c', mode=0o666)

     Open a ‘dbm.dumb’ database.


     パラメータ:

        * ‘filename’ - The basename of the database file (without
          extensions).  A new database creates the following files:

             - ‘`filename'.dat’

             - ‘`filename'.dir’

        * ‘flag’ (*note str: 169.) -

             * ‘'r'’: Open existing database for reading only.

             * ‘'w'’: Open existing database for reading and writing.

             * ‘'c'’ (default): Open database for reading and writing,
               creating it if it doesn't exist.

             * ‘'n'’: Always create a new, empty database, open for
               reading and writing.

        * ‘mode’ (*note int: 19b.) - The Unix file access mode of the
          file (default: octal ‘0o666’), used only when the database has
          to be created.

          警告: 十分に大きかったり複雑だったりするエントリーのあるデータ
          ベースを読み込んでいるときに、 Python の抽象構文木コンパイラの
          スタックの深さの限界を越えるせいで、 Python インタプリタをクラ
          ッシュさせることができます。

     バージョン 3.5 で変更: *note open(): c8d. always creates a new
     database when 'flag' is ‘'n'’.

     バージョン 3.8 で変更: A database opened read-only if 'flag' is
     ‘'r'’.  A database is not created if it does not exist if 'flag' is
     ‘'r'’ or ‘'w'’.

     バージョン 3.11 で変更: 'filename' accepts a *note path-like
     object: 5a1.

     The returned database object behaves similar to a mutable *note
     mapping: 13d3, but the ‘keys()’ and ‘items()’ methods return lists,
     and the ‘setdefault()’ method requires two arguments.  It also
     supports a "closing" context manager via the *note with: 186.
     keyword.

     The following methods are also provided:

      -- メソッド: dumbdbm.close ()

          Close the database.

      -- メソッド: dumbdbm.sync ()

          Synchronize the on-disk directory and data files.  This method
          is called by the *note shelve.Shelf.sync(): 2d3a. method.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/dbm/dumb.py


File: python.info,  Node: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース,  Prev: dbm --- Unix "データベース" へのインターフェース,  Up: データの永続化

5.12.6 ‘sqlite3’ -- SQLite データベース用の DB-API 2.0 インターフェース
-----------------------------------------------------------------------

'ソースコード:' Lib/sqlite3/(1)

SQLite は、軽量なディスク上のデータベースを提供する C ライブラリです。別
のサーバプロセスを用意する必要なく、 SQL クエリー言語の非標準的な一種を
使用してデータベースにアクセスできます。一部のアプリケーションは内部デー
タ保存に SQLite を使えます。また、SQLite を使ってアプリケーションのプロ
トタイプを作り、その後そのコードを PostgreSQL や Oracle のような大規模デ
ータベースに移植するということも可能です。

The ‘sqlite3’ module was written by Gerhard Häring.  It provides an SQL
interface compliant with the DB-API 2.0 specification described by PEP
249(2), and requires the third-party SQLite(3) library.

This is an *note optional module: 215a.  If it is missing from your copy
of CPython, look for documentation from your distributor (that is,
whoever provided Python to you).  If you are the distributor, see *note
オプションのモジュールの要件: 2158.

この文書には大きく分けて 4 つの節があります:

   * *note チュートリアル: 2d5e. ‘sqlite3’ モジュールの使い方を学びます
     。

   * *note リファレンス: 2d5f. このモジュールが定義するクラスと関数につ
     いて説明します。

   * *note ハウツー・ガイド: 2d60. 特定のタスクの処理方法について詳しく
     説明します。

   * *note 説明: 2d61. トランザクション制御の背景をより深く掘り下げて説
     明します。

参考
....

‘https://www.sqlite.org’

     SQLite のウェブページ。ここの文書ではサポートされる SQL 方言の文法
     と使えるデータ型を説明しています。

‘https://www.w3schools.com/sql/’

     SQL 学習に効くチュートリアル、リファレンス、実例集。

PEP 249(4) - Database API Specification 2.0

     Marc-Andre Lemburg により書かれた PEP。

* Menu:

* チュートリアル::
* リファレンス::
* ハウツー・ガイド::
* 説明::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/sqlite3/

   (2) https://peps.python.org/pep-0249/

   (3) https://sqlite.org/

   (4) https://peps.python.org/pep-0249/


File: python.info,  Node: チュートリアル,  Next: リファレンス,  Up: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース

5.12.6.1 チュートリアル
.......................

このチュートリアルでは、あなたは基本的な ‘sqlite3’ 機能を使用して、 例と
してモンティ・パイソンの映画のデータベースを作成します。 あなたがカーソ
ル(cursors(1))やトランザクション(transactions(2))を含むデータベースの基
本概念を理解していることを前提としています。

最初に、新しいデータベースを作成し、データベース接続(connection)を開いて
‘sqlite3’ が動作できるようにする必要があります。 *note
sqlite3.connect(): 5a6. を呼び出して、データベース ‘tutorial.db’ への接
続を現在の作業ディレクトリに作成します。存在しない場合は暗黙的に作成しま
す。

     import sqlite3
     con = sqlite3.connect("tutorial.db")

返された *note Connection: 54d. オブジェクト ‘con’ は、ディスク上のデー
タベースへの接続を表します。

SQL 文を実行し、SQL クエリから結果を取得するには、データベース・カーソル
を使用する必要があります。 *note con.cursor(): 2d63. を呼び出して *note
Cursor: 2d64. を作成してください:

     cur = con.cursor()

さて、今やデータベース接続とカーソルを取得したので、タイトル(title)とリ
リース年(year)と、レビュー・スコア(score)の列(columns)を持つデータベース
・テーブル ‘movie’ を作成できます。 簡単にするために、テーブル宣言では列
名だけを使用できます。SQLite の 柔軟な型付け(flexible typing(3))機能のお
かげで、データ型の指定はオプションになっています。 *note
cur.execute(...): 5b0. を呼び出して ‘CREATE TABLE’ 文を実行してください:

     cur.execute("CREATE TABLE movie(title, year, score)")

SQLite に組み込みの ‘sqlite_master’ テーブルに対してクエリを実行すること
で、新しいテーブルが作成されたことを確認できます。このテーブルには、
‘movie’ テーブル定義のエントリが含まれているはずです(詳細は The Schema
Table(4) 参照)。 *note cur.execute(...): 5b0. を呼び出してクエリを実行し
て、その結果を ‘res’ に代入し、結果の行(row)を取得するために *note
res.fetchone(): 2d65. を呼び出します:

     >>> res = cur.execute("SELECT name FROM sqlite_master")
     >>> res.fetchone()
     ('movie',)

We can see that the table has been created, as the query returns a *note
tuple: 614. containing the table's name.  If we query ‘sqlite_master’
for a non-existent table ‘spam’, ‘res.fetchone()’ will return ‘None’:

     >>> res = cur.execute("SELECT name FROM sqlite_master WHERE name='spam'")
     >>> res.fetchone() is None
     True

ここで、 INSERT 文を実行して SQL のリテラルとして提供された 2 行のデータ
を追加し、 再度 *note cur.execute(...): 5b0. を呼び出して追加します:

     cur.execute("""
         INSERT INTO movie VALUES
             ('Monty Python and the Holy Grail', 1975, 8.2),
             ('And Now for Something Completely Different', 1971, 7.5)
     """)

‘INSERT’ 文は、変更がデータベースに保存される前にコミットする必要がある
、トランザクションを暗黙的に開きます(詳細は、 *note
トランザクション制御: 2d66. 参照)。 トランザクションをコミットするために
接続オブジェクト(connection object)の *note con.commit(): 2d67. を呼び出
して下さい:

     con.commit()

‘SELECT’ クエリを実行することで、データが正しく挿入されたことを確認でき
ます。 結果のすべての行を返すには、おなじみの *note cur.execute(...):
5b0. を使用して結果を ‘res’ に代入し、 *note res.fetchall(): 2d68. を呼
び出して下さい:

     >>> res = cur.execute("SELECT score FROM movie")
     >>> res.fetchall()
     [(8.2,), (7.5,)]

結果は、2 つの ‘タプル’ の *note リスト: 24d. で、 それぞれのタプルにそ
の行の ‘score’ 値が含まれています。

ここで、 *note cur.executemany(...): 5b1. を呼び出して、さらに 3 行挿入
します:

     data = [
         ("Monty Python Live at the Hollywood Bowl", 1982, 7.9),
         ("Monty Python's The Meaning of Life", 1983, 7.5),
         ("Monty Python's Life of Brian", 1979, 8.0),
     ]
     cur.executemany("INSERT INTO movie VALUES(?, ?, ?)", data)
     con.commit()  # Remember to commit the transaction after executing INSERT.

‘data’ をクエリに結び付け(bind)するために ‘?’ プレースホルダが使用されて
いることに注意してください。 SQL インジェクション攻撃(SQL injection
attacks(5))を避けるために、Python の値を SQL 文に結び付けするには、常に
*note 文字列フォーマット: 205a. の代わりにプレースホルダを使用してくださ
い(詳細は *note プレースホルダを使用して SQL クエリに値を結び付ける方法:
5b2. 参照)。

‘SELECT’ クエリを実行することで、新しい行が挿入されたことを確認できます
。今回は、クエリの結果を反復処理します:

     >>> for row in cur.execute("SELECT year, title FROM movie ORDER BY year"):
     ...     print(row)
     (1971, 'And Now for Something Completely Different')
     (1975, 'Monty Python and the Holy Grail')
     (1979, "Monty Python's Life of Brian")
     (1982, 'Monty Python Live at the Hollywood Bowl')
     (1983, "Monty Python's The Meaning of Life")

各行(row)は *note タプル: 614. の ‘(year, title)’ の 2 つの項目であり、
クエリで選択された列(columns)にマッチします。

最後に、 *note con.close(): 54e. を呼び出して既存の接続(connection)を閉
じ、新しい接続を開き、新しいカーソルを作成してから、データベースに対して
クエリを実行して、データベースがディスクに書き込まれたことを確認します:

     >>> con.close()
     >>> new_con = sqlite3.connect("tutorial.db")
     >>> new_cur = new_con.cursor()
     >>> res = new_cur.execute("SELECT title, year FROM movie ORDER BY score DESC")
     >>> title, year = res.fetchone()
     >>> print(f'The highest scoring Monty Python movie is {title!r}, released in {year}')
     The highest scoring Monty Python movie is 'Monty Python and the Holy Grail', released in 1975
     >>> new_con.close()

これで、あなたは、 ‘sqlite3’ モジュールを使用して SQLite データベースを
作成し、複数の方法でデータを挿入し、そこから値を取得することができるよう
になりました。

参考
....

   * *note ハウツー・ガイド: 2d60. も参考にしてください:

        * *note プレースホルダを使用して SQL クエリに値を結び付ける方法:
          5b2.

        * *note カスタム Python 型を SQLite 値に適合させる方法: 2d69.

        * *note SQLite 値をカスタム Python 型に変換する方法: 2d6a.

        * *note 接続(connection)コンテキストマネージャの使い方: 1b6c.

        * *note 行工場(row factories)の作成方法と使用方法: 2d6b.

   * *note トランザクション制御: 2d61. トランザクション制御の背景につい
     てより深く掘り下げた説明。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Cursor_(databases)

   (2) https://en.wikipedia.org/wiki/Database_transaction

   (3) https://www.sqlite.org/flextypegood.html

   (4) https://www.sqlite.org/schematab.html

   (5) https://en.wikipedia.org/wiki/SQL_injection


File: python.info,  Node: リファレンス,  Next: ハウツー・ガイド,  Prev: チュートリアル,  Up: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース

5.12.6.2 リファレンス
.....................

* Menu:

* モジュール関数::
* モジュール定数::
* Connection オブジェクト::
* Cursor オブジェクト::
* Row オブジェクト::
* Blob オブジェクト::
* PrepareProtocol オブジェクト::
* 例外: 例外<7>.
* SQLite と Python の型::
* デフォルトの適合関数(adapters)とデフォルトの変換関数(converters)(非推奨): デフォルトの適合関数 adapters とデフォルトの変換関数 converters 非推奨.
* コマンドライン・インターフェース: コマンドライン・インターフェース<2>.


File: python.info,  Node: モジュール関数,  Next: モジュール定数,  Up: リファレンス

5.12.6.3 モジュール関数
.......................

 -- の関数: sqlite3.connect (database, timeout=5.0, detect_types=0,
          isolation_level='DEFERRED', check_same_thread=True,
          factory=sqlite3.Connection, cached_statements=128, uri=False,
          *, autocommit=sqlite3.LEGACY_TRANSACTION_CONTROL)

     SQLite データベースとの接続(connection)を開きます。


     パラメータ:

        * ‘database’ (*note path-like object: 5a1.) - The path to the
          database file to be opened.  You can pass ‘":memory:"’ to
          create an SQLite database existing only in memory(1), and open
          a connection to it.

        * ‘timeout’ (*note float: 196.) - テーブルがロックされている場合
          、 *note OperationalError: 1c52. を送出する前に接続を待機する
          秒数。 別の接続がテーブルを変更するためにトランザクションを開
          くと、そのテーブルはトランザクションがコミットされるまでロック
          されます。 デフォルトは 5 秒です。

        * ‘detect_types’ (*note int: 19b.) - Control whether and how
          data types not *note natively supported by SQLite: 2d70. are
          looked up to be converted to Python types, using the
          converters registered with *note register_converter(): 2d71.
          Set it to any combination (using ‘|’, bitwise or) of *note
          PARSE_DECLTYPES: 2d72. and *note PARSE_COLNAMES: 2d73. to
          enable this.  Column names take precedence over declared types
          if both flags are set.  By default (‘0’), type detection is
          disabled.

        * ‘isolation_level’ (*note str: 169.‘ | ’‘None’) - Control
          legacy transaction handling behaviour.  See *note
          Connection.isolation_level: 2d74. and *note isolation_level
          属性に依るトランザクション制御: 2d75. for more information.
          Can be ‘"DEFERRED"’ (default), ‘"EXCLUSIVE"’ or ‘"IMMEDIATE"’;
          or ‘None’ to disable opening transactions implicitly.  Has no
          effect unless *note Connection.autocommit: 6dd. is set to
          *note LEGACY_TRANSACTION_CONTROL: 2d76. (the default).

        * ‘check_same_thread’ (*note bool: 3c3.) - ‘True’ (これがデフォ
          ルトです)なら、データベース接続を作成したスレッド以外のスレッ
          ドがデータベース接続を使用すると、 *note ProgrammingError:
          305. が送出されます。 ‘False’ なら、接続は複数のスレッドからア
          クセスできます。ただし、データの破損を避けるために、ユーザーに
          よる書き込み操作の直列化が必要になることがあります。詳細は
          *note threadsafety: 88c. を参照してください。

        * ‘factory’ (*note Connection: 54d.) - デフォルトの *note
          Connection: 54d. クラスでない場合に接続(connection)を作成する
          *note Connection: 54d. のカスタム・サブクラスです。

        * ‘cached_statements’ (*note int: 19b.) - ‘sqlite3’ がこの接続
          (connection)のために内部的にキャッシュするSQL文(statements)の
          数で、 パース時のオーバーヘッドを回避します。 デフォルトでは、
          128 文(statements)です。

        * ‘uri’ (*note bool: 3c3.) - ‘True’ に設定すると、 'database' は
          、ファイル・パス(path)とオプションのクエリ文字列を含む URI
          (Uniform Resource Identifier) として解釈されます。 スキームの
          部分は ‘"file:"’ でなければならず、パス(path)は相対パスまたは
          絶対パスにすることができます。 クエリ文字列により、 パラメータ
          ーを SQLite に渡すことができ、さまざまな *note SQLite URI
          の操作方法: 2d77. が有効になります。

        * ‘autocommit’ (*note bool: 3c3.) - Control PEP 249(2)
          transaction handling behaviour.  See *note
          Connection.autocommit: 6dd. and *note autocommit
          属性に依るトランザクション制御: 6de. for more information.
          'autocommit' currently defaults to *note
          LEGACY_TRANSACTION_CONTROL: 2d76.  The default will change to
          ‘False’ in a future Python release.


     戻り値の型: *note Connection: 54d.

     引数 ‘database’ を指定して *note 監査イベント: 1c6e.
     ‘sqlite3.connect’ を送出します。

     引数 ‘connection_handle’ を指定して *note 監査イベント: 1c6e.
     ‘sqlite3.connect/handle’ を送出します。

     バージョン 3.4 で変更: ‘uri’ パラメータが追加されました。

     バージョン 3.7 で変更: 'database' は、文字列だけでなく、 *note
     path-like object: 5a1. にすることもできるようになりました。

     バージョン 3.10 で変更: Added the ‘sqlite3.connect/handle’ auditing
     event.

     バージョン 3.12 で変更: Added the 'autocommit' parameter.

     バージョン 3.13 で変更: Positional use of the parameters 'timeout',
     'detect_types', 'isolation_level', 'check_same_thread', 'factory',
     'cached_statements', and 'uri' is deprecated.  They will become
     keyword-only parameters in Python 3.15.

 -- の関数: sqlite3.complete_statement (statement)

     文字列 'statement' が 1 つ以上の完全な SQL 文を含んでいるように見え
     る場合、 ‘True’ を返します。 閉じられていない文字列リテラルがないこ
     とと、文がセミコロンで終了していることを確認する以外の、構文の検証
     やパースは行われません。

     例えば:

          >>> sqlite3.complete_statement("SELECT foo FROM bar;")
          True
          >>> sqlite3.complete_statement("SELECT foo")
          False

     この関数は、コマンドライン入力時に便利で、入力されたテキストが完全
     な SQL 文を形成しているように見えるかどうか、または *note
     execute(): 5b0. を呼び出す前に追加の入力が必要かどうかを判断するの
     に使えます。

     実際の使用例については、 Lib/sqlite3/__main__.py(3) の
     ‘runsource()’ を参照してください。

 -- の関数: sqlite3.enable_callback_tracebacks (flag, /)

     コールバックのトレースバックを有効または無効にします。 デフォルトで
     は、ユーザー定義関数や集計関数や変換関数や authorizer コールバック
     などではトレースバックを取得しません。それらをデバッグしたい場合は
     、 'flag' を ‘True’ に設定してこの関数を呼び出し。その後、 *note
     sys.stderr: b33. のコールバックからトレースバックを取得します。 機
     能を再び無効にするには ‘False’ を使用します。

          注釈: Errors in user-defined function callbacks are logged as
          unraisable exceptions.  Use an *note unraisable hook handler:
          507. for introspection of the failed callback.

 -- の関数: sqlite3.register_adapter (type, adapter, /)

     'adapter' *note 呼び出し可能オブジェクト: 2d7b. を登録して、 Python
     型の 'type' を SQLite の型に適合させます。適合関数(adapter)アダプタ
     ーは、 Python 型 'type' の Python オブジェクトを唯一の引数として使
     用して呼び出され、 *note SQLite がネイティブに理解する型: 2d70. の
     値を返す必要があります。

 -- の関数: sqlite3.register_converter (typename, converter, /)

     'converter' *note 呼び出し可能オブジェクト: 2d7b. を登録して、
     'typename' 型の SQLite オブジェクトを指定の型の Python オブジェクト
     に変換します。変換関数(converter)、 'typename' 型のすべての SQLite
     値に対して呼び出されます。 変換関数には *note bytes: 192. オブジェ
     クトが渡され、目的の Python 型のオブジェクトを返す必要があります。
     型検出の仕組みについては、 *note connect(): 5a6. のパラメーター
     'detect_types' を参照してください。

     注釈: 'typename' とクエリ内の型の名前は、大文字小文字を区別せずにマ
     ッチングされます。

   ---------- Footnotes ----------

   (1) https://sqlite.org/inmemorydb.html

   (2) https://peps.python.org/pep-0249/

   (3) 
https://github.com/python/cpython/tree/3.14/Lib/sqlite3/__main__.py


File: python.info,  Node: モジュール定数,  Next: Connection オブジェクト,  Prev: モジュール関数,  Up: リファレンス

5.12.6.4 モジュール定数
.......................

 -- データ: sqlite3.LEGACY_TRANSACTION_CONTROL

     古いスタイル (Python 3.12 より前) のトランザクション制御の振る舞い
     を選択するには、 *note autocommit: 6dd. に、この定数を設定します。
     詳細については *note isolation_level
     属性に依るトランザクション制御: 2d75. を参照してください。

 -- データ: sqlite3.PARSE_DECLTYPES

     このフラグ値を *note connect(): 5a6. の 'detect_types' パラメーター
     に渡して、各列(column)で宣言した型を使用して変換関数を探します。型
     は、データベース・テーブルの作成時に宣言します。 ‘sqlite3’ は、宣言
     された型の、最初の単語を、変換関数辞書(converter dictionary)のキー
     として使用して、変換関数を探します。例えば:

          CREATE TABLE test(
             i integer primary key,  ! will look up a converter named "integer"
             p point,                ! will look up a converter named "point"
             n number(10)            ! will look up a converter named "number"
           )

     このフラグは ‘|’ (ビット論理和)演算子を使用して *note
     PARSE_COLNAMES: 2d73. と組み合わせることができます。

          注釈: Generated fields (for example ‘MAX(p)’) are returned as
          *note str: 169.  Use ‘PARSE_COLNAMES’ to enforce types for
          such queries.

 -- データ: sqlite3.PARSE_COLNAMES

     Pass this flag value to the 'detect_types' parameter of *note
     connect(): 5a6. to look up a converter function by using the type
     name, parsed from the query column name, as the converter
     dictionary key.  The query column name must be wrapped in double
     quotes (‘"’) and the type name must be wrapped in square brackets
     (‘[]’).

          SELECT MAX(p) as "p [point]" FROM test;  ! will look up converter "point"

     このフラグは ‘|’ (ビット論理和)演算子を使用して *note
     PARSE_DECLTYPES: 2d72. と組み合わせることができます。

 -- データ: sqlite3.SQLITE_OK
 -- データ: sqlite3.SQLITE_DENY
 -- データ: sqlite3.SQLITE_IGNORE

     *note Connection.set_authorizer(): 5a9. に渡す *note
     呼び出し可能オブジェクト: 2d7b. が返す必要のあるフラグ。これらは以
     下の意味です:

        * アクセスは許可されました(‘SQLITE_OK’)

        * 当該SQL文全体の実行をエラーで中止(abort)する必要があります
          (‘SQLITE_DENY’)

        * 列(column)は ‘NULL’ 値として扱う必要がありますが、当該SQL文の
          実行は続行する必要があります(‘SQLITE_IGNORE’)

 -- データ: sqlite3.apilevel

     サポートされている DB-API レベルを示す文字列定数。 DB-API で必要で
     す。 ‘"2.0"’ とハードコーディングされています。

 -- データ: sqlite3.paramstyle

     ‘sqlite3’ モジュールが期待するパラメータ・マーカーのフォーマットの
     種類をあらわす文字列定数です。 DB-API で必要です。 ‘"qmark"’ とハー
     ドコーディングされています。

          注釈: ‘named’ DB-API パラメータ・スタイルもサポートされていま
          す。

 -- データ: sqlite3.sqlite_version

     *note 文字列: 169. としての、ランタイム SQLite ライブラリのバージョ
     ン番号。

 -- データ: sqlite3.sqlite_version_info

     *note 整数: 19b. の *note タプル: 614. としての、ランタイム SQLite
     ライブラリのバージョン番号。

 -- データ: sqlite3.threadsafety

     ‘sqlite3’ モジュールがサポートするスレッドセーフのレベルを示す、
     DB-API 2.0 で必要な整数定数。 この属性は、背後の SQLite ライブラリ
     のコンパイル時のデフォルトの SQLite スレッド・モード (threading
     mode(1))に基づいて設定されます。 SQLite のスレッド・モードは以下の
     とおりです:

       1. 'シングル・スレッド': このモードでは、すべてのミューテックスが
          無効になり、一度に複数のスレッドで SQLite を使用するのは安全で
          はありません。

       2. 'マルチ・スレッド': このモードでは、 1 つのデータベース接続が
          2 つ以上のスレッドで同時に使用されない限り、複数のスレッドで
          SQLite を安全に使用できます。

       3. '直列化': 直列化(serialized)モードでは、 SQLite を複数のスレッ
          ドで制限なく安全に使用できます。

     SQLite スレッド・モードと、 DB-API 2.0 のスレッドセーフ・レベルとの
     対応は以下のとおりです:

     SQLite スレッド・モ    threadsafety(2)            SQLITE_THREADSAFE(3)       DB-API 2.0 での意味
     ード                                                                         

     -----------------------------------------------------------------------------------------------------------------
                                                                                  
     シングル・スレッド     0                          0                          スレッドはモジュールを共有できま
                                                                                  せん
                                                                                  
                                                                                  
     マルチ・スレッド       1                          2                          スレッドはモジュールを共有できま
                                                                                  すが、接続は共有できません
                                                                                  
                                                                                  
     直列化                 3                          1                          スレッドは、モジュールや接続やカ
                                                                                  ーソルを共有できます
                                                                                  

     バージョン 3.11 で変更: ‘1’ とハード・コーディングする代わりに
     'threadsafety' を動的に設定します。

 -- データ: sqlite3.SQLITE_DBCONFIG_DEFENSIVE
 -- データ: sqlite3.SQLITE_DBCONFIG_DQS_DDL
 -- データ: sqlite3.SQLITE_DBCONFIG_DQS_DML
 -- データ: sqlite3.SQLITE_DBCONFIG_ENABLE_FKEY
 -- データ: sqlite3.SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
 -- データ: sqlite3.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
 -- データ: sqlite3.SQLITE_DBCONFIG_ENABLE_QPSG
 -- データ: sqlite3.SQLITE_DBCONFIG_ENABLE_TRIGGER
 -- データ: sqlite3.SQLITE_DBCONFIG_ENABLE_VIEW
 -- データ: sqlite3.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE
 -- データ: sqlite3.SQLITE_DBCONFIG_LEGACY_FILE_FORMAT
 -- データ: sqlite3.SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
 -- データ: sqlite3.SQLITE_DBCONFIG_RESET_DATABASE
 -- データ: sqlite3.SQLITE_DBCONFIG_TRIGGER_EQP
 -- データ: sqlite3.SQLITE_DBCONFIG_TRUSTED_SCHEMA
 -- データ: sqlite3.SQLITE_DBCONFIG_WRITABLE_SCHEMA

     これらの定数は、 *note Connection.setconfig(): 6e1. メソッド や
     *note getconfig(): 6e0. メソッドで使用されます。

     これらの定数が利用できるかどうかは、 Python にコンパイルされた
     SQLite のバージョンによって異なります。

     Added in version 3.12.

     参考
     ....

     ‘https://www.sqlite.org/c3ref/c_dbconfig_defensive.html’

          SQLite docs: Database Connection Configuration Options

Deprecated since version 3.12, removed in version 3.14: The ‘version’
and ‘version_info’ constants.

   ---------- Footnotes ----------

   (1) https://sqlite.org/threadsafe.html

   (2) https://peps.python.org/pep-0249/#threadsafety

   (3) https://sqlite.org/compile.html#threadsafe


File: python.info,  Node: Connection オブジェクト,  Next: Cursor オブジェクト,  Prev: モジュール定数,  Up: リファレンス

5.12.6.5 Connection オブジェクト
................................

 -- クラス: sqlite3.Connection

     開いた SQLite データベースの各々は、 *note sqlite3.connect(): 5a6.
     を使用して作成される ‘Connection’ オブジェクトによって表されます。
     ‘Connection’ オブジェクトの主な目的は *note Cursor: 2d64. オブジェ
     クトの作成と *note トランザクション制御: 2d66. です。

     参考
     ....

        * *note 接続(connection)ショートカット・メソッドの使い方: 2d96.

        * *note 接続(connection)コンテキストマネージャの使い方: 1b6c.

     バージョン 3.13 で変更: A *note ResourceWarning: 54c. is emitted if
     *note close(): 54e. is not called before a ‘Connection’ object is
     deleted.

     SQLite データベース接続(connection)には、以下の属性とメソッドがあり
     ます:

      -- メソッド: cursor (factory=Cursor)

          *note Cursor: 2d64. オブジェクトを作成して返します。 cursor メ
          ソッドは、単一のオプション・パラメーター 'factory' を受け入れ
          ます。 'factory' を指定する場合、これは *note Cursor: 2d64. ま
          たはそのサブクラスのインスタンスを返す *note
          呼び出し可能オブジェクト: 2d7b. である必要があります。

      -- メソッド: blobopen (table, column, rowid, /, *, readonly=False,
               name='main')

          既存の BLOB (Binary Large OBject) への *note Blob: 892. ハンド
          ルを開きます。


          パラメータ:

             * ‘table’ (*note str: 169.) - 当該 BLOB が配置されているテ
               ーブルの名前。

             * ‘column’ (*note str: 169.) - 当該 BLOB が配置されている列
               (column)の名前。

             * ‘rowid’ (*note int: 19b.) - The row id where the blob is
               located.

             * ‘readonly’ (*note bool: 3c3.) - 書き込み権限なしで BLOB を
               開く必要がある場合は、 ‘True’ に設定します。 デフォルトは
               ‘False’ です。

             * ‘name’ (*note str: 169.) - 当該 BLOB が配置されているデー
               タベース名。 デフォルトは ‘"main"’ です。


          例外: *note OperationalError: 1c52. - ‘WITHOUT ROWID’ テーブル
          で BLOB を開こうとしたとき。


          戻り値の型: *note Blob: 892.

               注釈: *note Blob: 892. クラスを使用して BLOB のサイズを変
               更することはできません。 SQL 関数 ‘zeroblob’ を使用すると
               、固定サイズのブロブを作成します。

          Added in version 3.11.

      -- メソッド: commit ()

          保留中のトランザクションをデータベースにコミットします。 *note
          autocommit: 6dd. が ‘True’ または開いているトランザクションが
          ない場合、このメソッドは何も行いません。 ‘autocommit’ が
          ‘False’ の場合に保留中のトランザクションがこのメソッドによって
          コミットされた場合、新しいトランザクションが暗黙に開かれます。

      -- メソッド: rollback ()

          保留中のトランザクションの先頭にロールバックします。 *note
          autocommit: 6dd. が ‘True’ または開いているトランザクションが
          ない場合、このメソッドは何も行いません。 ‘autocommit’ が
          ‘False’ の場合に保留中のトランザクションがこのメソッドによって
          ロールバックされた場合、新しいトランザクションが暗黙に開かれま
          す。

      -- メソッド: close ()

          データベース接続を閉じます。 *note autocommit: 6dd. が ‘False’
          の場合、保留中のトランザクションは暗黙にロールバックされます。
          ‘autocommit’ が ‘True’ または *note
          LEGACY_TRANSACTION_CONTROL: 2d76. の場合、暗黙のトランザクショ
          ン制御は実行されませんので、保留中の変更が失われないように、デ
          ータベース接続を閉じる前に必ず *note commit(): 2d67. を行って
          ください。

      -- メソッド: execute (sql, parameters=(), /)

          新しい *note Cursor: 2d64. オブジェクトを作成し、指定の 'sql'
          と 'parameters' で *note execute(): 5b0. を呼び出します。新し
          いカーソル・オブジェクトを返します。

      -- メソッド: executemany (sql, parameters, /)

          新しい *note Cursor: 2d64. オブジェクトを作成し、与えられた
          'sql' と 'parameters' で *note executemany(): 5b1. を呼び出し
          ます。新しいカーソル・オブジェクトを返します。

      -- メソッド: executescript (sql_script, /)

          新しい *note Cursor: 2d64. オブジェクトを作成し、指定された
          'sql_script' で *note executescript(): 2d9b. を呼び出します。
          新しいカーソル・オブジェクトを返します。

      -- メソッド: create_function (name, narg, func, *,
               deterministic=False)

          ユーザ定義 SQL 関数を作成または削除します。


          パラメータ:

             * ‘name’ (*note str: 169.) - SQL 関数の名前。

             * ‘narg’ (*note int: 19b.) - SQL 関数が受け入れることができ
               る引数の数。 ‘-1’ を指定すると、任意の数の引数を取ること
               ができます。

             * ‘func’ (*note callback: 2d9c. | None) - この SQL 関数が呼
               び出されたときに起動される *note
               呼び出し可能オブジェクト: 2d7b. 。 この呼び出し可能オブジ
               ェクトは、 *note SQLite
               によってネイティブにサポートされる型: 2d70. を返すす必要
               があります。 既存の SQL 関数を削除するには、 ‘None’ に設
               定します。

             * ‘deterministic’ (*note bool: 3c3.) - ‘True’ の場合、作成
               された SQL 関数は決定論的(deterministic(1) : 入力が同一な
               ら常に同一の答えを返す)としてマークされ、SQLite が追加の
               最適化を実行できるようになります。

          バージョン 3.8 で変更: Added the 'deterministic' parameter.

          例:

               >>> import hashlib
               >>> def md5sum(t):
               ...     return hashlib.md5(t).hexdigest()
               >>> con = sqlite3.connect(":memory:")
               >>> con.create_function("md5", 1, md5sum)
               >>> for row in con.execute("SELECT md5(?)", (b"foo",)):
               ...     print(row)
               ('acbd18db4cc2f85cedef654fccc4a4d8',)
               >>> con.close()

          バージョン 3.13 で変更: Passing 'name', 'narg', and 'func' as
          keyword arguments is deprecated.  These parameters will become
          positional-only in Python 3.15.

      -- メソッド: create_aggregate (name, n_arg, aggregate_class)

          ユーザ定義集計関数を作成または削除します。


          パラメータ:

             * ‘name’ (*note str: 169.) - SQL 集計関数の名前。

             * ‘n_arg’ (*note int: 19b.) - SQL 集計関数が受け入れること
               ができる引数の数。 ‘-1’ を指定すると、任意の数の引数を取
               ることができます。

             * ‘aggregate_class’ (*note class: 1cfd. | None) - クラスは
               以下のメソッドを実装する必要があります:

                  * ‘step()’: 集計に行(row)を足し込みます。

                  * ‘finalize()’: 集計の最終結果を *note SQLite
                    でネイティブにサポートされている型: 2d70. として返し
                    ます。

               ‘step()’ メソッドが受け入れなければならない引数の数は
               'n_arg' によって制御されます。

               既存の SQL 集計関数を削除するには、 ‘None’ に設定します。

          例:

               class MySum:
                   def __init__(self):
                       self.count = 0

                   def step(self, value):
                       self.count += value

                   def finalize(self):
                       return self.count

               con = sqlite3.connect(":memory:")
               con.create_aggregate("mysum", 1, MySum)
               cur = con.execute("CREATE TABLE test(i)")
               cur.execute("INSERT INTO test(i) VALUES(1)")
               cur.execute("INSERT INTO test(i) VALUES(2)")
               cur.execute("SELECT mysum(i) FROM test")
               print(cur.fetchone()[0])

               con.close()

          バージョン 3.13 で変更: Passing 'name', 'n_arg', and
          'aggregate_class' as keyword arguments is deprecated.  These
          parameters will become positional-only in Python 3.15.

      -- メソッド: create_window_function (name, num_params,
               aggregate_class, /)

          ユーザー定義の集計ウインドウ関数を作成または削除します。


          パラメータ:

             * ‘name’ (*note str: 169.) - 作成または削除する SQL 集計ウ
               インドウ関数の名前。

             * ‘num_params’ (*note int: 19b.) - SQL 集計ウィンドウ関数が
               受け入れることができる引数の数。 ‘-1’ を指定した場合、任
               意の数の引数を取ることができます。

             * ‘aggregate_class’ (*note class: 1cfd. | None) - クラスは
               以下のメソッドを実装する必要があります:

                  * ‘step()’: 現在のウィンドウに行を足し込みます。

                  * ‘value()’: 集計の現在の値を返します。

                  * ‘inverse()’: 現在のウインドウから指定の行(row)の分を
                    削除します。

                  * ‘finalize()’: 集計の最終結果を *note SQLite
                    でネイティブにサポートされている型: 2d70. として返し
                    ます。

               ‘step()’ メソッドと ‘value()’ メソッドが受け入れなければ
               ならない引数の数は 'num_params' によって制御されます。

               ‘None’ に設定すると、既存の SQL 集計ウィンドウ関数が削除
               されます。


          例外: *note NotSupportedError: 2d9d. - 集計ウィンドウ関数をサ
          ポートしていない 3.25.0 より古いバージョンの SQLite で使用した
          場合に送出されます。

          Added in version 3.11.

          例:

               # Example taken from https://www.sqlite.org/windowfunctions.html#udfwinfunc
               class WindowSumInt:
                   def __init__(self):
                       self.count = 0

                   def step(self, value):
                       """Add a row to the current window."""
                       self.count += value

                   def value(self):
                       """Return the current value of the aggregate."""
                       return self.count

                   def inverse(self, value):
                       """Remove a row from the current window."""
                       self.count -= value

                   def finalize(self):
                       """Return the final value of the aggregate.

                       Any clean-up actions should be placed here.
                       """
                       return self.count


               con = sqlite3.connect(":memory:")
               cur = con.execute("CREATE TABLE test(x, y)")
               values = [
                   ("a", 4),
                   ("b", 5),
                   ("c", 3),
                   ("d", 8),
                   ("e", 1),
               ]
               cur.executemany("INSERT INTO test VALUES(?, ?)", values)
               con.create_window_function("sumint", 1, WindowSumInt)
               cur.execute("""
                   SELECT x, sumint(y) OVER (
                       ORDER BY x ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING
                   ) AS sum_y
                   FROM test ORDER BY x
               """)
               print(cur.fetchall())
               con.close()

      -- メソッド: create_collation (name, callable, /)

          照合関数(collating function) 'callable' を使用して 'name' とい
          う名前の照合(collation)を作成します。 'callable' には 2 つの
          *note 文字列: 169. 引数が渡され、*note 整数: 19b. を返す必要が
          あります:

             * 1 番目の文字列が 2 番目の文字列よりも高い順位ならば ‘1’ を
               返す

             * 1 番目の文字列が 2 番目の文字列よりも低い順位ならば ‘-1’
               を返す

             * 1 番目の文字列と 2 番目の文字列が同じ順位ならば ‘0’ を返
               す

          以下は逆順での照合例です:

               def collate_reverse(string1, string2):
                   if string1 == string2:
                       return 0
                   elif string1 < string2:
                       return 1
                   else:
                       return -1

               con = sqlite3.connect(":memory:")
               con.create_collation("reverse", collate_reverse)

               cur = con.execute("CREATE TABLE test(x)")
               cur.executemany("INSERT INTO test(x) VALUES(?)", [("a",), ("b",)])
               cur.execute("SELECT x FROM test ORDER BY x COLLATE reverse")
               for row in cur:
                   print(row)
               con.close()

          照合関数を削除するには 'callable' を ‘None’ に設定します。

          バージョン 3.11 で変更: 照合の名前には任意のユニコード文字を含
          めることができます。 以前は ASCII 文字のみが許可されていました
          。

      -- メソッド: interrupt ()

          このメソッドを別のスレッドから呼び出して、この接続
          (connection)で、実行中のすべてのクエリを中止(abort)させます。
          中止(abort)させられたクエリは *note OperationalError: 1c52. を
          送出します。

      -- メソッド: set_authorizer (authorizer_callback)

          データベース内のテーブルの列(column)にアクセスしようとするたび
          に起動される *note 呼び出し可能オブジェクト: 2d7b.
          'authorizer_callback' を登録します。 このコールバックは背後の
          SQLite ライブラリによって列(column)へのアクセスがどのように処
          理されるかを通知するために、 *note SQLITE_OK: 2d7e. または
          *note SQLITE_DENY: 2d7f. または *note SQLITE_IGNORE: 2d80. の
          いずれかを返さなければなりません。

          コールバックの最初の引数は、承認(authorize)される操作の種類を
          示します。 2 番目と 3 番目の引数は、最初の引数に応じて、引数ま
          たは ‘None’ になります。 4 番目の引数は、該当する場合、データ
          ベースの名前("main" や "temp" 等)です。 5 番目の引数は、 アク
          セス試行を担当する最も内側のトリガーまたはビューの名前です。こ
          のアクセス試行が入力 SQL コードから直接行われた場合は ‘None’ で
          す。

          最初の引数に指定可能な値と、 最初の引数に応じた 2 番目と 3 番
          目の引数の意味については、 SQLite のドキュメントを参照してくだ
          さい。 必要なすべての定数は ‘sqlite3’ モジュールで利用できます
          。

          'authorizer_callback' として ‘None’ を渡すと、承認機構
          (authorizer)が無効になります。

          バージョン 3.11 で変更: ‘None’ を使用して承認機構
          (authorizer)を無効にするサポートが追加されました。

          バージョン 3.13 で変更: Passing 'authorizer_callback' as a
          keyword argument is deprecated.  The parameter will become
          positional-only in Python 3.15.

      -- メソッド: set_progress_handler (progress_handler, n)

          SQLite 仮想マシンの命令を 'n' 個実行するごとに呼び出されるよう
          に、 *note 呼び出し可能オブジェクト: 2d7b. 'progress_handler'
          を登録します。これは、 GUI の更新など、長時間実行される操作中
          に SQLite から呼び出されるようにしたい場合に便利です。

          以前にインストールした progress ハンドラーをクリアしたい場合は
          、 'progress_handler' に ‘None’ を指定してメソッドを呼び出しま
          す。

          ハンドラー関数からゼロ以外の値を返すと、現在実行中のクエリを終
          了(terminate)し、 *note DatabaseError: 2d9f. 例外を送出します
          。

          バージョン 3.13 で変更: Passing 'progress_handler' as a
          keyword argument is deprecated.  The parameter will become
          positional-only in Python 3.15.

      -- メソッド: set_trace_callback (trace_callback)

          SQLite バックエンドによって実際に実行される SQL 文ごとに起動さ
          れる *note 呼び出し可能オブジェクト: 2d7b. 'trace_callback' を
          登録します。

          コールバックに渡される唯一の引数は、(*note str: 169. として渡
          される)実行中のSQL文です。 コールバックの戻り値は無視されます
          。 バックエンドは、 *note Cursor.execute(): 5b0. メソッドに渡
          されたSQL文を実行するだけではないことに注意してください。
          ‘sqlite3’ モジュールの *note トランザクション管理: 2d66. や、
          現在のデータベース内で定義されたトリガーの実行その他も行います
          。

          'trace_callback' として ‘None’ を渡すと、トレース・コールバッ
          クが無効になります。

               注釈: トレース・コールバックで送出した例外は伝播されませ
               ん。 開発およびデバッグの補助として、 *note
               enable_callback_tracebacks(): 2d79. を使用して、トレース
               ・コールバックで送出した例外からのトレースバックの出力を
               有効にします。

          Added in version 3.3.

          バージョン 3.13 で変更: Passing 'trace_callback' as a keyword
          argument is deprecated.  The parameter will become
          positional-only in Python 3.15.

      -- メソッド: enable_load_extension (enabled, /)

          'enabled' が ‘True’ の場合、 SQLite エンジンが共有ライブラリか
          ら SQLite 拡張機能をロードできるようにします。 ‘True’ 以外の場
          合は、 SQLite 拡張機能の読み込みを許可しません。 SQLite 拡張機
          能では、新しい関数の定義、または集計の定義、またはまったく新し
          い仮想テーブルの実装を定義できます。 よく知られている拡張機能
          の 1 つは、SQLite と共に配布される全文検索拡張機能です。

               注釈: ‘sqlite3’ モジュールは、デフォルトではロード可能な
               拡張機能をサポートするようにビルドされていません。一部の
               プラットフォーム(特に macOS)には、この機能なしでコンパイ
               ルされた SQLite ライブラリがあるためです。 ロード可能な拡
               張機能のサポートを得るには、 ‘configure’ に *note
               -enable-loadable-sqlite-extensions: 2162. オプションを渡
               す必要があります。

          引数 ‘connection’, ‘enabled’ を指定して *note 監査イベント:
          1c6e. ‘sqlite3.enable_load_extension’ を送出します。

          Added in version 3.2.

          バージョン 3.10 で変更: ‘sqlite3.enable_load_extension’ 監査イ
          ベントを追加しました。

               con.enable_load_extension(True)

               # Load the fulltext search extension
               con.execute("select load_extension('./fts3.so')")

               # alternatively you can load the extension using an API call:
               # con.load_extension("./fts3.so")

               # disable extension loading again
               con.enable_load_extension(False)

               # example from SQLite wiki
               con.execute("CREATE VIRTUAL TABLE recipe USING fts3(name, ingredients)")
               con.executescript("""
                   INSERT INTO recipe (name, ingredients) VALUES('broccoli stew', 'broccoli peppers cheese tomatoes');
                   INSERT INTO recipe (name, ingredients) VALUES('pumpkin stew', 'pumpkin onions garlic celery');
                   INSERT INTO recipe (name, ingredients) VALUES('broccoli pie', 'broccoli cheese onions flour');
                   INSERT INTO recipe (name, ingredients) VALUES('pumpkin pie', 'pumpkin sugar flour butter');
                   """)
               for row in con.execute("SELECT rowid, name, ingredients FROM recipe WHERE name MATCH 'pie'"):
                   print(row)

      -- メソッド: load_extension (path, /, *, entrypoint=None)

          共有ライブラリから SQLite 拡張機能(extension)をロードします。
          このメソッドを呼び出す前に *note enable_load_extension(): a3f.
          で拡張機能の読み込みを有効にしてください。


          パラメータ:

             * ‘path’ (*note str: 169.) - SQLite 拡張機能(extension)への
               パス(path)。

             * ‘entrypoint’ (*note str: 169.‘ | ’‘None’) - エントリ・ポ
               イント名。 ‘None’ (デフォルト) の場合、 SQLite は自分自身
               でエントリ・ポイント名を推測します。 詳細については、
               SQLite ドキュメント Loading an Extension(2) を参照してく
               ださい。

          引数 ‘connection’, ‘path’ を指定して *note 監査イベント: 1c6e.
          ‘sqlite3.load_extension’ を送出します。

          Added in version 3.2.

          バージョン 3.10 で変更: ‘sqlite3.load_extension’ 監査イベント
          を追加しました。

          バージョン 3.12 で変更: Added the 'entrypoint' parameter.

      -- メソッド: iterdump (*, filter=None)

          データベースを SQL ソース・コードとしてダンプする *note
          iterator: 4c8. を返します。 後で復元するためにメモリ内データベ
          ースを保存する場合に便利です。 ‘sqlite3’ シェルの ‘.dump’ コマ
          ンドに似ています。


          パラメータ: ‘filter’ (*note str: 169.‘ | ’‘None’) - An
          optional ‘LIKE’ pattern for database objects to dump, e.g.
          ‘prefix_%’.  If ‘None’ (the default), all database objects
          will be included.

          例:

               # Convert file example.db to SQL dump file dump.sql
               con = sqlite3.connect('example.db')
               with open('dump.sql', 'w') as f:
                   for line in con.iterdump():
                       f.write('%s\n' % line)
               con.close()

          参考
          ....

          *note How to handle non-UTF-8 text encodings: 2da0.

          バージョン 3.13 で変更: 'filter' パラメータが追加されました。

      -- メソッド: backup (target, *, pages=-1, progress=None,
               name='main', sleep=0.250)

          SQLite データベースのバックアップを作成します。

          データベースが他のクライアントによってアクセスされている場合、
          または同一の接続によって並行にアクセスされている場合でも機能し
          ます。


          パラメータ:

             * ‘target’ (*note Connection: 54d.) - バックアップ先のデー
               タベース接続(connection)。

             * ‘pages’ (*note int: 19b.) - 一度にコピーするページ数。
               ‘0’ 以下の場合、データベース全体がワンステップでコピーさ
               れます。 デフォルトは ‘-1’ です。

             * ‘progress’ (*note callback: 2d9c. | None) - *note
               呼び出し可能オブジェクト: 2d7b. を設定すると、バックアッ
               プの指定ページ数単位の反復ごとに 3 つの整数引数で呼び出さ
               れます。 'status' は、最後の反復時のステータスで、
               'remaining' はまだコピーされていない残りのページ数で、
               'total' はコピーされるページの合計です。 デフォルトは
               ‘None’ です。

             * ‘name’ (*note str: 169.) - バックアップするデータベース名
               。 ‘"main"’ (メイン・データベース。これがデフォルトです
               )、または ‘"temp"’ (一時データベース)、 または ‘ATTACH
               DATABASE’ SQL文を使用して取り付けられたカスタム・データベ
               ース名の、いずれかです。

             * ‘sleep’ (*note float: 196.) - バックアップの指定ページ数
               単位の反復ごとにスリープする秒数。

          例 1.  既存のデータベースを別のデータベースにコピーします:

               def progress(status, remaining, total):
                   print(f'Copied {total-remaining} of {total} pages...')

               src = sqlite3.connect('example.db')
               dst = sqlite3.connect('backup.db')
               with dst:
                   src.backup(dst, pages=1, progress=progress)
               dst.close()
               src.close()

          例 2.  既存のデータベースを臨時コピー(transient copy)にコピー
          します。

               src = sqlite3.connect('example.db')
               dst = sqlite3.connect(':memory:')
               src.backup(dst)
               dst.close()
               src.close()

          Added in version 3.7.

          参考
          ....

          *note How to handle non-UTF-8 text encodings: 2da0.

      -- メソッド: getlimit (category, /)

          接続(connection)の実行時制限を取得します。


          パラメータ: ‘category’ (*note int: 19b.) - 問い合わせを行う実
          行時制限カテゴリー(SQLite limit category(3))。


          戻り値の型: *note int: 19b.


          例外: *note ProgrammingError: 305. - 'category' に、 背後の
          SQLite ライブラリが認識できないカテゴリーを指定した場合に送出
          されます。

          例: *note Connection: 54d. の ‘con’ の SQL 文の最大長を照会し
          ます (デフォルトは 1000000000 です):

               >>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)
               1000000000

          Added in version 3.11.

      -- メソッド: setlimit (category, limit, /)

          接続の実行時制限を設定します。 コンパイル時上限を超えて制限を
          増やそうとすると、 暗黙のうちにコンパイル時上限に切り捨てられ
          ます。 制限が変更されたかどうかに関係なく、 制限の以前の値が返
          されます。


          パラメータ:

             * ‘category’ (*note int: 19b.) - SQLite limit category(4) を
               設定する。

             * ‘limit’ (*note int: 19b.) - 新しい制限の値。 負数の場合、
               現在の制限は変更されません。


          戻り値の型: *note int: 19b.


          例外: *note ProgrammingError: 305. - 'category' に、 背後の
          SQLite ライブラリが認識できないカテゴリーを指定した場合に送出
          されます。

          *note Connection: 54d. の ‘con’ に対して、取り付けられるデータ
          ベース(attached databases)の数を 1 に制限します (デフォルトの
          制限は 10 です):

               >>> con.setlimit(sqlite3.SQLITE_LIMIT_ATTACHED, 1)
               10
               >>> con.getlimit(sqlite3.SQLITE_LIMIT_ATTACHED)
               1

          Added in version 3.11.

      -- メソッド: getconfig (op, /)

          ブール値の接続構成オプションを問い合わせます。


          パラメータ: ‘op’ (*note int: 19b.) - *note SQLITE_DBCONFIG
          code: 2d83. を指定します。


          戻り値の型: *note bool: 3c3.

          Added in version 3.12.

      -- メソッド: setconfig (op, enable=True, /)

          ブール値の接続構成オプションを設定します。


          パラメータ:

             * ‘op’ (*note int: 19b.) - *note SQLITE_DBCONFIG code:
               2d83. を指定します。

             * ‘enable’ (*note bool: 3c3.) - 設定オプションを有効にする
               必要がある場合は ‘True’ (デフォルト)。 無効にする場合は
               ‘False’ を指定します。

          Added in version 3.12.

      -- メソッド: serialize (*, name='main')

          データベースを *note bytes: 192. オブジェクトに直列化
          (serialize)します。 通常のディスク上のデータベース・ファイルの
          場合、 直列化はディスク・ファイルの単なるコピーです。 インメモ
          リ・データベースまたは "temp" データベースの場合、 直列化は、
          そのデータベースがディスクにバックアップされた場合にディスクに
          書き込まれるバイト・シーケンスと同じです。


          パラメータ: ‘name’ (*note str: 169.) - 直列化するデータベース
          名。 デフォルトは ‘"main"’ です。


          戻り値の型: *note bytes: 192.

               注釈: このメソッドは、 背後の SQLite ライブラリに直列化
               API がある場合にのみ使用できます。

          Added in version 3.11.

      -- メソッド: deserialize (data, /, *, name='main')

          *note 直列化: 88e. されたデータベースを *note Connection: 54d.
          に、 脱直列化(deserialize)します。 このメソッドにより、 データ
          ベース接続はデータベース 'name' から切断され、そして、 'data'
          に含まれる直列化データに基づいて、 データベース 'name' がイン
          メモリ・データベースとして再度開かれます。


          パラメータ:

             * ‘data’ (*note bytes: 192.) - 直列化されたデータベース。

             * ‘name’ (*note str: 169.) - 脱直列化(deserialize)したデー
               タを入れるデータベース名。 デフォルトは ‘"main"’ です。


          例外:

             * *note OperationalError: 1c52. - データベース接続が読み取
               りトランザクションやバックアップ操作中の場合。

             * *note DatabaseError: 2d9f. - 'data' に有効な SQLite デー
               タベースが含まれていない場合。

             * *note OverflowError: a81. - *note len(data): 840. が
               ‘2**63 - 1’ より大きい場合。

               注釈: このメソッドは、 背後の SQLite ライブラリに脱直列化
               API がある場合にのみ使用できます。

          Added in version 3.11.

      -- の属性: autocommit

          この属性は、 PEP 249(5) 対応のトランザクションの振る舞いを制御
          します。 ‘auto​​commit’ には以下の 3 つの値が指定できます:

             * ‘False’: PEP 249(6) 対応のトランザクションの振る舞いを選
               びます。 これは、 ‘sqlite3’ が、 トランザクションが常に開
               いていることを保証することを意味します。トランザクション
               を閉じるには、 *note commit(): 2d67. や *note rollback():
               2d97. を使用します。

               これが ‘auto​​commit’ の推奨値です。

             * ‘True’: SQLite の autocommit mode(7) を使用します。このモ
               ードでは *note commit(): 2d67. や *note rollback(): 2d97.
               は効果がありません。

             * *note LEGACY_TRANSACTION_CONTROL: 2d76.: Python 3.12 より
               前( PEP 249(8) 非対応)のトランザクション制御。 詳細につい
               ては *note isolation_level: 2d74. を参照してください。

               これが、今のところは、 ‘auto​​commit’ のデフォルト値です。

          ‘auto​​commit’ を ‘False’ に変更すると新しいトランザクションが開
          き、 ‘True’ に変更すると保留中のトランザクションがコミットされ
          ます。

          詳細は *note autocommit 属性に依るトランザクション制御: 6de. を
          参照してください。

               注釈: *note isolation_level: 2d74. 属性は、 *note
               autocommit: 6dd. の値が *note LEGACY_TRANSACTION_CONTROL:
               2d76. でない限り、効果がありません。

          Added in version 3.12.

      -- の属性: in_transaction

          この読み取り専用属性は、低レベルの SQLite autocommit mode(9) に
          対応します。

          トランザクションがアクティブな場合 (コミットされていない変更が
          ある場合) は ‘True’ 、それ以外の場合は ‘False’ です。

          Added in version 3.2.

      -- の属性: isolation_level

          ‘sqlite3’ の *note 旧来のトランザクション処理モード: 2d75. を
          制御します。 ‘None’ に設定すると、トランザクションは暗黙に開か
          れることはありません。背後の SQLite の SQLite transaction
          behaviour(10) に対応する ‘"DEFERRED"’ または ‘"IMMEDIATE"’ ま
          たは ‘"EXCLUSIVE"’ のいずれかに設定すると、 *note
          暗黙のトランザクション管理: 2d75. が実行されます。

          *note connect(): 5a6. の 'isolation_level' パラメーターでオー
          バーライドされない場合、 デフォルトは ‘""’ で、 これは
          ‘"DEFERRED"’ の別名です。

               注釈: トランザクション処理を制御するには、
               ‘isolation_level’ を使用するよりも *note autocommit: 6dd.
               を使用することをお勧めします。 *note autocommit: 6dd. が
               *note LEGACY_TRANSACTION_CONTROL: 2d76. (これがデフォルト
               です)に設定されていない限り、 ‘isolation_level’ は効果が
               ありません。

      -- の属性: row_factory

          この接続から作成された *note Cursor: 2d64. オブジェクトの初期
          *note row_factory: 2da2. 。この属性に割り当てを行っても、 この
          接続に属する、すでに存在するカーソルの ‘row_factory’ には影響
          せず、 この属性に割り当てを行った後に作成する新しいカーソルの
          みに影響します。 デフォルトでは ‘None’ です。つまり、各行は
          *note タプル: 614. として返されます。

          詳細は *note 行工場(row factories)の作成方法と使用方法: 2d6b.
          をご覧下さい。

      -- の属性: text_factory

          *note bytes: 192. のパラメータを受け取り、そのテキスト表現を返
          す *note 呼び出し可能オブジェクト: 2d7b. です。呼び出し可能オ
          ブジェクトは ‘TEXT’ データ型である SQLite 値に対して呼び出され
          ます。 デフォルトでは、 この属性は *note str: 169. に設定され
          ています。

          See *note How to handle non-UTF-8 text encodings: 2da0. for
          more details.

      -- の属性: total_changes

          データベース接続が開かれてから、変更または挿入または削除された
          データベース行の総数を返します。

   ---------- Footnotes ----------

   (1) https://sqlite.org/deterministic.html

   (2) https://www.sqlite.org/loadext.html#loading_an_extension

   (3) https://www.sqlite.org/c3ref/c_limit_attached.html

   (4) https://www.sqlite.org/c3ref/c_limit_attached.html

   (5) https://peps.python.org/pep-0249/

   (6) https://peps.python.org/pep-0249/

   (7) 
https://www.sqlite.org/lang_transaction.html#implicit_versus_explicit_transactions

   (8) https://peps.python.org/pep-0249/

   (9) 
https://www.sqlite.org/lang_transaction.html#implicit_versus_explicit_transactions

   (10) 
https://www.sqlite.org/lang_transaction.html#deferred_immediate_and_exclusive_transactions


File: python.info,  Node: Cursor オブジェクト,  Next: Row オブジェクト,  Prev: Connection オブジェクト,  Up: リファレンス

5.12.6.6 Cursor オブジェクト
............................

     ‘Cursor’ オブジェクトは、 SQL 文を実行し、 取得操作(fetch
     operation)のコンテキストを管理するために使用されるデータベース・カ
     ーソル(database cursor(1))を表します。カーソルは、 *note
     Connection.cursor(): 2d63. または *note
     接続(connection)ショートカット・メソッド: 2d96. の、いずれかを使用
     して作成されます。

     カーソル・オブジェクトは *note イテレータ: 4c8. です。つまり、
     ‘SELECT’ クエリに対して *note execute(): 5b0. した場合、結果の行
     (rows)を取得するためには、カーソルを単純に反復(iterate)できます:

          for row in cur.execute("SELECT t FROM data"):
              print(row)

 -- クラス: sqlite3.Cursor

     *note Cursor: 2d64. インスタンスは以下の属性やメソッドを持ちます。

      -- メソッド: execute (sql, parameters=(), /)

          Execute a single SQL statement, optionally binding Python
          values using *note placeholders: 5b2.


          パラメータ:

             * ‘sql’ (*note str: 169.) - 単一の SQL 文。

             * ‘parameters’ (*note dict: 183. | *note sequence: 716.) -
               'sql' のプレースホルダに結び付け(bind)する Python 値。 名
               前付きプレースホルダが使用されている場合は ‘dict’ です。
               名前のないプレースホルダが使用されている場合は sequence で
               す。 *note プレースホルダを使用して SQL
               クエリに値を結び付ける方法: 5b2. を参照してください。


          例外: *note ProgrammingError: 305. - When 'sql' contains more
          than one SQL statement.  When *note named placeholders: 5b2.
          are used and 'parameters' is a sequence instead of a *note
          dict: 183.

          *note autocommit: 6dd. が *note LEGACY_TRANSACTION_CONTROL:
          2d76. で、かつ、 *note isolation_level: 2d74. が ‘None’ で無く
          、 かつ、 'sql' が ‘INSERT’ または ‘UPDATE’ または ‘DELETE’ ま
          たは ‘REPLACE’ 文で、かつ、開いているトランザクションがない場
          合、 'sql' を実行する前にトランザクションが暗黙に開かれます。

          バージョン 3.14 で変更: *note ProgrammingError: 305. is
          emitted if *note named placeholders: 5b2. are used and
          'parameters' is a sequence instead of a *note dict: 183.

          複数の SQL 文を実行するには *note executescript(): 2d9b. を使
          用します。

      -- メソッド: executemany (sql, parameters, /)

          'parameters' のすべての item に対して、 *note パラメーター化:
          5b2. された DML (Data Manipulation Language) SQL 文である
          'sql' を繰り返し実行します。

          *note execute(): 5b0. と同一の暗黙のトランザクション処理を使用
          します。


          パラメータ:

             * ‘sql’ (*note str: 169.) - 単一の DML 文。

             * ‘parameters’ (*note iterable: 12f1.) - 'sql' のプレースホ
               ルダに結び付け(bind)するためのパラメータの iterable 。
               *note プレースホルダを使用して SQL
               クエリに値を結び付ける方法: 5b2. 参照。


          例外: *note ProgrammingError: 305. - When 'sql' contains more
          than one SQL statement or is not a DML statement, When *note
          named placeholders: 5b2. are used and the items in
          'parameters' are sequences instead of *note dict: 183.s.

          例:

               rows = [
                   ("row1",),
                   ("row2",),
               ]
               # cur is an sqlite3.Cursor object
               cur.executemany("INSERT INTO data VALUES(?)", rows)

               注釈: RETURNING 句(RETURNING clauses(2))を含むDML文を含め
               、結果の行はすべて破棄されます。

          バージョン 3.14 で変更: *note ProgrammingError: 305. is
          emitted if *note named placeholders: 5b2. are used and the
          items in 'parameters' are sequences instead of *note dict:
          183.s.

      -- メソッド: executescript (sql_script, /)

          'sql_script' 内の複数のSQL文を実行します。 *note autocommit:
          6dd. が *note LEGACY_TRANSACTION_CONTROL: 2d76. で、かつ、保留
          中のトランザクションがある場合、暗黙の ‘COMMIT’ 文が最初に実行
          されます。その他の暗黙のトランザクション制御は実行されませんの
          で、トランザクション制御を 'sql_script' に追加しなければなりま
          せん。

          'sql_script' は *note 文字列: 169. でなければなりません。

          例:

               # cur is an sqlite3.Cursor object
               cur.executescript("""
                   BEGIN;
                   CREATE TABLE person(firstname, lastname, age);
                   CREATE TABLE book(title, author, published);
                   CREATE TABLE publisher(name, address);
                   COMMIT;
               """)

      -- メソッド: fetchone ()

          *note row_factory: 2da2. が ‘None’ の場合、 次の行のクエリ結果
          セットを *note タプル: 614. として返します。それ以外の場合は、
          それを行工場(row factory)に渡し、 その結果を返します。 これ以
          上データが無い場合は ‘None’ を返します。

      -- メソッド: fetchmany (size=cursor.arraysize)

          クエリ結果の次の行セットを *note list: 24d. として返します。行
          がそれ以上ない場合は、空のリストを返します。

          呼び出しごとに取得する行数は、'size' パラメーターで指定されま
          す。 'size' が指定されていない場合、 *note arraysize: 17a8. が
          取得する行数を決定します。有効な行の数が 'size' 未満の場合は、
          有効な数の行が返されます。

          'size' 引数とパフォーマンスの関係についての注意です。パフォー
          マンスを最適化するためには、大抵、 arraysize 属性を利用するの
          がベストです。 'size' 引数を利用したのであれば、次回の *note
          fetchmany(): 17a7. の呼び出しでも 'size' 引数に同一の値を指定
          するのがのがベストです。

          バージョン 3.14.1 で変更: Negative 'size' values are rejected
          by raising *note ValueError: 2ec.

      -- メソッド: fetchall ()

          クエリ結果の(残りの)すべての行を *note list: 24d. として返しま
          す。 有効な行がない場合は、空のリストを返します。 *note
          arraysize: 17a8. 属性は、この操作のパフォーマンスに影響を与え
          る可能性があることに注意してください。

      -- メソッド: close ()

          (‘__del__’ が呼び出される時ではなく、) 今すぐカーソルを閉じま
          す。

          この時点から、このカーソルは使用できなくなります。今後、このカ
          ーソルで何らかの操作を試みると、 *note ProgrammingError: 305.
          例外が送出されます。

      -- メソッド: setinputsizes (sizes, /)

          DB-API で必要です。 ‘sqlite3’ では何もしません。

      -- メソッド: setoutputsize (size, column=None, /)

          DB-API で必要です。 ‘sqlite3’ では何もしません。

      -- の属性: arraysize

          *note fetchmany(): 17a7. によって返される行(row)数を制御する、
          読み取りと書き込みが可能な属性。 デフォルト値は 1 で、これは呼
          び出しごとに 1 行が取得されることを意味します。

          バージョン 3.14.1 で変更: Negative values are rejected by
          raising *note ValueError: 2ec.

      -- の属性: connection

          カーソルが属する SQLite データベース *note Connection: 54d. を
          提供する読み取り専用属性。 *note con.cursor(): 2d63. と呼び出
          して作成した *note Cursor: 2d64. オブジェクトには、'con' を参
          照する *note connection: 2daa. 属性があります:

               >>> con = sqlite3.connect(":memory:")
               >>> cur = con.cursor()
               >>> cur.connection == con
               True
               >>> con.close()

      -- の属性: description

          最後のクエリの列(column)名を提供する読み取り専用属性。 Python
          DB API との互換性を維持するために、各列ごとに 7 項目のタプルで
          、先頭の項目が列名、残りの6項目が ‘None’ です。

          この属性は ‘SELECT’ 文にマッチする行(row)が1つもなかった場合で
          もセットされます。

      -- の属性: lastrowid

          最後に挿入された行の行 ID (row id) を提供する読み取り専用属性
          。 *note execute(): 5b0. で ‘INSERT’ または ‘REPLACE’ 文が成功
          した後にのみ更新されます。他のSQL文や、 *note executemany():
          5b1. の後や、 *note executescript(): 2d9b. の後や、 挿入が失敗
          した場合、 ‘lastrowid’ の値は変更されません。‘lastrowid’ の初
          期値は ‘None’ です。

               注釈: ‘WITHOUT ROWID’ テーブルへの挿入(insert)は記録され
               ません。

          バージョン 3.6 で変更: ‘REPLACE’ 文のサポートが追加されました
          。

      -- の属性: rowcount

          ‘INSERT’ や ‘UPDATE’ や ‘DELETE’ や ‘REPLACE’ 文で変更された行
          数を提供する読み取り専用属性。 CTE (共通テーブル式) クエリを含
          む他のSQL文は ‘-1’ です。 *note execute(): 5b0. と *note
          executemany(): 5b1. メソッドのみにおいて、 SQL文(statement)実
          行の完了後に更新されます。 なぜなら ‘rowcount’ を更新するため
          には、結果の行を取得(fetch)しなければならないからです。

      -- の属性: row_factory

          この ‘カーソル’ から取得された行の表現方法を制御します。
          ‘None’ の場合、行は *note タプル: 614. として表されます。
          *note sqlite3.Row: 1071. に設定することもできます。 そしてまた
          、 *note Cursor: 2d64. オブジェクトと、 行の値の ‘タプル’ の、
          2 つの引数を受け取り、 SQLite の行(row)を表すカスタム・オブジ
          ェクトを返す、 *note 呼び出し可能オブジェクト: 2d7b. に設定す
          ることもできます。

          ‘カーソル・オブジェクト’ の作成時に *note
          Connection.row_factory: 19a5. の値をこの属性のデフォルト値とし
          て設定します。この属性に割り当てても、親接続(parent
          connection)の *note Connection.row_factory: 19a5. には影響しま
          せん。

          詳細は *note 行工場(row factories)の作成方法と使用方法: 2d6b.
          をご覧下さい。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Cursor_(databases)

   (2) https://www.sqlite.org/lang_returning.html


File: python.info,  Node: Row オブジェクト,  Next: Blob オブジェクト,  Prev: Cursor オブジェクト,  Up: リファレンス

5.12.6.7 Row オブジェクト
.........................

 -- クラス: sqlite3.Row

     ‘Row’ インスタンスは、 *note Connection: 54d. オブジェクトの、高度
     に最適化された *note row_factory: 19a5. の役割をします。 反復
     (iteration)や、等しいかどうかのテスト(equality testing)や、 *note
     len(): 840. 関数や 、 列名(column name)とインデックスによる *note
     マッピング: 13d3. のアクセスを、サポートします。

     列名(column names)と値(values)が全く同一である 2 つの ‘Row’ オブジ
     ェクトを比較すると、等しいと見なされます。

     詳細は *note 行工場(row factories)の作成方法と使用方法: 2d6b. をご
     覧下さい。

      -- メソッド: keys ()

          列名(column names)の *note リスト: 24d. を *note 文字列: 169.
          として返します。 クエリの直後であれば、それは *note
          Cursor.description: 18ab. の各タプルの最初のメンバーです。

     バージョン 3.5 で変更: スライスがサポートされました。


File: python.info,  Node: Blob オブジェクト,  Next: PrepareProtocol オブジェクト,  Prev: Row オブジェクト,  Up: リファレンス

5.12.6.8 Blob オブジェクト
..........................

 -- クラス: sqlite3.Blob

     Added in version 3.11.

     *note Blob: 892. インスタンスは、 SQLite の BLOB とデータを読み書き
     できる *note file-like object: 17ac. です。 *note len(blob): 840. を
     呼び出して、 Blob のサイズ (バイト数) を取得します。 Blob データに
     直接アクセスするには、インデックスと *note スライス: 24ae. を使用し
     ます。

     *note Blob: 892. を *note コンテキストマネージャ: 1e1. として使用し
     て、 使用後に Blob ハンドルが確実に閉じられるようにします。

          con = sqlite3.connect(":memory:")
          con.execute("CREATE TABLE test(blob_col blob)")
          con.execute("INSERT INTO test(blob_col) VALUES(zeroblob(13))")

          # Write to our blob, using two write operations:
          with con.blobopen("test", "blob_col", 1) as blob:
              blob.write(b"hello, ")
              blob.write(b"world.")
              # Modify the first and last bytes of our blob
              blob[0] = ord("H")
              blob[-1] = ord("!")

          # Read the contents of our blob
          with con.blobopen("test", "blob_col", 1) as blob:
              greeting = blob.read()

          print(greeting)  # outputs "b'Hello, world!'"
          con.close()

      -- メソッド: close ()

          Blob を閉じます。

          この時点から、 BLOB は使用できなくなります。 BLOB に対してさら
          に操作を試みると、 *note Error: 1c25. (またはそのサブクラスの)
          例外を送出します。

      -- メソッド: read (length=-1, /)

          BLOB の現在のオフセット位置から 'length' バイトのデータを読み
          取り返ます。 BLOB の現在のオフセット位置から末尾までの残りが
          'length' バイトよりも少ない場合、末尾までのデータを読み取りま
          す。 'length' が指定されていない場合、 または負数の場合、
          *note read(): 2db2. は BLOB の現在のオフセット位置から末尾まで
          のデータを読み取ります。

      -- メソッド: write (data, /)

          BLOB の現在のオフセット位置から 'data' を書き込みます。 この関
          数では BLOB の長さを変更できません。 BLOB の末尾を超えて書き込
          もうとすると *note ValueError: 2ec. を送出します。

      -- メソッド: tell ()

          BLOBの現在のオフセット位置(current access position)を返します
          。

      -- メソッド: seek (offset, origin=os.SEEK_SET, /)

          Set the current access position of the blob to 'offset'.  The
          'origin' argument defaults to *note os.SEEK_SET: 14a5.
          (absolute blob positioning).  Other values for 'origin' are
          *note os.SEEK_CUR: 14a6. (seek relative to the current
          position) and *note os.SEEK_END: 14a7. (seek relative to the
          blob’s end).


File: python.info,  Node: PrepareProtocol オブジェクト,  Next: 例外<7>,  Prev: Blob オブジェクト,  Up: リファレンス

5.12.6.9 PrepareProtocol オブジェクト
.....................................

 -- クラス: sqlite3.PrepareProtocol

     PrepareProtocol 型の唯一の目的は、 *note SQLite
     でネイティブにサポートされている型: 2d70. に *note
     オブジェクト自身で適合(adapt): 2db7. できるオブジェクトの PEP
     246(1) スタイルの適合プロトコルとして機能することです。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0246/


File: python.info,  Node: 例外<7>,  Next: SQLite と Python の型,  Prev: PrepareProtocol オブジェクト,  Up: リファレンス

5.12.6.10 例外
..............

例外の階層は DB-API 2.0 ( PEP 249(1)) で定義されています。

 -- 例外: sqlite3.Warning

     この例外は、現在 ‘sqlite3’ モジュールでは送出しませんが、ユーザー定
     義関数が挿入処理中にデータを切り捨てる場合など、‘sqlite3’ を使用す
     るアプリケーションによって送出されるる可能性があります。 ‘Warning’
     は *note Exception: bcd. のサブクラスです。

 -- 例外: sqlite3.Error

     このモジュールの他の例外の基底となるクラス。 これを使用すると、1 つ
     の *note except: 1ab. 文ですべてのエラーをキャッチできます。
     ‘Error’ は *note Exception: bcd. のサブクラスです。

     例外が SQLite ライブラリ内で発生した場合、 以下の 2 つの属性が例外
     に追加されます:

      -- の属性: sqlite_errorcode

          SQLite API(2) からの数値エラー・コード

          Added in version 3.11.

      -- の属性: sqlite_errorname

          SQLite API(3) からの数値エラー・コードの記号名

          Added in version 3.11.

 -- 例外: sqlite3.InterfaceError

     低レベルの SQLite C API の誤用により送出される例外。 つまり、この例
     外が送出された場合、おそらく ‘sqlite3’ モジュールのバグを示していま
     す。 ‘InterfaceError’ は *note Error: 1c25. のサブクラスです。

 -- 例外: sqlite3.DatabaseError

     データベースに関連するエラーに対して送出される例外。 これは、いくつ
     かの種類のデータベース・エラーの基底の例外として機能します。 これを
     特殊化(specialise)したサブクラスを介して暗黙的にのみ送出されます。
     ‘DatabaseError’ は *note Error: 1c25. のサブクラスです。

 -- 例外: sqlite3.DataError

     範囲外の数値や長すぎる文字列など、処理されたデータの問題によって発
     生したエラーに対して送出される例外。 ‘DataError’ は *note
     DatabaseError: 2d9f. のサブクラスです。

 -- 例外: sqlite3.OperationalError

     データベースの操作に関連し、必ずしもプログラマの制御下にないエラー
     に対して発生する例外。 たとえば、データベース・パスが見つからないと
     か、トランザクションを処理できませんでした等。 ‘OperationalError’ は
     *note DatabaseError: 2d9f. のサブクラスです。

 -- 例外: sqlite3.IntegrityError

     データベースの参照整合性が影響を受ける場合に発生する例外。 たとえば
     外部キーのチェック(foreign key check)が失敗したとき。 *note
     DatabaseError: 2d9f. のサブクラスです。

 -- 例外: sqlite3.InternalError

     SQLite が内部エラーに遭遇したときに発生する例外。 これが送出された
     場合、ランタイム SQLite ライブラリに問題があることを示している可能
     性があります。 ‘InternalError’ は *note DatabaseError: 2d9f. のサブ
     クラスです。

 -- 例外: sqlite3.ProgrammingError

     ‘sqlite3’ API プログラミング・エラーに対して送出される例外。たとえ
     ば、クエリに間違った数のバインディング(結び付け)を指定したり、閉じ
     た後の *note Connection: 54d. を操作しようとしたりしたとき。
     ‘ProgrammingError’ は *note DatabaseError: 2d9f. のサブクラスです。

 -- 例外: sqlite3.NotSupportedError

     メソッドまたはデータベース API が 背後の SQLite ライブラリでサポー
     トしていない場合に送出される例外。たとえば、背後の SQLite ライブラ
     リが決定論的関数(deterministic functions)をサポートしていない場合に
     、*note create_function(): 5a7. で 'deterministic' を ‘True’ に設定
     したとき。 ‘NotSupportedError’ は *note DatabaseError: 2d9f. のサブ
     クラスです。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0249/

   (2) https://sqlite.org/rescode.html

   (3) https://sqlite.org/rescode.html


File: python.info,  Node: SQLite と Python の型,  Next: デフォルトの適合関数 adapters とデフォルトの変換関数 converters 非推奨,  Prev: 例外<7>,  Up: リファレンス

5.12.6.11 SQLite と Python の型
...............................

SQLite は以下の型をネイティブにサポートします: ‘NULL’, ‘INTEGER’,
‘REAL’, ‘TEXT’, ‘BLOB’。

したがって、次の Python の型は問題なく SQLite に送り込めます:

Python の型                         SQLite の型
                                    
------------------------------------------------------
                                    
‘None’                              ‘NULL’
                                    
                                    
*note int: 19b.                     ‘INTEGER’
                                    
                                    
*note float: 196.                   ‘REAL’
                                    
                                    
*note str: 169.                     ‘TEXT’
                                    
                                    
*note bytes: 192.                   ‘BLOB’
                                    

SQLite の型から Python の型へのデフォルトでの変換は以下の通りです:

SQLite の型       Python の型
                  
---------------------------------------------------------------------
                  
‘NULL’            ‘None’
                  
                  
‘INTEGER’         *note int: 19b.
                  
                  
‘REAL’            *note float: 196.
                  
                  
‘TEXT’            *note text_factory: 2da3. に依存する。デフォルト
                  では *note str: 169. 。
                  
                  
‘BLOB’            *note bytes: 192.
                  

‘sqlite3’ モジュールの型システムは 2 つの方法で拡張可能です。 *note
オブジェクト適合関数(adapter): 2d69. を介して SQLite データベースに追加
の Python 型を格納できます。 または、 *note 変換関数(converter): 2d6a. を
介して ‘sqlite3’ モジュールが SQLite 型を Python 型に変換できます。


File: python.info,  Node: デフォルトの適合関数 adapters とデフォルトの変換関数 converters 非推奨,  Next: コマンドライン・インターフェース<2>,  Prev: SQLite と Python の型,  Up: リファレンス

5.12.6.12 デフォルトの適合関数(adapters)とデフォルトの変換関数(converters)(非推奨)
..................................................................................

     注釈: デフォルトの適合関数(adapters)とデフォルトの変換関数
     (converters)は、 Python 3.12 以降非推奨になりました。代わりに、
     *note 適合関数と変換関数のレシピ集: 715. を利用して、あなたのニーズ
     に合わせて仕立てて下さい。

非推奨の、デフォルトの適合関数(adapters)とデフォルトの変換関数
(converters)は以下のもので構成されています:

   * *note datetime.date: 1fa. オブジェクトを ISO 8601(1) 形式の *note
     文字列: 169. にする適合関数(adapter)。

   * *note datetime.datetime: 4e2. オブジェクトを ISO 8601 形式の文字列
     にする適合関数(adapter)。

   * "date" と *note 宣言された: 2d6a. 型を *note datetime.date: 1fa. オ
     ブジェクトにする変換関数(converter)。

   * "timestamp" と宣言された型を *note datetime.datetime: 4e2. オブジェ
     クトにする変換関数(converter)。小数部分は 6 桁 (マイクロ秒の精度) に
     切り捨てられます。

     注釈: デフォルトの "timestamp" 変換関数は、データベース内の UTC オ
     フセットを無視し、常に素朴(naive)な *note datetime.datetime: 4e2. オ
     ブジェクトを返します。 timestamp で UTC オフセットを保持するには、
     変換関数を無効のままにするか、あるいは、オフセット対応の変換関数を
     *note register_converter(): 2d71. に登録します。

バージョン 3.12 で非推奨.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/ISO_8601


File: python.info,  Node: コマンドライン・インターフェース<2>,  Prev: デフォルトの適合関数 adapters とデフォルトの変換関数 converters 非推奨,  Up: リファレンス

5.12.6.13 コマンドライン・インターフェース
..........................................

‘sqlite3’ モジュールは、単純な SQLite シェルを提供するために、インタプリ
タで *note -m: 23c. スイッチを使用してスクリプトとして呼び出すことができ
ます。引数は以下のとおりです:

     python -m sqlite3 [-h] [-v] [filename] [sql]

‘.quit’ または CTRL-D を入力するとシェルを終了(exit)します。

 -- Option: -h, --help

     CLI ヘルプを表示。

 -- Option: -v, --version

     背後の SQLite ライブラリのバージョンを出力します。

Added in version 3.12.


File: python.info,  Node: ハウツー・ガイド,  Next: 説明,  Prev: リファレンス,  Up: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース

5.12.6.14 ハウツー・ガイド
..........................

* Menu:

* プレースホルダを使用して SQL クエリに値を結び付ける方法::
* カスタム Python 型を SQLite 値に適合させる方法::
* SQLite 値をカスタム Python 型に変換する方法::
* 適合関数と変換関数のレシピ集::
* 接続(connection)ショートカット・メソッドの使い方: 接続 connection ショートカット・メソッドの使い方.
* 接続(connection)コンテキストマネージャの使い方: 接続 connection コンテキストマネージャの使い方.
* SQLite URI の操作方法::
* 行工場(row factories)の作成方法と使用方法: 行工場 row factories の作成方法と使用方法.
* How to handle non-UTF-8 text encodings::


File: python.info,  Node: プレースホルダを使用して SQL クエリに値を結び付ける方法,  Next: カスタム Python 型を SQLite 値に適合させる方法,  Up: ハウツー・ガイド

5.12.6.15 プレースホルダを使用して SQL クエリに値を結び付ける方法
.................................................................

たいてい、SQL 操作は Python 変数の値を使う必要があります。しかし、
Python の文字列操作を使用してクエリを組み立てるのはSQLインジェクション攻
撃(SQL injection attacks(1))に対して脆弱なので注意が必要です。たとえば、
攻撃者は以下のように単純にシングルクォートを閉じて ‘OR TRUE’ を挿入して
すべての行を選択できます:

     >>> # Never do this -- insecure!
     >>> symbol = input()
     ' OR TRUE; --
     >>> sql = "SELECT * FROM stocks WHERE symbol = '%s'" % symbol
     >>> print(sql)
     SELECT * FROM stocks WHERE symbol = '' OR TRUE; --'
     >>> cur.execute(sql)

代わりに、DB-API のパラメータ割り当てを使います。クエリ文字列にPythonの
変数を挿入するには、クエリ文字列中でプレースホルダを使用し、 かつ、 カー
ソルの *note execute(): 5b0. メソッドの 2 番目の引数にPythonの変数を値の
*note タプル: 614. として指定することにより、 実際の値をクエリに割り当て
ます。

SQL 文では、疑問符 (qmark スタイル) または名前付きプレースホルダー (名前
付きスタイル) の 2 種類のプレースホルダーのいずれかを使用できます。
qmark スタイルの場合、'parameters' は、 *note シーケンス: 716. でなけれ
ばならず、シーケンスの長さがプレースホルダーの数と一致する必要があります
。そうでなければ、 *note ProgrammingError: 305. を送出します。名前付きス
タイルの場合、 'parameters' は *note dict: 183. (またはそのサブクラス) の
インスタンスである必要があり、すべての名前付きパラメーターのキーが含まれ
ている必要があります。余分な項目は無視されます。両方のスタイルの例を以下
に示します。

     con = sqlite3.connect(":memory:")
     cur = con.execute("CREATE TABLE lang(name, first_appeared)")

     # This is the named style used with executemany():
     data = (
         {"name": "C", "year": 1972},
         {"name": "Fortran", "year": 1957},
         {"name": "Python", "year": 1991},
         {"name": "Go", "year": 2009},
     )
     cur.executemany("INSERT INTO lang VALUES(:name, :year)", data)

     # This is the qmark style used in a SELECT query:
     params = (1972,)
     cur.execute("SELECT * FROM lang WHERE first_appeared = ?", params)
     print(cur.fetchall())
     con.close()

     注釈: PEP 249(2) numeric プレースホルダは 'サポートされていません'
     。 使用すると、名前付きプレースホルダとして解釈されます。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/SQL_injection

   (2) https://peps.python.org/pep-0249/


File: python.info,  Node: カスタム Python 型を SQLite 値に適合させる方法,  Next: SQLite 値をカスタム Python 型に変換する方法,  Prev: プレースホルダを使用して SQL クエリに値を結び付ける方法,  Up: ハウツー・ガイド

5.12.6.16 カスタム Python 型を SQLite 値に適合させる方法
........................................................

SQLite は、 限られたデータ型のみをネイティブにサポートします。 カスタム
Python 型を SQLite データベースに保存するには、 *note SQLite
がネイティブに理解できる Python 型: 2d70. のいずれかに '適合' (adapt)さ
せます。

Python オブジェクトを SQLite の型に適合させる方法は 2 つあります。それは
、オブジェクト自体を適合させる方法と、 'adapter callable' を使用する方法
です。 後者は前者よりも優先されます。 カスタム型をエクスポートするライブ
ラリの場合、 その型がそれ自体を適合させる事ができるようにすることが理に
かなっている場合があります。 アプリケーション開発者としては、カスタム適
合関数を登録して直接制御する方が理にかなっている場合もあります。

* Menu:

* 適合可能オブジェクトの書き方::
* 適合用呼び出し可能オブジェクト(adapter callables)の登録方法: 適合用呼び出し可能オブジェクト adapter callables の登録方法.


File: python.info,  Node: 適合可能オブジェクトの書き方,  Next: 適合用呼び出し可能オブジェクト adapter callables の登録方法,  Up: カスタム Python 型を SQLite 値に適合させる方法

5.12.6.17 適合可能オブジェクトの書き方
......................................

直交座標系(Cartesian coordinate system)で ‘x’ と ‘y’ のペアで座標を表す
、 ‘Point’ クラスがあるとします。 この ‘x’ と ‘y’ のペアはセミコロンで区
切られたテキスト文字列としてデータベースに保存されます。 これは、適合し
た値を返す ‘__conform__(self, protocol)’ メソッドを追加することで実装で
きます。 'protocol' に渡されるオブジェクトは、 *note PrepareProtocol:
1b6b. 型になります。

     class Point:
         def __init__(self, x, y):
             self.x, self.y = x, y

         def __conform__(self, protocol):
             if protocol is sqlite3.PrepareProtocol:
                 return f"{self.x};{self.y}"

     con = sqlite3.connect(":memory:")
     cur = con.cursor()

     cur.execute("SELECT ?", (Point(4.0, -3.2),))
     print(cur.fetchone()[0])
     con.close()


File: python.info,  Node: 適合用呼び出し可能オブジェクト adapter callables の登録方法,  Prev: 適合可能オブジェクトの書き方,  Up: カスタム Python 型を SQLite 値に適合させる方法

5.12.6.18 適合用呼び出し可能オブジェクト(adapter callables)の登録方法
.....................................................................

別の策としては、Python オブジェクトを SQLite 互換の型に変換する関数を作
成することが挙げられます。 この関数は、 *note register_adapter(): 2d7a.
を使用して登録できます。

     class Point:
         def __init__(self, x, y):
             self.x, self.y = x, y

     def adapt_point(point):
         return f"{point.x};{point.y}"

     sqlite3.register_adapter(Point, adapt_point)

     con = sqlite3.connect(":memory:")
     cur = con.cursor()

     cur.execute("SELECT ?", (Point(1.0, 2.5),))
     print(cur.fetchone()[0])
     con.close()


File: python.info,  Node: SQLite 値をカスタム Python 型に変換する方法,  Next: 適合関数と変換関数のレシピ集,  Prev: カスタム Python 型を SQLite 値に適合させる方法,  Up: ハウツー・ガイド

5.12.6.19 SQLite 値をカスタム Python 型に変換する方法
.....................................................

適合関数(adapter)を使用すると、カスタム Python 型から SQLite 値に変換で
きます。SQLite 値 から カスタム Python 型に変換できるようにするためには
、 '変換関数' (converters)を使用します。

それでは ‘Point’ クラスの話に戻るとしましょう。 先程は x 座標と y 座標を
セミコロンで区切られた文字列として SQLite に格納しました。

まず、 文字列をパラメーターとして受け取り、そこから ‘Point’ オブジェクト
を構築する変換関数を定義します。

     注釈: 変換関数には、基になる SQLite データ型に関係なく、 '常に'
     *note bytes: 192. オブジェクトで渡されます。

     def convert_point(s):
         x, y = map(float, s.split(b";"))
         return Point(x, y)

与えられた SQLite 値をどの時点で変換すべきかを ‘sqlite3’ に伝える必要が
あります。これは、 *note connect(): 5a6. の 'detect_types' パラメータを
使用して、データベースに接続する際に行います。 以下の 3 つの選択肢があり
ます:

   * 暗黙的: 'detect_types' に *note PARSE_DECLTYPES: 2d72. と設定。

   * 明示的: 'detect_types' に *note PARSE_COLNAMES: 2d73. と設定。

   * 両方: 'detect_types' に ‘sqlite3.PARSE_DECLTYPES |
     sqlite3.PARSE_COLNAMES’ を設定。列名での指定は、宣言時の型よりも優
     先されます。

以下の例では、暗黙的なアプローチと明示的なアプローチについて表しています
:

     class Point:
         def __init__(self, x, y):
             self.x, self.y = x, y

         def __repr__(self):
             return f"Point({self.x}, {self.y})"

     def adapt_point(point):
         return f"{point.x};{point.y}"

     def convert_point(s):
         x, y = list(map(float, s.split(b";")))
         return Point(x, y)

     # Register the adapter and converter
     sqlite3.register_adapter(Point, adapt_point)
     sqlite3.register_converter("point", convert_point)

     # 1) Parse using declared types
     p = Point(4.0, -3.2)
     con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES)
     cur = con.execute("CREATE TABLE test(p point)")

     cur.execute("INSERT INTO test(p) VALUES(?)", (p,))
     cur.execute("SELECT p FROM test")
     print("with declared types:", cur.fetchone()[0])
     cur.close()
     con.close()

     # 2) Parse using column names
     con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_COLNAMES)
     cur = con.execute("CREATE TABLE test(p)")

     cur.execute("INSERT INTO test(p) VALUES(?)", (p,))
     cur.execute('SELECT p AS "p [point]" FROM test')
     print("with column names:", cur.fetchone()[0])
     cur.close()
     con.close()


File: python.info,  Node: 適合関数と変換関数のレシピ集,  Next: 接続 connection ショートカット・メソッドの使い方,  Prev: SQLite 値をカスタム Python 型に変換する方法,  Up: ハウツー・ガイド

5.12.6.20 適合関数と変換関数のレシピ集
......................................

この節では一般的な適合関数と変換関数のレシピを紹介します。

     import datetime
     import sqlite3

     def adapt_date_iso(val):
         """Adapt datetime.date to ISO 8601 date."""
         return val.isoformat()

     def adapt_datetime_iso(val):
         """Adapt datetime.datetime to timezone-naive ISO 8601 date."""
         return val.replace(tzinfo=None).isoformat()

     def adapt_datetime_epoch(val):
         """Adapt datetime.datetime to Unix timestamp."""
         return int(val.timestamp())

     sqlite3.register_adapter(datetime.date, adapt_date_iso)
     sqlite3.register_adapter(datetime.datetime, adapt_datetime_iso)
     sqlite3.register_adapter(datetime.datetime, adapt_datetime_epoch)

     def convert_date(val):
         """Convert ISO 8601 date to datetime.date object."""
         return datetime.date.fromisoformat(val.decode())

     def convert_datetime(val):
         """Convert ISO 8601 datetime to datetime.datetime object."""
         return datetime.datetime.fromisoformat(val.decode())

     def convert_timestamp(val):
         """Convert Unix epoch timestamp to datetime.datetime object."""
         return datetime.datetime.fromtimestamp(int(val))

     sqlite3.register_converter("date", convert_date)
     sqlite3.register_converter("datetime", convert_datetime)
     sqlite3.register_converter("timestamp", convert_timestamp)


File: python.info,  Node: 接続 connection ショートカット・メソッドの使い方,  Next: 接続 connection コンテキストマネージャの使い方,  Prev: 適合関数と変換関数のレシピ集,  Up: ハウツー・ガイド

5.12.6.21 接続(connection)ショートカット・メソッドの使い方
..........................................................

*note Connection: 54d. クラスのメソッド *note execute(): 2d98. と *note
executemany(): 2d99. と *note executescript(): 2d9a. を使うことで、 (し
ばしば余計な) *note Cursor: 2d64. オブジェクトをわざわざ作り出さずに済む
ので、コードをより簡潔に書くことができます。 *note Cursor: 2d64. オブジ
ェクトは暗黙裡に生成され、ショートカット・メソッドの戻り値として受け取る
ことができます。この方法を使えば、 ‘SELECT’ 文を実行してその結果について
反復することが、 *note Connection: 54d. オブジェクトに対する呼び出し一つ
で行なえます。

     # Create and fill the table.
     con = sqlite3.connect(":memory:")
     con.execute("CREATE TABLE lang(name, first_appeared)")
     data = [
         ("C++", 1985),
         ("Objective-C", 1984),
     ]
     con.executemany("INSERT INTO lang(name, first_appeared) VALUES(?, ?)", data)

     # Print the table contents
     for row in con.execute("SELECT name, first_appeared FROM lang"):
         print(row)

     print("I just deleted", con.execute("DELETE FROM lang").rowcount, "rows")

     # close() is not a shortcut method and it's not called automatically;
     # the connection object should be closed manually
     con.close()


File: python.info,  Node: 接続 connection コンテキストマネージャの使い方,  Next: SQLite URI の操作方法,  Prev: 接続 connection ショートカット・メソッドの使い方,  Up: ハウツー・ガイド

5.12.6.22 接続(connection)コンテキストマネージャの使い方
........................................................

*note Connection: 54d. オブジェクトは、コンテキスト・マネージャーとして
使用でき、コンテキスト・マネージャーとして使用すると、 *note with: 186.
ブロックを離れるときに、開いているトランザクションを自動的にコミットまた
はロールバックします。 *note with: 186. 文のブロックが例外なく終了すると
、トランザクションはコミットされます。このコミットが失敗した、または、
‘with’ 文のブロックでキャッチされなかった例外が発生した場合、トランザク
ションはロールバックされます。 *note autocommit: 6dd. が ‘False’ の場合
、コミット後またはロールバック後に新しいトランザクションが暗黙に開かれま
す。

‘with’ 文のブロックを離れるときに開いているトランザクションがない、また
は、 *note autocommit: 6dd. が ‘True’ の場合、コンテキスト・マネージャは
何も行いません。

     注釈: The context manager neither implicitly opens a new
     transaction nor closes the connection.  If you need a closing
     context manager, consider using *note contextlib.closing(): 15a1.

     con = sqlite3.connect(":memory:")
     con.execute("CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR UNIQUE)")

     # Successful, con.commit() is called automatically afterwards
     with con:
         con.execute("INSERT INTO lang(name) VALUES(?)", ("Python",))

     # con.rollback() is called after the with block finishes with an exception,
     # the exception is still raised and must be caught
     try:
         with con:
             con.execute("INSERT INTO lang(name) VALUES(?)", ("Python",))
     except sqlite3.IntegrityError:
         print("couldn't add Python twice")

     # Connection object used as context manager only commits or rollbacks transactions,
     # so the connection object should be closed manually
     con.close()


File: python.info,  Node: SQLite URI の操作方法,  Next: 行工場 row factories の作成方法と使用方法,  Prev: 接続 connection コンテキストマネージャの使い方,  Up: ハウツー・ガイド

5.12.6.23 SQLite URI の操作方法
...............................

URI の小技をいくつか紹介します:

   * データベースを読み取り専用で開きます:

     >>> con = sqlite3.connect("file:tutorial.db?mode=ro", uri=True)
     >>> con.execute("CREATE TABLE readonly(data)")
     Traceback (most recent call last):
     OperationalError: attempt to write a readonly database
     >>> con.close()

   * まだ存在しない場合、新しいデータベース・ファイルを暗黙に作成しませ
     ん。なお、新しいファイルが作成できない場合には *note
     OperationalError: 1c52. が送出されます:

     >>> con = sqlite3.connect("file:nosuchdb.db?mode=rw", uri=True)
     Traceback (most recent call last):
     OperationalError: unable to open database file

   * 共有の名前付きインメモリ・データベースを作成します:

     db = "file:mem1?mode=memory&cache=shared"
     con1 = sqlite3.connect(db, uri=True)
     con2 = sqlite3.connect(db, uri=True)
     with con1:
         con1.execute("CREATE TABLE shared(data)")
         con1.execute("INSERT INTO shared VALUES(28)")
     res = con2.execute("SELECT data FROM shared")
     assert res.fetchone() == (28,)

     con1.close()
     con2.close()

パラメータのリストを含む、この機能の詳細については、 SQLite URI
documentation(1) を参照してください。

   ---------- Footnotes ----------

   (1) https://www.sqlite.org/uri.html


File: python.info,  Node: 行工場 row factories の作成方法と使用方法,  Next: How to handle non-UTF-8 text encodings,  Prev: SQLite URI の操作方法,  Up: ハウツー・ガイド

5.12.6.24 行工場(row factories)の作成方法と使用方法
...................................................

デフォルトでは、 ‘sqlite3’ は各行(row)を *note タプル: 614. として表しま
す。 ‘タプル’ があなたのニーズと合わない場合は、 *note sqlite3.Row:
1071. クラスまたはカスタム *note row_factory: 2da2. を使用できます。

‘row_factory’ は *note Cursor: 2d64. と *note Connection: 54d. の両方に
属性として存在しますが、 その接続(connection)から作成されたすべてのカー
ソルが同一の行工場(row factory)を使用するようにするために、 *note
Connection.row_factory: 19a5. を設定することをお勧めします。

‘Row’ は、 ‘タプル’ に対してメモリ・オーバーヘッドとパフォーマンスへの影
響を最小限に抑えながら、列(row)へのインデックスによるアクセスと、列への
(大文字と小文字を区別しない)名前によるアクセスを提供します。 ‘Row’ を行
工場(row factory)として使用するには、 ‘row_factory’ 属性に割り当てます:

     >>> con = sqlite3.connect(":memory:")
     >>> con.row_factory = sqlite3.Row

このように設定すると、クエリは ‘Row’ オブジェクトを返すようになります:

     >>> res = con.execute("SELECT 'Earth' AS name, 6378 AS radius")
     >>> row = res.fetchone()
     >>> row.keys()
     ['name', 'radius']
     >>> row[0]         # Access by index.
     'Earth'
     >>> row["name"]    # Access by name.
     'Earth'
     >>> row["RADIUS"]  # Column names are case-insensitive.
     6378
     >>> con.close()

     注釈: The ‘FROM’ clause can be omitted in the ‘SELECT’ statement,
     as in the above example.  In such cases, SQLite returns a single
     row with columns defined by expressions, e.g.  literals, with the
     given aliases ‘expr AS alias’.

各列名が各値にマップされた *note dict: 183. として行を返す、カスタム
*note row_factory: 2da2. を作成することもできます:

     def dict_factory(cursor, row):
         fields = [column[0] for column in cursor.description]
         return {key: value for key, value in zip(fields, row)}

これを使うと、クエリは ‘タプル’ の代わりに ‘dict’ を返すようになります:

     >>> con = sqlite3.connect(":memory:")
     >>> con.row_factory = dict_factory
     >>> for row in con.execute("SELECT 1 AS a, 2 AS b"):
     ...     print(row)
     {'a': 1, 'b': 2}
     >>> con.close()

以下の行工場(row factory)は *note 名前付きタプル: 85e. を返します:

     from collections import namedtuple

     def namedtuple_factory(cursor, row):
         fields = [column[0] for column in cursor.description]
         cls = namedtuple("Row", fields)
         return cls._make(row)

‘namedtuple_factory()’ は以下のようにして使う事ができます:

     >>> con = sqlite3.connect(":memory:")
     >>> con.row_factory = namedtuple_factory
     >>> cur = con.execute("SELECT 1 AS a, 2 AS b")
     >>> row = cur.fetchone()
     >>> row
     Row(a=1, b=2)
     >>> row[0]  # Indexed access.
     1
     >>> row.b   # Attribute access.
     2
     >>> con.close()

上記レシピをチューニングすれば、 *note namedtuple: 4e0. の代わりに *note
dataclass: 4e1. または、その他のカスタム・クラスを使用するように適合
(adapt)させることができます。


File: python.info,  Node: How to handle non-UTF-8 text encodings,  Prev: 行工場 row factories の作成方法と使用方法,  Up: ハウツー・ガイド

5.12.6.25 How to handle non-UTF-8 text encodings
................................................

By default, ‘sqlite3’ uses *note str: 169. to adapt SQLite values with
the ‘TEXT’ data type.  This works well for UTF-8 encoded text, but it
might fail for other encodings and invalid UTF-8.  You can use a custom
*note text_factory: 2da3. to handle such cases.

Because of SQLite's flexible typing(1), it is not uncommon to encounter
table columns with the ‘TEXT’ data type containing non-UTF-8 encodings,
or even arbitrary data.  To demonstrate, let's assume we have a database
with ISO-8859-2 (Latin-2) encoded text, for example a table of
Czech-English dictionary entries.  Assuming we now have a *note
Connection: 54d. instance ‘con’ connected to this database, we can
decode the Latin-2 encoded text using this *note text_factory: 2da3.:

     con.text_factory = lambda data: str(data, encoding="latin2")

For invalid UTF-8 or arbitrary data in stored in ‘TEXT’ table columns,
you can use the following technique, borrowed from the *note Unicode
HOWTO: 14bc.:

     con.text_factory = lambda data: str(data, errors="surrogateescape")

     注釈: The ‘sqlite3’ module API does not support strings containing
     surrogates.

参考
....

*note Unicode HOWTO: 14bc.

   ---------- Footnotes ----------

   (1) https://www.sqlite.org/flextypegood.html


File: python.info,  Node: 説明,  Prev: ハウツー・ガイド,  Up: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース

5.12.6.26 説明
..............

* Menu:

* トランザクション制御::


File: python.info,  Node: トランザクション制御,  Up: 説明

5.12.6.27 トランザクション制御
..............................

‘sqlite3’ は、データベース・トランザクションを開くかどうか、いつ、どのよ
うに開くかを制御する複数の方法を提供します。 *note autocommit
属性に依るトランザクション制御: 6de. が推奨されますが、*note
isolation_level 属性に依るトランザクション制御: 2d75. は Python 3.12 よ
り前の動作を保持します。

* Menu:

* autocommit 属性に依るトランザクション制御::
* isolation_level 属性に依るトランザクション制御::


File: python.info,  Node: autocommit 属性に依るトランザクション制御,  Next: isolation_level 属性に依るトランザクション制御,  Up: トランザクション制御

5.12.6.28 ‘autocommit’ 属性に依るトランザクション制御
.....................................................

トランザクションの動作を制御する推奨方法は、 *note
Connection.autocommit: 6dd. 属性を使用することです。 この属性は *note
connect(): 5a6. の 'autocommit' パラメータを使用して設定して頂けるとあり
がたいです。

'autocommit' を ‘False’ に設定することをお勧めします。そうすると PEP
249(1) 対応のトランザクション制御を行います。これは以下のことを意味しま
す:

   * ‘sqlite3’ はトランザクションが常に開いていることを保証します。その
     ため、 *note connect(): 5a6. や *note Connection.commit(): 2d67. や
     *note Connection.rollback(): 2d97. は暗黙に新しいトランザクションを
     開きます(1つ目については保留中のトランザクションを閉じた直後で、後
     の2つについてはその直後に、です)。 ‘sqlite3’ はトランザクションを開
     くときに ‘BEGIN DEFERRED’ 文を使用します。

   * トランザクションは、 ‘commit()’ を使用して明示的にコミットする必要
     があります。

   * トランザクションは、 ‘rollback()’ を使用して明示的にロールバックす
     る必要があります。

   * データベースの保留中に行った変更は *note close(): 54e. された場合、
     暗黙のロールバックが実行されます。

'autocommit' を ‘True’ に設定して、SQLite の autocommit mode(2) を有効に
します。このモードでは、 *note Connection.commit(): 2d67. と *note
Connection.rollback(): 2d97. は効果がありません。 SQLite の自動コミット
・モード(autocommit mode)は、 PEP 249(3) 対応の *note
Connection.autocommit: 6dd. 属性とは異なることに注意してください。 *note
Connection.in_transaction: 2da1. を使用して、低レベル SQLite 自動コミッ
ト・モードを問い合わせします。

'autocommit' を *note LEGACY_TRANSACTION_CONTROL: 2d76. に設定して、トラ
ンザクション制御の振る舞いを *note Connection.isolation_level: 2d74. 属
性に任せます。詳細については *note isolation_level
属性に依るトランザクション制御: 2d75. を参照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0249/

   (2) 
https://www.sqlite.org/lang_transaction.html#implicit_versus_explicit_transactions

   (3) https://peps.python.org/pep-0249/


File: python.info,  Node: isolation_level 属性に依るトランザクション制御,  Prev: autocommit 属性に依るトランザクション制御,  Up: トランザクション制御

5.12.6.29 ‘isolation_level’ 属性に依るトランザクション制御
..........................................................

     注釈: 推奨のトランザクション制御方法は、 *note autocommit: 6dd. 属
     性を使用することです。 *note autocommit
     属性に依るトランザクション制御: 6de. を参照してください。

*note Connection.autocommit: 6dd. が *note LEGACY_TRANSACTION_CONTROL:
2d76. (これがデフォルトです)に設定されている場合、トランザクションの振る
舞いは *note Connection.isolation_level: 2d74. 属性を使用して制御されま
す。 *note LEGACY_TRANSACTION_CONTROL: 2d76. 以外の場合、
‘isolation_level’ は効果がありません。

接続属性 *note isolation_level: 2d74. が ‘None’ で無いのなら、 *note
execute(): 5b0. や *note executemany(): 5b1. が ‘INSERT’ または ‘UPDATE’
または ‘DELETE’ または ‘REPLACE’ 文を実行する前に新しいトランザクション
が暗黙に開かれます。それ以外のSQL文では暗黙のトランザクション処理は行わ
れません。 *note commit(): 2d67. メソッドや *note rollback(): 2d97. メソ
ッドを使用して、 保留中のトランザクションをそれぞれコミットおよびロール
バックします。あなたは、背後にある SQLite ライブラリのトランザクションの
振る舞い(SQLite transaction behaviour(1)) — つまり、 sqlite3 が暗黙に実
行する ‘BEGIN’ 文の有無とその種類 – を、 *note isolation_level: 2d74. 属
性を介して選択できます。

*note isolation_level: 2d74. が ‘None’ に設定されていると、トランザクシ
ョンは暗黙に開かれません。これにより、背後にある SQLite ライブラリを自動
コミット・モード(autocommit mode(2))にしたまま、 明示的な SQL 文を使用し
て、 ユーザが独自のトランザクション処理を行えるようにします。背後にある
SQLite ライブラリの自動コミット・モードは、 *note in_transaction: 2da1.
属性を使用して問い合わせできます。

*note executescript(): 2d9b. メソッドは、 *note isolation_level: 2d74. の
値に関係なく、与えられた SQL スクリプトの実行前に、保留中のトランザクシ
ョンを暗黙にコミットします。

バージョン 3.6 で変更: ‘sqlite3’ は、 DDL文の前に、開いているトランザク
ションを暗黙にコミットしていました。これはもはや当てはまりません。

バージョン 3.12 で変更: 推奨のトランザクションを制御方法は、 *note
autocommit: 6dd. 属性を使用することです。

   ---------- Footnotes ----------

   (1) 
https://www.sqlite.org/lang_transaction.html#deferred_immediate_and_exclusive_transactions

   (2) 
https://www.sqlite.org/lang_transaction.html#implicit_versus_explicit_transactions


File: python.info,  Node: データ圧縮とアーカイブ,  Next: ファイルフォーマット,  Prev: データの永続化,  Up: Python 標準ライブラリ

5.13 データ圧縮とアーカイブ
===========================

The modules described in this chapter support data compression with the
zlib, gzip, bzip2, lzma, and zstd algorithms, and the creation of ZIP-
and tar-format archives.  See also *note アーカイブ化操作: 1431.
provided by the *note shutil: ca. module.

* Menu:

* compression パッケージ::
* compression.zstd: compression zstd --- Compression compatible with the Zstandard format. Compression compatible with the Zstandard format
* zlib: zlib --- gzip 互換の圧縮. gzip 互換の圧縮
* gzip: gzip --- gzip ファイルのサポート. gzip ファイルのサポート
* bz2: bz2 --- bzip2 圧縮のサポート. bzip2 圧縮のサポート
* lzma: lzma --- LZMA アルゴリズムを使用した圧縮. LZMA アルゴリズムを使用した圧縮
* zipfile: zipfile --- ZIP アーカイブの処理. ZIP アーカイブの処理
* tarfile: tarfile --- tar アーカイブファイルの読み書き. tar アーカイブファイルの読み書き


File: python.info,  Node: compression パッケージ,  Next: compression zstd --- Compression compatible with the Zstandard format,  Up: データ圧縮とアーカイブ

5.13.1 ‘compression’ パッケージ
-------------------------------

Added in version 3.14.

The ‘compression’ package contains the canonical compression modules
containing interfaces to several different compression algorithms.  Some
of these modules have historically been available as separate modules;
those will continue to be available under their original names for
compatibility reasons, and will not be removed without a deprecation
cycle.  The use of modules in ‘compression’ is encouraged where
practical.

   * ‘compression.bz2’ - Re-exports *note bz2: 14.

   * ‘compression.gzip’ - Re-exports *note gzip: 6b.

   * ‘compression.lzma’ - Re-exports *note lzma: 8e.

   * ‘compression.zlib’ - Re-exports *note zlib: 139.

   * *note compression.zstd: 23. - Wrapper for the Zstandard compression
     library


File: python.info,  Node: compression zstd --- Compression compatible with the Zstandard format,  Next: zlib --- gzip 互換の圧縮,  Prev: compression パッケージ,  Up: データ圧縮とアーカイブ

5.13.2 ‘compression.zstd’ -- Compression compatible with the Zstandard format
-----------------------------------------------------------------------------

Added in version 3.14.

'Source code:' Lib/compression/zstd/__init__.py(1)

__________________________________________________________________

This module provides classes and functions for compressing and
decompressing data using the Zstandard (or 'zstd') compression
algorithm.  The zstd manual(2) describes Zstandard as "a fast lossless
compression algorithm, targeting real-time compression scenarios at
zlib-level and better compression ratios."  Also included is a file
interface that supports reading and writing the contents of ‘.zst’ files
created by the ‘zstd’ utility, as well as raw zstd compressed streams.

The ‘compression.zstd’ module contains:

   * The *note open(): 2ddc. function and *note ZstdFile: 2ddd. class
     for reading and writing compressed files.

   * The *note ZstdCompressor: 2dde. and *note ZstdDecompressor: 2ddf.
     classes for incremental (de)compression.

   * 一度に圧縮・展開を行う *note compress(): 2de0. および *note
     decompress(): 2de1. 関数。

   * The *note train_dict(): 2de2. and *note finalize_dict(): 2de3.
     functions and the *note ZstdDict: 2de4. class to train and manage
     Zstandard dictionaries.

   * The *note CompressionParameter: 2de5, *note DecompressionParameter:
     2de6, and *note Strategy: 2de7. classes for setting advanced
     (de)compression parameters.

This is an *note optional module: 215a.  If it is missing from your copy
of CPython, look for documentation from your distributor (that is,
whoever provided Python to you).  If you are the distributor, see *note
オプションのモジュールの要件: 2158.

* Menu:

* 例外: 例外<8>.
* 圧縮ファイルへの読み書き::
* メモリ上での圧縮と展開::
* Zstandard dictionaries::
* Advanced parameter control::
* その他: その他<3>.
* 使用例: 使用例<14>.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/compression/zstd/__init__.py

   (2) https://facebook.github.io/zstd/doc/api_manual_latest.html


File: python.info,  Node: 例外<8>,  Next: 圧縮ファイルへの読み書き,  Up: compression zstd --- Compression compatible with the Zstandard format

5.13.2.1 例外
.............

 -- 例外: compression.zstd.ZstdError

     This exception is raised when an error occurs during compression or
     decompression, or while initializing the (de)compressor state.


File: python.info,  Node: 圧縮ファイルへの読み書き,  Next: メモリ上での圧縮と展開,  Prev: 例外<8>,  Up: compression zstd --- Compression compatible with the Zstandard format

5.13.2.2 圧縮ファイルへの読み書き
.................................

 -- の関数: compression.zstd.open (file, /, mode='rb', *, level=None,
          options=None, zstd_dict=None, encoding=None, errors=None,
          newline=None)

     Open a Zstandard-compressed file in binary or text mode, returning
     a *note file object: 13db.

     The 'file' argument can be either a file name (given as a *note
     str: 169, *note bytes: 192. or *note path-like: 5a1. object), in
     which case the named file is opened, or it can be an existing file
     object to read from or write to.

     The mode argument can be either ‘'rb'’ for reading (default),
     ‘'wb'’ for overwriting, ‘'ab'’ for appending, or ‘'xb'’ for
     exclusive creation.  These can equivalently be given as ‘'r'’,
     ‘'w'’, ‘'a'’, and ‘'x'’ respectively.  You may also open in text
     mode with ‘'rt'’, ‘'wt'’, ‘'at'’, and ‘'xt'’ respectively.

     When reading, the 'options' argument can be a dictionary providing
     advanced decompression parameters; see *note
     DecompressionParameter: 2de6. for detailed information about
     supported parameters.  The 'zstd_dict' argument is a *note
     ZstdDict: 2de4. instance to be used during decompression.  When
     reading, if the 'level' argument is not None, a ‘TypeError’ will be
     raised.

     When writing, the 'options' argument can be a dictionary providing
     advanced compression parameters; see *note CompressionParameter:
     2de5. for detailed information about supported parameters.  The
     'level' argument is the compression level to use when writing
     compressed data.  Only one of 'level' or 'options' may be non-None.
     The 'zstd_dict' argument is a *note ZstdDict: 2de4. instance to be
     used during compression.

     In binary mode, this function is equivalent to the *note ZstdFile:
     2ddd. constructor: ‘ZstdFile(file, mode, ...)’.  In this case, the
     'encoding', 'errors', and 'newline' parameters must not be
     provided.

     In text mode, a *note ZstdFile: 2ddd. object is created, and
     wrapped in an *note io.TextIOWrapper: 9be. instance with the
     specified encoding, error handling behavior, and line endings.

 -- クラス: compression.zstd.ZstdFile (file, /, mode='rb', *,
          level=None, options=None, zstd_dict=None)

     Open a Zstandard-compressed file in binary mode.

     A *note ZstdFile: 2ddd. can wrap an already-open *note file object:
     13db, or operate directly on a named file.  The 'file' argument
     specifies either the file object to wrap, or the name of the file
     to open (as a *note str: 169, *note bytes: 192. or *note path-like:
     5a1. object).  If wrapping an existing file object, the wrapped
     file will not be closed when the *note ZstdFile: 2ddd. is closed.

     The 'mode' argument can be either ‘'rb'’ for reading (default),
     ‘'wb'’ for overwriting, ‘'xb'’ for exclusive creation, or ‘'ab'’
     for appending.  These can equivalently be given as ‘'r'’, ‘'w'’,
     ‘'x'’ and ‘'a'’ respectively.

     If 'file' is a file object (rather than an actual file name), a
     mode of ‘'w'’ does not truncate the file, and is instead equivalent
     to ‘'a'’.

     When reading, the 'options' argument can be a dictionary providing
     advanced decompression parameters; see *note
     DecompressionParameter: 2de6. for detailed information about
     supported parameters.  The 'zstd_dict' argument is a *note
     ZstdDict: 2de4. instance to be used during decompression.  When
     reading, if the 'level' argument is not None, a ‘TypeError’ will be
     raised.

     When writing, the 'options' argument can be a dictionary providing
     advanced compression parameters; see *note CompressionParameter:
     2de5. for detailed information about supported parameters.  The
     'level' argument is the compression level to use when writing
     compressed data.  Only one of 'level' or 'options' may be passed.
     The 'zstd_dict' argument is a *note ZstdDict: 2de4. instance to be
     used during compression.

     ‘ZstdFile’ supports all the members specified by *note
     io.BufferedIOBase: 8a3, except for *note detach(): 2deb. and *note
     truncate(): 1528.  Iteration and the *note with: 186. statement are
     supported.

     以下のメソッドと属性も提供されています:

      -- メソッド: peek (size=-1)

          ファイル上の現在位置を変更せずにバッファのデータを返します。
          EOF に達しない限り、少なくとも 1 バイトが返されます。返される
          正確なバイト数は規定されていません (引数 'size' は無視されます
          )。

               注釈: While calling *note peek(): 2dec. does not change
               the file position of the *note ZstdFile: 2ddd, it may
               change the position of the underlying file object (for
               example, if the *note ZstdFile: 2ddd. was constructed by
               passing a file object for 'file').

      -- の属性: mode

          ‘'rb'’ は読み込み用、 ‘'wb'’ は書き込み用です。

      -- の属性: name

          The name of the Zstandard file.  Equivalent to the *note name:
          2def. attribute of the underlying *note file object: 13db.


File: python.info,  Node: メモリ上での圧縮と展開,  Next: Zstandard dictionaries,  Prev: 圧縮ファイルへの読み書き,  Up: compression zstd --- Compression compatible with the Zstandard format

5.13.2.3 メモリ上での圧縮と展開
...............................

 -- の関数: compression.zstd.compress (data, level=None, options=None,
          zstd_dict=None)

     Compress 'data' (a *note bytes-like object: 193.), returning the
     compressed data as a *note bytes: 192. object.

     The 'level' argument is an integer controlling the level of
     compression.  'level' is an alternative to setting *note
     CompressionParameter.compression_level: 2df1. in 'options'.  Use
     *note bounds(): 2df2. on *note compression_level: 2df1. to get the
     values that can be passed for 'level'.  If advanced compression
     options are needed, the 'level' argument must be omitted and in the
     'options' dictionary the ‘CompressionParameter.compression_level’
     parameter should be set.

     The 'options' argument is a Python dictionary containing advanced
     compression parameters.  The valid keys and values for compression
     parameters are documented as part of the *note
     CompressionParameter: 2de5. documentation.

     The 'zstd_dict' argument is an instance of *note ZstdDict: 2de4.
     containing trained data to improve compression efficiency.  The
     function *note train_dict(): 2de2. can be used to generate a
     Zstandard dictionary.

 -- の関数: compression.zstd.decompress (data, zstd_dict=None,
          options=None)

     Decompress 'data' (a *note bytes-like object: 193.), returning the
     uncompressed data as a *note bytes: 192. object.

     The 'options' argument is a Python dictionary containing advanced
     decompression parameters.  The valid keys and values for
     compression parameters are documented as part of the *note
     DecompressionParameter: 2de6. documentation.

     The 'zstd_dict' argument is an instance of *note ZstdDict: 2de4.
     containing trained data used during compression.  This must be the
     same Zstandard dictionary used during compression.

     If 'data' is the concatenation of multiple distinct compressed
     frames, decompress all of these frames, and return the
     concatenation of the results.

 -- クラス: compression.zstd.ZstdCompressor (level=None, options=None,
          zstd_dict=None)

     データをインクリメンタルに圧縮する圧縮オブジェクトを作成します。

     For a more convenient way of compressing a single chunk of data,
     see the module-level function *note compress(): 2de0.

     The 'level' argument is an integer controlling the level of
     compression.  'level' is an alternative to setting *note
     CompressionParameter.compression_level: 2df1. in 'options'.  Use
     *note bounds(): 2df2. on *note compression_level: 2df1. to get the
     values that can be passed for 'level'.  If advanced compression
     options are needed, the 'level' argument must be omitted and in the
     'options' dictionary the ‘CompressionParameter.compression_level’
     parameter should be set.

     The 'options' argument is a Python dictionary containing advanced
     compression parameters.  The valid keys and values for compression
     parameters are documented as part of the *note
     CompressionParameter: 2de5. documentation.

     The 'zstd_dict' argument is an optional instance of *note ZstdDict:
     2de4. containing trained data to improve compression efficiency.
     The function *note train_dict(): 2de2. can be used to generate a
     Zstandard dictionary.

      -- メソッド: compress (data, mode=ZstdCompressor.CONTINUE)

          Compress 'data' (a *note bytes-like object: 193.), returning a
          *note bytes: 192. object with compressed data if possible, or
          otherwise an empty ‘bytes’ object.  Some of 'data' may be
          buffered internally, for use in later calls to ‘compress()’
          and *note flush(): 2df4.  The returned data should be
          concatenated with the output of any previous calls to *note
          compress(): 2df3.

          The 'mode' argument is a *note ZstdCompressor: 2dde.
          attribute, either *note CONTINUE: 2df5, *note FLUSH_BLOCK:
          2df6, or *note FLUSH_FRAME: 2df7.

          When all data has been provided to the compressor, call the
          *note flush(): 2df4. method to finish the compression process.
          If *note compress(): 2df3. is called with 'mode' set to *note
          FLUSH_FRAME: 2df7, *note flush(): 2df4. should not be called,
          as it would write out a new empty frame.

      -- メソッド: flush (mode=ZstdCompressor.FLUSH_FRAME)

          圧縮処理を終了し、コンプレッサの内部バッファにあるあらゆるデー
          タを格納する *note bytes: 192. オブジェクトを返します。

          The 'mode' argument is a *note ZstdCompressor: 2dde.
          attribute, either *note FLUSH_BLOCK: 2df6, or *note
          FLUSH_FRAME: 2df7.

      -- メソッド: set_pledged_input_size (size)

          Specify the amount of uncompressed data 'size' that will be
          provided for the next frame.  'size' will be written into the
          frame header of the next frame unless *note
          CompressionParameter.content_size_flag: 2df9. is ‘False’ or
          ‘0’.  A size of ‘0’ means that the frame is empty.  If 'size'
          is ‘None’, the frame header will omit the frame size.  Frames
          that include the uncompressed data size require less memory to
          decompress, especially at higher compression levels.

          If *note last_mode: 2dfa. is not *note FLUSH_FRAME: 2df7, a
          *note ValueError: 2ec. is raised as the compressor is not at
          the start of a frame.  If the pledged size does not match the
          actual size of data provided to *note compress(): 2df3, future
          calls to ‘compress()’ or *note flush(): 2df4. may raise *note
          ZstdError: 2de9. and the last chunk of data may be lost.

          After *note flush(): 2df4. or *note compress(): 2df3. are
          called with mode *note FLUSH_FRAME: 2df7, the next frame will
          not include the frame size into the header unless
          ‘set_pledged_input_size()’ is called again.

      -- の属性: CONTINUE

          Collect more data for compression, which may or may not
          generate output immediately.  This mode optimizes the
          compression ratio by maximizing the amount of data per block
          and frame.

      -- の属性: FLUSH_BLOCK

          Complete and write a block to the data stream.  The data
          returned so far can be immediately decompressed.  Past data
          can still be referenced in future blocks generated by calls to
          *note compress(): 2df3, improving compression.

      -- の属性: FLUSH_FRAME

          Complete and write out a frame.  Future data provided to *note
          compress(): 2df3. will be written into a new frame and
          'cannot' reference past data.

      -- の属性: last_mode

          The last mode passed to either *note compress(): 2df3. or
          *note flush(): 2df4.  The value can be one of *note CONTINUE:
          2df5, *note FLUSH_BLOCK: 2df6, or *note FLUSH_FRAME: 2df7.
          The initial value is *note FLUSH_FRAME: 2df7, signifying that
          the compressor is at the start of a new frame.

 -- クラス: compression.zstd.ZstdDecompressor (zstd_dict=None,
          options=None)

     データをインクリメンタルに展開するために使用できる展開オブジェクト
     を作成します。

     For a more convenient way of decompressing an entire compressed
     stream at once, see the module-level function *note decompress():
     2de1.

     The 'options' argument is a Python dictionary containing advanced
     decompression parameters.  The valid keys and values for
     compression parameters are documented as part of the *note
     DecompressionParameter: 2de6. documentation.

     The 'zstd_dict' argument is an instance of *note ZstdDict: 2de4.
     containing trained data used during compression.  This must be the
     same Zstandard dictionary used during compression.

          注釈: This class does not transparently handle inputs
          containing multiple compressed frames, unlike the *note
          decompress(): 2de1. function and *note ZstdFile: 2ddd. class.
          To decompress a multi-frame input, you should use *note
          decompress(): 2de1, *note ZstdFile: 2ddd. if working with a
          *note file object: 13db, or multiple ‘ZstdDecompressor’
          instances.

      -- メソッド: decompress (data, max_length=-1)

          Decompress 'data' (a *note bytes-like object: 193.), returning
          uncompressed data as bytes.  Some of 'data' may be buffered
          internally, for use in later calls to ‘decompress()’.  The
          returned data should be concatenated with the output of any
          previous calls to ‘decompress()’.

          If 'max_length' is non-negative, the method returns at most
          'max_length' bytes of decompressed data.  If this limit is
          reached and further output can be produced, the *note
          needs_input: 2dfc. attribute will be set to ‘False’.  In this
          case, the next call to *note decompress(): 2dfb. may provide
          'data' as ‘b''’ to obtain more of the output.

          入力データの全てが圧縮され返された ('max_length' バイトより少
          ないためか 'max_length' が負のため) 場合、 *note needs_input:
          2dfc. 属性は ‘True’ になります。

          Attempting to decompress data after the end of a frame will
          raise a *note ZstdError: 2de9.  Any data found after the end
          of the frame is ignored and saved in the *note unused_data:
          2dfd. attribute.

      -- の属性: eof

          ストリーム終端記号に到達した場合 ‘True’ を返します。

      -- の属性: unused_data

          圧縮ストリームの末尾以降に存在したデータを表します。

          Before the end of the stream is reached, this will be ‘b''’.

      -- の属性: needs_input

          ‘False’ if the *note decompress(): 2dfb. method can provide
          more decompressed data before requiring new compressed input.


File: python.info,  Node: Zstandard dictionaries,  Next: Advanced parameter control,  Prev: メモリ上での圧縮と展開,  Up: compression zstd --- Compression compatible with the Zstandard format

5.13.2.4 Zstandard dictionaries
...............................

 -- の関数: compression.zstd.train_dict (samples, dict_size)

     Train a Zstandard dictionary, returning a *note ZstdDict: 2de4.
     instance.  Zstandard dictionaries enable more efficient compression
     of smaller sizes of data, which is traditionally difficult to
     compress due to less repetition.  If you are compressing multiple
     similar groups of data (such as similar files), Zstandard
     dictionaries can improve compression ratios and speed
     significantly.

     The 'samples' argument (an iterable of *note bytes: 192. objects),
     is the population of samples used to train the Zstandard
     dictionary.

     The 'dict_size' argument, an integer, is the maximum size (in
     bytes) the Zstandard dictionary should be.  The Zstandard
     documentation suggests an absolute maximum of no more than 100 KB,
     but the maximum can often be smaller depending on the data.  Larger
     dictionaries generally slow down compression, but improve
     compression ratios.  Smaller dictionaries lead to faster
     compression, but reduce the compression ratio.

 -- の関数: compression.zstd.finalize_dict (zstd_dict, /, samples,
          dict_size, level)

     An advanced function for converting a "raw content" Zstandard
     dictionary into a regular Zstandard dictionary.  "Raw content"
     dictionaries are a sequence of bytes that do not need to follow the
     structure of a normal Zstandard dictionary.

     The 'zstd_dict' argument is a *note ZstdDict: 2de4. instance with
     the *note dict_content: 2e00. containing the raw dictionary
     contents.

     The 'samples' argument (an iterable of *note bytes: 192. objects),
     contains sample data for generating the Zstandard dictionary.

     The 'dict_size' argument, an integer, is the maximum size (in
     bytes) the Zstandard dictionary should be.  See *note train_dict():
     2de2. for suggestions on the maximum dictionary size.

     The 'level' argument (an integer) is the compression level expected
     to be passed to the compressors using this dictionary.  The
     dictionary information varies for each compression level, so tuning
     for the proper compression level can make compression more
     efficient.

 -- クラス: compression.zstd.ZstdDict (dict_content, /, *, is_raw=False)

     A wrapper around Zstandard dictionaries.  Dictionaries can be used
     to improve the compression of many small chunks of data.  Use *note
     train_dict(): 2de2. if you need to train a new dictionary from
     sample data.

     The 'dict_content' argument (a *note bytes-like object: 193.), is
     the already trained dictionary information.

     The 'is_raw' argument, a boolean, is an advanced parameter
     controlling the meaning of 'dict_content'.  ‘True’ means
     'dict_content' is a "raw content" dictionary, without any format
     restrictions.  ‘False’ means 'dict_content' is an ordinary
     Zstandard dictionary, created from Zstandard functions, for
     example, *note train_dict(): 2de2. or the external ‘zstd’ CLI.

     When passing a ‘ZstdDict’ to a function, the ‘as_digested_dict’ and
     ‘as_undigested_dict’ attributes can control how the dictionary is
     loaded by passing them as the ‘zstd_dict’ argument, for example,
     ‘compress(data, zstd_dict=zd.as_digested_dict)’.  Digesting a
     dictionary is a costly operation that occurs when loading a
     Zstandard dictionary.  When making multiple calls to compression or
     decompression, passing a digested dictionary will reduce the
     overhead of loading the dictionary.

          Difference for compression

                         Digested           Undigested
                         dictionary         dictionary
                                            
          -------------------------------------------------
                                            
          Advanced       ‘window_log’,      None
          parameters     ‘hash_log’,        
          of the         ‘chain_log’,
          compressor     ‘search_log’,
          which may be   ‘min_match’,
          overridden     ‘target_length’,
          by the         ‘strategy’,
          dictionary's   ‘enable_long_distance_matching’,
          parameters     ‘ldm_hash_log’,
                         ‘ldm_min_match’,
                         ‘ldm_bucket_size_log’,
                         ‘ldm_hash_rate_log’,
                         and some
                         non-public
                         parameters.
                         
                                            
          ‘ZstdDict’     Yes.  It's         No.  If you
          internally     faster when        wish to load
          caches the     loading a          an
          dictionary     digested           undigested
                         dictionary again   dictionary
                         with the same      multiple
                         compression        times,
                         level.             consider
                                            reusing a
                                            compressor
                                            object.
                                            

     If passing a ‘ZstdDict’ without any attribute, an undigested
     dictionary is passed by default when compressing and a digested
     dictionary is generated if necessary and passed by default when
     decompressing.

           -- の属性: dict_content

               The content of the Zstandard dictionary, a ‘bytes’
               object.  It's the same as the 'dict_content' argument in
               the ‘__init__’ method.  It can be used with other
               programs, such as the ‘zstd’ CLI program.

           -- の属性: dict_id

               Identifier of the Zstandard dictionary, a non-negative
               int value.

               Non-zero means the dictionary is ordinary, created by
               Zstandard functions and following the Zstandard format.

               ‘0’ means a "raw content" dictionary, free of any format
               restriction, used for advanced users.

                    注釈: The meaning of ‘0’ for ‘ZstdDict.dict_id’ is
                    different from the ‘dictionary_id’ attribute to the
                    *note get_frame_info(): 2e02. function.

           -- の属性: as_digested_dict

               Load as a digested dictionary.

           -- の属性: as_undigested_dict

               Load as an undigested dictionary.


File: python.info,  Node: Advanced parameter control,  Next: その他<3>,  Prev: Zstandard dictionaries,  Up: compression zstd --- Compression compatible with the Zstandard format

5.13.2.5 Advanced parameter control
...................................

 -- クラス: compression.zstd.CompressionParameter

     An *note IntEnum: edb. containing the advanced compression
     parameter keys that can be used when compressing data.

     The *note bounds(): 2df2. method can be used on any attribute to
     get the valid values for that parameter.

     Parameters are optional; any omitted parameter will have it's value
     selected automatically.

     Example getting the lower and upper bound of *note
     compression_level: 2df1.:

          lower, upper = CompressionParameter.compression_level.bounds()

     Example setting the *note window_log: 2e06. to the maximum size:

          _lower, upper = CompressionParameter.window_log.bounds()
          options = {CompressionParameter.window_log: upper}
          compress(b'venezuelan beaver cheese', options=options)

      -- メソッド: bounds ()

          Return the tuple of int bounds, ‘(lower, upper)’, of a
          compression parameter.  This method should be called on the
          attribute you wish to retrieve the bounds of.  For example, to
          get the valid values for *note compression_level: 2df1, one
          may check the result of
          ‘CompressionParameter.compression_level.bounds()’.

          Both the lower and upper bounds are inclusive.

      -- の属性: compression_level

          A high-level means of setting other compression parameters
          that affect the speed and ratio of compressing data.

          Regular compression levels are greater than ‘0’.  Values
          greater than ‘20’ are considered "ultra" compression and
          require more memory than other levels.  Negative values can be
          used to trade off faster compression for worse compression
          ratios.

          Setting the level to zero uses *note
          COMPRESSION_LEVEL_DEFAULT: 2e07.

      -- の属性: window_log

          Maximum allowed back-reference distance the compressor can use
          when compressing data, expressed as power of two, ‘1 <<
          window_log’ bytes.  This parameter greatly influences the
          memory usage of compression.  Higher values require more
          memory but gain better compression values.

          A value of zero causes the value to be selected automatically.

      -- の属性: hash_log

          Size of the initial probe table, as a power of two.  The
          resulting memory usage is ‘1 << (hash_log+2)’ bytes.  Larger
          tables improve compression ratio of strategies <= *note dfast:
          2e09, and improve compression speed of strategies > *note
          dfast: 2e09.

          A value of zero causes the value to be selected automatically.

      -- の属性: chain_log

          Size of the multi-probe search table, as a power of two.  The
          resulting memory usage is ‘1 << (chain_log+2)’ bytes.  Larger
          tables result in better and slower compression.  This
          parameter has no effect for the *note fast: 2e0b. strategy.
          It's still useful when using *note dfast: 2e09. strategy, in
          which case it defines a secondary probe table.

          A value of zero causes the value to be selected automatically.

      -- の属性: search_log

          Number of search attempts, as a power of two.  More attempts
          result in better and slower compression.  This parameter is
          useless for *note fast: 2e0b. and *note dfast: 2e09.
          strategies.

          A value of zero causes the value to be selected automatically.

      -- の属性: min_match

          Minimum size of searched matches.  Larger values increase
          compression and decompression speed, but decrease ratio.  Note
          that Zstandard can still find matches of smaller size, it just
          tweaks its search algorithm to look for this size and larger.
          For all strategies < *note btopt: 2e0e, the effective minimum
          is ‘4’; for all strategies > *note fast: 2e0b, the effective
          maximum is ‘6’.

          A value of zero causes the value to be selected automatically.

      -- の属性: target_length

          The impact of this field depends on the selected *note
          Strategy: 2de7.

          For strategies *note btopt: 2e0e, *note btultra: 2e10. and
          *note btultra2: 2e11, the value is the length of a match
          considered "good enough" to stop searching.  Larger values
          make compression ratios better, but compresses slower.

          For strategy *note fast: 2e0b, it is the distance between
          match sampling.  Larger values make compression faster, but
          with a worse compression ratio.

          A value of zero causes the value to be selected automatically.

      -- の属性: strategy

          The higher the value of selected strategy, the more complex
          the compression technique used by zstd, resulting in higher
          compression ratios but slower compression.

          参考
          ....

          *note Strategy: 2de7.

      -- の属性: enable_long_distance_matching

          Long distance matching can be used to improve compression for
          large inputs by finding large matches at greater distances.
          It increases memory usage and window size.

          ‘True’ or ‘1’ enable long distance matching while ‘False’ or
          ‘0’ disable it.

          Enabling this parameter increases default *note window_log:
          2e06. to 128 MiB except when expressly set to a different
          value.  This setting is enabled by default if ‘window_log’ >=
          128 MiB and the compression strategy >= *note btopt: 2e0e.
          (compression level 16+).

      -- の属性: ldm_hash_log

          Size of the table for long distance matching, as a power of
          two.  Larger values increase memory usage and compression
          ratio, but decrease compression speed.

          A value of zero causes the value to be selected automatically.

      -- の属性: ldm_min_match

          Minimum match size for long distance matcher.  Larger or too
          small values can often decrease the compression ratio.

          A value of zero causes the value to be selected automatically.

      -- の属性: ldm_bucket_size_log

          Log size of each bucket in the long distance matcher hash
          table for collision resolution.  Larger values improve
          collision resolution but decrease compression speed.

          A value of zero causes the value to be selected automatically.

      -- の属性: ldm_hash_rate_log

          Frequency of inserting/looking up entries into the long
          distance matcher hash table.  Larger values improve
          compression speed.  Deviating far from the default value will
          likely result in a compression ratio decrease.

          A value of zero causes the value to be selected automatically.

      -- の属性: content_size_flag

          Write the size of the data to be compressed into the Zstandard
          frame header when known prior to compressing.

          This flag only takes effect under the following scenarios:

             * Calling *note compress(): 2de0. for one-shot compression

             * Providing all of the data to be compressed in the frame
               in a single *note ZstdCompressor.compress(): 2df3. call,
               with the *note ZstdCompressor.FLUSH_FRAME: 2df7. mode.

             * Calling *note ZstdCompressor.set_pledged_input_size():
               2df8. with the exact amount of data that will be provided
               to the compressor prior to any calls to *note
               ZstdCompressor.compress(): 2df3. for the current frame.
               ‘ZstdCompressor.set_pledged_input_size()’ must be called
               for each new frame.

          All other compression calls may not write the size information
          into the frame header.

          ‘True’ or ‘1’ enable the content size flag while ‘False’ or
          ‘0’ disable it.

      -- の属性: checksum_flag

          A four-byte checksum using XXHash64 of the uncompressed
          content is written at the end of each frame.  Zstandard's
          decompression code verifies the checksum.  If there is a
          mismatch a *note ZstdError: 2de9. exception is raised.

          ‘True’ or ‘1’ enable checksum generation while ‘False’ or ‘0’
          disable it.

      -- の属性: dict_id_flag

          When compressing with a *note ZstdDict: 2de4, the dictionary's
          ID is written into the frame header.

          ‘True’ or ‘1’ enable storing the dictionary ID while ‘False’
          or ‘0’ disable it.

      -- の属性: nb_workers

          Select how many threads will be spawned to compress in
          parallel.  When ‘nb_workers’ > 0, enables multi-threaded
          compression, a value of ‘1’ means "one-thread multi-threaded
          mode".  More workers improve speed, but also increase memory
          usage and slightly reduce compression ratio.

          A value of zero disables multi-threading.

      -- の属性: job_size

          Size of a compression job, in bytes.  This value is enforced
          only when *note nb_workers: 2e1a. >= 1.  Each compression job
          is completed in parallel, so this value can indirectly impact
          the number of active threads.

          A value of zero causes the value to be selected automatically.

      -- の属性: overlap_log

          Sets how much data is reloaded from previous jobs (threads)
          for new jobs to be used by the look behind window during
          compression.  This value is only used when *note nb_workers:
          2e1a. >= 1.  Acceptable values vary from 0 to 9.

                  * 0 means dynamically set the overlap amount

                  * 1 means no overlap

                  * 9 means use a full window size from the previous job

          Each increment halves/doubles the overlap size.  "8" means an
          overlap of ‘window_size/2’, "7" means an overlap of
          ‘window_size/4’, etc.

 -- クラス: compression.zstd.DecompressionParameter

     An *note IntEnum: edb. containing the advanced decompression
     parameter keys that can be used when decompressing data.
     Parameters are optional; any omitted parameter will have it's value
     selected automatically.

     The *note bounds(): 2e1d. method can be used on any attribute to
     get the valid values for that parameter.

     Example setting the *note window_log_max: 2e1e. to the maximum
     size:

          data = compress(b'Some very long buffer of bytes...')

          _lower, upper = DecompressionParameter.window_log_max.bounds()

          options = {DecompressionParameter.window_log_max: upper}
          decompress(data, options=options)

      -- メソッド: bounds ()

          Return the tuple of int bounds, ‘(lower, upper)’, of a
          decompression parameter.  This method should be called on the
          attribute you wish to retrieve the bounds of.

          Both the lower and upper bounds are inclusive.

      -- の属性: window_log_max

          The base-two logarithm of the maximum size of the window used
          during decompression.  This can be useful to limit the amount
          of memory used when decompressing data.  A larger maximum
          window size leads to faster decompression.

          A value of zero causes the value to be selected automatically.

 -- クラス: compression.zstd.Strategy

     An *note IntEnum: edb. containing strategies for compression.
     Higher-numbered strategies correspond to more complex and slower
     compression.

          注釈: The values of attributes of ‘Strategy’ are not
          necessarily stable across zstd versions.  Only the ordering of
          the attributes may be relied upon.  The attributes are listed
          below in order.

     The following strategies are available:

      -- の属性: fast

      -- の属性: dfast

      -- の属性: greedy

      -- の属性: lazy

      -- の属性: lazy2

      -- の属性: btlazy2

      -- の属性: btopt

      -- の属性: btultra

      -- の属性: btultra2


File: python.info,  Node: その他<3>,  Next: 使用例<14>,  Prev: Advanced parameter control,  Up: compression zstd --- Compression compatible with the Zstandard format

5.13.2.6 その他
...............

 -- の関数: compression.zstd.get_frame_info (frame_buffer)

     Retrieve a *note FrameInfo: 2e24. object containing metadata about
     a Zstandard frame.  Frames contain metadata related to the
     compressed data they hold.

 -- クラス: compression.zstd.FrameInfo

     Metadata related to a Zstandard frame.

      -- の属性: decompressed_size

          The size of the decompressed contents of the frame.

      -- の属性: dictionary_id

          An integer representing the Zstandard dictionary ID needed for
          decompressing the frame.  ‘0’ means the dictionary ID was not
          recorded in the frame header.  This may mean that a Zstandard
          dictionary is not needed, or that the ID of a required
          dictionary was not recorded.

 -- の属性: compression.zstd.COMPRESSION_LEVEL_DEFAULT

     The default compression level for Zstandard: ‘3’.

 -- の属性: compression.zstd.zstd_version_info

     Version number of the runtime zstd library as a tuple of integers
     (major, minor, release).


File: python.info,  Node: 使用例<14>,  Prev: その他<3>,  Up: compression zstd --- Compression compatible with the Zstandard format

5.13.2.7 使用例
...............

Reading in a compressed file:

     from compression import zstd

     with zstd.open("file.zst") as f:
         file_content = f.read()

Creating a compressed file:

     from compression import zstd

     data = b"Insert Data Here"
     with zstd.open("file.zst", "w") as f:
         f.write(data)

Compressing data in memory:

     from compression import zstd

     data_in = b"Insert Data Here"
     data_out = zstd.compress(data_in)

Incremental compression:

     from compression import zstd

     comp = zstd.ZstdCompressor()
     out1 = comp.compress(b"Some data\n")
     out2 = comp.compress(b"Another piece of data\n")
     out3 = comp.compress(b"Even more data\n")
     out4 = comp.flush()
     # Concatenate all the partial results:
     result = b"".join([out1, out2, out3, out4])

Writing compressed data to an already-open file:

     from compression import zstd

     with open("myfile", "wb") as f:
         f.write(b"This data will not be compressed\n")
         with zstd.open(f, "w") as zstf:
             zstf.write(b"This *will* be compressed\n")
         f.write(b"Not compressed\n")

Creating a compressed file using compression parameters:

     from compression import zstd

     options = {
        zstd.CompressionParameter.checksum_flag: 1
     }
     with zstd.open("file.zst", "w", options=options) as f:
         f.write(b"Mind if I squeeze in?")


File: python.info,  Node: zlib --- gzip 互換の圧縮,  Next: gzip --- gzip ファイルのサポート,  Prev: compression zstd --- Compression compatible with the Zstandard format,  Up: データ圧縮とアーカイブ

5.13.3 ‘zlib’ -- ‘gzip’ 互換の圧縮
----------------------------------

__________________________________________________________________

For applications that require data compression, the functions in this
module allow compression and decompression, using the zlib library(1).

This is an *note optional module: 215a.  If it is missing from your copy
of CPython, look for documentation from your distributor (that is,
whoever provided Python to you).  If you are the distributor, see *note
オプションのモジュールの要件: 2158.

zlib's functions have many options and often need to be used in a
particular order.  This documentation doesn't attempt to cover all of
the permutations; consult the zlib manual(2) for authoritative
information.

‘.gz’ ファイルの読み書きのためには、 *note gzip: 6b. モジュールを参照し
てください。

このモジュールで利用可能な例外と関数を以下に示します:

 -- 例外: zlib.error

     圧縮および展開時のエラーによって送出される例外です。

 -- の関数: zlib.adler32 (data[, value])

     'data' の Adler-32 チェックサムを計算します (Adler-32 チェックサム
     は、おおむね CRC32 と同等の信頼性を持ちながら、はるかに高速に計算で
     きます)。結果は、符号のない 32 ビットの整数です。 'value' が与えら
     れている場合、チェックサム計算の初期値として使われます。与えられて
     いない場合、デフォルト値の 1 が使われます。 'value' を与えることで
     、複数の入力を結合したデータ全体にわたり、通しのチェックサムを計算
     できます。このアルゴリズムは暗号論的には強力ではなく、認証やデジタ
     ル署名などに用いるべきではありません。また、チェックサムアルゴリズ
     ムとして設計されているため、汎用のハッシュアルゴリズムには向きませ
     ん。

     バージョン 3.0 で変更: The result is always unsigned.

 -- の関数: zlib.compress (data, /, level=Z_DEFAULT_COMPRESSION,
          wbits=MAX_WBITS)

     Compresses the bytes in 'data', returning a bytes object containing
     compressed data.  'level' is an integer from ‘0’ to ‘9’ or ‘-1’
     controlling the level of compression; See *note Z_BEST_SPEED: 2e2d.
     (‘1’), *note Z_BEST_COMPRESSION: 2e2e. (‘9’), *note
     Z_NO_COMPRESSION: 2e2f. (‘0’), and the default, *note
     Z_DEFAULT_COMPRESSION: 2e30. (‘-1’) for more information about
     these values.  The 'wbits' argument controls the size of the
     history buffer (or the "window size") used when compressing data,
     and whether a header and trailer is included in the output.  It can
     take several ranges of values, defaulting to ‘15’ (*note MAX_WBITS:
     2e32.):

        * +9 to +15: The base-two logarithm of the window size, which
          therefore ranges between 512 and 32768.  Larger values produce
          better compression at the expense of greater memory usage.
          The resulting output will include a zlib-specific header and
          trailer.

        * −9 to −15: Uses the absolute value of 'wbits' as the window
          size logarithm, while producing a raw output stream with no
          header or trailing checksum.

        * +25 to +31 = 16 + (9 to 15): Uses the low 4 bits of the value
          as the window size logarithm, while including a basic ‘gzip’
          header and trailing checksum in the output.

     Raises the *note error: 2e2c. exception if any error occurs.

     バージョン 3.6 で変更: 'level' can now be used as a keyword
     parameter.

     バージョン 3.11 で変更: The 'wbits' parameter is now available to
     set window bits and compression type.

 -- の関数: zlib.compressobj (level=Z_DEFAULT_COMPRESSION,
          method=DEFLATED, wbits=MAX_WBITS, memLevel=DEF_MEM_LEVEL,
          strategy=Z_DEFAULT_STRATEGY[, zdict])

     一度にメモリ上に置くことができないようなデータストリームを圧縮する
     ための圧縮オブジェクトを返します。

     'level' is the compression level - an integer from ‘0’ to ‘9’ or
     ‘-1’.  See *note Z_BEST_SPEED: 2e2d. (‘1’), *note
     Z_BEST_COMPRESSION: 2e2e. (‘9’), *note Z_NO_COMPRESSION: 2e2f.
     (‘0’), and the default, *note Z_DEFAULT_COMPRESSION: 2e30. (‘-1’)
     for more information about these values.

     'method' は圧縮アルゴリズムです。現在、 *note DEFLATED: 2e34. のみ
     サポートされています。

     The 'wbits' parameter controls the size of the history buffer (or
     the "window size"), and what header and trailer format will be
     used.  It has the same meaning as *note described for compress():
     2e31.

     'memLevel' 引数は内部圧縮状態用に使用されるメモリ量を制御します。有
     効な値は ‘1’ から ‘9’ です。大きい値ほど多くのメモリを消費しますが
     、より速く、より小さな出力を作成します。

     'strategy' is used to tune the compression algorithm.  Possible
     values are *note Z_DEFAULT_STRATEGY: 2e35, *note Z_FILTERED: 2e36,
     *note Z_HUFFMAN_ONLY: 2e37, *note Z_RLE: 2e38. and *note Z_FIXED:
     2e39.

     'zdict' は定義済み圧縮辞書です。これは圧縮されるデータ内で繰り返し
     現れると予想されるサブシーケンスを含む (*note bytes: 192. オブジェ
     クトのような) バイト列のシーケンスです。最も一般的と思われるサブシ
     ーケンスは辞書の末尾に来なければなりません。

     バージョン 3.3 で変更: 'zdict' パラメータとキーワード引数のサポート
     が追加されました。

 -- の関数: zlib.crc32 (data[, value])

     'data' の CRC (Cyclic Redundancy Check, 巡回冗長検査) チェックサム
     を計算します。結果は、符号のない 32 ビットの整数です。 'value' が与
     えられている場合、チェックサム計算の初期値として使われます。与えら
     れていない場合、デフォルト値の 0 が使われます。 'value' を与えるこ
     とで、複数の入力を結合したデータ全体にわたり、通しのチェックサムを
     計算できます。このアルゴリズムは暗号論的には強力ではなく、認証やデ
     ジタル署名などに用いるべきではありません。また、チェックサムアルゴ
     リズムとして設計されているため、汎用のハッシュアルゴリズムには向き
     ません。

     バージョン 3.0 で変更: The result is always unsigned.

 -- の関数: zlib.decompress (data, /, wbits=MAX_WBITS,
          bufsize=DEF_BUF_SIZE)

     Decompresses the bytes in 'data', returning a bytes object
     containing the uncompressed data.  The 'wbits' parameter depends on
     the format of 'data', and is discussed further below.  If 'bufsize'
     is given, it is used as the initial size of the output buffer.
     Raises the *note error: 2e2c. exception if any error occurs.  The
     'wbits' parameter controls the size of the history buffer (or
     "window size"), and what header and trailer format is expected.  It
     is similar to the parameter for *note compressobj(): 2e33, but
     accepts more ranges of values:

        * +8 to +15: The base-two logarithm of the window size.  The
          input must include a zlib header and trailer.

        * 0: Automatically determine the window size from the zlib
          header.  Only supported since zlib 1.2.3.5.

        * −8 to −15: Uses the absolute value of 'wbits' as the window
          size logarithm.  The input must be a raw stream with no header
          or trailer.

        * +24 to +31 = 16 + (8 to 15): Uses the low 4 bits of the value
          as the window size logarithm.  The input must include a gzip
          header and trailer.

        * +40 to +47 = 32 + (8 to 15): Uses the low 4 bits of the value
          as the window size logarithm, and automatically accepts either
          the zlib or gzip format.

     When decompressing a stream, the window size must not be smaller
     than the size originally used to compress the stream; using a
     too-small value may result in an *note error: 2e2c. exception.  The
     default 'wbits' value corresponds to the largest window size and
     requires a zlib header and trailer to be included.

     'bufsize' は展開されたデータを保持するためのバッファサイズの初期値
     です。バッファの空きは必要に応じて必要なだけ増加するので、必ずしも
     正確な値を指定する必要はありません。この値のチューニングでできるこ
     とは、‘malloc()’ が呼ばれる回数を数回減らすことぐらいです。

     バージョン 3.6 で変更: 'wbits' and 'bufsize' can be used as keyword
     arguments.

 -- の関数: zlib.decompressobj (wbits=MAX_WBITS[, zdict])

     一度にメモリ上に置くことができないようなデータストリームを展開する
     ための展開オブジェクトを返します。

     The 'wbits' parameter controls the size of the history buffer (or
     the "window size"), and what header and trailer format is expected.
     It has the same meaning as *note described for decompress(): 2e3a.

     'zdict' パラメータには定義済み圧縮辞書を指定します。このパラメータ
     を指定する場合、展開するデータを圧縮した際に使用した辞書と同じもの
     でなければなりません。

          注釈: 'zdict' が (*note bytearray: 344. のような) 変更可能オブ
          ジェクトの場合、*note decompressobj(): 2e3b. の呼び出しとデコ
          ンプレッサの ‘decompress()’ メソッドの最初の呼び出しの間に辞書
          の内容を変更してはいけません。

     バージョン 3.3 で変更: パラメータに 'zdict' を追加しました。

圧縮オブジェクトは以下のメソッドをサポートしています:

 -- メソッド: Compress.compress (data)

     'data' を圧縮し、圧縮されたデータを含むバイト列オブジェクトを返しま
     す。この文字列は少なくとも 'data' の一部分のデータに対する圧縮デー
     タを含みます。このデータは以前に呼んだ *note compress(): 84f. が返
     した出力と結合することができます。入力の一部は以後の処理のために内
     部バッファに保存されることもあります。

 -- メソッド: Compress.flush ([mode])

     All pending input is processed, and a bytes object containing the
     remaining compressed output is returned.  'mode' can be selected
     from the constants *note Z_NO_FLUSH: 2e3e, *note Z_PARTIAL_FLUSH:
     2e3f, *note Z_SYNC_FLUSH: 2e40, *note Z_FULL_FLUSH: 2e41, *note
     Z_BLOCK: 2e42, or *note Z_FINISH: 2e43, defaulting to *note
     Z_FINISH: 2e43.  Except *note Z_FINISH: 2e43, all constants allow
     compressing further bytestrings of data, while *note Z_FINISH:
     2e43. finishes the compressed stream and prevents compressing any
     more data.  After calling *note flush(): 2e3d. with 'mode' set to
     *note Z_FINISH: 2e43, the *note compress(): 84f. method cannot be
     called again; the only realistic action is to delete the object.

 -- メソッド: Compress.copy ()

     圧縮オブジェクトのコピーを返します。これを使うと先頭部分が共通して
     いる複数のデータを効率的に圧縮することができます。

バージョン 3.8 で変更: Added *note copy.copy(): 757. and *note
copy.deepcopy(): d65. support to compression objects.

展開オブジェクトは以下のメソッドと属性をサポートしています:

 -- の属性: Decompress.unused_data

     圧縮データの末尾より後のバイト列が入ったバイト列オブジェクトです。
     すなわち、この値は圧縮データの入っているバイト列の最後の文字が利用
     可能になるまでは ‘b""’ のままとなります。入力バイト文字列すべてが圧
     縮データを含んでいた場合、この属性は ‘b""’ 、すなわち空バイト列にな
     ります。

 -- の属性: Decompress.unconsumed_tail

     展開されたデータを収めるバッファの長さ制限を超えたために、直近の
     *note decompress(): f09. 呼び出しで処理しきれなかったデータを含むバ
     イト列オブジェクトです。このデータはまだ zlib 側からは見えていない
     ので、正しい展開出力を得るには以降の *note decompress(): f09. メソ
     ッド呼び出しに (場合によっては後続のデータが追加された) データを差
     し戻さなければなりません。

 -- の属性: Decompress.eof

     圧縮データストリームの終了に達したかどうかを示すブール値です。

     これは、正常な形式の圧縮ストリームと、不完全あるいは切り詰められた
     ストリームとを区別することを可能にします。

     Added in version 3.3.

 -- メソッド: Decompress.decompress (data, max_length=0)

     'data' を展開し、少なくとも 'string' の一部分に対応する展開されたデ
     ータを含むバイト列オブジェクトを返します。このデータは以前に *note
     decompress(): f09. メソッドを呼んだ時に返された出力と結合することが
     できます。入力データの一部分が以後の処理のために内部バッファに保存
     されることもあります。

     オプションパラメータ 'max_length' が非ゼロの場合、返される展開デー
     タの長さが 'max_length' 以下に制限されます。このことは入力した圧縮
     データの全てが処理されるとは限らないことを意味し、処理されなかった
     データは *note unconsumed_tail: 2e46. 属性に保存されます。展開処理
     を継続する場合、この保存されたバイト文字列を以降の *note
     decompress(): f09. 呼び出しに渡さなくてはなりません。 'max_length'
     が 0 の場合、全ての入力が展開され、 *note unconsumed_tail: 2e46. 属
     性は空になります。

     バージョン 3.6 で変更: 'max_length' can be used as a keyword
     argument.

 -- メソッド: Decompress.flush ([length])

     未処理の入力データをすべて処理し、最終的に圧縮されなかった残りの出
     力バイト列オブジェクトを返します。*note flush(): 2e48. を呼んだ後、
     *note decompress(): f09. を再度呼ぶべきではありません。このときでき
     る唯一の現実的な操作はオブジェクトの削除だけです。

     オプション引数 'length' には出力バッファの初期サイズを指定します。

 -- メソッド: Decompress.copy ()

     展開オブジェクトのコピーを返します。これを使うとデータストリームの
     途中にある展開オブジェクトの状態を保存でき、未来のある時点で行なわ
     れるストリームのランダムなシークをスピードアップするのに利用できま
     す。

バージョン 3.8 で変更: Added *note copy.copy(): 757. and *note
copy.deepcopy(): d65. support to decompression objects.

The following constants are available to configure compression and
decompression behavior:

 -- データ: zlib.DEFLATED

     The deflate compression method.

 -- データ: zlib.MAX_WBITS

     The maximum window size, expressed as a power of 2.  For example,
     if ‘MAX_WBITS’ is ‘15’ it results in a window size of ‘32 KiB’.

 -- データ: zlib.DEF_MEM_LEVEL

     The default memory level for compression objects.

 -- データ: zlib.DEF_BUF_SIZE

     The default buffer size for decompression operations.

 -- データ: zlib.Z_NO_COMPRESSION

     Compression level ‘0’; no compression.

     Added in version 3.6.

 -- データ: zlib.Z_BEST_SPEED

     Compression level ‘1’; fastest and produces the least compression.

 -- データ: zlib.Z_BEST_COMPRESSION

     Compression level ‘9’; slowest and produces the most compression.

 -- データ: zlib.Z_DEFAULT_COMPRESSION

     Default compression level (‘-1’); a compromise between speed and
     compression.  Currently equivalent to compression level ‘6’.

 -- データ: zlib.Z_DEFAULT_STRATEGY

     Default compression strategy, for normal data.

 -- データ: zlib.Z_FILTERED

     Compression strategy for data produced by a filter (or predictor).

 -- データ: zlib.Z_HUFFMAN_ONLY

     Compression strategy that forces Huffman coding only.

 -- データ: zlib.Z_RLE

     Compression strategy that limits match distances to one (run-length
     encoding).

     This constant is only available if Python was compiled with zlib
     1.2.0.1 or greater.

     Added in version 3.6.

 -- データ: zlib.Z_FIXED

     Compression strategy that prevents the use of dynamic Huffman
     codes.

     This constant is only available if Python was compiled with zlib
     1.2.2.2 or greater.

     Added in version 3.6.

 -- データ: zlib.Z_NO_FLUSH

     Flush mode ‘0’.  No special flushing behavior.

     Added in version 3.6.

 -- データ: zlib.Z_PARTIAL_FLUSH

     Flush mode ‘1’.  Flush as much output as possible.

 -- データ: zlib.Z_SYNC_FLUSH

     Flush mode ‘2’.  All output is flushed and the output is aligned to
     a byte boundary.

 -- データ: zlib.Z_FULL_FLUSH

     Flush mode ‘3’.  All output is flushed and the compression state is
     reset.

 -- データ: zlib.Z_FINISH

     Flush mode ‘4’.  All pending input is processed, no more input is
     expected.

 -- データ: zlib.Z_BLOCK

     Flush mode ‘5’.  A deflate block is completed and emitted.

     This constant is only available if Python was compiled with zlib
     1.2.2.2 or greater.

     Added in version 3.6.

 -- データ: zlib.Z_TREES

     Flush mode ‘6’, for inflate operations.  Instructs inflate to
     return when it gets to the next deflate block boundary.

     This constant is only available if Python was compiled with zlib
     1.2.3.4 or greater.

     Added in version 3.6.

使用している zlib ライブラリのバージョン情報を以下の定数で確認できます:

 -- データ: zlib.ZLIB_VERSION

     モジュールのビルド時に使用された zlib ライブラリのバージョン文字列
     です。これは *note ZLIB_RUNTIME_VERSION: 1386. で確認できる、実行時
     に使用している実際の zlib ライブラリのバージョンとは異なる場合があ
     ります。

 -- データ: zlib.ZLIB_RUNTIME_VERSION

     インタプリタが読み込んだ実際の zlib ライブラリのバージョン文字列で
     す。

     Added in version 3.3.

 -- データ: zlib.ZLIBNG_VERSION

     The version string of the zlib-ng library that was used for
     building the module if zlib-ng was used.  When present, the *note
     ZLIB_VERSION: 2e4d. and *note ZLIB_RUNTIME_VERSION: 1386. constants
     reflect the version of the zlib API provided by zlib-ng.

     If zlib-ng was not used to build the module, this constant will be
     absent.

     Added in version 3.14.

参考
....

*note gzip: 6b. モジュール

     ‘gzip’ 形式ファイルへの読み書きを行うモジュール。

‘https://www.zlib.net’

     zlib ライブラリホームページ。

‘https://www.zlib.net/manual.html’

     zlib ライブラリの多くの関数の意味と使い方を解説したマニュアル。

In case gzip (de)compression is a bottleneck, the python-isal(3) package
speeds up (de)compression with a mostly compatible API.

   ---------- Footnotes ----------

   (1) https://www.zlib.net

   (2) https://www.zlib.net/manual.html

   (3) https://github.com/pycompression/python-isal


File: python.info,  Node: gzip --- gzip ファイルのサポート,  Next: bz2 --- bzip2 圧縮のサポート,  Prev: zlib --- gzip 互換の圧縮,  Up: データ圧縮とアーカイブ

5.13.4 ‘gzip’ -- ‘gzip’ ファイルのサポート
------------------------------------------

'ソースコード:' Lib/gzip.py(1)

__________________________________________________________________

このモジュールは、GNU の ‘gzip’ や ‘gunzip’ のようにファイルを圧縮、展開
するシンプルなインターフェイスを提供しています。

This is an *note optional module: 215a.  If it is missing from your copy
of CPython, look for documentation from your distributor (that is,
whoever provided Python to you).  If you are the distributor, see *note
オプションのモジュールの要件: 2158.

データ圧縮は *note zlib: 139. モジュールで提供されています。

The ‘gzip’ module provides the *note GzipFile: 65c. class, as well as
the *note open(): 2e52, *note compress(): 84e. and *note decompress():
1426. convenience functions.  The *note GzipFile: 65c. class reads and
writes ‘gzip’-format files, automatically compressing or decompressing
the data so that it looks like an ordinary *note file object: 13db.

‘compress’ や ‘pack’ 等によって作成され、‘gzip’ や ‘gunzip’ が展開できる
他のファイル形式についてはこのモジュールは対応していないので注意してくだ
さい。

このモジュールは以下の項目を定義しています:

 -- の関数: gzip.open (filename, mode='rb', compresslevel=9,
          encoding=None, errors=None, newline=None)

     gzip 圧縮ファイルをバイナリまたはテキストモードで開き、*note
     ファイルオブジェクト: 13db. を返します。

     引数 'filename' には実際のファイル名 (*note str: 169. または *note
     bytes: 192. オブジェクト) か、既存のファイルオブジェクトを指定しま
     す。

     引数 'mode' には、バイナリモード用に ‘'r'’、‘'rb'’、‘'a'’、‘'ab'’、
     ‘'w'’、‘'wb'’、‘'x'’、または ‘'xb'’、テキストモード用に ‘'rt'’、
     ‘'at'’、‘'wt'’、または ‘'xt'’ を指定できます。デフォルトは ‘'rb'’ で
     す。

     引数 'compresslevel' は *note GzipFile: 65c. コンストラクタと同様に
     0 から 9 の整数を取ります。

     バイナリモードでは、この関数は *note GzipFile: 65c. コンストラクタ
     ‘GzipFile(filename, mode, compresslevel)’ と等価です。この時、引数
     'encoding'、'errors'、および 'newline' を指定してはいけません。

     テキストモードでは、*note GzipFile: 65c. オブジェクトが作成され、指
     定されたエンコーディング、エラーハンドラの挙動、および改行文字で
     *note io.TextIOWrapper: 9be. インスタンスにラップされます。

     バージョン 3.3 で変更: 'filename' にファイルオブジェクト指定のサポ
     ート、テキストモードのサポート、および引数に 'encoding'、'errors'、
     および 'newline' を追加しました。

     バージョン 3.4 で変更: Added support for the ‘'x'’, ‘'xb'’ and
     ‘'xt'’ modes.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- 例外: gzip.BadGzipFile

     An exception raised for invalid gzip files.  It inherits from *note
     OSError: 2c0.  *note EOFError: 14f1. and *note zlib.error: 2e2c.
     can also be raised for invalid gzip files.

     Added in version 3.8.

 -- クラス: gzip.GzipFile (filename=None, mode=None, compresslevel=9,
          fileobj=None, mtime=None)

     *note GzipFile: 65c. クラスのコンストラクタです。*note GzipFile:
     65c. オブジェクトは *note truncate(): 1528. メソッドを除くほとんど
     の *note ファイルオブジェクト: 13db. のメソッドをシミュレートします
     。少なくとも 'fileobj' および 'filename' は有効な値でなければなりま
     せん。

     クラスの新しいインスタンスは、 'fileobj' に基づいて作成されます。
     'fileobj' は通常のファイル、 *note io.BytesIO: 10a4. オブジェクト、
     そしてその他ファイルをシミュレートできるオブジェクトでかまいません
     。 値はデフォルトでは 'None' で、その場合ファイルオブジェクトを生成
     するために 'filename' を開きます。

     'fileobj' が ‘None’ でない場合、'filename' 引数は ‘gzip’ ファイルヘ
     ッダにインクルードされることのみに使用されます。‘gzip’ ファイルヘッ
     ダは圧縮されていないファイルの元の名前をインクルードするかもしれま
     せん。認識可能な場合、規定値は 'fileobj' のファイル名です。そうでな
     い場合、規定値は空の文字列で、元のファイル名はヘッダにはインクルー
     ドされません。

     The 'mode' argument can be any of ‘'r'’, ‘'rb'’, ‘'a'’, ‘'ab'’,
     ‘'w'’, ‘'wb'’, ‘'x'’, or ‘'xb'’, depending on whether the file will
     be read or written.  The default is the mode of 'fileobj' if
     discernible; otherwise, the default is ‘'rb'’.  In future Python
     releases the mode of 'fileobj' will not be used.  It is better to
     always specify 'mode' for writing.

     ファイルは常にバイナリモードで開かれることに注意してください。圧縮
     ファイルをテキストモードで開く場合、*note open(): 2e52. (または
     *note GzipFile: 65c. を *note io.TextIOWrapper: 9be. でラップしたオ
     ブジェクト) を使ってください。

     引数 'compresslevel' は ‘0’ から ‘9’ の整数を取り、圧縮レベルを制御
     します; ‘1’ は最も高速で最小限の圧縮を行い、‘9’ は最も低速ですが最
     大限の圧縮を行います。‘0’ は圧縮しません。デフォルトは ‘9’ です。

     The optional 'mtime' argument is the timestamp requested by gzip.
     The time is in Unix format, i.e., seconds since 00:00:00 UTC,
     January 1, 1970.  If 'mtime' is omitted or ‘None’, the current time
     is used.  Use 'mtime' = 0 to generate a compressed stream that does
     not depend on creation time.

     See below for the *note mtime: 2e53. attribute that is set when
     decompressing.

     圧縮したデータの後ろにさらに何か追加したい場合もあるので、*note
     GzipFile: 65c. オブジェクトの ‘close()’ メソッド呼び出しは
     'fileobj' を閉じません。 このため、書き込みのためにオープンした
     *note io.BytesIO: 10a4. オブジェクトを 'fileobj' として渡し、(*note
     GzipFile: 65c. を ‘close()’ した後に) *note io.BytesIO: 10a4. オブ
     ジェクトの *note getvalue(): 2e54. メソッドを使って書き込んだデータ
     の入っているメモリバッファを取得することができます。

     *note GzipFile: 65c. は、イテレーションと *note with: 186. 文を含む
     *note io.BufferedIOBase: 8a3. インターフェイスをサポートしています
     。*note truncate(): 1528. メソッドのみ実装されていません。

     *note GzipFile: 65c. は以下のメソッドと属性も提供しています:

      -- メソッド: peek (n)

          ファイル内の位置を移動せずに展開した 'n' バイトを読み込みます
          。返されるバイト数はほぼ要求した値になります。

               注釈: *note peek(): 1425. の呼び出しでは *note GzipFile:
               65c. のファイル位置は変わりませんが、下層のファイルオブジ
               ェクトの位置が変わる惧れがあります。(e.g.  *note
               GzipFile: 65c. が 'fileobj' 引数で作成された場合)

          Added in version 3.2.

      -- の属性: mode

          ‘'rb'’ は読み込み用、 ‘'wb'’ は書き込み用です。

          バージョン 3.13 で変更: In previous versions it was an integer
          ‘1’ or ‘2’.

      -- の属性: mtime

          When decompressing, this attribute is set to the last
          timestamp in the most recently read header.  It is an integer,
          holding the number of seconds since the Unix epoch (00:00:00
          UTC, January 1, 1970).  The initial value before reading any
          headers is ‘None’.

      -- の属性: name

          The path to the gzip file on disk, as a *note str: 169. or
          *note bytes: 192.  Equivalent to the output of *note
          os.fspath(): e4d. on the original input path, with no other
          normalization, resolution or expansion.

     バージョン 3.1 で変更: *note with: 186. 文がサポートされました。
     'mtime' コンストラクタ引数と *note mtime: 2e53. 属性が追加されまし
     た。

     バージョン 3.2 で変更: ゼロパディングされたファイルやシーク出来ない
     ファイルがサポートされました。

     バージョン 3.3 で変更: *note io.BufferedIOBase.read1(): 2e56. メソ
     ッドを実装しました。

     バージョン 3.4 で変更: ‘'x'’ ならびに ‘'xb'’ モードがサポートされま
     した。

     バージョン 3.5 で変更: 任意の *note バイトライクオブジェクト: 193.
     の書き込みがサポートされました。 *note read(): 1540. メソッドが
     ‘None’ を引数として受け取るようになりました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.9 で非推奨: Opening *note GzipFile: 65c. for writing
     without specifying the 'mode' argument is deprecated.

     バージョン 3.12 で変更: Remove the ‘filename’ attribute, use the
     *note name: 731. attribute instead.

 -- の関数: gzip.compress (data, compresslevel=9, *, mtime=0)

     Compress the 'data', returning a *note bytes: 192. object
     containing the compressed data.  'compresslevel' and 'mtime' have
     the same meaning as in the *note GzipFile: 65c. constructor above,
     but 'mtime' defaults to 0 for reproducible output.

     Added in version 3.2.

     バージョン 3.8 で変更: Added the 'mtime' parameter for reproducible
     output.

     バージョン 3.11 で変更: Speed is improved by compressing all data
     at once instead of in a streamed fashion.  Calls with 'mtime' set
     to ‘0’ are delegated to *note zlib.compress(): 84f. for better
     speed.  In this situation the output may contain a gzip header "OS"
     byte value other than 255 "unknown" as supplied by the underlying
     zlib implementation.

     バージョン 3.13 で変更: The gzip header OS byte is guaranteed to be
     set to 255 when this function is used as was the case in 3.10 and
     earlier.

     バージョン 3.14 で変更: The 'mtime' parameter now defaults to 0 for
     reproducible output.  For the previous behaviour of using the
     current time, pass ‘None’ to 'mtime'.

 -- の関数: gzip.decompress (data)

     Decompress the 'data', returning a *note bytes: 192. object
     containing the uncompressed data.  This function is capable of
     decompressing multi-member gzip data (multiple gzip blocks
     concatenated together).  When the data is certain to contain only
     one member the *note zlib.decompress(): f09. function with 'wbits'
     set to 31 is faster.

     Added in version 3.2.

     バージョン 3.11 で変更: Speed is improved by decompressing members
     at once in memory instead of in a streamed fashion.

* Menu:

* 使い方の例::
* コマンドライン・インターフェース: コマンドライン・インターフェース<3>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/gzip.py


File: python.info,  Node: 使い方の例,  Next: コマンドライン・インターフェース<3>,  Up: gzip --- gzip ファイルのサポート

5.13.4.1 使い方の例
...................

圧縮されたファイルを読み込む例:

     import gzip
     with gzip.open('/home/joe/file.txt.gz', 'rb') as f:
         file_content = f.read()

GZIP 圧縮されたファイルを作成する例:

     import gzip
     content = b"Lots of content here"
     with gzip.open('/home/joe/file.txt.gz', 'wb') as f:
         f.write(content)

既存のファイルを GZIP 圧縮する例:

     import gzip
     import shutil
     with open('/home/joe/file.txt', 'rb') as f_in:
         with gzip.open('/home/joe/file.txt.gz', 'wb') as f_out:
             shutil.copyfileobj(f_in, f_out)

バイナリ文字列を GZIP 圧縮する例:

     import gzip
     s_in = b"Lots of content here"
     s_out = gzip.compress(s_in)

参考
....

*note zlib: 139. モジュール

     ‘gzip’ ファイル形式のサポートを行うために必要な基本ライブラリモジュ
     ール。

In case gzip (de)compression is a bottleneck, the python-isal(1) package
speeds up (de)compression with a mostly compatible API.

   ---------- Footnotes ----------

   (1) https://github.com/pycompression/python-isal


File: python.info,  Node: コマンドライン・インターフェース<3>,  Prev: 使い方の例,  Up: gzip --- gzip ファイルのサポート

5.13.4.2 コマンドライン・インターフェース
.........................................

The ‘gzip’ module provides a simple command line interface to compress
or decompress files.

Once executed the ‘gzip’ module keeps the input file(s).

バージョン 3.8 で変更: Add a new command line interface with a usage.
By default, when you will execute the CLI, the default compression level
is 6.

* Menu:

* コマンドラインオプション::


File: python.info,  Node: コマンドラインオプション,  Up: コマンドライン・インターフェース<3>

5.13.4.3 コマンドラインオプション
.................................

 -- Option: file

     If 'file' is not specified, read from *note sys.stdin: 75f.

 -- Option: --fast

     Indicates the fastest compression method (less compression).

 -- Option: --best

     Indicates the slowest compression method (best compression).

 -- Option: -d, --decompress

     Decompress the given file.

 -- Option: -h, --help

     ヘルプメッセージを出力します


File: python.info,  Node: bz2 --- bzip2 圧縮のサポート,  Next: lzma --- LZMA アルゴリズムを使用した圧縮,  Prev: gzip --- gzip ファイルのサポート,  Up: データ圧縮とアーカイブ

5.13.5 ‘bz2’ -- ‘bzip2’ 圧縮のサポート
--------------------------------------

'ソースコード:' Lib/bz2.py(1)

__________________________________________________________________

このモジュールは、bzip2 アルゴリズムを用いて圧縮・展開を行う包括的なイン
ターフェイスを提供します。

The ‘bz2’ module contains:

   * 圧縮ファイルを読み書きするための *note open(): 129f. 関数と *note
     BZ2File: a66. クラス。

   * インクリメンタルにデータを圧縮・展開するための *note BZ2Compressor:
     1ace. および *note BZ2Decompressor: 1acc. クラス。

   * 一度に圧縮・展開を行う *note compress(): 287d. および *note
     decompress(): 12a0. 関数。

This is an *note optional module: 215a.  If it is missing from your copy
of CPython, look for documentation from your distributor (that is,
whoever provided Python to you).  If you are the distributor, see *note
オプションのモジュールの要件: 2158.

* Menu:

* ファイルの圧縮/解凍::
* 逐次圧縮および展開::
* 一括圧縮/解凍::
* 使い方の例: 使い方の例<2>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/bz2.py


File: python.info,  Node: ファイルの圧縮/解凍,  Next: 逐次圧縮および展開,  Up: bz2 --- bzip2 圧縮のサポート

5.13.5.1 ファイルの圧縮/解凍
............................

 -- の関数: bz2.open (filename, mode='rb', compresslevel=9,
          encoding=None, errors=None, newline=None)

     bzip2 圧縮されたファイルを、バイナリモードかテキストモードでオープ
     ンし、*note ファイルオブジェクト: 13db. を返します。

     *note BZ2File: a66. のコンストラクタと同様に、引数 'filename' には
     実際のファイル名 (*note str: 169. または *note bytes: 192. オブジェ
     クト) か、読み書きする既存のファイルオブジェクトを指定します。

     引数 'mode' には、バイナリモード用に ‘'r'’、‘'rb'’、‘'w'’、‘'wb'’、
     ‘'x'’、‘'xb'’、‘'a'’、あるいは ‘'ab'’、テキストモード用に ‘'rt'’、
     ‘'wt'’、‘'xt'’、あるいは ‘'at'’ を指定できます。デフォルトは ‘'rb'’
     です。

     引数 'compresslevel' には *note BZ2File: a66. コンストラクタと同様
     に 1 から 9 の整数を指定します。

     バイナリモードでは、この関数は *note BZ2File: a66. コンストラクタ
     ‘BZ2File(filename, mode, compresslevel=compresslevel)’ と等価です。
     この時、引数 'encoding'、'errors'、および 'newline' を指定してはい
     けません。

     テキストモードでは、*note BZ2File: a66. オブジェクトが作成され、指
     定されたエンコーディング、エラーハンドラの挙動、および改行文字で
     *note io.TextIOWrapper: 9be. にラップされます。

     Added in version 3.3.

     バージョン 3.4 で変更: ‘'x'’ (排他的作成) モードが追加されました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- クラス: bz2.BZ2File (filename, mode='r', *, compresslevel=9)

     bzip2 圧縮ファイルをバイナリモードでオープンします。

     'filename' が *note str: 169. あるいは *note bytes: 192. オブジェク
     トの場合、それを名前とするファイルを直接開きます。そうでない場合、
     'filename' は圧縮データを読み書きする *note ファイルオブジェクト:
     13db. でなくてはなりません。

     引数 'mode' は読み込みモードの ‘'r'’ (デフォルト)、上書きモードの
     ‘'w'’、排他的作成モードの ‘'x'’、あるいは追記モードの ‘'a'’ のいず
     れかを指定できます。これらはそれぞれ ‘'rb'’、‘'wb'’、‘'xb'’ および
     ‘'ab'’ と等価です。

     'filename' が (実際のファイル名でなく) ファイルオブジェクトの場合、
     ‘'w'’ はファイルを上書きせず、‘'a'’ と等価になります。

     'mode' が ‘'w'’ あるいは ‘'a'’ の場合、'compresslevel' に圧縮レベル
     を ‘1’ から ‘9’ の整数で指定できます。 圧縮率は ‘1’ が最低で、‘9’
     (デフォルト値) が最高です。

     'mode' の値が ‘'r'’ の場合、入力ファイルは複数の圧縮ストリームでも
     構いません。

     *note BZ2File: a66. には、 *note io.BufferedIOBase: 8a3. で規定され
     ているメソッドや属性のうち、 *note detach(): 2deb. と *note
     truncate(): 1528. を除くすべてが備わっています。イテレーションと
     *note with: 186. 文をサポートしています。

     *note BZ2File: a66. also provides the following methods and
     attributes:

      -- メソッド: peek ([n])

          ファイル上の現在位置を変更せずにバッファのデータを返します。こ
          のメソッドは少なくとも 1 バイトのデータを返します (EOF の場合
          を除く)。返される正確なバイト数は規定されていません。

               注釈: *note peek(): 2e67. の呼び出しでは *note BZ2File:
               a66. のファイル位置は変わりませんが、下層のファイルオブジ
               ェクトの位置が変わる惧れがあります(e.g.  *note BZ2File:
               a66. を 'filename' にファイルオブジェクトを渡して作成した
               場合)。

          Added in version 3.3.

      -- メソッド: fileno ()

          Return the file descriptor for the underlying file.

          Added in version 3.3.

      -- メソッド: readable ()

          Return whether the file was opened for reading.

          Added in version 3.3.

      -- メソッド: seekable ()

          Return whether the file supports seeking.

          Added in version 3.3.

      -- メソッド: writable ()

          Return whether the file was opened for writing.

          Added in version 3.3.

      -- メソッド: read1 (size=-1)

          Read up to 'size' uncompressed bytes, while trying to avoid
          making multiple reads from the underlying stream.  Reads up to
          a buffer's worth of data if size is negative.

          Returns ‘b''’ if the file is at EOF.

          Added in version 3.3.

      -- メソッド: readinto (b)

          Read bytes into 'b'.

          Returns the number of bytes read (0 for EOF).

          Added in version 3.3.

      -- の属性: mode

          ‘'rb'’ は読み込み用、 ‘'wb'’ は書き込み用です。

          Added in version 3.13.

      -- の属性: name

          The bzip2 file name.  Equivalent to the *note name: 2def.
          attribute of the underlying *note file object: 13db.

          Added in version 3.13.

     バージョン 3.1 で変更: *note with: 186. 構文のサポートが追加されま
     した。

     バージョン 3.3 で変更: 'filename' が実際のファイル名でなく *note
     ファイルオブジェクト: 13db. だった場合のサポートが追加されました。

     ‘'a'’ (追記) モードが追加され、複数のストリームの読み込みがサポート
     されました。

     バージョン 3.4 で変更: ‘'x'’ (排他的作成) モードが追加されました。

     バージョン 3.5 で変更: *note read(): 1540. メソッドが ‘None’ を引数
     として受け取るようになりました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.9 で変更: 'buffering' パラメータは削除されました。
     Python 3.0 からは無視され非推奨となっています。開かれたファイルオブ
     ジェクトを渡し、ファイルの開きかたを制御します。

     'compresslevel' パラメータはキーワード専用になりました。

     バージョン 3.10 で変更: このクラスは、複数の同時読み出しや書き込み
     においては、既存の *note gzip: 6b. や *note lzma: 8e. などの同等の
     クラスのように、スレッド安全ではありません。


File: python.info,  Node: 逐次圧縮および展開,  Next: 一括圧縮/解凍,  Prev: ファイルの圧縮/解凍,  Up: bz2 --- bzip2 圧縮のサポート

5.13.5.2 逐次圧縮および展開
...........................

 -- クラス: bz2.BZ2Compressor (compresslevel=9)

     新しくコンプレッサオブジェクトを作成します。このオブジェクトはデー
     タの逐次的な圧縮に使用できます。一度に圧縮したい場合は、*note
     compress(): 287d. 関数を使ってください。

     引数 'compresslevel' を指定する場合は、‘1’ から ‘9’ までの整数を与
     えてください。 デフォルト値は ‘9’ です。

      -- メソッド: compress (data)

          データをコンプレッサオブジェクトに渡します。戻り値は圧縮された
          データですが、圧縮データを返すことができない場合は空のバイト文
          字列を返します。

          コンプレッサオブジェクトにデータをすべて渡し終えたら、*note
          flush(): 2e72. メソッドを呼び出し、圧縮プロセスを完了させてく
          ださい。

      -- メソッド: flush ()

          圧縮プロセスを完了させ、内部バッファに残っている圧縮済みデータ
          を返します。

          このメソッドを呼び出すと、それ以後コンプレッサオブジェクトは使
          用できなくなります。

 -- クラス: bz2.BZ2Decompressor

     新しくデコンプレッサオブジェクトを作成します。このオブジェクトは逐
     次的なデータ展開に使用できます。一度に展開したい場合は、*note
     decompress(): 12a0. 関数を使ってください。

          注釈: このクラスは、*note decompress(): 12a0. や *note
          BZ2File: a66. とは異なり、複数の圧縮レベルが混在しているデータ
          を透過的に扱うことができません。 *note BZ2Decompressor: 1acc.
          クラスを用いて、複数のストリームからなるデータを展開する場合は
          、それぞれのストリームについてデコンプレッサオブジェクトを用意
          してください。

      -- メソッド: decompress (data, max_length=-1)

          'data' (*note bytes-like object: 193.) を展開し、未圧縮のデー
          タを bytes で返します。 'data' の一部は、後で *note
          decompress(): 12a0. の呼び出しに使用するため内部でバッファされ
          ている場合があります。 返されたデータは、以前の *note
          decompress(): 12a0. の呼び出しの出力に連結する必要があります。

          'max_length' が非負の場合、最大 'max_length' バイトの展開デー
          タを返します。この制限に達して、出力がさらに生成できる場合、
          *note needs_input: 2e73. が ‘False’ に設定されます。この場合、
          *note decompress(): fca. を次に呼び出すと、'data' を ‘b''’ と
          して提供し、出力をさらに取得することができます。

          入力データの全てが圧縮され返された ('max_length' バイトより少
          ないためか 'max_length' が負のため) 場合、 *note needs_input:
          2e73. 属性は ‘True’ になります。

          ストリームの終端に到達した後にデータを展開しようとすると *note
          EOFError: 14f1. が送出されます。 ストリームの終端の後ろの全て
          のデータは無視され、その部分は *note unused_data: 2e74. 属性に
          保存されます。

          バージョン 3.5 で変更: ‘max_length’ パラメータが追加されました
          。

      -- の属性: eof

          ストリーム終端記号に到達した場合 ‘True’ を返します。

          Added in version 3.3.

      -- の属性: unused_data

          圧縮ストリームの末尾以降に存在したデータを表します。

          ストリームの末尾に達する前には、この属性には ‘b''’ という値が
          収められています。

      -- の属性: needs_input

          *note decompress(): fca. メソッドが、新しい非圧縮入力を必要と
          せずにさらに展開データを提供できる場合、 ‘False’ です。

          Added in version 3.5.


File: python.info,  Node: 一括圧縮/解凍,  Next: 使い方の例<2>,  Prev: 逐次圧縮および展開,  Up: bz2 --- bzip2 圧縮のサポート

5.13.5.3 一括圧縮/解凍
......................

 -- の関数: bz2.compress (data, compresslevel=9)

     *note バイト類オブジェクト: 193. の 'data' を圧縮します。

     引数 'compresslevel' を指定する場合は、‘1’ から ‘9’ までの整数を与
     えてください。 デフォルト値は ‘9’ です。

     逐次的にデータを圧縮したい場合は、*note BZ2Compressor: 1ace. を使っ
     てください。

 -- の関数: bz2.decompress (data)

     *note バイト類オブジェクト: 193. の 'data' を展開します。

     'data' が複数の圧縮ストリームから成る場合、そのすべてを展開します。

     逐次的に展開を行う場合は、*note BZ2Decompressor: 1acc. を使ってくだ
     さい。

     バージョン 3.3 で変更: 複数ストリームの入力をサポートしました。


File: python.info,  Node: 使い方の例<2>,  Prev: 一括圧縮/解凍,  Up: bz2 --- bzip2 圧縮のサポート

5.13.5.4 使い方の例
...................

Below are some examples of typical usage of the ‘bz2’ module.

*note compress(): 287d. と *note decompress(): 12a0. を使い、圧縮して展
開する実演をしています:

     >>> import bz2
     >>> data = b"""\
     ... Donec rhoncus quis sapien sit amet molestie. Fusce scelerisque vel augue
     ... nec ullamcorper. Nam rutrum pretium placerat. Aliquam vel tristique lorem,
     ... sit amet cursus ante. In interdum laoreet mi, sit amet ultrices purus
     ... pulvinar a. Nam gravida euismod magna, non varius justo tincidunt feugiat.
     ... Aliquam pharetra lacus non risus vehicula rutrum. Maecenas aliquam leo
     ... felis. Pellentesque semper nunc sit amet nibh ullamcorper, ac elementum
     ... dolor luctus. Curabitur lacinia mi ornare consectetur vestibulum."""
     >>> c = bz2.compress(data)
     >>> len(data) / len(c)  # Data compression ratio
     1.513595166163142
     >>> d = bz2.decompress(c)
     >>> data == d  # Check equality to original object after round-trip
     True

*note BZ2Compressor: 1ace. を使い、逐次圧縮をしています:

     >>> import bz2
     >>> def gen_data(chunks=10, chunksize=1000):
     ...     """Yield incremental blocks of chunksize bytes."""
     ...     for _ in range(chunks):
     ...         yield b"z" * chunksize
     ...
     >>> comp = bz2.BZ2Compressor()
     >>> out = b""
     >>> for chunk in gen_data():
     ...     # Provide data to the compressor object
     ...     out = out + comp.compress(chunk)
     ...
     >>> # Finish the compression process.  Call this once you have
     >>> # finished providing data to the compressor.
     >>> out = out + comp.flush()

上の例は、非常に "ランダムでない" データストリーム (チャンク ‘b"z"’ のス
トリーム) です。 ランダムなデータは圧縮率が低い傾向にある一方、揃ってい
て、繰り返しのあるデータは通常は高い圧縮率を叩き出します。

bzip2 圧縮されたファイルをバイナリモードで読み書きしています:

     >>> import bz2
     >>> data = b"""\
     ... Donec rhoncus quis sapien sit amet molestie. Fusce scelerisque vel augue
     ... nec ullamcorper. Nam rutrum pretium placerat. Aliquam vel tristique lorem,
     ... sit amet cursus ante. In interdum laoreet mi, sit amet ultrices purus
     ... pulvinar a. Nam gravida euismod magna, non varius justo tincidunt feugiat.
     ... Aliquam pharetra lacus non risus vehicula rutrum. Maecenas aliquam leo
     ... felis. Pellentesque semper nunc sit amet nibh ullamcorper, ac elementum
     ... dolor luctus. Curabitur lacinia mi ornare consectetur vestibulum."""
     >>> with bz2.open("myfile.bz2", "wb") as f:
     ...     # Write compressed data to file
     ...     unused = f.write(data)
     ...
     >>> with bz2.open("myfile.bz2", "rb") as f:
     ...     # Decompress data from file
     ...     content = f.read()
     ...
     >>> content == data  # Check equality to original object after round-trip
     True


File: python.info,  Node: lzma --- LZMA アルゴリズムを使用した圧縮,  Next: zipfile --- ZIP アーカイブの処理,  Prev: bz2 --- bzip2 圧縮のサポート,  Up: データ圧縮とアーカイブ

5.13.6 ‘lzma’ -- LZMA アルゴリズムを使用した圧縮
------------------------------------------------

Added in version 3.3.

'ソースコード:' Lib/lzma.py(1)

__________________________________________________________________

このモジュールは LZMA 圧縮アルゴリズムを使用したデータ圧縮および展開のた
めのクラスや便利な関数を提供しています。また、‘xz’ ユーティリティを使用
した ‘.xz’ およびレガシーな ‘.lzma’ ファイル形式へのファイルインターフェ
イスの他、RAW 圧縮ストリームもサポートしています。

このモジュールが提供するインターフェイスは *note bz2: 14. モジュールと非
常によく似ています。 *note LZMAFile: 120e. と *note bz2.BZ2File: a66. は
スレッドセーフでは 'ない' 点に注意してください。 そのため、単一の *note
LZMAFile: 120e. インスタンスを複数スレッドから使用する場合は、ロックで保
護する必要があります。

This is an *note optional module: 215a.  If it is missing from your copy
of CPython, look for documentation from your distributor (that is,
whoever provided Python to you).  If you are the distributor, see *note
オプションのモジュールの要件: 2158.

 -- 例外: lzma.LZMAError

     この例外は圧縮あるいは展開中にエラーが発生した場合、または圧縮/展開
     状態の初期化中に送出されます。

* Menu:

* 圧縮ファイルへの読み書き: 圧縮ファイルへの読み書き<2>.
* メモリ上での圧縮と展開: メモリ上での圧縮と展開<2>.
* その他: その他<4>.
* カスタムフィルタチェインの指定::
* 使用例: 使用例<15>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/lzma.py


File: python.info,  Node: 圧縮ファイルへの読み書き<2>,  Next: メモリ上での圧縮と展開<2>,  Up: lzma --- LZMA アルゴリズムを使用した圧縮

5.13.6.1 圧縮ファイルへの読み書き
.................................

 -- の関数: lzma.open (filename, mode='rb', *, format=None, check=-1,
          preset=None, filters=None, encoding=None, errors=None,
          newline=None)

     LZMA 圧縮ファイルをバイナリまたはテキストモードでオープンし、*note
     ファイルオブジェクト: 13db. を返します。

     'filename' 引数には、ファイルをオープンする際には実際のファイル名
     (*note str: 169.、 *note bytes: 192.、または *note path-like: 5a1.
     オブジェクトとして指定します)か、読み込みまたは書き込むためであれば
     、すでに存在するファイルオブジェクトを指定できます。

     引数 'mode' は、バイナリモードでは ‘"r"’、‘"rb"’、‘"w"’、‘"wb"’、
     ‘"x"’、‘"xb"’、‘"a"’、あるいは ‘"ab"’ の、テキストモードでは
     ‘"rt"’、‘"wt"’、‘"xt"’、あるいは ‘"at"’ のいずれかになります。デフ
     ォルトは ‘"rb"’ です。

     読み込み用にファイルをオープンした場合、引数 'format' および
     'filters' は *note LZMADecompressor: 1acb. と同じ意味になります。こ
     の時、引数 'check' および 'preset' は使用しないでください。

     書き出し用にオープンした場合、引数 'format'、'check'、'preset'、お
     よび 'filters' は *note LZMACompressor: 1acd. と同じ意味になります
     。

     バイナリモードでは、この関数は *note LZMAFile: 120e. コンストラクタ
     と等価になります (‘LZMAFile(filename, mode, ...)’)。この場合、引数
     'encoding'、'errors'、および 'newline' を指定しなければなりません。

     テキストモードでは、*note LZMAFile: 120e. オブジェクトが生成され、
     指定したエンコーディング、エラーハンドラの挙動、および改行コードで
     *note io.TextIOWrapper: 9be. にラップされます。

     バージョン 3.4 で変更: ‘"x"’, ‘"xb"’, ‘"xt"’ モードのサポートが追加
     されました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- クラス: lzma.LZMAFile (filename=None, mode='r', *, format=None,
          check=-1, preset=None, filters=None)

     LZMA 圧縮ファイルをバイナリモードで開きます。

     *note LZMAFile: 120e. はすでにオープンしている *note file object:
     13db. をラップ、または名前付きファイルを直接操作できます。引数
     'filename' にはラップするファイルオブジェクトかオープンするファイル
     名 (*note str: 169. オブジェクトま、*note bytes: 192. オブジェクト
     、または *note path-like: 5a1. オブジェクト) を指定します。既存のフ
     ァイルオブジェクトをラップした場合、*note LZMAFile: 120e. をクロー
     ズしてもラップしたファイルはクローズされません。

     引数 'mode' は読み込みモードの ‘"r"’ (デフォルト)、上書きモードの
     ‘"w"’、排他的生成モードの ‘"x"’、あるいは追記モードの ‘"a"’ のいず
     れかを指定できます。これらはそれぞれ ‘"rb"’、‘"wb"’、‘"xb"’、および
     ‘"ab"’ と等価です。

     'filename' が (実際のファイル名でなく) ファイルオブジェクトの場合、
     ‘"w"’ モードはファイルを上書きせず、‘"a"’ と等価になります。

     読み込みモードでファイルをオープンした時、入力ファイルは複数に分割
     された圧縮ストリームを連結したものでもかまいません。これらは透過的
     に単一論理ストリームとしてデコードされます。

     読み込み用にファイルをオープンした場合、引数 'format' および
     'filters' は *note LZMADecompressor: 1acb. と同じ意味になります。こ
     の時、引数 'check' および 'preset' は使用しないでください。

     書き出し用にオープンした場合、引数 'format'、'check'、'preset'、お
     よび 'filters' は *note LZMACompressor: 1acd. と同じ意味になります
     。

     *note LZMAFile: 120e. には、 *note io.BufferedIOBase: 8a3. で規定さ
     れているメソッドや属性のうち、 *note detach(): 2deb. と *note
     truncate(): 1528. を除くすべてが備わっています。イテレーションと
     *note with: 186. 文をサポートしています。

     以下のメソッドと属性も提供されています:

      -- メソッド: peek (size=-1)

          ファイル上の現在位置を変更せずにバッファのデータを返します。
          EOF に達しない限り、少なくとも 1 バイトが返されます。返される
          正確なバイト数は規定されていません (引数 'size' は無視されます
          )。

               注釈: *note peek(): 2e7f. の呼び出しでは *note LZMAFile:
               120e. のファイル位置は変わりませんが、下層のファイルオブ
               ジェクトの位置が変わる惧れがあります。(e.g.  *note
               LZMAFile: 120e. を 'filename' にファイルオブジェクトを渡
               して作成した場合)

      -- の属性: mode

          ‘'rb'’ は読み込み用、 ‘'wb'’ は書き込み用です。

          Added in version 3.13.

      -- の属性: name

          lzma ファイルの名前。基礎である *note file object: 13db. の
          *note name: 2def. 属性と同様です。

          Added in version 3.13.

     バージョン 3.4 で変更: ‘'x'’, ‘'xb'’ モードがサポートが追加されまし
     た。

     バージョン 3.5 で変更: *note read(): 1540. メソッドが ‘None’ を引数
     として受け取るようになりました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。


File: python.info,  Node: メモリ上での圧縮と展開<2>,  Next: その他<4>,  Prev: 圧縮ファイルへの読み書き<2>,  Up: lzma --- LZMA アルゴリズムを使用した圧縮

5.13.6.2 メモリ上での圧縮と展開
...............................

 -- クラス: lzma.LZMACompressor (format=FORMAT_XZ, check=-1,
          preset=None, filters=None)

     データをインクリメンタルに圧縮する圧縮オブジェクトを作成します。

     大量の単一データを圧縮する、より便利な方法については *note
     compress(): 2e83. を参照してください。

     引数 'format' には使用するコンテナフォーマットを指定します。以下の
     値が指定できます:

        * 
          ‘FORMAT_XZ’: The ‘.xz’ コンテナフォーマット。

               デフォルトのフォーマットです。

        * 
          ‘FORMAT_ALONE’: レガシーな ‘.lzma’ コンテナフォーマット。

               このフォーマットは ‘.xz’ より制限があります - インテグリ
               ティチェックや複数フィルタをサポートしていません。

        * 
          ‘FORMAT_RAW’: 特定のコンテナフォーマットを使わない、生のデータストリーム。

               このフォーマット指定子はインテグリティチェックをサポート
               しておらず、(圧縮および展開双方のために) 常にカスタムフィ
               ルタチェインを指定する必要があります。さらに、この方法で
               圧縮されたデータは ‘FORMAT_AUTO’ を使っても展開できません
               (*note LZMADecompressor: 1acb. を参照)。

     引数 'check' には圧縮データに組み込むインテグリティチェックのタイプ
     を指定します。このチェックは展開時に使用され、データが破損していな
     いことを保証します。以下の値が指定できます:

        * ‘CHECK_NONE’: インテグリティチェックなし。‘FORMAT_ALONE’ およ
          び ‘FORMAT_RAW’ のデフォルト (かつ唯一指定可能な値) です。

        * ‘CHECK_CRC32’: 32-bit 巡回冗長検査。

        * ‘CHECK_CRC64’: 64-bit 巡回冗長検査。‘FORMAT_XZ’ のデフォルトで
          す。

        * ‘CHECK_SHA256’: 256-bit セキュアハッシュアルゴリズム (SHA)。

     指定したチェック方法がサポートされていない場合、*note LZMAError:
     2e7c. が送出されます。

     圧縮設定はプリセット圧縮レベル (引数 'preset' で指定) またはカスタ
     ムフィルタチェイン (引数 'filters' で指定) のどちらかを指定します。

     引数 'preset' を指定する場合、‘0’ から ‘9’ までの整数値でなければな
     らず、オプションで定数 ‘PRESET_EXTREME’ を論理和指定できます。
     'preset' も 'filters' も指定されなかった場合、デフォルトの挙動とし
     て ‘PRESET_DEFAULT’ (プリセットレベル ‘6’) が使用されます。高いプリ
     セット値を指定すると圧縮率が上がりますが、圧縮にかかる時間が長くな
     ります。

          注釈: CPU の使用量が多いのに加えて、高いプリセットで圧縮を行う
          には、メモリをずっと多く必要とします (さらに、生成される出力も
          展開により多くのメモリを必要とします)。例えば、プリセットが
          ‘9’ の場合、*note LZMACompressor: 1acd. オブジェクトのオーバー
          ヘッドは 800 MiB にまで高くなる場合があります。このため、通常
          はデフォルトのプリセットを使用するのがよいでしょう。

     引数 'filters' を指定する場合、フィルタチェイン指定子でなければなり
     ません。詳しくは *note カスタムフィルタチェインの指定: 2e84. を参照
     してください。

      -- メソッド: compress (data)

          'data' (*note bytes: 192. オブジェクト) を圧縮し、少なくともそ
          の一部が圧縮されたデータを格納する *note bytes: 192. オブジェ
          クトを返します。'data' の一部は、後で *note compress(): 2e83.
          および *note flush(): 2e86. の呼び出しに使用するため内部でバッ
          ファされている場合があります。返すデータは以前の *note
          compress(): 2e83. 呼び出しの出力を連結したものです。

      -- メソッド: flush ()

          圧縮処理を終了し、コンプレッサの内部バッファにあるあらゆるデー
          タを格納する *note bytes: 192. オブジェクトを返します。

          コンプレッサはこのメソッドが呼び出された後は使用できません。

 -- クラス: lzma.LZMADecompressor (format=FORMAT_AUTO, memlimit=None,
          filters=None)

     データをインクリメンタルに展開するために使用できる展開オブジェクト
     を作成します。

     圧縮されたストリーム全体を一度に展開にする、より便利な方法について
     は、*note decompress(): 2e87. を参照してください。

     引数 'format' には使用するコンテナフォーマットを指定します。デフォ
     ルトは ‘FORMAT_AUTO’ で、‘.xz’ および ‘.lzma’ ファイルを展開できま
     す。その他に指定できる値は、‘FORMAT_XZ’、‘FORMAT_ALONE’、および
     ‘FORMAT_RAW’ です。

     引数 'memlimit' にはデコンプレッサが使用できるメモリ量をバイトで指
     定します。この引数を指定した場合、そのメモリ量で展開ができないと
     *note LZMAError: 2e7c. を送出します。

     引数 'filters' には展開されるストリームの作成に使用するフィルタチェ
     インを指定します。この引数を使用する際は、引数 'format' に
     ‘FORMAT_RAW’ を指定しなければなりません。フィルタチェインについての
     詳細は *note カスタムフィルタチェインの指定: 2e84. を参照してくださ
     い。

          注釈: このクラスは *note decompress(): 2e87. および *note
          LZMAFile: 120e. と異なり、複数の圧縮ストリームを含む入力を透過
          的に扱いません。 *note LZMADecompressor: 1acb. で複数ストリー
          ム入力を展開するには、各ストリームごとに新しいデコンプレッサを
          作成しなければなりません。

      -- メソッド: decompress (data, max_length=-1)

          'data' (*note bytes-like object: 193.) を展開し、未圧縮のデー
          タを bytes で返します。 'data' の一部は、後で *note
          decompress(): 2e87. の呼び出しに使用するため内部でバッファされ
          ている場合があります。 返されたデータは、以前の *note
          decompress(): 2e87. の呼び出しの出力に連結する必要があります。

          'max_length' が非負の場合、最大 'max_length' バイトの展開デー
          タを返します。この制限に達して、出力がさらに生成できる場合、
          *note needs_input: 2e88. が ‘False’ に設定されます。この場合、
          *note decompress(): 102e. を次に呼び出すと、'data' を ‘b''’ と
          して提供し、出力をさらに取得することができます。

          入力データの全てが圧縮され返された ('max_length' バイトより少
          ないためか 'max_length' が負のため) 場合、 *note needs_input:
          2e88. 属性は ‘True’ になります。

          ストリームの終端に到達した後にデータを展開しようとすると *note
          EOFError: 14f1. が送出されます。 ストリームの終端の後ろの全て
          のデータは無視され、その部分は *note unused_data: 2e89. 属性に
          保存されます。

          バージョン 3.5 で変更: ‘max_length’ パラメータが追加されました
          。

      -- の属性: check

          入力ストリームに使用されるインテグリティチェックの ID です。こ
          れは何のインテグリティチェックが使用されているか決定するために
          十分な入力がデコードされるまでは ‘CHECK_UNKNOWN’ になることが
          あります。

      -- の属性: eof

          ストリーム終端記号に到達した場合 ‘True’ を返します。

      -- の属性: unused_data

          圧縮ストリームの末尾以降に存在したデータを表します。

          ストリームの末尾に達する前は、これは ‘b""’ になります。

      -- の属性: needs_input

          *note decompress(): 102e. メソッドが、新しい非圧縮入力を必要と
          せずにさらに展開データを提供できる場合、 ‘False’ です。

          Added in version 3.5.

 -- の関数: lzma.compress (data, format=FORMAT_XZ, check=-1,
          preset=None, filters=None)

     'data' (*note bytes: 192. オブジェクト) を圧縮し、圧縮データを
     *note bytes: 192. オブジェクトとして返します。

     引数 'format'、'check'、'preset'、および 'filters' についての説明は
     上記の *note LZMACompressor: 1acd. を参照してください。

 -- の関数: lzma.decompress (data, format=FORMAT_AUTO, memlimit=None,
          filters=None)

     'data' (*note bytes: 192. オブジェクト) を展開し、展開データを
     *note bytes: 192. オブジェクトとして返します。

     'data' が複数の明確な圧縮ストリームの連結だった場合、すべてのストリ
     ームを展開し、結果の連結を返します。

     引数 'format'、'memlimit'、および 'filters' の説明は、上記 *note
     LZMADecompressor: 1acb. を参照してください。


File: python.info,  Node: その他<4>,  Next: カスタムフィルタチェインの指定,  Prev: メモリ上での圧縮と展開<2>,  Up: lzma --- LZMA アルゴリズムを使用した圧縮

5.13.6.3 その他
...............

 -- の関数: lzma.is_check_supported (check)

     指定したインテグリティチェックがシステムでサポートされていれば
     ‘True’ を返します。

     ‘CHECK_NONE’ および ‘CHECK_CRC32’ は常にサポートされています。
     ‘CHECK_CRC64’ および ‘CHECK_SHA256’ は ‘liblzma’ が機能制限セットで
     コンパイルされている場合利用できないことがあります。


File: python.info,  Node: カスタムフィルタチェインの指定,  Next: 使用例<15>,  Prev: その他<4>,  Up: lzma --- LZMA アルゴリズムを使用した圧縮

5.13.6.4 カスタムフィルタチェインの指定
.......................................

フィルタチェイン指定子は、辞書のシーケンスで、各辞書は ID と単一フィルタ
のオプションからなります。各辞書はキー ‘"id"’ を持たなければならず、フィ
ルタ依存のオプションを指定する追加キーを持つ場合もあります。有効なフィル
タ ID は以下のとおりです:

   * 圧縮フィルタ:

        * ‘FILTER_LZMA1’ (‘FORMAT_ALONE’ と共に使用)

        * ‘FILTER_LZMA2’ (‘FORMAT_XZ’ および ‘FORMAT_RAW’ と共に使用)

   * デルタフィルター:

        * ‘FILTER_DELTA’

   * ブランチコールジャンプ (BCJ) フィルター:

        * ‘FILTER_X86’

        * ‘FILTER_IA64’

        * ‘FILTER_ARM’

        * ‘FILTER_ARMTHUMB’

        * ‘FILTER_POWERPC’

        * ‘FILTER_SPARC’

一つのフィルタチェインは 4 個までのフィルタを定義することができ、空には
できません。チェインの最後は圧縮フィルタでなくてはならず、その他のフィル
タはデルタまたは BCJ フィルタでなければなりません。

圧縮フィルタは以下のオプション (追加エントリとしてフィルタを表す辞書に指
定) をサポートしています:

   * ‘preset’: 明示されていないオプションのデフォルト値のソースとして使
     用する圧縮プリセット。

   * ‘dict_size’: 辞書のサイズのバイト数。これは、 4 KiB から 1.5 GiB の
     間にしてください (両端を含みます)。

   * ‘lc’: リテラルコンテキストビットの数。

   * ‘lp’: リテラル位置ビットの数。‘lc + lp’ で最大 4 までです。

   * ‘pb’: 位置ビットの数。最大で 4 までです。

   * ‘mode’: ‘MODE_FAST’ または ‘MODE_NORMAL’。

   * ‘nice_len’: マッチに "良い" とみなす長さ。273 以下でなければなりま
     せん。

   * ‘mf’: 使用するマッチファインダ - ‘MF_HC3’、‘MF_HC4’、‘MF_BT2’、
     ‘MF_BT3’、または ‘MF_BT4’。

   * ‘depth’: マッチファインダが使用する検索の最大深度。0 (デフォルト) で
     は他のフィルタオプションをベースに自動選択します。

デルタフィルターは、バイト間の差異を保存し、特定の状況で、コンプレッサー
に対してさらに反復的な入力を生成します。 デルタフィルターは、1 つのオプ
ション ‘dist’ のみをサポートします。 これは差し引くバイトどうしの距離を
示します。 デフォルトは 1 で、隣接するバイトの差異を扱います。

The BCJ filters are intended to be applied to machine code.  They
convert relative branches, calls and jumps in the code to use absolute
addressing, with the aim of increasing the redundancy that can be
exploited by the compressor.  These filters support one option,
‘start_offset’.  This specifies the address that should be mapped to the
beginning of the input data.  The default is 0.


File: python.info,  Node: 使用例<15>,  Prev: カスタムフィルタチェインの指定,  Up: lzma --- LZMA アルゴリズムを使用した圧縮

5.13.6.5 使用例
...............

圧縮ファイルからの読み込み:

     import lzma
     with lzma.open("file.xz") as f:
         file_content = f.read()

圧縮ファイルの作成:

     import lzma
     data = b"Insert Data Here"
     with lzma.open("file.xz", "w") as f:
         f.write(data)

メモリ上でデータを圧縮:

     import lzma
     data_in = b"Insert Data Here"
     data_out = lzma.compress(data_in)

逐次圧縮:

     import lzma
     lzc = lzma.LZMACompressor()
     out1 = lzc.compress(b"Some data\n")
     out2 = lzc.compress(b"Another piece of data\n")
     out3 = lzc.compress(b"Even more data\n")
     out4 = lzc.flush()
     # Concatenate all the partial results:
     result = b"".join([out1, out2, out3, out4])

すでにオープンしているファイルへの圧縮データの書き出し:

     import lzma
     with open("file.xz", "wb") as f:
         f.write(b"This data will not be compressed\n")
         with lzma.open(f, "w") as lzf:
             lzf.write(b"This *will* be compressed\n")
         f.write(b"Not compressed\n")

カスタムフィルタチェインを使った圧縮ファイルの作成:

     import lzma
     my_filters = [
         {"id": lzma.FILTER_DELTA, "dist": 5},
         {"id": lzma.FILTER_LZMA2, "preset": 7 | lzma.PRESET_EXTREME},
     ]
     with lzma.open("file.xz", "w", filters=my_filters) as f:
         f.write(b"blah blah blah")


File: python.info,  Node: zipfile --- ZIP アーカイブの処理,  Next: tarfile --- tar アーカイブファイルの読み書き,  Prev: lzma --- LZMA アルゴリズムを使用した圧縮,  Up: データ圧縮とアーカイブ

5.13.7 ‘zipfile’ -- ZIP アーカイブの処理
----------------------------------------

'Source code:' Lib/zipfile/(1)

__________________________________________________________________

ZIP は一般によく知られているアーカイブ (書庫化) および圧縮の標準ファイル
フォーマットです。このモジュールでは ZIP 形式のファイルの作成、読み書き
、追記、書庫内のファイル一覧の作成を行うためのツールを提供します。より高
度な使い方でこのモジュールを利用したいのであれば、 PKZIP Application
Note(2) に定義されている ZIP ファイルフォーマットの理解が必要になるでし
ょう。

This module does not handle multipart ZIP files.  It can handle ZIP
files that use the ZIP64 extensions (that is ZIP files that are more
than 4 GiB in size).  It supports decryption of encrypted files in ZIP
archives, but it cannot create an encrypted file.  Decryption is
extremely slow as it is implemented in native Python rather than C.

Handling compressed archives requires *note optional modules: 215a. such
as *note zlib: 139, *note bz2: 14, *note lzma: 8e, and *note
compression.zstd: 23.  If any of them are missing from your copy of
CPython, look for documentation from your distributor (that is, whoever
provided Python to you).  If you are the distributor, see *note
オプションのモジュールの要件: 2158.

このモジュールは以下の項目を定義しています:

 -- 例外: zipfile.BadZipFile

     正常ではない ZIP ファイルに対して送出されるエラーです。

     Added in version 3.2.

 -- 例外: zipfile.BadZipfile

     *note BadZipFile: 1b68. の別名です。過去のバージョンの Python との
     互換性のために用意されています。

     バージョン 3.2 で非推奨.

 -- 例外: zipfile.LargeZipFile

     ZIP ファイルが ZIP64 の機能を必要としているが、その機能が有効化され
     ていない場合に送出されるエラーです。

 -- クラス: zipfile.ZipFile

     ZIP ファイルの読み書きのためのクラスです。コンストラクタの詳細につ
     いては、*note ZipFile objects: 2e95. 節を参照してください。

 -- クラス: zipfile.Path

     *note pathlib.Path: 266. インターフェースの一部を実装したクラスです
     。 *note importlib.resources.abc.Traversable: 2fa. インターフェース
     は完全に実装しています。

     Added in version 3.8.

 -- クラス: zipfile.PyZipFile

     Python ライブラリを含む、ZIP アーカイブを作成するためのクラスです。

 -- クラス: zipfile.ZipInfo (filename='NoName', date_time=(1980, 1, 1,
          0, 0, 0))

     Class used to represent information about a member of an archive.
     Instances of this class are returned by the *note getinfo(): 2e96.
     and *note infolist(): 2e97. methods of *note ZipFile: 8d3. objects.
     Most users of the ‘zipfile’ module will not need to create these,
     but only use those created by this module.  'filename' should be
     the full name of the archive member, and 'date_time' should be a
     tuple containing six fields which describe the time of the last
     modification to the file; the fields are described in section *note
     ZipInfo objects: 2e98.

     バージョン 3.13 で変更: A public ‘compress_level’ attribute has
     been added to expose the formerly protected ‘_compresslevel’.  The
     older protected name continues to work as a property for backwards
     compatibility.

      -- メソッド: _for_archive (archive)

          Resolve the date_time, compression attributes, and external
          attributes to suitable defaults as used by *note
          ZipFile.writestr(): 2cc.

          Returns self for chaining.

          Added in version 3.14.

 -- の関数: zipfile.is_zipfile (filename)

     'filename' が正しいマジックナンバをもつ ZIP ファイルの時に ‘True’ を
     返し、そうでない場合 ‘False’ を返します。'filename' にはファイルや
     ファイルライクオブジェクトを渡すこともできます。

     バージョン 3.1 で変更: ファイルおよびファイルライクオブジェクトをサ
     ポートしました。

 -- データ: zipfile.ZIP_STORED

     アーカイブメンバを圧縮しない (複数ファイルを一つにまとめるだけ) こ
     とを表す数値定数です。

 -- データ: zipfile.ZIP_DEFLATED

     通常の ZIP 圧縮方法を表す数値定数です。これには *note zlib: 139. モ
     ジュールが必要です。

 -- データ: zipfile.ZIP_BZIP2

     BZIP2 圧縮方法を表す数値定数です。これには *note bz2: 14. モジュー
     ルが必要です。

     Added in version 3.3.

 -- データ: zipfile.ZIP_LZMA

     LZMA 圧縮方法を表す数値定数です。これには *note lzma: 8e. モジュー
     ルが必要です。

     Added in version 3.3.

 -- データ: zipfile.ZIP_ZSTANDARD

     The numeric constant for Zstandard compression.  This requires the
     *note compression.zstd: 23. module.

          注釈: In APPNOTE 6.3.7, the method ID ‘20’ was assigned to
          Zstandard compression.  This was changed in APPNOTE 6.3.8 to
          method ID ‘93’ to avoid conflicts, with method ID ‘20’ being
          deprecated.  For compatibility, the ‘zipfile’ module reads
          both method IDs but will only write data with method ID ‘93’.

     Added in version 3.14.

     注釈: The ZIP file format specification has included support for
     bzip2 compression since 2001, for LZMA compression since 2006, and
     Zstandard compression since 2020.  However, some tools (including
     older Python releases) do not support these compression methods,
     and may either refuse to process the ZIP file altogether, or fail
     to extract individual files.

参考
....

PKZIP Application Note(3)

     ZIP ファイルフォーマットおよびアルゴリズムを作成した Phil Katz によ
     るドキュメント。

Info-ZIP Home Page(4)

     Info-ZIP プロジェクトによる ZIP アーカイブプログラムおよびプログラ
     ム開発ライブラリに関する情報。

* Menu:

* ZipFile objects::
* Path objects::
* PyZipFile objects::
* ZipInfo objects::
* コマンドライン・インターフェース: コマンドライン・インターフェース<4>.
* Decompression pitfalls::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/zipfile/

   (2) https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

   (3) https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

   (4) https://infozip.sourceforge.net/


File: python.info,  Node: ZipFile objects,  Next: Path objects,  Up: zipfile --- ZIP アーカイブの処理

5.13.7.1 ZipFile objects
........................

 -- クラス: zipfile.ZipFile (file, mode='r', compression=ZIP_STORED,
          allowZip64=True, compresslevel=None, *,
          strict_timestamps=True, metadata_encoding=None)

     ZIP ファイルを開きます。 'file' はファイルのパス (文字列) か、ファ
     イルライクオブジェクト、 *note path-like object: 5a1. のいずれかで
     す。

     'mode' パラメータには、既存のファイルを読み込む場合は ‘'r'’ 、内容
     を消去して新しいファイルに書き込む場合は ‘'w'’ 、既存のファイルの末
     尾に追加する場合は ‘'a'’ 、ファイルが存在しない場合にのみファイルを
     作成して書き込む場合は ‘'x'’ を指定します。 'mode' が ‘'x'’ で
     'file' が既存のファイルを指している場合、 *note FileExistsError:
     1221. が発生します。 'mode' が ‘'a'’ で 'file' が既存の ZIP ファイ
     ルを指している場合、新しい ZIP アーカイブがそのファイルに追加されま
     す。 'file' が ZIP ファイルでない場合は、ファイルの末尾にあたらしい
     ZIP アーカイブが追加されます。 これは、既存のファイル (例えば
     ‘python.exe’) に ZIP アーカイブを付け加える用途を想定したものです。
     'mode' が ‘'a'’ で 'file' が存在しない場合は、ファイルが作成されま
     す。 'mode' が ‘'r'’ か ‘'a'’ の場合、ファイルはシーク可能である必
     要があります。

     'compression' is the ZIP compression method to use when writing the
     archive, and should be *note ZIP_STORED: 2e99, *note ZIP_DEFLATED:
     2e9a, *note ZIP_BZIP2: 2e9b, *note ZIP_LZMA: 2e9c, or *note
     ZIP_ZSTANDARD: 2e9d.; unrecognized values will cause *note
     NotImplementedError: 36b. to be raised.  If *note ZIP_DEFLATED:
     2e9a, *note ZIP_BZIP2: 2e9b, *note ZIP_LZMA: 2e9c, or *note
     ZIP_ZSTANDARD: 2e9d. is specified but the corresponding module
     (*note zlib: 139, *note bz2: 14, *note lzma: 8e, or *note
     compression.zstd: 23.) is not available, *note RuntimeError: 244.
     is raised.  The default is *note ZIP_STORED: 2e99.

     If 'allowZip64' is ‘True’ (the default) zipfile will create ZIP
     files that use the ZIP64 extensions when the zipfile is larger than
     4 GiB. If it is ‘false’ ‘zipfile’ will raise an exception when the
     ZIP file would require ZIP64 extensions.

     The 'compresslevel' parameter controls the compression level to use
     when writing files to the archive.  When using *note ZIP_STORED:
     2e99. or *note ZIP_LZMA: 2e9c. it has no effect.  When using *note
     ZIP_DEFLATED: 2e9a. integers ‘0’ through ‘9’ are accepted (see
     *note zlib: 2e33. for more information).  When using *note
     ZIP_BZIP2: 2e9b. integers ‘1’ through ‘9’ are accepted (see *note
     bz2: a66. for more information).  When using *note ZIP_ZSTANDARD:
     2e9d. integers ‘-131072’ through ‘22’ are commonly accepted (see
     *note CompressionParameter.compression_level: 2df1. for more on
     retrieving valid values and their meaning).

     The 'strict_timestamps' argument, when set to ‘False’, allows to
     zip files older than 1980-01-01 at the cost of setting the
     timestamp to 1980-01-01.  Similar behavior occurs with files newer
     than 2107-12-31, the timestamp is also set to the limit.

     When mode is ‘'r'’, 'metadata_encoding' may be set to the name of a
     codec, which will be used to decode metadata such as the names of
     members and ZIP comments.

     ファイルがモード ‘'w'’、 ‘'x'’ または ‘'a'’ で作成され、その後その
     アーカイブにファイルを追加することなく *note クローズ: 2e9f. された
     場合、空のアーカイブのための適切な ZIP 構造がファイルに書き込まれま
     す。

     ZipFile はコンテキストマネージャにもなっているので、*note with:
     186. 文をサポートしています。次の例では、'myzip' は ‘with’ 文のブロ
     ックが終了したときに、(たとえ例外が発生したとしても) クローズされま
     す:

          with ZipFile('spam.zip', 'w') as myzip:
              myzip.write('eggs.txt')

          注釈: 'metadata_encoding' is an instance-wide setting for the
          ZipFile.  It is not possible to set this on a per-member
          basis.

          This attribute is a workaround for legacy implementations
          which produce archives with names in the current locale
          encoding or code page (mostly on Windows).  According to the
          .ZIP standard, the encoding of metadata may be specified to be
          either IBM code page (default) or UTF-8 by a flag in the
          archive header.  That flag takes precedence over
          'metadata_encoding', which is a Python-specific extension.

     バージョン 3.2 で変更: *note ZipFile: 8d3. をコンテキストマネージャ
     として使用できるようになりました。

     バージョン 3.3 で変更: *note bzip2: 14. および *note lzma: 8e. 圧縮
     をサポートしました。

     バージョン 3.4 で変更: ZIP64 拡張がデフォルトで有効になりました。

     バージョン 3.5 で変更: seek 出来ないストリームのサポートが追加され
     ました。‘'x'’ モードのサポートが追加されました。

     バージョン 3.6 で変更: Previously, a plain *note RuntimeError: 244.
     was raised for unrecognized compression values.

     バージョン 3.6.2 で変更: 'file' 引数が *note path-like object: 5a1.
     を受け入れるようになりました。

     バージョン 3.7 で変更: 'compresslevel' パラメータが追加されました。

     バージョン 3.8 で変更: The 'strict_timestamps' keyword-only
     parameter.

     バージョン 3.11 で変更: Added support for specifying member name
     encoding for reading metadata in the zipfile's directory and file
     headers.

 -- メソッド: ZipFile.close ()

     アーカイブファイルをクローズします。*note close(): 2e9f. はプログラ
     ムを終了する前に必ず呼び出さなければなりません。さもないとアーカイ
     ブ上の重要なレコードが書き込まれません。

 -- メソッド: ZipFile.getinfo (name)

     アーカイブメンバ 'name' に関する情報を持つ *note ZipInfo: 2cb. オブ
     ジェクトを返します。アーカイブに含まれないファイル名に対して *note
     getinfo(): 2e96. を呼び出すと、*note KeyError: 5e7. が送出されます
     。

 -- メソッド: ZipFile.infolist ()

     アーカイブに含まれる各メンバの *note ZipInfo: 2cb. オブジェクトから
     なるリストを返します。既存のアーカイブファイルを開いている場合、リ
     ストの順番は実際の ZIP ファイル中のメンバの順番と同じになります。

 -- メソッド: ZipFile.namelist ()

     アーカイブメンバの名前のリストを返します。

 -- メソッド: ZipFile.open (name, mode='r', pwd=None, *,
          force_zip64=False)

     Access a member of the archive as a binary file-like object.
     'name' can be either the name of a file within the archive or a
     *note ZipInfo: 2cb. object.  The 'mode' parameter, if included,
     must be ‘'r'’ (the default) or ‘'w'’.  'pwd' is the password used
     to decrypt encrypted ZIP files as a *note bytes: 192. object.

     *note open(): 65d. はコンテキストマネージャでもあるので *note with:
     186. 文をサポートしています:

          with ZipFile('spam.zip') as myzip:
              with myzip.open('eggs.txt') as myfile:
                  print(myfile.read())

     With 'mode' ‘'r'’ the file-like object (‘ZipExtFile’) is read-only
     and provides the following methods: *note read(): 1540, *note
     readline(): 1541, *note readlines(): 27a1, *note seek(): 14a4,
     *note tell(): 15c6, *note __iter__(): 20aa, *note __next__(): 14e5.
     These objects can operate independently of the ZipFile.

     With ‘mode='w'’, a writable file handle is returned, which supports
     the *note write(): ed7. method.  While a writable file handle is
     open, attempting to read or write other files in the ZIP file will
     raise a *note ValueError: 2ec.

     In both cases the file-like object has also attributes ‘name’,
     which is equivalent to the name of a file within the archive, and
     ‘mode’, which is ‘'rb'’ or ‘'wb'’ depending on the input mode.

     When writing a file, if the file size is not known in advance but
     may exceed 2 GiB, pass ‘force_zip64=True’ to ensure that the header
     format is capable of supporting large files.  If the file size is
     known in advance, construct a *note ZipInfo: 2cb. object with *note
     file_size: 2ea1. set, and use that as the 'name' parameter.

          注釈: *note open(): 65d.、*note read(): 2ea2.、および *note
          extract(): 2ea3. メソッドには、ファイル名または *note ZipInfo:
          2cb. オブジェクトを指定できます。これは重複する名前のメンバを
          含む ZIP ファイルを読み込むときにそのメリットを享受できるでし
          ょう。

     バージョン 3.6 で変更: Removed support of ‘mode='U'’.  Use *note
     io.TextIOWrapper: 9be. for reading compressed text files in *note
     universal newlines: f35. mode.

     バージョン 3.6 で変更: *note ZipFile.open(): 65d. can now be used
     to write files into the archive with the ‘mode='w'’ option.

     バージョン 3.6 で変更: Calling *note open(): 65d. on a closed
     ZipFile will raise a *note ValueError: 2ec.  Previously, a *note
     RuntimeError: 244. was raised.

     バージョン 3.13 で変更: Added attributes ‘name’ and ‘mode’ for the
     writeable file-like object.  The value of the ‘mode’ attribute for
     the readable file-like object was changed from ‘'r'’ to ‘'rb'’.

 -- メソッド: ZipFile.extract (member, path=None, pwd=None)

     Extract a member from the archive to the current working directory;
     'member' must be its full name or a *note ZipInfo: 2cb. object.
     Its file information is extracted as accurately as possible.
     'path' specifies a different directory to extract to.  'member' can
     be a filename or a *note ZipInfo: 2cb. object.  'pwd' is the
     password used for encrypted files as a *note bytes: 192. object.

     作成された (ディレクトリか新ファイルの) 正規化されたパスを返します
     。

          注釈: メンバのファイル名が絶対パスなら、ドライブ/UNC
          sharepoint および先頭の (バック) スラッシュは取り除かれます。
          例えば、Unix で ‘///foo/bar’ は ‘foo/bar’ となり、Window で
          ‘C:\foo\bar’ は ‘foo\bar’ となります。また、メンバのファイル名
          に含まれる全ての ‘".."’ は取り除かれます。例えば、
          ‘../../foo../../ba..r’ は ‘foo../ba..r’ となります。Windows で
          は、不正な文字 (‘:’, ‘<’, ‘>’, ‘|’, ‘"’, ‘?’, および ‘*’) はア
          ンダースコア (‘_’) で置き換えられます。

     バージョン 3.6 で変更: Calling *note extract(): 2ea3. on a closed
     ZipFile will raise a *note ValueError: 2ec.  Previously, a *note
     RuntimeError: 244. was raised.

     バージョン 3.6.2 で変更: 'path' パラメタが *note path-like object:
     5a1. を受け付けるようになりました。

 -- メソッド: ZipFile.extractall (path=None, members=None, pwd=None)

     Extract all members from the archive to the current working
     directory.  'path' specifies a different directory to extract to.
     'members' is optional and must be a subset of the list returned by
     *note namelist(): 2ea0.  'pwd' is the password used for encrypted
     files as a *note bytes: 192. object.

          警告: 信頼できないソースからきた Zip ファイルを、事前に中身を
          チェックせずに展開してはいけません。ファイルを 'path' の外側に
          作成することができるからです。例えば、 ‘"/"’ で始まる絶対パス
          を持ったメンバーや、 2 つのドット ‘".."’ を持つファイル名など
          の場合です。このモジュールはそれを避けようとします。 *note
          extract(): 2ea3. の注釈を参照してください。

     バージョン 3.6 で変更: Calling *note extractall(): 2ea4. on a
     closed ZipFile will raise a *note ValueError: 2ec.  Previously, a
     *note RuntimeError: 244. was raised.

     バージョン 3.6.2 で変更: 'path' パラメタが *note path-like object:
     5a1. を受け付けるようになりました。

 -- メソッド: ZipFile.printdir ()

     アーカイブの内容の一覧を ‘sys.stdout’ に出力します。

 -- メソッド: ZipFile.setpassword (pwd)

     Set 'pwd' (a *note bytes: 192. object) as default password to
     extract encrypted files.

 -- メソッド: ZipFile.read (name, pwd=None)

     Return the bytes of the file 'name' in the archive.  'name' is the
     name of the file in the archive, or a *note ZipInfo: 2cb. object.
     The archive must be open for read or append.  'pwd' is the password
     used for encrypted files as a *note bytes: 192. object and, if
     specified, overrides the default password set with *note
     setpassword(): 2ea6.  Calling *note read(): 2ea2. on a ZipFile that
     uses a compression method other than *note ZIP_STORED: 2e99, *note
     ZIP_DEFLATED: 2e9a, *note ZIP_BZIP2: 2e9b, *note ZIP_LZMA: 2e9c, or
     *note ZIP_ZSTANDARD: 2e9d. will raise a *note NotImplementedError:
     36b.  An error will also be raised if the corresponding compression
     module is not available.

     バージョン 3.6 で変更: Calling *note read(): 2ea2. on a closed
     ZipFile will raise a *note ValueError: 2ec.  Previously, a *note
     RuntimeError: 244. was raised.

 -- メソッド: ZipFile.testzip ()

     Read all the files in the archive and check their CRC's and file
     headers.  Return the name of the first bad file, or else return
     ‘None’.

     バージョン 3.6 で変更: Calling *note testzip(): 2ea7. on a closed
     ZipFile will raise a *note ValueError: 2ec.  Previously, a *note
     RuntimeError: 244. was raised.

 -- メソッド: ZipFile.write (filename, arcname=None, compress_type=None,
          compresslevel=None)

     Write the file named 'filename' to the archive, giving it the
     archive name 'arcname' (by default, this will be the same as
     'filename', but without a drive letter and with leading path
     separators removed).  If given, 'compress_type' overrides the value
     given for the 'compression' parameter to the constructor for the
     new entry.  Similarly, 'compresslevel' will override the
     constructor if given.  The archive must be open with mode ‘'w'’,
     ‘'x'’ or ‘'a'’.

          注釈: The ZIP file standard historically did not specify a
          metadata encoding, but strongly recommended CP437 (the
          original IBM PC encoding) for interoperability.  Recent
          versions allow use of UTF-8 (only).  In this module, UTF-8
          will automatically be used to write the member names if they
          contain any non-ASCII characters.  It is not possible to write
          member names in any encoding other than ASCII or UTF-8.

          注釈: アーカイブ名はアーカイブルートに対する相対パスでなければ
          なりません。言い換えると、アーカイブ名はパスセパレータで始まっ
          てはいけません。

          注釈: もし、‘arcname’ (‘arcname’ が与えられない場合は、
          ‘filename’) が null byte を含むなら、アーカイブ中のファイルの
          ファイル名は、null byte までで切り詰められます。

          注釈: A leading slash in the filename may lead to the archive
          being impossible to open in some zip programs on Windows
          systems.

     バージョン 3.6 で変更: Calling *note write(): f49. on a ZipFile
     created with mode ‘'r'’ or a closed ZipFile will raise a *note
     ValueError: 2ec.  Previously, a *note RuntimeError: 244. was
     raised.

 -- メソッド: ZipFile.writestr (zinfo_or_arcname, data,
          compress_type=None, compresslevel=None)

     Write a file into the archive.  The contents is 'data', which may
     be either a *note str: 169. or a *note bytes: 192. instance; if it
     is a *note str: 169, it is encoded as UTF-8 first.
     'zinfo_or_arcname' is either the file name it will be given in the
     archive, or a *note ZipInfo: 2cb. instance.  If it's an instance,
     at least the filename, date, and time must be given.  If it's a
     name, the date and time is set to the current date and time.  The
     archive must be opened with mode ‘'w'’, ‘'x'’ or ‘'a'’.

     If given, 'compress_type' overrides the value given for the
     'compression' parameter to the constructor for the new entry, or in
     the 'zinfo_or_arcname' (if that is a *note ZipInfo: 2cb. instance).
     Similarly, 'compresslevel' will override the constructor if given.

          注釈: *note ZipInfo: 2cb. インスタンスを引数
          'zinfo_or_arcname' として与えた場合、与えられた *note ZipInfo:
          2cb. インスタンスのメンバーである 'compress_type' で指定された
          圧縮方法が使われます。デフォルトでは、*note ZipInfo: 2cb. コン
          ストラクターが、このメンバーを *note ZIP_STORED: 2e99. に設定
          します。

     バージョン 3.2 で変更: 引数 'compress_type' を追加しました。

     バージョン 3.6 で変更: Calling *note writestr(): 2cc. on a ZipFile
     created with mode ‘'r'’ or a closed ZipFile will raise a *note
     ValueError: 2ec.  Previously, a *note RuntimeError: 244. was
     raised.

 -- メソッド: ZipFile.mkdir (zinfo_or_directory, mode=511)

     Create a directory inside the archive.  If 'zinfo_or_directory' is
     a string, a directory is created inside the archive with the mode
     that is specified in the 'mode' argument.  If, however,
     'zinfo_or_directory' is a *note ZipInfo: 2cb. instance then the
     'mode' argument is ignored.

     The archive must be opened with mode ‘'w'’, ‘'x'’ or ‘'a'’.

     Added in version 3.11.

以下のデータ属性も利用することができます:

 -- の属性: ZipFile.filename

     ZIP ファイルの名前です。

 -- の属性: ZipFile.debug

     使用するデバッグ出力レベルです。この属性は ‘0’ (デフォルト、何も出
     力しない) から ‘3’ (最も多く出力する) までの値に設定することができ
     ます。デバッグ情報は ‘sys.stdout’ に出力されます。

 -- の属性: ZipFile.comment

     ZIP ファイルに *note bytes: 192. オブジェクトとして関連付けられたコ
     メントです。モード ‘'w'’ 、 ‘'x'’ または ‘'a'’ で作成された *note
     ZipFile: 8d3. インスタンスへコメントを割り当てる場合、文字列長は
     65535 バイトまでにしてください。その長さを超えたコメントは切り捨て
     られます。


File: python.info,  Node: Path objects,  Next: PyZipFile objects,  Prev: ZipFile objects,  Up: zipfile --- ZIP アーカイブの処理

5.13.7.2 Path objects
.....................

 -- クラス: zipfile.Path (root, at='')

     Construct a Path object from a ‘root’ zipfile (which may be a *note
     ZipFile: 8d3. instance or ‘file’ suitable for passing to the *note
     ZipFile: 8d3. constructor).

     ‘at’ specifies the location of this Path within the zipfile, e.g.
     'dir/file.txt', 'dir/', or ''.  Defaults to the empty string,
     indicating the root.

          注釈: The *note Path: 8d8. class does not sanitize filenames
          within the ZIP archive.  Unlike the *note ZipFile.extract():
          2ea3. and *note ZipFile.extractall(): 2ea4. methods, it is the
          caller's responsibility to validate or sanitize filenames to
          prevent path traversal vulnerabilities (e.g., filenames
          containing ".."  or absolute paths).  When handling untrusted
          archives, consider resolving filenames using *note
          os.path.abspath(): 1532. and checking against the target
          directory with *note os.path.commonpath(): 103d.

Path objects expose the following features of *note pathlib.Path: 266.
objects:

Path objects are traversable using the ‘/’ operator or ‘joinpath’.

 -- の属性: Path.name

     The final path component.

 -- メソッド: Path.open (mode='r', *, pwd, **)

     Invoke *note ZipFile.open(): 65d. on the current path.  Allows
     opening for read or write, text or binary through supported modes:
     'r', 'w', 'rb', 'wb'.  Positional and keyword arguments are passed
     through to *note io.TextIOWrapper: 9be. when opened as text and
     ignored otherwise.  ‘pwd’ is the ‘pwd’ parameter to *note
     ZipFile.open(): 65d.

     バージョン 3.9 で変更: Added support for text and binary modes for
     open.  Default mode is now text.

     バージョン 3.11.2 で変更: The ‘encoding’ parameter can be supplied
     as a positional argument without causing a *note TypeError: 198.
     As it could in 3.9.  Code needing to be compatible with unpatched
     3.10 and 3.11 versions must pass all *note io.TextIOWrapper: 9be.
     arguments, ‘encoding’ included, as keywords.

 -- メソッド: Path.iterdir ()

     Enumerate the children of the current directory.

 -- メソッド: Path.is_dir ()

     Return ‘True’ if the current context references a directory.

 -- メソッド: Path.is_file ()

     Return ‘True’ if the current context references a file.

 -- メソッド: Path.is_symlink ()

     Return ‘True’ if the current context references a symbolic link.

     Added in version 3.12.

     バージョン 3.13 で変更: Previously, ‘is_symlink’ would
     unconditionally return ‘False’.

 -- メソッド: Path.exists ()

     Return ‘True’ if the current context references a file or directory
     in the zip file.

 -- データ: Path.suffix

     The last dot-separated portion of the final component, if any.
     This is commonly called the file extension.

     Added in version 3.11: Added *note Path.suffix: 8d6. property.

 -- データ: Path.stem

     The final path component, without its suffix.

     Added in version 3.11: Added *note Path.stem: 8d5. property.

 -- データ: Path.suffixes

     A list of the path’s suffixes, commonly called file extensions.

     Added in version 3.11: Added *note Path.suffixes: 8d7. property.

 -- メソッド: Path.read_text (*, **)

     Read the current file as unicode text.  Positional and keyword
     arguments are passed through to *note io.TextIOWrapper: 9be.
     (except ‘buffer’, which is implied by the context).

     バージョン 3.11.2 で変更: The ‘encoding’ parameter can be supplied
     as a positional argument without causing a *note TypeError: 198.
     As it could in 3.9.  Code needing to be compatible with unpatched
     3.10 and 3.11 versions must pass all *note io.TextIOWrapper: 9be.
     arguments, ‘encoding’ included, as keywords.

 -- メソッド: Path.read_bytes ()

     Read the current file as bytes.

 -- メソッド: Path.joinpath (*other)

     Return a new Path object with each of the 'other' arguments joined.
     The following are equivalent:

          >>> Path(...).joinpath('child').joinpath('grandchild')
          >>> Path(...).joinpath('child', 'grandchild')
          >>> Path(...) / 'child' / 'grandchild'

     バージョン 3.10 で変更: Prior to 3.10, ‘joinpath’ was undocumented
     and accepted exactly one parameter.

The zipp(1) project provides backports of the latest path object
functionality to older Pythons.  Use ‘zipp.Path’ in place of
‘zipfile.Path’ for early access to changes.

   ---------- Footnotes ----------

   (1) https://pypi.org/project/zipp/


File: python.info,  Node: PyZipFile objects,  Next: ZipInfo objects,  Prev: Path objects,  Up: zipfile --- ZIP アーカイブの処理

5.13.7.3 PyZipFile objects
..........................

*note PyZipFile: 11fa. コンストラクタは *note ZipFile: 8d3. コンストラク
タと同じパラメータに加え、'optimize' パラメータをとります。

 -- クラス: zipfile.PyZipFile (file, mode='r', compression=ZIP_STORED,
          allowZip64=True, optimize=-1)

     バージョン 3.2 で変更: Added the 'optimize' parameter.

     バージョン 3.4 で変更: ZIP64 拡張がデフォルトで有効になりました。

     インスタンスは *note ZipFile: 8d3. オブジェクトのメソッドの他に、追
     加のメソッドを 1 個持ちます:

      -- メソッド: writepy (pathname, basename='', filterfunc=None)

          ‘*.py’ ファイルを探し、一致するファイルをアーカイブに追加しま
          す。

          *note PyZipFile: 11fa. に 'optimize' 引数が与えられない場合、
          あるいは ‘-1’ が指定された場合、対応するファイルは ‘*.pyc’ フ
          ァイルで、必要に応じてコンパイルします。

          *note PyZipFile: 11fa. の 'optimize' パラメータが ‘0’、‘1’、あ
          るいは ‘2’ の場合、それを最適化レベル (*note compile(): 4b1. 参
          照) とするファイルのみが、必要に応じてコンパイルされアーカイブ
          に追加されます。

          If 'pathname' is a file, the filename must end with ‘.py’, and
          just the (corresponding ‘*.pyc’) file is added at the top
          level (no path information).  If 'pathname' is a file that
          does not end with ‘.py’, a *note RuntimeError: 244. will be
          raised.  If it is a directory, and the directory is not a
          package directory, then all the files ‘*.pyc’ are added at the
          top level.  If the directory is a package directory, then all
          ‘*.pyc’ are added under the package name as a file path, and
          if any subdirectories are package directories, all of these
          are added recursively in sorted order.

          'basename' は内部が使用するためだけのものです。

          'filterfunc' を与える場合、単一の文字列引数を取る関数を渡して
          ください。これには(個々のフルパスを含む)それぞれのパスがアーカ
          イブに加えられる前に渡されます。 'filterfunc' が偽を返せば、そ
          のパスはアーカイブに追加されず、ディレクトリだった場合はその中
          身が無視されます。例として、私たちのテストファイルが全て
          ‘test’ ディレクトリの中にあるか、 ‘test’ 文字列で始まるとしま
          しょう。 'filterfunc' を使ってそれらを除外出来ます:

               >>> zf = PyZipFile('myprog.zip')
               >>> def notests(s):
               ...     fn = os.path.basename(s)
               ...     return (not (fn == 'test' or fn.startswith('test_')))
               ...
               >>> zf.writepy('myprog', filterfunc=notests)

          *note writepy(): 11fb. メソッドは以下のようなファイル名でアー
          カイブを作成します:

               string.pyc                   # Top level name
               test/__init__.pyc            # Package directory
               test/testall.pyc             # Module test.testall
               test/bogus/__init__.pyc      # Subpackage directory
               test/bogus/myfile.pyc        # Submodule test.bogus.myfile

          バージョン 3.4 で変更: Added the 'filterfunc' parameter.

          バージョン 3.6.2 で変更: 'pathname' 引数が *note path-like
          object: 5a1. を受け付けるようになりました。

          バージョン 3.7 で変更: Recursion sorts directory entries.


File: python.info,  Node: ZipInfo objects,  Next: コマンドライン・インターフェース<4>,  Prev: PyZipFile objects,  Up: zipfile --- ZIP アーカイブの処理

5.13.7.4 ZipInfo objects
........................

*note ZipInfo: 2cb. クラスのインスタンスは、*note ZipFile: 8d3. オブジェ
クトの *note getinfo(): 2e96. および *note infolist(): 2e97. メソッドに
よって返されます。各オブジェクトは ZIP アーカイブ内の 1 個のメンバに関す
る情報を格納します。

There is one classmethod to make a *note ZipInfo: 2cb. instance for a
filesystem file:

 -- メソッド: classmethod ZipInfo.from_file (filename, arcname=None, *,
          strict_timestamps=True)

     Construct a *note ZipInfo: 2cb. instance for a file on the
     filesystem, in preparation for adding it to a zip file.

     'filename' should be the path to a file or directory on the
     filesystem.

     If 'arcname' is specified, it is used as the name within the
     archive.  If 'arcname' is not specified, the name will be the same
     as 'filename', but with any drive letter and leading path
     separators removed.

     The 'strict_timestamps' argument, when set to ‘False’, allows to
     zip files older than 1980-01-01 at the cost of setting the
     timestamp to 1980-01-01.  Similar behavior occurs with files newer
     than 2107-12-31, the timestamp is also set to the limit.

     Added in version 3.6.

     バージョン 3.6.2 で変更: 'filename' 引数が *note path-like object:
     5a1. を受け入れるようになりました。

     バージョン 3.8 で変更: Added the 'strict_timestamps' keyword-only
     parameter.

インスタンスは以下のメソッドと属性を持ちます:

 -- メソッド: ZipInfo.is_dir ()

     アーカイブのメンバーがディレクトリの場合に ‘True’ を返します。

     This uses the entry's name: directories should always end with ‘/’.

     Added in version 3.6.

 -- の属性: ZipInfo.filename

     アーカイブ中のファイル名。

 -- の属性: ZipInfo.date_time

     The time and date of the last modification to the archive member.
     This is a tuple of six values representing the "last [modified]
     file time" and "last [modified] file date" fields from the ZIP
     file's central directory.

     The tuple contains:

     インデッ    値
     クス        

     -------------------------------------------
                 
     ‘0’         西暦年 (>= 1980)
                 
                 
     ‘1’         月 (1 から始まる)
                 
                 
     ‘2’         日 (1 から始まる)
                 
                 
     ‘3’         時 (0 から始まる)
                 
                 
     ‘4’         分 (0 から始まる)
                 
                 
     ‘5’         秒 (0 から始まる)
                 

          注釈: The ZIP format supports multiple timestamp fields in
          different locations (central directory, extra fields for
          NTFS/UNIX systems, etc.).  This attribute specifically returns
          the timestamp from the central directory.  The central
          directory timestamp format in ZIP files does not support
          timestamps before 1980.  While some extra field formats (such
          as UNIX timestamps) can represent earlier dates, this
          attribute only returns the central directory timestamp.

          The central directory timestamp is interpreted as representing
          local time, rather than UTC time, to match the behavior of
          other zip tools.

 -- の属性: ZipInfo.compress_type

     アーカイブメンバの圧縮形式。

 -- の属性: ZipInfo.comment

     Comment for the individual archive member as a *note bytes: 192.
     object.

 -- の属性: ZipInfo.extra

     拡張フィールドデータ。この *note bytes: 192. オブジェクトに含まれて
     いるデータの内部構成については、PKZIP Application Note(1) でコメン
     トされています。

 -- の属性: ZipInfo.create_system

     ZIP アーカイブを作成したシステムを記述する文字列。

 -- の属性: ZipInfo.create_version

     このアーカイブを作成した PKZIP のバージョン。

 -- の属性: ZipInfo.extract_version

     このアーカイブを展開する際に必要な PKZIP のバージョン。

 -- の属性: ZipInfo.reserved

     予約領域。ゼロでなくてはなりません。

 -- の属性: ZipInfo.flag_bits

     ZIP フラグビット列。

 -- の属性: ZipInfo.volume

     ファイルヘッダのボリューム番号。

 -- の属性: ZipInfo.internal_attr

     内部属性。

 -- の属性: ZipInfo.external_attr

     外部ファイル属性。

 -- の属性: ZipInfo.header_offset

     ファイルヘッダへのバイトオフセット。

 -- の属性: ZipInfo.CRC

     圧縮前のファイルの CRC-32 チェックサム。

 -- の属性: ZipInfo.compress_size

     圧縮後のデータのサイズ。

 -- の属性: ZipInfo.file_size

     圧縮前のファイルのサイズ。

   ---------- Footnotes ----------

   (1) https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT


File: python.info,  Node: コマンドライン・インターフェース<4>,  Next: Decompression pitfalls,  Prev: ZipInfo objects,  Up: zipfile --- ZIP アーカイブの処理

5.13.7.5 コマンドライン・インターフェース
.........................................

The ‘zipfile’ module provides a simple command-line interface to
interact with ZIP archives.

ZIP アーカイブを新規に作成したい場合、*note -c: 2eca. オプションの後にま
とめたいファイルを列挙してください:

     $ python -m zipfile -c monty.zip spam.txt eggs.txt

ディレクトリを渡すこともできます:

     $ python -m zipfile -c monty.zip life-of-brian_1979/

ZIP アーカイブを特定のディレクトリに展開したい場合、*note -e: 2ecb. オプ
ションを使用してください:

     $ python -m zipfile -e monty.zip target-dir/

ZIP アーカイブ内のファイル一覧を表示するには *note -l: 2ecc. を使用して
ください:

     $ python -m zipfile -l monty.zip

* Menu:

* コマンドラインオプション: コマンドラインオプション<2>.


File: python.info,  Node: コマンドラインオプション<2>,  Up: コマンドライン・インターフェース<4>

5.13.7.6 コマンドラインオプション
.................................

 -- Option: -l <zipfile>
 -- Option: --list <zipfile>

     zipfile 内のファイル一覧を表示します。

 -- Option: -c <zipfile> <source1> ... <sourceN>
 -- Option: --create <zipfile> <source1> ... <sourceN>

     ソースファイルから zipfile を作成します。

 -- Option: -e <zipfile> <output_dir>
 -- Option: --extract <zipfile> <output_dir>

     zipfile を対象となるディレクトリに展開します。

 -- Option: -t <zipfile>
 -- Option: --test <zipfile>

     zipfile が有効かどうか調べます。

 -- Option: --metadata-encoding <encoding>

     Specify encoding of member names for *note -l: 2ecc, *note -e:
     2ecb. and *note -t: 2ed1.

     Added in version 3.11.


File: python.info,  Node: Decompression pitfalls,  Prev: コマンドライン・インターフェース<4>,  Up: zipfile --- ZIP アーカイブの処理

5.13.7.7 Decompression pitfalls
...............................

The extraction in zipfile module might fail due to some pitfalls listed
below.

* Menu:

* From file itself::
* File system limitations::
* Resources limitations::
* Interruption::
* Default behaviors of extraction::


File: python.info,  Node: From file itself,  Next: File system limitations,  Up: Decompression pitfalls

5.13.7.8 From file itself
.........................

Decompression may fail due to incorrect password / CRC checksum / ZIP
format or unsupported compression method / decryption.


File: python.info,  Node: File system limitations,  Next: Resources limitations,  Prev: From file itself,  Up: Decompression pitfalls

5.13.7.9 File system limitations
................................

Exceeding limitations on different file systems can cause decompression
failed.  Such as allowable characters in the directory entries, length
of the file name, length of the pathname, size of a single file, and
number of files, etc.


File: python.info,  Node: Resources limitations,  Next: Interruption,  Prev: File system limitations,  Up: Decompression pitfalls

5.13.7.10 Resources limitations
...............................

The lack of memory or disk volume would lead to decompression failed.
For example, decompression bombs (aka ZIP bomb(1)) apply to zipfile
library that can cause disk volume exhaustion.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Zip_bomb


File: python.info,  Node: Interruption,  Next: Default behaviors of extraction,  Prev: Resources limitations,  Up: Decompression pitfalls

5.13.7.11 Interruption
......................

Interruption during the decompression, such as pressing control-C or
killing the decompression process may result in incomplete decompression
of the archive.


File: python.info,  Node: Default behaviors of extraction,  Prev: Interruption,  Up: Decompression pitfalls

5.13.7.12 Default behaviors of extraction
.........................................

Not knowing the default extraction behaviors can cause unexpected
decompression results.  For example, when extracting the same archive
twice, it overwrites files without asking.


File: python.info,  Node: tarfile --- tar アーカイブファイルの読み書き,  Prev: zipfile --- ZIP アーカイブの処理,  Up: データ圧縮とアーカイブ

5.13.8 ‘tarfile’ -- tar アーカイブファイルの読み書き
----------------------------------------------------

'ソースコード:' Lib/tarfile.py(1)

__________________________________________________________________

The ‘tarfile’ module makes it possible to read and write tar archives,
including those using gzip, bz2 and lzma compression.  Use the *note
zipfile: 137. module to read or write ‘.zip’ files, or the higher-level
functions in *note shutil: 1431.

いくつかの事実と形態:

   * モジュールが利用可能な場合、*note gzip: 6b.、*note bz2: 14.、*note
     compression.zstd: 23. ならびに *note lzma: 8e. で圧縮されたアーカイ
     ブを読み書きします。

     If any of these *note optional modules: 215a. are missing from your
     copy of CPython, look for documentation from your distributor (that
     is, whoever provided Python to you).  If you are the distributor,
     see *note オプションのモジュールの要件: 2158.

   * POSIX.1-1988 (ustar) フォーマットの読み書きをサポートしています。

   * 'longname' および 'longlink' 拡張を含む GNU tar フォーマットの読み
     書きをサポートしています。スパースファイルの復元を含む 'sparse' 拡
     張は読み込みのみサポートしています。

   * POSIX.1-2001 (pax) フォーマットの読み書きをサポートしています。

   * ディレクトリ、一般ファイル、ハードリンク、シンボリックリンク、
     fifo、キャラクターデバイスおよびブロックデバイスを処理します。また
     、タイムスタンプ、アクセス許可や所有者のようなファイル情報の取得お
     よび保存が可能です。

バージョン 3.3 で変更: *note lzma: 8e. 圧縮をサポートしました。

バージョン 3.12 で変更: Archives are extracted using a *note filter:
697, which makes it possible to either limit surprising/dangerous
features, or to acknowledge that they are expected and the archive is
fully trusted.

バージョン 3.14 で変更: Set the default extraction filter to *note data:
29a, which disallows some dangerous features such as links to absolute
paths or paths outside of the destination.  Previously, the filter
strategy was equivalent to *note fully_trusted: 2ede.

バージョン 3.14 で変更: Added support for Zstandard compression using
*note compression.zstd: 23.

 -- の関数: tarfile.open (name=None, mode='r', fileobj=None,
          bufsize=10240, **kwargs)

     パス名 'name' の *note TarFile: 1429. オブジェクトを返します。*note
     TarFile: 1429. オブジェクトと、利用できるキーワード引数に関する詳細
     な情報については、*note TarFile オブジェクト: 2edf. 節を参照してく
     ださい。

     'mode' は ‘'filemode[:compression]'’ の形式をとる文字列でなければな
     りません。デフォルトの値は ‘'r'’ です。以下に 'mode' のとりうる組み
     合わせすべてを示します:

     mode                   action
                            
     -------------------------------------------------------------------------
                            
     ‘'r'’ または ‘'r:*'’   圧縮方法に関して透過的に、読み込み用にオープン
                            します (推奨)。
                            
                            
     ‘'r:'’                 非圧縮で読み込み用に排他的にオープンします。
                            
                            
     ‘'r:gz'’               gzip 圧縮で読み込み用にオープンします。
                            
                            
     ‘'r:bz2'’              bzip2 圧縮で読み込み用にオープンします。
                            
                            
     ‘'r:xz'’               lzma 圧縮で読み込み用にオープンします。
                            
                            
     ‘'r:zst'’              Zstandard 圧縮で読み込み用にオープンします。
                            
                            
     ‘'x'’ or ‘'x:'’        圧縮せずに tarfile を排他的に作成します。
                            tarfile が既存の場合
                            *note FileExistsError: 1221. 例外を送出します。
                            
                            
     ‘'x:gz'’               gzip 圧縮で tarfile を作成します。tarfile が既
                            存の場合 *note FileExistsError: 1221. 例外を送
                            出します。
                            
                            
     ‘'x:bz2'’              bzip2 圧縮で tarfile を作成します。tarfile が既
                            存の場合 *note FileExistsError: 1221. 例外を送
                            出します。
                            
                            
     ‘'x:xz'’               lzma 圧縮で tarfile を作成します。tarfile が既
                            存の場合 *note FileExistsError: 1221. 例外を送
                            出します。
                            
                            
     ‘'x:zst'’              Zstandard 圧縮で tarfile を作成します。tarfile
                            が既存の場合 *note FileExistsError: 1221. 例外
                            を送出します。
                            
                            
     ‘'a'’ または ‘'a:'’    非圧縮で追記用にオープンします。ファイルが存在
                            しない場合は新たに作成されます。
                            
                            
     ‘'w'’ または ‘'w:'’    非圧縮で書き込み用にオープンします。
                            
                            
     ‘'w:gz'’               gzip 圧縮で書き込み用にオープンします。
                            
                            
     ‘'w:bz2'’              bzip2 圧縮で書き込み用にオープンします。
                            
                            
     ‘'w:xz'’               lzma 圧縮で書き込み用にオープンします。
                            
                            
     ‘'w:zst'’              Zstandard 圧縮で書き込み用にオープンします。
                            

     ‘'a:gz'’、‘'a:bz2'’、‘'a:xz'’ は利用できないことに注意して下さい。
     もし 'mode' が、ある (圧縮した) ファイルを読み込み用にオープンする
     のに適していないなら、*note ReadError: 1c4f. が送出されます。これを
     防ぐには 'mode' ‘'r'’ を使って下さい。もし圧縮方式がサポートされて
     いなければ、*note CompressionError: 2ee0. が送出されます。

     もし 'fileobj' が指定されていれば、それは 'name' でバイナリモードで
     オープンされた *note ファイルオブジェクト: 13db. の代替として使うこ
     とができます。そのファイルオブジェクトの位置が 0 であることを前提に
     動作します。

     ‘'w:gz'’、‘'x:gz'’、‘'w|gz'’、‘'w:bz2'’、‘'x:bz2'’、‘'w|bz2'’ モー
     ドの場合、*note tarfile.open(): 1077. はファイルの圧縮レベルを指定
     するキーワード引数 'compresslevel' (デフォルトは ‘9’) を受け付けま
     す。

     ‘'w:xz'’、‘'x:xz'’ および ‘'w|xz'’ モードの場合、*note
     tarfile.open(): 1077. はファイルの圧縮レベルを指定するキーワード引
     数 'preset' を受け付けます。

     For modes ‘'w:zst'’, ‘'x:zst'’ and ‘'w|zst'’, *note tarfile.open():
     1077. accepts the keyword argument 'level' to specify the
     compression level of the file.  The keyword argument 'options' may
     also be passed, providing advanced Zstandard compression parameters
     described by *note CompressionParameter: 2de5.  The keyword
     argument 'zstd_dict' can be passed to provide a *note ZstdDict:
     2de4, a Zstandard dictionary used to improve compression of smaller
     amounts of data.

     For special purposes, there is a second format for 'mode':
     ‘'filemode|[compression]'’.  *note tarfile.open(): 1077. will
     return a *note TarFile: 1429. object that processes its data as a
     stream of blocks.  No random seeking will be done on the file.  If
     given, 'fileobj' may be any object that has a *note read(): 101d.
     or *note write(): 15c5. method (depending on the 'mode') that works
     with bytes.  'bufsize' specifies the blocksize and defaults to ‘20
     * 512’ bytes.  Use this variant in combination with e.g.
     ‘sys.stdin.buffer’, a socket *note file object: 13db. or a tape
     device.  However, such a *note TarFile: 1429. object is limited in
     that it does not allow random access, see *note 使用例: 2ee1.  The
     currently possible modes:

     モード            動作
                       
     -------------------------------------------------------------------
                       
     ‘'r|*'’           tar ブロックの 'stream' を圧縮方法に関して透過
                       的に読み込み用にオープンします。
                       
                       
     ‘'r|'’            非圧縮 tar ブロックの 'stream' を読み込み用に
                       オープンします。
                       
                       
     ‘'r|gz'’          gzip 圧縮の 'stream' を読み込み用にオープンし
                       ます。
                       
                       
     ‘'r|bz2'’         bzip2 圧縮の 'stream' を読み込み用にオープンし
                       ます。
                       
                       
     ‘'r|xz'’          lzma 圧縮の 'stream' を読み込み用にオープンし
                       ます。
                       
                       
     ‘'r|zst'’         Zstandard 圧縮の 'stream' を読み込み用にオープ
                       ンします。
                       
                       
     ‘'w|'’            非圧縮の 'stream' を書き込み用にオープンします
                       。
                       
                       
     ‘'w|gz'’          gzip 圧縮の 'stream' を書き込み用にオープンし
                       ます。
                       
                       
     ‘'w|bz2'’         bzip2 圧縮の 'stream' を書き込み用にオープンし
                       ます。
                       
                       
     ‘'w|xz'’          lzma 圧縮の 'stream' を書き込み用にオープンし
                       ます。
                       
                       
     ‘'w|zst'’         Zstandard 圧縮の 'stream' を書き込み用にオープ
                       ンします。
                       

     バージョン 3.5 で変更: ‘'x'’ (排他的作成) モードが追加されました。

     バージョン 3.6 で変更: 'name' パラメタが *note path-like object:
     5a1. を受け付けるようになりました。

     バージョン 3.12 で変更: The 'compresslevel' keyword argument also
     works for streams.

     バージョン 3.14 で変更: The 'preset' keyword argument also works
     for streams.

 -- クラス: tarfile.TarFile

     tar アーカイブを読み書きするためのクラスです。このクラスを直接使わ
     ないこと: 代わりに *note tarfile.open(): 1077. を使ってください。
     *note TarFile オブジェクト: 2edf. を参照してください。

 -- の関数: tarfile.is_tarfile (name)

     Return *note True: e07. if 'name' is a tar archive file, that the
     ‘tarfile’ module can read.  'name' may be a *note str: 169, file,
     or file-like object.

     バージョン 3.9 で変更: ファイルおよびファイルライクオブジェクトをサ
     ポートしました。

The ‘tarfile’ module defines the following exceptions:

 -- 例外: tarfile.TarError

     Base class for all ‘tarfile’ exceptions.

 -- 例外: tarfile.ReadError

     Is raised when a tar archive is opened, that either cannot be
     handled by the ‘tarfile’ module or is somehow invalid.

 -- 例外: tarfile.CompressionError

     圧縮方法がサポートされていないか、あるいはデータを正しくデコードで
     きない時に送出されます。

 -- 例外: tarfile.StreamError

     ストリームのような *note TarFile: 1429. オブジェクトで典型的な制限
     のために送出されます。

 -- 例外: tarfile.ExtractError

     *note TarFile.extract(): 29c. を使った時に '致命的でない' エラーに
     対して送出されます。ただし *note TarFile.errorlevel: 29e.‘== 2’ の
     場合に限ります。

 -- 例外: tarfile.HeaderError

     *note TarInfo.frombuf(): 2ee6. メソッドが取得したバッファーが不正だ
     ったときに送出されます。

 -- 例外: tarfile.FilterError

     Base class for members *note refused: 2ee8. by filters.

      -- の属性: tarinfo

          Information about the member that the filter refused to
          extract, as *note TarInfo: 2eea.

 -- 例外: tarfile.AbsolutePathError

     Raised to refuse extracting a member with an absolute path.

 -- 例外: tarfile.OutsideDestinationError

     Raised to refuse extracting a member outside the destination
     directory.

 -- 例外: tarfile.SpecialFileError

     Raised to refuse extracting a special file (e.g.  a device or
     pipe).

 -- 例外: tarfile.AbsoluteLinkError

     Raised to refuse extracting a symbolic link with an absolute path.

 -- 例外: tarfile.LinkOutsideDestinationError

     Raised to refuse extracting a symbolic link pointing outside the
     destination directory.

 -- 例外: tarfile.LinkFallbackError

     Raised to refuse emulating a link (hard or symbolic) by extracting
     another archive member, when that member would be rejected by the
     filter location.  The exception that was raised to reject the
     replacement member is available as ‘BaseException.__context__’.

     Added in version 3.14.

モジュールレベルで以下の定数が利用できます。

 -- データ: tarfile.ENCODING

     既定の文字エンコーディング。Windows では ‘'utf-8'’ 、それ以外では
     *note sys.getfilesystemencoding(): e53. の返り値です。

 -- データ: tarfile.REGTYPE
 -- データ: tarfile.AREGTYPE

     A regular file *note type: 2ef3.

 -- データ: tarfile.LNKTYPE

     A link (inside tarfile) *note type: 2ef3.

 -- データ: tarfile.SYMTYPE

     A symbolic link *note type: 2ef3.

 -- データ: tarfile.CHRTYPE

     A character special device *note type: 2ef3.

 -- データ: tarfile.BLKTYPE

     A block special device *note type: 2ef3.

 -- データ: tarfile.DIRTYPE

     A directory *note type: 2ef3.

 -- データ: tarfile.FIFOTYPE

     A FIFO special device *note type: 2ef3.

 -- データ: tarfile.CONTTYPE

     A contiguous file *note type: 2ef3.

 -- データ: tarfile.GNUTYPE_LONGNAME

     A GNU tar longname *note type: 2ef3.

 -- データ: tarfile.GNUTYPE_LONGLINK

     A GNU tar longlink *note type: 2ef3.

 -- データ: tarfile.GNUTYPE_SPARSE

     A GNU tar sparse file *note type: 2ef3.

Each of the following constants defines a tar archive format that the
‘tarfile’ module is able to create.  See section *note サポートしている
tar フォーマット: 2efe. for details.

 -- データ: tarfile.USTAR_FORMAT

     POSIX.1-1988 (ustar) フォーマット。

 -- データ: tarfile.GNU_FORMAT

     GNU tar フォーマット。

 -- データ: tarfile.PAX_FORMAT

     POSIX.1-2001 (pax) フォーマット。

 -- データ: tarfile.DEFAULT_FORMAT

     アーカイブを作成する際のデフォルトのフォーマット。現在は *note
     PAX_FORMAT: 2f01. です。

     バージョン 3.8 で変更: 新しいアーカイブのデフォルトフォーマットが
     *note GNU_FORMAT: 2f00. から *note PAX_FORMAT: 2f01. に変更されまし
     た。

参考
....

*note zipfile: 137. モジュール

     *note zipfile: 137. 標準モジュールのドキュメント。

*note アーカイブ化操作: 1431.

     *note shutil: ca. が提供するより高水準のアーカイブ機能についてのド
     キュメント。

GNU tar manual, Basic Tar Format(2)

     GNU tar 拡張機能を含む、tar アーカイブファイルのためのドキュメント
     。

* Menu:

* TarFile オブジェクト::
* TarInfo オブジェクト::
* Extraction filters::
* コマンドラインインターフェイス::
* 使用例: 使用例<16>.
* サポートしている tar フォーマット::
* Unicode に関する問題::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/tarfile.py

   (2) https://www.gnu.org/software/tar/manual/html_node/Standard.html


File: python.info,  Node: TarFile オブジェクト,  Next: TarInfo オブジェクト,  Up: tarfile --- tar アーカイブファイルの読み書き

5.13.8.1 TarFile オブジェクト
.............................

*note TarFile: 1429. オブジェクトは、tar アーカイブへのインターフェース
を提供します。tar アーカイブは一連のブロックです。アーカイブメンバー (保
存されたファイル) は、ヘッダーブロックとそれに続くデータブロックで構成さ
れています。一つの tar アーカイブにファイルを何回も保存することができま
す。各アーカイブメンバーは、*note TarInfo: 142a. オブジェクトで確認でき
ます。詳細については *note TarInfo オブジェクト: 2eea. を参照してくださ
い。

*note TarFile: 1429. オブジェクトは *note with: 186. 文のコンテキストマ
ネージャーとして利用できます。with ブロックが終了したときにオブジェクト
はクローズされます。例外が発生した時、内部で利用されているファイルオブジ
ェクトのみがクローズされ、書き込み用にオープンされたアーカイブのファイナ
ライズは行われないことに注意してください。*note 使用例: 2ee1. 節のユース
ケースを参照してください。

Added in version 3.2: コンテキスト管理のプロトコルがサポートされました。

 -- クラス: tarfile.TarFile (name=None, mode='r', fileobj=None,
          format=DEFAULT_FORMAT, tarinfo=TarInfo, dereference=False,
          ignore_zeros=False, encoding=ENCODING,
          errors='surrogateescape', pax_headers=None, debug=0,
          errorlevel=1, stream=False)

     以下のすべての引数はオプションで、インスタンス属性としてもアクセス
     できます。

     'name' is the pathname of the archive.  'name' may be a *note
     path-like object: 5a1.  It can be omitted if 'fileobj' is given.
     In this case, the file object's ‘name’ attribute is used if it
     exists.

     'mode' は、既存のアーカイブから読み込むための ‘'r'’、既存のアーカイ
     ブに追記するための ‘'a'’、既存のファイルがあれば上書きして新しいフ
     ァイルを作成する ‘'w'’ 、あるいは存在しない場合にのみ新しいファイル
     を作成する ‘'x'’ のいずれかです。

     'fileobj' が与えられていれば、それを使ってデータを読み書きします。
     もしそれが決定できれば、'mode' は 'fileobj' のモードで上書きされま
     す。'fileobj' は位置 0 から利用されます。

          注釈: *note TarFile: 1429. をクローズした時、'fileobj' はクロ
          ーズされません。

     'format' はアーカイブの書き込みフォーマットを制御します。モジュール
     レベルで定義されている、*note USTAR_FORMAT: 2eff.、*note
     GNU_FORMAT: 2f00.、あるいは *note PAX_FORMAT: 2f01. のいずれかであ
     る必要があります。 読み出しのときは、1 つのアーカイブに異なるフォー
     マットが混在していたとしても、フォーマットは自動的に検知されます。

     'tarinfo' 引数を利用して、デフォルトの *note TarInfo: 142a. クラス
     を別のクラスで置き換えることができます。

     'dereference' が *note False: d2b. だった場合、シンボリックリンクや
     ハードリンクがアーカイブに追加されます。*note True: e07. だった場合
     、リンクのターゲットとなるファイルの内容がアーカイブに追加されます
     。シンボリックリンクをサポートしていないシステムでは効果がありませ
     ん。

     'ignore_zeros' が *note False: d2b. だった場合、空ブロックをアーカ
     イブの終端として扱います。*note True: e07. だった場合、空の (無効な
     ) ブロックをスキップして、可能な限り多くのメンバーを取得しようとし
     ます。このオプションは、連結されたり、壊れたアーカイブファイルを扱
     うときにのみ、意味があります。

     'debug' は ‘0’ (デバッグメッセージ無し) から ‘3’ (全デバッグメッセ
     ージ) まで設定できます。このメッセージは ‘sys.stderr’ に書き込まれ
     ます。

     'errorlevel' controls how extraction errors are handled, see *note
     the corresponding attribute: 29e.

     引数 'encoding' および 'errors' にはアーカイブの読み書きやエラー文
     字列の変換に使用する文字エンコーディングを指定します。ほとんどのユ
     ーザーはデフォルト設定のままで動作します。詳細に関しては *note
     Unicode に関する問題: 2f04. 節を参照してください。

     引数 'pax_headers' は、オプションの文字列辞書で、'format' が *note
     PAX_FORMAT: 2f01. だった場合に pax グローバルヘッダーに追加されます
     。

     If 'stream' is set to *note True: e07. then while reading the
     archive info about files in the archive are not cached, saving
     memory.

     バージョン 3.2 で変更: 引数 'errors' のデフォルトが
     ‘'surrogateescape'’ になりました。

     バージョン 3.5 で変更: ‘'x'’ (排他的作成) モードが追加されました。

     バージョン 3.6 で変更: 'name' パラメタが *note path-like object:
     5a1. を受け付けるようになりました。

     バージョン 3.13 で変更: Add the 'stream' parameter.

 -- メソッド: classmethod TarFile.open (...)

     代替コンストラクターです。モジュールレベルでの *note
     tarfile.open(): 1077. 関数は、実際はこのクラスメソッドへのショート
     カットです。

 -- メソッド: TarFile.getmember (name)

     メンバー 'name' に対する *note TarInfo: 142a. オブジェクトを返しま
     す。'name' がアーカイブに見つからなければ、*note KeyError: 5e7. が
     送出されます。

          注釈: アーカイブ内にメンバーが複数ある場合は、最後に出現するも
          のが最新のバージョンとみなされます。

 -- メソッド: TarFile.getmembers ()

     *note TarInfo: 142a. アーカイブのメンバーをオブジェクトのリストとし
     て返します。このリストはアーカイブ内のメンバーと同じ順番です。

 -- メソッド: TarFile.getnames ()

     メンバーをその名前のリストを返します。これは *note getmembers():
     1079. で返されるリストと同じ順番です。

 -- メソッド: TarFile.list (verbose=True, *, members=None)

     内容の一覧を ‘sys.stdout’ に出力します。'verbose' が *note False:
     d2b. の場合、メンバー名のみ表示します。*note True: e07. の場合、
     ‘ls -l’ に似た出力を生成します。オプションの 'members' を与える場合
     、 *note getmembers(): 1079. が返すリストのサブセットである必要があ
     ります。

     バージョン 3.5 で変更: 'members' 引数が追加されました。.

 -- メソッド: TarFile.next ()

     *note TarFile: 1429. が読み込み用にオープンされている時、アーカイブ
     の次のメンバーを *note TarInfo: 142a. オブジェクトとして返します。
     もしそれ以上利用可能なものがなければ、*note None: 885. を返します。

 -- メソッド: TarFile.extractall (path='.', members=None, *,
          numeric_owner=False, filter=None)

     すべてのメンバーをアーカイブから現在の作業ディレクトリまたは 'path'
     に抽出します。オプションの 'members' が与えられるときには、*note
     getmembers(): 1079. で返されるリストの一部でなければなりません。所
     有者、変更時刻、アクセス権限のようなディレクトリ情報はすべてのメン
     バーが抽出された後にセットされます。これは二つの問題を回避するため
     です。一つはディレクトリの変更時刻はその中にファイルが作成されるた
     びにリセットされるということ、もう一つはディレクトリに書き込み許可
     がなければその中のファイル抽出は失敗してしまうということです。

     'numeric_owner' が *note True: e07. の場合、tarfile の uid と gid 数
     値が抽出されたファイルのオーナー/グループを設定するために使用されま
     す。False の場合、tarfile の名前付きの値が使用されます。

     The 'filter' argument specifies how ‘members’ are modified or
     rejected before extraction.  See *note Extraction filters: 697. for
     details.  It is recommended to set this explicitly only if specific
     'tar' features are required, or as ‘filter='data'’ to support
     Python versions with a less secure default (3.13 and lower).

          警告: Never extract archives from untrusted sources without
          prior inspection.

          Since Python 3.14, the default (*note data: 29a.) will prevent
          the most dangerous security issues.  However, it will not
          prevent 'all' unintended or insecure behavior.  Read the *note
          Extraction filters: 697. section for details.

     バージョン 3.5 で変更: 'numeric_owner' 引数が追加されました。

     バージョン 3.6 で変更: 'path' パラメタが *note path-like object:
     5a1. を受け付けるようになりました。

     バージョン 3.12 で変更: 'filter' パラメータが追加されました。

     バージョン 3.14 で変更: The 'filter' parameter now defaults to
     ‘'data'’.

 -- メソッド: TarFile.extract (member, path='', set_attrs=True, *,
          numeric_owner=False, filter=None)

     アーカイブからメンバーの完全な名前を使って、現在のディレクトリに展
     開します。ファイル情報はできる限り正確に展開されます。 'member' は
     ファイル名もしくは *note TarInfo: 142a. オブジェクトです。 'path' を
     使って別のディレクトリを指定することもできます。 'path' は　*note
     path-like object: 5a1. でも構いません。'set_attrs' が false でない
     限り、ファイルの属性 (所有者、最終更新時刻、モード) は設定されます
     。

     The 'numeric_owner' and 'filter' arguments are the same as for
     *note extractall(): 29b.

          注釈: *note extract(): 29c. メソッドはいくつかの展開に関する問
          題を扱いません。ほとんどの場合、*note extractall(): 29b. メソ
          ッドの利用を考慮するべきです。

          警告: Never extract archives from untrusted sources without
          prior inspection.  See the warning for *note extractall():
          29b. for details.

     バージョン 3.2 で変更: パラメーターに 'set_attrs' を追加しました。

     バージョン 3.5 で変更: 'numeric_owner' 引数が追加されました。

     バージョン 3.6 で変更: 'path' パラメタが *note path-like object:
     5a1. を受け付けるようになりました。

     バージョン 3.12 で変更: 'filter' パラメータが追加されました。

 -- メソッド: TarFile.extractfile (member)

     アーカイブからメンバーをファイルオブジェクトとして抽出します。
     'member' はファイル名でも *note TarInfo: 142a. オブジェクトでも構い
     ません。'member' が一般ファイルまたはリンクの場合、*note
     io.BufferedReader: 1427. オブジェクトが返されます。 存在するそれ以
     外のメンバーでは、 *note None: 885. が返されます。 それ以外の場合、
     *note None: 885. が返されます。 アーカイブに 'member' が存在しない
     場合は *note KeyError: 5e7. が送出されます。

     バージョン 3.3 で変更: 戻り値が *note io.BufferedReader: 1427. オブ
     ジェクトになりました。

     バージョン 3.13 で変更: The returned *note io.BufferedReader: 1427.
     object has the ‘mode’ attribute which is always equal to ‘'rb'’.

 -- の属性: TarFile.errorlevel: *note int: 19b.

     If 'errorlevel' is ‘0’, errors are ignored when using *note
     TarFile.extract(): 29c. and *note TarFile.extractall(): 29b.
     Nevertheless, they appear as error messages in the debug output
     when 'debug' is greater than 0.  If ‘1’ (the default), all 'fatal'
     errors are raised as *note OSError: 2c0. or *note FilterError:
     2ee7. exceptions.  If ‘2’, all 'non-fatal' errors are raised as
     *note TarError: 2ee2. exceptions as well.

     Some exceptions, e.g.  ones caused by wrong argument types or data
     corruption, are always raised.

     Custom *note extraction filters: 697. should raise *note
     FilterError: 2ee7. for 'fatal' errors and *note ExtractError: 2ee4.
     for 'non-fatal' ones.

     Note that when an exception is raised, the archive may be partially
     extracted.  It is the user’s responsibility to clean up.

 -- の属性: TarFile.extraction_filter

     Added in version 3.12.

     The *note extraction filter: 697. used as a default for the
     'filter' argument of *note extract(): 29c. and *note extractall():
     29b.

     The attribute may be ‘None’ or a callable.  String names are not
     allowed for this attribute, unlike the 'filter' argument to *note
     extract(): 29c.

     If ‘extraction_filter’ is ‘None’ (the default), extraction methods
     will use the *note data: 29a. filter by default.

     The attribute may be set on instances or overridden in subclasses.
     It also is possible to set it on the ‘TarFile’ class itself to set
     a global default, although, since it affects all uses of 'tarfile',
     it is best practice to only do so in top-level applications or
     *note site configuration: cc.  To set a global default this way, a
     filter function needs to be wrapped in *note staticmethod(): 453.
     to prevent injection of a ‘self’ argument.

     バージョン 3.14 で変更: The default filter is set to *note data:
     29a, which disallows some dangerous features such as links to
     absolute paths or paths outside of the destination.  Previously,
     the default was equivalent to *note fully_trusted: 2ede.

 -- メソッド: TarFile.add (name, arcname=None, recursive=True, *,
          filter=None)

     ファイル 'name' をアーカイブに追加します。 'name' は、任意のファイ
     ルタイプ (ディレクトリ、fifo、シンボリックリンク等)です。 'arcname'
     が与えられている場合は、それはアーカイブ内のファイルの代替名を指定
     します。 デフォルトではディレクトリは再帰的に追加されます。 これは
     、 'recursive' を *note False: d2b. に設定すると避けられます。 再帰
     処理はソートされた順序でエントリーを追加します。 'filter' が与えら
     れた場合、それは *note TarInfo: 142a. オブジェクトを引数として受け
     取り、操作した *note TarInfo: 142a. オブジェクトを返す関数でなけれ
     ばなりません。 代わりに *note None: 885. を返した場合、 *note
     TarInfo: 142a. オブジェクトはアーカイブから除外されます。 *note
     使用例: 2ee1. にある例を参照してください。

     バージョン 3.2 で変更: 'filter' パラメータが追加されました。

     バージョン 3.7 で変更: 再帰処理はソートされた順序でエントリーを追加
     するようになりました。

 -- メソッド: TarFile.addfile (tarinfo, fileobj=None)

     Add the *note TarInfo: 142a. object 'tarinfo' to the archive.  If
     'tarinfo' represents a non zero-size regular file, the 'fileobj'
     argument should be a *note binary file: 206e, and ‘tarinfo.size’
     bytes are read from it and added to the archive.  You can create
     *note TarInfo: 142a. objects directly, or by using *note
     gettarinfo(): 2f09.

     バージョン 3.13 で変更: 'fileobj' must be given for non-zero-sized
     regular files.

 -- メソッド: TarFile.gettarinfo (name=None, arcname=None, fileobj=None)

     *note os.stat(): 26d. の結果か、既存のファイルに相当するものから、
     *note TarInfo: 142a. オブジェクトを作成します。このファイルは、
     'name' で名付けられるか、ファイル記述子を持つ *note file object:
     13db. 'fileobj' として指定されます。'name' は *note path-like
     object: 5a1. でも構いません。 'arcname' が与えられた場合、アーカイ
     ブ内のファイルに対して代替名を指定します。与えられない場合、名前は
     'fileobj' の *note name: 2def. 属性 'name' 属性から取られます。名前
     はテキスト文字列にしてください。

     *note TarInfo: 142a. の属性の一部は、*note addfile(): 19a7. を使用
     して追加する前に修正できます。ファイルオブジェクトが、ファイルの先
     頭にある通常のファイルオブジェクトでない場合、 *note size: 2f0a. な
     どの属性は修正が必要かもしれません。これは、 *note GzipFile: 65c. な
     どの属性に当てはまります。*note name: 2f0b. も修正できるかもしれず
     、この場合、'arcname' はダミーの文字列にすることができます。

     バージョン 3.6 で変更: 'name' パラメタが *note path-like object:
     5a1. を受け付けるようになりました。

 -- メソッド: TarFile.close ()

     *note TarFile: 1429. をクローズします。書き込みモードでは、完了ゼロ
     ブロックが 2 個アーカイブに追加されます。

 -- の属性: TarFile.pax_headers: *note dict: 183.

     pax グローバルヘッダーに含まれる key-value ペアの辞書です。


File: python.info,  Node: TarInfo オブジェクト,  Next: Extraction filters,  Prev: TarFile オブジェクト,  Up: tarfile --- tar アーカイブファイルの読み書き

5.13.8.2 TarInfo オブジェクト
.............................

*note TarInfo: 142a. オブジェクトは *note TarFile: 1429. の一つのメンバ
ーを表します。ファイルに必要なすべての属性 (ファイルタイプ、ファイルサイ
ズ、時刻、アクセス権限、所有者等のような) を保存する他に、そのタイプを決
定するのに役に立ついくつかのメソッドを提供します。これにはファイルのデー
タそのものは '含まれません' 。

*note TarInfo: 142a. objects are returned by *note TarFile: 1429.'s
methods *note getmember(): 1bf0, *note getmembers(): 1079. and *note
gettarinfo(): 2f09.

Modifying the objects returned by *note getmember(): 1bf0. or *note
getmembers(): 1079. will affect all subsequent operations on the
archive.  For cases where this is unwanted, you can use *note
copy.copy(): 29. or call the *note replace(): 2f0f. method to create a
modified copy in one step.

Several attributes can be set to ‘None’ to indicate that a piece of
metadata is unused or unknown.  Different *note TarInfo: 142a. methods
handle ‘None’ differently:

   - The *note extract(): 29c. or *note extractall(): 29b. methods will
     ignore the corresponding metadata, leaving it set to a default.

   - *note addfile(): 19a7. will fail.

   - *note list(): 1078. will print a placeholder string.

 -- クラス: tarfile.TarInfo (name='')

     *note TarInfo: 142a. オブジェクトを作成します。

 -- メソッド: classmethod TarInfo.frombuf (buf, encoding, errors)

     *note TarInfo: 142a. オブジェクトを文字列バッファー 'buf' から作成
     して返します。

     バッファーが不正な場合 *note HeaderError: 2ee5. を送出します。

 -- メソッド: classmethod TarInfo.fromtarfile (tarfile)

     *note TarFile: 1429. オブジェクトの 'tarfile' から、次のメンバーを
     読み込んで、それを *note TarInfo: 142a. オブジェクトとして返します
     。

 -- メソッド: TarInfo.tobuf (format=DEFAULT_FORMAT, encoding=ENCODING,
          errors='surrogateescape')

     *note TarInfo: 142a. オブジェクトから文字列バッファーを作成します。
     引数についての情報は、*note TarFile: 1429. クラスのコンストラクター
     を参照してください。

     バージョン 3.2 で変更: 引数 'errors' のデフォルトが
     ‘'surrogateescape'’ になりました。

‘TarInfo’ オブジェクトには以下のデータ属性があります:

 -- の属性: TarInfo.name: *note str: 169.

     アーカイブメンバーの名前。

 -- の属性: TarInfo.size: *note int: 19b.

     バイト単位でのサイズ。

 -- の属性: TarInfo.mtime: *note int: 19b. | *note float: 196.

     Time of last modification in seconds since the *note epoch: 2f13,
     as in *note os.stat_result.st_mtime: 2f14.

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     29c. and *note extractall(): 29b, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.mode: *note int: 19b.

     Permission bits, as for *note os.chmod(): 529.

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     29c. and *note extractall(): 29b, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.type

     ファイルタイプ。'type' は通常、定数 *note REGTYPE: 2ef1.、*note
     AREGTYPE: 2ef2.、*note LNKTYPE: 2ef4.、*note SYMTYPE: 2ef5.、*note
     DIRTYPE: 2ef8.、*note FIFOTYPE: 2ef9.、*note CONTTYPE: 2efa.、*note
     CHRTYPE: 2ef6.、*note BLKTYPE: 2ef7.、あるいは *note
     GNUTYPE_SPARSE: 2efd. のいずれかです。*note TarInfo: 142a. オブジェ
     クトのタイプをもっと簡単に解決するには、下記の ‘is*()’ メソッドを使
     って下さい。

 -- の属性: TarInfo.linkname: *note str: 169.

     リンク先ファイルの名前。これはタイプ *note LNKTYPE: 2ef4. と *note
     SYMTYPE: 2ef5. の *note TarInfo: 142a. オブジェクトにだけ存在します
     。

     For symbolic links (‘SYMTYPE’), the 'linkname' is relative to the
     directory that contains the link.  For hard links (‘LNKTYPE’), the
     'linkname' is relative to the root of the archive.

 -- の属性: TarInfo.uid: *note int: 19b.

     ファイルメンバーを保存した元のユーザーのユーザー ID。

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     29c. and *note extractall(): 29b, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.gid: *note int: 19b.

     ファイルメンバーを保存した元のユーザーのグループ ID。

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     29c. and *note extractall(): 29b, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.uname: *note str: 169.

     ファイルメンバーを保存した元のユーザーのユーザー名。

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     29c. and *note extractall(): 29b, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.gname: *note str: 169.

     ファイルメンバーを保存した元のユーザーのグループ名。

     バージョン 3.12 で変更: Can be set to ‘None’ for *note extract():
     29c. and *note extractall(): 29b, causing extraction to skip
     applying this attribute.

 -- の属性: TarInfo.chksum: *note int: 19b.

     Header checksum.

 -- の属性: TarInfo.devmajor: *note int: 19b.

     Device major number.

 -- の属性: TarInfo.devminor: *note int: 19b.

     Device minor number.

 -- の属性: TarInfo.offset: *note int: 19b.

     The tar header starts here.

 -- の属性: TarInfo.offset_data: *note int: 19b.

     The file's data starts here.

 -- の属性: TarInfo.sparse

     Sparse member information.

 -- の属性: TarInfo.pax_headers: *note dict: 183.

     pax 拡張ヘッダーに関連付けられた、key-value ペアの辞書。

 -- メソッド: TarInfo.replace (name=..., mtime=..., mode=...,
          linkname=..., uid=..., gid=..., uname=..., gname=...,
          deep=True)

     Added in version 3.12.

     Return a 'new' copy of the ‘TarInfo’ object with the given
     attributes changed.  For example, to return a ‘TarInfo’ with the
     group name set to ‘'staff'’, use:

          new_tarinfo = old_tarinfo.replace(gname='staff')

     By default, a deep copy is made.  If 'deep' is false, the copy is
     shallow, i.e.  ‘pax_headers’ and any custom attributes are shared
     with the original ‘TarInfo’ object.

*note TarInfo: 142a. オブジェクトは便利な照会用のメソッドもいくつか提供
しています:

 -- メソッド: TarInfo.isfile ()

     Return *note True: e07. if the *note TarInfo: 142a. object is a
     regular file.

 -- メソッド: TarInfo.isreg ()

     *note isfile(): 2f22. と同じです。

 -- メソッド: TarInfo.isdir ()

     ディレクトリの場合に *note True: e07. を返します。

 -- メソッド: TarInfo.issym ()

     シンボリックリンクの場合に *note True: e07. を返します。

 -- メソッド: TarInfo.islnk ()

     ハードリンクの場合に *note True: e07. を返します。

 -- メソッド: TarInfo.ischr ()

     キャラクターデバイスの場合に *note True: e07. を返します。

 -- メソッド: TarInfo.isblk ()

     ブロックデバイスの場合に *note True: e07. を返します。

 -- メソッド: TarInfo.isfifo ()

     FIFO の場合に *note True: e07. を返します。

 -- メソッド: TarInfo.isdev ()

     キャラクターデバイス、ブロックデバイスあるいは FIFO のいずれかの場
     合に *note True: e07. を返します。


File: python.info,  Node: Extraction filters,  Next: コマンドラインインターフェイス,  Prev: TarInfo オブジェクト,  Up: tarfile --- tar アーカイブファイルの読み書き

5.13.8.3 Extraction filters
...........................

Added in version 3.12.

The 'tar' format is designed to capture all details of a UNIX-like
filesystem, which makes it very powerful.  Unfortunately, the features
make it easy to create tar files that have unintended - and possibly
malicious - effects when extracted.  For example, extracting a tar file
can overwrite arbitrary files in various ways (e.g.  by using absolute
paths, ‘..’ path components, or symlinks that affect later members).

In most cases, the full functionality is not needed.  Therefore,
'tarfile' supports extraction filters: a mechanism to limit
functionality, and thus mitigate some of the security issues.

     警告: None of the available filters blocks 'all' dangerous archive
     features.  Never extract archives from untrusted sources without
     prior inspection.  See also *note Hints for further verification:
     2cf4.

参考
....

PEP 706(1)

     Contains further motivation and rationale behind the design.

The 'filter' argument to *note TarFile.extract(): 29c. or *note
extractall(): 29b. can be:

   * the string ‘'fully_trusted'’: Honor all metadata as specified in
     the archive.  Should be used if the user trusts the archive
     completely, or implements their own complex verification.

   * the string ‘'tar'’: Honor most 'tar'-specific features (i.e.
     features of UNIX-like filesystems), but block features that are
     very likely to be surprising or malicious.  See *note tar_filter():
     2f2c. for details.

   * the string ‘'data'’: Ignore or block most features specific to
     UNIX-like filesystems.  Intended for extracting cross-platform data
     archives.  See *note data_filter(): 29a. for details.

   * ‘None’ (default): Use *note TarFile.extraction_filter: 2f08.

     If that is also ‘None’ (the default), the ‘'data'’ filter will be
     used.

          バージョン 3.14 で変更: The default filter is set to *note
          data: 29a.  Previously, the default was equivalent to *note
          fully_trusted: 2ede.

   * A callable which will be called for each extracted member with a
     *note TarInfo: 2eea. describing the member and the destination path
     to where the archive is extracted (i.e.  the same path is used for
     all members):

          filter(member: TarInfo, path: str, /) -> TarInfo | None

     The callable is called just before each member is extracted, so it
     can take the current state of the disk into account.  It can:

        - return a *note TarInfo: 142a. object which will be used
          instead of the metadata in the archive, or

        - return ‘None’, in which case the member will be skipped, or

        - raise an exception to abort the operation or skip the member,
          depending on *note errorlevel: 29e.  Note that when extraction
          is aborted, *note extractall(): 29b. may leave the archive
          partially extracted.  It does not attempt to clean up.

* Menu:

* Default named filters::
* Filter errors::
* Hints for further verification::
* Supporting older Python versions::
* Stateful extraction filter example::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0706/


File: python.info,  Node: Default named filters,  Next: Filter errors,  Up: Extraction filters

5.13.8.4 Default named filters
..............................

The pre-defined, named filters are available as functions, so they can
be reused in custom filters:

 -- の関数: tarfile.fully_trusted_filter (member, path)

     Return 'member' unchanged.

     This implements the ‘'fully_trusted'’ filter.

 -- の関数: tarfile.tar_filter (member, path)

     Implements the ‘'tar'’ filter.

        - Strip leading slashes (‘/’ and *note os.sep: 87a.) from
          filenames.

        - *note Refuse: 2ee8. to extract files with absolute paths (in
          case the name is absolute even after stripping slashes, e.g.
          ‘C:/foo’ on Windows).  This raises *note AbsolutePathError:
          2eeb.

        - *note Refuse: 2ee8. to extract files whose absolute path
          (after following symlinks) would end up outside the
          destination.  This raises *note OutsideDestinationError: 2eec.

        - Clear high mode bits (setuid, setgid, sticky) and group/other
          write bits (*note S_IWGRP: 2c80. | *note S_IWOTH: 2c83.).

     Return the modified ‘TarInfo’ member.

 -- の関数: tarfile.data_filter (member, path)

     Implements the ‘'data'’ filter.  In addition to what ‘tar_filter’
     does:

        - Normalize link targets (*note TarInfo.linkname: 2f16.) using
          *note os.path.normpath(): 1531.  Note that this removes
          internal ‘..’ components, which may change the meaning of the
          link if the path in ‘TarInfo.linkname’ traverses symbolic
          links.

        - *note Refuse: 2ee8. to extract links (hard or soft) that link
          to absolute paths, or ones that link outside the destination.

          This raises *note AbsoluteLinkError: 2eee. or *note
          LinkOutsideDestinationError: 2eef.

          Note that such files are refused even on platforms that do not
          support symbolic links.

        - *note Refuse: 2ee8. to extract device files (including pipes).
          This raises *note SpecialFileError: 2eed.

        - For regular files, including hard links:

             - Set the owner read and write permissions (*note S_IRUSR:
               2c7b. | *note S_IWUSR: 2c7c.).

             - Remove the group & other executable permission (*note
               S_IXGRP: 2c77. | *note S_IXOTH: 2c84.) if the owner
               doesn’t have it (*note S_IXUSR: 2c7d.).

        - For other files (directories), set ‘mode’ to ‘None’, so that
          extraction methods skip applying permission bits.

        - Set user and group info (‘uid’, ‘gid’, ‘uname’, ‘gname’) to
          ‘None’, so that extraction methods skip setting it.

     Return the modified ‘TarInfo’ member.

     Note that this filter does not block 'all' dangerous archive
     features.  See *note Hints for further verification: 2cf4. for
     details.

     バージョン 3.14 で変更: Link targets are now normalized.


File: python.info,  Node: Filter errors,  Next: Hints for further verification,  Prev: Default named filters,  Up: Extraction filters

5.13.8.5 Filter errors
......................

When a filter refuses to extract a file, it will raise an appropriate
exception, a subclass of *note FilterError: 2ee7.  This will abort the
extraction if *note TarFile.errorlevel: 29e. is 1 or more.  With
‘errorlevel=0’ the error will be logged and the member will be skipped,
but extraction will continue.


File: python.info,  Node: Hints for further verification,  Next: Supporting older Python versions,  Prev: Filter errors,  Up: Extraction filters

5.13.8.6 Hints for further verification
.......................................

Even with ‘filter='data'’, 'tarfile' is not suited for extracting
untrusted files without prior inspection.  Among other issues, the
pre-defined filters do not prevent denial-of-service attacks.  Users
should do additional checks.

Here is an incomplete list of things to consider:

   * Extract to a *note new temporary directory: 52d. to prevent e.g.
     exploiting pre-existing links, and to make it easier to clean up
     after a failed extraction.

   * Disallow symbolic links if you do not need the functionality.

   * When working with untrusted data, use external (e.g.  OS-level)
     limits on disk, memory and CPU usage.

   * Check filenames against an allow-list of characters (to filter out
     control characters, confusables, foreign path separators, and so
     on).

   * Check that filenames have expected extensions (discouraging files
     that execute when you “click on them”, or extension-less files like
     Windows special device names).

   * Limit the number of extracted files, total size of extracted data,
     filename length (including symlink length), and size of individual
     files.

   * Check for files that would be shadowed on case-insensitive
     filesystems.

Also note that:

   * Tar files may contain multiple versions of the same file.  Later
     ones are expected to overwrite any earlier ones.  This feature is
     crucial to allow updating tape archives, but can be abused
     maliciously.

   * 'tarfile' does not protect against issues with “live” data, e.g.
     an attacker tinkering with the destination (or source) directory
     while extraction (or archiving) is in progress.


File: python.info,  Node: Supporting older Python versions,  Next: Stateful extraction filter example,  Prev: Hints for further verification,  Up: Extraction filters

5.13.8.7 Supporting older Python versions
.........................................

Extraction filters were added to Python 3.12, but may be backported to
older versions as security updates.  To check whether the feature is
available, use e.g.  ‘hasattr(tarfile, 'data_filter')’ rather than
checking the Python version.

The following examples show how to support Python versions with and
without the feature.  Note that setting ‘extraction_filter’ will affect
any subsequent operations.

   * Fully trusted archive:

          my_tarfile.extraction_filter = (lambda member, path: member)
          my_tarfile.extractall()

   * Use the ‘'data'’ filter if available, but revert to Python 3.11
     behavior (‘'fully_trusted'’) if this feature is not available:

          my_tarfile.extraction_filter = getattr(tarfile, 'data_filter',
                                                 (lambda member, path: member))
          my_tarfile.extractall()

   * Use the ‘'data'’ filter; 'fail' if it is not available:

          my_tarfile.extractall(filter=tarfile.data_filter)

     もしくは:

          my_tarfile.extraction_filter = tarfile.data_filter
          my_tarfile.extractall()

   * Use the ‘'data'’ filter; 'warn' if it is not available:

          if hasattr(tarfile, 'data_filter'):
              my_tarfile.extractall(filter='data')
          else:
              # remove this when no longer needed
              warn_the_user('Extracting may be unsafe; consider updating Python')
              my_tarfile.extractall()


File: python.info,  Node: Stateful extraction filter example,  Prev: Supporting older Python versions,  Up: Extraction filters

5.13.8.8 Stateful extraction filter example
...........................................

While 'tarfile"s extraction methods take a simple 'filter' callable,
custom filters may be more complex objects with an internal state.  It
may be useful to write these as context managers, to be used like this:

     with StatefulFilter() as filter_func:
         tar.extractall(path, filter=filter_func)

Such a filter can be written as, for example:

     class StatefulFilter:
         def __init__(self):
             self.file_count = 0

         def __enter__(self):
             return self

         def __call__(self, member, path):
             self.file_count += 1
             return member

         def __exit__(self, *exc_info):
             print(f'{self.file_count} files extracted')


File: python.info,  Node: コマンドラインインターフェイス,  Next: 使用例<16>,  Prev: Extraction filters,  Up: tarfile --- tar アーカイブファイルの読み書き

5.13.8.9 コマンドラインインターフェイス
.......................................

Added in version 3.4.

The ‘tarfile’ module provides a simple command-line interface to
interact with tar archives.

tar アーカイブを新規に作成したい場合、*note -c: 2f33. オプションの後にま
とめたいファイル名のリストを指定してください:

     $ python -m tarfile -c monty.tar  spam.txt eggs.txt

ディレクトリを渡すこともできます:

     $ python -m tarfile -c monty.tar life-of-brian_1979/

tar アーカイブをカレントディレクトリに展開したい場合、*note -e: 2f34. オ
プションを使用してください:

     $ python -m tarfile -e monty.tar

ディレクトリ名を渡すことで tar アーカイブを別のディレクトリに取り出すこ
ともできます:

     $ python -m tarfile -e monty.tar  other-dir/

tar アーカイブ内のファイル一覧を表示するには *note -l: 2f35. を使用して
ください:

     $ python -m tarfile -l monty.tar

* Menu:

* コマンドラインオプション: コマンドラインオプション<3>.


File: python.info,  Node: コマンドラインオプション<3>,  Up: コマンドラインインターフェイス

5.13.8.10 コマンドラインオプション
..................................

 -- Option: -l <tarfile>
 -- Option: --list <tarfile>

     tarfile 内のファイル一覧を表示します。

 -- Option: -c <tarfile> <source1> ... <sourceN>
 -- Option: --create <tarfile> <source1> ... <sourceN>

     ソースファイルから tarfile を作成します。

 -- Option: -e <tarfile> [<output_dir>]
 -- Option: --extract <tarfile> [<output_dir>]

     'output_dir' が指定されていない場合、カレントディレクトリに tarfile
     を展開します。

 -- Option: -t <tarfile>
 -- Option: --test <tarfile>

     tarfile が有効かどうか調べます。

 -- Option: -v, --verbose

     詳細も出力します。

 -- Option: --filter <filtername>

     Specifies the 'filter' for ‘--extract’.  See *note Extraction
     filters: 697. for details.  Only string names are accepted (that
     is, ‘fully_trusted’, ‘tar’, and ‘data’).


File: python.info,  Node: 使用例<16>,  Next: サポートしている tar フォーマット,  Prev: コマンドラインインターフェイス,  Up: tarfile --- tar アーカイブファイルの読み書き

5.13.8.11 使用例
................

* Menu:

* Reading examples::
* Writing examples::


File: python.info,  Node: Reading examples,  Next: Writing examples,  Up: 使用例<16>

5.13.8.12 Reading examples
..........................

tar アーカイブから現在のディレクトリにすべて抽出する方法:

     import tarfile
     tar = tarfile.open("sample.tar.gz")
     tar.extractall(filter='data')
     tar.close()

tar アーカイブの一部を、リストの代わりにジェネレーター関数を利用して
*note TarFile.extractall(): 29b. で展開する方法:

     import os
     import tarfile

     def py_files(members):
         for tarinfo in members:
             if os.path.splitext(tarinfo.name)[1] == ".py":
                 yield tarinfo

     tar = tarfile.open("sample.tar.gz")
     tar.extractall(members=py_files(tar))
     tar.close()

gzip 圧縮 tar アーカイブを作成してメンバー情報のいくつかを表示する方法:

     import tarfile
     tar = tarfile.open("sample.tar.gz", "r:gz")
     for tarinfo in tar:
         print(tarinfo.name, "is", tarinfo.size, "bytes in size and is ", end="")
         if tarinfo.isreg():
             print("a regular file.")
         elif tarinfo.isdir():
             print("a directory.")
         else:
             print("something else.")
     tar.close()


File: python.info,  Node: Writing examples,  Prev: Reading examples,  Up: 使用例<16>

5.13.8.13 Writing examples
..........................

非圧縮 tar アーカイブをファイル名のリストから作成する方法:

     import tarfile
     tar = tarfile.open("sample.tar", "w")
     for name in ["foo", "bar", "quux"]:
         tar.add(name)
     tar.close()

*note with: 186. 文を利用した同じ例:

     import tarfile
     with tarfile.open("sample.tar", "w") as tar:
         for name in ["foo", "bar", "quux"]:
             tar.add(name)

How to create and write an archive to stdout using *note
sys.stdout.buffer: ccd. in the 'fileobj' parameter in *note
TarFile.add(): dee.:

     import sys
     import tarfile
     with tarfile.open("sample.tar.gz", "w|gz", fileobj=sys.stdout.buffer) as tar:
         for name in ["foo", "bar", "quux"]:
             tar.add(name)

*note TarFile.add(): dee. 関数の 'filter' 引数を利用してユーザー情報をリ
セットしながらアーカイブを作成する方法:

     import tarfile
     def reset(tarinfo):
         tarinfo.uid = tarinfo.gid = 0
         tarinfo.uname = tarinfo.gname = "root"
         return tarinfo
     tar = tarfile.open("sample.tar.gz", "w:gz")
     tar.add("foo", filter=reset)
     tar.close()


File: python.info,  Node: サポートしている tar フォーマット,  Next: Unicode に関する問題,  Prev: 使用例<16>,  Up: tarfile --- tar アーカイブファイルの読み書き

5.13.8.14 サポートしている tar フォーマット
...........................................

There are three tar formats that can be created with the ‘tarfile’
module:

   * POSIX.1-1988 ustar format (*note USTAR_FORMAT: 2eff.).  ファイル名
     の長さは256文字までで、リンク名の長さは100文字までです。最大のファ
     イルサイズは8GiBです。このフォーマットは古くて制限が多いですが、広
     くサポートされています。

   * The GNU tar format (*note GNU_FORMAT: 2f00.).  It supports long
     filenames and linknames, files bigger than 8 GiB and sparse files.
     It is the de facto standard on GNU/Linux systems.  ‘tarfile’ fully
     supports the GNU tar extensions for long names, sparse file support
     is read-only.

   * The POSIX.1-2001 pax format (*note PAX_FORMAT: 2f01.).  It is the
     most flexible format with virtually no limits.  It supports long
     filenames and linknames, large files and stores pathnames in a
     portable way.  Modern tar implementations, including GNU tar,
     bsdtar/libarchive and star, fully support extended 'pax' features;
     some old or unmaintained libraries may not, but should treat 'pax'
     archives as if they were in the universally supported 'ustar'
     format.  It is the current default format for new archives.

     It extends the existing 'ustar' format with extra headers for
     information that cannot be stored otherwise.  There are two
     flavours of pax headers: Extended headers only affect the
     subsequent file header, global headers are valid for the complete
     archive and affect all following files.  All the data in a pax
     header is encoded in 'UTF-8' for portability reasons.

他にも、読み込みのみサポートしている tar フォーマットがいくつかあります:

   * ancient V7 フォーマット。これは Unix 7th Edition から存在する、最初
     の tar フォーマットです。通常のファイルとディレクトリのみ保存します
     。名前は 100 文字を超えてはならず、ユーザー/グループ名に関する情報
     は保存されません。いくつかのアーカイブは、フィールドが ASCII でない
     文字を含む場合に、ヘッダーのチェックサムの計算を誤ります。

   * SunOS tar 拡張フォーマット。POSIX.1-2001 pax フォーマットの亜流です
     が、互換性がありません。


File: python.info,  Node: Unicode に関する問題,  Prev: サポートしている tar フォーマット,  Up: tarfile --- tar アーカイブファイルの読み書き

5.13.8.15 Unicode に関する問題
..............................

tar フォーマットは、もともとテープドライブにファイルシステムのバックアッ
プをとる目的で設計されました。現在、tarアーカイブはファイルを配布する際
に一般的に用いられ、ネットワーク上で交換されています。オリジナルフォーマ
ットが抱える一つの問題は (他の多くのフォーマットでも同じですが)、様々な
文字エンコーディングのサポートについて考慮していないことです。例えば、
'UTF-8' システム上で作成された通常の tar アーカイブは、非 'ASCII' 文字を
含んでいた場合、'Latin-1' システムでは正しく読み取ることができません。テ
キストのメタデータ (ファイル名、リンク名、ユーザー/グループ名など) は破
壊されます。残念なことに、アーカイブのエンコーディングを自動検出する方法
はありません。pax フォーマットはこの問題を解決するために設計されました。
これは非 ASCII メタデータをユニバーサル文字エンコーディング 'UTF-8' を使
用して格納します。

The details of character conversion in ‘tarfile’ are controlled by the
'encoding' and 'errors' keyword arguments of the *note TarFile: 1429.
class.

'encoding' はアーカイブのメタデータに使用する文字エンコーディングを指定
します。デフォルト値は *note sys.getfilesystemencoding(): e53. で、フォ
ールバックとして ‘'ascii'’ が使用されます。アーカイブの読み書き時に、メ
タデータはそれぞれデコードまたはエンコードしなければなりません。
'encoding' に適切な値が設定されていない場合、その変換は失敗することがあ
ります。

引数 'errors' は文字を変換できない時の扱いを指定します。指定できる値は
*note エラーハンドラ: 1b6f. 節を参照してください。デフォルトのスキームは
‘'surrogateescape'’ で、Python はそのファイルシステムの呼び出しも使用し
ます。*note ファイル名、コマンドライン引数、および環境変数: 2f44. を参照
してください。

デフォルトの *note PAX_FORMAT: 2f01. アーカイブでは、メタデータはすべて
'UTF-8' で格納されるため、'encoding' は通常指定する必要はありません。
'encoding' は、まれにある、バイナリの pax ヘッダーがデコードされた場合、
あるいはサロゲート文字を含む文字列が格納されていた場合に使用されます。


File: python.info,  Node: ファイルフォーマット,  Next: 暗号関連のサービス,  Prev: データ圧縮とアーカイブ,  Up: Python 標準ライブラリ

5.14 ファイルフォーマット
=========================

この章で説明されるモジュールはマークアップやEメールでない様々なファイル
フォーマットを構文解析します。

* Menu:

* csv: csv --- CSV ファイルの読み書き. CSV ファイルの読み書き
* configparser: configparser --- 設定ファイルのパーサー. 設定ファイルのパーサー
* tomllib: tomllib --- TOML ファイルの解析. TOML ファイルの解析
* netrc: netrc --- netrc ファイルの処理. netrc ファイルの処理
* plistlib: plistlib --- Apple plist ファイルを生成・解析する. Apple .plist ファイルを生成・解析する


File: python.info,  Node: csv --- CSV ファイルの読み書き,  Next: configparser --- 設定ファイルのパーサー,  Up: ファイルフォーマット

5.14.1 ‘csv’ -- CSV ファイルの読み書き
--------------------------------------

'ソースコード:' Lib/csv.py(1)

__________________________________________________________________

CSV (Comma Separated Values、カンマ区切り値列) と呼ばれる形式は、 スプレ
ッドシートやデータベース間でのデータのインポートやエクスポートにおける最
も一般的な形式です。 CSVフォーマットは、 RFC 4180(2) によって標準的な方
法でフォーマットを記述する試みが行われる以前から長年使用されました。明確
に定義された標準がないということは、異なるアプリケーション によって生成
されたり取り込まれたりするデータ間では、しばしば微妙な違いが発生するとい
うことを意味します。こうした違いのために、複数のデータ源から得られた CSV
ファイルを処理する作業が鬱陶しいものになることがあります。とはいえ、デリ
ミタ (delimiter) やクオート文字の 相違はあっても、全体的な形式は十分似通
っているため、こうしたデータを効率的に操作し、データの読み書きにおける細
々としたことをプログラマ から隠蔽するような単一のモジュールを書くことは
可能です。

The ‘csv’ module implements classes to read and write tabular data in
CSV format.  It allows programmers to say, "write this data in the
format preferred by Excel," or "read data from this file which was
generated by Excel," without knowing the precise details of the CSV
format used by Excel.  Programmers can also describe the CSV formats
understood by other applications or define their own special-purpose CSV
formats.

The ‘csv’ module's *note reader: 6ae. and *note writer: 6af. objects
read and write sequences.  Programmers can also read and write data in
dictionary form using the *note DictReader: bd8. and *note DictWriter:
1417. classes.

参考
....

PEP 305(3) - CSV File API

     Python へのこのモジュールの追加を提案している Python 改良案 (PEP:
     Python Enhancement Proposal)。

* Menu:

* モジュールコンテンツ: モジュールコンテンツ<3>.
* Dialect クラスと書式化パラメータ::
* reader オブジェクト::
* writer オブジェクト::
* 使用例: 使用例<17>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/csv.py

   (2) https://datatracker.ietf.org/doc/html/rfc4180.html

   (3) https://peps.python.org/pep-0305/


File: python.info,  Node: モジュールコンテンツ<3>,  Next: Dialect クラスと書式化パラメータ,  Up: csv --- CSV ファイルの読み書き

5.14.1.1 モジュールコンテンツ
.............................

The ‘csv’ module defines the following functions:

 -- の関数: csv.reader (csvfile, /, dialect='excel', **fmtparams)

     Return a *note reader object: 2f4d. that will process lines from
     the given 'csvfile'.  A csvfile must be an iterable of strings,
     each in the reader's defined csv format.  A csvfile is most
     commonly a file-like object or list.  If 'csvfile' is a file
     object, it should be opened with ‘newline=''’.  (1)  An optional
     'dialect' parameter can be given which is used to define a set of
     parameters specific to a particular CSV dialect.  It may be an
     instance of a subclass of the *note Dialect: 1827. class or one of
     the strings returned by the *note list_dialects(): 1b94. function.
     The other optional 'fmtparams' keyword arguments can be given to
     override individual formatting parameters in the current dialect.
     For full details about the dialect and formatting parameters, see
     section *note Dialect クラスと書式化パラメータ: 2f4e.

     csv ファイルから読み込まれた各行は、文字列のリストとして返されます
     。*note QUOTE_NONNUMERIC: 1947. フォーマットオプションが指定された
     場合を除き、データ型の変換が自動的に行われることはありません (この
     オプションが指定された場合、クォートされていないフィールドは浮動小
     数点数に変換されます)。

     短い利用例:

          >>> import csv
          >>> with open('eggs.csv', newline='') as csvfile:
          ...     spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
          ...     for row in spamreader:
          ...         print(', '.join(row))
          Spam, Spam, Spam, Spam, Spam, Baked Beans
          Spam, Lovely Spam, Wonderful Spam

 -- の関数: csv.writer (csvfile, /, dialect='excel', **fmtparams)

     ユーザが与えたデータをデリミタで区切られた文字列に変換し、与えられ
     たファイルオブジェクトに書き込むための writer オブジェクトを返しま
     す。 'csvfile' は *note write(): 205b. メソッドを持つ任意のオブジェ
     クトです。 'csvfile' がファイルオブジェクトの場合、 ‘newline=''’ と
     して開くべきです (2) 。オプションとして 'dialect' 引数を与えること
     ができ、利用するCSV表現形式(dialect)を指定することができます。
     'dialect' パラメータは *note Dialect: 1827. クラスのサブクラスのイ
     ンスタンスか、 *note list_dialects(): 1b94. 関数が返す文字列の1つに
     することができます。別のオプション引数である 'fmtparams' キーワード
     引数は、現在の表現形式における個々の書式パラメータを上書きするため
     に与えることができます。dialect と書式パラメータについての詳細は、
     *note Dialect クラスと書式化パラメータ: 2f4e. 節を参照してください
     。 DB API を実装するモジュールとのインターフェースを可能な限り容易
     にするために、 *note None: 885. は空文字列として書き込まれます。こ
     の処理は可逆な変換ではありませんが、SQL で NULL データ値を CSV にダ
     ンプする処理を、 ‘cursor.fetch*’ 呼び出しによって返されたデータを前
     処理することなく簡単に行うことができます。他の非文字列データは、書
     き出される前に *note str(): 169. を使って文字列に変換されます。

     短い利用例:

          import csv
          with open('eggs.csv', 'w', newline='') as csvfile:
              spamwriter = csv.writer(csvfile, delimiter=' ',
                                      quotechar='|', quoting=csv.QUOTE_MINIMAL)
              spamwriter.writerow(['Spam'] * 5 + ['Baked Beans'])
              spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])

 -- の関数: csv.register_dialect (name, /, dialect='excel', **fmtparams)

     'dialect' を 'name' と関連付けます。 'name' は文字列でなければなり
     ません。表現形式(dialect)は *note Dialect: 1827. のサブクラスを渡す
     か、またはキーワード引数 'fmtparams' 、もしくは両方で指定できますが
     、キーワード引数の方が優先されます。表現形式と書式化パラメータにつ
     いての詳細は、 *note Dialect クラスと書式化パラメータ: 2f4e. 節を参
     照してください。

 -- の関数: csv.unregister_dialect (name)

     'name' に関連づけられた表現形式を表現形式レジストリから削除します。
     'name' が表現形式名でない場合には *note Error: 2f4f. を送出します。

 -- の関数: csv.get_dialect (name)

     'name' に関連づけられた表現形式を返します。 'name' が表現形式名でな
     い場合には *note Error: 2f4f. を送出します。この関数は不変の *note
     Dialect: 1827. を返します。

 -- の関数: csv.list_dialects ()

     登録されている全ての表現形式を返します。

 -- の関数: csv.field_size_limit ()

 -- の関数: csv.field_size_limit (new_limit)

     パーサが許容する現在の最大フィールドサイズを返します。 'new_limit'
     が渡されたときは、その値が新しい上限になります。

The ‘csv’ module defines the following classes:

 -- クラス: csv.DictReader (f, fieldnames=None, restkey=None,
          restval=None, dialect='excel', *args, **kwds)

     通常の reader のように動作しますが、個々の行の情報を *note dict:
     183. にマップするオブジェクトを生成します。マップのキーは省略可能な
     'fieldnames' パラメータで与えられます。

     The 'fieldnames' parameter is a *note sequence: 716.  If
     'fieldnames' is omitted, the values in the first row of file 'f'
     will be used as the fieldnames and will be omitted from the
     results.  If 'fieldnames' is provided, they will be used and the
     first row will be included in the results.  Regardless of how the
     fieldnames are determined, the dictionary preserves their original
     ordering.

     行がフィールド名より多くのフィールドを持っていた場合、残りのデータ
     はリストに入れられて、 'restkey' により指定されたフィールド名 (デフ
     ォルトでは ‘None’) で保存されます。空白でない行がフィールド名よりも
     少ないフィールドしか持たない場合、足りない値は 'restval' の値 (デフ
     ォルトは ‘None’ ) によって埋められます。

     その他の省略可能またはキーワード形式のパラメータは、ベースになって
     いる *note reader: 6ae. インスタンスに渡されます。

     'fieldnames' に渡された引数がイテレータの場合、 *note list: 24d. に
     変換されます。

     バージョン 3.6 で変更: 返される行の型は ‘OrderedDict’ になりました
     。

     バージョン 3.8 で変更: 返される行の型は *note dict: 183. になりまし
     た。

     短い利用例:

          >>> import csv
          >>> with open('names.csv', newline='') as csvfile:
          ...     reader = csv.DictReader(csvfile)
          ...     for row in reader:
          ...         print(row['first_name'], row['last_name'])
          ...
          Eric Idle
          John Cleese

          >>> print(row)
          {'first_name': 'John', 'last_name': 'Cleese'}

 -- クラス: csv.DictWriter (f, fieldnames, restval='',
          extrasaction='raise', dialect='excel', *args, **kwds)

     通常の writer のように動作しますが、辞書を出力行にマップするオブジ
     ェクトを生成します。 'fieldnames' パラメータは、*note writerow():
     fe9. メソッドに渡された辞書の値がどのような順番でファイル 'f' に書
     かれるかを指定するキーの *note sequence: 1f. です。 *note
     writerow(): fe9. メソッドに渡された辞書に 'fieldnames' には存在しな
     いキーが含まれている場合、オプションの 'extrasaction' パラメータに
     よってどんな動作を行うかが指定されます。この値がデフォルト値である
     ‘'raise'’ に設定されている場合、 *note ValueError: 2ec. が送出され
     ます。 ‘'ignore'’ に設定されている場合、辞書の余分な値は無視されま
     す。その他のパラメータはベースになっている *note writer: 6af. イン
     スタンスに渡されます。

     *note DictReader: bd8. クラスとは異なり、 *note DictWriter: 1417. の
     'fieldnames' パラメータは省略可能ではありません。

     'fieldnames' に渡された引数がイテレータの場合、 *note list: 24d. に
     変換されます。

     短い利用例:

          import csv

          with open('names.csv', 'w', newline='') as csvfile:
              fieldnames = ['first_name', 'last_name']
              writer = csv.DictWriter(csvfile, fieldnames=fieldnames)

              writer.writeheader()
              writer.writerow({'first_name': 'Baked', 'last_name': 'Beans'})
              writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})
              writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})

 -- クラス: csv.Dialect

     *note Dialect: 1827. クラスはコンテナクラスです。その属性に、ダブル
     クォート、空白文字、デリミタなどの扱い方に関する情報を含みます。CSV
     には厳密な規格がないため、アプリケーションによって生成される CSV デ
     ータはそれぞれ僅かに異なります。 *note Dialect: 1827. クラスのイン
     スタンスは *note reader: 6ae. と *note writer: 6af. のインスタンス
     の挙動を定義します。

     All available *note Dialect: 1827. names are returned by *note
     list_dialects(): 1b94, and they can be registered with specific
     *note reader: 6ae. and *note writer: 6af. classes through their
     initializer (‘__init__’) functions like this:

          import csv

          with open('students.csv', 'w', newline='') as csvfile:
              writer = csv.writer(csvfile, dialect='unix')

 -- クラス: csv.excel

     *note excel: 2f50. クラスは Excel で生成される CSV ファイルの通常の
     プロパティを定義します。これは ‘'excel'’ という名前の dialect とし
     て登録されています。

 -- クラス: csv.excel_tab

     *note excel_tab: 2f51. クラスは Excel で生成されるタブ分割ファイル
     の通常のプロパティを定義します。これは ‘'excel-tab'’ という名前の
     dialect として登録されています。

 -- クラス: csv.unix_dialect

     *note unix_dialect: 1416. クラスは UNIX システムで生成される CSV フ
     ァイルの通常のプロパティ (行終端記号として ‘'\n'’ を用い全てのフィ
     ールドをクォートするもの) を定義します。これは ‘'unix'’ という名前
     の dialect として登録されています。

     Added in version 3.2.

 -- クラス: csv.Sniffer

     *note Sniffer: 2f52. クラスは CSV ファイルの書式を推理するために用
     いられるクラスです。

     *note Sniffer: 2f52. クラスではメソッドを二つ提供しています:

      -- メソッド: sniff (sample, delimiters=None)

          与えられた 'sample' を解析し、発見されたパラメータを反映した
          *note Dialect: 1827. サブクラスを返します。オプションの
          'delimiters' パラメータを与えた場合、有効なデリミタ文字を含ん
          でいるはずの文字列として解釈されます。

      -- メソッド: has_header (sample)

          Analyze the sample text (presumed to be in CSV format) and
          return *note True: e07. if the first row appears to be a
          series of column headers.  Inspecting each column, one of two
          key criteria will be considered to estimate if the sample
          contains a header:

             - 2番目からn番目の行は数値を含みます。

             - the second through n-th rows contain strings where at
               least one value's length differs from that of the
               putative header of that column.

          Twenty-one rows after the header are sampled; if more than
          half of the columns + rows meet the criteria, *note True: e07.
          is returned.

          注釈: このメソッドは大雑把なヒューリスティックであり、結果が偽
          陽性や偽陰性である可能性があります。

*note Sniffer: 2f52. の利用例:

     with open('example.csv', newline='') as csvfile:
         dialect = csv.Sniffer().sniff(csvfile.read(1024))
         csvfile.seek(0)
         reader = csv.reader(csvfile, dialect)
         # ... process CSV file contents here ...
The ‘csv’ module defines the following constants:

 -- データ: csv.QUOTE_ALL

     *note writer: 6af. オブジェクトに対し、全てのフィールドをクオートす
     るように指示します。

 -- データ: csv.QUOTE_MINIMAL

     *note writer: 6af. オブジェクトに対し、 'delimiter' 、 'quotechar'、
     ‘'\r'’、‘'\n'’ または 'lineterminator' に含まれる任意の文字のような
     特別な文字を含むフィールドだけをクオートするように指示します。

 -- データ: csv.QUOTE_NONNUMERIC

     *note writer: 6af. オブジェクトに対し、全ての非数値フィールドをクオ
     ートするように指示します。

     *note reader: 6ae. オブジェクトに、クォーテーションで囲まれていない
     すべてのフィールドを *note float: 196. 型に変換するよう指示します。

          注釈: Some numeric types, such as *note bool: 3c3, *note
          Fraction: 213, or *note IntEnum: edb, have a string
          representation that cannot be converted to *note float: 196.
          They cannot be read in the *note QUOTE_NONNUMERIC: 1947. and
          *note QUOTE_STRINGS: 6ad. modes.

 -- データ: csv.QUOTE_NONE

     Instructs *note writer: 6af. objects to never quote fields.  When
     the current 'delimiter', 'quotechar', 'escapechar', ‘'\r'’, ‘'\n'’
     or any of the characters in 'lineterminator' occurs in output data
     it is preceded by the current 'escapechar' character.  If
     'escapechar' is not set, the writer will raise *note Error: 2f4f.
     if any characters that require escaping are encountered.  Set
     'quotechar' to ‘None’ to prevent its escaping.

     *note reader: 6ae. オブジェクトに、クオート文字に対する特殊処理を行
     わないよう指示します。

 -- データ: csv.QUOTE_NOTNULL

     Instructs *note writer: 6af. objects to quote all fields which are
     not ‘None’.  This is similar to *note QUOTE_ALL: 2f55, except that
     if a field value is ‘None’ an empty (unquoted) string is written.

     Instructs *note reader: 6ae. objects to interpret an empty
     (unquoted) field as ‘None’ and to otherwise behave as *note
     QUOTE_ALL: 2f55.

     Added in version 3.12.

 -- データ: csv.QUOTE_STRINGS

     Instructs *note writer: 6af. objects to always place quotes around
     fields which are strings.  This is similar to *note
     QUOTE_NONNUMERIC: 1947, except that if a field value is ‘None’ an
     empty (unquoted) string is written.

     Instructs *note reader: 6ae. objects to interpret an empty
     (unquoted) string as ‘None’ and to otherwise behave as *note
     QUOTE_NONNUMERIC: 1947.

     Added in version 3.12.

The ‘csv’ module defines the following exception:

 -- 例外: csv.Error

     全ての関数において、エラーが検出された際に送出される例外です。

   ---------- Footnotes ----------

   (1) If ‘newline=''’ is not specified, newlines embedded inside quoted
fields will not be interpreted correctly, and on platforms that use
‘\r\n’ line endings on write an extra ‘\r’ will be added.  It should
always be safe to specify ‘newline=''’, since the csv module does its
own (*note universal: f35.) newline handling.

   (2) If ‘newline=''’ is not specified, newlines embedded inside quoted
fields will not be interpreted correctly, and on platforms that use
‘\r\n’ line endings on write an extra ‘\r’ will be added.  It should
always be safe to specify ‘newline=''’, since the csv module does its
own (*note universal: f35.) newline handling.


File: python.info,  Node: Dialect クラスと書式化パラメータ,  Next: reader オブジェクト,  Prev: モジュールコンテンツ<3>,  Up: csv --- CSV ファイルの読み書き

5.14.1.2 Dialect クラスと書式化パラメータ
.........................................

To make it easier to specify the format of input and output records,
specific formatting parameters are grouped together into dialects.  A
dialect is a subclass of the *note Dialect: 1827. class containing
various attributes describing the format of the CSV file.  When creating
*note reader: 6ae. or *note writer: 6af. objects, the programmer can
specify a string or a subclass of the *note Dialect: 1827. class as the
dialect parameter.  In addition to, or instead of, the 'dialect'
parameter, the programmer can also specify individual formatting
parameters, which have the same names as the attributes defined below
for the *note Dialect: 1827. class.

Dialect は以下の属性をサポートしています:

 -- の属性: Dialect.delimiter

     フィールド間を分割するのに用いられる 1 文字からなる文字列です。デフ
     ォルトでは ‘','’ です。

 -- の属性: Dialect.doublequote

     フィールド内に現れた 'quotechar' のインスタンスで、クオートではない
     その文字自身でなければならない文字をどのようにクオートするかを制御
     します。 *note True: e07. の場合、この文字は二重化されます。 *note
     False: d2b. の場合、 'escapechar' は 'quotechar' の前に置かれます。
     デフォルトでは *note True: e07. です。

     出力においては、 'doublequote' が *note False: d2b. で 'escapechar'
     がセットされていない場合、フィールド内に 'quotechar' が現れると
     *note Error: 2f4f. が送出されます。

 -- の属性: Dialect.escapechar

     A one-character string used by the writer to escape characters that
     require escaping:

             * the 'delimiter', the 'quotechar', ‘'\r'’, ‘'\n'’ and any
               of the characters in 'lineterminator' are escaped if
               'quoting' is set to *note QUOTE_NONE: 2f57.;

             * the 'quotechar' is escaped if 'doublequote' is *note
               False: d2b.;

             * the 'escapechar' itself.

     On reading, the 'escapechar' removes any special meaning from the
     following character.  It defaults to *note None: 885, which
     disables escaping.

     バージョン 3.11 で変更: 空の 'escapechar' は許可されていません。

 -- の属性: Dialect.lineterminator

     *note writer: 6af. が作り出す各行を終端する際に用いられる文字列です
     。デフォルトでは ‘'\r\n'’ です。

          注釈: *note reader: 6ae. は ‘'\r'’ または ‘'\n'’ のどちらかを
          行末と認識するようにハードコードされており、 'lineterminator'
          を無視します。この振る舞いは将来変更されるかもしれません。

 -- の属性: Dialect.quotechar

     A one-character string used to quote fields containing special
     characters, such as the 'delimiter' or the 'quotechar', or which
     contain new-line characters (‘'\r'’, ‘'\n'’ or any of the
     characters in 'lineterminator').  It defaults to ‘'"'’.  Can be set
     to ‘None’ to prevent escaping ‘'"'’ if 'quoting' is set to *note
     QUOTE_NONE: 2f57.

     バージョン 3.11 で変更: 空の 'quotechar' は許可されていません。

 -- の属性: Dialect.quoting

     Controls when quotes should be generated by the writer and
     recognised by the reader.  It can take on any of the *note QUOTE_*
     constants: 2f54. and defaults to *note QUOTE_MINIMAL: 2f56. if
     'quotechar' is not ‘None’, and *note QUOTE_NONE: 2f57. otherwise.

 -- の属性: Dialect.skipinitialspace

     When *note True: e07, spaces immediately following the 'delimiter'
     are ignored.  The default is *note False: d2b.  When combining
     ‘delimiter=' '’ with ‘skipinitialspace=True’, unquoted empty fields
     are not allowed.

 -- の属性: Dialect.strict

     ‘True’ の場合、 不正な CSV 入力に対して *note Error: 2f4f. を送出し
     ます。デフォルトでは ‘False’ です。


File: python.info,  Node: reader オブジェクト,  Next: writer オブジェクト,  Prev: Dialect クラスと書式化パラメータ,  Up: csv --- CSV ファイルの読み書き

5.14.1.3 reader オブジェクト
............................

reader オブジェクト(*note DictReader: bd8. インスタンス、および *note
reader(): 6ae. 関数によって返されたオブジェクト) は、以下の public なメ
ソッドを持っています:

 -- メソッド: csvreader.__next__ ()

     reader の反復可能なオブジェクトから、現在の表現形式 (*note Dialect:
     1827.) に基づいて次の行を解析してリスト（オブジェクトが *note
     reader(): 6ae. から返された場合）または辞書 （ *note DictReader:
     bd8. のインスタンスの場合）として返します。通常は ‘next(reader)’ の
     ようにして呼び出すことになります。

reader オブジェクトには以下の公開属性があります:

 -- の属性: csvreader.dialect

     パーサで使われる表現形式の読み出し専用の記述です。

 -- の属性: csvreader.line_num

     ソースイテレータから読んだ行数です。この数は返されるレコードの数と
     は、レコードが複数行に亘ることがあるので、一致しません。

DictReader オブジェクトは、以下の public な属性を持っています:

 -- の属性: DictReader.fieldnames

     オブジェクトを生成するときに渡されなかった場合、この属性は最初のア
     クセス時か、ファイルから最初のレコードを読み出したときに初期化され
     ます。


File: python.info,  Node: writer オブジェクト,  Next: 使用例<17>,  Prev: reader オブジェクト,  Up: csv --- CSV ファイルの読み書き

5.14.1.4 writer オブジェクト
............................

*note writer: 6af. オブジェクト(*note DictWriter: 1417. インスタンス、お
よび *note writer(): 6af. 関数によって返されたオブジェクト) は、以下の
public なメソッドを持っています: 'row' には、 *note writer: 6af. オブジ
ェクトの場合には文字列か数値のイテラブルを指定し、 *note DictWriter:
1417. オブジェクトの場合はフィールド名をキーとして対応する文字列か数値を
格納した辞書オブジェクトを指定します(数値は *note str(): 169. で変換され
ます)。複素数を出力する場合、値をかっこで囲んで出力します。このため、CSV
ファイルを読み込むアプリケーションで（そのアプリケーションが複素数をサポ
ートしていたとしても）問題が発生する場合があります。

 -- メソッド: csvwriter.writerow (row, /)

     現在の表現形式 (*note Dialect: 1827.)に沿ってフォーマットされた
     'row' パラメータを writer のファイルオブジェクトに書き込みます。フ
     ァイルオブジェクトの 'write' メソッドを呼び出した際の戻り値を返しま
     す。

     バージョン 3.5 で変更: 任意のイテラブルのサポートの追加。

 -- メソッド: csvwriter.writerows (rows, /)

     'rows' 引数 (上で解説した 'row' オブジェクトのイテラブル) の全ての
     要素を現在の表現形式に基づいて書式化し、writer のファイルオブジェク
     トに書き込みます。

writer オブジェクトには以下の公開属性があります:

 -- の属性: csvwriter.dialect

     writer で使われる表現形式の読み出し専用の記述です。

DictWriter のオブジェクトは以下の public メソッドを持っています:

 -- メソッド: DictWriter.writeheader ()

     Write a row with the field names (as specified in the constructor)
     to the writer's file object, formatted according to the current
     dialect.  Return the return value of the *note
     csvwriter.writerow(): fe9. call used internally.

     Added in version 3.2.

     バージョン 3.8 で変更: *note writeheader(): 1418. は内部的に利用し
     ている *note csvwriter.writerow(): fe9. メソッドの返り値を返すよう
     になりました。


File: python.info,  Node: 使用例<17>,  Prev: writer オブジェクト,  Up: csv --- CSV ファイルの読み書き

5.14.1.5 使用例
...............

最も簡単な CSV ファイル読み込みの例です:

     import csv
     with open('some.csv', newline='') as f:
         reader = csv.reader(f)
         for row in reader:
             print(row)

別の書式での読み込み:

     import csv
     with open('passwd', newline='') as f:
         reader = csv.reader(f, delimiter=':', quoting=csv.QUOTE_NONE)
         for row in reader:
             print(row)

上に対して、単純な書き込みのプログラム例は以下のようになります。

     import csv
     with open('some.csv', 'w', newline='') as f:
         writer = csv.writer(f)
         writer.writerows(someiterable)

*note open(): 316. が CSV ファイルの読み込みに使われるため、ファイルはデ
フォルトではシステムのデフォルトエンコーディングでユニコード文字列にデコ
ードされます (*note locale.getencoding(): 329. を参照)。他のエンコーディ
ングを用いてデコードするには、open の引数 ‘encoding’ を設定して、以下の
ようにします:

     import csv
     with open('some.csv', newline='', encoding='utf-8') as f:
         reader = csv.reader(f)
         for row in reader:
             print(row)

システムのデフォルトエンコーディング以外で書き込む場合も同様です。出力フ
ァイルを開く際に引数 ‘encoding’ を明示してください。

新しい表現形式の登録:

     import csv
     csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)
     with open('passwd', newline='') as f:
         reader = csv.reader(f, 'unixpwd')

もう少し手の込んだ reader の使い方 -- エラーを捉えてレポートします。

     import csv, sys
     filename = 'some.csv'
     with open(filename, newline='') as f:
         reader = csv.reader(f)
         try:
             for row in reader:
                 print(row)
         except csv.Error as e:
             sys.exit(f'file {filename}, line {reader.line_num}: {e}')

このモジュールは文字列の解析は直接サポートしませんが、簡単にできます。

     import csv
     for row in csv.reader(['one,two,three']):
         print(row)

脚注
....


File: python.info,  Node: configparser --- 設定ファイルのパーサー,  Next: tomllib --- TOML ファイルの解析,  Prev: csv --- CSV ファイルの読み書き,  Up: ファイルフォーマット

5.14.2 ‘configparser’ -- 設定ファイルのパーサー
-----------------------------------------------

'ソースコード:' Lib/configparser.py(1)

__________________________________________________________________

このモジュールは、 Microsoft Windows の INI ファイルに似た構造を持ったベ
ーシックな設定用言語を実装した *note ConfigParser: 4de. クラスを提供しま
す。このクラスを使ってユーザーが簡単にカスタマイズできる Python プログラ
ムを作ることができます。

     注釈: このライブラリでは、Windowsのレジストリ用に拡張された INI 文
     法はサポート 'していません' 。

参考
....

モジュール *note tomllib: 102.

     TOML is a well-specified format for application configuration
     files.  It is specifically designed to be an improved version of
     INI.

*note shlex: c9. モジュール

     アプリケーション設定ファイルにも使える、Unix シェルに似たミニ言語の
     作成を支援します。

*note json: 86. モジュール

     The ‘json’ module implements a subset of JavaScript syntax which is
     sometimes used for configuration, but does not support comments.

* Menu:

* クイックスタート::
* サポートされるデータ型::
* 代替値::
* サポートするINI ファイルの構造::
* Unnamed Sections::
* 値の補間::
* マップ型プロトコルアクセス::
* パーサーの振る舞いをカスタマイズする::
* レガシーな API の例::
* ConfigParser オブジェクト::
* RawConfigParser オブジェクト::
* 例外: 例外<9>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/configparser.py


File: python.info,  Node: クイックスタート,  Next: サポートされるデータ型,  Up: configparser --- 設定ファイルのパーサー

5.14.2.1 クイックスタート
.........................

次のような、非常に簡単な設定ファイルを例に考えましょう:

     [DEFAULT]
     ServerAliveInterval = 45
     Compression = yes
     CompressionLevel = 9
     ForwardX11 = yes

     [forge.example]
     User = hg

     [topsecret.server.example]
     Port = 50022
     ForwardX11 = no

The structure of INI files is described *note in the following section:
2f6f.  Essentially, the file consists of sections, each of which
contains keys with values.  ‘configparser’ classes can read and write
such files.  Let's start by creating the above configuration file
programmatically.

     >>> import configparser
     >>> config = configparser.ConfigParser()
     >>> config['DEFAULT'] = {'ServerAliveInterval': '45',
     ...                      'Compression': 'yes',
     ...                      'CompressionLevel': '9'}
     >>> config['forge.example'] = {}
     >>> config['forge.example']['User'] = 'hg'
     >>> config['topsecret.server.example'] = {}
     >>> topsecret = config['topsecret.server.example']
     >>> topsecret['Port'] = '50022'     # mutates the parser
     >>> topsecret['ForwardX11'] = 'no'  # same here
     >>> config['DEFAULT']['ForwardX11'] = 'yes'
     >>> with open('example.ini', 'w') as configfile:
     ...   config.write(configfile)
     ...

この例でわかるように、config parser は辞書のように扱うことができます。辞
書との違いは *note 後に: 2f70. 説明しますが、このインターフェイスは辞書
に対して期待するのととても近い動作をします。

これで設定ファイルを作成して保存できました。次はこれを読み込み直して、中
のデータを取り出してみましょう。

     >>> config = configparser.ConfigParser()
     >>> config.sections()
     []
     >>> config.read('example.ini')
     ['example.ini']
     >>> config.sections()
     ['forge.example', 'topsecret.server.example']
     >>> 'forge.example' in config
     True
     >>> 'python.org' in config
     False
     >>> config['forge.example']['User']
     'hg'
     >>> config['DEFAULT']['Compression']
     'yes'
     >>> topsecret = config['topsecret.server.example']
     >>> topsecret['ForwardX11']
     'no'
     >>> topsecret['Port']
     '50022'
     >>> for key in config['forge.example']:
     ...     print(key)
     user
     compressionlevel
     serveraliveinterval
     compression
     forwardx11
     >>> config['forge.example']['ForwardX11']
     'yes'

上の例からわかるように、API はとても直感的です。唯一の魔術は、‘DEFAULT’
セクションが他の全てのセクションのためのデフォルト値を提供していることで
す (1)。 また、セクション内の各キーは大文字小文字を区別せず、全て小文字
で保存されていることにも注意してください (2)。

It is possible to read several configurations into a single *note
ConfigParser: 4de, where the most recently added configuration has the
highest priority.  Any conflicting keys are taken from the more recent
configuration while the previously existing keys are retained.  The
example below reads in an ‘override.ini’ file, which will override any
conflicting keys from the ‘example.ini’ file.

     [DEFAULT]
     ServerAliveInterval = -1

     >>> config_override = configparser.ConfigParser()
     >>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}
     >>> with open('override.ini', 'w') as configfile:
     ...     config_override.write(configfile)
     ...
     >>> config_override = configparser.ConfigParser()
     >>> config_override.read(['example.ini', 'override.ini'])
     ['example.ini', 'override.ini']
     >>> print(config_override.get('DEFAULT', 'ServerAliveInterval'))
     -1

This behaviour is equivalent to a *note ConfigParser.read(): 1681. call
with several files passed to the 'filenames' parameter.

   ---------- Footnotes ----------

   (1) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2f71.
セクションを参照してください。

   (2) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2f71.
セクションを参照してください。


File: python.info,  Node: サポートされるデータ型,  Next: 代替値,  Prev: クイックスタート,  Up: configparser --- 設定ファイルのパーサー

5.14.2.2 サポートされるデータ型
...............................

Config parser は値のデータ型について何も推論せず、常に文字列のまま内部に
保存します。他のデータ型が必要な場合は自分で変換する必要があります:

     >>> int(topsecret['Port'])
     50022
     >>> float(topsecret['CompressionLevel'])
     9.0

このタスクはとても一般的なため、設定パーサーでは整数、浮動小数点数、真偽
値を扱うための手頃なゲッターメソッドが提供されています。真偽値の扱いは一
筋縄ではいきません。文字列を ‘bool()’ に渡しても、 ‘bool('False')’ が
‘True’ になってしまいます。そこで config parser は *note getboolean():
2f73. を提供しています。このメソッドは大文字小文字を区別せず、
‘'yes'’/‘'no'’、‘'on'’/‘'off'’、‘'true'’/‘'false'’、‘'1'’/‘'0'’ を真偽値
として認識します (1)。例えば:

     >>> topsecret.getboolean('ForwardX11')
     False
     >>> config['forge.example'].getboolean('ForwardX11')
     True
     >>> config.getboolean('forge.example', 'Compression')
     True

config parser では、 *note getboolean(): 2f73. 以外に *note getint():
2f74. と *note getfloat(): 2f75. メソッドも提供されています。独自のコン
バーターの登録、提供されたメソッドのカスタマイズもできます。 (2)

   ---------- Footnotes ----------

   (1) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2f71.
セクションを参照してください。

   (2) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2f71.
セクションを参照してください。


File: python.info,  Node: 代替値,  Next: サポートするINI ファイルの構造,  Prev: サポートされるデータ型,  Up: configparser --- 設定ファイルのパーサー

5.14.2.3 代替値
...............

As with a dictionary, you can use a section's *note get(): 1483. method
to provide fallback values:

     >>> topsecret.get('Port')
     '50022'
     >>> topsecret.get('CompressionLevel')
     '9'
     >>> topsecret.get('Cipher')
     >>> topsecret.get('Cipher', '3des-cbc')
     '3des-cbc'

デフォルト値は代替値よりも優先されることに注意してください。例えば上の例
では、‘'CompressionLevel'’ キーは ‘'DEFAULT'’ セクションにしか存在しませ
ん。その値を ‘'topsecret.server.example'’ から取得しようとした場合、代替
値を指定しても常にデフォルト値を返します:

     >>> topsecret.get('CompressionLevel', '3')
     '9'

One more thing to be aware of is that the parser-level *note get():
1483. method provides a custom, more complex interface, maintained for
backwards compatibility.  When using this method, a fallback value can
be provided via the ‘fallback’ keyword-only argument:

     >>> config.get('forge.example', 'monster',
     ...            fallback='No such things as monsters')
     'No such things as monsters'

同様の ‘fallback’ 引数を、*note getint(): 2f74. 、 *note getfloat():
2f75. と *note getboolean(): 2f73. メソッドでも使えます。例えば:

     >>> 'BatchMode' in topsecret
     False
     >>> topsecret.getboolean('BatchMode', fallback=True)
     True
     >>> config['DEFAULT']['BatchMode'] = 'no'
     >>> topsecret.getboolean('BatchMode', fallback=True)
     False


File: python.info,  Node: サポートするINI ファイルの構造,  Next: Unnamed Sections,  Prev: 代替値,  Up: configparser --- 設定ファイルのパーサー

5.14.2.4 サポートするINI ファイルの構造
.......................................

A configuration file consists of sections, each led by a ‘[section]’
header, followed by key/value entries separated by a specific string
(‘=’ or ‘:’ by default (1)).  By default, section names are case
sensitive but keys are not (2).  Leading and trailing whitespace is
removed from keys and values.  Values can be omitted if the parser is
configured to allow it (3), in which case the key/value delimiter may
also be left out.  Values can also span multiple lines, as long as they
are indented deeper than the first line of the value.  Depending on the
parser's mode, blank lines may be treated as parts of multiline values
or ignored.

By default, a valid section name can be any string that does not contain
'\n'.  To change this, see *note ConfigParser.SECTCRE: 2f77.

The first section name may be omitted if the parser is configured to
allow an unnamed top level section with ‘allow_unnamed_section=True’.
In this case, the keys/values may be retrieved by *note UNNAMED_SECTION:
178a. as in ‘config[UNNAMED_SECTION]’.

設定ファイルには先頭に特定の文字 (デフォルトでは ‘#’ および ‘;’ (4)) を
つけてコメントをつけることができます。コメントは、他の内容がない行に置く
ことができ、インデントされていても構いません。(5)

例えば:

     [Simple Values]
     key=value
     spaces in keys=allowed
     spaces in values=allowed as well
     spaces around the delimiter = obviously
     you can also use : to delimit keys from values

     [All Values Are Strings]
     values like this: 1000000
     or this: 3.14159265359
     are they treated as numbers? : no
     integers, floats and booleans are held as: strings
     can use the API to get converted values directly: true

     [Multiline Values]
     chorus: I'm a lumberjack, and I'm okay
         I sleep all night and I work all day

     [No Values]
     key_without_value
     empty string value here =

     [You can use comments]
     # like this
     ; or this

     # By default only in an empty line.
     # Inline comments can be harmful because they prevent users
     # from using the delimiting characters as parts of values.
     # That being said, this can be customized.

         [Sections Can Be Indented]
             can_values_be_as_well = True
             does_that_mean_anything_special = False
             purpose = formatting for readability
             multiline_values = are
                 handled just fine as
                 long as they are indented
                 deeper than the first line
                 of a value
             # Did I mention we can indent comments, too?

   ---------- Footnotes ----------

   (1) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2f71.
セクションを参照してください。

   (2) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2f71.
セクションを参照してください。

   (3) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2f71.
セクションを参照してください。

   (4) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2f71.
セクションを参照してください。

   (5) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2f71.
セクションを参照してください。


File: python.info,  Node: Unnamed Sections,  Next: 値の補間,  Prev: サポートするINI ファイルの構造,  Up: configparser --- 設定ファイルのパーサー

5.14.2.5 Unnamed Sections
.........................

The name of the first section (or unique) may be omitted and values
retrieved by the *note UNNAMED_SECTION: 178a. attribute.

     >>> config = """
     ... option = value
     ...
     ... [  Section 2  ]
     ... another = val
     ... """
     >>> unnamed = configparser.ConfigParser(allow_unnamed_section=True)
     >>> unnamed.read_string(config)
     >>> unnamed.get(configparser.UNNAMED_SECTION, 'option')
     'value'


File: python.info,  Node: 値の補間,  Next: マップ型プロトコルアクセス,  Prev: Unnamed Sections,  Up: configparser --- 設定ファイルのパーサー

5.14.2.6 値の補間
.................

コア機能に加えて、 *note ConfigParser: 4de. は補間(interpolation, 内挿と
も)をサポートします。これは ‘get()’ コールが値を返す前に、その値に対して
前処理を行えることを意味します。

 -- クラス: configparser.BasicInterpolation

     *note ConfigParser: 4de. が使用するデフォルト実装です。値に、同じセ
     クションか特別なデフォルトセクション中 (1) の他の値を参照するフォー
     マット文字列を含めることができます。追加のデフォルト値を初期化時に
     提供できます。

     例えば:

          [Paths]
          home_dir: /Users
          my_dir: %(home_dir)s/lumberjack
          my_pictures: %(my_dir)s/Pictures

          [Escape]
          # use a %% to escape the % sign (% is the only character that needs to be escaped):
          gain: 80%%

     上の例では、 'interpolation' に ‘BasicInterpolation()’ を設定した
     *note ConfigParser: 4de. が ‘%(home_dir)s’ を ‘home_dir’ の値(この
     ケースでは ‘/Users’ )として解決しています、その結果 ‘%(my_dir)s’ は
     ‘/Users/lumberjack’ になります。全ての補間は必要に応じて実行される
     ため、設定ファイル中で参照の連鎖をもつキーを特定の順序で記述する必
     要はありません。

     ‘interpolation’ に ‘None’ を設定すれば、パーサーは単に
     ‘my_pictures’ の値として ‘%(my_dir)s/Pictures’ を返し、‘my_dir’ の
     値として ‘%(home_dir)s/lumberjack’ を返します。

 -- クラス: configparser.ExtendedInterpolation

     ‘zc.buildout’ で使用されるような、より高度な文法を実装した補間ハン
     ドラの別の選択肢です。拡張された補間は、他のセクション中の値を示す
     のに ‘${section:option}’ と書けます。補間は複数のレベルに及べます、
     利便性のために、もし ‘section:’ の部分が省略されると、現在のセクシ
     ョンがデフォルト値となります(スペシャルセクション中のデフォルト値を
     使用することもできます)。

     たとえば、上記の basic interpolation で指定した設定は、extended
     interpolation を使うと下記のようになります:

          [Paths]
          home_dir: /Users
          my_dir: ${home_dir}/lumberjack
          my_pictures: ${my_dir}/Pictures

          [Escape]
          # use a $$ to escape the $ sign ($ is the only character that needs to be escaped):
          cost: $$80

     他のセクションから値を持ってくることもできます:

          [Common]
          home_dir: /Users
          library_dir: /Library
          system_dir: /System
          macports_dir: /opt/local

          [Frameworks]
          Python: 3.2
          path: ${Common:system_dir}/Library/Frameworks/

          [Arthur]
          nickname: Two Sheds
          last_name: Jackson
          my_dir: ${Common:home_dir}/twosheds
          my_pictures: ${my_dir}/Pictures
          python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python}

   ---------- Footnotes ----------

   (1) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2f71.
セクションを参照してください。


File: python.info,  Node: マップ型プロトコルアクセス,  Next: パーサーの振る舞いをカスタマイズする,  Prev: 値の補間,  Up: configparser --- 設定ファイルのパーサー

5.14.2.7 マップ型プロトコルアクセス
...................................

Added in version 3.2.

Mapping protocol access is a generic name for functionality that enables
using custom objects as if they were dictionaries.  In case of
‘configparser’, the mapping interface implementation is using the
‘parser['section']['option']’ notation.

とくに、‘parser['section']’ はパーサー内のそのセクションのデータへのプロ
キシを返します。つまり、値はコピーされるのではなく必要に応じてオリジナル
のパーサーから取られます。さらに重要なことに、セクションのプロキシの値が
変更されると、オリジナルのパーサー中の値が実際に変更されます。

‘configparser’ objects behave as close to actual dictionaries as
possible.  The mapping interface is complete and adheres to the *note
MutableMapping: 12c0. ABC. However, there are a few differences that
should be taken into account:

   * デフォルトでは、セクション内の全てのキーは大文字小文字の区別なくア
     クセスできます (1)。例えば、‘for option in parser["section"]’ は
     ‘optionxform’ されたオプションキー名のみを yield します。つまり小文
     字のキーがデフォルトです。同時に、キー ‘'a'’ を含むセクションにおい
     て、どちらの式も ‘True’ を返します:

          "a" in parser["section"]
          "A" in parser["section"]

   * 全てのセクションは ‘DEFAULTSECT’ 値を持ち、すなわちセクションで
     ‘.clear()’ してもセクションは見た目上空になりません。これは、デフォ
     ルト値は (技術的にはそこにないので) セクションから削除できないため
     です。デフォルト値が上書きされた場合、それが削除されるとデフォルト
     値が再び見えるようになります。デフォルト値を削除しようとすると
     *note KeyError: 5e7. が発生します。

   * ‘DEFAULTSECT’ はパーサーから取り除けません:

        * 削除しようとすると *note ValueError: 2ec. が発生します。

        * ‘parser.clear()’ はこれをそのまま残し、

        * ‘parser.popitem()’ がこれを返すことはありません。

   * ‘parser.get(section, option, **kwargs)’ - 第二引数は代替値では 'あ
     りません'。ただし、セクションごとの ‘get()’ メソッドはマップ型プロ
     トコルと旧式の configparser API の両方に互換です。

   * ‘parser.items()’ はマップ型プロトコルと互換です (DEFAULTSECT を含む
     'section_name', 'section_proxy' 対のリストを返します)。ただし、この
     メソッドは ‘parser.items(section, raw, vars)’ のようにして引数を与
     えることでも呼び出せます。後者の呼び出しは指定された ‘section’ の
     'option', 'value' 対のリストを、(‘raw=True’ が与えられない限り) 全
     ての補間を展開して返します。

マップ型プロトコルは、既存のレガシーな API の上に実装されているので、オ
リジナルのインターフェースを上書きする派生クラスもまたは期待どおりにはた
らきます。

   ---------- Footnotes ----------

   (1) 設定パーサーは大々的にカスタマイズできます。脚注の参照で概説され
た挙動の変更に関心がある場合、*note Customizing Parser Behaviour: 2f71.
セクションを参照してください。


File: python.info,  Node: パーサーの振る舞いをカスタマイズする,  Next: レガシーな API の例,  Prev: マップ型プロトコルアクセス,  Up: configparser --- 設定ファイルのパーサー

5.14.2.8 パーサーの振る舞いをカスタマイズする
.............................................

There are nearly as many INI format variants as there are applications
using it.  ‘configparser’ goes a long way to provide support for the
largest sensible set of INI styles available.  The default functionality
is mainly dictated by historical background and it's very likely that
you will want to customize some of the features.

The most common way to change the way a specific config parser works is
to use the ‘__init__()’ options:

   * 'defaults', デフォルト値: ‘None’

     このオプションは最初に ‘DEFAULT’ セクションに加えられるキー-値の対
     の辞書を受け付けます。

     Hint: if you want to specify default values for a specific section,
     use *note read_dict(): 2f7b. before you read the actual file.

   * 'dict_type', デフォルト値: *note dict: 183.

     このオプションはマップ型プロトコルの振る舞い方や書き込まれる設定フ
     ァイルの見た目に大きく影響します。標準の辞書では、全てのセクション
     はパーサーに加えられた順に並びます。同じことがセクション内のオプシ
     ョンにも言えます。

     セクションとオプションをライトバック時にソートするためなどに、別の
     辞書型も使えます。

     注意: 一度の操作でキー-値の対を複数追加する方法もあります。そのよう
     な操作に普通の辞書を使うと、キーの並びは挿入順になります。例えば:

          >>> parser = configparser.ConfigParser()
          >>> parser.read_dict({'section1': {'key1': 'value1',
          ...                                'key2': 'value2',
          ...                                'key3': 'value3'},
          ...                   'section2': {'keyA': 'valueA',
          ...                                'keyB': 'valueB',
          ...                                'keyC': 'valueC'},
          ...                   'section3': {'foo': 'x',
          ...                                'bar': 'y',
          ...                                'baz': 'z'}
          ... })
          >>> parser.sections()
          ['section1', 'section2', 'section3']
          >>> [option for option in parser['section3']]
          ['foo', 'bar', 'baz']

   * 'allow_no_value', デフォルト値: ‘False’

     Some configuration files are known to include settings without
     values, but which otherwise conform to the syntax supported by
     ‘configparser’.  The 'allow_no_value' parameter to the constructor
     can be used to indicate that such values should be accepted:

          >>> import configparser

          >>> sample_config = """
          ... [mysqld]
          ...   user = mysql
          ...   pid-file = /var/run/mysqld/mysqld.pid
          ...   skip-external-locking
          ...   old_passwords = 1
          ...   skip-bdb
          ...   # we don't need ACID today
          ...   skip-innodb
          ... """
          >>> config = configparser.ConfigParser(allow_no_value=True)
          >>> config.read_string(sample_config)

          >>> # Settings with values are treated as before:
          >>> config["mysqld"]["user"]
          'mysql'

          >>> # Settings without values provide None:
          >>> config["mysqld"]["skip-bdb"]

          >>> # Settings which aren't specified still raise an error:
          >>> config["mysqld"]["does-not-exist"]
          Traceback (most recent call last):
            ...
          KeyError: 'does-not-exist'

   * 'delimiters', デフォルト値: ‘('=', ':')’

     デリミタはセクション内でキーを値から区切る部分文字列です。行中で最
     初に現れた区切り部分文字列がデリミタと見なされます。つまり値にはデ
     リミタを含めることができます (キーには含めることができません)。

     *note ConfigParser.write(): 1de. の 'space_around_delimiters' 引数
     も参照してください。

   * 'comment_prefixes', デフォルト値: ‘('#', ';')’

   * 'inline_comment_prefixes', デフォルト値: ‘None’

     コメント接頭辞は設定ファイル中で有効なコメントの開始を示す文字列で
     す。'comment_prefixes' は他の内容がない行 (インデントは自由) にのみ
     使用でき、'inline_comment_prefixes' は任意の有効な値 (例えば、セク
     ション名、オプション、空行も可能) の後に使えます。デフォルトではイ
     ンラインコメントは無効化されていて、‘'#'’ と ‘';'’ を行全体のコメン
     トに使用します。

     バージョン 3.2 で変更: In previous versions of ‘configparser’
     behaviour matched ‘comment_prefixes=('#',';')’ and
     ‘inline_comment_prefixes=(';',)’.

     設定パーサーはコメント接頭辞のエスケープをサポートしないので、
     'inline_comment_prefixes' はユーザーがコメント接頭辞として使われる
     文字を含むオプション値を指定するのを妨げる可能性があります。疑わし
     い場合には、'inline_comment_prefixes' を設定しないようにしてくださ
     い。どのような状況でも、複数行にわたる値で、行の先頭にコメント接頭
     辞文字を保存する唯一の方法は、次の例のように接頭辞を補間することで
     す:

          >>> from configparser import ConfigParser, ExtendedInterpolation
          >>> parser = ConfigParser(interpolation=ExtendedInterpolation())
          >>> # the default BasicInterpolation could be used as well
          >>> parser.read_string("""
          ... [DEFAULT]
          ... hash = #
          ...
          ... [hashes]
          ... shebang =
          ...   ${hash}!/usr/bin/env python
          ...   ${hash} -*- coding: utf-8 -*-
          ...
          ... extensions =
          ...   enabled_extension
          ...   another_extension
          ...   #disabled_by_comment
          ...   yet_another_extension
          ...
          ... interpolation not necessary = if # is not at line start
          ... even in multiline values = line #1
          ...   line #2
          ...   line #3
          ... """)
          >>> print(parser['hashes']['shebang'])

          #!/usr/bin/env python
          # -*- coding: utf-8 -*-
          >>> print(parser['hashes']['extensions'])

          enabled_extension
          another_extension
          yet_another_extension
          >>> print(parser['hashes']['interpolation not necessary'])
          if # is not at line start
          >>> print(parser['hashes']['even in multiline values'])
          line #1
          line #2
          line #3

   * 'strict', デフォルト値: ‘True’

     When set to ‘True’, the parser will not allow for any section or
     option duplicates while reading from a single source (using *note
     read_file(): 72a, *note read_string(): 2f7c. or *note read_dict():
     2f7b.).  It is recommended to use strict parsers in new
     applications.

     バージョン 3.2 で変更: In previous versions of ‘configparser’
     behaviour matched ‘strict=False’.

   * 'empty_lines_in_values', デフォルト値: ‘True’

     設定パーサーでは、キーよりもその値を深くインデントするかぎり、複数
     行にまたがる値を使えます。デフォルトのパーサーはさらにその値の間に
     空行を置けます。同時に、キーは読みやすくするため任意にインデントで
     きます。結果として、設定ファイルが大きく複雑になったとき、ユーザー
     がファイル構造を見失いやすいです。この例をご覧ください:

          [Section]
          key = multiline
            value with a gotcha

           this = is still a part of the multiline value of 'key'

     これは特にプロポーショナルフォントを使ってファイルを編集しているユ
     ーザーにとって問題になることがあります。だから、アプリケーションの
     値に空行が必要ないなら、空行を認めないべきです。これによって空行で
     必ずキーが分かれます。上の例では、2 つのキー、‘key’ および ‘this’ が
     作られます。

   * 'default_section', デフォルト値: ‘configparser.DEFAULTSECT’ (すなわ
     ち: ‘"DEFAULT"’)

     他のセクションのデフォルト値や補間目的での特別なセクションを認める
     慣行はこのライブラリの明確なコンセプトの一つで、ユーザーは複雑で宣
     言的な設定を作成できます。このセクションは通常 ‘"DEFAULT"’ と呼ばれ
     ますが、任意の有効なセクション名を指すようにカスタマイズできます。
     典型的な値には ‘"general"’ や ‘"common"’ があります。与えられた名前
     はソースを読み込む際にデフォルトセクションを認識するのに使われ、設
     定をファイルに書き戻すときにも使われます。現在の値は
     ‘parser_instance.default_section’ 属性から取り出すことができ、実行
     時 (すなわちファイルを別のフォーマットに変換するとき) に変更するこ
     ともできます。

   * 'interpolation', デフォルト値: ‘configparser.BasicInterpolation’

     補間の振る舞いは、 'interpolation' 引数を通してカスタムハンドラを与
     えることでカスタマイズできます。 ‘None’ 引数を使うと補間を完全に無
     効にできます。 ‘ExtendedInterpolation()’ は、 ‘zc.buildout’ に影響
     を受けたより高度な補間を提供します。この話題に *note
     特化したドキュメントのセクション: 2f7a. をご覧ください。 *note
     RawConfigParser: 1166. のデフォルト値は ‘None’ です。

   * 'converters', デフォルト値: 未設定

     Config parsers provide option value getters that perform type
     conversion.  By default *note getint(): 2f74, *note getfloat():
     2f75, and *note getboolean(): 2f73. are implemented.  Should other
     getters be desirable, users may define them in a subclass or pass a
     dictionary where each key is a name of the converter and each value
     is a callable implementing said conversion.  For instance, passing
     ‘{'decimal': decimal.Decimal}’ would add ‘getdecimal()’ on both the
     parser object and all section proxies.  In other words, it will be
     possible to write both ‘parser_instance.getdecimal('section',
     'key', fallback=0)’ and
     ‘parser_instance['section'].getdecimal('key', 0)’.

     コンバーターがパーサーの状態にアクセスする必要がある場合、設定パー
     サーサブクラスでメソッドとして実装することができます。このメソッド
     の名前が ‘get’ から始まる場合、すべてのセクションプロキシで、辞書と
     互換性のある形式で利用できます (上記の ‘getdecimal()’ の例を参照)。

これらのパーサー引数のデフォルト値を上書きすれば、さらに進んだカスタマイ
ズができます。デフォルトはクラスで定義されているので、派生クラスや属性の
代入で上書きできます。

 -- の属性: ConfigParser.BOOLEAN_STATES

     デフォルトでは、 *note getboolean(): 2f73. を使うことで、設定パーサ
     ーは以下の値を ‘True’ と見なします: ‘'1'’, ‘'yes'’, ‘'true'’,
     ‘'on'’ 。以下の値を ‘False’ と見なします: ‘'0'’, ‘'no'’, ‘'false'’,
     ‘'off'’ 。文字列と対応するブール値のカスタム辞書を指定することでこ
     れを上書きできます。たとえば:

          >>> custom = configparser.ConfigParser()
          >>> custom['section1'] = {'funky': 'nope'}
          >>> custom['section1'].getboolean('funky')
          Traceback (most recent call last):
          ...
          ValueError: Not a boolean: nope
          >>> custom.BOOLEAN_STATES = {'sure': True, 'nope': False}
          >>> custom['section1'].getboolean('funky')
          False

     ほかの典型的なブール値ペアには ‘accept’/‘reject’ や
     ‘enabled’/‘disabled’ などがあります。

 -- メソッド: ConfigParser.optionxform (option)

     このメソッドは読み込み、取得、設定操作のたびにオプション名を変換し
     ます。デフォルトでは名前を小文字に変換します。従って設定ファイルが
     書き込まれるとき、すべてのキーは小文字になります。それがふさわしく
     なければ、このメソッドを上書きしてください。例えば:

          >>> config = """
          ... [Section1]
          ... Key = Value
          ...
          ... [Section2]
          ... AnotherKey = Value
          ... """
          >>> typical = configparser.ConfigParser()
          >>> typical.read_string(config)
          >>> list(typical['Section1'].keys())
          ['key']
          >>> list(typical['Section2'].keys())
          ['anotherkey']
          >>> custom = configparser.RawConfigParser()
          >>> custom.optionxform = lambda option: option
          >>> custom.read_string(config)
          >>> list(custom['Section1'].keys())
          ['Key']
          >>> list(custom['Section2'].keys())
          ['AnotherKey']

          注釈: The optionxform function transforms option names to a
          canonical form.  This should be an idempotent function: if the
          name is already in canonical form, it should be returned
          unchanged.

 -- の属性: ConfigParser.SECTCRE

     セクションヘッダを解析するのに使われる、コンパイルされた正規表現で
     す。デフォルトでは ‘[section]’ が ‘"section"’ という名前にマッチし
     ます。空白はセクション名の一部と見なされるので、‘[ larch ]’ は ‘"
     larch "’ という名のセクションとして読み込まれます。これがふさわしく
     ない場合、このメソッドを上書きしてください。例えば:

          >>> import re
          >>> config = """
          ... [Section 1]
          ... option = value
          ...
          ... [  Section 2  ]
          ... another = val
          ... """
          >>> typical = configparser.ConfigParser()
          >>> typical.read_string(config)
          >>> typical.sections()
          ['Section 1', '  Section 2  ']
          >>> custom = configparser.ConfigParser()
          >>> custom.SECTCRE = re.compile(r"\[ *(?P<header>[^]]+?) *\]")
          >>> custom.read_string(config)
          >>> custom.sections()
          ['Section 1', 'Section 2']

          注釈: ConfigParser オブジェクトはオプション行の認識に ‘OPTCRE’
          属性も使いますが、これを上書きすることは推奨されません。上書き
          するとコンストラクタオプション 'allow_no_value' および
          'delimiters' に干渉します。


File: python.info,  Node: レガシーな API の例,  Next: ConfigParser オブジェクト,  Prev: パーサーの振る舞いをカスタマイズする,  Up: configparser --- 設定ファイルのパーサー

5.14.2.9 レガシーな API の例
............................

Mainly because of backwards compatibility concerns, ‘configparser’
provides also a legacy API with explicit ‘get’/‘set’ methods.  While
there are valid use cases for the methods outlined below, mapping
protocol access is preferred for new projects.  The legacy API is at
times more advanced, low-level and downright counterintuitive.

設定ファイルを書き出す例:

     import configparser

     config = configparser.RawConfigParser()

     # Please note that using RawConfigParser's set functions, you can assign
     # non-string values to keys internally, but will receive an error when
     # attempting to write to a file or when you get it in non-raw mode. Setting
     # values using the mapping protocol or ConfigParser's set() does not allow
     # such assignments to take place.
     config.add_section('Section1')
     config.set('Section1', 'an_int', '15')
     config.set('Section1', 'a_bool', 'true')
     config.set('Section1', 'a_float', '3.1415')
     config.set('Section1', 'baz', 'fun')
     config.set('Section1', 'bar', 'Python')
     config.set('Section1', 'foo', '%(bar)s is %(baz)s!')

     # Writing our configuration file to 'example.cfg'
     with open('example.cfg', 'w') as configfile:
         config.write(configfile)

設定ファイルを読み込む例:

     import configparser

     config = configparser.RawConfigParser()
     config.read('example.cfg')

     # getfloat() raises an exception if the value is not a float
     # getint() and getboolean() also do this for their respective types
     a_float = config.getfloat('Section1', 'a_float')
     an_int = config.getint('Section1', 'an_int')
     print(a_float + an_int)

     # Notice that the next output does not interpolate '%(bar)s' or '%(baz)s'.
     # This is because we are using a RawConfigParser().
     if config.getboolean('Section1', 'a_bool'):
         print(config.get('Section1', 'foo'))

補間するには、 *note ConfigParser: 4de. を使ってください:

     import configparser

     cfg = configparser.ConfigParser()
     cfg.read('example.cfg')

     # Set the optional *raw* argument of get() to True if you wish to disable
     # interpolation in a single get operation.
     print(cfg.get('Section1', 'foo', raw=False))  # -> "Python is fun!"
     print(cfg.get('Section1', 'foo', raw=True))   # -> "%(bar)s is %(baz)s!"

     # The optional *vars* argument is a dict with members that will take
     # precedence in interpolation.
     print(cfg.get('Section1', 'foo', vars={'bar': 'Documentation',
                                            'baz': 'evil'}))

     # The optional *fallback* argument can be used to provide a fallback value
     print(cfg.get('Section1', 'foo'))
           # -> "Python is fun!"

     print(cfg.get('Section1', 'foo', fallback='Monty is not.'))
           # -> "Python is fun!"

     print(cfg.get('Section1', 'monster', fallback='No such things as monsters.'))
           # -> "No such things as monsters."

     # A bare print(cfg.get('Section1', 'monster')) would raise NoOptionError
     # but we can also use:

     print(cfg.get('Section1', 'monster', fallback=None))
           # -> None

どちらの型の ConfigParsers でもデフォルト値が利用できます。使われている
オプションがどこにも定義されていなければ、そのデフォルト値が補間に使われ
ます。

     import configparser

     # New instance with 'bar' and 'baz' defaulting to 'Life' and 'hard' each
     config = configparser.ConfigParser({'bar': 'Life', 'baz': 'hard'})
     config.read('example.cfg')

     print(config.get('Section1', 'foo'))     # -> "Python is fun!"
     config.remove_option('Section1', 'bar')
     config.remove_option('Section1', 'baz')
     print(config.get('Section1', 'foo'))     # -> "Life is hard!"


File: python.info,  Node: ConfigParser オブジェクト,  Next: RawConfigParser オブジェクト,  Prev: レガシーな API の例,  Up: configparser --- 設定ファイルのパーサー

5.14.2.10 ConfigParser オブジェクト
...................................

 -- クラス: configparser.ConfigParser (defaults=None, dict_type=dict,
          allow_no_value=False, *, delimiters=('=', ':'),
          comment_prefixes=('#', ';'), inline_comment_prefixes=None,
          strict=True, empty_lines_in_values=True,
          default_section=configparser.DEFAULTSECT,
          interpolation=BasicInterpolation(), converters={},
          allow_unnamed_section=False)

     主要な設定パーサーです。'defaults' が与えられれば、その辞書の持つ初
     期値で初期化されます。'dict_type' が与えられれば、それがセクション
     の一覧、セクション中のオプション、およびデフォルト値の辞書オブジェ
     クトを作成するのに使われます。

     'delimiters' が与えられた場合、キーと値を分割する部分文字列の組み合
     わせとして使われます。'comment_prefixes' が与えられた場合、他の内容
     がない行のコメントに接頭する部分文字列の組み合わせとして使われます
     。コメントはインデントできます。'inline_comment_prefixes' が与えら
     れた場合、非空行のコメントに接頭する部分文字列としての組み合わせと
     して使われます。

     'strict' が ‘True’ (デフォルト) であれば、パーサーは単一のソース (フ
     ァイル、文字列、辞書) 中にセクションやオプションの重複を認めず、
     *note DuplicateSectionError: 1486. や *note DuplicateOptionError:
     1487. を送出します。 'empty_lines_in_values' が ‘False’ (デフォルト
     : ‘True’) なら、空行はそれぞれオプションの終わりを示します。
     'allow_no_value' が ‘True’ (デフォルト: ‘False’) なら、値のないオプ
     ションが受け付けられます。そのオプションの値は ‘None’ となり、後端
     のデリミタを除いてシリアル化されます。

     When 'default_section' is given, it specifies the name for the
     special section holding default values for other sections and
     interpolation purposes (normally named ‘"DEFAULT"’).  This value
     can be retrieved and changed at runtime using the ‘default_section’
     instance attribute.  This won't re-evaluate an already parsed
     config file, but will be used when writing parsed settings to a new
     config file.

     補間の動作は、 'interpolation' 引数を通してカスタムハンドラを与える
     ことでカスタマイズできます。 ‘None’ 引数を使うと補間を完全に無効に
     できます。 ‘ExtendedInterpolation()’ は、 ‘zc.buildout’ に影響を受
     けたより高度な補間を提供します。この件に *note
     特化したドキュメントのセクション: 2f7a. を参照してください。

     補間に使われるすべてのオプション名は、他のオプション名参照と同様に
     、 *note optionxform(): 2f81. メソッドを通して渡されます。例えば、
     *note optionxform(): 2f81. のデフォルトの実装を使うと、値 ‘foo
     %(bar)s’ と ‘foo %(BAR)s’ は等しくなります。

     When 'converters' is given, it should be a dictionary where each
     key represents the name of a type converter and each value is a
     callable implementing the conversion from string to the desired
     datatype.  Every converter gets its own corresponding ‘get*()’
     method on the parser object and section proxies.

     When 'allow_unnamed_section' is ‘True’ (default: ‘False’), the
     first section name can be omitted.  See the *note "Unnamed
     Sections" section: 2f79.

     It is possible to read several configurations into a single *note
     ConfigParser: 4de, where the most recently added configuration has
     the highest priority.  Any conflicting keys are taken from the more
     recent configuration while the previously existing keys are
     retained.  The example below reads in an ‘override.ini’ file, which
     will override any conflicting keys from the ‘example.ini’ file.

          [DEFAULT]
          ServerAliveInterval = -1

          >>> config_override = configparser.ConfigParser()
          >>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}
          >>> with open('override.ini', 'w') as configfile:
          ...     config_override.write(configfile)
          ...
          >>> config_override = configparser.ConfigParser()
          >>> config_override.read(['example.ini', 'override.ini'])
          ['example.ini', 'override.ini']
          >>> print(config_override.get('DEFAULT', 'ServerAliveInterval'))
          -1

     バージョン 3.1 で変更: デフォルトの 'dict_type' は *note
     collections.OrderedDict: 7f3. です。

     バージョン 3.2 で変更: 'allow_no_value', 'delimiters',
     'comment_prefixes', 'strict', 'empty_lines_in_values',
     'default_section' および 'interpolation' が追加されました。

     バージョン 3.5 で変更: 'converters' 引数が追加されました。

     バージョン 3.7 で変更: The 'defaults' argument is read with *note
     read_dict(): 2f7b, providing consistent behavior across the parser:
     non-string keys and values are implicitly converted to strings.

     バージョン 3.8 で変更: The default 'dict_type' is *note dict: 183,
     since it now preserves insertion order.

     バージョン 3.13 で変更: Raise a *note MultilineContinuationError:
     2f82. when 'allow_no_value' is ‘True’, and a key without a value is
     continued with an indented line.

     バージョン 3.13 で変更: The 'allow_unnamed_section' argument was
     added.

      -- メソッド: defaults ()

          インスタンス全体で使われるデフォルト値の辞書を返します。

      -- メソッド: sections ()

          利用できるセクションのリストを返します。'default section' はリ
          ストに含まれません。

      -- メソッド: add_section (section)

          'section' という名のセクションをインスタンスに追加します。与え
          られた名前のセクション名がすでに存在したら、 *note
          DuplicateSectionError: 1486. が送出されます。 'default
          section' 名が渡されたら、 *note ValueError: 2ec. が送出されま
          す。セクションの名前は文字列でなければなりません。そうでなけれ
          ば、 *note TypeError: 198. が送出されます。

          バージョン 3.2 で変更: 文字列でないセクション名は *note
          TypeError: 198. を送出します。

      -- メソッド: has_section (section)

          指名された 'section' が設定中に存在するかを示します。'default
          section' は認識されません。

      -- メソッド: options (section)

          指定された 'section' 中で利用できるオプションのリストを返しま
          す。

      -- メソッド: has_option (section, option)

          与えられた 'section' が存在し、与えられた 'option' を含む場合
          、 *note True: e07. を返します。それ以外の場合には、 *note
          False: d2b. を返します。指定された 'section' が *note None:
          885. または空文字列の場合、 DEFAULT が仮定されます。

      -- メソッド: read (filenames, encoding=None)

          ファイル名の iterable を読み込んでパースしようと試みます。正常
          にパースできたファイル名のリストを返します。

          もし 'filenames' が文字列か *note bytes: 192. オブジェクトか
          *note path-like object: 5a1. なら、この引数は1つのファイル名と
          して扱われます。 'filenames' 中に開けないファイルがある場合、
          そのファイルは無視されます。この挙動は、設定ファイルが置かれる
          可能性のある場所(例えば、 カレントディレクトリ、ホームディレク
          トリ、システム全体の設定を行うディレクトリ)のイテラブルを指定
          して、イテラブルの中で存在する全ての設定ファイルを読むことを想
          定して設計されています。

          どの設定ファイルも存在しなかった場合、 *note ConfigParser:
          4de. のインスタンスは 空のデータセットを持ちます。初期値の設定
          ファイルを先に読み込んでおく必要があるアプリケーションでは、 オ
          プションのファイルを読み込むために *note read(): 1681. を呼ぶ
          前に 、まず *note read_file(): 72a. を用いて必要なファイルを読
          み込んでください:

               import configparser, os

               config = configparser.ConfigParser()
               config.read_file(open('defaults.cfg'))
               config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')],
                           encoding='cp1250')

          バージョン 3.2 で変更: Added the 'encoding' parameter.
          Previously, all files were read using the default encoding for
          *note open(): 316.

          バージョン 3.6.1 で変更: 'filenames' 引数が *note path-like
          object: 5a1. を受け入れるようになりました。

          バージョン 3.7 で変更: 'filenames' 引数が *note bytes: 192. オ
          ブジェクトを受け入れるようになりました。

      -- メソッド: read_file (f, source=None)

          設定データを 'f' から読み込んで解析します。'f' は Unicode 文字
          列を yield するイテラブル (例えばテキストモードで開かれたファ
          イル) です。

          Optional argument 'source' specifies the name of the file
          being read.  If not given and 'f' has a ‘name’ attribute, that
          is used for 'source'; the default is ‘'<???>'’.

          Added in version 3.2: ‘readfp()’ を置き換えます。

      -- メソッド: read_string (string, source='<string>')

          設定データを文字列から解析します。

          オプションの引数 'source' はコンテキストにおける渡された文字列
          の名前を指定します。与えられなければ、‘'<string>'’ が使われま
          す。これは一般にファイルシステムパスや URL にします。

          Added in version 3.2.

      -- メソッド: read_dict (dictionary, source='<dict>')

          辞書的な ‘items()’ メソッドを提供する任意のオブジェクトから設
          定を読み込みます。キーはセクション名で、値はそのセクションに現
          れるキーと値をもつ辞書です。使われた辞書型が順序を保存するなら
          、セクションおよびそのキーは順に加えられます。値は自動で文字列
          に変換されます。

          オプションの引数 'source' はコンテキストにおける渡された辞書の
          名前を指定します。与えられなければ、‘<dict>’ が使われます。

          このメソッドを使ってパーサー間で状態をコピーできます。

          Added in version 3.2.

      -- メソッド: get (section, option, *, raw=False, vars=None[,
               fallback])

          指名された 'section' の 'option' の値を取得します。'vars' が提
          供されるなら、それは辞書でなければならず、(与えられたなら)
          'vars', 'section', 'DEFAULTSECT' 内からこの順で 'option' が探
          索されます。'fallback' の値として ‘None’ を与えられます。

          'raw' が真でない時には、全ての ‘'%'’ 置換は展開されてから返さ
          れます。置換後の値はオプションと同じ順序で探されます。

          バージョン 3.2 で変更: 引数 'raw', 'vars' および 'fallback' は
          、(特にマッピングプロトコルを使用するときに) ユーザーが第 3 引
          数を 'fallback' フォールバックとして使おうとしないように、キー
          ワード専用となりました。

      -- メソッド: getint (section, option, *, raw=False, vars=None[,
               fallback])

          指定された 'section' 中の 'option' を整数に型強制する補助メソ
          ッドです。 'raw', 'vars' および 'fallback' の説明は *note
          get(): 1483. を参照してください。

      -- メソッド: getfloat (section, option, *, raw=False, vars=None[,
               fallback])

          A convenience method which coerces the 'option' in the
          specified 'section' to a floating-point number.  See *note
          get(): 1483. for explanation of 'raw', 'vars' and 'fallback'.

      -- メソッド: getboolean (section, option, *, raw=False,
               vars=None[, fallback])

          指定された 'section' 中の 'option' をブール値に型強制する補助
          メソッドです。なお、このオプションで受け付けられる値はこのメソ
          ッドが ‘True’ を返す ‘'1'’, ‘'yes'’, ‘'true'’, および ‘'on'’,と
          、このメソッドが ‘False’ を返す ‘'0'’, ‘'no'’, ‘'false'’, and
          ‘'off'’ です。その他のいかなる値も *note ValueError: 2ec. を送
          出します。 'raw', 'vars' および 'fallback' の説明は *note
          get(): 1483. を参照してください。

      -- メソッド: items (raw=False, vars=None)

      -- メソッド: items (section, raw=False, vars=None)

          'section' が与えられなければ、DEFAULTSECT を含めた
          'section_name', 'section_proxy' の対のリストを返します。

          与えられれば、与えられた 'section' 中のオプションの 'name',
          'value' の対のリストを返します。オプションの引数は *note
          get(): 1483. メソッドに与えるものと同じ意味を持ちます。

          バージョン 3.8 で変更: 'vars' に現れる項目は結果に表れなくなり
          ました。以前の挙動は、実際のパーサーオプションを補間のために与
          えられた変数と混合していました。

      -- メソッド: set (section, option, value)

          与えられたセクションが存在すれば、与えられたオプションを指定さ
          れた値に設定します。そうでなければ *note NoSectionError: 2f89.
          を送出します。 'option' および 'value' は文字列でなければなり
          ません。そうでなければ *note TypeError: 198. が送出されます。

      -- メソッド: write (fileobject, space_around_delimiters=True)

          設定の表現を指定された *note file object: 13db. に書き込みます
          。 'fileobject' は (文字列を受け付ける) テキストモードで開かれ
          ていなければなりません。この表現は後で *note read(): 1681. を
          呼び出すことでパースできます。 'space_around_delimiters' が真
          なら、キーと値の間のデリミタはスペースで囲まれます。

          バージョン 3.14 で変更: Raises InvalidWriteError if this would
          write a representation which cannot be accurately parsed by a
          future *note read(): 1681. call from this parser.

          注釈: Comments in the original configuration file are not
          preserved when writing the configuration back.  What is
          considered a comment, depends on the given values for
          'comment_prefix' and 'inline_comment_prefix'.

      -- メソッド: remove_option (section, option)

          指定された 'option' を指定された 'section' から削除します。セ
          クションが存在しなければ、 *note NoSectionError: 2f89. を送出
          します。オプションが存在して削除されれば、 *note True: e07. を
          返します。そうでなければ *note False: d2b. を返します。

      -- メソッド: remove_section (section)

          指定された 'section' を設定から削除します。セクションが実際に
          存在すれば、‘True’ を返します。そうでなければ ‘False’ を返しま
          す。

      -- メソッド: optionxform (option)

          入力ファイルに現れた、またはクライアントコードで渡されたオプシ
          ョン名 'option' を内部構造で実際に使われる形式に変換します。デ
          フォルトの実装では 'option' の小文字版を返します。派生クラスで
          これを上書きするか、クライアントコードでインスタンス上のこの名
          前の属性を設定して、この動作に影響を与えることができます。

          このメソッドを使うためにパーサーを派生クラス化させる必要はなく
          、インスタンス上で、これを文字列引数をとって文字列を返す関数に
          設定できます。例えば、これを ‘str’ に設定すると、オプション名
          に大文字小文字の区別をつけられます:

               cfgparser = ConfigParser()
               cfgparser.optionxform = str

          なお、設定ファイルを読み込むとき、オプション名の周りの空白は
          *note optionxform(): 2f81. が呼び出される前に取り除かれます。

 -- データ: configparser.UNNAMED_SECTION

     A special object representing a section name used to reference the
     unnamed section (see *note Unnamed Sections: 2f79.).

 -- データ: configparser.MAX_INTERPOLATION_DEPTH

     The maximum depth for recursive interpolation for *note get():
     1483. when the 'raw' parameter is false.  This is relevant only
     when the default 'interpolation' is used.


File: python.info,  Node: RawConfigParser オブジェクト,  Next: 例外<9>,  Prev: ConfigParser オブジェクト,  Up: configparser --- 設定ファイルのパーサー

5.14.2.11 RawConfigParser オブジェクト
......................................

 -- クラス: configparser.RawConfigParser (defaults=None, dict_type=dict,
          allow_no_value=False, *, delimiters=('=', ':'),
          comment_prefixes=('#', ';'), inline_comment_prefixes=None,
          strict=True, empty_lines_in_values=True,
          default_section=configparser.DEFAULTSECT,
          interpolation=BasicInterpolation(), converters={},
          allow_unnamed_section=False)

     Legacy variant of the *note ConfigParser: 4de.  It has
     interpolation disabled by default and allows for non-string section
     names, option names, and values via its unsafe ‘add_section’ and
     ‘set’ methods, as well as the legacy ‘defaults=’ keyword argument
     handling.

     バージョン 3.2 で変更: 'allow_no_value', 'delimiters',
     'comment_prefixes', 'strict', 'empty_lines_in_values',
     'default_section' および 'interpolation' が追加されました。

     バージョン 3.5 で変更: 'converters' 引数が追加されました。

     バージョン 3.8 で変更: The default 'dict_type' is *note dict: 183,
     since it now preserves insertion order.

     バージョン 3.13 で変更: The 'allow_unnamed_section' argument was
     added.

          注釈: 代わりに内部に保存する値の型を検査する *note
          ConfigParser: 4de. を使うことを検討してください。補間を望まな
          い場合、 ‘ConfigParser(interpolation=None)’ を使用できます。

      -- メソッド: add_section (section)

          Add a section named 'section' or *note UNNAMED_SECTION: 178a.
          to the instance.

          If the given section already exists, *note
          DuplicateSectionError: 1486. is raised.  If the 'default
          section' name is passed, *note ValueError: 2ec. is raised.  If
          *note UNNAMED_SECTION: 178a. is passed and support is
          disabled, *note UnnamedSectionDisabledError: 2f90. is raised.

          'section' の型は検査されないため、ユーザーは非文字列の名前付き
          セクションを作ることができます。この振る舞いはサポートされてお
          らず、内部エラーを起こす可能性があります。

     バージョン 3.14 で変更: Added support for *note UNNAMED_SECTION:
     178a.

      -- メソッド: set (section, option, value)

          与えられたセクションが存在していれば、オプションを指定された値
          に設定します。セクションが存在しなければ *note NoSectionError:
          2f89. を発生させます。 *note RawConfigParser: 1166. (あるいは
          'raw' パラメータをセットした *note ConfigParser: 4de.) を文字
          列型でない値の '内部的な' 格納場所として使うことは可能ですが、
          すべての機能 (置換やファイルへの出力を含む) がサポートされるの
          は文字列を値として使った場合だけです。

          ユーザーは、このメソッドを使って非文字列の値をキーに代入できま
          す。この振る舞いはサポートされておらず、非rawモードでの値の取
          得や、ファイルへの書き出しを試みた際にエラーの原因となりえます
          。このような代入を許さない 'マッピングプロトコルAPIを使用して
          ください'。


File: python.info,  Node: 例外<9>,  Prev: RawConfigParser オブジェクト,  Up: configparser --- 設定ファイルのパーサー

5.14.2.12 例外
..............

 -- 例外: configparser.Error

     Base class for all other ‘configparser’ exceptions.

 -- 例外: configparser.NoSectionError

     指定したセクションが見つからなかった時に起きる例外です。

 -- 例外: configparser.DuplicateSectionError

     Exception raised if *note add_section(): 1485. is called with the
     name of a section that is already present or in strict parsers when
     a section if found more than once in a single input file, string or
     dictionary.

     バージョン 3.2 で変更: Added the optional 'source' and 'lineno'
     attributes and parameters to ‘__init__()’.

 -- 例外: configparser.DuplicateOptionError

     strict なパーサーで、単一の入力ファイル、文字列、辞書中に同じオプシ
     ョンが複数回現れたときに送出される例外です。これはミススペルや大文
     字小文字の区別に関係するエラー、例えば辞書の二つのキーが同じ大文字
     小文字の区別のない設定キーを表すこと、を捕捉します。

 -- 例外: configparser.NoOptionError

     指定されたオプションが指定されたセクションに見つからないときに送出
     される例外です。

 -- 例外: configparser.InterpolationError

     文字列の補間中に問題が起きた時に発生する例外の基底クラスです。

 -- 例外: configparser.InterpolationDepthError

     繰り返しの回数が *note MAX_INTERPOLATION_DEPTH: 2f8c. を超えたため
     に文字列補間が完了しなかったときに送出される例外です。 *note
     InterpolationError: 2f95. の派生クラスです。

 -- 例外: configparser.InterpolationMissingOptionError

     *note InterpolationError: 2f95. の派生クラスで、値が参照しているオ
     プションが見つからない場合に発生する例外です。

 -- 例外: configparser.InterpolationSyntaxError

     置換がなされるソーステキストが要求された文法を満たさないときに送出
     される例外です。 *note InterpolationError: 2f95. の派生クラスです。

 -- 例外: configparser.MissingSectionHeaderError

     セクションヘッダを持たないファイルを構文解析しようとした時に起きる
     例外です。

 -- 例外: configparser.ParsingError

     ファイルの構文解析中にエラーが起きた場合に発生する例外です。

     バージョン 3.12 で変更: The ‘filename’ attribute and ‘__init__()’
     constructor argument were removed.  They have been available using
     the name ‘source’ since 3.2.

 -- 例外: configparser.MultilineContinuationError

     Exception raised when a key without a corresponding value is
     continued with an indented line.

     Added in version 3.13.

 -- 例外: configparser.UnnamedSectionDisabledError

     Exception raised when attempting to use the *note UNNAMED_SECTION:
     178a. without enabling it.

          Added in version 3.14.

 -- 例外: configparser.InvalidWriteError

     Exception raised when an attempted *note ConfigParser.write(): 1de.
     would not be parsed accurately with a future *note
     ConfigParser.read(): 1681. call.

     Ex: Writing a key beginning with the *note ConfigParser.SECTCRE:
     2f77. pattern would parse as a section header when read.
     Attempting to write this will raise this exception.

     Added in version 3.14.

脚注
....


File: python.info,  Node: tomllib --- TOML ファイルの解析,  Next: netrc --- netrc ファイルの処理,  Prev: configparser --- 設定ファイルのパーサー,  Up: ファイルフォーマット

5.14.3 ‘tomllib’ -- TOML ファイルの解析
---------------------------------------

Added in version 3.11.

'ソースコード:' Lib/tomllib(1)

__________________________________________________________________

このモジュールはTOML 1.0.0（Tom's Obvious Minimal Language,
https://toml.io(2)）を解析するインターフェースを提供します。このモジュー
ルはTOMLの書き出しはサポートしません。

参考
....

Tomli-W パッケージ(3) はTOMLの書き込み用にこのモジュールと組み合わせて使
用でき、標準ライブラリの *note marshal: 91. や *note pickle: ab. モジュ
ールなどでユーザーによく知られている書き込みAPIを提供します。

参考
....

TOML Kit パッケージ(4) は、スタイルを保持した読み書きに対応したTOMLライ
ブラリです。存在するTOMLファイルを編集するときにこのモジュールの代わりに
使用することを推奨します。

このモジュールは以下の関数を定義しています:

 -- の関数: tomllib.load (fp, /, *, parse_float=float)

     TOMLファイルを読み込みます。第1引数には読み込み可能なバイナリのファ
     イルオブジェクトを指定します。戻り値は *note dict: 183. です。
     TOMLの型は *note conversion table: 2f9e. を使用してPythonのデータ型
     に変換されます。

     'parse_float' は、全てのデコードされる TOML の浮動小数点数文字列に
     対して呼ばれます。デフォルトでは、 ‘float(num_str)’ と等価です。こ
     れは TOML 浮動小数点数に対して他のデータ型やパーサ (たとえば *note
     decimal.Decimal: 1fe.) を使うのに使えます。呼び出し可能オブジェクト
     は *note dict: 183. や *note list: 24d. 以外を返す必要があり、そう
     でない場合は *note ValueError: 2ec. が送出されます。

     無効なTOMLドキュメントの場合は *note TOMLDecodeError: 190d. が送出
     されます。

 -- の関数: tomllib.loads (s, /, *, parse_float=float)

     *note str: 169. からTOMLを読み込みます。戻り値は *note dict: 183. で
     す。TOMLの型は *note conversion table: 2f9e. を使用してPythonのデー
     タ型に変換されます。'parse_float'  引数は *note load(): 2f9d. と同
     じ意味を持ちます。

     無効なTOMLドキュメントの場合は *note TOMLDecodeError: 190d. が送出
     されます。

次の例外がサポートされています:

 -- 例外: tomllib.TOMLDecodeError (msg, doc, pos)

     *note ValueError: 2ec. のサブクラスで、以下の追加の属性を持ちます:

      -- の属性: msg

          フォーマットされていないエラーメッセージです。

      -- の属性: doc

          パース対象の TOML ドキュメントです。

      -- の属性: pos

          'doc' の解析に失敗したインデクスです。

      -- の属性: lineno

          'pos' に対応する行です。

      -- の属性: colno

          'pos' に対応する列です。

     バージョン 3.14 で変更: Added the 'msg', 'doc' and 'pos'
     parameters.  Added the *note msg: 2f9f, *note doc: 2fa0, *note pos:
     2fa1, *note lineno: 2fa2. and *note colno: 2fa3. attributes.

     バージョン 3.14 で非推奨: Passing free-form positional arguments is
     deprecated.

* Menu:

* 使用例: 使用例<18>.
* 変換表::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/tomllib

   (2) https://toml.io/en/

   (3) https://pypi.org/project/tomli-w/

   (4) https://pypi.org/project/tomlkit/


File: python.info,  Node: 使用例<18>,  Next: 変換表,  Up: tomllib --- TOML ファイルの解析

5.14.3.1 使用例
...............

TOMLファイルを解析します:

     import tomllib

     with open("pyproject.toml", "rb") as f:
         data = tomllib.load(f)

TOMLの文字列を解析します:

     import tomllib

     toml_str = """
     python-version = "3.11.0"
     python-implementation = "CPython"
     """

     data = tomllib.loads(toml_str)


File: python.info,  Node: 変換表,  Prev: 使用例<18>,  Up: tomllib --- TOML ファイルの解析

5.14.3.2 変換表
...............

TOML                   Python
                       
------------------------------------------------------------------------------------------------------------------
                       
TOMLドキュメント       辞書
                       
                       
文字列                 文字列
                       
                       
整数                   整数
                       
                       
浮動小数点数           浮動小数点数（'parse_float' で設定可能）
                       
                       
ブール値               真偽値型(bool)
                       
                       
オフセット付きの日時   datetime.datetime（‘tzinfo’ 属性は ‘datetime.timezone’ のインスタンスが設定される）
                       
                       
ローカルの日時         datetime.datetime（‘tzinfo’ 属性は ‘None’ に設定される）
                       
                       
ローカルの日付         datetime.date
                       
                       
ローカルの時刻         datetime.time
                       
                       
配列                   リスト
                       
                       
テーブル               辞書
                       
                       
インラインテーブル     辞書
                       
                       
テーブルの配列         辞書のリスト
                       


File: python.info,  Node: netrc --- netrc ファイルの処理,  Next: plistlib --- Apple plist ファイルを生成・解析する,  Prev: tomllib --- TOML ファイルの解析,  Up: ファイルフォーマット

5.14.4 ‘netrc’ -- netrc ファイルの処理
--------------------------------------

'ソースコード:' Lib/netrc.py(1)

__________________________________________________________________

*note netrc: 1c79. クラスは、Unix ‘ftp’ プログラムや他の FTP クライアン
トで用いられる netrc ファイル形式を解析し、カプセル化 (encapsulate) しま
す。

 -- クラス: netrc.netrc ([file])

     A *note netrc: 1c79. instance or subclass instance encapsulates
     data from a netrc file.  The initialization argument, if present,
     specifies the file to parse.  If no argument is given, the file
     ‘.netrc’ in the user's home directory - as determined by *note
     os.path.expanduser(): c09. - will be read.  Otherwise, a *note
     FileNotFoundError: 264. exception will be raised.  Parse errors
     will raise *note NetrcParseError: 2fa9. with diagnostic information
     including the file name, line number, and terminating token.

     If no argument is specified on a POSIX system, the presence of
     passwords in the ‘.netrc’ file will raise a *note NetrcParseError:
     2fa9. if the file ownership or permissions are insecure (owned by a
     user other than the user running the process, or accessible for
     read or write by any other user).  This implements security
     behavior equivalent to that of ftp and other programs that use
     ‘.netrc’.  Such security checks are not available on platforms that
     do not support *note os.getuid(): 1817.

     バージョン 3.4 で変更: POSIX パーミッションのチェックが追加されまし
     た。

     バージョン 3.7 で変更: 引数で 'file' が渡されなかったときは、
     ‘.netrc’ ファイルの場所を探すのに *note os.path.expanduser(): c09.
     が使われるようになりました。

     バージョン 3.10 で変更: *note netrc: 9f. は、ロケール固有のエンコー
     ディングを使用する前に、 UTF-8 でのエンコーディングを試みます。
     netrc ファイルのエントリがすべてのトークンを含む必要はなくなりまし
     た。欠落したトークンのデフォルト値は空文字列です。すべてのトークン
     とその値は空白や非 ASCII 文字のような任意の文字を使用できるようにな
     りました。ログイン名が匿名の場合、セキュリティチェックはトリガーし
     ません。

 -- 例外: netrc.NetrcParseError

     ソーステキストに構文上のエラーがある場合に、 *note netrc: 1c79. ク
     ラスで発生する例外。この例外のインスタンスは3つの興味深い属性を提供
     します:

      -- の属性: msg

          エラーのテキストによる説明。

      -- の属性: filename

          ソースファイルの名前。

      -- の属性: lineno

          エラーが見つかった行番号。

* Menu:

* netrc オブジェクト::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/netrc.py


File: python.info,  Node: netrc オブジェクト,  Up: netrc --- netrc ファイルの処理

5.14.4.1 netrc オブジェクト
...........................

*note netrc: 1c79. インスタンスは以下のメソッドを持っています:

 -- メソッド: netrc.authenticators (host)

     'host' の認証情報として、三要素のタプル ‘(login, account,
     password)’ を返します。与えられた host に対するエントリが netrc フ
     ァイルにない場合、'default' エントリに関連付けられたタプルが返され
     ます。host に対応するエントリがなく、default エントリもない場合、
     ‘None’ を返します。

 -- メソッド: netrc.__repr__ ()

     クラスの持っているデータを netrc ファイルの書式に従った文字列で出力
     します。(コメントは無視され、エントリが並べ替えられる可能性がありま
     す。)

*note netrc: 1c79. のインスタンスは以下の public なインスタンス変数を持
っています:

 -- の属性: netrc.hosts

     ホスト名を ‘(login, account, password)’ からなるタプルに対応づけて
     いる辞書です。'default' エントリがある場合、その名前の擬似ホスト名
     として表現されます。

 -- の属性: netrc.macros

     マクロ名を文字列のリストに対応付けている辞書です。


File: python.info,  Node: plistlib --- Apple plist ファイルを生成・解析する,  Prev: netrc --- netrc ファイルの処理,  Up: ファイルフォーマット

5.14.5 ‘plistlib’ -- Apple ‘.plist’ ファイルを生成・解析する
------------------------------------------------------------

'ソースコード:' Lib/plistlib.py(1)

__________________________________________________________________

このモジュールは Apple (主に macOS と iOS) で使われる「プロパティーリス
ト」ファイルを読み書きするインターフェイスを提供します。このモジュールは
バイナリと XML の plist ファイルの両方をサポートします。

プロパティーリスト (‘.plist’) ファイル形式は基本的型のオブジェクト、たと
えば辞書やリスト、数、文字列など、に対する単純な直列化です。たいてい、ト
ップレベルのオブジェクトは辞書です。

plist ファイルを書き出したり解析したりするには *note dump(): b4a. や
*note load(): b48. 関数を利用します。

バイトオブジェクトや文字列オブジェクトの plist データを扱うためには
*note dumps(): b4b. や *note loads(): b49. を利用します。

値は文字列、整数、浮動小数点数、ブール型、タプル、リスト、辞書 (ただし文
字列だけがキーになれます)、 *note bytes: 192.、*note bytearray: 344. ま
たは *note datetime.datetime: 4e2. のオブジェクトです。

バージョン 3.4 で変更: 新しい API となり、古い API は非推奨となりました
。バイナリ形式の plist がサポートされました。

バージョン 3.8 で変更: バイナリの plist で NSKeyedArchiver や
NSKeyedUnarchiver によって使用される *note UID: c16. トークンの読み込み
・書き込みのサポートが追加されました。

バージョン 3.9 で変更: 古い API が削除されました。

参考
....

PList マニュアルページ(2)

     このファイル形式の Apple の文書。

このモジュールは以下の関数を定義しています:

 -- の関数: plistlib.load (fp, *, fmt=None, dict_type=dict,
          aware_datetime=False)

     plist ファイルを読み込みます。'fp' は読み込み可能かつバイナリのファ
     イルオブジェクトです。展開されたルートオブジェクト (通常は辞書です)
     を返します。

     'fmt' はファイルの形式で、次の値が有効です。

        * *note None: 885.: ファイル形式を自動検出します

        * *note FMT_XML: 117b.: XML ファイル形式です

        * *note FMT_BINARY: 117c.: バイナリの plist 形式です

     'dict_type' は、 plist ファイルから読み出された辞書に使われる型です
     。

     When 'aware_datetime' is true, fields with type ‘datetime.datetime’
     will be created as *note aware object: 2899, with ‘tzinfo’ as *note
     datetime.UTC: 713.

     *note FMT_XML: 117b. 形式の XML データは *note xml.parsers.expat:
     12c. にある Expat パーサーを使って解析されます。不正な形式の XML に
     対して送出される可能性のある例外については、そちらの文書を参照して
     ください。plist 解析器では、未知の要素は単純に無視されます。

     The parser raises *note InvalidFileException: 1cfa. when the file
     cannot be parsed.

     Added in version 3.4.

     バージョン 3.13 で変更: キーワード専用引数 'aware_datetime' が追加
     されました。

 -- の関数: plistlib.loads (data, *, fmt=None, dict_type=dict,
          aware_datetime=False)

     バイナリまたは文字列オブジェクトから plist をロードします。キーワー
     ド引数の説明については、 *note load(): b48. を参照してください。

     Added in version 3.4.

     バージョン 3.13 で変更: 'fmt' が *note FMT_XML: 117b. の場合、
     'data' は文字列たり得ます。

 -- の関数: plistlib.dump (value, fp, *, fmt=FMT_XML, sort_keys=True,
          skipkeys=False, aware_datetime=False)

     Write 'value' to a plist file.  'fp' should be a writable, binary
     file object.

     'fmt' 引数は plist ファイルの形式を指定し、次のいずれかの値をとるこ
     とができます。

        * *note FMT_XML: 117b.: XML 形式の plist ファイルです

        * *note FMT_BINARY: 117c.: バイナリ形式の plist ファイルです

     'sort_keys' が真 (デフォルト) の場合、辞書内のキーは、plist にソー
     トされた順序で書き込まれます。偽の場合、ディクショナリのイテレート
     の順序で書き込まれます。

     'skipkeys' が偽 (デフォルト) の場合、この関数は辞書のキーが文字列で
     ない場合に *note TypeError: 198. を送出します。真の場合、そのような
     キーは読み飛ばされます。

     When 'aware_datetime' is true and any field with type
     ‘datetime.datetime’ is set as an *note aware object: 2899, it will
     convert to UTC timezone before writing it.

     *note TypeError: 198. が、オブジェクトがサポート外の型のものであっ
     たりサポート外の型のオブジェクトを含むコンテナだった場合に、送出さ
     れます。

     (バイナリの) plist ファイル内で表現できない整数値に対しては、 *note
     OverflowError: a81. が送出されます。

     Added in version 3.4.

     バージョン 3.13 で変更: キーワード専用引数 'aware_datetime' が追加
     されました。

 -- の関数: plistlib.dumps (value, *, fmt=FMT_XML, sort_keys=True,
          skipkeys=False, aware_datetime=False)

     'value' を plist 形式のバイトオブジェクトとして返します。この関数の
     キーワード引数の説明については、 *note dump(): b4a. を参照してくだ
     さい。

     Added in version 3.4.

以下のクラスが使用可能です:

 -- クラス: plistlib.UID (data)

     *note int: 19b. をラップします。これは NSKeyedArchiver でエンコード
     された UID を含むデータ、の読み込みや書き込みに使用されます (PList
     マニュアルを参照) 。

      -- の属性: data

          Int value of the UID. It must be in the range ‘0 <= data <
          2**64’.

     Added in version 3.8.

以下の定数が利用可能です:

 -- データ: plistlib.FMT_XML

     plist ファイルの XML 形式です

     Added in version 3.4.

 -- データ: plistlib.FMT_BINARY

     plist ファイルのバイナリ形式です

     Added in version 3.4.

The module defines the following exceptions:

 -- 例外: plistlib.InvalidFileException

     Raised when a file cannot be parsed.

     Added in version 3.4.

* Menu:

* 使用例: 使用例<19>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/plistlib.py

   (2) 
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/PropertyLists/


File: python.info,  Node: 使用例<19>,  Up: plistlib --- Apple plist ファイルを生成・解析する

5.14.5.1 使用例
...............

plist を作ります:

     import datetime
     import plistlib

     pl = dict(
         aString = "Doodah",
         aList = ["A", "B", 12, 32.1, [1, 2, 3]],
         aFloat = 0.1,
         anInt = 728,
         aDict = dict(
             anotherString = "<hello & hi there!>",
             aThirdString = "M\xe4ssig, Ma\xdf",
             aTrueValue = True,
             aFalseValue = False,
         ),
         someData = b"<binary gunk>",
         someMoreData = b"<lots of binary gunk>" * 10,
         aDate = datetime.datetime.now()
     )
     print(plistlib.dumps(pl).decode())

plist を解析します:

     import plistlib

     plist = b"""<plist version="1.0">
     <dict>
         <key>foo</key>
         <string>bar</string>
     </dict>
     </plist>"""
     pl = plistlib.loads(plist)
     print(pl["foo"])


File: python.info,  Node: 暗号関連のサービス,  Next: 汎用オペレーティングシステムサービス,  Prev: ファイルフォーマット,  Up: Python 標準ライブラリ

5.15 暗号関連のサービス
=======================

この章で記述されているモジュールでは、暗号の本質に関わる様々なアルゴリズ
ムを実装しています。 これらは必要に応じてインストールすることで使用でき
ます。概要を以下に示します:

* Menu:

* hashlib: hashlib --- セキュアハッシュとメッセージダイジェスト. セキュアハッシュとメッセージダイジェスト
* hmac: hmac --- メッセージ認証のための鍵付きハッシュ化. メッセージ認証のための鍵付きハッシュ化
* secrets: secrets --- 機密を扱うために安全な乱数を生成する. 機密を扱うために安全な乱数を生成する


File: python.info,  Node: hashlib --- セキュアハッシュとメッセージダイジェスト,  Next: hmac --- メッセージ認証のための鍵付きハッシュ化,  Up: 暗号関連のサービス

5.15.1 ‘hashlib’ -- セキュアハッシュとメッセージダイジェスト
------------------------------------------------------------

'ソースコード:' Lib/hashlib.py(1)

__________________________________________________________________

This module implements a common interface to many different hash
algorithms.  Included are the FIPS secure hash algorithms SHA224,
SHA256, SHA384, SHA512, (defined in the FIPS 180-4 standard(2)), the
SHA-3 series (defined in the FIPS 202 standard(3)) as well as the legacy
algorithms SHA1 (formerly part of FIPS(4)) and the MD5 algorithm
(defined in internet RFC 1321(5)).

     注釈: adler32 や crc32 ハッシュ関数は *note zlib: 139. モジュールで
     提供されています。

* Menu:

* ハッシュアルゴリズム::
* 使用法::
* コンストラクタ::
* 属性::
* Hash Objects::
* SHAKE 可変長ダイジェスト::
* ファイルのハッシュ化::
* 鍵導出::
* BLAKE2::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/hashlib.py

   (2) https://csrc.nist.gov/pubs/fips/180-4/upd1/final

   (3) https://csrc.nist.gov/pubs/fips/202/final

   (4) https://csrc.nist.gov/news/2023/decision-to-revise-fips-180-4

   (5) https://datatracker.ietf.org/doc/html/rfc1321.html


File: python.info,  Node: ハッシュアルゴリズム,  Next: 使用法,  Up: hashlib --- セキュアハッシュとメッセージダイジェスト

5.15.1.1 ハッシュアルゴリズム
.............................

各 'hash' の名前が付いたコンストラクタがあります。いずれも同一で簡単なイ
ンターフェイスのあるハッシュオブジェクトを返します。例えば、SHA-256 ハッ
シュオブジェクトを作るには *note sha256(): 18ae. を使います。このオブジ
ェクトには *note update: 2fc0. メソッドを用いて *note bytes-like
オブジェクト: 193. (通常 *note bytes: 192.) を渡すことができます。*note
digest(): 2fc1. や *note hexdigest(): 2fc2. メソッドを用いて、それまでに
渡したデータを連結したものの 'digest' をいつでも要求することができます。

To allow multithreading, the Python *note GIL: 164. is released while
computing a hash supplied more than 2047 bytes of data at once in its
constructor or *note .update: 2fc0. method.

Constructors for hash algorithms that are always present in this module
are *note sha1(): 2fc3, *note sha224(): 2fc4, *note sha256(): 18ae,
*note sha384(): 2fc5, *note sha512(): 2fc6, *note sha3_224(): ea0, *note
sha3_256(): ea1, *note sha3_384(): ea2, *note sha3_512(): ea3, *note
shake_128(): ea4, *note shake_256(): ea5, *note blake2b(): 852, and
*note blake2s(): 853.  *note md5(): 1823. is normally available as well,
though it may be missing or blocked if you are using a rare "FIPS
compliant" build of Python.  These correspond to *note
algorithms_guaranteed: 158b.

Additional algorithms may also be available if your Python
distribution's ‘hashlib’ was linked against a build of OpenSSL that
provides others.  Others 'are not guaranteed available' on all
installations and will only be accessible by name via *note new(): 1d2e.
See *note algorithms_available: 158c.

     警告: Some algorithms have known hash collision weaknesses
     (including MD5 and SHA1).  Refer to Attacks on cryptographic hash
     algorithms(1) and the *note hashlib-seealso: 2fc7. section at the
     end of this document.

Added in version 3.6: SHA3 (Keccak) and SHAKE constructors *note
sha3_224(): ea0, *note sha3_256(): ea1, *note sha3_384(): ea2, *note
sha3_512(): ea3, *note shake_128(): ea4, *note shake_256(): ea5. were
added.  *note blake2b(): 852. and *note blake2s(): 853. were added.

バージョン 3.9 で変更: All hashlib constructors take a keyword-only
argument 'usedforsecurity' with default value ‘True’.  A false value
allows the use of insecure and blocked hashing algorithms in restricted
environments.  ‘False’ indicates that the hashing algorithm is not used
in a security context, e.g.  as a non-cryptographic one-way compression
function.

バージョン 3.9 で変更: Hashlib now uses SHA3 and SHAKE from OpenSSL if
it provides it.

バージョン 3.12 で変更: For any of the MD5, SHA1, SHA2, or SHA3
algorithms that the linked OpenSSL does not provide we fall back to a
verified implementation from the HACL* project(2).

   ---------- Footnotes ----------

   (1) 
https://en.wikipedia.org/wiki/Cryptographic_hash_function#Attacks_on_cryptographic_hash_algorithms

   (2) https://github.com/hacl-star/hacl-star


File: python.info,  Node: 使用法,  Next: コンストラクタ,  Prev: ハッシュアルゴリズム,  Up: hashlib --- セキュアハッシュとメッセージダイジェスト

5.15.1.2 使用法
...............

>>''<<b"Nobody inspects the spammish repetition">>''<<というバイト文字列
のダイジェストを取得するには次のようにします:

     >>> import hashlib
     >>> m = hashlib.sha256()
     >>> m.update(b"Nobody inspects")
     >>> m.update(b" the spammish repetition")
     >>> m.digest()
     b'\x03\x1e\xdd}Ae\x15\x93\xc5\xfe\\\x00o\xa5u+7\xfd\xdf\xf7\xbcN\x84:\xa6\xaf\x0c\x95\x0fK\x94\x06'
     >>> m.hexdigest()
     '031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'

もっと簡潔に書くと、このようになります:

     >>> hashlib.sha256(b"Nobody inspects the spammish repetition").hexdigest()
     '031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'


File: python.info,  Node: コンストラクタ,  Next: 属性,  Prev: 使用法,  Up: hashlib --- セキュアハッシュとメッセージダイジェスト

5.15.1.3 コンストラクタ
.......................

 -- の関数: hashlib.new (name[, data], *, usedforsecurity=True)

     一般的なコンストラクタで、第一引数にアルゴリズム名を文字列 'name' で
     受け取ります。他にも、前述のハッシュアルゴリズムだけでなく OpenSSL
     ライブラリーが提供するような他のアルゴリズムにアクセスすることがで
     きます。

Using *note new(): 1d2e. with an algorithm name:

     >>> h = hashlib.new('sha256')
     >>> h.update(b"Nobody inspects the spammish repetition")
     >>> h.hexdigest()
     '031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'

 -- の関数: hashlib.md5 ([data], *, usedforsecurity=True)

 -- の関数: hashlib.sha1 ([data], *, usedforsecurity=True)

 -- の関数: hashlib.sha224 ([data], *, usedforsecurity=True)

 -- の関数: hashlib.sha256 ([data], *, usedforsecurity=True)

 -- の関数: hashlib.sha384 ([data], *, usedforsecurity=True)

 -- の関数: hashlib.sha512 ([data], *, usedforsecurity=True)

 -- の関数: hashlib.sha3_224 ([data], *, usedforsecurity=True)

 -- の関数: hashlib.sha3_256 ([data], *, usedforsecurity=True)

 -- の関数: hashlib.sha3_384 ([data], *, usedforsecurity=True)

 -- の関数: hashlib.sha3_512 ([data], *, usedforsecurity=True)

Named constructors such as these are faster than passing an algorithm
name to *note new(): 1d2e.


File: python.info,  Node: 属性,  Next: Hash Objects,  Prev: コンストラクタ,  Up: hashlib --- セキュアハッシュとメッセージダイジェスト

5.15.1.4 属性
.............

Hashlib provides the following constant module attributes:

 -- データ: hashlib.algorithms_guaranteed

     このモジュールによってすべてのプラットフォームでサポートされている
     ことが保証されるハッシュアルゴリズムの名前を含む集合です。一部のア
     ップストリームのベンダーが提供する奇妙な "FIPS準拠の" Pythonビルド
     ではmd5のサポートを除外していますが、その場合であっても 'md5' がリ
     ストに含まれることに注意してください。

     Added in version 3.2.

 -- データ: hashlib.algorithms_available

     実行中の Python インタープリタで利用可能なハッシュアルゴリズム名の
     set です。これらの名前は *note new(): 1d2e. に渡すことができます。
     *note algorithms_guaranteed: 158b. は常にサブセットです。この set の
     中に同じアルゴリズムが違う名前で複数回現れることがあります (OpenSSL
     由来)。

     Added in version 3.2.


File: python.info,  Node: Hash Objects,  Next: SHAKE 可変長ダイジェスト,  Prev: 属性,  Up: hashlib --- セキュアハッシュとメッセージダイジェスト

5.15.1.5 Hash Objects
.....................

コンストラクタが返すハッシュオブジェクトには、次のような定数属性が用意さ
れています:

 -- データ: hash.digest_size

     生成されたハッシュのバイト数。

 -- データ: hash.block_size

     内部で使われるハッシュアルゴリズムのブロックのバイト数。

ハッシュオブジェクトには次のような属性があります:

 -- の属性: hash.name

     このハッシュの正規名です。常に小文字で、*note new(): 1d2e. の引数と
     して渡してこのタイプの別のハッシュを生成することができます。

     バージョン 3.4 で変更: name 属性は CPython には最初からありましたが
     、Python 3.4 までは正式に明記されていませんでした。そのため、プラッ
     トフォームによっては存在しないかもしれません。

ハッシュオブジェクトには次のようなメソッドがあります:

 -- メソッド: hash.update (data)

     hash オブジェクトを *note bytes-like object: 193. で更新します。こ
     のメソッドの呼出しの繰り返しは、それらの引数を全て結合した引数で単
     一の呼び出しをした際と同じになります。すなわち ‘m.update(a);
     m.update(b)’ は ‘m.update(a + b)’ と等価です。

 -- メソッド: hash.digest ()

     これまで *note update(): 2fc0. メソッドに渡されたデータのダイジェス
     ト値を返します。これは *note digest_size: 2fcd. と同じ長さの、0 か
     ら 255 の範囲全てを含み得るバイトの列です。

 -- メソッド: hash.hexdigest ()

     *note digest(): 2fc1. と似ていますが、倍の長さの、16進形式文字列を
     返します。これは、電子メールなどの非バイナリ環境で値を交換する場合
     に便利です。

 -- メソッド: hash.copy ()

     ハッシュオブジェクトのコピー ("クローン") を返します。これは、最初
     の部分文字列が共通なデータのダイジェストを効率的に計算するために使
     用します。


File: python.info,  Node: SHAKE 可変長ダイジェスト,  Next: ファイルのハッシュ化,  Prev: Hash Objects,  Up: hashlib --- セキュアハッシュとメッセージダイジェスト

5.15.1.6 SHAKE 可変長ダイジェスト
.................................

 -- の関数: hashlib.shake_128 ([data], *, usedforsecurity=True)

 -- の関数: hashlib.shake_256 ([data], *, usedforsecurity=True)

The *note shake_128(): ea4. and *note shake_256(): ea5. algorithms
provide variable length digests with length_in_bits//2 up to 128 or 256
bits of security.  As such, their digest methods require a length.
Maximum length is not limited by the SHAKE algorithm.

 -- メソッド: shake.digest (length)

     これまで *note update(): 2fc0. メソッドに渡されたデータのダイジェス
     ト値を返します。これは 'length' と同じ長さの、0 から 255 の範囲全て
     を含み得るバイトの列です。

 -- メソッド: shake.hexdigest (length)

     *note digest(): 1e1a. と似ていますが、倍の長さの、16進形式文字列を
     返します。これは、電子メールなどの非バイナリ環境で値を交換する場合
     に便利です。

使用例:

     >>> h = hashlib.shake_256(b'Nobody inspects the spammish repetition')
     >>> h.hexdigest(20)
     '44709d6fcb83d92a76dcb0b668c98e1b1d3dafe7'


File: python.info,  Node: ファイルのハッシュ化,  Next: 鍵導出,  Prev: SHAKE 可変長ダイジェスト,  Up: hashlib --- セキュアハッシュとメッセージダイジェスト

5.15.1.7 ファイルのハッシュ化
.............................

The hashlib module provides a helper function for efficient hashing of a
file or file-like object.

 -- の関数: hashlib.file_digest (fileobj, digest, /)

     Return a digest object that has been updated with contents of file
     object.

     'fileobj' must be a file-like object opened for reading in binary
     mode.  It accepts file objects from builtin *note open(): 316,
     *note BytesIO: 10a4. instances, SocketIO objects from *note
     socket.socket.makefile(): 13b7, and similar.  'fileobj' must be
     opened in blocking mode, otherwise a *note BlockingIOError: 235.
     may be raised.

     The function may bypass Python's I/O and use the file descriptor
     from *note fileno(): 17ad. directly.  'fileobj' must be assumed to
     be in an unknown state after this function returns or raises.  It
     is up to the caller to close 'fileobj'.

     'digest' must either be a hash algorithm name as a 'str', a hash
     constructor, or a callable that returns a hash object.

     例:

          >>> import io, hashlib, hmac
          >>> with open("library/hashlib.rst", "rb") as f:
          ...     digest = hashlib.file_digest(f, "sha256")
          ...
          >>> digest.hexdigest()
          '...'

          >>> buf = io.BytesIO(b"somedata")
          >>> mac1 = hmac.HMAC(b"key", digestmod=hashlib.sha512)
          >>> digest = hashlib.file_digest(buf, lambda: mac1)

          >>> digest is mac1
          True
          >>> mac2 = hmac.HMAC(b"key", b"somedata", digestmod=hashlib.sha512)
          >>> mac1.digest() == mac2.digest()
          True

     Added in version 3.11.

     バージョン 3.14 で変更: Now raises a *note BlockingIOError: 235. if
     the file is opened in non-blocking mode.  Previously, spurious null
     bytes were added to the digest.


File: python.info,  Node: 鍵導出,  Next: BLAKE2,  Prev: ファイルのハッシュ化,  Up: hashlib --- セキュアハッシュとメッセージダイジェスト

5.15.1.8 鍵導出
...............

鍵の導出 (derivation) と引き伸ばし (stretching) のアルゴリズムはセキュア
なパスワードのハッシュ化のために設計されました。 ‘sha1(password)’ のよう
な甘いアルゴリズムは、ブルートフォース攻撃に抵抗できません。良いパスワー
ドハッシュ化は調節可能で、遅くて、 salt(1) を含まなければなりません。

 -- の関数: hashlib.pbkdf2_hmac (hash_name, password, salt, iterations,
          dklen=None)

     この関数は PKCS#5 のパスワードに基づいた鍵導出関数 2 を提供していま
     す。疑似乱数関数として HMAC を使用しています。

     文字列 'hash_name' は、HMAC のハッシュダイジェストアルゴリズムの望
     ましい名前で、例えば 'sha1' や 'sha256' です。 'password' と 'salt'
     はバイト列のバッファとして解釈されます。アプリケーションとライブラ
     リは、 'password' を適切な長さ (例えば 1024) に制限すべきです。
     'salt' は *note os.urandom(): 746. のような適切なソースからの、およ
     そ 16 バイトかそれ以上のバイト列にするべきです。

     The number of 'iterations' should be chosen based on the hash
     algorithm and computing power.  As of 2022, hundreds of thousands
     of iterations of SHA-256 are suggested.  For rationale as to why
     and how to choose what is best for your application, read 'Appendix
     A.2.2' of NIST-SP-800-132(2).  The answers on the stackexchange
     pbkdf2 iterations question(3) explain in detail.

     'dklen' は、導出されたバイト列の鍵の長さです。 'dklen' が ‘None’ の
     場合、ハッシュアルゴリズム 'hash_name' のダイジェストサイズが使われ
     ます。例えば SHA-512 では 64 です。

          >>> from hashlib import pbkdf2_hmac
          >>> our_app_iters = 500_000  # Application specific, read above.
          >>> dk = pbkdf2_hmac('sha256', b'password', b'bad salt' * 2, our_app_iters)
          >>> dk.hex()
          '15530bba69924174860db778f2c6f8104d3aaf9d26241840c8c4a641c8d000a9'

     Function only available when Python is compiled with OpenSSL.

     Added in version 3.4.

     バージョン 3.12 で変更: Function now only available when Python is
     built with OpenSSL. The slow pure Python implementation has been
     removed.

 -- の関数: hashlib.scrypt (password, *, salt, n, r, p, maxmem=0,
          dklen=64)

     この関数は、 RFC 7914(4) で定義されるscrypt のパスワードに基づいた
     鍵導出関数を提供します。

     'password' と 'salt' は *note bytes-like object: 193. でなければな
     りません。アプリケーションとライブラリは、 'password' を適切な長さ
     (例えば 1024) に制限すべきです。 'salt' は *note os.urandom(): 746.
     のような適切なソースからの、およそ 16 バイトかそれ以上のバイト列に
     するべきです。

     'n' is the CPU/Memory cost factor, 'r' the block size, 'p'
     parallelization factor and 'maxmem' limits memory (OpenSSL 1.1.0
     defaults to 32 MiB). 'dklen' is the length of the derived key in
     bytes.

     Added in version 3.6.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Salt_%28cryptography%29

   (2) 
https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf

   (3) 
https://security.stackexchange.com/questions/3959/recommended-of-iterations-when-using-pbkdf2-sha256/

   (4) https://datatracker.ietf.org/doc/html/rfc7914.html


File: python.info,  Node: BLAKE2,  Prev: 鍵導出,  Up: hashlib --- セキュアハッシュとメッセージダイジェスト

5.15.1.9 BLAKE2
...............

BLAKE2(1) is a cryptographic hash function defined in RFC 7693(2) that
comes in two flavors:

   * 'BLAKE2b', optimized for 64-bit platforms and produces digests of
     any size between 1 and 64 bytes,

   * 'BLAKE2s', optimized for 8- to 32-bit platforms and produces
     digests of any size between 1 and 32 bytes.

BLAKE2 supports 'keyed mode' (a faster and simpler replacement for
HMAC(3)), 'salted hashing', 'personalization', and 'tree hashing'.

Hash objects from this module follow the API of standard library's
‘hashlib’ objects.

* Menu:

* ハッシュオブジェクトの作成::
* 定数: 定数<5>.
* 使用例: 使用例<20>.
* クレジット;: クレジット.

   ---------- Footnotes ----------

   (1) https://www.blake2.net

   (2) https://datatracker.ietf.org/doc/html/rfc7693.html

   (3) 
https://en.wikipedia.org/wiki/Hash-based_message_authentication_code


File: python.info,  Node: ハッシュオブジェクトの作成,  Next: 定数<5>,  Up: BLAKE2

5.15.1.10 ハッシュオブジェクトの作成
....................................

新しいハッシュオブジェクトは、コンストラクタ関数を呼び出すことで生成され
ます:

 -- の関数: hashlib.blake2b (data=b'', *, digest_size=64, key=b'',
          salt=b'', person=b'', fanout=1, depth=1, leaf_size=0,
          node_offset=0, node_depth=0, inner_size=0, last_node=False,
          usedforsecurity=True)

 -- の関数: hashlib.blake2s (data=b'', *, digest_size=32, key=b'',
          salt=b'', person=b'', fanout=1, depth=1, leaf_size=0,
          node_offset=0, node_depth=0, inner_size=0, last_node=False,
          usedforsecurity=True)

These functions return the corresponding hash objects for calculating
BLAKE2b or BLAKE2s.  They optionally take these general parameters:

   * 'data': initial chunk of data to hash, which must be *note
     bytes-like object: 193.  It can be passed only as positional
     argument.

   * 'digest_size': 出力するダイジェストのバイト数。

   * 'key': key for keyed hashing (up to 64 bytes for BLAKE2b, up to 32
     bytes for BLAKE2s).

   * 'salt': salt for randomized hashing (up to 16 bytes for BLAKE2b, up
     to 8 bytes for BLAKE2s).

   * 'person': personalization string (up to 16 bytes for BLAKE2b, up to
     8 bytes for BLAKE2s).

下の表は一般的なパラメータの上限 (バイト単位) です:

Hash        digest_size     len(key)     len(salt)     len(person)
                                                       
-----------------------------------------------------------------------
                                                       
BLAKE2b     64              64           16            16
                                                       
                                                       
BLAKE2s     32              32           8             8
                                                       

     注釈: BLAKE2 specification defines constant lengths for salt and
     personalization parameters, however, for convenience, this
     implementation accepts byte strings of any size up to the specified
     length.  If the length of the parameter is less than specified, it
     is padded with zeros, thus, for example, ‘b'salt'’ and
     ‘b'salt\x00'’ is the same value.  (This is not the case for 'key'.)

これらのサイズは以下に述べるモジュール *note constants: 2fd6. で利用でき
ます。

コンストラクタ関数は以下のツリーハッシングパラメタを受け付けます:

   * 'fanout': fanout (0 to 255, 0 if unlimited, 1 in sequential mode).

   * 'depth': ツリーの深さの最大値（1から255までの値で、無制限であれば
     255、シーケンスモードでは1）。

   * 'leaf_size': maximal byte length of leaf (0 to ‘2**32-1’, 0 if
     unlimited or in sequential mode).

   * 'node_offset': node offset (0 to ‘2**64-1’ for BLAKE2b, 0 to
     ‘2**48-1’ for BLAKE2s, 0 for the first, leftmost, leaf, or in
     sequential mode).

   * 'node_depth': node depth (0 to 255, 0 for leaves, or in sequential
     mode).

   * 'inner_size': inner digest size (0 to 64 for BLAKE2b, 0 to 32 for
     BLAKE2s, 0 in sequential mode).

   * 'last_node': boolean indicating whether the processed node is the
     last one (‘False’ for sequential mode).

[image src="python-figures/hashlib-blake2-tree.png" alt="Explanation of tree mode parameters."]


Figure
See section 2.10 in BLAKE2 specification(1) for comprehensive review of
tree hashing.

   ---------- Footnotes ----------

   (1) https://www.blake2.net/blake2_20130129.pdf


File: python.info,  Node: 定数<5>,  Next: 使用例<20>,  Prev: ハッシュオブジェクトの作成,  Up: BLAKE2

5.15.1.11 定数
..............

 -- データ: blake2b.SALT_SIZE

 -- データ: blake2s.SALT_SIZE

ソルト長（コンストラクタが受け付けれる最大長）

 -- データ: blake2b.PERSON_SIZE

 -- データ: blake2s.PERSON_SIZE

Personalization string length (maximum length accepted by constructors).

 -- データ: blake2b.MAX_KEY_SIZE

 -- データ: blake2s.MAX_KEY_SIZE

最大キー長

 -- データ: blake2b.MAX_DIGEST_SIZE

 -- データ: blake2s.MAX_DIGEST_SIZE

ハッシュ関数が出力しうるダイジェストの最大長


File: python.info,  Node: 使用例<20>,  Next: クレジット,  Prev: 定数<5>,  Up: BLAKE2

5.15.1.12 使用例
................

* Menu:

* 簡単なハッシュ化::
* Using different digest sizes::
* Keyed hashing::
* Randomized hashing::
* Personalization::
* ツリーモード::


File: python.info,  Node: 簡単なハッシュ化,  Next: Using different digest sizes,  Up: 使用例<20>

5.15.1.13 簡単なハッシュ化
..........................

To calculate hash of some data, you should first construct a hash object
by calling the appropriate constructor function (*note blake2b(): 852.
or *note blake2s(): 853.), then update it with the data by calling *note
update(): 2fc0. on the object, and, finally, get the digest out of the
object by calling *note digest(): 2fc1. (or *note hexdigest(): 2fc2. for
hex-encoded string).

     >>> from hashlib import blake2b
     >>> h = blake2b()
     >>> h.update(b'Hello world')
     >>> h.hexdigest()
     '6ff843ba685842aa82031d3f53c48b66326df7639a63d128974c5c14f31a0f33343a8c65551134ed1ae0f2b0dd2bb495dc81039e3eeb0aa1bb0388bbeac29183'

As a shortcut, you can pass the first chunk of data to update directly
to the constructor as the positional argument:

     >>> from hashlib import blake2b
     >>> blake2b(b'Hello world').hexdigest()
     '6ff843ba685842aa82031d3f53c48b66326df7639a63d128974c5c14f31a0f33343a8c65551134ed1ae0f2b0dd2bb495dc81039e3eeb0aa1bb0388bbeac29183'

You can call *note hash.update(): 2fc0. as many times as you need to
iteratively update the hash:

     >>> from hashlib import blake2b
     >>> items = [b'Hello', b' ', b'world']
     >>> h = blake2b()
     >>> for item in items:
     ...     h.update(item)
     ...
     >>> h.hexdigest()
     '6ff843ba685842aa82031d3f53c48b66326df7639a63d128974c5c14f31a0f33343a8c65551134ed1ae0f2b0dd2bb495dc81039e3eeb0aa1bb0388bbeac29183'


File: python.info,  Node: Using different digest sizes,  Next: Keyed hashing,  Prev: 簡単なハッシュ化,  Up: 使用例<20>

5.15.1.14 Using different digest sizes
......................................

BLAKE2 はダイジェストの長さを、BLAKE2bでは64バイトまで、BLAKE2sでは32バ
イトまでのダイジェスト長を指定できます。例えばSHA-1を、出力を同じ長さの
ままでBLAKE2bで置き換えるには、BLAKE2bに20バイトのダイジェストを生成する
ように指示できます:

     >>> from hashlib import blake2b
     >>> h = blake2b(digest_size=20)
     >>> h.update(b'Replacing SHA1 with the more secure function')
     >>> h.hexdigest()
     'd24f26cf8de66472d58d4e1b1774b4c9158b1f4c'
     >>> h.digest_size
     20
     >>> len(h.digest())
     20

Hash objects with different digest sizes have completely different
outputs (shorter hashes are 'not' prefixes of longer hashes); BLAKE2b
and BLAKE2s produce different outputs even if the output length is the
same:

     >>> from hashlib import blake2b, blake2s
     >>> blake2b(digest_size=10).hexdigest()
     '6fa1d8fcfd719046d762'
     >>> blake2b(digest_size=11).hexdigest()
     'eb6ec15daf9546254f0809'
     >>> blake2s(digest_size=10).hexdigest()
     '1bf21a98c78a1c376ae9'
     >>> blake2s(digest_size=11).hexdigest()
     '567004bf96e4a25773ebf4'


File: python.info,  Node: Keyed hashing,  Next: Randomized hashing,  Prev: Using different digest sizes,  Up: 使用例<20>

5.15.1.15 Keyed hashing
.......................

Keyed hashing can be used for authentication as a faster and simpler
replacement for Hash-based message authentication code(1) (HMAC). BLAKE2
can be securely used in prefix-MAC mode thanks to the
indifferentiability property inherited from BLAKE.

This example shows how to get a (hex-encoded) 128-bit authentication
code for message ‘b'message data'’ with key ‘b'pseudorandom key'’:

     >>> from hashlib import blake2b
     >>> h = blake2b(key=b'pseudorandom key', digest_size=16)
     >>> h.update(b'message data')
     >>> h.hexdigest()
     '3d363ff7401e02026f4a4687d4863ced'

As a practical example, a web application can symmetrically sign cookies
sent to users and later verify them to make sure they weren't tampered
with:

     >>> from hashlib import blake2b
     >>> from hmac import compare_digest
     >>>
     >>> SECRET_KEY = b'pseudorandomly generated server secret key'
     >>> AUTH_SIZE = 16
     >>>
     >>> def sign(cookie):
     ...     h = blake2b(digest_size=AUTH_SIZE, key=SECRET_KEY)
     ...     h.update(cookie)
     ...     return h.hexdigest().encode('utf-8')
     >>>
     >>> def verify(cookie, sig):
     ...     good_sig = sign(cookie)
     ...     return compare_digest(good_sig, sig)
     >>>
     >>> cookie = b'user-alice'
     >>> sig = sign(cookie)
     >>> print("{0},{1}".format(cookie.decode('utf-8'), sig))
     user-alice,b'43b3c982cf697e0c5ab22172d1ca7421'
     >>> verify(cookie, sig)
     True
     >>> verify(b'user-bob', sig)
     False
     >>> verify(cookie, b'0102030405060708090a0b0c0d0e0f00')
     False

Even though there's a native keyed hashing mode, BLAKE2 can, of course,
be used in HMAC construction with *note hmac: 6e. module:

     >>> import hmac, hashlib
     >>> m = hmac.new(b'secret key', digestmod=hashlib.blake2s)
     >>> m.update(b'message')
     >>> m.hexdigest()
     'e3c8102868d28b5ff85fc35dda07329970d1a01e273c37481326fe0c861c8142'

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/HMAC


File: python.info,  Node: Randomized hashing,  Next: Personalization,  Prev: Keyed hashing,  Up: 使用例<20>

5.15.1.16 Randomized hashing
............................

By setting 'salt' parameter users can introduce randomization to the
hash function.  Randomized hashing is useful for protecting against
collision attacks on the hash function used in digital signatures.

     Randomized hashing is designed for situations where one party, the
     message preparer, generates all or part of a message to be signed
     by a second party, the message signer.  If the message preparer is
     able to find cryptographic hash function collisions (i.e., two
     messages producing the same hash value), then they might prepare
     meaningful versions of the message that would produce the same hash
     value and digital signature, but with different results (e.g.,
     transferring $1,000,000 to an account, rather than $10).
     Cryptographic hash functions have been designed with collision
     resistance as a major goal, but the current concentration on
     attacking cryptographic hash functions may result in a given
     cryptographic hash function providing less collision resistance
     than expected.  Randomized hashing offers the signer additional
     protection by reducing the likelihood that a preparer can generate
     two or more messages that ultimately yield the same hash value
     during the digital signature generation process -- even if it is
     practical to find collisions for the hash function.  However, the
     use of randomized hashing may reduce the amount of security
     provided by a digital signature when all portions of the message
     are prepared by the signer.

     (NIST SP-800-106 "Randomized Hashing for Digital Signatures"(1))

In BLAKE2 the salt is processed as a one-time input to the hash function
during initialization, rather than as an input to each compression
function.

     警告: 'Salted hashing' (or just hashing) with BLAKE2 or any other
     general-purpose cryptographic hash function, such as SHA-256, is
     not suitable for hashing passwords.  See BLAKE2 FAQ(2) for more
     information.

     >>> import os
     >>> from hashlib import blake2b
     >>> msg = b'some message'
     >>> # Calculate the first hash with a random salt.
     >>> salt1 = os.urandom(blake2b.SALT_SIZE)
     >>> h1 = blake2b(salt=salt1)
     >>> h1.update(msg)
     >>> # Calculate the second hash with a different random salt.
     >>> salt2 = os.urandom(blake2b.SALT_SIZE)
     >>> h2 = blake2b(salt=salt2)
     >>> h2.update(msg)
     >>> # The digests are different.
     >>> h1.digest() != h2.digest()
     True

   ---------- Footnotes ----------

   (1) https://csrc.nist.gov/pubs/sp/800/106/final

   (2) https://www.blake2.net/#qa


File: python.info,  Node: Personalization,  Next: ツリーモード,  Prev: Randomized hashing,  Up: 使用例<20>

5.15.1.17 Personalization
.........................

Sometimes it is useful to force hash function to produce different
digests for the same input for different purposes.  Quoting the authors
of the Skein hash function:

     We recommend that all application designers seriously consider
     doing this; we have seen many protocols where a hash that is
     computed in one part of the protocol can be used in an entirely
     different part because two hash computations were done on similar
     or related data, and the attacker can force the application to make
     the hash inputs the same.  Personalizing each hash function used in
     the protocol summarily stops this type of attack.

     (The Skein Hash Function Family(1), p.  21)

BLAKE2は 'person' 引数にバイト列を渡すことでパーソナライズできます:

     >>> from hashlib import blake2b
     >>> FILES_HASH_PERSON = b'MyApp Files Hash'
     >>> BLOCK_HASH_PERSON = b'MyApp Block Hash'
     >>> h = blake2b(digest_size=32, person=FILES_HASH_PERSON)
     >>> h.update(b'the same content')
     >>> h.hexdigest()
     '20d9cd024d4fb086aae819a1432dd2466de12947831b75c5a30cf2676095d3b4'
     >>> h = blake2b(digest_size=32, person=BLOCK_HASH_PERSON)
     >>> h.update(b'the same content')
     >>> h.hexdigest()
     'cf68fb5761b9c44e7878bfb2c4c9aea52264a80b75005e65619778de59f383a3'

Personalization together with the keyed mode can also be used to derive
different keys from a single one.

     >>> from hashlib import blake2s
     >>> from base64 import b64decode, b64encode
     >>> orig_key = b64decode(b'Rm5EPJai72qcK3RGBpW3vPNfZy5OZothY+kHY6h21KM=')
     >>> enc_key = blake2s(key=orig_key, person=b'kEncrypt').digest()
     >>> mac_key = blake2s(key=orig_key, person=b'kMAC').digest()
     >>> print(b64encode(enc_key).decode('utf-8'))
     rbPb15S/Z9t+agffno5wuhB77VbRi6F9Iv2qIxU7WHw=
     >>> print(b64encode(mac_key).decode('utf-8'))
     G9GtHFE1YluXY1zWPlYk1e/nWfu0WSEb0KRcjhDeP/o=

   ---------- Footnotes ----------

   (1) https://www.schneier.com/wp-content/uploads/2016/02/skein.pdf


File: python.info,  Node: ツリーモード,  Prev: Personalization,  Up: 使用例<20>

5.15.1.18 ツリーモード
......................

これが二つの葉ノードからなる最小の木をハッシュする例です:

       10
      /  \
     00  01

次の例では、64バイトの内部桁が使われ、32バイトの最終的なダイジェストを返
しています:

     >>> from hashlib import blake2b
     >>>
     >>> FANOUT = 2
     >>> DEPTH = 2
     >>> LEAF_SIZE = 4096
     >>> INNER_SIZE = 64
     >>>
     >>> buf = bytearray(6000)
     >>>
     >>> # Left leaf
     ... h00 = blake2b(buf[0:LEAF_SIZE], fanout=FANOUT, depth=DEPTH,
     ...               leaf_size=LEAF_SIZE, inner_size=INNER_SIZE,
     ...               node_offset=0, node_depth=0, last_node=False)
     >>> # Right leaf
     ... h01 = blake2b(buf[LEAF_SIZE:], fanout=FANOUT, depth=DEPTH,
     ...               leaf_size=LEAF_SIZE, inner_size=INNER_SIZE,
     ...               node_offset=1, node_depth=0, last_node=True)
     >>> # Root node
     ... h10 = blake2b(digest_size=32, fanout=FANOUT, depth=DEPTH,
     ...               leaf_size=LEAF_SIZE, inner_size=INNER_SIZE,
     ...               node_offset=0, node_depth=1, last_node=True)
     >>> h10.update(h00.digest())
     >>> h10.update(h01.digest())
     >>> h10.hexdigest()
     '3ad2a9b37c6070e374c7a8c508fe20ca86b6ed54e286e93a0318e95e881db5aa'


File: python.info,  Node: クレジット,  Prev: 使用例<20>,  Up: BLAKE2

5.15.1.19 クレジット:
.....................

BLAKE2(1) は*Jean-Philippe Aumasson*、 'Luca Henzen'、 'Willi Meier' そ
して 'Raphael C.-W. Phan' によって作成された SHA-3(2) の最終候補である
BLAKE(3) を元に、'Jean-Philippe Aumasson'、 'Samuel Neves'、 'Zooko
Wilcox-O'Hearn', そして 'Christian Winnerlein' によって設計されました。

それは、 'Daniel J. Bernstein' によって設計されたChaCha(4) 暗号由来のア
ルゴリズムを用いています。

標準ライブラリは pyblake2(5) モジュールを基礎として実装されています。 こ
のモジュールは 'Dmitry Chestnykh' によって、'Samuel Neves' が作成した C実
装を元に書かれました。 このドキュメントは、pyblake2(6) からコピーされ、
'Dmitry Chestnykh' によって書かれました。

'Christian Heimes' によって、一部のCコードがPython向けに書き直されました
。

以下の public domain dedicationが、Cのハッシュ関数実装と、拡張コードと、
このドキュメントに適用されます:

     To the extent possible under law, the author(s) have dedicated all
     copyright and related and neighboring rights to this software to
     the public domain worldwide.  This software is distributed without
     any warranty.

     You should have received a copy of the CC0 Public Domain Dedication
     along with this software.  If not, see
     ‘https://creativecommons.org/publicdomain/zero/1.0/’.

The following people have helped with development or contributed their
changes to the project and the public domain according to the Creative
Commons Public Domain Dedication 1.0 Universal:

   * 'Alexandr Sokolovskiy'

参考
....

*note hmac: 6e. モジュール

     ハッシュを用いてメッセージ認証コードを生成するモジュールです。

*note base64: f. モジュール

     バイナリハッシュを非バイナリ環境用にエンコードするもうひとつの方法
     です。

‘https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.180-4.pdf’

     The FIPS 180-4 publication on Secure Hash Algorithms.

‘https://csrc.nist.gov/pubs/fips/202/final’

     The FIPS 202 publication on the SHA-3 Standard.

‘https://www.blake2.net/’

     BLAKE2 の公式ウェブサイト

‘https://en.wikipedia.org/wiki/Cryptographic_hash_function’

     どのアルゴリズムにどんな既知の問題があって、それが実際に利用する際
     にどう影響するかについての Wikipedia の記事。

‘https://www.ietf.org/rfc/rfc8018.txt’

     PKCS #5: Password-Based Cryptography Specification Version 2.1

‘https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf’

     NIST Recommendation for Password-Based Key Derivation.

   ---------- Footnotes ----------

   (1) https://www.blake2.net

   (2) https://en.wikipedia.org/wiki/Secure_Hash_Algorithms

   (3) 
https://web.archive.org/web/20200918190133/https://131002.net/blake/

   (4) https://cr.yp.to/chacha.html

   (5) https://pythonhosted.org/pyblake2/

   (6) https://pythonhosted.org/pyblake2/


File: python.info,  Node: hmac --- メッセージ認証のための鍵付きハッシュ化,  Next: secrets --- 機密を扱うために安全な乱数を生成する,  Prev: hashlib --- セキュアハッシュとメッセージダイジェスト,  Up: 暗号関連のサービス

5.15.2 ‘hmac’ -- メッセージ認証のための鍵付きハッシュ化
-------------------------------------------------------

'ソースコード:' Lib/hmac.py(1)

__________________________________________________________________

This module implements the HMAC algorithm as described by RFC 2104(2).
The interface allows to use any hash function with a 'fixed' digest
size.  In particular, extendable output functions such as SHAKE-128 or
SHAKE-256 cannot be used with HMAC.

 -- の関数: hmac.new (key, msg=None, digestmod)

     Return a new hmac object.  'key' is a bytes or bytearray object
     giving the secret key.  If 'msg' is present, the method call
     ‘update(msg)’ is made.  'digestmod' is the digest name, digest
     constructor or module for the HMAC object to use.  It may be any
     name suitable to *note hashlib.new(): 1d2e.  Despite its argument
     position, it is required.

     バージョン 3.4 で変更: 引数 'key' に bytes または bytearray オブジ
     ェクトを渡せるようになりました。引数 'msg' に *note hashlib: 6c. が
     サポートする全てのタイプを渡せるようになりました。引数 'digestmod'
     にハッシュアルゴリズム名を渡せるようになりました。

     バージョン 3.8 で変更: The 'digestmod' argument is now required.
     Pass it as a keyword argument to avoid awkwardness when you do not
     have an initial 'msg'.

 -- の関数: hmac.digest (key, msg, digest)

     与えられたsecret 'key' と 'digest' の 'msg' のダイジェストを返しま
     す。この関数は ‘HMAC(key, msg, digest).digest()’ に似ていますが、最
     適化されたCやインラインの実装を使用しており、メモリに収まるメッセー
     ジに対しては高速です。パラメータ 'key' 、 'msg' 、および 'digest' は
     、 *note new(): c96. と同じ意味を持ちます。

     CPython実装の詳細、最適化されたC実装は、OpenSSLがサポートするダイジ
     ェストアルゴリズムの文字列と名前が 'digest' の場合にのみ使用されま
     す。

     Added in version 3.7.

 -- クラス: hmac.HMAC

     HMAC オブジェクトは以下のメソッドを持っています:

 -- メソッド: HMAC.update (msg)

     hmac オブジェクトを 'msg' で更新します。このメソッドの呼出の繰り返
     しは、それらの引数を全て結合した引数で単一の呼び出しをした際と同じ
     になります。すなわち ‘m.update(a); m.update(b)’ は ‘m.update(a +
     b)’ と等価です。

     バージョン 3.4 で変更: 引数 'msg' は *note hashlib: 6c. がサポート
     しているあらゆる型のいずれかです。

 -- メソッド: HMAC.digest ()

     これまで *note update(): 114b. メソッドに渡されたバイト列のダイジェ
     スト値を返します。これはコンストラクタに与えられた 'digest_size' と
     同じ長さのバイト列で、 NUL バイトを含む非 ASCII 文字が含まれること
     があります。

          警告: When comparing the output of *note digest(): d32. to an
          externally supplied digest during a verification routine, it
          is recommended to use the *note compare_digest(): 12e0.
          function instead of the ‘==’ operator to reduce the
          vulnerability to timing attacks.

 -- メソッド: HMAC.hexdigest ()

     *note digest(): d32. と似ていますが、返される文字列は倍の長さとなり
     、16進形式となります。これは、電子メールなどの非バイナリ環境で値を
     交換する場合に便利です。

          警告: When comparing the output of *note hexdigest(): 2feb. to
          an externally supplied digest during a verification routine,
          it is recommended to use the *note compare_digest(): 12e0.
          function instead of the ‘==’ operator to reduce the
          vulnerability to timing attacks.

 -- メソッド: HMAC.copy ()

     hmac オブジェクトのコピー ("クローン") を返します。このコピーは最初
     の部分文字列が共通になっている文字列のダイジェスト値を効率よく計算
     するために使うことができます。

ハッシュオブジェクトには次のような属性があります:

 -- の属性: HMAC.digest_size

     生成された HMAC ダイジェストのバイト数。

 -- の属性: HMAC.block_size

     内部で使われるハッシュアルゴリズムのブロックのバイト数。

     Added in version 3.4.

 -- の属性: HMAC.name

     このHMAC の正規名で、例えば ‘hmac-md5’ のように常に小文字です。

     Added in version 3.4.

バージョン 3.10 で変更: Removed the undocumented attributes
‘HMAC.digest_cons’, ‘HMAC.inner’, and ‘HMAC.outer’.

このモジュールは以下のヘルパ関数も提供しています:

 -- の関数: hmac.compare_digest (a, b)

     ‘a == b’ を返します。この関数は、内容ベースの短絡的な振る舞いを避け
     ることによってタイミング分析を防ぐよう設計されたアプローチを用い、
     暗号化に用いるのに相応しいものとしています。 'a' と 'b' は両方が同
     じ型でなければなりません: (例えば *note HMAC.hexdigest(): 2feb. が
     返したような ASCII のみの) *note str: 169. または *note bytes-like
     object: 193. のどちらか一方。

          注釈: 'a' と 'b' が異なる長さであったりエラーが発生した場合に
          は、タイミング攻撃で理論上 'a' と 'b' の型と長さについての情報
          が暴露されますが、その値は明らかになりません。

     Added in version 3.3.

     バージョン 3.10 で変更: The function uses OpenSSL's
     ‘CRYPTO_memcmp()’ internally when available.

参考
....

*note hashlib: 6c. モジュール

     セキュアハッシュ関数を提供する Python モジュールです。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/hmac.py

   (2) https://datatracker.ietf.org/doc/html/rfc2104.html


File: python.info,  Node: secrets --- 機密を扱うために安全な乱数を生成する,  Prev: hmac --- メッセージ認証のための鍵付きハッシュ化,  Up: 暗号関連のサービス

5.15.3 ‘secrets’ -- 機密を扱うために安全な乱数を生成する
--------------------------------------------------------

Added in version 3.6.

'ソースコード:' Lib/secrets.py(1)

__________________________________________________________________

The ‘secrets’ module is used for generating cryptographically strong
random numbers suitable for managing data such as passwords, account
authentication, security tokens, and related secrets.

In particular, ‘secrets’ should be used in preference to the default
pseudo-random number generator in the *note random: bd. module, which is
designed for modelling and simulation, not security or cryptography.

参考
....

PEP 506(2)

* Menu:

* 乱数::
* トークンの生成::
* その他の関数::
* レシピとベストプラクティス::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/secrets.py

   (2) https://peps.python.org/pep-0506/


File: python.info,  Node: 乱数,  Next: トークンの生成,  Up: secrets --- 機密を扱うために安全な乱数を生成する

5.15.3.1 乱数
.............

The ‘secrets’ module provides access to the most secure source of
randomness that your operating system provides.

 -- クラス: secrets.SystemRandom

     OS が提供する最も高品質なソースを用いて乱数を生成するためのクラスで
     す。更に詳しいことについては *note random.SystemRandom: 2b57. を参
     照してください。

 -- の関数: secrets.choice (seq)

     空でないシーケンスから要素をランダムに選択して返します。

 -- の関数: secrets.randbelow (exclusive_upper_bound)

     [0, 'exclusive_upper_bound') の範囲のランダムな整数を返します。

 -- の関数: secrets.randbits (k)

     ランダムな 'k' ビットの非負の整数を返します。


File: python.info,  Node: トークンの生成,  Next: その他の関数,  Prev: 乱数,  Up: secrets --- 機密を扱うために安全な乱数を生成する

5.15.3.2 トークンの生成
.......................

The ‘secrets’ module provides functions for generating secure tokens,
suitable for applications such as password resets, hard-to-guess URLs,
and similar.

 -- の関数: secrets.token_bytes (nbytes=None)

     Return a random byte string containing 'nbytes' number of bytes.

     If 'nbytes' is not specified or ‘None’, *note DEFAULT_ENTROPY:
     2ff5. is used instead.

          >>> token_bytes(16)
          b'\xebr\x17D*t\xae\xd4\xe3S\xb6\xe2\xebP1\x8b'

 -- の関数: secrets.token_hex (nbytes=None)

     Return a random text string, in hexadecimal.  The string has
     'nbytes' random bytes, each byte converted to two hex digits.

     If 'nbytes' is not specified or ‘None’, *note DEFAULT_ENTROPY:
     2ff5. is used instead.

          >>> token_hex(16)
          'f9bf78b9a18ce6d46a0cd2b0b86df9da'

 -- の関数: secrets.token_urlsafe (nbytes=None)

     Return a random URL-safe text string, containing 'nbytes' random
     bytes.  The text is Base64 encoded, so on average each byte results
     in approximately 1.3 characters.

     If 'nbytes' is not specified or ‘None’, *note DEFAULT_ENTROPY:
     2ff5. is used instead.

          >>> token_urlsafe(16)
          'Drmhze6EPcv0fN_81Bj-nA'

* Menu:

* トークンは何バイト使うべきか？::


File: python.info,  Node: トークンは何バイト使うべきか？,  Up: トークンの生成

5.15.3.3 トークンは何バイト使うべきか？
.......................................

To be secure against brute-force attacks(1), tokens need to have
sufficient randomness.  Unfortunately, what is considered sufficient
will necessarily increase as computers get more powerful and able to
make more guesses in a shorter period.  As of 2015, it is believed that
32 bytes (256 bits) of randomness is sufficient for the typical use-case
expected for the ‘secrets’ module.

独自の長さのトークンを扱いたい場合、様々な ‘token_*’ 関数に *note int:
19b. 引数で渡すことで、トークンに使用するランダムさを明示的に指定するこ
とができます。引数はランダムさのバイト数として使用されます。

Otherwise, if no argument is provided, or if the argument is ‘None’, the
‘token_*’ functions use *note DEFAULT_ENTROPY: 2ff5. instead.

 -- データ: secrets.DEFAULT_ENTROPY

     Default number of bytes of randomness used by the ‘token_*’
     functions.

     The exact value is subject to change at any time, including during
     maintenance releases.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Brute-force_attack


File: python.info,  Node: その他の関数,  Next: レシピとベストプラクティス,  Prev: トークンの生成,  Up: secrets --- 機密を扱うために安全な乱数を生成する

5.15.3.4 その他の関数
.....................

 -- の関数: secrets.compare_digest (a, b)

     文字列または *note bytes-like オブジェクト: 193. 'a' と 'b' が等し
     ければ ‘True’ を、そうでなければ ‘False’ を返します。比較は タイミ
     ング攻撃(1) のリスクを減らす "定数時間比較" の方法で行われます。詳
     細については *note hmac.compare_digest(): 12e0. を参照してください
     。

   ---------- Footnotes ----------

   (1) https://codahale.com/a-lesson-in-timing-attacks/


File: python.info,  Node: レシピとベストプラクティス,  Prev: その他の関数,  Up: secrets --- 機密を扱うために安全な乱数を生成する

5.15.3.5 レシピとベストプラクティス
...................................

This section shows recipes and best practices for using ‘secrets’ to
manage a basic level of security.

8文字のアルファベットと数字を含むパスワードを生成するには:

     import string
     import secrets
     alphabet = string.ascii_letters + string.digits
     password = ''.join(secrets.choice(alphabet) for i in range(8))

     注釈: アプリケーションは、平文であろうと暗号化されていようと、 復元
     可能な形式でパスワードを保存(1) してはいけません。パスワードは暗号
     学的に強い一方向 (非可逆) ハッシュ関数を用いてソルトしハッシュしな
     ければなりません。

アルファべットと数字からなり、小文字を少なくとも1つと数字を少なくとも3つ
含む、10文字のパスワードを生成するには:

     import string
     import secrets
     alphabet = string.ascii_letters + string.digits
     while True:
         password = ''.join(secrets.choice(alphabet) for i in range(10))
         if (any(c.islower() for c in password)
                 and any(c.isupper() for c in password)
                 and sum(c.isdigit() for c in password) >= 3):
             break

XKCD スタイルのパスフレーズ(2) を生成するには:

     import secrets
     # On standard Linux systems, use a convenient dictionary file.
     # Other platforms may need to provide their own word-list.
     with open('/usr/share/dict/words') as f:
         words = [word.strip() for word in f]
         password = ' '.join(secrets.choice(words) for i in range(4))

パスワードの復元用途に適したセキュリティトークンを含む、推測しにくい一時
URL を生成するには:

     import secrets
     url = 'https://example.com/reset=' + secrets.token_urlsafe()

   ---------- Footnotes ----------

   (1) https://cwe.mitre.org/data/definitions/257.html

   (2) https://xkcd.com/936/


File: python.info,  Node: 汎用オペレーティングシステムサービス,  Next: コマンドラインインターフェースライブラリ,  Prev: 暗号関連のサービス,  Up: Python 標準ライブラリ

5.16 汎用オペレーティングシステムサービス
=========================================

本章に記述されたモジュールは、ファイルの取り扱いや時間計測のような (ほぼ
)すべてのオペレーティングシステムで利用可能な機能にインターフェースを提
供します。これらのインターフェースは、Unix もしくは C のインターフェース
を基に作られますが、ほとんどの他のシステムで同様に利用可能です。概要を以
下に記述します:

* Menu:

* os: os --- 雑多なオペレーティングシステムインターフェース. 雑多なオペレーティングシステムインターフェース
* io: io --- ストリームを扱うコアツール. ストリームを扱うコアツール
* time: time --- 時刻データへのアクセスと変換. 時刻データへのアクセスと変換
* logging: logging --- Python 用のログ記録手段. Python 用のログ記録手段
* logging.config: logging config --- ログ記録の環境設定. ログ記録の環境設定
* logging.handlers: logging handlers --- ログ記録ハンドラー. ログ記録ハンドラー
* platform: platform --- 実行中プラットフォームの固有情報を参照する. 実行中プラットフォームの固有情報を参照する
* errno: errno --- 標準の errno システムシンボル. 標準の errno システムシンボル
* ctypes: ctypes --- Python 用の外部関数ライブラリ. Python 用の外部関数ライブラリ


File: python.info,  Node: os --- 雑多なオペレーティングシステムインターフェース,  Next: io --- ストリームを扱うコアツール,  Up: 汎用オペレーティングシステムサービス

5.16.1 ‘os’ -- 雑多なオペレーティングシステムインターフェース
-------------------------------------------------------------

'ソースコード:' Lib/os.py(1)

__________________________________________________________________

このモジュールは、 OS 依存の機能を利用するポータブルな方法を提供します。
単純なファイルの読み書きについては、 *note open(): 316. を参照してくださ
い。パス操作については、 *note os.path: a6. モジュールを参照してください
。コマンドラインに与えられたすべてのファイルから行を読み込んでいくには、
*note fileinput: 5f. モジュールを参照してください。一時ファイルや一時デ
ィレクトリの作成については、 *note tempfile: e6. モジュールを参照してく
ださい。高水準のファイルとディレクトリの操作については、 *note shutil:
ca. モジュールを参照してください。

利用可能性に関する注意 :

   * Python の、すべての OS 依存モジュールの設計方針は、可能な限り同一の
     インターフェースで同一の機能を利用できるようにする、というものです
     。例えば、 ‘os.stat(path)’ は 'path' に関する stat 情報を、 (POSIX
     を元にした ) 同じフォーマットで返します。

   * Extensions peculiar to a particular operating system are also
     available through the ‘os’ module, but using them is of course a
     threat to portability.

   * パスやファイル名を受け付けるすべての関数は、バイト列型および文字列
     型両方のオブジェクトを受け付け、パスやファイル名を返す時は、同じ型
     のオブジェクトを返します。

   * VxWorks では、os.popen, os.fork, os.execv および os.spawn*p* はサポ
     ートされていません。

   * On WebAssembly platforms, Android and iOS, large parts of the ‘os’
     module are not available or behave differently.  APIs related to
     processes (e.g.  *note fork(): 4b5, *note execve(): 1311.) and
     resources (e.g.  *note nice(): 1319.) are not available.  Others
     like *note getuid(): 1817. and *note getpid(): 3001. are emulated
     or stubs.  WebAssembly platforms also lack support for signals
     (e.g.  *note kill(): 157f, *note wait(): f98.).

     注釈: このモジュール内のすべての関数は、間違った、あるいはアクセス
     出来ないファイル名やファイルパス、その他型が合っていても OS が受理
     しない引数に対して、 *note OSError: 2c0. (またはそのサブクラス)を送
     出します。

 -- 例外: os.error

     組み込みの *note OSError: 2c0. 例外に対するエイリアスです。

 -- データ: os.name

     import されているオペレーティングシステムに依存するモジュールの名前
     です。現在次の名前が登録されています: ‘'posix'’, ‘'nt'’, ‘'java'’。

     参考
     ....

     *note sys.platform: 291. はより細かな粒度を持っています。 *note
     os.uname(): 132e. はシステム依存のバージョン情報を提供します。

     *note platform: af. モジュールはシステムの詳細な識別情報をチェック
     する機能を提供しています。

* Menu:

* ファイル名、コマンドライン引数、および環境変数::
* Python UTF-8 Mode::
* プロセスのパラメーター::
* ファイルオブジェクトの生成::
* ファイル記述子の操作::
* ファイルとディレクトリ::
* プロセス管理::
* スケジューラーへのインターフェイス::
* 雑多なシステム情報::
* 乱数: 乱数<2>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/os.py


File: python.info,  Node: ファイル名、コマンドライン引数、および環境変数,  Next: Python UTF-8 Mode,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.16.1.1 ファイル名、コマンドライン引数、および環境変数
.......................................................

Python では、ファイル名、コマンドライン引数、および環境変数を表すのに文
字列型を使用します。一部のシステムでは、これらをオペレーティングシステム
に渡す前に、文字列からバイト列へ、またはその逆のデコードが必要です。
Python はこの変換を行うために *note filesystem encoding and error
handler: 75d. を使用します (*note sys.getfilesystemencoding(): e53. 参照
)。

term:‘ファイルシステムのエンコーディングとエラーハンドラ <filesystem
encoding and error handler>’ は、Pythonの開始時に:c:func:‘PyConfig_Read’
関数により設定されます。 *note PyConfig: 3f7. のメンバー *note
filesystem_encoding: 41b. と *note filesystem_errors: 41c. を参照してく
ださい。

バージョン 3.1 で変更: 一部のシステムでは、ファイルシステムのエンコーデ
ィングを使用して変換すると失敗する場合があります。この場合、Python は
*note surrogateescape エンコーディングエラーハンドラー: 2853. を使用しま
す。これは、デコード時にデコードできないバイト列は Unicode 文字 U+DC'xx'
に置き換えられ、それらはエンコード時に再び元のバイト列に変換されることを
意味します。

*note file system encoding: 75d. では、すべてが 128 バイト以下に正常にデ
コードされることが保証されなくてはなりません。ファイルシステムのエンコー
ディングでこれが保証されなかった場合は、API 関数が *note UnicodeError:
462. を送出します。

See also the *note locale encoding: 54a.


File: python.info,  Node: Python UTF-8 Mode,  Next: プロセスのパラメーター,  Prev: ファイル名、コマンドライン引数、および環境変数,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.16.1.2 Python UTF-8 Mode
..........................

Added in version 3.7: より詳しくは PEP 540(1) を参照してください。

The Python UTF-8 Mode ignores the *note locale encoding: 54a. and forces
the usage of the UTF-8 encoding:

   * Use UTF-8 as the *note filesystem encoding: 75d.

   * *note sys.getfilesystemencoding(): e53. returns ‘'utf-8'’.

   * *note locale.getpreferredencoding(): 75c. returns ‘'utf-8'’ (the
     'do_setlocale' argument has no effect).

   * *note sys.stdin: 75f, *note sys.stdout: ccd, and *note sys.stderr:
     b33. all use UTF-8 as their text encoding, with the
     ‘surrogateescape’ *note error handler: 1b6f. being enabled for
     *note sys.stdin: 75f. and *note sys.stdout: ccd. (*note sys.stderr:
     b33. continues to use ‘backslashreplace’ as it does in the default
     locale-aware mode)

   * On Unix, *note os.device_encoding(): 1c35. returns ‘'utf-8'’ rather
     than the device encoding.

Note that the standard stream settings in UTF-8 mode can be overridden
by *note PYTHONIOENCODING: 120c. (just as they can be in the default
locale-aware mode).

As a consequence of the changes in those lower level APIs, other higher
level APIs also exhibit different default behaviours:

   * Command line arguments, environment variables and filenames are
     decoded to text using the UTF-8 encoding.

   * *note os.fsdecode(): e4e. and *note os.fsencode(): e4f. use the
     UTF-8 encoding.

   * *note open(): 316, *note io.open(): 740, and *note codecs.open():
     315. use the UTF-8 encoding by default.  However, they still use
     the strict error handler by default so that attempting to open a
     binary file in text mode is likely to raise an exception rather
     than producing nonsense data.

The *note Python UTF-8 Mode: 866. is enabled if the LC_CTYPE locale is
‘C’ or ‘POSIX’ at Python startup (see the *note PyConfig_Read(): 993.
function).

It can be enabled or disabled using the *note -X utf8: 16f. command line
option and the *note PYTHONUTF8: ccf. environment variable.

If the *note PYTHONUTF8: ccf. environment variable is not set at all,
then the interpreter defaults to using the current locale settings,
'unless' the current locale is identified as a legacy ASCII-based locale
(as described for *note PYTHONCOERCECLOCALE: ccc.), and locale coercion
is either disabled or fails.  In such legacy locales, the interpreter
will default to enabling UTF-8 mode unless explicitly instructed not to
do so.

The Python UTF-8 Mode can only be enabled at the Python startup.  Its
value can be read from *note sys.flags.utf8_mode: 89c.

See also the *note UTF-8 mode on Windows: 221d. and the *note filesystem
encoding and error handler: 75d.

参考
....

PEP 686(2)

     Python 3.15 will make *note Python UTF-8 Mode: 866. default.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0540/

   (2) https://peps.python.org/pep-0686/


File: python.info,  Node: プロセスのパラメーター,  Next: ファイルオブジェクトの生成,  Prev: Python UTF-8 Mode,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.16.1.3 プロセスのパラメーター
...............................

これらの関数とデータアイテムは、現在のプロセスおよびユーザーに対する情報
提供および操作のための機能を提供しています。

 -- の関数: os.ctermid ()

     プロセスの制御端末に対応するファイル名を返します。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.environ

     A *note mapping: 13d3. object where keys and values are strings
     that represent the process environment.  For example,
     ‘environ['HOME']’ is the pathname of your home directory (on some
     platforms), and is equivalent to ‘getenv("HOME")’ in C.

     This mapping is captured the first time the ‘os’ module is
     imported, typically during Python startup as part of processing
     ‘site.py’.  Changes to the environment made after this time are not
     reflected in *note os.environ: 259, except for changes made by
     modifying *note os.environ: 259. directly.

     このマップ型オブジェクトは環境変数に対する変更に使うこともできます
     。 *note putenv(): 25b. はマップ型オブジェクトが修正される時に、自
     動的に呼ばれることになります。

     Unix では、キーと値に *note sys.getfilesystemencoding(): e53.、エラ
     ーハンドラーに ‘'surrogateescape'’ を使用します。異なるエンコーディ
     ングを使用したい場合は *note environb: 25a. を使用します。

     On Windows, the keys are converted to uppercase.  This also applies
     when getting, setting, or deleting an item.  For example,
     ‘environ['monty'] = 'python'’ maps the key ‘'MONTY'’ to the value
     ‘'python'’.

          注釈: *note putenv(): 25b. を直接呼び出しても *note
          os.environ: 259. の内容は変わらないので、 *note os.environ:
          259. を直接変更する方が良いです。

          注釈: FreeBSD や macOS など一部のプラットフォームでは
          ‘environ’ の値を変更するとメモリリークが発生する可能性がありま
          す。各システムのドキュメントで ‘putenv()’ の項目を参照してくだ
          さい。

     このマップ型オブジェクトからアイテムを削除することで環境変数を消す
     ことができます。 *note unsetenv(): 25c. は *note os.environ: 259. か
     らアイテムが取り除かれた時に自動的に呼ばれます。 ‘pop()’ または
     ‘clear()’ が呼ばれた時も同様です。

     参考
     ....

     The *note os.reload_environ(): 258. function.

     バージョン 3.9 で変更: 更新され PEP 584(1) の合成演算子 (‘|’) と更
     新演算子 (‘|=’) がサポートされました。

 -- データ: os.environb

     Bytes version of *note environ: 259.: a *note mapping: 13d3. object
     where both keys and values are *note bytes: 192. objects
     representing the process environment.  *note environ: 259. and
     *note environb: 25a. are synchronized (modifying *note environb:
     25a. updates *note environ: 259, and vice versa).

     *note environb: 25a. は *note supports_bytes_environ: 142e. が
     ‘True’ の場合のみ利用可能です。

     Added in version 3.2.

     バージョン 3.9 で変更: 更新され PEP 584(2) の合成演算子 (‘|’) と更
     新演算子 (‘|=’) がサポートされました。

 -- の関数: os.reload_environ ()

     The *note os.environ: 259. and *note os.environb: 25a. mappings are
     a cache of environment variables at the time that Python started.
     As such, changes to the current process environment are not
     reflected if made outside Python, or by *note os.putenv(): 25b. or
     *note os.unsetenv(): 25c.  Use ‘os.reload_environ()’ to update
     *note os.environ: 259. and *note os.environb: 25a. with any such
     changes to the current process environment.

          警告: This function is not thread-safe.  Calling it while the
          environment is being modified in another thread is an
          undefined behavior.  Reading from *note os.environ: 259. or
          *note os.environb: 25a, or calling *note os.getenv(): 3009.
          while reloading, may return an empty result.

     Added in version 3.14.

 -- の関数: os.chdir (path)

 -- の関数: os.fchdir (fd)

 -- の関数: os.getcwd ()

     これらの関数は、 *note ファイルとディレクトリ: 300a. 節で説明されて
     います。

 -- の関数: os.fsencode (filename)

     *note path-like: 5a1. な 'filename' を *note
     ファイルシステムのエンコーディングとエラーハンドラ: 75d. にエンコー
     ドします。未変更の *note bytes: 192. オブジェクトを返します。

     *note fsdecode(): e4e. はこの逆変換を行う関数です。

     Added in version 3.2.

     バージョン 3.6 で変更: *note os.PathLike: e4b. インターフェースを実
     装したオブジェクトを受け入れるようになりました。

 -- の関数: os.fsdecode (filename)

     *note path-like: 5a1. な 'filename' を *note
     ファイルシステムのエンコーディングとエラーハンドラ: 75d. からデコー
     ドします。未変更の *note str: 169. オブジェクトを返します。

     *note fsencode(): e4f. はこの逆変換を行う関数です。

     Added in version 3.2.

     バージョン 3.6 で変更: *note os.PathLike: e4b. インターフェースを実
     装したオブジェクトを受け入れるようになりました。

 -- の関数: os.fspath (path)

     path のファイルシステム表現を返します。

     もし *note str: 169. か ‘bytes:’ のオブジェクトが渡された場合は、変
     更せずにそのまま返します。さもなければ、 *note __fspath__(): e4c. が
     呼び出され、その戻り値が *note str: 169. か *note bytes: 192. のオ
     ブジェクトであれば、その値を返します。他のすべてのケースでは *note
     TypeError: 198. が送出されます。

     Added in version 3.6.

 -- クラス: os.PathLike

     ファイルシステムパスを表すオブジェクト(例: *note pathlib.PurePath:
     6cd.) 向けの *note abstract base class: 13ce. です。

     Added in version 3.6.

      -- メソッド: abstractmethod __fspath__ ()

          このオブジェクトが表現するファイルシステムパスを返します。

          このメソッドは *note str: 169. か *note bytes: 192. のオブジェ
          クトのみを返す必要があります(*note str: 169. が好まれます)。

 -- の関数: os.getenv (key, default=None)

     環境変数 'key' が存在する場合はその値を文字列として返し、存在しなけ
     れば 'default' を返します。'key' は文字列です。注意すべき点として、
     *note getenv(): 3009. は内部的に *note os.environ: 259. を使用する
     ため、*note getenv(): 3009. のマップ型オブジェクトはインポート時に
     取得されます。そのため、それ以降に環境変数が変更されても、この関数
     の値にそれが反映されない可能性があります。

     Unix では、キーと値は *note sys.getfilesystemencoding(): e53.、エラ
     ーハンドラー ‘'surrogateescape'’ でデコードされます。異なるエンコー
     ディングを使用したい場合は *note os.getenvb(): 142f. を使用します。

     *note Availability: 213f.: Unix, Windows.

 -- の関数: os.getenvb (key, default=None)

     環境変数 'key' が存在する場合はその値を bytes として返し、存在しな
     ければ 'default' を返します。'key' はbytes である必要があります。注
     意すべき点として、*note getenvb(): 142f. は内部的に *note
     os.environb: 25a. を使用するため、*note getenvb(): 142f. のマップ型
     オブジェクトはインポート時に取得されます。そのため、それ以降に環境
     変数が変更されても、この関数の値にそれが反映されない可能性がありま
     す。

     *note getenvb(): 142f. は *note supports_bytes_environ: 142e. が
     ‘True’ の場合のみ利用可能です。

     *note Availability: 213f.: Unix.

     Added in version 3.2.

 -- の関数: os.get_exec_path (env=None)

     プロセスを起動する時に名前付き実行ファイルを検索するディレクトリの
     リストを返します。 'env' が指定されると、それを環境変数の辞書とみな
     し、その辞書からキー PATH の値を探します。 デフォルトでは 'env' は
     ‘None’ であり、*note environ: 259. が使用されます。

     Added in version 3.2.

 -- の関数: os.getegid ()

     現在のプロセスの実効グループ id を返します。この id は現在のプロセ
     スで実行されているファイルの "set id" ビットに対応します。

     *note Availability: 213f.: Unix, not WASI.

 -- の関数: os.geteuid ()

     現在のプロセスの実効ユーザー id を返します。

     *note Availability: 213f.: Unix, not WASI.

 -- の関数: os.getgid ()

     現在のプロセスの実グループ id を返します。

     *note Availability: 213f.: Unix.

     The function is a stub on WASI, see *note WebAssembly
     プラットフォーム: 1b6a. for more information.

 -- の関数: os.getgrouplist (user, group, /)

     Return list of group ids that 'user' belongs to.  If 'group' is not
     in the list, it is included; typically, 'group' is specified as the
     group ID field from the password record for 'user', because that
     group ID will otherwise be potentially omitted.

     *note Availability: 213f.: Unix, not WASI.

     Added in version 3.3.

 -- の関数: os.getgroups ()

     現在のプロセスに関連付けられた従属グループ id のリストを返します。

     *note Availability: 213f.: Unix, not WASI.

          注釈: macOS では *note getgroups(): 300e. の挙動は他の Unix プ
          ラットフォームとはいくぶん異なります。 Python のインタープリタ
          が ‘10.5’ 以前の Deployment Target でビルドされている場合、
          *note getgroups(): 300e. は現在のユーザープロセスに関連付けら
          れている実効グループ id を返します。このリストはシステムで定義
          されたエントリ数 ( 通常は 16) に制限され、適切な特権があれば
          *note setgroups(): 300f. の呼び出しによって変更することができ
          ます。 ‘10.5’ より新しい Deployment Target でビルドされている
          場合、 *note getgroups(): 300e. はプロセスの実効ユーザー id に
          関連付けられたユーザーの現在のグループアクセスリストを返します
          。このグループアクセスリストは、プロセスのライフタイムで変更さ
          れる可能性があり、 *note setgroups(): 300f. の呼び出しの影響を
          受けず、長さ 16 の制限を受けません。 Deployment Target の値
          ‘MACOSX_DEPLOYMENT_TARGET’ は、 *note
          sysconfig.get_config_var(): 174. で取得することができます。

 -- の関数: os.getlogin ()

     プロセスの制御端末にログインしているユーザー名を返します。ほとんど
     の場合、*note getpass.getuser(): 65a. を使う方が便利です。なぜなら
     、*note getpass.getuser(): 65a. は、ユーザーを見つけるために、環境
     変数 ‘LOGNAME’ や ‘USERNAME’ を調べ、さらには
     ‘pwd.getpwuid(os.getuid())[0]’ まで調べに行くからです。

     *note Availability: 213f.: Unix, Windows, not WASI.

 -- の関数: os.getpgid (pid)

     プロセス id 'pid' のプロセスのプロセスグループ id を返します。
     'pid' が 0 の場合、現在のプロセスのプロセスグループ id を返します。

     *note Availability: 213f.: Unix, not WASI.

 -- の関数: os.getpgrp ()

     現在のプロセスグループの id を返します。

     *note Availability: 213f.: Unix, not WASI.

 -- の関数: os.getpid ()

     現在のプロセス id を返します。

     The function is a stub on WASI, see *note WebAssembly
     プラットフォーム: 1b6a. for more information.

 -- の関数: os.getppid ()

     親プロセスのプロセス id を返します。親プロセスが終了していた場合、
     Unix では init プロセスの id (1) が返され、Windows では親のプロセス
     id だったもの (別のプロセスで再利用されているかもしれない) がそのま
     ま返されます。

     *note Availability: 213f.: Unix, Windows, not WASI.

     バージョン 3.2 で変更: Windows サポートが追加されました。

 -- の関数: os.getpriority (which, who)

     プログラムのスケジューリング優先度を取得します。'which' の値は
     *note PRIO_PROCESS: 3012.、*note PRIO_PGRP: 3013.、あるいは *note
     PRIO_USER: 3014. のいずれか一つで、'who' の値は 'which' に応じて解
     釈されます (*note PRIO_PROCESS: 3012. であればプロセス識別子、*note
     PRIO_PGRP: 3013. であればプロセスグループ識別子、そして *note
     PRIO_USER: 3014. であればユーザー ID)。'who' の値がゼロの場合、呼び
     出したプロセス、呼び出したプロセスのプロセスグループ、および呼び出
     したプロセスの実ユーザー id を (それぞれ) 意味します。

     *note Availability: 213f.: Unix, not WASI.

     Added in version 3.3.

 -- データ: os.PRIO_PROCESS
 -- データ: os.PRIO_PGRP
 -- データ: os.PRIO_USER

     *note getpriority(): 1317. と *note setpriority(): 1318. 用のパラメ
     ータです。

     *note Availability: 213f.: Unix, not WASI.

     Added in version 3.3.

 -- データ: os.PRIO_DARWIN_THREAD
 -- データ: os.PRIO_DARWIN_PROCESS
 -- データ: os.PRIO_DARWIN_BG
 -- データ: os.PRIO_DARWIN_NONUI

     *note getpriority(): 1317. と *note setpriority(): 1318. 用のパラメ
     ータです。

     *note Availability: 213f.: macOS

     Added in version 3.12.

 -- の関数: os.getresuid ()

     現在のプロセスの実ユーザー id 、実効ユーザー id 、および保存ユーザ
     ー id を示す、 (ruid, euid, suid) のタプルを返します。

     *note Availability: 213f.: Unix, not WASI.

     Added in version 3.2.

 -- の関数: os.getresgid ()

     現在のプロセスの実グループ id 、実効グループ id 、および保存グルー
     プ id を示す、 (rgid, egid, sgid) のタプルを返します。

     *note Availability: 213f.: Unix, not WASI.

     Added in version 3.2.

 -- の関数: os.getuid ()

     現在のプロセスの実ユーザー id を返します。

     *note Availability: 213f.: Unix.

     The function is a stub on WASI, see *note WebAssembly
     プラットフォーム: 1b6a. for more information.

 -- の関数: os.initgroups (username, gid, /)

     Call the system ‘initgroups()’ to initialize the group access list
     with all of the groups of which the specified username is a member,
     plus the specified group id.

     *note Availability: 213f.: Unix, not WASI, not Android.

     Added in version 3.2.

 -- の関数: os.putenv (key, value, /)

     'key' という名前の環境変数に文字列 'value' を設定します。このような
     環境変数の変更は、*note os.system(): 1676.、*note popen(): 31a.、ま
     たは *note fork(): 4b5. と *note execv(): 3019. で起動されたサブプ
     ロセスに影響を与えます。

     *note os.environ: 259. の要素に代入すると、それは *note putenv():
     25b. の呼び出しに自動変換されます。 しかし、直接 *note putenv():
     25b. を呼び出しても *note os.environ: 259. には反映されないため、
     *note os.environ: 259. の要素に代入する方がベターです。 *note
     getenv(): 3009. と *note getenvb(): 142f. についても、実装上それぞ
     れ *note os.environ: 259. と *note os.environb: 25a. を使用するので
     、同様に注意が必要です。

     See also the *note os.reload_environ(): 258. function.

          注釈: FreeBSD や macOS など一部のプラットフォームでは
          ‘environ’ の値を変更するとメモリリークが発生する可能性がありま
          す。 各システムのドキュメントで ‘putenv()’ の項目を参照してく
          ださい。

     引数 ‘key’, ‘value’ を指定して *note 監査イベント: 1c6e.
     ‘os.putenv’ を送出します。

     バージョン 3.9 で変更: 常に利用出来るようになりました。

 -- の関数: os.setegid (egid, /)

     現在のプロセスに実効グループ id をセットします。

     *note Availability: 213f.: Unix, not WASI, not Android.

 -- の関数: os.seteuid (euid, /)

     現在のプロセスに実効ユーザー id をセットします。

     *note Availability: 213f.: Unix, not WASI, not Android.

 -- の関数: os.setgid (gid, /)

     現在のプロセスにグループ id をセットします。

     *note Availability: 213f.: Unix, not WASI, not Android.

 -- の関数: os.setgroups (groups, /)

     現在のグループに関連付けられた従属グループ id のリストを 'groups' に
     設定します。 'groups' はシーケンス型でなくてはならず、各要素はグル
     ープを特定する整数でなくてはなりません。通常、この操作はスーパユー
     ザーしか利用できません。

     *note Availability: 213f.: Unix, not WASI.

          注釈: macOS では、 'groups' の長さはシステムで定義された実効グ
          ループ id の最大数 ( 通常は 16) を超えない場合があります。
          setgroups() 呼び出しで設定されたものと同じグループリストが返さ
          れないケースについては、 *note getgroups(): 300e. のドキュメン
          トを参照してください。

 -- の関数: os.setns (fd, nstype=0)

     Reassociate the current thread with a Linux namespace.  See the
     ‘setns(2)(3)’ and ‘namespaces(7)(4)’ man pages for more details.

     If 'fd' refers to a ‘/proc/`pid'/ns/’ link, ‘setns()’ reassociates
     the calling thread with the namespace associated with that link,
     and 'nstype' may be set to one of the *note CLONE_NEW* constants:
     301d. to impose constraints on the operation (‘0’ means no
     constraints).

     Since Linux 5.8, 'fd' may refer to a PID file descriptor obtained
     from *note pidfd_open(): 6a4.  In this case, ‘setns()’ reassociates
     the calling thread into one or more of the same namespaces as the
     thread referred to by 'fd'.  This is subject to any constraints
     imposed by 'nstype', which is a bit mask combining one or more of
     the *note CLONE_NEW* constants: 301d, e.g.  ‘setns(fd,
     os.CLONE_NEWUTS | os.CLONE_NEWPID)’.  The caller's memberships in
     unspecified namespaces are left unchanged.

     'fd' can be any object with a *note fileno(): 17ad. method, or a
     raw file descriptor.

     This example reassociates the thread with the ‘init’ process's
     network namespace:

          fd = os.open("/proc/1/ns/net", os.O_RDONLY)
          os.setns(fd, os.CLONE_NEWNET)
          os.close(fd)

     *note Availability: 213f.: Linux >= 3.0 with glibc >= 2.14.

     Added in version 3.12.

     参考
     ....

     The *note unshare(): 1b42. function.

 -- の関数: os.setpgrp ()

     システムコール ‘setpgrp()’ か ‘setpgrp(0, 0)’ のどちらか(実装されて
     いるもの)を呼び出します。機能については UNIX マニュアルを参照して下
     さい。

     *note Availability: 213f.: Unix, not WASI.

 -- の関数: os.setpgid (pid, pgrp, /)

     システムコール ‘setpgid()’ を呼び出してプロセス id 'pid' のプロセス
     のプロセスグループ id を 'pgrp' に設定します。この動作に関しては
     Unix のマニュアルを参照してください。

     *note Availability: 213f.: Unix, not WASI.

 -- の関数: os.setpriority (which, who, priority)

     プログラムのスケジューリング優先度を設定します。'which' は *note
     PRIO_PROCESS: 3012.、*note PRIO_PGRP: 3013.、あるいは *note
     PRIO_USER: 3014. のいずれか一つで、'who' の値は 'which' に応じて解
     釈されます (*note PRIO_PROCESS: 3012. であればプロセス識別子、*note
     PRIO_PGRP: 3013. であればプロセスグループ識別子、そして *note
     PRIO_USER: 3014. であればユーザー ID)。'who' の値がゼロの場合、呼び
     出したプロセス、呼び出したプロセスのプロセスグループ、および呼び出
     したプロセスの実ユーザー id を (それぞれ) 意味します。'priority' は
     -20 から 19 の整数値で、デフォルトの優先度は 0 です。小さい数値ほど
     優先されるスケジューリングとなります。

     *note Availability: 213f.: Unix, not WASI.

     Added in version 3.3.

 -- の関数: os.setregid (rgid, egid, /)

     現在のプロセスの実グループ id および実効グループ id を設定します。

     *note Availability: 213f.: Unix, not WASI, not Android.

 -- の関数: os.setresgid (rgid, egid, sgid, /)

     現在のプロセスの、実グループ id 、実効グループ id 、および保存グル
     ープ id を設定します。

     *note Availability: 213f.: Unix, not WASI, not Android.

     Added in version 3.2.

 -- の関数: os.setresuid (ruid, euid, suid, /)

     現在のプロセスの実ユーザー id 、実効ユーザー id 、および保存ユーザ
     ー id を設定します。

     *note Availability: 213f.: Unix, not WASI, not Android.

     Added in version 3.2.

 -- の関数: os.setreuid (ruid, euid, /)

     現在のプロセスの実ユーザー id および実効ユーザー id を設定します。

     *note Availability: 213f.: Unix, not WASI, not Android.

 -- の関数: os.getsid (pid, /)

     ‘getsid()’ システムコールを呼び出します。機能については Unix のマニ
     ュアルを参照してください。

     *note Availability: 213f.: Unix, not WASI.

 -- の関数: os.setsid ()

     ‘setsid()’ システムコールを呼び出します。機能については Unix のマニ
     ュアルを参照してください。

     *note Availability: 213f.: Unix, not WASI.

 -- の関数: os.setuid (uid, /)

     現在のプロセスのユーザー id を設定します。

     *note Availability: 213f.: Unix, not WASI, not Android.

 -- の関数: os.strerror (code, /)

     エラーコード 'code' に対応するエラーメッセージを返します。未知のエ
     ラーコードの対して ‘strerror()’ が ‘NULL’ を返すプラットフォームで
     は、 *note ValueError: 2ec. が送出されます。

 -- データ: os.supports_bytes_environ

     環境のネイティブ OS タイプがバイト型の場合、 ‘True’ です (例:
     Windows では、 ‘False’ です)。

     Added in version 3.2.

 -- の関数: os.umask (mask, /)

     現在の数値 umask を設定し、以前の umask 値を返します。

     The function is a stub on WASI, see *note WebAssembly
     プラットフォーム: 1b6a. for more information.

 -- の関数: os.uname ()

     現在のオペレーティングシステムを識別する情報を返します。返り値は 5
     個の属性を持つオブジェクトです:

        * ‘sysname’ - OS の名前

        * ‘nodename’ - (実装時に定義された) ネットワーク上でのマシン名

        * ‘release’ - OS のリリース

        * ‘version’ - OS のバージョン

        * ‘machine’ - ハードウェア識別子

     後方互換性のため、このオブジェクトはイテラブルでもあり、‘sysname’、
     ‘nodename’、‘release’、‘version’、および ‘machine’ の 5 個の要素を
     この順序で持つタプルのように振る舞います。

     一部のシステムでは、‘nodename’ はコンポーネントを読み込むために 8 文
     字または先頭の要素だけに切り詰められます; ホスト名を取得する方法と
     しては、*note socket.gethostname(): 3026. を使う方がよいでしょう。
     あるいは ‘socket.gethostbyaddr(socket.gethostname())’ でもかまいま
     せん。

     On macOS, iOS and Android, this returns the 'kernel' name and
     version (i.e., ‘'Darwin'’ on macOS and iOS; ‘'Linux'’ on Android).
     *note platform.uname(): 1e13. can be used to get the user-facing
     operating system name and version on iOS and Android.

     *note Availability: 213f.: Unix.

     バージョン 3.3 で変更: 返り値の型が、タプルから属性名のついたタプル
     ライクオブジェクトに変更されました。

 -- の関数: os.unsetenv (key, /)

     'key' という名前の環境変数を unset (削除) します。このような環境変
     数の変更は、*note os.system(): 1676.、*note popen(): 31a.、または
     *note fork(): 4b5. と *note execv(): 3019. で起動されたサブプロセス
     に影響を与えます。

     *note os.environ: 259. のアイテムの削除を行うと、自動的に *note
     unsetenv(): 25c. の対応する呼び出しに変換されます。直接 *note
     unsetenv(): 25c. を呼び出した場合 *note os.environ: 259. は更新され
     ないため、実際には *note os.environ: 259. のアイテムを削除する方が
     望ましい操作です。

     See also the *note os.reload_environ(): 258. function.

     引数 ‘key’ を指定して *note 監査イベント: 1c6e. ‘os.unsetenv’ を送
     出します。

     バージョン 3.9 で変更: 常に関数は利用出来るようになりました。

 -- の関数: os.unshare (flags)

     Disassociate parts of the process execution context, and move them
     into a newly created namespace.  See the ‘unshare(2)(5)’ man page
     for more details.  The 'flags' argument is a bit mask, combining
     zero or more of the *note CLONE_* constants: 301d, that specifies
     which parts of the execution context should be unshared from their
     existing associations and moved to a new namespace.  If the 'flags'
     argument is ‘0’, no changes are made to the calling process's
     execution context.

     *note Availability: 213f.: Linux >= 2.6.16.

     Added in version 3.12.

     参考
     ....

     *note setns(): 1b41. 関数。

Flags to the *note unshare(): 1b42. function, if the implementation
supports them.  See ‘unshare(2)(6)’ in the Linux manual for their exact
effect and availability.

 -- データ: os.CLONE_FILES
 -- データ: os.CLONE_FS
 -- データ: os.CLONE_NEWCGROUP
 -- データ: os.CLONE_NEWIPC
 -- データ: os.CLONE_NEWNET
 -- データ: os.CLONE_NEWNS
 -- データ: os.CLONE_NEWPID
 -- データ: os.CLONE_NEWTIME
 -- データ: os.CLONE_NEWUSER
 -- データ: os.CLONE_NEWUTS
 -- データ: os.CLONE_SIGHAND
 -- データ: os.CLONE_SYSVSEM
 -- データ: os.CLONE_THREAD
 -- データ: os.CLONE_VM

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0584/

   (2) https://peps.python.org/pep-0584/

   (3) https://manpages.debian.org/setns(2)

   (4) https://manpages.debian.org/namespaces(7)

   (5) https://manpages.debian.org/unshare(2)

   (6) https://manpages.debian.org/unshare(2)


File: python.info,  Node: ファイルオブジェクトの生成,  Next: ファイル記述子の操作,  Prev: プロセスのパラメーター,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.16.1.4 ファイルオブジェクトの生成
...................................

以下の関数は新しい *note ファイルオブジェクト: 13db. を作成します。(ファ
イル記述子のオープンについては *note open(): f92. も参照してください)

 -- の関数: os.fdopen (fd, *args, **kwargs)

     ファイル記述子 'fd' に接続し、オープンしたファイルオブジェクトを返
     します。これは組み込み関数 *note open(): 316. の別名であり、同じ引
     数を受け取ります。唯一の違いは *note fdopen(): 2381. の第一引数が常
     に整数でなければならないことです。


File: python.info,  Node: ファイル記述子の操作,  Next: ファイルとディレクトリ,  Prev: ファイルオブジェクトの生成,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.16.1.5 ファイル記述子の操作
.............................

これらの関数は、ファイル記述子を使って参照されている I/O ストリームを操
作します。

ファイル記述子とは現在のプロセスで開かれたファイルに対応する小さな整数で
す。例えば、標準入力のファイル記述子は通常 0 で、標準出力は 1 、標準エラ
ーは 2 です。プロセスから開かれたその他のファイルには 3 、 4 、 5 と割り
振られていきます。「ファイル記述子」という名称は少し誤解を与えるものかも
しれません。Unix プラットフォームでは、ソケットやパイプもファイル記述子
によって参照されます。

*note fileno(): 17ad. メソッドを使用して、必要な場合に *note file
object: 13db. に関連付けられているファイル記述子を取得することができます
。ファイル記述子を直接使用すると、ファイルオブジェクトのメソッドが使用さ
れないため、データの内部バッファなどの性質は無視されることに注意してくだ
さい。

 -- の関数: os.close (fd)

     ファイル記述子 'fd' をクローズします。

          注釈: この関数は低水準の I/O 向けのもので、 *note os.open():
          f92. や *note pipe(): 1b64. が返すファイル記述子に対して使用し
          なければなりません。 組み込み関数 *note open(): 316. や *note
          popen(): 31a. 、 *note fdopen(): 2381. が返す "ファイルオブジ
          ェクト" を閉じるには、オブジェクトの *note close(): 506. メソ
          ッドを使用してください。

 -- の関数: os.closerange (fd_low, fd_high, /)

     'fd_low' 以上 'fd_high' 未満のすべてのファイル記述子をエラーを無視
     してクローズします。以下のコードと等価です:

          for fd in range(fd_low, fd_high):
              try:
                  os.close(fd)
              except OSError:
                  pass

 -- の関数: os.copy_file_range (src, dst, count, offset_src=None,
          offset_dst=None)

     Copy 'count' bytes from file descriptor 'src', starting from offset
     'offset_src', to file descriptor 'dst', starting from offset
     'offset_dst'.  If 'offset_src' is ‘None’, then 'src' is read from
     the current position; respectively for 'offset_dst'.

     In Linux kernel older than 5.3, the files pointed to by 'src' and
     'dst' must reside in the same filesystem, otherwise an *note
     OSError: 2c0. is raised with *note errno: 17b3. set to *note
     errno.EXDEV: 303a.

     This copy is done without the additional cost of transferring data
     from the kernel to user space and then back into the kernel.
     Additionally, some filesystems could implement extra optimizations,
     such as the use of reflinks (i.e., two or more inodes that share
     pointers to the same copy-on-write disk blocks; supported file
     systems include btrfs and XFS) and server-side copy (in the case of
     NFS).

     The function copies bytes between two file descriptors.  Text
     options, like the encoding and the line ending, are ignored.

     返り値はコピーされたバイトの量です。 この値は、要求した量より少なく
     なることもあります。

          注釈: On Linux, *note os.copy_file_range(): 18b4. should not
          be used for copying a range of a pseudo file from a special
          filesystem like procfs and sysfs.  It will always copy no
          bytes and return 0 as if the file was empty because of a known
          Linux kernel issue.

     *note Availability: 213f.: Linux >= 4.5 with glibc >= 2.27.

     Added in version 3.8.

 -- の関数: os.device_encoding (fd)

     'fd' に関連付けられたデバイスが端末 (ターミナル) に接続されている場
     合に、そのデバイスのエンコーディングを表す文字列を返します。端末に
     接続されていない場合、 *note None: 885. を返します。

     On Unix, if the *note Python UTF-8 Mode: 866. is enabled, return
     ‘'UTF-8'’ rather than the device encoding.

     バージョン 3.10 で変更: On Unix, the function now implements the
     Python UTF-8 Mode.

 -- の関数: os.dup (fd, /)

     ファイル記述子 'fd' の複製を返します。新しいファイル記述子は *note
     継承不可: 10fc. です。

     Windows では、標準ストリーム (0: 標準入力、1: 標準出力、2: 標準エラ
     ー出力) を複製する場合、新しいファイル記述子は *note 継承可能:
     10fc. です。

     *note Availability: 213f.: not WASI.

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

 -- の関数: os.dup2 (fd, fd2, inheritable=True)

     ファイル記述子 'fd' を 'fd2' に複製し、必要な場合には後者を先に閉じ
     ます。 'fd2' が返ります。 新しいファイル記述子はデフォルトでは
     *note 継承可能: 10fc. で、'inheritable' が ‘False’ の場合は継承不可
     です。

     *note Availability: 213f.: not WASI.

     バージョン 3.4 で変更: オプションの 'inheritable' 引数が追加されま
     した。

     バージョン 3.7 で変更: 成功したときは 'fd2' が返ります。 以前は常に
     ‘None’ が返っていました。

 -- の関数: os.fchmod (fd, mode)

     'fd' で指定されたファイルのモードを 'mode' に変更します。'mode' に
     指定できる値については、*note chmod(): 529. のドキュメントを参照し
     てください。Python 3.3 以降では ‘os.chmod(fd, mode)’ と等価です。

     引数 ‘path’, ‘mode’, ‘dir_fd’ を指定して *note 監査イベント: 1c6e.
     ‘os.chmod’ を送出します。

     *note Availability: 213f.: Unix, Windows.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1b6a. for more information.

     バージョン 3.13 で変更: Added support on Windows.

 -- の関数: os.fchown (fd, uid, gid)

     'fd' で指定されたファイルの所有者 id およびグループ id を数値 'uid'
     および 'gid' に変更します。いずれかの id を変更せずにおくにはその値
     として -1 を指定します。*note chown(): 1306. を参照してください。
     Python 3.3 以降では ‘os.chown(fd, uid, gid)’ と等価です。

     引数 ‘path’, ‘uid’, ‘gid’, ‘dir_fd’ を指定して *note 監査イベント:
     1c6e. ‘os.chown’ を送出します。

     *note Availability: 213f.: Unix.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1b6a. for more information.

 -- の関数: os.fdatasync (fd)

     ファイル記述子 'fd' を持つファイルのディスクへの書き込みを強制しま
     す。メタデータの更新は強制しません。

     *note Availability: 213f.: Unix.

          注釈: この関数は MacOS では利用できません。

 -- の関数: os.fpathconf (fd, name, /)

     開いているファイルに関連するシステム設定情報を返します。 'name' は
     取得する設定名を指定します。これは、いくつかの標準 (POSIX.1 、 Unix
     95 、 Unix 98 その他 ) で定義された定義済みのシステム値名の文字列で
     ある場合があります。プラットフォームによっては別の名前も定義されて
     います。ホストオペレーティングシステムの関知する名前は
     ‘pathconf_names’ 辞書で与えられています。このマップ型オブジェクトに
     含まれていない構成変数については、 'name' に整数を渡してもかまいま
     せん。

     'name' が不明の文字列である場合、 *note ValueError: 2ec. を送出しま
     す。 'name' の特定の値がホストシステムでサポートされていない場合、
     ‘pathconf_names’ に含まれていたとしても、 *note errno.EINVAL: 1dd2.
     をエラー番号として *note OSError: 2c0. を送出します。

     Python 3.3 以降では ‘os.pathconf(fd, name)’ と等価です。

     *note Availability: 213f.: Unix.

 -- の関数: os.fstat (fd)

     ファイル記述子 'fd' の状態を取得します。*note stat_result: 16da. オ
     ブジェクトを返します。

     Python 3.3 以降では ‘os.stat(fd)’ と等価です。

     参考
     ....

     *note stat(): 26d. 関数。

 -- の関数: os.fstatvfs (fd, /)

     *note statvfs(): 1314. と同様に、ファイル記述子 'fd' に関連付けられ
     たファイルが格納されているファイルシステムに関する情報を返します。
     Python 3.3 以降では ‘os.statvfs(fd)’ と等価です。

     *note Availability: 213f.: Unix.

 -- の関数: os.fsync (fd)

     ファイル記述子 'fd' を持つファイルのディスクへの書き込みを強制しま
     す。 Unix では、ネイティブの ‘fsync()’ 関数を、 Windows では
     ‘_commit()’ 関数を呼び出します。

     Python の *note ファイルオブジェクト: 13db. 'f' を使う場合、'f' の
     内部バッファを確実にディスクに書き込むために、まず ‘f.flush()’ を、
     その後 ‘os.fsync(f.fileno())’ を実行してください。

     *note Availability: 213f.: Unix, Windows.

 -- の関数: os.ftruncate (fd, length, /)

     ファイル記述子 'fd' に対応するファイルを、サイズが最長で 'length' バ
     イトになるように切り詰めます。Python 3.3 以降では ‘os.truncate(fd,
     length)’ と等価です。

     引数 ‘fd’, ‘length’ を指定して *note 監査イベント: 1c6e.
     ‘os.truncate’ を送出します。

     *note Availability: 213f.: Unix, Windows.

     バージョン 3.5 で変更: Windows サポートを追加しました。

 -- の関数: os.get_blocking (fd, /)

     記述子のブロッキングモードを取得します。 *note O_NONBLOCK: 103b. フ
     ラグが設定されている場合は ‘False’ で、フラグがクリアされている場合
     は ‘True’ です。

     *note set_blocking(): 103a. および *note
     socket.socket.setblocking(): 303c. も参照してください。

     *note Availability: 213f.: Unix, Windows.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1b6a. for more information.

     On Windows, this function is limited to pipes.

     Added in version 3.5.

     バージョン 3.12 で変更: Added support for pipes on Windows.

 -- の関数: os.grantpt (fd, /)

     Grant access to the slave pseudo-terminal device associated with
     the master pseudo-terminal device to which the file descriptor 'fd'
     refers.  The file descriptor 'fd' is not closed upon failure.

     Calls the C standard library function ‘grantpt()’.

     *note Availability: 213f.: Unix, not WASI.

     Added in version 3.13.

 -- の関数: os.isatty (fd, /)

     ファイル記述子 'fd' がオープンされていて、 tty (のような) デバイス
     に接続されている場合、 ‘True’ を返します。そうでない場合は ‘False’
     を返します。

 -- の関数: os.lockf (fd, cmd, len, /)

     オープンされたファイル記述子に対して、POSIX ロックの適用、テスト、
     解除を行います。'fd' はオープンされたファイル記述子です。'cmd' には
     使用するコマンド (*note F_LOCK: 303d.、*note F_TLOCK: 303e.、*note
     F_ULOCK: 303f.、あるいは *note F_TEST: 3040. のいずれか一つ) を指定
     します。'len' にはロックするファイルのセクションを指定します。

     引数 ‘fd’, ‘cmd’, ‘len’ を指定して *note 監査イベント: 1c6e.
     ‘os.lockf’ を送出します。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

 -- データ: os.F_LOCK
 -- データ: os.F_TLOCK
 -- データ: os.F_ULOCK
 -- データ: os.F_TEST

     *note lockf(): 132b. がとる動作を指定するフラグです。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

 -- の関数: os.login_tty (fd, /)

     Prepare the tty of which fd is a file descriptor for a new login
     session.  Make the calling process a session leader; make the tty
     the controlling tty, the stdin, the stdout, and the stderr of the
     calling process; close fd.

     *note Availability: 213f.: Unix, not WASI.

     Added in version 3.11.

 -- の関数: os.lseek (fd, pos, whence, /)

     Set the current position of file descriptor 'fd' to position 'pos',
     modified by 'whence', and return the new position in bytes relative
     to the start of the file.  Valid values for 'whence' are:

        * *note SEEK_SET: 14a5. or ‘0’ - set 'pos' relative to the
          beginning of the file

        * *note SEEK_CUR: 14a6. or ‘1’ - set 'pos' relative to the
          current file position

        * *note SEEK_END: 14a7. or ‘2’ - set 'pos' relative to the end
          of the file

        * *note SEEK_HOLE: 3041. - set 'pos' to the next data location,
          relative to 'pos'

        * *note SEEK_DATA: 3042. - set 'pos' to the next data hole,
          relative to 'pos'

     バージョン 3.3 で変更: Add support for ‘SEEK_HOLE’ and ‘SEEK_DATA’.

 -- データ: os.SEEK_SET
 -- データ: os.SEEK_CUR
 -- データ: os.SEEK_END

     Parameters to the *note lseek(): 132f. function and the *note
     seek(): 14a4. method on *note file-like objects: 13db, for whence
     to adjust the file position indicator.

     *note SEEK_SET: 14a5.

          Adjust the file position relative to the beginning of the
          file.

     *note SEEK_CUR: 14a6.

          Adjust the file position relative to the current file
          position.

     *note SEEK_END: 14a7.

          Adjust the file position relative to the end of the file.

     Their values are 0, 1, and 2, respectively.

 -- データ: os.SEEK_HOLE
 -- データ: os.SEEK_DATA

     Parameters to the *note lseek(): 132f. function and the *note
     seek(): 14a4. method on *note file-like objects: 13db, for seeking
     file data and holes on sparsely allocated files.

     ‘SEEK_DATA’

          Adjust the file offset to the next location containing data,
          relative to the seek position.

     ‘SEEK_HOLE’

          Adjust the file offset to the next location containing a hole,
          relative to the seek position.  A hole is defined as a
          sequence of zeros.

          注釈: These operations only make sense for filesystems that
          support them.

     *note Availability: 213f.: Linux >= 3.1, macOS, Unix

     Added in version 3.3.

 -- の関数: os.open (path, flags, mode=0o777, *, dir_fd=None)

     ファイル 'path' を開き、'flag' に従って様々なフラグを設定し、可能な
     ら 'mode' に従ってファイルモードを設定します。'mode' を計算する際、
     まず現在の umask 値でマスクされます。新たに開いたファイルのファイル
     記述子を返します。新しいファイル記述子は *note 継承不可: 10fc. です
     。

     For a description of the flag and mode values, see the C run-time
     documentation; flag constants (like *note O_RDONLY: 3043. and *note
     O_WRONLY: 3044.) are defined in the ‘os’ module.  In particular, on
     Windows adding *note O_BINARY: 3045. is needed to open files in
     binary mode.

     この関数は 'dir_fd' パラメタで *note
     ディレクトリ記述子への相対パス: 1302. をサポートしています。

     引数 ‘path’, ‘mode’, ‘flags’ を指定して *note 監査イベント: 1c6e.
     ‘open’ を送出します。

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

          注釈: この関数は低水準の I/O 向けのものです。 通常の利用では、
          組み込み関数 *note open(): 316. を使用してください。 *note
          open(): 316. は ‘read()’ や ‘write()’ (そしてさらに多くの) メ
          ソッドを持つ *note ファイルオブジェクト: 13db. を返します。 フ
          ァイル記述子をファイルオブジェクトでラップするには *note
          fdopen(): 2381. を使用してください。

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、この関数は *note InterruptedError: f88. 例
     外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(1) を参照してください)。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

以下の定数は *note open(): f92. 関数の 'flags' 引数に利用します。これら
の定数は、ビット単位に OR 演算子 ‘|’ で組み合わせることができます。一部
、すべてのプラットフォームでは使用できない定数があります。利用可能かどう
かや使い方については、Unix では ‘open(2)(2)’、Windows では MSDN(3) を参
照してください。

 -- データ: os.O_RDONLY
 -- データ: os.O_WRONLY
 -- データ: os.O_RDWR
 -- データ: os.O_APPEND
 -- データ: os.O_CREAT
 -- データ: os.O_EXCL
 -- データ: os.O_TRUNC

     上記の定数は Unix および Windows で利用可能です。

 -- データ: os.O_DSYNC
 -- データ: os.O_RSYNC
 -- データ: os.O_SYNC
 -- データ: os.O_NDELAY
 -- データ: os.O_NONBLOCK
 -- データ: os.O_NOCTTY
 -- データ: os.O_CLOEXEC

     上記の定数は Unix でのみ利用可能です。

     バージョン 3.3 で変更: 定数 *note O_CLOEXEC: 1288. が追加されました
     。

 -- データ: os.O_BINARY
 -- データ: os.O_NOINHERIT
 -- データ: os.O_SHORT_LIVED
 -- データ: os.O_TEMPORARY
 -- データ: os.O_RANDOM
 -- データ: os.O_SEQUENTIAL
 -- データ: os.O_TEXT

     上記の定数は Windows でのみ利用可能です。

 -- データ: os.O_EVTONLY
 -- データ: os.O_FSYNC
 -- データ: os.O_SYMLINK
 -- データ: os.O_NOFOLLOW_ANY

     上記の定数は macOS でのみ利用可能です。

     バージョン 3.10 で変更: Add *note O_EVTONLY: a1b, *note O_FSYNC:
     a1c, *note O_SYMLINK: a1d. and *note O_NOFOLLOW_ANY: a1e.
     constants.

 -- データ: os.O_ASYNC
 -- データ: os.O_DIRECT
 -- データ: os.O_DIRECTORY
 -- データ: os.O_NOFOLLOW
 -- データ: os.O_NOATIME
 -- データ: os.O_PATH
 -- データ: os.O_TMPFILE
 -- データ: os.O_SHLOCK
 -- データ: os.O_EXLOCK

     上記の定数は拡張仕様であり、Cライブラリで定義されていない場合は利用
     できません。

     バージョン 3.4 で変更: *note O_PATH: 1174. を、それをサポートするシ
     ステムで追加しました。また、 *note O_TMPFILE: 1175. を追加しました
     (Linux Kernel 3.11 以降でのみ利用可能です)。

 -- の関数: os.openpty ()

     新しい擬似端末のペアを開きます。pty および tty を表すファイル記述子
     のペア ‘(master, slave)’ を返します。新しいファイル記述子は *note
     継承不可: 10fc. です。(若干) 可搬性の高いアプローチには *note pty:
     b6. を使用してください。

     *note Availability: 213f.: Unix, not WASI.

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

 -- の関数: os.pipe ()

     パイプを作成します。読み込み、書き込みに使うことの出来るファイル記
     述子のペア ‘(r, w)’ を返します。新しいファイル記述子は *note
     継承不可: 10fc. です。

     *note Availability: 213f.: Unix, Windows.

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

 -- の関数: os.pipe2 (flags, /)

     'flags' を設定したパイプをアトミックに作成します。'flags' には値
     *note O_NONBLOCK: 103b. と *note O_CLOEXEC: 1288. を一つ以上論理和
     指定できます。読み込み、書き込みに使うことの出来るファイル記述子の
     ペア ‘(r, w)’ を返します。

     *note Availability: 213f.: Unix, not WASI.

     Added in version 3.3.

 -- の関数: os.posix_fallocate (fd, offset, len, /)

     'fd' で指定されたファイルに対し、開始位置 'offset' から 'len' バイ
     ト分割り当てるに十分なディスクスペースを確保します。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

 -- の関数: os.posix_fadvise (fd, offset, len, advice, /)

     データへアクセスする意思を、パターンを指定して宣言します。これによ
     りカーネルが最適化を行えるようになります。'advice' は 'fd' で指定さ
     れたファイルに対し、開始位置 'offset' から 'len' バイト分の領域に適
     用されます。'advice' には *note POSIX_FADV_NORMAL: 305b.、*note
     POSIX_FADV_SEQUENTIAL: 305c.、*note POSIX_FADV_RANDOM: 305d.、*note
     POSIX_FADV_NOREUSE: 305e.、*note POSIX_FADV_WILLNEED: 305f.、または
     *note POSIX_FADV_DONTNEED: 3060. のいずれか一つを指定します。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

 -- データ: os.POSIX_FADV_NORMAL
 -- データ: os.POSIX_FADV_SEQUENTIAL
 -- データ: os.POSIX_FADV_RANDOM
 -- データ: os.POSIX_FADV_NOREUSE
 -- データ: os.POSIX_FADV_WILLNEED
 -- データ: os.POSIX_FADV_DONTNEED

     *note posix_fadvise(): f93. において、使われるであろうアクセスパタ
     ーンを指定する 'advice' に使用できるフラグです。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

 -- の関数: os.pread (fd, n, offset, /)

     ファイル記述子の位置 'offset' から最大で 'n' バイトを読み出します。
     ファイルオフセットは変化しません。

     読み込んだバイト分のバイト列を返します。 'fd' が参照しているファイ
     ルの終端に達した場合、空のバイト列が返されます。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

 -- の関数: os.posix_openpt (oflag, /)

     Open and return a file descriptor for a master pseudo-terminal
     device.

     Calls the C standard library function ‘posix_openpt()’.  The
     'oflag' argument is used to set file status flags and file access
     modes as specified in the manual page of ‘posix_openpt()’ of your
     system.

     The returned file descriptor is *note non-inheritable: 10fc.  If
     the value *note O_CLOEXEC: 1288. is available on the system, it is
     added to 'oflag'.

     *note Availability: 213f.: Unix, not WASI.

     Added in version 3.13.

 -- の関数: os.preadv (fd, buffers, offset, flags=0, /)

     ファイル記述子 'fd' の 'offset' の位置から、可変な *note bytes-like
     オブジェクト: 193. 'buffers' にオフセットを変更せずに読み込みます。
     データをそれぞれのバッファがいっぱいになるまで移し、いっぱいになっ
     たらシーケンスの次のバッファに処理を移し、残りのデータを読み込ませ
     ます。

     flags 引数にはゼロあるいは次のフラグのバイトごとの OR を取った結果
     が保持されています。

        - *note RWF_HIPRI: 3061.

        - *note RWF_NOWAIT: 3062.

     実際に読み込んだ合計バイト数を返します。この値は、すべてのオブジェ
     クトの容量の総量よりも小さくなることがあります。

     オペレーティングシステムは、使用可能なバッファの個数に基づいて上限
     (*note sysconf(): 18ed. の ‘'SC_IOV_MAX'’ の値) を設定することがあ
     ります。

     *note os.readv(): d55. と *note os.pread(): d56. の機能を統合します
     。

     *note Availability: 213f.: Linux >= 2.6.30, FreeBSD >= 6.0, OpenBSD
     >= 2.7, AIX >= 7.1.

     Using flags requires Linux >= 4.6.

     Added in version 3.7.

 -- データ: os.RWF_NOWAIT

     即座に利用できないデータを待ちません。このフラグを指定すると、バッ
     クエンドのストレージからデータを読む必要があるか、ロックを待機する
     場合、システムコールは即座にリターンします。

     If some data was successfully read, it will return the number of
     bytes read.  If no bytes were read, it will return ‘-1’ and set
     errno to *note errno.EAGAIN: 26fd.

     *note Availability: 213f.: Linux >= 4.14.

     Added in version 3.7.

 -- データ: os.RWF_HIPRI

     優先度の高い読み込み・書き込み (read/write) フラグです。ブロックス
     トレージに対して、追加のリソースを必要とする一方で低レイテンシなデ
     バイスのポーリングを使うことを許可します。

     現状、Linuxでは、ファイル記述子を *note O_DIRECT: 3056. フラグを指
     定したオープンした場合でのみ、この機能を利用できます。

     *note Availability: 213f.: Linux >= 4.6.

     Added in version 3.7.

 -- の関数: os.ptsname (fd, /)

     Return the name of the slave pseudo-terminal device associated with
     the master pseudo-terminal device to which the file descriptor 'fd'
     refers.  The file descriptor 'fd' is not closed upon failure.

     Calls the reentrant C standard library function ‘ptsname_r()’ if it
     is available; otherwise, the C standard library function
     ‘ptsname()’, which is not guaranteed to be thread-safe, is called.

     *note Availability: 213f.: Unix, not WASI.

     Added in version 3.13.

 -- の関数: os.pwrite (fd, str, offset, /)

     'str' 中のバイト文字列をファイル記述子 'fd' の 'offset' の位置に書
     き込みます。ファイルオフセットを変化しません。

     実際に書き込まれたバイト数を返します。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

 -- の関数: os.pwritev (fd, buffers, offset, flags=0, /)

     Write the 'buffers' contents to file descriptor 'fd' at an offset
     'offset', leaving the file offset unchanged.  'buffers' must be a
     sequence of *note bytes-like objects: 193.  Buffers are processed
     in array order.  Entire contents of the first buffer is written
     before proceeding to the second, and so on.

     flags 引数にはゼロあるいは次のフラグのバイトごとの OR を取った結果
     が保持されています。

        - *note RWF_DSYNC: 3063.

        - *note RWF_SYNC: 3064.

        - *note RWF_APPEND: 1d2d.

     実際に書き込まれた合計バイト数を返します。

     オペレーティングシステムは、使用可能なバッファの個数に基づいて上限
     (*note sysconf(): 18ed. の ‘'SC_IOV_MAX'’ の値) を設定することがあ
     ります。

     *note os.writev(): d58. と *note os.pwrite(): d59. の機能を統合しま
     す。

     *note Availability: 213f.: Linux >= 2.6.30, FreeBSD >= 6.0, OpenBSD
     >= 2.7, AIX >= 7.1.

     Using flags requires Linux >= 4.6.

     Added in version 3.7.

 -- データ: os.RWF_DSYNC

     書き込みごとに *note os.open(): f92. の *note O_DSYNC: 304a. と同等
     の効果を提供するフラグです。このフラグはシステムコールによって書き
     込まれたデータ範囲に対してのみ適用されます。

     *note Availability: 213f.: Linux >= 4.7.

     Added in version 3.7.

 -- データ: os.RWF_SYNC

     書き込みごとに *note os.open(): f92. の *note O_SYNC: 304c. と同等
     の効果を提供するフラグです。このフラグはシステムコールによって書き
     込まれたデータ範囲に対してのみ適用されます。

     *note Availability: 213f.: Linux >= 4.7.

     Added in version 3.7.

 -- データ: os.RWF_APPEND

     Provide a per-write equivalent of the *note O_APPEND: 3047. *note
     os.open(): f92. flag.  This flag is meaningful only for *note
     os.pwritev(): d57, and its effect applies only to the data range
     written by the system call.  The 'offset' argument does not affect
     the write operation; the data is always appended to the end of the
     file.  However, if the 'offset' argument is ‘-1’, the current file
     'offset' is updated.

     *note Availability: 213f.: Linux >= 4.16.

     Added in version 3.10.

 -- の関数: os.read (fd, n, /)

     ファイル記述子 'fd' から 最大 'n' バイトを読み込みます。

     読み込んだバイト分のバイト列を返します。 'fd' が参照しているファイ
     ルの終端に達した場合、空のバイト列が返されます。

          注釈: この関数は低水準の I/O 向けのもので、 *note os.open():
          f92. や *note pipe(): 1b64. が返すファイル記述子に対して使用さ
          れなければなりません。 組み込み関数 *note open(): 316. や
          *note popen(): 31a. 、 *note fdopen(): 2381. 、あるいは *note
          sys.stdin: 75f. が返す "ファイルオブジェクト" を読み込むには、
          オブジェクトの ‘read()’ か ‘readline()’ メソッドを使用してくだ
          さい。

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、この関数は *note InterruptedError: f88. 例
     外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(4) を参照してください)。

 -- の関数: os.readinto (fd, buffer, /)

     Read from a file descriptor 'fd' into a mutable *note buffer
     object: 260. 'buffer'.

     The 'buffer' should be mutable and *note bytes-like: 193.  On
     success, returns the number of bytes read.  Less bytes may be read
     than the size of the buffer.  The underlying system call will be
     retried when interrupted by a signal, unless the signal handler
     raises an exception.  Other errors will not be retried and an error
     will be raised.

     Returns 0 if 'fd' is at end of file or if the provided 'buffer' has
     length 0 (which can be used to check for errors without reading
     data).  Never returns negative.

          注釈: This function is intended for low-level I/O and must be
          applied to a file descriptor as returned by *note os.open():
          f92. or *note os.pipe(): 1b64.  To read a "file object"
          returned by the built-in function *note open(): 316, or *note
          sys.stdin: 75f, use its member functions, for example *note
          io.BufferedIOBase.readinto(): 1895, *note
          io.BufferedIOBase.read(): 1540, or *note io.TextIOBase.read():
          206c.

     Added in version 3.14.

 -- の関数: os.sendfile (out_fd, in_fd, offset, count)

 -- の関数: os.sendfile (out_fd, in_fd, offset, count, headers=(),
          trailers=(), flags=0)

     ファイル記述子 'in_fd' からファイル記述子 'out_fd' への開始位置
     'offset' へ 'count' バイトコピーします。 送信バイト数を返します。
     EOF に達した場合は ‘0’ を返します。

     前者の関数表記は *note sendfile(): d05. が定義されているすべてのプ
     ラットフォームでサポートされています。

     Linux では、'offset' に ‘None’ が与えられると、バイト列は 'in_fd' の
     現在の位置から読み込まれ、'in_fd' の位置は更新されます。

     後者は macOS および FreeBSD で使用される場合があります。'headers' お
     よび 'trailers' は任意のバッファのシーケンス型オブジェクトで、
     'in_fd' からのデータが書き出される前と後に書き出されます。返り値は
     前者と同じです。

     macOS と FreeBSD では、'count' の値に ‘0’ を指定すると、 'in_fd' の
     末尾に達するまで送信します。

     全てのプラットフォームはソケットをファイル記述子 'out_fd' としてサ
     ポートし、あるプラットフォームは他の種類 (例えば、通常のファイル、
     パイプ) も同様にサポートします。

     クロスプラットフォームのアプリケーションは 'headers'、'trailers' な
     らびに 'flags' 引数を使用するべきではありません。

     *note Availability: 213f.: Unix, not WASI.

          注釈: *note sendfile(): d05. のより高水準のラッパについては
          *note socket.socket.sendfile(): 105d. を参照してください。

     Added in version 3.3.

     バージョン 3.9 で変更: 引数 'out' と 'in' は 'out_fd' と 'in_fd' に
     名前が変更されました。

 -- データ: os.SF_NODISKIO
 -- データ: os.SF_MNOWAIT
 -- データ: os.SF_SYNC

     実装がサポートしている場合 *note sendfile(): d05. 関数に渡すパラメ
     ーターです。

     *note Availability: 213f.: Unix, not WASI.

     Added in version 3.3.

 -- データ: os.SF_NOCACHE

     Parameter to the *note sendfile(): d05. function, if the
     implementation supports it.  The data won't be cached in the
     virtual memory and will be freed afterwards.

     *note Availability: 213f.: Unix, not WASI.

     Added in version 3.11.

 -- の関数: os.set_blocking (fd, blocking, /)

     指定されたファイル記述子のブロッキングモードを設定します。 ブロッキ
     ングが ‘False’ の場合 *note O_NONBLOCK: 103b. フラグを設定し、そう
     でない場合はクリアします。

     *note get_blocking(): 1039. および *note
     socket.socket.setblocking(): 303c. も参照してください。

     *note Availability: 213f.: Unix, Windows.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1b6a. for more information.

     On Windows, this function is limited to pipes.

     Added in version 3.5.

     バージョン 3.12 で変更: Added support for pipes on Windows.

 -- の関数: os.splice (src, dst, count, offset_src=None,
          offset_dst=None, flags=0)

     Transfer 'count' bytes from file descriptor 'src', starting from
     offset 'offset_src', to file descriptor 'dst', starting from offset
     'offset_dst'.

     The splicing behaviour can be modified by specifying a 'flags'
     value.  Any of the following variables may used, combined using
     bitwise OR (the ‘|’ operator):

        * If *note SPLICE_F_MOVE: 3069. is specified, the kernel is
          asked to move pages instead of copying, but pages may still be
          copied if the kernel cannot move the pages from the pipe.

        * If *note SPLICE_F_NONBLOCK: 306a. is specified, the kernel is
          asked to not block on I/O. This makes the splice pipe
          operations nonblocking, but splice may nevertheless block
          because the spliced file descriptors may block.

        * If *note SPLICE_F_MORE: 306b. is specified, it hints to the
          kernel that more data will be coming in a subsequent splice.

     At least one of the file descriptors must refer to a pipe.  If
     'offset_src' is ‘None’, then 'src' is read from the current
     position; respectively for 'offset_dst'.  The offset associated to
     the file descriptor that refers to a pipe must be ‘None’.  The
     files pointed to by 'src' and 'dst' must reside in the same
     filesystem, otherwise an *note OSError: 2c0. is raised with *note
     errno: 17b3. set to *note errno.EXDEV: 303a.

     このコピーは、カーネルからユーザースペースにデータを転送した後カー
     ネルに戻すという追加のコスト無しに完了します。 加えて、追加の最適化
     ができるファイルシステムもあります。 このコピーはファイルが両方とも
     バイナリファイルとして開かれたかのように行われます。

     Upon successful completion, returns the number of bytes spliced to
     or from the pipe.  A return value of 0 means end of input.  If
     'src' refers to a pipe, then this means that there was no data to
     transfer, and it would not make sense to block because there are no
     writers connected to the write end of the pipe.

     参考
     ....

     The ‘splice(2)(5)’ man page.

     *note Availability: 213f.: Linux >= 2.6.17 with glibc >= 2.5

     Added in version 3.10.

 -- データ: os.SPLICE_F_MOVE
 -- データ: os.SPLICE_F_NONBLOCK
 -- データ: os.SPLICE_F_MORE

     Added in version 3.10.

 -- の関数: os.readv (fd, buffers, /)

     Read from a file descriptor 'fd' into a number of mutable *note
     bytes-like objects: 193. 'buffers'.  Transfer data into each buffer
     until it is full and then move on to the next buffer in the
     sequence to hold the rest of the data.

     実際に読み込んだ合計バイト数を返します。この値は、すべてのオブジェ
     クトの容量の総量よりも小さくなることがあります。

     オペレーティングシステムは、使用可能なバッファの個数に基づいて上限
     (*note sysconf(): 18ed. の ‘'SC_IOV_MAX'’ の値) を設定することがあ
     ります。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

 -- の関数: os.tcgetpgrp (fd, /)

     'fd' (*note os.open(): f92. が返すオープンしたファイル記述子 ) で与
     えられる端末に関連付けられたプロセスグループを返します。

     *note Availability: 213f.: Unix, not WASI.

 -- の関数: os.tcsetpgrp (fd, pg, /)

     'fd' (*note os.open(): f92. が返すオープンしたファイル記述子 ) で与
     えられる端末に関連付けられたプロセスグループを 'pg' に設定します。

     *note Availability: 213f.: Unix, not WASI.

 -- の関数: os.ttyname (fd, /)

     ファイル記述子 'fd' に関連付けられている端末デバイスを特定する文字
     列を返します。 'fd' が端末に関連付けられていない場合、例外が送出さ
     れます。

     *note Availability: 213f.: Unix.

 -- の関数: os.unlockpt (fd, /)

     Unlock the slave pseudo-terminal device associated with the master
     pseudo-terminal device to which the file descriptor 'fd' refers.
     The file descriptor 'fd' is not closed upon failure.

     Calls the C standard library function ‘unlockpt()’.

     *note Availability: 213f.: Unix, not WASI.

     Added in version 3.13.

 -- の関数: os.write (fd, str, /)

     'str' のバイト列をファイル記述子 'fd' に書き出します。

     実際に書き込まれたバイト数を返します。

          注釈: この関数は低水準の I/O 向けのもので、 *note os.open():
          f92. や *note pipe(): 1b64. が返すファイル記述子に対して使用し
          なければなりません。 組み込み関数 *note open(): 316. や *note
          popen(): 31a. 、 *note fdopen(): 2381. 、あるいは *note
          sys.stdout: ccd. や *note sys.stderr: b33. が返す "ファイルオ
          ブジェクト" に書き込むには、オブジェクトの ‘write()’ メソッド
          を使用してください。

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、この関数は *note InterruptedError: f88. 例
     外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(6) を参照してください)。

 -- の関数: os.writev (fd, buffers, /)

     'buffers' の内容をファイル記述子 'fd' へ書き出します。 'buffers' は
     *note bytes-like オブジェクト: 193. のシーケンスでなければなりませ
     ん。バッファは配列の順番で処理されます。最初のバッファの内容全体は
     2 番目のバッファに進む前に書き込まれ、その次も同様です。

     実際に書き込まれた合計バイト数を返します。

     オペレーティングシステムは、使用可能なバッファの個数に基づいて上限
     (*note sysconf(): 18ed. の ‘'SC_IOV_MAX'’ の値) を設定することがあ
     ります。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

* Menu:

* ターミナルのサイズの問い合わせ::
* ファイル記述子の継承::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/

   (2) https://manpages.debian.org/open(2)

   (3) https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx

   (4) https://peps.python.org/pep-0475/

   (5) https://manpages.debian.org/splice(2)

   (6) https://peps.python.org/pep-0475/


File: python.info,  Node: ターミナルのサイズの問い合わせ,  Next: ファイル記述子の継承,  Up: ファイル記述子の操作

5.16.1.6 ターミナルのサイズの問い合わせ
.......................................

Added in version 3.3.

 -- の関数: os.get_terminal_size (fd=STDOUT_FILENO, /)

     ターミナル (端末) のサイズ ‘(columns, lines)’ を、*note
     terminal_size: 2cfc. 型のタプルで返します。

     オプションの引数 ‘fd’ には問い合わせるファイル記述子を指定します (デ
     フォルトは ‘STDOUT_FILENO’、または標準出力)。

     ファイル記述子が接続されていなかった場合、 *note OSError: 2c0. が送
     出されます。

     通常は高水準関数である *note shutil.get_terminal_size(): 131b. を使
     用してください。‘os.get_terminal_size’ は低水準の実装です。

     *note Availability: 213f.: Unix, Windows.

 -- クラス: os.terminal_size

     ターミナルウィンドウのサイズ ‘(columns, lines)’ を保持するタプルの
     サブクラスです。

      -- の属性: columns

          ターミナルウィンドウの横幅 (文字数) です。

      -- の属性: lines

          ターミナルウィンドウの高さ (文字数) です。


File: python.info,  Node: ファイル記述子の継承,  Prev: ターミナルのサイズの問い合わせ,  Up: ファイル記述子の操作

5.16.1.7 ファイル記述子の継承
.............................

Added in version 3.4.

ファイル記述子には「継承可能 (inheritable)」フラグというものがあって、こ
れにより子プロセスにファイル記述子が引き継がれるかどうかが決定されます。
Python 3.4 より、 Python によって作成されるファイル記述子はデフォルトで
継承不可 (non-inheritable) となりました。

On UNIX, non-inheritable file descriptors are closed in child processes
at the execution of a new program, other file descriptors are inherited.
Note that non-inheritable file descriptors are still 'inherited' by
child processes on *note os.fork(): 4b5.

Windows の場合は、標準ストリームを除き、継承不可のハンドルと継承不可のフ
ァイル記述子は子プロセスでクローズされます。標準ストリーム (ファイル記述
子の 0, 1, 2: 標準入力, 標準出力, 標準エラー出力) は常に引き継がれます。
*note spawn*: 31b. 関数を使う場合、全ての継承可能なハンドルと全ての継承
可能なファイル記述子は引き継がれます。 *note subprocess: dc. モジュール
を使う場合、標準ストリームを除く全てのファイル記述子はクローズされ、継承
可能なハンドルは 'close_fds' 引数が ‘False’ の場合にのみ引き継がれます。

On WebAssembly platforms, the file descriptor cannot be modified.

 -- の関数: os.get_inheritable (fd, /)

     指定したファイル記述子の「継承可能 (inheritable)」フラグを取得しま
     す (boolean)。

 -- の関数: os.set_inheritable (fd, inheritable, /)

     指定したファイル記述子の「継承可能 (inheritable)」フラグをセットし
     ます。

 -- の関数: os.get_handle_inheritable (handle, /)

     指定したハンドルの「継承可能 (inheritable)」フラグを取得します
     (boolean)。

     *note Availability: 213f.: Windows.

 -- の関数: os.set_handle_inheritable (handle, inheritable, /)

     指定したハンドルの「継承可能 (inheritable)」フラグをセットします。

     *note Availability: 213f.: Windows.


File: python.info,  Node: ファイルとディレクトリ,  Next: プロセス管理,  Prev: ファイル記述子の操作,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.16.1.8 ファイルとディレクトリ
...............................

一部の Unix プラットフォームでは、このセクションの関数の多くが以下の機能
を一つ以上サポートしています。

   * 'specifying a file descriptor:' Normally the 'path' argument
     provided to functions in the ‘os’ module must be a string
     specifying a file path.  However, some functions now alternatively
     accept an open file descriptor for their 'path' argument.  The
     function will then operate on the file referred to by the
     descriptor.  For POSIX systems, Python will call the variant of the
     function prefixed with ‘f’ (e.g.  call ‘fchdir’ instead of
     ‘chdir’).

     *note os.supports_fd: 1315. を使うことで、そのプラットフォーム上で
     'path' にファイル記述子を指定できるかどうかを確認することができます
     。この機能が利用可能でない場合、 *note os.supports_fd: 1315. の利用
     は *note NotImplementedError: 36b. 例外を送出します。

     その関数が引数に 'dir_fd' または 'follow_symlinks' もサポートしてい
     る場合、'path' にファイル記述子を指定した時にそれらのいずれかを指定
     するとエラーになります。

   * 'paths relative to directory descriptors:' If 'dir_fd' is not
     ‘None’, it should be a file descriptor referring to a directory,
     and the path to operate on should be relative; path will then be
     relative to that directory.  If the path is absolute, 'dir_fd' is
     ignored.  For POSIX systems, Python will call the variant of the
     function with an ‘at’ suffix and possibly prefixed with ‘f’ (e.g.
     call ‘faccessat’ instead of ‘access’).

     そのプラットフォーム上で特別な関数に 'dir_fd' がサポートされている
     かどうかは、*note os.supports_dir_fd: 130f. で確認できます。利用で
     きない場合 *note NotImplementedError: 36b. が送出されます。

   * 'not following symlinks:' If 'follow_symlinks' is ‘False’, and the
     last element of the path to operate on is a symbolic link, the
     function will operate on the symbolic link itself rather than the
     file pointed to by the link.  For POSIX systems, Python will call
     the ‘l...’ variant of the function.

     そのプラットフォーム上で特別な関数に 'follow_symlinks' がサポートさ
     れているかどうかは、*note os.supports_follow_symlinks: 1310. で確認
     できます。利用できない場合 *note NotImplementedError: 36b. が送出さ
     れます。

 -- の関数: os.access (path, mode, *, dir_fd=None, effective_ids=False,
          follow_symlinks=True)

     実 uid/gid を使って 'path' に対するアクセスが可能か調べます。ほとん
     どのオペレーティングシステムは実効 uid/gid を使うため、このルーチン
     は suid/sgid 環境において、プログラムを起動したユーザーが 'path' に
     対するアクセス権をもっているかを調べるために使われます。 'path' が
     存在するかどうかを調べるには 'mode' を *note F_OK: 3075. にします。
     ファイルアクセス権限 ( パーミッション ) を調べるには、 *note R_OK:
     3076, *note W_OK: 3077, *note X_OK: 3078. から一つまたはそれ以上の
     フラグを論理和指定でとることもできます。アクセスが許可されている場
     合 *note True: e07. を、そうでない場合 *note False: d2b. を返します
     。詳細は ‘access(2)(1)’ の Unix マニュアルページを参照してください
     。

     この関数は *note ディレクトリ記述子への相対パス: 1302. および *note
     シンボリックリンクをたどらない: 1303. をサポートしています。

     'effective_ids' が ‘True’ の場合、*note access(): 1304. は実
     uid/gid ではなく実効 uid/gid を使用してアクセス権を調べます。プラッ
     トフォームによっては 'effective_ids' がサポートされていない場合があ
     ります; サポートされているかどうかは *note
     os.supports_effective_ids: 1316. で確認できます。利用できない場合
     *note NotImplementedError: 36b. が送出されます。

          注釈: ユーザーが、例えばファイルを開く権限を持っているかどうか
          を調べるために実際に *note open(): 316. を行う前に *note
          access(): 1304. を使用することはセキュリティホールの原因になり
          ます。なぜなら、調べた時点とオープンした時点との時間差を利用し
          てそのユーザーがファイルを不当に操作してしまうかもしれないから
          です。その場合は *note EAFP: 3079. テクニックを利用するのが望
          ましいやり方です。例えば

               if os.access("myfile", os.R_OK):
                   with open("myfile") as fp:
                       return fp.read()
               return "some default data"

          このコードは次のように書いたほうが良いです

               try:
                   fp = open("myfile")
               except PermissionError:
                   return "some default data"
               else:
                   with fp:
                       return fp.read()

          注釈: I/O 操作は *note access(): 1304. が成功を示した時でも失
          敗することがあります。特にネットワークファイルシステムが通常の
          POSIX のパーミッションビットモデルをはみ出すアクセス権限操作を
          備える場合にはそのようなことが起こりえます。

     バージョン 3.3 で変更: 引数 'dir_fd'、'effective_ids'、および
     'follow_symlinks' が追加されました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- データ: os.F_OK
 -- データ: os.R_OK
 -- データ: os.W_OK
 -- データ: os.X_OK

     *note access(): 1304. で 'path' をテストする時に 'mode' 引数に渡す
     値です。上からそれぞれ、ファイルの存在、読み込み許可、書き込み許可
     、および実行許可になります。

 -- の関数: os.chdir (path)

     現在の作業ディレクトリを 'path' に設定します。

     この関数は *note ファイル記述子の指定: d53. をサポートしています。
     記述子は、オープンしているファイルではなく、オープンしているディレ
     クトリを参照していなければなりません。

     この関数は *note OSError: 2c0. やそのサブクラスである *note
     FileNotFoundError: 264, *note PermissionError: f3e, *note
     NotADirectoryError: 1265. などの例外を送出することがあります。

     引数 ‘path’ を指定して *note 監査イベント: 1c6e. ‘os.chdir’ を送出
     します。

     バージョン 3.3 で変更: 一部のプラットフォームで、'path' にファイル
     記述子の指定をサポートしました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.chflags (path, flags, *, follow_symlinks=True)

     'path' のフラグを 'flags' に変更します。 'flags' は、以下の値
     (*note stat: d6. モジュールで定義されているもの ) をビット単位の論
     理和で組み合わせることができます :

        * *note stat.UF_NODUMP: 2c89.

        * *note stat.UF_IMMUTABLE: 2c8a.

        * *note stat.UF_APPEND: 2c8b.

        * *note stat.UF_OPAQUE: 2c8c.

        * *note stat.UF_NOUNLINK: 2c8d.

        * *note stat.UF_COMPRESSED: 2c8e.

        * *note stat.UF_HIDDEN: 2c91.

        * *note stat.SF_ARCHIVED: 2c95.

        * *note stat.SF_IMMUTABLE: 2c96.

        * *note stat.SF_APPEND: 2c97.

        * *note stat.SF_NOUNLINK: 2c99.

        * *note stat.SF_SNAPSHOT: 2c9a.

     この関数は *note シンボリックリンクをたどらない: 1303. をサポートし
     ています。

     引数 ‘path’, ‘flags’ を指定して *note 監査イベント: 1c6e.
     ‘os.chflags’ を送出します。

     *note Availability: 213f.: Unix, not WASI.

     バージョン 3.3 で変更: Added the 'follow_symlinks' parameter.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.chmod (path, mode, *, dir_fd=None, follow_symlinks=True)

     'path' のモードを数値 'mode' に変更します。 'mode' は、 (*note
     stat: d6. モジュールで定義されている ) 以下の値のいずれかまたはビッ
     ト単位の論理和で組み合わせた値を取り得ます :

        * *note stat.S_ISUID: 2c75.

        * *note stat.S_ISGID: 2c76.

        * *note stat.S_ENFMT: 2c78.

        * *note stat.S_ISVTX: 2c79.

        * *note stat.S_IREAD: 2c85.

        * *note stat.S_IWRITE: 2c86.

        * *note stat.S_IEXEC: 2c87.

        * *note stat.S_IRWXU: 2c7a.

        * *note stat.S_IRUSR: 2c7b.

        * *note stat.S_IWUSR: 2c7c.

        * *note stat.S_IXUSR: 2c7d.

        * *note stat.S_IRWXG: 2c7e.

        * *note stat.S_IRGRP: 2c7f.

        * *note stat.S_IWGRP: 2c80.

        * *note stat.S_IXGRP: 2c77.

        * *note stat.S_IRWXO: 2c81.

        * *note stat.S_IROTH: 2c82.

        * *note stat.S_IWOTH: 2c83.

        * *note stat.S_IXOTH: 2c84.

     この関数は *note ファイル記述子の指定: d53. 、 *note
     ディレクトリ記述子への相対パス: 1302. 、および *note
     シンボリックリンクをたどらない: 1303. をサポートしています。

          注釈: Although Windows supports *note chmod(): 529, you can
          only set the file's read-only flag with it (via the
          ‘stat.S_IWRITE’ and ‘stat.S_IREAD’ constants or a
          corresponding integer value).  All other bits are ignored.
          The default value of 'follow_symlinks' is ‘False’ on Windows.

          The function is limited on WASI, see *note WebAssembly
          プラットフォーム: 1b6a. for more information.

     引数 ‘path’, ‘mode’, ‘dir_fd’ を指定して *note 監査イベント: 1c6e.
     ‘os.chmod’ を送出します。

     バージョン 3.3 で変更: 'path' にオープンしているファイル記述子の指
     定のサポート、および引数 'dir_fd' と 'follow_symlinks' を追加しまし
     た。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.13 で変更: Added support for a file descriptor and the
     'follow_symlinks' argument on Windows.

 -- の関数: os.chown (path, uid, gid, *, dir_fd=None,
          follow_symlinks=True)

     'path' の所有者 id およびグループ id を、数値 'uid' および 'gid' に
     変更します。いずれかの id を変更せずにおくには、その値として -1 を
     指定します。

     この関数は *note ファイル記述子の指定: d53. 、 *note
     ディレクトリ記述子への相対パス: 1302. 、および *note
     シンボリックリンクをたどらない: 1303. をサポートしています。

     数値 id の他に名前でも受け取る高水準関数の *note shutil.chown():
     548. を参照してください。

     引数 ‘path’, ‘uid’, ‘gid’, ‘dir_fd’ を指定して *note 監査イベント:
     1c6e. ‘os.chown’ を送出します。

     *note Availability: 213f.: Unix.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1b6a. for more information.

     バージョン 3.3 で変更: 'path' にオープンしているファイル記述子の指
     定のサポート、および引数 'dir_fd' と 'follow_symlinks' を追加しまし
     た。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.chroot (path)

     現在のプロセスのルートディレクトリを 'path' に変更します。

     *note Availability: 213f.: Unix, not WASI, not Android.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.fchdir (fd)

     現在の作業ディレクトリをファイル記述子 'fd' が表すディレクトリに変
     更します。記述子はオープンしているファイルではなく、オープンしたデ
     ィレクトリを参照していなければなりません。Python 3.3 以降では
     ‘os.chdir(fd)’ と等価です。

     引数 ‘path’ を指定して *note 監査イベント: 1c6e. ‘os.chdir’ を送出
     します。

     *note Availability: 213f.: Unix.

 -- の関数: os.getcwd ()

     現在の作業ディレクトリを表す文字列を返します。

 -- の関数: os.getcwdb ()

     現在の作業ディレクトリを表すバイト列を返します。

     バージョン 3.8 で変更: この関数は Windows において ANSI コードペー
     ジ ではなく UTF-8 エンコーディングを使うようになりました: 変更の背
     景については PEP 529(2) をご覧ください。この関数は Windows において
     非推奨になりません。

 -- の関数: os.lchflags (path, flags)

     'path' のフラグを数値 'flags' に設定します。*note chflags(): 1305.
     に似ていますが、シンボリックリンクをたどりません。Python 3.3 以降で
     は ‘os.chflags(path, flags, follow_symlinks=False)’ と等価です。

     引数 ‘path’, ‘flags’ を指定して *note 監査イベント: 1c6e.
     ‘os.chflags’ を送出します。

     *note Availability: 213f.: Unix, not WASI.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.lchmod (path, mode)

     'path' のモードを数値 'mode' に変更します。パスがシンボリックリンク
     の場合はそのリンク先ではなくシンボリックリンクそのものに対して作用
     します。'mode' に指定できる値については *note chmod(): 529. のドキ
     ュメントを参照してください。Python 3.3 以降では ‘os.chmod(path,
     mode, follow_symlinks=False)’ と等価です。

     ‘lchmod()’ is not part of POSIX, but Unix implementations may have
     it if changing the mode of symbolic links is supported.

     引数 ‘path’, ‘mode’, ‘dir_fd’ を指定して *note 監査イベント: 1c6e.
     ‘os.chmod’ を送出します。

     *note Availability: 213f.: Unix, Windows, not Linux, FreeBSD >=
     1.3, NetBSD >= 1.3, not OpenBSD

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.13 で変更: Added support on Windows.

 -- の関数: os.lchown (path, uid, gid)

     'path' の所有者 id およびグループ id を、数値 'uid' および 'gid' に
     変更します。この関数はシンボリックリンクをたどりません。Python 3.3
     以降では ‘os.chown(path, uid, gid, follow_symlinks=False)’ と等価で
     す。

     引数 ‘path’, ‘uid’, ‘gid’, ‘dir_fd’ を指定して *note 監査イベント:
     1c6e. ‘os.chown’ を送出します。

     *note Availability: 213f.: Unix.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.link (src, dst, *, src_dir_fd=None, dst_dir_fd=None,
          follow_symlinks=True)

     'src' を指し示すハードリンク 'dst' を作成します。

     This function can support specifying 'src_dir_fd' and/or
     'dst_dir_fd' to supply *note paths relative to directory
     descriptors: 1302, and *note not following symlinks: 1303.  The
     default value of 'follow_symlinks' is ‘False’ on Windows.

     引数 ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’ を指定して *note
     監査イベント: 1c6e. ‘os.link’ を送出します。

     *note Availability: 213f.: Unix, Windows.

     バージョン 3.2 で変更: Windows サポートを追加しました。

     バージョン 3.3 で変更: Added the 'src_dir_fd', 'dst_dir_fd', and
     'follow_symlinks' parameters.

     バージョン 3.6 で変更: 'src' と 'dst' が *note path-like object:
     5a1. を受け付けるようになりました。

 -- の関数: os.listdir (path='.')

     'path' に指定したディレクトリに含まれるエントリ名のリストを返します
     。リストの順番は不定です。特別なエントリ ‘'.'’ と ‘'..'’ はリストに
     含まれません。この関数の呼び出し中にディレクトリからファイルが削除
     されたり、ディレクトリにファイルが追加されたりした場合、それらのフ
     ァイルがリストに含まれるかどうかは不定です。

     'path' に *note path-like オブジェクト: 5a1. を指定することもできま
     す。 'path' が (直接的または間接的に *note PathLike: e4b. インター
     フェースを介した) ‘bytes’ 型の場合、戻り値のファイル名も ‘bytes’ 型
     になります; それ以外の場合、ファイル名は ‘str’ 型です。

     この関数は *note ファイル記述子の指定: d53. もサポートしています; フ
     ァイル記述子はディレクトリを参照していなくてはなりません。

     引数 ‘path’ を指定して *note 監査イベント: 1c6e. ‘os.listdir’ を送
     出します。

          注釈: ‘文字列型’ のファイル名を ‘バイト列型’ にエンコードする
          には、*note fsencode(): e4f. を使用します。

     参考
     ....

     ディレクトリエントリに加えてファイル属性情報も返す *note scandir():
     c54. 関数の方が、多くの一般的な用途では使い勝手が良くなります。

     バージョン 3.2 で変更: 引数 'path' は任意になりました。

     バージョン 3.3 で変更: 'path' へのオープン・ファイル記述子の指定を
     サポートしました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.listdrives ()

     Return a list containing the names of drives on a Windows system.

     A drive name typically looks like ‘'C:\\'’.  Not every drive name
     will be associated with a volume, and some may be inaccessible for
     a variety of reasons, including permissions, network connectivity
     or missing media.  This function does not test for access.

     May raise *note OSError: 2c0. if an error occurs collecting the
     drive names.

     Raises an *note auditing event: 1c6e. ‘os.listdrives’ with no
     arguments.

     *note Availability: 213f.: Windows

     Added in version 3.12.

 -- の関数: os.listmounts (volume)

     Return a list containing the mount points for a volume on a Windows
     system.

     'volume' must be represented as a GUID path, like those returned by
     *note os.listvolumes(): 6c6.  Volumes may be mounted in multiple
     locations or not at all.  In the latter case, the list will be
     empty.  Mount points that are not associated with a volume will not
     be returned by this function.

     The mount points return by this function will be absolute paths,
     and may be longer than the drive name.

     Raises *note OSError: 2c0. if the volume is not recognized or if an
     error occurs collecting the paths.

     Raises an *note auditing event: 1c6e. ‘os.listmounts’ with argument
     ‘volume’.

     *note Availability: 213f.: Windows

     Added in version 3.12.

 -- の関数: os.listvolumes ()

     Return a list containing the volumes in the system.

     Volumes are typically represented as a GUID path that looks like
     ‘\\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\’.  Files can
     usually be accessed through a GUID path, permissions allowing.
     However, users are generally not familiar with them, and so the
     recommended use of this function is to retrieve mount points using
     *note os.listmounts(): 6c7.

     May raise *note OSError: 2c0. if an error occurs collecting the
     volumes.

     Raises an *note auditing event: 1c6e. ‘os.listvolumes’ with no
     arguments.

     *note Availability: 213f.: Windows

     Added in version 3.12.

 -- の関数: os.lstat (path, *, dir_fd=None)

     Perform the equivalent of an ‘lstat()’ system call on the given
     path.  Similar to *note stat(): 26d, but does not follow symbolic
     links.  Return a *note stat_result: 16da. object.

     シンボリックリンクをサポートしていないプラットフォームでは *note
     stat(): 26d. の別名です。

     Python 3.3 以降では ‘os.stat(path, dir_fd=dir_fd,
     follow_symlinks=False)’ と等価です。

     この関数は *note ディレクトリ記述子への相対パス: 1302. もサポートす
     ることができます。

     参考
     ....

     *note stat(): 26d. 関数。

     バージョン 3.2 で変更: Windows 6.0 (Vista) のシンボリックリンクをサ
     ポートしました。

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.8 で変更: On Windows, now opens reparse points that
     represent another path (name surrogates), including symbolic links
     and directory junctions.  Other kinds of reparse points are
     resolved by the operating system as for *note stat(): 26d.

 -- の関数: os.mkdir (path, mode=0o777, *, dir_fd=None)

     ディレクトリ 'path' を数値モード 'mode' で作成します。

     If the directory already exists, *note FileExistsError: 1221. is
     raised.  If a parent directory in the path does not exist, *note
     FileNotFoundError: 264. is raised.  いくつかのシステムにおいては
     'mode' は無視されます。それが使われる時には、最初に現在の umask 値
     でマスクされます。もし最後の 9 ビット (つまり 'mode' の8進法表記の
     最後の3桁) を除いたビットが設定されていたら、それらの意味はプラット
     フォームに依存します。いくつかのプラットフォームではそれらは無視さ
     れ、それらを設定するためには明示的に *note chmod(): 529. を呼ぶ必要
     があるでしょう。

     On Windows, a 'mode' of ‘0o700’ is specifically handled to apply
     access control to the new directory such that only the current user
     and administrators have access.  Other values of 'mode' are
     ignored.

     この関数は *note ディレクトリ記述子への相対パス: 1302. もサポートす
     ることができます。

     一時ディレクトリを作成することもできます : *note tempfile: e6. モジ
     ュールの *note tempfile.mkdtemp(): 52d. 関数を参照してください。

     引数 ‘path’, ‘mode’, ‘dir_fd’ を指定して *note 監査イベント: 1c6e.
     ‘os.mkdir’ を送出します。

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.13 で変更: Windows now handles a 'mode' of ‘0o700’.

 -- の関数: os.makedirs (name, mode=0o777, exist_ok=False)

     再帰的にディレクトリを作成する関数です。*note mkdir(): 52b. と似て
     いますが、末端ディレクトリを作成するために必要なすべての中間ディレ
     クトリも作成します。

     The 'mode' parameter is passed to *note mkdir(): 52b. for creating
     the leaf directory; see *note the mkdir() description: 307c. for
     how it is interpreted.  To set the file permission bits of any
     newly created parent directories you can set the umask before
     invoking *note makedirs(): 52c.  The file permission bits of
     existing parent directories are not changed.

     'exist_ok' の値が ‘False’ の場合 (デフォルト)、対象のディレクトリが
     すでに存在すると *note FileExistsError: 1221. を送出します。

          注釈: 作成するパス要素に *note pardir: 307d. (UNIX では "..")
          が含まれる場合、*note makedirs(): 52c. は混乱します。

     この関数は UNC パスを正しく扱えるようになりました。

     引数 ‘path’, ‘mode’, ‘dir_fd’ を指定して *note 監査イベント: 1c6e.
     ‘os.mkdir’ を送出します。

     バージョン 3.2 で変更: Added the 'exist_ok' parameter.

     バージョン 3.4.1 で変更: Python 3.4.1 より前、 'exist_ok' が ‘True’
     でそのディレクトリが既存の場合でも、 *note makedirs(): 52c. は
     'mode' が既存ディレクトリのモードと合わない場合にはエラーにしようと
     していました。このモードチェックの振る舞いを安全に実装することが出
     来なかったため、 Python 3.4.1 でこのチェックは削除されました。
     bpo-21082(3) を参照してください。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.7 で変更: The 'mode' argument no longer affects the
     file permission bits of newly created intermediate-level
     directories.

 -- の関数: os.mkfifo (path, mode=0o666, *, dir_fd=None)

     FIFO (名前付きパイプ) 'path' を数値モード 'mode' で作成します。先に
     現在の umask 値でマスクされます。

     この関数は *note ディレクトリ記述子への相対パス: 1302. もサポートす
     ることができます。

     FIFO は通常のファイルのようにアクセスできるパイプです。 FIFO は ( 例
     えば *note os.unlink(): 130d. を使って ) 削除されるまで存在しつづけ
     ます。一般的に、 FIFO は " クライアント " と " サーバー " 形式のプ
     ロセス間でランデブーを行うために使われます : この時、サーバーは
     FIFO を読み込み用に、クライアントは書き出し用にオープンします。
     *note mkfifo(): f90. は FIFO をオープンしない -- 単にランデブーポイ
     ントを作成するだけ -- なので注意してください。

     *note Availability: 213f.: Unix, not WASI.

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.mknod (path, mode=0o600, device=0, *, dir_fd=None)

     'path' という名前で、ファイルシステムノード (ファイル、デバイス特殊
     ファイル、または名前つきパイプ) を作成します。'mode' は、作成するノ
     ードのアクセス権限とタイプの両方を ‘stat.S_IFREG’、‘stat.S_IFCHR’、
     ‘stat.S_IFBLK’、および ‘stat.S_IFIFO’ の組み合わせ (ビット単位の論
     理和) で指定します (これらの定数は *note stat: d6. で利用可能です
     )。‘stat.S_IFCHR’ と ‘stat.S_IFBLK’ を指定した場合、'devide' は新し
     く作成されたデバイス特殊ファイルを (おそらく *note os.makedev():
     1960. を使って) 定義し、それ以外の定数を指定した場合は無視されます
     。

     この関数は *note ディレクトリ記述子への相対パス: 1302. もサポートす
     ることができます。

     *note Availability: 213f.: Unix, not WASI.

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.major (device, /)

     Extract the device major number from a raw device number (usually
     the ‘st_dev’ or ‘st_rdev’ field from ‘stat’).

 -- の関数: os.minor (device, /)

     Extract the device minor number from a raw device number (usually
     the ‘st_dev’ or ‘st_rdev’ field from ‘stat’).

 -- の関数: os.makedev (major, minor, /)

     メジャーおよびマイナーデバイス番号から、新しく RAW デバイス番号を作
     成します。

 -- の関数: os.pathconf (path, name)

     名前付きファイルに関連するシステム設定情報を返します。 'name' には
     取得したい設定名を指定します ; これは定義済みのシステム値名の文字列
     で、多くの標準 (POSIX.1 、 Unix 95 、 Unix 98 その他 ) で定義されて
     います。プラットフォームによっては別の名前も定義しています。ホスト
     オペレーティングシステムの関知する名前は ‘pathconf_names’ 辞書で与
     えられています。このマップ型オブジェクトに入っていない設定変数につ
     いては、 'name' に整数を渡してもかまいません。

     'name' が不明の文字列である場合、 *note ValueError: 2ec. を送出しま
     す。 'name' の特定の値がホストシステムでサポートされていない場合、
     ‘pathconf_names’ に含まれていたとしても、 *note errno.EINVAL: 1dd2.
     をエラー番号として *note OSError: 2c0. を送出します。

     この関数は *note ファイル記述子の指定: d53. をサポートしています。

     *note Availability: 213f.: Unix.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- データ: os.pathconf_names

     *note pathconf(): 1313. および *note fpathconf(): 303b. が受理する
     システム設定名を、ホストオペレーティングシステムで定義されている整
     数値に対応付けている辞書です。この辞書はシステムでどの設定名が定義
     されているかを知るために利用できます。

     *note Availability: 213f.: Unix.

 -- の関数: os.readlink (path, *, dir_fd=None)

     シンボリックリンクが指しているパスを表す文字列を返します。返される
     値は絶対パスにも、相対パスにもなり得ます ; 相対パスの場合、
     ‘os.path.join(os.path.dirname(path), result)’ を使って絶対パスに変
     換することができます。

     If the 'path' is a string object (directly or indirectly through a
     *note PathLike: e4b. interface), the result will also be a string
     object, and the call may raise a UnicodeDecodeError.  If the 'path'
     is a bytes object (direct or indirectly), the result will be a
     bytes object.

     この関数は *note ディレクトリ記述子への相対パス: 1302. もサポートす
     ることができます。

     When trying to resolve a path that may contain links, use *note
     realpath(): 262. to properly handle recursion and platform
     differences.

     *note Availability: 213f.: Unix, Windows.

     バージョン 3.2 で変更: Windows 6.0 (Vista) のシンボリックリンクをサ
     ポートしました。

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: Unixで、 *note path-like object: 5a1. を受け
     入れるようになりました。

     バージョン 3.8 で変更: Windowsで、 *note path-like object: 5a1. と
     bytes オブジェクトを受け入れるようになりました。

     Added support for directory junctions, and changed to return the
     substitution path (which typically includes ‘\\?\’ prefix) rather
     than the optional "print name" field that was previously returned.

 -- の関数: os.remove (path, *, dir_fd=None)

     Remove (delete) the file 'path'.  If 'path' is a directory, an
     *note OSError: 2c0. is raised.  Use *note rmdir(): 130b. to remove
     directories.  If the file does not exist, a *note
     FileNotFoundError: 264. is raised.

     この関数は *note ディレクトリ記述子への相対パス: 1302. をサポートし
     ています。

     Windows では、使用中のファイルを削除しようとすると例外を送出します;
     Unixでは、ディレクトリエントリは削除されますが、記憶装置上に割り当
     てられたファイル領域は元のファイルが使われなくなるまで残されます。

     この関数は意味論的に *note unlink(): 130d. と同一です。

     引数 ‘path’, ‘dir_fd’ を指定して *note 監査イベント: 1c6e.
     ‘os.remove’ を送出します。

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.removedirs (name)

     再帰的なディレクトリ削除関数です。 *note rmdir(): 130b. と同じよう
     に動作しますが、末端ディレクトリがうまく削除できるかぎり、 *note
     removedirs(): 307f. は 'path' に現れる親ディレクトリをエラーが送出
     されるまで ( このエラーは通常、指定したディレクトリの親ディレクトリ
     が空でないことを意味するだけなので無視されます ) 順に削除することを
     試みます。例えば、 ‘os.removedirs('foo/bar/baz')’ では最初にディレ
     クトリ ‘'foo/bar/baz'’ を削除し、次に ‘'foo/bar'’ さらに ‘'foo'’ を
     それらが空ならば削除します。末端のディレクトリが削除できなかった場
     合には *note OSError: 2c0. が送出されます。

     引数 ‘path’, ‘dir_fd’ を指定して *note 監査イベント: 1c6e.
     ‘os.remove’ を送出します。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.rename (src, dst, *, src_dir_fd=None, dst_dir_fd=None)

     Rename the file or directory 'src' to 'dst'.  If 'dst' exists, the
     operation will fail with an *note OSError: 2c0. subclass in a
     number of cases:

     On Windows, if 'dst' exists a *note FileExistsError: 1221. is
     always raised.  The operation may fail if 'src' and 'dst' are on
     different filesystems.  Use *note shutil.move(): c51. to support
     moves to a different filesystem.

     On Unix, if 'src' is a file and 'dst' is a directory or vice-versa,
     an *note IsADirectoryError: 1264. or a *note NotADirectoryError:
     1265. will be raised respectively.  If both are directories and
     'dst' is empty, 'dst' will be silently replaced.  If 'dst' is a
     non-empty directory, an *note OSError: 2c0. is raised.  If both are
     files, 'dst' will be replaced silently if the user has permission.
     The operation may fail on some Unix flavors if 'src' and 'dst' are
     on different filesystems.  If successful, the renaming will be an
     atomic operation (this is a POSIX requirement).

     この関数は 'src_dir_fd' と 'dst_dir_fd' のどちらかまたは両方の指定
     に *note ディレクトリ記述子への相対パス: 1302. をサポートしています
     。

     対象の上書きがクロスプラットフォームになる場合は *note replace():
     130a. を使用してください。

     引数 ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’ を指定して *note
     監査イベント: 1c6e. ‘os.rename’ を送出します。

     バージョン 3.3 で変更: Added the 'src_dir_fd' and 'dst_dir_fd'
     parameters.

     バージョン 3.6 で変更: 'src' と 'dst' が *note path-like object:
     5a1. を受け付けるようになりました。

 -- の関数: os.renames (old, new)

     再帰的にディレクトリやファイル名を変更する関数です。 *note
     rename(): 1309. のように動作しますが、新たなパス名を持つファイルを
     配置するために必要な途中のディレクトリ構造をまず作成しようと試みま
     す。名前変更の後、元のファイル名のパス要素は *note removedirs():
     307f. を使って右側から順に削除されます。

          注釈: この関数はコピー元の末端のディレクトリまたはファイルを削
          除する権限がない場合には失敗します。

     引数 ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’ を指定して *note
     監査イベント: 1c6e. ‘os.rename’ を送出します。

     バージョン 3.6 で変更: 'old' と 'new' が *note path-like object:
     5a1. を受け付けるようになりました。

 -- の関数: os.replace (src, dst, *, src_dir_fd=None, dst_dir_fd=None)

     ファイルまたはディレクトリ 'src' の名前を 'dst' へ変更します。'dst'
     が空でないディレクトリの場合 *note OSError: 2c0. が送出されます。
     'dst' が存在し、かつファイルの場合、ユーザーの権限がある限り暗黙の
     うちに置き換えられます。'src' と 'dst' が異なるファイルシステム上に
     あると失敗することがあります。ファイル名の変更が成功する場合はアト
     ミック操作となります (これは POSIX 要求仕様です)。

     この関数は 'src_dir_fd' と 'dst_dir_fd' のどちらかまたは両方の指定
     に *note ディレクトリ記述子への相対パス: 1302. をサポートしています
     。

     引数 ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’ を指定して *note
     監査イベント: 1c6e. ‘os.rename’ を送出します。

     Added in version 3.3.

     バージョン 3.6 で変更: 'src' と 'dst' が *note path-like object:
     5a1. を受け付けるようになりました。

 -- の関数: os.rmdir (path, *, dir_fd=None)

     Remove (delete) the directory 'path'.  If the directory does not
     exist or is not empty, a *note FileNotFoundError: 264. or an *note
     OSError: 2c0. is raised respectively.  In order to remove whole
     directory trees, *note shutil.rmtree(): 356. can be used.

     この関数は *note ディレクトリ記述子への相対パス: 1302. をサポートし
     ています。

     引数 ‘path’, ‘dir_fd’ を指定して *note 監査イベント: 1c6e.
     ‘os.rmdir’ を送出します。

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.scandir (path='.')

     Return an iterator of *note os.DirEntry: 6c3. objects corresponding
     to the entries in the directory given by 'path'.  The entries are
     yielded in arbitrary order, and the special entries ‘'.'’ and
     ‘'..'’ are not included.  If a file is removed from or added to the
     directory after creating the iterator, whether an entry for that
     file be included is unspecified.

     *note listdir(): 1312. の代わりに *note scandir(): c54. を使用する
     と、ファイルタイプや属性情報も必要とするコードのパフォーマンスが大
     幅に向上します。これは、オペレーティングシステムがディレクトリのス
     キャン中にこの情報を提供した場合、*note os.DirEntry: 6c3. オブジェ
     クトがその情報を公開するからです。すべての *note os.DirEntry: 6c3.
     メソッドはシステムコールを実行する場合がありますが、*note is_dir():
     3081. と *note is_file(): f84. は、通常はシンボリックリンクにしかシ
     ステムコールを必要としません。*note os.DirEntry.stat(): 1a6b. は、
     Unix 上では常にシステムコールを必要としますが、Windows ではシンボリ
     ックリンク用にシステムコールを一つ必要とするだけです。

     'path' may be a *note path-like object: 5a1.  If 'path' is of type
     ‘bytes’ (directly or indirectly through the *note PathLike: e4b.
     interface), the type of the *note name: 3082. and *note path: 19f8.
     attributes of each *note os.DirEntry: 6c3. will be ‘bytes’; in all
     other circumstances, they will be of type ‘str’.

     この関数は *note ファイル記述子の指定: d53. もサポートしています; フ
     ァイル記述子はディレクトリを参照していなくてはなりません。

     引数 ‘path’ を指定して *note 監査イベント: 1c6e. ‘os.scandir’ を送
     出します。

     *note scandir(): c54. イテレータは、 *note コンテキストマネージャ:
     1e1. プロトコルをサポートし、次のメソッドを持ちます。

      -- メソッド: scandir.close ()

          イテレータを閉じ、獲得した資源を開放します。

          この関数は、イテレータがすべて消費されるか、ガーベージコレクト
          された、もしくはイテレート中にエラーが発生した際に自動的に呼び
          出されます。しかし、 *note with: 186. 文を用いるか、明示的に呼
          び出すことを推奨します。

          Added in version 3.6.

     次の単純な例では、*note scandir(): c54. を使用して、指定した 'path'
     内の先頭が ‘'.'’ でないすべてのファイル (ディレクトリを除く) をすべ
     て表示します。‘entry.is_file()’ を呼び出しても、通常は追加のシステ
     ムコールは行われません:

          with os.scandir(path) as it:
              for entry in it:
                  if not entry.name.startswith('.') and entry.is_file():
                      print(entry.name)

          注釈: On Unix-based systems, *note scandir(): c54. uses the
          system's opendir()(4) and readdir()(5) functions.  On Windows,
          it uses the Win32 FindFirstFileW(6) and FindNextFileW(7)
          functions.

     Added in version 3.5.

     バージョン 3.6 で変更: Added support for the *note context manager:
     1e1. protocol and the *note close(): eb8. method.  If a *note
     scandir(): c54. iterator is neither exhausted nor explicitly closed
     a *note ResourceWarning: 54c. will be emitted in its destructor.

     関数が *note path-like object: 5a1. を受け入れるようになりました。

     バージョン 3.7 で変更: Unix で *note ファイル記述子の指定: d53. の
     サポートが追加されました。

 -- クラス: os.DirEntry

     ディレクトリエントリのファイルパスとその他のファイル属性を公開する
     ために、*note scandir(): c54. が yield するオブジェクトです。

     *note scandir(): c54. は、追加のシステムコールを実行することなく、
     この情報をできるだけ多く提供します。‘stat()’ または ‘lstat()’ シス
     テムコールが実行された場合、‘os.DirEntry’ オブジェクトは結果をキャ
     ッシュします。

     ‘os.DirEntry’ インスタンスは、寿命の長いデータ構造に保存されること
     は想定されていません。ファイルメタデータが変更された場合や、 *note
     scandir(): c54. が呼び出されてから長時間が経過した場合は、
     ‘os.stat(entry.path)’ を呼び出して最新の情報を取得してください。

     ‘os.DirEntry’ のメソッドはオペレーティングシステムコールを実行する
     場合があるため、それらは *note OSError: 2c0. も送出する場合がありま
     す。エラーを細かく制御する必要がある場合、 ‘os.DirEntry’ のメソッド
     の一つの呼び出し時に *note OSError: 2c0. を捕捉して、適切な処理を行
     うことができます。

     To be directly usable as a *note path-like object: 5a1,
     ‘os.DirEntry’ implements the *note PathLike: e4b. interface.

     ‘os.DirEntry’ インスタンスの属性とメソッドは以下の通りです:

      -- の属性: name

          *note scandir(): c54. の 'path' 引数に対して相対的な、エントリ
          のベースファイル名です。

          The *note name: 3003. attribute will be ‘bytes’ if the *note
          scandir(): c54. 'path' argument is of type ‘bytes’ and ‘str’
          otherwise.  Use *note fsdecode(): e4e. to decode byte
          filenames.

      -- の属性: path

          The entry's full path name: equivalent to
          ‘os.path.join(scandir_path, entry.name)’ where 'scandir_path'
          is the *note scandir(): c54. 'path' argument.  The path is
          only absolute if the *note scandir(): c54. 'path' argument was
          absolute.  If the *note scandir(): c54. 'path' argument was a
          *note file descriptor: d53, the *note path: a6. attribute is
          the same as the *note name: 3003. attribute.

          The *note path: a6. attribute will be ‘bytes’ if the *note
          scandir(): c54. 'path' argument is of type ‘bytes’ and ‘str’
          otherwise.  Use *note fsdecode(): e4e. to decode byte
          filenames.

      -- メソッド: inode ()

          項目の inode 番号を返します。

          結果は ‘os.DirEntry’ オブジェクトにキャッシュされます。最新の
          情報を取得するには ‘os.stat(entry.path,
          follow_symlinks=False).st_ino’ を使用してください。

          Windows 上では、最初のキャッシュされていない呼び出しでシステム
          コールが必要ですが、 Unix 上では必要ありません。

      -- メソッド: is_dir (*, follow_symlinks=True)

          この項目がディレクトリまたはディレクトリへのシンボリックリンク
          である場合、 ‘True’ を返します。項目がそれ以外のファイルやそれ
          以外のファイルへのシンボリックリンクである場合や、もはや存在し
          ない場合は ‘False’ を返します。

          'follow_symlinks' が ‘False’ の場合、項目がディレクトリ (シン
          ボリックリンクはたどりません) の場合にのみ ‘True’ を返します。
          項目がディレクトリ以外のファイルである場合や、項目がもはや存在
          しない場合は ‘False’ を返します。

          結果は ‘os.DirEntry’ オブジェクトにキャッシュされます。
          'follow_symlinks' が ‘True’ の場合と ‘False’ の場合とでは、別
          のオブジェクトにキャッシュされます。最新の情報を取得するには
          *note stat.S_ISDIR(): 2c5c. と共に *note os.stat(): 26d. を呼
          び出してください。

          多くの場合、最初のキャッシュされない呼び出しでは、システムコー
          ルは必要とされません。具体的には、シンボリックリンク以外では、
          Windows も Unix もシステムコールを必要としません。ただし、
          ‘dirent.d_type == DT_UNKNOWN’ を返す、ネットワークファイルシス
          テムなどの特定の Unix ファイルシステムは例外です。項目がシンボ
          リックリンクの場合、'follow_symlinks' が ‘False’ の場合を除き
          、シンボリックリンクをたどるためにシステムコールが必要となりま
          す。

          このメソッドは *note PermissionError: f3e. のような *note
          OSError: 2c0. を送出することがありますが、 *note
          FileNotFoundError: 264. は捕捉され送出されません。

      -- メソッド: is_file (*, follow_symlinks=True)

          この項目がファイルまたはファイルへのシンボリックリンクである場
          合、 ‘True’ を返します。項目がディレクトリやファイル以外の項目
          へのシンボリックリンクである場合や、もはや存在しない場合は
          ‘False’ を返します。

          'follow_symlinks' が ‘False’ の場合、項目がファイル (シンボリ
          ックリンクはたどりません) の場合にのみ ‘True’ を返します。項目
          がディレクトリやその他のファイル以外の項目である場合や、項目が
          もはや存在しない場合は ‘False’ を返します。

          結果は ‘os.DirEntry’ オブジェクトにキャッシュされます。キャッ
          シュ、システムコール、例外は、*note is_dir(): 3081. と同様に行
          われます。

      -- メソッド: is_symlink ()

          この項目がシンボリックリンクの場合 (たとえ破損していても)、
          ‘True’ を返します。項目がディレクトリやあらゆる種類のファイル
          の場合、またはもはや存在しない場合は ‘False’ を返します。

          結果は ‘os.DirEntry’ オブジェクトにキャッシュされます。 最新の
          情報をフェッチするには *note os.path.islink(): c01. を呼び出し
          てください。

          多くの場合、最初のキャッシュされない呼び出しでは、システムコー
          ルは必要とされません。具体的には、Windows も Unix もシステムコ
          ールを必要としません。ただし、‘dirent.d_type == DT_UNKNOWN’ を
          返す、ネットワークファイルシステムなどの特定の Unix ファイルシ
          ステムは例外です。

          このメソッドは *note PermissionError: f3e. のような *note
          OSError: 2c0. を送出することがありますが、 *note
          FileNotFoundError: 264. は捕捉され送出されません。

      -- メソッド: is_junction ()

          Return ‘True’ if this entry is a junction (even if broken);
          return ‘False’ if the entry points to a regular directory, any
          kind of file, a symlink, or if it doesn't exist anymore.

          The result is cached on the ‘os.DirEntry’ object.  Call *note
          os.path.isjunction(): 6ca. to fetch up-to-date information.

          Added in version 3.12.

      -- メソッド: stat (*, follow_symlinks=True)

          この項目の *note stat_result: 16da. オブジェクトを返します。こ
          のメソッドは、デフォルトでシンボリックリンクをたどります。シン
          ボリックリンクを開始するには、 ‘follow_symlinks=False’ 引数を
          追加します。

          On Unix, this method always requires a system call.  On
          Windows, it only requires a system call if 'follow_symlinks'
          is ‘True’ and the entry is a reparse point (for example, a
          symbolic link or directory junction).

          Windows では、*note stat_result: 16da. の ‘st_ino’ 、 ‘st_dev’
          、 ‘st_nlink’ 属性は常にゼロに設定されます。これらの属性を取得
          するには、 *note os.stat(): 26d. を呼び出します。

          結果は ‘os.DirEntry’ オブジェクトにキャッシュされます。
          'follow_symlinks' が ‘True’ の場合と ‘False’ の場合とでは、別
          のオブジェクトにキャッシュされます。最新の情報を取得するには、
          *note os.stat(): 26d. を呼び出してください。

     Note that there is a nice correspondence between several attributes
     and methods of ‘os.DirEntry’ and of *note pathlib.Path: 266.  In
     particular, the ‘name’ attribute has the same meaning, as do the
     ‘is_dir()’, ‘is_file()’, ‘is_symlink()’, ‘is_junction()’, and
     ‘stat()’ methods.

     Added in version 3.5.

     バージョン 3.6 で変更: *note PathLike: e4b. インターフェースをサポ
     ートしました。Windowsで *note bytes: 192. パスをサポートしました。

     バージョン 3.12 で変更: The ‘st_ctime’ attribute of a stat result
     is deprecated on Windows.  The file creation time is properly
     available as ‘st_birthtime’, and in the future ‘st_ctime’ may be
     changed to return zero or the metadata change time, if available.

 -- の関数: os.stat (path, *, dir_fd=None, follow_symlinks=True)

     Get the status of a file or a file descriptor.  Perform the
     equivalent of a ‘stat()’ system call on the given path.  'path' may
     be specified as either a string or bytes - directly or indirectly
     through the *note PathLike: e4b. interface - or as an open file
     descriptor.  Return a *note stat_result: 16da. object.

     この関数は通常はシンボリックリンクをたどります。シンボリックリンク
     に対して stat したい場合は ‘follow_symlinks=False’ とするか、 *note
     lstat(): 6c8. を利用してください。

     この関数は *note ファイル記述子の指定: d53. および *note
     シンボリックリンクをたどらない: 1303. をサポートしています。

     On Windows, passing ‘follow_symlinks=False’ will disable following
     all name-surrogate reparse points, which includes symlinks and
     directory junctions.  Other types of reparse points that do not
     resemble links or that the operating system is unable to follow
     will be opened directly.  When following a chain of multiple links,
     this may result in the original link being returned instead of the
     non-link that prevented full traversal.  To obtain stat results for
     the final path in this case, use the *note os.path.realpath(): 262.
     function to resolve the path name as far as possible and call *note
     lstat(): 6c8. on the result.  This does not apply to dangling
     symlinks or junction points, which will raise the usual exceptions.

     以下はプログラム例です:

          >>> import os
          >>> statinfo = os.stat('somefile.txt')
          >>> statinfo
          os.stat_result(st_mode=33188, st_ino=7876932, st_dev=234881026,
          st_nlink=1, st_uid=501, st_gid=501, st_size=264, st_atime=1297230295,
          st_mtime=1297230027, st_ctime=1297230027)
          >>> statinfo.st_size
          264

     参考
     ....

     *note fstat(): f8c. と *note lstat(): 6c8.。

     バージョン 3.3 で変更: Added the 'dir_fd' and 'follow_symlinks'
     parameters, specifying a file descriptor instead of a path.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.8 で変更: On Windows, all reparse points that can be
     resolved by the operating system are now followed, and passing
     ‘follow_symlinks=False’ disables following all name surrogate
     reparse points.  If the operating system reaches a reparse point
     that it is not able to follow, 'stat' now returns the information
     for the original path as if ‘follow_symlinks=False’ had been
     specified instead of raising an error.

 -- クラス: os.stat_result

     Object whose attributes correspond roughly to the members of the
     ‘stat’ structure.  It is used for the result of *note os.stat():
     26d, *note os.fstat(): f8c. and *note os.lstat(): 6c8.

     属性:

      -- の属性: st_mode

          ファイルモード。ファイルタイプとファイルモードのビット （権限
          ）。

      -- の属性: st_ino

          Platform dependent, but if non-zero, uniquely identifies the
          file for a given value of ‘st_dev’.  Typically:

             * the inode number on Unix,

             * the file index(8) on Windows

      -- の属性: st_dev

          このファイルが存在するデバイスの識別子。

      -- の属性: st_nlink

          ハードリンクの数。

      -- の属性: st_uid

          ファイル所有者のユーザ識別子。

      -- の属性: st_gid

          ファイル所有者のグループ識別子。

      -- の属性: st_size

          ファイルが通常のファイルまたはシンボリックリンクの場合、そのフ
          ァイルのバイト単位でのサイズです。シンボリックリンクのサイズは
          、含まれるパス名の長さで、null バイトで終わることはありません
          。

     タイムスタンプ:

      -- の属性: st_atime

          秒で表した最終アクセス時刻。

      -- の属性: st_mtime

          秒で表した最終内容更新時刻。

      -- の属性: st_ctime

          Time of most recent metadata change expressed in seconds.

          バージョン 3.12 で変更: ‘st_ctime’ is deprecated on Windows.
          Use ‘st_birthtime’ for the file creation time.  In the future,
          ‘st_ctime’ will contain the time of the most recent metadata
          change, as for other platforms.

      -- の属性: st_atime_ns

          ナノ秒 (整数) で表した最終アクセス時刻。

          Added in version 3.3.

      -- の属性: st_mtime_ns

          ナノ秒 (整数) で表した最終内容更新時刻。

          Added in version 3.3.

      -- の属性: st_ctime_ns

          Time of most recent metadata change expressed in nanoseconds
          as an integer.

          Added in version 3.3.

          バージョン 3.12 で変更: ‘st_ctime_ns’ is deprecated on
          Windows.  Use ‘st_birthtime_ns’ for the file creation time.
          In the future, ‘st_ctime’ will contain the time of the most
          recent metadata change, as for other platforms.

      -- の属性: st_birthtime

          Time of file creation expressed in seconds.  This attribute is
          not always available, and may raise *note AttributeError: 5f0.

          バージョン 3.12 で変更: ‘st_birthtime’ is now available on
          Windows.

      -- の属性: st_birthtime_ns

          Time of file creation expressed in nanoseconds as an integer.
          This attribute is not always available, and may raise *note
          AttributeError: 5f0.

          Added in version 3.12.

          注釈: The exact meaning and resolution of the *note st_atime:
          308a, *note st_mtime: 2f14, *note st_ctime: 308b. and *note
          st_birthtime: 308f. attributes depend on the operating system
          and the file system.  For example, on Windows systems using
          the FAT32 file systems, *note st_mtime: 2f14. has 2-second
          resolution, and *note st_atime: 308a. has only 1-day
          resolution.  See your operating system documentation for
          details.

          Similarly, although *note st_atime_ns: 308c, *note
          st_mtime_ns: 308d, *note st_ctime_ns: 308e. and *note
          st_birthtime_ns: 3090. are always expressed in nanoseconds,
          many systems do not provide nanosecond precision.  On systems
          that do provide nanosecond precision, the floating-point
          object used to store *note st_atime: 308a, *note st_mtime:
          2f14, *note st_ctime: 308b. and *note st_birthtime: 308f.
          cannot preserve all of it, and as such will be slightly
          inexact.  If you need the exact timestamps you should always
          use *note st_atime_ns: 308c, *note st_mtime_ns: 308d, *note
          st_ctime_ns: 308e. and *note st_birthtime_ns: 3090.

     (Linux のような ) 一部の Unix システムでは、以下の属性が利用できる
     場合があります :

      -- の属性: st_blocks

          ファイルに対して割り当てられている 512 バイトのブロックの数で
          す。ファイルにホール (hole) が含まれている場合、*note st_size:
          3089./512 より小さくなる場合があります。

      -- の属性: st_blksize

          効率的なファイルシステム I/O のための「推奨される」ブロックサ
          イズです。ファイルに、これより小さいチャンクで書き込むと、非効
          率的な読み込み、編集、再書き込みが起こる場合があります。

      -- の属性: st_rdev

          inode デバイスの場合デバイスタイプ

      -- の属性: st_flags

          ファイルのユーザ定義フラグ

     他の (FreeBSD のような ) Unix システムでは、以下の属性が利用できる
     場合があります ( ただし root ユーザ以外が使うと値が入っていない場合
     があります ):

      -- の属性: st_gen

          ファイル生成番号

     On Solaris and derivatives, the following attributes may also be
     available:

      -- の属性: st_fstype

          String that uniquely identifies the type of the filesystem
          that contains the file.

     On macOS systems, the following attributes may also be available:

      -- の属性: st_rsize

          ファイルの実際のサイズ

      -- の属性: st_creator

          ファイルの作成者

      -- の属性: st_type

          ファイルタイプ

     On Windows systems, the following attributes are also available:

      -- の属性: st_file_attributes

          Windows file attributes: ‘dwFileAttributes’ member of the
          ‘BY_HANDLE_FILE_INFORMATION’ structure returned by
          ‘GetFileInformationByHandle()’.  See the ‘FILE_ATTRIBUTE_*
          <stat.FILE_ATTRIBUTE_ARCHIVE>’ constants in the *note stat:
          d6. module.

          Added in version 3.5.

      -- の属性: st_reparse_tag

          When *note st_file_attributes: 1038. has the *note
          FILE_ATTRIBUTE_REPARSE_POINT: 2ca9. set, this field contains
          the tag identifying the type of reparse point.  See the *note
          IO_REPARSE_TAG_*: 2cae. constants in the *note stat: d6.
          module.

     The standard module *note stat: d6. defines functions and constants
     that are useful for extracting information from a ‘stat’ structure.
     (On Windows, some items are filled with dummy values.)

     For backward compatibility, a *note stat_result: 16da. instance is
     also accessible as a tuple of at least 10 integers giving the most
     important (and portable) members of the ‘stat’ structure, in the
     order *note st_mode: bff, *note st_ino: 3084, *note st_dev: 3085,
     *note st_nlink: 3086, *note st_uid: 3087, *note st_gid: 3088, *note
     st_size: 3089, *note st_atime: 308a, *note st_mtime: 2f14, *note
     st_ctime: 308b.  More items may be added at the end by some
     implementations.  For compatibility with older Python versions,
     accessing *note stat_result: 16da. as a tuple always returns
     integers.

     バージョン 3.5 で変更: Windows now returns the file index as *note
     st_ino: 3084. when available.

     バージョン 3.7 で変更: Added the *note st_fstype: d5b. member to
     Solaris/derivatives.

     バージョン 3.8 で変更: Added the *note st_reparse_tag: c00. member
     on Windows.

     バージョン 3.8 で変更: On Windows, the *note st_mode: bff. member
     now identifies special files as ‘S_IFCHR’, ‘S_IFIFO’ or ‘S_IFBLK’
     as appropriate.

     バージョン 3.12 で変更: On Windows, *note st_ctime: 308b. is
     deprecated.  Eventually, it will contain the last metadata change
     time, for consistency with other platforms, but for now still
     contains creation time.  Use *note st_birthtime: 308f. for the
     creation time.

     On Windows, *note st_ino: 3084. may now be up to 128 bits,
     depending on the file system.  Previously it would not be above 64
     bits, and larger file identifiers would be arbitrarily packed.

     On Windows, *note st_rdev: 17bf. no longer returns a value.
     Previously it would contain the same as *note st_dev: 3085, which
     was incorrect.

     Added the *note st_birthtime: 308f. member on Windows.

 -- の関数: os.statvfs (path)

     Perform a ‘statvfs()’ system call on the given path.  The return
     value is an object whose attributes describe the filesystem on the
     given path, and correspond to the members of the ‘statvfs’
     structure, namely: ‘f_bsize’, ‘f_frsize’, ‘f_blocks’, ‘f_bfree’,
     ‘f_bavail’, ‘f_files’, ‘f_ffree’, ‘f_favail’, ‘f_flag’,
     ‘f_namemax’, ‘f_fsid’.

     ‘f_flag’ 属性のビットフラグ用に 2 つのモジュールレベル定数が定義さ
     れています: ‘ST_RDONLY’ が設定されるとファイルシステムは読み出し専
     用でマウントされ、‘ST_NOSUID’ が設定されると setuid/setgid ビットの
     動作は無効になるか、サポートされません。

     GNU/glibc ベースのシステム用に、追加のモジュールレベルの定数が次の
     ように定義されています。 ‘ST_NODEV’ (デバイス特殊ファイルへのアクセ
     スを許可しない) 、 ‘ST_NOEXEC’ (プログラムの実行を許可しない) 、
     ‘ST_SYNCHRONOUS’ (書き込みが一度に同期される) 、‘ST_MANDLOCK’ (ファ
     イルシステムで強制的なロックを許可する) 、 ‘ST_WRITE’ (ファイル/デ
     ィレクトリ/シンボリックリンクに書き込む) 、 ‘ST_APPEND’ (追記のみの
     ファイル) 、‘ST_IMMUTABLE’ (変更不能なファイル) 、 ‘ST_NOATIME’ (ア
     クセス時刻を更新しない) 、‘ST_NODIRATIME’ (ディレクトリアクセス時刻
     を更新しない) 、‘ST_RELATIME’ (mtime/ctimeに対して相対的に atime を
     更新する)。

     この関数は *note ファイル記述子の指定: d53. をサポートしています。

     *note Availability: 213f.: Unix.

     バージョン 3.2 で変更: 定数 ‘ST_RDONLY’ および ‘ST_NOSUID’ が追加さ
     れました。

     バージョン 3.3 で変更: 'path' へのオープン・ファイル記述子の指定を
     サポートしました。

     バージョン 3.4 で変更: ‘ST_NODEV’, ‘ST_NOEXEC’, ‘ST_SYNCHRONOUS’,
     ‘ST_MANDLOCK’, ‘ST_WRITE’, ‘ST_APPEND’, ‘ST_IMMUTABLE’,
     ‘ST_NOATIME’, ‘ST_NODIRATIME’, ‘ST_RELATIME’ 定数が追加されました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.7 で変更: Added the ‘f_fsid’ attribute.

 -- データ: os.supports_dir_fd

     A *note set: 184. object indicating which functions in the ‘os’
     module accept an open file descriptor for their 'dir_fd' parameter.
     Different platforms provide different features, and the underlying
     functionality Python uses to implement the 'dir_fd' parameter is
     not available on all platforms Python supports.  For consistency's
     sake, functions that may support 'dir_fd' always allow specifying
     the parameter, but will throw an exception if the functionality is
     used when it's not locally available.  (Specifying ‘None’ for
     'dir_fd' is always supported on all platforms.)

     To check whether a particular function accepts an open file
     descriptor for its 'dir_fd' parameter, use the ‘in’ operator on
     ‘supports_dir_fd’.  As an example, this expression evaluates to
     ‘True’ if *note os.stat(): 26d. accepts open file descriptors for
     'dir_fd' on the local platform:

          os.stat in os.supports_dir_fd

     現在 'dir_fd' 引数は Unix プラットフォームでのみ動作します。Windows
     で動作する関数はありません。

     Added in version 3.3.

 -- データ: os.supports_effective_ids

     A *note set: 184. object indicating whether *note os.access():
     1304. permits specifying ‘True’ for its 'effective_ids' parameter
     on the local platform.  (Specifying ‘False’ for 'effective_ids' is
     always supported on all platforms.)  If the local platform supports
     it, the collection will contain *note os.access(): 1304.; otherwise
     it will be empty.

     This expression evaluates to ‘True’ if *note os.access(): 1304.
     supports ‘effective_ids=True’ on the local platform:

          os.access in os.supports_effective_ids

     現在 'effective_ids' は Unix プラットフォームでのみサポートされてい
     ます。Windows では動作しません。

     Added in version 3.3.

 -- データ: os.supports_fd

     A *note set: 184. object indicating which functions in the ‘os’
     module permit specifying their 'path' parameter as an open file
     descriptor on the local platform.  Different platforms provide
     different features, and the underlying functionality Python uses to
     accept open file descriptors as 'path' arguments is not available
     on all platforms Python supports.

     To determine whether a particular function permits specifying an
     open file descriptor for its 'path' parameter, use the ‘in’
     operator on ‘supports_fd’.  As an example, this expression
     evaluates to ‘True’ if *note os.chdir(): 821. accepts open file
     descriptors for 'path' on your local platform:

          os.chdir in os.supports_fd

     Added in version 3.3.

 -- データ: os.supports_follow_symlinks

     A *note set: 184. object indicating which functions in the ‘os’
     module accept ‘False’ for their 'follow_symlinks' parameter on the
     local platform.  Different platforms provide different features,
     and the underlying functionality Python uses to implement
     'follow_symlinks' is not available on all platforms Python
     supports.  For consistency's sake, functions that may support
     'follow_symlinks' always allow specifying the parameter, but will
     throw an exception if the functionality is used when it's not
     locally available.  (Specifying ‘True’ for 'follow_symlinks' is
     always supported on all platforms.)

     To check whether a particular function accepts ‘False’ for its
     'follow_symlinks' parameter, use the ‘in’ operator on
     ‘supports_follow_symlinks’.  As an example, this expression
     evaluates to ‘True’ if you may specify ‘follow_symlinks=False’ when
     calling *note os.stat(): 26d. on the local platform:

          os.stat in os.supports_follow_symlinks

     Added in version 3.3.

 -- の関数: os.symlink (src, dst, target_is_directory=False, *,
          dir_fd=None)

     'src' を指し示すシンボリックリンク 'dst' を作成します。

     The 'src' parameter refers to the target of the link (the file or
     directory being linked to), and 'dst' is the name of the link being
     created.

     Windows では、シンボリックリンクはファイルかディレクトリのどちらか
     を表しますが、ターゲットに合わせて動的に変化することはありません。
     ターゲットが存在する場合、シンボリックリンクの種類は対象に合わせて
     作成されます。ターゲットが存在せず 'target_is_directory' に ‘True’
     が設定された場合、シンボリックリンクはディレクトリのリンクとして作
     成され、‘False’ に設定された場合 (デフォルト) はファイルのリンクに
     なります。Windows 以外のプラットフォームでは 'target_is_directory'
     は無視されます。

     この関数は *note ディレクトリ記述子への相対パス: 1302. をサポートし
     ています。

          注釈: On newer versions of Windows 10, unprivileged accounts
          can create symlinks if Developer Mode is enabled.  When
          Developer Mode is not available/enabled, the
          'SeCreateSymbolicLinkPrivilege' privilege is required, or the
          process must be run as an administrator.

          この関数が特権を持たないユーザーに呼び出されると、*note
          OSError: 2c0. が送出されます。

     引数 ‘src’, ‘dst’, ‘dir_fd’ を指定して *note 監査イベント: 1c6e.
     ‘os.symlink’ を送出します。

     *note Availability: 213f.: Unix, Windows.

     The function is limited on WASI, see *note WebAssembly
     プラットフォーム: 1b6a. for more information.

     バージョン 3.2 で変更: Windows 6.0 (Vista) のシンボリックリンクをサ
     ポートしました。

     バージョン 3.3 で変更: Added the 'dir_fd' parameter, and now allow
     'target_is_directory' on non-Windows platforms.

     バージョン 3.6 で変更: 'src' と 'dst' が *note path-like object:
     5a1. を受け付けるようになりました。

     バージョン 3.8 で変更: Added support for unelevated symlinks on
     Windows with Developer Mode.

 -- の関数: os.sync ()

     ディスクキャッシュのディスクへの書き出しを強制します。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

 -- の関数: os.truncate (path, length)

     'path' に対応するファイルを、サイズが最大で 'length' バイトになるよ
     う切り詰めます。

     この関数は *note ファイル記述子の指定: d53. をサポートしています。

     引数 ‘path’, ‘length’ を指定して *note 監査イベント: 1c6e.
     ‘os.truncate’ を送出します。

     *note Availability: 213f.: Unix, Windows.

     Added in version 3.3.

     バージョン 3.5 で変更: Windows サポートを追加しました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.unlink (path, *, dir_fd=None)

     ファイル 'path' を削除します。意味上は *note remove(): 1308. と等価
     です。‘unlink’ の名前は伝統的な Unix の関数名です。詳細は *note
     remove(): 1308. のドキュメントを参照してください。

     引数 ‘path’, ‘dir_fd’ を指定して *note 監査イベント: 1c6e.
     ‘os.remove’ を送出します。

     バージョン 3.3 で変更: 引数 'dir_fd' を追加しました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.utime (path, times=None, *[, ns], dir_fd=None,
          follow_symlinks=True)

     'path' で指定されたファイルに最終アクセス時刻および最終修正時刻を設
     定します。

     *note utime(): 130e. は 2 つの任意引数 'times' と 'ns' をとります。
     これらは 'path' に設定する時刻を指定し、以下のように使用されます:

        - 'ns' を指定する場合、ナノ秒を表す整数値をメンバーとして使用し
          て、 ‘(atime_ns, mtime_ns)’ の形式の 2 要素タプルを指定する必
          要があります。

        - 'times' が ‘None’ ではない場合、‘(atime, mtime)’ の形式で各メ
          ンバーは単位を秒で表す整数か浮動小数点値のタプルを指定しなけれ
          ばなりません。

        - 'times' が ‘None’ で、 'ns' が指定されていない場合、これは両方
          の時間を現在時刻として ‘ns=(atime_ns, mtime_ns)’ を指定するこ
          とと等価です。

     'times' と 'ns' の両方にタプルが指定されるとエラーになります。

     ここで設定した時刻が、後に *note stat(): 26d. の呼び出し時正確に返
     されない場合があります。これはオペレーティングシステムが記録するア
     クセスおよび修正時刻の精度に依存しています; *note stat(): 26d. を参
     照してください。正確な時刻を保持する最善の方法は、*note utime():
     130e. で 'ns' 引数を指定し、*note os.stat(): 26d. の返り値オブジェ
     クトから 'st_atime_ns' および 'st_mtime_ns' フィールドを使用するこ
     とです。

     この関数は *note ファイル記述子の指定: d53. 、 *note
     ディレクトリ記述子への相対パス: 1302. 、および *note
     シンボリックリンクをたどらない: 1303. をサポートしています。

     引数 ‘path’, ‘times’, ‘ns’, ‘dir_fd’ を指定して *note 監査イベント:
     1c6e. ‘os.utime’ を送出します。

     バージョン 3.3 で変更: 'path' にオープンしているファイル記述子の指
     定のサポート、および引数 'dir_fd', 'follow_symlinks', 'ns' を追加し
     ました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.walk (top, topdown=True, onerror=None, followlinks=False)

     ディレクトリツリー以下のファイル名を、ツリーをトップダウンもしくは
     ボトムアップに走査することで作成します。ディレクトリ 'top' を根に持
     つディレクトリツリーに含まれる、各ディレクトリ ('top' 自身を含む )
     ごとに、タプル ‘(dirpath, dirnames, filenames)’ を yield します。

     'dirpath' is a string, the path to the directory.  'dirnames' is a
     list of the names of the subdirectories in 'dirpath' (including
     symlinks to directories, and excluding ‘'.'’ and ‘'..'’).
     'filenames' is a list of the names of the non-directory files in
     'dirpath'.  Note that the names in the lists contain no path
     components.  To get a full path (which begins with 'top') to a file
     or directory in 'dirpath', do ‘os.path.join(dirpath, name)’.
     Whether or not the lists are sorted depends on the file system.  If
     a file is removed from or added to the 'dirpath' directory during
     generating the lists, whether a name for that file be included is
     unspecified.

     オプション引数 'topdown' が ‘True’ であるか、指定されなかった場合、
     各ディレクトリからタプルを生成した後で、サブディレクトリからタプル
     を生成します。( ディレクトリはトップダウンで生成 ) 。 'topdown' が
     ‘False’ の場合、ディレクトリに対応するタプルは、そのディレクトリ以
     下の全てのサブディレクトリに対応するタプルの後で ( ボトムアップで )
     生成されます。 'topdown' の値によらず、サブディレクトリのリストは、
     ディレクトリとそのサブディレクトリのタプルを生成する前に取り出され
     ます。

     'topdown' が ‘True’ のとき、呼び出し側は 'dirnames' リストを、イン
     プレースで ( たとえば、 *note del: 1b1f. やスライスを使った代入で )
     変更でき、 *note walk(): 6d0. は 'dirnames' に残っているサブディレ
     クトリ内のみを再帰します。これにより、検索を省略したり、特定の訪問
     順序を強制したり、呼び出し側が *note walk(): 6d0. を再開する前に、
     呼び出し側が作った、または名前を変更したディレクトリを、 *note
     walk(): 6d0. に知らせたりすることができます。 'topdown' が ‘False’
     のときに 'dirnames' を変更しても効果はありません。ボトムアップモー
     ドでは 'dirpath' 自身が生成される前に 'dirnames' 内のディレクトリの
     情報が生成されるからです。

     デフォルトでは、 *note scandir(): c54. 呼び出しからのエラーは無視さ
     れます。オプション引数の 'onerror' を指定する場合は関数でなければな
     りません ; この関数は単一の引数として *note OSError: 2c0. インスタ
     ンスを伴って呼び出されます。この関数でエラーを報告して走査を継続し
     たり、例外を送出して走査を中止したりできます。ファイル名は例外オブ
     ジェクトの ‘filename’ 属性として利用できます。

     デフォルトでは、 *note walk(): 6d0. はディレクトリへのシンボリック
     リンクをたどりません。 'followlinks' に ‘True’ を指定すると、ディレ
     クトリへのシンボリックリンクをサポートしているシステムでは、シンボ
     リックリンクの指しているディレクトリを走査します。

          注釈: 'followlinks' に ‘True’ を指定すると、シンボリックリンク
          が親ディレクトリを指していた場合に、無限ループになることに注意
          してください。 *note walk(): 6d0. はすでにたどったディレクトリ
          を管理したりはしません。

          注釈: 相対パスを渡した場合、 *note walk(): 6d0. が再開されるま
          での間に現在の作業ディレクトリを変更しないでください。 *note
          walk(): 6d0. はカレントディレクトリを変更しませんし、呼び出し
          側もカレントディレクトリを変更しないと仮定しています。

     This example displays the number of bytes taken by non-directory
     files in each directory under the starting directory, except that
     it doesn't look under any ‘__pycache__’ subdirectory:

          import os
          from os.path import join, getsize
          for root, dirs, files in os.walk('python/Lib/xml'):
              print(root, "consumes", end=" ")
              print(sum(getsize(join(root, name)) for name in files), end=" ")
              print("bytes in", len(files), "non-directory files")
              if '__pycache__' in dirs:
                  dirs.remove('__pycache__')  # don't visit __pycache__ directories

     次の例 (*note shutil.rmtree(): 356. の単純な実装) では、ツリーをボ
     トムアップで走査することが不可欠になります; *note rmdir(): 130b. は
     ディレクトリが空になるまで削除を許さないからです:

          # Delete everything reachable from the directory named in "top",
          # assuming there are no symbolic links.
          # CAUTION:  This is dangerous!  For example, if top == '/', it
          # could delete all your disk files.
          import os
          for root, dirs, files in os.walk(top, topdown=False):
              for name in files:
                  os.remove(os.path.join(root, name))
              for name in dirs:
                  os.rmdir(os.path.join(root, name))
          os.rmdir(top)

     引数 ‘top’, ‘topdown’, ‘onerror’, ‘followlinks’ を指定して *note
     監査イベント: 1c6e. ‘os.walk’ を送出します。

     バージョン 3.5 で変更: この関数は、今では *note os.listdir(): 1312.
     ではなく *note os.scandir(): c54. を呼び出します。これにより、
     *note os.stat(): 26d. の呼び出し回数を削減でき、動作が高速化します
     。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.fwalk (top='.', topdown=True, onerror=None, *,
          follow_symlinks=False, dir_fd=None)

     挙動は *note walk(): 6d0. と同じですが、‘dir_fd’ をサポートし、タプ
     ル ‘(dirpath, dirnames, filenames, dirfd)’ を yield します。

     'dirpath'、'dirnames'、および 'filenames' は *note walk(): 6d0. の
     出力と同じで、'dirfd' は 'dirpath' を参照するファイル記述子です。

     この関数は常に *note ディレクトリ記述子への相対パス: 1302. および
     *note シンボリックリンクをたどらない: 1303. をサポートしています。
     ただし、他の関数と異なり、*note fwalk(): d52. での
     'follow_symlinks' のデフォルト値は ‘False’ になることに注意してくだ
     さい。

          注釈: *note fwalk(): d52. はファイル記述子を yield するため、
          それらが有効なのは次のイテレートステップまでです。それ以後も保
          持したい場合は *note dup(): 1dc2. などを使って複製して使用して
          ください。

     This example displays the number of bytes taken by non-directory
     files in each directory under the starting directory, except that
     it doesn't look under any ‘__pycache__’ subdirectory:

          import os
          for root, dirs, files, rootfd in os.fwalk('python/Lib/xml'):
              print(root, "consumes", end=" ")
              print(sum([os.stat(name, dir_fd=rootfd).st_size for name in files]),
                    end=" ")
              print("bytes in", len(files), "non-directory files")
              if '__pycache__' in dirs:
                  dirs.remove('__pycache__')  # don't visit __pycache__ directories

     次の例では、ツリーをボトムアップで走査することが不可欠になります ;
     *note rmdir(): 130b. はディレクトリが空になるまで削除を許さないから
     です

          # Delete everything reachable from the directory named in "top",
          # assuming there are no symbolic links.
          # CAUTION:  This is dangerous!  For example, if top == '/', it
          # could delete all your disk files.
          import os
          for root, dirs, files, rootfd in os.fwalk(top, topdown=False):
              for name in files:
                  os.unlink(name, dir_fd=rootfd)
              for name in dirs:
                  os.rmdir(name, dir_fd=rootfd)

     引数 ‘top’, ‘topdown’, ‘onerror’, ‘follow_symlinks’ を指定して
     *note 監査イベント: 1c6e. ‘os.fwalk’ を送出します。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.7 で変更: Added support for *note bytes: 192. paths.

 -- の関数: os.memfd_create (name[, flags=os.MFD_CLOEXEC])

     Create an anonymous file and return a file descriptor that refers
     to it.  'flags' must be one of the ‘os.MFD_*’ constants available
     on the system (or a bitwise ORed combination of them).  By default,
     the new file descriptor is *note non-inheritable: 10fc.

     The name supplied in 'name' is used as a filename and will be
     displayed as the target of the corresponding symbolic link in the
     directory ‘/proc/self/fd/’.  The displayed name is always prefixed
     with ‘memfd:’ and serves only for debugging purposes.  Names do not
     affect the behavior of the file descriptor, and as such multiple
     files can have the same name without any side effects.

     *note Availability: 213f.: Linux >= 3.17 with glibc >= 2.27.

     Added in version 3.8.

 -- データ: os.MFD_CLOEXEC
 -- データ: os.MFD_ALLOW_SEALING
 -- データ: os.MFD_HUGETLB
 -- データ: os.MFD_HUGE_SHIFT
 -- データ: os.MFD_HUGE_MASK
 -- データ: os.MFD_HUGE_64KB
 -- データ: os.MFD_HUGE_512KB
 -- データ: os.MFD_HUGE_1MB
 -- データ: os.MFD_HUGE_2MB
 -- データ: os.MFD_HUGE_8MB
 -- データ: os.MFD_HUGE_16MB
 -- データ: os.MFD_HUGE_32MB
 -- データ: os.MFD_HUGE_256MB
 -- データ: os.MFD_HUGE_512MB
 -- データ: os.MFD_HUGE_1GB
 -- データ: os.MFD_HUGE_2GB
 -- データ: os.MFD_HUGE_16GB

     These flags can be passed to *note memfd_create(): bfe.

     *note Availability: 213f.: Linux >= 3.17 with glibc >= 2.27

     The ‘MFD_HUGE*’ flags are only available since Linux 4.14.

     Added in version 3.8.

 -- の関数: os.eventfd (initval[, flags=os.EFD_CLOEXEC])

     Create and return an event file descriptor.  The file descriptors
     supports raw *note read(): f95. and *note write(): f9b. with a
     buffer size of 8, *note select(): fa0, *note poll(): 30a9. and
     similar.  See man page ‘eventfd(2)(9)’ for more information.  By
     default, the new file descriptor is *note non-inheritable: 10fc.

     'initval' is the initial value of the event counter.  The initial
     value must be a 32 bit unsigned integer.  Please note that the
     initial value is limited to a 32 bit unsigned int although the
     event counter is an unsigned 64 bit integer with a maximum value of
     2^64-2.

     'flags' can be constructed from *note EFD_CLOEXEC: 1b58, *note
     EFD_NONBLOCK: 1b59, and *note EFD_SEMAPHORE: 1b5a.

     If *note EFD_SEMAPHORE: 1b5a. is specified and the event counter is
     non-zero, *note eventfd_read(): 30aa. returns 1 and decrements the
     counter by one.

     If *note EFD_SEMAPHORE: 1b5a. is not specified and the event
     counter is non-zero, *note eventfd_read(): 30aa. returns the
     current event counter value and resets the counter to zero.

     If the event counter is zero and *note EFD_NONBLOCK: 1b59. is not
     specified, *note eventfd_read(): 30aa. blocks.

     *note eventfd_write(): 30ab. increments the event counter.  Write
     blocks if the write operation would increment the counter to a
     value larger than 2^64-2.

     以下はプログラム例です:

          import os

          # semaphore with start value '1'
          fd = os.eventfd(1, os.EFD_SEMAPHORE | os.EFD_CLOEXEC)
          try:
              # acquire semaphore
              v = os.eventfd_read(fd)
              try:
                  do_work()
              finally:
                  # release semaphore
                  os.eventfd_write(fd, v)
          finally:
              os.close(fd)

     *note Availability: 213f.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.10.

 -- の関数: os.eventfd_read (fd)

     Read value from an *note eventfd(): a19. file descriptor and return
     a 64 bit unsigned int.  The function does not verify that 'fd' is
     an *note eventfd(): a19.

     *note Availability: 213f.: Linux >= 2.6.27

     Added in version 3.10.

 -- の関数: os.eventfd_write (fd, value)

     Add value to an *note eventfd(): a19. file descriptor.  'value'
     must be a 64 bit unsigned int.  The function does not verify that
     'fd' is an *note eventfd(): a19.

     *note Availability: 213f.: Linux >= 2.6.27

     Added in version 3.10.

 -- データ: os.EFD_CLOEXEC

     Set close-on-exec flag for new *note eventfd(): a19. file
     descriptor.

     *note Availability: 213f.: Linux >= 2.6.27

     Added in version 3.10.

 -- データ: os.EFD_NONBLOCK

     Set *note O_NONBLOCK: 103b. status flag for new *note eventfd():
     a19. file descriptor.

     *note Availability: 213f.: Linux >= 2.6.27

     Added in version 3.10.

 -- データ: os.EFD_SEMAPHORE

     Provide semaphore-like semantics for reads from an *note eventfd():
     a19. file descriptor.  On read the internal counter is decremented
     by one.

     *note Availability: 213f.: Linux >= 2.6.30

     Added in version 3.10.

* Menu:

* Timer File Descriptors::
* Linux 拡張属性::

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/access(2)

   (2) https://peps.python.org/pep-0529/

   (3) https://bugs.python.org/issue?@action=redirect&bpo=21082

   (4) 
https://pubs.opengroup.org/onlinepubs/009695399/functions/opendir.html

   (5) 
https://pubs.opengroup.org/onlinepubs/009695399/functions/readdir_r.html

   (6) 
https://msdn.microsoft.com/en-us/library/windows/desktop/aa364418(v=vs.85).aspx

   (7) 
https://msdn.microsoft.com/en-us/library/windows/desktop/aa364428(v=vs.85).aspx

   (8) https://msdn.microsoft.com/en-us/library/aa363788

   (9) https://manpages.debian.org/eventfd(2)


File: python.info,  Node: Timer File Descriptors,  Next: Linux 拡張属性,  Up: ファイルとディレクトリ

5.16.1.9 Timer File Descriptors
...............................

Added in version 3.13.

These functions provide support for Linux's 'timer file descriptor' API.
Naturally, they are all only available on Linux.

 -- の関数: os.timerfd_create (clockid, /, *, flags=0)

     Create and return a timer file descriptor ('timerfd').

     The file descriptor returned by *note timerfd_create(): 51f.
     supports:

        - *note read(): f95.

        - *note select(): fa0.

        - *note poll(): 30a9.

     The file descriptor's *note read(): f95. method can be called with
     a buffer size of 8.  If the timer has already expired one or more
     times, *note read(): f95. returns the number of expirations with
     the host's endianness, which may be converted to an *note int: 19b.
     by ‘int.from_bytes(x, byteorder=sys.byteorder)’.

     *note select(): fa0. and *note poll(): 30a9. can be used to wait
     until timer expires and the file descriptor is readable.

     'clockid' must be a valid *note clock ID: 30ad, as defined in the
     *note time: f4. module:

        - *note time.CLOCK_REALTIME: 8a9.

        - *note time.CLOCK_MONOTONIC: 8a8.

        - *note time.CLOCK_BOOTTIME: d87. (Since Linux 3.15 for
          timerfd_create)

     If 'clockid' is *note time.CLOCK_REALTIME: 8a9, a settable
     system-wide real-time clock is used.  If system clock is changed,
     timer setting need to be updated.  To cancel timer when system
     clock is changed, see *note TFD_TIMER_CANCEL_ON_SET: 527.

     If 'clockid' is *note time.CLOCK_MONOTONIC: 8a8, a non-settable
     monotonically increasing clock is used.  Even if the system clock
     is changed, the timer setting will not be affected.

     If 'clockid' is *note time.CLOCK_BOOTTIME: d87, same as *note
     time.CLOCK_MONOTONIC: 8a8. except it includes any time that the
     system is suspended.

     The file descriptor's behaviour can be modified by specifying a
     'flags' value.  Any of the following variables may be used,
     combined using bitwise OR (the ‘|’ operator):

        - *note TFD_NONBLOCK: 524.

        - *note TFD_CLOEXEC: 525.

     If *note TFD_NONBLOCK: 524. is not set as a flag, *note read():
     f95. blocks until the timer expires.  If it is set as a flag, *note
     read(): f95. doesn't block, but If there hasn't been an expiration
     since the last call to read, *note read(): f95. raises *note
     OSError: 2c0. with ‘errno’ is set to *note errno.EAGAIN: 26fd.

     *note TFD_CLOEXEC: 525. is always set by Python automatically.

     The file descriptor must be closed with *note os.close(): d6b. when
     it is no longer needed, or else the file descriptor will be leaked.

     参考
     ....

     The ‘timerfd_create(2)(1)’ man page.

     *note Availability: 213f.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.13.

 -- の関数: os.timerfd_settime (fd, /, *, flags=flags, initial=0.0,
          interval=0.0)

     Alter a timer file descriptor's internal timer.  This function
     operates the same interval timer as *note timerfd_settime_ns():
     521.

     'fd' must be a valid timer file descriptor.

     The timer's behaviour can be modified by specifying a 'flags'
     value.  Any of the following variables may be used, combined using
     bitwise OR (the ‘|’ operator):

        - *note TFD_TIMER_ABSTIME: 526.

        - *note TFD_TIMER_CANCEL_ON_SET: 527.

     The timer is disabled by setting 'initial' to zero (‘0’).  If
     'initial' is equal to or greater than zero, the timer is enabled.
     If 'initial' is less than zero, it raises an *note OSError: 2c0.
     exception with ‘errno’ set to *note errno.EINVAL: 1dd2.

     By default the timer will fire when 'initial' seconds have elapsed.
     (If 'initial' is zero, timer will fire immediately.)

     However, if the *note TFD_TIMER_ABSTIME: 526. flag is set, the
     timer will fire when the timer's clock (set by 'clockid' in *note
     timerfd_create(): 51f.) reaches 'initial' seconds.

     The timer's interval is set by the 'interval' *note float: 196.  If
     'interval' is zero, the timer only fires once, on the initial
     expiration.  If 'interval' is greater than zero, the timer fires
     every time 'interval' seconds have elapsed since the previous
     expiration.  If 'interval' is less than zero, it raises *note
     OSError: 2c0. with ‘errno’ set to *note errno.EINVAL: 1dd2.

     If the *note TFD_TIMER_CANCEL_ON_SET: 527. flag is set along with
     *note TFD_TIMER_ABSTIME: 526. and the clock for this timer is *note
     time.CLOCK_REALTIME: 8a9, the timer is marked as cancelable if the
     real-time clock is changed discontinuously.  Reading the descriptor
     is aborted with the error ECANCELED.

     Linux manages system clock as UTC. A daylight-savings time
     transition is done by changing time offset only and doesn't cause
     discontinuous system clock change.

     Discontinuous system clock change will be caused by the following
     events:

        - ‘settimeofday’

        - ‘clock_settime’

        - set the system date and time by ‘date’ command

     Return a two-item tuple of (‘next_expiration’, ‘interval’) from the
     previous timer state, before this function executed.

     参考
     ....

     ‘timerfd_create(2)(2)’, ‘timerfd_settime(2)(3)’,
     ‘settimeofday(2)(4)’, ‘clock_settime(2)(5)’, and ‘date(1)(6)’.

     *note Availability: 213f.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.13.

 -- の関数: os.timerfd_settime_ns (fd, /, *, flags=0, initial=0,
          interval=0)

     Similar to *note timerfd_settime(): 520, but use time as
     nanoseconds.  This function operates the same interval timer as
     *note timerfd_settime(): 520.

     *note Availability: 213f.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.13.

 -- の関数: os.timerfd_gettime (fd, /)

     Return a two-item tuple of floats (‘next_expiration’, ‘interval’).

     ‘next_expiration’ denotes the relative time until the timer next
     fires, regardless of if the *note TFD_TIMER_ABSTIME: 526. flag is
     set.

     ‘interval’ denotes the timer's interval.  If zero, the timer will
     only fire once, after ‘next_expiration’ seconds have elapsed.

     参考
     ....

     ‘timerfd_gettime(2)(7)’

     *note Availability: 213f.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.13.

 -- の関数: os.timerfd_gettime_ns (fd, /)

     Similar to *note timerfd_gettime(): 522, but return time as
     nanoseconds.

     *note Availability: 213f.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.13.

 -- データ: os.TFD_NONBLOCK

     A flag for the *note timerfd_create(): 51f. function, which sets
     the *note O_NONBLOCK: 103b. status flag for the new timer file
     descriptor.  If *note TFD_NONBLOCK: 524. is not set as a flag,
     *note read(): f95. blocks.

     *note Availability: 213f.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.13.

 -- データ: os.TFD_CLOEXEC

     A flag for the *note timerfd_create(): 51f. function, If *note
     TFD_CLOEXEC: 525. is set as a flag, set close-on-exec flag for new
     file descriptor.

     *note Availability: 213f.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.13.

 -- データ: os.TFD_TIMER_ABSTIME

     A flag for the *note timerfd_settime(): 520. and *note
     timerfd_settime_ns(): 521. functions.  If this flag is set,
     'initial' is interpreted as an absolute value on the timer's clock
     (in UTC seconds or nanoseconds since the Unix Epoch).

     *note Availability: 213f.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.13.

 -- データ: os.TFD_TIMER_CANCEL_ON_SET

     A flag for the *note timerfd_settime(): 520. and *note
     timerfd_settime_ns(): 521. functions along with *note
     TFD_TIMER_ABSTIME: 526.  The timer is cancelled when the time of
     the underlying clock changes discontinuously.

     *note Availability: 213f.: Linux >= 2.6.27 with glibc >= 2.8

     Added in version 3.13.

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/timerfd_create(2)

   (2) https://manpages.debian.org/timerfd_create(2)

   (3) https://manpages.debian.org/timerfd_settime(2)

   (4) https://manpages.debian.org/settimeofday(2)

   (5) https://manpages.debian.org/clock_settime(2)

   (6) https://manpages.debian.org/date(1)

   (7) https://manpages.debian.org/timerfd_gettime(2)


File: python.info,  Node: Linux 拡張属性,  Prev: Timer File Descriptors,  Up: ファイルとディレクトリ

5.16.1.10 Linux 拡張属性
........................

Added in version 3.3.

以下の関数はすべて Linux でのみ使用可能です。

 -- の関数: os.getxattr (path, attribute, *, follow_symlinks=True)

     Return the value of the extended filesystem attribute 'attribute'
     for 'path'.  'attribute' can be bytes or str (directly or
     indirectly through the *note PathLike: e4b. interface).  If it is
     str, it is encoded with the filesystem encoding.

     この関数は *note ファイル記述子の指定: d53. および *note
     シンボリックリンクをたどらない: 1303. をサポートしています。

     引数 ‘path’, ‘attribute’ を指定して *note 監査イベント: 1c6e.
     ‘os.getxattr’ を送出します。

     バージョン 3.6 で変更: 'path' と 'attribute' が *note path-like
     object: 5a1. を受け付けるようになりました。

 -- の関数: os.listxattr (path=None, *, follow_symlinks=True)

     'path' の拡張ファイルシステム属性のリストを返します。リスト内の属性
     はファイルシステムのエンコーディングでデコードされた文字列で表され
     ます。'path' が ‘None’ の場合、*note listxattr(): 131d. はカレント
     ディレクトリを調べます。

     この関数は *note ファイル記述子の指定: d53. および *note
     シンボリックリンクをたどらない: 1303. をサポートしています。

     引数 ‘path’ を指定して *note 監査イベント: 1c6e. ‘os.listxattr’ を
     送出します。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os.removexattr (path, attribute, *, follow_symlinks=True)

     Removes the extended filesystem attribute 'attribute' from 'path'.
     'attribute' should be bytes or str (directly or indirectly through
     the *note PathLike: e4b. interface).  If it is a string, it is
     encoded with the *note filesystem encoding and error handler: 75d.

     この関数は *note ファイル記述子の指定: d53. および *note
     シンボリックリンクをたどらない: 1303. をサポートしています。

     引数 ‘path’, ‘attribute’ を指定して *note 監査イベント: 1c6e.
     ‘os.removexattr’ を送出します。

     バージョン 3.6 で変更: 'path' と 'attribute' が *note path-like
     object: 5a1. を受け付けるようになりました。

 -- の関数: os.setxattr (path, attribute, value, flags=0, *,
          follow_symlinks=True)

     Set the extended filesystem attribute 'attribute' on 'path' to
     'value'.  'attribute' must be a bytes or str with no embedded NULs
     (directly or indirectly through the *note PathLike: e4b.
     interface).  If it is a str, it is encoded with the *note
     filesystem encoding and error handler: 75d.  'flags' may be *note
     XATTR_REPLACE: 30af. or *note XATTR_CREATE: 30b0.  If *note
     XATTR_REPLACE: 30af. is given and the attribute does not exist,
     ‘ENODATA’ will be raised.  If *note XATTR_CREATE: 30b0. is given
     and the attribute already exists, the attribute will not be created
     and ‘EEXISTS’ will be raised.

     この関数は *note ファイル記述子の指定: d53. および *note
     シンボリックリンクをたどらない: 1303. をサポートしています。

          注釈: Linux カーネル 2.6.39 以前では、バグのため一部のファイル
          システムで引数 flags が無視されます。

     引数 ‘path’, ‘attribute’, ‘value’, ‘flags’ を指定して *note
     監査イベント: 1c6e. ‘os.setxattr’ を送出します。

     バージョン 3.6 で変更: 'path' と 'attribute' が *note path-like
     object: 5a1. を受け付けるようになりました。

 -- データ: os.XATTR_SIZE_MAX

     拡張属性の値にできる最大サイズです。現在、Linux では 64 キロバイト
     です。

 -- データ: os.XATTR_CREATE

     *note setxattr(): 131f. の引数 flags に指定できる値です。その操作で
     属性を作成しなければならないことを意味します。

 -- データ: os.XATTR_REPLACE

     *note setxattr(): 131f. の引数 flags に指定できる値です。その操作で
     既存の属性を置き換えなければならないことを意味します。


File: python.info,  Node: プロセス管理,  Next: スケジューラーへのインターフェイス,  Prev: ファイルとディレクトリ,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.16.1.11 プロセス管理
......................

以下の関数はプロセスの生成や管理に利用できます。

さまざまな *note exec*: 30b4. 関数は、プロセス内にロードされる新しいプロ
グラムに与えるための、引数のリストを取ります。どの関数の場合でも、新しい
プログラムに渡されるリストの最初の引数は、ユーザがコマンドラインで入力す
る引数ではなく、そのプログラム自体の名前です。 C プログラマならば、プロ
グラムの ‘main()’ に渡される ‘argv[0]’ だと考えれば良いでしょう。たとえ
ば、 ‘os.execv('/bin/echo', ['foo', 'bar'])’ が標準出力に出力するのは
‘bar’ だけで、 ‘foo’ は無視されたかのように見えることになります。

 -- の関数: os.abort ()

     ‘SIGABRT’ シグナルを現在のプロセスに対して生成します。 Unix では、
     デフォルトの動作はコアダンプの生成です ; Windows では、プロセスは即
     座に終了コード ‘3’ を返します。この関数の呼び出しは *note
     signal.signal(): 134c. を使って ‘SIGABRT’ に対し登録された Python シ
     グナルハンドラーを呼び出さないことに注意してください。

 -- の関数: os.add_dll_directory (path)

     Add a path to the DLL search path.

     This search path is used when resolving dependencies for imported
     extension modules (the module itself is resolved through *note
     sys.path: 3e4.), and also by *note ctypes: 2e.

     Remove the directory by calling 'close()' on the returned object or
     using it in a *note with: 186. statement.

     See the Microsoft documentation(1) for more information about how
     DLLs are loaded.

     引数 ‘path’ を指定して *note 監査イベント: 1c6e.
     ‘os.add_dll_directory’ を送出します。

     *note Availability: 213f.: Windows.

     Added in version 3.8: Previous versions of CPython would resolve
     DLLs using the default behavior for the current process.  This led
     to inconsistencies, such as only sometimes searching ‘PATH’ or the
     current working directory, and OS functions such as
     ‘AddDllDirectory’ having no effect.

     In 3.8, the two primary ways DLLs are loaded now explicitly
     override the process-wide behavior to ensure consistency.  See the
     *note porting notes: c95. for information on updating libraries.

 -- の関数: os.execl (path, arg0, arg1, ...)
 -- の関数: os.execle (path, arg0, arg1, ..., env)
 -- の関数: os.execlp (file, arg0, arg1, ...)
 -- の関数: os.execlpe (file, arg0, arg1, ..., env)
 -- の関数: os.execv (path, args)
 -- の関数: os.execve (path, args, env)
 -- の関数: os.execvp (file, args)
 -- の関数: os.execvpe (file, args, env)

     これらの関数はすべて、現在のプロセスを置き換える形で新たなプログラ
     ムを実行します ; 現在のプロセスは返り値を返しません。 Unix では、新
     たに実行される実行コードは現在のプロセス内に読み込まれ、呼び出し側
     と同じプロセス ID を持つことになります。エラーは *note OSError:
     2c0. 例外として報告されます。

     現在のプロセスは瞬時に置き換えられます。開かれているファイルオブジ
     ェクトやファイル記述子はフラッシュされません。そのため、バッファ内
     にデータが残っているかもしれない場合、 *note exec*: 30b4. 関数を実
     行する前に ‘sys.stdout.flush()’ か *note os.fsync(): f8e. を利用し
     てバッファをフラッシュしておく必要があります。

     The "l" and "v" variants of the *note exec*: 30b4. functions differ
     in how command-line arguments are passed.  The "l" variants are
     perhaps the easiest to work with if the number of parameters is
     fixed when the code is written; the individual parameters simply
     become additional parameters to the ‘execl*()’ functions.  The "v"
     variants are good when the number of parameters is variable, with
     the arguments being passed in a list or tuple as the 'args'
     parameter.  In either case, the arguments to the child process
     should start with the name of the command being run, but this is
     not enforced.

     The variants which include a "p" near the end (*note execlp():
     30b7, *note execlpe(): 30b8, *note execvp(): 30b9, and *note
     execvpe(): 30ba.) will use the ‘PATH’ environment variable to
     locate the program 'file'.  When the environment is being replaced
     (using one of the *note exec*e: 30b4. variants, discussed in the
     next paragraph), the new environment is used as the source of the
     ‘PATH’ variable.  The other variants, *note execl(): 30b4, *note
     execle(): 30b6, *note execv(): 3019, and *note execve(): 1311, will
     not use the ‘PATH’ variable to locate the executable; 'path' must
     contain an appropriate absolute or relative path.  Relative paths
     must include at least one slash, even on Windows, as plain names
     will not be resolved.

     *note execle(): 30b6. 、 *note execlpe(): 30b8. 、 *note execve():
     1311. 、および *note execvpe(): 30ba. (すべて末尾に "e" がついてい
     ます) では、 'env' 引数は新たなプロセスで利用される環境変数を定義す
     るためのマップ型でなくてはなりません ( 現在のプロセスの環境変数の代
     わりに利用されます ); *note execl(): 30b4. 、 *note execlp(): 30b7.
     、 *note execv(): 3019. 、および *note execvp(): 30b9. では、すべて
     新たなプロセスは現在のプロセスの環境を引き継ぎます。

     一部のプラットフォームの *note execve(): 1311. では、'path' はオー
     プンしているファイル記述子で指定することもできます。この機能をサポ
     ートしていないプラットフォームもあります; *note os.supports_fd:
     1315. を使うことで利用可能かどうか調べることができます。利用できな
     い場合、*note NotImplementedError: 36b. が送出されます。

     引数 ‘path’, ‘args’, ‘env’ を指定して *note 監査イベント: 1c6e.
     ‘os.exec’ を送出します。

     *note Availability: 213f.: Unix, Windows, not WASI, not Android,
     not iOS.

     バージョン 3.3 で変更: Added support for specifying 'path' as an
     open file descriptor for *note execve(): 1311.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: os._exit (n)

     終了ステータス 'n' でプロセスを終了します。この時クリーンアップハン
     ドラーの呼び出しや、標準入出力バッファのフラッシュなどは行いません
     。

          注釈: The standard way to exit is *note sys.exit(n): 277.
          ‘_exit()’ should normally only be used in the child process
          after a *note fork(): 4b5.

以下の終了コードは必須ではありませんが *note _exit(): 26f9. で使うことが
できます。一般に、メールサーバーの外部コマンド配送プログラムのような、
Python で書かれたシステムプログラムに使います。

     注釈: いくつかのバリエーションがあって、これらのすべてがすべての
     Unix プラットフォームで使えるわけではありません。以下の定数は下層の
     プラットフォームで定義されていれば定義されます。

 -- データ: os.EX_OK

     Exit code that means no error occurred.  May be taken from the
     defined value of ‘EXIT_SUCCESS’ on some platforms.  Generally has a
     value of zero.

     *note Availability: 213f.: Unix, Windows.

 -- データ: os.EX_USAGE

     誤った個数の引数が渡された時など、コマンドが間違って使われたことを
     表す終了コード。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.EX_DATAERR

     入力データが誤っていたことを表す終了コード。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.EX_NOINPUT

     入力ファイルが存在しなかった、または、読み込み不可だったことを表す
     終了コード。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.EX_NOUSER

     指定されたユーザーが存在しなかったことを表す終了コード。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.EX_NOHOST

     指定されたホストが存在しなかったことを表す終了コード。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.EX_UNAVAILABLE

     要求されたサービスが利用できないことを表す終了コード。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.EX_SOFTWARE

     内部ソフトウェアエラーが検出されたことを表す終了コード。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.EX_OSERR

     fork できない、 pipe の作成ができないなど、オペレーティングシステム
     のエラーが検出されたことを表す終了コード。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.EX_OSFILE

     システムファイルが存在しなかった、開けなかった、あるいはその他のエ
     ラーが起きたことを表す終了コード。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.EX_CANTCREAT

     ユーザーには作成できない出力ファイルを指定したことを表す終了コード
     。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.EX_IOERR

     ファイルの I/O を行っている途中にエラーが発生した時の終了コード。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.EX_TEMPFAIL

     一時的な失敗が発生したことを表す終了コード。これは、再試行可能な操
     作の途中に、ネットワークに接続できないというような、実際にはエラー
     ではないかも知れないことを意味します。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.EX_PROTOCOL

     プロトコル交換が不正、不適切、または理解不能なことを表す終了コード
     。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.EX_NOPERM

     操作を行うために十分な許可がなかった（ファイルシステムの問題を除く
     ）ことを表す終了コード。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.EX_CONFIG

     設定エラーが起こったことを表す終了コード。

     *note Availability: 213f.: Unix, not WASI.

 -- データ: os.EX_NOTFOUND

     "an entry was not found" のようなことを表す終了コード。

     *note Availability: 213f.: Unix, not WASI.

 -- の関数: os.fork ()

     子プロセスを fork します。子プロセスでは ‘0’ が返り、親プロセスでは
     子プロセスの id が返ります。エラーが発生した場合は、 *note OSError:
     2c0. を送出します。

     FreeBSD 6.3 以下、Cygwinを含む一部のプラットフォームにおいて、
     ‘fork()’ をスレッド内から利用した場合に既知の問題があることに注意し
     てください。

     引数無しで *note 監査イベント: 1c6e. ‘os.fork’ を送出します。

          警告: If you use TLS sockets in an application calling
          ‘fork()’, see the warning in the *note ssl: d5. documentation.

          警告: On macOS the use of this function is unsafe when mixed
          with using higher-level system APIs, and that includes using
          *note urllib.request: 111.

     バージョン 3.8 で変更: Calling ‘fork()’ in a subinterpreter is no
     longer supported (*note RuntimeError: 244. is raised).

     バージョン 3.12 で変更: If Python is able to detect that your
     process has multiple threads, *note os.fork(): 4b5. now raises a
     *note DeprecationWarning: 1a3.

     We chose to surface this as a warning, when detectable, to better
     inform developers of a design problem that the POSIX platform
     specifically notes as not supported.  Even in code that 'appears'
     to work, it has never been safe to mix threading with *note
     os.fork(): 4b5. on POSIX platforms.  The CPython runtime itself has
     always made API calls that are not safe for use in the child
     process when threads existed in the parent (such as ‘malloc’ and
     ‘free’).

     Users of macOS or users of libc or malloc implementations other
     than those typically found in glibc to date are among those already
     more likely to experience deadlocks running such code.

     See this discussion on fork being incompatible with threads(2) for
     technical details of why we're surfacing this longstanding platform
     compatibility problem to developers.

     *note Availability: 213f.: POSIX, not WASI, not Android, not iOS.

 -- の関数: os.forkpty ()

     子プロセスを fork します。この時新しい擬似端末を子プロセスの制御端
     末として使います。親プロセスでは ‘(pid, fd)’ からなるペアが返り、
     'fd' は擬似端末のマスター側のファイル記述子となります。可搬性のある
     アプローチを取るには、 *note pty: b6. モジュールを利用してください
     。エラーが発生した場合は、 *note OSError: 2c0. を送出します。

     引数無しで *note 監査イベント: 1c6e. ‘os.forkpty’ を送出します。

          警告: On macOS the use of this function is unsafe when mixed
          with using higher-level system APIs, and that includes using
          *note urllib.request: 111.

     バージョン 3.8 で変更: Calling ‘forkpty()’ in a subinterpreter is
     no longer supported (*note RuntimeError: 244. is raised).

     バージョン 3.12 で変更: If Python is able to detect that your
     process has multiple threads, this now raises a *note
     DeprecationWarning: 1a3.  See the longer explanation on *note
     os.fork(): 4b5.

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.kill (pid, sig, /)

     プロセス 'pid' にシグナル 'sig' を送ります。ホストプラットフォーム
     で利用可能なシグナルを特定する定数は *note signal: cb. モジュールで
     定義されています。

     Windows: The *note signal.CTRL_C_EVENT: 1580. and *note
     signal.CTRL_BREAK_EVENT: 1581. signals are special signals which
     can only be sent to console processes which share a common console
     window, e.g., some subprocesses.  Any other value for 'sig' will
     cause the process to be unconditionally killed by the
     TerminateProcess API, and the exit code will be set to 'sig'.

     *note signal.pthread_kill(): 1349. も参照してください。

     引数 ‘pid’, ‘sig’ を指定して *note 監査イベント: 1c6e. ‘os.kill’ を
     送出します。

     *note Availability: 213f.: Unix, Windows, not WASI, not iOS.

     バージョン 3.2 で変更: Windows サポートを追加しました。

 -- の関数: os.killpg (pgid, sig, /)

     プロセスグループ 'pgid' にシグナル 'sig' を送ります。

     引数 ‘pgid’, ‘sig’ を指定して *note 監査イベント: 1c6e. ‘os.killpg’
     を送出します。

     *note Availability: 213f.: Unix, not WASI, not iOS.

 -- の関数: os.nice (increment, /)

     プロセスの "nice 値 " に 'increment' を加えます。新たな nice 値を返
     します。

     *note Availability: 213f.: Unix, not WASI.

 -- の関数: os.pidfd_open (pid, flags=0)

     Return a file descriptor referring to the process 'pid' with
     'flags' set.  This descriptor can be used to perform process
     management without races and signals.

     See the ‘pidfd_open(2)(3)’ man page for more details.

     *note Availability: 213f.: Linux >= 5.3, Android >= *note
     build-time: d83. API level 31

     Added in version 3.9.

      -- データ: os.PIDFD_NONBLOCK

          This flag indicates that the file descriptor will be
          non-blocking.  If the process referred to by the file
          descriptor has not yet terminated, then an attempt to wait on
          the file descriptor using ‘waitid(2)(4)’ will immediately
          return the error *note EAGAIN: 26fd. rather than blocking.

     *note Availability: 213f.: Linux >= 5.10

     Added in version 3.12.

 -- の関数: os.plock (op, /)

     プログラムのセグメントをメモリ内にロックします。 'op'
     (‘<sys/lock.h>’ で定義されています ) にはどのセグメントをロックする
     かを指定します。

     *note Availability: 213f.: Unix, not WASI, not iOS.

 -- の関数: os.popen (cmd, mode='r', buffering=-1)

     コマンド 'cmd' への、または 'cmd' からのパイプ入出力を開きます。戻
     り値はパイプに接続されている開かれたファイルオブジェクトで、 'mode'
     が ‘'r'’ (デフォルト) または ‘'w'’ かによって読み出しまたは書き込み
     を行うことができます。引数 'bufsize' は、組み込み関数 *note open():
     316. における対応する引数と同じ意味を持ちます。 返されるファイルオ
     ブジェクトは、バイトではなくテキスト文字列を読み書きします。

     ‘close’ メソッドは、サブプロセスが正常に終了した場合は *note None:
     885. を返し、エラーが発生した場合にはサブプロセスの返りコードを返し
     ます。POSIX システムでは、返りコードが正の場合、そのコードは1バイト
     左にシフトしてプロセスが終了したことを示します。返りコードが負の場
     合、プロセスは返りコードの符号を変えた信号により終了します 。 (例え
     ば、サブプロセスが kill された場合、返り値は ‘- signal.SIGKILL’ と
     なる場合があります。) Windows システムでは、返り値には子プロセスか
     らの符号のついた整数の返りコードを含まれます。

     On Unix, *note waitstatus_to_exitcode(): b17. can be used to
     convert the ‘close’ method result (exit status) into an exit code
     if it is not ‘None’.  On Windows, the ‘close’ method result is
     directly the exit code (or ‘None’).

     これは、*note subprocess.Popen: 4b7. を使用して実装されています。サ
     ブプロセスを管理し、サブプロセスと通信を行うためのより強力な方法に
     ついては、クラスのドキュメンテーションを参照してください。

     *note Availability: 213f.: not WASI, not Android, not iOS.

          注釈: The *note Python UTF-8 Mode: 866. affects encodings used
          for 'cmd' and pipe contents.

          *note popen(): 31a. is a simple wrapper around *note
          subprocess.Popen: 4b7.  Use *note subprocess.Popen: 4b7. or
          *note subprocess.run(): d7f. to control options like
          encodings.

     バージョン 3.14 で非推奨: The function is *note soft deprecated:
     23d. and should no longer be used to write new code.  The *note
     subprocess: dc. module is recommended instead.

 -- の関数: os.posix_spawn (path, argv, env, *, file_actions=None,
          setpgroup=None, resetids=False, setsid=False, setsigmask=(),
          setsigdef=(), scheduler=None)

     Wraps the ‘posix_spawn()’ C library API for use from Python.

     大部分のユーザーは *note posix_spawn(): 52e. ではなく、 *note
     subprocess.run(): d7f. を使うべきです。

     The positional-only arguments 'path', 'args', and 'env' are similar
     to *note execve(): 1311.  'env' is allowed to be ‘None’, in which
     case current process' environment is used.

     'path' には実行ファイルへのパスを指定します。 'path' はディレクトリ
     を含む形（実行ファイルへの絶対パスまたは相対パス）で指定する必要が
     あります。実行ファイル名のみを指定したい場合は *note
     posix_spawnp(): 1e11. を使ってください。

     'file_actions' 引数はCライブラリ実装の ‘fork()’ と ‘exec()’ の間で
     子プロセスが持つファイルデスクリプタに対して行うアクションを記述す
     るタプルのシーケンスです。各タプルの最初の要素は、残りのタプル要素
     の解釈方法を指定する以下の3つの型指定子のうちのひとつでなければなり
     ません。

      -- データ: os.POSIX_SPAWN_OPEN

          (‘os.POSIX_SPAWN_OPEN’, 'fd', 'path', 'flags', 'mode')

          ‘os.dup2(os.open(path, flags, mode), fd)’ を実行します。

      -- データ: os.POSIX_SPAWN_CLOSE

          (‘os.POSIX_SPAWN_CLOSE’, 'fd')

          ‘os.close(fd)’ を実行します。

      -- データ: os.POSIX_SPAWN_DUP2

          (‘os.POSIX_SPAWN_DUP2’, 'fd', 'new_fd')

          ‘os.dup2(fd, new_fd)’ を実行します。

      -- データ: os.POSIX_SPAWN_CLOSEFROM

          (‘os.POSIX_SPAWN_CLOSEFROM’, 'fd')

          Performs ‘os.closerange(fd, INF)’.

     These tuples correspond to the C library
     ‘posix_spawn_file_actions_addopen()’,
     ‘posix_spawn_file_actions_addclose()’,
     ‘posix_spawn_file_actions_adddup2()’, and
     ‘posix_spawn_file_actions_addclosefrom_np()’ API calls used to
     prepare for the ‘posix_spawn()’ call itself.

     The 'setpgroup' argument will set the process group of the child to
     the value specified.  If the value specified is 0, the child's
     process group ID will be made the same as its process ID. If the
     value of 'setpgroup' is not set, the child will inherit the
     parent's process group ID. This argument corresponds to the C
     library ‘POSIX_SPAWN_SETPGROUP’ flag.

     If the 'resetids' argument is ‘True’ it will reset the effective
     UID and GID of the child to the real UID and GID of the parent
     process.  If the argument is ‘False’, then the child retains the
     effective UID and GID of the parent.  In either case, if the
     set-user-ID and set-group-ID permission bits are enabled on the
     executable file, their effect will override the setting of the
     effective UID and GID. This argument corresponds to the C library
     ‘POSIX_SPAWN_RESETIDS’ flag.

     If the 'setsid' argument is ‘True’, it will create a new session ID
     for ‘posix_spawn’.  'setsid' requires ‘POSIX_SPAWN_SETSID’ or
     ‘POSIX_SPAWN_SETSID_NP’ flag.  Otherwise, *note
     NotImplementedError: 36b. is raised.

     The 'setsigmask' argument will set the signal mask to the signal
     set specified.  If the parameter is not used, then the child
     inherits the parent's signal mask.  This argument corresponds to
     the C library ‘POSIX_SPAWN_SETSIGMASK’ flag.

     The 'sigdef' argument will reset the disposition of all signals in
     the set specified.  This argument corresponds to the C library
     ‘POSIX_SPAWN_SETSIGDEF’ flag.

     The 'scheduler' argument must be a tuple containing the (optional)
     scheduler policy and an instance of *note sched_param: 1910. with
     the scheduler parameters.  A value of ‘None’ in the place of the
     scheduler policy indicates that is not being provided.  This
     argument is a combination of the C library
     ‘POSIX_SPAWN_SETSCHEDPARAM’ and ‘POSIX_SPAWN_SETSCHEDULER’ flags.

     引数 ‘path’, ‘argv’, ‘env’ を指定して *note 監査イベント: 1c6e.
     ‘os.posix_spawn’ を送出します。

     Added in version 3.8.

     バージョン 3.13 で変更: 'env' parameter accepts ‘None’.
     ‘os.POSIX_SPAWN_CLOSEFROM’ is available on platforms where
     ‘posix_spawn_file_actions_addclosefrom_np()’ exists.

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.posix_spawnp (path, argv, env, *, file_actions=None,
          setpgroup=None, resetids=False, setsid=False, setsigmask=(),
          setsigdef=(), scheduler=None)

     Wraps the ‘posix_spawnp()’ C library API for use from Python.

     Similar to *note posix_spawn(): 52e. except that the system
     searches for the 'executable' file in the list of directories
     specified by the ‘PATH’ environment variable (in the same way as
     for ‘execvp(3)’).

     引数 ‘path’, ‘argv’, ‘env’ を指定して *note 監査イベント: 1c6e.
     ‘os.posix_spawn’ を送出します。

     Added in version 3.8.

     *note Availability: 213f.: POSIX, not WASI, not Android, not iOS.

     See *note posix_spawn(): 52e. documentation.

 -- の関数: os.register_at_fork (*, before=None, after_in_parent=None,
          after_in_child=None)

     Register callables to be executed when a new child process is
     forked using *note os.fork(): 4b5. or similar process cloning APIs.
     The parameters are optional and keyword-only.  Each specifies a
     different call point.

        * 'before' is a function called before forking a child process.

        * 'after_in_parent' is a function called from the parent process
          after forking a child process.

        * 'after_in_child' is a function called from the child process.

     These calls are only made if control is expected to return to the
     Python interpreter.  A typical *note subprocess: dc. launch will
     not trigger them as the child is not going to re-enter the
     interpreter.

     Functions registered for execution before forking are called in
     reverse registration order.  Functions registered for execution
     after forking (either in the parent or in the child) are called in
     registration order.

     Note that ‘fork()’ calls made by third-party C code may not call
     those functions, unless it explicitly calls *note
     PyOS_BeforeFork(): db8, *note PyOS_AfterFork_Parent(): db9. and
     *note PyOS_AfterFork_Child(): 430.

     There is no way to unregister a function.

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

     Added in version 3.7.

 -- の関数: os.spawnl (mode, path, ...)
 -- の関数: os.spawnle (mode, path, ..., env)
 -- の関数: os.spawnlp (mode, file, ...)
 -- の関数: os.spawnlpe (mode, file, ..., env)
 -- の関数: os.spawnv (mode, path, args)
 -- の関数: os.spawnve (mode, path, args, env)
 -- の関数: os.spawnvp (mode, file, args)
 -- の関数: os.spawnvpe (mode, file, args, env)

     新たなプロセス内でプログラム 'path' を実行します。

     (*note subprocess: dc. モジュールが、新しいプロセスを実行して結果を
     取得するための、より強力な機能を提供しています。この関数の代わりに
     *note subprocess: dc. モジュールを利用することが推奨されています。
     *note subprocess: dc. モジュールのドキュメントの、 *note Replacing
     Older Functions with the subprocess Module: 13a0. セクションを参照
     してください )

     'mode' が *note P_NOWAIT: 30d7. の場合、この関数は新たなプロセスの
     プロセス ID を返します ; 'mode' が *note P_WAIT: 30d8. の場合、子プ
     ロセスが正常に終了するとその終了コードが返ります。そうでない場合に
     はプロセスを kill したシグナル 'signal' に対して ‘-signal’ が返りま
     す。 Windows では、プロセス ID は実際にはプロセスハンドル値になるの
     で、 *note waitpid(): f9a. 関数で使えます。

     Note on VxWorks, this function doesn't return ‘-signal’ when the
     new process is killed.  Instead it raises OSError exception.

     The "l" and "v" variants of the *note spawn*: 31b. functions differ
     in how command-line arguments are passed.  The "l" variants are
     perhaps the easiest to work with if the number of parameters is
     fixed when the code is written; the individual parameters simply
     become additional parameters to the ‘spawnl*()’ functions.  The "v"
     variants are good when the number of parameters is variable, with
     the arguments being passed in a list or tuple as the 'args'
     parameter.  In either case, the arguments to the child process must
     start with the name of the command being run.

     末尾近くに "p" をもつ型 (*note spawnlp(): 30d1, *note spawnlpe():
     30d2, *note spawnvp(): 30d5, *note spawnvpe(): 30d6.) は、プログラ
     ム 'file' を探すために環境変数 ‘PATH’ を利用します。環境変数が ( 次
     の段で述べる *note spawn*e: 31b. 型関数で ) 置き換えられる場合、環
     境変数は ‘PATH’ を決定する上の情報源として使われます。その他の型、
     *note spawnl(): 31b, *note spawnle(): 30d0, *note spawnv(): 30d3, お
     よび *note spawnve(): 30d4. では、実行コードを探すために ‘PATH’ を
     使いません。 'path' には適切に設定された絶対パスまたは相対パスが入
     っていなくてはなりません。

     *note spawnle(): 30d0, *note spawnlpe(): 30d2, *note spawnve():
     30d4, および *note spawnvpe(): 30d6. (すべて末尾に "e" がついていま
     す) では、 'env' 引数は新たなプロセスで利用される環境変数を定義する
     ためのマップ型でなくてはなりません ; *note spawnl(): 31b. 、 *note
     spawnlp(): 30d1. 、 *note spawnv(): 30d3. 、および *note spawnvp():
     30d5. では、すべて新たなプロセスは現在のプロセスの環境を引き継ぎま
     す。 'env' 辞書のキーと値はすべて文字列である必要があります。不正な
     キーや値を与えると関数が失敗し、 ‘127’ を返します。

     例えば、以下の *note spawnlp(): 30d1. および *note spawnvpe():
     30d6. 呼び出しは等価です

          import os
          os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')

          L = ['cp', 'index.html', '/dev/null']
          os.spawnvpe(os.P_WAIT, 'cp', L, os.environ)

     引数 ‘mode’, ‘path’, ‘args’, ‘env’ を指定して *note 監査イベント:
     1c6e. ‘os.spawn’ を送出します。

     *note Availability: 213f.: Unix, Windows, not WASI, not Android,
     not iOS.

     *note spawnlp(): 30d1. 、 *note spawnlpe(): 30d2. 、 *note
     spawnvp(): 30d5. 、および *note spawnvpe(): 30d6. は Windows では利
     用できません。 *note spawnle(): 30d0. および *note spawnve(): 30d4.
     は Windows においてスレッドセーフではありません ; 代わりに *note
     subprocess: dc. モジュールの利用を推奨します。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.14 で非推奨: These functions are *note soft
     deprecated: 23d. and should no longer be used to write new code.
     The *note subprocess: dc. module is recommended instead.

 -- データ: os.P_NOWAIT
 -- データ: os.P_NOWAITO

     Possible values for the 'mode' parameter to the *note spawn*: 31b.
     family of functions.  If either of these values is given, the *note
     spawn*: 31b. functions will return as soon as the new process has
     been created, with the process id as the return value.

     *note Availability: 213f.: Unix, Windows.

 -- データ: os.P_WAIT

     Possible value for the 'mode' parameter to the *note spawn*: 31b.
     family of functions.  If this is given as 'mode', the *note spawn*:
     31b. functions will not return until the new process has run to
     completion and will return the exit code of the process the run is
     successful, or ‘-signal’ if a signal kills the process.

     *note Availability: 213f.: Unix, Windows.

 -- データ: os.P_DETACH
 -- データ: os.P_OVERLAY

     *note spawn*: 31b. 関数ファミリに対する 'mode' パラメタとして取れる
     値です。これらの値は上の値よりもやや可搬性において劣っています。
     *note P_DETACH: 30da. は *note P_NOWAIT: 30d7. に似ていますが、新た
     なプロセスは呼び出しプロセスのコンソールから切り離され (detach) ま
     す。 *note P_OVERLAY: 30db. が使われた場合、現在のプロセスは置き換
     えられます。したがって *note spawn*: 31b. は返りません。

     *note Availability: 213f.: Windows.

 -- の関数: os.startfile (path[, operation][, arguments][, cwd][,
          show_cmd])

     ファイルを関連付けられたアプリケーションを使ってスタートします。

     When 'operation' is not specified, this acts like double-clicking
     the file in Windows Explorer, or giving the file name as an
     argument to the ‘start’ command from the interactive command shell:
     the file is opened with whatever application (if any) its extension
     is associated.

     When another 'operation' is given, it must be a "command verb" that
     specifies what should be done with the file.  Common verbs
     documented by Microsoft are ‘'open'’, ‘'print'’ and ‘'edit'’ (to be
     used on files) as well as ‘'explore'’ and ‘'find'’ (to be used on
     directories).

     When launching an application, specify 'arguments' to be passed as
     a single string.  This argument may have no effect when using this
     function to launch a document.

     The default working directory is inherited, but may be overridden
     by the 'cwd' argument.  This should be an absolute path.  A
     relative 'path' will be resolved against this argument.

     Use 'show_cmd' to override the default window style.  Whether this
     has any effect will depend on the application being launched.
     Values are integers as supported by the Win32 ‘ShellExecute()’
     function.

     *note startfile(): 1c83. returns as soon as the associated
     application is launched.  There is no option to wait for the
     application to close, and no way to retrieve the application's exit
     status.  The 'path' parameter is relative to the current directory
     or 'cwd'.  If you want to use an absolute path, make sure the first
     character is not a slash (‘'/'’) Use *note pathlib: a8. or the
     *note os.path.normpath(): 1531. function to ensure that paths are
     properly encoded for Win32.

     To reduce interpreter startup overhead, the Win32 ‘ShellExecute()’
     function is not resolved until this function is first called.  If
     the function cannot be resolved, *note NotImplementedError: 36b.
     will be raised.

     引数 ‘path’, ‘operation’ を指定して *note 監査イベント: 1c6e.
     ‘os.startfile’ を送出します。

     Raises an *note auditing event: 1c6e. ‘os.startfile/2’ with
     arguments ‘path’, ‘operation’, ‘arguments’, ‘cwd’, ‘show_cmd’.

     *note Availability: 213f.: Windows.

     バージョン 3.10 で変更: Added the 'arguments', 'cwd' and 'show_cmd'
     arguments, and the ‘os.startfile/2’ audit event.

 -- の関数: os.system (command)

     Execute the command (a string) in a subshell.  This is implemented
     by calling the Standard C function ‘system()’, and has the same
     limitations.  Changes to *note sys.stdin: 75f, etc.  are not
     reflected in the environment of the executed command.  If 'command'
     generates any output, it will be sent to the interpreter standard
     output stream.  The C standard does not specify the meaning of the
     return value of the C function, so the return value of the Python
     function is system-dependent.

     On Unix, the return value is the exit status of the process encoded
     in the format specified for *note wait(): f98.

     Windows では、返り値は 'command' を実行した後にシステムシェルから返
     される値です。シェルは通常 ‘cmd.exe’ であり、返す値は実行したコマン
     ドの終了ステータスになります。シェルの種類は Windows の環境変数
     ‘COMSPEC’: に指定されています。ネイティブでないシェルを使用している
     場合は、そのドキュメントを参照してください。

     The *note subprocess: dc. module provides more powerful facilities
     for spawning new processes and retrieving their results; using that
     module is recommended to using this function.  See the *note
     Replacing Older Functions with the subprocess Module: 13a0. section
     in the *note subprocess: dc. documentation for some helpful
     recipes.

     On Unix, *note waitstatus_to_exitcode(): b17. can be used to
     convert the result (exit status) into an exit code.  On Windows,
     the result is directly the exit code.

     引数 ‘command’ を指定して *note 監査イベント: 1c6e. ‘os.system’ を
     送出します。

     *note Availability: 213f.: Unix, Windows, not WASI, not Android,
     not iOS.

 -- の関数: os.times ()

     現在の全体的なプロセス時間を返します。返り値は 5 個の属性を持つオブ
     ジェクトになります:

        * ‘user’ - user time

        * ‘system’ - system time

        * ‘children_user’ - user time of all child processes

        * ‘children_system’ - system time of all child processes

        * ‘elapsed’ - elapsed real time since a fixed point in the past

     後方互換性のため、このオブジェクトは 5 個のアイテム ‘user’ 、
     ‘system’ 、 ‘children_user’ 、 ‘children_system’ 、および ‘elapsed’
     を持つタプルのようにも振る舞います。

     See the Unix manual page ‘times(2)(5)’ and times(3)(6) manual page
     on Unix or the GetProcessTimes MSDN(7) on Windows.  On Windows,
     only ‘user’ and ‘system’ are known; the other attributes are zero.

     *note Availability: 213f.: Unix, Windows.

     バージョン 3.3 で変更: 返り値の型が、タプルから属性名のついたタプル
     ライクオブジェクトに変更されました。

 -- の関数: os.wait ()

     子プロセスの実行完了を待機し、子プロセスの pid と終了コードインジケ
     ーター -- 16 ビットの数値で、下位バイトがプロセスを kill したシグナ
     ル番号、上位バイトが終了ステータス ( シグナル番号がゼロの場合 ) --
     の入ったタプルを返します ; コアダンプファイルが生成された場合、下位
     バイトの最上桁ビットが立てられます。

     If there are no children that could be waited for, *note
     ChildProcessError: 1263. is raised.

     戻り値の終了ステータスを終了コードに変換するために *note
     waitstatus_to_exitcode(): b17. を使うことができます。

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

     参考
     ....

     The other ‘wait*()’ functions documented below can be used to wait
     for the completion of a specific child process and have more
     options.  *note waitpid(): f9a. is the only one also available on
     Windows.

 -- の関数: os.waitid (idtype, id, options, /)

     Wait for the completion of a child process.

     'idtype' can be *note P_PID: 30dc, *note P_PGID: 30dd, *note P_ALL:
     30de, or (on Linux) *note P_PIDFD: b16.  The interpretation of 'id'
     depends on it; see their individual descriptions.

     'options' is an OR combination of flags.  At least one of *note
     WEXITED: 30df, *note WSTOPPED: 30e0. or *note WCONTINUED: 30e1. is
     required; *note WNOHANG: 30e2. and *note WNOWAIT: 30e3. are
     additional optional flags.

     The return value is an object representing the data contained in
     the ‘siginfo_t’ structure with the following attributes:

        * ‘si_pid’ (process ID)

        * ‘si_uid’ (real user ID of the child)

        * ‘si_signo’ (always *note SIGCHLD: 30e4.)

        * ‘si_status’ (the exit status or signal number, depending on
          ‘si_code’)

        * ‘si_code’ (see *note CLD_EXITED: 30e5. for possible values)

     If *note WNOHANG: 30e2. is specified and there are no matching
     children in the requested state, ‘None’ is returned.  Otherwise, if
     there are no matching children that could be waited for, *note
     ChildProcessError: 1263. is raised.

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

     Added in version 3.3.

     バージョン 3.13 で変更: This function is now available on macOS as
     well.

 -- の関数: os.waitpid (pid, options, /)

     この関数の詳細は Unix と Windows で異なります。

     Unix の場合 : プロセス id 'pid' で与えられた子プロセスの完了を待機
     し、子プロセスのプロセス id と (*note wait(): f98. と同様にコード化
     された ) 終了ステータスインジケーターからなるタプルを返します。この
     関数の動作は 'options' によって変わります。通常の操作では ‘0’ にし
     ます。

     'pid' が ‘0’ よりも大きい場合、 *note waitpid(): f9a. は特定のプロ
     セスのステータス情報を要求します。 'pid' が ‘0’ の場合、現在のプロ
     セスグループ内の任意の子プロセスの状態に対する要求です。 'pid' が
     ‘-1’ の場合、現在のプロセスの任意の子プロセスに対する要求です。
     'pid' が ‘-1’ よりも小さい場合、プロセスグループ ‘-pid’ ( すなわち
     'pid' の絶対値 ) 内の任意のプロセスに対する要求です。

     'options' is an OR combination of flags.  If it contains *note
     WNOHANG: 30e2. and there are no matching children in the requested
     state, ‘(0, 0)’ is returned.  Otherwise, if there are no matching
     children that could be waited for, *note ChildProcessError: 1263.
     is raised.  Other options that can be used are *note WUNTRACED:
     30e6. and *note WCONTINUED: 30e1.

     Windows では、プロセスハンドル 'pid' を指定してプロセスの終了を待っ
     て、 'pid' と、終了ステータスを 8bit 左シフトした値のタプルを返しま
     す。 ( シフトは、この関数をクロスプラットフォームで利用しやすくする
     ために行われます ) ‘0’ 以下の 'pid' は Windows では特別な意味を持っ
     ておらず、例外を発生させます。 'options' の値は効果がありません。
     'pid' は、子プロセスで無くても、プロセス ID を知っているどんなプロ
     セスでも参照することが可能です。 *note spawn*: 31b. 関数を *note
     P_NOWAIT: 30d7. と共に呼び出した場合、適切なプロセスハンドルが返さ
     れます。

     戻り値の終了ステータスを終了コードに変換するために *note
     waitstatus_to_exitcode(): b17. を使うことができます。

     *note Availability: 213f.: Unix, Windows, not WASI, not Android,
     not iOS.

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、この関数は *note InterruptedError: f88. 例
     外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(8) を参照してください)。

 -- の関数: os.wait3 (options)

     *note waitpid(): f9a. に似ていますが、プロセス id を引数に取らず、
     子プロセス id 、終了ステータスインジケータ、リソース使用情報の 3 要
     素からなるタプルを返します。リソース使用情報の詳しい情報は *note
     resource.getrusage(): 164a. を参照してください。'options' 引数は
     *note waitpid(): f9a. および *note wait4(): f97. に渡されるものと同
     じです。

     戻り値の終了ステータスを終了コードに変換するために *note
     waitstatus_to_exitcode(): b17. を使うことができます。

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.wait4 (pid, options)

     *note waitpid(): f9a. に似ていますが、子プロセス id 、終了ステータ
     スインジケータ、リソース使用情報の 3 要素からなるタプルを返します。
     リソース使用情報の詳しい情報は *note resource.getrusage(): 164a. を
     参照してください。 *note wait4(): f97. の引数は *note waitpid():
     f9a. に与えられるものと同じです。

     戻り値の終了ステータスを終了コードに変換するために *note
     waitstatus_to_exitcode(): b17. を使うことができます。

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

 -- データ: os.P_PID
 -- データ: os.P_PGID
 -- データ: os.P_ALL
 -- データ: os.P_PIDFD

     *note waitid(): f99. の 'idtype' に指定できる値です。これらは 'id'
     がどう解釈されるかに影響します:

        * ‘P_PID’ - wait for the child whose PID is 'id'.

        * ‘P_PGID’ - wait for any child whose progress group ID is 'id'.

        * ‘P_ALL’ - wait for any child; 'id' is ignored.

        * ‘P_PIDFD’ - wait for the child identified by the file
          descriptor 'id' (a process file descriptor created with *note
          pidfd_open(): 6a4.).

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

          注釈: ‘P_PIDFD’ is only available on Linux >= 5.4.

     Added in version 3.3.

     Added in version 3.9: The ‘P_PIDFD’ constant.

 -- データ: os.WCONTINUED

     This 'options' flag for *note waitpid(): f9a, *note wait3(): f96,
     *note wait4(): f97, and *note waitid(): f99. causes child processes
     to be reported if they have been continued from a job control stop
     since they were last reported.

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

 -- データ: os.WEXITED

     This 'options' flag for *note waitid(): f99. causes child processes
     that have terminated to be reported.

     The other ‘wait*’ functions always report children that have
     terminated, so this option is not available for them.

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

     Added in version 3.3.

 -- データ: os.WSTOPPED

     This 'options' flag for *note waitid(): f99. causes child processes
     that have been stopped by the delivery of a signal to be reported.

     This option is not available for the other ‘wait*’ functions.

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

     Added in version 3.3.

 -- データ: os.WUNTRACED

     This 'options' flag for *note waitpid(): f9a, *note wait3(): f96,
     and *note wait4(): f97. causes child processes to also be reported
     if they have been stopped but their current state has not been
     reported since they were stopped.

     This option is not available for *note waitid(): f99.

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

 -- データ: os.WNOHANG

     This 'options' flag causes *note waitpid(): f9a, *note wait3():
     f96, *note wait4(): f97, and *note waitid(): f99. to return right
     away if no child process status is available immediately.

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

 -- データ: os.WNOWAIT

     This 'options' flag causes *note waitid(): f99. to leave the child
     in a waitable state, so that a later ‘wait*()’ call can be used to
     retrieve the child status information again.

     This option is not available for the other ‘wait*’ functions.

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

 -- データ: os.CLD_EXITED
 -- データ: os.CLD_KILLED
 -- データ: os.CLD_DUMPED
 -- データ: os.CLD_TRAPPED
 -- データ: os.CLD_STOPPED
 -- データ: os.CLD_CONTINUED

     *note waitid(): f99. の返り値の ‘si_code’ に設定され得る値です。

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

     Added in version 3.3.

     バージョン 3.9 で変更: *note CLD_KILLED: b14. と *note CLD_STOPPED:
     b15. が追加されました。

 -- の関数: os.waitstatus_to_exitcode (status)

     待機ステータスを終了コードに変換します。

     Unix の場合:

        * 子プロセスが正常終了した場合 (‘WIFEXITED(status)``が真の場合
          )、子プロセスの終了ステータス (``WEXITSTATUS(status)’) を返し
          ます: 戻り値は0または正の整数です。

        * 子プロセスがシグナルによって終了した場合
          (‘WIFSIGNALED(status)``が真の場合)、子プロセスを終了したシグナ
          ルの番号に負符号をつけた ``-signum’ (‘-WTERMSIG(status)’) を返
          します: 戻り値は負の整数です。

        * それ以外の場合、 *note ValueError: 2ec. 例外を送出します。

     Windows の場合、 'status' を8ビット右にシフトした値を返します。

     Unix の場合、プロセスがトレースされているか *note waitpid(): f9a. が
     *note WUNTRACED: 30e6. オプションをつけて実行されている場合、呼び出
     しもとは最初に ‘WIFSTOPPED(status)’ が真であるかを確認しなければな
     りません。この関数は ‘WIFSTOPPED(status)’ が真の場合呼び出してはい
     けません。

     参考
     ....

     *note WIFEXITED(): 30ea, *note WEXITSTATUS(): 30eb, *note
     WIFSIGNALED(): 30ec, *note WTERMSIG(): 30ed, *note WIFSTOPPED():
     30ee, *note WSTOPSIG(): 30ef. 関数。

     *note Availability: 213f.: Unix, Windows, not WASI, not Android,
     not iOS.

     Added in version 3.9.

以下の関数は *note system(): 1676. 、 *note wait(): f98. 、あるいは
*note waitpid(): f9a. が返すプロセス状態コードを引数にとります。これらの
関数はプロセスの配置を決めるために利用できます。

 -- の関数: os.WCOREDUMP (status, /)

     プロセスに対してコアダンプが生成されていた場合には ‘True’ を、それ
     以外の場合は ‘False’ を返します。

     この関数は *note WIFSIGNALED(): 30ec. が真である場合のみ使用される
     べきです。

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WIFCONTINUED (status)

     Return ‘True’ if a stopped child has been resumed by delivery of
     *note SIGCONT: 30f2. (if the process has been continued from a job
     control stop), otherwise return ‘False’.

     *note WCONTINUED: 30e1. オプションを参照してください。

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WIFSTOPPED (status)

     プロセスがシグナルの送信によって中断させられた場合に ‘True’ を返し
     ます。それ以外の場合は ‘False’ を返します。

     *note WIFSTOPPED(): 30ee. は *note waitpid(): f9a. が *note
     WUNTRACED: 30e6. オプションを使って実行されたか、もしくはプロセスが
     トレースされている場合 (‘ptrace(2)(9)’ を参照してください) にのみ
     ‘True’ を返します。

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WIFSIGNALED (status)

     プロセスがシグナルによって終了させられた場合に ‘True’ を返します。
     そうでない場合は ‘False’ を返します。

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WIFEXITED (status)

     プロセスが正常終了した場合、すなわち ‘exit()’ や ‘_exit()’ を呼び出
     したか、もしくは ‘main()’ から戻ることにより終了した場合に ‘True’ を
     返します。それ以外は ‘False’ を返します。

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WEXITSTATUS (status)

     プロセスの終了ステータスを返します。

     この関数は *note WIFEXITED(): 30ea. が真である場合のみ使用されるべ
     きです。

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WSTOPSIG (status)

     プロセスを停止させたシグナル番号を返します。

     この関数は *note WIFSTOPPED(): 30ee. が真である場合のみ使用されるべ
     きです。

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

 -- の関数: os.WTERMSIG (status)

     プロセスを終了させたシグナルの番号を返します。

     この関数は *note WIFSIGNALED(): 30ec. が真である場合のみ使用される
     べきです。

     *note Availability: 213f.: Unix, not WASI, not Android, not iOS.

   ---------- Footnotes ----------

   (1) https://msdn.microsoft.com/44228cf2-6306-466c-8f16-f513cd3ba8b5

   (2) https://discuss.python.org/t/33555

   (3) https://manpages.debian.org/pidfd_open(2)

   (4) https://manpages.debian.org/waitid(2)

   (5) https://manpages.debian.org/times(2)

   (6) https://man.freebsd.org/cgi/man.cgi?time(3)

   (7) 
https://docs.microsoft.com/windows/win32/api/processthreadsapi/nf-processthreadsapi-getprocesstimes

   (8) https://peps.python.org/pep-0475/

   (9) https://manpages.debian.org/ptrace(2)


File: python.info,  Node: スケジューラーへのインターフェイス,  Next: 雑多なシステム情報,  Prev: プロセス管理,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.16.1.12 スケジューラーへのインターフェイス
............................................

以下の関数は、オペレーティングシステムがプロセスに CPU 時間を割り当てる
方法を制御します。これらは一部の Unix プラットフォームでのみ利用可能です
。詳しくは Unix マニュアルページを参照してください。

Added in version 3.3.

次のスケジューリングポリシーは、オペレーティングシステムでサポートされて
いれば公開されます。

 -- データ: os.SCHED_OTHER

     デフォルトのスケジューリングポリシーです。

 -- データ: os.SCHED_BATCH

     常にCPUに負荷のかかる (CPU-intensive) プロセス用のポリシーです。他
     の対話式プロセスなどの応答性を維持するよう試みます。

 -- データ: os.SCHED_DEADLINE

     Scheduling policy for tasks with deadline constraints.

     Added in version 3.14.

 -- データ: os.SCHED_IDLE

     非常に優先度の低いバックグラウンドタスク用のスケジューリングポリシ
     ーです。

 -- データ: os.SCHED_NORMAL

     Alias for *note SCHED_OTHER: 30f5.

     Added in version 3.14.

 -- データ: os.SCHED_SPORADIC

     散発的なサーバープログラム用のスケジューリングポリシーです。

 -- データ: os.SCHED_FIFO

     FIFO (First In, First Out) 型のスケジューリングポリシーです。

 -- データ: os.SCHED_RR

     ラウンドロビン型のスケジューリングポリシーです。

 -- データ: os.SCHED_RESET_ON_FORK

     このフラグは他のスケジューリングポリシーとともに論理和指定できます
     。このフラグが与えられたプロセスが fork されると、その子プロセスの
     スケジューリングポリシーおよび優先度はデフォルトにリセットされます
     。

 -- クラス: os.sched_param (sched_priority)

     このクラスは、*note sched_setparam(): 1327.、*note
     sched_setscheduler(): 1328.、および *note sched_getparam(): 1323. で
     使用される、調節可能なスケジューリングパラメーターを表します。これ
     はイミュータブルです。

     現在、一つの引数のみ指定できます:

      -- の属性: sched_priority

          スケジューリングポリシーのスケジューリング優先度です。

 -- の関数: os.sched_get_priority_min (policy)

     'policy' の最小優先度値を取得します。'policy' には上記のスケジュー
     リングポリシー定数の一つを指定します。

 -- の関数: os.sched_get_priority_max (policy)

     'policy' の最大優先度値を取得します。'policy' には上記のスケジュー
     リングポリシー定数の一つを指定します。

 -- の関数: os.sched_setscheduler (pid, policy, param, /)

     PID 'pid' のプロセスのスケジューリングポリシーを設定します。'pid' が
     0 の場合、呼び出しプロセスを意味します。'policy' には上記のスケジュ
     ーリングポリシー定数の一つを指定します。'param' は *note
     sched_param: 1910. のインスタンスです。

 -- の関数: os.sched_getscheduler (pid, /)

     PID 'pid' のプロセスのスケジューリングポリシーを返します。'pid' が
     0 の場合、呼び出しプロセスを意味します。返り値は上記のスケジューリ
     ングポリシー定数の一つになります。

 -- の関数: os.sched_setparam (pid, param, /)

     PID 'pid' を持つプロセスのスケジューリングパラメータを設定します。
     'pid' を 0 とした場合呼び出しプロセスを意味します。 'param' は
     *note sched_param: 1910. インスタンスです。

 -- の関数: os.sched_getparam (pid, /)

     PID 'pid' のプロセスのスケジューリングパラメーターを *note
     sched_param: 1910. のインスタンスとして返します。'pid' が 0 の場合
     、呼び出しプロセスを意味します。

 -- の関数: os.sched_rr_get_interval (pid, /)

     PID 'pid' のプロセスのラウンドロビンクォンタム (秒) を返します。
     'pid' が 0 の場合、呼び出しプロセスを意味します。

 -- の関数: os.sched_yield ()

     Voluntarily relinquish the CPU. See ‘sched_yield(2)(1)’ for
     details.

 -- の関数: os.sched_setaffinity (pid, mask, /)

     PID 'pid' のプロセス (0 であれば現在のプロセス) を CPU の集合に制限
     します。'mask' はプロセスを制限する CPU の集合を表す整数のイテラブ
     ルなオブジェクトです。

 -- の関数: os.sched_getaffinity (pid, /)

     Return the set of CPUs the process with PID 'pid' is restricted to.

     If 'pid' is zero, return the set of CPUs the calling thread of the
     current process is restricted to.

     See also the *note process_cpu_count(): 4da. function.

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/sched_yield(2)


File: python.info,  Node: 雑多なシステム情報,  Next: 乱数<2>,  Prev: スケジューラーへのインターフェイス,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.16.1.13 雑多なシステム情報
............................

 -- の関数: os.confstr (name, /)

     システム設定値を文字列で返します。 'name' には取得したい設定名を指
     定します ; この値は定義済みのシステム値名を表す文字列にすることがで
     きます ; 名前は多くの標準 (POSIX.1 、 Unix 95 、 Unix 98 その他 ) で
     定義されています。ホストオペレーティングシステムの関知する名前は
     ‘confstr_names’ 辞書のキーとして与えられています。このマップ型オブ
     ジェクトに入っていない設定変数については、 'name' に整数を渡しても
     かまいません。

     'name' に指定された設定値が定義されていない場合、 ‘None’ を返します
     。

     'name' が文字列で、かつ不明の場合、 *note ValueError: 2ec. を送出し
     ます。 'name' の指定値がホストシステムでサポートされておらず、
     ‘confstr_names’ にも入っていない場合、 *note errno.EINVAL: 1dd2. を
     エラー番号として *note OSError: 2c0. を送出します。

     *note Availability: 213f.: Unix.

 -- データ: os.confstr_names

     *note confstr(): 18ec. が受理する名前を、ホストオペレーティングシス
     テムで定義されている整数値に対応付けている辞書です。この辞書はシス
     テムでどの設定名が定義されているかを決定するために利用できます。

     *note Availability: 213f.: Unix.

 -- の関数: os.cpu_count ()

     Return the number of logical CPUs in the 'system'.  Returns ‘None’
     if undetermined.

     The *note process_cpu_count(): 4da. function can be used to get the
     number of logical CPUs usable by the calling thread of the 'current
     process'.

     Added in version 3.4.

     バージョン 3.13 で変更: If *note -X cpu_count: 16f. is given or
     *note PYTHON_CPU_COUNT: 51e. is set, *note cpu_count(): 4db.
     returns the override value 'n'.

 -- の関数: os.getloadavg ()

     過去 1 分、 5 分、および 15 分間の、システムの実行キューの平均プロ
     セス数を返します。平均負荷が得られない場合には *note OSError: 2c0.
     を送出します。

     *note Availability: 213f.: Unix.

 -- の関数: os.process_cpu_count ()

     Get the number of logical CPUs usable by the calling thread of the
     'current process'.  Returns ‘None’ if undetermined.  It can be less
     than *note cpu_count(): 4db. depending on the CPU affinity.

     The *note cpu_count(): 4db. function can be used to get the number
     of logical CPUs in the 'system'.

     If *note -X cpu_count: 16f. is given or *note PYTHON_CPU_COUNT:
     51e. is set, *note process_cpu_count(): 4da. returns the override
     value 'n'.

     See also the *note sched_getaffinity(): 1322. function.

     Added in version 3.13.

 -- の関数: os.sysconf (name, /)

     整数値のシステム設定値を返します。 'name' で指定された設定値が定義
     されていない場合、 ‘-1’ が返されます。 'name' に関するコメントとし
     ては、 *note confstr(): 18ec. で述べた内容が同様に当てはまります ;
     既知の設定名についての情報を与える辞書は ‘sysconf_names’ で与えられ
     ています。

     *note Availability: 213f.: Unix.

 -- データ: os.sysconf_names

     *note sysconf(): 18ed. が受理する名前を、ホストオペレーティングシス
     テムで定義されている整数値に対応付けている辞書です。この辞書はシス
     テムでどの設定名が定義されているかを決定するために利用できます。

     *note Availability: 213f.: Unix.

     バージョン 3.11 で変更: Add ‘'SC_MINSIGSTKSZ'’ name.

以下のデータ値はパス名編集操作をサポートするために利用されます。これらの
値はすべてのプラットフォームで定義されています。

パス名に対する高水準の操作は *note os.path: a6. モジュールで定義されてい
ます。

 -- データ: os.curdir

     現在のディレクトリ参照するためにオペレーティングシステムで使われる
     文字列定数です。 POSIX と Windows では ‘'.'’ になります。 *note
     os.path: a6. からも利用できます。

 -- データ: os.pardir

     親ディレクトリを参照するためにオペレーティングシステムで使われる文
     字列定数です。 POSIX と Windows では ‘'..'’ になります。 *note
     os.path: a6. からも利用できます。

 -- データ: os.sep

     パス名を要素に分割するためにオペレーティングシステムで利用されてい
     る文字です。例えば POSIX では ‘'/'’ で、 Windows では ‘'\\'’ です。
     しかし、このことを知っているだけではパス名を解析したり、パス名同士
     を結合したりするには不十分です -- こうした操作には *note
     os.path.split(): 2c51. や *note os.path.join(): 19a9. を使用してく
     ださい -- が、たまに便利なこともあります。 *note os.path: a6. から
     も利用できます。

 -- データ: os.altsep

     文字パス名を要素に分割する際にオペレーティングシステムで利用される
     もう一つの文字で、分割文字が一つしかない場合には ‘None’ になります
     。この値は ‘sep’ がバックスラッシュとなっている DOS や Windows シス
     テムでは ‘'/'’ に設定されています。 *note os.path: a6. からも利用で
     きます。

 -- データ: os.extsep

     ベースのファイル名と拡張子を分ける文字です。例えば、 ‘os.py’ であれ
     ば ‘'.'’ です。 *note os.path: a6. からも利用できます。

 -- データ: os.pathsep

     ( ‘PATH’ のような ) サーチパス内の要素を分割するためにオペレーティ
     ングシステムが慣習的に用いる文字で、 POSIX における ‘':'’ や DOS お
     よび Windows における ‘';'’ に相当します。 *note os.path: a6. から
     も利用できます。

 -- データ: os.defpath

     *note exec*p*: 30b4. や *note spawn*p*: 31b. において、環境変数辞書
     内に ‘'PATH'’ キーがない場合に使われる標準設定のサーチパスです。
     *note os.path: a6. からも利用できます。

 -- データ: os.linesep

     現在のプラットフォーム上で行を分割 ( あるいは終端 ) するために用い
     られている文字列です。この値は例えば POSIX での ‘'\n'’ や Mac OS で
     の ‘'\r'’ のように、単一の文字にもなりますし、例えば Windows での
     ‘'\r\n'’ のように複数の文字列にもなります。テキストモードで開いたフ
     ァイルに書き込む時には、 'os.linesep' を利用しないでください。すべ
     てのプラットフォームで、単一の ‘'\n'’ を使用してください。

 -- データ: os.devnull

     ヌルデバイスのファイルパスです。例えば POSIX では ‘'/dev/null'’ で
     、 Windows では ‘'nul'’ です。この値は *note os.path: a6. からも利
     用できます。

 -- データ: os.RTLD_LAZY
 -- データ: os.RTLD_NOW
 -- データ: os.RTLD_GLOBAL
 -- データ: os.RTLD_LOCAL
 -- データ: os.RTLD_NODELETE
 -- データ: os.RTLD_NOLOAD
 -- データ: os.RTLD_DEEPBIND

     *note setdlopenflags(): 1337. 関数と *note getdlopenflags(): 1727.
     関数と一緒に使用するフラグ。それぞれのフラグの意味については、Unix
     マニュアルの ‘dlopen(3)(1)’ ページを参照してください。

     Added in version 3.3.

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/dlopen(3)


File: python.info,  Node: 乱数<2>,  Prev: 雑多なシステム情報,  Up: os --- 雑多なオペレーティングシステムインターフェース

5.16.1.14 乱数
..............

 -- の関数: os.getrandom (size, flags=0)

     最大で 'size' バイトからなるランダムなバイト列を返します。この関数
     は要求されたバイト数よりも少ないバイト数を返すことがあります。

     バイト列は、ユーザー空間の乱数生成器や暗号目的ののシードとして利用
     できます。

     ‘getrandom()’ はデバイスドライバや他の環境ノイズ源から収集されたエ
     ントロピーに頼っています。不必要な大量のデータの読出しは、
     ‘/dev/random’ と ‘/dev/urandom’ デバイスの他のユーザーに負の影響を
     与えるでしょう。

     The flags argument is a bit mask that can contain zero or more of
     the following values ORed together: *note os.GRND_RANDOM: 3103. and
     *note GRND_NONBLOCK: 3104.

     Linux getrandom() manual page(1) も参照してください。

     *note Availability: 213f.: Linux >= 3.17.

     Added in version 3.6.

 -- の関数: os.urandom (size, /)

     暗号に関する用途に適した 'size' バイトからなるランダムなバイト文字
     列を返します。

     この関数は OS 固有の乱数発生源からランダムなバイト列を生成して返し
     ます。この関数の返すデータは暗号を用いたアプリケーションで十分利用
     できる程度に予測不能ですが、実際のクオリティは OS の実装によって異
     なります。

     Linux では、 ‘getrandom()’ システムコールが利用可能ならブロッキング
     モードで呼び出されます: すなわちシステムの urandom エントロピープー
     ルが初期化されるまで (128 ビットのエントロピーがカーネルにより収集
     されるまで) 処理がブロックされます。論拠については PEP 524(2) を参
     照してください。 Linux では、 (*note GRND_NONBLOCK: 3104. フラグを
     使って) 非ブロッキングモードでランダムなバイトを取得したり、システ
     ムの urandom エントロピープールが初期化されるまでポーリングするため
     に *note getrandom(): eb9. 関数を利用することができます。

     Unix ライクなシステムでは、ランダムなバイトは ‘/dev/urandom’ デバイ
     スから読み込みます。 ‘/dev/urandom’ デバイスが利用できないか、もし
     くは読み取り不可のときは、 *note NotImplementedError: 36b. 例外が送
     出されます。

     Windowsで、 ‘BCryptGenRandom()’ を使用します。

     参考
     ....

     *note secrets: c5. モジュールは高レベルの乱数生成機能を提供します。
     プラットフォームが提供する乱数生成器に対する簡便なインターフェース
     については、 *note random.SystemRandom: 2b57. を参照してください。

     バージョン 3.5 で変更: Linux 3.17 以降では、使用可能な場合に
     ‘getrandom()’ システムコールが使用されるようになりました。OpenBSD
     5.6 以降では、C ‘getentropy()’ 関数が使用されるようになりました。こ
     れらの関数は、内部ファイル記述子を使用しません。

     バージョン 3.5.2 で変更: Linux において、 ‘getrandom()’ システムコ
     ールがブロックするなら (urandom エントロピープールが初期化されてい
     なければ) 、 ‘/dev/urandom’ を読む方法にフォールバックします。

     バージョン 3.6 で変更: Linuxで、 セキュリティを高めるために、
     ‘getrandom()’ をブロッキングモードで使用するようになりました。

     バージョン 3.11 で変更: On Windows, ‘BCryptGenRandom()’ is used
     instead of ‘CryptGenRandom()’ which is deprecated.

 -- データ: os.GRND_NONBLOCK

     デフォルトでは、*note getrandom(): eb9. は ‘/dev/random’ から読み込
     んだときにランダムなバイトが存在しない場合や、 ‘/dev/urandom’ から
     読み込んだときにエントロピープールが初期化されていない場合に処理を
     ブロックします。

     *note GRND_NONBLOCK: 3104. フラグがセットされると、 *note
     getrandom(): eb9. はこれらの場合に処理をブロックせず、ただちに
     *note BlockingIOError: 235. 例外を送出します。

     Added in version 3.6.

 -- データ: os.GRND_RANDOM

     このビットがセットされた場合、 ランダムバイトは ‘/dev/urandom’ プー
     ルの代わりに ‘/dev/random’ プールから取り出されます。

     Added in version 3.6.

   ---------- Footnotes ----------

   (1) https://man7.org/linux/man-pages/man2/getrandom.2.html

   (2) https://peps.python.org/pep-0524/


File: python.info,  Node: io --- ストリームを扱うコアツール,  Next: time --- 時刻データへのアクセスと変換,  Prev: os --- 雑多なオペレーティングシステムインターフェース,  Up: 汎用オペレーティングシステムサービス

5.16.2 ‘io’ -- ストリームを扱うコアツール
-----------------------------------------

'ソースコード:' Lib/io.py(1)

__________________________________________________________________

* Menu:

* 概要: 概要<2>.
* Text Encoding::
* 高水準のモジュールインターフェイス::
* クラス階層::
* Static Typing::
* 性能: 性能<3>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/io.py


File: python.info,  Node: 概要<2>,  Next: Text Encoding,  Up: io --- ストリームを扱うコアツール

5.16.2.1 概要
.............

The ‘io’ module provides Python's main facilities for dealing with
various types of I/O. There are three main types of I/O: 'text I/O',
'binary I/O' and 'raw I/O'. These are generic categories, and various
backing stores can be used for each of them.  A concrete object
belonging to any of these categories is called a *note file object:
13db.  Other common terms are 'stream' and 'file-like object'.

それぞれの具象ストリームオブジェクトは、カテゴリに応じた機能を持ちます。
ストリームは読み込み専用、書き込み専用、読み書き可能のいずかになります。
任意のランダムアクセス（前方、後方の任意の場所にシークする）が可能かもし
れませんし、シーケンシャルアクセスしかできないかもしれません（例えばソケ
ットやパイプなど）。

All streams are careful about the type of data you give to them.  For
example giving a *note str: 169. object to the ‘write()’ method of a
binary stream will raise a *note TypeError: 198.  So will giving a *note
bytes: 192. object to the ‘write()’ method of a text stream.

バージョン 3.3 で変更: 以前 *note IOError: 125e. を送出していた操作が
*note OSError: 2c0. を送出するようになりました。 *note IOError: 125e. は
今は *note OSError: 2c0. の別名です。

* Menu:

* テキスト I/O::
* バイナリ I/O::
* Raw I/O::


File: python.info,  Node: テキスト I/O,  Next: バイナリ I/O,  Up: 概要<2>

5.16.2.2 テキスト I/O
.....................

テキスト I/O は、 *note str: 169. オブジェクトを受け取り、生成します。す
なわち、背後にあるストレージがバイト列 (例えばファイルなど) を格納すると
きは常に、透過的にデータのエンコード・デコードを行ない、オプションでプラ
ットフォーム依存の改行文字変換を行います。

テキストストリームを作る一番簡単な方法は、オプションでエンコーディングを
指定して、 *note open(): 316. を利用することです:

     f = open("myfile.txt", "r", encoding="utf-8")

*note StringIO: 112a. オブジェクトはインメモリーのテキストストリームです
:

     f = io.StringIO("some initial text data")

     注釈: When working with a non-blocking stream, be aware that read
     operations on text I/O objects might raise a *note BlockingIOError:
     235. if the stream cannot perform the operation immediately.

テキストストリームの API は *note TextIOBase: 8a4. のドキュメントで詳し
く解説します。


File: python.info,  Node: バイナリ I/O,  Next: Raw I/O,  Prev: テキスト I/O,  Up: 概要<2>

5.16.2.3 バイナリ I/O
.....................

バイナリー I/O ('buffered I/O' とも呼ばれます) は *note bytes-like
オブジェクト: 193. を受け取り *note bytes: 192. オブジェクトを生成します
。エンコード、デコード、改行文字変換は一切行いません。このカテゴリのスト
リームは全ての非テキストデータや、テキストデータの扱いを手動で管理したい
場合に利用することができます。

バイナリーストリームを生成する一番簡単な方法は、 *note open(): 316. の
mode 文字列に ‘'b'’ を指定することです:

     f = open("myfile.jpg", "rb")

*note BytesIO: 10a4. はインメモリーのバイナリストリームです:

     f = io.BytesIO(b"some initial binary data: \x00\x01")

バイナリーストリーム API は *note BufferedIOBase: 8a3. のドキュメントで
詳しく解説します。

他のライブラリモジュールが、別のテキスト・バイナリーストリームを生成する
方法を提供しています。例えば *note socket.socket.makefile(): 13b7. など
です。


File: python.info,  Node: Raw I/O,  Prev: バイナリ I/O,  Up: 概要<2>

5.16.2.4 Raw I/O
................

Raw I/O ('unbuffered I/O' とも呼ばれます) は、バイナリーストリームやテキ
ストストリームの低水準の部品としてよく利用されます。ユーザーコードで直接
raw ストリームを扱うべき場面は滅多にありません。とはいえ、バッファリング
を無効にしてファイルをバイナリーモードで開くことで raw ストリームを作る
ことができます:

     f = open("myfile.jpg", "rb", buffering=0)

raw ストリーム API は *note RawIOBase: 12e7. のドキュメントで詳しく解説
します。


File: python.info,  Node: Text Encoding,  Next: 高水準のモジュールインターフェイス,  Prev: 概要<2>,  Up: io --- ストリームを扱うコアツール

5.16.2.5 Text Encoding
......................

The default encoding of *note TextIOWrapper: 9be. and *note open(): 316.
is locale-specific (*note locale.getencoding(): 329.).

However, many developers forget to specify the encoding when opening
text files encoded in UTF-8 (e.g.  JSON, TOML, Markdown, etc...)  since
most Unix platforms use UTF-8 locale by default.  This causes bugs
because the locale encoding is not UTF-8 for most Windows users.  For
example:

     # May not work on Windows when non-ASCII characters in the file.
     with open("README.md") as f:
         long_description = f.read()

Accordingly, it is highly recommended that you specify the encoding
explicitly when opening text files.  If you want to use UTF-8, pass
‘encoding="utf-8"’.  To use the current locale encoding,
‘encoding="locale"’ is supported since Python 3.10.

参考
....

*note Python UTF-8 Mode: 866.

     Python UTF-8 Mode can be used to change the default encoding to
     UTF-8 from locale-specific encoding.

PEP 686(1)

     Python 3.15 will make *note Python UTF-8 Mode: 866. default.

* Menu:

* Opt-in EncodingWarning::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0686/


File: python.info,  Node: Opt-in EncodingWarning,  Up: Text Encoding

5.16.2.6 Opt-in EncodingWarning
...............................

Added in version 3.10: See PEP 597(1) for more details.

To find where the default locale encoding is used, you can enable the
*note -X warn_default_encoding: 16f. command line option or set the
*note PYTHONWARNDEFAULTENCODING: 9bf. environment variable, which will
emit an *note EncodingWarning: 212e. when the default encoding is used.

If you are providing an API that uses *note open(): 316. or *note
TextIOWrapper: 9be. and passes ‘encoding=None’ as a parameter, you can
use *note text_encoding(): 1a3c. so that callers of the API will emit an
*note EncodingWarning: 212e. if they don't pass an ‘encoding’.  However,
please consider using UTF-8 by default (i.e.  ‘encoding="utf-8"’) for
new APIs.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0597/


File: python.info,  Node: 高水準のモジュールインターフェイス,  Next: クラス階層,  Prev: Text Encoding,  Up: io --- ストリームを扱うコアツール

5.16.2.7 高水準のモジュールインターフェイス
...........................................

 -- データ: io.DEFAULT_BUFFER_SIZE

     このモジュールの buffered I/O クラスで利用されるデフォルトのバッフ
     ァーサイズを表す整数です。可能であれば、*note open(): 316. は file
     の blksize (*note os.stat(): 26d. で取得される) を利用します。

 -- の関数: io.open (file, mode='r', buffering=-1, encoding=None,
          errors=None, newline=None, closefd=True, opener=None)

     組み込みの *note open(): 316. 関数のエイリアスです。

     This function raises an *note auditing event: 1c6e. ‘open’ with
     arguments 'path', 'mode' and 'flags'.  The 'mode' and 'flags'
     arguments may have been modified or inferred from the original
     call.

 -- の関数: io.open_code (path)

     ‘'rb'’ モードでファイルを開きます。この関数はファイルの中身を実行可
     能なコードとして扱いたい場合にのみ使用します。

     'path' should be a *note str: 169. and an absolute path.

     The behavior of this function may be overridden by an earlier call
     to the *note PyFile_SetOpenCodeHook(): 1a9a.  However, assuming
     that 'path' is a *note str: 169. and an absolute path,
     ‘open_code(path)’ should always behave the same as ‘open(path,
     'rb')’.  Overriding the behavior is intended for additional
     validation or preprocessing of the file.

     Added in version 3.8.

 -- の関数: io.text_encoding (encoding, stacklevel=2, /)

     This is a helper function for callables that use *note open(): 316.
     or *note TextIOWrapper: 9be. and have an ‘encoding=None’ parameter.

     This function returns 'encoding' if it is not ‘None’.  Otherwise,
     it returns ‘"locale"’ or ‘"utf-8"’ depending on *note UTF-8 Mode:
     866.

     This function emits an *note EncodingWarning: 212e. if *note
     sys.flags.warn_default_encoding: 89c. is true and 'encoding' is
     ‘None’.  'stacklevel' specifies where the warning is emitted.  For
     example:

          def read_text(path, encoding=None):
              encoding = io.text_encoding(encoding)  # stacklevel=2
              with open(path, encoding) as f:
                  return f.read()

     In this example, an *note EncodingWarning: 212e. is emitted for the
     caller of ‘read_text()’.

     See *note Text Encoding: 9c0. for more information.

     Added in version 3.10.

     バージョン 3.11 で変更: *note text_encoding(): 1a3c. returns
     "utf-8" when UTF-8 mode is enabled and 'encoding' is ‘None’.

 -- 例外: io.BlockingIOError

     互換性のための、組み込みの *note BlockingIOError: 235. 例外のエイリ
     アスです。

 -- 例外: io.UnsupportedOperation

     *note OSError: 2c0. と *note ValueError: 2ec. を継承した例外です。
     ストリームがサポートしていない操作を行おうとした時に送出されます。

参考
....

*note sys: df.

     標準 IO ストリームを持っています: *note sys.stdin: 75f, *note
     sys.stdout: ccd, *note sys.stderr: b33.。


File: python.info,  Node: クラス階層,  Next: Static Typing,  Prev: 高水準のモジュールインターフェイス,  Up: io --- ストリームを扱うコアツール

5.16.2.8 クラス階層
...................

I/O ストリームの実装はクラス階層に分けて整理されています。まずストリーム
のカテゴリを分類するための *note 抽象基底クラス: 13ce. (ABC) があり、続
いて標準のストリーム実装を行う具象クラス群があります。

     注釈: The abstract base classes also provide default
     implementations of some methods in order to help implementation of
     concrete stream classes.  For example, *note BufferedIOBase: 8a3.
     provides unoptimized implementations of ‘readinto()’ and
     ‘readline()’.

I/O 階層の最上位には抽象基底クラスの *note IOBase: 505. があります。
*note IOBase: 505. ではストリームに対して基本的なインターフェースを定義
しています。 しかしながら、ストリームに対する読み込みと書き込みが分離さ
れていないことに注意してください。 実装においては与えられた操作をサポー
トしない場合は *note UnsupportedOperation: 1d7f. を送出することが許され
ています。

*note RawIOBase: 12e7. ABC は *note IOBase: 505. を拡張します。このクラ
スはストリームからの bytes の読み書きを扱います。 *note FileIO: 1527. は
、 *note RawIOBase: 12e7. を継承してマシンのファイルシステム中のファイル
へのインターフェースを提供します。

The *note BufferedIOBase: 8a3. ABC extends *note IOBase: 505.  It deals
with buffering on a raw binary stream (*note RawIOBase: 12e7.).  Its
subclasses, *note BufferedWriter: 15cb, *note BufferedReader: 1427, and
*note BufferedRWPair: 15cd. buffer raw binary streams that are writable,
readable, and both readable and writable, respectively.  *note
BufferedRandom: 15cc. provides a buffered interface to seekable streams.
Another *note BufferedIOBase: 8a3. subclass, *note BytesIO: 10a4, is a
stream of in-memory bytes.

*note TextIOBase: 8a4. ABC は *note IOBase: 505. を拡張します。このクラ
スはテキストをあらわすバイトストリームを対象とし、バイトデータと文字列の
間のエンコーディングやデコーディングを適切に行います。 *note
TextIOWrapper: 9be. は *note TextIOBase: 8a4. を拡張し、バッファリングさ
れた生のストリーム (*note BufferedIOBase: 8a3.) に対するバッファリングさ
れたテキストのインターフェースです。最後に、 *note StringIO: 112a. はメ
モリ上のテキストデータに対するストリームです。

引数名は規約に含まれていません。 そして *note open(): 316. の引数だけが
キーワード引数として用いられることが意図されています。

The following table summarizes the ABCs provided by the ‘io’ module:

ABC                           継承元                 スタブメソッド               Mixin するメソッドとプロパティ
                                                                                  
-----------------------------------------------------------------------------------------------------------------------------------------
                                                                                  
*note IOBase: 505.                                   ‘fileno’, ‘seek’,            ‘close’, ‘closed’, ‘__enter__’, ‘__exit__’, ‘flush’,
                                                     ‘truncate’                   ‘isatty’, ‘__iter__’, ‘__next__’, ‘readable’,
                                                                                  ‘readline’, ‘readlines’, ‘seekable’, ‘tell’,
                                                                                  ‘writable’, ‘writelines’
                                                                                  
                                                                                  
*note RawIOBase: 12e7.        *note IOBase: 505.     ‘readinto’, ‘write’          *note IOBase: 505. から継承したメソッド、 ‘read’,
                                                                                  ‘readall’
                                                                                  
                                                                                  
*note BufferedIOBase: 8a3.    *note IOBase: 505.     ‘detach’, ‘read’, ‘read1’,   *note IOBase: 505. から継承したメソッド、
                                                     ‘write’                      ‘readinto’, ‘readinto1’
                                                                                  
                                                                                  
*note TextIOBase: 8a4.        *note IOBase: 505.     ‘detach’, ‘read’,            *note IOBase: 505. から継承したメソッド、
                                                     ‘readline’, ‘write’          ‘encoding’, ‘errors’, ‘newlines’
                                                                                  

* Menu:

* I/O 基底クラス::
* 生ファイルI/O::
* バッファ付きストリーム::
* テキスト I/O: テキスト I/O<2>.


File: python.info,  Node: I/O 基底クラス,  Next: 生ファイルI/O,  Up: クラス階層

5.16.2.9 I/O 基底クラス
.......................

 -- クラス: io.IOBase

     The abstract base class for all I/O classes.

     継承先のクラスが選択的にオーバライドできるように、このクラスは多く
     のメソッドに空の抽象実装をしています。デフォルトの実装では、読み込
     み、書き込み、シークができないファイルを表現します。

     Even though *note IOBase: 505. does not declare ‘read()’ or
     ‘write()’ because their signatures will vary, implementations and
     clients should consider those methods part of the interface.  Also,
     implementations may raise a *note ValueError: 2ec. (or *note
     UnsupportedOperation: 1d7f.) when operations they do not support
     are called.

     ファイルへのバイナリデータの読み書きに用いられる基本型は *note
     bytes: 192. です。 他の *note bytes-like オブジェクト: 193. もメソ
     ッドの引数として受け付けられます。 テキスト I/O クラスは *note str:
     169. データを扱います。

     閉じられたストリームに対するメソッド呼び出しは (問い合わせであって
     も) 未定義です。この場合、実装は *note ValueError: 2ec. を送出する
     ことがあります。

     *note IOBase: 505. (とそのサブクラス) はイテレータプロトコルをサポ
     ートします。 *note IOBase: 505. オブジェクトをイテレートすると、ス
     トリーム内の行が yield されます。ストリーム内の行の定義は、そのスト
     リームが (バイト列を yield する) バイナリストリームか (文字列を
     yield する) テキストストリームかによって、 少し異なります。下の
     *note readline(): 1541. を参照してください。

     *note IOBase: 505. はコンテキストマネージャでもあります。そのため
     *note with: 186. 構文をサポートします。 次の例では、 ‘with’ 構文が
     終わった後で--たとえ例外が発生した場合でも、 'file' は閉じられます
     。

          with open('spam.txt', 'w') as file:
              file.write('Spam and eggs!')

     *note IOBase: 505. は以下のデータ属性とメソッドを提供します:

      -- メソッド: close ()

          このストリームをフラッシュして閉じます。このメソッドはファイル
          が既に閉じられていた場合は特に何の効果もありません。いったんフ
          ァイルが閉じられると、すべてのファイルに対する操作 (例えば読み
          込みや書き込み) で *note ValueError: 2ec. が発生します。

          利便性のためにこのメソッドを複数回呼ぶことは許されています。し
          かし、効果があるのは最初の1回だけです。

      -- の属性: closed

          ストリームが閉じられていた場合 ‘True’ になります。

      -- メソッド: fileno ()

          ストリームが保持しているファイル記述子 (整数値) が存在する場合
          はそれを返します。もし IO オブジェクトがファイル記述子を使って
          いない場合は *note OSError: 2c0. が発生します。

      -- メソッド: flush ()

          適用可能であればストリームの書き込みバッファをフラッシュします
          。読み出し専用や非ブロッキングストリームでは何もしません。

      -- メソッド: isatty ()

          ストリームが対話的であれば (つまりターミナルや tty デバイスに
          つながっている場合) ‘True’ を返します。

      -- メソッド: readable ()

          Return ‘True’ if the stream can be read from.  If ‘False’,
          ‘read()’ will raise *note OSError: 2c0.

      -- メソッド: readline (size=-1, /)

          ストリームから 1 行読み込んで返します。もし 'size' が指定され
          た場合、最大で 'size' バイトが読み込まれます。

          バイナリファイルでは行末文字は常に ‘b'\n'’ となります。テキス
          トファイルでは、認識される行末文字を選択するために *note
          open(): 316. に対する 'newline' 引数が使われます。

      -- メソッド: readlines (hint=-1, /)

          ストリームから行のリストを読み込んで返します。 'hint' を指定す
          ることで、読み込む行数を制御できます。もし読み込んだすべての行
          のサイズ (バイト数、もしくは文字数) が 'hint' の値を超えた場合
          、それ以上の行は読み込まれません。

          引数 'hint' の値が ‘0’ 以下、および ‘None’ の場合は、ヒントが
          ないものとして取り扱われます。

          Note that it's already possible to iterate on file objects
          using ‘for line in file: ...’ without calling
          ‘file.readlines()’.

      -- メソッド: seek (offset, whence=os.SEEK_SET, /)

          Change the stream position to the given byte 'offset',
          interpreted relative to the position indicated by 'whence',
          and return the new absolute position.  Values for 'whence'
          are:

             * *note os.SEEK_SET: 14a5. or ‘0’ - start of the stream
               (the default); 'offset' should be zero or positive

             * *note os.SEEK_CUR: 14a6. or ‘1’ - current stream
               position; 'offset' may be negative

             * *note os.SEEK_END: 14a7. or ‘2’ - end of the stream;
               'offset' is usually negative

          Added in version 3.1: The ‘SEEK_*’ constants.

          Added in version 3.3: Some operating systems could support
          additional values, like *note os.SEEK_HOLE: 3041. or *note
          os.SEEK_DATA: 3042.  The valid values for a file could depend
          on it being open in text or binary mode.

      -- メソッド: seekable ()

          ストリームがランダムアクセスをサポートしている場合、 ‘True’ を
          返します。 ‘False’ の場合、 *note seek(): 14a4.、 *note
          tell(): 15c6.、 *note truncate(): 1528. を使用すると *note
          OSError: 2c0. を発生させます。

      -- メソッド: tell ()

          現在のストリーム位置を返します。

      -- メソッド: truncate (size=None, /)

          ストリームのサイズを、指定された 'size' バイト (または 'size'
          が指定されていない場合、現在位置) に変更します。現在のストリー
          ム位置は変更されません。このサイズ変更により、現在のファイルサ
          イズを拡大または縮小させることができます。拡大の場合には、新し
          いファイル領域の内容はプラットホームによって異なります (ほとん
          どのシステムでは、追加のバイトが 0 で埋められます)。新しいファ
          イルサイズが返されます。

          バージョン 3.5 で変更: Windows で、拡大時に追加領域を 0 で埋め
          るようになりました。

      -- メソッド: writable ()

          Return ‘True’ if the stream supports writing.  If ‘False’,
          ‘write()’ and *note truncate(): 1528. will raise *note
          OSError: 2c0.

      -- メソッド: writelines (lines, /)

          ストリームに行のリストを書き込みます。行区切り文字は追加されな
          いので、書き込む各行の行末に行区切り文字を含ませるのが一般的で
          す。

      -- メソッド: __del__ ()

          オブジェクトの破壊の用意をします。このメソッドはインスタンスの
          *note close(): 506. メソッドを呼びます。 *note IOBase: 505. は
          このメソッドのデフォルトの実装を提供します

 -- クラス: io.RawIOBase

     Base class for raw binary streams.  It inherits from *note IOBase:
     505.

     生のバイナリストリームは典型的に、背後にある OS デバイスや API への
     低水準なアクセスを提供し、それらを高水準の基本要素へカプセル化しよ
     うとはしません (そのような機能は後述するバッファされたバイナリスト
     リームやテキストストリームのような高水準のクラスで行われます)。

     *note RawIOBase: 12e7. は *note IOBase: 505. が提供するメソッドに加
     えて、以下のメソッドを提供します:

      -- メソッド: read (size=-1, /)

          オブジェクトを 'size' バイトまで読み込み、それを返します。 簡
          単のため、 'size' が指定されていないか -1 の場合は、 EOF まで
          の全てのバイトを返します。 そうでない場合は、システムコール呼
          び出しが一度だけ行われます。 オペレーティングシステムコールか
          ら返ってきたものが 'size' バイトより少なければ、 'size' バイト
          より少ない返り値になることがあります。

          'size' が 0 でないのに 0 バイトが返った場合、それはファイルの
          終端を表します。オブジェクトがノンブロッキングモードで、1 バイ
          トも読み込めなければ、‘None’ が返されます。

          デフォルトの実装は *note readall(): 3113. と *note readinto():
          101e. に従います。

      -- メソッド: readall ()

          EOF までストリームからすべてのバイトを読み込みます。必要な場合
          はストリームに対して複数の呼び出しをします。

      -- メソッド: readinto (b, /)

          あらかじめ確保された書き込み可能な *note bytes 類オブジェクト:
          193. 'b' にバイト列を読み込み、読み込んだバイト数を返します。
          例えば、 'b' は *note bytearray: 344. です。 オブジェクトがノ
          ンブロッキングモードで、 1 バイトも読み込めなければ、 ‘None’ が
          返されます。

      -- メソッド: write (b, /)

          与えられた *note bytes-like オブジェクト: 193. 'b' を生ストリ
          ームに書き込み、書き込んだバイト数を返します。これは、根底の生
          ストリームの性質や、特にノンブロッキングである場合に、 'b' の
          バイト数より小さくなることがあります。生ストリームがブロックさ
          れないように設定されていて、かつ1バイトも即座に書き込むことが
          できなければ、 ‘None’ が返されます。このメソッドから返った後で
          呼び出し元は 'b' を解放したり変更したりするかもしれないので、
          実装はメソッド呼び出しの間だけ 'b' にアクセスすべきです。

 -- クラス: io.BufferedIOBase

     Base class for binary streams that support some kind of buffering.
     It inherits from *note IOBase: 505.

     The main difference with *note RawIOBase: 12e7. is that methods
     *note read(): 1540, *note readinto(): 1895. and *note write(): ed7.
     will try (respectively) to read as much input as requested or to
     emit all provided data.

     In addition, if the underlying raw stream is in non-blocking mode,
     when the system returns would block *note write(): ed7. will raise
     *note BlockingIOError: 235. with *note
     BlockingIOError.characters_written: 2701. and *note read(): 1540.
     will return data read so far or ‘None’ if no data is available.

     さらに、 *note read(): 1540. メソッドは、 *note readinto(): 1895. に
     従うデフォルト実装を持ちません。

     通常の *note BufferedIOBase: 8a3. 実装は *note RawIOBase: 12e7. 実
     装を継承せずに、 *note BufferedWriter: 15cb. と *note
     BufferedReader: 1427. がするようにこれをラップすべきです。

     *note BufferedIOBase: 8a3. は *note IOBase: 505. から継承した属性と
     メソッドに加えて、以下のデータ属性とメソッドを提供またはオーバーラ
     イドします:

      -- の属性: raw

          *note BufferedIOBase: 8a3. が扱う根底の生ストリーム (*note
          RawIOBase: 12e7. インスタンス) を返します。これは *note
          BufferedIOBase: 8a3. API には含まれず、よって実装に含まれない
          ことがあります。

      -- メソッド: detach ()

          根底の生ストリームをバッファから分離して返します。

          生ストリームが取り外された後、バッファは使用不能状態になります
          。

          バッファには、 *note BytesIO: 10a4. など、このメソッドで返され
          る単体のストリームという概念を持たないものがあります。これらは
          *note UnsupportedOperation: 1d7f. を送出します。

          Added in version 3.1.

      -- メソッド: read (size=-1, /)

          Read and return up to 'size' bytes.  If the argument is
          omitted, ‘None’, or negative read as much as possible.

          Fewer bytes may be returned than requested.  An empty *note
          bytes: 192. object is returned if the stream is already at
          EOF.  More than one read may be made and calls may be retried
          if specific errors are encountered, see *note os.read(): f95.
          and PEP 475(1) for more details.  Less than size bytes being
          returned does not imply that EOF is imminent.

          When reading as much as possible the default implementation
          will use ‘raw.readall’ if available (which should implement
          *note RawIOBase.readall(): 3113.), otherwise will read in a
          loop until read returns ‘None’, an empty *note bytes: 192, or
          a non-retryable error.  For most streams this is to EOF, but
          for non-blocking streams more data may become available.

               注釈: When the underlying raw stream is non-blocking,
               implementations may either raise *note BlockingIOError:
               235. or return ‘None’ if no data is available.  ‘io’
               implementations return ‘None’.

      -- メソッド: read1 (size=-1, /)

          Read and return up to 'size' bytes, calling *note readinto():
          101e. which may retry if *note EINTR: f87. is encountered per
          PEP 475(2).  If 'size' is ‘-1’ or not provided, the
          implementation will choose an arbitrary value for 'size'.

               注釈: When the underlying raw stream is non-blocking,
               implementations may either raise *note BlockingIOError:
               235. or return ‘None’ if no data is available.  ‘io’
               implementations return ‘None’.

      -- メソッド: readinto (b, /)

          あらかじめ確保された書き込み可能な *note bytes 類オブジェクト:
          193. 'b' にバイト列を読み込み、読み込んだバイト数を返します。
          例えば、 'b' は *note bytearray: 344. です。

          *note read(): 1540. と同様に、下層の raw ストリームが対話的で
          ない限り、複数の読み込みは下層の raw ストリームに与えられるか
          もしれません。

          元になる生ストリームがノンブロッキングモードで、呼び出された時
          点でデータを持っていなければ、 *note BlockingIOError: 235. が
          送出されます。

      -- メソッド: readinto1 (b, /)

          根底の raw ストリームの *note read(): 101d. (または *note
          readinto(): 101e.) メソッドを高々 1 回呼び出し、あらかじめ確保
          された書き込み可能な *note bytes-like オブジェクト: 193. 'b' に
          バイト列を読み込みます。読み込んだバイト数を返します。

          元になる生ストリームがノンブロッキングモードで、呼び出された時
          点でデータを持っていなければ、 *note BlockingIOError: 235. が
          送出されます。

          Added in version 3.5.

      -- メソッド: write (b, /)

          与えられた *note bytes-like オブジェクト: 193. 'b' を書き込み
          、書き込んだバイト数を返します (これは常に 'b' のバイト数と等
          しくなります。なぜなら、もし書き込みに失敗した場合は *note
          OSError: 2c0. が発生するからです)。実際の実装に依存して、これ
          らのバイト列は根底のストリームに即座に書き込まれることもあれば
          、パフォーマンスやレイテンシの関係でバッファに保持されることも
          あります。

          ノンブロッキングモードであるとき、バッファが満杯で根底の生スト
          リームが書き込み時点でさらなるデータを受け付けられない場合
          *note BlockingIOError: 235. が送出されます。

          このメソッドが戻った後で、呼び出し元は 'b' を解放、または変更
          するかもしれないので、実装はメソッド呼び出しの間だけ 'b' にア
          クセスすべきです。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/

   (2) https://peps.python.org/pep-0475/


File: python.info,  Node: 生ファイルI/O,  Next: バッファ付きストリーム,  Prev: I/O 基底クラス,  Up: クラス階層

5.16.2.10 生ファイルI/O
.......................

 -- クラス: io.FileIO (name, mode='r', closefd=True, opener=None)

     A raw binary stream representing an OS-level file containing bytes
     data.  It inherits from *note RawIOBase: 12e7.

     'name' は、次の 2 つのいずれかです。

        * 開くファイルへのパスを表す文字列または *note bytes: 192. オブ
          ジェクト。 この場合、closefd は ‘True’ (デフォルト) でなければ
          なりません。 ‘True’ でない場合、エラーが送出されます。

        * 結果の *note FileIO: 1527. オブジェクトがアクセスを与える、既
          存の OS レベルファイル記述子の数を表す整数。FileIO オブジェク
          トが閉じられると、'closefd' が ‘False’ に設定されていない場合
          、この fd も閉じられます。

     'mode' は 読み込み（デフォルト）、書き込み、排他的作成、追記に対し
     ‘'r'’ 、 ‘'w'’ 、 ‘'x'’ 、 ‘'a'’ です。ファイルは書き込みや追記で開
     かれたときに存在しない場合作成されます。書き込みのときにファイルの
     内容は破棄されます。作成時に既に存在する場合は *note
     FileExistsError: 1221. が送出されます。作成のためにファイルを開くの
     は暗黙的に書き込みなので、このモードは ‘'w'’ と同じように振る舞いま
     す。読み込みと書き込みを同時に許可するにはモードに ‘'+'’ を加えてく
     ださい。

     The *note read(): 101d. (when called with a positive argument),
     *note readinto(): 101e. and *note write(): 15c5. methods on this
     class will only make one system call.

     呼び出し可能オブジェクトを 'opener' として与えることで、カスタムの
     オープナーが使えます。そしてファイルオブジェクトの基底のファイルデ
     ィスクリプタは、'opener' を ('name', 'flags') で呼び出して得られま
     す。'opener' は開いたファイルディスクリプタを返さなければなりません
     。 (*note os.open: f92. を 'opener' として渡すと、‘None’ を渡したの
     と同様の機能になります。)

     新たに作成されたファイルは *note 継承不可: 10fc. です。

     'opener' 引数を使う例については *note open(): 316. 組み込み関数を参
     照してください。

     バージョン 3.3 で変更: 'opener' 引数が追加されました。‘'x'’ モード
     が追加されました。

     バージョン 3.4 で変更: ファイルが継承不可になりました。

     *note FileIO: 1527. は *note RawIOBase: 12e7. と *note IOBase: 505.
     から継承したデータ属性に加えて以下のデータ属性を提供します:

      -- の属性: mode

          コンストラクタに渡されたモードです。

      -- の属性: name

          ファイル名。コンストラクタに名前が渡されなかったときはファイル
          記述子になります。


File: python.info,  Node: バッファ付きストリーム,  Next: テキスト I/O<2>,  Prev: 生ファイルI/O,  Up: クラス階層

5.16.2.11 バッファ付きストリーム
................................

バッファ付き I/O ストリームは、I/O デバイスに生 I/O より高レベルなインタ
ーフェースを提供します。

 -- クラス: io.BytesIO (initial_bytes=b'')

     A binary stream using an in-memory bytes buffer.  It inherits from
     *note BufferedIOBase: 8a3.  The buffer is discarded when the *note
     close(): 506. method is called.

     省略可能な引数 'initial_bytes' は、初期データを含んだ *note
     bytes-like オブジェクト: 193. です。

     *note BytesIO: 10a4. は *note BufferedIOBase: 8a3. または *note
     IOBase: 505. からのメソッドに加えて、以下のメソッドを提供もしくはオ
     ーバーライドします:

      -- メソッド: getbuffer ()

          バッファの内容をコピーすることなく、その内容の上に、読み込み及
          び書き込みが可能なビューを返します。また、このビューを変更する
          と、バッファの内容は透過的に更新されます:

               >>> b = io.BytesIO(b"abcdef")
               >>> view = b.getbuffer()
               >>> view[2:4] = b"56"
               >>> b.getvalue()
               b'ab56ef'

               注釈: ビューが存在する限り、*note BytesIO: 10a4. オブジェ
               クトはリサイズやクローズされません。

          Added in version 3.2.

      -- メソッド: getvalue ()

          バッファの全内容を含む *note bytes: 192. を返します。

      -- メソッド: read1 (size=-1, /)

          *note BytesIO: 10a4. においては、このメソッドは *note read():
          1540. と同じです。

          バージョン 3.7 で変更: 'size' 引数が任意になりました。

      -- メソッド: readinto1 (b, /)

          *note BytesIO: 10a4. においては、このメソッドは *note
          readinto(): 1895. と同じです。

          Added in version 3.5.

 -- クラス: io.BufferedReader (raw, buffer_size=DEFAULT_BUFFER_SIZE)

     A buffered binary stream providing higher-level access to a
     readable, non seekable *note RawIOBase: 12e7. raw binary stream.
     It inherits from *note BufferedIOBase: 8a3.

     このオブジェクトからデータを読み出した時、背後にある生のストリーム
     からはより大きな量のデータの読み出しがリクエストされ、内部バッファ
     に読み出したデータが保持されることがあります。バッファされたデータ
     はその後の読み出し処理で直接返すことができます。

     このコンストラクタは与えられた 'raw' ストリームと 'buffer_size' に
     対し *note BufferedReader: 1427. を生成します。 'buffer_size' が省
     略された場合、代わりに *note DEFAULT_BUFFER_SIZE: 1a3d. が使われま
     す。

     *note BufferedReader: 1427. は *note BufferedIOBase: 8a3. または
     *note IOBase: 505. からのメソッドに加えて、以下のメソッドを提供もし
     くはオーバーライドします:

      -- メソッド: peek (size=0, /)

          Return bytes from the stream without advancing the position.
          The number of bytes returned may be less or more than
          requested.  If the underlying raw stream is non-blocking and
          the operation would block, returns empty bytes.

      -- メソッド: read (size=-1, /)

          In *note BufferedReader: 1427. this is the same as *note
          io.BufferedIOBase.read(): 1540.

      -- メソッド: read1 (size=-1, /)

          In *note BufferedReader: 1427. this is the same as *note
          io.BufferedIOBase.read1(): 2e56.

          バージョン 3.7 で変更: 'size' 引数が任意になりました。

 -- クラス: io.BufferedWriter (raw, buffer_size=DEFAULT_BUFFER_SIZE)

     A buffered binary stream providing higher-level access to a
     writeable, non seekable *note RawIOBase: 12e7. raw binary stream.
     It inherits from *note BufferedIOBase: 8a3.

     このオブジェクトに対して書き込みを行なったとき、データは通常内部バ
     ッファに配置されます。バッファは以下に示すさまざまな条件で背後にあ
     る *note RawIOBase: 12e7. オブジェクトに書き込まれます:

        * 保留中の全データに対してバッファが足りなくなったとき;

        * when *note flush(): 311c. is called;

        * when a *note seek(): 14a4. is requested (for *note
          BufferedRandom: 15cc. objects);

        * *note BufferedWriter: 15cb. オブジェクトが閉じられたり破棄され
          たりしたとき。

     このコンストラクタは与えられた書き込み可能な 'raw' ストリームに対し
     *note BufferedWriter: 15cb. を生成します。 'buffer_size' が省略され
     た場合、 *note DEFAULT_BUFFER_SIZE: 1a3d. がデフォルトになります。

     *note BufferedWriter: 15cb. は *note BufferedIOBase: 8a3. または
     *note IOBase: 505. からのメソッドに加えて、以下のメソッドを提供もし
     くはオーバーライドします:

      -- メソッド: flush ()

          バッファに保持されたバイト列を生ストリームに強制的に流し込みま
          す。生ストリームがブロックした場合 *note BlockingIOError: 235.
          が送出されます。

      -- メソッド: write (b, /)

          Write the *note bytes-like object: 193, 'b', and return the
          number of bytes written.  When in non-blocking mode, a *note
          BlockingIOError: 235. with *note
          BlockingIOError.characters_written: 2701. set is raised if the
          buffer needs to be written out but the raw stream blocks.

 -- クラス: io.BufferedRandom (raw, buffer_size=DEFAULT_BUFFER_SIZE)

     A buffered binary stream providing higher-level access to a
     seekable *note RawIOBase: 12e7. raw binary stream.  It inherits
     from *note BufferedReader: 1427. and *note BufferedWriter: 15cb.

     このコンストラクタは第一引数として与えられるシーク可能な生ストリー
     ムに対し、リーダーおよびライターを作成します。 'buffer_size' が省略
     された場合、 *note DEFAULT_BUFFER_SIZE: 1a3d. がデフォルトになりま
     す。

     *note BufferedRandom: 15cc. is capable of anything *note
     BufferedReader: 1427. or *note BufferedWriter: 15cb. can do.  In
     addition, *note seek(): 14a4. and *note tell(): 15c6. are
     guaranteed to be implemented.

 -- クラス: io.BufferedRWPair (reader, writer,
          buffer_size=DEFAULT_BUFFER_SIZE, /)

     A buffered binary stream providing higher-level access to two non
     seekable *note RawIOBase: 12e7. raw binary streams--one readable,
     the other writeable.  It inherits from *note BufferedIOBase: 8a3.

     'reader' と 'writer' はそれぞれ読み込み可能、書き込み可能な *note
     RawIOBase: 12e7. オブジェクトです。 'buffer_size' が省略された場合
     *note DEFAULT_BUFFER_SIZE: 1a3d. がデフォルトになります。

     *note BufferedRWPair: 15cd. は、 *note UnsupportedOperation: 1d7f.
     を送出する *note detach(): 2deb. を除く、 *note BufferedIOBase:
     8a3. の全てのメソッドを実装します。

          警告: *note BufferedRWPair: 15cd. は下層の生ストリームのアクセ
          スを同期しようとはしません。同じオブジェクトをリーダとライタと
          して渡してはいけません。その場合は代わりに *note
          BufferedRandom: 15cc. を使用してください。


File: python.info,  Node: テキスト I/O<2>,  Prev: バッファ付きストリーム,  Up: クラス階層

5.16.2.12 テキスト I/O
......................

 -- クラス: io.TextIOBase

     Base class for text streams.  This class provides a character and
     line based interface to stream I/O. It inherits from *note IOBase:
     505.

     *note IOBase: 505. から継承した属性とメソッドに加えて、 *note
     TextIOBase: 8a4. は以下のデータ属性とメソッドを提供しています:

      -- の属性: encoding

          エンコーディング名で、ストリームのバイト列を文字列にデコードす
          るとき、また文字列をバイト列にエンコードするときに使われます。

      -- の属性: errors

          このエンコーダやデコーダのエラー設定です。

      -- の属性: newlines

          文字列、文字列のタプル、または ‘None’ で、改行がどのように読み
          換えられるかを指定します。実装や内部コンストラクタのフラグに依
          って、これは利用できないことがあります。

      -- の属性: buffer

          The underlying binary buffer (a *note BufferedIOBase: 8a3. or
          *note RawIOBase: 12e7. instance) that *note TextIOBase: 8a4.
          deals with.  This is not part of the *note TextIOBase: 8a4.
          API and may not exist in some implementations.

      -- メソッド: detach ()

          根底のバイナリバッファを *note TextIOBase: 8a4. から分離して返
          します。

          根底のバッファが取り外された後、 *note TextIOBase: 8a4. は使用
          不能状態になります。

          *note TextIOBase: 8a4. 実装には、 *note StringIO: 112a. など、
          根底のバッファという概念を持たないものがあります。これらを呼び
          出すと *note UnsupportedOperation: 1d7f. を送出します。

          Added in version 3.1.

      -- メソッド: read (size=-1, /)

          最大 'size' 文字をストリームから読み込み、一つの *note str:
          169. にして返します。 'size' が負の値または ‘None’ ならば、
          EOF まで読みます。

      -- メソッド: readline (size=-1, /)

          Read until newline or EOF and return a single *note str: 169.
          If the stream is already at EOF, an empty string is returned.

          'size' が指定された場合、最大 'size' 文字が読み込まれます。

      -- メソッド: seek (offset, whence=SEEK_SET, /)

          Change the stream position to the given 'offset'.  Behaviour
          depends on the 'whence' parameter.  The default value for
          'whence' is ‘SEEK_SET’.

             * ‘SEEK_SET’ or ‘0’: seek from the start of the stream (the
               default); 'offset' must either be a number returned by
               *note TextIOBase.tell(): 3122, or zero.  Any other
               'offset' value produces undefined behaviour.

             * ‘SEEK_CUR’ or ‘1’: "seek" to the current position;
               'offset' must be zero, which is a no-operation (all other
               values are unsupported).

             * ‘SEEK_END’ or ‘2’: seek to the end of the stream;
               'offset' must be zero (all other values are unsupported).

          新しい絶対位置を、不透明な数値で返します。

          Added in version 3.1: The ‘SEEK_*’ constants.

      -- メソッド: tell ()

          ストリームの現在位置を不透明な数値で返します。この値は根底のバ
          イナリストレージ内でのバイト数を表すとは限りません。

      -- メソッド: write (s, /)

          文字列 's' をストリームに書き出し、書き出された文字数を返しま
          す。

 -- クラス: io.TextIOWrapper (buffer, encoding=None, errors=None,
          newline=None, line_buffering=False, write_through=False)

     A buffered text stream providing higher-level access to a *note
     BufferedIOBase: 8a3. buffered binary stream.  It inherits from
     *note TextIOBase: 8a4.

     'encoding' gives the name of the encoding that the stream will be
     decoded or encoded with.  In *note UTF-8 Mode: 866, this defaults
     to UTF-8.  Otherwise, it defaults to *note locale.getencoding():
     329.  ‘encoding="locale"’ can be used to specify the current
     locale's encoding explicitly.  See *note Text Encoding: 9c0. for
     more information.

     'errors' はオプションの文字列で、エンコードやデコードの際のエラーを
     どのように扱うかを指定します。エンコードエラーがあったときに *note
     ValueError: 2ec. 例外を送出させるには ‘'strict'’ を渡します (デフォ
     ルトの ‘None’ でも同じです)。エラーを無視させるには ‘'ignore'’ を渡
     します。 (エンコーディングエラーを無視するとデータを喪失する可能性
     があることに注意してください。) ‘'replace'’ は不正な形式の文字の代
     わりにマーカ (たとえば ‘'?'’) を挿入させます。‘'backslashreplace'’
     を指定すると、不正な形式のデータをバックスラッシュ付きのエスケープ
     シーケンスに置換します。書き込み時には ‘'xmlcharrefreplace'’ (適切
     な XML 文字参照に置換) や ‘'namereplace'’ (‘\N{...}’ エスケープシー
     ケンスに置換) も使えます。他にも *note codecs.register_error():
     16b4. で登録されたエラー処理名が有効です。

     'newline' は行末をどのように処理するかを制御します 。‘None’, ‘''’,
     ‘'\n'’, ‘'\r'’, ‘'\r\n'’ のいずれかです。これは以下のように動作しま
     す:

        * ストリームからの入力を読み込んでいるとき、もし 'newline' が
          ‘None’ ならば *note universal newlines: f35. モードが有効にな
          ります。入力中の行は ‘'\n'’, ‘'\r'’, または ‘'\r\n'’ のいずれ
          で終わってもよく、それらは呼び出し元に返される前に'''n''' に変
          換されます。 'newline' が ‘''’ の場合、 universal newlines モ
          ードは有効になりますが、行末のコードは変換されずに呼び出し元に
          返されます。 'newline' がその他の有効な値の場合は、入力行は与
          えられた文字列のみで終端され、行末は変換されずに呼び出し元に返
          されます。

        * ストリームへの出力の書き込み時、'newline' が ‘None’ の場合、全
          ての ‘'\n'’ 文字はシステムのデフォルトの行セパレータ *note
          os.linesep: 25dc. に変換されます。 'newline' が ‘''’ または
          ‘'\n'’ の場合は変換されません。'newline' がその他の正当な値の
          場合、全ての ‘'\n'’ 文字は与えられた文字列に変換されます。

     If 'line_buffering' is ‘True’, *note flush(): 2ce6. is implied when
     a call to write contains a newline character or a carriage return.

     If 'write_through' is ‘True’, calls to *note write(): ed7. are
     guaranteed not to be buffered: any data written on the *note
     TextIOWrapper: 9be. object is immediately handled to its underlying
     binary 'buffer'.

     バージョン 3.3 で変更: 'write_through' 引数が追加されました。

     バージョン 3.3 で変更: 'encoding' の規定値が
     ‘locale.getpreferredencoding()’ から
     ‘locale.getpreferredencoding(False)’ になりました。 *note
     locale.setlocale(): 328. を用いてロケールのエンコーディングを一時的
     に変更してはいけません。ユーザが望むエンコーディングではなく現在の
     ロケールのエンコーディングを使用してください。

     バージョン 3.10 で変更: The 'encoding' argument now supports the
     ‘"locale"’ dummy encoding name.

          注釈: When the underlying raw stream is non-blocking, a *note
          BlockingIOError: 235. may be raised if a read operation cannot
          be completed immediately.

     *note TextIOWrapper: 9be. は *note TextIOBase: 8a4. と *note
     IOBase: 505. から継承したものに加えて以下のデータ属性をメソッドを提
     供します:

      -- の属性: line_buffering

          行バッファリングが有効かどうか。

      -- の属性: write_through

          書き込みが、根柢のバイナリバッファに即座に渡されるかどうか。

          Added in version 3.7.

      -- メソッド: reconfigure (*, encoding=None, errors=None,
               newline=None, line_buffering=None, write_through=None)

          このテキストストリームを 'encoding', 'errors', 'newline',
          'line_buffering' と 'write_through' を新しい設定として再設定し
          ます。

          'encoding' が指定されており、'errors' が指定されていないときに
          、 ‘errors='strict'’ が使われている場合を除き、指定されなかっ
          たパラメータは現在の設定が保持されます。

          ストリームからすでにデータが読み出されていた場合、encodingと
          newlineは変更できません。一方で、書き込み後にencodingを変更す
          ることはできます。

          このメソッドは、新しい設定を適用するまえにストリームをフラッシ
          ュします。

          Added in version 3.7.

          バージョン 3.11 で変更: The method supports
          ‘encoding="locale"’ option.

      -- メソッド: seek (cookie, whence=os.SEEK_SET, /)

          Set the stream position.  Return the new stream position as an
          *note int: 19b.

          Four operations are supported, given by the following argument
          combinations:

             * ‘seek(0, SEEK_SET)’: Rewind to the start of the stream.

             * ‘seek(cookie, SEEK_SET)’: Restore a previous position;
               'cookie' 'must be' a number returned by *note tell():
               17b1.

             * ‘seek(0, SEEK_END)’: Fast-forward to the end of the
               stream.

             * ‘seek(0, SEEK_CUR)’: Leave the current stream position
               unchanged.

          Any other argument combinations are invalid, and may raise
          exceptions.

          参考
          ....

          *note os.SEEK_SET: 14a5, *note os.SEEK_CUR: 14a6, and *note
          os.SEEK_END: 14a7.

      -- メソッド: tell ()

          Return the stream position as an opaque number.  The return
          value of ‘tell()’ can be given as input to *note seek(): 3125,
          to restore a previous stream position.

 -- クラス: io.StringIO (initial_value='', newline='\n')

     A text stream using an in-memory text buffer.  It inherits from
     *note TextIOBase: 8a4.

     テキストバッファは *note close(): 506. メソッドが呼び出されたときに
     破棄されます。

     The initial value of the buffer can be set by providing
     'initial_value'.  If newline translation is enabled, newlines will
     be encoded as if by *note write(): 205b.  The stream is positioned
     at the start of the buffer which emulates opening an existing file
     in a ‘w+’ mode, making it ready for an immediate write from the
     beginning or for a write that would overwrite the initial value.
     To emulate opening a file in an ‘a+’ mode ready for appending, use
     ‘f.seek(0, io.SEEK_END)’ to reposition the stream at the end of the
     buffer.

     'newline' 引数は *note TextIOWrapper: 9be. の同名の引数と同じように
     働きます。ただし、出力をストリームに書き込む時に 'newline' が
     ‘None’ の場合には、改行は全てのプラットフォームで ‘\n’ になります。

     *note TextIOBase: 8a4. と *note IOBase: 505. から継承したメソッドに
     加えて *note StringIO: 112a. は以下のメソッドを提供しています:

      -- メソッド: getvalue ()

          Return a *note str: 169. containing the entire contents of the
          buffer.  Newlines are decoded as if by *note read(): 206c,
          although the stream position is not changed.

     使用例:

          import io

          output = io.StringIO()
          output.write('First line.\n')
          print('Second line.', file=output)

          # Retrieve file contents -- this will be
          # 'First line.\nSecond line.\n'
          contents = output.getvalue()

          # Close object and discard memory buffer --
          # .getvalue() will now raise an exception.
          output.close()

 -- クラス: io.IncrementalNewlineDecoder

     A helper codec that decodes newlines for *note universal newlines:
     f35. mode.  It inherits from *note codecs.IncrementalDecoder: 2837.


File: python.info,  Node: Static Typing,  Next: 性能<3>,  Prev: クラス階層,  Up: io --- ストリームを扱うコアツール

5.16.2.13 Static Typing
.......................

The following protocols can be used for annotating function and method
arguments for simple stream reading or writing operations.  They are
decorated with *note @typing.runtime_checkable: 675.

 -- クラス: io.Reader [T]

     Generic protocol for reading from a file or other input stream.
     ‘T’ will usually be *note str: 169. or *note bytes: 192, but can be
     any type that is read from the stream.

     Added in version 3.14.

      -- メソッド: read ()

      -- メソッド: read (size, /)

          Read data from the input stream and return it.  If 'size' is
          specified, it should be an integer, and at most 'size' items
          (bytes/characters) will be read.

     例えば:

          def read_it(reader: Reader[str]):
              data = reader.read(11)
              assert isinstance(data, str)

 -- クラス: io.Writer [T]

     Generic protocol for writing to a file or other output stream.  ‘T’
     will usually be *note str: 169. or *note bytes: 192, but can be any
     type that can be written to the stream.

     Added in version 3.14.

      -- メソッド: write (data, /)

          Write 'data' to the output stream and return the number of
          items (bytes/characters) written.

     例えば:

          def write_binary(writer: Writer[bytes]):
              writer.write(b"Hello world!\n")

See *note ABCs and Protocols for working with I/O: 312a. for other I/O
related protocols and classes that can be used for static type checking.


File: python.info,  Node: 性能<3>,  Prev: Static Typing,  Up: io --- ストリームを扱うコアツール

5.16.2.14 性能
..............

このセクションでは与えられた具体的な I/O 実装の性能について議論します。

* Menu:

* バイナリ I/O: バイナリ I/O<2>.
* テキスト I/O: テキスト I/O<3>.
* マルチスレッディング: マルチスレッディング<3>.
* リエントラント性::


File: python.info,  Node: バイナリ I/O<2>,  Next: テキスト I/O<3>,  Up: 性能<3>

5.16.2.15 バイナリ I/O
......................

バッファ付き I/O は、ユーザが 1 バイトだけ要求した場合でさえ、データを大
きな塊でのみ読み書きします。これにより、オペレーティングシステムのバッフ
ァ無し I/O ルーチンを呼び出して実行する非効率性はすべて隠されます。その
成果は、OS と、実行される I/O の種類によって異なります。例えば、Linux の
ような現行の OS では、バッファ無しディスク I/O がバッファ付き I/O と同じ
くらい早いことがあります。しかし、どのプラットフォームとデバイスにおいて
も、バッファ付き I/O は最低でも予測可能なパフォーマンスを提供します。で
すから、バイナリデータに対しては、バッファ無し I/O を使用するより、バッ
ファ付きの I/O を使用するほうが望ましい場合がほとんどです。


File: python.info,  Node: テキスト I/O<3>,  Next: マルチスレッディング<3>,  Prev: バイナリ I/O<2>,  Up: 性能<3>

5.16.2.16 テキスト I/O
......................

Text I/O over a binary storage (such as a file) is significantly slower
than binary I/O over the same storage, because it requires conversions
between unicode and binary data using a character codec.  This can
become noticeable handling huge amounts of text data like large log
files.  Also, *note tell(): 3122. and *note seek(): 3121. are both quite
slow due to the reconstruction algorithm used.

しかし *note StringIO: 112a. は、ネイティブなインメモリ Unicode コンテナ
で、 *note BytesIO: 10a4. と同程度の速度を示します。


File: python.info,  Node: マルチスレッディング<3>,  Next: リエントラント性,  Prev: テキスト I/O<3>,  Up: 性能<3>

5.16.2.17 マルチスレッディング
..............................

*note FileIO: 1527. objects are thread-safe to the extent that the
operating system calls (such as ‘read(2)(1)’ under Unix) they wrap are
thread-safe too.

バイナリバッファ付きオブジェクト (*note BufferedReader: 1427, *note
BufferedWriter: 15cb, *note BufferedRandom: 15cc. および *note
BufferedRWPair: 15cd. のインスタンス) は、その内部構造をロックを使って保
護します。このため、これらを複数のスレッドから同時に呼び出しても安全です
。

*note TextIOWrapper: 9be. オブジェクトはスレッドセーフではありません。

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/read(2)


File: python.info,  Node: リエントラント性,  Prev: マルチスレッディング<3>,  Up: 性能<3>

5.16.2.18 リエントラント性
..........................

バイナリバッファ付きオブジェクト (*note BufferedReader: 1427, *note
BufferedWriter: 15cb, *note BufferedRandom: 15cc. および *note
BufferedRWPair: 15cd. のインスタンス) は、リエントラント (再入可能) では
ありません。リエントラントな呼び出しは普通の状況では起こりませんが、 I/O
を *note signal: cb. ハンドラで行なっているときに起こりえます。スレッド
が、すでにアクセスしているバッファ付きオブジェクトに再び入ろうとすると
*note RuntimeError: 244. が送出されます。これは、バッファ付きオブジェク
トに複数のスレッドから入ることを禁止するわけではありません。

The above implicitly extends to text files, since the *note open(): 316.
function will wrap a buffered object inside a *note TextIOWrapper: 9be.
This includes standard streams and therefore affects the built-in *note
print(): 1177. function as well.


File: python.info,  Node: time --- 時刻データへのアクセスと変換,  Next: logging --- Python 用のログ記録手段,  Prev: io --- ストリームを扱うコアツール,  Up: 汎用オペレーティングシステムサービス

5.16.3 ‘time’ -- 時刻データへのアクセスと変換
---------------------------------------------

__________________________________________________________________

このモジュールでは、時刻に関するさまざまな関数を提供します。関連した機能
について、*note datetime: 34, *note calendar: 15. モジュールも参照してく
ださい。

このモジュールは常に利用可能ですが、すべての関数がすべてのプラットフォー
ムで利用可能なわけではありません。このモジュールで定義されているほとんど
の関数は、プラットフォーム上の同名の C ライブラリ関数を呼び出します。こ
れらの関数に対する意味付けはプラットフォーム間で異なるため、プラットフォ
ーム提供のドキュメントを読んでおくと便利でしょう。

まずいくつかの用語の説明と慣習について整理します。

   * The 'epoch' is the point where the time starts, the return value of
     ‘time.gmtime(0)’.  It is January 1, 1970, 00:00:00 (UTC) on all
     platforms.

   * 'エポック秒' ('seconds since the epoch') は、エポックからの総経過秒
     数を示していますが、たいていはうるう秒 (leap seconds(1)) は含まれて
     いません。 全ての POSIX 互換のプラットフォームで、うるう秒はこの総
     秒数には含まれません。

   * このモジュールの中の関数は、エポック (*note epoch: 2f13.) 以前ある
     いは遠い未来の日付や時刻を扱うことができません。将来カットオフ（関
     数が正しく日付や時刻を扱えなくなる）が起きる時点は、C ライブラリに
     よって決まります。32-bit システムではカットオフは通常 2038 年です。

   * 関数 *note strptime(): 1646. は ‘%y’ 書式コードが与えられた時に 2 桁
     の年表記を解析できます。2 桁の年を解析する場合、それらは POSIX およ
     び ISO C 標準に従って変換されます: 69-99 の西暦年は 1969-1999 とな
     り、0–68 の西暦年は 2000–2068 になります。

   * UTC is Coordinated Universal Time(2) and superseded Greenwich Mean
     Time(3) or GMT as the basis of international timekeeping.  The
     acronym UTC is not a mistake but conforms to an earlier,
     language-agnostic naming scheme for time standards such as UT0,
     UT1, and UT2.

   * DST は夏時間 (Daylight Saving Time) のことで、一年のうちの一定期間
     に 1 時間タイムゾーンを修正することです。DST のルールは不可思議で
     (地域ごとに法律で定められています)、年ごとに変わることもあります。C
     ライブラリはローカルルールを記したテーブルを持っており (柔軟に対応
     するため、たいていはシステムファイルから読み込まれます)、この点に関
     しては唯一の真実の知識の源です。

   * 多くの現時刻を返す関数 (real-time functions) の精度は、値や引数を表
     現するために使う単位から想像されるよりも低いかも知れません。例えば
     、ほとんどの Unix システムにおいて、クロックの 1 ティックの精度は
     50 から 100 分の 1 秒に過ぎません。

   * 一方、*note time(): 55d. および *note sleep(): 8ac. は Unix の同等
     の関数よりましな精度を持っています。時刻は浮動小数点数で表され、
     *note time(): 55d. は可能なかぎり最も正確な時刻を (Unix の
     ‘gettimeofday()’ があればそれを使って) 返します。また *note
     sleep(): 8ac. にはゼロでない端数を与えることができます (Unix の
     ‘select()’ があれば、それを使って実装しています)。

   * *note gmtime(): 13d8, *note localtime(): 1712, *note strptime():
     1646. が返す時刻値、および *note asctime(): 1400, *note mktime():
     1401, *note strftime(): 1402. がとる時刻値は 9 個の整数からなるシー
     ケンスです。*note gmtime(): 13d8, *note localtime(): 1712, *note
     strptime(): 1646. の戻り値は個々の値を属性名で取得することもできま
     す。

     これらのオブジェクトについての解説は *note struct_time: ee6. を参照
     してください。

     バージョン 3.3 で変更: *note struct_time: ee6. オブジェクトは、プラ
     ットフォームが、対応する ‘struct tm’ メンバーをサポートしている場合
     、*note tm_gmtoff: 3133. および *note tm_zone: 3134. 属性が拡張され
     るようになりました。

     バージョン 3.6 で変更: *note struct_time: ee6. の属性 *note
     tm_gmtoff: 3133. および *note tm_zone: 3134. が全てのプラットフォー
     ムで利用できるようになりました。

   * 時間の表現を変換するには、以下の関数を利用してください:

     対象                          変換先                        関数
                                                                 
     ------------------------------------------------------------------------------------------
                                                                 
     エポックからの秒数            UTC の                        *note gmtime(): 13d8.
                                   *note struct_time: ee6.       
                                   
                                                                 
     エポックからの秒数            ローカル時間の                *note localtime(): 1712.
                                   *note struct_time: ee6.       
                                   
                                                                 
     UTC の                        エポックからの秒数            *note calendar.timegm(): 2948.
     *note struct_time: ee6.                                     

     ローカル時間の                エポックからの秒数            *note mktime(): 1401.
     *note struct_time: ee6.                                     

* Menu:

* 関数: 関数<5>.
* Clock ID Constants::
* Timezone Constants::

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Leap_second

   (2) https://en.wikipedia.org/wiki/Coordinated_Universal_Time

   (3) https://en.wikipedia.org/wiki/Greenwich_Mean_Time


File: python.info,  Node: 関数<5>,  Next: Clock ID Constants,  Up: time --- 時刻データへのアクセスと変換

5.16.3.1 関数
.............

 -- の関数: time.asctime ([t])

     Convert a tuple or *note struct_time: ee6. representing a time as
     returned by *note gmtime(): 13d8. or *note localtime(): 1712. to a
     string of the following form: ‘'Sun Jun 20 23:21:05 1993'’.  The
     day field is two characters long and is space padded if the day is
     a single digit, e.g.: ‘'Wed Jun 9 04:26:40 1993'’.

     If 't' is not provided, the current time as returned by *note
     localtime(): 1712. is used.  Locale information is not used by
     *note asctime(): 1400.

          注釈: 同名の C の関数と違って、*note asctime(): 1400. は末尾に
          改行文字を加えません。

 -- の関数: time.pthread_getcpuclockid (thread_id)

     Return the 'clk_id' of the thread-specific CPU-time clock for the
     specified 'thread_id'.

     Use *note threading.get_ident(): 1372. or the *note ident: 3137.
     attribute of *note threading.Thread: 176. objects to get a suitable
     value for 'thread_id'.

          警告: Passing an invalid or expired 'thread_id' may result in
          undefined behavior, such as segmentation fault.

     *note Availability: 213f.: Unix

     更なる情報については ‘pthread_getcpuclockid(3)(1)’ の man を参照し
     てください。

     Added in version 3.7.

 -- の関数: time.clock_getres (clk_id)

     指定された 'clk_id' クロックの分解能(精度)を返します。 'clk_id' と
     して受け付けられる値の一覧は *note Clock ID Constants: 30ad. を参照
     してください。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

 -- の関数: time.clock_gettime (clk_id) -> float

     指定された 'clk_id' クロックの時刻を返します。 'clk_id' として受け
     付けられる値の一覧は *note Clock ID Constants: 30ad. を参照してくだ
     さい。

     Use *note clock_gettime_ns(): cdb. to avoid the precision loss
     caused by the *note float: 196. type.

     *note Availability: 213f.: Unix.

     Added in version 3.3.

 -- の関数: time.clock_gettime_ns (clk_id) -> int

     *note clock_gettime(): 1376. に似ていますが、ナノ秒単位の時刻を返し
     ます。

     *note Availability: 213f.: Unix.

     Added in version 3.7.

 -- の関数: time.clock_settime (clk_id, time: float)

     指定された 'clk_id' クロックの時刻を設定します。 現在、 *note
     CLOCK_REALTIME: 8a9. は 'clk_id' が受け付ける唯一の値です。

     Use *note clock_settime_ns(): cdc. to avoid the precision loss
     caused by the *note float: 196. type.

     *note Availability: 213f.: Unix, not Android, not iOS.

     Added in version 3.3.

 -- の関数: time.clock_settime_ns (clk_id, time: int)

     *note clock_settime(): 1377. に似ていますが、ナノ秒単位の時刻を設定
     します。

     *note Availability: 213f.: Unix, not Android, not iOS.

     Added in version 3.7.

 -- の関数: time.ctime ([secs])

     Convert a time expressed in seconds since the *note epoch: 2f13. to
     a string of a form: ‘'Sun Jun 20 23:21:05 1993'’ representing local
     time.  The day field is two characters long and is space padded if
     the day is a single digit, e.g.: ‘'Wed Jun 9 04:26:40 1993'’.

     'secs' を指定しないか *note None: 885. を指定した場合、*note
     time(): 55d. が返す値を現在の時刻として使用します。‘ctime(secs)’ は
     ‘asctime(localtime(secs))’ と等価です。ローカル情報は *note
     ctime(): 28c5. には使用されません。

 -- の関数: time.get_clock_info (name)

     指定されたクロックの情報を名前空間オブジェクトとして取得します。サ
     ポートされているクロック名およびそれらの値を取得する関数は以下の通
     りです:

        * ‘'monotonic'’: *note time.monotonic(): 55c.

        * ‘'perf_counter'’: *note time.perf_counter(): c7a.

        * ‘'process_time'’: *note time.process_time(): c7b.

        * ‘'thread_time'’: *note time.thread_time(): b30.

        * ‘'time'’: *note time.time(): 55d.

     結果は以下の属性をもちます:

        - 'adjustable': ‘True’ if the clock can be set to jump forward
          or backward in time, ‘False’ otherwise.  Does not refer to
          gradual NTP rate adjustments.

        - 'implementation': クロック値を取得するために内部で使用している
          C 関数の名前です。 使える値については *note Clock ID
          Constants: 30ad. を参照してください。

        - 'monotonic': クロック値が後戻りすることがない場合 ‘True’ が、
          そうでない場合は ‘False’ になります。

        - 'resolution': クロックの分解能を秒 (*note float: 196.) で表し
          ます。

     Added in version 3.3.

 -- の関数: time.gmtime ([secs])

     エポック (*note epoch: 2f13.) からの経過時間で表現された時刻を、UTC
     で *note struct_time: ee6. に変換します。このとき dst フラグは常に
     ゼロとして扱われます。'secs' を指定しないか *note None: 885. を指定
     した場合、*note time(): 55d. が返す値を現在の時刻として使用します。
     秒の端数は無視されます。*note struct_time: ee6. オブジェクトについ
     ては前述の説明を参照してください。*note calendar.timegm(): 2948. は
     この関数と逆の変換を行います。

 -- の関数: time.localtime ([secs])

     *note gmtime(): 13d8. に似ていますが、ローカル時間に変換します。
     'secs' を指定しないか *note None: 885. を指定した場合、*note
     time(): 55d. が返す値を現在の時刻として使用します。DST が適用されて
     いる場合は dst フラグには ‘1’ が設定されます。

     *note localtime(): 1712. may raise *note OverflowError: a81, if the
     timestamp is outside the range of values supported by the platform
     C ‘localtime()’ or ‘gmtime()’ functions, and *note OSError: 2c0. on
     ‘localtime()’ or ‘gmtime()’ failure.  It's common for this to be
     restricted to years between 1970 and 2038.

 -- の関数: time.mktime (t)

     *note localtime(): 1712. の逆を行う関数です。引数は *note
     struct_time: ee6. か 9 個の要素すべての値を持つ完全なタプル (dst フ
     ラグも必要です; 時刻に DST が適用されるか不明の場合は ‘-1’ を使用し
     てください) で、UTC ではなく 'ローカル' 時間を指定します。戻り値は
     *note time(): 55d. との互換性のために浮動小数点数になります。入力し
     た値を正しい時刻として表現できない場合、例外 *note OverflowError:
     a81. または *note ValueError: 2ec. が送出されます (どちらが送出され
     るかは、無効な値を受け取ったのが Python と下層の C ライブラリのどち
     らなのかによって決まります)。この関数で時刻を生成できる最も古い日付
     はプラットフォームに依存します。

 -- の関数: time.monotonic () -> float

     モノトニッククロック、すなわち後戻りしないクロックの値を (小数秒で)
     返します。このクロックはシステムクロックの更新の影響を受けません。
     戻り値の基準点は定義されていないので、二回の呼び出しの結果の差だけ
     が有効です。

     Clock:

        * On Windows, call ‘QueryPerformanceCounter()’ and
          ‘QueryPerformanceFrequency()’.

        * On macOS, call ‘mach_absolute_time()’ and
          ‘mach_timebase_info()’.

        * On HP-UX, call ‘gethrtime()’.

        * Call ‘clock_gettime(CLOCK_HIGHRES)’ if available.

        * Otherwise, call ‘clock_gettime(CLOCK_MONOTONIC)’.

     Use *note monotonic_ns(): cdd. to avoid the precision loss caused
     by the *note float: 196. type.

     Added in version 3.3.

     バージョン 3.5 で変更: The function is now always available and the
     clock is now the same for all processes.

     バージョン 3.10 で変更: On macOS, the clock is now the same for all
     processes.

 -- の関数: time.monotonic_ns () -> int

     *note monotonic(): 55c. に似ていますが、ナノ秒単位の時刻を返します
     。

     Added in version 3.7.

 -- の関数: time.perf_counter () -> float

     Return the value (in fractional seconds) of a performance counter,
     i.e.  a clock with the highest available resolution to measure a
     short duration.  It does include time elapsed during sleep.  The
     clock is the same for all processes.  The reference point of the
     returned value is undefined, so that only the difference between
     the results of two calls is valid.

     'CPython 実装の詳細:' On CPython, use the same clock as *note
     time.monotonic(): 55c. and is a monotonic clock, i.e.  a clock that
     cannot go backwards.

     Use *note perf_counter_ns(): cde. to avoid the precision loss
     caused by the *note float: 196. type.

     Added in version 3.3.

     バージョン 3.10 で変更: On Windows, the clock is now the same for
     all processes.

     バージョン 3.13 で変更: Use the same clock as *note
     time.monotonic(): 55c.

 -- の関数: time.perf_counter_ns () -> int

     *note perf_counter(): c7a. に似ていますが、ナノ秒単位の時刻を返しま
     す。

     Added in version 3.7.

 -- の関数: time.process_time () -> float

     現在のプロセスのシステムおよびユーザー CPU 時間の値を (小数秒で) 返
     します。これはスリープ中の経過時間を含みません。これは定義上プロセ
     スワイドです。戻り値の基準点は定義されていないので、二回の呼び出し
     の結果の差だけが有効です。

     Use *note process_time_ns(): cdf. to avoid the precision loss
     caused by the *note float: 196. type.

     Added in version 3.3.

 -- の関数: time.process_time_ns () -> int

     *note process_time(): c7b. に似ていますが、ナノ秒単位の時刻を返しま
     す。

     Added in version 3.7.

 -- の関数: time.sleep (secs)

     Suspend execution of the calling thread for the given number of
     seconds.  The argument may be a floating-point number to indicate a
     more precise sleep time.

     If the sleep is interrupted by a signal and no exception is raised
     by the signal handler, the sleep is restarted with a recomputed
     timeout.

     The suspension time may be longer than requested by an arbitrary
     amount, because of the scheduling of other activity in the system.

     Windows implementation
     ......................

     On Windows, if 'secs' is zero, the thread relinquishes the
     remainder of its time slice to any other thread that is ready to
     run.  If there are no other threads ready to run, the function
     returns immediately, and the thread continues execution.  On
     Windows 10 and newer the implementation uses a high-resolution
     timer(2) which provides resolution of 100 nanoseconds.  If 'secs'
     is zero, ‘Sleep(0)’ is used.

     Unix implementation
     ...................

        * Use ‘clock_nanosleep()’ if available (resolution: 1
          nanosecond);

        * Or use ‘nanosleep()’ if available (resolution: 1 nanosecond);

        * Or use ‘select()’ (resolution: 1 microsecond).

          注釈: To emulate a "no-op", use *note pass: 17e. instead of
          ‘time.sleep(0)’.

          To voluntarily relinquish the CPU, specify a real-time *note
          scheduling policy: 30f4. and use *note os.sched_yield(): 1329.
          instead.

     引数 ‘secs’ を指定して *note 監査イベント: 1c6e. ‘time.sleep’ を送
     出します。

     バージョン 3.5 で変更: スリープがシグナルに中断されてもシグナルハン
     ドラが例外を送出しない限り、少なくとも 'secs' だけスリープするよう
     になりました (論拠については PEP 475(3) を参照してください)。

     バージョン 3.11 で変更: On Unix, the ‘clock_nanosleep()’ and
     ‘nanosleep()’ functions are now used if available.  On Windows, a
     waitable timer is now used.

     バージョン 3.13 で変更: Raises an auditing event.

 -- の関数: time.strftime (format[, t])

     *note gmtime(): 13d8. や *note localtime(): 1712. が返す時刻値タプ
     ルまたは *note struct_time: ee6. を、'format' で指定した文字列形式
     に変換します。't' が与えられていない場合、*note localtime(): 1712.
     が返す値を現在の時刻として使用します。'format' は文字列でなくてはな
     りません。't' のいずれかのフィールドが許容範囲外の数値であった場合
     、*note ValueError: 2ec. を送出します。

     0 は時刻タプル内のいずれの位置の引数にも使用できます; それが一般に
     不正な値であれば、正しい値に強制的に置き換えられます。

     'format' 文字列には以下のディレクティブ (指示語) を埋め込むことがで
     きます。これらはフィールド長や精度のオプションを付けずに表され、
     *note strftime(): 1402. の結果の対応する文字列に置き換えられます:

     ディレクティ    意味                                                 注釈
     ブ                                                                   

     ---------------------------------------------------------------------------------
                                                                          
     ‘%a’            ロケールの短縮された曜日名になります。
                     
                                                                          
     ‘%A’            ロケールの曜日名になります。
                     
                                                                          
     ‘%b’            ロケールの短縮された月名になります。
                     
                                                                          
     ‘%B’            ロケールの月名になります。
                     
                                                                          
     ‘%c’            ロケールの日時を適切な形式で表します。
                     
                                                                          
     ‘%d’            月中の日にちの 10 進表記になります [01,31]。
                     
                                                                          
     ‘%f’            Microseconds as a decimal number                     (1)
                                                                          
                          [000000,999999].
                     
                                                                          
     ‘%H’            時 (24 時間表記) の 10 進表記になります [00,23]。
                     
                                                                          
     ‘%I’            時 (12 時間表記) の 10 進表記になります [01,12]。
                     
                                                                          
     ‘%j’            年中の日にちの 10 進表記になります [001,366]。
                     
                                                                          
     ‘%m’            月の 10 進表記になります [01,12]。
                     
                                                                          
     ‘%M’            分の 10 進表記になります [00,59]。
                     
                                                                          
     ‘%p’            ロケールの AM もしくは PM と等価な文字列になります   (2)
                     。                                                   
                     
                                                                          
     ‘%S’            秒の 10 進表記になります [00,61]。                   (3)
                                                                          
                                                                          
     ‘%U’            年の初めから何週目か (日曜を週の始まりとします) を   (4)
                     表す 10 進数になります [00,53]。年が明けてから最初   
                     の日曜日までのすべての曜日は 0 週目に属すると見な
                     されます。
                     
                                                                          
     ‘%u’            Day of the week (Monday is 1; Sunday is 7) as a
                     decimal number [1, 7].
                     
                                                                          
     ‘%w’            曜日の 10 進表記になります [0 (日曜日),6]。
                     
                                                                          
     ‘%W’            年の初めから何週目か (月曜を週の始まりとします) を   (4)
                     表す 10 進数になります [00,53]。年が明けてから最初   
                     の月曜日までの全ての曜日は 0 週目に属すると見なさ
                     れます。
                     
                                                                          
     ‘%x’            ロケールの日付を適切な形式で表します。
                     
                                                                          
     ‘%X’            ロケールの時間を適切な形式で表します。
                     
                                                                          
     ‘%y’            西暦の下 2 桁の 10 進表記になります [00,99]。
                     
                                                                          
     ‘%Y’            西暦 ( 4桁) の 10 進表記を表します。
                     
                                                                          
     ‘%z’            タイムゾーンと UTC/GMT との時差を表す正または負の
                     時間を +HHMM、-HHMM で表します。H は時間の、M は分
                     の 10 進表記になります [-23:59, +23:59]。 (4)
                     
                                                                          
     ‘%Z’            タイムゾーンの名前を表します (タイムゾーンがない場
                     合には空文字列)。非推奨です。 (5)
                     
                                                                          
     ‘%G’            ISO 8601 year (similar to ‘%Y’ but follows the
                     rules for the ISO 8601 calendar year).  The year
                     starts with the week that contains the first
                     Thursday of the calendar year.
                     
                                                                          
     ‘%V’            ISO 8601 week number (as a decimal number
                     [01,53]).  The first week of the year is the one
                     that contains the first Thursday of the year.
                     Weeks start on Monday.
                     
                                                                          
     ‘%%’            文字 ‘'%'’ を表します。
                     

     注釈:

       1. The ‘%f’ format directive only applies to *note strptime():
          1646, not to *note strftime(): 1402.  However, see also *note
          datetime.datetime.strptime(): 1950. and *note
          datetime.datetime.strftime(): e8e. where the ‘%f’ format
          directive *note applies to microseconds: 2897.

       2. *note strptime(): 1646. 関数で使う場合、‘%p’ ディレクティブが
          出力結果の時刻フィールドに影響を及ぼすのは、時刻を解釈するため
          に ‘%I’ を使ったときのみです。

       3. 値の幅は実際に ‘0’ から ‘61’ です; ‘60’ は うるう秒<leap
          seconds>(6) を表し、 ‘61’ は歴史的理由によりサポートされていま
          す。

       4. *note strptime(): 1646. 関数で使う場合、‘%U’ および ‘%W’ を計
          算に使うのは曜日と年を指定したときだけです。

     以下に RFC 5322(7) インターネット電子メール標準で定義されている日付
     表現と互換の書式の例を示します。 (8)

          >>> from time import gmtime, strftime
          >>> strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
          'Thu, 28 Jun 2001 14:17:15 +0000'

     一部のプラットフォームではさらにいくつかのディレクティブがサポート
     されていますが、標準 ANSI C で意味のある値はここで列挙したものだけ
     です。あなたのプラットフォームでサポートされている書式コードの全一
     覧については、‘strftime(3)(9)’ のドキュメントを参照してください。

     一部のプラットフォームでは、フィールドの幅や精度を指定するオプショ
     ンがディレクティブの先頭の文字 ‘'%'’ の直後に付けられるようになって
     いました; この機能も移植性はありません。フィールドの幅は通常 2 です
     が、‘%j’ は例外で 3 です。

 -- の関数: time.strptime (string[, format])

     時刻を表現する文字列を書式に従って解釈します。返される値は *note
     gmtime(): 13d8. や *note localtime(): 1712. が返すような *note
     struct_time: ee6. です。

     'format' パラメーターは *note strftime(): 1402. で使うものと同じデ
     ィレクティブを使います; このパラメーターの値はデフォルトでは ‘"%a
     %b %d %H:%M:%S %Y"’ で、*note ctime(): 28c5. が返すフォーマットに一
     致します。'string' が 'format' に従って解釈できなかった場合、例外
     *note ValueError: 2ec. が送出されます。解析しようとする 'string' が
     解析後に余分なデータを持っていた場合、*note ValueError: 2ec. が送出
     されます。欠落したデータについて、適切な値を推測できない場合はデフ
     ォルトの値で埋められ、その値は ‘(1900, 1, 1, 0, 0, 0, 0, 1, -1)’ で
     す。'string' も 'format' も文字列でなければなりません。

     例えば:

          >>> import time
          >>> time.strptime("30 Nov 00", "%d %b %y")
          time.struct_time(tm_year=2000, tm_mon=11, tm_mday=30, tm_hour=0, tm_min=0,
                           tm_sec=0, tm_wday=3, tm_yday=335, tm_isdst=-1)

     ‘%Z’ ディレクティブへのサポートは ‘tzname’ に収められている値と
     ‘daylight’ が真かどうかで決められます。このため、常に既知の (かつ夏
     時間でないと考えられている) UTC や GMT を認識する時以外はプラットフ
     ォーム固有の動作になります。

     ドキュメント内で説明されているディレクティブだけがサポートされてい
     ます。‘strftime()’ はプラットフォームごとに実装されているので、説明
     されていないディレクティブも利用できるかもしれません。しかし、
     ‘strptime()’ はプラットフォーム非依存なので、ドキュメント内でサポー
     トされているとされているディレクティブ以外は利用できません。

 -- クラス: time.struct_time

     *note gmtime(): 13d8, *note localtime(): 1712. および *note
     strptime(): 1646. が返す時刻値シーケンスの型です。これは *note
     名前付きタプル: 85e. のインターフェースをもったオブジェクトです。値
     はインデックスでも属性名でもアクセス可能です。以下の値があります:

     インデックス                          属性                                  値
                                                                                 
                                                                                 
     0                                      -- の属性: tm_year                   (例えば 1993)
                                                                                 
                                                                                 
     1                                      -- の属性: tm_mon                    [1,12] の間の数
                                                                                 
                                                                                 
     2                                      -- の属性: tm_mday                   [1,31] の間の数
                                                                                 
                                                                                 
     3                                      -- の属性: tm_hour                   [0,23] の間の数
                                                                                 
                                                                                 
     4                                      -- の属性: tm_min                    [0,59] の間の数
                                                                                 
                                                                                 
     5                                      -- の属性: tm_sec                    range [0, 61]; see
                                                                                 *note Note (2): 3138. in
                                                                                 *note strftime(): 1402.
                                                                                 
                                                                                 
     6                                      -- の属性: tm_wday                   range [0, 6]; Monday is 0
                                                                                 
                                                                                 
     7                                      -- の属性: tm_yday                   [1,366] の間の数
                                                                                 
                                                                                 
     8                                      -- の属性: tm_isdst                  0, 1 または -1; 以下を参照してくだ
                                                                                 さい
                                                                                 
                                                                                 
     N/A                                    -- の属性: tm_zone                   タイムゾーンの短縮名
                                                                                 
                                                                                 
     N/A                                    -- の属性: tm_gmtoff                 UTC から東方向へのオフセット (秒)
                                                                                 

     C の構造体とは異なり、月の値は [0, 11] ではなく [1, 12] であること
     に注意してください。

     *note mktime(): 1401. の呼び出し時に、*note tm_isdst: 28d6. は夏時
     間が有効な場合は 1、そうでない場合は 0 に設定されることがあります。
     値が -1 の場合は夏時間について不明なことを表していて、普通 *note
     tm_isdst: 28d6. は正しい状態に設定されます。

     *note struct_time: ee6. を引数とする関数に正しくない長さの *note
     struct_time: ee6. や要素の型が正しくない *note struct_time: ee6. を
     与えた場合には、 *note TypeError: 198. が送出されます。

 -- の関数: time.time () -> float

     エポック (*note epoch: 2f13.) からの秒数を浮動小数点数で返します。
     うるう秒 (leap seconds(10)) の扱いはプラットフォーム依存です。
     Windows とほとんどの Unix システムでは、うるう秒はエポック (*note
     epoch: 2f13.) 秒の時間の勘定には入りません。 これは一般に Unix 時間
     (11) と呼ばれています。

     時刻は常に浮動小数点数で返されますが、すべてのシステムが 1 秒より高
     い精度で時刻を提供するとは限らないので注意してください。 この関数が
     返す値は通常減少していくことはありませんが、この関数を 2 回呼び出し
     、その呼び出しの間にシステムクロックの時刻を巻き戻して設定した場合
     には、以前の呼び出しよりも低い値が返ることがあります。

     *note time(): 55d. が返す数値は、 *note gmtime(): 13d8. 関数に渡さ
     れて UTC の、あるいは *note localtime(): 1712. 関数に渡されて現地時
     間の、より一般的な時間のフォーマット (つまり、年、月、日、時間など)
     に変換されているかもしれません。 どちらの場合でも *note
     struct_time: ee6. オブジェクトが返され、このオブジェクトの属性とし
     てカレンダー日付の構成要素へアクセスできます。

     Clock:

        * On Windows, call ‘GetSystemTimePreciseAsFileTime()’.

        * Call ‘clock_gettime(CLOCK_REALTIME)’ if available.

        * Otherwise, call ‘gettimeofday()’.

     Use *note time_ns(): ce0. to avoid the precision loss caused by the
     *note float: 196. type.

バージョン 3.13 で変更: On Windows, calls
‘GetSystemTimePreciseAsFileTime()’ instead of
‘GetSystemTimeAsFileTime()’.

 -- の関数: time.time_ns () -> int

     *note time(): 55d. に似ていますが、時刻を *note epoch: 2f13. を基点
     としたナノ秒単位の整数で返します。

     Added in version 3.7.

 -- の関数: time.thread_time () -> float

     現在のスレッドのシステムおよびユーザー CPU 時間の値を (小数秒で) 返
     します。これはスリープ中の経過時間を含みません。これは定義上スレッ
     ド固有です。戻り値の基準点は定義されていないので、同一スレッドにお
     ける二回の呼び出しの結果の差だけが有効です。

     Use *note thread_time_ns(): d8a. to avoid the precision loss caused
     by the *note float: 196. type.

     *note Availability: 213f.: Linux, Unix, Windows.

     Unix systems supporting ‘CLOCK_THREAD_CPUTIME_ID’.

     Added in version 3.7.

 -- の関数: time.thread_time_ns () -> int

     *note thread_time(): b30. に似ていますが、ナノ秒単位の時刻を返しま
     す。

     Added in version 3.7.

 -- の関数: time.tzset ()

     Reset the time conversion rules used by the library routines.  The
     environment variable ‘TZ’ specifies how this is done.  It will also
     set the variables ‘tzname’ (from the ‘TZ’ environment variable),
     ‘timezone’ (non-DST seconds West of UTC), ‘altzone’ (DST seconds
     west of UTC) and ‘daylight’ (to 0 if this timezone does not have
     any daylight saving time rules, or to nonzero if there is a time,
     past, present or future when daylight saving time applies).

     *note Availability: 213f.: Unix.

          注釈: 多くの場合、環境変数 ‘TZ’ を変更すると、 *note tzset():
          3140. を呼ばない限り *note localtime(): 1712. のような関数の出
          力に影響を及ぼすため、値が信頼できなくなってしまいます。

          ‘TZ’ 環境変数には空白文字を含めてはなりません。

     環境変数 ‘TZ’ の標準的な書式は以下の通りです (分かりやすいように空
     白を入れています):

          std offset [dst [offset [,start[/time], end[/time]]]]

     各値は以下のようになっています:

     ‘std’ と ‘dst’

          三文字またはそれ以上の英数字で、タイムゾーンの略称を与えます。
          この値は time.tzname になります。

     ‘offset’

          オフセットは形式: ‘± hh[:mm[:ss]]’ をとります。この表現は、UTC
          時刻にするためにローカルな時間に加算する必要のある時間値を示し
          ます。'-' が先頭につく場合、そのタイムゾーンは本初子午線
          (Prime Meridian) より東側にあります。それ以外の場合は本初子午
          線の西側です。オフセットが dst の後ろに続かない場合、夏時間は
          標準時より一時間先行しているものと仮定します。

     ‘start[/time], end[/time]’

          いつ DST に移動し、DST から戻ってくるかを示します。開始および
          終了日時の形式は以下のいずれかです:

          ‘JN’

               ユリウス日 (Julian day) 'n' (1 <= 'n' <= 365) を表します
               。うるう日は計算に含められないため、2 月 28 日は常に 59 で
               、3 月 1 日は 60 になります。

          ‘N’

               ゼロから始まるユリウス日 (0 <= 'n' <= 365) です。うるう日
               は計算に含められるため、2 月 29 日を参照することができま
               す。

          ‘MM.N.D’

               'm' 月の週 'n' における 'd' 番目の日 (0 <= 'd' <= 6, 1 <=
               'n' <= 5, 1 <= 'm' <= 12) を表します。週 5 は月 'm' にお
               ける最終週の 'd' 番目の日を表し、第 4 週か第 5 週のどちら
               かになります。週 1 は日 'd' が最初に現れる日を指します。
               日 0 は日曜日です。

          ‘time’ は ‘offset’ とほぼ同じで、先頭に符号 ('-' や '+') を付
          けてはいけないところだけが違います。時刻が指定されていなければ
          、デフォルトの値 02:00:00 になります。

          >>> os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'
          >>> time.tzset()
          >>> time.strftime('%X %x %Z')
          '02:07:36 05/08/03 EDT'
          >>> os.environ['TZ'] = 'AEST-10AEDT-11,M10.5.0,M3.5.0'
          >>> time.tzset()
          >>> time.strftime('%X %x %Z')
          '16:08:12 05/08/03 AEST'

     多くの Unix システム (*BSD, Linux, Solaris, および Darwin を含む) で
     は、システムの zoneinfo (‘tzfile(5)(12)’) データベースを使ったほう
     が、タイムゾーンごとの規則を指定する上で便利です。これを行うには、
     必要なタイムゾーンデータファイルへのパスをシステムの 'zoneinfo' タ
     イムゾーンデータベースからの相対で表した値を環境変数 ‘TZ’ に設定し
     ます。システムの 'zoneinfo' は通常 ‘/usr/share/zoneinfo’ にあります
     。例えば、 ‘'US/Eastern'’ 、 ‘'Australia/Melbourne'’ 、 ‘'Egypt'’ な
     いし ‘'Europe/Amsterdam'’ と指定します。

          >>> os.environ['TZ'] = 'US/Eastern'
          >>> time.tzset()
          >>> time.tzname
          ('EST', 'EDT')
          >>> os.environ['TZ'] = 'Egypt'
          >>> time.tzset()
          >>> time.tzname
          ('EET', 'EEST')

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/pthread_getcpuclockid(3)

   (2) 
https://learn.microsoft.com/windows/win32/api/synchapi/nf-synchapi-createwaitabletimerexw

   (3) https://peps.python.org/pep-0475/

   (4) The use of ‘%Z’ is now deprecated, but the ‘%z’ escape that
expands to the preferred hour/minute offset is not supported by all ANSI
C libraries.  Also, a strict reading of the original 1982 RFC 822
(https://datatracker.ietf.org/doc/html/rfc822.html) standard calls for a
two-digit year (‘%y’ rather than ‘%Y’), but practice moved to 4-digit
years long before the year 2000.  After that, RFC 822
(https://datatracker.ietf.org/doc/html/rfc822.html) became obsolete and
the 4-digit year has been first recommended by RFC 1123
(https://datatracker.ietf.org/doc/html/rfc1123.html) and then mandated
by RFC 2822 (https://datatracker.ietf.org/doc/html/rfc2822.html), with
RFC 5322 (https://datatracker.ietf.org/doc/html/rfc5322.html) continuing
this requirement.

   (5) The use of ‘%Z’ is now deprecated, but the ‘%z’ escape that
expands to the preferred hour/minute offset is not supported by all ANSI
C libraries.  Also, a strict reading of the original 1982 RFC 822
(https://datatracker.ietf.org/doc/html/rfc822.html) standard calls for a
two-digit year (‘%y’ rather than ‘%Y’), but practice moved to 4-digit
years long before the year 2000.  After that, RFC 822
(https://datatracker.ietf.org/doc/html/rfc822.html) became obsolete and
the 4-digit year has been first recommended by RFC 1123
(https://datatracker.ietf.org/doc/html/rfc1123.html) and then mandated
by RFC 2822 (https://datatracker.ietf.org/doc/html/rfc2822.html), with
RFC 5322 (https://datatracker.ietf.org/doc/html/rfc5322.html) continuing
this requirement.

   (6) https://en.wikipedia.org/wiki/Leap_second

   (7) https://datatracker.ietf.org/doc/html/rfc5322.html

   (8) The use of ‘%Z’ is now deprecated, but the ‘%z’ escape that
expands to the preferred hour/minute offset is not supported by all ANSI
C libraries.  Also, a strict reading of the original 1982 RFC 822
(https://datatracker.ietf.org/doc/html/rfc822.html) standard calls for a
two-digit year (‘%y’ rather than ‘%Y’), but practice moved to 4-digit
years long before the year 2000.  After that, RFC 822
(https://datatracker.ietf.org/doc/html/rfc822.html) became obsolete and
the 4-digit year has been first recommended by RFC 1123
(https://datatracker.ietf.org/doc/html/rfc1123.html) and then mandated
by RFC 2822 (https://datatracker.ietf.org/doc/html/rfc2822.html), with
RFC 5322 (https://datatracker.ietf.org/doc/html/rfc5322.html) continuing
this requirement.

   (9) https://manpages.debian.org/strftime(3)

   (10) https://en.wikipedia.org/wiki/Leap_second

   (11) https://en.wikipedia.org/wiki/Unix_time

   (12) https://manpages.debian.org/tzfile(5)


File: python.info,  Node: Clock ID Constants,  Next: Timezone Constants,  Prev: 関数<5>,  Up: time --- 時刻データへのアクセスと変換

5.16.3.2 Clock ID Constants
...........................

These constants are used as parameters for *note clock_getres(): 1375.
and *note clock_gettime(): 1376.

 -- データ: time.CLOCK_BOOTTIME

     Identical to *note CLOCK_MONOTONIC: 8a8, except it also includes
     any time that the system is suspended.

     This allows applications to get a suspend-aware monotonic clock
     without having to deal with the complications of *note
     CLOCK_REALTIME: 8a9, which may have discontinuities if the time is
     changed using ‘settimeofday()’ or similar.

     *note Availability: 213f.: Linux >= 2.6.39.

     Added in version 3.7.

 -- データ: time.CLOCK_HIGHRES

     Solaris OS は任意のハードウェアソースの使用を試み、ナノ秒レベルの分
     解能を提供する ‘CLOCK_HIGHRES’ タイマーを具備しています。
     ‘CLOCK_HIGHRES’ は変更不可で、高分解能のクロックです。

     *note Availability: 213f.: Solaris.

     Added in version 3.3.

 -- データ: time.CLOCK_MONOTONIC

     設定不可で、モノトニック時刻 (不特定のエポックからの単調増加な時刻)
     を表します。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

 -- データ: time.CLOCK_MONOTONIC_RAW

     *note CLOCK_MONOTONIC: 8a8. と似ていますが、NTP の影響を受けていな
     い、ハードウェアベースの時刻へのアクセスを提供します。

     *note Availability: 213f.: Linux >= 2.6.28, macOS >= 10.12.

     Added in version 3.3.

 -- データ: time.CLOCK_MONOTONIC_RAW_APPROX

     Similar to *note CLOCK_MONOTONIC_RAW: 3143, but reads a value
     cached by the system at context switch and hence has less accuracy.

     *note Availability: 213f.: macOS >= 10.12.

     Added in version 3.13.

 -- データ: time.CLOCK_PROCESS_CPUTIME_ID

     CPU による高分解能のプロセスごとのタイマーです。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

 -- データ: time.CLOCK_PROF

     CPU による高分解能のプロセスごとのタイマーです。

     *note Availability: 213f.: FreeBSD, NetBSD >= 7, OpenBSD.

     Added in version 3.7.

 -- データ: time.CLOCK_TAI

     International Atomic Time(1)

     The system must have a current leap second table in order for this
     to give the correct answer.  PTP or NTP software can maintain a
     leap second table.

     *note Availability: 213f.: Linux.

     Added in version 3.9.

 -- データ: time.CLOCK_THREAD_CPUTIME_ID

     スレッド固有の CPU タイムクロックです。

     *note Availability: 213f.: Unix.

     Added in version 3.3.

 -- データ: time.CLOCK_UPTIME

     Time whose absolute value is the time the system has been running
     and not suspended, providing accurate uptime measurement, both
     absolute and interval.

     *note Availability: 213f.: FreeBSD, OpenBSD >= 5.5.

     Added in version 3.7.

 -- データ: time.CLOCK_UPTIME_RAW

     Clock that increments monotonically, tracking the time since an
     arbitrary point, unaffected by frequency or time adjustments and
     not incremented while the system is asleep.

     *note Availability: 213f.: macOS >= 10.12.

     Added in version 3.8.

 -- データ: time.CLOCK_UPTIME_RAW_APPROX

     Like *note CLOCK_UPTIME_RAW: c37, but the value is cached by the
     system at context switches and therefore has less accuracy.

     *note Availability: 213f.: macOS >= 10.12.

     Added in version 3.13.

The following constant is the only parameter that can be sent to *note
clock_settime(): 1377.

 -- データ: time.CLOCK_REALTIME

     Real-time clock.  Setting this clock requires appropriate
     privileges.  The clock is the same for all processes.

     *note Availability: 213f.: Unix.

     Added in version 3.3.

   ---------- Footnotes ----------

   (1) 
https://www.nist.gov/pml/time-and-frequency-division/how-utcnist-related-coordinated-universal-time-utc-international


File: python.info,  Node: Timezone Constants,  Prev: Clock ID Constants,  Up: time --- 時刻データへのアクセスと変換

5.16.3.3 Timezone Constants
...........................

 -- データ: time.altzone

     ローカルの夏時間タイムゾーンにおける UTC からの時刻オフセットで、西
     に行くほど増加する、秒で表した値です (ほとんどの西ヨーロッパでは負
     になり、アメリカでは正、イギリスではゼロになります)。‘daylight’ が
     ゼロでないときのみ使用してください。以下の注釈を参照してください。

 -- データ: time.daylight

     DST タイムゾーンが定義されている場合ゼロでない値になります。以下の
     注釈を参照してください。

 -- データ: time.timezone

     (DST でない) ローカルタイムゾーンの UTC からの時刻オフセットで、西
     に行くほど増加する秒で表した値です (ほとんどの西ヨーロッパでは負に
     なり、アメリカでは正、イギリスではゼロになります)。以下の注釈を参照
     してください。

 -- データ: time.tzname

     二つの文字列からなるタプルです。最初の要素は DST でないローカルのタ
     イムゾーン名です。ふたつめの要素は DST のタイムゾーンです。DST のタ
     イムゾーンが定義されていない場合。二つ目の文字列を使うべきではあり
     ません。以下の注釈を参照してください。

     注釈: For the above Timezone constants (*note altzone: 314a, *note
     daylight: 314b, *note timezone: 314c, and *note tzname: 314d.), the
     value is determined by the timezone rules in effect at module load
     time or the last time *note tzset(): 3140. is called and may be
     incorrect for times in the past.  It is recommended to use the
     *note tm_gmtoff: 3133. and *note tm_zone: 3134. results from *note
     localtime(): 1712. to obtain timezone information.

参考
....

*note datetime: 34. モジュール

     日付と時刻に対する、よりオブジェクト指向のインターフェースです。

*note locale: 8a. モジュール

     国際化サービスです。ロケールの設定は *note strftime(): 1402. および
     *note strptime(): 1646. の多くの書式指定子の解釈に影響を及ぼします
     。

*note calendar: 15. モジュール

     一般的なカレンダーに関する関数群です。*note timegm(): 2948. はこの
     モジュールの *note gmtime(): 13d8. の逆を行う関数です。

脚注
....


File: python.info,  Node: logging --- Python 用のログ記録手段,  Next: logging config --- ログ記録の環境設定,  Prev: time --- 時刻データへのアクセスと変換,  Up: 汎用オペレーティングシステムサービス

5.16.4 ‘logging’ -- Python 用のログ記録手段
-------------------------------------------

'ソースコード:' Lib/logging/__init__.py(1)

Important
.........

このページには、リファレンス情報だけが含まれています。チュートリアルは、
以下のページを参照してください

   * *note 基本チュートリアル: 140e.

   * *note 上級チュートリアル: 140f.

   * *note ロギングクックブック: 1410.

__________________________________________________________________

このモジュールは、アプリケーションやライブラリのための柔軟なエラーログ記
録 (logging) システムを実装するための関数やクラスを定義しています。

標準ライブラリモジュールとしてログ記録 API が提供される利点は、すべての
Python モジュールがログ記録に参加できることであり、これによってあなたが
書くアプリケーションのログにサードパーティーのモジュールが出力するメッセ
ージを含ませることができます。

以下は慣用的な使い方の単純な例です:

     # myapp.py
     import logging
     import mylib
     logger = logging.getLogger(__name__)

     def main():
         logging.basicConfig(filename='myapp.log', level=logging.INFO)
         logger.info('Started')
         mylib.do_something()
         logger.info('Finished')

     if __name__ == '__main__':
         main()

     # mylib.py
     import logging
     logger = logging.getLogger(__name__)

     def do_something():
         logger.info('Doing something')

'myapp.py' を実行すれば、'myapp.log' でログが確認できます:

     INFO:__main__:Started
     INFO:mylib:Doing something
     INFO:__main__:Finished

この慣用的な使い方における重要な特色は、大部分のコードは
‘getLogger(__name__)’ で単にモジュールレベルのロガーを作るだけで、そのロ
ガーを必要なロギングに使えるということです。これは簡潔であると同時に、下
位のコードにおいて、必要に応じてきめ細やかな制御を可能にしています。モジ
ュールレベルのロガーに対するログメッセージは、最終的にルートロガーとして
知られる最上位のロガーに達するまで順次転送されます。ロギングに対するこの
ようなアプローチは、階層的ロギングとして知られています。

ロギングを有用なものとするためには、用途に応じて構成する必要があります:
ログレベルの設定や各ロガーの出力先から、潜在的には特定のモジュールに対す
る振る舞いの変更などを、しばしばコマンドライン引数かアプリケーションの構
成の一部として。上記の例を含めて、ほとんどの場合ではルートロガーのみを構
成するだけで十分です。なぜならモジュールレベルの全ての下位のロガーは、全
てのメッセージを最終的にルートロガーのハンドラに転送するからです。 *note
basicConfig(): bf3. は、多くのユースケースを上手に扱うことのできる簡便な
ルートロガーの構成方法を提供します。

このモジュールは、多くの機能性と柔軟性を提供します。ロギングに慣れていな
いなら、使い方を理解する最良の方法はチュートリアルを読むことです ('右上
のリンクを参照してください')。

モジュールで定義されている基本的なクラスと、その属性およびメソッドを以下
に列挙します。

   * ロガーは、アプリケーションコードが直接使うインターフェースを公開し
     ます。

   * ハンドラは、(ロガーによって生成された) ログ記録を適切な送信先に送り
     ます。

   * フィルタは、どのログ記録を出力するかを決定する、きめ細かい機能を提
     供します。

   * フォーマッタは、ログ記録が最終的に出力されるレイアウトを指定します
     。

* Menu:

* ロガーオブジェクト::
* ロギングレベル::
* ハンドラオブジェクト::
* フォーマッタオブジェクト::
* フィルタオブジェクト::
* LogRecord オブジェクト::
* LogRecord 属性::
* LoggerAdapter オブジェクト::
* スレッドセーフ性::
* モジュールレベルの関数::
* モジュールレベル属性::
* warnings モジュールとの統合::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/logging/__init__.py


File: python.info,  Node: ロガーオブジェクト,  Next: ロギングレベル,  Up: logging --- Python 用のログ記録手段

5.16.4.1 ロガーオブジェクト
...........................

ロガーには以下のような属性とメソッドがあります。 ロガーを直接インスタン
ス化することは '絶対に' してはならず、常にモジュール関数
‘logging.getLogger(name)’ を介してインスタンス化することに注意してくださ
い。 同じ name で *note getLogger(): b59. を複数回呼び出すと、常に同じロ
ガー・オブジェクトへの参照が返されます。

‘name’ は、潜在的に ‘foo.bar.baz’ のようなピリオドで区切られた階層的な値
です (ただし、たとえば ‘foo’ のような単純な値も可能です)。階層構造の下位
にあるロガーは、上位のロガーの子になります。たとえば ‘foo’ という名前の
ロガーに対して、 ‘foo.bar’、 ‘foo.bar.baz’、 ‘foo.bam’ という名前のロガ
ーは全て ‘foo’ の子孫です。さらに、全てのロガーはルートロガーの子孫です
。ロガー名の階層構造は Python パッケージの階層構造に類似しています。また
、推奨される構築方法である ‘logging.getLogger(__name__)’ を使ってモジュ
ール単位でロガーを構築すれば、パッケージの階層構造とロガーの階層構造は同
一になります。なぜなら、モジュールの中で、 ‘__name__’ は Python パッケー
ジの名前空間におけるモジュール名だからです。

 -- クラス: logging.Logger

      -- の属性: name

          ロガーの名前です。また、ロガーを取得するために *note
          getLogger(): b59. を呼び出すときに渡された値です。

               注釈: この属性は読み出し専用として扱われるべきです。

      -- の属性: level

          *note setLevel(): 16ac. メソッドで設定された、このロガーのしき
          い値です。

               注釈: この属性を直接設定しないでください - *note
               setLevel(): 16ac. は渡されたレベルをチェックする機能を持
               っていますので、常にこのメソッドを使うようにしてください
               。

      -- の属性: parent

          このロガーの親にあたるロガーです。名前空間の階層構造で上位にあ
          たるロガーのインスタンス化により、親ロガーは変わる可能性があり
          ます。

               注釈: この値は読み出し専用として取り扱われるべきです。

      -- の属性: propagate

          この属性が真と評価された場合、このロガーに記録されたイベントは
          、このロガーに取り付けられた全てのハンドラに加え、上位 (祖先)
          ロガーのハンドラにも渡されます。 メッセージは、祖先ロガーのハ
          ンドラに直接渡されます - 今問題にしている祖先ロガーのレベルも
          フィルタも、どちらも考慮されません。

          この値の評価結果が偽になる場合、ロギングメッセージは祖先ロガー
          のハンドラに渡されません。

          具体的な例で説明します: ‘A.B.C’ という名前のロガーの propagate
          属性が真と評価された場合、
          ‘logging.getLogger('A.B.C').error(...)’ のようなメソッドの呼び
          出しを通じて ‘A.B.C’ に記録された全てのイベントは、 [ログレベ
          ルとフィルタの設定を満たした場合に限り] 最初に ‘A.B.C’ に接続
          されたハンドラに渡され、その後 ‘A.B’, ‘A’ という名前のロガー、
          そしてルートロガーという順番で各ロガーに接続されたハンドラに渡
          されます。この連鎖構造において ‘A.B.C’, ‘A.B’, ‘A’ のいずれか
          の ‘propagate’ 属性が偽に設定された場合、そのロガーがイベント
          を処理する最後のロガーとなり、その時点でイベントの伝播は止まり
          ます。

          コンストラクタはこの属性を ‘True’ に設定します。

               注釈: ハンドラを、あるロガー 'と' その祖先のロガーに接続
               した場合、同一レコードが複数回発行される場合があります。
               一般的に、ハンドラを複数のロガーに接続する必要はありませ
               ん。propagate 設定が ‘True’ のままになっていれば、ロガー
               の階層において最上位にある適切なロガーにハンドラを接続す
               るだけで、そのハンドラは全ての子孫ロガーが記録する全ての
               イベントを確認することができます。一般的なシナリオでは、
               ハンドラをルートロガーに対してのみ接続し、残りは
               propagate にすべて委ねます。

      -- の属性: handlers

          このロガーインスタンスに直接接続されているハンドラのリストです
          。

               注釈: この属性は読み出し専用として取り扱われるべきです; 通
               常この属性は *note addHandler(): 3157. と *note
               removeHandler(): 3158. の2つのメソッドを介して変更されま
               す。これらのメソッドはスレッドセーフな処理を保証するため
               にロックを活用します。

      -- の属性: disabled

          この属性は、いかなるイベントの処理も作動しないようにします。イ
          ニシャライザはこの属性に ‘False’ を設定します。また、この属性
          はロギングを設定するコードによってのみ変更されます。

               注釈: この属性は読み出し専用として扱われるべきです。

      -- メソッド: setLevel (level)

          このロガーの閾値を 'level' に設定します。 'level' よりも深刻で
          ないログメッセージは無視されます; 深刻さが 'level' 以上のログ
          メッセージは、ハンドラのレベルが 'level' より上に設定されてい
          ない限り、このロガーに取り付けられているハンドラによって投げら
          れます。

          ロガーが生成された際、レベルは *note NOTSET: 315a. (これにより
          すべてのメッセージについて、ロガーがルートロガーであれば処理さ
          れる、そうでなくてロガーが非ルートロガーの場合には親ロガーに委
          譲させる) に設定されます。 ルートロガーは *note WARNING: 20e0.
          レベルで生成されることに注意してください。

          「親ロガーに委譲」という用語の意味は、もしロガーのレベルが
          NOTSET ならば、祖先ロガーの系列の中を NOTSET 以外のレベルの祖
          先を見つけるかルートに到達するまで辿っていく、ということです。

          もし NOTSET 以外のレベルの祖先が見つかったなら、その祖先のレベ
          ルが探索を開始したロガーの実効レベルとして扱われ、ログイベント
          がどのように処理されるかを決めるのに使われます。

          ルートに到達した場合、ルートのレベルが NOTSET ならばすべてのメ
          ッセージは処理されます。そうでなければルートのレベルが実効レベ
          ルとして使われます。

          レベルの一覧については *note ロギングレベル: 86a. を参照してく
          ださい。

          バージョン 3.2 で変更: 'level' パラメータは、 *note INFO:
          20df. のような整数定数の代わりに 'INFO' のようなレベルの文字列
          表現も受け付けるようになりました。ただし、レベルは内部で整数と
          して保存されますし、 *note getEffectiveLevel(): 315b. や *note
          isEnabledFor(): 150e. といったメソッドは、整数を返し、また渡さ
          れるものと期待します。

      -- メソッド: isEnabledFor (level)

          深刻度が 'lvl' のメッセージが、このロガーで処理されることにな
          っているかどうかを示します。このメソッドはまず、
          ‘logging.disable(level)’ で設定されるモジュールレベルの深刻度
          レベルを調べ、次にロガーの実効レベルを *note
          getEffectiveLevel(): 315b. で調べます。

      -- メソッド: getEffectiveLevel ()

          このロガーの実効レベルを示します。 *note NOTSET: 315a. 以外の
          値が *note setLevel(): 16ac. で設定されていた場合、その値が返
          されます。そうでない場合、 *note NOTSET: 315a. 以外の値が見つ
          かるまでロガーの階層をルートロガーの方向に追跡します。見つかっ
          た場合、その値が返されます。返される値は整数で、典型的には
          *note logging.DEBUG: 20de, *note logging.INFO: 20df. 等のうち
          一つです。

      -- メソッド: getChild (suffix)

          このロガーの子であるロガーを、接頭辞によって決定し、返します。
          従って、‘logging.getLogger('abc').getChild('def.ghi')’ は、
          ‘logging.getLogger('abc.def.ghi')’ によって返されるのと同じロ
          ガーを返すことになります。これは簡便なメソッドで、親ロガーがリ
          テラルでなく ‘__name__’ などを使って名付けられているときに便利
          です。

          Added in version 3.2.

      -- メソッド: getChildren ()

          このロガーの直接の子であるロガーの集合を返します。したがって、
          たとえば ‘logging.getLogger().getChildren()’ は ‘foo’ や ‘bar’
          といった名前のロガーを含む集合を返すかもしれませんが、
          ‘foo.bar’ という名前のロガーは戻り値の集合には含まれません。同
          様に、 ‘logging.getLogger('foo').getChildren()’ は ‘foo.bar’ と
          いう名前のロガーを含む集合を返すかもしれませんが、
          ‘foo.bar.baz’ のような名前のロガーは戻り値の集合には含まれませ
          ん。

          Added in version 3.12.

      -- メソッド: debug (msg, *args, **kwargs)

          レベル *note DEBUG: 20de. のメッセージをこのロガーで記録します
          。 'msg' はメッセージの書式文字列で、 'args' は 'msg' に文字列
          書式化演算子を使って取り込むための引数です。 (これは、書式化文
          字列の中でキーワードを使い、引数として単一の辞書を渡すことがで
          きる、ということを意味します。) 'args' が提供されない場合は
          'msg' の%フォーマットは実行されません。

          'kwargs' のうち、 'exc_info', 'stack_info', 'stacklevel',
          'extra' という4つのキーワード引数の中身を調べます。

          'exc_info' は、この値の評価値が false でない場合、例外情報がロ
          ギングメッセージに追加されます。もし例外情報をあらわすタプル
          (*note sys.exc_info(): 89a. 関数によって戻されるフォーマットに
          おいて)、または、例外情報をあらわすインスタンスが与えられてい
          れば、それが使用されることになります。それ以外の場合には、
          *note sys.exc_info(): 89a. を呼び出して例外情報を取得します。

          2つ目の省略可能なキーワード引数は 'stack_info' で、デフォルト
          は ‘False’ です。真の場合、実際のロギング呼び出しを含むスタッ
          ク情報がロギングメッセージに追加されます。これは 'exc_info' 指
          定によって表示されるスタック情報と同じものではないことに注意し
          てください: 前者はカレントスレッド内での、一番下からロギング呼
          び出しまでのスタックフレームですが、後者は例外に呼応して、例外
          ハンドラが見つかるところまで巻き戻されたスタックフレームの情報
          です。

          'exc_info' とは独立に 'stack_info' を指定することもできます (例
          えば、例外が上げられなかった場合でも、コード中のある地点にどの
          ように到着したかを単に示すために)。スタックフレームは、次のよ
          うなヘッダー行に続いて表示されます:

               Stack (most recent call last):

          これは、例外フレームを表示する場合に使用される ‘Traceback
          (most recent call last):’ を模倣します。

          3番目のオプションキーワード引数は 'stacklevel' で、デフォルト
          は ‘1’ です。もしこれが1よりも大きい場合は、 *note LogRecord:
          11e8. 内で行番号と関数名を算出する時に、指定されたスタックフレ
          ームの数をスキップします。これはログヘルパー内部で使われる場合
          、関数名、ファイル名、行番号はそのヘルパーの情報ではなく、その
          ヘルパーを呼び出した呼び出し元のものになります。このパラメータ
          の名前は *note warnings: 118. モジュールと同じものになります。

          4番目のキーワード引数は 'extra' で、ロギングイベントの際に作ら
          れる *note LogRecord: 11e8. の *note __dict__: 77d. 属性に、ユ
          ーザー定義の属性を追加するための辞書を渡すのに使うことができま
          す。これら追加の属性は、好きなように使うことができます。たとえ
          ば、それらをログメッセージに埋め込むことができます。使用例:

               FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s'
               logging.basicConfig(format=FORMAT)
               d = {'clientip': '192.168.0.1', 'user': 'fbloggs'}
               logger = logging.getLogger('tcpserver')
               logger.warning('Protocol problem: %s', 'connection reset', extra=d)

          これは以下のような出力を行います

               2006-02-08 22:20:02,165 192.168.0.1 fbloggs  Protocol problem: connection reset

          'extra' に渡される辞書のキーはロギングシステムで使われているも
          のと衝突してはいけません。 (ロギングシステムが使うキーの詳細に
          ついては *note LogRecord 属性: 315c. の節を参照してください。)

          これらの属性をログメッセージに使うことにしたなら、少し注意が必
          要です。上の例では、 'clientip' と 'user' が *note LogRecord:
          11e8. の属性辞書に含まれていることを期待した書式文字列で *note
          Formatter: 16b0. がセットアップされています。もしこれらが欠け
          ていると、書式化例外が発生してしまうためメッセージはログに残り
          ません。したがってこの場合、常にこれらのキーを含む 'extra' 辞
          書を渡す必要があります。

          このようなことは煩わしいかもしれませんが、この機能は限定された
          場面で使われるように意図しているものなのです。たとえば同じコー
          ドがいくつものコンテキストで実行されるマルチスレッドのサーバで
          、興味のある条件が現れるのがそのコンテキストに依存している (上
          の例で言えば、リモートのクライアント IP アドレスや認証されたユ
          ーザ名など)、というような場合です。そういった場面では、それ用
          の *note Formatter: 16b0. が特定の *note Handler: 16af. と共に
          使われるというのはよくあることです。

          このロガー (および *note Logger.propagate: 16ae. 属性を考慮し
          た上で実効的にイベントが伝播する祖先のロガー) にハンドラが接続
          されていない場合、メッセージは *note lastResort: 1413. に設定
          されたハンドラーに送られます。

          バージョン 3.2 で変更: 'stack_info' パラメータが追加されました
          。

          バージョン 3.5 で変更: 'exc_info' パラメータは例外インスタンス
          を受け入れることが可能です。

          バージョン 3.8 で変更: 'stacklevel' 引数が追加されました。

      -- メソッド: info (msg, *args, **kwargs)

          レベル *note INFO: 20df. のメッセージをこのロガーで記録します
          。引数は *note debug(): 315d. と同じように解釈されます。

      -- メソッド: warning (msg, *args, **kwargs)

          レベル *note WARNING: 20e0. のメッセージをこのロガーで記録しま
          す。引数は *note debug(): 315d. と同じように解釈されます。

               注釈: ‘warning’ と機能的に等価な古いメソッド ‘warn’ があ
               ります。‘warn’ は廃止予定なので使わないでください - 代わ
               りに ‘warning’ を使ってください。

      -- メソッド: error (msg, *args, **kwargs)

          レベル *note ERROR: 20e1. のメッセージをこのロガーで記録します
          。引数は *note debug(): 315d. と同じように解釈されます。

      -- メソッド: critical (msg, *args, **kwargs)

          レベル *note CRITICAL: 20e2. のメッセージをこのロガーで記録し
          ます。引数は *note debug(): 315d. と同じように解釈されます。

      -- メソッド: log (level, msg, *args, **kwargs)

          整数で表したレベル 'level' のメッセージをこのロガーで記録しま
          す。その他の引数は *note debug(): 315d. と同じように解釈されま
          す。

      -- メソッド: exception (msg, *args, **kwargs)

          レベル *note ERROR: 20e1. のメッセージをこのロガーで記録します
          。引数は *note debug(): 315d. と同じように解釈されます。例外情
          報がログメッセージに追加されます。このメソッドは例外ハンドラか
          らのみ呼び出されるべきです。

      -- メソッド: addFilter (filter)

          指定されたフィルタ 'filter' をこのロガーに追加します。

      -- メソッド: removeFilter (filter)

          指定されたフィルタ 'filter' をこのロガーから取り除きます。

      -- メソッド: filter (record)

          レコードに対してこのロガーのフィルタを適用し、レコードが処理さ
          れるべき場合に ‘True’ を返します。フィルタのいずれかの値が偽を
          返すまで、それらは順番に試されていきます。いずれも偽を返さなけ
          れば、レコードは処理される(ハンドラに渡される)ことになります。
          ひとつでも偽を返せば、発生したレコードはもはや処理されることは
          ありません。

      -- メソッド: addHandler (hdlr)

          指定されたハンドラ 'hdlr' をこのロガーに追加します。

      -- メソッド: removeHandler (hdlr)

          指定されたハンドラ 'hdlr' をこのロガーから取り除きます。

      -- メソッド: findCaller (stack_info=False, stacklevel=1)

          呼び出し元のソースファイル名と行番号を調べます。ファイル名と行
          番号、関数名、スタック情報を 4 要素のタプルで返します。
          'stack_info' が ‘True’ でなければ、スタック情報は ‘None’ が返
          されます。

          'stacklevel' パラメータは *note debug(): 315d. や他のAPIを呼び
          出すコードから渡されます。もしこれが1よりも大きい場合は、その
          超過分は返す値を決定する前にスタックフレームをスキップする数と
          して利用されます。これは通常、ログAPIをヘルパーやラッパー経由
          で呼び出す場合に便利です。こうすることで、イベントログに記録さ
          れる情報はヘルパーやラッパーのコードではなく、それらを呼び出し
          ているコードのものとなります。

      -- メソッド: handle (record)

          レコードを、このロガーおよびその上位ロガー (ただし 'propagate'
          の値が false になったところまで) に関連付けられているすべての
          ハンドラに渡して処理します。このメソッドは、ローカルで生成され
          たレコードだけでなく、ソケットから受信した unpickle されたレコ
          ードに対しても同様に用いられます。 *note filter(): 3161. によ
          って、ロガーレベルでのフィルタが適用されます。

      -- メソッド: makeRecord (name, level, fn, lno, msg, args,
               exc_info, func=None, extra=None, sinfo=None)

          このメソッドは、特殊な *note LogRecord: 11e8. インスタンスを生
          成するためにサブクラスでオーバライドできるファクトリメソッドで
          す。

      -- メソッド: hasHandlers ()

          このロガーにハンドラが設定されているかどうかを調べます。 その
          ために、このロガーとロガー階層における祖先からハンドラを探しま
          す。 ハンドラが見つかれば ‘True’ 、そうでなければ ‘False’ を返
          します。 このメソッドは、'propagate' 属性が偽に設定されたロガ
          ーを見つけると、さらに上位の探索をやめます。そのロガーが、ハン
          ドラが存在するかどうかチェックされる最後のロガーになります。

          Added in version 3.2.

     バージョン 3.7 で変更: ロガーの pickle 化と unpickle 化ができるよう
     になりました。


File: python.info,  Node: ロギングレベル,  Next: ハンドラオブジェクト,  Prev: ロガーオブジェクト,  Up: logging --- Python 用のログ記録手段

5.16.4.2 ロギングレベル
.......................

ログレベルの数値は以下の表のように与えられています。これらは基本的に自分
でレベルを定義したい人のためのもので、定義するレベルを既存のレベルの間に
位置づけるためには具体的な値が必要になります。もし数値が他のレベルと同じ
だったら、既存の値は上書きされその名前は失われます。

レベル                      数値                どういう意味か / いつ使用するべきか
                                                
------------------------------------------------------------------------------------------
                                                
 -- データ:                 0                   ロガーに対してこのレベルが設定された場
          logging.NOTSET                        合、実際のログレベルは祖先のロガーを参
                                                照して決めることを意味します。実効ログ
                                                レベルも ‘NOTSET’ となった場合は、全て
                                                のイベントが記録されます。ハンドラーに
                                                対してこのレベルが設定された場合、全て
                                                のイベントが処理されます。
                                                
                                                
 -- データ: logging.DEBUG   10                  詳細情報。典型的には、問題が発生した際
                                                に原因を突き止めようとする開発者向けの
                                                情報。
                                                
                                                
 -- データ: logging.INFO    20                  想定された通りのことが起こったことの確
                                                認。
                                                
                                                
 -- データ:                 30                  想定外の事象、または近い将来に問題が起
          logging.WARNING                       きる可能性 (たとえば 'disk space low' す
                                                なわちディスク空き容量の低下) の表示。
                                                ソフトウエアは引き続き期待通りに動作し
                                                ている状態。
                                                
                                                
 -- データ: logging.ERROR   40                  より重大な問題により、ソフトウェアがあ
                                                る機能を実行できないこと。
                                                
                                                
 -- データ:                 50                  プログラム自体が実行を続けられないこと
          logging.CRITICAL                      を表す、重大なエラー。
                                                


File: python.info,  Node: ハンドラオブジェクト,  Next: フォーマッタオブジェクト,  Prev: ロギングレベル,  Up: logging --- Python 用のログ記録手段

5.16.4.3 ハンドラオブジェクト
.............................

ハンドラ (Handler) は以下の属性とメソッドを持ちます。 *note Handler:
16af. は直接インスタンス化されることはありません; このクラスはより便利な
サブクラスの基底クラスとして働きます。しかしながら、サブクラスにおける
‘__init__()’ メソッドでは、 *note Handler.__init__(): 3169. を呼び出す必
要があります。

 -- クラス: logging.Handler

      -- メソッド: __init__ (level=NOTSET)

          レベルを設定して、 *note Handler: 16af. インスタンスを初期化し
          ます。空のリストを使ってフィルタを設定し、 I/O 機構へのアクセ
          スを直列化するために (*note createLock(): 316a. を使って) ロッ
          クを生成します。

      -- メソッド: createLock ()

          スレッドセーフでない背後の I/O 機能に対するアクセスを直列化す
          るために用いられるスレッドロック (thread lock) を初期化します
          。

      -- メソッド: acquire ()

          *note createLock(): 316a. で生成されたスレッドロックを獲得しま
          す。

      -- メソッド: release ()

          *note acquire(): 316b. で獲得したスレッドロックを解放します。

      -- メソッド: setLevel (level)

          このハンドラに対する閾値を 'level' に設定します。 'level' より
          も深刻でないログメッセージは無視されます。 ハンドラが生成され
          た際、レベルは *note NOTSET: 315a. (すべてのメッセージが処理さ
          れる) に設定されます。

          レベルの一覧については *note ロギングレベル: 86a. を参照してく
          ださい。

          バージョン 3.2 で変更: 'level' パラメータは、 *note INFO:
          20df. のような整数定数の代わりに 'INFO' のようなレベルの文字列
          表現も受け付けるようになりました。

      -- メソッド: setFormatter (fmt)

          Sets the formatter for this handler to 'fmt'.  The 'fmt'
          argument must be a *note Formatter: 16b0. instance or ‘None’.

      -- メソッド: addFilter (filter)

          指定されたフィルタ 'filter' をこのハンドラに追加します。

      -- メソッド: removeFilter (filter)

          指定されたフィルタ 'filter' をこのハンドラから除去します。

      -- メソッド: filter (record)

          レコードに対してこのハンドラのフィルタを適用し、レコードが処理
          されるべき場合に ‘True’ を返します。フィルタのいずれかの値が偽
          を返すまで、それらは順番に試されていきます。いずれも偽を返さな
          ければ、レコードは発行されることになります。ひとつでも偽を返せ
          ば、ハンドラはレコードを発行しません。

      -- メソッド: flush ()

          すべてのログ出力がフラッシュされるようにします。このクラスのバ
          ージョンではなにも行わず、サブクラスで実装するためのものです。

      -- メソッド: close ()

          Tidy up any resources used by the handler.  This version does
          no output but removes the handler from an internal map of
          handlers, which is used for handler lookup by name.

          Subclasses should ensure that this gets called from overridden
          *note close(): 3173. methods.

      -- メソッド: handle (record)

          ハンドラに追加されたフィルタの条件に応じて、指定されたログレコ
          ードを出力します。このメソッドは I/O スレッドロックの獲得/解放
          を伴う実際のログ出力をラップします。

      -- メソッド: handleError (record)

          このメソッドは、 *note emit(): 3176. の呼び出し中に例外に遭遇
          した際にハンドラから呼び出されることを想定しています。モジュー
          ルレベルの属性 *note raiseExceptions: 1412. が ‘False’ の場合
          、例外は静かに無視されます。これは、ほとんどの場合でロギングシ
          ステムに期待される挙動です - なぜなら、ほとんどのユーザーはロ
          ギングシステムの中で起こったエラーなどに興味はなく、アプリケー
          ションエラーの方により関心があるからです。しかし、必要ならばこ
          の挙動を自作のハンドラで置き換えることができます。引数に指定さ
          れたレコードは例外発生時に処理されるものです。 (*note
          raiseExceptions: 1412. のデフォルト値は、開発中にはその方が便
          利なので、 ‘True’ です)。

      -- メソッド: format (record)

          レコードに対する書式化を行います - フォーマッタが設定されてい
          れば、それを使います。そうでない場合、モジュールにデフォルト指
          定されたフォーマッタを使います。

      -- メソッド: emit (record)

          指定されたログ記録レコードを実際にログ記録する際のすべての処理
          を行います。このメソッドはサブクラスで実装されることを意図して
          おり、そのためこのクラスのバージョンは *note
          NotImplementedError: 36b. を送出します。

               警告: このメソッドはハンドラレベルのロックを取得した後で
               呼び出されます。また、ロックはこのメソッドがリターンした
               後で解放されます。このメソッドをオーバーライドする場合、
               ロックを取得する可能性のある logging API の他の関数やメソ
               ッドの呼び出しに注意してください。そのような実装はデッド
               ロックを引き起こす可能性があります。特に以下の点に注意し
               てください:

                  * ロギングを構成するための API はモジュールレベルのロ
                    ックを取得し、その後ハンドラを構成する際に個々のハン
                    ドラに対してハンドラレベルのロックを取得します。

                  * 多くのロギング API はモジュールレベルのロックを取得
                    します。そのような API がこのメソッドから呼ばれた場
                    合、他のスレッドからロギングを構成するための API 呼
                    び出しが行われたときにデッドロックに陥る可能性があり
                    ます。これは他のスレッドがハンドラレベルのロックを取
                    得する '前に' モジュールレベルのロックを取得しようと
                    する一方で、 (このメソッドはハンドラレベルのロックが
                    既に取得された状態で呼び出されているため) このメソッ
                    ドを呼び出したスレッドはハンドラレベルのロックを取得
                    した '後で' モジュールレベルのロックを取得しようとす
                    るためです。

標準として含まれているハンドラについては、 *note logging.handlers: 8d. を
参照してください。


File: python.info,  Node: フォーマッタオブジェクト,  Next: フィルタオブジェクト,  Prev: ハンドラオブジェクト,  Up: logging --- Python 用のログ記録手段

5.16.4.4 フォーマッタオブジェクト
.................................

 -- クラス: logging.Formatter (fmt=None, datefmt=None, style='%',
          validate=True, *, defaults=None)

     *note LogRecord: 11e8. を、人間または外部のシステムが解釈可能な出力
     文字列に変換する責任を持ちます。


     パラメータ:

        * ‘fmt’ (*note str: 169.) - 'style' で指定された書式にもとづく、
          出力ログ全体に対する書式文字列です。マッピングのキーは *note
          LogRecord: 11e8. オブジェクトの *note LogRecord 属性: 315c. か
          ら取り出されます。特に指定がない場合は、ログメッセージをあらわ
          す ‘'%(message)s'’ が使われます。

        * ‘datefmt’ (*note str: 169.) - A format string for the
          date/time portion of the logged output.  If not specified, the
          default described in *note formatTime(): 317a. is used.

        * ‘style’ (*note str: 169.) - ‘'%'’, または ‘'$'’ のいずれかで、
          書式文字列がログデータとどのようにマージされるかを決めます:
          *note printf 形式の文字列書式化: 8db. (‘%’), *note
          str.format(): 833. (‘{’) または *note string.Template: 897. ()
          のいずれかを使います。この引数は 'fmt' だけに適用されます (た
          とえば ‘'%(message)s'’ に対して ‘'{message}'’) が、ロギングメ
          ソッドに渡された実際のログメッセージには適用されません。いっぽ
          う、 ‘'{'’ や ‘$’ を使ってログメッセージをフォーマットする
          *note 他の方法: 317b. も存在します。

        * ‘validate’ (*note bool: 3c3.) - ‘True’ が指定されると (デフォ
          ルト) 、 'fmt' と 'style' が不正な場合や、それらが不適切な組み
          合わせだった場合に *note ValueError: 2ec. 例外を送出します; た
          とえば ‘logging.Formatter('%(asctime)s - %(message)s',
          style='{')’ は例外となります。

        * ‘defaults’ (*note dict: 183.‘[’*note str: 169.‘, ’‘Any’‘]’) -
          カスタムフィールドに使用されるデフォルト値を指定する辞書です。
          例えば ‘logging.Formatter('%(ip)s %(message)s',
          defaults={"ip": None})’ のように使います。

     バージョン 3.2 で変更: 'style' パラメータが追加されました。

     バージョン 3.8 で変更: 'validate' パラメータが追加されました。

     バージョン 3.10 で変更: 'defaults' パラメータが追加されました。

      -- メソッド: format (record)

          レコードの属性辞書が、文字列を書式化する演算で被演算子として使
          われます。書式化された結果の文字列を返します。辞書を書式化する
          前に、二つの準備段階を経ます。レコードの 'message' 属性が
          'msg' % 'args' を使って処理されます。書式化された文字列が
          ‘'(asctime)'’ を含むなら、 *note formatTime(): 317a. が呼び出
          され、イベントの発生時刻を書式化します。例外情報が存在する場合
          、 *note formatException(): 317d. を使って書式化され、メッセー
          ジに追加されます。ここで注意していただきたいのは、書式化された
          例外情報は 'exc_text' にキャッシュされるという点です。これが有
          用なのは例外情報がピックル化されて回線上を送ることができるから
          ですが、しかし二つ以上の *note Formatter: 16b0. サブクラスで例
          外情報の書式化をカスタマイズしている場合には注意が必要になりま
          す。この場合、フォーマッタが書式化を終えるごとにキャッシュをク
          リアして（ 'ext_text' 属性に ‘None’ を設定して）、次のフォーマ
          ッタがキャッシュされた値を使わずに新鮮な状態で再計算するように
          しなければならないことになります。

          スタック情報が利用可能な場合、(必要ならば *note formatStack():
          317e. を使って整形した上で) スタック情報が例外情報の後に追加さ
          れます。

      -- メソッド: formatTime (record, datefmt=None)

          このメソッドは、フォーマッタが書式化された時間を利用したい際に
          、 *note format(): 199. から呼び出されます。 このメソッドは特
          定の要求を提供するためにフォーマッタで上書きすることができます
          が、基本的な振る舞いは以下のようになります: 'datefmt' (文字列)
          が指定された場合、レコードが生成された時刻を書式化するために
          *note time.strftime(): 1402. で使われます。 そうでない場合、
          '%Y-%m-%d %H:%M:%S,uuu' というフォーマットが使われます。 uuu 部
          分はミリ秒値で、それ以外の文字は *note time.strftime(): 1402.
          ドキュメントに従います。 このフォーマットの時刻の例は
          ‘2003-01-23 00:29:50,411’ です。 結果の文字列が返されます。

          この関数は、ユーザが設定できる関数を使って、生成時刻をタプルに
          変換します。デフォルトでは、 *note time.localtime(): 1712. が
          使われます。特定のフォーマッタインスタンスに対してこれを変更す
          るには、 ‘converter’ 属性を *note time.localtime(): 1712. や
          *note time.gmtime(): 13d8. と同じ署名をもつ関数に設定してくだ
          さい。すべてのフォーマッタインスタンスに対してこれを変更するに
          は、例えば全てのロギング時刻を GMT で表示するには、
          ‘Formatter’ クラスの ‘converter’ 属性を設定してください。

          バージョン 3.3 で変更: 以前は、デフォルトのフォーマットがこの
          例のようにハードコーディングされていました: ‘2010-09-06
          22:38:15,292’ ここで、コンマの前の部分は strptime フォーマット
          文字列 (‘'%Y-%m-%d %H:%M:%S'’) によって扱われる部分で、コンマ
          の後の部分はミリ秒値です。strptime にミリ秒のフォーマットプレ
          ースホルダーがないので、ミリ秒値は別のフォーマット文字列
          ‘'%s,%03d'’ を使用して追加されます。そして、これらのフォーマッ
          ト文字列は両方ともこのメソッドでハードコーディングされていまし
          た。変更後は、これらの文字列はクラスレベル属性として定義され、
          必要ならインスタンスレベルでオーバーライドすることができます。
          属性の名前は ‘default_time_format’ (strptime 書式文字列用) と
          ‘default_msec_format’ (ミリ秒値の追加用) です。

          バージョン 3.9 で変更: ‘default_msec_format’ 引数が ‘None’ で
          あることを許容します。

      -- メソッド: formatException (exc_info)

          指定された例外情報 (*note sys.exc_info(): 89a. が返すような標
          準例外のタプル) を文字列として書式化します。デフォルトの実装は
          単に *note traceback.print_exception(): a4f. を使います。結果
          の文字列が返されます。

      -- メソッド: formatStack (stack_info)

          指定されたスタック情報を文字列としてフォーマットします (*note
          traceback.print_stack(): 1086. によって返される文字列ですが、
          最後の改行が取り除かれています)。このデフォルト実装は、単に入
          力値をそのまま返します。

 -- クラス: logging.BufferingFormatter (linefmt=None)

     複数のレコードをまとめてフォーマットしたい場合のクラス定義に適した
     基底クラスです。各行 (単一のレコードに相当します) をフォーマットす
     るために使う *note Formatter: 16b0. インスタンスを渡すことができま
     す。特に指定がない場合はデフォルトのフォーマッタ (イベントのメッセ
     ージだけを出力するフォーマッタ) が使われます。

      -- メソッド: formatHeader (records)

          '複数のレコード' のリストに対するヘッダを返します。基底クラス
          の実装は単に空の文字列を返すだけです。レコード数やタイトルを表
          示したり、あるいはセパレータ行したいなど、ヘッダに対して特別な
          振る舞いが必要な場合はこのメソッドをオーバーライドする必要があ
          ります。

      -- メソッド: formatFooter (records)

          '複数のレコード' のリストに対するフッタを返します。基底クラス
          の実装は単に空の文字列を返すだけです。レコード数やセパレータ行
          の表示など、フッタに対して特別な振る舞いが必要な場合はこのメソ
          ッドをオーバーライドする必要があります。

      -- メソッド: format (records)

          '複数のレコード' のリストに対するフォーマット済みテキストを返
          します。基底クラスの実装は、レコードがなければ空の文字列を返し
          、レコードがある場合はヘッダ、単一のレコードをフォーマットする
          ためのラインフォーマッタで各レコードをフォーマットした文字列、
          そしてフッタを全て連結したものを返します。


File: python.info,  Node: フィルタオブジェクト,  Next: LogRecord オブジェクト,  Prev: フォーマッタオブジェクト,  Up: logging --- Python 用のログ記録手段

5.16.4.5 フィルタオブジェクト
.............................

‘フィルタ (Filter)’ は、‘ハンドラ’ や ‘ロガー’ によって使われ、レベルに
よって提供されるのよりも洗練されたフィルタリングを実現します。基底のフィ
ルタクラスは、ロガー階層構造内の特定地点の配下にあるイベントだけを許可し
ます。例えば、'A.B' で初期化されたフィルタは、ロガー 'A.B', 'A.B.C',
'A.B.C.D', 'A.B.D' 等によって記録されたイベントは許可しますが、'A.BB',
'B.A.B' などは許可しません。空の文字列で初期化された場合、すべてのイベン
トを通過させます。

 -- クラス: logging.Filter (name='')

     *note Filter: 1414. クラスのインスタンスを返します。 'name' が指定
     されていれば、 'name' はロガーの名前を表します。指定されたロガーと
     その子ロガーのイベントがフィルタを通過できるようになります。 'name'
     が指定されなければ、すべてのイベントを通過させます。

      -- メソッド: filter (record)

          指定されたログレコードは記録されるでしょうか？答えが「いいえ」
          なら false を、「はい」なら true を返します。フィルタは受け取
          ったログレコードそのものを編集したり、その後のイベント処理にお
          いて元のログレコードに取って代わる、まったく異なるログレコード
          インスタンスを返す可能性があります。

ハンドラに対するフィルタはハンドラがイベントを発行する前に試され、一方で
はロガーに対するフィルタは、イベントが(*note debug(): 315d, *note
info(): 3186. などによって)ロギングされる際には、ハンドラにイベントが送
信される前にはいつでも試されることに注意してください。そのフィルタがそれ
ら子孫ロガーにも適用されていない限り、子孫ロガーによって生成されたイベン
トはロガーのフィルタ設定によってフィルタされることはありません。

実際には、‘Filter’ をサブクラス化する必要はありません。同じ意味の
‘filter’ メソッドを持つ、すべてのインスタンスを通せます。

バージョン 3.2 で変更: 特殊な ‘Filter’ クラスを作ったり、 ‘filter’ メソ
ッドを持つ他のクラスを使う必要はありません: 関数 (あるいは他の callable)
をフィルタとして使用することができます。フィルタロジックは、フィルタオブ
ジェクトが ‘filter’ 属性を持っているかどうかチェックします: もし
‘filter’ 属性を持っていたら、それは ‘Filter’ であると仮定され、その
*note filter(): 3185. メソッドが呼び出されます。そうでなければ、それは
callable であると仮定され、レコードを単一のパラメータとして呼び出されま
す。返される値は *note filter(): 3185. によって返されるものと一致すべき
です。

バージョン 3.12 で変更: 受け取ったログレコード自体を編集する代わりに、元
のログレコードに取って代わる別の *note LogRecord: 11e8. インスタンスを返
すことができるようになりました。これにより、 *note Handler: 16af. にアタ
ッチされたフィルタが、他のハンドラへの副作用を伴うことなく、発行前にログ
レコードを編集することが可能になります。

フィルタは本来、レコードをレベルよりも洗練された基準に基づいてフィルタす
るために使われますが、それが取り付けられたハンドラやロガーによって処理さ
れるレコードをすべて監視します。これは、特定のロガーやハンドラに処理され
たレコードの数を数えたり、処理されている *note LogRecord: 11e8. の属性を
追加、変更、削除したりするときに便利です。もちろん、LogRecord を変更する
には注意が必要ですが、これにより、ログにコンテキスト情報を注入できます
(*note Filter を使ったコンテキスト情報の伝達: 3187. を参照してください
)。


File: python.info,  Node: LogRecord オブジェクト,  Next: LogRecord 属性,  Prev: フィルタオブジェクト,  Up: logging --- Python 用のログ記録手段

5.16.4.6 LogRecord オブジェクト
...............................

*note LogRecord: 11e8. インスタンスは、何かをログ記録するたびに *note
Logger: d46. によって生成されます。また、 *note makeLogRecord(): 318a. を
通して (例えば、ワイヤを通して受け取られた pickle 化されたイベントから)
手動で生成することも出来ます。

 -- クラス: logging.LogRecord (name, level, pathname, lineno, msg, args,
          exc_info, func=None, sinfo=None)

     ロギングされているイベントに適切なすべての情報を含みます。

     もっとも重要な情報は 'msg' と 'args' に渡され、 ‘msg % args’ で結合
     されてレコードの ‘message’ 属性を生成します。


     パラメータ:

        * ‘name’ (*note str: 169.) - この ‘LogRecord’ であらわされるイベ
          ントを記録したロガーの名前です。 ‘LogRecord’ が持つロガーの名
          前は、たとえ異なる (祖先の) ロガーに接続されたハンドラから出力
          されたとしても、常に同じ値を持つことに注意してください。

        * ‘level’ (*note int: 19b.) - 記録されたイベントの *note
          数値であらわしたロギングレベル: 86a. (‘10’ が ‘DEBUG’, ‘20’ が
          ‘INFO’ など) です。このパラメータは LogRecord の '2つの' 属性
          に変換されることに注意してください: 数値は ‘levelno’ に、また
          対応するログレベルの名前は ‘levelname’ に保持されます。

        * ‘pathname’ (*note str: 169.) - ロギングの呼び出しが行われたソ
          ースファイルへの完全なパス名をあらわす文字列です。

        * ‘lineno’ (*note int: 19b.) - ロギングの呼び出しが発せられたソ
          ース行番号。

        * ‘msg’ (*note Any: 8bb.) - イベントの説明メッセージ。様々なデー
          タのプレースホルダを含んだ %フォーマット文字列か、任意のオブジ
          ェクト (*note 任意のオブジェクトをメッセージに使用する: 318b.
          を参照)。

        * ‘args’ (*note tuple: 614.‘ | ’*note dict: 183.‘[’*note str:
          169.‘, ’*note Any: 8bb.‘]’) - 'msg' 引数と組み合わせてイベント
          記述を得るための変数データです。

        * ‘exc_info’ (*note tuple: 614.‘[’*note type: f44.‘[’*note
          BaseException: 7d6.‘]’‘, ’*note BaseException: 7d6.‘, ’*note
          types.TracebackType: cea.‘] ’‘| ’‘None’) - *note
          sys.exc_info(): 89a. によって返される現在の例外情報を含む例外
          タプルです。例外情報がない場合は ‘None’ です。

        * ‘func’ (*note str: 169.‘ | ’‘None’) - ロギングの呼び出しを行っ
          た関数またはメソッドの名前です。

        * ‘sinfo’ (*note str: 169.‘ | ’‘None’) - 現在のスレッドのスタッ
          クベースからログ呼び出しまでの間のスタック情報を表わすテキスト
          文字列。

      -- メソッド: getMessage ()

          ユーザが提供した引数をメッセージに交ぜた後、この *note
          LogRecord: 11e8. インスタンスへのメッセージを返します。ユーザ
          がロギングの呼び出しに与えた引数が文字列でなければ、その引数に
          *note str(): 169. が呼ばれ、文字列に変換されます。これにより、
          ‘__str__’ メソッドが実際のフォーマット文字列を返せるようなユー
          ザ定義のクラスをメッセージとして使えます。

     バージョン 3.2 で変更: *note LogRecord: 11e8. の生成は、レコードを
     生成するために使用されるファクトリを提供することにより、さらに設定
     可能になりました。ファクトリは *note getLogRecordFactory(): 318d. と
     *note setLogRecordFactory(): 318e. を使用して設定することができます
     (ファクトリのシグネチャに関しては *note setLogRecordFactory():
     318e. を参照)。

     この機能を使うと *note LogRecord: 11e8. の生成時に独自の値を注入す
     ることができます。次のパターンが使えます:

          old_factory = logging.getLogRecordFactory()

          def record_factory(*args, **kwargs):
              record = old_factory(*args, **kwargs)
              record.custom_attribute = 0xdecafbad
              return record

          logging.setLogRecordFactory(record_factory)

     このパターンでは複数のファクトリをつなぐこともできます。それらが互
     いの属性を上書きしたりせず、また上にリストされた標準属性を意図せず
     上書きしたりしない限り、驚くようなことは何も起こりません (there
     should be no surprises)。


File: python.info,  Node: LogRecord 属性,  Next: LoggerAdapter オブジェクト,  Prev: LogRecord オブジェクト,  Up: logging --- Python 用のログ記録手段

5.16.4.7 LogRecord 属性
.......................

LogRecord には幾つかの属性があり、そのほとんどはコンストラクタの引数から
得られます。(なお、LogRecord コンストラクタの引数と LogRecord 属性が常に
厳密に対応するわけではありません。) これらの属性は、レコードからのデータ
をフォーマット文字列に統合するのに使えます。以下のテーブルに、属性名、意
味、そして % 形式フォーマット文字列における対応するプレースホルダを (ア
ルファベット順に) 列挙します。

{}-フォーマット (*note str.format(): 833.) を使用していれば、書式文字列
の中でプレースホールダーとして ‘{attrname}’ を使うことができます。 $-フ
ォーマット (*note string.Template: 897.) を使用している場合は、
‘${attrname}’ 形式にしてください。もちろん、両方の場合で ‘attrname’ は使
用したい実際の属性名に置き換えてください。

{}-フォーマットの場合には、属性名の後にフォーマットフラグを指定すること
ができます。属性名とフォーマットフラグの間はコロンで分割します。例: プレ
ースホールダー ‘{msecs:03.0f}’ は、ミリセカンド値 ‘4’ を ‘004’ としてフ
ォーマットします。利用可能なオプション上の全詳細に関しては *note
str.format(): 833. ドキュメンテーションを参照してください。

属性名               フォーマット                  説明
                                                   
-------------------------------------------------------------------------------------------------------
                                                   
‘args’               このフォーマットを自分で使    ‘msg’ に組み合わせて ‘message’ を生成するための引
                     う必要はないでしょう。        数のタプル、または、マージに用いられる辞書(引数が
                                                   一つしかなく、かつそれが辞書の場合)。
                                                   
                                                   
asctime              ‘%(asctime)s’                 *note LogRecord: 11e8. が生成された時刻を人間が読
                                                   める書式で表したもの。デフォルトでは "2003-07-08
                                                   16:49:45,896" 形式 (コンマ以降の数字は時刻のミリ
                                                   秒部分) です。
                                                   
                                                   
created              ‘%(created)f’                 *note LogRecord: 11e8. が生成された時刻です
                                                   (*note time.time_ns(): ce0. / 1e9 で返される形式
                                                   で)。
                                                   
                                                   
exc_info             このフォーマットを自分で使    (‘sys.exc_info’ 風の) 例外タプルか、例外が起こっ
                     う必要はないでしょう。        ていない場合は ‘None’。
                                                   
                                                   
exc_text             このフォーマットを自分で使    Exception information formatted as a string.
                     う必要はないでしょう。        This is set when *note Formatter.format(): 317c.
                                                   is invoked, or ‘None’ if no exception has
                                                   occurred.
                                                   
                                                   
ファイル名           ‘%(filename)s’                ‘pathname’ のファイル名部分。
                                                   
                                                   
funcName             ‘%(funcName)s’                ロギングの呼び出しを含む関数の名前。
                                                   
                                                   
levelname            ‘%(levelname)s’               メッセージのための文字のロギングレベル
                                                   (‘'DEBUG'’, ‘'INFO'’, ‘'WARNING'’, ‘'ERROR'’,
                                                   ‘'CRITICAL'’)。
                                                   
                                                   
levelno              ‘%(levelno)s’                 メッセージのための数値のロギングレベル
                                                   (*note DEBUG: 20de, *note INFO: 20df,
                                                   *note WARNING: 20e0, *note ERROR: 20e1,
                                                   *note CRITICAL: 20e2.)。
                                                   
                                                   
lineno               ‘%(lineno)d’                  ロギングの呼び出しが発せられたソース行番号 (利用
                                                   できる場合のみ)。
                                                   
                                                   
message              ‘%(message)s’                 ‘msg % args’ として求められた、ログメッセージ。
                                                   *note Formatter.format(): 317c. が呼び出されたと
                                                   きに設定されます。
                                                   
                                                   
module               ‘%(module)s’                  モジュール (‘filename’ の名前部分)。
                                                   
                                                   
msecs                ‘%(msecs)d’                   *note LogRecord: 11e8. が生成された時刻のミリ秒部
                                                   分。
                                                   
                                                   
msg                  このフォーマットを自分で使    元のロギングの呼び出しで渡されたフォーマット文字
                     う必要はないでしょう。        列。 ‘args’ と合わせて、 ‘message’ 、または任意の
                                                   オブジェクトを生成します
                                                   (*note 任意のオブジェクトをメッセージに使用する: 318b.
                                                   参照)。
                                                   
                                                   
name                 ‘%(name)s’                    ロギングに使われたロガーの名前。
                                                   
                                                   
pathname             ‘%(pathname)s’                ロギングの呼び出しが発せられたファイルの完全なパ
                                                   ス名 (利用できる場合のみ)。
                                                   
                                                   
process              ‘%(process)d’                 プロセス ID (利用可能な場合のみ)。
                                                   
                                                   
processName          ‘%(processName)s’             プロセス名 (利用可能な場合のみ)。
                                                   
                                                   
relativeCreated      ‘%(relativeCreated)d’         logging モジュールが読み込まれた時刻に対する、
                                                   LogRecord が生成された時刻を、ミリ秒で表したもの
                                                   。
                                                   
                                                   
stack_info           このフォーマットを自分で使    現在のスレッドでのスタックの底からこのレコードの
                     う必要はないでしょう。        生成に帰着したログ呼び出しまでのスタックフレーム
                                                   情報 (利用可能な場合)。
                                                   
                                                   
thread               ‘%(thread)d’                  スレッド ID (利用可能な場合のみ)。
                                                   
                                                   
threadName           ‘%(threadName)s’              スレッド名 (利用可能な場合のみ)。
                                                   
                                                   
taskName             ‘%(taskName)s’                *note asyncio.Task: 1c7. 名 (利用可能な場合のみ
                                                   )。
                                                   

バージョン 3.1 で変更: 'processName' が追加されました。

バージョン 3.12 で変更: 'taskName' が追加されました。


File: python.info,  Node: LoggerAdapter オブジェクト,  Next: スレッドセーフ性,  Prev: LogRecord 属性,  Up: logging --- Python 用のログ記録手段

5.16.4.8 LoggerAdapter オブジェクト
...................................

*note LoggerAdapter: 150d. インスタンスは文脈情報をログ記録呼び出しに渡
すのを簡単にするために使われます。使い方の例は *note
コンテキスト情報をログ記録出力に付加する: 3192. を参照してください。

 -- クラス: logging.LoggerAdapter (logger, extra=None,
          merge_extra=False)

     Returns an instance of *note LoggerAdapter: 150d. initialized with
     an underlying *note Logger: d46. instance, an optional dict-like
     object ('extra'), and an optional boolean ('merge_extra')
     indicating whether or not the 'extra' argument of individual log
     calls should be merged with the *note LoggerAdapter: 150d. extra.
     The default behavior is to ignore the 'extra' argument of
     individual log calls and only use the one of the *note
     LoggerAdapter: 150d. instance

      -- メソッド: process (msg, kwargs)

          文脈情報を挿入するために、ログ記録呼び出しに渡されたメッセージ
          および/またはキーワード引数に変更を加えます。ここでの実装は
          'extra' としてコンストラクタに渡されたオブジェクトを取り、
          'extra' キーを使って 'kwargs' に加えます。返り値は ('msg',
          'kwargs') というタプルで、(変更されているはずの) 渡された引数
          を含みます。

      -- の属性: manager

          背後にある 'logger' の ‘manager’ メソッドを代理で呼び出します
          。

      -- の属性: _log

          背後にある 'logger' の ‘_log()’ メソッドを代理で呼び出します。

     *note LoggerAdapter: 150d. は上記に加え *note Logger: d46. のメソッ
     ド *note debug(): 102b, *note info(): 20dd, *note warning(): 1a74,
     *note error(): 315e, *note exception(): 1029, *note critical():
     102a, *note log(): 1028, *note isEnabledFor(): 150e, *note
     getEffectiveLevel(): 315b, *note setLevel(): 16ac, *note
     hasHandlers(): 3165. をサポートします。これらは *note Logger: d46.
     の対応するメソッドと同じシグニチャを持つため、2つのインスタンスは区
     別せずに利用出来ます。

     バージョン 3.2 で変更: *note isEnabledFor(): 150e, *note
     getEffectiveLevel(): 315b, *note setLevel(): 16ac, *note
     hasHandlers(): 3165. が *note LoggerAdapter: 150d. に追加されました
     。これらメソッドは元のロガーに処理を委譲します。

     バージョン 3.6 で変更: 基底のロガーに移譲し、アダプターをネストでき
     るようにするために ‘manager’ 属性と ‘_log()’ メソッドが追加されまし
     た。

     バージョン 3.10 で変更: 'extra' 引数が任意になりました。

     バージョン 3.13 で変更: 'merge_extra' 引数が追加されました。


File: python.info,  Node: スレッドセーフ性,  Next: モジュールレベルの関数,  Prev: LoggerAdapter オブジェクト,  Up: logging --- Python 用のログ記録手段

5.16.4.9 スレッドセーフ性
.........................

logging モジュールは、クライアントで特殊な作業を必要としない限りスレッド
セーフになっています。このスレッドセーフ性はスレッドロックによって達成さ
れています; モジュールの共有データへのアクセスを直列化するためのロックが
一つ存在し、各ハンドラでも背後にある I/O へのアクセスを直列化するために
ロックを生成します。

*note signal: cb. モジュールを使用して非同期シグナルハンドラを実装してい
る場合、そのようなハンドラからはログ記録を使用できないかもしれません。こ
れは、 *note threading: f3. モジュールにおけるロック実装が常にリエントラ
ントではなく、そのようなシグナルハンドラから呼び出すことができないからで
す。


File: python.info,  Node: モジュールレベルの関数,  Next: モジュールレベル属性,  Prev: スレッドセーフ性,  Up: logging --- Python 用のログ記録手段

5.16.4.10 モジュールレベルの関数
................................

上で述べたクラスに加えて、いくつかのモジュールレベルの関数が存在します。

 -- の関数: logging.getLogger (name=None)

     指定された名前のロガーを返します。名前が ‘None’ であれば、ロガーの
     階層構造におけるルートロガーを返します。名前を指定する場合は、典型
     的には ''a"、 ''a.b" または ''a.b.c.d" のようなドット区切りの階層的
     な名前にします。名前の付け方は完全にログ機能を使う開発者次第ですが
     、 *note ロガーオブジェクト: 3151. で言及されている通り、特に理由が
     なければ ‘__name__’ を使うことが推奨されます。

     与えられた名前に対して、この関数はどの呼び出しでも同じロガーインス
     タンスを返します。したがって、ロガーインスタンスをアプリケーション
     の各部でやりとりする必要はありません。

 -- の関数: logging.getLoggerClass ()

     標準の *note Logger: d46. クラスか、最後に *note setLoggerClass():
     3199. に渡したクラスを返します。この関数は、新たなクラス定義の中で
     呼び出して、カスタマイズした *note Logger: d46. クラスのインストー
     ルが既に他のコードで適用したカスタマイズを取り消さないことを保証す
     るために使われることがあります。例えば以下のようにします:

          class MyLogger(logging.getLoggerClass()):
              # ... override behaviour here

 -- の関数: logging.getLogRecordFactory ()

     *note LogRecord: 11e8. を生成するのに使われる callable を返します。

     Added in version 3.2: この関数は、ログイベントを表現する *note
     LogRecord: 11e8. の構築方法に関して開発者により多くのコントロールを
     与えるため、 *note setLogRecordFactory(): 318e. とともに提供されま
     した。

     このファクトリがどのように呼ばれるかに関する詳細は *note
     setLogRecordFactory(): 318e. を参照してください。

 -- の関数: logging.debug (msg, *args, **kwargs)

     ルートロガーの *note Logger.debug(): 102b. メソッドを呼び出す便利関
     数です。引数の取り扱いはあらゆる点で当該メソッドと同じです。

     唯一の違いはルートロガーがハンドラを持たない場合で、この場合はルー
     トロガーの ‘debug’ メソッドを呼び出す前に *note basicConfig(): bf3.
     が呼ばれます。

     非常に短いスクリプトや ‘logging’ の機能についての簡単なデモに対して
     は、 ‘debug’ やその他のモジュールレベル関数は便利でしょう。しかしな
     がら、ほとんどのプログラムはロギングの設定を慎重かつ明示的に制御し
     たいはずです。したがって、このドキュメントの最初に書かれているとお
     り、モジュールレベルのロガーを生成してそのロガーに対する *note
     Logger.debug(): 102b. メソッド (または他のログレベル固有のメソッド)
     を呼び出す方を好むでしょう。

 -- の関数: logging.info (msg, *args, **kwargs)

     ルートロガーに対してログレベル *note INFO: 20df. でメッセージを記録
     します。引数と振る舞いは、ログレベルを除けば *note debug(): 315d. と
     同じです。

 -- の関数: logging.warning (msg, *args, **kwargs)

     ルートロガーに対してログレベル *note WARNING: 20e0. でメッセージを
     記録します。引数と振る舞いは、ログレベルを除けば *note debug():
     315d. と同じです。

          注釈: ‘warning’ と機能的に等価な古い関数 ‘warn’ があります。
          ‘warn’ は廃止予定なので使わないでください - 代わりに ‘warning’
          を使ってください。

 -- の関数: logging.error (msg, *args, **kwargs)

     ルートロガーに対してログレベル *note ERROR: 20e1. でメッセージを記
     録します。引数と振る舞いは、ログレベルを除けば *note debug(): 315d.
     と同じです。

 -- の関数: logging.critical (msg, *args, **kwargs)

     ルートロガーに対してログレベル *note CRITICAL: 20e2. でメッセージを
     記録します。引数と振る舞いは、ログレベルを除けば *note debug():
     315d. と同じです。

 -- の関数: logging.exception (msg, *args, **kwargs)

     ルートロガーに対してログレベル *note ERROR: 20e1. でメッセージを記
     録します。引数と振る舞いは、ログレベルを除けば *note debug(): 315d.
     と同じです。例外情報がログメッセージに追加されます。この関数は例外
     ハンドラからのみ呼び出されるべきです。

 -- の関数: logging.log (level, msg, *args, **kwargs)

     ルートロガーに対して 'level' で指定したログレベルでメッセージを記録
     します。引数と振る舞いは、ログレベルを除けば *note debug(): 315d. と
     同じです。

 -- の関数: logging.disable (level=CRITICAL)

     全てのロガーのレベル 'level' を上書きし、これはロガー自身の出力レベ
     ルよりも優先されます。アプリケーション全体を横断するログ出力を一時
     的に調整する必要が生じたら、この関数は便利でしょう。これの効果は重
     大度 'level' 以下の全てのロギング呼び出しを無効にすることですので、
     INFO で呼び出しをすれば、INFO と DEBUG イベントが捨てられる一方で、
     重大度 WARNING 以上のものは、ロガーの有効レベルに基いて処理されます
     。 ‘logging.disable(logging.NOTSET)’ が呼び出されると、この上書きレ
     ベルは削除され、ログ出力は再び個々のロガーの有効レベルに依存するよ
     うになります。

     ‘CRITICAL’ より高い独自のログレベル (これは推奨されません) を定義し
     た場合は、 'level' 引数のデフォルト値を当てにできなくなり、適切な値
     を明示的に与える必要があります。

     バージョン 3.7 で変更: 'level' 引数のデフォルトが ‘CRITICAL’ レベル
     になりました。この変更についてのより詳しいことは bpo-28524(1) を参
     照してください。

 -- の関数: logging.addLevelName (level, levelName)

     内部的な辞書の中でレベル 'level' をテキスト 'levelName' に関連付け
     ます。これは例えば *note Formatter: 16b0. でメッセージを書式化する
     際のように、数字のレベルをテキスト表現に対応付ける際に用いられます
     。この関数は自作のレベルを定義するために使うこともできます。使われ
     るレベルに対する唯一の制限は、レベルは正の整数でなくてはならず、メ
     ッセージの深刻度が上がるに従ってレベルの数も上がらなくてはならない
     ということです。

          注釈: 独自のレベルを定義したい場合、 *note カスタムレベル:
          319f. のセクションを参照してください。

 -- の関数: logging.getLevelNamesMapping ()

     ログレベルの名前と対応するログレベルのマッピングを返します。例えば
     、文字列 "CRITICAL" は *note CRITICAL: 20e2. にマップされます。この
     関数が返すマッピングオブジェクトは、関数呼び出しのたびに内部のマッ
     ピングをコピーしたものです。

     Added in version 3.11.

 -- の関数: logging.getLevelName (level)

     テキストまたは数値表現でログレベル 'level' を返してください。

     'level' が定義済みのレベル *note CRITICAL: 20e2, *note ERROR: 20e1,
     *note WARNING: 20e0, *note INFO: 20df, *note DEBUG: 20de. のいずれ
     かである場合、対応する文字列が返されます。 *note addLevelName():
     319e. を使ってレベルに名前を関連付けていた場合、 'level' に関連付け
     られた名前が返されます。定義済みのレベルに対応する数値を指定した場
     合、レベルに対応した文字列表現を返します。

     'level' パラメータは、 *note INFO: 20df. のような整数定数の代わりに
     'INFO' のようなレベルの文字列表現も受け付けます。この場合、この関数
     は関連するレベルの数値表現を返します。

     もし渡された数値や文字列がマッチしなければ、 'Level %s' % level が
     返されます。

          注釈: レベルは内部的には整数です(これはロギングのロジックが大
          小比較をする必要があるからです)。この関数は、数値のレベルを、
          書式記述子 ‘%(levelname)s’ (*note LogRecord 属性: 315c. 参照
          )によって書式化されるログ出力の表示用レベル名に変換するなどの
          用途に使用されます。

     バージョン 3.4 で変更: Python 3.4以前のバージョンでは、この関数には
     テキストのレベルも渡すことが出来、これは対応する数字レベルに読み替
     えられていました。このドキュメントされていなかった振る舞いは誤りで
     あると判断され、Python 3.4 で一度削除されました。ただし後方互換性の
     ために、これは 3.4.2 で元に戻されました。

 -- の関数: logging.getHandlerByName (name)

     'name' に指定した名前のハンドラを返します。指定した名前のハンドラが
     ない場合は ‘None’ を返します。

     Added in version 3.12.

 -- の関数: logging.getHandlerNames ()

     全ての既知のハンドラ名の、イミュータブルな集合を返します。

     Added in version 3.12.

 -- の関数: logging.makeLogRecord (attrdict)

     属性が 'attrdict' で定義された、新しい *note LogRecord: 11e8. イン
     スタンスを生成して返します。この関数は、 pickle された *note
     LogRecord: 11e8. 属性の辞書をソケットを介して送信し、受信端で *note
     LogRecord: 11e8. インスタンスとして再構成する場合に便利です。

 -- の関数: logging.basicConfig (**kwargs)

     デフォルトの *note Formatter: 16b0. を持つ *note StreamHandler:
     1411. を生成してルートロガーに追加し、ロギングシステムの基本的な環
     境設定を行います。関数 *note debug(): 315d, *note info(): 3186,
     *note warning(): 354, *note error(): 319a, *note critical(): 319b.
     は、ルートロガーにハンドラが定義されていない場合に自動的に *note
     basicConfig(): bf3. を呼び出します。

     この関数は 'force' キーワード引数に ‘True’ が設定されない限り、ルー
     トロガーに設定されたハンドラがあれば何もしません。

          注釈: この関数は、他のスレッドが開始される前にメインスレッドか
          ら呼び出されるべきです。Python の 2.7.1 や 3.2 以前のバージョ
          ンでは、この関数が複数のスレッドから呼ばれると(珍しい状況下と
          はいえ)ハンドラがルートロガーに複数回加えられることがあり、ロ
          グ内のメッセージが重複するという予期しない結果をもたらすことが
          あります。

     以下のキーワード引数がサポートされます。

     フォーマット       説明
                        
     ---------------------------------------------------------------------
                        
     'filename'         *note StreamHandler: 1411. ではなく指定された名
                        前で *note FileHandler: 1c53. が作られます。
                        
                        
     'filemode'         'filename' が指定された場合、この
                        *note モード: 25d9. でファイルが開かれます。 デ
                        フォルトは ‘'a'’ です。
                        
                        
     'format'           ハンドラーで指定されたフォーマット文字列を使い
                        ます。デフォルトは ‘levelname’, ‘name’,
                        ‘message’ 属性をコロン区切りにしたものです。
                        
                        
     'datefmt'          指定された日時の書式で
                        *note time.strftime(): 1402. が受け付けるものを
                        使います。
                        
                        
     'style'            'format' が指定された場合、書式文字列にこのスタ
                        イルを仕様します。 ‘'%'’, ‘'{'’, ‘'$'’ のうち
                        1つで、それぞれ *note printf-style: 8db,
                        *note str.format(): 833,
                        *note string.Template: 897. に対応します。 デフ
                        ォルトは ‘'%'’ です。
                        
                        
     'level'            ルートロガーのレベルを指定された
                        *note レベル: 86a. に設定します。
                        
                        
     'stream'           指定されたストリームを
                        *note StreamHandler: 1411. の初期化に使います。
                        この引数は 'filename' と同時には使えないことに
                        注意してください。 両方が指定されたときには
                        ‘ValueError’ が送出されます。
                        
                        
     'handlers'         もし指定されれば、 これは root ロガーに追加され
                        る既に作られたハンドラのイテラブルになります。
                        まだフォーマッタがセットされていないすべてのハ
                        ンドラは、この関数で作られたデフォルトフォーマ
                        ッタが割り当てられることになります。この引数は
                        'filename' や 'stream' と互換性がないことに注意
                        してください。両方が存在する場合 ‘ValueError’ が
                        上げられます。
                        
                        
     'force'            このキーワード引数が真に設定されている場合、ル
                        ートのロガーに取り付けられたハンドラは全て取り
                        除かれ、他の引数によって指定された設定が有効に
                        なる前に閉じられます。
                        
                        
     'encoding'         もしこのキーワード引数が 'filename' とともに指
                        定された場合、 *note FileHandler: 1c53. が作成
                        されるときにこの値が利用され、出力ファイルを開
                        く時に使用されます。
                        
                        
     'errors'           もしこのキーワード引数が 'filename' とともに指
                        定された場合、 *note FileHandler: 1c53. が作成
                        されるときのこの値が使用され、出力ファイルを開
                        く時に使われます。もし指定されなかった場合、
                        'backslashreplace' が使用されます。もし ‘None’
                        が指定されると *note open(): 316. のように渡さ
                        れ、'errors' を渡したのと同じように扱われます。
                        

     バージョン 3.2 で変更: 'style' 引数が追加されました。

     バージョン 3.3 で変更: 互換性のない引数が指定された状況 (例えば
     'handlers' が 'stream' や 'filename' と一緒に指定されたり、'stream'
     が 'filename' と一緒に指定された場合) を捕捉するために、追加のチェ
     ックが加えられました。

     バージョン 3.8 で変更: 'force' 引数が追加されました。

     バージョン 3.9 で変更: 'encoding' と 'errors' 引数が追加されました
     。

 -- の関数: logging.shutdown ()

     ロギングシステムに対して、バッファのフラッシュを行い、すべてのハン
     ドラを閉じることで順次シャットダウンを行うように告知します。この関
     数はアプリケーションの終了時に呼ばれるべきであり、また呼び出し以降
     はそれ以上ロギングシステムを使ってはなりません。

     loggingモジュールがインポートされると、この関数が終了ハンドラーとし
     て登録されます（ *note atexit: d. 参照）。そのため、通常はこれを手
     動で行う必要はありません。

 -- の関数: logging.setLoggerClass (klass)

     ロギングシステムに対して、ロガーをインスタンス化する際にクラス
     'klass' を使うように指示します。 指定するクラスは引数として名前だけ
     をとるようなメソッド ‘__init__()’ を定義していなければならず、
     ‘__init__()’ では ‘Logger.__init__()’ を呼び出さなければなりません
     。 この関数が呼び出されるのはたいてい、独自の振る舞いをするロガーを
     使う必要のあるアプリケーションでロガーがインスタンス化される前です
     。 呼び出された後は、いつでもそのサブクラスを使ってロガーのインスタ
     ンス化をしてはいけません: 引き続き *note logging.getLogger(): b59.
     API を使用してロガーを取得してください。

 -- の関数: logging.setLogRecordFactory (factory)

     *note LogRecord: 11e8. を生成するのに使われる callable をセットしま
     す。


     パラメータ: ‘factory’ - ログレコードを生成するファクトリとして振舞
     う callable。

     Added in version 3.2: この関数は、ログイベントを表現する *note
     LogRecord: 11e8. の構築方法に関して開発者により多くのコントロールを
     与えるため、 *note getLogRecordFactory(): 318d. とともに提供されま
     した。

     ファクトリは以下のようなシグネチャを持っています:

     ‘factory(name, level, fn, lno, msg, args, exc_info, func=None,
     sinfo=None, **kwargs)’


          name: ロガーの名前。


          level: ログレベル (数値)。


          fn: ログ呼び出しが行われたファイルのフルパス名。


          lno: ログ呼び出しが行われたファイルの行数。


          msg: ログメッセージ。


          ‘args’: ログメッセージに対する引数。


          exc_info: 例外タプルまたは ‘None’。


          func: ログ呼び出しを起動した関数またはメソッドの名前。


          sinfo: *note traceback.print_stack(): 1086. で提供されるような
          、呼び出し階層を示すスタックトレースバック。


          ‘kwargs’: 追加のキーワード引数。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=28524


File: python.info,  Node: モジュールレベル属性,  Next: warnings モジュールとの統合,  Prev: モジュールレベルの関数,  Up: logging --- Python 用のログ記録手段

5.16.4.11 モジュールレベル属性
..............................

 -- データ: logging.lastResort

     「最後の手段のハンドラ」が、この属性で利用可能です。これは *note
     StreamHandler: 1411. が ‘sys.stderr’ に ‘WARNING’ レベルで書き出し
     ているのがそうですし、ロギングの設定がなにか不在のロギングイベント
     を扱う場合に使われます。最終的な結果は、メッセージを単に
     ‘sys.stderr’ に出力することです。これはかつて「logger XYZ について
     のハンドラが見つかりません」と言っていたエラーメッセージを置き換え
     ています。もしも何らかの理由でその昔の振る舞いが必要な場合は、
     ‘lastResort’ に ‘None’ をセットすれば良いです。

     Added in version 3.2.

 -- データ: logging.raiseExceptions

     ログメッセージの処理中に発生した例外を伝播させるかどうかを調べるた
     めに使われます。

     デフォルト: ‘True’.

     *note raiseExceptions: 1412. が ‘False’ の場合、発生した例外は静か
     に無視されます。これはほとんどのログシステムにおいて望ましい動作で
     す - ほとんどのユーザーはログシステムのエラーには興味がなく、アプリ
     ケーションのエラーにより強い関心を持つでしょう。


File: python.info,  Node: warnings モジュールとの統合,  Prev: モジュールレベル属性,  Up: logging --- Python 用のログ記録手段

5.16.4.12 warnings モジュールとの統合
.....................................

The *note captureWarnings(): 31a4. function can be used to integrate
‘logging’ with the *note warnings: 118. module.

 -- の関数: logging.captureWarnings (capture)

     この関数は、logging による警告の補足を、有効にまたは無効にします。

     'capture' が ‘True’ なら、 *note warnings: 118. モジュールに発せら
     れた警告は、ロギングシステムにリダイレクトされるようになります。具
     体的には、警告が *note warnings.formatwarning(): 1df8. でフォーマッ
     ト化され、結果の文字列が ‘'py.warnings'’ という名のロガーに、 *note
     WARNING: 20e0. の重大度でロギングされるようになります。

     'capture' が ‘False’ なら、警告のロギングシステムに対するリダイレク
     トは止められ、警告は元の (すなわち、‘captureWarnings(True)’ が呼び
     出される前に有効だった) 送信先にリダイレクトされるようになります。

参考
....

*note logging.config: 8c. モジュール

     logging モジュールの環境設定 API です。

*note logging.handlers: 8d. モジュール

     logging モジュールに含まれる、便利なハンドラです。

PEP 282(1) - ログシステム

     この機能を Python 標準ライブラリに含めることを述べた提案です。

Python の最初のロギングパッケージ(2)

     This is the original source for the ‘logging’ package.  The version
     of the package available from this site is suitable for use with
     Python 1.5.2, 2.1.x and 2.2.x, which do not include the ‘logging’
     package in the standard library.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0282/

   (2) https://old.red-dove.com/python_logging.html


File: python.info,  Node: logging config --- ログ記録の環境設定,  Next: logging handlers --- ログ記録ハンドラー,  Prev: logging --- Python 用のログ記録手段,  Up: 汎用オペレーティングシステムサービス

5.16.5 ‘logging.config’ -- ログ記録の環境設定
---------------------------------------------

'ソースコード:' Lib/logging/config.py(1)

Important
.........

このページには、リファレンス情報だけが含まれています。チュートリアルは、
以下のページを参照してください

   * *note 基本チュートリアル: 140e.

   * *note 上級チュートリアル: 140f.

   * *note ロギングクックブック: 1410.

__________________________________________________________________

この節は、logging モジュールを設定するための API を解説します。

* Menu:

* 環境設定のための関数::
* セキュリティで考慮すべき点::
* 環境設定辞書スキーマ::
* 環境設定ファイルの書式::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/logging/config.py


File: python.info,  Node: 環境設定のための関数,  Next: セキュリティで考慮すべき点,  Up: logging config --- ログ記録の環境設定

5.16.5.1 環境設定のための関数
.............................

The following functions configure the logging module.  They are located
in the ‘logging.config’ module.  Their use is optional -- you can
configure the logging module using these functions or by making calls to
the main API (defined in *note logging: 8b. itself) and defining
handlers which are declared either in *note logging: 8b. or *note
logging.handlers: 8d.

 -- の関数: logging.config.dictConfig (config)

     辞書からロギング環境設定を取得します。この辞書の内容は、以下の
     *note 環境設定辞書スキーマ: 31a9. で記述されています。

     環境設定中にエラーに遭遇すると、この関数は適宜メッセージを記述しつ
     つ *note ValueError: 2ec, *note TypeError: 198, *note
     AttributeError: 5f0. または *note ImportError: 65b. を送出します。
     例外を送出する条件を (不完全かもしれませんが) 以下に列挙します:

        * 文字列でなかったり、実際のロギングレベルと関係ない文字列であっ
          たりする ‘level’。

        * ブール値でない ‘propagate’ の値。

        * 対応する行き先を持たない id。

        * インクリメンタルな呼び出しの中で見つかった存在しないハンドラ
          id。

        * 無効なロガー名。

        * 内部や外部のオブジェクトに関わる不可能性。

     Parsing is performed by the ‘DictConfigurator’ class, whose
     constructor is passed the dictionary used for configuration, and
     has a ‘configure()’ method.  The ‘logging.config’ module has a
     callable attribute ‘dictConfigClass’ which is initially set to
     ‘DictConfigurator’.  You can replace the value of ‘dictConfigClass’
     with a suitable implementation of your own.

     *note dictConfig(): 13c8. は ‘dictConfigClass’ を、指定された辞書を
     渡して呼び出し、それから返されたオブジェクトの ‘configure()’ メソッ
     ドを呼び出して、環境設定を作用させます:

          def dictConfig(config):
              dictConfigClass(config).configure()

     For example, a subclass of ‘DictConfigurator’ could call
     ‘DictConfigurator.__init__()’ in its own ‘__init__()’, then set up
     custom prefixes which would be usable in the subsequent
     ‘configure()’ call.  ‘dictConfigClass’ would be bound to this new
     subclass, and then *note dictConfig(): 13c8. could be called
     exactly as in the default, uncustomized state.

     Added in version 3.2.

 -- の関数: logging.config.fileConfig (fname, defaults=None,
          disable_existing_loggers=True, encoding=None)

     ログ記録の環境設定を *note configparser: 26. 形式ファイルから読み出
     します。そのファイルの形式は *note 環境設定ファイルの書式: 31aa. で
     記述されているとおりにしなければなりません。この関数はアプリケーシ
     ョンから何度も呼び出すことができ、これによって、 (設定を選択し、選
     択された設定を読み出す機構をデベロッパが提供していれば) 複数の準備
     済みの設定からエンドユーザが選択するようにできます。

     It will raise *note FileNotFoundError: 264. if the file doesn't
     exist and *note RuntimeError: 244. if the file is invalid or empty.


     パラメータ:

        * ‘fname’ - A filename, or a file-like object, or an instance
          derived from *note RawConfigParser: 1166.  If a
          ‘RawConfigParser’-derived instance is passed, it is used as
          is.  Otherwise, a *note ConfigParser: 4de. is instantiated,
          and the configuration read by it from the object passed in
          ‘fname’.  If that has a *note readline(): bf. method, it is
          assumed to be a file-like object and read using *note
          read_file(): 72a.; otherwise, it is assumed to be a filename
          and passed to *note read(): 1681.

        * ‘defaults’ - Defaults to be passed to the ‘ConfigParser’ can
          be specified in this argument.

        * ‘disable_existing_loggers’ - ‘False’ が指定された場合は、この
          呼び出しが行われたときに存在するロガーは有効のまま残されます。
          後方互換性のあるやり方で古い振る舞いを保つので、デフォルト値は
          ‘True’ になっています。そのような振る舞いでは、既存の非ルート
          ロガーまたはそれらのロガーの先祖がロギング設定の中で明示的に名
          付けられていない限り、既存のロガーを無効にします。

        * ‘encoding’ - 'fname' がファイル名の場合に、ファイルをオープン
          する時のエンコーディングです。

     バージョン 3.4 で変更: ‘fname’ として *note RawConfigParser: 1166.
     のサブクラスのインスタンスが渡せ得るようになっています。これによっ
     てこのようなことが容易になります:

             * ロギングの設定が、アプリケーション全体の設定における単な
               る一部であるような設定ファイルの使用。

             * ファイルから設定を読み込み、 ‘fileConfig’ に通す前に(例え
               ばコマンドラインパラメータやランタイム環境の他のなにかで
               )アプリケーションによって修正するようなこと。

     バージョン 3.10 で変更: Added the 'encoding' parameter.

     バージョン 3.12 で変更: An exception will be thrown if the provided
     file doesn't exist or is invalid or empty.

 -- の関数: logging.config.listen (port=DEFAULT_LOGGING_CONFIG_PORT,
          verify=None)

     指定されたポートでソケットサーバを起動し、新しい設定を待ち受けます
     。ポートが指定されなかった場合は、モジュールのデフォルトの
     ‘DEFAULT_LOGGING_CONFIG_PORT’ が使用されます。ロギング設定は *note
     dictConfig(): 13c8. あるいは *note fileConfig(): d48. で処理できる
     ファイルとして送信されます。 *note Thread: 176. インスタンスを返し
     、このインスタンスの *note start(): 178. を呼び出してサーバを起動し
     、適切なところで *note join(): 13fd. を呼び出すことができます。サー
     バを停止するには、 *note stopListening(): 31ab. を呼び出します。

     ‘verify’ 引数を指定する場合は、これはソケットを通して受け取ったバイ
     ト文字列が妥当であるか、処理すべきであるかどうかを検査する callable
     である必要があります。ソケットを通じて、暗号化または署名あるいはそ
     の両方を受け取ることがあります。そのような場合に、 ‘verify’
     callable が署名の正当性検査または暗号化の復号あるいはその両方を実施
     することが出来ます。 ‘verify’ callable は単一引数で呼び出されます -
     ソケットを通じて受け取ったバイト文字列です - そして処理すべきバイト
     文字列、または捨て去られるべきであることを示すための ‘None’ を返す
     必要があります。返却されるバイト文字列は(たとえば正当性検査だけが行
     われて)渡されたものと同じかもしれませんし、あるいは(おそらく暗号化
     の復号が行われて)まったく異なるものかもしれません。

     ソケットに設定を送るには、まず設定ファイルを読み、それを
     ‘struct.pack('>L', n)’ を使って長さ 4 バイトのバイナリにパックした
     ものを前に付けたバイト列としてソケットに送ります。
          注釈: 設定の一部は *note eval(): 4a3. を通じて渡されるため、こ
          の関数を利用することはユーザーをセキュリティ上のリスクにさらす
          可能性があります。この関数は ‘localhost’ のソケットだけにバイ
          ンドされており、リモートマシンからの接続を受け付けませんが、そ
          れでも *note listen(): 1167. を呼び出したプロセスのアカウント
          のもとで信頼できないコードが実行されうるシナリオが存在します。
          特に、 *note listen(): 1167. を呼び出したプロセスが複数のユー
          ザーが利用するマシン上で実行されており、ユーザー同士が互いに信
          頼できない場合、悪意あるユーザーが被害者ユーザーのプロセス上で
          本質的に任意のコードを実行するように計画する可能性があります。
          攻撃は、単に被害者ユーザーの *note listen(): 1167. ソケットに
          接続して、被害者ユーザーのプロセス上で攻撃者が実行したいコード
          が実行されるような設定を送り込むだけです。この攻撃はデフォルト
          のポートが使われている場合きわめて容易であり、異なるポートが使
          われている場合でもそれほど難しくはありません。このような事象が
          発生するリスクを回避するためには、 *note listen(): 1167. の
          ‘verify’ 引数を使って不正な設定が適用されるのを防ぐようにして
          ください。

     バージョン 3.4 で変更: ‘verify’ 引数が追加されました。

          注釈: 既存のロガーを無効にしない構成をリスナーに送信する場合は
          、設定にはJSONフォーマットを使用する必要があります。これは、設
          定に *note dictConfig(): 13c8. を使用します。 このメソッドを使
          用すると、 ‘disable_existing_loggers’ に ‘False’ を指定した設
          定を送信できます。

 -- の関数: logging.config.stopListening ()

     *note listen(): 1167. を呼び出して作成された、待ち受け中のサーバを
     停止します。通常 *note listen(): 1167. の戻り値に対して ‘join()’ が
     呼ばれる前に呼び出します。


File: python.info,  Node: セキュリティで考慮すべき点,  Next: 環境設定辞書スキーマ,  Prev: 環境設定のための関数,  Up: logging config --- ログ記録の環境設定

5.16.5.2 セキュリティで考慮すべき点
...................................

logging の設定機能は便利さを提供します。その便利さの一部は設定ファイル内
のテキストを logging の設定に使われる Python オブジェクトに変換する機能
を提供することによって実現されています - たとえば、 *note
ユーザ定義オブジェクト: 31ae. で説明されているような機能です。しかし、ま
さにこのメカニズム (実行可能オブジェクトをユーザー定義モジュールからイン
ポートし、設定ファイルから読み込んだパラメータを使ってそれらを呼び出すこ
と) が任意のコードを呼び出すことに利用できる可能性があります。そして、こ
の理由により、信頼できない情報源から取得した設定ファイルは '細心の注意'
を払って取り扱わなければなりません。そのようなファイルをロードする場合、
そのファイルがいかなる問題も起こさないと確認した上で実際にファイルをロー
ドしてください。


File: python.info,  Node: 環境設定辞書スキーマ,  Next: 環境設定ファイルの書式,  Prev: セキュリティで考慮すべき点,  Up: logging config --- ログ記録の環境設定

5.16.5.3 環境設定辞書スキーマ
.............................

ロギング設定を記述するには、生成するさまざまなオブジェクトと、それらのつ
ながりを列挙しなければなりません。例えば、 'console' という名前のハンド
ラを生成し、'startup' という名前のロガーがメッセージを 'console' ハンド
ラに送るというようなことを記述します。これらのオブジェクトは、 *note
logging: 8b. モジュールによって提供されるものに限らず、独自のフォーマッ
タやハンドラクラスを書くことも出来ます。このクラスへのパラメータは、
‘sys.stderr’ のような外部オブジェクトを必要とすることもあります。これら
のオブジェクトとつながりを記述する構文は、以下の *note
オブジェクトの接続: 31b0. で定義されています。

* Menu:

* 辞書スキーマの詳細::
* 増分設定::
* オブジェクトの接続::
* ユーザ定義オブジェクト::
* ハンドラの設定順序::
* 外部オブジェクトへのアクセス::
* 内部オブジェクトへのアクセス::
* インポート解決とカスタムインポーター::
* Configuring QueueHandler and QueueListener::


File: python.info,  Node: 辞書スキーマの詳細,  Next: 増分設定,  Up: 環境設定辞書スキーマ

5.16.5.4 辞書スキーマの詳細
...........................

*note dictConfig(): 13c8. に渡される辞書は、以下のキーを含んでいなければ
なりません:

   * 'version' - スキーマのバージョンを表す整数値に設定されます。現在有
     効な値は 1 だけですが、このキーがあることで、このスキーマは後方互換
     性を保ちながら発展できます。

その他すべてのキーは省略可能ですが、与えられたなら以下に記述するように解
釈されます。以下のすべての場合において、 '環境設定辞書' と記載されている
所では、その辞書に特殊な ‘'()'’ キーがあるかを調べることで、カスタムのイ
ンスタンス化が必要であるか判断されます。その場合は、以下の *note
ユーザ定義オブジェクト: 31ae. で記述されている機構がインスタンス生成に使
われます。そうでなければ、インスタンス化するべきものを決定するのにコンテ
キストが使われます。

   * 'formatters' - 対応する値は辞書で、そのそれぞれのキーがフォーマッタ
     id になり、それぞれの値が対応する *note Formatter: 16b0. インスタン
     スをどのように環境設定するかを記述する辞書になります。

     設定辞書は *note Formatter: 16b0. オブジェクトを作成するときの引数
     に対応する、次のようなオプションキーがないか探索されます。

        * ‘format’

        * ‘datefmt’

        * ‘style’

        * ‘validate’ (バージョン3.8以降)

        * ‘defaults’ (since version >=3.12)

     オプションの ‘class’ キーはフォーマッタークラスの名前を表します（モ
     ジュールとクラス名をドットで繋げる）。インスタンス化時の引数は
     *note Formatter: 16b0. と同じであるため、このキーは *note
     Formatter: 16b0. をカスタマイズしたサブクラスのインスタンス化に使う
     のがもっとも便利です。例えばトレースバックにさらに情報を付加したり
     、情報を要約代替クラスを実装するといったことが想定されます。もし、
     自作のフォーマッターが異なる引数や追加の設定引数を持つ場合は、
     *note ユーザ定義オブジェクト: 31ae. を使うべきです。

   * 'filters' - 対応する値は辞書で、そのそれぞれのキーがフィルタ id に
     なり、それぞれの値が対応する Filter インスタンスをどのように環境設
     定するかを記述する辞書になります。

     環境設定辞書は、(デフォルトが空文字列の) キー ‘name’ を検索され、そ
     れらが *note logging.Filter: 1414. インスタンスを構成するのに使われ
     ます。

   * 'handlers' - 対応する値は辞書で、そのそれぞれのキーがハンドラ id に
     なり、それぞれの値が対応する Handler インスタンスをどのように環境設
     定するかを記述する辞書になります。

     環境設定辞書は、以下のキーを検索されます:

        * ‘class’ (必須)。これはハンドラクラスの完全に修飾された名前です
          。

        * ‘level’ (任意)。ハンドラのレベルです。

        * ‘formatter’ (任意)。このハンドラへのフォーマッタの id です。

        * ‘filters’ (任意)。このハンドラへのフィルタの id のリストです。

          バージョン 3.11 で変更: ‘filters’ は id に加えてフィルタのイン
          スタンスを受け取ることができるようになりました。

     その他の 'すべての' キーは、ハンドラのコンストラクタにキーワード引
     数として渡されます。例えば、以下のコード片が与えられたとすると:

          handlers:
            console:
              class : logging.StreamHandler
              formatter: brief
              level   : INFO
              filters: [allow_foo]
              stream  : ext://sys.stdout
            file:
              class : logging.handlers.RotatingFileHandler
              formatter: precise
              filename: logconfig.log
              maxBytes: 1024
              backupCount: 3

     id が ‘console’ であるハンドラが、 ‘sys.stdout’ を根底のストリーム
     にして、 *note logging.StreamHandler: 1411. としてインスタンス化さ
     れます。id が ‘file’ であるハンドラが、 ‘filename='logconfig.log',
     maxBytes=1024, backupCount=3’ をキーワード引数にして、 *note
     logging.handlers.RotatingFileHandler: 1941. としてインスタンス化さ
     れます。

   * 'loggers' - 対応する値は辞書で、そのそれぞれのキーがロガー名になり
     、それぞれの値が対応する Logger インスタンスをどのように環境設定す
     るかを記述する辞書になります。

     環境設定辞書は、以下のキーを検索されます:

        * ‘level’ (任意)。ロガーのレベルです。

        * ‘propagate’ (任意)。ロガーの伝播の設定です。

        * ‘filters’ (任意)。このロガーへのフィルタの id のリストです。

          バージョン 3.11 で変更: ‘filters’ は id に加えてフィルタのイン
          スタンスを受け取ることができるようになりました。

        * ‘handlers’ (任意)。このロガーへのハンドラの id のリストです。

     指定されたロガーは、指定されたレベル、伝播、ハンドラに従って環境設
     定されます。

   * 'root' - これは、ルートロガーへの設定になります。この環境設定の進行
     は、‘propagate’ 設定が適用されないことを除き、他のロガーと同じです
     。

   * 'incremental' - この環境設定が既存の環境設定に対する増分として解釈
     されるかどうかです。この値のデフォルトは ‘False’ で、指定された環境
     設定は、既存の *note fileConfig(): d48. API によって使われているの
     と同じ意味上で、既存の環境設定を置き換えます。

     指定された値が ‘True’ なら、環境設定は *note 増分設定: 31b3. の節で
     記述されているように進行します。

   * 'disable_existing_loggers' - 既存の非ルートロガーをすべて無効にする
     べきかどうかです。この設定は、 *note fileConfig(): d48. における同
     じ名前のパラメータと同じです。設定されていなければ、このパラメータ
     のデフォルトは ‘True’ です。この値は、 'incremental' が ‘True’ なら
     無視されます。


File: python.info,  Node: 増分設定,  Next: オブジェクトの接続,  Prev: 辞書スキーマの詳細,  Up: 環境設定辞書スキーマ

5.16.5.5 増分設定
.................

増分設定に完全な柔軟性を提供するのは難しいです。例えば、フィルタやフォー
マッタのようなオブジェクトは匿名なので、一旦環境設定がなされると、設定を
拡張するときにそのような匿名オブジェクトを参照することができません。

さらに、一旦環境設定がなされた後、実行時にロガー、ハンドラ、フィルタ、フ
ォーマッタのオブジェクトグラフを任意に変えなければならない例もありません
。ロガーとハンドラの冗長性は、レベル (または、ロガーの場合には、伝播フラ
グ) を設定することによってのみ制御できます。安全な方法でオブジェクトグラ
フを任意に変えることは、マルチスレッド環境で問題となります。不可能ではな
いですが、その効用は実装に加えられる複雑さに見合いません。

従って、環境設定辞書の ‘incremental’ キーが与えられ、これが ‘True’ であ
るとき、システムは ‘formatters’ と ‘filters’ の項目を完全に無視し、
‘handlers’ の項目の ‘level’ 設定と、‘loggers’ と ‘root’ の項目の ‘level’
と ‘propagate’ 設定のみを処理します。

環境設定辞書の値を使うことで、設定は pickle 化された辞書としてネットワー
クを通してソケットリスナに送ることができます。これにより、長時間起動する
アプリケーションのロギングの冗長性を、アプリケーションを止めて再起動する
必要なしに、いつでも変更することができます。


File: python.info,  Node: オブジェクトの接続,  Next: ユーザ定義オブジェクト,  Prev: 増分設定,  Up: 環境設定辞書スキーマ

5.16.5.6 オブジェクトの接続
...........................

このスキーマは、ロギングオブジェクトの一揃い - ロガー、ハンドラ、フォー
マッタ、フィルタ - について記述します。これらは、オブジェクトグラフ上で
お互い接続されます。従って、このスキーマは、オブジェクト間の接続を表現し
なければなりません。例えば、環境設定で、特定のロガーが特定のハンドラに取
り付けられたとします。この議論では、ロガーとハンドラが、これら 2 つの接
続のそれぞれ送信元と送信先であるといえます。もちろん、この設定オブジェク
ト中では、これはハンドラへの参照を保持しているロガーで表されます。設定辞
書中で、これは次のようになされます。まず、送信先オブジェクトを曖昧さなく
指定する id を与えます。そして、その id を送信元オブジェクトの環境設定で
使い、送信元とその id をもつ送信先が接続されていることを示します。

ですから、例えば、以下の YAML のコード片を例にとると:

     formatters:
       brief:
         # configuration for formatter with id 'brief' goes here
       precise:
         # configuration for formatter with id 'precise' goes here
     handlers:
       h1: #This is an id
        # configuration of handler with id 'h1' goes here
        formatter: brief
       h2: #This is another id
        # configuration of handler with id 'h2' goes here
        formatter: precise
     loggers:
       foo.bar.baz:
         # other configuration for logger 'foo.bar.baz'
         handlers: [h1, h2]

(注釈: YAML がここで使われているのは、辞書の等価な Python 形式よりもこち
らのほうが少し読みやすいからです。)

ロガーの id は、プログラム上でロガーへの参照を得るために使われるロガー名
で、たとえば ‘foo.bar.baz’ です。フォーマッタとフィルタの id は、(上の
‘brief’, ‘precise’ のような) 任意の文字列値にできます。これらは一時的な
もので、環境設定辞書の処理にのみ意味があり、オブジェクト間の接続を決定す
るのに使われます。また、これらは設定の呼び出しが完了したとき、どこにも残
りません。

上記のコード片は、‘foo.bar.baz’ という名のロガーに、ハンドラ id ‘h1’ と
‘h2’ で表される 2 つのハンドラを接続することを示します。‘h1’ のフォーマ
ッタは id ‘brief’ で記述されるもので、‘h2’ のフォーマッタは id ‘precise’
で記述されるものです。


File: python.info,  Node: ユーザ定義オブジェクト,  Next: ハンドラの設定順序,  Prev: オブジェクトの接続,  Up: 環境設定辞書スキーマ

5.16.5.7 ユーザ定義オブジェクト
...............................

このスキーマは、ハンドラ、フィルタ、フォーマッタのための、ユーザ定義オブ
ジェクトをサポートします。(ロガーは、異なるインスタンスに対して異なる型
を持つ必要はないので、この環境設定スキーマは、ユーザ定義ロガークラスをサ
ポートしていません。)

設定されるオブジェクトは、それらの設定を詳述する辞書によって記述されます
。場所によっては、あるオブジェクトがどのようにインスタンス化されるかとい
うコンテキストを、ロギングシステムが推測できます。しかし、ユーザ定義オブ
ジェクトがインスタンス化されるとき、システムはどのようにこれを行うかを知
りません。ユーザ定義オブジェクトのインスタンス化を完全に柔軟なものにする
ため、ユーザは 'ファクトリ' - 設定辞書を引数として呼ばれ、インスタンス化
されたオブジェクトを返す呼び出し可能オブジェクト - を提供する必要があり
ます。これは特殊キー ‘'()'’ で利用できる、ファクトリへの絶対インポートパ
スによって合図されます。ここに具体的な例を挙げます:

     formatters:
       brief:
         format: '%(message)s'
       default:
         format: '%(asctime)s %(levelname)-8s %(name)-15s %(message)s'
         datefmt: '%Y-%m-%d %H:%M:%S'
       custom:
           (): my.package.customFormatterFactory
           bar: baz
           spam: 99.9
           answer: 42

上記の YAML コード片は 3 つのフォーマッタを定義します。 1 つ目は、id が
‘brief’ で、指定されたフォーマット文字列をもつ、標準 *note
logging.Formatter: 16b0. インスタンスです。 2 つ目は、id が ‘default’ で
、長いフォーマットを持ち、時間フォーマットも定義していて、結果はその 2 つ
のフォーマット文字列で初期化された *note logging.Formatter: 16b0. になり
ます。Python ソース形式で見ると、 ‘brief’ と ‘default’ フォーマッタは、
それぞれ設定の部分辞書:

     {
       'format' : '%(message)s'
     }

および:

     {
       'format' : '%(asctime)s %(levelname)-8s %(name)-15s %(message)s',
       'datefmt' : '%Y-%m-%d %H:%M:%S'
     }

を持ち、これらの辞書が特殊キー ‘'()'’ を持たないので、インスタンス化はコ
ンテキストから推測され、結果として標準の *note logging.Formatter: 16b0.
インスタンスが生成されます。id が ‘custom’ である、3 つ目のフォーマッタ
の設定をする部分辞書は:

     {
       '()' : 'my.package.customFormatterFactory',
       'bar' : 'baz',
       'spam' : 99.9,
       'answer' : 42
     }

で、ユーザ定義のインスタンス化が望まれることを示す特殊キー ‘'()'’ を含み
ます。この場合、指定された呼び出し可能ファクトリオブジェクトが使われます
。これが実際の呼び出し可能オブジェクトであれば、それが直接使われます - そ
うではなく、(この例でのように) 文字列を指定したなら、実際の呼び出し可能
オブジェクトは、通常のインポート機構を使って検索されます。その呼び出し可
能オブジェクトは、環境設定の部分辞書の、'残りの' 要素をキーワード引数と
して呼ばれます。上記の例では、id が ‘custom’ のフォーマッタは、以下の呼
び出しによって返されるものとみなされます:

     my.package.customFormatterFactory(bar='baz', spam=99.9, answer=42)

     警告: 上記の例で ‘bar’, ‘spam’ または ‘answer’ のようなキーワード引
     数に指定する値は、設定作業の途中で処理されることなくそのまま呼び出
     し可能オブジェクトに渡されるため、 ‘cfg://foo’ や ‘ext://bar’ のよ
     うな設定用の辞書や参照であってはいけません。

キー ‘'()'’ が特殊キーとして使われるのは、キーワードパラメータ名として不
正で、呼び出しに使われるキーワード引数と衝突し得ないからです。‘'()'’ は
また、対応する値が呼び出し可能オブジェクトであると覚えやすくします。

バージョン 3.11 で変更: ‘handlers’ と ‘loggers’ の ‘filters’ メンバーは
id に加えてフィルタのインスタンスを受け取ることができるようになりました
。

You can also specify a special key ‘'.'’ whose value is a mapping of
attribute names to values.  If found, the specified attributes will be
set on the user-defined object before it is returned.  Thus, with the
following configuration:

     {
       '()' : 'my.package.customFormatterFactory',
       'bar' : 'baz',
       'spam' : 99.9,
       'answer' : 42,
       '.' {
         'foo': 'bar',
         'baz': 'bozz'
       }
     }

戻り値のフォーマッタは属性 ‘foo’ と ‘baz’ をもち、それぞれの値は ‘'bar'’
と ‘'bozz'’ に設定されます。

     警告: 上記の例で ‘foo’ や ‘baz’ のような属性に設定する値は、フォー
     マッタの設定作業の途中で処理されることなくそのまま属性値として設定
     されるため、 ‘cfg://foo’ や ‘ext://bar’ のような設定用の辞書や参照
     であってはいけません。


File: python.info,  Node: ハンドラの設定順序,  Next: 外部オブジェクトへのアクセス,  Prev: ユーザ定義オブジェクト,  Up: 環境設定辞書スキーマ

5.16.5.8 ハンドラの設定順序
...........................

Handlers are configured in alphabetical order of their keys, and a
configured handler replaces the configuration dictionary in (a working
copy of) the ‘handlers’ dictionary in the schema.  If you use a
construct such as ‘cfg://handlers.foo’, then initially ‘handlers['foo']’
points to the configuration dictionary for the handler named ‘foo’, and
later (once that handler has been configured) it points to the
configured handler instance.  Thus, ‘cfg://handlers.foo’ could resolve
to either a dictionary or a handler instance.  In general, it is wise to
name handlers in a way such that dependent handlers are configured
'after' any handlers they depend on; that allows something like
‘cfg://handlers.foo’ to be used in configuring a handler that depends on
handler ‘foo’.  If that dependent handler were named ‘bar’, problems
would result, because the configuration of ‘bar’ would be attempted
before that of ‘foo’, and ‘foo’ would not yet have been configured.
However, if the dependent handler were named ‘foobar’, it would be
configured after ‘foo’, with the result that ‘cfg://handlers.foo’ would
resolve to configured handler ‘foo’, and not its configuration
dictionary.


File: python.info,  Node: 外部オブジェクトへのアクセス,  Next: 内部オブジェクトへのアクセス,  Prev: ハンドラの設定順序,  Up: 環境設定辞書スキーマ

5.16.5.9 外部オブジェクトへのアクセス
.....................................

環境設定が、例えば ‘sys.stderr’ のような、設定の外部のオブジェクトへの参
照を必要とすることがあります。設定辞書が Python コードで構成されていれば
話は簡単ですが、これがテキストファイル (JSON, YAML 等) を通して提供され
ていると問題となります。テキストファイルでは、‘sys.stderr’ をリテラル文
字列 ‘'sys.stderr'’ と区別する標準の方法がありません。この区別を容易にす
るため、環境設定システムは、文字列中の特定の特殊接頭辞を見つけ、それらを
特殊に扱います。例えば、リテラル文字列 ‘'ext://sys.stderr'’ が設定中の値
として与えられたら、この ‘ext://’ は剥ぎ取られ、この値の残りが普通のイン
ポート機構で処理されます。

このような接頭辞の処理は、プロトコルの処理と同じようになされます。どちら
の機構も、正規表現 ‘^(?P<prefix>[a-z]+)://(?P<suffix>.*)$’ にマッチする
接頭辞を検索し、それによって ‘prefix’ が認識されたなら、接頭辞に応じたや
り方で ‘suffix’ が処理され、その処理の結果によって文字列値が置き換えられ
ます。接頭辞が認識されなければ、その文字列値はそのまま残されます。


File: python.info,  Node: 内部オブジェクトへのアクセス,  Next: インポート解決とカスタムインポーター,  Prev: 外部オブジェクトへのアクセス,  Up: 環境設定辞書スキーマ

5.16.5.10 内部オブジェクトへのアクセス
......................................

外部オブジェクトと同様、環境設定内部のオブジェクトへのアクセスを必要とす
ることもあります。これは、その各オブジェクトを司る環境設定システムによっ
て暗黙に行われます。例えば、ロガーやハンドラの ‘level’ に対する文字列値
‘'DEBUG'’ は、自動的に値 ‘logging.DEBUG’ に変換されますし、‘handlers’,
‘filters’ および ‘formatter’ の項目は、オブジェクト id を取って、適切な
送信先オブジェクトを決定します。

しかし、ユーザ定義モジュールには、 *note logging: 8b. モジュールには分か
らないような、より一般的な機構が必要です。例えば、 *note
logging.handlers.MemoryHandler: 31bd. があって、委譲する先の別のハンドラ
である ‘target’ 引数を取るとします。システムはこのクラスをすでに知ってい
ますから、設定中で、与えられた ‘target’ は関連するターゲットハンドラのオ
ブジェクト id でさえあればよく、システムはその id からハンドラを決定しま
す。しかし、ユーザが ‘my.package.MyHandler’ を定義して、それが
‘alternate’ ハンドラを持つなら、設定システムは ‘alternate’ がハンドラを
参照していることを知りません。これを知らせるのに、一般的な解析システムで
、ユーザはこのように指定できます:

     handlers:
       file:
         # configuration of file handler goes here

       custom:
         (): my.package.MyHandler
         alternate: cfg://handlers.file

リテラル文字列 ‘'cfg://handlers.file'’ は、‘ext://’ 接頭辞が付いた文字列
と同じように分析されますが、インポート名前空間ではなく、環境設定自体が検
索されます。この機構は ‘str.format’ でできるのと同じようにドットやインデ
ックスのアクセスができます。従って、環境設定において以下のコード片が与え
られれば:

     handlers:
       email:
         class: logging.handlers.SMTPHandler
         mailhost: localhost
         fromaddr: my_app@domain.tld
         toaddrs:
           - support_team@domain.tld
           - dev_team@domain.tld
         subject: Houston, we have a problem.

in the configuration, the string ‘'cfg://handlers'’ would resolve to the
dict with key ‘handlers’, the string ‘'cfg://handlers.email’ would
resolve to the dict with key ‘email’ in the ‘handlers’ dict, and so on.
The string ‘'cfg://handlers.email.toaddrs[1]’ would resolve to
‘'dev_team@domain.tld'’ and the string
‘'cfg://handlers.email.toaddrs[0]'’ would resolve to the value
‘'support_team@domain.tld'’.  The ‘subject’ value could be accessed
using either ‘'cfg://handlers.email.subject'’ or, equivalently,
‘'cfg://handlers.email[subject]'’.  The latter form only needs to be
used if the key contains spaces or non-alphanumeric characters.  Please
note that the characters ‘[’ and ‘]’ are not allowed in the keys.  If an
index value consists only of decimal digits, access will be attempted
using the corresponding integer value, falling back to the string value
if needed.

文字列 ‘cfg://handlers.myhandler.mykey.123’ が与えられると、これは
‘config_dict['handlers']['myhandler']['mykey']['123']’ と分析されます。
文字列が ‘cfg://handlers.myhandler.mykey[123]’ と指定されたら、システム
は ‘config_dict['handlers']['myhandler']['mykey'][123]’ から値を引き出そ
うとし、失敗したら
‘config_dict['handlers']['myhandler']['mykey']['123']’ で代替します。


File: python.info,  Node: インポート解決とカスタムインポーター,  Next: Configuring QueueHandler and QueueListener,  Prev: 内部オブジェクトへのアクセス,  Up: 環境設定辞書スキーマ

5.16.5.11 インポート解決とカスタムインポーター
..............................................

インポート解決は、デフォルトではインポートを行うために *note
__import__(): ad1. 組み込み関数を使用します。これを独自のインポートメカ
ニズムに置き換えたいと思うかもしれません: もしそうなら、
‘DictConfigurator’ あるいはその上位クラスである ‘BaseConfigurator’ クラ
スの ‘importer’ 属性を置換することができます。ただし、この関数はクラスか
らディスクリプタ経由でアクセスされる点に注意する必要があります。インポー
トを行うために Python callable を使用していて、それをインスタンスレベル
ではなくクラスレベルで定義したければ、 *note staticmethod(): 453. でそれ
をラップする必要があります。例えば:

     from importlib import import_module
     from logging.config import BaseConfigurator

     BaseConfigurator.importer = staticmethod(import_module)

configurator 'インスタンス' に対してインポート callable をセットする場合
は、 *note staticmethod(): 453. でラップする必要はありません。


File: python.info,  Node: Configuring QueueHandler and QueueListener,  Prev: インポート解決とカスタムインポーター,  Up: 環境設定辞書スキーマ

5.16.5.12 Configuring QueueHandler and QueueListener
....................................................

If you want to configure a *note QueueHandler: 1b61, noting that this is
normally used in conjunction with a *note QueueListener: 242, you can
configure both together.  After the configuration, the ‘QueueListener’
instance will be available as the *note listener: 31c1. attribute of the
created handler, and that in turn will be available to you using *note
getHandlerByName(): 1b62. and passing the name you have used for the
‘QueueHandler’ in your configuration.  The dictionary schema for
configuring the pair is shown in the example YAML snippet below.

     handlers:
       qhand:
         class: logging.handlers.QueueHandler
         queue: my.module.queue_factory
         listener: my.package.CustomListener
         handlers:
           - hand_name_1
           - hand_name_2
           ...

The ‘queue’ and ‘listener’ keys are optional.

If the ‘queue’ key is present, the corresponding value can be one of the
following:

   * An object implementing the *note Queue.put_nowait: 31c2. and *note
     Queue.get: 31c3. public API. For instance, this may be an actual
     instance of *note queue.Queue: 15ac. or a subclass thereof, or a
     proxy obtained by *note
     multiprocessing.managers.SyncManager.Queue(): 31c4.

     This is of course only possible if you are constructing or
     modifying the configuration dictionary in code.

   * A string that resolves to a callable which, when called with no
     arguments, returns the queue instance to use.  That callable could
     be a *note queue.Queue: 15ac. subclass or a function which returns
     a suitable queue instance, such as ‘my.module.queue_factory()’.

   * A dict with a ‘'()'’ key which is constructed in the usual way as
     discussed in *note ユーザ定義オブジェクト: 31ae.  The result of
     this construction should be a *note queue.Queue: 15ac. instance.

If the ‘queue’ key is absent, a standard unbounded *note queue.Queue:
15ac. instance is created and used.

If the ‘listener’ key is present, the corresponding value can be one of
the following:

   * A subclass of *note logging.handlers.QueueListener: 242.  This is
     of course only possible if you are constructing or modifying the
     configuration dictionary in code.

   * A string which resolves to a class which is a subclass of
     ‘QueueListener’, such as ‘'my.package.CustomListener'’.

   * A dict with a ‘'()'’ key which is constructed in the usual way as
     discussed in *note ユーザ定義オブジェクト: 31ae.  The result of
     this construction should be a callable with the same signature as
     the ‘QueueListener’ initializer.

If the ‘listener’ key is absent, *note logging.handlers.QueueListener:
242. is used.

The values under the ‘handlers’ key are the names of other handlers in
the configuration (not shown in the above snippet) which will be passed
to the queue listener.

Any custom queue handler and listener classes will need to be defined
with the same initialization signatures as *note QueueHandler: 1b61. and
*note QueueListener: 242.

Added in version 3.12.


File: python.info,  Node: 環境設定ファイルの書式,  Prev: 環境設定辞書スキーマ,  Up: logging config --- ログ記録の環境設定

5.16.5.13 環境設定ファイルの書式
................................

*note fileConfig(): d48. が解釈できる環境設定ファイルの形式は、 *note
configparser: 26. の機能に基づいています。ファイルには、 ‘[loggers]’,
‘[handlers]’, ‘[formatters]’ といったセクションが入っていなければならず
、各セクションではファイル中で定義されている各タイプのエンティティを名前
で指定しています。こうしたエンティティの各々について、そのエンティティを
どう設定するかを示した個別のセクションがあります。すなわち、 ‘log01’ と
いう名前の ‘[loggers]’ セクションにあるロガーに対しては、対応する詳細設
定がセクション ‘[logger_log01]’ に収められています。同様に、 ‘hand01’ と
いう名前の ‘[handlers]’ セクションにあるハンドラは ‘[handler_hand01]’ と
呼ばれるセクションに設定をもつことになり、 ‘[formatters]’ セクションにあ
る ‘form01’ は ‘[formatter_form01]’ というセクションで設定が指定されてい
ます。ルートロガーの設定は ‘[logger_root]’ と呼ばれるセクションで指定さ
れていなければなりません。

     注釈: *note fileConfig(): d48. API は *note dictConfig(): 13c8. API
     よりも古く、ロギングのある種の側面についてカバーする機能に欠けてい
     ます。たとえば *note fileConfig(): d48. では数値レベルを超えたメッ
     セージを単に拾うフィルタリングを行う *note Filter: 1414. オブジェク
     トを構成出来ません。 *note Filter: 1414. のインスタンスをロギングの
     設定において持つ必要があるならば、 *note dictConfig(): 13c8. を使う
     必要があるでしょう。設定の機能における将来の拡張は *note
     dictConfig(): 13c8. に対して行われることに注意してください。ですか
     ら、そうするのが便利であるときに新しい API に乗り換えるのは良い考え
     です。

ファイルにおけるこれらのセクションの例を以下に示します。

     [loggers]
     keys=root,log02,log03,log04,log05,log06,log07

     [handlers]
     keys=hand01,hand02,hand03,hand04,hand05,hand06,hand07,hand08,hand09

     [formatters]
     keys=form01,form02,form03,form04,form05,form06,form07,form08,form09

ルートロガーでは、レベルとハンドラのリストを指定しなければなりません。ル
ートロガーのセクションの例を以下に示します。

     [logger_root]
     level=NOTSET
     handlers=hand01

‘level’ エントリは ‘DEBUG, INFO, WARNING, ERROR, CRITICAL’ または
‘NOTSET’ のいずれかの値を取ることができます。ルートロガーでのみ、
‘NOTSET’ は全てのメッセージがログとして記録されることを意味します。レベ
ルの値は ‘logging’ パッケージの名前空間のコンテキストで *note 評価:
25cd. されます。

‘handlers’ エントリはコンマで区切られたハンドラ名からなるリストで、
‘[handlers]’ セクションになくてはなりません。また、これらの各ハンドラの
名前に対応するセクションが設定ファイルに存在しなければなりません。

ルートロガー以外のロガーでは、いくつか追加の情報が必要になります。これは
以下の例のように表されます。

     [logger_parser]
     level=DEBUG
     handlers=hand01
     propagate=1
     qualname=compiler.parser

‘level’ および ‘handlers’ エントリはルートロガーのエントリと同様に解釈さ
れますが、非ルートロガーのレベルが ‘NOTSET’ に指定された場合、ロギングシ
ステムはロガー階層のより上位のロガーにロガーの実効レベルを問い合わせると
ころが違います。‘propagate’ エントリは、メッセージをロガー階層におけるこ
のロガーの上位のハンドラに伝播させることを示す 1 に設定されるか、メッセ
ージを階層の上位に伝播 'しない' ことを示す 0 に設定されます。‘qualname’
エントリはロガーのチャネル名を階層的に表したもの、すなわちアプリケーショ
ンがこのロガーを取得する際に使う名前になります。

ハンドラの環境設定を指定しているセクションは以下の例のようになります。

     [handler_hand01]
     class=StreamHandler
     level=NOTSET
     formatter=form01
     args=(sys.stdout,)

‘class’ エントリはハンドラのクラス (‘logging’ パッケージの名前空間におい
て *note eval(): 4a3. で決定されます) を示します。 ‘level’ はロガーの場
合と同じように解釈され、 ‘NOTSET’ は "すべてを記録する (log everything)"
と解釈されます。

‘formatter’ エントリはこのハンドラのフォーマッタに対するキー名を表します
。空文字列の場合、デフォルトのフォーマッタ (‘logging._defaultFormatter’)
が使われます。名前が指定されている場合、その名前は ‘[formatters]’ セクシ
ョンになくてはならず、対応するセクションが設定ファイル中になければなりま
せん。

‘args’ は、 ‘logging’ パッケージの名前空間のコンテキストで *note 評価:
25cd. される時点では、ハンドラークラスのコンストラクタのための引数のリス
トです。典型的なコンストラクタの引数が生成される方法については、各ハンド
ラのコンストラクタまたは下記の例を参照してください。指定されなければデフ
ォルトは ‘()’ になります。

オプションの ‘kwargs’ は、 ‘logging’ パッケージの名前空間のコンテキスト
で *note 評価: 25cd. される時点では、ハンドラークラスのコンストラクタの
ためのキーワード引数の辞書です。指定されなければデフォルトは ‘{}’ になり
ます。

     [handler_hand02]
     class=FileHandler
     level=DEBUG
     formatter=form02
     args=('python.log', 'w')

     [handler_hand03]
     class=handlers.SocketHandler
     level=INFO
     formatter=form03
     args=('localhost', handlers.DEFAULT_TCP_LOGGING_PORT)

     [handler_hand04]
     class=handlers.DatagramHandler
     level=WARN
     formatter=form04
     args=('localhost', handlers.DEFAULT_UDP_LOGGING_PORT)

     [handler_hand05]
     class=handlers.SysLogHandler
     level=ERROR
     formatter=form05
     args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER)

     [handler_hand06]
     class=handlers.NTEventLogHandler
     level=CRITICAL
     formatter=form06
     args=('Python Application', '', 'Application')

     [handler_hand07]
     class=handlers.SMTPHandler
     level=WARN
     formatter=form07
     args=('localhost', 'from@abc', ['user1@abc', 'user2@xyz'], 'Logger Subject')
     kwargs={'timeout': 10.0}

     [handler_hand08]
     class=handlers.MemoryHandler
     level=NOTSET
     formatter=form08
     target=
     args=(10, ERROR)

     [handler_hand09]
     class=handlers.HTTPHandler
     level=NOTSET
     formatter=form09
     args=('localhost:9022', '/log', 'GET')
     kwargs={'secure': True}

フォーマッタの環境設定を指定しているセクションは以下のような形式です。

     [formatter_form01]
     format=F1 %(asctime)s %(levelname)s %(message)s %(customfield)s
     datefmt=
     style=%
     validate=True
     defaults={'customfield': 'defaultvalue'}
     class=logging.Formatter

*note フォーマッターのセクション: 31b2. の辞書スキーマと同じキーを持つ、
フォーマッター設定の引数です。

The ‘defaults’ entry, when *note evaluated: 25cd. in the context of the
‘logging’ package's namespace, is a dictionary of default values for
custom formatting fields.  If not provided, it defaults to ‘None’.

     注釈: *note eval(): 4a3. を使用していることで、上述のようにソケット
     経由で設定を送受信するために *note listen(): 1167. を使用しているこ
     とに起因する潜在的なセキュリティリスクがあります。そのリスクは、相
     互に信頼できない多数のユーザが同じマシン上でコードを実行する場合に
     制限されています; 詳細は *note listen(): 1167. ドキュメンテーション
     を参照してください。

参考
....

*note logging: 8b. モジュール

     logging モジュールの API リファレンス。

*note logging.handlers: 8d. モジュール

     logging モジュールに含まれる、便利なハンドラです。


File: python.info,  Node: logging handlers --- ログ記録ハンドラー,  Next: platform --- 実行中プラットフォームの固有情報を参照する,  Prev: logging config --- ログ記録の環境設定,  Up: 汎用オペレーティングシステムサービス

5.16.6 ‘logging.handlers’ -- ログ記録ハンドラー
-----------------------------------------------

'ソースコード:' Lib/logging/handlers.py(1)

Important
.........

このページには、リファレンス情報だけが含まれています。チュートリアルは、
以下のページを参照してください

   * *note 基本チュートリアル: 140e.

   * *note 上級チュートリアル: 140f.

   * *note ロギングクックブック: 1410.

__________________________________________________________________

このパッケージでは、以下の便利なハンドラが提供されています。なお、これら
のハンドラのうち、3 つ (*note StreamHandler: 1411, *note FileHandler:
1c53. および *note NullHandler: 149c.) は、実際には *note logging: 8b. モ
ジュール自身で定義されていますが、他のハンドラと一緒にここでドキュメント
化します。

* Menu:

* StreamHandler::
* FileHandler::
* NullHandler::
* WatchedFileHandler::
* BaseRotatingHandler::
* RotatingFileHandler::
* TimedRotatingFileHandler::
* SocketHandler::
* DatagramHandler::
* SysLogHandler::
* NTEventLogHandler::
* SMTPHandler::
* MemoryHandler::
* HTTPHandler::
* QueueHandler::
* QueueListener::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/logging/handlers.py


File: python.info,  Node: StreamHandler,  Next: FileHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.1 StreamHandler
......................

*note logging: 8b. コアパッケージに含まれる *note StreamHandler: 1411. ク
ラスは、ログ出力を 'sys.stdout', 'sys.stderr' あるいは何らかのファイル風
(file-like) オブジェクト (あるいは、より正確に言えば ‘write()’ および
‘flush()’ メソッドをサポートする何らかのオブジェクト) といったストリーム
に送信します。

 -- クラス: logging.StreamHandler (stream=None)

     *note StreamHandler: 1411. クラスの新たなインスタンスを返します。
     'stream' が指定された場合、インスタンスはログ出力先として指定された
     ストリームを使います; そうでない場合、 'sys.stderr' が使われます。

      -- メソッド: emit (record)

          フォーマッタが指定されていれば、フォーマッタを使ってレコードを
          書式化します。 次に、レコードが *note terminator: 31cc. ととも
          にストリームに書き込まれます。 例外情報が存在する場合、 *note
          traceback.print_exception(): a4f. を使って書式化され、 ストリ
          ームの末尾につけられます。

      -- メソッド: flush ()

          ストリームの *note flush(): 31cd. メソッドを呼び出してバッファ
          をフラッシュします。 ‘close()’ メソッドは *note Handler: 16af.
          から継承しているため何も出力を行わないので、 *note flush():
          31cd. 呼び出しを明示的に行う必要があるかもしれません。

      -- メソッド: setStream (stream)

          このインスタンスの stream と指定された値が異なる場合、指定され
          た値に設定します。 新しい stream を設定する前に、古い stream は
          フラッシュされます。


          パラメータ: ‘stream’ - ハンドラがこれから使う stream 。


          戻り値: the old stream, if the stream was changed, or ‘None’
          if it wasn't.

          Added in version 3.7.

      -- の属性: terminator

          フォーマット済みのレコードをストリームに出力するときの終端とし
          て使われる文字列です。デフォルト値は ‘'\n'’ です。

          もし改行区切りにしたくない場合はハンドラーインスタンスの
          ‘terminator’ 属性に空文字列を設定してください。

          以前のバージョンでは、区切り文字は ‘'\n'’ にハードコードされて
          いました。

          Added in version 3.2.


File: python.info,  Node: FileHandler,  Next: NullHandler,  Prev: StreamHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.2 FileHandler
....................

*note logging: 8b. コアパッケージに含まれる *note FileHandler: 1c53. ク
ラスは、ログ出力をディスク上のファイルに送信します。このクラスは出力機能
を *note StreamHandler: 1411. から継承しています。

 -- クラス: logging.FileHandler (filename, mode='a', encoding=None,
          delay=False, errors=None)

     Returns a new instance of the *note FileHandler: 1c53. class.  The
     specified file is opened and used as the stream for logging.  If
     'mode' is not specified, ‘'a'’ is used.  If 'encoding' is not
     ‘None’, it is used to open the file with that encoding.  If 'delay'
     is true, then file opening is deferred until the first call to
     *note emit(): 31d0.  By default, the file grows indefinitely.  If
     'errors' is specified, it's used to determine how encoding errors
     are handled.

     バージョン 3.6 で変更: 文字列値に加え、 *note Path: 266. オブジェク
     トも 'filename' 引数が受け取るようになりました。

     バージョン 3.9 で変更: 'errors' 引数が追加されました。

      -- メソッド: close ()

          ファイルを閉じます。

      -- メソッド: emit (record)

          'record' をファイルに出力します。

          終了時、ロギングがシャットダウンされたためにファイルがクローズ
          されており、ファイルのモードが 'w' である場合、 record は出力
          されません (bpo-42378(1) を参照してください)。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=42378


File: python.info,  Node: NullHandler,  Next: WatchedFileHandler,  Prev: FileHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.3 NullHandler
....................

Added in version 3.1.

*note logging: 8b. コアパッケージに含まれる *note NullHandler: 149c. ク
ラスは、いかなる書式化も出力も行いません。これは本質的には、ライブラリ開
発者に使われる 'no-op' ハンドラです。

 -- クラス: logging.NullHandler

     *note NullHandler: 149c. クラスの新しいインスタンスを返します。

      -- メソッド: emit (record)

          このメソッドは何もしません。

      -- メソッド: handle (record)

          このメソッドは何もしません。

      -- メソッド: createLock ()

          アクセスが特殊化される必要がある I/O が下にないので、このメソ
          ッドはロックに対して ‘None’ を返します。

*note NullHandler: 149c. の使い方の詳しい情報は、 *note
ライブラリのためのロギングの設定: 31d7. を参照してください。


File: python.info,  Node: WatchedFileHandler,  Next: BaseRotatingHandler,  Prev: NullHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.4 WatchedFileHandler
...........................

The *note WatchedFileHandler: 31da. class, located in the
‘logging.handlers’ module, is a ‘FileHandler’ which watches the file it
is logging to.  If the file changes, it is closed and reopened using the
file name.

ファイルはログファイルをローテーションさせる 'newsyslog' や 'logrotate'
のようなプログラムを使うことで変更されることがあります。このハンドラは、
Unix/Linux で使われることを意図していますが、ファイルが最後にログを出力
してから変わったかどうかを監視します。 (ファイルはデバイスや inode が変
わることで変わったと判断します。) ファイルが変わったら古いファイルのスト
リームは閉じて、現在のファイルを新しいストリームを取得するために開きます
。

このハンドラを Windows で使うことは適切ではありません。というのも
Windows では開いているログファイルを移動したり削除したりできないからです
- logging はファイルを排他的ロックを掛けて開きます - そのためこうしたハ
ンドラは必要ないのです。さらに、 Windows では 'ST_INO' がサポートされて
いません; *note stat(): 26d. はこの値として常に 0 を返します。

 -- クラス: logging.handlers.WatchedFileHandler (filename, mode='a',
          encoding=None, delay=False, errors=None)

     Returns a new instance of the *note WatchedFileHandler: 31da.
     class.  The specified file is opened and used as the stream for
     logging.  If 'mode' is not specified, ‘'a'’ is used.  If 'encoding'
     is not ‘None’, it is used to open the file with that encoding.  If
     'delay' is true, then file opening is deferred until the first call
     to *note emit(): 31db.  By default, the file grows indefinitely.
     If 'errors' is provided, it determines how encoding errors are
     handled.

     バージョン 3.6 で変更: 文字列値に加え、 *note Path: 266. オブジェク
     トも 'filename' 引数が受け取るようになりました。

     バージョン 3.9 で変更: 'errors' 引数が追加されました。

      -- メソッド: reopenIfNeeded ()

          ファイルが変更されていないかチェックします。 もし変更されてい
          れば、手始めにレコードをファイルに出力し、既存のストリームはフ
          ラッシュして閉じられ、ファイルが再度開かれます。

          Added in version 3.6.

      -- メソッド: emit (record)

          レコードをファイルに出力しますが、最初に *note
          reopenIfNeeded(): eb4. を呼び出して、変更があった場合はファイ
          ルを再度開きます。


File: python.info,  Node: BaseRotatingHandler,  Next: RotatingFileHandler,  Prev: WatchedFileHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.5 BaseRotatingHandler
............................

The *note BaseRotatingHandler: 31de. class, located in the
‘logging.handlers’ module, is the base class for the rotating file
handlers, *note RotatingFileHandler: 1941. and *note
TimedRotatingFileHandler: 1163.  You should not need to instantiate this
class, but it has attributes and methods you may need to override.

 -- クラス: logging.handlers.BaseRotatingHandler (filename, mode,
          encoding=None, delay=False, errors=None)

     パラメータは ‘FileHandler’ と同じです。属性は次の通りです:

      -- の属性: namer

          この属性に callable がセットされた場合、 *note
          rotation_filename(): 31e0. メソッドはこの callable に委譲され
          ます。 callable に渡されるパラメータは *note
          rotation_filename(): 31e0. に渡されたものです。

               注釈: namer 関数はロールオーバー中にかなりの回数呼ばれま
               す。そのため、できるだけ単純で、速くあるべきです。さらに
               、それは与えられた入力に対しては常に同じ出力を返すべきで
               す。そうでなければ、ロールオーバーの振る舞いは期待通りに
               動かないかもしれません。

               namer 属性にローテーションの際に使われるファイル名に埋め
               込むための特定の属性を保持しようとする場合に注意が必要な
               ことは、注意喚起しておくべきでしょう。たとえば *note
               RotatingFileHandler: 1941. は、ローテーションが期待通りに
               動作するために、名前に連続した番号を含むようなファイル名
               のリストを持つことを期待します。また *note
               TimedRotatingFileHandler: 1163. は (ハンドラの初期化時に
               渡された ‘backupCount’ にもとづいて) 削除すべき古いファイ
               ルを決定しながら、古いログファイルを削除します。この仕組
               みが動作するためには、ファイル名は名前に含まれる日付や時
               刻でソート可能である必要があり、 namer はそれを尊重しなけ
               ればなりません (namer がこの規則を尊重したくない場合、そ
               のような namer は *note getFilesToDelete(): 31e1. メソッ
               ドが特定の命名規則に適合するようにオーバーライドされた
               *note TimedRotatingFileHandler: 1163. の派生クラス内で使
               う必要があるでしょう)。

          Added in version 3.3.

      -- の属性: rotator

          この属性に callable がセットされた場合、 *note rotate(): 31e3.
          メソッドはこの callable に委譲されます。 callable に渡されるパ
          ラメータは *note rotate(): 31e3. に渡されたものです。

          Added in version 3.3.

      -- メソッド: rotation_filename (default_name)

          ローテートを行う際にログファイルのファイル名を変更します。

          このメソッドは、ファイル名をカスタマイズするために提供されます
          。

          デフォルト実装は、ハンドラの 'namer' 属性が callable だった場
          合、その callable を呼んでデフォルト名を渡します。属性が
          callable でない場合 (デフォルトは ‘None’ です)、名前は変更せず
          に返されます。


          パラメータ: ‘default_name’ - ログファイルのデフォルトのファイ
          ル名。

          Added in version 3.3.

      -- メソッド: rotate (source, dest)

          ローテートが行われる時、現在のログをローテートします。

          デフォルト実装は、 ハンドラの 'rotator' 属性が callable だった
          場合、その callable を呼んで source と dest 引数を渡します。属
          性が callable でない場合 (デフォルトは ‘None’ です)、単に
          source が destination に改名されます。


          パラメータ:

             * ‘source’ - ソースファイル名。これは通常ベースファイル名 、
               例えば 'test.log' となります。

             * ‘dest’ - 変更先ファイル名。これは通常ソースファイルをロー
               テートしたもの (例えば 'test.log.1') です。

          Added in version 3.3.

これらの属性が存在する理由は、サブクラス化を省略できるようにするためです
。 *note RotatingFileHandler: 1941. と *note TimedRotatingFileHandler:
1163. のインスタンスに対して同じ callable が使えます。もし namer や
rotator callable が例外を上げれば、 ‘emit()’ 呼び出しで発生した他の例外
と同じ方法で、つまりハンドラの ‘handleError()’ メソッドによって扱われま
す。

ローテート処理に大幅な変更を加える必要があれば、メソッドをオーバーライド
することができます。

例えば、 *note rotator と namer
を使ってログローテートをカスタマイズする: 31e4. を参照してください。


File: python.info,  Node: RotatingFileHandler,  Next: TimedRotatingFileHandler,  Prev: BaseRotatingHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.6 RotatingFileHandler
............................

The *note RotatingFileHandler: 1941. class, located in the
‘logging.handlers’ module, supports rotation of disk log files.

 -- クラス: logging.handlers.RotatingFileHandler (filename, mode='a',
          maxBytes=0, backupCount=0, encoding=None, delay=False,
          errors=None)

     *note RotatingFileHandler: 1941. クラスの新たなインスタンスを返しま
     す。 指定されたファイルが開かれ、ログ記録のためのストリームとして使
     われます。 'mode' が指定されなかった場合、 ‘'a'’ が使われます。
     'encoding' が ‘None’ でない場合、その値はファイルを開くときのエンコ
     ーディングとして使われます。 'delay' が真ならば、ファイルを開くのは
     最初の *note emit(): 31e7. 呼び出しまで遅らせられます。 デフォルト
     では、ファイルは無制限に大きくなりつづけます。 'errors' が提供され
     ると、エンコーディングエラーの処理方法を決定します。

     'maxBytes' および 'backupCount' 値を指定することで、あらかじめ決め
     られたサイズでファイルをロールオーバ ('rollover') させることができ
     ます。 指定サイズを超えそうになると、ファイルは閉じられ、暗黙のうち
     に新たなファイルが開かれます。 ロールオーバは現在のログファイルの長
     さが 'maxBytes' に近くなると常に起きますが、 'maxBytes' または
     'backupCount' がゼロならロールオーバは起きなくなってしまうので、一
     般的には 'backupCount' を少なくとも 1 に設定し 'maxBytes' を非ゼロ
     にするのが良いでしょう。 'backupCount' が非ゼロのとき、システムは古
     いログファイルをファイル名に ".1", ".2" といった拡張子を追加して保
     存します。 例えば、 'backupCount' が 5 で、基本のファイル名が
     ‘app.log’ なら、 ‘app.log’, ‘app.log.1’, ‘app.log.2’ ...  と続き、
     ‘app.log.5’ までを得ることになります。 ログの書き込み対象になるファ
     イルは常に ‘app.log’ です。このファイルが満杯になると、ファイルは閉
     じられ、 ‘app.log.1’ に名前が変更されます。 ‘app.log.1’,
     ‘app.log.2’ などが存在する場合、それらのファイルはそれぞれ
     ‘app.log.2’, ‘app.log.3’ といった具合に名前が変更されます。

     バージョン 3.6 で変更: 文字列値に加え、 *note Path: 266. オブジェク
     トも 'filename' 引数が受け取るようになりました。

     バージョン 3.9 で変更: 'errors' 引数が追加されました。

      -- メソッド: doRollover ()

          上述のような方法でロールオーバを行います。

      -- メソッド: emit (record)

          上述のようなロールオーバを行いながら、レコードをファイルに出力
          します。

      -- メソッド: shouldRollover (record)

          See if the supplied record would cause the file to exceed the
          configured size limit.


File: python.info,  Node: TimedRotatingFileHandler,  Next: SocketHandler,  Prev: RotatingFileHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.7 TimedRotatingFileHandler
.................................

The *note TimedRotatingFileHandler: 1163. class, located in the
‘logging.handlers’ module, supports rotation of disk log files at
certain timed intervals.

 -- クラス: logging.handlers.TimedRotatingFileHandler (filename,
          when='h', interval=1, backupCount=0, encoding=None,
          delay=False, utc=False, atTime=None, errors=None)

     *note TimedRotatingFileHandler: 1163. クラスの新たなインスタンスを
     返します。 'filename' に指定したファイルを開き、ログ出力先のストリ
     ームとして使います。ログファイルのローテーション時には、ファイル名
     に拡張子 (suffix) をつけます。ログファイルのローテーションは 'when'
     および 'interval' の積に基づいて行います。

     'when' は 'interval' の単位を指定するために使います。使える値は下表
     の通りです。大小文字の区別は行いません。

     値                   'interval' の単位                'atTime' の使用有無/使用方
                                                           法
                                                           
     ------------------------------------------------------------------------------------
                                                           
     ‘'S'’                秒                               無視
                                                           
                                                           
     ‘'M'’                分                               無視
                                                           
                                                           
     ‘'H'’                時間                             無視
                                                           
                                                           
     ‘'D'’                日                               無視
                                                           
                                                           
     ‘'W0'-'W6'’          曜日 (0=月曜)                    初期のロールオーバー時刻の
                                                           算出に使用
                                                           
                                                           
     ‘'midnight'’         'atTime' が指定されなかった場    初期のロールオーバー時刻の
                          合は深夜に、そうでない場合は     算出に使用
                          'atTime' の時刻にロールオーバ    
                          ーされます
                          

     曜日ベースのローテーションを使う場合は、月曜として 'W0' を、火曜と
     して 'W1' を、…、日曜として 'W6' を指定します。このケースの場合は、
     'interval' は使われません。

     古いログファイルの保存時、ロギングシステムによりファイル名に拡張子
     が付けられます。 ロールオーバ間隔によって、strftime の
     ‘%Y-%m-%d_%H-%M-%S’ 形式またはその前方の一部を使って、日付と時間に
     基づいた拡張子が付けられます。

     最初に次のロールオーバー時間を計算するとき (ハンドラが生成されると
     き)、次のローテーションがいつ起こるかを計算するために、既存のログフ
     ァイルの最終変更時刻または現在の時間が使用されます。

     'utc' 引数が true の場合時刻は UTC になり、それ以外では現地時間が使
     われます。

     'backupCount' がゼロでない場合、保存されるファイル数は高々
     'backupCount' 個で、それ以上のファイルがロールオーバされる時に作ら
     れるならば、一番古いものが削除されます。削除のロジックは interval で
     決まるファイルを削除するので、 interval を変えると古いファイルが残
     ったままになることもあります。

     'delay' が true なら、ファイルを開くのは *note emit(): 31ec. の最初
     の呼び出しまで延期されます。

     'atTime' が ‘None’ でない場合、それは ‘datetime.time’ インスタンス
     でなければなりません。ロールオーバーが「夜中」「特定の曜日」に設定
     されていて、ロールが発生する時刻を指定します。 'atTime' の値は '初
     期' のロールオーバーの計算に使われますが、後続のロールオーバーは通
     常の間隔の計算で算出されます。

     'errors' が指定されると、エンコーディングエラーの取り扱い方法を決定
     します。

          注釈: 最初のロールオーバーの計算はハンドラーが初期化されたとき
          に行われます。後続のロールオーバーは、ロールオーバーが発生し、
          ロールオーバーが出力した時にのみ行われます。これを念頭に置いて
          おかないと混乱する可能性があります。例えば、インターバルが '毎
          分' に設定されていて、1分ごとにログファイルが常に生成されると
          は限りません。アプリケーションが実行されている間、1分に1回以上
          のログ出力されて 'いるとすると' 毎分、分割されたログファイルが
          出力されますが、そうでなく、5分ごとに出力される場合は、出力さ
          れずにロールオーバーが実行されなかった時間分のギャップが生じま
          す。

     バージョン 3.4 で変更: 'atTime' パラメータが追加されました。

     バージョン 3.6 で変更: 文字列値に加え、 *note Path: 266. オブジェク
     トも 'filename' 引数が受け取るようになりました。

     バージョン 3.9 で変更: 'errors' 引数が追加されました。

      -- メソッド: doRollover ()

          上述のような方法でロールオーバを行います。

      -- メソッド: emit (record)

          上で説明した方法でロールオーバを行いながら、レコードをファイル
          に出力します。

      -- メソッド: getFilesToDelete ()

          ロールオーバーの一環として削除されるファイル名のリストを返しま
          す。それらのファイルは、ハンドラによって書き込まれた最も古いバ
          ックアップログファイルの絶対パスです。

      -- メソッド: shouldRollover (record)

          See if enough time has passed for a rollover to occur and if
          it has, compute the next rollover time.


File: python.info,  Node: SocketHandler,  Next: DatagramHandler,  Prev: TimedRotatingFileHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.8 SocketHandler
......................

The *note SocketHandler: 1164. class, located in the ‘logging.handlers’
module, sends logging output to a network socket.  The base class uses a
TCP socket.

 -- クラス: logging.handlers.SocketHandler (host, port)

     アドレスが 'host' および 'port' で与えられた遠隔のマシンと通信する
     ようにした *note SocketHandler: 1164. クラスのインスタンスを生成し
     て返します。

     バージョン 3.4 で変更: ‘port’ に ‘None’ を指定すると、Unix ドメイン
     ソケットが ‘host’ 値を用いて作られます - そうでない場合は TCP ソケ
     ットが作られます。

      -- メソッド: close ()

          ソケットを閉じます。

      -- メソッド: emit ()

          レコードの属性辞書を pickle して、バイナリ形式でソケットに書き
          込みます。ソケット操作でエラーが生じた場合、暗黙のうちにパケッ
          トは捨てられます。事前に接続が失われていた場合、接続を再度確立
          します。受信端でレコードを unpickle して *note LogRecord:
          11e8. にするには、 *note makeLogRecord(): 318a. 関数を使ってく
          ださい。

      -- メソッド: handleError ()

          *note emit(): 31f2. の処理中に発生したエラーを処理します。よく
          ある原因は接続の消失です。次のイベント発生時に再試行できるよう
          にソケットを閉じます。

      -- メソッド: makeSocket ()

          サブクラスで必要なソケット形式を詳細に定義できるようにするため
          のファクトリメソッドです。デフォルトの実装では、 TCP ソケット
          (*note socket.SOCK_STREAM: 150b.) を生成します。

      -- メソッド: makePickle (record)

          レコードの属性辞書をバイナリ形式に pickle したものの先頭に長さ
          情報を付け、ソケットを介して送信できるようにして返します。 こ
          の操作の詳細は次のコードと同等です:

               data = pickle.dumps(record_attr_dict, 1)
               datalen = struct.pack('>L', len(data))
               return datalen + data

          pickle が完全に安全というわけではないことに注意してください。
          セキュリティに関して心配なら、より安全なメカニズムを実装するた
          めにこのメソッドをオーバーライドすると良いでしょう。例えば、
          HMAC を使って pickle に署名して、受け取る側ではそれを検証する
          ことができます。あるいはまた、受け取る側でグローバルなオブジェ
          クトの unpickle を無効にすることができます。

      -- メソッド: send (packet)

          pickle したバイト文字列 'packet' をソケットに送信します。 送信
          するバイト文字列のフォーマットは、 *note makePickle(): 31f5. の
          ドキュメントで解説されています。

          この関数はネットワークがビジーの時に発生する部分的送信に対応し
          ています。

      -- メソッド: createSocket ()

          ソケットの生成を試みます。失敗時には、指数的な減速アルゴリズム
          を使います。最初の失敗時には、ハンドラは送ろうとしていたメッセ
          ージを落とします。続くメッセージが同じインスタンスで扱われたと
          き、幾らかの時間が経過するまで接続を試みません。デフォルトのパ
          ラメタは、最初の遅延時間が 1 秒で、その遅延時間の後でそれでも
          接続が確保できないなら、遅延時間は 2 倍づつになり、最大で 30 秒
          になります。

          この働きは、以下のハンドラ属性で制御されます:

             * ‘retryStart’ (最初の遅延時間、デフォルトは 1.0 秒)。

             * ‘retryFactor’ (乗数、デフォルトは 2.0)。

             * ‘retryMax’ (最大遅延時間、デフォルトは 30.0 秒)。

          つまり、ハンドラが使われた '後に' リモートリスナが起動した場合
          、メッセージが失われてしまうことがあります (ハンドラは、遅延時
          間が経過するまで接続を試みようとさえせず、その遅延時間中に通知
          なくメッセージを捨てるので)。


File: python.info,  Node: DatagramHandler,  Next: SysLogHandler,  Prev: SocketHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.9 DatagramHandler
........................

The *note DatagramHandler: 1165. class, located in the
‘logging.handlers’ module, inherits from *note SocketHandler: 1164. to
support sending logging messages over UDP sockets.

 -- クラス: logging.handlers.DatagramHandler (host, port)

     アドレスが 'host' および 'port' で与えられた遠隔のマシンと通信する
     ようにした *note DatagramHandler: 1165. クラスのインスタンスを生成
     して返します。

          注釈: UDP はストリーミングプロトコルではないため、このハンドラ
          のインスタンスと 'host' に指定したホストとの間に持続的なコネク
          ションはありません。この理由から、ネットワークソケットを使う場
          合、イベントがログされるごとに DNS のルックアップを行わなけれ
          ばならないかもしれず、それによりシステムにある程度の待ち時間を
          もたらす可能性があります。この待ち時間が問題になる場合、自身で
          ルックアップを行い、ホスト名の代わりにルックアップの結果得られ
          た IP アドレスを使ってハンドラを初期化することができます。

     バージョン 3.4 で変更: ‘port’ に ‘None’ を指定すると、Unix ドメイン
     ソケットが ‘host’ 値を用いて作られます - そうでない場合は UDP ソケ
     ットが作られます。

      -- メソッド: emit ()

          レコードの属性辞書を pickle して、バイナリ形式でソケットに書き
          込みます。ソケット操作でエラーが生じた場合、暗黙のうちにパケッ
          トは捨てられます。事前に接続が失われていた場合、接続を再度確立
          します。受信端でレコードを unpickle して *note LogRecord:
          11e8. にするには、 *note makeLogRecord(): 318a. 関数を使ってく
          ださい。

      -- メソッド: makeSocket ()

          ここで *note SocketHandler: 1164. のファクトリメソッドをオーバ
          ライドして、 UDP ソケット (*note socket.SOCK_DGRAM: 150a.) を
          生成しています。

      -- メソッド: send (s)

          pickle したバイト文字列をソケットに送信します。 送信するバイト
          文字列のフォーマットは、 *note SocketHandler.makePickle():
          31f5. のドキュメントで解説されています。


File: python.info,  Node: SysLogHandler,  Next: NTEventLogHandler,  Prev: DatagramHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.10 SysLogHandler
.......................

The *note SysLogHandler: 86c. class, located in the ‘logging.handlers’
module, supports sending logging messages to a remote or local Unix
syslog.

 -- クラス: logging.handlers.SysLogHandler (address=('localhost',
          SYSLOG_UDP_PORT), facility=LOG_USER,
          socktype=socket.SOCK_DGRAM, timeout=None)

     Returns a new instance of the *note SysLogHandler: 86c. class
     intended to communicate with a remote Unix machine whose address is
     given by 'address' in the form of a ‘(host, port)’ tuple.  If
     'address' is not specified, ‘('localhost', 514)’ is used.  The
     address is used to open a socket.  An alternative to providing a
     ‘(host, port)’ tuple is providing an address as a string, for
     example '/dev/log'.  In this case, a Unix domain socket is used to
     send the message to the syslog.  If 'facility' is not specified,
     ‘LOG_USER’ is used.  The type of socket opened depends on the
     'socktype' argument, which defaults to *note socket.SOCK_DGRAM:
     150a. and thus opens a UDP socket.  To open a TCP socket (for use
     with the newer syslog daemons such as rsyslog), specify a value of
     *note socket.SOCK_STREAM: 150b.  If 'timeout' is specified, it sets
     a timeout (in seconds) for the socket operations.  This can help
     prevent the program from hanging indefinitely if the syslog server
     is unreachable.  By default, 'timeout' is ‘None’, meaning no
     timeout is applied.

     使用中のサーバが UDP ポート 514 を待機していない場合、 *note
     SysLogHandler: 86c. が正常に動作していないように見える場合がありま
     す。その場合、ドメインソケットに使うべきアドレスを調べてください。
     そのアドレスはシステムによって異なります。例えば、Linux システムで
     は通常 '/dev/log' ですが、 OS X では '/var/run/syslog' です。プラッ
     トフォームを確認し、適切なアドレスを使う必要があります (アプリケー
     ションを複数のプラットフォーム上で動作させる必要がある場合、実行時
     に確認する必要があるかもしれません)。Windows では、多くの場合、UDP
     オプションを使用する必要があります。

          注釈: macOS 12.x (Monterey) でApple社はsyslogデーモンの振る舞
          いを変更し、デーモンはドメインソケットを待ち受けなくなりました
          。したがってこのシステム上では *note SysLogHandler: 86c. が動
          作することは期待できません。

          より詳細な情報は gh-91070(1) を参照して下さい。

     バージョン 3.2 で変更: 'socktype' が追加されました。

     バージョン 3.14 で変更: 'timeout' が追加されました

      -- メソッド: close ()

          遠隔ホストへのソケットを閉じます。

      -- メソッド: createSocket ()

          Tries to create a socket and, if it's not a datagram socket,
          connect it to the other end.  This method is called during
          handler initialization, but it's not regarded as an error if
          the other end isn't listening at this point - the method will
          be called again when emitting an event, if there is no socket
          at that point.

          Added in version 3.11.

      -- メソッド: emit (record)

          レコードは書式化された後、 syslog サーバに送信されます。例外情
          報が存在しても、サーバには '送信されません' 。

          バージョン 3.2.1 で変更: (参照: bpo-12168(2)) 初期のバージョン
          では、 syslog デーモンに送られるメッセージは常に NUL バイトで
          終端していました。初期のバージョンの syslog デーモンが NUL 終
          端されたメッセージを期待していたからです - たとえ、それが適切
          な仕様 ( RFC 5424(3)) にはなかったとしても。 syslog デーモンの
          新しいバージョンは NUL バイトを期待せず、代わりにもしそれがあ
          る場合は削除します。さらに、より最近のデーモン (RFC 5424 によ
          り忠実なバージョン) は、メッセージの一部として NUL バイトを通
          します。

          このような異なるデーモンの振る舞いすべてに対して syslog メッセ
          ージの取り扱いをより容易にするため、 NUL バイトの追加はクラス
          レベル属性 ‘append_nul’ を使用して設定できるようになりました。
          これはデフォルトで ‘True’ (既存の振る舞いを保持) ですが、
          ‘SysLogHandler’ インスタンスが NUL 終端文字を追加 'しない' よ
          うに ‘False’ にセットすることができます。

          バージョン 3.3 で変更: (参照: bpo-12419(4)) 以前のバージョンで
          は、メッセージソースを識別するための "ident" あるいは "tag" プ
          リフィックス機能はありませんでした。これは、今ではクラスレベル
          属性を使用して指定することができるようになりました。デフォルト
          では既存の振る舞いを保持するために ‘""’ ですが、特定の
          ‘SysLogHandler’ インスタンスが扱うすべてのメッセージに識別子を
          前置するようにそれをオーバーライドすることができます。識別子は
          バイトではなくテキストでなければならず、正確にそのままメッセー
          ジに前置されることに注意してください。

      -- メソッド: encodePriority (facility, priority)

          ファシリティおよび優先度を整数に符号化します。値は文字列でも整
          数でも渡すことができます。文字列が渡された場合、内部の対応付け
          辞書が使われ、整数に変換されます。

          シンボリックな ‘LOG_’ 値は *note SysLogHandler: 86c. で定義さ
          れています。これは ‘sys/syslog.h’ ヘッダーファイルで定義された
          値を反映しています。

          '優先度'

          名前 (文字列)                  シンボル値
                                         
          ---------------------------------------------------
                                         
          ‘alert’                        LOG_ALERT
                                         
                                         
          ‘crit’ or ‘critical’           LOG_CRIT
                                         
                                         
          ‘debug’                        LOG_DEBUG
                                         
                                         
          ‘emerg’ or ‘panic’             LOG_EMERG
                                         
                                         
          ‘err’ or ‘error’               LOG_ERR
                                         
                                         
          ‘info’                         LOG_INFO
                                         
                                         
          ‘notice’                       LOG_NOTICE
                                         
                                         
          ‘warn’ or ‘warning’            LOG_WARNING
                                         

          'ファシリティ'

          名前 (文字列)       シンボル値
                              
          ----------------------------------------
                              
          ‘auth’              LOG_AUTH
                              
                              
          ‘authpriv’          LOG_AUTHPRIV
                              
                              
          ‘cron’              LOG_CRON
                              
                              
          ‘daemon’            LOG_DAEMON
                              
                              
          ‘ftp’               LOG_FTP
                              
                              
          ‘kern’              LOG_KERN
                              
                              
          ‘lpr’               LOG_LPR
                              
                              
          ‘mail’              LOG_MAIL
                              
                              
          ‘news’              LOG_NEWS
                              
                              
          ‘syslog’            LOG_SYSLOG
                              
                              
          ‘user’              LOG_USER
                              
                              
          ‘uucp’              LOG_UUCP
                              
                              
          ‘local0’            LOG_LOCAL0
                              
                              
          ‘local1’            LOG_LOCAL1
                              
                              
          ‘local2’            LOG_LOCAL2
                              
                              
          ‘local3’            LOG_LOCAL3
                              
                              
          ‘local4’            LOG_LOCAL4
                              
                              
          ‘local5’            LOG_LOCAL5
                              
                              
          ‘local6’            LOG_LOCAL6
                              
                              
          ‘local7’            LOG_LOCAL7
                              

      -- メソッド: mapPriority (levelname)

          ログレベル名を syslog 優先度名に対応付けます。カスタムレベルを
          使用している場合や、デフォルトアルゴリズムがニーズに適していな
          い場合には、このメソッドをオーバーライドする必要があるかもしれ
          ません。デフォルトアルゴリズムは、 ‘DEBUG’, ‘INFO’, ‘WARNING’,
          ‘ERROR’, ‘CRITICAL’ を等価な syslog 名に、他のすべてのレベル名
          を "warning" に対応付けます。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/91070

   (2) https://bugs.python.org/issue?@action=redirect&bpo=12168

   (3) https://datatracker.ietf.org/doc/html/rfc5424.html

   (4) https://bugs.python.org/issue?@action=redirect&bpo=12419


File: python.info,  Node: NTEventLogHandler,  Next: SMTPHandler,  Prev: SysLogHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.11 NTEventLogHandler
...........................

The *note NTEventLogHandler: 3204. class, located in the
‘logging.handlers’ module, supports sending logging messages to a local
Windows NT, Windows 2000 or Windows XP event log.  Before you can use
it, you need Mark Hammond's Win32 extensions for Python installed.

 -- クラス: logging.handlers.NTEventLogHandler (appname, dllname=None,
          logtype='Application')

     *note NTEventLogHandler: 3204. クラスの新たなインスタンスを返します
     。 'appname' はイベントログに表示する際のアプリケーション名を定義す
     るために使われます。この名前を使って適切なレジストリエントリが生成
     されます。 'dllname' はログに保存するメッセージ定義の入った .dll ま
     たは .exe ファイルへの完全修飾パス名を与えなければなりません (指定
     されない場合、 ‘'win32service.pyd'’ が使われます - このライブラリは
     Win32 拡張とともにインストールされ、いくつかのプレースホルダとなる
     メッセージ定義を含んでいます)。これらのプレースホルダを利用すると、
     メッセージの発信源全体がログに記録されるため、イベントログは巨大に
     なるので注意してください。 'logtype' は ‘'Application'’,
     ‘'System'’, ‘'Security'’ のいずれかで、デフォルトは ‘'Application'’
     です。

      -- メソッド: close ()

          現時点では、イベントログエントリの発信源としてのアプリケーショ
          ン名をレジストリから除去することはできます。しかしこれを行うと
          、イベントログビューアで意図した通りにログが見えなくなるでしょ
          う - これはイベントログが .dll 名を取得するためにレジストリに
          アクセスできなければならないからです。現在のバージョンではこの
          操作を行いません。

      -- メソッド: emit (record)

          メッセージ ID、イベントカテゴリ、イベント型を決定し、メッセー
          ジを NT イベントログに記録します。

      -- メソッド: getEventCategory (record)

          レコードに対するイベントカテゴリを返します。自作のカテゴリを指
          定したい場合、このメソッドをオーバライドしてください。このクラ
          スのバージョンのメソッドは 0 を返します。

      -- メソッド: getEventType (record)

          レコードのイベント型を返します。自作の型を指定したい場合、この
          メソッドをオーバライドしてください。このクラスのバージョンのメ
          ソッドは、ハンドラの 'typemap' 属性を使って対応付けを行います
          。この属性は ‘__init__()’ で初期化され、 ‘DEBUG’, ‘INFO’,
          ‘WARNING’, ‘ERROR’, ‘CRITICAL’ が入っています。自作のレベルを
          使っているのなら、このメソッドをオーバライドするか、ハンドラの
          'typemap' 属性に適切な辞書を配置する必要があるでしょう。

      -- メソッド: getMessageID (record)

          レコードのメッセージ ID を返します。自作のメッセージを使ってい
          るのなら、ロガーに渡される 'msg' を書式化文字列ではなく ID に
          します。その上で、辞書参照を行ってメッセージ ID を得ます。この
          クラスのバージョンでは 1 を返します。この値は
          ‘win32service.pyd’ における基本メッセージ ID です。


File: python.info,  Node: SMTPHandler,  Next: MemoryHandler,  Prev: NTEventLogHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.12 SMTPHandler
.....................

The *note SMTPHandler: 18b2. class, located in the ‘logging.handlers’
module, supports sending logging messages to an email address via SMTP.

 -- クラス: logging.handlers.SMTPHandler (mailhost, fromaddr, toaddrs,
          subject, credentials=None, secure=None, timeout=1.0)

     新たな *note SMTPHandler: 18b2. クラスのインスタンスを返します。イ
     ンスタンスは email の from および to アドレス行、および subject 行
     とともに初期化されます。 'toaddrs' は文字列からなるリストでなければ
     なりません。非標準の SMTP ポートを指定するには、 'mailhost' 引数に
     (host, port) のタプル形式を指定します。文字列を使った場合、標準の
     SMTP ポートが使われます。もし SMTP サーバが認証を必要とするならば、
     (username, password) のタプル形式を 'credentials' 引数に指定するこ
     とができます。

     セキュアプロトコル (TLS) の使用を指定するには 'secure' 引数にタプル
     を渡してください。これは認証情報が渡された場合のみ使用されます。タ
     プルは、空のタプルか、キーファイルの名前を持つ1要素のタプルか、また
     はキーファイルと証明書ファイルの名前を持つ2要素のタプルのいずれかで
     なければなりません。 (このタプルは *note smtplib.SMTP.starttls():
     1350. メソッドに渡されます。)

     SMTP サーバとのコミュニケーションのために、 'timeout' 引数を使用し
     てタイムアウトを指定することができます。

     バージョン 3.3 で変更: 'timeout' 引数が追加されました。

      -- メソッド: emit (record)

          レコードを書式化し、指定されたアドレスに送信します。

      -- メソッド: getSubject (record)

          レコードに応じたサブジェクト行を指定したいなら、このメソッドを
          オーバライドしてください。


File: python.info,  Node: MemoryHandler,  Next: HTTPHandler,  Prev: SMTPHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.13 MemoryHandler
.......................

The *note MemoryHandler: 31bd. class, located in the ‘logging.handlers’
module, supports buffering of logging records in memory, periodically
flushing them to a 'target' handler.  Flushing occurs whenever the
buffer is full, or when an event of a certain severity or greater is
seen.

*note MemoryHandler: 31bd. はより一般的な抽象クラス、 *note
BufferingHandler: 3210. のサブクラスです。この抽象クラスでは、ログ記録す
るレコードをメモリ上にバッファリングします。各レコードがバッファに追加さ
れる毎に、 ‘shouldFlush()’ を呼び出してバッファをフラッシュすべきかどう
か調べます。フラッシュする必要がある場合、 ‘flush()’ がフラッシュ処理を
行うものと想定されます。

 -- クラス: logging.handlers.BufferingHandler (capacity)

     容量つきのバッファーを設定してハンドラーが初期化されます。
     'capacity' はバッファ可能なログレコード数を意味します。

      -- メソッド: emit (record)

          レコードをバッファに追加します。 *note shouldFlush(): 3212. が
          true を返す場合、バッファを処理するために *note flush(): 3213.
          を呼び出します。

      -- メソッド: flush ()

          For a *note BufferingHandler: 3210. instance, flushing means
          that it sets the buffer to an empty list.  This method can be
          overwritten to implement more useful flushing behavior.

      -- メソッド: shouldFlush (record)

          バッファが許容量に達している場合に ‘True’ を返します。このメソ
          ッドは自作のフラッシュ処理方針を実装するためにオーバライドする
          ことができます。

 -- クラス: logging.handlers.MemoryHandler (capacity, flushLevel=ERROR,
          target=None, flushOnClose=True)

     *note MemoryHandler: 31bd. クラスの新たなインスタンスを返します。 イ
     ンスタンスはサイズ 'capacity' （バッファされるレコード数）のバッフ
     ァとともに初期化されます。 'flushLevel' が指定されていない場合、
     ‘ERROR’ が使われます。 'target' が指定されていない場合、ハンドラが
     何らかの意味のある処理を行う前に *note setTarget(): 3214. でターゲ
     ットを指定する必要があります。 'flushOnClose' が ‘False’ に指定され
     ていた場合、ハンドラが閉じられるときにバッファはフラッシュ 'されま
     せん' 。 'flushOnClose' が指定されていないか ‘True’ に指定されてい
     た場合、ハンドラが閉じられるときのバッファのフラッシュは以前の挙動
     になります。

     バージョン 3.6 で変更: 'flushOnClose' パラメータが追加されました。

      -- メソッド: close ()

          *note flush(): 3216. を呼び出し、ターゲットを ‘None’ に設定し
          てバッファを消去します。

      -- メソッド: flush ()

          For a *note MemoryHandler: 31bd. instance, flushing means just
          sending the buffered records to the target, if there is one.
          The buffer is also cleared when buffered records are sent to
          the target.  Override if you want different behavior.

      -- メソッド: setTarget (target)

          ターゲットハンドラをこのハンドラに設定します。

      -- メソッド: shouldFlush (record)

          バッファが一杯になっているか、 'flushLevel' またはそれ以上のレ
          コードでないかを調べます。


File: python.info,  Node: HTTPHandler,  Next: QueueHandler,  Prev: MemoryHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.14 HTTPHandler
.....................

The *note HTTPHandler: 102c. class, located in the ‘logging.handlers’
module, supports sending logging messages to a web server, using either
‘GET’ or ‘POST’ semantics.

 -- クラス: logging.handlers.HTTPHandler (host, url, method='GET',
          secure=False, credentials=None, context=None)

     *note HTTPHandler: 102c. クラスの新たなインスタンスを返します。特別
     なポートを使う必要がある場合、'host' は ‘host:port’ の形式で使うこ
     とができます。 'method' が指定されない場合、 ‘GET’ が使われます。
     'secure' が真の場合、HTTPS 接続が使われます。 HTTPS 接続で使用する
     SSL 設定のために 'context' 引数を *note ssl.SSLContext: 357. のイン
     スタンスに設定することができます。 'credentials' を指定する場合、
     BASIC 認証の際の HTTP 'Authorization' ヘッダに使われるユーザIDとパ
     スワードからなる 2要素タプルを渡してください。 credentials を指定す
     る場合、ユーザIDとパスワードが通信中に平文として剥き出しにならない
     よう、secure=True も指定すべきです。

     バージョン 3.5 で変更: 'context' パラメータが追加されました。

      -- メソッド: mapLogRecord (record)

          URL エンコードされて Web サーバに送信することになる、 ‘record’
          に基づく辞書を供給します。デフォルトの実装では単に
          ‘record.__dict__’ を返します。例えば *note LogRecord: 11e8. の
          サブセットのみを Web サーバに送信する場合や、 サーバーに送信す
          る内容を特別にカスタマイズする必要がある場合には、このメソッド
          をオーバライドできます。

      -- メソッド: emit (record)

          レコードを URL エンコードされた辞書形式で Web サーバに送信しま
          す。レコードを送信のために辞書に変換するために *note
          mapLogRecord(): 321a. が呼び出されます。

          注釈: Web server に送信するためのレコードを準備することは一般
          的な書式化操作とは同じではありませんので、 *note
          setFormatter(): 316e. を使って *note Formatter: 16b0. を指定す
          ることは、 *note HTTPHandler: 102c. には効果はありません。
          *note format(): 3177. を呼び出す代わりに、このハンドラは *note
          mapLogRecord(): 321a. を呼び出し、その後その返却辞書を Web
          server に送信するのに適した様式にエンコードするために *note
          urllib.parse.urlencode(): 1095. を呼び出します。


File: python.info,  Node: QueueHandler,  Next: QueueListener,  Prev: HTTPHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.15 QueueHandler
......................

Added in version 3.2.

The *note QueueHandler: 1b61. class, located in the ‘logging.handlers’
module, supports sending logging messages to a queue, such as those
implemented in the *note queue: bb. or *note multiprocessing: 98.
modules.

*note QueueListener: 242. クラスとともに *note QueueHandler: 1b61. を使
うと、ロギングを行うスレッドから分離されたスレッド上でハンドラを動かすこ
とができます。これは、クライアントに対してサービスするスレッドができるだ
け速く応答する必要がある一方、別のスレッド上で (*note SMTPHandler: 18b2.
によって電子メールを送信するような) 潜在的に遅い操作が行われるような、ウ
ェブアプリケーションおよびその他のサービスアプリケーションにおいて重要で
す。

 -- クラス: logging.handlers.QueueHandler (queue)

     *note QueueHandler: 1b61. クラスの新しいインスタンスを返します。イ
     ンスタンスは、キューにメッセージを送るように初期化されます。キュー
     は任意のキューのようなオブジェクトが可能です; それはそのまま *note
     enqueue(): 321e. メソッドによって使用されます。そのメソッドはメッセ
     ージを送る方法を知っている必要があります。もしタスクのトラッキング
     APIにキューが必要でない場合はキューとして *note SimpleQueue: d61. の
     インスタンスが使用できます。

          注釈: *note multiprocessing: 98. を使っている場合、 *note
          SimpleQueue: d61. を使うことは避けてください。代わりに *note
          multiprocessing.Queue: 1b89. を使ってください。

          警告: The *note multiprocessing: 98. module uses an internal
          logger created and accessed via *note get_logger(): 321f.
          *note multiprocessing.Queue: 1b89. will log ‘DEBUG’ level
          messages upon items being queued.  If those log messages are
          processed by a *note QueueHandler: 1b61. using the same *note
          multiprocessing.Queue: 1b89. instance, it will cause a
          deadlock or infinite recursion.

      -- メソッド: emit (record)

          Enqueues the result of preparing the LogRecord.  Should an
          exception occur (e.g.  because a bounded queue has filled up),
          the *note handleError(): 3175. method is called to handle the
          error.  This can result in the record silently being dropped
          (if *note logging.raiseExceptions: 1412. is ‘False’) or a
          message printed to ‘sys.stderr’ (if *note
          logging.raiseExceptions: 1412. is ‘True’).

      -- メソッド: prepare (record)

          キューに追加するためレコードを準備します。このメソッドが返した
          オブジェクトがキューに追加されます。

          基底の実装はレコードがメッセージや引数と、またもし存在すれば、
          発生した例外およびスタック情報と統合されるようにフォーマットし
          ます。またこの実装では非 pickle 化不可能な要素をレコードから削
          除します。特に、この実装はレコードの ‘msg’ と ‘message’ 属性を
          (ハンドラの *note format(): 199. メソッドを呼び出すことによっ
          て得られる) 統合されたメッセージで上書きし、同時に ‘args’,
          ‘exc_info’, ‘exc_text’ の3つの属性値をすべて ‘None’ に設定しま
          す。

          レコードを dict や JSON 文字列に変換したい場合や、オリジナルの
          レコードを変更せずに修正済のコピーを送りたい場合は、このメソッ
          ドをオーバーライドすると良いでしょう。

               注釈: 基底の実装は、レコードを pickle 化可能にしつつ、さ
               らなるフォーマット処理を防ぐために、メッセージを引数でフ
               ォーマットしてフォーマットされたメッセージを ‘message’ と
               ‘msg’ 属性に設定し、同時に ‘args’ と ‘exc_text’ 属性を
               ‘None’ に設定します。このことは、 *note QueueListener:
               242. 側のハンドラが必要なフォーマット処理を行う、たとえば
               例外のフォーマット処理を行う、ための必要な情報が得られな
               いかもしれないことを意味します。そのため、 ‘QueueHandler’
               の派生クラスにおいてこのメソッドを、たとえば ‘exc_text’ 属
               性が ‘None’ に設定されないように、オーバーライドしたいと
               考えるかもしれません。この場合、 ‘message’ / ‘msg’ /
               ‘args’ といった属性の変更はレコードが pickle 化可能である
               ことを保証することと関係しており、元の ‘args’ の値が
               pickle 化可能かどうかによって、これらの属性の変更が避けら
               れないかもしれないということに注意してください (この点に
               ついては、自分のコードだけでなく依存するライブラリのコー
               ドも考慮しなければならないことにも注意してください)

      -- メソッド: enqueue (record)

          キューにレコードを ‘put_nowait()’ を使ってエンキューします; ブ
          ロッキングやタイムアウト、あるいはなにか特別なキューの実装を使
          いたければ、これをオーバライドしてみてください。

      -- の属性: listener

          When created via configuration using *note dictConfig(): 13c8,
          this attribute will contain a *note QueueListener: 242.
          instance for use with this handler.  Otherwise, it will be
          ‘None’.

          Added in version 3.12.


File: python.info,  Node: QueueListener,  Prev: QueueHandler,  Up: logging handlers --- ログ記録ハンドラー

5.16.6.16 QueueListener
.......................

Added in version 3.2.

The *note QueueListener: 242. class, located in the ‘logging.handlers’
module, supports receiving logging messages from a queue, such as those
implemented in the *note queue: bb. or *note multiprocessing: 98.
modules.  The messages are received from a queue in an internal thread
and passed, on the same thread, to one or more handlers for processing.
While *note QueueListener: 242. is not itself a handler, it is
documented here because it works hand-in-hand with *note QueueHandler:
1b61.

*note QueueHandler: 1b61. クラスとともに *note QueueListener: 242. を使
うと、ロギングを行うスレッドから分離されたスレッド上でハンドラを動かすこ
とができます。これは、クライアントに対してサービスするスレッドができるだ
け速く応答する必要がある一方、別のスレッド上で (*note SMTPHandler: 18b2.
によって電子メールを送信するような) 潜在的に遅い操作が行われるような、ウ
ェブアプリケーションおよびその他のサービスアプリケーションにおいて重要で
す。

 -- クラス: logging.handlers.QueueListener (queue, *handlers,
          respect_handler_level=False)

     *note QueueListener: 242. クラスの新しいインスタンスを返します。イ
     ンスタンスは、メッセージを送るためのキューと、キューに格納されたエ
     ントリーを処理するハンドラーのリストが設定されて初期化されます。キ
     ューは任意のキューのようなオブジェクトが可能です; それはそのまま
     *note dequeue(): 3224. メソッドによって使用されます。そのメソッドは
     メッセージを送る方法を知っている必要があります。もしタスクのトラッ
     キングAPIにキューが必要でない場合はキューとして *note SimpleQueue:
     d61. のインスタンスが使用できます（トラッキングAPIが使用可能な場合
     は使用されます）。

          注釈: *note multiprocessing: 98. を使っている場合、 *note
          SimpleQueue: d61. を使うことは避けてください。代わりに *note
          multiprocessing.Queue: 1b89. を使ってください。

     もし ‘respect_handler_level’ が ‘True’ なら、メッセージをハンドラー
     に渡すか決める時に（メッセージのレベルに比べて）ハンドラーのレベル
     が尊重されます。そうでない場合は依然のPythonバージョンと同様にすべ
     てのメッセージは常にハンドラーに渡されます。

     バージョン 3.5 で変更: The ‘respect_handler_level’ argument was
     added.

     バージョン 3.14 で変更: *note QueueListener: 242. can now be used
     as a context manager via *note with: 186.  When entering the
     context, the listener is started.  When exiting the context, the
     listener is stopped.  *note __enter__(): 26a8. returns the *note
     QueueListener: 242. object.

      -- メソッド: dequeue (block)

          キューからレコードを取り除き、それを返します。ブロッキングする
          ことがあります。

          ベース実装は ‘get()’ を使用します。タイムアウトを有効にしたい
          場合や、カスタムのキュー実装を使いたい場合は、このメソッドをオ
          ーバーライドすると良いでしょう。

      -- メソッド: prepare (record)

          レコードを扱うための準備をします。

          この実装は渡されたレコードをそのまま返します。その値をハンドラ
          に渡す前に何らかのカスタムな整列化 (marshalling) あるいはレコ
          ードに対する操作を行う必要があれば、このメソッドをオーバーライ
          ドすると良いでしょう。

      -- メソッド: handle (record)

          レコードを処理します。

          これは、ハンドラをループしてそれらに処理すべきレコードを渡しま
          す。ハンドラに渡される実際のオブジェクトは、 *note prepare():
          3225. から返されたものです。

      -- メソッド: start ()

          リスナーを開始します。

          これは、 LogRecord を処理するキューを監視するために、バックグ
          ラウンドスレッドを開始します。

          バージョン 3.14 で変更: Raises *note RuntimeError: 244. if
          called and the listener is already running.

      -- メソッド: stop ()

          リスナーを停止します。

          スレッドに終了するように依頼し、終了するまで待ちます。アプリケ
          ーションの終了前にこのメソッドを呼ばないと、いくつかのレコード
          がキューに残り、処理されなくなるかもしれないことに注意してくだ
          さい。

      -- メソッド: enqueue_sentinel ()

          リスナーに停止するように指示するためキューに番兵を書き込みます
          。この実装は ‘put_nowait()’ を使用します。タイムアウトを有効に
          したい場合や、カスタムのキュー実装を使いたい場合は、このメソッ
          ドをオーバーライドすると良いでしょう。

          Added in version 3.3.

参考
....

*note logging: 8b. モジュール

     logging モジュールの API リファレンス。

*note logging.config: 8c. モジュール

     logging モジュールの環境設定 API です。


File: python.info,  Node: platform --- 実行中プラットフォームの固有情報を参照する,  Next: errno --- 標準の errno システムシンボル,  Prev: logging handlers --- ログ記録ハンドラー,  Up: 汎用オペレーティングシステムサービス

5.16.7 ‘platform’ -- 実行中プラットフォームの固有情報を参照する
---------------------------------------------------------------

'ソースコード:' Lib/platform.py(1)

__________________________________________________________________

     注釈: プラットフォーム毎にアルファベット順に並べています。Linuxにつ
     いては Unixセクションを参照してください。

* Menu:

* Cross platform::
* Java platform::
* Windows platform::
* macOS platform::
* iOS platform::
* Unix platforms::
* Linux platforms::
* Android platform::
* コマンドラインでの使用: コマンドラインでの使用<3>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/platform.py


File: python.info,  Node: Cross platform,  Next: Java platform,  Up: platform --- 実行中プラットフォームの固有情報を参照する

5.16.7.1 Cross platform
.......................

 -- の関数: platform.architecture (executable=sys.executable, bits='',
          linkage='')

     'executable' で指定した実行可能ファイル（省略時はPythonインタープリ
     タのバイナリ）の各種アーキテクチャ情報を調べます。

     戻り値はタプル ‘(bits, linkage)’ で、アーキテクチャのビット数と実行
     可能ファイルのリンク形式を示します。どちらの値も文字列で返ります。

     値を決定できない場合はパラメータプリセットから与えられる値を返しま
     す。bits に ‘''’ を与えた場合、サポートされているポインタサイズを知
     るために ‘sizeof(pointer)’ (Python バージョン < 1.5.2 では
     ‘sizeof(long)’) が使用されます。

     この関数は、システムの ‘file’ コマンドを使用します。 ‘file’ はほと
     んどのUnixプラットフォームと一部の非Unixプラットフォームで利用可能
     ですが、 ‘file’ コマンドが利用できず、かつ 'executable' が Pythonイ
     ンタープリタでない場合には適切なデフォルト値が返ります。

          注釈: macOS (とひょっとすると他のプラットフォーム) では、実行
          可能ファイルは複数のアーキテクチャを含んだユニバーサル形式かも
          しれません。

          現在のインタープリターが "64-bit" であるかどうかを調べるには、
          *note sys.maxsize: 13dd. の方が信頼できます:

               is_64bits = sys.maxsize > 2**32

 -- の関数: platform.machine ()

     ‘'AMD64'’ のような、機種を返します。不明な場合は空文字列を返します
     。

     The output is platform-dependent and may differ in casing and
     naming conventions.

 -- の関数: platform.node ()

     コンピュータのネットワーク名を返します。ネットワーク名は完全修飾名
     とは限りません。不明な場合は空文字列を返します。

 -- の関数: platform.platform (aliased=False, terse=False)

     実行中プラットフォームを識別する文字列を返します。この文字列には、
     有益な情報をできるだけ多く付加しています。

     戻り値は機械で処理しやすい形式ではなく、'人間にとって読みやすい' 形
     式となっています。異なったプラットフォームでは異なった戻り値となる
     ようになっています。

     'aliased' が真なら、システムの名称として一般的な名称ではなく、別名
     を使用して結果を返します。たとえば、SunOS は Solaris となります。こ
     の機能は *note system_alias(): 322f. で実装されています。

     'terse' が真なら、プラットフォームを特定するために最低限必要な情報
     だけを返します。

     バージョン 3.8 で変更: macOSでは、 *note mac_ver(): 1e15. が空でな
     いリリース文字列を返すとき、darwin のバージョンではなく macOS のバ
     ージョンを取得するために、この関数は *note mac_ver(): 1e15. を使う
     ようになりました。

 -- の関数: platform.processor ()

     ‘'amdk6'’ のような、（現実の）プロセッサ名を返します。

     不明な場合は空文字列を返します。NetBSDのようにこの情報を提供しない
     、または *note machine(): 322d. と同じ値しか返さないプラットフォー
     ムも多く存在しますので、注意してください。

 -- の関数: platform.python_build ()

     Pythonのビルド番号と日付を、‘(buildno, builddate)’ のタプルで返しま
     す。

 -- の関数: platform.python_compiler ()

     Pythonをコンパイルする際に使用したコンパイラを示す文字列を返します
     。

 -- の関数: platform.python_branch ()

     Python実装のバージョン管理システム上のブランチを特定する文字列を返
     します。

 -- の関数: platform.python_implementation ()

     Python実装を指定する文字列を返します。戻り値は: 'CPython',
     'IronPython', 'Jython', 'PyPy' のいずれかです。

 -- の関数: platform.python_revision ()

     Python実装のバージョン管理システム上のリビジョンを特定する文字列を
     返します。

 -- の関数: platform.python_version ()

     Python のバージョンを、‘'major.minor.patchlevel'’ 形式の文字列で返
     します。

     ‘sys.version’ と異なり、patchlevel（デフォルトでは0)も必ず含まれて
     います。

 -- の関数: platform.python_version_tuple ()

     Pythonのバージョンを、文字列のタプル ‘(major, minor, patchlevel)’ で
     返します。

     ‘sys.version’ と異なり、patchlevel（デフォルトでは ‘'0'’)も必ず含ま
     れています。

 -- の関数: platform.release ()

     ‘'2.2.0'’ や ‘'NT'’ のような、システムのリリース情報を返します。不
     明な場合は空文字列を返します。

 -- の関数: platform.system ()

     ‘'Linux'’ 、 ‘'Darwin'’ 、 ‘'Java'’ 、 ‘'Windows'’ のような、システ
     ム/OS 名を返します。不明な場合は空文字列を返します。

     On iOS and Android, this returns the user-facing OS name (i.e,
     ‘'iOS’, ‘'iPadOS'’ or ‘'Android'’).  To obtain the kernel name
     (‘'Darwin'’ or ‘'Linux'’), use *note os.uname(): 132e.

 -- の関数: platform.system_alias (system, release, version)

     マーケティング目的で使われる一般的な別名に変換して ‘(system,
     release, version)’ を返します。混乱を避けるために、情報を並べなおす
     場合があります。

 -- の関数: platform.version ()

     ‘'#3 on degas'’ のような、システムのリリース情報を返します。不明な
     場合は空文字列を返します。

     On iOS and Android, this is the user-facing OS version.  To obtain
     the Darwin or Linux kernel version, use *note os.uname(): 132e.

 -- の関数: platform.uname ()

     極めて可搬性の高い uname インターフェースです。 *note system: 2267,
     *note node: 322e, *note release: 3238, *note version: 3239, *note
     machine: 322d, *note processor: 3230. の6つの属性を持った *note
     namedtuple(): 4e0. を返します。

     *note processor: 3230. is resolved late, on demand.

     Note: the first two attribute names differ from the names presented
     by *note os.uname(): 132e, where they are named ‘sysname’ and
     ‘nodename’.

     不明な項目は ‘''’ となります。

     バージョン 3.3 で変更: 結果が タプル から *note namedtuple(): 4e0.
     へ変更されました。

     バージョン 3.9 で変更: *note processor: 3230. is resolved late
     instead of immediately.

 -- の関数: platform.invalidate_caches ()

     Clear out the internal cache of information, such as the *note
     uname(): 1e13.  This is typically useful when the platform's *note
     node(): 322e. is changed by an external process and one needs to
     retrieve the updated value.

     Added in version 3.14.


File: python.info,  Node: Java platform,  Next: Windows platform,  Prev: Cross platform,  Up: platform --- 実行中プラットフォームの固有情報を参照する

5.16.7.2 Java platform
......................

 -- の関数: platform.java_ver (release='', vendor='', vminfo=('', '',
          ''), osinfo=('', '', ''))

     Jython用のバージョンインターフェースです。

     タプル ‘(release, vendor, vminfo, osinfo)’ を返します。'vminfo' は
     タプル ‘(vm_name, vm_release, vm_vendor)’、'osinfo' はタプル
     ‘(os_name, os_version, os_arch)’ です。不明な項目は引数で指定した値
     (デフォルトは ‘''’) となります。

     Deprecated since version 3.13, will be removed in version 3.15: It
     was largely untested, had a confusing API, and was only useful for
     Jython support.


File: python.info,  Node: Windows platform,  Next: macOS platform,  Prev: Java platform,  Up: platform --- 実行中プラットフォームの固有情報を参照する

5.16.7.3 Windows platform
.........................

 -- の関数: platform.win32_ver (release='', version='', csd='',
          ptype='')

     Get additional version information from the Windows Registry and
     return a tuple ‘(release, version, csd, ptype)’ referring to OS
     release, version number, CSD level (service pack) and OS type
     (multi/single processor).  Values which cannot be determined are
     set to the defaults given as parameters (which all default to an
     empty string).

     As a hint: 'ptype' is ‘'Uniprocessor Free'’ on single processor NT
     machines and ‘'Multiprocessor Free'’ on multi processor machines.
     The ‘'Free'’ refers to the OS version being free of debugging code.
     It could also state ‘'Checked'’ which means the OS version uses
     debugging code, i.e.  code that checks arguments, ranges, etc.

 -- の関数: platform.win32_edition ()

     Returns a string representing the current Windows edition, or
     ‘None’ if the value cannot be determined.  Possible values include
     but are not limited to ‘'Enterprise'’, ‘'IoTUAP'’,
     ‘'ServerStandard'’, and ‘'nanoserver'’.

     Added in version 3.8.

 -- の関数: platform.win32_is_iot ()

     *note win32_edition(): 323c. によって返された Windows のエディショ
     ンが IoT エディションの時 ‘True’ を返します。

     Added in version 3.8.


File: python.info,  Node: macOS platform,  Next: iOS platform,  Prev: Windows platform,  Up: platform --- 実行中プラットフォームの固有情報を参照する

5.16.7.4 macOS platform
.......................

 -- の関数: platform.mac_ver (release='', versioninfo=('', '', ''),
          machine='')

     macOS のバージョン情報を、タプル ‘(release, versioninfo, machine)’
     で返します。'versioninfo' は、タプル ‘(version, dev_stage,
     non_release_version)’ です。

     不明な項目は ‘''’ となります。タプルの要素は全て文字列です。


File: python.info,  Node: iOS platform,  Next: Unix platforms,  Prev: macOS platform,  Up: platform --- 実行中プラットフォームの固有情報を参照する

5.16.7.5 iOS platform
.....................

 -- の関数: platform.ios_ver (system='', release='', model='',
          is_simulator=False)

     iOS のバージョン情報を取得し、次の属性付きで *note namedtuple():
     4e0. として返します。

        * ‘system’ は OS 名です。 ‘'iOS'’ または ‘'iPadOS'’ となります。

        * ‘release’ は、 iOS のバージョン番号の文字列です。 (‘'17.2'’ な
          ど)

        * ‘model’ はデバイスモデルの識別子です。これは物理デバイスでは
          ‘'iPhone13,2'’ 、シミュレーターでは ‘'iPhone'’ のような文字列
          になります。

        * ‘is_simulator’ は、アプリがシミュレーター上で実行されているの
          か、物理デバイス上で実行されているのかを示す真偽値です。

     決定不能な項目は、引数として指定されたデフォルトに設定されます。


File: python.info,  Node: Unix platforms,  Next: Linux platforms,  Prev: iOS platform,  Up: platform --- 実行中プラットフォームの固有情報を参照する

5.16.7.6 Unix platforms
.......................

 -- の関数: platform.libc_ver (executable=sys.executable, lib='',
          version='', chunksize=16384)

     executableで指定したファイル（省略時はPythonインタープリタ）がリン
     クしているlibcバージョンの取得を試みます。戻り値は文字列のタプル
     ‘(lib, version)’ で、不明な項目は引数で指定した値となります。

     この関数は、実行形式に追加されるシンボルの細かな違いによって、
     libcのバージョンを特定します。この違いは ‘gcc’ でコンパイルされた実
     行可能ファイルでのみ有効だと思われます。

     'chunksize' にはファイルから情報を取得するために読み込むバイト数を
     指定します。


File: python.info,  Node: Linux platforms,  Next: Android platform,  Prev: Unix platforms,  Up: platform --- 実行中プラットフォームの固有情報を参照する

5.16.7.7 Linux platforms
........................

 -- の関数: platform.freedesktop_os_release ()

     Get operating system identification from ‘os-release’ file and
     return it as a dict.  The ‘os-release’ file is a freedesktop.org
     standard(1) and is available in most Linux distributions.  A
     noticeable exception is Android and Android-based distributions.

     Raises *note OSError: 2c0. or subclass when neither
     ‘/etc/os-release’ nor ‘/usr/lib/os-release’ can be read.

     On success, the function returns a dictionary where keys and values
     are strings.  Values have their special characters like ‘"’ and ‘$’
     unquoted.  The fields ‘NAME’, ‘ID’, and ‘PRETTY_NAME’ are always
     defined according to the standard.  All other fields are optional.
     Vendors may include additional fields.

     Note that fields like ‘NAME’, ‘VERSION’, and ‘VARIANT’ are strings
     suitable for presentation to users.  Programs should use fields
     like ‘ID’, ‘ID_LIKE’, ‘VERSION_ID’, or ‘VARIANT_ID’ to identify
     Linux distributions.

     以下はプログラム例です:

          def get_like_distro():
              info = platform.freedesktop_os_release()
              ids = [info["ID"]]
              if "ID_LIKE" in info:
                  # ids are space separated and ordered by precedence
                  ids.extend(info["ID_LIKE"].split())
              return ids

     Added in version 3.10.

   ---------- Footnotes ----------

   (1) https://www.freedesktop.org/software/systemd/man/os-release.html


File: python.info,  Node: Android platform,  Next: コマンドラインでの使用<3>,  Prev: Linux platforms,  Up: platform --- 実行中プラットフォームの固有情報を参照する

5.16.7.8 Android platform
.........................

 -- の関数: platform.android_ver (release='', api_level=0,
          manufacturer='', model='', device='', is_emulator=False)

     Android のデバイス情報を取得し、次の属性付きで *note namedtuple():
     4e0. として返します。決定不能な値は、引数として指定されたデフォルト
     に設定されます。

        * ‘release’ - Android バージョンの文字列 (‘"14"’ など) 。

        * ‘api_level’ - API level of the running device, as an integer
          (e.g.  ‘34’ for Android 14).  To get the API level which
          Python was built against, see *note sys.getandroidapilevel():
          d83.

        * ‘manufacturer’ - Manufacturer name(1).

        * ‘model’ - Model name(2) – typically the marketing name or
          model number.

        * ‘device’ - Device name(3) – typically the model number or a
          codename.

        * ‘is_emulator’ - ‘True’ if the device is an emulator; ‘False’
          if it's a physical device.

     Google maintains a list of known model and device names(4).

     Added in version 3.13.

   ---------- Footnotes ----------

   (1) 
https://developer.android.com/reference/android/os/Build#MANUFACTURER

   (2) https://developer.android.com/reference/android/os/Build#MODEL

   (3) https://developer.android.com/reference/android/os/Build#DEVICE

   (4) https://storage.googleapis.com/play_public/supported_devices.html


File: python.info,  Node: コマンドラインでの使用<3>,  Prev: Android platform,  Up: platform --- 実行中プラットフォームの固有情報を参照する

5.16.7.9 コマンドラインでの使用
...............................

‘platform’ can also be invoked directly using the *note -m: 23c. switch
of the interpreter:

     python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]

以下のオプションが使用できます:

 -- Option: --terse

     Print terse information about the platform.  This is equivalent to
     calling *note platform.platform(): 1ac6. with the 'terse' argument
     set to ‘True’.

 -- Option: --nonaliased

     Print platform information without system/OS name aliasing.  This
     is equivalent to calling *note platform.platform(): 1ac6. with the
     'aliased' argument set to ‘True’.

You can also pass one or more positional arguments (‘terse’,
‘nonaliased’) to explicitly control the output format.  These behave
similarly to their corresponding options.


File: python.info,  Node: errno --- 標準の errno システムシンボル,  Next: ctypes --- Python 用の外部関数ライブラリ,  Prev: platform --- 実行中プラットフォームの固有情報を参照する,  Up: 汎用オペレーティングシステムサービス

5.16.8 ‘errno’ -- 標準の errno システムシンボル
-----------------------------------------------

__________________________________________________________________

このモジュールから標準の ‘errno’ システムシンボルを取得することができま
す。個々のシンボルの値は ‘errno’ に対応する整数値です。これらのシンボル
の名前は、 ‘linux/include/errno.h’ から借用されており、網羅的なはずです
。

 -- データ: errno.errorcode

     errno 値を背後のシステムにおける文字列表現に対応付ける辞書です。例
     えば、‘errno.errorcode[errno.EPERM]’ は ‘'EPERM'’ に対応付けられま
     す。

数値のエラーコードをエラーメッセージに変換するには、 *note
os.strerror(): 3024. を使ってください。

以下のリストの内、現在のプラットフォームで使われていないシンボルはモジュ
ール上で定義されていません。定義されているシンボルだけを挙げたリストは
‘errno.errorcode.keys()’ として取得することができます。取得できるシンボ
ルには以下のようなものがあります:

 -- データ: errno.EPERM

     Operation not permitted.  This error is mapped to the exception
     *note PermissionError: f3e.

 -- データ: errno.ENOENT

     No such file or directory.  This error is mapped to the exception
     *note FileNotFoundError: 264.

 -- データ: errno.ESRCH

     No such process.  This error is mapped to the exception *note
     ProcessLookupError: 1266.

 -- データ: errno.EINTR

     Interrupted system call.  This error is mapped to the exception
     *note InterruptedError: f88.

 -- データ: errno.EIO

     I/O エラーです (I/O error)

 -- データ: errno.ENXIO

     そのようなデバイスまたはアドレスは存在しません (No such device or
     address)

 -- データ: errno.E2BIG

     引数リストが長すぎます (Arg list too long)

 -- データ: errno.ENOEXEC

     実行形式にエラーがあります (Exec format error)

 -- データ: errno.EBADF

     ファイル番号が間違っています (Bad file number)

 -- データ: errno.ECHILD

     No child processes.  This error is mapped to the exception *note
     ChildProcessError: 1263.

 -- データ: errno.EAGAIN

     Try again.  This error is mapped to the exception *note
     BlockingIOError: 235.

 -- データ: errno.ENOMEM

     空きメモリがありません (Out of memory)

 -- データ: errno.EACCES

     Permission denied.  This error is mapped to the exception *note
     PermissionError: f3e.

 -- データ: errno.EFAULT

     不正なアドレスです (Bad address)

 -- データ: errno.ENOTBLK

     ブロックデバイスが必要です (Block device required)

 -- データ: errno.EBUSY

     そのデバイスまたはリソースは使用中です (Device or resource busy)

 -- データ: errno.EEXIST

     File exists.  This error is mapped to the exception *note
     FileExistsError: 1221.

 -- データ: errno.EXDEV

     デバイスをまたいだリンクです (Cross-device link)

 -- データ: errno.ENODEV

     そのようなデバイスはありません (No such device)

 -- データ: errno.ENOTDIR

     Not a directory.  This error is mapped to the exception *note
     NotADirectoryError: 1265.

 -- データ: errno.EISDIR

     Is a directory.  This error is mapped to the exception *note
     IsADirectoryError: 1264.

 -- データ: errno.EINVAL

     無効な引数です (Invalid argument)

 -- データ: errno.ENFILE

     ファイルテーブルがオーバフローしています (File table overflow)

 -- データ: errno.EMFILE

     開かれたファイルが多すぎます (Too many open files)

 -- データ: errno.ENOTTY

     タイプライタではありません (Not a typewriter)

 -- データ: errno.ETXTBSY

     テキストファイルが使用中です (Text file busy)

 -- データ: errno.EFBIG

     ファイルが大きすぎます (File too large)

 -- データ: errno.ENOSPC

     デバイス上に空きがありません (No space left on device)

 -- データ: errno.ESPIPE

     不正なシークです (Illegal seek)

 -- データ: errno.EROFS

     リードオンリーのファイルシステムです (Read-only file system)

 -- データ: errno.EMLINK

     リンクが多すぎます (Too many links)

 -- データ: errno.EPIPE

     Broken pipe.  This error is mapped to the exception *note
     BrokenPipeError: 1267.

 -- データ: errno.EDOM

     数学引数が関数の定義域を越えています (Math argument out of domain
     of func)

 -- データ: errno.ERANGE

     表現できない数学演算結果になりました (Math result not
     representable)

 -- データ: errno.EDEADLK

     リソースのデッドロックが起きます (Resource deadlock would occur)

 -- データ: errno.ENAMETOOLONG

     ファイル名が長すぎます (File name too long)

 -- データ: errno.ENOLCK

     レコードロッキングが利用できません (No record locks available)

 -- データ: errno.ENOSYS

     実装されていない機能です (Function not implemented)

 -- データ: errno.ENOTEMPTY

     ディレクトリが空ではありません (Directory not empty)

 -- データ: errno.ELOOP

     これ以上シンボリックリンクを追跡できません (Too many symbolic links
     encountered)

 -- データ: errno.EWOULDBLOCK

     Operation would block.  This error is mapped to the exception *note
     BlockingIOError: 235.

 -- データ: errno.ENOMSG

     指定された型のメッセージはありません (No message of desired type)

 -- データ: errno.EIDRM

     識別子が除去されました (Identifier removed)

 -- データ: errno.ECHRNG

     チャネル番号が範囲を超えました (Channel number out of range)

 -- データ: errno.EL2NSYNC

     レベル 2 で同期がとれていません (Level 2 not synchronized)

 -- データ: errno.EL3HLT

     レベル 3 で終了しました (Level 3 halted)

 -- データ: errno.EL3RST

     レベル 3 でリセットしました (Level 3 reset)

 -- データ: errno.ELNRNG

     リンク番号が範囲を超えています (Link number out of range)

 -- データ: errno.EUNATCH

     プロトコルドライバが接続されていません (Protocol driver not
     attached)

 -- データ: errno.ENOCSI

     CSI 構造体がありません (No CSI structure available)

 -- データ: errno.EL2HLT

     レベル 2 で終了しました (Level 2 halted)

 -- データ: errno.EBADE

     無効な変換です (Invalid exchange)

 -- データ: errno.EBADR

     無効な要求記述子です (Invalid request descriptor)

 -- データ: errno.EXFULL

     変換テーブルが一杯です (Exchange full)

 -- データ: errno.ENOANO

     陰極がありません (No anode)

 -- データ: errno.EBADRQC

     無効なリクエストコードです (Invalid request code)

 -- データ: errno.EBADSLT

     無効なスロットです (Invalid slot)

 -- データ: errno.EDEADLOCK

     ファイルロックにおけるデッドロックエラーです (File locking deadlock
     error)

 -- データ: errno.EBFONT

     フォントファイル形式が間違っています (Bad font file format)

 -- データ: errno.ENOSTR

     ストリーム型でないデバイスです (Device not a stream)

 -- データ: errno.ENODATA

     利用可能なデータがありません (No data available)

 -- データ: errno.ETIME

     時間切れです (Timer expired)

 -- データ: errno.ENOSR

     ストリームリソースを使い切りました (Out of streams resources)

 -- データ: errno.ENONET

     計算機はネットワーク上にありません (Machine is not on the network)

 -- データ: errno.ENOPKG

     パッケージがインストールされていません (Package not installed)

 -- データ: errno.EREMOTE

     対象物は遠隔にあります (Object is remote)

 -- データ: errno.ENOLINK

     リンクが切られました (Link has been severed)

 -- データ: errno.EADV

     Advertise エラーです (Advertise error)

 -- データ: errno.ESRMNT

     Srmount エラーです (Srmount error)

 -- データ: errno.ECOMM

     送信時の通信エラーです (Communication error on send)

 -- データ: errno.EPROTO

     プロトコルエラーです (Protocol error)

 -- データ: errno.EMULTIHOP

     多重ホップを試みました (Multihop attempted)

 -- データ: errno.EDOTDOT

     RFS 特有のエラーです (RFS specific error)

 -- データ: errno.EBADMSG

     データメッセージではありません (Not a data message)

 -- データ: errno.EOVERFLOW

     定義されたデータ型にとって大きすぎる値です (Value too large for
     defined data type)

 -- データ: errno.ENOTUNIQ

     名前がネットワーク上で一意でありません (Name not unique on network)

 -- データ: errno.EBADFD

     ファイル記述子の状態が不正です (File descriptor in bad state)

 -- データ: errno.EREMCHG

     遠隔のアドレスが変更されました (Remote address changed)

 -- データ: errno.ELIBACC

     必要な共有ライブラリにアクセスできません (Can not access a needed
     shared library)

 -- データ: errno.ELIBBAD

     壊れた共有ライブラリにアクセスしています (Accessing a corrupted
     shared library)

 -- データ: errno.ELIBSCN

     a.out の .lib セクションが壊れています (.lib section in a.out
     corrupted)

 -- データ: errno.ELIBMAX

     リンクを試みる共有ライブラリが多すぎます (Attempting to link in too
     many shared libraries)

 -- データ: errno.ELIBEXEC

     共有ライブラリを直接実行することができません (Cannot exec a shared
     library directly)

 -- データ: errno.EILSEQ

     不正なバイト列です (Illegal byte sequence)

 -- データ: errno.ERESTART

     割り込みシステムコールを復帰しなければなりません (Interrupted
     system call should be restarted)

 -- データ: errno.ESTRPIPE

     ストリームパイプのエラーです (Streams pipe error)

 -- データ: errno.EUSERS

     ユーザが多すぎます (Too many users)

 -- データ: errno.ENOTSOCK

     非ソケットに対するソケット操作です (Socket operation on non-socket)

 -- データ: errno.EDESTADDRREQ

     目的アドレスが必要です (Destination address required)

 -- データ: errno.EMSGSIZE

     メッセージが長すぎます (Message too long)

 -- データ: errno.EPROTOTYPE

     ソケットに対して不正なプロトコル型です (Protocol wrong type for
     socket)

 -- データ: errno.ENOPROTOOPT

     利用できないプロトコルです (Protocol not available)

 -- データ: errno.EPROTONOSUPPORT

     サポートされていないプロトコルです (Protocol not supported)

 -- データ: errno.ESOCKTNOSUPPORT

     サポートされていないソケット型です (Socket type not supported)

 -- データ: errno.EOPNOTSUPP

     通信端点に対してサポートされていない操作です (Operation not
     supported on transport endpoint)

 -- データ: errno.ENOTSUP

     Operation not supported

     Added in version 3.2.

 -- データ: errno.EPFNOSUPPORT

     サポートされていないプロトコルファミリです (Protocol family not
     supported)

 -- データ: errno.EAFNOSUPPORT

     プロトコルでサポートされていないアドレスファミリです (Address
     family not supported by protocol)

 -- データ: errno.EADDRINUSE

     アドレスは使用中です (Address already in use)

 -- データ: errno.EADDRNOTAVAIL

     要求されたアドレスを割り当てできません (Cannot assign requested
     address)

 -- データ: errno.ENETDOWN

     ネットワークがダウンしています (Network is down)

 -- データ: errno.ENETUNREACH

     ネットワークに到達できません (Network is unreachable)

 -- データ: errno.ENETRESET

     リセットによってネットワーク接続が切られました (Network dropped
     connection because of reset)

 -- データ: errno.ECONNABORTED

     Software caused connection abort.  This error is mapped to the
     exception *note ConnectionAbortedError: 1268.

 -- データ: errno.ECONNRESET

     Connection reset by peer.  This error is mapped to the exception
     *note ConnectionResetError: 126a.

 -- データ: errno.ENOBUFS

     バッファに空きがありません (No buffer space available)

 -- データ: errno.EISCONN

     通信端点がすでに接続されています (Transport endpoint is already
     connected)

 -- データ: errno.ENOTCONN

     通信端点が接続されていません (Transport endpoint is not connected)

 -- データ: errno.ESHUTDOWN

     Cannot send after transport endpoint shutdown.  This error is
     mapped to the exception *note BrokenPipeError: 1267.

 -- データ: errno.ETOOMANYREFS

     参照が多すぎます: 接続できません (Too many references: cannot
     splice)

 -- データ: errno.ETIMEDOUT

     Connection timed out.  This error is mapped to the exception *note
     TimeoutError: a36.

 -- データ: errno.ECONNREFUSED

     Connection refused.  This error is mapped to the exception *note
     ConnectionRefusedError: 1269.

 -- データ: errno.EHOSTDOWN

     ホストはシステムダウンしています (Host is down)

 -- データ: errno.EHOSTUNREACH

     ホストへの経路がありません (No route to host)

 -- データ: errno.EHWPOISON

     Memory page has hardware error.

     Added in version 3.14.

 -- データ: errno.EALREADY

     Operation already in progress.  This error is mapped to the
     exception *note BlockingIOError: 235.

 -- データ: errno.EINPROGRESS

     Operation now in progress.  This error is mapped to the exception
     *note BlockingIOError: 235.

 -- データ: errno.ESTALE

     無効な NFS ファイルハンドルです (Stale NFS file handle)

 -- データ: errno.EUCLEAN

     構造のクリーニングが必要です (Structure needs cleaning)

 -- データ: errno.ENOTNAM

     XENIX 名前付きファイルではありません (Not a XENIX named type file)

 -- データ: errno.ENAVAIL

     XENIX セマフォは利用できません (No XENIX semaphores available)

 -- データ: errno.EISNAM

     名前付きファイルです (Is a named type file)

 -- データ: errno.EREMOTEIO

     遠隔側の I/O エラーです (Remote I/O error)

 -- データ: errno.EDQUOT

     ディスククオータを超えました (Quota exceeded)

 -- データ: errno.EQFULL

     Interface output queue is full

     Added in version 3.11.

 -- データ: errno.ENOMEDIUM

     No medium found

 -- データ: errno.EMEDIUMTYPE

     Wrong medium type

 -- データ: errno.ENOKEY

     Required key not available

 -- データ: errno.EKEYEXPIRED

     Key has expired

 -- データ: errno.EKEYREVOKED

     Key has been revoked

 -- データ: errno.EKEYREJECTED

     Key was rejected by service

 -- データ: errno.ERFKILL

     Operation not possible due to RF-kill

 -- データ: errno.ELOCKUNMAPPED

     Locked lock was unmapped

 -- データ: errno.ENOTACTIVE

     Facility is not active

 -- データ: errno.EAUTH

     Authentication error

     Added in version 3.2.

 -- データ: errno.EBADARCH

     Bad CPU type in executable

     Added in version 3.2.

 -- データ: errno.EBADEXEC

     Bad executable (or shared library)

     Added in version 3.2.

 -- データ: errno.EBADMACHO

     Malformed Mach-o file

     Added in version 3.2.

 -- データ: errno.EDEVERR

     Device error

     Added in version 3.2.

 -- データ: errno.EFTYPE

     Inappropriate file type or format

     Added in version 3.2.

 -- データ: errno.ENEEDAUTH

     Need authenticator

     Added in version 3.2.

 -- データ: errno.ENOATTR

     Attribute not found

     Added in version 3.2.

 -- データ: errno.ENOPOLICY

     Policy not found

     Added in version 3.2.

 -- データ: errno.EPROCLIM

     Too many processes

     Added in version 3.2.

 -- データ: errno.EPROCUNAVAIL

     Bad procedure for program

     Added in version 3.2.

 -- データ: errno.EPROGMISMATCH

     Program version wrong

     Added in version 3.2.

 -- データ: errno.EPROGUNAVAIL

     RPC prog.  not avail

     Added in version 3.2.

 -- データ: errno.EPWROFF

     Device power is off

     Added in version 3.2.

 -- データ: errno.EBADRPC

     RPC struct is bad

     Added in version 3.2.

 -- データ: errno.ERPCMISMATCH

     RPC version wrong

     Added in version 3.2.

 -- データ: errno.ESHLIBVERS

     Shared library version mismatch

     Added in version 3.2.

 -- データ: errno.ENOTCAPABLE

     Capabilities insufficient.  This error is mapped to the exception
     *note PermissionError: f3e.

     *note Availability: 213f.: WASI, FreeBSD

     Added in version 3.11.1.

 -- データ: errno.ECANCELED

     Operation canceled

     Added in version 3.2.

 -- データ: errno.EOWNERDEAD

     Owner died

     Added in version 3.2.

 -- データ: errno.ENOTRECOVERABLE

     State not recoverable

     Added in version 3.2.


File: python.info,  Node: ctypes --- Python 用の外部関数ライブラリ,  Prev: errno --- 標準の errno システムシンボル,  Up: 汎用オペレーティングシステムサービス

5.16.9 ‘ctypes’ -- Python 用の外部関数ライブラリ
------------------------------------------------

'ソースコード:' Lib/ctypes(1)

__________________________________________________________________

‘ctypes’ is a foreign function library for Python.  It provides C
compatible data types, and allows calling functions in DLLs or shared
libraries.  It can be used to wrap these libraries in pure Python.

This is an *note optional module: 215a.  If it is missing from your copy
of CPython, look for documentation from your distributor (that is,
whoever provided Python to you).  If you are the distributor, see *note
オプションのモジュールの要件: 2158.

* Menu:

* ctypes チュートリアル::
* ctypesリファレンス::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/ctypes


File: python.info,  Node: ctypes チュートリアル,  Next: ctypesリファレンス,  Up: ctypes --- Python 用の外部関数ライブラリ

5.16.9.1 ctypes チュートリアル
..............................

注意: このチュートリアルのコードサンプルは動作確認のために *note
doctest: 3e. を使います。コードサンプルの中には Linux、 Windows、あるい
は macOS 上で異なる動作をするものがあるため、サンプルのコメントに
doctest 命令を入れてあります。

注意: いくつかのコードサンプルで ctypes の *note c_int: 32cf. 型を参照し
ています。 ‘sizeof(long) == sizeof(int)’ であるようなプラットフォームで
は、この型は *note c_long: 32d0. のエイリアスです。そのため、 *note
c_int: 32cf. 型を想定しているときに *note c_long: 32d0. が表示されたとし
ても、混乱しないようにしてください -- 実際には同じ型なのです。

* Menu:

* 動的リンクライブラリをロードする::
* ロードしたdllから関数にアクセスする::
* 関数を呼び出す::
* 基本データ型::
* 続・関数を呼び出す::
* Calling variadic functions::
* 自作のデータ型とともに関数を呼び出す::
* 要求される引数の型を指定する (関数プロトタイプ): 要求される引数の型を指定する 関数プロトタイプ.
* 戻り値の型::
* ポインタを渡す(または、パラメータの参照渡し): ポインタを渡す または、パラメータの参照渡し.
* 構造体と共用体::
* Structure/union layout, alignment and byte order: Structure/union layout alignment and byte order.
* 構造体と共用体におけるビットフィールド::
* 配列: 配列<2>.
* ポインタ::
* Thread safety without the GIL::
* 型変換::
* 不完全型::
* コールバック関数::
* dllからエクスポートされた値へアクセスする::
* びっくり仰天::
* 可変サイズのデータ型::


File: python.info,  Node: 動的リンクライブラリをロードする,  Next: ロードしたdllから関数にアクセスする,  Up: ctypes チュートリアル

5.16.9.2 動的リンクライブラリをロードする
.........................................

‘ctypes’ exports the 'cdll', and on Windows 'windll' and 'oledll'
objects, for loading dynamic link libraries.

You load libraries by accessing them as attributes of these objects.
'cdll' loads libraries which export functions using the standard ‘cdecl’
calling convention, while 'windll' libraries call functions using the
‘stdcall’ calling convention.  'oledll' also uses the ‘stdcall’ calling
convention, and assumes the functions return a Windows ‘HRESULT’ error
code.  The error code is used to automatically raise an *note OSError:
2c0. exception when the function call fails.

バージョン 3.3 で変更: Windows エラーは以前は *note WindowsError: 1260.
を送出していましたが、これは現在では *note OSError: 2c0. の別名になって
います。

Here are some examples for Windows.  Note that ‘msvcrt’ is the MS
standard C library containing most standard C functions, and uses the
‘cdecl’ calling convention:

     >>> from ctypes import *
     >>> print(windll.kernel32)
     <WinDLL 'kernel32', handle ... at ...>
     >>> print(cdll.msvcrt)
     <CDLL 'msvcrt', handle ... at ...>
     >>> libc = cdll.msvcrt
     >>>

Windows では通常の ‘.dll’ ファイル拡張子を自動的に追加します。

     注釈: ‘cdll.msvcrt’ 経由で標準 C ライブラリにアクセスすると、Python
     が使用しているライブラリとは互換性のない可能性のある、古いバージョ
     ンのライブラリが使用されます。可能な場合には、ネイティブ Python の
     機能を使用するか、‘msvcrt’ モジュールをインポートして使用してくださ
     い。

On Linux, it is required to specify the filename 'including' the
extension to load a library, so attribute access can not be used to load
libraries.  Either the *note LoadLibrary(): 32d3. method of the dll
loaders should be used, or you should load the library by creating an
instance of CDLL by calling the constructor:

     >>> cdll.LoadLibrary("libc.so.6")
     <CDLL 'libc.so.6', handle ... at ...>
     >>> libc = CDLL("libc.so.6")
     >>> libc
     <CDLL 'libc.so.6', handle ... at ...>
     >>>


File: python.info,  Node: ロードしたdllから関数にアクセスする,  Next: 関数を呼び出す,  Prev: 動的リンクライブラリをロードする,  Up: ctypes チュートリアル

5.16.9.3 ロードしたdllから関数にアクセスする
............................................

dll オブジェクトの属性として関数にアクセスします:

     >>> libc.printf
     <_FuncPtr object at 0x...>
     >>> print(windll.kernel32.GetModuleHandleA)
     <_FuncPtr object at 0x...>
     >>> print(windll.kernel32.MyOwnFunction)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
       File "ctypes.py", line 239, in __getattr__
         func = _StdcallFuncPtr(name, self)
     AttributeError: function 'MyOwnFunction' not found
     >>>

Note that win32 system dlls like ‘kernel32’ and ‘user32’ often export
ANSI as well as UNICODE versions of a function.  The UNICODE version is
exported with a ‘W’ appended to the name, while the ANSI version is
exported with an ‘A’ appended to the name.  The win32 ‘GetModuleHandle’
function, which returns a 'module handle' for a given module name, has
the following C prototype, and a macro is used to expose one of them as
‘GetModuleHandle’ depending on whether UNICODE is defined or not:

     /* ANSI version */
     HMODULE GetModuleHandleA(LPCSTR lpModuleName);
     /* UNICODE version */
     HMODULE GetModuleHandleW(LPCWSTR lpModuleName);

'windll' は魔法を使ってどちらか一つを選ぶようなことはしません。
‘GetModuleHandleA’ もしくは ‘GetModuleHandleW’ を明示的に指定して必要と
するバージョンにアクセスし、バイト列か文字列を使ってそれぞれ呼び出さなけ
ればなりません。

時には、 dll が関数を ‘"??2@YAPAXI@Z"’ のような Python 識別子として有効
でない名前でエクスポートすることがあります。このような場合に関数を取り出
すには、 *note getattr(): dca. を使わなければなりません。:

     >>> getattr(cdll.msvcrt, "??2@YAPAXI@Z")
     <_FuncPtr object at 0x...>
     >>>

Windows では、名前ではなく序数によって関数をエクスポートする dll もあり
ます。こうした関数には序数を使って dll オブジェクトにインデックス指定す
ることでアクセスします:

     >>> cdll.kernel32[1]
     <_FuncPtr object at 0x...>
     >>> cdll.kernel32[0]
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
       File "ctypes.py", line 310, in __getitem__
         func = _StdcallFuncPtr(name, self)
     AttributeError: function ordinal 0 not found
     >>>


File: python.info,  Node: 関数を呼び出す,  Next: 基本データ型,  Prev: ロードしたdllから関数にアクセスする,  Up: ctypes チュートリアル

5.16.9.4 関数を呼び出す
.......................

You can call these functions like any other Python callable.  This
example uses the ‘rand()’ function, which takes no arguments and returns
a pseudo-random integer:

     >>> print(libc.rand())
     1804289383

On Windows, you can call the ‘GetModuleHandleA()’ function, which
returns a win32 module handle (passing ‘None’ as single argument to call
it with a ‘NULL’ pointer):

     >>> print(hex(windll.kernel32.GetModuleHandleA(None)))
     0x1d000000
     >>>

‘cdecl’ 呼び出し規約を使って ‘stdcall’ 関数を呼び出したときには、 *note
ValueError: 2ec. が送出されます。逆の場合も同様です:

     >>> cdll.kernel32.GetModuleHandleA(None)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     ValueError: Procedure probably called with not enough arguments (4 bytes missing)
     >>>

     >>> windll.msvcrt.printf(b"spam")
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     ValueError: Procedure probably called with too many arguments (4 bytes in excess)
     >>>

正しい呼び出し規約を知るためには、呼び出したい関数についての C ヘッダフ
ァイルもしくはドキュメントを見なければなりません。

On Windows, ‘ctypes’ uses win32 structured exception handling to prevent
crashes from general protection faults when functions are called with
invalid argument values:

     >>> windll.kernel32.GetModuleHandleA(32)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     OSError: exception: access violation reading 0x00000020
     >>>

There are, however, enough ways to crash Python with ‘ctypes’, so you
should be careful anyway.  The *note faulthandler: 5c. module can be
helpful in debugging crashes (e.g.  from segmentation faults produced by
erroneous C library calls).

‘None’, integers, bytes objects and (unicode) strings are the only
native Python objects that can directly be used as parameters in these
function calls.  ‘None’ is passed as a C ‘NULL’ pointer, bytes objects
and strings are passed as pointer to the memory block that contains
their data (char* or wchar_t*).  Python integers are passed as the
platform's default C int type, their value is masked to fit into the C
type.

Before we move on calling functions with other parameter types, we have
to learn more about ‘ctypes’ data types.


File: python.info,  Node: 基本データ型,  Next: 続・関数を呼び出す,  Prev: 関数を呼び出す,  Up: ctypes チュートリアル

5.16.9.5 基本データ型
.....................

‘ctypes’ defines a number of primitive C compatible data types:

ctypes の型                C の型                                         Python の型
                                                                          
-----------------------------------------------------------------------------------------------------------
                                                                          
*note c_bool: 32da.        _Bool                                          bool (1)
                                                                          
                                                                          
*note c_char: 32db.        char                                           1文字のバイト列オブジェクト
                                                                          
                                                                          
*note c_wchar: 32dc.       ‘wchar_t’                                      1文字の文字列
                                                                          
                                                                          
*note c_byte: 1ae0.        char                                           int
                                                                          
                                                                          
*note c_ubyte: 1ae1.       unsigned char                                  int
                                                                          
                                                                          
*note c_short: 32dd.       short                                          int
                                                                          
                                                                          
*note c_ushort: 32de.      unsigned short                                 int
                                                                          
                                                                          
*note c_int: 32cf.         int                                            int
                                                                          
                                                                          
*note c_int8: 32df.        ‘int8_t’                                       int
                                                                          
                                                                          
*note c_int16: 32e0.       ‘int16_t’                                      int
                                                                          
                                                                          
*note c_int32: 32e1.       ‘int32_t’                                      int
                                                                          
                                                                          
*note c_int64: 32e2.       ‘int64_t’                                      int
                                                                          
                                                                          
*note c_uint: 32e3.        unsigned int                                   int
                                                                          
                                                                          
*note c_uint8: 32e4.       ‘uint8_t’                                      int
                                                                          
                                                                          
*note c_uint16: 32e5.      ‘uint16_t’                                     int
                                                                          
                                                                          
*note c_uint32: 32e6.      ‘uint32_t’                                     int
                                                                          
                                                                          
*note c_uint64: 32e7.      ‘uint64_t’                                     int
                                                                          
                                                                          
*note c_long: 32d0.        long                                           int
                                                                          
                                                                          
*note c_ulong: 32e8.       unsigned long                                  int
                                                                          
                                                                          
*note c_longlong: 32e9.    __int64 または long long                       int
                                                                          
                                                                          
*note c_ulonglong: 32ea.   unsigned __int64 または unsigned long long     int
                                                                          
                                                                          
*note c_size_t: 32eb.      ‘size_t’                                       int
                                                                          
                                                                          
*note c_ssize_t: 1454.     ‘ssize_t’ or *note Py_ssize_t: c55.            int
                                                                          
                                                                          
*note c_time_t: 1b63.      ‘time_t’                                       int
                                                                          
                                                                          
*note c_float: 32ec.       float                                          浮動小数点数
                                                                          
                                                                          
*note c_double: 1cb8.      double                                         浮動小数点数
                                                                          
                                                                          
*note c_longdouble: 1cb9.  long double                                    浮動小数点数
                                                                          
                                                                          
*note c_char_p: 1a57.      char* (NUL 終端)                               バイト列オブジェクトまたは
                                                                          ‘None’
                                                                          
                                                                          
*note c_wchar_p: 1a58.     wchar_t* (NUL 終端)                            文字列または ‘None’
                                                                          
                                                                          
*note c_void_p: 1a59.      void*                                          整数または ‘None’
                                                                          

  1. コンストラクタは任意のオブジェクトをその真偽値として受け取ります。

Additionally, if IEC 60559 compatible complex arithmetic (Annex G) is
supported in both C and ‘libffi’, the following complex types are
available:

ctypes の型                            C の型                                Python の型
                                                                             
---------------------------------------------------------------------------------------------------
                                                                             
*note c_float_complex: 1ed.            float complex                         複素数
                                                                             
                                                                             
*note c_double_complex: 1ee.           double complex                        複素数
                                                                             
                                                                             
*note c_longdouble_complex: 1ef.       long double complex                   複素数
                                                                             

これら全ての型はその型を呼び出すことによって作成でき、オプションとして型
と値が合っている初期化子を指定することができます:

     >>> c_int()
     c_long(0)
     >>> c_wchar_p("Hello, World")
     c_wchar_p(140018365411392)
     >>> c_ushort(-3)
     c_ushort(65533)
     >>>

これらの型は変更可能であり、値を後で変更することもできます:

     >>> i = c_int(42)
     >>> print(i)
     c_long(42)
     >>> print(i.value)
     42
     >>> i.value = -99
     >>> print(i.value)
     -99
     >>>

Assigning a new value to instances of the pointer types *note c_char_p:
1a57, *note c_wchar_p: 1a58, and *note c_void_p: 1a59. changes the
'memory location' they point to, 'not the contents' of the memory block
(of course not, because Python string objects are immutable):

     >>> s = "Hello, World"
     >>> c_s = c_wchar_p(s)
     >>> print(c_s)
     c_wchar_p(139966785747344)
     >>> print(c_s.value)
     Hello World
     >>> c_s.value = "Hi, there"
     >>> print(c_s)              # the memory location has changed
     c_wchar_p(139966783348904)
     >>> print(c_s.value)
     Hi, there
     >>> print(s)                # first object is unchanged
     Hello, World
     >>>

しかし、変更可能なメモリを指すポインタであることを想定している関数へそれ
らを渡さないように注意すべきです。もし変更可能なメモリブロックが必要なら
、 ctypes には *note create_string_buffer(): 32ed. 関数があり、いろいろ
な方法で作成することできます。現在のメモリブロックの内容は ‘raw’ プロパ
ティを使ってアクセス (あるいは変更) することができます。もし現在のメモリ
ブロックに NUL 終端文字列としてアクセスしたいなら、 ‘value’ プロパティを
使ってください:

     >>> from ctypes import *
     >>> p = create_string_buffer(3)            # create a 3 byte buffer, initialized to NUL bytes
     >>> print(sizeof(p), repr(p.raw))
     3 b'\x00\x00\x00'
     >>> p = create_string_buffer(b"Hello")     # create a buffer containing a NUL terminated string
     >>> print(sizeof(p), repr(p.raw))
     6 b'Hello\x00'
     >>> print(repr(p.value))
     b'Hello'
     >>> p = create_string_buffer(b"Hello", 10) # create a 10 byte buffer
     >>> print(sizeof(p), repr(p.raw))
     10 b'Hello\x00\x00\x00\x00\x00'
     >>> p.value = b"Hi"
     >>> print(sizeof(p), repr(p.raw))
     10 b'Hi\x00lo\x00\x00\x00\x00\x00'
     >>>

The *note create_string_buffer(): 32ed. function replaces the old
‘c_buffer()’ function (which is still available as an alias).  To create
a mutable memory block containing unicode characters of the C type
‘wchar_t’, use the *note create_unicode_buffer(): 1db4. function.


File: python.info,  Node: 続・関数を呼び出す,  Next: Calling variadic functions,  Prev: 基本データ型,  Up: ctypes チュートリアル

5.16.9.6 続・関数を呼び出す
...........................

printf は *note sys.stdout: ccd. では 'なく' 、本物の標準出力チャンネル
へプリントすることに注意してください。したがって、これらの例はコンソール
プロンプトでのみ動作し、 'IDLE' や 'PythonWin' では動作しません。:

     >>> printf = libc.printf
     >>> printf(b"Hello, %s\n", b"World!")
     Hello, World!
     14
     >>> printf(b"Hello, %S\n", "World!")
     Hello, World!
     14
     >>> printf(b"%d bottles of beer\n", 42)
     42 bottles of beer
     19
     >>> printf(b"%f bottles of beer\n", 42.5)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     ctypes.ArgumentError: argument 2: TypeError: Don't know how to convert parameter 2
     >>>

As has been mentioned before, all Python types except integers, strings,
and bytes objects have to be wrapped in their corresponding ‘ctypes’
type, so that they can be converted to the required C data type:

     >>> printf(b"An int %d, a double %f\n", 1234, c_double(3.14))
     An int 1234, a double 3.140000
     31
     >>>


File: python.info,  Node: Calling variadic functions,  Next: 自作のデータ型とともに関数を呼び出す,  Prev: 続・関数を呼び出す,  Up: ctypes チュートリアル

5.16.9.7 Calling variadic functions
...................................

On a lot of platforms calling variadic functions through ctypes is
exactly the same as calling functions with a fixed number of parameters.
On some platforms, and in particular ARM64 for Apple Platforms, the
calling convention for variadic functions is different than that for
regular functions.

On those platforms it is required to specify the *note argtypes: 17c1.
attribute for the regular, non-variadic, function arguments:

     libc.printf.argtypes = [ctypes.c_char_p]

Because specifying the attribute does not inhibit portability it is
advised to always specify *note argtypes: 17c1. for all variadic
functions.


File: python.info,  Node: 自作のデータ型とともに関数を呼び出す,  Next: 要求される引数の型を指定する 関数プロトタイプ,  Prev: Calling variadic functions,  Up: ctypes チュートリアル

5.16.9.8 自作のデータ型とともに関数を呼び出す
.............................................

You can also customize ‘ctypes’ argument conversion to allow instances
of your own classes be used as function arguments.  ‘ctypes’ looks for
an ‘_as_parameter_’ attribute and uses this as the function argument.
The attribute must be an integer, string, bytes, a ‘ctypes’ instance, or
an object with an ‘_as_parameter_’ attribute:

     >>> class Bottles:
     ...     def __init__(self, number):
     ...         self._as_parameter_ = number
     ...
     >>> bottles = Bottles(42)
     >>> printf(b"%d bottles of beer\n", bottles)
     42 bottles of beer
     19
     >>>

If you don't want to store the instance's data in the ‘_as_parameter_’
instance variable, you could define a *note property: 4b3. which makes
the attribute available on request.


File: python.info,  Node: 要求される引数の型を指定する 関数プロトタイプ,  Next: 戻り値の型,  Prev: 自作のデータ型とともに関数を呼び出す,  Up: ctypes チュートリアル

5.16.9.9 要求される引数の型を指定する (関数プロトタイプ)
........................................................

It is possible to specify the required argument types of functions
exported from DLLs by setting the *note argtypes: 17c1. attribute.

*note argtypes: 17c1. must be a sequence of C data types (the ‘printf()’
function is probably not a good example here, because it takes a
variable number and different types of parameters depending on the
format string, on the other hand this is quite handy to experiment with
this feature):

     >>> printf.argtypes = [c_char_p, c_char_p, c_int, c_double]
     >>> printf(b"String '%s', Int %d, Double %f\n", b"Hi", 10, 2.2)
     String 'Hi', Int 10, Double 2.200000
     37
     >>>

(C の関数のプロトタイプのように) 書式を指定すると互換性のない引数型にな
るのを防ぎ、引数を有効な型へ変換しようとします。:

     >>> printf(b"%d %d %d", 1, 2, 3)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     ctypes.ArgumentError: argument 2: TypeError: 'int' object cannot be interpreted as ctypes.c_char_p
     >>> printf(b"%s %d %f\n", b"X", 2, 3)
     X 2 3.000000
     13
     >>>

If you have defined your own classes which you pass to function calls,
you have to implement a *note from_param(): 32f6. class method for them
to be able to use them in the *note argtypes: 17c1. sequence.  The *note
from_param(): 32f6. class method receives the Python object passed to
the function call, it should do a typecheck or whatever is needed to
make sure this object is acceptable, and then return the object itself,
its ‘_as_parameter_’ attribute, or whatever you want to pass as the C
function argument in this case.  Again, the result should be an integer,
string, bytes, a ‘ctypes’ instance, or an object with an
‘_as_parameter_’ attribute.


File: python.info,  Node: 戻り値の型,  Next: ポインタを渡す または、パラメータの参照渡し,  Prev: 要求される引数の型を指定する 関数プロトタイプ,  Up: ctypes チュートリアル

5.16.9.10 戻り値の型
....................

By default functions are assumed to return the C int type.  Other return
types can be specified by setting the *note restype: 32f9. attribute of
the function object.

The C prototype of ‘time()’ is ‘time_t time(time_t *)’.  Because
‘time_t’ might be of a different type than the default return type int,
you should specify the ‘restype’ attribute:

     >>> libc.time.restype = c_time_t

The argument types can be specified using *note argtypes: 17c1.:

     >>> libc.time.argtypes = (POINTER(c_time_t),)

To call the function with a ‘NULL’ pointer as first argument, use
‘None’:

     >>> print(libc.time(None))
     1150640792

Here is a more advanced example, it uses the ‘strchr()’ function, which
expects a string pointer and a char, and returns a pointer to a string:

     >>> strchr = libc.strchr
     >>> strchr(b"abcdef", ord("d"))
     8059983
     >>> strchr.restype = c_char_p    # c_char_p is a pointer to a string
     >>> strchr(b"abcdef", ord("d"))
     b'def'
     >>> print(strchr(b"abcdef", ord("x")))
     None
     >>>

If you want to avoid the *note ord("x"): 233b. calls above, you can set
the *note argtypes: 17c1. attribute, and the second argument will be
converted from a single character Python bytes object into a C char:

     >>> strchr.restype = c_char_p
     >>> strchr.argtypes = [c_char_p, c_char]
     >>> strchr(b"abcdef", b"d")
     b'def'
     >>> strchr(b"abcdef", b"def")
     Traceback (most recent call last):
     ctypes.ArgumentError: argument 2: TypeError: one character bytes, bytearray or integer expected
     >>> print(strchr(b"abcdef", b"x"))
     None
     >>> strchr(b"abcdef", b"d")
     b'def'
     >>>

You can also use a callable Python object (a function or a class for
example) as the *note restype: 32f9. attribute, if the foreign function
returns an integer.  The callable will be called with the 'integer' the
C function returns, and the result of this call will be used as the
result of your function call.  This is useful to check for error return
values and automatically raise an exception:

     >>> GetModuleHandle = windll.kernel32.GetModuleHandleA
     >>> def ValidHandle(value):
     ...     if value == 0:
     ...         raise WinError()
     ...     return value
     ...
     >>>
     >>> GetModuleHandle.restype = ValidHandle
     >>> GetModuleHandle(None)
     486539264
     >>> GetModuleHandle("something silly")
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
       File "<stdin>", line 3, in ValidHandle
     OSError: [Errno 126] The specified module could not be found.
     >>>

‘WinError’ はエラーコードの文字列表現を得るために Windows の
‘FormatMessage()’ api を呼び出し、例外を '返す' 関数です。 ‘WinError’ は
オプションでエラーコードパラメータを取ります。このパラメータが使われない
場合は、エラーコードを取り出すために *note GetLastError(): 32fa. を呼び
出します。

Please note that a much more powerful error checking mechanism is
available through the *note errcheck: 32fb. attribute; see the reference
manual for details.


File: python.info,  Node: ポインタを渡す または、パラメータの参照渡し,  Next: 構造体と共用体,  Prev: 戻り値の型,  Up: ctypes チュートリアル

5.16.9.11 ポインタを渡す(または、パラメータの参照渡し)
......................................................

時には、 C api 関数がパラメータのデータ型として 'ポインタ' を想定してい
ることがあります。おそらくパラメータと同一の場所に書き込むためか、もしく
はそのデータが大きすぎて値渡しできない場合です。これは 'パラメータの参照
渡し' としても知られています。

‘ctypes’ exports the *note byref(): 32fe. function which is used to pass
parameters by reference.  The same effect can be achieved with the *note
pointer(): 1a56. function, although *note pointer(): 1a56. does a lot
more work since it constructs a real pointer object, so it is faster to
use *note byref(): 32fe. if you don't need the pointer object in Python
itself:

     >>> i = c_int()
     >>> f = c_float()
     >>> s = create_string_buffer(b'\000' * 32)
     >>> print(i.value, f.value, repr(s.value))
     0 0.0 b''
     >>> libc.sscanf(b"1 3.14 Hello", b"%d %f %s",
     ...             byref(i), byref(f), s)
     3
     >>> print(i.value, f.value, repr(s.value))
     1 3.1400001049 b'Hello'
     >>>


File: python.info,  Node: 構造体と共用体,  Next: Structure/union layout alignment and byte order,  Prev: ポインタを渡す または、パラメータの参照渡し,  Up: ctypes チュートリアル

5.16.9.12 構造体と共用体
........................

Structures and unions must derive from the *note Structure: 1e5. and
*note Union: 1e6. base classes which are defined in the ‘ctypes’ module.
Each subclass must define a *note _fields_: 1936. attribute.  ‘_fields_’
must be a list of '2-tuples', containing a 'field name' and a 'field
type'.

The field type must be a ‘ctypes’ type like *note c_int: 32cf, or any
other derived ‘ctypes’ type: structure, union, array, pointer.

以下は、 'x' と 'y' という名前の二つの整数からなる簡単な POINT 構造体の
例です。コンストラクタで構造体を初期化する方法も説明しています:

     >>> from ctypes import *
     >>> class POINT(Structure):
     ...     _fields_ = [("x", c_int),
     ...                 ("y", c_int)]
     ...
     >>> point = POINT(10, 20)
     >>> print(point.x, point.y)
     10 20
     >>> point = POINT(y=5)
     >>> print(point.x, point.y)
     0 5
     >>> POINT(1, 2, 3)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: too many initializers
     >>>

しかし、もっと複雑な構造体を構築することもできます。ある構造体は、他の構
造体をフィールド型として使うことで、他の構造体を含むことができます。

'upperleft' と 'lowerright' という名前の二つの POINT を持つ RECT 構造体
です。:

     >>> class RECT(Structure):
     ...     _fields_ = [("upperleft", POINT),
     ...                 ("lowerright", POINT)]
     ...
     >>> rc = RECT(point)
     >>> print(rc.upperleft.x, rc.upperleft.y)
     0 5
     >>> print(rc.lowerright.x, rc.lowerright.y)
     0 0
     >>>

入れ子になった構造体はいくつかの方法を用いてコンストラクタで初期化するこ
とができます。:

     >>> r = RECT(POINT(1, 2), POINT(3, 4))
     >>> r = RECT((1, 2), (3, 4))

Field *note descriptor: 1881.s can be retrieved from the 'class', they
are useful for debugging because they can provide useful information.
See *note CField: 1e8.:

     >>> POINT.x
     <ctypes.CField 'x' type=c_int, ofs=0, size=4>
     >>> POINT.y
     <ctypes.CField 'y' type=c_int, ofs=4, size=4>
     >>>
     警告: ‘ctypes’ does not support passing unions or structures with
     bit-fields to functions by value.  While this may work on 32-bit
     x86, it's not guaranteed by the library to work in the general
     case.  Unions and structures with bit-fields should always be
     passed to functions by pointer.


File: python.info,  Node: Structure/union layout alignment and byte order,  Next: 構造体と共用体におけるビットフィールド,  Prev: 構造体と共用体,  Up: ctypes チュートリアル

5.16.9.13 Structure/union layout, alignment and byte order
..........................................................

By default, Structure and Union fields are laid out in the same way the
C compiler does it.  It is possible to override this behavior entirely
by specifying a *note _layout_: 1e7. class attribute in the subclass
definition; see the attribute documentation for details.

It is possible to specify the maximum alignment for the fields and/or
for the structure itself by setting the class attributes *note _pack_:
317. and/or *note _align_: 4e8, respectively.  See the attribute
documentation for details.

‘ctypes’ uses the native byte order for Structures and Unions.  To build
structures with non-native byte order, you can use one of the *note
BigEndianStructure: 3303, *note LittleEndianStructure: 3304, *note
BigEndianUnion: 1bb7, and *note LittleEndianUnion: 1bb8. base classes.
These classes cannot contain pointer fields.


File: python.info,  Node: 構造体と共用体におけるビットフィールド,  Next: 配列<2>,  Prev: Structure/union layout alignment and byte order,  Up: ctypes チュートリアル

5.16.9.14 構造体と共用体におけるビットフィールド
................................................

It is possible to create structures and unions containing bit fields.
Bit fields are only possible for integer fields, the bit width is
specified as the third item in the *note _fields_: 1936. tuples:

     >>> class Int(Structure):
     ...     _fields_ = [("first_16", c_int, 16),
     ...                 ("second_16", c_int, 16)]
     ...
     >>> print(Int.first_16)
     <ctypes.CField 'first_16' type=c_int, ofs=0, bit_size=16, bit_offset=0>
     >>> print(Int.second_16)
     <ctypes.CField 'second_16' type=c_int, ofs=0, bit_size=16, bit_offset=16>

It is important to note that bit field allocation and layout in memory
are not defined as a C standard; their implementation is
compiler-specific.  By default, Python will attempt to match the
behavior of a "native" compiler for the current platform.  See the *note
_layout_: 1e7. attribute for details on the default behavior and how to
change it.


File: python.info,  Node: 配列<2>,  Next: ポインタ,  Prev: 構造体と共用体におけるビットフィールド,  Up: ctypes チュートリアル

5.16.9.15 配列
..............

配列 (Array) はシーケンスであり、決まった数の同じ型のインスタンスを持ち
ます。

推奨されている配列の作成方法はデータ型に正の整数を掛けることです。:

     TenPointsArrayType = POINT * 10

ややわざとらしいデータ型の例になりますが、他のものに混ざって 4 個の
POINT がある構造体です:

     >>> from ctypes import *
     >>> class POINT(Structure):
     ...     _fields_ = ("x", c_int), ("y", c_int)
     ...
     >>> class MyStruct(Structure):
     ...     _fields_ = [("a", c_int),
     ...                 ("b", c_float),
     ...                 ("point_array", POINT * 4)]
     >>>
     >>> print(len(MyStruct().point_array))
     4
     >>>

インスタンスはクラスを呼び出す通常の方法で作成します。:

     arr = TenPointsArrayType()
     for pt in arr:
         print(pt.x, pt.y)

上記のコードは ‘0 0’ という行が並んだものを表示します。配列の要素がゼロ
で初期化されているためです。

正しい型の初期化子を指定することもできます。:

     >>> from ctypes import *
     >>> TenIntegers = c_int * 10
     >>> ii = TenIntegers(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
     >>> print(ii)
     <c_long_Array_10 object at 0x...>
     >>> for i in ii: print(i, end=" ")
     ...
     1 2 3 4 5 6 7 8 9 10
     >>>


File: python.info,  Node: ポインタ,  Next: Thread safety without the GIL,  Prev: 配列<2>,  Up: ctypes チュートリアル

5.16.9.16 ポインタ
..................

Pointer instances are created by calling the *note pointer(): 1a56.
function on a ‘ctypes’ type:

     >>> from ctypes import *
     >>> i = c_int(42)
     >>> pi = pointer(i)
     >>>

次のように、ポインタインスタンスは、ポインタが指すオブジェクト (上の例で
は ‘i’) を返す *note contents: 330a. 属性を持ちます:

     >>> pi.contents
     c_long(42)
     >>>

Note that ‘ctypes’ does not have OOR (original object return), it
constructs a new, equivalent object each time you retrieve an attribute:

     >>> pi.contents is i
     False
     >>> pi.contents is pi.contents
     False
     >>>

別の *note c_int: 32cf. インスタンスがポインタの contents 属性に代入され
ると、これが記憶されているメモリ位置を指すポインタに変化します。:

     >>> i = c_int(99)
     >>> pi.contents = i
     >>> pi.contents
     c_long(99)
     >>>

ポインタインスタンスは整数でインデックス指定することもできます。:

     >>> pi[0]
     99
     >>>

整数インデックスへ代入するとポインタが指す値が変更されます。:

     >>> print(i)
     c_long(99)
     >>> pi[0] = 22
     >>> print(i)
     c_long(22)
     >>>

0 ではないインデックスを使うこともできますが、 C の場合と同じように自分
が何をしているかを理解している必要があります。任意のメモリ位置にアクセス
もしくは変更できるのです。一般的にこの機能を使うのは、 C 関数からポイン
タを受け取り、そのポインタが単一の要素ではなく実際に配列を指していると
'分かっている' 場合だけです。

Behind the scenes, the *note pointer(): 1a56. function does more than
simply create pointer instances, it has to create pointer 'types' first.
This is done with the *note POINTER(): 1f1. function, which accepts any
‘ctypes’ type, and returns a new type:

     >>> PI = POINTER(c_int)
     >>> PI
     <class 'ctypes.LP_c_long'>
     >>> PI(42)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: expected c_long instead of int
     >>> PI(c_int(42))
     <ctypes.LP_c_long object at 0x...>
     >>>

ポインタ型を引数なしで呼び出すと ‘NULL’ ポインタを作成します。 ‘NULL’ ポ
インタは ‘False’ ブール値を持っています。:

     >>> null_ptr = POINTER(c_int)()
     >>> print(bool(null_ptr))
     False
     >>>

‘ctypes’ checks for ‘NULL’ when dereferencing pointers (but
dereferencing invalid non-‘NULL’ pointers would crash Python):

     >>> null_ptr[0]
     Traceback (most recent call last):
         ....
     ValueError: NULL pointer access
     >>>

     >>> null_ptr[0] = 1234
     Traceback (most recent call last):
         ....
     ValueError: NULL pointer access
     >>>


File: python.info,  Node: Thread safety without the GIL,  Next: 型変換,  Prev: ポインタ,  Up: ctypes チュートリアル

5.16.9.17 Thread safety without the GIL
.......................................

From Python 3.13 onward, the *note GIL: 164. can be disabled on the
*note free-threaded build: 176d.  In ctypes, reads and writes to a
single object concurrently is safe, but not across multiple objects:

          >>> number = c_int(42)
          >>> pointer_a = pointer(number)
          >>> pointer_b = pointer(number)

In the above, it's only safe for one object to read and write to the
address at once if the GIL is disabled.  So, ‘pointer_a’ can be shared
and written to across multiple threads, but only if ‘pointer_b’ is not
also attempting to do the same.  If this is an issue, consider using a
*note threading.Lock: 19f4. to synchronize access to memory:

          >>> import threading
          >>> lock = threading.Lock()
          >>> # Thread 1
          >>> with lock:
          ...    pointer_a.contents = 24
          >>> # Thread 2
          >>> with lock:
          ...    pointer_b.contents = 42


File: python.info,  Node: 型変換,  Next: 不完全型,  Prev: Thread safety without the GIL,  Up: ctypes チュートリアル

5.16.9.18 型変換
................

Usually, ctypes does strict type checking.  This means, if you have
‘POINTER(c_int)’ in the *note argtypes: 17c1. list of a function or as
the type of a member field in a structure definition, only instances of
exactly the same type are accepted.  There are some exceptions to this
rule, where ctypes accepts other objects.  For example, you can pass
compatible array instances instead of pointer types.  So, for
‘POINTER(c_int)’, ctypes accepts an array of c_int:

     >>> class Bar(Structure):
     ...     _fields_ = [("count", c_int), ("values", POINTER(c_int))]
     ...
     >>> bar = Bar()
     >>> bar.values = (c_int * 3)(1, 2, 3)
     >>> bar.count = 3
     >>> for i in range(bar.count):
     ...     print(bar.values[i])
     ...
     1
     2
     3
     >>>

In addition, if a function argument is explicitly declared to be a
pointer type (such as ‘POINTER(c_int)’) in *note argtypes: 17c1, an
object of the pointed type (‘c_int’ in this case) can be passed to the
function.  ctypes will apply the required *note byref(): 32fe.
conversion in this case automatically.

POINTER型フィールドを ‘NULL’ に設定するために、 ‘None’ を代入してもかま
いません。:

     >>> bar.values = None
     >>>

Sometimes you have instances of incompatible types.  In C, you can cast
one type into another type.  ‘ctypes’ provides a *note cast(): 330f.
function which can be used in the same way.  The ‘Bar’ structure defined
above accepts ‘POINTER(c_int)’ pointers or *note c_int: 32cf. arrays for
its ‘values’ field, but not instances of other types:

     >>> bar.values = (c_byte * 4)()
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: incompatible types, c_byte_Array_4 instance instead of LP_c_long instance
     >>>

このような場合には、 *note cast(): 330f. 関数が便利です。

*note cast(): 330f. 関数は ctypes インスタンスを異なる ctypes データ型を
指すポインタへキャストするために使えます。 *note cast(): 330f. は二つの
パラメータ、ある種のポインタかそのポインタへ変換できる ctypes オブジェク
トと、 ctypes ポインタ型を取ります。そして、第二引数のインスタンスを返し
ます。このインスタンスは第一引数と同じメモリブロックを参照しています:

     >>> a = (c_byte * 4)()
     >>> cast(a, POINTER(c_int))
     <ctypes.LP_c_long object at ...>
     >>>

したがって、 *note cast(): 330f. を ‘Bar’ 構造体の ‘values’ フィールドへ
代入するために使うことができます:

     >>> bar = Bar()
     >>> bar.values = cast((c_byte * 4)(), POINTER(c_int))
     >>> print(bar.values[0])
     0
     >>>


File: python.info,  Node: 不完全型,  Next: コールバック関数,  Prev: 型変換,  Up: ctypes チュートリアル

5.16.9.19 不完全型
..................

'不完全型' はメンバーがまだ指定されていない構造体、共用体もしくは配列で
す。 C では、前方宣言により指定され、後で定義されます。:

     struct cell; /* forward declaration */

     struct cell {
         char *name;
         struct cell *next;
     };

ctypes コードへの直接的な変換ではこうなるでしょう。しかし、動作しません:

     >>> class cell(Structure):
     ...     _fields_ = [("name", c_char_p),
     ...                 ("next", POINTER(cell))]
     ...
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
       File "<stdin>", line 2, in cell
     NameError: name 'cell' is not defined
     >>>

because the new ‘class cell’ is not available in the class statement
itself.  In ‘ctypes’, we can define the ‘cell’ class and set the *note
_fields_: 1936. attribute later, after the class statement:

     >>> from ctypes import *
     >>> class cell(Structure):
     ...     pass
     ...
     >>> cell._fields_ = [("name", c_char_p),
     ...                  ("next", POINTER(cell))]
     >>>

試してみましょう。 ‘cell’ のインスタンスを二つ作り、互いに参照し合うよう
にします。最後に、つながったポインタを何度かたどります。:

     >>> c1 = cell()
     >>> c1.name = b"foo"
     >>> c2 = cell()
     >>> c2.name = b"bar"
     >>> c1.next = pointer(c2)
     >>> c2.next = pointer(c1)
     >>> p = c1
     >>> for i in range(8):
     ...     print(p.name, end=" ")
     ...     p = p.next[0]
     ...
     foo bar foo bar foo bar foo bar
     >>>


File: python.info,  Node: コールバック関数,  Next: dllからエクスポートされた値へアクセスする,  Prev: 不完全型,  Up: ctypes チュートリアル

5.16.9.20 コールバック関数
..........................

‘ctypes’ allows creating C callable function pointers from Python
callables.  These are sometimes called 'callback functions'.

最初に、コールバック関数のためのクラスを作る必要があります。そのクラスに
は呼び出し規約、戻り値の型およびこの関数が受け取る引数の数と型についての
情報があります。

*note CFUNCTYPE(): 3313. ファクトリ関数は通常の ‘cdecl’ 呼び出し規約を用
いてコールバック関数のための型を作成します。 Windows では、 *note
WINFUNCTYPE(): 3314. ファクトリ関数が ‘stdcall’ 呼び出し規約を用いてコー
ルバック関数の型を作成します。

これらのファクトリ関数はともに最初の引数に戻り値の型、残りの引数としてコ
ールバック関数が想定する引数の型を渡して呼び出されます。

I will present an example here which uses the standard C library's
‘qsort()’ function, that is used to sort items with the help of a
callback function.  ‘qsort()’ will be used to sort an array of integers:

     >>> IntArray5 = c_int * 5
     >>> ia = IntArray5(5, 1, 7, 33, 99)
     >>> qsort = libc.qsort
     >>> qsort.restype = None
     >>>

‘qsort()’ must be called with a pointer to the data to sort, the number
of items in the data array, the size of one item, and a pointer to the
comparison function, the callback.  The callback will then be called
with two pointers to items, and it must return a negative integer if the
first item is smaller than the second, a zero if they are equal, and a
positive integer otherwise.

コールバック関数は整数へのポインタを受け取り、整数を返す必要があります。
まず、コールバック関数のための ‘type’ を作成します。:

     >>> CMPFUNC = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))
     >>>

まず初めに、これが受け取った変数を表示するだけのシンプルなコールバックで
す:

     >>> def py_cmp_func(a, b):
     ...     print("py_cmp_func", a[0], b[0])
     ...     return 0
     ...
     >>> cmp_func = CMPFUNC(py_cmp_func)
     >>>

結果は以下の通りです:

     >>> qsort(ia, len(ia), sizeof(c_int), cmp_func)
     py_cmp_func 5 1
     py_cmp_func 33 99
     py_cmp_func 7 33
     py_cmp_func 5 7
     py_cmp_func 1 7
     >>>

ここで 2 つの要素を実際に比較し、役に立つ結果を返します:

     >>> def py_cmp_func(a, b):
     ...     print("py_cmp_func", a[0], b[0])
     ...     return a[0] - b[0]
     ...
     >>>
     >>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func))
     py_cmp_func 5 1
     py_cmp_func 33 99
     py_cmp_func 7 33
     py_cmp_func 1 7
     py_cmp_func 5 7
     >>>

簡単に確認できるように、配列を次のようにソートしました:

     >>> for i in ia: print(i, end=" ")
     ...
     1 5 7 33 99
     >>>

関数ファクトリはデコレータファクトリとしても使えるので、次のようにも書け
ます:

     >>> @CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))
     ... def py_cmp_func(a, b):
     ...     print("py_cmp_func", a[0], b[0])
     ...     return a[0] - b[0]
     ...
     >>> qsort(ia, len(ia), sizeof(c_int), py_cmp_func)
     py_cmp_func 5 1
     py_cmp_func 33 99
     py_cmp_func 7 33
     py_cmp_func 1 7
     py_cmp_func 5 7
     >>>

     注釈: Make sure you keep references to *note CFUNCTYPE(): 3313.
     objects as long as they are used from C code.  ‘ctypes’ doesn't,
     and if you don't, they may be garbage collected, crashing your
     program when a callback is made.

     同様に、コールバック関数が Python の管理外 (例えば、コールバックを
     呼び出す外部のコード) で作られたスレッドで呼び出された場合、 ctypes
     は全ての呼び出しごとに新しいダミーの Python スレッドを作成すること
     に注意してください。 この動作はほとんどの目的に対して正しいものです
     が、同じ C スレッドからの呼び出しだったとしても、 *note
     threading.local: 185f. で格納された値は異なるコールバックをまたいで
     生存は 'しません' 。


File: python.info,  Node: dllからエクスポートされた値へアクセスする,  Next: びっくり仰天,  Prev: コールバック関数,  Up: ctypes チュートリアル

5.16.9.21 dllからエクスポートされた値へアクセスする
...................................................

Some shared libraries not only export functions, they also export
variables.  An example in the Python library itself is the *note
Py_Version: 381, Python runtime version number encoded in a single
constant integer.

‘ctypes’ can access values like this with the *note in_dll(): 3317.
class methods of the type.  'pythonapi' is a predefined symbol giving
access to the Python C api:

     >>> version = ctypes.c_int.in_dll(ctypes.pythonapi, "Py_Version")
     >>> print(hex(version.value))
     0x30c00a0

ポインタの使い方を説明する拡張例では、 Python がエクスポートする *note
PyImport_FrozenModules: 3318. ポインタにアクセスします。

この値のドキュメントから引用すると:

     このポインタは *note _frozen: 979. のレコードからなり、終端の要素の
     メンバが ‘NULL’ かゼロになっているような配列を指すよう初期化されま
     す。 フリーズされたモジュールをインポートするとき、このテーブルを検
     索します。 サードパーティ製のコードからこのポインタに仕掛けを講じて
     、動的に生成されたフリーズ化モジュールの集合を提供するようにできま
     す。

So manipulating this pointer could even prove useful.  To restrict the
example size, we show only how this table can be read with ‘ctypes’:

     >>> from ctypes import *
     >>>
     >>> class struct_frozen(Structure):
     ...     _fields_ = [("name", c_char_p),
     ...                 ("code", POINTER(c_ubyte)),
     ...                 ("size", c_int),
     ...                 ("get_code", POINTER(c_ubyte)),  # Function pointer
     ...                ]
     ...
     >>>

私たちは *note _frozen: 979. データ型を定義済みなので、このテーブルを指
すポインタを得ることができます。:

     >>> FrozenTable = POINTER(struct_frozen)
     >>> table = FrozenTable.in_dll(pythonapi, "_PyImport_FrozenBootstrap")
     >>>

‘table’ が ‘struct_frozen’ レコードの配列への ‘pointer’ なので、その配列
に対して反復処理を行えます。しかし、ループが確実に終了するようにする必要
があります。なぜなら、ポインタに大きさの情報がないからです。遅かれ早かれ
、アクセス違反か何かでクラッシュすることになるでしょう。 ‘NULL’ エントリ
に達したときはループを抜ける方が良いです:

     >>> for item in table:
     ...     if item.name is None:
     ...         break
     ...     print(item.name.decode("ascii"), item.size)
     ...
     _frozen_importlib 31764
     _frozen_importlib_external 41499
     zipimport 12345
     >>>

標準 Python はフローズンモジュールとフローズンパッケージ (負の ‘size’ メ
ンバーで表されています) を持っているという事実はあまり知られておらず、テ
ストにだけ使われています。例えば、 ‘import __hello__’ を試してみてくださ
い。


File: python.info,  Node: びっくり仰天,  Next: 可変サイズのデータ型,  Prev: dllからエクスポートされた値へアクセスする,  Up: ctypes チュートリアル

5.16.9.22 びっくり仰天
......................

There are some edges in ‘ctypes’ where you might expect something other
than what actually happens.

次に示す例について考えてみてください。:

     >>> from ctypes import *
     >>> class POINT(Structure):
     ...     _fields_ = ("x", c_int), ("y", c_int)
     ...
     >>> class RECT(Structure):
     ...     _fields_ = ("a", POINT), ("b", POINT)
     ...
     >>> p1 = POINT(1, 2)
     >>> p2 = POINT(3, 4)
     >>> rc = RECT(p1, p2)
     >>> print(rc.a.x, rc.a.y, rc.b.x, rc.b.y)
     1 2 3 4
     >>> # now swap the two points
     >>> rc.a, rc.b = rc.b, rc.a
     >>> print(rc.a.x, rc.a.y, rc.b.x, rc.b.y)
     3 4 3 4
     >>>

うーん、最後の文に ‘3 4 1 2’ と表示されることを期待していたはずです。何
が起きたのでしょうか?  上の行の ‘rc.a, rc.b = rc.b, rc.a’ の各段階はこの
ようになります。:

     >>> temp0, temp1 = rc.b, rc.a
     >>> rc.a = temp0
     >>> rc.b = temp1
     >>>

‘temp0’ と ‘temp1’ は前記の ‘rc’ オブジェクトの内部バッファでまだ使われ
ているオブジェクトです。したがって、 ‘rc.a = temp0’ を実行すると ‘temp0’
のバッファ内容が ‘rc’ のバッファへコピーされます。さらに、これは ‘temp1’
の内容を変更します。そのため、最後の代入 ‘rc.b = temp1’ は、期待する結果
にはならないのです。

Structure 、 Union および Array のサブオブジェクトを取り出しても、そのサ
ブオブジェクトが 'コピー' されるわけではなく、ルートオブジェクトの内部バ
ッファにアクセスするラッパーオブジェクトを取り出すことを覚えておいてくだ
さい。

期待とは違う振る舞いをする別の例はこれです:

     >>> s = c_char_p()
     >>> s.value = b"abc def ghi"
     >>> s.value
     b'abc def ghi'
     >>> s.value is s.value
     False
     >>>

     注釈: *note c_char_p: 1a57. からインスタンス化されたオブジェクトは
     、bytes または整数に設定された値しか持てません。

なぜ ‘False’ と表示されるのでしょうか?  ctypes インスタンスはメモリと、
メモリの内容にアクセスするいくつかの *note descriptor: 1881. (記述子)を
含むオブジェクトです。メモリブロックに Python オブジェクトを保存してもオ
ブジェクト自身が保存される訳ではなく、オブジェクトの ‘contents’ が保存さ
れます。その contents に再アクセスすると新しい Python オブジェクトがその
度に作られます。


File: python.info,  Node: 可変サイズのデータ型,  Prev: びっくり仰天,  Up: ctypes チュートリアル

5.16.9.23 可変サイズのデータ型
..............................

‘ctypes’ provides some support for variable-sized arrays and structures.

*note resize(): 331d. 関数は既存の ctypes オブジェクトのメモリバッファの
サイズを変更したい場合に使えます。この関数は第一引数にオブジェクト、第二
引数に要求されたサイズをバイト単位で指定します。メモリブロックはオブジェ
クト型で指定される通常のメモリブロックより小さくすることはできません。こ
れをやろうとすると、 *note ValueError: 2ec. が送出されます。:

     >>> short_array = (c_short * 4)()
     >>> print(sizeof(short_array))
     8
     >>> resize(short_array, 4)
     Traceback (most recent call last):
         ...
     ValueError: minimum size is 8
     >>> resize(short_array, 32)
     >>> sizeof(short_array)
     32
     >>> sizeof(type(short_array))
     8
     >>>

これはこれで上手くいっていますが、この配列の追加した要素へどうやってアク
セスするのでしょうか?  この型は要素の数が 4 個であるとまだ認識しているの
で、他の要素にアクセスするとエラーになります。:

     >>> short_array[:]
     [0, 0, 0, 0]
     >>> short_array[7]
     Traceback (most recent call last):
         ...
     IndexError: invalid index
     >>>

Another way to use variable-sized data types with ‘ctypes’ is to use the
dynamic nature of Python, and (re-)define the data type after the
required size is already known, on a case by case basis.


File: python.info,  Node: ctypesリファレンス,  Prev: ctypes チュートリアル,  Up: ctypes --- Python 用の外部関数ライブラリ

5.16.9.24 ctypesリファレンス
............................

* Menu:

* 共有ライブラリを見つける::
* Listing loaded shared libraries::
* 共有ライブラリをロードする::
* 外部関数::
* 関数プロトタイプ::
* ユーティリティー関数::
* データ型: データ型<3>.
* 基本データ型: 基本データ型<2>.
* 構造化データ型::
* 配列とポインタ::
* 例外: 例外<10>.


File: python.info,  Node: 共有ライブラリを見つける,  Next: Listing loaded shared libraries,  Up: ctypesリファレンス

5.16.9.25 共有ライブラリを見つける
..................................

コンパイルされる言語でプログラミングしている場合、共有ライブラリはプログ
ラムをコンパイル/リンクしているときと、そのプログラムが動作しているとき
にアクセスされます。

The purpose of the *note find_library(): f45. function is to locate a
library in a way similar to what the compiler or runtime loader does (on
platforms with several versions of a shared library the most recent
should be loaded), while the ctypes library loaders act like when a
program is run, and call the runtime loader directly.

The ‘ctypes.util’ module provides a function which can help to determine
the library to load.

 -- データ: ctypes.util.find_library (name)

     ライブラリを見つけてパス名を返そうと試みます。 'name' は ‘lib’ のよ
     うな接頭辞、 ‘.so’, ‘.dylib’ のような接尾辞、あるいは、バージョン番
     号が何も付いていないライブラリの名前です (これは posix リンカのオプ
     ション ‘-l’ に使われている形式です)。 ライブラリが見つからないとき
     は ‘None’ を返します。

厳密な機能はシステムに依存します。

On Linux, *note find_library(): f45. tries to run external programs
(‘/sbin/ldconfig’, ‘gcc’, ‘objdump’ and ‘ld’) to find the library file.
It returns the filename of the library file.

Note that if the output of these programs does not correspond to the
dynamic linker used by Python, the result of this function may be
misleading.

バージョン 3.6 で変更: Linux では、ライブラリを検索する際に、他の方法で
ライブラリが見つけられない場合は、 ‘LD_LIBRARY_PATH’ 環境変数の値が使わ
れます

ここに例があります:

     >>> from ctypes.util import find_library
     >>> find_library("m")
     'libm.so.6'
     >>> find_library("c")
     'libc.so.6'
     >>> find_library("bz2")
     'libbz2.so.1.0'
     >>>

On macOS and Android, *note find_library(): f45. uses the system's
standard naming schemes and paths to locate the library, and returns a
full pathname if successful:

     >>> from ctypes.util import find_library
     >>> find_library("c")
     '/usr/lib/libc.dylib'
     >>> find_library("m")
     '/usr/lib/libm.dylib'
     >>> find_library("bz2")
     '/usr/lib/libbz2.dylib'
     >>> find_library("AGL")
     '/System/Library/Frameworks/AGL.framework/AGL'
     >>>

On Windows, *note find_library(): f45. searches along the system search
path, and returns the full pathname, but since there is no predefined
naming scheme a call like ‘find_library("c")’ will fail and return
‘None’.

If wrapping a shared library with ‘ctypes’, it 'may' be better to
determine the shared library name at development time, and hardcode that
into the wrapper module instead of using *note find_library(): f45. to
locate the library at runtime.


File: python.info,  Node: Listing loaded shared libraries,  Next: 共有ライブラリをロードする,  Prev: 共有ライブラリを見つける,  Up: ctypesリファレンス

5.16.9.26 Listing loaded shared libraries
.........................................

When writing code that relies on code loaded from shared libraries, it
can be useful to know which shared libraries have already been loaded
into the current process.

The ‘ctypes.util’ module provides the *note dllist(): 1f0. function,
which calls the different APIs provided by the various platforms to help
determine which shared libraries have already been loaded into the
current process.

The exact output of this function will be system dependent.  On most
platforms, the first entry of this list represents the current process
itself, which may be an empty string.  For example, on glibc-based
Linux, the return may look like:

     >>> from ctypes.util import dllist
     >>> dllist()
     ['', 'linux-vdso.so.1', '/lib/x86_64-linux-gnu/libm.so.6', '/lib/x86_64-linux-gnu/libc.so.6', ... ]


File: python.info,  Node: 共有ライブラリをロードする,  Next: 外部関数,  Prev: Listing loaded shared libraries,  Up: ctypesリファレンス

5.16.9.27 共有ライブラリをロードする
....................................

共有ライブラリを Python プロセスへロードする方法はいくつかあります。一つ
の方法は下記のクラスの一つをインスタンス化することです:

 -- クラス: ctypes.CDLL (name, mode=DEFAULT_MODE, handle=None,
          use_errno=False, use_last_error=False, winmode=None)

     このクラスのインスタンスはロードされた共有ライブラリをあらわします
     。これらのライブラリの関数は標準 C 呼び出し規約を使用し、 int を返
     すと仮定されます。

     On Windows creating a *note CDLL: bdc. instance may fail even if
     the DLL name exists.  When a dependent DLL of the loaded DLL is not
     found, a *note OSError: 2c0. error is raised with the message
     '"[WinError 126] The specified module could not be found".'  This
     error message does not contain the name of the missing DLL because
     the Windows API does not return this information making this error
     hard to diagnose.  To resolve this error and determine which DLL is
     not found, you need to find the list of dependent DLLs and
     determine which one is not found using Windows debugging and
     tracing tools.

     バージョン 3.12 で変更: The 'name' parameter can now be a *note
     path-like object: 5a1.

参考
....

Microsoft DUMPBIN tool(1) - A tool to find DLL dependents.

 -- クラス: ctypes.OleDLL (name, mode=DEFAULT_MODE, handle=None,
          use_errno=False, use_last_error=False, winmode=None)

     Instances of this class represent loaded shared libraries,
     functions in these libraries use the ‘stdcall’ calling convention,
     and are assumed to return the windows specific *note HRESULT: 3326.
     code.  *note HRESULT: 3326. values contain information specifying
     whether the function call failed or succeeded, together with
     additional error code.  If the return value signals a failure, an
     *note OSError: 2c0. is automatically raised.

     *note Availability: 213f.: Windows

     バージョン 3.3 で変更: *note WindowsError: 1260. used to be raised,
     which is now an alias of *note OSError: 2c0.

     バージョン 3.12 で変更: The 'name' parameter can now be a *note
     path-like object: 5a1.

 -- クラス: ctypes.WinDLL (name, mode=DEFAULT_MODE, handle=None,
          use_errno=False, use_last_error=False, winmode=None)

     Instances of this class represent loaded shared libraries,
     functions in these libraries use the ‘stdcall’ calling convention,
     and are assumed to return int by default.

     *note Availability: 213f.: Windows

     バージョン 3.12 で変更: The 'name' parameter can now be a *note
     path-like object: 5a1.

これらのライブラリがエクスポートするどの関数でも呼び出す前に Python
*note global interpreter lock: 474. は解放され、後でまた獲得されます。

 -- クラス: ctypes.PyDLL (name, mode=DEFAULT_MODE, handle=None)

     Python GIL が関数呼び出しの間解放 'されず' 、関数実行の後に Python
     エラーフラグがチェックされるということを除けば、このクラスのインス
     タンスは *note CDLL: bdc. インスタンスのように振る舞います。エラー
     フラグがセットされた場合、 Python 例外が送出されます。

     要するに、これは Python C api 関数を直接呼び出すのに便利だというだ
     けです。

     バージョン 3.12 で変更: The 'name' parameter can now be a *note
     path-like object: 5a1.

All these classes can be instantiated by calling them with at least one
argument, the pathname of the shared library.  If you have an existing
handle to an already loaded shared library, it can be passed as the
‘handle’ named parameter, otherwise the underlying platform's ‘dlopen()’
or ‘LoadLibrary()’ function is used to load the library into the
process, and to get a handle to it.

'mode' パラメータを使うと、ライブラリがどうやってロードされたかを特定で
きます。 詳細は ‘dlopen(3)(2)’ マニュアルページを参考にしてください。
Windows では 'mode' は無視されます。 POSIX システムでは RTLD_NOW が常に
追加され、設定変更はできません。

The 'use_errno' parameter, when set to true, enables a ctypes mechanism
that allows accessing the system *note errno: 5b. error number in a safe
way.  ‘ctypes’ maintains a thread-local copy of the system's *note
errno: 5b. variable; if you call foreign functions created with
‘use_errno=True’ then the *note errno: 5b. value before the function
call is swapped with the ctypes private copy, the same happens
immediately after the function call.

*note ctypes.get_errno(): 3327. 関数は ctypes のプライベートコピーの値を
返します。そして、 *note ctypes.set_errno(): 3328. 関数は ctypes のプラ
イベートコピーを置き換え、以前の値を返します。

The 'use_last_error' parameter, when set to true, enables the same
mechanism for the Windows error code which is managed by the *note
GetLastError(): 32fa. and ‘SetLastError()’ Windows API functions; *note
ctypes.get_last_error(): 3329. and *note ctypes.set_last_error(): 332a.
are used to request and change the ctypes private copy of the windows
error code.

The 'winmode' parameter is used on Windows to specify how the library is
loaded (since 'mode' is ignored).  It takes any value that is valid for
the Win32 API ‘LoadLibraryEx’ flags parameter.  When omitted, the
default is to use the flags that result in the most secure DLL load,
which avoids issues such as DLL hijacking.  Passing the full path to the
DLL is the safest way to ensure the correct library and dependencies are
loaded.

バージョン 3.8 で変更: 'winmode' 引数が追加されました。

 -- データ: ctypes.RTLD_GLOBAL

     'mode' パラメータとして使うフラグ。このフラグが利用できないプラット
     フォームでは、整数のゼロと定義されています。

 -- データ: ctypes.RTLD_LOCAL

     'mode' パラメータとして使うフラグ。これが利用できないプラットフォー
     ムでは、 'RTLD_GLOBAL' と同様です。

 -- データ: ctypes.DEFAULT_MODE

     共有ライブラリをロードするために使われるデフォルトモード。 OSX 10.3
     では 'RTLD_GLOBAL' であり、そうでなければ 'RTLD_LOCAL' と同じです。

これらのクラスのインスタンスには公開メソッドはありません。 共有ライブラ
リからエクスポートされた関数は、属性として、もしくは添字でアクセスできま
す。 属性を通した関数へのアクセスは結果がキャッシュされ、従って繰り返し
アクセスされると毎回同じオブジェクトを返すことに注意してください。 それ
とは反対に、添字を通したアクセスは毎回新しいオブジェクトを返します:

     >>> from ctypes import CDLL
     >>> libc = CDLL("libc.so.6")  # On Linux
     >>> libc.time == libc.time
     True
     >>> libc['time'] == libc['time']
     False

次に述べる公開属性が利用できます。それらの名前はエクスポートされた関数名
に衝突しないように下線で始まります。:

 -- の属性: PyDLL._handle

     ライブラリへのアクセスに用いられるシステムハンドル。

 -- の属性: PyDLL._name

     コンストラクタに渡されたライブラリの名前。

Shared libraries can also be loaded by using one of the prefabricated
objects, which are instances of the *note LibraryLoader: 332d. class,
either by calling the *note LoadLibrary(): 32d3. method, or by
retrieving the library as attribute of the loader instance.

 -- クラス: ctypes.LibraryLoader (dlltype)

     共有ライブラリをロードするクラス。 'dlltype' は *note CDLL: bdc. 、
     *note PyDLL: 1ae4. 、 *note WinDLL: 1ae3. もしくは *note OleDLL:
     1ae2. 型の一つであるべきです。

     ‘__getattr__()’ has special behavior: It allows loading a shared
     library by accessing it as attribute of a library loader instance.
     The result is cached, so repeated attribute accesses return the
     same library each time.

      -- メソッド: LoadLibrary (name)

          共有ライブラリをプロセスへロードし、それを返します。このメソッ
          ドはライブラリの新しいインスタンスを常に返します。

これらの前もって作られたライブラリローダーを利用することができます。:

 -- データ: ctypes.cdll

     *note CDLL: bdc. インスタンスを作ります。

 -- データ: ctypes.windll

     Creates *note WinDLL: 1ae3. instances.

     *note Availability: 213f.: Windows

 -- データ: ctypes.oledll

     Creates *note OleDLL: 1ae2. instances.

     *note Availability: 213f.: Windows

 -- データ: ctypes.pydll

     *note PyDLL: 1ae4. インスタンスを作ります。

C Python api に直接アクセスするために、すぐに使用できる Python 共有ライ
ブラリオブジェクトが次のように用意されています。

 -- データ: ctypes.pythonapi

     An instance of *note PyDLL: 1ae4. that exposes Python C API
     functions as attributes.  Note that all these functions are assumed
     to return C int, which is of course not always the truth, so you
     have to assign the correct ‘restype’ attribute to use these
     functions.

Loading a library through any of these objects raises an *note auditing
event: 1c6e. ‘ctypes.dlopen’ with string argument ‘name’, the name used
to load the library.

Accessing a function on a loaded library raises an auditing event
‘ctypes.dlsym’ with arguments ‘library’ (the library object) and ‘name’
(the symbol's name as a string or integer).

In cases when only the library handle is available rather than the
object, accessing a function raises an auditing event
‘ctypes.dlsym/handle’ with arguments ‘handle’ (the raw library handle)
and ‘name’.

   ---------- Footnotes ----------

   (1) https://docs.microsoft.com/cpp/build/reference/dependents

   (2) https://manpages.debian.org/dlopen(3)


File: python.info,  Node: 外部関数,  Next: 関数プロトタイプ,  Prev: 共有ライブラリをロードする,  Up: ctypesリファレンス

5.16.9.28 外部関数
..................

As explained in the previous section, foreign functions can be accessed
as attributes of loaded shared libraries.  The function objects created
in this way by default accept any number of arguments, accept any ctypes
data instances as arguments, and return the default result type
specified by the library loader.

They are instances of a private local class ‘_FuncPtr’ (not exposed in
‘ctypes’) which inherits from the private *note _CFuncPtr: 18d2. class:

     >>> import ctypes
     >>> lib = ctypes.CDLL(None)
     >>> issubclass(lib._FuncPtr, ctypes._CFuncPtr)
     True
     >>> lib._FuncPtr is ctypes._CFuncPtr
     False

 -- クラス: ctypes._CFuncPtr

     C の呼び出し可能外部関数のためのベースクラス。

     外部関数のインスタンスも C 互換データ型です。それらは C の関数ポイ
     ンタを表しています。

     この振る舞いは外部関数オブジェクトの特別な属性に代入することによっ
     て、カスタマイズすることができます。

      -- の属性: restype

          外部関数の結果の型を指定するために ctypes 型を代入する。何も返
          さない関数を表す void に対しては ‘None’ を使います。

          It is possible to assign a callable Python object that is not
          a ctypes type, in this case the function is assumed to return
          a C int, and the callable will be called with this integer,
          allowing further processing or error checking.  Using this is
          deprecated, for more flexible post processing or error
          checking use a ctypes data type as ‘restype’ and assign a
          callable to the *note errcheck: 32fb. attribute.

      -- の属性: argtypes

          関数が受け取る引数の型を指定するために ctypes 型のタプルを代入
          します。‘stdcall’ 呼び出し規約を使う関数はこのタプルの長さと同
          じ数の引数で呼び出されます。C 呼び出し規約を使う関数は、追加の
          不特定の引数も取ります。

          When a foreign function is called, each actual argument is
          passed to the *note from_param(): 32f6. class method of the
          items in the *note argtypes: 17c1. tuple, this method allows
          adapting the actual argument to an object that the foreign
          function accepts.  For example, a *note c_char_p: 1a57. item
          in the *note argtypes: 17c1. tuple will convert a string
          passed as argument into a bytes object using ctypes conversion
          rules.

          New: It is now possible to put items in argtypes which are not
          ctypes types, but each item must have a *note from_param():
          32f6. method which returns a value usable as argument
          (integer, string, ctypes instance).  This allows defining
          adapters that can adapt custom objects as function parameters.

      -- の属性: errcheck

          Python 関数または他の呼び出し可能オブジェクトをこの属性に代入
          します。呼び出し可能オブジェクトは三つ以上の引数とともに呼び出
          されます。

           -- の関数: callable (result, func, arguments)

               'result' is what the foreign function returns, as
               specified by the ‘restype’ attribute.

               'func' は外部関数オブジェクト自身で、これにより複数の関数
               の処理結果をチェックまたは後処理するために、同じ呼び出し
               可能オブジェクトを再利用できるようになります。

               'arguments' は関数呼び出しに最初に渡されたパラメータが入
               ったタプルです。これにより使われた引数に基づいた特別な振
               る舞いをさせることができるようになります。

          この関数が返すオブジェクトは外部関数呼び出しから返された値でし
          ょう。しかし、戻り値をチェックして、外部関数呼び出しが失敗して
          いるなら例外を送出させることもできます。

On Windows, when a foreign function call raises a system exception (for
example, due to an access violation), it will be captured and replaced
with a suitable Python exception.  Further, an auditing event
‘ctypes.set_exception’ with argument ‘code’ will be raised, allowing an
audit hook to replace the exception with its own.

Some ways to invoke foreign function calls as well as some of the
functions in this module may raise an auditing event
‘ctypes.call_function’ with arguments ‘function pointer’ and
‘arguments’.


File: python.info,  Node: 関数プロトタイプ,  Next: ユーティリティー関数,  Prev: 外部関数,  Up: ctypesリファレンス

5.16.9.29 関数プロトタイプ
..........................

外部関数は関数プロトタイプをインスタンス化することによって作成されます。
関数プロトタイプは C の関数プロトタイプと似ています。実装は定義せずに、
関数 (返り値の型、引数の型、呼び出し規約) を記述します。 ファクトリ関数
は、その関数に要求される返り値の型と引数の型とともに呼び出されます。そし
てこの関数はデコレータファクトリとしても使え、 ‘@wrapper’ 構文で他の関数
に適用できます。 例については *note コールバック関数: 3312. を参照してく
ださい。

 -- の関数: ctypes.CFUNCTYPE (restype, *argtypes, use_errno=False,
          use_last_error=False)

     返された関数プロトタイプは標準 C 呼び出し規約をつかう関数を作成しま
     す。関数は呼び出されている間 GIL を解放します。 'use_errno' が真に
     設定されれば、呼び出しの前後で System 変数 *note errno: 5b. の
     ctypesプライベートコピーは本当の *note errno: 5b. の値と交換されま
     す。 'use_last_error' も Windows エラーコードに対するのと同様です。

 -- の関数: ctypes.WINFUNCTYPE (restype, *argtypes, use_errno=False,
          use_last_error=False)

     The returned function prototype creates functions that use the
     ‘stdcall’ calling convention.  The function will release the GIL
     during the call.  'use_errno' and 'use_last_error' have the same
     meaning as above.

     *note Availability: 213f.: Windows

 -- の関数: ctypes.PYFUNCTYPE (restype, *argtypes)

     返された関数プロトタイプは Python 呼び出し規約を使う関数を作成しま
     す。関数は呼び出されている間 GIL を解放 'しません'。

ファクトリ関数によって作られた関数プロトタイプは呼び出しのパラメータの型
と数に依存した別の方法でインスタンス化することができます。 :

 -- の関数: prototype (address)

     指定されたアドレス(整数でなくてはなりません)の外部関数を返します。

 -- の関数: prototype (callable)

     Python の 'callable' から C の呼び出し可能関数(コールバック関数) を
     作成します。

 -- の関数: prototype (func_spec[, paramflags])

     共有ライブラリがエクスポートしている外部関数を返します。
     'func_spec' は 2 要素タプル ‘(name_or_ordinal, library)’ でなければ
     なりません。第一要素はエクスポートされた関数の名前である文字列、ま
     たはエクスポートされた関数の序数である小さい整数です。第二要素は共
     有ライブラリインスタンスです。

 -- の関数: prototype (vtbl_index, name[, paramflags[, iid]])

     COM メソッドを呼び出す外部関数を返します。 'vtbl_index' は仮想関数
     テーブルのインデックスで、非負の小さい整数です。 'name' は COM メソ
     ッドの名前です。 'iid' はオプションのインターフェイス識別子へのポイ
     ンタで、拡張されたエラー情報の提供のために使われます。

     If 'iid' is not specified, an *note OSError: 2c0. is raised if the
     COM method call fails.  If 'iid' is specified, a *note COMError:
     1e9. is raised instead.

     COM methods use a special calling convention: They require a
     pointer to the COM interface as first argument, in addition to
     those parameters that are specified in the ‘argtypes’ tuple.

     *note Availability: 213f.: Windows

オプションの 'paramflags' パラメータは上述した機能より多機能な外部関数ラ
ッパーを作成します。

'paramflags' must be a tuple of the same length as *note argtypes: 17c1.

このタプルの個々の要素はパラメータについてのより詳細な情報を持ち、 1 、
2 もしくは 3 要素を含むタプルでなければなりません。

第一要素はパラメータについてのフラグの組み合わせを含んだ整数です。

     1

          入力パラメータを関数に指定します。

     2

          出力パラメータ。外部関数が値を書き込みます。

     4

          デフォルトで整数ゼロになる入力パラメータ。

オプションの第二要素はパラメータ名の文字列です。これが指定された場合は、
外部関数を名前付きパラメータで呼び出すことができます。

オプションの第三要素はこのパラメータのデフォルト値です。

The following example demonstrates how to wrap the Windows ‘MessageBoxW’
function so that it supports default parameters and named arguments.
The C declaration from the windows header file is this:

     WINUSERAPI int WINAPI
     MessageBoxW(
         HWND hWnd,
         LPCWSTR lpText,
         LPCWSTR lpCaption,
         UINT uType);

Here is the wrapping with ‘ctypes’:

     >>> from ctypes import c_int, WINFUNCTYPE, windll
     >>> from ctypes.wintypes import HWND, LPCWSTR, UINT
     >>> prototype = WINFUNCTYPE(c_int, HWND, LPCWSTR, LPCWSTR, UINT)
     >>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", "Hello from ctypes"), (1, "flags", 0)
     >>> MessageBox = prototype(("MessageBoxW", windll.user32), paramflags)

これで外部関数の ‘MessageBox’ を次のような方法で呼び出すことができるよう
になりました:

     >>> MessageBox()
     >>> MessageBox(text="Spam, spam, spam")
     >>> MessageBox(flags=2, text="foo bar")

二番目の例は出力パラメータについて説明します。 win32 の ‘GetWindowRect’
関数は、指定されたウィンドウの大きさを呼び出し側が与える ‘RECT’ 構造体へ
コピーすることで取り出します。 C の宣言はこうです。:

     WINUSERAPI BOOL WINAPI
     GetWindowRect(
          HWND hWnd,
          LPRECT lpRect);

Here is the wrapping with ‘ctypes’:

     >>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError
     >>> from ctypes.wintypes import BOOL, HWND, RECT
     >>> prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT))
     >>> paramflags = (1, "hwnd"), (2, "lprect")
     >>> GetWindowRect = prototype(("GetWindowRect", windll.user32), paramflags)
     >>>

出力パラメータを持つ関数は、単一のパラメータがある場合にはその出力パラメ
ータ値を、複数のパラメータがある場合には出力パラメータ値が入ったタプルを
、それぞれ自動的に返します。そのため、GetWindowRect 関数は呼び出されると
RECT インスタンスを返します。

Output parameters can be combined with the *note errcheck: 32fb.
protocol to do further output processing and error checking.  The win32
‘GetWindowRect’ api function returns a ‘BOOL’ to signal success or
failure, so this function could do the error checking, and raises an
exception when the api call failed:

     >>> def errcheck(result, func, args):
     ...     if not result:
     ...         raise WinError()
     ...     return args
     ...
     >>> GetWindowRect.errcheck = errcheck
     >>>

If the *note errcheck: 32fb. function returns the argument tuple it
receives unchanged, ‘ctypes’ continues the normal processing it does on
the output parameters.  If you want to return a tuple of window
coordinates instead of a ‘RECT’ instance, you can retrieve the fields in
the function and return them instead, the normal processing will no
longer take place:

     >>> def errcheck(result, func, args):
     ...     if not result:
     ...         raise WinError()
     ...     rc = args[1]
     ...     return rc.left, rc.top, rc.bottom, rc.right
     ...
     >>> GetWindowRect.errcheck = errcheck
     >>>


File: python.info,  Node: ユーティリティー関数,  Next: データ型<3>,  Prev: 関数プロトタイプ,  Up: ctypesリファレンス

5.16.9.30 ユーティリティー関数
..............................

 -- の関数: ctypes.addressof (obj)

     メモリバッファのアドレスを示す整数を返します。 'obj' は ctypes 型の
     インスタンスでなければなりません。

     引数 ‘obj’ を指定して *note 監査イベント: 1c6e. ‘ctypes.addressof’
     を送出します。

 -- の関数: ctypes.alignment (obj_or_type)

     ctypes 型のアライメントの必要条件を返します。 'obj_or_type' は
     ctypes 型またはインスタンスでなければなりません。

 -- の関数: ctypes.byref (obj[, offset])

     'obj' (ctypes 型のインスタンスでなければならない) への軽量ポインタ
     を返します。 'offset' はデフォルトでは 0 で、内部ポインターへ加算さ
     れる整数です。

     ‘byref(obj, offset)’ は、 C コードとしては、以下のようにみなされま
     す。:

          (((char *)&obj) + offset)

     返されるオブジェクトは外部関数呼び出しのパラメータとしてのみ使用で
     きます。‘pointer(obj)’ と似たふるまいをしますが、作成が非常に速く行
     えます。

 -- の関数: ctypes.CopyComPointer (src, dst)

     Copies a COM pointer from 'src' to 'dst' and returns the Windows
     specific ‘HRESULT’ value.

     If 'src' is not ‘NULL’, its ‘AddRef’ method is called, incrementing
     the reference count.

     In contrast, the reference count of 'dst' will not be decremented
     before assigning the new value.  Unless 'dst' is ‘NULL’, the caller
     is responsible for decrementing the reference count by calling its
     ‘Release’ method when necessary.

     *note Availability: 213f.: Windows

     Added in version 3.14.

 -- の関数: ctypes.cast (obj, type)

     この関数は C のキャスト演算子に似ています。'obj' と同じメモリブロッ
     クを指している 'type' の新しいインスタンスを返します。'type' はポイ
     ンタ型でなければならず、'obj' はポインタとして解釈できるオブジェク
     トでなければなりません。

 -- の関数: ctypes.create_string_buffer (init, size=None)

 -- の関数: ctypes.create_string_buffer (size)

     この関数は変更可能な文字バッファを作成します。返されるオブジェクト
     は *note c_char: 32db. の ctypes 配列です。

     If 'size' is given (and not ‘None’), it must be an *note int: 19b.
     It specifies the size of the returned array.

     If the 'init' argument is given, it must be *note bytes: 192.  It
     is used to initialize the array items.  Bytes not initialized this
     way are set to zero (NUL).

     If 'size' is not given (or if it is ‘None’), the buffer is made one
     element larger than 'init', effectively adding a NUL terminator.

     If both arguments are given, 'size' must not be less than
     ‘len(init)’.

          警告: If 'size' is equal to ‘len(init)’, a NUL terminator is
          not added.  Do not treat such a buffer as a C string.

     例えば:

          >>> bytes(create_string_buffer(2))
          b'\x00\x00'
          >>> bytes(create_string_buffer(b'ab'))
          b'ab\x00'
          >>> bytes(create_string_buffer(b'ab', 2))
          b'ab'
          >>> bytes(create_string_buffer(b'ab', 4))
          b'ab\x00\x00'
          >>> bytes(create_string_buffer(b'abcdef', 2))
          Traceback (most recent call last):
             ...
          ValueError: byte string too long

     引数 ‘init’, ‘size’ を指定して *note 監査イベント: 1c6e.
     ‘ctypes.create_string_buffer’ を送出します。

 -- の関数: ctypes.create_unicode_buffer (init, size=None)

 -- の関数: ctypes.create_unicode_buffer (size)

     この関数は変更可能な Unicode 文字バッファを作成します。返されるオブ
     ジェクトは *note c_wchar: 32dc. の ctypes 配列です。

     The function takes the same arguments as *note
     create_string_buffer(): 32ed. except 'init' must be a string and
     'size' counts *note c_wchar: 32dc.

     引数 ‘init’, ‘size’ を指定して *note 監査イベント: 1c6e.
     ‘ctypes.create_unicode_buffer’ を送出します。

 -- の関数: ctypes.DllCanUnloadNow ()

     This function is a hook which allows implementing in-process COM
     servers with ctypes.  It is called from the DllCanUnloadNow
     function that the _ctypes extension dll exports.

     *note Availability: 213f.: Windows

 -- の関数: ctypes.DllGetClassObject ()

     This function is a hook which allows implementing in-process COM
     servers with ctypes.  It is called from the DllGetClassObject
     function that the ‘_ctypes’ extension dll exports.

     *note Availability: 213f.: Windows

 -- の関数: ctypes.util.find_library (name)

     ライブラリを検索し、パス名を返します。 'name' は ‘lib’ のような接頭
     辞、 ‘.so’ や ‘.dylib’ のような接尾辞、そして、バージョンナンバーを
     除くライブラリ名です (これは posix のリンカーオプション ‘-l’ で使わ
     れる書式です) 。もしライブラリが見つからなければ、 ‘None’ を返しま
     す。

     厳密な機能はシステムに依存します。

     See *note 共有ライブラリを見つける: 3320. for complete
     documentation.

 -- の関数: ctypes.util.find_msvcrt ()

     Returns the filename of the VC runtime library used by Python, and
     by the extension modules.  If the name of the library cannot be
     determined, ‘None’ is returned.

     もし、例えば拡張モジュールにより割り付けられたメモリを ‘free(void
     *)’ で解放する必要があるなら、メモリ割り付けを行ったのと同じライブ
     ラリの関数を使うことが重要です。

     *note Availability: 213f.: Windows

 -- の関数: ctypes.util.dllist ()

     Try to provide a list of paths of the shared libraries loaded into
     the current process.  These paths are not normalized or processed
     in any way.  The function can raise *note OSError: 2c0. if the
     underlying platform APIs fail.  The exact functionality is system
     dependent.

     On most platforms, the first element of the list represents the
     current executable file.  It may be an empty string.

     *note Availability: 213f.: Windows, macOS, iOS, glibc, BSD libc,
     musl

     Added in version 3.14.

 -- の関数: ctypes.FormatError ([code])

     Returns a textual description of the error code 'code'.  If no
     error code is specified, the last error code is used by calling the
     Windows API function *note GetLastError(): 32fa.

     *note Availability: 213f.: Windows

 -- の関数: ctypes.GetLastError ()

     Returns the last error code set by Windows in the calling thread.
     This function calls the Windows ‘GetLastError()’ function directly,
     it does not return the ctypes-private copy of the error code.

     *note Availability: 213f.: Windows

 -- の関数: ctypes.get_errno ()

     システムの *note errno: 5b. 変数の、スレッドローカルなプライベート
     コピーを返します。

     引数無しで *note 監査イベント: 1c6e. ‘ctypes.get_errno’ を送出しま
     す。

 -- の関数: ctypes.get_last_error ()

     Returns the current value of the ctypes-private copy of the system
     ‘LastError’ variable in the calling thread.

     *note Availability: 213f.: Windows

     引数無しで *note 監査イベント: 1c6e. ‘ctypes.get_last_error’ を送出
     します。

 -- の関数: ctypes.memmove (dst, src, count)

     標準 C の memmove ライブラリ関数と同じものです。: 'count' バイトを
     'src' から 'dst' へコピーします。 'dst' と 'src' はポインタへ変換可
     能な整数または ctypes インスタンスでなければなりません。

 -- の関数: ctypes.memset (dst, c, count)

     標準 C の memset ライブラリ関数と同じものです。: アドレス 'dst' の
     メモリブロックを値 'c' を 'count' バイト分書き込みます。 'dst' はア
     ドレスを指定する整数または ctypes インスタンスである必要があります
     。

 -- の関数: ctypes.POINTER (type, /)

     Create or return a ctypes pointer type.  Pointer types are cached
     and reused internally, so calling this function repeatedly is
     cheap.  'type' must be a ctypes type.

     'CPython 実装の詳細:' The resulting pointer type is cached in the
     ‘__pointer_type__’ attribute of 'type'.  It is possible to set this
     attribute before the first call to ‘POINTER’ in order to set a
     custom pointer type.  However, doing this is discouraged: manually
     creating a suitable pointer type is difficult without relying on
     implementation details that may change in future Python versions.

 -- の関数: ctypes.pointer (obj, /)

     Create a new pointer instance, pointing to 'obj'.  The returned
     object is of the type ‘POINTER(type(obj))’.

     注意: 外部関数呼び出しへオブジェクトへのポインタを渡したいだけなら
     、はるかに高速な ‘byref(obj)’ を使うべきです。

 -- の関数: ctypes.resize (obj, size)

     この関数は 'obj' の内部メモリバッファのサイズを変更します。 'obj' は
     ctypes 型のインスタンスでなければなりません。バッファを
     ‘sizeof(type(obj))’ で与えられるオブジェクト型の本来のサイズより小
     さくすることはできませんが、バッファを拡大することはできます。

 -- の関数: ctypes.set_errno (value)

     システム変数 *note errno: 5b. の、呼び出し元スレッドでの ctypes の
     プライベートコピーの現在値を 'value' に設定し、前の値を返します。

     引数 ‘errno’ を指定して *note 監査イベント: 1c6e.
     ‘ctypes.set_errno’ を送出します。

 -- の関数: ctypes.set_last_error (value)

     Sets the current value of the ctypes-private copy of the system
     ‘LastError’ variable in the calling thread to 'value' and return
     the previous value.

     *note Availability: 213f.: Windows

     引数 ‘error’ を指定して *note 監査イベント: 1c6e.
     ‘ctypes.set_last_error’ を送出します。

 -- の関数: ctypes.sizeof (obj_or_type)

     ctypes の型やインスタンスのメモリバッファのサイズをバイト数で返しま
     す。C の ‘sizeof’ 演算子と同様の動きをします。

 -- の関数: ctypes.string_at (ptr, size=-1)

     Return the byte string at 'void *ptr'.  If 'size' is specified, it
     is used as size, otherwise the string is assumed to be
     zero-terminated.

     Raises an *note auditing event: 1c6e. ‘ctypes.string_at’ with
     arguments ‘ptr’, ‘size’.

 -- の関数: ctypes.WinError (code=None, descr=None)

     Creates an instance of *note OSError: 2c0.  If 'code' is not
     specified, *note GetLastError(): 32fa. is called to determine the
     error code.  If 'descr' is not specified, *note FormatError():
     333a. is called to get a textual description of the error.

     *note Availability: 213f.: Windows

     バージョン 3.3 で変更: An instance of *note WindowsError: 1260.
     used to be created, which is now an alias of *note OSError: 2c0.

 -- の関数: ctypes.wstring_at (ptr, size=-1)

     Return the wide-character string at 'void *ptr'.  If 'size' is
     specified, it is used as the number of characters of the string,
     otherwise the string is assumed to be zero-terminated.

     Raises an *note auditing event: 1c6e. ‘ctypes.wstring_at’ with
     arguments ‘ptr’, ‘size’.

 -- の関数: ctypes.memoryview_at (ptr, size, readonly=False)

     Return a *note memoryview: 165. object of length 'size' that
     references memory starting at 'void *ptr'.

     If 'readonly' is true, the returned ‘memoryview’ object can not be
     used to modify the underlying memory.  (Changes made by other means
     will still be reflected in the returned object.)

     This function is similar to *note string_at(): 1ec. with the key
     difference of not making a copy of the specified memory.  It is a
     semantically equivalent (but more efficient) alternative to
     ‘memoryview((c_byte * size).from_address(ptr))’.  (While *note
     from_address(): 3340. only takes integers, 'ptr' can also be given
     as a *note ctypes.POINTER: 1f1. or a *note byref(): 32fe. object.)

     Raises an *note auditing event: 1c6e. ‘ctypes.memoryview_at’ with
     arguments ‘address’, ‘size’, ‘readonly’.

     Added in version 3.14.


File: python.info,  Node: データ型<3>,  Next: 基本データ型<2>,  Prev: ユーティリティー関数,  Up: ctypesリファレンス

5.16.9.31 データ型
..................

 -- クラス: ctypes._CData

     この非公開クラスはすべての ctypes データ型の共通のベースクラスです
     。他のことはさておき、すべての ctypes 型インスタンスは C 互換データ
     を保持するメモリブロックを内部に持ちます。このメモリブロックのアド
     レスは *note addressof(): 3335. ヘルパー関数が返します。別のインス
     タンス変数が *note _objects: 3344. として公開されます。これはメモリ
     ブロックがポインタを含む場合に存続し続ける必要のある他の Python オ
     ブジェクトを含んでいます。

     ctypes データ型の共通メソッド、すべてのクラスメソッドが存在します
     (正確には、 *note メタクラス: 23d0. のメソッドです):

      -- メソッド: from_buffer (source[, offset])

          このメソッドは 'source' オブジェクトのバッファを共有する
          ctypes のインスタンスを返します。 'source' オブジェクトは書き
          込み可能バッファインターフェースをサポートしている必要がありま
          す。オプションの 'offset' 引数では 'source' バッファのオフセッ
          トをバイト単位で指定します。デフォルトではゼロです。もし
          'source' バッファが十分に大きくなければ、 *note ValueError:
          2ec. が送出されます。

          引数 ‘pointer’, ‘size’, ‘offset’ を指定して *note
          監査イベント: 1c6e. ‘ctypes.cdata/buffer’ を送出します。

      -- メソッド: from_buffer_copy (source[, offset])

          このメソッドは 'source' オブジェクトの読み出し可能バッファをコ
          ピーすることで、ctypes のインスタンスを生成します。オプション
          の 'offset' 引数では 'source' バッファのオフセットをバイト単位
          で指定します。デフォルトではゼロです。もし 'source' バッファが
          十分に大きくなければ、 *note ValueError: 2ec. が送出されます。

          引数 ‘pointer’, ‘size’, ‘offset’ を指定して *note
          監査イベント: 1c6e. ‘ctypes.cdata/buffer’ を送出します。

      -- メソッド: from_address (address)

          このメソッドは 'address' で指定されたメモリを使って ctypes 型
          のインスタンスを返します。 'address' は整数でなければなりませ
          ん。

          This method, and others that indirectly call this method,
          raises an *note auditing event: 1c6e. ‘ctypes.cdata’ with
          argument ‘address’.

      -- メソッド: from_param (obj)

          This method adapts 'obj' to a ctypes type.  It is called with
          the actual object used in a foreign function call when the
          type is present in the foreign function's *note argtypes:
          17c1. tuple; it must return an object that can be used as a
          function call parameter.

          すべての ctypes のデータ型は、それが型のインスタンスであれば、
          'obj' を返すこのクラスメソッドのデフォルトの実装を持ちます。い
          くつかの型は、別のオブジェクトも受け付けます。

      -- メソッド: in_dll (library, name)

          このメソッドは、共有ライブラリによってエクスポートされた
          ctypes 型のインスタンスを返します。 'name' はエクスポートされ
          たデータの名前で、 'library' はロードされた共有ライブラリです
          。

     Common class variables of ctypes data types:

      -- の属性: __pointer_type__

          The pointer type that was created by calling *note POINTER():
          1f1. for corresponding ctypes data type.  If a pointer type
          was not yet created, the attribute is missing.

          Added in version 3.14.

     ctypes データ型共通のインスタンス変数:

      -- の属性: _b_base_

          ctypes 型データのインスタンスは、それ自身のメモリブロックを持
          たず、基底オブジェクトのメモリブロックの一部を共有することがあ
          ります。 *note _b_base_: 3347. 読み出し専用属性は、メモリブロ
          ックを保持する ctypes の基底オブジェクトです。

      -- の属性: _b_needsfree_

          この読み出し専用の変数は、 ctypes データインスタンスが、それ自
          身に割り当てられたメモリブロックを持つとき true になります。そ
          れ以外の場合は false になります。

      -- の属性: _objects

          このメンバは ‘None’ 、または、メモリブロックの内容が正しく保つ
          ために、生存させておかなくてはならない Python オブジェクトを持
          つディクショナリです。このオブジェクトはデバッグでのみ使われま
          す。決してディクショナリの内容を変更しないで下さい。


File: python.info,  Node: 基本データ型<2>,  Next: 構造化データ型,  Prev: データ型<3>,  Up: ctypesリファレンス

5.16.9.32 基本データ型
......................

 -- クラス: ctypes._SimpleCData

     この非公開クラスは、全ての基本的な ctypes データ型の基底クラスです
     。これは基本的な ctypes データ型に共通の属性を持っているので、ここ
     で触れておきます。 *note _SimpleCData: 334b. は *note _CData: 3343.
     の子クラスなので、そのメソッドと属性を継承しています。ポインタでな
     いかポインタを含まない ctypes データ型は、現在は pickle 化できます
     。

     インスタンスは一つだけ属性を持ちます:

      -- の属性: value

          この属性は、インスタンスの実際の値を持ちます。整数型とポインタ
          型に対しては整数型、文字型に対しては一文字のバイト列オブジェク
          ト、文字へのポインタに対しては Python のバイト列オブジェクトも
          しくは文字列となります。

          When the ‘value’ attribute is retrieved from a ctypes
          instance, usually a new object is returned each time.
          ‘ctypes’ does 'not' implement original object return, always a
          new object is constructed.  The same is true for all other
          ctypes object instances.

Fundamental data types, when returned as foreign function call results,
or, for example, by retrieving structure field members or array items,
are transparently converted to native Python types.  In other words, if
a foreign function has a *note restype: 32f9. of *note c_char_p: 1a57,
you will always receive a Python bytes object, 'not' a *note c_char_p:
1a57. instance.

Subclasses of fundamental data types do 'not' inherit this behavior.
So, if a foreign functions ‘restype’ is a subclass of *note c_void_p:
1a59, you will receive an instance of this subclass from the function
call.  Of course, you can get the value of the pointer by accessing the
‘value’ attribute.

これらが基本 ctypes データ型です:

 -- クラス: ctypes.c_byte

     C の signed char データ型を表し、小整数として値を解釈します。コンス
     トラクタはオプションの整数初期化子を受け取ります。オーバーフローの
     チェックは行われません。

 -- クラス: ctypes.c_char

     C char データ型を表し、単一の文字として値を解釈します。コンストラク
     タはオプションの文字列初期化子を受け取り、その文字列の長さちょうど
     一文字である必要があります。

 -- クラス: ctypes.c_char_p

     C char* データ型を表し、ゼロ終端文字列へのポインタでなければなりま
     せん。バイナリデータを指す可能性のある一般的なポインタに対しては
     ‘POINTER(c_char)’ を使わなければなりません。コンストラクタは整数の
     アドレスもしくはバイト列オブジェクトを受け取ります。

 -- クラス: ctypes.c_double

     C double データ型を表します。コンストラクタはオプションの浮動小数点
     数初期化子を受け取ります。

 -- クラス: ctypes.c_longdouble

     C long double データ型を表します。コンストラクタはオプションで浮動
     小数点数初期化子を受け取ります。 ‘sizeof(long double) ==
     sizeof(double)’ であるプラットフォームでは *note c_double: 1cb8. の
     別名です。

 -- クラス: ctypes.c_float

     C float データ型を表します。コンストラクタはオプションの浮動小数点
     数初期化子を受け取ります。

 -- クラス: ctypes.c_double_complex

     Represents the C double complex datatype, if available.  The
     constructor accepts an optional *note complex: 197. initializer.

     Added in version 3.14.

 -- クラス: ctypes.c_float_complex

     Represents the C float complex datatype, if available.  The
     constructor accepts an optional *note complex: 197. initializer.

     Added in version 3.14.

 -- クラス: ctypes.c_longdouble_complex

     Represents the C long double complex datatype, if available.  The
     constructor accepts an optional *note complex: 197. initializer.

     Added in version 3.14.

 -- クラス: ctypes.c_int

     C signed int データ型を表します。コンストラクタはオプションの整数初
     期化子を受け取ります。オーバーフローのチェックは行われません。
     ‘sizeof(int) == sizeof(long)’ であるプラットフォームでは、 *note
     c_long: 32d0. の別名です。

 -- クラス: ctypes.c_int8

     Represents the C 8-bit signed int datatype.  It is an alias for
     *note c_byte: 1ae0.

 -- クラス: ctypes.c_int16

     C 16-bit signed int データ型を表します。たいていは、 *note c_short:
     32dd. の別名です。

 -- クラス: ctypes.c_int32

     C 32-bit signed int データ型を表します。たいていは、 *note c_int:
     32cf. の別名です。

 -- クラス: ctypes.c_int64

     C 64-bit signed int データ型を表します。たいていは、 *note
     c_longlong: 32e9. の別名です。

 -- クラス: ctypes.c_long

     C signed long データ型を表します。コンストラクタはオプションの整数
     初期化子を受け取ります。オーバーフローのチェックは行われません。

 -- クラス: ctypes.c_longlong

     C signed long long データ型を表します。コンストラクタはオプションの
     整数初期化子を受け取ります。オーバーフローのチェックは行われません
     。

 -- クラス: ctypes.c_short

     C signed short データ型を表します。コンストラクタはオプションの整数
     初期化子を受け取ります。オーバーフローのチェックは行われません。

 -- クラス: ctypes.c_size_t

     C ‘size_t’ データ型を表します。

 -- クラス: ctypes.c_ssize_t

     C ‘ssize_t’ データ型を表します。

     Added in version 3.2.

 -- クラス: ctypes.c_time_t

     Represents the C ‘time_t’ datatype.

     Added in version 3.12.

 -- クラス: ctypes.c_ubyte

     C の unsigned char データ型を表し、小さな整数として値を解釈します。
     コンストラクタはオプションの整数初期化子を受け取ります; オーバーフ
     ローのチェックは行われません。

 -- クラス: ctypes.c_uint

     C の unsigned int データ型を表します。コンストラクタはオプションの
     整数初期化子を受け取ります; オーバーフローのチェックは行われません
     。これは、 ‘sizeof(int) == sizeof(long)’ であるプラットフォームでは
     *note c_ulong: 32e8. の別名です。

 -- クラス: ctypes.c_uint8

     Represents the C 8-bit unsigned int datatype.  It is an alias for
     *note c_ubyte: 1ae1.

 -- クラス: ctypes.c_uint16

     C 16-bit unsigned int データ型を表します。たいていは、 *note
     c_ushort: 32de. の別名です。

 -- クラス: ctypes.c_uint32

     C 32-bit unsigned int データ型を表します。たいていは、 *note
     c_uint: 32e3. の別名です。

 -- クラス: ctypes.c_uint64

     C 64-bit unsigned int データ型を表します。たいていは、 *note
     c_ulonglong: 32ea. の別名です。

 -- クラス: ctypes.c_ulong

     C unsigned long データ型を表します。コンストラクタはオプションの整
     数初期化子を受け取ります。オーバーフローのチェックは行われません。

 -- クラス: ctypes.c_ulonglong

     C unsigned long long データ型を表します。コンストラクタはオプション
     の整数初期化子を受け取ります。オーバーフローのチェックは行われませ
     ん。

 -- クラス: ctypes.c_ushort

     C unsigned short データ型を表します。コンストラクタはオプションの整
     数初期化子を受け取ります。オーバーフローのチェックは行われません。

 -- クラス: ctypes.c_void_p

     C void* データ型を表します。値は整数として表されます。コンストラク
     タはオプションの整数初期化子を受け取ります。

 -- クラス: ctypes.c_wchar

     C ‘wchar_t’ データ型を表し、値は Unicode 文字列の単一の文字として解
     釈されます。コンストラクタはオプションの文字列初期化子を受け取り、
     その文字列の長さはちょうど一文字である必要があります。

 -- クラス: ctypes.c_wchar_p

     C wchar_t* データ型を表し、ゼロ終端ワイド文字列へのポインタでなけれ
     ばなりません。コンストラクタは整数のアドレスもしくは文字列を受け取
     ります。

 -- クラス: ctypes.c_bool

     C の bool データ型 (より正確には、 C99 以降の _Bool) を表します。
     ‘True’ または ‘False’ の値を持ち、コンストラクタは真偽値と解釈でき
     るオブジェクトを受け取ります。

 -- クラス: ctypes.HRESULT

     Represents a ‘HRESULT’ value, which contains success or error
     information for a function or method call.

     *note Availability: 213f.: Windows

 -- クラス: ctypes.py_object

     C *note PyObject: 5df.* データ型を表します。引数なしでこれを呼び出
     すと ‘NULL’ *note PyObject: 5df.* ポインタを作成します。

     バージョン 3.14 で変更: ‘py_object’ is now a *note generic type:
     1a1.

The ‘ctypes.wintypes’ module provides quite some other Windows specific
data types, for example ‘HWND’, ‘WPARAM’, or ‘DWORD’.  Some useful
structures like ‘MSG’ or ‘RECT’ are also defined.


File: python.info,  Node: 構造化データ型,  Next: 配列とポインタ,  Prev: 基本データ型<2>,  Up: ctypesリファレンス

5.16.9.33 構造化データ型
........................

 -- クラス: ctypes.Union (*args, **kw)

     ネイティブのバイトオーダーでの共用体のための抽象ベースクラス。

     Unions share common attributes and behavior with structures; see
     *note Structure: 1e5. documentation for details.

 -- クラス: ctypes.BigEndianUnion (*args, **kw)

     'ビックエンディアン' バイトオーダーでの共用体のための抽象ベースクラ
     ス。

     Added in version 3.11.

 -- クラス: ctypes.LittleEndianUnion (*args, **kw)

     'リトルエンディアン' バイトオーダーでの共用体のための抽象ベースクラ
     ス。

     Added in version 3.11.

 -- クラス: ctypes.BigEndianStructure (*args, **kw)

     'ビックエンディアン' バイトオーダーでの構造体のための抽象ベースクラ
     ス。

 -- クラス: ctypes.LittleEndianStructure (*args, **kw)

     'リトルエンディアン' バイトオーダーでの構造体のための抽象ベースクラ
     ス。

ネイティブではないバイトオーダーを持つ構造体および共用体にポインタ型フィ
ールドあるいはポインタ型フィールドを含む他のどんなデータ型をも入れること
はできません。

 -- クラス: ctypes.Structure (*args, **kw)

     'ネイティブ' のバイトオーダーでの構造体のための抽象ベースクラス。

     Concrete structure and union types must be created by subclassing
     one of these types, and at least define a *note _fields_: 1936.
     class variable.  ‘ctypes’ will create *note descriptor: 1881.s
     which allow reading and writing the fields by direct attribute
     accesses.  These are the

      -- の属性: _fields_

          構造体のフィールドを定義するシーケンス。要素は2要素タプルか3要
          素タプルでなければなりません。第一要素はフィールドの名前です。
          第二要素はフィールドの型を指定します。それはどんな ctypes デー
          タ型でも構いません。

          *note c_int: 32cf. のような整数型のために、オプションの第三要
          素を与えることができます。フィールドのビット幅を定義する正の小
          整数である必要があります。

          一つの構造体と共用体の中で、フィールド名はただ一つである必要が
          あります。これはチェックされません。名前が繰り返しでてきたとき
          にアクセスできるのは一つのフィールドだけです。

          Structure サブクラスを定義するクラス文の '後で' 、 *note
          _fields_: 1936. クラス変数を定義することができます。これにより
          、次のように自身を直接または間接的に参照するデータ型を作成でき
          るようになります:

               class List(Structure):
                   pass
               List._fields_ = [("pnext", POINTER(List)),
                                ...
                               ]

          The ‘_fields_’ class variable can only be set once.  Later
          assignments will raise an *note AttributeError: 5f0.

          Additionally, the ‘_fields_’ class variable must be defined
          before the structure or union type is first used: an instance
          or subclass is created, *note sizeof(): 333d. is called on it,
          and so on.  Later assignments to ‘_fields_’ will raise an
          *note AttributeError: 5f0.  If ‘_fields_’ has not been set
          before such use, the structure or union will have no own
          fields, as if ‘_fields_’ was empty.

          Sub-subclasses of structure types inherit the fields of the
          base class plus the *note _fields_: 1936. defined in the
          sub-subclass, if any.

      -- の属性: _pack_

          An optional small integer that allows overriding the alignment
          of structure fields in the instance.

          This is only implemented for the MSVC-compatible memory layout
          (see *note _layout_: 1e7.).

          Setting ‘_pack_’ to 0 is the same as not setting it at all.
          Otherwise, the value must be a positive power of two.  The
          effect is equivalent to ‘#pragma pack(N)’ in C, except
          ‘ctypes’ may allow larger 'n' than what the compiler accepts.

          ‘_pack_’ must already be defined when *note _fields_: 1936. is
          assigned, otherwise it will have no effect.

          Deprecated since version 3.14, will be removed in version
          3.19: For historical reasons, if ‘_pack_’ is non-zero, the
          MSVC-compatible layout will be used by default.  On
          non-Windows platforms, this default is deprecated and is
          slated to become an error in Python 3.19.  If it is intended,
          set *note _layout_: 1e7. to ‘'ms'’ explicitly.

      -- の属性: _align_

          An optional small integer that allows increasing the alignment
          of the structure when being packed or unpacked to/from memory.

          The value must not be negative.  The effect is equivalent to
          ‘__attribute__((aligned(N)))’ on GCC or ‘#pragma align(N)’ on
          MSVC, except ‘ctypes’ may allow values that the compiler would
          reject.

          ‘_align_’ can only 'increase' a structure's alignment
          requirements.  Setting it to 0 or 1 has no effect.

          Using values that are not powers of two is discouraged and may
          lead to surprising behavior.

          ‘_align_’ must already be defined when *note _fields_: 1936.
          is assigned, otherwise it will have no effect.

          Added in version 3.13.

      -- の属性: _layout_

          An optional string naming the struct/union layout.  It can
          currently be set to:

             - ‘"ms"’: the layout used by the Microsoft compiler (MSVC).
               On GCC and Clang, this layout can be selected with
               ‘__attribute__((ms_struct))’.

             - ‘"gcc-sysv"’: the layout used by GCC with the System V or
               “SysV-like” data model, as used on Linux and macOS. With
               this layout, *note _pack_: 317. must be unset or zero.

          If not set explicitly, ‘ctypes’ will use a default that
          matches the platform conventions.  This default may change in
          future Python releases (for example, when a new platform gains
          official support, or when a difference between similar
          platforms is found).  Currently the default will be:

             - On Windows: ‘"ms"’

             - When *note _pack_: 317. is specified: ‘"ms"’.  (This is
               deprecated; see *note _pack_: 317. documentation.)

             - Otherwise: ‘"gcc-sysv"’

          ‘_layout_’ must already be defined when *note _fields_: 1936.
          is assigned, otherwise it will have no effect.

          Added in version 3.14.

      -- の属性: _anonymous_

          無名 (匿名) フィールドの名前が並べあげられたオプションのシーケ
          ンス。 *note _fields_: 1936. が代入されたとき、 *note
          _anonymous_: 334f. がすでに定義されていなければなりません。そ
          うでなければ、何ら影響はありません。

          The fields listed in this variable must be structure or union
          type fields.  ‘ctypes’ will create descriptors in the
          structure type that allows accessing the nested fields
          directly, without the need to create the structure or union
          field.

          型の例です (Windows):

               class _U(Union):
                   _fields_ = [("lptdesc", POINTER(TYPEDESC)),
                               ("lpadesc", POINTER(ARRAYDESC)),
                               ("hreftype", HREFTYPE)]

               class TYPEDESC(Structure):
                   _anonymous_ = ("u",)
                   _fields_ = [("u", _U),
                               ("vt", VARTYPE)]

          ‘TYPEDESC’ 構造体はCOMデータ型を表現しており、 ‘vt’ フィールド
          は共用体フィールドのどれが有効であるかを指定します。 ‘u’ フィ
          ールドは匿名フィールドとして定義されているため、 TYPEDESC イン
          スタンスから取り除かれてそのメンバーへ直接アクセスできます。
          ‘td.lptdesc’ と ‘td.u.lptdesc’ は同等ですが、前者がより高速で
          す。なぜなら一時的な共用体インスタンスを作る必要がないためです
          。:

               td = TYPEDESC()
               td.vt = VT_PTR
               td.lptdesc = POINTER(some_type)
               td.u.lptdesc = POINTER(some_type)

     構造体のサブクラスのサブクラスを定義することができ、基底クラスのフ
     ィールドを継承します。 サブクラス定義に別の *note _fields_: 1936. 変
     数がある場合は、この中で指定されたフィールドは基底クラスのフィール
     ドへ追加されます。

     構造体と共用体のコンストラクタは位置引数とキーワード引数の両方を受
     け取ります。位置引数は *note _fields_: 1936. の中に現れたのと同じ順
     番でメンバーフィールドを初期化するために使われます。コンストラクタ
     のキーワード引数は属性代入として解釈され、そのため、同じ名前をもつ
     *note _fields_: 1936. を初期化するか、 *note _fields_: 1936. に存在
     しない名前に対しては新しい属性を作ります。

 -- クラス: ctypes.CField (*args, **kw)

     Descriptor for fields of a *note Structure: 1e5. and *note Union:
     1e6.  For example:

          >>> class Color(Structure):
          ...     _fields_ = (
          ...         ('red', c_uint8),
          ...         ('green', c_uint8),
          ...         ('blue', c_uint8),
          ...         ('intense', c_bool, 1),
          ...         ('blinking', c_bool, 1),
          ...    )
          ...
          >>> Color.red
          <ctypes.CField 'red' type=c_ubyte, ofs=0, size=1>
          >>> Color.green.type
          <class 'ctypes.c_ubyte'>
          >>> Color.blue.byte_offset
          2
          >>> Color.intense
          <ctypes.CField 'intense' type=c_bool, ofs=3, bit_size=1, bit_offset=0>
          >>> Color.blinking.bit_offset
          1

     All attributes are read-only.

     ‘CField’ objects are created via *note _fields_: 1936.; do not
     instantiate the class directly.

     Added in version 3.14: Previously, descriptors only had ‘offset’
     and ‘size’ attributes and a readable string representation; the
     ‘CField’ class was not available directly.

      -- の属性: name

          Name of the field, as a string.

      -- の属性: type

          Type of the field, as a *note ctypes class: 3341.

      -- の属性: offset
      -- の属性: byte_offset

          Offset of the field, in bytes.

          For bitfields, this is the offset of the underlying
          byte-aligned 'storage unit'; see *note bit_offset: 3354.

      -- の属性: byte_size

          Size of the field, in bytes.

          For bitfields, this is the size of the underlying 'storage
          unit'.  Typically, it has the same size as the bitfield's
          type.

      -- の属性: size

          For non-bitfields, equivalent to *note byte_size: 3355.

          For bitfields, this contains a backwards-compatible bit-packed
          value that combines *note bit_size: 3357. and *note
          bit_offset: 3354.  Prefer using the explicit attributes
          instead.

      -- の属性: is_bitfield

          True if this is a bitfield.

      -- の属性: bit_offset
      -- の属性: bit_size

          The location of a bitfield within its 'storage unit', that is,
          within *note byte_size: 3355. bytes of memory starting at
          *note byte_offset: 3353.

          To get the field's value, read the storage unit as an integer,
          *note shift left: 24c9. by ‘bit_offset’ and take the
          ‘bit_size’ least significant bits.

          For non-bitfields, ‘bit_offset’ is zero and ‘bit_size’ is
          equal to ‘byte_size * 8’.

      -- の属性: is_anonymous

          True if this field is anonymous, that is, it contains nested
          sub-fields that should be merged into a containing structure
          or union.


File: python.info,  Node: 配列とポインタ,  Next: 例外<10>,  Prev: 構造化データ型,  Up: ctypesリファレンス

5.16.9.34 配列とポインタ
........................

 -- クラス: ctypes.Array (*args)

     配列のための抽象基底クラスです。

     The recommended way to create concrete array types is by
     multiplying any ‘ctypes’ data type with a non-negative integer.
     Alternatively, you can subclass this type and define *note
     _length_: 335c. and *note _type_: 335d. class variables.  Array
     elements can be read and written using standard subscript and slice
     accesses; for slice reads, the resulting object is 'not' itself an
     *note Array: 1e0c.

      -- の属性: _length_

          配列の要素数を指定する正の整数。範囲外の添え字を指定すると、
          *note IndexError: 174e. が送出されます。*note len(): 840. がこ
          の整数を返します。

      -- の属性: _type_

          配列内の各要素の型を指定します。

     配列のサブクラスのコンストラクタは、位置引数を受け付けて、配列を順
     番に初期化するために使用します。

 -- の関数: ctypes.ARRAY (type, length)

     Create an array.  Equivalent to ‘type * length’, where 'type' is a
     ‘ctypes’ data type and 'length' an integer.

     This function is *note soft deprecated: 23d. in favor of
     multiplication.  There are no plans to remove it.

 -- クラス: ctypes._Pointer

     ポインタのためのプライベートな抽象基底クラスです。

     具象ポインタ型は、ポイント先の型を持つ *note POINTER(): 1f1. を呼び
     出すことで、作成できます。これは、 *note pointer(): 1a56. により自
     動的に行われます。

     ポインタが配列を指す場合、その配列の要素は、標準の添え字とスライス
     によるアクセスを使用して読み書きが行えます。ポインタオブジェクトに
     は、サイズがないため、 *note len(): 840. 関数は *note TypeError:
     198. を送出します。負の添え字は、(C と同様に) ポインタの '前' のメ
     モリから読み込み、範囲外の添え字はおそらく (幸運な場合でも) アクセ
     ス違反によりクラッシュを起こします。

      -- の属性: _type_

          ポイント先の型を指定します。

      -- の属性: contents

          ポインタが指すオブジェクトを返します。この属性に割り当てると、
          ポインタが割り当てられたオブジェクトを指すようになります。


File: python.info,  Node: 例外<10>,  Prev: 配列とポインタ,  Up: ctypesリファレンス

5.16.9.35 例外
..............

 -- 例外: ctypes.ArgumentError

     この例外は外部関数呼び出しが渡された引数を変換できなかったときに送
     出されます。

 -- 例外: ctypes.COMError (hresult, text, details)

     This exception is raised when a COM method call failed.

      -- の属性: hresult

          The integer value representing the error code.

      -- の属性: text

          The error message.

      -- の属性: details

          The 5-tuple ‘(descr, source, helpfile, helpcontext, progid)’.

          'descr' is the textual description.  'source' is the
          language-dependent ‘ProgID’ for the class or application that
          raised the error.  'helpfile' is the path of the help file.
          'helpcontext' is the help context identifier.  'progid' is the
          ‘ProgID’ of the interface that defined the error.

     *note Availability: 213f.: Windows

     Added in version 3.14.


File: python.info,  Node: コマンドラインインターフェースライブラリ,  Next: 並行実行,  Prev: 汎用オペレーティングシステムサービス,  Up: Python 標準ライブラリ

5.17 コマンドラインインターフェースライブラリ
=============================================

この章で説明されているモジュールは、アプリケーション向けのコマンドライン
やターミナルインターフェースの実装を支援します。

概要は以下のとおりです:

* Menu:

* argparse: argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー. コマンドラインオプションや引数、サブコマンド向けのパーサー
* optparse: optparse --- Parser for command line options. Parser for command line options
* getpass: getpass --- 可搬性のあるパスワード入力機構. 可搬性のあるパスワード入力機構
* fileinput: fileinput --- 複数の入力ストリームをまたいだ行を反復する. 複数の入力ストリームをまたいだ行を反復する
* curses: curses --- 文字セル表示のターミナル処理. 文字セル表示のターミナル処理
* curses.textpad: curses textpad --- Text input widget for curses programs. Text input widget for curses programs
* curses.ascii: curses ascii --- ASCII 文字のユーティリティー. ASCII 文字のユーティリティー
* curses.panel: curses panel --- curses のためのパネルスタック拡張. curses のためのパネルスタック拡張
* cmd: cmd --- 行指向のコマンドインタープリターのサポート. 行指向のコマンドインタープリターのサポート


File: python.info,  Node: argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー,  Next: optparse --- Parser for command line options,  Up: コマンドラインインターフェースライブラリ

5.17.1 ‘argparse’ -- コマンドラインオプションや引数、サブコマンド向けのパーサー
-------------------------------------------------------------------------------

Added in version 3.2.

'ソースコード:' Lib/argparse.py(1)

     注釈: While ‘argparse’ is the default recommended standard library
     module for implementing basic command line applications, authors
     with more exacting requirements for exactly how their command line
     applications behave may find it doesn't provide the necessary level
     of control.  Refer to *note Choosing an argument parsing library:
     336b. for alternatives to consider when ‘argparse’ doesn't support
     behaviors that the application requires (such as entirely disabling
     support for interspersed options and positional arguments, or
     accepting option parameter values that start with ‘-’ even when
     they correspond to another defined option).

__________________________________________________________________

チュートリアル
..............

このページは API のリファレンス情報が記載しています。*note argparse
チュートリアル: 336c. では、コマンドラインの解析についてより優しく説明し
ています。

The ‘argparse’ module makes it easy to write user-friendly command-line
interfaces.  The program defines what arguments it requires, and
‘argparse’ will figure out how to parse those out of *note sys.argv:
147c.  The ‘argparse’ module also automatically generates help and usage
messages.  The module will also issue errors when users give the program
invalid arguments.

The ‘argparse’ module's support for command-line interfaces is built
around an instance of *note argparse.ArgumentParser: 1bd.  It is a
container for argument specifications and has options that apply to the
parser as whole:

     parser = argparse.ArgumentParser(
                         prog='ProgramName',
                         description='What the program does',
                         epilog='Text at the bottom of help')

*note ArgumentParser.add_argument(): 4bc. メソッドは各引数の仕様をパーサ
ーに付属させます。このメソッドは位置引数、値を受け取るオプション、機能の
オン／オフを切り替えるフラグをサポートします:

     parser.add_argument('filename')           # 位置引数
     parser.add_argument('-c', '--count')      # 値を取るオプション
     parser.add_argument('-v', '--verbose',
                         action='store_true')  # オン／オフフラグ

*note ArgumentParser.parse_args(): 336d. メソッドはパーサーを実行し、抽
出したデータを *note argparse.Namespace: 336e. オブジェクト内に配置しま
す:

     args = parser.parse_args()
     print(args.filename, args.count, args.verbose)

     注釈: If you're looking for a guide about how to upgrade *note
     optparse: a4. code to ‘argparse’, see *note Upgrading Optparse
     Code: 13c6.

* Menu:

* ArgumentParser オブジェクト::
* add_argument() メソッド: add_argument メソッド.
* parse_args() メソッド: parse_args メソッド.
* その他のユーティリティ::
* 例外: 例外<11>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/argparse.py


File: python.info,  Node: ArgumentParser オブジェクト,  Next: add_argument メソッド,  Up: argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー

5.17.1.1 ArgumentParser オブジェクト
....................................

 -- クラス: argparse.ArgumentParser (prog=None, usage=None,
          description=None, epilog=None, parents=[],
          formatter_class=argparse.HelpFormatter, prefix_chars='-',
          fromfile_prefix_chars=None, argument_default=None,
          conflict_handler='error', add_help=True, allow_abbrev=True,
          exit_on_error=True, *, suggest_on_error=False, color=True)

     新しい *note ArgumentParser: 1bd. オブジェクトを生成します。すべて
     の引数はキーワード引数として渡すべきです。各引数についてはあとで詳
     しく説明しますが、簡単に言うと:

        * *note prog: 1bc. - The name of the program (default: generated
          from the ‘__main__’ module attributes and ‘sys.argv[0]’)

        * *note usage: 3370. - プログラムの利用方法を記述する文字列 (デ
          フォルト: パーサーに追加された引数から生成されます)

        * *note description: 3371. - 引数のヘルプの前に表示されるテキス
          ト (デフォルトはテキストなしです)

        * *note epilog: 3372. - 引数のヘルプの後に表示されるテキスト (デ
          フォルトはテキストなしです)

        * *note parents: 3373. - *note ArgumentParser: 1bd. オブジェクト
          のリストで、このオブジェクトの引数が追加されます

        * *note formatter_class: 3374. - ヘルプ出力をカスタマイズするた
          めのクラス

        * *note prefix_chars: 3375. - オプションの引数の prefix になる文
          字集合 (デフォルト: '-')

        * *note fromfile_prefix_chars: 3376. - 追加の引数を読み込むファ
          イルの prefix になる文字集合 (デフォルト: ‘None’)

        * *note argument_default: 3377. - 引数のグローバルなデフォルト値
          (デフォルト: ‘None’)

        * *note conflict_handler: 3378. - 衝突するオプションを解決する方
          法 (通常は不要)

        * *note add_help: 3379. - ‘-h/--help’ オプションをパーサーに追加
          する (デフォルト: ‘True’)

        * *note allow_abbrev: fbe. - Allows long options to be
          abbreviated if the abbreviation is unambiguous (default:
          ‘True’)

        * *note exit_on_error: 337a. - Determines whether or not
          ‘ArgumentParser’ exits with error info when an error occurs.
          (default: ‘True’)

        * *note suggest_on_error: 337b. - Enables suggestions for
          mistyped argument choices and subparser names (default:
          ‘False’)

        * *note color: 337c. - Allow color output (default: ‘True’)

     バージョン 3.5 で変更: 'allow_abbrev' 引数が追加されました。

     バージョン 3.8 で変更: 以前のバージョンでは、 'allow_abbrev' は、
     ‘-vv’ が ‘-v -v’ と等価になるような、短いフラグのグループ化を無効に
     していました。

     バージョン 3.9 で変更: 'exit_on_error' 引数が追加されました。

     バージョン 3.14 で変更: 'suggest_on_error' and 'color' parameters
     were added.

以下の節では各オプションの利用方法を説明します。

* Menu:

* prog::
* usage::
* description::
* epilog::
* parents::
* formatter_class::
* prefix_chars::
* fromfile_prefix_chars::
* argument_default::
* allow_abbrev::
* conflict_handler::
* add_help::
* exit_on_error::
* suggest_on_error::
* color::


File: python.info,  Node: prog,  Next: usage,  Up: ArgumentParser オブジェクト

5.17.1.2 ‘prog’
...............

By default, *note ArgumentParser: 1bd. calculates the name of the
program to display in help messages depending on the way the Python
interpreter was run:

   * The *note base name: 2c48. of ‘sys.argv[0]’ if a file was passed as
     argument.

   * The Python interpreter name followed by ‘sys.argv[0]’ if a
     directory or a zipfile was passed as argument.

   * The Python interpreter name followed by ‘-m’ followed by the module
     or package name if the *note -m: 23c. option was used.

This default is almost always desirable because it will make the help
messages match the string that was used to invoke the program on the
command line.  However, to change this default behavior, another value
can be supplied using the ‘prog=’ argument to *note ArgumentParser:
1bd.:

     >>> parser = argparse.ArgumentParser(prog='myprogram')
     >>> parser.print_help()
     usage: myprogram [-h]

     options:
      -h, --help  show this help message and exit

Note that the program name, whether determined from ‘sys.argv[0]’, from
the ‘__main__’ module attributes or from the ‘prog=’ argument, is
available to help messages using the ‘%(prog)s’ format specifier.

     >>> parser = argparse.ArgumentParser(prog='myprogram')
     >>> parser.add_argument('--foo', help='foo of the %(prog)s program')
     >>> parser.print_help()
     usage: myprogram [-h] [--foo FOO]

     options:
      -h, --help  show this help message and exit
      --foo FOO   foo of the myprogram program

バージョン 3.14 で変更: The default ‘prog’ value now reflects how
‘__main__’ was actually executed, rather than always being
‘os.path.basename(sys.argv[0])’.


File: python.info,  Node: usage,  Next: description,  Prev: prog,  Up: ArgumentParser オブジェクト

5.17.1.3 usage
..............

By default, *note ArgumentParser: 1bd. calculates the usage message from
the arguments it contains.  The default message can be overridden with
the ‘usage=’ keyword argument:

     >>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s [options]')
     >>> parser.add_argument('--foo', nargs='?', help='foo help')
     >>> parser.add_argument('bar', nargs='+', help='bar help')
     >>> parser.print_help()
     usage: PROG [options]

     positional arguments:
      bar          bar help

     options:
      -h, --help   show this help message and exit
      --foo [FOO]  foo help

‘%(prog)s’ フォーマット指定子を、使用法メッセージ内でプログラム名として
利用できます。

When a custom usage message is specified for the main parser, you may
also want to consider passing the ‘prog’ argument to *note
add_subparsers(): e11. or the ‘prog’ and the ‘usage’ arguments to
‘add_parser()’, to ensure consistent command prefixes and usage
information across subparsers.


File: python.info,  Node: description,  Next: epilog,  Prev: usage,  Up: ArgumentParser オブジェクト

5.17.1.4 description
....................

Most calls to the *note ArgumentParser: 1bd. constructor will use the
‘description=’ keyword argument.  This argument gives a brief
description of what the program does and how it works.  In help
messages, the description is displayed between the command-line usage
string and the help messages for the various arguments.

デフォルトでは、説明は与えられたスペースに合わせて折り返されます。この挙
動を変更するには、*note formatter_class: 3374. 引数を参照してください。


File: python.info,  Node: epilog,  Next: parents,  Prev: description,  Up: ArgumentParser オブジェクト

5.17.1.5 epilog
...............

いくつかのプログラムは、プログラムについての追加の説明を引数の説明の後に
表示します。このテキストは *note ArgumentParser: 1bd. の ‘epilog=’ 引数
に指定できます:

     >>> parser = argparse.ArgumentParser(
     ...     description='A foo that bars',
     ...     epilog="And that's how you'd foo a bar")
     >>> parser.print_help()
     usage: argparse.py [-h]

     A foo that bars

     options:
      -h, --help  show this help message and exit

     And that's how you'd foo a bar

*note description: 3371. 引数と同じく、‘epilog=’ テキストもデフォルトで
折り返され、*note ArgumentParser: 1bd. の *note formatter_class: 3374. 引
数で動作を調整できます。


File: python.info,  Node: parents,  Next: formatter_class,  Prev: epilog,  Up: ArgumentParser オブジェクト

5.17.1.6 parents
................

ときどき、いくつかのパーサーが共通の引数セットを共有することがあります。
それらの引数を繰り返し定義する代わりに、すべての共通引数を持ったパーサー
を *note ArgumentParser: 1bd. の ‘parents=’ 引数に渡すことができます。
‘parents=’ 引数は *note ArgumentParser: 1bd. オブジェクトのリストを受け
取り、すべての位置アクションとオプションのアクションをそれらから集め、そ
のアクションを構築中の *note ArgumentParser: 1bd. オブジェクトに追加しま
す:

     >>> parent_parser = argparse.ArgumentParser(add_help=False)
     >>> parent_parser.add_argument('--parent', type=int)

     >>> foo_parser = argparse.ArgumentParser(parents=[parent_parser])
     >>> foo_parser.add_argument('foo')
     >>> foo_parser.parse_args(['--parent', '2', 'XXX'])
     Namespace(foo='XXX', parent=2)

     >>> bar_parser = argparse.ArgumentParser(parents=[parent_parser])
     >>> bar_parser.add_argument('--bar')
     >>> bar_parser.parse_args(['--bar', 'YYY'])
     Namespace(bar='YYY', parent=None)

一番親になるパーサーに ‘add_help=False’ を指定していることに注目してくだ
さい。こうしないと、*note ArgumentParser: 1bd. は2つの ‘-h/--help’ オプ
ションを与えられる (1つは親から、もうひとつは子から) ことになり、エラー
を発生します。

     注釈: ‘parents=’ に渡す前にパーサーを完全に初期化する必要があります
     。子パーサーを作成してから親パーサーを変更した場合、その変更は子パ
     ーサーに反映されません。


File: python.info,  Node: formatter_class,  Next: prefix_chars,  Prev: parents,  Up: ArgumentParser オブジェクト

5.17.1.7 formatter_class
........................

*note ArgumentParser: 1bd. オブジェクトは代わりのフォーマットクラスを指
定することでヘルプのフォーマットをカスタマイズできます。現在、4つのフォ
ーマットクラスがあります:

 -- クラス: argparse.RawDescriptionHelpFormatter
 -- クラス: argparse.RawTextHelpFormatter
 -- クラス: argparse.ArgumentDefaultsHelpFormatter
 -- クラス: argparse.MetavarTypeHelpFormatter

*note RawDescriptionHelpFormatter: 3380. と *note RawTextHelpFormatter:
3381. はどのようにテキストの説明を表示するかを指定できます。デフォルトで
は *note ArgumentParser: 1bd. オブジェクトはコマンドラインヘルプの中の
*note description: 3371. と *note epilog: 3372. を折り返して表示します:

     >>> parser = argparse.ArgumentParser(
     ...     prog='PROG',
     ...     description='''this description
     ...         was indented weird
     ...             but that is okay''',
     ...     epilog='''
     ...             likewise for this epilog whose whitespace will
     ...         be cleaned up and whose words will be wrapped
     ...         across a couple lines''')
     >>> parser.print_help()
     usage: PROG [-h]

     this description was indented weird but that is okay

     options:
      -h, --help  show this help message and exit

     likewise for this epilog whose whitespace will be cleaned up and whose words
     will be wrapped across a couple lines

‘formatter_class=’ に *note RawDescriptionHelpFormatter: 3380. を渡した
場合、 *note description: 3371. と *note epilog: 3372. は整形済みとされ
改行されません:

     >>> parser = argparse.ArgumentParser(
     ...     prog='PROG',
     ...     formatter_class=argparse.RawDescriptionHelpFormatter,
     ...     description=textwrap.dedent('''\
     ...         Please do not mess up this text!
     ...         --------------------------------
     ...             I have indented it
     ...             exactly the way
     ...             I want it
     ...         '''))
     >>> parser.print_help()
     usage: PROG [-h]

     Please do not mess up this text!
     --------------------------------
        I have indented it
        exactly the way
        I want it

     options:
      -h, --help  show this help message and exit

*note RawTextHelpFormatter: 3381. maintains whitespace for all sorts of
help text, including argument descriptions.  However, multiple newlines
are replaced with one.  If you wish to preserve multiple blank lines,
add spaces between the newlines.

*note ArgumentDefaultsHelpFormatter: 1c50. は各引数のデフォルト値を自動
的にヘルプに追加します:

     >>> parser = argparse.ArgumentParser(
     ...     prog='PROG',
     ...     formatter_class=argparse.ArgumentDefaultsHelpFormatter)
     >>> parser.add_argument('--foo', type=int, default=42, help='FOO!')
     >>> parser.add_argument('bar', nargs='*', default=[1, 2, 3], help='BAR!')
     >>> parser.print_help()
     usage: PROG [-h] [--foo FOO] [bar ...]

     positional arguments:
      bar         BAR! (default: [1, 2, 3])

     options:
      -h, --help  show this help message and exit
      --foo FOO   FOO! (default: 42)

*note MetavarTypeHelpFormatter: 3382. は、各引数の値の表示名に *note
type: 3383. 引数の値を使用します (通常は *note dest: 3384. の値が使用さ
れます):

     >>> parser = argparse.ArgumentParser(
     ...     prog='PROG',
     ...     formatter_class=argparse.MetavarTypeHelpFormatter)
     >>> parser.add_argument('--foo', type=int)
     >>> parser.add_argument('bar', type=float)
     >>> parser.print_help()
     usage: PROG [-h] [--foo int] float

     positional arguments:
       float

     options:
       -h, --help  show this help message and exit
       --foo int


File: python.info,  Node: prefix_chars,  Next: fromfile_prefix_chars,  Prev: formatter_class,  Up: ArgumentParser オブジェクト

5.17.1.8 prefix_chars
.....................

Most command-line options will use ‘-’ as the prefix, e.g.  ‘-f/--foo’.
Parsers that need to support different or additional prefix characters,
e.g.  for options like ‘+f’ or ‘/foo’, may specify them using the
‘prefix_chars=’ argument to the *note ArgumentParser: 1bd. constructor:

     >>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')
     >>> parser.add_argument('+f')
     >>> parser.add_argument('++bar')
     >>> parser.parse_args('+f X ++bar Y'.split())
     Namespace(bar='Y', f='X')

‘prefix_chars=’ 引数のデフォルトは ‘'-'’ です。‘-’ を含まない文字セット
を指定すると、‘-f/--foo’ オプションが使用できなくなります。


File: python.info,  Node: fromfile_prefix_chars,  Next: argument_default,  Prev: prefix_chars,  Up: ArgumentParser オブジェクト

5.17.1.9 fromfile_prefix_chars
..............................

ときどき、非常に長い引数リストを扱う場合に、その引数リストを毎回コマンド
ラインにタイプする代わりにファイルに置いておきたい場合があります。*note
ArgumentParser: 1bd. のコンストラクターに ‘fromfile_prefix_chars=’ 引数
が渡された場合、指定された文字のいずれかで始まる引数はファイルとして扱わ
れ、そのファイルに含まれる引数リストに置換されます。例えば:

     >>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:
     ...     fp.write('-f\nbar')
     ...
     >>> parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
     >>> parser.add_argument('-f')
     >>> parser.parse_args(['-f', 'foo', '@args.txt'])
     Namespace(f='bar')

Arguments read from a file must be one per line by default (but see also
*note convert_arg_line_to_args(): 3385.) and are treated as if they were
in the same place as the original file referencing argument on the
command line.  So in the example above, the expression ‘['-f', 'foo',
'@args.txt']’ is considered equivalent to the expression ‘['-f', 'foo',
'-f', 'bar']’.

     注釈: Empty lines are treated as empty strings (‘''’), which are
     allowed as values but not as arguments.  Empty lines that are read
     as arguments will result in an "unrecognized arguments" error.

*note ArgumentParser: 1bd. uses *note filesystem encoding and error
handler: 75d. to read the file containing arguments.

‘fromfile_prefix_chars=’ 引数のデフォルト値は ‘None’ で、引数がファイル
参照として扱われることがないことを意味しています。

バージョン 3.12 で変更: *note ArgumentParser: 1bd. changed encoding and
errors to read arguments files from default (e.g.  *note
locale.getpreferredencoding(False): 75c. and ‘"strict"’) to the *note
filesystem encoding and error handler: 75d.  Arguments file should be
encoded in UTF-8 instead of ANSI Codepage on Windows.


File: python.info,  Node: argument_default,  Next: allow_abbrev,  Prev: fromfile_prefix_chars,  Up: ArgumentParser オブジェクト

5.17.1.10 argument_default
..........................

一般的には、引数のデフォルト値は *note add_argument(): 4bc. メソッドにデ
フォルト値を渡すか、*note set_defaults(): 3386. メソッドに名前と値のペア
を渡すことで指定します。しかしまれに、1つのパーサー全体に適用されるデフ
ォルト引数が便利なことがあります。これを行うには、 *note ArgumentParser:
1bd. に ‘argument_default=’ キーワード引数を渡します。例えば、全体で
*note parse_args(): 336d. メソッド呼び出しの属性の生成を抑制するには、
‘argument_default=SUPPRESS’ を指定します:

     >>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)
     >>> parser.add_argument('--foo')
     >>> parser.add_argument('bar', nargs='?')
     >>> parser.parse_args(['--foo', '1', 'BAR'])
     Namespace(bar='BAR', foo='1')
     >>> parser.parse_args([])
     Namespace()


File: python.info,  Node: allow_abbrev,  Next: conflict_handler,  Prev: argument_default,  Up: ArgumentParser オブジェクト

5.17.1.11 allow_abbrev
......................

通常、*note ArgumentParser: 1bd. の *note parse_args(): 336d. に引数のリ
ストを渡すとき、長いオプションは *note 短縮しても認識されます: fbf.。

この機能は、‘allow_abbrev’ に ‘False’ を指定することで無効にできます:

     >>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)
     >>> parser.add_argument('--foobar', action='store_true')
     >>> parser.add_argument('--foonley', action='store_false')
     >>> parser.parse_args(['--foon'])
     usage: PROG [-h] [--foobar] [--foonley]
     PROG: error: unrecognized arguments: --foon

Added in version 3.5.


File: python.info,  Node: conflict_handler,  Next: add_help,  Prev: allow_abbrev,  Up: ArgumentParser オブジェクト

5.17.1.12 conflict_handler
..........................

*note ArgumentParser: 1bd. オブジェクトは同じオプション文字列に対して複
数のアクションを許可していません。 デフォルトでは、*note ArgumentParser:
1bd. オブジェクトは、すでに利用されているオプション文字列を使って新しい
引数をつくろうとしたときに例外を送出します:

     >>> parser = argparse.ArgumentParser(prog='PROG')
     >>> parser.add_argument('-f', '--foo', help='old foo help')
     >>> parser.add_argument('--foo', help='new foo help')
     Traceback (most recent call last):
      ..
     ArgumentError: argument --foo: conflicting option string(s): --foo

ときどき (例えば *note parents: 3373. を利用する場合など)、古い引数を同
じオプション文字列で上書きするほうが便利な場合があります。この動作をする
には、*note ArgumentParser: 1bd. の ‘conflict_handler=’ 引数に
‘'resolve'’ を渡します:

     >>> parser = argparse.ArgumentParser(prog='PROG', conflict_handler='resolve')
     >>> parser.add_argument('-f', '--foo', help='old foo help')
     >>> parser.add_argument('--foo', help='new foo help')
     >>> parser.print_help()
     usage: PROG [-h] [-f FOO] [--foo FOO]

     options:
      -h, --help  show this help message and exit
      -f FOO      old foo help
      --foo FOO   new foo help

*note ArgumentParser: 1bd. オブジェクトは、すべてのオプション文字列が上
書きされた場合にだけアクションを削除することに注目してください。上の例で
は、 ‘--foo’ オプション文字列だけが上書きされているので、古い ‘-f/--foo’
アクションは ‘-f’ アクションとして残っています。


File: python.info,  Node: add_help,  Next: exit_on_error,  Prev: conflict_handler,  Up: ArgumentParser オブジェクト

5.17.1.13 add_help
..................

By default, *note ArgumentParser: 1bd. objects add an option which
simply displays the parser's help message.  If ‘-h’ or ‘--help’ is
supplied at the command line, the ‘ArgumentParser’ help will be printed.

必要に応じて、この help オプションを無効にする場合があります。これは
*note ArgumentParser: 1bd. の ‘add_help=’ 引数に ‘False’ を渡すことで可
能です:

     >>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)
     >>> parser.add_argument('--foo', help='foo help')
     >>> parser.print_help()
     usage: PROG [--foo FOO]

     options:
      --foo FOO  foo help

ヘルプオプションは通常 ‘-h/--help’ です。例外は ‘prefix_chars=’ が指定さ
れてその中に ‘-’ が無かった場合で、その場合は ‘-h’ と ‘--help’ は有効な
オプションではありません。この場合、‘prefix_chars’ の最初の文字がヘルプ
オプションの接頭辞として利用されます:

     >>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')
     >>> parser.print_help()
     usage: PROG [+h]

     options:
       +h, ++help  show this help message and exit


File: python.info,  Node: exit_on_error,  Next: suggest_on_error,  Prev: add_help,  Up: ArgumentParser オブジェクト

5.17.1.14 exit_on_error
.......................

Normally, when you pass an invalid argument list to the *note
parse_args(): 336d. method of an *note ArgumentParser: 1bd, it will
print a 'message' to *note sys.stderr: b33. and exit with a status code
of 2.

もしエラーを例外としてプログラム内でキャッチしたい場合は、
‘exit_on_error’ を ‘False’ に設定してください:

     >>> parser = argparse.ArgumentParser(exit_on_error=False)
     >>> parser.add_argument('--integers', type=int)
     _StoreAction(option_strings=['--integers'], dest='integers', nargs=None, const=None, default=None, type=<class 'int'>, choices=None, help=None, metavar=None)
     >>> try:
     ...     parser.parse_args('--integers a'.split())
     ... except argparse.ArgumentError:
     ...     print('Catching an argumentError')
     ...
     Catching an argumentError

Added in version 3.9.


File: python.info,  Node: suggest_on_error,  Next: color,  Prev: exit_on_error,  Up: ArgumentParser オブジェクト

5.17.1.15 suggest_on_error
..........................

By default, when a user passes an invalid argument choice or subparser
name, *note ArgumentParser: 1bd. will exit with error info and list the
permissible argument choices (if specified) or subparser names as part
of the error message.

If the user would like to enable suggestions for mistyped argument
choices and subparser names, the feature can be enabled by setting
‘suggest_on_error’ to ‘True’.  Note that this only applies for arguments
when the choices specified are strings:

     >>> parser = argparse.ArgumentParser(description='Process some integers.',
                                          suggest_on_error=True)
     >>> parser.add_argument('--action', choices=['sum', 'max'])
     >>> parser.add_argument('integers', metavar='N', type=int, nargs='+',
     ...                     help='an integer for the accumulator')
     >>> parser.parse_args(['--action', 'sumn', 1, 2, 3])
     tester.py: error: argument --action: invalid choice: 'sumn', maybe you meant 'sum'? (choose from 'sum', 'max')

If you're writing code that needs to be compatible with older Python
versions and want to opportunistically use ‘suggest_on_error’ when it's
available, you can set it as an attribute after initializing the parser
instead of using the keyword argument:

     >>> parser = argparse.ArgumentParser(description='Process some integers.')
     >>> parser.suggest_on_error = True

Added in version 3.14.


File: python.info,  Node: color,  Prev: suggest_on_error,  Up: ArgumentParser オブジェクト

5.17.1.16 color
...............

By default, the help message is printed in color using ANSI escape
sequences(1).  If you want plain text help messages, you can disable
this *note in your local environment: 1b7, or in the argument parser
itself by setting ‘color’ to ‘False’:

     >>> parser = argparse.ArgumentParser(description='Process some integers.',
     ...                                  color=False)
     >>> parser.add_argument('--action', choices=['sum', 'max'])
     >>> parser.add_argument('integers', metavar='N', type=int, nargs='+',
     ...                     help='an integer for the accumulator')
     >>> parser.parse_args(['--help'])

Note that when ‘color=True’, colored output depends on both environment
variables and terminal capabilities.  However, if ‘color=False’, colored
output is always disabled, even if environment variables like
‘FORCE_COLOR’ are set.

     注釈: Error messages will include color codes when redirecting
     stderr to a file.  To avoid this, set the NO_COLOR(2) or *note
     PYTHON_COLORS: 476. environment variable (for example, ‘NO_COLOR=1
     python script.py 2> errors.txt’).

Added in version 3.14.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/ANSI_escape_code

   (2) https://no-color.org/


File: python.info,  Node: add_argument メソッド,  Next: parse_args メソッド,  Prev: ArgumentParser オブジェクト,  Up: argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー

5.17.1.17 add_argument() メソッド
.................................

 -- メソッド: ArgumentParser.add_argument (name or flags..., *[,
          action][, nargs][, const][, default][, type][, choices][,
          required][, help][, metavar][, dest][, deprecated])

     1つのコマンドライン引数がどう解析されるかを定義します。各引数につい
     ての詳細は後述しますが、簡単に言うと:

        * *note name or flags: 3389. - Either a name or a list of option
          strings, e.g.  ‘'foo'’ or ‘'-f', '--foo'’.

        * *note action: 192b. - コマンドラインにこの引数があったときのア
          クション。

        * *note nargs: 1931. - 受け取るべきコマンドライン引数の数。

        * *note const: 1933. - 一部の *note action: 192b. と *note
          nargs: 1931. の組み合わせで利用される定数。

        * *note default: 1932. - コマンドラインに対応する引数が存在せず
          、さらに namespace オブジェクトにも存在しない場合に利用される
          値。

        * *note type: 3383. - コマンドライン引数が変換されるべき型。

        * *note choices: 192d. - 引数として許される値のシーケンス。

        * *note required: 338a. - コマンドラインオプションが省略可能かど
          うか (オプション引数のみ)。

        * *note help: 338b. - 引数が何なのかを示す簡潔な説明。

        * *note metavar: 338c. - 使用法メッセージの中で使われる引数の名
          前。

        * *note dest: 3384. - *note parse_args(): 336d. が返すオブジェク
          トに追加される属性名。

        * *note deprecated: 338d. - Whether or not use of the argument
          is deprecated.

以下の節では各オプションの利用方法を説明します。

* Menu:

* name または flags::
* action::
* nargs::
* const::
* default::
* type::
* choices::
* required::
* help::
* metavar::
* dest::
* deprecated::
* Action クラス::


File: python.info,  Node: name または flags,  Next: action,  Up: add_argument メソッド

5.17.1.18 name または flags
...........................

*note add_argument(): 4bc. メソッドは、指定されている引数が ‘-f’ や
‘--foo’ のようなオプション引数なのか、ファイル名リストなどの位置引数なの
かを知る必要があります。 そのため、 *note add_argument(): 4bc. に初めに
渡される引数は、一連のフラグか、単一の引数名のどちらかになります。

たとえば、オプション引数は次のように作成します:

     >>> parser.add_argument('-f', '--foo')

一方、位置引数は次のように作成します:

     >>> parser.add_argument('bar')

*note parse_args(): 336d. が呼ばれたとき、オプション引数は接頭辞 ‘-’ に
より識別され、それ以外の引数は位置引数として扱われます:

     >>> parser = argparse.ArgumentParser(prog='PROG')
     >>> parser.add_argument('-f', '--foo')
     >>> parser.add_argument('bar')
     >>> parser.parse_args(['BAR'])
     Namespace(bar='BAR', foo=None)
     >>> parser.parse_args(['BAR', '--foo', 'FOO'])
     Namespace(bar='BAR', foo='FOO')
     >>> parser.parse_args(['--foo', 'FOO'])
     usage: PROG [-h] [-f FOO] bar
     PROG: error: the following arguments are required: bar

By default, ‘argparse’ automatically handles the internal naming and
display names of arguments, simplifying the process without requiring
additional configuration.  As such, you do not need to specify the *note
dest: 3384. and *note metavar: 338c. parameters.  The *note dest: 3384.
parameter defaults to the argument name with underscores ‘_’ replacing
hyphens ‘-’ .  The *note metavar: 338c. parameter defaults to the
upper-cased name.  For example:

     >>> parser = argparse.ArgumentParser(prog='PROG')
     >>> parser.add_argument('--foo-bar')
     >>> parser.parse_args(['--foo-bar', 'FOO-BAR'])
     Namespace(foo_bar='FOO-BAR')
     >>> parser.print_help()
     usage:  [-h] [--foo-bar FOO-BAR]

     optional arguments:
      -h, --help  show this help message and exit
      --foo-bar FOO-BAR


File: python.info,  Node: action,  Next: nargs,  Prev: name または flags,  Up: add_argument メソッド

5.17.1.19 action
................

*note ArgumentParser: 1bd. オブジェクトはコマンドライン引数にアクション
を割り当てます。このアクションは、割り当てられたコマンドライン引数に関し
てどんな処理でもできますが、ほとんどのアクションは単に *note
parse_args(): 336d. が返すオブジェクトに属性を追加するだけです。‘action’
キーワード引数は、コマンドライン引数がどう処理されるかを指定します。提供
されているアクションは:

   * ‘'store'’ - This just stores the argument's value.  This is the
     default action.

   * ‘'store_const'’ - このアクションは *note const: 1933. キーワード引
     数で指定された値を格納します。*note const: 1933. キーワード引数のデ
     フォルト値は ‘None’ であることに注意してください。‘'store_const'’ ア
     クションは、何かの種類のフラグを指定するオプション引数によく使われ
     ます。例えば:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo', action='store_const', const=42)
          >>> parser.parse_args(['--foo'])
          Namespace(foo=42)

   * ‘'store_true'’ and ‘'store_false'’ - These are special cases of
     ‘'store_const'’ that respectively store the values ‘True’ and
     ‘False’ with default values of ‘False’ and ‘True’:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo', action='store_true')
          >>> parser.add_argument('--bar', action='store_false')
          >>> parser.add_argument('--baz', action='store_false')
          >>> parser.parse_args('--foo --bar'.split())
          Namespace(foo=True, bar=False, baz=True)

   * ‘'append'’ - This appends each argument value to a list.  It is
     useful for allowing an option to be specified multiple times.  If
     the default value is a non-empty list, the parsed value will start
     with the default list's elements and any values from the command
     line will be appended after those default values.  Example usage:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo', action='append', default=['0'])
          >>> parser.parse_args('--foo 1 --foo 2'.split())
          Namespace(foo=['0', '1', '2'])

   * ‘'append_const'’ - This appends the value specified by the *note
     const: 1933. keyword argument to a list; note that the *note const:
     1933. keyword argument defaults to ‘None’.  The ‘'append_const'’
     action is typically useful when multiple arguments need to store
     constants to the same list.  For example:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--str', dest='types', action='append_const', const=str)
          >>> parser.add_argument('--int', dest='types', action='append_const', const=int)
          >>> parser.parse_args('--str --int'.split())
          Namespace(types=[<class 'str'>, <class 'int'>])

   * ‘'extend'’ - This appends each item from a multi-value argument to
     a list.  The ‘'extend'’ action is typically used with the *note
     nargs: 1931. keyword argument value ‘'+'’ or ‘'*'’.  Note that when
     *note nargs: 1931. is ‘None’ (the default) or ‘'?'’, each character
     of the argument string will be appended to the list.  Example
     usage:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument("--foo", action="extend", nargs="+", type=str)
          >>> parser.parse_args(["--foo", "f1", "--foo", "f2", "f3", "f4"])
          Namespace(foo=['f1', 'f2', 'f3', 'f4'])

     Added in version 3.8.

   * ‘'count'’ - This counts the number of times an argument occurs.
     For example, this is useful for increasing verbosity levels:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--verbose', '-v', action='count', default=0)
          >>> parser.parse_args(['-vvv'])
          Namespace(verbose=3)

     'default' は明示的に '0' と指定されない場合は ‘None’ であることに注
     意してください。

   * ‘'help'’ - このアクションは現在のパーサー中のすべてのオプションのヘ
     ルプメッセージを表示し、終了します。出力の生成方法の詳細については
     *note ArgumentParser: 1bd. を参照してください。

   * ‘'version'’ - このアクションは *note add_argument(): 4bc. の呼び出
     しに ‘version=’ キーワード引数を期待します。指定されたときはバージ
     ョン情報を表示して終了します:

          >>> import argparse
          >>> parser = argparse.ArgumentParser(prog='PROG')
          >>> parser.add_argument('--version', action='version', version='%(prog)s 2.0')
          >>> parser.parse_args(['--version'])
          PROG 2.0

You may also specify an arbitrary action by passing an *note Action:
1b8c. subclass (e.g.  *note BooleanOptionalAction: 1bf2.) or other
object that implements the same interface.  Only actions that consume
command-line arguments (e.g.  ‘'store'’, ‘'append'’, ‘'extend'’, or
custom actions with non-zero ‘nargs’) can be used with positional
arguments.

The recommended way to create a custom action is to extend *note Action:
1b8c, overriding the ‘__call__()’ method and optionally the ‘__init__()’
and ‘format_usage()’ methods.  You can also register custom actions
using the *note register(): 3390. method and reference them by their
registered name.

カスタムアクションの例です:

     >>> class FooAction(argparse.Action):
     ...     def __init__(self, option_strings, dest, nargs=None, **kwargs):
     ...         if nargs is not None:
     ...             raise ValueError("nargs not allowed")
     ...         super().__init__(option_strings, dest, **kwargs)
     ...     def __call__(self, parser, namespace, values, option_string=None):
     ...         print('%r %r %r' % (namespace, values, option_string))
     ...         setattr(namespace, self.dest, values)
     ...
     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('--foo', action=FooAction)
     >>> parser.add_argument('bar', action=FooAction)
     >>> args = parser.parse_args('1 --foo 2'.split())
     Namespace(bar=None, foo=None) '1' None
     Namespace(bar='1', foo=None) '2' '--foo'
     >>> args
     Namespace(bar='1', foo='2')

詳細は *note Action: 1b8c. を参照してください。


File: python.info,  Node: nargs,  Next: const,  Prev: action,  Up: add_argument メソッド

5.17.1.20 nargs
...............

*note ArgumentParser: 1bd. objects usually associate a single
command-line argument with a single action to be taken.  The ‘nargs’
keyword argument associates a different number of command-line arguments
with a single action.  See also *note 多義性のある引数の指定: 3392.  The
supported values are:

   * ‘N’ (整数) - ‘N’ 個の引数がコマンドラインから集められ、リストに格納
     されます。例えば:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo', nargs=2)
          >>> parser.add_argument('bar', nargs=1)
          >>> parser.parse_args('c --foo a b'.split())
          Namespace(bar=['c'], foo=['a', 'b'])

     ‘nargs=1’ は1要素のリストを作ることに注意してください。これはデフォ
     ルトの、要素がそのまま属性になる動作とは異なります。

   * ‘'?'’ - 可能なら1つの引数がコマンドラインから取られ、1つのアイテム
     を作ります。コマンドライン引数が存在しない場合、*note default:
     1932. の値が生成されます。オプション引数の場合、さらにオプション引
     数が指定され、その後にコマンドライン引数がないというケースもありえ
     ます。この場合は *note const: 1933. の値が生成されます。この動作の
     例です:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo', nargs='?', const='c', default='d')
          >>> parser.add_argument('bar', nargs='?', default='d')
          >>> parser.parse_args(['XX', '--foo', 'YY'])
          Namespace(bar='XX', foo='YY')
          >>> parser.parse_args(['XX', '--foo'])
          Namespace(bar='XX', foo='c')
          >>> parser.parse_args([])
          Namespace(bar='d', foo='d')

     ‘nargs='?'’ のよくある利用例の1つは、入出力ファイルの指定オプション
     です:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('infile', nargs='?')
          >>> parser.add_argument('outfile', nargs='?')
          >>> parser.parse_args(['input.txt', 'output.txt'])
          Namespace(infile='input.txt', outfile='output.txt')
          >>> parser.parse_args(['input.txt'])
          Namespace(infile='input.txt', outfile=None)
          >>> parser.parse_args([])
          Namespace(infile=None, outfile=None)

   * ‘'*'’ - すべてのコマンドライン引数がリストに集められます。複数の位
     置引数が ‘nargs='*'’ を持つことにあまり意味はありませんが、複数のオ
     プション引数が ‘nargs='*'’ を持つことはありえます。例えば:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo', nargs='*')
          >>> parser.add_argument('--bar', nargs='*')
          >>> parser.add_argument('baz', nargs='*')
          >>> parser.parse_args('a b --foo x y --bar 1 2'.split())
          Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])

   * ‘'+'’.  Just like ‘'*'’, all command-line arguments present are
     gathered into a list.  Additionally, an error message will be
     generated if there wasn't at least one command-line argument
     present.  For example:

          >>> parser = argparse.ArgumentParser(prog='PROG')
          >>> parser.add_argument('foo', nargs='+')
          >>> parser.parse_args(['a', 'b'])
          Namespace(foo=['a', 'b'])
          >>> parser.parse_args([])
          usage: PROG [-h] foo [foo ...]
          PROG: error: the following arguments are required: foo

If the ‘nargs’ keyword argument is not provided, the number of arguments
consumed is determined by the *note action: 192b.  Generally this means
a single command-line argument will be consumed and a single item (not a
list) will be produced.  Actions that do not consume command-line
arguments (e.g.  ‘'store_const'’) set ‘nargs=0’.


File: python.info,  Node: const,  Next: default,  Prev: nargs,  Up: add_argument メソッド

5.17.1.21 const
...............

*note add_argument(): 4bc. の ‘const’ 引数は、コマンドライン引数から読み
込まれないけれども *note ArgumentParser: 1bd. のいくつかのアクションで必
要とされる値のために使われます。この引数のよくある2つの使用法は:

   * *note add_argument(): 4bc. が ‘action='store_const'’ か
     ‘action='append_const'’ で呼び出されたとき、これらのアクションは
     ‘const’ の値を *note parse_args(): 336d. が返すオブジェクトの属性に
     追加します。サンプルは *note action: 192b. の説明を参照してください
     。‘const’ が *note add_argument(): 4bc. に与えられなければ、‘None’
     のデフォルト値を受け取ります。

   * When *note add_argument(): 4bc. is called with option strings (like
     ‘-f’ or ‘--foo’) and ‘nargs='?'’.  This creates an optional
     argument that can be followed by zero or one command-line
     arguments.  When parsing the command line, if the option string is
     encountered with no command-line argument following it, the value
     from ‘const’ will be used.  See the *note nargs: 1931. description
     for examples.

バージョン 3.11 で変更: ‘action='append_const'’ や
‘action='store_const'’ の場合も含め、デフォルトでは ‘const=None’ です。


File: python.info,  Node: default,  Next: type,  Prev: const,  Up: add_argument メソッド

5.17.1.22 default
.................

すべてのオプション引数といくつかの位置引数はコマンドライン上で省略される
ことがあります。 *note add_argument(): 4bc. の ‘default’ キーワード引数
(デフォルト: ‘None’) は、コマンドライン引数が存在しなかった場合に利用す
る値を指定します。オプション引数では、オプション文字列がコマンドライン上
に存在しなかったときに ‘default’ の値が利用されます:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('--foo', default=42)
     >>> parser.parse_args(['--foo', '2'])
     Namespace(foo='2')
     >>> parser.parse_args([])
     Namespace(foo=42)

If the target namespace already has an attribute set, the action
'default' will not overwrite it:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('--foo', default=42)
     >>> parser.parse_args([], namespace=argparse.Namespace(foo=101))
     Namespace(foo=101)

‘default’ の値が文字列の場合、パーサーは値をコマンドライン引数のように解
析します。具体的には、パーサーは返り値 *note Namespace: 336e. の属性を設
定する前に、*note type: 3383. 変換引数が与えられていればそれらを適用しま
す。そうでない場合、パーサーは値をそのまま使用します:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('--length', default='10', type=int)
     >>> parser.add_argument('--width', default=10.5, type=int)
     >>> parser.parse_args()
     Namespace(length=10, width=10.5)

*note nargs: 1931. が ‘?’ か ‘*’ である位置引数では、コマンドライン引数
が指定されなかった場合 ‘default’ の値が使われます。例えば:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('foo', nargs='?', default=42)
     >>> parser.parse_args(['a'])
     Namespace(foo='a')
     >>> parser.parse_args([])
     Namespace(foo=42)

For *note required: 338a. arguments, the ‘default’ value is ignored.
For example, this applies to positional arguments with *note nargs:
1931. values other than ‘?’ or ‘*’, or optional arguments marked as
‘required=True’.

‘default=argparse.SUPPRESS’ を渡すと、コマンドライン引数が存在しないとき
に属性の追加をしなくなります:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('--foo', default=argparse.SUPPRESS)
     >>> parser.parse_args([])
     Namespace()
     >>> parser.parse_args(['--foo', '1'])
     Namespace(foo='1')


File: python.info,  Node: type,  Next: choices,  Prev: default,  Up: add_argument メソッド

5.17.1.23 type
..............

デフォルトでは、パーサーはコマンドライン引数を単なる文字列として読み込み
ます。しかし、それらの文字列を *note float: 196, *note int: 19b. など別
の型として扱うべき事がよくあります。*note add_argument(): 4bc. の ‘type’
キーワード引数に指定する type converter により、必要な型チェックと型変換
を行うことができます。

もし *note type: 3383. キーワードが *note default: 1932. キーワードとと
もに使用された場合、*note default: 1932. の値が文字列のときのみ、type
converter による変換などが行われます。

The argument to ‘type’ can be a callable that accepts a single string or
the name of a registered type (see *note register(): 3390.) If the
function raises *note ArgumentTypeError: 3396, *note TypeError: 198, or
*note ValueError: 2ec, the exception is caught and a nicely formatted
error message is displayed.  Other exception types are not handled.

一般的なビルトインデータ型や関数を ‘type’ 引数の値として直接指定できます
:

     import argparse
     import pathlib

     parser = argparse.ArgumentParser()
     parser.add_argument('count', type=int)
     parser.add_argument('distance', type=float)
     parser.add_argument('street', type=ascii)
     parser.add_argument('code_point', type=ord)
     parser.add_argument('datapath', type=pathlib.Path)

ユーザが定義した関数も使用できます:

     >>> def hyphenated(string):
     ...     return '-'.join([word[:4] for word in string.casefold().split()])
     ...
     >>> parser = argparse.ArgumentParser()
     >>> _ = parser.add_argument('short_title', type=hyphenated)
     >>> parser.parse_args(['"The Tale of Two Cities"'])
     Namespace(short_title='"the-tale-of-two-citi')

Type converter として *note bool(): 3c3. 関数を使用することは推奨されま
せん。なぜなら、これは空文字列を ‘False’ に、それ以外の全てを ‘True’ に
変換しますが、これはおそらく望まれる動作ではないからです (訳注: 文字列
‘'false'’ を ‘False’ に変換してくれたりはしません)。

一般論として、‘type’ キーワードに指定するものは、せいぜい上記の3種類の例
外を発生するくらいの、お手軽な変換に限るべきです。より複雑な
(interesting) エラー処理、またはリソース管理を伴うものは、引数を解析した
あとに別個の処理として行うべきです。

たとえば、JSON または YAML からの変換は複雑なエラーケースを持つので、
‘type’ がサポートする以上のエラー表示を必要とするでしょう。(JSON デコー
ダが発生しうる) *note JSONDecodeError: 1022. は適切に整形されて表示され
ません。また、*note FileNotFoundError: 264. が発生しても parser は何も処
理しません。

Even *note FileType: 30c. has its limitations for use with the ‘type’
keyword.  If one argument uses *note FileType: 30c. and then a
subsequent argument fails, an error is reported but the file is not
automatically closed.  In this case, it would be better to wait until
after the parser has run and then use the *note with: 186.-statement to
manage the files.

なお、引数が、あらかじめ決められた値の候補のいずれかに一致するかをチェッ
クしたいだけの場合には、代わりに *note choices: 192d. キーワードの使用を
検討してください。


File: python.info,  Node: choices,  Next: required,  Prev: type,  Up: add_argument メソッド

5.17.1.24 choices
.................

コマンドライン引数をいくつかの選択肢の中から選ばせたい場合があります。 こ
れは *note add_argument(): 4bc. に シーケンスオブジェクトを 'choices' キ
ーワード引数として渡すことで可能です。コマンドラインを解析するとき、引数
の値がチェックされ、その値が選択肢の中に含まれていない場合はエラーメッセ
ージを表示します:

     >>> parser = argparse.ArgumentParser(prog='game.py')
     >>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])
     >>> parser.parse_args(['rock'])
     Namespace(move='rock')
     >>> parser.parse_args(['fire'])
     usage: game.py [-h] {rock,paper,scissors}
     game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',
     'paper', 'scissors')

任意のシーケンスを 'choices' に渡すことができます。すなわち、*note list:
24d. オブジェクト、 *note tuple: 614. オブジェクト、カスタムシーケンスは
すべてサポートされています。

ただし、*note enum.Enum: 842. を渡すことは推奨されません。使用方法、ヘル
プ、エラーメッセージなどでどのように表示されるかを制御することが難いから
です。

Note that 'choices' are checked after any *note type: 3383. conversions
have been performed, so objects in 'choices' should match the *note
type: 3383. specified.  This can make 'choices' appear unfamiliar in
usage, help, or error messages.

To keep 'choices' user-friendly, consider a custom type wrapper that
converts and formats values, or omit *note type: 3383. and handle
conversion in your application code.

ヘルプテキストにおいて整形された choices の値は、通常 'dest' から生成さ
れるデフォルトの 'metavar' に優先します。ユーザーは 'dest' パラメータを
目にすることがないため、この振る舞いは基本的には望ましいものです。もしこ
の表示方法が望ましくない場合 (おそらく多くの選択肢がある場合など) は、
*note metavar: 338c. を明示的に指定してください。


File: python.info,  Node: required,  Next: help,  Prev: choices,  Up: add_argument メソッド

5.17.1.25 required
..................

In general, the ‘argparse’ module assumes that flags like ‘-f’ and
‘--bar’ indicate 'optional' arguments, which can always be omitted at
the command line.  To make an option 'required', ‘True’ can be specified
for the ‘required=’ keyword argument to *note add_argument(): 4bc.:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('--foo', required=True)
     >>> parser.parse_args(['--foo', 'BAR'])
     Namespace(foo='BAR')
     >>> parser.parse_args([])
     usage: [-h] --foo FOO
     : error: the following arguments are required: --foo

上の例のように、引数が ‘required’ と指定されると、*note parse_args():
336d. はそのフラグがコマンドラインに存在しないときにエラーを表示します。

     注釈: ユーザーは、通常 'フラグ' の指定は '任意' であると認識してい
     るため、必須にするのは一般的には悪いやり方で、できる限り避けるべき
     です。


File: python.info,  Node: help,  Next: metavar,  Prev: required,  Up: add_argument メソッド

5.17.1.26 help
..............

The ‘help’ value is a string containing a brief description of the
argument.  When a user requests help (usually by using ‘-h’ or ‘--help’
at the command line), these ‘help’ descriptions will be displayed with
each argument.

‘help’ 文字列には、プログラム名や引数の *note default: 1932. などを繰り
返し記述するのを避けるためのフォーマット指定子を含めることができます。利
用できる指定子には、プログラム名 ‘%(prog)s’ と、 ‘%(default)s’ や
‘%(type)s’ など *note add_argument(): 4bc. のキーワード引数の多くが含ま
れます:

     >>> parser = argparse.ArgumentParser(prog='frobble')
     >>> parser.add_argument('bar', nargs='?', type=int, default=42,
     ...                     help='the bar to %(prog)s (default: %(default)s)')
     >>> parser.print_help()
     usage: frobble [-h] [bar]

     positional arguments:
      bar     the bar to frobble (default: 42)

     options:
      -h, --help  show this help message and exit

ヘルプ文字列は %-フォーマットをサポートしているので、ヘルプ文字列内にリ
テラル ‘%’ を表示したい場合は ‘%%’ のようにエスケープしなければなりませ
ん。

‘argparse’ supports silencing the help entry for certain options, by
setting the ‘help’ value to ‘argparse.SUPPRESS’:

     >>> parser = argparse.ArgumentParser(prog='frobble')
     >>> parser.add_argument('--foo', help=argparse.SUPPRESS)
     >>> parser.print_help()
     usage: frobble [-h]

     options:
       -h, --help  show this help message and exit


File: python.info,  Node: metavar,  Next: dest,  Prev: help,  Up: add_argument メソッド

5.17.1.27 metavar
.................

When *note ArgumentParser: 1bd. generates help messages, it needs some
way to refer to each expected argument.  By default, ‘ArgumentParser’
objects use the *note dest: 3384. value as the "name" of each object.
By default, for positional argument actions, the *note dest: 3384. value
is used directly, and for optional argument actions, the *note dest:
3384. value is uppercased.  So, a single positional argument with
‘dest='bar'’ will be referred to as ‘bar’.  A single optional argument
‘--foo’ that should be followed by a single command-line argument will
be referred to as ‘FOO’.  An example:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('--foo')
     >>> parser.add_argument('bar')
     >>> parser.parse_args('X --foo Y'.split())
     Namespace(bar='X', foo='Y')
     >>> parser.print_help()
     usage:  [-h] [--foo FOO] bar

     positional arguments:
      bar

     options:
      -h, --help  show this help message and exit
      --foo FOO

代わりの名前を、‘metavar’ として指定できます:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('--foo', metavar='YYY')
     >>> parser.add_argument('bar', metavar='XXX')
     >>> parser.parse_args('X --foo Y'.split())
     Namespace(bar='X', foo='Y')
     >>> parser.print_help()
     usage:  [-h] [--foo YYY] XXX

     positional arguments:
      XXX

     options:
      -h, --help  show this help message and exit
      --foo YYY

‘metavar’ は '表示される' 名前だけを変更することに注意してください。
*note parse_args(): 336d. の返すオブジェクトの属性名は *note dest: 3384.
の値のままです。

‘nargs’ を指定した場合、metavar が複数回利用されるかもしれません。
‘metavar’ にタプルを渡すと、各引数に対して異なる名前を指定できます:

     >>> parser = argparse.ArgumentParser(prog='PROG')
     >>> parser.add_argument('-x', nargs=2)
     >>> parser.add_argument('--foo', nargs=2, metavar=('bar', 'baz'))
     >>> parser.print_help()
     usage: PROG [-h] [-x X X] [--foo bar baz]

     options:
      -h, --help     show this help message and exit
      -x X X
      --foo bar baz


File: python.info,  Node: dest,  Next: deprecated,  Prev: metavar,  Up: add_argument メソッド

5.17.1.28 dest
..............

ほとんどの *note ArgumentParser: 1bd. のアクションは *note parse_args():
336d. が返すオブジェクトに対する属性として値を追加します。この属性の名前
は *note add_argument(): 4bc. の ‘dest’ キーワード引数によって決定されま
す。位置引数のアクションについては、 ‘dest’ は通常 *note add_argument():
4bc. の第一引数として渡します:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('bar')
     >>> parser.parse_args(['XXX'])
     Namespace(bar='XXX')

オプション引数のアクションについては、 ‘dest’ の値は通常オプション文字列
から生成されます。 *note ArgumentParser: 1bd. は最初の長いオプション文字
列を選択し、先頭の ‘--’ を除去することで ‘dest’ の値を生成します。長いオ
プション文字列が指定されていない場合、最初の短いオプション文字列から先頭
の ‘-’ 文字を除去することで ‘dest’ を生成します。先頭以外のすべての ‘-’
文字は、妥当な属性名になるように ‘_’ 文字へ変換されます。次の例はこの動
作を示しています:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('-f', '--foo-bar', '--foo')
     >>> parser.add_argument('-x', '-y')
     >>> parser.parse_args('-f 1 -x 2'.split())
     Namespace(foo_bar='1', x='2')
     >>> parser.parse_args('--foo 1 -y 2'.split())
     Namespace(foo_bar='1', x='2')

‘dest’ にカスタムの属性名を与えることも可能です:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument('--foo', dest='bar')
     >>> parser.parse_args('--foo XXX'.split())
     Namespace(bar='XXX')


File: python.info,  Node: deprecated,  Next: Action クラス,  Prev: dest,  Up: add_argument メソッド

5.17.1.29 deprecated
....................

During a project's lifetime, some arguments may need to be removed from
the command line.  Before removing them, you should inform your users
that the arguments are deprecated and will be removed.  The ‘deprecated’
keyword argument of *note add_argument(): 4bc, which defaults to
‘False’, specifies if the argument is deprecated and will be removed in
the future.  For arguments, if ‘deprecated’ is ‘True’, then a warning
will be printed to *note sys.stderr: b33. when the argument is used:

     >>> import argparse
     >>> parser = argparse.ArgumentParser(prog='snake.py')
     >>> parser.add_argument('--legs', default=0, type=int, deprecated=True)
     >>> parser.parse_args([])
     Namespace(legs=0)
     >>> parser.parse_args(['--legs', '4'])
     snake.py: warning: option '--legs' is deprecated
     Namespace(legs=4)

Added in version 3.13.


File: python.info,  Node: Action クラス,  Prev: deprecated,  Up: add_argument メソッド

5.17.1.30 Action クラス
.......................

‘Action’ classes implement the Action API, a callable which returns a
callable which processes arguments from the command-line.  Any object
which follows this API may be passed as the ‘action’ parameter to *note
add_argument(): 4bc.

 -- クラス: argparse.Action (option_strings, dest, nargs=None,
          const=None, default=None, type=None, choices=None,
          required=False, help=None, metavar=None)

     ‘Action’ objects are used by an *note ArgumentParser: 1bd. to
     represent the information needed to parse a single argument from
     one or more strings from the command line.  The ‘Action’ class must
     accept the two positional arguments plus any keyword arguments
     passed to *note ArgumentParser.add_argument(): 4bc. except for the
     ‘action’ itself.

     Instances of ‘Action’ (or return value of any callable to the
     ‘action’ parameter) should have attributes ‘dest’,
     ‘option_strings’, ‘default’, ‘type’, ‘required’, ‘help’, etc.
     defined.  The easiest way to ensure these attributes are defined is
     to call ‘Action.__init__()’.

      -- メソッド: __call__ (parser, namespace, values,
               option_string=None)

          ‘Action’ instances should be callable, so subclasses must
          override the ‘__call__()’ method, which should accept four
          parameters:

             * 'parser' - The *note ArgumentParser: 1bd. object which
               contains this action.

             * 'namespace' - The *note Namespace: 336e. object that will
               be returned by *note parse_args(): 336d.  Most actions
               add an attribute to this object using *note setattr():
               25be.

             * 'values' - The associated command-line arguments, with
               any type conversions applied.  Type conversions are
               specified with the *note type: 3383. keyword argument to
               *note add_argument(): 4bc.

             * 'option_string' - The option string that was used to
               invoke this action.  The ‘option_string’ argument is
               optional, and will be absent if the action is associated
               with a positional argument.

          The ‘__call__()’ method may perform arbitrary actions, but
          will typically set attributes on the ‘namespace’ based on
          ‘dest’ and ‘values’.

      -- メソッド: format_usage ()

          ‘Action’ subclasses can define a ‘format_usage()’ method that
          takes no argument and return a string which will be used when
          printing the usage of the program.  If such method is not
          provided, a sensible default will be used.

 -- クラス: argparse.BooleanOptionalAction

     A subclass of *note Action: 1b8c. for handling boolean flags with
     positive and negative options.  Adding a single argument such as
     ‘--foo’ automatically creates both ‘--foo’ and ‘--no-foo’ options,
     storing ‘True’ and ‘False’ respectively:

          >>> import argparse
          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo', action=argparse.BooleanOptionalAction)
          >>> parser.parse_args(['--no-foo'])
          Namespace(foo=False)

     Added in version 3.9.


File: python.info,  Node: parse_args メソッド,  Next: その他のユーティリティ,  Prev: add_argument メソッド,  Up: argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー

5.17.1.31 parse_args() メソッド
...............................

 -- メソッド: ArgumentParser.parse_args (args=None, namespace=None)

     引数の文字列をオブジェクトに変換し、namespace オブジェクトの属性に
     代入します。結果の namespace オブジェクトを返します。

     Previous calls to *note add_argument(): 4bc. determine exactly what
     objects are created and how they are assigned.  See the
     documentation for ‘add_argument()’ for details.

        * *note args: 33a1. - 解析する文字列のリスト。デフォルトでは
          *note sys.argv: 147c. から取得されます。

        * *note namespace: 33a2. - 属性を代入するオブジェクト。デフォル
          トでは、新しい空の *note Namespace: 336e. オブジェクトです。

* Menu:

* オプション値の文法::
* 不正な引数::
* - を含む引数::
* 引数の短縮形 (先頭文字でのマッチング): 引数の短縮形 先頭文字でのマッチング.
* sys.argv 以外: sys argv 以外.
* Namespace オブジェクト::


File: python.info,  Node: オプション値の文法,  Next: 不正な引数,  Up: parse_args メソッド

5.17.1.32 オプション値の文法
............................

*note parse_args(): 336d. メソッドは、オプションの値がある場合、そのオプ
ションの値の指定に複数の方法をサポートしています。もっとも単純な場合には
、オプションとその値は次のように2つの別々の引数として渡されます:

     >>> parser = argparse.ArgumentParser(prog='PROG')
     >>> parser.add_argument('-x')
     >>> parser.add_argument('--foo')
     >>> parser.parse_args(['-x', 'X'])
     Namespace(foo=None, x='X')
     >>> parser.parse_args(['--foo', 'FOO'])
     Namespace(foo='FOO', x=None)

長いオプション (1文字よりも長い名前を持ったオプション) では、オプション
とその値は次のように ‘=’ で区切られた1つのコマンドライン引数として渡すこ
ともできます:

     >>> parser.parse_args(['--foo=FOO'])
     Namespace(foo='FOO', x=None)

短いオプション (1文字のオプション) では、オプションとその値は次のように
連結して渡すことができます:

     >>> parser.parse_args(['-xX'])
     Namespace(foo=None, x='X')

最後の1つのオプションだけが値を要求する場合、または値を要求するオプショ
ンがない場合、複数の短いオプションは次のように1つの接頭辞 ‘-’ だけで連結
できます:

     >>> parser = argparse.ArgumentParser(prog='PROG')
     >>> parser.add_argument('-x', action='store_true')
     >>> parser.add_argument('-y', action='store_true')
     >>> parser.add_argument('-z')
     >>> parser.parse_args(['-xyzZ'])
     Namespace(x=True, y=True, z='Z')


File: python.info,  Node: 不正な引数,  Next: - を含む引数,  Prev: オプション値の文法,  Up: parse_args メソッド

5.17.1.33 不正な引数
....................

*note parse_args(): 336d. は、コマンドラインの解析中に、曖昧なオプション
、不正な型、不正なオプション、位置引数の数の不一致などのエラーを検証しま
す。それらのエラーが発生した場合、エラーメッセージと使用法メッセージを表
示して終了します:

     >>> parser = argparse.ArgumentParser(prog='PROG')
     >>> parser.add_argument('--foo', type=int)
     >>> parser.add_argument('bar', nargs='?')

     >>> # invalid type
     >>> parser.parse_args(['--foo', 'spam'])
     usage: PROG [-h] [--foo FOO] [bar]
     PROG: error: argument --foo: invalid int value: 'spam'

     >>> # invalid option
     >>> parser.parse_args(['--bar'])
     usage: PROG [-h] [--foo FOO] [bar]
     PROG: error: no such option: --bar

     >>> # wrong number of arguments
     >>> parser.parse_args(['spam', 'badger'])
     usage: PROG [-h] [--foo FOO] [bar]
     PROG: error: extra arguments found: badger


File: python.info,  Node: - を含む引数,  Next: 引数の短縮形 先頭文字でのマッチング,  Prev: 不正な引数,  Up: parse_args メソッド

5.17.1.34 ‘-’ を含む引数
........................

*note parse_args(): 336d. メソッドは、ユーザーが明らかなミスをした場合は
エラーを表示しますが、いくつか本質的に曖昧な場面があります。例えば、コマ
ンドライン引数 ‘-1’ は、オプションの指定かもしれませんし位置引数かもしれ
ません。*note parse_args(): 336d. メソッドはこれを次のように扱います: 負
の数として解釈でき、パーサーに負の数のように解釈できるオプションが存在し
ない場合にのみ、‘-’ で始まる位置引数になりえます:

     >>> parser = argparse.ArgumentParser(prog='PROG')
     >>> parser.add_argument('-x')
     >>> parser.add_argument('foo', nargs='?')

     >>> # no negative number options, so -1 is a positional argument
     >>> parser.parse_args(['-x', '-1'])
     Namespace(foo=None, x='-1')

     >>> # no negative number options, so -1 and -5 are positional arguments
     >>> parser.parse_args(['-x', '-1', '-5'])
     Namespace(foo='-5', x='-1')

     >>> parser = argparse.ArgumentParser(prog='PROG')
     >>> parser.add_argument('-1', dest='one')
     >>> parser.add_argument('foo', nargs='?')

     >>> # negative number options present, so -1 is an option
     >>> parser.parse_args(['-1', 'X'])
     Namespace(foo=None, one='X')

     >>> # negative number options present, so -2 is an option
     >>> parser.parse_args(['-2'])
     usage: PROG [-h] [-1 ONE] [foo]
     PROG: error: no such option: -2

     >>> # negative number options present, so both -1s are options
     >>> parser.parse_args(['-1', '-1'])
     usage: PROG [-h] [-1 ONE] [foo]
     PROG: error: argument -1: expected one argument

‘-’ で始まる位置引数があって、それが負の数として解釈できない場合、ダミー
の引数 ‘'--'’ を挿入して、*note parse_args(): 336d. にそれ以降のすべてが
位置引数だと教えることができます:

     >>> parser.parse_args(['--', '-f'])
     Namespace(foo='-f', one=None)

See also *note the argparse howto on ambiguous arguments: 3392. for more
details.


File: python.info,  Node: 引数の短縮形 先頭文字でのマッチング,  Next: sys argv 以外,  Prev: - を含む引数,  Up: parse_args メソッド

5.17.1.35 引数の短縮形 (先頭文字でのマッチング)
...............................................

*note parse_args(): 336d. メソッドは、*note デフォルトで: fbe.、長いオプ
ションに曖昧さがない (先頭文字列が一意である) かぎり、先頭文字列に短縮し
て指定できます:

     >>> parser = argparse.ArgumentParser(prog='PROG')
     >>> parser.add_argument('-bacon')
     >>> parser.add_argument('-badger')
     >>> parser.parse_args('-bac MMM'.split())
     Namespace(bacon='MMM', badger=None)
     >>> parser.parse_args('-bad WOOD'.split())
     Namespace(bacon=None, badger='WOOD')
     >>> parser.parse_args('-ba BA'.split())
     usage: PROG [-h] [-bacon BACON] [-badger BADGER]
     PROG: error: ambiguous option: -ba could match -badger, -bacon

先頭の文字が同じ引数が複数ある場合に短縮指定を行うとエラーを発生させます
。この機能は *note allow_abbrev: fbe. に ‘False’ を指定することで無効に
できます。


File: python.info,  Node: sys argv 以外,  Next: Namespace オブジェクト,  Prev: 引数の短縮形 先頭文字でのマッチング,  Up: parse_args メソッド

5.17.1.36 ‘sys.argv’ 以外
.........................

Sometimes it may be useful to have an *note ArgumentParser: 1bd. parse
arguments other than those of *note sys.argv: 147c.  This can be
accomplished by passing a list of strings to *note parse_args(): 336d.
This is useful for testing at the interactive prompt:

     >>> parser = argparse.ArgumentParser()
     >>> parser.add_argument(
     ...     'integers', metavar='int', type=int, choices=range(10),
     ...     nargs='+', help='an integer in the range 0..9')
     >>> parser.add_argument(
     ...     '--sum', dest='accumulate', action='store_const', const=sum,
     ...     default=max, help='sum the integers (default: find the max)')
     >>> parser.parse_args(['1', '2', '3', '4'])
     Namespace(accumulate=<built-in function max>, integers=[1, 2, 3, 4])
     >>> parser.parse_args(['1', '2', '3', '4', '--sum'])
     Namespace(accumulate=<built-in function sum>, integers=[1, 2, 3, 4])


File: python.info,  Node: Namespace オブジェクト,  Prev: sys argv 以外,  Up: parse_args メソッド

5.17.1.37 Namespace オブジェクト
................................

 -- クラス: argparse.Namespace

     *note parse_args(): 336d. が属性を格納して返すためのオブジェクトに
     デフォルトで使用されるシンプルなクラスです。

     このクラスはシンプルに設計されており、単に読みやすい文字列表現を持
     った *note object: c7e. のサブクラスです。もし属性を辞書のように扱
     える方が良ければ、標準的な Python のイディオム *note vars(): 1e23.
     を利用できます:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo')
          >>> args = parser.parse_args(['--foo', 'BAR'])
          >>> vars(args)
          {'foo': 'BAR'}

     *note ArgumentParser: 1bd. が、新しい *note Namespace: 336e. オブジ
     ェクトではなく、既存のオブジェクトに属性を設定する方が良い場合があ
     ります。これは ‘namespace=’ キーワード引数を指定することで可能です:

          >>> class C:
          ...     pass
          ...
          >>> c = C()
          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo')
          >>> parser.parse_args(args=['--foo', 'BAR'], namespace=c)
          >>> c.foo
          'BAR'


File: python.info,  Node: その他のユーティリティ,  Next: 例外<11>,  Prev: parse_args メソッド,  Up: argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー

5.17.1.38 その他のユーティリティ
................................

* Menu:

* Subcommands::
* FileType オブジェクト::
* 引数グループ::
* 相互排他::
* パーサーのデフォルト値::
* ヘルプの表示::
* 部分解析::
* ファイル解析のカスタマイズ::
* 終了メソッド::
* 混在した引数の解析::
* Registering custom types or actions::


File: python.info,  Node: Subcommands,  Next: FileType オブジェクト,  Up: その他のユーティリティ

5.17.1.39 Subcommands
.....................

 -- メソッド: ArgumentParser.add_subparsers (*[, title][, description][,
          prog][, parser_class][, action][, dest][, required][, help][,
          metavar])

     Many programs split up their functionality into a number of
     subcommands, for example, the ‘svn’ program can invoke subcommands
     like ‘svn checkout’, ‘svn update’, and ‘svn commit’.  Splitting up
     functionality this way can be a particularly good idea when a
     program performs several different functions which require
     different kinds of command-line arguments.  *note ArgumentParser:
     1bd. supports the creation of such subcommands with the
     ‘add_subparsers()’ method.  The ‘add_subparsers()’ method is
     normally called with no arguments and returns a special action
     object.  This object has a single method, ‘add_parser()’, which
     takes a command name and any ‘ArgumentParser’ constructor
     arguments, and returns an ‘ArgumentParser’ object that can be
     modified as usual.

     引数の説明:

        * 'title' - title for the sub-parser group in help output; by
          default "subcommands" if description is provided, otherwise
          uses title for positional arguments

        * 'description' - description for the sub-parser group in help
          output, by default ‘None’

        * 'prog' - usage information that will be displayed with
          subcommand help, by default the name of the program and any
          positional arguments before the subparser argument

        * 'parser_class' - class which will be used to create sub-parser
          instances, by default the class of the current parser (e.g.
          *note ArgumentParser: 1bd.)

        * *note action: 192b. - コマンドラインにこの引数があったときの基
          本のアクション。

        * *note dest: 3384. - name of the attribute under which
          subcommand name will be stored; by default ‘None’ and no value
          is stored

        * *note required: 338a. - サブコマンドが必須であるかどうかを指定
          し、デフォルトは ‘False’ です。(3.7 より追加)

        * *note help: 338b. - ヘルプ出力に表示されるサブパーサーグループ
          のヘルプです。デフォルトは ‘None’ です

        * *note metavar: 338c. - string presenting available subcommands
          in help; by default it is ‘None’ and presents subcommands in
          form {cmd1, cmd2, ..}

     いくつかの使用例:

          >>> # create the top-level parser
          >>> parser = argparse.ArgumentParser(prog='PROG')
          >>> parser.add_argument('--foo', action='store_true', help='foo help')
          >>> subparsers = parser.add_subparsers(help='subcommand help')
          >>>
          >>> # create the parser for the "a" command
          >>> parser_a = subparsers.add_parser('a', help='a help')
          >>> parser_a.add_argument('bar', type=int, help='bar help')
          >>>
          >>> # create the parser for the "b" command
          >>> parser_b = subparsers.add_parser('b', help='b help')
          >>> parser_b.add_argument('--baz', choices=('X', 'Y', 'Z'), help='baz help')
          >>>
          >>> # parse some argument lists
          >>> parser.parse_args(['a', '12'])
          Namespace(bar=12, foo=False)
          >>> parser.parse_args(['--foo', 'b', '--baz', 'Z'])
          Namespace(baz='Z', foo=True)

     *note parse_args(): 336d. が返すオブジェクトにはメインパーサーとコ
     マンドラインで選択されたサブパーサーによる属性だけが設定されており
     、選択されなかったサブコマンドのパーサーの属性が設定されていないこ
     とに注意してください。このため、上の例では、‘a’ コマンドが指定され
     たときは ‘foo’, ‘bar’ 属性だけが存在し、‘b’ コマンドが指定されたと
     きは ‘foo’, ‘baz’ 属性だけが存在しています。

     同じように、サブパーサーにヘルプメッセージが要求された場合は、その
     パーサーに対するヘルプだけが表示されます。ヘルプメッセージには親パ
     ーサーや兄弟パーサーのヘルプメッセージを表示しません。 (ただし、各
     サブパーサーコマンドのヘルプメッセージは、上の例にもあるように
     ‘add_parser()’ の ‘help=’ 引数によって指定できます)

          >>> parser.parse_args(['--help'])
          usage: PROG [-h] [--foo] {a,b} ...

          positional arguments:
            {a,b}   subcommand help
              a     a help
              b     b help

          options:
            -h, --help  show this help message and exit
            --foo   foo help

          >>> parser.parse_args(['a', '--help'])
          usage: PROG a [-h] bar

          positional arguments:
            bar     bar help

          options:
            -h, --help  show this help message and exit

          >>> parser.parse_args(['b', '--help'])
          usage: PROG b [-h] [--baz {X,Y,Z}]

          options:
            -h, --help     show this help message and exit
            --baz {X,Y,Z}  baz help

     *note add_subparsers(): e11. メソッドは ‘title’ と ‘description’ キ
     ーワード引数もサポートしています。どちらかが存在する場合、サブパー
     サーのコマンドはヘルプ出力でそれぞれのグループの中に表示されます。
     例えば:

          >>> parser = argparse.ArgumentParser()
          >>> subparsers = parser.add_subparsers(title='subcommands',
          ...                                    description='valid subcommands',
          ...                                    help='additional help')
          >>> subparsers.add_parser('foo')
          >>> subparsers.add_parser('bar')
          >>> parser.parse_args(['-h'])
          usage:  [-h] {foo,bar} ...

          options:
            -h, --help  show this help message and exit

          subcommands:
            valid subcommands

            {foo,bar}   additional help

     Furthermore, ‘add_parser()’ supports an additional 'aliases'
     argument, which allows multiple strings to refer to the same
     subparser.  This example, like ‘svn’, aliases ‘co’ as a shorthand
     for ‘checkout’:

          >>> parser = argparse.ArgumentParser()
          >>> subparsers = parser.add_subparsers()
          >>> checkout = subparsers.add_parser('checkout', aliases=['co'])
          >>> checkout.add_argument('foo')
          >>> parser.parse_args(['co', 'bar'])
          Namespace(foo='bar')

     ‘add_parser()’ supports also an additional 'deprecated' argument,
     which allows to deprecate the subparser.

          >>> import argparse
          >>> parser = argparse.ArgumentParser(prog='chicken.py')
          >>> subparsers = parser.add_subparsers()
          >>> run = subparsers.add_parser('run')
          >>> fly = subparsers.add_parser('fly', deprecated=True)
          >>> parser.parse_args(['fly'])
          chicken.py: warning: command 'fly' is deprecated
          Namespace()

     Added in version 3.13.

     One particularly effective way of handling subcommands is to
     combine the use of the *note add_subparsers(): e11. method with
     calls to *note set_defaults(): 3386. so that each subparser knows
     which Python function it should execute.  For example:

          >>> # subcommand functions
          >>> def foo(args):
          ...     print(args.x * args.y)
          ...
          >>> def bar(args):
          ...     print('((%s))' % args.z)
          ...
          >>> # create the top-level parser
          >>> parser = argparse.ArgumentParser()
          >>> subparsers = parser.add_subparsers(required=True)
          >>>
          >>> # create the parser for the "foo" command
          >>> parser_foo = subparsers.add_parser('foo')
          >>> parser_foo.add_argument('-x', type=int, default=1)
          >>> parser_foo.add_argument('y', type=float)
          >>> parser_foo.set_defaults(func=foo)
          >>>
          >>> # create the parser for the "bar" command
          >>> parser_bar = subparsers.add_parser('bar')
          >>> parser_bar.add_argument('z')
          >>> parser_bar.set_defaults(func=bar)
          >>>
          >>> # parse the args and call whatever function was selected
          >>> args = parser.parse_args('foo 1 -x 2'.split())
          >>> args.func(args)
          2.0
          >>>
          >>> # parse the args and call whatever function was selected
          >>> args = parser.parse_args('bar XYZYX'.split())
          >>> args.func(args)
          ((XYZYX))

     こうすると、*note parse_args(): 336d. が引数の解析が終わってから適
     切な関数を呼び出すようになります。このように関数をアクションに関連
     付けるのは一般的にサブパーサーごとに異なるアクションを扱うもっとも
     簡単な方法です。ただし、実行されたサブパーサーの名前を確認する必要
     がある場合は、*note add_subparsers(): e11. を呼び出すときに ‘dest’
     キーワードを指定できます:

          >>> parser = argparse.ArgumentParser()
          >>> subparsers = parser.add_subparsers(dest='subparser_name')
          >>> subparser1 = subparsers.add_parser('1')
          >>> subparser1.add_argument('-x')
          >>> subparser2 = subparsers.add_parser('2')
          >>> subparser2.add_argument('y')
          >>> parser.parse_args(['2', 'frobble'])
          Namespace(subparser_name='2', y='frobble')

     バージョン 3.7 で変更: New 'required' keyword-only parameter.

     バージョン 3.14 で変更: Subparser's 'prog' is no longer affected by
     a custom usage message in the main parser.


File: python.info,  Node: FileType オブジェクト,  Next: 引数グループ,  Prev: Subcommands,  Up: その他のユーティリティ

5.17.1.40 FileType オブジェクト
...............................

 -- クラス: argparse.FileType (mode='r', bufsize=-1, encoding=None,
          errors=None)

     *note FileType: 30c. ファクトリは *note
     ArgumentParser.add_argument(): 4bc. の type 引数に渡すことができる
     オブジェクトを生成します。 type が *note FileType: 30c. オブジェク
     トである引数はコマンドライン引数を、指定されたモード、バッファーサ
     イズ、エンコーディング、エラー処理でファイルとして開きます (詳細は
     *note open(): 316. 関数を参照してください。):

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))
          >>> parser.add_argument('out', type=argparse.FileType('w', encoding='UTF-8'))
          >>> parser.parse_args(['--raw', 'raw.dat', 'file.txt'])
          Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, raw=<_io.FileIO name='raw.dat' mode='wb'>)

     FileType オブジェクトは擬似引数 ‘'-'’ を識別し、読み込み用の *note
     FileType: 30c. であれば *note sys.stdin: 75f. を、書き込み用の
     *note FileType: 30c. であれば *note sys.stdout: ccd. に変換します:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('infile', type=argparse.FileType('r'))
          >>> parser.parse_args(['-'])
          Namespace(infile=<_io.TextIOWrapper name='<stdin>' encoding='UTF-8'>)

          注釈: If one argument uses 'FileType' and then a subsequent
          argument fails, an error is reported but the file is not
          automatically closed.  This can also clobber the output files.
          In this case, it would be better to wait until after the
          parser has run and then use the *note with: 186.-statement to
          manage the files.

     バージョン 3.4 で変更: 'encodings' と 'errors' がパラメータに追加さ
     れました。

     バージョン 3.14 で非推奨.


File: python.info,  Node: 引数グループ,  Next: 相互排他,  Prev: FileType オブジェクト,  Up: その他のユーティリティ

5.17.1.41 引数グループ
......................

 -- メソッド: ArgumentParser.add_argument_group (title=None,
          description=None, *[, argument_default][, conflict_handler])

     By default, *note ArgumentParser: 1bd. groups command-line
     arguments into "positional arguments" and "options" when displaying
     help messages.  When there is a better conceptual grouping of
     arguments than this default one, appropriate groups can be created
     using the ‘add_argument_group()’ method:

          >>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)
          >>> group = parser.add_argument_group('group')
          >>> group.add_argument('--foo', help='foo help')
          >>> group.add_argument('bar', help='bar help')
          >>> parser.print_help()
          usage: PROG [--foo FOO] bar

          group:
            bar    bar help
            --foo FOO  foo help

     The *note add_argument_group(): 2eb. method returns an argument
     group object which has an *note add_argument(): 4bc. method just
     like a regular *note ArgumentParser: 1bd.  When an argument is
     added to the group, the parser treats it just like a normal
     argument, but displays the argument in a separate group for help
     messages.  The ‘add_argument_group()’ method accepts 'title' and
     'description' arguments which can be used to customize this
     display:

          >>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)
          >>> group1 = parser.add_argument_group('group1', 'group1 description')
          >>> group1.add_argument('foo', help='foo help')
          >>> group2 = parser.add_argument_group('group2', 'group2 description')
          >>> group2.add_argument('--bar', help='bar help')
          >>> parser.print_help()
          usage: PROG [--bar BAR] foo

          group1:
            group1 description

            foo    foo help

          group2:
            group2 description

            --bar BAR  bar help

     The optional, keyword-only parameters *note argument_default: 3377.
     and *note conflict_handler: 3378. allow for finer-grained control
     of the behavior of the argument group.  These parameters have the
     same meaning as in the *note ArgumentParser: 1bd. constructor, but
     apply specifically to the argument group rather than the entire
     parser.

     ユーザー定義グループにないすべての引数は通常の "位置引数" と "オプ
     ション引数" セクションに表示されます。

     Deprecated since version 3.11, removed in version 3.14: Calling
     *note add_argument_group(): 2eb. on an argument group now raises an
     exception.  This nesting was never supported, often failed to work
     correctly, and was unintentionally exposed through inheritance.

     バージョン 3.14 で非推奨: Passing *note prefix_chars: 3375. to
     *note add_argument_group(): 2eb. is now deprecated.


File: python.info,  Node: 相互排他,  Next: パーサーのデフォルト値,  Prev: 引数グループ,  Up: その他のユーティリティ

5.17.1.42 相互排他
..................

 -- メソッド: ArgumentParser.add_mutually_exclusive_group
          (required=False)

     Create a mutually exclusive group.  ‘argparse’ will make sure that
     only one of the arguments in the mutually exclusive group was
     present on the command line:

          >>> parser = argparse.ArgumentParser(prog='PROG')
          >>> group = parser.add_mutually_exclusive_group()
          >>> group.add_argument('--foo', action='store_true')
          >>> group.add_argument('--bar', action='store_false')
          >>> parser.parse_args(['--foo'])
          Namespace(bar=True, foo=True)
          >>> parser.parse_args(['--bar'])
          Namespace(bar=False, foo=False)
          >>> parser.parse_args(['--foo', '--bar'])
          usage: PROG [-h] [--foo | --bar]
          PROG: error: argument --bar: not allowed with argument --foo

     *note add_mutually_exclusive_group(): 2ed. メソッドの引数
     'required' に True 値を指定すると、その相互排他引数のどれか1つを選
     ぶことが要求されます:

          >>> parser = argparse.ArgumentParser(prog='PROG')
          >>> group = parser.add_mutually_exclusive_group(required=True)
          >>> group.add_argument('--foo', action='store_true')
          >>> group.add_argument('--bar', action='store_false')
          >>> parser.parse_args([])
          usage: PROG [-h] (--foo | --bar)
          PROG: error: one of the arguments --foo --bar is required

     Note that currently mutually exclusive argument groups do not
     support the 'title' and 'description' arguments of *note
     add_argument_group(): 2eb.  However, a mutually exclusive group can
     be added to an argument group that has a title and description.
     For example:

          >>> parser = argparse.ArgumentParser(prog='PROG')
          >>> group = parser.add_argument_group('Group title', 'Group description')
          >>> exclusive_group = group.add_mutually_exclusive_group(required=True)
          >>> exclusive_group.add_argument('--foo', help='foo help')
          >>> exclusive_group.add_argument('--bar', help='bar help')
          >>> parser.print_help()
          usage: PROG [-h] (--foo FOO | --bar BAR)

          options:
            -h, --help  show this help message and exit

          Group title:
            Group description

            --foo FOO   foo help
            --bar BAR   bar help

     Deprecated since version 3.11, removed in version 3.14: Calling
     *note add_argument_group(): 2eb. or *note
     add_mutually_exclusive_group(): 2ed. on a mutually exclusive group
     now raises an exception.  This nesting was never supported, often
     failed to work correctly, and was unintentionally exposed through
     inheritance.


File: python.info,  Node: パーサーのデフォルト値,  Next: ヘルプの表示,  Prev: 相互排他,  Up: その他のユーティリティ

5.17.1.43 パーサーのデフォルト値
................................

 -- メソッド: ArgumentParser.set_defaults (**kwargs)

     ほとんどの場合、 *note parse_args(): 336d. が返すオブジェクトの属性
     はコマンドライン引数の内容と引数のアクションによってのみ決定されま
     す。 *note set_defaults(): 3386. を使うと与えられたコマンドライン引
     数の内容によらず追加の属性を決定することが可能です:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('foo', type=int)
          >>> parser.set_defaults(bar=42, baz='badger')
          >>> parser.parse_args(['736'])
          Namespace(bar=42, baz='badger', foo=736)

     Note that defaults can be set at both the parser level using *note
     set_defaults(): 3386. and at the argument level using *note
     add_argument(): 4bc.  If both are called for the same argument, the
     last default set for an argument is used:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo', default='bar')
          >>> parser.set_defaults(foo='spam')
          >>> parser.parse_args([])
          Namespace(foo='spam')

     パーサーレベルの default は、複数のパーサーを扱うときに特に便利です
     。このタイプの例については *note add_subparsers(): e11. メソッドを
     参照してください。

 -- メソッド: ArgumentParser.get_default (dest)

     *note add_argument(): 4bc. か *note set_defaults(): 3386. によって
     指定された、 namespace の属性のデフォルト値を取得します:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo', default='badger')
          >>> parser.get_default('foo')
          'badger'


File: python.info,  Node: ヘルプの表示,  Next: 部分解析,  Prev: パーサーのデフォルト値,  Up: その他のユーティリティ

5.17.1.44 ヘルプの表示
......................

ほとんどの典型的なアプリケーションでは、*note parse_args(): 336d. が使用
法やエラーメッセージのフォーマットと表示について面倒を見ます。しかし、い
くつかのフォーマットメソッドが利用できます:

 -- メソッド: ArgumentParser.print_usage (file=None)

     *note ArgumentParser: 1bd. がコマンドラインからどう実行されるべきか
     の短い説明を表示します。 'file' が ‘None’ の時は、 *note
     sys.stdout: ccd. に出力されます。

 -- メソッド: ArgumentParser.print_help (file=None)

     プログラムの使用法と *note ArgumentParser: 1bd. に登録された引数に
     ついての情報を含むヘルプメッセージを表示します。 'file' が ‘None’ の
     時は、 *note sys.stdout: ccd. に出力されます。

これらのメソッドの、表示する代わりにシンプルに文字列を返すバージョンもあ
ります:

 -- メソッド: ArgumentParser.format_usage ()

     *note ArgumentParser: 1bd. がコマンドラインからどう実行されるべきか
     の短い説明を格納した文字列を返します。

 -- メソッド: ArgumentParser.format_help ()

     プログラムの使用法と *note ArgumentParser: 1bd. に登録された引数に
     ついての情報を含むヘルプメッセージを格納した文字列を返します。


File: python.info,  Node: 部分解析,  Next: ファイル解析のカスタマイズ,  Prev: ヘルプの表示,  Up: その他のユーティリティ

5.17.1.45 部分解析
..................

 -- メソッド: ArgumentParser.parse_known_args (args=None,
          namespace=None)

     Sometimes a script only needs to handle a specific set of
     command-line arguments, leaving any unrecognized arguments for
     another script or program.  In these cases, the *note
     parse_known_args(): 33b5. method can be useful.

     This method works similarly to *note parse_args(): 336d, but it
     does not raise an error for extra, unrecognized arguments.
     Instead, it parses the known arguments and returns a two item tuple
     that contains the populated namespace and the list of any
     unrecognized arguments.

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo', action='store_true')
          >>> parser.add_argument('bar')
          >>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])
          (Namespace(bar='BAR', foo=True), ['--badger', 'spam'])

     警告: *note 先頭文字でのマッチング: fbf. ルールは *note
     parse_known_args(): 33b5. にも適用されます。たとえ既知のオプション
     の先頭文字に過ぎない場合でも、パーサは引数リストに残さずに、オプシ
     ョンを受け取る場合があります。


File: python.info,  Node: ファイル解析のカスタマイズ,  Next: 終了メソッド,  Prev: 部分解析,  Up: その他のユーティリティ

5.17.1.46 ファイル解析のカスタマイズ
....................................

 -- メソッド: ArgumentParser.convert_arg_line_to_args (arg_line)

     ファイルから引数を読み込む場合 (*note ArgumentParser: 1bd. コンスト
     ラクターの 'fromfile_prefix_chars' キーワード引数を参照)、1行につき
     1つの引数を読み込みます。 *note convert_arg_line_to_args(): 3385. を
     変更することでこの動作をカスタマイズできます。

     このメソッドは、引数ファイルから読まれた文字列である1つの引数
     'arg_line' を受け取ります。そしてその文字列を解析した結果の引数のリ
     ストを返します。このメソッドはファイルから1行読みこむごとに、順番に
     呼ばれます。

     このメソッドをオーバーライドすると便利なこととして、スペースで区切
     られた行の単語1つ1つを別々の引数として扱えます。次の例でその方法を
     示します:

          class MyArgumentParser(argparse.ArgumentParser):
              def convert_arg_line_to_args(self, arg_line):
                  return arg_line.split()


File: python.info,  Node: 終了メソッド,  Next: 混在した引数の解析,  Prev: ファイル解析のカスタマイズ,  Up: その他のユーティリティ

5.17.1.47 終了メソッド
......................

 -- メソッド: ArgumentParser.exit (status=0, message=None)

     This method terminates the program, exiting with the specified
     'status' and, if given, it prints a 'message' to *note sys.stderr:
     b33. before that.  The user can override this method to handle
     these steps differently:

          class ErrorCatchingArgumentParser(argparse.ArgumentParser):
              def exit(self, status=0, message=None):
                  if status:
                      raise Exception(f'Exiting because of an error: {message}')
                  exit(status)

 -- メソッド: ArgumentParser.error (message)

     This method prints a usage message, including the 'message', to
     *note sys.stderr: b33. and terminates the program with a status
     code of 2.


File: python.info,  Node: 混在した引数の解析,  Next: Registering custom types or actions,  Prev: 終了メソッド,  Up: その他のユーティリティ

5.17.1.48 混在した引数の解析
............................

 -- メソッド: ArgumentParser.parse_intermixed_args (args=None,
          namespace=None)

 -- メソッド: ArgumentParser.parse_known_intermixed_args (args=None,
          namespace=None)

     多くの Unix コマンドは、オプション引数と位置引数を混在させることを
     許しています。 *note parse_intermixed_args(): cf7. と *note
     parse_known_intermixed_args(): 33bb. メソッドは、このような方法での
     解析をサポートしています。

     These parsers do not support all the ‘argparse’ features, and will
     raise exceptions if unsupported features are used.  In particular,
     subparsers, and mutually exclusive groups that include both
     optionals and positionals are not supported.

     この例は、*note parse_known_args(): 33b5. と *note
     parse_intermixed_args(): cf7. の違いを表しています: 前者は ‘['2',
     '3']’ を、解析されない引数として返し、後者は全ての位置引数を ‘rest’
     に入れて返しています:

          >>> parser = argparse.ArgumentParser()
          >>> parser.add_argument('--foo')
          >>> parser.add_argument('cmd')
          >>> parser.add_argument('rest', nargs='*', type=int)
          >>> parser.parse_known_args('doit 1 --foo bar 2 3'.split())
          (Namespace(cmd='doit', foo='bar', rest=[1]), ['2', '3'])
          >>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())
          Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])

     *note parse_known_intermixed_args(): 33bb. は、解析した内容を含む名
     前空間と、残りの引数を含んだリストの、2つの要素を持つタプルを返しま
     す。 *note parse_intermixed_args(): cf7. は、解析されない引数が残さ
     れた場合にはエラーを送出します。

     Added in version 3.7.


File: python.info,  Node: Registering custom types or actions,  Prev: 混在した引数の解析,  Up: その他のユーティリティ

5.17.1.49 Registering custom types or actions
.............................................

 -- メソッド: ArgumentParser.register (registry_name, value, object)

     Sometimes it's desirable to use a custom string in error messages
     to provide more user-friendly output.  In these cases, ‘register()’
     can be used to register custom actions or types with a parser and
     allow you to reference the type by their registered name instead of
     their callable name.

     The ‘register()’ method accepts three arguments - a
     'registry_name', specifying the internal registry where the object
     will be stored (e.g., ‘action’, ‘type’), 'value', which is the key
     under which the object will be registered, and object, the callable
     to be registered.

     The following example shows how to register a custom type with a
     parser:

          >>> import argparse
          >>> parser = argparse.ArgumentParser()
          >>> parser.register('type', 'hexadecimal integer', lambda s: int(s, 16))
          >>> parser.add_argument('--foo', type='hexadecimal integer')
          _StoreAction(option_strings=['--foo'], dest='foo', nargs=None, const=None, default=None, type='hexadecimal integer', choices=None, required=False, help=None, metavar=None, deprecated=False)
          >>> parser.parse_args(['--foo', '0xFA'])
          Namespace(foo=250)
          >>> parser.parse_args(['--foo', '1.2'])
          usage: PROG [-h] [--foo FOO]
          PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'


File: python.info,  Node: 例外<11>,  Prev: その他のユーティリティ,  Up: argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー

5.17.1.50 例外
..............

 -- 例外: argparse.ArgumentError

     引数 (オプション引数または位置引数) の生成時または利用時のエラーで
     す。

     この例外の文字列表現は、エラーの原因となった引数についての情報を補
     足するメッセージです。

 -- 例外: argparse.ArgumentTypeError

     コマンドラインの文字列を、指定された型に変換するのに失敗した時に送
     出されます。

ガイドとチュートリアル
......................

* Menu:

* Argparse チュートリアル::
* Migrating optparse code to argparse::


File: python.info,  Node: Argparse チュートリアル,  Next: Migrating optparse code to argparse,  Up: 例外<11>

5.17.1.51 Argparse チュートリアル
.................................


author: Tshepang Mbambo

このチュートリアルでは、*note argparse: 7. を丁寧に説明します。*note
argparse: 7. は、Python 標準ライブラリの一部であり、おすすめのコマンドラ
イン引数の解析モジュールです。

     注釈: The standard library includes two other libraries directly
     related to command-line parameter processing: the lower level *note
     optparse: a4. module (which may require more code to configure for
     a given application, but also allows an application to request
     behaviors that ‘argparse’ doesn't support), and the very low level
     *note getopt: 65. (which specifically serves as an equivalent to
     the ‘getopt()’ family of functions available to C programmers).
     While neither of those modules is covered directly in this guide,
     many of the core concepts in ‘argparse’ first originated in
     ‘optparse’, so some aspects of this tutorial will also be relevant
     to ‘optparse’ users.

* Menu:

* コンセプト::
* 基礎::
* 位置引数の入門::
* Optional引数の導入::
* 位置引数とOptional引数の併用::
* もうちょっとだけ学ぶ::
* argparse の出力を翻訳するには::
* Custom type converters::
* 結び::


File: python.info,  Node: コンセプト,  Next: 基礎,  Up: Argparse チュートリアル

5.17.1.52 コンセプト
....................

‘ls’ コマンドを使って、このチュートリアルで私たちが学ぶ機能をいくつか見
てみましょう:

     $ ls
     cpython  devguide  prog.py  pypy  rm-unused-function.patch
     $ ls pypy
     ctypes_configure  demo  dotviewer  include  lib_pypy  lib-python ...
     $ ls -l
     total 20
     drwxr-xr-x 19 wena wena 4096 Feb 18 18:51 cpython
     drwxr-xr-x  4 wena wena 4096 Feb  8 12:04 devguide
     -rwxr-xr-x  1 wena wena  535 Feb 19 00:05 prog.py
     drwxr-xr-x 14 wena wena 4096 Feb  7 00:59 pypy
     -rw-r--r--  1 wena wena  741 Feb 18 01:01 rm-unused-function.patch
     $ ls --help
     Usage: ls [OPTION]... [FILE]...
     List information about the FILEs (the current directory by default).
     Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
     ...

上の４つの実行結果から、以下のことが分かります:

   * ‘ls’ コマンドは、まったくオプションを指定せずに実行したとしても役に
     立ちます。デフォルトの動作は、カレントディレクトリの内容を表示する
     ことです。

   * デフォルトの動作で提供される以上のことをしたい場合、すこしだけオプ
     ションを指定する必要があります。別のディレクトリ ‘pypy’ を表示した
     い場合、私たちがしたことは、位置引数として知られる引数を指定するこ
     とです。これは、引数がコマンドラインのどの位置に現れたかということ
     だけを基に、プログラムがその値について何をするのか分かるべきなので
     、このように名づけられています。このコンセプトは ‘cp’ のようなコマ
     ンドで重要な意味があります。 ‘cp’ コマンドのもっとも基本的な使い方
     は、 ‘cp SRC DEST’ です。最初の引数は '何をコピーしたいか' であり、
     二つ目の引数は 'どこにコピーしたいか' を意味します。

   * プログラムの振る舞いを変えましょう。例では、単にファイル名を表示す
     る代わりにそれぞれのファイルに関する多くの情報を表示します。このケ
     ースでは、‘-l’ はoptional引数として知られます。

   * ヘルプテキストの抜粋です。この実行の仕方は、まだ使用したことがない
     プログラムにたいして行うと有用で、ヘルプテキストを読むことで、プロ
     グラムがどのように動作するかわかります。


File: python.info,  Node: 基礎,  Next: 位置引数の入門,  Prev: コンセプト,  Up: Argparse チュートリアル

5.17.1.53 基礎
..............

（ほとんど）何もしない、とても簡単な例から始めましょう:

     import argparse
     parser = argparse.ArgumentParser()
     parser.parse_args()

下記がこのコードを実行した結果です:

     $ python prog.py
     $ python prog.py --help
     usage: prog.py [-h]

     options:
       -h, --help  show this help message and exit
     $ python prog.py --verbose
     usage: prog.py [-h]
     prog.py: error: unrecognized arguments: --verbose
     $ python prog.py foo
     usage: prog.py [-h]
     prog.py: error: unrecognized arguments: foo

こんなことが起こりました:

   * オプションなしでスクリプトを実行した結果、なにも標準出力に表示され
     ませんでした。それほど便利ではありませんね。

   * 二つ目の実行結果から *note argparse: 7. モジュールの有用性がわかり
     ます。ほとんど何もしていないのに、すてきなヘルプメッセージが手に入
     りました。

   * ‘--help’ （これは ‘-h’ と短縮できます）だけが無料のオプションです（
     つまりプログラムで指示する必要はありません）。他のオプションを指定
     するとエラーになります。エラー時の有用な用法メッセージも、プログラ
     ムで指示することなく出力できます。


File: python.info,  Node: 位置引数の入門,  Next: Optional引数の導入,  Prev: 基礎,  Up: Argparse チュートリアル

5.17.1.54 位置引数の入門
........................

以下に例を示します:

     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument("echo")
     args = parser.parse_args()
     print(args.echo)

このコードを実行してみましょう:

     $ python prog.py
     usage: prog.py [-h] echo
     prog.py: error: the following arguments are required: echo
     $ python prog.py --help
     usage: prog.py [-h] echo

     positional arguments:
       echo

     options:
       -h, --help  show this help message and exit
     $ python prog.py foo
     foo

こんなことが起こりました:

   * プログラムが受け付けるコマンドラインオプションを指定するメソッドで
     ある *note add_argument(): 4bc. を追加しました。ここでは、その機能
     にあわせて引数名を ‘echo’ としました。

   * プログラムを実行すると、オプションを指定するように要求されます。

   * *note parse_args(): 336d. メソッドは指定されたオプションを、この場
     合は ‘echo’ として、返します。

   * この変数は *note argparse: 7. が自動的に行うある種の魔法です（つま
     り、値を格納する変数を指定する必要がありません）。変数の名前がメソ
     ッドに与えた文字列引数 ‘echo’ と同じことに気付いたでしょう。

ヘルプメッセージは十分なように見えますが、それほど分かりやすくもありませ
ん。たとえば、‘echo’ は位置引数であることがわかりますが、それが何である
かを知るためには推測するかソースコードを見なけれなりません。もうすこしヘ
ルプメッセージ分かりやすくしてみましょう:

     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument("echo", help="echo the string you use here")
     args = parser.parse_args()
     print(args.echo)

修正した結果は以下のようになります:

     $ python prog.py -h
     usage: prog.py [-h] echo

     positional arguments:
       echo        echo the string you use here

     options:
       -h, --help  show this help message and exit

次は、もっと有益なことをしてみませんか？:

     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument("square", help="display a square of a given number")
     args = parser.parse_args()
     print(args.square**2)

下記がこのコードを実行した結果です:

     $ python prog.py 4
     Traceback (most recent call last):
       File "prog.py", line 5, in <module>
         print(args.square**2)
     TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'

上手くいきませんでした。 何も伝えなければ、*note argparse: 7. は与えられ
たオプションを文字列として扱います。 *note argparse: 7. にオプションの値
を整数として扱うように伝えましょう:

     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument("square", help="display a square of a given number",
                         type=int)
     args = parser.parse_args()
     print(args.square**2)

下記がこのコードを実行した結果です:

     $ python prog.py 4
     16
     $ python prog.py four
     usage: prog.py [-h] square
     prog.py: error: argument square: invalid int value: 'four'

今度は上手くいきました。このプログラムは不正な入力が与えられるとそれを処
理せずに、より親切なメッセージを表示して実行を終了します。


File: python.info,  Node: Optional引数の導入,  Next: 位置引数とOptional引数の併用,  Prev: 位置引数の入門,  Up: Argparse チュートリアル

5.17.1.55 Optional引数の導入
............................

ここまで位置引数を扱ってきました。optional引数を追加する方法についても見
ていきましょう:

     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument("--verbosity", help="increase output verbosity")
     args = parser.parse_args()
     if args.verbosity:
         print("verbosity turned on")

実行してみましょう:

     $ python prog.py --verbosity 1
     verbosity turned on
     $ python prog.py
     $ python prog.py --help
     usage: prog.py [-h] [--verbosity VERBOSITY]

     options:
       -h, --help            show this help message and exit
       --verbosity VERBOSITY
                             increase output verbosity
     $ python prog.py --verbosity
     usage: prog.py [-h] [--verbosity VERBOSITY]
     prog.py: error: argument --verbosity: expected one argument

こんなことが起こりました:

   * プログラムは、‘--verbosity’ が指定された場合はなにかしらを表示し、
     指定されなければ何も表示をしないように書かれています。

   * オプションの指定が実際に任意であることを示すために、プログラムをオ
     プション指定なしで実行してもエラーにはなっていません。オプション引
     数が指定されなかった場合、関連する変数、この例では ‘args.verbosity’
     、の値にはデフォルトで ‘None’ がセットされます。これが *note if:
     181. 文による真偽テストに失敗した理由です。

   * ヘルプメッセージが少し変わりました。

   * ‘--verbosity’ オプションを使うには、そのオプションにひとつの値を指
     定しなければなりません。

上記の例では、‘--verbosity’ に任意の整数を取れます。この簡単なプログラム
では、実際には ‘True’ または ‘False’ の二つの値だけが有効です。そうなる
ようにコードを修正してみましょう:

     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument("--verbose", help="increase output verbosity",
                         action="store_true")
     args = parser.parse_args()
     if args.verbose:
         print("verbosity turned on")

実行してみましょう:

     $ python prog.py --verbose
     verbosity turned on
     $ python prog.py --verbose 1
     usage: prog.py [-h] [--verbose]
     prog.py: error: unrecognized arguments: 1
     $ python prog.py --help
     usage: prog.py [-h] [--verbose]

     options:
       -h, --help  show this help message and exit
       --verbose   increase output verbosity

こんなことが起こりました:

   * オプションは値を必要とするのではなく、単なるフラグになりました。こ
     の考え方に沿うようにオプションの名前も変更しています。ここで新しい
     キーワード ‘action’ を指定し、値として ‘"store_true"’ を設定してい
     ることに注意してください。これは、オプションが指定された場合に値と
     して ‘True’ を ‘args.verbose’ に設定するということを意味します。オ
     プションの指定がない場合の値は ‘False’ となることを意味します。

   * フラグは値を取るべきではないので、値を指定するとプログラムはエラー
     になります。

   * ヘルプテキストが変わっています。

* Menu:

* 短いオプション::


File: python.info,  Node: 短いオプション,  Up: Optional引数の導入

5.17.1.56 短いオプション
........................

コマンドラインになれていれば、オプションの短いバージョンの話題に触れてい
ないことに気付いたでしょう。それはとても簡単です:

     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument("-v", "--verbose", help="increase output verbosity",
                         action="store_true")
     args = parser.parse_args()
     if args.verbose:
         print("verbosity turned on")

上記のプログラムを実行するとこうなります:

     $ python prog.py -v
     verbosity turned on
     $ python prog.py --help
     usage: prog.py [-h] [-v]

     options:
       -h, --help     show this help message and exit
       -v, --verbose  increase output verbosity

新しい機能がヘルプテキストにも反映されている点に気付いたでしょう。


File: python.info,  Node: 位置引数とOptional引数の併用,  Next: もうちょっとだけ学ぶ,  Prev: Optional引数の導入,  Up: Argparse チュートリアル

5.17.1.57 位置引数とOptional引数の併用
......................................

プログラムが複雑になってきました:

     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument("square", type=int,
                         help="display a square of a given number")
     parser.add_argument("-v", "--verbose", action="store_true",
                         help="increase output verbosity")
     args = parser.parse_args()
     answer = args.square**2
     if args.verbose:
         print(f"the square of {args.square} equals {answer}")
     else:
         print(answer)

出力は以下のようになります:

     $ python prog.py
     usage: prog.py [-h] [-v] square
     prog.py: error: the following arguments are required: square
     $ python prog.py 4
     16
     $ python prog.py 4 --verbose
     the square of 4 equals 16
     $ python prog.py --verbose 4
     the square of 4 equals 16

   * 位置引数を元に戻したので、引数を指定しないとエラーになりました。

   * ２つのオプションの順序を考慮しないことに注意してください。

複数の詳細レベルを値にとれるようにプログラムを元に戻して、指定された値を
使ってみましょう:

     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument("square", type=int,
                         help="display a square of a given number")
     parser.add_argument("-v", "--verbosity", type=int,
                         help="increase output verbosity")
     args = parser.parse_args()
     answer = args.square**2
     if args.verbosity == 2:
         print(f"the square of {args.square} equals {answer}")
     elif args.verbosity == 1:
         print(f"{args.square}^2 == {answer}")
     else:
         print(answer)

実行してみましょう:

     $ python prog.py 4
     16
     $ python prog.py 4 -v
     usage: prog.py [-h] [-v VERBOSITY] square
     prog.py: error: argument -v/--verbosity: expected one argument
     $ python prog.py 4 -v 1
     4^2 == 16
     $ python prog.py 4 -v 2
     the square of 4 equals 16
     $ python prog.py 4 -v 3
     16

プログラムのバグである最後の結果を除いて、上手く行っているようです。この
バグを、‘--verbosity’ オプションが取れる値を制限することで修正しましょう
:

     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument("square", type=int,
                         help="display a square of a given number")
     parser.add_argument("-v", "--verbosity", type=int, choices=[0, 1, 2],
                         help="increase output verbosity")
     args = parser.parse_args()
     answer = args.square**2
     if args.verbosity == 2:
         print(f"the square of {args.square} equals {answer}")
     elif args.verbosity == 1:
         print(f"{args.square}^2 == {answer}")
     else:
         print(answer)

実行してみましょう:

     $ python prog.py 4 -v 3
     usage: prog.py [-h] [-v {0,1,2}] square
     prog.py: error: argument -v/--verbosity: invalid choice: 3 (choose from 0, 1, 2)
     $ python prog.py 4 -h
     usage: prog.py [-h] [-v {0,1,2}] square

     positional arguments:
       square                display a square of a given number

     options:
       -h, --help            show this help message and exit
       -v, --verbosity {0,1,2}
                             increase output verbosity

変更がエラーメッセージとヘルプメッセージの両方に反映されていることに注意
してください。

詳細レベルついて、違ったアプローチを試してみましょう。これは CPython 実
行可能ファイルがその詳細レベル引数を扱う方法と同じです。（ ‘python
--help’ の出力を確認してください）:

     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument("square", type=int,
                         help="display the square of a given number")
     parser.add_argument("-v", "--verbosity", action="count",
                         help="increase output verbosity")
     args = parser.parse_args()
     answer = args.square**2
     if args.verbosity == 2:
         print(f"the square of {args.square} equals {answer}")
     elif args.verbosity == 1:
         print(f"{args.square}^2 == {answer}")
     else:
         print(answer)

もう一つの action である "count" を紹介します。これは指定されたオプショ
ンの出現回数を数えます:

     $ python prog.py 4
     16
     $ python prog.py 4 -v
     4^2 == 16
     $ python prog.py 4 -vv
     the square of 4 equals 16
     $ python prog.py 4 --verbosity --verbosity
     the square of 4 equals 16
     $ python prog.py 4 -v 1
     usage: prog.py [-h] [-v] square
     prog.py: error: unrecognized arguments: 1
     $ python prog.py 4 -h
     usage: prog.py [-h] [-v] square

     positional arguments:
       square           display a square of a given number

     options:
       -h, --help       show this help message and exit
       -v, --verbosity  increase output verbosity
     $ python prog.py 4 -vvv
     16

   * 前のバージョンのスクリプトのようにフラグ (‘action="store_true"’ に
     似ています）になりました。エラーとなる理由がわかります。（訳注: ５
     つ目の例では ‘-v’ オプションに引数を与えたため、エラーとなっていま
     す。）

   * これは"store_true" アクションによく似た動作をします。

   * では "count" アクションが何をもたらすかデモンストレーションをします
     。おそらくこのような使用方法を前に見たことがあるでしょう。

   * ‘-v’ フラグを指定しなければ、フラグの値は ‘None’ とみなされます。

   * 期待通り、長い形式のフラグを指定しても同じ結果になります。

   * 残念ながら、このヘルプ出力はプログラムが新しく得た機能についてそこ
     まで有益ではありません。しかし、スクリプトのドキュメンテーションを
     改善することでいつでも修正することができます（例えば、‘help’ キーワ
     ード引数を使用することで）。

   * 最後の出力はプログラムにバグがあることを示します。

修正しましょう:

     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument("square", type=int,
                         help="display a square of a given number")
     parser.add_argument("-v", "--verbosity", action="count",
                         help="increase output verbosity")
     args = parser.parse_args()
     answer = args.square**2

     # bugfix: replace == with >=
     if args.verbosity >= 2:
         print(f"the square of {args.square} equals {answer}")
     elif args.verbosity >= 1:
         print(f"{args.square}^2 == {answer}")
     else:
         print(answer)

これが結果です:

     $ python prog.py 4 -vvv
     the square of 4 equals 16
     $ python prog.py 4 -vvvv
     the square of 4 equals 16
     $ python prog.py 4
     Traceback (most recent call last):
       File "prog.py", line 11, in <module>
         if args.verbosity >= 2:
     TypeError: '>=' not supported between instances of 'NoneType' and 'int'

   * 最初の出力は上手くいっていますし、以前のバグが修正されています。最
     も詳細な出力を得るには、2 以上の値が必要です。

   * 三番目の結果は、よくありません。

このバグを修正しましょう:

     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument("square", type=int,
                         help="display a square of a given number")
     parser.add_argument("-v", "--verbosity", action="count", default=0,
                         help="increase output verbosity")
     args = parser.parse_args()
     answer = args.square**2
     if args.verbosity >= 2:
         print(f"the square of {args.square} equals {answer}")
     elif args.verbosity >= 1:
         print(f"{args.square}^2 == {answer}")
     else:
         print(answer)

もう一つのキーワード引数である ‘default’ を導入しました。整数値と比較で
きるように、その値に ‘0’ を設定しました。デフォルトでは、optional 引数が
指定されていない場合 ‘None’ となること、‘None’ が整数値と比較できない（
よって *note TypeError: 198. 例外となる）ことを思い出してください。

こうなりました:

     $ python prog.py 4
     16

ここまで学んできたことだけで、さまざまな事が実現できます。しかしまだ表面
をなぞっただけです。 *note argparse: 7. モジュールはとても強力ですので、
チュートリアルを終える前にもう少しだけ探検してみましょう.


File: python.info,  Node: もうちょっとだけ学ぶ,  Next: argparse の出力を翻訳するには,  Prev: 位置引数とOptional引数の併用,  Up: Argparse チュートリアル

5.17.1.58 もうちょっとだけ学ぶ
..............................

もし、この小さなプログラムを二乗以外の累乗が行えるように拡張するとどうな
るでしょうか:

     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument("x", type=int, help="the base")
     parser.add_argument("y", type=int, help="the exponent")
     parser.add_argument("-v", "--verbosity", action="count", default=0)
     args = parser.parse_args()
     answer = args.x**args.y
     if args.verbosity >= 2:
         print(f"{args.x} to the power {args.y} equals {answer}")
     elif args.verbosity >= 1:
         print(f"{args.x}^{args.y} == {answer}")
     else:
         print(answer)

出力:

     $ python prog.py
     usage: prog.py [-h] [-v] x y
     prog.py: error: the following arguments are required: x, y
     $ python prog.py -h
     usage: prog.py [-h] [-v] x y

     positional arguments:
       x                the base
       y                the exponent

     options:
       -h, --help       show this help message and exit
       -v, --verbosity
     $ python prog.py 4 2 -v
     4^2 == 16

これまで、出力されるテキストを '変更する' ために詳細レベルを使ってきまし
た。かわりに下記の例では、'追加の' テキストを出力するのに詳細レベルを使
用します:

     import argparse
     parser = argparse.ArgumentParser()
     parser.add_argument("x", type=int, help="the base")
     parser.add_argument("y", type=int, help="the exponent")
     parser.add_argument("-v", "--verbosity", action="count", default=0)
     args = parser.parse_args()
     answer = args.x**args.y
     if args.verbosity >= 2:
         print(f"Running '{__file__}'")
     if args.verbosity >= 1:
         print(f"{args.x}^{args.y} == ", end="")
     print(answer)

出力:

     $ python prog.py 4 2
     16
     $ python prog.py 4 2 -v
     4^2 == 16
     $ python prog.py 4 2 -vv
     Running 'prog.py'
     4^2 == 16

* Menu:

* 多義性のある引数の指定::
* 競合するオプション::


File: python.info,  Node: 多義性のある引数の指定,  Next: 競合するオプション,  Up: もうちょっとだけ学ぶ

5.17.1.59 多義性のある引数の指定
................................

ある引数の解釈について、位置引数なのか、ある引数に対する追加の引数なのか
、あいまいさがあるときは、 ‘--’ を使うことで *note parse_args(): 336d. に
対してこれ以降は位置引数であることを伝えることができます:

     >>> parser = argparse.ArgumentParser(prog='PROG')
     >>> parser.add_argument('-n', nargs='+')
     >>> parser.add_argument('args', nargs='*')

     >>> # ambiguous, so parse_args assumes it's an option
     >>> parser.parse_args(['-f'])
     usage: PROG [-h] [-n N [N ...]] [args ...]
     PROG: error: unrecognized arguments: -f

     >>> parser.parse_args(['--', '-f'])
     Namespace(args=['-f'], n=None)

     >>> # ambiguous, so the -n option greedily accepts arguments
     >>> parser.parse_args(['-n', '1', '2', '3'])
     Namespace(args=[], n=['1', '2', '3'])

     >>> parser.parse_args(['-n', '1', '--', '2', '3'])
     Namespace(args=['2', '3'], n=['1'])


File: python.info,  Node: 競合するオプション,  Prev: 多義性のある引数の指定,  Up: もうちょっとだけ学ぶ

5.17.1.60 競合するオプション
............................

これまでのところ、 *note argparse.ArgumentParser: 1bd. インスタンスの2つ
のメソッドについて学んできました。ここで3つめのメソッドとして *note
add_mutually_exclusive_group(): 2ed. を導入しましょう。このメソッドは互
いに対立する引数の指定を可能にします。また、新しい機能として理解しやすい
ように、プログラムの残りの部分を変更しましょう: 以下では ‘--quiet’ オプ
ションを ‘--verbose’ と反対のオプションとして導入します:

     import argparse

     parser = argparse.ArgumentParser()
     group = parser.add_mutually_exclusive_group()
     group.add_argument("-v", "--verbose", action="store_true")
     group.add_argument("-q", "--quiet", action="store_true")
     parser.add_argument("x", type=int, help="the base")
     parser.add_argument("y", type=int, help="the exponent")
     args = parser.parse_args()
     answer = args.x**args.y

     if args.quiet:
         print(answer)
     elif args.verbose:
         print(f"{args.x} to the power {args.y} equals {answer}")
     else:
         print(f"{args.x}^{args.y} == {answer}")

プログラムはより簡潔になりましたが、デモのための機能が失われました。とも
かく下記が実行結果です:

     $ python prog.py 4 2
     4^2 == 16
     $ python prog.py 4 2 -q
     16
     $ python prog.py 4 2 -v
     4 to the power 2 equals 16
     $ python prog.py 4 2 -vq
     usage: prog.py [-h] [-v | -q] x y
     prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose
     $ python prog.py 4 2 -v --quiet
     usage: prog.py [-h] [-v | -q] x y
     prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose

これは分かりやすいでしょう。ここで得たちょっとした柔軟性を示すために最後
の出力を追加しました、つまり長い形式のオプションと短い形式のオプションの
混在です。

結びの前に、恐らくあなたはプログラムの主な目的をユーザに伝えたいでしょう
。万が一、彼らがそれを知らないときに備えて:

     import argparse

     parser = argparse.ArgumentParser(description="calculate X to the power of Y")
     group = parser.add_mutually_exclusive_group()
     group.add_argument("-v", "--verbose", action="store_true")
     group.add_argument("-q", "--quiet", action="store_true")
     parser.add_argument("x", type=int, help="the base")
     parser.add_argument("y", type=int, help="the exponent")
     args = parser.parse_args()
     answer = args.x**args.y

     if args.quiet:
         print(answer)
     elif args.verbose:
         print(f"{args.x} to the power {args.y} equals {answer}")
     else:
         print(f"{args.x}^{args.y} == {answer}")

使用方法のテキストが少し変化しました。‘[-v | -q]’ は ‘-v’ または ‘-q’ の
どちらかを使用できるが、同時に両方を使用できないことを意味します:

     $ python prog.py --help
     usage: prog.py [-h] [-v | -q] x y

     calculate X to the power of Y

     positional arguments:
       x              the base
       y              the exponent

     options:
       -h, --help     show this help message and exit
       -v, --verbose
       -q, --quiet


File: python.info,  Node: argparse の出力を翻訳するには,  Next: Custom type converters,  Prev: もうちょっとだけ学ぶ,  Up: Argparse チュートリアル

5.17.1.61 argparse の出力を翻訳するには
.......................................

ヘルプテキストやエラーメッセージなどの *note argparse: 7. モジュールの出
力は、すべて *note gettext: 67. モジュールを使って訳せるように作られてい
ます。これにより、 *note argparse: 7. によって生成されたメッセージを簡単
にローカライズできます。 *note プログラムやモジュールを国際化する: 33cb.
も参照してください。

たとえば、この *note argparse: 7. の出力では:

     $ python prog.py --help
     usage: prog.py [-h] [-v | -q] x y

     calculate X to the power of Y

     positional arguments:
       x              the base
       y              the exponent

     options:
       -h, --help     show this help message and exit
       -v, --verbose
       -q, --quiet

文字列 ‘usage:’, ‘positional arguments:’, ‘options:’ と ‘show this help
message and exit’ はすべて訳せます。

これらの文字列を訳すには、それらをまず ‘.po’ ファイルに抽出する必要があ
ります。たとえば、 Babel(1) を使い、次のコマンドを実行します。

     $ pybabel extract -o messages.po /usr/lib/python3.12/argparse.py

このコマンドは *note argparse: 7. モジュールからすべての翻訳可能な文字列
を抽出し、それらを ‘messages.po’ という名前のファイルに出力します。この
コマンドは Python のインストールが ‘/usr/lib’ にあることを前提としていま
す。

システム上の *note argparse: 7. モジュールの場所は、次のスクリプトで調べ
られます:

     import argparse
     print(argparse.__file__)

‘.po’ ファイル内のメッセージが訳され、その訳が *note gettext: 67. を用い
てインストールされると、 *note argparse: 7. は翻訳されたメッセージを表示
できるようになります。

*note argparse: 7. 出力内のあなたの文字列を翻訳するには、 *note gettext:
67. を使います。

   ---------- Footnotes ----------

   (1) https://babel.pocoo.org/


File: python.info,  Node: Custom type converters,  Next: 結び,  Prev: argparse の出力を翻訳するには,  Up: Argparse チュートリアル

5.17.1.62 Custom type converters
................................

The *note argparse: 7. module allows you to specify custom type
converters for your command-line arguments.  This allows you to modify
user input before it's stored in the *note argparse.Namespace: 336e.
This can be useful when you need to pre-process the input before it is
used in your program.

When using a custom type converter, you can use any callable that takes
a single string argument (the argument value) and returns the converted
value.  However, if you need to handle more complex scenarios, you can
use a custom action class with the 'action' parameter instead.

For example, let's say you want to handle arguments with different
prefixes and process them accordingly:

     import argparse

     parser = argparse.ArgumentParser(prefix_chars='-+')

     parser.add_argument('-a', metavar='<value>', action='append',
                         type=lambda x: ('-', x))
     parser.add_argument('+a', metavar='<value>', action='append',
                         type=lambda x: ('+', x))

     args = parser.parse_args()
     print(args)

出力:

     $ python prog.py -a value1 +a value2
     Namespace(a=[('-', 'value1'), ('+', 'value2')])

In this example, we:

   * Created a parser with custom prefix characters using the
     ‘prefix_chars’ parameter.

   * Defined two arguments, ‘-a’ and ‘+a’, which used the ‘type’
     parameter to create custom type converters to store the value in a
     tuple with the prefix.

Without the custom type converters, the arguments would have treated the
‘-a’ and ‘+a’ as the same argument, which would have been undesirable.
By using custom type converters, we were able to differentiate between
the two arguments.


File: python.info,  Node: 結び,  Prev: Custom type converters,  Up: Argparse チュートリアル

5.17.1.63 結び
..............

*note argparse: 7. モジュールはここで学んだことより多くの機能を提供しま
す。モジュールのドキュメントはとても詳細で、綿密で、そしてたくさんの例が
あります。このチュートリアルの体験したことで、気がめいることなくそれらの
他の機能を会得できるに違いありません。


File: python.info,  Node: Migrating optparse code to argparse,  Prev: Argparse チュートリアル,  Up: 例外<11>

5.17.1.64 Migrating ‘optparse’ code to ‘argparse’
.................................................

The *note argparse: 7. module offers several higher level features not
natively provided by the *note optparse: a4. module, including:

   * 位置引数を扱う

   * Supporting subcommands.

   * ‘+’, ‘/’ のような代替オプションプレフィクスを許容する

   * zero-or-more スタイル、one-or-more スタイルの引数を扱う

   * より有益な使用方法メッセージの生成

   * カスタム ‘type’, カスタム ‘action’ のために遥かに簡単なインターフェ
     イスを提供する

Originally, the *note argparse: 7. module attempted to maintain
compatibility with *note optparse: a4.  However, the fundamental design
differences between supporting declarative command line option
processing (while leaving positional argument processing to application
code), and supporting both named options and positional arguments in the
declarative interface mean that the API has diverged from that of
‘optparse’ over time.

As described in *note Choosing an argument parsing library: 336b,
applications that are currently using *note optparse: a4. and are happy
with the way it works can just continue to use ‘optparse’.

Application developers that are considering migrating should also review
the list of intrinsic behavioural differences described in that section
before deciding whether or not migration is desirable.

For applications that do choose to migrate from *note optparse: a4. to
*note argparse: 7, the following suggestions should be helpful:

   * すべての *note optparse.OptionParser.add_option(): 33d2. の呼び出し
     を、*note ArgumentParser.add_argument(): 4bc. の呼び出しに置き換え
     る。

   * ‘(options, args) = parser.parse_args()’ を ‘args =
     parser.parse_args()’ に置き換え、位置引数のために必要に応じて *note
     ArgumentParser.add_argument(): 4bc. の呼び出しを追加する。これまで
     ‘options’ と呼ばれていたものが、*note argparse: 7. では ‘args’ と呼
     ばれていることに留意してください。

   * *note optparse.OptionParser.disable_interspersed_args(): 33d3. を、
     *note parse_args(): 336d. ではなく *note parse_intermixed_args():
     cf7. で置き換える。

   * コールバック・アクションと ‘callback_*’ キーワード引数を ‘type’ や
     ‘action’ 引数に置き換える。

   * ‘type’ キーワード引数に渡していた文字列の名前を、それに応じたオブジ
     ェクト (例: int, float, complex, ...)  に置き換える。

   * *note optparse.Values: 33d4. を *note Namespace: 336e. に置き換え、
     *note optparse.OptionError: 33d5. と *note
     optparse.OptionValueError: 33d6. を *note ArgumentError: 33be. に置
     き換える。

   * ‘%default’ や ‘%prog’ などの暗黙の引数を含む文字列を、‘%(default)s’
     や ‘%(prog)s’ などの、通常の Python で辞書を使う場合のフォーマット
     文字列に置き換える。

   * OptionParser のコンストラクターの ‘version’ 引数を、
     ‘parser.add_argument('--version', action='version', version='<the
     version>')’ に置き換える


File: python.info,  Node: optparse --- Parser for command line options,  Next: getpass --- 可搬性のあるパスワード入力機構,  Prev: argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー,  Up: コマンドラインインターフェースライブラリ

5.17.2 ‘optparse’ -- Parser for command line options
----------------------------------------------------

'ソースコード:' Lib/optparse.py(1)

__________________________________________________________________

* Menu:

* Choosing an argument parsing library::
* はじめに: はじめに<7>.
* 背景::
* チュートリアル: チュートリアル<2>.
* リファレンスガイド::
* オプション処理コールバック::
* Extending optparse::
* 例外: 例外<12>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/optparse.py


File: python.info,  Node: Choosing an argument parsing library,  Next: はじめに<7>,  Up: optparse --- Parser for command line options

5.17.2.1 Choosing an argument parsing library
.............................................

The standard library includes three argument parsing libraries:

   * *note getopt: 65.: a module that closely mirrors the procedural C
     ‘getopt’ API. Included in the standard library since before the
     initial Python 1.0 release.

   * ‘optparse’: a declarative replacement for ‘getopt’ that provides
     equivalent functionality without requiring each application to
     implement its own procedural option parsing logic.  Included in the
     standard library since the Python 2.3 release.

   * *note argparse: 7.: a more opinionated alternative to ‘optparse’
     that provides more functionality by default, at the expense of
     reduced application flexibility in controlling exactly how
     arguments are processed.  Included in the standard library since
     the Python 2.7 and Python 3.2 releases.

In the absence of more specific argument parsing design constraints,
*note argparse: 7. is the recommended choice for implementing command
line applications, as it offers the highest level of baseline
functionality with the least application level code.

*note getopt: 65. is retained almost entirely for backwards
compatibility reasons.  However, it also serves a niche use case as a
tool for prototyping and testing command line argument handling in
‘getopt’-based C applications.

‘optparse’ should be considered as an alternative to *note argparse: 7.
in the following cases:

   * an application is already using ‘optparse’ and doesn't want to risk
     the subtle behavioural changes that may arise when migrating to
     *note argparse: 7.

   * the application requires additional control over the way options
     and positional parameters are interleaved on the command line
     (including the ability to disable the interleaving feature
     completely)

   * the application requires additional control over the incremental
     parsing of command line elements (while ‘argparse’ does support
     this, the exact way it works in practice is undesirable for some
     use cases)

   * the application requires additional control over the handling of
     options which accept parameter values that may start with ‘-’ (such
     as delegated options to be passed to invoked subprocesses)

   * the application requires some other command line parameter
     processing behavior which ‘argparse’ does not support, but which
     can be implemented in terms of the lower level interface offered by
     ‘optparse’

These considerations also mean that ‘optparse’ is likely to provide a
better foundation for library authors writing third party command line
argument processing libraries.

As a concrete example, consider the following two command line argument
parsing configurations, the first using ‘optparse’, and the second using
‘argparse’:

     import optparse

     if __name__ == '__main__':
         parser = optparse.OptionParser()
         parser.add_option('-o', '--output')
         parser.add_option('-v', dest='verbose', action='store_true')
         opts, args = parser.parse_args()
         process(args, output=opts.output, verbose=opts.verbose)

     import argparse

     if __name__ == '__main__':
         parser = argparse.ArgumentParser()
         parser.add_argument('-o', '--output')
         parser.add_argument('-v', dest='verbose', action='store_true')
         parser.add_argument('rest', nargs='*')
         args = parser.parse_args()
         process(args.rest, output=args.output, verbose=args.verbose)

The most obvious difference is that in the ‘optparse’ version, the
non-option arguments are processed separately by the application after
the option processing is complete.  In the ‘argparse’ version,
positional arguments are declared and processed in the same way as the
named options.

However, the ‘argparse’ version will also handle some parameter
combination differently from the way the ‘optparse’ version would handle
them.  For example (amongst other differences):

   * supplying ‘-o -v’ gives ‘output="-v"’ and ‘verbose=False’ when
     using ‘optparse’, but a usage error with ‘argparse’ (complaining
     that no value has been supplied for ‘-o/--output’, since ‘-v’ is
     interpreted as meaning the verbosity flag)

   * similarly, supplying ‘-o --’ gives ‘output="--"’ and ‘args=()’ when
     using ‘optparse’, but a usage error with ‘argparse’ (also
     complaining that no value has been supplied for ‘-o/--output’,
     since ‘--’ is interpreted as terminating the option processing and
     treating all remaining values as positional arguments)

   * supplying ‘-o=foo’ gives ‘output="=foo"’ when using ‘optparse’, but
     gives ‘output="foo"’ with ‘argparse’ (since ‘=’ is special cased as
     an alternative separator for option parameter values)

Whether these differing behaviors in the ‘argparse’ version are
considered desirable or a problem will depend on the specific command
line application use case.

参考
....

click(1) is a third party argument processing library (originally based
on ‘optparse’), which allows command line applications to be developed
as a set of decorated command implementation functions.

Other third party libraries, such as typer(2) or msgspec-click(3), allow
command line interfaces to be specified in ways that more effectively
integrate with static checking of Python type annotations.

   ---------- Footnotes ----------

   (1) https://pypi.org/project/click/

   (2) https://pypi.org/project/typer/

   (3) https://pypi.org/project/msgspec-click/


File: python.info,  Node: はじめに<7>,  Next: 背景,  Prev: Choosing an argument parsing library,  Up: optparse --- Parser for command line options

5.17.2.2 はじめに
.................

‘optparse’ is a more convenient, flexible, and powerful library for
parsing command-line options than the minimalist *note getopt: 65.
module.  ‘optparse’ uses a more declarative style of command-line
parsing: you create an instance of *note OptionParser: 16e6, populate it
with options, and parse the command line.  ‘optparse’ allows users to
specify options in the conventional GNU/POSIX syntax, and additionally
generates usage and help messages for you.

Here's an example of using ‘optparse’ in a simple script:

     from optparse import OptionParser
     ...
     parser = OptionParser()
     parser.add_option("-f", "--file", dest="filename",
                       help="write report to FILE", metavar="FILE")
     parser.add_option("-q", "--quiet",
                       action="store_false", dest="verbose", default=True,
                       help="don't print status messages to stdout")

     (options, args) = parser.parse_args()

このようにわずかな行数のコードによって、スクリプトのユーザはコマンドライ
ン上で例えば以下のような「よくある使い方」を実行できるようになります:

     <yourscript> --file=outfile -q

As it parses the command line, ‘optparse’ sets attributes of the
‘options’ object returned by *note parse_args(): 16e7. based on
user-supplied command-line values.  When *note parse_args(): 16e7.
returns from parsing this command line, ‘options.filename’ will be
‘"outfile"’ and ‘options.verbose’ will be ‘False’.  ‘optparse’ supports
both long and short options, allows short options to be merged together,
and allows options to be associated with their arguments in a variety of
ways.  Thus, the following command lines are all equivalent to the above
example:

     <yourscript> -f outfile --quiet
     <yourscript> --quiet --file outfile
     <yourscript> -q -foutfile
     <yourscript> -qfoutfile

さらに、ユーザが以下のいずれかを実行すると

     <yourscript> -h
     <yourscript> --help

and ‘optparse’ will print out a brief summary of your script's options:

     Usage: <yourscript> [options]

     Options:
       -h, --help            show this help message and exit
       -f FILE, --file=FILE  write report to FILE
       -q, --quiet           don't print status messages to stdout

'yourscript' の中身は実行時に決まります (通常は ‘sys.argv[0]’ になります
)。


File: python.info,  Node: 背景,  Next: チュートリアル<2>,  Prev: はじめに<7>,  Up: optparse --- Parser for command line options

5.17.2.3 背景
.............

‘optparse’ was explicitly designed to encourage the creation of programs
with straightforward command-line interfaces that follow the conventions
established by the ‘getopt()’ family of functions available to C
developers.  To that end, it supports only the most common command-line
syntax and semantics conventionally used under Unix.  If you are
unfamiliar with these conventions, reading this section will allow you
to acquaint yourself with them.

* Menu:

* 用語集::
* オプションとは何か::
* 位置引数とは何か::


File: python.info,  Node: 用語集,  Next: オプションとは何か,  Up: 背景

5.17.2.4 用語集
...............

引数 (argument)

     コマンドラインでユーザが入力するテキストの塊で、シェルが ‘execl’ や
     ‘execv’ に引き渡すものです。Python では、引数は ‘sys.argv[1:]’ の要
     素となります。(‘sys.argv[0]’ は実行しようとしているプログラムの名前
     です。引数解析に関しては、この要素はあまり重要ではありません。)
     Unix シェルでは、「語 (word)」という用語も使います。

     場合によっては ‘sys.argv[1:]’ 以外の引数リストを代入する方が望まし
     いことがあるので、「引数」は「 ‘sys.argv[1:]’ または ‘sys.argv[1:]’
     の代替として提供される別のリストの要素」と読むべきでしょう。

オプション (option)

     an argument used to supply extra information to guide or customize
     the execution of a program.  There are many different syntaxes for
     options; the traditional Unix syntax is a hyphen ("-") followed by
     a single letter, e.g.  ‘-x’ or ‘-F’.  Also, traditional Unix syntax
     allows multiple options to be merged into a single argument, e.g.
     ‘-x -F’ is equivalent to ‘-xF’.  The GNU project introduced ‘--’
     followed by a series of hyphen-separated words, e.g.  ‘--file’ or
     ‘--dry-run’.  These are the only two option syntaxes provided by
     ‘optparse’.

     他に見られる他のオプション書法には以下のようなものがあります:

        * ハイフンの後ろに数個の文字が続くもので、例えば ‘-pf’ (このオプ
          ションは複数のオプションを一つにまとめたものとは '違います')

        * ハイフンの後ろに語が続くもので、例えば ‘-file’ (これは技術的に
          は上の書式と同じですが、通常同じプログラム上で一緒に使うことは
          ありません)

        * プラス記号の後ろに一文字、数個の文字、または語を続けたもので、
          例えば ‘+f’, ‘+rgb’

        * スラッシュ記号の後ろに一文字、数個の文字、または語を続けたもの
          で、例えば ‘/f’, ‘/file’

     These option syntaxes are not supported by ‘optparse’, and they
     never will be.  This is deliberate: the first three are
     non-standard on any environment, and the last only makes sense if
     you're exclusively targeting Windows or certain legacy platforms
     (e.g.  VMS, MS-DOS).

オプション引数 (option argument)

     an argument that follows an option, is closely associated with that
     option, and is consumed from the argument list when that option is.
     With ‘optparse’, option arguments may either be in a separate
     argument from their option:

          -f foo
          --file foo

     また、一つの引数中にも入れられます:

          -ffoo
          --file=foo

     Typically, a given option either takes an argument or it doesn't.
     Lots of people want an "optional option arguments" feature, meaning
     that some options will take an argument if they see it, and won't
     if they don't.  This is somewhat controversial, because it makes
     parsing ambiguous: if ‘-a’ takes an optional argument and ‘-b’ is
     another option entirely, how do we interpret ‘-ab’?  Because of
     this ambiguity, ‘optparse’ does not support this feature.

位置引数 (positional argument)

     他のオプションが解析される、すなわち他のオプションとその引数が解析
     されて引数リストから除去された後に引数リストに置かれているものです
     。

必須のオプション (required option)

     an option that must be supplied on the command-line; note that the
     phrase "required option" is self-contradictory in English.
     ‘optparse’ doesn't prevent you from implementing required options,
     but doesn't give you much help at it either.

例えば、下記のような架空のコマンドラインを考えてみましょう:

     prog -v --report report.txt foo bar

‘-v’ と ‘--report’ はどちらもオプションです。‘--report’ オプションが引数
をとるとすれば、‘report.txt’ はオプションの引数です。‘foo’ と ‘bar’ は位
置引数になります。


File: python.info,  Node: オプションとは何か,  Next: 位置引数とは何か,  Prev: 用語集,  Up: 背景

5.17.2.5 オプションとは何か
...........................

オプションはプログラムの実行を調整したり、カスタマイズしたりするための補
助的な情報を与えるために使います。もっとはっきりいうと、オプションはあく
までもオプション (省略可能)であるということです。本来、プログラムはとも
かくもオプションなしでうまく実行できてしかるべきです。(Unix やGNU ツール
セットのプログラムをランダムにピックアップしてみてください。オプションを
全く指定しなくてもちゃんと動くでしょう？例外は ‘find’, ‘tar’, ‘dd’ くら
いです--これらの例外は、オプション文法が標準的でなく、インターフェースが
混乱を招くと酷評されてきた変種のはみ出しものなのです)

多くの人が自分のプログラムに「必須のオプション」を持たせたいと考えます。
しかしよく考えてください。必須なら、それは 'オプション(省略可能) ではな
いのです！' プログラムを正しく動作させるのに絶対的に必要な情報があるとす
れば、そこには位置引数を割り当てるべきなのです。

良くできたコマンドライン インターフェース設計として、ファイルのコピーに
使われる ‘cp’ ユーティリティのことを考えてみましょう。ファイルのコピーで
は、コピー先を指定せずにファイルをコピーするのは無意味な操作ですし、少な
くとも一つのコピー元が必要です。従って、‘cp’ は引数無しで実行すると失敗
します。とはいえ、‘cp’ はオプションを全く必要としない柔軟で便利なコマン
ドライン文法を備えています:

     cp SOURCE DEST
     cp SOURCE ... DEST-DIR

まだあります。ほとんどの ‘cp’ の実装では、ファイルモードや変更時刻を変え
ずにコピーする、シンボリックリンクの追跡を行わない、すでにあるファイルを
上書きする前にユーザに尋ねる、など、ファイルをコピーする方法をいじるため
の一連のオプションを実装しています。しかし、こうしたオプションは、一つの
ファイルを別の場所にコピーする、または複数のファイルを別のディレクトリに
コピーするという、‘cp’ の中心的な処理を乱すことはないのです。


File: python.info,  Node: 位置引数とは何か,  Prev: オプションとは何か,  Up: 背景

5.17.2.6 位置引数とは何か
.........................

位置引数とは、プログラムを動作させる上で絶対的に必要な情報となる引数です
。

よいユーザインターフェースとは、絶対に必要だとされるものが可能な限り少な
いものです。プログラムを正しく動作させるために 17 個もの別個の情報が必要
だとしたら、その '方法' はさして問題にはなりません --ユーザはプログラム
を正しく動作させられないうちに諦め、立ち去ってしまうからです。ユーザイン
ターフェースがコマンドラインでも、設定ファイルでも、GUI やその他の何であ
っても同じです: 多くの要求をユーザに押し付ければ、ほとんどのユーザはただ
音をあげてしまうだけなのです。

要するに、ユーザが絶対に提供しなければならない情報だけに制限する -- そし
て可能な限りよく練られたデフォルト設定を使うよう試みてください。もちろん
、プログラムには適度な柔軟性を持たせたいとも望むはずですが、それこそがオ
プションの果たす役割です。繰り返しますが、設定ファイルのエントリであろう
が、GUI でできた「環境設定」ダイアログ上のウィジェットであろうが、コマン
ドラインオプションであろうが関係ありません -- より多くのオプションを実装
すればプログラムはより柔軟性を持ちますが、実装はより難解になるのです。高
すぎる柔軟性はユーザを閉口させ、コードの維持をより難しくするのです。


File: python.info,  Node: チュートリアル<2>,  Next: リファレンスガイド,  Prev: 背景,  Up: optparse --- Parser for command line options

5.17.2.7 チュートリアル
.......................

While ‘optparse’ is quite flexible and powerful, it's also
straightforward to use in most cases.  This section covers the code
patterns that are common to any ‘optparse’-based program.

まず、*note OptionParser: 16e6. クラスを import しておかなければなりませ
ん。次に、プログラムの冒頭で *note OptionParser: 16e6. インスタンスを生
成しておきます:

     from optparse import OptionParser
     ...
     parser = OptionParser()

これでオプションを定義できるようになりました。基本的な構文は以下の通りで
す:

     parser.add_option(opt_str, ...,
                       attr=value, ...)

Each option has one or more option strings, such as ‘-f’ or ‘--file’,
and several option attributes that tell ‘optparse’ what to expect and
what to do when it encounters that option on the command line.

通常、各オプションには短いオプション文字列と長いオプション文字列がありま
す。例えば:

     parser.add_option("-f", "--file", ...)

オプション文字列は、(ゼロ文字の場合も含め)いくらでも短く、またいくらでも
長くできます。ただしオプション文字列は少なくとも一つなければなりません。

The option strings passed to *note OptionParser.add_option(): 33d2. are
effectively labels for the option defined by that call.  For brevity, we
will frequently refer to 'encountering an option' on the command line;
in reality, ‘optparse’ encounters 'option strings' and looks up options
from them.

Once all of your options are defined, instruct ‘optparse’ to parse your
program's command line:

     (options, args) = parser.parse_args()

(お望みなら、 *note parse_args(): 16e7. に自作の引数リストを渡してもかま
いません。とはいえ、実際にはそうした必要はほとんどないでしょう:
‘optionparser’ はデフォルトで ‘sys.argv[1:]’ を使うからです。)

*note parse_args(): 16e7. は二つの値を返します:

   * 全てのオプションに対する値の入ったオブジェクト ‘options’ -- 例えば
     、‘--file’ が単一の文字列引数をとる場合、‘options.file’ はユーザが
     指定したファイル名になります。オプションを指定しなかった場合には
     ‘None’ になります

   * オプションの解析後に残った位置引数からなるリスト ‘args’

このチュートリアルの節では、最も重要な四つのオプション属性: *note
action: 33e6, *note type: 33e7, *note dest: 33e8. (destination), *note
help: 33e9. についてしか触れません。このうち最も重要なのは *note action:
33e6. です。

* Menu:

* オプション・アクションを理解する::
* store アクション::
* ブール値 (フラグ) オプションの処理: ブール値 フラグ オプションの処理.
* その他のアクション::
* デフォルト値::
* ヘルプの生成::
* バージョン番号の出力::
* How optparse handles errors::
* 全てをつなぎ合わせる::


File: python.info,  Node: オプション・アクションを理解する,  Next: store アクション,  Up: チュートリアル<2>

5.17.2.8 オプション・アクションを理解する
.........................................

Actions tell ‘optparse’ what to do when it encounters an option on the
command line.  There is a fixed set of actions hard-coded into
‘optparse’; adding new actions is an advanced topic covered in section
*note Extending optparse: 33ec.  Most actions tell ‘optparse’ to store a
value in some variable--for example, take a string from the command line
and store it in an attribute of ‘options’.

If you don't specify an option action, ‘optparse’ defaults to ‘store’.


File: python.info,  Node: store アクション,  Next: ブール値 フラグ オプションの処理,  Prev: オプション・アクションを理解する,  Up: チュートリアル<2>

5.17.2.9 store アクション
.........................

The most common option action is ‘store’, which tells ‘optparse’ to take
the next argument (or the remainder of the current argument), ensure
that it is of the correct type, and store it to your chosen destination.

例えば:

     parser.add_option("-f", "--file",
                       action="store", type="string", dest="filename")

Now let's make up a fake command line and ask ‘optparse’ to parse it:

     args = ["-f", "foo.txt"]
     (options, args) = parser.parse_args(args)

When ‘optparse’ sees the option string ‘-f’, it consumes the next
argument, ‘foo.txt’, and stores it in ‘options.filename’.  So, after
this call to *note parse_args(): 16e7, ‘options.filename’ is
‘"foo.txt"’.

Some other option types supported by ‘optparse’ are ‘int’ and ‘float’.
Here's an option that expects an integer argument:

     parser.add_option("-n", type="int", dest="num")

このオプションには長い形式のオプション文字列がないため、設定に問題がない
ということに注意してください。また、デフォルトのアクションは ‘store’ な
ので、ここでは action を明示的に指定していません。

架空のコマンドラインをもう一つ解析してみましょう。今度は、オプション引数
をオプションの右側にぴったりくっつけて一緒くたにします: ‘-n42’ (一つの引
数のみ) は ‘-n 42’ (二つの引数からなる) と等価になるので

     (options, args) = parser.parse_args(["-n42"])
     print(options.num)

は ‘42’ を出力します。

If you don't specify a type, ‘optparse’ assumes ‘string’.  Combined with
the fact that the default action is ‘store’, that means our first
example can be a lot shorter:

     parser.add_option("-f", "--file", dest="filename")

If you don't supply a destination, ‘optparse’ figures out a sensible
default from the option strings: if the first long option string is
‘--foo-bar’, then the default destination is ‘foo_bar’.  If there are no
long option strings, ‘optparse’ looks at the first short option string:
the default destination for ‘-f’ is ‘f’.

‘optparse’ also includes the built-in ‘complex’ type.  Adding types is
covered in section *note Extending optparse: 33ec.


File: python.info,  Node: ブール値 フラグ オプションの処理,  Next: その他のアクション,  Prev: store アクション,  Up: チュートリアル<2>

5.17.2.10 ブール値 (フラグ) オプションの処理
............................................

Flag options--set a variable to true or false when a particular option
is seen--are quite common.  ‘optparse’ supports them with two separate
actions, ‘store_true’ and ‘store_false’.  For example, you might have a
‘verbose’ flag that is turned on with ‘-v’ and off with ‘-q’:

     parser.add_option("-v", action="store_true", dest="verbose")
     parser.add_option("-q", action="store_false", dest="verbose")

ここでは二つのオプションに同じ保存先を指定していますが、全く問題ありませ
ん。(下記のように、デフォルト値の設定を少し注意深く行わなければならない
だけです。)

When ‘optparse’ encounters ‘-v’ on the command line, it sets
‘options.verbose’ to ‘True’; when it encounters ‘-q’, ‘options.verbose’
is set to ‘False’.


File: python.info,  Node: その他のアクション,  Next: デフォルト値,  Prev: ブール値 フラグ オプションの処理,  Up: チュートリアル<2>

5.17.2.11 その他のアクション
............................

Some other actions supported by ‘optparse’ are:

‘"store_const"’

     store a constant value, pre-set via *note Option.const: 33f3.

‘"append"’

     オプションの引数を指定のリストに追加します

‘"count"’

     指定のカウンタを 1 増やします

‘"callback"’

     指定の関数を呼び出します

これらのアクションについては、 *note リファレンスガイド: 33f4. 節および
*note オプション処理コールバック: 33f5. 節で触れます。


File: python.info,  Node: デフォルト値,  Next: ヘルプの生成,  Prev: その他のアクション,  Up: チュートリアル<2>

5.17.2.12 デフォルト値
......................

All of the above examples involve setting some variable (the
"destination") when certain command-line options are seen.  What happens
if those options are never seen?  Since we didn't supply any defaults,
they are all set to ‘None’.  This is usually fine, but sometimes you
want more control.  ‘optparse’ lets you supply a default value for each
destination, which is assigned before the command line is parsed.

First, consider the verbose/quiet example.  If we want ‘optparse’ to set
‘verbose’ to ‘True’ unless ‘-q’ is seen, then we can do this:

     parser.add_option("-v", action="store_true", dest="verbose", default=True)
     parser.add_option("-q", action="store_false", dest="verbose")

デフォルトの値は特定のオプションではなく '保存先' に対して適用されます。
また、これら二つのオプションはたまたま同じ保存先を持っているにすぎないた
め、上のコードは下のコードと全く等価になります:

     parser.add_option("-v", action="store_true", dest="verbose")
     parser.add_option("-q", action="store_false", dest="verbose", default=True)

下のような場合を考えてみましょう:

     parser.add_option("-v", action="store_true", dest="verbose", default=False)
     parser.add_option("-q", action="store_false", dest="verbose", default=True)

やはり ‘verbose’ のデフォルト値は ‘True’ になります; 特定の目的変数に対
するデフォルト値として有効なのは、最後に指定した値だからです。

デフォルト値をすっきりと指定するには、 *note OptionParser: 16e6. の
‘set_defaults()’ メソッドを使います。このメソッドは *note parse_args():
16e7. を呼び出す前ならいつでも使えます:

     parser.set_defaults(verbose=True)
     parser.add_option(...)
     (options, args) = parser.parse_args()

前の例と同様、あるオプションの値の保存先に対するデフォルトの値は最後に指
定した値になります。コードを読みやすくするため、デフォルト値を設定すると
きには両方のやり方を混ぜるのではなく、片方だけを使うようにしましょう。


File: python.info,  Node: ヘルプの生成,  Next: バージョン番号の出力,  Prev: デフォルト値,  Up: チュートリアル<2>

5.17.2.13 ヘルプの生成
......................

‘optparse’'s ability to generate help and usage text automatically is
useful for creating user-friendly command-line interfaces.  All you have
to do is supply a *note help: 33e9. value for each option, and
optionally a short usage message for your whole program.  Here's an
OptionParser populated with user-friendly (documented) options:

     usage = "usage: %prog [options] arg1 arg2"
     parser = OptionParser(usage=usage)
     parser.add_option("-v", "--verbose",
                       action="store_true", dest="verbose", default=True,
                       help="make lots of noise [default]")
     parser.add_option("-q", "--quiet",
                       action="store_false", dest="verbose",
                       help="be vewwy quiet (I'm hunting wabbits)")
     parser.add_option("-f", "--filename",
                       metavar="FILE", help="write output to FILE")
     parser.add_option("-m", "--mode",
                       default="intermediate",
                       help="interaction mode: novice, intermediate, "
                            "or expert [default: %default]")

If ‘optparse’ encounters either ‘-h’ or ‘--help’ on the command-line, or
if you just call ‘parser.print_help()’, it prints the following to
standard output:

     Usage: <yourscript> [options] arg1 arg2

     Options:
       -h, --help            show this help message and exit
       -v, --verbose         make lots of noise [default]
       -q, --quiet           be vewwy quiet (I'm hunting wabbits)
       -f FILE, --filename=FILE
                             write output to FILE
       -m MODE, --mode=MODE  interaction mode: novice, intermediate, or
                             expert [default: intermediate]

(If the help output is triggered by a help option, ‘optparse’ exits
after printing the help text.)

There's a lot going on here to help ‘optparse’ generate the best
possible help message:

   * スクリプト自体の利用法を表すメッセージを定義します:

          usage = "usage: %prog [options] arg1 arg2"

     ‘optparse’ expands ‘%prog’ in the usage string to the name of the
     current program, i.e.  ‘os.path.basename(sys.argv[0])’.  The
     expanded string is then printed before the detailed option help.

     If you don't supply a usage string, ‘optparse’ uses a bland but
     sensible default: ‘"Usage: %prog [options]"’, which is fine if your
     script doesn't take any positional arguments.

   * every option defines a help string, and doesn't worry about
     line-wrapping--‘optparse’ takes care of wrapping lines and making
     the help output look good.

   * オプションが値をとるということは自動的に生成されるヘルプメッセージ
     の中で分かります。例えば、"mode" option の場合にはこのようになりま
     す:

          -m MODE, --mode=MODE

     Here, "MODE" is called the meta-variable: it stands for the
     argument that the user is expected to supply to ‘-m’/‘--mode’.  By
     default, ‘optparse’ converts the destination variable name to
     uppercase and uses that for the meta-variable.  Sometimes, that's
     not what you want--for example, the ‘--filename’ option explicitly
     sets ‘metavar="FILE"’, resulting in this automatically generated
     option description:

          -f FILE, --filename=FILE

     この機能の重要さは、単に表示スペースを節約するといった理由にとどま
     りません: 上の例では、手作業で書いたヘルプテキストの中でメタ変数と
     して ‘FILE’ を使っています。その結果、ユーザに対してやや堅苦しい表
     現の書法 ‘-f FILE’ と、より平易に意味付けを説明した "write output
     to FILE" との間に対応があるというヒントを与えています。これは、エン
     ドユーザにとってより明解で便利なヘルプテキストを作成する単純であり
     ながら効果的な手法なのです。

   * options that have a default value can include ‘%default’ in the
     help string--‘optparse’ will replace it with *note str(): 169. of
     the option's default value.  If an option has no default value (or
     the default value is ‘None’), ‘%default’ expands to ‘none’.

* Menu:

* オプションをグループ化する::


File: python.info,  Node: オプションをグループ化する,  Up: ヘルプの生成

5.17.2.14 オプションをグループ化する
....................................

たくさんのオプションを扱う場合、オプションをグループ分けするとヘルプ出力
が見やすくなります。 *note OptionParser: 16e6. は、複数のオプションをま
とめたオプショングループを複数持つことができます。

オプションのグループは、 *note OptionGroup: 33fb. を使って作成します:

 -- クラス: optparse.OptionGroup (parser, title, description=None)

     ここでは:

        * 'parser' は、このグループが属する *note OptionParser: 16e6. の
          インスタンスです

        * 'title' はグループのタイトルです

        * 'description' はオプションで、グループの長い説明です

*note OptionGroup: 33fb. は (*note OptionParser: 16e6. のように)
‘OptionContainer’ を継承していて、オプションをグループに追加するために
‘add_option()’ メソッドを利用できます。

全てのオプションを定義したら、 *note OptionParser: 16e6. の
‘add_option_group()’ メソッドを使ってグループを定義済みのパーサーに追加
します。

前のセクションで定義したパーサーに、続けて *note OptionGroup: 33fb. を追
加します:

     group = OptionGroup(parser, "Dangerous Options",
                         "Caution: use these options at your own risk.  "
                         "It is believed that some of them bite.")
     group.add_option("-g", action="store_true", help="Group option.")
     parser.add_option_group(group)

この結果のヘルプ出力は次のようになります:

     Usage: <yourscript> [options] arg1 arg2

     Options:
       -h, --help            show this help message and exit
       -v, --verbose         make lots of noise [default]
       -q, --quiet           be vewwy quiet (I'm hunting wabbits)
       -f FILE, --filename=FILE
                             write output to FILE
       -m MODE, --mode=MODE  interaction mode: novice, intermediate, or
                             expert [default: intermediate]

       Dangerous Options:
         Caution: use these options at your own risk.  It is believed that some
         of them bite.

         -g                  Group option.

さらにサンプルを拡張して、複数のグループを使うようにしてみます:

     group = OptionGroup(parser, "Dangerous Options",
                         "Caution: use these options at your own risk.  "
                         "It is believed that some of them bite.")
     group.add_option("-g", action="store_true", help="Group option.")
     parser.add_option_group(group)

     group = OptionGroup(parser, "Debug Options")
     group.add_option("-d", "--debug", action="store_true",
                      help="Print debug information")
     group.add_option("-s", "--sql", action="store_true",
                      help="Print all SQL statements executed")
     group.add_option("-e", action="store_true", help="Print every action done")
     parser.add_option_group(group)

出力結果は次のようになります:

     Usage: <yourscript> [options] arg1 arg2

     Options:
       -h, --help            show this help message and exit
       -v, --verbose         make lots of noise [default]
       -q, --quiet           be vewwy quiet (I'm hunting wabbits)
       -f FILE, --filename=FILE
                             write output to FILE
       -m MODE, --mode=MODE  interaction mode: novice, intermediate, or expert
                             [default: intermediate]

       Dangerous Options:
         Caution: use these options at your own risk.  It is believed that some
         of them bite.

         -g                  Group option.

       Debug Options:
         -d, --debug         Print debug information
         -s, --sql           Print all SQL statements executed
         -e                  Print every action done

もう1つの、特にオプショングループをプログラムから操作するときに利用でき
るメソッドがあります:

 -- メソッド: OptionParser.get_option_group (opt_str)

     短いオプション文字列もしくは長いオプション文字列 'opt_str' (例。
     ‘'-o'’ 、 ‘'--option'’) が属する *note OptionGroup: 33fb. を返しま
     す。そのような *note OptionGroup: 33fb. が無い場合は、 ‘None’ を返
     します。


File: python.info,  Node: バージョン番号の出力,  Next: How optparse handles errors,  Prev: ヘルプの生成,  Up: チュートリアル<2>

5.17.2.15 バージョン番号の出力
..............................

Similar to the brief usage string, ‘optparse’ can also print a version
string for your program.  You have to supply the string as the ‘version’
argument to OptionParser:

     parser = OptionParser(usage="%prog [-f] [-q]", version="%prog 1.0")

‘%prog’ is expanded just like it is in ‘usage’.  Apart from that,
‘version’ can contain anything you like.  When you supply it, ‘optparse’
automatically adds a ‘--version’ option to your parser.  If it
encounters this option on the command line, it expands your ‘version’
string (by replacing ‘%prog’), prints it to stdout, and exits.

例えば、‘/usr/bin/foo’ という名前のスクリプトなら:

     $ /usr/bin/foo --version
     foo 1.0

以下の2つのメソッドを、‘version’ 文字列を表示するために利用できます:

 -- メソッド: OptionParser.print_version (file=None)

     現在のプログラムのバージョン (‘self.version’) を 'file' (デフォルト
     : stdout) へ表示します。 *note print_usage(): 3400. と同じく、
     ‘self.version’ の中の全ての ‘%prog’ が現在のプログラム名に置き換え
     られます。 ‘self.version’ が空文字列だだったり未定義だったときは何
     もしません。

 -- メソッド: OptionParser.get_version ()

     *note print_version(): 33ff. と同じですが、バージョン文字列を表示す
     る代わりに返します。


File: python.info,  Node: How optparse handles errors,  Next: 全てをつなぎ合わせる,  Prev: バージョン番号の出力,  Up: チュートリアル<2>

5.17.2.16 How ‘optparse’ handles errors
.......................................

There are two broad classes of errors that ‘optparse’ has to worry
about: programmer errors and user errors.  Programmer errors are usually
erroneous calls to *note OptionParser.add_option(): 33d2, e.g.  invalid
option strings, unknown option attributes, missing option attributes,
etc.  These are dealt with in the usual way: raise an exception (either
*note optparse.OptionError: 33d5. or *note TypeError: 198.) and let the
program crash.

Handling user errors is much more important, since they are guaranteed
to happen no matter how stable your code is.  ‘optparse’ can
automatically detect some user errors, such as bad option arguments
(passing ‘-n 4x’ where ‘-n’ takes an integer argument), missing
arguments (‘-n’ at the end of the command line, where ‘-n’ takes an
argument of any type).  Also, you can call ‘OptionParser.error()’ to
signal an application-defined error condition:

     (options, args) = parser.parse_args()
     ...
     if options.a and options.b:
         parser.error("options -a and -b are mutually exclusive")

In either case, ‘optparse’ handles the error the same way: it prints the
program's usage message and an error message to standard error and exits
with error status 2.

上に挙げた最初の例、すなわち整数を引数にとるオプションにユーザが ‘4x’ を
指定した場合を考えてみましょう:

     $ /usr/bin/foo -n 4x
     Usage: foo [options]

     foo: error: option -n: invalid integer value: '4x'

値を全く指定しない場合には、以下のようになります:

     $ /usr/bin/foo -n
     Usage: foo [options]

     foo: error: -n option requires an argument

‘optparse’-generated error messages take care always to mention the
option involved in the error; be sure to do the same when calling
‘OptionParser.error()’ from your application code.

If ‘optparse’'s default error-handling behaviour does not suit your
needs, you'll need to subclass OptionParser and override its ‘exit()’
and/or ‘error()’ methods.


File: python.info,  Node: 全てをつなぎ合わせる,  Prev: How optparse handles errors,  Up: チュートリアル<2>

5.17.2.17 全てをつなぎ合わせる
..............................

Here's what ‘optparse’-based scripts usually look like:

     from optparse import OptionParser
     ...
     def main():
         usage = "usage: %prog [options] arg"
         parser = OptionParser(usage)
         parser.add_option("-f", "--file", dest="filename",
                           help="read data from FILENAME")
         parser.add_option("-v", "--verbose",
                           action="store_true", dest="verbose")
         parser.add_option("-q", "--quiet",
                           action="store_false", dest="verbose")
         ...
         (options, args) = parser.parse_args()
         if len(args) != 1:
             parser.error("incorrect number of arguments")
         if options.verbose:
             print("reading %s..." % options.filename)
         ...

     if __name__ == "__main__":
         main()


File: python.info,  Node: リファレンスガイド,  Next: オプション処理コールバック,  Prev: チュートリアル<2>,  Up: optparse --- Parser for command line options

5.17.2.18 リファレンスガイド
............................

* Menu:

* parserを作る::
* パーザへのオプション追加::
* オプションの定義::
* オプション属性::
* 標準的なオプション・アクション::
* 標準のオプション型::
* 引数を解析する::
* オプション解析器への問い合わせと操作::
* オプション間の衝突::
* クリーンアップ::
* その他のメソッド::


File: python.info,  Node: parserを作る,  Next: パーザへのオプション追加,  Up: リファレンスガイド

5.17.2.19 parserを作る
......................

The first step in using ‘optparse’ is to create an OptionParser
instance.

 -- クラス: optparse.OptionParser (...)

     OptionParser のコンストラクタの引数はどれも必須ではありませんが、い
     くつものキーワード引数がオプションとして使えます。これらはキーワー
     ド引数として渡さなければなりません。すなわち、引数が宣言されている
     順番に頼ってはいけません。

     ‘usage’ (デフォルト: ‘"%prog [options]"’)

          The usage summary to print when your program is run
          incorrectly or with a help option.  When ‘optparse’ prints the
          usage string, it expands ‘%prog’ to
          ‘os.path.basename(sys.argv[0])’ (or to ‘prog’ if you passed
          that keyword argument).  To suppress a usage message, pass the
          special value ‘optparse.SUPPRESS_USAGE’.

     ‘option_list’ (デフォルト: ‘[]’)

          パーザに追加する Option オブジェクトのリストです。
          ‘option_list’ の中のオプションは ‘standard_option_list’
          (OptionParser のサブクラスでセットされる可能性のあるクラス属性
          ) の後に追加されますが、バージョンやヘルプのオプションよりは前
          になります。このオプションの使用は推奨されません。パーザを作成
          した後で、 *note add_option(): 33d2. を使って追加してください
          。

     ‘option_class’ (デフォルト: optparse.Option)

          *note add_option(): 33d2. でパーザにオプションを追加するときに
          使用されるクラス。

     ‘version’ (デフォルト: ‘None’)

          A version string to print when the user supplies a version
          option.  If you supply a true value for ‘version’, ‘optparse’
          automatically adds a version option with the single option
          string ‘--version’.  The substring ‘%prog’ is expanded the
          same as for ‘usage’.

     ‘conflict_handler’ (デフォルト: ‘"error"’)

          オプション文字列が衝突するようなオプションがパーザに追加された
          ときにどうするかを指定します。 *note オプション間の衝突: 3409.
          節を参照して下さい。

     ‘description’ (デフォルト: ‘None’)

          A paragraph of text giving a brief overview of your program.
          ‘optparse’ reformats this paragraph to fit the current
          terminal width and prints it when the user requests help
          (after ‘usage’, but before the list of options).

     ‘formatter’ (デフォルト: 新しい ‘IndentedHelpFormatter’)

          An instance of optparse.HelpFormatter that will be used for
          printing help text.  ‘optparse’ provides two concrete classes
          for this purpose: IndentedHelpFormatter and
          TitledHelpFormatter.

     ‘add_help_option’ (デフォルト: ‘True’)

          If true, ‘optparse’ will add a help option (with option
          strings ‘-h’ and ‘--help’) to the parser.

     ‘prog’

          ‘usage’ や ‘version’ の中の ‘%prog’ を展開するときに
          ‘os.path.basename(sys.argv[0])’ の代わりに使われる文字列です。

     ‘epilog’ (デフォルト: ‘None’)

          オプションのヘルプの後に表示されるヘルプテキスト.


File: python.info,  Node: パーザへのオプション追加,  Next: オプションの定義,  Prev: parserを作る,  Up: リファレンスガイド

5.17.2.20 パーザへのオプション追加
..................................

パーザにオプションを加えていくにはいくつか方法があります。推奨するのは
*note チュートリアル: 33e4. 節で示したような *note
OptionParser.add_option(): 33d2. を使う方法です。 ‘add_option()’ は以下
の二つのうちいずれかの方法で呼び出せます:

   * (‘make_option()’ などが返す) *note Option: 340c. インスタンスを渡し
     ます

   * ‘make_option()’ に (すなわち *note Option: 340c. のコンストラクタに
     ) 位置引数とキーワード引数の組み合わせを渡して、 *note Option:
     340c. インスタンスを生成させます

もう一つの方法は、あらかじめ作成しておいた *note Option: 340c. インスタ
ンスからなるリストを、以下のようにして *note OptionParser: 16e6. のコン
ストラクタに渡すというものです:

     option_list = [
         make_option("-f", "--filename",
                     action="store", type="string", dest="filename"),
         make_option("-q", "--quiet",
                     action="store_false", dest="verbose"),
         ]
     parser = OptionParser(option_list=option_list)

(‘make_option()’ is a factory function for creating Option instances;
currently it is an alias for the Option constructor.  A future version
of ‘optparse’ may split Option into several classes, and ‘make_option()’
will pick the right class to instantiate.  Do not instantiate Option
directly.)


File: python.info,  Node: オプションの定義,  Next: オプション属性,  Prev: パーザへのオプション追加,  Up: リファレンスガイド

5.17.2.21 オプションの定義
..........................

各々の *note Option: 340c. インスタンス、は ‘-f’ や ‘--file’ といった同
義のコマンドラインオプションからなる集合を表現しています。一つの *note
Option: 340c. には任意の数のオプションを短い形式でも長い形式でも指定でき
ます。ただし、少なくとも一つは指定しなければなりません。

正しい方法で *note Option: 340c. インスタンスを生成するには、 *note
OptionParser: 16e6. の ‘add_option()’ を使います。

 -- メソッド: OptionParser.add_option (option)

 -- メソッド: OptionParser.add_option (*opt_str, attr=value, ...)

     短い形式のオプション文字列を一つだけ持つようなオプションを生成する
     には次のようにします:

          parser.add_option("-f", attr=value, ...)

     また、長い形式のオプション文字列を一つだけ持つようなオプションの定
     義は次のようになります:

          parser.add_option("--foo", attr=value, ...)

     The keyword arguments define attributes of the new Option object.
     The most important option attribute is *note action: 33e6, and it
     largely determines which other attributes are relevant or required.
     If you pass irrelevant option attributes, or fail to pass required
     ones, ‘optparse’ raises an *note OptionError: 33d5. exception
     explaining your mistake.

     An option's 'action' determines what ‘optparse’ does when it
     encounters this option on the command-line.  The standard option
     actions hard-coded into ‘optparse’ are:

     ‘"store"’

          オプションの引数を保存します (デフォルトの動作です)

     ‘"store_const"’

          store a constant value, pre-set via *note Option.const: 33f3.

     ‘"store_true"’

          store ‘True’

     ‘"store_false"’

          store ‘False’

     ‘"append"’

          オプションの引数を指定のリストに追加します

     ‘"append_const"’

          append a constant value to a list, pre-set via *note
          Option.const: 33f3.

     ‘"count"’

          指定のカウンタを 1 増やします

     ‘"callback"’

          指定の関数を呼び出します

     ‘"help"’

          全てのオプションとそのドキュメントの入った使用法メッセージを出
          力します

     (アクションを指定しない場合、デフォルトは ‘"store"’ になります。こ
     のアクションでは、 *note type: 33e7. および *note dest: 33e8. オプ
     ション属性を指定できます。 *note 標準的なオプション・アクション:
     340f. を参照してください。)

As you can see, most actions involve storing or updating a value
somewhere.  ‘optparse’ always creates a special object for this,
conventionally called ‘options’, which is an instance of *note
optparse.Values: 33d4.

 -- クラス: optparse.Values

     An object holding parsed argument names and values as attributes.
     Normally created by calling when calling *note
     OptionParser.parse_args(): 16e7, and can be overridden by a custom
     subclass passed to the 'values' argument of *note
     OptionParser.parse_args(): 16e7. (as described in *note
     引数を解析する: 3410.).

Option arguments (and various other values) are stored as attributes of
this object, according to the *note dest: 33e8. (destination) option
attribute.

例えばこれを呼び出した場合

     parser.parse_args()

one of the first things ‘optparse’ does is create the ‘options’ object:

     options = Values()

パーザ中で以下のようなオプションが定義されていて

     parser.add_option("-f", "--file", action="store", type="string", dest="filename")

パーズしたコマンドラインに以下のいずれかが入っていた場合:

     -ffoo
     -f foo
     --file=foo
     --file foo

then ‘optparse’, on seeing this option, will do the equivalent of

     options.filename = "foo"

*note type: 33e7. および *note dest: 33e8. オプション属性は *note
action: 33e6. と同じくらい重要ですが、 '全ての' オプションで意味をなすの
は *note action: 33e6. だけなのです。


File: python.info,  Node: オプション属性,  Next: 標準的なオプション・アクション,  Prev: オプションの定義,  Up: リファレンスガイド

5.17.2.22 オプション属性
........................

 -- クラス: optparse.Option

     A single command line argument, with various attributes passed by
     keyword to the constructor.  Normally created with *note
     OptionParser.add_option(): 33d2. rather than directly, and can be
     overridden by a custom class via the 'option_class' argument to
     *note OptionParser: 16e6.

The following option attributes may be passed as keyword arguments to
*note OptionParser.add_option(): 33d2.  If you pass an option attribute
that is not relevant to a particular option, or fail to pass a required
option attribute, ‘optparse’ raises *note OptionError: 33d5.

 -- の属性: Option.action

     (デフォルト: ‘"store"’)

     Determines ‘optparse’'s behaviour when this option is seen on the
     command line; the available options are documented *note here:
     340f.

 -- の属性: Option.type

     (デフォルト: ‘"string"’)

     このオプションに与えられる引数の型 (たとえば ‘"string"’ や ‘"int"’)
     です。取りうるオプションについては *note こちら: 3413. を参照してく
     ださい。

 -- の属性: Option.dest

     (デフォルト: オプション文字列を使う)

     If the option's action implies writing or modifying a value
     somewhere, this tells ‘optparse’ where to write it: *note dest:
     33e8. names an attribute of the ‘options’ object that ‘optparse’
     builds as it parses the command line.

 -- の属性: Option.default

     コマンドラインに指定がなかったときにこのオプションの対象に使われる
     値です。 *note OptionParser.set_defaults(): 3415. も参照してくださ
     い。

 -- の属性: Option.nargs

     (デフォルト: 1)

     How many arguments of type *note type: 33e7. should be consumed
     when this option is seen.  If > 1, ‘optparse’ will store a tuple of
     values to *note dest: 33e8.

 -- の属性: Option.const

     定数を格納する動作のための、その定数です。

 -- の属性: Option.choices

     ‘"choice"’ 型オプションに対してユーザが選べる選択肢となる文字列のリ
     ストです。

 -- の属性: Option.callback

     アクションが ‘"callback"’ であるオプションに対し、このオプションが
     あったときに呼ばれる呼び出し可能オブジェクトです。呼び出し時に渡さ
     れる引数の詳細については、 *note オプション処理コールバック: 33f5.
     を参照してください。

 -- の属性: Option.callback_args
 -- の属性: Option.callback_kwargs

     ‘callback’ に渡される標準的な4つのコールバック引数の後ろに追加する
     、位置引数とキーワード引数。

 -- の属性: Option.help

     ユーザが *note help: 33e9. オプション(‘--help’ のような)を指定した
     ときに表示される、使用可能な全オプションのリストの中のこのオプショ
     ンに関する説明文です。説明文を提供しておかなければ、オプションは説
     明文なしで表示されます。オプションを隠すには特殊な値
     ‘optparse.SUPPRESS_HELP’ を使います。

 -- の属性: Option.metavar

     (デフォルト: オプション文字列を使う)

     説明文を表示する際にオプションの引数の身代わりになるものです。例は
     *note チュートリアル: 33e4. 節を参照してください。


File: python.info,  Node: 標準的なオプション・アクション,  Next: 標準のオプション型,  Prev: オプション属性,  Up: リファレンスガイド

5.17.2.23 標準的なオプション・アクション
........................................

The various option actions all have slightly different requirements and
effects.  Most actions have several relevant option attributes which you
may specify to guide ‘optparse’'s behaviour; a few have required
attributes, which you must specify for any option using that action.

   * ‘"store"’ [関連: *note type: 33e7, *note dest: 33e8, *note nargs:
     3416, *note choices: 3417.]

     オプションの後には必ず引数が続きます。引数は *note type: 33e7. に従
     って値に変換されて *note dest: 33e8. に保存されます。 *note nargs:
     3416. > 1 の場合、複数の引数をコマンドラインから取り出します。引数
     は全て *note type: 33e7. に従って変換され、 *note dest: 33e8. にタ
     プルとして保存されます。 *note 標準のオプション型: 3413. 節を参照し
     てください。

     *note choices: 3417. を(文字列のリストかタプルで) 指定した場合、型
     のデフォルト値は ‘"choice"’ になります。

     *note type: 33e7. を指定しない場合、デフォルトの値は ‘"string"’ で
     す。

     If *note dest: 33e8. is not supplied, ‘optparse’ derives a
     destination from the first long option string (e.g., ‘--foo-bar’
     implies ‘foo_bar’).  If there are no long option strings,
     ‘optparse’ derives a destination from the first short option string
     (e.g., ‘-f’ implies ‘f’).

     以下はプログラム例です:

          parser.add_option("-f")
          parser.add_option("-p", type="float", nargs=3, dest="point")

     とすると、以下のようなコマンドライン

          -f foo.txt -p 1 -3.5 4 -fbar.txt

     ‘optparse’ will set

          options.f = "foo.txt"
          options.point = (1.0, -3.5, 4.0)
          options.f = "bar.txt"

   * ‘"store_const"’ [関連: *note const: 33f3.; 関連: *note dest: 33e8.]

     値 *note const: 33f3. を *note dest: 33e8. に保存します。

     以下はプログラム例です:

          parser.add_option("-q", "--quiet",
                            action="store_const", const=0, dest="verbose")
          parser.add_option("-v", "--verbose",
                            action="store_const", const=1, dest="verbose")
          parser.add_option("--noisy",
                            action="store_const", const=2, dest="verbose")

     If ‘--noisy’ is seen, ‘optparse’ will set

          options.verbose = 2

   * ‘"store_true"’ [関連: *note dest: 33e8.]

     A special case of ‘"store_const"’ that stores ‘True’ to *note dest:
     33e8.

   * ‘"store_false"’ [関連: *note dest: 33e8.]

     Like ‘"store_true"’, but stores ‘False’.

     以下はプログラム例です:

          parser.add_option("--clobber", action="store_true", dest="clobber")
          parser.add_option("--no-clobber", action="store_false", dest="clobber")

   * ‘"append"’ [関連: *note type: 33e7, *note dest: 33e8, *note nargs:
     3416, *note choices: 3417.]

     The option must be followed by an argument, which is appended to
     the list in *note dest: 33e8.  If no default value for *note dest:
     33e8. is supplied, an empty list is automatically created when
     ‘optparse’ first encounters this option on the command-line.  If
     *note nargs: 3416. > 1, multiple arguments are consumed, and a
     tuple of length *note nargs: 3416. is appended to *note dest: 33e8.

     *note type: 33e7. および *note dest: 33e8. のデフォルト値は
     ‘"store"’ アクションと同じです。

     以下はプログラム例です:

          parser.add_option("-t", "--tracks", action="append", type="int")

     If ‘-t3’ is seen on the command-line, ‘optparse’ does the
     equivalent of:

          options.tracks = []
          options.tracks.append(int("3"))

     その後、‘--tracks=4’ が見つかると以下を実行します:

          options.tracks.append(int("4"))

     ‘append’ アクションは、オプションの現在の値の ‘append’ メソッドを呼
     び出します。これは、どのデフォルト値も ‘append’ メソッドを持ってい
     なければならないことを意味します。また、デフォルト値が空でない場合
     、オプションの解析結果は、そのデフォルトの要素の後ろにコマンドライ
     ンからの値が追加されたものになる、ということも意味します:

          >>> parser.add_option("--files", action="append", default=['~/.mypkg/defaults'])
          >>> opts, args = parser.parse_args(['--files', 'overrides.mypkg'])
          >>> opts.files
          ['~/.mypkg/defaults', 'overrides.mypkg']

   * ‘"append_const"’ [関連: *note const: 33f3.; 関連: *note dest:
     33e8.]

     ‘"store_const"’ と同様ですが、 *note const: 33f3. の値は *note
     dest: 33e8. に追加(append)されます。 ‘"append"’ の場合と同じように
     *note dest: 33e8. のデフォルトは ‘None’ ですがこのオプションを最初
     にみつけた時点で空のリストを自動的に生成します。

   * ‘"count"’ [関連: *note dest: 33e8.]

     *note dest: 33e8. に保存されている整数値をインクリメントします。
     *note dest: 33e8. は (デフォルトの値を指定しない限り) 最初にインク
     リメントを行う前にゼロに設定されます。

     以下はプログラム例です:

          parser.add_option("-v", action="count", dest="verbosity")

     The first time ‘-v’ is seen on the command line, ‘optparse’ does
     the equivalent of:

          options.verbosity = 0
          options.verbosity += 1

     以後、‘-v’ が見つかるたびに

          options.verbosity += 1

   * ‘"callback"’ [必須: *note callback: 3418.; 関連: *note type: 33e7,
     *note nargs: 3416, *note callback_args: 3419, *note
     callback_kwargs: 341a.]

     *note callback: 3418. に指定された関数を次のように呼び出します

          func(option, opt_str, value, parser, *args, **kwargs)

     詳細は、 *note オプション処理コールバック: 33f5. 節を参照してくださ
     い。

   * ‘"help"’

     現在のオプションパーザ内の全てのオプションに対する完全なヘルプメッ
     セージを出力します。ヘルプメッセージは *note OptionParser: 16e6. の
     コンストラクタに渡した ‘usage’ 文字列と、各オプションに渡した *note
     help: 33e9. 文字列から生成します。

     オプションに *note help: 33e9. 文字列が指定されていなくても、オプシ
     ョンはヘルプメッセージ中に列挙されます。オプションを完全に表示させ
     ないようにするには、特殊な値 ‘optparse.SUPPRESS_HELP’ を使ってくだ
     さい。

     ‘optparse’ automatically adds a *note help: 33e9. option to all
     OptionParsers, so you do not normally need to create one.

     以下はプログラム例です:

          from optparse import OptionParser, SUPPRESS_HELP

          # usually, a help option is added automatically, but that can
          # be suppressed using the add_help_option argument
          parser = OptionParser(add_help_option=False)

          parser.add_option("-h", "--help", action="help")
          parser.add_option("-v", action="store_true", dest="verbose",
                            help="Be moderately verbose")
          parser.add_option("--file", dest="filename",
                            help="Input file to read data from")
          parser.add_option("--secret", help=SUPPRESS_HELP)

     If ‘optparse’ sees either ‘-h’ or ‘--help’ on the command line, it
     will print something like the following help message to stdout
     (assuming ‘sys.argv[0]’ is ‘"foo.py"’):

          Usage: foo.py [options]

          Options:
            -h, --help        Show this help message and exit
            -v                Be moderately verbose
            --file=FILENAME   Input file to read data from

     After printing the help message, ‘optparse’ terminates your process
     with ‘sys.exit(0)’.

   * ‘"version"’

     Prints the version number supplied to the OptionParser to stdout
     and exits.  The version number is actually formatted and printed by
     the ‘print_version()’ method of OptionParser.  Generally only
     relevant if the ‘version’ argument is supplied to the OptionParser
     constructor.  As with *note help: 33e9. options, you will rarely
     create ‘version’ options, since ‘optparse’ automatically adds them
     when needed.


File: python.info,  Node: 標準のオプション型,  Next: 引数を解析する,  Prev: 標準的なオプション・アクション,  Up: リファレンスガイド

5.17.2.24 標準のオプション型
............................

‘optparse’ has five built-in option types: ‘"string"’, ‘"int"’,
‘"choice"’, ‘"float"’ and ‘"complex"’.  If you need to add new option
types, see section *note Extending optparse: 33ec.

文字列オプションの引数はチェックや変換を一切受けません: コマンドライン上
のテキストは保存先にそのまま保存されます (またはコールバックに渡されます
)。

整数引数 (‘"int"’ 型) は次のように解析されます:

   * 数が ‘0x’ から始まるならば、16進数として読み取られます

   * 数が ‘0’ から始まるならば、8進数として読み取られます

   * 数が ‘0b’ から始まるならば、2進数として読み取られます

   * それ以外の場合、数は10進数として読み取られます

The conversion is done by calling *note int(): 19b. with the appropriate
base (2, 8, 10, or 16).  If this fails, so will ‘optparse’, although
with a more useful error message.

‘"float"’ および ‘"complex"’ のオプション引数は直接 *note float(): 196.
や *note complex(): 197. で変換されます。エラーは同様の扱いです。

‘"choice"’ オプションは ‘"string"’ オプションのサブタイプです。 *note
choices: 3417. オプションの属性 (文字列からなるシーケンス) には、利用で
きるオプション引数のセットを指定します。 ‘optparse.check_choice()’ はユ
ーザの指定したオプション引数とマスタリストを比較して、無効な文字列が指定
された場合には *note OptionValueError: 33d6. を送出します。


File: python.info,  Node: 引数を解析する,  Next: オプション解析器への問い合わせと操作,  Prev: 標準のオプション型,  Up: リファレンスガイド

5.17.2.25 引数を解析する
........................

OptionParser を作成してオプションを追加していく上で大事なポイントは、
*note parse_args(): 16e7. メソッドの呼び出しです。

 -- メソッド: OptionParser.parse_args (args=None, values=None)

     Parse the command-line options found in 'args'.

     The input parameters are

     ‘args’

          処理する引数のリスト (デフォルト: ‘sys.argv[1:]’)

     ‘values’

          オプション引数を格納する *note Values: 33d4. のオブジェクト (デ
          フォルト: 新しい *note Values: 33d4. のインスタンス) - 既存の
          オブジェクトを指定した場合、オプションのデフォルトは初期化され
          ません

     and the return value is a pair ‘(options, args)’ where

     ‘options’

          the same object that was passed in as 'values', or the
          ‘optparse.Values’ instance created by ‘optparse’

     ‘args’

          全てのオプションの処理が終わった後で残った位置引数

一番普通の使い方は一切キーワード引数を使わないというものです。 ‘values’
を指定した場合、それは繰り返される *note setattr(): 25be. の呼び出し (大
雑把に言うと保存される各オプション引数につき一回ずつ) で更新されていき、
*note parse_args(): 16e7. で返されます。

*note parse_args(): 16e7. が引数リストでエラーに遭遇した場合、
OptionParser の ‘error()’ メソッドを適切なエンドユーザ向けのエラーメッセ
ージとともに呼び出します。この呼び出しにより、最終的に終了ステータス 2
(伝統的な Unix におけるコマンドラインエラーの終了ステータス) でプロセス
を終了させることになります。


File: python.info,  Node: オプション解析器への問い合わせと操作,  Next: オプション間の衝突,  Prev: 引数を解析する,  Up: リファレンスガイド

5.17.2.26 オプション解析器への問い合わせと操作
..............................................

オプションパーザのデフォルトの振る舞いは、ある程度カスタマイズすることが
できます。また、オプションパーザの中を調べることもできます。*note
OptionParser: 16e6. は幾つかのヘルパーメソッドを提供しています:

 -- メソッド: OptionParser.disable_interspersed_args ()

     Set parsing to stop on the first non-option.  For example, if ‘-a’
     and ‘-b’ are both simple options that take no arguments, ‘optparse’
     normally accepts this syntax:

          prog -a arg1 -b arg2

     それを次と同じように扱います

          prog -a -b arg1 arg2

     この機能を無効にしたいときは、 *note disable_interspersed_args():
     33d3. メソッドを呼び出してください。古典的な Unix システムのように
     、最初のオプションでない引数を見つけたときにオプションの解析を止め
     るようになります。

     別のコマンドを実行するコマンドをプロセッサを作成する際、別のコマン
     ドのオプションと自身のオプションが混ざるのを防ぐために利用すること
     ができます。例えば、各コマンドがそれぞれ異なるオプションのセットを
     持つ場合などに有効です。

 -- メソッド: OptionParser.enable_interspersed_args ()

     オプションで無い最初の引数を見つけてもパースを止めないように設定し
     ます。オプションとコマンド引数の順序が混ざっても良いようになります
     。これはデフォルトの動作です。

 -- メソッド: OptionParser.get_option (opt_str)

     オプション文字列 'opt_str' に対する *note Option: 340c. インスタン
     スを返します。該当するオプションがなければ ‘None’ を返します。

 -- メソッド: OptionParser.has_option (opt_str)

     *note OptionParser: 16e6. に(‘-q’ や ‘--verbose’ のような) オプショ
     ン 'opt_str' がある場合、‘True’ を返します。

 -- メソッド: OptionParser.remove_option (opt_str)

     *note OptionParser: 16e6. に 'opt_str' に対応するオプションがある場
     合、そのオプションを削除します。該当するオプションに他のオプション
     文字列が指定されていた場合、それらのオプション文字列は全て無効にな
     ります。 'opt_str' がこの *note OptionParser: 16e6. オブジェクトの
     どのオプションにも属さない場合、 *note ValueError: 2ec. を送出しま
     す。


File: python.info,  Node: オプション間の衝突,  Next: クリーンアップ,  Prev: オプション解析器への問い合わせと操作,  Up: リファレンスガイド

5.17.2.27 オプション間の衝突
............................

注意が足りないと、衝突するオプションを定義してしまうことがあります:

     parser.add_option("-n", "--dry-run", ...)
     ...
     parser.add_option("-n", "--noisy", ...)

(とりわけ、*note OptionParser: 16e6. から標準的なオプションを備えた自前
のサブクラスを定義してしまった場合にはよく起きます。)

Every time you add an option, ‘optparse’ checks for conflicts with
existing options.  If it finds any, it invokes the current
conflict-handling mechanism.  You can set the conflict-handling
mechanism either in the constructor:

     parser = OptionParser(..., conflict_handler=handler)

個別にも呼び出せます:

     parser.set_conflict_handler(handler)

衝突時の処理をおこなうハンドラ(handler)には、以下のものが利用できます:

     ‘"error"’ (デフォルト)

          オプション間の衝突をプログラム上のエラーとみなし、 *note
          OptionConflictError: 3426. を送出します

     ‘"resolve"’

          オプション間の衝突をインテリジェントに解決します (下記参照)

一例として、衝突をインテリジェントに解決する *note OptionParser: 16e6. を
定義し、衝突を起こすようなオプションを追加してみましょう:

     parser = OptionParser(conflict_handler="resolve")
     parser.add_option("-n", "--dry-run", ..., help="do no harm")
     parser.add_option("-n", "--noisy", ..., help="be noisy")

At this point, ‘optparse’ detects that a previously added option is
already using the ‘-n’ option string.  Since ‘conflict_handler’ is
‘"resolve"’, it resolves the situation by removing ‘-n’ from the earlier
option's list of option strings.  Now ‘--dry-run’ is the only way for
the user to activate that option.  If the user asks for help, the help
message will reflect that:

     Options:
       --dry-run     do no harm
       ...
       -n, --noisy   be noisy

It's possible to whittle away the option strings for a previously added
option until there are none left, and the user has no way of invoking
that option from the command-line.  In that case, ‘optparse’ removes
that option completely, so it doesn't show up in help text or anywhere
else.  Carrying on with our existing OptionParser:

     parser.add_option("--dry-run", ..., help="new dry-run option")

At this point, the original ‘-n’/‘--dry-run’ option is no longer
accessible, so ‘optparse’ removes it, leaving this help text:

     Options:
       ...
       -n, --noisy   be noisy
       --dry-run     new dry-run option


File: python.info,  Node: クリーンアップ,  Next: その他のメソッド,  Prev: オプション間の衝突,  Up: リファレンスガイド

5.17.2.28 クリーンアップ
........................

OptionParser インスタンスはいくつかの循環参照を抱えています。このことは
Python のガーベジコレクタにとって問題になるわけではありませんが、使い終
わった OptionParser に対して ‘destroy()’ を呼び出すことでこの循環参照を
意図的に断ち切るという方法を選ぶこともできます。この方法は特に長時間実行
するアプリケーションで OptionParser から大きなオブジェクトグラフが到達可
能になっているような場合に有用です。


File: python.info,  Node: その他のメソッド,  Prev: クリーンアップ,  Up: リファレンスガイド

5.17.2.29 その他のメソッド
..........................

OptionParser にはその他にも幾つかの公開されたメソッドがあります:

 -- メソッド: OptionParser.set_usage (usage)

     上で説明したコンストラクタの ‘usage’ キーワード引数での規則に従った
     使用法の文字列をセットします。 ‘None’ を渡すとデフォルトの使用法文
     字列が使われるようになり、 ‘optparse.SUPPRESS_USAGE’ によって使用法
     メッセージを抑制できます。

 -- メソッド: OptionParser.print_usage (file=None)

     現在のプログラムの使用法メッセージ (‘self.usage’) を 'file' (デフォ
     ルト: stdout) に表示します。‘self.usage’ 内にある全ての ‘%prog’ と
     いう文字列は現在のプログラム名に置換されます。‘self.usage’ が空もし
     くは未定義の時は何もしません。

 -- メソッド: OptionParser.get_usage ()

     *note print_usage(): 3400. と同じですが、使用法メッセージを表示する
     代わりに文字列として返します。

 -- メソッド: OptionParser.set_defaults (dest=value, ...)

     幾つかの保存先に対してデフォルト値をまとめてセットします。 *note
     set_defaults(): 3415. を使うのは複数のオプションにデフォルト値をセ
     ットする好ましいやり方です。複数のオプションが同じ保存先を共有する
     ことがあり得るからです。たとえば幾つかの "mode" オプションが全て同
     じ保存先をセットするものだったとすると、どのオプションもデフォルト
     をセットすることができ、しかし最後に指定したものだけが有効になりま
     す:

          parser.add_option("--advanced", action="store_const",
                            dest="mode", const="advanced",
                            default="novice")    # overridden below
          parser.add_option("--novice", action="store_const",
                            dest="mode", const="novice",
                            default="advanced")  # overrides above setting

     こうした混乱を避けるために *note set_defaults(): 3415. を使います:

          parser.set_defaults(mode="advanced")
          parser.add_option("--advanced", action="store_const",
                            dest="mode", const="advanced")
          parser.add_option("--novice", action="store_const",
                            dest="mode", const="novice")


File: python.info,  Node: オプション処理コールバック,  Next: Extending optparse,  Prev: リファレンスガイド,  Up: optparse --- Parser for command line options

5.17.2.30 オプション処理コールバック
....................................

When ‘optparse’'s built-in actions and types aren't quite enough for
your needs, you have two choices: extend ‘optparse’ or define a callback
option.  Extending ‘optparse’ is more general, but overkill for a lot of
simple cases.  Quite often a simple callback is all you need.

‘callback’ オプションの定義は二つのステップからなります:

   * ‘"callback"’ アクションを使ってオプション自体を定義する

   * コールバックを書く。コールバックは少なくとも後で説明する 4 つの引数
     をとる関数 (またはメソッド) でなければなりません

* Menu:

* callbackオプションの定義::
* コールバック関数はどのように呼び出されるか::
* コールバック中で例外を送出する::
* コールバックの例 1; ありふれたコールバック: コールバックの例 1 ありふれたコールバック.
* コールバックの例 2; オプションの順番をチェックする: コールバックの例 2 オプションの順番をチェックする.
* コールバックの例 3; オプションの順番をチェックする (汎用的): コールバックの例 3 オプションの順番をチェックする 汎用的.
* コールバックの例 4; 任意の条件をチェックする: コールバックの例 4 任意の条件をチェックする.
* コールバックの例5; 固定引数: コールバックの例5 固定引数.
* コールバックの例6; 可変個の引数: コールバックの例6 可変個の引数.


File: python.info,  Node: callbackオプションの定義,  Next: コールバック関数はどのように呼び出されるか,  Up: オプション処理コールバック

5.17.2.31 callbackオプションの定義
..................................

callback オプションを最も簡単に定義するには、 *note
OptionParser.add_option(): 33d2. メソッドを使います。 *note action:
33e6. の他に指定しなければならない属性は ‘callback’ すなわちコールバック
する関数自体です:

     parser.add_option("-c", action="callback", callback=my_callback)

‘callback’ is a function (or other callable object), so you must have
already defined ‘my_callback()’ when you create this callback option.
In this simple case, ‘optparse’ doesn't even know if ‘-c’ takes any
arguments, which usually means that the option takes no arguments--the
mere presence of ‘-c’ on the command-line is all it needs to know.  In
some circumstances, though, you might want your callback to consume an
arbitrary number of command-line arguments.  This is where writing
callbacks gets tricky; it's covered later in this section.

‘optparse’ always passes four particular arguments to your callback, and
it will only pass additional arguments if you specify them via *note
callback_args: 3419. and *note callback_kwargs: 341a.  Thus, the minimal
callback function signature is:

     def my_callback(option, opt, value, parser):

コールバックの四つの引数については後で説明します。

callback オプションを定義する場合には、他にもいくつかオプション属性を指
定できます:

*note type: 33e7.

     has its usual meaning: as with the ‘"store"’ or ‘"append"’ actions,
     it instructs ‘optparse’ to consume one argument and convert it to
     *note type: 33e7.  Rather than storing the converted value(s)
     anywhere, though, ‘optparse’ passes it to your callback function.

*note nargs: 3416.

     also has its usual meaning: if it is supplied and > 1, ‘optparse’
     will consume *note nargs: 3416. arguments, each of which must be
     convertible to *note type: 33e7.  It then passes a tuple of
     converted values to your callback.

*note callback_args: 3419.

     その他の位置引数からなるタプルで、コールバックに渡されます

*note callback_kwargs: 341a.

     その他のキーワード引数からなる辞書で、コールバックに渡されます


File: python.info,  Node: コールバック関数はどのように呼び出されるか,  Next: コールバック中で例外を送出する,  Prev: callbackオプションの定義,  Up: オプション処理コールバック

5.17.2.32 コールバック関数はどのように呼び出されるか
....................................................

コールバックは全て以下の形式で呼び出されます:

     func(option, opt_str, value, parser, *args, **kwargs)

ここでは:

‘option’

     コールバックを呼び出している *note Option: 340c. のインスタンスです

‘opt_str’

     は、コールバック呼び出しのきっかけとなったコマンドライン上のオプシ
     ョン文字列です。(長い形式のオプションに対する省略形が使われている場
     合、‘opt_str’ は完全な、正式な形のオプション文字列となります -- 例
     えば、ユーザが ‘--foobar’ の短縮形として ‘--foo’ をコマンドラインに
     入力した時には、‘opt_str’ は ‘"--foobar"’ となります。)

‘value’

     is the argument to this option seen on the command-line.
     ‘optparse’ will only expect an argument if *note type: 33e7. is
     set; the type of ‘value’ will be the type implied by the option's
     type.  If *note type: 33e7. for this option is ‘None’ (no argument
     expected), then ‘value’ will be ‘None’.  If *note nargs: 3416. > 1,
     ‘value’ will be a tuple of values of the appropriate type.

‘parser’

     現在のオプション解析の全てを駆動している *note OptionParser: 16e6.
     インスタンスです。この変数が有用なのは、この値を介してインスタンス
     属性としていくつかの興味深いデータにアクセスできるからです:

     ‘parser.largs’

          現在放置されている引数、すなわち、すでに消費されたものの、オプ
          ションでもオプション引数でもない引数からなるリストです。
          ‘parser.largs’ は自由に変更でき、たとえば引数を追加したりでき
          ます (このリストは ‘args’ 、すなわち *note parse_args(): 16e7.
          の二つ目の戻り値になります)

     ‘parser.rargs’

          現在残っている引数、すなわち、‘opt_str’ および ‘value’ があれ
          ば除き、それ以外の引数が残っているリストです。‘parser.rargs’ は
          自由に変更でき、例えばさらに引数を消費したりできます。

     ‘parser.values’

          the object where option values are by default stored (an
          instance of optparse.OptionValues).  This lets callbacks use
          the same mechanism as the rest of ‘optparse’ for storing
          option values; you don't need to mess around with globals or
          closures.  You can also access or modify the value(s) of any
          options already encountered on the command-line.

‘args’

     *note callback_args: 3419. オプション属性で与えられた任意の位置引数
     からなるタプルです。

‘kwargs’

     *note callback_kwargs: 341a. オプション属性で与えられた任意のキーワ
     ード引数からなるタプルです。


File: python.info,  Node: コールバック中で例外を送出する,  Next: コールバックの例 1 ありふれたコールバック,  Prev: コールバック関数はどのように呼び出されるか,  Up: オプション処理コールバック

5.17.2.33 コールバック中で例外を送出する
........................................

The callback function should raise *note OptionValueError: 33d6. if
there are any problems with the option or its argument(s).  ‘optparse’
catches this and terminates the program, printing the error message you
supply to stderr.  Your message should be clear, concise, accurate, and
mention the option at fault.  Otherwise, the user will have a hard time
figuring out what they did wrong.


File: python.info,  Node: コールバックの例 1 ありふれたコールバック,  Next: コールバックの例 2 オプションの順番をチェックする,  Prev: コールバック中で例外を送出する,  Up: オプション処理コールバック

5.17.2.34 コールバックの例 1: ありふれたコールバック
....................................................

引数をとらず、発見したオプションを単に記録するだけのコールバックオプショ
ンの例を以下に示します:

     def record_foo_seen(option, opt_str, value, parser):
         parser.values.saw_foo = True

     parser.add_option("--foo", action="callback", callback=record_foo_seen)

もちろん、‘"store_true"’ アクションを使っても実現できます。


File: python.info,  Node: コールバックの例 2 オプションの順番をチェックする,  Next: コールバックの例 3 オプションの順番をチェックする 汎用的,  Prev: コールバックの例 1 ありふれたコールバック,  Up: オプション処理コールバック

5.17.2.35 コールバックの例 2: オプションの順番をチェックする
............................................................

もう少し面白みのある例を示します: この例では、‘-b’ を発見して、その後で
‘-a’ がコマンドライン中に現れた場合にはエラーになります。

     def check_order(option, opt_str, value, parser):
         if parser.values.b:
             raise OptionValueError("can't use -a after -b")
         parser.values.a = 1
     ...
     parser.add_option("-a", action="callback", callback=check_order)
     parser.add_option("-b", action="store_true", dest="b")


File: python.info,  Node: コールバックの例 3 オプションの順番をチェックする 汎用的,  Next: コールバックの例 4 任意の条件をチェックする,  Prev: コールバックの例 2 オプションの順番をチェックする,  Up: オプション処理コールバック

5.17.2.36 コールバックの例 3: オプションの順番をチェックする (汎用的)
.....................................................................

このコールバック (フラグを立てるが、‘-b’ が既に指定されていればエラーに
なる) を同様の複数のオプションに対して再利用したければ、もう少し作業する
必要があります: エラーメッセージとセットされるフラグを一般化しなければな
りません。

     def check_order(option, opt_str, value, parser):
         if parser.values.b:
             raise OptionValueError("can't use %s after -b" % opt_str)
         setattr(parser.values, option.dest, 1)
     ...
     parser.add_option("-a", action="callback", callback=check_order, dest='a')
     parser.add_option("-b", action="store_true", dest="b")
     parser.add_option("-c", action="callback", callback=check_order, dest='c')


File: python.info,  Node: コールバックの例 4 任意の条件をチェックする,  Next: コールバックの例5 固定引数,  Prev: コールバックの例 3 オプションの順番をチェックする 汎用的,  Up: オプション処理コールバック

5.17.2.37 コールバックの例 4: 任意の条件をチェックする
......................................................

もちろん、単に定義済みのオプションの値を調べるだけにとどまらず、コールバ
ックには任意の条件を入れられます。例えば、満月でなければ呼び出してはなら
ないオプションがあるとしましょう。やらなければならないことはこれだけです
:

     def check_moon(option, opt_str, value, parser):
         if is_moon_full():
             raise OptionValueError("%s option invalid when moon is full"
                                    % opt_str)
         setattr(parser.values, option.dest, 1)
     ...
     parser.add_option("--foo",
                       action="callback", callback=check_moon, dest="foo")

(‘is_moon_full()’ の定義は読者への課題としましょう。)


File: python.info,  Node: コールバックの例5 固定引数,  Next: コールバックの例6 可変個の引数,  Prev: コールバックの例 4 任意の条件をチェックする,  Up: オプション処理コールバック

5.17.2.38 コールバックの例5: 固定引数
.....................................

決まった数の引数をとるようなコールパックオプションを定義するなら、問題は
やや興味深くなってきます。引数をとるようコールバックに指定するのは、
‘"store"’ や ‘"append"’ オプションの定義に似ています。 *note type: 33e7.
を定義していれば、そのオプションは引数を受け取ったときに該当する型に変換
できなければなりません。さらに *note nargs: 3416. を指定すれば、オプショ
ンは *note nargs: 3416. 個の引数を受け取ります。

標準の ‘"store"’ アクションをエミュレートする例を以下に示します:

     def store_value(option, opt_str, value, parser):
         setattr(parser.values, option.dest, value)
     ...
     parser.add_option("--foo",
                       action="callback", callback=store_value,
                       type="int", nargs=3, dest="foo")

Note that ‘optparse’ takes care of consuming 3 arguments and converting
them to integers for you; all you have to do is store them.  (Or
whatever; obviously you don't need a callback for this example.)


File: python.info,  Node: コールバックの例6 可変個の引数,  Prev: コールバックの例5 固定引数,  Up: オプション処理コールバック

5.17.2.39 コールバックの例6: 可変個の引数
.........................................

Things get hairy when you want an option to take a variable number of
arguments.  For this case, you must write a callback, as ‘optparse’
doesn't provide any built-in capabilities for it.  And you have to deal
with certain intricacies of conventional Unix command-line parsing that
‘optparse’ normally handles for you.  In particular, callbacks should
implement the conventional rules for bare ‘--’ and ‘-’ arguments:

   * either ‘--’ or ‘-’ can be option arguments

   * 裸の ‘--’ (何らかのオプションの引数でない場合): コマンドライン処理
     を停止し、‘--’ を無視します

   * 裸の ‘-’ (何らかのオプションの引数でない場合): コマンドライン処理を
     停止しますが、‘-’ は残します (‘parser.largs’ に追加します)

If you want an option that takes a variable number of arguments, there
are several subtle, tricky issues to worry about.  The exact
implementation you choose will be based on which trade-offs you're
willing to make for your application (which is why ‘optparse’ doesn't
support this sort of thing directly).

とはいえ、可変個の引数をもつオプションに対するスタブ (stub、仲介インター
フェース) を以下に示しておきます:

     def vararg_callback(option, opt_str, value, parser):
         assert value is None
         value = []

         def floatable(str):
             try:
                 float(str)
                 return True
             except ValueError:
                 return False

         for arg in parser.rargs:
             # stop on --foo like options
             if arg[:2] == "--" and len(arg) > 2:
                 break
             # stop on -a, but not on -3 or -3.0
             if arg[:1] == "-" and len(arg) > 1 and not floatable(arg):
                 break
             value.append(arg)

         del parser.rargs[:len(value)]
         setattr(parser.values, option.dest, value)

     ...
     parser.add_option("-c", "--callback", dest="vararg_attr",
                       action="callback", callback=vararg_callback)


File: python.info,  Node: Extending optparse,  Next: 例外<12>,  Prev: オプション処理コールバック,  Up: optparse --- Parser for command line options

5.17.2.40 Extending ‘optparse’
..............................

Since the two major controlling factors in how ‘optparse’ interprets
command-line options are the action and type of each option, the most
likely direction of extension is to add new actions and new types.

* Menu:

* 新しい型の追加::
* 新しいアクションの追加::


File: python.info,  Node: 新しい型の追加,  Next: 新しいアクションの追加,  Up: Extending optparse

5.17.2.41 新しい型の追加
........................

To add new types, you need to define your own subclass of ‘optparse’'s
*note Option: 340c. class.  This class has a couple of attributes that
define ‘optparse’'s types: *note TYPES: 3443. and *note TYPE_CHECKER:
3444.

 -- の属性: Option.TYPES

     *note TYPES: 3443. は型名のタプルです。新しく作るサブクラスでは、タ
     プル *note TYPES: 3443. を単純に標準のものを利用して新しく定義する
     と良いでしょう。

 -- の属性: Option.TYPE_CHECKER

     ‘TYPE_CHECKER’ は辞書で型名を型チェック関数に対応付けるものです。型
     チェック関数は以下のようなシグネチャを持ちます:

          def check_mytype(option, opt, value)

     ここで ‘option’ は *note Option: 340c. のインスタンスであり、 ‘opt’
     はオプション文字列(たとえば ‘-f’)で、 ‘value’ は望みの型としてチェ
     ックされ変換されるべくコマンドラインで与えられる文字列です。
     ‘check_mytype()’ は想定されている型 ‘mytype’ のオブジェクトを返さな
     ければなりません。型チェック関数から返される値は *note
     OptionParser.parse_args(): 16e7. で返されるOptionValues インスタン
     スに収められるか、またはコールバックに ‘value’ パラメータとして渡さ
     れます。

     型チェック関数は何か問題に遭遇したら *note OptionValueError: 33d6.
     を送出しなければなりません。 *note OptionValueError: 33d6. は文字列
     一つを引数に取り、それはそのまま *note OptionParser: 16e6. の
     ‘error()’ メソッドに渡され、そこでプログラム名と文字列 ‘"error:"’ が
     前置されてプロセスが終了する前に stderr に出力されます。

Here's a silly example that demonstrates adding a ‘"complex"’ option
type to parse Python-style complex numbers on the command line.  (This
is even sillier than it used to be, because ‘optparse’ 1.3 added
built-in support for complex numbers, but never mind.)

最初に必要な import 文を書きます:

     from copy import copy
     from optparse import Option, OptionValueError

まずは型チェック関数を定義しなければなりません。これは後で(これから定義
する Option のサブクラスの *note TYPE_CHECKER: 3444. クラス属性の中で) 参
照されることになります:

     def check_complex(option, opt, value):
         try:
             return complex(value)
         except ValueError:
             raise OptionValueError(
                 "option %s: invalid complex value: %r" % (opt, value))

最後に Option のサブクラスです:

     class MyOption (Option):
         TYPES = Option.TYPES + ("complex",)
         TYPE_CHECKER = copy(Option.TYPE_CHECKER)
         TYPE_CHECKER["complex"] = check_complex

(If we didn't make a *note copy(): 29. of *note Option.TYPE_CHECKER:
3444, we would end up modifying the *note TYPE_CHECKER: 3444. attribute
of ‘optparse’'s Option class.  This being Python, nothing stops you from
doing that except good manners and common sense.)

That's it!  Now you can write a script that uses the new option type
just like any other ‘optparse’-based script, except you have to instruct
your OptionParser to use MyOption instead of Option:

     parser = OptionParser(option_class=MyOption)
     parser.add_option("-c", type="complex")

別のやり方として、オプションリストを構築して OptionParser に渡すという方
法もあります。 ‘add_option()’ を上でやったように使わないならば、
OptionParser にどのクラスを使うのか教える必要はありません:

     option_list = [MyOption("-c", action="store", type="complex", dest="c")]
     parser = OptionParser(option_list=option_list)


File: python.info,  Node: 新しいアクションの追加,  Prev: 新しい型の追加,  Up: Extending optparse

5.17.2.42 新しいアクションの追加
................................

Adding new actions is a bit trickier, because you have to understand
that ‘optparse’ has a couple of classifications for actions:

"store" アクション

     actions that result in ‘optparse’ storing a value to an attribute
     of the current OptionValues instance; these options require a *note
     dest: 33e8. attribute to be supplied to the Option constructor.

"typed" アクション

     コマンドラインから引数を受け取り、それがある型であることが期待され
     ているアクションです。もう少しはっきり言えば、その型に変換される文
     字列を受け取るものです。この種類のオプションは Option のコンストラ
     クタに *note type: 33e7. 属性を与えることが要求されます。

この分類には重複する部分があります。デフォルトの "store" アクションには
‘"store"’, ‘"store_const"’, ‘"append"’, ‘"count"’ などがありますが、デフ
ォルトの "typed" オプションは ‘"store"’, ‘"append"’, ‘"callback"’ の三つ
です。

アクションを追加する際に、以下の Option のクラス属性(全て文字列のリスト
です) の中の少なくとも一つに付け加えることでそのアクションを分類する必要
があります:

 -- の属性: Option.ACTIONS

     全てのアクションは ACTIONS にリストされていなければなりません。

 -- の属性: Option.STORE_ACTIONS

     "store" アクションはここにもリストされます。

 -- の属性: Option.TYPED_ACTIONS

     "typed" アクションはここにもリストされます。

 -- の属性: Option.ALWAYS_TYPED_ACTIONS

     Actions that always take a type (i.e.  whose options always take a
     value) are additionally listed here.  The only effect of this is
     that ‘optparse’ assigns the default type, ‘"string"’, to options
     with no explicit type whose action is listed in *note
     ALWAYS_TYPED_ACTIONS: 344a.

実際に新しいアクションを実装するには、Option の ‘take_action()’ メソッド
をオーバライドしてそのアクションを認識する場合分けを追加しなければなりま
せん。

例えば、‘"extend"’ アクションというのを追加してみましょう。このアクショ
ンは標準的な ‘"append"’ アクションと似ていますが、コマンドラインから一つ
だけ値を読み取って既存のリストに追加するのではなく、複数の値をコンマ区切
りの文字列として読み取ってそれらで既存のリストを拡張します。すなわち、も
し ‘--names’ が ‘"string"’ 型の ‘"extend"’ オプションだとすると、次のコ
マンドライン

     --names=foo,bar --names blah --names ding,dong

の結果は次のリストになります

     ["foo", "bar", "blah", "ding", "dong"]

再び Option のサブクラスを定義します:

     class MyOption(Option):

         ACTIONS = Option.ACTIONS + ("extend",)
         STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",)
         TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",)
         ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",)

         def take_action(self, action, dest, opt, value, values, parser):
             if action == "extend":
                 lvalue = value.split(",")
                 values.ensure_value(dest, []).extend(lvalue)
             else:
                 Option.take_action(
                     self, action, dest, opt, value, values, parser)

注意すべきは次のようなところです:

   * ‘"extend"’ はコマンドラインの値を予期していると同時にその値をどこか
     に格納しますので、 *note STORE_ACTIONS: 3448. と *note
     TYPED_ACTIONS: 3449. の両方に入ります。

   * to ensure that ‘optparse’ assigns the default type of ‘"string"’ to
     ‘"extend"’ actions, we put the ‘"extend"’ action in *note
     ALWAYS_TYPED_ACTIONS: 344a. as well.

   * ‘MyOption.take_action()’ implements just this one new action, and
     passes control back to ‘Option.take_action()’ for the standard
     ‘optparse’ actions.

   * ‘values’ は optparse_parser.Values クラスのインスタンスであり、非常
     に有用な ‘ensure_value()’ メソッドを提供しています。
     ‘ensure_value()’ は本質的に安全弁付きの *note getattr(): dca. です
     。次のように呼び出します

          values.ensure_value(attr, value)

     ‘values’ に ‘attr’ 属性が無いか ‘None’ だった場合に、
     ‘ensure_value()’ は最初に ‘value’ をセットし、それから ‘value’ を返
     します。この振る舞いは ‘"extend"’, ‘"append"’, ‘"count"’ のように、
     データを変数に集積し、またその変数がある型 (最初の二つはリスト、最
     後のは整数) であると期待されるアクションを作るのにとても使い易いも
     のです。 ‘ensure_value()’ を使えば、作ったアクションを使うスクリプ
     トはオプションに保存先にデフォルト値をセットすることに煩わされずに
     済みます。デフォルトを ‘None’ にしておけば ‘ensure_value()’ がそれ
     が必要になったときに適当な値を返してくれます。


File: python.info,  Node: 例外<12>,  Prev: Extending optparse,  Up: optparse --- Parser for command line options

5.17.2.43 例外
..............

 -- 例外: optparse.OptionError

     Raised if an *note Option: 340c. instance is created with invalid
     or inconsistent arguments.

 -- 例外: optparse.OptionConflictError

     Raised if conflicting options are added to an *note OptionParser:
     16e6.

 -- 例外: optparse.OptionValueError

     Raised if an invalid option value is encountered on the command
     line.

 -- 例外: optparse.BadOptionError

     Raised if an invalid option is passed on the command line.

 -- 例外: optparse.AmbiguousOptionError

     Raised if an ambiguous option is passed on the command line.


File: python.info,  Node: getpass --- 可搬性のあるパスワード入力機構,  Next: fileinput --- 複数の入力ストリームをまたいだ行を反復する,  Prev: optparse --- Parser for command line options,  Up: コマンドラインインターフェースライブラリ

5.17.3 ‘getpass’ -- 可搬性のあるパスワード入力機構
--------------------------------------------------

'ソースコード:' Lib/getpass.py(1)

__________________________________________________________________

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

The ‘getpass’ module provides two functions:

 -- の関数: getpass.getpass (prompt='Password: ', stream=None, *,
          echo_char=None)

     エコーなしでユーザーにパスワードを入力させるプロンプト。ユーザーは
     'prompt' の文字列をプロンプトに使え、デフォルトは ‘'Password: '’ で
     す。 Unixではプロンプトはファイルに似たオブジェクト 'stream' へ、必
     要なら置き換えられたエラーハンドラを使って出力されます。 'stream' の
     デフォルトは、制御端末(‘/dev/tty’)か、それが利用できない場合は
     ‘sys.stderr’ です (この引数は Windowsでは無視されます)。

     The 'echo_char' argument controls how user input is displayed while
     typing.  If 'echo_char' is ‘None’ (default), input remains hidden.
     Otherwise, 'echo_char' must be a single printable ASCII character
     and each typed character is replaced by it.  For example,
     ‘echo_char='*'’ will display asterisks instead of the actual input.

     もしエコーなしで入力が利用できない場合は、 ‘getpass()’ は 'stream'
     に警告メッセージを出力し、 ‘sys.stdin’ から読み込み、 *note
     GetPassWarning: 3451. 警告を発生させます。

          注釈: IDLE から getpass を呼び出した場合、入力はIDLEのウィンド
          ウではなく、IDLE を起動したターミナルから行われます。

          注釈: On Unix systems, when 'echo_char' is set, the terminal
          will be configured to operate in ‘noncanonical mode(2)’.  In
          particular, this means that line editing shortcuts such as
          ‘Ctrl’+‘U’ will not work and may insert unexpected characters
          into the input.

     バージョン 3.14 で変更: Added the 'echo_char' parameter for
     keyboard feedback.

 -- 例外: getpass.GetPassWarning

     *note UserWarning: 2713. のサブクラスで、入力がエコーされてしまった
     場合に発生します。

 -- の関数: getpass.getuser ()

     ユーザーの "ログイン名"を返します。

     この関数は環境変数 ‘LOGNAME’ ‘USER’ ‘LNAME’ ‘USERNAME’ の順序でチェ
     ックして、最初の空ではない文字列が設定された値を返します。もし、な
     にも設定されていない場合は *note pwd: b7. モジュールが提供するシス
     テム上のパスワードデータベースから返します。それ以外の場合は、
     *note OSError: 2c0. が送出されます。

     In general, this function should be preferred over *note
     os.getlogin(): 1822.

     バージョン 3.13 で変更: 以前は *note OSError: 2c0. だけでなく、様々
     な例外が送出されていました。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/getpass.py

   (2) 
https://manpages.debian.org/termios(3)#Canonical_and_noncanonical_mode


File: python.info,  Node: fileinput --- 複数の入力ストリームをまたいだ行を反復する,  Next: curses --- 文字セル表示のターミナル処理,  Prev: getpass --- 可搬性のあるパスワード入力機構,  Up: コマンドラインインターフェースライブラリ

5.17.4 ‘fileinput’ -- 複数の入力ストリームをまたいだ行を反復する
----------------------------------------------------------------

'ソースコード:' Lib/fileinput.py(1)

__________________________________________________________________

このモジュールは標準入力やファイルの並びにまたがるループを素早く書くため
のヘルパークラスと関数を提供しています。単一のファイルを読み書きしたいだ
けなら、 *note open(): 316. を参照してください。

典型的な使い方は以下の通りです:

     import fileinput
     for line in fileinput.input(encoding="utf-8"):
         process(line)

このスクリプトは ‘sys.argv[1:]’ に列挙されている全てのファイルの行に渡っ
て反復処理を行います。もし列挙されているものがなければ、 ‘sys.stdin’ が
デフォルトとして扱われます。 ファイル名として ‘'-'’ が与えられた場合も、
‘sys.stdin’ に置き換えられ、 'mode' と 'openhook' は無視されます。 別の
ファイル名リストを使いたい時には、そのリストを *note input(): a00. の最
初の引数に与えます。 ファイル名が 1 つでも受け付けます。

全てのファイルはデフォルトでテキストモードでオープンされます。しかし、
*note input(): a00. や *note FileInput: 940. をコールする際に 'mode' パ
ラメータを指定すれば、これをオーバーライドすることができます。オープン中
あるいは読み込み中にI/Oエラーが発生した場合には、 *note OSError: 2c0. が
発生します。

バージョン 3.3 で変更: 以前は *note IOError: 125e. が送出されました; そ
れは現在 *note OSError: 2c0. のエイリアスです。

‘sys.stdin’ が2回以上使われた場合は、2回目以降は行を返しません。ただしイ
ンタラクティブに利用している時や明示的にリセット (‘sys.stdin.seek(0)’ を
使う) を行った場合はその限りではありません。

空のファイルは開いた後すぐ閉じられます。空のファイルはファイル名リストの
最後にある場合にしか外部に影響を与えません。

ファイルの各行は、各種改行文字まで含めて返されます。ファイルの最後が改行
文字で終っていない場合には、改行文字で終わらない行が返されます。

You can control how files are opened by providing an opening hook via
the 'openhook' parameter to *note fileinput.input(): a00. or *note
FileInput(): 940.  The hook must be a function that takes two arguments,
'filename' and 'mode', and returns an accordingly opened file-like
object.  If 'encoding' and/or 'errors' are specified, they will be
passed to the hook as additional keyword arguments.  This module
provides a *note hook_compressed(): a01. to support compressed files.

以下の関数がこのモジュールの基本的なインターフェースです:

 -- の関数: fileinput.input (files=None, inplace=False, backup='', *,
          mode='r', openhook=None, encoding=None, errors=None)

     *note FileInput: 940. クラスのインスタンスを作ります。生成されたイ
     ンスタンスは、このモジュールの関数群が利用するグローバルな状態とし
     て利用されます。この関数への引数は *note FileInput: 940. クラスのコ
     ンストラクタへ渡されます。

     *note FileInput: 940. のインスタンスは *note with: 186. 文の中でコ
     ンテキストマネージャーとして使用できます。 次の例では、仮に例外が生
     じたとしても ‘with’ 文から抜けた後で 'input' は閉じられます:

          with fileinput.input(files=('spam.txt', 'eggs.txt'), encoding="utf-8") as f:
              for line in f:
                  process(line)

     バージョン 3.2 で変更: コンテキストマネージャとして使うことができる
     ようになりました。

     バージョン 3.8 で変更: キーワード引数 'mode' と 'openhook' は、キー
     ワード専用引数になりました。

     バージョン 3.10 で変更: The keyword-only parameter 'encoding' and
     'errors' are added.

以下の関数は *note fileinput.input(): a00. 関数によって作られたグローバ
ルな状態を利用します。アクティブな状態が無い場合には、 *note
RuntimeError: 244. が発生します。

 -- の関数: fileinput.filename ()

     現在読み込み中のファイル名を返します。一行目が読み込まれる前は
     ‘None’ を返します。

 -- の関数: fileinput.fileno ()

     現在のファイルの "ファイル記述子" を整数値で返します。ファイルがオ
     ープンされていない場合 (最初の行の前、ファイルとファイルの間) は
     ‘-1’ を返します。

 -- の関数: fileinput.lineno ()

     最後に読み込まれた行の、累積した行番号を返します。1行目が読み込まれ
     る前は ‘0’ を返します。最後のファイルの最終行が読み込まれた後には、
     その行の行番号を返します。

 -- の関数: fileinput.filelineno ()

     現在のファイル中での行番号を返します。1行目が読み込まれる前は ‘0’ を
     返します。最後のファイルの最終行が読み込まれた後には、その行のファ
     イル中での行番号を返します。

 -- の関数: fileinput.isfirstline ()

     最後に読み込まれた行がファイルの1行目なら ‘True’ 、そうでなければ
     ‘False’ を返します。

 -- の関数: fileinput.isstdin ()

     最後に読み込まれた行が ‘sys.stdin’ から読み込まれていれば ‘True’ 、
     そうでなければ ‘False’ を返します。

 -- の関数: fileinput.nextfile ()

     現在のファイルを閉じます。次の繰り返しでは(存在すれば)次のファイル
     の最初の行が読み込まれます。閉じたファイルの読み込まれなかった行は
     、累積の行数にカウントされません。ファイル名は次のファイルの最初の
     行が読み込まれるまで変更されません。最初の行の読み込みが行われるま
     では、この関数は呼び出されても何もしませんので、最初のファイルをス
     キップするために利用することはできません。最後のファイルの最終行が
     読み込まれた後にも、この関数は呼び出されても何もしません。

 -- の関数: fileinput.close ()

     シーケンスを閉じます。

このモジュールのシーケンスの振舞いを実装しているクラスのサブクラスを作る
こともできます:

 -- クラス: fileinput.FileInput (files=None, inplace=False, backup='',
          *, mode='r', openhook=None, encoding=None, errors=None)

     *note FileInput: 940. クラスはモジュールの関数に対応するメソッド
     *note filename(): 3455. 、 *note fileno(): 1647. 、 *note lineno():
     3456. 、 *note filelineno(): 3457. 、 *note isfirstline(): 3458. 、
     *note isstdin(): 3459. 、 *note nextfile(): 345a. および *note
     close(): 345b. を実装しています。*note イテラブル: 12f1. であること
     に加えて、次の入力行を返す *note readline(): 20a6. メソッドがありま
     す。シーケンスはシーケンシャルに読み込むことしかできません。つまり
     ランダムアクセスと *note readline(): 20a6. を混在させることはできま
     せん。

     'mode' を使用すると、 *note open(): 316. に渡すファイルモードを指定
     することができます。これは ‘'r'’ および ‘'rb'’ のうちのいずれかとな
     ります。

     'openhook' を指定する場合は、ふたつの引数 'filename' と 'mode' をと
     る関数でなければなりません。この関数の返り値は、オープンしたファイ
     ルオブジェクトとなります。'inplace' と 'openhook' を同時に使うこと
     はできません。

     You can specify 'encoding' and 'errors' that is passed to *note
     open(): 316. or 'openhook'.

     *note FileInput: 940. のインスタンスは *note with: 186. 文の中でコ
     ンテキストマネージャーとして使用できます。 次の例では、仮に例外が生
     じたとしても ‘with’ 文から抜けた後で 'input' は閉じられます:

          with FileInput(files=('spam.txt', 'eggs.txt')) as input:
              process(input)

     バージョン 3.2 で変更: コンテキストマネージャとして使うことができる
     ようになりました。

     バージョン 3.8 で変更: キーワード引数 'mode' と 'openhook' は、キー
     ワード専用引数になりました。

     バージョン 3.10 で変更: The keyword-only parameter 'encoding' and
     'errors' are added.

     バージョン 3.11 で変更: The ‘'rU'’ and ‘'U'’ modes and the
     ‘__getitem__()’ method have been removed.

'インプレース(in-place)フィルタオプション:' キーワード引数
‘inplace=True’ が *note fileinput.input(): a00. か *note FileInput: 940.
クラスのコンストラクタに渡された場合には、入力ファイルはバックアップファ
イルに移動され、標準出力が入力ファイルに設定されます(バックアップファイ
ルと同じ名前のファイルが既に存在していた場合には、警告無しに置き替えられ
ます)。これによって入力ファイルをその場で書き替えるフィルタを書くことが
できます。キーワード引数 'backup' (通常は ‘backup='.<拡張子>'’ という形
で利用します)が与えられていた場合、バックアップファイルの拡張子として利
用され、バックアップファイルは削除されずに残ります。デフォルトでは、拡張
子は ‘'.bak'’ になっていて、出力先のファイルが閉じられればバックアップフ
ァイルも消されます。インプレースフィルタ機能は、標準入力を読み込んでいる
間は無効にされます。

このモジュールには、次のふたつのオープン時フックが用意されています:

 -- の関数: fileinput.hook_compressed (filename, mode, *, encoding=None,
          errors=None)

     gzip や bzip2 で圧縮された (拡張子が ‘'.gz'’ や ‘'.bz2'’ の) ファイ
     ルを、 *note gzip: 6b. モジュールや *note bz2: 14. モジュールを使っ
     て透過的にオープンします。ファイルの拡張子が ‘'.gz'’ や ‘'.bz2'’ で
     ない場合は、通常通りファイルをオープンします (つまり、 *note
     open(): 316. をコールする際に伸長を行いません)。

     The 'encoding' and 'errors' values are passed to *note
     io.TextIOWrapper: 9be. for compressed files and open for normal
     files.

     使用例: ‘fi =
     fileinput.FileInput(openhook=fileinput.hook_compressed,
     encoding="utf-8")’

     バージョン 3.10 で変更: The keyword-only parameter 'encoding' and
     'errors' are added.

 -- の関数: fileinput.hook_encoded (encoding, errors=None)

     各ファイルを *note open(): 316. でオープンするフックを返します。指
     定した 'encoding' および 'errors' でファイルを読み込みます。

     使用例: ‘fi =
     fileinput.FileInput(openhook=fileinput.hook_encoded("utf-8",
     "surrogateescape"))’

     バージョン 3.6 で変更: オプションの 'errors' 引数が追加されました。

     バージョン 3.10 で非推奨: This function is deprecated since *note
     fileinput.input(): a00. and *note FileInput: 940. now have
     'encoding' and 'errors' parameters.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/fileinput.py


File: python.info,  Node: curses --- 文字セル表示のターミナル処理,  Next: curses textpad --- Text input widget for curses programs,  Prev: fileinput --- 複数の入力ストリームをまたいだ行を反復する,  Up: コマンドラインインターフェースライブラリ

5.17.5 ‘curses’ -- 文字セル表示のターミナル処理
-----------------------------------------------

'ソースコード:' Lib/curses(1)

__________________________________________________________________

The ‘curses’ module provides an interface to the curses library, the
de-facto standard for portable advanced terminal handling.

curses が最も広く用いられているのは Unix 環境ですが、Windows、DOS で利用
できるバージョンもあり、おそらく他のシステムで利用できるバージョンもあり
ます。この拡張モジュールは Linux および BSD 系の Unixで動作するオープン
ソースの curses ライブラリである ncurses の API に合致するように設計され
ています。

*note Availability: 213f.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 225c. と *note
WebAssemblyプラットフォーム: 1b6a. をサポートしません。

This is an *note optional module: 215a.  If it is missing from your copy
of CPython, look for documentation from your distributor (that is,
whoever provided Python to you).  If you are the distributor, see *note
オプションのモジュールの要件: 2158.

*note Availability: 213f.: Unix.

     注釈: Whenever the documentation mentions a 'character' it can be
     specified as an integer, a one-character Unicode string or a
     one-byte byte string.

     Whenever the documentation mentions a 'character string' it can be
     specified as a Unicode string or a byte string.

参考
....

*note curses.ascii: 30. モジュール

     ロケール設定に関わらず ASCII 文字を扱うためのユーティリティ。

*note curses.panel: 31. モジュール

     curses ウィンドウにデプス機能を追加するパネルスタック拡張。

*note curses.textpad: 32. モジュール

     ‘Emacs’ ライクなキーバインディングをサポートする編集可能な curses 用
     テキストウィジェット。

*note Python で Curses プログラミング: 345f.

     Andrew Kuchling および Eric Raymond によって書かれた、curses を
     Python で使うためのチュートリアルです。

* Menu:

* 関数: 関数<6>.
* Window オブジェクト::
* 定数: 定数<6>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/curses


File: python.info,  Node: 関数<6>,  Next: Window オブジェクト,  Up: curses --- 文字セル表示のターミナル処理

5.17.5.1 関数
.............

The module ‘curses’ defines the following exception:

 -- 例外: curses.error

     curses ライブラリ関数がエラーを返した際に送出される例外です。

     注釈: 関数やメソッドにおけるオプションの引数 'x' および 'y' がある
     場合、デフォルト値は常に現在のカーソルになります。オプションの
     'attr' がある場合、デフォルト値は *note A_NORMAL: 3463. です。

The module ‘curses’ defines the following functions:

 -- の関数: curses.assume_default_colors (fg, bg, /)

     Allow use of default values for colors on terminals supporting this
     feature.  Use this to support transparency in your application.

        * Assign terminal default foreground/background colors to color
          number ‘-1’.  So ‘init_pair(x, COLOR_RED, -1)’ will initialize
          pair 'x' as red on default background and ‘init_pair(x, -1,
          COLOR_BLUE)’ will initialize pair 'x' as default foreground on
          blue.

        * Change the definition of the color-pair ‘0’ to ‘(fg, bg)’.

     Added in version 3.14.

 -- の関数: curses.baudrate ()

     端末の出力速度をビット/秒で返します。ソフトウェア端末エミュレータの
     場合、これは固定の高い値を持つことになります。この関数は歴史的な理
     由で入れられています; かつては、この関数は時間遅延を生成するための
     出力ループを書くために用いられたり、行速度に応じてインターフェース
     を切り替えたりするために用いられたりしていました。

 -- の関数: curses.beep ()

     注意を促す短い音を鳴らします。

 -- の関数: curses.can_change_color ()

     端末に表示される色をプログラマが変更できるか否かによって、‘True’ ま
     たは ‘False’ を返します。

 -- の関数: curses.cbreak ()

     cbreak モードに入ります。cbreak モード ("rare" モードと呼ばれること
     もあります) では、通常の tty 行バッファリングはオフにされ、文字を一
     文字一文字読むことができます。ただし、raw モードとは異なり、特殊文
     字 (割り込み:interrupt、終了:quit、一時停止:suspend、およびフロー制
     御) については、tty ドライバおよび呼び出し側のプログラムに対する通
     常の効果をもっています。まず *note raw(): 3468. を呼び出し、次いで
     *note cbreak(): 3467. を呼び出すと、端末を cbreak モードにします。

 -- の関数: curses.color_content (color_number)

     色 'color_number' の赤、緑、および青 (RGB) 要素の強度を返します。
     'color_number' は ‘0’ から ‘COLORS - 1’ の間でなければなりません。
     与えられた色の R、G、B、の値からなる三要素のタプルが返されます。こ
     の値は ‘0’ (その成分はない) から ‘1000’ (その成分の最大強度) の範囲
     をとります。

 -- の関数: curses.color_pair (pair_number)

     Return the attribute value for displaying text in the specified
     color pair.  Only the first 256 color pairs are supported.  This
     attribute value can be combined with *note A_STANDOUT: 346a, *note
     A_REVERSE: 346b, and the other ‘A_*’ attributes.  *note
     pair_number(): 346c. is the counterpart to this function.

 -- の関数: curses.curs_set (visibility)

     カーソルの状態を設定します。'visibility' は ‘0’ 、 ‘1``または ``2’
     に設定され、それぞれ不可視、通常、または非常に可視、を意味します。
     要求された可視属性を端末がサポートしている場合、以前のカーソル状態
     が返されます; そうでなければ例外が送出されます。多くの端末では、"可
     視 (通常)" モードは下線カーソルで、"非常に可視" モードはブロックカ
     ーソルです。

 -- の関数: curses.def_prog_mode ()

     現在の端末属性を、稼動中のプログラムが curses を使う際のモードであ
     る "プログラム" モードとして保存します。(このモードの反対は、プログ
     ラムが curses を使わない "シェル" モードです。) その後 *note
     reset_prog_mode(): 346f. を呼ぶとこのモードを復旧します。

 -- の関数: curses.def_shell_mode ()

     現在の端末属性を、稼動中のプログラムが curses を使っていないときの
     モードである "シェル" モードとして保存します。(このモードの反対は、
     プログラムが curses 機能を利用している "プログラム" モードです。) そ
     の後 *note reset_shell_mode(): 3471. を呼ぶとこのモードを復旧します
     。

 -- の関数: curses.delay_output (ms)

     出力に 'ms' ミリ秒の一時停止を入れます。

 -- の関数: curses.doupdate ()

     物理スクリーンを更新します。curses ライブラリは、現在の物理スクリー
     ンの内容と、次の状態として要求されている仮想スクリーンをそれぞれ表
     す、2 つのデータ構造を保持しています。*note doupdate(): 3473. は更
     新を適用し、物理スクリーンを仮想スクリーンに一致させます。

     仮想スクリーンは *note addstr(): 3474. のような書き込み操作をウィン
     ドウに行った後に *note noutrefresh(): 3475. を呼び出して更新するこ
     とができます。通常の:meth:‘~window.refresh’ 呼び出しは、単に
     ‘noutrefresh()’ を呼んだ後に ‘doupdate`を呼ぶだけです; 複数のウィン
     ドウを更新しなければならない場合、すべてのウィンドウに対して
     :meth:()’!noutrefresh' を呼び出した後、一度だけ ‘doupdate()’ を呼ぶ
     ことで、パフォーマンスを向上させることができ、おそらくスクリーンの
     ちらつきも押さえることができます。

 -- の関数: curses.echo ()

     echo モードに入ります。echo モードでは、各文字入力はスクリーン上に
     入力された通りにエコーバックされます。

 -- の関数: curses.endwin ()

     ライブラリの非初期化を行い、端末を通常の状態に戻します。

 -- の関数: curses.erasechar ()

     ユーザの現在の消去文字 (erase character) を1バイトの bytes オブジェ
     クトで返します。Unix オペレーティングシステムでは、この値は curses
     プログラムが制御している端末の属性であり、curses ライブラリ自体では
     設定されません。

 -- の関数: curses.filter ()

     *note filter(): 3479. ルーチンを使う場合、*note initscr(): 190f. を
     呼ぶ前に呼び出さなくてはなりません。この手順のもたらす効果は以下の
     通りです: まず二つの関数の呼び出しの間は、 ‘LINES’ は ‘1’ に設定さ
     れます; ‘clear’, ‘cup’, ‘cud’, ‘cud1’, ‘cuu1’, ‘cuu’, ‘vpa’ は無効
     化されます; ‘home’ 文字列は ‘cr’ の値に設定されます。これにより、カ
     ーソルは現在の行に制限されるので、スクリーンの更新も同様に制限され
     ます。この関数は、スクリーンの他の部分に影響を及ぼさずに文字単位の
     行編集を行う場合に利用できます。

 -- の関数: curses.flash ()

     スクリーンを点滅します。すなわち、画面を色反転して、短時間でもとに
     もどします。人によっては、*note beep(): 3465. で生成される注意音よ
     りも、このような "目に見えるベル" を好みます。

 -- の関数: curses.flushinp ()

     すべての入力バッファをフラッシュします。この関数は、ユーザによって
     すでに入力されているが、まだプログラムによって処理されていないすべ
     ての先行入力文字を破棄します。

 -- の関数: curses.getmouse ()

     *note getch(): 1825. が *note KEY_MOUSE: 347d. を返してマウスイベン
     トを通知した後、この関数を呼んで待ち行列上に置かれているマウスイベ
     ントを取得しなければなりません。イベントは ‘(id, x, y, z, bstate)’
     の 5 要素のタプルで表現されています。'id' は複数のデバイスを区別す
     るための ID 値で、'x', 'y', 'z' はイベントの座標値です。(現在 'z' は
     使われていません) 'bstate' は整数値で、その各ビットはイベントのタイ
     プを示す値に設定されています。この値は以下に示す定数のうち一つまた
     はそれ以上のビット単位 OR になっています。以下の定数の 'n' は 1 か
     ら 5 のボタン番号を示します: *note BUTTONn_PRESSED: 347e, *note
     BUTTONn_RELEASED: 347f, *note BUTTONn_CLICKED: 3480, *note
     BUTTONn_DOUBLE_CLICKED: 3481, *note BUTTONn_TRIPLE_CLICKED: 3482,
     *note BUTTON_SHIFT: 3483, *note BUTTON_CTRL: 3484, *note
     BUTTON_ALT: 3485.。

     バージョン 3.10 で変更: The ‘BUTTON5_*’ constants are now exposed
     if they are provided by the underlying curses library.

 -- の関数: curses.getsyx ()

     仮想スクリーンにおける現在のカーソル位置をタプル ‘(y, x)’ で返しま
     す。 ‘leaveok()’ が ‘True’ に設定されていれば、 ‘(-1, -1)’ が返され
     ます。

 -- の関数: curses.getwin (file)

     Read window related data stored in the file by an earlier *note
     window.putwin(): 3488. call.  The routine then creates and
     initializes a new window using that data, returning the new window
     object.

 -- の関数: curses.has_colors ()

     端末が色表示を行える場合には ‘True’ を返します。そうでない場合には
     ‘False’ を返します。

 -- の関数: curses.has_extended_color_support ()

     Return ‘True’ if the module supports extended colors; otherwise,
     return ‘False’.  Extended color support allows more than 256 color
     pairs for terminals that support more than 16 colors (e.g.
     xterm-256color).

     Extended color support requires ncurses version 6.1 or later.

     Added in version 3.10.

 -- の関数: curses.has_ic ()

     端末が文字の挿入/削除機能を持つ場合に ‘True’ を返します。最近の端末
     エミュレータはどれもこの機能を持っており、この関数は歴史的な理由の
     ためだけに存在しています。

 -- の関数: curses.has_il ()

     端末が行の挿入/削除機能を持つ場合に ‘True’ を返します。最近の端末エ
     ミュレータはどれもこの機能を持っていて、この関数は歴史的な理由のた
     めだけに存在しています。

 -- の関数: curses.has_key (ch)

     キー値 'ch' をとり、現在の端末タイプがその値のキーを認識できる場合
     に ‘True’ を返します。

 -- の関数: curses.halfdelay (tenths)

     半遅延モード、すなわち cbreak モードに似た、ユーザが打鍵した文字が
     すぐにプログラムで利用できるようになるモードで使われます。しかしな
     がら、何も入力されなかった場合、十分の 'tenths' 秒後に例外が送出さ
     れます。'tenths' の値は ‘1’ から ‘255’ の間でなければなりません。半
     遅延モードから抜けるには *note nocbreak(): 348e. を使います。

 -- の関数: curses.init_color (color_number, r, g, b)

     色の定義を変更します。変更したい色番号と、その後に 3 つ組みの RGB 値
     (赤、緑、青の成分の大きさ) をとります。'color_number' の値は ‘0’ か
     ら ‘COLORS - 1’ の間でなければなりません。'r', 'g', 'b' の値は ‘0’
     から ‘1000’ の間でなければなりません。*note init_color(): 9f3. を使
     うと、スクリーン上でカラーが使用されている部分はすべて新しい設定に
     即時変更されます。この関数はほとんどの端末で何も行いません; *note
     can_change_color(): 3466. が ‘True’ を返す場合にのみ動作します。

 -- の関数: curses.init_pair (pair_number, fg, bg)

     Change the definition of a color-pair.  It takes three arguments:
     the number of the color-pair to be changed, the foreground color
     number, and the background color number.  The value of
     'pair_number' must be between ‘1’ and ‘COLOR_PAIRS - 1’ (the ‘0’
     color pair can only be changed by *note use_default_colors(): 1f7.
     and *note assume_default_colors(): 1f6.).  The value of 'fg' and
     'bg' arguments must be between ‘0’ and ‘COLORS - 1’, or, after
     calling ‘use_default_colors()’ or ‘assume_default_colors()’, ‘-1’.
     If the color-pair was previously initialized, the screen is
     refreshed and all occurrences of that color-pair are changed to the
     new definition.

 -- の関数: curses.initscr ()

     ライブラリを初期化します。スクリーン全体をあらわす *note
     ウィンドウ: 1989. オブジェクトを返します。

          注釈: 端末のオープン時にエラーが発生した場合、curses ライブラ
          リによってインタープリタが終了される場合があります。

 -- の関数: curses.is_term_resized (nlines, ncols)

     *note resize_term(): 1930. によってウィンドウ構造が変更されている場
     合に ‘True’ を、そうでない場合は ‘False’ を返します。

 -- の関数: curses.isendwin ()

     *note endwin(): 3477. がすでに呼び出されている (すなわち、curses ラ
     イブラリが非初期化されてしまっている) 場合に ‘True’ を返します。

 -- の関数: curses.keyname (k)

     bytes オブジェクト 'k' に番号付けされているキーの名前を返します。 印
     字可能な ASCII 文字を生成するキーの名前はそのキーの文字自体になりま
     す。 コントロールキーと組み合わせたキーの名前は、キャレット
     (‘b'^'’)の後に対応する ASCII 文字が続く 2 バイトの bytes オブジェク
     トになります。 Alt キーと組み合わせたキー (128-255) の名前は、先頭
     に ‘b'M-'’ が付き、その後に対応する ASCII 文字が続く bytes オブジェ
     クトになります。

 -- の関数: curses.killchar ()

     Return the user's current line kill character as a one-byte bytes
     object.  Under Unix operating systems this is a property of the
     controlling tty of the curses program, and is not set by the curses
     library itself.

 -- の関数: curses.longname ()

     現在の端末について記述している terminfo の長形式 name フィールドが
     入った bytes オブジェクトを返します。verbose 形式記述の最大長は 128
     文字です。この値は *note initscr(): 190f. 呼び出しの後でのみ定義さ
     れています。

 -- の関数: curses.meta (flag)

     'flag' が ‘True’ の場合、8 ビット文字の入力を許可します。'flag' が
     ‘False’ の場合、7 ビット文字だけを許可します。

 -- の関数: curses.mouseinterval (interval)

     ボタンが押されてから離されるまでの時間をマウスクリック一回として認
     識する最大の時間間隔をミリ秒で設定します。返り値は以前の内部設定値
     になります。デフォルトは 200 ミリ秒 (5 分の 1 秒) です。

 -- の関数: curses.mousemask (mousemask)

     報告すべきマウスイベントを設定し、‘(availmask, oldmask)’ の組からな
     るタプルを返します。'availmask' はどの指定されたマウスイベントのど
     れが報告されるかを示します; どのイベント指定も完全に失敗した場合に
     は ‘0’ が返ります。'oldmask' は与えられたウィンドウの以前のマウスイ
     ベントマスクです。この関数が呼ばれない限り、マウスイベントは何も報
     告されません。

 -- の関数: curses.napms (ms)

     'ms' ミリ秒間スリープします。

 -- の関数: curses.newpad (nlines, ncols)

     与えられた行とカラム数を持つパッド (pad) データ構造を生成し、そのポ
     インタを返します。パッドはウィンドウオブジェクトとして返されます。

     パッドはウィンドウと同じようなものですが、スクリーンのサイズによる
     制限をうけず、スクリーンの特定の部分に関連付けられていなくてもかま
     いません。大きなウィンドウが必要であり、スクリーンにはそのウィンド
     ウの一部しか一度に表示しない場合に使えます。(スクロールや入力エコー
     などによる) パッドに対する再描画は起こりません。パッドに対する
     *note refresh(): 3498. および *note noutrefresh(): 3475. メソッドは
     、パッド中の表示する部分と表示するために利用するスクリーン上の位置
     を指定する 6 つの引数が必要です。これらの引数は 'pminrow'、
     'pmincol'、'sminrow'、'smincol'、'smaxrow'、'smaxcol' です; 'p' で
     始まる引数はパッド中の表示領域の左上位置で、's' で始まる引数はパッ
     ド領域を表示するスクリーン上のクリップ矩形を指定します。

 -- の関数: curses.newwin (nlines, ncols)

 -- の関数: curses.newwin (nlines, ncols, begin_y, begin_x)

     左上の角が ‘(begin_y, begin_x)’ で、高さ/幅が 'nlines' / 'ncols' の
     新規 *note ウィンドウ: 1989. を返します。

     デフォルトでは、ウィンドウは指定された位置からスクリーンの右下まで
     広がります。

 -- の関数: curses.nl ()

     newlime モードに入ります。このモードはリターンキーを入力中の改行と
     して変換し、出力時に改行文字を復帰 (return) と改行 (line-feed) に変
     換します。newline モードは初期化時にはオンになっています。

 -- の関数: curses.nocbreak ()

     cbreak モードを終了します。行バッファリングを行う通常の "cooked" モ
     ードに戻ります。

 -- の関数: curses.noecho ()

     echo モードを終了します。入力のエコーバックはオフにされます。

 -- の関数: curses.nonl ()

     newline モードを終了します。入力時のリターンキーから改行への変換、
     および出力時の改行から復帰/改行への低レベル変換を無効化します (ただ
     し、‘addch('\n')’ の振る舞いは変更せず、仮想スクリーン上では常に復
     帰と改行に等しくなります)。変換をオフにすることで、curses は水平方
     向の動きを少しだけ高速化できることがあります; また、入力中のリター
     ンキーの検出ができるようになります。

 -- の関数: curses.noqiflush ()

     ‘noqiflush()’ ルーチンを使うと、通常行われている ‘INTR’ 、 ‘QUIT’ お
     よび ‘SUSP’ 文字による入力および出力キューのフラッシュが行われなく
     なります。シグナルハンドラが終了した際、割り込みが発生しなかったか
     のように出力を続たい場合、ハンドラ中で ‘noqiflush()’ を呼び出すこと
     ができます。

 -- の関数: curses.noraw ()

     raw モードから離れます。行バッファリングを行う通常の "cooked" モー
     ドに戻ります。

 -- の関数: curses.pair_content (pair_number)

     要求された色ペアの色を含むタプル ‘(fg, bg)’ を返します。
     'pair_number' は ‘0’ から ‘COLOR_PAIRS - 1’ の間でなければなりませ
     ん。

 -- の関数: curses.pair_number (attr)

     'attr' に対する色ペアセットの番号を返します。*note color_pair():
     3469. はこの関数の逆に相当します。

 -- の関数: curses.putp (str)

     ‘tputs(str, 1, putchar)’ と等価です; 現在の端末における、指定された
     terminfo 機能の値を出力します。*note putp(): 349f. の出力は常に標準
     出力に送られるので注意して下さい。

 -- の関数: curses.qiflush ([flag])

     'flag' が ‘False’ なら、*note noqiflush(): 349d. を呼ぶのとと同じ効
     果です。'flag' が ‘True’ か、引数が与えられていない場合、制御文字が
     読み出された最にキューはフラッシュされます。

 -- の関数: curses.raw ()

     raw モードに入ります。raw モードでは、通常の行バッファリングと割り
     込み (interrupt)、終了 (quit)、一時停止 (suspend)、およびフロー制御
     キーはオフになります; 文字は curses 入力関数に一文字づつ渡されます
     。

 -- の関数: curses.reset_prog_mode ()

     端末を "program" モードに復旧し、あらかじめ *note def_prog_mode():
     346e. で保存した内容に戻します。

 -- の関数: curses.reset_shell_mode ()

     端末を "shell" モードに復旧し、あらかじめ *note def_shell_mode():
     3470. で保存した内容に戻します。

 -- の関数: curses.resetty ()

     端末モードの状態を最後に *note savetty(): 34a2. を呼び出した時の状
     態に戻します。

 -- の関数: curses.resize_term (nlines, ncols)

     *note resizeterm(): 192f. で使用されるバックエンド関数で、ウィンド
     ウサイズを変更する時、*note resize_term(): 1930. は拡張された領域を
     埋めます。呼び出したアプリケーションはそれらの領域を適切なデータで
     埋めなくてはなりません。‘resize_term()’ 関数はすべてのウィンドウの
     サイズ変更を試みます。ただし、パッド呼び出しの慣例により、アプリケ
     ーションとの追加のやり取りを行わないサイズ変更は行えません。

 -- の関数: curses.resizeterm (nlines, ncols)

     現在の標準ウィンドウのサイズを指定された寸法に変更し、curses ライブ
     ラリが使用する、その他のウィンドウサイズを記憶しているデータ (特に
     SIGWINCH ハンドラ) を調整します。

 -- の関数: curses.savetty ()

     *note resetty(): 34a1. で使用される、バッファ内の端末モードの現在の
     状態を保存します。

 -- の関数: curses.get_escdelay ()

     Retrieves the value set by *note set_escdelay(): aed.

     Added in version 3.9.

 -- の関数: curses.set_escdelay (ms)

     Sets the number of milliseconds to wait after reading an escape
     character, to distinguish between an individual escape character
     entered on the keyboard from escape sequences sent by cursor and
     function keys.

     Added in version 3.9.

 -- の関数: curses.get_tabsize ()

     Retrieves the value set by *note set_tabsize(): aef.

     Added in version 3.9.

 -- の関数: curses.set_tabsize (size)

     Sets the number of columns used by the curses library when
     converting a tab character to spaces as it adds the tab to a
     window.

     Added in version 3.9.

 -- の関数: curses.setsyx (y, x)

     仮想スクリーンのカーソルを 'y', 'x' に設定します。'y' および 'x' が
     どちらも ‘-1’ の場合、 ‘leaveok()’ が に''True''に設定されます。

 -- の関数: curses.setupterm (term=None, fd=-1)

     端末を初期化します。'term' は端末名となる文字列または ‘None’ です。
     省略または ‘None’ の場合、環境変数 ‘TERM’ の値が使用されます。'fd'
     は送信される初期化シーケンスへのファイル記述子です。指定されないま
     たは ‘-1’ の場合、‘sys.stdout’ のファイル記述子が使用されます。

 -- の関数: curses.start_color ()

     プログラマがカラーを利用したい場合で、かつ他の何らかのカラー操作ル
     ーチンを呼び出す前に呼び出さなくてはなりません。この関数は *note
     initscr(): 190f. を呼んだ直後に呼ぶようにしておくとよいでしょう。

     *note start_color(): 34a5. initializes eight basic colors (black,
     red, green, yellow, blue, magenta, cyan, and white), and two global
     variables in the ‘curses’ module, *note COLORS: 34a6. and *note
     COLOR_PAIRS: 34a7, containing the maximum number of colors and
     color-pairs the terminal can support.  It also restores the colors
     on the terminal to the values they had when the terminal was just
     turned on.

 -- の関数: curses.termattrs ()

     端末がサポートするすべてのビデオ属性を論理和した値を返します。この
     情報は、curses プログラムがスクリーンの見え方を完全に制御する必要が
     ある場合に便利です。

 -- の関数: curses.termname ()

     14 文字以下になるように切り詰められた環境変数 ‘TERM’ の値を bytes オ
     ブジェクトで返します。

 -- の関数: curses.tigetflag (capname)

     terminfo 機能名 'capname' に対応する真偽値の機能値を整数で返します
     。'capname' が真偽値で表せる機能値でない場合 ‘-1’ を返し、機能がキ
     ャンセルされているか、端末記述上に見つからない場合 ‘0’ を返します。

 -- の関数: curses.tigetnum (capname)

     terminfo 機能名 'capname' に対応する数値の機能値を整数で返します。
     'capname' が数値で表せる機能値でない場合 ‘-2’ を返し、機能がキャン
     セルされているか、端末記述上に見つからない場合 ‘-1’ を返します。

 -- の関数: curses.tigetstr (capname)

     Return the value of the string capability corresponding to the
     terminfo capability name 'capname' as a bytes object.  Return
     ‘None’ if 'capname' is not a terminfo "string capability", or is
     canceled or absent from the terminal description.

 -- の関数: curses.tparm (str[, ...])

     'str' を与えられたパラメタを使って bytes オブジェクトにインスタンス
     化します。'str' は terminfo データベースから得られたパラメタを持つ
     文字列でなければなりません。例えば、‘tparm(tigetstr("cup"), 5, 3)’
     は ‘b'\033[6;4H'’ のようになります。厳密には端末の形式によって異な
     る結果となります。

 -- の関数: curses.typeahead (fd)

     先読みチェックに使うためのファイル記述子 'fd' を指定します。'fd' が
     ‘-1’ の場合、先読みチェックは行われません。

     curses ライブラリはスクリーンを更新する間、先読み文字列を定期的に検
     索することで "行はみ出し最適化 (line-breakout optimization)" を行い
     ます。入力が得られ、かつ入力は端末からのものである場合、現在行おう
     としている更新は refresh や doupdate を再度呼び出すまで先送りにしま
     す。この関数は異なるファイル記述子で先読みチェックを行うように指定
     することができます。

 -- の関数: curses.unctrl (ch)

     Return a bytes object which is a printable representation of the
     character 'ch'.  Control characters are represented as a caret
     followed by the character, for example as ‘b'^C'’.  Printing
     characters are left as they are.

 -- の関数: curses.ungetch (ch)

     'ch' をプッシュし、次に *note getch(): 1825. を呼び出した時にその値
     が返るようにします。

          注釈: ‘getch()’ を呼び出すまでは 'ch' は一つしかプッシュできま
          せん。

 -- の関数: curses.update_lines_cols ()

     Update the *note LINES: fec. and *note COLS: fed. module variables.
     Useful for detecting manual screen resize.

     Added in version 3.5.

 -- の関数: curses.unget_wch (ch)

     'ch' をプッシュし、次に *note get_wch(): 12a9. を呼び出した時にその
     値が返るようにします。

          注釈: ‘get_wch()’ を呼び出すまでは 'ch' は一つしかプッシュでき
          ません。

     Added in version 3.3.

 -- の関数: curses.ungetmouse (id, x, y, z, bstate)

     与えられた状態データが関連付けられた *note KEY_MOUSE: 347d. イベン
     トを入力キューにプッシュします。

 -- の関数: curses.use_env (flag)

     この関数を使う場合、*note initscr(): 190f. または newterm を呼ぶ前
     に呼び出さなくてはなりません。'flag' が ‘False’ の場合、環境変数
     ‘LINES’ および ‘COLUMNS’ の値 (デフォルトで使用されます) の値が設定
     されていたり、curses がウィンドウ内で動作して (この場合 ‘LINES’ や
     ‘COLUMNS’ が設定されていないとウィンドウのサイズを使います) いても
     、terminfo データベースに指定された lines および columns の値を使い
     ます。

 -- の関数: curses.use_default_colors ()

     Equivalent to ‘assume_default_colors(-1, -1)’.

 -- の関数: curses.wrapper (func, /, *args, **kwargs)

     curses を初期化し、呼び出し可能なオブジェクト 'func' (その他の
     curses を使用するアプリケーション) を呼び出します。アプリケーション
     が例外を送出した場合、この関数は端末を例外を再送出する前に正常な状
     態に戻し、トレースバックを作成します。その後、呼び出し可能オブジェ
     クト 'func' には、第一引数としてメインウィンドウ 'stdscr' が、続い
     て ‘wrapper()’ に渡されたその他の引数が渡されます。'func' を呼び出
     す前、‘wrapper()’ は cbreak モードをオンに、エコーをオフに、端末キ
     ーパッドを有効にし、端末が色表示をサポートしている場合は色を初期化
     します。終了時 (通常終了、例外による終了のどちらでも)、cooked モー
     ドに戻し、エコーをオンにし、端末キーパッドを無効にします。


File: python.info,  Node: Window オブジェクト,  Next: 定数<6>,  Prev: 関数<6>,  Up: curses --- 文字セル表示のターミナル処理

5.17.5.2 Window オブジェクト
............................

 -- クラス: curses.window

     上記の *note initscr(): 190f. や *note newwin(): 3499. が返すウィン
     ドウは、以下のメソッドと属性を持ちます:

 -- メソッド: window.addch (ch[, attr])

 -- メソッド: window.addch (y, x, ch[, attr])

     ‘(y, x)’ にある文字 'ch' を属性 'attr' で描画します。このときその場
     所に以前描画された文字は上書きされます。デフォルトでは、文字の位置
     および属性はウィンドウオブジェクトにおける現在の設定になります。

          注釈: Writing outside the window, subwindow, or pad raises a
          *note curses.error: 3462.  Attempting to write to the lower
          right corner of a window, subwindow, or pad will cause an
          exception to be raised after the character is printed.

 -- メソッド: window.addnstr (str, n[, attr])

 -- メソッド: window.addnstr (y, x, str, n[, attr])

     文字列 'str' から最大で 'n' 文字を ‘(y, x)’ に属性 'attr' で描画し
     ます。以前ディスプレイにあった内容はすべて上書きされます。

 -- メソッド: window.addstr (str[, attr])

 -- メソッド: window.addstr (y, x, str[, attr])

     ‘(y, x)’ に文字列 'str' を属性 'attr' で描画します。以前ディスプレ
     イにあった内容はすべて上書きされます。

          注釈: 
             * Writing outside the window, subwindow, or pad raises
               *note curses.error: 3462.  Attempting to write to the
               lower right corner of a window, subwindow, or pad will
               cause an exception to be raised after the string is
               printed.

             * A bug in ncurses(1), the backend for this Python module,
               can cause SegFaults when resizing windows.  This is fixed
               in ncurses-6.1-20190511.  If you are stuck with an
               earlier ncurses, you can avoid triggering this if you do
               not call *note addstr(): 3474. with a 'str' that has
               embedded newlines.  Instead, call *note addstr(): 3474.
               separately for each line.

 -- メソッド: window.attroff (attr)

     現在のウィンドウに書き込まれたすべての内容に対し "バックグラウンド"
     に設定された属性 'attr' を除去します。

 -- メソッド: window.attron (attr)

     Add attribute 'attr' to the "background" set applied to all writes
     to the current window.

 -- メソッド: window.attrset (attr)

     "バックグラウンド" の属性セットを 'attr' に設定します。初期値は ‘0’
     (属性なし) です。

 -- メソッド: window.bkgd (ch[, attr])

     ウィンドウ上の背景プロパティを、'attr' を属性とする文字 'ch' に設定
     します。変更はそのウィンドウ中のすべての文字に以下のようにして適用
     されます:

        * ウィンドウ中のすべての文字の属性が新たな背景属性に変更されます
          。

        * 以前の背景文字が出現すると、常に新たな背景文字に変更されます。

 -- メソッド: window.bkgdset (ch[, attr])

     ウィンドウの背景を設定します。ウィンドウの背景は、文字と何らかの属
     性の組み合わせから成り立ちます。背景情報の属性の部分は、ウィンドウ
     上に描画されている空白でないすべての文字と組み合わされ (OR され) ま
     す。空白文字には文字部分と属性部分の両方が組み合わされます。背景は
     文字のプロパティとなり、スクロールや行/文字の挿入/削除操作の際には
     文字と一緒に移動します。

 -- メソッド: window.border ([ls[, rs[, ts[, bs[, tl[, tr[, bl[,
          br]]]]]]]])

     ウィンドウの縁に境界線を描画します。各引数には境界の特定部分を表現
     するために使われる文字を指定します; 詳細は以下のテーブルを参照して
     ください。

          注釈: どの引数も、‘0’ を指定した場合デフォルトの文字が使われる
          ようになります。キーワード引数は使うことが 'できません'。デフ
          ォルトはテーブル内で示しています:

     引数            説明                      デフォルト値
                                               
     ----------------------------------------------------------------------
                                               
     'ls'            左側                      *note ACS_VLINE: 34bc.
                                               
                                               
     'rs'            右側                      *note ACS_VLINE: 34bc.
                                               
                                               
     'ts'            上側                      *note ACS_HLINE: 34bd.
                                               
                                               
     'bs'            下側                      *note ACS_HLINE: 34bd.
                                               
                                               
     'tl'            左上の角                  *note ACS_ULCORNER: 34be.
                                               
                                               
     'tr'            右上の角                  *note ACS_URCORNER: 34bf.
                                               
                                               
     'bl'            左下の角                  *note ACS_LLCORNER: 34c0.
                                               
                                               
     'br'            右下の角                  *note ACS_LRCORNER: 34c1.
                                               

 -- メソッド: window.box ([vertch, horch])

     *note border(): 34bb. と同様ですが、'ls' および 'rs' は共に
     'vertch' で、'ts' および 'bs' は共に 'horch' です。この関数では、角
     に使われるデフォルト文字が常に使用されます。

 -- メソッド: window.chgat (attr)

 -- メソッド: window.chgat (num, attr)

 -- メソッド: window.chgat (y, x, attr)

 -- メソッド: window.chgat (y, x, num, attr)

     Set the attributes of 'num' characters at the current cursor
     position, or at position ‘(y, x)’ if supplied.  If 'num' is not
     given or is ‘-1’, the attribute will be set on all the characters
     to the end of the line.  This function moves cursor to position
     ‘(y, x)’ if supplied.  The changed line will be touched using the
     *note touchline(): 34c4. method so that the contents will be
     redisplayed by the next window refresh.

 -- メソッド: window.clear ()

     *note erase(): 34c6. に似ていますが、次に *note refresh(): 3498. が
     呼び出された際にすべてのウィンドウを再描画するようにします。

 -- メソッド: window.clearok (flag)

     'flag' が ‘True’ ならば、次の *note refresh(): 3498. はウィンドウを
     完全に消去します。

 -- メソッド: window.clrtobot ()

     カーソルの位置からウィンドウの端までを消去します: カーソル以降のす
     べての行が削除されるため、*note clrtoeol(): 34c9. と等価です。

 -- メソッド: window.clrtoeol ()

     カーソル位置から行末までを消去します。

 -- メソッド: window.cursyncup ()

     ウィンドウのすべての親ウィンドウについて、現在のカーソル位置を反映
     するよう更新します。

 -- メソッド: window.delch ([y, x])

     ‘(y, x)’ にある文字を削除します。

 -- メソッド: window.deleteln ()

     カーソルの下にある行を削除します。後続の行はすべて 1 行上に移動しま
     す。

 -- メソッド: window.derwin (begin_y, begin_x)

 -- メソッド: window.derwin (nlines, ncols, begin_y, begin_x)

     "derive window (ウィンドウを派生する)" の短縮形です。*note
     derwin(): 34cd. は *note subwin(): 34ce. と同じですが、'begin_y' お
     よび 'begin_x' はスクリーン全体の原点ではなく、ウィンドウの原点から
     の相対位置です。派生したウィンドウオブジェクトが返されます。

 -- メソッド: window.echochar (ch[, attr])

     文字 'ch' に属性 'attr' を付与し、即座に *note refresh(): 3498. を
     ウィンドウに対して呼び出します。

 -- メソッド: window.enclose (y, x)

     与えられた文字セル座標をスクリーン原点から相対的なものとし、ウィン
     ドウの中に含まれるかを調べて、‘True’ または ‘False’ を返します。ス
     クリーン上のウィンドウの一部がマウスイベントの発生場所を含むかどう
     かを調べる上で便利です。

     バージョン 3.10 で変更: Previously it returned ‘1’ or ‘0’ instead
     of ‘True’ or ‘False’.

 -- の属性: window.encoding

     encode メソッドの引数 (Unicode 文字列および文字) で使用されるエンコ
     ーディングです。例えば *note window.subwin(): 34ce. などでサブウィ
     ンドウを生成した時、エンコーディング属性は親ウィンドウから継承しま
     す。デフォルトでは、現在のロケールのエンコーディングが使用されます
     (*note locale.getencoding(): 329. 参照)。

     Added in version 3.3.

 -- メソッド: window.erase ()

     ウィンドウをクリアします。

 -- メソッド: window.getbegyx ()

     Return a tuple ‘(y, x)’ of coordinates of upper-left corner.

 -- メソッド: window.getbkgd ()

     与えられたウィンドウの現在の背景文字と属性のペアを返します。

 -- メソッド: window.getch ([y, x])

     文字を 1 個取得します。返される整数は ASCII の範囲の値となる 'とは
     限らない' ので注意してください。ファンクションキー、キーパッドのキ
     ー等は 256 よりも大きな数字で表されます。無遅延 (no-delay) モードで
     は、入力がない場合 -1 を返し、そうでなければキーが押されるまで待ち
     ます。

 -- メソッド: window.get_wch ([y, x])

     ワイド文字を 1 個取得します。ほとんどのキー、ファンクションキーの数
     値、キーパッドのキー、およびその他の特殊キーの文字を返します。無遅
     延モードでは、入力がない場合例外を送出します。

     Added in version 3.3.

 -- メソッド: window.getkey ([y, x])

     文字を 1 個取得し、 *note getch(): 1825. が返すような整数ではなく文
     字列を返します。ファンクションキー、キーパッドのキー、およびその他
     特殊キーはキー名を含む複数文字を返します。無遅延モードでは、入力が
     ない場合例外を送出します。

 -- メソッド: window.getmaxyx ()

     ウィンドウの高さおよび幅を表すタプル ‘(y, x)’ を返します。

 -- メソッド: window.getparyx ()

     親ウィンドウ中におけるウィンドウの開始位置をタプル ‘(y, x)’ で返し
     ます。ウィンドウに親ウィンドウがない場合 ‘(-1, -1)’ を返します。

 -- メソッド: window.getstr ()

 -- メソッド: window.getstr (n)

 -- メソッド: window.getstr (y, x)

 -- メソッド: window.getstr (y, x, n)

     Read a bytes object from the user, with primitive line editing
     capacity.  The maximum value for 'n' is 2047.

     バージョン 3.14 で変更: The maximum value for 'n' was increased
     from 1023 to 2047.

 -- メソッド: window.getyx ()

     ウィンドウの左上角からの相対で表した現在のカーソル位置をタプル ‘(y,
     x)’ で返します。

 -- メソッド: window.hline (ch, n)

 -- メソッド: window.hline (y, x, ch, n)

     ‘(y, x)’ から始まり、'n' の長さを持つ、文字 'ch' で作られる水平線を
     表示します。

 -- メソッド: window.idcok (flag)

     'flag' が ‘False’ の場合、curses は端末のハードウェアによる文字挿入
     /削除機能を使おうとしなくなります; 'flag' が ‘True’ ならば、文字挿
     入/削除は有効にされます。curses が最初に初期化された際には文字挿入
     /削除はデフォルトで有効になっています。

 -- メソッド: window.idlok (flag)

     If 'flag' is ‘True’, ‘curses’ will try and use hardware line
     editing facilities.  Otherwise, line insertion/deletion are
     disabled.

 -- メソッド: window.immedok (flag)

     'flag' が ‘True’ ならば、ウィンドウイメージ内における何らかの変更が
     あるとウィンドウを更新するようになります; すなわち、*note
     refresh(): 3498. を自分で呼ばなくても良くなります。とはいえ、
     wrefresh を繰り返し呼び出すことになるため、この操作はかなりパフォー
     マンスを低下させます。デフォルトでは無効になっています。

 -- メソッド: window.inch ([y, x])

     ウィンドウの指定の位置の文字を返します。下位 8 ビットが本来の文字で
     、それより上のビットは属性です。

 -- メソッド: window.insch (ch[, attr])

 -- メソッド: window.insch (y, x, ch[, attr])

     ‘(y, x)’ に文字 'ch' を属性 'attr' で描画し、行の 'x' からの内容を
     1 文字分右にずらします。

 -- メソッド: window.insdelln (nlines)

     'nlines' 行を指定されたウィンドウの現在の行の上に挿入します。その下
     にある 'nlines' 行は失われます。負の 'nlines' を指定すると、カーソ
     ルのある行以降の 'nlines' を削除し、削除された行の後ろに続く内容が
     上に来ます。その下にある 'nlines' は消去されます。現在のカーソル位
     置はそのままです。

 -- メソッド: window.insertln ()

     カーソルの下に空行を 1 行入れます。それ以降の行は 1 行づつ下に移動
     します。

 -- メソッド: window.insnstr (str, n[, attr])

 -- メソッド: window.insnstr (y, x, str, n[, attr])

     文字列をカーソルの下にある文字の前に (一行に収まるだけ) 最大 'n' 文
     字挿入します。'n' がゼロまたは負の値の場合、文字列全体が挿入されま
     す。カーソルの右にあるすべての文字は右に移動し、行の左端にある文字
     は失われます。カーソル位置は ('y', 'x' が指定されていた場合はそこに
     移動しますが、その後は) 変化しません。

 -- メソッド: window.insstr (str[, attr])

 -- メソッド: window.insstr (y, x, str[, attr])

     キャラクタ文字列を (行に収まるだけ) カーソルより前に挿入します。カ
     ーソルの右側にある文字はすべて右にシフトし、行の右端の文字は失われ
     ます。カーソル位置は ('y', 'x' が指定されていた場合はそこに移動しま
     すが、その後は) 変化しません。

 -- メソッド: window.instr ([n])

 -- メソッド: window.instr (y, x[, n])

     Return a bytes object of characters, extracted from the window
     starting at the current cursor position, or at 'y', 'x' if
     specified.  Attributes are stripped from the characters.  If 'n' is
     specified, *note instr(): 183d. returns a string at most 'n'
     characters long (exclusive of the trailing NUL). The maximum value
     for 'n' is 2047.

     バージョン 3.14 で変更: The maximum value for 'n' was increased
     from 1023 to 2047.

 -- メソッド: window.is_linetouched (line)

     指定した行が、最後に *note refresh(): 3498. を呼んだ時から変更され
     ている場合に ‘True’ を返します; そうでない場合には ‘False’ を返しま
     す。'line' が現在のウィンドウ上の有効な行でない場合、*note
     curses.error: 3462. 例外を送出します。

 -- メソッド: window.is_wintouched ()

     指定したウィンドウが、最後に *note refresh(): 3498. を呼んだ時から
     変更されている場合に ‘True’ を返します; そうでない場合には ‘False’
     を返します。

 -- メソッド: window.keypad (flag)

     If 'flag' is ‘True’, escape sequences generated by some keys
     (keypad, function keys) will be interpreted by ‘curses’.  If 'flag'
     is ‘False’, escape sequences will be left as is in the input
     stream.

 -- メソッド: window.leaveok (flag)

     'flag' が ‘True’ の場合、カーソルは "カーソル位置" に移動せず現在の
     場所にとどめます。これにより、カーソルの移動を減らせる可能性があり
     ます。この場合、カーソルは不可視にされます。

     'flag' が ‘False’ の場合、カーソルは更新の際に常に "カーソル位置" に
     移動します。

 -- メソッド: window.move (new_y, new_x)

     カーソルを ‘(new_y, new_x)’ に移動します。

 -- メソッド: window.mvderwin (y, x)

     ウィンドウを親ウィンドウの中で移動します。ウィンドウのスクリーン相
     対となるパラメタ群は変化しません。このルーチンは親ウィンドウの一部
     をスクリーン上の同じ物理位置に表示する際に用いられます。

 -- メソッド: window.mvwin (new_y, new_x)

     ウィンドウの左上角が ‘(new_y, new_x)’ になるように移動します。

 -- メソッド: window.nodelay (flag)

     'flag' が ‘True’ の場合、*note getch(): 1825. は非ブロックで動作し
     ます。

 -- メソッド: window.notimeout (flag)

     'flag' が ‘True’ の場合、エスケープシーケンスはタイムアウトしなくな
     ります。

     'flag' が ‘False’ の場合、数ミリ秒間の間エスケープシーケンスは解釈
     されず、入力ストリーム中にそのままの状態で残されます。

 -- メソッド: window.noutrefresh ()

     更新をマークはしますが待機します。この関数はウィンドウのデータ構造
     を表現したい内容を反映するように更新しますが、物理スクリーン上に反
     映させるための強制更新を行いません。更新を行うためには *note
     doupdate(): 3473. を呼び出します。

 -- メソッド: window.overlay (destwin[, sminrow, smincol, dminrow,
          dmincol, dmaxrow, dmaxcol])

     ウィンドウを 'destwin' の上に重ね書き (overlay) します。ウィンドウ
     は同じサイズである必要はなく、重なっている領域だけが複写されます。
     この複写は非破壊的です。これは現在の背景文字が 'destwin' の内容を上
     書きしないことを意味します。

     複写領域をきめ細かく制御するために、*note overlay(): 34e9. の第二形
     式を使うことができます。'sminrow' および 'smincol' は元のウィンドウ
     の左上の座標で、他の変数は 'destwin' 内の矩形を表します。

 -- メソッド: window.overwrite (destwin[, sminrow, smincol, dminrow,
          dmincol, dmaxrow, dmaxcol])

     'destwin' の上にウィンドウの内容を上書き (overwrite) します。ウィン
     ドウは同じサイズである必要はなく、重なっている領域だけが複写されま
     す。この複写は破壊的です。これは現在の背景文字が 'destwin' の内容を
     上書きすることを意味します。

     複写領域をきめ細かく制御するために、*note overwrite(): 34ea. の第二
     形式を使うことができます。'sminrow' および 'smincol' は元のウィンド
     ウの左上の座標で、他の変数は 'destwin' 内の矩形を表します。

 -- メソッド: window.putwin (file)

     ウィンドウに関連付けられているすべてのデータを与えられたファイルオ
     ブジェクトに書き込みます。この情報は後に *note getwin(): 3487. 関数
     を使って取得することができます。

 -- メソッド: window.redrawln (beg, num)

     'beg' 行から始まる 'num' スクリーン行の表示内容が壊れており、次の
     *note refresh(): 3498. 呼び出しで完全に再描画されなければならないこ
     とを通知します。

 -- メソッド: window.redrawwin ()

     ウィンドウ全体を更新 (touch) し、次の *note refresh(): 3498. 呼び出
     しで完全に再描画されるようにします。

 -- メソッド: window.refresh ([pminrow, pmincol, sminrow, smincol,
          smaxrow, smaxcol])

     ディスプレイを即時更新し (実際のウィンドウとこれまでの描画/削除メソ
     ッドの内容とを同期し) ます。

     6 つのオプション引数はウィンドウが *note newpad(): 3497. で生成され
     た場合にのみ指定することができます。追加の引数はパッドやスクリーン
     のどの部分が含まれるのかを示すために必要です。'pminrow' および
     'pmincol' にはパッドが表示されている矩形の左上角を指定します。
     'sminrow', 'smincol', 'smaxrow', および 'smaxcol' には、スクリーン
     上に表示される矩形の縁を指定します。パッド内に表示される矩形の右下
     角はスクリーン座標から計算されるので、矩形は同じサイズでなければな
     りません。矩形は両方とも、それぞれのウィンドウ構造内に完全に含まれ
     ていなければなりません。'pminrow', 'pmincol', 'sminrow', または
     'smincol' に負の値を指定すると、ゼロを指定したものとして扱われます
     。

 -- メソッド: window.resize (nlines, ncols)

     curses ウィンドウの記憶域を、指定値のサイズに調整するため再割当てし
     ます。サイズが現在の値より大きい場合、ウィンドウのデータは現在の背
     景設定 (*note bkgdset(): 34ba. で設定) で埋められマージされます。

 -- メソッド: window.scroll ([lines=1])

     スクリーンまたはスクロール領域を上に 'lines' 行スクロールします。

 -- メソッド: window.scrollok (flag)

     ウィンドウのカーソルが、最下行で改行を行ったり最後の文字を入力した
     りした結果、ウィンドウやスクロール領域の縁からはみ出して移動した際
     の動作を制御します。'flag' が ‘False’ の場合、カーソルは最下行にそ
     のままにしておかれます。'flag' が ‘True’ の場合、ウィンドウは 1 行
     上にスクロールします。端末の物理スクロール効果を得るためには *note
     idlok(): 34d8. も呼び出す必要があるので注意してください。

 -- メソッド: window.setscrreg (top, bottom)

     スクロール領域を 'top' から 'bottom' に設定します。スクロール動作は
     すべてこの領域で行われます。

 -- メソッド: window.standend ()

     'A_STANDOUT' 属性をオフにします。端末によっては、この操作ですべての
     属性をオフにする副作用が発生します。

 -- メソッド: window.standout ()

     'A_STANDOUT' 属性をオンにします。

 -- メソッド: window.subpad (begin_y, begin_x)

 -- メソッド: window.subpad (nlines, ncols, begin_y, begin_x)

     左上の角が ‘(begin_y, begin_x)’ にあり、幅/高さがそれぞれ 'ncols' /
     'nlines' であるようなサブウィンドウを返します。

 -- メソッド: window.subwin (begin_y, begin_x)

 -- メソッド: window.subwin (nlines, ncols, begin_y, begin_x)

     左上の角が ‘(begin_y, begin_x)’ にあり、幅/高さがそれぞれ 'ncols' /
     'nlines' であるようなサブウィンドウを返します。

     デフォルトでは、サブウィンドウは指定された場所からウィンドウの右下
     角まで広がります。

 -- メソッド: window.syncdown ()

     このウィンドウの上位のウィンドウのいずれかで更新(touch)された各場所
     をこのウィンドウ内でも更新します。このルーチンは *note refresh():
     3498. から呼び出されるので、手動で呼び出す必要はほとんどないはずで
     す。

 -- メソッド: window.syncok (flag)

     'flag' が ‘True’ の場合、ウィンドウが変更された際は常に *note
     syncup(): 34f6. を自動的に呼ぶようになります。

 -- メソッド: window.syncup ()

     ウィンドウ内で更新 (touch) した場所を、上位のすべてのウィンドウ内で
     も更新します。

 -- メソッド: window.timeout (delay)

     ウィンドウのブロックまたは非ブロック読み込み動作を設定します。
     'delay' が負の場合、ブロック読み出しが使われ、入力を無期限で待ち受
     けます。'delay' がゼロの場合、非ブロック読み出しが使われ、入力待ち
     の文字がない場合 *note getch(): 1825. は ‘-1’ を返します。'delay' が
     正の値であれば、*note getch(): 1825. は 'delay' ミリ秒間ブロックし
     、ブロック後の時点で入力がない場合には ‘-1’ を返します。

 -- メソッド: window.touchline (start, count[, changed])

     'start' から始まる 'count' 行が変更されたかのように振舞わせます。も
     し 'changed' が与えられた場合、その引数は指定された行が変更された
     ('changed'‘=True’)か、変更されていないか('changed')を指定します。

 -- メソッド: window.touchwin ()

     描画を最適化するために、すべてのウィンドウが変更されたかのように振
     舞わせます。

 -- メソッド: window.untouchwin ()

     ウィンドウ内のすべての行を、最後に *note refresh(): 3498. を呼んだ
     際から変更されていないものとしてマークします。

 -- メソッド: window.vline (ch, n[, attr])

 -- メソッド: window.vline (y, x, ch, n[, attr])

     Display a vertical line starting at ‘(y, x)’ with length 'n'
     consisting of the character 'ch' with attributes 'attr'.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue35924


File: python.info,  Node: 定数<6>,  Prev: Window オブジェクト,  Up: curses --- 文字セル表示のターミナル処理

5.17.5.3 定数
.............

The ‘curses’ module defines the following data members:

 -- データ: curses.ERR

     *note getch(): 1825. のような整数を返す curses ルーチンのいくつかは
     、失敗した際に *note ERR: 34fb. を返します。

 -- データ: curses.OK

     *note napms(): 190e. のような整数を返す curses ルーチンのいくつかは
     、成功した際に *note OK: 34fc. を返します。

 -- データ: curses.version

     A bytes object representing the current version of the module.

 -- データ: curses.ncurses_version

     A named tuple containing the three components of the ncurses
     library version: 'major', 'minor', and 'patch'.  All values are
     integers.  The components can also be accessed by name, so
     ‘curses.ncurses_version[0]’ is equivalent to
     ‘curses.ncurses_version.major’ and so on.

     Availability: if the ncurses library is used.

     Added in version 3.8.

 -- データ: curses.COLORS

     The maximum number of colors the terminal can support.  It is
     defined only after the call to *note start_color(): 34a5.

 -- データ: curses.COLOR_PAIRS

     The maximum number of color pairs the terminal can support.  It is
     defined only after the call to *note start_color(): 34a5.

 -- データ: curses.COLS

     The width of the screen, i.e., the number of columns.  It is
     defined only after the call to *note initscr(): 190f.  Updated by
     *note update_lines_cols(): feb, *note resizeterm(): 192f. and *note
     resize_term(): 1930.

 -- データ: curses.LINES

     The height of the screen, i.e., the number of lines.  It is defined
     only after the call to *note initscr(): 190f.  Updated by *note
     update_lines_cols(): feb, *note resizeterm(): 192f. and *note
     resize_term(): 1930.

Some constants are available to specify character cell attributes.  The
exact constants available are system dependent.

属性                         意味
                             
-----------------------------------------------------------------
                             
 -- データ:                  代替文字セットモード
          curses.A_ALTCHARSET

 -- データ: curses.A_BLINK   点滅モード
                             
                             
 -- データ: curses.A_BOLD    太字モード
                             
                             
 -- データ: curses.A_DIM     低輝度モード
                             
                             
 -- データ: curses.A_INVIS   Invisible or blank mode
                             
                             
 -- データ:                  イタリックモード
          curses.A_ITALIC    

 -- データ:                  通常の属性
          curses.A_NORMAL    

 -- データ:                  Protected mode
          curses.A_PROTECT   

 -- データ:                  Reverse background and foreground
          curses.A_REVERSE   colors
                             
                             
 -- データ:                  強調モード
          curses.A_STANDOUT  

 -- データ:                  下線モード
          curses.A_UNDERLINE 

 -- データ:                  Horizontal highlight
          curses.A_HORIZONTAL

 -- データ: curses.A_LEFT    Left highlight
                             
                             
 -- データ: curses.A_LOW     Low highlight
                             
                             
 -- データ: curses.A_RIGHT   Right highlight
                             
                             
 -- データ: curses.A_TOP     Top highlight
                             
                             
 -- データ:                  Vertical highlight
          curses.A_VERTICAL  

Added in version 3.7: ‘A_ITALIC’ が追加されました。

Several constants are available to extract corresponding attributes
returned by some methods.

Bit-mask                      意味
                              
------------------------------------------------------------------
                              
 -- データ:                   Bit-mask to extract attributes
          curses.A_ATTRIBUTES 

 -- データ:                   Bit-mask to extract a character
          curses.A_CHARTEXT   

 -- データ: curses.A_COLOR    Bit-mask to extract color-pair
                              field information
                              

キーは ‘KEY_’ で始まる名前をもつ整数定数です。利用可能なキーキャップはシ
ステムに依存します。

キー定数                      キー
                              
-------------------------------------------------------------------------------
                              
 -- データ: curses.KEY_MIN    最小のキー値
                              
                              
 -- データ:                   ブレークキー (Break, 信頼できません)
          curses.KEY_BREAK    

 -- データ: curses.KEY_DOWN   下矢印
                              
                              
 -- データ: curses.KEY_UP     上矢印
                              
                              
 -- データ: curses.KEY_LEFT   左矢印
                              
                              
 -- データ:                   右矢印
          curses.KEY_RIGHT    

 -- データ: curses.KEY_HOME   ホームキー (Home, または上左矢印)
                              
                              
 -- データ:                   バックスペース (Backspace, 信頼できません)
          curses.KEY_BACKSPACE

 -- データ: curses.KEY_F0     ファンクションキー。64 個までサポートされてい
                              ます。
                              
                              
 -- データ: curses.KEY_Fn     ファンクションキー 'n' の値
                              
                              
 -- データ: curses.KEY_DL     行削除 (Delete line)
                              
                              
 -- データ: curses.KEY_IL     行挿入 (Insert line)
                              
                              
 -- データ: curses.KEY_DC     文字削除 (Delete char)
                              
                              
 -- データ: curses.KEY_IC     文字挿入、または文字挿入モードへ入る
                              
                              
 -- データ: curses.KEY_EIC    文字挿入モードから抜ける
                              
                              
 -- データ:                   画面消去
          curses.KEY_CLEAR    

 -- データ: curses.KEY_EOS    画面の末端まで消去
                              
                              
 -- データ: curses.KEY_EOL    行末端まで消去
                              
                              
 -- データ: curses.KEY_SF     前に 1 行スクロール
                              
                              
 -- データ: curses.KEY_SR     後ろ (逆方向) に 1 行スクロール
                              
                              
 -- データ:                   次のページ (Page Next)
          curses.KEY_NPAGE    

 -- データ:                   前のページ (Page Prev)
          curses.KEY_PPAGE    

 -- データ: curses.KEY_STAB   タブ設定
                              
                              
 -- データ: curses.KEY_CTAB   タブリセット
                              
                              
 -- データ:                   すべてのタブをリセット
          curses.KEY_CATAB    

 -- データ:                   入力または送信 (信頼できません)
          curses.KEY_ENTER    

 -- データ:                   ソフトウェア (部分的) リセット (信頼できません
          curses.KEY_SRESET   )
                              
                              
 -- データ:                   リセットまたはハードリセット (信頼できません)
          curses.KEY_RESET    

 -- データ:                   印刷 (Print)
          curses.KEY_PRINT    

 -- データ: curses.KEY_LL     下ホーム (Home down) または最下行 (左下)
                              
                              
 -- データ: curses.KEY_A1     キーパッドの左上キー
                              
                              
 -- データ: curses.KEY_A3     キーパッドの右上キー
                              
                              
 -- データ: curses.KEY_B2     キーパッドの中央キー
                              
                              
 -- データ: curses.KEY_C1     キーパッドの左下キー
                              
                              
 -- データ: curses.KEY_C3     キーパッドの右下キー
                              
                              
 -- データ: curses.KEY_BTAB   Back tab
                              
                              
 -- データ: curses.KEY_BEG    開始 (Beg)
                              
                              
 -- データ:                   キャンセル (Cancel)
          curses.KEY_CANCEL   

 -- データ:                   Close [閉じる]
          curses.KEY_CLOSE    

 -- データ:                   コマンド (Cmd)
          curses.KEY_COMMAND  

 -- データ: curses.KEY_COPY   Copy [コピー]
                              
                              
 -- データ:                   生成 (Create)
          curses.KEY_CREATE   

 -- データ: curses.KEY_END    終了 (End)
                              
                              
 -- データ: curses.KEY_EXIT   Exit [終了]
                              
                              
 -- データ: curses.KEY_FIND   検索 (Find)
                              
                              
 -- データ: curses.KEY_HELP   ヘルプ (Help)
                              
                              
 -- データ: curses.KEY_MARK   マーク (Mark)
                              
                              
 -- データ:                   メッセージ (Message)
          curses.KEY_MESSAGE  

 -- データ: curses.KEY_MOVE   移動 (Move)
                              
                              
 -- データ: curses.KEY_NEXT   次へ (Next)
                              
                              
 -- データ: curses.KEY_OPEN   開く (Open)
                              
                              
 -- データ:                   オプション
          curses.KEY_OPTIONS  

 -- データ:                   前へ (Prev)
          curses.KEY_PREVIOUS 

 -- データ: curses.KEY_REDO   Redo [やり直し]
                              
                              
 -- データ:                   参照 (Ref)
          curses.KEY_REFERENCE

 -- データ:                   更新 (Refresh)
          curses.KEY_REFRESH  

 -- データ:                   置換 (Replace)
          curses.KEY_REPLACE  

 -- データ:                   再起動 (Restart)
          curses.KEY_RESTART  

 -- データ:                   再開 (Resume)
          curses.KEY_RESUME   

 -- データ: curses.KEY_SAVE   Save [保存]
                              
                              
 -- データ: curses.KEY_SBEG   シフト付き Beg
                              
                              
 -- データ:                   シフト付き Cancel
          curses.KEY_SCANCEL  

 -- データ:                   シフト付き Command
          curses.KEY_SCOMMAND 

 -- データ:                   シフト付き Copy
          curses.KEY_SCOPY    

 -- データ:                   シフト付き Create
          curses.KEY_SCREATE  

 -- データ: curses.KEY_SDC    シフト付き Delete char
                              
                              
 -- データ: curses.KEY_SDL    シフト付き Delete line
                              
                              
 -- データ:                   選択 (Select)
          curses.KEY_SELECT   

 -- データ: curses.KEY_SEND   シフト付き End
                              
                              
 -- データ: curses.KEY_SEOL   シフト付き Clear line
                              
                              
 -- データ:                   シフト付き Exit
          curses.KEY_SEXIT    

 -- データ:                   シフト付き Find
          curses.KEY_SFIND    

 -- データ:                   シフト付き Help
          curses.KEY_SHELP    

 -- データ:                   シフト付き Home
          curses.KEY_SHOME    

 -- データ: curses.KEY_SIC    シフト付き Input
                              
                              
 -- データ:                   シフト付き Left arrow
          curses.KEY_SLEFT    

 -- データ:                   シフト付き Message
          curses.KEY_SMESSAGE 

 -- データ:                   シフト付き Move
          curses.KEY_SMOVE    

 -- データ:                   シフト付き Next
          curses.KEY_SNEXT    

 -- データ:                   シフト付き Options
          curses.KEY_SOPTIONS 

 -- データ:                   シフト付き Prev
          curses.KEY_SPREVIOUS

 -- データ:                   シフト付き Print
          curses.KEY_SPRINT   

 -- データ:                   シフト付き Redo
          curses.KEY_SREDO    

 -- データ:                   シフト付き Replace
          curses.KEY_SREPLACE 

 -- データ:                   シフト付き Right arrow
          curses.KEY_SRIGHT   

 -- データ:                   シフト付き Resume
          curses.KEY_SRSUME   

 -- データ:                   シフト付き Save
          curses.KEY_SSAVE    

 -- データ:                   シフト付き Suspend
          curses.KEY_SSUSPEND 

 -- データ:                   シフト付き Undo
          curses.KEY_SUNDO    

 -- データ:                   一時停止 (Suspend)
          curses.KEY_SUSPEND  

 -- データ: curses.KEY_UNDO   Undo [元に戻す]
                              
                              
 -- データ:                   マウスイベント通知
          curses.KEY_MOUSE    

 -- データ:                   端末リサイズイベント
          curses.KEY_RESIZE   

 -- データ: curses.KEY_MAX    最大キー値
                              

On VT100s and their software emulations, such as X terminal emulators,
there are normally at least four function keys (*note KEY_F1: 3518,
*note KEY_F2: 3518, *note KEY_F3: 3518, *note KEY_F4: 3518.) available,
and the arrow keys mapped to *note KEY_UP: 3512, *note KEY_DOWN: 3511,
*note KEY_LEFT: 3513. and *note KEY_RIGHT: 3514. in the obvious way.  If
your machine has a PC keyboard, it is safe to expect arrow keys and
twelve function keys (older PC keyboards may have only ten function
keys); also, the following keypad mappings are standard:

キーキャップ           定数
                       
---------------------------------------
                       
‘Insert’               KEY_IC
                       
                       
‘Delete’               KEY_DC
                       
                       
‘Home’                 KEY_HOME
                       
                       
‘End’                  KEY_END
                       
                       
‘Page Up’              KEY_PPAGE
                       
                       
‘Page Down’            KEY_NPAGE
                       

代替文字セットを以下の表に列挙します。これらは VT100 端末から継承したも
のであり、X 端末のようなソフトウェアエミュレーション上で一般に利用可能な
ものです。グラフィックが利用できない場合、curses は印字可能 ASCII文字に
よる粗雑な近似出力を行います。

     注釈: これらは *note initscr(): 190f. が呼び出された後でしか利用で
     きません。

ACS コード                   意味
                             
----------------------------------------------------------------------------
                             
 -- データ:                  右上角の別名
          curses.ACS_BBSS    

 -- データ:                  黒四角ブロック
          curses.ACS_BLOCK   

 -- データ:                  白四角ブロック
          curses.ACS_BOARD   

 -- データ:                  水平線の別名
          curses.ACS_BSBS    

 -- データ:                  左上角の別名
          curses.ACS_BSSB    

 -- データ:                  上向き T 字罫線の別名
          curses.ACS_BSSS    

 -- データ:                  下向き T 字罫線
          curses.ACS_BTEE    

 -- データ:                  黒丸(bullet)
          curses.ACS_BULLET  

 -- データ:                  チェッカーボードパタン (点描)
          curses.ACS_CKBOARD 

 -- データ:                  下向き矢印
          curses.ACS_DARROW  

 -- データ:                  度記号
          curses.ACS_DEGREE  

 -- データ:                  ダイアモンド
          curses.ACS_DIAMOND 

 -- データ:                  大なりイコール
          curses.ACS_GEQUAL  

 -- データ:                  水平線
          curses.ACS_HLINE   

 -- データ:                  ランタン(lantern) シンボル
          curses.ACS_LANTERN 

 -- データ:                  左向き矢印
          curses.ACS_LARROW  

 -- データ:                  小なりイコール
          curses.ACS_LEQUAL  

 -- データ:                  左下角
          curses.ACS_LLCORNER

 -- データ:                  右下角
          curses.ACS_LRCORNER

 -- データ:                  左向き T 字罫線
          curses.ACS_LTEE    

 -- データ:                  不等号
          curses.ACS_NEQUAL  

 -- データ: curses.ACS_PI    パイ記号
                             
                             
 -- データ:                  プラスマイナス記号
          curses.ACS_PLMINUS 

 -- データ:                  大プラス記号
          curses.ACS_PLUS    

 -- データ:                  右向き矢印
          curses.ACS_RARROW  

 -- データ:                  右向き T 字罫線
          curses.ACS_RTEE    

 -- データ: curses.ACS_S1    スキャンライン 1
                             
                             
 -- データ: curses.ACS_S3    スキャンライン 3
                             
                             
 -- データ: curses.ACS_S7    スキャンライン 7
                             
                             
 -- データ: curses.ACS_S9    スキャンライン 9
                             
                             
 -- データ:                  右下角の別名
          curses.ACS_SBBS    

 -- データ:                  垂直線の別名
          curses.ACS_SBSB    

 -- データ:                  右向き T 字罫線の別名
          curses.ACS_SBSS    

 -- データ:                  左下角の別名
          curses.ACS_SSBB    

 -- データ:                  下向き T 字罫線の別名
          curses.ACS_SSBS    

 -- データ:                  左向き T 字罫線の別名
          curses.ACS_SSSB    

 -- データ:                  交差罫線または大プラス記号の別名
          curses.ACS_SSSS    

 -- データ:                  ポンドスターリング記号
          curses.ACS_STERLING

 -- データ:                  上向き T 字罫線
          curses.ACS_TTEE    

 -- データ:                  上向き矢印
          curses.ACS_UARROW  

 -- データ:                  左上角
          curses.ACS_ULCORNER

 -- データ:                  右上角
          curses.ACS_URCORNER

 -- データ:                  垂直線
          curses.ACS_VLINE   

The following table lists mouse button constants used by *note
getmouse(): 347c.:

Mouse button constant                  意味
                                       
-----------------------------------------------------------------------------------------
                                       
 -- データ: curses.BUTTONn_PRESSED     Mouse button 'n' pressed
                                       
                                       
 -- データ: curses.BUTTONn_RELEASED    Mouse button 'n' released
                                       
                                       
 -- データ: curses.BUTTONn_CLICKED     Mouse button 'n' clicked
                                       
                                       
 -- データ:                            Mouse button 'n' double clicked
          curses.BUTTONn_DOUBLE_CLICKED

 -- データ:                            Mouse button 'n' triple clicked
          curses.BUTTONn_TRIPLE_CLICKED

 -- データ: curses.BUTTON_SHIFT        Shift was down during button state change
                                       
                                       
 -- データ: curses.BUTTON_CTRL         Control was down during button state change
                                       
                                       
 -- データ: curses.BUTTON_ALT          Control was down during button state change
                                       

バージョン 3.10 で変更: The ‘BUTTON5_*’ constants are now exposed if
they are provided by the underlying curses library.

以下のテーブルは定義済みの色を列挙したものです:

定数                          色
                              
---------------------------------------------------------------
                              
 -- データ:                   黒
          curses.COLOR_BLACK  

 -- データ:                   青
          curses.COLOR_BLUE   

 -- データ:                   シアン (薄く緑がかった青)
          curses.COLOR_CYAN   

 -- データ:                   緑
          curses.COLOR_GREEN  

 -- データ:                   マゼンタ (紫がかった赤)
          curses.COLOR_MAGENTA

 -- データ:                   赤
          curses.COLOR_RED    

 -- データ:                   白
          curses.COLOR_WHITE  

 -- データ:                   黄色
          curses.COLOR_YELLOW 


File: python.info,  Node: curses textpad --- Text input widget for curses programs,  Next: curses ascii --- ASCII 文字のユーティリティー,  Prev: curses --- 文字セル表示のターミナル処理,  Up: コマンドラインインターフェースライブラリ

5.17.6 ‘curses.textpad’ -- Text input widget for curses programs
----------------------------------------------------------------

The ‘curses.textpad’ module provides a *note Textbox: 359b. class that
handles elementary text editing in a curses window, supporting a set of
keybindings resembling those of Emacs (thus, also of Netscape Navigator,
BBedit 6.x, FrameMaker, and many other programs).  The module also
provides a rectangle-drawing function useful for framing text boxes or
for other purposes.

The module ‘curses.textpad’ defines the following function:

 -- の関数: curses.textpad.rectangle (win, uly, ulx, lry, lrx)

     矩形を描画します。最初の引数はウィンドウオブジェクトでなければなり
     ません; 残りの引数はそのウィンドウからの相対座標になります。2 番目
     および 3 番目の引数は描画すべき矩形の左上角の y および x 座標です;
     4 番目および 5 番目の引数は右下角の y および x 座標です。矩形は、
     VT100/IBM PC におけるフォーム文字を利用できる端末 (xterm やその他の
     ほとんどのソフトウェア端末エミュレータを含む) ではそれを使って描画
     されます。そうでなければ ASCII 文字のダッシュ、垂直バー、およびプラ
     ス記号で描画されます。

* Menu:

* Textbox オブジェクト::


File: python.info,  Node: Textbox オブジェクト,  Up: curses textpad --- Text input widget for curses programs

5.17.6.1 Textbox オブジェクト
.............................

以下のような *note Textbox: 359b. オブジェクトをインスタンス生成すること
ができます:

 -- クラス: curses.textpad.Textbox (win)

     テキストボックスウィジェットオブジェクトを返します。'win' 引数は、
     テキストボックスを入れるための *note ウィンドウ: 1989. オブジェクト
     でなければなりません。テキストボックスの編集カーソルは、最初はテキ
     ストボックスが入っているウィンドウの左上角に配置され、その座標は
     ‘(0, 0)’ です。インスタンスの *note stripspaces: 359f. フラグの初期
     値はオンに設定されます。

     *note Textbox: 359b. オブジェクトは以下のメソッドを持ちます:

      -- メソッド: edit ([validator])

          普段使うことになるエントリポイントです。終了キーストロークの一
          つが入力されるまで編集キーストロークを受け付けます。
          'validator' を与える場合、関数でなければなりません。
          'validator' はキーストロークが入力されるたびにそのキーストロー
          クが引数となって呼び出されます; 返された値に対して、コマンドキ
          ーストロークとして解釈が行われます。このメソッドはウィンドウの
          内容を文字列として返します; ウィンドウ内の空白が含められるかど
          うかは *note stripspaces: 359f. 属性で決められます。

      -- メソッド: do_command (ch)

          単一のコマンドキーストロークを処理します。以下にサポートされて
          いる特殊キーストロークを示します:

          キーストローク         動作
                                 
          -----------------------------------------------------------------------
                                 
          ‘Control’-‘A’          ウィンドウの左端に移動します。
                                 
                                 
          ‘Control’-‘B’          カーソルを左へ移動し、必要なら前の行に折り返
                                 します。
                                 
                                 
          ‘Control’-‘D’          カーソル下の文字を削除します。
                                 
                                 
          ‘Control’-‘E’          右端 (stripspaces がオフのとき) または行末
                                 (stripspaces がオンのとき) に移動します。
                                 
                                 
          ‘Control’-‘F’          カーソルを右に移動し、必要なら次の行に折り返
                                 します。
                                 
                                 
          ‘Control’-‘G’          ウィンドウを終了し、その内容を返します。
                                 
                                 
          ‘Control’-‘H’          逆方向に文字を削除します。
                                 
                                 
          ‘Control’-‘J’          ウィンドウが 1 行であれば終了し、そうでなけれ
                                 ば新しい行を挿入します。
                                 
                                 
          ‘Control’-‘K’          行が空白行ならその行全体を削除し、そうでなけ
                                 ればカーソル以降行末までを消去します。
                                 
                                 
          ‘Control’-‘L’          スクリーンを更新します。
                                 
                                 
          ‘Control’-‘N’          カーソルを下に移動します; 1 行下に移動します
                                 。
                                 
                                 
          ‘Control’-‘O’          カーソルの場所に空行を 1 行挿入します。
                                 
                                 
          ‘Control’-‘P’          カーソルを上に移動します; 1 行上に移動します
                                 。
                                 

          移動操作は、カーソルがウィンドウの縁にあって移動ができない場合
          には何も行いません。場合によっては、以下のような同義のキースト
          ロークがサポートされています:

          定数                                 キーストローク
                                               
          ------------------------------------------------------------
                                               
          *note KEY_LEFT: 3513.                ‘Control’-‘B’
                                               
                                               
          *note KEY_RIGHT: 3514.               ‘Control’-‘F’
                                               
                                               
          *note KEY_UP: 3512.                  ‘Control’-‘P’
                                               
                                               
          *note KEY_DOWN: 3511.                ‘Control’-‘N’
                                               
                                               
          *note KEY_BACKSPACE: 3516.           ‘Control’-‘h’
                                               

          他のキーストロークは、与えられた文字を挿入し、(行折り返し付き
          で) 右に移動するコマンドとして扱われます。

      -- メソッド: gather ()

          ウィンドウの内容を文字列として返します; ウィンドウ内の空白が含
          められるかどうかは *note stripspaces: 359f. メンバ変数で決めら
          れます。

      -- の属性: stripspaces

          この属性はウィンドウ内の空白領域の解釈方法を制御するためのフラ
          グです。フラグがオンに設定されている場合、各行の末端にある空白
          領域は無視されます; すなわち、末端空白領域にカーソルが入ると、
          その場所の代わりに行の末尾にカーソルが移動します。また、末端の
          空白領域はウィンドウの内容を取得する際に剥ぎ取られます。


File: python.info,  Node: curses ascii --- ASCII 文字のユーティリティー,  Next: curses panel --- curses のためのパネルスタック拡張,  Prev: curses textpad --- Text input widget for curses programs,  Up: コマンドラインインターフェースライブラリ

5.17.7 ‘curses.ascii’ -- ASCII 文字のユーティリティー
-----------------------------------------------------

'ソースコード:' Lib/curses/ascii.py(1)

__________________________________________________________________

The ‘curses.ascii’ module supplies name constants for ASCII characters
and functions to test membership in various ASCII character classes.
The constants supplied are names for control characters as follows:

名前                意味
                    
-----------------------------------------------------------------------
                    
 -- データ:
          curses.ascii.NUL

 -- データ:         ヘディング開始、コンソール割り込み
          curses.ascii.SOH

 -- データ:         テキスト開始
          curses.ascii.STX

 -- データ:         テキスト終了
          curses.ascii.ETX

 -- データ:         テキスト伝送終了
          curses.ascii.EOT

 -- データ:         問い合わせ、 *note ACK: 35ac. フロー制御時に使用
          curses.ascii.ENQ

 -- データ:         肯定応答
          curses.ascii.ACK

 -- データ:         ベル
          curses.ascii.BEL

 -- データ:         一文字後退
          curses.ascii.BS

 -- データ:         タブ
          curses.ascii.TAB

 -- データ:         *note TAB: 35af. の別名: "水平タブ"
          curses.ascii.HT

 -- データ:         改行
          curses.ascii.LF

 -- データ:         *note LF: 35b1. の別名: "改行"
          curses.ascii.NL

 -- データ:         垂直タブ
          curses.ascii.VT

 -- データ:         改頁
          curses.ascii.FF

 -- データ:         復帰
          curses.ascii.CR

 -- データ:         シフトアウト、他の文字セットの開始
          curses.ascii.SO

 -- データ:         シフトイン、標準の文字セットに復帰
          curses.ascii.SI

 -- データ:         データリンクでのエスケープ
          curses.ascii.DLE

 -- データ:         装置制御 1、フロー制御のための XON
          curses.ascii.DC1

 -- データ:         装置制御 2、ブロックモードフロー制御
          curses.ascii.DC2

 -- データ:         装置制御 3、フロー制御のための XOFF
          curses.ascii.DC3

 -- データ:         装置制御 4
          curses.ascii.DC4

 -- データ:         否定応答
          curses.ascii.NAK

 -- データ:         同期信号
          curses.ascii.SYN

 -- データ:         ブロック転送終了
          curses.ascii.ETB

 -- データ:         キャンセル (Cancel)
          curses.ascii.CAN

 -- データ:         媒体終端
          curses.ascii.EM

 -- データ:         代入文字
          curses.ascii.SUB

 -- データ:         エスケープ文字
          curses.ascii.ESC

 -- データ:         ファイル区切り文字
          curses.ascii.FS

 -- データ:         グループ区切り文字
          curses.ascii.GS

 -- データ:         レコード区切り文字、ブロックモード終了子
          curses.ascii.RS

 -- データ:         単位区切り文字
          curses.ascii.US

 -- データ:         空白文字
          curses.ascii.SP

 -- データ:         削除
          curses.ascii.DEL

これらの大部分は、最近は実際に定数の意味通りに使われることがほとんどない
ので注意してください。これらのニーモニック符号はデジタル計算機より前のテ
レプリンタにおける慣習から付けられたものです。

このモジュールでは、標準 C ライブラリの関数を雛型とする以下の関数をサポ
ートしています:

 -- の関数: curses.ascii.isalnum (c)

     ASCII 英数文字かどうかを調べます; ‘isalpha(c) or isdigit(c)’ と等価
     です。

 -- の関数: curses.ascii.isalpha (c)

     ASCII アルファベット文字かどうかを調べます; ‘isupper(c) or
     islower(c)’ と等価です。

 -- の関数: curses.ascii.isascii (c)

     文字が 7 ビット ASCII 文字に合致するかどうかを調べます。

 -- の関数: curses.ascii.isblank (c)

     ASCII 余白文字、すなわち空白または水平タブかどうかを調べます。

 -- の関数: curses.ascii.iscntrl (c)

     ASCII 制御文字 (0x00 から 0x1f の範囲または 0x7f) かどうかを調べま
     す。

 -- の関数: curses.ascii.isdigit (c)

     ASCII 10 進数字、すなわち ‘'0'’ から ‘'9'’ までの文字かどうかを調べ
     ます。‘c in string.digits’ と等価です。

 -- の関数: curses.ascii.isgraph (c)

     空白以外の ASCII 印字可能文字かどうかを調べます。

 -- の関数: curses.ascii.islower (c)

     ASCII 小文字かどうかを調べます。

 -- の関数: curses.ascii.isprint (c)

     空白文字を含め、ASCII 印字可能文字かどうかを調べます。

 -- の関数: curses.ascii.ispunct (c)

     空白または英数字以外の ASCII 印字可能文字かどうかを調べます。

 -- の関数: curses.ascii.isspace (c)

     ASCII 余白文字、すなわち空白、改行、復帰、改頁、水平タブ、垂直タブ
     かどうかを調べます。

 -- の関数: curses.ascii.isupper (c)

     ASCII 大文字かどうかを調べます。

 -- の関数: curses.ascii.isxdigit (c)

     ASCII 16 進数字かどうかを調べます。‘c in string.hexdigits’ と等価で
     す。

 -- の関数: curses.ascii.isctrl (c)

     ASCII 制御文字 (0 から 31 までの値) かどうかを調べます。

 -- の関数: curses.ascii.ismeta (c)

     非 ASCII 文字 (0x80 またはそれ以上の値) かどうかを調べます。

これらの関数は数字も 1 文字の文字列も使えます; 引数を文字列にした場合、
組み込み関数 *note ord(): 233b. を使って変換されます。

これらの関数は全て、関数に渡した文字列の文字から得られたビット値を調べる
ので注意してください; 関数はホスト計算機で使われている文字列エンコーディ
ングについて何ら関知しません。

以下の 2 つの関数は、引数として 1 文字の文字列または整数で表したバイト値
のどちらでもとり得ます; これらの関数は引数と同じ型で値を返します。

 -- の関数: curses.ascii.ascii (c)

     ASCII 値を返します。'c' の下位 7 ビットに対応します。

 -- の関数: curses.ascii.ctrl (c)

     与えた文字に対応する制御文字を返します (0x1f とビット単位で論理積を
     取ります)。

 -- の関数: curses.ascii.alt (c)

     与えた文字に対応する 8 ビット文字を返します (0x80 とビット単位で論
     理和を取ります)。

以下の関数は 1 文字からなる文字列値または整数値を引数に取り、文字列を返
します。

 -- の関数: curses.ascii.unctrl (c)

     ASCII 文字 'c' の文字列表現を返します。 もし 'c' が印字可能文字であ
     れば、返される文字列は 'c' そのものになります。 もし 'c' が制御文字
     (0x00-0x1f) であれば、キャレット (‘'^'’) と、その後ろに続く 'c' に
     対応した大文字からなる文字列になります。 'c' が ASCII 削除文字
     (0x7f) であれば、文字列は ‘'^?'’ になります。 'c' のメタビット
     (0x80) がセットされていれば、メタビットは取り去られ、前述のルールが
     適用され、‘'!'’ が前につけられます。

 -- データ: curses.ascii.controlnames

     0 (NUL) から 0x1f (US) までの 32 の ASCII 制御文字と、空白文字 ‘SP’
     のニーモニック符号名からなる 33 要素の文字列によるシーケンスです。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/curses/ascii.py


File: python.info,  Node: curses panel --- curses のためのパネルスタック拡張,  Next: cmd --- 行指向のコマンドインタープリターのサポート,  Prev: curses ascii --- ASCII 文字のユーティリティー,  Up: コマンドラインインターフェースライブラリ

5.17.8 ‘curses.panel’ -- curses のためのパネルスタック拡張
----------------------------------------------------------

__________________________________________________________________

パネルは深さ (depth) の機能が追加されたウィンドウです。これにより、ウィ
ンドウをお互いに重ね合わせることができ、各ウィンドウの可視部分だけが表示
されます。パネルはスタック中に追加したり、スタック内で上下移動させたり、
スタックから除去することができます。

* Menu:

* 関数: 関数<7>.
* Panel オブジェクト::


File: python.info,  Node: 関数<7>,  Next: Panel オブジェクト,  Up: curses panel --- curses のためのパネルスタック拡張

5.17.8.1 関数
.............

The module ‘curses.panel’ defines the following functions:

 -- の関数: curses.panel.bottom_panel ()

     パネルスタックの最下層のパネルを返します。

 -- の関数: curses.panel.new_panel (win)

     与えられたウィンドウ 'win' に関連付けられたパネルオブジェクトを返し
     ます。返されたパネルオブジェクトを参照しておく必要があることに注意
     してください。もし参照しなければ、パネルオブジェクトはガベージコレ
     クションされてパネルスタックから削除されます。

 -- の関数: curses.panel.top_panel ()

     パネルスタックの最上層のパネルを返します。

 -- の関数: curses.panel.update_panels ()

     仮想スクリーンをパネルスタック変更後の状態に更新します。この関数で
     は *note curses.doupdate(): 3473. を呼ばないので、ユーザは自分で呼
     び出す必要があります。


File: python.info,  Node: Panel オブジェクト,  Prev: 関数<7>,  Up: curses panel --- curses のためのパネルスタック拡張

5.17.8.2 Panel オブジェクト
...........................

上記の *note new_panel(): 35e4. が返す Panel オブジェクトはスタック順の
概念を持つウィンドウです。ウィンドウはパネルに関連付けられており、表示す
る内容を決定している一方、パネルのメソッドはパネルスタック中のウィンドウ
の深さ管理を担います。

Panel オブジェクトは以下のメソッドを持っています:

 -- メソッド: Panel.above ()

     現在のパネルの上にあるパネルを返します。

 -- メソッド: Panel.below ()

     現在のパネルの下にあるパネルを返します。

 -- メソッド: Panel.bottom ()

     パネルをスタックの最下層にプッシュします。

 -- メソッド: Panel.hidden ()

     パネルが隠れている (不可視である) 場合に ‘True’ を返し、そうでない
     場合 ‘False’ を返します。

 -- メソッド: Panel.hide ()

     パネルを隠します。この操作ではオブジェクトは消去されず、スクリーン
     上のウィンドウを不可視にするだけです。

 -- メソッド: Panel.move (y, x)

     パネルをスクリーン座標 ‘(y, x)’ に移動します。

 -- メソッド: Panel.replace (win)

     パネルに関連付けられたウィンドウを 'win' に変更します。

 -- メソッド: Panel.set_userptr (obj)

     パネルのユーザポインタを 'obj' に設定します。このメソッドは任意のデ
     ータをパネルに関連付けるために使われ、任意の Python オブジェクトに
     することができます。

 -- メソッド: Panel.show ()

     (隠れているはずの) パネルを表示します。

 -- メソッド: Panel.top ()

     パネルをスタックの最上層にプッシュします。

 -- メソッド: Panel.userptr ()

     パネルのユーザポインタを返します。任意の Python オブジェクトです。

 -- メソッド: Panel.window ()

     パネルに関連付けられているウィンドウオブジェクトを返します。


File: python.info,  Node: cmd --- 行指向のコマンドインタープリターのサポート,  Prev: curses panel --- curses のためのパネルスタック拡張,  Up: コマンドラインインターフェースライブラリ

5.17.9 ‘cmd’ -- 行指向のコマンドインタープリターのサポート
----------------------------------------------------------

'ソースコード:' Lib/cmd.py(1)

__________________________________________________________________

*note Cmd: 184e. クラスでは、行指向のコマンドインタープリタを書くための
簡単なフレームワークを提供します。テストハーネスや管理ツール、そして、後
により洗練されたインターフェイスでラップするプロトタイプとして、こうした
インタープリタはよく役に立ちます。

 -- クラス: cmd.Cmd (completekey='tab', stdin=None, stdout=None)

     *note Cmd: 184e. インスタンス、あるいはサブクラスのインスタンスは、
     行指向のインタープリタ・フレームワークです。 *note Cmd: 184e. 自身
     をインスタンス化することはありません。むしろ、 *note Cmd: 184e. の
     メソッドを継承したり、アクションメソッドをカプセル化するために、あ
     なたが自分で定義するインタープリタクラスのスーパークラスとしての便
     利です。

     オプション引数 'completekey' は、補完キーの *note readline: bf. 名
     です。デフォルトは ‘Tab’ です。 'completekey' が *note None: 885. で
     なく、 *note readline: bf. が利用できるならば、コマンド補完は自動的
     に行われます。

     The default, ‘'tab'’, is treated specially, so that it refers to
     the ‘Tab’ key on every *note readline.backend: 1a27.  Specifically,
     if *note readline.backend: 1a27. is ‘editline’, ‘Cmd’ will use
     ‘'^I'’ instead of ‘'tab'’.  Note that other values are not treated
     this way, and might only work with a specific backend.

     オプション引数の 'stdin' と 'stdout' には、Cmd またはそのサブクラス
     のインスタンスが入出力に使用するファイルオブジェクトを指定します。
     省略時には *note sys.stdin: 75f. と *note sys.stdout: ccd. が使用さ
     れます。

     引数に渡した 'stdin' を使いたい場合は、インスタンスの *note
     use_rawinput: 35f8. 属性を ‘False’ にセットしてください。そうしない
     と 'stdin' は無視されます。

     バージョン 3.13 で変更: ‘completekey='tab'’ is replaced by ‘'^I'’
     for ‘editline’.

* Menu:

* Cmdオブジェクト::
* Cmd の例::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/cmd.py


File: python.info,  Node: Cmdオブジェクト,  Next: Cmd の例,  Up: cmd --- 行指向のコマンドインタープリターのサポート

5.17.9.1 Cmdオブジェクト
........................

*note Cmd: 184e. インスタンスは、次のメソッドを持ちます:

 -- メソッド: Cmd.cmdloop (intro=None)

     プロンプトを繰り返し出力し、入力を受け取り、受け取った入力から取り
     去った先頭の語を解析し、その行の残りを引数としてアクションメソッド
     へディスパッチします。

     オプションの引数は、最初のプロンプトの前に表示されるバナーあるいは
     イントロ用の文字列です (これはクラス属性 *note intro: 35fc. をオー
     バーライドします)。

     *note readline: bf. モジュールがロードされているなら、入力は自動的
     に ‘bash’ のような履歴リスト編集機能を受け継ぎます(例えば、
     ‘Control’-‘P’ は直前のコマンドへのスクロールバック、 ‘Control’-‘N’
     は次のものへ進む、 ‘Control’-‘F’ はカーソルを右へ非破壊的に進める、
     ‘Control’-‘B’ はカーソルを非破壊的に左へ移動させる等)。

     入力のファイル終端は、文字列 ‘'EOF'’ として渡されます。

     An interpreter instance will recognize a command name ‘foo’ if and
     only if it has a method ‘do_foo()’.  As a special case, a line
     beginning with the character ‘'?'’ is dispatched to the method
     *note do_help(): 1a2b.  As another special case, a line beginning
     with the character ‘'!'’ is dispatched to the method ‘do_shell()’
     (if such a method is defined).

     This method will return when the *note postcmd(): 35fd. method
     returns a true value.  The 'stop' argument to *note postcmd():
     35fd. is the return value from the command's corresponding ‘do_*()’
     method.

     If completion is enabled, completing commands will be done
     automatically, and completing of commands args is done by calling
     ‘complete_foo()’ with arguments 'text', 'line', 'begidx', and
     'endidx'.  'text' is the string prefix we are attempting to match:
     all returned matches must begin with it.  'line' is the current
     input line with leading whitespace removed, 'begidx' and 'endidx'
     are the beginning and ending indexes of the prefix text, which
     could be used to provide different completion depending upon which
     position the argument is in.

 -- メソッド: Cmd.do_help (arg)

     All subclasses of *note Cmd: 184e. inherit a predefined
     ‘do_help()’.  This method, called with an argument ‘'bar'’, invokes
     the corresponding method ‘help_bar()’, and if that is not present,
     prints the docstring of ‘do_bar()’, if available.  With no
     argument, ‘do_help()’ lists all available help topics (that is, all
     commands with corresponding ‘help_*()’ methods or commands that
     have docstrings), and also lists any undocumented commands.

 -- メソッド: Cmd.onecmd (str)

     Interpret the argument as though it had been typed in response to
     the prompt.  This may be overridden, but should not normally need
     to be; see the *note precmd(): 35ff. and *note postcmd(): 35fd.
     methods for useful execution hooks.  The return value is a flag
     indicating whether interpretation of commands by the interpreter
     should stop.  If there is a ‘do_*()’ method for the command 'str',
     the return value of that method is returned, otherwise the return
     value from the *note default(): 3600. method is returned.

 -- メソッド: Cmd.emptyline ()

     プロンプトに空行が入力されたときに呼び出されるメソッド。このメソッ
     ドがオーバーライドされていないなら、最後に入力された空行でないコマ
     ンドが繰り返されます。

 -- メソッド: Cmd.default (line)

     コマンドの先頭の語が認識されないときに、入力行に対して呼び出されま
     す。このメソッドがオーバーライドされていないなら、エラーメッセージ
     を表示して戻ります。

 -- メソッド: Cmd.completedefault (text, line, begidx, endidx)

     Method called to complete an input line when no command-specific
     ‘complete_*()’ method is available.  By default, it returns an
     empty list.

 -- メソッド: Cmd.columnize (list, displaywidth=80)

     Method called to display a list of strings as a compact set of
     columns.  Each column is only as wide as necessary.  Columns are
     separated by two spaces for readability.

 -- メソッド: Cmd.precmd (line)

     コマンド行 'line' が解釈実行される直前、しかし入力プロンプトが作ら
     れ表示された後に実行されるフックメソッド。このメソッドは *note Cmd:
     184e. 内のスタブであって、サブクラスでオーバーライドされるために存
     在します。戻り値は *note onecmd(): 35fe. メソッドが実行するコマンド
     として使われます。 *note precmd(): 35ff. の実装では、コマンドを書き
     換えるかもしれないし、あるいは単に変更していない 'line' を返すかも
     しれません。

 -- メソッド: Cmd.postcmd (stop, line)

     コマンドディスパッチが終わった直後に実行されるフックメソッド。この
     メソッドは *note Cmd: 184e. 内のスタブで、サブクラスでオーバーライ
     ドされるために存在します。 'line' は実行されたコマンド行で、 'stop'
     は *note postcmd(): 35fd. の呼び出しの後に実行を停止するかどうかを
     示すフラグです。これは *note onecmd(): 35fe. メソッドの戻り値です。
     このメソッドの戻り値は、 'stop' に対応する内部フラグの新しい値とし
     て使われます。偽を返すと、実行を続けます。

 -- メソッド: Cmd.preloop ()

     *note cmdloop(): 35fb. が呼び出されたときに一度だけ実行されるフック
     メソッド。このメソッドは *note Cmd: 184e. 内のスタブであって、サブ
     クラスでオーバーライドされるために存在します。

 -- メソッド: Cmd.postloop ()

     *note cmdloop(): 35fb. が戻る直前に一度だけ実行されるフックメソッド
     。このメソッドは *note Cmd: 184e. 内のスタブであって、サブクラスで
     オーバーライドされるために存在します。

*note Cmd: 184e. のサブクラスのインスタンスは、公開されたインスタンス変
数をいくつか持っています:

 -- の属性: Cmd.prompt

     入力を求めるために表示されるプロンプト。

 -- の属性: Cmd.identchars

     コマンドの先頭の語として受け入れられる文字の文字列。

 -- の属性: Cmd.lastcmd

     最後の空でないコマンド接頭辞。

 -- の属性: Cmd.cmdqueue

     キューに入れられた入力行のリスト。cmdqueue リストは新たな入力が必要
     な際に *note cmdloop(): 35fb. 内でチェックされます; これが空でない
     場合、その要素は、あたかもプロンプトから入力されたかのように順に処
     理されます。

 -- の属性: Cmd.intro

     イントロあるいはバナーとして表示される文字列。 *note cmdloop():
     35fb. メソッドに引数を与えるために、オーバーライドされるかもしれま
     せん。

 -- の属性: Cmd.doc_header

     ヘルプ出力に文書化されたコマンドのセクションがある場合に表示するヘ
     ッダ。

 -- の属性: Cmd.misc_header

     The header to issue if the help output has a section for
     miscellaneous help topics (that is, there are ‘help_*()’ methods
     without corresponding ‘do_*()’ methods).

 -- の属性: Cmd.undoc_header

     The header to issue if the help output has a section for
     undocumented commands (that is, there are ‘do_*()’ methods without
     corresponding ‘help_*()’ methods).

 -- の属性: Cmd.ruler

     ヘルプメッセージのヘッダの下に、区切り行を表示するために使われる文
     字。空のときは、ルーラ行が表示されません。デフォルトでは、‘'='’ で
     す。

 -- の属性: Cmd.use_rawinput

     A flag, defaulting to true.  If true, *note cmdloop(): 35fb. uses
     *note input(): 14f0. to display a prompt and read the next command;
     if false, *note sys.stdout.write(): ccd. and *note
     sys.stdin.readline(): 75f. are used.  (This means that by importing
     *note readline: bf, on systems that support it, the interpreter
     will automatically support ‘Emacs’-like line editing and
     command-history keystrokes.)


File: python.info,  Node: Cmd の例,  Prev: Cmdオブジェクト,  Up: cmd --- 行指向のコマンドインタープリターのサポート

5.17.9.2 Cmd の例
.................

The ‘cmd’ module is mainly useful for building custom shells that let a
user work with a program interactively.

この節では、*note turtle: 107. モジュールのいくつかのコマンドを持ったシ
ェルの作成方法の簡単な例を示します。

Basic turtle commands such as *note forward(): 360f. are added to a
*note Cmd: 184e. subclass with method named ‘do_forward()’.  The
argument is converted to a number and dispatched to the turtle module.
The docstring is used in the help utility provided by the shell.

The example also includes a basic record and playback facility
implemented with the *note precmd(): 35ff. method which is responsible
for converting the input to lowercase and writing the commands to a
file.  The ‘do_playback()’ method reads the file and adds the recorded
commands to the *note cmdqueue: 3608. for immediate playback:

     import cmd, sys
     from turtle import *

     class TurtleShell(cmd.Cmd):
         intro = 'Welcome to the turtle shell.   Type help or ? to list commands.\n'
         prompt = '(turtle) '
         file = None

         # ----- basic turtle commands -----
         def do_forward(self, arg):
             'Move the turtle forward by the specified distance:  FORWARD 10'
             forward(*parse(arg))
         def do_right(self, arg):
             'Turn turtle right by given number of degrees:  RIGHT 20'
             right(*parse(arg))
         def do_left(self, arg):
             'Turn turtle left by given number of degrees:  LEFT 90'
             left(*parse(arg))
         def do_goto(self, arg):
             'Move turtle to an absolute position with changing orientation.  GOTO 100 200'
             goto(*parse(arg))
         def do_home(self, arg):
             'Return turtle to the home position:  HOME'
             home()
         def do_circle(self, arg):
             'Draw circle with given radius an options extent and steps:  CIRCLE 50'
             circle(*parse(arg))
         def do_position(self, arg):
             'Print the current turtle position:  POSITION'
             print('Current position is %d %d\n' % position())
         def do_heading(self, arg):
             'Print the current turtle heading in degrees:  HEADING'
             print('Current heading is %d\n' % (heading(),))
         def do_color(self, arg):
             'Set the color:  COLOR BLUE'
             color(arg.lower())
         def do_undo(self, arg):
             'Undo (repeatedly) the last turtle action(s):  UNDO'
         def do_reset(self, arg):
             'Clear the screen and return turtle to center:  RESET'
             reset()
         def do_bye(self, arg):
             'Stop recording, close the turtle window, and exit:  BYE'
             print('Thank you for using Turtle')
             self.close()
             bye()
             return True

         # ----- record and playback -----
         def do_record(self, arg):
             'Save future commands to filename:  RECORD rose.cmd'
             self.file = open(arg, 'w')
         def do_playback(self, arg):
             'Playback commands from a file:  PLAYBACK rose.cmd'
             self.close()
             with open(arg) as f:
                 self.cmdqueue.extend(f.read().splitlines())
         def precmd(self, line):
             line = line.lower()
             if self.file and 'playback' not in line:
                 print(line, file=self.file)
             return line
         def close(self):
             if self.file:
                 self.file.close()
                 self.file = None

     def parse(arg):
         'Convert a series of zero or more numbers to an argument tuple'
         return tuple(map(int, arg.split()))

     if __name__ == '__main__':
         TurtleShell().cmdloop()

以下は、turtle シェルでの機能のヘルプ表示、空行によるコマンドの繰り返し
、単純な記録と再実行のセッション例です:

     Welcome to the turtle shell.   Type help or ? to list commands.

     (turtle) ?

     Documented commands (type help <topic>):
     ========================================
     bye     color    goto     home  playback  record  right
     circle  forward  heading  left  position  reset   undo

     (turtle) help forward
     Move the turtle forward by the specified distance:  FORWARD 10
     (turtle) record spiral.cmd
     (turtle) position
     Current position is 0 0

     (turtle) heading
     Current heading is 0

     (turtle) reset
     (turtle) circle 20
     (turtle) right 30
     (turtle) circle 40
     (turtle) right 30
     (turtle) circle 60
     (turtle) right 30
     (turtle) circle 80
     (turtle) right 30
     (turtle) circle 100
     (turtle) right 30
     (turtle) circle 120
     (turtle) right 30
     (turtle) circle 120
     (turtle) heading
     Current heading is 180

     (turtle) forward 100
     (turtle)
     (turtle) right 90
     (turtle) forward 100
     (turtle)
     (turtle) right 90
     (turtle) forward 400
     (turtle) right 90
     (turtle) forward 500
     (turtle) right 90
     (turtle) forward 400
     (turtle) right 90
     (turtle) forward 300
     (turtle) playback spiral.cmd
     Current position is 0 0

     Current heading is 0

     Current heading is 180

     (turtle) bye
     Thank you for using Turtle


File: python.info,  Node: 並行実行,  Next: ネットワーク通信とプロセス間通信,  Prev: コマンドラインインターフェースライブラリ,  Up: Python 標準ライブラリ

5.18 並行実行
=============

この章で記述されているモジュールは、コードの並行実行のサポートを提供しま
す。ツールの適切な選択は、実行されるタスク(IO bound vs CPU bound) や推奨
される開発スタイル (イベントドリブンな協調的マルチタスク vs プリエンプテ
ィブマルチタスク) に依存します。ここに概観を示します:

* Menu:

* threading: threading --- スレッドベースの並列処理. スレッドベースの並列処理
* multiprocessing: multiprocessing --- プロセスベースの並列処理. プロセスベースの並列処理
* multiprocessing.shared_memory: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ. プロセス間で直接アクセス可能な共有メモリ
* concurrent パッケージ::
* concurrent.futures: concurrent futures --- 並列タスク実行. 並列タスク実行
* concurrent.interpreters: concurrent interpreters --- Multiple interpreters in the same process. Multiple interpreters in the same process
* subprocess: subprocess --- サブプロセス管理. サブプロセス管理
* sched: sched --- イベントスケジューラー. イベントスケジューラー
* queue: queue --- 同期キュークラス. 同期キュークラス
* contextvars: contextvars --- コンテキスト変数. コンテキスト変数
* _thread: _thread --- 低水準なスレッド API. 低水準なスレッド API


File: python.info,  Node: threading --- スレッドベースの並列処理,  Next: multiprocessing --- プロセスベースの並列処理,  Up: 並行実行

5.18.1 ‘threading’ -- スレッドベースの並列処理
----------------------------------------------

'ソースコード:' Lib/threading.py(1)

__________________________________________________________________

このモジュールでは、高水準のスレッドインターフェースをより低水準 な
*note _thread: 2. モジュールの上に構築しています。

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

* Menu:

* はじめに: はじめに<8>.
* GIL and performance considerations::
* リファレンス: リファレンス<2>.
* with 文でのロック・条件変数・セマフォの使い方::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/threading.py


File: python.info,  Node: はじめに<8>,  Next: GIL and performance considerations,  Up: threading --- スレッドベースの並列処理

5.18.1.1 はじめに
.................

The ‘threading’ module provides a way to run multiple threads(1)
(smaller units of a process) concurrently within a single process.  It
allows for the creation and management of threads, making it possible to
execute tasks in parallel, sharing memory space.  Threads are
particularly useful when tasks are I/O bound, such as file operations or
making network requests, where much of the time is spent waiting for
external resources.

A typical use case for ‘threading’ includes managing a pool of worker
threads that can process multiple tasks concurrently.  Here's a basic
example of creating and starting threads using *note Thread: 176.:

     import threading
     import time

     def crawl(link, delay=3):
         print(f"crawl started for {link}")
         time.sleep(delay)  # Blocking I/O (simulating a network request)
         print(f"crawl ended for {link}")

     links = [
         "https://python.org",
         "https://docs.python.org",
         "https://peps.python.org",
     ]

     # Start threads for each link
     threads = []
     for link in links:
         # Using `args` to pass positional arguments and `kwargs` for keyword arguments
         t = threading.Thread(target=crawl, args=(link,), kwargs={"delay": 2})
         threads.append(t)

     # Start each thread
     for t in threads:
         t.start()

     # Wait for all threads to finish
     for t in threads:
         t.join()

バージョン 3.7 で変更: このモジュールは以前はオプションでしたが、常に利
用可能なモジュールとなりました。

参考
....

*note concurrent.futures.ThreadPoolExecutor: 949. offers a higher level
interface to push tasks to a background thread without blocking
execution of the calling thread, while still being able to retrieve
their results when needed.

*note queue: bb. provides a thread-safe interface for exchanging data
between running threads.

*note asyncio: b. offers an alternative approach to achieving task level
concurrency without requiring the use of multiple operating system
threads.

     注釈: In the Python 2.x series, this module contained ‘camelCase’
     names for some methods and functions.  These are deprecated as of
     Python 3.10, but they are still supported for compatibility with
     Python 2.5 and lower.

CPython は *note Global Interpreter Lock: 474. のため、ある時点で Python
コードを実行できるスレッドは1つに限られます (ただし、いくつかのパフォー
マンスが強く求められるライブラリはこの制限を克服しています)。アプリケー
ションにマルチコアマシンの計算能力をより良く利用させたい場合は、 *note
multiprocessing: 98. モジュールや *note
concurrent.futures.ProcessPoolExecutor: 1d6. の利用をお勧めします。 ただ
し、I/Oバウンドなタスクを並行して複数走らせたい場合においては、 マルチス
レッドは正しい選択肢です。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Thread_(computing)


File: python.info,  Node: GIL and performance considerations,  Next: リファレンス<2>,  Prev: はじめに<8>,  Up: threading --- スレッドベースの並列処理

5.18.1.2 GIL and performance considerations
...........................................

Unlike the *note multiprocessing: 98. module, which uses separate
processes to bypass the *note global interpreter lock: 474. (GIL), the
threading module operates within a single process, meaning that all
threads share the same memory space.  However, the GIL limits the
performance gains of threading when it comes to CPU-bound tasks, as only
one thread can execute Python bytecode at a time.  Despite this, threads
remain a useful tool for achieving concurrency in many scenarios.

As of Python 3.13, *note free-threaded: 1f4. builds can disable the GIL,
enabling true parallel execution of threads, but this feature is not
available by default (see PEP 703(1)).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0703/


File: python.info,  Node: リファレンス<2>,  Next: with 文でのロック・条件変数・セマフォの使い方,  Prev: GIL and performance considerations,  Up: threading --- スレッドベースの並列処理

5.18.1.3 リファレンス
.....................

このモジュールは以下の関数を定義しています:

 -- の関数: threading.active_count ()

     生存中の *note Thread: 176. オブジェクトの数を返します。この数は
     *note enumerate(): 1c5a. の返すリストの長さと同じです。

     関数''activeCount''はこの関数の非推奨エイリアスです。

 -- の関数: threading.current_thread ()

     Return the current *note Thread: 176. object, corresponding to the
     caller's thread of control.  If the caller's thread of control was
     not created through the ‘threading’ module, a dummy thread object
     with limited functionality is returned.

     関数''currentThread''はこの関数の非推奨エイリアスです。

 -- の関数: threading.excepthook (args, /)

     *note Thread.run(): c31. で発生したキャッチされない例外を処理する。

     (実) 引数*args*は以下の属性をもちます:

        * 'exc_type': 例外の型

        * 'exc_value': 例外の値、‘None’ の可能性がある。

        * 'exc_traceback': Exception traceback, can be ‘None’.

        * 'thread': Thread which raised the exception, can be ‘None’.

     If 'exc_type' is *note SystemExit: f3c, the exception is silently
     ignored.  Otherwise, the exception is printed out on *note
     sys.stderr: b33.

     If this function raises an exception, *note sys.excepthook(): a0c.
     is called to handle it.

     *note threading.excepthook(): a4b. can be overridden to control how
     uncaught exceptions raised by *note Thread.run(): c31. are handled.

     Storing 'exc_value' using a custom hook can create a reference
     cycle.  It should be cleared explicitly to break the reference
     cycle when the exception is no longer needed.

     Storing 'thread' using a custom hook can resurrect it if it is set
     to an object which is being finalized.  Avoid storing 'thread'
     after the custom hook completes to avoid resurrecting objects.

     参考
     ....

     *note sys.excepthook(): a0c. handles uncaught exceptions.

     Added in version 3.8.

 -- データ: threading.__excepthook__

     Holds the original value of *note threading.excepthook(): a4b.  It
     is saved so that the original value can be restored in case they
     happen to get replaced with broken or alternative objects.

     Added in version 3.10.

 -- の関数: threading.get_ident ()

     現在のスレッドの 'スレッドID' を返します。非ゼロの整数です。この値
     は直接の意味を持っていません; 例えばスレッド特有のデータの辞書に索
     引をつけるためのような、マジッククッキーとして意図されています。ス
     レッドが終了し、他のスレッドが作られたとき、スレッド ID は再利用さ
     れるかもしれません。

     Added in version 3.3.

 -- の関数: threading.get_native_id ()

     Return the native integral Thread ID of the current thread assigned
     by the kernel.  This is a non-negative integer.  Its value may be
     used to uniquely identify this particular thread system-wide (until
     the thread terminates, after which the value may be recycled by the
     OS).

     *note Availability: 213f.: Windows, FreeBSD, Linux, macOS, OpenBSD,
     NetBSD, AIX, DragonFlyBSD, GNU/kFreeBSD.

     Added in version 3.8.

     バージョン 3.13 で変更: Added support for GNU/kFreeBSD.

 -- の関数: threading.enumerate ()

     現在、アクティブな *note Thread: 176. オブジェクト全てのリストを返
     します。リストには、デーモンスレッド (daemonic thread)、 *note
     current_thread(): 35e. の生成するダミースレッドオブジェクトが入りま
     す。終了したスレッドとまだ開始していないスレッドは入りません。しか
     し、主スレッドは、たとえ終了しても、常に結果に含まれます。

 -- の関数: threading.main_thread ()

     main *note Thread: 176. オブジェクトを返します。通常の条件では、メ
     インスレッドはPythonインタプリタが起動したスレッドを指します。

     Added in version 3.4.

 -- の関数: threading.settrace (func)

     Set a trace function for all threads started from the ‘threading’
     module.  The 'func' will be passed to *note sys.settrace(): 2e1.
     for each thread, before its *note run(): c31. method is called.

 -- の関数: threading.settrace_all_threads (func)

     Set a trace function for all threads started from the ‘threading’
     module and all Python threads that are currently executing.

     The 'func' will be passed to *note sys.settrace(): 2e1. for each
     thread, before its *note run(): c31. method is called.

     Added in version 3.12.

 -- の関数: threading.gettrace ()

     *note settrace(): a48. 関数で設定したトレース関数を取得します。

     Added in version 3.10.

 -- の関数: threading.setprofile (func)

     Set a profile function for all threads started from the ‘threading’
     module.  The 'func' will be passed to *note sys.setprofile(): 1717.
     for each thread, before its *note run(): c31. method is called.

 -- の関数: threading.setprofile_all_threads (func)

     Set a profile function for all threads started from the ‘threading’
     module and all Python threads that are currently executing.

     The 'func' will be passed to *note sys.setprofile(): 1717. for each
     thread, before its *note run(): c31. method is called.

     Added in version 3.12.

 -- の関数: threading.getprofile ()

     *note setprofile(): a49. 関数で設定したプロファイラ関数を取得します
     。

     Added in version 3.10.

 -- の関数: threading.stack_size ([size])

     新しいスレッドを作るときのスレッドスタックサイズを返します。オプシ
     ョンの 'size' 引数にはこれ以降に作成するスレッドのスタックサイズを
     指定し、0 (プラットフォームのデフォルト値または設定されたデフォルト
     値) か、 32,768 (32 KiB) 以上の正の整数でなければなりません。'size'
     が指定されない場合 0 が使われます。スレッドのスタックサイズの変更が
     サポートされていない場合、 *note RuntimeError: 244. を送出します。
     不正なスタックサイズが指定された場合、 *note ValueError: 2ec. を送
     出して、スタックサイズは変更されません。32 KiB は現在のインタープリ
     タ自身のために十分であると保証された最小のスタックサイズです。いく
     つかのプラットフォームではスタックサイズに対して制限があることに注
     意してください。例えば最小のスタックサイズが 32 KiB より大きかった
     り、システムのメモリページサイズ の整数倍の必要があるなどです。この
     制限についてはプラットフォームのドキュメントを参照してください (一
     般的なページサイズは 4 KiB なので、プラットフォームに関する情報がな
     い場合は 4096 の整数倍のスタックサイズを選ぶといいかもしれません)。

     *note Availability: 213f.: Windows, pthreads.

     Unix platforms with POSIX threads support.

このモジュールでは以下の定数も定義しています:

 -- データ: threading.TIMEOUT_MAX

     ブロックする関数 (*note Lock.acquire(): 8a7, *note RLock.acquire():
     107b, *note Condition.wait(): 1c66. など) の 'timeout' 引数に許され
     る最大値。これ以上の値を timeout に指定すると *note OverflowError:
     a81. が発生します。

     Added in version 3.2.

このモジュールは多くのクラスを定義しています。それらは下記のセクションで
詳しく説明されます。

このモジュールのおおまかな設計は Java のスレッドモデルに基づいています。
とはいえ、 Java がロックと条件変数を全てのオブジェクトの基本的な挙動にし
ているのに対し、 Python ではこれらを別個のオブジェクトに分けています。
Python の *note Thread: 176. クラスがサポートしているのは Java の Thread
クラスの挙動のサブセットにすぎません; 現状では、優先度 (priority)やスレ
ッドグループがなく、スレッドの破壊 (destroy)、中断 (stop)、一時停止
(suspend)、復帰 (resume)、割り込み (interrupt) は行えません。 Java の
Thread クラスにおける静的メソッドに対応する機能が実装されている場合には
モジュールレベルの関数になっています。

以下に説明するメソッドは全て原子的 (atomic) に実行されます。

* Menu:

* Thread-local data::
* Thread objects::
* Lock objects::
* RLock objects::
* Condition objects::
* Semaphore objects::
* Semaphore example::
* Event objects::
* Timer objects::
* Barrier objects::


File: python.info,  Node: Thread-local data,  Next: Thread objects,  Up: リファレンス<2>

5.18.1.4 Thread-local data
..........................

Thread-local data is data whose values are thread specific.  If you have
data that you want to be local to a thread, create a *note local: 185f.
object and use its attributes:

     >>> mydata = local()
     >>> mydata.number = 42
     >>> mydata.number
     42

You can also access the *note local: 185f.-object's dictionary:

     >>> mydata.__dict__
     {'number': 42}
     >>> mydata.__dict__.setdefault('widgets', [])
     []
     >>> mydata.widgets
     []

If we access the data in a different thread:

     >>> log = []
     >>> def f():
     ...     items = sorted(mydata.__dict__.items())
     ...     log.append(items)
     ...     mydata.number = 11
     ...     log.append(mydata.number)

     >>> import threading
     >>> thread = threading.Thread(target=f)
     >>> thread.start()
     >>> thread.join()
     >>> log
     [[], 11]

we get different data.  Furthermore, changes made in the other thread
don't affect data seen in this thread:

     >>> mydata.number
     42

Of course, values you get from a *note local: 185f. object, including
their *note __dict__: 77d. attribute, are for whatever thread was
current at the time the attribute was read.  For that reason, you
generally don't want to save these values across threads, as they apply
only to the thread they came from.

You can create custom *note local: 185f. objects by subclassing the
*note local: 185f. class:

     >>> class MyLocal(local):
     ...     number = 2
     ...     def __init__(self, /, **kw):
     ...         self.__dict__.update(kw)
     ...     def squared(self):
     ...         return self.number ** 2

This can be useful to support default values, methods and
initialization.  Note that if you define an *note __init__(): 8bf.
method, it will be called each time the *note local: 185f. object is
used in a separate thread.  This is necessary to initialize each
thread's dictionary.

Now if we create a *note local: 185f. object:

     >>> mydata = MyLocal(color='red')

we have a default number:

     >>> mydata.number
     2

an initial color:

     >>> mydata.color
     'red'
     >>> del mydata.color

And a method that operates on the data:

     >>> mydata.squared()
     4

As before, we can access the data in a separate thread:

     >>> log = []
     >>> thread = threading.Thread(target=f)
     >>> thread.start()
     >>> thread.join()
     >>> log
     [[('color', 'red')], 11]

without affecting this thread's data:

     >>> mydata.number
     2
     >>> mydata.color
     Traceback (most recent call last):
     ...
     AttributeError: 'MyLocal' object has no attribute 'color'

Note that subclasses can define *note __slots__: 7f7, but they are not
thread local.  They are shared across threads:

     >>> class MyLocal(local):
     ...     __slots__ = 'number'

     >>> mydata = MyLocal()
     >>> mydata.number = 42
     >>> mydata.color = 'red'

So, the separate thread:

     >>> thread = threading.Thread(target=f)
     >>> thread.start()
     >>> thread.join()

affects what we see:

     >>> mydata.number
     11

 -- クラス: threading.local

     スレッドローカルデータを表現するクラス。


File: python.info,  Node: Thread objects,  Next: Lock objects,  Prev: Thread-local data,  Up: リファレンス<2>

5.18.1.5 Thread objects
.......................

The *note Thread: 176. class represents an activity that is run in a
separate thread of control.  There are two ways to specify the activity:
by passing a callable object to the constructor, or by overriding the
*note run(): c31. method in a subclass.  No other methods (except for
the constructor) should be overridden in a subclass.  In other words,
'only' override the ‘__init__()’ and *note run(): c31. methods of this
class.

ひとたびスレッドオブジェクトを生成すると、スレッドの *note start(): 178.
メソッドを呼び出して活動を開始しなければなりません。 ‘start()’ メソッド
はそれぞれのスレッドの *note run(): c31. メソッドを起動します。

スレッドの活動が始まると、スレッドは '生存中 (alive)' とみなされます。 ス
レッドは、通常 *note run(): c31. メソッドが終了するまで、もしくは捕捉さ
れない例外が送出されるまで生存中となります。 *note is_alive(): b46. メソ
ッドは、スレッドが生存中であるかどうか調べます。

スレッドは他のスレッドの *note join(): 13fd. メソッドを呼び出すことがで
きます。このメソッドは、 *note join(): 13fd. メソッドを呼ばれたスレッド
が終了するまでメソッドの呼び出し元のスレッドをブロックします。

スレッドは名前を持っています。名前はコンストラクタに渡すことができ、
*note name: 2a0. 属性を通して読み出したり変更したりできます。

*note run(): c31. メソッドが例外を発生させた場合、*note
threading.excepthook(): a4b. が呼び出され、例外を処理します。デフォルト
では、*note threading.excepthook(): a4b. は *note SystemExit: f3c. を黙
殺します。

スレッドには "デーモンスレッド (daemon thread)" であるというフラグを立て
られます。 このフラグには、残っているスレッドがデーモンスレッドだけにな
った時に Python プログラム全体を終了させるという意味があります。フラグの
初期値はスレッドを生成したスレッドから継承します。フラグの値は *note
daemon: 35c. プロパティまたは 'daemon' コンストラクタ引数を通して設定で
きます。

     注釈: デーモンスレッドは終了時にいきなり停止されます。デーモンスレ
     ッドで使われたリソース (開いているファイル、データベースのトランザ
     クションなど) は適切に解放されないかもしれません。きちんと
     (gracefully) スレッドを停止したい場合は、スレッドを非デーモンスレッ
     ドにして、*note Event: 1370. のような適切なシグナル送信機構を使用し
     てください。

スレッドには "主スレッド (main thread)" オブジェクトがあります。主スレッ
ドは Python プログラムを最初に制御していたスレッドです。主スレッドはデー
モンスレッドではありません。

"ダミースレッドオブジェクト (dummy thread objects)" が作成される場合があ
ります。ダミースレッドは、 "外来スレッド (alien thread)" に相当するスレ
ッドオブジェクトです。ダミースレッドは、C コードから直接生成されたスレッ
ドのような、 *note threading: f3. モジュールの外で開始された処理スレッド
です。ダミースレッドオブジェクトには限られた機能しかなく、常に生存中、か
つデーモンスレッドであるとみなされ、 *note join: 361e. できません。また
、外来スレッドの終了を検出するのは不可能なので、ダミースレッドは削除でき
ません。

 -- クラス: threading.Thread (group=None, target=None, name=None,
          args=(), kwargs={}, *, daemon=None, context=None)

     コンストラクタは常にキーワード引数を使って呼び出さなければなりませ
     ん。各引数は以下の通りです:

     'group' should be ‘None’; reserved for future extension when a
     ‘ThreadGroup’ class is implemented.

     'target' は *note run(): c31. メソッドによって起動される呼び出し可
     能オブジェクトです。デフォルトでは何も呼び出さないことを示す ‘None’
     になっています。

     'name*はスレッド名です。デフォルトでは、"Thread-*N'"('N*は小さな
     10進数)、または*target*引数が指定された場合"Thread-*N'
     (target)"("target"は''target.__name__'')という形式でユニークな名前
     が構成される。

     'args' は 'target' を呼び出すときの引数のリストかタプルです。デフォ
     ルトは ‘()’ です。

     'kwargs' は 'target' を呼び出すときのキーワード引数の辞書です。デフ
     ォルトは ‘{}’ です。

     ‘None’ でない場合、'daemon' はスレッドがデーモンかどうかを明示的に
     設定します。‘None’ の場合 (デフォルト)、デーモン属性は現在のスレッ
     ドから継承されます。

     'context' is the *note Context: 177. value to use when starting the
     thread.  The default value is ‘None’ which indicates that the *note
     sys.flags.thread_inherit_context: 175. flag controls the behaviour.
     If the flag is true, threads will start with a copy of the context
     of the caller of *note start(): 178.  If false, they will start
     with an empty context.  To explicitly start with an empty context,
     pass a new instance of *note Context(): 177.  To explicitly start
     with a copy of the current context, pass the value from *note
     copy_context(): 361f.  The flag defaults true on free-threaded
     builds and false otherwise.

     サブクラスでコンストラクタをオーバライドした場合、必ずスレッドが何
     かを始める前に基底クラスのコンストラクタ (‘Thread.__init__()’) を呼
     び出しておかなくてはなりません。

     バージョン 3.3 で変更: Added the 'daemon' parameter.

     バージョン 3.10 で変更: 'name' 引数が省略された場合、'target' 名を
     使用します。

     バージョン 3.14 で変更: 'context' パラメータを追加しました。

      -- メソッド: start ()

          スレッドの活動を開始します。

          このメソッドは、スレッドオブジェクトあたり一度しか呼び出しては
          なりません。 *note start(): 178. は、オブジェクトの *note
          run(): c31. メソッドが個別の処理スレッド中で呼び出されるように
          調整します。

          同じスレッドオブジェクトに対し、このメソッドを2回以上呼び出し
          た場合、 *note RuntimeError: 244. を送出します。

          If supported, set the operating system thread name to *note
          threading.Thread.name: 2a0.  The name can be truncated
          depending on the operating system thread name limits.

          バージョン 3.14 で変更: Set the operating system thread name.

      -- メソッド: run ()

          スレッドの活動をもたらすメソッドです。

          このメソッドはサブクラスでオーバライドできます。標準の *note
          run(): c31. メソッドでは、オブジェクトのコンストラクタの
          'target' 引数に呼び出し可能オブジェクトを指定した場合、 'args'
          および 'kwargs' の位置引数およびキーワード引数とともに呼び出し
          ます。

          *note Thread: 176. に渡される 'args' の引数にリストやタプルを
          使っても、同じ効果が得られます。

          以下はプログラム例です:

               >>> from threading import Thread
               >>> t = Thread(target=print, args=[1])
               >>> t.run()
               1
               >>> t = Thread(target=print, args=(1,))
               >>> t.run()
               1

      -- メソッド: join (timeout=None)

          スレッドが終了するまで待機します。 このメソッドは、 *note
          join(): 13fd. を呼ばれたスレッドが正常終了あるいは処理されない
          例外によって終了するか、オプションのタイムアウトが発生するまで
          、メソッドの呼び出し元のスレッドをブロックします。

          When the 'timeout' argument is present and not ‘None’, it
          should be a floating-point number specifying a timeout for the
          operation in seconds (or fractions thereof).  As *note join():
          13fd. always returns ‘None’, you must call *note is_alive():
          b46. after *note join(): 13fd. to decide whether a timeout
          happened - if the thread is still alive, the *note join():
          13fd. call timed out.

          'timeout' が指定されないかまたは ‘None’ であるときは、この操作
          はスレッドが終了するまでブロックします。

          1つのスレッドは何回も join されることができます。

          現在のスレッドに対して *note join(): 13fd. を呼び出そうとする
          と、デッドロックを引き起こすため *note RuntimeError: 244. が送
          出されます。 スレッドが開始される前に *note join(): 13fd. を呼
          び出すことも同様のエラーのため、同じ例外が送出されます。

          If an attempt is made to join a running daemonic thread in
          late stages of *note Python finalization: 479. ‘join()’ raises
          a *note PythonFinalizationError: 47a.

          バージョン 3.14 で変更: May raise *note
          PythonFinalizationError: 47a.

      -- の属性: name

          識別のためにのみ用いられる文字列です。名前には機能上の意味づけ
          (semantics) はありません。複数のスレッドに同じ名前をつけてもか
          まいません。名前の初期値はコンストラクタで設定されます。

          On some platforms, the thread name is set at the operating
          system level when the thread starts, so that it is visible in
          task managers.  This name may be truncated to fit in a
          system-specific limit (for example, 15 bytes on Linux or 63
          bytes on macOS).

          Changes to 'name' are only reflected at the OS level when the
          currently running thread is renamed.  (Setting the 'name'
          attribute of a different thread only updates the Python Thread
          object.)

      -- メソッド: getName ()
      -- メソッド: setName ()

          *note name: 2a0. に対する非推奨 getter/setter API; 代わりにプ
          ロパティを直接使用してください。

          バージョン 3.10 で非推奨.

      -- の属性: ident

          'スレッド識別子' 、または、スレッドが開始されていなければ
          ‘None’ です。非ゼロの整数です。 *note get_ident(): 1372. 関数
          を参照下さい。スレッド識別子は、スレッドが終了した後、新たなス
          レッドが生成された場合、再利用され得ます。スレッド識別子は、ス
          レッドが終了した後でも利用できます。

      -- の属性: native_id

          The Thread ID (‘TID’) of this thread, as assigned by the OS
          (kernel).  This is a non-negative integer, or ‘None’ if the
          thread has not been started.  See the *note get_native_id():
          c32. function.  This value may be used to uniquely identify
          this particular thread system-wide (until the thread
          terminates, after which the value may be recycled by the OS).

               注釈: Similar to Process IDs, Thread IDs are only valid
               (guaranteed unique system-wide) from the time the thread
               is created until the thread has been terminated.

          *note Availability: 213f.: Windows, FreeBSD, Linux, macOS,
          OpenBSD, NetBSD, AIX, DragonFlyBSD.

          Added in version 3.8.

      -- メソッド: is_alive ()

          スレッドが生存中かどうかを返します。

          このメソッドは、 *note run(): c31. メソッドが起動する直前から
          *note run(): c31. メソッドが終了する直後までの間 ‘True’ を返し
          ます。モジュール関数 *note enumerate(): 1c5a. は、全ての生存中
          のスレッドのリストを返します。

      -- の属性: daemon

          このスレッドがデーモンスレッドか (‘True’) か否か (‘False’) を
          示すブール値。この値は *note start(): 178. の呼び出し前に設定
          されなければなりません。さもなければ *note RuntimeError: 244.
          が送出されます。初期値は生成側のスレッドから継承されます; メイ
          ンスレッドはデーモンスレッドではないので、メインスレッドで作成
          されたすべてのスレッドは、デフォルトで *note daemon: 35c. =
          ‘False’ になります。

          デーモンでない生存中のスレッドが全てなくなると、 Python プログ
          ラム全体が終了します。

      -- メソッド: isDaemon ()
      -- メソッド: setDaemon ()

          *note daemon: 35c. に対する非推奨 getter/setter API; 代わりに
          プロパティを直接使用してください。

          バージョン 3.10 で非推奨.


File: python.info,  Node: Lock objects,  Next: RLock objects,  Prev: Thread objects,  Up: リファレンス<2>

5.18.1.6 Lock objects
.....................

プリミティブロックとは、ロックが生じた際に特定のスレッドによって所有され
ない同期プリミティブです。 Python では現在のところ拡張モジュール *note
_thread: 2. で直接実装されている最も低水準の同期プリミティブを使えます。

プリミティブロックは2つの状態、 "ロック" または "アンロック" があります
。ロックはアンロック状態で作成されます。ロックには基本となる二つのメソッ
ド、 *note acquire(): 8a7. と *note release(): 14da. があります。ロック
の状態がアンロックである場合、 *note acquire(): 8a7. は状態をロックに変
更して即座に処理を戻します。 状態がロックの場合、 *note acquire(): 8a7.
は他のスレッドが *note release(): 14da. を呼び出してロックの状態をアンロ
ックに変更するまでブロックします。その後、 *note acquire(): 8a7. 呼び出
しは状態を再度ロックに設定してから処理を戻します。 *note release():
14da. メソッドを呼び出すのはロック状態のときでなければなりません; このメ
ソッドはロックの状態をアンロックに変更して、即座に処理を戻します。 アン
ロックの状態のロックを解放しようとすると *note RuntimeError: 244. が送出
されます。

ロックは *note コンテキストマネージメントプロトコル: 3624. もサポートし
ます。

複数のスレッドにおいて *note acquire(): 8a7. がアンロック状態への遷移を
待っているためにブロックが起きている時に *note release(): 14da. を呼び出
してロックの状態をアンロックにすると、一つのスレッドだけが処理を進行でき
ます。 どのスレッドが処理を進行できるのかは定義されておらず、実装によっ
て異なるかもしれません。

全てのメソッドはアトミックに実行されます。

 -- クラス: threading.Lock

     プリミティブロック (primitive lock) オブジェクトを実装しているクラ
     スです。スレッドが一度ロックを獲得すると、それ以後のロック獲得の試
     みはロックが解放されるまでブロックします。どのスレッドでもロックを
     解放できます。

     バージョン 3.13 で変更: ‘Lock’ is now a class.  In earlier Pythons,
     ‘Lock’ was a factory function which returned an instance of the
     underlying private lock type.

      -- メソッド: acquire (blocking=True, timeout=-1)

          ブロックあり、またはブロックなしでロックを獲得します。

          引数 'blocking' を ‘True’ (デフォルト) に設定して呼び出した場
          合、ロックがアンロック状態になるまでブロックします。そしてそれ
          をロック状態にしてから ‘True’ を返します。

          引数 'blocking' の値を ‘False’ にして呼び出すとブロックしませ
          ん。'blocking' を ‘True’ にして呼び出した場合にブロックするよ
          うな状況では、直ちに ‘False’ を返します。それ以外の場合には、
          ロックをロック状態にして ‘True’ を返します。

          正の値に設定された浮動小数点の 'timeout' 引数とともに起動され
          た場合、ロックを得られなければ最大で 'timeout' によって指定さ
          れた秒数だけブロックします。'timeout' 引数の ‘-1’ は無制限の待
          機を指定します。'blocking' が ‘False’ の場合に 'timeout' を指
          定することは禁止されています。

          ロックを獲得すると ‘True’ を、ロックを獲得できなかったとき (例
          えば 'timeout' が過ぎた場合) には ‘False’ を返します。

          バージョン 3.2 で変更: 新しい 'timeout' 引数。

          バージョン 3.2 で変更: Lock acquisition can now be interrupted
          by signals on POSIX if the underlying threading implementation
          supports it.

          バージョン 3.14 で変更: Lock acquisition can now be
          interrupted by signals on Windows.

      -- メソッド: release ()

          ロックを解放します。これはロックを獲得したスレッドだけでなく、
          任意のスレッドから呼ぶことができます。

          ロックの状態がロックのとき、状態をアンロックにリセットして処理
          を戻します。他のスレッドがロックがアンロック状態になるのを待っ
          てブロックしている場合、ただ一つのスレッドだけが処理を継続でき
          るようにします。

          アンロック状態のロックに対して呼び出された場合、*note
          RuntimeError: 244. が送出されます。

          戻り値はありません。

      -- メソッド: locked ()

          ロック状態のとき ‘True’ を返します。


File: python.info,  Node: RLock objects,  Next: Condition objects,  Prev: Lock objects,  Up: リファレンス<2>

5.18.1.7 RLock objects
......................

再入可能ロック (reentrant lock) とは、同じスレッドが複数回獲得できるよう
な同期プリミティブです。再入可能ロックの内部では、プリミティブロックの使
うロック／アンロック状態に加え、 "所有スレッド (owning thread)" と "再帰
レベル (recursion level)" という概念を用いています。ロック状態では何らか
のスレッドがロックを所有しており、アンロック状態ではいかなるスレッドもロ
ックを所有していません。

Threads call a lock's *note acquire(): 107b. method to lock it, and its
*note release(): 14da. method to unlock it.

     注釈: Reentrant locks support the *note context management
     protocol: 3624, so it is recommended to use *note with: 186.
     instead of manually calling *note acquire(): 107b. and *note
     release(): 3628. to handle acquiring and releasing the lock for a
     block of code.

RLock's *note acquire(): 107b./*note release(): 3628. call pairs may be
nested, unlike Lock's *note acquire(): 8a7./*note release(): 14da.  Only
the final *note release(): 3628. (the *note release(): 14da. of the
outermost pair) resets the lock to an unlocked state and allows another
thread blocked in *note acquire(): 107b. to proceed.

*note acquire(): 107b./*note release(): 3628. must be used in pairs:
each acquire must have a release in the thread that has acquired the
lock.  Failing to call release as many times the lock has been acquired
can lead to deadlock.

 -- クラス: threading.RLock

     このクラスは再入可能ロックオブジェクトを実装します。再入可能ロック
     はそれを獲得したスレッドによって解放されなければなりません。いった
     んスレッドが再入可能ロックを獲得すると、同じスレッドはブロックされ
     ずにもう一度それを獲得できます ; そのスレッドは獲得した回数だけ解放
     しなければいけません。

     ‘RLock’ は実際にはファクトリ関数で、プラットフォームでサポートされ
     る最も効率的なバージョンの具体的な RLock クラスのインスタンスを返す
     ことに注意してください。

      -- メソッド: acquire (blocking=True, timeout=-1)

          ブロックあり、またはブロックなしでロックを獲得します。

          参考
          ....

          *note Using RLock as a context manager: 3624.

               Recommended over manual ‘acquire()’ and *note release():
               3628. calls whenever practical.

          When invoked with the 'blocking' argument set to ‘True’ (the
          default):

                  * If no thread owns the lock, acquire the lock and
                    return immediately.

                  * If another thread owns the lock, block until we are
                    able to acquire lock, or 'timeout', if set to a
                    positive float value.

                  * If the same thread owns the lock, acquire the lock
                    again, and return immediately.  This is the
                    difference between *note Lock: 19f4. and ‘RLock’;
                    *note Lock: 19f4. handles this case the same as the
                    previous, blocking until the lock can be acquired.

          When invoked with the 'blocking' argument set to ‘False’:

                  * If no thread owns the lock, acquire the lock and
                    return immediately.

                  * If another thread owns the lock, return immediately.

                  * If the same thread owns the lock, acquire the lock
                    again and return immediately.

          In all cases, if the thread was able to acquire the lock,
          return ‘True’.  If the thread was unable to acquire the lock
          (i.e.  if not blocking or the timeout was reached) return
          ‘False’.

          If called multiple times, failing to call *note release():
          3628. as many times may lead to deadlock.  Consider using
          ‘RLock’ as a context manager rather than calling
          acquire/release directly.

          バージョン 3.2 で変更: 新しい 'timeout' 引数。

      -- メソッド: release ()

          再帰レベルをデクリメントしてロックを解放します。デクリメント後
          に再帰レベルがゼロになった場合、ロックの状態をアンロック (いか
          なるスレッドにも所有されていない状態) にリセットし、ロックの状
          態がアンロックになるのを待ってブロックしているスレッドがある場
          合にはその中のただ一つだけが処理を進行できるようにします。デク
          リメント後も再帰レベルがゼロでない場合、ロックの状態はロックの
          ままで、呼び出し側のスレッドに所有されたままになります。

          Only call this method when the calling thread owns the lock.
          A *note RuntimeError: 244. is raised if this method is called
          when the lock is not acquired.

          戻り値はありません。

      -- メソッド: locked ()

          Return a boolean indicating whether this object is locked
          right now.

          Added in version 3.14.


File: python.info,  Node: Condition objects,  Next: Semaphore objects,  Prev: RLock objects,  Up: リファレンス<2>

5.18.1.8 Condition objects
..........................

条件変数 (condition variable) は、常にある種のロックに関連付けられていま
す; このロックは明示的に渡すことも、デフォルトで生成させることもできます
。複数の条件変数で同じロックを共有しなければならない場合には、引渡しによ
る関連付けが便利です。ロックは条件オブジェクトの一部です: それを別々に扱
う必要はありません。

条件変数は *note コンテキスト管理プロトコル: 3624. に従います: ‘with’ 文
を使って囲まれたブロックの間だけ関連付けられたロックを獲得することができ
ます。 *note acquire(): 362b. メソッドと *note release(): 362c. メソッド
は、さらに関連付けられたロックの対応するメソッドを呼び出します。

他のメソッドは、関連付けられたロックを保持した状態で呼び出さなければなり
ません。 *note wait(): 1c66. メソッドはロックを解放します。そして別のス
レッドが *note notify(): 1b66. または *note notify_all(): 359. を呼ぶこ
とによってスレッドを起こすまでブロックします。一旦起こされたなら、 *note
wait(): 1c66. は再びロックを得て戻ります。タイムアウトを指定することも可
能です。

*note notify(): 1b66. メソッドは条件変数待ちのスレッドを1つ起こします。
*note notify_all(): 359. メソッドは条件変数待ちの全てのスレッドを起こし
ます。

注意: *note notify(): 1b66. と *note notify_all(): 359. はロックを解放し
ません; 従って、スレッドが起こされたとき、 *note wait(): 1c66. の呼び出
しは即座に処理を戻すわけではなく、 *note notify(): 1b66. または *note
notify_all(): 359. を呼び出したスレッドが最終的にロックの所有権を放棄し
たときに初めて処理を返すのです。

条件変数を使う典型的なプログラミングスタイルでは、何らかの共有された状態
変数へのアクセスを同期させるためにロックを使います; 状態変数が特定の状態
に変化したことを知りたいスレッドは、自分の望む状態になるまで繰り返し
*note wait(): 1c66. を呼び出します。その一方で、状態変更を行うスレッドは
、前者のスレッドが待ち望んでいる状態であるかもしれないような状態へ変更を
行ったときに *note notify(): 1b66. や *note notify_all(): 359. を呼び出
します。例えば、以下のコードは無制限のバッファ容量のときの一般的な生産者
-消費者問題です:

     # Consume one item
     with cv:
         while not an_item_is_available():
             cv.wait()
         get_an_available_item()

     # Produce one item
     with cv:
         make_an_item_available()
         cv.notify()

アプリケーションの条件をチェックする ‘while’ ループは必須です。なぜなら
、 *note wait(): 1c66. が任意の長時間の後で返り、 *note notify(): 1b66.
呼び出しを促した条件がもはや真でないことがありえるからです。これはマルチ
スレッドプログラミングに固有です。条件チェックを自動化するために *note
wait_for(): 362d. メソッドを使うことができ、それはタイムアウトの計算を簡
略化します:

     # Consume an item
     with cv:
         cv.wait_for(an_item_is_available)
         get_an_available_item()

*note notify(): 1b66. と *note notify_all(): 359. のどちらを使うかは、そ
の状態の変化に興味を持っている待ちスレッドが一つだけなのか、あるいは複数
なのかで考えます。例えば、典型的な生産者-消費者問題では、バッファに1つの
要素を加えた場合には消費者スレッドを 1 つしか起こさなくてかまいません。

 -- クラス: threading.Condition (lock=None)

     このクラスは条件変数 (condition variable) オブジェクトを実装します
     。条件変数を使うと、1つ以上のスレッドを別のスレッドの通知があるまで
     待機させておけます。

     'lock' に ‘None’ でない値を指定した場合、その値は *note Lock: 19f4.
     または *note RLock: 32e. オブジェクトでなければなりません。 この場
     合、 'lock' は根底にあるロックオブジェクトとして使われます。 それ以
     外の場合には、 *note RLock: 32e. オブジェクトを新しく作成して使いま
     す。

     バージョン 3.3 で変更: ファクトリ関数からクラスに変更されました。

      -- メソッド: acquire (*args)

          根底にあるロックを獲得します。このメソッドは根底にあるロックの
          対応するメソッドを呼び出します。そのメソッドの戻り値を返します
          。

      -- メソッド: release ()

          根底にあるロックを解放します。このメソッドは根底にあるロックの
          対応するメソッドを呼び出します。戻り値はありません。

      -- メソッド: locked ()

          Return a boolean indicating whether this object is locked
          right now.

          Added in version 3.14.

      -- メソッド: wait (timeout=None)

          通知 (notify) を受けるか、タイムアウトするまで待機します。呼び
          出し側のスレッドがロックを獲得していないときにこのメソッドを呼
          び出すと *note RuntimeError: 244. が送出されます。

          このメソッドは根底にあるロックを解放し、他のスレッドが同じ条件
          変数に対して *note notify(): 1b66. または *note notify_all():
          359. を呼び出して現在のスレッドを起こすか、オプションのタイム
          アウトが発生するまでブロックします。一度スレッドが起こされると
          、再度ロックを獲得して処理を戻します。

          When the 'timeout' argument is present and not ‘None’, it
          should be a floating-point number specifying a timeout for the
          operation in seconds (or fractions thereof).

          根底にあるロックが *note RLock: 32e. である場合、 *note
          release(): 362c. メソッドではロックは解放されません。というの
          も、ロックが再帰的に複数回獲得されている場合には、 *note
          release(): 362c. によって実際にアンロックが行われないかもしれ
          ないからです。その代わり、ロックが再帰的に複数回獲得されていて
          も確実にアンロックを行える *note RLock: 32e. クラスの内部イン
          ターフェースを使います。その後ロックを再獲得する時に、もう一つ
          の内部インターフェースを使ってロックの再帰レベルを復帰します。

          与えられた 'timeout' が過ぎていなければ返り値は ‘True’ です。
          タイムアウトした場合には ‘False’ が返ります。

          バージョン 3.2 で変更: 以前は、このメソッドは常に ‘None’ を返
          していました。

      -- メソッド: wait_for (predicate, timeout=None)

          条件が真と判定されるまで待ちます。 'predicate' は呼び出し可能
          オブジェクトでなければならず、その結果はブール値として解釈され
          ます。 最大の待ち時間を指定する 'timeout' を与えることができま
          す。

          このユーティリティメソッドは、述語が満たされるかタイムアウトが
          発生するまで *note wait(): 1c66. を繰り返し呼び出す場合があり
          ます。戻り値は述語の最後の戻り値で、もしメソッドがタイムアウト
          すれば、 ‘False’ と評価されます。

          タイムアウト機能を無視すれば、このメソッドの呼び出しは以下のよ
          うに書くのとほぼ等価です:

               while not predicate():
                   cv.wait()

          したがって、 *note wait(): 1c66. と同じルールが適用されます: 呼
          び出された時にロックを保持していなければならず、戻るときにロッ
          クが再度獲得されます。述語はロックを保持した状態で評価されます
          。

          Added in version 3.2.

      -- メソッド: notify (n=1)

          デフォルトで、この条件変数を待っている1つのスレッドを起こしま
          す。 呼び出し側のスレッドがロックを獲得していないときにこのメ
          ソッドを呼び出すと *note RuntimeError: 244. が送出されます。

          何らかの待機中スレッドがある場合、そのうち 'n' スレッドを起こ
          します。待機中のスレッドがなければ何もしません。

          現在の実装では、少なくとも 'n' スレッドが待機中であれば、ちょ
          うど 'n' スレッドを起こします。とはいえ、この挙動に依存するの
          は安全ではありません。将来、実装の最適化によって、複数のスレッ
          ドを起こすようになるかもしれないからです。

          注意: 起こされたスレッドは実際にロックを再獲得できるまで *note
          wait(): 1c66. 呼び出しから戻りません。 *note notify(): 1b66. は
          ロックを解放しないので、 *note notify(): 1b66. 呼び出し側は明
          示的にロックを解放しなければなりません。

      -- メソッド: notify_all ()

          この条件を待っているすべてのスレッドを起こします。このメソッド
          は *note notify(): 1b66. のように動作しますが、 1 つではなくす
          べての待ちスレッドを起こします。呼び出し側のスレッドがロックを
          獲得していない場合、 *note RuntimeError: 244. が送出されます。

          関数''notifyAll''はこの関数の非推奨エイリアスです。


File: python.info,  Node: Semaphore objects,  Next: Semaphore example,  Prev: Condition objects,  Up: リファレンス<2>

5.18.1.9 Semaphore objects
..........................

セマフォ (semaphore) は、計算機科学史上最も古い同期プリミティブの一つ で
、草創期のオランダ計算機科学者 Edsger W. Dijkstra によって発明されました
(彼は *note acquire(): 146b. と *note release(): 3631. の代わりに ‘P()’
と ‘V()’ を使いました)。

セマフォは *note acquire(): 146b. でデクリメントされ *note release():
3631. でインクリメントされるような内部カウンタを管理します。 カウンタは
決してゼロより小さくはなりません; *note acquire(): 146b. は、カウンタが
ゼロになっている場合、他のスレッドが *note release(): 3631. を呼び出すま
でブロックします。

セマフォは *note コンテキストマネージメントプロトコル: 3624. もサポート
します。

 -- クラス: threading.Semaphore (value=1)

     このクラスはセマフォ (semaphore) オブジェクトを実装します。セマフォ
     は、 *note release(): 3631. を呼び出した数から *note acquire():
     146b. を呼び出した数を引き、初期値を足した値を表す極小のカウンタを
     管理します。 *note acquire(): 146b. メソッドは、カウンタの値を負に
     せずに処理を戻せるまで必要ならば処理をブロックします。 'value' を指
     定しない場合、デフォルトの値は 1 になります。

     オプションの引数には、内部カウンタの初期値を指定します。デフォルト
     は ‘1’ です。与えられた 'value' が 0 より小さい場合、 *note
     ValueError: 2ec. が送出されます。

     バージョン 3.3 で変更: ファクトリ関数からクラスに変更されました。

      -- メソッド: acquire (blocking=True, timeout=None)

          セマフォを獲得します。

          When invoked without arguments:

             * If the internal counter is larger than zero on entry,
               decrement it by one and return ‘True’ immediately.

             * If the internal counter is zero on entry, block until
               awoken by a call to *note release(): 3631.  Once awoken
               (and the counter is greater than 0), decrement the
               counter by 1 and return ‘True’.  Exactly one thread will
               be awoken by each call to *note release(): 3631.  The
               order in which threads are awoken should not be relied
               on.

          'blocking' を ‘False’ にして呼び出すとブロックしません。引数な
          しで呼び出した場合にブロックするような状況であった場合には直ち
          に ‘False’ を返します。それ以外の場合には、引数なしで呼び出し
          たときと同じ処理を行い ‘True’ を返します。

          ‘None’ 以外の 'timeout' で起動された場合、最大で 'timeout' 秒
          ブロックします。 acquire が その間隔の間で完了しなかった場合は
          ‘False’ が返ります。そうでなければ ‘True’ が返ります。

          バージョン 3.2 で変更: 新しい 'timeout' 引数。

      -- メソッド: release (n=1)

          内部カウンタを 'n' インクリメントして、セマフォを解放します。
          ‘release()’ 処理に入ったときにカウンタがゼロであり、カウンタの
          値がゼロより大きくなるのを待っている別のスレッドがあった場合、
          それらのスレッドから 'n' 個を起こします。

          バージョン 3.9 で変更: 複数の待機中のスレッドを一度に解放する
          'n' パラメータを追加しました。

 -- クラス: threading.BoundedSemaphore (value=1)

     有限セマフォ (bounded semaphore) オブジェクトを実装しているクラスで
     す。有限セマフォは、現在の値が初期値を超過しないようチェックを行い
     ます。超過を起こした場合、 *note ValueError: 2ec. を送出します。た
     いていの場合、セマフォは限られた容量のリソースを保護するために使わ
     れるものです。従って、あまりにも頻繁なセマフォの解放はバグが生じて
     いるしるしです。 'value' を指定しない場合、デフォルトの値は 1 にな
     ります。

     バージョン 3.3 で変更: ファクトリ関数からクラスに変更されました。


File: python.info,  Node: Semaphore example,  Next: Event objects,  Prev: Semaphore objects,  Up: リファレンス<2>

5.18.1.10 ‘Semaphore’ example
.............................

セマフォはしばしば、容量に限りのある資源、例えばデータベースサーバなどを
保護するために使われます。リソースが固定の状況では、常に有限セマフォを使
わなければなりません。主スレッドは、作業スレッドを立ち上げる前にセマフォ
を初期化します:

     maxconnections = 5
     # ...
     pool_sema = BoundedSemaphore(value=maxconnections)

作業スレッドは、ひとたび立ち上がると、サーバへ接続する必要が生じたときに
セマフォの ‘acquire()’ および ‘release()’ メソッドを呼び出します:

     with pool_sema:
         conn = connectdb()
         try:
             # ... use connection ...
         finally:
             conn.close()

有限セマフォを使うと、セマフォを獲得回数以上に解放してしまうというプログ
ラム上の間違いを見逃しにくくします。


File: python.info,  Node: Event objects,  Next: Timer objects,  Prev: Semaphore example,  Up: リファレンス<2>

5.18.1.11 Event objects
.......................

イベントは、あるスレッドがイベントを発信し、他のスレッドはそれを待つとい
う、スレッド間で通信を行うための最も単純なメカニズムの一つです。

イベントオブジェクトは内部フラグを管理します。このフラグは *note set():
3636. メソッドで値を true に、 *note clear(): 3637. メソッドで値を false
にリセットします。 *note wait(): 153e. メソッドはフラグが true になるま
でブロックします。

 -- クラス: threading.Event

     イベントオブジェクトを実装しているクラスです。イベントは *note
     set(): 3636. メソッドを使うと *note True: e07. に、 *note clear():
     3637. メソッドを使うと *note False: d2b. にセットされるようなフラグ
     を管理します。 *note wait(): 153e. メソッドは、全てのフラグが true
     になるまでブロックするようになっています。フラグの初期値は false で
     す。

     バージョン 3.3 で変更: ファクトリ関数からクラスに変更されました。

      -- メソッド: is_set ()

          内部フラグが真のとき ‘True’ を返します。

          メソッド ‘isSet’ はこのメソッドの非推奨エイリアスです。

      -- メソッド: set ()

          内部フラグの値を true にセットします。フラグの値が true になる
          のを待っている全てのスレッドを起こします。一旦フラグが true に
          なると、スレッドが *note wait(): 153e. を呼び出しても全くブロ
          ックしなくなります。

      -- メソッド: clear ()

          内部フラグの値を false にリセットします。以降は、 *note set():
          3636. を呼び出して再び内部フラグの値を true にセットするまで、
          *note wait(): 153e. を呼び出したスレッドはブロックするようにな
          ります。

      -- メソッド: wait (timeout=None)

          Block as long as the internal flag is false and the timeout,
          if given, has not expired.  The return value represents the
          reason that this blocking method returned; ‘True’ if returning
          because the internal flag is set to true, or ‘False’ if a
          timeout is given and the internal flag did not become true
          within the given wait time.

          When the timeout argument is present and not ‘None’, it should
          be a floating-point number specifying a timeout for the
          operation in seconds, or fractions thereof.

          バージョン 3.1 で変更: 以前は、このメソッドは常に ‘None’ を返
          していました。


File: python.info,  Node: Timer objects,  Next: Barrier objects,  Prev: Event objects,  Up: リファレンス<2>

5.18.1.12 Timer objects
.......................

このクラスは、一定時間経過後に実行される活動、すなわちタイマ活動を表現し
ます。 *note Timer: 1371. は *note Thread: 176. のサブクラスであり、自作
のスレッドを構築した一例でもあります。

Timers are started, as with threads, by calling their *note Timer.start:
178. method.  The timer can be stopped (before its action has begun) by
calling the *note cancel(): 363a. method.  The interval the timer will
wait before executing its action may not be exactly the same as the
interval specified by the user.

例えば:

     def hello():
         print("hello, world")

     t = Timer(30.0, hello)
     t.start()  # after 30 seconds, "hello, world" will be printed

 -- クラス: threading.Timer (interval, function, args=None, kwargs=None)

     'interval' 秒後に引数 'args' キーワード引数 'kwargs' で 'function'
     を実行するようなタイマを生成します。'args*が ''None'' (デフォルト)
     なら空のリストが使用されます。*kwargs' が ‘None’ (デフォルト) なら
     空の辞書が使用されます。

     バージョン 3.3 で変更: ファクトリ関数からクラスに変更されました。

      -- メソッド: cancel ()

          タイマをストップして、その動作の実行をキャンセルします。このメ
          ソッドはタイマがまだ活動待ち状態にある場合にのみ動作します。


File: python.info,  Node: Barrier objects,  Prev: Timer objects,  Up: リファレンス<2>

5.18.1.13 Barrier objects
.........................

Added in version 3.2.

このクラスは、互いを待つ必要のある固定の数のスレッドで使用するための単純
な同期プリミティブを提供します。それぞれのスレッドは *note wait(): 363c.
メソッドを呼ぶことによりバリアを通ろうとしてブロックします。すべてのスレ
ッドがそれぞれの *note wait(): 363c. メソッドを呼び出した時点で、すべて
のスレッドが同時に解放されます。

バリアは同じ数のスレッドに対して何度でも再利用することができます。

例として、クライアントとサーバの間でスレッドを同期させる単純な方法を紹介
します:

     b = Barrier(2, timeout=5)

     def server():
         start_server()
         b.wait()
         while True:
             connection = accept_connection()
             process_server_connection(connection)

     def client():
         b.wait()
         while True:
             connection = make_connection()
             process_client_connection(connection)

 -- クラス: threading.Barrier (parties, action=None, timeout=None)

     'parties' 個のスレッドのためのバリアオブジェクトを作成します。
     'action' は、もし提供されるなら呼び出し可能オブジェクトで、スレッド
     が解放される時にそのうちの1つによって呼ばれます。 'timeout' は、
     *note wait(): 363c. メソッドに対して none が指定された場合のデフォ
     ルトのタイムアウト値です。

      -- メソッド: wait (timeout=None)

          バリアを通ります。バリアに対するすべてのスレッドがこの関数を呼
          んだ時に、それらは同時にすべて解放されます。'timeout' が提供さ
          れる場合、それはクラスコンストラクタに渡された値に優先して使用
          されます。

          返り値は 0 から 'parties' - 1 の範囲の整数で、それぞれのスレッ
          ドに対して異なります。これは、特別な後始末 (housekeeping) を行
          うスレッドを選択するために使用することができます。例えば:

               i = barrier.wait()
               if i == 0:
                   # Only one thread needs to print this
                   print("passed the barrier")

          'action' がコンストラクタに渡されていれば、スレッドのうちの1つ
          が解放される前にそれを呼び出します。万一この呼び出しでエラーが
          発生した場合、バリアは broken な状態に陥ります。

          この呼び出しがタイムアウトする場合、バリアは broken な状態に陥
          ります。

          スレッドが待っている間にバリアが broken になるかリセットされた
          場合、このメソッドは *note BrokenBarrierError: 13fe. 例外を送
          出するかもしれません。

      -- メソッド: reset ()

          バリアをデフォルトの空の状態に戻します。そのバリアの上で待って
          いるすべてのスレッドは *note BrokenBarrierError: 13fe. 例外を
          受け取ります。

          状態が未知の他のスレッドがある場合、この関数を使用するのに何ら
          かの外部同期を必要とするかもしれないことに注意してください。バ
          リアが broken な場合、単にそれをそのままにして新しいものを作成
          する方がよいでしょう。

      -- メソッド: abort ()

          バリアを broken な状態にします。これによって、現在または将来の
          *note wait(): 363c. 呼び出しが *note BrokenBarrierError: 13fe.
          とともに失敗するようになります。これを使うと、例えばスレッドが
          異常終了する必要がある場合にアプリケーションがデッドロックする
          のを避けることができます。

          スレッドのうちの1つが返ってこないことに対して自動的に保護する
          ように、単純に常識的な 'timeout' 値でバリアを作成することは望
          ましいかもしれません。

      -- の属性: parties

          バリアを通るために要求されるスレッドの数。

      -- の属性: n_waiting

          現在バリアの中で待っているスレッドの数。

      -- の属性: broken

          バリアが broken な状態である場合に ‘True’ となるブール値。

 -- 例外: threading.BrokenBarrierError

     *note Barrier: 13fc. オブジェクトがリセットされるか broken な場合に
     、この例外 (*note RuntimeError: 244. のサブクラス) が送出されます。


File: python.info,  Node: with 文でのロック・条件変数・セマフォの使い方,  Prev: リファレンス<2>,  Up: threading --- スレッドベースの並列処理

5.18.1.14 ‘with’ 文でのロック・条件変数・セマフォの使い方
.........................................................

All of the objects provided by this module that have ‘acquire’ and
‘release’ methods can be used as context managers for a *note with: 186.
statement.  The ‘acquire’ method will be called when the block is
entered, and ‘release’ will be called when the block is exited.  Hence,
the following snippet:

     with some_lock:
         # do something...

は、以下と同じです

     some_lock.acquire()
     try:
         # do something...
     finally:
         some_lock.release()

現在のところ、 *note Lock: 19f4. 、 *note RLock: 32e. 、 *note
Condition: 136d. 、 *note Semaphore: 136e. 、 *note BoundedSemaphore:
136f. を *note with: 186. 文のコンテキストマネージャとして使うことができ
ます。


File: python.info,  Node: multiprocessing --- プロセスベースの並列処理,  Next: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ,  Prev: threading --- スレッドベースの並列処理,  Up: 並行実行

5.18.2 ‘multiprocessing’ -- プロセスベースの並列処理
----------------------------------------------------

'ソースコード:' Lib/multiprocessing/(1)

__________________________________________________________________

*note Availability: 213f.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 225c. と *note
WebAssemblyプラットフォーム: 1b6a. をサポートしません。

* Menu:

* はじめに: はじめに<9>.
* リファレンス: リファレンス<3>.
* プログラミングガイドライン::
* 使用例: 使用例<21>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/multiprocessing/


File: python.info,  Node: はじめに<9>,  Next: リファレンス<3>,  Up: multiprocessing --- プロセスベースの並列処理

5.18.2.1 はじめに
.................

‘multiprocessing’ is a package that supports spawning processes using an
API similar to the *note threading: f3. module.  The ‘multiprocessing’
package offers both local and remote concurrency, effectively
side-stepping the *note Global Interpreter Lock: 474. by using
subprocesses instead of threads.  Due to this, the ‘multiprocessing’
module allows the programmer to fully leverage multiple processors on a
given machine.  It runs on both POSIX and Windows.

The ‘multiprocessing’ module also introduces the *note Pool: 116d.
object which offers a convenient means of parallelizing the execution of
a function across multiple input values, distributing the input data
across processes (data parallelism).  The following example demonstrates
the common practice of defining such functions in a module so that child
processes can successfully import that module.  This basic example of
data parallelism using *note Pool: 116d,

     from multiprocessing import Pool

     def f(x):
         return x*x

     if __name__ == '__main__':
         with Pool(5) as p:
             print(p.map(f, [1, 2, 3]))

標準出力に以下が出力されます:

     [1, 4, 9]

The ‘multiprocessing’ module also introduces APIs which do not have
analogs in the *note threading: f3. module, like the ability to *note
terminate: 1857, *note interrupt: 251. or *note kill: d4f. a running
process.

参考
....

*note concurrent.futures.ProcessPoolExecutor: 1d6. offers a higher level
interface to push tasks to a background process without blocking
execution of the calling process.  Compared to using the *note Pool:
116d. interface directly, the *note concurrent.futures: 24. API more
readily allows the submission of work to the underlying process pool to
be separated from waiting for the results.

* Menu:

* Process クラス::
* コンテキストと開始方式::
* プロセス間でのオブジェクト交換::
* プロセス間の同期::
* プロセス間での状態の共有::
* ワーカープロセスのプールを使用::


File: python.info,  Node: Process クラス,  Next: コンテキストと開始方式,  Up: はじめに<9>

5.18.2.2 ‘Process’ クラス
.........................

In ‘multiprocessing’, processes are spawned by creating a *note Process:
252. object and then calling its *note start(): 15a9. method.  *note
Process: 252. follows the API of *note threading.Thread: 176.  A trivial
example of a multiprocess program is

     from multiprocessing import Process

     def f(name):
         print('hello', name)

     if __name__ == '__main__':
         p = Process(target=f, args=('bob',))
         p.start()
         p.join()

実行された個々のプロセス ID を表示するために拡張したサンプルコードを以下
に示します:

     from multiprocessing import Process
     import os

     def info(title):
         print(title)
         print('module name:', __name__)
         print('parent process:', os.getppid())
         print('process id:', os.getpid())

     def f(name):
         info('function f')
         print('hello', name)

     if __name__ == '__main__':
         info('main line')
         p = Process(target=f, args=('bob',))
         p.start()
         p.join()

なぜ ‘if __name__ == '__main__'’ という記述が必要かは *note
プログラミングガイドライン: 3648. を参照してください。

The arguments to *note Process: 252. usually need to be unpickleable
from within the child process.  If you tried typing the above example
directly into a REPL it could lead to an *note AttributeError: 5f0. in
the child process trying to locate the 'f' function in the ‘__main__’
module.


File: python.info,  Node: コンテキストと開始方式,  Next: プロセス間でのオブジェクト交換,  Prev: Process クラス,  Up: はじめに<9>

5.18.2.3 コンテキストと開始方式
...............................

Depending on the platform, ‘multiprocessing’ supports three ways to
start a process.  These 'start methods' are

     'spawn'

          親プロセスは新たに Python インタープリタープロセスを開始します
          。子プロセスはプロセスオブジェクトの *note run(): 364a. メソッ
          ドの実行に必要なリソースのみ継承します。特に、親プロセスからの
          不要なファイル記述子とハンドルは継承されません。この方式を使用
          したプロセスの開始は 'fork' や 'forkserver' に比べ遅くなります
          。

          Available on POSIX and Windows platforms.  The default on
          Windows and macOS.

     'fork'

          親プロセスは *note os.fork(): 4b5. を使用して Python インター
          プリターをフォークします。子プロセスはそれが開始されるとき、事
          実上親プロセスと同一になります。親プロセスのリソースはすべて子
          プロセスに継承されます。マルチスレッドプロセスのフォークは安全
          性に問題があることに注意してください。

          Available on POSIX systems.

          バージョン 3.14 で変更: This is no longer the default start
          method on any platform.  Code that requires 'fork' must
          explicitly specify that via *note get_context(): 24a. or *note
          set_start_method(): 24b.

          バージョン 3.12 で変更: If Python is able to detect that your
          process has multiple threads, the *note os.fork(): 4b5.
          function that this start method calls internally will raise a
          *note DeprecationWarning: 1a3.  Use a different start method.
          See the *note os.fork(): 4b5. documentation for further
          explanation.

     'forkserver'

          When the program starts and selects the 'forkserver' start
          method, a server process is spawned.  From then on, whenever a
          new process is needed, the parent process connects to the
          server and requests that it fork a new process.  The fork
          server process is single threaded unless system libraries or
          preloaded imports spawn threads as a side-effect so it is
          generally safe for it to use *note os.fork(): 4b5.  No
          unnecessary resources are inherited.

          Available on POSIX platforms which support passing file
          descriptors over Unix pipes such as Linux.  The default on
          those.

          バージョン 3.14 で変更: This became the default start method
          on POSIX platforms.

バージョン 3.4 で変更: 'spawn' added on all POSIX platforms, and
'forkserver' added for some POSIX platforms.  Child processes no longer
inherit all of the parents inheritable handles on Windows.

バージョン 3.8 で変更: On macOS, the 'spawn' start method is now the
default.  The 'fork' start method should be considered unsafe as it can
lead to crashes of the subprocess as macOS system libraries may start
threads.  See bpo-33725(1).

バージョン 3.14 で変更: On POSIX platforms the default start method was
changed from 'fork' to 'forkserver' to retain the performance but avoid
common multithreaded process incompatibilities.  See gh-84559(2).

On POSIX using the 'spawn' or 'forkserver' start methods will also start
a 'resource tracker' process which tracks the unlinked named system
resources (such as named semaphores or *note SharedMemory: 19d8.
objects) created by processes of the program.  When all processes have
exited the resource tracker unlinks any remaining tracked object.
Usually there should be none, but if a process was killed by a signal
there may be some "leaked" resources.  (Neither leaked semaphores nor
shared memory segments will be automatically unlinked until the next
reboot.  This is problematic for both objects because the system allows
only a limited number of named semaphores, and shared memory segments
occupy some space in the main memory.)

開始方式はメインモジュールの ‘if __name__ == '__main__'’ 節内で、関数
*note set_start_method(): 24b. によって指定します。以下に例を示します:

     import multiprocessing as mp

     def foo(q):
         q.put('hello')

     if __name__ == '__main__':
         mp.set_start_method('spawn')
         q = mp.Queue()
         p = mp.Process(target=foo, args=(q,))
         p.start()
         print(q.get())
         p.join()

関数 *note set_start_method(): 24b. はプログラム内で複数回使用してはいけ
ません。

もうひとつの方法として、*note get_context(): 24a. を使用してコンテキスト
オブジェクトを取得することができます。コンテキストオブジェクトは
multiprocessing モジュールと同じ API を持ち、同じプログラム内で複数の開
始方式を使用できます。

     import multiprocessing as mp

     def foo(q):
         q.put('hello')

     if __name__ == '__main__':
         ctx = mp.get_context('spawn')
         q = ctx.Queue()
         p = ctx.Process(target=foo, args=(q,))
         p.start()
         print(q.get())
         p.join()

あるコンテキストに関連したオブジェクトは、異なるコンテキストのプロセスと
は互換性がない場合があることに注意してください。特に、'fork' コンテキス
トを使用して作成されたロックは、'spawn' あるいは 'forkserver' を使用して
開始されたプロセスに渡すことはできません。

Libraries using ‘multiprocessing’ or *note ProcessPoolExecutor: 1d6.
should be designed to allow their users to provide their own
multiprocessing context.  Using a specific context of your own within a
library can lead to incompatibilities with the rest of the library
user's application.  Always document if your library requires a specific
start method.

     警告: The ‘'spawn'’ and ‘'forkserver'’ start methods generally
     cannot be used with "frozen" executables (i.e., binaries produced
     by packages like 'PyInstaller' and 'cx_Freeze') on POSIX systems.
     The ‘'fork'’ start method may work if code does not use threads.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33725

   (2) https://github.com/python/cpython/issues/84559


File: python.info,  Node: プロセス間でのオブジェクト交換,  Next: プロセス間の同期,  Prev: コンテキストと開始方式,  Up: はじめに<9>

5.18.2.4 プロセス間でのオブジェクト交換
.......................................

‘multiprocessing’ supports two types of communication channel between
processes:

'キュー (Queue)'

     *note Queue: 1b89. クラスは *note queue.Queue: 15ac. クラスとほとん
     ど同じように使うことができます。以下に例を示します:

          from multiprocessing import Process, Queue

          def f(q):
              q.put([42, None, 'hello'])

          if __name__ == '__main__':
              q = Queue()
              p = Process(target=f, args=(q,))
              p.start()
              print(q.get())    # prints "[42, None, 'hello']"
              p.join()

     Queues are thread and process safe.  Any object put into a
     ‘multiprocessing’ queue will be serialized.

'パイプ (Pipe)'

     *note Pipe(): 364c. 関数はパイプで繋がれたコネクションオブジェクト
     のペアを返します。デフォルトでは双方向性パイプを返します。以下に例
     を示します:

          from multiprocessing import Process, Pipe

          def f(conn):
              conn.send([42, None, 'hello'])
              conn.close()

          if __name__ == '__main__':
              parent_conn, child_conn = Pipe()
              p = Process(target=f, args=(child_conn,))
              p.start()
              print(parent_conn.recv())   # prints "[42, None, 'hello']"
              p.join()

     パイプのそれぞれの端を表す2つのコネクションオブジェクトが *note
     Pipe(): 364c. 関数から返されます。各コネクションオブジェクトには、
     ‘send()’、 ‘recv()’、その他のメソッドがあります。2つのプロセス (ま
     たはスレッド) がパイプの '同じ' 端で同時に読み込みや書き込みを行う
     と、パイプ内のデータが破損してしまうかもしれないことに注意してくだ
     さい。もちろん、各プロセスがパイプの別々の端を同時に使用するならば
     、データが破壊される危険性はありません。

     The ‘send()’ method serializes the object and ‘recv()’ re-creates
     the object.


File: python.info,  Node: プロセス間の同期,  Next: プロセス間での状態の共有,  Prev: プロセス間でのオブジェクト交換,  Up: はじめに<9>

5.18.2.5 プロセス間の同期
.........................

‘multiprocessing’ contains equivalents of all the synchronization
primitives from *note threading: f3.  For instance one can use a lock to
ensure that only one process prints to standard output at a time:

     from multiprocessing import Process, Lock

     def f(l, i):
         l.acquire()
         try:
             print('hello world', i)
         finally:
             l.release()

     if __name__ == '__main__':
         lock = Lock()

         for num in range(10):
             Process(target=f, args=(lock, num)).start()

ロックを使用しないで標準出力に書き込んだ場合は、各プロセスからの出力がご
ちゃまぜになってしまいます。


File: python.info,  Node: プロセス間での状態の共有,  Next: ワーカープロセスのプールを使用,  Prev: プロセス間の同期,  Up: はじめに<9>

5.18.2.6 プロセス間での状態の共有
.................................

これまでの話の流れで触れたとおり、並行プログラミングを行うときには、でき
るかぎり状態を共有しないのが定石です。複数のプロセスを使用するときは特に
そうでしょう。

However, if you really do need to use some shared data then
‘multiprocessing’ provides a couple of ways of doing so.

'共有メモリ (Shared memory)'

     データを共有メモリ上に保持するために *note Value: 364f. クラス、も
     しくは *note Array: 3650. クラスを使用することができます。以下のサ
     ンプルコードを使って、この機能についてみていきましょう

          from multiprocessing import Process, Value, Array

          def f(n, a):
              n.value = 3.1415927
              for i in range(len(a)):
                  a[i] = -a[i]

          if __name__ == '__main__':
              num = Value('d', 0.0)
              arr = Array('i', range(10))

              p = Process(target=f, args=(num, arr))
              p.start()
              p.join()

              print(num.value)
              print(arr[:])

     このサンプルコードを実行すると以下のように表示されます

          3.1415927
          [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]

     ‘num’ と ‘arr’ を生成するときに使用されている、引数 ‘'d'’ と ‘'i'’
     は *note array: 8. モジュールにより使用される種別の型コードです。こ
     こで使用されている ‘'d'’ は倍精度浮動小数、 ‘'i'’ は符号付整数を表
     します。これらの共有オブジェクトは、プロセスセーフでありスレッドセ
     ーフです。

     共有メモリを使用して、さらに柔軟なプログラミングを行うには *note
     multiprocessing.sharedctypes: 9e. モジュールを使用します。このモジ
     ュールは共有メモリから割り当てられた任意の ctypes オブジェクトの生
     成をサポートします。

'サーバープロセス (Server process)'

     *note Manager(): 250. 関数により生成されたマネージャーオブジェクト
     はサーバープロセスを管理します。マネージャーオブジェクトは Python の
     オブジェクトを保持して、他のプロセスがプロキシ経由でその Python オ
     ブジェクトを操作することができます。

     A manager returned by *note Manager(): 250. will support types
     *note list: 24d, *note dict: 183, *note set: 184, *note Namespace:
     3651, *note Lock: 1853, *note RLock: 1854, *note Semaphore: 3652,
     *note BoundedSemaphore: 3653, *note Condition: 3654, *note Event:
     1c06, *note Barrier: 3655, *note Queue: 1b89, *note Value: 364f.
     and *note Array: 3650.  For example,

          from multiprocessing import Process, Manager

          def f(d, l, s):
              d[1] = '1'
              d['2'] = 2
              d[0.25] = None
              l.reverse()
              s.add('a')
              s.add('b')

          if __name__ == '__main__':
              with Manager() as manager:
                  d = manager.dict()
                  l = manager.list(range(10))
                  s = manager.set()

                  p = Process(target=f, args=(d, l, s))
                  p.start()
                  p.join()

                  print(d)
                  print(l)
                  print(s)

     このサンプルコードを実行すると以下のように表示されます

          {0.25: None, 1: '1', '2': 2}
          [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
          {'a', 'b'}

     サーバープロセスのマネージャーオブジェクトは共有メモリのオブジェク
     トよりも柔軟であるといえます。それは、どのような型のオブジェクトで
     も使えるからです。また、1つのマネージャーオブジェクトはネットワーク
     経由で他のコンピューター上のプロセスによって共有することもできます
     。しかし、共有メモリより動作が遅いという欠点があります。


File: python.info,  Node: ワーカープロセスのプールを使用,  Prev: プロセス間での状態の共有,  Up: はじめに<9>

5.18.2.7 ワーカープロセスのプールを使用
.......................................

*note Pool: 116d. クラスは、ワーカープロセスをプールする機能を備えていま
す。このクラスには、異なる方法でワーカープロセスへタスクを割り当てるいく
つかのメソッドがあります。

例えば:

     from multiprocessing import Pool, TimeoutError
     import time
     import os

     def f(x):
         return x*x

     if __name__ == '__main__':
         # start 4 worker processes
         with Pool(processes=4) as pool:

             # print "[0, 1, 4,..., 81]"
             print(pool.map(f, range(10)))

             # print same numbers in arbitrary order
             for i in pool.imap_unordered(f, range(10)):
                 print(i)

             # evaluate "f(20)" asynchronously
             res = pool.apply_async(f, (20,))      # runs in *only* one process
             print(res.get(timeout=1))             # prints "400"

             # evaluate "os.getpid()" asynchronously
             res = pool.apply_async(os.getpid, ()) # runs in *only* one process
             print(res.get(timeout=1))             # prints the PID of that process

             # launching multiple evaluations asynchronously *may* use more processes
             multiple_results = [pool.apply_async(os.getpid, ()) for i in range(4)]
             print([res.get(timeout=1) for res in multiple_results])

             # make a single worker sleep for 10 seconds
             res = pool.apply_async(time.sleep, (10,))
             try:
                 print(res.get(timeout=1))
             except TimeoutError:
                 print("We lacked patience and got a multiprocessing.TimeoutError")

             print("For the moment, the pool remains available for more work")

         # exiting the 'with'-block has stopped the pool
         print("Now the pool is closed and no longer available")

プールオブジェクトのメソッドは、そのプールを作成したプロセスのみが呼び出
すべきです。

     注釈: このパッケージに含まれる機能を使用するためには、子プロセスか
     ら ‘__main__’ モジュールをインポートできる必要があります。このこと
     については *note プログラミングガイドライン: 3648. で触れていますが
     、ここであらためて強調しておきます。なぜかというと、いくつかのサン
     プルコード、例えば *note multiprocessing.pool.Pool: 116d. のサンプ
     ルはインタラクティブシェル上では動作しないからです。以下に例を示し
     ます:

          >>> from multiprocessing import Pool
          >>> p = Pool(5)
          >>> def f(x):
          ...     return x*x
          ...
          >>> with p:
          ...     p.map(f, [1,2,3])
          Process PoolWorker-1:
          Process PoolWorker-2:
          Process PoolWorker-3:
          Traceback (most recent call last):
          Traceback (most recent call last):
          Traceback (most recent call last):
          AttributeError: Can't get attribute 'f' on <module '__main__' (<class '_frozen_importlib.BuiltinImporter'>)>
          AttributeError: Can't get attribute 'f' on <module '__main__' (<class '_frozen_importlib.BuiltinImporter'>)>
          AttributeError: Can't get attribute 'f' on <module '__main__' (<class '_frozen_importlib.BuiltinImporter'>)>

     (もしこのコードを試すなら、実際には3つの完全なトレースバックがばら
     ばらの順番で出力されますし、親プロセスを何らかの方法で止める必要が
     あります。)


File: python.info,  Node: リファレンス<3>,  Next: プログラミングガイドライン,  Prev: はじめに<9>,  Up: multiprocessing --- プロセスベースの並列処理

5.18.2.8 リファレンス
.....................

The ‘multiprocessing’ package mostly replicates the API of the *note
threading: f3. module.

* Menu:

* Global start method::
* Process クラスと例外::
* パイプ (Pipe) とキュー (Queue): パイプ Pipe とキュー Queue.
* その他: その他<5>.
* Connection オブジェクト: Connection オブジェクト<2>.
* 同期プリミティブ::
* 共有 ctypes オブジェクト::
* マネージャー::
* Proxy オブジェクト::
* プロセスプール::
* リスナーとクライアント::
* 認証キー::
* ログ記録: ログ記録<2>.
* The multiprocessing.dummy module: The multiprocessing dummy module.


File: python.info,  Node: Global start method,  Next: Process クラスと例外,  Up: リファレンス<3>

5.18.2.9 Global start method
............................

Python supports several ways to create and initialize a process.  The
global start method sets the default mechanism for creating a process.

Several multiprocessing functions and methods that may also instantiate
certain objects will implicitly set the global start method to the
system's default, if it hasn’t been set already.  The global start
method can only be set once.  If you need to change the start method
from the system default, you must proactively set the global start
method before calling functions or methods, or creating these objects.


File: python.info,  Node: Process クラスと例外,  Next: パイプ Pipe とキュー Queue,  Prev: Global start method,  Up: リファレンス<3>

5.18.2.10 ‘Process’ クラスと例外
................................

 -- クラス: multiprocessing.Process (group=None, target=None, name=None,
          args=(), kwargs={}, *, daemon=None)

     Process オブジェクトは各プロセスの処理を表します。 *note Process:
     252. クラスは *note threading.Thread: 176. クラスのすべてのメソッド
     と同じインターフェースを提供します。

     The constructor should always be called with keyword arguments.
     'group' should always be ‘None’; it exists solely for compatibility
     with *note threading.Thread: 176.  'target' is the callable object
     to be invoked by the *note run(): 364a. method.  It defaults to
     ‘None’, meaning nothing is called.  'name' is the process name (see
     *note name: 365b. for more details).  'args' is the argument tuple
     for the target invocation.  'kwargs' is a dictionary of keyword
     arguments for the target invocation.  If provided, the keyword-only
     'daemon' argument sets the process *note daemon: 365c. flag to
     ‘True’ or ‘False’.  If ‘None’ (the default), this flag will be
     inherited from the creating process.

     デフォルトでは、'target' に何の引数も与えられません。(実) 引数
     'args' (デフォルトは''()'')は、'target' に渡す引数のリストまたはタ
     プルを指定するために使用されます。

     If a subclass overrides the constructor, it must make sure it
     invokes the base class constructor (‘super().__init__()’) before
     doing anything else to the process.

          注釈: In general, all arguments to *note Process: 252. must be
          picklable.  This is frequently observed when trying to create
          a *note Process: 252. or use a *note
          concurrent.futures.ProcessPoolExecutor: 1d6. from a REPL with
          a locally defined 'target' function.

          Passing a callable object defined in the current REPL session
          causes the child process to die via an uncaught *note
          AttributeError: 5f0. exception when starting as 'target' must
          have been defined within an importable module in order to be
          loaded during unpickling.

          Example of this uncatchable error from the child:

               >>> import multiprocessing as mp
               >>> def knigit():
               ...     print("Ni!")
               ...
               >>> process = mp.Process(target=knigit)
               >>> process.start()
               >>> Traceback (most recent call last):
                 File ".../multiprocessing/spawn.py", line ..., in spawn_main
                 File ".../multiprocessing/spawn.py", line ..., in _main
               AttributeError: module '__main__' has no attribute 'knigit'
               >>> process
               <SpawnProcess name='SpawnProcess-1' pid=379473 parent=378707 stopped exitcode=1>

          See *note 開始方式が spawn および forkserver の場合: 365d.
          While this restriction is not true if using the ‘"fork"’ start
          method, as of Python ‘3.14’ that is no longer the default on
          any platform.  See *note コンテキストと開始方式: 1d5.  See
          also gh-132898(1).

     バージョン 3.3 で変更: Added the 'daemon' parameter.

      -- メソッド: run ()

          プロセスが実行する処理を表すメソッドです。

          このメソッドはサブクラスでオーバーライドすることができます。標
          準の *note run(): 364a. メソッドは、コンストラクターの target
          引数として渡された呼び出し可能オブジェクトを呼び出します。もし
          コンストラクターに 'args' もしくは 'kwargs' 引数が渡されていれ
          ば、呼び出すオブジェクトにこれらの引数を渡します。

          *note Process: 252. に渡される 'args' の引数にリストやタプルを
          使っても、同じ効果が得られます。

          以下はプログラム例です:

               >>> from multiprocessing import Process
               >>> p = Process(target=print, args=[1])
               >>> p.run()
               1
               >>> p = Process(target=print, args=(1,))
               >>> p.run()
               1

      -- メソッド: start ()

          プロセスの処理を開始するためのメソッドです。

          各 Process オブジェクトに対し、このメソッドが2回以上呼び出され
          てはいけません。各プロセスでオブジェクトの *note run(): 364a.
          メソッドを呼び出す準備を行います。

      -- メソッド: join ([timeout])

          オプションの引数 'timeout' が ‘None’ (デフォルト) の場合、
          *note join(): 15ab. メソッドが呼ばれたプロセスは処理が終了する
          までブロックします。 'timeout' が正の数である場合、最大
          'timeout' 秒ブロックします。 プロセスが終了あるいはタイムアウ
          トした場合、メソッドは ‘None’ を返すことに注意してください。 プ
          ロセスの *note exitcode: 365e. を確認し終了したかどうかを判断
          してください。

          1つのプロセスは何回も join されることができます。

          プロセスは自分自身を join することはできません。それはデッドロ
          ックを引き起こすことがあるからです。プロセスが start される前
          に join しようとするとエラーが発生します。

      -- の属性: name

          プロセスの名前。名前は識別のためだけに使用される文字列です。そ
          れ自体には特別な意味はありません。複数のプロセスに同じ名前が与
          えられても構いません。

          最初の名前はコンストラクターによってセットされます。コンストラ
          クターに明示的な名前が渡されない場合、
          'Process-N[1]:N[2]:...:N[k]' 形式の名前が構築されます。ここで
          それぞれの N[k] はその親のN番目の子供です。

      -- メソッド: is_alive ()

          プロセスが実行中かを判別します。

          おおまかに言って、プロセスオブジェクトは *note start(): 15a9.
          メソッドを呼び出してから子プロセス終了までの期間が実行中となり
          ます。

      -- の属性: daemon

          デーモンプロセスであるかのフラグであり、ブール値です。この属性
          は *note start(): 15a9. が呼び出される前に設定されている必要が
          あります。

          初期値は作成するプロセスから継承します。

          あるプロセスが終了するとき、そのプロセスはその子プロセスである
          デーモンプロセスすべてを終了させようとします。

          デーモンプロセスは子プロセスを作成できないことに注意してくださ
          い。もし作成できてしまうと、そのデーモンプロセスの親プロセスが
          終了したときにデーモンプロセスの子プロセスが孤児になってしまう
          場合があるからです。さらに言えば、デーモンプロセスはUnix デー
          モンやサービスでは 'なく' 通常のプロセスであり、非デーモンプロ
          セスが終了すると終了されます (そして join されません)。

     *note threading.Thread: 176. クラスの API に加えて *note Process:
     252. クラスのオブジェクトには以下の属性およびメソッドがあります:

      -- の属性: pid

          プロセスIDを返します。プロセスの生成前は ‘None’ が設定されてい
          ます。

      -- の属性: exitcode

          The child's exit code.  This will be ‘None’ if the process has
          not yet terminated.

          If the child's *note run(): 364a. method returned normally,
          the exit code will be 0.  If it terminated via *note
          sys.exit(): 277. with an integer argument 'N', the exit code
          will be 'N'.

          If the child terminated due to an exception not caught within
          *note run(): 364a, the exit code will be 1.  If it was
          terminated by signal 'N', the exit code will be the negative
          value '-N'.

      -- の属性: authkey

          プロセスの認証キーです (バイト文字列です)。

          When ‘multiprocessing’ is initialized the main process is
          assigned a random string using *note os.urandom(): 746.

          *note Process: 252. クラスのオブジェクトの作成時にその親プロセ
          スから認証キーを継承します。もしくは *note authkey: 3660. に別
          のバイト文字列を設定することもできます。

          詳細は *note 認証キー: 3661. を参照してください。

      -- の属性: sentinel

          プロセスが終了するときに "ready" となるシステムオブジェクトの
          数値ハンドル。

          You can use this value if you want to wait on several events
          at once using *note multiprocessing.connection.wait(): 12f7.
          Otherwise calling *note join(): 15ab. is simpler.

          On Windows, this is an OS handle usable with the
          ‘WaitForSingleObject’ and ‘WaitForMultipleObjects’ family of
          API calls.  On POSIX, this is a file descriptor usable with
          primitives from the *note select: c6. module.

          Added in version 3.3.

      -- メソッド: interrupt ()

          Terminate the process.  Works on POSIX using the *note SIGINT:
          253. signal.  Behavior on Windows is undefined.

          By default, this terminates the child process by raising *note
          KeyboardInterrupt: bc5.  This behavior can be altered by
          setting the respective signal handler in the child process
          *note signal.signal(): 134c. for *note SIGINT: 253.

          Note: if the child process catches and discards *note
          KeyboardInterrupt: bc5, the process will not be terminated.

          Note: the default behavior will also set *note exitcode: 365e.
          to ‘1’ as if an uncaught exception was raised in the child
          process.  To have a different *note exitcode: 365e. you may
          simply catch *note KeyboardInterrupt: bc5. and call
          ‘exit(your_code)’.

          Added in version 3.14.

      -- メソッド: terminate ()

          Terminate the process.  On POSIX this is done using the *note
          SIGTERM: 15f8. signal; on Windows ‘TerminateProcess()’ is
          used.  Note that exit handlers and finally clauses, etc., will
          not be executed.

          このメソッドにより終了するプロセスの子孫プロセスは、終了 'しま
          せん' 。そういった子孫プロセスは単純に孤児になります。

               警告: このメソッドの使用時に、関連付けられたプロセスがパ
               イプやキューを使用している場合には、使用中のパイプやキュ
               ーが破損して他のプロセスから使用できなくなる可能性があり
               ます。同様に、プロセスがロックやセマフォなどを取得してい
               る場合には、このプロセスが終了してしまうと他のプロセスの
               デッドロックの原因になるでしょう。

      -- メソッド: kill ()

          Same as *note terminate(): 1857. but using the ‘SIGKILL’
          signal on POSIX.

          Added in version 3.7.

      -- メソッド: close ()

          *note Process: 252. オブジェクトを閉じ、関連付けられていたすべ
          てのリソースを開放します。中のプロセスが実行中であった場合、
          *note ValueError: 2ec. を送出します。*note close(): d4e. が成
          功した場合、*note Process: 252. オブジェクトの他のメソッドや属
          性は、ほとんどが *note ValueError: 2ec. を送出します。

          Added in version 3.7.

     プロセスオブジェクトが作成したプロセスのみが *note start(): 15a9,
     *note join(): 15ab, *note is_alive(): 15aa, *note terminate():
     1857. と *note exitcode: 365e. のメソッドを呼び出すべきです。

     以下の例では *note Process: 252. のメソッドの使い方を示しています:

          >>> import multiprocessing, time, signal
          >>> mp_context = multiprocessing.get_context('spawn')
          >>> p = mp_context.Process(target=time.sleep, args=(1000,))
          >>> print(p, p.is_alive())
          <...Process ... initial> False
          >>> p.start()
          >>> print(p, p.is_alive())
          <...Process ... started> True
          >>> p.terminate()
          >>> time.sleep(0.1)
          >>> print(p, p.is_alive())
          <...Process ... stopped exitcode=-SIGTERM> False
          >>> p.exitcode == -signal.SIGTERM
          True

 -- 例外: multiprocessing.ProcessError

     The base class of all ‘multiprocessing’ exceptions.

 -- 例外: multiprocessing.BufferTooShort

     Exception raised by ‘Connection.recv_bytes_into()’ when the
     supplied buffer object is too small for the message read.

     ‘e’ が *note BufferTooShort: 3663. のインスタンスであるとすると、
     ‘e.args[0]’ はそのメッセージをバイト文字列で与えるものです。

 -- 例外: multiprocessing.AuthenticationError

     認証エラーがあった場合に送出されます。

 -- 例外: multiprocessing.TimeoutError

     タイムアウトをサポートするメソッドでタイムアウトが過ぎたときに送出
     されます。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/132898


File: python.info,  Node: パイプ Pipe とキュー Queue,  Next: その他<5>,  Prev: Process クラスと例外,  Up: リファレンス<3>

5.18.2.11 パイプ (Pipe) とキュー (Queue)
........................................

複数のプロセスを使う場合、一般的にはメッセージパッシングをプロセス間通信
に使用し、ロックのような同期プリミティブを使用しないようにします。

メッセージのやりとりのために *note Pipe(): 364c. (2つのプロセス間の通信
用)、もしくはキュー (複数のメッセージ生成プロセス (producer)、消費プロセ
ス (consumer) の実現用) を使うことができます。

*note Queue: 1b89, *note SimpleQueue: b10. と *note JoinableQueue: 3667.
型は複数プロセスから生成/消費を行う FIFO キューです。これらのキューは標
準ライブラリの *note queue.Queue: 15ac. を模倣しています。 *note Queue:
1b89. には Python 2.5 の *note queue.Queue: 15ac. クラスで導入された
*note task_done(): 3668. と *note join(): 3669. メソッドがないことが違う
点です。

もし *note JoinableQueue: 3667. を使用するなら、キューから削除される各タ
スクのために *note JoinableQueue.task_done(): 366a. を呼び出さなければ
'なりません' 。さもないと、いつか完了していないタスクを数えるためのセマ
フォがオーバーフローし、例外を発生させるでしょう。

One difference from other Python queue implementations, is that
‘multiprocessing’ queues serializes all objects that are put into them
using *note pickle: ab.  The object returned by the get method is a
re-created object that does not share memory with the original object.

管理オブジェクトを使用することで共有キューを作成できることも覚えておいて
ください。詳細は *note マネージャー: 366b. を参照してください。

     注釈: ‘multiprocessing’ uses the usual *note queue.Empty: 366c. and
     *note queue.Full: 366d. exceptions to signal a timeout.  They are
     not available in the ‘multiprocessing’ namespace so you need to
     import them from *note queue: bb.

     注釈: オブジェクトがキューに追加される際、そのオブジェクトは pickle
     化されています。そのため、バックグラウンドのスレッドが後になって下
     位層のパイプに pickle 化されたデータをフラッシュすることがあります
     。これにより、少し驚くような結果になりますが、実際に問題になること
     はないはずです。これが問題になるような状況では、かわりに *note
     manager: 366b. を使ってキューを作成することができるからです。

       1. 空のキューの中にオブジェクトを追加した後、キューの *note
          empty(): 1968. メソッドが *note False: d2b. を返すまでの間にご
          くわずかな遅延が起きることがあり、*note get_nowait(): 366e. が
          *note queue.Empty: 366c. を発生させることなく制御が呼び出し元
          に返ってしまうことがあります。

       2. 複数のプロセスがオブジェクトをキューに詰めている場合、キューの
          反対側ではオブジェクトが詰められたのとは違う順序で取得される可
          能性があります。ただし、同一のプロセスから詰め込まれたオブジェ
          クトは、それらのオブジェクト間では、必ず期待どおりの順序になり
          ます。

     警告: *note Queue: 1b89. を利用しようとしている最中にプロセスを
     *note Process.terminate(): 1857. や *note os.kill(): 157f. で終了さ
     せる場合、キューにあるデータは破損し易くなります。終了した後で他の
     プロセスがキューを利用しようとすると、例外を発生させる可能性があり
     ます。

     警告: 上述したように、もし子プロセスがキューへ要素を追加するなら (か
     つ *note JoinableQueue.cancel_join_thread: 366f. を使用しないなら)
     そのプロセスはバッファーされたすべての要素がパイプへフラッシュされ
     るまで終了しません。

     これは、そのプロセスを join しようとする場合、キューに追加されたす
     べての要素が消費されたことが確実でないかぎり、デッドロックを発生さ
     せる可能性があることを意味します。似たような現象で、子プロセスが非
     デーモンプロセスの場合、親プロセスは終了時に非デーモンのすべての子
     プロセスを join しようとしてハングアップする可能性があります。

     マネージャーを使用して作成されたキューではこの問題はありません。詳
     細は *note プログラミングガイドライン: 3648. を参照してください。

プロセス間通信におけるキューの使用例を知りたいなら *note 使用例: 3670. を
参照してください。

 -- の関数: multiprocessing.Pipe (duplex=True)

     パイプの両端を表す *note Connection: 12f8. オブジェクトのペア
     ‘(conn1, conn2)’ を返します。

     'duplex' が ‘True’ (デフォルト) ならパイプは双方向性です。'duplex'
     が ‘False’ ならパイプは一方向性で、‘conn1’ はメッセージの受信専用、
     ‘conn2’ はメッセージの送信専用になります。

     The ‘send()’ method serializes the object using *note pickle: ab.
     and the ‘recv()’ re-creates the object.

 -- クラス: multiprocessing.Queue ([maxsize])

     パイプや2～3個のロック/セマフォを使用して実装されたプロセス共有キュ
     ーを返します。あるプロセスが最初に要素をキューへ追加するとき、バッ
     ファーからパイプの中へオブジェクトを転送する供給スレッドが開始され
     ます。

     Instantiating this class may set the global start method.  See
     *note Global start method: 3658. for more details.

     標準ライブラリの *note queue: bb. モジュールの通常の *note
     queue.Empty: 366c. や *note queue.Full: 366d. 例外がタイムアウトを
     伝えるために送出されます。

     *note Queue: 1b89. は *note task_done(): 3668. や *note join():
     3669. を除く *note queue.Queue: 15ac. のすべてのメソッドを実装しま
     す。

      -- メソッド: qsize ()

          おおよそのキューのサイズを返します。マルチスレッディング/マル
          チプロセスの特性上、この数値は信用できません。

          Note that this may raise *note NotImplementedError: 36b. on
          platforms like macOS where ‘sem_getvalue()’ is not
          implemented.

      -- メソッド: empty ()

          キューが空っぽなら ‘True’ を、そうでなければ ‘False’ を返しま
          す。マルチスレッディング/マルチプロセシングの特性上、これは信
          用できません。

          May raise an *note OSError: 2c0. on closed queues.  (not
          guaranteed)

      -- メソッド: full ()

          キューがいっぱいなら ‘True’ を、そうでなければ ‘False’ を返し
          ます。マルチスレッディング/マルチプロセシングの特性上、これは
          信用できません。

      -- メソッド: put (obj[, block[, timeout]])

          キューの中へ obj を追加します。オプションの引数 'block' が
          ‘True’ (デフォルト) 且つ 'timeout' が ‘None’ (デフォルト) なら
          、空きスロットが利用可能になるまで必要であればブロックします。
          'timeout' が正の数なら、最大 'timeout' 秒ブロックして、その時
          間内に空きスロットが利用できなかったら *note queue.Full: 366d.
          例外を発生させます。それ以外 ('block' が ‘False’) で、空きスロ
          ットがすぐに利用可能な場合はキューに要素を追加します。そうでな
          ければ *note queue.Full: 366d. 例外が発生します(その場合
          'timeout' は無視されます)。

          バージョン 3.8 で変更: If the queue is closed, *note
          ValueError: 2ec. is raised instead of *note AssertionError:
          8b8.

      -- メソッド: put_nowait (obj)

          ‘put(obj, False)’ と等価です。

      -- メソッド: get ([block[, timeout]])

          キューから要素を取り出して削除します。オプションの引数 'block'
          が ‘True’ (デフォルト) 且つ 'timeout' が ‘None’ (デフォルト) な
          ら、要素が取り出せるまで必要であればブロックします。 'timeout'
          が正の数なら、最大 'timeout' 秒ブロックして、その時間内に要素
          が取り出せなかったら *note queue.Empty: 366c. 例外を発生させま
          す。それ以外 ('block' が ‘False’) で、要素がすぐに取り出せる場
          合は要素を返します。そうでなければ *note queue.Empty: 366c. 例
          外が発生します(その場合 'timeout' は無視されます)。

          バージョン 3.8 で変更: If the queue is closed, *note
          ValueError: 2ec. is raised instead of *note OSError: 2c0.

      -- メソッド: get_nowait ()

          ‘get(False)’ と等価です。

     *note multiprocessing.Queue: 1b89. は *note queue.Queue: 15ac. には
     ない追加メソッドがあります。 これらのメソッドは通常、ほとんどのコー
     ドに必要ありません:

      -- メソッド: close ()

          Close the queue: release internal resources.

          A queue must not be used anymore after it is closed.  For
          example, *note get(): 1e1e, *note put(): 1e1d. and *note
          empty(): 1968. methods must no longer be called.

          The background thread will quit once it has flushed all
          buffered data to the pipe.  This is called automatically when
          the queue is garbage collected.

      -- メソッド: join_thread ()

          バックグラウンドスレッドを join します。このメソッドは *note
          close(): 1b8a. が呼び出された後でのみ使用されます。バッファー
          されたすべてのデータがパイプへフラッシュされるのを保証するため
          、バックグラウンドスレッドが終了するまでブロックします。

          デフォルトでは、あるプロセスがキューを作成していない場合、終了
          時にキューのバックグラウンドスレッドを join しようとします。そ
          のプロセスは *note join_thread(): 3674. が何もしないように
          *note cancel_join_thread(): 366f. を呼び出すことができます。

      -- メソッド: cancel_join_thread ()

          *note join_thread(): 3674. がブロッキングするのを防ぎます。特
          にこれはバックグラウンドスレッドがそのプロセスの終了時に自動的
          に join されるのを防ぎます。詳細は *note join_thread(): 3674.
          を参照してください。

          このメソッドは ‘allow_exit_without_flush()’ という名前のほうが
          よかったかもしれません。キューに追加されたデータが失われてしま
          いがちなため、このメソッドを使う必要はほぼ確実にないでしょう。
          本当にこれが必要になるのは、キューに追加されたデータを下位層の
          パイプにフラッシュすることなくカレントプロセスを直ちに終了する
          必要があり、かつ失われるデータに関心がない場合です。

          注釈: このクラスに含まれる機能には、ホストとなるオペレーティン
          グシステム上で動作している共有セマフォ (shared semaphore) を使
          用しているものがあります。これが使用できない場合には、このクラ
          スが無効になり、 *note Queue: 1b89. をインスタンス化する時に
          *note ImportError: 65b. が発生します。詳細は bpo-3770(1) を参
          照してください。同様のことが、以下に列挙されている特殊なキュー
          でも成り立ちます。

 -- クラス: multiprocessing.SimpleQueue

     単純化された *note Queue: 1b89. 型です。ロックされた *note Pipe:
     364c. と非常に似ています。

     Instantiating this class may set the global start method.  See
     *note Global start method: 3658. for more details.

      -- メソッド: close ()

          Close the queue: release internal resources.

          A queue must not be used anymore after it is closed.  For
          example, *note get(): 3675, *note put(): 3676. and *note
          empty(): 1969. methods must no longer be called.

          Added in version 3.9.

      -- メソッド: empty ()

          キューが空ならば ‘True’ を、そうでなければ ‘False’ を返します
          。

          Always raises an *note OSError: 2c0. if the SimpleQueue is
          closed.

      -- メソッド: get ()

          キューから要素を削除して返します。

      -- メソッド: put (item)

          'item' をキューに追加します。

 -- クラス: multiprocessing.JoinableQueue ([maxsize])

     *note JoinableQueue: 3667. は *note Queue: 1b89. のサブクラスであり
     、 *note task_done(): 366a. や *note join(): 3677. メソッドが追加さ
     れているキューです。

     Instantiating this class may set the global start method.  See
     *note Global start method: 3658. for more details.

      -- メソッド: task_done ()

          以前にキューへ追加されたタスクが完了したことを表します。キュー
          のコンシューマによって使用されます。 タスクをフェッチするため
          に使用されるそれぞれの *note get(): 1e1e. に対して、 後続の
          *note task_done(): 366a. 呼び出しはタスクの処理が完了したこと
          をキューへ伝えます。

          もし *note join(): 3669. がブロッキング状態なら、 すべての要素
          が処理されたときに復帰します( *note task_done(): 366a. 呼び出
          しが すべての要素からキュー内へ *note put(): 1e1d. されたと受
          け取ったことを意味します)。

          キューにある要素より多く呼び出された場合 *note ValueError:
          2ec. が発生します。

      -- メソッド: join ()

          キューにあるすべてのアイテムが取り出されて処理されるまでブロッ
          クします。

          キューに要素が追加されると未完了タスク数が増えます。コンシュー
          マがキューの要素が取り出されてすべての処理が完了したことを表す
          *note task_done(): 366a. を呼び出すと数が減ります。 未完了タス
          ク数がゼロになると *note join(): 3669. はブロッキングを解除し
          ます。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=3770


File: python.info,  Node: その他<5>,  Next: Connection オブジェクト<2>,  Prev: パイプ Pipe とキュー Queue,  Up: リファレンス<3>

5.18.2.12 その他
................

 -- の関数: multiprocessing.active_children ()

     カレントプロセスのすべてのアクティブな子プロセスのリストを返します
     。

     これを呼び出すと "join" してすでに終了しているプロセスには副作用が
     あります。

 -- の関数: multiprocessing.cpu_count ()

     システムの CPU 数を返します。

     This number is not equivalent to the number of CPUs the current
     process can use.  The number of usable CPUs can be obtained with
     *note os.process_cpu_count(): 4da. (or
     ‘len(os.sched_getaffinity(0))’).

     When the number of CPUs cannot be determined a *note
     NotImplementedError: 36b. is raised.

     参考
     ....

     *note os.cpu_count(): 4db. *note os.process_cpu_count(): 4da.

     バージョン 3.13 で変更: The return value can also be overridden
     using the *note -X cpu_count: 16f. flag or *note PYTHON_CPU_COUNT:
     51e. as this is merely a wrapper around the *note os: a5. cpu count
     APIs.

 -- の関数: multiprocessing.current_process ()

     カレントプロセスに対応する *note Process: 252. オブジェクトを返しま
     す。

     *note threading.current_thread(): 35e. とよく似た関数です。

 -- の関数: multiprocessing.parent_process ()

     Return the *note Process: 252. object corresponding to the parent
     process of the *note current_process(): 367a.  For the main
     process, ‘parent_process’ will be ‘None’.

     Added in version 3.8.

 -- の関数: multiprocessing.freeze_support ()

     Add support for when a program which uses ‘multiprocessing’ has
     been frozen to produce an executable.  (Has been tested with
     'py2exe', 'PyInstaller' and 'cx_Freeze'.)

     メインモジュールの ‘if __name__ == '__main__'’ の直後にこの関数を呼
     び出す必要があります。以下に例を示します:

          from multiprocessing import Process, freeze_support

          def f():
              print('hello world!')

          if __name__ == '__main__':
              freeze_support()
              Process(target=f).start()

     もし ‘freeze_support()’ の行がない場合、フリーズされた実行可能形式
     を実行しようとすると *note RuntimeError: 244. を発生させます。

     Calling ‘freeze_support()’ has no effect when the start method is
     not 'spawn'.  In addition, if the module is being run normally by
     the Python interpreter (the program has not been frozen), then
     ‘freeze_support()’ has no effect.

 -- の関数: multiprocessing.get_all_start_methods ()

     Returns a list of the supported start methods, the first of which
     is the default.  The possible start methods are ‘'fork'’, ‘'spawn'’
     and ‘'forkserver'’.  Not all platforms support all methods.  See
     *note コンテキストと開始方式: 1d5.

     Added in version 3.4.

 -- の関数: multiprocessing.get_context (method=None)

     Return a context object which has the same attributes as the
     ‘multiprocessing’ module.

     If 'method' is ‘None’ then the default context is returned.  Note
     that if the global start method has not been set, this will set it
     to the system default See *note Global start method: 3658. for more
     details.  Otherwise 'method' should be ‘'fork'’, ‘'spawn'’,
     ‘'forkserver'’.  *note ValueError: 2ec. is raised if the specified
     start method is not available.  See *note コンテキストと開始方式:
     1d5.

     Added in version 3.4.

 -- の関数: multiprocessing.get_start_method (allow_none=False)

     開始するプロセスで使用する開始方式名を返します。

     If the global start method is not set and 'allow_none' is ‘False’,
     the global start method is set to the default, and its name is
     returned.  See *note Global start method: 3658. for more details.

     The return value can be ‘'fork'’, ‘'spawn'’, ‘'forkserver'’ or
     ‘None’.  See *note コンテキストと開始方式: 1d5.

     Added in version 3.4.

     バージョン 3.8 で変更: macOS では、 'spawn' 開始方式がデフォルトに
     なりました。 'fork' 開始方法は、サブプロセスのクラッシュを引き起こ
     す可能性があるため、安全ではありません。 bpo-33725(1) を参照。

 -- の関数: multiprocessing.set_executable (executable)

     Set the path of the Python interpreter to use when starting a child
     process.  (By default *note sys.executable: 3ed. is used).
     Embedders will probably need to do something like

          set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))

     子プロセスを作成する前に行ってください。

     バージョン 3.4 で変更: Now supported on POSIX when the ‘'spawn'’
     start method is used.

     バージョン 3.11 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: multiprocessing.set_forkserver_preload (module_names)

     Set a list of module names for the forkserver main process to
     attempt to import so that their already imported state is inherited
     by forked processes.  Any *note ImportError: 65b. when doing so is
     silently ignored.  This can be used as a performance enhancement to
     avoid repeated work in every process.

     For this to work, it must be called before the forkserver process
     has been launched (before creating a ‘Pool’ or starting a *note
     Process: 252.).

     Only meaningful when using the ‘'forkserver'’ start method.  See
     *note コンテキストと開始方式: 1d5.

     Added in version 3.4.

 -- の関数: multiprocessing.set_start_method (method, force=False)

     Set the method which should be used to start child processes.  The
     'method' argument can be ‘'fork'’, ‘'spawn'’ or ‘'forkserver'’.
     Raises *note RuntimeError: 244. if the start method has already
     been set and 'force' is not ‘True’.  If 'method' is ‘None’ and
     'force' is ‘True’ then the start method is set to ‘None’.  If
     'method' is ‘None’ and 'force' is ‘False’ then the context is set
     to the default context.

     これは一度しか呼び出すことができず、その場所もメインモジュールの
     ‘if __name__ == '__main__'’ 節内で保護された状態でなければなりませ
     ん。

     See *note コンテキストと開始方式: 1d5.

     Added in version 3.4.

     注釈: ‘multiprocessing’ contains no analogues of *note
     threading.active_count(): 35f, *note threading.enumerate(): 1c5a,
     *note threading.settrace(): a48, *note threading.setprofile(): a49,
     *note threading.Timer: 1371, or *note threading.local: 185f.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33725


File: python.info,  Node: Connection オブジェクト<2>,  Next: 同期プリミティブ,  Prev: その他<5>,  Up: リファレンス<3>

5.18.2.13 Connection オブジェクト
.................................

Connection オブジェクトは pickle でシリアライズ可能なオブジェクトか文字
列を送ったり、受け取ったりします。そういったオブジェクトはメッセージ指向
の接続ソケットと考えられます。

Connection オブジェクトは通常は *note Pipe: 364c. を使用して作成されます
。 詳細は *note リスナーとクライアント: 367d. も参照してください。

 -- クラス: multiprocessing.connection.Connection

      -- メソッド: send (obj)

          コネクションの相手側へ *note recv(): 367f. を使用して読み込む
          オブジェクトを送ります。

          オブジェクトは pickle でシリアライズ可能でなければなりません。
          pickle が極端に大きすぎる (OS にも依りますが、およそ 32 MiB+)
          と、 *note ValueError: 2ec. 例外が送出されることがあります。

      -- メソッド: recv ()

          コネクションの相手側から *note send(): 367e. を使用して送られ
          たオブジェクトを返します。 何か受け取るまでブロックします。何
          も受け取らずにコネクションの相手側でクローズされた場合 *note
          EOFError: 14f1. が発生します。

      -- メソッド: fileno ()

          コネクションが使用するハンドラーか、ファイル記述子を返します。

      -- メソッド: close ()

          コネクションをクローズします。

          コネクションがガベージコレクトされるときに自動的に呼び出されま
          す。

      -- メソッド: poll ([timeout])

          読み込み可能なデータがあるかどうかを返します。

          'timeout' が指定されていなければすぐに返します。 'timeout' に
          数値を指定すると、最大指定した秒数をブロッキングします。
          'timeout' に ‘None’ を指定するとタイムアウトせずにずっとブロッ
          キングします。

          *note multiprocessing.connection.wait(): 12f7. を使って複数の
          コネクションオブジェクトを同時にポーリングできることに注意して
          ください。

      -- メソッド: send_bytes (buffer[, offset[, size]])

          *note bytes-like object: 193. から完全なメッセージとしてバイト
          データを送ります。

          'offset' が指定されると 'buffer' のその位置からデータが読み込
          まれます。 'size' が指定されるとバッファーからその量のデータが
          読み込まれます。非常に大きなバッファー (OS に依存しますが、お
          よそ 32MiB+) を指定すると、 *note ValueError: 2ec. 例外が発生
          するかもしれません。

      -- メソッド: recv_bytes ([maxlength])

          コネクションの相手側から送られたバイトデータの完全なメッセージ
          を文字列として返します。何か受け取るまでブロックします。受け取
          るデータが何も残っておらず、相手側がコネクションを閉じていた場
          合、 *note EOFError: 14f1. が送出されます。

          'maxlength' を指定していて、かつメッセージが 'maxlength' より
          長い場合、 *note OSError: 2c0. が発生してコネクションからそれ
          以上読めなくなります。

          バージョン 3.3 で変更: この関数は以前は *note IOError: 125e. を
          送出していました。今では *note OSError: 2c0. の別名です。

      -- メソッド: recv_bytes_into (buffer[, offset])

          コネクションの相手側から送られたバイトデータを 'buffer' に読み
          込み、メッセージのバイト数を返します。 何か受け取るまでブロッ
          クします。何も受け取らずにコネクションの相手側でクローズされた
          場合 *note EOFError: 14f1. が発生します。

          'buffer' は書き込み可能な *note bytes-like object: 193. でなけ
          ればなりません。 'offset' が与えられたら、その位置からバッファ
          ーへメッセージが書き込まれます。 オフセットは 'buffer' バイト
          よりも小さい正の数でなければなりません。

          バッファーがあまりに小さいと ‘BufferTooShort’ 例外が発生します
          。 ‘e’ が例外インスタンスとすると完全なメッセージは
          ‘e.args[0]’ で確認できます。

     バージョン 3.3 で変更: *note Connection.send(): 367e. と *note
     Connection.recv(): 367f. を使用して Connection オブジェクト自体をプ
     ロセス間で転送できるようになりました。

     Connection objects also now support the context management protocol
     - see *note コンテキストマネージャ型: 240d.  *note __enter__():
     26a8. returns the connection object, and *note __exit__(): 26a9.
     calls *note close(): 3681.

例えば:

     >>> from multiprocessing import Pipe
     >>> a, b = Pipe()
     >>> a.send([1, 'hello', None])
     >>> b.recv()
     [1, 'hello', None]
     >>> b.send_bytes(b'thank you')
     >>> a.recv_bytes()
     b'thank you'
     >>> import array
     >>> arr1 = array.array('i', range(5))
     >>> arr2 = array.array('i', [0] * 10)
     >>> a.send_bytes(arr1)
     >>> count = b.recv_bytes_into(arr2)
     >>> assert count == len(arr1) * arr1.itemsize
     >>> arr2
     array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])
     警告: *note Connection.recv(): 367f. メソッドは受信したデータを自動
     的に unpickle 化します。それはメッセージを送ったプロセスが信頼でき
     る場合を除いてセキュリティリスクになります。

     そのため ‘Pipe()’ を使用してコネクションオブジェクトを生成する場合
     を除いて、何らかの認証処理を実行した後で *note recv(): 367f. や
     *note send(): 367e. メソッドのみを使用すべきです。詳細は *note
     認証キー: 3661. を参照してください。

     警告: もしプロセスがパイプの読み込みまたは書き込み中に kill される
     と、メッセージの境界がどこなのか分からなくなってしまうので、そのパ
     イプ内のデータは破損してしまいがちです。


File: python.info,  Node: 同期プリミティブ,  Next: 共有 ctypes オブジェクト,  Prev: Connection オブジェクト<2>,  Up: リファレンス<3>

5.18.2.14 同期プリミティブ
..........................

一般的にマルチプロセスプログラムは、マルチスレッドプログラムほどは同期プ
リミティブを必要としません。詳細は *note threading: f3. モジュールのドキ
ュメントを参照してください。

マネージャーオブジェクトを使用して同期プリミティブを作成できることも覚え
ておいてください。詳細は *note マネージャー: 366b. を参照してください。

 -- クラス: multiprocessing.Barrier (parties[, action[, timeout]])

     バリアーオブジェクト: *note threading.Barrier: 13fc. のクローンです
     。

     Instantiating this class may set the global start method.  See
     *note Global start method: 3658. for more details.

     Added in version 3.3.

 -- クラス: multiprocessing.BoundedSemaphore ([value])

     有限セマフォオブジェクト: *note threading.BoundedSemaphore: 136f. の
     類似物です。

     Instantiating this class may set the global start method.  See
     *note Global start method: 3658. for more details.

     よく似た *note threading.BoundedSemaphore: 136f. とは、次の一点だけ
     異なります。 ‘acquire’ メソッドの第一引数名は 'block' で、*note
     Lock.acquire(): 3688. と一致しています。

      -- メソッド: locked ()

          Return a boolean indicating whether this object is locked
          right now.

          Added in version 3.14.

          注釈: macOS では ‘sem_getvalue()’ が実装されていないので *note
          Semaphore: 3652. と区別がつきません。

 -- クラス: multiprocessing.Condition ([lock])

     状態変数: *note threading.Condition: 136d. の別名です。

     If 'lock' is specified then it should be a *note Lock: 1853. or
     *note RLock: 1854. object from ‘multiprocessing’.

     Instantiating this class may set the global start method.  See
     *note Global start method: 3658. for more details.

     バージョン 3.3 で変更: *note wait_for(): 362d. メソッドが追加されま
     した。

 -- クラス: multiprocessing.Event

     *note threading.Event: 1370. のクローンです。

     Instantiating this class may set the global start method.  See
     *note Global start method: 3658. for more details.

 -- クラス: multiprocessing.Lock

     再帰しないロックオブジェクトで、 *note threading.Lock: 19f4. 相当の
     ものです。プロセスやスレッドがロックをいったん獲得 (acquire) すると
     、それに続くほかのプロセスやスレッドが獲得しようとする際、それが解
     放 (release) されるまではブロックされます。解放はどのプロセス、スレ
     ッドからも行えます。スレッドに対して適用される *note
     threading.Lock: 19f4. のコンセプトと振る舞いは、特筆すべきものがな
     い限り、プロセスとスレッドに適用される *note multiprocessing.Lock:
     1853. に引き継がれています。

     *note Lock: 1853. は実際にはファクトリ関数で、デフォルトコンテキス
     トで初期化された ‘multiprocessing.synchronize.Lock’ のインスタンス
     を返すことに注意してください。

     Instantiating this class may set the global start method.  See
     *note Global start method: 3658. for more details.

     *note Lock: 1853. は *note context manager: 1e1. プロトコルをサポー
     トしています。つまり *note with: 186. 文で使うことができます。

      -- メソッド: acquire (block=True, timeout=None)

          ブロックあり、またはブロックなしでロックを獲得します。

          引数 'block' を ‘True’ (デフォルト) に設定して呼び出した場合、
          ロックがアンロック状態になるまでブロックします。ブロックから抜
          けるとそれをロック状態にしてから ‘True’ を返します。 *note
          threading.Lock.acquire(): 8a7. の最初の引数とは名前が違ってい
          るので注意してください。

          引数 'block' の値を ‘False’ にして呼び出すとブロックしません。
          現在ロック状態であれば、直ちに ‘False’ を返します。それ以外の
          場合には、ロックをロック状態にして ‘True’ を返します。

          'timeout' として正の浮動小数点数を与えて呼び出すと、ロックが獲
          得できない限り、指定された秒数だけブロックします。 'timeout' 値
          に負数を与えると、ゼロを与えた場合と同じになります。 'timeout'
          値の ‘None’ (デフォルト) を与えると、無限にブロックします。
          'timeout' 引数の負数と ‘None’ の扱いは、 *note
          threading.Lock.acquire(): 8a7. に実装された動作と異なるので注
          意してください。 'block' が ‘False’ の場合、 'timeout' は実際
          的な意味を持たなくなるので無視されます。ロックを獲得した場合は
          ‘True’ 、タイムアウトした場合は ‘False’ で戻ります。

      -- メソッド: release ()

          ロックを解放します。これはロックを獲得したプロセスやスレッドだ
          けでなく、任意のプロセスやスレッドから呼ぶことができます。

          *note threading.Lock.release(): 14da. と同じように振舞いますが
          、ロックされていない場合に呼び出すと *note ValueError: 2ec. と
          なる点だけが違います。

      -- メソッド: locked ()

          Return a boolean indicating whether this object is locked
          right now.

          Added in version 3.14.

 -- クラス: multiprocessing.RLock

     再帰ロックオブジェクトで、 *note threading.RLock: 32e. 相当のもので
     す。再帰ロックオブジェクトはそれを獲得 (acquire) したプロセスやスレ
     ッドが解放 (release) しなければなりません。プロセスやスレッドがロッ
     クをいったん獲得すると、同じプロセスやスレッドはブロックされずに再
     度獲得出来ます。そのプロセスやスレッドは獲得した回数ぶん解放しなけ
     ればなりません。

     *note RLock: 1854. は実際にはファクトリ関数で、デフォルトコンテキス
     トで初期化された ‘multiprocessing.synchronize.Lock’ のインスタンス
     を返すことに注意してください。

     Instantiating this class may set the global start method.  See
     *note Global start method: 3658. for more details.

     *note RLock: 1854. は *note context manager: 1e1. プロトコルをサポ
     ートしています。つまり *note with: 186. 文で使うことができます。

      -- メソッド: acquire (block=True, timeout=None)

          ブロックあり、またはブロックなしでロックを獲得します。

          'block' 引数を ‘True’ にして呼び出した場合、ロックが既にカレン
          トプロセスもしくはカレントスレッドが既に所有していない限りは、
          アンロック状態 (どのプロセス、スレッドも所有していない状態) に
          なるまでブロックします。ブロックから抜けるとカレントプロセスも
          しくはカレントスレッドが (既に持っていなければ) 所有権を得て、
          再帰レベルをインクリメントし、 ‘True’ で戻ります。 *note
          threading.RLock.acquire(): 107b. の実装とはこの最初の引数の振
          る舞いが、その名前自身を始めとしていくつか違うので注意してくだ
          さい。

          'block' 引数を ‘False’ にして呼び出した場合、ブロックしません
          。ロックが他のプロセスもしくはスレッドにより獲得済み (つまり所
          有されている) であれば、カレントプロセスまたはカレントスレッド
          は所有権を得ず、再帰レベルも変更せずに、 ‘False’ で戻ります。
          ロックがアンロック状態の場合、カレントプロセスもしくはカレント
          スレッドは所有権を得て再帰レベルがインクリメントされ、 ‘True’
          で戻ります。(--訳注: 'block' の True/False 関係なくここでの説
          明では「所有権を持っている場合の2度目以降の aquire」の説明が欠
          けています。2度目以降の acquire では再帰レベルがインクリメント
          されて即座に返ります。全体読めばわかるとは思いますが一応。--)

          'timeout' 引数の使い方と振る舞いは *note Lock.acquire(): 3688.
          と同じです。 'timeout' 引数の振る舞いがいくつかの点で *note
          threading.RLock.acquire(): 107b. と異なるので注意してください
          。

      -- メソッド: release ()

          再帰レベルをデクリメントしてロックを解放します。デクリメント後
          に再帰レベルがゼロになった場合、ロックの状態をアンロック (いか
          なるプロセス、いかなるスレッドにも所有されていない状態) にリセ
          ットし、ロックの状態がアンロックになるのを待ってブロックしてい
          るプロセスもしくはスレッドがある場合にはその中のただ一つだけが
          処理を進行できるようにします。デクリメント後も再帰レベルがゼロ
          でない場合、ロックの状態はロックのままで、呼び出し側のプロセス
          もしくはスレッドに所有されたままになります。

          このメソッドは呼び出しプロセスあるいはスレッドがロックを所有し
          ている場合に限り呼び出してください。所有者でないプロセスもしく
          はスレッドによって呼ばれるか、あるいはアンロック (未所有) 状態
          で呼ばれた場合、 *note AssertionError: 8b8. が送出されます。同
          じ状況での *note threading.RLock.release(): 3628. 実装とは例外
          の型が異なるので注意してください。

      -- メソッド: locked ()

          Return a boolean indicating whether this object is locked
          right now.

          Added in version 3.14.

 -- クラス: multiprocessing.Semaphore ([value])

     セマフォオブジェクト: *note threading.Semaphore: 136e. のクローンで
     す。

     Instantiating this class may set the global start method.  See
     *note Global start method: 3658. for more details.

     よく似た *note threading.BoundedSemaphore: 136f. とは、次の一点だけ
     異なります。 ‘acquire’ メソッドの第一引数名は 'block' で、*note
     Lock.acquire(): 3688. と一致しています。

      -- メソッド: get_value ()

          Return the current value of semaphore.

          Note that this may raise *note NotImplementedError: 36b. on
          platforms like macOS where ‘sem_getvalue()’ is not
          implemented.

      -- メソッド: locked ()

          Return a boolean indicating whether this object is locked
          right now.

          Added in version 3.14.

     注釈: macOS では ‘sem_timedwait’ がサポートされていないので、
     ‘acquire()’ にタイムアウトを与えて呼ぶと、ループ内でスリープするこ
     とでこの関数がエミュレートされます。

     注釈: このパッケージに含まれる機能には、ホストとなるオペレーティン
     グシステム上で動作している共有セマフォを使用しているものがあります
     。これが使用できない場合には、‘multiprocessing.synchronize’ モジュ
     ールが無効になり、このモジュールのインポート時に *note ImportError:
     65b. が発生します。詳細は bpo-3770(1) を参照してください。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=3770


File: python.info,  Node: 共有 ctypes オブジェクト,  Next: マネージャー,  Prev: 同期プリミティブ,  Up: リファレンス<3>

5.18.2.15 共有 ‘ctypes’ オブジェクト
....................................

子プロセスにより継承される共有メモリを使用する共有オブジェクトを作成する
ことができます。

 -- の関数: multiprocessing.Value (typecode_or_type, *args, lock=True)

     共有メモリから割り当てられた *note ctypes: 2e. オブジェクトを返しま
     す。 デフォルトでは、返り値は実際のオブジェクトの同期ラッパーです。
     オブジェクトそれ自身は、 *note Value: 364f. の 'value' 属性によって
     アクセスできます。

     'typecode_or_type' は返されるオブジェクトの型を決めます。それは
     ctypes の型か *note array: 8. モジュールで使用されるような1文字の型
     コードかのどちらか一方です。 '*args' は型のコンストラクターへ渡され
     ます。

     'lock' が ‘True’ (デフォルト) なら、値へ同期アクセスするために新た
     に再帰的なロックオブジェクトが作成されます。 'lock' が *note Lock:
     1853. か *note RLock: 1854. なら値への同期アクセスに使用されます。
     'lock' が ‘False’ なら、返されたオブジェクトへのアクセスはロックに
     より自動的に保護されません。そのため、必ずしも "プロセスセーフ" で
     はありません。

     ‘+=’ のような演算は、読み込みと書き込みを含むためアトミックでありま
     せん。このため、たとえば自動的に共有の値を増加させたい場合、以下の
     ようにするのでは不十分です

          counter.value += 1

     関連するロックが再帰的 (それがデフォルトです) なら、かわりに次のよ
     うにします

          with counter.get_lock():
              counter.value += 1

     'lock' はキーワード専用引数であることに注意してください。

 -- の関数: multiprocessing.Array (typecode_or_type,
          size_or_initializer, *, lock=True)

     共有メモリから割り当てられた ctypes 配列を返します。デフォルトでは
     、返り値は実際の配列の同期ラッパーです。

     'typecode_or_type' determines the type of the elements of the
     returned array: it is either a *note ctypes type: 32d8. or a one
     character typecode of the kind used by the *note array: 8. module
     with the exception of ‘'w'’, which is not supported.  In addition,
     the ‘'c'’ typecode is an alias for *note ctypes.c_char: 32db.  If
     'size_or_initializer' is an integer, then it determines the length
     of the array, and the array will be initially zeroed.  Otherwise,
     'size_or_initializer' is a sequence which is used to initialize the
     array and whose length determines the length of the array.

     'lock' が ‘True’ (デフォルト) なら、値へ同期アクセスするために新た
     なロックオブジェクトが作成されます。 'lock' が *note Lock: 1853. か
     *note RLock: 1854. なら値への同期アクセスに使用されます。 'lock' が
     ‘False’ なら、返されたオブジェクトへのアクセスはロックにより自動的
     に保護されません。そのため、必ずしも "プロセスセーフ" ではありませ
     ん。

     'lock' はキーワード引数としてのみ利用可能なことに注意してください。

     *note ctypes.c_char: 32db. の配列は文字列を格納して取り出せる
     'value' と 'raw' 属性を持っていることを覚えておいてください。

* Menu:

* The multiprocessing.sharedctypes module: The multiprocessing sharedctypes module.


File: python.info,  Node: The multiprocessing sharedctypes module,  Up: 共有 ctypes オブジェクト

5.18.2.16 The ‘multiprocessing.sharedctypes’ module
...................................................

The ‘multiprocessing.sharedctypes’ module provides functions for
allocating *note ctypes: 2e. objects from shared memory which can be
inherited by child processes.

     注釈: 共有メモリのポインターを格納することは可能ではありますが、特
     定プロセスのアドレス空間の位置を参照するということを覚えておいてく
     ださい。しかし、そのポインターは別のプロセスのコンテキストにおいて
     無効になる確率が高いです。そして、別のプロセスからそのポインターを
     逆参照しようとするとクラッシュを引き起こす可能性があります。

 -- の関数: multiprocessing.sharedctypes.RawArray (typecode_or_type,
          size_or_initializer)

     共有メモリから割り当てられた ctypes 配列を返します。

     'typecode_or_type' は返される配列の要素の型を決めます。それは
     ctypes の型か *note array: 8. モジュールで使用されるような1文字の型
     コードのどちらか一方です。 'size_or_initializer' が整数なら、それが
     配列の長さになり、その配列はゼロで初期化されます。別の使用方法とし
     て 'size_or_initializer' には配列の初期化に使用されるシーケンスを設
     定することもでき、その場合はシーケンスの長さが配列の長さになります
     。

     要素を取得したり設定したりすることは潜在的に非アトミックであること
     に注意してください。ロックを使用して自動的に同期化されたアクセスを
     保証するには *note Array(): 3692. を使用してください。

 -- の関数: multiprocessing.sharedctypes.RawValue (typecode_or_type,
          *args)

     共有メモリから割り当てられた ctypes オブジェクトを返します。

     'typecode_or_type' は返されるオブジェクトの型を決めます。それは
     ctypes の型か *note array: 8. モジュールで使用されるような1文字の型
     コードかのどちらか一方です。 '*args' は型のコンストラクターへ渡され
     ます。

     値を取得したり設定したりすることは潜在的に非アトミックであることに
     注意してください。ロックを使用して自動的に同期化されたアクセスを保
     証するには *note Value(): 3694. を使用してください。

     *note ctypes.c_char: 32db. の配列は文字列を格納して取り出せる
     ‘value’ と ‘raw’ 属性を持っていることを覚えておいてください。詳細は
     *note ctypes: 2e. を参照してください。

 -- の関数: multiprocessing.sharedctypes.Array (typecode_or_type,
          size_or_initializer, *, lock=True, ctx=None)

     *note RawArray(): 3691. と同様ですが、 'lock' の値によっては ctypes
     配列をそのまま返す代わりに、プロセスセーフな同期ラッパーが返されま
     す。

     'lock' が ‘True’ (デフォルト) なら、値へ同期アクセスするために新た
     な ロックオブジェクトが作成されます。 'lock' が *note Lock: 1853. か
     *note RLock: 1854. なら値への同期アクセスに使用されます。 'lock' が
     ‘False’ なら、返された オブジェクトへのアクセスはロックにより自動的
     に保護されません。 そのため、必ずしも "プロセスセーフ" ではありませ
     ん。

     'ctx' is a context object, or ‘None’ (use the current context).  If
     ‘None’, calling this may set the global start method.  See *note
     Global start method: 3658. for more details.

     Note that 'lock' and 'ctx' are keyword-only parameters.

 -- の関数: multiprocessing.sharedctypes.Value (typecode_or_type, *args,
          lock=True, ctx=None)

     *note RawValue(): 3693. と同様ですが、 'lock' の値によっては ctypes
     オブジェクトをそのまま返す代わりに、プロセスセーフな同期ラッパーが
     返されます。

     'lock' が ‘True’ (デフォルト) なら、値へ同期アクセスするために新た
     な ロックオブジェクトが作成されます。 'lock' が *note Lock: 1853. か
     *note RLock: 1854. なら値への同期アクセスに使用されます。 'lock' が
     ‘False’ なら、返された オブジェクトへのアクセスはロックにより自動的
     に保護されません。 そのため、必ずしも "プロセスセーフ" ではありませ
     ん。

     'ctx' is a context object, or ‘None’ (use the current context).  If
     ‘None’, calling this may set the global start method.  See *note
     Global start method: 3658. for more details.

     Note that 'lock' and 'ctx' are keyword-only parameters.

 -- の関数: multiprocessing.sharedctypes.copy (obj)

     共有メモリから割り当てられた ctypes オブジェクト 'obj' をコピーした
     オブジェクトを返します。

 -- の関数: multiprocessing.sharedctypes.synchronized (obj, lock=None,
          ctx=None)

     同期アクセスに 'lock' を使用する ctypes オブジェクトのためにプロセ
     スセーフなラッパーオブジェクトを返します。 'lock' が ‘None’ (デフォ
     ルト) なら、 *note multiprocessing.RLock: 1854. オブジェクトが自動
     的に作成されます。

     'ctx' is a context object, or ‘None’ (use the current context).  If
     ‘None’, calling this may set the global start method.  See *note
     Global start method: 3658. for more details.

     同期ラッパーがラップするオブジェクトに加えて2つのメソッドがあります
     。 ‘get_obj()’ はラップされたオブジェクトを返します。 ‘get_lock()’
     は同期のために使用されるロックオブジェクトを返します。

     ラッパー経由で ctypes オブジェクトにアクセスすることは raw ctypes オ
     ブジェクトへアクセスするよりずっと遅くなることに注意してください。

     バージョン 3.5 で変更: synchronized オブジェクトは *note
     コンテキストマネージャ: 1e1. プロトコルをサポートしています。

次の表は通常の ctypes 構文で共有メモリから共有 ctypes オブジェクトを作成
するための構文を比較します。 (‘MyStruct’ テーブル内には *note
ctypes.Structure: 1e5. のサブクラスがあります。)

ctypes                   type を使用する sharedctypes   typecode を使用する
                                                        sharedctypes
                                                        
----------------------------------------------------------------------------------------
                                                        
c_double(2.4)            RawValue(c_double, 2.4)        RawValue('d', 2.4)
                                                        
                                                        
MyStruct(4, 6)           RawValue(MyStruct, 4, 6)
                         
                                                        
(c_short * 7)()          RawArray(c_short, 7)           RawArray('h', 7)
                                                        
                                                        
(c_int * 3)(9, 2, 8)     RawArray(c_int, (9, 2, 8))     RawArray('i', (9, 2, 8))
                                                        

以下に子プロセスが多くの ctypes オブジェクトを変更する例を紹介します:

     from multiprocessing import Process, Lock
     from multiprocessing.sharedctypes import Value, Array
     from ctypes import Structure, c_double

     class Point(Structure):
         _fields_ = [('x', c_double), ('y', c_double)]

     def modify(n, x, s, A):
         n.value **= 2
         x.value **= 2
         s.value = s.value.upper()
         for a in A:
             a.x **= 2
             a.y **= 2

     if __name__ == '__main__':
         lock = Lock()

         n = Value('i', 7)
         x = Value(c_double, 1.0/3.0, lock=False)
         s = Array('c', b'hello world', lock=lock)
         A = Array(Point, [(1.875,-6.25), (-5.75,2.0), (2.375,9.5)], lock=lock)

         p = Process(target=modify, args=(n, x, s, A))
         p.start()
         p.join()

         print(n.value)
         print(x.value)
         print(s.value)
         print([(a.x, a.y) for a in A])

結果は以下のように表示されます

     49
     0.1111111111111111
     HELLO WORLD
     [(3.515625, 39.0625), (33.0625, 4.0), (5.640625, 90.25)]


File: python.info,  Node: マネージャー,  Next: Proxy オブジェクト,  Prev: 共有 ctypes オブジェクト,  Up: リファレンス<3>

5.18.2.17 マネージャー
......................

マネージャーは異なるプロセス間で共有されるデータの作成方法を提供します。
これには別のマシン上で走るプロセス間のネットワーク越しの共有も含まれます
。マネージャーオブジェクトは '共有オブジェクト' を管理するサーバープロセ
スを制御します。他のプロセスはプロキシ経由で共有オブジェクトへアクセスす
ることができます。

 -- の関数: multiprocessing.Manager ()

     プロセス間でオブジェクトを共有するために使用される *note
     SyncManager: 1894. オブジェクトを返します。返されたマネージャーオブ
     ジェクトは生成される子プロセスに対応付けられ、共有オブジェクトを作
     成するメソッドや、共有オブジェクトに対応するプロキシを返すメソッド
     を持ちます。

マネージャープロセスは親プロセスが終了するか、ガベージコレクトされると停
止します。マネージャークラスは *note multiprocessing.managers: 9b. モジ
ュールで定義されています:

 -- クラス: multiprocessing.managers.BaseManager (address=None,
          authkey=None, serializer='pickle', ctx=None, *,
          shutdown_timeout=1.0)

     BaseManager オブジェクトを作成します。

     作成後、*note start(): 3698. または ‘get_server().serve_forever()’
     を呼び出して、マネージャーオブジェクトが、開始されたマネージャープ
     ロセスを確実に参照するようにしてください。

     'address' はマネージャープロセスが新たなコネクションを待ち受けるア
     ドレスです。'address' が ‘None’ の場合、任意のアドレスが設定されま
     す。

     'authkey' はサーバープロセスへ接続しようとするコネクションの正当性
     を検証するために 使用される認証キーです。'authkey' が ‘None’ の場合
     ‘current_process().authkey’ が使用されます。'authkey' を使用する場
     合はバイト文字列でなければなりません。

     'serializer' must be ‘'pickle'’ (use *note pickle: ab.
     serialization) or ‘'xmlrpclib'’ (use *note xmlrpc.client: 134.
     serialization).

     'ctx' is a context object, or ‘None’ (use the current context).  If
     ‘None’, calling this may set the global start method.  See *note
     Global start method: 3658. for more details.

     'shutdown_timeout' is a timeout in seconds used to wait until the
     process used by the manager completes in the *note shutdown():
     3699. method.  If the shutdown times out, the process is
     terminated.  If terminating the process also times out, the process
     is killed.

     バージョン 3.11 で変更: 'shutdown_timeout' パラメータを追加しました
     。

      -- メソッド: start ([initializer[, initargs]])

          マネージャーを開始するためにサブプロセスを開始します。
          'initializer' が ‘None’ でなければ、サブプロセスは開始時に
          ‘initializer(*initargs)’ を呼び出します。

      -- メソッド: get_server ()

          マネージャーの制御下にある実際のサーバーを表す ‘Server’ オブジ
          ェクトを返します。 ‘Server’ オブジェクトは ‘serve_forever()’ メ
          ソッドをサポートします:

               >>> from multiprocessing.managers import BaseManager
               >>> manager = BaseManager(address=('', 50000), authkey=b'abc')
               >>> server = manager.get_server()
               >>> server.serve_forever()

          ‘Server’ はさらに *note address: 369b. 属性も持っています。

      -- メソッド: connect ()

          ローカルからリモートのマネージャーオブジェクトへ接続します:

               >>> from multiprocessing.managers import BaseManager
               >>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')
               >>> m.connect()

      -- メソッド: shutdown ()

          マネージャーが使用するプロセスを停止します。これはサーバープロ
          セスを開始するために *note start(): 3698. が使用された場合のみ
          有効です。

          これは複数回呼び出すことができます。

      -- メソッド: register (typeid[, callable[, proxytype[, exposed[,
               method_to_typeid[, create_method]]]]])

          マネージャークラスで呼び出し可能オブジェクト(callable)や型を登
          録するために使用されるクラスメソッドです。

          'typeid' は特に共有オブジェクトの型を識別するために使用される
          "型識別子" です。これは文字列でなければなりません。

          'callable' はこの型識別子のオブジェクトを作成するために使用さ
          れる呼び出し可能オブジェクトです。マネージャーインスタンスが
          *note connect(): 369c. メソッドを使ってサーバーに接続されてい
          るか、 'create_method' 引数が ‘False’ の場合は、 ‘None’ でも構
          いません。

          'proxytype' はこの 'typeid' で共有オブジェクトのプロキシを作成
          するために使用される *note BaseProxy: 369e. のサブクラスです。
          ‘None’ の場合、プロキシクラスは自動的に作成されます。

          'exposed' は *note BaseProxy._callmethod(): 369f. を使用したア
          クセスが許されるべき typeid をプロキシするメソッド名のシーケン
          スを指定するために使用されます ('exposed' が ‘None’ の場合
          ‘proxytype._exposed_’ が存在すればそれが代わりに使用されます
          )。'exposed' リストが指定されない場合、共有オブジェクトのすべ
          ての "パブリックメソッド" がアクセス可能になります。 (ここでい
          う "パブリックメソッド" とは *note __call__(): 77a. メソッドを
          持つものと名前が ‘'_'’ で始まらないあらゆる属性を意味します。)

          'method_to_typeid' はプロキシが返す exposed メソッドの返り値の
          型を指定するために使用されるマッピングで、メソッド名を typeid
          文字列にマップします。 ('method_to_typeid' が ‘None’ の場合
          ‘proxytype._method_to_typeid_’ が存在すれば、それが代わりに使
          用されます。) メソッド名がこのマッピングのキーではないか、マッ
          ピングが ‘None’ の場合、そのメソッドによって返されるオブジェク
          トが値として (by value) コピーされます。

          'create_method' は、共有オブジェクトを作成し、それに対するプロ
          キシを返すようサーバープロセスに伝える、名前 'typeid' のメソッ
          ドを作成するかを決定します。デフォルトでは ‘True’ です。

     *note BaseManager: 3697. インスタンスも読み出し専用属性を1つ持って
     います:

      -- の属性: address

          マネージャーが使用するアドレスです。

     バージョン 3.3 で変更: マネージャーオブジェクトはコンテキストマネー
     ジメント・プロトコルをサポートします - *note
     コンテキストマネージャ型: 240d. を参照してください。 *note
     __enter__(): 26a8. は (まだ開始していない場合) サーバープロセスを開
     始してから、マネージャーオブジェクトを返します。 *note __exit__():
     26a9. は *note shutdown(): 3699. を呼び出します。

     旧バージョンでは、 *note __enter__(): 26a8. はマネージャーのサーバ
     ープロセスがまだ開始していなかった場合でもプロセスを開始しませんで
     した。

 -- クラス: multiprocessing.managers.SyncManager

     プロセス間の同期のために使用される *note BaseManager: 3697. のサブ
     クラスです。 *note multiprocessing.Manager(): 250. はこの型のオブジ
     ェクトを返します。

     Its methods create and return *note Proxy オブジェクト: 24c. for a
     number of commonly used data types to be synchronized across
     processes.  This notably includes shared lists and dictionaries.

      -- メソッド: Barrier (parties[, action[, timeout]])

          共有 *note threading.Barrier: 13fc. オブジェクトを作成して、そ
          のプロキシを返します。

          Added in version 3.3.

      -- メソッド: BoundedSemaphore ([value])

          共有 *note threading.BoundedSemaphore: 136f. オブジェクトを作
          成して、そのプロキシを返します。

      -- メソッド: Condition ([lock])

          共有 *note threading.Condition: 136d. オブジェクトを作成して、
          そのプロキシを返します。

          'lock' が提供される場合 *note threading.Lock: 19f4. か *note
          threading.RLock: 32e. オブジェクトのためのプロキシになります。

          バージョン 3.3 で変更: *note wait_for(): 362d. メソッドが追加
          されました。

      -- メソッド: Event ()

          共有 *note threading.Event: 1370. オブジェクトを作成して、その
          プロキシを返します。

      -- メソッド: Lock ()

          共有 *note threading.Lock: 19f4. オブジェクトを作成して、その
          プロキシを返します。

      -- メソッド: Namespace ()

          共有 *note Namespace: 3651. オブジェクトを作成して、そのプロキ
          シを返します。

      -- メソッド: Queue ([maxsize])

          共有 *note queue.Queue: 15ac. オブジェクトを作成して、そのプロ
          キシを返します。

      -- メソッド: RLock ()

          共有 *note threading.RLock: 32e. オブジェクトを作成して、その
          プロキシを返します。

      -- メソッド: Semaphore ([value])

          共有 *note threading.Semaphore: 136e. オブジェクトを作成して、
          そのプロキシを返します。

      -- メソッド: Array (typecode, sequence)

          配列を作成して、そのプロキシを返します。

      -- メソッド: Value (typecode, value)

          書き込み可能な ‘value’ 属性を作成して、そのプロキシを返します
          。

      -- メソッド: dict ()

      -- メソッド: dict (mapping)

      -- メソッド: dict (sequence)

          共有 *note dict: 183. オブジェクトを作成して、そのプロキシを返
          します。

      -- メソッド: list ()

      -- メソッド: list (sequence)

          共有 *note list: 24d. オブジェクトを作成して、そのプロキシを返
          します。

      -- メソッド: set ()

      -- メソッド: set (sequence)

      -- メソッド: set (mapping)

          Create a shared *note set: 184. object and return a proxy for
          it.

          Added in version 3.14: *note set: 184. support was added.

     バージョン 3.6 で変更: 共有オブジェクトは入れ子もできます。 例えば
     、共有リストのような共有コンテナオブジェクトは、 *note SyncManager:
     1894. がまとめて管理し同期を取っている他の共有オブジェクトを保持で
     きます。

 -- クラス: multiprocessing.managers.Namespace

     *note SyncManager: 1894. に登録することのできる型です。

     Namespace オブジェクトにはパブリックなメソッドはありませんが、書き
     込み可能な属性を持ちます。そのオブジェクト表現はその属性の値を表示
     します。

     しかし、Namespace オブジェクトのためにプロキシを使用するとき ‘'_'’
     が先頭に付く属性はプロキシの属性になり、参照対象の属性にはなりませ
     ん:

          >>> mp_context = multiprocessing.get_context('spawn')
          >>> manager = mp_context.Manager()
          >>> Global = manager.Namespace()
          >>> Global.x = 10
          >>> Global.y = 'hello'
          >>> Global._z = 12.3    # this is an attribute of the proxy
          >>> print(Global)
          Namespace(x=10, y='hello')

* Menu:

* カスタマイズされたマネージャー::
* リモートマネージャーを使用する::


File: python.info,  Node: カスタマイズされたマネージャー,  Next: リモートマネージャーを使用する,  Up: マネージャー

5.18.2.18 カスタマイズされたマネージャー
........................................

独自のマネージャーを作成するには、*note BaseManager: 3697. のサブクラス
を作成して、 マネージャークラスで呼び出し可能なオブジェクトか新たな型を
登録するために *note register(): 369d. クラスメソッドを使用します。例え
ば:

     from multiprocessing.managers import BaseManager

     class MathsClass:
         def add(self, x, y):
             return x + y
         def mul(self, x, y):
             return x * y

     class MyManager(BaseManager):
         pass

     MyManager.register('Maths', MathsClass)

     if __name__ == '__main__':
         with MyManager() as manager:
             maths = manager.Maths()
             print(maths.add(4, 3))         # prints 7
             print(maths.mul(7, 8))         # prints 56


File: python.info,  Node: リモートマネージャーを使用する,  Prev: カスタマイズされたマネージャー,  Up: マネージャー

5.18.2.19 リモートマネージャーを使用する
........................................

あるマシン上でマネージャーサーバーを実行して、他のマシンからそのサーバー
を使用するクライアントを持つことができます(ファイアウォールを通過できる
ことが前提)。

次のコマンドを実行することでリモートクライアントからアクセスを受け付ける
1つの共有キューのためにサーバーを作成します:

     >>> from multiprocessing.managers import BaseManager
     >>> from queue import Queue
     >>> queue = Queue()
     >>> class QueueManager(BaseManager): pass
     >>> QueueManager.register('get_queue', callable=lambda:queue)
     >>> m = QueueManager(address=('', 50000), authkey=b'abracadabra')
     >>> s = m.get_server()
     >>> s.serve_forever()

あるクライアントからサーバーへのアクセスは次のようになります:

     >>> from multiprocessing.managers import BaseManager
     >>> class QueueManager(BaseManager): pass
     >>> QueueManager.register('get_queue')
     >>> m = QueueManager(address=('foo.bar.org', 50000), authkey=b'abracadabra')
     >>> m.connect()
     >>> queue = m.get_queue()
     >>> queue.put('hello')

別のクライアントもそれを使用することができます:

     >>> from multiprocessing.managers import BaseManager
     >>> class QueueManager(BaseManager): pass
     >>> QueueManager.register('get_queue')
     >>> m = QueueManager(address=('foo.bar.org', 50000), authkey=b'abracadabra')
     >>> m.connect()
     >>> queue = m.get_queue()
     >>> queue.get()
     'hello'

ローカルプロセスもそのキューへアクセスすることができます。クライアント上
で上述のコードを使用してアクセスします:

     >>> from multiprocessing import Process, Queue
     >>> from multiprocessing.managers import BaseManager
     >>> class Worker(Process):
     ...     def __init__(self, q):
     ...         self.q = q
     ...         super().__init__()
     ...     def run(self):
     ...         self.q.put('local hello')
     ...
     >>> queue = Queue()
     >>> w = Worker(queue)
     >>> w.start()
     >>> class QueueManager(BaseManager): pass
     ...
     >>> QueueManager.register('get_queue', callable=lambda: queue)
     >>> m = QueueManager(address=('', 50000), authkey=b'abracadabra')
     >>> s = m.get_server()
     >>> s.serve_forever()


File: python.info,  Node: Proxy オブジェクト,  Next: プロセスプール,  Prev: マネージャー,  Up: リファレンス<3>

5.18.2.20 Proxy オブジェクト
............................

プロキシは別のプロセスで(おそらく)有効な共有オブジェクトを '参照する' オ
ブジェクトです。共有オブジェクトはプロキシの '参照対象' になるということ
ができます。複数のプロキシオブジェクトが同じ参照対象を持つ可能性もありま
す。

プロキシオブジェクトはその参照対象の対応するメソッドを呼び出すメソッドを
持ちます (そうは言っても、参照対象のすべてのメソッドが必ずしもプロキシ経
由で利用可能なわけではありません)。 この方法で、プロキシオブジェクトはま
るでその参照先と同じように使えます:

     >>> mp_context = multiprocessing.get_context('spawn')
     >>> manager = mp_context.Manager()
     >>> l = manager.list([i*i for i in range(10)])
     >>> print(l)
     [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
     >>> print(repr(l))
     <ListProxy object, typeid 'list' at 0x...>
     >>> l[4]
     16
     >>> l[2:5]
     [4, 9, 16]

プロキシに *note str(): 169. を適用すると参照対象のオブジェクト表現を返
すのに対して、 *note repr(): 1c1. を適用するとプロキシのオブジェクト表現
を返すことに注意してください。

プロキシオブジェクトの重要な機能は pickle 化ができることで、これによりプ
ロセス間での受け渡しができます。 そのため、参照対象が *note Proxy
オブジェクト: 24c. を持てます。 これによって管理されたリスト、辞書、その
他 *note Proxy オブジェクト: 24c. をネストできます:

     >>> a = manager.list()
     >>> b = manager.list()
     >>> a.append(b)         # referent of a now contains referent of b
     >>> print(a, b)
     [<ListProxy object, typeid 'list' at ...>] []
     >>> b.append('hello')
     >>> print(a[0], b)
     ['hello'] ['hello']

同様に、辞書とリストのプロキシも他のプロキシの内部に入れてネストできます
:

     >>> l_outer = manager.list([ manager.dict() for i in range(2) ])
     >>> d_first_inner = l_outer[0]
     >>> d_first_inner['a'] = 1
     >>> d_first_inner['b'] = 2
     >>> l_outer[1]['c'] = 3
     >>> l_outer[1]['z'] = 26
     >>> print(l_outer[0])
     {'a': 1, 'b': 2}
     >>> print(l_outer[1])
     {'c': 3, 'z': 26}

(プロキシでない) 標準の *note list: 24d. オブジェクトや *note dict: 183.
オブジェクトが参照対象に含まれていた場合、それらの可変な値の変更はマネー
ジャーからは伝搬されません。 というのも、プロキシには参照対象の中に含ま
れる値がいつ変更されたかを知る術が無いのです。 しかし、コンテナプロキシ
に値を保存する (これはプロキシオブジェクトの ‘__setitem__’ を起動します)
場合はマネージャーを通して変更が伝搬され、その要素を実際に変更するために
、コンテナプロキシに変更後の値が再代入されます:

     # create a list proxy and append a mutable object (a dictionary)
     lproxy = manager.list()
     lproxy.append({})
     # now mutate the dictionary
     d = lproxy[0]
     d['a'] = 1
     d['b'] = 2
     # at this point, the changes to d are not yet synced, but by
     # updating the dictionary, the proxy is notified of the change
     lproxy[0] = d

This approach is perhaps less convenient than employing nested *note
Proxy オブジェクト: 24c. for most use cases but also demonstrates a
level of control over the synchronization.

     注釈: The proxy types in ‘multiprocessing’ do nothing to support
     comparisons by value.  So, for instance, we have:

          >>> manager.list([1,2,3]) == [1,2,3]
          False

     比較を行いたいときは参照対象のコピーを使用してください。

 -- クラス: multiprocessing.managers.BaseProxy

     プロキシオブジェクトは *note BaseProxy: 369e. のサブクラスのインス
     タンスです。

      -- メソッド: _callmethod (methodname[, args[, kwds]])

          プロキシの参照対象のメソッドの実行結果を返します。

          ‘proxy’ がプロキシで、プロキシ内の参照対象が ‘obj’ ならこの式

               proxy._callmethod(methodname, args, kwds)

          はこの式を評価します

               getattr(obj, methodname)(*args, **kwds)

          (マネージャープロセス内の)。

          返される値はその呼び出し結果のコピーか、新たな共有オブジェクト
          に対するプロキシになります。詳細は *note
          BaseManager.register(): 369d. の 'method_to_typeid' 引数のドキ
          ュメントを参照してください。

          その呼び出しによって例外が発生した場合、*note _callmethod():
          369f. によってその例外は再送出されます。他の例外がマネージャー
          プロセスで発生したなら、‘RemoteError’ 例外に変換されたものが
          *note _callmethod(): 369f. によって送出されます。

          特に 'methodname' が '公開' されていない場合は例外が発生するこ
          とに注意してください。

          *note _callmethod(): 369f. の使用例になります:

               >>> l = manager.list(range(10))
               >>> l._callmethod('__len__')
               10
               >>> l._callmethod('__getitem__', (slice(2, 7),)) # equivalent to l[2:7]
               [2, 3, 4, 5, 6]
               >>> l._callmethod('__getitem__', (20,))          # equivalent to l[20]
               Traceback (most recent call last):
               ...
               IndexError: list index out of range

      -- メソッド: _getvalue ()

          参照対象のコピーを返します。

          参照対象が unpickle 化できるなら例外を発生します。

      -- メソッド: __repr__ ()

          プロキシオブジェクトのオブジェクト表現を返します。

      -- メソッド: __str__ ()

          参照対象のオブジェクト表現を返します。

* Menu:

* クリーンアップ: クリーンアップ<2>.


File: python.info,  Node: クリーンアップ<2>,  Up: Proxy オブジェクト

5.18.2.21 クリーンアップ
........................

プロキシオブジェクトは弱参照(weakref)コールバックを使用します。プロキシ
オブジェクトがガベージコレクトされるときにその参照対象が所有するマネージ
ャーからその登録を取り消せるようにするためです。

共有オブジェクトはプロキシが参照しなくなったときにマネージャープロセスか
ら削除されます。


File: python.info,  Node: プロセスプール,  Next: リスナーとクライアント,  Prev: Proxy オブジェクト,  Up: リファレンス<3>

5.18.2.22 プロセスプール
........................

*note Pool: 116d. クラスでタスクを実行するプロセスのプールを作成すること
ができます。

 -- クラス: multiprocessing.pool.Pool ([processes[, initializer[,
          initargs[, maxtasksperchild[, context]]]]])

     プロセスプールオブジェクトは、ジョブを送り込めるワーカープロセスの
     プールを制御します。タイムアウトやコールバックのある非同期の実行を
     サポートし、並列 map 実装を持ちます。

     'processes' is the number of worker processes to use.  If
     'processes' is ‘None’ then the number returned by *note
     os.process_cpu_count(): 4da. is used.

     'initializer' が ‘None’ ではない場合、各ワーカープロセスは開始時に
     ‘initializer(*initargs)’ を呼び出します。

     'maxtasksperchild' は、ワーカープロセスが exit して新たなワーカープ
     ロセスと置き替えられるまでの間に、ワーカープロセスが完了することの
     できるタスクの数です。この設定により未利用のリソースが解放されるよ
     うなります。デフォルトの 'maxtasksperchild' は ‘None’ で、これはワ
     ーカープロセスがプールと同じ期間だけ生き続けるということを意味しま
     す。

     'context' can be used to specify the context used for starting the
     worker processes.  Usually a pool is created using the function
     ‘multiprocessing.Pool()’ or the *note Pool(): 116d. method of a
     context object.  In both cases 'context' is set appropriately.  If
     ‘None’, calling this function will have the side effect of setting
     the current global start method if it has not been set already.
     See the ‘get_context()’ function.

     プールオブジェクトのメソッドは、そのプールを作成したプロセスのみが
     呼び出すべきです。

          警告: *note multiprocessing.pool: 9c. objects have internal
          resources that need to be properly managed (like any other
          resource) by using the pool as a context manager or by calling
          *note close(): 36b1. and *note terminate(): 36b2. manually.
          Failure to do this can lead to the process hanging on
          finalization.

          Note that it is 'not correct' to rely on the garbage collector
          to destroy the pool as CPython does not assure that the
          finalizer of the pool will be called (see *note
          object.__del__(): 11ff. for more information).

     バージョン 3.2 で変更: Added the 'maxtasksperchild' parameter.

     バージョン 3.4 で変更: 'context' パラメータを追加しました。

     バージョン 3.13 で変更: 'processes' uses *note
     os.process_cpu_count(): 4da. by default, instead of *note
     os.cpu_count(): 4db.

          注釈: Worker processes within a *note Pool: 116d. typically
          live for the complete duration of the Pool's work queue.  A
          frequent pattern found in other systems (such as Apache,
          mod_wsgi, etc) to free resources held by workers is to allow a
          worker within a pool to complete only a set amount of work
          before exiting, being cleaned up and a new process spawned to
          replace the old one.  The 'maxtasksperchild' argument to the
          *note Pool: 116d. exposes this ability to the end user.

      -- メソッド: apply (func[, args[, kwds]])

          引数 'args' とキーワード引数 'kwds' を伴って 'func' を呼びます
          。結果が準備できるまでブロックします。このブロックがあるため、
          *note apply_async(): 15ae. の方が並行作業により適しています。
          加えて、 'func' は、プール内の1つのワーカーだけで実行されます
          。

      -- メソッド: apply_async (func[, args[, kwds[, callback[,
               error_callback]]]])

          *note apply(): 15ad. メソッドの派生版で *note AsyncResult:
          36b3. オブジェクトを返します。

          'callback' が指定された場合、それは単一の引数を受け取る呼び出
          し可能オブジェクトでなければなりません。結果を返せるようになっ
          たときに 'callback' が結果オブジェクトに対して適用されます。た
          だし呼び出しが失敗した場合は、代わりに 'error_callback' が適用
          されます。

          'error_callback' が指定された場合、それは単一の引数を受け取る
          呼び出し可能オブジェクトでなければなりません。対象の関数が失敗
          した場合、例外インスタンスを伴って 'error_callback' が呼ばれま
          す。

          コールバックは直ちに完了すべきです。なぜなら、そうしなければ、
          結果を扱うスレッドがブロックするからです。

      -- メソッド: map (func, iterable[, chunksize])

          *note map(): 19f. 組み込み関数の並列版です ('iterable' な引数
          を1つだけサポートするという違いはあります。もしも複数のイテラ
          ブルを使いたいのならば *note starmap(): 12fd. を参照)。結果が
          出るまでブロックします。

          このメソッドはイテラブルをいくつものチャンクに分割し、プロセス
          プールにそれぞれ独立したタスクとして送ります。(概算の) チャン
          クサイズは 'chunksize' を正の整数に設定することで指定できます
          。

          Note that it may cause high memory usage for very long
          iterables.  Consider using *note imap(): 36b4. or *note
          imap_unordered(): 36b5. with explicit 'chunksize' option for
          better efficiency.

      -- メソッド: map_async (func, iterable[, chunksize[, callback[,
               error_callback]]])

          *note map(): 12fb. メソッドの派生版で *note AsyncResult: 36b3.
          オブジェクトを返します。

          'callback' が指定された場合、それは単一の引数を受け取る呼び出
          し可能オブジェクトでなければなりません。結果を返せるようになっ
          たときに 'callback' が結果オブジェクトに対して適用されます。た
          だし呼び出しが失敗した場合は、代わりに 'error_callback' が適用
          されます。

          'error_callback' が指定された場合、それは単一の引数を受け取る
          呼び出し可能オブジェクトでなければなりません。対象の関数が失敗
          した場合、例外インスタンスを伴って 'error_callback' が呼ばれま
          す。

          コールバックは直ちに完了すべきです。なぜなら、そうしなければ、
          結果を扱うスレッドがブロックするからです。

      -- メソッド: imap (func, iterable[, chunksize])

          *note map(): 12fb. の遅延評価版です。

          'chunksize' 引数は *note map(): 12fb. メソッドで使用されるもの
          と同じです。 引数 iterable がとても長いなら 'chunksize' に大き
          な値を指定して使用する方がデフォルト値の ‘1’ を使用するよりも
          ジョブの完了が 'かなり' 速くなります。

          また 'chunksize' が ‘1’ の場合 *note imap(): 36b4. メソッドが
          返すイテレーターの ‘next()’ メソッドはオプションで 'timeout' パ
          ラメーターを持ちます。 ‘next(timeout)’ は、その結果が
          'timeout' 秒以内に返されないときに *note
          multiprocessing.TimeoutError: 3665. を発生させます。

      -- メソッド: imap_unordered (func, iterable[, chunksize])

          イテレーターが返す結果の順番が任意の順番で良いと見なされること
          を除けば *note imap(): 36b4. と同じです。 (ワーカープロセスが
          1つしかない場合のみ "正しい" 順番になることが保証されます。)

      -- メソッド: starmap (func, iterable[, chunksize])

          'iterable' の要素が、引数として unpack されるイテレート可能オ
          ブジェクトであると期待される以外は、 *note map(): 12fb. と似て
          います。

          そのため、'iterable' が ‘[(1,2), (3, 4)]’ なら、結果は
          ‘[func(1,2), func(3,4)]’ になります。

          Added in version 3.3.

      -- メソッド: starmap_async (func, iterable[, chunksize[,
               callback[, error_callback]]])

          *note starmap(): 12fd. と *note map_async(): 12fc. の組み合わ
          せです。 イテレート可能オブジェクトの 'iterable' をイテレート
          して、 unpack したイテレート可能オブジェクトを伴って 'func' を
          呼び出します。結果オブジェクトを返します。

          Added in version 3.3.

      -- メソッド: close ()

          これ以上プールでタスクが実行されないようにします。すべてのタス
          クが完了した後でワーカープロセスが終了します。

      -- メソッド: terminate ()

          実行中の処理を完了させずにワーカープロセスをすぐに停止します。
          プールオブジェクトがガベージコレクトされるときに *note
          terminate(): 36b2. が呼び出されます。

      -- メソッド: join ()

          ワーカープロセスが終了するのを待ちます。 *note join(): 36b6. を
          使用する前に *note close(): 36b1. か *note terminate(): 36b2.
          を呼び出さなければなりません。

     バージョン 3.3 で変更: Pool オブジェクトがコンテキストマネージメン
     ト・プロトコルをサポートするようになりました。 - *note
     コンテキストマネージャ型: 240d. を参照してください。 *note
     __enter__(): 26a8. は Pool オブジェクトを返します。また *note
     __exit__(): 26a9. は *note terminate(): 36b2. を呼び出します。

 -- クラス: multiprocessing.pool.AsyncResult

     *note Pool.apply_async(): 15ae. や *note Pool.map_async(): 12fc. で
     返される結果のクラスです。

      -- メソッド: get ([timeout])

          結果を受け取ったときに返します。 'timeout' が ‘None’ ではなく
          て、その結果が 'timeout' 秒以内に受け取れない場合 *note
          multiprocessing.TimeoutError: 3665. が発生します。リモートの呼
          び出しが例外を発生させる場合、その例外は *note get(): 36b7. が
          再発生させます。

      -- メソッド: wait ([timeout])

          その結果が有効になるか 'timeout' 秒経つまで待ちます。

      -- メソッド: ready ()

          その呼び出しが完了しているかどうかを返します。

      -- メソッド: successful ()

          その呼び出しが例外を発生させることなく完了したかどうかを返しま
          す。その結果が返せる状態でない場合 *note ValueError: 2ec. が発
          生します。

          バージョン 3.7 で変更: If the result is not ready, *note
          ValueError: 2ec. is raised instead of *note AssertionError:
          8b8.

次の例はプールの使用例を紹介します:

     from multiprocessing import Pool
     import time

     def f(x):
         return x*x

     if __name__ == '__main__':
         with Pool(processes=4) as pool:         # start 4 worker processes
             result = pool.apply_async(f, (10,)) # evaluate "f(10)" asynchronously in a single process
             print(result.get(timeout=1))        # prints "100" unless your computer is *very* slow

             print(pool.map(f, range(10)))       # prints "[0, 1, 4,..., 81]"

             it = pool.imap(f, range(10))
             print(next(it))                     # prints "0"
             print(next(it))                     # prints "1"
             print(it.next(timeout=1))           # prints "4" unless your computer is *very* slow

             result = pool.apply_async(time.sleep, (10,))
             print(result.get(timeout=1))        # raises multiprocessing.TimeoutError


File: python.info,  Node: リスナーとクライアント,  Next: 認証キー,  Prev: プロセスプール,  Up: リファレンス<3>

5.18.2.23 リスナーとクライアント
................................

通常、プロセス間でメッセージを渡すにはキューを使用するか *note Pipe():
364c. が返す *note Connection: 12f8. オブジェクトを使用します。

However, the ‘multiprocessing.connection’ module allows some extra
flexibility.  It basically gives a high level message oriented API for
dealing with sockets or Windows named pipes.  It also has support for
'digest authentication' using the *note hmac: 6e. module, and for
polling multiple connections at the same time.

 -- の関数: multiprocessing.connection.deliver_challenge (connection,
          authkey)

     ランダム生成したメッセージをコネクションの相手側へ送信して応答を待
     ちます。

     その応答がキーとして 'authkey' を使用するメッセージのダイジェストと
     一致する場合、 コネクションの相手側へ歓迎メッセージを送信します。 そ
     うでなければ *note AuthenticationError: 3664. を発生させます。

 -- の関数: multiprocessing.connection.answer_challenge (connection,
          authkey)

     メッセージを受信して、そのキーとして 'authkey' を使用するメッセージ
     のダイジェストを計算し、ダイジェストを送り返します。

     歓迎メッセージを受け取れない場合 *note AuthenticationError: 3664. が
     発生します。

 -- の関数: multiprocessing.connection.Client (address[, family[,
          authkey]])

     'address' で渡したアドレスを使用するリスナーに対してコネクションを
     確立しようとして *note Connection: 12f8. を返します。

     コネクション種別は 'family' 引数で決定しますが、一般的には
     'address' のフォーマットから推測できるので、これは指定されません。
     (*note アドレスフォーマット: 36bf. を参照してください)

     If 'authkey' is given and not ‘None’, it should be a byte string
     and will be used as the secret key for an HMAC-based authentication
     challenge.  No authentication is done if 'authkey' is ‘None’.
     *note AuthenticationError: 3664. is raised if authentication fails.
     See *note 認証キー: 3661.

 -- クラス: multiprocessing.connection.Listener ([address[, family[,
          backlog[, authkey]]]])

     コネクションを '待ち受ける' 束縛されたソケットか Windows の名前付き
     パイプのラッパーです。

     'address' はリスナーオブジェクトの束縛されたソケットか名前付きパイ
     プが使用するアドレスです。

          注釈: '0.0.0.0' のアドレスを使用する場合、Windows 上の終点へ接
          続することができません。終点へ接続したい場合は '127.0.0.1' を
          使用すべきです。

     'family' は使用するソケット(名前付きパイプ)の種別です。これは
     ‘'AF_INET'’ (TCP ソケット), ‘'AF_UNIX'’ (Unix ドメインソケット) ま
     たは ‘'AF_PIPE'’ (Windows 名前付きパイプ) という文字列のどれか1つに
     なります。これらのうち ‘'AF_INET'’ のみが利用可能であることが保証さ
     れています。 'family' が ‘None’ の場合 'address' のフォーマットから
     推測されたものが使用されます。 'address' も ‘None’ の場合はデフォル
     トが選択されます。詳細は *note アドレスフォーマット: 36bf. を参照し
     てください。 'family' が ‘'AF_UNIX'’ で 'address' が ‘None’ の場合
     *note tempfile.mkstemp(): 2cca. を使用して作成されたプライベートな
     一時ディレクトリにソケットが作成されます。

     リスナーオブジェクトがソケットを使用する場合、ソケットに束縛される
     ときに 'backlog' (デフォルトでは1つ) がソケットの *note listen():
     105e. メソッドに対して渡されます。

     If 'authkey' is given and not ‘None’, it should be a byte string
     and will be used as the secret key for an HMAC-based authentication
     challenge.  No authentication is done if 'authkey' is ‘None’.
     *note AuthenticationError: 3664. is raised if authentication fails.
     See *note 認証キー: 3661.

      -- メソッド: accept ()

          リスナーオブジェクトの名前付きパイプか束縛されたソケット上でコ
          ネクションを 受け付けて *note Connection: 12f8. オブジェクトを
          返します。 認証が失敗した場合 *note AuthenticationError: 3664.
          が発生します。

      -- メソッド: close ()

          リスナーオブジェクトの名前付きパイプか束縛されたソケットをクロ
          ーズします。これはリスナーがガベージコレクトされるときに自動的
          に呼ばれます。そうは言っても、明示的に close() を呼び出す方が
          望ましいです。

     リスナーオブジェクトは次の読み出し専用属性を持っています:

      -- の属性: address

          リスナーオブジェクトが使用中のアドレスです。

      -- の属性: last_accepted

          最後にコネクションを受け付けたアドレスです。有効なアドレスがな
          い場合は ‘None’ になります。

     バージョン 3.3 で変更: Listener オブジェクトがコンテキストマネージ
     メント・プロトコルをサポートするようになりました。 - *note
     コンテキストマネージャ型: 240d. を参照してください。 *note
     __enter__(): 26a8. はリスナーオブジェクトを返します。また *note
     __exit__(): 26a9. は *note close(): 36c0. を呼び出します。

 -- の関数: multiprocessing.connection.wait (object_list, timeout=None)

     'object_list' 中のオブジェクトが準備ができるまで待機します。準備が
     できた 'object_list' 中のオブジェクトのリストを返します。'timeout'
     が浮動小数点なら、最大でその秒数だけ呼び出しがブロックします。
     'timeout' が ‘None’ の場合、無制限の期間ブロックします。負のタイム
     アウトは0と等価です。

     For both POSIX and Windows, an object can appear in 'object_list'
     if it is

        * 読み取り可能な *note Connection: 12f8. オブジェクト;

        * 接続された読み取り可能な *note socket.socket: fa1. オブジェク
          ト; または

        * *note Process: 252. オブジェクトの *note sentinel: 12f9. 属性
          。

     読み取ることのできるデータがある場合、あるいは相手側の端が閉じられ
     ている場合、コネクションまたはソケットオブジェクトは準備ができてい
     ます。

     'POSIX': ‘wait(object_list, timeout)’ almost equivalent
     ‘select.select(object_list, [], [], timeout)’.  The difference is
     that, if *note select.select(): fa0. is interrupted by a signal, it
     can raise *note OSError: 2c0. with an error number of ‘EINTR’,
     whereas *note wait(): 12f7. will not.

     'Windows': An item in 'object_list' must either be an integer
     handle which is waitable (according to the definition used by the
     documentation of the Win32 function ‘WaitForMultipleObjects()’) or
     it can be an object with a *note fileno(): 17ad. method which
     returns a socket handle or pipe handle.  (Note that pipe handles
     and socket handles are 'not' waitable handles.)

     Added in version 3.3.

'例'

次のサーバーコードは認証キーとして ‘'secret password'’ を使用するリスナ
ーを作成します。このサーバーはコネクションを待ってクライアントへデータを
送信します:

     from multiprocessing.connection import Listener
     from array import array

     address = ('localhost', 6000)     # family is deduced to be 'AF_INET'

     with Listener(address, authkey=b'secret password') as listener:
         with listener.accept() as conn:
             print('connection accepted from', listener.last_accepted)

             conn.send([2.25, None, 'junk', float])

             conn.send_bytes(b'hello')

             conn.send_bytes(array('i', [42, 1729]))

次のコードはサーバーへ接続して、サーバーからデータを受信します:

     from multiprocessing.connection import Client
     from array import array

     address = ('localhost', 6000)

     with Client(address, authkey=b'secret password') as conn:
         print(conn.recv())                  # => [2.25, None, 'junk', float]

         print(conn.recv_bytes())            # => 'hello'

         arr = array('i', [0, 0, 0, 0, 0])
         print(conn.recv_bytes_into(arr))    # => 8
         print(arr)                          # => array('i', [42, 1729, 0, 0, 0])

次のコードは *note wait(): 12f7. を使って複数のプロセスからのメッセージ
を同時に待ちます:

     from multiprocessing import Process, Pipe, current_process
     from multiprocessing.connection import wait

     def foo(w):
         for i in range(10):
             w.send((i, current_process().name))
         w.close()

     if __name__ == '__main__':
         readers = []

         for i in range(4):
             r, w = Pipe(duplex=False)
             readers.append(r)
             p = Process(target=foo, args=(w,))
             p.start()
             # We close the writable end of the pipe now to be sure that
             # p is the only process which owns a handle for it.  This
             # ensures that when p closes its handle for the writable end,
             # wait() will promptly report the readable end as being ready.
             w.close()

         while readers:
             for r in wait(readers):
                 try:
                     msg = r.recv()
                 except EOFError:
                     readers.remove(r)
                 else:
                     print(msg)

* Menu:

* アドレスフォーマット::


File: python.info,  Node: アドレスフォーマット,  Up: リスナーとクライアント

5.18.2.24 アドレスフォーマット
..............................

   * ‘'AF_INET'’ アドレスは ‘(hostname, port)’ のタプルになります。
     'hostname' は文字列で 'port' は整数です。

   * ‘'AF_UNIX'’ アドレスはファイルシステム上のファイル名の文字列です。

   * ‘'AF_PIPE'’ アドレスは ‘r'\\.\pipe\PIPENAME'’ という形式の文字列で
     す。 'ServerName' という名前のリモートコンピューター上の名前付きパ
     イプに接続するために *note Client(): 36be. を使用するには、代わりに
     ‘r'\\SERVERNAME\pipe\PIPENAME'’ 形式のアドレスを使用する必要があり
     ます。

デフォルトでは、2つのバックスラッシュで始まる文字列は ‘'AF_UNIX'’ よりも
‘'AF_PIPE'’ として推測されることに注意してください。


File: python.info,  Node: 認証キー,  Next: ログ記録<2>,  Prev: リスナーとクライアント,  Up: リファレンス<3>

5.18.2.25 認証キー
..................

‘Connection.recv’ を使用するとき、データは自動的に unpickle されて受信し
ます。 信頼できない接続元からのデータを unpickle することはセキュリティ
リスクがあります。 そのため *note Listener: 1a23. や *note Client():
36be. はダイジェスト認証を提供するために *note hmac: 6e. モジュールを使
用します。

認証キーはパスワードとして見なされるバイト文字列です。コネクションが確立
すると、双方の終点で正しい接続先であることを証明するために 知っているお
互いの認証キーを要求します。(双方の終点が同じキーを使用して通信しようと
しても、コネクション上でそのキーを送信することは 'できません'。)

認証が要求されているにもかかわらず認証キーが指定されていない場合
‘current_process().authkey’ の返す値が使用されます。 (詳細は *note
Process: 252. を参照してください。) この値はカレントプロセスを作成する
*note Process: 252. オブジェクトによって自動的に継承されます。 これは(デ
フォルトでは)複数プロセスのプログラムの全プロセスが相互にコネクションを
確立するときに使用される1つの認証キーを共有することを意味します。

適当な認証キーを *note os.urandom(): 746. を使用して生成することもできま
す。


File: python.info,  Node: ログ記録<2>,  Next: The multiprocessing dummy module,  Prev: 認証キー,  Up: リファレンス<3>

5.18.2.26 ログ記録
..................

ロギングのためにいくつかの機能が利用可能です。しかし *note logging: 8b.
パッケージは、 (ハンドラー種別に依存して)違うプロセスからのメッセージが
ごちゃ混ぜになるので、プロセスの共有ロックを使用しないことに注意してくだ
さい。

 -- の関数: multiprocessing.get_logger ()

     Returns the logger used by ‘multiprocessing’.  If necessary, a new
     one will be created.

     When first created the logger has level *note logging.NOTSET: 315a.
     and no default handler.  Messages sent to this logger will not by
     default propagate to the root logger.

     Windows 上では子プロセスが親プロセスのロガーレベルを継承しないこと
     に注意してください。さらにその他のロガーのカスタマイズ内容もすべて
     継承されません。

 -- の関数: multiprocessing.log_to_stderr (level=None)

     この関数は *note get_logger(): 321f. に対する呼び出しを実行しますが
     、 get_logger によって作成されるロガーを返すことに加えて、
     ‘'[%(levelname)s/%(processName)s] %(message)s'’ のフォーマットを使
     用して *note sys.stderr: b33. へ出力を送るハンドラーを追加します。
     ‘level’ 引数を渡すことによってロガーの ‘levelname’ を変更できます。

以下にロギングを有効にした例を紹介します:

     >>> import multiprocessing, logging
     >>> logger = multiprocessing.log_to_stderr()
     >>> logger.setLevel(logging.INFO)
     >>> logger.warning('doomed')
     [WARNING/MainProcess] doomed
     >>> m = multiprocessing.Manager()
     [INFO/SyncManager-...] child process calling self.run()
     [INFO/SyncManager-...] created temp directory /.../pymp-...
     [INFO/SyncManager-...] manager serving at '/.../listener-...'
     >>> del m
     [INFO/MainProcess] sending shutdown message to manager
     [INFO/SyncManager-...] manager exiting with exitcode 0

完全なロギングレベルの表については *note logging: 8b. モジュールを参照し
てください。


File: python.info,  Node: The multiprocessing dummy module,  Prev: ログ記録<2>,  Up: リファレンス<3>

5.18.2.27 The ‘multiprocessing.dummy’ module
............................................

‘multiprocessing.dummy’ replicates the API of ‘multiprocessing’ but is
no more than a wrapper around the *note threading: f3. module.

In particular, the ‘Pool’ function provided by ‘multiprocessing.dummy’
returns an instance of *note ThreadPool: 1cd4, which is a subclass of
*note Pool: 116d. that supports all the same method calls but uses a
pool of worker threads rather than worker processes.

 -- クラス: multiprocessing.pool.ThreadPool ([processes[, initializer[,
          initargs]]])

     A thread pool object which controls a pool of worker threads to
     which jobs can be submitted.  *note ThreadPool: 1cd4. instances are
     fully interface compatible with *note Pool: 116d. instances, and
     their resources must also be properly managed, either by using the
     pool as a context manager or by calling *note close(): 36b1. and
     *note terminate(): 36b2. manually.

     'processes' is the number of worker threads to use.  If 'processes'
     is ‘None’ then the number returned by *note os.process_cpu_count():
     4da. is used.

     'initializer' が ‘None’ ではない場合、各ワーカープロセスは開始時に
     ‘initializer(*initargs)’ を呼び出します。

     Unlike *note Pool: 116d, 'maxtasksperchild' and 'context' cannot be
     provided.

          注釈: A *note ThreadPool: 1cd4. shares the same interface as
          *note Pool: 116d, which is designed around a pool of processes
          and predates the introduction of the *note concurrent.futures:
          24. module.  As such, it inherits some operations that don't
          make sense for a pool backed by threads, and it has its own
          type for representing the status of asynchronous jobs, *note
          AsyncResult: 36b3, that is not understood by any other
          libraries.

          Users should generally prefer to use *note
          concurrent.futures.ThreadPoolExecutor: 949, which has a
          simpler interface that was designed around threads from the
          start, and which returns *note concurrent.futures.Future:
          13ca. instances that are compatible with many other libraries,
          including *note asyncio: b.


File: python.info,  Node: プログラミングガイドライン,  Next: 使用例<21>,  Prev: リファレンス<3>,  Up: multiprocessing --- プロセスベースの並列処理

5.18.2.28 プログラミングガイドライン
....................................

There are certain guidelines and idioms which should be adhered to when
using ‘multiprocessing’.

* Menu:

* すべての開始方式について::
* 開始方式が spawn および forkserver の場合::


File: python.info,  Node: すべての開始方式について,  Next: 開始方式が spawn および forkserver の場合,  Up: プログラミングガイドライン

5.18.2.29 すべての開始方式について
..................................

以下はすべての開始方式に当てはまります。

共有状態を避ける

     できるだけプロセス間で巨大なデータを移動することは避けるようにすべ
     きです。

     プロセス間の通信には、*note threading: f3. モジュールの低レベルな同
     期プリミティブを使うのではなく、キューやパイプを使うのが良いでしょ
     う。

pickle 化の可能性

     プロキシのメソッドへの引数は、 pickle 化できるものにしてください。

プロキシのスレッドセーフ性

     1 つのプロキシオブジェクトは、ロックで保護しないかぎり、2 つ以上の
     スレッドから使用してはいけません。

     (異なるプロセスで '同じ' プロキシを使用することは問題ではありません
     。)

ゾンビプロセスを join する

     On POSIX when a process finishes but has not been joined it becomes
     a zombie.  There should never be very many because each time a new
     process starts (or *note active_children(): 3679. is called) all
     completed processes which have not yet been joined will be joined.
     Also calling a finished process's *note Process.is_alive: 15aa.
     will join the process.  Even so it is probably good practice to
     explicitly join all the processes that you start.

pickle/unpickle より継承する方が良い

     When using the 'spawn' or 'forkserver' start methods many types
     from ‘multiprocessing’ need to be picklable so that child processes
     can use them.  However, one should generally avoid sending shared
     objects to other processes using pipes or queues.  Instead you
     should arrange the program so that a process which needs access to
     a shared resource created elsewhere can inherit it from an ancestor
     process.

プロセスの強制終了を避ける

     あるプロセスを停止するために *note Process.terminate: 1857. メソッ
     ドを使用すると、そのプロセスが現在使用されている (ロック、セマフォ
     、パイプやキューのような) 共有リソースを破壊したり他のプロセスから
     利用できない状態を引き起こし易いです。

     そのため、共有リソースを使用しないプロセスでのみ *note
     Process.terminate: 1857. を使用することを考慮することがおそらく最善
     の方法です。

キューを使用するプロセスを join する

     キューに要素を追加するプロセスは、すべてのバッファーされた要素が
     "feeder" スレッドによって下位層のパイプに対してフィードされるまで終
     了を待つということを覚えておいてください。 (子プロセスはこの動作を
     避けるためにキューの *note Queue.cancel_join_thread: 366f. メソッド
     を呼ぶことができます。)

     これはキューを使用するときに、キューに追加されたすべての要素が最終
     的にそのプロセスが join される前に削除されていることを確認する必要
     があることを意味します。そうしないと、そのキューに要素が追加したプ
     ロセスの終了を保証できません。デーモンではないプロセスは自動的に
     join されることも覚えておいてください。

     次の例はデッドロックを引き起こします:

          from multiprocessing import Process, Queue

          def f(q):
              q.put('X' * 1000000)

          if __name__ == '__main__':
              queue = Queue()
              p = Process(target=f, args=(queue,))
              p.start()
              p.join()                    # this deadlocks
              obj = queue.get()

     修正するには最後の2行を入れ替えます(または単純に ‘p.join()’ の行を
     削除します)。

明示的に子プロセスへリソースを渡す

     On POSIX using the 'fork' start method, a child process can make
     use of a shared resource created in a parent process using a global
     resource.  However, it is better to pass the object as an argument
     to the constructor for the child process.

     Windows や他の開始方式と (将来的にでも) 互換性のあるコードを書く場
     合は別として、これは子プロセスが実行中である限りは親プロセス内でオ
     ブジェクトがガベージコレクトされないことも保証します。これは親プロ
     セス内でオブジェクトがガベージコレクトされたときに一部のリソースが
     開放されてしまう場合に重要かもしれません。

     そのため、例えば

          from multiprocessing import Process, Lock

          def f():
              ... do something using "lock" ...

          if __name__ == '__main__':
              lock = Lock()
              for i in range(10):
                  Process(target=f).start()

     は、次のように書き直すべきです

          from multiprocessing import Process, Lock

          def f(l):
              ... do something using "l" ...

          if __name__ == '__main__':
              lock = Lock()
              for i in range(10):
                  Process(target=f, args=(lock,)).start()

*note sys.stdin: 75f. を file-like オブジェクトに置き換えることに注意す
る

     ‘multiprocessing’ originally unconditionally called:

          os.close(sys.stdin.fileno())

     を ‘multiprocessing.Process._bootstrap()’ メソッドの中で呼び出して
     いました -- これはプロセス内プロセス (processes-in-processes) で問
     題が起こしてしまいます。そこで、これは以下のように変更されました:

          sys.stdin.close()
          sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)

     Which solves the fundamental issue of processes colliding with each
     other resulting in a bad file descriptor error, but introduces a
     potential danger to applications which replace *note sys.stdin():
     75f. with a "file-like object" with output buffering.  This danger
     is that if multiple processes call *note close(): 506. on this
     file-like object, it could result in the same data being flushed to
     the object multiple times, resulting in corruption.

     もし file-like オブジェクトを書いて独自のキャッシュを実装するなら、
     キャッシュするときに常に pid を記録しておき、pid が変わったらキュッ
     シュを捨てることで、フォークセーフにできます。例:

          @property
          def cache(self):
              pid = os.getpid()
              if pid != self._pid:
                  self._pid = pid
                  self._cache = []
              return self._cache

     より詳しい情報は bpo-5155(1) 、 bpo-5313(2) 、 bpo-5331(3) を見てく
     ださい

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=5155

   (2) https://bugs.python.org/issue?@action=redirect&bpo=5313

   (3) https://bugs.python.org/issue?@action=redirect&bpo=5331


File: python.info,  Node: 開始方式が spawn および forkserver の場合,  Prev: すべての開始方式について,  Up: プログラミングガイドライン

5.18.2.30 開始方式が 'spawn' および 'forkserver' の場合
.......................................................

There are a few extra restrictions which don't apply to the 'fork' start
method.

さらなる pickle 化の可能性

     Ensure that all arguments to *note Process: 252. are picklable.
     Also, if you subclass ‘Process.__init__’, you must make sure that
     instances will be picklable when the *note Process.start: 15a9.
     method is called.

グローバル変数

     子プロセスで実行されるコードがグローバル変数にアクセスしようとする
     場合、子プロセスが見るその値は *note Process.start: 15a9. が呼ばれ
     たときの親プロセスの値と同じではない可能性があります。

     しかし、単にモジュールレベルの定数であるグローバル変数なら問題には
     なりません。
メインモジュールの安全なインポート

     Make sure that the main module can be safely imported by a new
     Python interpreter without causing unintended side effects (such as
     starting a new process).

     例えば、開始方式に 'spawn' あるいは 'forkserver' を使用した場合に以
     下のモジュールを実行すると *note RuntimeError: 244. で失敗します:

          from multiprocessing import Process

          def foo():
              print('hello')

          p = Process(target=foo)
          p.start()

     代わりに、次のように ‘if __name__ == '__main__':’ を使用してプログ
     ラムの "エントリポイント" を保護すべきです:

          from multiprocessing import Process, freeze_support, set_start_method

          def foo():
              print('hello')

          if __name__ == '__main__':
              freeze_support()
              set_start_method('spawn')
              p = Process(target=foo)
              p.start()

     (プログラムをフリーズせずに通常通り実行するなら ‘freeze_support()’
     行は取り除けます。)

     これは新たに生成された Python インタープリターがそのモジュールを安
     全にインポートして、モジュールの ‘foo()’ 関数を実行します。

     プールまたはマネージャーがメインモジュールで作成される場合に似たよ
     うな制限が適用されます。


File: python.info,  Node: 使用例<21>,  Prev: プログラミングガイドライン,  Up: multiprocessing --- プロセスベースの並列処理

5.18.2.31 使用例
................

カスタマイズされたマネージャーやプロキシの作成方法と使用方法を紹介します
:

     from multiprocessing import freeze_support
     from multiprocessing.managers import BaseManager, BaseProxy
     import operator

     ##

     class Foo:
         def f(self):
             print('you called Foo.f()')
         def g(self):
             print('you called Foo.g()')
         def _h(self):
             print('you called Foo._h()')

     # A simple generator function
     def baz():
         for i in range(10):
             yield i*i

     # Proxy type for generator objects
     class GeneratorProxy(BaseProxy):
         _exposed_ = ['__next__']
         def __iter__(self):
             return self
         def __next__(self):
             return self._callmethod('__next__')

     # Function to return the operator module
     def get_operator_module():
         return operator

     ##

     class MyManager(BaseManager):
         pass

     # register the Foo class; make `f()` and `g()` accessible via proxy
     MyManager.register('Foo1', Foo)

     # register the Foo class; make `g()` and `_h()` accessible via proxy
     MyManager.register('Foo2', Foo, exposed=('g', '_h'))

     # register the generator function baz; use `GeneratorProxy` to make proxies
     MyManager.register('baz', baz, proxytype=GeneratorProxy)

     # register get_operator_module(); make public functions accessible via proxy
     MyManager.register('operator', get_operator_module)

     ##

     def test():
         manager = MyManager()
         manager.start()

         print('-' * 20)

         f1 = manager.Foo1()
         f1.f()
         f1.g()
         assert not hasattr(f1, '_h')
         assert sorted(f1._exposed_) == sorted(['f', 'g'])

         print('-' * 20)

         f2 = manager.Foo2()
         f2.g()
         f2._h()
         assert not hasattr(f2, 'f')
         assert sorted(f2._exposed_) == sorted(['g', '_h'])

         print('-' * 20)

         it = manager.baz()
         for i in it:
             print('<%d>' % i, end=' ')
         print()

         print('-' * 20)

         op = manager.operator()
         print('op.add(23, 45) =', op.add(23, 45))
         print('op.pow(2, 94) =', op.pow(2, 94))
         print('op._exposed_ =', op._exposed_)

     ##

     if __name__ == '__main__':
         freeze_support()
         test()

*note Pool: 116d. を使用する例です:

     import multiprocessing
     import time
     import random
     import sys

     #
     # Functions used by test code
     #

     def calculate(func, args):
         result = func(*args)
         return '%s says that %s%s = %s' % (
             multiprocessing.current_process().name,
             func.__name__, args, result
             )

     def calculatestar(args):
         return calculate(*args)

     def mul(a, b):
         time.sleep(0.5 * random.random())
         return a * b

     def plus(a, b):
         time.sleep(0.5 * random.random())
         return a + b

     def f(x):
         return 1.0 / (x - 5.0)

     def pow3(x):
         return x ** 3

     def noop(x):
         pass

     #
     # Test code
     #

     def test():
         PROCESSES = 4
         print('Creating pool with %d processes\n' % PROCESSES)

         with multiprocessing.Pool(PROCESSES) as pool:
             #
             # Tests
             #

             TASKS = [(mul, (i, 7)) for i in range(10)] + \
                     [(plus, (i, 8)) for i in range(10)]

             results = [pool.apply_async(calculate, t) for t in TASKS]
             imap_it = pool.imap(calculatestar, TASKS)
             imap_unordered_it = pool.imap_unordered(calculatestar, TASKS)

             print('Ordered results using pool.apply_async():')
             for r in results:
                 print('\t', r.get())
             print()

             print('Ordered results using pool.imap():')
             for x in imap_it:
                 print('\t', x)
             print()

             print('Unordered results using pool.imap_unordered():')
             for x in imap_unordered_it:
                 print('\t', x)
             print()

             print('Ordered results using pool.map() --- will block till complete:')
             for x in pool.map(calculatestar, TASKS):
                 print('\t', x)
             print()

             #
             # Test error handling
             #

             print('Testing error handling:')

             try:
                 print(pool.apply(f, (5,)))
             except ZeroDivisionError:
                 print('\tGot ZeroDivisionError as expected from pool.apply()')
             else:
                 raise AssertionError('expected ZeroDivisionError')

             try:
                 print(pool.map(f, list(range(10))))
             except ZeroDivisionError:
                 print('\tGot ZeroDivisionError as expected from pool.map()')
             else:
                 raise AssertionError('expected ZeroDivisionError')

             try:
                 print(list(pool.imap(f, list(range(10)))))
             except ZeroDivisionError:
                 print('\tGot ZeroDivisionError as expected from list(pool.imap())')
             else:
                 raise AssertionError('expected ZeroDivisionError')

             it = pool.imap(f, list(range(10)))
             for i in range(10):
                 try:
                     x = next(it)
                 except ZeroDivisionError:
                     if i == 5:
                         pass
                 except StopIteration:
                     break
                 else:
                     if i == 5:
                         raise AssertionError('expected ZeroDivisionError')

             assert i == 9
             print('\tGot ZeroDivisionError as expected from IMapIterator.next()')
             print()

             #
             # Testing timeouts
             #

             print('Testing ApplyResult.get() with timeout:', end=' ')
             res = pool.apply_async(calculate, TASKS[0])
             while 1:
                 sys.stdout.flush()
                 try:
                     sys.stdout.write('\n\t%s' % res.get(0.02))
                     break
                 except multiprocessing.TimeoutError:
                     sys.stdout.write('.')
             print()
             print()

             print('Testing IMapIterator.next() with timeout:', end=' ')
             it = pool.imap(calculatestar, TASKS)
             while 1:
                 sys.stdout.flush()
                 try:
                     sys.stdout.write('\n\t%s' % it.next(0.02))
                 except StopIteration:
                     break
                 except multiprocessing.TimeoutError:
                     sys.stdout.write('.')
             print()
             print()


     if __name__ == '__main__':
         multiprocessing.freeze_support()
         test()

ワーカープロセスのコレクションに対してタスクをフィードしてその結果をまと
めるキューの使い方の例を紹介します:

     import time
     import random

     from multiprocessing import Process, Queue, current_process, freeze_support

     #
     # Function run by worker processes
     #

     def worker(input, output):
         for func, args in iter(input.get, 'STOP'):
             result = calculate(func, args)
             output.put(result)

     #
     # Function used to calculate result
     #

     def calculate(func, args):
         result = func(*args)
         return '%s says that %s%s = %s' % \
             (current_process().name, func.__name__, args, result)

     #
     # Functions referenced by tasks
     #

     def mul(a, b):
         time.sleep(0.5*random.random())
         return a * b

     def plus(a, b):
         time.sleep(0.5*random.random())
         return a + b

     #
     #
     #

     def test():
         NUMBER_OF_PROCESSES = 4
         TASKS1 = [(mul, (i, 7)) for i in range(20)]
         TASKS2 = [(plus, (i, 8)) for i in range(10)]

         # Create queues
         task_queue = Queue()
         done_queue = Queue()

         # Submit tasks
         for task in TASKS1:
             task_queue.put(task)

         # Start worker processes
         for i in range(NUMBER_OF_PROCESSES):
             Process(target=worker, args=(task_queue, done_queue)).start()

         # Get and print results
         print('Unordered results:')
         for i in range(len(TASKS1)):
             print('\t', done_queue.get())

         # Add more tasks using `put()`
         for task in TASKS2:
             task_queue.put(task)

         # Get and print some more results
         for i in range(len(TASKS2)):
             print('\t', done_queue.get())

         # Tell child processes to stop
         for i in range(NUMBER_OF_PROCESSES):
             task_queue.put('STOP')


     if __name__ == '__main__':
         freeze_support()
         test()


File: python.info,  Node: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ,  Next: concurrent パッケージ,  Prev: multiprocessing --- プロセスベースの並列処理,  Up: 並行実行

5.18.3 ‘multiprocessing.shared_memory’ -- プロセス間で直接アクセス可能な共有メモリ
----------------------------------------------------------------------------------

'ソースコード' Lib/multiprocessing/shared_memory.py(1)

Added in version 3.8.

__________________________________________________________________

このモジュールは、マルチコアもしくは対称型マルチプロセッサ(SMP) を持つマ
シン上で実行される、ひとつ以上のプロセスから参照される共有メモリの確保、
管理を行うための *note SharedMemory: 19d8. クラスを提供します。共有メモ
リのライフサイクル管理、とりわけ複数のプロセスにわたる場合のために、
*note multiprocessing.managers: 9b. モジュールでは *note BaseManager:
3697. のサブクラス *note SharedMemoryManager: 36d0. も提供されます。

In this module, shared memory refers to "POSIX style" shared memory
blocks (though is not necessarily implemented explicitly as such) and
does not refer to "distributed shared memory".  This style of shared
memory permits distinct processes to potentially read and write to a
common (or shared) region of volatile memory.  Processes are
conventionally limited to only have access to their own process memory
space but shared memory permits the sharing of data between processes,
avoiding the need to instead send messages between processes containing
that data.  Sharing data directly via memory can provide significant
performance benefits compared to sharing data via disk or socket or
other communications requiring the serialization/deserialization and
copying of data.

 -- クラス: multiprocessing.shared_memory.SharedMemory (name=None,
          create=False, size=0, *, track=True)

     Create an instance of the ‘SharedMemory’ class for either creating
     a new shared memory block or attaching to an existing shared memory
     block.  Each shared memory block is assigned a unique name.  In
     this way, one process can create a shared memory block with a
     particular name and a different process can attach to that same
     shared memory block using that same name.

     As a resource for sharing data across processes, shared memory
     blocks may outlive the original process that created them.  When
     one process no longer needs access to a shared memory block that
     might still be needed by other processes, the *note close(): 36d1.
     method should be called.  When a shared memory block is no longer
     needed by any process, the *note unlink(): 36d2. method should be
     called to ensure proper cleanup.


     パラメータ:

        * ‘name’ (*note str: 169.‘ | ’‘None’) - The unique name for the
          requested shared memory, specified as a string.  When creating
          a new shared memory block, if ‘None’ (the default) is supplied
          for the name, a novel name will be generated.

        * ‘create’ (*note bool: 3c3.) - Control whether a new shared
          memory block is created (‘True’) or an existing shared memory
          block is attached (‘False’).

        * ‘size’ (*note int: 19b.) - The requested number of bytes when
          creating a new shared memory block.  Because some platforms
          choose to allocate chunks of memory based upon that platform's
          memory page size, the exact size of the shared memory block
          may be larger or equal to the size requested.  When attaching
          to an existing shared memory block, the 'size' parameter is
          ignored.

        * ‘track’ (*note bool: 3c3.) - When ‘True’, register the shared
          memory block with a resource tracker process on platforms
          where the OS does not do this automatically.  The resource
          tracker ensures proper cleanup of the shared memory even if
          all other processes with access to the memory exit without
          doing so.  Python processes created from a common ancestor
          using *note multiprocessing: 98. facilities share a single
          resource tracker process, and the lifetime of shared memory
          segments is handled automatically among these processes.
          Python processes created in any other way will receive their
          own resource tracker when accessing shared memory with 'track'
          enabled.  This will cause the shared memory to be deleted by
          the resource tracker of the first process that terminates.  To
          avoid this issue, users of *note subprocess: dc. or standalone
          Python processes should set 'track' to ‘False’ when there is
          already another process in place that does the bookkeeping.
          'track' is ignored on Windows, which has its own tracking and
          automatically deletes shared memory when all handles to it
          have been closed.

     バージョン 3.13 で変更: Added the 'track' parameter.

      -- メソッド: close ()

          Close the file descriptor/handle to the shared memory from
          this instance.  *note close(): 36d1. should be called once
          access to the shared memory block from this instance is no
          longer needed.  Depending on operating system, the underlying
          memory may or may not be freed even if all handles to it have
          been closed.  To ensure proper cleanup, use the *note
          unlink(): 36d2. method.

      -- メソッド: unlink ()

          Delete the underlying shared memory block.  This should be
          called only once per shared memory block regardless of the
          number of handles to it, even in other processes.  *note
          unlink(): 36d2. and *note close(): 36d1. can be called in any
          order, but trying to access data inside a shared memory block
          after *note unlink(): 36d2. may result in memory access
          errors, depending on platform.

          This method has no effect on Windows, where the only way to
          delete a shared memory block is to close all handles.

      -- の属性: buf

          A memoryview of contents of the shared memory block.

      -- の属性: name

          Read-only access to the unique name of the shared memory
          block.

      -- の属性: size

          Read-only access to size in bytes of the shared memory block.

The following example demonstrates low-level use of *note SharedMemory:
19d8. instances:

     >>> from multiprocessing import shared_memory
     >>> shm_a = shared_memory.SharedMemory(create=True, size=10)
     >>> type(shm_a.buf)
     <class 'memoryview'>
     >>> buffer = shm_a.buf
     >>> len(buffer)
     10
     >>> buffer[:4] = bytearray([22, 33, 44, 55])  # Modify multiple at once
     >>> buffer[4] = 100                           # Modify single byte at a time
     >>> # Attach to an existing shared memory block
     >>> shm_b = shared_memory.SharedMemory(shm_a.name)
     >>> import array
     >>> array.array('b', shm_b.buf[:5])  # Copy the data into a new array.array
     array('b', [22, 33, 44, 55, 100])
     >>> shm_b.buf[:5] = b'howdy'  # Modify via shm_b using bytes
     >>> bytes(shm_a.buf[:5])      # Access via shm_a
     b'howdy'
     >>> shm_b.close()   # Close each SharedMemory instance
     >>> shm_a.close()
     >>> shm_a.unlink()  # Call unlink only once to release the shared memory

The following example demonstrates a practical use of the *note
SharedMemory: 19d8. class with NumPy arrays(2), accessing the same
‘numpy.ndarray’ from two distinct Python shells:

     >>> # In the first Python interactive shell
     >>> import numpy as np
     >>> a = np.array([1, 1, 2, 3, 5, 8])  # Start with an existing NumPy array
     >>> from multiprocessing import shared_memory
     >>> shm = shared_memory.SharedMemory(create=True, size=a.nbytes)
     >>> # Now create a NumPy array backed by shared memory
     >>> b = np.ndarray(a.shape, dtype=a.dtype, buffer=shm.buf)
     >>> b[:] = a[:]  # Copy the original data into shared memory
     >>> b
     array([1, 1, 2, 3, 5, 8])
     >>> type(b)
     <class 'numpy.ndarray'>
     >>> type(a)
     <class 'numpy.ndarray'>
     >>> shm.name  # We did not specify a name so one was chosen for us
     'psm_21467_46075'

     >>> # In either the same shell or a new Python shell on the same machine
     >>> import numpy as np
     >>> from multiprocessing import shared_memory
     >>> # Attach to the existing shared memory block
     >>> existing_shm = shared_memory.SharedMemory(name='psm_21467_46075')
     >>> # Note that a.shape is (6,) and a.dtype is np.int64 in this example
     >>> c = np.ndarray((6,), dtype=np.int64, buffer=existing_shm.buf)
     >>> c
     array([1, 1, 2, 3, 5, 8])
     >>> c[-1] = 888
     >>> c
     array([  1,   1,   2,   3,   5, 888])

     >>> # Back in the first Python interactive shell, b reflects this change
     >>> b
     array([  1,   1,   2,   3,   5, 888])

     >>> # Clean up from within the second Python shell
     >>> del c  # Unnecessary; merely emphasizing the array is no longer used
     >>> existing_shm.close()

     >>> # Clean up from within the first Python shell
     >>> del b  # Unnecessary; merely emphasizing the array is no longer used
     >>> shm.close()
     >>> shm.unlink()  # Free and release the shared memory block at the very end

 -- クラス: multiprocessing.managers.SharedMemoryManager ([address[,
          authkey]])

     A subclass of *note multiprocessing.managers.BaseManager: 3697.
     which can be used for the management of shared memory blocks across
     processes.

     A call to *note start(): 3698. on a ‘SharedMemoryManager’ instance
     causes a new process to be started.  This new process's sole
     purpose is to manage the life cycle of all shared memory blocks
     created through it.  To trigger the release of all shared memory
     blocks managed by that process, call *note shutdown(): 3699. on the
     instance.  This triggers a *note unlink(): 36d2. call on all of the
     *note SharedMemory: 36d6. objects managed by that process and then
     stops the process itself.  By creating ‘SharedMemory’ instances
     through a ‘SharedMemoryManager’, we avoid the need to manually
     track and trigger the freeing of shared memory resources.

     This class provides methods for creating and returning *note
     SharedMemory: 36d6. instances and for creating a list-like object
     (*note ShareableList: 36d7.) backed by shared memory.

     Refer to *note BaseManager: 3697. for a description of the
     inherited 'address' and 'authkey' optional input arguments and how
     they may be used to connect to an existing ‘SharedMemoryManager’
     service from other processes.

      -- メソッド: SharedMemory (size)

          Create and return a new *note SharedMemory: 36d6. object with
          the specified 'size' in bytes.

      -- メソッド: ShareableList (sequence)

          Create and return a new *note ShareableList: 36d7. object,
          initialized by the values from the input 'sequence'.

The following example demonstrates the basic mechanisms of a *note
SharedMemoryManager: 36d0.:

     >>> from multiprocessing.managers import SharedMemoryManager
     >>> smm = SharedMemoryManager()
     >>> smm.start()  # Start the process that manages the shared memory blocks
     >>> sl = smm.ShareableList(range(4))
     >>> sl
     ShareableList([0, 1, 2, 3], name='psm_6572_7512')
     >>> raw_shm = smm.SharedMemory(size=128)
     >>> another_sl = smm.ShareableList('alpha')
     >>> another_sl
     ShareableList(['a', 'l', 'p', 'h', 'a'], name='psm_6572_12221')
     >>> smm.shutdown()  # Calls unlink() on sl, raw_shm, and another_sl

The following example depicts a potentially more convenient pattern for
using *note SharedMemoryManager: 36d0. objects via the *note with: 186.
statement to ensure that all shared memory blocks are released after
they are no longer needed:

     >>> with SharedMemoryManager() as smm:
     ...     sl = smm.ShareableList(range(2000))
     ...     # Divide the work among two processes, storing partial results in sl
     ...     p1 = Process(target=do_work, args=(sl, 0, 1000))
     ...     p2 = Process(target=do_work, args=(sl, 1000, 2000))
     ...     p1.start()
     ...     p2.start()  # A multiprocessing.Pool might be more efficient
     ...     p1.join()
     ...     p2.join()   # Wait for all work to complete in both processes
     ...     total_result = sum(sl)  # Consolidate the partial results now in sl

When using a *note SharedMemoryManager: 36d0. in a *note with: 186.
statement, the shared memory blocks created using that manager are all
released when the ‘with’ statement's code block finishes execution.

 -- クラス: multiprocessing.shared_memory.ShareableList (sequence=None,
          *, name=None)

     Provide a mutable list-like object where all values stored within
     are stored in a shared memory block.  This constrains storable
     values to the following built-in data types:

        * *note int: 19b. (signed 64-bit)

        * *note float: 196.

        * *note bool: 3c3.

        * *note str: 169. (less than 10M bytes each when encoded as
          UTF-8)

        * *note bytes: 192. (less than 10M bytes each)

        * ‘None’

     It also notably differs from the built-in *note list: 24d. type in
     that these lists can not change their overall length (i.e.  no
     ‘append()’, ‘insert()’, etc.)  and do not support the dynamic
     creation of new ‘ShareableList’ instances via slicing.

     'sequence' is used in populating a new ‘ShareableList’ full of
     values.  Set to ‘None’ to instead attach to an already existing
     ‘ShareableList’ by its unique shared memory name.

     'name' is the unique name for the requested shared memory, as
     described in the definition for *note SharedMemory: 19d8.  When
     attaching to an existing ‘ShareableList’, specify its shared memory
     block's unique name while leaving 'sequence' set to ‘None’.

          注釈: A known issue exists for *note bytes: 192. and *note
          str: 169. values.  If they end with ‘\x00’ nul bytes or
          characters, those may be 'silently stripped' when fetching
          them by index from the ‘ShareableList’.  This
          ‘.rstrip(b'\x00')’ behavior is considered a bug and may go
          away in the future.  See gh-106939(3).

     For applications where rstripping of trailing nulls is a problem,
     work around it by always unconditionally appending an extra non-0
     byte to the end of such values when storing and unconditionally
     removing it when fetching:

          >>> from multiprocessing import shared_memory
          >>> nul_bug_demo = shared_memory.ShareableList(['?\x00', b'\x03\x02\x01\x00\x00\x00'])
          >>> nul_bug_demo[0]
          '?'
          >>> nul_bug_demo[1]
          b'\x03\x02\x01'
          >>> nul_bug_demo.shm.unlink()
          >>> padded = shared_memory.ShareableList(['?\x00\x07', b'\x03\x02\x01\x00\x00\x00\x07'])
          >>> padded[0][:-1]
          '?\x00'
          >>> padded[1][:-1]
          b'\x03\x02\x01\x00\x00\x00'
          >>> padded.shm.unlink()

      -- メソッド: count (value)

          Return the number of occurrences of 'value'.

      -- メソッド: index (value)

          Return first index position of 'value'.  Raise *note
          ValueError: 2ec. if 'value' is not present.

      -- の属性: format

          Read-only attribute containing the *note struct: db. packing
          format used by all currently stored values.

      -- の属性: shm

          The *note SharedMemory: 19d8. instance where the values are
          stored.

以下に *note ShareableList: 1d58. インスタンスの利用例を示します。

     >>> from multiprocessing import shared_memory
     >>> a = shared_memory.ShareableList(['howdy', b'HoWdY', -273.154, 100, None, True, 42])
     >>> [ type(entry) for entry in a ]
     [<class 'str'>, <class 'bytes'>, <class 'float'>, <class 'int'>, <class 'NoneType'>, <class 'bool'>, <class 'int'>]
     >>> a[2]
     -273.154
     >>> a[2] = -78.5
     >>> a[2]
     -78.5
     >>> a[2] = 'dry ice'  # Changing data types is supported as well
     >>> a[2]
     'dry ice'
     >>> a[2] = 'larger than previously allocated storage space'
     Traceback (most recent call last):
       ...
     ValueError: exceeds available storage for existing str
     >>> a[2]
     'dry ice'
     >>> len(a)
     7
     >>> a.index(42)
     6
     >>> a.count(b'howdy')
     0
     >>> a.count(b'HoWdY')
     1
     >>> a.shm.close()
     >>> a.shm.unlink()
     >>> del a  # Use of a ShareableList after call to unlink() is unsupported

The following example depicts how one, two, or many processes may access
the same *note ShareableList: 1d58. by supplying the name of the shared
memory block behind it:

     >>> b = shared_memory.ShareableList(range(5))         # In a first process
     >>> c = shared_memory.ShareableList(name=b.shm.name)  # In a second process
     >>> c
     ShareableList([0, 1, 2, 3, 4], name='...')
     >>> c[-1] = -999
     >>> b[-1]
     -999
     >>> b.shm.close()
     >>> c.shm.close()
     >>> c.shm.unlink()

The following examples demonstrates that *note ShareableList: 1d58. (and
underlying *note SharedMemory: 19d8.) objects can be pickled and
unpickled if needed.  Note, that it will still be the same shared
object.  This happens, because the deserialized object has the same
unique name and is just attached to an existing object with the same
name (if the object is still alive):

     >>> import pickle
     >>> from multiprocessing import shared_memory
     >>> sl = shared_memory.ShareableList(range(10))
     >>> list(sl)
     [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

     >>> deserialized_sl = pickle.loads(pickle.dumps(sl))
     >>> list(deserialized_sl)
     [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

     >>> sl[0] = -1
     >>> deserialized_sl[1] = -2
     >>> list(sl)
     [-1, -2, 2, 3, 4, 5, 6, 7, 8, 9]
     >>> list(deserialized_sl)
     [-1, -2, 2, 3, 4, 5, 6, 7, 8, 9]

     >>> sl.shm.close()
     >>> sl.shm.unlink()

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/multiprocessing/shared_memory.py

   (2) https://numpy.org/

   (3) https://github.com/python/cpython/issues/106939


File: python.info,  Node: concurrent パッケージ,  Next: concurrent futures --- 並列タスク実行,  Prev: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ,  Up: 並行実行

5.18.4 ‘concurrent’ パッケージ
------------------------------

This package contains the following modules:

   * *note concurrent.futures: 24. - 並列タスク実行

   * *note concurrent.interpreters: 25. - Multiple interpreters in the
     same process


File: python.info,  Node: concurrent futures --- 並列タスク実行,  Next: concurrent interpreters --- Multiple interpreters in the same process,  Prev: concurrent パッケージ,  Up: 並行実行

5.18.5 ‘concurrent.futures’ -- 並列タスク実行
---------------------------------------------

Added in version 3.2.

'ソースコード:' Lib/concurrent/futures/thread.py(1)、
Lib/concurrent/futures/process.py(2) および
Lib/concurrent/futures/interpreter.py(3)

__________________________________________________________________

The ‘concurrent.futures’ module provides a high-level interface for
asynchronously executing callables.

The asynchronous execution can be performed with threads, using *note
ThreadPoolExecutor: 949. or *note InterpreterPoolExecutor: 1d2, or
separate processes, using *note ProcessPoolExecutor: 1d6.  Each
implements the same interface, which is defined by the abstract *note
Executor: 36e2. class.

*note concurrent.futures.Future: 13ca. must not be confused with *note
asyncio.Future: dc6, which is designed for use with *note asyncio: b.
tasks and coroutines.  See the *note asyncio's Future: 36e3.
documentation for a detailed comparison of the two.

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

* Menu:

* Executor オブジェクト::
* ThreadPoolExecutor::
* InterpreterPoolExecutor::
* ProcessPoolExecutor::
* Future オブジェクト::
* モジュール関数: モジュール関数<2>.
* 例外クラス::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/concurrent/futures/thread.py

   (2) 
https://github.com/python/cpython/tree/3.14/Lib/concurrent/futures/process.py

   (3) 
https://github.com/python/cpython/tree/3.14/Lib/concurrent/futures/interpreter.py


File: python.info,  Node: Executor オブジェクト,  Next: ThreadPoolExecutor,  Up: concurrent futures --- 並列タスク実行

5.18.5.1 Executor オブジェクト
..............................

 -- クラス: concurrent.futures.Executor

     非同期呼び出しを実行するためのメソッドを提供する抽象クラスです。こ
     のクラスを直接使ってはならず、具象サブクラスを介して使います。

      -- メソッド: submit (fn, /, *args, **kwargs)

          呼び出し可能オブジェクト 'fn' を、 ‘fn(*args, **kwargs)’ とし
          て実行するようにスケジュールし、呼び出し可能オブジェクトの実行
          を表現する *note Future: 13ca. オブジェクトを返します。

               with ThreadPoolExecutor(max_workers=1) as executor:
                   future = executor.submit(pow, 323, 1235)
                   print(future.result())

      -- メソッド: map (fn, *iterables, timeout=None, chunksize=1,
               buffersize=None)

          Similar to *note map(fn, *iterables): 19f. except:

             * The 'iterables' are collected immediately rather than
               lazily, unless a 'buffersize' is specified to limit the
               number of submitted tasks whose results have not yet been
               yielded.  If the buffer is full, iteration over the
               'iterables' pauses until a result is yielded from the
               buffer.

             * 'fn' is executed asynchronously and several calls to 'fn'
               may be made concurrently.

          もし *note __next__(): 14e5. が呼ばれその結果が元々の *note
          Executor.map(): 1dc. の呼び出しから 'timeout' 秒経った後も利用
          できない場合、返されるイテレータは *note TimeoutError: a36. を
          送出します。'timeout' は整数または浮動小数点数です。もし
          'timeout' が指定されないか の場合、待ち時間に制限はありません
          。

          もし 'fn' の呼び出しが例外を送出した場合、その例外はイテレータ
          から値を受け取る時に送出されます。

          When using *note ProcessPoolExecutor: 1d6, this method chops
          'iterables' into a number of chunks which it submits to the
          pool as separate tasks.  The (approximate) size of these
          chunks can be specified by setting 'chunksize' to a positive
          integer.  For very long iterables, using a large value for
          'chunksize' can significantly improve performance compared to
          the default size of 1.  With *note ThreadPoolExecutor: 949.
          and *note InterpreterPoolExecutor: 1d2, 'chunksize' has no
          effect.

          バージョン 3.5 で変更: 'chunksize' 引数が追加されました。

          バージョン 3.14 で変更: 'buffersize' 引数が追加されました。

      -- メソッド: shutdown (wait=True, *, cancel_futures=False)

          executor に対して、現在保留中のフューチャーが実行された後で、
          使用中のすべての資源を解放するように伝えます。シャットダウンに
          より後に *note Executor.submit(): c75. と *note
          Executor.map(): 1dc. を呼び出すと *note RuntimeError: 244. が
          送出されます。

          'wait' が ‘True’ の場合、すべての未完了のフューチャの実行が完
          了して Executor に関連付けられたリソースが解放されるまで、この
          メソッドは返りません。 'wait' が ‘False’ の場合、このメソッド
          はすぐに返り、すべての未完了のフューチャの実行が完了したときに
          、 Executor に関連付けられたリソースが解放されます。 'wait' の
          値に関係なく、すべての未完了のフューチャの実行が完了するまで
          Python プログラム全体は終了しません。

          If 'cancel_futures' is ‘True’, this method will cancel all
          pending futures that the executor has not started running.
          Any futures that are completed or running won't be cancelled,
          regardless of the value of 'cancel_futures'.

          If both 'cancel_futures' and 'wait' are ‘True’, all futures
          that the executor has started running will be completed prior
          to this method returning.  The remaining futures are
          cancelled.

          You can avoid having to call this method explicitly if you use
          the executor as a *note context manager: 1e1. via the *note
          with: 186. statement, which will shutdown the *note Executor:
          36e2. (waiting as if *note Executor.shutdown(): aea. were
          called with 'wait' set to ‘True’):

               import shutil
               with ThreadPoolExecutor(max_workers=4) as e:
                   e.submit(shutil.copy, 'src1.txt', 'dest1.txt')
                   e.submit(shutil.copy, 'src2.txt', 'dest2.txt')
                   e.submit(shutil.copy, 'src3.txt', 'dest3.txt')
                   e.submit(shutil.copy, 'src4.txt', 'dest4.txt')

          バージョン 3.9 で変更: 'cancel_futures' が追加されました。


File: python.info,  Node: ThreadPoolExecutor,  Next: InterpreterPoolExecutor,  Prev: Executor オブジェクト,  Up: concurrent futures --- 並列タスク実行

5.18.5.2 ThreadPoolExecutor
...........................

*note ThreadPoolExecutor: 949. はスレッドのプールを使用して非同期に呼び
出しを行う、 *note Executor: 36e2. のサブクラスです。

*note Future: 13ca. に関連づけられた呼び出し可能オブジェクトが、別の
*note Future: 13ca. の結果を待つ時にデッドロックすることがあります。例:

     import time
     def wait_on_b():
         time.sleep(5)
         print(b.result())  # b will never complete because it is waiting on a.
         return 5

     def wait_on_a():
         time.sleep(5)
         print(a.result())  # a will never complete because it is waiting on b.
         return 6


     executor = ThreadPoolExecutor(max_workers=2)
     a = executor.submit(wait_on_b)
     b = executor.submit(wait_on_a)

以下でも同様です:

     def wait_on_future():
         f = executor.submit(pow, 5, 2)
         # This will never complete because there is only one worker thread and
         # it is executing this function.
         print(f.result())

     executor = ThreadPoolExecutor(max_workers=1)
     executor.submit(wait_on_future)

 -- クラス: concurrent.futures.ThreadPoolExecutor (max_workers=None,
          thread_name_prefix='', initializer=None, initargs=())

     最大で 'max_workers' 個のスレッドを非同期実行に使う *note Executor:
     36e2. のサブクラスです。

     All threads enqueued to ‘ThreadPoolExecutor’ will be joined before
     the interpreter can exit.  Note that the exit handler which does
     this is executed 'before' any exit handlers added using ‘atexit’.
     This means exceptions in the main thread must be caught and handled
     in order to signal threads to exit gracefully.  For this reason, it
     is recommended that ‘ThreadPoolExecutor’ not be used for
     long-running tasks.

     'initializer' is an optional callable that is called at the start
     of each worker thread; 'initargs' is a tuple of arguments passed to
     the initializer.  Should 'initializer' raise an exception, all
     currently pending jobs will raise a *note BrokenThreadPool: 36e6,
     as well as any attempt to submit more jobs to the pool.

     バージョン 3.5 で変更: 'max_workers' が ‘None’ か指定されない場合の
     デフォルト値はマシンのプロセッサの数に 5 を掛けたものになります。こ
     れは、 *note ThreadPoolExecutor: 949. は CPU の処理ではなく I/O を
     オーバーラップするのによく使用されるため、 *note
     ProcessPoolExecutor: 1d6. のワーカーの数よりもこのワーカーの数を増
     やすべきであるという想定に基づいています。

     バージョン 3.6 で変更: 'thread_name_prefix' 引数が追加され、デバッ
     グしやすくなるようにプールから作られたワーカスレッド *note
     threading.Thread: 176. の名前を管理できるようになりました。

     バージョン 3.7 で変更: 'initializer' と 'initargs' 引数が追加されま
     した。

     バージョン 3.8 で変更: Default value of 'max_workers' is changed to
     ‘min(32, os.cpu_count() + 4)’.  This default value preserves at
     least 5 workers for I/O bound tasks.  It utilizes at most 32 CPU
     cores for CPU bound tasks which release the GIL. And it avoids
     using very large resources implicitly on many-core machines.

     ThreadPoolExecutor now reuses idle worker threads before starting
     'max_workers' worker threads too.

     バージョン 3.13 で変更: Default value of 'max_workers' is changed
     to ‘min(32, (os.process_cpu_count() or 1) + 4)’.

* Menu:

* ThreadPoolExecutor の例::


File: python.info,  Node: ThreadPoolExecutor の例,  Up: ThreadPoolExecutor

5.18.5.3 ThreadPoolExecutor の例
................................

     import concurrent.futures
     import urllib.request

     URLS = ['http://www.foxnews.com/',
             'http://www.cnn.com/',
             'http://europe.wsj.com/',
             'http://www.bbc.co.uk/',
             'http://nonexistent-subdomain.python.org/']

     # Retrieve a single page and report the URL and contents
     def load_url(url, timeout):
         with urllib.request.urlopen(url, timeout=timeout) as conn:
             return conn.read()

     # We can use a with statement to ensure threads are cleaned up promptly
     with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
         # Start the load operations and mark each future with its URL
         future_to_url = {executor.submit(load_url, url, 60): url for url in URLS}
         for future in concurrent.futures.as_completed(future_to_url):
             url = future_to_url[future]
             try:
                 data = future.result()
             except Exception as exc:
                 print('%r generated an exception: %s' % (url, exc))
             else:
                 print('%r page is %d bytes' % (url, len(data)))


File: python.info,  Node: InterpreterPoolExecutor,  Next: ProcessPoolExecutor,  Prev: ThreadPoolExecutor,  Up: concurrent futures --- 並列タスク実行

5.18.5.4 InterpreterPoolExecutor
................................

Added in version 3.14.

The *note InterpreterPoolExecutor: 1d2. class uses a pool of
interpreters to execute calls asynchronously.  It is a *note
ThreadPoolExecutor: 949. subclass, which means each worker is running in
its own thread.  The difference here is that each worker has its own
interpreter, and runs each task using that interpreter.

The biggest benefit to using interpreters instead of only threads is
true multi-core parallelism.  Each interpreter has its own *note Global
Interpreter Lock: 474, so code running in one interpreter can run on one
CPU core, while code in another interpreter runs unblocked on a
different core.

The tradeoff is that writing concurrent code for use with multiple
interpreters can take extra effort.  However, this is because it forces
you to be deliberate about how and when interpreters interact, and to be
explicit about what data is shared between interpreters.  This results
in several benefits that help balance the extra effort, including true
multi-core parallelism, For example, code written this way can make it
easier to reason about concurrency.  Another major benefit is that you
don't have to deal with several of the big pain points of using threads,
like race conditions.

Each worker's interpreter is isolated from all the other interpreters.
"Isolated" means each interpreter has its own runtime state and operates
completely independently.  For example, if you redirect *note
sys.stdout: ccd. in one interpreter, it will not be automatically
redirected to any other interpreter.  If you import a module in one
interpreter, it is not automatically imported in any other.  You would
need to import the module separately in interpreter where you need it.
In fact, each module imported in an interpreter is a completely separate
object from the same module in a different interpreter, including *note
sys: df, *note builtins: 13, and even ‘__main__’.

Isolation means a mutable object, or other data, cannot be used by more
than one interpreter at the same time.  That effectively means
interpreters cannot actually share such objects or data.  Instead, each
interpreter must have its own copy, and you will have to synchronize any
changes between the copies manually.  Immutable objects and data, like
the builtin singletons, strings, and tuples of immutable objects, don't
have these limitations.

Communicating and synchronizing between interpreters is most effectively
done using dedicated tools, like those proposed in PEP 734(1).  One less
efficient alternative is to serialize with *note pickle: ab. and then
send the bytes over a shared *note socket: d1. or *note pipe: 1b64.

 -- クラス: concurrent.futures.InterpreterPoolExecutor
          (max_workers=None, thread_name_prefix='', initializer=None,
          initargs=())

     A *note ThreadPoolExecutor: 949. subclass that executes calls
     asynchronously using a pool of at most 'max_workers' threads.  Each
     thread runs tasks in its own interpreter.  The worker interpreters
     are isolated from each other, which means each has its own runtime
     state and that they can't share any mutable objects or other data.
     Each interpreter has its own *note Global Interpreter Lock: 474,
     which means code run with this executor has true multi-core
     parallelism.

     The optional 'initializer' and 'initargs' arguments have the same
     meaning as for ‘ThreadPoolExecutor’: the initializer is run when
     each worker is created, though in this case it is run in the
     worker's interpreter.  The executor serializes the 'initializer'
     and 'initargs' using *note pickle: ab. when sending them to the
     worker's interpreter.

          注釈: The executor may replace uncaught exceptions from
          'initializer' with *note ExecutionFailed: 36e9.

     Other caveats from parent *note ThreadPoolExecutor: 949. apply
     here.

*note submit(): c75. and *note map(): 1dc. work like normal, except the
worker serializes the callable and arguments using *note pickle: ab.
when sending them to its interpreter.  The worker likewise serializes
the return value when sending it back.

When a worker's current task raises an uncaught exception, the worker
always tries to preserve the exception as-is.  If that is successful
then it also sets the ‘__cause__’ to a corresponding *note
ExecutionFailed: 36e9. instance, which contains a summary of the
original exception.  In the uncommon case that the worker is not able to
preserve the original as-is then it directly preserves the corresponding
*note ExecutionFailed: 36e9. instance instead.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0734/


File: python.info,  Node: ProcessPoolExecutor,  Next: Future オブジェクト,  Prev: InterpreterPoolExecutor,  Up: concurrent futures --- 並列タスク実行

5.18.5.5 ProcessPoolExecutor
............................

*note ProcessPoolExecutor: 1d6. はプロセスプールを使って非同期呼び出しを
実施する *note Executor: 36e2. のサブクラスです。*note
ProcessPoolExecutor: 1d6. は *note multiprocessing: 98. モジュールを利用
します。このため *note Global Interpreter Lock: 474. を回避することがで
きますが、pickle 化できるオブジェクトしか実行したり返したりすることがで
きません。

‘__main__’ モジュールはワーカサブプロセスでインポート可能でなければなり
ません。 すなわち、 *note ProcessPoolExecutor: 1d6. は対話的インタープリ
タでは動きません。

*note ProcessPoolExecutor: 1d6. に渡された呼び出し可能オブジェクトから
*note Executor: 36e2. や *note Future: 13ca. メソッドを呼ぶとデッドロッ
クに陥ります。

Note that the restrictions on functions and arguments needing to
picklable as per *note multiprocessing.Process: 252. apply when using
*note submit(): c75. and *note map(): 1dc. on a *note
ProcessPoolExecutor: 1d6.  A function defined in a REPL or a lambda
should not be expected to work.

 -- クラス: concurrent.futures.ProcessPoolExecutor (max_workers=None,
          mp_context=None, initializer=None, initargs=(),
          max_tasks_per_child=None)

     An *note Executor: 36e2. subclass that executes calls
     asynchronously using a pool of at most 'max_workers' processes.  If
     'max_workers' is ‘None’ or not given, it will default to *note
     os.process_cpu_count(): 4da.  If 'max_workers' is less than or
     equal to ‘0’, then a *note ValueError: 2ec. will be raised.  On
     Windows, 'max_workers' must be less than or equal to ‘61’.  If it
     is not then *note ValueError: 2ec. will be raised.  If
     'max_workers' is ‘None’, then the default chosen will be at most
     ‘61’, even if more processors are available.  'mp_context' can be a
     *note multiprocessing: 98. context or ‘None’.  It will be used to
     launch the workers.  If 'mp_context' is ‘None’ or not given, the
     default *note multiprocessing: 98. context is used.  See *note
     コンテキストと開始方式: 1d5.

     'initializer' is an optional callable that is called at the start
     of each worker process; 'initargs' is a tuple of arguments passed
     to the initializer.  Should 'initializer' raise an exception, all
     currently pending jobs will raise a *note BrokenProcessPool: 36eb,
     as well as any attempt to submit more jobs to the pool.

     'max_tasks_per_child' is an optional argument that specifies the
     maximum number of tasks a single process can execute before it will
     exit and be replaced with a fresh worker process.  By default
     'max_tasks_per_child' is ‘None’ which means worker processes will
     live as long as the pool.  When a max is specified, the "spawn"
     multiprocessing start method will be used by default in absence of
     a 'mp_context' parameter.  This feature is incompatible with the
     "fork" start method.

          注釈: Bugs have been reported when using the
          'max_tasks_per_child' feature that can result in the *note
          ProcessPoolExecutor: 1d6. hanging in some circumstances.
          Follow its eventual resolution in gh-115634(1).

     バージョン 3.3 で変更: ワーカプロセスの1つが突然終了した場合、*note
     BrokenProcessPool: 36eb. エラーが送出されるようになりました。 以前
     は挙動は未定義でしたが、 executor や futures がフリーズしたりデッド
     ロックを起こすことがしばしばでした。

     バージョン 3.7 で変更: The 'mp_context' argument was added to allow
     users to control the start_method for worker processes created by
     the pool.

     'initializer' と 'initargs' 引数が追加されました。

     バージョン 3.11 で変更: The 'max_tasks_per_child' argument was
     added to allow users to control the lifetime of workers in the
     pool.

     バージョン 3.12 で変更: On POSIX systems, if your application has
     multiple threads and the *note multiprocessing: 98. context uses
     the ‘"fork"’ start method: The *note os.fork(): 4b5. function
     called internally to spawn workers may raise a *note
     DeprecationWarning: 1a3.  Pass a 'mp_context' configured to use a
     different start method.  See the *note os.fork(): 4b5.
     documentation for further explanation.

     バージョン 3.13 で変更: 'max_workers' uses *note
     os.process_cpu_count(): 4da. by default, instead of *note
     os.cpu_count(): 4db.

     バージョン 3.14 で変更: The default process start method (see *note
     コンテキストと開始方式: 1d5.) changed away from 'fork'.  If you
     require the 'fork' start method for *note ProcessPoolExecutor: 1d6.
     you must explicitly pass
     ‘mp_context=multiprocessing.get_context("fork")’.

      -- メソッド: terminate_workers ()

          Attempt to terminate all living worker processes immediately
          by calling *note Process.terminate: 1857. on each of them.
          Internally, it will also call *note Executor.shutdown(): aea.
          to ensure that all other resources associated with the
          executor are freed.

          After calling this method the caller should no longer submit
          tasks to the executor.

          Added in version 3.14.

      -- メソッド: kill_workers ()

          Attempt to kill all living worker processes immediately by
          calling *note Process.kill: d4f. on each of them.  Internally,
          it will also call *note Executor.shutdown(): aea. to ensure
          that all other resources associated with the executor are
          freed.

          After calling this method the caller should no longer submit
          tasks to the executor.

          Added in version 3.14.

* Menu:

* ProcessPoolExecutor の例::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/115634


File: python.info,  Node: ProcessPoolExecutor の例,  Up: ProcessPoolExecutor

5.18.5.6 ProcessPoolExecutor の例
.................................

     import concurrent.futures
     import math

     PRIMES = [
         112272535095293,
         112582705942171,
         112272535095293,
         115280095190773,
         115797848077099,
         1099726899285419]

     def is_prime(n):
         if n < 2:
             return False
         if n == 2:
             return True
         if n % 2 == 0:
             return False

         sqrt_n = int(math.floor(math.sqrt(n)))
         for i in range(3, sqrt_n + 1, 2):
             if n % i == 0:
                 return False
         return True

     def main():
         with concurrent.futures.ProcessPoolExecutor() as executor:
             for number, prime in zip(PRIMES, executor.map(is_prime, PRIMES)):
                 print('%d is prime: %s' % (number, prime))

     if __name__ == '__main__':
         main()


File: python.info,  Node: Future オブジェクト,  Next: モジュール関数<2>,  Prev: ProcessPoolExecutor,  Up: concurrent futures --- 並列タスク実行

5.18.5.7 Future オブジェクト
............................

*note Future: 13ca. クラスは呼び出し可能オブジェクトの非同期実行をカプセ
ル化します。 *note Future: 13ca. のインスタンスは *note
Executor.submit(): c75. によって生成されます。

 -- クラス: concurrent.futures.Future

     呼び出し可能オブジェクトの非同期実行をカプセル化します。 *note
     Future: 13ca. インスタンスは *note Executor.submit(): c75. で生成さ
     れ、テストを除いて直接生成すべきではありません。

      -- メソッド: cancel ()

          Attempt to cancel the call.  If the call is currently being
          executed or finished running and cannot be cancelled then the
          method will return ‘False’, otherwise the call will be
          cancelled and the method will return ‘True’.

      -- メソッド: cancelled ()

          呼び出しが正常にキャンセルされた場合 ‘True’ を返します。

      -- メソッド: running ()

          現在呼び出しが実行中でキャンセルできない場合 ‘True’ を返します
          。

      -- メソッド: done ()

          呼び出しが正常にキャンセルされたか終了した場合 ‘True’ を返しま
          す。

      -- メソッド: result (timeout=None)

          呼び出しによって返された値を返します。もし呼び出しがまだ完了し
          ていなければ、このメソッドは 'timeout' 秒の間、待機します。も
          し呼び出しが 'timeout' 秒間の間に完了しなければ、 *note
          TimeoutError: a36. が送出されます。 'timeout' はintかfloatを指
          定できます。もし 'timeout' が指定されていないか、 ‘None’ であ
          れば、待機時間に制限はありません。

          future が完了する前にキャンセルされた場合 *note
          CancelledError: bce. が送出されます。

          If the call raised an exception, this method will raise the
          same exception.

      -- メソッド: exception (timeout=None)

          呼び出しによって送出された例外を返します。もし呼び出しがまだ完
          了されていなければ、このメソッドは 'timeout' 秒だけ待機します
          。もし呼び出しが 'timeout' 秒の間に完了しなければ、 *note
          TimeoutError: a36. が送出されます。 'timeout' にはintかfloatを
          指定できます。 'timeout' が指定されていないか、 ‘None’ であれ
          ば、待機時間に制限はありません。

          future が完了する前にキャンセルされた場合 *note
          CancelledError: bce. が送出されます。

          呼び出しが例外を送出することなく完了した場合、‘None’ を返しま
          す。

      -- メソッド: add_done_callback (fn)

          呼び出し可能な 'fn' オブジェクトを future にアタッチします。
          futureがキャンセルされたか、実行を終了した際に、future をその
          ただ一つの引数として 'fn' が呼び出されます。

          追加された呼び出し可能オブジェクトは、追加された順番で呼びださ
          れ、追加を行ったプロセスに属するスレッド中で呼び出されます。も
          し呼び出し可能オブジェクトが *note Exception: bcd. のサブクラ
          スを送出した場合、それはログに記録され無視されます。呼び出し可
          能オブジェクトが *note BaseException: 7d6. のサブクラスを送出
          した場合の動作は未定義です。

          もしfutureがすでに完了しているか、キャンセル済みであれば、'fn'
          は即座に実行されます。

     以下の *note Future: 13ca. メソッドは、ユニットテストでの使用と
     *note Executor: 36e2. を実装することを意図しています。

      -- メソッド: set_running_or_notify_cancel ()

          このメソッドは、*note Future: 13ca. に関連付けられたワークやユ
          ニットテストによるワークの実行前に、 *note Executor: 36e2. の
          実装によってのみ呼び出してください。

          このメソッドが ‘False’ を返す場合、 *note Future: 13ca. はキャ
          ンセルされています。つまり、 *note Future.cancel(): 36ee. が呼
          び出されて ‘True’ が返っています。*note Future: 13ca. の完了を
          (*note as_completed(): 19c7. または *note wait(): 1c05. により
          ) 待機するすべてのスレッドが起動します。

          このメソッドが ‘True’ を返す場合、 *note Future: 13ca. はキャ
          ンセルされて、実行状態に移行されています。つまり、 *note
          Future.running(): 36f0. を呼び出すと ‘True’ が返ります。

          このメソッドは、一度だけ呼び出すことができ、*note
          Future.set_result(): 36f6. または *note
          Future.set_exception(): 36f7. がキャンセルされた後には呼び出す
          ことができません。

      -- メソッド: set_result (result)

          *note Future: 13ca. に関連付けられたワークの結果を 'result' に
          設定します。

          このメソッドは、 *note Executor: 36e2. の実装またはユニットテ
          ストによってのみ使用してください。

          バージョン 3.8 で変更: This method raises *note
          concurrent.futures.InvalidStateError: 1951. if the *note
          Future: 13ca. is already done.

      -- メソッド: set_exception (exception)

          *note Future: 13ca. に関連付けられたワークの結果を *note
          Exception: bcd. 'exception' に設定します。

          このメソッドは、 *note Executor: 36e2. の実装またはユニットテ
          ストによってのみ使用してください。

          バージョン 3.8 で変更: This method raises *note
          concurrent.futures.InvalidStateError: 1951. if the *note
          Future: 13ca. is already done.


File: python.info,  Node: モジュール関数<2>,  Next: 例外クラス,  Prev: Future オブジェクト,  Up: concurrent futures --- 並列タスク実行

5.18.5.8 モジュール関数
.......................

 -- の関数: concurrent.futures.wait (fs, timeout=None,
          return_when=ALL_COMPLETED)

     Wait for the *note Future: 13ca. instances (possibly created by
     different *note Executor: 36e2. instances) given by 'fs' to
     complete.  Duplicate futures given to 'fs' are removed and will be
     returned only once.  Returns a named 2-tuple of sets.  The first
     set, named ‘done’, contains the futures that completed (finished or
     cancelled futures) before the wait completed.  The second set,
     named ‘not_done’, contains the futures that did not complete
     (pending or running futures).

     'timeout' で結果を返すまで待機する最大秒数を指定できます。'timeout'
     は整数か浮動小数点数をとります。'timeout' が指定されないか ‘None’ の
     場合、無期限に待機します。

     'return_when' でこの関数がいつ結果を返すか指定します。指定できる値
     は以下の 定数のどれか一つです:

     定数                                                   説明
                                                            
     --------------------------------------------------------------------------------------------------------------
                                                            
      -- データ: concurrent.futures.FIRST_COMPLETED         いずれかのフューチャが終了したかキャンセルされたとき
                                                            に返します。
                                                            
                                                            
      -- データ: concurrent.futures.FIRST_EXCEPTION         The function will return when any future finishes by
                                                            raising an exception.  If no future raises an
                                                            exception then it is equivalent to
                                                            *note ALL_COMPLETED: 36fb.
                                                            
                                                            
      -- データ: concurrent.futures.ALL_COMPLETED           すべてのフューチャが終了したかキャンセルされたときに
                                                            返します。
                                                            

 -- の関数: concurrent.futures.as_completed (fs, timeout=None)

     Returns an iterator over the *note Future: 13ca. instances
     (possibly created by different *note Executor: 36e2. instances)
     given by 'fs' that yields futures as they complete (finished or
     cancelled futures).  Any futures given by 'fs' that are duplicated
     will be returned once.  Any futures that completed before *note
     as_completed(): 19c7. is called will be yielded first.  The
     returned iterator raises a *note TimeoutError: a36. if *note
     __next__(): 14e5. is called and the result isn't available after
     'timeout' seconds from the original call to *note as_completed():
     19c7.  'timeout' can be an int or float.  If 'timeout' is not
     specified or ‘None’, there is no limit to the wait time.

参考
....

PEP 3148(1) - futures - execute computations asynchronously

     この機能を Python 標準ライブラリに含めることを述べた提案です。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3148/


File: python.info,  Node: 例外クラス,  Prev: モジュール関数<2>,  Up: concurrent futures --- 並列タスク実行

5.18.5.9 例外クラス
...................

 -- 例外: concurrent.futures.CancelledError

     future がキャンセルされたときに送出されます。

 -- 例外: concurrent.futures.TimeoutError

     A deprecated alias of *note TimeoutError: a36, raised when a future
     operation exceeds the given timeout.

     バージョン 3.11 で変更: このクラスは *note TimeoutError: a36. のエ
     イリアスになりました。

 -- 例外: concurrent.futures.BrokenExecutor

     Derived from *note RuntimeError: 244, this exception class is
     raised when an executor is broken for some reason, and cannot be
     used to submit or execute new tasks.

     Added in version 3.7.

 -- 例外: concurrent.futures.InvalidStateError

     Raised when an operation is performed on a future that is not
     allowed in the current state.

     Added in version 3.8.

 -- 例外: concurrent.futures.thread.BrokenThreadPool

     Derived from *note BrokenExecutor: 36fe, this exception class is
     raised when one of the workers of a *note ThreadPoolExecutor: 949.
     has failed initializing.

     Added in version 3.7.

 -- 例外: concurrent.futures.interpreter.BrokenInterpreterPool

     Derived from *note BrokenThreadPool: 36e6, this exception class is
     raised when one of the workers of a *note InterpreterPoolExecutor:
     1d2. has failed initializing.

     Added in version 3.14.

 -- 例外: concurrent.futures.process.BrokenProcessPool

     Derived from *note BrokenExecutor: 36fe. (formerly *note
     RuntimeError: 244.), this exception class is raised when one of the
     workers of a *note ProcessPoolExecutor: 1d6. has terminated in a
     non-clean fashion (for example, if it was killed from the outside).

     Added in version 3.3.


File: python.info,  Node: concurrent interpreters --- Multiple interpreters in the same process,  Next: subprocess --- サブプロセス管理,  Prev: concurrent futures --- 並列タスク実行,  Up: 並行実行

5.18.6 ‘concurrent.interpreters’ -- Multiple interpreters in the same process
-----------------------------------------------------------------------------

Added in version 3.14.

'Source code:' Lib/concurrent/interpreters(1)

__________________________________________________________________

The ‘concurrent.interpreters’ module constructs higher-level interfaces
on top of the lower level ‘_interpreters’ module.

The module is primarily meant to provide a basic API for managing
interpreters (AKA "subinterpreters") and running things in them.
Running mostly involves switching to an interpreter (in the current
thread) and calling a function in that execution context.

For concurrency, interpreters themselves (and this module) don't provide
much more than isolation, which on its own isn't useful.  Actual
concurrency is available separately through *note threads: f3. See *note
below: 3703.

参考
....

*note InterpreterPoolExecutor: 1d2.

     Combines threads with interpreters in a familiar interface.

*note 拡張モジュールを分離する: 166.

     How to update an extension module to support multiple interpreters.

PEP 554(2)

PEP 734(3)

PEP 684(4)

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

* Menu:

* Key details::
* はじめに: はじめに<10>.
* リファレンス: リファレンス<4>.
* 基本的な使い方: 基本的な使い方<3>.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/concurrent/interpreters

   (2) https://peps.python.org/pep-0554/

   (3) https://peps.python.org/pep-0734/

   (4) https://peps.python.org/pep-0684/


File: python.info,  Node: Key details,  Next: はじめに<10>,  Up: concurrent interpreters --- Multiple interpreters in the same process

5.18.6.1 Key details
....................

Before we dive in further, there are a small number of details to keep
in mind about using multiple interpreters:

   * *note isolated: 3705., by default

   * no implicit threads

   * not all PyPI packages support use in multiple interpreters yet


File: python.info,  Node: はじめに<10>,  Next: リファレンス<4>,  Prev: Key details,  Up: concurrent interpreters --- Multiple interpreters in the same process

5.18.6.2 はじめに
.................

An "interpreter" is effectively the execution context of the Python
runtime.  It contains all of the state the runtime needs to execute a
program.  This includes things like the import state and builtins.
(Each thread, even if there's only the main thread, has some extra
runtime state, in addition to the current interpreter, related to the
current exception and the bytecode eval loop.)

The concept and functionality of the interpreter have been a part of
Python since version 2.2, but the feature was only available through the
C-API and not well known, and the *note isolation: 3705. was relatively
incomplete until version 3.12.

* Menu:

* Multiple Interpreters and Isolation::
* Running in an Interpreter::
* Concurrency and Parallelism::
* Communication Between Interpreters::
* "Sharing" Objects::


File: python.info,  Node: Multiple Interpreters and Isolation,  Next: Running in an Interpreter,  Up: はじめに<10>

5.18.6.3 Multiple Interpreters and Isolation
............................................

A Python implementation may support using multiple interpreters in the
same process.  CPython has this support.  Each interpreter is
effectively isolated from the others (with a limited number of carefully
managed process-global exceptions to the rule).

That isolation is primarily useful as a strong separation between
distinct logical components of a program, where you want to have careful
control of how those components interact.

     注釈: Interpreters in the same process can technically never be
     strictly isolated from one another since there are few restrictions
     on memory access within the same process.  The Python runtime makes
     a best effort at isolation but extension modules may easily violate
     that.  Therefore, do not use multiple interpreters in
     security-sensitive situations, where they shouldn't have access to
     each other's data.


File: python.info,  Node: Running in an Interpreter,  Next: Concurrency and Parallelism,  Prev: Multiple Interpreters and Isolation,  Up: はじめに<10>

5.18.6.4 Running in an Interpreter
..................................

Running in a different interpreter involves switching to it in the
current thread and then calling some function.  The runtime will execute
the function using the current interpreter's state.  The
‘concurrent.interpreters’ module provides a basic API for creating and
managing interpreters, as well as the switch-and-call operation.

No other threads are automatically started for the operation.  There is
*note a helper: 370a.for that though.  There is another dedicated helper
for calling the builtin *note exec(): 4a2. in an interpreter.

When *note exec(): 4a2. (or *note eval(): 4a3.) are called in an
interpreter, they run using the interpreter's ‘__main__’ module as the
"globals" namespace.  The same is true for functions that aren't
associated with any module.  This is the same as how scripts invoked
from the command-line run in the ‘__main__’ module.


File: python.info,  Node: Concurrency and Parallelism,  Next: Communication Between Interpreters,  Prev: Running in an Interpreter,  Up: はじめに<10>

5.18.6.5 Concurrency and Parallelism
....................................

As noted earlier, interpreters do not provide any concurrency on their
own.  They strictly represent the isolated execution context the runtime
will use 'in the current thread'.  That isolation makes them similar to
processes, but they still enjoy in-process efficiency, like threads.

All that said, interpreters do naturally support certain flavors of
concurrency.  There's a powerful side effect of that isolation.  It
enables a different approach to concurrency than you can take with async
or threads.  It's a similar concurrency model to CSP or the actor model,
a model which is relatively easy to reason about.

You can take advantage of that concurrency model in a single thread,
switching back and forth between interpreters, Stackless-style.
However, this model is more useful when you combine interpreters with
multiple threads.  This mostly involves starting a new thread, where you
switch to another interpreter and run what you want there.

Each actual thread in Python, even if you're only running in the main
thread, has its own 'current' execution context.  Multiple threads can
use the same interpreter or different ones.

At a high level, you can think of the combination of threads and
interpreters as threads with opt-in sharing.

As a significant bonus, interpreters are sufficiently isolated that they
do not share the *note GIL: 164, which means combining threads with
multiple interpreters enables full multi-core parallelism.  (This has
been the case since Python 3.12.)


File: python.info,  Node: Communication Between Interpreters,  Next: "Sharing" Objects,  Prev: Concurrency and Parallelism,  Up: はじめに<10>

5.18.6.6 Communication Between Interpreters
...........................................

In practice, multiple interpreters are useful only if we have a way to
communicate between them.  This usually involves some form of message
passing, but can even mean sharing data in some carefully managed way.

With this in mind, the ‘concurrent.interpreters’ module provides a *note
queue.Queue: 15ac. implementation, available through *note
create_queue(): 370d.


File: python.info,  Node: "Sharing" Objects,  Prev: Communication Between Interpreters,  Up: はじめに<10>

5.18.6.7 "Sharing" Objects
..........................

Any data actually shared between interpreters loses the thread-safety
provided by the *note GIL: 164.  There are various options for dealing
with this in extension modules.  However, from Python code the lack of
thread-safety means objects can't actually be shared, with a few
exceptions.  Instead, a copy must be created, which means mutable
objects won't stay in sync.

By default, most objects are copied with *note pickle: ab. when they are
passed to another interpreter.  Nearly all of the immutable builtin
objects are either directly shared or copied efficiently.  For example:

   * *note None: 885.

   * *note bool: 3c3. (*note True: e07. and *note False: d2b.)

   * *note bytes: 192.

   * *note str: 169.

   * *note int: 19b.

   * *note float: 196.

   * *note tuple: 614. (of similarly supported objects)

There is a small number of Python types that actually share mutable data
between interpreters:

   * *note memoryview: 165.

   * *note Queue: 3710.


File: python.info,  Node: リファレンス<4>,  Next: 基本的な使い方<3>,  Prev: はじめに<10>,  Up: concurrent interpreters --- Multiple interpreters in the same process

5.18.6.8 リファレンス
.....................

このモジュールは以下の関数を定義しています:

 -- の関数: concurrent.interpreters.list_all ()

     Return a *note list: 24d. of *note Interpreter: 3713. objects, one
     for each existing interpreter.

 -- の関数: concurrent.interpreters.get_current ()

     Return an *note Interpreter: 3713. object for the currently running
     interpreter.

 -- の関数: concurrent.interpreters.get_main ()

     Return an *note Interpreter: 3713. object for the main interpreter.
     This is the interpreter the runtime created to run the *note REPL:
     491. or the script given at the command-line.  It is usually the
     only one.

 -- の関数: concurrent.interpreters.create ()

     Initialize a new (idle) Python interpreter and return a *note
     Interpreter: 3713. object for it.

 -- の関数: concurrent.interpreters.create_queue ()

     Initialize a new cross-interpreter queue and return a *note Queue:
     3710. object for it.

* Menu:

* Interpreter objects::
* 例外: 例外<13>.
* Communicating Between Interpreters::


File: python.info,  Node: Interpreter objects,  Next: 例外<13>,  Up: リファレンス<4>

5.18.6.9 Interpreter objects
............................

 -- クラス: concurrent.interpreters.Interpreter (id)

     A single interpreter in the current process.

     Generally, *note Interpreter: 3713. shouldn't be called directly.
     Instead, use *note create(): 17bc. or one of the other module
     functions.

      -- の属性: id

          (read-only)

          The underlying interpreter's ID.

      -- の属性: whence

          (read-only)

          A string describing where the interpreter came from.

      -- メソッド: is_running ()

          Return ‘True’ if the interpreter is currently executing code
          in its ‘__main__’ module and ‘False’ otherwise.

      -- メソッド: close ()

          Finalize and destroy the interpreter.

      -- メソッド: prepare_main (ns=None, **kwargs)

          Bind objects in the interpreter's ‘__main__’ module.

          Some objects are actually shared and some are copied
          efficiently, but most are copied via *note pickle: ab.  See
          *note "Sharing" Objects: 370e.

      -- メソッド: exec (code, /, dedent=True)

          Run the given source code in the interpreter (in the current
          thread).

      -- メソッド: call (callable, /, *args, **kwargs)

          Return the result of calling running the given function in the
          interpreter (in the current thread).

      -- メソッド: call_in_thread (callable, /, *args, **kwargs)

          Run the given function in the interpreter (in a new thread).


File: python.info,  Node: 例外<13>,  Next: Communicating Between Interpreters,  Prev: Interpreter objects,  Up: リファレンス<4>

5.18.6.10 例外
..............

 -- 例外: concurrent.interpreters.InterpreterError

     This exception, a subclass of *note Exception: bcd, is raised when
     an interpreter-related error happens.

 -- 例外: concurrent.interpreters.InterpreterNotFoundError

     This exception, a subclass of *note InterpreterError: 371f, is
     raised when the targeted interpreter no longer exists.

 -- 例外: concurrent.interpreters.ExecutionFailed

     This exception, a subclass of *note InterpreterError: 371f, is
     raised when the running code raised an uncaught exception.

      -- の属性: excinfo

          A basic snapshot of the exception raised in the other
          interpreter.

 -- 例外: concurrent.interpreters.NotShareableError

     This exception, a subclass of *note TypeError: 198, is raised when
     an object cannot be sent to another interpreter.


File: python.info,  Node: Communicating Between Interpreters,  Prev: 例外<13>,  Up: リファレンス<4>

5.18.6.11 Communicating Between Interpreters
............................................

 -- クラス: concurrent.interpreters.Queue (id)

     A wrapper around a low-level, cross-interpreter queue, which
     implements the *note queue.Queue: 15ac. interface.  The underlying
     queue can only be created through *note create_queue(): 370d.

     Some objects are actually shared and some are copied efficiently,
     but most are copied via *note pickle: ab.  See *note "Sharing"
     Objects: 370e.

      -- の属性: id

          (read-only)

          The queue's ID.

 -- 例外: concurrent.interpreters.QueueEmptyError

     This exception, a subclass of *note queue.Empty: 366c, is raised
     from ‘Queue.get()’ and ‘Queue.get_nowait()’ when the queue is
     empty.

 -- 例外: concurrent.interpreters.QueueFullError

     This exception, a subclass of *note queue.Full: 366d, is raised
     from ‘Queue.put()’ and ‘Queue.put_nowait()’ when the queue is full.


File: python.info,  Node: 基本的な使い方<3>,  Prev: リファレンス<4>,  Up: concurrent interpreters --- Multiple interpreters in the same process

5.18.6.12 基本的な使い方
........................

Creating an interpreter and running code in it:

     from concurrent import interpreters

     interp = interpreters.create()

     # Run in the current OS thread.

     interp.exec('print("spam!")')

     interp.exec("""if True:
         print('spam!')
         """)

     from textwrap import dedent
     interp.exec(dedent("""
         print('spam!')
         """))

     def run(arg):
         return arg

     res = interp.call(run, 'spam!')
     print(res)

     def run():
         print('spam!')

     interp.call(run)

     # Run in new OS thread.

     t = interp.call_in_thread(run)
     t.join()


File: python.info,  Node: subprocess --- サブプロセス管理,  Next: sched --- イベントスケジューラー,  Prev: concurrent interpreters --- Multiple interpreters in the same process,  Up: 並行実行

5.18.7 ‘subprocess’ -- サブプロセス管理
---------------------------------------

'ソースコード:' Lib/subprocess.py(1)

__________________________________________________________________

The ‘subprocess’ module allows you to spawn new processes, connect to
their input/output/error pipes, and obtain their return codes.  This
module intends to replace several older modules and functions:

     os.system
     os.spawn*

Information about how the ‘subprocess’ module can be used to replace
these modules and functions can be found in the following sections.

参考
....

PEP 324(2) - subprocess モジュールを提案している PEP

*note Availability: 213f.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 225c. と *note
WebAssemblyプラットフォーム: 1b6a. をサポートしません。

* Menu:

* Using the subprocess Module::
* セキュリティで考慮すべき点: セキュリティで考慮すべき点<2>.
* Popen オブジェクト::
* Windows Popen ヘルパー::
* 古い高水準 API::
* Replacing Older Functions with the subprocess Module::
* レガシーなシェル呼び出し関数::
* 注釈: 注釈<2>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/subprocess.py

   (2) https://peps.python.org/pep-0324/


File: python.info,  Node: Using the subprocess Module,  Next: セキュリティで考慮すべき点<2>,  Up: subprocess --- サブプロセス管理

5.18.7.1 Using the ‘subprocess’ Module
......................................

サブプロセスを起動するために推奨される方法は、すべての用法を扱える *note
run(): d7f. 関数を使用することです。より高度な用法では下層の *note
Popen: 4b7. インターフェースを直接使用することもできます。

 -- の関数: subprocess.run (args, *, stdin=None, input=None,
          stdout=None, stderr=None, capture_output=False, shell=False,
          cwd=None, timeout=None, check=False, encoding=None,
          errors=None, text=None, env=None, universal_newlines=None,
          **other_popen_kwargs)

     'args' で指定されたコマンドを実行します。コマンドの完了を待って、
     *note CompletedProcess: 1073. インスタンスを返します。

     上記の引数は、もっともよく使われるものだけ示しており、後述の *note
     よく使われる引数: 372c. で説明されています (そのためここではキーワ
     ード専用引数の表記に省略されています)。関数の完全な使用法を説明して
     も大部分が *note Popen: 4b7. コンストラクターの内容と同じになります
     - この関数のほとんどの引数は *note Popen: 4b7. インターフェイスに渡
     されます。('timeout'、'input' および 'check' は除く。)

     If 'capture_output' is true, stdout and stderr will be captured.
     When used, the internal *note Popen: 4b7. object is automatically
     created with 'stdout' and 'stderr' both set to *note PIPE: d80.
     The 'stdout' and 'stderr' arguments may not be supplied at the same
     time as 'capture_output'.  If you wish to capture and combine both
     streams into one, set 'stdout' to *note PIPE: d80. and 'stderr' to
     *note STDOUT: 372d, instead of using 'capture_output'.

     A 'timeout' may be specified in seconds, it is internally passed on
     to *note Popen.communicate(): 17aa.  If the timeout expires, the
     child process will be killed and waited for.  The *note
     TimeoutExpired: 17ab. exception will be re-raised after the child
     process has terminated.  The initial process creation itself cannot
     be interrupted on many platform APIs so you are not guaranteed to
     see a timeout exception until at least after however long process
     creation takes.

     The 'input' argument is passed to *note Popen.communicate(): 17aa.
     and thus to the subprocess's stdin.  If used it must be a byte
     sequence, or a string if 'encoding' or 'errors' is specified or
     'text' is true.  When used, the internal *note Popen: 4b7. object
     is automatically created with 'stdin' set to *note PIPE: d80, and
     the 'stdin' argument may not be used as well.

     'check' に真を指定した場合、プロセスが非ゼロの終了コードで終了する
     と *note CalledProcessError: 153c. 例外が送出されます。 この例外の
     属性には、引数、終了コード、標準出力および標準エラー出力が捕捉でき
     た場合に格納されます。

     'encoding' または 'errors' 引数が指定されるか、'text' 引数が true で
     ある場合、stdin, stdout および stderr のためのファイルオブジェクト
     はテキストモードでオープンされます。 その際には指定された
     'encoding' および 'errors' が使われるか、デフォルトの *note
     io.TextIOWrapper: 9be. になります。'universal_newlines' 引数は
     'text' 引数と等価であり、後方互換性のために提供されています。そうで
     ない場合、デフォルトでこれらのファイルオブジェクトはバイナリモード
     でオープンされます。

     'env' が ‘None’ 以外の場合、これは新しいプロセスでの環境変数を定義
     します。デフォルトでは、子プロセスは現在のプロセスの環境変数を引き
     継ぎます。 *note Popen: 4b7. に直接渡されます。あらゆるプラットフォ
     ームで *note os.environ: 259. のように文字列から文字列へ、またPOSIX
     プラットフォームにおいては *note os.environb: 25a. のようにバイトか
     らバイトへも、定義すること出来ます。

     例:

          >>> subprocess.run(["ls", "-l"])  # doesn't capture output
          CompletedProcess(args=['ls', '-l'], returncode=0)

          >>> subprocess.run("exit 1", shell=True, check=True)
          Traceback (most recent call last):
            ...
          subprocess.CalledProcessError: Command 'exit 1' returned non-zero exit status 1

          >>> subprocess.run(["ls", "-l", "/dev/null"], capture_output=True)
          CompletedProcess(args=['ls', '-l', '/dev/null'], returncode=0,
          stdout=b'crw-rw-rw- 1 root root 1, 3 Jan 23 16:23 /dev/null\n', stderr=b'')

     Added in version 3.5.

     バージョン 3.6 で変更: 'encoding' と 'error' が引数に追加されました
     。

     バージョン 3.7 で変更: 'universal_newlines' 引数のよりわかりやすい
     名前として、'text' 引数が追加されました。'capture_output' 引数が追
     加されました。

     バージョン 3.12 で変更: ‘shell=True’ のときのWindowsシェル検索順序
     を変更しました。カレントディレクトリと ‘%PATH%’ は、 ‘%COMSPEC%’ と
     ‘%SystemRoot%\System32\cmd.exe’ に置き換えられました。これにより、
     ‘cmd.exe’ という名前の悪意のあるプログラムをカレントディレクトリに
     ドロップしても、動作しなくなりました。

 -- クラス: subprocess.CompletedProcess

     *note run(): d7f. の戻り値。プロセスが終了したことを表します。

      -- の属性: args

          プロセスを起動するときに使用された引数。1 個のリストか 1 個の
          文字列になります。

      -- の属性: returncode

          子プロセスの終了コード。一般に、終了ステータス 0 はプロセスが
          正常に終了したことを示します。

          負の値 ‘-N’ は子プロセスがシグナル ‘N’ により中止させられたこ
          とを示します (POSIX のみ)。

      -- の属性: stdout

          子プロセスから補足された標準出力です。バイト列、もしくは *note
          run(): d7f. でエンコーディングが指定された場合、エラーの場合、
          text=True が指定された場合は文字列です。標準出力が補足できなか
          ったら ‘None’ になります。

          プロセスが ‘stderr=subprocess.STDOUT’ で実行された場合、標準出
          力と標準エラー出力が混合されたものがこの属性に格納され、*note
          stderr: 3731. は ‘None’ になります。

      -- の属性: stderr

          子プロセスから補足された標準エラー出力です。バイト列、もしくは
          *note run(): d7f. でエンコーディングが指定された場合、エラーの
          場合、text=True が指定された場合は文字列です。標準エラー出力が
          補足できなかったら ‘None’ になります。

      -- メソッド: check_returncode ()

          *note returncode: 372f. が非ゼロの場合、*note
          CalledProcessError: 153c. が送出されます。

     Added in version 3.5.

 -- データ: subprocess.DEVNULL

     *note Popen: 4b7. の 'stdin', 'stdout', 'stderr' 引数に渡して、標準
     入出力を *note os.devnull: 1e14. から入出力するように指定するための
     特殊値です。

     Added in version 3.3.

 -- データ: subprocess.PIPE

     *note Popen: 4b7. の 'stdin', 'stdout', 'stderr' 引数に渡して、標準
     ストリームに対するパイプを開くことを指定するための特殊値です。*note
     Popen.communicate(): 17aa. に非常に有用です。

 -- データ: subprocess.STDOUT

     *note Popen: 4b7. の 'stderr' 引数に渡して、標準エラー出力が標準出
     力と同じハンドルに出力されるように指定するための特殊値です。

 -- 例外: subprocess.SubprocessError

     このモジュールの他のすべての例外のための基底クラスです。

     Added in version 3.3.

 -- 例外: subprocess.TimeoutExpired

     *note SubprocessError: 3733. のサブクラスです。子プロセスの終了を待
     機している間にタイムアウトが発生した場合に送出されます。

      -- の属性: cmd

          子プロセスの生成に使用されるコマンド本文。

      -- の属性: timeout

          タイムアウト秒数。

      -- の属性: output

          *note run(): d7f. にまたは *note check_output(): 11c4. によっ
          て捕捉された場合は、子プロセスの出力となり、それ以外の場合は
          ‘None’ となります。‘text=True’ の設定に関係なく、出力が捕捉さ
          れた場合は常に *note bytes: 192. となります。出力がない場合は
          ‘b''’ の代わりに''None'' のままになることがあります。

      -- の属性: stdout

          output の別名。*note stderr: 3738. と対になります。

      -- の属性: stderr

          *note run(): d7f. によって捕捉された場合、子プロセスの標準エラ
          ー出力が表示され、それ以外の場合は ‘None’ となります。
          ‘text=True’ の設定に関係なく、標準エラー出力を捕捉した場合は常
          に *note bytes: 192. となります。標準エラー出力がない場合は、
          ‘b''’ の代わりに ‘None’ のままになることがあります。

     Added in version 3.3.

     バージョン 3.5 で変更: 属性 'stdout' および 'stderr' が追加されまし
     た。

 -- 例外: subprocess.CalledProcessError

     *note SubprocessError: 3733. のサブクラスです。*note check_call():
     3739. または *note check_output(): 11c4. 、 ‘check=True’ であるとき
     の *note run(): d7f. 、によって実行されたプロセスが非ゼロの終了ステ
     ータスを返した場合に送出されます。

      -- の属性: returncode

          子プロセスの終了ステータスです。もしプロセスがシグナルによって
          終了したなら、これは負のシグナル番号になります。

      -- の属性: cmd

          子プロセスの生成に使用されるコマンド本文。

      -- の属性: output

          *note run(): d7f. または *note check_output(): 11c4. によって
          捕捉された子プロセスの出力。捕捉されなかったら ‘None’ になりま
          す。

      -- の属性: stdout

          output の別名。*note stderr: 373e. と対になります。

      -- の属性: stderr

          *note run(): d7f. によって捕捉された子プロセスの標準エラー出力
          。捕捉されなかったら ‘None’ になります。

     バージョン 3.5 で変更: 属性 'stdout' および 'stderr' が追加されまし
     た。

* Menu:

* よく使われる引数::
* Popen コンストラクター::
* 例外: 例外<14>.


File: python.info,  Node: よく使われる引数,  Next: Popen コンストラクター,  Up: Using the subprocess Module

5.18.7.2 よく使われる引数
.........................

幅広い使用例をサポートするために、*note Popen: 4b7. コンストラクター (と
その他の簡易関数) は、多くのオプション引数を受け付けます。一般的な用法に
ついては、これらの引数の多くはデフォルト値のままで問題ありません。通常必
要とされる引数は以下の通りです:

     'args' はすべての呼び出しに必要で、文字列あるいはプログラム引数のシ
     ーケンスでなければなりません。一般に、引数のシーケンスを渡す方が望
     ましいです。なぜなら、モジュールが必要な引数のエスケープやクオート
     (例えばファイル名中のスペースを許すこと) の面倒を見ることができるた
     めです。単一の文字列を渡す場合、'shell' は *note True: e07. でなけ
     ればなりません (以下を参照)。もしくは、その文字列は引数を指定せずに
     実行される単なるプログラムの名前でなければなりません。

     'stdin', 'stdout' and 'stderr' specify the executed program's
     standard input, standard output and standard error file handles,
     respectively.  Valid values are ‘None’, *note PIPE: d80, *note
     DEVNULL: 1366, an existing file descriptor (a positive integer),
     and an existing *note file object: 13db. with a valid file
     descriptor.  With the default settings of ‘None’, no redirection
     will occur.  *note PIPE: d80. indicates that a new pipe to the
     child should be created.  *note DEVNULL: 1366. indicates that the
     special file *note os.devnull: 1e14. will be used.  Additionally,
     'stderr' can be *note STDOUT: 372d, which indicates that the stderr
     data from the child process should be captured into the same file
     handle as for 'stdout'.

     If 'encoding' or 'errors' are specified, or 'text' (also known as
     'universal_newlines') is true, the file objects 'stdin', 'stdout'
     and 'stderr' will be opened in text mode using the 'encoding' and
     'errors' specified in the call or the defaults for *note
     io.TextIOWrapper: 9be.

     'stdin' については、入力での行末文字 ‘'\n'’ はデフォルトの行セパレ
     ーター *note os.linesep: 25dc. に変換されます。'stdout' と 'stderr'
     については、出力での行末はすべて ‘'\n'’ に変換されます。詳細は
     *note io.TextIOWrapper: 9be. クラスのドキュメントでコンストラクター
     の引数 'newline' が ‘None’ である場合を参照してください。

     If text mode is not used, 'stdin', 'stdout' and 'stderr' will be
     opened as binary streams.  No encoding or line ending conversion is
     performed.

     バージョン 3.6 で変更: 'encoding' と 'errors' が引数に追加されまし
     た。

     バージョン 3.7 で変更: 'universal_newlines' の別名として、'text' 引
     数が追加されました。

          注釈: ファイルオブジェクト *note Popen.stdin: 3740.、*note
          Popen.stdout: 3741. ならびに *note Popen.stderr: 3742. の改行
          属性は *note Popen.communicate(): 17aa. メソッドで更新されませ
          ん。

     'shell' が ‘True’ なら、指定されたコマンドはシェルによって実行され
     ます。あなたが Python を主として (ほとんどのシステムシェル以上の) 強
     化された制御フローのために使用していて、さらにシェルパイプ、ファイ
     ル名ワイルドカード、環境変数展開、‘~’ のユーザーホームディレクトリ
     への展開のような他のシェル機能への簡単なアクセスを望むなら、これは
     有用かもしれません。しかしながら、Python 自身が多くのシェル的な機能
     の実装を提供していることに注意してください (特に *note glob: 68,
     *note fnmatch: 60, *note os.walk(): 6d0, *note
     os.path.expandvars(): 15f2, *note os.path.expanduser(): c09, *note
     shutil: ca.)。

     バージョン 3.3 で変更: 'universal_newlines' が ‘True’ の場合、クラ
     スはエンコーディング ‘locale.getpreferredencoding()’ の代わりに
     *note locale.getpreferredencoding(False): 75c. を使用します。この変
     更についての詳細は、 *note io.TextIOWrapper: 9be. クラスを参照して
     ください。

          注釈: ‘shell=True’ を使う前に *note
          セキュリティで考慮すべき点: 3743. を読んでください。

これらのオプションは、他のすべてのオプションとともに *note Popen: 4b7. コ
ンストラクターのドキュメントの中でより詳細に説明されています。


File: python.info,  Node: Popen コンストラクター,  Next: 例外<14>,  Prev: よく使われる引数,  Up: Using the subprocess Module

5.18.7.3 Popen コンストラクター
...............................

このモジュールの中で、根底のプロセス生成と管理は *note Popen: 4b7. クラ
スによって扱われます。簡易関数によってカバーされないあまり一般的でないケ
ースを開発者が扱えるように、*note Popen: 4b7. クラスは多くの柔軟性を提供
しています。

 -- クラス: subprocess.Popen (args, bufsize=-1, executable=None,
          stdin=None, stdout=None, stderr=None, preexec_fn=None,
          close_fds=True, shell=False, cwd=None, env=None,
          universal_newlines=None, startupinfo=None, creationflags=0,
          restore_signals=True, start_new_session=False, pass_fds=(), *,
          group=None, extra_groups=None, user=None, umask=-1,
          encoding=None, errors=None, text=None, pipesize=-1,
          process_group=None)

     新しいプロセスで子のプログラムを実行します。POSIX においては、子の
     プログラムを実行するために、このクラスは *note os.execvpe(): 30ba.
     のような挙動を使用します。Windows においては、このクラスは Windows
     の ‘CreateProcess()’ 関数を使用します。*note Popen: 4b7. への引数は
     以下の通りです。

     'args' はプログラム引数のシーケンスか、単一の文字列または *note
     path-like object: 5a1. でなければなりません。デフォルトでは、'args'
     がシーケンスの場合に実行されるプログラムは 'args' の最初の要素です
     。'args' が文字列の場合、解釈はプラットフォーム依存であり、下記に説
     明されます。デフォルトの挙動からの追加の違いについては 'shell' およ
     び 'executable' 引数を参照してください。特に明記されない限り、
     'args' をシーケンスとして渡すことが推奨されます。

          警告: For maximum reliability, use a fully qualified path for
          the executable.  To search for an unqualified name on ‘PATH’,
          use *note shutil.which(): 6db.  On all platforms, passing
          *note sys.executable: 3ed. is the recommended way to launch
          the current Python interpreter again, and use the ‘-m’
          command-line format to launch an installed module.

          Resolving the path of 'executable' (or the first item of
          'args') is platform dependent.  For POSIX, see *note
          os.execvpe(): 30ba, and note that when resolving or searching
          for the executable path, 'cwd' overrides the current working
          directory and 'env' can override the ‘PATH’ environment
          variable.  For Windows, see the documentation of the
          ‘lpApplicationName’ and ‘lpCommandLine’ parameters of WinAPI
          ‘CreateProcess’, and note that when resolving or searching for
          the executable path with ‘shell=False’, 'cwd' does not
          override the current working directory and 'env' cannot
          override the ‘PATH’ environment variable.  Using a full path
          avoids all of these variations.

     An example of passing some arguments to an external program as a
     sequence is:

          Popen(["/usr/bin/git", "commit", "-m", "Fixes a bug."])

     POSIX 上では、'args' が文字列の場合、その文字列は実行すべきプログラ
     ムの名前またはパスとして解釈されます。しかし、これはプログラムに引
     数を渡さない場合にのみ可能です。

          注釈: It may not be obvious how to break a shell command into
          a sequence of arguments, especially in complex cases.  *note
          shlex.split(): 75e. can illustrate how to determine the
          correct tokenization for 'args':

               >>> import shlex, subprocess
               >>> command_line = input()
               /bin/vikings -input eggs.txt -output "spam spam.txt" -cmd "echo '$MONEY'"
               >>> args = shlex.split(command_line)
               >>> print(args)
               ['/bin/vikings', '-input', 'eggs.txt', '-output', 'spam spam.txt', '-cmd', "echo '$MONEY'"]
               >>> p = subprocess.Popen(args) # Success!

          特に注意すべき点は、シェル内でスペースで区切られたオプション
          ('-input' など) と引数 ('eggs.txt' など) はリストの別々の要素
          になるのに対し、シェル内で (上記のスペースを含むファイル名や
          'echo' コマンドのように) クォーティングやバックスラッシュエス
          ケープが必要なものは単一のリスト要素であることです。

     Windows 上では、'args' がシーケンスなら *note Windows
     における引数シーケンスから文字列への変換: 3745. に記述された方法で
     文字列に変換されます。これは根底の ‘CreateProcess()’ が文字列上で動
     作するからです。

     バージョン 3.6 で変更: 'args' parameter accepts a *note path-like
     object: 5a1. if 'shell' is ‘False’ and a sequence containing
     path-like objects on POSIX.

     バージョン 3.8 で変更: 'args' parameter accepts a *note path-like
     object: 5a1. if 'shell' is ‘False’ and a sequence containing bytes
     and path-like objects on Windows.

     'shell' 引数 (デフォルトでは ‘False’) は、実行するプログラムとして
     シェルを使用するかどうかを指定します。 'shell' が ‘True’ の場合、
     'args' をシーケンスとしてではなく文字列として渡すことが推奨されます
     。

     POSIX で ‘shell=True’ の場合、シェルのデフォルトは ‘/bin/sh’ になり
     ます。'args' が文字列の場合、この文字列はシェルを介して実行されるコ
     マンドを指定します。したがって、文字列は厳密にシェルプロンプトで打
     つ形式と一致しなければなりません。例えば、文字列の中にスペースを含
     むファイル名がある場合は、クォーティングやバックスラッシュエスケー
     プが必要です。'args' がシーケンスの場合には、最初の要素はコマンド名
     を表わす文字列として、残りの要素は追加の引数としてシェルに渡されま
     す。つまり、以下の *note Popen: 4b7. と等価ということです:

          Popen(['/bin/sh', '-c', args[0], args[1], ...])

     Windows で ‘shell=True’ とすると、 ‘COMSPEC’ 環境変数がデフォルトシ
     ェルを指定します。Windows で ‘shell=True’ を指定する必要があるのは
     、実行したいコマンドがシェルに組み込みの場合だけです (例えば ‘dir’
     や ‘copy’)。バッチファイルやコンソールベースの実行ファイルを実行す
     るために ‘shell=True’ は必要ありません。

          注釈: ‘shell=True’ を使う前に *note
          セキュリティで考慮すべき点: 3743. を読んでください。

     'bufsize' は標準入力/標準出力/標準エラー出力パイプファイルオブジェ
     クトを生成するときに *note open(): 316. 関数の対応する引数に渡され
     ます:

        - ‘0’ means unbuffered (read and write are one system call and
          can return short)

        - ‘1’ means line buffered (only usable if ‘text=True’ or
          ‘universal_newlines=True’)

        - それ以外の正の整数はバッファーのおよそのサイズになることを意味
          します。

        - 負のサイズ (デフォルト) は io.DEFAULT_BUFFER_SIZE のシステムデ
          フォルトが使用されることを意味します。

     バージョン 3.3.1 で変更: 'bufsize' now defaults to -1 to enable
     buffering by default to match the behavior that most code expects.
     In versions prior to Python 3.2.4 and 3.3.1 it incorrectly
     defaulted to ‘0’ which was unbuffered and allowed short reads.
     This was unintentional and did not match the behavior of Python 2
     as most code expected.

     'executable' 引数は、実行する置換プログラムを指定します。これが必要
     になるのは極めて稀です。‘shell=False’ のときは、'executable' は
     'args' で指定されている実行プログラムを置換します。しかし、オリジナ
     ルの 'args' は依然としてプログラムに渡されます。ほとんどのプログラ
     ムは、'args' で指定されたプログラムをコマンド名として扱います。そし
     て、それは実際に実行されたプログラムとは異なる可能性があります。
     POSIX において、‘ps’ のようなユーティリティの中では、'args' 名が実
     行ファイルの表示名になります。‘shell=True’ の場合、POSIX において
     'executable' 引数はデフォルトの ‘/bin/sh’ に対する置換シェルを指定
     します。

     バージョン 3.6 で変更: 'executable' 引数が POSIX で *note path-like
     object: 5a1. を受け付けるようになりました。

     バージョン 3.8 で変更: 'executable' 引数が Windows で *note
     path-like object: 5a1. を受け付けるようになりました。

     バージョン 3.12 で変更: ‘shell=True’ のときのWindowsシェル検索順序
     を変更しました。カレントディレクトリと ‘%PATH%’ は、 ‘%COMSPEC%’ と
     ‘%SystemRoot%\System32\cmd.exe’ に置き換えられました。これにより、
     ‘cmd.exe’ という名前の悪意のあるプログラムをカレントディレクトリに
     ドロップしても、動作しなくなりました。

     'stdin', 'stdout' and 'stderr' specify the executed program's
     standard input, standard output and standard error file handles,
     respectively.  Valid values are ‘None’, *note PIPE: d80, *note
     DEVNULL: 1366, an existing file descriptor (a positive integer),
     and an existing *note file object: 13db. with a valid file
     descriptor.  With the default settings of ‘None’, no redirection
     will occur.  *note PIPE: d80. indicates that a new pipe to the
     child should be created.  *note DEVNULL: 1366. indicates that the
     special file *note os.devnull: 1e14. will be used.  Additionally,
     'stderr' can be *note STDOUT: 372d, which indicates that the stderr
     data from the applications should be captured into the same file
     handle as for 'stdout'.

     'preexec_fn' に呼び出し可能オブジェクトが指定されている場合、このオ
     ブジェクトは子プロセスが実行される直前 (fork されたあと、exec され
     る直前) に子プロセス内で呼ばれます。(POSIXのみ)

          警告: アプリケーション中に複数のスレッドが存在する状態で
          'preexec_fn' 引数を使用するのは**安全ではありません**。exec が
          呼ばれる前に子プロセスがデッドロックを起こすことがあります。

          注釈: If you need to modify the environment for the child use
          the 'env' parameter rather than doing it in a 'preexec_fn'.
          The 'start_new_session' and 'process_group' parameters should
          take the place of code using 'preexec_fn' to call *note
          os.setsid(): 1dba. or *note os.setpgid(): 301f. in the child.

     バージョン 3.8 で変更: The 'preexec_fn' parameter is no longer
     supported in subinterpreters.  The use of the parameter in a
     subinterpreter raises *note RuntimeError: 244.  The new restriction
     may affect applications that are deployed in mod_wsgi, uWSGI, and
     other embedded environments.

     If 'close_fds' is true, all file descriptors except ‘0’, ‘1’ and
     ‘2’ will be closed before the child process is executed.  Otherwise
     when 'close_fds' is false, file descriptors obey their inheritable
     flag as described in *note ファイル記述子の継承: 10fc.

     On Windows, if 'close_fds' is true then no handles will be
     inherited by the child process unless explicitly passed in the
     ‘handle_list’ element of *note STARTUPINFO.lpAttributeList: e08, or
     by standard handle redirection.

     バージョン 3.2 で変更: 'close_fds' のデフォルトは、*note False:
     d2b. から上記のものに変更されました。

     バージョン 3.7 で変更: On Windows the default for 'close_fds' was
     changed from *note False: d2b. to *note True: e07. when redirecting
     the standard handles.  It's now possible to set 'close_fds' to
     *note True: e07. when redirecting the standard handles.

     'pass_fds' はオプションで、親と子の間で開いたままにしておくファイル
     記述子のシーケンスを指定します。何らかの 'pass_fds' を渡した場合、
     'close_fds' は強制的に *note True: e07. になります。(POSIXのみ)

     バージョン 3.2 で変更: 'pass_fds' 引数が追加されました。

     If 'cwd' is not ‘None’, the function changes the working directory
     to 'cwd' before executing the child.  'cwd' can be a string, bytes
     or *note path-like: 5a1. object.  On POSIX, the function looks for
     'executable' (or for the first item in 'args') relative to 'cwd' if
     the executable path is a relative path.

     バージョン 3.6 で変更: 'cwd' 引数が POSIX で *note path-like
     object: 5a1. を受け付けるようになりました。

     バージョン 3.7 で変更: 'cwd' 引数が Windows で *note path-like
     object: 5a1. を受け付けるようになりました。

     バージョン 3.8 で変更: 'cwd' 引数が Windows で bytes オブジェクトを
     受け付けるようになりました。

     'restore_signals' が真の場合 (デフォルト)、Python が SIG_IGN に設定
     したすべてのシグナルは子プロセスが exec される前に子プロセスの
     SIG_DFL に格納されます。現在これには SIGPIPE, SIGXFZ および SIGXFSZ
     シグナルが含まれています。(POSIX のみ)

     バージョン 3.2 で変更: 'restore_signals' が追加されました。

     If 'start_new_session' is true the ‘setsid()’ system call will be
     made in the child process prior to the execution of the subprocess.

     *note Availability: 213f.: POSIX

     バージョン 3.2 で変更: 'start_new_session' が追加されました。

     If 'process_group' is a non-negative integer, the ‘setpgid(0,
     value)’ system call will be made in the child process prior to the
     execution of the subprocess.

     *note Availability: 213f.: POSIX

     バージョン 3.11 で変更: 'process_group' was added.

     If 'group' is not ‘None’, the setregid() system call will be made
     in the child process prior to the execution of the subprocess.  If
     the provided value is a string, it will be looked up via *note
     grp.getgrnam(): 3746. and the value in ‘gr_gid’ will be used.  If
     the value is an integer, it will be passed verbatim.  (POSIX only)

     *note Availability: 213f.: POSIX

     Added in version 3.9.

     If 'extra_groups' is not ‘None’, the setgroups() system call will
     be made in the child process prior to the execution of the
     subprocess.  Strings provided in 'extra_groups' will be looked up
     via *note grp.getgrnam(): 3746. and the values in ‘gr_gid’ will be
     used.  Integer values will be passed verbatim.  (POSIX only)

     *note Availability: 213f.: POSIX

     Added in version 3.9.

     If 'user' is not ‘None’, the setreuid() system call will be made in
     the child process prior to the execution of the subprocess.  If the
     provided value is a string, it will be looked up via *note
     pwd.getpwnam(): 3747. and the value in ‘pw_uid’ will be used.  If
     the value is an integer, it will be passed verbatim.  (POSIX only)

     *note Availability: 213f.: POSIX

     Added in version 3.9.

     If 'umask' is not negative, the umask() system call will be made in
     the child process prior to the execution of the subprocess.

     *note Availability: 213f.: POSIX

     Added in version 3.9.

     'env' が ‘None’ 以外の場合、これは新しいプロセスでの環境変数を定義
     します。デフォルトでは、子プロセスは現在のプロセスの環境変数を引き
     継ぎます。あらゆるプラットフォームで *note os.environ: 259. のよう
     に文字列から文字列へ、またPOSIX プラットフォームにおいては *note
     os.environb: 25a. のようにバイトからバイトへも、定義すること出来ま
     す。

          注釈: If specified, 'env' must provide any variables required
          for the program to execute.  On Windows, in order to run a
          side-by-side assembly(1) the specified 'env' 'must' include a
          valid ‘%SystemRoot%’.

     If 'encoding' or 'errors' are specified, or 'text' is true, the
     file objects 'stdin', 'stdout' and 'stderr' are opened in text mode
     with the specified 'encoding' and 'errors', as described above in
     *note よく使われる引数: 372c.  The 'universal_newlines' argument is
     equivalent to 'text' and is provided for backwards compatibility.
     By default, file objects are opened in binary mode.

     Added in version 3.6: 'encoding' と 'errors' が追加されました。

     Added in version 3.7: 'text' が、'universal_newlines' のより読みや
     すい別名として追加されました。

     If given, 'startupinfo' will be a *note STARTUPINFO: 3748. object,
     which is passed to the underlying ‘CreateProcess’ function.

     If given, 'creationflags', can be one or more of the following
     flags:

        * *note CREATE_NEW_CONSOLE: 3749.

        * *note CREATE_NEW_PROCESS_GROUP: 374a.

        * *note ABOVE_NORMAL_PRIORITY_CLASS: 374b.

        * *note BELOW_NORMAL_PRIORITY_CLASS: 374c.

        * *note HIGH_PRIORITY_CLASS: 374d.

        * *note IDLE_PRIORITY_CLASS: 374e.

        * *note NORMAL_PRIORITY_CLASS: 374f.

        * *note REALTIME_PRIORITY_CLASS: 3750.

        * *note CREATE_NO_WINDOW: 3751.

        * *note DETACHED_PROCESS: 3752.

        * *note CREATE_DEFAULT_ERROR_MODE: 3753.

        * *note CREATE_BREAKAWAY_FROM_JOB: 3754.

     'pipesize' can be used to change the size of the pipe when *note
     PIPE: d80. is used for 'stdin', 'stdout' or 'stderr'.  The size of
     the pipe is only changed on platforms that support this (only Linux
     at this time of writing).  Other platforms will ignore this
     parameter.

     バージョン 3.10 で変更: Added the 'pipesize' parameter.

     Popen オブジェクトは *note with: 186. 文によってコンテキストマネー
     ジャーとしてサポートされます: 終了時には標準ファイル記述子が閉じら
     れ、プロセスを待機します:

          with Popen(["ifconfig"], stdout=PIPE) as proc:
              log.write(proc.stdout.read())

     Popen and the other functions in this module that use it raise an
     *note auditing event: 1c6e. ‘subprocess.Popen’ with arguments
     ‘executable’, ‘args’, ‘cwd’, and ‘env’.  The value for ‘args’ may
     be a single string or a list of strings, depending on platform.

     バージョン 3.2 で変更: コンテキストマネージャーサポートが追加されま
     した。

     バージョン 3.6 で変更: Popen destructor now emits a *note
     ResourceWarning: 54c. warning if the child process is still
     running.

     バージョン 3.8 で変更: Popen can use *note os.posix_spawn(): 52e.
     in some cases for better performance.  On Windows Subsystem for
     Linux and QEMU User Emulation, Popen constructor using *note
     os.posix_spawn(): 52e. no longer raise an exception on errors like
     missing program, but the child process fails with a non-zero *note
     returncode: c83.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Side-by-Side_Assembly


File: python.info,  Node: 例外<14>,  Prev: Popen コンストラクター,  Up: Using the subprocess Module

5.18.7.4 例外
.............

Exceptions raised in the child process, before the new program has
started to execute, will be re-raised in the parent.

The most common exception raised is *note OSError: 2c0.  This occurs,
for example, when trying to execute a non-existent file.  Applications
should prepare for *note OSError: 2c0. exceptions.  Note that, when
‘shell=True’, *note OSError: 2c0. will be raised by the child only if
the selected shell itself was not found.  To determine if the shell
failed to find the requested application, it is necessary to check the
return code or output from the subprocess.

不正な引数で *note Popen: 4b7. が呼ばれた場合は *note ValueError: 2ec. が
発生します。

呼び出されたプロセスが非ゼロのリターンコードを返した場合 *note
check_call(): 3739. や *note check_output(): 11c4. は *note
CalledProcessError: 153c. を送出します。

All of the functions and methods that accept a 'timeout' parameter, such
as *note run(): d7f. and *note Popen.communicate(): 17aa. will raise
*note TimeoutExpired: 17ab. if the timeout expires before the process
exits.

このモジュールで定義されたすべての例外は *note SubprocessError: 3733. を
継承しています。

Added in version 3.3: *note SubprocessError: 3733. 基底クラスが追加され
ました。


File: python.info,  Node: セキュリティで考慮すべき点<2>,  Next: Popen オブジェクト,  Prev: Using the subprocess Module,  Up: subprocess --- サブプロセス管理

5.18.7.5 セキュリティで考慮すべき点
...................................

Unlike some other popen functions, this library will not implicitly
choose to call a system shell.  This means that all characters,
including shell metacharacters, can safely be passed to child processes.
If the shell is invoked explicitly, via ‘shell=True’, it is the
application's responsibility to ensure that all whitespace and
metacharacters are quoted appropriately to avoid shell injection(1)
vulnerabilities.  On *note some platforms: 3757, it is possible to use
*note shlex.quote(): 582. for this escaping.

On Windows, batch files (‘*.bat’ or ‘*.cmd’) may be launched by the
operating system in a system shell regardless of the arguments passed to
this library.  This could result in arguments being parsed according to
shell rules, but without any escaping added by Python.  If you are
intentionally launching a batch file with arguments from untrusted
sources, consider passing ‘shell=True’ to allow Python to escape special
characters.  See gh-114539(2) for additional discussion.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Shell_injection#Shell_injection

   (2) https://github.com/python/cpython/issues/114539


File: python.info,  Node: Popen オブジェクト,  Next: Windows Popen ヘルパー,  Prev: セキュリティで考慮すべき点<2>,  Up: subprocess --- サブプロセス管理

5.18.7.6 Popen オブジェクト
...........................

*note Popen: 4b7. クラスのインスタンスには、以下のようなメソッドがありま
す:

 -- メソッド: Popen.poll ()

     子プロセスが終了しているかどうかを調べます。 *note returncode: c83.
     属性を設定して返します。そうでなければ ‘None’ を返します。

 -- メソッド: Popen.wait (timeout=None)

     子プロセスが終了するまで待ちます。*note returncode: c83. 属性を設定
     して返します。

     プロセスが 'timeout' 秒後に終了してない場合、*note TimeoutExpired:
     17ab. 例外を送出します。この例外を捕捉して wait を再試行するのは安
     全です。

          注釈: ‘stdout=PIPE’ や ‘stderr=PIPE’ を使っていて、より多くの
          データを受け入れるために OS のパイプバッファーをブロックしてい
          るパイプに子プロセスが十分な出力を生成した場合、デッドロックが
          発生します。これを避けるには *note Popen.communicate(): 17aa.
          を使用してください。

          注釈: When the ‘timeout’ parameter is not ‘None’, then (on
          POSIX) the function is implemented using a busy loop
          (non-blocking call and short sleeps).  Use the *note asyncio:
          b. module for an asynchronous wait: see *note
          asyncio.create_subprocess_exec: c6b.

     バージョン 3.3 で変更: 'timeout' が追加されました

 -- メソッド: Popen.communicate (input=None, timeout=None)

     Interact with process: Send data to stdin.  Read data from stdout
     and stderr, until end-of-file is reached.  Wait for process to
     terminate and set the *note returncode: c83. attribute.  The
     optional 'input' argument should be data to be sent to the child
     process, or ‘None’, if no data should be sent to the child.  If
     streams were opened in text mode, 'input' must be a string.
     Otherwise, it must be bytes.

     *note communicate(): 17aa. returns a tuple ‘(stdout_data,
     stderr_data)’.  The data will be strings if streams were opened in
     text mode; otherwise, bytes.

     子プロセスの標準入力にデータを送りたい場合は、 Popen オブジェクトを
     ‘stdin=PIPE’ と指定して作成しなければなりません。同じく、戻り値のタ
     プルから ‘None’ ではない値を取得するためには、 ‘stdout=PIPE’ かつ
     /または ‘stderr=PIPE’ を指定しなければなりません。

     If the process does not terminate after 'timeout' seconds, a *note
     TimeoutExpired: 17ab. exception will be raised.  Catching this
     exception and retrying communication will not lose any output.
     Supplying 'input' to a subsequent post-timeout *note communicate():
     17aa. call is in undefined behavior and may become an error in the
     future.

     タイムアウトが発生した場合子プロセスは kill されません。したがって
     、適切にクリーンアップを行うために、正常に動作するアプリケーション
     は子プロセスを kill して通信を終了すべきです:

          proc = subprocess.Popen(...)
          try:
              outs, errs = proc.communicate(timeout=15)
          except TimeoutExpired:
              proc.kill()
              outs, errs = proc.communicate()

     After a call to *note communicate(): 17aa. raises *note
     TimeoutExpired: 17ab, do not call *note wait(): ee0.  Use an
     additional *note communicate(): 17aa. call to finish handling pipes
     and populate the *note returncode: c83. attribute.

          注釈: 受信したデータはメモリにバッファーされます。そのため、返
          されるデータが大きいかあるいは制限がないような場合はこのメソッ
          ドを使うべきではありません。

     バージョン 3.3 で変更: 'timeout' が追加されました

 -- メソッド: Popen.send_signal (signal)

     'signal' シグナルを子プロセスに送ります。

     Do nothing if the process completed.

          注釈: Windows では、SIGTERM は *note terminate(): 15f5. の別名
          です。CTRL_C_EVENT と CTRL_BREAK_EVENT を、
          ‘CREATE_NEW_PROCESS_GROUP’ を含む 'creationflags' で始まった、
          プロセスに送れます。

 -- メソッド: Popen.terminate ()

     Stop the child.  On POSIX OSs the method sends *note SIGTERM: 15f8.
     to the child.  On Windows the Win32 API function
     ‘TerminateProcess()’ is called to stop the child.

 -- メソッド: Popen.kill ()

     子プロセスを kill します。POSIX OS では SIGKILL シグナルを子プロセ
     スに送ります。Windows では、*note kill(): 15f6. は *note
     terminate(): 15f5. の別名です。

The following attributes are also set by the class for you to access.
Reassigning them to new values is unsupported:

 -- の属性: Popen.args

     *note Popen: 4b7. に渡された引数 'args' です - プログラム引数のシー
     ケンスまたは 1 個の文字列になります。

     Added in version 3.3.

 -- の属性: Popen.stdin

     If the 'stdin' argument was *note PIPE: d80, this attribute is a
     writeable stream object as returned by *note open(): 316.  If the
     'encoding' or 'errors' arguments were specified or the 'text' or
     'universal_newlines' argument was ‘True’, the stream is a text
     stream, otherwise it is a byte stream.  If the 'stdin' argument was
     not *note PIPE: d80, this attribute is ‘None’.

 -- の属性: Popen.stdout

     If the 'stdout' argument was *note PIPE: d80, this attribute is a
     readable stream object as returned by *note open(): 316.  Reading
     from the stream provides output from the child process.  If the
     'encoding' or 'errors' arguments were specified or the 'text' or
     'universal_newlines' argument was ‘True’, the stream is a text
     stream, otherwise it is a byte stream.  If the 'stdout' argument
     was not *note PIPE: d80, this attribute is ‘None’.

 -- の属性: Popen.stderr

     If the 'stderr' argument was *note PIPE: d80, this attribute is a
     readable stream object as returned by *note open(): 316.  Reading
     from the stream provides error output from the child process.  If
     the 'encoding' or 'errors' arguments were specified or the 'text'
     or 'universal_newlines' argument was ‘True’, the stream is a text
     stream, otherwise it is a byte stream.  If the 'stderr' argument
     was not *note PIPE: d80, this attribute is ‘None’.

     警告: *note .stdin.write: 3740, *note .stdout.read: 3741, *note
     .stderr.read: 3742. を利用すると、別のパイプの OS パイプバッファー
     がいっぱいになってデッドロックが発生する恐れがあります。これを避け
     るためには *note communicate(): 17aa. を利用してください。

 -- の属性: Popen.pid

     子プロセスのプロセス ID が入ります。

     'shell' 引数を ‘True’ に設定した場合は、生成されたシェルのプロセス
     ID になります。

 -- の属性: Popen.returncode

     The child return code.  Initially ‘None’, *note returncode: c83. is
     set by a call to the *note poll(): 3759, *note wait(): ee0, or
     *note communicate(): 17aa. methods if they detect that the process
     has terminated.

     A ‘None’ value indicates that the process hadn't yet terminated at
     the time of the last method call.

     負の値 ‘-N’ は子プロセスがシグナル ‘N’ により中止させられたことを示
     します (POSIX のみ)。


File: python.info,  Node: Windows Popen ヘルパー,  Next: 古い高水準 API,  Prev: Popen オブジェクト,  Up: subprocess --- サブプロセス管理

5.18.7.7 Windows Popen ヘルパー
...............................

*note STARTUPINFO: 3748. クラスと以下の定数は、Windows のみで利用できま
す。

 -- クラス: subprocess.STARTUPINFO (*, dwFlags=0, hStdInput=None,
          hStdOutput=None, hStdError=None, wShowWindow=0,
          lpAttributeList=None)

     Partial support of the Windows STARTUPINFO(1) structure is used for
     *note Popen: 4b7. creation.  The following attributes can be set by
     passing them as keyword-only arguments.

     バージョン 3.7 で変更: キーワード専用引数のサポートが追加されました
     。

      -- の属性: dwFlags

          特定の *note STARTUPINFO: 3748. の属性が、プロセスがウィンドウ
          を生成するときに使われるかを決定するビットフィールドです:

               si = subprocess.STARTUPINFO()
               si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess.STARTF_USESHOWWINDOW

      -- の属性: hStdInput

          *note dwFlags: 375d. が *note STARTF_USESTDHANDLES: 375f. を指
          定すれば、この属性がプロセスの標準入力処理です。*note
          STARTF_USESTDHANDLES: 375f. が指定されなければ、標準入力のデフ
          ォルトはキーボードバッファーです。

      -- の属性: hStdOutput

          *note dwFlags: 375d. が *note STARTF_USESTDHANDLES: 375f. を指
          定すれば、この属性がプロセスの標準出力処理です。そうでなければ
          、この属性は無視され、標準出力のデフォルトはコンソールウィンド
          ウのバッファーです。

      -- の属性: hStdError

          *note dwFlags: 375d. が *note STARTF_USESTDHANDLES: 375f. を指
          定すれば、この属性がプロセスの標準エラー処理です。そうでなけれ
          ば、この属性は無視され、標準エラー出力のデフォルトはコンソール
          ウィンドウのバッファーです。

      -- の属性: wShowWindow

          *note dwFlags: 375d. が *note STARTF_USESHOWWINDOW: 3763. を指
          定すれば、この属性は ShowWindow(2) 関数の ‘nCmdShow’ 引数で指
          定された値なら、 ‘SW_SHOWDEFAULT’ 以外の任意のものにできます。
          しかし、この属性は無視されます。

          この属性には *note SW_HIDE: 3764. が提供されています。これは、
          *note Popen: 4b7. が ‘shell=True’ として呼び出されたときに使わ
          れます。

      -- の属性: lpAttributeList

          A dictionary of additional attributes for process creation as
          given in ‘STARTUPINFOEX’, see UpdateProcThreadAttribute(3).

          Supported attributes:

          'handle_list'

               Sequence of handles that will be inherited.  'close_fds'
               must be true if non-empty.

               The handles must be temporarily made inheritable by *note
               os.set_handle_inheritable(): 1100. when passed to the
               *note Popen: 4b7. constructor, else *note OSError: 2c0.
               will be raised with Windows error
               ‘ERROR_INVALID_PARAMETER’ (87).

                    警告: In a multithreaded process, use caution to
                    avoid leaking handles that are marked inheritable
                    when combining this feature with concurrent calls to
                    other process creation functions that inherit all
                    handles such as *note os.system(): 1676.  This also
                    applies to standard handle redirection, which
                    temporarily creates inheritable handles.

          Added in version 3.7.

* Menu:

* Windows Constants::

   ---------- Footnotes ----------

   (1) https://msdn.microsoft.com/en-us/library/ms686331(v=vs.85).aspx

   (2) https://msdn.microsoft.com/en-us/library/ms633548(v=vs.85).aspx

   (3) 
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686880(v=vs.85).aspx


File: python.info,  Node: Windows Constants,  Up: Windows Popen ヘルパー

5.18.7.8 Windows Constants
..........................

The ‘subprocess’ module exposes the following constants.

 -- データ: subprocess.STD_INPUT_HANDLE

     標準入力デバイスです。この初期値は、コンソール入力バッファ、
     ‘CONIN$’ です。

 -- データ: subprocess.STD_OUTPUT_HANDLE

     標準出力デバイスです。この初期値は、アクティブコンソールスクリーン
     、 ‘CONOUT$’ です。

 -- データ: subprocess.STD_ERROR_HANDLE

     標準エラーデバイスです。この初期値は、アクティブコンソールスクリー
     ン、 ‘CONOUT$’ です。

 -- データ: subprocess.SW_HIDE

     ウィンドウを隠します。別のウィンドウがアクティブになります。

 -- データ: subprocess.STARTF_USESTDHANDLES

     追加情報を保持する、*note STARTUPINFO.hStdInput: 375e, *note
     STARTUPINFO.hStdOutput: 3760, および *note STARTUPINFO.hStdError:
     3761. 属性を指定します。

 -- データ: subprocess.STARTF_USESHOWWINDOW

     追加情報を保持する、 *note STARTUPINFO.wShowWindow: 3762. 属性を指
     定します。

 -- データ: subprocess.STARTF_FORCEONFEEDBACK

     A *note STARTUPINFO.dwFlags: 375d. parameter to specify that the
     'Working in Background' mouse cursor will be displayed while a
     process is launching.  This is the default behavior for GUI
     processes.

     Added in version 3.13.

 -- データ: subprocess.STARTF_FORCEOFFFEEDBACK

     A *note STARTUPINFO.dwFlags: 375d. parameter to specify that the
     mouse cursor will not be changed when launching a process.

     Added in version 3.13.

 -- データ: subprocess.CREATE_NEW_CONSOLE

     新しいプロセスが、親プロセスのコンソールを継承する (デフォルト) の
     ではなく、新しいコンソールを持ちます。

 -- データ: subprocess.CREATE_NEW_PROCESS_GROUP

     新しいプロセスグループが生成されることを指定する *note Popen: 4b7.
     ‘creationflags’ パラメーターです。このフラグは、サブプロセスで
     *note os.kill(): 157f. を使うのに必要です。

     *note CREATE_NEW_CONSOLE: 3749. が指定されていたら、このフラグは無
     視されます。

 -- データ: subprocess.ABOVE_NORMAL_PRIORITY_CLASS

     A *note Popen: 4b7. ‘creationflags’ parameter to specify that a new
     process will have an above average priority.

     Added in version 3.7.

 -- データ: subprocess.BELOW_NORMAL_PRIORITY_CLASS

     A *note Popen: 4b7. ‘creationflags’ parameter to specify that a new
     process will have a below average priority.

     Added in version 3.7.

 -- データ: subprocess.HIGH_PRIORITY_CLASS

     A *note Popen: 4b7. ‘creationflags’ parameter to specify that a new
     process will have a high priority.

     Added in version 3.7.

 -- データ: subprocess.IDLE_PRIORITY_CLASS

     A *note Popen: 4b7. ‘creationflags’ parameter to specify that a new
     process will have an idle (lowest) priority.

     Added in version 3.7.

 -- データ: subprocess.NORMAL_PRIORITY_CLASS

     A *note Popen: 4b7. ‘creationflags’ parameter to specify that a new
     process will have a normal priority.  (default)

     Added in version 3.7.

 -- データ: subprocess.REALTIME_PRIORITY_CLASS

     A *note Popen: 4b7. ‘creationflags’ parameter to specify that a new
     process will have realtime priority.  You should almost never use
     REALTIME_PRIORITY_CLASS, because this interrupts system threads
     that manage mouse input, keyboard input, and background disk
     flushing.  This class can be appropriate for applications that
     "talk" directly to hardware or that perform brief tasks that should
     have limited interruptions.

     Added in version 3.7.

 -- データ: subprocess.CREATE_NO_WINDOW

     A *note Popen: 4b7. ‘creationflags’ parameter to specify that a new
     process will not create a window.

     Added in version 3.7.

 -- データ: subprocess.DETACHED_PROCESS

     A *note Popen: 4b7. ‘creationflags’ parameter to specify that a new
     process will not inherit its parent's console.  This value cannot
     be used with CREATE_NEW_CONSOLE.

     Added in version 3.7.

 -- データ: subprocess.CREATE_DEFAULT_ERROR_MODE

     A *note Popen: 4b7. ‘creationflags’ parameter to specify that a new
     process does not inherit the error mode of the calling process.
     Instead, the new process gets the default error mode.  This feature
     is particularly useful for multithreaded shell applications that
     run with hard errors disabled.

     Added in version 3.7.

 -- データ: subprocess.CREATE_BREAKAWAY_FROM_JOB

     A *note Popen: 4b7. ‘creationflags’ parameter to specify that a new
     process is not associated with the job.

     Added in version 3.7.


File: python.info,  Node: 古い高水準 API,  Next: Replacing Older Functions with the subprocess Module,  Prev: Windows Popen ヘルパー,  Up: subprocess --- サブプロセス管理

5.18.7.9 古い高水準 API
.......................

Python 3.5 より前のバージョンでは、サブプロセスに対して以下の 3 つの関数
からなる高水準 API が用意されていました。現在多くの場合 *note run():
d7f. の使用で済みますが、既存の多くのコードではこれらの関数が使用されて
います。

 -- の関数: subprocess.call (args, *, stdin=None, stdout=None,
          stderr=None, shell=False, cwd=None, timeout=None,
          **other_popen_kwargs)

     'args' で指定されたコマンドを実行します。コマンドの終了を待ち、
     *note returncode: c83. 属性を返します。

     Code needing to capture stdout or stderr should use *note run():
     d7f. instead:

          run(...).returncode

     To suppress stdout or stderr, supply a value of *note DEVNULL:
     1366.

     上記の引数は、よく使われるものだけ示しています。関数の全使用法は
     *note Popen: 4b7. コンストラクターの内容と同じになります - この関数
     は、このインターフェースに直接指定される 'timeout' 以外は与えられた
     全引数を渡します。

          注釈: この関数を使用する際は ‘stdout=PIPE’ および
          ‘stderr=PIPE’ を使用しないでください。子プロセスが OS のパイプ
          バッファーを埋めてしまうほどの出力データを生成した場合、パイプ
          からは読み込まれないので、子プロセスがブロックされることがあり
          ます。

     バージョン 3.3 で変更: 'timeout' が追加されました

     バージョン 3.12 で変更: ‘shell=True’ のときのWindowsシェル検索順序
     を変更しました。カレントディレクトリと ‘%PATH%’ は、 ‘%COMSPEC%’ と
     ‘%SystemRoot%\System32\cmd.exe’ に置き換えられました。これにより、
     ‘cmd.exe’ という名前の悪意のあるプログラムをカレントディレクトリに
     ドロップしても、動作しなくなりました。

 -- の関数: subprocess.check_call (args, *, stdin=None, stdout=None,
          stderr=None, shell=False, cwd=None, timeout=None,
          **other_popen_kwargs)

     Run command with arguments.  Wait for command to complete.  If the
     return code was zero then return, otherwise raise *note
     CalledProcessError: 153c.  The *note CalledProcessError: 153c.
     object will have the return code in the *note returncode: 373a.
     attribute.  If *note check_call(): 3739. was unable to start the
     process it will propagate the exception that was raised.

     Code needing to capture stdout or stderr should use *note run():
     d7f. instead:

          run(..., check=True)

     To suppress stdout or stderr, supply a value of *note DEVNULL:
     1366.

     上記の引数は、よく使われるものだけ示しています。関数の全使用法は
     *note Popen: 4b7. コンストラクターの内容と同じになります - この関数
     は、このインターフェースに直接指定される 'timeout' 以外は与えられた
     全引数を渡します。

          注釈: この関数を使用する際は ‘stdout=PIPE’ および
          ‘stderr=PIPE’ を使用しないでください。子プロセスが OS のパイプ
          バッファーを埋めてしまうほどの出力データを生成した場合、パイプ
          からは読み込まれないので、子プロセスがブロックされることがあり
          ます。

     バージョン 3.3 で変更: 'timeout' が追加されました

     バージョン 3.12 で変更: ‘shell=True’ のときのWindowsシェル検索順序
     を変更しました。カレントディレクトリと ‘%PATH%’ は、 ‘%COMSPEC%’ と
     ‘%SystemRoot%\System32\cmd.exe’ に置き換えられました。これにより、
     ‘cmd.exe’ という名前の悪意のあるプログラムをカレントディレクトリに
     ドロップしても、動作しなくなりました。

 -- の関数: subprocess.check_output (args, *, stdin=None, stderr=None,
          shell=False, cwd=None, encoding=None, errors=None,
          universal_newlines=None, timeout=None, text=None,
          **other_popen_kwargs)

     引数でコマンドを実行し、その出力を返します。

     コマンドのリターンコードが非ゼロならば *note CalledProcessError:
     153c. 例外が送出されます。*note CalledProcessError: 153c. オブジェ
     クトには、リターンコードが *note returncode: 373a. 属性に、コマンド
     からの出力が *note output: 373c. 属性に、それぞれ格納されています。

     これは次と等価です:

          run(..., check=True, stdout=PIPE).stdout

     The arguments shown above are merely some common ones.  The full
     function signature is largely the same as that of *note run(): d7f.
     - most arguments are passed directly through to that interface.
     One API deviation from *note run(): d7f. behavior exists: passing
     ‘input=None’ will behave the same as ‘input=b''’ (or ‘input=''’,
     depending on other arguments) rather than using the parent's
     standard input file handle.

     デフォルトで、この関数はデータをエンコードされたバイトとして返しま
     す。出力されたデータの実際のエンコードは起動されているコマンドに依
     存するため、テキストへのデコードは通常アプリケーションレベルで扱う
     必要があります。

     This behaviour may be overridden by setting 'text', 'encoding',
     'errors', or 'universal_newlines' to ‘True’ as described in *note
     よく使われる引数: 372c. and *note run(): d7f.

     標準エラー出力も結果に含めるには、‘stderr=subprocess.STDOUT’ を使い
     ます:

          >>> subprocess.check_output(
          ...     "ls non_existent_file; exit 0",
          ...     stderr=subprocess.STDOUT,
          ...     shell=True)
          'ls: non_existent_file: No such file or directory\n'

     Added in version 3.1.

     バージョン 3.3 で変更: 'timeout' が追加されました

     バージョン 3.4 で変更: キーワード引数 'input' が追加されました。

     バージョン 3.6 で変更: 'encoding' and 'errors' were added.  See
     *note run(): d7f. for details.

     Added in version 3.7: 'text' が、'universal_newlines' のより読みや
     すい別名として追加されました。

     バージョン 3.12 で変更: ‘shell=True’ のときのWindowsシェル検索順序
     を変更しました。カレントディレクトリと ‘%PATH%’ は、 ‘%COMSPEC%’ と
     ‘%SystemRoot%\System32\cmd.exe’ に置き換えられました。これにより、
     ‘cmd.exe’ という名前の悪意のあるプログラムをカレントディレクトリに
     ドロップしても、動作しなくなりました。


File: python.info,  Node: Replacing Older Functions with the subprocess Module,  Next: レガシーなシェル呼び出し関数,  Prev: 古い高水準 API,  Up: subprocess --- サブプロセス管理

5.18.7.10 Replacing Older Functions with the ‘subprocess’ Module
................................................................

この節では、 "a becomes b" と書かれているものは a の代替として b が使え
るということを表します。

     注釈: この節で紹介されている "a" 関数は全て、実行するプログラムが見
     つからないときは (おおむね) 静かに終了します。それに対して "b" 代替
     手段は *note OSError: 2c0. 例外を送出します。

     また、要求された操作が非ゼロの終了コードを返した場合、*note
     check_output(): 11c4. を使用した置き換えは *note
     CalledProcessError: 153c. で失敗します。その出力は、送出された例外
     の *note output: 373c. 属性として利用可能です。

In the following examples, we assume that the relevant functions have
already been imported from the ‘subprocess’ module.

* Menu:

* Replacing /bin/sh shell command substitution::
* シェルのパイプラインを置き換える::
* os.system() を置き換える: os system を置き換える.
* os.spawn 関数群を置き換える: os spawn 関数群を置き換える.
* Replacing os.popen(): Replacing os popen.


File: python.info,  Node: Replacing /bin/sh shell command substitution,  Next: シェルのパイプラインを置き換える,  Up: Replacing Older Functions with the subprocess Module

5.18.7.11 Replacing ‘/bin/sh’ shell command substitution
........................................................

     output=$(mycmd myarg)

これは以下のようになります:

     output = check_output(["mycmd", "myarg"])


File: python.info,  Node: シェルのパイプラインを置き換える,  Next: os system を置き換える,  Prev: Replacing /bin/sh shell command substitution,  Up: Replacing Older Functions with the subprocess Module

5.18.7.12 シェルのパイプラインを置き換える
..........................................

     output=$(dmesg | grep hda)

これは以下のようになります:

     p1 = Popen(["dmesg"], stdout=PIPE)
     p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE)
     p1.stdout.close()  # Allow p1 to receive a SIGPIPE if p2 exits.
     output = p2.communicate()[0]

p2 を開始した後の ‘p1.stdout.close()’ の呼び出しは、p1 が p2 の前に存在
した場合に、p1 が SIGPIPE を受け取るために重要です。

あるいは、信頼された入力に対しては、シェル自身のパイプラインサポートを直
接使用することもできます:

     output=$(dmesg | grep hda)

これは以下のようになります:

     output = check_output("dmesg | grep hda", shell=True)


File: python.info,  Node: os system を置き換える,  Next: os spawn 関数群を置き換える,  Prev: シェルのパイプラインを置き換える,  Up: Replacing Older Functions with the subprocess Module

5.18.7.13 ‘os.system()’ を置き換える
....................................

     sts = os.system("mycmd" + " myarg")
     # becomes
     retcode = call("mycmd" + " myarg", shell=True)

注釈:

   * このプログラムは普通シェル経由で呼び出す必要はありません。

   * The *note call(): d81. return value is encoded differently to that
     of *note os.system(): 1676.

   * The *note os.system(): 1676. function ignores SIGINT and SIGQUIT
     signals while the command is running, but the caller must do this
     separately when using the ‘subprocess’ module.

より現実的な例ではこうなるでしょう:

     try:
         retcode = call("mycmd" + " myarg", shell=True)
         if retcode < 0:
             print("Child was terminated by signal", -retcode, file=sys.stderr)
         else:
             print("Child returned", retcode, file=sys.stderr)
     except OSError as e:
         print("Execution failed:", e, file=sys.stderr)


File: python.info,  Node: os spawn 関数群を置き換える,  Next: Replacing os popen,  Prev: os system を置き換える,  Up: Replacing Older Functions with the subprocess Module

5.18.7.14 ‘os.spawn’ 関数群を置き換える
.......................................

P_NOWAIT の例:

     pid = os.spawnlp(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg")
     ==>
     pid = Popen(["/bin/mycmd", "myarg"]).pid

P_WAIT の例:

     retcode = os.spawnlp(os.P_WAIT, "/bin/mycmd", "mycmd", "myarg")
     ==>
     retcode = call(["/bin/mycmd", "myarg"])

シーケンスを使った例:

     os.spawnvp(os.P_NOWAIT, path, args)
     ==>
     Popen([path] + args[1:])

環境変数を使った例:

     os.spawnlpe(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg", env)
     ==>
     Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"})


File: python.info,  Node: Replacing os popen,  Prev: os spawn 関数群を置き換える,  Up: Replacing Older Functions with the subprocess Module

5.18.7.15 Replacing ‘os.popen()’
................................

終了コードハンドリングは以下のように解釈します:

     pipe = os.popen(cmd, 'w')
     ...
     rc = pipe.close()
     if rc is not None and rc >> 8:
         print("There were some errors")
     ==>
     process = Popen(cmd, stdin=PIPE)
     ...
     process.stdin.close()
     if process.wait() != 0:
         print("There were some errors")


File: python.info,  Node: レガシーなシェル呼び出し関数,  Next: 注釈<2>,  Prev: Replacing Older Functions with the subprocess Module,  Up: subprocess --- サブプロセス管理

5.18.7.16 レガシーなシェル呼び出し関数
......................................

このモジュールでは、以下のような 2.x ‘commands’ モジュールからのレガシー
関数も提供しています。これらの操作は、暗黙的にシステムシェルを起動します
。また、セキュリティに関して上述した保証や例外処理一貫性は、これらの関数
では有効ではありません。

 -- の関数: subprocess.getstatusoutput (cmd, *, encoding=None,
          errors=None)

     シェル中の 'cmd' を実行して ‘(exitcode, output)’ を返します。

     Execute the string 'cmd' in a shell with *note check_output():
     11c4. and return a 2-tuple ‘(exitcode, output)’.  'encoding' and
     'errors' are used to decode output; see the notes on *note
     よく使われる引数: 372c. for more details.

     A trailing newline is stripped from the output.  The exit code for
     the command can be interpreted as the return code of subprocess.
     Example:

          >>> subprocess.getstatusoutput('ls /bin/ls')
          (0, '/bin/ls')
          >>> subprocess.getstatusoutput('cat /bin/junk')
          (1, 'cat: /bin/junk: No such file or directory')
          >>> subprocess.getstatusoutput('/bin/junk')
          (127, 'sh: /bin/junk: not found')
          >>> subprocess.getstatusoutput('/bin/kill $$')
          (-15, '')

     *note Availability: 213f.: Unix, Windows.

     バージョン 3.3.4 で変更: Windows のサポートが追加されました。

     The function now returns (exitcode, output) instead of (status,
     output) as it did in Python 3.3.3 and earlier.  exitcode has the
     same value as *note returncode: c83.

     バージョン 3.11 で変更: 'encoding' と 'errors' が引数に追加されまし
     た。

 -- の関数: subprocess.getoutput (cmd, *, encoding=None, errors=None)

     シェル中の 'cmd' を実行して出力 (stdout と stderr) を返します。

     *note getstatusoutput(): 11c6. に似ていますが、終了コードは無視され
     、コマンドの出力のみを返します。例えば:

          >>> subprocess.getoutput('ls /bin/ls')
          '/bin/ls'

     *note Availability: 213f.: Unix, Windows.

     バージョン 3.3.4 で変更: Windowsで利用可能になりました

     バージョン 3.11 で変更: 'encoding' と 'errors' が引数に追加されまし
     た。


File: python.info,  Node: 注釈<2>,  Prev: レガシーなシェル呼び出し関数,  Up: subprocess --- サブプロセス管理

5.18.7.17 注釈
..............

* Menu:

* Timeout Behavior::
* Windows における引数シーケンスから文字列への変換::
* Disable use of posix_spawn(): Disable use of posix_spawn.


File: python.info,  Node: Timeout Behavior,  Next: Windows における引数シーケンスから文字列への変換,  Up: 注釈<2>

5.18.7.18 Timeout Behavior
..........................

When using the ‘timeout’ parameter in functions like *note run(): d7f,
*note Popen.wait(): ee0, or *note Popen.communicate(): 17aa, users
should be aware of the following behaviors:

  1. 'Process Creation Delay': The initial process creation itself
     cannot be interrupted on many platform APIs.  This means that even
     when specifying a timeout, you are not guaranteed to see a timeout
     exception until at least after however long process creation takes.

  2. 'Extremely Small Timeout Values': Setting very small timeout values
     (such as a few milliseconds) may result in almost immediate *note
     TimeoutExpired: 17ab. exceptions because process creation and
     system scheduling inherently require time.


File: python.info,  Node: Windows における引数シーケンスから文字列への変換,  Next: Disable use of posix_spawn,  Prev: Timeout Behavior,  Up: 注釈<2>

5.18.7.19 Windows における引数シーケンスから文字列への変換
..........................................................

Windows では、 'args' シーケンスは以下の (MS C ランタイムで使われる規則
に対応する) 規則を使って解析できる文字列に変換されます:

  1. 引数は、スペースかタブのどちらかの空白で分けられます。

  2. ダブルクオーテーションマークで囲まれた文字列は、空白が含まれていた
     としても 1 つの引数として解釈されます。クオートされた文字列は引数に
     埋め込めます。

  3. バックスラッシュに続くダブルクオーテーションマークは、リテラルのダ
     ブルクオーテーションマークと解釈されます。

  4. バックスラッシュは、ダブルクオーテーションが続かない限り、リテラル
     として解釈されます。

  5. 複数のバックスラッシュにダブルクオーテーションマークが続くなら、バ
     ックスラッシュ 2 つで 1 つのバックスラッシュ文字と解釈されます。バ
     ックスラッシュの数が奇数なら、最後のバックスラッシュは規則 3 に従っ
     て続くダブルクオーテーションマークをエスケープします。

参考
....

*note shlex: c9.

     コマンドラインを解析したりエスケープしたりする関数を提供するモジュ
     ール。


File: python.info,  Node: Disable use of posix_spawn,  Prev: Windows における引数シーケンスから文字列への変換,  Up: 注釈<2>

5.18.7.20 Disable use of ‘posix_spawn()’
........................................

On Linux, ‘subprocess’ defaults to using the ‘vfork()’ system call
internally when it is safe to do so rather than ‘fork()’.  This greatly
improves performance.

     subprocess._USE_POSIX_SPAWN = False  # See CPython issue gh-NNNNNN.

It is safe to set this to false on any Python version.  It will have no
effect on older or newer versions where unsupported.  Do not assume the
attribute is available to read.  Despite the name, a true value does not
indicate the corresponding function will be used, only that it may be.

Please file issues any time you have to use these private knobs with a
way to reproduce the issue you were seeing.  Link to that issue from a
comment in your code.

Added in version 3.8: ‘_USE_POSIX_SPAWN’


File: python.info,  Node: sched --- イベントスケジューラー,  Next: queue --- 同期キュークラス,  Prev: subprocess --- サブプロセス管理,  Up: 並行実行

5.18.8 ‘sched’ -- イベントスケジューラー
----------------------------------------

'ソースコード:' Lib/sched.py(1)

__________________________________________________________________

The ‘sched’ module defines a class which implements a general purpose
event scheduler:

 -- クラス: sched.scheduler (timefunc=time.monotonic,
          delayfunc=time.sleep)

     *note scheduler: 133f. クラスはイベントをスケジュールするための一般
     的なインターフェースを定義します。それは "外の世界" を実際に扱うた
     めの2つの関数を必要とします -- 'timefunc' は引数なしで呼ばれて 1 つ
     の数値を返す callable オブジェクトでなければなりません (戻り値は任
     意の単位で「時間」を表します)。 'delayfunc' は 1 つの引数を持つ
     callable オブジェクトでなければならず、その時間だけ遅延する必要があ
     ります (引数は 'timefunc' の出力と互換)。 'delayfunc' は、各々のイ
     ベントが実行された後に引数 ‘0’ で呼ばれることがあります。これは、マ
     ルチスレッドアプリケーションの中で他のスレッドが実行する機会を与え
     るためです。

     バージョン 3.3 で変更: 'timefunc' と 'delayfunc' がオプション引数に
     なりました。

     バージョン 3.3 で変更: *note scheduler: 133f. クラスをマルチスレッ
     ド環境で安全に使用出来るようになりました。

以下はプログラム例です:

     >>> import sched, time
     >>> s = sched.scheduler(time.time, time.sleep)
     >>> def print_time(a='default'):
     ...     print("From print_time", time.time(), a)
     ...
     >>> def print_some_times():
     ...     print(time.time())
     ...     s.enter(10, 1, print_time)
     ...     s.enter(5, 2, print_time, argument=('positional',))
     ...     # despite having higher priority, 'keyword' runs after 'positional' as enter() is relative
     ...     s.enter(5, 1, print_time, kwargs={'a': 'keyword'})
     ...     s.enterabs(1_650_000_000, 10, print_time, argument=("first enterabs",))
     ...     s.enterabs(1_650_000_000, 5, print_time, argument=("second enterabs",))
     ...     s.run()
     ...     print(time.time())
     ...
     >>> print_some_times()
     1652342830.3640375
     From print_time 1652342830.3642538 second enterabs
     From print_time 1652342830.3643398 first enterabs
     From print_time 1652342835.3694863 positional
     From print_time 1652342835.3696074 keyword
     From print_time 1652342840.369612 default
     1652342840.3697174

* Menu:

* スケジューラオブジェクト::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/sched.py


File: python.info,  Node: スケジューラオブジェクト,  Up: sched --- イベントスケジューラー

5.18.8.1 スケジューラオブジェクト
.................................

*note scheduler: 133f. インスタンスは以下のメソッドと属性を持っています:

 -- メソッド: scheduler.enterabs (time, priority, action, argument=(),
          kwargs={})

     新しいイベントをスケジュールします。 引数 'time' は、コンストラクタ
     へ渡された 'timefunc' の戻り値と互換な数値型でなければいけません。
     同じ 'time' によってスケジュールされたイベントは、それらの
     'priority' によって実行されます。 数値の小さい方が高い優先度となり
     ます。

     イベントを実行することは、 ‘action(*argument, **kwargs)’ を実行する
     ことを意味します。 'argument' は 'action' のための位置引数を保持す
     るシーケンスでなければいけません。 'kwargs' は 'action' のためのキ
     ーワード引数を保持する辞書でなければいけません。

     戻り値は、後にイベントをキャンセルする時に使われる可能性のあるイベ
     ントです (*note cancel(): 1cfb. を参照)。

     バージョン 3.3 で変更: 'argument' 引数が任意になりました。

     バージョン 3.3 で変更: 'kwargs' 引数が追加されました。

 -- メソッド: scheduler.enter (delay, priority, action, argument=(),
          kwargs={})

     時間単位以上の 'delay' でイベントをスケジュールします。相対的時間以
     外の、引数、効果、戻り値は、 *note enterabs(): 1341. に対するものと
     同じです。

     バージョン 3.3 で変更: 'argument' 引数が任意になりました。

     バージョン 3.3 で変更: 'kwargs' 引数が追加されました。

 -- メソッド: scheduler.cancel (event)

     キューからイベントを消去します。もし 'event' がキューにある現在のイ
     ベントでないならば、このメソッドは *note ValueError: 2ec. を送出し
     ます。

 -- メソッド: scheduler.empty ()

     もしイベントキューが空ならば、 ‘True’ を返します。

 -- メソッド: scheduler.run (blocking=True)

     すべてのスケジュールされたイベントを実行します。このメソッドは次の
     イベントを待ち、それを実行し、スケジュールされたイベントがなくなる
     まで同じことを繰り返します。(イベントの待機は、 コンストラクタへ渡
     された関数 'delayfunc' を使うことで行います。)

     'blocking' が False の場合、最も早く期限が来るスケジュールされたイ
     ベントを (存在する場合) 実行し、スケジューラ内で次にスケジュールさ
     れた呼び出しの期限を (存在する場合) 返します。

     'action' あるいは 'delayfunc' は例外を投げることができます。いずれ
     の場合も、スケジューラは一貫した状態を維持し、例外を伝播するでしょ
     う。例外が 'action' によって投げられる場合、イベントは *note run():
     133e. への呼出しを未来に行なわないでしょう。

     イベントのシーケンスが、次イベントの前に、利用可能時間より実行時間
     が長いと、スケジューラは単に遅れることになるでしょう。イベントが落
     ちることはありません; 呼出しコードはもはや適切でないキャンセルイベ
     ントに対して責任があります。

     バージョン 3.3 で変更: 'blocking' 引数が追加されました。

 -- の属性: scheduler.queue

     読み出し専用の属性で、これから起こるイベントが実行される順序で格納
     されたリストを返します。各イベントは、次の属性 time, priority,
     action, argument, kwargs を持った *note named tuple: 85e. の形式に
     なります。


File: python.info,  Node: queue --- 同期キュークラス,  Next: contextvars --- コンテキスト変数,  Prev: sched --- イベントスケジューラー,  Up: 並行実行

5.18.9 ‘queue’ -- 同期キュークラス
----------------------------------

'ソースコード:' Lib/queue.py(1)

__________________________________________________________________

The ‘queue’ module implements multi-producer, multi-consumer queues.  It
is especially useful in threaded programming when information must be
exchanged safely between multiple threads.  The *note Queue: 15ac. class
in this module implements all the required locking semantics.

このモジュールでは3種類のキューが実装されています。それらはキューから取
り出されるエントリの順番だけが違います。 FIFO キューでは、最初に追加され
たエントリが最初に取り出されます。 LIFO キューでは、最後に追加されたエン
トリが最初に取り出されます(スタックのように振る舞います)。 優先順位付き
キュー(priority queue)では、エントリは(*note heapq: 6d. モジュールを利用
して)ソートされ、 最も低い値のエントリが最初に取り出されます。

内部的には、これらの3種類のキューは競争スレッドを一時的にブロックするた
めにロックを使っています; しかし、スレッド内での再入を扱うようには設計さ
れていません。

In addition, the module implements a "simple" FIFO queue type, *note
SimpleQueue: d61, whose specific implementation provides additional
guarantees in exchange for the smaller functionality.

The ‘queue’ module defines the following classes and exceptions:

 -- クラス: queue.Queue (maxsize=0)

     FIFO キューのコンストラクタです。 'maxsize' はキューに入れられる要
     素数の上限を設定する整数です。 いったんこの大きさに達したら、挿入処
     理はキューの要素が消費されるまでブロックされます。 'maxsize' が0以
     下の場合は、キューの大きさは無限です。

 -- クラス: queue.LifoQueue (maxsize=0)

     LIFO キューのコンストラクタです。 'maxsize' はキューに入れられる要
     素数の上限を設定する整数です。 いったんこの大きさに達したら、挿入処
     理はキューの要素が消費されるまでブロックされます。 'maxsize' が0以
     下の場合は、キューの大きさは無限です。

 -- クラス: queue.PriorityQueue (maxsize=0)

     優先順位付きキューのコンストラクタです。'maxsize' はキューに置くこ
     とのできる要素数の上限を設定する整数です。いったんこの大きさに達し
     たら、挿入はキューの要素が消費されるまでブロックされます。もし
     'maxsize' が0以下であるならば、キューの大きさは無限です。

     最小の値を持つ要素が最初に検索されます (最小の値を持つ値は、
     ‘min(entries)’ によって返されるものです)。典型的な要素のパターンは
     、‘(priority_number, data)’ 形式のタプルです。

     If the 'data' elements are not comparable, the data can be wrapped
     in a class that ignores the data item and only compares the
     priority number:

          from dataclasses import dataclass, field
          from typing import Any

          @dataclass(order=True)
          class PrioritizedItem:
              priority: int
              item: Any=field(compare=False)

 -- クラス: queue.SimpleQueue

     Constructor for an unbounded FIFO queue.  Simple queues lack
     advanced functionality such as task tracking.

     Added in version 3.7.

 -- 例外: queue.Empty

     空の *note Queue: 15ac. オブジェクトで、非ブロックメソッド *note
     get(): 31c3. (または *note get_nowait(): 3784.) が呼ばれたとき、送
     出される例外です。

 -- 例外: queue.Full

     満杯の *note Queue: 15ac. オブジェクトで、非ブロックメソッド *note
     put(): 3785. (または *note put_nowait(): 31c2.) が呼ばれたとき、送
     出される例外です。

 -- 例外: queue.ShutDown

     Exception raised when *note put(): 3785. or *note get(): 31c3. is
     called on a *note Queue: 15ac. object which has been shut down.

     Added in version 3.13.

* Menu:

* キューオブジェクト::
* SimpleQueue オブジェクト::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/queue.py


File: python.info,  Node: キューオブジェクト,  Next: SimpleQueue オブジェクト,  Up: queue --- 同期キュークラス

5.18.9.1 キューオブジェクト
...........................

キューオブジェクト(*note Queue: 15ac, *note LifoQueue: 26b6, *note
PriorityQueue: 26b7.)は、以下のpublicメソッドを提供しています。

 -- メソッド: Queue.qsize ()

     キューの近似サイズを返します。ここで、qsize() > 0 は後続の get() が
     ブロックしないことを保証しないこと、また qsize() < maxsize が put()
     がブロックしないことを保証しないことに注意してください。

 -- メソッド: Queue.empty ()

     キューが空の場合は ‘True’ を返し、そうでなければ ‘False’ を返します
     。empty() が ‘True’ を返しても、後続の put() の呼び出しがブロックし
     ないことは保証されません。同様に、empty() が ‘False’ を返しても、後
     続の get() の呼び出しがブロックしないことは保証されません。

 -- メソッド: Queue.full ()

     キューが一杯の場合は ‘True’ を返し、そうでなければ ‘False’ を返しま
     す。full() が ‘True’ を返しても、後続の get() の呼び出しがブロック
     しないことは保証されません。同様に、full() が ‘False’ を返しても、
     後続の put() の呼び出しがブロックしないことは保証されません。

 -- メソッド: Queue.put (item, block=True, timeout=None)

     'item' をキューに入れます。 もしオプション引数 'block' が真で
     'timeout' が ‘None’ (デフォルト) の場合は、必要であればフリースロッ
     トが利用可能になるまでブロックします。 'timeout' が正の数の場合は、
     最大で 'timeout' 秒間ブロックし、その時間内に空きスロットが利用可能
     にならなければ、例外 *note Full: 366d. を送出します。 そうでない場
     合 ('block' が偽) は、空きスロットが直ちに利用できるならば、キュー
     にアイテムを置きます。 できないならば、例外 *note Full: 366d. を送
     出します (この場合 'timeout' は無視されます)。

     Raises *note ShutDown: 543. if the queue has been shut down.

 -- メソッド: Queue.put_nowait (item)

     ‘put(item, block=False)’ と等価です。

 -- メソッド: Queue.get (block=True, timeout=None)

     キューからアイテムを取り除き、それを返します。 オプション引数
     'block' が真で 'timeout' が ‘None’ (デフォルト) の場合は、必要であ
     ればアイテムが取り出せるようになるまでブロックします。 もし
     'timeout' が正の数の場合は、最大で 'timeout' 秒間ブロックし、その時
     間内でアイテムが取り出せるようにならなければ、例外 *note Empty:
     366c. を送出します。 そうでない場合 ('block' が偽) は、直ちにアイテ
     ムが取り出せるならば、それを返します。 できないならば、例外 *note
     Empty: 366c. を送出します (この場合 'timeout' は無視されます)。

     Prior to 3.0 on POSIX systems, and for all versions on Windows, if
     'block' is true and 'timeout' is ‘None’, this operation goes into
     an uninterruptible wait on an underlying lock.  This means that no
     exceptions can occur, and in particular a SIGINT will not trigger a
     *note KeyboardInterrupt: bc5.

     Raises *note ShutDown: 543. if the queue has been shut down and is
     empty, or if the queue has been shut down immediately.

 -- メソッド: Queue.get_nowait ()

     ‘get(False)’ と等価です。

キューに入れられたタスクが全てコンシューマスレッドに処理されたかどうかを
追跡するために 2つのメソッドが提供されます。

 -- メソッド: Queue.task_done ()

     過去にキューに入れられたタスクが完了した事を示します。キューのコン
     シューマスレッドに利用されます。タスクの取り出しに使われた各 *note
     get(): 31c3. の後に *note task_done(): 3668. を呼び出すと、取り出し
     たタスクに対する処理が完了した事をキューに教えます。

     *note join(): 3669. がブロックされていた場合、全itemが処理された (キ
     ューに *note put(): 3785. された全てのitemに対して *note
     task_done(): 3668. が呼び出されたことを意味します) 時に復帰します。

     キューにある要素より多く呼び出された場合 *note ValueError: 2ec. が
     発生します。

 -- メソッド: Queue.join ()

     キューにあるすべてのアイテムが取り出されて処理されるまでブロックし
     ます。

     未完了のタスクのカウント値はキューにアイテムが追加されるときは常に
     加算され、コンシューマースレッドが *note task_done(): 3668. を呼び
     出してアイテムの回収とその全処理の完了が示されるときは常に減算され
     ます。未完了のタスクのカウント値がゼロになった場合、*note join():
     3669. のブロックが解除されます。

* Menu:

* Waiting for task completion::
* Terminating queues::


File: python.info,  Node: Waiting for task completion,  Next: Terminating queues,  Up: キューオブジェクト

5.18.9.2 Waiting for task completion
....................................

キューに入れたタスクが完了するのを待つ例:

     import threading
     import queue

     q = queue.Queue()

     def worker():
         while True:
             item = q.get()
             print(f'Working on {item}')
             print(f'Finished {item}')
             q.task_done()

     # Turn-on the worker thread.
     threading.Thread(target=worker, daemon=True).start()

     # Send thirty task requests to the worker.
     for item in range(30):
         q.put(item)

     # Block until all tasks are done.
     q.join()
     print('All work completed')


File: python.info,  Node: Terminating queues,  Prev: Waiting for task completion,  Up: キューオブジェクト

5.18.9.3 Terminating queues
...........................

When no longer needed, *note Queue: 15ac. objects can be wound down
until empty or terminated immediately with a hard shutdown.

 -- メソッド: Queue.shutdown (immediate=False)

     Put a *note Queue: 15ac. instance into a shutdown mode.

     The queue can no longer grow.  Future calls to *note put(): 3785.
     raise *note ShutDown: 543.  Currently blocked callers of *note
     put(): 3785. will be unblocked and will raise *note ShutDown: 543.
     in the formerly blocked thread.

     If 'immediate' is false (the default), the queue can be wound down
     normally with *note get(): 31c3. calls to extract tasks that have
     already been loaded.

     And if *note task_done(): 3668. is called for each remaining task,
     a pending *note join(): 3669. will be unblocked normally.

     Once the queue is empty, future calls to *note get(): 31c3. will
     raise *note ShutDown: 543.

     If 'immediate' is true, the queue is terminated immediately.  The
     queue is drained to be completely empty and the count of unfinished
     tasks is reduced by the number of tasks drained.  If unfinished
     tasks is zero, callers of *note join(): 3669. are unblocked.  Also,
     blocked callers of *note get(): 31c3. are unblocked and will raise
     *note ShutDown: 543. because the queue is empty.

     Use caution when using *note join(): 3669. with 'immediate' set to
     true.  This unblocks the join even when no work has been done on
     the tasks, violating the usual invariant for joining a queue.

     Added in version 3.13.


File: python.info,  Node: SimpleQueue オブジェクト,  Prev: キューオブジェクト,  Up: queue --- 同期キュークラス

5.18.9.4 SimpleQueue オブジェクト
.................................

*note SimpleQueue: d61. オブジェクトは以下のpublicメソッドを提供していま
す。

 -- メソッド: SimpleQueue.qsize ()

     キューの近似サイズを返します。ここで、qsize() > 0 であるからといっ
     て、後続の get() の呼び出しがブロックしないことが保証されないことに
     注意してください。

 -- メソッド: SimpleQueue.empty ()

     キューが空の場合は ‘True’ を返し、そうでなければ ‘False’ を返します
     。 empty() が ‘False’ を返しても、後続の get() の呼び出しがブロック
     しないことは保証されません。

 -- メソッド: SimpleQueue.put (item, block=True, timeout=None)

     Put 'item' into the queue.  The method never blocks and always
     succeeds (except for potential low-level errors such as failure to
     allocate memory).  The optional args 'block' and 'timeout' are
     ignored and only provided for compatibility with *note Queue.put():
     3785.

     'CPython 実装の詳細:' This method has a C implementation which is
     reentrant.  That is, a ‘put()’ or ‘get()’ call can be interrupted
     by another ‘put()’ call in the same thread without deadlocking or
     corrupting internal state inside the queue.  This makes it
     appropriate for use in destructors such as ‘__del__’ methods or
     *note weakref: 11a. callbacks.

 -- メソッド: SimpleQueue.put_nowait (item)

     ‘put(item, block=False)’ と等価です。*note Queue.put_nowait():
     31c2. との互換性のためのメソッドです。

 -- メソッド: SimpleQueue.get (block=True, timeout=None)

     キューからアイテムを取り除き、それを返します。 オプション引数
     'block' が真で 'timeout' が ‘None’ (デフォルト) の場合は、必要であ
     ればアイテムが取り出せるようになるまでブロックします。 もし
     'timeout' が正の数の場合は、最大で 'timeout' 秒間ブロックし、その時
     間内でアイテムが取り出せるようにならなければ、例外 *note Empty:
     366c. を送出します。 そうでない場合 ('block' が偽) は、直ちにアイテ
     ムが取り出せるならば、それを返します。 できないならば、例外 *note
     Empty: 366c. を送出します (この場合 'timeout' は無視されます)。

 -- メソッド: SimpleQueue.get_nowait ()

     ‘get(False)’ と等価です。

参考
....

*note multiprocessing.Queue: 1b89. クラス

     (マルチスレッドではなく) マルチプロセスの文脈で使用されるキュークラ
     ス。

*note collections.deque: 7f4. is an alternative implementation of
unbounded queues with fast atomic *note append(): 297c. and *note
popleft(): 2982. operations that do not require locking and also support
indexing.


File: python.info,  Node: contextvars --- コンテキスト変数,  Next: _thread --- 低水準なスレッド API,  Prev: queue --- 同期キュークラス,  Up: 並行実行

5.18.10 ‘contextvars’ -- コンテキスト変数
-----------------------------------------

__________________________________________________________________

このモジュールは、コンテキストローカルな状態を管理し、保持し、アクセスす
るための API を提供します。 *note ContextVar: 1875. クラスは 'コンテキス
ト変数' を宣言し、取り扱うために使われます。 非同期フレームワークで現時
点のコンテキストを管理するのには、 *note copy_context(): 361f. 関数と
*note Context: 177. クラスを使うべきです。

Context managers that have state should use Context Variables instead of
*note threading.local(): 185f. to prevent their state from bleeding to
other code unexpectedly, when used in concurrent code.

より詳しくは PEP 567(1) を参照をしてください。

Added in version 3.7.

* Menu:

* コンテキスト変数::
* マニュアルでのコンテキスト管理::
* asyncio サポート::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0567/


File: python.info,  Node: コンテキスト変数,  Next: マニュアルでのコンテキスト管理,  Up: contextvars --- コンテキスト変数

5.18.10.1 コンテキスト変数
..........................

 -- クラス: contextvars.ContextVar (name[, *, default])

     このクラスは新しいコンテキスト変数を宣言するのに使われます。例えば
     、次の通りです:

          var: ContextVar[int] = ContextVar('var', default=42)

     必須のパラメータの 'name' は内観やデバッグの目的で使われます。

     オプションのキーワード専用引数 'default' は、現在のコンテキストにそ
     の変数の値が見付からなかったときに *note ContextVar.get(): 3798. か
     ら返されます。

     '重要:' コンテキスト変数は、モジュールのトップレベルで生成する必要
     があり、クロージャの中で作成すべきではありません。*note Context:
     177. オブジェクトはコンテキスト変数への強参照を持っており、コンテキ
     スト変数がガーベジコレクトされるのを防ぎます。

      -- の属性: name

          変数の名前。読み出し専用のプロパティです。

          Added in version 3.7.1.

      -- メソッド: get ([default])

          現在のコンテキストのコンテキスト変数の値を返します。

          現在のコンテキストのコンテキスト変数に値がなければ、メソッドは
          :

             * メソッドの 'default' 引数に値が指定されていればその値を返
               します。さもなければ

             * コンテキスト変数が生成された時にデフォルト値が渡されてい
               れば、その値を返します。さもなければ

             * *note LookupError: 23e5. を送出します。

      -- メソッド: set (value)

          現在のコンテキストのコンテキスト変数に新しい値を設定する際に呼
          び出します。

          'value' は必須の引数で、コンテキスト変数の新しい値を指定します
          。

          *note Token: 1e2. オブジェクトを返します。このオブジェクトを
          *note ContextVar.reset(): 379a. メソッドに渡すことで、以前の値
          に戻すことができます。

          For convenience, the token object can be used as a context
          manager to avoid calling *note ContextVar.reset(): 379a.
          manually:

               var = ContextVar('var', default='default value')

               with var.set('new value'):
                   assert var.get() == 'new value'

               assert var.get() == 'default value'

          It is a shorthand for:

               var = ContextVar('var', default='default value')

               token = var.set('new value')
               try:
                   assert var.get() == 'new value'
               finally:
                   var.reset(token)

               assert var.get() == 'default value'

          Added in version 3.14: Added support for using tokens as
          context managers.

      -- メソッド: reset (token)

          コンテキスト変数の値を、 'token' を生成した *note
          ContextVar.set(): 1792. が呼び出される前の値にリセットします。

          例えば:

               var = ContextVar('var')

               token = var.set('new value')
               # code that uses 'var'; var.get() returns 'new value'.
               var.reset(token)

               # After the reset call the var has no value again, so
               # var.get() would raise a LookupError.

          The same 'token' cannot be used twice.

 -- クラス: contextvars.Token

     'Token' objects are returned by the *note ContextVar.set(): 1792.
     method.  They can be passed to the *note ContextVar.reset(): 379a.
     method to revert the value of the variable to what it was before
     the corresponding 'set'.  A single token cannot reset a context
     variable more than once.

     Tokens support the *note context manager protocol: 240b. to
     automatically reset context variables.  See *note ContextVar.set():
     1792.

     Added in version 3.14: Added support for usage as a context
     manager.

      -- の属性: var

          読み出し専用のプロパティです。トークンを生成した *note
          ContextVar: 1875. オブジェクトを指します。

      -- の属性: old_value

          読み出し専用のプロパティです。このトークンを作成した *note
          ContextVar.set(): 1792. メソッドの呼び出しの前に持っていた値に
          設定されています。もし呼び出しの前に値が設定されていなければ
          *note Token.MISSING: 17f9. を指します。

      -- の属性: MISSING

          *note Token.old_value: 379c. で利用されるマーカーオブジェクト
          です。


File: python.info,  Node: マニュアルでのコンテキスト管理,  Next: asyncio サポート,  Prev: コンテキスト変数,  Up: contextvars --- コンテキスト変数

5.18.10.2 マニュアルでのコンテキスト管理
........................................

 -- の関数: contextvars.copy_context ()

     現在の *note Context: 177. オブジェクトのコピーを返します。

     次のスニペットは、現在のコンテキストのコピーを取得し、コンテキスト
     に設定されているすべての変数とその値を表示します:

          ctx: Context = copy_context()
          print(list(ctx.items()))

     この関数の複雑性は 'O'(1) です。つまり、少数のコンテキスト変数を持
     つコンテキストと多くの変数を持つコンテキストで同程度の速度で動作し
     ます。

 -- クラス: contextvars.Context

     ‘ContextVars’ とその値の対応付け。

     ‘Context()’ は、値を持たない空のコンテキストを生成します。現在のコ
     ンテキストのコピーを得るには、*note copy_context(): 361f. 関数を利
     用します。

     Each thread has its own effective stack of ‘Context’ objects.  The
     *note current context: 1964. is the ‘Context’ object at the top of
     the current thread's stack.  All ‘Context’ objects in the stacks
     are considered to be 'entered'.

     'Entering' a context, which can be done by calling its *note run():
     194b. method, makes the context the current context by pushing it
     onto the top of the current thread's context stack.

     'Exiting' from the current context, which can be done by returning
     from the callback passed to the *note run(): 194b. method, restores
     the current context to what it was before the context was entered
     by popping the context off the top of the context stack.

     Since each thread has its own context stack, *note ContextVar:
     1875. objects behave in a similar fashion to *note
     threading.local(): 185f. when values are assigned in different
     threads.

     Attempting to enter an already entered context, including contexts
     entered in other threads, raises a *note RuntimeError: 244.

     After exiting a context, it can later be re-entered (from any
     thread).

     Any changes to *note ContextVar: 1875. values via the *note
     ContextVar.set(): 1792. method are recorded in the current context.
     The *note ContextVar.get(): 3798. method returns the value
     associated with the current context.  Exiting a context effectively
     reverts any changes made to context variables while the context was
     entered (if needed, the values can be restored by re-entering the
     context).

     Context は、 *note collections.abc.Mapping: ac7. インターフェースを
     実装します。

      -- メソッド: run (callable, *args, **kwargs)

          Enters the Context, executes ‘callable(*args, **kwargs)’, then
          exits the Context.  Returns 'callable"s return value, or
          propagates an exception if one occurred.

          例:

               import contextvars

               var = contextvars.ContextVar('var')
               var.set('spam')
               print(var.get())  # 'spam'

               ctx = contextvars.copy_context()

               def main():
                   # 'var' was set to 'spam' before
                   # calling 'copy_context()' and 'ctx.run(main)', so:
                   print(var.get())  # 'spam'
                   print(ctx[var])  # 'spam'

                   var.set('ham')

                   # Now, after setting 'var' to 'ham':
                   print(var.get())  # 'ham'
                   print(ctx[var])  # 'ham'

               # Any changes that the 'main' function makes to 'var'
               # will be contained in 'ctx'.
               ctx.run(main)

               # The 'main()' function was run in the 'ctx' context,
               # so changes to 'var' are contained in it:
               print(ctx[var])  # 'ham'

               # However, outside of 'ctx', 'var' is still set to 'spam':
               print(var.get())  # 'spam'

      -- メソッド: copy ()

          コンテキストオブジェクトの浅いコピーを返します。

      -- Describe: var in context

          'context' に 'var' の値が設定されていた場合 ‘True’ を返します;
          そうでない場合は ‘False’ を返します。

      -- Describe: context[var]

          *note ContextVar: 1875. 'var' の値を返します。コンテキストオブ
          ジェクト内で変数が設定されていない場合は、*note KeyError: 5e7.
          を送出します。

      -- メソッド: get (var[, default])

          'var' がコンテキストオブジェクトの中に値を持てば、その値を返し
          ます。さもなければ、'default' を返します。'default' を指定して
          いなければ、‘None’ を返します。

      -- Describe: iter(context)

          コンテキストオブジェクトに格納されている変数群のイテレータを返
          します。

      -- Describe: len(proxy)

          コンテキストオブジェクトに格納されている変数の数を返します。

      -- メソッド: keys ()

          コンテキストオブジェクト中のすべての変数のリストを返します。

      -- メソッド: values ()

          コンテキストオブジェクト中のすべての変数の値のリストを返します
          。

      -- メソッド: items ()

          コンテキストオブジェクト中のすべての変数について、変数とその値
          からなる2要素のタプルのリストを返します。


File: python.info,  Node: asyncio サポート,  Prev: マニュアルでのコンテキスト管理,  Up: contextvars --- コンテキスト変数

5.18.10.3 asyncio サポート
..........................

コンテキスト変数は、追加の設定なしに *note asyncio: b. をサポートします
。例えば、次の単純なechoサーバーは、クライアントを扱う Task の中でリモー
トクライアントのアドレスが利用できるように、コンテキスト変数を利用します
:

     import asyncio
     import contextvars

     client_addr_var = contextvars.ContextVar('client_addr')

     def render_goodbye():
         # The address of the currently handled client can be accessed
         # without passing it explicitly to this function.

         client_addr = client_addr_var.get()
         return f'Good bye, client @ {client_addr}\r\n'.encode()

     async def handle_request(reader, writer):
         addr = writer.transport.get_extra_info('socket').getpeername()
         client_addr_var.set(addr)

         # In any code that we call is now possible to get
         # client's address by calling 'client_addr_var.get()'.

         while True:
             line = await reader.readline()
             print(line)
             if not line.strip():
                 break

         writer.write(b'HTTP/1.1 200 OK\r\n')  # status line
         writer.write(b'\r\n')  # headers
         writer.write(render_goodbye())  # body
         writer.close()

     async def main():
         srv = await asyncio.start_server(
             handle_request, '127.0.0.1', 8081)

         async with srv:
             await srv.serve_forever()

     asyncio.run(main())

     # To test it you can use telnet or curl:
     #     telnet 127.0.0.1 8081
     #     curl 127.0.0.1:8081

以下のモジュールは上記のサービスの一部で使われるサポートモジュールです:


File: python.info,  Node: _thread --- 低水準なスレッド API,  Prev: contextvars --- コンテキスト変数,  Up: 並行実行

5.18.11 ‘_thread’ -- 低水準なスレッド API
-----------------------------------------

__________________________________________________________________

このモジュールはマルチスレッド (別名 '軽量プロセス' ('light-weight
processes')または 'タスク' ('tasks')) に用いられる低水準プリミティブを提
供します -- グローバルデータ空間を共有するマルチスレッドを制御します。同
期のための単純なロック (別名 'mutexes' またはバイナリセマフォ ('binary
semaphores'))が提供されています。 *note threading: f3. モジュールは、こ
のモジュール上で、より使い易く高級なスレッディングの API を提供します。

バージョン 3.7 で変更: このモジュールは以前はオプションでしたが、常に利
用可能なモジュールとなりました。

このモジュールでは以下の定数および関数を定義しています:

 -- 例外: _thread.error

     スレッド固有の例外です。

     バージョン 3.3 で変更: 現在は組み込みの *note RuntimeError: 244. の
     別名です。

 -- データ: _thread.LockType

     これはロックオブジェクトのタイプです。

 -- の関数: _thread.start_new_thread (function, args[, kwargs])

     新しいスレッドを開始して、そのIDを返します。スレッドは引数リスト
     'args' (タプルでなければなりません)の関数 'function' を実行します。
     オプション引数 'kwargs' はキーワード引数の辞書を指定します。

     関数が戻るとき、スレッドは静かに終了します。

     When the function terminates with an unhandled exception, *note
     sys.unraisablehook(): 507. is called to handle the exception.  The
     'object' attribute of the hook argument is 'function'.  By default,
     a stack trace is printed and then the thread exits (but other
     threads continue to run).

     When the function raises a *note SystemExit: f3c. exception, it is
     silently ignored.

     Raises an *note auditing event: 1c6e. ‘_thread.start_new_thread’
     with arguments ‘function’, ‘args’, ‘kwargs’.

     バージョン 3.8 で変更: *note sys.unraisablehook(): 507. is now used
     to handle unhandled exceptions.

 -- の関数: _thread.interrupt_main (signum=signal.SIGINT, /)

     Simulate the effect of a signal arriving in the main thread.  A
     thread can use this function to interrupt the main thread, though
     there is no guarantee that the interruption will happen
     immediately.

     If given, 'signum' is the number of the signal to simulate.  If
     'signum' is not given, *note signal.SIGINT: 253. is simulated.

     If the given signal isn't handled by Python (it was set to *note
     signal.SIG_DFL: 1bb2. or *note signal.SIG_IGN: 1bb1.), this
     function does nothing.

     バージョン 3.10 で変更: The 'signum' argument is added to customize
     the signal number.

          注釈: This does not emit the corresponding signal but
          schedules a call to the associated handler (if it exists).  If
          you want to truly emit the signal, use *note
          signal.raise_signal(): 1b8f.

 -- の関数: _thread.exit ()

     *note SystemExit: f3c. を送出します。それが捕えられないときは、静か
     にスレッドを終了させます。

 -- の関数: _thread.allocate_lock ()

     新しいロックオブジェクトを返します。ロックのメソッドはこの後に記述
     されます。ロックは初期状態としてアンロック状態です。

 -- の関数: _thread.get_ident ()

     現在のスレッドの 'スレッドID' を返します。非ゼロの整数です。この値
     は直接の意味を持っていません; 例えばスレッド特有のデータの辞書に索
     引をつけるためのような、マジッククッキーとして意図されています。ス
     レッドが終了し、他のスレッドが作られたとき、スレッド ID は再利用さ
     れるかもしれません。

 -- の関数: _thread.get_native_id ()

     Return the native integral Thread ID of the current thread assigned
     by the kernel.  This is a non-negative integer.  Its value may be
     used to uniquely identify this particular thread system-wide (until
     the thread terminates, after which the value may be recycled by the
     OS).

     *note Availability: 213f.: Windows, FreeBSD, Linux, macOS, OpenBSD,
     NetBSD, AIX, DragonFlyBSD, GNU/kFreeBSD.

     Added in version 3.8.

     バージョン 3.13 で変更: Added support for GNU/kFreeBSD.

 -- の関数: _thread.stack_size ([size])

     新しいスレッドを作るときのスレッドスタックサイズを返します。オプシ
     ョンの 'size' 引数にはこれ以降に作成するスレッドのスタックサイズを
     指定し、0 (プラットフォームのデフォルト値または設定されたデフォルト
     値) か、 32,768 (32 KiB) 以上の正の整数でなければなりません。'size'
     が指定されない場合 0 が使われます。スレッドのスタックサイズの変更が
     サポートされていない場合、 *note RuntimeError: 244. を送出します。
     不正なスタックサイズが指定された場合、 *note ValueError: 2ec. を送
     出して、スタックサイズは変更されません。32 KiB は現在のインタープリ
     タ自身のために十分であると保証された最小のスタックサイズです。いく
     つかのプラットフォームではスタックサイズに対して制限があることに注
     意してください。例えば最小のスタックサイズが 32 KiB より大きかった
     り、システムのメモリページサイズ の整数倍の必要があるなどです。この
     制限についてはプラットフォームのドキュメントを参照してください (一
     般的なページサイズは 4 KiB なので、プラットフォームに関する情報がな
     い場合は 4096 の整数倍のスタックサイズを選ぶといいかもしれません)。

     *note Availability: 213f.: Windows, pthreads.

     Unix platforms with POSIX threads support.

 -- データ: _thread.TIMEOUT_MAX

     The maximum value allowed for the 'timeout' parameter of *note
     Lock.acquire: 8a7.  Specifying a timeout greater than this value
     will raise an *note OverflowError: a81.

     Added in version 3.2.

ロックオブジェクトは次のようなメソッドを持っています:

 -- メソッド: lock.acquire (blocking=True, timeout=-1)

     オプションの引数なしで使用すると、このメソッドは他のスレッドがロッ
     クしているかどうかにかかわらずロックを獲得します。ただし、他のスレ
     ッドがすでにロックしている場合には解除されるまで待ってからロックを
     獲得します (同時にロックを獲得できるスレッドはひとつだけであり、こ
     れこそがロックの存在理由です)。

     If the 'blocking' argument is present, the action depends on its
     value: if it is false, the lock is only acquired if it can be
     acquired immediately without waiting, while if it is true, the lock
     is acquired unconditionally as above.

     If the floating-point 'timeout' argument is present and positive,
     it specifies the maximum wait time in seconds before returning.  A
     negative 'timeout' argument specifies an unbounded wait.  You
     cannot specify a 'timeout' if 'blocking' is false.

     なお、ロックを獲得できた場合は ‘True’、できなかった場合は ‘False’ を
     返します。

     バージョン 3.2 で変更: 新しい 'timeout' 引数。

     バージョン 3.2 で変更: POSIX ではロックの取得がシグナルに割り込まれ
     るようになりました。

     バージョン 3.14 で変更: Lock acquires can now be interrupted by
     signals on Windows.

 -- メソッド: lock.release ()

     ロックを解放します。そのロックは既に獲得されたものでなければなりま
     せんが、しかし同じスレッドによって獲得されたものである必要はありま
     せん。

 -- メソッド: lock.locked ()

     ロックの状態を返します: 同じスレッドによって獲得されたものなら
     ‘True’ 、違うのなら ‘False’ を返します。

これらのメソッドに加えて、ロックオブジェクトは *note with: 186. 文を通じ
て以下の例のように使うこともできます。

     import _thread

     a_lock = _thread.allocate_lock()

     with a_lock:
         print("a_lock is locked while this executes")

'警告:'

   * Interrupts always go to the main thread (the *note
     KeyboardInterrupt: bc5. exception will be received by that thread.)

   * *note sys.exit(): 277. を呼び出す、あるいは *note SystemExit: f3c.
     例外を送出することは、 *note _thread.exit(): 37a9. を呼び出すことと
     同じです。

   * メインスレッドが終了したとき、他のスレッドが生き残るかどうかは、シ
     ステムに依存します。多くのシステムでは、 *note try: 8f8. ...  *note
     finally: 1b0. 節や、オブジェクトデストラクタを実行せずに終了されま
     す。


File: python.info,  Node: ネットワーク通信とプロセス間通信,  Next: インターネット上のデータの操作,  Prev: 並行実行,  Up: Python 標準ライブラリ

5.19 ネットワーク通信とプロセス間通信
=====================================

この章で解説しているモジュールはネットワーク通信とプロセス間通信の仕組み
を提供しています。

例えば *note signal: cb. や *note mmap: 94. のように、同じマシン上の 2 つ
のプロセスでしか使えないモジュールがあります。その他のモジュールは 2 つ
以上のプロセスを使ってマシン間で通信できるネットワークプロトコルをサポー
トします。

この章で解説されるモジュールのリスト:

* Menu:

* asyncio: asyncio --- 非同期 I/O. 非同期 I/O
* socket: socket --- 低水準ネットワークインターフェース. 低水準ネットワークインターフェース
* ssl: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー. ソケットオブジェクト用の TLS/SSL ラッパー
* select: select --- I/O 完了の待機. I/O 完了の待機
* selectors: selectors --- 高水準の I/O 多重化. 高水準の I/O 多重化
* signal: signal --- 非同期イベントにハンドラーを設定する. 非同期イベントにハンドラーを設定する
* mmap: mmap --- メモリマップファイルのサポート. メモリマップファイルのサポート


File: python.info,  Node: asyncio --- 非同期 I/O,  Next: socket --- 低水準ネットワークインターフェース,  Up: ネットワーク通信とプロセス間通信

5.19.1 ‘asyncio’ -- 非同期 I/O
------------------------------

__________________________________________________________________

Hello World!
............

     import asyncio

     async def main():
         print('Hello ...')
         await asyncio.sleep(1)
         print('... World!')

     asyncio.run(main())

asyncio は 'async/await' 構文を使い '並行処理の' コードを書くためのライ
ブラリです。

asyncio は、高性能なネットワークとウェブサーバ、データベース接続ライブラ
リ、分散タスクキューなどの複数の非同期 Python フレームワークの基盤として
使われています。

asyncio は多くの場合、 IOバウンドだったり高レベルの '構造化された' ネッ
トワークコードに完璧に適しています。

参考
....

*note A Conceptual Overview of asyncio: 37b7.

     asyncio の基本が解説されています。

asyncio は次の目的で '高レベル' API を提供しています:

   * 並行に *note Python コルーチンを起動: 37b8. し、実行全体を管理する

   * *note ネットワーク IO と IPC: 37b9. を執り行う

   * *note subprocesses: 37ba. を管理する

   * *note キュー: 37bb. を使ってタスクを分散する

   * 並列処理のコードを *note 同期: 37bc. させる

これに加えて、 'ライブラリやフレームワークの開発者' が次のことをするため
の '低レベル' API があります:

   * *note ネットワーク通信: 37bd. 、 *note サブプロセス: 37be. の実行、
     *note OS シグナル: 37bf. の取り扱いなどのための非同期 API を提供す
     る *note イベントループ: f76. の作成と管理を行う

   * *note Transport: 37c0. を使った効率的な protocol を実装します

   * コールバックを用いたライブラリと async/await 構文を使ったコードの
     *note 橋渡し: 37c1.

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

asyncio REPL
............

*note REPL: 491. で、‘asyncio’ 並行コンテキストを試すことができます:

     $ python -m asyncio
     asyncio REPL ...
     Use "await" directly instead of "asyncio.run()".
     Type "help", "copyright", "credits" or "license" for more information.
     >>> import asyncio
     >>> await asyncio.sleep(10, result='hello')
     'hello'

This REPL provides limited compatibility with *note PYTHON_BASIC_REPL:
1b6.  It is recommended that the default REPL is used for full
functionality and the latest features.

引数無しで *note 監査イベント: 1c6e. ‘cpython.run_stdin’ を送出します。

バージョン 3.12.5 で変更: (also 3.11.10, 3.10.15, 3.9.20, and 3.8.20)
Emits audit events.

バージョン 3.13 で変更: Uses PyREPL if possible, in which case *note
PYTHONSTARTUP: 1b8. is also executed.  Emits audit events.

リファレンス
............

* Menu:

* Runners::
* コルーチンと Task::
* ストリーム::
* 同期プリミティブ: 同期プリミティブ<2>.
* サブプロセス::
* キュー::
* 例外: 例外<16>.
* Call Graph Introspection::
* イベントループ::
* Future::
* トランスポートとプロトコル::
* ポリシー::
* プラットフォームでのサポート::
* Extending::
* 高水準の API インデックス::
* 低水準の API インデックス::
* asyncio での開発::


File: python.info,  Node: Runners,  Next: コルーチンと Task,  Up: asyncio --- 非同期 I/O

5.19.1.1 Runners
................

'ソースコード:' Lib/asyncio/runners.py(1)

この節では、asyncio のコードを実行するための高レベルの asyncio のプリミ
ティブの概略を解説します。

これらは *note イベントループ: f76. の上に構築されており、一般的な広く普
及しているシナリオでの非同期コードの使用を簡素化することを目的としていま
す。

* Menu:

* 非同期プログラムの実行::
* Runner context manager::
* Handling Keyboard Interruption::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/runners.py


File: python.info,  Node: 非同期プログラムの実行,  Next: Runner context manager,  Up: Runners

5.19.1.2 非同期プログラムの実行
...............................

 -- の関数: asyncio.run (coro, *, debug=None, loop_factory=None)

     Execute 'coro' in an asyncio event loop and return the result.

     The argument can be any awaitable object.

     This function runs the awaitable, taking care of managing the
     asyncio event loop, 'finalizing asynchronous generators', and
     closing the executor.

     この関数は、同じスレッドで他の非同期イベントループが実行中のときは
     呼び出せません。

     'debug' が ‘True’ の場合、イベントループはデバッグモードで実行され
     ます。‘False’ は明示的にデバッグモードを無効化します。 グローバルな
     *note デバッグモード: 213a. 設定を尊重するために ‘None’ が使用され
     ます。

     If 'loop_factory' is not ‘None’, it is used to create a new event
     loop; otherwise *note asyncio.new_event_loop(): 37c6. is used.  The
     loop is closed at the end.  This function should be used as a main
     entry point for asyncio programs, and should ideally only be called
     once.  It is recommended to use 'loop_factory' to configure the
     event loop instead of policies.  Passing *note asyncio.EventLoop:
     1a67. allows running asyncio without the policy system.

     The executor is given a timeout duration of 5 minutes to shutdown.
     If the executor hasn't finished within that duration, a warning is
     emitted and the executor is closed.

     以下はプログラム例です:

          async def main():
              await asyncio.sleep(1)
              print('hello')

          asyncio.run(main())

     Added in version 3.7.

     バージョン 3.9 で変更: *note loop.shutdown_default_executor(): ae4.
     メソッドを使うように更新されました。

     バージョン 3.10 で変更: 'debug' はグローバルなデバッグモード設定を
     尊重するためにデフォルトで ‘None’ です。

     バージョン 3.12 で変更: 'loop_factory' 引数が追加されました。

     バージョン 3.14 で変更: 'coro' can be any awaitable object.

          注釈: The ‘asyncio’ policy system is deprecated and will be
          removed in Python 3.16; from there on, an explicit
          'loop_factory' is needed to configure the event loop.


File: python.info,  Node: Runner context manager,  Next: Handling Keyboard Interruption,  Prev: 非同期プログラムの実行,  Up: Runners

5.19.1.3 Runner context manager
...............................

 -- クラス: asyncio.Runner (*, debug=None, loop_factory=None)

     同じコンテキスト上での '複数' の非同期関数呼び出しをシンプルにする
     コンテキストマネージャ。

     Sometimes several top-level async functions should be called in the
     same *note event loop: f76. and *note contextvars.Context: 177.

     'debug' が ‘True’ の場合、イベントループはデバッグモードで実行され
     ます。‘False’ は明示的にデバッグモードを無効化します。 グローバルな
     *note デバッグモード: 213a. 設定を尊重するために ‘None’ が使用され
     ます。

     'loop_factory' could be used for overriding the loop creation.  It
     is the responsibility of the 'loop_factory' to set the created loop
     as the current one.  By default *note asyncio.new_event_loop():
     37c6. is used and set as current event loop with *note
     asyncio.set_event_loop(): 1b55. if 'loop_factory' is ‘None’.

     Basically, *note asyncio.run(): 2f3. example can be rewritten with
     the runner usage:

          async def main():
              await asyncio.sleep(1)
              print('hello')

          with asyncio.Runner() as runner:
              runner.run(main())

     Added in version 3.11.

      -- メソッド: run (coro, *, context=None)

          Execute 'coro' in the embedded event loop.

          The argument can be any awaitable object.

          If the argument is a coroutine, it is wrapped in a Task.

          An optional keyword-only 'context' argument allows specifying
          a custom *note contextvars.Context: 177. for the code to run
          in.  The runner's default context is used if context is
          ‘None’.

          Returns the awaitable's result or raises an exception.

          この関数は、同じスレッドで他の非同期イベントループが実行中のと
          きは呼び出せません。

          バージョン 3.14 で変更: 'coro' can be any awaitable object.

      -- メソッド: close ()

          Close the runner.

          Finalize asynchronous generators, shutdown default executor,
          close the event loop and release embedded *note
          contextvars.Context: 177.

      -- メソッド: get_loop ()

          Return the event loop associated with the runner instance.

          注釈: *note Runner: 2f5. uses the lazy initialization
          strategy, its constructor doesn't initialize underlying
          low-level structures.

          Embedded 'loop' and 'context' are created at the *note with:
          186. body entering or the first call of *note run(): 2f3. or
          *note get_loop(): 37c9.


File: python.info,  Node: Handling Keyboard Interruption,  Prev: Runner context manager,  Up: Runners

5.19.1.4 Handling Keyboard Interruption
.......................................

Added in version 3.11.

When *note signal.SIGINT: 253. is raised by ‘Ctrl’-‘C’, *note
KeyboardInterrupt: bc5. exception is raised in the main thread by
default.  However this doesn't work with *note asyncio: b. because it
can interrupt asyncio internals and can hang the program from exiting.

To mitigate this issue, *note asyncio: b. handles *note signal.SIGINT:
253. as follows:

  1. *note asyncio.Runner.run(): 194d. installs a custom *note
     signal.SIGINT: 253. handler before any user code is executed and
     removes it when exiting from the function.

  2. The *note Runner: 2f5. creates the main task for the passed
     coroutine for its execution.

  3. When *note signal.SIGINT: 253. is raised by ‘Ctrl’-‘C’, the custom
     signal handler cancels the main task by calling *note
     asyncio.Task.cancel(): 4d3. which raises *note
     asyncio.CancelledError: 4d4. inside the main task.  This causes the
     Python stack to unwind, ‘try/except’ and ‘try/finally’ blocks can
     be used for resource cleanup.  After the main task is cancelled,
     *note asyncio.Runner.run(): 194d. raises *note KeyboardInterrupt:
     bc5.

  4. A user could write a tight loop which cannot be interrupted by
     *note asyncio.Task.cancel(): 4d3, in which case the second
     following ‘Ctrl’-‘C’ immediately raises the *note
     KeyboardInterrupt: bc5. without cancelling the main task.


File: python.info,  Node: コルーチンと Task,  Next: ストリーム,  Prev: Runners,  Up: asyncio --- 非同期 I/O

5.19.1.5 コルーチンと Task
..........................

この節では、コルーチンと Task を利用する高レベルの asyncio の API の概略
を解説します。

* Menu:

* コルーチン: コルーチン<3>.
* Awaitable::
* Task の作成::
* タスクのキャンセル::
* Task Groups::
* スリープ::
* 並行な Task 実行::
* Eager Task Factory::
* キャンセルからの保護::
* タイムアウト::
* 要素の終了待機::
* スレッド内での実行::
* 外部スレッドからのスケジュール::
* イントロスペクション::
* Task オブジェクト::


File: python.info,  Node: コルーチン<3>,  Next: Awaitable,  Up: コルーチンと Task

5.19.1.6 コルーチン
...................

'Source code:' Lib/asyncio/coroutines.py(1)

__________________________________________________________________

async/await 構文で宣言された *note コルーチン: 6b9. は、 asyncio を使っ
たアプリケーションを書くのに推奨される方法です。例えば、次のコードスニペ
ットは "hello" を出力し、そこから 1 秒待って "world" を出力します:

     >>> import asyncio

     >>> async def main():
     ...     print('hello')
     ...     await asyncio.sleep(1)
     ...     print('world')

     >>> asyncio.run(main())
     hello
     world

単にコルーチンを呼び出しただけでは、コルーチンの実行スケジュールは予約さ
れていないことに注意してください:

     >>> main()
     <coroutine object main at 0x1053bb7c8>

実際にコルーチンを実行するために、asyncio は以下のメカニズムを提供してい
ます:

   * 最上位のエントリーポイントである "main()" 関数を実行する *note
     asyncio.run(): 2f3. 関数 (上の例を参照してください。)

   * コルーチンを await すること。次のコード片は 1 秒間待機した後に
     "hello" と出力し、 '更に' 2 秒間待機してから "world" と出力します:

          import asyncio
          import time

          async def say_after(delay, what):
              await asyncio.sleep(delay)
              print(what)

          async def main():
              print(f"started at {time.strftime('%X')}")

              await say_after(1, 'hello')
              await say_after(2, 'world')

              print(f"finished at {time.strftime('%X')}")

          asyncio.run(main())

     予想される出力:

          started at 17:13:52
          hello
          world
          finished at 17:13:55

   * asyncio の *note Tasks: 1c7. としてコルーチンを並行して走らせる
     *note asyncio.create_task(): 1c9. 関数。

     上のコード例を編集して、ふたつの ‘say_after’ コルーチンを '並行して
     ' 走らせてみましょう:

          async def main():
              task1 = asyncio.create_task(
                  say_after(1, 'hello'))

              task2 = asyncio.create_task(
                  say_after(2, 'world'))

              print(f"started at {time.strftime('%X')}")

              # Wait until both tasks are completed (should take
              # around 2 seconds.)
              await task1
              await task2

              print(f"finished at {time.strftime('%X')}")

     予想される出力が、スニペットの実行が前回よりも 1 秒早いことを示して
     いることに注意してください:

          started at 17:14:32
          hello
          world
          finished at 17:14:34

   * The *note asyncio.TaskGroup: 4d1. class provides a more modern
     alternative to *note create_task(): 1c9.  Using this API, the last
     example becomes:

          async def main():
              async with asyncio.TaskGroup() as tg:
                  task1 = tg.create_task(
                      say_after(1, 'hello'))

                  task2 = tg.create_task(
                      say_after(2, 'world'))

                  print(f"started at {time.strftime('%X')}")

              # The await is implicit when the context manager exits.

              print(f"finished at {time.strftime('%X')}")

     The timing and output should be the same as for the previous
     version.

     Added in version 3.11: *note asyncio.TaskGroup: 4d1.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/coroutines.py


File: python.info,  Node: Awaitable,  Next: Task の作成,  Prev: コルーチン<3>,  Up: コルーチンと Task

5.19.1.7 Awaitable
..................

あるオブジェクトを *note await: 18d. 式の中で使うことができる場合、その
オブジェクトを 'awaitable' オブジェクトと言います。多くの asyncio API は
awaitable を受け取るように設計されています。

'awaitable' オブジェクトには主に3つの種類があります: 'コルーチン',
'Task', そして 'Future' です

コルーチン
..........

Python のコルーチンは 'awaitable' であり、他のコルーチンから待機されるこ
とができます:

     import asyncio

     async def nested():
         return 42

     async def main():
         # Nothing happens if we just call "nested()".
         # A coroutine object is created but not awaited,
         # so it *won't run at all*.
         nested()  # will raise a "RuntimeWarning".

         # Let's do it differently now and await it:
         print(await nested())  # will print "42".

     asyncio.run(main())

     重要: このドキュメントにおいて「コルーチン」という用語は以下2つの密
     接に関連した概念に対して使用できます:

        * 'コルーチン関数': *note async def: 7ed. 関数;

        * 'コルーチンオブジェクト': 'コルーチン関数' を呼び出すと返って
          くるオブジェクト.

Task
....

'Task' は、コルーチンを '並行に' スケジュールするのに使います。

*note asyncio.create_task(): 1c9. のような関数で、コルーチンが 'Task' に
ラップされているとき、自動的にコルーチンは即時実行されるようにスケジュー
ルされます:

     import asyncio

     async def nested():
         return 42

     async def main():
         # Schedule nested() to run soon concurrently
         # with "main()".
         task = asyncio.create_task(nested())

         # "task" can now be used to cancel "nested()", or
         # can simply be awaited to wait until it is complete:
         await task

     asyncio.run(main())

Future
......

*note Future: dc6. は、非同期処理の '最終結果' を表現する特別な '低レベ
ルの' awaitable オブジェクトです。

Future オブジェクトが '待機 (await) されている' とは、Future がどこか他
の場所で解決されるまでコルーチンが待機するということです。

asyncioのFutureオブジェクトを使うと、async/awaitとコールバック形式のコー
ドを併用できます。

通常、アプリケーション水準のコードで Future オブジェクトを作る '必要はあ
りません' 。

Future オブジェクトはライブラリや asyncio のAPIで外部に提供されることも
あり、await （待機）されることができます:

     async def main():
         await function_that_returns_a_future_object()

         # this is also valid:
         await asyncio.gather(
             function_that_returns_a_future_object(),
             some_python_coroutine()
         )

Future オブジェクトを返す低レベル関数の良い例は *note
loop.run_in_executor(): ae6. です。


File: python.info,  Node: Task の作成,  Next: タスクのキャンセル,  Prev: Awaitable,  Up: コルーチンと Task

5.19.1.8 Task の作成
....................

'ソースコード:' Lib/asyncio/tasks.py(1)

__________________________________________________________________

 -- の関数: asyncio.create_task (coro, *, name=None, context=None,
          eager_start=None, **kwargs)

     'coro' *note coroutine: 37b8. を *note Task: 1c7. でラップし、その
     実行をスケジュールします。 Task オブジェクトを返します。

     The full function signature is largely the same as that of the
     *note Task: 1c7. constructor (or factory) - all of the keyword
     arguments to this function are passed through to that interface.

     省略可能なキーワード引数 'context' によって、'coro' を実行するため
     のカスタムの *note contextvars.Context: 177. を指定できます。
     'context' が省略された場合、現在のコンテキストのコピーが作成されま
     す。

     An optional keyword-only 'eager_start' argument allows specifying
     if the task should execute eagerly during the call to create_task,
     or be scheduled later.  If 'eager_start' is not passed the mode set
     by *note loop.set_task_factory(): 1c8. will be used.

     その Task オブジェクトは *note get_running_loop(): d01. から返され
     たループの中で実行されます。現在のスレッドに実行中のループが無い場
     合は、 *note RuntimeError: 244. が送出されます。

          注釈: *note asyncio.TaskGroup.create_task(): 1cb. is a new
          alternative leveraging structural concurrency; it allows for
          waiting for a group of related tasks with strong safety
          guarantees.

          重要: タスクが実行中に消えないように、この関数の結果の参照を保
          存してください。イベントループは弱い参照のみを保持します。ほか
          に参照元のないタスクは、完了していなくてもガーベジコレクション
          される可能性があります。信頼性のある "fire-and-forget" バック
          グラウンドタスクが必要な場合、コレクションを使ってください。

               background_tasks = set()

               for i in range(10):
                   task = asyncio.create_task(some_coro(param=i))

                   # Add task to the set. This creates a strong reference.
                   background_tasks.add(task)

                   # To prevent keeping references to finished tasks forever,
                   # make each task remove its own reference from the set after
                   # completion:
                   task.add_done_callback(background_tasks.discard)

     Added in version 3.7.

     バージョン 3.8 で変更: 'name' パラメータを追加しました。

     バージョン 3.11 で変更: 'context' パラメータを追加しました。

     バージョン 3.14 で変更: Added the 'eager_start' parameter by
     passing on all 'kwargs'.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/asyncio/tasks.py


File: python.info,  Node: タスクのキャンセル,  Next: Task Groups,  Prev: Task の作成,  Up: コルーチンと Task

5.19.1.9 タスクのキャンセル
...........................

タスクは簡単に、そして安全にキャンセルできます。タスクがキャンセルされた
場合、*note asyncio.CancelledError: 4d4. が次の機会に送出されます。

It is recommended that coroutines use ‘try/finally’ blocks to robustly
perform clean-up logic.  In case *note asyncio.CancelledError: 4d4. is
explicitly caught, it should generally be propagated when clean-up is
complete.  *note asyncio.CancelledError: 4d4. directly subclasses *note
BaseException: 7d6. so most code will not need to be aware of it.

The asyncio components that enable structured concurrency, like *note
asyncio.TaskGroup: 4d1. and *note asyncio.timeout(): 814, are
implemented using cancellation internally and might misbehave if a
coroutine swallows *note asyncio.CancelledError: 4d4.  Similarly, user
code should not generally call *note uncancel: 4d6.  However, in cases
when suppressing *note asyncio.CancelledError: 4d4. is truly desired, it
is necessary to also call ‘uncancel()’ to completely remove the
cancellation state.


File: python.info,  Node: Task Groups,  Next: スリープ,  Prev: タスクのキャンセル,  Up: コルーチンと Task

5.19.1.10 Task Groups
.....................

Task groups combine a task creation API with a convenient and reliable
way to wait for all tasks in the group to finish.

 -- クラス: asyncio.TaskGroup

     An *note asynchronous context manager: 812. holding a group of
     tasks.  Tasks can be added to the group using *note create_task():
     1c9.  All tasks are awaited when the context manager exits.

     Added in version 3.11.

      -- メソッド: create_task (coro, *, name=None, context=None,
               eager_start=None, **kwargs)

          Create a task in this task group.  The signature matches that
          of *note asyncio.create_task(): 1c9.  If the task group is
          inactive (e.g.  not yet entered, already finished, or in the
          process of shutting down), we will close the given ‘coro’.

          バージョン 3.13 で変更: Close the given coroutine if the task
          group is not active.

          バージョン 3.14 で変更: Passes on all 'kwargs' to *note
          loop.create_task(): 1ca.

以下はプログラム例です:

     async def main():
         async with asyncio.TaskGroup() as tg:
             task1 = tg.create_task(some_coro(...))
             task2 = tg.create_task(another_coro(...))
         print(f"Both tasks have completed now: {task1.result()}, {task2.result()}")

The ‘async with’ statement will wait for all tasks in the group to
finish.  While waiting, new tasks may still be added to the group (for
example, by passing ‘tg’ into one of the coroutines and calling
‘tg.create_task()’ in that coroutine).  Once the last task has finished
and the ‘async with’ block is exited, no new tasks may be added to the
group.

The first time any of the tasks belonging to the group fails with an
exception other than *note asyncio.CancelledError: 4d4, the remaining
tasks in the group are cancelled.  No further tasks can then be added to
the group.  At this point, if the body of the ‘async with’ statement is
still active (i.e., *note __aexit__(): 19a1. hasn't been called yet),
the task directly containing the ‘async with’ statement is also
cancelled.  The resulting *note asyncio.CancelledError: 4d4. will
interrupt an ‘await’, but it will not bubble out of the containing
‘async with’ statement.

Once all tasks have finished, if any tasks have failed with an exception
other than *note asyncio.CancelledError: 4d4, those exceptions are
combined in an *note ExceptionGroup: 4d2. or *note BaseExceptionGroup:
566. (as appropriate; see their documentation) which is then raised.

Two base exceptions are treated specially: If any task fails with *note
KeyboardInterrupt: bc5. or *note SystemExit: f3c, the task group still
cancels the remaining tasks and waits for them, but then the initial
*note KeyboardInterrupt: bc5. or *note SystemExit: f3c. is re-raised
instead of *note ExceptionGroup: 4d2. or *note BaseExceptionGroup: 566.

If the body of the ‘async with’ statement exits with an exception (so
*note __aexit__(): 19a1. is called with an exception set), this is
treated the same as if one of the tasks failed: the remaining tasks are
cancelled and then waited for, and non-cancellation exceptions are
grouped into an exception group and raised.  The exception passed into
*note __aexit__(): 19a1, unless it is *note asyncio.CancelledError: 4d4,
is also included in the exception group.  The same special case is made
for *note KeyboardInterrupt: bc5. and *note SystemExit: f3c. as in the
previous paragraph.

Task groups are careful not to mix up the internal cancellation used to
"wake up" their *note __aexit__(): 19a1. with cancellation requests for
the task in which they are running made by other parties.  In
particular, when one task group is syntactically nested in another, and
both experience an exception in one of their child tasks simultaneously,
the inner task group will process its exceptions, and then the outer
task group will receive another cancellation and process its own
exceptions.

In the case where a task group is cancelled externally and also must
raise an *note ExceptionGroup: 4d2, it will call the parent task's *note
cancel(): 4d3. method.  This ensures that a *note
asyncio.CancelledError: 4d4. will be raised at the next *note await:
18d, so the cancellation is not lost.

Task groups preserve the cancellation count reported by *note
asyncio.Task.cancelling(): 4d5.

バージョン 3.13 で変更: Improved handling of simultaneous internal and
external cancellations and correct preservation of cancellation counts.

* Menu:

* Terminating a Task Group::


File: python.info,  Node: Terminating a Task Group,  Up: Task Groups

5.19.1.11 Terminating a Task Group
..................................

While terminating a task group is not natively supported by the standard
library, termination can be achieved by adding an exception-raising task
to the task group and ignoring the raised exception:

     import asyncio
     from asyncio import TaskGroup

     class TerminateTaskGroup(Exception):
         """Exception raised to terminate a task group."""

     async def force_terminate_task_group():
         """Used to force termination of a task group."""
         raise TerminateTaskGroup()

     async def job(task_id, sleep_time):
         print(f'Task {task_id}: start')
         await asyncio.sleep(sleep_time)
         print(f'Task {task_id}: done')

     async def main():
         try:
             async with TaskGroup() as group:
                 # spawn some tasks
                 group.create_task(job(1, 0.5))
                 group.create_task(job(2, 1.5))
                 # sleep for 1 second
                 await asyncio.sleep(1)
                 # add an exception-raising task to force the group to terminate
                 group.create_task(force_terminate_task_group())
         except* TerminateTaskGroup:
             pass

     asyncio.run(main())

予想される出力:

     Task 1: start
     Task 2: start
     Task 1: done


File: python.info,  Node: スリープ,  Next: 並行な Task 実行,  Prev: Task Groups,  Up: コルーチンと Task

5.19.1.12 スリープ
..................

 -- の関数: async asyncio.sleep (delay, result=None)

     'delay' 秒だけ停止します。

     'result' が提供されている場合は、コルーチン完了時にそれが呼び出し元
     に返されます。

     ‘sleep()’ は常に現在の Task を一時中断し、他の Task が実行されるの
     を許可します。

     delay を 0 に設定することで、他のタスクを実行可能にする最適な方針を
     提供します。この方法は、実行時間の長い関数が、その実行時間全体にわ
     たってイベントループをブロックしないようにするために利用できます。
     現在の時刻を5秒間、毎秒表示するコルーチンの例:

          import asyncio
          import datetime

          async def display_date():
              loop = asyncio.get_running_loop()
              end_time = loop.time() + 5.0
              while True:
                  print(datetime.datetime.now())
                  if (loop.time() + 1.0) >= end_time:
                      break
                  await asyncio.sleep(1)

          asyncio.run(display_date())

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     バージョン 3.13 で変更: Raises *note ValueError: 2ec. if 'delay' is
     *note nan: 873.


File: python.info,  Node: 並行な Task 実行,  Next: Eager Task Factory,  Prev: スリープ,  Up: コルーチンと Task

5.19.1.13 並行な Task 実行
..........................

 -- の関数: awaitable asyncio.gather (*aws, return_exceptions=False)

     'aws' シーケンスにある *note awaitable オブジェクト: 37cf. を '並行
     ' 実行します。

     'aws' にある awaitable がコルーチンである場合、自動的に Task として
     スケジュールされます。

     全ての awaitable が正常終了した場合、その結果は返り値を集めたリスト
     になります。 返り値の順序は、 'aws' での awaitable の順序に相当しま
     す。

     'return_exceptions' が ‘False’ である場合(デフォルト)、‘gather()’ で
     await しているタスクに対して、最初の例外が直接伝えられます。'aws' に
     並んでいる他の awaitable は、'キャンセルされずに' 引き続いて実行さ
     れます。

     'return_exceptions' が ‘True’ だった場合、例外は成功した結果と同じ
     ように取り扱われ、結果リストに集められます。

     ‘gather()’ が 'キャンセル' された場合、起動された全ての (未完了の)
     awaitable も 'キャンセル' されます。

     'aws' シーケンスにある Task あるいは Future が 'キャンセル' された
     場合、 *note CancelledError: 4d4. を送出したかのうように扱われます
     。つまり、この場合 ‘gather()’ 呼び出しはキャンセル 'されません'。 こ
     れは、起動された 1 つの Task あるいは Future のキャンセルが、他の
     Task あるいは Future のキャンセルを引き起こすのを避けるためです。

          注釈: A new alternative to create and run tasks concurrently
          and wait for their completion is *note asyncio.TaskGroup: 4d1.
          'TaskGroup' provides stronger safety guarantees than 'gather'
          for scheduling a nesting of subtasks: if a task (or a subtask,
          a task scheduled by a task) raises an exception, 'TaskGroup'
          will, while 'gather' will not, cancel the remaining scheduled
          tasks).
     以下はプログラム例です:

          import asyncio

          async def factorial(name, number):
              f = 1
              for i in range(2, number + 1):
                  print(f"Task {name}: Compute factorial({number}), currently i={i}...")
                  await asyncio.sleep(1)
                  f *= i
              print(f"Task {name}: factorial({number}) = {f}")
              return f

          async def main():
              # Schedule three calls *concurrently*:
              L = await asyncio.gather(
                  factorial("A", 2),
                  factorial("B", 3),
                  factorial("C", 4),
              )
              print(L)

          asyncio.run(main())

          # Expected output:
          #
          #     Task A: Compute factorial(2), currently i=2...
          #     Task B: Compute factorial(3), currently i=2...
          #     Task C: Compute factorial(4), currently i=2...
          #     Task A: factorial(2) = 2
          #     Task B: Compute factorial(3), currently i=3...
          #     Task C: Compute factorial(4), currently i=3...
          #     Task B: factorial(3) = 6
          #     Task C: Compute factorial(4), currently i=4...
          #     Task C: factorial(4) = 24
          #     [2, 6, 24]

          注釈: If 'return_exceptions' is false, cancelling gather()
          after it has been marked done won't cancel any submitted
          awaitables.  For instance, gather can be marked done after
          propagating an exception to the caller, therefore, calling
          ‘gather.cancel()’ after catching an exception (raised by one
          of the awaitables) from gather won't cancel any other
          awaitables.

     バージョン 3.7 で変更: 'gather' 自身がキャンセルされた場合は、
     'return_exceptions' の値に関わらずキャンセルが伝搬されます。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     バージョン 3.10 で非推奨: Deprecation warning is emitted if no
     positional arguments are provided or not all positional arguments
     are Future-like objects and there is no running event loop.


File: python.info,  Node: Eager Task Factory,  Next: キャンセルからの保護,  Prev: 並行な Task 実行,  Up: コルーチンと Task

5.19.1.14 Eager Task Factory
............................

 -- の関数: asyncio.eager_task_factory (loop, coro, *, name=None,
          context=None)

     A task factory for eager task execution.

     When using this factory (via *note
     loop.set_task_factory(asyncio.eager_task_factory): 1c8.),
     coroutines begin execution synchronously during *note Task: 1c7.
     construction.  Tasks are only scheduled on the event loop if they
     block.  This can be a performance improvement as the overhead of
     loop scheduling is avoided for coroutines that complete
     synchronously.

     A common example where this is beneficial is coroutines which
     employ caching or memoization to avoid actual I/O when possible.

          注釈: Immediate execution of the coroutine is a semantic
          change.  If the coroutine returns or raises, the task is never
          scheduled to the event loop.  If the coroutine execution
          blocks, the task is scheduled to the event loop.  This change
          may introduce behavior changes to existing applications.  For
          example, the application's task execution order is likely to
          change.

     Added in version 3.12.

 -- の関数: asyncio.create_eager_task_factory (custom_task_constructor)

     Create an eager task factory, similar to *note
     eager_task_factory(): 6a2, using the provided
     'custom_task_constructor' when creating a new task instead of the
     default *note Task: 1c7.

     'custom_task_constructor' must be a 'callable' with the signature
     matching the signature of *note Task.__init__: 1c7.  The callable
     must return a *note asyncio.Task: 1c7.-compatible object.

     This function returns a 'callable' intended to be used as a task
     factory of an event loop via *note loop.set_task_factory(factory):
     1c8.).

     Added in version 3.12.


File: python.info,  Node: キャンセルからの保護,  Next: タイムアウト,  Prev: Eager Task Factory,  Up: コルーチンと Task

5.19.1.15 キャンセルからの保護
..............................

 -- の関数: awaitable asyncio.shield (aw)

     *note キャンセル: 4d3. から *note awaitable オブジェクト: 37cf. を
     保護します。

     'aw' がコルーチンだった場合、自動的に Task としてスケジュールされま
     す。

     文:

          task = asyncio.create_task(something())
          res = await shield(task)

     は、以下と同じです

          res = await something()

     それを含むコルーチンがキャンセルされた場合を '除き'、‘something()’
     内で動作している Task はキャンセルされません。 ‘something()’ 側から
     見るとキャンセルは発生しません。 呼び出し元がキャンセルされた場合で
     も、 "await" 式は *note CancelledError: 4d4. を送出します。

     注意: ‘something()’ が他の理由 (例えば、原因が自分自身) でキャンセ
     ルされた場合は ‘shield()’ でも保護できません。

     完全にキャンセルを無視したい場合 (推奨はしません) は、 ‘shield()’ 関
     数は次のように try/except 節と組み合わせることになるでしょう:

          task = asyncio.create_task(something())
          try:
              res = await shield(task)
          except CancelledError:
              res = None

          重要: Save a reference to tasks passed to this function, to
          avoid a task disappearing mid-execution.  The event loop only
          keeps weak references to tasks.  A task that isn't referenced
          elsewhere may get garbage collected at any time, even before
          it's done.

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     バージョン 3.10 で非推奨: Deprecation warning is emitted if 'aw' is
     not Future-like object and there is no running event loop.


File: python.info,  Node: タイムアウト,  Next: 要素の終了待機,  Prev: キャンセルからの保護,  Up: コルーチンと Task

5.19.1.16 タイムアウト
......................

 -- の関数: asyncio.timeout (delay)

     Return an *note asynchronous context manager: 812. that can be used
     to limit the amount of time spent waiting on something.

     'delay' can either be ‘None’, or a float/int number of seconds to
     wait.  If 'delay' is ‘None’, no time limit will be applied; this
     can be useful if the delay is unknown when the context manager is
     created.

     In either case, the context manager can be rescheduled after
     creation using *note Timeout.reschedule(): 37de.

     以下はプログラム例です:

          async def main():
              async with asyncio.timeout(10):
                  await long_running_task()

     If ‘long_running_task’ takes more than 10 seconds to complete, the
     context manager will cancel the current task and handle the
     resulting *note asyncio.CancelledError: 4d4. internally,
     transforming it into a *note TimeoutError: a36. which can be caught
     and handled.

          注釈: The *note asyncio.timeout(): 814. context manager is
          what transforms the *note asyncio.CancelledError: 4d4. into a
          *note TimeoutError: a36, which means the *note TimeoutError:
          a36. can only be caught 'outside' of the context manager.

     Example of catching *note TimeoutError: a36.:

          async def main():
              try:
                  async with asyncio.timeout(10):
                      await long_running_task()
              except TimeoutError:
                  print("The long operation timed out, but we've handled it.")

              print("This statement will run regardless.")

     The context manager produced by *note asyncio.timeout(): 814. can
     be rescheduled to a different deadline and inspected.

      -- クラス: asyncio.Timeout (when)

          An *note asynchronous context manager: 812. for cancelling
          overdue coroutines.

          Prefer using *note asyncio.timeout(): 814. or *note
          asyncio.timeout_at(): 1bb3. rather than instantiating
          ‘Timeout’ directly.

          ‘when’ should be an absolute time at which the context should
          time out, as measured by the event loop's clock:

             - If ‘when’ is ‘None’, the timeout will never trigger.

             - If ‘when < loop.time()’, the timeout will trigger on the
               next iteration of the event loop.

                -- メソッド: when () -> float | None

                    Return the current deadline, or ‘None’ if the
                    current deadline is not set.

                -- メソッド: reschedule (when: float | None)

                    Reschedule the timeout.

                -- メソッド: expired () -> bool

                    Return whether the context manager has exceeded its
                    deadline (expired).

     以下はプログラム例です:

          async def main():
              try:
                  # We do not know the timeout when starting, so we pass ``None``.
                  async with asyncio.timeout(None) as cm:
                      # We know the timeout now, so we reschedule it.
                      new_deadline = get_running_loop().time() + 10
                      cm.reschedule(new_deadline)

                      await long_running_task()
              except TimeoutError:
                  pass

              if cm.expired():
                  print("Looks like we haven't finished on time.")

     Timeout context managers can be safely nested.

     Added in version 3.11.

 -- の関数: asyncio.timeout_at (when)

     Similar to *note asyncio.timeout(): 814, except 'when' is the
     absolute time to stop waiting, or ‘None’.

     以下はプログラム例です:

          async def main():
              loop = get_running_loop()
              deadline = loop.time() + 20
              try:
                  async with asyncio.timeout_at(deadline):
                      await long_running_task()
              except TimeoutError:
                  print("The long operation timed out, but we've handled it.")

              print("This statement will run regardless.")

     Added in version 3.11.

 -- の関数: async asyncio.wait_for (aw, timeout)

     'aw' *note awaitable: 37cf. が、完了するかタイムアウトになるのを待
     ちます。

     'aw' がコルーチンだった場合、自動的に Task としてスケジュールされま
     す。

     'timeout' には ‘None’ もしくは待つ秒数の浮動小数点数か整数を指定で
     きます。 'timeout' が ‘None’ の場合、 Future が完了するまで待ちます
     。

     If a timeout occurs, it cancels the task and raises *note
     TimeoutError: a36.

     Task の *note キャンセル: 4d3. を避けるためには、 *note shield():
     c65. の中にラップしてください。

     この関数は future が実際にキャンセルされるまで待つため、待ち時間の
     合計は 'timeout' を超えることがあります。キャンセル中に例外が発生し
     た場合は、その例外は伝達されます。

     待機が中止された場合 'aw' も中止されます。 以下はプログラム例です:

          async def eternity():
              # Sleep for one hour
              await asyncio.sleep(3600)
              print('yay!')

          async def main():
              # Wait for at most 1 second
              try:
                  await asyncio.wait_for(eternity(), timeout=1.0)
              except TimeoutError:
                  print('timeout!')

          asyncio.run(main())

          # Expected output:
          #
          #     timeout!

     バージョン 3.7 で変更: When 'aw' is cancelled due to a timeout,
     ‘wait_for’ waits for 'aw' to be cancelled.  Previously, it raised
     *note TimeoutError: a36. immediately.

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     バージョン 3.11 で変更: Raises *note TimeoutError: a36. instead of
     *note asyncio.TimeoutError: 1ab5.


File: python.info,  Node: 要素の終了待機,  Next: スレッド内での実行,  Prev: タイムアウト,  Up: コルーチンと Task

5.19.1.17 要素の終了待機
........................

 -- の関数: async asyncio.wait (aws, *, timeout=None,
          return_when=ALL_COMPLETED)

     Run *note Future: dc6. and *note Task: 1c7. instances in the 'aws'
     iterable concurrently and block until the condition specified by
     'return_when'.

     イテラブル 'aws' は空であってはなりません。

     Task/Future からなる 2 つの集合 ‘(done, pending)’ を返します。

     使い方:

          done, pending = await asyncio.wait(aws)

     'timeout' (浮動小数点数または整数) が指定されていたら、処理を返すの
     を待つ最大秒数を制御するのに使われます。

     Note that this function does not raise *note TimeoutError: a36.
     Futures or Tasks that aren't done when the timeout occurs are
     simply returned in the second set.

     'return_when' でこの関数がいつ結果を返すか指定します。指定できる値
     は以下の 定数のどれか一つです:

     定数                                                   説明
                                                            
     --------------------------------------------------------------------------------------------------------------
                                                            
      -- データ: asyncio.FIRST_COMPLETED                    いずれかのフューチャが終了したかキャンセルされたとき
                                                            に返します。
                                                            
                                                            
      -- データ: asyncio.FIRST_EXCEPTION                    The function will return when any future finishes by
                                                            raising an exception.  If no future raises an
                                                            exception then it is equivalent to
                                                            *note ALL_COMPLETED: 37e5.
                                                            
                                                            
      -- データ: asyncio.ALL_COMPLETED                      すべてのフューチャが終了したかキャンセルされたときに
                                                            返します。
                                                            

     *note wait_for(): 815. と異なり、 ‘wait()’ はタイムアウトが起きたと
     きに Future をキャンセルしません。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     バージョン 3.11 で変更: Passing coroutine objects to ‘wait()’
     directly is forbidden.

     バージョン 3.12 で変更: Added support for generators yielding
     tasks.

 -- の関数: asyncio.as_completed (aws, *, timeout=None)

     Run *note awaitable objects: 37cf. in the 'aws' iterable
     concurrently.  The returned object can be iterated to obtain the
     results of the awaitables as they finish.

     The object returned by ‘as_completed()’ can be iterated as an *note
     asynchronous iterator: 4c7. or a plain *note iterator: 4c8.  When
     asynchronous iteration is used, the originally-supplied awaitables
     are yielded if they are tasks or futures.  This makes it easy to
     correlate previously-scheduled tasks with their results.  Example:

          ipv4_connect = create_task(open_connection("127.0.0.1", 80))
          ipv6_connect = create_task(open_connection("::1", 80))
          tasks = [ipv4_connect, ipv6_connect]

          async for earliest_connect in as_completed(tasks):
              # earliest_connect is done. The result can be obtained by
              # awaiting it or calling earliest_connect.result()
              reader, writer = await earliest_connect

              if earliest_connect is ipv6_connect:
                  print("IPv6 connection established.")
              else:
                  print("IPv4 connection established.")

     During asynchronous iteration, implicitly-created tasks will be
     yielded for supplied awaitables that aren't tasks or futures.

     When used as a plain iterator, each iteration yields a new
     coroutine that returns the result or raises the exception of the
     next completed awaitable.  This pattern is compatible with Python
     versions older than 3.13:

          ipv4_connect = create_task(open_connection("127.0.0.1", 80))
          ipv6_connect = create_task(open_connection("::1", 80))
          tasks = [ipv4_connect, ipv6_connect]

          for next_connect in as_completed(tasks):
              # next_connect is not one of the original task objects. It must be
              # awaited to obtain the result value or raise the exception of the
              # awaitable that finishes next.
              reader, writer = await next_connect

     A *note TimeoutError: a36. is raised if the timeout occurs before
     all awaitables are done.  This is raised by the ‘async for’ loop
     during asynchronous iteration or by the coroutines yielded during
     plain iteration.

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     バージョン 3.10 で非推奨: Deprecation warning is emitted if not all
     awaitable objects in the 'aws' iterable are Future-like objects and
     there is no running event loop.

     バージョン 3.12 で変更: Added support for generators yielding
     tasks.

     バージョン 3.13 で変更: The result can now be used as either an
     *note asynchronous iterator: 4c7. or as a plain *note iterator:
     4c8. (previously it was only a plain iterator).


File: python.info,  Node: スレッド内での実行,  Next: 外部スレッドからのスケジュール,  Prev: 要素の終了待機,  Up: コルーチンと Task

5.19.1.18 スレッド内での実行
............................

 -- の関数: async asyncio.to_thread (func, /, *args, **kwargs)

     別のスレッドで非同期的に関数 'func' を実行します。

     この関数に渡された *args と **kwargs は関数 'func' に直接渡されます
     。また、イベントループスレッドのコンテキスト変数に関数を実行するス
     レッドからアクセスできるように、現在の *note contextvars.Context:
     177. も伝播されます。

     関数 'func' の最終結果を待ち受けできるコルーチンを返します。

     This coroutine function is primarily intended to be used for
     executing IO-bound functions/methods that would otherwise block the
     event loop if they were run in the main thread.  For example:

          def blocking_io():
              print(f"start blocking_io at {time.strftime('%X')}")
              # Note that time.sleep() can be replaced with any blocking
              # IO-bound operation, such as file operations.
              time.sleep(1)
              print(f"blocking_io complete at {time.strftime('%X')}")

          async def main():
              print(f"started main at {time.strftime('%X')}")

              await asyncio.gather(
                  asyncio.to_thread(blocking_io),
                  asyncio.sleep(1))

              print(f"finished main at {time.strftime('%X')}")


          asyncio.run(main())

          # Expected output:
          #
          # started main at 19:50:53
          # start blocking_io at 19:50:53
          # blocking_io complete at 19:50:54
          # finished main at 19:50:54

     Directly calling ‘blocking_io()’ in any coroutine would block the
     event loop for its duration, resulting in an additional 1 second of
     run time.  Instead, by using ‘asyncio.to_thread()’, we can run it
     in a separate thread without blocking the event loop.

          注釈: Due to the *note GIL: 164, ‘asyncio.to_thread()’ can
          typically only be used to make IO-bound functions
          non-blocking.  However, for extension modules that release the
          GIL or alternative Python implementations that don't have one,
          ‘asyncio.to_thread()’ can also be used for CPU-bound
          functions.

     Added in version 3.9.


File: python.info,  Node: 外部スレッドからのスケジュール,  Next: イントロスペクション,  Prev: スレッド内での実行,  Up: コルーチンと Task

5.19.1.19 外部スレッドからのスケジュール
........................................

 -- の関数: asyncio.run_coroutine_threadsafe (coro, loop)

     与えられたイベントループにコルーチンを送ります。 この処理は、スレッ
     ドセーフです。

     他の OS スレッドから結果を待つための *note
     concurrent.futures.Future: 13ca. を返します。

     この関数は、イベントループが動作しているスレッドとは異なる OS スレ
     ッドから呼び出すためのものです。 例えば次のように使います:

          def in_thread(loop: asyncio.AbstractEventLoop) -> None:
              # Run some blocking IO
              pathlib.Path("example.txt").write_text("hello world", encoding="utf8")

              # Create a coroutine
              coro = asyncio.sleep(1, result=3)

              # Submit the coroutine to a given loop
              future = asyncio.run_coroutine_threadsafe(coro, loop)

              # Wait for the result with an optional timeout argument
              assert future.result(timeout=2) == 3

          async def amain() -> None:
              # Get the running loop
              loop = asyncio.get_running_loop()

              # Run something in a thread
              await asyncio.to_thread(in_thread, loop)

     It's also possible to run the other way around.  Example:

          @contextlib.contextmanager
          def loop_in_thread() -> Generator[asyncio.AbstractEventLoop]:
              loop_fut = concurrent.futures.Future[asyncio.AbstractEventLoop]()
              stop_event = asyncio.Event()

              async def main() -> None:
                  loop_fut.set_result(asyncio.get_running_loop())
                  await stop_event.wait()

              with concurrent.futures.ThreadPoolExecutor(1) as tpe:
                  complete_fut = tpe.submit(asyncio.run, main())
                  for fut in concurrent.futures.as_completed((loop_fut, complete_fut)):
                      if fut is loop_fut:
                          loop = loop_fut.result()
                          try:
                              yield loop
                          finally:
                              loop.call_soon_threadsafe(stop_event.set)
                      else:
                          fut.result()

          # Create a loop in another thread
          with loop_in_thread() as loop:
              # Create a coroutine
              coro = asyncio.sleep(1, result=3)

              # Submit the coroutine to a given loop
              future = asyncio.run_coroutine_threadsafe(coro, loop)

              # Wait for the result with an optional timeout argument
              assert future.result(timeout=2) == 3

     コルーチンから例外が送出された場合、返された Future に通知されます
     。 これはイベントループの Task をキャンセルするのにも使えます:

          try:
              result = future.result(timeout)
          except TimeoutError:
              print('The coroutine took too long, cancelling the task...')
              future.cancel()
          except Exception as exc:
              print(f'The coroutine raised an exception: {exc!r}')
          else:
              print(f'The coroutine returned: {result!r}')

     このドキュメントの *note 並行処理とマルチスレッド処理: 37e8. 節を参
     照してください。

     他の asyncio 関数とは異なり、この関数は明示的に渡される 'loop' 引数
     を必要とします。

     Added in version 3.5.1.


File: python.info,  Node: イントロスペクション,  Next: Task オブジェクト,  Prev: 外部スレッドからのスケジュール,  Up: コルーチンと Task

5.19.1.20 イントロスペクション
..............................

 -- の関数: asyncio.current_task (loop=None)

     現在実行中の *note Task: 1c7. インスタンスを返します。実行中の Task
     が無い場合は ‘None’ を返します。

     'loop' が ‘None’ の場合、 *note get_running_loop(): d01. が現在のル
     ープを取得するのに使われます。

     Added in version 3.7.

 -- の関数: asyncio.all_tasks (loop=None)

     ループで実行された *note Task: 1c7. オブジェクトでまだ完了していな
     いものの集合を返します。

     'loop' が ‘None’ の場合、 *note get_running_loop(): d01. は現在のル
     ープを取得するのに使われます。

     Added in version 3.7.

 -- の関数: asyncio.iscoroutine (obj)

     Return ‘True’ if 'obj' is a coroutine object.

     Added in version 3.4.


File: python.info,  Node: Task オブジェクト,  Prev: イントロスペクション,  Up: コルーチンと Task

5.19.1.21 Task オブジェクト
...........................

 -- クラス: asyncio.Task (coro, *, loop=None, name=None, context=None,
          eager_start=False)

     Python *note コルーチン: 37b8. を実行する *note Future 類: dc6. オ
     ブジェクトです。 スレッドセーフではありません。

     Task はイベントループのコルーチンを実行するのに使われます。 Future
     でコルーチンが待機している場合、 Task は自身のコルーチンの実行を一
     時停止させ、 Future の完了を待ちます。 Future が '完了' したら、
     Task が内包しているコルーチンの実行を再開します。

     イベントループは協調スケジューリングを使用します。つまり、イベント
     ループは同時に 1 つの Task のみ実行します。 Task が Future の完了を
     待っているときは、イベントループは他の Task やコールバックを動作さ
     せるか、 IO 処理を実行します。

     Task を作成するには高レベルの *note asyncio.create_task(): 1c9. 関
     数、あるいは低レベルの *note loop.create_task(): 1ca. 関数や *note
     ensure_future(): e71. 関数を使用してください。 手作業での Task の実
     装は推奨されません。

     実行中のタスクをキャンセルするためには、*note cancel(): 4d3. メソッ
     ドを使用します。このメソッドを呼ぶと、タスクはそれを内包するコルー
     チンに対して *note CancelledError: 4d4. 例外を送出します。キャンセ
     ルの際にコルーチンが Future オブジェクトを待っていた場合、その
     Future オブジェクトはキャンセルされます。

     *note cancelled(): 37ec. は、タスクがキャンセルされたかを調べるのに
     使用できます。タスクを内包するコルーチンで *note CancelledError:
     4d4. 例外が抑制されておらず、かつタスクが実際にキャンセルされている
     場合に、このメソッドは ‘True’ を変えます。

     *note asyncio.Task: 1c7. は、*note Future.set_result(): 37ed. と
     *note Future.set_exception(): e78. を除いて、*note Future: dc6. の
     API をすべて継承しています。

     An optional keyword-only 'context' argument allows specifying a
     custom *note contextvars.Context: 177. for the 'coro' to run in.
     If no 'context' is provided, the Task copies the current context
     and later runs its coroutine in the copied context.

     An optional keyword-only 'eager_start' argument allows eagerly
     starting the execution of the *note asyncio.Task: 1c7. at task
     creation time.  If set to ‘True’ and the event loop is running, the
     task will start executing the coroutine immediately, until the
     first time the coroutine blocks.  If the coroutine returns or
     raises without blocking, the task will be finished eagerly and will
     skip scheduling to the event loop.

     バージョン 3.7 で変更: *note contextvars: 28. モジュールのサポート
     を追加。

     バージョン 3.8 で変更: 'name' パラメータを追加しました。

     バージョン 3.10 で非推奨: Deprecation warning is emitted if 'loop'
     is not specified and there is no running event loop.

     バージョン 3.11 で変更: 'context' パラメータを追加しました。

     バージョン 3.12 で変更: Added the 'eager_start' parameter.

      -- メソッド: done ()

          Task が '完了' しているなら ‘True’ を返します。

          Task がラップしているコルーチンが値を返すか、例外を送出するか
          、または Task がキャンセルされたとき、 Task は '完了' します。

      -- メソッド: result ()

          Task の結果を返します。

          Task が '完了' している場合、ラップしているコルーチンの結果が
          返されます (コルーチンが例外を送出された場合、その例外が例外が
          再送出されます)

          Task が 'キャンセル' されている場合、このメソッドは *note
          CancelledError: 4d4. 例外を送出します。

          If the Task's result isn't yet available, this method raises
          an *note InvalidStateError: 37f0. exception.

      -- メソッド: exception ()

          Task の例外を返します。

          ラップされたコルーチンが例外を送出した場合、その例外が返されま
          す。ラップされたコルーチンが正常終了した場合、このメソッドは
          ‘None’ を返します。

          Task が 'キャンセル' されている場合、このメソッドは *note
          CancelledError: 4d4. 例外を送出します。

          Task がまだ '完了' していない場合、このメソッドは *note
          InvalidStateError: 37f0. 例外を送出します。

      -- メソッド: add_done_callback (callback, *, context=None)

          Task が '完了' したときに実行されるコールバックを追加します。

          このメソッドは低水準のコールバックベースのコードでのみ使うべき
          です。

          詳細については *note Future.add_done_callback(): cfe. のドキュ
          メントを参照してください。

      -- メソッド: remove_done_callback (callback)

          コールバックリストから 'callback' を削除します。

          このメソッドは低水準のコールバックベースのコードでのみ使うべき
          です。

          詳細については *note Future.remove_done_callback(): 1911. のド
          キュメントを参照してください。

      -- メソッド: get_stack (*, limit=None)

          このタスクのスタックフレームのリストを返します。

          コルーチンが完了していない場合、これはサスペンドされた時点での
          スタックを返します。コルーチンが正常に処理を完了したか、キャン
          セルされていた場合は空のリストを返します。コルーチンが例外で終
          了した場合はトレースバックフレームのリストを返します。

          フレームは常に古いものから新しい物へ並んでいます。

          サスペンドされているコルーチンの場合スタックフレームが 1 個だ
          け返されます。

          オプション引数 'limit' は返すフレームの最大数を指定します; デ
          フォルトでは取得可能な全てのフレームを返します。返されるリスト
          の順番は、スタックが返されるか、トレースバックが返されるかによ
          って変わります: スタックでは新しい順に並んだリストが返されます
          が、トレースバックでは古い順に並んだリストが返されます（これは
          traceback モジュールの振る舞いと一致します）。

      -- メソッド: print_stack (*, limit=None, file=None)

          このタスクのスタックまたはトレースバックを出力します。

          このメソッドは *note get_stack(): 37f4. によって取得されるフレ
          ームに対し、 traceback モジュールと同じような出力を生成します
          。

          引数 'limit' は *note get_stack(): 37f4. にそのまま渡されます
          。

          The 'file' argument is an I/O stream to which the output is
          written; by default output is written to *note sys.stdout:
          ccd.

      -- メソッド: get_coro ()

          *note Task: 1c7. がラップしているコルーチンオブジェクトを返し
          ます。

               注釈: This will return ‘None’ for Tasks which have
               already completed eagerly.  See the *note Eager Task
               Factory: 37da.

          Added in version 3.8.

          バージョン 3.12 で変更: Newly added eager task execution means
          result may be ‘None’.

      -- メソッド: get_context ()

          Return the *note contextvars.Context: 177. object associated
          with the task.

          Added in version 3.12.

      -- メソッド: get_name ()

          Task の名前を返します。

          Task に対して明示的に名前が設定されていない場合, デフォルトの
          asyncio Task 実装はタスクをインスタンス化する際にデフォルトの
          名前を生成します。

          Added in version 3.8.

      -- メソッド: set_name (value)

          Task に名前を設定します。

          引数 'value' は文字列に変換可能なオブジェクトであれば何でもか
          まいません。

          Task のデフォルト実装では、名前はオブジェクトの *note repr():
          1c1. メソッドの出力で確認できます。

          Added in version 3.8.

      -- メソッド: cancel (msg=None)

          このタスクに、自身のキャンセルを要求します。

          If the Task is already 'done' or 'cancelled', return ‘False’,
          otherwise, return ‘True’.

          The method arranges for a *note CancelledError: 4d4. exception
          to be thrown into the wrapped coroutine on the next cycle of
          the event loop.

          The coroutine then has a chance to clean up or even deny the
          request by suppressing the exception with a *note try: 8f8.
          ...  ...  ‘except CancelledError’ ...  *note finally: 1b0.
          block.  Therefore, unlike *note Future.cancel(): 1ba9, *note
          Task.cancel(): 4d3. does not guarantee that the Task will be
          cancelled, although suppressing cancellation completely is not
          common and is actively discouraged.  Should the coroutine
          nevertheless decide to suppress the cancellation, it needs to
          call *note Task.uncancel(): 4d6. in addition to catching the
          exception.

          バージョン 3.9 で変更: Added the 'msg' parameter.

          バージョン 3.11 で変更: The ‘msg’ parameter is propagated from
          cancelled task to its awaiter.

          以下の例は、コルーチンがどのようにしてキャンセルのリクエストを
          阻止するかを示しています:

               async def cancel_me():
                   print('cancel_me(): before sleep')

                   try:
                       # Wait for 1 hour
                       await asyncio.sleep(3600)
                   except asyncio.CancelledError:
                       print('cancel_me(): cancel sleep')
                       raise
                   finally:
                       print('cancel_me(): after sleep')

               async def main():
                   # Create a "cancel_me" Task
                   task = asyncio.create_task(cancel_me())

                   # Wait for 1 second
                   await asyncio.sleep(1)

                   task.cancel()
                   try:
                       await task
                   except asyncio.CancelledError:
                       print("main(): cancel_me is cancelled now")

               asyncio.run(main())

               # Expected output:
               #
               #     cancel_me(): before sleep
               #     cancel_me(): cancel sleep
               #     cancel_me(): after sleep
               #     main(): cancel_me is cancelled now

      -- メソッド: cancelled ()

          Task が 'キャンセルされた' 場合に ‘True’ を返します。

          *note cancel(): 4d3. メソッドによりキャンセルがリクエストされ
          、かつ Task がラップしているコルーチンが内部で送出された *note
          CancelledError: 4d4. 例外を伝達したとき、 Task は実際に 'キャ
          ンセル' されます。

      -- メソッド: uncancel ()

          Decrement the count of cancellation requests to this Task.

          Returns the remaining number of cancellation requests.

          Note that once execution of a cancelled task completed,
          further calls to *note uncancel(): 4d6. are ineffective.

          Added in version 3.11.

          This method is used by asyncio's internals and isn't expected
          to be used by end-user code.  In particular, if a Task gets
          successfully uncancelled, this allows for elements of
          structured concurrency like *note Task Groups: 37d4. and *note
          asyncio.timeout(): 814. to continue running, isolating
          cancellation to the respective structured block.  For example:

               async def make_request_with_timeout():
                   try:
                       async with asyncio.timeout(1):
                           # Structured block affected by the timeout:
                           await make_request()
                           await make_another_request()
                   except TimeoutError:
                       log("There was a timeout")
                   # Outer code not affected by the timeout:
                   await unrelated_code()

          While the block with ‘make_request()’ and
          ‘make_another_request()’ might get cancelled due to the
          timeout, ‘unrelated_code()’ should continue running even in
          case of the timeout.  This is implemented with *note
          uncancel(): 4d6.  *note TaskGroup: 4d1. context managers use
          *note uncancel(): 4d6. in a similar fashion.

          If end-user code is, for some reason, suppressing cancellation
          by catching *note CancelledError: 4d4, it needs to call this
          method to remove the cancellation state.

          When this method decrements the cancellation count to zero,
          the method checks if a previous *note cancel(): 4d3. call had
          arranged for *note CancelledError: 4d4. to be thrown into the
          task.  If it hasn't been thrown yet, that arrangement will be
          rescinded (by resetting the internal ‘_must_cancel’ flag).

     バージョン 3.13 で変更: Changed to rescind pending cancellation
     requests upon reaching zero.

      -- メソッド: cancelling ()

          Return the number of pending cancellation requests to this
          Task, i.e., the number of calls to *note cancel(): 4d3. less
          the number of *note uncancel(): 4d6. calls.

          Note that if this number is greater than zero but the Task is
          still executing, *note cancelled(): 37ec. will still return
          ‘False’.  This is because this number can be lowered by
          calling *note uncancel(): 4d6, which can lead to the task not
          being cancelled after all if the cancellation requests go down
          to zero.

          This method is used by asyncio's internals and isn't expected
          to be used by end-user code.  See *note uncancel(): 4d6. for
          more details.

          Added in version 3.11.


File: python.info,  Node: ストリーム,  Next: 同期プリミティブ<2>,  Prev: コルーチンと Task,  Up: asyncio --- 非同期 I/O

5.19.1.22 ストリーム
....................

'ソースコード:' Lib/asyncio/streams.py(1)

__________________________________________________________________

ストリームはネットワークコネクションと合わせて動作する高水準の
async/await 可能な基本要素です。ストリームはコールバックや低水準のプロト
コルやトランスポートを使うことなくデータを送受信することを可能にします。
以下は asyncio ストリームを使って書いた TCP エコークライアントの例です:

     import asyncio

     async def tcp_echo_client(message):
         reader, writer = await asyncio.open_connection(
             '127.0.0.1', 8888)

         print(f'Send: {message!r}')
         writer.write(message.encode())
         await writer.drain()

         data = await reader.read(100)
         print(f'Received: {data.decode()!r}')

         print('Close the connection')
         writer.close()
         await writer.wait_closed()

     asyncio.run(tcp_echo_client('Hello World!'))

下記の *note 使用例: 37fb. 節も参照してください。

ストリーム関数
..............

以下の asyncio のトップレベル関数はストリームの作成や操作を行うことがで
きます:

 -- の関数: async asyncio.open_connection (host=None, port=None, *,
          limit=None, ssl=None, family=0, proto=0, flags=0, sock=None,
          local_addr=None, server_hostname=None,
          ssl_handshake_timeout=None, ssl_shutdown_timeout=None,
          happy_eyeballs_delay=None, interleave=None)

     ネットワークコネクションを確立し、 ‘(reader, writer)’ のオブジェク
     トのペアを返します。

     戻り値の 'reader' と 'writer' はそれぞれ *note StreamReader: 1c7d.
     と *note StreamWriter: 1a70. クラスのインスタンスです。

     'limit' は戻り値の *note StreamReader: 1c7d. インスタンスが利用する
     バッファのサイズの上限値を設定します。デフォルトでは 'limit' は 64
     KiB に設定されます。

     残りの引数は直接 *note loop.create_connection(): 818. に渡されます
     。

          注釈: The 'sock' argument transfers ownership of the socket to
          the *note StreamWriter: 1a70. created.  To close the socket,
          call its *note close(): 37fc. method.

     バージョン 3.7 で変更: 'ssl_handshake_timeout' 引数が追加されました
     。

     バージョン 3.8 で変更: 'happy_eyeballs_delay' と 'interleave' が追
     加されました。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     バージョン 3.11 で変更: 'ssl_shutdown_timeout' パラメータが追加され
     ました。

 -- の関数: async asyncio.start_server (client_connected_cb, host=None,
          port=None, *, limit=None, family=socket.AF_UNSPEC,
          flags=socket.AI_PASSIVE, sock=None, backlog=100, ssl=None,
          reuse_address=None, reuse_port=None, keep_alive=None,
          ssl_handshake_timeout=None, ssl_shutdown_timeout=None,
          start_serving=True)

     ソケットサーバーを起動します。

     'client_connected_cb' コールバックは新しいクライアントコネクション
     が確立されるたびに呼び出されます。このコールバックは *note
     StreamReader: 1c7d. と *note StreamWriter: 1a70. クラスのインスタン
     スのペア ‘(reader, writer)’ を2つの引数として受け取ります。

     'client_connected_cb' には単純な呼び出し可能オブジェクトか、または
     *note コルーチン関数: 37b8. を指定します; コルーチン関数が指定され
     た場合、コールバックの呼び出しは自動的に *note Task: 1c7. としてス
     ケジュールされます。

     'limit' は戻り値の *note StreamReader: 1c7d. インスタンスが利用する
     バッファのサイズの上限値を設定します。デフォルトでは 'limit' は 64
     KiB に設定されます。

     残りの引数は直接 *note loop.create_server(): d09. に渡されます。

          注釈: The 'sock' argument transfers ownership of the socket to
          the server created.  To close the socket, call the server's
          *note close(): 37fd. method.

     バージョン 3.7 で変更: 'ssl_handshake_timeout' と 'start_serving' パ
     ラメータが追加されました。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     バージョン 3.11 で変更: 'ssl_shutdown_timeout' パラメータが追加され
     ました。

     バージョン 3.13 で変更: Added the 'keep_alive' parameter.

Unix ソケット
.............

 -- の関数: async asyncio.open_unix_connection (path=None, *,
          limit=None, ssl=None, sock=None, server_hostname=None,
          ssl_handshake_timeout=None, ssl_shutdown_timeout=None)

     Unix ソケットコネクションを確立し、 ‘(reader, writer)’ のオブジェク
     トのペアを返します。

     この関数は *note open_connection(): d0e. と似ていますが Unix ソケッ
     トに対して動作します。

     *note loop.create_unix_connection(): 37ff. のドキュメントも参照して
     ください。

          注釈: The 'sock' argument transfers ownership of the socket to
          the *note StreamWriter: 1a70. created.  To close the socket,
          call its *note close(): 37fc. method.

     *note Availability: 213f.: Unix.

     バージョン 3.7 で変更: Added the 'ssl_handshake_timeout' parameter.
     The 'path' parameter can now be a *note path-like object: 5a1.

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     バージョン 3.11 で変更: 'ssl_shutdown_timeout' パラメータが追加され
     ました。

 -- の関数: async asyncio.start_unix_server (client_connected_cb,
          path=None, *, limit=None, sock=None, backlog=100, ssl=None,
          ssl_handshake_timeout=None, ssl_shutdown_timeout=None,
          start_serving=True, cleanup_socket=True)

     Unix のソケットサーバーを起動します。

     *note start_server(): d0f. と似ていますが Unix ソケットに対して動作
     します。

     If 'cleanup_socket' is true then the Unix socket will automatically
     be removed from the filesystem when the server is closed, unless
     the socket has been replaced after the server has been created.

     *note loop.create_unix_server(): 4ca. のドキュメントも参照してくだ
     さい。

          注釈: The 'sock' argument transfers ownership of the socket to
          the server created.  To close the socket, call the server's
          *note close(): 37fd. method.

     *note Availability: 213f.: Unix.

     バージョン 3.7 で変更: Added the 'ssl_handshake_timeout' and
     'start_serving' parameters.  The 'path' parameter can now be a
     *note path-like object: 5a1.

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     バージョン 3.11 で変更: 'ssl_shutdown_timeout' パラメータが追加され
     ました。

     バージョン 3.13 で変更: Added the 'cleanup_socket' parameter.

* Menu:

* StreamReader::
* StreamWriter::
* 使用例: 使用例<22>.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/streams.py


File: python.info,  Node: StreamReader,  Next: StreamWriter,  Up: ストリーム

5.19.1.23 StreamReader
......................

 -- クラス: asyncio.StreamReader

     Represents a reader object that provides APIs to read data from the
     IO stream.  As an *note asynchronous iterable: f74, the object
     supports the *note async for: ca1. statement.

     'StreamReader' オブジェクトを直接インスタンス化することは推奨されま
     せん; 代わりに *note open_connection(): d0e. や *note
     start_server(): d0f. を使ってください。

      -- メソッド: feed_eof ()

          EOF の肯定応答を行います。

      -- メソッド: async read (n=-1)

          ストリームから最大 'n' バイト読み込みます。

          'n' が指定されないか ‘-1’ が指定されていた場合 EOF になるまで
          読み込み、読み込まれた全ての *note bytes: 192. を返します。EOF
          を受信し、かつ内部バッファーが空の場合、空の ‘bytes’ オブジェ
          クトを返します。

          'n' が ‘0’ なら、ただちに空の ‘bytes’ オブジェクトを返します。

          'n' が正なら、内部バッファで最低でも 1 バイトが利用可能になり
          次第、利用可能な最大 'n' ‘bytes’ を返します。1 バイトも読み込
          まないうちに EOF を受信したなら、空の ‘bytes’ オブジェクトを返
          します。

      -- メソッド: async readline ()

          1 行読み込みます。 "行" とは、‘\n’ で終了するバイト列のシーケ
          ンスです。

          EOF を受信し、かつ ‘\n’ が見つからない場合、このメソッドは部分
          的に読み込んだデータを返します。

          EOF を受信し、かつ内部バッファーが空の場合、空の ‘bytes’ オブ
          ジェクトを返します。

      -- メソッド: async readexactly (n)

          厳密に 'n' バイトのデータを読み出します。

          'n' バイトを読み出す前に EOF に達した場合 *note
          IncompleteReadError: 1ce8. を送出します。部分的に読み出したデ
          ータを取得するには *note IncompleteReadError.partial: 3805. 属
          性を使ってください。

      -- メソッド: async readuntil (separator=b'\n')

          'separator' が見つかるまでストリームからデータを読み出します。

          成功時には、データと区切り文字は内部バッファから削除されます
          (消費されます)。返されるデータの最後には区切り文字が含まれます
          。

          読み出したデータの量が設定したストリームの上限を超えると *note
          LimitOverrunError: 3806. 例外が送出されます。このときデータは
          内部バッファーに残され、再度読み出すことができます。

          完全な区切り文字が見つかる前に EOF に達すると *note
          IncompleteReadError: 1ce8. 例外が送出され、内部バッファーがリ
          セットされます。このとき *note IncompleteReadError.partial:
          3805. 属性は区切り文字の一部を含むかもしれません。

          The 'separator' may also be a tuple of separators.  In this
          case the return value will be the shortest possible that has
          any separator as the suffix.  For the purposes of *note
          LimitOverrunError: 3806, the shortest possible separator is
          considered to be the one that matched.

          Added in version 3.5.2.

          バージョン 3.13 で変更: The 'separator' parameter may now be a
          *note tuple: 614. of separators.

      -- メソッド: at_eof ()

          バッファーが空で *note feed_eof(): 3802. が呼ばれていた場合
          ‘True’ を返します。


File: python.info,  Node: StreamWriter,  Next: 使用例<22>,  Prev: StreamReader,  Up: ストリーム

5.19.1.24 StreamWriter
......................

 -- クラス: asyncio.StreamWriter

     IO ストリームにデータを書き込むための API を提供するライターオブジ
     ェクトを表します。

     'StreamWriter' オブジェクトを直接インスタンス化することは推奨されま
     せん; 代わりに *note open_connection(): d0e. や *note
     start_server(): d0f. を使ってください。

      -- メソッド: write (data)

          このメソッドは、背後にあるソケットにデータ 'data' を即座に書き
          込みます。書き込みに失敗した場合、データは送信可能になるまで内
          部の書き込みバッファーに格納されて待機します。

          The 'data' buffer should be a bytes, bytearray, or
          C-contiguous one-dimensional memoryview object.

          このメソッドは ‘drain()’ メソッドと組み合わせて使うべきです:

               stream.write(data)
               await stream.drain()

      -- メソッド: writelines (data)

          このメソッドは、背後にあるソケットにバイトデータのリスト (また
          はイテラブル) を即座に書き込みます。書き込みに失敗した場合、デ
          ータは送信可能になるまで内部の書き込みバッファーに格納されて待
          機します。

          このメソッドは ‘drain()’ メソッドと組み合わせて使うべきです:

               stream.writelines(lines)
               await stream.drain()

      -- メソッド: close ()

          このメソッドはストリームと背後にあるソケットをクローズします。

          The method should be used, though not mandatory, along with
          the ‘wait_closed()’ method:

               stream.close()
               await stream.wait_closed()

      -- メソッド: can_write_eof ()

          背後にあるトランスポートが *note write_eof(): 380c. メソッドを
          サポートしている場合 ‘True’ を返し、そうでない場合は ‘False’ を
          返します。

      -- メソッド: write_eof ()

          バッファーされた書き込みデータを全て書き込んでから、ストリーム
          の書き込み側終端をクローズします。

      -- の属性: transport

          背後にある asyncio トランスポートを返します。

      -- メソッド: get_extra_info (name, default=None)

          オプションのトランスポート情報にアクセスします。詳細は *note
          BaseTransport.get_extra_info(): c93. を参照してください。

      -- メソッド: async drain ()

          ストリームへの書き込み再開に適切な状態になるまで待ちます。使用
          例:

               writer.write(data)
               await writer.drain()

          このメソッドは背後にある IO 書き込みバッファーとやりとりを行う
          フロー制御メソッドです。バッファーのサイズが最高水位点に達した
          場合、'drain()' はバッファのサイズが最低水位点を下回るまで減量
          され、書き込み再開可能になるまで書き込みをブロックします。待ち
          受けの必要がない場合、 *note drain(): 1b29. は即座にリターンし
          ます。

      -- メソッド: async start_tls (sslcontext, *, server_hostname=None,
               ssl_handshake_timeout=None, ssl_shutdown_timeout=None)

          Upgrade an existing stream-based connection to TLS.

          引数:

             * 'sslcontext': 構成済みの *note SSLContext: 357. インスタ
               ンスです。

             * 'server_hostname': 対象のサーバーの証明書との照合に使われ
               るホスト名を設定または上書きします。

             * 'ssl_handshake_timeout' is the time in seconds to wait
               for the TLS handshake to complete before aborting the
               connection.  ‘60.0’ seconds if ‘None’ (default).

             * 'ssl_shutdown_timeout' is the time in seconds to wait for
               the SSL shutdown to complete before aborting the
               connection.  ‘30.0’ seconds if ‘None’ (default).

          Added in version 3.11.

          バージョン 3.12 で変更: 'ssl_shutdown_timeout' パラメータが追
          加されました。

      -- メソッド: is_closing ()

          ストリームがクローズされたか、またはクローズ処理中の場合に
          ‘True’ を返します。

          Added in version 3.7.

      -- メソッド: async wait_closed ()

          ストリームがクローズされるまで待機します。

          Should be called after *note close(): 37fc. to wait until the
          underlying connection is closed, ensuring that all data has
          been flushed before e.g.  exiting the program.

          Added in version 3.7.


File: python.info,  Node: 使用例<22>,  Prev: StreamWriter,  Up: ストリーム

5.19.1.25 使用例
................

* Menu:

* ストリームを使った TCP Echo クライアント::
* ストリームを使った TCP Echo サーバー::
* HTTP ヘッダーの取得::
* ストリームを使ってデータを待つオープンソケットの登録::


File: python.info,  Node: ストリームを使った TCP Echo クライアント,  Next: ストリームを使った TCP Echo サーバー,  Up: 使用例<22>

5.19.1.26 ストリームを使った TCP Echo クライアント
..................................................

*note asyncio.open_connection(): d0e. 関数を使った TCP Echo クライアント
です:

     import asyncio

     async def tcp_echo_client(message):
         reader, writer = await asyncio.open_connection(
             '127.0.0.1', 8888)

         print(f'Send: {message!r}')
         writer.write(message.encode())
         await writer.drain()

         data = await reader.read(100)
         print(f'Received: {data.decode()!r}')

         print('Close the connection')
         writer.close()
         await writer.wait_closed()

     asyncio.run(tcp_echo_client('Hello World!'))

参考
....

*note TCP エコークライアントプロトコル: 3811. の例は低水準の *note
loop.create_connection(): 818. メソッドを使っています。


File: python.info,  Node: ストリームを使った TCP Echo サーバー,  Next: HTTP ヘッダーの取得,  Prev: ストリームを使った TCP Echo クライアント,  Up: 使用例<22>

5.19.1.27 ストリームを使った TCP Echo サーバー
..............................................

*note asyncio.start_server(): d0f. 関数を使った TCP Echo サーバーです:

     import asyncio

     async def handle_echo(reader, writer):
         data = await reader.read(100)
         message = data.decode()
         addr = writer.get_extra_info('peername')

         print(f"Received {message!r} from {addr!r}")

         print(f"Send: {message!r}")
         writer.write(data)
         await writer.drain()

         print("Close the connection")
         writer.close()
         await writer.wait_closed()

     async def main():
         server = await asyncio.start_server(
             handle_echo, '127.0.0.1', 8888)

         addrs = ', '.join(str(sock.getsockname()) for sock in server.sockets)
         print(f'Serving on {addrs}')

         async with server:
             await server.serve_forever()

     asyncio.run(main())

参考
....

*note TCP エコーサーバープロトコル: 3814. の例は *note
loop.create_server(): d09. メソッドを使っています。


File: python.info,  Node: HTTP ヘッダーの取得,  Next: ストリームを使ってデータを待つオープンソケットの登録,  Prev: ストリームを使った TCP Echo サーバー,  Up: 使用例<22>

5.19.1.28 HTTP ヘッダーの取得
.............................

コマンドラインから渡された URL の HTTP ヘッダーを問い合わせる簡単な例で
す:

     import asyncio
     import urllib.parse
     import sys

     async def print_http_headers(url):
         url = urllib.parse.urlsplit(url)
         if url.scheme == 'https':
             reader, writer = await asyncio.open_connection(
                 url.hostname, 443, ssl=True)
         else:
             reader, writer = await asyncio.open_connection(
                 url.hostname, 80)

         query = (
             f"HEAD {url.path or '/'} HTTP/1.0\r\n"
             f"Host: {url.hostname}\r\n"
             f"\r\n"
         )

         writer.write(query.encode('latin-1'))
         while True:
             line = await reader.readline()
             if not line:
                 break

             line = line.decode('latin1').rstrip()
             if line:
                 print(f'HTTP header> {line}')

         # Ignore the body, close the socket
         writer.close()
         await writer.wait_closed()

     url = sys.argv[1]
     asyncio.run(print_http_headers(url))

使い方:

     python example.py http://example.com/path/page.html

または HTTPS を使用:

     python example.py https://example.com/path/page.html


File: python.info,  Node: ストリームを使ってデータを待つオープンソケットの登録,  Prev: HTTP ヘッダーの取得,  Up: 使用例<22>

5.19.1.29 ストリームを使ってデータを待つオープンソケットの登録
..............................................................

*note open_connection(): d0e. 関数を使ってソケットがデータを受信するまで
待つコルーチンです:

     import asyncio
     import socket

     async def wait_for_data():
         # Get a reference to the current event loop because
         # we want to access low-level APIs.
         loop = asyncio.get_running_loop()

         # Create a pair of connected sockets.
         rsock, wsock = socket.socketpair()

         # Register the open socket to wait for data.
         reader, writer = await asyncio.open_connection(sock=rsock)

         # Simulate the reception of data from the network
         loop.call_soon(wsock.send, 'abc'.encode())

         # Wait for data
         data = await reader.read(100)

         # Got data, we are done: close the socket
         print("Received:", data.decode())
         writer.close()
         await writer.wait_closed()

         # Close the second socket
         wsock.close()

     asyncio.run(wait_for_data())

参考
....

*note
プロトコルを使ってオープンしたソケットをデータ待ち受けのために登録する:
3818. 例では、低水準のプロトコルと *note loop.create_connection(): 818.
メソッドを使っています。

*note ファイル記述子の読み出しイベントを監視する: 3819. 例では、低水準の
*note loop.add_reader(): 381a. メソッドを使ってファイル記述子を監視して
います。


File: python.info,  Node: 同期プリミティブ<2>,  Next: サブプロセス,  Prev: ストリーム,  Up: asyncio --- 非同期 I/O

5.19.1.30 同期プリミティブ
..........................

'ソースコード:' Lib/asyncio/locks.py(1)

__________________________________________________________________

asyncio の同期プリミティブは *note threading: f3. モジュールのそれと類似
するようにデザインされていますが、2つの重要な注意事項があります:

   * asyncio の同期プリミティブはスレッドセーフではありません。従って OS
     スレッドの同期に使うべきではありません (代わりに *note threading:
     f3. を使ってください);

   * 同期プリミティブのメソッドは 'timeout' 引数を受け付けません; タイム
     アウトを伴う操作を実行するには *note asyncio.wait_for(): 815. 関数
     を使ってください。

asyncio モジュールは以下の基本的な同期プリミティブを持っています:

   * *note Lock: c66.

   * *note Event: 2f4.

   * *note Condition: c67.

   * *note Semaphore: c68.

   * *note BoundedSemaphore: c69.

   * *note Barrier: 816.

__________________________________________________________________

* Menu:

* Lock::
* Event::
* Condition::
* Semaphore::
* BoundedSemaphore::
* Barrier::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/asyncio/locks.py


File: python.info,  Node: Lock,  Next: Event,  Up: 同期プリミティブ<2>

5.19.1.31 Lock
..............

 -- クラス: asyncio.Lock

     asyncio タスクのためのミューテックスロックを実装しています。スレッ
     ドセーフではありません。

     asyncio ロックは、共有リソースに対する排他的なアクセスを保証するた
     めに使うことができます。

     Lock の望ましい使用方法は、 *note async with: 185. 文と組み合わせて
     使うことです:

          lock = asyncio.Lock()

          # ... later
          async with lock:
              # access shared state

     これは以下のコードと等価です:

          lock = asyncio.Lock()

          # ... later
          await lock.acquire()
          try:
              # access shared state
          finally:
              lock.release()

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

      -- メソッド: async acquire ()

          ロックを獲得します。

          このメソッドはロックが '解除される' まで待機し、ロックを 'ロッ
          ク状態' に変更して ‘True’ を返します。

          複数のコルーチンが *note acquire(): 381f. メソッドによりロック
          の解除を待ち受けている場合、最終的にただひとつのコルーチンが実
          行されます。

          ロックの獲得は '公平' です: すなわちロックを獲得して実行される
          コルーチンは、最初にロックの待ち受けを開始したコルーチンです。

      -- メソッド: release ()

          ロックを解放します。

          ロックが 'ロック状態' の場合、 ロックを '解除状態' にしてリタ
          ーンします。

          ロックが '解除状態' の場合、 *note RuntimeError: 244. 例外が送
          出されます。

      -- メソッド: locked ()

          'ロック状態' の場合に ‘True’ を返します。


File: python.info,  Node: Event,  Next: Condition,  Prev: Lock,  Up: 同期プリミティブ<2>

5.19.1.32 Event
...............

 -- クラス: asyncio.Event

     イベントオブジェクトです。スレッドセーフではありません。

     asyncio イベントは、複数の asyncio タスクに対して何らかのイベントが
     発生したことを通知するために使うことができます。

     Event オブジェクトは内部フラグを管理します。フラグの値は *note
     set(): 3823. メソッドにより 'true' に、また *note clear(): 3824. メ
     ソッドにより 'false' に設定することができます。 *note wait(): 3825.
     メソッドはフラグが 'true' になるまで処理をブロックします。フラグの
     初期値は 'false' です。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     以下はプログラム例です:

          async def waiter(event):
              print('waiting for it ...')
              await event.wait()
              print('... got it!')

          async def main():
              # Create an Event object.
              event = asyncio.Event()

              # Spawn a Task to wait until 'event' is set.
              waiter_task = asyncio.create_task(waiter(event))

              # Sleep for 1 second and set the event.
              await asyncio.sleep(1)
              event.set()

              # Wait until the waiter task is finished.
              await waiter_task

          asyncio.run(main())

      -- メソッド: async wait ()

          イベントがセットされるまで待機します。

          イベントがセットされると、即座に ‘True’ を返します。 そうでな
          ければ、他のタスクが *note set(): 3823. メソッドを呼び出すまで
          処理をブロックします。

      -- メソッド: set ()

          イベントをセットします。

          イベントがセットされるまで待機している全てのタスクは、即座に通
          知を受けて実行を再開します。

      -- メソッド: clear ()

          イベントをクリア (アンセット) します

          Subsequent tasks awaiting on *note wait(): 3825. will now
          block until the *note set(): 3823. method is called again.

      -- メソッド: is_set ()

          イベントがセットされている場合 ‘True’ を返します。


File: python.info,  Node: Condition,  Next: Semaphore,  Prev: Event,  Up: 同期プリミティブ<2>

5.19.1.33 Condition
...................

 -- クラス: asyncio.Condition (lock=None)

     条件変数オブジェクトです。スレッドセーフではありません。

     asyncio 条件プリミティブは何らかのイベントが発生するのを待ち受け、
     そのイベントを契機として共有リソースへの排他的なアクセスを得るため
     に利用することができます。

     本質的に、 Condition オブジェクトは *note Event: 2f4. と a *note
     Lock: c66. の2つのクラスの機能を組み合わせたものです。複数の
     Condition オブジェクトが単一の Lock を共有することでができます。こ
     れにより、共有リソースのそれぞれの状態に関連する異なるタスクの間で
     、そのリソースへの排他的アクセスを調整することが可能になります。

     オプション引数 'lock' は *note Lock: c66. または ‘None’ でなければ
     なりません。後者の場合自動的に新しい Lock オブジェクトが生成されま
     す。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     Condition の望ましい使用方法は *note async with: 185. 文と組み合わ
     せて使うことです:

          cond = asyncio.Condition()

          # ... later
          async with cond:
              await cond.wait()

     これは以下のコードと等価です:

          cond = asyncio.Condition()

          # ... later
          await cond.acquire()
          try:
              await cond.wait()
          finally:
              cond.release()

      -- メソッド: async acquire ()

          下層でのロックを獲得します。

          このメソッドは下層のロックが '解除される' まで待機し、ロックを
          'ロック状態' に変更して ‘True’ を返します。

      -- メソッド: notify (n=1)

          Wake up 'n' tasks (1 by default) waiting on this condition.
          If fewer than 'n' tasks are waiting they are all awakened.

          このメソッドが呼び出される前にロックを獲得しておかなければなり
          ません。また、メソッド呼び出し後速やかにロックを解除しなければ
          なりません。 '解除された' ロックとと共に呼び出された場合、
          *note RuntimeError: 244. 例外が送出されます。

      -- メソッド: locked ()

          下層のロックを獲得していれば ‘True’ を返します。

      -- メソッド: notify_all ()

          この条件を待ち受けている全てのタスクを起動します。

          このメソッドは *note notify(): 19f7. と同じように振る舞います
          が、待ち受けている全てのタスクを起動します。

          このメソッドが呼び出される前にロックを獲得しておかなければなり
          ません。また、メソッド呼び出し後速やかにロックを解除しなければ
          なりません。 '解除された' ロックとと共に呼び出された場合、
          *note RuntimeError: 244. 例外が送出されます。

      -- メソッド: release ()

          下層のロックを解除します。

          アンロック状態のロックに対して呼び出された場合、*note
          RuntimeError: 244. が送出されます。

      -- メソッド: async wait ()

          通知を受けるまで待機します。

          このメソッドが呼び出された時点で呼び出し元のタスクがロックを獲
          得していない場合、 *note RuntimeError: 244. 例外が送出されます
          。

          このメソッドは下層のロックを解除し、その後 *note notify():
          19f7. または *note notify_all(): 382b. の呼び出しによって起動
          されるまで処理をブロックします。いったん起動されると、
          Condition は再びロックを獲得し、メソッドは ‘True’ を返します。

          Note that a task 'may' return from this call spuriously, which
          is why the caller should always re-check the state and be
          prepared to *note wait(): 1a20. again.  For this reason, you
          may prefer to use *note wait_for(): 382d. instead.

      -- メソッド: async wait_for (predicate)

          引数 predicate の条件が '真' になるまで待機します。

          The predicate must be a callable which result will be
          interpreted as a boolean value.  The method will repeatedly
          *note wait(): 1a20. until the predicate evaluates to 'true'.
          The final value is the return value.


File: python.info,  Node: Semaphore,  Next: BoundedSemaphore,  Prev: Condition,  Up: 同期プリミティブ<2>

5.19.1.34 Semaphore
...................

 -- クラス: asyncio.Semaphore (value=1)

     セマフォオブジェクトです。スレッドセーフではありません。

     セマフォは内部のカウンターを管理しています。カウンターは *note
     acquire(): 1a21. メソッドの呼び出しによって減算され、 *note
     release(): 382f. メソッドの呼び出しによって加算されます。カウンター
     がゼロを下回ることはありません。 *note acquire(): 1a21. メソッドが
     呼び出された時にカウンターがゼロになっていると、セマフォは処理をブ
     ロックし、他のタスクが *note release(): 382f. メソッドを呼び出すま
     で待機します。

     オプション引数 'value' は内部カウンターの初期値を与えます (デフォル
     トは ‘1’ です)。 指定された値が ‘0’ より小さい場合、 *note
     ValueError: 2ec. 例外が送出されます。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     セマフォの望ましい使用方法は、 *note async with: 185. 文と組み合わ
     せて使うことです:

          sem = asyncio.Semaphore(10)

          # ... later
          async with sem:
              # work with shared resource

     これは以下のコードと等価です:

          sem = asyncio.Semaphore(10)

          # ... later
          await sem.acquire()
          try:
              # work with shared resource
          finally:
              sem.release()

      -- メソッド: async acquire ()

          セマフォを獲得します。

          内部カウンターがゼロより大きい場合、カウンターを1つ減算して即
          座に ‘True’ を返します。内部カウンターがゼロの場合、 *note
          release(): 382f. が呼び出されるまで待機してから ‘True’ を返し
          ます。

      -- メソッド: locked ()

          セマフォを直ちに獲得できない場合 ‘True’ を返します。

      -- メソッド: release ()

          セマフォを解放し、内部カウンターを1つ加算します。セマフォ待ち
          をしているタスクを起動する可能性があります。

          *note BoundedSemaphore: c69. と異なり、 *note Semaphore: c68.
          は ‘release()’ を ‘acquire()’ よりも多く呼び出すことを許容しま
          す。


File: python.info,  Node: BoundedSemaphore,  Next: Barrier,  Prev: Semaphore,  Up: 同期プリミティブ<2>

5.19.1.35 BoundedSemaphore
..........................

 -- クラス: asyncio.BoundedSemaphore (value=1)

     有限セマフォオブジェクトです。スレッドセーフではありません。

     有限セマフォは *note Semaphore: c68. の一種で、 *note release():
     382f. メソッドの呼び出しにより内部カウンターが '初期値' よりも増加
     してしまう場合は *note ValueError: 2ec. 例外を送出します。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。


File: python.info,  Node: Barrier,  Prev: BoundedSemaphore,  Up: 同期プリミティブ<2>

5.19.1.36 Barrier
.................

 -- クラス: asyncio.Barrier (parties)

     A barrier object.  Not thread-safe.

     A barrier is a simple synchronization primitive that allows to
     block until 'parties' number of tasks are waiting on it.  Tasks can
     wait on the *note wait(): 3833. method and would be blocked until
     the specified number of tasks end up waiting on *note wait(): 3833.
     At that point all of the waiting tasks would unblock
     simultaneously.

     *note async with: 185. can be used as an alternative to awaiting on
     *note wait(): 3833.

     The barrier can be reused any number of times.  以下はプログラム例
     です:

          async def example_barrier():
             # barrier with 3 parties
             b = asyncio.Barrier(3)

             # create 2 new waiting tasks
             asyncio.create_task(b.wait())
             asyncio.create_task(b.wait())

             await asyncio.sleep(0)
             print(b)

             # The third .wait() call passes the barrier
             await b.wait()
             print(b)
             print("barrier passed")

             await asyncio.sleep(0)
             print(b)

          asyncio.run(example_barrier())

     Result of this example is:

          <asyncio.locks.Barrier object at 0x... [filling, waiters:2/3]>
          <asyncio.locks.Barrier object at 0x... [draining, waiters:0/3]>
          barrier passed
          <asyncio.locks.Barrier object at 0x... [filling, waiters:0/3]>

     Added in version 3.11.

      -- メソッド: async wait ()

          Pass the barrier.  When all the tasks party to the barrier
          have called this function, they are all unblocked
          simultaneously.

          When a waiting or blocked task in the barrier is cancelled,
          this task exits the barrier which stays in the same state.  If
          the state of the barrier is "filling", the number of waiting
          task decreases by 1.

          The return value is an integer in the range of 0 to
          ‘parties-1’, different for each task.  This can be used to
          select a task to do some special housekeeping, e.g.:

               ...
               async with barrier as position:
                  if position == 0:
                     # Only one task prints this
                     print('End of *draining phase*')

          This method may raise a *note BrokenBarrierError: 817.
          exception if the barrier is broken or reset while a task is
          waiting.  It could raise a *note CancelledError: 4d4. if a
          task is cancelled.

      -- メソッド: async reset ()

          Return the barrier to the default, empty state.  Any tasks
          waiting on it will receive the *note BrokenBarrierError: 817.
          exception.

          If a barrier is broken it may be better to just leave it and
          create a new one.

      -- メソッド: async abort ()

          Put the barrier into a broken state.  This causes any active
          or future calls to *note wait(): 3833. to fail with the *note
          BrokenBarrierError: 817.  Use this for example if one of the
          tasks needs to abort, to avoid infinite waiting tasks.

      -- の属性: parties

          The number of tasks required to pass the barrier.

      -- の属性: n_waiting

          The number of tasks currently waiting in the barrier while
          filling.

      -- の属性: broken

          バリアが broken な状態である場合に ‘True’ となるブール値。

 -- 例外: asyncio.BrokenBarrierError

     *note Barrier: 816. オブジェクトがリセットされるか broken な場合に
     、この例外 (*note RuntimeError: 244. のサブクラス) が送出されます。

__________________________________________________________________

バージョン 3.9 で変更: ‘await lock’ や ‘yield from lock’ およびそれらと
*note with: 186. 文との組み合わせ (すなわち ‘with await lock’ や ‘with
(yield from lock)’) によるロックの獲得は削除されました。代わりに ‘async
with lock’ を使ってください。


File: python.info,  Node: サブプロセス,  Next: キュー,  Prev: 同期プリミティブ<2>,  Up: asyncio --- 非同期 I/O

5.19.1.37 サブプロセス
......................

'ソースコード:' Lib/asyncio/subprocess.py(1),
Lib/asyncio/base_subprocess.py(2)

__________________________________________________________________

このセクションはサブプロセスの生成と管理を行う高水準の async/await
asyncio API について説明します。 以下は、 asyncio モジュールがどのように
シェルコマンドを実行し、結果を取得できるかを示す例です:

     import asyncio

     async def run(cmd):
         proc = await asyncio.create_subprocess_shell(
             cmd,
             stdout=asyncio.subprocess.PIPE,
             stderr=asyncio.subprocess.PIPE)

         stdout, stderr = await proc.communicate()

         print(f'[{cmd!r} exited with {proc.returncode}]')
         if stdout:
             print(f'[stdout]\n{stdout.decode()}')
         if stderr:
             print(f'[stderr]\n{stderr.decode()}')

     asyncio.run(run('ls /zzz'))

このサンプルコードは以下を出力します:

     ['ls /zzz' exited with 1]
     [stderr]
     ls: /zzz: No such file or directory

全ての asyncio のサブプロセス関数は非同期ですが、 asyncio モジュールはこ
れらの非同期関数と協調するための多くのツールを提供しているので、複数のサ
ブプロセスを並列に実行して監視することは簡単です。実際、上記のサンプルコ
ードを複数のコマンドを同時に実行するように修正するのはきわめて単純です:

     async def main():
         await asyncio.gather(
             run('ls /zzz'),
             run('sleep 1; echo "hello"'))

     asyncio.run(main())

*note 使用例: 383e. 節も参照してください。

* Menu:

* サブプロセスの生成::
* 定数: 定数<7>.
* サブプロセスとやりとりする::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/subprocess.py

   (2) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/base_subprocess.py


File: python.info,  Node: サブプロセスの生成,  Next: 定数<7>,  Up: サブプロセス

5.19.1.38 サブプロセスの生成
............................

 -- の関数: async asyncio.create_subprocess_exec (program, *args,
          stdin=None, stdout=None, stderr=None, limit=None, **kwds)

     サブプロセスを作成します。

     The 'limit' argument sets the buffer limit for *note StreamReader:
     1c7d. wrappers for *note stdout: 3840. and *note stderr: 3841. (if
     *note subprocess.PIPE: d80. is passed to 'stdout' and 'stderr'
     arguments).

     *note Process: 3842. のインスタンスを返します。

     他のパラメータについては *note loop.subprocess_exec(): 3843. を参照
     してください。

     If the process object is garbage collected while the process is
     still running, the child process will be killed.

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

 -- の関数: async asyncio.create_subprocess_shell (cmd, stdin=None,
          stdout=None, stderr=None, limit=None, **kwds)

     シェルコマンド 'cmd' を実行します。

     The 'limit' argument sets the buffer limit for *note StreamReader:
     1c7d. wrappers for *note stdout: 3840. and *note stderr: 3841. (if
     *note subprocess.PIPE: d80. is passed to 'stdout' and 'stderr'
     arguments).

     *note Process: 3842. のインスタンスを返します。

     他のパラメータについては *note loop.subprocess_shell(): 3844. のド
     キュメントを参照してください。

     If the process object is garbage collected while the process is
     still running, the child process will be killed.

          重要: シェルインジェクション(1) の脆弱性を回避するために全ての
          空白文字および特殊文字を適切にクオートすることは、アプリケーシ
          ョン側の責任で確実に行ってください。シェルコマンドを構成する文
          字列内の空白文字と特殊文字のエスケープは、 *note
          shlex.quote(): 582. 関数を使うと適切に行うことができます。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     注釈: サブプロセスは、 *note ProactorEventLoop: 81d. を使えば
     Windows でも利用可能です。詳しくは *note Windows
     におけるサブプロセスのサポート: 3845. を参照してください。

参考
....

asyncio は以下に挙げるサブプロセスと協調するための '低水準の' API も持っ
ています: *note loop.subprocess_exec(): 3843, *note
loop.subprocess_shell(): 3844, *note loop.connect_read_pipe(): 3846,
*note loop.connect_write_pipe(): 3847. および *note Subprocess
Transports: 3848. と *note Subprocess Protocols: 3849.。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Shell_injection#Shell_injection


File: python.info,  Node: 定数<7>,  Next: サブプロセスとやりとりする,  Prev: サブプロセスの生成,  Up: サブプロセス

5.19.1.39 定数
..............

 -- データ: asyncio.subprocess.PIPE

     'stdin', 'stdout' または 'stderr' に渡すことができます。

     If 'PIPE' is passed to 'stdin' argument, the *note Process.stdin:
     384c. attribute will point to a *note StreamWriter: 1a70. instance.

     If 'PIPE' is passed to 'stdout' or 'stderr' arguments, the *note
     Process.stdout: 3840. and *note Process.stderr: 3841. attributes
     will point to *note StreamReader: 1c7d. instances.

 -- データ: asyncio.subprocess.STDOUT

     'stderr' 引数に対して利用できる特殊な値で、標準エラー出力が標準出力
     にリダイレクトされることを意味します。

 -- データ: asyncio.subprocess.DEVNULL

     プロセスを生成する関数の 'stdin', 'stdout' または 'stderr' 引数に利
     用できる特殊な値です。対応するサブプロセスのストリームに特殊なファ
     イル *note os.devnull: 1e14. が使われることを意味します。


File: python.info,  Node: サブプロセスとやりとりする,  Prev: 定数<7>,  Up: サブプロセス

5.19.1.40 サブプロセスとやりとりする
....................................

*note create_subprocess_exec(): c6b. と *note create_subprocess_shell():
c6c. の2つの関数はどちらも 'Process' クラスのインスタンスを返します。
'Process' クラスはサブプロセスと通信したり、サブプロセスの完了を監視した
りするための高水準のラッパーです。

 -- クラス: asyncio.subprocess.Process

     An object that wraps OS processes created by the *note
     create_subprocess_exec(): c6b. and *note create_subprocess_shell():
     c6c. functions.

     このクラスは *note subprocess.Popen: 4b7. クラスと同様の API を持つ
     ように設計されていますが、いくつかの注意すべき違いがあります:

        * Popen と異なり、 Process インスタンスは *note poll(): 3759. メ
          ソッドに相当するメソッドを持っていません;

        * the *note communicate(): 1a9f. and *note wait(): 3850. methods
          don't have a 'timeout' parameter: use the *note wait_for():
          815. function;

        * *note subprocess.Popen.wait(): ee0. メソッドが同期処理のビジー
          ループとして実装されているのに対して、 *note Process.wait():
          3850. メソッドは非同期処理です;

        * 'universal_newlines' パラメータはサポートされていません。

     このクラスは *note スレッド安全ではありません: 37e8.。

     *note サブプロセスとスレッド: 3851. 節も参照してください。

      -- メソッド: async wait ()

          子プロセスが終了するのを待ち受けます。

          *note returncode: 3852. 属性を設定し、その値を返します。

               注釈: ‘stdout=PIPE’ または ‘stderr=PIPE’ を使っており、OS
               パイプバッファがさらなるデータを受け付けるようになるまで
               子プロセスをブロックするほど大量の出力を生成場合、このメ
               ソッドはデッドロックする可能性があります。この条件を避け
               るため、パイプを使用する場合は *note communicate(): 1a9f.
               メソッドを使ってください。

      -- メソッド: async communicate (input=None)

          プロセスとのやりとりを行います:

            1. 'stdin' にデータを送信します ('input' が ‘None’ でない場
               合);

            2. 'stdin' を閉じます;

            3. EOF に達するまで 'stdout' および 'stderr' からデータを読
               み出します;

            4. プロセスが終了するまで待ち受けます。

          'input' オプション引数は子プロセスに送信されるデータ (*note
          bytes: 192. オブジェクト) です。

          ‘(stdout_data, stderr_data)’ のタプルを返します。

          'input' を標準入力 'stdin' nに書き込んでいる時に *note
          BrokenPipeError: 1267. または *note ConnectionResetError:
          126a. 例外が送出された場合、例外は無視されます。このような条件
          は、全てのデータが 'stdin' に書き込まれる前にプロセスが終了し
          た場合に起こります。

          子プロセスの標準入力 'stdin' にデータを送りたい場合、プロセス
          は ‘stdin=PIPE’ を設定して生成する必要があります。同様に、
          ‘None’ 以外の何らかのデータを戻り値のタプルで受け取りたい場合
          、プロセスは ‘stdout=PIPE’ と ‘stderr=PIPE’ のいずれかまたは両
          方を指定して生成しなければなりません。

          プロセスから受信したデータはメモリ上にバッファーされることに注
          意してください。そのため、返されるデータのサイズが大きいかまた
          は無制限の場合はこのメソッドを使わないようにしてください。

          バージョン 3.12 で変更: 'stdin' gets closed when ‘input=None’
          too.

      -- メソッド: send_signal (signal)

          子プロセスにシグナル 'signal' を送信します。

               注釈: On Windows, *note SIGTERM: 15f8. is an alias for
               *note terminate(): 3853.  ‘CTRL_C_EVENT’ and
               ‘CTRL_BREAK_EVENT’ can be sent to processes started with
               a 'creationflags' parameter which includes
               ‘CREATE_NEW_PROCESS_GROUP’.

      -- メソッド: terminate ()

          子プロセスを停止します。

          On POSIX systems this method sends *note SIGTERM: 15f8. to the
          child process.

          On Windows the Win32 API function ‘TerminateProcess()’ is
          called to stop the child process.

      -- メソッド: kill ()

          子プロセスを強制終了 (kill) します。

          On POSIX systems this method sends *note SIGKILL: d50. to the
          child process.

          Windows では、このメソッドは *note terminate(): 3853. のエイリ
          アスです。

      -- の属性: stdin

          Standard input stream (*note StreamWriter: 1a70.) or ‘None’ if
          the process was created with ‘stdin=None’.

      -- の属性: stdout

          Standard output stream (*note StreamReader: 1c7d.) or ‘None’
          if the process was created with ‘stdout=None’.

      -- の属性: stderr

          Standard error stream (*note StreamReader: 1c7d.) or ‘None’ if
          the process was created with ‘stderr=None’.

          警告: Use the *note communicate(): 1a9f. method rather than
          *note process.stdin.write(): 384c, *note await
          process.stdout.read(): 3840. or *note await
          process.stderr.read(): 3841.  This avoids deadlocks due to
          streams pausing reading or writing and blocking the child
          process.

      -- の属性: pid

          子プロセスのプロセス番号 (PID) です。

          Note that for processes created by the *note
          create_subprocess_shell(): c6c. function, this attribute is
          the PID of the spawned shell.

      -- の属性: returncode

          プロセスが終了した時の終了ステータスを返します。

          この属性が ‘None’ であることは、プロセスがまだ終了していないこ
          とを示しています。

          負の値 ‘-N’ は子プロセスがシグナル ‘N’ により中止させられたこ
          とを示します (POSIX のみ)。

* Menu:

* サブプロセスとスレッド::
* 使用例: 使用例<23>.


File: python.info,  Node: サブプロセスとスレッド,  Next: 使用例<23>,  Up: サブプロセスとやりとりする

5.19.1.41 サブプロセスとスレッド
................................

標準的な asyncio のイベントループは、異なるスレッドからサブプロセスを実
行するのをデフォルトでサポートしています。

Windows のサブプロセスは *note ProactorEventLoop: 81d. (デフォルト) のみ
提供され、 *note SelectorEventLoop: 314. はサブプロセスをサポートしてい
ません。

標準で提供されない別のイベントループ実装の場合、固有の制限がある可能性が
あります; それぞれの実装のドキュメントを参照してください。

参考
....

*note 並行処理とマルチスレッド処理: 37e8.


File: python.info,  Node: 使用例<23>,  Prev: サブプロセスとスレッド,  Up: サブプロセスとやりとりする

5.19.1.42 使用例
................

サブプロセスの制御のために *note Process: 3842. クラスを使い、サブプロセ
スの標準出力を読み出すために *note StreamReader: 1c7d. を使う例です。 サ
ブプロセスは *note create_subprocess_exec(): c6b. 関数により生成されます
:

     import asyncio
     import sys

     async def get_date():
         code = 'import datetime; print(datetime.datetime.now())'

         # Create the subprocess; redirect the standard output
         # into a pipe.
         proc = await asyncio.create_subprocess_exec(
             sys.executable, '-c', code,
             stdout=asyncio.subprocess.PIPE)

         # Read one line of output.
         data = await proc.stdout.readline()
         line = data.decode('ascii').rstrip()

         # Wait for the subprocess exit.
         await proc.wait()
         return line

     date = asyncio.run(get_date())
     print(f"Current date: {date}")

低水準の API を使って書かれた *note 同様の例: 3858. も参照してください。


File: python.info,  Node: キュー,  Next: 例外<16>,  Prev: サブプロセス,  Up: asyncio --- 非同期 I/O

5.19.1.43 キュー
................

'ソースコード:' Lib/asyncio/queues.py(1)

__________________________________________________________________

asyncio キューは *note queue: bb. モジュールのクラス群と同じ形になるよう
に設計されています。 asyncio キューはスレッドセーフではありませんが、そ
れらは async/await コードから使われるために特別に設計されています。

asyncio キューのメソッドは 'timeout' パラメータを持たないことに注意して
ください; タイムアウトを伴うキューを使った処理を行うには *note
asyncio.wait_for(): 815. 関数を使ってください。

下記の *note 使用例: 385c. 節も参照してください。

* Menu:

* Queue::
* 優先度付きのキュー::
* LIFO キュー::
* 例外: 例外<15>.
* 使用例: 使用例<24>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/asyncio/queues.py


File: python.info,  Node: Queue,  Next: 優先度付きのキュー,  Up: キュー

5.19.1.44 Queue
...............

 -- クラス: asyncio.Queue (maxsize=0)

     先入れ先出し (FIFO) キューです。

     'maxsize' がゼロ以下の場合、キューは無限長になります。 ‘0’ より大き
     い整数の場合、キューが 'maxsize' に達すると ‘await put()’ は *note
     get(): 385e. によってキューの要素が除去されるまでブロックします。

     標準ライブラリにおけるスレッドベースの *note queue: bb. モジュール
     と異なり、キューのサイズは常に既知であり、 *note qsize(): 385f. メ
     ソッドを呼び出すことによって取得することができます。

     バージョン 3.10 で変更: 'loop' パラメータが削除されました。

     このクラスは *note スレッド安全ではありません: 37e8.。

      -- の属性: maxsize

          キューに追加できるアイテム数です。

      -- メソッド: empty ()

          キューが空ならば ‘True’ を、そうでなければ ‘False’ を返します
          。

      -- メソッド: full ()

          キューに要素が *note maxsize: 3860. 個あれば ‘True’ を返します
          。

          If the queue was initialized with ‘maxsize=0’ (the default),
          then *note full(): 3862. never returns ‘True’.

      -- メソッド: async get ()

          キューから要素を削除して返します。キューが空の場合項目が利用可
          能になるまで待機します。

          Raises *note QueueShutDown: 4cd. if the queue has been shut
          down and is empty, or if the queue has been shut down
          immediately.

      -- メソッド: get_nowait ()

          直ちに利用できるアイテムがあるときはそれを、そうでなければ
          *note QueueEmpty: 3864. を返します。

      -- メソッド: async join ()

          キューにある全ての要素が取得され、処理されるまでブロックします
          。

          未完了のタスクのカウント値は、キューにアイテムが追加されるとき
          は常に加算され、キューの要素を消費するコルーチンが要素を取り出
          し、処理を完了したことを通知するために *note task_done(): fc7.
          を呼び出すと減算されます。未完了のタスクのカウント値がゼロにな
          ると、 *note join(): fc6. のブロックは解除されます。

      -- メソッド: async put (item)

          要素をキューに入力します。キューが満杯の場合、要素を追加する前
          に空きスロットが利用できるようになるまで待機します。

          Raises *note QueueShutDown: 4cd. if the queue has been shut
          down.

      -- メソッド: put_nowait (item)

          ブロックせずにアイテムをキューに追加します。

          直ちに利用できるスロットがない場合、*note QueueFull: 3867. を
          送出します。

      -- メソッド: qsize ()

          キュー内の要素数を返します。

      -- メソッド: shutdown (immediate=False)

          Put a *note Queue: c6a. instance into a shutdown mode.

          The queue can no longer grow.  Future calls to *note put():
          3865. raise *note QueueShutDown: 4cd.  Currently blocked
          callers of *note put(): 3865. will be unblocked and will raise
          *note QueueShutDown: 4cd. in the formerly awaiting task.

          If 'immediate' is false (the default), the queue can be wound
          down normally with *note get(): 385e. calls to extract tasks
          that have already been loaded.

          And if *note task_done(): fc7. is called for each remaining
          task, a pending *note join(): fc6. will be unblocked normally.

          Once the queue is empty, future calls to *note get(): 385e.
          will raise *note QueueShutDown: 4cd.

          If 'immediate' is true, the queue is terminated immediately.
          The queue is drained to be completely empty and the count of
          unfinished tasks is reduced by the number of tasks drained.
          If unfinished tasks is zero, callers of *note join(): fc6. are
          unblocked.  Also, blocked callers of *note get(): 385e. are
          unblocked and will raise *note QueueShutDown: 4cd. because the
          queue is empty.

          Use caution when using *note join(): fc6. with 'immediate' set
          to true.  This unblocks the join even when no work has been
          done on the tasks, violating the usual invariant for joining a
          queue.

          Added in version 3.13.

      -- メソッド: task_done ()

          Indicate that a formerly enqueued work item is complete.

          Used by queue consumers.  For each *note get(): 385e. used to
          fetch a work item, a subsequent call to *note task_done():
          fc7. tells the queue that the processing on the work item is
          complete.

          *note join(): fc6. が現在ブロック中だった場合、全アイテムが処
          理されたとき (*note put(): 3865. でキューに追加された全アイテ
          ムの *note task_done(): fc7. の呼び出しを受信したとき) に再開
          します。

          キューに追加されているアイテム数以上の呼び出しが行われたときに
          *note ValueError: 2ec. を送出します。


File: python.info,  Node: 優先度付きのキュー,  Next: LIFO キュー,  Prev: Queue,  Up: キュー

5.19.1.45 優先度付きのキュー
............................

 -- クラス: asyncio.PriorityQueue

     *note Queue: c6a. の変種です; 優先順位にしたがって要素を取り出しま
     す (最低順位が最初に取り出されます)。

     項目は典型的には ‘(priority_number, data)’ 形式のタプルです。


File: python.info,  Node: LIFO キュー,  Next: 例外<15>,  Prev: 優先度付きのキュー,  Up: キュー

5.19.1.46 LIFO キュー
.....................

 -- クラス: asyncio.LifoQueue

     *note Queue: c6a. の変種で、最後に追加された項目を最初に取り出しま
     す (後入れ先出し、またはスタック)。


File: python.info,  Node: 例外<15>,  Next: 使用例<24>,  Prev: LIFO キュー,  Up: キュー

5.19.1.47 例外
..............

 -- 例外: asyncio.QueueEmpty

     この例外は *note get_nowait(): 3863. メソッドが空のキューに対して呼
     ばれたときに送出されます。

 -- 例外: asyncio.QueueFull

     サイズが 'maxsize' に達したキューに対して *note put_nowait(): 3866.
     メソッドが 呼ばれたときに送出される例外です。

 -- 例外: asyncio.QueueShutDown

     Exception raised when *note put(): 3865. or *note get(): 385e. is
     called on a queue which has been shut down.

     Added in version 3.13.


File: python.info,  Node: 使用例<24>,  Prev: 例外<15>,  Up: キュー

5.19.1.48 使用例
................

キューを使って、並行処理を行う複数のタスクにワークロードを分散させること
ができます:

     import asyncio
     import random
     import time


     async def worker(name, queue):
         while True:
             # Get a "work item" out of the queue.
             sleep_for = await queue.get()

             # Sleep for the "sleep_for" seconds.
             await asyncio.sleep(sleep_for)

             # Notify the queue that the "work item" has been processed.
             queue.task_done()

             print(f'{name} has slept for {sleep_for:.2f} seconds')


     async def main():
         # Create a queue that we will use to store our "workload".
         queue = asyncio.Queue()

         # Generate random timings and put them into the queue.
         total_sleep_time = 0
         for _ in range(20):
             sleep_for = random.uniform(0.05, 1.0)
             total_sleep_time += sleep_for
             queue.put_nowait(sleep_for)

         # Create three worker tasks to process the queue concurrently.
         tasks = []
         for i in range(3):
             task = asyncio.create_task(worker(f'worker-{i}', queue))
             tasks.append(task)

         # Wait until the queue is fully processed.
         started_at = time.monotonic()
         await queue.join()
         total_slept_for = time.monotonic() - started_at

         # Cancel our worker tasks.
         for task in tasks:
             task.cancel()
         # Wait until all worker tasks are cancelled.
         await asyncio.gather(*tasks, return_exceptions=True)

         print('====')
         print(f'3 workers slept in parallel for {total_slept_for:.2f} seconds')
         print(f'total expected sleep time: {total_sleep_time:.2f} seconds')


     asyncio.run(main())


File: python.info,  Node: 例外<16>,  Next: Call Graph Introspection,  Prev: キュー,  Up: asyncio --- 非同期 I/O

5.19.1.49 例外
..............

'ソースコード:' Lib/asyncio/exceptions.py(1)

__________________________________________________________________

 -- 例外: asyncio.TimeoutError

     操作が指定された期限を超えたときに送出される、非推奨な *note
     TimeoutError: a36. のエイリアス。

     バージョン 3.11 で変更: このクラスは *note TimeoutError: a36. のエ
     イリアスになりました。

 -- 例外: asyncio.CancelledError

     処理がキャンセルされました。

     asyncio タスクがキャンセルされた場合の処理をカスタマイズするために
     、この例外を一旦キャッチすることができます。 ほとんどの場合、キャッ
     チした例外は再度送出しなければなりません。

     バージョン 3.8 で変更: *note CancelledError: 4d4. は *note
     Exception: bcd. ではなく *note BaseException: 7d6. のサブクラスにな
     りました。

 -- 例外: asyncio.InvalidStateError

     *note Task: 1c7. または *note Future: dc6. の内部状態が不正になりま
     した。

     すでに結果の値が設定されている 'Future' オブジェクトに対してさらに
     結果の値を再び設定しようとする場合などに送出されることがあります。

 -- 例外: asyncio.SendfileNotAvailableError

     与えられたソケットまたはファイルタイプに対して "sendfile" システム
     コールが利用可能ではありません。

     *note RuntimeError: 244. の派生クラスです。

 -- 例外: asyncio.IncompleteReadError

     要求された読み込み処理が完了できませんでした。

     *note asyncio ストリーム API: 37b9. から送出されます。

     この例外は *note EOFError: 14f1. の派生クラスです。

      -- の属性: expected

          期待される総バイト数 (*note int: 19b.) です。

      -- の属性: partial

          ストリームの終端に達するまでに読み込んだ *note bytes: 192. 文
          字列です。

 -- 例外: asyncio.LimitOverrunError

     区切り文字を探している間にバッファサイズの上限に到達しました。

     *note asyncio ストリーム API: 37b9. から送出されます。

      -- の属性: consumed

          未消費のバイトの合計数です。

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/exceptions.py


File: python.info,  Node: Call Graph Introspection,  Next: イベントループ,  Prev: 例外<16>,  Up: asyncio --- 非同期 I/O

5.19.1.50 Call Graph Introspection
..................................

'Source code:' Lib/asyncio/graph.py(1)

__________________________________________________________________

asyncio has powerful runtime call graph introspection utilities to trace
the entire call graph of a running 'coroutine' or 'task', or a suspended
'future'.  These utilities and the underlying machinery can be used from
within a Python program or by external profilers and debuggers.

Added in version 3.14.

 -- の関数: asyncio.print_call_graph (future=None, /, *, file=None,
          depth=1, limit=None)

     Print the async call graph for the current task or the provided
     *note Task: 1c7. or *note Future: dc6.

     This function prints entries starting from the top frame and going
     down towards the invocation point.

     The function receives an optional 'future' argument.  If not
     passed, the current running task will be used.

     If the function is called on 'the current task', the optional
     keyword-only 'depth' argument can be used to skip the specified
     number of frames from top of the stack.

     If the optional keyword-only 'limit' argument is provided, each
     call stack in the resulting graph is truncated to include at most
     ‘abs(limit)’ entries.  If 'limit' is positive, the entries left are
     the closest to the invocation point.  If 'limit' is negative, the
     topmost entries are left.  If 'limit' is omitted or ‘None’, all
     entries are present.  If 'limit' is ‘0’, the call stack is not
     printed at all, only "awaited by" information is printed.

     If 'file' is omitted or ‘None’, the function will print to *note
     sys.stdout: ccd.

     'Example:'

     The following Python code:

          import asyncio

          async def test():
              asyncio.print_call_graph()

          async def main():
              async with asyncio.TaskGroup() as g:
                  g.create_task(test(), name='test')

          asyncio.run(main())

     このサンプルコードは以下を出力します:

          * Task(name='test', id=0x1039f0fe0)
          + Call stack:
          |   File 't2.py', line 4, in async test()
          + Awaited by:
             * Task(name='Task-1', id=0x103a5e060)
                + Call stack:
                |   File 'taskgroups.py', line 107, in async TaskGroup.__aexit__()
                |   File 't2.py', line 7, in async main()

 -- の関数: asyncio.format_call_graph (future=None, /, *, depth=1,
          limit=None)

     Like *note print_call_graph(): 1cd, but returns a string.  If
     'future' is ‘None’ and there's no current task, the function
     returns an empty string.

 -- の関数: asyncio.capture_call_graph (future=None, /, *, depth=1,
          limit=None)

     Capture the async call graph for the current task or the provided
     *note Task: 1c7. or *note Future: dc6.

     The function receives an optional 'future' argument.  If not
     passed, the current running task will be used.  If there's no
     current task, the function returns ‘None’.

     If the function is called on 'the current task', the optional
     keyword-only 'depth' argument can be used to skip the specified
     number of frames from top of the stack.

     Returns a ‘FutureCallGraph’ data class object:

        * ‘FutureCallGraph(future, call_stack, awaited_by)’

               Where 'future' is a reference to a *note Future: dc6. or
               a *note Task: 1c7. (or their subclasses.)

               ‘call_stack’ is a tuple of ‘FrameCallGraphEntry’ objects.

               ‘awaited_by’ is a tuple of ‘FutureCallGraph’ objects.

        * ‘FrameCallGraphEntry(frame)’

               Where 'frame' is a frame object of a regular Python
               function in the call stack.

* Menu:

* Low level utility functions::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/asyncio/graph.py


File: python.info,  Node: Low level utility functions,  Up: Call Graph Introspection

5.19.1.51 Low level utility functions
.....................................

To introspect an async call graph asyncio requires cooperation from
control flow structures, such as *note shield(): c65. or *note
TaskGroup: 4d1.  Any time an intermediate *note Future: dc6. object with
low-level APIs like *note Future.add_done_callback(): cfe. is involved,
the following two functions should be used to inform asyncio about how
exactly such intermediate future objects are connected with the tasks
they wrap or control.

 -- の関数: asyncio.future_add_to_awaited_by (future, waiter, /)

     Record that 'future' is awaited on by 'waiter'.

     Both 'future' and 'waiter' must be instances of *note Future: dc6.
     or *note Task: 1c7. or their subclasses, otherwise the call would
     have no effect.

     A call to ‘future_add_to_awaited_by()’ must be followed by an
     eventual call to the *note future_discard_from_awaited_by(): 387c.
     function with the same arguments.

 -- の関数: asyncio.future_discard_from_awaited_by (future, waiter, /)

     Record that 'future' is no longer awaited on by 'waiter'.

     Both 'future' and 'waiter' must be instances of *note Future: dc6.
     or *note Task: 1c7. or their subclasses, otherwise the call would
     have no effect.


File: python.info,  Node: イベントループ,  Next: Future,  Prev: Call Graph Introspection,  Up: asyncio --- 非同期 I/O

5.19.1.52 イベントループ
........................

'ソースコード:' Lib/asyncio/profile.py(1) と Lib/asyncio/pstats.py(2)

__________________________________________________________________

まえがき
........

イベントループは全ての asyncio アプリケーションの中核をなす存在です。イ
ベントループは非同期タスクやコールバックを実行し、ネットワーク I/O を処
理し、サブプロセスを実行します。

アプリケーション開発者は通常 *note asyncio.run(): 2f3. のような高水準の
ayncio 関数だけを利用し、ループオブジェクトを参照したり、ループオブジェ
クトのメソッドを呼び出したりすることはほとんどありません。この節は、イベ
ントループの振る舞いに対して細かい調整が必要な、低水準のコード、ライブラ
リ、フレームワークの開発者向けです。

イベントループの取得
....................

以下の低水準関数はイベントループの取得、設定、生成するために使います:

 -- の関数: asyncio.get_running_loop ()

     現在の OS スレッドで実行中のイベントループを取得します。

     Raise a *note RuntimeError: 244. if there is no running event loop.

     This function can only be called from a coroutine or a callback.

     Added in version 3.7.

 -- の関数: asyncio.get_event_loop ()

     現在のイベントループを取得します。

     When called from a coroutine or a callback (e.g.  scheduled with
     call_soon or similar API), this function will always return the
     running event loop.

     If there is no running event loop set, the function will return the
     result of the ‘get_event_loop_policy().get_event_loop()’ call.

     この関数の振る舞いは (特にイベントループポリシーをカスタマイズした
     場合) 複雑なため、コルーチンやコールバックでは *note
     get_event_loop(): 2f2. よりも *note get_running_loop(): d01. を使う
     ほうが好ましいと考えられます。

     As noted above, consider using the higher-level *note
     asyncio.run(): 2f3. function, instead of using these lower level
     functions to manually create and close an event loop.

     バージョン 3.14 で変更: Raises a *note RuntimeError: 244. if there
     is no current event loop.

          注釈: The ‘asyncio’ policy system is deprecated and will be
          removed in Python 3.16; from there on, this function will
          return the current running event loop if present else it will
          return the loop set by *note set_event_loop(): 1b55.

 -- の関数: asyncio.set_event_loop (loop)

     'loop' を OS スレッドの現在のイベントループに設定します。

 -- の関数: asyncio.new_event_loop ()

     新しいイベントループオブジェクトを生成して返します。

*note get_event_loop(): 2f2, *note set_event_loop(): 1b55, および *note
new_event_loop(): 37c6. 関数の振る舞いは、 *note
カスタムイベントループポリシーを設定する: 3880. ことにより変更することが
できます。

内容
....

このページは以下の節から構成されます:

   * *note イベントループのメソッド: 3881. 節は、イベントループ API のリ
     ファレンスです。

   * *note コールバックハンドル: 3882. 節は *note loop.call_soon(): cfa.
     や *note loop.call_later(): cfc. などのスケジューリングメソッドが返
     す *note Handle: 1e84. や *note TimerHandle: 1add. インスタンスにつ
     いて解説しています。

   * *note サーバーオブジェクト: 3883. 節は *note loop.create_server():
     d09. のようなメソッドが返す型について解説しています。

   * *note イベントループの実装: 3884. 節は *note SelectorEventLoop:
     314. と *note ProactorEventLoop: 81d. の2つのクラスについて解説して
     います。

   * *note 使用例: 3885. 節ではイベントループ API の具体的な使い方を紹介
     しています。

* Menu:

* イベントループのメソッド::
* コールバックのハンドル::
* Serverオブジェクト::
* イベントループの実装::
* 使用例: 使用例<25>.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/profile.py

   (2) https://github.com/python/cpython/tree/3.14/Lib/asyncio/pstats.py


File: python.info,  Node: イベントループのメソッド,  Next: コールバックのハンドル,  Up: イベントループ

5.19.1.53 イベントループのメソッド
..................................

イベントループは以下の '低水準な' API を持っています:

* Menu:

* ループの開始と停止::
* コールバックのスケジューリング::
* 遅延コールバックのスケジューリング::
* フューチャーとタスクの生成::
* ネットワーク接続の確立::
* ネットワークサーバの生成::
* ファイルの転送::
* TLS へのアップグレード::
* ファイル記述子の監視::
* ソケットオブジェクトと直接やりとりする::
* DNS::
* パイプとやりとりする::
* Unix シグナル::
* スレッドまたはプロセスプールでコードを実行する::
* エラーハンドリング API::
* デバッグモードの有効化::
* サブプロセスの実行::


File: python.info,  Node: ループの開始と停止,  Next: コールバックのスケジューリング,  Up: イベントループのメソッド

5.19.1.54 ループの開始と停止
............................

 -- メソッド: loop.run_until_complete (future)

     'フューチャー' (*note Future: dc6. インスタンス) が完了するまで実行
     します。

     引数が *note コルーチンオブジェクト: 37b8. の場合、暗黙のうちに
     *note asyncio.Task: 1c7. として実行されるようにスケジュールされます
     。

     Future の結果を返すか、例外を送出します。

 -- メソッド: loop.run_forever ()

     *note stop(): e77. が呼び出されるまでイベントループを実行します。

     *note run_forever(): 3888. メソッドが呼ばれるより前に *note stop():
     e77. メソッドが呼ばれた場合、イベントループはタイムアウトをゼロにし
     て一度だけ I/O セレクタの問い合わせ処理を行い、 I/O イベントに対し
     てスケジュールされた全てのコールバック (および既にスケジュール済み
     のコールバック) を実行したのち、終了します。

     *note run_forever(): 3888. メソッドを実行中に *note stop(): e77. メ
     ソッドが呼び出された場合、イベントループは現在処理されているすべて
     のコールバックを実行してから終了します。 この場合、コールバックによ
     り新たにスケジュールされるコールバックは実行されないことに注意して
     ください; これら新たにスケジュールされたコールバックは、次に *note
     run_forever(): 3888. または *note run_until_complete(): e72. が呼び
     出されたときに実行されます。

 -- メソッド: loop.stop ()

     イベントループを停止します。

 -- メソッド: loop.is_running ()

     イベントループが現在実行中の場合 ‘True’ を返します。

 -- メソッド: loop.is_closed ()

     イベントループが閉じられていた場合 ‘True’ を返します。

 -- メソッド: loop.close ()

     イベントループをクローズします。

     この関数が呼び出される時点で、イベントループが実行中であってはいけ
     ません。保留中のコールバックはすべて破棄されます。

     このメソッドは全てのキューをクリアし、エグゼキューターが実行完了す
     るのを待たずにシャットダウンします。

     このメソッドはべき等 (何回実行しても結果は同じ) であり取り消せませ
     ん。イベントループがクローズされた後、他のいかなるメソッドも呼び出
     すべきではありません。

 -- メソッド: async loop.shutdown_asyncgens ()

     現在オープンになっているすべての *note asynchronous generator:
     249b. (非同期ジェネレータ) オブジェクトをスケジュールし、 *note
     aclose(): ad5. メソッドを呼び出すことでそれらをクローズします。 こ
     のメソッドの呼び出し後に新しい非同期ジェネレータがイテレートされる
     と、イベントループは警告を発します。このメソッドはスケジュールされ
     たすべての非同期ジェネレータの終了処理を確実に行うために使用すべき
     です。

     *note asyncio.run(): 2f3. を使った場合はこの関数を呼び出す必要はあ
     りません。

     以下はプログラム例です:

          try:
              loop.run_forever()
          finally:
              loop.run_until_complete(loop.shutdown_asyncgens())
              loop.close()

     Added in version 3.6.

 -- メソッド: async loop.shutdown_default_executor (timeout=None)

     Schedule the closure of the default executor and wait for it to
     join all of the threads in the *note ThreadPoolExecutor: 949.  Once
     this method has been called, using the default executor with *note
     loop.run_in_executor(): ae6. will raise a *note RuntimeError: 244.

     The 'timeout' parameter specifies the amount of time (in *note
     float: 196. seconds) the executor will be given to finish joining.
     With the default, ‘None’, the executor is allowed an unlimited
     amount of time.

     If the 'timeout' is reached, a *note RuntimeWarning: 4d7. is
     emitted and the default executor is terminated without waiting for
     its threads to finish joining.

          注釈: Do not call this method when using *note asyncio.run():
          2f3, as the latter handles default executor shutdown
          automatically.

     Added in version 3.9.

     バージョン 3.12 で変更: 'timeout' 引数が追加されました。


File: python.info,  Node: コールバックのスケジューリング,  Next: 遅延コールバックのスケジューリング,  Prev: ループの開始と停止,  Up: イベントループのメソッド

5.19.1.55 コールバックのスケジューリング
........................................

 -- メソッド: loop.call_soon (callback, *args, context=None)

     イベントループの次のイテレーションで 'callback' に指定したコールバ
     ック (*note callback: 2d9c.) を 'args' 引数で呼び出すようにスケジュ
     ールします。

     *note asyncio.Handle: 1e84. のインスタンスを返します。このインスタ
     ンスを使ってスケジュールしたコールバックをキャンセルすることができ
     ます。

     コールバックは登録された順に呼び出されます。各コールバックは厳密に
     1回だけ呼び出されます。

     The optional keyword-only 'context' argument specifies a custom
     *note contextvars.Context: 177. for the 'callback' to run in.
     Callbacks use the current context when no 'context' is provided.

     Unlike *note call_soon_threadsafe(): cfb, this method is not
     thread-safe.

 -- メソッド: loop.call_soon_threadsafe (callback, *args, context=None)

     A thread-safe variant of *note call_soon(): cfa.  When scheduling
     callbacks from another thread, this function 'must' be used, since
     *note call_soon(): cfa. is not thread-safe.

     This function is safe to be called from a reentrant context or
     signal handler, however, it is not safe or fruitful to use the
     returned handle in such contexts.

     すでにクローズされたイベントループに対してこのメソッドが呼び出され
     た場合 *note RuntimeError: 244. 例外を送出します。これはメインアプ
     リケーションが終了しているにもかかわらずセカンダリスレッドでメソッ
     ドが呼び出されるといった場合に起こりえます。

     このドキュメントの *note 並行処理とマルチスレッド処理: 37e8. 節を参
     照してください。

     バージョン 3.7 で変更: キーワード引数 'context' が追加されました。
     詳細は PEP 567(1) を参照してください。

     注釈: ほとんどの *note asyncio: b. モジュールのスケジューリング関数
     は、キーワード引数をコールバックに渡すことを許していません。キーワ
     ード引数を渡すためには *note functools.partial(): 217. を使ってくだ
     さい:

          # will schedule "print("Hello", flush=True)"
          loop.call_soon(
              functools.partial(print, "Hello", flush=True))

     asyncio は partial オブジェクトのデバッグメッセージやエラーメッセー
     ジをよりよく可視化することができるため、通常はラムダ式よりも
     partial オブジェクトを使う方が便利です。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0567/


File: python.info,  Node: 遅延コールバックのスケジューリング,  Next: フューチャーとタスクの生成,  Prev: コールバックのスケジューリング,  Up: イベントループのメソッド

5.19.1.56 遅延コールバックのスケジューリング
............................................

イベントループは、コールバック関数を未来のある時点で呼び出されるようにス
ケジュールする仕組みを提供します。イベントループは時刻が戻らない単調な時
計 (monotonic clock) を使って時刻を追跡します。

 -- メソッド: loop.call_later (delay, callback, *args, context=None)

     'delay' 秒経過後にコールバック関数 'callback' を呼び出すようにスケ
     ジュールします。 'delay' には整数または浮動小数点数を指定します。

     *note asyncio.TimerHandle: 1add. のインスタンスを返します。このイン
     スタンスを使ってスケジュールしたコールバックをキャンセルすることが
     できます。

     'callback' は厳密に一度だけ呼び出されます。2つのコールバックが完全
     に同じ時間にスケジュールされた場合、呼び出しの順序は未定義です。

     The optional positional 'args' will be passed to the callback when
     it is called.  Use *note functools.partial(): 217. *note to pass
     keyword arguments: 388c. to 'callback'.

     オプションのキーワード引数 'context' を使って、コールバック
     *callback* を実行する際のコンテキスト *note contextvars.Context:
     177. を設定することができます。コンテキスト 'context' が指定されな
     い場合は現在のコンテキストが使われます。

          注釈: For performance, callbacks scheduled with *note
          loop.call_later(): cfc. may run up to one clock-resolution
          early (see ‘time.get_clock_info('monotonic').resolution’).

     バージョン 3.7 で変更: キーワード引数 'context' が追加されました。
     詳細は PEP 567(1) を参照してください。

     バージョン 3.8 で変更: Python 3.7 またはそれ以前のバージョンでは、
     デフォルトイベントループの実装を利用した場合に遅延時間 'delay' が
     1日を超えることができませんでした。この問題は Python 3.8 で修正され
     ました。

 -- メソッド: loop.call_at (when, callback, *args, context=None)

     絶対値の時刻 'when' (整数または浮動小数点数) にコールバックを呼び出
     すようにスケジュールします。 *note loop.time(): 388f. と同じ参照時
     刻を使用します。

     このメソッドの振る舞いは *note call_later(): cfc. と同じです。

     *note asyncio.TimerHandle: 1add. のインスタンスを返します。このイン
     スタンスを使ってスケジュールしたコールバックをキャンセルすることが
     できます。

          注釈: For performance, callbacks scheduled with *note
          loop.call_at(): cfd. may run up to one clock-resolution early
          (see ‘time.get_clock_info('monotonic').resolution’).

     バージョン 3.7 で変更: キーワード引数 'context' が追加されました。
     詳細は PEP 567(2) を参照してください。

     バージョン 3.8 で変更: Python 3.7 またはそれ以前のバージョンでは、
     デフォルトイベントループの実装を利用した場合に現在の時刻と 'when' と
     の差が1日を超えることができませんでした。この問題は Python 3.8 で修
     正されました。

 -- メソッド: loop.time ()

     現在の時刻を *note float: 196. 値で返します。時刻はイベントループが
     内部で参照している時刻が戻らない単調な時計 (monotonic clock) に従い
     ます。

     注釈: 
     バージョン 3.8 で変更: Python 3.7 またはそれ以前のバージョンでは、
     タイムアウト (相対値 'delay' もしくは絶対値 'when') は1日を超えるこ
     とができませんでした。この問題は Python 3.8 で修正されました。

参考
....

関数 *note asyncio.sleep(): c64.。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0567/

   (2) https://peps.python.org/pep-0567/


File: python.info,  Node: フューチャーとタスクの生成,  Next: ネットワーク接続の確立,  Prev: 遅延コールバックのスケジューリング,  Up: イベントループのメソッド

5.19.1.57 フューチャーとタスクの生成
....................................

 -- メソッド: loop.create_future ()

     イベントループに接続した *note asyncio.Future: dc6. オブジェクトを
     生成します。

     asyncio でフューチャーオブジェクトを作成するために推奨される方法で
     す。このメソッドにより、サードパーティ製のイベントループがFutures ク
     ラスの(パフォーマンスや計測方法が優れた) 代替実装を提供することを可
     能にします。

     Added in version 3.5.2.

 -- メソッド: loop.create_task (coro, *, name=None, context=None,
          eager_start=None, **kwargs)

     *note コルーチン: 37b8. 'coro' の実行をスケジュールします。 *note
     Task: 1c7. オブジェクトを返します。

     サードパーティのイベントループは相互運用のための自身の *note Task:
     1c7. のサブクラスを使用できます。この場合、結果は *note Task: 1c7.
     のサブクラスになります。

     The full function signature is largely the same as that of the
     *note Task: 1c7. constructor (or factory) - all of the keyword
     arguments to this function are passed through to that interface.

     'name' 引数が指定され、値が ‘None’ でない場合、 *note
     Task.set_name(): bd0. メソッドにより 'name' がタスクの名前として設
     定されます。

     省略可能なキーワード引数 'context' によって、'coro' を実行するため
     のカスタムの *note contextvars.Context: 177. を指定できます。
     'context' が省略された場合、現在のコンテキストのコピーが作成されま
     す。

     An optional keyword-only 'eager_start' argument allows specifying
     if the task should execute eagerly during the call to create_task,
     or be scheduled later.  If 'eager_start' is not passed the mode set
     by *note loop.set_task_factory(): 1c8. will be used.

     バージョン 3.8 で変更: 'name' パラメータを追加しました。

     バージョン 3.11 で変更: 'context' パラメータを追加しました。

     バージョン 3.13.3 で変更: Added ‘kwargs’ which passes on arbitrary
     extra parameters, including ‘name’ and ‘context’.

     バージョン 3.13.4 で変更: Rolled back the change that passes on
     'name' and 'context' (if it is None), while still passing on other
     arbitrary keyword arguments (to avoid breaking backwards
     compatibility with 3.13.3).

     バージョン 3.14 で変更: All 'kwargs' are now passed on.  The
     'eager_start' parameter works with eager task factories.

 -- メソッド: loop.set_task_factory (factory)

     *note loop.create_task(): 1ca. が使用するタスクファクトリーを設定し
     ます。

     If 'factory' is ‘None’ the default task factory will be set.
     Otherwise, 'factory' must be a 'callable' with the signature
     matching ‘(loop, coro, **kwargs)’, where 'loop' is a reference to
     the active event loop, and 'coro' is a coroutine object.  The
     callable must pass on all 'kwargs', and return a *note
     asyncio.Task: 1c7.-compatible object.

     バージョン 3.13.3 で変更: Required that all 'kwargs' are passed on
     to *note asyncio.Task: 1c7.

     バージョン 3.13.4 で変更: 'name' is no longer passed to task
     factories.  'context' is no longer passed to task factories if it
     is ‘None’.

     バージョン 3.14 で変更: 'name' and 'context' are now
     unconditionally passed on to task factories again.

 -- メソッド: loop.get_task_factory ()

     タスクファクトリを返します。デフォルトのタスクファクトリを使用中の
     場合は ‘None’ を返します。


File: python.info,  Node: ネットワーク接続の確立,  Next: ネットワークサーバの生成,  Prev: フューチャーとタスクの生成,  Up: イベントループのメソッド

5.19.1.58 ネットワーク接続の確立
................................

 -- メソッド: async loop.create_connection (protocol_factory, host=None,
          port=None, *, ssl=None, family=0, proto=0, flags=0, sock=None,
          local_addr=None, server_hostname=None,
          ssl_handshake_timeout=None, ssl_shutdown_timeout=None,
          happy_eyeballs_delay=None, interleave=None, all_errors=False)

     'host' と 'port' で指定されたアドレスとのストリーミングトランスポー
     ト接続をオープンします。

     ソケットファミリーは 'host' (または 'family' 引数が与えられた場合は
     'family') に依存し、 *note AF_INET: 1bad. か *note AF_INET6: 1bae.
     のいずれかを指定します。

     ソケットタイプは *note SOCK_STREAM: 150b. になります。

     'protocol_factory' は *note asyncio プロトコル: 3892. の実装を返す
     呼び出し可能オブジェクトでなければなりません。

     このメソッドはバックグラウンドで接続の確立を試みます。成功した場合
     、メソッドは ‘(transport, protocol)’ のペアを返します。

     時系列での下層処理の概要は以下のとおりです:

       1. 接続を確立し、その接続に対する *note トランスポート: 3893. が
          生成されます。

       2. 'protocol_factory' が引数なしで呼び出され、ファクトリが *note
          プロトコル: 3892. インスタンスを返すよう要求します。

       3. プロトコルインスタンスが *note connection_made(): 3894. メソッ
          ドを呼び出すことにより、トランスポートと紐付けられます。

       4. 成功すると ‘(transport, protocol)’ タプルが返されます。

     作成されたトランスポートは実装依存の双方向ストリームです。

     その他の引数:

        * 'ssl': 偽値以外が与えられた場合、SSL/TLS トランスポートが作成
          されます (デフォルトでは暗号化なしの TCP トランスポートが作成
          されます)。 'ssl' が *note ssl.SSLContext: 357. オブジェクトの
          場合、このコンテキストがトランスポートを作成するために使用され
          ます; 'ssl' が *note True: e07. の場合、 *note
          ssl.create_default_context(): 480. が返すデフォルトのコンテキ
          ストが使われます。

          参考
          ....

          *note SSL/TLS セキュリティについての考察: 3895.

        * 'server_hostname' は対象サーバーの証明書との一致を確認するため
          のホスト名を設定または上書きします。この引数は 'ssl' が ‘None’
          でない場合のみ設定すべきです。デフォルトでは 'host' に指定した
          サーバー名が使用されます。 'host' が空の文字列の場合のデフォル
          ト値は設定されていません。その場合、 'server_hostname' を必ず
          指定してください。 'server_hostname' も空の文字列の場合は、ホ
          スト名の一致確認は行われません (これは深刻なセキュリティリスク
          であり、中間者攻撃を受ける可能性があります)。

        * 'family', 'proto', 'flags' は任意のアドレスファミリであり、
          'host' 解決のための getaddrinfo() 経由で渡されるプロトコルおよ
          びフラグになります。このオプションが与えられた場合、これらはす
          べて *note socket: d1. モジュール定数に従った整数でなければな
          りません。

        * 'happy_eyeballs_delay' が設定されると、この接続に対して Happy
          Eyeballs が有効化されます。設定する値は浮動小数点数であり、次
          の接続試行を開始する前に、現在の接続試行が完了するのを待つ時間
          を秒単位で表現します。この値は RFC 8305(1) で定義されている "接
          続試行遅延" に相当します。RFC で推奨されている実用的なデフォル
          ト値は ‘0.25’ (250 ミリ秒) です。

        * 'interleave' はホスト名が複数の IP アドレスに名前解決される場
          合のアドレスの並べ替えを制御します。 ‘0’ または未指定の場合並
          べ替えは行われず、 *note getaddrinfo(): e0e. が返す順番にした
          がってアドレスへの接続を試行します。正の整数が指定されると、ア
          ドレスはアドレスファミリに応じてインターリーブされます。このと
          き、与えられた整数は RFC 8305(2) で定義される "最初のアドレス
          ファミリカウント (First Address Family Count)" として解釈され
          ます。デフォルト値は、 'happy_eyeballs_delay' が指定されない場
          合は ‘0’ であり、指定された場合は ‘1’ です。

        * 'sock' を与える場合、トランスポートに使用される、既存の、かつ
          接続済の *note socket.socket: fa1. オブジェクトを指定します。
          'sock' を指定する場合、'host'、 'port'、 'family'、 'proto'、
          'flags'、 'happy_eyeballs_delay'、 'interleave' および
          'local_addr' のいずれも指定してはいけません。

               注釈: The 'sock' argument transfers ownership of the
               socket to the transport created.  To close the socket,
               call the transport's *note close(): 3896. method.

        * 'local_addr' を与える場合、ソケットをローカルにバインドするた
          めに使用する ‘(local_host, local_port)’ タプルを指定します。
          'local_host' と 'local_port' は、 'host' および 'port' と同じ
          く ‘getaddrinfo()’ を使ってルックアップされます。

        * 'ssl_handshake_timeout' は TLS ハンドシェイクが完了するまでの
          (TLS 接続のための) 待ち時間を秒単位で指定します。指定した待ち
          時間を超えると接続は中断します。 ‘None’ が与えられた場合はデフ
          ォルト値 ‘60.0’ が使われます。

        * 'ssl_shutdown_timeout' is the time in seconds to wait for the
          SSL shutdown to complete before aborting the connection.
          ‘30.0’ seconds if ‘None’ (default).

        * 'all_errors' determines what exceptions are raised when a
          connection cannot be created.  By default, only a single
          ‘Exception’ is raised: the first exception if there is only
          one or all errors have same message, or a single ‘OSError’
          with the error messages combined.  When ‘all_errors’ is
          ‘True’, an ‘ExceptionGroup’ will be raised containing all
          exceptions (even if there is only one).

     バージョン 3.5 で変更: *note ProactorEventLoop: 81d. において
     SSL/TLS のサポートが追加されました。

     バージョン 3.6 で変更: 全ての TCP 接続に対してデフォルトでソケット
     オプション *note socket.TCP_NODELAY: d6c. が設定されるようになりま
     した。

     バージョン 3.7 で変更: 'ssl_handshake_timeout' 引数が追加されました
     。

     バージョン 3.8 で変更: 'happy_eyeballs_delay' と 'interleave' が追
     加されました。

     Happy Eyeballs Algorithm: Success with Dual-Stack Hosts.  When a
     server's IPv4 path and protocol are working, but the server's IPv6
     path and protocol are not working, a dual-stack client application
     experiences significant connection delay compared to an IPv4-only
     client.  This is undesirable because it causes the dual-stack
     client to have a worse user experience.  This document specifies
     requirements for algorithms that reduce this user-visible delay and
     provides an algorithm.

     詳しくは右記を参照してください:
     ‘https://datatracker.ietf.org/doc/html/rfc6555’

     バージョン 3.11 で変更: 'ssl_shutdown_timeout' パラメータが追加され
     ました。

     バージョン 3.12 で変更: 'all_errors' が追加されました

     参考
     ....

     *note open_connection(): d0e. 関数は高水準の代替 API です。この関数
     は(*note StreamReader: 1c7d, *note StreamWriter: 1a70.) のペアを返
     し、 async/await コードから直接使うことができます。

 -- メソッド: async loop.create_datagram_endpoint (protocol_factory,
          local_addr=None, remote_addr=None, *, family=0, proto=0,
          flags=0, reuse_port=None, allow_broadcast=None, sock=None)

     データグラム接続 (UDP) を生成します。

     ソケットファミリーは 'host' (または 'family' 引数が与えられた場合は
     'family') に依存し、 *note AF_INET: 1bad.、 *note AF_INET6: 1bae.、
     *note AF_UNIX: 1bb0. のいずれかを指定します。

     ソケットタイプは *note SOCK_DGRAM: 150a. になります。

     'protocol_factory' は *note asyncio プロトコル: 3892. の実装を返す
     呼び出し可能オブジェクトでなければなりません。

     成功すると ‘(transport, protocol)’ タプルが返されます。

     その他の引数:

        * 'local_addr' が指定される場合、ソケットをローカルにバインドす
          るための ‘(local_host, local_port)’ のタプルを指定します。
          'local_host' と 'local_port' は *note getaddrinfo(): e0e. メソ
          ッドを使用して検索されます。

               注釈: On Windows, when using the proactor event loop with
               ‘local_addr=None’, an *note OSError: 2c0. with
               ‘errno.WSAEINVAL’ will be raised when running it.

        * 'remote_addr' が指定される場合、‘(remote_host, remote_por)’ の
          タプルで、ソケットをリモートアドレスに束縛するために使用されま
          す。'remote_host' と 'remote_port' は *note getaddrinfo():
          e0e. を使用して検索されます。

        * 'family', 'proto', 'flags' は任意のアドレスファミリです。これ
          らのファミリ、プロトコル、フラグは、'host' 解決のため *note
          getaddrinfo(): e0e. 経由でオプションで渡されます。これらのオプ
          ションを指定する場合、すべて *note socket: d1. モジュール定数
          に従った整数でなければなりません。

        * 'reuse_port' は、同じポートにバインドされた既存の端点すべてが
          このフラグを設定して生成されている場合に限り、この端点を既存の
          端点と同じポートにバインドすることを許可するよう、カーネルに指
          示します（訳註: ソケットのオプション SO_REUSEPORT を使用します
          ）。このオプションは、Windows やいくつかの UNIX システムではサ
          ポートされていません。*note socket.SO_REUSEPORT: d6c. 定数が定
          義されていなければ、この機能はサポートされません。

        * 'allow_broadcast' は、カーネルに、このエンドポイントがブロード
          キャストアドレスにメッセージを送信することを許可するように指示
          します。

        * オプションの 'sock' を指定することで、既存の、すでに接続されて
          いる *note socket.socket: fa1. をトランスポートで使用すること
          ができます。このオプションを使用する場合、'local_addr' と
          'remote_addr' は省略してください (*note None: 885. でなければ
          なりません)。

               注釈: The 'sock' argument transfers ownership of the
               socket to the transport created.  To close the socket,
               call the transport's *note close(): 3896. method.

     *note UDP echo クライアントプロトコル: 3897. および *note UDP echo
     サーバープロトコル: 3898. の例を参照してください。

     バージョン 3.4.4 で変更: 'family', 'proto', 'flags',
     'reuse_address', 'reuse_port', 'allow_broadcast', 'sock' パラメータ
     が追加されました。

     バージョン 3.8 で変更: Windows サポートが追加されました。

     バージョン 3.8.1 で変更: *note socket.SO_REUSEADDR: d6c. の利用が
     UDP に対して重大なセキュリティ上の懸念をもたらすため、
     'reuse_address' パラメータはサポートされなくなりました。明示的に
     ‘reuse_address=True’ を設定すると例外を送出します。

     ‘SO_REUSEADDR’ を使って、同一の UDP ソケットアドレスに対して複数の
     プロセスが異なる UID でソケットを割り当てている場合、受信パケットは
     複数のソケット間にランダムに分散する可能性があります。

     サポートされているプラットフォームでは、 'reuse_port' が同様の機能
     に対する代用品として利用できます。 'reuse_port' は代替機能として
     *note socket.SO_REUSEPORT: d6c. を使っており、複数のプロセスが異な
     る UID で同一のソケットに対して割り当てられるのを明確に禁止します。

     バージョン 3.11 で変更: The 'reuse_address' parameter, disabled
     since Python 3.8.1, 3.7.6 and 3.6.10, has been entirely removed.

 -- メソッド: async loop.create_unix_connection (protocol_factory,
          path=None, *, ssl=None, sock=None, server_hostname=None,
          ssl_handshake_timeout=None, ssl_shutdown_timeout=None)

     Unix 接続を生成します。

     ソケットファミリーは *note AF_UNIX: 1bb0. になります; また、ソケッ
     トタイプは *note SOCK_STREAM: 150b. になります。

     成功すると ‘(transport, protocol)’ タプルが返されます。

     'path' は Unix ドメインソケット名で、 'sock' パラメータが指定されな
     い場合は必須です。 抽象 Unix ソケット、 *note str: 169.、 *note
     bytes: 192.、 and *note Path: 266. 形式でのパスがサポートされていま
     す。

     このメソッドの引数についての詳細は *note loop.create_connection():
     818. メソッドのドキュメントを参照してください。

     *note Availability: 213f.: Unix.

     バージョン 3.7 で変更: Added the 'ssl_handshake_timeout' parameter.
     The 'path' parameter can now be a *note path-like object: 5a1.

     バージョン 3.11 で変更: 'ssl_shutdown_timeout' パラメータが追加され
     ました。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc8305.html

   (2) https://datatracker.ietf.org/doc/html/rfc8305.html


File: python.info,  Node: ネットワークサーバの生成,  Next: ファイルの転送,  Prev: ネットワーク接続の確立,  Up: イベントループのメソッド

5.19.1.59 ネットワークサーバの生成
..................................

 -- メソッド: async loop.create_server (protocol_factory, host=None,
          port=None, *, family=socket.AF_UNSPEC,
          flags=socket.AI_PASSIVE, sock=None, backlog=100, ssl=None,
          reuse_address=None, reuse_port=None, keep_alive=None,
          ssl_handshake_timeout=None, ssl_shutdown_timeout=None,
          start_serving=True)

     Create a TCP server (socket type *note SOCK_STREAM: 150b.)
     listening on 'port' of the 'host' address.

     *note Server: d08. オブジェクトを返します。

     引数:

        * 'protocol_factory' は *note asyncio プロトコル: 3892. の実装を
          返す呼び出し可能オブジェクトでなければなりません。

        * 'host' パラメータはいくつかの方法で指定することができ、その値
          によってサーバーがどこをリッスンするかが決まります。

             - 'host' が文字列の場合、 TCP サーバーは 'host' で指定した
               単一のネットワークインターフェースに束縛されます。

             - 'host' が文字列のシーケンスである場合、 TCP サーバーはそ
               のシーケンスで指定された全てのネットワークインターフェー
               スに束縛されます。

             - 'host' が空の文字列か ‘None’ の場合、すべてのインターフェ
               ースが想定され、複合的なソケットのリスト (通常は一つが
               IPv4、もう一つが IPv6) が返されます。

        * The 'port' parameter can be set to specify which port the
          server should listen on.  If ‘0’ or ‘None’ (the default), a
          random unused port will be selected (note that if 'host'
          resolves to multiple network interfaces, a different random
          port will be selected for each interface).

        * 'family' can be set to either *note socket.AF_INET: 1bad. or
          *note AF_INET6: 1bae. to force the socket to use IPv4 or IPv6.
          If not set, the 'family' will be determined from host name
          (defaults to *note AF_UNSPEC: 389a.).

        * 'flags' は *note getaddrinfo(): e0e. のためのビットマスクにな
          ります。

        * サーバーで既存のソケットオブジェクトを使用するために、オプショ
          ンの引数 'sock' にソケットオブジェクトを設定することができます
          。指定した場合、 'host' と 'port' を指定してはいけません。

               注釈: The 'sock' argument transfers ownership of the
               socket to the server created.  To close the socket, call
               the server's *note close(): 37fd. method.

        * 'backlog' は *note listen(): 105e. に渡される、キューに入るコ
          ネクションの最大数になります (デフォルトは 100)。

        * 確立した接続の上で TLS を有効化するために、 'ssl' に *note
          SSLContext: 357. のインスタンスを指定することができます。

        * 'reuse_address' は、‘TIME_WAIT’ 状態にあるローカルソケットを、
          その状態が自然にタイムアウトするのを待つことなく再利用するよう
          カーネルに指示します（訳註: ソケットのオプション SO_REUSEADDR
          を使用します）。指定しない場合、UNIX では自動的に ‘True’ が設
          定されます。

        * 'reuse_port' は、同じポートにバインドされた既存の端点すべてが
          このフラグを設定して生成されている場合に限り、この端点を既存の
          端点と同じポートにバインドすることを許可するよう、カーネルに指
          示します（訳註: ソケットのオプション SO_REUSEPORT を使用します
          ）。このオプションは、Windows ではサポートされていません。

        * 'keep_alive' set to ‘True’ keeps connections active by
          enabling the periodic transmission of messages.

     バージョン 3.13 で変更: Added the 'keep_alive' parameter.

        * 'ssl_handshake_timeout' は TLS ハンドシェイクが完了するまでの
          (TLS サーバーのための) 待ち時間を秒単位で指定します。指定した
          待ち時間を超えると接続は中断します。 ‘None’ が与えられた場合は
          デフォルト値 ‘60.0’ が使われます。

        * 'ssl_shutdown_timeout' is the time in seconds to wait for the
          SSL shutdown to complete before aborting the connection.
          ‘30.0’ seconds if ‘None’ (default).

        * 'start_serving' が ‘True’ に設定された場合 (これがデフォルトで
          す)、 生成されたサーバーは即座に接続の受け付けを開始します。
          ‘False’ が指定された場合、ユーザーは接続の受け付けを開始するた
          めに *note Server.start_serving(): d0a. または *note
          Server.serve_forever(): d0b. を待ち受け (await) る必要がありま
          す。

     バージョン 3.5 で変更: *note ProactorEventLoop: 81d. において
     SSL/TLS のサポートが追加されました。

     バージョン 3.5.1 で変更: 'host' パラメータに文字列のシーケンスを指
     定できるようになりました。

     バージョン 3.6 で変更: Added 'ssl_handshake_timeout' and
     'start_serving' parameters.  The socket option *note
     socket.TCP_NODELAY: d6c. is set by default for all TCP connections.

     バージョン 3.11 で変更: 'ssl_shutdown_timeout' パラメータが追加され
     ました。

     参考
     ....

     *note start_server(): d0f. 関数は高水準の代替 API です。この関数は
     *note StreamReader: 1c7d. と *note StreamWriter: 1a70. のペアを返し
     、async/await コードから使うことができます。

 -- メソッド: async loop.create_unix_server (protocol_factory,
          path=None, *, sock=None, backlog=100, ssl=None,
          ssl_handshake_timeout=None, ssl_shutdown_timeout=None,
          start_serving=True, cleanup_socket=True)

     Similar to *note loop.create_server(): d09. but works with the
     *note AF_UNIX: 1bb0. socket family.

     'path' は Unix ドメインソケット名で、 'sock' パラメータが指定されな
     い場合は必須です。 抽象 Unix ソケット、 *note str: 169.、 *note
     bytes: 192.、 and *note Path: 266. 形式でのパスがサポートされていま
     す。

     If 'cleanup_socket' is true then the Unix socket will automatically
     be removed from the filesystem when the server is closed, unless
     the socket has been replaced after the server has been created.

     このメソッドの引数についての詳細は *note loop.create_server(): d09.
     メソッドのドキュメントを参照してください。

     *note Availability: 213f.: Unix.

     バージョン 3.7 で変更: Added the 'ssl_handshake_timeout' and
     'start_serving' parameters.  The 'path' parameter can now be a
     *note Path: 266. object.

     バージョン 3.11 で変更: 'ssl_shutdown_timeout' パラメータが追加され
     ました。

     バージョン 3.13 で変更: Added the 'cleanup_socket' parameter.

 -- メソッド: async loop.connect_accepted_socket (protocol_factory,
          sock, *, ssl=None, ssl_handshake_timeout=None,
          ssl_shutdown_timeout=None)

     すでに確立した接続を transport と protocol のペアでラップします。

     このメソッドは asyncio の範囲外で確立された接続を使うサーバーに対し
     ても使えますが、その場合でも接続は asyncio を使って処理されます。

     引数:

        * 'protocol_factory' は *note asyncio プロトコル: 3892. の実装を
          返す呼び出し可能オブジェクトでなければなりません。

        * 'sock' は *note socket.accept: fa2. メソッドが返す既存のソケッ
          トオブジェクトです。

               注釈: The 'sock' argument transfers ownership of the
               socket to the transport created.  To close the socket,
               call the transport's *note close(): 3896. method.

        * 'ssl' には *note SSLContext: 357. を指定できます。指定すると、
          受け付けたコネクション上での SSL を有効にします。

        * 'ssl_handshake_timeout' は SSL ハンドシェイクが完了するまでの
          (SSL 接続のための) 待ち時間を秒単位で指定します。 ‘None’ が与
          えられた場合はデフォルト値 ‘60.0’ が使われます。

        * 'ssl_shutdown_timeout' is the time in seconds to wait for the
          SSL shutdown to complete before aborting the connection.
          ‘30.0’ seconds if ‘None’ (default).

     ‘(transport, protocol)’ のペアを返します。

     Added in version 3.5.3.

     バージョン 3.7 で変更: 'ssl_handshake_timeout' 引数が追加されました
     。

     バージョン 3.11 で変更: 'ssl_shutdown_timeout' パラメータが追加され
     ました。


File: python.info,  Node: ファイルの転送,  Next: TLS へのアップグレード,  Prev: ネットワークサーバの生成,  Up: イベントループのメソッド

5.19.1.60 ファイルの転送
........................

 -- メソッド: async loop.sendfile (transport, file, offset=0,
          count=None, *, fallback=True)

     'transport' を通じて 'file' を送信します。送信したデータの総バイト
     数を返します。

     このメソッドは、もし利用可能であれば高性能な *note os.sendfile():
     d05. を利用します。

     'file' はバイナリモードでオープンされた通常のファイルオブジェクトで
     なければなりません。

     'offset' はファイルの読み込み開始位置を指定します。 'count' が指定
     された場合、ファイルの EOF までファイルを送信する代わりに、 'count'
     で指定された総バイト数の分だけ送信します。ファイルオブジェクトが指
     し示す位置は、メソッドがエラーを送出した場合でも更新されます。この
     場合実際に送信されたバイト数は *note file.tell(): 15c6. メソッドで
     取得することができます。

     'fallback' を ‘True’ に指定することで、 asyncio がプラットフォーム
     が sendfile システムコールをサポートしていない場合 (たとえば
     Windows や Unix の SSL ソケットなど) に別の方法でファイルの読み込み
     と送信を行うようにすることができます。

     システムが 'sendfile' システムコールをサポートしておらず、かつ
     'fallback' が ‘False’ の場合、 *note SendfileNotAvailableError:
     3872. 例外を送出します。

     Added in version 3.7.


File: python.info,  Node: TLS へのアップグレード,  Next: ファイル記述子の監視,  Prev: ファイルの転送,  Up: イベントループのメソッド

5.19.1.61 TLS へのアップグレード
................................

 -- メソッド: async loop.start_tls (transport, protocol, sslcontext, *,
          server_side=False, server_hostname=None,
          ssl_handshake_timeout=None, ssl_shutdown_timeout=None)

     既存のトランスポートベースの接続を TLS にアップグレードします。

     Create a TLS coder/decoder instance and insert it between the
     'transport' and the 'protocol'.  The coder/decoder implements both
     'transport'-facing protocol and 'protocol'-facing transport.

     Return the created two-interface instance.  After 'await', the
     'protocol' must stop using the original 'transport' and communicate
     with the returned object only because the coder caches
     'protocol'-side data and sporadically exchanges extra TLS session
     packets with 'transport'.

     In some situations (e.g.  when the passed transport is already
     closing) this may return ‘None’.

     引数:

        * 'transport' と 'protocol' には、 *note create_server(): d09. や
          *note create_connection(): 818. が返すものと同等のインスタンス
          を指定します。

        * 'sslcontext': 構成済みの *note SSLContext: 357. インスタンスで
          す。

        * (*note create_server(): d09. で生成されたような) サーバーサイ
          ドの接続をアップグレードする場合は 'server_side' に ‘True’ を
          渡します。

        * 'server_hostname': 対象のサーバーの証明書との照合に使われるホ
          スト名を設定または上書きします。

        * 'ssl_handshake_timeout' は TLS ハンドシェイクが完了するまでの
          (TLS 接続のための) 待ち時間を秒単位で指定します。指定した待ち
          時間を超えると接続は中断します。 ‘None’ が与えられた場合はデフ
          ォルト値 ‘60.0’ が使われます。

        * 'ssl_shutdown_timeout' is the time in seconds to wait for the
          SSL shutdown to complete before aborting the connection.
          ‘30.0’ seconds if ‘None’ (default).

     Added in version 3.7.

     バージョン 3.11 で変更: 'ssl_shutdown_timeout' パラメータが追加され
     ました。


File: python.info,  Node: ファイル記述子の監視,  Next: ソケットオブジェクトと直接やりとりする,  Prev: TLS へのアップグレード,  Up: イベントループのメソッド

5.19.1.62 ファイル記述子の監視
..............................

 -- メソッド: loop.add_reader (fd, callback, *args)

     ファイル記述子 'fd' に対する読み込みが可能かどうかの監視を開始し、
     'fd' が読み込み可能になると、指定した引数でコールバック 'callback'
     を呼び出します。

     Any preexisting callback registered for 'fd' is cancelled and
     replaced by 'callback'.

 -- メソッド: loop.remove_reader (fd)

     Stop monitoring the 'fd' file descriptor for read availability.
     Returns ‘True’ if 'fd' was previously being monitored for reads.

 -- メソッド: loop.add_writer (fd, callback, *args)

     Start monitoring the 'fd' file descriptor for write availability
     and invoke 'callback' with the specified arguments 'args' once 'fd'
     is available for writing.

     Any preexisting callback registered for 'fd' is cancelled and
     replaced by 'callback'.

     コールバック 'callback' に *note キーワード引数を渡す: 388c. 場合は
     *note functools.partial(): 217. を使ってください。

 -- メソッド: loop.remove_writer (fd)

     Stop monitoring the 'fd' file descriptor for write availability.
     Returns ‘True’ if 'fd' was previously being monitored for writes.

これらのメソッドに対する制限事項については *note
プラットフォームのサポート状況: 38a2. 節も参照してください。


File: python.info,  Node: ソケットオブジェクトと直接やりとりする,  Next: DNS,  Prev: ファイル記述子の監視,  Up: イベントループのメソッド

5.19.1.63 ソケットオブジェクトと直接やりとりする
................................................

一般に、 *note loop.create_connection(): 818. や *note
loop.create_server(): d09. のようなトランスポートベースの API を使ったプ
ロトコルの実装はソケットと直接やり取りする実装に比べて高速です。しかしな
がら、パフォーマンスが重要でなく、直接 *note socket: fa1. オブジェクトと
やりとりした方が便利なユースケースがいくつかあります。

 -- メソッド: async loop.sock_recv (sock, nbytes)

     'nbytes' で指定したバイト数までのデータをソケット 'sock' から受信し
     ます。 このメソッドは *note socket.recv(): fa4. の非同期版です。

     受信したデータをバイトオブジェクトとして返します。

     'sock' はノンブロッキングソケットでなければなりません。

     バージョン 3.7 で変更: このメソッドは常にコルーチンメソッドとしてド
     キュメントに記載されてきましたが、 Python 3.7 以前のリリースでは
     *note Future: dc6. オブジェクトを返していました。 Python 3.7 からは
     ‘async def’ メソッドになりました。

 -- メソッド: async loop.sock_recv_into (sock, buf)

     ソケット 'sock' からデータを受信してバッファ 'buf' に格納します。ブ
     ロッキングコードの *note socket.recv_into(): 1535. メソッドをモデル
     としています。

     バッファに書き込んだデータのバイト数を返します。

     'sock' はノンブロッキングソケットでなければなりません。

     Added in version 3.7.

 -- メソッド: async loop.sock_recvfrom (sock, bufsize)

     Receive a datagram of up to 'bufsize' from 'sock'.  Asynchronous
     version of *note socket.recvfrom(): fa5.

     Return a tuple of (received data, remote address).

     'sock' はノンブロッキングソケットでなければなりません。

     Added in version 3.11.

 -- メソッド: async loop.sock_recvfrom_into (sock, buf, nbytes=0)

     Receive a datagram of up to 'nbytes' from 'sock' into 'buf'.
     Asynchronous version of *note socket.recvfrom_into(): 1536.

     Return a tuple of (number of bytes received, remote address).

     'sock' はノンブロッキングソケットでなければなりません。

     Added in version 3.11.

 -- メソッド: async loop.sock_sendall (sock, data)

     データ 'data' をソケット 'sock' に送信します。 *note
     socket.sendall(): fa8. メソッドの非同期版です。

     このメソッドは 'data' をすべて送信し終えるか、またはエラーが起きる
     までデータをソケットに送信し続けます。送信に成功した場合 ‘None’ を
     返します。エラーの場合は例外が送出されます。エラーとなった場合、接
     続の受信側で正しく処理されたデータの総量を特定する方法はありません
     。

     'sock' はノンブロッキングソケットでなければなりません。

     バージョン 3.7 で変更: このメソッドは常にコルーチンメソッドとしてド
     キュメントに記載されてきましたが、 Python 3.7 以前のリリースでは
     *note Future: dc6. オブジェクトを返していました。 Python 3.7 からは
     ‘async def’ メソッドになりました。

 -- メソッド: async loop.sock_sendto (sock, data, address)

     Send a datagram from 'sock' to 'address'.  Asynchronous version of
     *note socket.sendto(): fa9.

     Return the number of bytes sent.

     'sock' はノンブロッキングソケットでなければなりません。

     Added in version 3.11.

 -- メソッド: async loop.sock_connect (sock, address)

     ソケット 'sock' をアドレス 'address' のリモートソケットに接続します
     。

     *note socket.connect(): fa3. の非同期版です。

     'sock' はノンブロッキングソケットでなければなりません。

     バージョン 3.5.2 で変更: ‘address’ を名前解決する必要はなくなりまし
     た。 ‘sock_connect’ は *note socket.inet_pton(): b5b. を呼び出して
     'address' が解決済みかどうかを確認します。未解決の場合、 'address'
     の名前解決には *note loop.getaddrinfo(): e0e. メソッドが使われます
     。

     参考
     ....

     *note loop.create_connection(): 818. および *note
     asyncio.open_connection(): d0e.。

 -- メソッド: async loop.sock_accept (sock)

     接続を受け付けます。ブロッキングコールの *note socket.accept():
     fa2. メソッドをモデルとしています。

     ソケットはアドレスに束縛済みで、接続を listen 中である必要がありま
     す。戻り値は ‘(conn, address)’ のペアで、'conn' は接続を通じてデー
     タの送受信を行うための '新しい' ソケットオブジェクト、'address' は
     接続先の端点でソケットに束縛されているアドレスを示します。

     'sock' はノンブロッキングソケットでなければなりません。

     バージョン 3.7 で変更: このメソッドは常にコルーチンメソッドとしてド
     キュメントに記載されてきましたが、 Python 3.7 以前のリリースでは
     *note Future: dc6. オブジェクトを返していました。 Python 3.7 からは
     ‘async def’ メソッドになりました。

     参考
     ....

     *note loop.create_server(): d09. および *note start_server(): d0f.。

 -- メソッド: async loop.sock_sendfile (sock, file, offset=0,
          count=None, *, fallback=True)

     ファイルを送信します。利用可能なら高性能な *note os.sendfile: d05.
     を使います。送信したデータの総バイト数を返します。

     *note socket.sendfile(): 105d. メソッドの非同期版です。

     'sock' は *note socket.SOCK_STREAM: 150b. タイプのノンブロッキング
     な *note socket: fa1. でなければなりません。

     'file' はバイナリモードでオープンされた通常のファイルオブジェクトで
     なければなりません。

     'offset' はファイルの読み込み開始位置を指定します。 'count' が指定
     された場合、ファイルの EOF までファイルを送信する代わりに、 'count'
     で指定された総バイト数の分だけ送信します。ファイルオブジェクトが指
     し示す位置は、メソッドがエラーを送出した場合でも更新されます。この
     場合実際に送信されたバイト数は *note file.tell(): 15c6. メソッドで
     取得することができます。

     'fallback' が ‘True’ に設定された場合、 プラットフォームが sendfile
     システムコールをサポートしていない場合 (たとえば Windows や Unix の
     SSL ソケットなど) に asyncio が別の方法でファイルの読み込みと送信を
     行うようにすることができます。

     システムが 'sendfile' システムコールをサポートしておらず、かつ
     'fallback' が ‘False’ の場合、 *note SendfileNotAvailableError:
     3872. 例外を送出します。

     'sock' はノンブロッキングソケットでなければなりません。

     Added in version 3.7.


File: python.info,  Node: DNS,  Next: パイプとやりとりする,  Prev: ソケットオブジェクトと直接やりとりする,  Up: イベントループのメソッド

5.19.1.64 DNS
.............

 -- メソッド: async loop.getaddrinfo (host, port, *, family=0, type=0,
          proto=0, flags=0)

     *note socket.getaddrinfo(): 1ac3. の非同期版です。

 -- メソッド: async loop.getnameinfo (sockaddr, flags=0)

     *note socket.getnameinfo(): 1a3a. の非同期版です。

     注釈: Both 'getaddrinfo' and 'getnameinfo' internally utilize their
     synchronous versions through the loop's default thread pool
     executor.  When this executor is saturated, these methods may
     experience delays, which higher-level networking libraries may
     report as increased timeouts.  To mitigate this, consider using a
     custom executor for other user tasks, or setting a default executor
     with a larger number of workers.

バージョン 3.7 で変更: 'getaddrinfo' と 'getnameinfo' の2つのメソッドは
、いずれも常にコルーチンメソッドとしてドキュメントに記載されてきましたが
、 Python 3.7 以前のリリースでは、実際には *note asyncio.Future: dc6. オ
ブジェクトを返していました。 Python 3.7 からはどちらのメソッドもコルーチ
ンになりました。


File: python.info,  Node: パイプとやりとりする,  Next: Unix シグナル,  Prev: DNS,  Up: イベントループのメソッド

5.19.1.65 パイプとやりとりする
..............................

 -- メソッド: async loop.connect_read_pipe (protocol_factory, pipe)

     イベントループの読み込み側終端に 'pipe' を登録します。

     'protocol_factory' は *note asyncio プロトコル: 3892. の実装を返す
     呼び出し可能オブジェクトでなければなりません。

     'pipe' には *note file-like オブジェクト: 13db. を指定します。

     ‘(transport, protocol)’ のペアを返します。ここで 'transport' は
     *note ReadTransport: 38a6. のインターフェースをサポートし、
     'protocol' は 'protocol_factory' ファクトリでインスタンス化されたオ
     ブジェクトです。

     *note SelectorEventLoop: 314. イベントループの場合、'pipe' は非ブロ
     ックモードに設定されていなければなりません。

 -- メソッド: async loop.connect_write_pipe (protocol_factory, pipe)

     'pipe' の書き込み側終端をイベントループに登録します。

     'protocol_factory' は *note asyncio プロトコル: 3892. の実装を返す
     呼び出し可能オブジェクトでなければなりません。

     'pipe' は *note file-like オブジェクト: 13db. です。

     ‘(transport, protocol)’ のペアを返します。ここで 'transport' は
     *note WriteTransport: 38a7. のインスタンスであり、 'protocol' は
     'protocol_factory' ファクトリでインスタンス化されたオブジェクトです
     。

     *note SelectorEventLoop: 314. イベントループの場合、'pipe' は非ブロ
     ックモードに設定されていなければなりません。

     注釈: *note SelectorEventLoop: 314. は Windows 上で上記のメソッドを
     サポートしていません。 Windowsでは代わりに *note ProactorEventLoop:
     81d. を使ってください。

参考
....

*note loop.subprocess_exec(): 3843. および *note
loop.subprocess_shell(): 3844. メソッド。


File: python.info,  Node: Unix シグナル,  Next: スレッドまたはプロセスプールでコードを実行する,  Prev: パイプとやりとりする,  Up: イベントループのメソッド

5.19.1.66 Unix シグナル
.......................

 -- メソッド: loop.add_signal_handler (signum, callback, *args)

     Set 'callback' as the handler for the 'signum' signal, passing
     'args' as positional arguments.

     コールバックは 'loop'、登録された他のコールバック、およびイベントル
     ープの実行可能なコルーチンから呼び出されます。 *note
     signal.signal(): 134c. を使って登録されたシグナルハンドラと異なり、
     この関数で登録されたコールバックはイベントループと相互作用すること
     が可能です。

     シグナルナンバーが誤っているか捕捉不可能な場合 *note ValueError:
     2ec. が送出されます。ハンドラーの設定に問題があった場合 *note
     RuntimeError: 244. が送出されます。

     コールバック 'callback' に *note キーワード引数を渡す: 388c. 場合は
     *note functools.partial(): 217. を使ってください。

     *note signal.signal(): 134c. と同じく、この関数はメインスレッドから
     呼び出されなければなりません。

 -- メソッド: loop.remove_signal_handler (sig)

     シグナル 'sig' に対するハンドラを削除します。

     シグナルハンドラが削除された場合 ‘True’ を返します。シグナルに対し
     てハンドラが設定されていない場合には ‘False’ を返します。

     *note Availability: 213f.: Unix.

参考
....

*note signal: cb. モジュール。


File: python.info,  Node: スレッドまたはプロセスプールでコードを実行する,  Next: エラーハンドリング API,  Prev: Unix シグナル,  Up: イベントループのメソッド

5.19.1.67 スレッドまたはプロセスプールでコードを実行する
........................................................

 -- メソッド: awaitable loop.run_in_executor (executor, func, *args)

     Arrange for 'func' to be called in the specified executor passing
     'args' as positional arguments.

     The 'executor' argument should be an *note
     concurrent.futures.Executor: 36e2. instance.  The default executor
     is used if 'executor' is ‘None’.  The default executor can be set
     by *note loop.set_default_executor(): 94a, otherwise, a *note
     concurrent.futures.ThreadPoolExecutor: 949. will be
     lazy-initialized and used by *note run_in_executor(): ae6. if
     needed.

     以下はプログラム例です:

          import asyncio
          import concurrent.futures

          def blocking_io():
              # File operations (such as logging) can block the
              # event loop: run them in a thread pool.
              with open('/dev/urandom', 'rb') as f:
                  return f.read(100)

          def cpu_bound():
              # CPU-bound operations will block the event loop:
              # in general it is preferable to run them in a
              # process pool.
              return sum(i * i for i in range(10 ** 7))

          async def main():
              loop = asyncio.get_running_loop()

              ## Options:

              # 1. Run in the default loop's executor:
              result = await loop.run_in_executor(
                  None, blocking_io)
              print('default thread pool', result)

              # 2. Run in a custom thread pool:
              with concurrent.futures.ThreadPoolExecutor() as pool:
                  result = await loop.run_in_executor(
                      pool, blocking_io)
                  print('custom thread pool', result)

              # 3. Run in a custom process pool:
              with concurrent.futures.ProcessPoolExecutor() as pool:
                  result = await loop.run_in_executor(
                      pool, cpu_bound)
                  print('custom process pool', result)

              # 4. Run in a custom interpreter pool:
              with concurrent.futures.InterpreterPoolExecutor() as pool:
                  result = await loop.run_in_executor(
                      pool, cpu_bound)
                  print('custom interpreter pool', result)

          if __name__ == '__main__':
              asyncio.run(main())

     Note that the entry point guard (‘if __name__ == '__main__'’) is
     required for option 3 due to the peculiarities of *note
     multiprocessing: 98, which is used by *note ProcessPoolExecutor:
     1d6.  See *note Safe importing of main module: 36cb.

     このメソッドは *note asyncio.Future: dc6. オブジェクトを返します。

     関数 'func' に *note キーワード引数を渡す: 388c. 場合は *note
     functools.partial(): 217. を使ってください。

     バージョン 3.5.3 で変更: *note loop.run_in_executor(): ae6. は内部
     で生成するスレッドプールエグゼキュータの ‘max_workers’ を設定せず、
     代わりにスレッドプールエグゼキュータ (*note ThreadPoolExecutor:
     949.) にデフォルト値を設定させるようになりました。

 -- メソッド: loop.set_default_executor (executor)

     Set 'executor' as the default executor used by *note
     run_in_executor(): ae6.  'executor' must be an instance of *note
     ThreadPoolExecutor: 949, which includes *note
     InterpreterPoolExecutor: 1d2.

     バージョン 3.11 で変更: 'executor' must be an instance of *note
     ThreadPoolExecutor: 949.


File: python.info,  Node: エラーハンドリング API,  Next: デバッグモードの有効化,  Prev: スレッドまたはプロセスプールでコードを実行する,  Up: イベントループのメソッド

5.19.1.68 エラーハンドリング API
................................

イベントループ内での例外の扱い方をカスタマイズできます。

 -- メソッド: loop.set_exception_handler (handler)

     'handler' を新しいイベントループ例外ハンドラーとして設定します。

     'handler' が ‘None’ の場合、デフォルトの例外ハンドラが設定されます
     。そうでなければ、 'handler' は ‘(loop, context)’ に一致する関数シ
     グネチャを持った呼び出し可能オブジェクトでなければなりません。ここ
     で ‘loop’ はアクティブなイベントループへの参照であり、 ‘context’ は
     例外の詳細な記述からなる ‘dict’ オブジェクトです ('context' につい
     ての詳細は *note call_exception_handler(): 38ae. メソッドのドキュメ
     ントを参照してください)。

     If the handler is called on behalf of a *note Task: 1c7. or *note
     Handle: 1e84, it is run in the *note contextvars.Context: 177. of
     that task or callback handle.

     バージョン 3.12 で変更: The handler may be called in the *note
     Context: 177. of the task or handle where the exception originated.

 -- メソッド: loop.get_exception_handler ()

     現在の例外ハンドラを返します。カスタム例外ハンドラが設定されていな
     い場合は ‘None’ を返します。

     Added in version 3.5.2.

 -- メソッド: loop.default_exception_handler (context)

     デフォルトの例外ハンドラーです。

     デフォルト例外ハンドラは、例外ハンドラが未設定の場合、例外が発生し
     た時に呼び出されます。デフォルト例外ハンドラの挙動を受け入れるため
     に、カスタム例外ハンドラから呼び出すことも可能です。

     引数 'context' の意味は *note call_exception_handler(): 38ae. と同
     じです。

 -- メソッド: loop.call_exception_handler (context)

     現在のイベントループ例外ハンドラーを呼び出します。

     'context' は以下のキーを含む ‘dict’ オブジェクトです (将来の Python
     バージョンで新しいキーが追加される可能性があります):

        * 'message': エラーメッセージ;

        * 'exception' (任意): 例外オブジェクト;

        * 'future' (任意): *note asyncio.Future: dc6. インスタンス;

        * 'task' (optional): *note asyncio.Task: 1c7. instance;

        * 'handle' (任意): *note asyncio.Handle: 1e84. インスタンス;

        * 'protocol' (任意): *note プロトコル: 3892. インスタンス;

        * 'transport' (任意): *note トランスポート: 3893. インスタンス;

        * 'socket' (optional): *note socket.socket: fa1. instance;

        * 'source_traceback' (optional): Traceback of the source;

        * 'handle_traceback' (optional): Traceback of the handle;

        * 
          'asyncgen' (optional): Asynchronous generator that caused

               the exception.

          注釈: This method should not be overloaded in subclassed event
          loops.  For custom exception handling, use the *note
          set_exception_handler(): 38ad. method.


File: python.info,  Node: デバッグモードの有効化,  Next: サブプロセスの実行,  Prev: エラーハンドリング API,  Up: イベントループのメソッド

5.19.1.69 デバッグモードの有効化
................................

 -- メソッド: loop.get_debug ()

     イベントループのデバッグモード (*note bool: 3c3.) を取得します。

     環境変数 *note PYTHONASYNCIODEBUG: 2139. に空でない文字列が設定され
     ている場合のデフォルト値は ‘True’、そうでない場合は ‘False’ になり
     ます。

 -- メソッド: loop.set_debug (enabled: bool)

     イベントループのデバッグモードを設定します。

     バージョン 3.7 で変更: 新しい *note Python 開発モード: 508. を使っ
     てデバッグモードを有効化することができるようになりました。

 -- の属性: loop.slow_callback_duration

     This attribute can be used to set the minimum execution duration in
     seconds that is considered "slow".  When debug mode is enabled,
     "slow" callbacks are logged.

     Default value is 100 milliseconds.

参考
....

*note asyncio のデバッグモード: 213a.。


File: python.info,  Node: サブプロセスの実行,  Prev: デバッグモードの有効化,  Up: イベントループのメソッド

5.19.1.70 サブプロセスの実行
............................

この節で解説しているのは低水準のメソッドです。通常の async/await コード
では、高水準の関数である *note asyncio.create_subprocess_shell(): c6c. や
*note asyncio.create_subprocess_exec(): c6b. を代わりに使うことを検討し
てください。

     注釈: On Windows, the default event loop *note ProactorEventLoop:
     81d. supports subprocesses, whereas *note SelectorEventLoop: 314.
     does not.  See *note Subprocess Support on Windows: 3845. for
     details.

 -- メソッド: async loop.subprocess_exec (protocol_factory, *args,
          stdin=subprocess.PIPE, stdout=subprocess.PIPE,
          stderr=subprocess.PIPE, **kwargs)

     'args' で指定されたひとつの、または複数の文字列引数からサブプロセス
     を生成します。

     'args' は下記のいずれかに当てはまる文字列のリストでなければなりませ
     ん:

        * *note str: 169.;

        * または *note ファイルシステムのエンコーディング: 2c35. にエン
          コードされた *note bytes: 192.

     引数の最初の文字列はプログラムの実行ファイルを指定します。それに続
     く残りの文字列は引数を指定し、そのプログラムに対する ‘argv’ を構成
     します。

     このメソッドは標準ライブラリの *note subprocess.Popen: 4b7. クラス
     を、 ‘shell=False’ かつ最初の引数に文字列のリストを渡して呼び出した
     場合に似ています。しかし、 *note Popen: 4b7. クラスは文字列のリスト
     を引数としてひとつだけ取るのに対して、 'subprocess_exec' は複数の文
     字列引数をとることができます。

     'protocol_factory' は *note asyncio.SubprocessProtocol: 38b3. クラ
     スの派生クラスを返す呼び出し可能オブジェクトでなければなりません。

     その他の引数:

        * 'stdin' は下記のいずれかをとることができます:

             * a file-like object

             * an existing file descriptor (a positive integer), for
               example those created with *note os.pipe(): 1b64.

             * デフォルト値は *note subprocess.PIPE: d80. 定数で、この場
               合新規にパイプを生成して接続します。

             * ‘None’ が設定された場合、サブプロセスは元のプロセスのファ
               イルデスクリプタを引き継ぎます。

             * *note subprocess.DEVNULL: 1366. 定数を設定すると、特別な
               ファイル *note os.devnull: 1e14. を使います。

        * 'stdout' は下記のいずれかをとることができます:

             * a file-like object

             * デフォルト値は *note subprocess.PIPE: d80. 定数で、この場
               合新規にパイプを生成して接続します。

             * ‘None’ が設定された場合、サブプロセスは元のプロセスのファ
               イルデスクリプタを引き継ぎます。

             * *note subprocess.DEVNULL: 1366. 定数を設定すると、特別な
               ファイル *note os.devnull: 1e14. を使います。

        * 'stderr' は下記のいずれかをとることができます:

             * a file-like object

             * デフォルト値は *note subprocess.PIPE: d80. 定数で、この場
               合新規にパイプを生成して接続します。

             * ‘None’ が設定された場合、サブプロセスは元のプロセスのファ
               イルデスクリプタを引き継ぎます。

             * *note subprocess.DEVNULL: 1366. 定数を設定すると、特別な
               ファイル *note os.devnull: 1e14. を使います。

             * *note subprocess.STDOUT: 372d. 定数を設定すると、標準エラ
               ー出力ストリームをプロセスの標準出力ストリームに接続しま
               す。

        * その他のすべてのキーワード引数は解釈されずにそのまま *note
          subprocess.Popen: 4b7. に渡されます。ただし、 'bufsize'、
          'universal_newlines'、 'shell'、 'text'、 'encoding' および
          'errors' は指定してはいけません。

          ‘asyncio’ のサブプロセス API はストリームからテキストへのデコ
          ードをサポートしていません。ストリームからテキストに変換するに
          は *note bytes.decode(): ad3. 関数を使ってください。

     If a file-like object passed as 'stdin', 'stdout' or 'stderr'
     represents a pipe, then the other side of this pipe should be
     registered with *note connect_write_pipe(): 3847. or *note
     connect_read_pipe(): 3846. for use with the event loop.

     他の引数についての詳細は *note subprocess.Popen: 4b7. クラスのコン
     ストラクタを参照してください。

     ‘(transport, protocol)’ のペアを返します。ここで 'transport' は
     *note asyncio.SubprocessTransport: 38b4. 基底クラスに適合するオブジ
     ェクトで、 'protocol' は 'protocol_factory' によりインスタンス化さ
     れたオブジェクトです。

     If the transport is closed or is garbage collected, the child
     process is killed if it is still running.

 -- メソッド: async loop.subprocess_shell (protocol_factory, cmd, *,
          stdin=subprocess.PIPE, stdout=subprocess.PIPE,
          stderr=subprocess.PIPE, **kwargs)

     コマンド 'cmd' からプラットフォームの "シェル" シンタックスを使って
     サブプロセスを生成します。 'cmd' は *note str: 169. 文字列もしくは
     *note ファイルシステムのエンコーディング: 2c35. でエンコードされた
     *note bytes: 192. 文字列です。

     これは標準ライブラリの *note subprocess.Popen: 4b7. クラスを
     ‘shell=True’ で呼び出した場合と似ています。

     'protocol_factory' は *note SubprocessProtocol: 38b3. の派生クラス
     を返す呼び出し可能オブジェクトでなければなりません。

     その他の引数についての詳細は *note subprocess_exec(): 3843. メソッ
     ドを参照してください。

     ‘(transport, protocol)’ のペアを返します。ここで 'transport' は
     *note SubprocessTransport: 38b4. 基底クラスに適合するオブジェクトで
     、 'protocol' は 'protocol_factory' によりインスタンス化されたオブ
     ジェクトです。

     If the transport is closed or is garbage collected, the child
     process is killed if it is still running.

     注釈: シェルインジェクション(1) の脆弱性を回避するために全ての空白
     文字および特殊文字を適切にクオートすることは、アプリケーション側の
     責任で確実に行ってください。シェルコマンドを構成する文字列内の空白
     文字と特殊文字のエスケープは、 *note shlex.quote(): 582. 関数を使う
     と適切に行うことができます。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Shell_injection#Shell_injection


File: python.info,  Node: コールバックのハンドル,  Next: Serverオブジェクト,  Prev: イベントループのメソッド,  Up: イベントループ

5.19.1.71 コールバックのハンドル
................................

 -- クラス: asyncio.Handle

     *note loop.call_soon(): cfa. や *note loop.call_soon_threadsafe():
     cfb. が返すコールバックのラッパーです。

      -- メソッド: get_context ()

          Return the *note contextvars.Context: 177. object associated
          with the handle.

          Added in version 3.12.

      -- メソッド: cancel ()

          コールバックをキャンセルします。コールバックがキャンセル済みま
          たは実行済みの場合、このメソッドは何の影響もありません。

      -- メソッド: cancelled ()

          コールバックがキャンセルされた場合 ‘True’ を返します。

          Added in version 3.7.

 -- クラス: asyncio.TimerHandle

     A callback wrapper object returned by *note loop.call_later(): cfc,
     and *note loop.call_at(): cfd.

     このクラスは *note Handle: 1e84. の派生クラスです。

      -- メソッド: when ()

          コールバックのスケジュール時刻を秒単位の *note float: 196. で
          返します。

          戻り値の時刻は絶対値で、 *note loop.time(): 388f. と同じ参照時
          刻を使って定義されています。

          Added in version 3.7.


File: python.info,  Node: Serverオブジェクト,  Next: イベントループの実装,  Prev: コールバックのハンドル,  Up: イベントループ

5.19.1.72 Serverオブジェクト
............................

Server オブジェクトは *note loop.create_server(): d09.、 *note
loop.create_unix_server(): 4ca.、 *note start_server(): d0f. および
*note start_unix_server(): 3800. 関数により生成されます。

Do not instantiate the *note Server: d08. class directly.

 -- クラス: asyncio.Server

     'Server' オブジェクトは非同期のコンテキストマネージャです。 ‘async
     with’ 文の中で使われた場合、 ‘async with’ 文が完了した時に Server オ
     ブジェクトがクローズされること、およびそれ以降に接続を受け付けない
     ことが保証されます。

          srv = await loop.create_server(...)

          async with srv:
              # some code

          # At this point, srv is closed and no longer accepts new connections.

     バージョン 3.7 で変更: Python 3.7 から、 Server オブジェクトは非同
     期のコンテキストマネージャになりました。

     バージョン 3.11 で変更: This class was exposed publicly as
     ‘asyncio.Server’ in Python 3.9.11, 3.10.3 and 3.11.

      -- メソッド: close ()

          サーバーを停止します: 待機しているソケットをクローズし *note
          sockets: e10. 属性に ‘None’ を設定します。

          既存の受信中のクライアントとの接続を表すソケットはオープンのま
          まです。

          The server is closed asynchronously; use the *note
          wait_closed(): 1a3f. coroutine to wait until the server is
          closed (and no more connections are active).

      -- メソッド: close_clients ()

          Close all existing incoming client connections.

          Calls *note close(): 3896. on all associated transports.

          *note close(): 37fd. should be called before *note
          close_clients(): 4ce. when closing the server to avoid races
          with new clients connecting.

          Added in version 3.13.

      -- メソッド: abort_clients ()

          Close all existing incoming client connections immediately,
          without waiting for pending operations to complete.

          Calls *note abort(): 38b7. on all associated transports.

          *note close(): 37fd. should be called before *note
          abort_clients(): 4cf. when closing the server to avoid races
          with new clients connecting.

          Added in version 3.13.

      -- メソッド: get_loop ()

          サーバオブジェクトに付随するイベントループを返します。

          Added in version 3.7.

      -- メソッド: async start_serving ()

          接続の受け付けを開始します。

          This method is idempotent, so it can be called when the server
          is already serving.

          キーワード専用のパラメータ 'start_serving' を *note
          loop.create_server(): d09. や *note asyncio.start_server():
          d0f. メソッドに対して使用することにより、初期に接続を受け付け
          ない Server オブジェクトを生成することができます。この場合
          ‘Server.start_serving()’ または *note Server.serve_forever():
          d0b. メソッドを使ってオブジェクトが接続の受け付けを開始するよ
          うにすることができます。

          Added in version 3.7.

      -- メソッド: async serve_forever ()

          接続の受け入れを開始し、コルーチンがキャンセルされるまで継続し
          ます。 ‘serve_forever’ タスクのキャンセルによりサーバーもクロ
          ーズされます。

          このメソッドはサーバーがすでに接続の受け入れを開始していても呼
          び出し可能です。ひとつの 'Server' オブジェクトにつき
          ‘serve_forever’ タスクはひとつだけ存在できます。

          以下はプログラム例です:

               async def client_connected(reader, writer):
                   # Communicate with the client with
                   # reader/writer streams.  For example:
                   await reader.readline()

               async def main(host, port):
                   srv = await asyncio.start_server(
                       client_connected, host, port)
                   await srv.serve_forever()

               asyncio.run(main('127.0.0.1', 0))

          Added in version 3.7.

      -- メソッド: is_serving ()

          サーバーが新規に接続の受け入れを開始した場合 ‘True’ を返します
          。

          Added in version 3.7.

      -- メソッド: async wait_closed ()

          Wait until the *note close(): 37fd. method completes and all
          active connections have finished.

      -- の属性: sockets

          List of socket-like objects, ‘asyncio.trsock.TransportSocket’,
          which the server is listening on.

          バージョン 3.7 で変更: Python 3.7 より前のバージョンでは、
          ‘Server.sockets’ は内部に持っているサーバーソケットのリストを
          直接返していました。 Python 3.7 ではリストのコピーが返されるよ
          うになりました。


File: python.info,  Node: イベントループの実装,  Next: 使用例<25>,  Prev: Serverオブジェクト,  Up: イベントループ

5.19.1.73 イベントループの実装
..............................

asyncio は2つの異なるイベントループの実装、 *note SelectorEventLoop:
314. と *note ProactorEventLoop: 81d.、 を提供します:

By default asyncio is configured to use *note EventLoop: 1a67.

 -- クラス: asyncio.SelectorEventLoop

     A subclass of *note AbstractEventLoop: b58. based on the *note
     selectors: c7. module.

     プラットフォーム上で利用可能な最も効率の良い 'selector' を使います
     。特定のセレクタ実装を使うように手動で構成することも可能です:

          import asyncio
          import selectors

          async def main():
             ...

          loop_factory = lambda: asyncio.SelectorEventLoop(selectors.SelectSelector())
          asyncio.run(main(), loop_factory=loop_factory)

     *note Availability: 213f.: Unix, Windows.

 -- クラス: asyncio.ProactorEventLoop

     A subclass of *note AbstractEventLoop: b58. for Windows that uses
     "I/O Completion Ports" (IOCP).

     *note Availability: 213f.: Windows.

     参考
     ....

     MSDN documentation on I/O Completion Ports(1).

 -- クラス: asyncio.EventLoop

          An alias to the most efficient available subclass of *note
          AbstractEventLoop: b58. for the given platform.

          It is an alias to *note SelectorEventLoop: 314. on Unix and
          *note ProactorEventLoop: 81d. on Windows.

     Added in version 3.13.

 -- クラス: asyncio.AbstractEventLoop

     asyncio に適合するイベントループの抽象基底クラスです。

     The *note イベントループのメソッド: 3886. section lists all methods
     that an alternative implementation of ‘AbstractEventLoop’ should
     have defined.

   ---------- Footnotes ----------

   (1) 
https://learn.microsoft.com/windows/win32/fileio/i-o-completion-ports


File: python.info,  Node: 使用例<25>,  Prev: イベントループの実装,  Up: イベントループ

5.19.1.74 使用例
................

この節の全ての使用例は '意図的に' *note loop.run_forever(): 3888. や
*note loop.call_soon(): cfa. のような 低水準のイベントループ API の使用
法を示しています。一方で現代的な asyncio アプリケーションはここに示すよ
うな方法をほとんど必要としません。 *note asyncio.run(): 2f3. のような高
水準の関数の使用を検討してください。

* Menu:

* call_soon() を使った Hello World: call_soon を使った Hello World.
* call_later() で現在の日時を表示する: call_later で現在の日時を表示する.
* 読み込みイベント用ファイル記述子の監視::
* SIGINT および SIGTERM 用のシグナルハンドラーの設定::


File: python.info,  Node: call_soon を使った Hello World,  Next: call_later で現在の日時を表示する,  Up: 使用例<25>

5.19.1.75 call_soon() を使った Hello World
..........................................

*note loop.call_soon(): cfa. メソッドを使ってコールバックをスケジュール
する例です。コールバックは ‘"Hello World"’ を出力しイベントループを停止
します:

     import asyncio

     def hello_world(loop):
         """A callback to print 'Hello World' and stop the event loop"""
         print('Hello World')
         loop.stop()

     loop = asyncio.new_event_loop()

     # Schedule a call to hello_world()
     loop.call_soon(hello_world, loop)

     # Blocking call interrupted by loop.stop()
     try:
         loop.run_forever()
     finally:
         loop.close()

参考
....

コルーチンと *note run(): 2f3. 関数を使用した同じような *note Hello
World: 37b8. の例。


File: python.info,  Node: call_later で現在の日時を表示する,  Next: 読み込みイベント用ファイル記述子の監視,  Prev: call_soon を使った Hello World,  Up: 使用例<25>

5.19.1.76 call_later() で現在の日時を表示する
.............................................

毎秒現在時刻を表示するコールバックの例です。コールバックは *note
loop.call_later(): cfc. メソッドを使って自身を5秒後に実行するよう再スケ
ジュールし、イベントループを停止します:

     import asyncio
     import datetime

     def display_date(end_time, loop):
         print(datetime.datetime.now())
         if (loop.time() + 1.0) < end_time:
             loop.call_later(1, display_date, end_time, loop)
         else:
             loop.stop()

     loop = asyncio.new_event_loop()

     # Schedule the first call to display_date()
     end_time = loop.time() + 5.0
     loop.call_soon(display_date, end_time, loop)

     # Blocking call interrupted by loop.stop()
     try:
         loop.run_forever()
     finally:
         loop.close()

参考
....

コルーチンと *note run(): 2f3. 関数を使用した同じような *note
現在時刻出力: 37d7. の例。


File: python.info,  Node: 読み込みイベント用ファイル記述子の監視,  Next: SIGINT および SIGTERM 用のシグナルハンドラーの設定,  Prev: call_later で現在の日時を表示する,  Up: 使用例<25>

5.19.1.77 読み込みイベント用ファイル記述子の監視
................................................

ファイル記述子が *note loop.add_reader(): 381a. メソッドを使って何らかの
データを受信するまで待機し、その後イベントループをクローズします:

     import asyncio
     from socket import socketpair

     # Create a pair of connected file descriptors
     rsock, wsock = socketpair()

     loop = asyncio.new_event_loop()

     def reader():
         data = rsock.recv(100)
         print("Received:", data.decode())

         # We are done: unregister the file descriptor
         loop.remove_reader(rsock)

         # Stop the event loop
         loop.stop()

     # Register the file descriptor for read event
     loop.add_reader(rsock, reader)

     # Simulate the reception of data from the network
     loop.call_soon(wsock.send, 'abc'.encode())

     try:
         # Run the event loop
         loop.run_forever()
     finally:
         # We are done. Close sockets and the event loop.
         rsock.close()
         wsock.close()
         loop.close()

参考
....

   * トランスポート、プロトコル、および *note loop.create_connection():
     818. メソッドを使用した同じような *note 例: 3818.。

   * 高水準の *note asyncio.open_connection(): d0e. 関数とストリームを使
     用したもうひとつの *note 実装例: 3816.。


File: python.info,  Node: SIGINT および SIGTERM 用のシグナルハンドラーの設定,  Prev: 読み込みイベント用ファイル記述子の監視,  Up: 使用例<25>

5.19.1.78 SIGINT および SIGTERM 用のシグナルハンドラーの設定
............................................................

(ここに挙げる ‘signals’ の例は Unix でのみ動きます。)

Register handlers for signals *note SIGINT: 253. and *note SIGTERM:
15f8. using the *note loop.add_signal_handler(): 38a9. method:

     import asyncio
     import functools
     import os
     import signal

     def ask_exit(signame, loop):
         print("got signal %s: exit" % signame)
         loop.stop()

     async def main():
         loop = asyncio.get_running_loop()

         for signame in {'SIGINT', 'SIGTERM'}:
             loop.add_signal_handler(
                 getattr(signal, signame),
                 functools.partial(ask_exit, signame, loop))

         await asyncio.sleep(3600)

     print("Event loop running for 1 hour, press Ctrl+C to interrupt.")
     print(f"pid {os.getpid()}: send SIGINT or SIGTERM to exit.")

     asyncio.run(main())


File: python.info,  Node: Future,  Next: トランスポートとプロトコル,  Prev: イベントループ,  Up: asyncio --- 非同期 I/O

5.19.1.79 Future
................

'ソースコード:' Lib/asyncio/futures.py(1),
Lib/asyncio/base_futures.py(2)

__________________________________________________________________

'Future' オブジェクトは '低水準のコールバックベースのコード' と高水準の
async/await コードとの間を橋渡しします。

* Menu:

* Future の関数::
* Future オブジェクト: Future オブジェクト<2>.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/futures.py

   (2) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/base_futures.py


File: python.info,  Node: Future の関数,  Next: Future オブジェクト<2>,  Up: Future

5.19.1.80 Future の関数
.......................

 -- の関数: asyncio.isfuture (obj)

     オブジェクト 'obj' が下記のいずれかであれば ‘True’ を返します:

        * *note asyncio.Future: dc6. クラスのインスタンス

        * *note asyncio.Task: 1c7. クラスのインスタンス

        * ‘_asyncio_future_blocking’ 属性を持った Future 的なオブジェク
          ト

     Added in version 3.5.

 -- の関数: asyncio.ensure_future (obj, *, loop=None)

     下記のいずれかを返します:

        * 'obj' が *note Future: dc6. オブジェクト、 *note Task: 1c7. オ
          ブジェクト、または Future 的なオブジェクト (*note isfuture():
          38c4. 関数を使って検査します) である場合には 'obj' そのもの

        * 引数 'obj' がコルーチンである (*note iscoroutine(): 6a6. 関数
          を使って検査します) 場合には 'obj' をラップした *note Task:
          1c7. オブジェクト; この場合コルーチンは ‘ensure_future()’ によ
          りスケジュールされます。

        * 引数 'obj' が awaitable である (*note inspect.isawaitable():
          1018. 関数を使って検査します) 場合には 'obj' を await する
          *note Task: 1c7. オブジェクト

     引数 'obj' が上記のいずれにもあてはまらない場合は *note TypeError:
     198. 例外を送出します。

          重要: Save a reference to the result of this function, to
          avoid a task disappearing mid-execution.

          See also the *note create_task(): 1c9. function which is the
          preferred way for creating new tasks or use *note
          asyncio.TaskGroup: 4d1. which keeps reference to the task
          internally.

     バージョン 3.5.1 で変更: この関数はどんな *note awaitable: 4c9. な
     オブジェクトでも受け入れるようになりました。

     バージョン 3.10 で非推奨: Deprecation warning is emitted if 'obj'
     is not a Future-like object and 'loop' is not specified and there
     is no running event loop.

 -- の関数: asyncio.wrap_future (future, *, loop=None)

     *note concurrent.futures.Future: 13ca. オブジェクトを *note
     asyncio.Future: dc6. オブジェクトでラップします。

     バージョン 3.10 で非推奨: Deprecation warning is emitted if
     'future' is not a Future-like object and 'loop' is not specified
     and there is no running event loop.


File: python.info,  Node: Future オブジェクト<2>,  Prev: Future の関数,  Up: Future

5.19.1.81 Future オブジェクト
.............................

 -- クラス: asyncio.Future (*, loop=None)

     Future は非同期処理の最終結果を表すクラスです。スレッドセーフではあ
     りません。

     Future is an *note awaitable: 4c9. object.  Coroutines can await on
     Future objects until they either have a result or an exception set,
     or until they are cancelled.  A Future can be awaited multiple
     times and the result is same.

     典型的には、 Future は低水準のコールバックベースのコード (たとえば
     asyncio の *note transports: 37c0. を使って実装されたプロトコル) が
     高水準の async/await と相互運用することを可能にするために利用されま
     す。

     経験則は Future オブジェクトをユーザー向けの API であらわに利用しな
     いことです。推奨される Future オブジェクトの生成方法は *note
     loop.create_future(): e74. を呼び出すことです。これによりイベントル
     ープの代替実装は、自身に最適化された Future オブジェクトの実装を合
     わせて提供することができます。

     バージョン 3.7 で変更: *note contextvars: 28. モジュールのサポート
     を追加。

     バージョン 3.10 で非推奨: Deprecation warning is emitted if 'loop'
     is not specified and there is no running event loop.

      -- メソッド: result ()

          Future の結果を返します。

          Future が '完了' していて、 *note set_result(): 37ed. メソッド
          により設定された結果を持っている場合は結果の値を返します。

          Future が '完了' していて、 *note set_exception(): e78. メソッ
          ドにより設定された例外を持っている場合はその例外を送出します。

          Future が 'キャンセルされた' 場合、このメソッドは *note
          CancelledError: 4d4. 例外を送出します。

          If the Future's result isn't yet available, this method raises
          an *note InvalidStateError: 37f0. exception.

      -- メソッド: set_result (result)

          Future を '完了' とマークし、結果を設定します。

          Raises an *note InvalidStateError: 37f0. error if the Future
          is already 'done'.

      -- メソッド: set_exception (exception)

          Future を '完了' とマークし、例外を設定します。

          Raises an *note InvalidStateError: 37f0. error if the Future
          is already 'done'.

      -- メソッド: done ()

          Future が '完了' しているなら ‘True’ を返します。

          Future は 'キャンセルされた' か、または *note set_result():
          37ed. メソッドや *note set_exception(): e78. メソッドの呼び出
          しにより結果や例外が設定された場合に '完了' とみなされます。

      -- メソッド: cancelled ()

          Future が 'キャンセルされた' 場合に ‘True’ を返します。

          通常の場合、このメソッドは Future に処理結果や例外を設定する前
          に Future が 'キャンセルされていない' ことを確認するために使用
          されます:

               if not fut.cancelled():
                   fut.set_result(42)

      -- メソッド: add_done_callback (callback, *, context=None)

          Future が '完了' したときに実行されるコールバックを追加します
          。

          'callback' は Future オブジェクトだけを引数にとって呼び出され
          ます。

          このメソッドが呼び出される時点ですでに Future が '完了' してい
          る場合、コールバックは *note loop.call_soon(): cfa. メソッドに
          よりスケジュールされます。

          オプションのキーワード引数 'context' を使って、コールバック
          *callback* を実行する際のコンテキスト *note
          contextvars.Context: 177. を設定することができます。コンテキス
          ト 'context' が指定されない場合は現在のコンテキストが使われま
          す。

          コールバックにパラメータを渡すには、次の例のように *note
          functools.partial(): 217. を使うことができます:

               # Call 'print("Future:", fut)' when "fut" is done.
               fut.add_done_callback(
                   functools.partial(print, "Future:"))

          バージョン 3.7 で変更: キーワード引数 'context' が追加されまし
          た。詳細は PEP 567(1) を参照してください。

      -- メソッド: remove_done_callback (callback)

          コールバックリストから 'callback' を削除します。

          削除されたコールバックの数を返します。コールバックが複数回追加
          されていない限り、通常は1が返ります。

      -- メソッド: cancel (msg=None)

          Future をキャンセルし、コールバックをスケジュールします。

          Future がすでに '完了' または 'キャンセル' された場合、
          ‘False’ を返します。そうでない場合 Future の状態を 'キャンセル
          ' に変更した上でコールバックをスケジュールし、 ‘True’ を返しま
          す。

          バージョン 3.9 で変更: Added the 'msg' parameter.

      -- メソッド: exception ()

          この Future オブジェクトに設定された例外を返します。

          例外 (または例外が設定されていないときは ‘None’) は Future が
          '完了' している場合のみ返されます。

          Future が 'キャンセルされた' 場合、このメソッドは *note
          CancelledError: 4d4. 例外を送出します。

          Future が '未完了' の場合、このメソッドは *note
          InvalidStateError: 37f0. 例外を送出します。

      -- メソッド: get_loop ()

          Future オブジェクトが束縛されているイベントループを返します。

          Added in version 3.7.

この例は Future オブジェクトを生成し、Future に結果を設定するための非同
期タスクを生成してスケジュールし、そして Future に結果が設定されるまで待
機します:

     async def set_after(fut, delay, value):
         # Sleep for *delay* seconds.
         await asyncio.sleep(delay)

         # Set *value* as a result of *fut* Future.
         fut.set_result(value)

     async def main():
         # Get the current event loop.
         loop = asyncio.get_running_loop()

         # Create a new Future object.
         fut = loop.create_future()

         # Run "set_after()" coroutine in a parallel Task.
         # We are using the low-level "loop.create_task()" API here because
         # we already have a reference to the event loop at hand.
         # Otherwise we could have just used "asyncio.create_task()".
         loop.create_task(
             set_after(fut, 1, '... world'))

         print('hello ...')

         # Wait until *fut* has a result (1 second) and print it.
         print(await fut)

     asyncio.run(main())

     重要: Future オブジェクトは *note concurrent.futures.Future: 13ca.
     を模倣してデザインされました。両者の重要な違いは以下の通りです:

        - asyncio の Futures と異なり、 *note concurrent.futures.Future:
          13ca. インスタンスは待ち受けできません。

        - *note asyncio.Future.result(): 38c7. と *note
          asyncio.Future.exception(): 38ca. は 'timeout' 引数を取りませ
          ん。

        - *note asyncio.Future.result(): 38c7. と *note
          asyncio.Future.exception(): 38ca. は Future が '未完了' の場合
          に *note InvalidStateError: 37f0. 例外を送出します。

        - *note asyncio.Future.add_done_callback(): cfe. メソッドによっ
          て登録されたコールバックは、即座に呼び出されません。代わりにコ
          ールバックは *note loop.call_soon(): cfa. によりスケジュールさ
          れます。

        - asyncio の Future は *note concurrent.futures.wait(): 1c05. お
          よび *note concurrent.futures.as_completed(): 19c7. との互換性
          がありません。

        - *note asyncio.Future.cancel(): 1ba9. accepts an optional ‘msg’
          argument, but *note concurrent.futures.Future.cancel(): 36ee.
          does not.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0567/


File: python.info,  Node: トランスポートとプロトコル,  Next: ポリシー,  Prev: Future,  Up: asyncio --- 非同期 I/O

5.19.1.82 トランスポートとプロトコル
....................................

まえがき
........

トランスポートとプロトコルは *note loop.create_connection(): 818. のよう
な '低水準の' イベントループ API から使われます。これらはコールバックに
基づくプログラミングスタイルを使うことでネットワークや IPC プロトコル
(HTTP など) の高性能な実装を可能にします。

基本的にトランスポートとプロトコルはライブラリやフレームワークからのみ使
われるべきであり、高水準の asyncio アプリケーションから使われるものでは
ありません。

このドキュメントは *note Transports: 38cf. と *note Protocols: 38d0. を
扱います。

はじめに
........

最上位の観点からは、トランスポートは 'どのように' バイトデータを送信する
かに影響を与え、いっぽうプロトコルは 'どの' バイトデータを送信するかを決
定します (また、ある程度は 'いつ' も決定します) 。

同じことを違う言い方で表現します: トランスポートはソケット (または同様の
I/O 端点) の抽象化であり、プロトコルはトランスポートから見たときのアプリ
ケーションの抽象化です。

さらにもう一つの見方として、トランスポートとプロトコルの2つのインターフ
ェースは、協調してネットワーク I/O やプロセス間 I/O の抽象インターフェー
スを定義しています。

トランスポートオブジェクトとプロトコルオブジェクトの間には常に1対1の関係
があります: プロトコルはデータを送信するためにトランスポートのメソッドを
呼び出し、トランスポートは受信したデータを渡すためにプロトコルのメソッド
を呼び出します。

ほとんどの接続に基づくイベントループメソッド (*note
loop.create_connection(): 818. など) は通常 'protocol_factory' 引数を受
け取り、 'Transport' オブジェクトで表現される確立した接続に対する
'Protocol' オブジェクトを生成するために使います。そのようなメソッドは通
常 ‘(transport, protocol)’ タプルを返します。

内容
....

このページは以下の節から構成されます:

   * *note Transports: 38cf. 節は asyncio の *note BaseTransport: 38d1,
     *note ReadTransport: 38a6, *note WriteTransport: 38a7, *note
     Transport: 38d2, *note DatagramTransport: 1b27, および *note
     SubprocessTransport: 38b4. クラスについて記述しています。

   * *note Protocols: 38d0. 節は asyncio の *note BaseProtocol: 38d3,
     *note Protocol: 38d4, *note BufferedProtocol: c94, *note
     DatagramProtocol: 8de, および *note SubprocessProtocol: 38b3. クラ
     スについて記述しています。

   * *note Examples: 38d5. 節はトランスポート、プロトコル、および低水準
     のイベントループ API の利用方法を紹介しています。

* Menu:

* トランスポート::
* プロトコル: プロトコル<2>.
* 使用例: 使用例<26>.


File: python.info,  Node: トランスポート,  Next: プロトコル<2>,  Up: トランスポートとプロトコル

5.19.1.83 トランスポート
........................

'ソースコード:' Lib/asyncio/transports.py(1)

__________________________________________________________________

トランスポートはさまざまな通信方法を抽象化するために *note asyncio: b. が
提供するクラス群です。

トランスポートオブジェクトは常に *note asyncio イベントループ: f76. によ
ってインスタンス化されます。

asyncio は TCP, UDP, SSL, およびサブプロセスパイプのトランスポートを実装
しています。利用可能なトランスポートのメソッドはトランスポートの種類に依
存します。

トランスポートクラスは *note スレッド安全ではありません: 37e8.。

* Menu:

* トランスポートのクラス階層構造::
* 基底トランスポート::
* 読み出し専用のトランスポート::
* 書き込み専用のトランスポート::
* データグラムトランスポート::
* サブプロセス化されたトランスポート::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/transports.py


File: python.info,  Node: トランスポートのクラス階層構造,  Next: 基底トランスポート,  Up: トランスポート

5.19.1.84 トランスポートのクラス階層構造
........................................

 -- クラス: asyncio.BaseTransport

     全てのトランスポートの基底クラスです。すべての asyncio トランスポー
     トが共有するメソッドを含んでいます。

 -- クラス: asyncio.WriteTransport (BaseTransport)

     書き込み専用の接続に対する基底トランスポートクラスです。

     'WriteTransport' クラスのインスタンスは *note
     loop.connect_write_pipe(): 3847. イベントループメソッドから返され、
     *note loop.subprocess_exec(): 3843. のようなサブプロセスに関連する
     メソッドから利用されます。

 -- クラス: asyncio.ReadTransport (BaseTransport)

     読み込み専用の接続に対する基底トランスポートクラスです。

     Instances of the 'ReadTransport' class are returned from the *note
     loop.connect_read_pipe(): 3846. event loop method and are also used
     by subprocess-related methods like *note loop.subprocess_exec():
     3843.

 -- クラス: asyncio.Transport (WriteTransport, ReadTransport)

     TCP 接続のような、読み出しと書き込みの双方向のトランスポートを表現
     するインターフェースです。

     ユーザーはトランスポートを直接インスタンス化することはありません; ユ
     ーザーは、ユーティリティ関数にプロトコルファクトリとその他トランス
     ポートとプロトコルを作成するために必要な情報を渡して呼び出します。

     'Transport' クラスのインスタンスは、*note loop.create_connection():
     818, *note loop.create_unix_connection(): 37ff, *note
     loop.create_server(): d09, *note loop.sendfile(): 389c. などのイベ
     ントループメソッドから返されたり、これらのメソッドから利用されたり
     します。

 -- クラス: asyncio.DatagramTransport (BaseTransport)

     データグラム (UDP) 接続のためのトランスポートです。

     'DatagramTransport' クラスのインスタンスは *note
     loop.create_datagram_endpoint(): 93c. イベントループメソッドから返
     されます。

 -- クラス: asyncio.SubprocessTransport (BaseTransport)

     親プロセスとその子プロセスの間の接続を表現する抽象クラスです。

     'SubprocessTransport' クラスのインスタンスは *note
     loop.subprocess_shell(): 3844. と *note loop.subprocess_exec():
     3843. の2つのイベントループメソッドから返されます。


File: python.info,  Node: 基底トランスポート,  Next: 読み出し専用のトランスポート,  Prev: トランスポートのクラス階層構造,  Up: トランスポート

5.19.1.85 基底トランスポート
............................

 -- メソッド: BaseTransport.close ()

     トランスポートをクローズします。

     トランスポートが発信データのバッファーを持っていた場合、バッファー
     されたデータは非同期にフラッシュされます。それ以降データは受信され
     ません。バッファーされていたデータがすべてフラッシュされた後、その
     プロトコルの *note protocol.connection_lost(): 38d8. メソッドが引数
     *note None: 885. で呼び出されます。一度閉じたトランスポートは、使用
     されるべきではありません。

 -- メソッド: BaseTransport.is_closing ()

     トランスポートを閉じている最中か閉じていた場合 ‘True’ を返します。

 -- メソッド: BaseTransport.get_extra_info (name, default=None)

     トランスポートまたはそれが背後で利用しているリソースの情報を返しま
     す。

     'name' は取得するトランスポート特有の情報を表す文字列です。

     'default' は、取得したい情報が取得可能でなかったり、サードパーティ
     のイベントループ実装や現在のプラットフォームがその情報の問い合わせ
     をサポートしていない場合に返される値です。

     例えば、以下のコードはトランスポート内のソケットオブジェクトを取得
     しようとします:

          sock = transport.get_extra_info('socket')
          if sock is not None:
              print(sock.getsockopt(...))

     いくつかのトランスポートで問い合わせ可能な情報のカテゴリを示します:

        * ソケット:

             - ‘'peername'’: ソケットが接続されているリモートアドレスで
               、*note socket.socket.getpeername(): 38d9. の結果になりま
               す (エラーのときは ‘None’)

             - ‘'socket'’: *note socket.socket: fa1. のインスタンスにな
               ります

             - ‘'sockname'’: ソケット自身のアドレスで、*note
               socket.socket.getsockname(): 284. の結果になります

        * SSL ソケット:

             - ‘'compression'’: 圧縮アルゴリズムで、*note
               ssl.SSLSocket.compression(): 135d. の結果になります。圧縮
               されていないときは ‘None’ になります

             - ‘'cipher'’: 3 個の値 (使用されている暗号アルゴリズムの名
               称、使用が定義されている SSL プロトコルのバージョン、およ
               び使用されている秘密鍵のビット数) からなるタプルで、*note
               ssl.SSLSocket.cipher(): 38da. の結果になります

             - ‘'peercert'’: ピアの証明書で、*note
               ssl.SSLSocket.getpeercert(): 11ba. の結果になります

             - ‘'sslcontext'’: *note ssl.SSLContext: 357. のインスタンス
               になります

             - ‘'ssl_object'’: *note ssl.SSLObject: d7a. または *note
               ssl.SSLSocket: ae7. インスタンス

        * パイプ:

             - ‘'pipe'’: パイプオブジェクトです

        * サブプロセス:

             - ‘'subprocess'’: *note subprocess.Popen: 4b7. のインスタン
               スになります

 -- メソッド: BaseTransport.set_protocol (protocol)

     トランスポートに新しいプロトコルを設定します。

     プロトコルの切り替えは、両方のプロトコルのドキュメントで切り替えが
     サポートされている場合にのみ行うべきです。

 -- メソッド: BaseTransport.get_protocol ()

     現在のプロトコルを返します。


File: python.info,  Node: 読み出し専用のトランスポート,  Next: 書き込み専用のトランスポート,  Prev: 基底トランスポート,  Up: トランスポート

5.19.1.86 読み出し専用のトランスポート
......................................

 -- メソッド: ReadTransport.is_reading ()

     トランスポートが新しいデータを受信中の場合 ‘True’ を返します。

     Added in version 3.7.

 -- メソッド: ReadTransport.pause_reading ()

     トランスポートの受信側を一時停止します。 *note resume_reading():
     d12. メソッドが呼び出されるまでプロトコルの *note
     protocol.data_received(): 1b02. メソッドにデータは渡されません。

     バージョン 3.7 で変更: このメソッドはべき等です。すなわちトランスポ
     ートがすでに停止していたりクローズしていても呼び出すことができます
     。

 -- メソッド: ReadTransport.resume_reading ()

     受信を再開します。データが読み込み可能になるとプロトコルの *note
     protocol.data_received(): 1b02. メソッドが再び呼び出されるようにな
     ります。

     バージョン 3.7 で変更: このメソッドはべき等です。すなわちトランスポ
     ートがすでにデータを読み込み中であっても呼び出すことができます。


File: python.info,  Node: 書き込み専用のトランスポート,  Next: データグラムトランスポート,  Prev: 読み出し専用のトランスポート,  Up: トランスポート

5.19.1.87 書き込み専用のトランスポート
......................................

 -- メソッド: WriteTransport.abort ()

     未完了の処理が完了するのを待たず、即座にトランスポートをクローズし
     ます。バッファーされているデータは失われます。このメソッドの呼び出
     し以降データは受信されません。最終的にプロトコルの *note
     protocol.connection_lost(): 38d8. メソッドが引数 *note None: 885. で
     呼び出されます。

 -- メソッド: WriteTransport.can_write_eof ()

     トランスポートが *note write_eof(): 38e0. メソッドをサポートしてい
     る場合 *note True: e07. を返し、そうでない場合は *note False: d2b.
     を返します。

 -- メソッド: WriteTransport.get_write_buffer_size ()

     トランスポートで使用されている出力バッファーの現在のサイズを返しま
     す。

 -- メソッド: WriteTransport.get_write_buffer_limits ()

     書き込みフロー制御の '最高' および '最低' 水位点を取得します。
     ‘(low, high)’ タプルを返します。ここで 'low' と 'high' はバイト数を
     あらわす正の整数です。

     水位点の設定は *note set_write_buffer_limits(): 38e2. で行います。

     Added in version 3.4.2.

 -- メソッド: WriteTransport.set_write_buffer_limits (high=None,
          low=None)

     書き込みフロー制御の '最高' および '最低' 水位点を設定します。

     (バイト数をあらわす) これら2つの値はプロトコルの *note
     protocol.pause_writing(): 38e3. と *note protocol.resume_writing():
     38e4. の2つのメソッドがいつ呼ばれるかを制御します。指定する場合、
     'low' は 'high' と等しいかまたは 'high' より小さくなければなりませ
     ん。また、 'high' も 'low' も負の値を指定することはできません。

     *note pause_writing(): 38e3. はバッファーサイズが 'high' の値以上に
     なった場合に呼び出されます。書き込みが一時停止している場合、バッフ
     ァーサイズが 'low' の値以下になると *note resume_writing(): 38e4. メ
     ソッドが呼び出されます。

     デフォルト値は実装固有になります。 'high' のみ与えられた場合、
     'low' は 'high' 以下の実装固有のデフォルト値になります。 'high' を
     ゼロに設定すると 'low' も強制的にゼロになり、バッファーが空でなくな
     るとすぐに *note pause_writing(): 38e3. メソッドが呼び出されるよう
     になります。 'low' をゼロに設定すると、バッファーが空にな *note
     resume_writing(): 38e4. が呼び出されるようになります。どちらかにゼ
     ロを設定することは I/O と計算を並行に実行する機会を減少させるため、
     一般に最適ではありません。

     上限値と下限値を取得するには *note get_write_buffer_limits(): fc4.
     メソッドを使ってください。

 -- メソッド: WriteTransport.write (data)

     トランスポートにバイト列 'data' を書き込みます。

     このメソッドはブロックしません; データをバッファーし、非同期に送信
     する準備を行います。

 -- メソッド: WriteTransport.writelines (list_of_data)

     バイト列のデータのリスト (またはイテラブル) をトランスポートに書き
     込みます。この振る舞いはイテラブルを yield して各要素で *note
     write(): 17ca. を呼び出すことと等価ですが、より効率的な実装となる場
     合があります。

 -- メソッド: WriteTransport.write_eof ()

     バッファーされた全てのデータをフラッシュした後トランスポートの送信
     側をクローズします。送信側をクローズした後もデータを受信することは
     可能です。

     このメソッドはトランスポート (例えば SSL) がハーフクローズドな接続
     をサポートしていない場合 *note NotImplementedError: 36b. を送出しま
     す。


File: python.info,  Node: データグラムトランスポート,  Next: サブプロセス化されたトランスポート,  Prev: 書き込み専用のトランスポート,  Up: トランスポート

5.19.1.88 データグラムトランスポート
....................................

 -- メソッド: DatagramTransport.sendto (data, addr=None)

     リモートピア 'addr' (トランスポート依存の対象アドレス) にバイト列
     'data' を送信します。'addr' が *note None: 885. の場合、データはト
     ランスポートの作成時に指定された送信先に送られます。

     このメソッドはブロックしません; データをバッファーし、非同期に送信
     する準備を行います。

     バージョン 3.13 で変更: このメソッドは、長さがゼロのデータグラムを
     送信するために、空のバイトオブジェクトで呼び出すこともできます。フ
     ロー制御に使用されるバッファサイズ計算も、データグラムヘッダーを考
     慮するように更新されました。

 -- メソッド: DatagramTransport.abort ()

     未完了の処理が完了するのを待たず、即座にトランスポートをクローズし
     ます。バッファーされているデータは失われます。このメソッドの呼び出
     し以降データは受信されません。最終的にプロトコルの *note
     protocol.connection_lost(): 38d8. メソッドが引数 *note None: 885. で
     呼び出されます。


File: python.info,  Node: サブプロセス化されたトランスポート,  Prev: データグラムトランスポート,  Up: トランスポート

5.19.1.89 サブプロセス化されたトランスポート
............................................

 -- メソッド: SubprocessTransport.get_pid ()

     サブプロセスのプロセス ID (整数) を返します。

 -- メソッド: SubprocessTransport.get_pipe_transport (fd)

     整数のファイル記述子 'fd' に該当する通信パイプのトランスポートを返
     します:

        * ‘0’: writable streaming transport of the standard input
          ('stdin'), or *note None: 885. if the subprocess was not
          created with ‘stdin=PIPE’

        * ‘1’: readable streaming transport of the standard output
          ('stdout'), or *note None: 885. if the subprocess was not
          created with ‘stdout=PIPE’

        * ‘2’: readable streaming transport of the standard error
          ('stderr'), or *note None: 885. if the subprocess was not
          created with ‘stderr=PIPE’

        * その他の 'fd': *note None: 885.

 -- メソッド: SubprocessTransport.get_returncode ()

     サブプロセスのリターンコードを整数で返します。サブプロセスがリター
     ンしなかった場合は *note None: 885. を返します。 *note
     subprocess.Popen.returncode: c83. 属性と同じです。

 -- メソッド: SubprocessTransport.kill ()

     サブプロセスを強制終了 (kill) します。

     POSIX システムでは、この関数はサブプロセスに SIGKILL を送信します。
     Windows では、このメソッドは *note terminate(): 38ec. の別名です。

     *note subprocess.Popen.kill(): 15f6. も参照してください。

 -- メソッド: SubprocessTransport.send_signal (signal)

     サブプロセスにシグナル 'signal' を送信します。*note
     subprocess.Popen.send_signal(): 15f7. と同じです。

 -- メソッド: SubprocessTransport.terminate ()

     サブプロセスを停止します。

     POSIX システムでは、このメソッドはサブプロセスに *note SIGTERM:
     15f8. を送信します。Windows では、Windows API 関数
     ‘TerminateProcess()’ がサブプロセスを停止するために呼び出されます。

     *note subprocess.Popen.terminate(): 15f5. も参照してください。

 -- メソッド: SubprocessTransport.close ()

     *note kill(): 38eb. メソッドを呼び出すことでサブプロセスを強制終了
     します。

     サブプロセスがまだリターンしていない場合、 'stdin', 'stdout', およ
     び 'stderr' の各パイプのトランスポートをクローズします。


File: python.info,  Node: プロトコル<2>,  Next: 使用例<26>,  Prev: トランスポート,  Up: トランスポートとプロトコル

5.19.1.90 プロトコル
....................

'ソースコード:' Lib/asyncio/protocols.py(1)

__________________________________________________________________

asyncio はネットワークプロトコルを実装するために使う抽象基底クラス群を提
供します。これらのクラスは *note トランスポート: 3893. と組み合わせて使
うことが想定されています。

抽象基底プロトコルクラスの派生クラスはメソッドの一部または全てを実装する
ことができます。これらのメソッドは全てコールバックです: それらは、データ
を受信した、などの決まったイベントに対してトランスポートから呼び出されま
す。基底プロトコルメソッドは対応するトランスポートから呼び出されるべきで
す。

* Menu:

* 基底プロトコル::
* 基底プロトコル: 基底プロトコル<2>.
* ストリーミングプロトコル::
* バッファリングされたストリーミングプロトコル::
* データグラムプロトコル::
* サブプロセスプロトコル::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/protocols.py


File: python.info,  Node: 基底プロトコル,  Next: 基底プロトコル<2>,  Up: プロトコル<2>

5.19.1.91 基底プロトコル
........................

 -- クラス: asyncio.BaseProtocol

     全てのプロトコルクラスが共有する全てのメソッドを持った基底プロトコ
     ルクラスです。

 -- クラス: asyncio.Protocol (BaseProtocol)

     ストリーミングプロトコル (TCP, Unix ソケットなど) を実装するための
     基底クラスです。

 -- クラス: asyncio.BufferedProtocol (BaseProtocol)

     受信バッファーを手動で制御するストリーミングプロトコルを実装するた
     めの基底クラスです。

 -- クラス: asyncio.DatagramProtocol (BaseProtocol)

     データグラム (UDP) プロトコルを実装するための基底クラスです。

 -- クラス: asyncio.SubprocessProtocol (BaseProtocol)

     子プロセスと (一方向パイプを通じて) 通信するプロトコルを実装するた
     めの基底クラスです。


File: python.info,  Node: 基底プロトコル<2>,  Next: ストリーミングプロトコル,  Prev: 基底プロトコル,  Up: プロトコル<2>

5.19.1.92 基底プロトコル
........................

全ての asyncio プロトコルは基底プロトコルのコールバックを実装することが
できます。

通信のコールバック
..................

コネクションコールバックは全てのプロトコルから、成功したコネクションそれ
ぞれにつきただ一度だけ呼び出されます。その他の全てのプロトコルコールバッ
クはこれら2つのメソッドの間に呼び出すことができます。

 -- メソッド: BaseProtocol.connection_made (transport)

     コネクションが作成されたときに呼び出されます。

     引数 'transport' はコネクションをあらわすトランスポートです。プロト
     コルはトランスポートへの参照を保存する責任を負います。

 -- メソッド: BaseProtocol.connection_lost (exc)

     コネクションが失われた、あるいはクローズされたときに呼び出されます
     。

     引数は例外オブジェクトまたは *note None: 885. になります。*note
     None: 885. のとき、通常の EOF が受信されたか、あるいはコネクション
     がこちら側から中止またはクローズされたことを意味します。

フロー制御コールバック
......................

フロー制御コールバックは、プロトコルによって実行される書き込み処理を停止
または再開するためにトランスポートから呼び出されます。

詳しくは *note set_write_buffer_limits(): 38e2. メソッドのドキュメントを
参照してください。

 -- メソッド: BaseProtocol.pause_writing ()

     トランスポートのバッファーサイズが最高水位点 (high watermark) を超
     えたときに呼び出されます。

 -- メソッド: BaseProtocol.resume_writing ()

     トランスポートのバッファーサイズが最低水位点 (low watermark) に達し
     たきに呼び出されます。

バッファーサイズが最高水位点と等しい場合、 *note pause_writing(): 38e3.
は呼び出されません: バッファーサイズは必ず制限値を超えなければなりません
。

それに対して、 *note resume_writing(): 38e4. はバッファーサイズが最低水
位点と等しいかそれよりも小さい場合に呼び出されます。これらの境界条件は、
どちらの基準値もゼロである場合の処理が期待通りとなることを保証するために
重要です。


File: python.info,  Node: ストリーミングプロトコル,  Next: バッファリングされたストリーミングプロトコル,  Prev: 基底プロトコル<2>,  Up: プロトコル<2>

5.19.1.93 ストリーミングプロトコル
..................................

*note loop.create_server(): d09, *note loop.create_unix_server(): 4ca,
*note loop.create_connection(): 818, *note
loop.create_unix_connection(): 37ff, *note
loop.connect_accepted_socket(): 9de, *note loop.connect_read_pipe():
3846, そして *note loop.connect_write_pipe(): 3847. などのイベントメソッ
ドはストリーミングプロトコルを返すファクトリを受け付けます。

 -- メソッド: Protocol.data_received (data)

     データを受信したときに呼び出されます。'data' は受信したデータを含む
     空ではないバイト列オブジェクトになります。

     データがバッファーされるか、チャンキングされるか、または再構築され
     るかはトランスポートに依存します。一般には、特定のセマンティクスを
     信頼するべきではなく、代わりにデータのパースを全般的かつ柔軟に行う
     べきです。ただし、データは常に正しい順序で受信されます。

     このメソッドは、コネクションがオープンである間は何度でも呼び出すこ
     とができます。

     いっぽうで、 *note protocol.eof_received(): 38f2. メソッドは最大で
     も一度だけ呼び出されます。いったん ‘eof_received()’ が呼び出される
     と、それ以降 ‘data_received()’ は呼び出されません。

 -- メソッド: Protocol.eof_received ()

     コネクションの相手方がこれ以上データを送信しないことを伝えてきたと
     き (例えば相手方が asyncio を使用しており、 *note
     transport.write_eof(): 38e0. を呼び出した場合) に呼び出されます。

     このメソッドは (‘None’ を含む) 偽値 を返すことがあり、その場合トラ
     ンスポートは自身をクローズします。一方メソッドが真値を返す場合は、
     利用しているプロトコルがトランスポートをクローズするかどうかを決め
     ます。デフォルトの実装は ‘None’ を返すため、コネクションは暗黙のう
     ちにクローズされます。

     SSL を含む一部のトランスポートはハーフクローズ接続をサポートしませ
     ん。そのような場合このメソッドが真値を返すとコネクションはクローズ
     されます。

ステートマシン:

     start -> connection_made
         [-> data_received]*
         [-> eof_received]?
     -> connection_lost -> end


File: python.info,  Node: バッファリングされたストリーミングプロトコル,  Next: データグラムプロトコル,  Prev: ストリーミングプロトコル,  Up: プロトコル<2>

5.19.1.94 バッファリングされたストリーミングプロトコル
......................................................

Added in version 3.7.

バッファー付きプロトコルは *note ストリーミングプロトコル: 38f1. をサポ
ートするイベントループメソッドで利用することができます。

‘BufferedProtocol’ 実装は受信バッファーの手動での明示的な割り当てや制御
を可能にします。イベントループはプロトコルにより提供されるバッファを利用
することにより不要なデータのコピーを避けることができます。これにより大量
のデータを受信するプロトコルにおいて顕著なパフォーマンスの向上をもたらし
ます。精巧なプロトコル実装によりバッファー割り当ての数を劇的に減少させる
ことができます。

以下に示すコールバックは *note BufferedProtocol: c94. インスタンスに対し
て呼び出されます:

 -- メソッド: BufferedProtocol.get_buffer (sizehint)

     新しい受信バッファを割り当てるために呼び出します。

     'sizehint' は返されるバッファーの推奨される最小サイズです。
     'sizehint' によって推奨された値より小さい、または大きいサイズのバッ
     ファーを返すことは容認されています。 -1 がセットされた場合、バッフ
     ァーサイズは任意となります。サイズがゼロのバッファーを返すとエラー
     になります。

     ‘get_buffer()’ は *note バッファープロトコル: 260. を実装したオブジ
     ェクトを返さなければなりません。

 -- メソッド: BufferedProtocol.buffer_updated (nbytes)

     受信データによりバッファが更新された場合に呼び出されます。

     'nbytes' はバッファに書き込まれた総バイト数です。

 -- メソッド: BufferedProtocol.eof_received ()

     *note protocol.eof_received(): 38f2. メソッドのドキュメントを参照し
     てください。

コネクションの間、 *note get_buffer(): 38f4. は何度でも呼び出すことがで
きます。しかし *note protocol.eof_received(): 38f2. が呼び出されるのは最
大でも1回で、もし呼び出されると、それ以降 *note get_buffer(): 38f4. と
*note buffer_updated(): 38f5. が呼び出されることはありません。

ステートマシン:

     start -> connection_made
         [-> get_buffer
             [-> buffer_updated]?
         ]*
         [-> eof_received]?
     -> connection_lost -> end


File: python.info,  Node: データグラムプロトコル,  Next: サブプロセスプロトコル,  Prev: バッファリングされたストリーミングプロトコル,  Up: プロトコル<2>

5.19.1.95 データグラムプロトコル
................................

データグラムプロトコルのインスタンスは *note
loop.create_datagram_endpoint(): 93c. メソッドに渡されたプロトコルファク
トリによって生成されるべきです。

 -- メソッド: DatagramProtocol.datagram_received (data, addr)

     データグラムを受信したときに呼び出されます。'data' は受信データを含
     むバイトオブジェクトです。'addr' はデータを送信するピアのアドレスで
     す; 正確な形式はトランスポートに依存します。

 -- メソッド: DatagramProtocol.error_received (exc)

     直前の送信あるいは受信が *note OSError: 2c0. を送出したときに呼び出
     されます。'exc' は *note OSError: 2c0. のインスタンスになります。

     このメソッドが呼ばれるのは、トランスポート (UDP など) がデータグラ
     ムを受信側に配信できなかったことが検出されたなどの、まれな場合にお
     いてのみです。ほとんどの場合、データグラムが配信できなければそのま
     ま通知されることなく破棄されます。

     注釈: BSD システム (macOS, FreeBSD など) ではフロー制御はサポートさ
     れていません。これは非常に多くのパケットを書き込もうとしたことによ
     る送信の失敗を検出する信頼できる方法が存在しないためです。

     ソケットは常に '準備ができた状態' のように振る舞いますが、超過した
     パケットは破棄されます。この場合 ‘errno’ を *note errno.ENOBUFS:
     1b71. に設定した *note OSError: 2c0. 例外が送出されることがあります
     。もし例外が送出された場合は *note
     DatagramProtocol.error_received(): 38f9. に通知されますが、送出され
     ない場合は単に無視されます。


File: python.info,  Node: サブプロセスプロトコル,  Prev: データグラムプロトコル,  Up: プロトコル<2>

5.19.1.96 サブプロセスプロトコル
................................

サブプロセスプロトコルのインスタンスは *note loop.subprocess_exec():
3843. と *note loop.subprocess_shell(): 3844. メソッドに渡されたプロトコ
ルファクトリにより生成されるべきです。

 -- メソッド: SubprocessProtocol.pipe_data_received (fd, data)

     子プロセスが標準出力または標準エラー出力のパイプにデータを書き込ん
     だ時に呼び出されます。

     'fd' はパイプのファイル記述子を表す整数です。

     'data' は受信データを含む空でないバイトオブジェクトです。

 -- メソッド: SubprocessProtocol.pipe_connection_lost (fd, exc)

     子プロセスと通信するパイプのいずれかがクローズされたときに呼び出さ
     れます。

     'fd' はクローズされたファイル記述子を表す整数です。

 -- メソッド: SubprocessProtocol.process_exited ()

     子プロセスが終了したときに呼び出されます。

     これは、 *note pipe_data_received(): 1b50. と *note
     pipe_connection_lost(): 38fb. メソッドの前に呼び出すことができます
     。


File: python.info,  Node: 使用例<26>,  Prev: プロトコル<2>,  Up: トランスポートとプロトコル

5.19.1.97 使用例
................

* Menu:

* TCP エコーサーバー::
* TCP エコークライアント::
* UDP エコーサーバー::
* UDP エコークライアント::
* 既存のソケットへの接続::
* loop.subprocess_exec() と SubprocessProtocol: loop subprocess_exec と SubprocessProtocol.


File: python.info,  Node: TCP エコーサーバー,  Next: TCP エコークライアント,  Up: 使用例<26>

5.19.1.98 TCP エコーサーバー
............................

*note loop.create_server(): d09. メソッドを使って TCP エコーサーバーを生
成し、受信したデータをそのまま送り返して、最後にコネクションをクローズし
ます:

     import asyncio


     class EchoServerProtocol(asyncio.Protocol):
         def connection_made(self, transport):
             peername = transport.get_extra_info('peername')
             print('Connection from {}'.format(peername))
             self.transport = transport

         def data_received(self, data):
             message = data.decode()
             print('Data received: {!r}'.format(message))

             print('Send: {!r}'.format(message))
             self.transport.write(data)

             print('Close the client socket')
             self.transport.close()


     async def main():
         # Get a reference to the event loop as we plan to use
         # low-level APIs.
         loop = asyncio.get_running_loop()

         server = await loop.create_server(
             EchoServerProtocol,
             '127.0.0.1', 8888)

         async with server:
             await server.serve_forever()


     asyncio.run(main())

参考
....

*note ストリームを使った TCP エコーサーバー: 3812. の例では高水準の
*note asyncio.start_server(): d0f. 関数を使っています。


File: python.info,  Node: TCP エコークライアント,  Next: UDP エコーサーバー,  Prev: TCP エコーサーバー,  Up: 使用例<26>

5.19.1.99 TCP エコークライアント
................................

*note loop.create_connection(): 818. メソッドを使った TCP エコークライア
ントは、データを送信したあとコネクションがクローズされるまで待機します:

     import asyncio


     class EchoClientProtocol(asyncio.Protocol):
         def __init__(self, message, on_con_lost):
             self.message = message
             self.on_con_lost = on_con_lost

         def connection_made(self, transport):
             transport.write(self.message.encode())
             print('Data sent: {!r}'.format(self.message))

         def data_received(self, data):
             print('Data received: {!r}'.format(data.decode()))

         def connection_lost(self, exc):
             print('The server closed the connection')
             self.on_con_lost.set_result(True)


     async def main():
         # Get a reference to the event loop as we plan to use
         # low-level APIs.
         loop = asyncio.get_running_loop()

         on_con_lost = loop.create_future()
         message = 'Hello World!'

         transport, protocol = await loop.create_connection(
             lambda: EchoClientProtocol(message, on_con_lost),
             '127.0.0.1', 8888)

         # Wait until the protocol signals that the connection
         # is lost and close the transport.
         try:
             await on_con_lost
         finally:
             transport.close()


     asyncio.run(main())

参考
....

*note ストリームを使った TCP エコークライアント: 380f. の例では高水準の
*note asyncio.open_connection(): d0e. 関数を使っています。


File: python.info,  Node: UDP エコーサーバー,  Next: UDP エコークライアント,  Prev: TCP エコークライアント,  Up: 使用例<26>

5.19.1.100 UDP エコーサーバー
.............................

*note loop.create_datagram_endpoint(): 93c. メソッドを使った UDP エコー
サーバーは受信したデータをそのまま送り返します:

     import asyncio


     class EchoServerProtocol:
         def connection_made(self, transport):
             self.transport = transport

         def datagram_received(self, data, addr):
             message = data.decode()
             print('Received %r from %s' % (message, addr))
             print('Send %r to %s' % (message, addr))
             self.transport.sendto(data, addr)


     async def main():
         print("Starting UDP server")

         # Get a reference to the event loop as we plan to use
         # low-level APIs.
         loop = asyncio.get_running_loop()

         # One protocol instance will be created to serve all
         # client requests.
         transport, protocol = await loop.create_datagram_endpoint(
             EchoServerProtocol,
             local_addr=('127.0.0.1', 9999))

         try:
             await asyncio.sleep(3600)  # Serve for 1 hour.
         finally:
             transport.close()


     asyncio.run(main())


File: python.info,  Node: UDP エコークライアント,  Next: 既存のソケットへの接続,  Prev: UDP エコーサーバー,  Up: 使用例<26>

5.19.1.101 UDP エコークライアント
.................................

*note loop.create_datagram_endpoint(): 93c. メソッドを使った UDP エコー
クライアントはデータを送信し、応答を受信するとトランスポートをクローズし
ます:

     import asyncio


     class EchoClientProtocol:
         def __init__(self, message, on_con_lost):
             self.message = message
             self.on_con_lost = on_con_lost
             self.transport = None

         def connection_made(self, transport):
             self.transport = transport
             print('Send:', self.message)
             self.transport.sendto(self.message.encode())

         def datagram_received(self, data, addr):
             print("Received:", data.decode())

             print("Close the socket")
             self.transport.close()

         def error_received(self, exc):
             print('Error received:', exc)

         def connection_lost(self, exc):
             print("Connection closed")
             self.on_con_lost.set_result(True)


     async def main():
         # Get a reference to the event loop as we plan to use
         # low-level APIs.
         loop = asyncio.get_running_loop()

         on_con_lost = loop.create_future()
         message = "Hello World!"

         transport, protocol = await loop.create_datagram_endpoint(
             lambda: EchoClientProtocol(message, on_con_lost),
             remote_addr=('127.0.0.1', 9999))

         try:
             await on_con_lost
         finally:
             transport.close()


     asyncio.run(main())


File: python.info,  Node: 既存のソケットへの接続,  Next: loop subprocess_exec と SubprocessProtocol,  Prev: UDP エコークライアント,  Up: 使用例<26>

5.19.1.102 既存のソケットへの接続
.................................

プロトコルを設定した *note loop.create_connection(): 818. メソッドを使っ
てソケットがデータを受信するまで待機します:

     import asyncio
     import socket


     class MyProtocol(asyncio.Protocol):

         def __init__(self, on_con_lost):
             self.transport = None
             self.on_con_lost = on_con_lost

         def connection_made(self, transport):
             self.transport = transport

         def data_received(self, data):
             print("Received:", data.decode())

             # We are done: close the transport;
             # connection_lost() will be called automatically.
             self.transport.close()

         def connection_lost(self, exc):
             # The socket has been closed
             self.on_con_lost.set_result(True)


     async def main():
         # Get a reference to the event loop as we plan to use
         # low-level APIs.
         loop = asyncio.get_running_loop()
         on_con_lost = loop.create_future()

         # Create a pair of connected sockets
         rsock, wsock = socket.socketpair()

         # Register the socket to wait for data.
         transport, protocol = await loop.create_connection(
             lambda: MyProtocol(on_con_lost), sock=rsock)

         # Simulate the reception of data from the network.
         loop.call_soon(wsock.send, 'abc'.encode())

         try:
             await protocol.on_con_lost
         finally:
             transport.close()
             wsock.close()

     asyncio.run(main())

参考
....

*note ファイル記述子の読み込みイベントを監視する: 3819. 例では低レベルの
*note loop.add_reader(): 381a. メソッドを使ってファイル記述子 (FD) を登
録しています。

*note ストリームを使ってデータを待ち受けるオープンなソケットを登録する:
3816. 例ではコルーチン内で *note open_connection(): d0e. 関数によって生
成されたストリームを使っています。


File: python.info,  Node: loop subprocess_exec と SubprocessProtocol,  Prev: 既存のソケットへの接続,  Up: 使用例<26>

5.19.1.103 loop.subprocess_exec() と SubprocessProtocol
.......................................................

サブプロセスからの出力を受け取り、サブプロセスが終了するまで待機するため
に使われるサブプロセスプロトコルの例です。

サブプロセスは *note loop.subprocess_exec(): 3843. メソッドにより生成さ
れます:

     import asyncio
     import sys

     class DateProtocol(asyncio.SubprocessProtocol):
         def __init__(self, exit_future):
             self.exit_future = exit_future
             self.output = bytearray()
             self.pipe_closed = False
             self.exited = False

         def pipe_connection_lost(self, fd, exc):
             self.pipe_closed = True
             self.check_for_exit()

         def pipe_data_received(self, fd, data):
             self.output.extend(data)

         def process_exited(self):
             self.exited = True
             # process_exited() method can be called before
             # pipe_connection_lost() method: wait until both methods are
             # called.
             self.check_for_exit()

         def check_for_exit(self):
             if self.pipe_closed and self.exited:
                 self.exit_future.set_result(True)

     async def get_date():
         # Get a reference to the event loop as we plan to use
         # low-level APIs.
         loop = asyncio.get_running_loop()

         code = 'import datetime; print(datetime.datetime.now())'
         exit_future = asyncio.Future(loop=loop)

         # Create the subprocess controlled by DateProtocol;
         # redirect the standard output into a pipe.
         transport, protocol = await loop.subprocess_exec(
             lambda: DateProtocol(exit_future),
             sys.executable, '-c', code,
             stdin=None, stderr=None)

         # Wait for the subprocess exit using the process_exited()
         # method of the protocol.
         await exit_future

         # Close the stdout pipe.
         transport.close()

         # Read the output which was collected by the
         # pipe_data_received() method of the protocol.
         data = bytes(protocol.output)
         return data.decode('ascii').rstrip()

     date = asyncio.run(get_date())
     print(f"Current date: {date}")

高水準の API を使って書かれた *note 同様の例: 3857. も参照してください。


File: python.info,  Node: ポリシー,  Next: プラットフォームでのサポート,  Prev: トランスポートとプロトコル,  Up: asyncio --- 非同期 I/O

5.19.1.104 ポリシー
...................

     警告: Policies are deprecated and will be removed in Python 3.16.
     Users are encouraged to use the *note asyncio.run(): 2f3. function
     or the *note asyncio.Runner: 2f5. with 'loop_factory' to use the
     desired loop implementation.

An event loop policy is a global object used to get and set the current
*note event loop: f76, as well as create new event loops.  The default
policy can be *note replaced: 3905. with *note built-in alternatives:
3906. to use different event loop implementations, or substituted by a
*note custom policy: 3907. that can override these behaviors.

The *note policy object: 3908. gets and sets a separate event loop per
'context'.  This is per-thread by default, though custom policies could
define 'context' differently.

Custom event loop policies can control the behavior of *note
get_event_loop(): 2f2, *note set_event_loop(): 1b55, and *note
new_event_loop(): 37c6.

ポリシーオブジェクトは *note AbstractEventLoopPolicy: 30e. 抽象基底クラ
スで定義された API を実装しなければなりません。

* Menu:

* ポリシーの取得と設定::
* ポリシーオブジェクト::
* ポリシーのカスタマイズ::


File: python.info,  Node: ポリシーの取得と設定,  Next: ポリシーオブジェクト,  Up: ポリシー

5.19.1.105 ポリシーの取得と設定
...............................

以下の関数は現在のプロセスに対するポリシーの取得や設定をするために使われ
ます:

 -- の関数: asyncio.get_event_loop_policy ()

     プロセス全体にわたる現在のポリシーを返します。

     バージョン 3.14 で非推奨: The *note get_event_loop_policy(): 312.
     function is deprecated and will be removed in Python 3.16.

 -- の関数: asyncio.set_event_loop_policy (policy)

     プロセス全体にわたる現在のポリシーを 'policy' に設定します。

     'policy' が ‘None’ の場合、デフォルトポリシーが現在のポリシーに戻さ
     れます。

     バージョン 3.14 で非推奨: The *note set_event_loop_policy(): 313.
     function is deprecated and will be removed in Python 3.16.


File: python.info,  Node: ポリシーオブジェクト,  Next: ポリシーのカスタマイズ,  Prev: ポリシーの取得と設定,  Up: ポリシー

5.19.1.106 ポリシーオブジェクト
...............................

イベントループポリシーの抽象基底クラスは以下のように定義されています:

 -- クラス: asyncio.AbstractEventLoopPolicy

     asyncio ポリシーの抽象基底クラスです。

      -- メソッド: get_event_loop ()

          現在のコンテキストのイベントループを取得します。

          *note AbstractEventLoop: b58. のインターフェースを実装したイベ
          ントループオブジェクトを返します。

          このメソッドは ‘None’ を返してはいけません。

          バージョン 3.6 で変更.

      -- メソッド: set_event_loop (loop)

          現在のコンテキストにイベントループ 'loop' を設定します。

      -- メソッド: new_event_loop ()

          新しいイベントループオブジェクトを生成して返します。

          このメソッドは ‘None’ を返してはいけません。

     バージョン 3.14 で非推奨: The *note AbstractEventLoopPolicy: 30e.
     class is deprecated and will be removed in Python 3.16.

asyncio は以下の組み込みポリシーを提供します:

 -- クラス: asyncio.DefaultEventLoopPolicy

     デフォルトの asyncio ポリシーです。Unix では *note
     SelectorEventLoop: 314. 、Windows では *note ProactorEventLoop:
     81d. を使います。

     デフォルトのポリシーを手動でインストールする必要はありません。
     asyncio はデフォルトポリシーを使うように自動的に構成されます。

     バージョン 3.8 で変更: Windows では *note ProactorEventLoop: 81d. が
     デフォルトで使われるようになりました。

     バージョン 3.14 で変更: The *note get_event_loop(): 2f2. method of
     the default asyncio policy now raises a *note RuntimeError: 244. if
     there is no set event loop.

     バージョン 3.14 で非推奨: The *note DefaultEventLoopPolicy: 30f.
     class is deprecated and will be removed in Python 3.16.

 -- クラス: asyncio.WindowsSelectorEventLoopPolicy

     *note SelectorEventLoop: 314. イベントループ実装を使った別のイベン
     トループポリシーです。

     *note Availability: 213f.: Windows.

     バージョン 3.14 で非推奨: The *note WindowsSelectorEventLoopPolicy:
     310. class is deprecated and will be removed in Python 3.16.

 -- クラス: asyncio.WindowsProactorEventLoopPolicy

     *note ProactorEventLoop: 81d. イベントループ実装を使った別のイベン
     トループポリシーです。

     *note Availability: 213f.: Windows.

     バージョン 3.14 で非推奨: The *note WindowsProactorEventLoopPolicy:
     311. class is deprecated and will be removed in Python 3.16.


File: python.info,  Node: ポリシーのカスタマイズ,  Prev: ポリシーオブジェクト,  Up: ポリシー

5.19.1.107 ポリシーのカスタマイズ
.................................

新しいイベントループのポリシーを実装するためには、以下に示すように *note
DefaultEventLoopPolicy: 30f. を継承して振る舞いを変更したいメソッドをオ
ーバーライドすることが推奨されます。:

     class MyEventLoopPolicy(asyncio.DefaultEventLoopPolicy):

         def get_event_loop(self):
             """Get the event loop.

             This may be None or an instance of EventLoop.
             """
             loop = super().get_event_loop()
             # Do something with loop ...
             return loop

     asyncio.set_event_loop_policy(MyEventLoopPolicy())


File: python.info,  Node: プラットフォームでのサポート,  Next: Extending,  Prev: ポリシー,  Up: asyncio --- 非同期 I/O

5.19.1.108 プラットフォームでのサポート
.......................................

*note asyncio: b. モジュールは可搬的であるようにデザインされていますが、
いくつかのプラットフォームでは、その根底にあるアーキテクチャや性能による
微妙な動作の違いや制限があります。

* Menu:

* 全てのプラットホーム::
* Windows: Windows<84>.
* macOS: macOS<52>.


File: python.info,  Node: 全てのプラットホーム,  Next: Windows<84>,  Up: プラットフォームでのサポート

5.19.1.109 全てのプラットホーム
...............................

   * *note loop.add_reader(): 381a. と *note loop.add_writer(): 38a0. を
     ファイル I/O を監視するためには使えません。


File: python.info,  Node: Windows<84>,  Next: macOS<52>,  Prev: 全てのプラットホーム,  Up: プラットフォームでのサポート

5.19.1.110 Windows
..................

'ソースコード:' Lib/asyncio/proactor_events.py(1),
Lib/asyncio/windows_events.py(2), Lib/asyncio/windows_utils.py(3)

__________________________________________________________________

バージョン 3.8 で変更: Windows では *note ProactorEventLoop: 81d. がデフ
ォルトのイベントループになりました。

全ての Windows 上のイベントループは以下のメソッドをサポートしません:

   * *note loop.create_unix_connection(): 37ff. と *note
     loop.create_unix_server(): 4ca. はサポートされません。 *note
     socket.AF_UNIX: 1bb0. ソケットファミリーは Unix 固有です。

   * *note loop.add_signal_handler(): 38a9. と *note
     loop.remove_signal_handler(): 38aa. はサポートされていません。

*note SelectorEventLoop: 314. は以下の制限があります:

   * *note SelectSelector: 3914. はソケットイベントの待ち受けに使われま
     す: このクラスはソケットをサポートしますが 512 ソケットまでに制限さ
     れています。

   * *note loop.add_reader(): 381a. と *note loop.add_writer(): 38a0. は
     ソケットハンドルのみを受け付けます (たとえばパイプファイル記述子は
     サポートされていません)。

   * パイプはサポートされていません。従って *note
     loop.connect_read_pipe(): 3846. と *note loop.connect_write_pipe():
     3847. の2つのメソッドは未実装です。

   * *note Subprocesses: 37ba. はサポートされていません。すなわち *note
     loop.subprocess_exec(): 3843. と *note loop.subprocess_shell():
     3844. の2つのメソッドは未実装です。

*note ProactorEventLoop: 81d. は以下の制限があります:

   * *note loop.add_reader(): 381a. と *note loop.add_writer(): 38a0. は
     サポートされていません。

Windows のモノトニッククロックの時間分解能は、通常約15.6ミリ秒です。最高
分解能は0.5ミリ秒です。分解能はハードウエア (HPET(4) が利用可能かどうか)
および WIndows の設定に依存します。

* Menu:

* Windows におけるサブプロセスのサポート::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/proactor_events.py

   (2) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/windows_events.py

   (3) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/windows_utils.py

   (4) https://en.wikipedia.org/wiki/High_Precision_Event_Timer


File: python.info,  Node: Windows におけるサブプロセスのサポート,  Up: Windows<84>

5.19.1.111 Windows におけるサブプロセスのサポート
.................................................

Windows において、デフォルトのイベントループ *note ProactorEventLoop:
81d. はサブプロセスをサポートしますが、 *note SelectorEventLoop: 314. は
サポートしません。


File: python.info,  Node: macOS<52>,  Prev: Windows<84>,  Up: プラットフォームでのサポート

5.19.1.112 macOS
................

最近の macOS バージョンは完全にサポートされています。

10.8 以前の macOS
.................

macOS 10.6, 10.7 および 10.8 では、デフォルトイベントループは *note
selectors.KqueueSelector: 3917. をしていますが、このクラスはこれらの
macOS バージョンのキャラクターデバイスをサポートしていません。これらの
macOS バージョンでキャラクターデバイスをサポートするためには *note
SelectorEventLoop: 314. で *note SelectSelector: 3914. または *note
PollSelector: dd1. を使うように手動で設定します。以下はその例です:

     import asyncio
     import selectors

     selector = selectors.SelectSelector()
     loop = asyncio.SelectorEventLoop(selector)
     asyncio.set_event_loop(loop)


File: python.info,  Node: Extending,  Next: 高水準の API インデックス,  Prev: プラットフォームでのサポート,  Up: asyncio --- 非同期 I/O

5.19.1.113 Extending
....................

The main direction for *note asyncio: b. extending is writing custom
'event loop' classes.  Asyncio has helpers that could be used to
simplify this task.

     注釈: Third-parties should reuse existing asyncio code with
     caution, a new Python version is free to break backward
     compatibility in 'internal' part of API.

* Menu:

* Writing a Custom Event Loop::
* Future and Task private constructors::
* Task lifetime support::


File: python.info,  Node: Writing a Custom Event Loop,  Next: Future and Task private constructors,  Up: Extending

5.19.1.114 Writing a Custom Event Loop
......................................

*note asyncio.AbstractEventLoop: b58. declares very many methods.
Implementing all them from scratch is a tedious job.

A loop can get many common methods implementation for free by inheriting
from ‘asyncio.BaseEventLoop’.

In turn, the successor should implement a bunch of 'private' methods
declared but not implemented in ‘asyncio.BaseEventLoop’.

For example, ‘loop.create_connection()’ checks arguments, resolves DNS
addresses, and calls ‘loop._make_socket_transport()’ that should be
implemented by inherited class.  The ‘_make_socket_transport()’ method
is not documented and is considered as an 'internal' API.


File: python.info,  Node: Future and Task private constructors,  Next: Task lifetime support,  Prev: Writing a Custom Event Loop,  Up: Extending

5.19.1.115 Future and Task private constructors
...............................................

*note asyncio.Future: dc6. and *note asyncio.Task: 1c7. should be never
created directly, please use corresponding *note loop.create_future():
e74. and *note loop.create_task(): 1ca, or *note asyncio.create_task():
1c9. factories instead.

However, third-party 'event loops' may 'reuse' built-in future and task
implementations for the sake of getting a complex and highly optimized
code for free.

For this purpose the following, 'private' constructors are listed:

 -- メソッド: Future.__init__ (*, loop=None)

     Create a built-in future instance.

     'loop' is an optional event loop instance.

 -- メソッド: Task.__init__ (coro, *, loop=None, name=None,
          context=None)

     Create a built-in task instance.

     'loop' is an optional event loop instance.  The rest of arguments
     are described in *note loop.create_task(): 1ca. description.

     バージョン 3.11 で変更: 'context' argument is added.


File: python.info,  Node: Task lifetime support,  Prev: Future and Task private constructors,  Up: Extending

5.19.1.116 Task lifetime support
................................

A third party task implementation should call the following functions to
keep a task visible by *note asyncio.all_tasks(): b4f. and *note
asyncio.current_task(): 6a5.:

 -- の関数: asyncio._register_task (task)

     Register a new 'task' as managed by 'asyncio'.

     Call the function from a task constructor.

 -- の関数: asyncio._unregister_task (task)

     Unregister a 'task' from 'asyncio' internal structures.

     The function should be called when a task is about to finish.

 -- の関数: asyncio._enter_task (loop, task)

     Switch the current task to the 'task' argument.

     Call the function just before executing a portion of embedded
     'coroutine' (*note coroutine.send(): 2419. or *note
     coroutine.throw(): 71b.).

 -- の関数: asyncio._leave_task (loop, task)

     Switch the current task back from 'task' to ‘None’.

     Call the function just after *note coroutine.send(): 2419. or *note
     coroutine.throw(): 71b. execution.


File: python.info,  Node: 高水準の API インデックス,  Next: 低水準の API インデックス,  Prev: Extending,  Up: asyncio --- 非同期 I/O

5.19.1.117 高水準の API インデックス
....................................

このページには、すべての高水準の 非同期/待機 可能な asyncio API が一覧に
なっています。

* Menu:

* Task::
* キュー: キュー<2>.
* サブプロセス: サブプロセス<2>.
* ストリーム: ストリーム<2>.
* 同期::
* 例外: 例外<17>.


File: python.info,  Node: Task,  Next: キュー<2>,  Up: 高水準の API インデックス

5.19.1.118 Task
...............

ユーティリティは asyncio プログラムを実行し、タスクを作成し、タイムアウ
トのある複数の機能を待っています。

*note run(): 2f3.                                      イベントループを作成し、コルーチンを実行し、ループを
                                                       閉じます。
                                                       
                                                       
*note Runner: 2f5.                                     複数の非同期関数呼び出しをシンプルにするコンテキスト
                                                       マネージャ。
                                                       
                                                       
*note Task: 1c7.                                       Task オブジェクト
                                                       
                                                       
*note TaskGroup: 4d1.                                  タスクのグループを保持するコンテキストマネージャ。グ
                                                       ループに属するすべてのタスクが完了するのを待つのに便
                                                       利で信頼性のある方法を提供します。
                                                       
                                                       
*note create_task(): 1c9.                              asyncio タスクを開始し、それを返します。
                                                       
                                                       
*note current_task(): 6a5.                             現在のタスクを返します。
                                                       
                                                       
*note all_tasks(): b4f.                                イベントループのまだ終了していないすべてのタスクを返
                                                       します。
                                                       
                                                       
‘await’ *note sleep(): c64.                            数秒間スリープします。
                                                       
                                                       
‘await’ *note gather(): 813.                           並行してスケジュールして、待ちます。
                                                       
                                                       
‘await’ *note wait_for(): 815.                         タイムアウトで実行します。
                                                       
                                                       
‘await’ *note shield(): c65.                           取り消しから保護します。
                                                       
                                                       
‘await’ *note wait(): 6a7.                             完了かどうかを監視します。
                                                       
                                                       
*note timeout(): 814.                                  タイムアウト付きで実行します。 ‘wait_for’ が適してい
                                                       ない場合に有用です。
                                                       
                                                       
*note to_thread(): ae5.                                別の OS スレッドで非同期的に関数を実行します。
                                                       
                                                       
*note run_coroutine_threadsafe(): a82.                 別の OS スレッドからコルーチンの実行をスケジュールし
                                                       ます。
                                                       
                                                       
‘for in’ *note as_completed(): 4c6.                    ‘for’ ループ向けにコルーチンの完了を監視します。
                                                       

使用例
......

   * *note asyncio.gather() を使って複数の処理を並列に実行する: 37d9. 。

   * *note asyncio.wait_for() を使って強制的にタイムアウトする: 37e1. 。

   * *note 非同期処理をキャンセルする: 37f6. 。

   * *note asyncio.sleep() を使う: 37d7. 。

   * *note Tasks のドキュメント: 37b8. も参照してください。


File: python.info,  Node: キュー<2>,  Next: サブプロセス<2>,  Prev: Task,  Up: 高水準の API インデックス

5.19.1.119 キュー
.................

キューは複数の非同期タスクの分散処理、コネクションプールやpub/subパター
ンの実装に適しています。

*note Queue: c6a.                                      FIFO キューです。
                                                       
                                                       
*note PriorityQueue: 3869.                             優先度付きのキューです。
                                                       
                                                       
*note LifoQueue: 386b.                                 LIFO キュー (スタック) です。
                                                       

使用例
......

   * *note asyncio.Queue を使って複数のタスクを分散処理する: 386d.

   * *note Queue のドキュメント: 37bb. も参照してください。


File: python.info,  Node: サブプロセス<2>,  Next: ストリーム<2>,  Prev: キュー<2>,  Up: 高水準の API インデックス

5.19.1.120 サブプロセス
.......................

サブプロセスを生成したり、シェルコマンドを実行するためのユーティリティで
す。

‘await’ *note create_subprocess_exec(): c6b.           サブプロセスを作成します。
                                                       
                                                       
‘await’ *note create_subprocess_shell(): c6c.          シェルコマンドを実行します。
                                                       

使用例
......

   * *note シェルコマンドを実行する: 383d.。

   * *note サブプロセス API: 37ba. のドキュメントも参照してください。


File: python.info,  Node: ストリーム<2>,  Next: 同期,  Prev: サブプロセス<2>,  Up: 高水準の API インデックス

5.19.1.121 ストリーム
.....................

ネットワーク IO を利用するための高水準の APIs です。

‘await’ *note open_connection(): d0e.                  TCP コネクションを確立します。
                                                       
                                                       
‘await’ *note open_unix_connection(): 37fe.            Unix のソケット接続を確立します。
                                                       
                                                       
‘await’ *note start_server(): d0f.                     TCP サーバーを起動します。
                                                       
                                                       
‘await’ *note start_unix_server(): 3800.               Unix のソケットサーバーを起動します。
                                                       
                                                       
*note StreamReader: 1c7d.                              ネットワークからデータを受信するための高水準の
                                                       async/await オブジェクトです。
                                                       
                                                       
*note StreamWriter: 1a70.                              ネットワークにデータを送信するための高水準の
                                                       async/await オブジェクトです。
                                                       

使用例
......

   * *note TCPクライアントの例: 37fa.

   * *note ストリーム API: 37b9. のドキュメントも参照してください。


File: python.info,  Node: 同期,  Next: 例外<17>,  Prev: ストリーム<2>,  Up: 高水準の API インデックス

5.19.1.122 同期
...............

タスク内で利用できるスレッド並列処理に似た同期プリミティブです。

*note Lock: c66.                                       ミューテックスロックです。
                                                       
                                                       
*note Event: 2f4.                                      イベントオブジェクトです。
                                                       
                                                       
*note Condition: c67.                                  条件変数オブジェクトです。
                                                       
                                                       
*note Semaphore: c68.                                  セマフォ (semaphore) です。
                                                       
                                                       
*note BoundedSemaphore: c69.                           有限セマフォ (bounded semaphore) です。
                                                       
                                                       
*note Barrier: 816.                                    バリアーオブジェクト。
                                                       

使用例
......

   * *note asyncio.Event の使用例: 3826. 。

   * *note asyncio.Barrier を使う: 3834.。

   * asyncio の *note 同期プリミティブ: 37bc. についてのドキュメントも参
     照してください。


File: python.info,  Node: 例外<17>,  Prev: 同期,  Up: 高水準の API インデックス

5.19.1.123 例外
...............

*note asyncio.CancelledError: 4d4.                     タスクがキャンセルされた場合に送出されます。
                                                       *note Task.cancel(): 4d3. も参照してください。
                                                       
                                                       
*note asyncio.BrokenBarrierError: 817.                 バリアーが破壊された場合に送出されます。
                                                       *note Barrier.wait(): 3833. も参照してください。
                                                       

使用例
......

   * *note CancelledError
     を処理してキャンセル要求に対応するコードを実行する: 37f6.

   * *note asyncio に特有な例外の完全なリスト: 386f. も参照してください
     。


File: python.info,  Node: 低水準の API インデックス,  Next: asyncio での開発,  Prev: 高水準の API インデックス,  Up: asyncio --- 非同期 I/O

5.19.1.124 低水準の API インデックス
....................................

このページでは低水準の asyncio API を全てリストしています。

* Menu:

* イベントループの取得::
* イベントループのメソッド: イベントループのメソッド<2>.
* トランスポート: トランスポート<2>.
* プロトコル: プロトコル<3>.
* イベントループのポリシー::


File: python.info,  Node: イベントループの取得,  Next: イベントループのメソッド<2>,  Up: 低水準の API インデックス

5.19.1.125 イベントループの取得
...............................

*note asyncio.get_running_loop(): d01.                 実行中のイベントループを取得するために '利用が推奨さ
                                                       れる' 関数です。
                                                       
                                                       
*note asyncio.get_event_loop(): 2f2.                   Get an event loop instance (running or current via
                                                       the current policy).
                                                       
                                                       
*note asyncio.set_event_loop(): 1b55.                  ポリシーに基づいて引数のイベントループを "カレント"
                                                       (current event loop) に設定します。
                                                       
                                                       
*note asyncio.new_event_loop(): 37c6.                  新しいイベントループのインスタンスを生成します。
                                                       

使用例
......

   * *note asyncio.get_running_loop() を使う: 38cb.。


File: python.info,  Node: イベントループのメソッド<2>,  Next: トランスポート<2>,  Prev: イベントループの取得,  Up: 低水準の API インデックス

5.19.1.126 イベントループのメソッド
...................................

See also the main documentation section about the *note
イベントループのメソッド: 3886.

ライフサイクル
..............

*note loop.run_until_complete(): e72.                  Future/Task/awaitable が完了するまで実行します。
                                                       
                                                       
*note loop.run_forever(): 3888.                        イベントループを永久に実行します。
                                                       
                                                       
*note loop.stop(): e77.                                イベントループを停止します。
                                                       
                                                       
*note loop.close(): 388a.                              イベントループをクローズします。
                                                       
                                                       
*note loop.is_running(): 3889.                         イベントループが実行中の場合 ‘True’ を返します。
                                                       
                                                       
*note loop.is_closed(): fc3.                           イベントループがクローズされている場合 ‘True’ を返し
                                                       ます。
                                                       
                                                       
‘await’ *note loop.shutdown_asyncgens(): e79.          非同期ジェネレータをクローズします。
                                                       

デバッグ
........

*note loop.set_debug(): fc1.                           デバッグモードを有効化または無効化します。
                                                       
                                                       
*note loop.get_debug(): fc2.                           現在のデバッグモードを取得します。
                                                       

コールバックのスケジューリング
..............................

*note loop.call_soon(): cfa.                           コールバックを即座に実行します。
                                                       
                                                       
*note loop.call_soon_threadsafe(): cfb.                *note loop.call_soon(): cfa. のスレッドセーフ版です
                                                       。
                                                       
                                                       
*note loop.call_later(): cfc.                          与えられた遅延時間の '経過後' にコールバックを実行し
                                                       ます。
                                                       
                                                       
*note loop.call_at(): cfd.                             '与えられた時刻に' コールバックを実行します。
                                                       

Thread/Interpreter/Process Pool
...............................

‘await’ *note loop.run_in_executor(): ae6.             CPUバウンドなブロッキング関数、またはその他のブロッ
                                                       キング関数を *note concurrent.futures: 24. 実行オブ
                                                       ジェクト (executor) 上で実行します。
                                                       
                                                       
*note loop.set_default_executor(): 94a.                *note loop.run_in_executor(): ae6. のデフォルト実行
                                                       オブジェクト (executor) を設定します。
                                                       

タスクとフューチャー
....................

*note loop.create_future(): e74.                       *note Future: dc6. オブジェクトを生成します。
                                                       
                                                       
*note loop.create_task(): 1ca.                         コルーチンを *note Task: 1c7. としてスケジュールしま
                                                       す。
                                                       
                                                       
*note loop.set_task_factory(): 1c8.                    *note loop.create_task(): 1ca. が *note Tasks: 1c7.
                                                       を生成する際に使われるファクトリを設定します。
                                                       
                                                       
*note loop.get_task_factory(): fc5.                    *note loop.create_task(): 1ca. が *note Tasks: 1c7.
                                                       を生成するファクトリを取得します。
                                                       

DNS
...

‘await’ *note loop.getaddrinfo(): e0e.                 *note socket.getaddrinfo(): 1ac3. の非同期版です。
                                                       
                                                       
‘await’ *note loop.getnameinfo(): e0f.                 *note socket.getnameinfo(): 1a3a. の非同期版です。
                                                       

ネットワークとプロセス間通信 (IPC)
..................................

‘await’ *note loop.create_connection(): 818.           TCP接続を確立します。
                                                       
                                                       
‘await’ *note loop.create_server(): d09.               TCPサーバーを起動します。
                                                       
                                                       
‘await’ *note loop.create_unix_connection(): 37ff.     Unix のソケット接続を確立します。
                                                       
                                                       
‘await’ *note loop.create_unix_server(): 4ca.          Create a Unix socket server.
                                                       
                                                       
‘await’ *note loop.connect_accepted_socket(): 9de.     *note socket: fa1. を ‘(transport, protocol)’ のペア
                                                       でラップします。
                                                       
                                                       
‘await’ *note loop.create_datagram_endpoint(): 93c.    データグラム (UDP) 接続を確立します。
                                                       
                                                       
‘await’ *note loop.sendfile(): 389c.                   確立した接続 (transport) を通じてファイルを送信しま
                                                       す。
                                                       
                                                       
‘await’ *note loop.start_tls(): cff.                   既存の接続を TLS にアップグレードします。
                                                       
                                                       
‘await’ *note loop.connect_read_pipe(): 3846.          パイプの読み出し側を ‘(transport, protocol)’ のペア
                                                       でラップします。
                                                       
                                                       
‘await’ *note loop.connect_write_pipe(): 3847.         パイプの書き込み側を ‘(transport, protocol)’ のペア
                                                       でラップします。
                                                       

ソケット
........

‘await’ *note loop.sock_recv(): e0b.                   *note socket: fa1. からデータを受信します。
                                                       
                                                       
‘await’ *note loop.sock_recv_into(): d00.              *note socket: fa1. からデータを受信し、バッファに送
                                                       信します。
                                                       
                                                       
‘await’ *note loop.sock_recvfrom(): 81b.               Receive a datagram from the *note socket: fa1.
                                                       
                                                       
‘await’ *note loop.sock_recvfrom_into(): 81c.          Receive a datagram from the *note socket: fa1. into
                                                       a buffer.
                                                       
                                                       
‘await’ *note loop.sock_sendall(): e0c.                *note socket: fa1. にデータを送信します。
                                                       
                                                       
‘await’ *note loop.sock_sendto(): 81a.                 Send a datagram via the *note socket: fa1. to the
                                                       given address.
                                                       
                                                       
‘await’ *note loop.sock_connect(): fc8.                *note socket: fa1. を接続します。
                                                       
                                                       
‘await’ *note loop.sock_accept(): e0d.                 *note socket: fa1. の接続を受け入れます。
                                                       
                                                       
‘await’ *note loop.sock_sendfile(): d04.               Send a file over the *note socket: fa1.
                                                       
                                                       
*note loop.add_reader(): 381a.                         ファイル記述子が読み込み可能かどうかの監視を開始しま
                                                       す。
                                                       
                                                       
*note loop.remove_reader(): 389f.                      ファイル記述子が読み込み可能かどうかの監視を停止しま
                                                       す。
                                                       
                                                       
*note loop.add_writer(): 38a0.                         ファイル記述子が書き込み可能かどうかの監視を開始しま
                                                       す。
                                                       
                                                       
*note loop.remove_writer(): 38a1.                      ファイル記述子が書き込み可能かどうかの監視を停止しま
                                                       す。
                                                       

Unix シグナル
.............

*note loop.add_signal_handler(): 38a9.                 *note signal: cb. 用のハンドラーを追加します。
                                                       
                                                       
*note loop.remove_signal_handler(): 38aa.              *note signal: cb. 用のハンドラーを削除します。
                                                       

サブプロセス
............

*note loop.subprocess_exec(): 3843.                    サブプロセスを生成します。
                                                       
                                                       
*note loop.subprocess_shell(): 3844.                   シェルコマンドからサブプロセスを生成します。
                                                       

エラー処理
..........

*note loop.call_exception_handler(): 38ae.             例外ハンドラを呼び出します。
                                                       
                                                       
*note loop.set_exception_handler(): 38ad.              新しい例外ハンドラーを設定します。
                                                       
                                                       
*note loop.get_exception_handler(): e75.               現在の例外ハンドラーを取得します。
                                                       
                                                       
*note loop.default_exception_handler(): 38af.          デフォルトの例外ハンドラー実装です。
                                                       

使用例
......

   * *note Using asyncio.new_event_loop() and loop.run_forever(): 38ba.

   * *note loop.call_later() を使う: 38bc.。

   * ‘loop.create_connection()’ を使って *note an echo-client: 3811. を
     実装する。

   * ‘loop.create_connection()’ を使って *note ソケットに接続する:
     3818.。

   * *note add_reader()
     を使ってファイルデスクリプタの読み込みイベントを監視する: 3819.。

   * *note loop.add_signal_handler() を使う: 38bf.。

   * *note loop.subprocess_exec() を使う: 3858.。


File: python.info,  Node: トランスポート<2>,  Next: プロトコル<3>,  Prev: イベントループのメソッド<2>,  Up: 低水準の API インデックス

5.19.1.127 トランスポート
.........................

全てのトランスポートは以下のメソッドを実装します:

*note transport.close(): 3896.                         トランスポートをクローズします。
                                                       
                                                       
*note transport.is_closing(): e73.                     トランスポートを閉じている最中か閉じていた場合
                                                       ‘True’ を返します。
                                                       
                                                       
*note transport.get_extra_info(): c93.                 トランスポートについての情報をリクエストします。
                                                       
                                                       
*note transport.set_protocol(): 38db.                  トランスポートに新しいプロトコルを設定します。
                                                       
                                                       
*note transport.get_protocol(): 38dc.                  現在のプロトコルを返します。
                                                       

データを受信できるトランスポート (TCP 接続、 Unix 接続、パイプなど) のメ
ソッドです。該当するトランスポートは *note loop.create_connection():
818, *note loop.create_unix_connection(): 37ff, *note
loop.connect_read_pipe(): 3846. などの戻り値です:

読み込みトランスポート
......................

*note transport.is_reading(): d11.                     トランスポートがデータを受信中の場合 ‘True’ を返しま
                                                       す。
                                                       
                                                       
*note transport.pause_reading(): d13.                  データの受信を停止します。
                                                       
                                                       
*note transport.resume_reading(): d12.                 データの受信を再開します。
                                                       

データを送信できるトランスポート (TCP 接続、 Unix 接続、パイプなど) のメ
ソッドです。該当するトランスポートは *note loop.create_connection():
818, *note loop.create_unix_connection(): 37ff, *note
loop.connect_write_pipe(): 3847. などの戻り値です:

トランスポートにデータを書き込みます。
......................................

*note transport.write(): 17ca.                         トランスポートにデータを書き込みます。
                                                       
                                                       
*note transport.writelines(): 17c9.                    トランスポートにバッファの内容を書き込みます。
                                                       
                                                       
*note transport.can_write_eof(): 38df.                 トランスポートが 終端 (EOF) の送信をサポートしている
                                                       場合 *note True: e07. を返します。
                                                       
                                                       
*note transport.write_eof(): 38e0.                     バッファに残っているデータをフラッシュしてから終端
                                                       (EOF) を送信して、トランスポートをクローズします。
                                                       
                                                       
*note transport.abort(): 38b7.                         トランスポートを即座にクローズします。
                                                       
                                                       
*note transport.get_write_buffer_size(): 38e1.         Return the current size of the output buffer.
                                                       
                                                       
*note transport.get_write_buffer_limits(): fc4.        書き込みフロー制御の高水位点と低水位点を取得します。
                                                       
                                                       
*note transport.set_write_buffer_limits(): 38e2.       書き込みフロー制御の高水位点と低水位点を設定します。
                                                       

*note loop.create_datagram_endpoint(): 93c. が返すトランスポート:

データグラムトランスポート
..........................

*note transport.sendto(): 4cb.                         リモートピアにデータを送信します。
                                                       
                                                       
*note transport.abort(): 38e6.                         トランスポートを即座にクローズします。
                                                       

サブプロセスに対するトランスポートの低レベルな抽象化です。 *note
loop.subprocess_exec(): 3843. や *note loop.subprocess_shell(): 3844. の
戻り値です:

サブプロセス化されたトランスポート
..................................

*note transport.get_pid(): 38e8.                       サブプロセスのプロセス ID を返します。
                                                       
                                                       
*note transport.get_pipe_transport(): 38e9.            リクエストされた通信パイプ (標準入力 'stdin', 標準出
                                                       力 'stdout', または標準エラー出力 'stderr') のための
                                                       トランスポートを返します。
                                                       
                                                       
*note transport.get_returncode(): 38ea.                サブプロセスの終了ステータスを返します。
                                                       
                                                       
*note transport.kill(): 38eb.                          サブプロセスを強制終了 (kill) します。
                                                       
                                                       
*note transport.send_signal(): 38ed.                   サブプロセスにシグナルを送信します。
                                                       
                                                       
*note transport.terminate(): 38ec.                     サブプロセスを停止します。
                                                       
                                                       
*note transport.close(): 38ee.                         サブプロセスを強制終了 (kill) し、全てのパイプをクロ
                                                       ーズします。
                                                       


File: python.info,  Node: プロトコル<3>,  Next: イベントループのポリシー,  Prev: トランスポート<2>,  Up: 低水準の API インデックス

5.19.1.128 プロトコル
.....................

プロトコルクラスは以下の 'コールバックメソッド' を実装することができます
:

‘callback’ *note connection_made(): 3894.              コネクションが作成されたときに呼び出されます。
                                                       
                                                       
‘callback’ *note connection_lost(): 38d8.              コネクションが失われた、あるいはクローズされたときに
                                                       呼び出されます。
                                                       
                                                       
‘callback’ *note pause_writing(): 38e3.                トランスポートのバッファーサイズが最高水位点
                                                       (High-Water Mark) を超えたときに呼び出されます。
                                                       
                                                       
‘callback’ *note resume_writing(): 38e4.               トランスポートのバッファーサイズが最低水位点
                                                       (Low-Water Mark) に達したきに呼び出されます。
                                                       

ストリーミングプロトコル (TCP, Unix ソケット, パイプ)
.....................................................

‘callback’ *note data_received(): 1b02.                データを受信したときに呼び出されます。
                                                       
                                                       
‘callback’ *note eof_received(): 38f2.                 終端 (EOF) を受信したときに呼び出されます。
                                                       

バッファリングされたストリーミングプロトコル
............................................

‘callback’ *note get_buffer(): 38f4.                   新しい受信バッファを割り当てるために呼び出します。
                                                       
                                                       
‘callback’ *note buffer_updated(): 38f5.               受信データによりバッファが更新された場合に呼び出され
                                                       ます。
                                                       
                                                       
‘callback’ *note eof_received(): 38f6.                 終端 (EOF) を受信したときに呼び出されます。
                                                       

データグラムプロトコル
......................

‘callback’ *note datagram_received(): 38f8.            データグラムを受信したときに呼び出されます。
                                                       
                                                       
‘callback’ *note error_received(): 38f9.               直前の送信あるいは受信が *note OSError: 2c0. を送出
                                                       したときに呼び出されます。
                                                       

サブプロセスプロトコル
......................

‘callback’ *note pipe_data_received(): 1b50.           子プロセスが標準出力 ('stdout') または標準エラー出力
                                                       ('stderr') のパイプにデータを書き込んだときに呼び出
                                                       されます。
                                                       
                                                       
‘callback’ *note pipe_connection_lost(): 38fb.         子プロセスと通信するパイプのいずれかがクローズされた
                                                       ときに呼び出されます。
                                                       
                                                       
‘callback’ *note process_exited(): 1b4f.               Called when the child process has exited.  It can be
                                                       called before *note pipe_data_received(): 1b50. and
                                                       *note pipe_connection_lost(): 38fb. methods.
                                                       


File: python.info,  Node: イベントループのポリシー,  Prev: プロトコル<3>,  Up: 低水準の API インデックス

5.19.1.129 イベントループのポリシー
...................................

ポリシーは *note asyncio.get_event_loop(): 2f2. などの関数の振る舞いを変
更する低レベルなメカニズムです。詳細は *note
ポリシーについてのセクション: 3880. を参照してください。

ポリシーへのアクセス
....................

*note asyncio.get_event_loop_policy(): 312.            プロセス全体にわたる現在のポリシーを返します。
                                                       
                                                       
*note asyncio.set_event_loop_policy(): 313.            新たなプロセス全体にわたるポリシーを設定します。
                                                       
                                                       
*note AbstractEventLoopPolicy: 30e.                    ポリシーオブジェクトの基底クラスです。
                                                       


File: python.info,  Node: asyncio での開発,  Prev: 低水準の API インデックス,  Up: asyncio --- 非同期 I/O

5.19.1.130 asyncio での開発
...........................

非同期プログラミングは伝統的な "同期的" プログラミングとは異なります。

このページはよくある間違いや落とし穴を列挙し、それらを回避する方法を説明
します。

* Menu:

* デバッグモード::
* 並行処理とマルチスレッド処理::
* ブロッキングコードの実行::
* ログ記録: ログ記録<3>.
* 待ち受け処理を伴わないコルーチンの検出::
* 回収されない例外の検出::


File: python.info,  Node: デバッグモード,  Next: 並行処理とマルチスレッド処理,  Up: asyncio での開発

5.19.1.131 デバッグモード
.........................

asyncio はデフォルトで本運用モードで実行されます。いっぽう、開発を容易に
するために asyncio は "デバッグモード" を持っています。

asyncio のデバッグモードを有効化する方法はいくつかあります:

   * *note PYTHONASYNCIODEBUG: 2139. 環境変数の値を ‘1’ に設定する。

   * *note Python 開発モード: 508. を使う。

   * *note asyncio.run(): 2f3. 実行時に ‘debug=True’ を設定する。

   * *note loop.set_debug(): fc1. を呼び出す。

デバッグモードを有効化することに加え、以下も検討してください:

   * *note asyncio ロガー: 3939. のログレベルを *note logging.DEBUG:
     20de. に設定します。例えばアプリケーションの起動時に以下を実行しま
     す:

          logging.basicConfig(level=logging.DEBUG)

   * *note warnings: 118. モジュールが *note ResourceWarning: 54c. 警告
     を表示するように設定します。やり方のひとつは *note -W: ac6.
     ‘default’ コマンドラインオプションを使うことです。

デバッグモードが有効化されたときの動作:

   * スレッドセーフでない asyncio APIs の多く (*note loop.call_soon():
     cfa. や *note loop.call_at(): cfd. など) は、誤ったスレッドから呼び
     出されたときに例外を送出します。

   * I/O セレクタが I/O 処理を実行する時間が長すぎる場合、その実行時間が
     記録されます。

   * 実行時間が100ミリ秒を超えるコールバックは記録されます。 "遅い" の判
     断基準となる実行時間の最小値は *note loop.slow_callback_duration:
     38b1. 属性で設定できます。


File: python.info,  Node: 並行処理とマルチスレッド処理,  Next: ブロッキングコードの実行,  Prev: デバッグモード,  Up: asyncio での開発

5.19.1.132 並行処理とマルチスレッド処理
.......................................

イベントループはスレッド（典型的にはメインスレッド）内で動作し、すべての
コールバックとタスクをそのスレッド内で実行します。ひとつのタスクがイベン
トループ内で実行される間、他のタスクを同じスレッド内で実行することはでき
ません。タスクが ‘await’ 式を実行すると、実行中のタスクはサスペンドされ
、イベントループは次のタスクを実行します。

別の OS スレッドからのコールバック (*note callback: 2d9c.) をスケジュー
ルする場合、 *note loop.call_soon_threadsafe(): cfb. メソッドを使ってく
ださい。例:

     loop.call_soon_threadsafe(callback, *args)

ほぼ全ての非同期オブジェクトはスレッドセーフではありませんが、タスクやコ
ールバックの外側で非同期オブジェクトを使うコードが存在しない限り、それが
問題にはなることはほとんどありません。もしそのような目的で低レベルの
asyncio API を呼び出すようなコードを書く必要がある場合、 *note
loop.call_soon_threadsafe(): cfb. メソッドを使ってください。例:

     loop.call_soon_threadsafe(fut.cancel)

別の OS スレッドからコルーチンオブジェクトをスケジュールする場合は、
*note run_coroutine_threadsafe(): a82. メソッドを使ってください。 *note
run_coroutine_threadsafe(): a82. は結果にアクセスするための *note
concurrent.futures.Future: 13ca. オブジェクトを返します:

     async def coro_func():
          return await asyncio.sleep(1, 42)

     # Later in another OS thread:

     future = asyncio.run_coroutine_threadsafe(coro_func(), loop)
     # Wait for the result:
     result = future.result()

シグナルの処理を行うには、イベントループはメインスレッド内で実行しなけれ
ばなりません。

The *note loop.run_in_executor(): ae6. method can be used with a *note
concurrent.futures.ThreadPoolExecutor: 949. or *note
InterpreterPoolExecutor: 1d2. to execute blocking code in a different OS
thread without blocking the OS thread that the event loop runs in.

現在のところ、 (たとえば *note multiprocessing: 98. で開始したような) 別
のプロセスからコルーチンやコールバックを直接スケジュールすることはできま
せん。 *note イベントループのメソッド: 3886. 節では、イベントループをブ
ロックすることなくパイプからの読み込みやファイルデスクリプタの監視ができ
る API のリストを掲載しています。さらに、 asyncio の *note サブプロセス:
37ba. API はイベントループからプロセスを開始したりプロセスと通信したりす
る方法を提供します。 最後に、前述の *note loop.run_in_executor(): ae6. メ
ソッドは *note concurrent.futures.ProcessPoolExecutor: 1d6. とともに使用
することで、別のプロセス内でコードを実行することもできます。


File: python.info,  Node: ブロッキングコードの実行,  Next: ログ記録<3>,  Prev: 並行処理とマルチスレッド処理,  Up: asyncio での開発

5.19.1.133 ブロッキングコードの実行
...................................

ブロッキングコード (CPU バウンドなコード) を直接呼び出すべきではありませ
ん。たとえば、 CPU 負荷の高い関数を1秒実行したとすると、並行に処理されて
いる全ての非同期タスクと I/O 処理は1秒遅れる可能性があります。

An executor can be used to run a task in a different thread, including
in a different interpreter, or even in a different process to avoid
blocking the OS thread with the event loop.  See the *note
loop.run_in_executor(): ae6. method for more details.


File: python.info,  Node: ログ記録<3>,  Next: 待ち受け処理を伴わないコルーチンの検出,  Prev: ブロッキングコードの実行,  Up: asyncio での開発

5.19.1.134 ログ記録
...................

asyncio は *note logging: 8b. モジュールを利用し、 全てのログ記録は
‘"asyncio"’ ロガーを通じて行われます。

デフォルトのログレベルは *note logging.INFO: 20df. ですが、これは簡単に
調節できます:

     logging.getLogger("asyncio").setLevel(logging.WARNING)

ネットワークログ記録は、イベントループをブロックし得ます。ログ処理のスレ
ッドを分離するか、ノンブロッキング IO を使用することを推奨します。例えば
、 *note ブロックする handler を扱う: 393e. を見てください。


File: python.info,  Node: 待ち受け処理を伴わないコルーチンの検出,  Next: 回収されない例外の検出,  Prev: ログ記録<3>,  Up: asyncio での開発

5.19.1.135 待ち受け処理を伴わないコルーチンの検出
.................................................

コルーチンが呼び出されただけで、待ち受け処理がない場合 (たとえば ‘await
coro()’ のかわりに ‘coro()’ と書いてしまった場合) 、またはコルーチンが
*note asyncio.create_task(): 1c9. を使わずにスケジュールされた場合、
asyncio は *note RuntimeWarning: 4d7. 警告を送出します:

     import asyncio

     async def test():
         print("never scheduled")

     async def main():
         test()

     asyncio.run(main())

出力:

     test.py:7: RuntimeWarning: coroutine 'test' was never awaited
       test()

デバッグモードの出力:

     test.py:7: RuntimeWarning: coroutine 'test' was never awaited
     Coroutine created at (most recent call last)
       File "../t.py", line 9, in <module>
         asyncio.run(main(), debug=True)

       < .. >

       File "../t.py", line 7, in main
         test()
       test()

通常の修正方法はコルーチンを待ち受ける (await) か、 *note
asyncio.create_task(): 1c9. 関数を呼び出すことです:

     async def main():
         await test()


File: python.info,  Node: 回収されない例外の検出,  Prev: 待ち受け処理を伴わないコルーチンの検出,  Up: asyncio での開発

5.19.1.136 回収されない例外の検出
.................................

もし *note Future.set_exception(): e78. メソッドが呼び出されても、その
Future オブジェクトを待ち受けていなければ、例外は決してユーザーコードま
で伝播しません。この場合 asyncio は、 Future オブジェクトがガベージコレ
クションの対象となったときにログメッセージを送出することがあります。

処理されない例外の例:

     import asyncio

     async def bug():
         raise Exception("not consumed")

     async def main():
         asyncio.create_task(bug())

     asyncio.run(main())

出力:

     Task exception was never retrieved
     future: <Task finished coro=<bug() done, defined at test.py:3>
       exception=Exception('not consumed')>

     Traceback (most recent call last):
       File "test.py", line 4, in bug
         raise Exception("not consumed")
     Exception: not consumed

タスクが生成された箇所を特定するには、 *note デバッグモードを有効化して:
213a. トレースバックを取得してください:

     asyncio.run(main(), debug=True)

デバッグモードの出力:

     Task exception was never retrieved
     future: <Task finished coro=<bug() done, defined at test.py:3>
         exception=Exception('not consumed') created at asyncio/tasks.py:321>

     source_traceback: Object created at (most recent call last):
       File "../t.py", line 9, in <module>
         asyncio.run(main(), debug=True)

     < .. >

     Traceback (most recent call last):
       File "../t.py", line 4, in bug
         raise Exception("not consumed")
     Exception: not consumed

     注釈: asyncio のソースコードは Lib/asyncio/(1) にあります。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/asyncio/


File: python.info,  Node: socket --- 低水準ネットワークインターフェース,  Next: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー,  Prev: asyncio --- 非同期 I/O,  Up: ネットワーク通信とプロセス間通信

5.19.2 ‘socket’ -- 低水準ネットワークインターフェース
-----------------------------------------------------

'ソースコード:' Lib/socket.py(1)

__________________________________________________________________

このモジュールはBSDの 'ソケット(socket)' インターフェイスへのアクセスを
提供します。これは、近代的なUnixシステム、Windows、MacOS、その他多くのプ
ラットフォームで動作します。

     注釈: いくつかの挙動はプラットフォームに依存します。オペレーティン
     グシステムのソケットAPIを呼び出しているためです。

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

Pythonインターフェースは、Unixのソケット用システムコールとライブラリイン
ターフェースを、そのままPythonのオブジェクト指向スタイルに変換したもので
す。各種ソケット関連のシステムコールは、 *note socket(): fa1. 関数で生成
される 'socket オブジェクト' のメソッドとして実装されています。 メソッド
の引数は C のインターフェイスよりも多少高水準で、例えばファイルに対する
‘read()’ や ‘write()’ メソッドと同様に、 受信時のバッファ確保は自動的に
処理され、送信時のバッファ長は暗黙的に決まります。

参考
....

Module *note socketserver: d2.

     ネットワークサーバの開発を省力化するためのクラス群。

Module *note ssl: d5.

     ソケットオブジェクトに対する TLS/SSL ラッパー.

* Menu:

* ソケットファミリー::
* モジュールの内容::
* socket オブジェクト::
* ソケットタイムアウトの注意事項::
* 使用例: 使用例<27>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/socket.py


File: python.info,  Node: ソケットファミリー,  Next: モジュールの内容,  Up: socket --- 低水準ネットワークインターフェース

5.19.2.1 ソケットファミリー
...........................

どのシステムで実行するかとビルドオプションに依存しますが、このモジュール
によって多様なソケットファミリーをサポートします。

特定のソケットオブジェクトによって必要とされるアドレスフォーマットは、ソ
ケットオブジェクトが生成されたときに指定されたアドレスファミリーを元に自
動的に選択されます。ソケットアドレスは次の通りです。

   - ファイルシステム上のノードに束縛された *note AF_UNIX: 1bb0. ソケッ
     トのアドレスは、ファイルシステムエンコーディングと
     ‘'surrogateescape'’ エラーハンドラ ( PEP 383(1) を参照) を使って文
     字列として表現されます。 Linux の抽象名前空間のアドレスは、先頭が
     null バイトとなる *note bytes-like object: 193. として返されます。
     この名前空間のソケットは通常のファイルシステム上のソケットと通信で
     きるので、 Linux 上で動作することを意図したプログラムは両方のアドレ
     スを扱う必要がある可能性があります。文字列と bytes-like オブジェク
     トはどちらのタイプのアドレスにも引数として渡すことができます。

     バージョン 3.3 で変更: これまでは *note AF_UNIX: 1bb0. ソケットパス
     は UTF-8 エンコーディングを使用するものとされていました。

     バージョン 3.5 で変更: 書き込み可能な *note bytes-like object: 193.
     を使用できるようになりました。

   - *note AF_INET: 1bad. アドレスファミリーには、 ‘(host, port)’ ペアが
     アドレスとして利用されます。 'host' はホスト名か ‘'daring.cwi.nl'’
     のようなインターネットドメインか、 ‘'100.50.200.5'’ のような IPv4 ア
     ドレスで、 'port' は整数です。

        - IPv4ではホストアドレスのほかに2つの特別な形式が使用できます。
          ‘''’ はすべてのインターフェイスにバインドされるために使われる
          ‘INADDR_ANY’ を表し、‘'<broadcast>'’ は ‘INADDR_BROADCAST’ を
          表します。これらの動作はIPv6と互換性がありません。そのためもし
          もあなたがPythonプログラムでIPv6をサポートする予定があるのなら
          ばこれらを避けたほうが良いでしょう。

   - For *note AF_INET6: 1bae. address family, a four-tuple ‘(host,
     port, flowinfo, scope_id)’ is used, where 'flowinfo' and 'scope_id'
     represent the ‘sin6_flowinfo’ and ‘sin6_scope_id’ members in
     ‘struct sockaddr_in6’ in C. For ‘socket’ module methods, 'flowinfo'
     and 'scope_id' can be omitted just for backward compatibility.
     Note, however, omission of 'scope_id' can cause problems in
     manipulating scoped IPv6 addresses.

     バージョン 3.7 で変更: For multicast addresses (with 'scope_id'
     meaningful) 'address' may not contain ‘%scope_id’ (or ‘zone id’)
     part.  This information is superfluous and may be safely omitted
     (recommended).

   - ‘AF_NETLINK’ ソケットのアドレスは ‘(pid, groups)’ のペアで表されま
     す。

   - Linux 限定で、 ‘AF_TIPC’ アドレスファミリーを用いて TIPC がサポート
     されます。 TIPC は、クラスタコンピューティング環境のために設計され
     た、IP ベースではないオープンなネットワークプロトコルです。アドレス
     はタプルで表現され、フィールドはアドレスタイプに依存します。一般的
     なタプルの形式は ‘(addr_type, v1, v2, v3 [, scope])’ で、それぞれは
     次の通りです:

        - 'addr_type' は ‘TIPC_ADDR_NAMESEQ’, ‘TIPC_ADDR_NAME’,
          ‘TIPC_ADDR_ID’ の1つ。

        - 'scope' は ‘TIPC_ZONE_SCOPE’, ‘TIPC_CLUSTER_SCOPE’,
          ‘TIPC_NODE_SCOPE’ の1つ。

        - 'addr_type' が ‘TIPC_ADDR_NAME’ の場合、 'v1' はサーバータイプ
          、 'v2' はポートID (the port identifier)、そして 'v3' は 0 で
          あるべきです。

          'addr_type' が ‘TIPC_ADDR_NAMESEQ’ の場合、 'v1' はサーバータ
          イプ、 'v2' はポート番号下位(lower port number)、 'v3' はポー
          ト番号上位(upper port number) です。

          'addr_type' が ‘TIPC_ADDR_ID’ の場合、 'v1' はノード、 'v2' は
          参照、 'v3' は0であるべきです。

   - *note AF_CAN: 3947. アドレスファミリーには ‘(interface, )’ というタ
     プルを利用します。 'interface' は ‘'can0'’ のようなネットワークイン
     ターフェース名を表す文字列です。このファミリーの全てのネットワーク
     インターフェースからパケットを受信するために、ネットワークインター
     フェース名 ‘''’ を利用できます。

        - *note CAN_ISOTP: 3948. protocol requires a tuple ‘(interface,
          rx_addr, tx_addr)’ where both additional parameters are
          unsigned long integer that represent a CAN identifier
          (standard or extended).

        - *note CAN_J1939: b2c. protocol requires a tuple ‘(interface,
          name, pgn, addr)’ where additional parameters are 64-bit
          unsigned integer representing the ECU name, a 32-bit unsigned
          integer representing the Parameter Group Number (PGN), and an
          8-bit integer representing the address.

   - 文字列またはタプル ‘(id, unit)’ は ‘PF_SYSTEM’ ファミリーの
     ‘SYSPROTO_CONTROL’ プロトコルのために使用されます。この文字列は、動
     的に割り当てられたIDによるカーネルコントロールの名前です。このタプ
     ルは、カーネルコントロールのIDとユニット番号が既知の場合、または登
     録済みIDが使用中の場合に使用することができます。

     Added in version 3.3.

   - *note AF_BLUETOOTH: 1baf. は以下のプロトコルとアドレスフォーマット
     をサポートしています。

        - *note BTPROTO_L2CAP: 283. accepts a tuple ‘(bdaddr, psm[,
          cid[, bdaddr_type]])’ where:

             - ‘bdaddr’ is a string specifying the Bluetooth address.

             - ‘psm’ is an integer specifying the Protocol/Service
               Multiplexer.

             - ‘cid’ is an optional integer specifying the Channel
               Identifier.  If not given, defaults to zero.

             - ‘bdaddr_type’ is an optional integer specifying the
               address type; one of *note BDADDR_BREDR: 3949. (default),
               *note BDADDR_LE_PUBLIC: 394a, *note BDADDR_LE_RANDOM:
               394b.

          バージョン 3.14 で変更: Added ‘cid’ and ‘bdaddr_type’ fields.

        - *note BTPROTO_RFCOMM: 394c. は ‘(bdaddr, channel)’ を受け取り
          ます。 ‘bdaddr’ は Bluetooth アドレスを表す文字列で、
          ‘channel’ は整数です。

        - *note BTPROTO_HCI: 281. accepts a format that depends on your
          OS.

             - On Linux it accepts an integer ‘device_id’ or a tuple
               ‘(device_id, [channel])’ where ‘device_id’ specifies the
               number of the Bluetooth device, and ‘channel’ is an
               optional integer specifying the HCI channel (*note
               HCI_CHANNEL_RAW: 394d. by default).

             - On FreeBSD, NetBSD and DragonFly BSD it accepts ‘bdaddr’
               where ‘bdaddr’ is the Bluetooth address as a string.

          バージョン 3.2 で変更: NetBSD と DragonFlyBSD のサポートが追加
          されました。

          バージョン 3.13.3 で変更: FreeBSD support added.

          バージョン 3.14 で変更: Added ‘channel’ field.  ‘device_id’
          not packed in a tuple is now accepted.

        - *note BTPROTO_SCO: 282. accepts ‘bdaddr’ where ‘bdaddr’ is the
          Bluetooth address as a string or a *note bytes: 192. object.
          (ex.  ‘'12:23:34:45:56:67'’ or ‘b'12:23:34:45:56:67'’)

          バージョン 3.14 で変更: FreeBSD support added.

   - *note AF_ALG: ed2. はカーネル暗号へのソケットベースのインターフェイ
     スで、Linux でのみ使用できます。アルゴリズムソケットは、2 つから 4
     つの要素を持つタプル ‘(type, name [, feat [, mask]])’ で構成されま
     す。各要素の意味は、以下の通りです。

        - 'type' はアルゴリズムタイプを示す文字列です。例: ‘aead’,
          ‘hash’, ‘skcipher’ または ‘rng’。

        - 'name' はアルゴリズム名及び操作モードを示す文字列です。例:
          ‘sha256’, ‘hmac(sha256)’, ‘cbc(aes)’ または
          ‘drbg_nopr_ctr_aes256’。

        - 'feat' と 'mask' は、符号を持たない 32 ビットの整数です。

     *note Availability: 213f.: Linux >= 2.6.38.

     一部のアルゴリズムタイプでは、さらに新しいカーネルが必要です。

     Added in version 3.6.

   - *note AF_VSOCK: d6d. allows communication between virtual machines
     and their hosts.  The sockets are represented as a ‘(CID, port)’
     tuple where the context ID or CID and port are integers.

     *note Availability: 213f.: Linux >= 3.9

     See ‘vsock(7)(2)’

     Added in version 3.7.

   - *note AF_PACKET: 394e. is a low-level interface directly to network
     devices.  The addresses are represented by the tuple ‘(ifname,
     proto[, pkttype[, hatype[, addr]]])’ where:

        - 'ifname' - デバイス名を指定する文字列。

        - 'proto' - The Ethernet protocol number.  May be *note
          ETH_P_ALL: 1b23. to capture all protocols, one of the *note
          ETHERTYPE_* constants: 1b24. or any other Ethernet protocol
          number.

        - 'pkttype' - パケットタイプを指定するオプションの整数:

             - ‘PACKET_HOST’ (the default) - Packet addressed to the
               local host.

             - ‘PACKET_BROADCAST’ - Physical-layer broadcast packet.

             - ‘PACKET_MULTICAST’ - Packet sent to a physical-layer
               multicast address.

             - ‘PACKET_OTHERHOST’ - Packet to some other host that has
               been caught by a device driver in promiscuous mode.

             - ‘PACKET_OUTGOING’ - Packet originating from the local
               host that is looped back to a packet socket.

        - 'hatype' - Optional integer specifying the ARP hardware
          address type.

        - 'addr' - Optional bytes-like object specifying the hardware
          physical address, whose interpretation depends on the device.

     *note Availability: 213f.: Linux >= 2.2.

   - *note AF_QIPCRTR: 394f. is a Linux-only socket based interface for
     communicating with services running on co-processors in Qualcomm
     platforms.  The address family is represented as a ‘(node, port)’
     tuple where the 'node' and 'port' are non-negative integers.

     *note Availability: 213f.: Linux >= 4.7.

     Added in version 3.8.

   - ‘IPPROTO_UDPLITE’ is a variant of UDP which allows you to specify
     what portion of a packet is covered with the checksum.  It adds two
     socket options that you can change.
     ‘self.setsockopt(IPPROTO_UDPLITE, UDPLITE_SEND_CSCOV, length)’ will
     change what portion of outgoing packets are covered by the checksum
     and ‘self.setsockopt(IPPROTO_UDPLITE, UDPLITE_RECV_CSCOV, length)’
     will filter out packets which cover too little of their data.  In
     both cases ‘length’ should be in ‘range(8, 2**16, 8)’.

     Such a socket should be constructed with ‘socket(AF_INET,
     SOCK_DGRAM, IPPROTO_UDPLITE)’ for IPv4 or ‘socket(AF_INET6,
     SOCK_DGRAM, IPPROTO_UDPLITE)’ for IPv6.

     *note Availability: 213f.: Linux >= 2.6.20, FreeBSD >= 10.1

     Added in version 3.9.

   - *note AF_HYPERV: 3950. is a Windows-only socket based interface for
     communicating with Hyper-V hosts and guests.  The address family is
     represented as a ‘(vm_id, service_id)’ tuple where the ‘vm_id’ and
     ‘service_id’ are UUID strings.

     The ‘vm_id’ is the virtual machine identifier or a set of known
     VMID values if the target is not a specific virtual machine.  Known
     VMID constants defined on ‘socket’ are:

        - ‘HV_GUID_ZERO’

        - ‘HV_GUID_BROADCAST’

        - ‘HV_GUID_WILDCARD’ - Used to bind on itself and accept
          connections from all partitions.

        - ‘HV_GUID_CHILDREN’ - Used to bind on itself and accept
          connection from child partitions.

        - ‘HV_GUID_LOOPBACK’ - Used as a target to itself.

        - ‘HV_GUID_PARENT’ - When used as a bind accepts connection from
          the parent partition.  When used as an address target it will
          connect to the parent partition.

     The ‘service_id’ is the service identifier of the registered
     service.

     Added in version 3.12.

IPv4/v6ソケットの 'host' 部にホスト名を指定すると、処理結果が一定ではな
い場合があります。これはPythonはDNSから取得したアドレスのうち最初のアド
レスを使用するので、 DNSの処理やホストの設定によって異なるIPv4/6アドレス
を取得する場合があるためです。常に同じ結果が必要であれば、 'host' に数値
のアドレスを指定してください。

エラー時には例外が発生します。引数型のエラーやメモリ不足の場合には通常の
例外が発生し、ソケットやアドレス関連のエラーの場合は *note OSError: 2c0.
またはそのサブクラスが発生します。

*note setblocking(): 303c. メソッドで、非ブロッキングモードを使用するこ
とができます。また、より汎用的に *note settimeout(): 3951. メソッドでタ
イムアウトを指定する事ができます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0383/

   (2) https://manpages.debian.org/vsock(7)


File: python.info,  Node: モジュールの内容,  Next: socket オブジェクト,  Prev: ソケットファミリー,  Up: socket --- 低水準ネットワークインターフェース

5.19.2.2 モジュールの内容
.........................

The module ‘socket’ exports the following elements.

* Menu:

* 例外: 例外<18>.
* 定数: 定数<8>.
* 関数: 関数<8>.


File: python.info,  Node: 例外<18>,  Next: 定数<8>,  Up: モジュールの内容

5.19.2.3 例外
.............

 -- 例外: socket.error

     *note OSError: 2c0. の非推奨のエイリアスです。

     バージョン 3.3 で変更: PEP 3151(1) に基づき、このクラスは *note
     OSError: 2c0. のエイリアスになりました。

 -- 例外: socket.herror

     *note OSError: 2c0. のサブクラス。この例外はアドレス関連のエラー、
     つまり *note gethostbyname_ex(): 1c85. と *note gethostbyaddr():
     1c84. などの、 POSIX C API の 'h_errno' を利用する関数のために利用
     されます。例外に付随する ‘(h_errno, string)’ ペアはライブラリの呼び
     出しによって返されたエラーを表します。 'h_errno' は数値で、
     'string' は、 ‘hstrerror()’ C関数によって返される 'h_errno' を説明
     する文字列です。

     バージョン 3.3 で変更: このクラスは *note OSError: 2c0. のサブクラ
     スになりました。

 -- 例外: socket.gaierror

     A subclass of *note OSError: 2c0, this exception is raised for
     address-related errors by *note getaddrinfo(): 1ac3. and *note
     getnameinfo(): 1a3a.  The accompanying value is a pair ‘(error,
     string)’ representing an error returned by a library call.
     'string' represents the description of 'error', as returned by the
     ‘gai_strerror()’ C function.  The numeric 'error' value will match
     one of the ‘EAI_*’ constants defined in this module.

     バージョン 3.3 で変更: このクラスは *note OSError: 2c0. のサブクラ
     スになりました。

 -- 例外: socket.timeout

     *note TimeoutError: a36. の非推奨のエイリアスです。

     *note OSError: 2c0. のサブクラスです。この例外は、あらかじめ *note
     settimeout(): 3951. を呼び出して (あるいは *note
     setdefaulttimeout(): 3955. を利用して暗黙に) タイムアウトを有効にし
     てあるソケットでタイムアウトが生じた際に送出されます。 例外に付属す
     る値は文字列で、その内容は現状では常に "timed out" となります。

     バージョン 3.3 で変更: このクラスは *note OSError: 2c0. のサブクラ
     スになりました。

     バージョン 3.10 で変更: このクラスは *note TimeoutError: a36. のエ
     イリアスになりました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3151/


File: python.info,  Node: 定数<8>,  Next: 関数<8>,  Prev: 例外<18>,  Up: モジュールの内容

5.19.2.4 定数
.............

AF_* 定数と SOCK_* 定数は、 ‘AddressFamily’ と ‘SocketKind’ *note
IntEnum: edb. collection になりました。

Added in version 3.4.

 -- データ: socket.AF_UNIX
 -- データ: socket.AF_INET
 -- データ: socket.AF_INET6

     These constants represent the address (and protocol) families, used
     for the first argument to *note socket(): fa1.  If the *note
     AF_UNIX: 1bb0. constant is not defined then this protocol is
     unsupported.  More constants may be available depending on the
     system.

 -- データ: socket.AF_UNSPEC

     *note AF_UNSPEC: 389a. means that *note getaddrinfo(): 1ac3. should
     return socket addresses for any address family (either IPv4, IPv6,
     or any other) that can be used.

 -- データ: socket.SOCK_STREAM
 -- データ: socket.SOCK_DGRAM
 -- データ: socket.SOCK_RAW
 -- データ: socket.SOCK_RDM
 -- データ: socket.SOCK_SEQPACKET

     These constants represent the socket types, used for the second
     argument to *note socket(): fa1.  More constants may be available
     depending on the system.  (Only *note SOCK_STREAM: 150b. and *note
     SOCK_DGRAM: 150a. appear to be generally useful.)

 -- データ: socket.SOCK_CLOEXEC
 -- データ: socket.SOCK_NONBLOCK

     この2つの定数が定義されていた場合、ソケットタイプと組み合わせていく
     つかの flags をアトミックに設定することができます (別の呼び出しを不
     要にして競合状態を避ける事ができます)。

     参考
     ....

     より完全な説明は Secure File Descriptor Handling(1) を参照してくだ
     さい。

     *note Availability: 213f.: Linux >= 2.6.27.

     Added in version 3.2.

 -- データ: SO_*
 -- データ: socket.SOMAXCONN

 -- データ: MSG_*

 -- データ: SOL_*

 -- データ: SCM_*

 -- データ: IPPROTO_*

 -- データ: IPPORT_*

 -- データ: INADDR_*

 -- データ: IP_*

 -- データ: IPV6_*

 -- データ: EAI_*

 -- データ: AI_*

 -- データ: NI_*

 -- データ: TCP_*

     Many constants of these forms, documented in the Unix documentation
     on sockets and/or the IP protocol, are also defined in the socket
     module.  They are generally used in arguments to the *note
     setsockopt(): ed1. and *note getsockopt(): ed0. methods of socket
     objects.  In most cases, only those symbols that are defined in the
     Unix header files are defined; for a few symbols, default values
     are provided.

     バージョン 3.6 で変更: ‘SO_DOMAIN’, ‘SO_PROTOCOL’, ‘SO_PEERSEC’,
     ‘SO_PASSSEC’, ‘TCP_USER_TIMEOUT’, ‘TCP_CONGESTION’ が追加されました
     。

     バージョン 3.6.5 で変更: Added support for ‘TCP_FASTOPEN’,
     ‘TCP_KEEPCNT’ on Windows platforms when available.

     バージョン 3.7 で変更: ‘TCP_NOTSENT_LOWAT’ が追加されました。

     Added support for ‘TCP_KEEPIDLE’, ‘TCP_KEEPINTVL’ on Windows
     platforms when available.

     バージョン 3.10 で変更: ‘IP_RECVTOS’ was added.  Added
     ‘TCP_KEEPALIVE’.  On MacOS this constant can be used in the same
     way that ‘TCP_KEEPIDLE’ is used on Linux.

     バージョン 3.11 で変更: Added ‘TCP_CONNECTION_INFO’.  On MacOS this
     constant can be used in the same way that ‘TCP_INFO’ is used on
     Linux and BSD.

     バージョン 3.12 で変更: Added ‘SO_RTABLE’ and ‘SO_USER_COOKIE’.  On
     OpenBSD and FreeBSD respectively those constants can be used in the
     same way that ‘SO_MARK’ is used on Linux.  Also added missing TCP
     socket options from Linux: ‘TCP_MD5SIG’,
     ‘TCP_THIN_LINEAR_TIMEOUTS’, ‘TCP_THIN_DUPACK’, ‘TCP_REPAIR’,
     ‘TCP_REPAIR_QUEUE’, ‘TCP_QUEUE_SEQ’, ‘TCP_REPAIR_OPTIONS’,
     ‘TCP_TIMESTAMP’, ‘TCP_CC_INFO’, ‘TCP_SAVE_SYN’, ‘TCP_SAVED_SYN’,
     ‘TCP_REPAIR_WINDOW’, ‘TCP_FASTOPEN_CONNECT’, ‘TCP_ULP’,
     ‘TCP_MD5SIG_EXT’, ‘TCP_FASTOPEN_KEY’, ‘TCP_FASTOPEN_NO_COOKIE’,
     ‘TCP_ZEROCOPY_RECEIVE’, ‘TCP_INQ’, ‘TCP_TX_DELAY’.  Added
     ‘IP_PKTINFO’, ‘IP_UNBLOCK_SOURCE’, ‘IP_BLOCK_SOURCE’,
     ‘IP_ADD_SOURCE_MEMBERSHIP’, ‘IP_DROP_SOURCE_MEMBERSHIP’.

     バージョン 3.13 で変更: Added ‘SO_BINDTOIFINDEX’.  On Linux this
     constant can be used in the same way that ‘SO_BINDTODEVICE’ is
     used, but with the index of a network interface instead of its
     name.

     バージョン 3.14 で変更: Added missing ‘IP_FREEBIND’, ‘IP_RECVERR’,
     ‘IPV6_RECVERR’, ‘IP_RECVTTL’, and ‘IP_RECVORIGDSTADDR’ on Linux.

     バージョン 3.14 で変更: Added support for ‘TCP_QUICKACK’ on Windows
     platforms when available.

 -- データ: socket.AF_CAN
 -- データ: socket.PF_CAN

 -- データ: SOL_CAN_*

 -- データ: CAN_*

     Linux ドキュメントにあるこの形式の定数は socket モジュールでも定義
     されています。

     *note Availability: 213f.: Linux >= 2.6.25, NetBSD >= 8.

     Added in version 3.3.

     バージョン 3.11 で変更: NetBSD サポートが追加されました。

     バージョン 3.14 で変更: Restored missing ‘CAN_RAW_ERR_FILTER’ on
     Linux.

 -- データ: socket.CAN_BCM

 -- データ: CAN_BCM_*

     CANプロトコルファミリーのCAN_BCMは、ブロードキャストマネージャー
     (BCM)プロトコルです。Linuxドキュメントにあるこの形式の定数は、
     socketモジュールでも定義されています。

     *note Availability: 213f.: Linux >= 2.6.25.

          注釈: The ‘CAN_BCM_CAN_FD_FRAME’ flag is only available on
          Linux >= 4.8.

     Added in version 3.4.

 -- データ: socket.CAN_RAW_FD_FRAMES

     CAN_RAW ソケットで CAN FD をサポートします。これはデフォルトで無効
     になっています。これにより、アプリケーションが CAN フレームと CAN
     FD フレームを送信できるようになります。ただし、ソケットからの読み出
     し時に、CAN と CAN FD の両方のフレームを受け入れなければなりません
     。

     この定数は、 Linux のドキュメンテーションで説明されています。

     *note Availability: 213f.: Linux >= 3.6.

     Added in version 3.5.

 -- データ: socket.CAN_RAW_JOIN_FILTERS

     Joins the applied CAN filters such that only CAN frames that match
     all given CAN filters are passed to user space.

     この定数は、 Linux のドキュメンテーションで説明されています。

     *note Availability: 213f.: Linux >= 4.1.

     Added in version 3.9.

 -- データ: socket.CAN_ISOTP

     CAN_ISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2)
     protocol.  ISO-TP constants, documented in the Linux documentation.

     *note Availability: 213f.: Linux >= 2.6.25.

     Added in version 3.7.

 -- データ: socket.CAN_J1939

     CAN_J1939, in the CAN protocol family, is the SAE J1939 protocol.
     J1939 constants, documented in the Linux documentation.

     *note Availability: 213f.: Linux >= 5.4.

     Added in version 3.9.

 -- データ: socket.AF_DIVERT
 -- データ: socket.PF_DIVERT

     These two constants, documented in the FreeBSD divert(4) manual
     page, are also defined in the socket module.

     *note Availability: 213f.: FreeBSD >= 14.0.

     Added in version 3.12.

 -- データ: socket.AF_PACKET
 -- データ: socket.PF_PACKET

 -- データ: PACKET_*

     Linux ドキュメントにあるこの形式の定数は socket モジュールでも定義
     されています。

     *note Availability: 213f.: Linux >= 2.2.

 -- データ: socket.ETH_P_ALL

     ‘ETH_P_ALL’ can be used in the *note socket: fa1. constructor as
     'proto' for the *note AF_PACKET: 394e. family in order to capture
     every packet, regardless of protocol.

     For more information, see the ‘packet(7)(2)’ manpage.

     *note Availability: 213f.: Linux.

     Added in version 3.12.

 -- データ: socket.AF_RDS
 -- データ: socket.PF_RDS
 -- データ: socket.SOL_RDS

 -- データ: RDS_*

     Linux ドキュメントにあるこの形式の定数は socket モジュールでも定義
     されています。

     *note Availability: 213f.: Linux >= 2.6.30.

     Added in version 3.3.

 -- データ: socket.SIO_RCVALL
 -- データ: socket.SIO_KEEPALIVE_VALS
 -- データ: socket.SIO_LOOPBACK_FAST_PATH

 -- データ: RCVALL_*

     Windows の WSAIoctl() のための定数です。この定数はソケットオブジェ
     クトの *note ioctl(): ece. メソッドに引数として渡されます。

     バージョン 3.6 で変更: ‘SIO_LOOPBACK_FAST_PATH’ が追加されました。

 -- データ: TIPC_*

     TIPC 関連の定数で、C のソケットAPIが公開しているものにマッチします
     。詳しい情報は TIPC のドキュメントを参照してください。

 -- データ: socket.AF_ALG
 -- データ: socket.SOL_ALG

 -- データ: ALG_*

     Linux カーネル暗号用の定数です。

     *note Availability: 213f.: Linux >= 2.6.38.

     Added in version 3.6.

 -- データ: socket.AF_VSOCK
 -- データ: socket.IOCTL_VM_SOCKETS_GET_LOCAL_CID

 -- データ: VMADDR*

 -- データ: SO_VM*

     Constants for Linux host/guest communication.

     *note Availability: 213f.: Linux >= 4.8.

     Added in version 3.7.

 -- データ: socket.AF_LINK

     *note Availability: 213f.: BSD, macOS.

     Added in version 3.4.

 -- データ: socket.has_ipv6

     現在のプラットフォームでIPv6がサポートされているか否かを示す真偽値
     。

 -- データ: socket.AF_BLUETOOTH
 -- データ: socket.BTPROTO_L2CAP
 -- データ: socket.BTPROTO_RFCOMM
 -- データ: socket.BTPROTO_HCI
 -- データ: socket.BTPROTO_SCO

     Integer constants for use with Bluetooth addresses.

 -- データ: socket.BDADDR_ANY
 -- データ: socket.BDADDR_LOCAL

     これらは、特別な意味を持つ Bluetooth アドレスを含む文字列定数です。
     例えば、*note BDADDR_ANY: 3966. を使用すると、 *note
     BTPROTO_RFCOMM: 394c. で束縛ソケットを指定する際に、任意のアドレス
     を指し示すことができます。

 -- データ: socket.BDADDR_BREDR
 -- データ: socket.BDADDR_LE_PUBLIC
 -- データ: socket.BDADDR_LE_RANDOM

     These constants describe the Bluetooth address type when binding or
     connecting a *note BTPROTO_L2CAP: 283. socket.

     *note Availability: 213f.: Linux, FreeBSD

     Added in version 3.14.

 -- データ: socket.SOL_RFCOMM
 -- データ: socket.SOL_L2CAP
 -- データ: socket.SOL_HCI
 -- データ: socket.SOL_SCO
 -- データ: socket.SOL_BLUETOOTH

     Used in the level argument to the *note setsockopt(): ed1. and
     *note getsockopt(): ed0. methods of Bluetooth socket objects.

     *note SOL_BLUETOOTH: 396c. is only available on Linux.  Other
     constants are available if the corresponding protocol is supported.

 -- データ: SO_L2CAP_*
 -- データ: socket.L2CAP_LM

 -- データ: L2CAP_LM_*

 -- データ: SO_RFCOMM_*

 -- データ: RFCOMM_LM_*

 -- データ: SO_SCO_*

 -- データ: SO_BTH_*

 -- データ: BT_*

     Used in the option name and value argument to the *note
     setsockopt(): ed1. and *note getsockopt(): ed0. methods of
     Bluetooth socket objects.

     ‘BT_*’ and *note L2CAP_LM: 396d. are only available on Linux.
     ‘SO_BTH_*’ are only available on Windows.  Other constants may be
     available on Linux and various BSD platforms.

     Added in version 3.14.

 -- データ: socket.HCI_FILTER
 -- データ: socket.HCI_TIME_STAMP
 -- データ: socket.HCI_DATA_DIR
 -- データ: socket.SO_HCI_EVT_FILTER
 -- データ: socket.SO_HCI_PKT_FILTER

     Option names for use with *note BTPROTO_HCI: 281.  Availability and
     format of the option values depend on platform.

     バージョン 3.14 で変更: Added ‘SO_HCI_EVT_FILTER’ and
     ‘SO_HCI_PKT_FILTER’ on NetBSD and DragonFly BSD. Added
     ‘HCI_DATA_DIR’ on FreeBSD, NetBSD and DragonFly BSD.

 -- データ: socket.HCI_DEV_NONE

     The ‘device_id’ value used to create an HCI socket that isn't
     specific to a single Bluetooth adapter.

     *note Availability: 213f.: Linux

     Added in version 3.14.

 -- データ: socket.HCI_CHANNEL_RAW
 -- データ: socket.HCI_CHANNEL_USER
 -- データ: socket.HCI_CHANNEL_MONITOR
 -- データ: socket.HCI_CHANNEL_CONTROL
 -- データ: socket.HCI_CHANNEL_LOGGING

     Possible values for ‘channel’ field in the *note BTPROTO_HCI: 281.
     address.

     *note Availability: 213f.: Linux

     Added in version 3.14.

 -- データ: socket.AF_QIPCRTR

     Constant for Qualcomm's IPC router protocol, used to communicate
     with service providing remote processors.

     *note Availability: 213f.: Linux >= 4.7.

 -- データ: socket.SCM_CREDS2
 -- データ: socket.LOCAL_CREDS
 -- データ: socket.LOCAL_CREDS_PERSISTENT

     LOCAL_CREDS and LOCAL_CREDS_PERSISTENT can be used with SOCK_DGRAM,
     SOCK_STREAM sockets, equivalent to Linux/DragonFlyBSD SO_PASSCRED,
     while LOCAL_CREDS sends the credentials at first read,
     LOCAL_CREDS_PERSISTENT sends for each read, SCM_CREDS2 must be then
     used for the latter for the message type.

     Added in version 3.11.

     *note Availability: 213f.: FreeBSD.

 -- データ: socket.SO_INCOMING_CPU

     Constant to optimize CPU locality, to be used in conjunction with
     ‘SO_REUSEPORT’.

     Added in version 3.11.

     *note Availability: 213f.: Linux >= 3.9

 -- データ: socket.SO_REUSEPORT_LB

          Constant to enable duplicate address and port bindings with
          load balancing.

     Added in version 3.14.

     *note Availability: 213f.: FreeBSD >= 12.0

 -- データ: socket.AF_HYPERV
 -- データ: socket.HV_PROTOCOL_RAW
 -- データ: socket.HVSOCKET_CONNECT_TIMEOUT
 -- データ: socket.HVSOCKET_CONNECT_TIMEOUT_MAX
 -- データ: socket.HVSOCKET_CONNECTED_SUSPEND
 -- データ: socket.HVSOCKET_ADDRESS_FLAG_PASSTHRU
 -- データ: socket.HV_GUID_ZERO
 -- データ: socket.HV_GUID_WILDCARD
 -- データ: socket.HV_GUID_BROADCAST
 -- データ: socket.HV_GUID_CHILDREN
 -- データ: socket.HV_GUID_LOOPBACK
 -- データ: socket.HV_GUID_PARENT

     Constants for Windows Hyper-V sockets for host/guest
     communications.

     *note Availability: 213f.: Windows.

     Added in version 3.12.

 -- データ: socket.ETHERTYPE_ARP
 -- データ: socket.ETHERTYPE_IP
 -- データ: socket.ETHERTYPE_IPV6
 -- データ: socket.ETHERTYPE_VLAN

     IEEE 802.3 protocol number(3).  constants.

     *note Availability: 213f.: Linux, FreeBSD, macOS.

     Added in version 3.12.

 -- データ: socket.SHUT_RD
 -- データ: socket.SHUT_WR
 -- データ: socket.SHUT_RDWR

     These constants are used by the *note shutdown(): 398e. method of
     socket objects.

     *note Availability: 213f.: not WASI.

   ---------- Footnotes ----------

   (1) https://udrepper.livejournal.com/20407.html

   (2) https://manpages.debian.org/packet(7)

   (3) 
https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.txt


File: python.info,  Node: 関数<8>,  Prev: 定数<8>,  Up: モジュールの内容

5.19.2.5 関数
.............

* Menu:

* ソケットの作成::
* その他の関数: その他の関数<2>.


File: python.info,  Node: ソケットの作成,  Next: その他の関数<2>,  Up: 関数<8>

5.19.2.6 ソケットの作成
.......................

以下の関数は全て *note socket object: 3991. を生成します。

 -- クラス: socket.socket (family=AF_INET, type=SOCK_STREAM, proto=0,
          fileno=None)

     アドレスファミリー、ソケットタイプ、プロトコル番号を指定してソケッ
     トを作成します。アドレスファミリーには *note AF_INET: 1bad. (デフォ
     ルト値), *note AF_INET6: 1bae, *note AF_UNIX: 1bb0, *note AF_CAN:
     3947, *note AF_PACKET: 394e, *note AF_RDS: 395e. を指定することがで
     きます。ソケットタイプには *note SOCK_STREAM: 150b. (デフォルト値),
     *note SOCK_DGRAM: 150a, *note SOCK_RAW: 3957. または他の ‘SOCK_’ 定
     数の何れかを指定します。プロトコル番号は通常省略するか、または0を指
     定しますが、アドレスファミリーに *note AF_CAN: 3947. を指定した場合
     は、プロトコル番号には const:‘CAN_RAW’, *note CAN_BCM: 11a5, *note
     CAN_ISOTP: 3948, *note CAN_J1939: b2c. のいずれかを指定すべきです。

     If 'fileno' is specified, the values for 'family', 'type', and
     'proto' are auto-detected from the specified file descriptor.
     Auto-detection can be overruled by calling the function with
     explicit 'family', 'type', or 'proto' arguments.  This only affects
     how Python represents e.g.  the return value of *note
     socket.getpeername(): 38d9. but not the actual OS resource.  Unlike
     *note socket.fromfd(): 3992, 'fileno' will return the same socket
     and not a duplicate.  This may help close a detached socket using
     *note socket.close(): d6a.

     新たに作成されたソケットは *note 継承不可: 10fc. です。

     引数 ‘self’, ‘family’, ‘type’, ‘protocol’ 付きで *note
     監査イベント: 1c6e. ‘socket.__new__’ を送出します。

     バージョン 3.3 で変更: AF_CAN, AF_RDS ファミリーが追加されました。

     バージョン 3.4 で変更: CAN_BCMプロトコルが追加されました。

     バージョン 3.4 で変更: 返されるソケットは継承不可になりました。

     バージョン 3.7 で変更: CAN_ISOTP プロトコルが追加されました。

     バージョン 3.7 で変更: When *note SOCK_NONBLOCK: e04. or *note
     SOCK_CLOEXEC: e05. bit flags are applied to 'type' they are
     cleared, and *note socket.type: e06. will not reflect them.  They
     are still passed to the underlying system ‘socket()’ call.
     Therefore,

          sock = socket.socket(
              socket.AF_INET,
              socket.SOCK_STREAM | socket.SOCK_NONBLOCK)

     will still create a non-blocking socket on OSes that support
     ‘SOCK_NONBLOCK’, but ‘sock.type’ will be set to
     ‘socket.SOCK_STREAM’.

     バージョン 3.9 で変更: CAN_J1939 プロトコルが追加されました。

     バージョン 3.10 で変更: IPPROTO_MPTCP プロトコルが追加されました。

 -- の関数: socket.socketpair ([family[, type[, proto]]])

     Build a pair of connected socket objects using the given address
     family, socket type, and protocol number.  Address family, socket
     type, and protocol number are as for the *note socket(): fa1.
     function above.  The default family is *note AF_UNIX: 1bb0. if
     defined on the platform; otherwise, the default is *note AF_INET:
     1bad.

     新たに作成されたソケットは *note 継承不可: 10fc. です。

     バージョン 3.2 で変更: 返されるソケットオブジェクトが、サブセットで
     はなく完全なソケットAPIを提供するようになりました。

     バージョン 3.4 で変更: 返されるソケットの組は、どちらも継承不可にな
     りました。

     バージョン 3.5 で変更: Windows のサポートが追加されました。

 -- の関数: socket.create_connection (address, timeout=GLOBAL_DEFAULT,
          source_address=None, *, all_errors=False)

     インターネット 'address' (‘(host, port)’ ペア) で listen している
     TCPサービスに接続し、ソケットオブジェクトを返します。これは *note
     socket.connect(): fa3. を高級にした関数です。 'host' が数値でないホ
     スト名の場合、 *note AF_INET: 1bad. と *note AF_INET6: 1bae. の両方
     で名前解決を試み、得られた全てのアドレスに対して成功するまで接続を
     試みます。この関数を使って IPv4 と IPv6 に両対応したクライアントを
     簡単に書くことができます。

     オプションの 'timeout' 引数を指定すると、接続を試みる前にソケットオ
     ブジェクトのタイムアウトを設定します。 'timeout' が指定されない場合
     、 *note getdefaulttimeout(): 3993. が返すデフォルトのタイムアウト
     設定値を利用します。

     'source_address' は接続する前にバインドするソースアドレスを指定する
     オプション引数で、指定する場合は ‘(host, port)’ の2要素タプルでなけ
     ればなりません。 host や port が '' か 0 だった場合は、OSのデフォル
     トの動作になります。

     When a connection cannot be created, an exception is raised.  By
     default, it is the exception from the last address in the list.  If
     'all_errors' is ‘True’, it is an *note ExceptionGroup: 4d2.
     containing the errors of all attempts.

     バージョン 3.2 で変更: 'source_address' が追加されました。

     バージョン 3.11 で変更: 'all_errors' が追加されました

 -- の関数: socket.create_server (address, *, family=AF_INET,
          backlog=None, reuse_port=False, dualstack_ipv6=False)

     Convenience function which creates a TCP socket bound to 'address'
     (a 2-tuple ‘(host, port)’) and returns the socket object.

     'family' should be either *note AF_INET: 1bad. or *note AF_INET6:
     1bae.  'backlog' is the queue size passed to *note socket.listen():
     105e.; if not specified , a default reasonable value is chosen.
     'reuse_port' dictates whether to set the ‘SO_REUSEPORT’ socket
     option.

     If 'dualstack_ipv6' is true, 'family' is *note AF_INET6: 1bae. and
     the platform supports it the socket will be able to accept both
     IPv4 and IPv6 connections, else it will raise *note ValueError:
     2ec.  Most POSIX platforms and Windows are supposed to support this
     functionality.  When this functionality is enabled the address
     returned by *note socket.getpeername(): 38d9. when an IPv4
     connection occurs will be an IPv6 address represented as an
     IPv4-mapped IPv6 address.  If 'dualstack_ipv6' is false it will
     explicitly disable this functionality on platforms that enable it
     by default (e.g.  Linux).  This parameter can be used in
     conjunction with *note has_dualstack_ipv6(): c21.:

          import socket

          addr = ("", 8080)  # all interfaces, port 8080
          if socket.has_dualstack_ipv6():
              s = socket.create_server(addr, family=socket.AF_INET6, dualstack_ipv6=True)
          else:
              s = socket.create_server(addr)

          注釈: On POSIX platforms the ‘SO_REUSEADDR’ socket option is
          set in order to immediately reuse previous sockets which were
          bound on the same 'address' and remained in TIME_WAIT state.

     Added in version 3.8.

 -- の関数: socket.has_dualstack_ipv6 ()

     Return ‘True’ if the platform supports creating a TCP socket which
     can handle both IPv4 and IPv6 connections.

     Added in version 3.8.

 -- の関数: socket.fromfd (fd, family, type, proto=0)

     Duplicate the file descriptor 'fd' (an integer as returned by a
     file object's *note fileno(): 17ad. method) and build a socket
     object from the result.  Address family, socket type and protocol
     number are as for the *note socket(): fa1. function above.  The
     file descriptor should refer to a socket, but this is not checked
     -- subsequent operations on the object may fail if the file
     descriptor is invalid.  This function is rarely needed, but can be
     used to get or set socket options on a socket passed to a program
     as standard input or output (such as a server started by the Unix
     inet daemon).  The socket is assumed to be in blocking mode.

     新たに作成されたソケットは *note 継承不可: 10fc. です。

     バージョン 3.4 で変更: 返されるソケットは継承不可になりました。

 -- の関数: socket.fromshare (data)

     *note socket.share(): e02. メソッドから取得した data からソケットオ
     ブジェクトを生成します。ソケットはブロッキングモードだと仮定されま
     す。

     *note Availability: 213f.: Windows.

     Added in version 3.3.

 -- データ: socket.SocketType

     ソケットオブジェクトの型を示す型オブジェクト。 ‘type(socket(...))’
     と同じです。


File: python.info,  Node: その他の関数<2>,  Prev: ソケットの作成,  Up: 関数<8>

5.19.2.7 その他の関数
.....................

The ‘socket’ module also offers various network-related services:

 -- の関数: socket.close (fd)

     Close a socket file descriptor.  This is like *note os.close():
     d6b, but for sockets.  On some platforms (most notably Windows)
     *note os.close(): d6b. does not work for socket file descriptors.

     Added in version 3.7.

 -- の関数: socket.getaddrinfo (host, port, family=AF_UNSPEC, type=0,
          proto=0, flags=0)

     This function wraps the C function ‘getaddrinfo’ of the underlying
     system.

     'host' / 'port' 引数の指すアドレス情報を、そのサービスに接続された
     ソケットを作成するために必要な全ての引数が入った 5 要素のタプルに変
     換します。 'host' はドメイン名、IPv4/v6アドレスの文字列、または
     ‘None’ です。 'port' は ‘'http'’ のようなサービス名文字列、ポート番
     号を表す数値、または ‘None’ です。 'host' と 'port' に ‘None’ を指
     定すると C APIに ‘NULL’ を渡せます。

     The 'family', 'type' and 'proto' arguments can be optionally
     specified in order to provide options and limit the list of
     addresses returned.  Pass their default values (*note AF_UNSPEC:
     389a, 0, and 0, respectively) to not limit the results.  See the
     note below for details.

     The 'flags' argument can be one or several of the ‘AI_*’ constants,
     and will influence how results are computed and returned.  For
     example, ‘AI_NUMERICHOST’ will disable domain name resolution and
     will raise an error if 'host' is a domain name.

     この関数は以下の構造をとる 5 要素のタプルのリストを返します:

     ‘(family, type, proto, canonname, sockaddr)’

     In these tuples, 'family', 'type', 'proto' are all integers and are
     meant to be passed to the *note socket(): fa1. function.
     'canonname' will be a string representing the canonical name of the
     'host' if ‘AI_CANONNAME’ is part of the 'flags' argument; else
     'canonname' will be empty.  'sockaddr' is a tuple describing a
     socket address, whose format depends on the returned 'family' (a
     ‘(address, port)’ 2-tuple for *note AF_INET: 1bad, a ‘(address,
     port, flowinfo, scope_id)’ 4-tuple for *note AF_INET6: 1bae.), and
     is meant to be passed to the *note socket.connect(): fa3. method.

          注釈: If you intend to use results from ‘getaddrinfo()’ to
          create a socket (rather than, for example, retrieve
          'canonname'), consider limiting the results by 'type' (e.g.
          *note SOCK_STREAM: 150b. or *note SOCK_DGRAM: 150a.) and/or
          'proto' (e.g.  ‘IPPROTO_TCP’ or ‘IPPROTO_UDP’) that your
          application can handle.

          The behavior with default values of 'family', 'type', 'proto'
          and 'flags' is system-specific.

          Many systems (for example, most Linux configurations) will
          return a sorted list of all matching addresses.  These
          addresses should generally be tried in order until a
          connection succeeds (possibly tried in parallel, for example,
          using a Happy Eyeballs(1) algorithm).  In these cases,
          limiting the 'type' and/or 'proto' can help eliminate
          unsuccessful or unusable connection attempts.

          Some systems will, however, only return a single address.
          (For example, this was reported on Solaris and AIX
          configurations.)  On these systems, limiting the 'type' and/or
          'proto' helps ensure that this address is usable.

     引数 ‘host’, ‘port’, ‘family’, ‘type’, ‘protocol’ 付きで *note
     監査イベント: 1c6e. ‘socket.getaddrinfo’ を送出します。

     次の例では ‘example.org’ の 80 番ポートポートへの TCP 接続を得るた
     めのアドレス情報を取得しようとしています。 (結果は IPv6 をサポート
     しているかどうかで変わります):

          >>> socket.getaddrinfo("example.org", 80, proto=socket.IPPROTO_TCP)
          [(socket.AF_INET6, socket.SOCK_STREAM,
           6, '', ('2606:2800:220:1:248:1893:25c8:1946', 80, 0, 0)),
           (socket.AF_INET, socket.SOCK_STREAM,
           6, '', ('93.184.216.34', 80))]

     バージョン 3.2 で変更: パラメータをキーワード引数で渡すことができる
     ようになりました。

     バージョン 3.7 で変更: for IPv6 multicast addresses, string
     representing an address will not contain ‘%scope_id’ part.

 -- の関数: socket.getfqdn ([name])

     Return a fully qualified domain name for 'name'.  If 'name' is
     omitted or empty, it is interpreted as the local host.  To find the
     fully qualified name, the hostname returned by *note
     gethostbyaddr(): 1c84. is checked, followed by aliases for the
     host, if available.  The first name which includes a period is
     selected.  In case no fully qualified domain name is available and
     'name' was provided, it is returned unchanged.  If 'name' was empty
     or equal to ‘'0.0.0.0'’, the hostname from *note gethostname():
     3026. is returned.

 -- の関数: socket.gethostbyname (hostname)

     ホスト名を ‘'100.50.200.5'’ のようなIPv4形式のアドレスに変換します
     。ホスト名としてIPv4アドレスを指定した場合、その値は変換せずにその
     まま返ります。 *note gethostbyname(): 3996. APIへのより完全なインタ
     ーフェイスが必要であれば、 *note gethostbyname_ex(): 1c85. を参照し
     てください。 *note gethostbyname(): 3996. は、IPv6名前解決をサポー
     トしていません。IPv4/ v6のデュアルスタックをサポートする場合は
     *note getaddrinfo(): 1ac3. を使用します。

     引数 ‘hostname’ を指定して *note 監査イベント: 1c6e.
     ‘socket.gethostbyname’ を送出します。

     *note Availability: 213f.: not WASI.

 -- の関数: socket.gethostbyname_ex (hostname)

     Translate a host name to IPv4 address format, extended interface.
     Return a 3-tuple ‘(hostname, aliaslist, ipaddrlist)’ where
     'hostname' is the host's primary host name, 'aliaslist' is a
     (possibly empty) list of alternative host names for the same
     address, and 'ipaddrlist' is a list of IPv4 addresses for the same
     interface on the same host (often but not always a single address).
     *note gethostbyname_ex(): 1c85. does not support IPv6 name
     resolution, and *note getaddrinfo(): 1ac3. should be used instead
     for IPv4/v6 dual stack support.

     引数 ‘hostname’ を指定して *note 監査イベント: 1c6e.
     ‘socket.gethostbyname’ を送出します。

     *note Availability: 213f.: not WASI.

 -- の関数: socket.gethostname ()

     Pythonインタープリタを現在実行しているマシンのホスト名を含む文字列
     を返します。

     引数無しで *note 監査イベント: 1c6e. ‘socket.gethostname’ を送出し
     ます。

     注意: *note gethostname(): 3026. は完全修飾ドメイン名を返すとは限り
     ません。完全修飾ドメイン名が必要であれば、*note getfqdn(): 1aed. を
     使用してください。

     *note Availability: 213f.: not WASI.

 -- の関数: socket.gethostbyaddr (ip_address)

     Return a 3-tuple ‘(hostname, aliaslist, ipaddrlist)’ where
     'hostname' is the primary host name responding to the given
     'ip_address', 'aliaslist' is a (possibly empty) list of alternative
     host names for the same address, and 'ipaddrlist' is a list of
     IPv4/v6 addresses for the same interface on the same host (most
     likely containing only a single address).  To find the fully
     qualified domain name, use the function *note getfqdn(): 1aed.
     *note gethostbyaddr(): 1c84. supports both IPv4 and IPv6.

     引数 ‘ip_address’ を指定して *note 監査イベント: 1c6e.
     ‘socket.gethostbyaddr’ を送出します。

     *note Availability: 213f.: not WASI.

 -- の関数: socket.getnameinfo (sockaddr, flags)

     Translate a socket address 'sockaddr' into a 2-tuple ‘(host,
     port)’.  Depending on the settings of 'flags', the result can
     contain a fully qualified domain name or numeric address
     representation in 'host'.  Similarly, 'port' can contain a string
     port name or a numeric port number.

     For IPv6 addresses, ‘%scope_id’ is appended to the host part if
     'sockaddr' contains meaningful 'scope_id'.  Usually this happens
     for multicast addresses.

     For more information about 'flags' you can consult
     ‘getnameinfo(3)(2)’.

     引数 ‘sockaddr’ を指定して *note 監査イベント: 1c6e.
     ‘socket.getnameinfo’ を送出します。

     *note Availability: 213f.: not WASI.

 -- の関数: socket.getprotobyname (protocolname)

     Translate an internet protocol name (for example, ‘'icmp'’) to a
     constant suitable for passing as the (optional) third argument to
     the *note socket(): fa1. function.  This is usually only needed for
     sockets opened in "raw" mode (*note SOCK_RAW: 3957.); for the
     normal socket modes, the correct protocol is chosen automatically
     if the protocol is omitted or zero.

     *note Availability: 213f.: not WASI.

 -- の関数: socket.getservbyname (servicename[, protocolname])

     インターネットサービス名とプロトコルから、そのサービスのポート番号
     を取得します。省略可能なプロトコル名として、 ‘'tcp'’ か ‘'udp'’ の
     どちらかを指定することができます。指定がなければどちらのプロトコル
     にもマッチします。

     引数 ‘servicename’, ‘protocolname’ を指定して *note 監査イベント:
     1c6e. ‘socket.getservbyname’ を送出します。

     *note Availability: 213f.: not WASI.

 -- の関数: socket.getservbyport (port[, protocolname])

     インターネットポート番号とプロトコル名から、サービス名を取得します
     。省略可能なプロトコル名として、 ‘'tcp'’ か ‘'udp'’ のどちらかを指
     定することができます。指定がなければどちらのプロトコルにもマッチし
     ます。

     引数 ‘port’, ‘protocolname’ を指定して *note 監査イベント: 1c6e.
     ‘socket.getservbyport’ を送出します。

     *note Availability: 213f.: not WASI.

 -- の関数: socket.ntohl (x)

     32ビットの正の整数のバイトオーダを、ネットワークバイトオーダからホ
     ストバイトオーダに変換します。ホストバイトオーダとネットワークバイ
     トオーダが一致するマシンでは、この関数は何もしません。それ以外の場
     合は4バイトのスワップを行います。

 -- の関数: socket.ntohs (x)

     16ビットの正の整数のバイトオーダを、ネットワークバイトオーダからホ
     ストバイトオーダに変換します。ホストバイトオーダとネットワークバイ
     トオーダが一致するマシンでは、この関数は何もしません。それ以外の場
     合は2バイトのスワップを行います。

     バージョン 3.10 で変更: Raises *note OverflowError: a81. if 'x'
     does not fit in a 16-bit unsigned integer.

 -- の関数: socket.htonl (x)

     32ビットの正の整数のバイトオーダを、ホストバイトオーダからネットワ
     ークバイトオーダに変換します。ホストバイトオーダとネットワークバイ
     トオーダが一致するマシンでは、この関数は何もしません。それ以外の場
     合は4バイトのスワップを行います。

 -- の関数: socket.htons (x)

     16ビットの正の整数のバイトオーダを、ホストバイトオーダからネットワ
     ークバイトオーダに変換します。ホストバイトオーダとネットワークバイ
     トオーダが一致するマシンでは、この関数は何もしません。それ以外の場
     合は2バイトのスワップを行います。

     バージョン 3.10 で変更: Raises *note OverflowError: a81. if 'x'
     does not fit in a 16-bit unsigned integer.

 -- の関数: socket.inet_aton (ip_string)

     ドット記法によるIPv4アドレス(‘'123.45.67.89'’ など)を32ビットにパッ
     クしたバイナリ形式に変換し、長さ4のバイト列オブジェクトとして返しま
     す。この関数が返す値は、標準Cライブラリの ‘in_addr’ 型を使用する関
     数に渡す事ができます。

     *note inet_aton(): b5a. はドットが 3 個以下の文字列も受け取ります;
     詳細については Unix のマニュアル ‘inet(3)(3)’ を参照してください。

     IPv4アドレス文字列が不正であれば、 *note OSError: 2c0. が発生します
     。このチェックは、この関数で使用しているCの実装 ‘inet_aton()’ で行
     われます。

     *note inet_aton(): b5a. は、IPv6をサポートしません。IPv4/v6のデュア
     ルスタックをサポートする場合は *note inet_pton(): b5b. を使用します
     。

 -- の関数: socket.inet_ntoa (packed_ip)

     32 ビットにパックされた IPv4 アドレス (長さ 4 バイトの *note
     bytes-like object: 193.) を、標準的なドット記法による 4 桁の文字列
     ('123.45.67.89' など) に変換します。この関数は、‘in_addr’ 型、つま
     りこの関数が引数として受け取る 32 ビットにパックされたバイナリデー
     タに対する C の型、を使用する標準 C ライブラリのプログラムとやりと
     りする場合に便利です。

     この関数に渡すバイトシーケンスの長さが4バイト以外であれば、 *note
     OSError: 2c0. が発生します。 *note inet_ntoa(): 399c. は、IPv6をサ
     ポートしません。IPv4/v6のデュアルスタックをサポートする場合は *note
     inet_ntop(): 11a7. を使用します。

     バージョン 3.5 で変更: 書き込み可能な *note bytes-like object: 193.
     を使用できるようになりました。

 -- の関数: socket.inet_pton (address_family, ip_string)

     IPアドレスを、アドレスファミリ固有の文字列からパックしたバイナリ形
     式に変換します。 *note inet_pton(): b5b. は、 ‘in_addr’ 型 (*note
     inet_aton(): b5a. と同様)や ‘in6_addr’ を使用するライブラリやネット
     ワークプロトコルを呼び出す際に使用することができます。

     現在サポートされている 'address_family' は、 *note AF_INET: 1bad. と
     *note AF_INET6: 1bae. です。 'ip_string' に不正なIPアドレス文字列を
     指定すると、 *note OSError: 2c0. が発生します。有効な 'ip_string' は
     、 'address_family' と ‘inet_pton()’ の実装によって異なります。

     *note Availability: 213f.: Unix, Windows.

     バージョン 3.4 で変更: Windowsで利用可能になりました

 -- の関数: socket.inet_ntop (address_family, packed_ip)

     パックしたIPアドレス (数バイトからなる *note bytes-like
     オブジェクト: 193. ) を、 ‘'7.10.0.5'’ や ‘'5aef:2b::8'’ などの標準
     的な、アドレスファミリ固有の文字列形式に変換します。 *note
     inet_ntop(): 11a7. は (*note inet_ntoa(): 399c. と同様に)、
     ‘in_addr’ 型や ‘in6_addr’ 型のオブジェクトを返すライブラリやネット
     ワークプロトコル等で使用することができます。

     現在サポートされている 'address_family' の値は、 *note AF_INET:
     1bad. と *note AF_INET6: 1bae. です。バイトオブジェクトの
     'packed_ip' の長さが、指定したアドレスファミリで適切な長さでない場
     合、 *note ValueError: 2ec. が発生します。 *note inet_ntop(): 11a7.
     の呼び出しでエラーが起こると、 *note OSError: 2c0. が発生します。

     *note Availability: 213f.: Unix, Windows.

     バージョン 3.4 で変更: Windowsで利用可能になりました

     バージョン 3.5 で変更: 書き込み可能な *note bytes-like object: 193.
     を使用できるようになりました。

 -- の関数: socket.CMSG_LEN (length)

     指定された 'length' にある制御メッセージ（CMSG）から、末尾のパディ
     ングを除いた全体の長さを返します。この値は多くの場合、 *note
     recvmsg(): fa6. が制御メッセージの一連の要素を受信するためのバッフ
     ァサイズとして使用できますが、バッファの末尾が要素である場合であっ
     てもパディングは含まれるので、バッファサイズを取得するには RFC
     3542(4) で求められているように、 *note CMSG_SPACE(): 1e17. を使用し
     た移植可能なアプリケーションが必要です。通常 'length' は定数であり
     、許容範囲外の値が指定された場合は *note OverflowError: a81. 例外が
     送出されます。

     *note Availability: 213f.: Unix, not WASI.

     Unix プラットフォーム。

     Added in version 3.3.

 -- の関数: socket.CMSG_SPACE (length)

     指定された 'length' の制御メッセージ（CMSG）の要素を *note
     recvmsg(): fa6. が受信するために必要な、パディングを含めたバッファ
     サイズを返します。複数の項目を受信するために必要なバッファスペース
     は、 *note CMSG_SPACE(): 1e17. が返すそれぞれの要素の長さの合計です
     。通常 'length' は定数であり、許容範囲外の値が指定された場合は
     *note OverflowError: a81. 例外が送出されます。

     一部のシステムではこの関数を提供せずに制御メッセージをサポートする
     可能性があることに注意してください。また、この関数の返り値を使用し
     て設定するバッファサイズは、受信する制御メッセージの量を正確に規定
     しないことがあり、その後に受信するデータがパディング領域に合う場合
     があることに注意してください。

     *note Availability: 213f.: Unix, not WASI.

     most Unix platforms.

     Added in version 3.3.

 -- の関数: socket.getdefaulttimeout ()

     新規に生成されたソケットオブジェクトの、デフォルトのタイムアウト値
     を浮動小数点形式の秒数で返します。タイムアウトを使用しない場合には
     ‘None’ を返します。最初に socket モジュールがインポートされた時の初
     期値は ‘None’ です。

 -- の関数: socket.setdefaulttimeout (timeout)

     新規に生成されるソケットオブジェクトの、デフォルトのタイムアウト値
     を秒数 (float 型) で設定します。最初に socket モジュールがインポー
     トされた時の初期値は ‘None’ です。指定可能な値とその意味については
     *note settimeout(): 3951. メソッドを参照してください。

 -- の関数: socket.sethostname (name)

     マシンのホスト名を 'name' に設定します。必要な権限がない場合は
     *note OSError: 2c0. を送出します。

     引数 ‘name’ を指定して *note 監査イベント: 1c6e.
     ‘socket.sethostname’ を送出します。

     *note Availability: 213f.: Unix, not Android.

     Added in version 3.3.

 -- の関数: socket.if_nameindex ()

     ネットワークインターフェース情報 (index int, name string)のタプルを
     返します。システムコールが失敗した場合、 *note OSError: 2c0. 例外を
     送出します。

     *note Availability: 213f.: Unix, Windows, not WASI.

     Added in version 3.3.

     バージョン 3.8 で変更: Windows のサポートが追加されました。

          注釈: On Windows network interfaces have different names in
          different contexts (all names are examples):

             * UUID: ‘{FB605B73-AAC2-49A6-9A2F-25416AEA0573}’

             * name: ‘ethernet_32770’

             * friendly name: ‘vEthernet (nat)’

             * description: ‘Hyper-V Virtual Ethernet Adapter’

          This function returns names of the second form from the list,
          ‘ethernet_32770’ in this example case.

 -- の関数: socket.if_nametoindex (if_name)

     インターフェース名 'if_name' に対応するネットワークインターフェース
     のインデックス番号を返します。対応するインターフェースが存在しない
     場合は *note OSError: 2c0. 例外を送出します。

     *note Availability: 213f.: Unix, Windows, not WASI.

     Added in version 3.3.

     バージョン 3.8 で変更: Windows のサポートが追加されました。

     参考
     ....

     "Interface name" is a name as documented in *note if_nameindex():
     c22.

 -- の関数: socket.if_indextoname (if_index)

     インターフェースインデックス番号 'if_index' に対応するネットワーク
     インターフェース名を返します。対応するインターフェースが存在しない
     場合は *note OSError: 2c0. 例外を送出します。

     *note Availability: 213f.: Unix, Windows, not WASI.

     Added in version 3.3.

     バージョン 3.8 で変更: Windows のサポートが追加されました。

     参考
     ....

     "Interface name" is a name as documented in *note if_nameindex():
     c22.

 -- の関数: socket.send_fds (sock, buffers, fds[, flags[, address]])

     Send the list of file descriptors 'fds' over an *note AF_UNIX:
     1bb0. socket 'sock'.  The 'fds' parameter is a sequence of file
     descriptors.  Consult *note sendmsg(): 6a1. for the documentation
     of these parameters.

     *note Availability: 213f.: Unix, not WASI.

     Unix platforms supporting *note sendmsg(): 6a1. and ‘SCM_RIGHTS’
     mechanism.

     Added in version 3.9.

 -- の関数: socket.recv_fds (sock, bufsize, maxfds[, flags])

     Receive up to 'maxfds' file descriptors from an *note AF_UNIX:
     1bb0. socket 'sock'.  Return ‘(msg, list(fds), flags, addr)’.
     Consult *note recvmsg(): fa6. for the documentation of these
     parameters.

     *note Availability: 213f.: Unix, not WASI.

     Unix platforms supporting *note recvmsg(): fa6. and ‘SCM_RIGHTS’
     mechanism.

     Added in version 3.9.

          注釈: Any truncated integers at the end of the list of file
          descriptors.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Happy_Eyeballs

   (2) https://manpages.debian.org/getnameinfo(3)

   (3) https://manpages.debian.org/inet(3)

   (4) https://datatracker.ietf.org/doc/html/rfc3542.html


File: python.info,  Node: socket オブジェクト,  Next: ソケットタイムアウトの注意事項,  Prev: モジュールの内容,  Up: socket --- 低水準ネットワークインターフェース

5.19.2.8 socket オブジェクト
............................

ソケットオブジェクトは以下のメソッドを持ちます。 *note makefile(): 13b7.
以外のメソッドは、Unixのソケット用システムコールに対応しています。

バージョン 3.2 で変更: *note context manager: 1e1. プロトコルのサポート
が追加されました。コンテキストマネージャを終了することは、 *note
close(): d6a. を呼ぶことと同一です。

 -- メソッド: socket.accept ()

     接続を受け付けます。ソケットはアドレスにbind済みで、listen中である
     必要があります。戻り値は ‘(conn, address)’ のペアで、 'conn' は接続
     を通じてデータの送受信を行うための '新しい' ソケットオブジェクト、
     'address' は接続先でソケットにbindしているアドレスを示します。

     新たに作成されたソケットは *note 継承不可: 10fc. です。

     バージョン 3.4 で変更: ソケットが *note 継承不可: 10fc. になりまし
     た。

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、このメソッドは *note InterruptedError: f88.
     例外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(1) を参照してください)。

 -- メソッド: socket.bind (address)

     ソケットを 'address' にbindします。bind済みのソケットを再バインドす
     る事はできません。('address' のフォーマットはアドレスファミリによっ
     て異なります - 前述。)

     引数 ‘self’, ‘address’ を指定して *note 監査イベント: 1c6e.
     ‘socket.bind’ を送出します。

     *note Availability: 213f.: not WASI.

 -- メソッド: socket.close ()

     Mark the socket closed.  The underlying system resource (e.g.  a
     file descriptor) is also closed when all file objects from *note
     makefile(): 13b7. are closed.  Once that happens, all future
     operations on the socket object will fail.  The remote end will
     receive no more data (after queued data is flushed).

     ソケットはガベージコレクション時に自動的にクローズされます。しかし
     、明示的に *note close(): d6a. するか、 *note with: 186. 文の中でソ
     ケットを使うことを推奨します。

     バージョン 3.6 で変更: 下層の ‘close()’ が呼び出される時、*note
     OSError: 2c0. が送出されるようになりました。

          注釈: *note close(): d6a. releases the resource associated
          with a connection but does not necessarily close the
          connection immediately.  If you want to close the connection
          in a timely fashion, call *note shutdown(): 398e. before *note
          close(): d6a.

 -- メソッド: socket.connect (address)

     'address' で示されるリモートソケットに接続します。('address' のフォ
     ーマットはアドレスファミリによって異なります -- 前述。)

     If the connection is interrupted by a signal, the method waits
     until the connection completes, or raises a *note TimeoutError:
     a36. on timeout, if the signal handler doesn't raise an exception
     and the socket is blocking or has a timeout.  For non-blocking
     sockets, the method raises an *note InterruptedError: f88.
     exception if the connection is interrupted by a signal (or the
     exception raised by the signal handler).

     引数 ‘self’, ‘address’ を指定して *note 監査イベント: 1c6e.
     ‘socket.connect’ を送出します。

     バージョン 3.5 で変更: このメソッドは、接続が信号によって中断され、
     信号ハンドラが例外を送出せず、ソケットがブロックであるかタイムアウ
     トが設定されている場合、*note InterruptedError: f88. 例外を送出する
     代わりに、接続を完了するまで待機するようになりました (論拠について
     は PEP 475(2) を参照してください)。

     *note Availability: 213f.: not WASI.

 -- メソッド: socket.connect_ex (address)

     ‘connect(address)’ と同様ですが、C言語の ‘connect()’ 関数の呼び出し
     でエラーが発生した場合には例外を送出せずにエラーを戻り値として返し
     ます。(これ以外の、"host not found,"等のエラーの場合には例外が発生
     します。)処理が正常に終了した場合には ‘0’ を返し、エラー時には
     ‘errno’ の値を返します。この関数は、非同期接続をサポートする場合な
     どに使用することができます。

     引数 ‘self’, ‘address’ を指定して *note 監査イベント: 1c6e.
     ‘socket.connect’ を送出します。

     *note Availability: 213f.: not WASI.

 -- メソッド: socket.detach ()

     実際にファイル記述子を閉じることなく、ソケットオブジェクトを閉じた
     状態にします。ファイル記述子は返却され、他の目的に再利用することが
     できます。

     Added in version 3.2.

 -- メソッド: socket.dup ()

     ソケットを複製します。

     新たに作成されたソケットは *note 継承不可: 10fc. です。

     バージョン 3.4 で変更: ソケットが *note 継承不可: 10fc. になりまし
     た。

     *note Availability: 213f.: not WASI.

 -- メソッド: socket.fileno ()

     ソケットのファイル記述子を短い整数型で返します。失敗時には、-1 を返
     します。ファイル記述子は、 *note select.select(): fa0. などで使用し
     ます。

     Windowsではこのメソッドで返された小整数をファイル記述子を扱う箇所
     (*note os.fdopen(): 2381. など) で利用できません。 Unix にはこの制
     限はありません。

 -- メソッド: socket.get_inheritable ()

     ソケットのファイル記述子またはソケットのハンドルの *note
     継承可能フラグ: 10fc. を取得します。ソケットが子プロセスへ継承可能
     なら ‘True’ 、継承不可なら ‘False’ を返します。

     Added in version 3.4.

 -- メソッド: socket.getpeername ()

     ソケットが接続しているリモートアドレスを返します。この関数は、リモ
     ート IPv4/v6ソケットのポート番号を調べる場合などに使用します。
     'address' のフォーマットはアドレスファミリによって異なります(前述
     )。この関数をサポートしていないシステムも存在します。

 -- メソッド: socket.getsockname ()

     ソケット自身のアドレスを返します。この関数は、IPv4/v6ソケットのポー
     ト番号を調べる場合などに使用します。('address' のフォーマットはアド
     レスファミリによって異なります -- 前述。)

 -- メソッド: socket.getsockopt (level, optname[, buflen])

     Return the value of the given socket option (see the Unix man page
     ‘getsockopt(2)(3)’).  The needed symbolic constants (*note SO_*
     etc.: d6c.) are defined in this module.  If 'buflen' is absent, an
     integer option is assumed and its integer value is returned by the
     function.  If 'buflen' is present, it specifies the maximum length
     of the buffer used to receive the option in, and this buffer is
     returned as a bytes object.  It is up to the caller to decode the
     contents of the buffer (see the optional built-in module *note
     struct: db. for a way to decode C structures encoded as byte
     strings).

     *note Availability: 213f.: not WASI.

 -- メソッド: socket.getblocking ()

     Return ‘True’ if socket is in blocking mode, ‘False’ if in
     non-blocking.

     This is equivalent to checking ‘socket.gettimeout() != 0’.

     Added in version 3.7.

 -- メソッド: socket.gettimeout ()

     ソケットに指定されたタイムアウト値を取得します。タイムアウト値が設
     定されている場合には浮動小数点型で秒数が、設定されていなければ
     ‘None’ が返ります。この値は、最後に呼び出された *note
     setblocking(): 303c. または *note settimeout(): 3951. によって設定
     されます。

 -- メソッド: socket.ioctl (control, option)

     *note ioctl(): ece. メソッドは WSAIoctl システムインターフェースへ
     の制限されたインターフェースです。詳しい情報については、 Win32
     documentation(4) を参照してください。

     他のプラットフォームでは一般的な *note fcntl.fcntl(): 1851. と
     *note fcntl.ioctl(): 1694. が使われるでしょう; これらの関数は第 1 引
     数としてソケットオブジェクトを取ります。

     現在、以下のコントロールコードのみがサポートされています。
     ‘SIO_RCVALL’, ‘SIO_KEEPALIVE_VALS’, ‘SIO_LOOPBACK_FAST_PATH’。

     *note Availability: 213f.: Windows

     バージョン 3.6 で変更: ‘SIO_LOOPBACK_FAST_PATH’ が追加されました。

 -- メソッド: socket.listen ([backlog])

     サーバーを有効にして、接続を受け付けるようにします。'backlog' が指
     定されている場合、少なくとも 0 以上でなければなりません (それより低
     い場合、0 に設定されます)。システムが新しい接続を拒否するまでに許可
     する未受付の接続の数を指定します。指定しない場合、デフォルトの妥当
     な値が選択されます。

     *note Availability: 213f.: not WASI.

     バージョン 3.5 で変更: 'backlog' 引数が任意になりました。

 -- メソッド: socket.makefile (mode='r', buffering=None, *,
          encoding=None, errors=None, newline=None)

     Return a *note file object: 13db. associated with the socket.  The
     exact returned type depends on the arguments given to *note
     makefile(): 13b7.  These arguments are interpreted the same way as
     by the built-in *note open(): 316. function, except the only
     supported 'mode' values are ‘'r'’ (default), ‘'w'’, ‘'b'’, or a
     combination of those.

     ソケットはブロッキングモードでなければなりません。タイムアウトを設
     定することはできますが、タイムアウトが発生すると、ファイルオブジェ
     クトの内部バッファが矛盾した状態になることがあります。

     *note makefile(): 13b7. でファイルオブジェクトにソケットを関連づけ
     た場合、ソケットを閉じるには、関連づけられたすべてのファイルオブジ
     ェクトを閉じたあとで、元のソケットの *note socket.close(): d6a. を
     呼び出さなければなりません。

          注釈: Windows では *note subprocess.Popen(): 4b7. の stream 引
          数などファイルディスクリプタつき file オブジェクトが期待されて
          いる場所では、 *note makefile(): 13b7. によって作成される
          file-like オブジェクトは使用できません。

 -- メソッド: socket.recv (bufsize[, flags])

     Receive data from the socket.  The return value is a bytes object
     representing the data received.  The maximum amount of data to be
     received at once is specified by 'bufsize'.  A returned empty bytes
     object indicates that the client has disconnected.  See the Unix
     manual page ‘recv(2)(5)’ for the meaning of the optional argument
     'flags'; it defaults to zero.

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、このメソッドは *note InterruptedError: f88.
     例外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(6) を参照してください)。

 -- メソッド: socket.recvfrom (bufsize[, flags])

     ソケットからデータを受信し、結果をタプル ‘(bytes, address)’ として
     返します。 'bytes' は受信データの bytes オブジェクトで、 'address'
     は送信元のアドレスを示します。オプション引数 'flags' については、
     Unix のマニュアルページ ‘recv(2)(7)’ を参照してください。デフォルト
     は0です。 ('address' のフォーマットはアドレスファミリによって異なり
     ます(前述))

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、このメソッドは *note InterruptedError: f88.
     例外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(8) を参照してください)。

     バージョン 3.7 で変更: For multicast IPv6 address, first item of
     'address' does not contain ‘%scope_id’ part anymore.  In order to
     get full IPv6 address use *note getnameinfo(): 1a3a.

 -- メソッド: socket.recvmsg (bufsize[, ancbufsize[, flags]])

     ソケットから通常のデータ (最大 'bufsize' バイト) と補助的なデータを
     受信します。'ancbufsize' 引数により、補助的なデータの受信に使用され
     る内部バッファのバイト数として、サイズが設定されます。このデフォル
     トは 0 で、補助的なデータを受信しないことを意味します。*note
     CMSG_SPACE(): 1e17. または *note CMSG_LEN(): 1e18. を使用して、補助
     的なデータの適切なサイズを計算することができ、バッファ内に収まらな
     いアイテムは、短縮されるか破棄されます。'flags' 引数はデフォルトで
     は 0 で、*note recv(): fa4. での意味と同じ意味を持ちます。

     戻り値は 4 要素のタプル ‘(data, ancdata, msg_flags, address)’ です
     。'data' アイテムは、受信した非付属的データを保持する *note bytes:
     192. オブジェクトです。'ancdata' アイテムは、ゼロ以上のタプル
     ‘(cmsg_level, cmsg_type, cmsg_data)’ からなるリストで、受信する付属
     的なデータ (制御メッセージ) を表します。'cmsg_level' と 'cmsg_type'
     はそれぞれ、プロトコルレベルとプロトコル固有のタイプを指定する整数
     で、'cmsg_data' は関連するデータを保持する *note bytes: 192. オブジ
     ェクトです。'msg_flags' アイテムは、受信したメッセージの条件を示す
     様々なフラグのビット OR です。詳細は、システムのドキュメントを参照
     してください。受信ソケットが接続されていない場合、'address' は、送
     信ソケットが利用できる場合にはそのアドレスで、利用できない場合、そ
     の値は未指定になります。

     一部のシステムでは、*note sendmsg(): 6a1. と *note recvmsg(): fa6.
     を使用して、プロセス間で *note AF_UNIX: 1bb0. ソケットを経由してフ
     ァイル記述子を渡すことができます。この機能を使用する場合 (しばしば
     *note SOCK_STREAM: 150b. ソケットに限定されます)、*note recvmsg():
     fa6. は、付属的なデータ中に、‘(socket.SOL_SOCKET,
     socket.SCM_RIGHTS, fds)’ という形式のアイテムを返します。ここで、
     'fds' は、新しいファイル記述子をネイティブ C の int 型のバイナリ配
     列として表す *note bytes: 192. オブジェクトです。システムコールが返
     った後 *note recvmsg(): fa6. が例外を送出する場合、まずこのメカニズ
     ムを経由して受信したファイル記述子を全て閉じようと試みます。

     一部のシステムでは、部分的に受信した付属的なデータアイテムの短縮さ
     れた長さが示されません。アイテムがバッファの末尾を超えているようで
     ある場合、*note recvmsg(): fa6. は *note RuntimeWarning: 4d7. を送
     出し、関連するデータの開始位置より前で途切れていない場合、バッファ
     内の付属的なデータの一部を返します。

     ‘SCM_RIGHTS’ メカニズムをサポートするシステム上では、次の関数が最大
     'maxfds' のファイル記述子を受信し、メッセージデータと記述子を含むリ
     ストを返しま(無関係な制御メッセージを受信した場合など、予期しない条
     件は無視します)。 *note sendmsg(): 6a1. も参照してください。

          import socket, array

          def recv_fds(sock, msglen, maxfds):
              fds = array.array("i")   # Array of ints
              msg, ancdata, flags, addr = sock.recvmsg(msglen, socket.CMSG_LEN(maxfds * fds.itemsize))
              for cmsg_level, cmsg_type, cmsg_data in ancdata:
                  if cmsg_level == socket.SOL_SOCKET and cmsg_type == socket.SCM_RIGHTS:
                      # Append data, ignoring any truncated integers at the end.
                      fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds.itemsize)])
              return msg, list(fds)

     *note Availability: 213f.: Unix.

     Unix プラットフォーム。

     Added in version 3.3.

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、このメソッドは *note InterruptedError: f88.
     例外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(9) を参照してください)。

 -- メソッド: socket.recvmsg_into (buffers[, ancbufsize[, flags]])

     *note recvmsg(): fa6. と同様に動作してソケットから通常のデータと付
     属的なデータを受信しますが、非付属的データは新しいバイトオブジェク
     トとして返すのではなく、一連のバッファとして返します。'buffers' 引
     数は書き込み可能なバッファをエクスポートするオブジェクトのイテラブ
     ルでなければなりません (例: *note bytearray: 344. オブジェクト)。こ
     れらは、全てに書き込まれるか、残りバッファがなくなるまで、非付属的
     データの連続チャンクで埋められます。オペレーティングシステムによっ
     て、使用できるバッファの数が制限 (*note sysconf(): 18ed. 値
     ‘SC_IOV_MAX’) されている場合があります。'ancbufsize' 引数と 'flags'
     引数は、*note recvmsg(): fa6. での意味と同じ意味を持ちます。

     戻り値は 4 要素のタプル ‘(nbytes, ancdata, msg_flags, address)’ で
     す。ここで、'nbytes' はバッファに書き込まれた非付属的データの総数で
     、'ancdata'、'msg_flags'、'address' は *note recvmsg(): fa6. と同様
     です。

     以下はプログラム例です:

          >>> import socket
          >>> s1, s2 = socket.socketpair()
          >>> b1 = bytearray(b'----')
          >>> b2 = bytearray(b'0123456789')
          >>> b3 = bytearray(b'--------------')
          >>> s1.send(b'Mary had a little lamb')
          22
          >>> s2.recvmsg_into([b1, memoryview(b2)[2:9], b3])
          (22, [], 0, None)
          >>> [b1, b2, b3]
          [bytearray(b'Mary'), bytearray(b'01 had a 9'), bytearray(b'little lamb---')]

     *note Availability: 213f.: Unix.

     Unix プラットフォーム。

     Added in version 3.3.

 -- メソッド: socket.recvfrom_into (buffer[, nbytes[, flags]])

     ソケットからデータを受信し、そのデータを新しいバイト文字列として返
     す代わりに 'buffer' に書きます。戻り値は ‘(nbytes, address)’ のペア
     で、 'nbytes' は受信したデータのバイト数を、 'address' はデータを送
     信したソケットのアドレスです。オプション引数 'flags' (デフォルト:0)
     の意味については、 Unix マニュアルページ ‘recv(2)(10)’ を参照してく
     ださい。('address' のフォーマットは前述のとおりアドレスファミリーに
     依存します。)

 -- メソッド: socket.recv_into (buffer[, nbytes[, flags]])

     'nbytes' バイトまでのデータをソケットから受信して、そのデータを新し
     いバイト文字列にするのではなく 'buffer' に保存します。 'nbytes' が
     指定されない(あるいは0が指定された)場合、 'buffer' の利用可能なサイ
     ズまで受信します。受信したバイト数を返り値として返します。オプショ
     ン引数 'flags' (デフォルト:0) の意味については、 Unix マニュアルペ
     ージ ‘recv(2)(11)’ を参照してください。

 -- メソッド: socket.send (bytes[, flags])

     ソケットにデータを送信します。ソケットはリモートソケットに接続済み
     でなければなりません。オプション引数 'flags' の意味は、上記 *note
     recv(): fa4. と同じです。戻り値として、送信したバイト数を返します。
     アプリケーションでは、必ず戻り値をチェックし、全てのデータが送られ
     た事を確認する必要があります。データの一部だけが送信された場合、ア
     プリケーションで残りのデータを再送信してください。 *note
     ソケットプログラミングHOWTO: 39a1. に、さらに詳しい情報があります。

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、このメソッドは *note InterruptedError: f88.
     例外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(12) を参照してください)。

 -- メソッド: socket.sendall (bytes[, flags])

     ソケットにデータを送信します。ソケットはリモートソケットに接続済み
     でなければなりません。オプション引数 'flags' の意味は、上記 *note
     recv(): fa4. と同じです。 *note send(): fa7. と異なり、このメソッド
     は 'bytes' の全データを送信するか、エラーが発生するまで処理を継続し
     ます。正常終了の場合は ‘None’ を返し、エラー発生時には例外が発生し
     ます。エラー発生時、送信されたバイト数を調べる事はできません。

     バージョン 3.5 で変更: ソケットのタイムアウトは、データが正常に送信
     される度にリセットされなくなりました。ソケットのタイムアウトは、す
     べてのデータを送る最大の合計時間となります。

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、このメソッドは *note InterruptedError: f88.
     例外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(13) を参照してください)。

 -- メソッド: socket.sendto (bytes, address)

 -- メソッド: socket.sendto (bytes, flags, address)

     ソケットにデータを送信します。このメソッドでは接続先を 'address' で
     指定するので、接続済みではいけません。オプション引数 'flags' の意味
     は、上記 *note recv(): fa4. と同じです。戻り値として、送信したバイ
     ト数を返します。('address' のフォーマットはアドレスファミリによって
     異なります -- 前述。)

     引数 ‘self’, ‘address’ を指定して *note 監査イベント: 1c6e.
     ‘socket.sendto’ を送出します。

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、このメソッドは *note InterruptedError: f88.
     例外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(14) を参照してください)。

 -- メソッド: socket.sendmsg (buffers[, ancdata[, flags[, address]]])

     非付属的なデータを一連のバッファから集め、単一のメッセージにまとめ
     ることで、通常のデータと付属的なデータをソケットに送信します。
     'buffers' 引数は、非付属的なデータを *note bytes-like objects: 193.
     (例: *note bytes: 192. オブジェクト) のイテラブルとして指定します。
     オペレーティングシステムによって、使用できるバッファの数が制限
     (*note sysconf(): 18ed. 値 ‘SC_IOV_MAX’) されている場合があります。
     'ancdata' 引数は付属的なデータ (制御メッセージ) をゼロ以上のタプル
     ‘(cmsg_level, cmsg_type, cmsg_data)’ のイテラブルとして指定します。
     ここで、'cmsg_level' と 'cmsg_type' はそれぞれプロトコルレベルとプ
     ロトコル固有のタイプを指定する整数で、'cmsg_data' は関連データを保
     持するバイトライクオブジェクトです。一部のシステム (特に *note
     CMSG_SPACE(): 1e17. を持たないシステム) では、一度の呼び出しで一つ
     の制御メッセージの送信しかサポートされていない場合があります。
     'flags' 引数のデフォルトは 0 であり、*note send(): fa7. での意味と
     同じ意味を持ちます。‘None’ 以外の 'address' が渡された場合、メッセ
     ージの目的地のアドレスを設定します。戻り値は、送信された非付属的デ
     ータのバイト数です。

     以下の関数は、‘SCM_RIGHTS’ メカニズムをサポートするシステムで、ファ
     イル記述子 'fds' を *note AF_UNIX: 1bb0. ソケット経由で送信します。
     *note recvmsg(): fa6. も参照してください。

          import socket, array

          def send_fds(sock, msg, fds):
              return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array.array("i", fds))])

     *note Availability: 213f.: Unix, not WASI.

     Unix プラットフォーム。

     引数 ‘self’, ‘address’ を指定して *note 監査イベント: 1c6e.
     ‘socket.sendmsg’ を送出します。

     Added in version 3.3.

     バージョン 3.5 で変更: システムコールが中断されシグナルハンドラが例
     外を送出しなかった場合、このメソッドは *note InterruptedError: f88.
     例外を送出する代わりにシステムコールを再試行するようになりました (論
     拠については PEP 475(15) を参照してください)。

 -- メソッド: socket.sendmsg_afalg ([msg], *, op[, iv[, assoclen[,
          flags]]])

     *note sendmsg(): 6a1. の *note AF_ALG: ed2. ソケット用に特化したバ
     ージョンです。*note AF_ALG: ed2. ソケットの、モード、IV、AEAD に関
     連づけられたデータ長、フラグを設定します。

     *note Availability: 213f.: Linux >= 2.6.38.

     Added in version 3.6.

 -- メソッド: socket.sendfile (file, offset=0, count=None)

     高性能の *note os.sendfile: d05. を使用して、ファイルを EOF まで送
     信し、送信されたバイトの総数を返します。'file' は、バイナリモードで
     開かれた標準的なファイルオブジェクトです。*note os.sendfile: d05. が
     使用できない場合 (例: Windows)、または 'file' が標準的なファイルで
     ない場合、代わりに *note send(): fa7. が使用されます。'offset' は、
     ファイルの読み出し開始位置を指定します。'count' が指定されている場
     合、ファイルを EOF まで送信するのではなく、転送するバイトの総数を指
     定します。ファイルの位置は、返る時に更新されます。あるいは、エラー
     時には *note file.tell(): 15c6.  を使用して送信されたバイトの数を確
     認することができます。ソケットは *note SOCK_STREAM: 150b. タイプで
     なければなりません。非ブロックソケットはサポートされていません。

     Added in version 3.5.

 -- メソッド: socket.set_inheritable (inheritable)

     ソケットのファイル記述子、またはソケットのハンドルの、 *note
     継承可能フラグ: 10fc. を立てます。

     Added in version 3.4.

 -- メソッド: socket.setblocking (flag)

     ソケットをブロッキングモード、または非ブロッキングモードに設定しま
     す。'flag' が False の場合にはソケットは非ブロッキングモードになり
     、True の場合にはブロッキングモードになります。

     このメソッドは、次の *note settimeout(): 3951. 呼び出しの省略表記で
     す:

        * ‘sock.setblocking(True)’ は ‘sock.settimeout(None)’ と等価です

        * ‘sock.setblocking(False)’ は ‘sock.settimeout(0.0)’ と等価です

     バージョン 3.7 で変更: The method no longer applies *note
     SOCK_NONBLOCK: e04. flag on *note socket.type: e06.

 -- メソッド: socket.settimeout (value)

     Set a timeout on blocking socket operations.  The 'value' argument
     can be a nonnegative floating-point number expressing seconds, or
     ‘None’.  If a non-zero value is given, subsequent socket operations
     will raise a *note timeout: a35. exception if the timeout period
     'value' has elapsed before the operation has completed.  If zero is
     given, the socket is put in non-blocking mode.  If ‘None’ is given,
     the socket is put in blocking mode.

     詳しくは *note ソケットタイムアウトの注意事項: 39a2. を参照してくだ
     さい。

     バージョン 3.7 で変更: The method no longer toggles *note
     SOCK_NONBLOCK: e04. flag on *note socket.type: e06.

 -- メソッド: socket.setsockopt (level, optname, value: int | Buffer)

 -- メソッド: socket.setsockopt (level, optname, None, optlen: int)

     Set the value of the given socket option (see the Unix manual page
     ‘setsockopt(2)(16)’).  The needed symbolic constants are defined in
     this module (SO_* etc.  <socket-unix-constants>).  The value can be
     an integer, ‘None’ or a *note bytes-like object: 193. representing
     a buffer.  In the latter case it is up to the caller to ensure that
     the bytestring contains the proper bits (see the optional built-in
     module *note struct: db. for a way to encode C structures as
     bytestrings).  When 'value' is set to ‘None’, 'optlen' argument is
     required.  It's equivalent to calling ‘setsockopt()’ C function
     with ‘optval=NULL’ and ‘optlen=optlen’.

     バージョン 3.5 で変更: 書き込み可能な *note bytes-like object: 193.
     を使用できるようになりました。

     バージョン 3.6 で変更: setsockopt(level, optname, None, optlen:
     int) の形式が追加されました。

     *note Availability: 213f.: not WASI.

 -- メソッド: socket.shutdown (how)

     接続の片方向、または両方向を切断します。 'how' が *note SHUT_RD:
     398b. の場合、以降は受信を行えません。 'how' が *note SHUT_WR:
     398c. の場合、以降は送信を行えません。 'how' が *note SHUT_RDWR:
     398d. の場合、以降は送受信を行えません。

     *note Availability: 213f.: not WASI.

 -- メソッド: socket.share (process_id)

     ソケットを複製し、対象のプロセスと共有するための bytes オブジェクト
     を返します。対象のプロセスを 'process_id' で指定しなければなりませ
     ん。戻り値の bytes オブジェクトは、何らかのプロセス間通信を使って対
     象のプロセスに伝えます。対象のプロセス側では、 *note fromshare():
     e01. を使って複製されたソケットをとらえます。オペレーティング・シス
     テムは対象のプロセスに対してソケットを複製するため、このメソッドを
     呼び出した後であれば、元のソケットをクローズしても、対象のプロセス
     に渡ったソケットには影響がありません。

     *note Availability: 213f.: Windows.

     Added in version 3.3.

‘read()’ メソッドと ‘write()’ メソッドは存在しませんので注意してください
。代わりに 'flags' を省略した *note recv(): fa4. と *note send(): fa7. を
使うことができます。

ソケットオブジェクトには以下の *note socket: fa1. コンストラクタに渡され
た値に対応した (読み出し専用) 属性があります。

 -- の属性: socket.family

     ソケットファミリー。

 -- の属性: socket.type

     ソケットタイプ。

 -- の属性: socket.proto

     ソケットプロトコル。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/

   (2) https://peps.python.org/pep-0475/

   (3) https://manpages.debian.org/getsockopt(2)

   (4) https://msdn.microsoft.com/en-us/library/ms741621%28VS.85%29.aspx

   (5) https://manpages.debian.org/recv(2)

   (6) https://peps.python.org/pep-0475/

   (7) https://manpages.debian.org/recv(2)

   (8) https://peps.python.org/pep-0475/

   (9) https://peps.python.org/pep-0475/

   (10) https://manpages.debian.org/recv(2)

   (11) https://manpages.debian.org/recv(2)

   (12) https://peps.python.org/pep-0475/

   (13) https://peps.python.org/pep-0475/

   (14) https://peps.python.org/pep-0475/

   (15) https://peps.python.org/pep-0475/

   (16) https://manpages.debian.org/setsockopt(2)


File: python.info,  Node: ソケットタイムアウトの注意事項,  Next: 使用例<27>,  Prev: socket オブジェクト,  Up: socket --- 低水準ネットワークインターフェース

5.19.2.9 ソケットタイムアウトの注意事項
.......................................

ソケットオブジェクトは、ブロッキングモード、非ブロッキングモード、タイム
アウトモードのうち、いずれか1つのモードをとります。デフォルトでは、ソケ
ットは常にブロッキングモードで作成されますが、 *note
setdefaulttimeout(): 3955. で標準のモードを変更することができます。

   * 'ブロッキングモード' での操作は、完了するか、または（接続がタイムア
     ウトするなどして）システムがエラーを返すまで、ブロックされます。

   * '非ブロッキングモード' での操作は、ただちに完了できない場合、例外を
     送出して失敗します。この場合の例外の種類は、システムに依存するため
     、ここに記すことができません。 *note select: c6. モジュールの関数を
     使って、ソケットの読み書きが利用可能かどうか、可能な場合はいつ利用
     できるかを調べることができます。

   * 'タイムアウトモード' での操作は、指定されたタイムアウトの時間内に完
     了しなければ、 *note timeout: a35. 例外を送出します。タイムアウトの
     時間内にシステムがエラーを返した場合は、そのエラーを返します。

     注釈: At the operating system level, sockets in 'timeout mode' are
     internally set in non-blocking mode.  Also, the blocking and
     timeout modes are shared between file descriptors and socket
     objects that refer to the same network endpoint.  This
     implementation detail can have visible consequences if e.g.  you
     decide to use the *note fileno(): 399f. of a socket.

* Menu:

* タイムアウトと connect メソッド::
* タイムアウトと accept メソッド::


File: python.info,  Node: タイムアウトと connect メソッド,  Next: タイムアウトと accept メソッド,  Up: ソケットタイムアウトの注意事項

5.19.2.10 タイムアウトと ‘connect’ メソッド
...........................................

*note connect(): fa3. もタイムアウト設定に従います。一般的に、 *note
settimeout(): 3951. を *note connect(): fa3. の前に呼ぶか、 *note
create_connection(): 882. にタイムアウト引数を渡すことが推奨されます。た
だし、システムのネットワークスタックが Python のソケットタイムアウトの設
定を無視して、自身の接続タイムアウトエラーを返すこともあります。


File: python.info,  Node: タイムアウトと accept メソッド,  Prev: タイムアウトと connect メソッド,  Up: ソケットタイムアウトの注意事項

5.19.2.11 タイムアウトと ‘accept’ メソッド
..........................................

*note getdefaulttimeout(): 3993. が *note None: 885. でない場合、 *note
accept(): fa2. メソッドが返すソケットでは、そのタイムアウトが継承されま
す。 *note None: 885. である場合、待機中のソケットの設定によって動作は異
なります。

   * 待機中のソケットが 'ブロッキングモード' または 'タイムアウトモード'
     である場合、*note accept(): fa2. が返すソケットは、'ブロッキングモ
     ード' になります。

   * 待機中のソケットが '非ブロッキングモード' である場合、*note
     accept(): fa2. が返すソケットは、オペレーティングシステムによってブ
     ロッキングモードまたは非ブロッキングモードになります。クロスプラッ
     トフォームの動作を確保したい場合、この設定を手動でオーバーライドす
     ることをお勧めします。


File: python.info,  Node: 使用例<27>,  Prev: ソケットタイムアウトの注意事項,  Up: socket --- 低水準ネットワークインターフェース

5.19.2.12 使用例
................

Here are four minimal example programs using the TCP/IP protocol: a
server that echoes all data that it receives back (servicing only one
client), and a client using it.  Note that a server must perform the
sequence *note socket(): fa1, *note bind(): 12d7, *note listen(): 105e,
*note accept(): fa2. (possibly repeating the *note accept(): fa2. to
service more than one client), while a client only needs the sequence
*note socket(): fa1, *note connect(): fa3.  Also note that the server
does not *note sendall(): fa8./*note recv(): fa4. on the socket it is
listening on but on the new socket returned by *note accept(): fa2.

次のクライアントとサーバは、IPv4 のみをサポートしています。

     # Echo server program
     import socket

     HOST = ''                 # Symbolic name meaning all available interfaces
     PORT = 50007              # Arbitrary non-privileged port
     with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
         s.bind((HOST, PORT))
         s.listen(1)
         conn, addr = s.accept()
         with conn:
             print('Connected by', addr)
             while True:
                 data = conn.recv(1024)
                 if not data: break
                 conn.sendall(data)

     # Echo client program
     import socket

     HOST = 'daring.cwi.nl'    # The remote host
     PORT = 50007              # The same port as used by the server
     with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
         s.connect((HOST, PORT))
         s.sendall(b'Hello, world')
         data = s.recv(1024)
     print('Received', repr(data))

The next two examples are identical to the above two, but support both
IPv4 and IPv6.  The server side will listen to the first address family
available (it should listen to both instead).  On most of IPv6-ready
systems, IPv6 will take precedence and the server may not accept IPv4
traffic.  The client side will try to connect to all the addresses
returned as a result of the name resolution, and sends traffic to the
first one connected successfully.

     # Echo server program
     import socket
     import sys

     HOST = None               # Symbolic name meaning all available interfaces
     PORT = 50007              # Arbitrary non-privileged port
     s = None
     for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC,
                                   socket.SOCK_STREAM, 0, socket.AI_PASSIVE):
         af, socktype, proto, canonname, sa = res
         try:
             s = socket.socket(af, socktype, proto)
         except OSError as msg:
             s = None
             continue
         try:
             s.bind(sa)
             s.listen(1)
         except OSError as msg:
             s.close()
             s = None
             continue
         break
     if s is None:
         print('could not open socket')
         sys.exit(1)
     conn, addr = s.accept()
     with conn:
         print('Connected by', addr)
         while True:
             data = conn.recv(1024)
             if not data: break
             conn.send(data)

     # Echo client program
     import socket
     import sys

     HOST = 'daring.cwi.nl'    # The remote host
     PORT = 50007              # The same port as used by the server
     s = None
     for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket.SOCK_STREAM):
         af, socktype, proto, canonname, sa = res
         try:
             s = socket.socket(af, socktype, proto)
         except OSError as msg:
             s = None
             continue
         try:
             s.connect(sa)
         except OSError as msg:
             s.close()
             s = None
             continue
         break
     if s is None:
         print('could not open socket')
         sys.exit(1)
     with s:
         s.sendall(b'Hello, world')
         data = s.recv(1024)
     print('Received', repr(data))

次の例は、Windowsで raw socket を利用して非常にシンプルなネットワークス
ニファーを書きます。このサンプルを実行するには、インターフェースを操作す
るための管理者権限が必要です:

     import socket

     # the public network interface
     HOST = socket.gethostbyname(socket.gethostname())

     # create a raw socket and bind it to the public interface
     s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)
     s.bind((HOST, 0))

     # Include IP headers
     s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)

     # receive all packets
     s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)

     # receive a packet
     print(s.recvfrom(65565))

     # disabled promiscuous mode
     s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)

次の例では、ソケットインターフェースを使用してローソケットプロトコルを使
用する CAN ネットワークと通信する方法を説明します。ブロードキャストマネ
ージャプロトコロルで CAN を使用するには、以下でソケットを開きます。

     socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)

ソケットの束縛 (‘CAN_RAW’) または (*note CAN_BCM: 11a5.) 接続を行ったあ
と、ソケットオブジェクトで *note socket.send(): fa7. と *note
socket.recv(): fa4. 操作 (とそのカウンターパート) を通常通りに使用するこ
とができます。

最後の例では、特権が必要になるかもしれません:

     import socket
     import struct


     # CAN frame packing/unpacking (see 'struct can_frame' in <linux/can.h>)

     can_frame_fmt = "=IB3x8s"
     can_frame_size = struct.calcsize(can_frame_fmt)

     def build_can_frame(can_id, data):
         can_dlc = len(data)
         data = data.ljust(8, b'\x00')
         return struct.pack(can_frame_fmt, can_id, can_dlc, data)

     def dissect_can_frame(frame):
         can_id, can_dlc, data = struct.unpack(can_frame_fmt, frame)
         return (can_id, can_dlc, data[:can_dlc])


     # create a raw socket and bind it to the 'vcan0' interface
     s = socket.socket(socket.AF_CAN, socket.SOCK_RAW, socket.CAN_RAW)
     s.bind(('vcan0',))

     while True:
         cf, addr = s.recvfrom(can_frame_size)

         print('Received: can_id=%x, can_dlc=%x, data=%s' % dissect_can_frame(cf))

         try:
             s.send(cf)
         except OSError:
             print('Error sending CAN frame')

         try:
             s.send(build_can_frame(0x01, b'\x01\x02\x03'))
         except OSError:
             print('Error sending CAN frame')

この例を、ほとんど間を空けずに複数回実行すると、以下のエラーが発生する場
合があります:

     OSError: [Errno 98] Address already in use

これは以前の実行がソケットを ‘TIME_WAIT’ 状態のままにし、すぐには再利用
できないことで起こります。

There is a ‘socket’ flag to set, in order to prevent this,
‘socket.SO_REUSEADDR’:

     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
     s.bind((HOST, PORT))

‘SO_REUSEADDR’ フラグは、 ‘TIME_WAIT’ 状態にあるローカルソケットをそのタ
イムアウト期限が自然に切れるのを待つことなく再利用することをカーネルに伝
えます。

参考
....

C 言語によるソケットプログラミングの基礎については、以下の資料を参照して
ください。

   - 'An Introductory 4.3BSD Interprocess Communication Tutorial', by
     Stuart Sechrest

   - 'An Advanced 4.3BSD Interprocess Communication Tutorial', by Samuel
     J. Leffler et al,

両書とも UNIX Programmer's Manual, Supplementary Documents 1 (PS1:7章
PS1:8章)。ソケットの詳細については、各プラットフォームのソケット関連シス
テムコールに関するドキュメントも参照してください。Unix ではマニュアルペ
ージ、WindowsではWinSock (または WinSock2) 仕様書をご覧ください。IPv6 対
応の API については、 RFC 3493(1) "Basic Socket Interface Extensions for
IPv6" を参照してください。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc3493.html


File: python.info,  Node: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー,  Next: select --- I/O 完了の待機,  Prev: socket --- 低水準ネットワークインターフェース,  Up: ネットワーク通信とプロセス間通信

5.19.3 ‘ssl’ -- ソケットオブジェクト用の TLS/SSL ラッパー
---------------------------------------------------------

'Source code:' Lib/ssl.py(1)

__________________________________________________________________

This module provides access to Transport Layer Security (often known as
"Secure Sockets Layer") encryption and peer authentication facilities
for network sockets, both client-side and server-side.  This module uses
the OpenSSL library.

This is an *note optional module: 215a.  If it is missing from your copy
of CPython, look for documentation from your distributor (that is,
whoever provided Python to you).  If you are the distributor, see *note
オプションのモジュールの要件: 2158.

     注釈: Some behavior may be platform dependent, since calls are made
     to the operating system socket APIs.  The installed version of
     OpenSSL may also cause variations in behavior.  For example,
     TLSv1.3 comes with OpenSSL version 1.1.1.

     警告: *note セキュリティで考慮すべき点: 3895. を読まずにこのモジュ
     ールを使用しないでください。SSL のデフォルト設定はアプリケーション
     に十分ではないので、読まない場合はセキュリティに誤った意識を持って
     しまうかもしれません。

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

このセクションでは、 ‘ssl’ モジュールのオブジェクトと関数を解説します。
TLS, SSL, 証明書に関するより一般的な情報は、末尾にある "See Also" のセク
ションを参照してください。

This module provides a class, *note ssl.SSLSocket: ae7, which is derived
from the *note socket.socket: fa1. type, and provides a socket-like
wrapper that also encrypts and decrypts the data going over the socket
with SSL. It supports additional methods such as ‘getpeercert()’, which
retrieves the certificate of the other side of the connection,
‘cipher()’, which retrieves the cipher being used for the secure
connection or ‘get_verified_chain()’, ‘get_unverified_chain()’ which
retrieves certificate chain.

より洗練されたアプリケーションのために、 *note ssl.SSLContext: 357. クラ
スが設定と証明書の管理の助けとなるでしょう。それは *note
SSLContext.wrap_socket(): 748. メソッドを通して SSL ソケットを作成するこ
とで引き継がれます。

バージョン 3.5.3 で変更: Updated to support linking with OpenSSL 1.1.0

バージョン 3.6 で変更: OpenSSL 0.9.8, 1.0.0, 1.0.1 は廃止されており、も
はやサポートされていません。ssl モジュールは、将来的に OpenSSL 1.0.2 ま
たは 1.1.0 を必要とするようになります。

バージョン 3.10 で変更: PEP 644(2) has been implemented.  The ssl module
requires OpenSSL 1.1.1 or newer.

Use of deprecated constants and functions result in deprecation
warnings.

* Menu:

* 関数、定数、例外::
* SSL ソケット::
* SSL コンテキスト::
* 証明書::
* 使用例: 使用例<28>.
* ノンブロッキングソケットについての注意事項::
* メモリ BIO サポート: メモリ BIO サポート<2>.
* SSL セッション::
* セキュリティで考慮すべき点: セキュリティで考慮すべき点<3>.
* TLS 1.3: TLS 1 3.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/ssl.py

   (2) https://peps.python.org/pep-0644/


File: python.info,  Node: 関数、定数、例外,  Next: SSL ソケット,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.19.3.1 関数、定数、例外
.........................

* Menu:

* ソケットの作成: ソケットの作成<2>.
* コンテキストの作成::
* 例外: 例外<19>.
* 乱数生成::
* 証明書の取り扱い::
* 定数: 定数<9>.


File: python.info,  Node: ソケットの作成<2>,  Next: コンテキストの作成,  Up: 関数、定数、例外

5.19.3.2 ソケットの作成
.......................

Instances of *note SSLSocket: ae7. must be created using the *note
SSLContext.wrap_socket(): 748. method.  The helper function *note
create_default_context(): 480. returns a new context with secure default
settings.

Client socket example with default context and IPv4/IPv6 dual stack:

     import socket
     import ssl

     hostname = 'www.python.org'
     context = ssl.create_default_context()

     with socket.create_connection((hostname, 443)) as sock:
         with context.wrap_socket(sock, server_hostname=hostname) as ssock:
             print(ssock.version())

Client socket example with custom context and IPv4:

     hostname = 'www.python.org'
     # PROTOCOL_TLS_CLIENT requires valid cert chain and hostname
     context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
     context.load_verify_locations('path/to/cabundle.pem')

     with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as sock:
         with context.wrap_socket(sock, server_hostname=hostname) as ssock:
             print(ssock.version())

Server socket example listening on localhost IPv4:

     context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
     context.load_cert_chain('/path/to/certchain.pem', '/path/to/private.key')

     with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as sock:
         sock.bind(('127.0.0.1', 8443))
         sock.listen(5)
         with context.wrap_socket(sock, server_side=True) as ssock:
             conn, addr = ssock.accept()
             ...


File: python.info,  Node: コンテキストの作成,  Next: 例外<19>,  Prev: ソケットの作成<2>,  Up: 関数、定数、例外

5.19.3.3 コンテキストの作成
...........................

コンビニエンス関数が、共通の目的で使用される *note SSLContext: 357. オブ
ジェクトを作成するのに役立ちます。

 -- の関数: ssl.create_default_context (purpose=Purpose.SERVER_AUTH, *,
          cafile=None, capath=None, cadata=None)

     Return a new *note SSLContext: 357. object with default settings
     for the given 'purpose'.  The settings are chosen by the ‘ssl’
     module, and usually represent a higher security level than when
     calling the *note SSLContext: 357. constructor directly.

     'cafile', 'capath', 'cadata' は証明書の検証で信用するオプションの
     CA 証明書で、 *note SSLContext.load_verify_locations(): 10ee. のも
     のと同じです。これら 3 つすべてが *note None: 885. であれば、この関
     数は代わりにシステムのデフォルトの CA 証明書を信用して選択すること
     ができます。

     The settings are: *note PROTOCOL_TLS_CLIENT: a72. or *note
     PROTOCOL_TLS_SERVER: a73, *note OP_NO_SSLv2: a3a, and *note
     OP_NO_SSLv3: a3b. with high encryption cipher suites without RC4
     and without unauthenticated cipher suites.  Passing *note
     SERVER_AUTH: 11b5. as 'purpose' sets *note verify_mode: 39b0. to
     *note CERT_REQUIRED: 39b1. and either loads CA certificates (when
     at least one of 'cafile', 'capath' or 'cadata' is given) or uses
     *note SSLContext.load_default_certs(): 11b4. to load default CA
     certificates.

     When *note keylog_filename: 39b2. is supported and the environment
     variable ‘SSLKEYLOGFILE’ is set, *note create_default_context():
     480. enables key logging.

     The default settings for this context include *note
     VERIFY_X509_PARTIAL_CHAIN: 481. and *note VERIFY_X509_STRICT: 551.
     These make the underlying OpenSSL implementation behave more like a
     conforming implementation of RFC 5280(1), in exchange for a small
     amount of incompatibility with older X.509 certificates.

          注釈: プロトコル、オプション、暗号方式その他の設定は、事前に非
          推奨の状態にすることなく、もっと制限の強い値に変更される場合が
          あります。これらの値は、互換性と安全性との妥当なバランスをとっ
          て決められます。

          もしもあなたのアプリケーションが特定の設定を必要とする場合、
          *note SSLContext: 357. を作って自分自身で設定を適用すべきです
          。

          注釈: ある種の古いクライアントやサーバが接続しようと試みてきた
          場合に、この関数で作られた *note SSLContext: 357. が "Protocol
          or cipher suite mismatch" で始まるエラーを起こすのを目撃したら
          それは、この関数が *note OP_NO_SSLv3: a3b. を使って除外してい
          る SSL 3.0 しかサポートしていないのでしょう。SSL 3.0 は 完璧に
          ぶっ壊れている(2) ことが広く知られています。それでもまだこの関
          数を使って、ただし SSL 3.0 接続を許可したいと望むならば、これ
          をこのように再有効化できます:

               ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)
               ctx.options &= ~ssl.OP_NO_SSLv3

          注釈: This context enables *note VERIFY_X509_STRICT: 551. by
          default, which may reject pre- RFC 5280(3) or malformed
          certificates that the underlying OpenSSL implementation
          otherwise would accept.  While disabling this is not
          recommended, you can do so using:

               ctx = ssl.create_default_context()
               ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT

     Added in version 3.4.

     バージョン 3.4.4 で変更: デフォルトの暗号設定から RC4 が除かれまし
     た。

     バージョン 3.6 で変更: デフォルトの暗号化文字列に ChaCha20/Poly1305
     が追加されました。

     デフォルトの暗号化文字列から 3DES が除かれました。

     バージョン 3.8 で変更: Support for key logging to ‘SSLKEYLOGFILE’
     was added.

     バージョン 3.10 で変更: The context now uses *note
     PROTOCOL_TLS_CLIENT: a72. or *note PROTOCOL_TLS_SERVER: a73.
     protocol instead of generic *note PROTOCOL_TLS: 39b3.

     バージョン 3.13 で変更: The context now uses *note
     VERIFY_X509_PARTIAL_CHAIN: 481. and *note VERIFY_X509_STRICT: 551.
     in its default verify flags.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc5280.html

   (2) https://en.wikipedia.org/wiki/POODLE

   (3) https://datatracker.ietf.org/doc/html/rfc5280.html


File: python.info,  Node: 例外<19>,  Next: 乱数生成,  Prev: コンテキストの作成,  Up: 関数、定数、例外

5.19.3.4 例外
.............

 -- 例外: ssl.SSLError

     (現在のところ OpenSSL ライブラリによって提供されている)下層の SSL 実
     装からのエラーを伝えるための例外です。このエラーは、低レベルなネッ
     トワークの上に載っている、高レベルな暗号化と認証レイヤーでの問題を
     通知します。このエラーは *note OSError: 2c0. のサブタイプです。
     *note SSLError: 1491. インスタンスのエラーコードとメッセージは
     OpenSSL ライブラリによるものです。

     バージョン 3.3 で変更: *note SSLError: 1491. は以前は *note
     socket.error: 1261. のサブタイプでした。

      -- の属性: library

          エラーが起こった OpenSSL サブモジュールを示すニーモニック文字
          列で、 ‘SSL’, ‘PEM’, ‘X509’ などです。取り得る値は OpenSSL の
          バージョンに依存します。

          Added in version 3.3.

      -- の属性: reason

          エラーが起こった原因を示すニーモニック文字列で、
          ‘CERTIFICATE_VERIFY_FAILED’ などです。取り得る値は OpenSSL の
          バージョンに依存します。

          Added in version 3.3.

 -- 例外: ssl.SSLZeroReturnError

     読み出しあるいは書き込みを試みようとした際に SSL コネクションが行儀
     よく閉じられてしまった場合に送出される *note SSLError: 1491. サブク
     ラス例外です。これは下層の転送(read TCP)が閉じたことは意味しないこ
     とに注意してください。

     Added in version 3.3.

 -- 例外: ssl.SSLWantReadError

     読み出しあるいは書き込みを試みようとした際に、リクエストが遂行され
     る前に下層の TCP 転送で受け取る必要があるデータが不足した場合に
     *note non-blocking SSL socket: 39b6. によって送出される *note
     SSLError: 1491. サブクラス例外です。

     Added in version 3.3.

 -- 例外: ssl.SSLWantWriteError

     読み出しあるいは書き込みを試みようとした際に、リクエストが遂行され
     る前に下層の TCP 転送が送信する必要があるデータが不足した場合に
     *note non-blocking SSL socket: 39b6. によって送出される *note
     SSLError: 1491. サブクラス例外です。

     Added in version 3.3.

 -- 例外: ssl.SSLSyscallError

     SSL ソケット上で操作を遂行しようとしていてシステムエラーが起こった
     場合に送出される *note SSLError: 1491. サブクラス例外です。残念なが
     ら元となった errno 番号を調べる簡単な方法はありません。

     Added in version 3.3.

 -- 例外: ssl.SSLEOFError

     SSL コネクションが唐突に打ち切られた際に送出される *note SSLError:
     1491. サブクラス例外です。一般的に、このエラーが起こったら下層の転
     送を再利用しようと試みるべきではありません。

     Added in version 3.3.

 -- 例外: ssl.SSLCertVerificationError

     A subclass of *note SSLError: 1491. raised when certificate
     validation has failed.

     Added in version 3.7.

      -- の属性: verify_code

          A numeric error number that denotes the verification error.

      -- の属性: verify_message

          A human readable string of the verification error.

 -- 例外: ssl.CertificateError

     *note SSLCertVerificationError: d75. の別名です。

     バージョン 3.7 で変更: 例外は *note SSLCertVerificationError: d75.
     の別名になりました。


File: python.info,  Node: 乱数生成,  Next: 証明書の取り扱い,  Prev: 例外<19>,  Up: 関数、定数、例外

5.19.3.5 乱数生成
.................

 -- の関数: ssl.RAND_bytes (num, /)

     暗号学的に強固な擬似乱数の 'num' バイトを返します。擬似乱数生成器に
     十分なデータでシードが与えられていない場合や、現在の RANDOM メソッ
     ドに操作がサポートされていない場合は *note SSLError: 1491. を送出し
     ます。 *note RAND_status(): 1c7e. を使って擬似乱数生成器の状態をチ
     ェックできます。 *note RAND_add(): 39bc. を使って擬似乱数生成器にシ
     ードを与えることができます。

     ほとんどすべてのアプリケーションでは *note os.urandom(): 746. が望
     ましいです。

     暗号論的に強い擬似乱数生成器に要求されることについては Wikipedia の
     記事 Cryptographically secure pseudorandom number generator
     (CSPRNG)(1) (日本語版: 暗号論的擬似乱数生成器(2)) を参照してくださ
     い。

     Added in version 3.3.

 -- の関数: ssl.RAND_status ()

     SSL 擬似乱数生成器が十分なランダム性(randomness)を受け取っている時
     に ‘True’ を、それ以外の場合は ‘False’ を返します。
     ‘ssl.RAND_egd()’ と *note ssl.RAND_add(): 39bc. を使って擬似乱数生
     成機にランダム性を加えることができます。

 -- の関数: ssl.RAND_add (bytes, entropy, /)

     Mix the given 'bytes' into the SSL pseudo-random number generator.
     The parameter 'entropy' (a float) is a lower bound on the entropy
     contained in string (so you can always use ‘0.0’).  See RFC 1750(3)
     for more information on sources of entropy.

     バージョン 3.5 で変更: 書き込み可能な *note bytes-like object: 193.
     を使用できるようになりました。

   ---------- Footnotes ----------

   (1) 
https://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator

   (2) 
http://ja.wikipedia.org/wiki/%E6%9A%97%E5%8F%B7%E8%AB%96%E7%9A%84%E6%93%AC%E4%BC%BC%E4%B9%B1%E6%95%B0%E7%94%9F%E6%88%90%E5%99%A8

   (3) https://datatracker.ietf.org/doc/html/rfc1750.html


File: python.info,  Node: 証明書の取り扱い,  Next: 定数<9>,  Prev: 乱数生成,  Up: 関数、定数、例外

5.19.3.6 証明書の取り扱い
.........................

 -- の関数: ssl.cert_time_to_seconds (cert_time)

     ‘cert_time’ として証明書内の "notBefore" や "notAfter" の ‘"%b %d
     %H:%M:%S %Y %Z"’ strptime フォーマット (C locale) 日付を渡すと、エ
     ポックからの積算秒を返します。

     例です。 :

          >>> import ssl
          >>> timestamp = ssl.cert_time_to_seconds("Jan  5 09:34:43 2018 GMT")
          >>> timestamp
          1515144883
          >>> from datetime import datetime
          >>> print(datetime.utcfromtimestamp(timestamp))
          2018-01-05 09:34:43

     "notBefore" や "notAfter" の日付には GMT を使わなければなりません(
     RFC 5280(1))。

     バージョン 3.5 で変更: 入力文字列に指定された 'GMT' タイムゾーンを
     UTC として解釈するようになりました。以前はローカルタイムで解釈して
     いました。また、整数を返すようになりました(入力に含まれる秒の端数を
     含まない)。

 -- の関数: ssl.get_server_certificate (addr,
          ssl_version=PROTOCOL_TLS_CLIENT, ca_certs=None[, timeout])

     Given the address ‘addr’ of an SSL-protected server, as a
     ('hostname', 'port-number') pair, fetches the server's certificate,
     and returns it as a PEM-encoded string.  If ‘ssl_version’ is
     specified, uses that version of the SSL protocol to attempt to
     connect to the server.  If 'ca_certs' is specified, it should be a
     file containing a list of root certificates, the same format as
     used for the 'cafile' parameter in *note
     SSLContext.load_verify_locations(): 10ee.  The call will attempt to
     validate the server certificate against that set of root
     certificates, and will fail if the validation attempt fails.  A
     timeout can be specified with the ‘timeout’ parameter.

     バージョン 3.3 で変更: この関数はIPv6互換になりました。

     バージョン 3.5 で変更: 'ssl_version' のデフォルトが、最近のサーバへ
     の最大限の互換性のために *note PROTOCOL_SSLv3: 39be. から *note
     PROTOCOL_TLS: 39b3. に変更されました。

     バージョン 3.10 で変更: 'timeout' 引数が追加されました。

 -- の関数: ssl.DER_cert_to_PEM_cert (der_cert_bytes)

     DERエンコードされたバイト列として与えられた証明書から、 PEMエンコー
     ドされたバージョンの同じ証明書を返します。

 -- の関数: ssl.PEM_cert_to_DER_cert (pem_cert_string)

     PEM 形式のASCII文字列として与えられた証明書から、同じ証明書をDERエ
     ンコードしたバイト列を返します。

 -- の関数: ssl.get_default_verify_paths ()

     OpenSSL デフォルトの cafile, capath を指すパスを名前付きタプルで返
     します。パスは *note SSLContext.set_default_verify_paths(): 11ad. で
     使われるものと同じです。戻り値は *note named tuple: 85e.
     ‘DefaultVerifyPaths’ です:

        * ‘cafile’ - cafile の解決済みパス、またはファイルが存在しない場
          合は ‘None’

        * ‘capath’ - capath の解決済みパス、またはディレクトリが存在しな
          い場合は ‘None’

        * ‘openssl_cafile_env’ - cafile を指す OpenSSL の環境変数

        * ‘openssl_cafile’ - OpenSSL にハードコードされた cafile のパス

        * ‘openssl_capath_env’ - capath を指す OpenSSL の環境変数

        * ‘openssl_capath’ - OpenSSL にハードコードされた capath のパス

     Added in version 3.4.

 -- の関数: ssl.enum_certificates (store_name)

     Windows のシステム証明書ストアより証明書を抽出します。 'store_name'
     は ‘CA’, ‘ROOT’, ‘MY’ のうちどれか一つでしょう。Windows は追加の証
     明書ストアを提供しているかもしれません。

     この関数はタプル (cert_bytes, encoding_type, trust) のリストで返し
     ます。encoding_type は cert_bytes のエンコーディングを表します。
     X.509 ASN.1 に対する ‘x509_asn’ か PKCS#7 ASN.1 データに対する
     ‘pkcs_7_asn’ のいずれかです。trust は、証明書の目的を、OIDS を内容
     に持つ set として表すか、または証明書がすべての目的で信頼できるなら
     ば ‘True’ です。

     以下はプログラム例です:

          >>> ssl.enum_certificates("CA")
          [(b'data...', 'x509_asn', {'1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2'}),
           (b'data...', 'x509_asn', True)]

     *note Availability: 213f.: Windows.

     Added in version 3.4.

 -- の関数: ssl.enum_crls (store_name)

     Windows のシステム証明書ストアより CRLs を抽出します。 'store_name'
     は ‘CA’, ‘ROOT’, ‘MY’ のうちどれか一つでしょう。Windows は追加の証
     明書ストアを提供しているかもしれません。

     この関数はタプル (cert_bytes, encoding_type, trust) のリストで返し
     ます。encoding_type は cert_bytes のエンコーディングを表します。
     X.509 ASN.1 に対する ‘x509_asn’ か PKCS#7 ASN.1 データに対する
     ‘pkcs_7_asn’ のいずれかです。

     *note Availability: 213f.: Windows.

     Added in version 3.4.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc5280.html


File: python.info,  Node: 定数<9>,  Prev: 証明書の取り扱い,  Up: 関数、定数、例外

5.19.3.7 定数
.............

     すべての定数が *note enum.IntEnum: edb. コレクションまたは *note
     enum.IntFlag: e9a. コレクションになりました。

     Added in version 3.6.

 -- データ: ssl.CERT_NONE

     Possible value for *note SSLContext.verify_mode: 39b0.  Except for
     *note PROTOCOL_TLS_CLIENT: a72, it is the default mode.  With
     client-side sockets, just about any cert is accepted.  Validation
     errors, such as untrusted or expired cert, are ignored and do not
     abort the TLS/SSL handshake.

     In server mode, no certificate is requested from the client, so the
     client does not send any for client cert authentication.

     このドキュメントの下の方の、 *note セキュリティで考慮すべき点:
     3895. に関する議論を参照してください。

 -- データ: ssl.CERT_OPTIONAL

     Possible value for *note SSLContext.verify_mode: 39b0.  In client
     mode, *note CERT_OPTIONAL: 39c3. has the same meaning as *note
     CERT_REQUIRED: 39b1.  It is recommended to use *note CERT_REQUIRED:
     39b1. for client-side sockets instead.

     In server mode, a client certificate request is sent to the client.
     The client may either ignore the request or send a certificate in
     order perform TLS client cert authentication.  If the client
     chooses to send a certificate, it is verified.  Any verification
     error immediately aborts the TLS handshake.

     Use of this setting requires a valid set of CA certificates to be
     passed to *note SSLContext.load_verify_locations(): 10ee.

 -- データ: ssl.CERT_REQUIRED

     Possible value for *note SSLContext.verify_mode: 39b0.  In this
     mode, certificates are required from the other side of the socket
     connection; an *note SSLError: 1491. will be raised if no
     certificate is provided, or if its validation fails.  This mode is
     'not' sufficient to verify a certificate in client mode as it does
     not match hostnames.  *note check_hostname: 39c4. must be enabled
     as well to verify the authenticity of a cert.  *note
     PROTOCOL_TLS_CLIENT: a72. uses *note CERT_REQUIRED: 39b1. and
     enables *note check_hostname: 39c4. by default.

     With server socket, this mode provides mandatory TLS client cert
     authentication.  A client certificate request is sent to the client
     and the client must provide a valid and trusted certificate.

     Use of this setting requires a valid set of CA certificates to be
     passed to *note SSLContext.load_verify_locations(): 10ee.

 -- クラス: ssl.VerifyMode

     CERT_* 定数の *note enum.IntEnum: edb. コレクションです。

     Added in version 3.6.

 -- データ: ssl.VERIFY_DEFAULT

     *note SSLContext.verify_flags: 11b0. に渡せる値です。このモードでは
     、証明書失効リスト(CRLs)はチェックされません。デフォルトでは
     OpenSSL は CRLs を必要ともしませんし検証にも使いません。

     Added in version 3.4.

 -- データ: ssl.VERIFY_CRL_CHECK_LEAF

     *note SSLContext.verify_flags: 11b0. に渡せる値です。このモードでは
     、接続先の証明書のみがチェックされ、仲介の CA 証明書はチェックされ
     ません。接続先証明書の発行者(その CA の直接の祖先)によって署名され
     た妥当な CRL が必要です。 *note SSLContext.load_verify_locations:
     10ee. で相応しい CRL をロードしていなければ、検証は失敗します。

     Added in version 3.4.

 -- データ: ssl.VERIFY_CRL_CHECK_CHAIN

     *note SSLContext.verify_flags: 11b0. に渡せる値です。このモードでは
     、接続先の証明書チェイン内のすべての証明書についての CRLs がチェッ
     クされます。

     Added in version 3.4.

 -- データ: ssl.VERIFY_X509_STRICT

     *note SSLContext.verify_flags: 11b0. に渡せる値で、壊れた X.509 証
     明書に対するワークアラウンドを無効にします。

     Added in version 3.4.

 -- データ: ssl.VERIFY_ALLOW_PROXY_CERTS

     Possible value for *note SSLContext.verify_flags: 11b0. to enables
     proxy certificate verification.

     Added in version 3.10.

 -- データ: ssl.VERIFY_X509_TRUSTED_FIRST

     *note SSLContext.verify_flags: 11b0. に渡せる値です。OpenSSL に対し
     、証明書検証のために信頼チェインを構築する際、信頼できる証明書を選
     ぶように指示します。これはデフォルトで有効にされています。

     Added in version 3.4.4.

 -- データ: ssl.VERIFY_X509_PARTIAL_CHAIN

     Possible value for *note SSLContext.verify_flags: 11b0.  It
     instructs OpenSSL to accept intermediate CAs in the trust store to
     be treated as trust-anchors, in the same way as the self-signed
     root CA certificates.  This makes it possible to trust certificates
     issued by an intermediate CA without having to trust its ancestor
     root CA.

     Added in version 3.10.

 -- クラス: ssl.VerifyFlags

     VERIFY_* 定数の *note enum.IntFlag: e9a. コレクションです。

     Added in version 3.6.

 -- データ: ssl.PROTOCOL_TLS

     クライアントとサーバの両方がサポートするプロトコルバージョンのうち
     、最も大きなものを選択します。名前に反して、このオプションは "SSL"
     と "TLS" プロトコルのいずれも選択できます。

     Added in version 3.6.

     バージョン 3.10 で非推奨: TLS clients and servers require different
     default settings for secure communication.  The generic TLS
     protocol constant is deprecated in favor of *note
     PROTOCOL_TLS_CLIENT: a72. and *note PROTOCOL_TLS_SERVER: a73.

 -- データ: ssl.PROTOCOL_TLS_CLIENT

     Auto-negotiate the highest protocol version that both the client
     and server support, and configure the context client-side
     connections.  The protocol enables *note CERT_REQUIRED: 39b1. and
     *note check_hostname: 39c4. by default.

     Added in version 3.6.

 -- データ: ssl.PROTOCOL_TLS_SERVER

     Auto-negotiate the highest protocol version that both the client
     and server support, and configure the context server-side
     connections.

     Added in version 3.6.

 -- データ: ssl.PROTOCOL_SSLv23

     *note PROTOCOL_TLS: 39b3. のエイリアスです。

     バージョン 3.6 で非推奨: 代わりに *note PROTOCOL_TLS: 39b3. を使用
     してください。

 -- データ: ssl.PROTOCOL_SSLv3

     チャンネル暗号化プロトコルとしてSSLバージョン3を選択します。

     このプロトコルは、 OpenSSL が ‘no-ssl3’ オプションをつけてコンパイ
     ルされている場合には利用できません。

          警告: SSL version 3 は非セキュアです。このプロトコルは強く非推
          奨です。

     バージョン 3.6 で非推奨: OpenSSL has deprecated all version
     specific protocols.  Use the default protocol *note
     PROTOCOL_TLS_SERVER: a73. or *note PROTOCOL_TLS_CLIENT: a72. with
     *note SSLContext.minimum_version: a70. and *note
     SSLContext.maximum_version: a71. instead.

 -- データ: ssl.PROTOCOL_TLSv1

     チャンネル暗号化プロトコルとしてTLSバージョン1.0を選択します。

     バージョン 3.6 で非推奨: OpenSSL has deprecated all version
     specific protocols.

 -- データ: ssl.PROTOCOL_TLSv1_1

     チャンネル暗号化プロトコルとしてTLSバージョン1.1を選択します。
     openssl version 1.0.1+ のみで利用可能です。

     Added in version 3.4.

     バージョン 3.6 で非推奨: OpenSSL has deprecated all version
     specific protocols.

 -- データ: ssl.PROTOCOL_TLSv1_2

     チャンネル暗号化プロトコルとしてTLSバージョン 1.2 を選択します。
     openssl version 1.0.1+ のみで利用可能です。

     Added in version 3.4.

     バージョン 3.6 で非推奨: OpenSSL has deprecated all version
     specific protocols.

 -- データ: ssl.OP_ALL

     相手にする SSL 実装のさまざまなバグを回避するためのワークアラウンド
     を有効にします。このオプションはデフォルトで有効です。これを有効に
     する場合 OpenSSL 用の同じ意味のフラグ ‘SSL_OP_ALL’ をセットする必要
     はありません。

     Added in version 3.2.

 -- データ: ssl.OP_NO_SSLv2

     SSLv2 接続が行われないようにします。このオプションは *note
     PROTOCOL_TLS: 39b3. と組み合わされている場合にのみ適用されます。ピ
     アがプロトコルバージョンとして SSLv2 を選択しないようにします。

     Added in version 3.2.

     バージョン 3.6 で非推奨: SSLv2 は非推奨です

 -- データ: ssl.OP_NO_SSLv3

     SSLv3 接続が行われないようにします。このオプションは *note
     PROTOCOL_TLS: 39b3. と組み合わされている場合にのみ適用されます。ピ
     アがプロトコルバージョンとして SSLv3 を選択しないようにします。

     Added in version 3.2.

     バージョン 3.6 で非推奨: SSLv3 は非推奨です

 -- データ: ssl.OP_NO_TLSv1

     TLSv1 接続が行われないようにします。このオプションは *note
     PROTOCOL_TLS: 39b3. と組み合わされている場合にのみ適用されます。ピ
     アがプロトコルバージョンとして TLSv1 を選択しないようにします。

     Added in version 3.2.

     バージョン 3.7 で非推奨: The option is deprecated since OpenSSL
     1.1.0, use the new *note SSLContext.minimum_version: a70. and *note
     SSLContext.maximum_version: a71. instead.

 -- データ: ssl.OP_NO_TLSv1_1

     TLSv1.1 接続が行われないようにします。このオプションは *note
     PROTOCOL_TLS: 39b3. と組み合わされている場合にのみ適用されます。ピ
     アがプロトコルバージョンとして TLSv1.1 を選択しないようにします。
     openssl バージョン 1.0.1 以降でのみ利用できます。

     Added in version 3.4.

     バージョン 3.7 で非推奨: The option is deprecated since OpenSSL
     1.1.0.

 -- データ: ssl.OP_NO_TLSv1_2

     TLSv1.2 接続が行われないようにします。このオプションは *note
     PROTOCOL_TLS: 39b3. と組み合わされている場合にのみ適用されます。ピ
     アがプロトコルバージョンとして TLSv1.2 を選択しないようにします。
     openssl バージョン 1.0.1 以降でのみ利用できます。

     Added in version 3.4.

     バージョン 3.7 で非推奨: The option is deprecated since OpenSSL
     1.1.0.

 -- データ: ssl.OP_NO_TLSv1_3

     Prevents a TLSv1.3 connection.  This option is only applicable in
     conjunction with *note PROTOCOL_TLS: 39b3.  It prevents the peers
     from choosing TLSv1.3 as the protocol version.  TLS 1.3 is
     available with OpenSSL 1.1.1 or later.  When Python has been
     compiled against an older version of OpenSSL, the flag defaults to
     '0'.

     Added in version 3.6.3.

     バージョン 3.7 で非推奨: The option is deprecated since OpenSSL
     1.1.0.  It was added to 2.7.15 and 3.6.3 for backwards
     compatibility with OpenSSL 1.0.2.

 -- データ: ssl.OP_NO_RENEGOTIATION

     Disable all renegotiation in TLSv1.2 and earlier.  Do not send
     HelloRequest messages, and ignore renegotiation requests via
     ClientHello.

     このオプションは OpenSSL 1.1.0h 以降のみで使用できます。

     Added in version 3.7.

 -- データ: ssl.OP_CIPHER_SERVER_PREFERENCE

     暗号の優先順位として、クライアントのものではなくサーバのものを使い
     ます。このオプションはクライアントソケットと SSLv2 のサーバソケット
     では効果はありません。

     Added in version 3.3.

 -- データ: ssl.OP_SINGLE_DH_USE

     Prevents reuse of the same DH key for distinct SSL sessions.  This
     improves forward secrecy but requires more computational resources.
     This option only applies to server sockets.

     Added in version 3.3.

 -- データ: ssl.OP_SINGLE_ECDH_USE

     Prevents reuse of the same ECDH key for distinct SSL sessions.
     This improves forward secrecy but requires more computational
     resources.  This option only applies to server sockets.

     Added in version 3.3.

 -- データ: ssl.OP_ENABLE_MIDDLEBOX_COMPAT

     Send dummy Change Cipher Spec (CCS) messages in TLS 1.3 handshake
     to make a TLS 1.3 connection look more like a TLS 1.2 connection.

     このオプションは OpenSSL 1.1.1 以降のみで使用できます。

     Added in version 3.8.

 -- データ: ssl.OP_NO_COMPRESSION

     SSL チャネルでの圧縮を無効にします。これはアプリケーションのプロト
     コルが自身の圧縮方法をサポートする場合に有用です。

     Added in version 3.3.

 -- クラス: ssl.Options

     OP_* 定数の *note enum.IntFlag: e9a. コレクションです。

 -- データ: ssl.OP_NO_TICKET

     クライアントサイドがセッションチケットをリクエストしないようにしま
     す。

     Added in version 3.6.

 -- データ: ssl.OP_IGNORE_UNEXPECTED_EOF

     Ignore unexpected shutdown of TLS connections.

     このオプションは OpenSSL 3.0.0以降のみで使用できます。

     Added in version 3.10.

 -- データ: ssl.OP_ENABLE_KTLS

     Enable the use of the kernel TLS. To benefit from the feature,
     OpenSSL must have been compiled with support for it, and the
     negotiated cipher suites and extensions must be supported by it (a
     list of supported ones may vary by platform and kernel version).

     Note that with enabled kernel TLS some cryptographic operations are
     performed by the kernel directly and not via any available OpenSSL
     Providers.  This might be undesirable if, for example, the
     application requires all cryptographic operations to be performed
     by the FIPS provider.

     このオプションは OpenSSL 3.0.0以降のみで使用できます。

     Added in version 3.12.

 -- データ: ssl.OP_LEGACY_SERVER_CONNECT

     Allow legacy insecure renegotiation between OpenSSL and unpatched
     servers only.

     Added in version 3.12.

 -- データ: ssl.HAS_ALPN

     OpenSSL ライブラリが、組み込みで RFC 7301(1) で記述されている
     'Application-Layer Protocol Negotiation' TLS 拡張をサポートしている
     かどうか。

     Added in version 3.5.

 -- データ: ssl.HAS_NEVER_CHECK_COMMON_NAME

     Whether the OpenSSL library has built-in support not checking
     subject common name and *note
     SSLContext.hostname_checks_common_name: d76. is writeable.

     Added in version 3.7.

 -- データ: ssl.HAS_ECDH

     OpenSSL ライブラリが、組み込みの楕円曲線ディフィー・ヘルマン鍵共有
     をサポートしているかどうか。これは、ディストリビュータが明示的に無
     効にしていない限りは、真であるはずです。

     Added in version 3.3.

 -- データ: ssl.HAS_SNI

     OpenSSL ライブラリが、組み込みで ( RFC 6066(2) で記述されている)
     'Server Name Indication' 拡張をサポートしているかどうか。

     Added in version 3.2.

 -- データ: ssl.HAS_NPN

     OpenSSL ライブラリが、組み込みで、Application Layer Protocol
     Negotiation(3) で記述されている 'Next Protocol Negotiation' をサポ
     ートしているかどうか。 true であれば、サポートしたいプロトコルを
     *note SSLContext.set_npn_protocols(): 358. メソッドで提示することが
     できます。

     Added in version 3.3.

 -- データ: ssl.HAS_SSLv2

     OpenSSL ライブラリが、組み込みで SSL 2.0 プロトコルをサポートしてい
     るかどうか。

     Added in version 3.7.

 -- データ: ssl.HAS_SSLv3

     OpenSSL ライブラリが、組み込みで SSL 3.0 プロトコルをサポートしてい
     るかどうか。

     Added in version 3.7.

 -- データ: ssl.HAS_TLSv1

     OpenSSL ライブラリが、組み込みで TLS 1.0 プロトコルをサポートしてい
     るかどうか。

     Added in version 3.7.

 -- データ: ssl.HAS_TLSv1_1

     OpenSSL ライブラリが、組み込みで TLS 1.1 プロトコルをサポートしてい
     るかどうか。

     Added in version 3.7.

 -- データ: ssl.HAS_TLSv1_2

     OpenSSL ライブラリが、組み込みで TLS 1.2 プロトコルをサポートしてい
     るかどうか。

     Added in version 3.7.

 -- データ: ssl.HAS_TLSv1_3

     OpenSSL ライブラリが、組み込みで TLS 1.3 プロトコルをサポートしてい
     るかどうか。

     Added in version 3.7.

 -- データ: ssl.HAS_PSK

     Whether the OpenSSL library has built-in support for TLS-PSK.

     Added in version 3.13.

 -- データ: ssl.HAS_PHA

     Whether the OpenSSL library has built-in support for TLS-PHA.

     Added in version 3.14.

 -- データ: ssl.CHANNEL_BINDING_TYPES

     サポートされている TLS のチャネルバインディングのタイプのリスト。リ
     スト内の文字列は *note SSLSocket.get_channel_binding(): 135c. の引
     数に渡せます。

     Added in version 3.3.

 -- データ: ssl.OPENSSL_VERSION

     インタプリタによってロードされた OpenSSL ライブラリのバージョン文字
     列:

          >>> ssl.OPENSSL_VERSION
          'OpenSSL 1.0.2k  26 Jan 2017'

     Added in version 3.2.

 -- データ: ssl.OPENSSL_VERSION_INFO

     OpenSSL ライブラリのバージョン情報を表す5つの整数のタプル:

          >>> ssl.OPENSSL_VERSION_INFO
          (1, 0, 2, 11, 15)

     Added in version 3.2.

 -- データ: ssl.OPENSSL_VERSION_NUMBER

     1つの整数の形式の、 OpenSSL ライブラリの生のバージョン番号:

          >>> ssl.OPENSSL_VERSION_NUMBER
          268443839
          >>> hex(ssl.OPENSSL_VERSION_NUMBER)
          '0x100020bf'

     Added in version 3.2.

 -- データ: ssl.ALERT_DESCRIPTION_HANDSHAKE_FAILURE
 -- データ: ssl.ALERT_DESCRIPTION_INTERNAL_ERROR

 -- データ: ALERT_DESCRIPTION_*

     RFC 5246(4) その他からのアラートの種類です。 IANA TLS Alert
     Registry(5) にはこのリストとその意味が定義された RFC へのリファレン
     スが含まれています。

     *note SSLContext.set_servername_callback(): 11b9. でのコールバック
     関数の戻り値として使われます。

     Added in version 3.4.

 -- クラス: ssl.AlertDescription

     ALERT_DESCRIPTION_* 定数の *note enum.IntEnum: edb. コレクションで
     す。

     Added in version 3.6.

 -- データ: Purpose.SERVER_AUTH

     *note create_default_context(): 480. と *note
     SSLContext.load_default_certs(): 11b4. に渡すオプションです。この値
     はコンテキストが web サーバの認証に使われることを示します (ですので
     、クライアントサイドのソケットを作るのに使うことになるでしょう)。

     Added in version 3.4.

 -- データ: Purpose.CLIENT_AUTH

     *note create_default_context(): 480. と *note
     SSLContext.load_default_certs(): 11b4. に渡すオプションです。この値
     はコンテキストが web クライアントの認証に使われることを示します (で
     すので、サーバサイドのソケットを作るのに使うことになるでしょう)。

     Added in version 3.4.

 -- クラス: ssl.SSLErrorNumber

     SSL_ERROR_* 定数の *note enum.IntEnum: edb. コレクションです。

     Added in version 3.6.

 -- クラス: ssl.TLSVersion

     *note enum.IntEnum: edb. collection of SSL and TLS versions for
     *note SSLContext.maximum_version: a71. and *note
     SSLContext.minimum_version: a70.

     Added in version 3.7.

 -- の属性: TLSVersion.MINIMUM_SUPPORTED

 -- の属性: TLSVersion.MAXIMUM_SUPPORTED

     The minimum or maximum supported SSL or TLS version.  These are
     magic constants.  Their values don't reflect the lowest and highest
     available TLS/SSL versions.

 -- の属性: TLSVersion.SSLv3

 -- の属性: TLSVersion.TLSv1

 -- の属性: TLSVersion.TLSv1_1

 -- の属性: TLSVersion.TLSv1_2

 -- の属性: TLSVersion.TLSv1_3

     SSL 3.0 to TLS 1.3.

     バージョン 3.10 で非推奨: All *note TLSVersion: 39e3. members
     except *note TLSVersion.TLSv1_2: 39e9. and *note
     TLSVersion.TLSv1_3: 39ea. are deprecated.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc7301.html

   (2) https://datatracker.ietf.org/doc/html/rfc6066.html

   (3) 
https://en.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation

   (4) https://datatracker.ietf.org/doc/html/rfc5246.html

   (5) 
https://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6


File: python.info,  Node: SSL ソケット,  Next: SSL コンテキスト,  Prev: 関数、定数、例外,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.19.3.8 SSL ソケット
.....................

 -- クラス: ssl.SSLSocket (socket.socket)

     SSL ソケットは *note socket オブジェクト: 3991. の以下のメソッドを
     提供します:

        - *note accept(): fa2.

        - *note bind(): 12d7.

        - *note close(): f3f.

        - *note connect(): fa3.

        - *note detach(): 1435.

        - *note fileno(): 399f.

        - *note getpeername(): 38d9, *note getsockname(): 284.

        - *note getsockopt(): ed0, *note setsockopt(): ed1.

        - *note gettimeout(): 39a0, *note settimeout(): 3951, *note
          setblocking(): 303c.

        - *note listen(): 105e.

        - *note makefile(): 13b7.

        - *note recv(): fa4, *note recv_into(): 1535. (but passing a
          non-zero ‘flags’ argument is not allowed)

        - *note send(): fa7, *note sendall(): fa8. (with the same
          limitation)

        - *note sendfile(): 105d. (but *note os.sendfile: d05. will be
          used for plain-text sockets only, else *note send(): fa7. will
          be used)

        - *note shutdown(): 398e.

     SSL(およびTLS)プロトコルは TCP の上に独自の枠組みを持っているので、
     SSLソケットの抽象化は、いくつかの点で通常の OSレベルのソケットの仕
     様から逸脱することがあります。特に *note
     ノンブロッキングソケットについての注釈: 39b6. を参照してください。

     *note SSLSocket: ae7. のインスタンスは *note
     SSLContext.wrap_socket(): 748. メソッドを使用して作成されなければな
     りません。

     バージョン 3.5 で変更: ‘sendfile()’ メソッドが追加されました。

     バージョン 3.5 で変更: ‘shutdown()’ は、バイトが送受信されるたびに
     ソケットのタイムアウトをリセットしません。ソケットのタイムアウトは
     、シャットダウンの最大合計時間になりました。

     バージョン 3.6 で非推奨: *note SSLSocket: ae7. インスタンスを直接作
     成することは非推奨です。ソケットをラップするために *note
     SSLContext.wrap_socket(): 748. を使用してください。

     バージョン 3.7 で変更: *note SSLSocket: ae7. instances must to
     created with *note wrap_socket(): 748.  In earlier versions, it was
     possible to create instances directly.  This was never documented
     or officially supported.

     バージョン 3.10 で変更: Python now uses ‘SSL_read_ex’ and
     ‘SSL_write_ex’ internally.  The functions support reading and
     writing of data larger than 2 GB. Writing zero-length data no
     longer fails with a protocol violation error.

SSL ソケットには、以下に示す追加のメソッドと属性もあります:

 -- メソッド: SSLSocket.read (len=1024, buffer=None)

     SSL ソケットからデータの 'len' バイトまでを読み出し、読み出した結果
     を ‘bytes’ インスタンスで返します。 'buffer' を指定すると、結果は代
     わりに buffer に読み込まれ、読み込んだバイト数を返します。

     ソケットが *note non-blocking: 39b6. で読み出しがブロックすると、
     *note SSLWantReadError: 1069. もしくは *note SSLWantWriteError:
     106a. が送出されます。

     再ネゴシエーションがいつでも可能なので、 *note read(): 106e. の呼び
     出しは書き込み操作も引き起こしえます。

     バージョン 3.5 で変更: ソケットのタイムアウトは、バイトが送受信され
     るたびにリセットされなくなりました。ソケットのタイムアウトは、最大
     'len' バイトを読むのにかかる最大合計時間になりました。

     バージョン 3.6 で非推奨: *note read(): 106e. の代わりに ‘recv()’ を
     使用してください。

 -- メソッド: SSLSocket.write (data)

     Write 'data' to the SSL socket and return the number of bytes
     written.  The 'data' argument must be an object supporting the
     buffer interface.

     ソケットが *note non-blocking: 39b6. で書き込みがブロックすると、
     *note SSLWantReadError: 1069. もしくは *note SSLWantWriteError:
     106a. が送出されます。

     再ネゴシエーションがいつでも可能なので、 *note write(): 106f. の呼
     び出しは読み出し操作も引き起こしえます。

     バージョン 3.5 で変更: The socket timeout is no longer reset each
     time bytes are received or sent.  The socket timeout is now the
     maximum total duration to write 'data'.

     バージョン 3.6 で非推奨: *note write(): 106f. の代わりに ‘send()’ を
     使用してください。

     注釈: *note read(): 106e, *note write(): 106f. メソッドは下位レベル
     のメソッドであり、暗号化されていないアプリケーションレベルのデータ
     を読み書きし、それを復号/暗号化して暗号化された書き込みレベルのデー
     タにします。これらのメソッドはアクティブな SSL 接続つまり、ハンドシ
     ェイクが完了していて、 *note SSLSocket.unwrap(): 39ec. が呼ばれてい
     ないことを必要とします。

     通常はこれらのメソッドの代わりに *note recv(): fa4. や *note
     send(): fa7. のようなソケット API メソッドを使うべきです。

 -- メソッド: SSLSocket.do_handshake (block=False)

     SSL セットアップのハンドシェイクを実行します。

     If 'block' is true and the timeout obtained by *note gettimeout():
     39a0. is zero, the socket is set in blocking mode until the
     handshake is performed.

     バージョン 3.4 で変更: The handshake method also performs
     ‘match_hostname()’ when the *note check_hostname: 39c4. attribute
     of the socket's *note context: 39ed. is true.

     バージョン 3.5 で変更: ソケットのタイムアウトは、バイトが送受信され
     るたびにリセットされなくなりました。ソケットのタイムアウトは、ハン
     ドシェイクにかかる最大合計時間になりました。

     バージョン 3.7 で変更: Hostname or IP address is matched by OpenSSL
     during handshake.  The function ‘match_hostname()’ is no longer
     used.  In case OpenSSL refuses a hostname or IP address, the
     handshake is aborted early and a TLS alert message is sent to the
     peer.

 -- メソッド: SSLSocket.getpeercert (binary_form=False)

     接続先に証明書が無い場合、 ‘None’ を返します。SSL ハンドシェイクが
     まだ行われていない場合は、 *note ValueError: 2ec. が送出されます。

     ‘binary_form’ が *note False: d2b. で接続先から証明書を取得した場合
     、このメソッドは *note dict: 183. のインスタンスを返します。証明書
     が認証されていない場合、辞書は空です。証明書が認証されていた場合い
     くつかのキーを持った辞書を返し、 ‘subject’ (証明書が発行された
     principal), ‘issuer’ (証明書を発行した principal) を含みます。証明
     書が 'Subject Alternative Name' 拡張( RFC 3280(1) を参照)のインスタ
     ンスを格納していた場合、 ‘subjectAltName’ キーも辞書に含まれます。

     ‘subject’, ‘issuer’ フィールドは、証明書のそれぞれのフィールドにつ
     いてのデータ構造で与えられる RDN (relative distinguishued name) の
     シーケンスを格納したタプルで、各 RDN は name-value ペアのシーケンス
     です。現実世界での例をお見せします:

          {'issuer': ((('countryName', 'IL'),),
                      (('organizationName', 'StartCom Ltd.'),),
                      (('organizationalUnitName',
                        'Secure Digital Certificate Signing'),),
                      (('commonName',
                        'StartCom Class 2 Primary Intermediate Server CA'),)),
           'notAfter': 'Nov 22 08:15:19 2013 GMT',
           'notBefore': 'Nov 21 03:09:52 2011 GMT',
           'serialNumber': '95F0',
           'subject': ((('description', '571208-SLe257oHY9fVQ07Z'),),
                       (('countryName', 'US'),),
                       (('stateOrProvinceName', 'California'),),
                       (('localityName', 'San Francisco'),),
                       (('organizationName', 'Electronic Frontier Foundation, Inc.'),),
                       (('commonName', '*.eff.org'),),
                       (('emailAddress', 'hostmaster@eff.org'),)),
           'subjectAltName': (('DNS', '*.eff.org'), ('DNS', 'eff.org')),
           'version': 3}

     ‘binary_form’ 引数が *note True: e07. だった場合、証明書が渡されて
     いればこのメソッドはDERエンコードされた証明書全体をバイト列として返
     し、接続先が証明書を提示しなかった場合は *note None: 885. を返しま
     す。接続先が証明書を提供するかどうかは SSL ソケットの役割に依存しま
     す:

        * クライアント SSL ソケットでは、認証が要求されているかどうかに
          関わらず、サーバは常に証明書を提供します。

        * サーバ SSL ソケットでは、クライアントはサーバによって認証が要
          求されている場合にのみ証明書を提供します。したがって、 (*note
          CERT_OPTIONAL: 39c3. や *note CERT_REQUIRED: 39b1. ではなく)
          *note CERT_NONE: 39c2. を使用した場合 *note getpeercert():
          11ba. は *note None: 885. を返します。

     See also *note SSLContext.check_hostname: 39c4.

     バージョン 3.2 で変更: 返される辞書に ‘issuer’, ‘notBefore’ のよう
     な追加アイテムを含むようになりました。

     バージョン 3.4 で変更: ハンドシェイクが済んでいなければ *note
     ValueError: 2ec. を投げるようになりました。返される辞書に
     ‘crlDistributionPoints’, ‘caIssuers’, ‘OCSP’ URI のような X509v3 拡
     張アイテムを含むようになりました。

     バージョン 3.9 で変更: IPv6 address strings no longer have a
     trailing new line.

 -- メソッド: SSLSocket.get_verified_chain ()

     Returns verified certificate chain provided by the other end of the
     SSL channel as a list of DER-encoded bytes.  If certificate
     verification was disabled method acts the same as *note
     get_unverified_chain(): 195d.

     Added in version 3.13.

 -- メソッド: SSLSocket.get_unverified_chain ()

     Returns raw certificate chain provided by the other end of the SSL
     channel as a list of DER-encoded bytes.

     Added in version 3.13.

 -- メソッド: SSLSocket.cipher ()

     利用されている暗号の名前、その暗号の利用を定義しているSSLプロトコル
     のバージョン、利用されている鍵のbit長の3つの値を含むタプルを返しま
     す。もし接続が確立されていない場合、 ‘None’ を返します。

 -- メソッド: SSLSocket.shared_ciphers ()

     クライアントとサーバーの両方で利用できる暗号方式のリストを返します
     。返されるリストの各要素は 3つの値を含むタプルで、その値はそれぞれ
     、暗号方式の名前、その暗号の利用を定義している SSL プロトコルのバー
     ジョン、暗号で使用される秘密鍵のビット長です。接続が確立されていな
     いか、ソケットがクライアントソケットである場合、*note
     shared_ciphers(): 106c. は ‘None’ を返します。

     Added in version 3.5.

 -- メソッド: SSLSocket.compression ()

     使われている圧縮アルゴリズムを文字列で返します。接続が圧縮されてい
     なければ ‘None’ を返します。

     上位レベルのプロトコルが自身で圧縮メカニズムをサポートする場合、SSL
     レベルでの圧縮を *note OP_NO_COMPRESSION: 135e. を使って無効にでき
     ます。

     Added in version 3.3.

 -- メソッド: SSLSocket.get_channel_binding (cb_type='tls-unique')

     現在の接続におけるチャネルバインディングのデータを取得します。未接
     続あるいはハンドシェイクが完了していなければ ‘None’ を返します。

     'cb_type' パラメータにより、望みのチャネルバインディングのタイプを
     選択できます。チャネルバインディングのタイプの妥当なものは *note
     CHANNEL_BINDING_TYPES: 39de. でリストされています。現在のところは
     RFC 5929(2) で定義されている 'tls-unique' のみがサポートされていま
     す。未サポートのチャネルバインディングのタイプが要求された場合、
     *note ValueError: 2ec. を送出します。

     Added in version 3.3.

 -- メソッド: SSLSocket.selected_alpn_protocol ()

     TLS ハンドシェイクで選択されたプロトコルを返します。 *note
     SSLContext.set_alpn_protocols(): 1064. が呼ばれていない場合、相手側
     が ALPN をサポートしていない場合、クライアントが提案したプロトコル
     のどれもソケットがサポートしない場合、あるいはハンドシェイクがまだ
     行われていない場合には、 ‘None’ が返されます。

     Added in version 3.5.

 -- メソッド: SSLSocket.selected_npn_protocol ()

     TLS/SSL ハンドシェイクで選択された上位レベルのプロトコルを返します
     。 *note SSLContext.set_npn_protocols(): 358. が呼ばれていない場合
     、相手側が NPN をサポートしていない場合、あるいはハンドシェイクがま
     だ行われていない場合には、 ‘None’ が返されます。

     Added in version 3.3.

     バージョン 3.10 で非推奨: NPN has been superseded by ALPN

 -- メソッド: SSLSocket.unwrap ()

     SSLシャットダウンハンドシェイクを実行します。これは下位レイヤーのソ
     ケットからTLSレイヤーを取り除き、下位レイヤーのソケットオブジェクト
     を返します。これは暗号化されたオペレーションから暗号化されていない
     接続に移行するときに利用されます。以降の通信には、オリジナルのソケ
     ットではなくこのメソッドが返したソケットのみを利用するべきです。

 -- メソッド: SSLSocket.verify_client_post_handshake ()

     Requests post-handshake authentication (PHA) from a TLS 1.3 client.
     PHA can only be initiated for a TLS 1.3 connection from a
     server-side socket, after the initial TLS handshake and with PHA
     enabled on both sides, see *note SSLContext.post_handshake_auth:
     c26.

     The method does not perform a cert exchange immediately.  The
     server-side sends a CertificateRequest during the next write event
     and expects the client to respond with a certificate on the next
     read event.

     If any precondition isn't met (e.g.  not TLS 1.3, PHA not enabled),
     an *note SSLError: 1491. is raised.

          注釈: Only available with OpenSSL 1.1.1 and TLS 1.3 enabled.
          Without TLS 1.3 support, the method raises *note
          NotImplementedError: 36b.

     Added in version 3.8.

 -- メソッド: SSLSocket.version ()

     コネクションによって実際にネゴシエイトされた SSL プロトコルバージョ
     ンを文字列で、または、セキュアなコネクションが確立していなければ
     ‘None’ を返します。これを書いている時点では、 ‘"SSLv2"’, ‘"SSLv3"’,
     ‘"TLSv1"’, ‘"TLSv1.1"’, ‘"TLSv1.2"’ などが返ります。最新の OpenSSL
     はもっと色々な値を定義しているかもしれません。

     Added in version 3.5.

 -- メソッド: SSLSocket.pending ()

     接続において既に復号済みで読み出し可能で保留になっているバイト列の
     数を返します。

 -- の属性: SSLSocket.context

     The *note SSLContext: 357. object this SSL socket is tied to.

     Added in version 3.2.

 -- の属性: SSLSocket.server_side

     サーバサイドのソケットに対して ‘True’ 、クライアントサイドのソケッ
     トに対して ‘False’ となる真偽値です。

     Added in version 3.2.

 -- の属性: SSLSocket.server_hostname

     サーバのホスト名: *note str: 169. 型、またはサーバサイドのソケット
     の場合とコンストラクタで hostname が指定されなかった場合は ‘None’

     Added in version 3.2.

     バージョン 3.7 で変更: The attribute is now always ASCII text.
     When ‘server_hostname’ is an internationalized domain name (IDN),
     this attribute now stores the A-label form (‘"xn--pythn-mua.org"’),
     rather than the U-label form (‘"pythön.org"’).

 -- の属性: SSLSocket.session

     この SSL 接続に対する *note SSLSession: ed9. です。このセッションは
     、TLS ハンドシェイクの実行後、クライアントサイドとサーバサイドのソ
     ケットで使用できます。クライアントソケットでは、このセッションを
     *note do_handshake(): 106d. が呼ばれる前に設定して、セッションを再
     利用できます。

     Added in version 3.6.

 -- の属性: SSLSocket.session_reused

     Added in version 3.6.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc3280.html

   (2) https://datatracker.ietf.org/doc/html/rfc5929.html


File: python.info,  Node: SSL コンテキスト,  Next: 証明書,  Prev: SSL ソケット,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.19.3.9 SSL コンテキスト
.........................

Added in version 3.2.

SSL コンテキストは、SSL 構成オプション、証明書(群)や秘密鍵(群)などのよう
な、一回の SSL 接続よりも長生きするさまざまなデータを保持します。これは
サーバサイドソケットの SSL セッションのキャッシュも管理し、同じクライア
ントからの繰り返しの接続時の速度向上に一役買います。

 -- クラス: ssl.SSLContext (protocol=None)

     Create a new SSL context.  You may pass 'protocol' which must be
     one of the ‘PROTOCOL_*’ constants defined in this module.  The
     parameter specifies which version of the SSL protocol to use.
     Typically, the server chooses a particular protocol version, and
     the client must adapt to the server's choice.  Most of the versions
     are not interoperable with the other versions.  If not specified,
     the default is *note PROTOCOL_TLS: 39b3.; it provides the most
     compatibility with other versions.

     次のテーブルは、どのクライアントのバージョンがどのサーバのバージョ
     ンに接続できるかを示しています:

     'client' / 'server'          'SSLv2'          'SSLv3'          'TLS' (1)         'TLSv1'       'TLSv1.1'       'TLSv1.2'
                                                                                                                    
                                                                                                                    
     'SSLv2'                      yes              no               no (2)            no            no              no
                                                                                                                    
                                                                                                                    
     'SSLv3'                      no               yes              no (3)            no            no              no
                                                                                                                    
                                                                                                                    
     'TLS' ('SSLv23') (4)         no (5)           no (6)           yes               yes           yes             yes
                                                                                                                    
                                                                                                                    
     'TLSv1'                      no               no               yes               yes           no              no
                                                                                                                    
                                                                                                                    
     'TLSv1.1'                    no               no               yes               no            yes             no
                                                                                                                    
                                                                                                                    
     'TLSv1.2'                    no               no               yes               no            no              yes
                                                                                                                    

     脚注
     ....

     参考
     ....

     *note create_default_context(): 480. lets the ‘ssl’ module choose
     security settings for a given purpose.

     バージョン 3.6 で変更: The context is created with secure default
     values.  The options *note OP_NO_COMPRESSION: 135e, *note
     OP_CIPHER_SERVER_PREFERENCE: 1361, *note OP_SINGLE_DH_USE: 39cf,
     *note OP_SINGLE_ECDH_USE: 39d0, *note OP_NO_SSLv2: a3a, and *note
     OP_NO_SSLv3: a3b. (except for *note PROTOCOL_SSLv3: 39be.) are set
     by default.  The initial cipher suite list contains only ‘HIGH’
     ciphers, no ‘NULL’ ciphers and no ‘MD5’ ciphers.

     バージョン 3.10 で非推奨: *note SSLContext: 357. without protocol
     argument is deprecated.  The context class will either require
     *note PROTOCOL_TLS_CLIENT: a72. or *note PROTOCOL_TLS_SERVER: a73.
     protocol in the future.

     バージョン 3.10 で変更: The default cipher suites now include only
     secure AES and ChaCha20 ciphers with forward secrecy and security
     level 2.  RSA and DH keys with less than 2048 bits and ECC keys
     with less than 224 bits are prohibited.  *note PROTOCOL_TLS: 39b3,
     *note PROTOCOL_TLS_CLIENT: a72, and *note PROTOCOL_TLS_SERVER: a73.
     use TLS 1.2 as minimum TLS version.

          注釈: *note SSLContext: 357. only supports limited mutation
          once it has been used by a connection.  Adding new
          certificates to the internal trust store is allowed, but
          changing ciphers, verification settings, or mTLS certificates
          may result in surprising behavior.

          注釈: *note SSLContext: 357. is designed to be shared and used
          by multiple connections.  Thus, it is thread-safe as long as
          it is not reconfigured after being used by a connection.

*note SSLContext: 357. オブジェクトは以下のメソッドと属性を持っています:

 -- メソッド: SSLContext.cert_store_stats ()

     ロードされた X.509 証明書の数、CA 証明書で活性の X.509 証明書の数、
     証明書失効リストの数、についての統計情報を辞書として取得します。

     一つの CA と他の一つの証明書を持ったコンテキストでの例です:

          >>> context.cert_store_stats()
          {'crl': 0, 'x509_ca': 1, 'x509': 2}

     Added in version 3.4.

 -- メソッド: SSLContext.load_cert_chain (certfile, keyfile=None,
          password=None)

     秘密鍵と対応する証明書をロードします。 'certfile' は、証明書と、証
     明書認証で必要とされる任意の数の CA 証明書を含む、PEM フォーマット
     の単一ファイルへのパスでなければなりません。 'keyfile' 文字列を指定
     する場合、秘密鍵が含まれるファイルを指すものでなければなりません。
     指定しない場合、秘密鍵も 'certfile' から取得されます。 'certfile' へ
     の証明書の格納についての詳細は、 *note 証明書: 39f2. の議論を参照し
     てください。

     'password' 引数に、秘密鍵を復号するためのパスワードを返す関数を与え
     ることができます。その関数は秘密鍵が暗号化されていて、なおかつパス
     ワードが必要な場合にのみ呼び出されます。その関数は引数なしで呼び出
     され、string, bytes, または bytearray を返さなければなりません。戻
     り値が string の場合は鍵を復号化するのに使う前に UTF-8 でエンコード
     されます。string の代わりに bytes や bytearray を返した場合は
     'password' 引数に直接供給されます。秘密鍵が暗号化されていなかったり
     パスワードを必要としない場合は、指定は無視されます。

     'password' が与えられず、そしてパスワードが必要な場合には、OpenSSL
     組み込みのパスワード問い合わせメカニズムが、ユーザに対話的にパスワ
     ードを問い合わせます。

     秘密鍵が証明書に合致しなければ、 *note SSLError: 1491. が送出されま
     す。

     バージョン 3.3 で変更: 新しいオプション引数 'password'。

 -- メソッド: SSLContext.load_default_certs
          (purpose=Purpose.SERVER_AUTH)

     デフォルトの場所から "認証局" (CA=certification authority) 証明書フ
     ァイル一式をロードします。Windows では、CA 証明書はシステム記憶域の
     ‘CA’ と ‘ROOT’ からロードします。全てのシステムでは、この関数は
     *note SSLContext.set_default_verify_paths(): 11ad. を呼び出します。
     将来的にはこのメソッドは、他の場所からも CA 証明書をロードするかも
     しれません。

     The 'purpose' flag specifies what kind of CA certificates are
     loaded.  The default settings *note Purpose.SERVER_AUTH: 11b5.
     loads certificates, that are flagged and trusted for TLS web server
     authentication (client side sockets).  *note Purpose.CLIENT_AUTH:
     11b6. loads CA certificates for client certificate verification on
     the server side.

     Added in version 3.4.

 -- メソッド: SSLContext.load_verify_locations (cafile=None,
          capath=None, cadata=None)

     *note verify_mode: 39b0. が *note CERT_NONE: 39c2. でない場合に接続
     先の証明書ファイルの正当性検証に使われる "認証局" (CA=certification
     authority) 証明書ファイル一式をロードします。少なくとも 'cafile' か
     'capath' のどちらかは指定しなければなりません。

     このメソッドは PEM または DER フォーマットの証明書失効リスト
     (CRLs=certification revocation lists)もロードできます。CRLs のため
     に使うには、 *note SSLContext.verify_flags: 11b0. を適切に設定しな
     ければなりません。

     'cafile' を指定する場合は、PEM フォーマットで CA 証明書が結合された
     ファイルへのパスを指定してください。このファイル内で証明書をどのよ
     うに編成すれば良いのかについての詳しい情報については、 *note
     証明書: 39f2. の議論を参照してください。

     The 'capath' string, if present, is the path to a directory
     containing several CA certificates in PEM format, following an
     OpenSSL specific layout(7).

     'cadata' オブジェクトを指定する場合は、PEM エンコードの証明書一つ以
     上の ASCII 文字列か、DER エンコードの証明書の *note bytes-like
     object: 193. オブジェクトのどちらかを指定してください。PEM エンコー
     ドの証明書の周囲の余分な行は無視されますが、少なくとも一つの証明書
     が含まれている必要があります。

     バージョン 3.4 で変更: 新しいオプション引数 'cadata' 。

 -- メソッド: SSLContext.get_ca_certs (binary_form=False)

     ロードされた "認証局" (CA=certification authority) 証明書のリストを
     取得します。 ‘binary_form’ 引数が *note False: d2b. である場合、リ
     ストのそれぞれのエントリは *note SSLSocket.getpeercert(): 11ba. が
     出力するような辞書になります。True である場合、このメソッドは、DER
     エンコード形式の証明書のリストを返します。返却されるリストには、
     SSL 接続によって証明書がリクエストおよびロードされない限り、
     'capath' からの証明書は含まれません。

          注釈: capath ディレクトリ内の証明書は一度でも使われない限りは
          ロードされません。

     Added in version 3.4.

 -- メソッド: SSLContext.get_ciphers ()

     有効な暗号化のリストを取得します。リストは暗号化優先度順に並びます
     。*note SSLContext.set_ciphers(): 39f3. を参照してください。

     以下はプログラム例です:

          >>> ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
          >>> ctx.set_ciphers('ECDHE+AESGCM:!ECDSA')
          >>> ctx.get_ciphers()
          [{'aead': True,
            'alg_bits': 256,
            'auth': 'auth-rsa',
            'description': 'ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH     Au=RSA  '
                           'Enc=AESGCM(256) Mac=AEAD',
            'digest': None,
            'id': 50380848,
            'kea': 'kx-ecdhe',
            'name': 'ECDHE-RSA-AES256-GCM-SHA384',
            'protocol': 'TLSv1.2',
            'strength_bits': 256,
            'symmetric': 'aes-256-gcm'},
           {'aead': True,
            'alg_bits': 128,
            'auth': 'auth-rsa',
            'description': 'ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH     Au=RSA  '
                           'Enc=AESGCM(128) Mac=AEAD',
            'digest': None,
            'id': 50380847,
            'kea': 'kx-ecdhe',
            'name': 'ECDHE-RSA-AES128-GCM-SHA256',
            'protocol': 'TLSv1.2',
            'strength_bits': 128,
            'symmetric': 'aes-128-gcm'}]

     Added in version 3.6.

 -- メソッド: SSLContext.set_default_verify_paths ()

     デフォルトの "認証局" (CA=certification authority) 証明書を、
     OpenSSL ライブラリがビルドされた際に定義されたファイルシステム上の
     パスからロードします。残念ながらこのメソッドが成功したかどうかを知
     るための簡単な方法はありません: 証明書が見つからなくてもエラーは返
     りません。OpenSSL ライブラリがオペレーティングシステムの一部として
     提供されている際にはどうやら適切に構成できるようですが。

 -- メソッド: SSLContext.set_ciphers (ciphers, /)

     Set the available ciphers for sockets created with this context.
     It should be a string in the OpenSSL cipher list format(8).  If no
     cipher can be selected (because compile-time options or other
     configuration forbids use of all the specified ciphers), an *note
     SSLError: 1491. will be raised.

          注釈: 接続時に SSL ソケットの *note SSLSocket.cipher(): 38da.
          メソッドが、現在選択されているその暗号を使います。

          TLS 1.3 cipher suites cannot be disabled with *note
          set_ciphers(): 39f3.

 -- メソッド: SSLContext.set_alpn_protocols (alpn_protocols)

     SSL/TLS ハンドシェイク時にソケットが提示すべきプロトコルを指定しま
     す。 ‘['http/1.1', 'spdy/2']’ のような推奨順に並べた ASCII 文字列の
     リストでなければなりません。プロトコルの選択は RFC 7301(9) に従いハ
     ンドシェイク中に行われます。ハンドシェイクが正常に終了した後、
     *note SSLSocket.selected_alpn_protocol(): 1065. メソッドは合意され
     たプロトコルを返します。

     このメソッドは *note HAS_ALPN: 1066. が ‘False’ の場合 *note
     NotImplementedError: 36b. を送出します。

     Added in version 3.5.

 -- メソッド: SSLContext.set_npn_protocols (npn_protocols)

     SSL/TLS ハンドシェイク時にソケットが提示すべきプロトコルを指定しま
     す。 ‘['http/1.1', 'spdy/2']’ のような推奨順に並べた文字列のリスト
     でなければなりません。プロトコルの選択は Application Layer Protocol
     Negotiation(10) に従いハンドシェイク中に行われます。ハンドシェイク
     が正常に終了した後、 *note SSLSocket.selected_alpn_protocol():
     1065. メソッドは合意されたプロトコルを返します。

     このメソッドは *note HAS_NPN: 39d7. が ‘False’ の場合 *note
     NotImplementedError: 36b. を送出します。

     Added in version 3.3.

     バージョン 3.10 で非推奨: NPN has been superseded by ALPN

 -- の属性: SSLContext.sni_callback

     TLS クライアントがサーバ名表示を指定した際の、SSL/TLS サーバによっ
     て TLS Client Hello ハンドシェイクメッセージが受け取られたあとで呼
     び出されるコールバック関数を登録します。サーバ名表示メカニズムは
     RFC 6066(11) セクション 3 - Server Name Indication で述べられていま
     す。

     ‘SSLContext’ ごとに一つだけコールバックをセットできます。
     'sni_callback' を ‘None’ にすればコールバックは無効になります。この
     関数を続けて呼ぶと、以前に登録されたコールバックを上書きします。

     The callback function will be called with three arguments; the
     first being the *note ssl.SSLSocket: ae7, the second is a string
     that represents the server name that the client is intending to
     communicate (or *note None: 885. if the TLS Client Hello does not
     contain a server name) and the third argument is the original *note
     SSLContext: 357.  The server name argument is text.  For
     internationalized domain name, the server name is an IDN A-label
     (‘"xn--pythn-mua.org"’).

     このコールバックの典型的な利用方法は、 *note ssl.SSLSocket: ae7. の
     *note SSLSocket.context: 39ed. 属性を、サーバ名に合致する証明書チェ
     インを持つ新しい *note SSLContext: 357. オブジェクトに変更すること
     です。

     Due to the early negotiation phase of the TLS connection, only
     limited methods and attributes are usable like *note
     SSLSocket.selected_alpn_protocol(): 1065. and *note
     SSLSocket.context: 39ed.  The *note SSLSocket.getpeercert(): 11ba,
     *note SSLSocket.get_verified_chain(): 195c, *note
     SSLSocket.get_unverified_chain(): 195d. *note SSLSocket.cipher():
     38da. and *note SSLSocket.compression(): 135d. methods require that
     the TLS connection has progressed beyond the TLS Client Hello and
     therefore will not return meaningful values nor can they be called
     safely.

     TLS ネゴシエーションを継続させるならば、 'sni_callback' 関数は
     ‘None’ を返さなければなりません。TLS が失敗することを必要とするなら
     、 constant *note ALERT_DESCRIPTION_*: 39e0. を返してください。ここ
     にない値を返すと、致命エラー *note
     ALERT_DESCRIPTION_INTERNAL_ERROR: 39e0. を引き起こします。

     'sni_callback' 関数が例外を送出した場合、TLS 接続は TLS の致命的ア
     ラートメッセージ *note ALERT_DESCRIPTION_HANDSHAKE_FAILURE: 39df. と
     ともに終了します。

     このメソッドは OpenSSL ライブラリが OPENSSL_NO_TLSEXT を定義してビ
     ルドされている場合、 *note NotImplementedError: 36b. を送出します。

     Added in version 3.7.

 -- メソッド: SSLContext.set_servername_callback (server_name_callback)

     This is a legacy API retained for backwards compatibility.  When
     possible, you should use *note sni_callback: 1c8f. instead.  The
     given 'server_name_callback' is similar to 'sni_callback', except
     that when the server hostname is an IDN-encoded internationalized
     domain name, the 'server_name_callback' receives a decoded U-label
     (‘"pythön.org"’).

     If there is a decoding error on the server name, the TLS connection
     will terminate with an *note ALERT_DESCRIPTION_INTERNAL_ERROR:
     39e0. fatal TLS alert message to the client.

     Added in version 3.4.

 -- メソッド: SSLContext.load_dh_params (dhfile, /)

     ディフィー・ヘルマン(DH)鍵交換のための鍵生成パラメータをロードしま
     す。DH 鍵交換を用いることは、(サーバ、クライアントともに)計算機リソ
     ースに高い処理負荷をかけますがセキュリティを向上させます。 'dhfile'
     パラメータは PEM フォーマットの DH パラメータを含んだファイルへのパ
     スでなければなりません。

     この設定はクライアントソケットには適用されません。さらにセキュリテ
     ィを改善するのに *note OP_SINGLE_DH_USE: 39cf. オプションも利用でき
     ます。

     Added in version 3.3.

 -- メソッド: SSLContext.set_ecdh_curve (curve_name, /)

     楕円曲線ディフィー・ヘルマン(ECDH)鍵交換の曲線名を指定します。ECDH
     はもとの DH に較べて、ほぼ間違いなく同程度に安全である一方で、顕著
     に高速です。 'curve_name' パラメータは既知の楕円曲線を表す文字列で
     なければなりません。例えば ‘prime256v1’ が広くサポートされている曲
     線です。

     この設定はクライアントソケットには適用されません。さらにセキュリテ
     ィを改善するのに *note OP_SINGLE_ECDH_USE: 39d0. オプションも利用で
     きます。

     このメソッドは *note HAS_ECDH: 39d5. が ‘False’ の場合は利用できま
     せん。

     Added in version 3.3.

     参考
     ....

     SSL/TLS & Perfect Forward Secrecy(12)

          Vincent Bernat.

 -- メソッド: SSLContext.wrap_socket (sock, server_side=False,
          do_handshake_on_connect=True, suppress_ragged_eofs=True,
          server_hostname=None, session=None)

     Wrap an existing Python socket 'sock' and return an instance of
     *note SSLContext.sslsocket_class: 39f4. (default *note SSLSocket:
     ae7.).  The returned SSL socket is tied to the context, its
     settings and certificates.  'sock' must be a *note SOCK_STREAM:
     150b. socket; other socket types are unsupported.

     ‘server_side’ 引数は真偽値で、このソケットがサーバサイドとクライア
     ントサイドのどちらの動作をするのかを指定します。

     クライアントサイドソケットにおいて、コンテキストの生成は遅延されま
     す。つまり、低レイヤのソケットがまだ接続されていない場合、コンテキ
     ストの生成はそのソケットの ‘connect()’ メソッドが呼ばれた後に行われ
     ます。サーバサイドソケットの場合、そのソケットに接続先が居なければ
     それは listen 用ソケットだと判断されます。 ‘accept()’ メソッドで生
     成されるクライアント接続に対してのサーバサイド SSLラップは自動的に
     行われます。メソッドは *note SSLError: 1491. を送出することがありま
     す。

     クライアントからの接続では、 'server_hostname' で接続先サービスのホ
     スト名を指定できます。これは HTTP バーチャルホストにかなり似て、シ
     ングルサーバで複数の SSL ベースのサービスを別々の証明書でホストして
     いるようなサーバに対して使えます。 'server_side' が True の場合に
     'server_hostname' を指定すると *note ValueError: 2ec. を送出します
     。

     ‘do_handshake_on_connect’ 引数は、 ‘socket.connect()’ の後に自動的
     に SSLハンドシェイクを行うか、それともアプリケーションが明示的に
     *note SSLSocket.do_handshake(): 106d. メソッドを実行するかを指定し
     ます。 *note SSLSocket.do_handshake(): 106d. を明示的に呼びだすこと
     で、ハンドシェイクによるソケットI/Oのブロッキング動作を制御できます
     。

     ‘suppress_ragged_eofs’ 引数は、 ‘SSLSocket.recv()’ メソッドが、接続
     先から予期しないEOF を受け取った時に通知する方法を指定します。
     *note True: e07. (デフォルト) の場合、下位のソケットレイヤーから予
     期せぬEOFエラーが来た場合、通常のEOF (空のバイト列オブジェクト)を返
     します。 *note False: d2b. の場合、呼び出し元に例外を投げて通知しま
     す。

     'session', *note session: 193d. を参照してください。

     To wrap an *note SSLSocket: ae7. in another *note SSLSocket: ae7,
     use *note SSLContext.wrap_bio(): d7b.

     バージョン 3.5 で変更: OpenSSL が SNI をサポートしなくても
     server_hostname を許容するようになりました。

     バージョン 3.6 で変更: 'session' 引数が追加されました。

     バージョン 3.7 で変更: The method returns an instance of *note
     SSLContext.sslsocket_class: 39f4. instead of hard-coded *note
     SSLSocket: ae7.

 -- の属性: SSLContext.sslsocket_class

     The return type of *note SSLContext.wrap_socket(): 748, defaults to
     *note SSLSocket: ae7.  The attribute can be assigned to on
     instances of *note SSLContext: 357. in order to return a custom
     subclass of *note SSLSocket: ae7.

     Added in version 3.7.

 -- メソッド: SSLContext.wrap_bio (incoming, outgoing,
          server_side=False, server_hostname=None, session=None)

     Wrap the BIO objects 'incoming' and 'outgoing' and return an
     instance of *note SSLContext.sslobject_class: 39f5. (default *note
     SSLObject: d7a.).  The SSL routines will read input data from the
     incoming BIO and write data to the outgoing BIO.

     'server_side'、 'server_hostname' 、 'session' 引数は、 *note
     SSLContext.wrap_socket(): 748. での意味と同じ意味を持ちます。

     バージョン 3.6 で変更: 'session' 引数が追加されました。

     バージョン 3.7 で変更: The method returns an instance of *note
     SSLContext.sslobject_class: 39f5. instead of hard-coded *note
     SSLObject: d7a.

 -- の属性: SSLContext.sslobject_class

     The return type of *note SSLContext.wrap_bio(): d7b, defaults to
     *note SSLObject: d7a.  The attribute can be overridden on instance
     of class in order to return a custom subclass of *note SSLObject:
     d7a.

     Added in version 3.7.

 -- メソッド: SSLContext.session_stats ()

     Get statistics about the SSL sessions created or managed by this
     context.  A dictionary is returned which maps the names of each
     piece of information(13) to their numeric values.  For example,
     here is the total number of hits and misses in the session cache
     since the context was created:

          >>> stats = context.session_stats()
          >>> stats['hits'], stats['misses']
          (0, 0)

 -- の属性: SSLContext.check_hostname

     Whether to match the peer cert's hostname in *note
     SSLSocket.do_handshake(): 106d.  The context's *note verify_mode:
     39b0. must be set to *note CERT_OPTIONAL: 39c3. or *note
     CERT_REQUIRED: 39b1, and you must pass 'server_hostname' to *note
     wrap_socket(): 748. in order to match the hostname.  Enabling
     hostname checking automatically sets *note verify_mode: 39b0. from
     *note CERT_NONE: 39c2. to *note CERT_REQUIRED: 39b1.  It cannot be
     set back to *note CERT_NONE: 39c2. as long as hostname checking is
     enabled.  The *note PROTOCOL_TLS_CLIENT: a72. protocol enables
     hostname checking by default.  With other protocols, hostname
     checking must be enabled explicitly.

     以下はプログラム例です:

          import socket, ssl

          context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
          context.verify_mode = ssl.CERT_REQUIRED
          context.check_hostname = True
          context.load_default_certs()

          s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
          ssl_sock = context.wrap_socket(s, server_hostname='www.verisign.com')
          ssl_sock.connect(('www.verisign.com', 443))

     Added in version 3.4.

     バージョン 3.7 で変更: *note verify_mode: 39b0. is now
     automatically changed to *note CERT_REQUIRED: 39b1. when hostname
     checking is enabled and *note verify_mode: 39b0. is *note
     CERT_NONE: 39c2.  Previously the same operation would have failed
     with a *note ValueError: 2ec.

 -- の属性: SSLContext.keylog_filename

     Write TLS keys to a keylog file, whenever key material is generated
     or received.  The keylog file is designed for debugging purposes
     only.  The file format is specified by NSS and used by many traffic
     analyzers such as Wireshark.  The log file is opened in append-only
     mode.  Writes are synchronized between threads, but not between
     processes.

     Added in version 3.8.

 -- の属性: SSLContext.maximum_version

     A *note TLSVersion: 39e3. enum member representing the highest
     supported TLS version.  The value defaults to *note
     TLSVersion.MAXIMUM_SUPPORTED: 39e5.  The attribute is read-only for
     protocols other than *note PROTOCOL_TLS: 39b3, *note
     PROTOCOL_TLS_CLIENT: a72, and *note PROTOCOL_TLS_SERVER: a73.

     The attributes *note maximum_version: a71, *note minimum_version:
     a70. and *note SSLContext.options: a39. all affect the supported
     SSL and TLS versions of the context.  The implementation does not
     prevent invalid combination.  For example a context with *note
     OP_NO_TLSv1_2: 39cd. in *note options: a39. and *note
     maximum_version: a71. set to *note TLSVersion.TLSv1_2: 39e9. will
     not be able to establish a TLS 1.2 connection.

     Added in version 3.7.

 -- の属性: SSLContext.minimum_version

     Like *note SSLContext.maximum_version: a71. except it is the lowest
     supported version or *note TLSVersion.MINIMUM_SUPPORTED: 39e4.

     Added in version 3.7.

 -- の属性: SSLContext.num_tickets

     Control the number of TLS 1.3 session tickets of a *note
     PROTOCOL_TLS_SERVER: a73. context.  The setting has no impact on
     TLS 1.0 to 1.2 connections.

     Added in version 3.8.

 -- の属性: SSLContext.options

     このコンテキストで有効になっている SSL オプションを表す整数。デフォ
     ルトの値は *note OP_ALL: 39ca. ですが、 *note OP_NO_SSLv2: a3a. の
     ような他の値をビット OR 演算で指定できます。

     バージョン 3.6 で変更: *note SSLContext.options: a39. は次のように
     *note Options: 39d2. のフラグを返します。

          >>> ssl.create_default_context().options
          <Options.OP_ALL|OP_NO_SSLv3|OP_NO_SSLv2|OP_NO_COMPRESSION: 2197947391>

     バージョン 3.7 で非推奨: All ‘OP_NO_SSL*’ and ‘OP_NO_TLS*’ options
     have been deprecated since Python 3.7.  Use *note
     SSLContext.minimum_version: a70. and *note
     SSLContext.maximum_version: a71. instead.

 -- の属性: SSLContext.post_handshake_auth

     Enable TLS 1.3 post-handshake client authentication.
     Post-handshake auth is disabled by default and a server can only
     request a TLS client certificate during the initial handshake.
     When enabled, a server may request a TLS client certificate at any
     time after the handshake.

     When enabled on client-side sockets, the client signals the server
     that it supports post-handshake authentication.

     When enabled on server-side sockets, *note SSLContext.verify_mode:
     39b0. must be set to *note CERT_OPTIONAL: 39c3. or *note
     CERT_REQUIRED: 39b1, too.  The actual client cert exchange is
     delayed until *note SSLSocket.verify_client_post_handshake(): c27.
     is called and some I/O is performed.

     Added in version 3.8.

 -- の属性: SSLContext.protocol

     コンテキストの構築時に選択されたプロトコルバージョン。この属性は読
     み出し専用です。

 -- の属性: SSLContext.hostname_checks_common_name

     Whether *note check_hostname: 39c4. falls back to verify the cert's
     subject common name in the absence of a subject alternative name
     extension (default: true).

     Added in version 3.7.

     バージョン 3.10 で変更: The flag had no effect with OpenSSL before
     version 1.1.1l.  Python 3.8.9, 3.9.3, and 3.10 include workarounds
     for previous versions.

 -- の属性: SSLContext.security_level

     An integer representing the security level(14) for the context.
     This attribute is read-only.

     Added in version 3.10.

 -- の属性: SSLContext.verify_flags

     証明書の検証操作のためのフラグです。 *note VERIFY_CRL_CHECK_LEAF:
     11b2. などのフラグをビット OR 演算でセットできます。デフォルトでは
     OpenSSL は証明書失効リスト (CRLs) を必要としませんし検証にも使いま
     せん。

     Added in version 3.4.

     バージョン 3.6 で変更: *note SSLContext.verify_flags: 11b0. は次の
     ように *note VerifyFlags: 39c7. のフラグを返します。

          >>> ssl.create_default_context().verify_flags
          <VerifyFlags.VERIFY_X509_TRUSTED_FIRST: 32768>

 -- の属性: SSLContext.verify_mode

     接続先の証明書の検証を試みるかどうか、また、検証が失敗した場合にど
     のように振舞うべきかを制御します。この属性は *note CERT_NONE: 39c2,
     *note CERT_OPTIONAL: 39c3, *note CERT_REQUIRED: 39b1. のうちどれか
     一つでなければなりません。

     バージョン 3.6 で変更: *note SSLContext.verify_mode: 39b0. は次のよ
     うに *note VerifyMode: 39c5. enum (列挙) を返します。

          >>> ssl.create_default_context().verify_mode
          <VerifyMode.CERT_REQUIRED: 2>

 -- メソッド: SSLContext.set_psk_client_callback (callback)

     Enables TLS-PSK (pre-shared key) authentication on a client-side
     connection.

     In general, certificate based authentication should be preferred
     over this method.

     The parameter ‘callback’ is a callable object with the signature:
     ‘def callback(hint: str | None) -> tuple[str | None, bytes]’.  The
     ‘hint’ parameter is an optional identity hint sent by the server.
     The return value is a tuple in the form (client-identity, psk).
     Client-identity is an optional string which may be used by the
     server to select a corresponding PSK for the client.  The string
     must be less than or equal to ‘256’ octets when UTF-8 encoded.  PSK
     is a *note bytes-like object: 193. representing the pre-shared key.
     Return a zero length PSK to reject the connection.

     Setting ‘callback’ to *note None: 885. removes any existing
     callback.

          注釈: When using TLS 1.3:

             - the ‘hint’ parameter is always *note None: 885.

             - client-identity must be a non-empty string.

     使用例:

          context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
          context.check_hostname = False
          context.verify_mode = ssl.CERT_NONE
          context.maximum_version = ssl.TLSVersion.TLSv1_2
          context.set_ciphers('PSK')

          # A simple lambda:
          psk = bytes.fromhex('c0ffee')
          context.set_psk_client_callback(lambda hint: (None, psk))

          # A table using the hint from the server:
          psk_table = { 'ServerId_1': bytes.fromhex('c0ffee'),
                        'ServerId_2': bytes.fromhex('facade')
          }
          def callback(hint):
              return 'ClientId_1', psk_table.get(hint, b'')
          context.set_psk_client_callback(callback)

     This method will raise *note NotImplementedError: 36b. if *note
     HAS_PSK: 39dd. is ‘False’.

     Added in version 3.13.

 -- メソッド: SSLContext.set_psk_server_callback (callback,
          identity_hint=None)

     Enables TLS-PSK (pre-shared key) authentication on a server-side
     connection.

     In general, certificate based authentication should be preferred
     over this method.

     The parameter ‘callback’ is a callable object with the signature:
     ‘def callback(identity: str | None) -> bytes’.  The ‘identity’
     parameter is an optional identity sent by the client which can be
     used to select a corresponding PSK. The return value is a *note
     bytes-like object: 193. representing the pre-shared key.  Return a
     zero length PSK to reject the connection.

     Setting ‘callback’ to *note None: 885. removes any existing
     callback.

     The parameter ‘identity_hint’ is an optional identity hint string
     sent to the client.  The string must be less than or equal to ‘256’
     octets when UTF-8 encoded.

          注釈: When using TLS 1.3 the ‘identity_hint’ parameter is not
          sent to the client.

     使用例:

          context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
          context.maximum_version = ssl.TLSVersion.TLSv1_2
          context.set_ciphers('PSK')

          # A simple lambda:
          psk = bytes.fromhex('c0ffee')
          context.set_psk_server_callback(lambda identity: psk)

          # A table using the identity of the client:
          psk_table = { 'ClientId_1': bytes.fromhex('c0ffee'),
                        'ClientId_2': bytes.fromhex('facade')
          }
          def callback(identity):
              return psk_table.get(identity, b'')
          context.set_psk_server_callback(callback, 'ServerId_1')

     This method will raise *note NotImplementedError: 36b. if *note
     HAS_PSK: 39dd. is ‘False’.

     Added in version 3.13.

   ---------- Footnotes ----------

   (1) TLS 1.3 protocol will be available with *note PROTOCOL_TLS: 39b3.
in OpenSSL >= 1.1.1.  There is no dedicated PROTOCOL constant for just
TLS 1.3.

   (2) *note SSLContext: 357. では、デフォルトで *note OP_NO_SSLv2: a3a.
によりSSLv2 が無効になっています。

   (3) *note SSLContext: 357. では、デフォルトで *note OP_NO_SSLv3: a3b.
により SSLv3 が無効になっています。

   (4) TLS 1.3 protocol will be available with *note PROTOCOL_TLS: 39b3.
in OpenSSL >= 1.1.1.  There is no dedicated PROTOCOL constant for just
TLS 1.3.

   (5) *note SSLContext: 357. では、デフォルトで *note OP_NO_SSLv2: a3a.
によりSSLv2 が無効になっています。

   (6) *note SSLContext: 357. では、デフォルトで *note OP_NO_SSLv3: a3b.
により SSLv3 が無効になっています。

   (7) 
https://docs.openssl.org/master/man3/SSL_CTX_load_verify_locations/

   (8) https://docs.openssl.org/master/man1/ciphers/

   (9) https://datatracker.ietf.org/doc/html/rfc7301.html

   (10) 
https://en.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation

   (11) https://datatracker.ietf.org/doc/html/rfc6066.html

   (12) 
https://vincent.bernat.ch/en/blog/2011-ssl-perfect-forward-secrecy

   (13) https://docs.openssl.org/1.1.1/man3/SSL_CTX_sess_number/

   (14) https://docs.openssl.org/master/man3/SSL_CTX_get_security_level/


File: python.info,  Node: 証明書,  Next: 使用例<28>,  Prev: SSL コンテキスト,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.19.3.10 証明書
................

証明書を大まかに説明すると、公開鍵/秘密鍵システムの一種です。このシステ
ムでは、各 'principal' (これはマシン、人、組織などです) は、ユニークな
2つの暗号鍵を割り当てられます。1つは公開され、 '公開鍵(public key)' と呼
ばれます。もう一方は秘密にされ、 '秘密鍵(private key)' と呼ばれます。 2つ
の鍵は関連しており、片方の鍵で暗号化したメッセージは、もう片方の鍵 'のみ
' で復号できます。

証明書は2つの principal の情報を含んでいます。証明書は 'subject' 名とそ
の公開鍵を含んでいます。また、もう一つの principal である '発行者
(issuer)' からの、 subject が本人であることと、その公開鍵が正しいことの
宣言(statement)を含んでいます。発行者からの宣言は、その発行者の秘密鍵で
署名されています。発行者の秘密鍵は発行者しか知りませんが、誰もがその発行
者の公開鍵を利用して宣言を復号し、証明書内の別の情報と比較することで認証
することができます。証明書はまた、その証明書が有効である期限に関する情報
も含んでいます。この期限は "notBefore" と "notAfter" と呼ばれる2つのフィ
ールドで表現されています。

Python において証明書を利用する場合、クライアントもサーバーも自分を証明
するために証明書を利用することができます。ネットワーク接続の相手側に証明
書の提示を要求する事ができ、そのクライアントやサーバーが認証を必要とする
ならその証明書を認証することができます。認証が失敗した場合、接続は例外を
発生させます。認証は下位層のOpenSSLフレームワークが自動的に行います。ア
プリケーションは認証機構について意識する必要はありません。しかし、アプリ
ケーションは認証プロセスのために幾つかの証明書を提供する必要があるかもし
れません。

Python は証明書を格納したファイルを利用します。そのファイルは "PEM" (
RFC 1422(1) 参照) フォーマットという、ヘッダー行とフッター行の間に
base-64エンコードされた形をとっている必要があります。

     -----BEGIN CERTIFICATE-----
     ... (certificate in base64 PEM encoding) ...
     -----END CERTIFICATE-----

* Menu:

* 証明書チェイン::
* CA 証明書::
* 秘密鍵と証明書の組み合わせ::
* 自己署名証明書::

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc1422.html


File: python.info,  Node: 証明書チェイン,  Next: CA 証明書,  Up: 証明書

5.19.3.11 証明書チェイン
........................

Pythonが利用する証明書を格納したファイルは、ときには '証明書チェイン
(certificate chain)' と呼ばれる証明書のシーケンスを格納します。このチェ
インの先頭には、まずクライアントやサーバーである principal の証明書を置
き、それ以降には、その証明書の発行者(issuer)の証明書などを続け、最後に証
明対象(subject)と発行者が同じ '自己署名(self-signed)' 証明書で終わります
。この最後の証明書は 'ルート証明書(root certificate' と呼ばれます。これ
らの証明書チェインは単純に1つの証明書ファイルに結合してください。例えば
、3つの証明書からなる証明書チェインがある場合、私たちのサーバーの証明書
から、私たちのサーバーに署名した認証局の証明書、そして認証局の証明書を発
行した機関のルート証明書と続きます:

     -----BEGIN CERTIFICATE-----
     ... (certificate for your server)...
     -----END CERTIFICATE-----
     -----BEGIN CERTIFICATE-----
     ... (the certificate for the CA)...
     -----END CERTIFICATE-----
     -----BEGIN CERTIFICATE-----
     ... (the root certificate for the CA's issuer)...
     -----END CERTIFICATE-----


File: python.info,  Node: CA 証明書,  Next: 秘密鍵と証明書の組み合わせ,  Prev: 証明書チェイン,  Up: 証明書

5.19.3.12 CA 証明書
...................

もし相手から送られてきた証明書の認証をしたい場合、信頼している各発行者の
証明書チェインが入った "CA certs" ファイルを提供する必要があります。繰り
返しますが、このファイルは単純に、各チェインを結合しただけのものです。認
証のために、Pythonはそのファイルの中の最初にマッチしたチェインを利用しま
す。*note SSLContext.load_default_certs(): 11b4. を呼び出すことでプラッ
トフォームの証明書ファイルも使われますが、これは *note
create_default_context(): 480. によって自動的に行われます。


File: python.info,  Node: 秘密鍵と証明書の組み合わせ,  Next: 自己署名証明書,  Prev: CA 証明書,  Up: 証明書

5.19.3.13 秘密鍵と証明書の組み合わせ
....................................

Often the private key is stored in the same file as the certificate; in
this case, only the ‘certfile’ parameter to *note
SSLContext.load_cert_chain(): 598. needs to be passed.  If the private
key is stored with the certificate, it should come before the first
certificate in the certificate chain:

     -----BEGIN RSA PRIVATE KEY-----
     ... (private key in base64 encoding) ...
     -----END RSA PRIVATE KEY-----
     -----BEGIN CERTIFICATE-----
     ... (certificate in base64 PEM encoding) ...
     -----END CERTIFICATE-----


File: python.info,  Node: 自己署名証明書,  Prev: 秘密鍵と証明書の組み合わせ,  Up: 証明書

5.19.3.14 自己署名証明書
........................

SSL暗号化接続サービスを提供するサーバーを建てる場合、適切な証明書を取得
するには、認証局から買うなどの幾つかの方法があります。また、自己署名証明
書を作るケースもあります。 OpenSSLを使って自己署名証明書を作るには、次の
ようにします。

     % openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem
     Generating a 1024 bit RSA private key
     .......++++++
     .............................++++++
     writing new private key to 'cert.pem'
     -----
     You are about to be asked to enter information that will be incorporated
     into your certificate request.
     What you are about to enter is what is called a Distinguished Name or a DN.
     There are quite a few fields but you can leave some blank
     For some fields there will be a default value,
     If you enter '.', the field will be left blank.
     -----
     Country Name (2 letter code) [AU]:US
     State or Province Name (full name) [Some-State]:MyState
     Locality Name (eg, city) []:Some City
     Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Organization, Inc.
     Organizational Unit Name (eg, section) []:My Group
     Common Name (eg, YOUR name) []:myserver.mygroup.myorganization.com
     Email Address []:ops@myserver.mygroup.myorganization.com
     %

自己署名証明書の欠点は、それ自身がルート証明書であり、他の人はその証明書
を持っていない (そして信頼しない)ことです。


File: python.info,  Node: 使用例<28>,  Next: ノンブロッキングソケットについての注意事項,  Prev: 証明書,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.19.3.15 使用例
................

* Menu:

* SSLサポートをテストする::
* クライアントサイドの処理::
* サーバサイドの処理::


File: python.info,  Node: SSLサポートをテストする,  Next: クライアントサイドの処理,  Up: 使用例<28>

5.19.3.16 SSLサポートをテストする
.................................

インストールされているPythonがSSLをサポートしているかどうかをテストする
ために、ユーザーコードは次のイディオムを利用することができます。

     try:
         import ssl
     except ImportError:
         pass
     else:
         ...  # do something that requires SSL support


File: python.info,  Node: クライアントサイドの処理,  Next: サーバサイドの処理,  Prev: SSLサポートをテストする,  Up: 使用例<28>

5.19.3.17 クライアントサイドの処理
..................................

この例では、自動的に証明書の検証を行うことを含む望ましいセキュリティ設定
でクライアントソケットの SSL コンテキストを作ります:

     >>> context = ssl.create_default_context()

自分自身でセキュリティ設定を調整したい場合、コンテキストを一から作ること
はできます (ただし、正しくない設定をしてしまいがちなことに注意してくださ
い):

     >>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
     >>> context.load_verify_locations("/etc/ssl/certs/ca-bundle.crt")

(このスニペットはすべての CA 証明書が ‘/etc/ssl/certs/ca-bundle.crt’ に
バンドルされていることを仮定しています; もし違っていればエラーになります
ので、適宜修正してください)

The *note PROTOCOL_TLS_CLIENT: a72. protocol configures the context for
cert validation and hostname verification.  *note verify_mode: 39b0. is
set to *note CERT_REQUIRED: 39b1. and *note check_hostname: 39c4. is set
to ‘True’.  All other protocols create SSL contexts with insecure
defaults.

When you use the context to connect to a server, *note CERT_REQUIRED:
39b1. and *note check_hostname: 39c4. validate the server certificate:
it ensures that the server certificate was signed with one of the CA
certificates, checks the signature for correctness, and verifies other
properties like validity and identity of the hostname:

     >>> conn = context.wrap_socket(socket.socket(socket.AF_INET),
     ...                            server_hostname="www.python.org")
     >>> conn.connect(("www.python.org", 443))

そして証明書を持ってくることができます:

     >>> cert = conn.getpeercert()

証明書が、期待しているサービス (つまり、 HTTPS ホスト ‘www.python.org’)
の身元を特定していることを視覚的に点検してみましょう:

     >>> pprint.pprint(cert)
     {'OCSP': ('http://ocsp.digicert.com',),
      'caIssuers': ('http://cacerts.digicert.com/DigiCertSHA2ExtendedValidationServerCA.crt',),
      'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1.crl',
                                'http://crl4.digicert.com/sha2-ev-server-g1.crl'),
      'issuer': ((('countryName', 'US'),),
                 (('organizationName', 'DigiCert Inc'),),
                 (('organizationalUnitName', 'www.digicert.com'),),
                 (('commonName', 'DigiCert SHA2 Extended Validation Server CA'),)),
      'notAfter': 'Sep  9 12:00:00 2016 GMT',
      'notBefore': 'Sep  5 00:00:00 2014 GMT',
      'serialNumber': '01BB6F00122B177F36CAB49CEA8B6B26',
      'subject': ((('businessCategory', 'Private Organization'),),
                  (('1.3.6.1.4.1.311.60.2.1.3', 'US'),),
                  (('1.3.6.1.4.1.311.60.2.1.2', 'Delaware'),),
                  (('serialNumber', '3359300'),),
                  (('streetAddress', '16 Allen Rd'),),
                  (('postalCode', '03894-4801'),),
                  (('countryName', 'US'),),
                  (('stateOrProvinceName', 'NH'),),
                  (('localityName', 'Wolfeboro'),),
                  (('organizationName', 'Python Software Foundation'),),
                  (('commonName', 'www.python.org'),)),
      'subjectAltName': (('DNS', 'www.python.org'),
                         ('DNS', 'python.org'),
                         ('DNS', 'pypi.org'),
                         ('DNS', 'docs.python.org'),
                         ('DNS', 'testpypi.org'),
                         ('DNS', 'bugs.python.org'),
                         ('DNS', 'wiki.python.org'),
                         ('DNS', 'hg.python.org'),
                         ('DNS', 'mail.python.org'),
                         ('DNS', 'packaging.python.org'),
                         ('DNS', 'pythonhosted.org'),
                         ('DNS', 'www.pythonhosted.org'),
                         ('DNS', 'test.pythonhosted.org'),
                         ('DNS', 'us.pycon.org'),
                         ('DNS', 'id.python.org')),
      'version': 3}

SSL チャネルは今や確立されて証明書が検証されているので、サーバとのお喋り
を続けることができます:

     >>> conn.sendall(b"HEAD / HTTP/1.0\r\nHost: linuxfr.org\r\n\r\n")
     >>> pprint.pprint(conn.recv(1024).split(b"\r\n"))
     [b'HTTP/1.1 200 OK',
      b'Date: Sat, 18 Oct 2014 18:27:20 GMT',
      b'Server: nginx',
      b'Content-Type: text/html; charset=utf-8',
      b'X-Frame-Options: SAMEORIGIN',
      b'Content-Length: 45679',
      b'Accept-Ranges: bytes',
      b'Via: 1.1 varnish',
      b'Age: 2188',
      b'X-Served-By: cache-lcy1134-LCY',
      b'X-Cache: HIT',
      b'X-Cache-Hits: 11',
      b'Vary: Cookie',
      b'Strict-Transport-Security: max-age=63072000; includeSubDomains',
      b'Connection: close',
      b'',
      b'']

このドキュメントの下の方の、 *note セキュリティで考慮すべき点: 3895. に
関する議論を参照してください。


File: python.info,  Node: サーバサイドの処理,  Prev: クライアントサイドの処理,  Up: 使用例<28>

5.19.3.18 サーバサイドの処理
............................

サーバサイドの処理では、通常、サーバー証明書と秘密鍵がそれぞれファイルに
格納された形で必要です。最初に秘密鍵と証明書が保持されたコンテキストを作
成し、クライアントがあなたの信憑性をチェックできるようにします。そののち
にソケットを開き、ポートにバインドし、そのソケットの ‘listen()’ を呼び、
クライアントからの接続を待ちます。

     import socket, ssl

     context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
     context.load_cert_chain(certfile="mycertfile", keyfile="mykeyfile")

     bindsocket = socket.socket()
     bindsocket.bind(('myaddr.example.com', 10023))
     bindsocket.listen(5)

クライアントが接続してきた場合、 ‘accept()’ を呼んで新しいソケットを作成
し、接続のためにサーバサイドの SSL ソケットを、コンテキストの *note
SSLContext.wrap_socket(): 748. メソッドで作ります:

     while True:
         newsocket, fromaddr = bindsocket.accept()
         connstream = context.wrap_socket(newsocket, server_side=True)
         try:
             deal_with_client(connstream)
         finally:
             connstream.shutdown(socket.SHUT_RDWR)
             connstream.close()

そして、 ‘connstream’ からデータを読み、クライアントと切断する(あるいは
クライアントが切断してくる)まで何か処理をします。

     def deal_with_client(connstream):
         data = connstream.recv(1024)
         # empty data means the client is finished with us
         while data:
             if not do_something(connstream, data):
                 # we'll assume do_something returns False
                 # when we're finished with client
                 break
             data = connstream.recv(1024)
         # finished with client

そして新しいクライアント接続のために listen に戻ります。 (もちろん現実の
サーバは、おそらく個々のクライアント接続ごとに別のスレッドで処理するか、
ソケットを *note ノンブロッキングモード: 39b6. にし、イベントループを使
うでしょう。)


File: python.info,  Node: ノンブロッキングソケットについての注意事項,  Next: メモリ BIO サポート<2>,  Prev: 使用例<28>,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.19.3.19 ノンブロッキングソケットについての注意事項
....................................................

SSL ソケットはノンブロッキングモードにおいては、普通のソケットとは少し違
った振る舞いをします。ですのでノンブロッキングソケットとともに使う場合、
いくつか気をつけなければならない事項があります:

   - ほとんどの *note SSLSocket: ae7. のメソッドは I/O 操作がブロックす
     ると *note BlockingIOError: 235. ではなく *note SSLWantWriteError:
     106a. か *note SSLWantReadError: 1069. のどちらかを送出します。
     *note SSLWantReadError: 1069. は下層のソケットで読み出しが必要な場
     合に送出され、 *note SSLWantWriteError: 106a. は下層のソケットで書
     き込みが必要な場合に送出されます。SSL ソケットに対して '書き込み' を
     試みると下層のソケットから最初に '読み出す' 必要があるかもしれず、
     SSL ソケットに対して '読み出し' を試みると下層のソケットに先に '書
     き込む' 必要があるかもしれないことに注意してください。

     バージョン 3.5 で変更: 以前の Python バージョンでは、
     ‘SSLSocket.send()’ メソッドは *note SSLWantWriteError: 106a. または
     *note SSLWantReadError: 1069. を送出するのではなく、ゼロを返してい
     ました。

   - *note select(): fa0. 呼び出しは OS レベルでのソケットが読み出し可能
     (または書き込み可能)になったことを教えてくれますが、上位の SSL レイ
     ヤーでの十分なデータがあることを意味するわけではありません。例えば
     、SSL フレームの一部が届いただけかもしれません。ですから、
     ‘SSLSocket.recv()’ と ‘SSLSocket.send()’ の失敗を処理することに備え
     、ほかの *note select(): fa0. 呼び出し後にリトライしなければなりま
     せん。

   - 反対に、SSL レイヤーは独自の枠組みを持っているため、*note select():
     fa0. が気付かない読み出し可能なデータを SSL ソケットが持っている場
     合があります。したがって、入手可能な可能性のあるデータをすべて引き
     出すために最初に ‘SSLSocket.recv()’ を呼び出し、次にそれでもまだ必
     要な場合にだけ *note select(): fa0. 呼び出しでブロックすべきです。

     (当然のことながら、ほかのプリミティブ、例えば *note poll(): 30a9. や
     *note selectors: c7. モジュール内のものを使う際にも似た但し書きが付
     きます)

   - SSL ハンドシェイクそのものがノンブロッキングになります: *note
     SSLSocket.do_handshake(): 106d. メソッドは成功するまでリトライしな
     ければなりません。 *note select(): fa0. を用いてソケットの準備が整
     うのを待つためには、およそ以下のようにします:

          while True:
              try:
                  sock.do_handshake()
                  break
              except ssl.SSLWantReadError:
                  select.select([sock], [], [])
              except ssl.SSLWantWriteError:
                  select.select([], [sock], [])

参考
....

The *note asyncio: b. module supports *note non-blocking SSL sockets:
39b6. and provides a higher level *note Streams API: 37b9.  It polls for
events using the *note selectors: c7. module and handles *note
SSLWantWriteError: 106a, *note SSLWantReadError: 1069. and *note
BlockingIOError: 235. exceptions.  It runs the SSL handshake
asynchronously as well.


File: python.info,  Node: メモリ BIO サポート<2>,  Next: SSL セッション,  Prev: ノンブロッキングソケットについての注意事項,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.19.3.20 メモリ BIO サポート
.............................

Added in version 3.5.

Python 2.6 で SSL モジュールが導入されて以降、*note SSLSocket: ae7. クラ
スは、以下の互いに関連するが別々の機能を提供してきました。

   - SSL プロトコル処理

   - ネットワーク IO

ネットワーク IO API は、*note socket.socket: fa1. が提供するものと同じで
す。*note SSLSocket: ae7. も、そのクラスから継承しています。これにより、
SSL ソケットは標準のソケットをそっくりそのまま置き換えるものとして使用で
きるため、既存のアプリケーションを SSL に対応させるのが非常に簡単になり
ます。

SSL プロトコルの処理とネットワーク IO を組み合わせた場合、通常は問題なく
動作しますが、問題が発生する場合があります。一例を挙げると、非同期 IO フ
レームワークが別の多重化モデルを使用する場合、これは *note
socket.socket: fa1. と内部 OpenSSL ソケット IO ルーティンが想定する「フ
ァイル記述子上の select/poll」モデル（準備状態ベース）とは異なります。こ
れは、このモデルが非効率的になる Windows などのプラットフォームに主に該
当します。そのため、スコープを限定した *note SSLSocket: ae7. の変種、
*note SSLObject: d7a. が提供されています。

 -- クラス: ssl.SSLObject

     ネットワーク IO メソッドを含まない SSL プロトコルインスタンスを表す
     、スコープを限定した *note SSLSocket: ae7. の変種です。一般的にこ、
     のクラスを使用するのは、メモリバッファを通じて SSL のための非同期
     IO を実装するフレームワーク作成者です。

     このクラスは、OpenSSL が実装する低水準 SSL オブジェクトの上にインタ
     ーフェースを実装します。このオブジェクトは SSL 接続の状態をキャプチ
     ャしますが、ネットワーク IO 自体は提供しません。IO は、OpenSSL の
     IO 抽象レイヤである別の「BIO」オブジェクトを通じて実行する必要があ
     ります。

     このクラスには公開されたコンストラクタがありません。*note
     SSLObject: d7a. インスタンスは、 *note wrap_bio(): d7b. メソッドを
     使用して作成しなければなりません。このメソッドは、*note SSLObject:
     d7a. インスタンスを作成し、2 つの BIO に束縛します。'incoming' BIO
     は、Python から SSL プロトコルインスタンスにデータを渡すために使用
     され、'outgoing' BIO は、データを反対向きに渡すために使用されます。

     次のメソッドがサポートされています:

        - *note context: 39ed.

        - *note server_side: 39ef.

        - *note server_hostname: d78.

        - *note session: 193d.

        - *note session_reused: 39f0.

        - *note read(): 106e.

        - *note write(): 106f.

        - *note getpeercert(): 11ba.

        - *note get_verified_chain(): 195c.

        - *note get_unverified_chain(): 195d.

        - *note selected_alpn_protocol(): 1065.

        - *note selected_npn_protocol(): a74.

        - *note cipher(): 38da.

        - *note shared_ciphers(): 106c.

        - *note compression(): 135d.

        - *note pending(): 39ee.

        - *note do_handshake(): 106d.

        - *note verify_client_post_handshake(): c27.

        - *note unwrap(): 39ec.

        - *note get_channel_binding(): 135c.

        - *note version(): 1068.

     *note SSLSocket: ae7. と比較すると、このオブジェクトでは以下の機能
     が不足しています。

        - Any form of network IO; ‘recv()’ and ‘send()’ read and write
          only to the underlying *note MemoryBIO: 1062. buffers.

        - 'do_handshake_on_connect' 機構はありません。必ず手動で *note
          do_handshake(): 106d. を呼んで、ハンドシェイクを開始する必要が
          あります。

        - 'suppress_ragged_eofs' は処理されません。プロトコルに違反する
          ファイル末尾状態は、 *note SSLEOFError: 1ab8. 例外を通じて報告
          されます。

        - *note unwrap(): 39ec. メソッドの呼び出しは、下層のソケットを返
          す SSL ソケットとは異なり、何も返しません。

        - *note SSLContext.set_servername_callback(): 11b9. に渡される
          'server_name_callback' コールバックは、1 つ目の引数として
          *note SSLSocket: ae7. インスタンスではなく *note SSLObject:
          d7a. インスタンスを受け取ります。

     *note SSLObject: d7a. の使用に関する注意:

        - *note SSLObject: d7a. 上のすべての IO は *note non-blocking:
          39b6. です。例えば、*note read(): 106e. は入力 BIO が持つデー
          タよりも多くのデータを必要とする場合、*note SSLWantReadError:
          1069. を送出します。

     バージョン 3.7 で変更: *note SSLObject: d7a. instances must be
     created with *note wrap_bio(): d7b.  In earlier versions, it was
     possible to create instances directly.  This was never documented
     or officially supported.

SSLObject は、メモリバッファを使用して外界と通信します。*note MemoryBIO:
1062. クラスは、以下のように OpenSSL メモリ BIO (Basic IO) オブジェクト
をラップし、この目的に使用できるメモリバッファを提供します。

 -- クラス: ssl.MemoryBIO

     Python と SSL プロトコルインスタンス間でデータをやり取りするために
     使用できるメモリバッファ。

      -- の属性: pending

          現在メモリバッファ中にあるバイト数を返します。

      -- の属性: eof

          メモリ BIOが現在ファイルの末尾にあるかを表す真偽値です。

      -- メソッド: read (n=-1, /)

          メモリバッファから最大 'n' 読み取ります。'n' が指定されていな
          いか、負値の場合、すべてのバイトが返されます。

      -- メソッド: write (buf, /)

          'buf' からメモリ BIO にバイトを書き込みます。'buf' 引数は、バ
          ッファプロトコルをサポートするオブジェクトでなければなりません
          。

          戻り値は、書き込まれるバイト数であり、常に 'buf' の長さと等し
          くなります。

      -- メソッド: write_eof ()

          EOF マーカーをメモリ BIO に書き込みます。このメソッドが呼び出
          された後に *note write(): 3a0a. を呼ぶことはできません。*note
          eof: 3a08. 属性は、バッファ内のすべてのデータが読み出された後
          に True になります。


File: python.info,  Node: SSL セッション,  Next: セキュリティで考慮すべき点<3>,  Prev: メモリ BIO サポート<2>,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.19.3.21 SSL セッション
........................

Added in version 3.6.

 -- クラス: ssl.SSLSession

     *note session: 193d. が使用するセッションオブジェクトです。

      -- の属性: id

      -- の属性: time

      -- の属性: timeout

      -- の属性: ticket_lifetime_hint

      -- の属性: has_ticket


File: python.info,  Node: セキュリティで考慮すべき点<3>,  Next: TLS 1 3,  Prev: SSL セッション,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.19.3.22 セキュリティで考慮すべき点
....................................

* Menu:

* 最善のデフォルト値::
* 手動での設定::
* マルチプロセス化::


File: python.info,  Node: 最善のデフォルト値,  Next: 手動での設定,  Up: セキュリティで考慮すべき点<3>

5.19.3.23 最善のデフォルト値
............................

'クライアントでの使用' では、セキュリティポリシーによる特殊な要件がない
限りは、 *note create_default_context(): 480. 関数を使用して SSL コンテ
キストを作成することを強くお勧めします。この関数は、システムの信頼済み
CA 証明書をロードし、証明書の検証とホスト名のチェックを有効化し、十分に
セキュアなプロトコルと暗号を選択しようとします。

例として、 *note smtplib.SMTP: b27. クラスを使用して SMTP サーバーに対し
て信頼できるセキュアな接続を行う方法を以下に示します:

     >>> import ssl, smtplib
     >>> smtp = smtplib.SMTP("mail.python.org", port=587)
     >>> context = ssl.create_default_context()
     >>> smtp.starttls(context=context)
     (220, b'2.0.0 Ready to start TLS')

接続にクライアントの証明書が必要な場合、 *note
SSLContext.load_cert_chain(): 598. によって追加できます。

対照的に、自分自身で *note SSLContext: 357. クラスのコンストラクタを呼び
出すことによって SSL コンテキストを作ると、デフォルトでは証明書検証もホ
スト名チェックも有効になりません。自分で設定を行う場合は、十分なセキュリ
ティレベルを達成するために、以下のパラグラフをお読みください。


File: python.info,  Node: 手動での設定,  Next: マルチプロセス化,  Prev: 最善のデフォルト値,  Up: セキュリティで考慮すべき点<3>

5.19.3.24 手動での設定
......................

* Menu:

* 証明書の検証::
* プロトコルのバージョン::
* 暗号の選択::


File: python.info,  Node: 証明書の検証,  Next: プロトコルのバージョン,  Up: 手動での設定

5.19.3.25 証明書の検証
......................

When calling the *note SSLContext: 357. constructor directly, *note
CERT_NONE: 39c2. is the default.  Since it does not authenticate the
other peer, it can be insecure, especially in client mode where most of
the time you would like to ensure the authenticity of the server you're
talking to.  Therefore, when in client mode, it is highly recommended to
use *note CERT_REQUIRED: 39b1.  However, it is in itself not sufficient;
you also have to check that the server certificate, which can be
obtained by calling *note SSLSocket.getpeercert(): 11ba, matches the
desired service.  For many protocols and applications, the service can
be identified by the hostname.  This common check is automatically
performed when *note SSLContext.check_hostname: 39c4. is enabled.

バージョン 3.7 で変更: Hostname matchings is now performed by OpenSSL.
Python no longer uses ‘match_hostname()’.

サーバモードにおいて、(より上位のレベルでの認証メカニズムではなく) SSL レ
イヤーを使ってあなたのクライアントを認証したいならば、 *note
CERT_REQUIRED: 39b1. を指定して同じようにクライアントの証明書を検証すべ
きでしょう。


File: python.info,  Node: プロトコルのバージョン,  Next: 暗号の選択,  Prev: 証明書の検証,  Up: 手動での設定

5.19.3.26 プロトコルのバージョン
................................

SSL バージョン 2 と 3 は安全性に欠けると考えられており、使用するのは危険
です。クライアントとサーバ間の互換性を最大限に確保したい場合、プロトコル
バージョンとして *note PROTOCOL_TLS_CLIENT: a72. または *note
PROTOCOL_TLS_SERVER: a73. を使用してください。 SSLv2 と SSLv3 はデフォル
トで無効になっています。

     >>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
     >>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3
     >>> client_context.maximum_version = ssl.TLSVersion.TLSv1_3

The SSL context created above will only allow TLSv1.3 and later (if
supported by your system) connections to a server.  *note
PROTOCOL_TLS_CLIENT: a72. implies certificate validation and hostname
checks by default.  You have to load certificates into the context.


File: python.info,  Node: 暗号の選択,  Prev: プロトコルのバージョン,  Up: 手動での設定

5.19.3.27 暗号の選択
....................

If you have advanced security requirements, fine-tuning of the ciphers
enabled when negotiating a SSL session is possible through the *note
SSLContext.set_ciphers(): 39f3. method.  Starting from Python 3.2.3, the
ssl module disables certain weak ciphers by default, but you may want to
further restrict the cipher choice.  Be sure to read OpenSSL's
documentation about the cipher list format(1).  If you want to check
which ciphers are enabled by a given cipher list, use *note
SSLContext.get_ciphers(): eda. or the ‘openssl ciphers’ command on your
system.

   ---------- Footnotes ----------

   (1) https://docs.openssl.org/1.1.1/man1/ciphers/#cipher-list-format


File: python.info,  Node: マルチプロセス化,  Prev: 手動での設定,  Up: セキュリティで考慮すべき点<3>

5.19.3.28 マルチプロセス化
..........................

If using this module as part of a multi-processed application (using,
for example the *note multiprocessing: 98. or *note concurrent.futures:
24. modules), be aware that OpenSSL's internal random number generator
does not properly handle forked processes.  Applications must change the
PRNG state of the parent process if they use any SSL feature with *note
os.fork(): 4b5.  Any successful call of *note RAND_add(): 39bc. or *note
RAND_bytes(): 747. is sufficient.


File: python.info,  Node: TLS 1 3,  Prev: セキュリティで考慮すべき点<3>,  Up: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー

5.19.3.29 TLS 1.3
.................

Added in version 3.7.

The TLS 1.3 protocol behaves slightly differently than previous version
of TLS/SSL. Some new TLS 1.3 features are not yet available.

   - TLS 1.3 uses a disjunct set of cipher suites.  All AES-GCM and
     ChaCha20 cipher suites are enabled by default.  The method *note
     SSLContext.set_ciphers(): 39f3. cannot enable or disable any TLS
     1.3 ciphers yet, but *note SSLContext.get_ciphers(): eda. returns
     them.

   - Session tickets are no longer sent as part of the initial handshake
     and are handled differently.  *note SSLSocket.session: 193d. and
     *note SSLSession: ed9. are not compatible with TLS 1.3.

   - Client-side certificates are also no longer verified during the
     initial handshake.  A server can request a certificate at any time.
     Clients process certificate requests while they send or receive
     application data from the server.

   - TLS 1.3 features like early data, deferred TLS client cert request,
     signature algorithm configuration, and rekeying are not supported
     yet.

参考
....

*note socket.socket: fa1. クラス

     下位レイヤーの *note socket: d1. クラスのドキュメント

SSL/TLS Strong Encryption: An Introduction(1)

     Apache HTTPサーバのドキュメンテーションのイントロ

RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: Certificate-Based Key Management(2)

     Steve Kent

RFC 4086: Randomness Requirements for Security(3)

     Donald E. Eastlake, Jeffrey I. Schiller, Steve Crocker

RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile(4)

     David Cooper et al.

RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2(5)

     Tim Dierks and Eric Rescorla.

RFC 6066: Transport Layer Security (TLS) Extensions(6)

     Donald E. Eastlake

IANA TLS: Transport Layer Security (TLS) Parameters(7)

     IANA

RFC 7525: Recommendations for Secure Use of Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS)(8)

     IETF

Mozilla's Server Side TLS recommendations(9)

     Mozilla

   ---------- Footnotes ----------

   (1) https://httpd.apache.org/docs/trunk/en/ssl/ssl_intro.html

   (2) https://datatracker.ietf.org/doc/html/rfc1422.html

   (3) https://datatracker.ietf.org/doc/html/rfc4086.html

   (4) https://datatracker.ietf.org/doc/html/rfc5280.html

   (5) https://datatracker.ietf.org/doc/html/rfc5246.html

   (6) https://datatracker.ietf.org/doc/html/rfc6066.html

   (7) 
https://www.iana.org/assignments/tls-parameters/tls-parameters.xml

   (8) https://datatracker.ietf.org/doc/html/rfc7525.html

   (9) https://wiki.mozilla.org/Security/Server_Side_TLS


File: python.info,  Node: select --- I/O 完了の待機,  Next: selectors --- 高水準の I/O 多重化,  Prev: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー,  Up: ネットワーク通信とプロセス間通信

5.19.4 ‘select’ -- I/O 完了の待機
---------------------------------

__________________________________________________________________

このモジュールでは、ほとんどのオペレーティングシステムで利用可能な
‘select()’ および ‘poll()’ 関数、Solaris やその派生で利用可能な
‘devpoll()’ 、Linux 2.5+ で利用可能な ‘epoll()’ 、多くのBSDで利用可能な
‘kqueue()’ 関数に対するアクセスを提供しています。 Windows 上ではソケット
に対してしか動作しないので注意してください; その他のオペレーティングシス
テムでは、他のファイル形式でも (特に Unixではパイプにも) 動作します。通
常のファイルに対して適用し、最後にファイルを読み出した時から内容が増えて
いるかを決定するために使うことはできません。

     注釈: The *note selectors: c7. module allows high-level and
     efficient I/O multiplexing, built upon the ‘select’ module
     primitives.  Users are encouraged to use the *note selectors: c7.
     module instead, unless they want precise control over the OS-level
     primitives used.

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

このモジュールは以下を定義します:

 -- 例外: select.error

     *note OSError: 2c0. の非推奨のエイリアスです。

     バージョン 3.3 で変更: PEP 3151(1) に基づき、このクラスは *note
     OSError: 2c0. のエイリアスになりました。

 -- の関数: select.devpoll ()

     (Solaris およびその派生でのみサポートされています) ‘/dev/poll’ ポー
     リングオブジェクトを返します。 ポーリングオブジェクトが提供している
     メソッドについては *note ポーリングオブジェクト: 3a1d. 節を参照して
     ください。

     ‘devpoll()’ オブジェクトはインスタンス化時に許されるファイル記述子
     の数にリンクされます。プログラムがこの値を減らす場合 ‘devpoll()’ は
     失敗します。プログラムがこの値を増やす場合 ‘devpoll()’ は有効なファ
     イル記述子の不完全なリストを返すことがあります。

     新しいファイル記述子は *note 継承不可: 10fc. です。

     Added in version 3.3.

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

 -- の関数: select.epoll (sizehint=-1, flags=0)

     (Linux 2.5.44 以降でのみサポート) エッジポーリング (edge polling) オ
     ブジェクトを返します。 このオブジェクトは、 I/O イベントのエッジト
     リガもしくはレベルトリガインターフェースとして使えます。

     'sizehint' informs epoll about the expected number of events to be
     registered.  It must be positive, or ‘-1’ to use the default.  It
     is only used on older systems where ‘epoll_create1()’ is not
     available; otherwise it has no effect (though its value is still
     checked).

     'flags' is deprecated and completely ignored.  However, when
     supplied, its value must be ‘0’ or ‘select.EPOLL_CLOEXEC’,
     otherwise ‘OSError’ is raised.

     エッジポーリングオブジェクトが提供しているメソッドについては *note
     エッジおよびレベルトリガポーリング (epoll) オブジェクト: 3a1e. 節を
     参照してください。

     ‘epoll’ オブジェクトはコンテキストマネジメントプロトコルをサポート
     しています。 *note with: 186. 文内で使用された場合、新たなファイル
     記述子はブロックの最後で自動的に閉じられます。

     新しいファイル記述子は *note 継承不可: 10fc. です。

     バージョン 3.3 で変更: 'flags' 引数が追加されました。

     バージョン 3.4 で変更: *note with: 186. 文のサポートが追加されまし
     た。新しいファイル記述子が継承不可になりました。

     バージョン 3.4 で非推奨: 'flags' パラメータ。 現在ではデフォルトで
     ‘select.EPOLL_CLOEXEC’ が使われます。 ファイルディスクリプタを継承
     可能にするには *note os.set_inheritable(): 10fe. を使ってください。

 -- の関数: select.poll ()

     (全てのオペレーティングシステムでサポートされているわけではありませ
     ん) ポーリングオブジェクトを返します。このオブジェクトはファイル記
     述子を登録したり登録解除したりすることができ、ファイル記述子に対す
     る I/O イベント発生をポーリングすることができます; ポーリングオブジ
     ェクトが提供しているメソッドについては *note
     ポーリングオブジェクト: 3a1d. 節を参照してください。

 -- の関数: select.kqueue ()

     (BSD でのみサポート) カーネルキュー(kernel queue)オブジェクトを返し
     ます。カーネルキューオブジェクトが提供しているメソッドについては、
     *note kqueue オブジェクト: 3a1f. 節を参照してください。

     新しいファイル記述子は *note 継承不可: 10fc. です。

     バージョン 3.4 で変更: 新しいファイル記述子が継承不可になりました。

 -- の関数: select.kevent (ident, filter=KQ_FILTER_READ,
          flags=KQ_EV_ADD, fflags=0, data=0, udata=0)

     (BSD でのみサポート) カーネルイベント(kernel event)オブジェクトを返
     します。カーネルイベントオブジェクトが提供しているメソッドについて
     は、 *note kevent オブジェクト: 3a21. 節を参照してください。

 -- の関数: select.select (rlist, wlist, xlist, timeout=None)

     This is a straightforward interface to the Unix ‘select()’ system
     call.  The first three arguments are iterables of 'waitable
     objects': either integers representing file descriptors or objects
     with a parameterless method named *note fileno(): 17ad. returning
     such an integer:

        * 'rlist': 読み込み可能になるまで待機

        * 'wlist': 書き込み可能になるまで待機

        * 'xlist': "例外状態 (exceptional condition)" になるまで待機 ("例
          外状態" については、システムのマニュアルページを参照してくださ
          い)

     Empty iterables are allowed, but acceptance of three empty
     iterables is platform-dependent.  (It is known to work on Unix but
     not on Windows.)  The optional 'timeout' argument specifies a
     time-out as a floating-point number in seconds.  When the 'timeout'
     argument is omitted or ‘None’, the function blocks until at least
     one file descriptor is ready.  A time-out value of zero specifies a
     poll and never blocks.

     戻り値は準備完了状態のオブジェクトからなる 3 つのリストです: したが
     ってこのリストはそれぞれ関数の最初の 3 つの引数のサブセットになりま
     す。ファイル記述子のいずれも準備完了にならないままタイムアウトした
     場合、3 つの空のリストが返されます。

     イテラブルの中に含めることのできるオブジェクトは Python *note
     ファイルオブジェクト: 13db. (例えば ‘sys.stdin’ や、 *note open():
     316. または *note os.popen(): 31a. が返すオブジェクト)、 *note
     socket.socket(): fa1. が返すソケットオブジェクトです。 'ラッパー
     <wrapper>' クラスを自分で定義することもできます。この場合、適切な
     (まったくデタラメな数ではなく本物のファイル記述子を返す) *note
     fileno(): 17ad. メソッドを持つ必要があります。

          注釈: 
          File objects on Windows are not acceptable, but sockets are.
          On Windows, the underlying ‘select()’ function is provided by
          the WinSock library, and does not handle file descriptors that
          don't originate from WinSock.

     バージョン 3.5 で変更: この関数は、シグナルによって中断された時に、
     *note InterruptedError: f88. を上げる代わりに再計算されたタイムアウ
     トによってリトライするようになりました。ただし、シグナルハンドラが
     例外を起こした場合を除きます (この論理的根拠については PEP 475(2) を
     見てください)。

 -- データ: select.PIPE_BUF

     The minimum number of bytes which can be written without blocking
     to a pipe when the pipe has been reported as ready for writing by
     *note select(): fa0, ‘poll()’ or another interface in this module.
     This doesn't apply to other kinds of file-like objects such as
     sockets.

     この値は POSIX により少なくとも512であることが保証されています。

     *note Availability: 213f.: Unix

     Added in version 3.2.

* Menu:

* /dev/poll ポーリングオブジェクト::
* エッジおよびレベルトリガポーリング (epoll) オブジェクト: エッジおよびレベルトリガポーリング epoll オブジェクト.
* ポーリングオブジェクト::
* kqueue オブジェクト::
* kevent オブジェクト::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3151/

   (2) https://peps.python.org/pep-0475/


File: python.info,  Node: /dev/poll ポーリングオブジェクト,  Next: エッジおよびレベルトリガポーリング epoll オブジェクト,  Up: select --- I/O 完了の待機

5.19.4.1 ‘/dev/poll’ ポーリングオブジェクト
...........................................

Solaris and derivatives have ‘/dev/poll’.  While ‘select()’ is
'O'('highest file descriptor') and ‘poll()’ is 'O'('number of file
descriptors'), ‘/dev/poll’ is 'O'('active file descriptors').

‘/dev/poll’ behaviour is very close to the standard ‘poll()’ object.

 -- メソッド: devpoll.close ()

     ポーリングオブジェクトのファイル記述子を閉じます。

     Added in version 3.4.

 -- の属性: devpoll.closed

     ポーリングオブジェクトが閉じている場合 ‘True’ です。

     Added in version 3.4.

 -- メソッド: devpoll.fileno ()

     ポーリングオブジェクトのファイル記述子番号を返します。

     Added in version 3.4.

 -- メソッド: devpoll.register (fd[, eventmask])

     ファイル記述子をポーリングオブジェクトに登録します。これ以降の
     *note poll(): 30a9. メソッド呼び出しでは、そのファイル記述子に処理
     待ち中の I/O イベントがあるかどうかを監視します。 'fd' は整数か、整
     数値を返す *note fileno(): 17ad. メソッドを持つオブジェクトを取りま
     す。ファイルオブジェクトも ‘fileno()’ を実装しているので、引数とし
     て使うことができます。

     'eventmask' is an optional bitmask describing the type of events
     you want to check for.  The constants are the same as with ‘poll()’
     object.  The default value is a combination of the constants
     ‘POLLIN’, ‘POLLPRI’, and ‘POLLOUT’.

          警告: Registering a file descriptor that's already registered
          is not an error, but the result is undefined.  The appropriate
          action is to unregister or modify it first.  This is an
          important difference compared with ‘poll()’.

 -- メソッド: devpoll.modify (fd[, eventmask])

     This method does an *note unregister(): 3a26. followed by a *note
     register(): 3a24.  It is (a bit) more efficient than doing the same
     explicitly.

 -- メソッド: devpoll.unregister (fd)

     ポーリングオブジェクトによって追跡中のファイル記述子を登録解除しま
     す。 *note register(): 3a24. メソッドと同様に、 'fd' は整数か、整数
     値を返す *note fileno(): 17ad. メソッドを持つオブジェクトを取ります
     。

     登録されていないファイル記述子の削除を試みるのは安全に無視されます
     。

 -- メソッド: devpoll.poll ([timeout])

     登録されたファイル記述子に対してポーリングを行い、報告すべき I/O イ
     ベントまたはエラーの発生したファイル記述子毎に 2 要素のタプル ‘(fd,
     event)’ からなるリストを返します。リストは空になることもあります。
     'fd' はファイル記述子で、 'event' は該当するファイル記述子について
     報告されたイベントを表すビットマスクです -- 例えば ‘POLLIN’ は入力
     待ちを示し、 ‘POLLOUT’ はファイル記述子に対する書き込みが可能を示す
     、などです。空のリストは呼び出しがタイムアウトしたか、報告すべきイ
     ベントがどのファイル記述子でも発生しなかったことを示します。
     'timeout' が与えられた場合、処理を戻すまで待機する時間の長さをミリ
     秒単位で指定します。 'timeout' が省略されたり、 -1 であったり、ある
     いは *note None: 885. の場合、そのポーリングオブジェクトが監視して
     いる何らかのイベントが発生するまでブロックします。

     バージョン 3.5 で変更: この関数は、シグナルによって中断された時に、
     *note InterruptedError: f88. を上げる代わりに再計算されたタイムアウ
     トによってリトライするようになりました。ただし、シグナルハンドラが
     例外を起こした場合を除きます (この論理的根拠については PEP 475(1) を
     見てください)。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/


File: python.info,  Node: エッジおよびレベルトリガポーリング epoll オブジェクト,  Next: ポーリングオブジェクト,  Prev: /dev/poll ポーリングオブジェクト,  Up: select --- I/O 完了の待機

5.19.4.2 エッジおよびレベルトリガポーリング (epoll) オブジェクト
................................................................

     ‘https://linux.die.net/man/4/epoll’

     'eventmask'

     定数                          意味
                                   
     ----------------------------------------------------------------------------------
                                   
     ‘EPOLLIN’                     読み込み可能
                                   
                                   
     ‘EPOLLOUT’                    書き込み可能
                                   
                                   
     ‘EPOLLPRI’                    緊急の読み出しデータ
                                   
                                   
     ‘EPOLLERR’                    設定された fd にエラー状態が発生した
                                   
                                   
     ‘EPOLLHUP’                    設定された fd がハングアップした
                                   
                                   
     ‘EPOLLET’                     エッジトリガ動作に設定する。デフォルトではレベル
                                   トリガ動作
                                   
                                   
     ‘EPOLLONESHOT’                1ショット動作に設定する。1回イベントが取り出され
                                   たら、その fd が内部で無効になる
                                   
                                   
     ‘EPOLLEXCLUSIVE’              関連づけられた fd にイベントがある場合、1 つの
                                   epoll オブジェクトのみを起こします。デフォルトで
                                   は (このフラグが設定されていない場合には)、fd に
                                   対してポーリングするすべての epoll オブジェクトを
                                   起こします。
                                   
                                   
     ‘EPOLLRDHUP’                  ストリームソケットの他端が接続を切断したか、接続
                                   の書き込み側のシャットダウンを行った。
                                   
                                   
     ‘EPOLLRDNORM’                 ‘EPOLLIN’ と同じ
                                   
                                   
     ‘EPOLLRDBAND’                 優先データバンドを読み込める。
                                   
                                   
     ‘EPOLLWRNORM’                 ‘EPOLLOUT’ と同じ
                                   
                                   
     ‘EPOLLWRBAND’                 優先データに書き込みできる。
                                   
                                   
     ‘EPOLLMSG’                    無視される。
                                   
                                   
     ‘EPOLLWAKEUP’                 Prevents sleep during event waiting.
                                   

     Added in version 3.6: ‘EPOLLEXCLUSIVE’ was added.  It's only
     supported by Linux Kernel 4.5 or later.

     Added in version 3.14: ‘EPOLLWAKEUP’ was added.  It's only
     supported by Linux Kernel 3.5 or later.

 -- メソッド: epoll.close ()

     epoll オブジェクトの制御用ファイル記述子を閉じます。

 -- の属性: epoll.closed

     epoll オブジェクトが閉じている場合 True です。

 -- メソッド: epoll.fileno ()

     制御用ファイル記述子の番号を返します。

 -- メソッド: epoll.fromfd (fd)

     'fd' から epoll オブジェクトを作成します。

 -- メソッド: epoll.register (fd[, eventmask])

     epoll オブジェクトにファイル記述子 'fd' を登録します。

 -- メソッド: epoll.modify (fd, eventmask)

     登録されたファイル記述子変更します。

 -- メソッド: epoll.unregister (fd)

     epoll オブジェクトから登録されたファイル記述子 'fd' を削除します。

     バージョン 3.9 で変更: The method no longer ignores the *note
     EBADF: b54. error.

 -- メソッド: epoll.poll (timeout=None, maxevents=-1)

     イベントを待機します。'timeout' はタイムアウト時間で、単位は秒
     (float型) です。

     バージョン 3.5 で変更: この関数は、シグナルによって中断された時に、
     *note InterruptedError: f88. を上げる代わりに再計算されたタイムアウ
     トによってリトライするようになりました。ただし、シグナルハンドラが
     例外を起こした場合を除きます (この論理的根拠については PEP 475(1) を
     見てください)。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/


File: python.info,  Node: ポーリングオブジェクト,  Next: kqueue オブジェクト,  Prev: エッジおよびレベルトリガポーリング epoll オブジェクト,  Up: select --- I/O 完了の待機

5.19.4.3 ポーリングオブジェクト
...............................

The ‘poll()’ system call, supported on most Unix systems, provides
better scalability for network servers that service many, many clients
at the same time.  ‘poll()’ scales better because the system call only
requires listing the file descriptors of interest, while ‘select()’
builds a bitmap, turns on bits for the fds of interest, and then
afterward the whole bitmap has to be linearly scanned again.  ‘select()’
is 'O'('highest file descriptor'), while ‘poll()’ is 'O'('number of file
descriptors').

 -- メソッド: poll.register (fd[, eventmask])

     ファイル記述子をポーリングオブジェクトに登録します。これ以降の
     *note poll(): 30a9. メソッド呼び出しでは、そのファイル記述子に処理
     待ち中の I/O イベントがあるかどうかを監視します。 'fd' は整数か、整
     数値を返す *note fileno(): 17ad. メソッドを持つオブジェクトを取りま
     す。ファイルオブジェクトも ‘fileno()’ を実装しているので、引数とし
     て使うことができます。

     'eventmask' はオプションのビットマスクで、どの種類の I/O イベントを
     監視したいかを記述します。この値は以下の表で述べる定数 ‘POLLIN’ 、
     ‘POLLPRI’ 、および ‘POLLOUT’ の組み合わせにすることができます。ビッ
     トマスクを指定しない場合、標準の値が使われ、 3 種類のイベント全てに
     対して監視が行われます。

     定数                    意味
                             
     -----------------------------------------------------------------------
                             
     ‘POLLIN’                読み出し可能なデータが存在する
                             
                             
     ‘POLLPRI’               緊急の読み出し可能なデータが存在する
                             
                             
     ‘POLLOUT’               書き出しの準備ができている: 書き出し処理がブ
                             ロックしない
                             
                             
     ‘POLLERR’               何らかのエラー状態
                             
                             
     ‘POLLHUP’               ハングアップ
                             
                             
     ‘POLLRDHUP’             ストリームソケットの他端が接続を切断したか、
                             接続の書き込み側のシャットダウンを行った。
                             
                             
     ‘POLLNVAL’              無効な要求: 記述子が開かれていない
                             

     登録済みのファイル記述子を登録してもエラーにはならず、一度だけ登録
     した場合と同じ効果になります。

 -- メソッド: poll.modify (fd, eventmask)

     登録されているファイル記述子 'fd' を変更する。これは、
     ‘register(fd, eventmask)’ と同じ効果を持ちます。登録されていないフ
     ァイル記述子に対してこのメソッドを呼び出すと、 errno ‘ENOENT’ で
     *note OSError: 2c0. 例外が発生します。

 -- メソッド: poll.unregister (fd)

     ポーリングオブジェクトによって追跡中のファイル記述子を登録解除しま
     す。 *note register(): 3a2e. メソッドと同様に、 'fd' は整数か、整数
     値を返す *note fileno(): 17ad. メソッドを持つオブジェクトを取ります
     。

     登録されていないファイル記述子を登録解除しようとすると *note
     KeyError: 5e7. 例外が送出されます。

 -- メソッド: poll.poll ([timeout])

     登録されたファイル記述子に対してポーリングを行い、報告すべき I/O イ
     ベントまたはエラーの発生したファイル記述子毎に 2 要素のタプル ‘(fd,
     event)’ からなるリストを返します。リストは空になることもあります。
     'fd' はファイル記述子で、 'event' は該当するファイル記述子について
     報告されたイベントを表すビットマスクです -- 例えば ‘POLLIN’ は入力
     待ちを示し、 ‘POLLOUT’ はファイル記述子に対する書き込みが可能を示す
     、などです。空のリストは呼び出しがタイムアウトしたか、報告すべきイ
     ベントがどのファイル記述子でも発生しなかったことを示します。
     'timeout' が与えられた場合、処理を戻すまで待機する時間の長さをミリ
     秒単位で指定します。 'timeout' が省略されたり、負の値であったり、あ
     るいは *note None: 885. の場合、そのポーリングオブジェクトが監視し
     ている何らかのイベントが発生するまでブロックします。

     バージョン 3.5 で変更: この関数は、シグナルによって中断された時に、
     *note InterruptedError: f88. を上げる代わりに再計算されたタイムアウ
     トによってリトライするようになりました。ただし、シグナルハンドラが
     例外を起こした場合を除きます (この論理的根拠については PEP 475(1) を
     見てください)。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/


File: python.info,  Node: kqueue オブジェクト,  Next: kevent オブジェクト,  Prev: ポーリングオブジェクト,  Up: select --- I/O 完了の待機

5.19.4.4 kqueue オブジェクト
............................

 -- メソッド: kqueue.close ()

     kqueue オブジェクトの制御用ファイル記述子を閉じる。

 -- の属性: kqueue.closed

     kqueue オブジェクトが閉じている場合 ‘True’ です。

 -- メソッド: kqueue.fileno ()

     制御用ファイル記述子の番号を返します。

 -- メソッド: kqueue.fromfd (fd)

     与えられたファイル記述子から、kqueue オブジェクトを作成する。

 -- メソッド: kqueue.control (changelist, max_events[, timeout]) ->
          eventlist

     kevent に対する低水準のインターフェース

        - 'changelist' は kevent オブジェクトのイテラブルまたは ‘None’

        - 'max_events' は 0 または正の整数

        - timeout in seconds (floats possible); the default is ‘None’,
          to wait forever

     バージョン 3.5 で変更: この関数は、シグナルによって中断された時に、
     *note InterruptedError: f88. を上げる代わりに再計算されたタイムアウ
     トによってリトライするようになりました。ただし、シグナルハンドラが
     例外を起こした場合を除きます (この論理的根拠については PEP 475(1) を
     見てください)。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/


File: python.info,  Node: kevent オブジェクト,  Prev: kqueue オブジェクト,  Up: select --- I/O 完了の待機

5.19.4.5 kevent オブジェクト
............................

‘https://man.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2’

 -- の属性: kevent.ident

     イベントを特定するための値。この値は、フィルタにもよりますが、大抵
     の場合はファイル記述子です。コンストラクタでは、 ident として、整数
     値か *note fileno(): 17ad. メソッドを持ったオブジェクトを渡せます。
     kevent は内部で整数値を保存します。

 -- の属性: kevent.filter

     カーネルフィルタの名前。

     定数                            意味
                                     
     ----------------------------------------------------------------------------------
                                     
     ‘KQ_FILTER_READ’                記述子を受け取り、読み込めるデータが存在する時
                                     に戻る
                                     
                                     
     ‘KQ_FILTER_WRITE’               記述子を受け取り、書き込み可能な時に戻る
                                     
                                     
     ‘KQ_FILTER_AIO’                 AIO リクエスト
                                     
                                     
     ‘KQ_FILTER_VNODE’               'fflag' で監視されたイベントが1つ以上発生したと
                                     きに戻る
                                     
                                     
     ‘KQ_FILTER_PROC’                プロセスID上のイベントを監視する
                                     
                                     
     ‘KQ_FILTER_NETDEV’              ネットワークデバイス上のイベントを監視する
                                     (macOS では利用不可)
                                     
                                     
     ‘KQ_FILTER_SIGNAL’              監視しているシグナルがプロセスに届いたときに戻
                                     る
                                     
                                     
     ‘KQ_FILTER_TIMER’               任意のタイマを設定する
                                     

 -- の属性: kevent.flags

     フィルタアクション。

     定数                            意味
                                     
     ----------------------------------------------------------------------------------
                                     
     ‘KQ_EV_ADD’                     イベントを追加または修正する
                                     
                                     
     ‘KQ_EV_DELETE’                  キューからイベントを取り除く
                                     
                                     
     ‘KQ_EV_ENABLE’                  Permits control() to return the event
                                     
                                     
     ‘KQ_EV_DISABLE’                 Disables event
                                     
                                     
     ‘KQ_EV_ONESHOT’                 イベントを最初の発生後無効にする
                                     
                                     
     ‘KQ_EV_CLEAR’                   イベントを受け取った後で状態をリセットする
                                     
                                     
     ‘KQ_EV_SYSFLAGS’                内部イベント
                                     
                                     
     ‘KQ_EV_FLAG1’                   内部イベント
                                     
                                     
     ‘KQ_EV_EOF’                     フィルタ依存のEOF状態
                                     
                                     
     ‘KQ_EV_ERROR’                   戻り値を参照
                                     

 -- の属性: kevent.fflags

     フィルタ依存のフラグ。

     ‘KQ_FILTER_READ’ と ‘KQ_FILTER_WRITE’ フィルタのフラグ:

     定数                             意味
                                      
     ----------------------------------------------------------------------------------
                                      
     ‘KQ_NOTE_LOWAT’                  ソケットバッファの最低基準値
                                      

     ‘KQ_FILTER_VNODE’ フィルタのフラグ:

     定数                             意味
                                      
     ----------------------------------------------------------------------------------
                                      
     ‘KQ_NOTE_DELETE’                 'unlink()' が呼ばれた
                                      
                                      
     ‘KQ_NOTE_WRITE’                  書き込みが発生した
                                      
                                      
     ‘KQ_NOTE_EXTEND’                 ファイルのサイズが拡張された
                                      
                                      
     ‘KQ_NOTE_ATTRIB’                 属性が変更された
                                      
                                      
     ‘KQ_NOTE_LINK’                   リンクカウントが変更された
                                      
                                      
     ‘KQ_NOTE_RENAME’                 ファイル名が変更された
                                      
                                      
     ‘KQ_NOTE_REVOKE’                 ファイルアクセスが破棄された
                                      

     ‘KQ_FILTER_PROC’ フィルタフラグ:

     定数                             意味
                                      
     ----------------------------------------------------------------------------------
                                      
     ‘KQ_NOTE_EXIT’                   プロセスが終了した
                                      
                                      
     ‘KQ_NOTE_FORK’                   プロセスが 'fork()' を呼び出した
                                      
                                      
     ‘KQ_NOTE_EXEC’                   プロセスが新しいプロセスを実行した
                                      
                                      
     ‘KQ_NOTE_PCTRLMASK’              内部フィルタフラグ
                                      
                                      
     ‘KQ_NOTE_PDATAMASK’              内部フィルタフラグ
                                      
                                      
     ‘KQ_NOTE_TRACK’                  'fork()' の呼び出しを超えてプロセスを監視する
                                      
                                      
     ‘KQ_NOTE_CHILD’                  'NOTE_TRACK' に対して子プロセスに渡される
                                      
                                      
     ‘KQ_NOTE_TRACKERR’               子プロセスにアタッチできなかった
                                      

     ‘KQ_FILTER_NETDEV’ フィルタフラグ (macOS では利用不可):

     定数                             意味
                                      
     ----------------------------------------------------------------------------------
                                      
     ‘KQ_NOTE_LINKUP’                 リンクアップしている
                                      
                                      
     ‘KQ_NOTE_LINKDOWN’               リンクダウンしている
                                      
                                      
     ‘KQ_NOTE_LINKINV’                リンク状態が不正
                                      

 -- の属性: kevent.data

     フィルタ固有のデータ。

 -- の属性: kevent.udata

     ユーザー定義値。


File: python.info,  Node: selectors --- 高水準の I/O 多重化,  Next: signal --- 非同期イベントにハンドラーを設定する,  Prev: select --- I/O 完了の待機,  Up: ネットワーク通信とプロセス間通信

5.19.5 ‘selectors’ -- 高水準の I/O 多重化
-----------------------------------------

Added in version 3.4.

'ソースコード:' Lib/selectors.py(1)

__________________________________________________________________

* Menu:

* はじめに: はじめに<11>.
* クラス: クラス<4>.
* 使用例: 使用例<29>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/selectors.py


File: python.info,  Node: はじめに<11>,  Next: クラス<4>,  Up: selectors --- 高水準の I/O 多重化

5.19.5.1 はじめに
.................

このモジュールにより、*note select: c6. モジュールプリミティブに基づく高
水準かつ効率的な I/O の多重化が行えます。OS 水準のプリミティブを使用した
正確な制御を求めない限り、このモジュールの使用が推奨されます。

このモジュールは *note BaseSelector: 3a41. 抽象基底クラスと、いくつかの
具象実装 (*note KqueueSelector: 3917, *note EpollSelector: dd0...)  を定
義しており、これらは複数のファイルオブジェクトの I/O の準備状況の通知の
待機に使用できます。以下では、 "ファイルオブジェクト" は、*note
fileno(): 17ad. メソッドを持つあらゆるオブジェクトか、あるいは Raw ファ
イル記述子を意味します。*note ファイルオブジェクト: 13db. を参照してくだ
さい。

*note DefaultSelector: 3a42. は、現在のプラットフォームで利用できる、も
っとも効率的な実装の別名になります: これはほとんどのユーザーにとってのデ
フォルトの選択になるはずです。

     注釈: プラットフォームごとにサポートされているファイルオブジェクト
     のタイプは異なります: Windows ではソケットはサポートされますが、パ
     イプはされません。Unix では両方がサポートされます (その他の fifo や
     スペシャルファイルデバイスなどのタイプもサポートされます)。

参考
....

*note select: c6.

     低水準の I/O 多重化モジュールです。

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。


File: python.info,  Node: クラス<4>,  Next: 使用例<29>,  Prev: はじめに<11>,  Up: selectors --- 高水準の I/O 多重化

5.19.5.2 クラス
...............

クラス階層:

     BaseSelector
     +-- SelectSelector
     +-- PollSelector
     +-- EpollSelector
     +-- DevpollSelector
     +-- KqueueSelector

In the following, 'events' is a bitwise mask indicating which I/O events
should be waited for on a given file object.  It can be a combination of
the module's constants below:

     定数                        意味
                                 
     --------------------------------------------------------------------------------
                                 
      -- データ:                 読み込み可能
               selectors.EVENT_READ

      -- データ:                 書き込み可能
               selectors.EVENT_WRITE

 -- クラス: selectors.SelectorKey

     *note SelectorKey: 3a46. はそれの下層のファイルディスクリプタ、選択
     したイベントマスク、および付属データへのファイルオブジェクトの関連
     付けに使用される *note namedtuple: 4e0. です。いくつかの *note
     BaseSelector: 3a41. メソッドを返します。

      -- の属性: fileobj

          登録されたファイルオブジェクトです。

      -- の属性: fd

          下層のファイル記述子です。

      -- の属性: events

          このファイルオブジェクトで待機しなければならないイベントです。

      -- の属性: data

          このファイルオブジェクトに関連付けられたオプションの不透明型
          (Opaque) データです。例えば、これはクライアントごとのセッショ
          ン ID を格納するために使用できます。

 -- クラス: selectors.BaseSelector

     *note BaseSelector: 3a41. は複数のファイルオブジェクトの I/O イベン
     トの準備状況の待機に使用されます。これはファイルストリームを登録、
     登録解除、およびこれらのストリームでの I/O イベントを待機 (オプショ
     ンでタイムアウト) するメソッドをサポートします。これは抽象基底クラ
     スであるため、インスタンスを作成できません。使用する実装を明示的に
     指定したい、そしてプラットフォームがそれをサポートしている場合は、
     代わりに *note DefaultSelector: 3a42. を使用するか、*note
     SelectSelector: 3914. や *note KqueueSelector: 3917. などの一つを使
     用します。*note BaseSelector: 3a41. とその具象実装は *note
     コンテキストマネージャー: 1e1. プロトコルをサポートしています。

      -- メソッド: abstractmethod register (fileobj, events, data=None)

          I/O イベントを監視するファイルオブジェクトをセレクションに登録
          します。

          'fileobj' は監視するファイルオブジェクトです。これは整数のファ
          イル記述子か、‘fileno()’ メソッドを持つオブジェクトのどちらか
          になります。'events' は監視するイベントのビット幅マスクになり
          ます。'data' は不透明型 (Opaque) オブジェクトです。

          これは新しい *note SelectorKey: 3a46. インスタンスを返します。
          不正なイベントマスク化ファイル記述子のときは *note ValueError:
          2ec. が、ファイルオブジェクトがすでに登録済みのときは *note
          KeyError: 5e7. が送出されます。

      -- メソッド: abstractmethod unregister (fileobj)

          ファイルオブジェクトのセレクション登録を解除し、監視対象から外
          します。ファイルオブジェクトの登録解除はそのクローズより前に行
          われます。

          'fileobj' は登録済みのファイルオブジェクトでなければなりません
          。

          関連付けられた *note SelectorKey: 3a46. インスタンスを返します
          。'fileobj' が登録されていない場合 *note KeyError: 5e7. を送出
          します。'fileobj' が不正な場合 (例えば 'fileobj' に ‘fileno()’
          メソッドが無い場合や ‘fileno()’ メソッドの戻り値が不正な場合)
          *note ValueError: 2ec. を送出します。

      -- メソッド: modify (fileobj, events, data=None)

          登録されたファイルオブジェクトの監視されたイベントや付属データ
          を変更します。

          より効率的に実装できる点を除けば、
          ‘BaseSelector.unregister(fileobj)’ に続けて
          ‘BaseSelector.register(fileobj, events, data)’ を行うのと等価
          です。

          新たな *note SelectorKey: 3a46. インスタンスを返します。 イベ
          ントマスクやファイル記述子が不正な場合は *note ValueError:
          2ec. を、ファイルオブジェクトが登録されていない場合は *note
          KeyError: 5e7. を送出します。

      -- メソッド: abstractmethod select (timeout=None)

          登録されたいくつかのファイルオブジェクトが準備できたか、タイム
          アウトするまで待機します。

          ‘timeout > 0’ の場合、最大待機時間を秒で指定します。 ‘timeout
          <= 0’ の場合、この関数の呼び出しはブロックせず、 現在準備でき
          ているファイルオブジェクトを報告します。 'timeout' が ‘None’ の
          場合、監視しているファイルオブジェクトの一つが準備できるまでブ
          ロックします。

          この関数は ‘(key, events)’ タプルのリストを返します。準備でき
          たファイルオブジェクトにつき1タプルです。

          'key' は準備状態のファイルオブジェクトに対応する *note
          SelectorKey: 3a46. インスタンスです。 'events' はそのファイル
          オブジェクトで準備が完了したイベントのビットマスクです。

               注釈: このメソッドは、現在のプロセスで信号を受信した場合
               、どのファイルオブジェクトも準備完了にならないうちに、ま
               たはタイムアウトが経過する前に返ることがあります。その場
               合、空のリストが返されます。

          バージョン 3.5 で変更: このセレクタは、シグナルによって中断さ
          れた時に、シグナルハンドラが例外を起こさなかった場合、空のイベ
          ントリストを返すのではなく、再計算されたタイムアウトによってリ
          トライするようになりました (この論拠については PEP 475(1) を参
          照してください)。

      -- メソッド: close ()

          セレクタを閉じます。

          下層のリソースがすべて解放されたことを確かめるために呼ばれなけ
          ればなりません。一旦閉じられたセレクタは使ってはいけません。

      -- メソッド: get_key (fileobj)

          登録されたファイルオブジェクトに関連付けられたキーを返します。

          そのファイルオブジェクトに関連付けられた *note SelectorKey:
          3a46. インスタンスを返します。そのファイルオブジェクトが登録さ
          れていない場合 *note KeyError: 5e7. を送出します。

      -- メソッド: abstractmethod get_map ()

          ファイルオブジェクトからセレクタキーへのマッピングを返します。

          これは、登録済みのファイルオブジェクトを、それらに関連づけられ
          た *note SelectorKey: 3a46. インスタンスにマッピングする *note
          Mapping: ac7. のインスタンスを返します。

 -- クラス: selectors.DefaultSelector

     デフォルトの selector クラスで、現在のプラットフォームで利用できる
     最も効率的な実装を使用しています。大半のユーザはこれをデフォルトに
     すべきです。

 -- クラス: selectors.SelectSelector

     *note select.select(): fa0. を基底とするセレクタです。

 -- クラス: selectors.PollSelector

     *note select.poll(): 30a9. を基底とするセレクタです。

 -- クラス: selectors.EpollSelector

     *note select.epoll(): 1196. を基底とするセレクタです。

      -- メソッド: fileno ()

          下層の *note select.epoll(): 1196. オブジェクトが使用している
          ファイル記述子を返します。

 -- クラス: selectors.DevpollSelector

     *note select.devpoll(): 1198. を基底とするセレクタです。

      -- メソッド: fileno ()

          下層の *note select.devpoll(): 1198. オブジェクトが使用してい
          るファイル記述子を返します。

     Added in version 3.5.

 -- クラス: selectors.KqueueSelector

     *note select.kqueue(): 1a43. を基底とするセレクタです。

      -- メソッド: fileno ()

          下層の *note select.kqueue(): 1a43. オブジェクトが使用している
          ファイル記述子を返します。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0475/


File: python.info,  Node: 使用例<29>,  Prev: クラス<4>,  Up: selectors --- 高水準の I/O 多重化

5.19.5.3 使用例
...............

簡単なエコーサーバの実装です:

     import selectors
     import socket

     sel = selectors.DefaultSelector()

     def accept(sock, mask):
         conn, addr = sock.accept()  # Should be ready
         print('accepted', conn, 'from', addr)
         conn.setblocking(False)
         sel.register(conn, selectors.EVENT_READ, read)

     def read(conn, mask):
         data = conn.recv(1000)  # Should be ready
         if data:
             print('echoing', repr(data), 'to', conn)
             conn.send(data)  # Hope it won't block
         else:
             print('closing', conn)
             sel.unregister(conn)
             conn.close()

     sock = socket.socket()
     sock.bind(('localhost', 1234))
     sock.listen(100)
     sock.setblocking(False)
     sel.register(sock, selectors.EVENT_READ, accept)

     while True:
         events = sel.select()
         for key, mask in events:
             callback = key.data
             callback(key.fileobj, mask)


File: python.info,  Node: signal --- 非同期イベントにハンドラーを設定する,  Next: mmap --- メモリマップファイルのサポート,  Prev: selectors --- 高水準の I/O 多重化,  Up: ネットワーク通信とプロセス間通信

5.19.6 ‘signal’ -- 非同期イベントにハンドラーを設定する
-------------------------------------------------------

'ソースコード:' Lib/signal.py(1)

__________________________________________________________________

このモジュールでは Python でシグナルハンドラを使うための機構を提供します
。

* Menu:

* 一般的なルール::
* モジュールの内容: モジュールの内容<2>.
* 使用例: 使用例<30>.
* Note on SIGPIPE::
* Note on Signal Handlers and Exceptions::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/signal.py


File: python.info,  Node: 一般的なルール,  Next: モジュールの内容<2>,  Up: signal --- 非同期イベントにハンドラーを設定する

5.19.6.1 一般的なルール
.......................

*note signal.signal(): 134c. 関数を使って、シグナルを受信した時に実行さ
れるハンドラを定義することができます。 Python は標準でごく少数のシグナル
ハンドラをインストールしています: *note SIGPIPE: 3a59. は無視され (した
がって、 pipe や socket に対する書き込みで生じたエラーは通常の Python 例
外として報告されます)、 *note SIGINT: 253. は *note KeyboardInterrupt:
bc5. 例外に変換されます。親プロセスが変更していない場合は、これらはどれ
も上書きすることができます。

特定のシグナルに対するハンドラが一度設定されると、明示的にリセットしない
かぎり設定されたままになります (Python は背後の実装系に関係なく BSD 形式
のインターフェースをエミュレートします)。例外は *note SIGCHLD: 30e4. の
ハンドラで、この場合は背後の実装系の仕様に従います。

On WebAssembly platforms, signals are emulated and therefore behave
differently.  Several functions and signals are not available on these
platforms.

* Menu:

* Python のシグナルハンドラの実行::
* シグナルとスレッド::


File: python.info,  Node: Python のシグナルハンドラの実行,  Next: シグナルとスレッド,  Up: 一般的なルール

5.19.6.2 Python のシグナルハンドラの実行
........................................

A Python signal handler does not get executed inside the low-level (C)
signal handler.  Instead, the low-level signal handler sets a flag which
tells the *note virtual machine: 3a5b. to execute the corresponding
Python signal handler at a later point (for example, at the next *note
bytecode: 4aa. instruction).  This has consequences:

   * It makes little sense to catch synchronous errors like *note
     SIGFPE: 128d. or *note SIGSEGV: 128c. that are caused by an invalid
     operation in C code.  Python will return from the signal handler to
     the C code, which is likely to raise the same signal again, causing
     Python to apparently hang.  From Python 3.3 onwards, you can use
     the *note faulthandler: 5c. module to report on synchronous errors.

   * 完全にCで実装された長時間かかる計算 (大きいテキストに対する正規表現
     のマッチなど) は、どのシグナルを受信しても中断されないまま長時間実
     行され続ける可能性があります。Python のシグナルハンドラはその計算が
     終了してから呼び出されます。

   * If the handler raises an exception, it will be raised "out of thin
     air" in the main thread.  See the *note note below: 26ec. for a
     discussion.


File: python.info,  Node: シグナルとスレッド,  Prev: Python のシグナルハンドラの実行,  Up: 一般的なルール

5.19.6.3 シグナルとスレッド
...........................

Python のシグナルハンドラは、もしシグナルを受け取ったのが別のスレッドだ
ったとしても、常にメインインタープリターの Python のメインスレッドで実行
されます。このためシグナルをスレッド間通信に使うことはできません。代わり
に *note threading: f3. モジュールが提供している同期プリミティブを利用で
きます。

また、メインインタープリターのメインスレッドだけが新しいシグナルハンドラ
を登録できます。

     警告: Synchronization primitives such as *note threading.Lock:
     19f4. should not be used within signal handlers.  Doing so can lead
     to unexpected deadlocks.


File: python.info,  Node: モジュールの内容<2>,  Next: 使用例<30>,  Prev: 一般的なルール,  Up: signal --- 非同期イベントにハンドラーを設定する

5.19.6.4 モジュールの内容
.........................

バージョン 3.5 で変更: signal (SIG*), handler (*note SIG_DFL: 1bb2,
*note SIG_IGN: 1bb1.) and sigmask (*note SIG_BLOCK: 3a5f, *note
SIG_UNBLOCK: 3a60, *note SIG_SETMASK: 3a61.) related constants listed
below were turned into *note enums: edb. (*note Signals: 3a62, *note
Handlers: 3a63. and *note Sigmasks: 3a64. respectively).  *note
getsignal(): 1a25, *note pthread_sigmask(): 1348, *note sigpending():
134a. and *note sigwait(): 134b. functions return human-readable *note
enums: edb. as *note Signals: 3a62. objects.

The signal module defines three enums:

 -- クラス: signal.Signals

     *note enum.IntEnum: edb. collection of SIG* constants and the
     CTRL_* constants.

     Added in version 3.5.

 -- クラス: signal.Handlers

     *note enum.IntEnum: edb. collection of the constants *note SIG_DFL:
     1bb2. and *note SIG_IGN: 1bb1.

     Added in version 3.5.

 -- クラス: signal.Sigmasks

     *note enum.IntEnum: edb. collection of the constants *note
     SIG_BLOCK: 3a5f, *note SIG_UNBLOCK: 3a60. and *note SIG_SETMASK:
     3a61.

     *note Availability: 213f.: Unix.

     See the man page ‘sigprocmask(2)(1)’ and ‘pthread_sigmask(3)(2)’
     for further information.

     Added in version 3.5.

The variables defined in the ‘signal’ module are:

 -- データ: signal.SIG_DFL

     二つある標準シグナル処理オプションのうちの一つです; 単純にシグナル
     に対する標準の関数を実行します。例えば、ほとんどのシステムでは、
     *note SIGQUIT: 3a65. に対する標準の動作はコアダンプと終了で、 *note
     SIGCHLD: 30e4. に対する標準の動作は単にシグナルの無視です。

 -- データ: signal.SIG_IGN

     もう一つの標準シグナル処理オプションで、受け取ったシグナルを単に無
     視します。

 -- データ: signal.SIGABRT

     Abort signal from ‘abort(3)(3)’.

 -- データ: signal.SIGALRM

     Timer signal from ‘alarm(2)(4)’.

     *note Availability: 213f.: Unix.

 -- データ: signal.SIGBREAK

     Interrupt from keyboard (CTRL + BREAK).

     *note Availability: 213f.: Windows.

 -- データ: signal.SIGBUS

     Bus error (bad memory access).

     *note Availability: 213f.: Unix.

 -- データ: signal.SIGCHLD

     Child process stopped or terminated.

     *note Availability: 213f.: Unix.

 -- データ: signal.SIGCLD

     *note SIGCHLD: 30e4. のエイリアスです。

     *note Availability: 213f.: not macOS.

 -- データ: signal.SIGCONT

     Continue the process if it is currently stopped

     *note Availability: 213f.: Unix.

 -- データ: signal.SIGFPE

     Floating-point exception.  For example, division by zero.

     参考
     ....

     *note ZeroDivisionError: b3f. is raised when the second argument of
     a division or modulo operation is zero.

 -- データ: signal.SIGHUP

     Hangup detected on controlling terminal or death of controlling
     process.

     *note Availability: 213f.: Unix.

 -- データ: signal.SIGILL

     Illegal instruction.

 -- データ: signal.SIGINT

     Interrupt from keyboard (CTRL + C).

     Default action is to raise *note KeyboardInterrupt: bc5.

 -- データ: signal.SIGKILL

     Kill signal.

     It cannot be caught, blocked, or ignored.

     *note Availability: 213f.: Unix.

 -- データ: signal.SIGPIPE

     Broken pipe: write to pipe with no readers.

     Default action is to ignore the signal.

     *note Availability: 213f.: Unix.

 -- データ: signal.SIGPROF

     Profiling timer expired.

     *note Availability: 213f.: Unix.

 -- データ: signal.SIGQUIT

     Terminal quit signal.

     *note Availability: 213f.: Unix.

 -- データ: signal.SIGSEGV

     Segmentation fault: invalid memory reference.

 -- データ: signal.SIGSTOP

     Stop executing (cannot be caught or ignored).

 -- データ: signal.SIGSTKFLT

     Stack fault on coprocessor.  The Linux kernel does not raise this
     signal: it can only be raised in user space.

     *note Availability: 213f.: Linux.

     On architectures where the signal is available.  See the man page
     ‘signal(7)(5)’ for further information.

     Added in version 3.11.

 -- データ: signal.SIGTERM

     Termination signal.

 -- データ: signal.SIGUSR1

     User-defined signal 1.

     *note Availability: 213f.: Unix.

 -- データ: signal.SIGUSR2

     User-defined signal 2.

     *note Availability: 213f.: Unix.

 -- データ: signal.SIGVTALRM

     Virtual timer expired.

     *note Availability: 213f.: Unix.

 -- データ: signal.SIGWINCH

     Window resize signal.

     *note Availability: 213f.: Unix.

 -- データ: signal.SIGXCPU

     CPU time limit exceeded.

     *note Availability: 213f.: Unix.

 -- データ: SIG*

     All the signal numbers are defined symbolically.  For example, the
     hangup signal is defined as *note signal.SIGHUP: 3a69.; the
     variable names are identical to the names used in C programs, as
     found in ‘<signal.h>’.  The Unix man page for '‘signal’' lists the
     existing signals (on some systems this is ‘signal(2)(6)’, on others
     the list is in ‘signal(7)(7)’).  Note that not all systems define
     the same set of signal names; only those names defined by the
     system are defined by this module.

 -- データ: signal.CTRL_C_EVENT

     ‘CTRL’+‘C’ キーストロークに該当するシグナル。このシグナルは *note
     os.kill(): 157f. でだけ利用できます。

     *note Availability: 213f.: Windows.

     Added in version 3.2.

 -- データ: signal.CTRL_BREAK_EVENT

     ‘CTRL’+‘BREAK’ キーストロークに該当するシグナル。このシグナルは
     *note os.kill(): 157f. でだけ利用できます。

     *note Availability: 213f.: Windows.

     Added in version 3.2.

 -- データ: signal.NSIG

     One more than the number of the highest signal number.  Use *note
     valid_signals(): 3a71. to get valid signal numbers.

 -- データ: signal.ITIMER_REAL

     実時間でデクリメントするインターバルタイマーです。タイマーが発火し
     たときに *note SIGALRM: 3a66. を送ります。

 -- データ: signal.ITIMER_VIRTUAL

     プロセスの実行時間だけデクリメントするインターバルタイマーです。タ
     イマーが発火したときに *note SIGVTALRM: 3a6e. を送ります。

 -- データ: signal.ITIMER_PROF

     プロセスの実行中と、システムがそのプロセスのために実行している時間
     だけデクリメントするインターバルタイマーです。ITIMER_VIRTUAL と組み
     合わせて、このタイマーはよくアプリケーションがユーザー空間とカーネ
     ル空間で消費した時間のプロファイリングに利用されます。タイマーが発
     火したときに *note SIGPROF: 3a6a. を送ります。

 -- データ: signal.SIG_BLOCK

     *note pthread_sigmask(): 1348. の 'how' 引数に渡せる値で、シグナル
     がブロックされることを意味します。

     Added in version 3.3.

 -- データ: signal.SIG_UNBLOCK

     *note pthread_sigmask(): 1348. の 'how' 引数に渡せる値で、シグナル
     がブロック解除されることを意味します。

     Added in version 3.3.

 -- データ: signal.SIG_SETMASK

     *note pthread_sigmask(): 1348. の 'how' 引数に渡せる値で、シグナル
     が置換されることを意味します。

     Added in version 3.3.

The ‘signal’ module defines one exception:

 -- 例外: signal.ItimerError

     背後の *note setitimer(): 3a76. または *note getitimer(): 3a77. 実
     装からエラーを通知するために送出されます。無効なインタバルタイマー
     や負の時間が *note setitimer(): 3a76. に渡された場合、このエラーを
     予期してください。このエラーは *note OSError: 2c0. を継承しています
     。

     Added in version 3.3: このエラーは以前は *note IOError: 125e. のサ
     ブタイプでしたが、 *note OSError: 2c0. のエイリアスになりました。

The ‘signal’ module defines the following functions:

 -- の関数: signal.alarm (time)

     'time' がゼロでない値の場合、この関数は 'time' 秒後頃に *note
     SIGALRM: 3a66. をプロセスに送るように要求します。それ以前にスケジュ
     ールしたアラームはキャンセルされます (常に一つのアラームしかスケジ
     ュールできません)。この場合、戻り値は以前に設定されたアラームシグナ
     ルが通知されるまであと何秒だったかを示す値です。 'time' がゼロの場
     合、アラームは一切スケジュールされず、現在スケジュールされているア
     ラームがキャンセルされます。戻り値がゼロの場合、現在アラームがスケ
     ジュールされていないことを示します。

     *note Availability: 213f.: Unix.

     See the man page ‘alarm(2)(8)’ for further information.

 -- の関数: signal.getsignal (signalnum)

     シグナル 'signalnum' に対する現在のシグナルハンドラを返します。戻り
     値は呼び出し可能な Python オブジェクトか、 *note signal.SIG_IGN:
     1bb1.、 *note signal.SIG_DFL: 1bb2.、および *note None: 885. といっ
     た特殊な値のいずれかです。ここで *note signal.SIG_IGN: 1bb1. は以前
     そのシグナルが無視されていたことを示し、 *note signal.SIG_DFL:
     1bb2. は以前そのシグナルの標準の処理方法が使われていたことを示し、
     ‘None’ はシグナルハンドラがまだ Python によってインストールされてい
     ないことを示します。

 -- の関数: signal.strsignal (signalnum)

     Returns the description of signal 'signalnum', such as "Interrupt"
     for *note SIGINT: 253.  Returns *note None: 885. if 'signalnum' has
     no description.  Raises *note ValueError: 2ec. if 'signalnum' is
     invalid.

     Added in version 3.8.

 -- の関数: signal.valid_signals ()

     Return the set of valid signal numbers on this platform.  This can
     be less than ‘range(1, NSIG)’ if some signals are reserved by the
     system for internal use.

     Added in version 3.8.

 -- の関数: signal.pause ()

     シグナルを受け取るまでプロセスを一時停止します; その後、適切なハン
     ドラが呼び出されます。戻り値はありません。

     *note Availability: 213f.: Unix.

     See the man page ‘signal(2)(9)’ for further information.

     *note sigwait(): 134b, *note sigwaitinfo(): fab, *note
     sigtimedwait(): faa. *note sigpending(): 134a. も参照してください。

 -- の関数: signal.raise_signal (signum)

     Sends a signal to the calling process.  Returns nothing.

     Added in version 3.8.

 -- の関数: signal.pidfd_send_signal (pidfd, sig, siginfo=None, flags=0)

     Send signal 'sig' to the process referred to by file descriptor
     'pidfd'.  Python does not currently support the 'siginfo'
     parameter; it must be ‘None’.  The 'flags' argument is provided for
     future extensions; no flag values are currently defined.

     さらに詳しい情報についてはオンラインマニュアルページ
     ‘pidfd_send_signal(2)(10)’ を参照してください。

     *note Availability: 213f.: Linux >= 5.1, Android >= *note
     build-time: d83. API level 31

     Added in version 3.9.

 -- の関数: signal.pthread_kill (thread_id, signalnum)

     Send the signal 'signalnum' to the thread 'thread_id', another
     thread in the same process as the caller.  The target thread can be
     executing any code (Python or not).  However, if the target thread
     is executing the Python interpreter, the Python signal handlers
     will be *note executed by the main thread of the main interpreter:
     3a5d.  Therefore, the only point of sending a signal to a
     particular Python thread would be to force a running system call to
     fail with *note InterruptedError: f88.

     Use *note threading.get_ident(): 1372. or the *note ident: 3137.
     attribute of *note threading.Thread: 176. objects to get a suitable
     value for 'thread_id'.

     If 'signalnum' is 0, then no signal is sent, but error checking is
     still performed; this can be used to check if the target thread is
     still running.

     引数 ‘thread_id’, ‘signalnum’ を指定して *note 監査イベント: 1c6e.
     ‘signal.pthread_kill’ を送出します。

     *note Availability: 213f.: Unix.

     See the man page ‘pthread_kill(3)(11)’ for further information.

     *note os.kill(): 157f. を参照してください。

     Added in version 3.3.

 -- の関数: signal.pthread_sigmask (how, mask)

     これを呼び出すスレッドにセットされているシグナルマスクを取り出した
     り変更したりします。シグナルマスクは、呼び出し側のために現在どのシ
     グナルの配送がブロックされているかを示す集合 (set) です。呼び出し前
     のもとのシグナルマスクを集合として返却します。

     この関数の振る舞いは 'how' に依存して以下のようになります。

        * *note SIG_BLOCK: 3a5f.: 'mask' で指定されるシグナルが現時点の
          シグナルマスクに追加されます。

        * *note SIG_UNBLOCK: 3a60.: 'mask' で指定されるシグナルが現時点
          のシグナルマスクから取り除かれます。もともとブロックされていな
          いシグナルをブロック解除しようとしても問題ありません。

        * *note SIG_SETMASK: 3a61.: シグナルマスク全体を 'mask' としてセ
          ットします。

     'mask' はシグナル番号の集合です (例えば {*note signal.SIGINT: 253,
     *note signal.SIGTERM: 15f8.})。全てのシグナルを含む全集合として
     *note valid_signals(): 3a71. を使うことが出来ます。

     呼び出しスレッドにセットされたシグナルマスクを問い合わせるには例え
     ば ‘signal.pthread_sigmask(signal.SIG_BLOCK, [])’ とします。

     *note SIGKILL: d50. and *note SIGSTOP: 3a6b. cannot be blocked.

     *note Availability: 213f.: Unix.

     See the man page ‘sigprocmask(2)(12)’ and ‘pthread_sigmask(3)(13)’
     for further information.

     *note pause(): 3a79, *note sigpending(): 134a, *note sigwait():
     134b. も参照して下さい。

     Added in version 3.3.

 -- の関数: signal.setitimer (which, seconds, interval=0.0)

     'which' で指定されたタイマー (*note signal.ITIMER_REAL: 3a72, *note
     signal.ITIMER_VIRTUAL: 3a73, *note signal.ITIMER_PROF: 3a74. のどれ
     か) を、 'seconds' 秒後と (*note alarm(): 3a78. と異なり、floatを指
     定できます)、それから ('interval' が0でなければ) 'interval' 秒間隔
     で起動するように設定します。 'seconds' に0を指定すると、'which' で
     指定されたタイマーをクリアすることができます。

     インターバルタイマーが起動したとき、シグナルがプロセスに送られます
     。送られるシグナルは利用されたタイマーの種類に依存します。 *note
     signal.ITIMER_REAL: 3a72. の場合は *note SIGALRM: 3a66. が、 *note
     signal.ITIMER_VIRTUAL: 3a73. の場合は *note SIGVTALRM: 3a6e. が、
     *note signal.ITIMER_PROF: 3a74. の場合は *note SIGPROF: 3a6a. が送
     られます。

     以前の値が (delay, interval) のタプルとして返されます。

     無効なインターバルタイマーを渡すと *note ItimerError: 3a75. 例外が
     発生します。

     *note Availability: 213f.: Unix.

 -- の関数: signal.getitimer (which)

     'which' で指定されたインターバルタイマーの現在の値を返します。

     *note Availability: 213f.: Unix.

 -- の関数: signal.set_wakeup_fd (fd, *, warn_on_full_buffer=True)

     Set the wakeup file descriptor to 'fd'.  When a signal your program
     has registered a signal handler for is received, the signal number
     is written as a single byte into the fd.  If you haven't registered
     a signal handler for the signals you care about, then nothing will
     be written to the wakeup fd.  This can be used by a library to
     wakeup a poll or select call, allowing the signal to be fully
     processed.

     The old wakeup fd is returned (or -1 if file descriptor wakeup was
     not enabled).  If 'fd' is -1, file descriptor wakeup is disabled.
     If not -1, 'fd' must be non-blocking.  It is up to the library to
     remove any bytes from 'fd' before calling poll or select again.

     スレッドが有効な場合、この関数は *note
     メインインタープリターのメインスレッド: 3a5d. からしか実行できませ
     ん。それ以外のスレッドからこの関数を実行しようとすると *note
     ValueError: 2ec. 例外が発生します。

     There are two common ways to use this function.  In both
     approaches, you use the fd to wake up when a signal arrives, but
     then they differ in how they determine 'which' signal or signals
     have arrived.

     In the first approach, we read the data out of the fd's buffer, and
     the byte values give you the signal numbers.  This is simple, but
     in rare cases it can run into a problem: generally the fd will have
     a limited amount of buffer space, and if too many signals arrive
     too quickly, then the buffer may become full, and some signals may
     be lost.  If you use this approach, then you should set
     ‘warn_on_full_buffer=True’, which will at least cause a warning to
     be printed to stderr when signals are lost.

     In the second approach, we use the wakeup fd 'only' for wakeups,
     and ignore the actual byte values.  In this case, all we care about
     is whether the fd's buffer is empty or non-empty; a full buffer
     doesn't indicate a problem at all.  If you use this approach, then
     you should set ‘warn_on_full_buffer=False’, so that your users are
     not confused by spurious warning messages.

     バージョン 3.5 で変更: Windowsで、この関数はソケットハンドルをサポ
     ートするようになりました。

     バージョン 3.7 で変更: ‘warn_on_full_buffer’ 引数が追加されました。

 -- の関数: signal.siginterrupt (signalnum, flag)

     システムコールのリスタートの動作を変更します。 'flag' が *note
     False: d2b. の場合、 'signalnum' シグナルに中断されたシステムコール
     は再実行されます。それ以外の場合、システムコールは中断されます。戻
     り値はありません。

     *note Availability: 213f.: Unix.

     See the man page ‘siginterrupt(3)(14)’ for further information.

     Note that installing a signal handler with *note signal(): cb. will
     reset the restart behaviour to interruptible by implicitly calling
     ‘siginterrupt()’ with a true 'flag' value for the given signal.

 -- の関数: signal.signal (signalnum, handler)

     シグナル 'signalnum' に対するハンドラを関数 'handler' にします。
     'handler' は二つの引数 (下記参照) を取る呼び出し可能な Python オブ
     ジェクトか、 *note signal.SIG_IGN: 1bb1. あるいは *note
     signal.SIG_DFL: 1bb2. といった特殊な値にすることができます。以前に
     使われていたシグナルハンドラが返されます (上記の *note getsignal():
     1a25. の記述を参照してください)。 (さらに詳しい情報については Unix
     マニュアルページ ‘signal(2)(15)’ を参照してください。)

     スレッドが有効な場合、この関数は *note
     メインインタープリターのメインスレッド: 3a5d. からしか実行できませ
     ん。それ以外のスレッドからこの関数を実行しようとすると *note
     ValueError: 2ec. 例外が発生します。

     'handler' は二つの引数とともに呼び出されます: シグナル番号、および
     現在のスタックフレーム (‘None’ またはフレームオブジェクト; フレーム
     オブジェクトについての記述は *note 標準型の階層における説明: 8ef. か
     、 *note inspect: 82. モジュールの属性の説明を参照してください)。

     On Windows, *note signal(): cb. can only be called with *note
     SIGABRT: 128e, *note SIGFPE: 128d, *note SIGILL: 1290, *note
     SIGINT: 253, *note SIGSEGV: 128c, *note SIGTERM: 15f8, or *note
     SIGBREAK: 3a67.  A *note ValueError: 2ec. will be raised in any
     other case.  Note that not all systems define the same set of
     signal names; an *note AttributeError: 5f0. will be raised if a
     signal name is not defined as ‘SIG*’ module level constant.

 -- の関数: signal.sigpending ()

     呼び出しスレッドで配送が保留されているシグナル (つまり配送がブロッ
     クされている間に発生したシグナル) の集合を調べます。保留中のシグナ
     ルの集合を返します。

     *note Availability: 213f.: Unix.

     See the man page ‘sigpending(2)(16)’ for further information.

     *note pause(): 3a79, *note pthread_sigmask(): 1348, *note
     sigwait(): 134b. も参照して下さい。

     Added in version 3.3.

 -- の関数: signal.sigwait (sigset)

     'sigset' 集合で指定されたシグナルのうちどれか一つが届くまで呼び出し
     スレッドを一時停止します。この関数はそのシグナルを受け取ると (それ
     を保留シグナルリストから取り除いて) そのシグナル番号を返します。

     *note Availability: 213f.: Unix.

     See the man page ‘sigwait(3)(17)’ for further information.

     *note pause(): 3a79, *note pthread_sigmask(): 1348, *note
     sigpending(): 134a, *note sigwaitinfo(): fab, *note sigtimedwait():
     faa. も参照して下さい。

     Added in version 3.3.

 -- の関数: signal.sigwaitinfo (sigset)

     Suspend execution of the calling thread until the delivery of one
     of the signals specified in the signal set 'sigset'.  The function
     accepts the signal and removes it from the pending list of signals.
     If one of the signals in 'sigset' is already pending for the
     calling thread, the function will return immediately with
     information about that signal.  The signal handler is not called
     for the delivered signal.  The function raises an *note
     InterruptedError: f88. if it is interrupted by a signal that is not
     in 'sigset'.

     The return value is an object representing the data contained in
     the ‘siginfo_t’ structure, namely: ‘si_signo’, ‘si_code’,
     ‘si_errno’, ‘si_pid’, ‘si_uid’, ‘si_status’, ‘si_band’.

     *note Availability: 213f.: Unix.

     See the man page ‘sigwaitinfo(2)(18)’ for further information.

     *note pause(): 3a79, *note sigwait(): 134b, *note sigtimedwait():
     faa. も参照して下さい。

     Added in version 3.3.

     バージョン 3.5 で変更: The function is now retried if interrupted
     by a signal not in 'sigset' and the signal handler does not raise
     an exception (see PEP 475(19) for the rationale).

 -- の関数: signal.sigtimedwait (sigset, timeout)

     Like *note sigwaitinfo(): fab, but takes an additional 'timeout'
     argument specifying a timeout.  If 'timeout' is specified as ‘0’, a
     poll is performed.  Returns *note None: 885. if a timeout occurs.

     *note Availability: 213f.: Unix.

     See the man page ‘sigtimedwait(2)(20)’ for further information.

     *note pause(): 3a79, *note sigwait(): 134b, *note sigwaitinfo():
     fab. も参照して下さい。

     Added in version 3.3.

     バージョン 3.5 で変更: The function is now retried with the
     recomputed 'timeout' if interrupted by a signal not in 'sigset' and
     the signal handler does not raise an exception (see PEP 475(21) for
     the rationale).

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/sigprocmask(2)

   (2) https://manpages.debian.org/pthread_sigmask(3)

   (3) https://manpages.debian.org/abort(3)

   (4) https://manpages.debian.org/alarm(2)

   (5) https://manpages.debian.org/signal(7)

   (6) https://manpages.debian.org/signal(2)

   (7) https://manpages.debian.org/signal(7)

   (8) https://manpages.debian.org/alarm(2)

   (9) https://manpages.debian.org/signal(2)

   (10) https://manpages.debian.org/pidfd_send_signal(2)

   (11) https://manpages.debian.org/pthread_kill(3)

   (12) https://manpages.debian.org/sigprocmask(2)

   (13) https://manpages.debian.org/pthread_sigmask(3)

   (14) https://manpages.debian.org/siginterrupt(3)

   (15) https://manpages.debian.org/signal(2)

   (16) https://manpages.debian.org/sigpending(2)

   (17) https://manpages.debian.org/sigwait(3)

   (18) https://manpages.debian.org/sigwaitinfo(2)

   (19) https://peps.python.org/pep-0475/

   (20) https://manpages.debian.org/sigtimedwait(2)

   (21) https://peps.python.org/pep-0475/


File: python.info,  Node: 使用例<30>,  Next: Note on SIGPIPE,  Prev: モジュールの内容<2>,  Up: signal --- 非同期イベントにハンドラーを設定する

5.19.6.5 使用例
...............

以下は最小限のプログラム例です。この例では *note alarm(): 3a78. を使って
ファイルを開く処理を待つのに費やす時間を制限します; 例えば、電源の入って
いないシリアルデバイスを開こうとすると、通常 *note os.open(): f92. は未
定義の期間ハングアップしてしまいますが、この方法はそうした場合に便利です
。ここではファイルを開くまで 5 秒間のアラームを設定することで解決してい
ます; ファイルを開く処理が長くかかりすぎると、アラームシグナルが送信され
、ハンドラが例外を送出するようになっています。

     import signal, os

     def handler(signum, frame):
         signame = signal.Signals(signum).name
         print(f'Signal handler called with signal {signame} ({signum})')
         raise OSError("Couldn't open device!")

     # Set the signal handler and a 5-second alarm
     signal.signal(signal.SIGALRM, handler)
     signal.alarm(5)

     # This open() may hang indefinitely
     fd = os.open('/dev/ttyS0', os.O_RDWR)

     signal.alarm(0)          # Disable the alarm


File: python.info,  Node: Note on SIGPIPE,  Next: Note on Signal Handlers and Exceptions,  Prev: 使用例<30>,  Up: signal --- 非同期イベントにハンドラーを設定する

5.19.6.6 Note on SIGPIPE
........................

Piping output of your program to tools like ‘head(1)(1)’ will cause a
*note SIGPIPE: 3a59. signal to be sent to your process when the receiver
of its standard output closes early.  This results in an exception like
‘BrokenPipeError: [Errno 32] Broken pipe’.  To handle this case, wrap
your entry point to catch this exception as follows:

     import os
     import sys

     def main():
         try:
             # simulate large output (your code replaces this loop)
             for x in range(10000):
                 print("y")
             # flush output here to force SIGPIPE to be triggered
             # while inside this try block.
             sys.stdout.flush()
         except BrokenPipeError:
             # Python flushes standard streams on exit; redirect remaining output
             # to devnull to avoid another BrokenPipeError at shutdown
             devnull = os.open(os.devnull, os.O_WRONLY)
             os.dup2(devnull, sys.stdout.fileno())
             sys.exit(1)  # Python exits with error code 1 on EPIPE

     if __name__ == '__main__':
         main()

Do not set *note SIGPIPE: 3a59.'s disposition to *note SIG_DFL: 1bb2. in
order to avoid *note BrokenPipeError: 1267.  Doing that would cause your
program to exit unexpectedly whenever any socket connection is
interrupted while your program is still writing to it.

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/head(1)


File: python.info,  Node: Note on Signal Handlers and Exceptions,  Prev: Note on SIGPIPE,  Up: signal --- 非同期イベントにハンドラーを設定する

5.19.6.7 Note on Signal Handlers and Exceptions
...............................................

If a signal handler raises an exception, the exception will be
propagated to the main thread and may be raised after any *note
bytecode: 4aa. instruction.  Most notably, a *note KeyboardInterrupt:
bc5. may appear at any point during execution.  Most Python code,
including the standard library, cannot be made robust against this, and
so a *note KeyboardInterrupt: bc5. (or any other exception resulting
from a signal handler) may on rare occasions put the program in an
unexpected state.

To illustrate this issue, consider the following code:

     class SpamContext:
         def __init__(self):
             self.lock = threading.Lock()

         def __enter__(self):
             # If KeyboardInterrupt occurs here, everything is fine
             self.lock.acquire()
             # If KeyboardInterrupt occurs here, __exit__ will not be called
             ...
             # KeyboardInterrupt could occur just before the function returns

         def __exit__(self, exc_type, exc_val, exc_tb):
             ...
             self.lock.release()

For many programs, especially those that merely want to exit on *note
KeyboardInterrupt: bc5, this is not a problem, but applications that are
complex or require high reliability should avoid raising exceptions from
signal handlers.  They should also avoid catching *note
KeyboardInterrupt: bc5. as a means of gracefully shutting down.
Instead, they should install their own *note SIGINT: 253. handler.
Below is an example of an HTTP server that avoids *note
KeyboardInterrupt: bc5.:

     import signal
     import socket
     from selectors import DefaultSelector, EVENT_READ
     from http.server import HTTPServer, SimpleHTTPRequestHandler

     interrupt_read, interrupt_write = socket.socketpair()

     def handler(signum, frame):
         print('Signal handler called with signal', signum)
         interrupt_write.send(b'\0')
     signal.signal(signal.SIGINT, handler)

     def serve_forever(httpd):
         sel = DefaultSelector()
         sel.register(interrupt_read, EVENT_READ)
         sel.register(httpd, EVENT_READ)

         while True:
             for key, _ in sel.select():
                 if key.fileobj == interrupt_read:
                     interrupt_read.recv(1)
                     return
                 if key.fileobj == httpd:
                     httpd.handle_request()

     print("Serving on port 8000")
     httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler)
     serve_forever(httpd)
     print("Shutdown...")


File: python.info,  Node: mmap --- メモリマップファイルのサポート,  Prev: signal --- 非同期イベントにハンドラーを設定する,  Up: ネットワーク通信とプロセス間通信

5.19.7 ‘mmap’ -- メモリマップファイルのサポート
-----------------------------------------------

__________________________________________________________________

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

メモリにマップされたファイルオブジェクトは、 *note bytearray: 344. と
*note ファイルオブジェクト: 13db. の両方のように振舞います。しかし通常の
文字列オブジェクトとは異なり、これらは可変です。 *note bytearray: 344. が
期待されるほとんどの場所で mmap オブジェクトを利用できます。例えば、メモ
リマップファイルを探索するために *note re: be. モジュールを使うことがで
きます。それらは可変なので、 ‘obj[index] = 97’ のように文字を変換できま
すし、スライスを使うことで ‘obj[i1:i2] = b'...'’ のように部分文字列を変
換することができます。現在のファイル位置をデータの始めとする読込みや書込
み、ファイルの異なる位置へ ‘seek()’ することもできます。

メモリマップドファイルは Unix と Windows で異なる *note mmap: 519. コン
ストラクタで生成されます。どちらの場合も、更新用に開かれたファイル記述子
を渡さなければなりません。既存の Python ファイルオブジェクトをマップした
ければ、 *note fileno(): 17ad. メソッドを使って 'fileno' パラメータの正
しい値を取得してください。そうでなければ、 *note os.open(): f92. 関数を
使ってファイルを開けます。この関数はファイルディスクリプタを直接返します
(処理が終わったら、やはりファイルを閉じる必要があります)。

     注釈: 書き込み可能でバッファされたファイルへのメモリマップファイル
     を作りたいのであれば、まず最初にファイルの *note flush(): 2ce6. を
     呼び出すべきです。これはバッファへのローカルな修正がマッピングで実
     際に利用可能になることを保障するために必要です。

Unix バージョンと Windows バージョンのどちらのコンストラクタについても、
オプションのキーワード・パラメータとして 'access' を指定できます。
'access' は4つの値の内の1つを受け入れます。 ‘ACCESS_READ’ は読み出し専用
、 ‘ACCESS_WRITE’ は書き込み可能、 ‘ACCESS_COPY’ はコピーした上での書き
込み、‘ACCESS_DEFAULT’ は 'prot' に従います。 'access' は Unix と
Windows の両方で使用することができます。 'access' が指定されない場合、
Windows の mmap は書き込み可能マップを返します。 3つのアクセス型すべてに
対する初期メモリ値は、指定されたファイルから得られます。 ‘ACCESS_READ’ 型
のメモリマップに対して書き込むと *note TypeError: 198. 例外を送出します
。 ‘ACCESS_WRITE’ 型のメモリマップへの書き込みはメモリと元のファイルの両
方に影響を与えます。 ‘ACCESS_COPY’ 型のメモリマップへの書き込みはメモリ
に影響を与えますが、元のファイルを更新することはありません。

バージョン 3.7 で変更: 定数 ‘ACCESS_DEFAULT’ が追加されました。

無名メモリ(anonymous memory)にマップするためには fileno として -1 を渡し
、length を与えてください。

 -- クラス: mmap.mmap (fileno, length, tagname=None,
          access=ACCESS_DEFAULT, offset=0)

     '(Windows バージョン)' ファイルハンドル 'fileno' によって指定された
     ファイルから 'length' バイトをマップして、 mmap オブジェクトを生成
     します。 'length' が現在のファイルサイズより大きな場合、ファイルサ
     イズは 'length' を含む大きさにまで拡張されます。 'length' が ‘0’ の
     場合、マップの最大の長さは現在のファイルサイズになります。ただし、
     ファイル自体が空のときは Windows が例外を送出します (Windows では空
     のマップを作成することができません)。

     'tagname' は、 ‘None’ 以外で指定された場合、マップのタグ名を与える
     文字列となります。 Windows は同じファイルに対する様々なマップを持つ
     ことを可能にします。既存のタグの名前を指定すればそのタグがオープン
     され、そうでなければこの名前の新しいタグが作成されます。もしこのパ
     ラメータを省略したり ‘None’ を与えたりしたならば、マップは名前なし
     で作成されます。 "tagname" パラメータの使用の回避は、あなたのコード
     を Unix と Windows の間で移植可能にしておくのを助けてくれるでしょう
     。

     'offset' は非負整数のオフセットとして指定できます。mmap の参照はフ
     ァイルの先頭からのオフセットに相対的になります。'offset' のデフォル
     トは 0 です。'offset' は ‘ALLOCATIONGRANULARITY’ の倍数でなければな
     りません。

     引数 ‘fileno’, ‘length’, ‘access’, ‘offset’ 付きで *note
     監査イベント: 1c6e. ‘mmap.__new__’ を送出します。

 -- クラス: mmap.mmap (fileno, length, flags=MAP_SHARED, prot=PROT_WRITE
          | PROT_READ, access=ACCESS_DEFAULT, offset=0, *, trackfd=True)

     '(Unix バージョン)' ファイルディスクリプタ 'fileno' で指定されたフ
     ァイルから 'length' バイトをマップし、mmap オブジェクトを返します。
     'length' が ‘0’ の場合、マップの最大の長さは *note mmap: 519. が呼
     ばれた時点でのファイルサイズになります。

     'flags' specifies the nature of the mapping.  *note MAP_PRIVATE:
     3a81. creates a private copy-on-write mapping, so changes to the
     contents of the mmap object will be private to this process, and
     *note MAP_SHARED: 3a82. creates a mapping that's shared with all
     other processes mapping the same areas of the file.  The default
     value is *note MAP_SHARED: 3a82.  Some systems have additional
     possible flags with the full list specified in *note MAP_*
     constants: 3a83.

     'prot' が指定された場合、希望のメモリ保護を与えます。 2つの最も有用
     な値は、 ‘PROT_READ’ と ‘PROT_WRITE’ です。これは、読込み可能または
     書込み可能を指定するものです。 'prot' のデフォルトは ‘PROT_READ |
     PROT_WRITE’ です。

     'access' はオプションのキーワード・パラメータとして、 'flags' と
     'prot' の代わりに指定してもかまいません。 'flags', 'prot' と
     'access' の両方を指定することは間違っています。このパラメータの使用
     法についての情報は、先に述べた 'access' の記述を参照してください。

     'offset' may be specified as a non-negative integer offset.  mmap
     references will be relative to the offset from the beginning of the
     file.  'offset' defaults to 0.  'offset' must be a multiple of
     ‘ALLOCATIONGRANULARITY’ which is equal to ‘PAGESIZE’ on Unix
     systems.

     If 'trackfd' is ‘False’, the file descriptor specified by 'fileno'
     will not be duplicated, and the resulting ‘mmap’ object will not be
     associated with the map's underlying file.  This means that the
     *note size(): 3a84. and *note resize(): 3a85. methods will fail.
     This mode is useful to limit the number of open file descriptors.

     macOS において、作成された memory mapping の正当性を確実にするため
     に 'fileno' で指定されたファイルディスクリプタは内部で自動的に物理
     的なストレージ (physical backing store) と同期されます。

     バージョン 3.13 で変更: 'trackfd' パラメータが追加されました。

     この例は *note mmap: 519. の簡潔な使い方を示すものです:

          import mmap

          # write a simple example file
          with open("hello.txt", "wb") as f:
              f.write(b"Hello Python!\n")

          with open("hello.txt", "r+b") as f:
              # memory-map the file, size 0 means whole file
              mm = mmap.mmap(f.fileno(), 0)
              # read content via standard file methods
              print(mm.readline())  # prints b"Hello Python!\n"
              # read content via slice notation
              print(mm[:5])  # prints b"Hello"
              # update content using slice notation;
              # note that new content must have same size
              mm[6:] = b" world!\n"
              # ... and read again using standard file methods
              mm.seek(0)
              print(mm.readline())  # prints b"Hello  world!\n"
              # close the map
              mm.close()

     *note mmap: 519. は *note with: 186. 文の中でコンテキストマネージャ
     としても使えます:

          import mmap

          with mmap.mmap(-1, 13) as mm:
              mm.write(b"Hello world!")

     Added in version 3.2: コンテキストマネージャのサポート。

     次の例では無名マップを作り親プロセスと子プロセスの間でデータのやり
     とりをしてみせます:

          import mmap
          import os

          mm = mmap.mmap(-1, 13)
          mm.write(b"Hello world!")

          pid = os.fork()

          if pid == 0:  # In a child process
              mm.seek(0)
              print(mm.readline())

              mm.close()

     引数 ‘fileno’, ‘length’, ‘access’, ‘offset’ 付きで *note
     監査イベント: 1c6e. ‘mmap.__new__’ を送出します。

     メモリマップファイルオブジェクトは以下のメソッドをサポートしていま
     す:

      -- メソッド: close ()

          メモリマップファイルを閉じます。この呼出しの後にオブジェクトの
          他のメソッドの呼出すことは、 *note ValueError: 2ec. 例外の送出
          を引き起こします。このメソッドは開いたファイルのクローズはしま
          せん。

      -- の属性: closed

          ファイルが閉じている場合 ‘True’ となります。

          Added in version 3.2.

      -- メソッド: find (sub[, start[, end]])

          オブジェクト内の ['start', 'end'] の範囲に含まれている部分シー
          ケンス 'sub' が見つかった場所の最も小さいインデックスを返しま
          す。オプションの引数 'start' と 'end' はスライスに使われるとき
          のように解釈されます。失敗したときには ‘-1’ を返します。

          バージョン 3.5 で変更: 書き込み可能な *note bytes-like object:
          193. を使用できるようになりました。

      -- メソッド: flush ()

      -- メソッド: flush (offset, size, /)

          Flushes changes made to the in-memory copy of a file back to
          disk.  Without use of this call there is no guarantee that
          changes are written back before the object is destroyed.  If
          'offset' and 'size' are specified, only changes to the given
          range of bytes will be flushed to disk; otherwise, the whole
          extent of the mapping is flushed.  'offset' must be a multiple
          of the ‘PAGESIZE’ or ‘ALLOCATIONGRANULARITY’.

          ‘None’ が返されたら成功を意味します。呼び出しが失敗すると例外
          が送出されます。

          バージョン 3.8 で変更: Previously, a nonzero value was
          returned on success; zero was returned on error under Windows.
          A zero value was returned on success; an exception was raised
          on error under Unix.

      -- メソッド: madvise (option[, start[, length]])

          Send advice 'option' to the kernel about the memory region
          beginning at 'start' and extending 'length' bytes.  'option'
          must be one of the *note MADV_* constants: 3a89. available on
          the system.  If 'start' and 'length' are omitted, the entire
          mapping is spanned.  On some systems (including Linux),
          'start' must be a multiple of the ‘PAGESIZE’.

          Availability: Systems with the ‘madvise()’ system call.

          Added in version 3.8.

      -- メソッド: move (dest, src, count)

          オフセット 'src' から始まる 'count' バイトをインデックス
          'dest' の位置へコピーします。もし mmap が ‘ACCESS_READ’ で作成
          されていた場合、 *note TypeError: 198. 例外を発生させます。

      -- メソッド: read ([n])

          現在のファイル位置からの最大 'n' バイトを含む *note bytes:
          192. を返します。引数が省略されるか、 ‘None’ もしくは負の値が
          指定された場合、現在のファイル位置からマップ終端までの全てのバ
          イト列を返します。ファイル位置は返されたバイト列の直後を指すよ
          うに更新されます。

          バージョン 3.3 で変更: 引数が省略可能になり、 ‘None’ も受け付
          けるようになりました。

      -- メソッド: read_byte ()

          現在のファイル位置のバイトを整数値として返し、ファイル位置を 1
          進めます。

      -- メソッド: readline ()

          Returns a single line, starting at the current file position
          and up to the next newline.  The file position is updated to
          point after the bytes that were returned.

      -- メソッド: resize (newsize)

          Resizes the map and the underlying file, if any.

          Resizing a map created with 'access' of ‘ACCESS_READ’ or
          ‘ACCESS_COPY’, will raise a *note TypeError: 198. exception.
          Resizing a map created with 'trackfd' set to ‘False’, will
          raise a *note ValueError: 2ec. exception.

          'On Windows': Resizing the map will raise an *note OSError:
          2c0. if there are other maps against the same named file.
          Resizing an anonymous map (ie against the pagefile) will
          silently create a new map with the original data copied over
          up to the length of the new size.

          バージョン 3.11 で変更: Correctly fails if attempting to
          resize when another map is held Allows resize against an
          anonymous map on Windows

      -- メソッド: rfind (sub[, start[, end]])

          オブジェクト内の ['start', 'end'] の範囲に含まれている部分シー
          ケンス 'sub' が見つかった場所の最も大きいインデックスを返しま
          す。オプションの引数 'start' と 'end' はスライスに使われるとき
          のように解釈されます。失敗したときには ‘-1’ を返します。

          バージョン 3.5 で変更: 書き込み可能な *note bytes-like object:
          193. を使用できるようになりました。

      -- メソッド: seek (pos[, whence])

          ファイルの現在位置をセットします。 'whence' 引数はオプションで
          あり、デフォルトは ‘os.SEEK_SET’ つまり ‘0’ (絶対位置)です。そ
          の他の値として、 ‘os.SEEK_CUR’ つまり ‘1’ (現在位置からの相対
          位置)と ‘os.SEEK_END’ つまり ‘2’ (ファイルの終わりからの相対位
          置)があります。

          バージョン 3.13 で変更: ‘None’ ではなく新しい絶対位置を返しま
          す。

      -- メソッド: seekable ()

          Return whether the file supports seeking, and the return value
          is always ‘True’.

          Added in version 3.13.

      -- メソッド: size ()

          ファイルの長さを返します。メモリマップ領域のサイズより大きいか
          もしれません。

      -- メソッド: tell ()

          ファイルポインタの現在位置を返します。

      -- メソッド: write (bytes)

          メモリ内のファイルポイントの現在位置に 'bytes' のバイト列を書
          き込み、書き込まれたバイト数を返します(もし書き込みが失敗した
          ら *note ValueError: 2ec. が送出されるため、‘len(bytes)’ より
          少なくなりません)。ファイル位置はバイト列が書き込まれた位置に
          更新されます。もしmmapが ‘ACCESS_READ’ とともに作成されていた
          場合は、書き込みは *note TypeError: 198. 例外を送出するでしょ
          う。

          バージョン 3.5 で変更: 書き込み可能な *note bytes-like object:
          193. を使用できるようになりました。

          バージョン 3.6 で変更: 書きこまれたバイト数を返すようになりま
          した。

      -- メソッド: write_byte (byte)

          メモリ内のファイル・ポインタの現在位置に整数 'byte' を書き込み
          ます。ファイル位置は ‘1’ だけ進みます。もし mmap が
          ‘ACCESS_READ’ で作成されていた場合、書き込み時に *note
          TypeError: 198. 例外を発生させるでしょう。

* Menu:

* MADV_* 定数::
* MAP_* 定数::


File: python.info,  Node: MADV_* 定数,  Next: MAP_* 定数,  Up: mmap --- メモリマップファイルのサポート

5.19.7.1 MADV_* 定数
....................

 -- データ: mmap.MADV_NORMAL
 -- データ: mmap.MADV_RANDOM
 -- データ: mmap.MADV_SEQUENTIAL
 -- データ: mmap.MADV_WILLNEED
 -- データ: mmap.MADV_DONTNEED
 -- データ: mmap.MADV_REMOVE
 -- データ: mmap.MADV_DONTFORK
 -- データ: mmap.MADV_DOFORK
 -- データ: mmap.MADV_HWPOISON
 -- データ: mmap.MADV_MERGEABLE
 -- データ: mmap.MADV_UNMERGEABLE
 -- データ: mmap.MADV_SOFT_OFFLINE
 -- データ: mmap.MADV_HUGEPAGE
 -- データ: mmap.MADV_NOHUGEPAGE
 -- データ: mmap.MADV_DONTDUMP
 -- データ: mmap.MADV_DODUMP
 -- データ: mmap.MADV_FREE
 -- データ: mmap.MADV_NOSYNC
 -- データ: mmap.MADV_AUTOSYNC
 -- データ: mmap.MADV_NOCORE
 -- データ: mmap.MADV_CORE
 -- データ: mmap.MADV_PROTECT
 -- データ: mmap.MADV_FREE_REUSABLE
 -- データ: mmap.MADV_FREE_REUSE

     These options can be passed to *note mmap.madvise(): bfb.  Not
     every option will be present on every system.

     Availability: Systems with the madvise() system call.

     Added in version 3.8.


File: python.info,  Node: MAP_* 定数,  Prev: MADV_* 定数,  Up: mmap --- メモリマップファイルのサポート

5.19.7.2 MAP_* 定数
...................

 -- データ: mmap.MAP_SHARED
 -- データ: mmap.MAP_PRIVATE
 -- データ: mmap.MAP_32BIT
 -- データ: mmap.MAP_ALIGNED_SUPER
 -- データ: mmap.MAP_ANON
 -- データ: mmap.MAP_ANONYMOUS
 -- データ: mmap.MAP_CONCEAL
 -- データ: mmap.MAP_DENYWRITE
 -- データ: mmap.MAP_EXECUTABLE
 -- データ: mmap.MAP_HASSEMAPHORE
 -- データ: mmap.MAP_JIT
 -- データ: mmap.MAP_NOCACHE
 -- データ: mmap.MAP_NOEXTEND
 -- データ: mmap.MAP_NORESERVE
 -- データ: mmap.MAP_POPULATE
 -- データ: mmap.MAP_RESILIENT_CODESIGN
 -- データ: mmap.MAP_RESILIENT_MEDIA
 -- データ: mmap.MAP_STACK
 -- データ: mmap.MAP_TPRO
 -- データ: mmap.MAP_TRANSLATED_ALLOW_EXECUTE
 -- データ: mmap.MAP_UNIX03

     These are the various flags that can be passed to *note
     mmap.mmap(): 519.  *note MAP_ALIGNED_SUPER: 1ac7. is only available
     at FreeBSD and *note MAP_CONCEAL: 1ac8. is only available at
     OpenBSD. Note that some options might not be present on some
     systems.

     バージョン 3.10 で変更: Added *note MAP_POPULATE: 1d2f. constant.

     Added in version 3.11: Added *note MAP_STACK: 3aae. constant.

     Added in version 3.12: Added *note MAP_ALIGNED_SUPER: 1ac7. and
     *note MAP_CONCEAL: 1ac8. constants.

     Added in version 3.13: Added *note MAP_32BIT: 1a1c, *note
     MAP_HASSEMAPHORE: 1a17, *note MAP_JIT: 1a19, *note MAP_NOCACHE:
     1a18, *note MAP_NOEXTEND: 1a16, *note MAP_NORESERVE: 1a15, *note
     MAP_RESILIENT_CODESIGN: 1a1a, *note MAP_RESILIENT_MEDIA: 1a1b,
     *note MAP_TPRO: 1a1f, *note MAP_TRANSLATED_ALLOW_EXECUTE: 1a1d, and
     *note MAP_UNIX03: 1a1e. constants.


File: python.info,  Node: インターネット上のデータの操作,  Next: 構造化マークアップツール,  Prev: ネットワーク通信とプロセス間通信,  Up: Python 標準ライブラリ

5.20 インターネット上のデータの操作
===================================

この章ではインターネット上で一般的に利用されているデータ形式の操作をサポ
ートするモジュール群について記述します。

* Menu:

* email: email --- 電子メールと MIME 処理のためのパッケージ. 電子メールと MIME 処理のためのパッケージ
* json: json --- JSON エンコーダーとデコーダー. JSON エンコーダーとデコーダー
* mailbox: mailbox --- 様々な形式のメールボックスを操作する. 様々な形式のメールボックスを操作する
* mimetypes: mimetypes --- ファイル名を MIME タイプへマップする. ファイル名を MIME タイプへマップする
* base64: base64 --- Base16 Base32 Base64 Base85 データのエンコード. Base16, Base32, Base64, Base85 データのエンコード
* binascii: binascii --- バイナリ と ASCII 間の変換. バイナリ と ASCII 間の変換
* quopri: quopri --- MIME quoted-printable データのエンコードとデコード. MIME quoted-printable データのエンコードとデコード


File: python.info,  Node: email --- 電子メールと MIME 処理のためのパッケージ,  Next: json --- JSON エンコーダーとデコーダー,  Up: インターネット上のデータの操作

5.20.1 ‘email’ -- 電子メールと MIME 処理のためのパッケージ
----------------------------------------------------------

'ソースコード:' Lib/email/__init__.py(1)

__________________________________________________________________

The ‘email’ package is a library for managing email messages.  It is
specifically 'not' designed to do any sending of email messages to SMTP
( RFC 2821(2)), NNTP, or other servers; those are functions of modules
such as *note smtplib: cf.  The ‘email’ package attempts to be as
RFC-compliant as possible, supporting RFC 5322(3) and RFC 6532(4), as
well as such MIME-related RFCs as RFC 2045(5), RFC 2046(6), RFC 2047(7),
RFC 2183(8), and RFC 2231(9).

The overall structure of the email package can be divided into three
major components, plus a fourth component that controls the behavior of
the other components.

The central component of the package is an "object model" that
represents email messages.  An application interacts with the package
primarily through the object model interface defined in the *note
message: 48. sub-module.  The application can use this API to ask
questions about an existing email, to construct a new email, or to add
or remove email subcomponents that themselves use the same object model
interface.  That is, following the nature of email messages and their
MIME subcomponents, the email object model is a tree structure of
objects that all provide the *note EmailMessage: 580. API.

The other two major components of the package are the *note parser: 52.
and the *note generator: 44.  The parser takes the serialized version of
an email message (a stream of bytes) and converts it into a tree of
*note EmailMessage: 580. objects.  The generator takes an *note
EmailMessage: 580. and turns it back into a serialized byte stream.
(The parser and generator also handle streams of text characters, but
this usage is discouraged as it is too easy to end up with messages that
are not valid in one way or another.)

The control component is the *note policy: 53. module.  Every *note
EmailMessage: 580, every *note generator: 44, and every *note parser:
52. has an associated *note policy: 53. object that controls its
behavior.  Usually an application only needs to specify the policy when
an *note EmailMessage: 580. is created, either by directly instantiating
an *note EmailMessage: 580. to create a new email, or by parsing an
input stream using a *note parser: 52.  But the policy can be changed
when the message is serialized using a *note generator: 44.  This
allows, for example, a generic email message to be parsed from disk, but
to serialize it using standard SMTP settings when sending it to an email
server.

The email package does its best to hide the details of the various
governing RFCs from the application.  Conceptually the application
should be able to treat the email message as a structured tree of
unicode text and binary attachments, without having to worry about how
these are represented when serialized.  In practice, however, it is
often necessary to be aware of at least some of the rules governing MIME
messages and their structure, specifically the names and nature of the
MIME "content types" and how they identify multipart documents.  For the
most part this knowledge should only be required for more complex
applications, and even then it should only be the high level structure
in question, and not the details of how those structures are
represented.  Since MIME content types are used widely in modern
internet software (not just email), this will be a familiar concept to
many programmers.

The following sections describe the functionality of the ‘email’
package.  We start with the *note message: 48. object model, which is
the primary interface an application will use, and follow that with the
*note parser: 52. and *note generator: 44. components.  Then we cover
the *note policy: 53. controls, which completes the treatment of the
main components of the library.

The next three sections cover the exceptions the package may raise and
the defects (non-compliance with the RFCs) that the *note parser: 52.
may detect.  Then we cover the *note headerregistry: 46. and the *note
contentmanager: 41. sub-components, which provide tools for doing more
detailed manipulation of headers and payloads, respectively.  Both of
these components contain features relevant to consuming and producing
non-trivial messages, but also document their extensibility APIs, which
will be of interest to advanced applications.

Following those is a set of examples of using the fundamental parts of
the APIs covered in the preceding sections.

The foregoing represent the modern (unicode friendly) API of the email
package.  The remaining sections, starting with the *note Message: 581.
class, cover the legacy *note compat32: e97. API that deals much more
directly with the details of how email messages are represented.  The
*note compat32: e97. API does 'not' hide the details of the RFCs from
the application, but for applications that need to operate at that
level, they can be useful tools.  This documentation is also relevant
for applications that are still using the *note compat32: e97. API for
backward compatibility reasons.

バージョン 3.6 で変更: Docs reorganized and rewritten to promote the new
*note EmailMessage: 580./*note EmailPolicy: 12cb. API.

Contents of the ‘email’ package documentation:

* Menu:

* email.message; Representing an email message: email message Representing an email message.
* email.parser; Parsing email messages: email parser Parsing email messages.
* email.generator; Generating MIME documents: email generator Generating MIME documents.
* email.policy; Policy Objects: email policy Policy Objects.
* email.errors; Exception and Defect classes: email errors Exception and Defect classes.
* email.headerregistry; Custom Header Objects: email headerregistry Custom Header Objects.
* email.contentmanager; Managing MIME Content: email contentmanager Managing MIME Content.
* email; 使用例: email 使用例.
* email.message.Message; compat32 API を使用した電子メールメッセージの表現: email message Message compat32 API を使用した電子メールメッセージの表現.
* email.mime; Creating email and MIME objects from scratch: email mime Creating email and MIME objects from scratch.
* email.header; 国際化されたヘッダー: email header 国際化されたヘッダー.
* email.charset; 文字集合の表現: email charset 文字集合の表現.
* email.encoders; エンコーダー: email encoders エンコーダー.
* email.utils; Miscellaneous utilities: email utils Miscellaneous utilities.
* email.iterators; イテレータ: email iterators イテレータ.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/email/__init__.py

   (2) https://datatracker.ietf.org/doc/html/rfc2821.html

   (3) https://datatracker.ietf.org/doc/html/rfc5322.html

   (4) https://datatracker.ietf.org/doc/html/rfc6532.html

   (5) https://datatracker.ietf.org/doc/html/rfc2045.html

   (6) https://datatracker.ietf.org/doc/html/rfc2046.html

   (7) https://datatracker.ietf.org/doc/html/rfc2047.html

   (8) https://datatracker.ietf.org/doc/html/rfc2183.html

   (9) https://datatracker.ietf.org/doc/html/rfc2231.html


File: python.info,  Node: email message Representing an email message,  Next: email parser Parsing email messages,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.20.1.1 ‘email.message’: Representing an email message
.......................................................

'ソースコード:' Lib/email/message.py(1)

__________________________________________________________________

Added in version 3.6: (2)

The central class in the *note email: 3f. package is the *note
EmailMessage: 580. class, imported from the ‘email.message’ module.  It
is the base class for the *note email: 3f. object model.  *note
EmailMessage: 580. provides the core functionality for setting and
querying header fields, for accessing message bodies, and for creating
or modifying structured messages.

An email message consists of 'headers' and a 'payload' (which is also
referred to as the 'content').  Headers are RFC 5322(3) or RFC 6532(4)
style field names and values, where the field name and value are
separated by a colon.  The colon is not part of either the field name or
the field value.  The payload may be a simple text message, or a binary
object, or a structured sequence of sub-messages each with their own set
of headers and their own payload.  The latter type of payload is
indicated by the message having a MIME type such as ‘multipart/*’ or
‘message/rfc822’.

The conceptual model provided by an *note EmailMessage: 580. object is
that of an ordered dictionary of headers coupled with a 'payload' that
represents the RFC 5322(5) body of the message, which might be a list of
sub-‘EmailMessage’ objects.  In addition to the normal dictionary
methods for accessing the header names and values, there are methods for
accessing specialized information from the headers (for example the MIME
content type), for operating on the payload, for generating a serialized
version of the message, and for recursively walking over the object
tree.

The *note EmailMessage: 580. dictionary-like interface is indexed by the
header names, which must be ASCII values.  The values of the dictionary
are strings with some extra methods.  Headers are stored and returned in
case-preserving form, but field names are matched case-insensitively.
The keys are ordered, but unlike a real dict, there can be duplicates.
Additional methods are provided for working with headers that have
duplicate keys.

The 'payload' is either a string or bytes object, in the case of simple
message objects, or a list of *note EmailMessage: 580. objects, for MIME
container documents such as ‘multipart/*’ and ‘message/rfc822’ message
objects.

 -- クラス: email.message.EmailMessage (policy=default)

     If 'policy' is specified use the rules it specifies to update and
     serialize the representation of the message.  If 'policy' is not
     set, use the *note default: 12cc. policy, which follows the rules
     of the email RFCs except for line endings (instead of the RFC
     mandated ‘\r\n’, it uses the Python standard ‘\n’ line endings).
     For more information see the *note policy: 53. documentation.  (6)

      -- メソッド: as_string (unixfrom=False, maxheaderlen=None,
               policy=None)

          Return the entire message flattened as a string.  When
          optional 'unixfrom' is true, the envelope header is included
          in the returned string.  'unixfrom' defaults to ‘False’.  For
          backward compatibility with the base *note Message: 581. class
          'maxheaderlen' is accepted, but defaults to ‘None’, which
          means that by default the line length is controlled by the
          *note max_line_length: 3ab9. of the policy.  The 'policy'
          argument may be used to override the default policy obtained
          from the message instance.  This can be used to control some
          of the formatting produced by the method, since the specified
          'policy' will be passed to the *note Generator: 13e6.

          もし、文字列への変換を完全に行うためにデフォルト値を埋める必要
          がある場合、メッセージのフラット化は *note EmailMessage: 580.
          の変更を引き起こす可能性があります (例えば、MIME の境界が生成
          される、変更される等)。

          Note that this method is provided as a convenience and may not
          be the most useful way to serialize messages in your
          application, especially if you are dealing with multiple
          messages.  See *note email.generator.Generator: 13e6. for a
          more flexible API for serializing messages.  Note also that
          this method is restricted to producing messages serialized as
          "7 bit clean" when *note utf8: ff9. is ‘False’, which is the
          default.

          バージョン 3.6 で変更: the default behavior when
          'maxheaderlen' is not specified was changed from defaulting to
          0 to defaulting to the value of 'max_line_length' from the
          policy.

      -- メソッド: __str__ ()

          Equivalent to
          ‘as_string(policy=self.policy.clone(utf8=True))’.  Allows
          ‘str(msg)’ to produce a string containing the serialized
          message in a readable format.

          バージョン 3.4 で変更: the method was changed to use
          ‘utf8=True’, thus producing an RFC 6531(7)-like message
          representation, instead of being a direct alias for *note
          as_string(): 3ab8.

      -- メソッド: as_bytes (unixfrom=False, policy=None)

          Return the entire message flattened as a bytes object.  When
          optional 'unixfrom' is true, the envelope header is included
          in the returned string.  'unixfrom' defaults to ‘False’.  The
          'policy' argument may be used to override the default policy
          obtained from the message instance.  This can be used to
          control some of the formatting produced by the method, since
          the specified 'policy' will be passed to the *note
          BytesGenerator: 13e7.

          もし、文字列への変換を完全に行うためにデフォルト値を埋める必要
          がある場合、メッセージのフラット化は *note EmailMessage: 580.
          の変更を引き起こす可能性があります (例えば、MIME の境界が生成
          される、変更される等)。

          Note that this method is provided as a convenience and may not
          be the most useful way to serialize messages in your
          application, especially if you are dealing with multiple
          messages.  See *note email.generator.BytesGenerator: 13e7. for
          a more flexible API for serializing messages.

      -- メソッド: __bytes__ ()

          Equivalent to *note as_bytes(): 3abb.  Allows ‘bytes(msg)’ to
          produce a bytes object containing the serialized message.

      -- メソッド: is_multipart ()

          Return ‘True’ if the message's payload is a list of sub-*note
          EmailMessage: 580. objects, otherwise return ‘False’.  When
          *note is_multipart(): 3abd. returns ‘False’, the payload
          should be a string object (which might be a CTE encoded binary
          payload).  Note that *note is_multipart(): 3abd. returning
          ‘True’ does not necessarily mean that
          "msg.get_content_maintype() == 'multipart'" will return the
          ‘True’.  For example, ‘is_multipart’ will return ‘True’ when
          the *note EmailMessage: 580. is of type ‘message/rfc822’.

      -- メソッド: set_unixfrom (unixfrom)

          Set the message's envelope header to 'unixfrom', which should
          be a string.  (See *note mboxMessage: 3abf. for a brief
          description of this header.)

      -- メソッド: get_unixfrom ()

          メッセージのエンベロープヘッダを返します。エンベロープヘッダが
          設定されていない場合は ‘None’ が返されます。

     The following methods implement the mapping-like interface for
     accessing the message's headers.  Note that there are some semantic
     differences between these methods and a normal mapping (i.e.
     dictionary) interface.  For example, in a dictionary there are no
     duplicate keys, but here there may be duplicate message headers.
     Also, in dictionaries there is no guaranteed order to the keys
     returned by *note keys(): 3ac1, but in an *note EmailMessage: 580.
     object, headers are always returned in the order they appeared in
     the original message, or in which they were added to the message
     later.  Any header deleted and then re-added is always appended to
     the end of the header list.

     These semantic differences are intentional and are biased toward
     convenience in the most common use cases.

     注意: どんな場合も、メッセージ中のエンベロープヘッダはこのマップ形
     式のインタフェイスには含まれません。

      -- メソッド: __len__ ()

          複製されたものもふくめてヘッダ数の合計を返します。

      -- メソッド: __contains__ (name)

          Return ‘True’ if the message object has a field named 'name'.
          Matching is done without regard to case and 'name' does not
          include the trailing colon.  Used for the ‘in’ operator.  For
          example:

               if 'message-id' in myMessage:
                  print('Message-ID:', myMessage['message-id'])

      -- メソッド: __getitem__ (name)

          Return the value of the named header field.  'name' does not
          include the colon field separator.  If the header is missing,
          ‘None’ is returned; a *note KeyError: 5e7. is never raised.

          Note that if the named field appears more than once in the
          message's headers, exactly which of those field values will be
          returned is undefined.  Use the *note get_all(): 3ac5. method
          to get the values of all the extant headers named 'name'.

          Using the standard (non-‘compat32’) policies, the returned
          value is an instance of a subclass of *note
          email.headerregistry.BaseHeader: 3ac6.

      -- メソッド: __setitem__ (name, val)

          メッセージヘッダに 'name' という名前の 'val' という値をもつフ
          ィールドをあらたに追加します。このフィールドは現在メッセージに
          存在するヘッダーのいちばん後に追加されます。

          注意: このメソッドでは、すでに同一の名前で存在するフィールドは
          上書き 'されません'。もしメッセージが名前 'name' をもつフィー
          ルドをひとつしか持たないようにしたければ、最初にそれを除去して
          ください。たとえば:

               del msg['subject']
               msg['subject'] = 'Python roolz!'

          If the *note policy: 53. defines certain headers to be unique
          (as the standard policies do), this method may raise a *note
          ValueError: 2ec. when an attempt is made to assign a value to
          such a header when one already exists.  This behavior is
          intentional for consistency's sake, but do not depend on it as
          we may choose to make such assignments do an automatic
          deletion of the existing header in the future.

      -- メソッド: __delitem__ (name)

          メッセージのヘッダから、'name' という名前をもつフィールドをす
          べて除去します。たとえこの名前をもつヘッダが存在していなくても
          例外は発生しません。

      -- メソッド: keys ()

          メッセージ中にあるすべてのヘッダのフィールド名のリストを返しま
          す。

      -- メソッド: values ()

          メッセージ中にあるすべてのフィールドの値のリストを返します。

      -- メソッド: items ()

          メッセージ中にあるすべてのヘッダのフィールド名とその値を 2-タ
          プルのリストとして返します。

      -- メソッド: get (name, failobj=None)

          Return the value of the named header field.  This is identical
          to *note __getitem__(): 588. except that optional 'failobj' is
          returned if the named header is missing ('failobj' defaults to
          ‘None’).

     Here are some additional useful header related methods:

      -- メソッド: get_all (name, failobj=None)

          'name' の名前をもつフィールドのすべての値からなるリストを返し
          ます。該当する名前のヘッダがメッセージ中に含まれていない場合は
          'failobj' (デフォルトでは ‘None’) が返されます。

      -- メソッド: add_header (_name, _value, **_params)

          拡張ヘッダ設定。このメソッドは *note __setitem__(): 3ac7. と似
          ていますが、追加のヘッダ・パラメータをキーワード引数で指定でき
          るところが違っています。 '_name' に追加するヘッダフィールドを
          、 '_value' にそのヘッダの '最初の' 値を渡します。

          For each item in the keyword argument dictionary '_params',
          the key is taken as the parameter name, with underscores
          converted to dashes (since dashes are illegal in Python
          identifiers).  Normally, the parameter will be added as
          ‘key="value"’ unless the value is ‘None’, in which case only
          the key will be added.

          If the value contains non-ASCII characters, the charset and
          language may be explicitly controlled by specifying the value
          as a three tuple in the format ‘(CHARSET, LANGUAGE, VALUE)’,
          where ‘CHARSET’ is a string naming the charset to be used to
          encode the value, ‘LANGUAGE’ can usually be set to ‘None’ or
          the empty string (see RFC 2231(8) for other possibilities),
          and ‘VALUE’ is the string value containing non-ASCII code
          points.  If a three tuple is not passed and the value contains
          non-ASCII characters, it is automatically encoded in RFC
          2231(9) format using a ‘CHARSET’ of ‘utf-8’ and a ‘LANGUAGE’
          of ‘None’.

          以下に例を示します。:

               msg.add_header('Content-Disposition', 'attachment', filename='bud.gif')

          こうするとヘッダには以下のように追加されます

               Content-Disposition: attachment; filename="bud.gif"

          An example of the extended interface with non-ASCII
          characters:

               msg.add_header('Content-Disposition', 'attachment',
                              filename=('iso-8859-1', '', 'Fußballer.ppt'))

      -- メソッド: replace_header (_name, _value)

          Replace a header.  Replace the first header found in the
          message that matches '_name', retaining header order and field
          name case of the original header.  If no matching header is
          found, raise a *note KeyError: 5e7.

      -- メソッド: get_content_type ()

          Return the message's content type, coerced to lower case of
          the form ‘maintype/subtype’.  If there is no ‘Content-Type’
          header in the message return the value returned by *note
          get_default_type(): 3acf.  If the ‘Content-Type’ header is
          invalid, return ‘text/plain’.

          (According to RFC 2045(10), messages always have a default
          type, *note get_content_type(): 3ace. will always return a
          value.  RFC 2045(11) defines a message's default type to be
          ‘text/plain’ unless it appears inside a ‘multipart/digest’
          container, in which case it would be ‘message/rfc822’.  If the
          ‘Content-Type’ header has an invalid type specification, RFC
          2045(12) mandates that the default type be ‘text/plain’.)

      -- メソッド: get_content_maintype ()

          そのメッセージの主 content-type を返します。これは *note
          get_content_type(): 3ace. によって返される文字列の ‘maintype’
          部分です。

      -- メソッド: get_content_subtype ()

          そのメッセージの副 content-type (sub content-type、subtype) を
          返します。これは *note get_content_type(): 3ace. によって返さ
          れる文字列の ‘subtype’ 部分です。

      -- メソッド: get_default_type ()

          デフォルトの content-type を返します。ほどんどのメッセージでは
          デフォルトの content-type は ‘text/plain’ ですが、メッセージが
          ‘multipart/digest’ コンテナに含まれているときだけ例外的に
          ‘message/rfc822’ になります。

      -- メソッド: set_default_type (ctype)

          Set the default content type.  'ctype' should either be
          ‘text/plain’ or ‘message/rfc822’, although this is not
          enforced.  The default content type is not stored in the
          ‘Content-Type’ header, so it only affects the return value of
          the ‘get_content_type’ methods when no ‘Content-Type’ header
          is present in the message.

      -- メソッド: set_param (param, value, header='Content-Type',
               requote=True, charset=None, language='', replace=False)

          Set a parameter in the ‘Content-Type’ header.  If the
          parameter already exists in the header, replace its value with
          'value'.  When 'header' is ‘Content-Type’ (the default) and
          the header does not yet exist in the message, add it, set its
          value to ‘text/plain’, and append the new parameter value.
          Optional 'header' specifies an alternative header to
          ‘Content-Type’.

          If the value contains non-ASCII characters, the charset and
          language may be explicitly specified using the optional
          'charset' and 'language' parameters.  Optional 'language'
          specifies the RFC 2231(13) language, defaulting to the empty
          string.  Both 'charset' and 'language' should be strings.  The
          default is to use the ‘utf8’ 'charset' and ‘None’ for the
          'language'.

          If 'replace' is ‘False’ (the default) the header is moved to
          the end of the list of headers.  If 'replace' is ‘True’, the
          header will be updated in place.

          Use of the 'requote' parameter with *note EmailMessage: 580.
          objects is deprecated.

          Note that existing parameter values of headers may be accessed
          through the *note params: 3ad4. attribute of the header value
          (for example, ‘msg['Content-Type'].params['charset']’).

          バージョン 3.4 で変更: ‘replace’ キーワードが追加されました。

      -- メソッド: del_param (param, header='content-type',
               requote=True)

          指定されたパラメータを ‘Content-Type’ ヘッダ中から完全にとりの
          ぞきます。ヘッダはそのパラメータと値がない状態に書き換えられま
          す。オプション変数 'header' が与えられた場合、 ‘Content-Type’
          のかわりにそのヘッダが使用されます。

          Use of the 'requote' parameter with *note EmailMessage: 580.
          objects is deprecated.

      -- メソッド: get_filename (failobj=None)

          そのメッセージ中の ‘Content-Disposition’ ヘッダにある、
          ‘filename’ パラメータの値を返します。目的のヘッダに ‘filename’
          パラメータがない場合には ‘Content-Type’ ヘッダにある ‘name’ パ
          ラメータを探します。それも無い場合またはヘッダが無い場合には
          'failobj' が返されます。返される文字列はつねに *note
          email.utils.unquote(): 3ad7. によって unquote されます。

      -- メソッド: get_boundary (failobj=None)

          そのメッセージ中の ‘Content-Type’ ヘッダにある、 ‘boundary’ パ
          ラメータの値を返します。目的のヘッダが欠けていたり、
          ‘boundary’ パラメータがない場合には 'failobj' が返されます。返
          される文字列はつねに *note email.utils.unquote(): 3ad7. によっ
          て unquote されます。

      -- メソッド: set_boundary (boundary)

          メッセージ中の ‘Content-Type’ ヘッダにある、 ‘boundary’ パラメ
          ータに値を設定します。 *note set_boundary(): 3ad9. は必要に応
          じて 'boundary' を quote します。そのメッセージが
          ‘Content-Type’ ヘッダを含んでいない場合、 *note
          HeaderParseError: 3ada. が発生します。

          Note that using this method is subtly different from deleting
          the old ‘Content-Type’ header and adding a new one with the
          new boundary via *note add_header(): 3acc, because *note
          set_boundary(): 3ad9. preserves the order of the
          ‘Content-Type’ header in the list of headers.

      -- メソッド: get_content_charset (failobj=None)

          そのメッセージ中の ‘Content-Type’ ヘッダにある、 ‘charset’ パ
          ラメータの値を返します。値はすべて小文字に変換されます。メッセ
          ージ中に ‘Content-Type’ がなかったり、このヘッダ中に
          ‘charaset’ パラメータがない場合には 'failobj' が返されます。

      -- メソッド: get_charsets (failobj=None)

          メッセージ中に含まれる文字セットの名前をすべてリストにして返し
          ます。そのメッセージが ‘multipart’ である場合、返されるリスト
          の各要素がそれぞれの subpart のペイロードに対応します。それ以
          外の場合、これは長さ 1 のリストを返します。

          リスト中の各要素は文字列であり、これは対応する subpart 中のそ
          れぞれの ‘Content-Type’ ヘッダにある ‘charset’ の値です。その
          subpart が ‘Content-Type’ をもってないか、 ‘charset’ がないか
          、あるいは MIME maintype が ‘text’ でないいずれかの場合には、
          リストの要素として 'failobj' が返されます。

      -- メソッド: is_attachment ()

          ‘Content-Disposition’ ヘッダが存在し、その (大文字小文字を区別
          しない) 値が ‘attachment’ の場合、 ‘True’ を返します。 それ以
          外の場合は ‘False’ を返します。

          バージョン 3.4.2 で変更: *note is_multipart(): 3ade. との一貫
          性のために、is_attachment が属性からメソッドになりました。

      -- メソッド: get_content_disposition ()

          Return the lowercased value (without parameters) of the
          message's ‘Content-Disposition’ header if it has one, or
          ‘None’.  The possible values for this method are 'inline',
          'attachment' or ‘None’ if the message follows RFC 2183(14).

          Added in version 3.5.

     The following methods relate to interrogating and manipulating the
     content (payload) of the message.

      -- メソッド: walk ()

          *note walk(): 3ae0. メソッドは多目的のジェネレータで、これはあ
          るメッセージオブジェクトツリー中のすべての part および subpart
          をわたり歩くのに使えます。順序は深さ優先です。おそらく典型的な
          用法は、 *note walk(): 3ae0. を ‘for’ ループ中でのイテレータと
          して使うことでしょう。ループを一回まわるごとに、次の subpart が
          返されるのです。

          以下の例は、 multipart メッセージのすべての part において、そ
          の MIME タイプを表示していくものです。 :

               >>> for part in msg.walk():
               ...     print(part.get_content_type())
               multipart/report
               text/plain
               message/delivery-status
               text/plain
               text/plain
               message/rfc822
               text/plain

          ‘walk’ iterates over the subparts of any part where *note
          is_multipart(): 3abd. returns ‘True’, even though
          ‘msg.get_content_maintype() == 'multipart'’ may return
          ‘False’.  We can see this in our example by making use of the
          ‘_structure’ debug helper function:

               >>> from email.iterators import _structure
               >>> for part in msg.walk():
               ...     print(part.get_content_maintype() == 'multipart',
               ...           part.is_multipart())
               True True
               False False
               False True
               False False
               False False
               False True
               False False
               >>> _structure(msg)
               multipart/report
                   text/plain
                   message/delivery-status
                       text/plain
                       text/plain
                   message/rfc822
                       text/plain

          Here the ‘message’ parts are not ‘multiparts’, but they do
          contain subparts.  ‘is_multipart()’ returns ‘True’ and ‘walk’
          descends into the subparts.

      -- メソッド: get_body (preferencelist=('related', 'html',
               'plain'))

          メッセージの "本体" の最有力候補となる MIME 部を返します。

          'preferencelist' must be a sequence of strings from the set
          ‘related’, ‘html’, and ‘plain’, and indicates the order of
          preference for the content type of the part returned.

          Start looking for candidate matches with the object on which
          the ‘get_body’ method is called.

          If ‘related’ is not included in 'preferencelist', consider the
          root part (or subpart of the root part) of any related
          encountered as a candidate if the (sub-)part matches a
          preference.

          When encountering a ‘multipart/related’, check the ‘start’
          parameter and if a part with a matching ‘Content-ID’ is found,
          consider only it when looking for candidate matches.
          Otherwise consider only the first (default root) part of the
          ‘multipart/related’.

          If a part has a ‘Content-Disposition’ header, only consider
          the part a candidate match if the value of the header is
          ‘inline’.

          If none of the candidates matches any of the preferences in
          'preferencelist', return ‘None’.

          Notes: (1) For most applications the only 'preferencelist'
          combinations that really make sense are ‘('plain',)’,
          ‘('html', 'plain')’, and the default ‘('related', 'html',
          'plain')’.  (2) Because matching starts with the object on
          which ‘get_body’ is called, calling ‘get_body’ on a
          ‘multipart/related’ will return the object itself unless
          'preferencelist' has a non-default value.  (3) Messages (or
          message parts) that do not specify a ‘Content-Type’ or whose
          ‘Content-Type’ header is invalid will be treated as if they
          are of type ‘text/plain’, which may occasionally cause
          ‘get_body’ to return unexpected results.

      -- メソッド: iter_attachments ()

          Return an iterator over all of the immediate sub-parts of the
          message that are not candidate "body" parts.  That is, skip
          the first occurrence of each of ‘text/plain’, ‘text/html’,
          ‘multipart/related’, or ‘multipart/alternative’ (unless they
          are explicitly marked as attachments via ‘Content-Disposition:
          attachment’), and return all remaining parts.  When applied
          directly to a ‘multipart/related’, return an iterator over the
          all the related parts except the root part (ie: the part
          pointed to by the ‘start’ parameter, or the first part if
          there is no ‘start’ parameter or the ‘start’ parameter doesn't
          match the ‘Content-ID’ of any of the parts).  When applied
          directly to a ‘multipart/alternative’ or a non-‘multipart’,
          return an empty iterator.

      -- メソッド: iter_parts ()

          Return an iterator over all of the immediate sub-parts of the
          message, which will be empty for a non-‘multipart’.  (See also
          *note walk(): 3ae0.)

      -- メソッド: get_content (*args, content_manager=None, **kw)

          Call the *note get_content(): 3ae5. method of the
          'content_manager', passing self as the message object, and
          passing along any other arguments or keywords as additional
          arguments.  If 'content_manager' is not specified, use the
          ‘content_manager’ specified by the current *note policy: 53.

      -- メソッド: set_content (*args, content_manager=None, **kw)

          Call the *note set_content(): 3ae6. method of the
          'content_manager', passing self as the message object, and
          passing along any other arguments or keywords as additional
          arguments.  If 'content_manager' is not specified, use the
          ‘content_manager’ specified by the current *note policy: 53.

      -- メソッド: make_related (boundary=None)

          Convert a non-‘multipart’ message into a ‘multipart/related’
          message, moving any existing ‘Content-’ headers and payload
          into a (new) first part of the ‘multipart’.  If 'boundary' is
          specified, use it as the boundary string in the multipart,
          otherwise leave the boundary to be automatically created when
          it is needed (for example, when the message is serialized).

      -- メソッド: make_alternative (boundary=None)

          Convert a non-‘multipart’ or a ‘multipart/related’ into a
          ‘multipart/alternative’, moving any existing ‘Content-’
          headers and payload into a (new) first part of the
          ‘multipart’.  If 'boundary' is specified, use it as the
          boundary string in the multipart, otherwise leave the boundary
          to be automatically created when it is needed (for example,
          when the message is serialized).

      -- メソッド: make_mixed (boundary=None)

          Convert a non-‘multipart’, a ‘multipart/related’, or a
          ‘multipart-alternative’ into a ‘multipart/mixed’, moving any
          existing ‘Content-’ headers and payload into a (new) first
          part of the ‘multipart’.  If 'boundary' is specified, use it
          as the boundary string in the multipart, otherwise leave the
          boundary to be automatically created when it is needed (for
          example, when the message is serialized).

      -- メソッド: add_related (*args, content_manager=None, **kw)

          If the message is a ‘multipart/related’, create a new message
          object, pass all of the arguments to its *note set_content():
          1c5d. method, and *note attach(): 3aeb. it to the ‘multipart’.
          If the message is a non-‘multipart’, call *note
          make_related(): 3ae7. and then proceed as above.  If the
          message is any other type of ‘multipart’, raise a *note
          TypeError: 198.  If 'content_manager' is not specified, use
          the ‘content_manager’ specified by the current *note policy:
          53.  If the added part has no ‘Content-Disposition’ header,
          add one with the value ‘inline’.

      -- メソッド: add_alternative (*args, content_manager=None, **kw)

          If the message is a ‘multipart/alternative’, create a new
          message object, pass all of the arguments to its *note
          set_content(): 1c5d. method, and *note attach(): 3aeb. it to
          the ‘multipart’.  If the message is a non-‘multipart’ or
          ‘multipart/related’, call *note make_alternative(): 3ae8. and
          then proceed as above.  If the message is any other type of
          ‘multipart’, raise a *note TypeError: 198.  If
          'content_manager' is not specified, use the ‘content_manager’
          specified by the current *note policy: 53.

      -- メソッド: add_attachment (*args, content_manager=None, **kw)

          If the message is a ‘multipart/mixed’, create a new message
          object, pass all of the arguments to its *note set_content():
          1c5d. method, and *note attach(): 3aeb. it to the ‘multipart’.
          If the message is a non-‘multipart’, ‘multipart/related’, or
          ‘multipart/alternative’, call *note make_mixed(): 3ae9. and
          then proceed as above.  If 'content_manager' is not specified,
          use the ‘content_manager’ specified by the current *note
          policy: 53.  If the added part has no ‘Content-Disposition’
          header, add one with the value ‘attachment’.  This method can
          be used both for explicit attachments (‘Content-Disposition:
          attachment’) and ‘inline’ attachments (‘Content-Disposition:
          inline’), by passing appropriate options to the
          ‘content_manager’.

      -- メソッド: clear ()

          ペイロードとヘッダの全てを削除します。

      -- メソッド: clear_content ()

          Remove the payload and all of the ‘!Content-’ headers, leaving
          all other headers intact and in their original order.

     *note EmailMessage: 580. オブジェクトは次のようなインスタンス属性を
     持ちます:

      -- の属性: preamble

          MIME ドキュメントの形式では、ヘッダ直後にくる空行と最初の
          multipart 境界をあらわす文字列のあいだにいくらかのテキスト (訳
          注: preamble, 序文) を埋めこむことを許しています。このテキスト
          は標準的な MIME の範疇からはみ出しているので、MIME 形式を認識
          するメールソフトからこれらは通常まったく見えません。しかしメッ
          セージのテキストを生で見る場合、あるいはメッセージを MIME 対応
          していないメールソフトで見る場合、このテキストは目に見えること
          になります。

          'preamble' 属性は MIME ドキュメントに加えるこの最初の MIME 範
          囲外テキストを含んでいます。 *note Parser: 13b5. があるテキス
          トをヘッダ以降に発見したが、それはまだ最初の MIME 境界文字列が
          現れる前だった場合、パーザはそのテキストをメッセージの
          'preamble' 属性に格納します。 *note Generator: 13e6. がある
          MIME メッセージからプレーンテキスト形式を生成するときメッセー
          ジが 'preamble' 属性を持つことが発見されれば、これはそのテキス
          トをヘッダと最初の MIME 境界の間に挿入します。詳細は *note
          email.parser: 52. および *note email.generator: 44. を参照して
          ください。

          注意: そのメッセージに preamble がない場合、'preamble' 属性に
          は ‘None’ が格納されます。

      -- の属性: epilogue

          The 'epilogue' attribute acts the same way as the 'preamble'
          attribute, except that it contains text that appears between
          the last boundary and the end of the message.  As with the
          *note preamble: 3af0, if there is no epilog text this
          attribute will be ‘None’.

      -- の属性: defects

          'defects' 属性はメッセージを解析する途中で検出されたすべての問
          題点 (defect、障害) のリストを保持しています。解析中に発見され
          うる障害についてのより詳細な説明は *note email.errors: 43. を
          参照してください。

 -- クラス: email.message.MIMEPart (policy=default)

     This class represents a subpart of a MIME message.  It is identical
     to *note EmailMessage: 580, except that no ‘MIME-Version’ headers
     are added when *note set_content(): 1c5d. is called, since
     sub-parts do not need their own ‘MIME-Version’ headers.

脚注
....

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/email/message.py

   (2) Originally added in 3.4 as a *note provisional module: 1243.
Docs for legacy message class moved to *note email.message.Message;
compat32 API を使用した電子メールメッセージの表現: 3ab7.

   (3) https://datatracker.ietf.org/doc/html/rfc5322.html

   (4) https://datatracker.ietf.org/doc/html/rfc6532.html

   (5) https://datatracker.ietf.org/doc/html/rfc5322.html

   (6) The *note EmailMessage: 580. class requires a policy that
provides a ‘content_manager’ attribute for content management methods
like ‘set_content()’ and ‘get_content()’ to work.  The legacy *note
compat32: e97. policy does not support these methods and should not be
used with *note EmailMessage: 580.

   (7) https://datatracker.ietf.org/doc/html/rfc6531.html

   (8) https://datatracker.ietf.org/doc/html/rfc2231.html

   (9) https://datatracker.ietf.org/doc/html/rfc2231.html

   (10) https://datatracker.ietf.org/doc/html/rfc2045.html

   (11) https://datatracker.ietf.org/doc/html/rfc2045.html

   (12) https://datatracker.ietf.org/doc/html/rfc2045.html

   (13) https://datatracker.ietf.org/doc/html/rfc2231.html

   (14) https://datatracker.ietf.org/doc/html/rfc2183.html


File: python.info,  Node: email parser Parsing email messages,  Next: email generator Generating MIME documents,  Prev: email message Representing an email message,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.20.1.2 ‘email.parser’: Parsing email messages
...............................................

'ソースコード:' Lib/email/parser.py(1)

__________________________________________________________________

Message object structures can be created in one of two ways: they can be
created from whole cloth by creating an *note EmailMessage: 580. object,
adding headers using the dictionary interface, and adding payload(s)
using *note set_content(): 1c5d. and related methods, or they can be
created by parsing a serialized representation of the email message.

The *note email: 3f. package provides a standard parser that understands
most email document structures, including MIME documents.  You can pass
the parser a bytes, string or file object, and the parser will return to
you the root *note EmailMessage: 580. instance of the object structure.
For simple, non-MIME messages the payload of this root object will
likely be a string containing the text of the message.  For MIME
messages, the root object will return ‘True’ from its *note
is_multipart(): 3abd. method, and the subparts can be accessed via the
payload manipulation methods, such as *note get_body(): 3ae1, *note
iter_parts(): 3ae3, and *note walk(): 3ae0.

There are actually two parser interfaces available for use, the *note
Parser: 13b5. API and the incremental *note FeedParser: 1785. API. The
*note Parser: 13b5. API is most useful if you have the entire text of
the message in memory, or if the entire message lives in a file on the
file system.  *note FeedParser: 1785. is more appropriate when you are
reading the message from a stream which might block waiting for more
input (such as reading an email message from a socket).  The *note
FeedParser: 1785. can consume and parse the message incrementally, and
only returns the root object when you close the parser.

Note that the parser can be extended in limited ways, and of course you
can implement your own parser completely from scratch.  All of the logic
that connects the *note email: 3f. package's bundled parser and the
*note EmailMessage: 580. class is embodied in the *note Policy: 12c7.
class, so a custom parser can create message object trees any way it
finds necessary by implementing custom versions of the appropriate
‘Policy’ methods.

* Menu:

* FeedParser API::
* Parser API::
* 追記事項::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/email/parser.py


File: python.info,  Node: FeedParser API,  Next: Parser API,  Up: email parser Parsing email messages

5.20.1.3 FeedParser API
.......................

The *note BytesFeedParser: 13e3, imported from the ‘email.feedparser’
module, provides an API that is conducive to incremental parsing of
email messages, such as would be necessary when reading the text of an
email message from a source that can block (such as a socket).  The
*note BytesFeedParser: 13e3. can of course be used to parse an email
message fully contained in a *note bytes-like object: 193, string, or
file, but the *note BytesParser: 13e4. API may be more convenient for
such use cases.  The semantics and results of the two parser APIs are
identical.

*note BytesFeedParser: 13e3. API は簡単です。まずインスタンスをつくり、
それに bytes を (それ以上 bytes が必要なくなるまで) 流しこみます。その後
パーザを close すると根っこ (root) のメッセージオブジェクトが返されます
。標準に従ったメッセージを解析する場合、 *note BytesFeedParser: 13e3. は
非常に正確であり、標準に従っていないメッセージでもちゃんと動きます。その
さい、これはメッセージがどのように壊れていると認識されたかについての情報
を残します。これはメッセージオブジェクトの *note defects: 3af2. 属性にリ
ストとして現れ、メッセージ中に発見された問題が記録されます。パーザが検出
できる障害 (defect) については *note email.errors: 43. モジュールを参照
してください。

以下は *note BytesFeedParser: 13e3. の API です:

 -- クラス: email.parser.BytesFeedParser (_factory=None, *,
          policy=policy.compat32)

     Create a *note BytesFeedParser: 13e3. instance.  Optional
     '_factory' is a no-argument callable; if not specified use the
     *note message_factory: e96. from the 'policy'.  Call '_factory'
     whenever a new message object is needed.

     If 'policy' is specified use the rules it specifies to update the
     representation of the message.  If 'policy' is not set, use the
     *note compat32: 12c8. policy, which maintains backward
     compatibility with the Python 3.2 version of the email package and
     provides *note Message: 581. as the default factory.  All other
     policies provide *note EmailMessage: 580. as the default
     '_factory'.  For more information on what else 'policy' controls,
     see the *note policy: 53. documentation.

     Note: 'The policy keyword should always be specified'; The default
     will change to *note email.policy.default: 12cc. in a future
     version of Python.

     Added in version 3.2.

     バージョン 3.3 で変更: キーワード引数 'policy' が追加されました。

     バージョン 3.6 で変更: '_factory' defaults to the policy
     ‘message_factory’.

      -- メソッド: feed (data)

          パーサーにデータを供給します。 'data' は 1行または複数行からな
          る *note bytes-like object: 193. を渡します。渡される行は完結
          していなくてもよく、その場合パーサーは部分的な行を適切につなぎ
          合わせます。各行は3種類の標準的な行末文字 (復帰 CR、改行 LF、
          または CR+LF) どれかの組み合わせでよく、これらが混在してもかま
          いません。

      -- メソッド: close ()

          Complete the parsing of all previously fed data and return the
          root message object.  It is undefined what happens if *note
          feed(): 3af7. is called after this method has been called.

 -- クラス: email.parser.FeedParser (_factory=None, *,
          policy=policy.compat32)

     Works like *note BytesFeedParser: 13e3. except that the input to
     the *note feed(): 3af7. method must be a string.  This is of
     limited utility, since the only way for such a message to be valid
     is for it to contain only ASCII text or, if *note utf8: ff9. is
     ‘True’, no binary attachments.

     バージョン 3.3 で変更: キーワード引数 'policy' が追加されました。


File: python.info,  Node: Parser API,  Next: 追記事項,  Prev: FeedParser API,  Up: email parser Parsing email messages

5.20.1.4 Parser API
...................

The *note BytesParser: 13e4. class, imported from the ‘email.parser’
module, provides an API that can be used to parse a message when the
complete contents of the message are available in a *note bytes-like
object: 193. or file.  The ‘email.parser’ module also provides *note
Parser: 13b5. for parsing strings, and header-only parsers, *note
BytesHeaderParser: 12d1. and *note HeaderParser: 12d2, which can be used
if you're only interested in the headers of the message.  *note
BytesHeaderParser: 12d1. and *note HeaderParser: 12d2. can be much
faster in these situations, since they do not attempt to parse the
message body, instead setting the payload to the raw body.

 -- クラス: email.parser.BytesParser (_class=None, *,
          policy=policy.compat32)

     Create a *note BytesParser: 13e4. instance.  The '_class' and
     'policy' arguments have the same meaning and semantics as the
     '_factory' and 'policy' arguments of *note BytesFeedParser: 13e3.

     Note: 'The policy keyword should always be specified'; The default
     will change to *note email.policy.default: 12cc. in a future
     version of Python.

     バージョン 3.3 で変更: 2.4 で非推奨になった 'strict' 引数の削除。キ
     ーワード引数 'policy' の追加。

     バージョン 3.6 で変更: '_class' defaults to the policy
     ‘message_factory’.

      -- メソッド: parse (fp, headersonly=False)

          Read all the data from the binary file-like object 'fp', parse
          the resulting bytes, and return the message object.  'fp' must
          support both the *note readline(): 1541. and the ‘read()’
          methods.

          The bytes contained in 'fp' must be formatted as a block of
          RFC 5322(1) (or, if *note utf8: ff9. is ‘True’, RFC 6532(2))
          style headers and header continuation lines, optionally
          preceded by an envelope header.  The header block is
          terminated either by the end of the data or by a blank line.
          Following the header block is the body of the message (which
          may contain MIME-encoded subparts, including subparts with a
          ‘Content-Transfer-Encoding’ of ‘8bit’).

          オプション引数 'headersonly' はヘッダを読み終えた後にパースを
          止めるかを指定するフラグです。デフォルトは ‘False’ で、ファイ
          ルの内容全体をパースします。

      -- メソッド: parsebytes (bytes, headersonly=False)

          Similar to the *note parse(): 3afa. method, except it takes a
          *note bytes-like object: 193. instead of a file-like object.
          Calling this method on a *note bytes-like object: 193. is
          equivalent to wrapping 'bytes' in a *note BytesIO: 10a4.
          instance first and calling *note parse(): 3afa.

          オプション引数 'headersonly' は *note parse(): 3afa. メソッド
          と同じです。

     Added in version 3.2.

 -- クラス: email.parser.BytesHeaderParser (_class=None, *,
          policy=policy.compat32)

     Exactly like *note BytesParser: 13e4, except that 'headersonly'
     defaults to ‘True’.

     Added in version 3.3.

 -- クラス: email.parser.Parser (_class=None, *, policy=policy.compat32)

     This class is parallel to *note BytesParser: 13e4, but handles
     string input.

     バージョン 3.3 で変更: 'strict' 引数の削除。キーワード引数 'policy'
     の追加。

     バージョン 3.6 で変更: '_class' defaults to the policy
     ‘message_factory’.

      -- メソッド: parse (fp, headersonly=False)

          ファイルなどテキストモードのストリーム形式 (file-like) のオブ
          ジェクト 'fp' からすべてのデータを読み込み、得られたテキストを
          解析して基底 (root) メッセージオブジェクト構造を返します。
          'fp' はストリーム形式のオブジェクトで *note readline(): 20a6.
          および *note read(): 206c. 両方のメソッドをサポートしている必
          要があります。

          Other than the text mode requirement, this method operates
          like *note BytesParser.parse(): 3afa.

      -- メソッド: parsestr (text, headersonly=False)

          *note parse(): 3afc. メソッドに似ていますが、ファイルなどのス
          トリーム形式のかわりに文字列を引数としてとるところが違います。
          文字列に対してこのメソッドを呼ぶことは、 'text' を *note
          StringIO: 112a. インスタンスとして作成して *note parse():
          3afc. を適用するのと同じです。

          オプション引数 'headersonly' は *note parse(): 3afc. メソッド
          と同じです。

 -- クラス: email.parser.HeaderParser (_class=None, *,
          policy=policy.compat32)

     Exactly like *note Parser: 13b5, except that 'headersonly' defaults
     to ‘True’.

ファイルや文字列からメッセージオブジェクト構造を作成するのはかなりよくお
こなわれる作業なので、便宜上次のような 4つの関数が提供されています。これ
らは *note email: 3f. パッケージのトップレベルの名前空間で使用できます。

 -- の関数: email.message_from_bytes (s, _class=None, *,
          policy=policy.compat32)

     *note bytes-like オブジェクト: 193. からメッセージオブジェクト構造
     を作成して返します。これは ‘BytesParser().parsebytes(s)’ と同じです
     。オプション引数 '_class' および 'policy' は *note BytesParser:
     13e4. クラスのコンストラクタと同様に解釈されます。

     Added in version 3.2.

     バージョン 3.3 で変更: 'strict' 引数の削除。キーワード引数 'policy'
     の追加。

 -- の関数: email.message_from_binary_file (fp, _class=None, *,
          policy=policy.compat32)

     オープンされたバイナリ *note file object: 13db. からメッセージオブ
     ジェクト構造を作成して返します。これは ‘BytesParser().parse(fp)’ と
     同じです。 '_class' および 'policy' は *note BytesParser: 13e4. ク
     ラスのコンストラクタと同様に解釈されます。

     Added in version 3.2.

     バージョン 3.3 で変更: 'strict' 引数の削除。キーワード引数 'policy'
     の追加。

 -- の関数: email.message_from_string (s, _class=None, *,
          policy=policy.compat32)

     文字列からメッセージオブジェクト構造を作成して返します。これは
     ‘Parser().parsestr(s)’ と同じです。 '_class' および 'policy' は
     *note Parser: 13b5. クラスのコンストラクタと同様に解釈されます。

     バージョン 3.3 で変更: 'strict' 引数の削除。キーワード引数 'policy'
     の追加。

 -- の関数: email.message_from_file (fp, _class=None, *,
          policy=policy.compat32)

     オープンされた *note file object: 13db. からメッセージオブジェクト
     構造を作成して返します。これは ‘Parser().parse(fp)’ と同じです。
     '_class' および 'policy' は *note Parser: 13b5. クラスのコンストラ
     クタと同様に解釈されます。

     バージョン 3.3 で変更: 'strict' 引数の削除。キーワード引数 'policy'
     の追加。

     バージョン 3.6 で変更: '_class' defaults to the policy
     ‘message_factory’.

対話的な Python プロンプトで *note message_from_bytes(): 13e1. を使用す
るとすれば、このようになります:

     >>> import email
     >>> msg = email.message_from_bytes(myBytes)

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc5322.html

   (2) https://datatracker.ietf.org/doc/html/rfc6532.html


File: python.info,  Node: 追記事項,  Prev: Parser API,  Up: email parser Parsing email messages

5.20.1.5 追記事項
.................

以下はテキスト解析の際に適用されるいくつかの規約です:

   * Most non-‘multipart’ type messages are parsed as a single message
     object with a string payload.  These objects will return ‘False’
     for *note is_multipart(): 3abd, and *note iter_parts(): 3ae3. will
     yield an empty list.

   * All ‘multipart’ type messages will be parsed as a container message
     object with a list of sub-message objects for their payload.  The
     outer container message will return ‘True’ for *note
     is_multipart(): 3abd, and *note iter_parts(): 3ae3. will yield a
     list of subparts.

   * Most messages with a content type of ‘message/*’ (such as
     ‘message/delivery-status’ and ‘message/rfc822’) will also be parsed
     as container object containing a list payload of length 1.  Their
     *note is_multipart(): 3abd. method will return ‘True’.  The single
     element yielded by *note iter_parts(): 3ae3. will be a sub-message
     object.

   * いくつかの標準的でないメッセージは、 ‘multipart’ の使い方に統一がと
     れていない場合があります。このようなメッセージは ‘Content-Type’ ヘ
     ッダに ‘multipart’ を指定しているものの、その *note is_multipart():
     3abd. メソッドは ‘False’ を返すことがあります。もしこのようなメッセ
     ージが *note FeedParser: 1785. によって解析されると、その 'defects'
     属性のリスト中には *note MultipartInvariantViolationDefect: 3b01. ク
     ラスのインスタンスが現れます。詳しい情報については *note
     email.errors: 43. を参照してください。


File: python.info,  Node: email generator Generating MIME documents,  Next: email policy Policy Objects,  Prev: email parser Parsing email messages,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.20.1.6 ‘email.generator’: Generating MIME documents
.....................................................

'ソースコード:' Lib/email/generator.py(1)

__________________________________________________________________

One of the most common tasks is to generate the flat (serialized)
version of the email message represented by a message object structure.
You will need to do this if you want to send your message via *note
smtplib.SMTP.sendmail(): 1059, or print the message on the console.
Taking a message object structure and producing a serialized
representation is the job of the generator classes.

As with the *note email.parser: 52. module, you aren't limited to the
functionality of the bundled generator; you could write one from scratch
yourself.  However the bundled generator knows how to generate most
email in a standards-compliant way, should handle MIME and non-MIME
email messages just fine, and is designed so that the bytes-oriented
parsing and generation operations are inverses, assuming the same
non-transforming *note policy: 53. is used for both.  That is, parsing
the serialized byte stream via the *note BytesParser: 13e4. class and
then regenerating the serialized byte stream using *note BytesGenerator:
13e7. should produce output identical to the input (2).  (On the other
hand, using the generator on an *note EmailMessage: 580. constructed by
program may result in changes to the *note EmailMessage: 580. object as
defaults are filled in.)

The *note Generator: 13e6. class can be used to flatten a message into a
text (as opposed to binary) serialized representation, but since Unicode
cannot represent binary data directly, the message is of necessity
transformed into something that contains only ASCII characters, using
the standard email RFC Content Transfer Encoding techniques for encoding
email messages for transport over channels that are not "8 bit clean".

To accommodate reproducible processing of SMIME-signed messages *note
Generator: 13e6. disables header folding for message parts of type
‘multipart/signed’ and all subparts.

 -- クラス: email.generator.BytesGenerator (outfp, mangle_from_=None,
          maxheaderlen=None, *, policy=None)

     Return a *note BytesGenerator: 13e7. object that will write any
     message provided to the *note flatten(): 3b06. method, or any
     surrogateescape encoded text provided to the *note write(): 3b07.
     method, to the *note file-like object: 17ac. 'outfp'.  'outfp' must
     support a ‘write’ method that accepts binary data.

     If optional 'mangle_from_' is ‘True’, put a ‘>’ character in front
     of any line in the body that starts with the exact string ‘"From
     "’, that is ‘From’ followed by a space at the beginning of a line.
     'mangle_from_' defaults to the value of the *note mangle_from_:
     ff7. setting of the 'policy' (which is ‘True’ for the *note
     compat32: e97. policy and ‘False’ for all others).  'mangle_from_'
     is intended for use when messages are stored in Unix mbox format
     (see *note mailbox: 8f. and WHY THE CONTENT-LENGTH FORMAT IS
     BAD(3)).

     If 'maxheaderlen' is not ‘None’, refold any header lines that are
     longer than 'maxheaderlen', or if ‘0’, do not rewrap any headers.
     If 'manheaderlen' is ‘None’ (the default), wrap headers and other
     message lines according to the 'policy' settings.

     If 'policy' is specified, use that policy to control message
     generation.  If 'policy' is ‘None’ (the default), use the policy
     associated with the *note Message: 581. or *note EmailMessage: 580.
     object passed to ‘flatten’ to control the message generation.  See
     *note email.policy: 53. for details on what 'policy' controls.

     Added in version 3.2.

     バージョン 3.3 で変更: キーワード引数 'policy' が追加されました。

     バージョン 3.6 で変更: The default behavior of the 'mangle_from_'
     and 'maxheaderlen' parameters is to follow the policy.

      -- メソッド: flatten (msg, unixfrom=False, linesep=None)

          'msg' を基点とするメッセージオブジェクト構造体の文字表現を出力
          します。出力先のファイルにはこの *note BytesGenerator: 13e7. イ
          ンスタンスが作成されたときに指定されたものが使われます。

          If the *note policy: 53. option *note cte_type: 3b08. is
          ‘8bit’ (the default), copy any headers in the original parsed
          message that have not been modified to the output with any
          bytes with the high bit set reproduced as in the original, and
          preserve the non-ASCII ‘Content-Transfer-Encoding’ of any body
          parts that have them.  If ‘cte_type’ is ‘7bit’, convert the
          bytes with the high bit set as needed using an
          ASCII-compatible ‘Content-Transfer-Encoding’.  That is,
          transform parts with non-ASCII ‘Content-Transfer-Encoding’
          (‘Content-Transfer-Encoding: 8bit’) to an ASCII compatible
          ‘Content-Transfer-Encoding’, and encode RFC-invalid non-ASCII
          bytes in headers using the MIME ‘unknown-8bit’ character set,
          thus rendering them RFC-compliant.

          If 'unixfrom' is ‘True’, print the envelope header delimiter
          used by the Unix mailbox format (see *note mailbox: 8f.)
          before the first of the RFC 5322(4) headers of the root
          message object.  If the root object has no envelope header,
          craft a standard one.  The default is ‘False’.  Note that for
          subparts, no envelope header is ever printed.

          If 'linesep' is not ‘None’, use it as the separator character
          between all the lines of the flattened message.  If 'linesep'
          is ‘None’ (the default), use the value specified in the
          'policy'.

      -- メソッド: clone (fp)

          Return an independent clone of this *note BytesGenerator:
          13e7. instance with the exact same option settings, and 'fp'
          as the new 'outfp'.

      -- メソッド: write (s)

          Encode 's' using the ‘ASCII’ codec and the ‘surrogateescape’
          error handler, and pass it to the 'write' method of the
          'outfp' passed to the *note BytesGenerator: 13e7.'s
          constructor.

As a convenience, *note EmailMessage: 580. provides the methods *note
as_bytes(): 3abb. and ‘bytes(aMessage)’ (a.k.a.  *note __bytes__():
3abc.), which simplify the generation of a serialized binary
representation of a message object.  For more detail, see *note
email.message: 48.

Because strings cannot represent binary data, the *note Generator: 13e6.
class must convert any binary data in any message it flattens to an
ASCII compatible format, by converting them to an ASCII compatible
‘Content-Transfer_Encoding’.  Using the terminology of the email RFCs,
you can think of this as *note Generator: 13e6. serializing to an I/O
stream that is not "8 bit clean".  In other words, most applications
will want to be using *note BytesGenerator: 13e7, and not *note
Generator: 13e6.

 -- クラス: email.generator.Generator (outfp, mangle_from_=None,
          maxheaderlen=None, *, policy=None)

     Return a *note Generator: 13e6. object that will write any message
     provided to the *note flatten(): 3b0a. method, or any text provided
     to the *note write(): 3b0b. method, to the *note file-like object:
     17ac. 'outfp'.  'outfp' must support a ‘write’ method that accepts
     string data.

     If optional 'mangle_from_' is ‘True’, put a ‘>’ character in front
     of any line in the body that starts with the exact string ‘"From
     "’, that is ‘From’ followed by a space at the beginning of a line.
     'mangle_from_' defaults to the value of the *note mangle_from_:
     ff7. setting of the 'policy' (which is ‘True’ for the *note
     compat32: e97. policy and ‘False’ for all others).  'mangle_from_'
     is intended for use when messages are stored in Unix mbox format
     (see *note mailbox: 8f. and WHY THE CONTENT-LENGTH FORMAT IS
     BAD(5)).

     If 'maxheaderlen' is not ‘None’, refold any header lines that are
     longer than 'maxheaderlen', or if ‘0’, do not rewrap any headers.
     If 'manheaderlen' is ‘None’ (the default), wrap headers and other
     message lines according to the 'policy' settings.

     If 'policy' is specified, use that policy to control message
     generation.  If 'policy' is ‘None’ (the default), use the policy
     associated with the *note Message: 581. or *note EmailMessage: 580.
     object passed to ‘flatten’ to control the message generation.  See
     *note email.policy: 53. for details on what 'policy' controls.

     バージョン 3.3 で変更: キーワード引数 'policy' が追加されました。

     バージョン 3.6 で変更: The default behavior of the 'mangle_from_'
     and 'maxheaderlen' parameters is to follow the policy.

      -- メソッド: flatten (msg, unixfrom=False, linesep=None)

          'msg' を基点とするメッセージオブジェクト構造体の文字表現を出力
          します。出力先のファイルにはこの *note Generator: 13e6. インス
          タンスが作成されたときに指定されたものが使われます。

          If the *note policy: 53. option *note cte_type: 3b08. is
          ‘8bit’, generate the message as if the option were set to
          ‘7bit’.  (This is required because strings cannot represent
          non-ASCII bytes.)  Convert any bytes with the high bit set as
          needed using an ASCII-compatible ‘Content-Transfer-Encoding’.
          That is, transform parts with non-ASCII
          ‘Content-Transfer-Encoding’ (‘Content-Transfer-Encoding:
          8bit’) to an ASCII compatible ‘Content-Transfer-Encoding’, and
          encode RFC-invalid non-ASCII bytes in headers using the MIME
          ‘unknown-8bit’ character set, thus rendering them
          RFC-compliant.

          If 'unixfrom' is ‘True’, print the envelope header delimiter
          used by the Unix mailbox format (see *note mailbox: 8f.)
          before the first of the RFC 5322(6) headers of the root
          message object.  If the root object has no envelope header,
          craft a standard one.  The default is ‘False’.  Note that for
          subparts, no envelope header is ever printed.

          If 'linesep' is not ‘None’, use it as the separator character
          between all the lines of the flattened message.  If 'linesep'
          is ‘None’ (the default), use the value specified in the
          'policy'.

          バージョン 3.2 で変更: ‘8bit’ メッセージ本体の再エンコードがサ
          ポートされました。'linesep' 引数が追加されました。

      -- メソッド: clone (fp)

          Return an independent clone of this *note Generator: 13e6.
          instance with the exact same options, and 'fp' as the new
          'outfp'.

      -- メソッド: write (s)

          Write 's' to the 'write' method of the 'outfp' passed to the
          *note Generator: 13e6.'s constructor.  This provides just
          enough file-like API for *note Generator: 13e6. instances to
          be used in the *note print(): 1177. function.

As a convenience, *note EmailMessage: 580. provides the methods *note
as_string(): 3ab8. and ‘str(aMessage)’ (a.k.a.  *note __str__(): 3aba.),
which simplify the generation of a formatted string representation of a
message object.  For more detail, see *note email.message: 48.

The ‘email.generator’ module also provides a derived class, *note
DecodedGenerator: e95, which is like the *note Generator: 13e6. base
class, except that non-‘text’ parts are not serialized, but are instead
represented in the output stream by a string derived from a template
filled in with information about the part.

 -- クラス: email.generator.DecodedGenerator (outfp, mangle_from_=None,
          maxheaderlen=None, fmt=None, *, policy=None)

     Act like *note Generator: 13e6, except that for any subpart of the
     message passed to *note Generator.flatten(): 3b0a, if the subpart
     is of main type ‘text’, print the decoded payload of the subpart,
     and if the main type is not ‘text’, instead of printing it fill in
     the string 'fmt' using information from the part and print the
     resulting filled-in string.

     To fill in 'fmt', execute ‘fmt % part_info’, where ‘part_info’ is a
     dictionary composed of the following keys and values:

        * ‘type’ - 非 ‘text’ 型 subpart の MIME 形式

        * ‘maintype’ - 非 ‘text’ 型 subpart の MIME 主形式 (maintype)

        * ‘subtype’ - 非 ‘text’ 型 subpart の MIME 副形式 (subtype)

        * ‘filename’ - 非 ‘text’ 型 subpart のファイル名

        * ‘description’ - 非 ‘text’ 型 subpart につけられた説明文字列

        * ‘encoding’ - 非 ‘text’ 型 subpart の Content-transfer-encoding

     If 'fmt' is ‘None’, use the following default 'fmt':

          "[Non-text (%(type)s) part of message omitted, filename
          %(filename)s]"

     Optional '_mangle_from_' and 'maxheaderlen' are as with the *note
     Generator: 13e6. base class.

脚注
....

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/email/generator.py

   (2) This statement assumes that you use the appropriate setting for
‘unixfrom’, and that there are no *note email.policy: 53. settings
calling for automatic adjustments (for example, *note refold_source:
3b05. must be ‘none’, which is 'not' the default).  It is also not 100%
true, since if the message does not conform to the RFC standards
occasionally information about the exact original text is lost during
parsing error recovery.  It is a goal to fix these latter edge cases
when possible.

   (3) https://www.jwz.org/doc/content-length.html

   (4) https://datatracker.ietf.org/doc/html/rfc5322.html

   (5) https://www.jwz.org/doc/content-length.html

   (6) https://datatracker.ietf.org/doc/html/rfc5322.html


File: python.info,  Node: email policy Policy Objects,  Next: email errors Exception and Defect classes,  Prev: email generator Generating MIME documents,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.20.1.7 ‘email.policy’: Policy Objects
.......................................

Added in version 3.3.

'ソースコード:' Lib/email/policy.py(1)

__________________________________________________________________

*note email: 3f. パッケージの主要な目的は様々なEメールやMIMEのRFCで記述
されたEメールメッセージを取り扱うことにあります。しかし、Eメールメッセー
ジの一般的なフォーマット(名前の後にコロンが続き、コロンの後に値が続くと
いう構成の複数のヘッダーフィールドのブロック、空白行、任意の 'body')は
Eメールの分野外での用途が見いだされたフォーマットです。これらの用途には
主となるEメールのRFCに厳密に従っているものもあれば、そうでないものもあり
ます。Eメールを使ったworkingのときでさえも、厳密なRFC準拠にしないのが望
ましいことがあります。たとえば、基準に従わないEメールサーバーと相互運用
するEメールを作成するときや、基準に違反する方法で使用したい拡張機能を実
装するEメールを作成するときです。

これらのばらばらな用途に対応するためPolicyオブジェクトはEメールパッケー
ジに対して柔軟性を提供します。

A *note Policy: 12c7. object encapsulates a set of attributes and
methods that control the behavior of various components of the email
package during use.  *note Policy: 12c7. instances can be passed to
various classes and methods in the email package to alter the default
behavior.  The settable values and their defaults are described below.

There is a default policy used by all classes in the email package.  For
all of the *note parser: 52. classes and the related convenience
functions, and for the *note Message: 581. class, this is the *note
Compat32: 12c8. policy, via its corresponding pre-defined instance *note
compat32: e97.  This policy provides for complete backward compatibility
(in some cases, including bug compatibility) with the pre-Python3.3
version of the email package.

This default value for the 'policy' keyword to *note EmailMessage: 580.
is the *note EmailPolicy: 12cb. policy, via its pre-defined instance
*note default: 12cc.

When a *note Message: 581. or *note EmailMessage: 580. object is
created, it acquires a policy.  If the message is created by a *note
parser: 52, a policy passed to the parser will be the policy used by the
message it creates.  If the message is created by the program, then the
policy can be specified when it is created.  When a message is passed to
a *note generator: 44, the generator uses the policy from the message by
default, but you can also pass a specific policy to the generator that
will override the one stored on the message object.

The default value for the 'policy' keyword for the *note email.parser:
52. classes and the parser convenience functions 'will be changing' in a
future version of Python.  Therefore you should 'always specify
explicitly which policy you want to use' when calling any of the classes
and functions described in the *note parser: 52. module.

The first part of this documentation covers the features of *note
Policy: 12c7, an *note abstract base class: 13ce. that defines the
features that are common to all policy objects, including *note
compat32: e97.  This includes certain hook methods that are called
internally by the email package, which a custom policy could override to
obtain different behavior.  The second part describes the concrete
classes *note EmailPolicy: 12cb. and *note Compat32: 12c8, which
implement the hooks that provide the standard behavior and the backward
compatible behavior and features, respectively.

*note Policy: 12c7. instances are immutable, but they can be cloned,
accepting the same keyword arguments as the class constructor and
returning a new *note Policy: 12c7. instance that is a copy of the
original but with the specified attributes values changed.

As an example, the following code could be used to read an email message
from a file on disk and pass it to the system ‘sendmail’ program on a
Unix system:

     >>> from email import message_from_binary_file
     >>> from email.generator import BytesGenerator
     >>> from email import policy
     >>> from subprocess import Popen, PIPE
     >>> with open('mymsg.txt', 'rb') as f:
     ...     msg = message_from_binary_file(f, policy=policy.default)
     ...
     >>> p = Popen(['sendmail', msg['To'].addresses[0]], stdin=PIPE)
     >>> g = BytesGenerator(p.stdin, policy=msg.policy.clone(linesep='\r\n'))
     >>> g.flatten(msg)
     >>> p.stdin.close()
     >>> rc = p.wait()

Here we are telling *note BytesGenerator: 13e7. to use the RFC correct
line separator characters when creating the binary string to feed into
‘sendmail's’ ‘stdin’, where the default policy would use ‘\n’ line
separators.

Some email package methods accept a 'policy' keyword argument, allowing
the policy to be overridden for that method.  For example, the following
code uses the *note as_bytes(): 1139. method of the 'msg' object from
the previous example and writes the message to a file using the native
line separators for the platform on which it is running:

     >>> import os
     >>> with open('converted.txt', 'wb') as f:
     ...     f.write(msg.as_bytes(policy=msg.policy.clone(linesep=os.linesep)))
     17

Policyオブジェクトは加算オペレータを使用して組み合わせることも可能で、そ
れらのオブジェクトの非デフォルト値を組み合わせた設定を持つPolicyオブジェ
クトを生成します:

     >>> compat_SMTP = policy.compat32.clone(linesep='\r\n')
     >>> compat_strict = policy.compat32.clone(raise_on_defect=True)
     >>> compat_strict_SMTP = compat_SMTP + compat_strict

この操作には交換法則が成り立ちません。つまり、オブジェクトを加える順番に
結果が依存します。次のように説明できます:

     >>> policy100 = policy.compat32.clone(max_line_length=100)
     >>> policy80 = policy.compat32.clone(max_line_length=80)
     >>> apolicy = policy100 + policy80
     >>> apolicy.max_line_length
     80
     >>> apolicy = policy80 + policy100
     >>> apolicy.max_line_length
     100

 -- クラス: email.policy.Policy (**kw)

     This is the *note abstract base class: 13ce. for all policy
     classes.  It provides default implementations for a couple of
     trivial methods, as well as the implementation of the immutability
     property, the *note clone(): 12c9. method, and the constructor
     semantics.

     The constructor of a policy class can be passed various keyword
     arguments.  The arguments that may be specified are any non-method
     properties on this class, plus any additional non-method properties
     on the concrete class.  A value specified in the constructor will
     override the default value for the corresponding attribute.

     This class defines the following properties, and thus values for
     the following may be passed in the constructor of any policy class:

      -- の属性: max_line_length

          行の終端文字を数に含まない、シリアライズした出力の任意の行の最
          大長。デフォルトは RFC 5322(2) に従い78となっています。値が
          ‘0’ または *note None: 885. の場合は行の折り返しを全くしないべ
          きであるということを示します。

      -- の属性: linesep

          The string to be used to terminate lines in serialized output.
          The default is ‘\n’ because that's the internal end-of-line
          discipline used by Python, though ‘\r\n’ is required by the
          RFCs.

      -- の属性: cte_type

          Controls the type of Content Transfer Encodings that may be or
          are required to be used.  The possible values are:

          ‘7bit’       all data must be "7 bit clean" (ASCII-only).  This means that
                       where necessary data will be encoded using either
                       quoted-printable or base64 encoding.
                       
                       
          ‘8bit’       data is not constrained to be 7 bit clean.  Data in headers is
                       still required to be ASCII-only and so will be encoded (see
                       *note fold_binary(): 3b11. and *note utf8: ff9. below for
                       exceptions), but body parts may use the ‘8bit’ CTE.
                       

          A ‘cte_type’ value of ‘8bit’ only works with ‘BytesGenerator’,
          not ‘Generator’, because strings cannot contain binary data.
          If a ‘Generator’ is operating under a policy that specifies
          ‘cte_type=8bit’, it will act as if ‘cte_type’ is ‘7bit’.

      -- の属性: raise_on_defect

          If *note True: e07, any defects encountered will be raised as
          errors.  If *note False: d2b. (the default), defects will be
          passed to the *note register_defect(): 3b13. method.

      -- の属性: mangle_from_

          If *note True: e07, lines starting with '"From "' in the body
          are escaped by putting a ‘>’ in front of them.  This parameter
          is used when the message is being serialized by a generator.
          Default: *note False: d2b.

          Added in version 3.5.

      -- の属性: message_factory

          A factory function for constructing a new empty message
          object.  Used by the parser when building messages.  Defaults
          to ‘None’, in which case *note Message: 581. is used.

          Added in version 3.6.

      -- の属性: verify_generated_headers

          If ‘True’ (the default), the generator will raise *note
          HeaderWriteError: 3b14. instead of writing a header that is
          improperly folded or delimited, such that it would be parsed
          as multiple headers or joined with adjacent data.  Such
          headers can be generated by custom header classes or bugs in
          the ‘email’ module.

          As it's a security feature, this defaults to ‘True’ even in
          the *note Compat32: 12c8. policy.  For backwards compatible,
          but unsafe, behavior, it must be set to ‘False’ explicitly.

          Added in version 3.13.

     The following *note Policy: 12c7. method is intended to be called
     by code using the email library to create policy instances with
     custom settings:

      -- メソッド: clone (**kw)

          Return a new *note Policy: 12c7. instance whose attributes
          have the same values as the current instance, except where
          those attributes are given new values by the keyword
          arguments.

     The remaining *note Policy: 12c7. methods are called by the email
     package code, and are not intended to be called by an application
     using the email package.  A custom policy must implement all of
     these methods.

      -- メソッド: handle_defect (obj, defect)

          Handle a 'defect' found on 'obj'.  When the email package
          calls this method, 'defect' will always be a subclass of *note
          MessageDefect: 3b16.

          The default implementation checks the *note raise_on_defect:
          3b12. flag.  If it is ‘True’, 'defect' is raised as an
          exception.  If it is ‘False’ (the default), 'obj' and 'defect'
          are passed to *note register_defect(): 3b13.

      -- メソッド: register_defect (obj, defect)

          Register a 'defect' on 'obj'.  In the email package, 'defect'
          will always be a subclass of *note MessageDefect: 3b16.

          The default implementation calls the ‘append’ method of the
          ‘defects’ attribute of 'obj'.  When the email package calls
          *note handle_defect: 3b15, 'obj' will normally have a
          ‘defects’ attribute that has an ‘append’ method.  Custom
          object types used with the email package (for example, custom
          ‘Message’ objects) should also provide such an attribute,
          otherwise defects in parsed messages will raise unexpected
          errors.

      -- メソッド: header_max_count (name)

          'name' というヘッダに許される最大の数を返します。

          Called when a header is added to an *note EmailMessage: 580.
          or *note Message: 581. object.  If the returned value is not
          ‘0’ or ‘None’, and there are already a number of headers with
          the name 'name' greater than or equal to the value returned, a
          *note ValueError: 2ec. is raised.

          Because the default behavior of ‘Message.__setitem__’ is to
          append the value to the list of headers, it is easy to create
          duplicate headers without realizing it.  This method allows
          certain headers to be limited in the number of instances of
          that header that may be added to a ‘Message’ programmatically.
          (The limit is not observed by the parser, which will
          faithfully produce as many headers as exist in the message
          being parsed.)

          デフォルトの実装は全てのヘッダ名に ‘None’ を返します。

      -- メソッド: header_source_parse (sourcelines)

          The email package calls this method with a list of strings,
          each string ending with the line separation characters found
          in the source being parsed.  The first line includes the field
          header name and separator.  All whitespace in the source is
          preserved.  The method should return the ‘(name, value)’ tuple
          that is to be stored in the ‘Message’ to represent the parsed
          header.

          If an implementation wishes to retain compatibility with the
          existing email package policies, 'name' should be the case
          preserved name (all characters up to the '‘:’' separator),
          while 'value' should be the unfolded value (all line separator
          characters removed, but whitespace kept intact), stripped of
          leading whitespace.

          'sourcelines' はサロゲートエスケープされたバイナリーデータを持
          つことがあります。

          デフォルトの実装はありません。

      -- メソッド: header_store_parse (name, value)

          The email package calls this method with the name and value
          provided by the application program when the application
          program is modifying a ‘Message’ programmatically (as opposed
          to a ‘Message’ created by a parser).  The method should return
          the ‘(name, value)’ tuple that is to be stored in the
          ‘Message’ to represent the header.

          If an implementation wishes to retain compatibility with the
          existing email package policies, the 'name' and 'value' should
          be strings or string subclasses that do not change the content
          of the passed in arguments.

          デフォルトの実装はありません。

      -- メソッド: header_fetch_parse (name, value)

          The email package calls this method with the 'name' and
          'value' currently stored in the ‘Message’ when that header is
          requested by the application program, and whatever the method
          returns is what is passed back to the application as the value
          of the header being retrieved.  Note that there may be more
          than one header with the same name stored in the ‘Message’;
          the method is passed the specific name and value of the header
          destined to be returned to the application.

          'value' はサロゲートエスケープされたバイナリーデータを持つこと
          があります。このメソッドの返り値にはサロゲートエスケープされた
          バイナリーデータはありません。

          デフォルトの実装はありません。

      -- メソッド: fold (name, value)

          The email package calls this method with the 'name' and
          'value' currently stored in the ‘Message’ for a given header.
          The method should return a string that represents that header
          "folded" correctly (according to the policy settings) by
          composing the 'name' with the 'value' and inserting *note
          linesep: 3b10. characters at the appropriate places.  See RFC
          5322(3) for a discussion of the rules for folding email
          headers.

          'value' はサロゲートエスケープされたバイナリーデータを持つこと
          があります。このメソッドが返す文字列にはサロゲートエスケープさ
          れたバイナリーデータはありません。

      -- メソッド: fold_binary (name, value)

          返り値が文字列でなく bytes オブジェクトである点を除けば、*note
          fold(): 3b1b. と同じです。

          'value' はサロゲートエスケープされたバイナリデータを持つことが
          あります。これらは返されたbytesオブジェクト内でバイナリデータ
          に変換されることがあります。

 -- クラス: email.policy.EmailPolicy (**kw)

     This concrete *note Policy: 12c7. provides behavior that is
     intended to be fully compliant with the current email RFCs.  These
     include (but are not limited to) RFC 5322(4), RFC 2047(5), and the
     current MIME RFCs.

     This policy adds new header parsing and folding algorithms.
     Instead of simple strings, headers are ‘str’ subclasses with
     attributes that depend on the type of the field.  The parsing and
     folding algorithm fully implement RFC 2047(6) and RFC 5322(7).

     The default value for the *note message_factory: e96. attribute is
     *note EmailMessage: 580.

     In addition to the settable attributes listed above that apply to
     all policies, this policy adds the following additional attributes:

     Added in version 3.6: (8)

      -- の属性: utf8

          If ‘False’, follow RFC 5322(9), supporting non-ASCII
          characters in headers by encoding them as "encoded words".  If
          ‘True’, follow RFC 6532(10) and use ‘utf-8’ encoding for
          headers.  Messages formatted in this way may be passed to SMTP
          servers that support the ‘SMTPUTF8’ extension ( RFC 6531(11)).

      -- の属性: refold_source

          If the value for a header in the ‘Message’ object originated
          from a *note parser: 52. (as opposed to being set by a
          program), this attribute indicates whether or not a generator
          should refold that value when transforming the message back
          into serialized form.  The possible values are:

          ‘none’       all source values use original folding
                       
                       
          ‘long’       source values that have any line that is longer than
                       ‘max_line_length’ will be refolded
                       
                       
          ‘all’        all values are refolded.
                       

          デフォルトは ‘long’ です。

      -- の属性: header_factory

          A callable that takes two arguments, ‘name’ and ‘value’, where
          ‘name’ is a header field name and ‘value’ is an unfolded
          header field value, and returns a string subclass that
          represents that header.  A default ‘header_factory’ (see *note
          headerregistry: 46.) is provided that supports custom parsing
          for the various address and date RFC 5322(12) header field
          types, and the major MIME header field stypes.  Support for
          additional custom parsing will be added in the future.

      -- の属性: content_manager

          An object with at least two methods: get_content and
          set_content.  When the *note get_content(): 3ae4. or *note
          set_content(): 1c5d. method of an *note EmailMessage: 580.
          object is called, it calls the corresponding method of this
          object, passing it the message object as its first argument,
          and any arguments or keywords that were passed to it as
          additional arguments.  By default ‘content_manager’ is set to
          *note raw_data_manager: 3b1d.

          Added in version 3.4.

     このクラスは *note Policy: 12c7. の抽象メソッドの具象実装を提供しま
     す:

      -- メソッド: header_max_count (name)

          Returns the value of the *note max_count: 3b1f. attribute of
          the specialized class used to represent the header with the
          given name.

      -- メソッド: header_source_parse (sourcelines)

          The name is parsed as everything up to the '‘:’' and returned
          unmodified.  The value is determined by stripping leading
          whitespace off the remainder of the first line, joining all
          subsequent lines together, and stripping any trailing carriage
          return or linefeed characters.

      -- メソッド: header_store_parse (name, value)

          The name is returned unchanged.  If the input value has a
          ‘name’ attribute and it matches 'name' ignoring case, the
          value is returned unchanged.  Otherwise the 'name' and 'value'
          are passed to ‘header_factory’, and the resulting header
          object is returned as the value.  In this case a ‘ValueError’
          is raised if the input value contains CR or LF characters.

      -- メソッド: header_fetch_parse (name, value)

          If the value has a ‘name’ attribute, it is returned to
          unmodified.  Otherwise the 'name', and the 'value' with any CR
          or LF characters removed, are passed to the ‘header_factory’,
          and the resulting header object is returned.  Any
          surrogateescaped bytes get turned into the unicode
          unknown-character glyph.

      -- メソッド: fold (name, value)

          Header folding is controlled by the *note refold_source: 3b05.
          policy setting.  A value is considered to be a 'source value'
          if and only if it does not have a ‘name’ attribute (having a
          ‘name’ attribute means it is a header object of some sort).
          If a source value needs to be refolded according to the
          policy, it is converted into a header object by passing the
          'name' and the 'value' with any CR and LF characters removed
          to the ‘header_factory’.  Folding of a header object is done
          by calling its ‘fold’ method with the current policy.

          Source values are split into lines using *note splitlines():
          146e.  If the value is not to be refolded, the lines are
          rejoined using the ‘linesep’ from the policy and returned.
          The exception is lines containing non-ascii binary data.  In
          that case the value is refolded regardless of the
          ‘refold_source’ setting, which causes the binary data to be
          CTE encoded using the ‘unknown-8bit’ charset.

      -- メソッド: fold_binary (name, value)

          返り値が bytes である点を除いて、*note cte_type: 3b08. が
          ‘7bit’ の場合は *note fold(): 19f2. と同じです。

          If *note cte_type: 3b08. is ‘8bit’, non-ASCII binary data is
          converted back into bytes.  Headers with binary data are not
          refolded, regardless of the ‘refold_header’ setting, since
          there is no way to know whether the binary data consists of
          single byte characters or multibyte characters.

The following instances of *note EmailPolicy: 12cb. provide defaults
suitable for specific application domains.  Note that in the future the
behavior of these instances (in particular the ‘HTTP’ instance) may be
adjusted to conform even more closely to the RFCs relevant to their
domains.

 -- データ: email.policy.default

     デフォルト値を変更していない ‘EmailPolicy’ のインスタンスです。この
     ポリシーの行末は、 RFC で正しい ‘\r\n’ ではなく Python の標準の
     ‘\n’ です。

 -- データ: email.policy.SMTP

     Suitable for serializing messages in conformance with the email
     RFCs.  Like ‘default’, but with ‘linesep’ set to ‘\r\n’, which is
     RFC compliant.

 -- データ: email.policy.SMTPUTF8

     The same as ‘SMTP’ except that *note utf8: ff9. is ‘True’.  Useful
     for serializing messages to a message store without using encoded
     words in the headers.  Should only be used for SMTP transmission if
     the sender or recipient addresses have non-ASCII characters (the
     *note smtplib.SMTP.send_message(): 105a. method handles this
     automatically).

 -- データ: email.policy.HTTP

     Suitable for serializing headers with for use in HTTP traffic.
     Like ‘SMTP’ except that ‘max_line_length’ is set to ‘None’
     (unlimited).

 -- データ: email.policy.strict

     Convenience instance.  The same as ‘default’ except that
     ‘raise_on_defect’ is set to ‘True’.  This allows any policy to be
     made strict by writing:

          somepolicy + policy.strict

With all of these *note EmailPolicies: 12cb, the effective API of the
email package is changed from the Python 3.2 API in the following ways:

   * Setting a header on a *note Message: 581. results in that header
     being parsed and a header object created.

   * Fetching a header value from a *note Message: 581. results in that
     header being parsed and a header object created and returned.

   * Any header object, or any header that is refolded due to the policy
     settings, is folded using an algorithm that fully implements the
     RFC folding algorithms, including knowing where encoded words are
     required and allowed.

From the application view, this means that any header obtained through
the *note EmailMessage: 580. is a header object with extra attributes,
whose string value is the fully decoded unicode value of the header.
Likewise, a header may be assigned a new value, or a new header created,
using a unicode string, and the policy will take care of converting the
unicode string into the correct RFC encoded form.

ヘッダオブジェクトとその属性は *note headerregistry: 46. で述べられてい
ます。

 -- クラス: email.policy.Compat32 (**kw)

     This concrete *note Policy: 12c7. is the backward compatibility
     policy.  It replicates the behavior of the email package in Python
     3.2.  The ‘policy’ module also defines an instance of this class,
     *note compat32: e97, that is used as the default policy.  Thus the
     default behavior of the email package is to maintain compatibility
     with Python 3.2.

     以下の属性は *note Policy: 12c7. デフォルトとは異なる値を持ちます:

      -- の属性: mangle_from_

          デフォルトは ‘True’ です。

     このクラスは *note Policy: 12c7. の抽象メソッドの具象実装を提供しま
     す:

      -- メソッド: header_source_parse (sourcelines)

          The name is parsed as everything up to the '‘:’' and returned
          unmodified.  The value is determined by stripping leading
          whitespace off the remainder of the first line, joining all
          subsequent lines together, and stripping any trailing carriage
          return or linefeed characters.

      -- メソッド: header_store_parse (name, value)

          名前と値は変更されずに返されます。

      -- メソッド: header_fetch_parse (name, value)

          If the value contains binary data, it is converted into a
          *note Header: 1c5e. object using the ‘unknown-8bit’ charset.
          Otherwise it is returned unmodified.

      -- メソッド: fold (name, value)

          Headers are folded using the *note Header: 1c5e. folding
          algorithm, which preserves existing line breaks in the value,
          and wraps each resulting line to the ‘max_line_length’.
          Non-ASCII binary data are CTE encoded using the ‘unknown-8bit’
          charset.

      -- メソッド: fold_binary (name, value)

          Headers are folded using the *note Header: 1c5e. folding
          algorithm, which preserves existing line breaks in the value,
          and wraps each resulting line to the ‘max_line_length’.  If
          ‘cte_type’ is ‘7bit’, non-ascii binary data is CTE encoded
          using the ‘unknown-8bit’ charset.  Otherwise the original
          source header is used, with its existing line breaks and any
          (RFC invalid) binary data it may contain.

 -- データ: email.policy.compat32

     *note Compat32: 12c8. のインスタンスで、Python 3.2 の email パッケ
     ージの挙動との後方互換性を提供します。

          注釈: The *note compat32: e97. policy should not be used as a
          policy for *note EmailMessage: 580. objects, and should only
          be used to serialize messages that were created using the
          *note compat32: e97. policy.

脚注
....

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/email/policy.py

   (2) https://datatracker.ietf.org/doc/html/rfc5322.html

   (3) https://datatracker.ietf.org/doc/html/rfc5322.html

   (4) https://datatracker.ietf.org/doc/html/rfc5322.html

   (5) https://datatracker.ietf.org/doc/html/rfc2047.html

   (6) https://datatracker.ietf.org/doc/html/rfc2047.html

   (7) https://datatracker.ietf.org/doc/html/rfc5322.html

   (8) Originally added in 3.3 as a *note provisional feature: 1243.

   (9) https://datatracker.ietf.org/doc/html/rfc5322.html

   (10) https://datatracker.ietf.org/doc/html/rfc6532.html

   (11) https://datatracker.ietf.org/doc/html/rfc6531.html

   (12) https://datatracker.ietf.org/doc/html/rfc5322.html


File: python.info,  Node: email errors Exception and Defect classes,  Next: email headerregistry Custom Header Objects,  Prev: email policy Policy Objects,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.20.1.8 ‘email.errors’: Exception and Defect classes
.....................................................

'ソースコード:' Lib/email/errors.py(1)

__________________________________________________________________

The following exception classes are defined in the ‘email.errors’
module:

 -- 例外: email.errors.MessageError

     これは *note email: 3f. パッケージが送出しうるすべての例外の基底ク
     ラスです。これは標準の *note Exception: bcd. クラスから派生しており
     、追加のメソッドは定義されていません。

 -- 例外: email.errors.MessageParseError

     This is the base class for exceptions raised by the *note Parser:
     13b5. class.  It is derived from *note MessageError: 3b2e.  This
     class is also used internally by the parser used by *note
     headerregistry: 46.

 -- 例外: email.errors.HeaderParseError

     Raised under some error conditions when parsing the RFC 5322(2)
     headers of a message, this class is derived from *note
     MessageParseError: 3b2f.  The *note set_boundary(): 3ad9. method
     will raise this error if the content type is unknown when the
     method is called.  *note Header: 1c5e. may raise this error for
     certain base64 decoding errors, and when an attempt is made to
     create a header that appears to contain an embedded header (that
     is, there is what is supposed to be a continuation line that has no
     leading whitespace and looks like a header).

 -- 例外: email.errors.BoundaryError

     Deprecated and no longer used.

 -- 例外: email.errors.MultipartConversionError

     Raised if the *note attach(): 3aeb. method is called on an instance
     of a class derived from *note MIMENonMultipart: 3b32. (e.g.  *note
     MIMEImage: 3b33.).  *note MultipartConversionError: 3b31. multiply
     inherits from *note MessageError: 3b2e. and the built-in *note
     TypeError: 198.

 -- 例外: email.errors.HeaderWriteError

     Raised when an error occurs when the *note generator: 44. outputs
     headers.

 -- 例外: email.errors.MessageDefect

     This is the base class for all defects found when parsing email
     messages.  It is derived from *note ValueError: 2ec.

 -- 例外: email.errors.HeaderDefect

     This is the base class for all defects found when parsing email
     headers.  It is derived from *note MessageDefect: 3b16.

以下は *note FeedParser: 1785. がメッセージの解析中に検出する障害
(defect) の一覧です。これらの障害は、問題が見つかったメッセージに追加さ
れるため、たとえば ‘multipart/alternative’ 内にあるネストしたメッセージ
が異常なヘッダをもっていた場合には、そのネストしたメッセージが障害を持っ
ているが、その親メッセージには障害はないとみなされることに注意してくださ
い。

すべての障害クラスは *note email.errors.MessageDefect: 3b16. のサブクラ
スです。

 -- 例外: email.errors.NoBoundaryInMultipartDefect

     A message claimed to be a multipart, but had no ‘boundary’
     parameter.

 -- 例外: email.errors.StartBoundaryNotFoundDefect

     The start boundary claimed in the ‘Content-Type’ header was never
     found.

 -- 例外: email.errors.CloseBoundaryNotFoundDefect

     A start boundary was found, but no corresponding close boundary was
     ever found.

     Added in version 3.3.

 -- 例外: email.errors.FirstHeaderLineIsContinuationDefect

     The message had a continuation line as its first header line.

 -- 例外: email.errors.MisplacedEnvelopeHeaderDefect

     A "Unix From" header was found in the middle of a header block.

 -- 例外: email.errors.MissingHeaderBodySeparatorDefect

     A line was found while parsing headers that had no leading white
     space but contained no ':'.  Parsing continues assuming that the
     line represents the first line of the body.

     Added in version 3.3.

 -- 例外: email.errors.MalformedHeaderDefect

     A header was found that was missing a colon, or was otherwise
     malformed.

     バージョン 3.3 で非推奨: この欠陥が使われていないPythonバージョンが
     いくつかあります。

 -- 例外: email.errors.MultipartInvariantViolationDefect

     A message claimed to be a ‘multipart’, but no subparts were found.
     Note that when a message has this defect, its *note is_multipart():
     3ade. method may return ‘False’ even though its content type claims
     to be ‘multipart’.

 -- 例外: email.errors.InvalidBase64PaddingDefect

     When decoding a block of base64 encoded bytes, the padding was not
     correct.  Enough padding is added to perform the decode, but the
     resulting decoded bytes may be invalid.

 -- 例外: email.errors.InvalidBase64CharactersDefect

     When decoding a block of base64 encoded bytes, characters outside
     the base64 alphabet were encountered.  The characters are ignored,
     but the resulting decoded bytes may be invalid.

 -- 例外: email.errors.InvalidBase64LengthDefect

     When decoding a block of base64 encoded bytes, the number of
     non-padding base64 characters was invalid (1 more than a multiple
     of 4).  The encoded block was kept as-is.

 -- 例外: email.errors.InvalidDateDefect

     When decoding an invalid or unparsable date field.  The original
     value is kept as-is.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/email/errors.py

   (2) https://datatracker.ietf.org/doc/html/rfc5322.html


File: python.info,  Node: email headerregistry Custom Header Objects,  Next: email contentmanager Managing MIME Content,  Prev: email errors Exception and Defect classes,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.20.1.9 ‘email.headerregistry’: Custom Header Objects
......................................................

'ソースコード:' Lib/email/headerregistry.py(1)

__________________________________________________________________

Added in version 3.6: (2)

ヘッダーは *note str: 169. のカスタマイズされたサブクラスで表現されます
。 与えられたヘッダーを表現するために使用される特定のクラスは、ヘッダー
が作成されるときに有効な *note policy: 53. の *note header_factory:
3b1c. で決定されます。 このセクションでは、email ライブラリが RFC
5322(3) に準拠したメールメッセージを扱うために実装している、特定の
‘header_factory’ について説明します。このヘッダーは、様々なヘッダータイ
プに対してカスタマイズされたヘッダーオブジェクトを提供するだけでなく、ア
プリケーションが独自のカスタムヘッダータイプを追加できるような拡張メカニ
ズムも備えています。

*note EmailPolicy: 12cb. から派生したポリシーオブジェクトのいずれかを使
用する場合、すべてのヘッダーは *note HeaderRegistry: 3b43. によって生成
され、最終的な基底クラスとして *note BaseHeader: 3ac6. を有します。 各ヘ
ッダクラスには、ヘッダの種類によって決まる追加のベースクラスがあります。
例えば、多くのヘッダーは *note UnstructuredHeader: 3b44. というクラスを
もうひとつの基底クラスとして持っています。 ヘッダーに特化した第二のクラ
スは、ヘッダーの名前によって決定され、 *note HeaderRegistry: 3b43. に格
納されたルックアップテーブルを使用します。 これらすべては、典型的なアプ
リケーションプログラムに対しては透過的に管理されますが、より複雑なアプリ
ケーションで使用するためにデフォルトの動作を変更するためのインタフェース
が提供されています。

以下のセクションでは、まずヘッダーの基本クラスとその属性を説明し、次に
*note HeaderRegistry: 3b43. の動作を変更するための API、そして最後に構造
化ヘッダーからパースされたデータを表現するためのサポートクラスについて説
明します。

 -- クラス: email.headerregistry.BaseHeader (name, value)

     'name' と 'value' は *note header_factory: 3b1c. 呼び出しから
     ‘BaseHeader’ に渡されます。 どのヘッダーオブジェクトの文字列値も、
     完全にユニコードにデコードされた 'value' です。

     基底クラスは以下の読み出し専用属性を定義しています:

      -- の属性: name

          ヘッダーの名前(フィールドの':'の前の部分)。これは *note
          header_factory: 3b1c. の 'name' の呼び出しで渡された値と全く同
          じです; つまり、大文字・小文字が保持されます。

      -- の属性: defects

          パース中に見つかったRFCのコンプライアンス問題を報告する *note
          HeaderDefect: 3b34. インスタンスのタプルです。 email パッケー
          ジはコンプライアンスに関する問題を完全に検出するように努めてい
          ます。 報告されるかもしれない欠陥の種類の議論については、
          *note errors: 43. モジュールを参照してください。

      -- の属性: max_count

          このタイプのヘッダーで、同じ ‘name’ を持つことができる最大数。
          値として ‘None’ を指定すると、無制限になります。 この属性の
          ‘BaseHeader’ の値は ‘None’ です; 特殊な header クラスでは、必
          要に応じてこの値をオーバーライドすることが期待されます。

     ‘BaseHeader’ は以下のメソッドも提供します。このメソッドはemail ライ
     ブラリのコードから呼び出され、一般にアプリケーションプログラムから
     は呼び出されません：

      -- メソッド: fold (*, policy)

          ヘッダを 'policy' に従って正しく折りたたむために必要な *note
          linesep: 3b10. 文字を含む文字列を返します。 ヘッダには任意のバ
          イナリデータを含めることができないため、 *note cte_type: 3b08.
          が ‘8bit’ の場合は ‘7bit’ と同じように扱われます。 もし *note
          utf8: ff9. が ‘False’ であれば、非ASCIIデータは RFC 2047(4) で
          エンコードされます。

     ‘BaseHeader’ 自身はヘッダーオブジェクトを生成するために使用すること
     はできません。このクラスは、それぞれの特殊化ヘッダーがヘッダーオブ
     ジェクトを生成するために協力するプロトコルを定義しています。 具体的
     には、 ‘BaseHeader’ は ‘parse’ という名前の *note classmethod():
     48e. を特殊化されたクラスが提供することを要求しています。このメソッ
     ドは以下のように呼び出されます:

          parse(string, kwds)

     ‘kwds’ は、初期化されたキー ‘defects’ を含む辞書です。‘defects’ は
     空のリストです。 解析メソッドは、検出された不具合をこのリストに追加
     するべきです。 returnの際には、 ‘kwds’ 辞書に少なくとも ‘decoded’ と
     ''defects'' のキーを含む必要があります。 ‘decoded’ はヘッダの文字列
     値 (つまり、ヘッダを Unicode に完全にデコードした値) でなければなり
     ません。 parseメソッドは、 'string' がcontent-transfer-encodedな部
     分を含む可能性があると仮定すべきですが、エンコードされていないヘッ
     ダ値をパースできるように、すべての有効なUnicode文字も正しく処理する
     必要があります。

     その後、 ‘BaseHeader’ の ‘__new__’ がヘッダのインスタンスを生成し、
     ‘init’ メソッドを呼び出します。 特殊クラスは、 ‘BaseHeader’ が提供
     しない属性を設定したい場合にのみ ‘init’ メソッドを提供する必要があ
     ります。 このような''init'' メソッドは以下のようなものです：

          def init(self, /, *args, **kw):
              self._myattr = kw.pop('myattr')
              super().init(*args, **kw)

     つまり、特殊クラスが ‘kwds’ の辞書に追加したものはすべて削除して処
     理し、 ‘kw``の残りの内容 (と ``args’) は''BaseHeader'' の''init'' メ
     ソッドに渡す必要があるのです。

 -- クラス: email.headerregistry.UnstructuredHeader

     "unstructured" ヘッダは RFC 5322(5) におけるデフォルトのヘッダのタ
     イプです。指定された構文を持たないすべてのヘッダは、unstructuredと
     して扱われます。 構造化されていないヘッダの典型的な例は ‘Subject’ ヘ
     ッダです。

     RFC 5322(6) では、非構造化ヘッダは ASCII 文字セットの任意のテキスト
     の集まりです。しかし、 RFC 2047(7) にはヘッダ値の中で非 ASCII テキ
     ストを ASCII 文字としてエンコードするための RFC 5322(8) と互換性の
     あるメカニズムが備わっています。 エンコードされた単語を含む 'value'
     がコンストラクタに渡されると、 ‘UnstructuredHeader’ パーサは非構造
     化テキストに対する RFC 2047(9) 規則に従って、エンコードされた単語を
     unicode に変換します。 パーサは特定の非適合なエンコードされた単語の
     デコードを試みるためにヒューリスティックを使用します。 このような場
     合、欠陥が登録されます。また、エンコードされた単語やエンコードされ
     ていないテキスト内の無効な文字などの問題に対しても欠陥が登録されま
     す。

     このヘッダ型には追加の属性はありません。

 -- クラス: email.headerregistry.DateHeader

     RFC 5322(10) specifies a very specific format for dates within
     email headers.  The ‘DateHeader’ parser recognizes that date
     format, as well as recognizing a number of variant forms that are
     sometimes found "in the wild".

     このヘッダ型は以下の属性も提供しています:

      -- の属性: datetime

          If the header value can be recognized as a valid date of one
          form or another, this attribute will contain a *note datetime:
          4e2. instance representing that date.  If the timezone of the
          input date is specified as ‘-0000’ (indicating it is in UTC
          but contains no information about the source timezone), then
          *note datetime: 3b49. will be a naive *note datetime: 4e2.  If
          a specific timezone offset is found (including ‘+0000’), then
          *note datetime: 3b49. will contain an aware ‘datetime’ that
          uses *note datetime.timezone: 12d5. to record the timezone
          offset.

     ヘッダーの ‘decoded’ 値は、 ‘datetime’ を RFC 5322(11) のルールに従
     ってフォーマットすることで決定されます。

          email.utils.format_datetime(self.datetime)

     ‘DateHeader’ を作成する際に、 'value' は *note datetime: 4e2. イン
     スタンスである可能性があります。 これは、例えば、次のようなコードは
     有効であり、期待通りの動作をすることを意味します:

          msg['Date'] = datetime(2011, 7, 15, 21)

     これは単純な ‘datetime’ であるため、UTC タイムスタンプとして解釈さ
     れ、結果として ‘-0000’ というタイムゾーンを持つ値になります。 もっ
     と便利なのは *note utils: 54. モジュールの *note localtime(): 2f7.
     関数を使用することです:

          msg['Date'] = utils.localtime()

     この例では、現在のタイムゾーンオフセットを使用して、日付ヘッダーを
     現在の時刻と日付に設定します。

 -- クラス: email.headerregistry.AddressHeader

     アドレスヘッダは最も複雑な構造のヘッダタイプの1つです。
     ‘AddressHeader’ クラスは、あらゆるアドレスヘッダに対する汎用的なイ
     ンターフェースを提供します。

     このヘッダ型は以下の属性も提供しています:

      -- の属性: groups

          ヘッダー値に含まれるアドレスとグループをエンコードした *note
          Group: 3b4c. オブジェクトのタプルです。 グループに属さないアド
          レスは、このリストでは *note display_name: 3b4d. が ‘None’ で
          あるシングルアドレスの ‘Groups’ として表現されます。

      -- の属性: addresses

          ヘッダー値に含まれる全ての個別アドレスをエンコードした *note
          Address: 3b4f. オブジェクトのタプルです。 ヘッダ値にグループが
          含まれている場合、そのグループに含まれる個々のアドレスは、ヘッ
          ダ値でグループが出現した時点でリストに含まれます (つまり、アド
          レスのリストは一次元のリストに「フラット化」されます)。

     The ‘decoded’ value of the header will have all encoded words
     decoded to unicode.  *note idna: 56. encoded domain names are also
     decoded to unicode.  The ‘decoded’ value is set by *note joining:
     2655. the *note str: 169. value of the elements of the ‘groups’
     attribute with ‘', '’.

     A list of *note Address: 3b4f. and *note Group: 3b4c. objects in
     any combination may be used to set the value of an address header.
     ‘Group’ objects whose ‘display_name’ is ‘None’ will be interpreted
     as single addresses, which allows an address list to be copied with
     groups intact by using the list obtained from the ‘groups’
     attribute of the source header.

 -- クラス: email.headerregistry.SingleAddressHeader

     追加の属性を 1 つ持つ、*note AddressHeader: 3b4a. の派生クラスです:

      -- の属性: address

          The single address encoded by the header value.  If the header
          value actually contains more than one address (which would be
          a violation of the RFC under the default *note policy: 53.),
          accessing this attribute will result in a *note ValueError:
          2ec.

Many of the above classes also have a ‘Unique’ variant (for example,
‘UniqueUnstructuredHeader’).  The only difference is that in the
‘Unique’ variant, *note max_count: 3b1f. is set to 1.

 -- クラス: email.headerregistry.MIMEVersionHeader

     There is really only one valid value for the ‘MIME-Version’ header,
     and that is ‘1.0’.  For future proofing, this header class supports
     other valid version numbers.  If a version number has a valid value
     per RFC 2045(12), then the header object will have non-‘None’
     values for the following attributes:

      -- の属性: version

          バージョン番号 (文字列)、空白やコメントは除かれます。

      -- の属性: major

          メジャーバージョン番号 (整数)

      -- の属性: minor

          マイナーバージョン番号 (整数)

 -- クラス: email.headerregistry.ParameterizedMIMEHeader

     MIME headers all start with the prefix 'Content-'.  Each specific
     header has a certain value, described under the class for that
     header.  Some can also take a list of supplemental parameters,
     which have a common format.  This class serves as a base for all
     the MIME headers that take parameters.

      -- の属性: params

          A dictionary mapping parameter names to parameter values.

 -- クラス: email.headerregistry.ContentTypeHeader

     ‘Content-Type’ ヘッダを扱う *note ParameterizedMIMEHeader: 3b56. ク
     ラスです。

      -- の属性: content_type

          The content type string, in the form ‘maintype/subtype’.

      -- の属性: maintype

      -- の属性: subtype

 -- クラス: email.headerregistry.ContentDispositionHeader

     ‘Content-Disposition’ ヘッダを扱う *note ParameterizedMIMEHeader:
     3b56. クラスです。

      -- の属性: content_disposition

          ‘inline’ and ‘attachment’ are the only valid values in common
          use.

 -- クラス: email.headerregistry.ContentTransferEncodingHeader

     ‘Content-Transfer-Encoding’ ヘッダを扱います。

      -- の属性: cte

          有効な値は ‘7bit’、‘8bit’、‘base64’、‘quoted-printable’ です。
          詳細については RFC 2045(13) を参照してください。

 -- クラス: email.headerregistry.HeaderRegistry (base_class=BaseHeader,
          default_class=UnstructuredHeader, use_default_map=True)

     This is the factory used by *note EmailPolicy: 12cb. by default.
     ‘HeaderRegistry’ builds the class used to create a header instance
     dynamically, using 'base_class' and a specialized class retrieved
     from a registry that it holds.  When a given header name does not
     appear in the registry, the class specified by 'default_class' is
     used as the specialized class.  When 'use_default_map' is ‘True’
     (the default), the standard mapping of header names to classes is
     copied in to the registry during initialization.  'base_class' is
     always the last class in the generated class's *note __bases__:
     16c5. list.

     デフォルトのマッピング:


          subject: UniqueUnstructuredHeader


          date: UniqueDateHeader


          resent-date: DateHeader


          orig-date: UniqueDateHeader


          sender: UniqueSingleAddressHeader


          resent-sender: SingleAddressHeader


          to: UniqueAddressHeader


          resent-to: AddressHeader


          cc: UniqueAddressHeader


          resent-cc: AddressHeader


          bcc: UniqueAddressHeader


          resent-bcc: AddressHeader


          from: UniqueAddressHeader


          resent-from: AddressHeader


          reply-to: UniqueAddressHeader


          mime-version: MIMEVersionHeader


          content-type: ContentTypeHeader


          content-disposition: ContentDispositionHeader


          content-transfer-encoding: ContentTransferEncodingHeader


          message-id: MessageIDHeader

     ‘HeaderRegistry’ には以下のメソッドがあります:

      -- メソッド: map_to_type (self, name, cls)

          'name' is the name of the header to be mapped.  It will be
          converted to lower case in the registry.  'cls' is the
          specialized class to be used, along with 'base_class', to
          create the class used to instantiate headers that match
          'name'.

      -- メソッド: __getitem__ (name)

          Construct and return a class to handle creating a 'name'
          header.

      -- メソッド: __call__ (name, value)

          Retrieves the specialized header associated with 'name' from
          the registry (using 'default_class' if 'name' does not appear
          in the registry) and composes it with 'base_class' to produce
          a class, calls the constructed class's constructor, passing it
          the same argument list, and finally returns the class instance
          created thereby.

The following classes are the classes used to represent data parsed from
structured headers and can, in general, be used by an application
program to construct structured values to assign to specific headers.

 -- クラス: email.headerregistry.Address (display_name='', username='',
          domain='', addr_spec=None)

     このクラスは電子メールのアドレスを表すのに使われます。アドレスの一
     般的な形式は:

          [display_name] <username@domain>

     もしくは:

          username@domain

     where each part must conform to specific syntax rules spelled out
     in RFC 5322(14).

     As a convenience 'addr_spec' can be specified instead of 'username'
     and 'domain', in which case 'username' and 'domain' will be parsed
     from the 'addr_spec'.  An 'addr_spec' must be a properly RFC quoted
     string; if it is not ‘Address’ will raise an error.  Unicode
     characters are allowed and will be property encoded when
     serialized.  However, per the RFCs, unicode is 'not' allowed in the
     username portion of the address.

      -- の属性: display_name

          The display name portion of the address, if any, with all
          quoting removed.  If the address does not have a display name,
          this attribute will be an empty string.

      -- の属性: username

          アドレスの ‘username’ 部分、クォートは取り除かれます。

      -- の属性: domain

          アドレスの ‘domain’ 部分。

      -- の属性: addr_spec

          The ‘username@domain’ portion of the address, correctly quoted
          for use as a bare address (the second form shown above).  This
          attribute is not mutable.

      -- メソッド: __str__ ()

          The ‘str’ value of the object is the address quoted according
          to RFC 5322(15) rules, but with no Content Transfer Encoding
          of any non-ASCII characters.

     To support SMTP ( RFC 5321(16)), ‘Address’ handles one special
     case: if ‘username’ and ‘domain’ are both the empty string (or
     ‘None’), then the string value of the ‘Address’ is ‘<>’.

 -- クラス: email.headerregistry.Group (display_name=None,
          addresses=None)

     このクラスはアドレスグループを表すのに使われます。アドレスグループ
     の一般的な形式は:

          display_name: [address-list];

     As a convenience for processing lists of addresses that consist of
     a mixture of groups and single addresses, a ‘Group’ may also be
     used to represent single addresses that are not part of a group by
     setting 'display_name' to ‘None’ and providing a list of the single
     address as 'addresses'.

      -- の属性: display_name

          The ‘display_name’ of the group.  If it is ‘None’ and there is
          exactly one ‘Address’ in ‘addresses’, then the ‘Group’
          represents a single address that is not in a group.

      -- の属性: addresses

          A possibly empty tuple of *note Address: 3b4f. objects
          representing the addresses in the group.

      -- メソッド: __str__ ()

          The ‘str’ value of a ‘Group’ is formatted according to RFC
          5322(17), but with no Content Transfer Encoding of any
          non-ASCII characters.  If ‘display_name’ is none and there is
          a single ‘Address’ in the ‘addresses’ list, the ‘str’ value
          will be the same as the ‘str’ of that single ‘Address’.

脚注
....

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/email/headerregistry.py

   (2) Originally added in 3.3 as a *note provisional module: 1243.

   (3) https://datatracker.ietf.org/doc/html/rfc5322.html

   (4) https://datatracker.ietf.org/doc/html/rfc2047.html

   (5) https://datatracker.ietf.org/doc/html/rfc5322.html

   (6) https://datatracker.ietf.org/doc/html/rfc5322.html

   (7) https://datatracker.ietf.org/doc/html/rfc2047.html

   (8) https://datatracker.ietf.org/doc/html/rfc5322.html

   (9) https://datatracker.ietf.org/doc/html/rfc2047.html

   (10) https://datatracker.ietf.org/doc/html/rfc5322.html

   (11) https://datatracker.ietf.org/doc/html/rfc5322.html

   (12) https://datatracker.ietf.org/doc/html/rfc2045.html

   (13) https://datatracker.ietf.org/doc/html/rfc2045.html

   (14) https://datatracker.ietf.org/doc/html/rfc5322.html

   (15) https://datatracker.ietf.org/doc/html/rfc5322.html

   (16) https://datatracker.ietf.org/doc/html/rfc5321.html

   (17) https://datatracker.ietf.org/doc/html/rfc5322.html


File: python.info,  Node: email contentmanager Managing MIME Content,  Next: email 使用例,  Prev: email headerregistry Custom Header Objects,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.20.1.10 ‘email.contentmanager’: Managing MIME Content
.......................................................

'ソースコード:' Lib/email/contentmanager.py(1)

__________________________________________________________________

Added in version 3.6: (2)

 -- クラス: email.contentmanager.ContentManager

     Base class for content managers.  Provides the standard registry
     mechanisms to register converters between MIME content and other
     representations, as well as the ‘get_content’ and ‘set_content’
     dispatch methods.

      -- メソッド: get_content (msg, *args, **kw)

          Look up a handler function based on the ‘mimetype’ of 'msg'
          (see next paragraph), call it, passing through all arguments,
          and return the result of the call.  The expectation is that
          the handler will extract the payload from 'msg' and return an
          object that encodes information about the extracted data.

          To find the handler, look for the following keys in the
          registry, stopping with the first one found:

             * 完全な MIME 型を表す文字列 (‘maintype/subtype’)

             * ‘maintype’ を表す文字列

             * 空の文字列

          If none of these keys produce a handler, raise a *note
          KeyError: 5e7. for the full MIME type.

      -- メソッド: set_content (msg, obj, *args, **kw)

          If the ‘maintype’ is ‘multipart’, raise a *note TypeError:
          198.; otherwise look up a handler function based on the type
          of 'obj' (see next paragraph), call *note clear_content():
          3aef. on the 'msg', and call the handler function, passing
          through all arguments.  The expectation is that the handler
          will transform and store 'obj' into 'msg', possibly making
          other changes to 'msg' as well, such as adding various MIME
          headers to encode information needed to interpret the stored
          data.

          To find the handler, obtain the type of 'obj' (‘typ =
          type(obj)’), and look for the following keys in the registry,
          stopping with the first one found:

             * 型自身 (‘typ’)

             * 型の完全修飾名 (‘typ.__module__ + '.' +
               typ.__qualname__’).

             * the type's *note qualname: 2373. (‘typ.__qualname__’)

             * the type's *note name: 16c4. (‘typ.__name__’).

          If none of the above match, repeat all of the checks above for
          each of the types in the *note MRO: 18dd. (*note typ.__mro__:
          2378.).  Finally, if no other key yields a handler, check for
          a handler for the key ‘None’.  If there is no handler for
          ‘None’, raise a *note KeyError: 5e7. for the fully qualified
          name of the type.

          Also add a ‘MIME-Version’ header if one is not present (see
          also *note MIMEPart: 113d.).

      -- メソッド: add_get_handler (key, handler)

          Record the function 'handler' as the handler for 'key'.  For
          the possible values of 'key', see *note get_content(): 3b6e.

      -- メソッド: add_set_handler (typekey, handler)

          Record 'handler' as the function to call when an object of a
          type matching 'typekey' is passed to *note set_content():
          3b70.  For the possible values of 'typekey', see *note
          set_content(): 3b70.

* Menu:

* Content Manager Instances::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/email/contentmanager.py

   (2) Originally added in 3.4 as a *note provisional module: 1243.


File: python.info,  Node: Content Manager Instances,  Up: email contentmanager Managing MIME Content

5.20.1.11 Content Manager Instances
...................................

Currently the email package provides only one concrete content manager,
*note raw_data_manager: 3b1d, although more may be added in the future.
*note raw_data_manager: 3b1d. is the *note content_manager: 113c.
provided by *note EmailPolicy: 12cb. and its derivatives.

 -- データ: email.contentmanager.raw_data_manager

     This content manager provides only a minimum interface beyond that
     provided by *note Message: 581. itself: it deals only with text,
     raw byte strings, and *note Message: 581. objects.  Nevertheless,
     it provides significant advantages compared to the base API:
     ‘get_content’ on a text part will return a unicode string without
     the application needing to manually decode it, ‘set_content’
     provides a rich set of options for controlling the headers added to
     a part and controlling the content transfer encoding, and it
     enables the use of the various ‘add_’ methods, thereby simplifying
     the creation of multipart messages.

      -- メソッド: email.contentmanager.get_content (msg,
               errors='replace')

          Return the payload of the part as either a string (for ‘text’
          parts), an *note EmailMessage: 580. object (for
          ‘message/rfc822’ parts), or a ‘bytes’ object (for all other
          non-multipart types).  Raise a *note KeyError: 5e7. if called
          on a ‘multipart’.  If the part is a ‘text’ part and 'errors'
          is specified, use it as the error handler when decoding the
          payload to unicode.  The default error handler is ‘replace’.

      -- メソッド: email.contentmanager.set_content (msg, <'str'>,
               subtype="plain", charset='utf-8', cte=None,
               disposition=None, filename=None, cid=None, params=None,
               headers=None)

      -- メソッド: email.contentmanager.set_content (msg, <'bytes'>,
               maintype, subtype, cte="base64", disposition=None,
               filename=None, cid=None, params=None, headers=None)

      -- メソッド: email.contentmanager.set_content (msg,
               <'EmailMessage'>, cte=None, disposition=None,
               filename=None, cid=None, params=None, headers=None)

          Add headers and payload to 'msg':

          Add a ‘Content-Type’ header with a ‘maintype/subtype’ value.

             * For ‘str’, set the MIME ‘maintype’ to ‘text’, and set the
               subtype to 'subtype' if it is specified, or ‘plain’ if it
               is not.

             * For ‘bytes’, use the specified 'maintype' and 'subtype',
               or raise a *note TypeError: 198. if they are not
               specified.

             * For *note EmailMessage: 580. objects, set the maintype to
               ‘message’, and set the subtype to 'subtype' if it is
               specified or ‘rfc822’ if it is not.  If 'subtype' is
               ‘partial’, raise an error (‘bytes’ objects must be used
               to construct ‘message/partial’ parts).

          If 'charset' is provided (which is valid only for ‘str’),
          encode the string to bytes using the specified character set.
          The default is ‘utf-8’.  If the specified 'charset' is a known
          alias for a standard MIME charset name, use the standard
          charset instead.

          If 'cte' is set, encode the payload using the specified
          content transfer encoding, and set the
          ‘Content-Transfer-Encoding’ header to that value.  Possible
          values for 'cte' are ‘quoted-printable’, ‘base64’, ‘7bit’,
          ‘8bit’, and ‘binary’.  If the input cannot be encoded in the
          specified encoding (for example, specifying a 'cte' of ‘7bit’
          for an input that contains non-ASCII values), raise a *note
          ValueError: 2ec.

             * For ‘str’ objects, if 'cte' is not set use heuristics to
               determine the most compact encoding.  Prior to encoding,
               *note str.splitlines(): 146e. is used to normalize all
               line boundaries, ensuring that each line of the payload
               is terminated by the current policy's *note linesep:
               3b10. property (even if the original string did not end
               with one).

             * For ‘bytes’ objects, 'cte' is taken to be base64 if not
               set, and the aforementioned newline translation is not
               performed.

             * For *note EmailMessage: 580, per RFC 2046(1), raise an
               error if a 'cte' of ‘quoted-printable’ or ‘base64’ is
               requested for 'subtype' ‘rfc822’, and for any 'cte' other
               than ‘7bit’ for 'subtype' ‘external-body’.  For
               ‘message/rfc822’, use ‘8bit’ if 'cte' is not specified.
               For all other values of 'subtype', use ‘7bit’.

               注釈: A 'cte' of ‘binary’ does not actually work
               correctly yet.  The ‘EmailMessage’ object as modified by
               ‘set_content’ is correct, but *note BytesGenerator: 13e7.
               does not serialize it correctly.

          If 'disposition' is set, use it as the value of the
          ‘Content-Disposition’ header.  If not specified, and
          'filename' is specified, add the header with the value
          ‘attachment’.  If 'disposition' is not specified and
          'filename' is also not specified, do not add the header.  The
          only valid values for 'disposition' are ‘attachment’ and
          ‘inline’.

          If 'filename' is specified, use it as the value of the
          ‘filename’ parameter of the ‘Content-Disposition’ header.

          If 'cid' is specified, add a ‘Content-ID’ header with 'cid' as
          its value.

          If 'params' is specified, iterate its ‘items’ method and use
          the resulting ‘(key, value)’ pairs to set additional
          parameters on the ‘Content-Type’ header.

          If 'headers' is specified and is a list of strings of the form
          ‘headername: headervalue’ or a list of ‘header’ objects
          (distinguished from strings by having a ‘name’ attribute), add
          the headers to 'msg'.

脚注
....

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2046.html


File: python.info,  Node: email 使用例,  Next: email message Message compat32 API を使用した電子メールメッセージの表現,  Prev: email contentmanager Managing MIME Content,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.20.1.12 ‘email’: 使用例
.........................

ここでは *note email: 3f. パッケージを使って電子メールメッセージを読む・
書く・送信するいくつかの例を紹介します。より複雑な MIME メッセージについ
ても扱います。

最初に、シンプルなテキストメッセージ (テキストコンテンツとアドレスの両方
がユニコード文字を含み得る) を作成・送信する方法を見てみましょう:

     # Import smtplib for the actual sending function
     import smtplib

     # Import the email modules we'll need
     from email.message import EmailMessage

     # Open the plain text file whose name is in textfile for reading.
     with open(textfile) as fp:
         # Create a text/plain message
         msg = EmailMessage()
         msg.set_content(fp.read())

     # me == the sender's email address
     # you == the recipient's email address
     msg['Subject'] = f'The contents of {textfile}'
     msg['From'] = me
     msg['To'] = you

     # Send the message via our own SMTP server.
     s = smtplib.SMTP('localhost')
     s.send_message(msg)
     s.quit()

RFC 822(1) ヘッダーの解析は、 *note parser: 52. モジュールにあるクラスを
使用することにより、簡単に実現できます:

     # Import the email modules we'll need
     #from email.parser import BytesParser
     from email.parser import Parser
     from email.policy import default

     # If the e-mail headers are in a file, uncomment these two lines:
     # with open(messagefile, 'rb') as fp:
     #     headers = BytesParser(policy=default).parse(fp)

     #  Or for parsing headers in a string (this is an uncommon operation), use:
     headers = Parser(policy=default).parsestr(
             'From: Foo Bar <user@example.com>\n'
             'To: <someone_else@example.com>\n'
             'Subject: Test message\n'
             '\n'
             'Body would go here\n')

     #  Now the header items can be accessed as a dictionary:
     print('To: {}'.format(headers['to']))
     print('From: {}'.format(headers['from']))
     print('Subject: {}'.format(headers['subject']))

     # You can also access the parts of the addresses:
     print('Recipient username: {}'.format(headers['to'].addresses[0].username))
     print('Sender name: {}'.format(headers['from'].addresses[0].display_name))

つぎに、あるディレクトリ内にある何枚かの家族写真をひとつの MIME メッセー
ジに収めて送信する例です:

     # Import smtplib for the actual sending function.
     import smtplib

     # Here are the email package modules we'll need.
     from email.message import EmailMessage

     # Create the container email message.
     msg = EmailMessage()
     msg['Subject'] = 'Our family reunion'
     # me == the sender's email address
     # family = the list of all recipients' email addresses
     msg['From'] = me
     msg['To'] = ', '.join(family)
     msg.preamble = 'You will not see this in a MIME-aware mail reader.\n'

     # Open the files in binary mode.  You can also omit the subtype
     # if you want MIMEImage to guess it.
     for file in pngfiles:
         with open(file, 'rb') as fp:
             img_data = fp.read()
         msg.add_attachment(img_data, maintype='image',
                                      subtype='png')

     # Send the email via our own SMTP server.
     with smtplib.SMTP('localhost') as s:
         s.send_message(msg)

つぎはあるディレクトリに含まれている内容全体をひとつの電子メールメッセー
ジとして送信するやり方です: (2)

     #!/usr/bin/env python3

     """Send the contents of a directory as a MIME message."""

     import os
     import smtplib
     # For guessing MIME type based on file name extension
     import mimetypes

     from argparse import ArgumentParser

     from email.message import EmailMessage
     from email.policy import SMTP


     def main():
         parser = ArgumentParser(description="""\
     Send the contents of a directory as a MIME message.
     Unless the -o option is given, the email is sent by forwarding to your local
     SMTP server, which then does the normal delivery process.  Your local machine
     must be running an SMTP server.
     """)
         parser.add_argument('-d', '--directory',
                             help="""Mail the contents of the specified directory,
                             otherwise use the current directory.  Only the regular
                             files in the directory are sent, and we don't recurse to
                             subdirectories.""")
         parser.add_argument('-o', '--output',
                             metavar='FILE',
                             help="""Print the composed message to FILE instead of
                             sending the message to the SMTP server.""")
         parser.add_argument('-s', '--sender', required=True,
                             help='The value of the From: header (required)')
         parser.add_argument('-r', '--recipient', required=True,
                             action='append', metavar='RECIPIENT',
                             default=[], dest='recipients',
                             help='A To: header value (at least one required)')
         args = parser.parse_args()
         directory = args.directory
         if not directory:
             directory = '.'
         # Create the message
         msg = EmailMessage()
         msg['Subject'] = f'Contents of directory {os.path.abspath(directory)}'
         msg['To'] = ', '.join(args.recipients)
         msg['From'] = args.sender
         msg.preamble = 'You will not see this in a MIME-aware mail reader.\n'

         for filename in os.listdir(directory):
             path = os.path.join(directory, filename)
             if not os.path.isfile(path):
                 continue
             # Guess the content type based on the file's extension.  Encoding
             # will be ignored, although we should check for simple things like
             # gzip'd or compressed files.
             ctype, encoding = mimetypes.guess_file_type(path)
             if ctype is None or encoding is not None:
                 # No guess could be made, or the file is encoded (compressed), so
                 # use a generic bag-of-bits type.
                 ctype = 'application/octet-stream'
             maintype, subtype = ctype.split('/', 1)
             with open(path, 'rb') as fp:
                 msg.add_attachment(fp.read(),
                                    maintype=maintype,
                                    subtype=subtype,
                                    filename=filename)
         # Now send or store the message
         if args.output:
             with open(args.output, 'wb') as fp:
                 fp.write(msg.as_bytes(policy=SMTP))
         else:
             with smtplib.SMTP('localhost') as s:
                 s.send_message(msg)


     if __name__ == '__main__':
         main()

つぎに、上のような MIME メッセージをどうやって展開してひとつのディレクト
リ上の複数ファイルにするかを示します:

     #!/usr/bin/env python3

     """Unpack a MIME message into a directory of files."""

     import os
     import email
     import mimetypes

     from email.policy import default

     from argparse import ArgumentParser


     def main():
         parser = ArgumentParser(description="""\
     Unpack a MIME message into a directory of files.
     """)
         parser.add_argument('-d', '--directory', required=True,
                             help="""Unpack the MIME message into the named
                             directory, which will be created if it doesn't already
                             exist.""")
         parser.add_argument('msgfile')
         args = parser.parse_args()

         with open(args.msgfile, 'rb') as fp:
             msg = email.message_from_binary_file(fp, policy=default)

         try:
             os.mkdir(args.directory)
         except FileExistsError:
             pass

         counter = 1
         for part in msg.walk():
             # multipart/* are just containers
             if part.get_content_maintype() == 'multipart':
                 continue
             # Applications should really sanitize the given filename so that an
             # email message can't be used to overwrite important files
             filename = part.get_filename()
             if not filename:
                 ext = mimetypes.guess_extension(part.get_content_type())
                 if not ext:
                     # Use a generic bag-of-bits extension
                     ext = '.bin'
                 filename = f'part-{counter:03d}{ext}'
             counter += 1
             with open(os.path.join(args.directory, filename), 'wb') as fp:
                 fp.write(part.get_payload(decode=True))


     if __name__ == '__main__':
         main()

代替のプレーンテキストバージョン付きの HTML メッセージを作成する方法の例
です。もう少し面白くするために、 HTML 部分に関連する画像を追加し、さらに
送信だけでなく、送信しようとしているもののコピーをディスクにも保存してみ
ます。

     #!/usr/bin/env python3

     import smtplib

     from email.message import EmailMessage
     from email.headerregistry import Address
     from email.utils import make_msgid

     # Create the base text message.
     msg = EmailMessage()
     msg['Subject'] = "Pourquoi pas des asperges pour ce midi ?"
     msg['From'] = Address("Pepé Le Pew", "pepe", "example.com")
     msg['To'] = (Address("Penelope Pussycat", "penelope", "example.com"),
                  Address("Fabrette Pussycat", "fabrette", "example.com"))
     msg.set_content("""\
     Salut!

     Cette recette [1] sera sûrement un très bon repas.

     [1] http://www.yummly.com/recipe/Roasted-Asparagus-Epicurious-203718

     --Pepé
     """)

     # Add the html version.  This converts the message into a multipart/alternative
     # container, with the original text message as the first part and the new html
     # message as the second part.
     asparagus_cid = make_msgid()
     msg.add_alternative("""\
     <html>
       <head></head>
       <body>
         <p>Salut!</p>
         <p>Cette
             <a href="http://www.yummly.com/recipe/Roasted-Asparagus-Epicurious-203718">
                 recette
             </a> sera sûrement un très bon repas.
         </p>
         <img src="cid:{asparagus_cid}">
       </body>
     </html>
     """.format(asparagus_cid=asparagus_cid[1:-1]), subtype='html')
     # note that we needed to peel the <> off the msgid for use in the html.

     # Now add the related image to the html part.
     with open("roasted-asparagus.jpg", 'rb') as img:
         msg.get_payload()[1].add_related(img.read(), 'image', 'jpeg',
                                          cid=asparagus_cid)

     # Make a local copy of what we are going to send.
     with open('outgoing.msg', 'wb') as f:
         f.write(bytes(msg))

     # Send the message via local SMTP server.
     with smtplib.SMTP('localhost') as s:
         s.send_message(msg)

前の例のメッセージが送信されてきたら、これを処理する方法の一つは次のよう
なものです:

     import os
     import sys
     import tempfile
     import mimetypes
     import webbrowser

     # Import the email modules we'll need
     from email import policy
     from email.parser import BytesParser


     def magic_html_parser(html_text, partfiles):
         """Return safety-sanitized html linked to partfiles.

         Rewrite the href="cid:...." attributes to point to the filenames in partfiles.
         Though not trivial, this should be possible using html.parser.
         """
         raise NotImplementedError("Add the magic needed")


     # In a real program you'd get the filename from the arguments.
     with open('outgoing.msg', 'rb') as fp:
         msg = BytesParser(policy=policy.default).parse(fp)

     # Now the header items can be accessed as a dictionary, and any non-ASCII will
     # be converted to unicode:
     print('To:', msg['to'])
     print('From:', msg['from'])
     print('Subject:', msg['subject'])

     # If we want to print a preview of the message content, we can extract whatever
     # the least formatted payload is and print the first three lines.  Of course,
     # if the message has no plain text part printing the first three lines of html
     # is probably useless, but this is just a conceptual example.
     simplest = msg.get_body(preferencelist=('plain', 'html'))
     print()
     print(''.join(simplest.get_content().splitlines(keepends=True)[:3]))

     ans = input("View full message?")
     if ans.lower()[0] == 'n':
         sys.exit()

     # We can extract the richest alternative in order to display it:
     richest = msg.get_body()
     partfiles = {}
     if richest['content-type'].maintype == 'text':
         if richest['content-type'].subtype == 'plain':
             for line in richest.get_content().splitlines():
                 print(line)
             sys.exit()
         elif richest['content-type'].subtype == 'html':
             body = richest
         else:
             print("Don't know how to display {}".format(richest.get_content_type()))
             sys.exit()
     elif richest['content-type'].content_type == 'multipart/related':
         body = richest.get_body(preferencelist=('html'))
         for part in richest.iter_attachments():
             fn = part.get_filename()
             if fn:
                 extension = os.path.splitext(part.get_filename())[1]
             else:
                 extension = mimetypes.guess_extension(part.get_content_type())
             with tempfile.NamedTemporaryFile(suffix=extension, delete=False) as f:
                 f.write(part.get_content())
                 # again strip the <> to go from email form of cid to html form.
                 partfiles[part['content-id'][1:-1]] = f.name
     else:
         print("Don't know how to display {}".format(richest.get_content_type()))
         sys.exit()
     with tempfile.NamedTemporaryFile(mode='w', delete=False) as f:
         f.write(magic_html_parser(body.get_content(), partfiles))
     webbrowser.open(f.name)
     os.remove(f.name)
     for fn in partfiles.values():
         os.remove(fn)

     # Of course, there are lots of email messages that could break this simple
     # minded program, but it will handle the most common ones.

プロンプトまでの、上記のプログラムの出力はこうなります:

     To: Penelope Pussycat <penelope@example.com>, Fabrette Pussycat <fabrette@example.com>
     From: Pepé Le Pew <pepe@example.com>
     Subject: Pourquoi pas des asperges pour ce midi ?

     Salut!

     Cette recette [1] sera sûrement un très bon repas.

脚注
....

レガシーAPI:

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc822.html

   (2) 最初の思いつきと用例は Matthew Dixon Cowles のおかげです。


File: python.info,  Node: email message Message compat32 API を使用した電子メールメッセージの表現,  Next: email mime Creating email and MIME objects from scratch,  Prev: email 使用例,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.20.1.13 ‘email.message.Message’: ‘compat32’ API を使用した電子メールメッセージの表現
......................................................................................

The *note Message: 581. class is very similar to the *note EmailMessage:
580. class, without the methods added by that class, and with the
default behavior of certain other methods being slightly different.  We
also document here some methods that, while supported by the *note
EmailMessage: 580. class, are not recommended unless you are dealing
with legacy code.

The philosophy and structure of the two classes is otherwise the same.

This document describes the behavior under the default (for *note
Message: 581.) policy *note Compat32: 12c8.  If you are going to use
another policy, you should be using the *note EmailMessage: 580. class
instead.

An email message consists of 'headers' and a 'payload'.  Headers must be
RFC 5322(1) style names and values, where the field name and value are
separated by a colon.  The colon is not part of either the field name or
the field value.  The payload may be a simple text message, or a binary
object, or a structured sequence of sub-messages each with their own set
of headers and their own payload.  The latter type of payload is
indicated by the message having a MIME type such as ‘multipart/*’ or
‘message/rfc822’.

The conceptual model provided by a *note Message: 581. object is that of
an ordered dictionary of headers with additional methods for accessing
both specialized information from the headers, for accessing the
payload, for generating a serialized version of the message, and for
recursively walking over the object tree.  Note that duplicate headers
are supported but special methods must be used to access them.

The *note Message: 581. pseudo-dictionary is indexed by the header
names, which must be ASCII values.  The values of the dictionary are
strings that are supposed to contain only ASCII characters; there is
some special handling for non-ASCII input, but it doesn't always produce
the correct results.  Headers are stored and returned in case-preserving
form, but field names are matched case-insensitively.  There may also be
a single envelope header, also known as the 'Unix-From' header or the
‘From_’ header.  The 'payload' is either a string or bytes, in the case
of simple message objects, or a list of *note Message: 581. objects, for
MIME container documents (e.g.  ‘multipart/*’ and ‘message/rfc822’).

*note Message: 581. クラスのメソッドは以下のとおりです:

 -- クラス: email.message.Message (policy=compat32)

     If 'policy' is specified (it must be an instance of a *note policy:
     53. class) use the rules it specifies to update and serialize the
     representation of the message.  If 'policy' is not set, use the
     *note compat32: 12c8. policy, which maintains backward
     compatibility with the Python 3.2 version of the email package.
     For more information see the *note policy: 53. documentation.

     バージョン 3.3 で変更: キーワード引数 'policy' が追加されました。

      -- メソッド: as_string (unixfrom=False, maxheaderlen=0,
               policy=None)

          Return the entire message flattened as a string.  When
          optional 'unixfrom' is true, the envelope header is included
          in the returned string.  'unixfrom' defaults to ‘False’.  For
          backward compatibility reasons, 'maxheaderlen' defaults to
          ‘0’, so if you want a different value you must override it
          explicitly (the value specified for 'max_line_length' in the
          policy will be ignored by this method).  The 'policy' argument
          may be used to override the default policy obtained from the
          message instance.  This can be used to control some of the
          formatting produced by the method, since the specified
          'policy' will be passed to the ‘Generator’.

          もし、文字列への変換を完全に行うためにデフォルト値を埋める必要
          がある場合、メッセージのフラット化は *note Message: 581. の変
          更を引き起こす可能性があります (例えば、MIME の境界が生成され
          る、変更される等)。

          Note that this method is provided as a convenience and may not
          always format the message the way you want.  For example, by
          default it does not do the mangling of lines that begin with
          ‘From’ that is required by the Unix mbox format.  For more
          flexibility, instantiate a *note Generator: 13e6. instance and
          use its *note flatten(): 3b0a. method directly.  For example:

               from io import StringIO
               from email.generator import Generator
               fp = StringIO()
               g = Generator(fp, mangle_from_=True, maxheaderlen=60)
               g.flatten(msg)
               text = fp.getvalue()

          If the message object contains binary data that is not encoded
          according to RFC standards, the non-compliant data will be
          replaced by unicode "unknown character" code points.  (See
          also *note as_bytes(): 1139. and *note BytesGenerator: 13e7.)

          バージョン 3.4 で変更: 'policy' キーワード引数が追加されました
          。

      -- メソッド: __str__ ()

          Equivalent to *note as_string(): 1138.  Allows ‘str(msg)’ to
          produce a string containing the formatted message.

      -- メソッド: as_bytes (unixfrom=False, policy=None)

          Return the entire message flattened as a bytes object.  When
          optional 'unixfrom' is true, the envelope header is included
          in the returned string.  'unixfrom' defaults to ‘False’.  The
          'policy' argument may be used to override the default policy
          obtained from the message instance.  This can be used to
          control some of the formatting produced by the method, since
          the specified 'policy' will be passed to the ‘BytesGenerator’.

          もし、文字列への変換を完全に行うためにデフォルト値を埋める必要
          がある場合、メッセージのフラット化は *note Message: 581. の変
          更を引き起こす可能性があります (例えば、MIME の境界が生成され
          る、変更される等)。

          Note that this method is provided as a convenience and may not
          always format the message the way you want.  For example, by
          default it does not do the mangling of lines that begin with
          ‘From’ that is required by the Unix mbox format.  For more
          flexibility, instantiate a *note BytesGenerator: 13e7.
          instance and use its *note flatten(): 3b06. method directly.
          For example:

               from io import BytesIO
               from email.generator import BytesGenerator
               fp = BytesIO()
               g = BytesGenerator(fp, mangle_from_=True, maxheaderlen=60)
               g.flatten(msg)
               text = fp.getvalue()

          Added in version 3.4.

      -- メソッド: __bytes__ ()

          Equivalent to *note as_bytes(): 1139.  Allows ‘bytes(msg)’ to
          produce a bytes object containing the formatted message.

          Added in version 3.4.

      -- メソッド: is_multipart ()

          Return ‘True’ if the message's payload is a list of sub-*note
          Message: 581. objects, otherwise return ‘False’.  When *note
          is_multipart(): 3ade. returns ‘False’, the payload should be a
          string object (which might be a CTE encoded binary payload).
          (Note that *note is_multipart(): 3ade. returning ‘True’ does
          not necessarily mean that "msg.get_content_maintype() ==
          'multipart'" will return the ‘True’.  For example,
          ‘is_multipart’ will return ‘True’ when the *note Message: 581.
          is of type ‘message/rfc822’.)

      -- メソッド: set_unixfrom (unixfrom)

          メッセージのエンベロープヘッダを 'unixfrom' に設定します。これ
          は文字列でなければなりません。

      -- メソッド: get_unixfrom ()

          メッセージのエンベロープヘッダを返します。エンベロープヘッダが
          設定されていない場合は ‘None’ が返されます。

      -- メソッド: attach (payload)

          与えられた 'payload' を現在のペイロードに追加します。この時点
          でのペイロードは ‘None’ か、あるいは *note Message: 581. オブ
          ジェクトのリストである必要があります。このメソッドの実行後、ペ
          イロードは必ず *note Message: 581. オブジェクトのリストになり
          ます。ペイロードにスカラーオブジェクト (文字列など) を格納した
          い場合は、かわりに *note set_payload(): 3b7b. を使ってください
          。

          This is a legacy method.  On the *note EmailMessage: 580.
          class its functionality is replaced by *note set_content():
          1c5d. and the related ‘make’ and ‘add’ methods.

      -- メソッド: get_payload (i=None, decode=False)

          現在のペイロードへの参照を返します。これは *note
          is_multipart(): 3ade. が ‘True’ の場合 *note Message: 581. オ
          ブジェクトのリストになり、 *note is_multipart(): 3ade. が
          ‘False’ の場合は文字列になります。ペイロードがリストの場合、リ
          ストを変更することはそのメッセージのペイロードを変更することに
          なります。

          オプション引数の 'i' がある場合、 *note is_multipart(): 3ade.
          が ‘True’ ならば *note get_payload(): 13e5. はペイロード中で 0
          から数えて 'i' 番目の要素を返します。 'i' が 0 より小さい場合
          、あるいはペイロードの個数以上の場合は *note IndexError: 174e.
          が発生します。ペイロードが文字列 (つまり *note is_multipart():
          3ade. が ‘False’) にもかかわらず 'i' が与えられたときは *note
          TypeError: 198. が発生します。

          Optional 'decode' is a flag indicating whether the payload
          should be decoded or not, according to the
          ‘Content-Transfer-Encoding’ header.  When ‘True’ and the
          message is not a multipart, the payload will be decoded if
          this header's value is ‘quoted-printable’ or ‘base64’.  If
          some other encoding is used, or ‘Content-Transfer-Encoding’
          header is missing, the payload is returned as-is (undecoded).
          In all cases the returned value is binary data.  If the
          message is a multipart and the 'decode' flag is ‘True’, then
          ‘None’ is returned.  If the payload is base64 and it was not
          perfectly formed (missing padding, characters outside the
          base64 alphabet), then an appropriate defect will be added to
          the message's defect property (*note
          InvalidBase64PaddingDefect: 3b3c. or *note
          InvalidBase64CharactersDefect: 3b3d, respectively).

          When 'decode' is ‘False’ (the default) the body is returned as
          a string without decoding the ‘Content-Transfer-Encoding’.
          However, for a ‘Content-Transfer-Encoding’ of 8bit, an attempt
          is made to decode the original bytes using the ‘charset’
          specified by the ‘Content-Type’ header, using the ‘replace’
          error handler.  If no ‘charset’ is specified, or if the
          ‘charset’ given is not recognized by the email package, the
          body is decoded using the default ASCII charset.

          This is a legacy method.  On the *note EmailMessage: 580.
          class its functionality is replaced by *note get_content():
          3ae4. and *note iter_parts(): 3ae3.

      -- メソッド: set_payload (payload, charset=None)

          メッセージオブジェクト全体のペイロードを 'payload' に設定しま
          す。クライアントはペイロードを変更してはいけません。オプション
          の 'charset' はメッセージのデフォルト文字セットを設定します。
          詳しくは *note set_charset(): 3b7c. を参照してください。

          This is a legacy method.  On the *note EmailMessage: 580.
          class its functionality is replaced by *note set_content():
          1c5d.

      -- メソッド: set_charset (charset)

          ペイロードの文字セットを 'charset' に変更します。これは *note
          Charset: ffb. インスタンス (*note email.charset: 40. 参照)、文
          字セット名を表す文字列、あるいは ‘None’ のいずれかです。文字列
          を指定した場合は *note Charset: ffb. インスタンスに変換されま
          す。 'charset' が ‘None’ の場合、 ‘charset’ 引数は
          ‘Content-Type’ ヘッダから除去されます (それ以外にメッセージは
          変更されません)。これら以外のものを文字セットとして指定した場
          合、 *note TypeError: 198. を送出します。

          ‘MIME-Version’ ヘッダが存在しなければ、追加されます。
          ‘Content-Type’ ヘッダが存在しなければ、 ‘text/plain’ を値とし
          て追加されます。 ‘Content-Type’ が存在していてもいなくても、
          ‘charset’ パラメタは 'charset.output_charset' に設定されます。
          'charset.input_charset' と 'charset.output_charset' が異なるな
          ら、ペイロードは 'output_charset' に再エンコードされます。
          ‘Content-Transfer-Encoding’ ヘッダが存在しなければ、ペイロード
          は、必要なら指定された *note Charset: ffb. を使って transfer エ
          ンコードされ、適切な値のヘッダが追加されます。
          ‘Content-Transfer-Encoding’ ヘッダがすでに存在すれば、ペイロー
          ドはすでにその ‘Content-Transfer-Encoding’ によって正しくエン
          コードされたものと見なされ、変形されません。

          This is a legacy method.  On the *note EmailMessage: 580.
          class its functionality is replaced by the 'charset' parameter
          of the *note email.message.EmailMessage.set_content(): 1c5d.
          method.

      -- メソッド: get_charset ()

          そのメッセージ中のペイロードの *note Charset: ffb. インスタン
          スを返します。

          This is a legacy method.  On the *note EmailMessage: 580.
          class it always returns ‘None’.

     以下のメソッドは、メッセージの RFC 2822(2) ヘッダにアクセスするため
     のマップ (辞書) 形式のインタフェイスを実装したものです。これらのメ
     ソッドと、通常のマップ (辞書) 型はまったく同じ意味をもつわけではな
     いことに注意してください。たとえば辞書型では、同じキーが複数あるこ
     とは許されていませんが、ここでは同じメッセージヘッダが複数ある場合
     があります。また、辞書型では *note keys(): 3b7e. で返されるキーの順
     序は保証されていませんが、 *note Message: 581. オブジェクト内のヘッ
     ダはつねに元のメッセージ中に現れた順序、あるいはそのあとに追加され
     た順序で返されます。削除され、その後ふたたび追加されたヘッダはリス
     トの一番最後に現れます。

     こういった意味のちがいは意図的なもので、最大の利便性をもつようにつ
     くられています。

     注意: どんな場合も、メッセージ中のエンベロープヘッダはこのマップ形
     式のインタフェイスには含まれません。

     In a model generated from bytes, any header values that (in
     contravention of the RFCs) contain non-ASCII bytes will, when
     retrieved through this interface, be represented as *note Header:
     1c5e. objects with a charset of ‘unknown-8bit’.

      -- メソッド: __len__ ()

          複製されたものもふくめてヘッダ数の合計を返します。

      -- メソッド: __contains__ (name)

          メッセージオブジェクトが 'name' という名前のフィールドを持って
          いれば ‘True’ を返します。この検査では名前の大文字小文字は区別
          されません。'name' は最後にコロンをふくんでいてはいけません。
          このメソッドは以下のように ‘in’ 演算子で使われます:

               if 'message-id' in myMessage:
                  print('Message-ID:', myMessage['message-id'])

      -- メソッド: __getitem__ (name)

          指定された名前のヘッダフィールドの値を返します。 'name' は最後
          にコロンをふくんでいてはいけません。そのヘッダがない場合は
          ‘None’ が返され、 *note KeyError: 5e7. 例外は発生しません。

          注意: 指定された名前のフィールドがメッセージのヘッダに2回以上
          現れている場合、どちらの値が返されるかは未定義です。ヘッダに存
          在するフィールドの値をすべて取り出したい場合は *note
          get_all(): 3b81. メソッドを使ってください。

      -- メソッド: __setitem__ (name, val)

          メッセージヘッダに 'name' という名前の 'val' という値をもつフ
          ィールドをあらたに追加します。このフィールドは現在メッセージに
          存在するフィールドのいちばん後に追加されます。

          注意: このメソッドでは、すでに同一の名前で存在するフィールドは
          上書き 'されません'。もしメッセージが名前 'name' をもつフィー
          ルドをひとつしか持たないようにしたければ、最初にそれを除去して
          ください。たとえば:

               del msg['subject']
               msg['subject'] = 'Python roolz!'

      -- メソッド: __delitem__ (name)

          メッセージのヘッダから、'name' という名前をもつフィールドをす
          べて除去します。たとえこの名前をもつヘッダが存在していなくても
          例外は発生しません。

      -- メソッド: keys ()

          メッセージ中にあるすべてのヘッダのフィールド名のリストを返しま
          す。

      -- メソッド: values ()

          メッセージ中にあるすべてのフィールドの値のリストを返します。

      -- メソッド: items ()

          メッセージ中にあるすべてのヘッダのフィールド名とその値を 2-タ
          プルのリストとして返します。

      -- メソッド: get (name, failobj=None)

          Return the value of the named header field.  This is identical
          to *note __getitem__(): 588. except that optional 'failobj' is
          returned if the named header is missing (defaults to ‘None’).

     さらに、役に立つメソッドをいくつか紹介します:

      -- メソッド: get_all (name, failobj=None)

          'name' の名前をもつフィールドのすべての値からなるリストを返し
          ます。該当する名前のヘッダがメッセージ中に含まれていない場合は
          'failobj' (デフォルトでは ‘None’) が返されます。

      -- メソッド: add_header (_name, _value, **_params)

          拡張ヘッダ設定。このメソッドは *note __setitem__(): 187d. と似
          ていますが、追加のヘッダ・パラメータをキーワード引数で指定でき
          るところが違っています。 '_name' に追加するヘッダフィールドを
          、 '_value' にそのヘッダの '最初の' 値を渡します。

          キーワード引数辞書 '_params' の各項目ごとに、そのキーがパラメ
          ータ名として扱われ、キー名にふくまれるアンダースコアはハイフン
          に置換されます (アンダースコアは、Python 識別子としてハイフン
          を使えないための代替です)。ふつう、パラメータの値が ‘None’ 以
          外のときは、 ‘key="value"’ の形で追加されます。パラメータの値
          が ‘None’ のときはキーのみが追加されます。値が非 ASCII 文字を
          含むなら、それは ‘(CHARSET, LANGUAGE, VALUE)’ の形式の 3 タプ
          ルにすることが出来ます。ここで ‘CHARSET’ はその値をエンコード
          するのに使われる文字セットを指示する文字列で、 ‘LANGUAGE’ は通
          常 ‘None’ か空文字列にでき (これら以外で指定出来るものについて
          は RFC 2231(3) を参照してください)、 ‘VALUE’ は非 ASCII コード
          ポイントを含む文字列値です。この 3 タプルではなく非 ASCII 文字
          を含む値が渡された場合は、 ‘CHARSET’ に ‘utf-8’ 、 ‘LANGUAGE’
          に ‘None’ を使って RFC 2231(4) 形式に自動的にエンコードされま
          す。

          以下はこの使用例です:

               msg.add_header('Content-Disposition', 'attachment', filename='bud.gif')

          こうするとヘッダには以下のように追加されます

               Content-Disposition: attachment; filename="bud.gif"

          非 ASCII 文字を使った例:

               msg.add_header('Content-Disposition', 'attachment',
                              filename=('iso-8859-1', '', 'Fußballer.ppt'))

          は、以下のようになります

               Content-Disposition: attachment; filename*="iso-8859-1''Fu%DFballer.ppt"

      -- メソッド: replace_header (_name, _value)

          ヘッダの置換。 '_name' と一致するヘッダで最初に見つかったもの
          を置き換えます。このときヘッダの順序とフィールド名の大文字小文
          字は保存されます。一致するヘッダがない場合、 *note KeyError:
          5e7. が発生します。

      -- メソッド: get_content_type ()

          そのメッセージの content-type を返します。返された文字列は強制
          的に小文字で ‘maintype/subtype’ の形式に変換されます。メッセー
          ジ中に ‘Content-Type’ ヘッダがない場合、デフォルトの
          content-type は *note get_default_type(): 3b88. が返す値によっ
          て与えられます。 RFC 2045(5) によればメッセージはつねにデフォ
          ルトの content-type をもっているので、 *note
          get_content_type(): 3b87. はつねになんらかの値を返すはずです。

          RFC 2045(6) はメッセージのデフォルト content-type を、それが
          ‘multipart/digest’ コンテナに現れているとき以外は ‘text/plain’
          に規定しています。あるメッセージが ‘multipart/digest’ コンテナ
          中にある場合、その content-type は ‘message/rfc822’ になります
          。もし ‘Content-Type’ ヘッダが適切でない content-type 書式だっ
          た場合、 RFC 2045(7) はそれのデフォルトを ‘text/plain’ として
          扱うよう定めています。

      -- メソッド: get_content_maintype ()

          そのメッセージの主 content-type を返します。これは *note
          get_content_type(): 3b87. によって返される文字列の ‘maintype’
          部分です。

      -- メソッド: get_content_subtype ()

          そのメッセージの副 content-type (sub content-type、subtype) を
          返します。これは *note get_content_type(): 3b87. によって返さ
          れる文字列の ‘subtype’ 部分です。

      -- メソッド: get_default_type ()

          デフォルトの content-type を返します。ほどんどのメッセージでは
          デフォルトの content-type は ‘text/plain’ ですが、メッセージが
          ‘multipart/digest’ コンテナに含まれているときだけ例外的に
          ‘message/rfc822’ になります。

      -- メソッド: set_default_type (ctype)

          デフォルトの content-type を設定します。 'ctype' は
          ‘text/plain’ あるいは ‘message/rfc822’ である必要がありますが
          、強制ではありません。デフォルトの content-type はヘッダの
          ‘Content-Type’ には格納されません。

      -- メソッド: get_params (failobj=None, header='content-type',
               unquote=True)

          メッセージの ‘Content-Type’ パラメータをリストとして返します。
          返されるリストはキー/値の組からなる2要素タプルが連なったもので
          あり、これらは ‘'='’ 記号で分離されています。 ‘'='’ の左側はキ
          ーになり、右側は値になります。パラメータ中に ‘'='’ がなかった
          場合、値の部分は空文字列になり、そうでなければその値は *note
          get_param(): 3b8d. で説明されている形式になります。また、オプ
          ション引数 'unquote' が ‘True’ (デフォルト) である場合、この値
          は unquote されます。

          オプション引数 'failobj' は、 ‘Content-Type’ ヘッダが存在しな
          かった場合に返すオブジェクトです。オプション引数 'header' には
          ‘Content-Type’ のかわりに検索すべきヘッダを指定します。

          This is a legacy method.  On the *note EmailMessage: 580.
          class its functionality is replaced by the 'params' property
          of the individual header objects returned by the header access
          methods.

      -- メソッド: get_param (param, failobj=None,
               header='content-type', unquote=True)

          メッセージの ‘Content-Type’ ヘッダ中のパラメータ 'param' を文
          字列として返します。そのメッセージ中に ‘Content-Type’ ヘッダが
          存在しなかった場合、 'failobj' (デフォルトは ‘None’) が返され
          ます。

          オプション引数 'header' が与えられた場合、 ‘Content-Type’ のか
          わりにそのヘッダが使用されます。

          パラメータのキー比較は常に大文字小文字を区別しません。返り値は
          文字列か 3 要素のタプルで、タプルになるのはパラメータが RFC
          2231(8) エンコードされている場合です。3 要素タプルの場合、各要
          素の値は ‘(CHARSET, LANGUAGE, VALUE)’ の形式になっています。
          ‘CHARSET’ と ‘LAGUAGE’ は ‘None’ になることがあり、その場合
          ‘VALUE’ は ‘us-ascii’ 文字セットでエンコードされているとみなさ
          なければならないので注意してください。普段は ‘LANGUAGE’ を無視
          できます。

          この関数を使うアプリケーションが、パラメータが RFC 2231(9) 形
          式でエンコードされているかどうかを気にしないのであれば、 *note
          email.utils.collapse_rfc2231_value(): 3b8e. に *note
          get_param(): 3b8d. の返り値を渡して呼び出すことで、このパラメ
          ータをひとつにまとめることができます。この値がタプルならばこの
          関数は適切にデコードされた Unicode 文字列を返し、そうでない場
          合は unquote された元の文字列を返します。たとえば:

               rawparam = msg.get_param('foo')
               param = email.utils.collapse_rfc2231_value(rawparam)

          いずれの場合もパラメータの値は (文字列であれ3要素タプルの
          ‘VALUE’ 項目であれ) つねに unquote されます。ただし、'unquote'
          が ‘False’ に指定されている場合は unquote されません。

          This is a legacy method.  On the *note EmailMessage: 580.
          class its functionality is replaced by the 'params' property
          of the individual header objects returned by the header access
          methods.

      -- メソッド: set_param (param, value, header='Content-Type',
               requote=True, charset=None, language='', replace=False)

          ‘Content-Type’ ヘッダ中のパラメータを設定します。指定されたパ
          ラメータがヘッダ中にすでに存在する場合、その値は 'value' に置
          き換えられます。 ‘Content-Type’ ヘッダがまだこのメッセージ中に
          存在していない場合、 RFC 2045(10) にしたがいこの値には
          ‘text/plain’ が設定され、新しいパラメータ値が末尾に追加されま
          す。

          オプション引数 'header' が与えられた場合、 ‘Content-Type’ のか
          わりにそのヘッダが使用されます。オプション引数 'requote' が
          ‘False’ でない限り、この値は quote されます (デフォルトは
          ‘True’)。

          オプション引数 'charset' が与えられると、そのパラメータは RFC
          2231(11) に従ってエンコードされます。オプション引数 'language'
          は RFC 2231 の言語を指定しますが、デフォルトではこれは空文字列
          となります。 'charset' と 'language' はどちらも文字列である必
          要があります。

          If 'replace' is ‘False’ (the default) the header is moved to
          the end of the list of headers.  If 'replace' is ‘True’, the
          header will be updated in place.

          バージョン 3.4 で変更: ‘replace’ キーワードが追加されました。

      -- メソッド: del_param (param, header='content-type',
               requote=True)

          指定されたパラメータを ‘Content-Type’ ヘッダ中から完全にとりの
          ぞきます。ヘッダはそのパラメータと値がない状態に書き換えられま
          す。 'requote' が ‘False’ でない限り (デフォルトでは ‘True’ で
          す)、すべての値は必要に応じて quote されます。オプション変数
          'header' が与えられた場合、 ‘Content-Type’ のかわりにそのヘッ
          ダが使用されます。

      -- メソッド: set_type (type, header='Content-Type', requote=True)

          ‘Content-Type’ ヘッダの maintype と subtype を設定します。
          'type' は ‘maintype/subtype’ という形の文字列でなければなりま
          せん。それ以外の場合は *note ValueError: 2ec. が発生します。

          このメソッドは ‘Content-Type’ ヘッダを置き換えますが、すべての
          パラメータはそのままにします。 'requote' が ‘False’ の場合、こ
          れはすでに存在するヘッダを quote せず放置しますが、そうでない
          場合は自動的に quote します (デフォルト動作)。

          オプション変数 'header' が与えられた場合、 ‘Content-Type’ のか
          わりにそのヘッダが使用されます。 ‘Content-Type’ ヘッダが設定さ
          れる場合には、 ‘MIME-Version’ ヘッダも同時に付加されます。

          This is a legacy method.  On the *note EmailMessage: 580.
          class its functionality is replaced by the ‘make_’ and ‘add_’
          methods.

      -- メソッド: get_filename (failobj=None)

          そのメッセージ中の ‘Content-Disposition’ ヘッダにある、
          ‘filename’ パラメータの値を返します。目的のヘッダに ‘filename’
          パラメータがない場合には ‘Content-Type’ ヘッダにある ‘name’ パ
          ラメータを探します。それも無い場合またはヘッダが無い場合には
          'failobj' が返されます。返される文字列はつねに *note
          email.utils.unquote(): 3ad7. によって unquote されます。

      -- メソッド: get_boundary (failobj=None)

          そのメッセージ中の ‘Content-Type’ ヘッダにある、 ‘boundary’ パ
          ラメータの値を返します。目的のヘッダが欠けていたり、
          ‘boundary’ パラメータがない場合には 'failobj' が返されます。返
          される文字列はつねに *note email.utils.unquote(): 3ad7. によっ
          て unquote されます。

      -- メソッド: set_boundary (boundary)

          メッセージ中の ‘Content-Type’ ヘッダにある、 ‘boundary’ パラメ
          ータに値を設定します。 *note set_boundary(): 3b93. は必要に応
          じて 'boundary' を quote します。そのメッセージが
          ‘Content-Type’ ヘッダを含んでいない場合、 *note
          HeaderParseError: 3ada. が発生します。

          注意: このメソッドを使うのは、古い ‘Content-Type’ ヘッダを削除
          して新しい boundary をもったヘッダを *note add_header(): 187e.
          で足すのとは少し違います。 *note set_boundary(): 3b93. は一連
          のヘッダ中での ‘Content-Type’ ヘッダの位置を保つからです。しか
          し、これは元の ‘Content-Type’ ヘッダ中に存在していた連続する行
          の順番までは '保ちません' 。

      -- メソッド: get_content_charset (failobj=None)

          そのメッセージ中の ‘Content-Type’ ヘッダにある、 ‘charset’ パ
          ラメータの値を返します。値はすべて小文字に変換されます。メッセ
          ージ中に ‘Content-Type’ がなかったり、このヘッダ中に
          ‘charaset’ パラメータがない場合には 'failobj' が返されます。

          注意: これは *note get_charset(): 3b7d. メソッドとは異なります
          。こちらのほうは文字列のかわりに、そのメッセージボディのデフォ
          ルトエンコーディングの *note Charset: ffb. インスタンスを返し
          ます。

      -- メソッド: get_charsets (failobj=None)

          メッセージ中に含まれる文字セットの名前をすべてリストにして返し
          ます。そのメッセージが ‘multipart’ である場合、返されるリスト
          の各要素がそれぞれの subpart のペイロードに対応します。それ以
          外の場合、これは長さ 1 のリストを返します。

          リスト中の各要素は文字列であり、これは対応する subpart 中のそ
          れぞれの ‘Content-Type’ ヘッダにある ‘charset’ の値です。しか
          し、その subpart が ‘Content-Type’ をもってないか、 ‘charset’
          がないか、あるいは MIME maintype が ‘text’ でないいずれかの場
          合には、リストの要素として 'failobj' が返されます。

      -- メソッド: get_content_disposition ()

          Return the lowercased value (without parameters) of the
          message's ‘Content-Disposition’ header if it has one, or
          ‘None’.  The possible values for this method are 'inline',
          'attachment' or ‘None’ if the message follows RFC 2183(12).

          Added in version 3.5.

      -- メソッド: walk ()

          *note walk(): 3b96. メソッドは多目的のジェネレータで、これはあ
          るメッセージオブジェクトツリー中のすべての part および subpart
          をわたり歩くのに使えます。順序は深さ優先です。おそらく典型的な
          用法は、 *note walk(): 3b96. を ‘for’ ループ中でのイテレータと
          して使うことでしょう。ループを一回まわるごとに、次の subpart が
          返されるのです。

          以下の例は、 multipart メッセージのすべての part において、そ
          の MIME タイプを表示していくものです。 :

               >>> for part in msg.walk():
               ...     print(part.get_content_type())
               multipart/report
               text/plain
               message/delivery-status
               text/plain
               text/plain
               message/rfc822
               text/plain

          ‘walk’ iterates over the subparts of any part where *note
          is_multipart(): 3ade. returns ‘True’, even though
          ‘msg.get_content_maintype() == 'multipart'’ may return
          ‘False’.  We can see this in our example by making use of the
          ‘_structure’ debug helper function:

               >>> for part in msg.walk():
               ...     print(part.get_content_maintype() == 'multipart',
               ...           part.is_multipart())
               True True
               False False
               False True
               False False
               False False
               False True
               False False
               >>> _structure(msg)
               multipart/report
                   text/plain
                   message/delivery-status
                       text/plain
                       text/plain
                   message/rfc822
                       text/plain

          Here the ‘message’ parts are not ‘multiparts’, but they do
          contain subparts.  ‘is_multipart()’ returns ‘True’ and ‘walk’
          descends into the subparts.

     *note Message: 581. オブジェクトはオプションとして 2つのインスタン
     ス属性をとることができます。これはある MIME メッセージからプレーン
     テキストを生成するのに使うことができます。

      -- の属性: preamble

          MIME ドキュメントの形式では、ヘッダ直後にくる空行と最初の
          multipart 境界をあらわす文字列のあいだにいくらかのテキスト (訳
          注: preamble, 序文) を埋めこむことを許しています。このテキスト
          は標準的な MIME の範疇からはみ出しているので、MIME 形式を認識
          するメールソフトからこれらは通常まったく見えません。しかしメッ
          セージのテキストを生で見る場合、あるいはメッセージを MIME 対応
          していないメールソフトで見る場合、このテキストは目に見えること
          になります。

          'preamble' 属性は MIME ドキュメントに加えるこの最初の MIME 範
          囲外テキストを含んでいます。 *note Parser: 13b5. があるテキス
          トをヘッダ以降に発見したが、それはまだ最初の MIME 境界文字列が
          現れる前だった場合、パーザはそのテキストをメッセージの
          'preamble' 属性に格納します。 *note Generator: 13e6. がある
          MIME メッセージからプレーンテキスト形式を生成するときメッセー
          ジが 'preamble' 属性を持つことが発見されれば、これはそのテキス
          トをヘッダと最初の MIME 境界の間に挿入します。詳細は *note
          email.parser: 52. および *note email.generator: 44. を参照して
          ください。

          注意: そのメッセージに preamble がない場合、'preamble' 属性に
          は ‘None’ が格納されます。

      -- の属性: epilogue

          'epilogue' 属性はメッセージの最後の MIME 境界文字列からメッセ
          ージ末尾までのテキストを含むもので、それ以外は 'preamble' 属性
          と同じです。

          *note Generator: 13e6. でファイル終端に改行を出力するため、
          epilogue に空文字列を設定する必要はなくなりました。

      -- の属性: defects

          'defects' 属性はメッセージを解析する途中で検出されたすべての問
          題点 (defect、障害) のリストを保持しています。解析中に発見され
          うる障害についてのより詳細な説明は *note email.errors: 43. を
          参照してください。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc5322.html

   (2) https://datatracker.ietf.org/doc/html/rfc2822.html

   (3) https://datatracker.ietf.org/doc/html/rfc2231.html

   (4) https://datatracker.ietf.org/doc/html/rfc2231.html

   (5) https://datatracker.ietf.org/doc/html/rfc2045.html

   (6) https://datatracker.ietf.org/doc/html/rfc2045.html

   (7) https://datatracker.ietf.org/doc/html/rfc2045.html

   (8) https://datatracker.ietf.org/doc/html/rfc2231.html

   (9) https://datatracker.ietf.org/doc/html/rfc2231.html

   (10) https://datatracker.ietf.org/doc/html/rfc2045.html

   (11) https://datatracker.ietf.org/doc/html/rfc2231.html

   (12) https://datatracker.ietf.org/doc/html/rfc2183.html


File: python.info,  Node: email mime Creating email and MIME objects from scratch,  Next: email header 国際化されたヘッダー,  Prev: email message Message compat32 API を使用した電子メールメッセージの表現,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.20.1.14 ‘email.mime’: Creating email and MIME objects from scratch
....................................................................

'ソースコード:' Lib/email/mime/(1)

__________________________________________________________________

This module is part of the legacy (‘Compat32’) email API. Its
functionality is partially replaced by the *note contentmanager: 41. in
the new API, but in certain applications these classes may still be
useful, even in non-legacy code.

ふつう、メッセージオブジェクト構造はファイルまたは何がしかのテキストをパ
ーザに通すことで得られます。パーザは与えられたテキストを解析し、基底とな
る root のメッセージオブジェクトを返します。しかし、完全なメッセージオブ
ジェクト構造を何もないところから作成することもまた可能です。個別の *note
Message: 581. を手で作成することさえできます。実際には、すでに存在するメ
ッセージオブジェクト構造をとってきて、そこに新たな *note Message: 581. オ
ブジェクトを追加したり、あるものを別のところへ移動させたりできます。これ
は MIME メッセージを切ったりおろしたりするために非常に便利なインターフェ
イスを提供します。

新しいメッセージオブジェクト構造は *note Message: 581. インスタンスを作
成することにより作れます。ここに添付ファイルやその他適切なものをすべて手
で加えてやればよいのです。MIME メッセージの場合、 *note email: 3f. パッ
ケージはこれらを簡単におこなえるようにするためにいくつかの便利なサブクラ
スを提供しています。

以下がそのサブクラスです:

 -- クラス: email.mime.base.MIMEBase (_maintype, _subtype, *,
          policy=compat32, **_params)

     モジュール: *note email.mime.base: 4c.

     これはすべての *note Message: 581. の MIME 用サブクラスの基底となる
     クラスです。とくに *note MIMEBase: 3b9d. のインスタンスを直接作成す
     ることは (可能ではありますが) ふつうはしないでしょう。 *note
     MIMEBase: 3b9d. は単により特化された MIME 用サブクラスのための便宜
     的な基底クラスとして提供されています。

     '_maintype' は ‘Content-Type’ の主形式 (maintype) であり (‘text’ や
     ‘image’ など)、 '_subtype' は ‘Content-Type’ の副形式 (subtype) で
     す (‘plain’ や ‘gif’ など)。 '_params' は各パラメータのキーと値を格
     納した辞書であり、これは直接 *note Message.add_header: 187e. に渡さ
     れます。

     If 'policy' is specified, (defaults to the *note compat32: 12c8.
     policy) it will be passed to *note Message: 581.

     *note MIMEBase: 3b9d. クラスはつねに ('_maintype' 、 '_subtype' 、
     および '_params' にもとづいた) ‘Content-Type’ ヘッダと、
     ‘MIME-Version’ ヘッダ (必ず ‘1.0’ に設定される) を追加します。

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

 -- クラス: email.mime.nonmultipart.MIMENonMultipart

     モジュール: *note email.mime.nonmultipart: 50.

     *note MIMEBase: 3b9d. のサブクラスで、これは ‘multipart’ 形式でない
     MIME メッセージのための中間的な基底クラスです。このクラスのおもな目
     的は、通常 ‘multipart’ 形式のメッセージに対してのみ意味をなす *note
     attach(): 3aeb. メソッドの使用をふせぐことです。もし *note
     attach(): 3aeb. メソッドが呼ばれた場合、これは *note
     MultipartConversionError: 3b31. 例外を発生します。

 -- クラス: email.mime.multipart.MIMEMultipart (_subtype='mixed',
          boundary=None, _subparts=None, *, policy=compat32, **_params)

     モジュール: *note email.mime.multipart: 4f.

     *note MIMEBase: 3b9d. のサブクラスで、これは ‘multipart’ 形式の
     MIME メッセージのための中間的な基底クラスです。オプション引数
     '_subtype' はデフォルトでは ‘mixed’ になっていますが、そのメッセー
     ジの副形式 (subtype) を指定するのに使うことができます。メッセージオ
     ブジェクトには ‘multipart/_subtype’ という値をもつ ‘Content-Type’ ヘ
     ッダとともに、 ‘MIME-Version’ ヘッダが追加されるでしょう。

     オプション引数 'boundary' は multipart の境界文字列です。これが
     ‘None’ の場合 (デフォルト)、境界は必要に応じて計算されます（例えば
     メッセージがシリアライズされるときなど）。

     '_subparts' はそのペイロードの subpart の初期値からなるシーケンスで
     す。このシーケンスはリストに変換できるようになっている必要がありま
     す。新しい subpart はつねに *note Message.attach: 3aeb. メソッドを
     使ってそのメッセージに追加できるようになっています。

     Optional 'policy' argument defaults to *note compat32: 12c8.

     ‘Content-Type’ ヘッダに対する追加のパラメータはキーワード引数
     '_params' を介して取得あるいは設定されます。これはキーワード辞書に
     なっています。

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

 -- クラス: email.mime.application.MIMEApplication (_data,
          _subtype='octet-stream',
          _encoder=email.encoders.encode_base64, *, policy=compat32,
          **_params)

     モジュール: *note email.mime.application: 4a.

     A subclass of *note MIMENonMultipart: 3b32, the *note
     MIMEApplication: 3b9f. class is used to represent MIME message
     objects of major type ‘application’.  '_data' contains the bytes
     for the raw application data.  Optional '_subtype' specifies the
     MIME subtype and defaults to ‘octet-stream’.

     オプション引数の '_encoder' は呼び出し可能なオブジェクト (関数など)
     で、データの転送に使う実際のエンコード処理を行います。この呼び出し
     可能なオブジェクトは引数を 1 つ取り、それは *note MIMEApplication:
     3b9f. のインスタンスです。ペイロードをエンコードされた形式に変更す
     るために *note get_payload(): 13e5. と *note set_payload(): 3b7b. を
     使い、必要に応じて ‘Content-Transfer-Encoding’ やその他のヘッダをメ
     ッセージオブジェクトに追加するべきです。デフォルトのエンコードは
     base64 です。組み込みのエンコーダの一覧は *note email.encoders: 42.
     モジュールを見てください。

     Optional 'policy' argument defaults to *note compat32: 12c8.

     '_params' は基底クラスのコンストラクタにそのまま渡されます。

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

 -- クラス: email.mime.audio.MIMEAudio (_audiodata, _subtype=None,
          _encoder=email.encoders.encode_base64, *, policy=compat32,
          **_params)

     モジュール: *note email.mime.audio: 4b.

     A subclass of *note MIMENonMultipart: 3b32, the *note MIMEAudio:
     3ba0. class is used to create MIME message objects of major type
     ‘audio’.  '_audiodata' contains the bytes for the raw audio data.
     If this data can be decoded as au, wav, aiff, or aifc, then the
     subtype will be automatically included in the ‘Content-Type’
     header.  Otherwise you can explicitly specify the audio subtype via
     the '_subtype' argument.  If the minor type could not be guessed
     and '_subtype' was not given, then *note TypeError: 198. is raised.

     オプション引数の '_encoder' は呼び出し可能なオブジェクト (関数など)
     で、オーディオデータの転送に使う実際のエンコード処理を行います。こ
     の呼び出し可能なオブジェクトは引数を 1 つ取り、それは *note
     MIMEAudio: 3ba0. のインスタンスです。ペイロードをエンコードされた形
     式に変更するために *note get_payload(): 13e5. と *note
     set_payload(): 3b7b. を使い、必要に応じて
     ‘Content-Transfer-Encoding’ やその他のヘッダをメッセージオブジェク
     トに追加するべきです。デフォルトのエンコードは base64 です。組み込
     みのエンコーダの一覧は *note email.encoders: 42. モジュールを見てく
     ださい。

     Optional 'policy' argument defaults to *note compat32: 12c8.

     '_params' は基底クラスのコンストラクタにそのまま渡されます。

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

 -- クラス: email.mime.image.MIMEImage (_imagedata, _subtype=None,
          _encoder=email.encoders.encode_base64, *, policy=compat32,
          **_params)

     モジュール: *note email.mime.image: 4d.

     A subclass of *note MIMENonMultipart: 3b32, the *note MIMEImage:
     3b33. class is used to create MIME message objects of major type
     ‘image’.  '_imagedata' contains the bytes for the raw image data.
     If this data type can be detected (jpeg, png, gif, tiff, rgb, pbm,
     pgm, ppm, rast, xbm, bmp, webp, and exr attempted), then the
     subtype will be automatically included in the ‘Content-Type’
     header.  Otherwise you can explicitly specify the image subtype via
     the '_subtype' argument.  If the minor type could not be guessed
     and '_subtype' was not given, then *note TypeError: 198. is raised.

     オプション引数の '_encoder' は呼び出し可能なオブジェクト (関数など)
     で、画像データの転送に使う実際のエンコード処理を行います。この呼び
     出し可能なオブジェクトは引数を 1 つ取り、それは *note MIMEImage:
     3b33. のインスタンスです。ペイロードをエンコードされた形式に変更す
     るために *note get_payload(): 13e5. と *note set_payload(): 3b7b. を
     使い、必要に応じて ‘Content-Transfer-Encoding’ やその他のヘッダをメ
     ッセージオブジェクトに追加するべきです。デフォルトのエンコードは
     base64 です。組み込みのエンコーダの一覧は *note email.encoders: 42.
     モジュールを見てください。

     Optional 'policy' argument defaults to *note compat32: 12c8.

     '_params' は *note MIMEBase: 3b9d. コンストラクタに直接渡されます。

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

 -- クラス: email.mime.message.MIMEMessage (_msg, _subtype='rfc822', *,
          policy=compat32)

     モジュール: *note email.mime.message: 4e.

     *note MIMEMessage: 3ba1. クラスは *note MIMENonMultipart: 3b32. の
     サブクラスで、主形式 (maintype) が ‘message’ の MIME オブジェクトを
     作成するのに使われます。ペイロードとして使われるメッセージは '_msg'
     になります。これは *note Message: 581. クラス (あるいはそのサブクラ
     ス) のインスタンスでなければいけません。そうでない場合、この関数は
     *note TypeError: 198. を発生します。

     オプション引数 '_subtype' はそのメッセージの副形式 (subtype) を設定
     します。デフォルトではこれは ‘rfc822’ になっています。

     Optional 'policy' argument defaults to *note compat32: 12c8.

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

 -- クラス: email.mime.text.MIMEText (_text, _subtype='plain',
          _charset=None, *, policy=compat32)

     モジュール: *note email.mime.text: 51.

     *note MIMEText: ffa. クラスは *note MIMENonMultipart: 3b32. のサブ
     クラスで、主形式 (maintype) が ‘text’ の MIME オブジェクトを作成す
     るのに使われます。ペイロードの文字列は '_text' になります。
     '_subtype' には副形式 (subtype) を指定し、デフォルトは ‘plain’ です
     。 '_charset' はテキストの文字セットで、 *note MIMENonMultipart:
     3b32. コンストラクタに引数として渡されます。この値は、文字列が
     ‘ascii’ コードポイントのみを含む場合 ‘us-ascii’ 、それ以外は
     ‘utf-8’ がデフォルトになっています。 '_charset' パラメータは、文字
     列と *note Charset: ffb. インスタンスの両方を受け付けます。

     ‘_charset’ 引数に明示的に ‘None’ をセットしない限りは、作成される
     MIMEText オブジェクトは ‘charset’ の付いた ‘Content-Type’ ヘッダと
     ‘Content-Transfer-Endcoding’ ヘッダの両方を持ちます。これは後続の
     ‘set_payload’ 呼び出しが、 ‘set_payload’ コマンドに charset が渡し
     たとしてもエンコードされたペイロードにはならないことを意味します。
     ‘Content-Transfer-Encoding’ ヘッダを削除することでこの振る舞いを「
     リセット」出来ます。これにより ‘set_payload’ 呼び出しが新たなペイロ
     ードを自動的にエンコード (そして新たな ‘Content-Transfer-Encoding’
     ヘッダを追加) します。

     Optional 'policy' argument defaults to *note compat32: 12c8.

     バージョン 3.5 で変更: '_charset' は *note Charset: ffb. インスタン
     スも受け取ります。

     バージョン 3.6 で変更: キーワード専用引数 'policy' が追加されました
     。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/email/mime/


File: python.info,  Node: email header 国際化されたヘッダー,  Next: email charset 文字集合の表現,  Prev: email mime Creating email and MIME objects from scratch,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.20.1.15 ‘email.header’: 国際化されたヘッダー
..............................................

'ソースコード:' Lib/email/header.py(1)

__________________________________________________________________

このモジュールはレガシー(‘Compat32’)な電子メールAPIの一部です。現在の
APIではヘッダのエンコードとデコードは *note EmailMessage: 580. クラスの
辞書的なAPIによって透過的に処理されます。レガシーコードでの使用に加えて
、このモジュールは、ヘッダーをエンコードする際に使用される文字セットを完
全に制御する必要があるアプリケーションで役立ちます

この節の以降のテキストはモジュールの元々のドキュメントです。

RFC 2822(2) は電子メールメッセージの形式を規定する基本規格です。これはほ
とんどの電子メールが ASCII 文字のみで構成されていたころ普及した RFC
822(3) 標準から発展したものです。 RFC 2822(4) は電子メールがすべて 7-bit
ASCII 文字のみから構成されていると仮定して作られた仕様です。

Of course, as email has been deployed worldwide, it has become
internationalized, such that language specific character sets can now be
used in email messages.  The base standard still requires email messages
to be transferred using only 7-bit ASCII characters, so a slew of RFCs
have been written describing how to encode email containing non-ASCII
characters into RFC 2822(5)-compliant format.  These RFCs include RFC
2045(6), RFC 2046(7), RFC 2047(8), and RFC 2231(9).  The *note email:
3f. package supports these standards in its ‘email.header’ and *note
email.charset: 40. modules.

If you want to include non-ASCII characters in your email headers, say
in the ‘Subject’ or ‘To’ fields, you should use the *note Header: 1c5e.
class and assign the field in the *note Message: 581. object to an
instance of *note Header: 1c5e. instead of using a string for the header
value.  Import the *note Header: 1c5e. class from the ‘email.header’
module.  For example:

     >>> from email.message import Message
     >>> from email.header import Header
     >>> msg = Message()
     >>> h = Header('p\xf6stal', 'iso-8859-1')
     >>> msg['Subject'] = h
     >>> msg.as_string()
     'Subject: =?iso-8859-1?q?p=F6stal?=\n\n'

‘Subject’ フィールドに非ASCII文字を含めていることに注目してください。こ
こでは、含めたいバイト列がエンコードされている文字集合を指定して *note
Header: 1c5e. インスタンスを作成することによって実現しています。のちにこ
の *note Message: 581. インスタンスからフラットなテキストを生成する際に
、この ‘Subject’ フィールドは RFC 2047(10) 準拠の適切な形式にエンコード
されます。MIME 機能のあるメーラなら、このヘッダに埋めこまれた ISO-8859-1
文字を正しく表示するでしょう。

以下は *note Header: 1c5e. クラスの説明です:

 -- クラス: email.header.Header (s=None, charset=None, maxlinelen=None,
          header_name=None, continuation_ws=' ', errors='strict')

     別の文字集合の文字列を含む MIME 準拠なヘッダを作成します。

     オプション引数 's' はヘッダの値の初期値です。これが ‘None’ の場合
     (デフォルト)、ヘッダの初期値は設定されません。この値はあとから
     *note append(): 3ba5. メソッドを呼びだすことによって追加することが
     できます。 's' は *note bytes: 192. または *note str: 169. のインス
     タンスにできます。このセマンティクスについては *note append():
     3ba5. の項を参照してください。

     オプション引数 'charset' には 2 つの目的があります。ひとつは *note
     append(): 3ba5. メソッドにおける 'charset' 引数と同じものです。もう
     ひとつは、これ以降 'charset' 引数を省略した *note append(): 3ba5. メ
     ソッド呼び出しすべてにおける、デフォルト文字集合を決定するものです
     。コンストラクタに 'charset' が与えられない場合 (デフォルト)、初期
     値の 's' および以後の *note append(): 3ba5. 呼び出しにおける文字集
     合として ‘us-ascii’ が使われます。

     行の最大長は 'maxlinelen' によって明示的に指定できます。最初の行を
     (‘Subject’ などの 's' に含まれないフィールドヘッダの責任をとるため)
     短く切りとる場合、 'header_name' にそのフィールド名を指定してくださ
     い。 'maxlinelen' のデフォルト値は 78 であり、 'header_name' のデフ
     ォルト値は ‘None’ です。これはその最初の行を長い、切りとられたヘッ
     ダとして扱わないことを意味します。

     オプション引数 'continuation_ws' は RFC 2822(11) 準拠の折り返し用余
     白文字で、ふつうこれは空白か、ハードタブ文字 (hard tab) である必要
     があります。ここで指定された文字は複数にわたる行の行頭に挿入されま
     す。 'continuation_ws' のデフォルト値は 1 つのスペース文字です。

     オプション引数 'errors' は、 *note append(): 3ba5. メソッドにそのま
     ま渡されます。

      -- メソッド: append (s, charset=None, errors='strict')

          この MIME ヘッダに文字列 's' を追加します。

          オプション引数 'charset' がもし与えられた場合、これは *note
          Charset: ffb. インスタンス (*note email.charset: 40. を参照) か
          、あるいは文字集合の名前でなければなりません。この場合は *note
          Charset: ffb. インスタンスに変換されます。この値が ‘None’ の場
          合 (デフォルト)、コンストラクタで与えられた 'charset' が使われ
          ます。

          's' は *note bytes: 192. または *note str: 169. のインスタンス
          です。 *note bytes: 192. のインスタンスの場合、 'charset' はそ
          の文字列のエンコーディングであり、この文字セットでデコードでき
          ないときは *note UnicodeError: 462. が発生します。

          's' が *note str: 169. のインスタンスの場合、 'charset' はその
          文字列の文字セットを決定するためのヒントとして使われます。

          いずれの場合でも、 RFC 2822(12) 準拠のヘッダを RFC 2047(13) の
          規則を用いて生成する際、文字列は指定された文字セットの出力コー
          デックを用いてエンコードされます。出力コーデックを用いて文字列
          がエンコードできないときは *note UnicodeError: 462. が発生しま
          す。

          オプションの 'errors' は、 's' がバイト文字列だった場合のデコ
          ード呼び出しに errors 引数として渡されます。

      -- メソッド: encode (splitchars=';, \t', maxlinelen=None,
               linesep='\n')

          メッセージヘッダを RFC に沿ったやり方でエンコードします。おそ
          らく長い行は折り返され、非 ASCII 部分は base64 または
          quoted-printable エンコーディングで包含されるでしょう。

          オプション引数 'splitchars' は、通常のヘッダーの折り返し処理の
          間に分割アルゴリズムによって特別な重みが与えられるべき文字を含
          む文字列です。これは、 RFC 2822(14) の 'higher level syntactic
          breaks' の非常に荒いサポートです: splitchar の後の分割点は、行
          分割において優先されます。 分割文字は文字列中での出現順に優先
          されます。スペースとタブは、分割しようとする行に他の分割文字が
          出現しない時に、分割点として他の文字と比べてどのような優先順位
          が与えられるべきかを示すために、文字列に含めることができます。
          Splitchars は RFC 2047(15) エンコードされた行には影響しません
          。

          与えられた場合、'maxlinelen' はインスタンスの最大行長の値を上
          書きします。

          'linesep' は、折り返しヘッダの行を区切る文字を指定します。デフ
          ォルトではPythonアプリケーションコードに最も有用な値(‘\n’)にな
          りますが、RFC準拠の行区切り文字でヘッダを生成するために
          ''rn''を指定することができます。

          バージョン 3.2 で変更: 'linesep' 引数が追加されました。

     *note Header: 1c5e. クラスは、標準の演算子や組み込み関数をサポート
     するためのメソッドもいくつか提供しています。

      -- メソッド: __str__ ()

          *note Header: 1c5e. の概要を文字列として返します。無制限の行長
          を使用します。すべての箇所は、指定されたエンコーディングを使用
          してUnicodeに変換され、適切に結合されます。文字セット
          ‘'unknown-8bit'’ を持つ箇所は、 ‘'replace'’ エラーハンドラを使
          ってASCIIとしてデコードされます。

          バージョン 3.2 で変更: ‘'unknown-8bit'’ 文字集合の処理が追加さ
          れました。

      -- メソッド: __eq__ (other)

          このメソッドは、ふたつの *note Header: 1c5e. インスタンスどう
          しが等しいかどうか判定するのに使えます。

      -- メソッド: __ne__ (other)

          このメソッドは、ふたつの *note Header: 1c5e. インスタンスどう
          しが異なっているかどうかを判定するのに使えます。

The ‘email.header’ module also provides the following convenient
functions.

 -- の関数: email.header.decode_header (header)

     文字集合を変換せずにメッセージのヘッダをデコードします。ヘッダの値
     は 'header' にあります。

     For historical reasons, this function may return either:

       1. A list of pairs containing each of the decoded parts of the
          header, ‘(decoded_bytes, charset)’, where 'decoded_bytes' is
          always an instance of *note bytes: 192, and 'charset' is
          either:

                  - A lower case string containing the name of the
                    character set specified.

                  - ‘None’ for non-encoded parts of the header.

       2. A list of length 1 containing a pair ‘(string, None)’, where
          'string' is always an instance of *note str: 169.

     An *note email.errors.HeaderParseError: 3ada. may be raised when
     certain decoding errors occur (e.g.  a base64 decoding exception).

     Here are examples:

          >>> from email.header import decode_header
          >>> decode_header('=?iso-8859-1?q?p=F6stal?=')
          [(b'p\xf6stal', 'iso-8859-1')]
          >>> decode_header('unencoded_string')
          [('unencoded_string', None)]
          >>> decode_header('bar =?utf-8?B?ZsOzbw==?=')
          [(b'bar ', None), (b'f\xc3\xb3o', 'utf-8')]

          注釈: This function exists for backwards compatibility only.
          For new code, we recommend using *note
          email.headerregistry.HeaderRegistry: 3b43.

 -- の関数: email.header.make_header (decoded_seq, maxlinelen=None,
          header_name=None, continuation_ws=' ')

     *note decode_header(): 12ce. によって返される 2要素タプルのリストか
     ら *note Header: 1c5e. インスタンスを作成します。

     *note decode_header(): 12ce. はヘッダの値をとってきて、
     ‘(decoded_string, charset)’ という形式の 2要素タプルからなるリスト
     を返します。ここで 'decoded_string' はデコードされた文字列、
     'charset' はその文字集合です。

     この関数はこれらのリストの項目から、 *note Header: 1c5e. インスタン
     スを返します。オプション引数 'maxlinelen' 、 'header_name' および
     'continuation_ws' は *note Header: 1c5e. コンストラクタに与えるもの
     と同じです。

          注釈: This function exists for backwards compatibility only,
          and is not recommended for use in new code.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/email/header.py

   (2) https://datatracker.ietf.org/doc/html/rfc2822.html

   (3) https://datatracker.ietf.org/doc/html/rfc822.html

   (4) https://datatracker.ietf.org/doc/html/rfc2822.html

   (5) https://datatracker.ietf.org/doc/html/rfc2822.html

   (6) https://datatracker.ietf.org/doc/html/rfc2045.html

   (7) https://datatracker.ietf.org/doc/html/rfc2046.html

   (8) https://datatracker.ietf.org/doc/html/rfc2047.html

   (9) https://datatracker.ietf.org/doc/html/rfc2231.html

   (10) https://datatracker.ietf.org/doc/html/rfc2047.html

   (11) https://datatracker.ietf.org/doc/html/rfc2822.html

   (12) https://datatracker.ietf.org/doc/html/rfc2822.html

   (13) https://datatracker.ietf.org/doc/html/rfc2047.html

   (14) https://datatracker.ietf.org/doc/html/rfc2822.html

   (15) https://datatracker.ietf.org/doc/html/rfc2047.html


File: python.info,  Node: email charset 文字集合の表現,  Next: email encoders エンコーダー,  Prev: email header 国際化されたヘッダー,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.20.1.16 ‘email.charset’: 文字集合の表現
.........................................

'ソースコード:' Lib/email/charset.py(1)

__________________________________________________________________

このモジュールは、レガシーな (‘Compat32’) email API の一部分です。 新し
い API では別名の表のみ使われています。

この節の以降のテキストはモジュールの元々のドキュメントです。

このモジュールは文字集合の表現および電子メールメッセージの文字集合の変換
を行う *note Charset: ffb. クラスに加え、文字集合のレジストリとそれを操
作する簡易メソッドを提供しています。 *note Charset: ffb. インスタンスは
*note email: 3f. パッケージ中にある他のいくつかのモジュールで使用されま
す。

Import this class from the ‘email.charset’ module.

 -- クラス: email.charset.Charset (input_charset=DEFAULT_CHARSET)

     文字集合を電子メールのプロパティに写像します。

     このクラスは、ある特定の文字集合に対し電子メールに課される条件につ
     いての情報を提供します。 また、適用可能なコーデックスが利用出来れば
     、文字集合間の変換を行う簡易ルーチンを提供します。 文字集合について
     、この関数は電子メールメッセージ内での RFC に準拠した文字集合の使い
     方に関する情報を提供するのに最善を尽くします。

     文字集合によっては、電子メールのヘッダや本体で使う場合に
     quoted-printable や base64 形式でエンコードされなければなりません。
     また、文字集合によっては完全に変換する必要があり、電子メールの中で
     は使用できません。

     以下ではオプション引数 'input_charset' について説明します。この値は
     常に小文字に強制的に変換されます。そして文字集合の別名が正規化され
     たあと、この値は文字集合のレジストリ内を検索し、ヘッダのエンコーデ
     ィングとメッセージ本体のエンコーディング、および出力時の変換に使わ
     れるコーデックを見付けるのに使われます。たとえば 'input_charset' が
     ‘iso-8859-1’ の場合、ヘッダおよびメッセージ本体は quoted-printable
     でエンコードされ、出力時の変換用コーデックは必要ありません。もし
     'input_charset' が ‘euc-jp’ ならば、ヘッダは base64 でエンコードさ
     れ、メッセージ本体はエンコードされませんが、出力されるテキストは
     ‘euc-jp’ 文字集合から ‘iso-2022-jp’ 文字集合に変換されます。

     *note Charset: ffb. インスタンスは以下のようなデータ属性をもってい
     ます:

      -- の属性: input_charset

          最初に指定される文字集合です。一般的な別名は、'正式な' 電子メ
          ール用の名前に変換されます (たとえば、‘latin_1’ は
          ‘iso-8859-1’ に変換されます)。デフォルトは 7-bit の ‘us-ascii’
          です。

      -- の属性: header_encoding

          この文字集合が電子メールヘッダに使われる前にエンコードされなけ
          ればならない場合、この属性は ‘charset.QP’ (quoted-printable エ
          ンコーディング)、‘charset.BASE64’ (base64 エンコーディング)、
          あるいは最短の QP または BASE64 エンコーディングである
          ‘charset.SHORTEST’ に設定されます。そうでない場合、この値は
          ‘None’ になります。

      -- の属性: body_encoding

          'header_encoding' と同じですが、この値はメッセージ本体のための
          エンコーディングを記述します。これはヘッダ用のエンコーディング
          とは違うかもしれません。'body_encoding' では、
          ‘charset.SHORTEST’ を使うことはできません。

      -- の属性: output_charset

          文字集合によっては、電子メールのヘッダあるいはメッセージ本体に
          使う前に変換しなければなりません。もし 'input_charset' がそれ
          らの文字集合のどれかをさしていたら、この 'output_charset' 属性
          はそれが出力時に変換される文字集合の名前を表しています。それ以
          外の場合、この値は ‘None’ になります。

      -- の属性: input_codec

          'input_charset' を Unicode に変換するための Python 用コーデッ
          ク名です。変換用のコーデックが必要ないときは、この値は ‘None’
          になります。

      -- の属性: output_codec

          Unicode を 'output_charset' に変換するための Python 用コーデッ
          ク名です。変換用のコーデックが必要ないときは、この値は ‘None’
          になります。この属性は 'input_codec' と同じ値を持つことになる
          でしょう。

     *note Charset: ffb. インスタンスは、以下のメソッドも持っています:

      -- メソッド: get_body_encoding ()

          メッセージ本体のエンコードに使われる content-transfer-encoding
          の値を返します。

          この値は使用しているエンコーディングの文字列
          ‘quoted-printable’ または ‘base64’ か、あるいは関数のいずれか
          です。後者の場合、これはエンコードされる Message オブジェクト
          を単一の引数として取るような関数である必要があります。この関数
          は変換後 ‘Content-Transfer-Encoding’ ヘッダ自体を、なんであれ
          適切な値に設定する必要があります。

          このメソッドは 'body_encoding' が ‘QP’ の場合
          ‘quoted-printable’ を返し、'body_encoding' が ‘BASE64’ の場合
          ‘base64’ を返します。それ以外の場合は文字列 ‘7bit’ を返します
          。

      -- メソッド: get_output_charset ()

          出力用の文字集合を返します。

          これは 'output_charset' 属性が ‘None’ でなければその値になりま
          す。それ以外の場合、この値は 'input_charset' と同じです。

      -- メソッド: header_encode (string)

          文字列 'string' をヘッダ用にエンコードします。

          エンコーディングの形式 (base64 または quoted-printable) は、
          'header_encoding' 属性に基づきます。

      -- メソッド: header_encode_lines (string, maxlengths)

          'string' を最初にバイト列に変換し、ヘッダ用にエンコードします
          。

          これは *note header_encode(): 3bb5. と似ていますが、与えられた
          引数 'maxlengths' に従って、行の最大長に合うように文字列が調整
          されるところが異なります。 'maxlengths' はイテレータでなければ
          なりません: このイテレータが返す要素は次の行の最大長を表します
          。

      -- メソッド: body_encode (string)

          文字列 'string' をメッセージ本体用にエンコードします。

          エンコーディングの形式 (base64 または quoted-printable) は、
          'body_encoding' 属性に基づきます。

     *note Charset: ffb. クラスには、標準的な演算と組み込み関数をサポー
     トするいくつかのメソッドがあります。

      -- メソッド: __str__ ()

          'input_charset' を小文字に変換された文字列型として返します。
          ‘__repr__()’ は、 ‘__str__()’ の別名となっています。

      -- メソッド: __eq__ (other)

          このメソッドは、2つの *note Charset: ffb. インスタンスが同じか
          どうかをチェックするのに使います。

      -- メソッド: __ne__ (other)

          このメソッドは、2つの *note Charset: ffb. インスタンスが異なる
          かどうかをチェックするのに使います。

The ‘email.charset’ module also provides the following functions for
adding new entries to the global character set, alias, and codec
registries:

 -- の関数: email.charset.add_charset (charset, header_enc=None,
          body_enc=None, output_charset=None)

     文字の属性をグローバルなレジストリに追加します。

     'charset' は入力用の文字集合で、その文字集合の正式名称を指定する必
     要があります。

     オプション引数 'header_enc' および 'body_enc' は quoted-printable エ
     ンコーディングを表す ‘charset.QP’ か、base64 エンコーディングを表す
     ‘charset.BASE64’、最短の quoted-printable または base64 エンコーデ
     ィングを表す ‘charset.SHORTEST’、あるいはエンコーディングなしの
     ‘None’ のいずれかになります。‘SHORTEST’ が使えるのは 'header_enc' だ
     けです。デフォルトの値はエンコーディングなしの ‘None’ になっていま
     す。

     オプション引数 'output_charset' には出力用の文字集合が入ります。
     ‘Charset.convert()’ が呼ばれたときの変換はまず入力用の文字集合を
     Unicode に変換し、それから出力用の文字集合に変換されます。デフォル
     トでは、出力は入力と同じ文字集合になっています。

     'input_charset' および 'output_charset' はこのモジュール中の文字集
     合-コーデック対応表にある Unicode コーデックエントリである必要があ
     ります。モジュールがまだ対応していないコーデックを追加するには、
     *note add_codec(): 3bbc. を使ってください。より詳しい情報については
     *note codecs: 1c. モジュールの文書を参照してください。

     グローバルな文字集合用のレジストリは、モジュールのグローバル辞書
     ‘CHARSETS’ 内に保持されています。

 -- の関数: email.charset.add_alias (alias, canonical)

     文字集合の別名を追加します。'alias' はその別名で、たとえば
     ‘latin-1’ のように指定します。'canonical' はその文字集合の正式名称
     で、たとえば ‘iso-8859-1’ のように指定します。

     文字集合のグローバルな別名用レジストリは、モジュールのグローバル辞
     書 ‘ALIASES’ 内に保持されています。

 -- の関数: email.charset.add_codec (charset, codecname)

     与えられた文字集合の文字と Unicode との変換を行うコーデックを追加し
     ます。

     'charset' は文字集合の正式な名前です。 'codecname' は、 *note str:
     169. の *note encode(): ad2. メソッドの第 2 引数で使える Python コ
     ーデックの名前です。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/email/charset.py


File: python.info,  Node: email encoders エンコーダー,  Next: email utils Miscellaneous utilities,  Prev: email charset 文字集合の表現,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.20.1.17 ‘email.encoders’: エンコーダー
........................................

'ソースコード:' Lib/email/encoders.py(1)

__________________________________________________________________

このモジュールは、レガシーな (‘Compat32’) email APIの一部です。新しい
APIでは、この機能は *note set_content(): 1c5d. メソッドの*cte*パラメータ
によって提供されます。

このモジュールはPython3で非推奨になりました。 *note MIMEText: ffa. クラ
スはクラスのインスタンス化中に渡された '_subtype' と '_charset' の値を使
ってcontent typeとCTEヘッダを設定するので、ここで提供されている関数は明
示的に呼び出すべきではありません。

この節の以降のテキストはモジュールの元々のドキュメントです。

何もないところから *note Message: 581. を作成するときしばしば必要になる
のが、ペイロードをメールサーバに通すためにエンコードすることです。これは
とくにバイナリデータを含んだ ‘image/*’ や ‘text/*’ タイプのメッセージで
必要です。

The *note email: 3f. package provides some convenient encoders in its
‘encoders’ module.  These encoders are actually used by the *note
MIMEAudio: 3ba0. and *note MIMEImage: 3b33. class constructors to
provide default encodings.  All encoder functions take exactly one
argument, the message object to encode.  They usually extract the
payload, encode it, and reset the payload to this newly encoded value.
They should also set the ‘Content-Transfer-Encoding’ header as
appropriate.

マルチパートメッセージにこれら関数を使うことは全く無意味です。それらは各
々のサブパートごとに適用されるべきものです。メッセージがマルチパートのも
のを渡すと *note TypeError: 198. が発生します。

提供されているエンコーディング関数は以下のとおりです:

 -- の関数: email.encoders.encode_quopri (msg)

     ペイロードを quoted-printable 形式にエンコードし、
     ‘Content-Transfer-Encoding’ ヘッダを ‘quoted-printable’ (2) に設定
     します。これはそのペイロードのほとんどが通常の印刷可能な文字からな
     っているが、印刷不可能な文字がすこしだけあるときのエンコード方法と
     して適しています。

 -- の関数: email.encoders.encode_base64 (msg)

     ペイロードを base64 形式でエンコードし、
     ‘Content-Transfer-Encoding’ ヘッダを ‘base64’ に変更します。これは
     ペイロード中のデータのほとんどが印刷不可能な文字である場合に適して
     います。 quoted-printable 形式よりも結果としてはコンパクトなサイズ
     になるからです。 base64 形式の欠点は、これが人間にはまったく読めな
     いテキストになってしまうことです。

 -- の関数: email.encoders.encode_7or8bit (msg)

     これは実際にはペイロードを変更はしませんが、ペイロードの形式に応じ
     て ‘Content-Transfer-Encoding’ ヘッダを ‘7bit’ あるいは ‘8bit’ に適
     した形に設定します。

 -- の関数: email.encoders.encode_noop (msg)

     これは何もしないエンコーダです。 ‘Content-Transfer-Encoding’ ヘッダ
     を設定さえしません。

脚注
....

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/email/encoders.py

   (2) 注意: *note encode_quopri(): 3bc1. を使ってエンコードすると、デー
タ中のタブ文字や空白文字もエンコードされます。


File: python.info,  Node: email utils Miscellaneous utilities,  Next: email iterators イテレータ,  Prev: email encoders エンコーダー,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.20.1.18 ‘email.utils’: Miscellaneous utilities
................................................

'ソースコード:' Lib/email/utils.py(1)

__________________________________________________________________

There are a couple of useful utilities provided in the ‘email.utils’
module:

 -- の関数: email.utils.localtime (dt=None)

     Return local time as an aware datetime object.  If called without
     arguments, return current time.  Otherwise 'dt' argument should be
     a *note datetime: 4e2. instance, and it is converted to the local
     time zone according to the system time zone database.  If 'dt' is
     naive (that is, ‘dt.tzinfo’ is ‘None’), it is assumed to be in
     local time.

     Added in version 3.3.

     Deprecated since version 3.12, removed in version 3.14: The 'isdst'
     parameter.

 -- の関数: email.utils.make_msgid (idstring=None, domain=None)

     Returns a string suitable for an RFC 2822(2)-compliant ‘Message-ID’
     header.  Optional 'idstring' if given, is a string used to
     strengthen the uniqueness of the message id.  Optional 'domain' if
     given provides the portion of the msgid after the '@'.  The default
     is the local hostname.  It is not normally necessary to override
     this default, but may be useful certain cases, such as a
     constructing distributed system that uses a consistent domain name
     across multiple hosts.

     バージョン 3.2 で変更: 'domain' キーワードが追加されました。

The remaining functions are part of the legacy (‘Compat32’) email API.
There is no need to directly use these with the new API, since the
parsing and formatting they provide is done automatically by the header
parsing machinery of the new API.

 -- の関数: email.utils.quote (str)

     文字列 'str' 内のバックスラッシュをバックスラッシュ2つに置換した新
     しい文字列を返します。また、ダブルクォートはバックスラッシュ + ダブ
     ルクォートに置換されます。

 -- の関数: email.utils.unquote (str)

     文字列 'str' の 'クォートを外した' 新しい文字列を返します。'str' の
     先頭と末尾がダブルクォートだった場合、それらは取り除かれます。同様
     に 'str' の先頭と末尾が角ブラケット (<、>) だった場合もそれらは取り
     除かれます。

 -- の関数: email.utils.parseaddr (address, *, strict=True)

     ‘To’ や ‘Cc’ のようなフィールドを持つアドレスをパースして、構成要素
     の '実名' と '電子メールアドレス' を取り出します。 パースに成功した
     場合、これらの情報持つタプルを返します。失敗した場合は 2 要素のタプ
     ル ‘('', '')’ を返します。

     If 'strict' is true, use a strict parser which rejects malformed
     inputs.

     バージョン 3.13 で変更: Add 'strict' optional parameter and reject
     malformed inputs by default.

 -- の関数: email.utils.formataddr (pair, charset='utf-8')

     *note parseaddr(): 4f4. の逆で、2 要素のタプル ‘(realname,
     email_address)’ を取って ‘To’ や ‘Cc’ ヘッダに適した文字列を返しま
     す。タプル 'pair' の第1要素が偽である場合、第2要素の値をそのまま返
     します。

     任意の 'charset' は、 ‘realname’ が非 ASCII 文字を含んでいる場合に
     その RFC 2047(3) エンコーディングに使われる文字集合です。*note str:
     169. か *note Charset: ffb. のインスタンスで、デフォルトは ‘utf-8’
     です。

     バージョン 3.3 で変更: 'charset' オプションが追加されました。

 -- の関数: email.utils.getaddresses (fieldvalues, *, strict=True)

     This method returns a list of 2-tuples of the form returned by
     ‘parseaddr()’.  'fieldvalues' is a sequence of header field values
     as might be returned by *note Message.get_all: 3b81.

     If 'strict' is true, use a strict parser which rejects malformed
     inputs.

     Here's a simple example that gets all the recipients of a message:

          from email.utils import getaddresses

          tos = msg.get_all('to', [])
          ccs = msg.get_all('cc', [])
          resent_tos = msg.get_all('resent-to', [])
          resent_ccs = msg.get_all('resent-cc', [])
          all_recipients = getaddresses(tos + ccs + resent_tos + resent_ccs)

     バージョン 3.13 で変更: Add 'strict' optional parameter and reject
     malformed inputs by default.

 -- の関数: email.utils.parsedate (date)

     RFC 2822(4) の規則に基づいて日付の解析を試みます。 しかしながらメイ
     ラーによっては指定された形式に従っていないものがあるので、その場合
     *note parsedate(): 3bca. は正しく推測しようとします。 'date' は
     ‘"Mon, 20 Nov 1995 19:12:08 -0500"’ のような RFC 2822(5) 形式の日付
     を含む文字列です。 日付の解析に成功した場合、 *note parsedate():
     3bca. は関数 *note time.mktime(): 1401. に直接渡せる形式の 9 要素か
     らなるタプルを返します。 失敗した場合は ‘None’ を返します。 返され
     るタプルの 6、7、8番目の添字は使用不可なので注意してください。

 -- の関数: email.utils.parsedate_tz (date)

     Performs the same function as *note parsedate(): 3bca, but returns
     either ‘None’ or a 10-tuple; the first 9 elements make up a tuple
     that can be passed directly to *note time.mktime(): 1401, and the
     tenth is the offset of the date's timezone from UTC (which is the
     official term for Greenwich Mean Time) (6).  If the input string
     has no timezone, the last element of the tuple returned is ‘0’,
     which represents UTC. Note that indexes 6, 7, and 8 of the result
     tuple are not usable.

 -- の関数: email.utils.parsedate_to_datetime (date)

     The inverse of *note format_datetime(): 12d3.  Performs the same
     function as *note parsedate(): 3bca, but on success returns a *note
     datetime: 4e2.; otherwise ‘ValueError’ is raised if 'date' contains
     an invalid value such as an hour greater than 23 or a timezone
     offset not between -24 and 24 hours.  If the input date has a
     timezone of ‘-0000’, the ‘datetime’ will be a naive ‘datetime’, and
     if the date is conforming to the RFCs it will represent a time in
     UTC but with no indication of the actual source timezone of the
     message the date comes from.  If the input date has any other valid
     timezone offset, the ‘datetime’ will be an aware ‘datetime’ with
     the corresponding a *note timezone: 12d5. *note tzinfo: 7f6.

     Added in version 3.3.

 -- の関数: email.utils.mktime_tz (tuple)

     *note parsedate_tz(): 1c23. が返す 10 要素のタプルを UTC のタイムス
     タンプ (エポックからの秒数) に変換します。与えられた時間帯が ‘None’
     である場合、時間帯として現地時間 (localtime) が仮定されます。

 -- の関数: email.utils.formatdate (timeval=None, localtime=False,
          usegmt=False)

     日付を RFC 2822(7) 形式の文字列で返します。例:

          Fri, 09 Nov 2001 01:08:47 -0000

     Optional 'timeval' if given is a floating-point time value as
     accepted by *note time.gmtime(): 13d8. and *note time.localtime():
     1712, otherwise the current time is used.

     オプション引数 'localtime' はフラグです。‘True’ の場合、この関数は
     'timeval' を解析して UTC の代わりに現地のタイムゾーンに対する日付を
     返します。おそらく夏時間も考慮するでしょう。デフォルトは ‘False’ で
     、UTC が使われます。

     オプション引数 'usegmt' はフラグです。‘True’ の場合、この関数はタイ
     ムゾーンを数値の ‘-0000’ ではなく ascii 文字列 ‘GMT’ として日付を出
     力します。これはプロトコルによっては (例えば HTTP) 必要です。これは
     'localtime' が ‘False’ のときのみ適用されます。デフォルトは ‘False’
     です。

 -- の関数: email.utils.format_datetime (dt, usegmt=False)

     Like ‘formatdate’, but the input is a *note datetime: 34. instance.
     If it is a naive datetime, it is assumed to be "UTC with no
     information about the source timezone", and the conventional
     ‘-0000’ is used for the timezone.  If it is an aware ‘datetime’,
     then the numeric timezone offset is used.  If it is an aware
     timezone with offset zero, then 'usegmt' may be set to ‘True’, in
     which case the string ‘GMT’ is used instead of the numeric timezone
     offset.  This provides a way to generate standards conformant HTTP
     date headers.

     Added in version 3.3.

 -- の関数: email.utils.decode_rfc2231 (s)

     RFC 2231(8) に従って文字列 's' をデコードします。

 -- の関数: email.utils.encode_rfc2231 (s, charset=None, language=None)

     RFC 2231(9) に従って 's' をエンコードします。オプション引数
     'charset' および 'language' が与えられた場合、これらは文字セット名
     と言語名として使われます。もしこれらのどちらも与えられていない場合
     、 's' はそのまま返されます。 'charset' は与えられているが
     'language' が与えられていない場合、文字列 's' は 'language' の空文
     字列を使ってエンコードされます。

 -- の関数: email.utils.collapse_rfc2231_value (value, errors='replace',
          fallback_charset='us-ascii')

     ヘッダのパラメータが RFC 2231(10) 形式でエンコードされている場合、
     *note Message.get_param: 3b8d. は 3 要素からなるタプルを返すことが
     あります。ここには、そのパラメータの文字セット、言語、および値の順
     に格納されています。 *note collapse_rfc2231_value(): 3b8e. はこのパ
     ラメータをひとつの Unicode 文字列にまとめます。オプション引数
     'errors' は *note str: 169. の *note encode(): ad2. メソッドの引数
     'errors' に渡されます。このデフォルト値は ‘'replace'’ となっていま
     す。オプション引数 'fallback_charset' は、もし RFC 2231(11) ヘッダ
     の使用している文字セットが Python の知っているものではなかった場合
     の非常用文字セットとして使われます。デフォルトでは、この値は
     ‘'us-ascii'’ です。

     便宜上、 *note collapse_rfc2231_value(): 3b8e. に渡された引数
     'value' がタプルでない場合には、これは文字列でなければなりません。
     その場合にはクォートを除いた文字列を返します。

 -- の関数: email.utils.decode_params (params)

     RFC 2231(12) に従って引数のリストをデコードします。 'params' は
     ‘(content-type, string-value)’ のような形式の 2 要素タプルです。

脚注
....

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/email/utils.py

   (2) https://datatracker.ietf.org/doc/html/rfc2822.html

   (3) https://datatracker.ietf.org/doc/html/rfc2047.html

   (4) https://datatracker.ietf.org/doc/html/rfc2822.html

   (5) https://datatracker.ietf.org/doc/html/rfc2822.html

   (6) 注意: この時間帯のオフセット値は ‘time.timezone’ の値と符号が逆で
す。これは ‘time.timezone’ が POSIX 標準に準拠しているのに対して、こちら
は RFC 2822 (https://datatracker.ietf.org/doc/html/rfc2822.html) に準拠
しているからです。

   (7) https://datatracker.ietf.org/doc/html/rfc2822.html

   (8) https://datatracker.ietf.org/doc/html/rfc2231.html

   (9) https://datatracker.ietf.org/doc/html/rfc2231.html

   (10) https://datatracker.ietf.org/doc/html/rfc2231.html

   (11) https://datatracker.ietf.org/doc/html/rfc2231.html

   (12) https://datatracker.ietf.org/doc/html/rfc2231.html


File: python.info,  Node: email iterators イテレータ,  Prev: email utils Miscellaneous utilities,  Up: email --- 電子メールと MIME 処理のためのパッケージ

5.20.1.19 ‘email.iterators’: イテレータ
.......................................

'ソースコード:' Lib/email/iterators.py(1)

__________________________________________________________________

Iterating over a message object tree is fairly easy with the *note
Message.walk: 3b96. method.  The ‘email.iterators’ module provides some
useful higher level iterations over message object trees.

 -- の関数: email.iterators.body_line_iterator (msg, decode=False)

     このイテレータは 'msg' 中のすべてのサブパートに含まれるペイロードを
     すべて順にたどっていき、ペイロード内の文字列を 1 行ずつ返します。サ
     ブパートのヘッダはすべて無視され、Python 文字列でないペイロードから
     なるサブパートも無視されます。これは *note readline(): 20a6. を使っ
     て、ファイルからメッセージを (ヘッダだけとばして) フラットなテキス
     トとして読むのにいくぶん似ているかもしれません。

     オプション引数 'decode' は、 *note Message.get_payload: 13e5. にそ
     のまま渡されます。

 -- の関数: email.iterators.typed_subpart_iterator (msg,
          maintype='text', subtype=None)

     このイテレータは 'msg' 中のすべてのサブパートをたどり、それらの中で
     指定されたMIME 形式 'maintype' と 'subtype' をもつようなパートのみ
     を返します。

     'subtype' は省略可能であることに注意してください。これが省略された
     場合、サブパートの MIME 形式は maintype のみがチェックされます。じ
     つは 'maintype' も省略可能で、その場合にはデフォルトは ‘text’ です
     。

     つまり、デフォルトでは *note typed_subpart_iterator(): 3bd2. は
     MIME 形式 ‘text/*’ をもつサブパートを順に返していくというわけです。

以下の関数は役に立つデバッグ用ツールとして追加されたもので、パッケージと
して公式なサポートのあるインターフェイスでは 'ありません'。

 -- の関数: email.iterators._structure (msg, fp=None, level=0,
          include_default=False)

     そのメッセージオブジェクト構造の content-type をインデントつきで表
     示します。例えば:

          >>> msg = email.message_from_file(somefile)
          >>> _structure(msg)
          multipart/mixed
              text/plain
              text/plain
              multipart/digest
                  message/rfc822
                      text/plain
                  message/rfc822
                      text/plain
                  message/rfc822
                      text/plain
                  message/rfc822
                      text/plain
                  message/rfc822
                      text/plain
              text/plain

     オプション引数 'fp' は出力を渡すための file-like オブジェクトです。
     これは Python の *note print(): 1177. 関数が対応できるようになって
     いる必要があります。 'level' は内部的に使用されます。
     'include_default' が真の場合、デフォルトの型も出力します。

参考
....

*note smtplib: cf. モジュール

     SMTP（簡易メール転送プロトコル）クライアント

*note poplib: b1. モジュール

     POP (Post Office Protocol) クライアント

モジュール *note imaplib: 78.

     IMAP (Internet Message Access Protocol) クライアント

*note mailbox: 8f. モジュール

     Tools for creating, reading, and managing collections of messages
     on disk using a variety standard formats.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/email/iterators.py


File: python.info,  Node: json --- JSON エンコーダーとデコーダー,  Next: mailbox --- 様々な形式のメールボックスを操作する,  Prev: email --- 電子メールと MIME 処理のためのパッケージ,  Up: インターネット上のデータの操作

5.20.2 ‘json’ -- JSON エンコーダーとデコーダー
----------------------------------------------

'ソースコード:' Lib/json/__init__.py(1)

__________________________________________________________________

JSON (JavaScript Object Notation)(2) は、 RFC 7159(3) ( RFC 4627(4) を
obsolete) と ECMA-404(5) によって定義された軽量のデータ交換用のフォーマ
ットです。 JavaScript のオブジェクトリテラル記法に由来しています
(JavaScript(6) の厳密なサブセットではありませんが (7))。

     注釈: The term "object" in the context of JSON processing in Python
     can be ambiguous.  All values in Python are objects.  In JSON, an
     object refers to any data wrapped in curly braces, similar to a
     Python dictionary.

     警告: 信頼されていないソースからの JSON データをパースするときは十
     分注意してください。悪意を持った JSON 文字列はデコーダに著しい量の
     CPU とメモリリソースを消費させる可能性があります。パースするデータ
     量を制限することを推奨します。

このモジュールの API は標準ライブラリの *note marshal: 91. や *note
pickle: ab. のユーザに馴染み深いものです。

基本的な Python オブジェクト階層のエンコーディング:

     >>> import json
     >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
     '["foo", {"bar": ["baz", null, 1.0, 2]}]'
     >>> print(json.dumps("\"foo\bar"))
     "\"foo\bar"
     >>> print(json.dumps('\u1234'))
     "\u1234"
     >>> print(json.dumps('\\'))
     "\\"
     >>> print(json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True))
     {"a": 0, "b": 0, "c": 0}
     >>> from io import StringIO
     >>> io = StringIO()
     >>> json.dump(['streaming API'], io)
     >>> io.getvalue()
     '["streaming API"]'

コンパクトなエンコーディング:

     >>> import json
     >>> json.dumps([1, 2, 3, {'4': 5, '6': 7}], separators=(',', ':'))
     '[1,2,3,{"4":5,"6":7}]'

見やすい表示:

     >>> import json
     >>> print(json.dumps({'6': 7, '4': 5}, sort_keys=True, indent=4))
     {
         "4": 5,
         "6": 7
     }

JSON オブジェクトのエンコーディング方法をカスタマイズする:

     >>> import json
     >>> def custom_json(obj):
     ...     if isinstance(obj, complex):
     ...         return {'__complex__': True, 'real': obj.real, 'imag': obj.imag}
     ...     raise TypeError(f'Cannot serialize object of {type(obj)}')
     ...
     >>> json.dumps(1 + 2j, default=custom_json)
     '{"__complex__": true, "real": 1.0, "imag": 2.0}'

JSON のデコーディング:

     >>> import json
     >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]')
     ['foo', {'bar': ['baz', None, 1.0, 2]}]
     >>> json.loads('"\\"foo\\bar"')
     '"foo\x08ar'
     >>> from io import StringIO
     >>> io = StringIO('["streaming API"]')
     >>> json.load(io)
     ['streaming API']

JSON オブジェクトのデコーディング方法をカスタマイズする:

     >>> import json
     >>> def as_complex(dct):
     ...     if '__complex__' in dct:
     ...         return complex(dct['real'], dct['imag'])
     ...     return dct
     ...
     >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}',
     ...     object_hook=as_complex)
     (1+2j)
     >>> import decimal
     >>> json.loads('1.1', parse_float=decimal.Decimal)
     Decimal('1.1')

*note JSONEncoder: f42. の拡張:

     >>> import json
     >>> class ComplexEncoder(json.JSONEncoder):
     ...     def default(self, obj):
     ...         if isinstance(obj, complex):
     ...             return [obj.real, obj.imag]
     ...         # Let the base class default method raise the TypeError
     ...         return super().default(obj)
     ...
     >>> json.dumps(2 + 1j, cls=ComplexEncoder)
     '[2.0, 1.0]'
     >>> ComplexEncoder().encode(2 + 1j)
     '[2.0, 1.0]'
     >>> list(ComplexEncoder().iterencode(2 + 1j))
     ['[2.0', ', 1.0', ']']

Using ‘json’ from the shell to validate and pretty-print:

     $ echo '{"json":"obj"}' | python -m json
     {
         "json": "obj"
     }
     $ echo '{1.2:3.4}' | python -m json
     Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

詳細については *note コマンドライン・インターフェース: 23e. を参照してく
ださい。

     注釈: JSON は YAML(8) 1.2 のサブセットです。このモジュールのデフォ
     ルト設定 (特に、デフォルトの 'セパレータ' 値) で生成される JSON は
     YAML 1.0 および 1.1 のサブセットでもあります。このモジュールは YAML
     シリアライザとしても使えます。

     注釈: このモジュールのエンコーダとデコーダは、デフォルトで入力順と
     出力順を保つようになっています。根底のコンテナに順序がない場合のみ
     、順序が失われます。

* Menu:

* 基本的な使い方: 基本的な使い方<4>.
* エンコーダとデコーダ::
* 例外: 例外<20>.
* 標準への準拠と互換性::
* コマンドライン・インターフェース: コマンドライン・インターフェース<5>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/json/__init__.py

   (2) https://json.org

   (3) https://datatracker.ietf.org/doc/html/rfc7159.html

   (4) https://datatracker.ietf.org/doc/html/rfc4627.html

   (5) 
https://ecma-international.org/publications-and-standards/standards/ecma-404/

   (6) https://en.wikipedia.org/wiki/JavaScript

   (7) RFC 7159 正誤表
(https://www.rfc-editor.org/errata_search.php?rfc=7159) で述べられている
通り、JSON は (ECMAScript Edition 5.1 の) JavaScript とは逆に、 U+2028
(LINE SEPARATOR) と U+2029 (PARAGRAPH SEPARATOR) が文字列内に含まれるこ
とを許容しています。

   (8) https://yaml.org/


File: python.info,  Node: 基本的な使い方<4>,  Next: エンコーダとデコーダ,  Up: json --- JSON エンコーダーとデコーダー

5.20.2.1 基本的な使い方
.......................

 -- の関数: json.dump (obj, fp, *, skipkeys=False, ensure_ascii=True,
          check_circular=True, allow_nan=True, cls=None, indent=None,
          separators=None, default=None, sort_keys=False, **kw)

     この *note PythonからJSONへの変換表: 3bd8. を使って、 'obj' を JSON
     形式の 'fp' (‘.write()’ がサポートされている *note file-like
     object: 17ac.) へのストリームとして直列化します。

          注釈: *note pickle: ab. や *note marshal: 91. とは異なり JSON
          はフレーム付きのプロトコルではないので、同じ 'fp' に対し繰り返
          し *note dump(): f40. を呼び、複数のオブジェクトを直列化しよう
          とすると、不正な JSON ファイルが作られてしまいます。


     パラメータ:

        * ‘obj’ (*note object: c7e.) - The Python object to be
          serialized.

        * ‘fp’ (*note file-like object: 17ac.) - The file-like object
          'obj' will be serialized to.  The ‘json’ module always
          produces *note str: 169. objects, not *note bytes: 192.
          objects, therefore ‘fp.write()’ must support *note str: 169.
          input.

        * ‘skipkeys’ (*note bool: 3c3.) - If ‘True’, keys that are not
          of a basic type (*note str: 169, *note int: 19b, *note float:
          196, *note bool: 3c3, ‘None’) will be skipped instead of
          raising a *note TypeError: 198.  Default ‘False’.

        * ‘ensure_ascii’ (*note bool: 3c3.) - If ‘True’ (the default),
          the output is guaranteed to have all incoming non-ASCII and
          non-printable characters escaped.  If ‘False’, all characters
          will be outputted as-is, except for the characters that must
          be escaped: quotation mark, reverse solidus, and the control
          characters U+0000 through U+001F.

        * ‘check_circular’ (*note bool: 3c3.) - If ‘False’, the circular
          reference check for container types is skipped and a circular
          reference will result in a *note RecursionError: f68. (or
          worse).  Default ‘True’.

        * ‘allow_nan’ (*note bool: 3c3.) - If ‘False’, serialization of
          out-of-range *note float: 196. values (‘nan’, ‘inf’, ‘-inf’)
          will result in a *note ValueError: 2ec, in strict compliance
          with the JSON specification.  If ‘True’ (the default), their
          JavaScript equivalents (‘NaN’, ‘Infinity’, ‘-Infinity’) are
          used.

        * ‘cls’ (a *note JSONEncoder: f42. subclass) - If set, a custom
          JSON encoder with the *note default(): 3bd9. method
          overridden, for serializing into custom datatypes.  If ‘None’
          (the default), ‘JSONEncoder’ is used.

        * ‘indent’ (*note int: 19b.‘ | ’*note str: 169.‘ | ’‘None’) - If
          a positive integer or string, JSON array elements and object
          members will be pretty-printed with that indent level.  A
          positive integer indents that many spaces per level; a string
          (such as ‘"\t"’) is used to indent each level.  If zero,
          negative, or ‘""’ (the empty string), only newlines are
          inserted.  If ‘None’ (the default), the most compact
          representation is used.

        * ‘separators’ (*note tuple: 614.‘ | ’‘None’) - A two-tuple:
          ‘(item_separator, key_separator)’.  If ‘None’ (the default),
          'separators' defaults to ‘(', ', ': ')’ if 'indent' is ‘None’,
          and ‘(',', ': ')’ otherwise.  For the most compact JSON,
          specify ‘(',', ':')’ to eliminate whitespace.

        * ‘default’ (*note callable: 2d7b. | None) - A function that is
          called for objects that can't otherwise be serialized.  It
          should return a JSON encodable version of the object or raise
          a *note TypeError: 198.  If ‘None’ (the default), ‘TypeError’
          is raised.

        * ‘sort_keys’ (*note bool: 3c3.) - If ‘True’, dictionaries will
          be outputted sorted by key.  Default ‘False’.

     バージョン 3.2 で変更: 整数に加えて、文字列が 'indent' に使用できる
     ようになりました。

     バージョン 3.4 で変更: 'indent' が ‘None’ でなければ ‘(',', ': ')’
     がデフォルトで使われます。

     バージョン 3.6 で変更: すべてのオプション引数は、 *note
     キーワード専用: 5a5. になりました。

 -- の関数: json.dumps (obj, *, skipkeys=False, ensure_ascii=True,
          check_circular=True, allow_nan=True, cls=None, indent=None,
          separators=None, default=None, sort_keys=False, **kw)

     この *note 変換表: 3bd8. を使って、'obj' を JSON 形式の *note str:
     169. オブジェクトに直列化します。引数は *note dump(): f40. と同じ意
     味です。

          注釈: JSON のキー値ペアのキーは、常に *note str: 169. 型です。
          辞書が JSON に変換されるとき、辞書の全てのキーは文字列へ強制的
          に変換が行われます。この結果として、辞書が JSON に変換され、そ
          れから辞書に戻された場合、辞書は元のものと同じではありません。
          つまり文字列ではないキーを持っている場合、 ‘loads(dumps(x)) !=
          x’ となるということです。

 -- の関数: json.load (fp, *, cls=None, object_hook=None,
          parse_float=None, parse_int=None, parse_constant=None,
          object_pairs_hook=None, **kw)

     Deserialize 'fp' to a Python object using the *note JSON-to-Python
     conversion table: 3bda.


     パラメータ:

        * ‘fp’ (*note file-like object: 17ac.) - A ‘.read()’-supporting
          *note text file: 206d. or *note binary file: 206e. containing
          the JSON document to be deserialized.

        * ‘cls’ (a *note JSONDecoder: f43. subclass) - If set, a custom
          JSON decoder.  Additional keyword arguments to ‘load()’ will
          be passed to the constructor of 'cls'.  If ‘None’ (the
          default), ‘JSONDecoder’ is used.

        * ‘object_hook’ (*note callable: 2d7b. | None) - If set, a
          function that is called with the result of any JSON object
          literal decoded (a *note dict: 183.).  The return value of
          this function will be used instead of the *note dict: 183.
          This feature can be used to implement custom decoders, for
          example JSON-RPC(1) class hinting.  Default ‘None’.

        * ‘object_pairs_hook’ (*note callable: 2d7b. | None) - If set, a
          function that is called with the result of any JSON object
          literal decoded with an ordered list of pairs.  The return
          value of this function will be used instead of the *note dict:
          183.  This feature can be used to implement custom decoders.
          If 'object_hook' is also set, 'object_pairs_hook' takes
          priority.  Default ‘None’.

        * ‘parse_float’ (*note callable: 2d7b. | None) - If set, a
          function that is called with the string of every JSON float to
          be decoded.  If ‘None’ (the default), it is equivalent to
          ‘float(num_str)’.  This can be used to parse JSON floats into
          custom datatypes, for example *note decimal.Decimal: 1fe.

        * ‘parse_int’ (*note callable: 2d7b. | None) - If set, a
          function that is called with the string of every JSON int to
          be decoded.  If ‘None’ (the default), it is equivalent to
          ‘int(num_str)’.  This can be used to parse JSON integers into
          custom datatypes, for example *note float: 196.

        * ‘parse_constant’ (*note callable: 2d7b. | None) - If set, a
          function that is called with one of the following strings:
          ‘'-Infinity'’, ‘'Infinity'’, or ‘'NaN'’.  This can be used to
          raise an exception if invalid JSON numbers are encountered.
          Default ‘None’.


     例外:

        * *note JSONDecodeError: 1022. - When the data being
          deserialized is not a valid JSON document.

        * *note UnicodeDecodeError: c08. - When the data being
          deserialized does not contain UTF-8, UTF-16 or UTF-32 encoded
          data.

     バージョン 3.1 で変更:

        * Added the optional 'object_pairs_hook' parameter.

        * 'null', 'true', 'false' に対して 'parse_constant' は呼びされま
          せん。

     バージョン 3.6 で変更:

        * すべてのオプション引数は、 *note キーワード専用: 5a5. になりま
          した。

        * 'fp' には *note binary file: 206e. 型も使えるようになりました
          。入力のエンコーディングは UTF-8, UTF-16, UTF-32 のいずれかで
          なければなりません。

     バージョン 3.11 で変更: デフォルトの 'parse_int' である *note
     int(): 19b. は、インタープリタの *note integer string conversion
     length limitation: 80b. により整数文字列の最大長を制限するようにな
     り、サービスを妨害する攻撃を拒否します。

 -- の関数: json.loads (s, *, cls=None, object_hook=None,
          parse_float=None, parse_int=None, parse_constant=None,
          object_pairs_hook=None, **kw)

     Identical to *note load(): eb2, but instead of a file-like object,
     deserialize 's' (a *note str: 169, *note bytes: 192. or *note
     bytearray: 344. instance containing a JSON document) to a Python
     object using this *note conversion table: 3bda.

     バージョン 3.6 で変更: 's' には *note bytes: 192. 型と *note
     bytearray: 344. 型も使えるようになりました。 入力エンコーディングは
     UTF-8, UTF-16, UTF-32 のいずれかでなければなりません。

     バージョン 3.9 で変更: キーワード引数 'encoding' が削除されました。

   ---------- Footnotes ----------

   (1) https://www.jsonrpc.org


File: python.info,  Node: エンコーダとデコーダ,  Next: 例外<20>,  Prev: 基本的な使い方<4>,  Up: json --- JSON エンコーダーとデコーダー

5.20.2.2 エンコーダとデコーダ
.............................

 -- クラス: json.JSONDecoder (*, object_hook=None, parse_float=None,
          parse_int=None, parse_constant=None, strict=True,
          object_pairs_hook=None)

     単純な JSON デコーダ。

     デフォルトではデコーディングの際、以下の変換を行います:

     JSON                Python
                         
     --------------------------------------------
                         
     object              dict
                         
                         
     array               list
                         
                         
     string              str
                         
                         
     number (int)        int
                         
                         
     number (real)       浮動小数点数
                         
                         
     true                True
                         
                         
     false               False
                         
                         
     null                None
                         

     また、このデコーダは ‘NaN’, ‘Infinity’, ‘-Infinity’ を対応する
     ‘float’ の値として、JSON の仕様からは外れますが、理解します。

     'object_hook' is an optional function that will be called with the
     result of every JSON object decoded and its return value will be
     used in place of the given *note dict: 183.  This can be used to
     provide custom deserializations (e.g.  to support JSON-RPC(1) class
     hinting).

     'object_pairs_hook' is an optional function that will be called
     with the result of every JSON object decoded with an ordered list
     of pairs.  The return value of 'object_pairs_hook' will be used
     instead of the *note dict: 183.  This feature can be used to
     implement custom decoders.  If 'object_hook' is also defined, the
     'object_pairs_hook' takes priority.

     バージョン 3.1 で変更: 'object_pairs_hook' のサポートが追加されまし
     た。

     'parse_float' is an optional function that will be called with the
     string of every JSON float to be decoded.  By default, this is
     equivalent to ‘float(num_str)’.  This can be used to use another
     datatype or parser for JSON floats (e.g.  *note decimal.Decimal:
     1fe.).

     'parse_int' is an optional function that will be called with the
     string of every JSON int to be decoded.  By default, this is
     equivalent to ‘int(num_str)’.  This can be used to use another
     datatype or parser for JSON integers (e.g.  *note float: 196.).

     'parse_constant' is an optional function that will be called with
     one of the following strings: ‘'-Infinity'’, ‘'Infinity'’, ‘'NaN'’.
     This can be used to raise an exception if invalid JSON numbers are
     encountered.

     'strict' が false (デフォルトは ‘True’) の場合、制御文字を文字列に
     含めることができます。ここで言う制御文字とは、‘'\t'’ (タブ)、
     ‘'\n'’、‘'\r'’、‘'\0'’ を含む 0-31 の範囲のコードを持つ文字のことで
     す。

     脱直列化しようとしているデータが不正な JSON ドキュメントだった場合
     、 *note JSONDecodeError: 1022. が送出されます。

     バージョン 3.6 で変更: すべての引数は、 *note キーワード専用: 5a5.
     になりました。

      -- メソッド: decode (s)

          's' (*note str: 169. インスタンスで JSON 文書を含むもの) の
          Python 表現を返します。

          不正な JSON ドキュメントが与えられた場合、 *note
          JSONDecodeError: 1022. が送出されます。

      -- メソッド: raw_decode (s)

          's' (*note str: 169. インスタンスで JSON 文書で始まるもの) か
          ら JSON 文書をデコードし、Python 表現と 's' の文書の終わるとこ
          ろのインデックスからなる 2 要素のタプルを返します。

          このメソッドは後ろに余分なデータを従えた文字列から JSON 文書を
          デコードするのに使えます。

 -- クラス: json.JSONEncoder (*, skipkeys=False, ensure_ascii=True,
          check_circular=True, allow_nan=True, sort_keys=False,
          indent=None, separators=None, default=None)

     Python データ構造に対する拡張可能な JSON エンコーダ。

     デフォルトでは以下のオブジェクトと型をサポートします:

     Python                                       JSON
                                                  
     -----------------------------------------------------------------
                                                  
     dict                                         object
                                                  
                                                  
     list, tuple                                  array
                                                  
                                                  
     str                                          string
                                                  
                                                  
     int、float と int や float の派生列挙型      number
                                                  
                                                  
     True                                         true
                                                  
                                                  
     False                                        false
                                                  
                                                  
     None                                         null
                                                  

     バージョン 3.4 で変更: int と float の派生列挙型クラスの対応が追加
     されました。

     このクラスを拡張して他のオブジェクトも認識するようにするには、サブ
     クラスを作って *note default(): 3bd9. メソッドを次のように実装しま
     す。もう一つ別のメソッドでオブジェクト ‘o’ に対する直列化可能なオブ
     ジェクトを返すものを呼び出すようにします。変換できない時はスーパー
     クラスの実装を (*note TypeError: 198. を送出させるために) 呼ばなけ
     ればなりません。

     If 'skipkeys' is false (the default), a *note TypeError: 198. will
     be raised when trying to encode keys that are not *note str: 169,
     *note int: 19b, *note float: 196, *note bool: 3c3. or ‘None’.  If
     'skipkeys' is true, such items are simply skipped.

     If 'ensure_ascii' is true (the default), the output is guaranteed
     to have all incoming non-ASCII and non-printable characters
     escaped.  If 'ensure_ascii' is false, all characters will be output
     as-is, except for the characters that must be escaped: quotation
     mark, reverse solidus, and the control characters U+0000 through
     U+001F.

     'check_circular' が true (デフォルト) ならば、リスト、辞書および自
     作でエンコードしたオブジェクトは循環参照がないかエンコード中にチェ
     ックされ、無限再帰 (これは *note RecursionError: f68. を引き起こし
     ます) を防止します。 ‘True’ でない場合は、そういったチェックは施さ
     れません。

     'allow_nan' が true (デフォルト) ならば、 ‘NaN’, ‘Infinity’,
     ‘-Infinity’ はそのままエンコードされます。この振る舞いは JSON 仕様
     に従っていませんが、大半の JavaScript ベースのエンコーダ、デコーダ
     と矛盾しません。 ‘True’ でない場合は、そのような浮動小数点数をエン
     コードすると *note ValueError: 2ec. が送出されます。

     'sort_keys' が true (デフォルトは ‘False’) ならば、辞書の出力がキー
     でソートされます。これは JSON の直列化がいつでも比較できるようにな
     るので回帰試験の際に便利です。

     'indent' が非負の整数または文字列であれば、JSON の配列要素とオブジ
     ェクトメンバはそのインデントレベルで見やすく表示されます。インデン
     トレベルが 0 か負数または ‘""’ であれば 改行だけが挿入されます。
     ‘None’ (デフォルト) では最もコンパクトな表現が選択されます。正の数
     のindentはレベル毎に、指定した数のスペースでインデントします。もし
     'indent' が文字列 (‘"\t"’ のような) であれば、その文字列が個々のレ
     ベルのインデントに使用されます。

     バージョン 3.2 で変更: 整数に加えて、文字列が 'indent' に使用できる
     ようになりました。

     'separators' はもし指定するなら ‘(item_separator, key_separator)’ と
     いうタプルでなければなりません。デフォルトは 'indent' が ‘None’ の
     とき ‘(', ', ': ')’ で、そうでなければ ‘(',', ': ')’ です。最もコン
     パクトな JSON の表現を得たければ空白を削った ‘(',', ':')’ を指定す
     ればいいでしょう。

     バージョン 3.4 で変更: 'indent' が ‘None’ でなければ ‘(',', ': ')’
     がデフォルトで使われます。

     'default' を指定する場合は関数を指定して、この関数はそれ以外では直
     列化できないオブジェクトに対して呼び出されます。 その関数は、オブジ
     ェクトを JSON でエンコードできるバージョンにして返すか、さもなけれ
     ば *note TypeError: 198. を送出しなければなりません。 指定しない場
     合は、 *note TypeError: 198. が送出されます。

     バージョン 3.6 で変更: すべての引数は、 *note キーワード専用: 5a5.
     になりました。

      -- メソッド: default (o)

          このメソッドをサブクラスで実装する際には 'o' に対して直列化可
          能なオブジェクトを返すか、基底クラスの実装を (*note TypeError:
          198. を送出するために) 呼び出すかします。

          例えば、任意のイテレータをサポートする場合、 *note default():
          3bd9. をこのように実装できます

               def default(self, o):
                  try:
                      iterable = iter(o)
                  except TypeError:
                      pass
                  else:
                      return list(iterable)
                  # Let the base class default method raise the TypeError
                  return super().default(o)

      -- メソッド: encode (o)

          Python データ構造 'o' の JSON 文字列表現を返します。たとえば:

               >>> json.JSONEncoder().encode({"foo": ["bar", "baz"]})
               '{"foo": ["bar", "baz"]}'

      -- メソッド: iterencode (o)

          与えられたオブジェクト 'o' をエンコードし、得られた文字列表現
          ごとに yield します。たとえば:

               for chunk in json.JSONEncoder().iterencode(bigobject):
                   mysocket.write(chunk)

   ---------- Footnotes ----------

   (1) https://www.jsonrpc.org


File: python.info,  Node: 例外<20>,  Next: 標準への準拠と互換性,  Prev: エンコーダとデコーダ,  Up: json --- JSON エンコーダーとデコーダー

5.20.2.3 例外
.............

 -- 例外: json.JSONDecodeError (msg, doc, pos)

     *note ValueError: 2ec. のサブクラスで、以下の追加の属性を持ちます:

      -- の属性: msg

          フォーマットされていないエラーメッセージです。

      -- の属性: doc

          パース対象 JSON ドキュメントです。

      -- の属性: pos

          'doc' の、解析に失敗した開始インデクスです。

      -- の属性: lineno

          'pos' に対応する行です。

      -- の属性: colno

          'pos' に対応する列です。

     Added in version 3.5.


File: python.info,  Node: 標準への準拠と互換性,  Next: コマンドライン・インターフェース<5>,  Prev: 例外<20>,  Up: json --- JSON エンコーダーとデコーダー

5.20.2.4 標準への準拠と互換性
.............................

The JSON format is specified by RFC 7159(1) and by ECMA-404(2).  This
section details this module's level of compliance with the RFC. For
simplicity, *note JSONEncoder: f42. and *note JSONDecoder: f43.
subclasses, and parameters other than those explicitly mentioned, are
not considered.

このモジュールは、JavaScript では正しいが JSON では不正ないくつかの拡張
が実装されているため、厳密な意味では RFC に準拠していません。特に:

   - 無限および NaN の数値を受け付け、また出力します;

   - あるオブジェクト内での同じ名前の繰り返しを受け付け、最後の名前と値
     のペアの値のみを使用します。

この RFC は、RFC 準拠のパーサが RFC 準拠でない入力テキストを受け付けるこ
とを許容しているので、このモジュールの脱直列化は技術的に言えば、デフォル
トの設定では RFC に準拠しています。

* Menu:

* 文字エンコーディング::
* 無限および NaN の数値::
* オブジェクト中に重複した名前の扱い::
* トップレベルの非オブジェクト、非配列の値の扱い::
* 実装の制限::

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc7159.html

   (2) 
https://ecma-international.org/publications-and-standards/standards/ecma-404/


File: python.info,  Node: 文字エンコーディング,  Next: 無限および NaN の数値,  Up: 標準への準拠と互換性

5.20.2.5 文字エンコーディング
.............................

RFC は、UTF-8、UTF-16、UTF-32のいずれかでJSONを表現するように要求してお
り、UTF-8 が最大の互換性を確保するために推奨されるデフォルトです。

As permitted, though not required, by the RFC, this module's serializer
sets 'ensure_ascii=True' by default, thus escaping the output so that
the resulting strings only contain printable ASCII characters.

'ensure_ascii' パラメータ以外は、このモジュールは Python オブジェクトと
*note Unicode 文字列: 169. の間の変換において厳密に定義されていて、それ
以外のパラメータで文字エンコーディングに直接的に関わるものはありません。

RFC は JSON テキストの最初にバイトオーダマーク(BOM)を追加することを禁止
していますので、このモジュールはその出力に BOM を追加しません。RFC は
JSON デシリアライザが入力の一番最初の BOM を無視することを、許容はします
が求めてはいません。このモジュールのデシリアライザは一番最初の BOM を見
つけると *note ValueError: 2ec. を送出します。

RFC は JSON 文字列に正当な Unicode 文字に対応付かないバイト列(例えばペア
にならない UTF-16 サロゲートのかたわれ)が含まれることを明示的に禁止して
はおらず、もちろんこれは相互運用性の問題を引き起こします。デフォルトでは
、このモジュールは(オリジナルの *note str: 169. にある場合)そのようなシ
ーケンスのコードポイントを受け取り、出力します。


File: python.info,  Node: 無限および NaN の数値,  Next: オブジェクト中に重複した名前の扱い,  Prev: 文字エンコーディング,  Up: 標準への準拠と互換性

5.20.2.6 無限および NaN の数値
..............................

RFC は、無限もしくは NaN の数値の表現は許可していません。それにも関わら
ずデフォルトでは、このモジュールは ‘Infinity’、‘-Infinity’、‘NaN’ を正し
い JSON の数値リテラルの値であるかのように受け付け、出力します:

     >>> # Neither of these calls raises an exception, but the results are not valid JSON
     >>> json.dumps(float('-inf'))
     '-Infinity'
     >>> json.dumps(float('nan'))
     'NaN'
     >>> # Same when deserializing
     >>> json.loads('-Infinity')
     -inf
     >>> json.loads('NaN')
     nan

シリアライザでは、この振る舞いを変更するのに 'allow_nan' パラメータが使
えます。デシリアライザでは、この振る舞いを変更するのに 'parse_constant'
パラメータが使えます。


File: python.info,  Node: オブジェクト中に重複した名前の扱い,  Next: トップレベルの非オブジェクト、非配列の値の扱い,  Prev: 無限および NaN の数値,  Up: 標準への準拠と互換性

5.20.2.7 オブジェクト中に重複した名前の扱い
...........................................

RFC は JSON オブジェクト中の名前はユニークでなければならないと規定してい
ますが、JSONオブジェクトで名前が繰り返された場合の扱いについて指定してい
ません。デフォルトでは、このモジュールは例外を送出せず、かわりに重複した
名前のうち、最後に出現した名前と値のペア以外を無視します。

     >>> weird_json = '{"x": 1, "x": 2, "x": 3}'
     >>> json.loads(weird_json)
     {'x': 3}

'object_pairs_hook' パラメータでこの動作を変更できます。


File: python.info,  Node: トップレベルの非オブジェクト、非配列の値の扱い,  Next: 実装の制限,  Prev: オブジェクト中に重複した名前の扱い,  Up: 標準への準拠と互換性

5.20.2.8 トップレベルの非オブジェクト、非配列の値の扱い
.......................................................

廃止された RFC 4627(1) によって規定された古いバージョンの JSON では、
JSON テキストのトップレベルの値は JSON オブジェクトか配列(Python での
*note dict: 183. か *note list: 24d.)であることを要求していて、JSON の
null, boolean, number, string であることは許されていませんでしたが、この
制限は RFC 7159(2) により取り払われました。このモジュールはこの制限を持
っていませんし、シリアライザでもデシリアライズでも、一度としてこの制限で
実装されたことはありません。

それにも関わらず、相互運用可能性を最大化したいならば、あなた自身の手で自
発的にその制約に忠実に従いたいと思うでしょう。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc4627.html

   (2) https://datatracker.ietf.org/doc/html/rfc7159.html


File: python.info,  Node: 実装の制限,  Prev: トップレベルの非オブジェクト、非配列の値の扱い,  Up: 標準への準拠と互換性

5.20.2.9 実装の制限
...................

いくつかの JSON デシリアライザの実装は、以下の制限を設定することがありま
す。

   * 受け入れられる JSON テキストのサイズ

   * JSON オブジェクトと配列のネストの最大の深さ

   * JSON 数値の範囲と精度

   * JSON 文字列の内容と最大の長さ

このモジュールは関連する Python データ型や Python インタプリタ自身の制約
の世界を超えたそのような制約を強要はしません。

JSON にシリアライズする際には、あなたの JSON を消費する側のアプリケーシ
ョンが持つ当該制約に思いを馳せてください。とりわけJSON 数値を IEEE 754 倍
精度浮動小数にデシリアライズする際の問題はありがちで、すなわちその有効桁
数と精度の制限の影響を受けます。これは、極端に大きな値を持った Python
*note int: 19b. をシリアライズするとき、あるいは *note decimal.Decimal:
1fe. のような "風変わりな" 数値型をシリアライズするとき、に特に関係があ
ります。


File: python.info,  Node: コマンドライン・インターフェース<5>,  Prev: 標準への準拠と互換性,  Up: json --- JSON エンコーダーとデコーダー

5.20.2.10 コマンドライン・インターフェース
..........................................

'ソースコード:' Lib/json/tool.py(1)

__________________________________________________________________

The ‘json’ module can be invoked as a script via ‘python -m json’ to
validate and pretty-print JSON objects.  The ‘json.tool’ submodule
implements this interface.

オプション引数の ‘infile’ と ‘outfile’ が指定されない場合、それぞれ
*note sys.stdin: 75f. と *note sys.stdout: ccd. が使用されます。

     $ echo '{"json": "obj"}' | python -m json
     {
         "json": "obj"
     }
     $ echo '{1.2:3.4}' | python -m json
     Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

バージョン 3.5 で変更: 出力が、入力と同じ順序になりました。辞書をキーで
アルファベット順に並べ替えた出力が欲しければ、 *note -sort-keys: 3bed. オ
プションを使ってください。

バージョン 3.14 で変更: The ‘json’ module may now be directly executed
as ‘python -m json’.  For backwards compatibility, invoking the CLI as
‘python -m json.tool’ remains supported.

* Menu:

* コマンドラインオプション: コマンドラインオプション<4>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/json/tool.py


File: python.info,  Node: コマンドラインオプション<4>,  Up: コマンドライン・インターフェース<5>

5.20.2.11 コマンドラインオプション
..................................

 -- Option: infile

     検証を行う、あるいは整形出力を行う JSON ファイルを指定します:

          $ python -m json mp_films.json
          [
              {
                  "title": "And Now for Something Completely Different",
                  "year": 1971
              },
              {
                  "title": "Monty Python and the Holy Grail",
                  "year": 1975
              }
          ]

     'infile' が指定されない場合、 *note sys.stdin: 75f. から読み込みま
     す。

 -- Option: outfile

     'infile' の出力を 'outfile' に書き込みます。そうでない場合、 *note
     sys.stdout: ccd. に書き込みます。

 -- Option: --sort-keys

     辞書の出力を、キーのアルファベット順にソートします。

     Added in version 3.5.

 -- Option: --no-ensure-ascii

     非 ASCII 文字のエスケープを無効化します。より詳しくは *note
     json.dumps(): f41. を参照してください。

     Added in version 3.9.

 -- Option: --json-lines

     すべての入力行を個別のJSON オブジェクトとしてパースします。

     Added in version 3.8.

 -- Option: --indent, --tab, --no-indent, --compact

     空白文字の制御のための排他的なオプション。

     Added in version 3.9.

 -- Option: -h, --help

     ヘルプメッセージを出力します

脚注
....


File: python.info,  Node: mailbox --- 様々な形式のメールボックスを操作する,  Next: mimetypes --- ファイル名を MIME タイプへマップする,  Prev: json --- JSON エンコーダーとデコーダー,  Up: インターネット上のデータの操作

5.20.3 ‘mailbox’ -- 様々な形式のメールボックスを操作する
--------------------------------------------------------

'ソースコード:' Lib/mailbox.py(1)

__________________________________________________________________

このモジュールでは二つのクラス *note Mailbox: 1463. および *note
Message: 1468. をディスク上のメールボックスとそこに収められたメッセージ
へのアクセスと操作のために定義しています。 ‘Mailbox’ は辞書のようなキー
からメッセージへの対応付けを提供しています。 ‘Message’ は *note
email.message: 48. モジュールの *note Message: 581. を拡張して形式ごとの
状態と振る舞いを追加しています。サポートされるメールボックスの形式は
Maildir, mbox, MH, Babyl, MMDF です。

参考
....

*note email: 3f. モジュール

     メッセージの表現と操作。

* Menu:

* Mailbox オブジェクト::
* Message オブジェクト::
* 例外: 例外<21>.
* 使用例: 使用例<31>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/mailbox.py


File: python.info,  Node: Mailbox オブジェクト,  Next: Message オブジェクト,  Up: mailbox --- 様々な形式のメールボックスを操作する

5.20.3.1 ‘Mailbox’ オブジェクト
...............................

 -- クラス: mailbox.Mailbox

     メールボックス。内容を確認したり変更したりできます。

     ‘Mailbox’ クラスはインターフェースを定義するもので、インスタンス化
     されることは想定していません。代わりに、‘Mailbox’ から継承した形式
     ごとのサブクラスを作り、コードでは特定のサブクラスをインスタンス化
     するべきです。

     ‘Mailbox’ のインターフェースは辞書風で、小さなキーがメッセージに対
     応します。キーは対象となる ‘Mailbox’ インスタンスが発行するもので、
     その ‘Mailbox’ インスタンスに対してのみ意味を持ちます。一つのキーは
     一つのメッセージにひも付けられ、その対応はメッセージが他のメッセー
     ジで置き換えられるような更新をされたあとも続きます。

     メッセージを ‘Mailbox’ インスタンスに追加するには集合風のメソッド
     *note add(): 1464. を使います。また削除は ‘del’ 文または集合風の
     *note remove(): 3bfe. や *note discard(): 3bff. を使って行ないます
     。

     ‘Mailbox’ インターフェースのセマンティクスと辞書のそれとは注意すべ
     き違いがあります。メッセージは、要求されるたびに新しい表現(典型的に
     は *note Message: 1468. インスタンス)が現在のメールボックスの状態に
     基づいて生成されます。同様に、メッセージが ‘Mailbox’ インスタンスに
     追加される時も、渡されたメッセージ表現の内容がコピーされます。どち
     らの場合も ‘Mailbox’ インスタンスにメッセージ表現への参照は保たれま
     せん。

     デフォルトの ‘Mailbox’ *note イテレータ: 4c8. はメッセージ表現ごと
     に繰り返すもので、*note 辞書: 183. のイテレータのようにキーごとの繰
     り返しではありません。さらに、繰り返し中のメールボックスを変更する
     ことは安全であり整合的に定義されています。イテレータが作られた後に
     メールボックスに追加されたメッセージはそのイテレータからは見えませ
     ん。そのイテレータが yield するまえにメールボックスから削除されたメ
     ッセージは黙ってスキップされますが、イテレータからのキーを使ったと
     きにはそのキーに対応するメッセージが削除されているならば *note
     KeyError: 5e7. を受け取ることになります。

          警告: 十分な注意を、何か他のプロセスによっても同時に変更される
          可能性のあるメールボックスを更新する時は、払わなければなりませ
          ん。そのようなタスクをこなすのに最も安全なメールボックス形式は
          *note Maildir: 65e. で、 *note mbox: 19fb. のような単一ファイ
          ルの形式を並行した書き込みに利用するのは避けるように努力しまし
          ょう。メールボックスを更新する場面では、 '必ず' *note lock():
          3c00. と *note unlock(): 3c01. メソッドを、ファイル内のメッセ
          ージを読んだり書き込んだり削除したりといった操作をする '前' に
          、呼び出してロックします。メールボックスをロックし損なうと、メ
          ッセージを失ったりメールボックス全体をぐちゃぐちゃにしたりする
          羽目に陥ります。

     ‘Mailbox’ インスタンスには次のメソッドがあります:

      -- メソッド: add (message)

          メールボックスに 'message' を追加し、それに割り当てられたキー
          を返します。

          引数 'message' は *note Message: 1468. インスタンス、 *note
          email.message.Message: 581. インスタンス、文字列、バイト文字列
          、ファイル風オブジェクト (バイナリモードで開かれていなければな
          りません) を使えます。 'message' が適切な形式に特化した *note
          Message: 1468. サブクラスのインスタンス (例えばメールボックス
          が *note mbox: 19fb. インスタンスのときの *note mboxMessage:
          3abf. インスタンス) であれば、形式ごとの情報が利用されます。そ
          うでなければ、形式ごとに必要な情報は適当なデフォルトが使われま
          す。

          バージョン 3.2 で変更: バイナリ入力のサポートが追加されました
          。

      -- メソッド: remove (key)
      -- メソッド: __delitem__ (key)
      -- メソッド: discard (key)

          メールボックスから 'key' に対応するメッセージを削除します。

          対応するメッセージが無い場合、メソッドが *note remove(): 3bfe.
          または *note __delitem__(): 3c02. として呼び出されている時は
          *note KeyError: 5e7. 例外が送出されます。しかし、 *note
          discard(): 3bff. として呼び出されている場合は例外は発生しませ
          ん。基づいているメールボックス形式が別のプロセスからの平行した
          変更をサポートしているならば、この *note discard(): 3bff. の振
          る舞いの方が好まれるかもしれません。

      -- メソッド: __setitem__ (key, message)

          'key' に対応するメッセージを 'message' で置き換えます。 'key'
          に対応しているメッセージが既に無くなっている場合 *note
          KeyError: 5e7. 例外が送出されます。

          *note add(): 1464. と同様に、引数の 'message' には *note
          Message: 1468. インスタンス、 *note email.message.Message:
          581. インスタンス、文字列、バイト文字列、ファイル風オブジェク
          ト (バイナリモードで開かれていなければなりません) を使えます。
          'message' が適切な形式に特化した *note Message: 1468. サブクラ
          スのインスタンス (例えばメールボックスが *note mbox: 19fb. イ
          ンスタンスのときの *note mboxMessage: 3abf. インスタンス) であ
          れば、形式ごとの情報が利用されます。そうでなければ、現在 'key'
          に対応するメッセージの形式ごとの情報が変更されずに残ります。

      -- メソッド: iterkeys ()

          Return an *note iterator: 4c8. over all keys

      -- メソッド: keys ()

          The same as *note iterkeys(): 3c04, except that a *note list:
          24d. is returned rather than an *note iterator: 4c8.

      -- メソッド: itervalues ()
      -- メソッド: __iter__ ()

          全てのメッセージの表現についての *note イテレータ: 4c8. を返し
          ます。メッセージは適切な形式ごとの *note Message: 1468. サブク
          ラスのインスタンスとして表現されるのが普通ですが、 ‘Mailbox’ イ
          ンスタンスが初期化されるときに指定すればお好みのメッセージファ
          クトリを使うこともできます。

               注釈: *note __iter__(): 3c07. は辞書のそれのようにキーに
               ついてのイテレータではありません。

      -- メソッド: values ()

          The same as *note itervalues(): 3c06, except that a *note
          list: 24d. is returned rather than an *note iterator: 4c8.

      -- メソッド: iteritems ()

          ('key', 'message') ペア、ただし 'key' はキーで 'message' はメ
          ッセージ表現、のイテレータを返します。メッセージは適切な形式ご
          との *note Message: 1468. サブクラスのインスタンスとして表現さ
          れるのが普通ですが、 ‘Mailbox’ インスタンスが初期化されるとき
          に指定すればお好みのメッセージファクトリを使うこともできます。

      -- メソッド: items ()

          The same as *note iteritems(): 3c09, except that a *note list:
          24d. of pairs is returned rather than an *note iterator: 4c8.
          of pairs.

      -- メソッド: get (key, default=None)
      -- メソッド: __getitem__ (key)

          'key' に対応するメッセージの表現を返します。対応するメッセージ
          が存在しない場合、 *note get(): 3c0b. として呼び出されたなら
          'default' を返しますが、 ‘__getitem__()’ として呼び出されたな
          ら *note KeyError: 5e7. 例外が送出されます。メッセージは適切な
          形式ごとの *note Message: 1468. サブクラスのインスタンスとして
          表現されるのが普通ですが、 ‘Mailbox’ スタンスが初期化されると
          きに指定すればお好みのメッセージファクトリを使うこともできます
          。

      -- メソッド: get_message (key)

          'key' に対応するメッセージの表現を形式ごとの *note Message:
          1468. サブクラスのインスタンスとして返します。もし対応するメッ
          セージが存在しなければ *note KeyError: 5e7. 例外が送出されます
          。

      -- メソッド: get_bytes (key)

          'key' に対応するメッセージのバイト列を返すか、そのようなメッセ
          ージが存在しない場合は *note KeyError: 5e7. 例外を送出します。

          Added in version 3.2.

      -- メソッド: get_string (key)

          'key' に対応するメッセージの文字列表現を返すか、そのようなメッ
          セージが存在しない場合は *note KeyError: 5e7. 例外を送出します
          。このメッセージは *note email.message.Message: 581. を通して
          処理されて7ビットクリーンな表現へ変換されます。

      -- メソッド: get_file (key)

          'key' に対応するメッセージの表現を *note ファイル風: 17ac. 表
          現として返します。もし対応するメッセージが存在しなければ *note
          KeyError: 5e7. 例外が送出されます。ファイル風オブジェクトはバ
          イナリモードで開かれているように振る舞います。このファイルは必
          要がなくなったら閉じなければなりません。

          バージョン 3.2 で変更: ファイルオブジェクトは実際は *note
          バイナリファイル: 206e. です; 以前は誤ってテキストモードで返さ
          れていました。 また、現在 *note ファイル風オブジェクト: 17ac.
          は *note コンテキストマネージャ: 1e1. プロトコルをサポートして
          います: *note with: 186. 文を用いることで自動的にファイルを閉
          じることができます。

               注釈: 他の表現方法とは違い、*note ファイル風: 17ac. 表現
               はそれを作り出した ‘Mailbox’ インスタンスやそれが基づいて
               いるメールボックスと独立である必要がありません。より詳細
               な説明は各サブクラスごとにあります。

      -- メソッド: __contains__ (key)

          'key' がメッセージに対応していれば ‘True’ を、そうでなければ
          ‘False’ を返します。

      -- メソッド: __len__ ()

          メールボックス中のメッセージ数を返します。

      -- メソッド: clear ()

          メールボックスから全てのメッセージを削除します。

      -- メソッド: pop (key, default=None)

          'key' に対応するメッセージの表現を返します。メッセージは適切な
          形式ごとの *note Message: 1468. サブクラスのインスタンスとして
          表現されるのが普通ですが、 ‘Mailbox’ インスタンスが初期化され
          るときに指定すればお好みのメッセージファクトリを使うこともでき
          ます。

      -- メソッド: popitem ()

          任意に選んだ ('key', 'message') ペアを返します。ただしここで
          'key' はキーで 'message' はメッセージ表現です。もしメールボッ
          クスが空ならば、 *note KeyError: 5e7. 例外を送出します。メッセ
          ージは適切な形式ごとの *note Message: 1468. サブクラスのインス
          タンスとして表現されるのが普通ですが、 ‘Mailbox’ インスタンス
          が初期化されるときに指定すればお好みのメッセージファクトリを使
          うこともできます。

      -- メソッド: update (arg)

          引数 'arg' は 'key' から 'message' へのマッピングまたは
          ('key', 'message') ペアのイテレート可能オブジェクトでなければ
          なりません。メールボックスは、各 'key' と 'message' のペアにつ
          いて *note __setitem__(): 3c03. を使ったかのように 'key' に対
          応するメッセージが 'message' になるように更新されます。 *note
          __setitem__(): 3c03. と同様に、 'key' は既存のメールボックス中
          のメッセージに対応しているものでなければならず、そうでなければ
          *note KeyError: 5e7. が送出されます。ですから、一般的には
          'arg' に ‘Mailbox’ インスタンスを渡すのは間違いです。

               注釈: 辞書と違い、キーワード引数はサポートされていません
               。

      -- メソッド: flush ()

          保留されている変更をファイルシステムに書き込みます。 *note
          Mailbox: 1463. のサブクラスによっては変更はいつも直ちにファイ
          ルに書き込まれ ‘flush()’ は何もしないということもありますが、
          それでもこのメソッドを呼ぶように習慣付けておきましょう。

      -- メソッド: lock ()

          メールボックスの排他的アドバイザリロックを取得し、他のプロセス
          が変更しないようにします。ロックが取得できない場合 *note
          ExternalClashError: 3c14. が送出されます。ロック機構はメールボ
          ックス形式によって変わります。メールボックスの内容に変更を加え
          るときは 'いつも' ロックを掛けるべきです。

      -- メソッド: unlock ()

          メールボックスのロックが存在する場合は解放します。

      -- メソッド: close ()

          メールボックスをフラッシュし、必要ならばアンロックし、開いてい
          るファイルを閉じます。 ‘Mailbox’ サブクラスによっては何もしな
          いこともあります。

* Menu:

* Maildir オブジェクト::
* mbox オブジェクト::
* MH オブジェクト::
* Babyl オブジェクト::
* MMDF オブジェクト::


File: python.info,  Node: Maildir オブジェクト,  Next: mbox オブジェクト,  Up: Mailbox オブジェクト

5.20.3.2 ‘Maildir’ オブジェクト
...............................

 -- クラス: mailbox.Maildir (dirname, factory=None, create=True)

     Maildir 形式のメールボックスのための *note Mailbox: 1463. のサブク
     ラス。パラメータ 'factory' は呼び出し可能オブジェクトで (バイナリモ
     ードで開かれているかのように振る舞う)ファイル風メッセージ表現を受け
     付けて好みの表現を返すものです。 'factory' が ‘None’ ならば、 *note
     MaildirMessage: 3c18. がデフォルトのメッセージ表現として使われます
     。 'create' が ‘True’ ならばメールボックスが存在しないときには作成
     します。

     'create' が ‘True’ で、パス 'dirname' が存在する場合、ディレクトリ
     レイアウトを検証せずに既存の maildir として扱います。

     'path' ではなく 'dirname' と命名される歴史的な理由のためです。

     Maildir はディレクトリ型のメールボックス形式でメール転送エージェン
     ト qmail 用に発明され、現在では多くの他のプログラムでもサポートされ
     ているものです。Maildir メールボックス中のメッセージは共通のディレ
     クトリ構造の下で個別のファイルに保存されます。このデザインにより、
     Maildir メールボックスは複数の無関係のプログラムからデータを失うこ
     となくアクセスしたり変更したりできます。そのためロックは不要です。

     Maildir メールボックスには三つのサブディレクトリ ‘tmp’, ‘new’,
     ‘cur’ があります。メッセージはまず ‘tmp’ サブディレクトリに瞬間的に
     作られた後、 ‘new’ サブディレクトリに移動されて配送を完了します。メ
     ールユーザエージェントが引き続いて ‘cur’ サブディレクトリにメッセー
     ジを移動しメッセージの状態についての情報をファイル名に追加される特
     別な "info" セクションに保存することができます。

     Courier メール転送エージェントによって導入されたスタイルのフォルダ
     もサポートされます。主たるメールボックスのサブディレクトリは ‘'.'’
     がファイル名の先頭であればフォルダと見なされます。フォルダ名は
     ‘Maildir’ によって先頭の ‘'.'’ を除いて表現されます。各フォルダはま
     た Maildir メールボックスですがさらにフォルダを含むことはできません
     。その代わり、論理的包含関係は例えば "Archived.2005.07" のような
     ‘'.'’ を使ったレベル分けで表わされます。

      -- の属性: colon

          本来の Maildir 仕様ではある種のメッセージのファイル名にコロン
          (‘':'’) を使う必要があります。しかしながら、オペレーティングシ
          ステムによってはこの文字をファイル名に含めることができないこと
          があります。そういった環境で Maildir のような形式を使いたい場
          合、代わりに使われる文字を指定する必要があります。感嘆符
          (‘'!'’) を使うのが一般的な選択です。以下の例を見てください:

               import mailbox
               mailbox.Maildir.colon = '!'

          ‘colon’ 属性はインスタンスごとにセットしても構いません。

     バージョン 3.13 で変更: *note Maildir: 65e. now ignores files with
     a leading dot.

     ‘Maildir’ インスタンスには *note Mailbox: 1463. の全てのメソッドに
     加え以下のメソッドもあります:

      -- メソッド: list_folders ()

          全てのフォルダ名のリストを返します。

      -- メソッド: get_folder (folder)

          名前が 'folder' であるフォルダを表わす ‘Maildir’ インスタンス
          を返します。そのようなフォルダが存在しなければ *note
          NoSuchMailboxError: 3c1c. 例外が送出されます。

      -- メソッド: add_folder (folder)

          名前が 'folder' であるフォルダを作り、それを表わす ‘Maildir’ イ
          ンスタンスを返します。

      -- メソッド: remove_folder (folder)

          名前が 'folder' であるフォルダを削除します。もしフォルダに一つ
          でもメッセージが含まれていれば *note NotEmptyError: 3c1f. 例外
          が送出されフォルダは削除されません。

      -- メソッド: clean ()

          過去36時間以内にアクセスされなかったメールボックス内の一時ファ
          イルを削除します。Maildir 仕様はメールを読むプログラムはときど
          きこの作業をすべきだとしています。

      -- メソッド: get_flags (key)

          Return as a string the flags that are set on the message
          corresponding to 'key'.  This is the same as
          ‘get_message(key).get_flags()’ but much faster, because it
          does not open the message file.  Use this method when
          iterating over the keys to determine which messages are
          interesting to get.

          If you do have a *note MaildirMessage: 3c18. object, use its
          *note get_flags(): 3c21. method instead, because changes made
          by the message's *note set_flags(): 3c22, *note add_flag():
          3c23. and *note remove_flag(): 3c24. methods are not reflected
          here until the mailbox's *note __setitem__(): 3c25. method is
          called.

          Added in version 3.13.

      -- メソッド: set_flags (key, flags)

          On the message corresponding to 'key', set the flags specified
          by 'flags' and unset all others.  Calling
          ‘some_mailbox.set_flags(key, flags)’ is similar to

               one_message = some_mailbox.get_message(key)
               one_message.set_flags(flags)
               some_mailbox[key] = one_message

          but faster, because it does not open the message file.

          If you do have a *note MaildirMessage: 3c18. object, use its
          *note set_flags(): 3c22. method instead, because changes made
          with this mailbox method will not be visible to the message
          object's method, *note get_flags(): 3c21.

          Added in version 3.13.

      -- メソッド: add_flag (key, flag)

          On the message corresponding to 'key', set the flags specified
          by 'flag' without changing other flags.  To add more than one
          flag at a time, 'flag' may be a string of more than one
          character.

          Considerations for using this method versus the message
          object's *note add_flag(): 3c23. method are similar to those
          for *note set_flags(): 1a47.; see the discussion there.

          Added in version 3.13.

      -- メソッド: remove_flag (key, flag)

          On the message corresponding to 'key', unset the flags
          specified by 'flag' without changing other flags.  To remove
          more than one flag at a time, 'flag' may be a string of more
          than one character.

          Considerations for using this method versus the message
          object's *note remove_flag(): 3c24. method are similar to
          those for *note set_flags(): 1a47.; see the discussion there.

          Added in version 3.13.

      -- メソッド: get_info (key)

          Return a string containing the info for the message
          corresponding to 'key'.  This is the same as
          ‘get_message(key).get_info()’ but much faster, because it does
          not open the message file.  Use this method when iterating
          over the keys to determine which messages are interesting to
          get.

          If you do have a *note MaildirMessage: 3c18. object, use its
          *note get_info(): 3c26. method instead, because changes made
          by the message's *note set_info(): 3c27. method are not
          reflected here until the mailbox's *note __setitem__(): 3c25.
          method is called.

          Added in version 3.13.

      -- メソッド: set_info (key, info)

          Set the info of the message corresponding to 'key' to 'info'.
          Calling ‘some_mailbox.set_info(key, flags)’ is similar to

               one_message = some_mailbox.get_message(key)
               one_message.set_info(info)
               some_mailbox[key] = one_message

          but faster, because it does not open the message file.

          If you do have a *note MaildirMessage: 3c18. object, use its
          *note set_info(): 3c27. method instead, because changes made
          with this mailbox method will not be visible to the message
          object's method, *note get_info(): 3c26.

          Added in version 3.13.

     ‘Maildir’ で実装された *note Mailbox: 1463. のいくつかのメソッドに
     は特別な注意が必要です:

      -- メソッド: add (message)
      -- メソッド: __setitem__ (key, message)
      -- メソッド: update (arg)

               警告: これらのメソッドは一意的なファイル名をプロセスIDに
               基づいて生成します。複数のスレッドを使う場合は、同じメー
               ルボックスを同時に操作しないようにスレッド間で調整してお
               かないと検知されない名前の衝突が起こりメールボックスを壊
               すかもしれません。

      -- メソッド: flush ()

          Maildir メールボックスへの変更は即時に適用されるので、このメソ
          ッドは何もしません。

      -- メソッド: lock ()
      -- メソッド: unlock ()

          Maildir メールボックスはロックをサポート(または要求)しないので
          、このメソッドは何もしません。

      -- メソッド: close ()

          ‘Maildir’ インスタンスは開いたファイルを保持しませんしメールボ
          ックスはロックをサポートしませんので、このメソッドは何もしませ
          ん。

      -- メソッド: get_file (key)

          ホストのプラットフォームによっては、返されたファイルが開いてい
          る間、元になったメッセージを変更したり削除したりできない場合が
          あります。

参考
....

Courier の maildir マニュアルページ(1)

     Maildir 形式の仕様。フォルダをサポートする一般的な拡張について記述
     されています。

Using maildir format(2)

     Maildir 形式の発明者による注意書き。更新された名前生成規則と "info"
     の解釈についても含まれます。

   ---------- Footnotes ----------

   (1) https://www.courier-mta.org/maildir.html

   (2) https://cr.yp.to/proto/maildir.html


File: python.info,  Node: mbox オブジェクト,  Next: MH オブジェクト,  Prev: Maildir オブジェクト,  Up: Mailbox オブジェクト

5.20.3.3 ‘mbox’ オブジェクト
............................

 -- クラス: mailbox.mbox (path, factory=None, create=True)

     mbox 形式のメールボックスのための *note Mailbox: 1463. のサブクラス
     。パラメータ 'factory' は呼び出し可能オブジェクトで (バイナリモード
     で開かれているかのように振る舞う)ファイル風メッセージ表現を受け付け
     て好みの表現を返すものです。 'factory' が ‘None’ ならば、 *note
     mboxMessage: 3abf. がデフォルトのメッセージ表現として使われます。
     'create' が ‘True’ ならばメールボックスが存在しないときには作成しま
     す。

     mbox 形式は Unixシステム上でメールを保存する古くからある形式です。
     mbox メールボックスでは全てのメッセージが一つのファイルに保存されて
     おりそれぞれのメッセージは "From " という5文字で始まる行を先頭に付
     けられています。

     mbox 形式には幾つかのバリエーションがあり、それぞれオリジナルの形式
     にあった欠点を克服すると主張しています。互換性のために、 ‘mbox’ は
     オリジナルの(時に 'mboxo' と呼ばれる) 形式を実装しています。すなわ
     ち、 ‘Content-Length’ ヘッダはもしあっても無視され、メッセージのボ
     ディにある行頭の "From " はメッセージを保存する際に ">From " に変換
     されますが、この ">From " は読み出し時にも "From " に変換されません
     。

     ‘mbox’ で実装された *note Mailbox: 1463. のいくつかのメソッドには特
     別な注意が必要です:

      -- メソッド: get_bytes (key, from_=False)

          Note: This method has an extra parameter ('from_') compared
          with other classes.  The first line of an mbox file entry is
          the Unix "From " line.  If 'from_' is False, the first line of
          the file is dropped.

      -- メソッド: get_file (key, from_=False)

          ‘mbox’ インスタンスに対し *note flush(): 19c1. や
          meth:‘~Mailbox.close’ を呼び出した後でファイルを使用すると予期
          しない結果を引き起こしたり例外が送出されたりすることがあります
          。

          Note: This method has an extra parameter ('from_') compared
          with other classes.  The first line of an mbox file entry is
          the Unix "From " line.  If 'from_' is False, the first line of
          the file is dropped.

      -- メソッド: get_string (key, from_=False)

          Note: This method has an extra parameter ('from_') compared
          with other classes.  The first line of an mbox file entry is
          the Unix "From " line.  If 'from_' is False, the first line of
          the file is dropped.

      -- メソッド: lock ()
      -- メソッド: unlock ()

          3種類のロック機構が使われます -- ドットロッキングと、もし使用
          可能ならば ‘flock()’ と ‘lockf()’ システムコールです。

参考
....

tin の mbox マニュアルページ(1)

     mbox 形式の仕様でロックについての詳細を含む。

Configuring Netscape Mail on Unix: Why The Content-Length Format is Bad(2)

     バリエーションの一つではなくオリジナルの mbox を使う理由。

"mbox" は相互に互換性を持たないいくつかのメールボックスフォーマットの集まりです(3)

     mbox バリエーションの歴史。

   ---------- Footnotes ----------

   (1) http://www.tin.org/bin/man.cgi?section=5&topic=mbox

   (2) https://www.jwz.org/doc/content-length.html

   (3) 
https://www.loc.gov/preservation/digital/formats/fdd/fdd000383.shtml


File: python.info,  Node: MH オブジェクト,  Next: Babyl オブジェクト,  Prev: mbox オブジェクト,  Up: Mailbox オブジェクト

5.20.3.4 ‘MH’ オブジェクト
..........................

 -- クラス: mailbox.MH (path, factory=None, create=True)

     MH 形式のメールボックスのための *note Mailbox: 1463. のサブクラス。
     パラメータ 'factory' は呼び出し可能オブジェクトで (バイナリモードで
     開かれているかのように振る舞う)ファイル風メッセージ表現を受け付けて
     好みの表現を返すものです。 'factory' が ‘None’ ならば、 *note
     MHMessage: 3c38. がデフォルトのメッセージ表現として使われます。
     'create' が ‘True’ ならばメールボックスが存在しないときには作成しま
     す。

     MH はディレクトリに基づいたメールボックス形式で MH Message Handling
     System というメールユーザエージェントのために発明されました。 MH メ
     ールボックス中のそれぞれのメッセージは一つのファイルとして収められ
     ています。 MH メールボックスにはメッセージの他に別の MH メールボッ
     クス ('フォルダ' と呼ばれます)を含んでもかまいません。フォルダは無
     限にネストできます。 MH メールボックスにはもう一つ 'シーケンス' と
     いう名前付きのリストでメッセージをサブフォルダに移動することなく論
     理的に分類するものがサポートされています。シーケンスは各フォルダの
     ‘.mh_sequences’ というファイルで定義されます。

     ‘MH’ クラスは MH メールボックスを操作しますが、 ‘mh’ の動作の全てを
     模倣しようとはしていません。特に、 ‘mh’ が状態と設定を保存する
     ‘context’ や ‘.mh_profile’ といったファイルは書き換えませんし影響も
     受けません。

     ‘MH’ インスタンスには *note Mailbox: 1463. の全てのメソッドの他に次
     のメソッドがあります:

     バージョン 3.13 で変更: Supported folders that don't contain a
     ‘.mh_sequences’ file.

      -- メソッド: list_folders ()

          全てのフォルダ名のリストを返します。

      -- メソッド: get_folder (folder)

          'folder' という名前のフォルダを表わす ‘MH’ インスタンスを返し
          ます。もしフォルダが存在しなければ *note NoSuchMailboxError:
          3c1c. 例外が送出されます。

      -- メソッド: add_folder (folder)

          'folder' という名前のフォルダを作成し、それを表わす ‘MH’ イン
          スタンスを返します。

      -- メソッド: remove_folder (folder)

          名前が 'folder' であるフォルダを削除します。もしフォルダに一つ
          でもメッセージが含まれていれば *note NotEmptyError: 3c1f. 例外
          が送出されフォルダは削除されません。

      -- メソッド: get_sequences ()

          シーケンス名をキーのリストに対応付ける辞書を返します。シーケン
          スが一つもなければ空の辞書を返します。

      -- メソッド: set_sequences (sequences)

          メールボックス中のシーケンスを *note get_sequences(): 3c3d. で
          返されるような名前とキーのリストを対応付ける辞書 'sequences' に
          基づいて再定義します。

      -- メソッド: pack ()

          番号付けの間隔を詰める必要に応じてメールボックス中のメッセージ
          の名前を付け替えます。シーケンスのリストのエントリもそれに応じ
          て更新されます。

               注釈: 既に発行されたキーはこの操作によって無効になるので
               それ以降使ってはなりません。

     ‘MH’ で実装された *note Mailbox: 1463. のいくつかのメソッドには特別
     な注意が必要です:

      -- メソッド: remove (key)
      -- メソッド: __delitem__ (key)
      -- メソッド: discard (key)

          これらのメソッドはメッセージを直ちに削除します。名前の前にコン
          マを付加してメッセージに削除の印を付けるという MH の規約は使い
          ません。

      -- メソッド: lock ()
      -- メソッド: unlock ()

          3種類のロック機構が使われます -- ドットロッキングと、もし使用
          可能ならば ‘flock()’ と ‘lockf()’ システムコールです。 MH メー
          ルボックスに対するロックとは ‘.mh_sequences’ のロックと、それ
          が影響を与える操作中だけの個々のメッセージファイルに対するロッ
          クを意味します。

      -- メソッド: get_file (key)

          ホストプラットフォームにより、ファイルが開かれたままの場合はメ
          ッセージを削除することができない場合があります。

      -- メソッド: flush ()

          MH メールボックスへの変更は即時に適用されますのでこのメソッド
          は何もしません。

      -- メソッド: close ()

          ‘MH’ インスタンスは開いたファイルを保持しませんのでこのメソッ
          ドは *note unlock(): 3c44. と同じです。

参考
....

nmh - Message Handling System(1)

     ‘mh’ の改良版である ‘nmh’ のホームページ。

MH & nmh: Email for Users & Programmers(2)

     GPLライセンスの ‘mh’ および ‘nmh’ の本で、このメールボックス形式に
     ついての情報があります。

   ---------- Footnotes ----------

   (1) https://www.nongnu.org/nmh/

   (2) https://rand-mh.sourceforge.io/book/


File: python.info,  Node: Babyl オブジェクト,  Next: MMDF オブジェクト,  Prev: MH オブジェクト,  Up: Mailbox オブジェクト

5.20.3.5 ‘Babyl’ オブジェクト
.............................

 -- クラス: mailbox.Babyl (path, factory=None, create=True)

     Babyl 形式のメールボックスのための *note Mailbox: 1463. のサブクラ
     ス。パラメータ 'factory' は呼び出し可能オブジェクトで (バイナリモー
     ドで開かれているかのように振る舞う)ファイル風メッセージ表現を受け付
     けて好みの表現を返すものです。 'factory' が ‘None’ ならば、 *note
     BabylMessage: 3c4b. がデフォルトのメッセージ表現として使われます。
     'create' が ‘True’ ならばメールボックスが存在しないときには作成しま
     す。

     Babyl は単一ファイルのメールボックス形式で Emacs に付属している
     Rmail メールユーザエージェントで使われているものです。メッセージの
     開始は Control-Underscore (‘'\037'’) および Control-L (‘'\014'’) の
     二文字を含む行で示されます。メッセージの終了は次のメッセージの開始
     または最後のメッセージの場合には Control-Underscore を含む行で示さ
     れます。

     Babyl メールボックス中のメッセージには二つのヘッダのセット、オリジ
     ナルヘッダといわゆる可視ヘッダ、があります。可視ヘッダは典型的には
     オリジナルヘッダの一部を分り易いように再整形したり短くしたりしたも
     のです。 Babyl メールボックス中のそれぞれのメッセージには 'ラベル'
     というそのメッセージについての追加情報を記録する短い文字列のリスト
     を伴い、メールボックス中に見出されるユーザが定義した全てのラベルの
     リストは Babyl オプションセクションに保持されます。

     ‘Babyl’ インスタンスには *note Mailbox: 1463. の全てのメソッドの他
     に次のメソッドがあります:

      -- メソッド: get_labels ()

          メールボックスで使われているユーザが定義した全てのラベルのリス
          トを返します。

               注釈: メールボックスにどのようなラベルが存在するかを決め
               るのに、Babyl オプションセクションのリストを参考にせず、
               実際のメッセージを捜索しますが、Babyl セクションもメール
               ボックスが変更されたときにはいつでも更新されます。

     ‘Babyl’ で実装された *note Mailbox: 1463. のいくつかのメソッドには
     特別な注意が必要です:

      -- メソッド: get_file (key)

          Babyl メールボックスにおいて、メッセージのヘッダはボディと繋が
          って格納されていません。ファイル風の表現を生成するために、ヘッ
          ダとボディがファイルと同じ API を持つ *note io.BytesIO: 10a4.
          インスタンスに一緒にコピーされます。その結果、ファイル風オブジ
          ェクトは元にしているメールボックスとは真に独立していますが、文
          字列表現と比べてメモリーを節約することにはなりません。

      -- メソッド: lock ()
      -- メソッド: unlock ()

          3種類のロック機構が使われます -- ドットロッキングと、もし使用
          可能ならば ‘flock()’ と ‘lockf()’ システムコールです。

参考
....

Format of Version 5 Babyl Files(1)

     Babyl 形式の仕様。

Reading Mail with Rmail(2)

     Rmail のマニュアルで Babyl のセマンティクスについての情報も少しある
     。

   ---------- Footnotes ----------

   (1) https://quimby.gnus.org/notes/BABYL

   (2) 
https://www.gnu.org/software/emacs/manual/html_node/emacs/Rmail.html


File: python.info,  Node: MMDF オブジェクト,  Prev: Babyl オブジェクト,  Up: Mailbox オブジェクト

5.20.3.6 ‘MMDF’ オブジェクト
............................

 -- クラス: mailbox.MMDF (path, factory=None, create=True)

     MMDF 形式のメールボックスのための *note Mailbox: 1463. のサブクラス
     。パラメータ 'factory' は呼び出し可能オブジェクトで (バイナリモード
     で開かれているかのように振る舞う)ファイル風メッセージ表現を受け付け
     て好みの表現を返すものです。 'factory' が ‘None’ ならば、 *note
     MMDFMessage: 3c52. がデフォルトのメッセージ表現として使われます。
     'create' が ‘True’ ならばメールボックスが存在しないときには作成しま
     す。

     MMDF は単一ファイルのメールボックス形式で Multichannel Memorandum
     Distribution Facility というメール転送エージェント用に発明されたも
     のです。各メッセージは mbox と同様の形式で収められますが、前後を4つ
     の Control-A (‘'\001'’) を含む行で挟んであります。mbox 形式と同じよ
     うにそれぞれのメッセージの開始は "From " の5文字を含む行で示されま
     すが、それ以外の場所での "From " は格納の際 ">From " には変えられま
     せん。それは追加されたメッセージ区切りによって新たなメッセージの開
     始と見間違うことが避けられるからです。

     ‘MMDF’ で実装された *note Mailbox: 1463. のいくつかのメソッドには特
     別な注意が必要です:

      -- メソッド: get_bytes (key, from_=False)

          Note: This method has an extra parameter ('from_') compared
          with other classes.  The first line of an mbox file entry is
          the Unix "From " line.  If 'from_' is False, the first line of
          the file is dropped.

      -- メソッド: get_file (key, from_=False)

          ‘MMDF’ インスタンスに対し *note flush(): 19c1. や
          meth:‘~Mailbox.close’ を呼び出した後でファイルを使用すると予期
          しない結果を引き起こしたり例外が送出されたりすることがあります
          。

          Note: This method has an extra parameter ('from_') compared
          with other classes.  The first line of an mbox file entry is
          the Unix "From " line.  If 'from_' is False, the first line of
          the file is dropped.

      -- メソッド: lock ()
      -- メソッド: unlock ()

          3種類のロック機構が使われます -- ドットロッキングと、もし使用
          可能ならば ‘flock()’ と ‘lockf()’ システムコールです。

参考
....

mmdf man page from tin(1)

     ニュースリーダ tin のドキュメント中の MMDF 形式仕様。

MMDF(2)

     Multichannel Memorandum Distribution Facility についてのウィキペデ
     ィアの記事。

   ---------- Footnotes ----------

   (1) http://www.tin.org/bin/man.cgi?section=5&topic=mmdf

   (2) https://en.wikipedia.org/wiki/MMDF


File: python.info,  Node: Message オブジェクト,  Next: 例外<21>,  Prev: Mailbox オブジェクト,  Up: mailbox --- 様々な形式のメールボックスを操作する

5.20.3.7 ‘Message’ オブジェクト
...............................

 -- クラス: mailbox.Message (message=None)

     *note email.message: 48. モジュールの *note Message: 581. のサブク
     ラス。 ‘mailbox.Message’ のサブクラスはメールボックス形式ごとの状態
     と動作を追加します。

     If 'message' is omitted, the new instance is created in a default,
     empty state.  If 'message' is an *note email.message.Message: 581.
     instance, its contents are copied; furthermore, any format-specific
     information is converted insofar as possible if 'message' is a
     ‘Message’ instance.  If 'message' is a string, a byte string, or a
     file, it should contain an RFC 5322(1)-compliant message, which is
     read and parsed.  Files should be open in binary mode, but text
     mode files are accepted for backward compatibility.

     サブクラスにより提供される形式ごとの状態と動作は様々ですが、一般に
     或るメールボックスに固有のものでないプロパティだけがサポートされま
     す(おそらくプロパティのセットはメールボックス形式ごとに固有でしょう
     が)。例えば、単一ファイルメールボックス形式におけるファイルオフセッ
     トやディレクトリ式メールボックス形式におけるファイル名は保持されま
     せん、というのもそれらは元々のメールボックスにしか適用できないから
     です。しかし、メッセージがユーザに読まれたかどうかあるいは重要だと
     マークされたかどうかという状態は保持されます、というのはそれらはメ
     ッセージ自体に適用されるからです。

     *note Mailbox: 1463. インスタンスを使って取得したメッセージを表現す
     るのに ‘Message’ インスタンスが使われなければいけないとは要求してい
     ません。ある種の状況では ‘Message’ による表現を生成するのに必要な時
     間やメモリーが受け入れられないこともあります。そういった状況では
     ‘Mailbox’ インスタンスは文字列やファイル風オブジェクトの表現も提供
     できますし、 ‘Mailbox’ インスタンスを初期化する際にメッセージファク
     トリーを指定することもできます。

* Menu:

* MaildirMessage オブジェクト::
* mboxMessage オブジェクト::
* MHMessage オブジェクト::
* BabylMessage オブジェクト::
* MMDFMessage オブジェクト::

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc5322.html


File: python.info,  Node: MaildirMessage オブジェクト,  Next: mboxMessage オブジェクト,  Up: Message オブジェクト

5.20.3.8 ‘MaildirMessage’ オブジェクト
......................................

 -- クラス: mailbox.MaildirMessage (message=None)

     Maildir 固有の動作をするメッセージ。引数 'message' は *note
     Message: 1468. のコンストラクタと同じ意味を持ちます。

     通常、メールユーザエージェントは ‘new’ サブディレクトリにある全ての
     メッセージをユーザが最初にメールボックスを開くか閉じるかした後で
     ‘cur’ サブディレクトリに移動し、メッセージが実際に読まれたかどうか
     を記録します。 ‘cur’ にある各メッセージには状態情報を保存するファイ
     ル名に付け加えられた "info" セクションがあります。(メールリーダの中
     には "info" セクションを ‘new’ にあるメッセージに付けることもありま
     す。) "info" セクションには二つの形式があります。一つは "2," の後に
     標準化されたフラグのリストを付けたもの (たとえば "2,FR")、もう一つ
     は "1," の後にいわゆる実験的情報を付け加えるものです。 Maildir の標
     準的なフラグは以下の通りです:

     Flag       意味          説明
                              
     --------------------------------------------------------------
                              
     D          ドラフト      作成中
                (Draft)       
                
                              
     F          フラグ付き    重要とされたもの
                (Flagged)     
                
                              
     P          通過          転送、再送またはバウンス
                (Passed)      
                
                              
     R          返答済み      返答されたもの
                (Replied)     
                
                              
     S          既読(Seen)    読んだもの
                              
                              
     T          ごみ          削除予定とされたもの
                (Trashed)     
                

     ‘MaildirMessage’ インスタンスは以下のメソッドを提供します:

      -- メソッド: get_subdir ()

          "new" (メッセージが ‘new’ サブディレクトリに保存されるべき場合
          ) または "cur" (メッセージが ‘cur’ サブディレクトリに保存され
          るべき場合)のどちらかを返します。

               注釈: メッセージは通常メールボックスがアクセスされた後、
               メッセージが読まれたかどうかに関わらず ‘new’ から ‘cur’ に
               移動されます。メッセージ ‘msg’ は ‘"S" in
               msg.get_flags()’ が ‘True’ ならば読まれています。

      -- メソッド: set_subdir (subdir)

          メッセージが保存されるべきサブディレクトリをセットします。パラ
          メータ 'subdir' は "new" または "cur" のいずれかでなければなり
          ません。

      -- メソッド: get_flags ()

          現在セットされているフラグを特定する文字列を返します。メッセー
          ジが標準 Maildir 形式に準拠しているならば、結果はアルファベッ
          ト順に並べられたゼロまたは1回の ‘'D'’、‘'F'’、‘'P'’、‘'R'’、
          ‘'S'’、‘'T'’ をつなげたものです。空文字列が返されるのはフラグ
          が一つもない場合、または "info" が実験的セマンティクスを使って
          いる場合です。

      -- メソッド: set_flags (flags)

          'flags' で指定されたフラグをセットし、他のフラグは下ろします。

      -- メソッド: add_flag (flag)

          'flag' で指定されたフラグをセットしますが他のフラグは変えませ
          ん。一度に二つ以上のフラグをセットすることは、'flag' に2文字以
          上の文字列を指定すればできます。現在の "info" はフラグの代わり
          に実験的情報を使っていても上書きされます。

      -- メソッド: remove_flag (flag)

          Unset the flag(s) specified by 'flag' without changing other
          flags.  To remove more than one flag at a time, 'flag' may be
          a string of more than one character.  If "info" contains
          experimental information rather than flags, the current "info"
          is not modified.

      -- メソッド: get_date ()

          メッセージの配送日時をエポックからの秒数を表わす浮動小数点数で
          返します。

      -- メソッド: set_date (date)

          メッセージの配送日時を 'date' にセットします。'date' はエポッ
          クからの秒数を表わす浮動小数点数です。

      -- メソッド: get_info ()

          メッセージの "info" を含む文字列を返します。このメソッドは実験
          的 (即ちフラグのリストでない) "info" にアクセスし、また変更す
          るのに役立ちます。

      -- メソッド: set_info (info)

          "info" に文字列 'info' をセットします。

‘MaildirMessage’ インスタンスが *note mboxMessage: 3abf. や *note
MMDFMessage: 3c52. のインスタンスに基づいて生成されるとき、 ‘Status’ お
よび ‘X-Status’ ヘッダは省かれ以下の変換が行われます:

結果の状態               *note mboxMessage: 3abf. または
                         *note MMDFMessage: 3c52. の状態
                         
----------------------------------------------------------------------------
                         
"cur" サブディレクトリ   O フラグ
                         
                         
F フラグ                 F フラグ
                         
                         
R フラグ                 A フラグ
                         
                         
S フラグ                 R フラグ
                         
                         
T フラグ                 D フラグ
                         

‘MaildirMessage’ インスタンスが *note MHMessage: 3c38. インスタンスに基
づいて生成されるとき、以下の変換が行われます:

結果の状態                          *note MHMessage: 3c38. の状
                                    態
                                    
-------------------------------------------------------------------
                                    
"cur" サブディレクトリ              "unseen" シーケンス
                                    
                                    
"cur" サブディレクトリおよび S フ   "unseen" シーケンス無し
ラグ                                

F フラグ                            "flagged" シーケンス
                                    
                                    
R フラグ                            "replied" シーケンス
                                    

‘MaildirMessage’ インスタンスが *note BabylMessage: 3c4b. インスタンスに
基づいて生成されるとき、以下の変換が行われます:

結果の状態                          *note BabylMessage: 3c4b. の状態
                                    
------------------------------------------------------------------------
                                    
"cur" サブディレクトリ              "unseen" ラベル
                                    
                                    
"cur" サブディレクトリおよび S フ   "unseen" ラベル無し
ラグ                                

P フラグ                            "forwarded" または "resent" ラベ
                                    ル
                                    
                                    
R フラグ                            "answered" ラベル
                                    
                                    
T フラグ                            "deleted" ラベル
                                    


File: python.info,  Node: mboxMessage オブジェクト,  Next: MHMessage オブジェクト,  Prev: MaildirMessage オブジェクト,  Up: Message オブジェクト

5.20.3.9 ‘mboxMessage’ オブジェクト
...................................

 -- クラス: mailbox.mboxMessage (message=None)

     mbox 固有の動作をするメッセージ。引数 'message' は *note Message:
     1468. のコンストラクタと同じ意味を持ちます。

     mbox メールボックス中のメッセージは単一ファイルにまとめて格納されて
     います。送り主のエンベロープアドレスおよび配送日時は通常メッセージ
     の開始を示す "From " から始まる行に記録されますが、正確なフォーマッ
     トに関しては mbox の実装ごとに大きな違いがあります。メッセージの状
     態を示すフラグ、たとえば読んだかどうかあるいは重要だとマークを付け
     られているかどうかといったようなもの、は典型的には ‘Status’ および
     ‘X-Status’ に収められます。

     規定されている mbox メッセージのフラグは以下の通りです:

     Flag       意味           説明
                               
     ---------------------------------------------------------------
                               
     R          読んだもの     読んだもの
                               
                               
     O          古い(Old)      以前に MUA に発見された
                               
                               
     D          削除           削除予定とされたもの
                (Deleted)      
                
                               
     F          フラグ付き     重要とされたもの
                (Flagged)      
                
                               
     A          返答済み       返答されたもの
                (Answered)     
                

     "R" および "O" フラグは ‘Status’ ヘッダに記録され、 "D"、"F"、"A" フ
     ラグは ‘X-Status’ ヘッダに記録されます。フラグとヘッダは通常記述さ
     れた順番に出現します。

     ‘mboxMessage’ インスタンスは以下のメソッドを提供します:

      -- メソッド: get_from ()

          mbox メールボックスのメッセージの開始を示す "From " 行を表わす
          文字列を返します。先頭の "From " および末尾の改行は含まれませ
          ん。

      -- メソッド: set_from (from_, time_=None)

          "From " 行を 'from_' にセットします。 'from_' は先頭の "From "
          や末尾の改行を含まない形で指定しなければなりません。利便性のた
          めに、 'time_' を指定して適切に整形して 'from_' に追加させるこ
          とができます。 'time_' を指定する場合、それは *note
          time.struct_time: ee6. インスタンス、 *note time.strftime():
          1402. に渡すのに適したタプル、または ‘True’ (この場合 *note
          time.gmtime(): 13d8. を使います) のいずれかでなければなりませ
          ん。

      -- メソッド: get_flags ()

          現在セットされているフラグを特定する文字列を返します。メッセー
          ジが規定された形式に準拠しているならば、結果は次の順に並べられ
          た 0回か1回の ‘'R'’、‘'O'’、‘'D'’、‘'F'’、‘'A'’ です。

      -- メソッド: set_flags (flags)

          'flags' で指定されたフラグをセットして、他のフラグは下ろします
          。'flags' は並べられたゼロまたは1回の ‘'R'’、‘'O'’、‘'D'’、
          ‘'F'’、‘'A'’ です。

      -- メソッド: add_flag (flag)

          'flag' で指定されたフラグをセットしますが他のフラグは変えませ
          ん。一度に二つ以上のフラグをセットすることは、'flag' に2文字以
          上の文字列を指定すればできます。

      -- メソッド: remove_flag (flag)

          Unset the flag(s) specified by 'flag' without changing other
          flags.  To remove more than one flag at a time, 'flag' may be
          a string of more than one character.

‘mboxMessage’ インスタンスが *note MaildirMessage: 3c18. インスタンスに
基づいて生成されるとき、 *note MaildirMessage: 3c18. インスタンスの配送
日時に基づいて "From " 行が作り出され、次の変換が行われます:

結果の状態            *note MaildirMessage: 3c18. の状
                      態
                      
----------------------------------------------------------
                      
R フラグ              S フラグ
                      
                      
O フラグ              "cur" サブディレクトリ
                      
                      
D フラグ              T フラグ
                      
                      
F フラグ              F フラグ
                      
                      
A フラグ              R フラグ
                      

‘mboxMessage’ インスタンスが *note MHMessage: 3c38. インスタンスに基づい
て生成されるとき、以下の変換が行われます:

結果の状態              *note MHMessage: 3c38. の状
                        態
                        
-------------------------------------------------------
                        
R フラグおよび O フラ   "unseen" シーケンス無し
グ                      

O フラグ                "unseen" シーケンス
                        
                        
F フラグ                "flagged" シーケンス
                        
                        
A フラグ                "replied" シーケンス
                        

‘mboxMessage’ インスタンスが *note BabylMessage: 3c4b. インスタンスに基
づいて生成されるとき、以下の変換が行われます:

結果の状態              *note BabylMessage: 3c4b. の状
                        態
                        
----------------------------------------------------------
                        
R フラグおよび O フラ   "unseen" ラベル無し
グ                      

O フラグ                "unseen" ラベル
                        
                        
D フラグ                "deleted" ラベル
                        
                        
A フラグ                "answered" ラベル
                        

‘mboxMessage’ インスタンスが *note MMDFMessage: 3c52. インスタンスに基づ
いて生成されるとき、"From " 行はコピーされ全てのフラグは直接対応します:

結果の状態            *note MMDFMessage: 3c52. の状
                      態
                      
-------------------------------------------------------
                      
R フラグ              R フラグ
                      
                      
O フラグ              O フラグ
                      
                      
D フラグ              D フラグ
                      
                      
F フラグ              F フラグ
                      
                      
A フラグ              A フラグ
                      


File: python.info,  Node: MHMessage オブジェクト,  Next: BabylMessage オブジェクト,  Prev: mboxMessage オブジェクト,  Up: Message オブジェクト

5.20.3.10 ‘MHMessage’ オブジェクト
..................................

 -- クラス: mailbox.MHMessage (message=None)

     MH 固有の動作をするメッセージ。引数 'message' は *note Message:
     1468. のコンストラクタと同じ意味を持ちます。

     MH メッセージは伝統的な意味あいにおいてマークやフラグをサポートしま
     せん。しかし、MH メッセージにはシーケンスがあり任意のメッセージを論
     理的にグループ分けできます。いくつかのメールソフト(標準の ‘mh’ や
     ‘nmh’ はそうではありませんが) は他の形式におけるフラグとほぼ同じよ
     うにシーケンスを使います:

     シーケンス     説明
                    
     --------------------------------------------------------------
                    
     unseen         読んではいないが既にMUAに見つけられている
                    
                    
     replied        返答されたもの
                    
                    
     flagged        重要とされたもの
                    

     ‘MHMessage’ インスタンスは以下のメソッドを提供します:

      -- メソッド: get_sequences ()

          このメッセージを含むシーケンスの名前のリストを返す。

      -- メソッド: set_sequences (sequences)

          このメッセージを含むシーケンスのリストをセットする。

      -- メソッド: add_sequence (sequence)

          'sequence' をこのメッセージを含むシーケンスのリストに追加する
          。

      -- メソッド: remove_sequence (sequence)

          'sequence' をこのメッセージを含むシーケンスのリストから除く。

‘MHMessage’ インスタンスが *note MaildirMessage: 3c18. インスタンスに基
づいて生成されるとき、以下の変換が行われます:

結果の状態               *note MaildirMessage: 3c18. の状
                         態
                         
-------------------------------------------------------------
                         
"unseen" シーケンス      S フラグ無し
                         
                         
"replied" シーケンス     R フラグ
                         
                         
"flagged" シーケンス     F フラグ
                         

‘MHMessage’ インスタンスが *note mboxMessage: 3abf. や *note
MMDFMessage: 3c52. のインスタンスに基づいて生成されるとき、 ‘Status’ お
よび ‘X-Status’ ヘッダは省かれ以下の変換が行われます:

結果の状態               *note mboxMessage: 3abf. または
                         *note MMDFMessage: 3c52. の状態
                         
----------------------------------------------------------------------------
                         
"unseen" シーケンス      R フラグ無し
                         
                         
"replied" シーケンス     A フラグ
                         
                         
"flagged" シーケンス     F フラグ
                         

‘MHMessage’ インスタンスが *note BabylMessage: 3c4b. インスタンスに基づ
いて生成されるとき、以下の変換が行われます:

結果の状態               *note BabylMessage: 3c4b. の状
                         態
                         
-----------------------------------------------------------
                         
"unseen" シーケンス      "unseen" ラベル
                         
                         
"replied" シーケンス     "answered" ラベル
                         


File: python.info,  Node: BabylMessage オブジェクト,  Next: MMDFMessage オブジェクト,  Prev: MHMessage オブジェクト,  Up: Message オブジェクト

5.20.3.11 ‘BabylMessage’ オブジェクト
.....................................

 -- クラス: mailbox.BabylMessage (message=None)

     Babyl 固有の動作をするメッセージ。引数 'message' は *note Message:
     1468. のコンストラクタと同じ意味を持ちます。

     ある種のメッセージラベルは 'アトリビュート' と呼ばれ、規約により特
     別な意味が与えられています。アトリビュートは以下の通りです:

     ラベル          説明
                     
     ---------------------------------------------------------------
                     
     unseen          読んではいないが既にMUAに見つけられている
                     
                     
     deleted         削除予定とされたもの
                     
                     
     filed           他のファイルまたはメールボックスにコピーされ
                     た
                     
                     
     answered        返答されたもの
                     
                     
     forwarded       転送された
                     
                     
     edited          ユーザによって変更された
                     
                     
     resent          再送された
                     

     デフォルトでは Rmail は可視ヘッダのみ表示します。 ‘BabylMessage’ ク
     ラスはしかし、オリジナルヘッダをより完全だという理由で使います。可
     視ヘッダは望むならそのように指示してアクセスすることができます。

     ‘BabylMessage’ インスタンスは以下のメソッドを提供します:

      -- メソッド: get_labels ()

          メッセージに付いているラベルのリストを返します。

      -- メソッド: set_labels (labels)

          メッセージに付いているラベルのリストを 'labels' にセットします
          。

      -- メソッド: add_label (label)

          メッセージに付いているラベルのリストに 'label' を追加します。

      -- メソッド: remove_label (label)

          メッセージに付いているラベルのリストから 'label' を削除します
          。

      -- メソッド: get_visible ()

          ヘッダがメッセージの可視ヘッダでありボディが空であるような
          *note Message: 1468. インスタンスを返します。

      -- メソッド: set_visible (visible)

          メッセージの可視ヘッダを 'visible' のヘッダと同じにセットしま
          す。引数 'visible' は *note Message: 1468. インスタンスまたは
          *note email.message.Message: 581. インスタンス、文字列、ファイ
          ル風オブジェクト(テキストモードで開かれてなければなりません)の
          いずれかです。

      -- メソッド: update_visible ()

          ‘BabylMessage’ インスタンスのオリジナルヘッダが変更されたとき
          、可視ヘッダは自動的に対応して変更されるわけではありません。こ
          のメソッドは可視ヘッダを以下のように更新します。対応するオリジ
          ナルヘッダのある可視ヘッダはオリジナルヘッダの値がセットされま
          す。対応するオリジナルヘッダの無い可視ヘッダは除去されます。そ
          して、オリジナルヘッダにあって可視ヘッダに無い ‘Date’ 、
          ‘From’ 、 ‘Reply-To’ 、 ‘To’ 、 ‘CC’ 、 ‘Subject’ は可視ヘッダ
          に追加されます。

‘BabylMessage’ インスタンスが *note MaildirMessage: 3c18. インスタンスに
基づいて生成されるとき、以下の変換が行われます:

結果の状態              *note MaildirMessage: 3c18. の状
                        態
                        
------------------------------------------------------------
                        
"unseen" ラベル         S フラグ無し
                        
                        
"deleted" ラベル        T フラグ
                        
                        
"answered" ラベル       R フラグ
                        
                        
"forwarded" ラベル      P フラグ
                        

‘BabylMessage’ インスタンスが *note mboxMessage: 3abf. や *note
MMDFMessage: 3c52. のインスタンスに基づいて生成されるとき、 ‘Status’ お
よび ‘X-Status’ ヘッダは省かれ以下の変換が行われます:

結果の状態             *note mboxMessage: 3abf. または
                       *note MMDFMessage: 3c52. の状態
                       
--------------------------------------------------------------------------
                       
"unseen" ラベル        R フラグ無し
                       
                       
"deleted" ラベル       D フラグ
                       
                       
"answered" ラベル      A フラグ
                       

‘BabylMessage’ インスタンスが *note MHMessage: 3c38. インスタンスに基づ
いて生成されるとき、以下の変換が行われます:

結果の状態             *note MHMessage: 3c38. の状
                       態
                       
------------------------------------------------------
                       
"unseen" ラベル        "unseen" シーケンス
                       
                       
"answered" ラベル      "replied" シーケンス
                       


File: python.info,  Node: MMDFMessage オブジェクト,  Prev: BabylMessage オブジェクト,  Up: Message オブジェクト

5.20.3.12 ‘MMDFMessage’ オブジェクト
....................................

 -- クラス: mailbox.MMDFMessage (message=None)

     MMDF 固有の動作をするメッセージ。引数 'message' は *note Message:
     1468. のコンストラクタと同じ意味を持ちます。

     mbox メールボックスのメッセージと同様に、MMDF メッセージは送り主の
     アドレスと配送日時が最初の "From " で始まる行に記録されています。同
     様に、メッセージの状態を示すフラグは通常 ‘Status’ および ‘X-Status’
     ヘッダに収められています。

     よく使われる MMDF メッセージのフラグは mbox メッセージのものと同一
     で以下の通りです:

     Flag       意味           説明
                               
     ---------------------------------------------------------------
                               
     R          読んだもの     読んだもの
                               
                               
     O          古い(Old)      以前に MUA に発見された
                               
                               
     D          削除           削除予定とされたもの
                (Deleted)      
                
                               
     F          フラグ付き     重要とされたもの
                (Flagged)      
                
                               
     A          返答済み       返答されたもの
                (Answered)     
                

     "R" および "O" フラグは ‘Status’ ヘッダに記録され、 "D"、"F"、"A" フ
     ラグは ‘X-Status’ ヘッダに記録されます。フラグとヘッダは通常記述さ
     れた順番に出現します。

     ‘MMDFMessage’ インスタンスは *note mboxMessage: 3abf. インスタンス
     と同一の以下のメソッドを提供します:

      -- メソッド: get_from ()

          mbox メールボックスのメッセージの開始を示す "From " 行を表わす
          文字列を返します。先頭の "From " および末尾の改行は含まれませ
          ん。

      -- メソッド: set_from (from_, time_=None)

          "From " 行を 'from_' にセットします。 'from_' は先頭の "From "
          や末尾の改行を含まない形で指定しなければなりません。利便性のた
          めに、 'time_' を指定して適切に整形して 'from_' に追加させるこ
          とができます。 'time_' を指定する場合、それは *note
          time.struct_time: ee6. インスタンス、 *note time.strftime():
          1402. に渡すのに適したタプル、または ‘True’ (この場合 *note
          time.gmtime(): 13d8. を使います) のいずれかでなければなりませ
          ん。

      -- メソッド: get_flags ()

          現在セットされているフラグを特定する文字列を返します。メッセー
          ジが規定された形式に準拠しているならば、結果は次の順に並べられ
          た 0回か1回の ‘'R'’、‘'O'’、‘'D'’、‘'F'’、‘'A'’ です。

      -- メソッド: set_flags (flags)

          'flags' で指定されたフラグをセットして、他のフラグは下ろします
          。'flags' は並べられたゼロまたは1回の ‘'R'’、‘'O'’、‘'D'’、
          ‘'F'’、‘'A'’ です。

      -- メソッド: add_flag (flag)

          'flag' で指定されたフラグをセットしますが他のフラグは変えませ
          ん。一度に二つ以上のフラグをセットすることは、'flag' に2文字以
          上の文字列を指定すればできます。

      -- メソッド: remove_flag (flag)

          Unset the flag(s) specified by 'flag' without changing other
          flags.  To remove more than one flag at a time, 'flag' may be
          a string of more than one character.

‘MMDFMessage’ インスタンスが *note MaildirMessage: 3c18. インスタンスに
基づいて生成されるとき、"From"行が *note MaildirMessage: 3c18. インスタ
ンスの配信日をもとに生成され、以下の変換が行われます:

結果の状態            *note MaildirMessage: 3c18. の状
                      態
                      
----------------------------------------------------------
                      
R フラグ              S フラグ
                      
                      
O フラグ              "cur" サブディレクトリ
                      
                      
D フラグ              T フラグ
                      
                      
F フラグ              F フラグ
                      
                      
A フラグ              R フラグ
                      

 ‘MMDFMessage’ インスタンスが *note MHMessage: 3c38. インスタンスに基づ
いて生成されるとき、以下の変換が行われます:

結果の状態              *note MHMessage: 3c38. の状
                        態
                        
-------------------------------------------------------
                        
R フラグおよび O フラ   "unseen" シーケンス無し
グ                      

O フラグ                "unseen" シーケンス
                        
                        
F フラグ                "flagged" シーケンス
                        
                        
A フラグ                "replied" シーケンス
                        

‘MMDFMessage’ インスタンスが *note BabylMessage: 3c4b. インスタンスに基
づいて生成されるとき、以下の変換が行われます:

結果の状態              *note BabylMessage: 3c4b. の状
                        態
                        
----------------------------------------------------------
                        
R フラグおよび O フラ   "unseen" ラベル無し
グ                      

O フラグ                "unseen" ラベル
                        
                        
D フラグ                "deleted" ラベル
                        
                        
A フラグ                "answered" ラベル
                        

‘MMDFMessage’ インスタンスが *note mboxMessage: 3abf. インスタンスに基づ
いて生成されるとき、"From"行がコピーされ、全てのフラグが直接対応します:

結果の状態            *note mboxMessage: 3abf. の状
                      態
                      
-------------------------------------------------------
                      
R フラグ              R フラグ
                      
                      
O フラグ              O フラグ
                      
                      
D フラグ              D フラグ
                      
                      
F フラグ              F フラグ
                      
                      
A フラグ              A フラグ
                      


File: python.info,  Node: 例外<21>,  Next: 使用例<31>,  Prev: Message オブジェクト,  Up: mailbox --- 様々な形式のメールボックスを操作する

5.20.3.13 例外
..............

‘mailbox’ モジュールでは以下の例外クラスが定義されています:

 -- 例外: mailbox.Error

     The base class for all other module-specific exceptions.

 -- 例外: mailbox.NoSuchMailboxError

     メールボックスがあると思っていたが見つからなかった場合に送出されま
     す。これはたとえば *note Mailbox: 1463. のサブクラスを存在しないパ
     スでインスタンス化しようとしたとき(かつ 'create' パラメータは
     ‘False’ であった場合)、あるいは存在しないフォルダを開こうとした時な
     どに発生します。

 -- 例外: mailbox.NotEmptyError

     メールボックスが空であることを期待されているときに空でない場合、た
     とえばメッセージの残っているフォルダを削除しようとした時などに送出
     されます。

 -- 例外: mailbox.ExternalClashError

     Raised when some mailbox-related condition beyond the control of
     the program causes it to be unable to proceed, such as when failing
     to acquire a lock that another program already holds, or when a
     uniquely generated file name already exists.

 -- 例外: mailbox.FormatError

     ファイル中のデータが解析できない場合、たとえば *note MH: 1a2d. イン
     スタンスが壊れた ‘.mh_sequences’ ファイルを読もうと試みた場合などに
     送出されます。


File: python.info,  Node: 使用例<31>,  Prev: 例外<21>,  Up: mailbox --- 様々な形式のメールボックスを操作する

5.20.3.14 使用例
................

メールボックス中の面白そうなメッセージのサブジェクトを全て印字する簡単な
例:

     import mailbox
     for message in mailbox.mbox('~/mbox'):
         subject = message['subject']       # Could possibly be None.
         if subject and 'python' in subject.lower():
             print(subject)

Babyl メールボックスから MH メールボックスへ全てのメールをコピーし、変換
可能な全ての形式固有の情報を変換する:

     import mailbox
     destination = mailbox.MH('~/Mail')
     destination.lock()
     for message in mailbox.Babyl('~/RMAIL'):
         destination.add(mailbox.MHMessage(message))
     destination.flush()
     destination.unlock()

この例は幾つかのメーリングリストのメールをソートするものです。他のプログ
ラムと平行して変更を加えることでメールが破損したり、プログラムを中断する
ことでメールを失ったり、はたまた半端なメッセージがメールボックス中にある
ことで途中で終了してしまう、といったことを避けるように注意深く扱っていま
す:

     import mailbox
     import email.errors

     list_names = ('python-list', 'python-dev', 'python-bugs')

     boxes = {name: mailbox.mbox('~/email/%s' % name) for name in list_names}
     inbox = mailbox.Maildir('~/Maildir', factory=None)

     for key in inbox.iterkeys():
         try:
             message = inbox[key]
         except email.errors.MessageParseError:
             continue                # The message is malformed. Just leave it.

         for name in list_names:
             list_id = message['list-id']
             if list_id and name in list_id:
                 # Get mailbox to use
                 box = boxes[name]

                 # Write copy to disk before removing original.
                 # If there's a crash, you might duplicate a message, but
                 # that's better than losing a message completely.
                 box.lock()
                 box.add(message)
                 box.flush()
                 box.unlock()

                 # Remove original message
                 inbox.lock()
                 inbox.discard(key)
                 inbox.flush()
                 inbox.unlock()
                 break               # Found destination, so stop looking.

     for box in boxes.itervalues():
         box.close()


File: python.info,  Node: mimetypes --- ファイル名を MIME タイプへマップする,  Next: base64 --- Base16 Base32 Base64 Base85 データのエンコード,  Prev: mailbox --- 様々な形式のメールボックスを操作する,  Up: インターネット上のデータの操作

5.20.4 ‘mimetypes’ -- ファイル名を MIME タイプへマップする
----------------------------------------------------------

'ソースコード:' Lib/mimetypes.py(1)

__________________________________________________________________

The ‘mimetypes’ module converts between a filename or URL and the MIME
type associated with the filename extension.  Conversions are provided
from filename to MIME type and from MIME type to filename extension;
encodings are not supported for the latter conversion.

このモジュールは、一つのクラスと多くの便利な関数を提供します。これらの関
数がこのモジュールへの標準のインターフェースですが、アプリケーションによ
っては、そのクラスにも関係するかもしれません。

以下で説明されている関数は、このモジュールへの主要なインターフェースを提
供します。たとえモジュールが初期化されていなくても、もしこれらの関数が、
*note init(): 3c86. がセットアップする情報に依存していれば、これらの関数
は、 *note init(): 3c86. を呼びます。

 -- の関数: mimetypes.guess_type (url, strict=True)

     'url' で与えられるファイル名あるいは URL に基づいて、ファイルの型を
     推定します。URL は文字列または *note path-like object: 5a1. です。

     戻り値は、タプル ‘(type, encoding)’ です、ここで 'type' は、もし型
     が(拡張子がないあるいは未定義のため)推定できない場合は、 ‘None’ を
     、あるいは、 MIME ‘content-type’ ヘッダ に利用できる、
     ‘'type/subtype'’ の形の文字列です。

     'encoding' は、符合化方式がない場合は ‘None’ を、あるいは、符号化に
     使われるプログラムの名前 (たとえば、 ‘compress’ あるいは ‘gzip’)で
     す。符号化方式は ‘Content-Encoding’ ヘッダとして使うのに適しており
     、 ‘Content-Transfer-Encoding’ ヘッダには適して 'いません' 。マッピ
     ングはテーブル駆動です。符号化方式のサフィックスは大/小文字を区別し
     ます; データ型サフィックスは、最初大/小文字を区別して試し、それから
     大/小文字を区別せずに試します。

     The optional 'strict' argument is a flag specifying whether the
     list of known MIME types is limited to only the official types
     registered with IANA(2). However, the behavior of this module also
     depends on the underlying operating system.  Only file types
     recognized by the OS or explicitly registered with Python's
     internal database can be identified.  When 'strict' is ‘True’ (the
     default), only the IANA types are supported; when 'strict' is
     ‘False’, some additional non-standard but commonly used MIME types
     are also recognized.

     バージョン 3.8 で変更: Added support for 'url' being a *note
     path-like object: 5a1.

     バージョン 3.13 で非推奨: Passing a file path instead of URL is
     *note soft deprecated: 23d.  Use *note guess_file_type(): 516. for
     this.

 -- の関数: mimetypes.guess_file_type (path, *, strict=True)

     Guess the type of a file based on its path, given by 'path'.
     Similar to the *note guess_type(): 517. function, but accepts a
     path instead of URL. Path can be a string, a bytes object or a
     *note path-like object: 5a1.

     Added in version 3.13.

 -- の関数: mimetypes.guess_all_extensions (type, strict=True)

     Guess the extensions for a file based on its MIME type, given by
     'type'.  The return value is a list of strings giving all possible
     filename extensions, including the leading dot (‘'.'’).  The
     extensions are not guaranteed to have been associated with any
     particular data stream, but would be mapped to the MIME type 'type'
     by *note guess_type(): 517. and *note guess_file_type(): 516.

     省略可能な 'strict' 引数は *note guess_type(): 517. 関数のものと同
     じ意味を持ちます。

 -- の関数: mimetypes.guess_extension (type, strict=True)

     Guess the extension for a file based on its MIME type, given by
     'type'.  The return value is a string giving a filename extension,
     including the leading dot (‘'.'’).  The extension is not guaranteed
     to have been associated with any particular data stream, but would
     be mapped to the MIME type 'type' by *note guess_type(): 517. and
     *note guess_file_type(): 516.  If no extension can be guessed for
     'type', ‘None’ is returned.

     省略可能な 'strict' 引数は *note guess_type(): 517. 関数のものと同
     じ意味を持ちます。

モジュールの動作を制御するために、いくつかの追加の関数とデータ項目が利用
できます。

 -- の関数: mimetypes.init (files=None)

     内部のデータ構造を初期化します。もし 'files' が与えられていれば、こ
     れはデフォルトの type map を増やすために使われる、一連のファイル名
     でなければなりません。もし省略されていれば、使われるファイル名は
     *note knownfiles: 3c88. から取られます。 Windows であれば、現在のレ
     ジストリの設定が読み込まれます。 'files' あるいは *note knownfiles:
     3c88. 内の各ファイル名は、それ以前に現れる名前より優先されます。繰
     り返し *note init(): 3c86. を呼び出すことは許されています。

     'files' に空リストを与えることで、システムのデフォルトが適用される
     のを避けることが出来ます; 組み込みのリストから well-known な値だけ
     が取り込まれます。

     'files' が ‘None’ の場合、内部のデータ構造は初期のデフォルト値に完
     全に再構築されます。 これは安定な操作であり、複数回呼び出されたとき
     は同じ結果になります。

     バージョン 3.2 で変更: 前のバージョンでは、 Windows のレジストリの
     設定は無視されていました。

 -- の関数: mimetypes.read_mime_types (filename)

     ファイル 'filename' で与えられた型のマップが、もしあればロードしま
     す。型のマップは、先頭の dot (‘'.'’) を含むファイル名拡張子を、
     ‘'type/subtype'’ の形の文字列にマッピングする辞書として返されます。
     もしファイル 'filename' が存在しないか、読み込めなければ、‘None’ が
     返されます。

 -- の関数: mimetypes.add_type (type, ext, strict=True)

     MIME 型 'type' からのマッピングを拡張子 'ext' に追加します。拡張子
     がすでに既知であれば、新しい型が古いものに置き替わります。その型が
     すでに既知であれば、その拡張子が、既知の拡張子のリストに追加されま
     す。

     'strict' が ‘True’ の時(デフォルト)は、そのマッピングは正式な MIME
     型に、そうでなければ、非標準の MIME 型に追加されます。

 -- データ: mimetypes.inited

     グローバルなデータ構造が初期化されているかどうかを示すフラグ。これ
     は *note init(): 3c86. により ‘True’ に設定されます。

 -- データ: mimetypes.knownfiles

     共通にインストールされた型マップファイル名のリスト。これらのファイ
     ルは、普通 ‘mime.types’ という名前であり、パッケージごとに異なる場
     所にインストールされます。

 -- データ: mimetypes.suffix_map

     サフィックスをサフィックスにマップする辞書。これは、符号化方式と型
     が同一拡張子で示される符号化ファイルが認識できるように使用されます
     。例えば、 ‘.tgz’ 拡張子は、符号化と型が別個に認識できるように
     ‘.tar.gz’ にマップされます。

 -- データ: mimetypes.encodings_map

     ファイル名拡張子を符号化方式型にマッピングする辞書。

 -- データ: mimetypes.types_map

     ファイル名拡張子を MIME 型にマップする辞書。

 -- データ: mimetypes.common_types

     ファイル名拡張子を非標準ではあるが、一般に使われている MIME 型にマ
     ップする辞書。

モジュールの使用例:

     >>> import mimetypes
     >>> mimetypes.init()
     >>> mimetypes.knownfiles
     ['/etc/mime.types', '/etc/httpd/mime.types', ... ]
     >>> mimetypes.suffix_map['.tgz']
     '.tar.gz'
     >>> mimetypes.encodings_map['.gz']
     'gzip'
     >>> mimetypes.types_map['.tgz']
     'application/x-tar-gz'

* Menu:

* MimeTypes objects::
* コマンドラインでの使用: コマンドラインでの使用<4>.
* コマンドラインの例: コマンドラインの例<2>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/mimetypes.py

   (2) https://www.iana.org/assignments/media-types/media-types.xhtml


File: python.info,  Node: MimeTypes objects,  Next: コマンドラインでの使用<4>,  Up: mimetypes --- ファイル名を MIME タイプへマップする

5.20.4.1 MimeTypes objects
..........................

The *note MimeTypes: 1714. class may be useful for applications which
may want more than one MIME-type database; it provides an interface
similar to the one of the ‘mimetypes’ module.

 -- クラス: mimetypes.MimeTypes (filenames=(), strict=True)

     このクラスは、MIME 型データベースを表現します。デフォルトでは、この
     モジュールの他のものと同じデータベースへのアクセスを提供します。初
     期データベースは、このモジュールによって提供されるもののコピーで、
     追加の ‘mime.types’ 形式のファイルを、 *note read(): 3c91. あるいは
     *note readfp(): 3c92. メソッドを使って、データベースにロードするこ
     とで拡張されます。マッピング辞書も、もしデフォルトのデータが望むも
     のでなければ、追加のデータをロードする前にクリアされます。

     省略可能な 'filenames' パラメータは、追加のファイルを、デフォルトデ
     ータベースの"トップに"ロードさせるのに使うことができます。

      -- の属性: suffix_map

          サフィックスをサフィックスにマップする辞書。これは、符号化方式
          と型が同一拡張子で示されるような符号化ファイルが認識できるよう
          に使用されます。例えば、 ‘.tgz’ 拡張子は、符号化方式と型が別個
          に認識できるように ‘.tar.gz’ に対応づけられます。これは、最初
          はモジュールで定義されたグローバルな *note suffix_map: 3c8b. の
          コピーです。

      -- の属性: encodings_map

          ファイル名拡張子を符号化型にマッピングする辞書。これは、最初は
          モジュールで定義されたグローバルな *note encodings_map: 3c8c.
          のコピーです。

      -- の属性: types_map

          ファイル名拡張子を MIME 型にマッピングする 2 種類の辞書のタプ
          ル; 最初の辞書は非標準型、二つ目は標準型の辞書です。初期状態で
          はそれぞれ *note common_types: 3c8e. と *note types_map: 3c8d.
          です。

      -- の属性: types_map_inv

          MIME 型をファイル名拡張子のリストにマッピングする 2 種類の辞書
          のタプル; 最初の辞書は非標準型、二つ目は標準型の辞書です。初期
          状態ではそれぞれ *note common_types: 3c8e. と *note types_map:
          3c8d. です。

      -- メソッド: guess_extension (type, strict=True)

          *note guess_extension(): 3c87. 関数と同様ですが、オブジェクト
          に保存されたテーブルを使用します。

      -- メソッド: guess_type (url, strict=True)

          *note guess_type(): 517. 関数と同様ですが、オブジェクトに保存
          されたテーブルを使用します。

      -- メソッド: guess_file_type (path, *, strict=True)

          Similar to the *note guess_file_type(): 516. function, using
          the tables stored as part of the object.

          Added in version 3.13.

      -- メソッド: guess_all_extensions (type, strict=True)

          *note guess_all_extensions(): 1c4a. と同様ですが、オブジェクト
          に保存されたテーブルを参照します。

      -- メソッド: read (filename, strict=True)

          MIME 情報を、 'filename' という名のファイルからロードします。
          これはファイルを解析するのに *note readfp(): 3c92. を使用しま
          す。

          'strict' が ‘True’ の時 (デフォルト) は、そのマッピングは標準
          MIME 型のリストに、そうでなければ、非標準 MIME 型のリストに追
          加されます。

      -- メソッド: readfp (fp, strict=True)

          MIME 型情報を、オープンしたファイル 'fp' からロードします。フ
          ァイルは、標準の ‘mime.types’ ファイルの形式でなければなりませ
          ん。

          'strict' が ‘True’ の時 (デフォルト) は、そのマッピングは標準
          MIME 型のリストに、そうでなければ、非標準 MIME 型のリストに追
          加されます。

      -- メソッド: read_windows_registry (strict=True)

          MIME type 情報を Windows のレジストリから読み込みます。

          *note Availability: 213f.: Windows.

          'strict' が ‘True’ の時 (デフォルト) は、そのマッピングは標準
          MIME 型のリストに、そうでなければ、非標準 MIME 型のリストに追
          加されます。

          Added in version 3.2.

      -- メソッド: add_type (type, ext, strict=True)

          Add a mapping from the MIME type 'type' to the extension
          'ext'.  Valid extensions start with a '.'  or are empty.  When
          the extension is already known, the new type will replace the
          old one.  When the type is already known the extension will be
          added to the list of known extensions.

          'strict' が ‘True’ の時(デフォルト)は、そのマッピングは正式な
          MIME 型に、そうでなければ、非標準の MIME 型に追加されます。

          Deprecated since version 3.14, will be removed in version
          3.16: Invalid, undotted extensions will raise a *note
          ValueError: 2ec. in Python 3.16.


File: python.info,  Node: コマンドラインでの使用<4>,  Next: コマンドラインの例<2>,  Prev: MimeTypes objects,  Up: mimetypes --- ファイル名を MIME タイプへマップする

5.20.4.2 コマンドラインでの使用
...............................

The ‘mimetypes’ module can be executed as a script from the command
line.

     python -m mimetypes [-h] [-e] [-l] type [type ...]

以下のオプションが使用できます:

 -- プログラムオプション: -h
 -- プログラムオプション: --help

     ヘルプメッセージを表示して終了します。

 -- プログラムオプション: -e
 -- プログラムオプション: --extension

     Guess extension instead of type.

 -- プログラムオプション: -l
 -- プログラムオプション: --lenient

     Additionally search for some common, but non-standard types.

By default the script converts MIME types to file extensions.  However,
if ‘--extension’ is specified, it converts file extensions to MIME
types.

For each ‘type’ entry, the script writes a line into the standard output
stream.  If an unknown type occurs, it writes an error message into the
standard error stream and exits with the return code ‘1’.


File: python.info,  Node: コマンドラインの例<2>,  Prev: コマンドラインでの使用<4>,  Up: mimetypes --- ファイル名を MIME タイプへマップする

5.20.4.3 コマンドラインの例
...........................

Here are some examples of typical usage of the ‘mimetypes’ command-line
interface:

     $ # get a MIME type by a file name
     $ python -m mimetypes filename.png
     type: image/png encoding: None

     $ # get a MIME type by a URL
     $ python -m mimetypes https://example.com/filename.txt
     type: text/plain encoding: None

     $ # get a complex MIME type
     $ python -m mimetypes filename.tar.gz
     type: application/x-tar encoding: gzip

     $ # get a MIME type for a rare file extension
     $ python -m mimetypes filename.pict
     error: unknown extension of filename.pict

     $ # now look in the extended database built into Python
     $ python -m mimetypes --lenient filename.pict
     type: image/pict encoding: None

     $ # get a file extension by a MIME type
     $ python -m mimetypes --extension text/javascript
     .js

     $ # get a file extension by a rare MIME type
     $ python -m mimetypes --extension text/xul
     error: unknown type text/xul

     $ # now look in the extended database again
     $ python -m mimetypes --extension --lenient text/xul
     .xul

     $ # try to feed an unknown file extension
     $ python -m mimetypes filename.sh filename.nc filename.xxx filename.txt
     type: application/x-sh encoding: None
     type: application/x-netcdf encoding: None
     error: unknown extension of filename.xxx

     $ # try to feed an unknown MIME type
     $ python -m mimetypes --extension audio/aac audio/opus audio/future audio/x-wav
     .aac
     .opus
     error: unknown type audio/future


File: python.info,  Node: base64 --- Base16 Base32 Base64 Base85 データのエンコード,  Next: binascii --- バイナリ と ASCII 間の変換,  Prev: mimetypes --- ファイル名を MIME タイプへマップする,  Up: インターネット上のデータの操作

5.20.5 ‘base64’ -- Base16, Base32, Base64, Base85 データのエンコード
--------------------------------------------------------------------

'ソースコード:' Lib/base64.py(1)

__________________________________________________________________

このモジュールは、バイナリデータを印刷可能なASCII文字列にエンコード、及
びデコードするための関数を提供しています。 RFC 4648(2) に *note
定義されているエンコーディング: 3ca6. (Base64、Base32、Base16)に加えて標
準ではない *note Base 85: 3ca7. をサポートしています。

このモジュールは、2つのインターフェースを提供します。このモダンなインタ
ーフェースは、*note bytes-like object: 193. を ASCII *note bytes: 192. に
エンコードし、*note bytes-like object: 193. か ASCII 文字列を、*note
bytes: 192. にデコードすることができます。 RFC 4648(3) に定義されている
base-64 アルファベット (一般の、URL あるいはファイルシステムセーフなもの
) の両方が使用できます。

*note 従来のインターフェース: 3ca8. は文字列からのデコードができませんが
、*note file object: 13db. との間のエンコードとデコードが可能な関数を提
供します。これは標準の base64 アルファベットのみをサポートし、 RFC
2045(4) の規定にあるように、76文字ごとに改行されます。 RFC 2045(5) のサ
ポートのためには、代わりに *note email: 3f. パッケージを参照する必要があ
るかもしれません。

バージョン 3.3 で変更: モダンなインターフェイスのデコード関数が ASCII の
みの Unicode 文字列を受け付けるようになりました。

バージョン 3.4 で変更: このモジュールのすべてのエンコード・デコード関数
が任意の *note bytes-like オブジェクト: 193. を受け取るようになりました
。Ascii85/Base85 のサポートが追加されました。

* Menu:

* RFC 4648 エンコーディング::
* Base85 エンコーディング::
* レガシーインターフェース::
* セキュリティで考慮すべき点: セキュリティで考慮すべき点<4>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/base64.py

   (2) https://datatracker.ietf.org/doc/html/rfc4648.html

   (3) https://datatracker.ietf.org/doc/html/rfc4648.html

   (4) https://datatracker.ietf.org/doc/html/rfc2045.html

   (5) https://datatracker.ietf.org/doc/html/rfc2045.html


File: python.info,  Node: RFC 4648 エンコーディング,  Next: Base85 エンコーディング,  Up: base64 --- Base16 Base32 Base64 Base85 データのエンコード

5.20.5.1 RFC 4648 エンコーディング
..................................

RFC 4648(1) エンコーディングは、email で安全に送信したり、 URL の一部と
して使ったり、あるいは HTTP POST リクエストの一部に含めるために用いるの
に適しています。

 -- の関数: base64.b64encode (s, altchars=None)

     Base64 を使って *note bytes-like object: 193. の 's' をエンコードし
     、エンコードされた *note bytes: 192. を返します。

     オプション引数 'altchars' は長さ 2 の *note bytes-like object: 193.
     で 、‘+’ と ‘/’ の代わりに使われる代替アルファベットを指定します。
     これにより、アプリケーションはたとえば URL やファイルシステムの影響
     を受けない Base64 文字列を生成できます。デフォルトは ‘None’ で、標
     準の Base64 アルファベットが使われます。

     'altchars' の長さが2でない場合は、 assert または *note ValueError:
     2ec. が発生します。 'altchars' が *note bytes-like object: 193. で
     ない場合は、 *note TypeError: 198. が発生します。

 -- の関数: base64.b64decode (s, altchars=None, validate=False)

     Base64 エンコードされた *note bytes-like object: 193. または ASCII
     文字列 's' をデコードし、デコードされた *note bytes: 192. を返しま
     す。

     オプション引数の 'altchars' は長さ 2 の *note bytes-like object:
     193. または ASCII 文字列で、‘+’ と ‘/’ の代わりに使われる代替アルフ
     ァベットを指定します。

     's' が正しくパディングされていない場合は *note binascii.Error:
     1227. 例外を発生させます。

     'validate' が ‘False’ (デフォルト) の場合、標準の base64 アルファベ
     ットでも代替文字でもない文字はパディングチェックの前に無視されます
     。 'validate' が ‘True’ の場合、入力に base64 アルファベット以外の
     文字があると *note binascii.Error: 1227. を発生させます。

     厳密な base64 チェックのについての詳細は *note
     binascii.a2b_base64(): 19a4. を参照してください

     'altchars' の長さが2でない場合は、 assert または
     :exc:>>'<<ValueError'が発生します。

 -- の関数: base64.standard_b64encode (s)

     標準の base64 アルファベットを使用して *note bytes-like object:
     193. の 's' をエンコードし、エンコードされた *note bytes: 192. を返
     します。

 -- の関数: base64.standard_b64decode (s)

     標準の base64 アルファベットを使用した *note bytes-like object:
     193. または ASCII 文字列 's' をデコードし、デコードされた *note
     bytes: 192. を返します。

 -- の関数: base64.urlsafe_b64encode (s)

     *note bytes-like object: 193. 's' を URLとファイルシステムセーフな
     アルファベットを利用してエンコードし、エンコードされた *note bytes:
     192. を返します。標準 base64 アルファベットに比べて、‘+’ の替わりに
     ‘-’ を、‘/’ の替わりに ‘_’ を利用します。結果は ‘=’ を含みます。

 -- の関数: base64.urlsafe_b64decode (s)

     *note bytes-like object: 193. または ASCII 文字列 's' を URLとファ
     イルシステムセーフなアルファベットを利用してデコードし、デコードさ
     れた *note bytes: 192. を返します。標準 base64 アルファベットに比べ
     て、‘+’ の替わりに ‘-’ を、‘/’ の替わりに ‘_’ を置換します。

 -- の関数: base64.b32encode (s)

     Base32 を使って *note bytes-like object: 193. の 's' をエンコードし
     、エンコードされた *note bytes: 192. を返します。

 -- の関数: base64.b32decode (s, casefold=False, map01=None)

     Base32 エンコードされた *note bytes-like object: 193. または ASCII
     文字列 's' をデコードし、デコードされた *note bytes: 192. を返しま
     す。

     オプション引数 'casefold' は小文字のアルファベットを受けつけるかど
     うかを指定します。セキュリティ上の理由により、デフォルトではこれは
     ‘False’ になっています。

     RFC 4648(2) は付加的なマッピングとして、数字の 0 (零) をアルファベ
     ットの O (オー) に、数字の 1 (壱) をアルファベットの I (アイ) また
     は L (エル) に対応させることを許しています。オプション引数は
     'map01' は、 ‘None’ でないときは、数字の 1 をどの文字に対応づけるか
     を指定します ('map01' が ‘None’ でないとき、数字の 0 はつねにアルフ
     ァベットの O (オー) に対応づけられます)。セキュリティ上の理由により
     、これはデフォルトでは ‘None’ になっているため、 0 および 1 は入力
     として許可されていません。

     's' が正しくパディングされていない場合や、入力にアルファベットでな
     い文字が含まれていた場合に、 *note binascii.Error: 1227. 例外を発生
     させます。

 -- の関数: base64.b32hexencode (s)

     :func:>>'<<b32encode'に似ていますが、:rfc:>>'<<4648'で定義されてい
     るようにExtended Hex Alphabetを使用します。

     Added in version 3.10.

 -- の関数: base64.b32hexdecode (s, casefold=False)

     :func:>>'<<b32decode'に似ていますが、:rfc:>>'<<4648'で定義されてい
     るようにExtended Hex Alphabetを使用します。

     This version does not allow the digit 0 (zero) to the letter O (oh)
     and digit 1 (one) to either the letter I (eye) or letter L (el)
     mappings, all these characters are included in the Extended Hex
     Alphabet and are not interchangeable.

     Added in version 3.10.

 -- の関数: base64.b16encode (s)

     Base16 を使って *note bytes-like object: 193. の 's' をエンコードし
     、エンコードされた *note bytes: 192. を返します。

 -- の関数: base64.b16decode (s, casefold=False)

     Base16 エンコードされた *note bytes-like object: 193. または ASCII
     文字列 's' をデコードし、デコードされた *note bytes: 192. を返しま
     す。

     オプション引数 'casefold' は小文字のアルファベットを受けつけるかど
     うかを指定します。セキュリティ上の理由により、デフォルトではこれは
     ‘False’ になっています。

     's' が正しくパディングされていない場合や、入力にアルファベットでな
     い文字が含まれていた場合に、 *note binascii.Error: 1227. 例外を発生
     させます。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc4648.html

   (2) https://datatracker.ietf.org/doc/html/rfc4648.html


File: python.info,  Node: Base85 エンコーディング,  Next: レガシーインターフェース,  Prev: RFC 4648 エンコーディング,  Up: base64 --- Base16 Base32 Base64 Base85 データのエンコード

5.20.5.2 Base85 エンコーディング
................................

Base85 encoding is not formally specified but rather a de facto
standard, thus different systems perform the encoding differently.

The *note a85encode(): 1121. and *note b85encode(): 1123. functions in
this module are two implementations of the de facto standard.  You
should call the function with the Base85 implementation used by the
software you intend to work with.

The two functions present in this module differ in how they handle the
following:

   * Whether to include enclosing ‘<~’ and ‘~>’ markers

   * Whether to include newline characters

   * The set of ASCII characters used for encoding

   * Handling of null bytes

Refer to the documentation of the individual functions for more
information.

 -- の関数: base64.a85encode (b, *, foldspaces=False, wrapcol=0,
          pad=False, adobe=False)

     Ascii85 を使って *note bytes-like object: 193. の 'b' をエンコード
     し、エンコードされた *note bytes: 192. を返します。

     'foldspaces' を使うと、4 つの連続した空白文字(ASCII 0x20)を 'btoa'
     によってサポートされている短い特殊文字 'y' に置き換えます。この機能
     は "標準" Ascii85 ではサポートされていません。

     'wrapcol' controls whether the output should have newline (‘b'\n'’)
     characters added to it.  If this is non-zero, each output line will
     be at most this many characters long, excluding the trailing
     newline.

     'pad' を指定すると、エンコード前に入力が 4 の倍数になるようにパディ
     ングされます。なお、 ‘btoa’ の実装は常にパディングします。

     'adobe' を指定すると、エンコードしたバイトシーケンスを ‘<~’ と ‘~>’
     で囲みます。これは Adobe の実装で使われています。

     Added in version 3.4.

 -- の関数: base64.a85decode (b, *, foldspaces=False, adobe=False,
          ignorechars=b' \t\n\r\x0b')

     Ascii85 エンコードされた *note bytes-like object: 193. または ASCII
     文字列 'b' をデコードし、デコードされた *note bytes: 192. を返しま
     す。

     'foldspaces' は、短い特殊文字 'y' を受け取って 4 つの連続した空白文
     字(ASCII 0x20)と解釈するかどうかを制御します。この機能は "標準"
     Ascii85 ではサポートされていません。

     'adobe' で、入力シーケンスが Adobe Ascii85 (つまり ‘<~’ と ‘~>’ で
     囲まれている)かどうかを伝えます。

     'ignorechars' should be a byte string containing characters to
     ignore from the input.  This should only contain whitespace
     characters, and by default contains all whitespace characters in
     ASCII.

     Added in version 3.4.

 -- の関数: base64.b85encode (b, pad=False)

     base85 (これは例えば git スタイルのバイナリ diff で用いられています
     ) を使って *note bytes-like object: 193. の 'b' をエンコードし、エ
     ンコードされた *note bytes: 192. を返します。

     'pad' が真ならば、エンコードに先立って、バイト数が 4 の倍数となるよ
     うに入力が ‘b'\0'’ でパディングされます。

     Added in version 3.4.

 -- の関数: base64.b85decode (b)

     base85でエンコードされた *note bytes-like object: 193. または ASCII
     文字列の 'b' をデコードし、デコードされた *note bytes: 192. を返し
     ます。パディングは、もしあれば、暗黙に削除されます。

     Added in version 3.4.

 -- の関数: base64.z85encode (s)

     Encode the *note bytes-like object: 193. 's' using Z85 (as used in
     ZeroMQ) and return the encoded *note bytes: 192.  See Z85
     specification(1) for more information.

     Added in version 3.13.

 -- の関数: base64.z85decode (s)

     Decode the Z85-encoded *note bytes-like object: 193. or ASCII
     string 's' and return the decoded *note bytes: 192.  See Z85
     specification(2) for more information.

     Added in version 3.13.

   ---------- Footnotes ----------

   (1) https://rfc.zeromq.org/spec/32/

   (2) https://rfc.zeromq.org/spec/32/


File: python.info,  Node: レガシーインターフェース,  Next: セキュリティで考慮すべき点<4>,  Prev: Base85 エンコーディング,  Up: base64 --- Base16 Base32 Base64 Base85 データのエンコード

5.20.5.3 レガシーインターフェース
.................................

 -- の関数: base64.decode (input, output)

     'input' ファイルの中身をデコードし、結果のバイナリデータを 'output'
     ファイルに出力します。 'input' 、 'output' ともに *note file
     objects: 13db. でなければなりません。 'input' は ‘input.readline()’
     が空バイト列を返すまで読まれます。

 -- の関数: base64.decodebytes (s)

     *note bytes-like object: 193. 's' をデコードし、デコードされた
     *note bytes: 192. を返します。 's' には一行以上の base64 形式でエン
     コードされたデータが含まれている必要があります。

     Added in version 3.1.

 -- の関数: base64.encode (input, output)

     バイナリの 'input' ファイルの中身を base64 形式でエンコードした結果
     を 'output' ファイルに出力します。 'input' 、 'output' ともに *note
     file objects: 13db. でなければなりません。 'input' は
     ‘input.read()’ が空バイト列を返すまで読まれます。 *note encode():
     3cb4. は76バイトの出力ごとに改行文字(‘b'\n'’)を挿入し、 RFC 2045(1)
     (MIME) の規定にあるように常に出力が新しい行で終わることを保証します
     。

 -- の関数: base64.encodebytes (s)

     *note bytes-like object: 193. 's' (任意のバイナリデータを含むことが
     できます) を、 RFC 2045(2) (MIME) に規定されるように末尾に新しい行
     のある、76バイトの出力ごとに新しい行 (‘b'\n'’) が挿入された、base64
     形式でエンコードしたデータを含む *note bytes: 192. を返します。

     Added in version 3.1.

モジュールの使用例:

     >>> import base64
     >>> encoded = base64.b64encode(b'data to be encoded')
     >>> encoded
     b'ZGF0YSB0byBiZSBlbmNvZGVk'
     >>> data = base64.b64decode(encoded)
     >>> data
     b'data to be encoded'

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2045.html

   (2) https://datatracker.ietf.org/doc/html/rfc2045.html


File: python.info,  Node: セキュリティで考慮すべき点<4>,  Prev: レガシーインターフェース,  Up: base64 --- Base16 Base32 Base64 Base85 データのエンコード

5.20.5.4 セキュリティで考慮すべき点
...................................

A new security considerations section was added to RFC 4648(1) (section
12); it's recommended to review the security section for any code
deployed to production.

参考
....

モジュール *note binascii: 11.

     ASCII からバイナリへ、バイナリから ASCII への変換をサポートするモジ
     ュール。

RFC 1521(2) - MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms for Specifying and Describing the Format of Internet Message Bodies

     Section 5.2, "Base64 Content-Transfer-Encoding," provides the
     definition of the base64 encoding.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc4648.html

   (2) https://datatracker.ietf.org/doc/html/rfc1521.html


File: python.info,  Node: binascii --- バイナリ と ASCII 間の変換,  Next: quopri --- MIME quoted-printable データのエンコードとデコード,  Prev: base64 --- Base16 Base32 Base64 Base85 データのエンコード,  Up: インターネット上のデータの操作

5.20.6 ‘binascii’ -- バイナリ と ASCII 間の変換
-----------------------------------------------

__________________________________________________________________

The ‘binascii’ module contains a number of methods to convert between
binary and various ASCII-encoded binary representations.  Normally, you
will not use these functions directly but use wrapper modules like *note
base64: f. instead.  The ‘binascii’ module contains low-level functions
written in C for greater speed that are used by the higher-level
modules.

     注釈: ‘a2b_*’ 関数は ASCII 文字だけを含むユニコード文字列を受け取り
     ます。他の関数は (*note bytes: 192. や *note bytearray: 344. または
     バッファープロトコルをサポートするその他のオブジェクトのような)
     *note bytes-like オブジェクト: 193. だけを受け取ります。

     バージョン 3.3 で変更: ‘a2b_*’ 関数は ASCII のみのユニコード文字列
     を受け取るようになりました。

The ‘binascii’ module defines the following functions:

 -- の関数: binascii.a2b_uu (string)

     uuencode された 1 行のデータをバイナリに変換し、変換後のバイナリデ
     ータを返します。最後の行を除いて、通常 1 行には (バイナリデータで)
     45 バイトが含まれます。入力データの先頭には空白文字が連続していても
     かまいません。

 -- の関数: binascii.b2a_uu (data, *, backtick=False)

     Convert binary data to a line of ASCII characters, the return value
     is the converted line, including a newline char.  The length of
     'data' should be at most 45.  If 'backtick' is true, zeros are
     represented by ‘'`'’ instead of spaces.

     バージョン 3.7 で変更: 'backtick' パラメータを追加しました.

 -- の関数: binascii.a2b_base64 (string, /, *, strict_mode=False)

     base64 でエンコードされたデータのブロックをバイナリに変換し、変換後
     のバイナリデータを返します。一度に 1 行以上のデータを与えてもかまい
     ません。

     If 'strict_mode' is true, only valid base64 data will be converted.
     Invalid base64 data will raise *note binascii.Error: 1227.

     Valid base64:

        * Conforms to RFC 3548(1).

        * Contains only characters from the base64 alphabet.

        * Contains no excess data after padding (including excess
          padding, newlines, etc.).

        * Does not start with a padding.

     バージョン 3.11 で変更: Added the 'strict_mode' parameter.

 -- の関数: binascii.b2a_base64 (data, *, newline=True)

     バイナリデータを base64 でエンコードされた 1 行の ASCII 文字列に変
     換します。戻り値は変換後の 1 行の文字列で、'newline' が真の場合改行
     文字を含みます。この関数の出力は RFC 3548(2) を遵守します。

     バージョン 3.6 で変更: パラメータに 'newline' を追加しました。

 -- の関数: binascii.a2b_qp (data, header=False)

     quoted-printable 形式のデータをバイナリに変換し、バイナリデータを返
     します。一度に 1 行以上のデータを渡すことができます。オプション引数
     'header' が与えられており、かつその値が真であれば、アンダースコアは
     空白文字にデコードされます。

 -- の関数: binascii.b2a_qp (data, quotetabs=False, istext=True,
          header=False)

     バイナリデータを quoted-printable 形式でエンコードして 1 行から複数
     行の ASCII 文字列に変換します。変換後の文字列を返します。オプション
     引数 'quptetabs' が存在し、かつその値が真であれば、全てのタブおよび
     空白文字もエンコードされます。オプション引数 'istext' が存在し、か
     つその値が真であれば、改行はエンコードされませんが、行末の空白文字
     はエンコードされます。オプション引数 'header' が存在し、かつその値
     が真である場合、空白文字は RFC 1522(3) にしたがってアンダースコアに
     エンコードされます。オプション引数 'header' が存在し、かつその値が
     偽である場合、改行文字も同様にエンコードされます。そうでない場合、
     復帰 (linefeed) 文字の変換によってバイナリデータストリームが破損し
     てしまうかもしれません。

 -- の関数: binascii.crc_hqx (data, value)

     'value' を CRC の初期値として 'data' の 16 ビット CRC 値を計算し、
     その結果を返します。 この関数は、よく 0x1021 と表現される CRC-CCITT
     多項式 'x'^16 + 'x'^12 + 'x'^5 + 1 を使います。 この CRC は binhex4
     形式で使われています。

 -- の関数: binascii.crc32 (data[, value])

     符号無し 32 ビットチェックサムである CRC-32 を 'data' に対して計算
     します。 crc の初期値は 'value' です。デフォルトの CRC の初期値はゼ
     ロです。このアルゴリズムは ZIP ファイルのチェックサムと同じです。こ
     のアルゴリズムはチェックサムアルゴリズムとして設計されたもので、一
     般的なハッシュアルゴリズムには向きません。以下のようにして使います:

          print(binascii.crc32(b"hello world"))
          # Or, in two pieces:
          crc = binascii.crc32(b"hello")
          crc = binascii.crc32(b" world", crc)
          print('crc32 = {:#010x}'.format(crc))

     バージョン 3.0 で変更: The result is always unsigned.

 -- の関数: binascii.b2a_hex (data[, sep[, bytes_per_sep=1]])
 -- の関数: binascii.hexlify (data[, sep[, bytes_per_sep=1]])

     バイナリ 'data' の16進表現を返します。'data' の各バイトは、対応する
     2桁の16進表現に変換されます。したがって、返されるバイトオブジェクト
     は 'data' の2倍の長さになります。

     Similar functionality (but returning a text string) is also
     conveniently accessible using the *note bytes.hex(): f65. method.

     If 'sep' is specified, it must be a single character str or bytes
     object.  It will be inserted in the output after every
     'bytes_per_sep' input bytes.  Separator placement is counted from
     the right end of the output by default, if you wish to count from
     the left, supply a negative 'bytes_per_sep' value.

          >>> import binascii
          >>> binascii.b2a_hex(b'\xb9\x01\xef')
          b'b901ef'
          >>> binascii.hexlify(b'\xb9\x01\xef', '-')
          b'b9-01-ef'
          >>> binascii.b2a_hex(b'\xb9\x01\xef', b'_', 2)
          b'b9_01ef'
          >>> binascii.b2a_hex(b'\xb9\x01\xef', b' ', -2)
          b'b901 ef'

     バージョン 3.8 で変更: 引数 'sep' と 'bytes_per_sep' が追加されまし
     た.

 -- の関数: binascii.a2b_hex (hexstr)
 -- の関数: binascii.unhexlify (hexstr)

     16進数表記の文字列 'hexstr' の表すバイナリデータを返します。この関
     数は *note b2a_hex(): 287e. の逆です。 'hexstr' は 16進数字 (大文字
     でも小文字でも構いません) を偶数個含んでいなければなりません。そう
     でない場合、例外 *note Error: 1227. が送出されます。

     Similar functionality (accepting only text string arguments, but
     more liberal towards whitespace) is also accessible using the *note
     bytes.fromhex(): 190. class method.

 -- 例外: binascii.Error

     エラーが発生した際に送出される例外です。通常はプログラムのエラーで
     す。

 -- 例外: binascii.Incomplete

     変換するデータが不完全な場合に送出される例外です。通常はプログラム
     のエラーではなく、多少追加読み込みを行って再度変換を試みることで対
     処できます。

参考
....

*note base64: f. モジュール

     RFC 準拠の base64 形式の、底が 16、32、64、85 のエンコーディング。

*note quopri: bc. モジュール

     MIME 電子メールメッセージで使われる quoted-printable エンコードのサ
     ポート。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc3548.html

   (2) https://datatracker.ietf.org/doc/html/rfc3548.html

   (3) https://datatracker.ietf.org/doc/html/rfc1522.html


File: python.info,  Node: quopri --- MIME quoted-printable データのエンコードとデコード,  Prev: binascii --- バイナリ と ASCII 間の変換,  Up: インターネット上のデータの操作

5.20.7 ‘quopri’ -- MIME quoted-printable データのエンコードとデコード
---------------------------------------------------------------------

'ソースコード:' Lib/quopri.py(1)

__________________________________________________________________

このモジュールは RFC 1521(2): "MIME (Multipurpose Internet Mail
Extensions) Part One: Mechanisms for Specifying and Describing the
Format of Internet Message Bodies" で定義されている quoted-printable に
よる伝送のエンコードおよびデコードを行います。 quoted-printable エンコー
ディングは比較的印字不可能な文字の少ないデータのために設計されています;
画像ファイルを送るときのように印字不可能な文字がたくさんある場合には、
*note base64: f. モジュールで利用できる base64 エンコーディングのほうが
よりコンパクトになります。

 -- の関数: quopri.decode (input, output, header=False)

     ファイル 'input' の内容をデコードして、デコードされたバイナリデータ
     をファイル 'output' に書き出します。 'input' および 'output' は
     *note バイナリファイルオブジェクト: 13db. でなければなりません。オ
     プション引数 'header' が存在し、かつその値が真である場合、アンダー
     スコアは空白文字にデコードされます。これは RFC 1522(3): "MIME
     (Multipurpose Internet Mail Extensions) Part Two: Message Header
     Extensions for Non-ASCII Text" で記述されているところの "Q"-エンコ
     ードされたヘッダをデコードするのに使われます。

 -- の関数: quopri.encode (input, output, quotetabs, header=False)

     ファイル 'input' の内容をエンコードして、その結果の
     quoted-printable データをファイル 'output' に書き出します。 'input'
     および 'output' は *note バイナリファイルオブジェクト: 13db. でなけ
     ればなりません。 'quotetabs' は、内容に含まれている空白とタブ文字を
     エンコードするかどうかを制御する必須のフラグで、真のときは空白文字
     をエンコードし、偽のときはエンコードしないままにしておきます。 RFC
     1521(4) に従って、行末にある空白とタブ文字は常にエンコードされるこ
     とに注意してください。 'header' は、空白を RFC 1522(5) に従ってアン
     ダースコアにエンコードするかどうかを制御するフラグです。

 -- の関数: quopri.decodestring (s, header=False)

     *note decode(): 2881. に似ていますが、ソース *note bytes: 192. を受
     け取り、対応するデコードされた *note bytes: 192. を返します。

 -- の関数: quopri.encodestring (s, quotetabs=False, header=False)

     *note encode(): 2880. に似ていますが、ソース *note bytes: 192. を受
     け取り、対応するエンコードされた *note bytes: 192. を返します。 デ
     フォルトでは、 *note encode(): 2880. 関数の 'quotetabs' パラメータ
     に ‘False’ を渡します。

参考
....

*note base64: f. モジュール

     MIME base64 形式データのエンコードおよびデコード

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/quopri.py

   (2) https://datatracker.ietf.org/doc/html/rfc1521.html

   (3) https://datatracker.ietf.org/doc/html/rfc1522.html

   (4) https://datatracker.ietf.org/doc/html/rfc1521.html

   (5) https://datatracker.ietf.org/doc/html/rfc1522.html


File: python.info,  Node: 構造化マークアップツール,  Next: インターネットプロトコルとサポート,  Prev: インターネット上のデータの操作,  Up: Python 標準ライブラリ

5.21 構造化マークアップツール
=============================

Python は様々な構造化データマークアップ形式を扱うための、様々なモジュー
ルをサポートしています。これらは標準化一般マークアップ言語 (SGML) および
ハイパーテキストマークアップ言語 (HTML)、そして可拡張性マークアップ言語
(XML) を扱うためのいくつかのインターフェースからなります。

* Menu:

* html: html --- HyperText Markup Language のサポート. HyperText Markup Language のサポート
* html.parser: html parser --- HTML と XHTML のシンプルなパーサー. HTML と XHTML のシンプルなパーサー
* html.entities: html entities --- HTML 一般実体の定義. HTML 一般実体の定義
* XMLを扱うモジュール群::
* xml.etree.ElementTree: xml etree ElementTree --- ElementTree XML API. ElementTree XML API
* xml.dom: xml dom --- ドキュメントオブジェクトモデル API. ドキュメントオブジェクトモデル API
* xml.dom.minidom: xml dom minidom --- 最小限の DOM の実装. 最小限の DOM の実装
* xml.dom.pulldom: xml dom pulldom --- 部分的な DOM ツリー構築のサポート. 部分的な DOM ツリー構築のサポート
* xml.sax: xml sax --- SAX2 バーサーのサポート. SAX2 バーサーのサポート
* xml.sax.handler: xml sax handler --- SAX ハンドラーの基底クラス. SAX ハンドラーの基底クラス
* xml.sax.saxutils: xml sax saxutils --- SAX ユーティリティー. SAX ユーティリティー
* xml.sax.xmlreader: xml sax xmlreader --- XML パーサーのインターフェース. XML パーサーのインターフェース
* xml.parsers.expat: xml parsers expat --- Expat を使用した高速な XML 解析. Expat を使用した高速な XML 解析


File: python.info,  Node: html --- HyperText Markup Language のサポート,  Next: html parser --- HTML と XHTML のシンプルなパーサー,  Up: 構造化マークアップツール

5.21.1 ‘html’ -- HyperText Markup Language のサポート
-----------------------------------------------------

'ソースコード:' Lib/html/__init__.py(1)

__________________________________________________________________

このモジュールは HTML を操作するユーティリティを定義しています。

 -- の関数: html.escape (s, quote=True)

     Convert the characters ‘&’, ‘<’ and ‘>’ in string 's' to HTML-safe
     sequences.  Use this if you need to display text that might contain
     such characters in HTML. If the optional flag 'quote' is true (the
     default), the characters (‘"’) and (‘'’) are also translated; this
     helps for inclusion in an HTML attribute value delimited by quotes,
     as in ‘<a href="...">’.  If 'quote' is set to false, the characters
     (‘"’) and (‘'’) are not translated.

     Added in version 3.2.

 -- の関数: html.unescape (s)

     文字列 's' 中の名前や数字による参照 (例えば ‘&gt;’, ‘&#62;’,
     ‘&#x3e;’) を全て対応するユニコード文字に変換します。 この関数は、
     HTML 5 標準規格で定められた有効な文字参照および無効な文字参照、
     *note list of HTML 5 named character references: 12e9. を対象としま
     す。

     Added in version 3.4.

__________________________________________________________________

‘html’ パッケージのサブモジュールは以下のとおりです:

   * *note html.parser: 71. - 許容性のあるモードを持つ HTML/XHTML パーサ
     ー

   * *note html.entities: 70. - HTML 実体の定義

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/html/__init__.py


File: python.info,  Node: html parser --- HTML と XHTML のシンプルなパーサー,  Next: html entities --- HTML 一般実体の定義,  Prev: html --- HyperText Markup Language のサポート,  Up: 構造化マークアップツール

5.21.2 ‘html.parser’ -- HTML と XHTML のシンプルなパーサー
----------------------------------------------------------

'ソースコード:' Lib/html/parser.py(1)

__________________________________________________________________

このモジュールでは *note HTMLParser: a77. クラスを定義します。このクラス
は HTML (ハイパーテキスト記述言語、HyperText Mark-up Language) および
XHTML で書式化されているテキストファイルを解釈するための基礎となります。

 -- クラス: html.parser.HTMLParser (*, convert_charrefs=True,
          scripting=False)

     不正なマークアップをパースできるパーサーインスタンスを作成します。

     If 'convert_charrefs' is true (the default), all character
     references (except the ones in elements like ‘script’ and ‘style’)
     are automatically converted to the corresponding Unicode
     characters.

     If 'scripting' is false (the default), the content of the
     ‘noscript’ element is parsed normally; if it's true, it's returned
     as is without being parsed.

     *note HTMLParser: a77. インスタンスは、HTML データが入力されると、
     開始タグ、終了タグ、およびその他の要素が見つかる度にハンドラーメソ
     ッドを呼び出します。各メソッドの挙動を実装するには *note
     HTMLParser: a77. サブクラスを使ってそれぞれを上書きして行います。

     このパーサーは終了タグが開始タグと一致しているか調べたり、外側のタ
     グ要素が閉じるときに内側で明示的に閉じられていないタグ要素のタグ終
     了ハンドラーを呼び出したりはしません。

     バージョン 3.4 で変更: キーワード引数 'convert_charrefs' を追加。

     バージョン 3.5 で変更: 'convert_charrefs' のデフォルト値は ‘True’ に
     なりました。

     バージョン 3.14.1 で変更: Added the 'scripting' parameter.

* Menu:

* HTML パーサーアプリケーションの例::
* HTMLParser メソッド::
* 使用例: 使用例<32>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/html/parser.py


File: python.info,  Node: HTML パーサーアプリケーションの例,  Next: HTMLParser メソッド,  Up: html parser --- HTML と XHTML のシンプルなパーサー

5.21.2.1 HTML パーサーアプリケーションの例
..........................................

As a basic example, below is a simple HTML parser that uses the *note
HTMLParser: a77. class to print out start tags, end tags, and data as
they are encountered:

     from html.parser import HTMLParser

     class MyHTMLParser(HTMLParser):
         def handle_starttag(self, tag, attrs):
             print("Encountered a start tag:", tag)

         def handle_endtag(self, tag):
             print("Encountered an end tag :", tag)

         def handle_data(self, data):
             print("Encountered some data  :", data)

     parser = MyHTMLParser()
     parser.feed('<html><head><title>Test</title></head>'
                 '<body><h1>Parse me!</h1></body></html>')

出力は以下のようになります:

     Encountered a start tag: html
     Encountered a start tag: head
     Encountered a start tag: title
     Encountered some data  : Test
     Encountered an end tag : title
     Encountered an end tag : head
     Encountered a start tag: body
     Encountered a start tag: h1
     Encountered some data  : Parse me!
     Encountered an end tag : h1
     Encountered an end tag : body
     Encountered an end tag : html


File: python.info,  Node: HTMLParser メソッド,  Next: 使用例<32>,  Prev: HTML パーサーアプリケーションの例,  Up: html parser --- HTML と XHTML のシンプルなパーサー

5.21.2.2 ‘HTMLParser’ メソッド
..............................

*note HTMLParser: a77. インスタンスは以下のメソッドを提供します:

 -- メソッド: HTMLParser.feed (data)

     パーサーにテキストを入力します。入力が完全なタグ要素で構成されてい
     る場合に限り処理が行われます; 不完全なデータであった場合、新たにデ
     ータが入力されるか、*note close(): 1841. が呼び出されるまでバッファ
     ーされます。 'data' は *note str: 169. でなければなりません。

 -- メソッド: HTMLParser.close ()

     全てのバッファーされているデータについて、その後にファイル終端マー
     クが続いているとみなして強制的に処理を行います。このメソッドは入力
     データの終端で行う追加処理を定義するために、派生クラスで再定義する
     ことができます。しかし、再定義されたバージョンでは、常に *note
     HTMLParser: a77. 基底クラスのメソッド *note close(): 1841. を呼び出
     さなくてはなりません。

 -- メソッド: HTMLParser.reset ()

     インスタンスをリセットします。未処理のデータはすべて失われます。イ
     ンスタンス化の際に暗黙的に呼び出されます。

 -- メソッド: HTMLParser.getpos ()

     現在の行番号およびオフセット値を返します。

 -- メソッド: HTMLParser.get_starttag_text ()

     最も最近開かれた開始タグのテキスト部分を返します。このテキストは必
     ずしも元データを構造化する上で必須ではありませんが、 "広く知られて
     いる (as deployed)" HTML を扱ったり、入力を最小限の変更で再生成 (属
     性間の空白をそのままにする、など) したりする場合に便利なことがあり
     ます。

以下のメソッドはデータまたはマークアップ要素が見つかる度に呼び出されます
。これらはサブクラスで上書きされることを想定されています。基底クラスの実
装は (*note handle_startendtag(): 3cd3. を除き) 何もしません:

 -- メソッド: HTMLParser.handle_starttag (tag, attrs)

     このメソッドは要素の開始タグを扱うために呼び出されます (例: ‘<div
     id="main">’)。

     引数 'tag' はタグの名前で、小文字に変換されます。引数 'attrs' は
     ‘(name, value)’ のペアからなるリストで、タグの ‘<>’ 括弧内にある属
     性が収められています。'name' は小文字に変換され、'value' 内の引用符
     は取り除かれ、文字参照と実態参照は置き換えられます。

     例えば、タグ ‘<A HREF="https://www.cwi.nl/">’ を処理する場合、この
     メソッドは ‘handle_starttag('a', [('href',
     'https://www.cwi.nl/')])’ として呼び出されます。

     *note html.entities: 70. からのすべての実態参照は、属性値に置き換え
     られます。

 -- メソッド: HTMLParser.handle_endtag (tag)

     このメソッドは要素の終了タグを扱うために呼び出されます (例:
     ‘</div>’)。

     引数 'tag' はタグの名前で、小文字に変換されます。

 -- メソッド: HTMLParser.handle_startendtag (tag, attrs)

     *note handle_starttag(): 3cd4. と似ていますが、パーサーが XHTML 形
     式の空タグ (‘<img ... />’) を見つける度に呼び出されます。この特定の
     字句情報が必要な場合にこのメソッドをサブクラスで上書きすることがで
     きます; 既定の実装では、単に *note handle_starttag(): 3cd4. および
     *note handle_endtag(): 3cd5. を呼び出します。

 -- メソッド: HTMLParser.handle_data (data)

     This method is called to process arbitrary data (e.g.  text nodes
     and the content of elements like ‘script’ and ‘style’).

 -- メソッド: HTMLParser.handle_entityref (name)

     This method is called to process a named character reference of the
     form ‘&name;’ (e.g.  ‘&gt;’), where 'name' is a general entity
     reference (e.g.  ‘'gt'’).  This method is only called if
     'convert_charrefs' is false.

 -- メソッド: HTMLParser.handle_charref (name)

     This method is called to process decimal and hexadecimal numeric
     character references of the form ‘&#NNN;’ and ‘&#xNNN;’.  For
     example, the decimal equivalent for ‘&gt;’ is ‘&#62;’, whereas the
     hexadecimal is ‘&#x3E;’; in this case the method will receive
     ‘'62'’ or ‘'x3E'’.  This method is only called if
     'convert_charrefs' is false.

 -- メソッド: HTMLParser.handle_comment (data)

     このメソッドはコメントが見つかった場合に呼び出されます (例:
     ‘<!--comment-->’)。

     例えば、コメント ‘<!-- comment -->’ があると。このメソッドを引数 ‘'
     comment '’ で呼び出されます。

     Internet Explorer 独自拡張の条件付きコメント (condcoms) はこのメソ
     ッドに送ることができます。‘<!--[if IE 9]>IE9-specific
     content<![endif]-->’ の場合、このメソッドは ‘'[if IE
     9]>IE9-specific content<![endif]'’ を受け取ります。

 -- メソッド: HTMLParser.handle_decl (decl)

     このメソッドは HTML doctype 宣言を扱うために呼び出されます (例:
     ‘<!DOCTYPE html>’)。

     引数 'decl' は ‘<!...>’ マークアップ内の宣言の内容全体になります (例
     : ‘'DOCTYPE html'’)。

 -- メソッド: HTMLParser.handle_pi (data)

     処理指令が見つかった場合に呼び出されます。'data' には、処理指令全体
     が含まれ、例えば ‘<?proc color='red'>’ という処理指令の場合、
     ‘handle_pi("proc color='red'")’ のように呼び出されます。このメソッ
     ドは派生クラスで上書きするためのメソッドです; 基底クラスの実装では
     何も行いません。

          注釈: *note HTMLParser: a77. クラスでは、処理指令に SGML の構
          文を使用します。末尾に ‘'?'’ がある XHTML の処理指令では、
          ‘'?'’ が 'data' に含まれることになります。

 -- メソッド: HTMLParser.unknown_decl (data)

     このメソッドはパーサーが未知の宣言を読み込んだ時に呼び出されます。

     パラメータ 'data' は ‘<![...]>’ マークアップ内の宣言の内容全体にな
     ります。 これは派生クラスで上書きする時に役立つことがあります。 基
     底クラスの実装では何もしません。


File: python.info,  Node: 使用例<32>,  Prev: HTMLParser メソッド,  Up: html parser --- HTML と XHTML のシンプルなパーサー

5.21.2.3 使用例
...............

The following class implements a parser that will be used to illustrate
more examples:

     from html.parser import HTMLParser
     from html.entities import name2codepoint

     class MyHTMLParser(HTMLParser):
         def handle_starttag(self, tag, attrs):
             print("Start tag:", tag)
             for attr in attrs:
                 print("     attr:", attr)

         def handle_endtag(self, tag):
             print("End tag  :", tag)

         def handle_data(self, data):
             print("Data     :", data)

         def handle_comment(self, data):
             print("Comment  :", data)

         def handle_entityref(self, name):
             c = chr(name2codepoint[name])
             print("Named ent:", c)

         def handle_charref(self, name):
             if name.startswith('x'):
                 c = chr(int(name[1:], 16))
             else:
                 c = chr(int(name))
             print("Num ent  :", c)

         def handle_decl(self, data):
             print("Decl     :", data)

     parser = MyHTMLParser()

Parsing a doctype:

     >>> parser.feed('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" '
     ...             '"http://www.w3.org/TR/html4/strict.dtd">')
     Decl     : DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"

Parsing an element with a few attributes and a title:

     >>> parser.feed('<img src="python-logo.png" alt="The Python logo">')
     Start tag: img
          attr: ('src', 'python-logo.png')
          attr: ('alt', 'The Python logo')
     >>>
     >>> parser.feed('<h1>Python</h1>')
     Start tag: h1
     Data     : Python
     End tag  : h1

The content of elements like ‘script’ and ‘style’ is returned as is,
without further parsing:

     >>> parser.feed('<style type="text/css">#python { color: green }</style>')
     Start tag: style
          attr: ('type', 'text/css')
     Data     : #python { color: green }
     End tag  : style

     >>> parser.feed('<script type="text/javascript">'
     ...             'alert("<strong>hello! &#9786;</strong>");</script>')
     Start tag: script
          attr: ('type', 'text/javascript')
     Data     : alert("<strong>hello! &#9786;</strong>");
     End tag  : script

Parsing comments:

     >>> parser.feed('<!--a comment-->'
     ...             '<!--[if IE 9]>IE-specific content<![endif]-->')
     Comment  : a comment
     Comment  : [if IE 9]>IE-specific content<![endif]

Parsing named and numeric character references and converting them to
the correct char (note: these 3 references are all equivalent to ‘'>'’):

     >>> parser = MyHTMLParser()
     >>> parser.feed('&gt;&#62;&#x3E;')
     Data     : >>>

     >>> parser = MyHTMLParser(convert_charrefs=False)
     >>> parser.feed('&gt;&#62;&#x3E;')
     Named ent: >
     Num ent  : >
     Num ent  : >

Feeding incomplete chunks to *note feed(): 3ccf. works, but *note
handle_data(): 3cd6. might be called more than once if
'convert_charrefs' is false:

     >>> for chunk in ['<sp', 'an>buff', 'ered', ' text</s', 'pan>']:
     ...     parser.feed(chunk)
     ...
     Start tag: span
     Data     : buff
     Data     : ered
     Data     :  text
     End tag  : span

Parsing invalid HTML (e.g.  unquoted attributes) also works:

     >>> parser.feed('<p><a class=link href=#main>tag soup</p ></a>')
     Start tag: p
     Start tag: a
          attr: ('class', 'link')
          attr: ('href', '#main')
     Data     : tag soup
     End tag  : p
     End tag  : a


File: python.info,  Node: html entities --- HTML 一般実体の定義,  Next: XMLを扱うモジュール群,  Prev: html parser --- HTML と XHTML のシンプルなパーサー,  Up: 構造化マークアップツール

5.21.3 ‘html.entities’ -- HTML 一般実体の定義
---------------------------------------------

'ソースコード:' Lib/html/entities.py(1)

__________________________________________________________________

このモジュールは 4 つの辞書、*note html5: 12e9.、*note name2codepoint:
3ce2.、*note codepoint2name: 3ce3.、および *note entitydefs: 3ce4. を定
義しています。

 -- データ: html.entities.html5

     HTML5 名前付き文字参照 (2) と Unicode 文字とを対応付ける辞書です (例
     : ‘html5['gt;'] == '>'’)。末尾のセミコロンは名前に含まれますが (例:
     ‘'gt;'’)、一部の名前はセミコロンなしでも標準で受け付けます。この場
     合、‘';'’ ありの名前と ‘';'’ なしの名前が両方存在します。 *note
     html.unescape(): b50. も参照してください。

     Added in version 3.3.

 -- データ: html.entities.entitydefs

     各 XHTML 1.0 実体定義と ISO Latin-1 における置換テキストとを対応付
     ける辞書です。

 -- データ: html.entities.name2codepoint

     HTML4 実体名と Unicode コードポイントとを対応付ける辞書です。

 -- データ: html.entities.codepoint2name

     Unicode コードポイントと HTML4 実体名とを対応付ける辞書です。

脚注
....

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/html/entities.py

   (2) 
‘https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references’
を参照


File: python.info,  Node: XMLを扱うモジュール群,  Next: xml etree ElementTree --- ElementTree XML API,  Prev: html entities --- HTML 一般実体の定義,  Up: 構造化マークアップツール

5.21.4 XMLを扱うモジュール群
----------------------------

'ソースコード:' Lib/xml/(1)

__________________________________________________________________

PythonのXMLを扱うインターフェースは ‘xml’ パッケージにまとめられています
。

     注釈: If you need to parse untrusted or unauthenticated data, see
     *note XML security: 3ce9.

It is important to note that modules in the ‘xml’ package require that
there be at least one SAX-compliant XML parser available.  The Expat
parser is included with Python, so the *note xml.parsers.expat: 12c.
module will always be available.

*note xml.dom: 127. および *note xml.sax: 12f. パッケージのドキュメント
は Python による DOM および SAX インターフェースへのバインディングに関す
る定義です。

XML に関連するサブモジュール:

   * *note xml.etree.ElementTree: 12b.: ElementTree API、シンプルで軽量
     な XML プロセッサ

   * *note xml.dom: 127.: DOM API の定義

   * *note xml.dom.minidom: 128.: 最小限の DOM の実装

   * *note xml.dom.pulldom: 129.: 部分的な DOM ツリー構築のサポート

   * *note xml.sax: 12f.: SAX2 基底クラスと便利関数群

   * *note xml.parsers.expat: 12c.: Expat parser バインディング
* Menu:

* XML security::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/xml/


File: python.info,  Node: XML security,  Up: XMLを扱うモジュール群

5.21.4.1 XML security
.....................

An attacker can abuse XML features to carry out denial of service
attacks, access local files, generate network connections to other
machines, or circumvent firewalls when attacker-controlled XML is being
parsed, in Python or elsewhere.

The built-in XML parsers of Python rely on the library libexpat(1),
commonly called Expat, for parsing XML.

By default, Expat itself does not access local files or create network
connections.

Expat versions lower than 2.7.2 may be vulnerable to the "billion
laughs", "quadratic blowup" and "large tokens" vulnerabilities, or to
disproportional use of dynamic memory.  Python bundles a copy of Expat,
and whether Python uses the bundled or a system-wide Expat, depends on
how the Python interpreter *note has been configured: 1b2d. in your
environment.  Python may be vulnerable if it uses such older versions of
Expat.  Check ‘pyexpat.EXPAT_VERSION’.

*note xmlrpc: 133. is 'vulnerable' to the "decompression bomb" attack.

billion laughs / exponential entity expansion

     Billion Laughs(2) 攻撃 - または指数関数的エンティティ展開
     (exponential entity expansion) - は複数階層の入れ子になったエンティ
     ティを使用します。 各エンティティは別のエンティティを複数回参照し、
     最終的なエンティティの定義は短い文字列です。 指数関数的に展開される
     ことで数 GB のテキストができ、多くのメモリと CPU 時間を消費します。

quadratic blowup entity expansion

     二次爆発攻撃 (quadratic blowup attack) はエンティティ展開を悪用する
     点で Billion Laughs(3) 攻撃に似ています。 入れ子になったエンティテ
     ィの代わりに、この攻撃は数千字の大きなエンティティを何度も繰り返し
     ます。 この攻撃は指数関数的なものほど効率的ではありませんが、パーザ
     の深い入れ子になったエンティティを禁止する対抗手段をすり抜けます。

decompression bomb

     解凍爆弾 (あるいは ZIP 爆弾(4)) は、gzip 圧縮 HTTP ストリームや
     LZMA 圧縮ファイルなどの圧縮された XML ストリームをパースできる全て
     の XML ライブラリに対し行われます。 攻撃者は送信データ量を1/3以下に
     減らすことができます。

large tokens

     Expat needs to re-parse unfinished tokens; without the protection
     introduced in Expat 2.6.0, this can lead to quadratic runtime that
     can be used to cause denial of service in the application parsing
     XML. The issue is known as CVE 2023-52425(5).

   ---------- Footnotes ----------

   (1) https://github.com/libexpat/libexpat

   (2) https://en.wikipedia.org/wiki/Billion_laughs

   (3) https://en.wikipedia.org/wiki/Billion_laughs

   (4) 
https://ja.wikipedia.org/wiki/%E9%AB%98%E5%9C%A7%E7%B8%AE%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E7%88%86%E5%BC%BE

   (5) https://www.cve.org/CVERecord?id=CVE-2023-52425


File: python.info,  Node: xml etree ElementTree --- ElementTree XML API,  Next: xml dom --- ドキュメントオブジェクトモデル API,  Prev: XMLを扱うモジュール群,  Up: 構造化マークアップツール

5.21.5 ‘xml.etree.ElementTree’ -- ElementTree XML API
-----------------------------------------------------

'Source code:' Lib/xml/etree/ElementTree.py(1)

__________________________________________________________________

The ‘xml.etree.ElementTree’ module implements a simple and efficient API
for parsing and creating XML data.

バージョン 3.3 で変更: このモジュールは利用出来る場合は常に高速な実装を
使用します。

バージョン 3.3 で非推奨: The ‘xml.etree.cElementTree’ モジュールは非推奨
です。

     注釈: If you need to parse untrusted or unauthenticated data, see
     *note XML security: 3ce9.

* Menu:

* チュートリアル: チュートリアル<3>.
* XPath サポート::
* リファレンス: リファレンス<5>.
* XInclude サポート::
* リファレンス: リファレンス<6>.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/xml/etree/ElementTree.py


File: python.info,  Node: チュートリアル<3>,  Next: XPath サポート,  Up: xml etree ElementTree --- ElementTree XML API

5.21.5.1 チュートリアル
.......................

This is a short tutorial for using ‘xml.etree.ElementTree’ (‘ET’ in
short).  The goal is to demonstrate some of the building blocks and
basic concepts of the module.

* Menu:

* XML 木構造と要素::
* XML の解析::
* 非ブロックパースのためのプル API::
* 関心ある要素の検索::
* XML ファイルの編集::
* XML 文書の構築::
* 名前空間のある XML の解析::


File: python.info,  Node: XML 木構造と要素,  Next: XML の解析,  Up: チュートリアル<3>

5.21.5.2 XML 木構造と要素
.........................

XML は本質的に階層データ形式で、木構造で表すのが最も自然な方法です。‘ET’
はこの目的のために 2 つのクラス - XML 文書全体を木で表す *note
ElementTree: b47. および木構造内の単一ノードを表す *note Element: 363. -
を持っています。文書全体とのやりとり (ファイルの読み書き) は通常 *note
ElementTree: b47. レベルで行います。単一 XML 要素およびその子要素とのや
りとりは *note Element: 363. レベルで行います。


File: python.info,  Node: XML の解析,  Next: 非ブロックパースのためのプル API,  Prev: XML 木構造と要素,  Up: チュートリアル<3>

5.21.5.3 XML の解析
...................

We'll be using the fictive ‘country_data.xml’ XML document as the sample
data for this section:

     <?xml version="1.0"?>
     <data>
         <country name="Liechtenstein">
             <rank>1</rank>
             <year>2008</year>
             <gdppc>141100</gdppc>
             <neighbor name="Austria" direction="E"/>
             <neighbor name="Switzerland" direction="W"/>
         </country>
         <country name="Singapore">
             <rank>4</rank>
             <year>2011</year>
             <gdppc>59900</gdppc>
             <neighbor name="Malaysia" direction="N"/>
         </country>
         <country name="Panama">
             <rank>68</rank>
             <year>2011</year>
             <gdppc>13600</gdppc>
             <neighbor name="Costa Rica" direction="W"/>
             <neighbor name="Colombia" direction="E"/>
         </country>
     </data>

ファイルを読み込むことでこのデータをインポートすることが出来ます:

     import xml.etree.ElementTree as ET
     tree = ET.parse('country_data.xml')
     root = tree.getroot()

文字列から直接インポートすることも出来ます:

     root = ET.fromstring(country_data_as_string)

*note fromstring(): 3cf3. は XML を文字列から *note Element: 363. に直接
パースします。*note Element: 363. はパースされた木のルート要素です。他の
パース関数は *note ElementTree: b47. を作成するかもしれません。ドキュメ
ントをきちんと確認してください。

*note Element: 363. として、‘root’ はタグと属性の辞書を持ちます:

     >>> root.tag
     'data'
     >>> root.attrib
     {}

さらにイテレート可能な子ノードも持ちます:

     >>> for child in root:
     ...     print(child.tag, child.attrib)
     ...
     country {'name': 'Liechtenstein'}
     country {'name': 'Singapore'}
     country {'name': 'Panama'}

子ノードは入れ子になっており、インデックスで子ノードを指定してアクセスで
きます:

     >>> root[0][1].text
     '2008'

     注釈: XML 入力の全ての要素が、パース後の木に要素として含まれる訳で
     はありません。現在、このモジュールは入力中のいかなる XML コメント、
     処理命令、ドキュメントタイプ宣言も読み飛ばします。しかし、XML テキ
     ストからのパースではなく、このモジュールの API を使用して構築された
     木には、コメントや処理命令を含むことができ、それらは XML 出力の生成
     時に含まれます。ドキュメントタイプ宣言は、 *note XMLParser: c49. コ
     ンストラクタにカスタムの *note TreeBuilder: c4a. インスタンスを渡す
     ことで、アクセスすることができます。


File: python.info,  Node: 非ブロックパースのためのプル API,  Next: 関心ある要素の検索,  Prev: XML の解析,  Up: チュートリアル<3>

5.21.5.4 非ブロックパースのためのプル API
.........................................

このモジュールが提供するパース関数のほとんどは、結果を返す前に、ドキュメ
ント全体を読む必要があります。 *note XMLParser: c49. を使用して、インク
リメンタルにデータを渡すことは可能ではありますが、それはコールバック対象
のメソッドを呼ぶプッシュ API であり、多くの場合、低水準すぎて不便です。
ユーザーが望むのは、完全に出来上がった *note Element: 363. オブジェクト
を便利に使いながら、操作をブロックすることなく XML のパースをインクリメ
ンタルに行えることです。

これを行うための最も強力なツールは、 *note XMLPullParser: 11f5. です。
XML データを取得するためにブロックするような読み込みは必要なく、 *note
XMLPullParser.feed(): 3cf5. を呼び出して、インクリメンタルにデータを読み
ます。パースされた XML 要素を取得するには、*note
XMLPullParser.read_events(): 3cf6. を呼び出します。以下に、例を示します
。

     >>> parser = ET.XMLPullParser(['start', 'end'])
     >>> parser.feed('<mytag>sometext')
     >>> list(parser.read_events())
     [('start', <Element 'mytag' at 0x7fa66db2be58>)]
     >>> parser.feed(' more text</mytag>')
     >>> for event, elem in parser.read_events():
     ...     print(event)
     ...     print(elem.tag, 'text=', elem.text)
     ...
     end
     mytag text= sometext more text

これの分かりやすい用途は、XML データをソケットから受信したり、ストレージ
デバイスからインクリメンタルに読み出したりするような、非ブロック式に動作
するアプリケーションです。このような場合、ブロッキング読み出しは使用でき
ません。

*note XMLPullParser: 11f5. は柔軟性が非常に高いため、単純に使用したいユ
ーザーにとっては不便かもしれません。アプリケーションにおいて、XML データ
の読み取り時にブロックすることに支障がないが、インクリメンタルにパースす
る能力が欲しい場合、*note iterparse(): 57a. を参照してください。大きな
XML ドキュメントを読んでいて、全てメモリ上にあるという状態にしたくない場
合に有用です。

Where 'immediate' feedback through events is wanted, calling method
*note XMLPullParser.flush(): 577. can help reduce delay; please make
sure to study the related security notes.


File: python.info,  Node: 関心ある要素の検索,  Next: XML ファイルの編集,  Prev: 非ブロックパースのためのプル API,  Up: チュートリアル<3>

5.21.5.5 関心ある要素の検索
...........................

*note Element: 363. は、例えば、*note Element.iter(): 1566. などの、配下
(その子ノードや孫ノードなど) の部分木全体を再帰的にイテレートするいくつ
かの役立つメソッドを持っています:

     >>> for neighbor in root.iter('neighbor'):
     ...     print(neighbor.attrib)
     ...
     {'name': 'Austria', 'direction': 'E'}
     {'name': 'Switzerland', 'direction': 'W'}
     {'name': 'Malaysia', 'direction': 'N'}
     {'name': 'Costa Rica', 'direction': 'W'}
     {'name': 'Colombia', 'direction': 'E'}

*note Element.findall(): 187c. はタグで現在の要素の直接の子要素のみ検索
します。 *note Element.find(): 187a. は特定のタグで '最初の' 子要素を検
索し、 *note Element.text: 3cf8. は要素のテキストコンテンツにアクセスし
ます。 *note Element.get(): 3cf9. は要素の属性にアクセスします:

     >>> for country in root.findall('country'):
     ...     rank = country.find('rank').text
     ...     name = country.get('name')
     ...     print(name, rank)
     ...
     Liechtenstein 1
     Singapore 4
     Panama 68

*note XPath: da6. を使用すると、より洗練された方法で、検索したい要素を指
定することができます。


File: python.info,  Node: XML ファイルの編集,  Next: XML 文書の構築,  Prev: 関心ある要素の検索,  Up: チュートリアル<3>

5.21.5.6 XML ファイルの編集
...........................

*note ElementTree: b47. は XML 文書を構築してファイルに出力する簡単な方
法を提供しています。*note ElementTree.write(): c8c. メソッドはこの目的に
適います。

*note Element: 363. オブジェクトを作成すると、そのフィールドの直接変更
(*note Element.text: 3cf8. など) や、属性の追加および変更 (*note
Element.set(): 3cfb. メソッド)、あるいは新しい子ノードの追加 (例えば
*note Element.append(): 3cfc. など) によってそれを操作できます。

例えば各 country の rank に 1 を足して、rank 要素に ‘updated’ 属性を追加
したい場合:

     >>> for rank in root.iter('rank'):
     ...     new_rank = int(rank.text) + 1
     ...     rank.text = str(new_rank)
     ...     rank.set('updated', 'yes')
     ...
     >>> tree.write('output.xml')

XML はこのようになります:

     <?xml version="1.0"?>
     <data>
         <country name="Liechtenstein">
             <rank updated="yes">2</rank>
             <year>2008</year>
             <gdppc>141100</gdppc>
             <neighbor name="Austria" direction="E"/>
             <neighbor name="Switzerland" direction="W"/>
         </country>
         <country name="Singapore">
             <rank updated="yes">5</rank>
             <year>2011</year>
             <gdppc>59900</gdppc>
             <neighbor name="Malaysia" direction="N"/>
         </country>
         <country name="Panama">
             <rank updated="yes">69</rank>
             <year>2011</year>
             <gdppc>13600</gdppc>
             <neighbor name="Costa Rica" direction="W"/>
             <neighbor name="Colombia" direction="E"/>
         </country>
     </data>

*note Element.remove(): 1876. を使って要素を削除することが出来ます。例え
ば rank が 50 より大きい全ての country を削除したい場合:

     >>> for country in root.findall('country'):
     ...     # using root.findall() to avoid removal during traversal
     ...     rank = int(country.find('rank').text)
     ...     if rank > 50:
     ...         root.remove(country)
     ...
     >>> tree.write('output.xml')

Note that concurrent modification while iterating can lead to problems,
just like when iterating and modifying Python lists or dicts.
Therefore, the example first collects all matching elements with
‘root.findall()’, and only then iterates over the list of matches.

XML はこのようになります:

     <?xml version="1.0"?>
     <data>
         <country name="Liechtenstein">
             <rank updated="yes">2</rank>
             <year>2008</year>
             <gdppc>141100</gdppc>
             <neighbor name="Austria" direction="E"/>
             <neighbor name="Switzerland" direction="W"/>
         </country>
         <country name="Singapore">
             <rank updated="yes">5</rank>
             <year>2011</year>
             <gdppc>59900</gdppc>
             <neighbor name="Malaysia" direction="N"/>
         </country>
     </data>


File: python.info,  Node: XML 文書の構築,  Next: 名前空間のある XML の解析,  Prev: XML ファイルの編集,  Up: チュートリアル<3>

5.21.5.7 XML 文書の構築
.......................

*note SubElement(): 3cfe. 関数は、与えられた要素に新しい子要素を作成する
便利な手段も提供しています:

     >>> a = ET.Element('a')
     >>> b = ET.SubElement(a, 'b')
     >>> c = ET.SubElement(a, 'c')
     >>> d = ET.SubElement(c, 'd')
     >>> ET.dump(a)
     <a><b /><c><d /></c></a>


File: python.info,  Node: 名前空間のある XML の解析,  Prev: XML 文書の構築,  Up: チュートリアル<3>

5.21.5.8 名前空間のある XML の解析
..................................

XML 入力が 名前空間(1) を持っている場合、 ‘prefix:sometag’ の形式で修飾
されたタグと属性が、その 'prefix' が完全な 'URI' で置換された
‘{uri}sometag’ の形に展開されます。さらに、 デフォルトの XML 名前空間(2)
があると、修飾されていない全てのタグにその完全 URI が前置されます。

ひとつは接頭辞 "fictional" でもうひとつがデフォルト名前空間で提供された
、 2 つの名前空間を組み込んだ XML の例をここにお見せします:

     <?xml version="1.0"?>
     <actors xmlns:fictional="http://characters.example.com"
             xmlns="http://people.example.com">
         <actor>
             <name>John Cleese</name>
             <fictional:character>Lancelot</fictional:character>
             <fictional:character>Archie Leach</fictional:character>
         </actor>
         <actor>
             <name>Eric Idle</name>
             <fictional:character>Sir Robin</fictional:character>
             <fictional:character>Gunther</fictional:character>
             <fictional:character>Commander Clement</fictional:character>
         </actor>
     </actors>

この XML の例を、検索し、渡り歩くためのひとつの方法としては、 *note
find(): 187a. や *note findall(): 187c. に渡す xpath で全てのタグや属性
に手作業で URI を付けてまわる手があります:

     root = fromstring(xml_text)
     for actor in root.findall('{http://people.example.com}actor'):
         name = actor.find('{http://people.example.com}name')
         print(name.text)
         for char in actor.findall('{http://characters.example.com}character'):
             print(' |-->', char.text)

もっと良い方法があります。接頭辞の辞書を作り、これを検索関数で使うことで
す:

     ns = {'real_person': 'http://people.example.com',
           'role': 'http://characters.example.com'}

     for actor in root.findall('real_person:actor', ns):
         name = actor.find('real_person:name', ns)
         print(name.text)
         for char in actor.findall('role:character', ns):
             print(' |-->', char.text)

どちらのアプローチでも同じ結果です:

     John Cleese
      |--> Lancelot
      |--> Archie Leach
     Eric Idle
      |--> Sir Robin
      |--> Gunther
      |--> Commander Clement

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/XML_namespace

   (2) https://www.w3.org/TR/xml-names/#defaulting


File: python.info,  Node: XPath サポート,  Next: リファレンス<5>,  Prev: チュートリアル<3>,  Up: xml etree ElementTree --- ElementTree XML API

5.21.5.9 XPath サポート
.......................

このモジュールは木構造内の要素の位置決めのための XPath 式(1) を限定的に
サポートしています。その目指すところは短縮構文のほんの一部だけのサポート
であり、XPath エンジンのフルセットは想定していません。

* Menu:

* 使用例: 使用例<33>.
* サポートされている XPath 構文::

   ---------- Footnotes ----------

   (1) https://www.w3.org/TR/xpath


File: python.info,  Node: 使用例<33>,  Next: サポートされている XPath 構文,  Up: XPath サポート

5.21.5.10 使用例
................

以下はこのモジュールの XPath 機能の一部を紹介する例です。*note XML
の解析: 3cf1. 節から XML 文書 ‘countrydata’ を使用します:

     import xml.etree.ElementTree as ET

     root = ET.fromstring(countrydata)

     # Top-level elements
     root.findall(".")

     # All 'neighbor' grand-children of 'country' children of the top-level
     # elements
     root.findall("./country/neighbor")

     # Nodes with name='Singapore' that have a 'year' child
     root.findall(".//year/..[@name='Singapore']")

     # 'year' nodes that are children of nodes with name='Singapore'
     root.findall(".//*[@name='Singapore']/year")

     # All 'neighbor' nodes that are the second child of their parent
     root.findall(".//neighbor[2]")

For XML with namespaces, use the usual qualified ‘{namespace}tag’
notation:

     # All dublin-core "title" tags in the document
     root.findall(".//{http://purl.org/dc/elements/1.1/}title")


File: python.info,  Node: サポートされている XPath 構文,  Prev: 使用例<33>,  Up: XPath サポート

5.21.5.11 サポートされている XPath 構文
.......................................

操作                        意味
                            
---------------------------------------------------------------------------------------
                            
‘tag’                       Selects all child elements with the given tag.  For
                            example, ‘spam’ selects all child elements named ‘spam’,
                            and ‘spam/egg’ selects all grandchildren named ‘egg’ in
                            all children named ‘spam’.  ‘{namespace}*’ selects all
                            tags in the given namespace, ‘{*}spam’ selects tags
                            named ‘spam’ in any (or no) namespace, and ‘{}*’ only
                            selects tags that are not in a namespace.
                            
                            バージョン 3.8 で変更: Support for star-wildcards was
                            added.
                            
                            
‘*’                         Selects all child elements, including comments and
                            processing instructions.  For example, ‘*/egg’ selects
                            all grandchildren named ‘egg’.
                            
                            
‘.’                         現在のノードを選択します。これはパスの先頭に置くことで相
                            対パスであることを示すのに役立ちます。
                            
                            
‘//’                        現在の要素の下にある全てのレベルの全ての子要素を選択しま
                            す。例えば、‘.//egg’ は木全体から ‘egg’ 要素を選択します
                            。
                            
                            
‘..’                        親ノードを選択します。パスが開始要素 (‘find’ が呼ばれた
                            要素) の上の要素に進もうとした場合 ‘None’ を返します。
                            
                            
‘[@attrib]’                 与えられた属性を持つ全ての要素を選択します。
                            
                            
‘[@attrib='value']’         与えられた属性が与えられた値を持つ全ての要素を選択します
                            。 値に引用符は含められません。
                            
                            
‘[@attrib!='value']’        与えられた属性が与えられた値を持たない全ての要素を選択し
                            ます。 値に引用符は含められません。
                            
                            Added in version 3.10.
                            
                            
‘[tag]’                     ‘tag’ という名前の子要素を持つ全ての要素を選択します。 直
                            下の子要素のみサポートしています。
                            
                            
‘[.='text']’                子孫のうち、与えられた ‘text’ とテキスト全体が等しい全て
                            の要素を選択します。
                            
                            Added in version 3.7.
                            
                            
‘[.!='text']’               子孫のうち、与えられた ‘text’ とテキスト全体が等しくない
                            全ての要素を選択します。
                            
                            Added in version 3.10.
                            
                            
‘[tag='text']’              子孫を含む完全なテキストコンテンツと与えられた ‘text’ が
                            一致する、 ‘tag’ と名付けられた子要素を持つすべての要素
                            を選択します。
                            
                            
‘[tag!='text']’             子孫を含む完全なテキストコンテンツと与えられた ‘text’ が
                            一致しない、 ‘tag’ と名付けられた子要素を持つすべての要
                            素を選択します。
                            
                            Added in version 3.10.
                            
                            
‘[position]’                与えられた位置にあるすべての要素を選択します。位置は整数
                            (先頭は 1)、式 ‘last()’ (末尾)、あるいは末尾からの相対位
                            置 (例えば ‘last()-1’) のいずれかで指定できます。
                            

述語 (角括弧内の式) の前にはタグ名、アスタリスク、あるいはその他の述語が
なければなりません。 ‘position’ 述語の前にはタグ名がなければなりません。


File: python.info,  Node: リファレンス<5>,  Next: XInclude サポート,  Prev: XPath サポート,  Up: xml etree ElementTree --- ElementTree XML API

5.21.5.12 リファレンス
......................

* Menu:

* 関数: 関数<9>.


File: python.info,  Node: 関数<9>,  Up: リファレンス<5>

5.21.5.13 関数
..............

 -- の関数: xml.etree.ElementTree.canonicalize (xml_data=None, *,
          out=None, from_file=None, **options)

     C14N 2.0(1) transformation function.

     Canonicalization is a way to normalise XML output in a way that
     allows byte-by-byte comparisons and digital signatures.  It reduces
     the freedom that XML serializers have and instead generates a more
     constrained XML representation.  The main restrictions regard the
     placement of namespace declarations, the ordering of attributes,
     and ignorable whitespace.

     This function takes an XML data string ('xml_data') or a file path
     or file-like object ('from_file') as input, converts it to the
     canonical form, and writes it out using the 'out' file(-like)
     object, if provided, or returns it as a text string if not.  The
     output file receives text, not bytes.  It should therefore be
     opened in text mode with ‘utf-8’ encoding.

     利用例:

          xml_data = "<root>...</root>"
          print(canonicalize(xml_data))

          with open("c14n_output.xml", mode='w', encoding='utf-8') as out_file:
              canonicalize(xml_data, out=out_file)

          with open("c14n_output.xml", mode='w', encoding='utf-8') as out_file:
              canonicalize(from_file="inputfile.xml", out=out_file)

     The configuration 'options' are as follows:

        - 'with_comments': set to true to include comments (default:
          false)

        - 
          'strip_text': set to true to strip whitespace before and after text content

               (デフォルト: false)

        - 
          'rewrite_prefixes': set to true to replace namespace prefixes by "n{number}"

               (デフォルト: false)

        - 
          'qname_aware_tags': a set of qname aware tag names in which prefixes

               should be replaced in text content (default: empty)

        - 
          'qname_aware_attrs': a set of qname aware attribute names in which prefixes

               should be replaced in text content (default: empty)

        - 'exclude_attrs': a set of attribute names that should not be
          serialised

        - 'exclude_tags': a set of tag names that should not be
          serialised

     In the option list above, "a set" refers to any collection or
     iterable of strings, no ordering is expected.

     Added in version 3.8.

 -- の関数: xml.etree.ElementTree.Comment (text=None)

     コメント要素のファクトリです。このファクトリ関数は、標準のシリアラ
     イザでは XML コメントにシリアライズされる特別な要素を作ります。コメ
     ント文字列はバイト文字列でも Unicode 文字列でも構いません。'text' は
     そのコメント文字列を含んだ文字列です。コメントを表わす要素のインス
     タンスを返します。

     *note XMLParser: c49. は、入力に含まれるコメントを読み飛ばし、コメ
     ントオブジェクトは作成しません。*note ElementTree: b47. は、*note
     Element: 363. メソッドの 1 つを使用して木内に挿入されたコメントノー
     ドのみを含みます。

 -- の関数: xml.etree.ElementTree.dump (elem)

     要素の木もしくは要素の構造を sys.stdout に出力します。この関数はデ
     バッグ目的のみに使用してください。

     出力される形式の正確なところは実装依存です。このバージョンでは、通
     常の XML ファイルとして出力されます。

     'elem' は要素の木もしくは個別の要素です。

     バージョン 3.8 で変更: *note dump(): 3d07. 関数はユーザーが指定した
     属性の順序を保持するようになりました。

 -- の関数: xml.etree.ElementTree.fromstring (text, parser=None)

     文字列定数で与えられた XML 断片を解析します。 *note XML(): 3d08. と
     同じです。 'text' には XML データを含む文字列を指定します。
     'parser' はオプションで、パーザのインスタンスを指定します。指定され
     なかった場合、標準の *note XMLParser: c49. パーザを使用します。
     *note Element: 363. インスタンスを返します。

 -- の関数: xml.etree.ElementTree.fromstringlist (sequence, parser=None)

     文字列フラグメントのシーケンスから XML ドキュメントを解析します。
     'sequence' は XML データのフラグメントを格納した、リストかその他の
     シーケンスです。 'parser' はオプションのパーザインスタンスです。パ
     ーザが指定されない場合、標準の *note XMLParser: c49. パーザが使用さ
     れます。 *note Element: 363. インスタンスを返します。

     Added in version 3.2.

 -- の関数: xml.etree.ElementTree.indent (tree, space=' ', level=0)

     Appends whitespace to the subtree to indent the tree visually.
     This can be used to generate pretty-printed XML output.  'tree' can
     be an Element or ElementTree.  'space' is the whitespace string
     that will be inserted for each indentation level, two space
     characters by default.  For indenting partial subtrees inside of an
     already indented tree, pass the initial indentation level as
     'level'.

     Added in version 3.9.

 -- の関数: xml.etree.ElementTree.iselement (element)

     オブジェクトが正当な要素オブジェクトであるかをチェックします。
     'element' は要素インスタンスです。引数が要素オブジェクトの場合
     ‘True’ を返します。

 -- の関数: xml.etree.ElementTree.iterparse (source, events=None,
          parser=None)

     Parses an XML section into an element tree incrementally, and
     reports what's going on to the user.  'source' is a filename or
     *note file object: 13db. containing XML data.  'events' is a
     sequence of events to report back.  The supported events are the
     strings ‘"start"’, ‘"end"’, ‘"comment"’, ‘"pi"’, ‘"start-ns"’ and
     ‘"end-ns"’ (the "ns" events are used to get detailed namespace
     information).  If 'events' is omitted, only ‘"end"’ events are
     reported.  'parser' is an optional parser instance.  If not given,
     the standard *note XMLParser: c49. parser is used.  'parser' must
     be a subclass of *note XMLParser: c49. and can only use the default
     *note TreeBuilder: c4a. as a target.  Returns an *note iterator:
     4c8. providing ‘(event, elem)’ pairs; it has a ‘root’ attribute
     that references the root element of the resulting XML tree once
     'source' is fully read.  The iterator has the ‘close()’ method that
     closes the internal file object if 'source' is a filename.

     *note iterparse(): 57a. は木をインクリメンタルに構築しますが、
     'source' (または指定のファイル) でのブロッキング読みを起こします。
     したがって、ブロッキング読みが許可されないアプリケーションには適し
     ません。完全に非ブロックのパースのためには、*note XMLPullParser:
     11f5. を参照してください。

          注釈: *note iterparse(): 57a. は "start" イベントを発行した時
          に開始タグの文字 ">" が現れたことだけを保証します。そのため、
          属性は定義されますが、その時点ではテキストの内容も tail 属性も
          定義されていません。同じことは子要素にも言えて、その時点ではあ
          るともないとも言えません。

          全部揃った要素が必要ならば、"end" イベントを探してください。

     バージョン 3.4 で非推奨: 'parser' 引数。

     バージョン 3.8 で変更: イベント ‘comment’, ‘pi’ が追加されました。

     バージョン 3.13 で変更: Added the ‘close()’ method.

 -- の関数: xml.etree.ElementTree.parse (source, parser=None)

     XML 断片を解析して要素の木にします。 'source' には XML データを含む
     ファイル名またはファイルオブジェクトを指定します。 'parser' はオプ
     ションでパーザインスタンスを指定します。パーザが指定されない場合、
     標準の *note XMLParser: c49. パーザが使用されます。 *note
     ElementTree: b47. インスタンスを返します。

 -- の関数: xml.etree.ElementTree.ProcessingInstruction (target,
          text=None)

     PI 要素のファクトリです。このファクトリ関数は XML の処理命令として
     シリアライズされた特別な要素を作成します。'target' は PI ターゲット
     を含んだ文字列です。'text' を指定する場合は PI コンテンツを含む文字
     列にします。PI を表わす要素インスタンスを返します。

     Note that *note XMLParser: c49. skips over processing instructions
     in the input instead of creating PI objects for them.  An *note
     ElementTree: b47. will only contain processing instruction nodes if
     they have been inserted into to the tree using one of the *note
     Element: 363. methods.

 -- の関数: xml.etree.ElementTree.register_namespace (prefix, uri)

     名前空間の接頭辞を登録します。レジストリはグローバルで、与えられた
     接頭辞か名前空間 URI のどちらかの既存のマッピングはすべて削除されま
     す。'prefix' には名前空間の接頭辞を指定します。'uri' には名前空間の
     URI を指定します。この名前空間のタグや属性は、可能な限り与えられた
     接頭辞をつけてシリアライズされます。

     Added in version 3.2.

 -- の関数: xml.etree.ElementTree.SubElement (parent, tag, attrib={},
          **extra)

     子要素のファクトリです。この関数は要素インスタンスを作成し、それを
     既存の要素に追加します。

     要素名、属性名、および属性値はバイト文字列でも Unicode 文字列でも構
     いません。 'parent' には親要素を指定します。 'tag' には要素名を指定
     します。'attrib' はオプションで要素の属性を含む辞書を指定します。
     'extra' は追加の属性で、キーワード引数として与えます。要素インスタ
     ンスを返します。

 -- の関数: xml.etree.ElementTree.tostring (element,
          encoding='us-ascii', method='xml', *, xml_declaration=None,
          default_namespace=None, short_empty_elements=True)

     XML 要素を全ての子要素を含めて表現する文字列を生成します。
     'element' は *note Element: 363. のインスタンスです。 'encoding'
     (2) は出力エンコーディング(デフォルトは US-ASCII)です。Unicode 文字
     列を生成するには、‘encoding="unicode"’ を使用してください。
     'method' は ‘"xml"’, ‘"html"’, ‘"text"’ のいずれか(デフォルトは
     ‘"xml"’) です。 'xml_declaration', 'default_namespace',
     'short_empty_elements' は、 *note ElementTree.write(): c8c. での意
     味と同じ意味を持ちます。 XML データを含んだ (オプションで) エンコー
     ドされた文字列を返します。

     バージョン 3.4 で変更: 'short_empty_elements' 引数を追加しました。

     バージョン 3.8 で変更: Added the 'xml_declaration' and
     'default_namespace' parameters.

     バージョン 3.8 で変更: The *note tostring(): 11f7. function now
     preserves the attribute order specified by the user.

 -- の関数: xml.etree.ElementTree.tostringlist (element,
          encoding='us-ascii', method='xml', *, xml_declaration=None,
          default_namespace=None, short_empty_elements=True)

     XML 要素を全ての子要素を含めて表現する文字列を生成します。
     'element' は *note Element: 363. のインスタンスです。 'encoding'
     (3) は出力エンコーディング(デフォルトは US-ASCII)です。Unicode 文字
     列を生成するには、‘encoding="unicode"’ を使用してください。
     'method' は ‘"xml"’, ‘"html"’, ‘"text"’ のいずれか(デフォルトは
     ‘"xml"’) です。 xml_declaration*, 'default_namespace',
     'short_empty_elements' は、 *note ElementTree.write(): c8c. での意
     味と同じ意味を持ちます。 XML データを含んだ (オプションで) エンコー
     ドされた文字列のリストを返します。‘b"".join(tostringlist(element))
     == tostring(element)’ となること以外、特定の順序になる保証はありま
     せん。

     Added in version 3.2.

     バージョン 3.4 で変更: 'short_empty_elements' 引数を追加しました。

     バージョン 3.8 で変更: Added the 'xml_declaration' and
     'default_namespace' parameters.

     バージョン 3.8 で変更: *note tostringlist(): 11f8. 関数はユーザーが
     指定した属性の順序を保持するようになりました。

 -- の関数: xml.etree.ElementTree.XML (text, parser=None)

     文字列定数で与えられた XML 断片を解析します。この関数は Python コー
     ドに "XML リテラル" を埋め込むのに使えます。 'text' には XML データ
     を含む文字列を指定します。 'parser' はオプションで、パーザのインス
     タンスを指定します。指定されなかった場合、標準の *note XMLParser:
     c49. パーザを使用します。 *note Element: 363. インスタンスを返しま
     す。

 -- の関数: xml.etree.ElementTree.XMLID (text, parser=None)

     文字列定数で与えられた XML 断片を解析し、要素 ID と要素を対応付ける
     辞書を返します。 'text' には XMLデータを含んだ文字列を指定します。
     'parser' はオプションで、パーザのインスタンスを指定します。指定され
     なかった場合、標準の *note XMLParser: c49. パーザを使用します。
     *note Element: 363. のインスタンスと辞書のタプルを返します。

   ---------- Footnotes ----------

   (1) https://www.w3.org/TR/xml-c14n2/

   (2) XML 出力に含まれるエンコーディング文字列は適切な規格に従っていな
ければなりません。例えば、"UTF-8" は有効ですが、"UTF8" はそうではありま
せん。‘https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl’ と
‘https://www.iana.org/assignments/character-sets/character-sets.xhtml’ を
参照してください。

   (3) XML 出力に含まれるエンコーディング文字列は適切な規格に従っていな
ければなりません。例えば、"UTF-8" は有効ですが、"UTF8" はそうではありま
せん。‘https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl’ と
‘https://www.iana.org/assignments/character-sets/character-sets.xhtml’ を
参照してください。


File: python.info,  Node: XInclude サポート,  Next: リファレンス<6>,  Prev: リファレンス<5>,  Up: xml etree ElementTree --- ElementTree XML API

5.21.5.14 XInclude サポート
...........................

This module provides limited support for XInclude directives(1), via the
*note xml.etree.ElementInclude: 12a. helper module.  This module can be
used to insert subtrees and text strings into element trees, based on
information in the tree.

* Menu:

* 使用例: 使用例<34>.

   ---------- Footnotes ----------

   (1) https://www.w3.org/TR/xinclude/


File: python.info,  Node: 使用例<34>,  Up: XInclude サポート

5.21.5.15 使用例
................

Here's an example that demonstrates use of the XInclude module.  To
include an XML document in the current document, use the
‘{http://www.w3.org/2001/XInclude}include’ element and set the 'parse'
attribute to ‘"xml"’, and use the 'href' attribute to specify the
document to include.

     <?xml version="1.0"?>
     <document xmlns:xi="http://www.w3.org/2001/XInclude">
       <xi:include href="source.xml" parse="xml" />
     </document>

By default, the 'href' attribute is treated as a file name.  You can use
custom loaders to override this behaviour.  Also note that the standard
helper does not support XPointer syntax.

To process this file, load it as usual, and pass the root element to the
‘xml.etree.ElementTree’ module:

     from xml.etree import ElementTree, ElementInclude

     tree = ElementTree.parse("document.xml")
     root = tree.getroot()

     ElementInclude.include(root)

The ElementInclude module replaces the
‘{http://www.w3.org/2001/XInclude}include’ element with the root element
from the 'source.xml' document.  The result might look something like
this:

     <document xmlns:xi="http://www.w3.org/2001/XInclude">
       <para>This is a paragraph.</para>
     </document>

If the 'parse' attribute is omitted, it defaults to "xml".  The href
attribute is required.

To include a text document, use the
‘{http://www.w3.org/2001/XInclude}include’ element, and set the 'parse'
attribute to "text":

     <?xml version="1.0"?>
     <document xmlns:xi="http://www.w3.org/2001/XInclude">
       Copyright (c) <xi:include href="year.txt" parse="text" />.
     </document>

The result might look something like:

     <document xmlns:xi="http://www.w3.org/2001/XInclude">
       Copyright (c) 2003.
     </document>


File: python.info,  Node: リファレンス<6>,  Prev: XInclude サポート,  Up: xml etree ElementTree --- ElementTree XML API

5.21.5.16 リファレンス
......................

* Menu:

* 関数: 関数<10>.
* Element オブジェクト::
* ElementTree オブジェクト::
* QName オブジェクト::
* TreeBuilder オブジェクト::
* XMLParser オブジェクト::
* XMLPullParser オブジェクト::
* 例外: 例外<22>.


File: python.info,  Node: 関数<10>,  Next: Element オブジェクト,  Up: リファレンス<6>

5.21.5.17 関数
..............

 -- の関数: xml.etree.ElementInclude.default_loader (href, parse,
          encoding=None)

     Default loader.  This default loader reads an included resource
     from disk.  'href' is a URL. 'parse' is for parse mode either "xml"
     or "text".  'encoding' is an optional text encoding.  If not given,
     encoding is ‘utf-8’.  Returns the expanded resource.  If the parse
     mode is ‘"xml"’, this is an *note Element: 363. instance.  If the
     parse mode is ‘"text"’, this is a string.  If the loader fails, it
     can return ‘None’ or raise an exception.

 -- の関数: xml.etree.ElementInclude.include (elem, loader=None,
          base_url=None, max_depth=6)

     This function expands XInclude directives in-place in tree pointed
     by 'elem'.  'elem' is either the root *note Element: 363. or an
     *note ElementTree: b47. instance to find such element.  'loader' is
     an optional resource loader.  If omitted, it defaults to *note
     default_loader(): 3d14.  If given, it should be a callable that
     implements the same interface as *note default_loader(): 3d14.
     'base_url' is base URL of the original file, to resolve relative
     include file references.  'max_depth' is the maximum number of
     recursive inclusions.  Limited to reduce the risk of malicious
     content explosion.  Pass ‘None’ to disable the limitation.

     バージョン 3.9 で変更: Added the 'base_url' and 'max_depth'
     parameters.


File: python.info,  Node: Element オブジェクト,  Next: ElementTree オブジェクト,  Prev: 関数<10>,  Up: リファレンス<6>

5.21.5.18 Element オブジェクト
..............................

 -- クラス: xml.etree.ElementTree.Element (tag, attrib={}, **extra)

     要素クラスです。この関数は Element インターフェースを定義すると同時
     に、そのリファレンス実装を提供します。

     要素名、属性名、および属性値はバイト文字列でも Unicode 文字列でも構
     いません。 'tag' には要素名を指定します。'attrib' はオプションで、
     要素と属性を含む辞書を指定します。'extra' は追加の属性で、キーワー
     ド引数として与えます。要素インスタンスを返します。

      -- の属性: tag

          この要素が表すデータの種類を示す文字列です (言い替えると、要素
          の型です)。

      -- の属性: text
      -- の属性: tail

          これらの属性は要素に結びつけられた付加的なデータを保持するのに
          使われます。これらの属性値はたいてい文字列ですが、アプリケーシ
          ョン固有のオブジェクトであって構いません。要素が XML ファイル
          から作られる場合、 'text' 属性は要素の開始タグとその最初の子要
          素または終了タグまでのテキストか、あるいは ‘None’ を保持し、
          'tail' 属性は要素の終了タグと次のタグまでのテキストか、あるい
          は ‘None’ を保持します。このような XML データ

               <a><b>1<c>2<d/>3</c></b>4</a>

          の場合、 'a' 要素は 'text', 'tail' 属性ともに ‘None’, 'b' 要素
          は 'text' に ‘"1"’ で 'tail' に ‘"4"’, 'c' 要素は 'text' に
          ‘"2"’ で 'tail' は ‘None’, 'd' 要素 は 'text' が ‘None’ で
          'tail' に ‘"3"’ をそれぞれ保持します。

          要素の内側のテキストを収集するためには、*note itertext():
          13ed. を参照してください。例えば ‘"".join(element.itertext())’
          のようにします。

          アプリケーションはこれらの属性に任意のオブジェクトを格納できま
          す。

      -- の属性: attrib

          要素の属性を保持する辞書です。 'attrib' の値は常に書き換え可能
          な Python 辞書ですが、ElementTree の実装によっては別の内部表現
          を使用し、要求されたときにだけ辞書を作るようにしているかもしれ
          ません。そうした実装の利益を享受するために、可能な限り下記の辞
          書メソッドを通じて使用してください。

     以下の辞書風メソッドが要素の属性に対して動作します。

      -- メソッド: clear ()

          要素をリセットします。この関数は全ての子要素を削除し、全属性を
          消去し、テキストとテール属性を ‘None’ に設定します。

      -- メソッド: get (key, default=None)

          要素の 'key' という名前の属性を取得します。

          属性の値、または属性がない場合は 'default' を返します。

      -- メソッド: items ()

          要素の属性を (名前, 値) ペアのシーケンスとして返します。返され
          る属性の順番は決まっていません。

      -- メソッド: keys ()

          要素の属性名をリストとして返します。返される名前の順番は決まっ
          ていません。

      -- メソッド: set (key, value)

          要素の属性 'key' に 'value' をセットします。

     以下のメソッドは要素の子要素 (副要素) に対して動作します。

      -- メソッド: append (subelement)

          要素 'subelement' を、要素の子要素の内部リストの末尾に追加しま
          す。'subelement' *note Element: 363. でない場合、*note
          TypeError: 198. を送出します。

      -- メソッド: extend (subelements)

          Appends 'subelements' from an iterable of elements.  Raises
          *note TypeError: 198. if a subelement is not an *note Element:
          363.

          Added in version 3.2.

      -- メソッド: find (match, namespaces=None)

          Finds the first subelement matching 'match'.  'match' may be a
          tag name or a *note path: da6.  Returns an element instance or
          ‘None’.  'namespaces' is an optional mapping from namespace
          prefix to full name.  Pass ‘''’ as prefix to move all
          unprefixed tag names in the expression into the given
          namespace.

      -- メソッド: findall (match, namespaces=None)

          Finds all matching subelements, by tag name or *note path:
          da6.  Returns a list containing all matching elements in
          document order.  'namespaces' is an optional mapping from
          namespace prefix to full name.  Pass ‘''’ as prefix to move
          all unprefixed tag names in the expression into the given
          namespace.

      -- メソッド: findtext (match, default=None, namespaces=None)

          Finds text for the first subelement matching 'match'.  'match'
          may be a tag name or a *note path: da6.  Returns the text
          content of the first matching element, or 'default' if no
          element was found.  Note that if the matching element has no
          text content an empty string is returned.  'namespaces' is an
          optional mapping from namespace prefix to full name.  Pass
          ‘''’ as prefix to move all unprefixed tag names in the
          expression into the given namespace.

      -- メソッド: insert (index, subelement)

          要素内の指定された位置に 'subelement' を挿入します。
          'subelement' が *note Element: 363. でない場合、*note
          TypeError: 198. を送出します。

      -- メソッド: iter (tag=None)

          現在の要素を根とする木の *note イテレータ: 4c8. を作成します。
          イテレータは現在の要素とそれ以下のすべての要素を、文書内での出
          現順 (深さ優先順) でイテレートします。 'tag' が ‘None’ または
          ‘'*'’ でない場合、与えられたタグに等しいものについてのみイテレ
          ータから返されます。イテレート中に木構造が変更された場合の結果
          は未定義です。

          Added in version 3.2.

      -- メソッド: iterfind (match, namespaces=None)

          タグ名または *note パス: da6. にマッチするすべての子要素を検索
          します。マッチしたすべての要素を文書内での出現順で yield する
          イテレータを返します。'namespaces' はオプションで、名前空間接
          頭辞と完全名を対応付けるマップオブジェクトを指定します。

          Added in version 3.2.

      -- メソッド: itertext ()

          テキストのイテレータを作成します。イテレータは、この要素とすべ
          ての子要素を文書上の順序で巡回し、すべての内部のテキストを返し
          ます。

          Added in version 3.2.

      -- メソッド: makeelement (tag, attrib)

          現在の要素と同じ型の新しい要素オブジェクトを作成します。このメ
          ソッドは呼び出さずに、 *note SubElement(): 3cfe. ファクトリ関
          数を使って下さい。

      -- メソッド: remove (subelement)

          要素から 'subelement' を削除します。find* メソッド群と異なり、
          このメソッドは要素をインスタンスの同一性で比較します。タグや内
          容では比較しません。

     *note Element: 363. オブジェクトは以下のシーケンス型のメソッドを、
     サブ要素を操作するためにサポートします: *note __delitem__(): 14e4,
     *note __getitem__(): 588, *note __setitem__(): 14e3, *note
     __len__(): 178f.

     Caution: Elements with no subelements will test as ‘False’.  In a
     future release of Python, all elements will test as ‘True’
     regardless of whether subelements exist.  Instead, prefer explicit
     ‘len(elem)’ or ‘elem is not None’ tests.:

          element = root.find('foo')

          if not element:  # careful!
              print("element not found, or element has no subelements")

          if element is None:
              print("element not found")

     バージョン 3.12 で変更: Testing the truth value of an Element emits
     *note DeprecationWarning: 1a3.

     Prior to Python 3.8, the serialisation order of the XML attributes
     of elements was artificially made predictable by sorting the
     attributes by their name.  Based on the now guaranteed ordering of
     dicts, this arbitrary reordering was removed in Python 3.8 to
     preserve the order in which attributes were originally parsed or
     created by user code.

     In general, user code should try not to depend on a specific
     ordering of attributes, given that the XML Information Set(1)
     explicitly excludes the attribute order from conveying information.
     Code should be prepared to deal with any ordering on input.  In
     cases where deterministic XML output is required, e.g.  for
     cryptographic signing or test data sets, canonical serialisation is
     available with the *note canonicalize(): c48. function.

     In cases where canonical output is not applicable but a specific
     attribute order is still desirable on output, code should aim for
     creating the attributes directly in the desired order, to avoid
     perceptual mismatches for readers of the code.  In cases where this
     is difficult to achieve, a recipe like the following can be applied
     prior to serialisation to enforce an order independently from the
     Element creation:

          def reorder_attributes(root):
              for el in root.iter():
                  attrib = el.attrib
                  if len(attrib) > 1:
                      # adjust attribute order, e.g. by sorting
                      attribs = sorted(attrib.items())
                      attrib.clear()
                      attrib.update(attribs)

   ---------- Footnotes ----------

   (1) https://www.w3.org/TR/xml-infoset/


File: python.info,  Node: ElementTree オブジェクト,  Next: QName オブジェクト,  Prev: Element オブジェクト,  Up: リファレンス<6>

5.21.5.19 ElementTree オブジェクト
..................................

 -- クラス: xml.etree.ElementTree.ElementTree (element=None, file=None)

     ElementTree ラッパークラスです。このクラスは要素の全階層を表現し、
     さらに標準 XML との相互変換を追加しています。

     'element' は根要素です。'file' が指定されている場合、その XML ファ
     イルの内容により木は初期化されます。

      -- メソッド: _setroot (element)

          この木の根要素を置き換えます。従って現在の木の内容は破棄され、
          与えられた要素が代わりに使われます。注意して使ってください。
          'element' は要素インスタンスです。

      -- メソッド: find (match, namespaces=None)

          *note Element.find(): 187a. と同じで、木の根要素を起点とします
          。

      -- メソッド: findall (match, namespaces=None)

          *note Element.findall(): 187c. と同じで、木の根要素を起点とし
          ます。

      -- メソッド: findtext (match, default=None, namespaces=None)

          *note Element.findtext(): 187b. と同じで、木の根要素を起点とし
          ます。

      -- メソッド: getroot ()

          この木のルート要素を返します。

      -- メソッド: iter (tag=None)

          根要素に対する、木を巡回するイテレータを返します。イテレータは
          木のすべての要素に渡ってセクション順にループします。'tag' は探
          したいタグです (デフォルトではすべての要素を返します)。

      -- メソッド: iterfind (match, namespaces=None)

          *note Element.iterfind(): 13ec. と同じで、木の根要素を起点とし
          ます。

          Added in version 3.2.

      -- メソッド: parse (source, parser=None)

          外部の XML 断片をこの要素木に入れます。'source' にはファイル名
          か *note ファイルオブジェクト: 13db. を指定します。'parser' は
          オプションで、パーザインスタンスを指定します。パーザが指定され
          ない場合、標準の *note XMLParser: c49. パーザが使用されます。
          断片の根要素を返します。

      -- メソッド: write (file, encoding='us-ascii',
               xml_declaration=None, default_namespace=None,
               method='xml', *, short_empty_elements=True)

          要素の木をファイルに XML として書き込みます。 'file' は、書き
          込み用に開かれたファイル名または *note ファイルオブジェクト:
          13db. です。 'encoding' (1) は出力エンコーディング(デフォルト
          は US-ASCII)です。 'xml_declaration' は、 XML 宣言がファイルに
          書かれるかどうかを制御します。 ‘False’ の場合は常に書かれず、
          ‘True’ の場合は常に書かれ、 ‘None’ の場合は US-ASCII 、 UTF-8
          、 Unicode 以外の場合に書かれます (デフォルトは ‘None’ です)。
          'default_namespace' でデフォルトの XML 名前空間 ("xmlns" 用) を
          指定します。 'method' は ‘"xml"’, ‘"html"’, ‘"text"’ のいずれ
          かです (デフォルトは ‘"xml"’ です)。 キーワード専用の
          'short_empty_elements' 引数は、内容がない属性のフォーマットを
          制御します。 ‘True’ (既定) の場合、単一の空要素タグとして書か
          れ、‘False’ の場合、開始タグと終了タグのペアとしてかかれます。

          出力は引数 'encoding' によって、文字列 (*note str: 169.) かバ
          イト列 (*note bytes: 192.) になります。'encoding' が
          ‘"unicode"’ の場合、出力は文字列になり、それ以外ではバイト列に
          なります。'file' が *note ファイルオブジェクト: 13db. の場合、
          型が衝突する場合があります。文字列をバイト列ファイルへ書き込ん
          だり、その逆を行わないよう注意してください。

          バージョン 3.4 で変更: 'short_empty_elements' 引数を追加しまし
          た。

          バージョン 3.8 で変更: *note write(): c8c. メソッドはユーザー
          が指定した属性の順序を保持するようになりました。

以下はこれから操作する XML ファイルです:

     <html>
         <head>
             <title>Example page</title>
         </head>
         <body>
             <p>Moved to <a href="http://example.org/">example.org</a>
             or <a href="http://example.com/">example.com</a>.</p>
         </body>
     </html>

第 1 段落のすべてのリンクの "target" 属性を変更する例:

     >>> from xml.etree.ElementTree import ElementTree
     >>> tree = ElementTree()
     >>> tree.parse("index.xhtml")
     <Element 'html' at 0xb77e6fac>
     >>> p = tree.find("body/p")     # Finds first occurrence of tag p in body
     >>> p
     <Element 'p' at 0xb77ec26c>
     >>> links = list(p.iter("a"))   # Returns list of all links
     >>> links
     [<Element 'a' at 0xb77ec2ac>, <Element 'a' at 0xb77ec1cc>]
     >>> for i in links:             # Iterates through all found links
     ...     i.attrib["target"] = "blank"
     ...
     >>> tree.write("output.xhtml")

   ---------- Footnotes ----------

   (1) XML 出力に含まれるエンコーディング文字列は適切な規格に従っていな
ければなりません。例えば、"UTF-8" は有効ですが、"UTF8" はそうではありま
せん。‘https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl’ と
‘https://www.iana.org/assignments/character-sets/character-sets.xhtml’ を
参照してください。


File: python.info,  Node: QName オブジェクト,  Next: TreeBuilder オブジェクト,  Prev: ElementTree オブジェクト,  Up: リファレンス<6>

5.21.5.20 QName オブジェクト
............................

 -- クラス: xml.etree.ElementTree.QName (text_or_uri, tag=None)

     QName ラッパーです。 このクラスは QName 属性値をラップし、出力時に
     適切な名前空間の扱いを得るために使われます。 'text_or_uri' は
     {uri}local という形式の QName 値を含む文字列、または tag 引数が与え
     られた場合には QName の URI 部分の文字列です。 'tag' が与えられた場
     合、一つめの引数は URI と解釈され、この引数はローカル名と解釈されま
     す。 *note QName: 3d2b. インスタンスは不透明です。


File: python.info,  Node: TreeBuilder オブジェクト,  Next: XMLParser オブジェクト,  Prev: QName オブジェクト,  Up: リファレンス<6>

5.21.5.21 TreeBuilder オブジェクト
..................................

 -- クラス: xml.etree.ElementTree.TreeBuilder (element_factory=None, *,
          comment_factory=None, pi_factory=None, insert_comments=False,
          insert_pis=False)

     汎用の要素構造ビルダー。これは start, data, end, comment, pi のメソ
     ッド呼び出しの列を整形式の要素構造に変換します。このクラスを使うと
     、好みの XML 構文解析器、または他の XML に似た形式の構文解析器を使
     って、要素構造を作り出すことができます。

     'element_factory', when given, must be a callable accepting two
     positional arguments: a tag and a dict of attributes.  It is
     expected to return a new element instance.

     The 'comment_factory' and 'pi_factory' functions, when given,
     should behave like the *note Comment(): 3d06. and *note
     ProcessingInstruction(): 3d0c. functions to create comments and
     processing instructions.  When not given, the default factories
     will be used.  When 'insert_comments' and/or 'insert_pis' is true,
     comments/pis will be inserted into the tree if they appear within
     the root element (but not outside of it).

      -- メソッド: close ()

          ビルダのバッファをフラッシュし、最上位の文書要素を返します。戻
          り値は *note Element: 363. インスタンスになります。

      -- メソッド: data (data)

          現在の要素にテキストを追加します。 'data' は文字列です。バイト
          文字列もしくは Unicode 文字列でなければなりません。

      -- メソッド: end (tag)

          現在の要素を閉じます。 'tag' は要素の名前です。閉じられた要素
          を返します。

      -- メソッド: start (tag, attrs)

          新しい要素を開きます。 'tag' は要素の名前です。 'attrs' は要素
          の属性を保持した辞書です。開かれた要素を返します。

      -- メソッド: comment (text)

          Creates a comment with the given 'text'.  If ‘insert_comments’
          is true, this will also add it to the tree.

          Added in version 3.8.

      -- メソッド: pi (target, text)

          Creates a process instruction with the given 'target' name and
          'text'.  If ‘insert_pis’ is true, this will also add it to the
          tree.

          Added in version 3.8.

     加えて、カスタムの *note TreeBuilder: c4a. オブジェクトは以下のメソ
     ッドを提供できます:

      -- メソッド: doctype (name, pubid, system)

          doctype 宣言を処理します。 'name' は doctype 名です。 'pubid'
          は公式の識別子です。 'system' はシステム識別子です。このメソッ
          ドはデフォルトの *note TreeBuilder: c4a. クラスには存在しませ
          ん。

          Added in version 3.2.

      -- メソッド: start_ns (prefix, uri)

          Is called whenever the parser encounters a new namespace
          declaration, before the ‘start()’ callback for the opening
          element that defines it.  'prefix' is ‘''’ for the default
          namespace and the declared namespace prefix name otherwise.
          'uri' is the namespace URI.

          Added in version 3.8.

      -- メソッド: end_ns (prefix)

          Is called after the ‘end()’ callback of an element that
          declared a namespace prefix mapping, with the name of the
          'prefix' that went out of scope.

          Added in version 3.8.

 -- クラス: xml.etree.ElementTree.C14NWriterTarget (write, *,
          with_comments=False, strip_text=False, rewrite_prefixes=False,
          qname_aware_tags=None, qname_aware_attrs=None,
          exclude_attrs=None, exclude_tags=None)

     A C14N 2.0(1) writer.  Arguments are the same as for the *note
     canonicalize(): c48. function.  This class does not build a tree
     but translates the callback events directly into a serialised form
     using the 'write' function.

     Added in version 3.8.

   ---------- Footnotes ----------

   (1) https://www.w3.org/TR/xml-c14n2/


File: python.info,  Node: XMLParser オブジェクト,  Next: XMLPullParser オブジェクト,  Prev: TreeBuilder オブジェクト,  Up: リファレンス<6>

5.21.5.22 XMLParser オブジェクト
................................

 -- クラス: xml.etree.ElementTree.XMLParser (*, target=None,
          encoding=None)

     このクラスは、このモジュールの構成要素のうち、低水準のものです。効
     率的でイベントベースのXMLパースのため、*note xml.parsers.expat:
     12c. を使用します。*note feed(): 3d37. メソッドで XML データをイン
     クリメンタルに受け取り、'target' オブジェクトのコールバックを呼び出
     すことで、パースイベントをプッシュ API に変換します。'target' が省
     略された場合、標準の *note TreeBuilder: c4a. が使用されます。
     'encoding' (1) が指定された場合、このあたいは XML ファイル内で指定
     されたエンコーディングを上書きします。

     バージョン 3.8 で変更: Parameters are now *note keyword-only: 5a5.
     The 'html' argument is no longer supported.

      -- メソッド: close ()

          パーザへのデータの提供を完了します。構築中に渡される 'target'
          の ‘close()’ メソッドを呼び出す結果を返します。既定では、これ
          がトップレベルのドキュメント要素になります。

      -- メソッド: feed (data)

          パーザへデータを入力します。 'data' はエンコードされたデータで
          す。

      -- メソッド: flush ()

          Triggers parsing of any previously fed unparsed data, which
          can be used to ensure more immediate feedback, in particular
          with Expat >=2.6.0.  The implementation of *note flush(): 576.
          temporarily disables reparse deferral with Expat (if currently
          enabled) and triggers a reparse.  Disabling reparse deferral
          has security consequences; please see *note
          xml.parsers.expat.xmlparser.SetReparseDeferralEnabled(): 579.
          for details.

          Note that *note flush(): 576. has been backported to some
          prior releases of CPython as a security fix.  Check for
          availability of *note flush(): 576. using *note hasattr():
          6f9. if used in code running across a variety of Python
          versions.

          Added in version 3.13.

     *note XMLParser.feed(): 3d37. は 'target' の ‘start(tag,
     attrs_dict)’ メソッドをそれぞれの開始タグに対して呼び、また
     ‘end(tag)’ メソッドを終了タグに対して呼び、そしてデータを
     ‘data(data)’ メソッドで処理します。サポートされているその他のコール
     バックメソッドについては、 *note TreeBuilder: c4a. クラスを参照して
     ください。*note XMLParser.close(): 3d38. は 'target' の ‘close()’ メ
     ソッドを呼びます。 *note XMLParser: c49. は木構造を構築する以外にも
     使えます。以下の例では、XML ファイルの最高の深さを数えます。

          >>> from xml.etree.ElementTree import XMLParser
          >>> class MaxDepth:                     # The target object of the parser
          ...     maxDepth = 0
          ...     depth = 0
          ...     def start(self, tag, attrib):   # Called for each opening tag.
          ...         self.depth += 1
          ...         if self.depth > self.maxDepth:
          ...             self.maxDepth = self.depth
          ...     def end(self, tag):             # Called for each closing tag.
          ...         self.depth -= 1
          ...     def data(self, data):
          ...         pass            # We do not need to do anything with data.
          ...     def close(self):    # Called when all data has been parsed.
          ...         return self.maxDepth
          ...
          >>> target = MaxDepth()
          >>> parser = XMLParser(target=target)
          >>> exampleXml = """
          ... <a>
          ...   <b>
          ...   </b>
          ...   <b>
          ...     <c>
          ...       <d>
          ...       </d>
          ...     </c>
          ...   </b>
          ... </a>"""
          >>> parser.feed(exampleXml)
          >>> parser.close()
          4

   ---------- Footnotes ----------

   (1) XML 出力に含まれるエンコーディング文字列は適切な規格に従っていな
ければなりません。例えば、"UTF-8" は有効ですが、"UTF8" はそうではありま
せん。‘https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl’ と
‘https://www.iana.org/assignments/character-sets/character-sets.xhtml’ を
参照してください。


File: python.info,  Node: XMLPullParser オブジェクト,  Next: 例外<22>,  Prev: XMLParser オブジェクト,  Up: リファレンス<6>

5.21.5.23 XMLPullParser オブジェクト
....................................

 -- クラス: xml.etree.ElementTree.XMLPullParser (events=None)

     非ブロックアプリケーションに適したプルパーザです。入力側の API は
     *note XMLParser: c49. のものと似ていますが、コールバックターゲット
     に呼び出しをプッシュするのではなく、 *note XMLPullParser: 11f5. は
     パースイベントの内部リストを収集し、ユーザーがそこから読み出すこと
     ができます。'events' は、呼び出し元に報告するイベントのシーケンスで
     す。サポートされているイベントは、文字列の ‘"start"’, ‘"end"’,
     ‘"comment"’, ‘"pi"’, ‘"start-ns"’, ‘"end-ns"’ ("ns" イベントは、名
     前空間の詳細情報の取得に使用) です。'events' が省略された場合、
     ‘"end"’ イベントのみが報告されます。

      -- メソッド: feed (data)

          指定したバイトデータをパーザに与えます。

      -- メソッド: flush ()

          Triggers parsing of any previously fed unparsed data, which
          can be used to ensure more immediate feedback, in particular
          with Expat >=2.6.0.  The implementation of *note flush(): 577.
          temporarily disables reparse deferral with Expat (if currently
          enabled) and triggers a reparse.  Disabling reparse deferral
          has security consequences; please see *note
          xml.parsers.expat.xmlparser.SetReparseDeferralEnabled(): 579.
          for details.

          Note that *note flush(): 577. has been backported to some
          prior releases of CPython as a security fix.  Check for
          availability of *note flush(): 577. using *note hasattr():
          6f9. if used in code running across a variety of Python
          versions.

          Added in version 3.13.

      -- メソッド: close ()

          パーザに、データストリームが終了したことを伝えます。*note
          XMLParser.close(): 3d38. とは異なり、このメソッドは常に *note
          None: 885. を返します。パーザがクローズした時にまだ帰って来て
          いないイベントは、まだ *note read_events(): 3cf6. で読むことが
          できます。

      -- メソッド: read_events ()

          Return an iterator over the events which have been encountered
          in the data fed to the parser.  The iterator yields ‘(event,
          elem)’ pairs, where 'event' is a string representing the type
          of event (e.g.  ‘"end"’) and 'elem' is the encountered *note
          Element: 363. object, or other context value as follows.

             * ‘start’, ‘end’: the current Element.

             * ‘comment’, ‘pi’: the current comment / processing
               instruction

             * ‘start-ns’: a tuple ‘(prefix, uri)’ naming the declared
               namespace mapping.

             * ‘end-ns’: *note None: 885. (this may change in a future
               version)

          *note read_events(): 3cf6. の前の呼び出しで提供されたイベント
          は、再度 yield されることはありません。イベントは、イテレータ
          から取得された場合にのみ内部キューから消費されるため、*note
          read_events(): 3cf6. から取得されたイテレータに対して複数の読
          み出しを並行して反復的に行うと、予期せぬ結果が引き起こされます
          。

          注釈: *note XMLPullParser: 11f5. は "start" イベントを発行した
          時に開始タグの文字 ">" が現れたことだけを保証します。そのため
          、属性は定義されますが、その時点ではテキストの内容も tail 属性
          も定義されていません。子要素にもそれが存在する、しないにかかわ
          らず同じ物が適用されます。

          全部揃った要素が必要ならば、"end" イベントを探してください。

     Added in version 3.4.

     バージョン 3.8 で変更: イベント ‘comment’, ‘pi’ が追加されました。


File: python.info,  Node: 例外<22>,  Prev: XMLPullParser オブジェクト,  Up: リファレンス<6>

5.21.5.24 例外
..............

 -- クラス: xml.etree.ElementTree.ParseError

     解析に失敗した時、このモジュールの様々なメソッドから送出される XML
     解析エラーです。この例外のインスタンスが表す文字列は、ユーザフレン
     ドリなメッセージを含んでいます。その他に、以下の属性も利用できます:

      -- の属性: code

          expat パーザからの数値エラーコードです。エラーコードの一覧とそ
          れらの意味については、*note xml.parsers.expat: 12c. のドキュメ
          ントを参照してください。

      -- の属性: position

          エラーが発生した場所を示す 'line' と 'column' 番号のタプルです
          。

脚注
....


File: python.info,  Node: xml dom --- ドキュメントオブジェクトモデル API,  Next: xml dom minidom --- 最小限の DOM の実装,  Prev: xml etree ElementTree --- ElementTree XML API,  Up: 構造化マークアップツール

5.21.6 ‘xml.dom’ -- ドキュメントオブジェクトモデル API
------------------------------------------------------

'ソースコード:' Lib/xml/dom/__init__.py(1)

__________________________________________________________________

文書オブジェクトモデル (Document Object Model)、すなわち "DOM" は、ワー
ルドワイドウェブコンソーシアム (World Wide Web Consortium, W3C) による、
XML ドキュメントにアクセスしたり変更を加えたりするための、プログラミング
言語間共通の API です。DOM 実装によって、XML ドキュメントはツリー構造と
して表現されます。また、クライアントコード側でツリー構造をゼロから構築で
きるようになります。さらに、前述の構造に対して、よく知られたインターフェ
ースをもつ一連のオブジェクトを通したアクセス手段も提供します。

DOM はランダムアクセスを行うアプリケーションで非常に有用です。SAX では、
一度に閲覧することができるのはドキュメントのほんの一部分です。ある SAX 要
素に注目している際には、別の要素をアクセスすることはできません。またテキ
ストノードに注目しているときには、その中に入っている要素をアクセスするこ
とができません。SAX によるアプリケーションを書くときには、プログラムがド
キュメント内のどこを処理しているのかを追跡するよう、コードのどこかに記述
する必要があります。SAX 自体がその作業を行ってくれることはありません。さ
らに、XML ドキュメントに対する先読み (look ahead) が必要だとすると不運な
ことになります。

アプリケーションによっては、ツリーにアクセスできなければイベント駆動モデ
ルを実現できません。もちろん、何らかのツリーを SAX イベントに応じて自分
で構築することもできるでしょうが、DOM ではそのようなコードを書かなくても
よくなります。DOM は XML データに対する標準的なツリー表現なのです。

文書オブジェクトモデルは、W3C によっていくつかの段階、W3C の用語で言えば
"レベル (level)" で定義されています。Python においては、DOM API への対応
付けは実質的には DOM レベル 2 勧告に基づいています。

DOM アプリケーションは、普通は XML を DOM に解析するところから始まります
。どのようにして解析を行うかについては DOM レベル 1 では全くカバーしてお
らず、レベル 2 では限定的な改良だけが行われました: レベル 2 では
‘Document’ を生成するメソッドを提供する ‘DOMImplementation’ オブジェクト
クラスがありますが、実装に依存しない方法で XML リーダ(reader)/パーザ
(parser)/文書ビルダ (Document builder) にアクセスする方法はありません。
また、既存の ‘Document’ オブジェクトなしにこれらのメソッドにアクセスする
ような、よく定義された方法もありません。 Python では、各々の DOM 実装で
*note getDOMImplementation(): 3d42. が定義されているはずです。 DOM レベ
ル 3 ではロード(Load)/ストア(Store) 仕様が追加され、リーダのインターフェ
ースにを定義していますが、Python 標準ライブラリではまだ利用することがで
きません。

DOM 文書オブジェクトを生成したら、そのプロパティとメソッドを使って XML 文
書の一部にアクセスできます。これらのプロパティは DOM 仕様で定義されてい
ます; 本リファレンスマニュアルでは、Python において DOM 仕様がどのように
解釈されているかを記述しています。

W3C から提供されている仕様は、 DOM API を Java、ECMAScript、および OMG
IDL で定義しています。ここで定義されている Python での対応づけは、大部分
がこの仕様の IDL 版に基づいていますが、厳密な準拠は必要とされていません
(実装で IDL の厳密な対応付けをサポートするのは自由ですが)。API への対応
付けに関する詳細な議論は *note 適合性: 3d43. を参照してください。

参考
....

Document Object Model (DOM) Level 2 Specification(2)

     Python DOM API が準拠している W3C 勧告。

Document Object Model (DOM) Level 1 Specification(3)

     *note xml.dom.minidom: 128. でサポートされている W3C の DOM に関す
     る勧告。

Python Language Mapping Specification(4)

     このドキュメントでは OMG IDL から Python への対応付けを記述していま
     す。

* Menu:

* モジュールコンテンツ: モジュールコンテンツ<4>.
* DOM 内のオブジェクト::
* 適合性::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/xml/dom/__init__.py

   (2) https://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/

   (3) https://www.w3.org/TR/REC-DOM-Level-1/

   (4) https://www.omg.org/spec/PYTH/1.2/PDF


File: python.info,  Node: モジュールコンテンツ<4>,  Next: DOM 内のオブジェクト,  Up: xml dom --- ドキュメントオブジェクトモデル API

5.21.6.1 モジュールコンテンツ
.............................

The ‘xml.dom’ contains the following functions:

 -- の関数: xml.dom.registerDOMImplementation (name, factory)

     ファクトリ関数 (factory function) 'factory' を名前 'name' で登録し
     ます。ファクトリ関数は ‘DOMImplementation’ インターフェースを実装す
     るオブジェクトを返さなければなりません。特定の実装 (例えば実装が何
     らかのカスタマイズをサポートしている場合) に適切となるように、ファ
     クトリ関数は毎回同じオブジェクトを返したり、呼び出しごとに新しいオ
     ブジェクトを返したりすることが出来ます。

 -- の関数: xml.dom.getDOMImplementation (name=None, features=())

     適切な DOM 実装を返します。'name' は、よく知られた DOM 実装のモジュ
     ール名か、 ‘None’ になります。 ‘None’ でない場合、対応するモジュー
     ルを import して、import が成功した場合 ‘DOMImplementation’ オブジ
     ェクトを返します。 'name' が与えられておらず、環境変数 ‘PYTHON_DOM’
     が設定されていた場合、 DOM 実装を見つけるのに環境変数が使われます。

     'name' が与えられない場合、利用可能な実装を調べて、指定された機能
     (feature) セットを持つものを探します。実装が見つからなければ *note
     ImportError: 65b. を送出します。 'features' のリストは ‘(feature,
     version)’ のペアからなるシーケンスで、利用可能な
     ‘DOMImplementation’ オブジェクトの ‘hasFeature()’ メソッドに渡され
     ます。

いくつかの便利な定数も提供されています:

 -- データ: xml.dom.EMPTY_NAMESPACE

     DOM 内のノードに名前空間が何も関連づけられていないことを示すために
     使われる値です。この値は通常、ノードの ‘namespaceURI’ の値として見
     つかったり、名前空間特有のメソッドに対する 'namespaceURI' パラメタ
     として使われます。

 -- データ: xml.dom.XML_NAMESPACE

     Namespaces in XML(1) (4 節) で定義されている、予約済みプレフィクス
     (reserved prefix) ‘xml’ に関連付けられた名前空間 URI です。

 -- データ: xml.dom.XMLNS_NAMESPACE

     Document Object Model (DOM) Level 2 Core Specification(2) (1.1.8 節
     ) で定義されている、名前空間宣言への名前空間 URI です。

 -- データ: xml.dom.XHTML_NAMESPACE

     XHTML 1.0: The Extensible HyperText Markup Language(3) (3.1.1 節) で
     定義されている、XHTML 名前空間 URI です。

In addition, ‘xml.dom’ contains a base ‘Node’ class and the DOM
exception classes.  The ‘Node’ class provided by this module does not
implement any of the methods or attributes defined by the DOM
specification; concrete DOM implementations must provide those.  The
‘Node’ class provided as part of this module does provide the constants
used for the ‘nodeType’ attribute on concrete ‘Node’ objects; they are
located within the class rather than at the module level to conform with
the DOM specifications.

   ---------- Footnotes ----------

   (1) https://www.w3.org/TR/REC-xml-names/

   (2) https://www.w3.org/TR/DOM-Level-2-Core/core.html

   (3) https://www.w3.org/TR/xhtml1/


File: python.info,  Node: DOM 内のオブジェクト,  Next: 適合性,  Prev: モジュールコンテンツ<4>,  Up: xml dom --- ドキュメントオブジェクトモデル API

5.21.6.2 DOM 内のオブジェクト
.............................

DOM について最も明確に限定しているドキュメントは W3C による DOM 仕様です
。

DOM 属性は単純な文字列としてだけではなく、ノードとして操作されるかもしれ
ないので注意してください。とはいえ、そうしなければならない場合はかなり稀
なので、今のところ記述されていません。

インターフェース                     節                                      目的
                                                                             
-------------------------------------------------------------------------------------------------------------------
                                                                             
‘DOMImplementation’                  *note DOMImplementation オブジェクト: 3d4c.根底にある実装へのインターフェース
                                                                             。
                                                                             
                                                                             
‘Node’                               *note Node オブジェクト: 3d4d.          ドキュメント内の大部分のオブジェク
                                                                             トに対する基底インターフェース。
                                                                             
                                                                             
‘NodeList’                           *note NodeList オブジェクト: 23ab.      ノード列に対するインターフェース。
                                                                             
                                                                             
‘DocumentType’                       *note DocumentType オブジェクト: 3d4e.  ドキュメントの処理に必要な宣言につ
                                                                             いての情報。
                                                                             
                                                                             
‘Document’                           *note Document オブジェクト: 3d4f.      ドキュメント全体を表現するオブジェ
                                                                             クト。
                                                                             
                                                                             
‘Element’                            *note Element オブジェクト: 3d50.       ドキュメント階層内の要素ノード。
                                                                             
                                                                             
‘Attr’                               *note Attr オブジェクト: 3d51.          要素ノード上の属性値ノード。
                                                                             
                                                                             
‘Comment’                            *note Comment オブジェクト: 3d52.       ソースドキュメント内のコメント表現
                                                                             。
                                                                             
                                                                             
‘Text’                               *note Text オブジェクトおよび CDATASection オブジェクト: 3d53.ドキュメント内のテキスト記述を含む
                                                                             ノード。
                                                                             
                                                                             
‘ProcessingInstruction’              *note ProcessingInstruction オブジェクト: 3d54.処理命令 (processing instruction) 表
                                                                             現。
                                                                             

さらに追加の節として、Python で DOM を利用するために定義されている例外に
ついて記述しています。

* Menu:

* DOMImplementation オブジェクト::
* Node オブジェクト::
* NodeList オブジェクト::
* DocumentType オブジェクト::
* Document オブジェクト::
* Element オブジェクト: Element オブジェクト<2>.
* Attr オブジェクト::
* NamedNodeMap Objects::
* Comment オブジェクト::
* Text オブジェクトおよび CDATASection オブジェクト::
* ProcessingInstruction オブジェクト::
* 例外: 例外<23>.


File: python.info,  Node: DOMImplementation オブジェクト,  Next: Node オブジェクト,  Up: DOM 内のオブジェクト

5.21.6.3 DOMImplementation オブジェクト
.......................................

‘DOMImplementation’ インターフェースは、利用している DOM 実装において特
定の機能が利用可能かどうかを決定するための方法をアプリケーションに提供し
ます。DOM レベル 2 では、 ‘DOMImplementation’ を使って新たな ‘Document’
オブジェクトや ‘DocumentType’ オブジェクトを生成する機能も追加しています
。

 -- メソッド: DOMImplementation.hasFeature (feature, version)

     機能名 'feature' とバージョン番号 'version' で識別される機能（
     feature）が実装されていれば ‘True’ を返します。

 -- メソッド: DOMImplementation.createDocument (namespaceUri,
          qualifiedName, doctype)

     新たな(DOMのスーパークラスである) ‘Document’ クラスのオブジェクトを
     返します。このクラスは 'namespaceUri' と 'qualifiedName' が設定され
     た子クラス ‘Element’ のオブジェクトを所有しています。 'doctype' は
     *note createDocumentType(): 3d58. によって生成された ‘DocumentType’
     クラスのオブジェクト、または ‘None’ である必要があります。 Python
     DOM APIでは、子クラスである ‘Element’ を作成しないことを示すために
     、はじめの２つの引数を ‘None’ に設定することができます。

 -- メソッド: DOMImplementation.createDocumentType (qualifiedName,
          publicId, systemId)

     新たな ‘DocumentType’ クラスのオブジェクトを返します。このオブジェ
     クトは 'qualifiedName' 、 'publicId' 、そして 'systemId' 文字列をふ
     くんでおり、XML文書の形式情報を表現しています。


File: python.info,  Node: Node オブジェクト,  Next: NodeList オブジェクト,  Prev: DOMImplementation オブジェクト,  Up: DOM 内のオブジェクト

5.21.6.4 Node オブジェクト
..........................

XML 文書の全ての構成要素は ‘Node’ のサブクラスです。

 -- の属性: Node.nodeType

     ノード (node) の型を表現する整数値です。型に対応する以下のシンボル
     定数: ‘ELEMENT_NODE’ 、 ‘ATTRIBUTE_NODE’ 、 ‘TEXT_NODE’ 、
     ‘CDATA_SECTION_NODE’ 、 ‘ENTITY_NODE’ 、
     ‘PROCESSING_INSTRUCTION_NODE’ 、 ‘COMMENT_NODE’ 、 ‘DOCUMENT_NODE’
     、 ‘DOCUMENT_TYPE_NODE’ 、 ‘NOTATION_NODE’ 、が ‘Node’ オブジェクト
     で定義されています。読み出し専用の属性です。

 -- の属性: Node.parentNode

     現在のノードの親ノードか、文書ノードの場合には ‘None’ になります。
     この値は常に ‘Node’ オブジェクトか ‘None’ になります。 ‘Element’ ノ
     ードの場合、この値はルート要素 (root element) の場合を除き親要素
     (parent element) となり、ルート要素の場合には ‘Document’ オブジェク
     トとなります。 ‘Attr’ ノードの場合、この値は常に ‘None’ となります
     。読み出し専用の属性です。

 -- の属性: Node.attributes

     属性オブジェクトの ‘NamedNodeMap’ です。要素だけがこの属性に実際の
     値を持ちます; その他のオブジェクトでは、この属性を ‘None’ にします
     。読み出し専用の属性です。

 -- の属性: Node.previousSibling

     このノードと同じ親ノードを持ち、直前にくるノードです。例えば、
     'self' 要素の開始タグの直前にくる終了タグを持つ要素です。もちろん、
     XML 文書は要素だけで構成されているだけではないので、直前にくる兄弟
     関係にある要素 (sibling) はテキストやコメント、その他になる可能性が
     あります。このノードが親ノードにおける先頭の子ノードである場合、属
     性値は ‘None’ になります。読み出し専用の属性です。

 -- の属性: Node.nextSibling

     このノードと同じ親ノードを持ち、直後にくるノードです。例えば、
     *note previousSibling: 3d5d. も参照してください。このノードが親ノー
     ドにおける末尾の子ノードである場合、属性値は ‘None’ になります。読
     み出し専用の属性です。

 -- の属性: Node.childNodes

     このノード内に収められているノードからなるリストです。読み出し専用
     の属性です。

 -- の属性: Node.firstChild

     このノードに子ノードがある場合、その先頭のノードです。そうでない場
     合 ‘None’ になります。読み出し専用の属性です。

 -- の属性: Node.lastChild

     このノードに子ノードがある場合、その末尾のノードです。そうでない場
     合 ‘None’ になります。読み出し専用の属性です。

 -- の属性: Node.localName

     ‘tagName’ にコロンがあれば、コロン以降の部分に、なければ ‘tagName’
     全体になります。値は文字列です。

 -- の属性: Node.prefix

     ‘tagName’ のコロンがあれば、コロン以前の部分に、なければ空文字列に
     なります。値は文字列か、 ‘None’ になります。

 -- の属性: Node.namespaceURI

     要素名に関連付けられた名前空間です。文字列か ‘None’ になります。読
     み出し専用の属性です。

 -- の属性: Node.nodeName

     この属性はノード型ごとに異なる意味を持ちます。その詳細は DOM 仕様を
     参照してください。この属性で得られることになる情報は、全てのノード
     型では ‘tagName’ 、属性では ‘name’ プロパティといったように、常に他
     のプロパティで得ることができます。全てのノード型で、この属性の値は
     文字列か ‘None’ になります。読み出し専用の属性です。

 -- の属性: Node.nodeValue

     この属性はノード型ごとに異なる意味を持ちます。その詳細は DOM 仕様を
     参照してください。その状況は *note nodeName: 3d65. と似ています。こ
     の属性の値は文字列または ‘None’ になります。

 -- メソッド: Node.hasAttributes ()

     ノードが何らかの属性を持っている場合に ‘True’ を返します。

 -- メソッド: Node.hasChildNodes ()

     ノードが何らかの子ノードを持っている場合に ‘True’ を返します。

 -- メソッド: Node.isSameNode (other)

     'other' がこのノードと同じノードを参照している場合に ‘True’ を返し
     ます。このメソッドは、何らかのプロキシ (proxy) 機構を利用するような
     DOM 実装で特に便利です (一つ以上のオブジェクトが同じノードを参照す
     るかもしれないからです)。

          注釈: このメソッドは DOM レベル 3 API の提案に基づいたもので、
          まだ "ワーキングドラフト(working draft)" の段階です。しかし、
          このインターフェースには異論は出ないと考えられます。W3C による
          変更があっても、必ずしも Python DOM インターフェースにおけるこ
          のメソッドに影響するとは限りません (ただしこのメソッドに対する
          何らかの新しい W3C API もサポートされるかもしれません)。

 -- メソッド: Node.appendChild (newChild)

     現在のノードの子ノードリストの末尾に新たな子ノードを追加し、
     'newChild' を返します。もしノードが既にツリーにあれば、最初に削除さ
     れます。

 -- メソッド: Node.insertBefore (newChild, refChild)

     新たな子ノードを既存の子ノードの前に挿入します。 'refChild' は現在
     のノードの子ノードである場合に限られます; そうでない場合、 *note
     ValueError: 2ec. が送出されます。 'newChild' が返されます。もし
     'refChild' が ‘None’ なら、 'newChild' を子ノードリストの最後に挿入
     します。

 -- メソッド: Node.removeChild (oldChild)

     子ノードを削除します。 'oldChild' はこのノードの子ノードでなければ
     なりません。そうでない場合、 *note ValueError: 2ec. が送出されます
     。成功した場合 'oldChild' が返されます。 'oldChild' をそれ以降使わ
     ない場合、 ‘unlink()’ メソッドを呼び出さなければなりません。

 -- メソッド: Node.replaceChild (newChild, oldChild)

     既存のノードと新たなノードを置き換えます。この操作は 'oldChild' が
     現在のノードの子ノードである場合に限られます; そうでない場合、
     *note ValueError: 2ec. が送出されます。

 -- メソッド: Node.normalize ()

     一続きのテキスト全体を一個の ‘Text’ インスタンスとして保存するため
     に隣接するテキストノードを結合します。これにより、多くのアプリケー
     ションで DOM ツリーからのテキスト処理が簡単になります。

 -- メソッド: Node.cloneNode (deep)

     このノードを複製 (clone) します。'deep' を設定すると、子ノードも同
     様に複製することを意味します。複製されたノードを返します。


File: python.info,  Node: NodeList オブジェクト,  Next: DocumentType オブジェクト,  Prev: Node オブジェクト,  Up: DOM 内のオブジェクト

5.21.6.5 NodeList オブジェクト
..............................

‘NodeList’ はノードのシーケンスを表現します。 これらのオブジェクトは DOM
コア勧告 (DOM Core recommendation) において、二通りに使われています:
‘Element’ オブジェクトでは、子ノードのリストを提供するのに ‘NodeList’ を
利用します。 また、このインターフェースにおける ‘Node’ の
‘getElementsByTagName()’ および ‘getElementsByTagNameNS()’ メソッドは、
クエリに対する結果を表現するのに ‘NodeList’ を利用します。

DOM レベル 2 勧告では、これらのオブジェクトに対し、以下のようにメソッド
を一つ、属性を一つ定義しています。

 -- メソッド: NodeList.item (i)

     存在する場合シークエンスの 'i' 番目の要素を、そうでない場合 ‘None’
     を返します。'i' は 0 未満やシークエンスの長さ以上であってはなりませ
     ん。

 -- の属性: NodeList.length

     シーケンス中のノードの数です。

この他に、Python の DOM インターフェースでは、 ‘NodeList’ オブジェクトを
Python のシーケンスとして使えるようにするサポートが追加されていることが
必要です。 ‘NodeList’ の実装では、全て *note __len__(): 178f. と *note
__getitem__(): 588. をサポートしなければなりません; このサポートにより、
*note for: 34a. 文内で ‘NodeList’ にわたる繰り返しと、組み込み関数 *note
len(): 840. の適切なサポートができるようになります。

DOM 実装が文書の変更をサポートしている場合、 ‘NodeList’ の実装でも *note
__setitem__(): 14e3. および *note __delitem__(): 14e4. メソッドをサポー
トしなければなりません。


File: python.info,  Node: DocumentType オブジェクト,  Next: Document オブジェクト,  Prev: NodeList オブジェクト,  Up: DOM 内のオブジェクト

5.21.6.6 DocumentType オブジェクト
..................................

文書で宣言されている記法 (notation) やエンティティ (entity) に関する (外
部サブセット(external subset) がパーザから利用でき、情報を提供できる場合
にはそれも含めた) 情報は、 ‘DocumentType’ オブジェクトから手に入れること
ができます。文書の ‘DocumentType’ は、 ‘Document’ オブジェクトの
‘doctype’ 属性で入手することができます; 文書の ‘DOCTYPE’ 宣言がない場合
、文書の ‘doctype’ 属性は、このインターフェースを持つインスタンスの代わ
りに ‘None’ に設定されます。

‘DocumentType’ は ‘Node’ を特殊化したもので、以下の属性を加えています:

 -- の属性: DocumentType.publicId

     文書型定義 (document type definition) の外部サブセットに対する公開
     識別子 (public identifier) です。文字列または ‘None’ になります。

 -- の属性: DocumentType.systemId

     文書型定義 (document type definition) の外部サブセットに対するシス
     テム識別子 (system identifier) です。文字列の URI または ‘None’ に
     なります。

 -- の属性: DocumentType.internalSubset

     ドキュメントの完全な内部サブセットを与える文字列です。サブセットを
     囲むブラケットは含みません。ドキュメントが内部サブセットを持たない
     場合、この値は ‘None’ です。

 -- の属性: DocumentType.name

     ‘DOCTYPE’ 宣言でルート要素の名前が与えられている場合、その値になり
     ます。

 -- の属性: DocumentType.entities

     外部エンティティの定義を与える ‘NamedNodeMap’ です。複数回定義され
     ているエンティティに対しては、最初の定義だけが提供されます (その他
     は XML 勧告での要求仕様によって無視されます)。パーザによって情報が
     提供されないか、エンティティが定義されていない場合には、この値は
     ‘None’ になることがあります。

 -- の属性: DocumentType.notations

     記法の定義を与える ‘NamedNodeMap’ です。複数回定義されている記法名
     に対しては、最初の定義だけが提供されます (その他は XML 勧告での要求
     仕様によって無視されます)。パーザによって情報が提供されないか、エン
     ティティが定義されていない場合には、この値は ‘None’ になることがあ
     ります。


File: python.info,  Node: Document オブジェクト,  Next: Element オブジェクト<2>,  Prev: DocumentType オブジェクト,  Up: DOM 内のオブジェクト

5.21.6.7 Document オブジェクト
..............................

‘Document’ は XML ドキュメント全体を表現し、その構成要素である要素、属性
、処理命令、コメント等を持ちます。 ‘Document’ は ‘Node’ からプロパティを
継承していることを思い出してください。

 -- の属性: Document.documentElement

     ドキュメントの唯一無二のルート要素です。

 -- メソッド: Document.createElement (tagName)

     新たな要素ノードを生成して返します。要素は、生成された時点ではドキ
     ュメント内に挿入されません。 ‘insertBefore()’ や ‘appendChild()’ の
     ような他のメソッドの一つを使って明示的に挿入を行う必要があります。

 -- メソッド: Document.createElementNS (namespaceURI, tagName)

     名前空間を伴う新たな要素ノードを生成して返します。 'tagName' には接
     頭辞 (prefix) があってもかまいません。要素は、生成された時点では文
     書内に挿入されません。 ‘insertBefore()’ や ‘appendChild()’ のような
     他のメソッドの一つを使って明示的に挿入を行う必要があります。

 -- メソッド: Document.createTextNode (data)

     引数として渡されたデータの入ったテキストノードを生成して返します。
     他の生成 (create) メソッドと同じく、このメソッドは生成されたノード
     をツリーに挿入しません。

 -- メソッド: Document.createComment (data)

     引数として渡されたデータの入ったコメントノードを生成して返します。
     他の生成 (create) メソッドと同じく、このメソッドは生成されたノード
     をツリーに挿入しません。

 -- メソッド: Document.createProcessingInstruction (target, data)

     引数として渡された 'target' および 'data' の入った処理命令ノードを
     生成して返します。他の生成 (create) メソッドと同じく、このメソッド
     は生成されたノードをツリーに挿入しません。

 -- メソッド: Document.createAttribute (name)

     属性ノードを生成して返します。このメソッドは属性ノードを特定の要素
     に関連づけることはしません。新たに生成された属性インスタンスを使う
     には、適切な ‘Element’ オブジェクトの ‘setAttributeNode()’ を使わな
     ければなりません。

 -- メソッド: Document.createAttributeNS (namespaceURI, qualifiedName)

     名前空間を伴う新たな属性ノードを生成して返します。 'tagName' には接
     頭辞 (prefix) があってもかまいません。このメソッドは属性ノードを特
     定の要素に関連づけることはしません。新たに生成された属性インスタン
     スを使うには、適切な ‘Element’ オブジェクトの ‘setAttributeNode()’
     を使わなければなりません。

 -- メソッド: Document.getElementsByTagName (tagName)

     全ての下位要素 (直接の子要素、子要素の子要素等) から特定の要素型名
     を持つものを検索します。

 -- メソッド: Document.getElementsByTagNameNS (namespaceURI, localName)

     全ての下位要素 (直接の子要素、子要素の子要素等) から特定の名前空間
     URI とローカル名 (local name) を持つものを検索します。ローカル名は
     名前空間における接頭辞以降の部分です。


File: python.info,  Node: Element オブジェクト<2>,  Next: Attr オブジェクト,  Prev: Document オブジェクト,  Up: DOM 内のオブジェクト

5.21.6.8 Element オブジェクト
.............................

‘Element’ は ‘Node’ のサブクラスです。このため ‘Node’ クラスの全ての属性
を継承します。

 -- の属性: Element.tagName

     要素型名です。名前空間使用の文書では、要素型名中にコロンがあるかも
     しれません。値は文字列です。

 -- メソッド: Element.getElementsByTagName (tagName)

     ‘Document’ クラス内における同名のメソッドと同じです。

 -- メソッド: Element.getElementsByTagNameNS (namespaceURI, localName)

     ‘Document’ クラス内における同名のメソッドと同じです。

 -- メソッド: Element.hasAttribute (name)

     指定要素に 'name' で渡した名前の属性が存在していれば ‘True’ を返し
     ます。

 -- メソッド: Element.hasAttributeNS (namespaceURI, localName)

     指定要素に 'namespaceURI' と 'localName' で指定した名前の属性が存在
     していれば ‘True’ を返します。

 -- メソッド: Element.getAttribute (name)

     'name' で指定した属性の値を文字列として返します。もし、属性が存在し
     ない、もしくは属性に値が設定されていない場合、空の文字列が返されま
     す。

 -- メソッド: Element.getAttributeNode (attrname)

     'attrname' で指定された属性の ‘Attr’ ノードを返します。

 -- メソッド: Element.getAttributeNS (namespaceURI, localName)

     'namespaceURI' と 'localName' によって指定した属性の値を文字列とし
     て返します。もし、属性が存在しない、もしくは属性に値が設定されてい
     ない場合、空の文字列が返されます。

 -- メソッド: Element.getAttributeNodeNS (namespaceURI, localName)

     指定した 'namespaceURI' および 'localName' を持つ属性値をノードとし
     て返します。

 -- メソッド: Element.removeAttribute (name)

     名前で指定された属性を削除します。該当する属性がない場合、*note
     NotFoundErr: 3d8f. が送出されます。

 -- メソッド: Element.removeAttributeNode (oldAttr)

     'oldAttr' が属性リストにある場合、削除して返します。 'oldAttr' が存
     在しない場合、 *note NotFoundErr: 3d8f. が送出されます。

 -- メソッド: Element.removeAttributeNS (namespaceURI, localName)

     名前で指定された属性を削除します。このメソッドは 'qname' ではなく
     'localName' を使うので注意してください。該当する属性がなくても例外
     は送出されません。

 -- メソッド: Element.setAttribute (name, value)

     文字列を使って属性値を設定します。

 -- メソッド: Element.setAttributeNode (newAttr)

     新たな属性ノードを要素に追加します。 ‘name’ 属性が既存の属性に一致
     した場合、必要に応じて属性を置換します。置換が行われると古い属性ノ
     ードが返されます。 'newAttr' がすでに使われていれば、 *note
     InuseAttributeErr: 3d94. が送出されます。

 -- メソッド: Element.setAttributeNodeNS (newAttr)

     新たな属性ノードを要素に追加します。 ‘namespaceURI’ および
     ‘localName’ 属性が既存の属性に一致した場合、必要に応じて属性を置き
     換えます。置換が生じると、古い属性ノードが返されます。 'newAttr' が
     すでに使われていれば、 *note InuseAttributeErr: 3d94. が送出されま
     す。

 -- メソッド: Element.setAttributeNS (namespaceURI, qname, value)

     指定された 'namespaceURI' および 'qname' で与えられた属性の値を文字
     列で設定します。qname は属性の完全な名前であり、この点が上記のメソ
     ッドと違うので注意してください。


File: python.info,  Node: Attr オブジェクト,  Next: NamedNodeMap Objects,  Prev: Element オブジェクト<2>,  Up: DOM 内のオブジェクト

5.21.6.9 Attr オブジェクト
..........................

‘Attr’ は ‘Node’ を継承しており、全ての属性を継承しています。

 -- の属性: Attr.name

     要素型名です。名前空間使用の文書では、要素型名中にコロンが含まれる
     かもしれません。

 -- の属性: Attr.localName

     名前にコロンがあればコロン以降の部分に、なければ名前全体になります
     。

 -- の属性: Attr.prefix

     名前にコロンがあればコロン以前の部分に、なければ空文字列になります
     。

 -- の属性: Attr.value

     その要素の text value.  これは ‘nodeValue’ 属性の別名です。


File: python.info,  Node: NamedNodeMap Objects,  Next: Comment オブジェクト,  Prev: Attr オブジェクト,  Up: DOM 内のオブジェクト

5.21.6.10 NamedNodeMap Objects
..............................

‘NamedNodeMap’ は ‘Node’ を継承して 'いません' 。

 -- の属性: NamedNodeMap.length

     属性リストの長さです。

 -- メソッド: NamedNodeMap.item (index)

     特定のインデクスを持つ属性を返します。属性の並び方は任意ですが、
     DOM 文書が生成されている間は一定になります。各要素は属性ノードです
     。属性値はノードの ‘value’ 属性で取得してください。

このクラスをよりマップ型的な動作ができるようにする実験的なメソッドもあり
ます。そうしたメソッドを使うこともできますし、 ‘Element’ オブジェクトに
対して、標準化された ‘getAttribute*()’ ファミリのメソッドを使うこともで
きます。


File: python.info,  Node: Comment オブジェクト,  Next: Text オブジェクトおよび CDATASection オブジェクト,  Prev: NamedNodeMap Objects,  Up: DOM 内のオブジェクト

5.21.6.11 Comment オブジェクト
..............................

‘Comment’ は XML 文書中のコメントを表現します。 ‘Comment’ は ‘Node’ のサ
ブクラスですが、子ノードを持つことはありません。

 -- の属性: Comment.data

     文字列によるコメントの内容です。この属性には、コメントの先頭にある
     ‘<!-’ ‘-’ と末尾にある ‘-’ ‘->’ 間の全ての文字が入っていますが、
     ‘<!-’ ‘-’ と ‘-’ ‘->’ 自体は含みません。


File: python.info,  Node: Text オブジェクトおよび CDATASection オブジェクト,  Next: ProcessingInstruction オブジェクト,  Prev: Comment オブジェクト,  Up: DOM 内のオブジェクト

5.21.6.12 Text オブジェクトおよび CDATASection オブジェクト
...........................................................

‘Text’ インターフェースは XML 文書内のテキストを表現します。パーザおよび
DOM 実装が DOM の XML 拡張をサポートしている場合、 CDATA でマークされた
区域 (section) に入れられている部分テキストは ‘CDATASection’ オブジェク
トに記憶されます。これら二つのインターフェースは同一のものですが、
‘nodeType’ 属性が異なります。

これらのインターフェースは ‘Node’ インターフェースを拡張したものです。し
かし子ノードを持つことはできません。

 -- の属性: Text.data

     文字列によるテキストノードの内容です。

     注釈: ‘CDATASection’ ノードの利用は、ノードが完全な CDATA マーク区
     域を表現するという意味ではなく、ノードの内容が CDATA 区域の一部であ
     るということを意味するだけです。単一の CDATA セクションは文書ツリー
     内で複数のノードとして表現されることがあります。二つの隣接する
     ‘CDATASection’ ノードが、異なる CDATA マーク区域かどうかを決定する
     方法はありません。


File: python.info,  Node: ProcessingInstruction オブジェクト,  Next: 例外<23>,  Prev: Text オブジェクトおよび CDATASection オブジェクト,  Up: DOM 内のオブジェクト

5.21.6.13 ProcessingInstruction オブジェクト
............................................

XML 文書内の処理命令を表現します; ‘Node’ インターフェースを継承していま
すが、子ノードを持つことはできません。

 -- の属性: ProcessingInstruction.target

     最初の空白文字までの処理命令の内容です。読み出し専用の属性です。

 -- の属性: ProcessingInstruction.data

     最初の空白文字以降の処理命令の内容です。


File: python.info,  Node: 例外<23>,  Prev: ProcessingInstruction オブジェクト,  Up: DOM 内のオブジェクト

5.21.6.14 例外
..............

DOM レベル 2 勧告では、単一の例外 *note DOMException: 3da9. と、どの種の
エラーが発生したかをアプリケーションが決定できるようにする多くの定数を定
義しています。 *note DOMException: 3da9. インスタンスは、特定の例外に関
する適切な値を提供する *note code: 1b. 属性を伴っています。

Python DOM インターフェースでは、上記の定数を提供していますが、同時に一
連の例外を拡張して、DOM で定義されている各例外コードに対して特定の例外が
存在するようにしています。 DOM の実装では、適切な特定の例外を送出しなけ
ればならず、各例外は *note code: 1b. 属性に対応する適切な値を伴わなけれ
ばなりません。

 -- 例外: xml.dom.DOMException

     全ての特定の DOM 例外で使われている基底例外クラスです。この例外クラ
     スを直接インスタンス化することはできません。

 -- 例外: xml.dom.DomstringSizeErr

     指定された範囲のテキストが文字列に収まらない場合に送出されます。こ
     の例外は Python の DOM 実装で使われるかどうかは判っていませんが、
     Python で書かれていない DOM 実装から送出される場合があります。

 -- 例外: xml.dom.HierarchyRequestErr

     挿入できない型のノードを挿入しようと試みたときに送出されます。

 -- 例外: xml.dom.IndexSizeErr

     メソッドに与えたインデクスやサイズパラメタが負の値や許容範囲の値を
     超えた際に送出されます。

 -- 例外: xml.dom.InuseAttributeErr

     文書中にすでに存在する ‘Attr’ ノードを挿入しようと試みた際に送出さ
     れます。

 -- 例外: xml.dom.InvalidAccessErr

     パラメタまたは操作が根底にあるオブジェクトでサポートされていない場
     合に送出されます。

 -- 例外: xml.dom.InvalidCharacterErr

     この例外は、文字列パラメタが、現在使われているコンテキストで XML
     1.0 勧告によって許可されていない場合に送出されます。例えば、要素型
     に空白の入った ‘Element’ ノードを生成しようとすると、このエラーが送
     出されます。

 -- 例外: xml.dom.InvalidModificationErr

     ノードの型を変更しようと試みた際に送出されます。

 -- 例外: xml.dom.InvalidStateErr

     定義されていないオブジェクトや、もはや利用できなくなったオブジェク
     トを使おうと試みた際に送出されます。

 -- 例外: xml.dom.NamespaceErr

     Namespaces in XML(1) に照らして許可されていない方法でオブジェクトを
     変更しようと試みた場合、この例外が送出されます。

 -- 例外: xml.dom.NotFoundErr

     参照しているコンテキスト中に目的のノードが存在しない場合に送出され
     る例外です。例えば、 ‘NamedNodeMap.removeNamedItem()’ は渡されたノ
     ードがノードマップ中に存在しない場合にこの例外を送出します。

 -- 例外: xml.dom.NotSupportedErr

     要求された方のオブジェクトや操作が実装でサポートされていない場合に
     送出されます。

 -- 例外: xml.dom.NoDataAllowedErr

     データ属性をサポートしないノードにデータを指定した際に送出されます
     。

 -- 例外: xml.dom.NoModificationAllowedErr

     オブジェクトに対して (読み出し専用ノードに対する修正のように) 許可
     されていない修正を行おうと試みた際に送出されます。

 -- 例外: xml.dom.SyntaxErr

     無効または不正な文字列が指定された際に送出されます。

 -- 例外: xml.dom.WrongDocumentErr

     ノードが現在属している文書と異なる文書に挿入され、かつある文書から
     別の文書へのノードの移行が実装でサポートされていない場合に送出され
     ます。

DOM 勧告で定義されている例外コードは、以下のテーブルに従って上記の例外と
対応付けられます:

定数                                       例外
                                           
---------------------------------------------------------------------------------
                                           
‘DOMSTRING_SIZE_ERR’                       *note DomstringSizeErr: 3daa.
                                           
                                           
‘HIERARCHY_REQUEST_ERR’                    *note HierarchyRequestErr: 3dab.
                                           
                                           
‘INDEX_SIZE_ERR’                           *note IndexSizeErr: 3dac.
                                           
                                           
‘INUSE_ATTRIBUTE_ERR’                      *note InuseAttributeErr: 3d94.
                                           
                                           
‘INVALID_ACCESS_ERR’                       *note InvalidAccessErr: 3dad.
                                           
                                           
‘INVALID_CHARACTER_ERR’                    *note InvalidCharacterErr: 3dae.
                                           
                                           
‘INVALID_MODIFICATION_ERR’                 *note InvalidModificationErr: 3daf.
                                           
                                           
‘INVALID_STATE_ERR’                        *note InvalidStateErr: 3db0.
                                           
                                           
‘NAMESPACE_ERR’                            *note NamespaceErr: 3db1.
                                           
                                           
‘NOT_FOUND_ERR’                            *note NotFoundErr: 3d8f.
                                           
                                           
‘NOT_SUPPORTED_ERR’                        *note NotSupportedErr: 3db2.
                                           
                                           
‘NO_DATA_ALLOWED_ERR’                      *note NoDataAllowedErr: 3db3.
                                           
                                           
‘NO_MODIFICATION_ALLOWED_ERR’              *note NoModificationAllowedErr: 3db4.
                                           
                                           
‘SYNTAX_ERR’                               *note SyntaxErr: 3db5.
                                           
                                           
‘WRONG_DOCUMENT_ERR’                       *note WrongDocumentErr: 3db6.
                                           

   ---------- Footnotes ----------

   (1) https://www.w3.org/TR/REC-xml-names/


File: python.info,  Node: 適合性,  Prev: DOM 内のオブジェクト,  Up: xml dom --- ドキュメントオブジェクトモデル API

5.21.6.15 適合性
................

この節では適合性に関する要求と、Python DOM API、W3C DOM 勧告、および OMG
IDL の Python API への対応付けとの間の関係について述べます。

* Menu:

* 型の対応付け::
* アクセサメソッド::


File: python.info,  Node: 型の対応付け,  Next: アクセサメソッド,  Up: 適合性

5.21.6.16 型の対応付け
......................

DOM 仕様で使われている IDL 型は、以下のテーブルに従って Python の型に対
応付けられています。

IDL 型                 Python の型
                       
-----------------------------------------------------------------------
                       
‘boolean’              ‘bool’ または ‘int’
                       
                       
‘int’                  ‘int’
                       
                       
‘long int’             ‘int’
                       
                       
‘unsigned int’         ‘int’
                       
                       
‘DOMString’            ‘str’ または ‘bytes’
                       
                       
‘null’                 ‘None’
                       


File: python.info,  Node: アクセサメソッド,  Prev: 型の対応付け,  Up: 適合性

5.21.6.17 アクセサメソッド
..........................

OMG IDL から Python への対応付けは、IDL ‘attribute’ 宣言へのアクセサ関数
の定義を、Java による対応付けが行うのとほとんど同じように行います。IDL 宣
言の対応付け

     readonly attribute string someValue;
              attribute string anotherValue;

は、三つのアクセサ関数: ‘someValue’ に対する "get" メソッド
(‘_get_someValue()’)、そして ‘anotherValue’ に対する "get" および "set"
メソッド (‘_get_anotherValue()’ および ‘_set_anotherValue()’) を生成しま
す。とりわけ、対応付けでは、IDL 属性が通常の Python 属性としてアクセス可
能であることは必須ではありません: ‘object.someValue’ が動作することは必
須 'ではなく' 、 *note AttributeError: 5f0. を送出してもかまいません。

しかしながら、Python DOM API では、通常の属性アクセスが動作することが必
須です。これは、Python IDL コンパイラによって生成された典型的な代用物は
まず動作することはなく、DOM オブジェクトが CORBA を介してアクセスされる
場合には、クライアント上でラッパーオブジェクトが必要であることを意味しま
す。CORBA DOM クライアントでは他にもいくつか考慮すべきことがある一方で、
Python から CORBA を介して DOM を使った経験を持つ実装者はこのことを問題
視していません。‘readonly’ であると宣言された属性は、全ての DOM 実装で書
き込みアクセスを制限しているとは限りません。

Python DOM API では、アクセサ関数は必須ではありません。アクセサ関数が提
供された場合、Python IDL 対応付けによって定義された形式をとらなければな
りませんが、属性は Python から直接アクセスすることができるので、それらの
メソッドは必須ではないと考えられます。‘readonly’ であると宣言された属性
に対しては、 "set" アクセサを提供してはなりません。

このIDLでの定義はW3C DOM APIの全ての要件を実装しているわけではありません
。例えば、一部のオブジェクトの概念や ‘getElementsByTagName()’ が "live"
であることなどです。 Python DOM API はこれらの要件を実装することを強制し
ません。


File: python.info,  Node: xml dom minidom --- 最小限の DOM の実装,  Next: xml dom pulldom --- 部分的な DOM ツリー構築のサポート,  Prev: xml dom --- ドキュメントオブジェクトモデル API,  Up: 構造化マークアップツール

5.21.7 ‘xml.dom.minidom’ -- 最小限の DOM の実装
-----------------------------------------------

'ソースコード:' Lib/xml/dom/minidom.py(1)

__________________________________________________________________

‘xml.dom.minidom’ is a minimal implementation of the Document Object
Model interface, with an API similar to that in other languages.  It is
intended to be simpler than the full DOM and also significantly smaller.
Users who are not already proficient with the DOM should consider using
the *note xml.etree.ElementTree: 12b. module for their XML processing
instead.

     注釈: If you need to parse untrusted or unauthenticated data, see
     *note XML security: 3ce9.

DOM applications typically start by parsing some XML into a DOM. With
‘xml.dom.minidom’, this is done through the parse functions:

     from xml.dom.minidom import parse, parseString

     dom1 = parse('c:\\temp\\mydata.xml')  # parse an XML file by name

     datasource = open('c:\\temp\\mydata.xml')
     dom2 = parse(datasource)  # parse an open file

     dom3 = parseString('<myxml>Some data<empty/> some more data</myxml>')

*note parse(): 3dbf. 関数はファイル名か、開かれたファイルオブジェクトを
引数にとることができます。

 -- の関数: xml.dom.minidom.parse (filename_or_file, parser=None,
          bufsize=None)

     与えられた入力から ‘Document’ を返します。 'filename_or_file' はフ
     ァイル名でもファイルオブジェクトでもかまいません。 'parser' を指定
     する場合、SAX2 パーザオブジェクトでなければなりません。この関数はパ
     ーザの文書ハンドラを変更し、名前空間サポートを有効にします; (エンテ
     ィティリゾルバ (entity resolver) のような) 他のパーザ設定は前もって
     おこなわなければなりません。

XML データを文字列で持っている場合、 *note parseString(): 3dc0. を代わり
に使うことができます:

 -- の関数: xml.dom.minidom.parseString (string, parser=None)

     'string' を表わす ‘Document’ を返します。このメソッドは、文字列に対
     する *note io.StringIO: 112a. オブジェクトを作成し、それを *note
     parse(): 3dbf. に渡します。

これらの関数は両方とも、文書の内容を表現する ‘Document’ オブジェクトを返
します。

What the *note parse(): 3dbf. and *note parseString(): 3dc0. functions
do is connect an XML parser with a "DOM builder" that can accept parse
events from any SAX parser and convert them into a DOM tree.  The names
of the functions are perhaps misleading, but are easy to grasp when
learning the interfaces.  The parsing of the document will be completed
before these functions return; it's simply that these functions do not
provide a parser implementation themselves.

You can also create a ‘Document’ by calling a method on a "DOM
Implementation" object.  You can get this object either by calling the
‘getDOMImplementation()’ function in the *note xml.dom: 127. package or
the ‘xml.dom.minidom’ module.  Once you have a ‘Document’, you can add
child nodes to it to populate the DOM:

     from xml.dom.minidom import getDOMImplementation

     impl = getDOMImplementation()

     newdoc = impl.createDocument(None, "some_tag", None)
     top_element = newdoc.documentElement
     text = newdoc.createTextNode('Some textual content.')
     top_element.appendChild(text)

DOM 文書オブジェクトを手にしたら、XML 文書のプロパティやメソッドを使って
、文書の一部にアクセスすることができます。これらのプロパティは DOM 仕様
で定義されています。文書オブジェクトの主要なプロパティは
‘documentElement’ プロパティです。このプロパティは XML 文書の主要な要素
、つまり他の全ての要素を保持する要素を与えます。以下にプログラム例を示し
ます。

     dom3 = parseString("<myxml>Some data</myxml>")
     assert dom3.documentElement.tagName == "myxml"

When you are finished with a DOM tree, you may optionally call the
‘unlink()’ method to encourage early cleanup of the now-unneeded
objects.  ‘unlink()’ is an ‘xml.dom.minidom’-specific extension to the
DOM API that renders the node and its descendants essentially useless.
Otherwise, Python's garbage collector will eventually take care of the
objects in the tree.

参考
....

Document Object Model (DOM) Level 1 Specification(2)

     The W3C recommendation for the DOM supported by ‘xml.dom.minidom’.

* Menu:

* DOM オブジェクト::
* DOM の例::
* minidom と DOM 標準::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/xml/dom/minidom.py

   (2) https://www.w3.org/TR/REC-DOM-Level-1/


File: python.info,  Node: DOM オブジェクト,  Next: DOM の例,  Up: xml dom minidom --- 最小限の DOM の実装

5.21.7.1 DOM オブジェクト
.........................

The definition of the DOM API for Python is given as part of the *note
xml.dom: 127. module documentation.  This section lists the differences
between the API and ‘xml.dom.minidom’.

 -- メソッド: Node.unlink ()

     DOM との内部的な参照を破壊して、循環参照ガベージコレクションを持た
     ないバージョンの Python でもガベージコレクションされるようにします
     。循環参照ガベージコレクションが利用できる場合でも、このメソッドを
     使えば大量のメモリをすぐに使えるようにできるため、不要になったらす
     ぐに DOM オブジェクトに対してこのメソッドを呼ぶのが良い習慣です。こ
     のメソッドは ‘Document’ オブジェクトに対して呼び出すだけでよいので
     すが、あるノードの子ノードを破棄するために子ノードに対して呼び出し
     てもかまいません。

     *note with: 186. ステートメントを使用することで、このメソッドを明示
     的に呼ばないようにできます。 ‘with’ ブロックから出る時に自動的に次
     のコードが 'dom' を unlink します:

          with xml.dom.minidom.parse(datasource) as dom:
              ... # Work with dom.

 -- メソッド: Node.writexml (writer, indent='', addindent='', newl='',
          encoding=None, standalone=None)

     XML を 'writer' オブジェクトに書き込みます。 'writer' は入力として
     テキストは受け付けますが、バイト列は受け付けません。 'writer' はフ
     ァイルオブジェクトインターフェースの ‘write()’ に該当するメソッドを
     持たなければなりません。 'indent' 引数には現在のノードのインデント
     を指定します。 'addindent' 引数には現在のノードの下にサブノードを追
     加する際のインデント増分を指定します。 'newl' には、改行時に行末を
     終端する文字列を指定します。

     ‘Document’ ノードでは、追加のキーワード引数 'encoding' を使って XML
     ヘッダの encoding フィールドを指定することができます。

     同様に、'standalone' 引数を明示的に指定すると、スタンドアロン文書宣
     言がXMLのプロローグに追加されます。値が ‘True’ の場合、
     ‘standalone="yes"’ が追加され、それ以外の場合 ‘"no"’ が設定されます
     。引数を指定しない場合は文書から宣言が省略されます。

     バージョン 3.8 で変更: *note writexml(): c89. メソッドはユーザーが
     指定した属性の順序を保持するようになりました。

     バージョン 3.9 で変更: 'standalone' パラメータが追加されました。

 -- メソッド: Node.toxml (encoding=None, standalone=None)

     DOM ノードによって表わされる XML を含んだ文字列またはバイト文字列を
     返します。

     明示的に 'encoding' (1) 引数を渡すと、結果は指定されたエンコードの
     バイト文字列になります。'encoding' 引数なしだと、結果は unicode 文
     字列です。また、結果として生じる文字列の中の XML 宣言はエンコーディ
     ングを指定しません。XML のデフォルトエンコーディングは UTF-8 なので
     、この文字列を UTF-8 以外でエンコードすることはおそらく正しくありま
     せん。

     'standalone' 引数は *note writexml(): c89. と全く同じ動作をします。

     バージョン 3.8 で変更: *note toxml(): c8a. メソッドはユーザーが指定
     した属性の順序を保持するようになりました。

     バージョン 3.9 で変更: 'standalone' パラメータが追加されました。

 -- メソッド: Node.toprettyxml (indent='\t', newl='\n', encoding=None,
          standalone=None)

     文書の整形されたバージョンを返します。 'indent' はインデントを行う
     ための文字で、デフォルトはタブです; 'newl' には行末で出力される文字
     列を指定し、デフォルトは ‘\n’ です。

     'encoding' 引数は *note toxml(): c8a. の対応する引数と同様に振る舞
     います。

     'standalone' 引数は *note writexml(): c89. と全く同じ動作をします。

     バージョン 3.8 で変更: *note toprettyxml(): c8b. メソッドはユーザー
     が指定した属性の順序を保持するようになりました。

     バージョン 3.9 で変更: 'standalone' パラメータが追加されました。

   ---------- Footnotes ----------

   (1) XML 出力に含まれるエンコード名は適切な規格に従っていなければなり
ません。例えば "UTF-8" は有効ですが、 "UTF8" は XML 文書の宣言では有効で
はありません。後者はエンコード名として Python に認められるとしてもです。
‘https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl’ と
‘https://www.iana.org/assignments/character-sets/character-sets.xhtml’ を
参照してください。


File: python.info,  Node: DOM の例,  Next: minidom と DOM 標準,  Prev: DOM オブジェクト,  Up: xml dom minidom --- 最小限の DOM の実装

5.21.7.2 DOM の例
.................

以下のプログラム例は、単純なプログラムのかなり現実的な例です。特にこの例
に関しては、DOM の柔軟性をあまり活用してはいません。

     import xml.dom.minidom

     document = """\
     <slideshow>
     <title>Demo slideshow</title>
     <slide><title>Slide title</title>
     <point>This is a demo</point>
     <point>Of a program for processing slides</point>
     </slide>

     <slide><title>Another demo slide</title>
     <point>It is important</point>
     <point>To have more than</point>
     <point>one slide</point>
     </slide>
     </slideshow>
     """

     dom = xml.dom.minidom.parseString(document)

     def getText(nodelist):
         rc = []
         for node in nodelist:
             if node.nodeType == node.TEXT_NODE:
                 rc.append(node.data)
         return ''.join(rc)

     def handleSlideshow(slideshow):
         print("<html>")
         handleSlideshowTitle(slideshow.getElementsByTagName("title")[0])
         slides = slideshow.getElementsByTagName("slide")
         handleToc(slides)
         handleSlides(slides)
         print("</html>")

     def handleSlides(slides):
         for slide in slides:
             handleSlide(slide)

     def handleSlide(slide):
         handleSlideTitle(slide.getElementsByTagName("title")[0])
         handlePoints(slide.getElementsByTagName("point"))

     def handleSlideshowTitle(title):
         print(f"<title>{getText(title.childNodes)}</title>")

     def handleSlideTitle(title):
         print(f"<h2>{getText(title.childNodes)}</h2>")

     def handlePoints(points):
         print("<ul>")
         for point in points:
             handlePoint(point)
         print("</ul>")

     def handlePoint(point):
         print(f"<li>{getText(point.childNodes)}</li>")

     def handleToc(slides):
         for slide in slides:
             title = slide.getElementsByTagName("title")[0]
             print(f"<p>{getText(title.childNodes)}</p>")

     handleSlideshow(dom)


File: python.info,  Node: minidom と DOM 標準,  Prev: DOM の例,  Up: xml dom minidom --- 最小限の DOM の実装

5.21.7.3 minidom と DOM 標準
............................

The ‘xml.dom.minidom’ module is essentially a DOM 1.0-compatible DOM
with some DOM 2 features (primarily namespace features).

Python における DOM インターフェースは率直なものです。以下の対応付け規則
が適用されます:

   * インターフェースはインスタンスオブジェクトを介してアクセスされます
     。アプリケーション自身から、クラスをインスタンス化してはなりません;
     ‘Document’ オブジェクト上で利用可能な生成関数 (creator function) を
     使わなければなりません。派生インターフェースでは基底インターフェー
     スの全ての演算 (および属性) に加え、新たな演算をサポートします。

   * 演算はメソッドとして使われます。DOM では *note in: 34b. パラメタの
     みを使うので、引数は通常の順番 (左から右へ) で渡されます。オプショ
     ン引数はありません。 ‘void’ 演算は ‘None’ を返します。

   * IDL 属性はインスタンス属性に対応付けられます。OMG IDL 言語における
     Python への対応付けとの互換性のために、属性 ‘foo’ はアクセサメソッ
     ド ‘_get_foo()’ および ‘_set_foo()’ でもアクセスできます。
     ‘readonly’ 属性は変更してはなりません; とはいえ、これは実行時には強
     制されません。

   * ‘short int’ 、 ‘unsigned int’ 、 ‘unsigned long long’ 、および
     ‘boolean’ 型は、全て Python 整数オブジェクトに対応付けられます。

   * The type ‘DOMString’ maps to Python strings.  ‘xml.dom.minidom’
     supports either bytes or strings, but will normally produce
     strings.  Values of type ‘DOMString’ may also be ‘None’ where
     allowed to have the IDL ‘null’ value by the DOM specification from
     the W3C.

   * ‘const’ 宣言を行うと、
     (‘xml.dom.minidom.Node.PROCESSING_INSTRUCTION_NODE’ のように) 対応
     するスコープ内の変数に対応付けを行います; これらは変更してはなりま
     せん。

   * ‘DOMException’ is currently not supported in ‘xml.dom.minidom’.
     Instead, ‘xml.dom.minidom’ uses standard Python exceptions such as
     *note TypeError: 198. and *note AttributeError: 5f0.

   * ‘NodeList’ オブジェクトは Python の組み込みのリスト型を使って実装さ
     れています。これらのオブジェクトは DOM 仕様で定義されたインターフェ
     ースを提供していますが、以前のバージョンの Python では、公式の API
     をサポートしていません。しかしながら、これらの API は W3C 勧告で定
     義されたインターフェースよりも "Python 的な" ものになっています。

The following interfaces have no implementation in ‘xml.dom.minidom’:

   * ‘DOMTimeStamp’

   * ‘EntityReference’

これらの大部分は、ほとんどの DOM のユーザにとって一般的な用途として有用
とはならないような XML 文書内の情報を反映しています。

脚注
....


File: python.info,  Node: xml dom pulldom --- 部分的な DOM ツリー構築のサポート,  Next: xml sax --- SAX2 バーサーのサポート,  Prev: xml dom minidom --- 最小限の DOM の実装,  Up: 構造化マークアップツール

5.21.8 ‘xml.dom.pulldom’ -- 部分的な DOM ツリー構築のサポート
-------------------------------------------------------------

'Source code:' Lib/xml/dom/pulldom.py(1)

__________________________________________________________________

The ‘xml.dom.pulldom’ module provides a "pull parser" which can also be
asked to produce DOM-accessible fragments of the document where
necessary.  The basic concept involves pulling "events" from a stream of
incoming XML and processing them.  In contrast to SAX which also employs
an event-driven processing model together with callbacks, the user of a
pull parser is responsible for explicitly pulling events from the
stream, looping over those events until either processing is finished or
an error condition occurs.

     注釈: If you need to parse untrusted or unauthenticated data, see
     *note XML security: 3ce9.

バージョン 3.7.1 で変更: SAXパーサーは、デフォルトでセキュリティーを向上
させるために、一般的な外部エンティティーをデフォルトでは処理しなくなりま
した。外部エンティティの処理を有効にするには、次の場所にカスタムパーサー
インスタンスを渡します:

     from xml.dom.pulldom import parse
     from xml.sax import make_parser
     from xml.sax.handler import feature_external_ges

     parser = make_parser()
     parser.setFeature(feature_external_ges, True)
     parse(filename, parser=parser)

以下はプログラム例です:

     from xml.dom import pulldom

     doc = pulldom.parse('sales_items.xml')
     for event, node in doc:
         if event == pulldom.START_ELEMENT and node.tagName == 'item':
             if int(node.getAttribute('price')) > 50:
                 doc.expandNode(node)
                 print(node.toxml())

‘event’ は定数で以下の内の一つです:

   * ‘START_ELEMENT’

   * ‘END_ELEMENT’

   * ‘COMMENT’

   * ‘START_DOCUMENT’

   * ‘END_DOCUMENT’

   * ‘CHARACTERS’

   * ‘PROCESSING_INSTRUCTION’

   * ‘IGNORABLE_WHITESPACE’

‘node’ は型 ‘xml.dom.minidom.Document’、 ‘xml.dom.minidom.Element’ また
は ‘xml.dom.minidom.Text’ のオブジェクトです。

文書はイベントの 'フラットな' 流れとして扱われるため、文書の "木" は暗黙
のうちに全て読み込まれ、目的の要素は木の中の深さに依らずに見つけられます
。つまり、文書ノードの再帰的な検索のような階層的な問題を考える必要はあり
ません。しかしながら要素の前後関係が重要な場合は、前後関係の状態を維持す
る (すなわち文章中の任意の点の場所を記憶する) か、 *note
DOMEventStream.expandNode(): 3dcb. メソッドを使用して DOM 関連の処理に切
り替える必要があります。

 -- クラス: xml.dom.pulldom.PullDOM (documentFactory=None)

     *note xml.sax.handler.ContentHandler: 3dcd. のサブクラスです。

 -- クラス: xml.dom.pulldom.SAX2DOM (documentFactory=None)

     *note xml.sax.handler.ContentHandler: 3dcd. のサブクラスです。

 -- の関数: xml.dom.pulldom.parse (stream_or_string, parser=None,
          bufsize=None)

     与えられた入力から *note DOMEventStream: 93e. を返します。
     'stream_or_string' はファイル名かファイル様オブジェクトのいずれかで
     す。'parser' は、与えれた場合、 *note XMLReader: 3dd0. オブジェクト
     でなければなりません。この関数はパーザの文書ハンドラを変えて名前空
     間のサポートを有効にします。パーザの他の設定 (例えばエンティティリ
     ゾルバ) は前もってしておかなければなりません。

XML データを文字列で持っている場合、 *note parseString(): 3dd1. を代わり
に使うことができます:

 -- の関数: xml.dom.pulldom.parseString (string, parser=None)

     (ユニコード) 'string' を表す *note DOMEventStream: 93e. を返します
     。

 -- データ: xml.dom.pulldom.default_bufsize

     *note parse(): 3dcf. の 'bufsize' パラメタのデフォルト値です。

     この変数の値は *note parse(): 3dcf. を呼び出す前に変更することがで
     きます。その場合、その新しい値が有効になります。

* Menu:

* DOMEventStream オブジェクト::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/xml/dom/pulldom.py


File: python.info,  Node: DOMEventStream オブジェクト,  Up: xml dom pulldom --- 部分的な DOM ツリー構築のサポート

5.21.8.1 DOMEventStream オブジェクト
....................................

 -- クラス: xml.dom.pulldom.DOMEventStream (stream, parser, bufsize)

     バージョン 3.11 で変更: *note __getitem__(): 588. メソッドのサポー
     トは削除されました。

      -- メソッド: getEvent ()

          event が ‘START_DOCUMENT’ の場合は 'event' と
          ‘xml.dom.minidom.Document’ としての現在の 'node' からなるタプ
          ルを、 ‘START_ELEMENT’ か ‘END_ELEMENT’ の場合は
          ‘xml.dom.minidom.Element’ を、 ‘CHARACTERS’ の場合は
          ‘xml.dom.minidom.Text’ を返します。 *note expandNode(): 3dcb.
          が呼ばれない限り、現在のノードは子ノードの情報を持ちません。

      -- メソッド: expandNode (node)

          'node' の全子ノードを 'node' に展開します。例:

               from xml.dom import pulldom

               xml = '<html><title>Foo</title> <p>Some text <div>and more</div></p> </html>'
               doc = pulldom.parseString(xml)
               for event, node in doc:
                   if event == pulldom.START_ELEMENT and node.tagName == 'p':
                       # Following statement only prints '<p/>'
                       print(node.toxml())
                       doc.expandNode(node)
                       # Following statement prints node with all its children '<p>Some text <div>and more</div></p>'
                       print(node.toxml())

      -- メソッド: reset ()


File: python.info,  Node: xml sax --- SAX2 バーサーのサポート,  Next: xml sax handler --- SAX ハンドラーの基底クラス,  Prev: xml dom pulldom --- 部分的な DOM ツリー構築のサポート,  Up: 構造化マークアップツール

5.21.9 ‘xml.sax’ -- SAX2 バーサーのサポート
-------------------------------------------

'ソースコード:' Lib/xml/sax/__init__.py(1)

__________________________________________________________________

The ‘xml.sax’ package provides a number of modules which implement the
Simple API for XML (SAX) interface for Python.  The package itself
provides the SAX exceptions and the convenience functions which will be
most used by users of the SAX API.

     注釈: If you need to parse untrusted or unauthenticated data, see
     *note XML security: 3ce9.

バージョン 3.7.1 で変更: SAXパーサーは、セキュリティーを向上させるために
、デフォルトで一般的な外部エンティティーを処理しなくなりました。以前は、
パーサーは、DTDおよびエンティティ用にファイルシステムからリモートファイ
ルまたはロードされたローカルファイルをフェッチするためのネットワーク接続
を作成していました。この機能は parser オブジェクトと(実) 引数 *note
feature_external_ges: 17cd. の *note setFeature(): 3dda. メソッドで再度
有効にすることができます。

その関数群は以下の通りです:

 -- の関数: xml.sax.make_parser (parser_list=[])

     SAX *note XMLReader: 3dd0. オブジェクトを生成し、返します。最初に見
     つかったパーサーが使用されます。'parser_list' を与える場合、それは
     ‘create_parser()’ という名前の関数をもつモジュール名のイテラブルで
     なければなりません。 'parser_list' に列挙されているモジュールは、パ
     ーサーのデフォルトリストにあるモジュールよりも先に使われます。

     バージョン 3.8 で変更: 'parser_list' 引数はリストだけでなく、イテラ
     ブルでもよくなりました。

 -- の関数: xml.sax.parse (filename_or_stream, handler,
          error_handler=handler.ErrorHandler())

     SAX パーサを生成し、そのパーサをドキュメントの解析に使用します。
     'filename_or_stream' として与えられるドキュメントは、ファイル名でも
     ファイルオブジェクトでもかまいません。 'handler' 引数は SAX *note
     ContentHandler: 3dcd. のインスタントである必要があります。
     'error_handler' が与えられる場合は、 SAX *note ErrorHandler: 3ddb.
     のインスタンスである必要があります。この引数を省略した場合、全ての
     例外に対して *note SAXParseException: 3ddc. が発生します。 戻り値は
     ありません。すべての操作は渡される 'handler' によって行われなければ
     なりません。

 -- の関数: xml.sax.parseString (string, handler,
          error_handler=handler.ErrorHandler())

     *note parse(): 1de6. と同様ですが、こちらは引数で受け取ったバッファ
     'string' をパースします。 'string' は *note str: 169. インスタンス
     か *note bytes-like object: 193. でなければなりません。

     バージョン 3.5 で変更: *note str: 169. インスタンスがサポートされま
     した。

典型的な SAX アプリケーションでは3種類のオブジェクト(リーダ、ハンドラ、
入力元)が用いられます。ここで言うリーダとはパーサを指しています。つまり
、入力元からバイト列または文字列を読み込み、一連のイベントを発生させるコ
ード片のことです。発生したイベントはハンドラ・オブジェクトに割り振られま
す。言い換えると、リーダがハンドラのメソッドを呼び出すわけです。つまり、
SAX アプリケーションは、リーダ・オブジェクトを作成し、入力元のオブジェク
トを作成するか開き、ハンドラ・オブジェクトを作成し、これら3つのオブジェ
クトを連携させる必要があります。準備の最終段階では、リーダが呼び出され、
入力をパースします。パース中には、入力データからの構造イベントや構文イベ
ントに基づいて、ハンドラ・オブジェクトのメソッドが呼び出されます。

For these objects, only the interfaces are relevant; they are normally
not instantiated by the application itself.  Since Python does not have
an explicit notion of interface, they are formally introduced as
classes, but applications may use implementations which do not inherit
from the provided classes.  The *note InputSource: 109b, *note Locator:
3ddd, ‘Attributes’, ‘AttributesNS’, and *note XMLReader: 3dd0.
interfaces are defined in the module *note xml.sax.xmlreader: 132.  The
handler interfaces are defined in *note xml.sax.handler: 130.  For
convenience, *note InputSource: 109b. (which is often instantiated
directly) and the handler classes are also available from ‘xml.sax’.
These interfaces are described below.

In addition to these classes, ‘xml.sax’ provides the following exception
classes.

 -- 例外: xml.sax.SAXException (msg, exception=None)

     XML エラーと警告をカプセル化します。このクラスには XML パーサとアプ
     リケーションで発生するエラーおよび警告の基本的な情報を持たせること
     ができます。また機能追加や地域化のためにサブクラス化することも可能
     です。なお *note ErrorHandler: 3ddb. で定義されているハンドラがこの
     例外のインスタンスを受け取ることに注意してください。実際に例外を発
     生させることは必須でなく、情報のコンテナとして利用されることもある
     からです。

     インスタンスを作成する際 'msg' はエラー内容を示す可読データにしてく
     ださい。オプションの 'exception' 引数は ‘None’ にするか、パース用コ
     ードで捕捉されて情報として渡される例外にしてください。

     このクラスはSAX 例外の基底クラスになります。

 -- 例外: xml.sax.SAXParseException (msg, exception, locator)

     パースエラー時に発生する *note SAXException: 3dde. のサブクラスです
     。パースエラーに関する情報として、このクラスのインスタンスが SAX
     *note ErrorHandler: 3ddb. インターフェースのメソッドに渡されます。
     このクラスは *note SAXException: 3dde. 同様 SAX *note Locator:
     3ddd. インターフェースもサポートしています。

 -- 例外: xml.sax.SAXNotRecognizedException (msg, exception=None)

     SAX *note XMLReader: 3dd0. が認識できない機能やプロパティに遭遇した
     とき発生させる *note SAXException: 3dde. のサブクラスです。 SAX ア
     プリケーションや拡張モジュールにおいて同様の目的にこのクラスを利用
     することもできます。

 -- 例外: xml.sax.SAXNotSupportedException (msg, exception=None)

     SAX *note XMLReader: 3dd0. が要求された機能をサポートしていないとき
     発生させる *note SAXException: 3dde. のサブクラスです。 SAX アプリ
     ケーションや拡張モジュールにおいて同様の目的にこのクラスを利用する
     こともできます。

参考
....

SAX: The Simple API for XML(2)

     SAX API 定義に関し中心となっているサイトです。Java による実装とオン
     ライン・ドキュメントが提供されています。実装と SAX API の歴史に関す
     る情報のリンクも掲載されています。

*note xml.sax.handler: 130. モジュール

     アプリケーションが提供するオブジェクトのインターフェース定義。

*note xml.sax.saxutils: 131. モジュール

     SAX アプリケーション向けの有用な関数群。

*note xml.sax.xmlreader: 132. モジュール

     パーサが提供するオブジェクトのインターフェース定義。

* Menu:

* SAXException オブジェクト::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/xml/sax/__init__.py

   (2) http://www.saxproject.org/


File: python.info,  Node: SAXException オブジェクト,  Up: xml sax --- SAX2 バーサーのサポート

5.21.9.1 SAXException オブジェクト
..................................

*note SAXException: 3dde. 例外クラスは以下のメソッドをサポートしています
:

 -- メソッド: SAXException.getMessage ()

     エラー状態を示す可読メッセージを返します。

 -- メソッド: SAXException.getException ()

     カプセル化した例外オブジェクトまたは ‘None’ を返します。


File: python.info,  Node: xml sax handler --- SAX ハンドラーの基底クラス,  Next: xml sax saxutils --- SAX ユーティリティー,  Prev: xml sax --- SAX2 バーサーのサポート,  Up: 構造化マークアップツール

5.21.10 ‘xml.sax.handler’ -- SAX ハンドラーの基底クラス
-------------------------------------------------------

'ソースコード:' Lib/xml/sax/handler.py(1)

__________________________________________________________________

The SAX API defines five kinds of handlers: content handlers, DTD
handlers, error handlers, entity resolvers and lexical handlers.
Applications normally only need to implement those interfaces whose
events they are interested in; they can implement the interfaces in a
single object or in multiple objects.  Handler implementations should
inherit from the base classes provided in the module ‘xml.sax.handler’,
so that all methods get default implementations.

 -- クラス: xml.sax.handler.ContentHandler

     アプリケーションにとって最も重要なメインの SAX コールバック・インタ
     ーフェースです。このインターフェースで発生するイベントの順序はドキ
     ュメント内の情報の順序を反映しています。

 -- クラス: xml.sax.handler.DTDHandler

     DTD イベントのハンドラです。

     パースされていないエンティティや属性など、基本的なパースに必要な
     DTD イベントの指定だけを行うインターフェースです。

 -- クラス: xml.sax.handler.EntityResolver

     エンティティ解決用の基本インターフェースです。このインターフェース
     を実装したオブジェクトを作成しパーサに登録することで、パーサはすべ
     ての外部エンティティを解決するメソッドを呼び出すようになります。

 -- クラス: xml.sax.handler.ErrorHandler

     エラーや警告メッセージをアプリケーションに通知するためにパーサが使
     用するインターフェースです。このオブジェクトのメソッドが、エラーを
     ただちに例外に変換するか、あるいは別の方法で処理するかの制御をして
     います。

 -- クラス: xml.sax.handler.LexicalHandler

     Interface used by the parser to represent low frequency events
     which may not be of interest to many applications.

In addition to these classes, ‘xml.sax.handler’ provides symbolic
constants for the feature and property names.

 -- データ: xml.sax.handler.feature_namespaces

          値: ‘"http://xml.org/sax/features/namespaces"’
          真: 名前空間を処理します。
          偽: オプションで名前空間を処理しません (暗黙に名前空間接頭辞も無効にします; デフォルト)。
          アクセス: (パース時) 読み込み専用; (パース時以外) 読み書き可

 -- データ: xml.sax.handler.feature_namespace_prefixes

          値: ‘"http://xml.org/sax/features/namespace-prefixes"’
          真: 名前空間宣言で用いられている元々の接頭辞付きの名前と属性を報告します。
          偽: 名前空間宣言で用いられている属性を報告しません。オプションで元々の接頭辞付きの名前も報告しません (デフォルト)。
          アクセス: (パース時) 読み込み専用; (パース時以外) 読み書き可

 -- データ: xml.sax.handler.feature_string_interning

          値: ‘"http://xml.org/sax/features/string-interning"’
          真: 全ての要素名、接頭辞、属性名、名前空間 URI、ローカル名を組込みの intern 関数を使ってシンボルに登録します。
          偽: 名前を必ずしもシンボルに登録しませんが、されるかもしれません (デフォルト)。
          アクセス: (パース時) 読み込み専用; (パース時以外) 読み書き可

 -- データ: xml.sax.handler.feature_validation

          値: ‘"http://xml.org/sax/features/validation"’
          真: 全ての妥当性検査エラーを報告します (外部一般エンティティと外部変数エンティティが暗示されます)。
          偽: 妥当性検査エラーを報告しません。
          アクセス: (パース時) 読み込み専用; (パース時以外) 読み書き可

 -- データ: xml.sax.handler.feature_external_ges

          警告: Enabling opens a vulnerability to external entity
          attacks(2) if the parser is used with user-provided XML
          content.  Please reflect on your threat model(3) before
          enabling this feature.

          値: ‘"http://xml.org/sax/features/external-general-entities"’
          真: 全ての外部一般 (テキスト) エンティティを取り込みます。
          偽: 外部一般エンティティを取り込みません。
          アクセス: (パース時) 読み込み専用; (パース時以外) 読み書き可

 -- データ: xml.sax.handler.feature_external_pes

          値: ‘"http://xml.org/sax/features/external-parameter-entities"’
          真: 外部 DTD サブセットを含む全ての外部変数エンティティを取り込みます。
          偽: 外部 DTD サブセットであっても外部変数エンティティを取り込みません。
          アクセス: (パース時) 読み込み専用; (パース時以外) 読み書き可

 -- データ: xml.sax.handler.all_features

     全機能のリスト。

 -- データ: xml.sax.handler.property_lexical_handler

          値: ‘"http://xml.org/sax/properties/lexical-handler"’
          data type: xml.sax.handler.LexicalHandler (not supported in Python 2)
          説明: コメントなど字句解析イベント用のオプション拡張ハンドラ。
          アクセス: 読み書き可

 -- データ: xml.sax.handler.property_declaration_handler

          値: ‘"http://xml.org/sax/properties/declaration-handler"’
          データ型: xml.sax.sax2lib.DeclHandler (Python 2 では未サポート)
          説明: 表記や未解析エンティティをのぞく DTD 関連イベント用のオプション拡張ハンドラ。
          アクセス: 読み書き可

 -- データ: xml.sax.handler.property_dom_node

          値: ‘"http://xml.org/sax/properties/dom-node"’
          データ型: org.w3c.dom.Node (Python 2 では未サポート)
          説明: パース時は DOM イテレータならば現在の DOM ノードです。非パース時はイテレートのルート DOM ノードです。
          アクセス: (パース時) 読み込み専用; (パース時以外) 読み書き可

 -- データ: xml.sax.handler.property_xml_string

          値: ‘"http://xml.org/sax/properties/xml-string"’
          data type: Bytes
          説明: 現在のイベントの元になったリテラル文字列。
          アクセス: 読み出し専用

 -- データ: xml.sax.handler.all_properties

     既知の全プロパティ名のリスト。

* Menu:

* ContentHandler オブジェクト::
* DTDHandler オブジェクト::
* EntityResolver オブジェクト::
* ErrorHandler オブジェクト::
* LexicalHandler Objects::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/xml/sax/handler.py

   (2) https://en.wikipedia.org/wiki/XML_external_entity_attack

   (3) https://en.wikipedia.org/wiki/Threat_model


File: python.info,  Node: ContentHandler オブジェクト,  Next: DTDHandler オブジェクト,  Up: xml sax handler --- SAX ハンドラーの基底クラス

5.21.10.1 ContentHandler オブジェクト
.....................................

*note ContentHandler: 3dcd. はアプリケーション側でサブクラス化して利用す
ることが前提になっています。パーサは入力ドキュメントのイベントにより、そ
れぞれに対応する以下のメソッドを呼び出します:

 -- メソッド: ContentHandler.setDocumentLocator (locator)

     アプリケーションにドキュメントイベントの発生位置を指すロケータを与
     えるためにパーサから呼び出されます。

     SAX パーサによるロケータの提供は強く推奨されています(必須ではありま
     せん)。もし提供する場合は、DocumentHandler インターフェースのどのメ
     ソッドよりも先にこのメソッドが呼び出されるようにしなければなりませ
     ん。

     パーサがエラーを報告しない場合でも、ロケータによってアプリケーショ
     ンは全てのドキュメント関連イベントの終了位置を知ることが出来ます。
     通常、アプリケーションは自身のエラー (例えば文字コンテンツがアプリ
     ケーションの規則に適合しない場合) を報告するためにこれを使用します
     。 ロケータが返す情報は検索エンジンでの利用にはおそらく不充分です。

     ロケータが正しい情報を返すのは、このインターフェースからイベントの
     呼出しが実行されている間だけです。それ以外のときは使用すべきであり
     ません。

 -- メソッド: ContentHandler.startDocument ()

     ドキュメントの開始通知を受け取ります。

     SAX パーサはこのインターフェースやDTDHandler のどのメソッド (*note
     setDocumentLocator(): 3df7. を除く) よりも先にこのメソッドを一度だ
     け呼び出します。

 -- メソッド: ContentHandler.endDocument ()

     ドキュメントの終了通知を受け取ります。

     SAX パーサはこのメソッドを一度だけ呼び出します。パース中に呼び出す
     最後のメソッドです。パーサは (回復不能なエラーで) パース処理を中断
     するか、あるいは入力の最後に到達するまでこのメソッドを呼び出しませ
     ん。

 -- メソッド: ContentHandler.startPrefixMapping (prefix, uri)

     接頭辞と URI 名前空間の関連付けのスコープを開始します。

     このイベントからの情報は名前空間処理に必須ではありません。SAX XML リ
     ーダは ‘feature_namespaces’ 機能が有効な場合 (デフォルト)、要素と属
     性名の接頭辞を自動的に置換します。

     しかしながら、接頭辞の自動展開を安全に行えないために、アプリケーシ
     ョンが文字データや属性値の中で接頭辞を使わなければならない場合があ
     ります。 必要ならば *note startPrefixMapping(): 3dfa. や *note
     endPrefixMapping(): 3dfb. イベントはアプリケーションにコンテキスト
     自身の中で接頭辞を展開するための情報を提供します。

     *note startPrefixMapping(): 3dfa. と *note endPrefixMapping():
     3dfb. イベントは相互に正しい入れ子関係になることが保証されていない
     ので注意が必要です。すべての *note startPrefixMapping(): 3dfa. は対
     応する *note startElement(): 175c. の前に発生し、 *note
     endPrefixMapping(): 3dfb. イベントは対応する *note endElement():
     175d. の後で発生しますが、その順序は保証されていません。

 -- メソッド: ContentHandler.endPrefixMapping (prefix)

     接頭辞と URI の関連付けのスコープを終了します。

     詳しくは *note startPrefixMapping(): 3dfa. を参照してください。この
     イベントは常に対応する *note endElement(): 175d. の後で発生しますが
     、複数の *note endPrefixMapping(): 3dfb. イベントの順序は特に保証さ
     れません。

 -- メソッド: ContentHandler.startElement (name, attrs)

     非名前空間モードでの要素の開始を通知します。

     The 'name' parameter contains the raw XML 1.0 name of the element
     type as a string and the 'attrs' parameter holds an object of the
     *note Attributes: 3dfc. interface containing the attributes of the
     element.  The object passed as 'attrs' may be re-used by the
     parser; holding on to a reference to it is not a reliable way to
     keep a copy of the attributes.  To keep a copy of the attributes,
     use the *note copy(): 29. method of the 'attrs' object.

 -- メソッド: ContentHandler.endElement (name)

     非名前空間モードでの要素の終了を通知します。

     'name' 引数は *note startElement(): 175c. イベントとまったく同じ要
     素型名を持ちます。

 -- メソッド: ContentHandler.startElementNS (name, qname, attrs)

     名前空間モードでの要素の開始を通知します。

     The 'name' parameter contains the name of the element type as a
     ‘(uri, localname)’ tuple, the 'qname' parameter contains the raw
     XML 1.0 name used in the source document, and the 'attrs' parameter
     holds an instance of the *note AttributesNS: 3dfe. interface
     containing the attributes of the element.  If no namespace is
     associated with the element, the 'uri' component of 'name' will be
     ‘None’.  The object passed as 'attrs' may be re-used by the parser;
     holding on to a reference to it is not a reliable way to keep a
     copy of the attributes.  To keep a copy of the attributes, use the
     *note copy(): 29. method of the 'attrs' object.

     ‘feature_namespace_prefixes’ 機能が有効でなければ、パーサで 'qname'
     を ‘None’ に設定することも可能です。

 -- メソッド: ContentHandler.endElementNS (name, qname)

     名前空間モードでの要素の終了を通知します。

     'name' 引数は *note startElementNS(): 3dfd. イベントとまったく同じ
     要素型を持ちます。 'qname' 引数も同様です。

 -- メソッド: ContentHandler.characters (content)

     文字データの通知を受け取ります。

     パーサはこのメソッドを呼び出して文字データの各チャンクを報告します
     。SAX パーサは一連の文字データを単一のチャンクとして返す場合と複数
     のチャンクに分けて返す場合がありますが、ロケータの情報が正しく保た
     れるように、一つのイベントの文字データは常に同じ外部エンティティの
     ものでなければなりません。

     'content' は文字列、バイト列のどちらでもかまいませんが、‘expat’ リ
     ーダ・モジュールは常に文字列を生成するようになっています。

          注釈: Python XML SIG が提供していた初期 SAX 1 では、このメソッ
          ドにもっと JAVA 風のインターフェースが用いられています。しかし
          Python で採用されている大半のパーサでは古いインターフェースを
          有効に使うことができないため、よりシンプルなものに変更されまし
          た。古いコードを新しいインターフェースに変更するには、古い
          'offset' と 'length' パラメータでスライスせずに、'content' を
          指定するようにしてください。

 -- メソッド: ContentHandler.ignorableWhitespace (whitespace)

     要素内容中の無視できる空白文字の通知を受け取ります。

     妥当性検査を行うパーサはこのメソッドを使って、無視できる空白文字
     (W3C XML 1.0 勧告の 2.10 節参照) の各チャンクを報告しなければなりま
     せん。妥当性検査をしないパーサもコンテンツモデルの利用とパースが可
     能な場合、このメソッドを利用することが可能です。

     SAX パーサは連続する複数の空白文字を単一のチャンクとして返す場合と
     複数のチャンクに分けて返す場合があります。しかし、ロケータが有用な
     情報を提供できるように、単一のイベント中のすべての文字は同じ外部エ
     ンティティからのものでなければなりません。

 -- メソッド: ContentHandler.processingInstruction (target, data)

     処理命令の通知を受け取ります。

     パーサは処理命令が見つかるたびにこのメソッドを呼び出します。処理命
     令はメインのドキュメント要素の前や後にも発生することがあるので注意
     してください。

     SAX パーサがこのメソッドを使って XML 宣言 (XML 1.0 のセクション
     2.8) やテキスト宣言 (XML 1.0 のセクション 4.3.1) の通知をすることは
     ありません。

 -- メソッド: ContentHandler.skippedEntity (name)

     スキップしたエンティティの通知を受け取ります。

     パーサはエンティティをスキップするたびにこのメソッドを呼び出します
     。妥当性検査をしないプロセッサは (外部 DTD サブセットで宣言されてい
     るなどの理由で) 宣言が見当たらないエンティティをスキップします。す
     べてのプロセッサは ‘feature_external_ges’ および
     ‘feature_external_pes’ 属性の値によっては外部エンティティをスキップ
     することがあります。


File: python.info,  Node: DTDHandler オブジェクト,  Next: EntityResolver オブジェクト,  Prev: ContentHandler オブジェクト,  Up: xml sax handler --- SAX ハンドラーの基底クラス

5.21.10.2 DTDHandler オブジェクト
.................................

*note DTDHandler: 3de8. インスタンスは以下のメソッドを提供します:

 -- メソッド: DTDHandler.notationDecl (name, publicId, systemId)

     表記宣言イベントの通知を扱います。

 -- メソッド: DTDHandler.unparsedEntityDecl (name, publicId, systemId,
          ndata)

     未パースのエンティティ宣言イベントの通知を扱います。


File: python.info,  Node: EntityResolver オブジェクト,  Next: ErrorHandler オブジェクト,  Prev: DTDHandler オブジェクト,  Up: xml sax handler --- SAX ハンドラーの基底クラス

5.21.10.3 EntityResolver オブジェクト
.....................................

 -- メソッド: EntityResolver.resolveEntity (publicId, systemId)

     エンティティのシステム識別子を解決し、文字列として読み込んだシステ
     ム識別子あるいは InputSource オブジェクトのいずれかを返します。デフ
     ォルトの実装では 'systemId' を返します。


File: python.info,  Node: ErrorHandler オブジェクト,  Next: LexicalHandler Objects,  Prev: EntityResolver オブジェクト,  Up: xml sax handler --- SAX ハンドラーの基底クラス

5.21.10.4 ErrorHandler オブジェクト
...................................

Objects with this interface are used to receive error and warning
information from the *note XMLReader: 3dd0.  If you create an object
that implements this interface, then register the object with your *note
XMLReader: 3dd0, the parser will call the methods in your object to
report all warnings and errors.  There are three levels of errors
available: warnings, (possibly) recoverable errors, and unrecoverable
errors.  All methods take a *note SAXParseException: 3ddc. as the only
parameter.  Errors and warnings may be converted to an exception by
raising the passed-in exception object.

 -- メソッド: ErrorHandler.error (exception)

     パーサが回復可能なエラーに遭遇すると呼び出されます。このメソッドが
     例外を送出しない場合パースは継続されますが、アプリケーションは更な
     るドキュメント情報を期待すべきではありません。パーサの処理を継続を
     認めることで入力ドキュメント内の他のエラーを見つけることができます
     。

 -- メソッド: ErrorHandler.fatalError (exception)

     パーサが回復不能なエラーに遭遇すると呼び出されます。このメソッドが
     return したとき、パースの停止が求められています。

 -- メソッド: ErrorHandler.warning (exception)

     パーサが軽微な警告情報をアプリケーションに通知するときに呼び出され
     ます。このメソッドが return したときはパースの継続が求められ、ドキ
     ュメント情報はアプリケーションに送り続けられます。このメソッドでの
     例外の送出はパースを終了します。


File: python.info,  Node: LexicalHandler Objects,  Prev: ErrorHandler オブジェクト,  Up: xml sax handler --- SAX ハンドラーの基底クラス

5.21.10.5 LexicalHandler Objects
................................

Optional SAX2 handler for lexical events.

This handler is used to obtain lexical information about an XML
document.  Lexical information includes information describing the
document encoding used and XML comments embedded in the document, as
well as section boundaries for the DTD and for any CDATA sections.  The
lexical handlers are used in the same manner as content handlers.

Set the LexicalHandler of an XMLReader by using the setProperty method
with the property identifier
‘'http://xml.org/sax/properties/lexical-handler'’.

 -- メソッド: LexicalHandler.comment (content)

     Reports a comment anywhere in the document (including the DTD and
     outside the document element).

 -- メソッド: LexicalHandler.startDTD (name, public_id, system_id)

     Reports the start of the DTD declarations if the document has an
     associated DTD.

 -- メソッド: LexicalHandler.endDTD ()

     Reports the end of DTD declaration.

 -- メソッド: LexicalHandler.startCDATA ()

     Reports the start of a CDATA marked section.

     The contents of the CDATA marked section will be reported through
     the characters handler.

 -- メソッド: LexicalHandler.endCDATA ()

     Reports the end of a CDATA marked section.


File: python.info,  Node: xml sax saxutils --- SAX ユーティリティー,  Next: xml sax xmlreader --- XML パーサーのインターフェース,  Prev: xml sax handler --- SAX ハンドラーの基底クラス,  Up: 構造化マークアップツール

5.21.11 ‘xml.sax.saxutils’ -- SAX ユーティリティー
--------------------------------------------------

'ソースコード:' Lib/xml/sax/saxutils.py(1)

__________________________________________________________________

The module ‘xml.sax.saxutils’ contains a number of classes and functions
that are commonly useful when creating SAX applications, either in
direct use, or as base classes.

 -- の関数: xml.sax.saxutils.escape (data, entities={})

     文字列データ内の ‘'&'’, ‘'<'’, ‘'>'’ をエスケープします。

     オプションの 'entities' 引数に辞書を渡すことで、そのほかの文字列デ
     ータをエスケープすることも可能です。辞書のキーと値はすべて文字列で
     、キーは対応する値に置換されます。'entities' が与えられている場合で
     も、 ‘'&'’, ‘'<'’, ‘'>'’ は常にエスケープされます。

          注釈: この関数は、 XML 内で直接使用できない文字のエスケープに
          のみ使用するべきです。この関数を一般的な文字列変換関数のように
          使用してはなりません。

 -- の関数: xml.sax.saxutils.unescape (data, entities={})

     エスケープされた文字列 ‘'&amp;'’, ‘'&lt;'’, ‘'&gt;'’ を元の文字に戻
     します。

     You can unescape other strings of data by passing a dictionary as
     the optional 'entities' parameter.  The keys and values must all be
     strings; each key will be replaced with its corresponding value.
     ‘'&amp;'’, ‘'&lt;'’, and ‘'&gt;'’ are always unescaped, even if
     'entities' is provided.

 -- の関数: xml.sax.saxutils.quoteattr (data, entities={})

     *note escape(): 3e19. に似ていますが、 'data' は属性値の作成に使わ
     れます。戻り値はクォート済みの 'data' で、置換する文字の追加も可能
     です。 *note quoteattr(): 3e1b. はクォートすべき文字を 'data' の文
     脈から判断し、クォートすべき文字を残さないように文字列をエンコード
     します。 'data' の中にシングル・クォート、ダブル・クォートがあれば
     、両方ともエンコードし、全体をダブルクォートで囲みます。戻り値の文
     字列はそのままで属性値として利用できます:

          >>> print("<element attr=%s>" % quoteattr("ab ' cd \" ef"))
          <element attr="ab ' cd &quot; ef">

     この関数は参照具象構文を使って、 HTML や SGML の属性値を生成するの
     に便利です。

 -- クラス: xml.sax.saxutils.XMLGenerator (out=None,
          encoding='iso-8859-1', short_empty_elements=False)

     このクラスは SAX イベントを XML 文書に書き戻すことで *note
     ContentHandler: 3dcd. インターフェースを実装しています。 つまり、
     *note XMLGenerator: 3e1c. をコンテントハンドラとして用いることで、
     パースしている元々の文書を複製することが出来ます。 'out' にはファイ
     ル様オブジェクトでなければなりません。 デフォルトは 'sys.stdout' で
     す。 'encoding' は出力ストリームのエンコーディングで、デフォルトは
     ‘'iso-8859-1'’ です。 'short_empty_elements' は 内容を持たない要素
     のフォーマットを制御します。 ‘False’ (デフォルト) の場合、開始/終了
     タグのペアとなり、 ‘True’ の場合、1つの空タグになります。

     バージョン 3.2 で変更: 'short_empty_elements' 引数を追加しました。

 -- クラス: xml.sax.saxutils.XMLFilterBase (base)

     このクラスは *note XMLReader: 3dd0. とクライアント・アプリケーショ
     ンのイベント・ハンドラとの間に位置するものとして設計されています。
     デフォルトでは何もせず、ただリクエストをリーダに、イベントをハンド
     ラに、それぞれ加工せず渡すだけです。しかし、サブクラスでメソッドを
     オーバーライドすると、イベント・ストリームやリクエストを加工してか
     ら渡すように変更可能です。

 -- の関数: xml.sax.saxutils.prepare_input_source (source, base='')

     この関数は引数に入力ソース、オプションとして URL を取り、読み取り可
     能な解決済み *note InputSource: 109b. オブジェクトを返します。入力
     ソースは文字列、ファイル風オブジェクト、 *note InputSource: 109b. の
     いずれでも良く、この関数を使うことで、パーサは様々な 'source' 引数
     を *note parse(): 3e1f. メソッドに実装することが可能になります。

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/xml/sax/saxutils.py


File: python.info,  Node: xml sax xmlreader --- XML パーサーのインターフェース,  Next: xml parsers expat --- Expat を使用した高速な XML 解析,  Prev: xml sax saxutils --- SAX ユーティリティー,  Up: 構造化マークアップツール

5.21.12 ‘xml.sax.xmlreader’ -- XML パーサーのインターフェース
-------------------------------------------------------------

'ソースコード:' Lib/xml/sax/xmlreader.py(1)

__________________________________________________________________

各 SAX パーサは Python モジュールとして *note XMLReader: 3dd0. インター
フェースを実装しており、関数 ‘create_parser()’ を提供しています。この関
数は新たなパーサ・オブジェクトを生成する際、 *note
xml.sax.make_parser(): 1e1c. から引数なしで呼び出されます。

 -- クラス: xml.sax.xmlreader.XMLReader

     SAX パーサが継承可能な基底クラスです。

 -- クラス: xml.sax.xmlreader.IncrementalParser

     入力ソースを一度にパースするのではなく、ドキュメントのチャンクが利
     用可能になるごとに取得したいことがあります。SAX リーダは通常、ファ
     イル全体を一気に読み込まず、チャンク単位で処理するのですが、全体の
     処理が終わるまで ‘parse()’ は返りません。そのため、 ‘parse()’ の排
     他的挙動を望まないときにこれらのインターフェースを使用してください
     。

     パーサのインスタンスが作成されるとすぐに、feed メソッドを通じてデー
     タを受け入れられるようになります。パースが完了して閉じるための呼び
     出しが行われた後、パーサがフィードからまたはパースメソッドを使用し
     て新しいデータを受け入れられるように、reset メソッドが呼び出される
     必要があります。

     これらのメソッドをパース処理の途中で呼び出すことはできません。つま
     り、パースが実行された後で、パーサから return する前に呼び出す必要
     があるのです。

     デフォルトでは、SAX 2.0 ドライバを書く人のために、このクラスは
     IncrementalParser の feed、close、reset メソッドを使って XMLReader
     インターフェースの parse メソッドを実装しています。

 -- クラス: xml.sax.xmlreader.Locator

     SAX イベントと文書の位置を関連付けるインターフェースです。locator オ
     ブジェクトは DocumentHandler メソッドを呼び出している間だけ正しい結
     果を返し、それ以外とのときは、予測できない結果を返します。情報を利
     用できない場合、メソッドは ‘None’ を返すこともあります。

 -- クラス: xml.sax.xmlreader.InputSource (system_id=None)

     *note XMLReader: 3dd0. がエンティティを読み込むために必要な情報をカ
     プセル化します。

     このクラスには公開識別子、システム識別子、(場合によっては文字エンコ
     ーディング情報を含む) バイト・ストリーム、そしてエンティティの文字
     ストリームなどの情報が含まれます。

     アプリケーションは *note XMLReader.parse(): 3e1f. メソッドでの使用
     や EntityResolver.resolveEntity の戻り値としてこのオブジェトを作成
     します。

     *note InputSource: 109b. はアプリケーションに属します。 *note
     XMLReader: 3dd0. はアプリケーションから渡された *note InputSource:
     109b. オブジェクトの変更を許可されていませんが、コピーを作ってそれ
     を変更することは可能です。

 -- クラス: xml.sax.xmlreader.AttributesImpl (attrs)

     ‘Attributes’ インターフェース (*note Attributes インターフェース:
     3dfc. 参照) の実装です。これは辞書風のオブジェクトで、
     ‘startElement()’ 内で要素の属性を表示します。最も有用な辞書操作に加
     え、インターフェースに記述されているメソッドを多数サポートしていま
     す。このクラスのオブジェクトはリーダによってインスタンス化されなけ
     ればなりません。'attrs' は属性名と属性値の対応付けを含む辞書風オブ
     ジェクトでなければなりません。

 -- クラス: xml.sax.xmlreader.AttributesNSImpl (attrs, qnames)

     *note AttributesImpl: 3e24. を名前空間認識型に改良したクラスで、
     ‘startElementNS()’ に渡されます。 *note AttributesImpl: 3e24. の派
     生クラスですが、 'namespaceURI' と 'localname' の2要素のタプルを解
     釈します。さらに、元の文書に出てくる修飾名を返す多くのメソッドを提
     供します。このクラスは ‘AttributesNS’ インターフェース (*note
     AttributesNS インターフェース: 3dfe. 参照) の実装です。

* Menu:

* XMLReader オブジェクト::
* IncrementalParser オブジェクト::
* Locator オブジェクト::
* InputSource オブジェクト::
* Attributes インターフェース::
* AttributesNS インターフェース::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/xml/sax/xmlreader.py


File: python.info,  Node: XMLReader オブジェクト,  Next: IncrementalParser オブジェクト,  Up: xml sax xmlreader --- XML パーサーのインターフェース

5.21.12.1 XMLReader オブジェクト
................................

*note XMLReader: 3dd0. は次のメソッドをサポートします:

 -- メソッド: XMLReader.parse (source)

     入力ソースを処理し、SAX イベントを作成します。 'source' オブジェク
     トはシステム識別子 (入力ソースを特定する文字列 - 一般にファイル名や
     URL)、 *note pathlib.Path: 266. オブジェクトか *note path-like:
     5a1. オブジェクトまたは *note InputSource: 109b. オブジェクトです。
     *note parse(): 3e1f. が return したとき、入力データの処理は完了し、
     パーサ・オブジェクトは破棄ないしリセットされます。

     バージョン 3.5 で変更: 文字ストリームがサポートされました。

     バージョン 3.8 で変更: path-like オブジェクトのサポートが追加されま
     した。

 -- メソッド: XMLReader.getContentHandler ()

     現在の *note ContentHandler: 3dcd. を返します。

 -- メソッド: XMLReader.setContentHandler (handler)

     現在の *note ContentHandler: 3dcd. を設定します。 *note
     ContentHandler: 3dcd. が設定されていない場合、内容イベントは破棄さ
     れます。

 -- メソッド: XMLReader.getDTDHandler ()

     現在の *note DTDHandler: 3de8. を返します。

 -- メソッド: XMLReader.setDTDHandler (handler)

     現在の *note DTDHandler: 3de8. を返します。 *note DTDHandler: 3de8.
     が設定されていな場合、DTD イベントは破棄されます。

 -- メソッド: XMLReader.getEntityResolver ()

     現在の *note EntityResolver: 3de9. を返します。

 -- メソッド: XMLReader.setEntityResolver (handler)

     現在の *note EntityResolver: 3de9. を返します。 *note
     EntityResolver: 3de9. が設定されていない場合、外部エンティティの解
     決を試行することでエンティティのシステム識別子が開かれます。利用で
     きない場合は失敗します。

 -- メソッド: XMLReader.getErrorHandler ()

     現在の *note ErrorHandler: 3ddb. を返します。

 -- メソッド: XMLReader.setErrorHandler (handler)

     現在のエラーハンドラを設定します。*note ErrorHandler: 3ddb. が設定
     されていない場合、エラーが例外として送出され、警告が表示されます。

 -- メソッド: XMLReader.setLocale (locale)

     アプリケーションにエラーや警告のロケール設定を許可します。

     SAX パーサにとって、エラーや警告の地域化は必須ではありません。しか
     し、パーサが要求されたロケールをサポートしていない場合、SAX 例外を
     送出しなければなりません。アプリケーションはパースの途中でロケール
     の変更を要求することができます。

 -- メソッド: XMLReader.getFeature (featurename)

     機能 'featurename' の現在の設定を返します。その機能が認識できないと
     きは、 ‘SAXNotRecognizedException’ を送出します。有名な機能名はモジ
     ュール *note xml.sax.handler: 130. に列挙されています。

 -- メソッド: XMLReader.setFeature (featurename, value)

     機能名 'featurename' に値 'value' を設定します。その機能が認識でき
     ないときは、 ‘SAXNotRecognizedException’ を送出します。また、パーサ
     が指定された機能や設定をサポートしていないときは、
     ‘SAXNotSupportedException’ を送出します。

 -- メソッド: XMLReader.getProperty (propertyname)

     属性名 'propertyname' の現在の値を返します。その属性が認識できない
     ときは、 ‘SAXNotRecognizedException’ を送出します。有名な属性名はモ
     ジュール *note xml.sax.handler: 130. に列挙されています。

 -- メソッド: XMLReader.setProperty (propertyname, value)

     属性名 'propertyname' に値 'value' を設定します。その機能が認識でき
     ないときは、 ‘SAXNotRecognizedException’ を送出します。また、パーサ
     が指定された機能や設定をサポートしていないときは、
     ‘SAXNotSupportedException’ を送出します。


File: python.info,  Node: IncrementalParser オブジェクト,  Next: Locator オブジェクト,  Prev: XMLReader オブジェクト,  Up: xml sax xmlreader --- XML パーサーのインターフェース

5.21.12.2 IncrementalParser オブジェクト
........................................

*note IncrementalParser: 3e23. のインスタンスは次の追加メソッドを提供し
ます:

 -- メソッド: IncrementalParser.feed (data)

     'data' のチャンクを処理します。

 -- メソッド: IncrementalParser.close ()

     文書の終端を決定します。文書の適格性を調べ (終端でのみ可能)、ハンド
     ラを起動し、パース時に割り当てた資源を解放します。

 -- メソッド: IncrementalParser.reset ()

     このメソッドは close が呼び出された後、新しい文書をパースできるよう
     に、パーサをリセットするのに呼び出されます。close 後 reset を呼び出
     さずに parse や feed を呼び出した場合の戻り値は未定義です。


File: python.info,  Node: Locator オブジェクト,  Next: InputSource オブジェクト,  Prev: IncrementalParser オブジェクト,  Up: xml sax xmlreader --- XML パーサーのインターフェース

5.21.12.3 Locator オブジェクト
..............................

*note Locator: 3ddd. のインスタンスは次のメソッドを提供します:

 -- メソッド: Locator.getColumnNumber ()

     現在のイベントが開始する列番号を返します。

 -- メソッド: Locator.getLineNumber ()

     現在のイベントが開始する行番号を返します。

 -- メソッド: Locator.getPublicId ()

     現在の文書イベントの公開識別子を返します。

 -- メソッド: Locator.getSystemId ()

     現在のイベントのシステム識別子を返します。


File: python.info,  Node: InputSource オブジェクト,  Next: Attributes インターフェース,  Prev: Locator オブジェクト,  Up: xml sax xmlreader --- XML パーサーのインターフェース

5.21.12.4 InputSource オブジェクト
..................................

 -- メソッド: InputSource.setPublicId (id)

     この *note InputSource: 109b. の公開識別子を設定します。

 -- メソッド: InputSource.getPublicId ()

     この *note InputSource: 109b. の公開識別子を返します。

 -- メソッド: InputSource.setSystemId (id)

     この *note InputSource: 109b. のシステム識別子を設定します。

 -- メソッド: InputSource.getSystemId ()

     この *note InputSource: 109b. のシステム識別子を返します。

 -- メソッド: InputSource.setEncoding (encoding)

     この *note InputSource: 109b. の文字エンコーディングを設定します。

     エンコーディングは XML エンコーディング宣言として受け入れられる文字
     列でなければなりません (XML 勧告の 4.3.3 節を参照)。

     *note InputSource: 109b. も文字ストリームを含んでいた場合、*note
     InputSource: 109b. のエンコーディング属性は無視されます。

 -- メソッド: InputSource.getEncoding ()

     この InputSource の文字エンコーディングを取得します。

 -- メソッド: InputSource.setByteStream (bytefile)

     この入力ソースのバイトストリーム (*note binary file: 206e.) を設定
     します。

     文字ストリームも指定されている場合、SAX パーサはこのバイトストリー
     ムを無視しますが、URI 接続自体を開くときには優先してバイトストリー
     ムを使います。

     アプリケーションがバイトストリームの文字エンコーディングを知ってい
     る場合は、setEncoding メソッドで設定する必要があります。

 -- メソッド: InputSource.getByteStream ()

     この入力ソースのバイトストリームを取得します。

     getEncoding メソッドは、このバイトストリームの文字エンコーディング
     を返します。不明なときは ‘None’ を返します。

 -- メソッド: InputSource.setCharacterStream (charfile)

     この入力ソースの文字ストリーム (*note text file: 206d.) を設定しま
     す。

     文字ストリームが指定された場合、SAX パーサは全バイトストリームを無
     視し、システム識別子への URI 接続の開始を試みません。

 -- メソッド: InputSource.getCharacterStream ()

     この入力ソースの文字ストリームを取得します。


File: python.info,  Node: Attributes インターフェース,  Next: AttributesNS インターフェース,  Prev: InputSource オブジェクト,  Up: xml sax xmlreader --- XML パーサーのインターフェース

5.21.12.5 ‘Attributes’ インターフェース
.......................................

‘Attributes’ オブジェクトは ‘copy()’、‘get()’、*note __contains__():
15d3.、‘items()’、‘keys()’、‘values()’ を含む *note
マッピングプロトコル: 13d3. の一部を実装しています。以下のメソッドも提供
されています:

 -- メソッド: Attributes.getLength ()

     属性の数を返します。

 -- メソッド: Attributes.getNames ()

     属性の名前を返します。

 -- メソッド: Attributes.getType (name)

     属性名 'name' のタイプを返します。通常は ‘'CDATA'’ です。

 -- メソッド: Attributes.getValue (name)

     属性 'name' の値を返します。


File: python.info,  Node: AttributesNS インターフェース,  Prev: Attributes インターフェース,  Up: xml sax xmlreader --- XML パーサーのインターフェース

5.21.12.6 ‘AttributesNS’ インターフェース
.........................................

このインターフェースは ‘Attributes’ インターフェース (*note Attributes
インターフェース: 3dfc. 参照) のサブタイプです。 Attributes インターフェ
ースがサポートしているすべてのメソッドは ‘AttributesNS’ オブジェクトでも
利用可能です。

次のメソッドもサポートされています:

 -- メソッド: AttributesNS.getValueByQName (name)

     修飾名の値を返します。

 -- メソッド: AttributesNS.getNameByQName (name)

     修飾名 'name' に対応する ‘(namespace, localname)’ のペアを返します
     。

 -- メソッド: AttributesNS.getQNameByName (name)

     ‘(namespace, localname)’ のペアに対応する修飾名を返します。

 -- メソッド: AttributesNS.getQNames ()

     すべての属性の修飾名を返します。


File: python.info,  Node: xml parsers expat --- Expat を使用した高速な XML 解析,  Prev: xml sax xmlreader --- XML パーサーのインターフェース,  Up: 構造化マークアップツール

5.21.13 ‘xml.parsers.expat’ -- Expat を使用した高速な XML 解析
--------------------------------------------------------------

__________________________________________________________________

     注釈: If you need to parse untrusted or unauthenticated data, see
     *note XML security: 3ce9.

The ‘xml.parsers.expat’ module is a Python interface to the Expat
non-validating XML parser.  The module provides a single extension type,
‘xmlparser’, that represents the current state of an XML parser.  After
an ‘xmlparser’ object has been created, various attributes of the object
can be set to handler functions.  When an XML document is then fed to
the parser, the handler functions are called for the character data and
markup in the XML document.

このモジュールでは、Expatパーザへのアクセスを提供するために ‘pyexpat’ モ
ジュールを使用します。 ‘pyexpat’ モジュールの直接使用は撤廃されています
。

このモジュールは、例外を一つと型オブジェクトを一つ提供しています:

 -- 例外: xml.parsers.expat.ExpatError

     Expat がエラーを報告したときに例外を送出します。 Expatのエラーを解
     釈する上での詳細な情報は、 *note ExpatError 例外: 3e58. を参照して
     ください。

 -- 例外: xml.parsers.expat.error

     *note ExpatError: 1490. の別名です。

 -- データ: xml.parsers.expat.XMLParserType

     *note ParserCreate(): 3e5b. 関数から返された戻り値の型を示します。

The ‘xml.parsers.expat’ module contains two functions:

 -- の関数: xml.parsers.expat.ErrorString (errno)

     与えられたエラー番号 'errno' を解説する文字列を返します。

 -- の関数: xml.parsers.expat.ParserCreate (encoding=None,
          namespace_separator=None)

     新しい ‘xmlparser’ オブジェクトを作成し、返します。 'encoding' が指
     定されていた場合、XMLデータで使われている文字列のエンコード名でなけ
     ればなりません。 Expatは、Pythonのように多くのエンコードをサポート
     しておらず、またエンコーディングのレパートリを拡張することはできま
     せん; サポートするエンコードは、UTF-8, UTF-16, ISO-8859-1 (Latin1),
     ASCII です。 'encoding' (1) が指定されると、文書に対する明示的、非
     明示的なエンコード指定を上書き (override) します。 Parsers created
     through ‘ParserCreate()’ are called "root" parsers, in the sense
     that they do not have any parent parser attached.  Non-root parsers
     are created by *note parser.ExternalEntityParserCreate: 17ee.

     Expat はオプションで XML 名前空間の処理を行うことができます。これは
     引数 'namespace_separator' に値を指定することで有効になります。この
     値は、1文字の文字列でなければなりません; 文字列が誤った長さを持つ場
     合には *note ValueError: 2ec. が送出されます (‘None’ は値の省略と見
     なされます)。名前空間の処理が可能なとき、名前空間に属する要素と属性
     が展開されます。要素のハンドラである ‘StartElementHandler’ と
     ‘EndElementHandler’ に渡された要素名は、名前空間の URI、名前空間の
     区切り文字、要素名のローカル部を連結したものになります。名前空間の
     区切り文字が 0 バイト (‘chr(0)’) の場合、名前空間の URI とローカル
     部は区切り文字なしで連結されます。

     たとえば、'namespace_separator' に空白文字(‘' '’)がセットされ、次の
     ような文書が解析されるとします:

          <?xml version="1.0"?>
          <root xmlns    = "http://default-namespace.org/"
                xmlns:py = "http://www.python.org/ns/">
            <py:elem1 />
            <elem2 xmlns="" />
          </root>

     ‘StartElementHandler’ は各要素ごとに次のような文字列を受け取ります:

          http://default-namespace.org/ root
          http://www.python.org/ns/ elem1
          elem2

     ‘pyexpat’ が使っている ‘Expat’ ライブラリの制限により、返される
     ‘xmlparser’ インスタンスは単独の XML ドキュメントの解析にしか使えま
     せん。それぞれのドキュメントごとに別々のパーサのインスタンスを作る
     ために ‘ParserCreate’ を呼び出してください。

参考
....

The Expat XML Parser(2)

     Expatプロジェクトのホームページ。

* Menu:

* XMLParser オブジェクト: XMLParser オブジェクト<2>.
* ExpatError 例外::
* 使用例: 使用例<35>.
* 内容モデルの記述::
* Expat エラー定数::

   ---------- Footnotes ----------

   (1) XML 出力に含まれるエンコーディング文字列は適切な規格に従っていな
ければなりません。例えば、 "UTF-8" は有効ですが、 "UTF8" はそうではあり
ません。‘https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl’
と
‘https://www.iana.org/assignments/character-sets/character-sets.xhtml’ を
参照してください。

   (2) http://www.libexpat.org/


File: python.info,  Node: XMLParser オブジェクト<2>,  Next: ExpatError 例外,  Up: xml parsers expat --- Expat を使用した高速な XML 解析

5.21.13.1 XMLParser オブジェクト
................................

‘xmlparser’ オブジェクトは以下のようなメソッドを持ちます:

 -- メソッド: xmlparser.Parse (data[, isfinal])

     文字列 'data' の内容を解析し、解析されたデータを処理するための適切
     な関数を呼び出します。このメソッドを最後に呼び出す時は 'isfinal' を
     真にしなければなりません; 単体ファイルを細切れに渡して解析出来るこ
     とを意味しますが、複数ファイルは扱えません。 'data' にはいつでも空
     の文字列を渡せます。

 -- メソッド: xmlparser.ParseFile (file)

     'file' オブジェクトから読み込んだXMLデータを解析します。 'file' に
     は ‘read(nbytes)’ メソッドのみが必要です。このメソッドはデータがな
     くなった場合に空文字列を返さねばなりません。。

 -- メソッド: xmlparser.SetBase (base)

     (XML) 宣言中のシステム識別子中の相対 URI を解決するための、基底 URI
     を設定します。相対識別子の解決はアプリケーションに任されます: この
     値は関数 *note ExternalEntityRefHandler(): 3e62. や *note
     NotationDeclHandler(): 3e63, *note UnparsedEntityDeclHandler():
     3e64. に引数 'base' としてそのまま渡されます。

 -- メソッド: xmlparser.GetBase ()

     以前の *note SetBase(): 3e61. によって設定された基底 URI を文字列の
     形で返します。 *note SetBase(): 3e61. が呼ばれていないときには
     ‘None’ を返します。

 -- メソッド: xmlparser.GetInputContext ()

     現在のイベントを発生させた入力データを文字列として返します。データ
     はテキストの入っているエンティティが持っているエンコードになります
     。イベントハンドラがアクティブでないときに呼ばれると、戻り値は
     ‘None’ となります。

 -- メソッド: xmlparser.ExternalEntityParserCreate (context[, encoding])

     親となるパーザで解析された内容が参照している、外部で解析されるエン
     ティティを解析するために使える "子の" パーザを作成します。
     'context' パラメータは、以下に記すように *note
     ExternalEntityRefHandler(): 3e62. ハンドラ関数に渡される文字列でな
     ければなりません。子のパーザは *note ordered_attributes: 3e67,
     *note specified_attributes: 3e68. が現在のパーザの値に設定されて生
     成されます。

 -- メソッド: xmlparser.SetParamEntityParsing (flag)

     パラメータエンティティ (外部DTDサブセットを含む) の解析を制御します
     。 'flag' の有効な値は、 ‘XML_PARAM_ENTITY_PARSING_NEVER’,
     ‘XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE’,
     ‘XML_PARAM_ENTITY_PARSING_ALWAYS’ です。 flag の設定をしたら true を
     返します。

 -- メソッド: xmlparser.UseForeignDTD ([flag])

     'flag' の値をデフォルトのtrueにすると、Expatは代わりのDTDをロードす
     るため、すべての引数に *note None: 885. を設定して *note
     ExternalEntityRefHandler: 3e62. を呼び出します。XML文書が文書型定義
     を持っていなければ、 *note ExternalEntityRefHandler: 3e62. が呼び出
     しますが、 *note StartDoctypeDeclHandler: 3e6b. と *note
     EndDoctypeDeclHandler: 3e6c. は呼び出されません。

     'flag' にfalseを与えると、メソッドが前回呼ばれた時のtrueの設定が解
     除されますが、他には何も起こりません。

     このメソッドは *note Parse(): 3e5f. または *note ParseFile(): 3e60.
     メソッドが呼び出される前にだけ呼び出されます;これら2つのメソッドの
     どちらかが呼び出されたあとにメソッドが呼ばれると、 *note code: 1b.
     に定数
     ‘errors.codes[errors.XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING]’ が
     設定されて例外 *note ExpatError: 1490. が送出されます。

 -- メソッド: xmlparser.SetReparseDeferralEnabled (enabled)

          警告: Calling ‘SetReparseDeferralEnabled(False)’ has security
          implications, as detailed below; please make sure to
          understand these consequences prior to using the
          ‘SetReparseDeferralEnabled’ method.

     Expat 2.6.0 introduced a security mechanism called "reparse
     deferral" where instead of causing denial of service through
     quadratic runtime from reparsing large tokens, reparsing of
     unfinished tokens is now delayed by default until a sufficient
     amount of input is reached.  Due to this delay, registered handlers
     may — depending of the sizing of input chunks pushed to Expat — no
     longer be called right after pushing new input to the parser.
     Where immediate feedback and taking over responsibility of
     protecting against denial of service from large tokens are both
     wanted, calling ‘SetReparseDeferralEnabled(False)’ disables reparse
     deferral for the current Expat parser instance, temporarily or
     altogether.  Calling ‘SetReparseDeferralEnabled(True)’ allows
     re-enabling reparse deferral.

     Note that *note SetReparseDeferralEnabled(): 579. has been
     backported to some prior releases of CPython as a security fix.
     Check for availability of *note SetReparseDeferralEnabled(): 579.
     using *note hasattr(): 6f9. if used in code running across a
     variety of Python versions.

     Added in version 3.13.

 -- メソッド: xmlparser.GetReparseDeferralEnabled ()

     Returns whether reparse deferral is currently enabled for the given
     Expat parser instance.

     Added in version 3.13.

‘xmlparser’ objects have the following methods to mitigate some common
XML vulnerabilities.

 -- メソッド: xmlparser.SetAllocTrackerActivationThreshold (threshold,
          /)

     Sets the number of allocated bytes of dynamic memory needed to
     activate protection against disproportionate use of RAM.

     By default, parser objects have an allocation activation threshold
     of 64 MiB, or equivalently 67,108,864 bytes.

     An *note ExpatError: 1490. is raised if this method is called on a
     *note non-root: 3e5d. parser.  The corresponding *note lineno:
     3e6d. and *note offset: 3e6e. should not be used as they may have
     no special meaning.

     Added in version 3.14.1.

 -- メソッド: xmlparser.SetAllocTrackerMaximumAmplification (max_factor,
          /)

     Sets the maximum amplification factor between direct input and
     bytes of dynamic memory allocated.

     The amplification factor is calculated as ‘allocated / direct’
     while parsing, where ‘direct’ is the number of bytes read from the
     primary document in parsing and ‘allocated’ is the number of bytes
     of dynamic memory allocated in the parser hierarchy.

     The 'max_factor' value must be a non-NaN *note float: 196. value
     greater than or equal to 1.0.  Amplification factors greater than
     100.0 can be observed near the start of parsing even with benign
     files in practice.  In particular, the activation threshold should
     be carefully chosen to avoid false positives.

     By default, parser objects have a maximum amplification factor of
     100.0.

     An *note ExpatError: 1490. is raised if this method is called on a
     *note non-root: 3e5d. parser or if 'max_factor' is outside the
     valid range.  The corresponding *note lineno: 3e6d. and *note
     offset: 3e6e. should not be used as they may have no special
     meaning.

          注釈: The maximum amplification factor is only considered if
          the threshold that can be adjusted by *note
          SetAllocTrackerActivationThreshold(): 17b9. is exceeded.

     Added in version 3.14.1.

‘xmlparser’ オブジェクトは次のような属性を持ちます:

 -- の属性: xmlparser.buffer_size

     *note buffer_text: 16db. が真の時に使われるバッファのサイズです。こ
     の属性に新しい整数値を代入することで違うバッファサイズにできます。
     サイズが変えられるときにバッファはフラッシュされます。

 -- の属性: xmlparser.buffer_text

     Setting this to true causes the ‘xmlparser’ object to buffer
     textual content returned by Expat to avoid multiple calls to the
     *note CharacterDataHandler(): 3e70. callback whenever possible.
     This can improve performance substantially since Expat normally
     breaks character data into chunks at every line ending.  This
     attribute is false by default, and may be changed at any time.
     Note that when it is false, data that does not contain newlines may
     be chunked too.

 -- の属性: xmlparser.buffer_used

     *note buffer_text: 16db. が利用可能なとき、バッファに保持されたバイ
     ト数です。これらのバイトはUTF-8でエンコードされたテキストを表します
     。この属性は *note buffer_text: 16db. が偽の時には意味がありません
     。

 -- の属性: xmlparser.ordered_attributes

     この属性をゼロ以外の整数にすると、報告される(XMLノードの) 属性を辞
     書型ではなくリスト型にします。属性は文書のテキスト中の出現順で示さ
     れます。それぞれの属性は、2つのリストのエントリ: 属性名とその値、が
     与えられます。 (このモジュールの古いバージョンでも、同じフォーマッ
     トが使われています。) デフォルトでは、この属性はデフォルトでは偽と
     なりますが、いつでも変更可能です。

 -- の属性: xmlparser.specified_attributes

     ゼロ以外の整数にすると、パーザは文書のインスタンスで特定される属性
     だけを報告し、属性宣言から導出された属性は報告しないようになります
     。この属性が指定されたアプリケーションでは、XMLプロセッサの振る舞い
     に関する標準に従うために必要とされる (文書型) 宣言によって、どのよ
     うな付加情報が利用できるのかということについて特に注意を払わなけれ
     ばなりません。デフォルトで、この属性は偽となりますが、いつでも変更
     可能です。

以下の属性には、 ‘xmlparser’ オブジェクトで最も最近に起きたエラーに関す
る値が入っており、また ‘Parse()’ または ‘ParseFile()’ メソッドが *note
xml.parsers.expat.ExpatError: 1490. 例外を送出した際にのみ正しい値となり
ます。

 -- の属性: xmlparser.ErrorByteIndex

     エラーが発生したバイトのインデクスです。

 -- の属性: xmlparser.ErrorCode

     エラーを特定する数値によるコードです。この値は *note ErrorString():
     3e5c. に渡したり、 ‘errors’ オブジェクトで定義された内容と比較でき
     ます。

 -- の属性: xmlparser.ErrorColumnNumber

     エラーの発生したカラム番号です。

 -- の属性: xmlparser.ErrorLineNumber

     エラーの発生した行番号です。

以下の属性は ‘xmlparser’ オブジェクトがその時パースしている位置に関する
値を保持しています。コールバックがパースイベントを報告している間、これら
の値はイベントの生成した文字列の先頭の位置を指し示します。コールバックの
外から参照された時には、（対応するコールバックであるかにかかわらず）直前
のパースイベントの位置を示します。

 -- の属性: xmlparser.CurrentByteIndex

     パーサへの入力の、現在のバイトインデックス。

 -- の属性: xmlparser.CurrentColumnNumber

     パーサへの入力の、現在のカラム番号。

 -- の属性: xmlparser.CurrentLineNumber

     パーサへの入力の、現在の行番号。

以下に指定可能なハンドラのリストを示します。 ‘xmlparser’ オブジェクト
'o' にハンドラを指定するには、 ‘o.handlername = func’ を使用します。
'handlername' は、以下のリストに挙げた値をとらなければならず、また
'func' は正しい数の引数を受理する呼び出し可能なオブジェクトでなければな
りません。引数は特に明記しない限り、すべて文字列となります。

 -- メソッド: xmlparser.XmlDeclHandler (version, encoding, standalone)

     XML 宣言が解析された時に呼ばれます。 XML宣言は XML 勧告の適用バージ
     ョン、文書テクストのエンコード、ならびに任意の "standalone" 宣言の
     (任意の) 宣言です。 'version' と 'encoding' は文字列で、
     'standalone' は文書がスタンドアローンと宣言された場合は ‘1’、スタン
     ドアローンでないと宣言された場合は ‘0’、スタンドアローン節がない場
     合は ‘-1’ です。 Expat のバージョン 1.95.0 以降でのみ使用できます。

 -- メソッド: xmlparser.StartDoctypeDeclHandler (doctypeName, systemId,
          publicId, has_internal_subset)

     Called when Expat begins parsing the document type declaration
     (‘<!DOCTYPE ...’).  The 'doctypeName' is provided exactly as
     presented.  The 'systemId' and 'publicId' parameters give the
     system and public identifiers if specified, or ‘None’ if omitted.
     'has_internal_subset' will be true if the document contains an
     internal document declaration subset.  This requires Expat version
     1.2 or newer.

 -- メソッド: xmlparser.EndDoctypeDeclHandler ()

     Expatが文書型宣言の解析を終えたときに呼び出されます。このハンドラに
     は、Expat version 1.2以上が必要です。

 -- メソッド: xmlparser.ElementDeclHandler (name, model)

     それぞれの要素型宣言ごとに呼び出されます。 'name' は要素型の名前で
     あり、 'model' は内容モデル (content model) の表現です。

 -- メソッド: xmlparser.AttlistDeclHandler (elname, attname, type,
          default, required)

     ひとつの要素型で宣言される属性ごとに呼び出されます。属性リストの宣
     言が 3つの属性を宣言したとすると、このハンドラは各属性に1度ずつ、
     3度呼び出されます。 'elname' は要素名であり、これに対して宣言が適用
     され、 'attname' が宣言された属性名となります。属性型は文字列で、
     'type' として渡されます。取り得る値は、 ‘'CDATA'’, ‘'ID'’,
     ‘'IDREF'’, ...  です。 'default' は、文書のインスタンスによって属性
     が指定されていないときに使用されるデフォルト値です。デフォルト値
     (‘#IMPLIED’ values)が存在しないときには ‘None’ を与えます。文書のイ
     ンスタンス中に属性値を与える必要のあるときには 'required' が true に
     なります。これにはExpat version 1.95.0 以上が必要です。

 -- メソッド: xmlparser.StartElementHandler (name, attributes)

     要素の開始ごとに呼び出されます。 'name' は要素名を持つ文字列で、
     'attributes' は要素の属性です。 *note ordered_attributes: 3e67. が
     真の場合これはリストです (詳細は *note ordered_attributes: 3e67. を
     参照してください)。 そうでなければ名前を値に対応させる辞書です。

 -- メソッド: xmlparser.EndElementHandler (name)

     要素の終端を処理するごとに呼び出されます。

 -- メソッド: xmlparser.ProcessingInstructionHandler (target, data)

     処理命令を処理するごとに呼び出されます。

 -- メソッド: xmlparser.CharacterDataHandler (data)

     Called for character data.  This will be called for normal
     character data, CDATA marked content, and ignorable whitespace.
     Applications which must distinguish these cases can use the *note
     StartCdataSectionHandler: 3e7e, *note EndCdataSectionHandler: 3e7f,
     and *note ElementDeclHandler: 17b4. callbacks to collect the
     required information.  Note that the character data may be chunked
     even if it is short and so you may receive more than one call to
     *note CharacterDataHandler(): 3e70.  Set the *note buffer_text:
     16db. instance attribute to ‘True’ to avoid that.

 -- メソッド: xmlparser.UnparsedEntityDeclHandler (entityName, base,
          systemId, publicId, notationName)

     解析されていない (NDATA) エンティティ宣言を処理するために呼び出され
     ます。このハンドラは Expat ライブラリのバージョン1.2のためだけに存
     在します; より最近のバージョンでは、代わりに *note
     EntityDeclHandler: 3e80. を使用してください (根底にある Expat ライ
     ブラリ内の関数は、撤廃されたものであると宣言されています)。

 -- メソッド: xmlparser.EntityDeclHandler (entityName,
          is_parameter_entity, value, base, systemId, publicId,
          notationName)

     エンティティ宣言ごとに呼び出されます。パラメタと内部エンティティに
     ついて、 'value' はエンティティ宣言の宣言済みの内容を与える文字列と
     なります; 外部エンティティの時には ‘None’ となります。解析済みエン
     ティティの場合、 'notationName' パラメタは ‘None’ となり、解析され
     ていないエンティティの時には記法 (notation) 名となります。
     'is_parameter_entity' は、エンティティがパラメタエンティティの場合
     真に、一般エンティティ (general entitiy) の場合には偽になります (ほ
     とんどのアプリケーションでは、一般エンティティのことしか気にする必
     要がありません)。このハンドラは Expat ライブラリのバージョン1.95.0
     以降でのみ使用できます。

 -- メソッド: xmlparser.NotationDeclHandler (notationName, base,
          systemId, publicId)

     記法の宣言 (notation declaration) で呼び出されます。
     'notationName', 'base', 'systemId', および 'publicId' を与える場合
     、文字列にします。public な識別子が省略された場合、 'publicId' は
     ‘None’ になります。

 -- メソッド: xmlparser.StartNamespaceDeclHandler (prefix, uri)

     要素が名前空間宣言を含んでいる場合に呼び出されます。名前空間宣言は
     、宣言が配置されている要素に対して *note StartElementHandler: 3e7b.
     が呼び出される前に処理されます。

 -- メソッド: xmlparser.EndNamespaceDeclHandler (prefix)

     名前空間宣言を含んでいたエレメントの終了タグに到達したときに呼び出
     されます。このハンドラは、要素に関する名前空間宣言ごとに、 *note
     StartNamespaceDeclHandler: 3e81. とは逆の順番で一度だけ呼び出され、
     各名前空間宣言のスコープが開始されたことを示します。このハンドラは
     、要素が終了する際、対応する *note EndElementHandler: 3e7c. が呼ば
     れた後に呼び出されます。

 -- メソッド: xmlparser.CommentHandler (data)

     コメントで呼び出されます。 'data' はコメントのテキストで、先頭の
     '‘<!-’ ‘-’' と末尾の '‘-’ ‘->’' を除きます。

 -- メソッド: xmlparser.StartCdataSectionHandler ()

     CDATA セクションの開始時に呼び出されます。CDATA セクションの構文的
     な開始と終了位置を識別できるようにするには、このハンドラと *note
     EndCdataSectionHandler: 3e7f. が必要です。

 -- メソッド: xmlparser.EndCdataSectionHandler ()

     CDATA セクションの終了時に呼び出されます。

 -- メソッド: xmlparser.DefaultHandler (data)

     XML 文書中で、適用可能なハンドラが指定されていない文字すべてに対し
     て呼び出されます。この文字とは、検出されたことが報告されるが、ハン
     ドラは指定されていないようなコンストラクト (construct) の一部である
     文字を意味します。

 -- メソッド: xmlparser.DefaultHandlerExpand (data)

     *note DefaultHandler(): 3e84. と同じですが、内部エンティティの展開
     を禁止しません。エンティティ参照はデフォルトハンドラに渡されません
     。

 -- メソッド: xmlparser.NotStandaloneHandler ()

     XML 文書がスタンドアロンの文書として宣言されていない場合に呼び出さ
     れます。外部サブセットやパラメタエンティティへの参照が存在するが、
     XML 宣言が XML 宣言中で standalone 変数を ‘yes’ に設定していない場
     合に起きます。このハンドラが ‘0’ を返すと、パーザは
     ‘XML_ERROR_NOT_STANDALONE’ を発生させます。このハンドラが設定されて
     いなければ、パーザは前述の事態で例外を送出しません。

 -- メソッド: xmlparser.ExternalEntityRefHandler (context, base,
          systemId, publicId)

          警告: Implementing a handler that accesses local files and/or
          the network may create a vulnerability to external entity
          attacks(1) if ‘xmlparser’ is used with user-provided XML
          content.  Please reflect on your threat model(2) before
          implementing this handler.

     外部エンティティの参照時に呼び出されます。 'base' は現在の基底
     (base) で、以前の *note SetBase(): 3e61. で設定された値になっていま
     す。 public、および system の識別子である、 'systemId' と
     'publicId' が指定されている場合、値は文字列です; public 識別子が指
     定されていない場合、 'publicId' は ‘None’ になります。 'context' の
     値は不明瞭なものであり、以下に記述するようにしか使ってはなりません
     。

     外部エンティティが解析されるようにするには、このハンドラを実装しな
     ければなりません。このハンドラは、
     ‘ExternalEntityParserCreate(context)’ を使って適切なコールバックを
     指定し、子パーザを生成して、エンティティを解析する役割を担います。
     このハンドラは整数を返さなければなりません; ‘0’ を返した場合、パー
     ザは ‘XML_ERROR_EXTERNAL_ENTITY_HANDLING’ エラーを送出します。そう
     でない場合、解析を継続します。

     このハンドラが与えられておらず、 *note DefaultHandler: 3e84. コール
     バックが指定されていれば、外部エンティティは *note DefaultHandler:
     3e84. で報告されます。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/XML_external_entity_attack

   (2) https://en.wikipedia.org/wiki/Threat_model


File: python.info,  Node: ExpatError 例外,  Next: 使用例<35>,  Prev: XMLParser オブジェクト<2>,  Up: xml parsers expat --- Expat を使用した高速な XML 解析

5.21.13.2 ExpatError 例外
.........................

*note ExpatError: 1490. 例外はいくつかの興味深い属性を備えています:

 -- の属性: ExpatError.code

     特定のエラーに対する Expat の内部エラー番号です。 *note
     errors.messages: 3e89. 辞書はこれらのエラー番号を Expat のエラーメ
     ッセージに対応させます。 例えば:

          from xml.parsers.expat import ParserCreate, ExpatError, errors

          p = ParserCreate()
          try:
              p.Parse(some_xml_document)
          except ExpatError as err:
              print("Error:", errors.messages[err.code])

     *note errors: 12d. モジュールはエラーメッセージ定数と、それらのメッ
     セージをエラーコードに対応させる辞書 *note codes: 3e8a. も提供して
     います。以下を参照してください。

 -- の属性: ExpatError.lineno

     エラーが検出された場所の行番号です。最初の行の番号は ‘1’ です。

 -- の属性: ExpatError.offset

     エラーが発生した場所の行内でのオフセットです。最初のカラムの番号は
     ‘0’ です。


File: python.info,  Node: 使用例<35>,  Next: 内容モデルの記述,  Prev: ExpatError 例外,  Up: xml parsers expat --- Expat を使用した高速な XML 解析

5.21.13.3 使用例
................

以下のプログラムでは、与えられた引数を出力するだけの三つのハンドラを定義
しています。

     import xml.parsers.expat

     # 3 handler functions
     def start_element(name, attrs):
         print('Start element:', name, attrs)
     def end_element(name):
         print('End element:', name)
     def char_data(data):
         print('Character data:', repr(data))

     p = xml.parsers.expat.ParserCreate()

     p.StartElementHandler = start_element
     p.EndElementHandler = end_element
     p.CharacterDataHandler = char_data

     p.Parse("""<?xml version="1.0"?>
     <parent id="top"><child1 name="paul">Text goes here</child1>
     <child2 name="fred">More text</child2>
     </parent>""", 1)

このプログラムの出力は以下のようになります:

     Start element: parent {'id': 'top'}
     Start element: child1 {'name': 'paul'}
     Character data: 'Text goes here'
     End element: child1
     Character data: '\n'
     Start element: child2 {'name': 'fred'}
     Character data: 'More text'
     End element: child2
     Character data: '\n'
     End element: parent


File: python.info,  Node: 内容モデルの記述,  Next: Expat エラー定数,  Prev: 使用例<35>,  Up: xml parsers expat --- Expat を使用した高速な XML 解析

5.21.13.4 内容モデルの記述
..........................

内容モデルは入れ子になったタプルを使って記述されています。各タプルには以
下の 4 つの値が収められています: 型、限定詞 (quantifier)、名前、そして子
のタプル。子のタプルは単に内容モデルを記述したものです。

The values of the first two fields are constants defined in the
‘xml.parsers.expat.model’ module.  These constants can be collected in
two groups: the model type group and the quantifier group.

以下にモデル型グループにおける定数を示します:

 -- データ: xml.parsers.expat.model.XML_CTYPE_ANY

     モデル名で指定された要素は ‘ANY’ の内容モデルを持つと宣言されます。

 -- データ: xml.parsers.expat.model.XML_CTYPE_CHOICE

     指定されたエレメントはいくつかのオプションから選択できるようになっ
     ています; ‘(A | B | C)’ のような内容モデルで用いられます。

 -- データ: xml.parsers.expat.model.XML_CTYPE_EMPTY

     ‘EMPTY’ であると宣言されている要素はこのモデル型を持ちます。

 -- データ: xml.parsers.expat.model.XML_CTYPE_MIXED

 -- データ: xml.parsers.expat.model.XML_CTYPE_NAME

 -- データ: xml.parsers.expat.model.XML_CTYPE_SEQ

     順々に続くようなモデルの系列を表すモデルがこのモデル型で表されます
     。 ‘(A, B, C)’ のようなモデルで用いられます。

限定子グループにおける定数を以下に示します:

 -- データ: xml.parsers.expat.model.XML_CQUANT_NONE

     修飾子 (modifier) が指定されていません。従って ‘A’ のように、厳密に
     一つだけです。

 -- データ: xml.parsers.expat.model.XML_CQUANT_OPT

     このモデルはオプションです: ‘A?’ のように、一つか全くないかです。

 -- データ: xml.parsers.expat.model.XML_CQUANT_PLUS

     このモデルは (‘A+’ のように) 一つかそれ以上あります。

 -- データ: xml.parsers.expat.model.XML_CQUANT_REP

     このモデルは ‘A*’ のようにゼロ回以上あります。


File: python.info,  Node: Expat エラー定数,  Prev: 内容モデルの記述,  Up: xml parsers expat --- Expat を使用した高速な XML 解析

5.21.13.5 Expat エラー定数
..........................

The following constants are provided in the ‘xml.parsers.expat.errors’
module.  These constants are useful in interpreting some of the
attributes of the ‘ExpatError’ exception objects raised when an error
has occurred.  Since for backwards compatibility reasons, the constants'
value is the error 'message' and not the numeric error 'code', you do
this by comparing its *note code: 1b. attribute with
‘errors.codes[errors.XML_ERROR_CONSTANT_NAME]’.

‘errors’ モジュールには以下の属性があります:

 -- データ: xml.parsers.expat.errors.codes

     文字列の記述をエラーコードに対応させる辞書です。

     Added in version 3.2.

 -- データ: xml.parsers.expat.errors.messages

     数値的なエラーコードを文字列の記述に対応させる辞書です。

     Added in version 3.2.

 -- データ: xml.parsers.expat.errors.XML_ERROR_ASYNC_ENTITY

 -- データ:
          xml.parsers.expat.errors.XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF

     属性値中のエンティティ参照が、内部エンティティではなく外部エンティ
     ティを参照しました。

 -- データ: xml.parsers.expat.errors.XML_ERROR_BAD_CHAR_REF

     文字参照が、XML では正しくない (illegal) 文字を参照しました (例えば
     ‘0’ や '‘&#0;’')。

 -- データ: xml.parsers.expat.errors.XML_ERROR_BINARY_ENTITY_REF

     エンティティ参照が、記法 (notation) つきで宣言されているエンティテ
     ィを参照したため、解析できません。

 -- データ: xml.parsers.expat.errors.XML_ERROR_DUPLICATE_ATTRIBUTE

     一つの属性が一つの開始タグ内に一度より多く使われています。

 -- データ: xml.parsers.expat.errors.XML_ERROR_INCORRECT_ENCODING

 -- データ: xml.parsers.expat.errors.XML_ERROR_INVALID_TOKEN

     入力されたバイトが文字に適切に関連付けできない際に送出されます; 例
     えば、UTF-8 入力ストリームにおける NUL バイト (値 ‘0’) などです。

 -- データ: xml.parsers.expat.errors.XML_ERROR_JUNK_AFTER_DOC_ELEMENT

     空白以外の何かがドキュメント要素の後にあります。

 -- データ: xml.parsers.expat.errors.XML_ERROR_MISPLACED_XML_PI

     入力データの先頭以外の場所に XML 定義が見つかりました。

 -- データ: xml.parsers.expat.errors.XML_ERROR_NO_ELEMENTS

     この文書には要素がありません (XML では全ての文書は確実に最上位の要
     素を正確に一つ持たなければなりません)。

 -- データ: xml.parsers.expat.errors.XML_ERROR_NO_MEMORY

     Expat が内部メモリを確保できませんでした。

 -- データ: xml.parsers.expat.errors.XML_ERROR_PARAM_ENTITY_REF

     パラメータエンティティが許可されていない場所で見つかりました。

 -- データ: xml.parsers.expat.errors.XML_ERROR_PARTIAL_CHAR

     入力に不完全な文字が見つかりました。

 -- データ: xml.parsers.expat.errors.XML_ERROR_RECURSIVE_ENTITY_REF

     エンティティ参照中に、同じエンティティへの別の参照が入っていました;
     おそらく違う名前で参照しているか、間接的に参照しています。

 -- データ: xml.parsers.expat.errors.XML_ERROR_SYNTAX

     何らかの仕様化されていない構文エラーに遭遇しました。

 -- データ: xml.parsers.expat.errors.XML_ERROR_TAG_MISMATCH

     終了タグが最も内側で開かれている開始タグに一致しません。

 -- データ: xml.parsers.expat.errors.XML_ERROR_UNCLOSED_TOKEN

     何らかの (開始タグのような) トークンが閉じられないまま、ストリーム
     の終端や次のトークンに遭遇しました。

 -- データ: xml.parsers.expat.errors.XML_ERROR_UNDEFINED_ENTITY

     定義されていないエンティティへの参照が行われました。

 -- データ: xml.parsers.expat.errors.XML_ERROR_UNKNOWN_ENCODING

     ドキュメントのエンコードが Expat でサポートされていません。

 -- データ: xml.parsers.expat.errors.XML_ERROR_UNCLOSED_CDATA_SECTION

     CDATAセクションが閉じられていません。

 -- データ: xml.parsers.expat.errors.XML_ERROR_EXTERNAL_ENTITY_HANDLING

 -- データ: xml.parsers.expat.errors.XML_ERROR_NOT_STANDALONE

     XML文書が "standalone" だと宣言されており ‘NotStandaloneHandler’ が
     設定され ‘0’ が返されているにもかかわらず、パーサは "standalone" で
     はないと判別しました。

 -- データ: xml.parsers.expat.errors.XML_ERROR_UNEXPECTED_STATE

 -- データ: xml.parsers.expat.errors.XML_ERROR_ENTITY_DECLARED_IN_PE

 -- データ: xml.parsers.expat.errors.XML_ERROR_FEATURE_REQUIRES_XML_DTD

     An operation was requested that requires DTD support to be compiled
     in, but Expat was configured without DTD support.  This should
     never be reported by a standard build of the ‘xml.parsers.expat’
     module.

 -- データ:
          xml.parsers.expat.errors.XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING

     パースが始まったあとで動作の変更が要求されました。これはパースが開
     始される前にのみ変更可能です。（現在のところ） ‘UseForeignDTD()’ に
     よってのみ送出されます。

 -- データ: xml.parsers.expat.errors.XML_ERROR_UNBOUND_PREFIX

     名前空間の処理を有効すると宣言されていないプレフィックスが見つかり
     ます。

 -- データ: xml.parsers.expat.errors.XML_ERROR_UNDECLARING_PREFIX

     XML文書はプレフィックスに対応した名前空間宣言を削除しようとしました
     。

 -- データ: xml.parsers.expat.errors.XML_ERROR_INCOMPLETE_PE

     パラメータエンティティは不完全なマークアップを含んでいます。

 -- データ: xml.parsers.expat.errors.XML_ERROR_XML_DECL

     XML文書中に要素がありません。

 -- データ: xml.parsers.expat.errors.XML_ERROR_TEXT_DECL

     外部エンティティ中のテキスト宣言にエラーがあります。

 -- データ: xml.parsers.expat.errors.XML_ERROR_PUBLICID

     パブリックID中に許可されていない文字があります。

 -- データ: xml.parsers.expat.errors.XML_ERROR_SUSPENDED

     要求された操作は一時停止されたパーサで行われていますが、許可されて
     いない操作です。このエラーは追加の入力を行なおうとしている場合、も
     しくはパーサが停止しようとしている場合にも送出されます。

 -- データ: xml.parsers.expat.errors.XML_ERROR_NOT_SUSPENDED

     パーサを一時停止しようとしましたが、停止されませんでした。

 -- データ: xml.parsers.expat.errors.XML_ERROR_ABORTED

     Pythonアプリケーションには通知されません。

 -- データ: xml.parsers.expat.errors.XML_ERROR_FINISHED

     要求された操作で、パース対象となる入力が完了したと判断しましたが、
     入力は受理されませんでした。このエラーは追加の入力を行なおうとして
     いる場合、もしくはパーサが停止しようとしている場合に送出されます。

 -- データ: xml.parsers.expat.errors.XML_ERROR_SUSPEND_PE

 -- データ: xml.parsers.expat.errors.XML_ERROR_RESERVED_PREFIX_XML

     An attempt was made to undeclare reserved namespace prefix ‘xml’ or
     to bind it to another namespace URI.

 -- データ: xml.parsers.expat.errors.XML_ERROR_RESERVED_PREFIX_XMLNS

     An attempt was made to declare or undeclare reserved namespace
     prefix ‘xmlns’.

 -- データ: xml.parsers.expat.errors.XML_ERROR_RESERVED_NAMESPACE_URI

     An attempt was made to bind the URI of one the reserved namespace
     prefixes ‘xml’ and ‘xmlns’ to another namespace prefix.

 -- データ: xml.parsers.expat.errors.XML_ERROR_INVALID_ARGUMENT

     Pythonアプリケーションには通知されません。

 -- データ: xml.parsers.expat.errors.XML_ERROR_NO_BUFFER

     Pythonアプリケーションには通知されません。

 -- データ:
          xml.parsers.expat.errors.XML_ERROR_AMPLIFICATION_LIMIT_BREACH

     The limit on input amplification factor (from DTD and entities) has
     been breached.

 -- データ: xml.parsers.expat.errors.XML_ERROR_NOT_STARTED

     The parser was tried to be stopped or suspended before it started.

     Added in version 3.14.

脚注
....


File: python.info,  Node: インターネットプロトコルとサポート,  Next: マルチメディアサービス,  Prev: 構造化マークアップツール,  Up: Python 標準ライブラリ

5.22 インターネットプロトコルとサポート
=======================================

この章で記述されるモジュールは、インターネットプロトコルを実装し、関連技
術をサポートします。それらは全てPythonで実装されています。これらのモジュ
ールの大部分は、システム依存のモジュール *note socket: d1. が存在するこ
とが必要ですが、これは現在ではほとんどの一般的なプラットフォーム上でサポ
ートされています。ここに概観を示します:

* Menu:

* webbrowser: webbrowser --- 便利なウェブブラウザコントローラー. 便利なウェブブラウザコントローラー
* wsgiref: wsgiref --- WSGI ユーティリティとリファレンス実装. WSGI ユーティリティとリファレンス実装
* urllib: urllib --- URL を扱うモジュール群. URL を扱うモジュール群
* urllib.request: urllib request --- URL を開くための大規模なライブラリ. URL を開くための大規模なライブラリ
* urllib.response: urllib response --- Response classes used by urllib. Response classes used by urllib
* urllib.parse: urllib parse --- URL を構成要素に解析する. URL を構成要素に解析する
* urllib.error: urllib error --- urllib request によって送出される例外クラス. urllib.request によって送出される例外クラス
* urllib.robotparser: urllib robotparser --- robots txt 用のパーサー. robots.txt 用のパーサー
* http: http --- HTTP モジュール群. HTTP モジュール群
* http.client: http client --- HTTP プロトコルクライアント. HTTP プロトコルクライアント
* ftplib: ftplib --- FTP プロトコルクライアント. FTP プロトコルクライアント
* poplib: poplib --- POP3 プロトコルクライアント. POP3 プロトコルクライアント
* imaplib: imaplib --- IMAP4 プロトコルクライアント. IMAP4 プロトコルクライアント
* smtplib: smtplib --- SMTP プロトコルクライアント. SMTP プロトコルクライアント
* uuid: uuid --- RFC 9562 に基づく UUID オブジェクト. RFC 9562 に基づく UUID オブジェクト
* socketserver: socketserver --- ネットワークサーバーのフレームワーク. ネットワークサーバーのフレームワーク
* http.server: http server --- HTTP サーバー. HTTP サーバー
* http.cookies: http cookies --- HTTP の状態管理. HTTP の状態管理
* http.cookiejar: http cookiejar --- HTTP クライアント用の Cookie 処理. HTTP クライアント用の Cookie 処理
* xmlrpc: xmlrpc --- XMLRPC サーバーとクライアントモジュール群. XMLRPC サーバーとクライアントモジュール群
* xmlrpc.client: xmlrpc client --- XML-RPC クライアントアクセス. XML-RPC クライアントアクセス
* xmlrpc.server: xmlrpc server --- 基本的な XML-RPC サーバー. 基本的な XML-RPC サーバー
* ipaddress: ipaddress --- IPv4/IPv6 操作ライブラリ. IPv4/IPv6 操作ライブラリ


File: python.info,  Node: webbrowser --- 便利なウェブブラウザコントローラー,  Next: wsgiref --- WSGI ユーティリティとリファレンス実装,  Up: インターネットプロトコルとサポート

5.22.1 ‘webbrowser’ -- 便利なウェブブラウザコントローラー
---------------------------------------------------------

'ソースコード:' Lib/webbrowser.py(1)

__________________________________________________________________

The ‘webbrowser’ module provides a high-level interface to allow
displaying web-based documents to users.  Under most circumstances,
simply calling the *note open(): 1889. function from this module will do
the right thing.

Unixでは、X11上でグラフィカルなブラウザが選択されますが、グラフィカルな
ブラウザが利用できなかったり、X11が利用できない場合はテキストモードのブ
ラウザが使われます。もしテキストモードのブラウザが使われたら、ユーザがブ
ラウザから抜け出すまでプロセスの呼び出しはブロックされます。

If the environment variable ‘BROWSER’ exists, it is interpreted as the
*note os.pathsep: 2134.-separated list of browsers to try ahead of the
platform defaults.  When the value of a list part contains the string
‘%s’, then it is interpreted as a literal browser command line to be
used with the argument URL substituted for ‘%s’; if the value is a
single word that refers to one of the already registered browsers this
browser is added to the front of the search list; if the part does not
contain ‘%s’, it is simply interpreted as the name of the browser to
launch.  (2)

バージョン 3.14 で変更: The ‘BROWSER’ variable can now also be used to
reorder the list of platform defaults.  This is particularly useful on
macOS where the platform defaults do not refer to command-line tools on
‘PATH’.

非UnixプラットフォームあるいはUnix上でリモートブラウザが利用可能な場合、
制御プロセスはユーザがブラウザを終了するのを待ちませんが、ディスプレイに
ブラウザのウィンドウを表示させたままにします。Unix上でリモートブラウザが
利用可能でない場合、制御プロセスは新しいブラウザを立ち上げ、待ちます。

On iOS, the ‘BROWSER’ environment variable, as well as any arguments
controlling autoraise, browser preference, and new tab/window creation
will be ignored.  Web pages will 'always' be opened in the user's
preferred browser, in a new tab, with the browser being brought to the
foreground.  The use of the ‘webbrowser’ module on iOS requires the
*note ctypes: 2e. module.  If *note ctypes: 2e. isn't available, calls
to *note open(): 1889. will fail.

* Menu:

* コマンドライン・インターフェース: コマンドライン・インターフェース<6>.
* Browser controller objects::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/webbrowser.py

   (2) ここでブラウザの名前が絶対パスで書かれていない場合は ‘PATH’ 環境
変数で与えられたディレクトリから探し出されます。


File: python.info,  Node: コマンドライン・インターフェース<6>,  Next: Browser controller objects,  Up: webbrowser --- 便利なウェブブラウザコントローラー

5.22.1.1 コマンドライン・インターフェース
.........................................

‘webbrowser’ のスクリプトは、モジュールのコマンドラインインターフェース
として利用可能です。これは引数として URL を受け入れます。また、次のオプ
ションのパラメーターを受け入れます。

 -- Option: -n, --new-window

     Opens the URL in a new browser window, if possible.

 -- Option: -t, --new-tab

     Opens the URL in a new browser tab.

The options are, naturally, mutually exclusive.  Usage example:

     python -m webbrowser -t "https://www.python.org"

*note Availability: 213f.: not WASI, not Android.

以下の例外が定義されています:

 -- 例外: webbrowser.Error

     ブラウザのコントロールエラーが起こると発生する例外。

以下の関数が定義されています:

 -- の関数: webbrowser.open (url, new=0, autoraise=True)

     デフォルトのブラウザで 'url' を表示します。'new' が 0 なら、'url' は
     ブラウザの今までと同じウィンドウで開きます。'new' が 1 なら、可能で
     あればブラウザの新しいウィンドウが開きます。'new' が 2 なら、可能で
     あればブラウザの新しいタブが開きます。'autoraise' が ‘True’ なら、
     可能であればウィンドウが前面に表示されます（多くのウィンドウマネー
     ジャではこの変数の設定に関わらず、前面に表示されます）。

     Returns ‘True’ if a browser was successfully launched, ‘False’
     otherwise.

     幾つかのプラットフォームにおいて、ファイル名をこの関数で開こうとす
     ると、OSによって関連付けられたプログラムが起動されます。しかし、こ
     の動作はポータブルではありませんし、サポートされていません。

     引数 ‘url’ を指定して *note 監査イベント: 1c6e. ‘webbrowser.open’ を
     送出します。

 -- の関数: webbrowser.open_new (url)

     可能であれば、デフォルトブラウザの新しいウィンドウで 'url' を開きま
     すが、そうでない場合はブラウザのただ１つのウィンドウで 'url' を開き
     ます。

     Returns ‘True’ if a browser was successfully launched, ‘False’
     otherwise.

 -- の関数: webbrowser.open_new_tab (url)

     可能であれば、デフォルトブラウザの新しいページ(「タブ」)で 'url' を
     開きますが、そうでない場合は *note open_new(): 3ec9. と同様に振る舞
     います。

     Returns ‘True’ if a browser was successfully launched, ‘False’
     otherwise.

 -- の関数: webbrowser.get (using=None)

     ブラウザの種類 'using' のコントローラーオブジェクトを返します。もし
     'using' が ‘None’ なら、呼び出した環境に適したデフォルトブラウザの
     コントローラーを返します。

 -- の関数: webbrowser.register (name, constructor, instance=None, *,
          preferred=False)

     ブラウザの種類 'name' を登録します。ブラウザの種類が登録されたら、
     *note get(): 3ecb. でそのブラウザのコントローラーを呼び出すことがで
     きます。 'instance' が指定されなかったり、 ‘None’ なら、インスタン
     スが必要な時には 'constructor' がパラメータなしに呼び出されて作られ
     ます。 'instance' が指定されたら、 'constructor' は呼び出されないの
     で、 ‘None’ でかまいません。

     'preferred' を ‘True’ に設定すると、 *note get(): 3ecb. の引数無し
     の呼び出しの結果が優先的にこのブラウザになります。 そうでない場合は
     、この関数は、変数 ‘BROWSER’ を設定するか、 *note get(): 3ecb. を空
     文字列ではない、宣言したハンドラの名前と一致する引数とともに呼び出
     すときにだけ、役に立ちます。

     バージョン 3.7 で変更: 'preferred' キーワード専用引数が追加されまし
     た。

いくつかの種類のブラウザがあらかじめ定義されています。このモジュールで定
義されている、関数 *note get(): 3ecb. に与えるブラウザの名前と、それぞれ
のコントローラークラスのインスタンスを以下の表に示します。

Type Name                    Class Name                                    注釈
                                                                           
---------------------------------------------------------------------------------------
                                                                           
‘'mozilla'’                  ‘Mozilla('mozilla')’
                             
                                                                           
‘'firefox'’                  ‘Mozilla('mozilla')’
                             
                                                                           
‘'epiphany'’                 ‘Epiphany('epiphany')’
                             
                                                                           
‘'kfmclient'’                ‘Konqueror()’                                 (1)
                                                                           
                                                                           
‘'konqueror'’                ‘Konqueror()’                                 (1)
                                                                           
                                                                           
‘'kfm'’                      ‘Konqueror()’                                 (1)
                                                                           
                                                                           
‘'opera'’                    ‘Opera()’
                             
                                                                           
‘'links'’                    ‘GenericBrowser('links')’
                             
                                                                           
‘'elinks'’                   ‘Elinks('elinks')’
                             
                                                                           
‘'lynx'’                     ‘GenericBrowser('lynx')’
                             
                                                                           
‘'w3m'’                      ‘GenericBrowser('w3m')’
                             
                                                                           
‘'windows-default'’          ‘WindowsDefault’                              (2)
                                                                           
                                                                           
‘'macosx'’                   ‘MacOSXOSAScript('default')’                  (3)
                                                                           
                                                                           
‘'safari'’                   ‘MacOSXOSAScript('safari')’                   (3)
                                                                           
                                                                           
‘'google-chrome'’            ‘Chrome('google-chrome')’
                             
                                                                           
‘'chrome'’                   ‘Chrome('chrome')’
                             
                                                                           
‘'chromium'’                 ‘Chromium('chromium')’
                             
                                                                           
‘'chromium-browser'’         ‘Chromium('chromium-browser')’
                             
                                                                           
‘'iosbrowser'’               ‘IOSBrowser’                                  (4)
                                                                           

注釈:

  1. "Konqueror" は Unix の KDE デスクトップ環境のファイルマネージャで、
     KDE が動作している時にだけ意味を持ちます。何か信頼できる方法で KDE
     を検出するのがいいでしょう; 変数 ‘KDEDIR’ では十分ではありません。
     また、 KDE 2 で ‘konqueror’ コマンドを使うときにも、 "kfm" が使われ
     ます -- Konqueror を動作させるのに最も良い方法が実装によって選択さ
     れます。

  2. Windows プラットフォームのみ。

  3. macOS のみ。

  4. iOS のみ。

Added in version 3.2: 新しい ‘MacOSXOSAScript’ クラスが追加され、以前の
‘MacOSX’ に替わって Mac で使用されます。これにより、現在 OS のデフォルト
として設定されていないブラウザを開くサポートが追加されました。

Added in version 3.3: Chrome/Chromium のサポートが追加されました。

バージョン 3.12 で変更: いくつかの古いブラウザのサポートが削除されました
。削除されたブラウザには、 Grail 、 Mosaic 、 Netscape 、 Galeon 、
Skipstone 、 Iceape 、そして Firefox のバージョン 35 以前が含まれます。

バージョン 3.13 で変更: iOS のサポートが追加されました。

簡単な例を示します:

     url = 'https://docs.python.org/'

     # Open URL in a new tab, if a browser window is already open.
     webbrowser.open_new_tab(url)

     # Open URL in new window, raising the window if possible.
     webbrowser.open_new(url)


File: python.info,  Node: Browser controller objects,  Prev: コマンドライン・インターフェース<6>,  Up: webbrowser --- 便利なウェブブラウザコントローラー

5.22.1.2 Browser controller objects
...................................

Browser controllers provide the *note name: 59a. attribute, and the
following three methods which parallel module-level convenience
functions:

 -- の属性: controller.name

     ブラウザのシステム依存名。

 -- メソッド: controller.open (url, new=0, autoraise=True)

     このコントローラーでハンドルされたブラウザで 'url' を表示します。
     'new' が 1 なら、可能であればブラウザの新しいウィンドウが開きます。
     'new' が 2 なら、可能であればブラウザの新しいページ(「タブ」)が開き
     ます。

 -- メソッド: controller.open_new (url)

     可能であれば、このコントローラーでハンドルされたブラウザの新しいウ
     ィンドウで 'url' を開きますが、そうでない場合はブラウザのただ１つの
     ウィンドウで 'url' を開きます。 *note open_new(): 3ec9. の別名。

 -- メソッド: controller.open_new_tab (url)

     可能であれば、このコントローラーでハンドルされたブラウザの新しいペ
     ージ(「タブ」)で 'url' を開きますが、そうでない場合は *note
     open_new(): 3ec9. と同じです。

脚注
....


File: python.info,  Node: wsgiref --- WSGI ユーティリティとリファレンス実装,  Next: urllib --- URL を扱うモジュール群,  Prev: webbrowser --- 便利なウェブブラウザコントローラー,  Up: インターネットプロトコルとサポート

5.22.2 ‘wsgiref’ -- WSGI ユーティリティとリファレンス実装
---------------------------------------------------------

'ソースコード:' Lib/wsgiref(1)

__________________________________________________________________

     警告: ‘wsgiref’ is a reference implementation and is not
     recommended for production.  The module only implements basic
     security checks.

Web Server Gateway Interface (WSGI) は、Web サーバソフトウェアと Python
で記述された Web アプリケーションとの標準インターフェースです。標準イン
ターフェースを持つことで、WSGI をサポートするアプリケーションを幾つもの
異なる Web サーバで使うことが容易になります。

Web サーバとプログラミングフレームワークの作者だけが、WSGI デザインのあ
らゆる細部や特例などを知る必要があります。WSGI アプリケーションをインス
トールしたり、既存のフレームワークを使ったアプリケーションを記述するだけ
の皆さんは、すべてについて理解する必要はありません。

‘wsgiref’ is a reference implementation of the WSGI specification that
can be used to add WSGI support to a web server or framework.  It
provides utilities for manipulating WSGI environment variables and
response headers, base classes for implementing WSGI servers, a demo
HTTP server that serves WSGI applications, types for static type
checking, and a validation tool that checks WSGI servers and
applications for conformance to the WSGI specification ( PEP 3333(2)).

wsgi.readthedocs.io(3) に、WSGIに関するさらなる情報と、チュートリアルや
その他のリソースへのリンクがあります。

* Menu:

* wsgiref.util: wsgiref util -- WSGI environment utilities. WSGI environment utilities
* wsgiref.headers: wsgiref headers -- WSGI response header tools. WSGI response header tools
* wsgiref.simple_server: wsgiref simple_server -- a simple WSGI HTTP server. a simple WSGI HTTP server
* wsgiref.validate: wsgiref validate --- WSGI conformance checker. WSGI conformance checker
* wsgiref.handlers: wsgiref handlers -- server/gateway base classes. server/gateway base classes
* wsgiref.types: wsgiref types -- WSGI types for static type checking. WSGI types for static type checking
* 使用例: 使用例<36>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/wsgiref

   (2) https://peps.python.org/pep-3333/

   (3) https://wsgi.readthedocs.io/


File: python.info,  Node: wsgiref util -- WSGI environment utilities,  Next: wsgiref headers -- WSGI response header tools,  Up: wsgiref --- WSGI ユーティリティとリファレンス実装

5.22.2.1 ‘wsgiref.util’ - WSGI environment utilities
....................................................

このモジュールは WSGI 環境で使う様々なユーティリティ関数を提供します。
WSGI 環境は PEP 3333(1) で記述されているような HTTP リクエスト変数を含む
辞書です。'environ' パラメータを取るすべての関数は WSGI 準拠の辞書を与え
られることを期待しています; 細かい仕様については PEP 3333(2) を、型アノ
テーションに使える型エイリアスについては *note WSGIEnvironment: 3ed6. を
参照してください。

 -- の関数: wsgiref.util.guess_scheme (environ)

     'environ' 辞書の ‘HTTPS’ 環境変数を調べることで ‘wsgi.url_scheme’ が
     "http" か "https" のどちらであるべきか推測し、その結果を返します。
     戻り値は文字列です。

     この関数は、CGI や FastCGI のような CGI に似たプロトコルをラップす
     るゲートウェイを作成する場合に便利です。典型的には、それらのプロト
     コルを提供するサーバが SSL 経由でリクエストを受け取った場合には
     ‘HTTPS’ 変数に値 "1", "yes" または "on" を持つでしょう。そのため、
     この関数はそのような値が見つかった場合には "https" を返し、そうでな
     ければ "http" を返します。

 -- の関数: wsgiref.util.request_uri (environ, include_query=True)

     リクエスト URI 全体 (オプションでクエリ文字列を含む) を、 PEP
     3333(3) の "URL 再構築(URL Reconstruction)" にあるアルゴリズムを使
     って返します。 'include_query' が false の場合、クエリ文字列は結果
     となる文字列には含まれません。

 -- の関数: wsgiref.util.application_uri (environ)

     ‘PATH_INFO’ と ‘QUERY_STRING’ 変数が無視されることを除けば *note
     request_uri(): 3ed8. に似ています。結果はリクエストによって指定され
     たアプリケーションオブジェクトのベース URI です。

 -- の関数: wsgiref.util.shift_path_info (environ)

     ‘PATH_INFO’ から ‘SCRIPT_NAME’ に一つの名前をシフトしてその名前を返
     します。'environ' 辞書は '変更されます' 。‘PATH_INFO’ や
     ‘SCRIPT_NAME’ のオリジナルをそのまま残したい場合にはコピーを使って
     ください。

     ‘PATH_INFO’ にパスセグメントが何も残っていなければ、‘None’ が返され
     ます。

     典型的なこのルーチンの使い方はリクエスト URI のそれぞれの要素の処理
     で、例えばパスを一連の辞書のキーとして取り扱う場合です。このルーチ
     ンは、渡された環境を、ターゲット URL で示される別の WSGI アプリケー
     ションの呼び出しに合うように調整します。例えば、 ‘/foo’ に WSGI ア
     プリケーションがあったとして、そしてリクエスト URL パスが
     ‘/foo/bar/baz’ で、 ‘/foo’ の WSGI アプリケーションが *note
     shift_path_info(): 3eda. を呼んだ場合、これは "bar" 文字列を受け取
     り、 environ は ‘/foo/bar’ の WSGI アプリケーションへの受け渡しに適
     するように更新されます。つまり、 ‘SCRIPT_NAME’ は ‘/foo’ から
     ‘/foo/bar’ に変わって、 ‘PATH_INFO’ は ‘/bar/baz’ から ‘/baz’ に変
     化するのです。

     ‘PATH_INFO’ が単に "/" の場合、このルーチンは空の文字列を返し、
     ‘SCRIPT_NAME’ の末尾にスラッシュを加えます、これはたとえ空のパスセ
     グメントが通常は無視され、そして ‘SCRIPT_NAME’ は通常スラッシュで終
     わる事が無かったとしてもです。これは意図的な振る舞いで、このルーチ
     ンでオブジェクト巡回(object traversal) をした場合に ‘/x’ で終わる
     URI と ‘/x/’ で終わるものをアプリケーションが識別できることを保証す
     るためのものです。

 -- の関数: wsgiref.util.setup_testing_defaults (environ)

     'environ' をテスト用に自明なデフォルト値で更新します。

     このルーチンは WSGI に必要な様々なパラメータを追加します。そのよう
     なパラメータとして ‘HTTP_HOST’ 、 ‘SERVER_NAME’ 、 ‘SERVER_PORT’ 、
     ‘REQUEST_METHOD’ 、 ‘SCRIPT_NAME’ 、 ‘PATH_INFO’ 、そして PEP
     3333(4) で定義されている ‘wsgi.*’ 変数群が含まれます。このルーチン
     はデフォルト値を提供するだけで、これらの変数の既存設定は一切置きか
     えません。

     このルーチンは、ダミー環境をセットアップすることによって WSGI サー
     バとアプリケーションのユニットテストを容易にすることを意図していま
     す。これは実際の WSGI サーバやアプリケーションで使うべきではありま
     せん。なぜならこのデータは偽物なのです！

     Example usage (see also *note demo_app(): 3edc. for another
     example):

          from wsgiref.util import setup_testing_defaults
          from wsgiref.simple_server import make_server

          # A relatively simple WSGI application. It's going to print out the
          # environment dictionary after being updated by setup_testing_defaults
          def simple_app(environ, start_response):
              setup_testing_defaults(environ)

              status = '200 OK'
              headers = [('Content-type', 'text/plain; charset=utf-8')]

              start_response(status, headers)

              ret = [("%s: %s\n" % (key, value)).encode("utf-8")
                     for key, value in environ.items()]
              return ret

          with make_server('', 8000, simple_app) as httpd:
              print("Serving on port 8000...")
              httpd.serve_forever()

In addition to the environment functions above, the ‘wsgiref.util’
module also provides these miscellaneous utilities:

 -- の関数: wsgiref.util.is_hop_by_hop (header_name)

     'header_name' が RFC 2616(5) で定義されている HTTP/1.1 の
     "Hop-by-Hop" ヘッダの場合に ‘True’ を返します。

 -- クラス: wsgiref.util.FileWrapper (filelike, blksize=8192)

     A concrete implementation of the *note wsgiref.types.FileWrapper:
     3edd. protocol used to convert a file-like object to an *note
     iterator: 4c8.  The resulting objects are *note iterable: 12f1.s.
     As the object is iterated over, the optional 'blksize' parameter
     will be repeatedly passed to the 'filelike' object's ‘read()’
     method to obtain bytestrings to yield.  When ‘read()’ returns an
     empty bytestring, iteration is ended and is not resumable.

     'filelike' に ‘close()’ メソッドがある場合、返されたオブジェクトも
     ‘close()’ メソッドを持ち、これが呼ばれた場合には 'filelike' オブジ
     ェクトの ‘close()’ メソッドを呼び出します。

     使用例:

          from io import StringIO
          from wsgiref.util import FileWrapper

          # We're using a StringIO-buffer for as the file-like object
          filelike = StringIO("This is an example file-like object"*10)
          wrapper = FileWrapper(filelike, blksize=5)

          for chunk in wrapper:
              print(chunk)

     バージョン 3.11 で変更: *note __getitem__(): 588. メソッドのサポー
     トは削除されました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3333/

   (2) https://peps.python.org/pep-3333/

   (3) https://peps.python.org/pep-3333/

   (4) https://peps.python.org/pep-3333/

   (5) https://datatracker.ietf.org/doc/html/rfc2616.html


File: python.info,  Node: wsgiref headers -- WSGI response header tools,  Next: wsgiref simple_server -- a simple WSGI HTTP server,  Prev: wsgiref util -- WSGI environment utilities,  Up: wsgiref --- WSGI ユーティリティとリファレンス実装

5.22.2.2 ‘wsgiref.headers’ - WSGI response header tools
.......................................................

このモジュールは単一のクラス、 *note Headers: 1098. を提供し、WSGI レス
ポンスヘッダの操作をマップに似たインターフェースで便利にします。

 -- クラス: wsgiref.headers.Headers ([headers])

     'headers' をラップするマップ風オブジェクトを生成します。これは PEP
     3333(1) に定義されるようなヘッダの名前／値のタプルのリストです。
     'headers' のデフォルト値は空のリストです。

     *note Headers: 1098. objects support typical mapping operations
     including *note __getitem__(): 588, *note get(): 2034, *note
     __setitem__(): 14e3, *note setdefault(): 1285, *note __delitem__():
     14e4. and *note __contains__(): 15d3.  For each of these methods,
     the key is the header name (treated case-insensitively), and the
     value is the first value associated with that header name.  Setting
     a header deletes any existing values for that header, then adds a
     new value at the end of the wrapped header list.  Headers' existing
     order is generally maintained, with new headers added to the end of
     the wrapped list.

     辞書とは違って、 *note Headers: 1098. オブジェクトはラップされたヘ
     ッダリストに存在しないキーを取得または削除しようとした場合にもエラ
     ーを発生しません。単に、存在しないヘッダの取得は ‘None’ を返し、存
     在しないヘッダの削除は何もしません。

     *note Headers: 1098. オブジェクトは ‘keys()’ 、 ‘values()’ 、
     ‘items()’ メソッドもサポートします。複数の値を持つヘッダがある場合
     には、 ‘keys()’ と ‘items()’ で返されるリストは同じキーを一つ以上含
     むことがあります。 *note Headers: 1098. オブジェクトの ‘len()’ は、
     その ‘items()’ の長さと同じであり、ラップされたヘッダリストの長さと
     同じです。実際、 ‘items()’ メソッドは単にラップされたヘッダリストの
     コピーを返しているだけです。

     *note Headers: 1098. オブジェクトに対して ‘bytes()’ を呼ぶと、HTTP
     レスポンスヘッダとして送信するのに適した形に整形されたバイト文字列
     を返します。それぞれのヘッダはコロンとスペースで区切られた値と共に
     一列に並んでいます。それぞれの行はキャリッジリターンとラインフィー
     ドで終了し、バイト文字列は空行で終了しています。

     これらのマッピングインターフェースと整形機能に加えて、 *note
     Headers: 1098. オブジェクトは複数の値を持つヘッダの取得と追加、MIME
     パラメータでヘッダを追加するための以下のようなメソッド群も持ってい
     ます:

      -- メソッド: get_all (name)

          指定されたヘッダのすべての値のリストを返します。

          返されるリストは、元々のヘッダリストに現れる順、またはこのイン
          スタンスに追加された順に並んでいて、重複を含む場合があります。
          削除されて加えられたフィールドはすべてヘッダリストの末尾に付き
          ます。与えられた name に対するフィールドが何もなければ、空のリ
          ストが返ります。

      -- メソッド: add_header (name, value, **_params)

          (複数の値を持つ可能性のある) ヘッダを、キーワード引数を通じて
          指定するオプションの MIME パラメータと共に追加します。

          'name' は追加するヘッダフィールドです。このヘッダフィールドに
          MIME パラメータを設定するためにキーワード引数を使うことができ
          ます。それぞれのパラメータは文字列か ‘None’ でなければいけませ
          ん。パラメータ中のアンダースコアはダッシュ (-) に変換されます
          。これは、ダッシュが Python の識別子としては不正なのですが、多
          くの MIME パラメータはダッシュを含むためです。パラメータ値が文
          字列の場合、これはヘッダ値のパラメータに ‘name="value"’ の形で
          追加されます。この値がもし ‘None’ の場合、パラメータ名だけが追
          加されます。（これは値なしの MIME パラメータの場合に使われます
          。）使い方の例は:

               h.add_header('content-disposition', 'attachment', filename='bud.gif')

          上記はこのようなヘッダを追加します:

               Content-Disposition: attachment; filename="bud.gif"

     バージョン 3.5 で変更: 'headers' 引数が任意になりました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3333/


File: python.info,  Node: wsgiref simple_server -- a simple WSGI HTTP server,  Next: wsgiref validate --- WSGI conformance checker,  Prev: wsgiref headers -- WSGI response header tools,  Up: wsgiref --- WSGI ユーティリティとリファレンス実装

5.22.2.3 ‘wsgiref.simple_server’ - a simple WSGI HTTP server
............................................................

このモジュールは WSGI アプリケーションを提供するシンプルな HTTP サーバで
す (*note http.server: 76. がベースです)。個々のサーバインスタンスは単一
の WSGI アプリケーションを、特定のホストとポート上で提供します。もし一つ
のホストとポート上で複数のアプリケーションを提供したいならば、
‘PATH_INFO’ をパースして個々のリクエストでどのアプリケーションを呼び出す
か選択するような WSGI アプリケーションを作る必要があります。（例えば、
*note wsgiref.util: 123. から ‘shift_path_info()’ を利用します。）

 -- の関数: wsgiref.simple_server.make_server (host, port, app,
          server_class=WSGIServer, handler_class=WSGIRequestHandler)

     'host' と 'port' 上で待機し、 'app' へのコネクションを受け付ける
     WSGI サーバを作成します。戻り値は与えられた 'server_class' のインス
     タンスで、指定された 'handler_class' を使ってリクエストを処理します
     。 'app' は PEP 3333(1) で定義されるところの WSGI アプリケーション
     でなければいけません。

     使用例:

          from wsgiref.simple_server import make_server, demo_app

          with make_server('', 8000, demo_app) as httpd:
              print("Serving HTTP on port 8000...")

              # Respond to requests until process is killed
              httpd.serve_forever()

              # Alternative: serve one request, then exit
              httpd.handle_request()

 -- の関数: wsgiref.simple_server.demo_app (environ, start_response)

     This function is a small but complete WSGI application that returns
     a text page containing the message "Hello world!"  and a list of
     the key/value pairs provided in the 'environ' parameter.  It's
     useful for verifying that a WSGI server (such as
     ‘wsgiref.simple_server’) is able to run a simple WSGI application
     correctly.

     The 'start_response' callable should follow the *note
     StartResponse: 3ee3. protocol.

 -- クラス: wsgiref.simple_server.WSGIServer (server_address,
          RequestHandlerClass)

     *note WSGIServer: 3ee4. インスタンスを作成します。 'server_address'
     は ‘(host,port)’ のタプル、そして 'RequestHandlerClass' はリクエス
     トの処理に使われる *note http.server.BaseHTTPRequestHandler: 12e2.
     のサブクラスでなければいけません。

     *note make_server(): 3ee2. が細かい調整をやってくれるので、通常はこ
     のコンストラクタを呼ぶ必要はありません。

     *note WSGIServer: 3ee4. は *note http.server.HTTPServer: 3ee5. のサ
     ブクラスなので、そのすべてのメソッド (‘serve_forever()’ や
     ‘handle_request()’ のような) が利用できます。 *note WSGIServer:
     3ee4. も以下のような WSGI 固有メソッドを提供します:

      -- メソッド: set_app (application)

          呼び出し可能 (callable) な 'application' をリクエストを受け取
          る WSGI アプリケーションとして設定します。

      -- メソッド: get_app ()

          Returns the currently set application callable.

     しかしながら、通常はこれらの追加されたメソッドを使う必要はありませ
     ん。 *note set_app(): 3ee6. は普通は *note make_server(): 3ee2. に
     よって呼ばれ、 *note get_app(): 3ee7. は主にリクエストハンドライン
     スタンスの便宜上存在するからです。

 -- クラス: wsgiref.simple_server.WSGIRequestHandler (request,
          client_address, server)

     与えられた 'request' （すなわちソケット）の HTTP ハンドラ、
     'client_address' (‘(host,port)’ のタプル)、 'server' (*note
     WSGIServer: 3ee4. インスタンス) の HTTP ハンドラを作成します。

     このクラスのインスタンスを直接生成する必要はありません; これらは必
     要に応じて *note WSGIServer: 3ee4. オブジェクトによって自動的に生成
     されます。しかしながら、このクラスをサブクラス化し、 *note
     make_server(): 3ee2. 関数に 'handler_class' として与えることは可能
     でしょう。サブクラスにおいてオーバーライドする意味のありそうなもの
     は:

      -- メソッド: get_environ ()

          リクエストに対する *note WSGIEnvironment: 3ed6. 辞書を返します
          。デフォルト実装では *note WSGIServer: 3ee4. オブジェクトの
          ‘base_environ’ 辞書属性のコンテンツをコピーし、それから HTTP リ
          クエスト由来の様々なヘッダを追加しています。このメソッド呼び出
          し毎に、 PEP 3333(2) に指定されている関連する CGI 環境変数をす
          べて含む新規の辞書を返さなければいけません。

      -- メソッド: get_stderr ()

          ‘wsgi.errors’ ストリームとして使われるオブジェクトを返します。
          デフォルト実装では単に ‘sys.stderr’ を返します。

      -- メソッド: handle ()

          HTTP リクエストを処理します。デフォルト実装では実際の WGI アプ
          リケーションインターフェースを実装するのに *note
          wsgiref.handlers: 11f. クラスを使ってハンドラインスタンスを作
          成します。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3333/

   (2) https://peps.python.org/pep-3333/


File: python.info,  Node: wsgiref validate --- WSGI conformance checker,  Next: wsgiref handlers -- server/gateway base classes,  Prev: wsgiref simple_server -- a simple WSGI HTTP server,  Up: wsgiref --- WSGI ユーティリティとリファレンス実装

5.22.2.4 ‘wsgiref.validate’ -- WSGI conformance checker
.......................................................

When creating new WSGI application objects, frameworks, servers, or
middleware, it can be useful to validate the new code's conformance
using ‘wsgiref.validate’.  This module provides a function that creates
WSGI application objects that validate communications between a WSGI
server or gateway and a WSGI application object, to check both sides for
protocol conformance.

このユーティリティは完全な PEP 3333(1) 準拠を保証するものでないことは注
意してください; このモジュールでエラーが出ないことは必ずしもエラーが存在
しないことを意味しません。しかしこのモジュールがエラーを出したならば、ほ
ぼ確実にサーバかアプリケーションのどちらかが 100% 準拠ではありません。

このモジュールは lan Bicking の "Python Paste" ライブラリの ‘paste.lint’
モジュールをベースにしています。

 -- の関数: wsgiref.validate.validator (application)

     'application' をラップし、新しい WSGI アプリケーションオブジェクト
     を返します。返されたアプリケーションは全てのリクエストを元々の
     'application' に転送し、'application' とそれを呼び出すサーバの両方
     が WSGI 仕様と RFC 2616(2) の両方に準拠しているかをチェックします。

     何らかの非準拠が検出されると、 *note AssertionError: 8b8. 例外が送
     出されます; しかし、このエラーがどう扱われるかはサーバ依存であるこ
     とに注意してください。例えば、 *note wsgiref.simple_server: 121. と
     その他 *note wsgiref.handlers: 11f. ベースのサーバ（エラー処理メソ
     ッドが他のことをするようにオーバライドしていないもの）は単純にエラ
     ーが発生したというメッセージとトレースバックのダンプを ‘sys.stderr’
     やその他のエラーストリームに出力します。

     このラッパーは、疑わしいものの実際には PEP 3333(3) で禁止されていな
     いかもしれない挙動を指摘するために *note warnings: 118. モジュール
     を使って出力を生成します。これらは Python のコマンドラインオプショ
     ンや *note warnings: 118. API で抑制されなければ、 ‘sys.stderr’
     (‘wsgi.errors’ では 'ありません' 。ただし、たまたま同一のオブジェク
     トだった場合を除く)に書き出されます。

     使用例:

          from wsgiref.validate import validator
          from wsgiref.simple_server import make_server

          # Our callable object which is intentionally not compliant to the
          # standard, so the validator is going to break
          def simple_app(environ, start_response):
              status = '200 OK'  # HTTP Status
              headers = [('Content-type', 'text/plain')]  # HTTP Headers
              start_response(status, headers)

              # This is going to break because we need to return a list, and
              # the validator is going to inform us
              return b"Hello World"

          # This is the application wrapped in a validator
          validator_app = validator(simple_app)

          with make_server('', 8000, validator_app) as httpd:
              print("Listening on port 8000....")
              httpd.serve_forever()

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3333/

   (2) https://datatracker.ietf.org/doc/html/rfc2616.html

   (3) https://peps.python.org/pep-3333/


File: python.info,  Node: wsgiref handlers -- server/gateway base classes,  Next: wsgiref types -- WSGI types for static type checking,  Prev: wsgiref validate --- WSGI conformance checker,  Up: wsgiref --- WSGI ユーティリティとリファレンス実装

5.22.2.5 ‘wsgiref.handlers’ - server/gateway base classes
.........................................................

このモジュールは WSGI サーバとゲートウェイ実装のベースハンドラクラスを提
供します。これらのベースクラスは、CGI 風の環境と、それに加えて入力、出力
そしてエラーストリームが与えられることで、WSGI アプリケーションとの通信
の大部分を処理します。

 -- クラス: wsgiref.handlers.CGIHandler

     ‘sys.stdin’、‘sys.stdout’、‘sys.stderr’ そして ‘os.environ’ 経由で
     の CGI ベースの呼び出しです。これは、もしあなたが WSGI アプリケーシ
     ョンを持っていて、これを CGI スクリプトとして実行したい場合に有用で
     す。単に ‘CGIHandler().run(app)’ を起動してください。‘app’ はあなた
     が起動したい WSGI アプリケーションオブジェクトです。

     このクラスは *note BaseCGIHandler: 3ef0. のサブクラスで、これは
     ‘wsgi.run_once’ を true、 ‘wsgi.multithread’ を false、そして
     ‘wsgi.multiprocess’ を true にセットし、常に *note sys: df. と
     *note os: a5. を、必要な CGI ストリームと環境を取得するために使用し
     ます。

 -- クラス: wsgiref.handlers.IISCGIHandler

     (IIS 7 以降の) 設定オプションの allowPathInfo や (IIS 7 より前の) メ
     タベースの allowPathInfoForScriptMappings を設定せずに Microsoft の
     IIS Web サーバにデプロイするときに使う、 *note CGIHandler: 3eef. ク
     ラス以外の専用の選択肢です。

     By default, IIS gives a ‘PATH_INFO’ that duplicates the
     ‘SCRIPT_NAME’ at the front, causing problems for WSGI applications
     that wish to implement routing.  This handler strips any such
     duplicated path.

     IIS can be configured to pass the correct ‘PATH_INFO’, but this
     causes another bug where ‘PATH_TRANSLATED’ is wrong.  Luckily this
     variable is rarely used and is not guaranteed by WSGI. On IIS<7,
     though, the setting can only be made on a vhost level, affecting
     all other script mappings, many of which break when exposed to the
     ‘PATH_TRANSLATED’ bug.  For this reason IIS<7 is almost never
     deployed with the fix (Even IIS7 rarely uses it because there is
     still no UI for it.).

     There is no way for CGI code to tell whether the option was set, so
     a separate handler class is provided.  It is used in the same way
     as *note CGIHandler: 3eef, i.e., by calling
     ‘IISCGIHandler().run(app)’, where ‘app’ is the WSGI application
     object you wish to invoke.

     Added in version 3.2.

 -- クラス: wsgiref.handlers.BaseCGIHandler (stdin, stdout, stderr,
          environ, multithread=True, multiprocess=False)

     *note CGIHandler: 3eef. に似ていますが、 *note sys: df. と *note
     os: a5. モジュールを使う代わりに CGI 環境と I/O ストリームを明示的
     に指定します。 'multithread' と 'multiprocess' の値は、ハンドライン
     スタンスにより実行されるアプリケーションの ‘wsgi.multithread’ と
     ‘wsgi.multiprocess’ フラグの設定に使われます。

     このクラスは *note SimpleHandler: 3ef2. のサブクラスで、HTTP の "本
     サーバ" でないソフトウェアと使うことを意図しています。もしあなたが
     ‘Status:’ ヘッダを HTTP ステータスを送信するのに使うようなゲートウ
     ェイプロトコルの実装（CGI、FastCGI、SCGIなど）を書いている場合、お
     そらく *note SimpleHandler: 3ef2. ではなくこのクラスをサブクラス化
     するとよいでしょう。

 -- クラス: wsgiref.handlers.SimpleHandler (stdin, stdout, stderr,
          environ, multithread=True, multiprocess=False)

     *note BaseCGIHandler: 3ef0. と似ていますが、HTTP の本サーバと使うた
     めにデザインされています。もしあなたが HTTP サーバ実装を書いている
     場合、おそらく *note BaseCGIHandler: 3ef0. ではなくこのクラスをサブ
     クラス化するとよいでしょう。

     This class is a subclass of *note BaseHandler: 1dd3.  It overrides
     the ‘__init__()’, *note get_stdin(): 3ef3, *note get_stderr():
     3ef4, *note add_cgi_vars(): 3ef5, *note _write(): 3ef6, and *note
     _flush(): 3ef7. methods to support explicitly setting the
     environment and streams via the constructor.  The supplied
     environment and streams are stored in the ‘stdin’, ‘stdout’,
     ‘stderr’, and ‘environ’ attributes.

     The *note write(): ed7. method of 'stdout' should write each chunk
     in full, like *note io.BufferedIOBase: 8a3.

 -- クラス: wsgiref.handlers.BaseHandler

     これは WSGI アプリケーションを実行するための抽象ベースクラスです。
     それぞれのインスタンスは一つの HTTP リクエストを処理します。しかし
     原理上は複数のリクエスト用に再利用可能なサブクラスを作成することが
     できます。

     *note BaseHandler: 1dd3. インスタンスは外部から利用されるたった一つ
     のメソッドを持ちます:

      -- メソッド: run (app)

          指定された WSGI アプリケーション、'app' を実行します。

     その他のすべての *note BaseHandler: 1dd3. のメソッドはアプリケーシ
     ョン実行プロセスでこのメソッドから呼ばれます。したがって、それらは
     主にそのプロセスのカスタマイズのために存在しています。

     以下のメソッドはサブクラスでオーバーライドされなければいけません:

      -- メソッド: _write (data)

          バイト列の 'data' をクライアントへの転送用にバッファします。こ
          のメソッドが実際にデータを転送しても OK です: 下部システムが実
          際にそのような区別をしている場合に効率をより良くするために、
          *note BaseHandler: 1dd3. は書き出しとフラッシュ操作を分けてい
          るからです。

      -- メソッド: _flush ()

          バッファされたデータをクライアントに強制的に転送します。このメ
          ソッドは何もしなくても OK です（すなわち、 *note _write():
          3ef6. が実際にデータを送る場合）。

      -- メソッド: get_stdin ()

          Return an object compatible with *note InputStream: 3ef9.
          suitable for use as the ‘wsgi.input’ of the request currently
          being processed.

      -- メソッド: get_stderr ()

          Return an object compatible with *note ErrorStream: 3efa.
          suitable for use as the ‘wsgi.errors’ of the request currently
          being processed.

      -- メソッド: add_cgi_vars ()

          現在のリクエストの CGI 変数を ‘environ’ 属性に追加します。

     オーバーライドされることの多いメソッド及び属性を以下に挙げます。し
     かし、このリストは単にサマリであり、オーバーライド可能なすべてのメ
     ソッドは含んでいません。カスタマイズした *note BaseHandler: 1dd3. サ
     ブクラスを作成しようとする前に docstring やソースコードでさらなる情
     報を調べてください。

     WSGI 環境のカスタマイズのための属性とメソッド:

      -- の属性: wsgi_multithread

          ‘wsgi.multithread’ 環境変数で使われる値。 *note BaseHandler:
          1dd3. ではデフォルトが true ですが、別のサブクラスではデフォル
          トで（またはコンストラクタによって設定されて）異なる値を持つこ
          とがあります。

      -- の属性: wsgi_multiprocess

          ‘wsgi.multiprocess’ 環境変数で使われる値。 *note BaseHandler:
          1dd3. ではデフォルトが true ですが、別のサブクラスではデフォル
          トで（またはコンストラクタによって設定されて）異なる値を持つこ
          とがあります。

      -- の属性: wsgi_run_once

          ‘wsgi.run_once’ 環境変数で使われる値。 *note BaseHandler:
          1dd3. ではデフォルトが false ですが、 *note CGIHandler: 3eef.
          はデフォルトでこれを true に設定します。

      -- の属性: os_environ

          The default environment variables to be included in every
          request's WSGI environment.  By default, this is a copy of
          ‘os.environ’ at the time that ‘wsgiref.handlers’ was imported,
          but subclasses can either create their own at the class or
          instance level.  Note that the dictionary should be considered
          read-only, since the default value is shared between multiple
          classes and instances.

      -- の属性: server_software

          *note origin_server: 3f00. 属性が設定されている場合、この属性
          の値がデフォルトの ‘SERVER_SOFTWARE’ WSGI 環境変数の設定や
          HTTP レスポンス中のデフォルトの ‘Server:’ ヘッダの設定に使われ
          ます。これは (*note BaseCGIHandler: 3ef0. や *note CGIHandler:
          3eef. のような) HTTP オリジンサーバでないハンドラでは無視され
          ます。

          バージョン 3.3 で変更: "Python" という語は "CPython" や
          "Jython" などのような個別実装の語に置き換えられました。

      -- メソッド: get_scheme ()

          現在のリクエストで使われている URL スキームを返します。デフォ
          ルト実装は *note wsgiref.util: 123. の ‘guess_scheme()’ を使い
          、現在のリクエストの ‘environ’ 変数に基づいてスキームが"http"
          か "https" かを推測します。

      -- メソッド: setup_environ ()

          ‘environ’ 属性を、フル実装 (fully populated) の WSGI 環境に設
          定します。デフォルトの実装は、上記すべてのメソッドと属性、加え
          て *note get_stdin(): 3ef3. 、 *note get_stderr(): 3ef4. 、
          *note add_cgi_vars(): 3ef5. メソッドと *note
          wsgi_file_wrapper: 3f03. 属性を利用します。これは、キーが存在
          せず、 *note origin_server: 3f00. 属性が true 値で *note
          server_software: 3eff. 属性も設定されている場合に
          ‘SERVER_SOFTWARE’ を挿入します。

     例外処理のカスタマイズのためのメソッドと属性:

      -- メソッド: log_exception (exc_info)

          'exc_info' タプルをサーバログに記録します。'exc_info' は
          ‘(type, value, traceback)’ のタプルです。デフォルトの実装は単
          純にトレースバックをリクエストの ‘wsgi.errors’ ストリームに書
          き出してフラッシュします。サブクラスはこのメソッドをオーバーラ
          イドしてフォーマットを変更したり出力先の変更、トレースバックを
          管理者にメールしたりその他適切と思われるいかなるアクションも取
          ることができます。

      -- の属性: traceback_limit

          デフォルトの *note log_exception(): 3f04. メソッドで出力される
          トレースバック出力に含まれる最大のフレーム数です。 ‘None’ なら
          ば、すべてのフレームが含まれます。

      -- メソッド: error_output (environ, start_response)

          このメソッドは、ユーザに対してエラーページを出力する WSGI アプ
          リケーションです。これはクライアントにヘッダが送出される前にエ
          ラーが発生した場合にのみ呼び出されます。

          This method can access the current error using
          ‘sys.exception()’, and should pass that information to
          'start_response' when calling it (as described in the "Error
          Handling" section of PEP 3333(1)).  In particular, the
          'start_response' callable should follow the *note
          StartResponse: 3ee3. protocol.

          デフォルト実装は単に *note error_status: 3f07. 、 *note
          error_headers: 3f08. 、 *note error_body: 3f09. 属性を出力ペー
          ジの生成に使います。サブクラスではこれをオーバーライドしてもっ
          と動的なエラー出力をすることができます。

          しかし、セキュリティの観点からは診断をあらゆるユーザに吐き出す
          ことは推奨されないことに気をつけてください; 理想的には、診断的
          な出力を有効にするには何らかの特別なことをする必要があるように
          すべきで、これがデフォルト実装では何も含まれていない理由です。

      -- の属性: error_status

          エラーレスポンスで使われる HTTP ステータスです。これは PEP
          3333(2) で定義されているステータス文字列です; デフォルトは 500
          コードとメッセージです。

      -- の属性: error_headers

          エラーレスポンスで使われる HTTP ヘッダです。これは PEP 3333(3)
          で述べられているような、 WSGI レスポンスヘッダ (‘(name,
          value)’ タプル) のリストであるべきです。デフォルトのリストはコ
          ンテントタイプを ‘text/plain’ にセットしているだけです。

      -- の属性: error_body

          エラーレスポンスボディ。これは HTTP レスポンスのボディバイト文
          字列であるべきです。これはデフォルトではプレーンテキストで "A
          server error occurred.  Please contact the administrator."  で
          す。

     PEP 3333(4) の "オプションのプラットフォーム固有のファイルハンドリ
     ング" 機能のためのメソッドと属性:

      -- の属性: wsgi_file_wrapper

          A ‘wsgi.file_wrapper’ factory, compatible with *note
          wsgiref.types.FileWrapper: 3edd, or ‘None’.  The default value
          of this attribute is the *note wsgiref.util.FileWrapper: 93f.
          class.

      -- メソッド: sendfile ()

          オーバーライドしてプラットフォーム固有のファイル転送を実装しま
          す。このメソッドはアプリケーションの戻り値が *note
          wsgi_file_wrapper: 3f03. 属性で指定されたクラスのインスタンス
          の場合にのみ呼ばれます。これはファイルの転送が成功できた場合に
          は true を返して、デフォルトの転送コードが実行されないようにす
          るべきです。このデフォルトの実装は単に false 値を返します。

     その他のメソッドと属性:

      -- の属性: origin_server

          この属性はハンドラの *note _write(): 3ef6. と *note _flush():
          3ef7. が、特別に ‘Status:’ ヘッダに HTTP ステータスを求めるよ
          うな CGI 風のゲートウェイプロトコル経由でなく、クライアントと
          直接通信をするような場合には true 値に設定されているべきです。

          この属性のデフォルト値は *note BaseHandler: 1dd3. では true で
          すが、 *note BaseCGIHandler: 3ef0. と *note CGIHandler: 3eef.
          では false です。

      -- の属性: http_version

          *note origin_server: 3f00. が true の場合、この文字列属性はク
          ライアントへのレスポンスセットの HTTP バージョンの設定に使われ
          ます。デフォルトは ‘"1.0"’ です。

 -- の関数: wsgiref.handlers.read_environ ()

     Transcode CGI variables from ‘os.environ’ to PEP 3333(5) "bytes in
     unicode" strings, returning a new dictionary.  This function is
     used by *note CGIHandler: 3eef. and *note IISCGIHandler: 3ef1. in
     place of directly using ‘os.environ’, which is not necessarily
     WSGI-compliant on all platforms and web servers using Python 3 -
     specifically, ones where the OS's actual environment is Unicode
     (i.e.  Windows), or ones where the environment is bytes, but the
     system encoding used by Python to decode it is anything other than
     ISO-8859-1 (e.g.  Unix systems using UTF-8).

     If you are implementing a CGI-based handler of your own, you
     probably want to use this routine instead of just copying values
     out of ‘os.environ’ directly.

     Added in version 3.2.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3333/

   (2) https://peps.python.org/pep-3333/

   (3) https://peps.python.org/pep-3333/

   (4) https://peps.python.org/pep-3333/

   (5) https://peps.python.org/pep-3333/


File: python.info,  Node: wsgiref types -- WSGI types for static type checking,  Next: 使用例<36>,  Prev: wsgiref handlers -- server/gateway base classes,  Up: wsgiref --- WSGI ユーティリティとリファレンス実装

5.22.2.6 ‘wsgiref.types’ - WSGI types for static type checking
..............................................................

This module provides various types for static type checking as described
in PEP 3333(1).

Added in version 3.11.

 -- クラス: wsgiref.types.StartResponse

     A *note typing.Protocol: 56b. describing start_response()(2)
     callables ( PEP 3333(3)).

 -- データ: wsgiref.types.WSGIEnvironment

     A type alias describing a WSGI environment dictionary.

 -- データ: wsgiref.types.WSGIApplication

     A type alias describing a WSGI application callable.

 -- クラス: wsgiref.types.InputStream

     A *note typing.Protocol: 56b. describing a WSGI Input Stream(4).

 -- クラス: wsgiref.types.ErrorStream

     A *note typing.Protocol: 56b. describing a WSGI Error Stream(5).

 -- クラス: wsgiref.types.FileWrapper

     A *note typing.Protocol: 56b. describing a file wrapper(6).  See
     *note wsgiref.util.FileWrapper: 93f. for a concrete implementation
     of this protocol.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3333/

   (2) https://peps.python.org/pep-3333/#the-start-response-callable

   (3) https://peps.python.org/pep-3333/

   (4) https://peps.python.org/pep-3333/#input-and-error-streams

   (5) https://peps.python.org/pep-3333/#input-and-error-streams

   (6) 
https://peps.python.org/pep-3333/#optional-platform-specific-file-handling


File: python.info,  Node: 使用例<36>,  Prev: wsgiref types -- WSGI types for static type checking,  Up: wsgiref --- WSGI ユーティリティとリファレンス実装

5.22.2.7 使用例
...............

This is a working "Hello World" WSGI application, where the
'start_response' callable should follow the *note StartResponse: 3ee3.
protocol:

     """
     Every WSGI application must have an application object - a callable
     object that accepts two arguments. For that purpose, we're going to
     use a function (note that you're not limited to a function, you can
     use a class for example). The first argument passed to the function
     is a dictionary containing CGI-style environment variables and the
     second variable is the callable object.
     """
     from wsgiref.simple_server import make_server


     def hello_world_app(environ, start_response):
         status = "200 OK"  # HTTP Status
         headers = [("Content-type", "text/plain; charset=utf-8")]  # HTTP Headers
         start_response(status, headers)

         # The returned object is going to be printed
         return [b"Hello World"]

     with make_server("", 8000, hello_world_app) as httpd:
         print("Serving on port 8000...")

         # Serve until process is killed
         httpd.serve_forever()

Example of a WSGI application serving the current directory, accept
optional directory and port number (default: 8000) on the command line:

     """
     Small wsgiref based web server. Takes a path to serve from and an
     optional port number (defaults to 8000), then tries to serve files.
     MIME types are guessed from the file names, 404 errors are raised
     if the file is not found.
     """
     import mimetypes
     import os
     import sys
     from wsgiref import simple_server, util


     def app(environ, respond):
         # Get the file name and MIME type
         fn = os.path.join(path, environ["PATH_INFO"][1:])
         if "." not in fn.split(os.path.sep)[-1]:
             fn = os.path.join(fn, "index.html")
         mime_type = mimetypes.guess_file_type(fn)[0]

         # Return 200 OK if file exists, otherwise 404 Not Found
         if os.path.exists(fn):
             respond("200 OK", [("Content-Type", mime_type)])
             return util.FileWrapper(open(fn, "rb"))
         else:
             respond("404 Not Found", [("Content-Type", "text/plain")])
             return [b"not found"]


     if __name__ == "__main__":
         # Get the path and port from command-line arguments
         path = sys.argv[1] if len(sys.argv) > 1 else os.getcwd()
         port = int(sys.argv[2]) if len(sys.argv) > 2 else 8000

         # Make and start the server until control-c
         httpd = simple_server.make_server("", port, app)
         print(f"Serving {path} on port {port}, control-C to stop")
         try:
             httpd.serve_forever()
         except KeyboardInterrupt:
             print("Shutting down.")
             httpd.server_close()


File: python.info,  Node: urllib --- URL を扱うモジュール群,  Next: urllib request --- URL を開くための大規模なライブラリ,  Prev: wsgiref --- WSGI ユーティリティとリファレンス実装,  Up: インターネットプロトコルとサポート

5.22.3 ‘urllib’ -- URL を扱うモジュール群
-----------------------------------------

'ソースコード:' Lib/urllib/(1)

__________________________________________________________________

‘urllib’ は URL を扱う幾つかのモジュールを集めたパッケージです:

   * *note urllib.request: 111. は URL を開いて読むためのモジュールです

   * *note urllib.error: 10f. は *note urllib.request: 111. が発生させる
     例外を持っています

   * *note urllib.parse: 110. は URL をパースするためのモジュールです

   * *note urllib.robotparser: 113. は ‘robots.txt’ ファイルをパースする
     ためのモジュールです

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/urllib/


File: python.info,  Node: urllib request --- URL を開くための大規模なライブラリ,  Next: urllib response --- Response classes used by urllib,  Prev: urllib --- URL を扱うモジュール群,  Up: インターネットプロトコルとサポート

5.22.4 ‘urllib.request’ -- URL を開くための大規模なライブラリ
-------------------------------------------------------------

'ソースコード:' Lib/urllib/request.py(1)

__________________________________________________________________

The ‘urllib.request’ module defines functions and classes which help in
opening URLs (mostly HTTP) in a complex world -- basic and digest
authentication, redirections, cookies and more.

参考
....

より高水準のHTTPクライアントインターフェースとして Requestsパッケージ(2)
がお奨めです。

     警告: On macOS it is unsafe to use this module in programs using
     *note os.fork(): 4b5. because the *note getproxies(): 3f15.
     implementation for macOS uses a higher-level system API. Set the
     environment variable ‘no_proxy’ to ‘*’ to avoid this problem (e.g.
     ‘os.environ["no_proxy"] = "*"’).

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

The ‘urllib.request’ module defines the following functions:

 -- の関数: urllib.request.urlopen (url, data=None[, timeout], *,
          context=None)

     Open 'url', which can be either a string containing a valid,
     properly encoded URL, or a *note Request: 11da. object.

     'data' はサーバーに送信する追加データを指定するオブジェクトであるか
     ‘None’ である必要があります。詳細は *note Request: 11da. を確認して
     ください。

     urllib.request モジュールは HTTP/1.1 を使用し、その HTTP リクエスト
     に ‘Connection:close’ ヘッダーを含みます。

     任意引数 'timeout' には接続開始などのブロックする操作におけるタイム
     アウト時間を秒数で指定します (指定されなかった場合、グローバルのデ
     フォルトタイムアウト時間が利用されます)。この引数は、 HTTP, HTTPS,
     FTP 接続でのみ有効です。

     'context' を指定する場合は、様々な SSL オプションを記述する *note
     ssl.SSLContext: 357. インスタンスでなければなりません。 詳細は
     *note HTTPSConnection: d36. を参照してください。

     この関数は常にプロパティ 'url'、 'headers'、および 'status' を持ち
     、 *note コンテキストマネージャ: 1e1. として動作するオブジェクトを
     返します。これらのプロパティに関する詳細は *note
     urllib.response.addinfourl: 3f16. を確認してください。

     HTTP および HTTPS URL の場合、この関数は、わずかに修正された *note
     http.client.HTTPResponse: 12e5. オブジェクトを返します。上記の3つの
     新しいメソッドに加えて、 msg 属性が *note HTTPResponse: 12e5. のド
     キュメンテーションで指定されているレスポンスヘッダーの代わりに
     *note reason: 3f17. 属性 -- サーバーから返された reason フレーズ --
     と同じ情報を含んでいます。

     FTP 、ファイルおよびデータURLの場合、この関数は *note
     urllib.response.addinfourl: 3f16. オブジェクトを返します。

     プロトコルエラー発生時は *note URLError: 2be. を送出します。

     どのハンドラもリクエストを処理しなかった場合には ‘None’ を返すこと
     があるので注意してください (デフォルトでインストールされる グローバ
     ルハンドラの *note OpenerDirector: 3f18. は、 *note UnknownHandler:
     3f19. を使って上記の問題が起きないようにしています)。

     さらに、プロキシ設定が検出された場合(例えば ‘http_proxy’ のような
     ‘*_proxy’ 環境変数がセットされているなど)には *note ProxyHandler:
     1db5. がデフォルトでインストールされ、これがプロキシを通してリクエ
     ストを処理するようにしています。

     Python 2.6 以前のレガシーな ‘urllib.urlopen’ 関数は廃止されました。
     *note urllib.request.urlopen(): 307. が過去の ‘urllib2.urlopen’ に
     相当します。‘urllib.urlopen’ において辞書型オブジェクトで渡していた
     プロキシの扱いは、*note ProxyHandler: 1db5. オブジェクトを使用して
     取得できます。

     The default opener raises an *note auditing event: 1c6e.
     ‘urllib.Request’ with arguments ‘fullurl’, ‘data’, ‘headers’,
     ‘method’ taken from the request object.

     バージョン 3.2 で変更: 'cafile' および 'capath' が追加されました。

     HTTPS バーチャルホストがサポートされました (*note ssl.HAS_SNI:
     39d6. が真の場合のみ)。

     'data' にイテラブルなオブジェクトを指定できるようになりました。

     バージョン 3.3 で変更: 'cadefault' が追加されました。

     バージョン 3.4.3 で変更: 'context' が追加されました。

     バージョン 3.10 で変更: HTTPS connection now send an ALPN extension
     with protocol indicator ‘http/1.1’ when no 'context' is given.
     Custom 'context' should set ALPN protocols with *note
     set_alpn_protocols(): 1064.

     バージョン 3.13 で変更: Remove 'cafile', 'capath' and 'cadefault'
     parameters: use the 'context' parameter instead.

 -- の関数: urllib.request.install_opener (opener)

     指定された *note OpenerDirector: 3f18. のインスタンスを、デフォルト
     で利用されるグローバルの opener としてインストールします。 opener の
     インストールは、 urlopen にその opener を使って欲しいとき以外必要あ
     りません。普段は単に *note urlopen(): 307. の代わりに *note
     OpenerDirector.open(): 11de. を利用してください。この関数は引数が本
     当に *note OpenerDirector: 3f18. のインスタンスであるかどうかはチェ
     ックしません。適切なインターフェースを持った任意のクラスを利用する
     ことができます。

 -- の関数: urllib.request.build_opener ([handler, ...])

     与えられた順番に URL ハンドラを連鎖させる *note OpenerDirector:
     3f18. のインスタンスを返します。 'handler' は *note BaseHandler:
     3f1b. または *note BaseHandler: 3f1b. のサブクラスのインスタンスの
     どちらかです (どちらの場合も、コンストラクトは引数無しで呼び出せる
     ようになっていなければなりません) 。クラス *note ProxyHandler:
     1db5. (proxy 設定が検出された場合), *note UnknownHandler: 3f19,
     *note HTTPHandler: ef8, *note HTTPDefaultErrorHandler: 3f1c, *note
     HTTPRedirectHandler: 3f1d, *note FTPHandler: 3f1e, *note
     FileHandler: 3f1f, *note HTTPErrorProcessor: 3f20. については、その
     クラスのインスタンスか、そのサブクラスのインスタンスが 'handler' に
     含まれていない限り、 'handler' よりも先に連鎖します。

     Python が SSL をサポートするように設定してインストールされている場
     合 (すなわち、 *note ssl: d5. モジュールを import できる場合) *note
     HTTPSHandler: 143c. も追加されます。

     *note BaseHandler: 3f1b. サブクラスでも ‘handler_order’ メンバー変
     数を変更して、ハンドラーリスト内での場所を変更できます。

 -- の関数: urllib.request.pathname2url (path, *, add_scheme=False)

     Convert the given local path to a ‘file:’ URL. This function uses
     *note quote(): d9c. function to encode the path.

     If 'add_scheme' is false (the default), the return value omits the
     ‘file:’ scheme prefix.  Set 'add_scheme' to true to return a
     complete URL.

     This example shows the function being used on Windows:

          >>> from urllib.request import pathname2url
          >>> path = 'C:\\Program Files'
          >>> pathname2url(path, add_scheme=True)
          'file:///C:/Program%20Files'

     バージョン 3.14 で変更: Windows drive letters are no longer
     converted to uppercase, and ‘:’ characters not following a drive
     letter no longer cause an *note OSError: 2c0. exception to be
     raised on Windows.

     バージョン 3.14 で変更: Paths beginning with a slash are converted
     to URLs with authority sections.  For example, the path
     ‘/etc/hosts’ is converted to the URL ‘///etc/hosts’.

     バージョン 3.14 で変更: 'add_scheme' パラメータが追加されました。

 -- の関数: urllib.request.url2pathname (url, *, require_scheme=False,
          resolve_host=False)

     Convert the given ‘file:’ URL to a local path.  This function uses
     *note unquote(): 1afb. to decode the URL.

     If 'require_scheme' is false (the default), the given value should
     omit a ‘file:’ scheme prefix.  If 'require_scheme' is set to true,
     the given value should include the prefix; a *note URLError: 2be.
     is raised if it doesn't.

     The URL authority is discarded if it is empty, ‘localhost’, or the
     local hostname.  Otherwise, if 'resolve_host' is set to true, the
     authority is resolved using *note socket.gethostbyname(): 3996. and
     discarded if it matches a local IP address (as per RFC 8089 §3(3)).
     If the authority is still unhandled, then on Windows a UNC path is
     returned, and on other platforms a *note URLError: 2be. is raised.

     This example shows the function being used on Windows:

          >>> from urllib.request import url2pathname
          >>> url = 'file:///C:/Program%20Files'
          >>> url2pathname(url, require_scheme=True)
          'C:\\Program Files'

     バージョン 3.14 で変更: Windows drive letters are no longer
     converted to uppercase, and ‘:’ characters not following a drive
     letter no longer cause an *note OSError: 2c0. exception to be
     raised on Windows.

     バージョン 3.14 で変更: The URL authority is discarded if it
     matches the local hostname.  Otherwise, if the authority isn't
     empty or ‘localhost’, then on Windows a UNC path is returned (as
     before), and on other platforms a *note URLError: 2be. is raised.

     バージョン 3.14 で変更: The URL query and fragment components are
     discarded if present.

     バージョン 3.14 で変更: 'require_scheme' および 'resolve_host' パラ
     メータが追加されました。

 -- の関数: urllib.request.getproxies ()

     このヘルパー関数はスキーマからプロキシサーバーのURLへのマッピングを
     行う辞書を返します。この関数はまず、どのOSでも最初に
     ‘<scheme>_proxy’ という名前の環境変数を大文字小文字を区別せずにスキ
     ャンします。そこで見つからなかった場合、 macOS の場合は macOS シス
     テム環境設定を、 Windows の場合はシステムレジストリを参照します。も
     し小文字と大文字の環境変数が両方存在する (そして値が一致しない) な
     ら、小文字の環境変数が優先されます。

          注釈: もし環境変数 ‘REQUEST_METHOD’ が設定されていたら (これは
          通常スクリプトが CGI 環境で動いていることを示しています)、環境
          変数 ‘HTTP_PROXY’ (大文字の ‘_PROXY’) は無視されます。その理由
          は、クライアントが "Proxy:" HTTP ヘッダーを使ってこの環境変数
          を注入できるからです。もし CGI 環境で HTTP プロキシを使う必要
          があれば、 ‘ProxyHandler’ を明示的に使用するか、環境変数名を小
          文字にしてください (あるいは、少なくともサフィックスを
          ‘_proxy’ にしてください) 。

以下のクラスが提供されています:

 -- クラス: urllib.request.Request (url, data=None, headers={},
          origin_req_host=None, unverifiable=False, method=None)

     このクラスは URL リクエストを抽象化したものです。

     'url' should be a string containing a valid, properly encoded URL.

     'data' must be an object specifying additional data to send to the
     server, or ‘None’ if no such data is needed.  Currently HTTP
     requests are the only ones that use 'data'.  The supported object
     types include bytes, file-like objects, and iterables of bytes-like
     objects.  If no ‘Content-Length’ nor ‘Transfer-Encoding’ header
     field has been provided, *note HTTPHandler: ef8. will set these
     headers according to the type of 'data'.  ‘Content-Length’ will be
     used to send bytes objects, while ‘Transfer-Encoding: chunked’ as
     specified in RFC 7230(4), Section 3.3.1 will be used to send files
     and other iterables.

     HTTP POST リクエストメソッドでは 'data' は標準の
     ‘application/x-www-form-urlencoded’ 形式のバッファーでなければなり
     ません。 *note urllib.parse.urlencode(): 1095. 関数は、マップ型ある
     いは 2 タプルのシーケンスを取り、この形式の ASCII 文字列を返します
     。これは 'data' パラメーターとして使用される前に bytes 型にエンコー
     ドされなければなりません。

     'headers' は辞書でなければなりません。この辞書は *note
     add_header(): 3f21. を辞書のキーおよび値を引数として呼び出した時と
     同じように扱われます。この引数は、多くの場合ブラウザーが何であるか
     を特定する ‘User-Agent’ ヘッダーの値を "偽装" するために用いられま
     す。これは一部の HTTP サーバーが、スクリプトからのアクセスを禁止す
     るために一般的なブラウザーの ‘User-Agent’ ヘッダーしか許可しないた
     めです。例えば、 Mozilla Firefox は ‘User-Agent’ に ‘"Mozilla/5.0
     (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11"’ のように設定
     し、 *note urllib: 10e. はデフォルトで ‘"Python-urllib/2.6"’
     (Python 2.6の場合) と設定します。headersのすべてのキーはキャメルケ
     ースで送信されます。

     An appropriate ‘Content-Type’ header should be included if the
     'data' argument is present.  If this header has not been provided
     and 'data' is not ‘None’, ‘Content-Type:
     application/x-www-form-urlencoded’ will be added as a default.

     次の2つの引数は、サードパーティの HTTP クッキーを正しく扱いたい場合
     にのみ関係してきます:

     'origin_req_host' は、 RFC 2965(5) で定義されている元のトランザクシ
     ョンにおけるリクエストホスト (request-host of the origin
     transaction) です。デフォルトの値は
     ‘http.cookiejar.request_host(self)’ です。この値は、ユーザーによっ
     て開始された元々のリクエストにおけるホスト名や IP アドレスです。例
     えば、もしリクエストがある HTML ドキュメント内の画像を指していれば
     、この値は画像を含んでいるページへのリクエストにおけるリクエストホ
     ストになるはずです。

     'unverifiable' は、 RFC 2965(6) の定義において、該当するリクエスト
     が証明不能 (unverifiable) であるかどうかを示します。デフォルトの値
     は ‘False’ です。証明不能なリクエストとは、ユーザが受け入れの可否を
     選択できないような URL を持つリクエストのことです。例えば、リクエス
     トが HTML ドキュメント中の画像であり、ユーザがこの画像を自動的に取
     得するか どうかを選択できない場合には、証明不能フラグは True になり
     ます。

     'method' は使用される HTTP リクエストメソッド (例: ‘'HEAD'’) を示す
     文字列でなければなりません。もし与えられた場合、この値は属性 *note
     method: 11db. に格納され、 *note get_method(): 1381. で使用されます
     。デフォルトは 'data' が ‘None’ であれば ‘'GET'’ で、そうでなければ
     ‘'POST'’ です。サブクラスは *note method: 11db. 属性をクラス自身に
     設定して、異なるデフォルトメソッドを示すことができます。

          注釈: The request will not work as expected if the data object
          is unable to deliver its content more than once (e.g.  a file
          or an iterable that can produce the content only once) and the
          request is retried for HTTP redirects or authentication.  The
          'data' is sent to the HTTP server right away after the
          headers.  There is no support for a 100-continue expectation
          in the library.

     バージョン 3.3 で変更: 引数 *note Request.method: 11db. が Request
     クラスに追加されました。

     バージョン 3.4 で変更: *note Request.method: 11db. のデフォルト値は
     クラスレベルで指定されることがあります。

     バージョン 3.6 で変更: Do not raise an error if the
     ‘Content-Length’ has not been provided and 'data' is neither ‘None’
     nor a bytes object.  Fall back to use chunked transfer encoding
     instead.

 -- クラス: urllib.request.OpenerDirector

     *note OpenerDirector: 3f18. クラスは、 *note BaseHandler: 3f1b. の
     連鎖的に呼び出して URL を開きます。このクラスはハンドラをどのように
     連鎖させるか、またどのようにエラーをリカバリするかを管理します。

 -- クラス: urllib.request.BaseHandler

     このクラスはハンドラ連鎖に登録される全てのハンドラがベースとしてい
     るクラスです - このクラスでは登録のための単純なメカニズムだけを扱い
     ます。

 -- クラス: urllib.request.HTTPDefaultErrorHandler

     HTTP エラーレスポンスのデフォルトハンドラーを定義するクラスです; す
     べてのレスポンスは *note HTTPError: 11e0. 例外に変換されます。

 -- クラス: urllib.request.HTTPRedirectHandler

     リダイレクションを扱うクラスです。

 -- クラス: urllib.request.HTTPCookieProcessor (cookiejar=None)

     HTTP Cookie を扱うためのクラスです。

 -- クラス: urllib.request.ProxyHandler (proxies=None)

     このクラスはプロキシを通過してリクエストを送らせます。引数
     'proxies' を与える場合、プロトコル名からプロキシの URL へ対応付ける
     辞書でなくてはなりません。標準では、プロキシのリストを環境変数
     ‘<protocol>_proxy’ から読み出します。プロキシ環境変数が設定されてい
     ない場合は、 Windows 環境では、 レジストリのインターネット設定セク
     ションからプロキシ設定を手に入れ、 macOS 環境では、 macOS システム
     設定フレームワーク (System Configuration Framework) からプロキシ情
     報を取得します。

     自動検出されたproxyを無効にするには、空の辞書を渡してください。

     ‘no_proxy’ 環境変数は、proxyを利用せずにアクセスするべきホストを指
     定するために利用されます。設定する場合は、カンマ区切りの、ホストネ
     ーム suffix のリストで、オプションとして ‘:port’ を付けることができ
     ます。例えば、 ‘cern.ch,ncsa.uiuc.edu,some.host:8080’.

          注釈: 変数 ‘REQUEST_METHOD’ が設定されている場合、
          ‘HTTP_PROXY’ は無視されます; *note getproxies(): 3f15. のドキ
          ュメンテーションを参照してください。

 -- クラス: urllib.request.HTTPPasswordMgr

     ‘(realm, uri) -> (user, password)’ の対応付けデータベースを保持しま
     す。

 -- クラス: urllib.request.HTTPPasswordMgrWithDefaultRealm

     ‘(realm, uri) -> (user, password)’ の対応付けデータベースを保持しま
     す。レルム ‘None’ はその他諸々のレルムを表し、他のレルムが該当しな
     い場合に検索されます。

 -- クラス: urllib.request.HTTPPasswordMgrWithPriorAuth

     ‘uri -> is_authenticated’ マッピングのデータベースも持つ *note
     HTTPPasswordMgrWithDefaultRealm: 3f24. のバリエーションです。最初に
     ‘401’ レスポンスを待つのではなく直ちに認証情報を送るときの条件を判
     断するために、 BasicAuth ハンドラによって使われます。

     Added in version 3.5.

 -- クラス: urllib.request.AbstractBasicAuthHandler (password_mgr=None)

     これは、リモートホストとプロキシの両方に対して HTTP 認証を行うこと
     を助ける mixin クラスです。 'password_mgr' は、もし与えられたら
     *note HTTPPasswordMgr: 3f23. と互換性のあるオブジェクトでなければな
     りません; サポートすべきインターフェースに関する情報は *note
     HTTPPasswordMgr オブジェクト: 3f25. 節を参照してください。もし
     'passwd_mgr' が ‘is_authenticated’ と ‘update_authenticated’ メソッ
     ドも提供するなら (*note HTTPPasswordMgrWithPriorAuth オブジェクト:
     3f26. を参照)、ハンドラは与えられた URI に対する ‘is_authenticated’
     の結果を用いてリクエストにおいて認証情報を送るかどうかを決定します
     。もし ‘is_authenticated’ がその URI に対して ‘True’ を返すなら、認
     証情報が送られます。 ‘is_authenticated’ が ‘False’ なら認証情報は送
     られません。そして、もし ‘401’ レスポンスを受け取ったら、認証情報を
     付けて改めてリクエストが送信されます。もし認証が成功したら、それ以
     降その URI またはその親 URI に対して行われるリクエストが認証情報を
     自動的に含むように、 URI に対して ‘is_authenticated’ を ‘True’ に設
     定するために ‘update_authenticated’ が呼ばれます。

     Added in version 3.5: ‘is_authenticated’ サポートが追加されました。

 -- クラス: urllib.request.HTTPBasicAuthHandler (password_mgr=None)

     遠隔ホストとの間での認証を扱います。 'password_mgr' を与える場合、
     *note HTTPPasswordMgr: 3f23. と互換性がなければなりません; 互換性の
     ためにサポートしなければならないインターフェースについての情報はセ
     クション *note HTTPPasswordMgr オブジェクト: 3f25. を参照してくださ
     い。HTTPBasicAuthHandler は、間違った認証スキーマが与えられると
     *note ValueError: 2ec. を送出します。

 -- クラス: urllib.request.ProxyBasicAuthHandler (password_mgr=None)

     プロキシとの間での認証を扱います。 'password_mgr' を与える場合、
     *note HTTPPasswordMgr: 3f23. と互換性が なければなりません; 互換性
     のためにサポートしなければならないインターフェースについての情報は
     セクション *note HTTPPasswordMgr オブジェクト: 3f25. を参照してくだ
     さい。

 -- クラス: urllib.request.AbstractDigestAuthHandler (password_mgr=None)

     このクラスはHTTP 認証を補助するための混ぜ込みクラス (mixin class) で
     す。遠隔ホストとプロキシの両方に対応しています。 'password_mgr' を
     与える場合、 *note HTTPPasswordMgr: 3f23. と互換性がなければなりま
     せん; 互換性のためにサポートしなければならないインターフェースにつ
     いての情報はセクション *note HTTPPasswordMgr オブジェクト: 3f25. を
     参照してください。

     バージョン 3.14 で変更: Added support for HTTP digest
     authentication algorithm ‘SHA-256’.

 -- クラス: urllib.request.HTTPDigestAuthHandler (password_mgr=None)

     リモートホストとの認証を扱います。'password_mgr' を与える場合、
     *note HTTPPasswordMgr: 3f23. と互換性のあるものでなければなりません
     。サポートしなければならないインターフェースについての情報は *note
     HTTPPasswordMgr オブジェクト: 3f25. 節を参照してください。Digest 認
     証ハンドラーと Basic 認証ハンドラーの両方が追加された場合、常に
     Digest 認証を先に試みます。Digest 認証が 40x のレスポンスを再び返す
     と、Basic 認証ハンドラーに送信されます。このハンドラーメソッドは、
     Digest および Basic 以外の認証スキームが存在する場合は *note
     ValueError: 2ec. を送出します。

     バージョン 3.3 で変更: 未サポートの認証スキームでは *note
     ValueError: 2ec. を送出するようになりました。

 -- クラス: urllib.request.ProxyDigestAuthHandler (password_mgr=None)

     プロキシとの間での認証を扱います。 'password_mgr' を与える場合、
     *note HTTPPasswordMgr: 3f23. と互換性が なければなりません; 互換性
     のためにサポートしなければならないインターフェースについての情報は
     セクション *note HTTPPasswordMgr オブジェクト: 3f25. を参照してくだ
     さい。

 -- クラス: urllib.request.HTTPHandler

     HTTP の URL を開きます。

 -- クラス: urllib.request.HTTPSHandler (debuglevel=0, context=None,
          check_hostname=None)

     HTTPS で URL を開きます。'context' および 'check_hostname' は *note
     http.client.HTTPSConnection: d36. のものと同じ意味です。

     バージョン 3.2 で変更: 'context' および 'check_hostname' が追加され
     ました。

 -- クラス: urllib.request.FileHandler

     ローカルファイルを開きます。

 -- クラス: urllib.request.DataHandler

     data URL を開きます。

     Added in version 3.4.

 -- クラス: urllib.request.FTPHandler

     FTP の URL を開きます。

 -- クラス: urllib.request.CacheFTPHandler

     FTP の URL を開きます。遅延を最小限にするために、開かれている FTP 接
     続に対するキャッシュを保持します。

 -- クラス: urllib.request.UnknownHandler

     その他諸々のためのクラスで、未知のプロトコルの URL を開きます。

 -- クラス: urllib.request.HTTPErrorProcessor

     HTTP エラー応答の処理をします。

* Menu:

* Request オブジェクト::
* OpenerDirector オブジェクト::
* BaseHandler オブジェクト::
* HTTPRedirectHandler オブジェクト::
* HTTPCookieProcessor オブジェクト::
* ProxyHandler オブジェクト::
* HTTPPasswordMgr オブジェクト::
* HTTPPasswordMgrWithPriorAuth オブジェクト::
* AbstractBasicAuthHandler オブジェクト::
* HTTPBasicAuthHandler オブジェクト::
* ProxyBasicAuthHandler オブジェクト::
* AbstractDigestAuthHandler オブジェクト::
* HTTPDigestAuthHandler オブジェクト::
* ProxyDigestAuthHandler オブジェクト::
* HTTPHandler オブジェクト::
* HTTPSHandler オブジェクト::
* FileHandler オブジェクト::
* DataHandler オブジェクト::
* FTPHandler オブジェクト::
* CacheFTPHandler オブジェクト::
* UnknownHandler オブジェクト::
* HTTPErrorProcessor オブジェクト::
* 使用例: 使用例<37>.
* レガシーインターフェース: レガシーインターフェース<2>.
* urllib.request Restrictions: urllib request Restrictions.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/urllib/request.py

   (2) https://requests.readthedocs.io/en/master/

   (3) https://datatracker.ietf.org/doc/html/rfc8089.html#section-3

   (4) https://datatracker.ietf.org/doc/html/rfc7230.html

   (5) https://datatracker.ietf.org/doc/html/rfc2965.html

   (6) https://datatracker.ietf.org/doc/html/rfc2965.html


File: python.info,  Node: Request オブジェクト,  Next: OpenerDirector オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.1 Request オブジェクト
.............................

以下のメソッドは *note Request: 11da. の公開インターフェースについて説明
しています。これらはすべてサブクラスでオーバーライドできます。また、解析
したリクエストを調査するためにクライアントで使用するいくつかの属性も定義
します。

 -- の属性: Request.full_url

     コンストラクターに渡されたオリジナルの URL です。

     バージョン 3.4 で変更.

     Request.full_url は、 setter, getter, deleter を持つプロパティです
     。もし存在すれば、 *note full_url: 11dc. はオリジナルのリクエスト
     URL フラグメント付きで返します。

 -- の属性: Request.type

     URI スキームです。

 -- の属性: Request.host

     URI オーソリティです。通常はホスト名ですが、コロンで区切られたポー
     ト番号が付随することもあります。

 -- の属性: Request.origin_req_host

     リクエストしたオリジナルのホスト名です。ポート番号はつきません。

 -- の属性: Request.selector

     URI パスです。*note Request: 11da. がプロキシを使用する場合、セレク
     ターはプロキシに渡される完全な URL になります。

 -- の属性: Request.data

     リクエストのエンティティボディか、指定されない場合は ‘None’ になり
     ます。

     バージョン 3.4 で変更: *note Request.data: 11dd. の値が変更されると
     、もしそれ以前に "Content-Length" ヘッダーの値が設定または計算され
     ていたらヘッダーが削除されるようになりました。

 -- の属性: Request.unverifiable

     リクエストが RFC 2965(1) で定義された証明不能 (unverifiable) である
     かどうかを示す論理値です。

 -- の属性: Request.method

     HTTP リクエストで使うメソッドです。 デフォルト値は *note None: 885.
     で、このときは使うメソッドを *note get_method(): 1381. が通常の方法
     で決定するということになります。 この値を設定する (従って *note
     get_method(): 1381. のデフォルトの決定を上書きする) 方法は、 *note
     Request: 11da. サブクラスでのクラスレベルの設定処理でデフォルト値を
     提供するか、 *note Request: 11da. のコンストラクタの 'method' 引数
     へ値を渡すかです。

     Added in version 3.3.

     バージョン 3.4 で変更: サブクラスでデフォルト値が設定できるようにな
     りました; 以前はコンストラクタ引数からしか設定できませんでした。

 -- メソッド: Request.get_method ()

     HTTP リクエストメソッドを示す文字列を返します。*note
     Request.method: 11db. が ‘None’ でなければその値を返します。そうで
     ない場合、*note Request.data: 11dd. が ‘None’ なら ‘'GET'’ を、そう
     でなければ ‘'POST'’ を返します。これは HTTP リクエストに対してのみ
     意味を持ちます。

     バージョン 3.3 で変更: get_method は *note Request.method: 11db. の
     値を参照するようになりました。

 -- メソッド: Request.add_header (key, val)

     リクエストに新たなヘッダーを追加します。ヘッダーは HTTP ハンドラ以
     外のハンドラでは無視されます。HTTP ハンドラでは、引数はサーバに送信
     される ヘッダーのリストに追加されます。同じ名前を持つヘッダを 2 つ
     以上持つことはできず、 'key' の衝突が生じた場合、後で追加したヘッダ
     ーが前に 追加したヘッダーを上書きします。現時点では、この機能は
     HTTP の機能を損ねることはありません。というのは、複数回呼び出したと
     きに意味を 持つようなヘッダーには、どれもただ一つのヘッダーを使って
     同じ機能を果たすための (ヘッダー特有の) 方法があるからです。このメ
     ソッドを使って追加されたヘッダーはリダイレクトされたリクエストにも
     追加されることに注意してください。

 -- メソッド: Request.add_unredirected_header (key, header)

     リダイレクトされたリクエストには追加されないヘッダーを追加します。

 -- メソッド: Request.has_header (header)

     インスタンスが名前つきヘッダーであるかどうかを (通常のヘッダーと非
     リダイレクトヘッダの両方を調べて) 返します。

 -- メソッド: Request.remove_header (header)

     リクエストインスタンス (の通常のヘッダーと非リダイレクトヘッダーの
     両方) から名前つきヘッダーを削除します。

     Added in version 3.4.

 -- メソッド: Request.get_full_url ()

     コンストラクタで与えられた URL を返します。

     バージョン 3.4 で変更.

     *note Request.full_url: 11dc. を返します。

 -- メソッド: Request.set_proxy (host, type)

     リクエストがプロキシサーバを経由するように準備します。 'host' およ
     び 'type' はインスタンスのもとの設定と置き換えられ ます。インスタン
     スのセレクタはコンストラクタに与えたもともとの URL になります。

 -- メソッド: Request.get_header (header_name, default=None)

     指定されたヘッダーの値を返します。ヘッダーがない場合は、 'default'
     の値を返します。

 -- メソッド: Request.header_items ()

     リクエストヘッダーの値を、タプル (header_name, header_value) のリス
     トで返します。

バージョン 3.4 で変更: 3.3 から非推奨だった Request オブジェクトのメソッ
ド add_data, has_data, get_data, get_type, get_host, get_selector,
get_origin_req_host, is_unverifiable が削除されました。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2965.html


File: python.info,  Node: OpenerDirector オブジェクト,  Next: BaseHandler オブジェクト,  Prev: Request オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.2 OpenerDirector オブジェクト
....................................

*note OpenerDirector: 3f18. インスタンスは以下のメソッドを持っています:

 -- メソッド: OpenerDirector.add_handler (handler)

     'handler' should be an instance of *note BaseHandler: 3f1b.  The
     following methods are searched, and added to the possible chains
     (note that HTTP errors are a special case).  Note that, in the
     following, 'protocol' should be replaced with the actual protocol
     to handle, for example ‘http_response()’ would be the HTTP protocol
     response handler.  Also 'type' should be replaced with the actual
     HTTP code, for example ‘http_error_404()’ would handle HTTP 404
     errors.

        * ‘<protocol>_open()’ -- ハンドラーが 'protocol' の URL を開く方
          法を知っているかどうかを調べます。

          詳細は、 *note BaseHandler.<protocol>_open(): 3f3b. を参照して
          ください。

        * ‘http_error_<type>()’ -- ハンドラーが HTTP エラーコード 'type'
          の処理方法を知っていることを示すシグナルです。

          詳細は、 *note BaseHandler.http_error_<nnn>(): 3f3c. を参照し
          てください。

        * ‘<protocol>_error()’ -- ハンドラーが (‘http’ でない)
          'protocol' のエラーを処理する方法を知っていることを示すシグナ
          ルです。

        * ‘<protocol>_request()’ -- ハンドラーが 'protocol' リクエストの
          プリプロセス方法を知っていることを示すシグナルです。

          詳細は、 *note BaseHandler.<protocol>_request(): 3f3d. を参照
          してください。

        * ‘<protocol>_response()’ -- ハンドラーが 'protocol' リクエスト
          のポストプロセス方法を知っていることを示すシグナルです。

          詳細は、 *note BaseHandler.<protocol>_response(): 3f3e. を参照
          してください。

 -- メソッド: OpenerDirector.open (url, data=None[, timeout])

     与えられた 'url' (リクエストオブジェクトでも文字列でもかまいません)
     を開きます。オプションとして 'data' を与えることができます。 引数、
     戻り値、および送出される例外は *note urlopen(): 307. と同じです
     (*note urlopen(): 307. の場合、標準でインストールされている グロー
     バルな *note OpenerDirector: 3f18. の *note open(): 316. メソッドを
     呼び出します) 。 オプションの 'timeout' 引数は、接続開始のようなブ
     ロックする処理におけるタイムアウト時間を 秒数で指定します。(指定し
     なかった場合は、グローバルのデフォルト設定が利用されます) タイムア
     ウト機能は、 HTTP, HTTPS, FTP 接続でのみ有効です。

 -- メソッド: OpenerDirector.error (proto, *args)

     与えられたプロトコルにおけるエラーを処理します。このメソッドは与え
     られたプロトコルにおける登録済みのエラーハンドラを (プロトコル固有
     の) 引数で呼び出します。 HTTP プロトコルは特殊なケースで、特定のエ
     ラーハンドラを選び出すのに HTTP レスポンスコードを使います; ハンド
     ラクラスの ‘http_error_<type>()’ メソッドを参照してください。

     戻り値および送出される例外は *note urlopen(): 307. と同じものです。

OpenerDirector オブジェクトは、以下の 3 つのステージに分けて URL を開き
ます:

各ステージで OpenerDirector オブジェクトのメソッドがどのような順で呼び出
されるかは、ハンドラインスタンスの並び方で決まります。

  1. ‘<protocol>_request()’ 形式のメソッドを持つすべてのハンドラーに対し
     てそのメソッドを呼び出し、リクエストのプリプロセスを行います。

  2. ‘<protocol>_open()’ のようなメソッドでハンドラーが呼び出され、リク
     エストを処理します。このステージではハンドラーが非-*note None: 885.
     値 (例: レスポンス) か例外 (通常は *note URLError: 2be.) を返した時
     点で終了します。例外は伝搬できます。

     実際には、上のアルゴリズムではまず *note default_open(): 3f40. とい
     う名前のメソッドを呼び出します。このメソッドがすべて *note None:
     885. を返す場合、同じアルゴリズムを繰り返して、今度は
     ‘<protocol>_open()’ 形式のメソッドを試します。メソッドがすべて
     *note None: 885. を返すと、さらに同じアルゴリズムを繰り返して *note
     unknown_open(): 3f41. を呼び出します。

     これらのメソッドの実装には、親となる *note OpenerDirector: 3f18. イ
     ンスタンスの ‘open()’ や ‘error()’ といったメソッド呼び出しが入る場
     合があるので注意してください。

  3. ‘<protocol>_response()’ 形式のメソッドを持つすべてのハンドラーに対
     してそのメソッドを呼び出し、リクエストのポストプロセスを行います。


File: python.info,  Node: BaseHandler オブジェクト,  Next: HTTPRedirectHandler オブジェクト,  Prev: OpenerDirector オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.3 BaseHandler オブジェクト
.................................

*note BaseHandler: 3f1b. オブジェクトは直接的に役に立つ 2 つのメソッドと
、その他として派生クラスで使われることを想定したメソッドを 提供します。
以下は直接的に使うためのメソッドです:

 -- メソッド: BaseHandler.add_parent (director)

     親オブジェクトとして、 ‘director’ を追加します。

 -- メソッド: BaseHandler.close ()

     全ての親オブジェクトを削除します。

以下の属性およびメソッドは *note BaseHandler: 3f1b. から派生したクラスで
のみ使われます。

     注釈: 慣習的に、 ‘<protocol>_request()’ や ‘<protocol>_response()’
     といったメソッドを定義している サブクラスは ‘*Processor`と名づけ、
     その他は :class:’!*Handler' と名づけることになっています

 -- の属性: BaseHandler.parent

     有効な *note OpenerDirector: 3f18. です。この値は違うプロトコルを使
     って URL を開く場合やエラーを処理する際に使われます。

 -- メソッド: BaseHandler.default_open (req)

     このメソッドは *note BaseHandler: 3f1b. では定義されて 'いません' 。
     しかし、全ての URL をキャッチさせたいなら、サブクラスで定義する 必
     要があります。

     このメソッドが実装されていれば、*note OpenerDirector: 3f18. の親ク
     ラスによって呼び出されます。これは *note OpenerDirector: 3f18. の
     *note open(): 11de. の戻り値で表されるファイルライクオブジェクトか
     、または ‘None’ を返さなければならず、真に想定外の事態が発生した場
     合を除き、*note URLError: 2be. を送出しなければなりません (例えば、
     *note MemoryError: 179e. は *note URLError: 2be. にマップしてはなり
     ません)。

     このメソッドはプロトコル固有のオープンメソッドが呼び出される前に呼
     び出されます。

 -- メソッド: BaseHandler.<protocol>_open(req)

     このメソッドは *note BaseHandler: 3f1b. では定義されて 'いません' 。
     しかしプロトコルの URL をキャッチしたいなら、サブクラスで定義する必
     要があります。

     このメソッドが定義されていた場合、 *note OpenerDirector: 3f18. から
     呼び出されます。戻り値は *note default_open(): 3f40. と同じでなけれ
     ばなりません。

 -- メソッド: BaseHandler.unknown_open (req)

     このメソッドは *note BaseHandler: 3f1b. では定義されて 'いません' 。
     しかし URL を開くための特定のハンドラが登録されていないような URL を
     キャッチしたいなら、サブクラスで定義する必要があります。

     このメソッドが定義されていた場合、 *note parent: 3f46. *note
     OpenerDirector: 3f18. から呼び出されます。戻り値は *note
     default_open(): 3f40. と同じでなければなりません。

 -- メソッド: BaseHandler.http_error_default (req, fp, code, msg, hdrs)

     このメソッドは *note BaseHandler: 3f1b. では定義されて 'いません' 。
     しかしその他の処理されなかった HTTP エラーを処理する機能をもたせた
     いなら、サブクラスで定義する必要があります。このメソッドはエラーに
     遭遇した *note OpenerDirector: 3f18. から自動的に呼び出されます。そ
     の他の状況では普通呼び出すべきではありません。

     *note OpenerDirector: 3f18. will call this method with five
     positional arguments:

       1. *note Request: 11da. オブジェクト

       2. a file-like object with the HTTP error body,

       3. the three-digit code of the error, as a string,

       4. the user-visible explanation of the code, as a string, and

       5. the headers of the error, as a mapping object.

     返される値および送出される例外は *note urlopen(): 307. と同じもので
     なければなりません。

 -- メソッド: BaseHandler.http_error_<nnn>(req, fp, code, msg, hdrs)

     'nnn' は 3 桁の 10 進数からなる HTTP エラーコードでなくてはなりませ
     ん。このメソッドも *note BaseHandler: 3f1b. では定義されていません
     が、サブクラスのインスタンスで定義されていた場合、エラーコード
     'nnn' の HTTP エラーが発生した際に呼び出されます。

     特定の HTTP エラーに対する処理を行うためには、このメソッドをサブク
     ラスでオーバライドする必要があります。

     引数、返される値、および送出される例外は *note
     http_error_default(): 3f47. と同じものでなければなりません。

 -- メソッド: BaseHandler.<protocol>_request(req)

     このメソッドは *note BaseHandler: 3f1b. では '定義されていません' が
     、サブクラスで特定のプロトコルのリクエストのプリプロセスを行いたい
     場合には定義する必要があります。

     このメソッドが定義されていると、親となる *note OpenerDirector:
     3f18. から呼び出されます。その際、 'req' は *note Request: 11da. オ
     ブジェクトになります。戻り値は *note Request: 11da. オブジェクトで
     なければなりません。

 -- メソッド: BaseHandler.<protocol>_response(req, response)

     このメソッドは *note BaseHandler: 3f1b. では '定義されていません' が
     、サブクラスで特定のプロトコルのリクエストのポストプロセスを行いた
     い場合には定義する必要があります。

     このメソッドが定義されていると、親となる *note OpenerDirector:
     3f18. から呼び出されます。その際、 'req' は *note Request: 11da. オ
     ブジェクトになります。 'response' は *note urlopen(): 307. の戻り値
     と同じインターフェースを 実装したオブジェクトになります。戻り値もま
     た、 *note urlopen(): 307. の戻り値と同じインターフェースを実装した
     オブジェクトでなければなりません。


File: python.info,  Node: HTTPRedirectHandler オブジェクト,  Next: HTTPCookieProcessor オブジェクト,  Prev: BaseHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.4 HTTPRedirectHandler オブジェクト
.........................................

     注釈: 一部の HTTP リクエストはこのモジュールのクライアントモードか
     らの操作を要求します。その場合、*note HTTPError: 11e0. が送出されま
     す。さまざまなリダイレクションコードの正確な意味についての詳細は
     RFC 2616(1) を参照してください。

     セキュリティ上の配慮として、HTTPRedirectHandler に HTTP、HTTPS、あ
     るいは FTP の URL ではないリダイレクトされた URL が存在した場合、
     *note HTTPError: 11e0. 例外が送出されます。

 -- メソッド: HTTPRedirectHandler.redirect_request (req, fp, code, msg,
          hdrs, newurl)

     リダイレクトへのレスポンスの *note Request: 11da. または ‘None’ を
     返します。これはサーバーからリダイレクションを受信した時に
     ‘http_error_30*()’ メソッドのデフォルトの実装によって呼び出されます
     。リダイレクションを行わなければならない場合、'newurl' へのリダイレ
     クトを実行するための ‘http_error_30*()’ を許可する新しい *note
     Request: 11da. を返します。その他の場合、この URL を扱うその他のハ
     ンドラーがない場合は *note HTTPError: 11e0. を、他のハンドラーでで
     きそうな場合は ‘None’ を返します。

          注釈: このメソッドのデフォルトの実装は、 RFC 2616(2) に厳密に
          従ったものではありません。 RFC 2616(3) では、 ‘POST’ リクエス
          トに対する 301 および 302 応答が、ユーザの承認なく自動的にリダ
          イレクトされてはならないと述べています。現実には、ブラウザは
          POST を ‘GET’ に変更することで、これらの応答に対して自動的にリ
          ダイレクトを行えるようにしています。デフォルトの実装でも、この
          挙動を再現しています。

 -- メソッド: HTTPRedirectHandler.http_error_301 (req, fp, code, msg,
          hdrs)

     ‘Location:’ か ‘URI:’ のURL にリダイレクトします。このメソッドは
     HTTP における 'moved permanently' レスポンスを取得した際に 親オブジ
     ェクトとなる *note OpenerDirector: 3f18. によって呼び出されます。

 -- メソッド: HTTPRedirectHandler.http_error_302 (req, fp, code, msg,
          hdrs)

     *note http_error_301(): 3f4b. と同じですが、'found' レスポンスに対
     して呼び出されます。

 -- メソッド: HTTPRedirectHandler.http_error_303 (req, fp, code, msg,
          hdrs)

     *note http_error_301(): 3f4b. と同じですが、'see other' レスポンス
     に対して呼び出されます。

 -- メソッド: HTTPRedirectHandler.http_error_307 (req, fp, code, msg,
          hdrs)

     The same as *note http_error_301(): 3f4b, but called for the
     'temporary redirect' response.  It does not allow changing the
     request method from ‘POST’ to ‘GET’.

 -- メソッド: HTTPRedirectHandler.http_error_308 (req, fp, code, msg,
          hdrs)

     The same as *note http_error_301(): 3f4b, but called for the
     'permanent redirect' response.  It does not allow changing the
     request method from ‘POST’ to ‘GET’.

     Added in version 3.11.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2616.html

   (2) https://datatracker.ietf.org/doc/html/rfc2616.html

   (3) https://datatracker.ietf.org/doc/html/rfc2616.html


File: python.info,  Node: HTTPCookieProcessor オブジェクト,  Next: ProxyHandler オブジェクト,  Prev: HTTPRedirectHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.5 HTTPCookieProcessor オブジェクト
.........................................

*note HTTPCookieProcessor: 3f22. インスタンスは属性をひとつだけ持ちます:

 -- の属性: HTTPCookieProcessor.cookiejar

     Cookie の入っている *note http.cookiejar.CookieJar: 3f53. オブジェ
     クトです。


File: python.info,  Node: ProxyHandler オブジェクト,  Next: HTTPPasswordMgr オブジェクト,  Prev: HTTPCookieProcessor オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.6 ProxyHandler オブジェクト
..................................

 -- メソッド: ProxyHandler.<protocol>_open(request)

     *note ProxyHandler: 1db5. は、コンストラクターで与えた辞書
     'proxies' にプロキシが設定されているような 'protocol' すべてについ
     て、メソッド ‘<protocol>_open()’ を持つことになります。このメソッド
     は ‘request.set_proxy()’ を呼び出して、リクエストがプロキシを通過で
     きるように修正します。その後連鎖するハンドラーの中から次のハンドラ
     ーを呼び出して実際にプロトコルを実行します。


File: python.info,  Node: HTTPPasswordMgr オブジェクト,  Next: HTTPPasswordMgrWithPriorAuth オブジェクト,  Prev: ProxyHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.7 HTTPPasswordMgr オブジェクト
.....................................

以下のメソッドは *note HTTPPasswordMgr: 3f23. および *note
HTTPPasswordMgrWithDefaultRealm: 3f24. オブジェクトで利用できます。

 -- メソッド: HTTPPasswordMgr.add_password (realm, uri, user, passwd)

     'uri' は単一の URI でも複数の URI からなるシーケンスでもかまいませ
     ん。 'realm' 、 'user' および 'passwd' は文字列でなくてはなりません
     。このメソッドによって、 'realm' と与えられた URI の上位 URI に対し
     て ‘(user, passwd)’ が認証トークンとして使われるようになります。

 -- メソッド: HTTPPasswordMgr.find_user_password (realm, authuri)

     与えられたレルムおよび URI に対するユーザ名またはパスワードがあれば
     それを取得します。該当するユーザ名／パスワードが存在しない場合、こ
     のメソッドは ‘(None, None)’ を返します。

     *note HTTPPasswordMgrWithDefaultRealm: 3f24. オブジェクトでは、与え
     られた 'realm' に対して該当するユーザ名/パスワードが存在しない場合
     、レルム ‘None’ が検索されます。


File: python.info,  Node: HTTPPasswordMgrWithPriorAuth オブジェクト,  Next: AbstractBasicAuthHandler オブジェクト,  Prev: HTTPPasswordMgr オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.8 HTTPPasswordMgrWithPriorAuth オブジェクト
..................................................

このパスワードマネージャは *note HTTPPasswordMgrWithDefaultRealm: 3f24.
を継承して、認証の証明書を常に送らないといけない URI を追跡する機能をサ
ポートしています。

 -- メソッド: HTTPPasswordMgrWithPriorAuth.add_password (realm, uri,
          user, passwd, is_authenticated=False)

     'realm', 'uri', 'user', 'passwd' は *note
     HTTPPasswordMgr.add_password(): 3f57. のものと同じです。
     'is_authenticated' は、与えられた URI や URI のリストの
     ‘is_authenticated’ フラグの初期値に設定されます。
     'is_authenticated' に ‘True’ を指定した場合は、 'realm' は無視され
     ます。

 -- メソッド: HTTPPasswordMgrWithPriorAuth.find_user_password (realm,
          authuri)

     *note HTTPPasswordMgrWithDefaultRealm: 3f24. オブジェクトに対する同
     名のメソッドと同じです。

 -- メソッド: HTTPPasswordMgrWithPriorAuth.update_authenticated (self,
          uri, is_authenticated=False)

     与えられた 'url' や URI のリストの ‘is_authenticated’ フラグを更新
     します。

 -- メソッド: HTTPPasswordMgrWithPriorAuth.is_authenticated (self,
          authuri)

     与えられた URI の ‘is_authenticated’ フラグの現在の状態を返します。


File: python.info,  Node: AbstractBasicAuthHandler オブジェクト,  Next: HTTPBasicAuthHandler オブジェクト,  Prev: HTTPPasswordMgrWithPriorAuth オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.9 AbstractBasicAuthHandler オブジェクト
..............................................

 -- メソッド: AbstractBasicAuthHandler.http_error_auth_reqed (authreq,
          host, req, headers)

     ユーザ名／パスワードを取得し、再度サーバへのリクエストを試みること
     で、サーバからの認証リクエストを処理します。 'authreq' はリクエスト
     において レルムに関する情報が含まれているヘッダーの名前、 'host' は
     認証を行う対象の URL とパスを指定します、 'req' は (失敗した) *note
     Request: 11da. オブジェクト、そして 'headers' はエラーヘッダーでな
     くてはなりません。

     'host' は、オーソリティ (例 ‘"python.org"’) か、オーソリティコンポ
     ーネントを含む URL (例 ‘"http://python.org"’) です。どちらの場合も
     、オーソリティはユーザ情報コンポーネントを含んではいけません (なの
     で、 ‘"python.org"’ や ‘"python.org:80"’ は正しく、
     ‘"joe:password@python.org"’ は不正です) 。


File: python.info,  Node: HTTPBasicAuthHandler オブジェクト,  Next: ProxyBasicAuthHandler オブジェクト,  Prev: AbstractBasicAuthHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.10 HTTPBasicAuthHandler オブジェクト
...........................................

 -- メソッド: HTTPBasicAuthHandler.http_error_401 (req, fp, code, msg,
          hdrs)

     認証情報がある場合、認証情報付きで再度リクエストを試みます。


File: python.info,  Node: ProxyBasicAuthHandler オブジェクト,  Next: AbstractDigestAuthHandler オブジェクト,  Prev: HTTPBasicAuthHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.11 ProxyBasicAuthHandler オブジェクト
............................................

 -- メソッド: ProxyBasicAuthHandler.http_error_407 (req, fp, code, msg,
          hdrs)

     認証情報がある場合、認証情報付きで再度リクエストを試みます。


File: python.info,  Node: AbstractDigestAuthHandler オブジェクト,  Next: HTTPDigestAuthHandler オブジェクト,  Prev: ProxyBasicAuthHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.12 AbstractDigestAuthHandler オブジェクト
................................................

 -- メソッド: AbstractDigestAuthHandler.http_error_auth_reqed (authreq,
          host, req, headers)

     'authreq' はリクエストにおいてレルムに関する情報が含まれているヘッ
     ダーの名前、 'host' は認証を行う対象のホスト名、 'req' は (失敗した
     ) *note Request: 11da. オブジェクト、そして 'headers' はエラーヘッ
     ダーでなくてはなりません。


File: python.info,  Node: HTTPDigestAuthHandler オブジェクト,  Next: ProxyDigestAuthHandler オブジェクト,  Prev: AbstractDigestAuthHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.13 HTTPDigestAuthHandler オブジェクト
............................................

 -- メソッド: HTTPDigestAuthHandler.http_error_401 (req, fp, code, msg,
          hdrs)

     認証情報がある場合、認証情報付きで再度リクエストを試みます。


File: python.info,  Node: ProxyDigestAuthHandler オブジェクト,  Next: HTTPHandler オブジェクト,  Prev: HTTPDigestAuthHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.14 ProxyDigestAuthHandler オブジェクト
.............................................

 -- メソッド: ProxyDigestAuthHandler.http_error_407 (req, fp, code, msg,
          hdrs)

     認証情報がある場合、認証情報付きで再度リクエストを試みます。


File: python.info,  Node: HTTPHandler オブジェクト,  Next: HTTPSHandler オブジェクト,  Prev: ProxyDigestAuthHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.15 HTTPHandler オブジェクト
..................................

 -- メソッド: HTTPHandler.http_open (req)

     HTTP リクエストを送ります。 ‘req.data’ に応じて、 GET または POST の
     どちらでも送ることができます。


File: python.info,  Node: HTTPSHandler オブジェクト,  Next: FileHandler オブジェクト,  Prev: HTTPHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.16 HTTPSHandler オブジェクト
...................................

 -- メソッド: HTTPSHandler.https_open (req)

     HTTPS リクエストを送ります。 ‘req.data’ に応じて、 GET または POST
     のどちらでも送ることができます。


File: python.info,  Node: FileHandler オブジェクト,  Next: DataHandler オブジェクト,  Prev: HTTPSHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.17 FileHandler オブジェクト
..................................

 -- メソッド: FileHandler.file_open (req)

     ホスト名がない場合、またはホスト名が ‘'localhost'’ の場合にファイル
     をローカルでオープンします。

     バージョン 3.2 で変更: このメソッドはローカルのホスト名に対してのみ
     適用可能です。リモートホスト名が与えられた場合、*note URLError:
     2be. が送出されます。


File: python.info,  Node: DataHandler オブジェクト,  Next: FTPHandler オブジェクト,  Prev: FileHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.18 DataHandler オブジェクト
..................................

 -- メソッド: DataHandler.data_open (req)

     Read a data URL. This kind of URL contains the content encoded in
     the URL itself.  The data URL syntax is specified in RFC 2397(1).
     This implementation ignores white spaces in base64 encoded data
     URLs so the URL may be wrapped in whatever source file it comes
     from.  But even though some browsers don't mind about a missing
     padding at the end of a base64 encoded data URL, this
     implementation will raise a *note ValueError: 2ec. in that case.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2397.html


File: python.info,  Node: FTPHandler オブジェクト,  Next: CacheFTPHandler オブジェクト,  Prev: DataHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.19 FTPHandler オブジェクト
.................................

 -- メソッド: FTPHandler.ftp_open (req)

     'req' で表されるファイルを FTP 越しにオープンします。ログインは常に
     空のユーザネームおよびパスワードで行われます。


File: python.info,  Node: CacheFTPHandler オブジェクト,  Next: UnknownHandler オブジェクト,  Prev: FTPHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.20 CacheFTPHandler オブジェクト
......................................

*note CacheFTPHandler: 1a99. オブジェクトは *note FTPHandler: 3f1e. オブ
ジェクトに以下のメソッドを追加したものです:

 -- メソッド: CacheFTPHandler.setTimeout (t)

     接続のタイムアウトを 't' 秒に設定します。

 -- メソッド: CacheFTPHandler.setMaxConns (m)

     キャッシュ付き接続の最大接続数を 'm' に設定します。


File: python.info,  Node: UnknownHandler オブジェクト,  Next: HTTPErrorProcessor オブジェクト,  Prev: CacheFTPHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.21 UnknownHandler オブジェクト
.....................................

 -- メソッド: UnknownHandler.unknown_open ()

     *note URLError: 2be. 例外を送出します。


File: python.info,  Node: HTTPErrorProcessor オブジェクト,  Next: 使用例<37>,  Prev: UnknownHandler オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.22 HTTPErrorProcessor オブジェクト
.........................................

 -- メソッド: HTTPErrorProcessor.http_response (request, response)

     HTTP エラー応答の処理をします。

     エラーコード 200 の場合、レスポンスオブジェクトを即座に返します。

     200 以外のエラーコードの場合、これは単に ‘http_error_<type>()’ ハン
     ドラーメソッドに *note OpenerDirector.error(): 3f3f. 経由で処理を渡
     します。他にそのエラーを処理するハンドラーがない場合、*note
     HTTPDefaultErrorHandler: 3f1c. は最後に *note HTTPError: 11e0. を送
     出します。

 -- メソッド: HTTPErrorProcessor.https_response (request, response)

     HTTPS エラー応答の処理をします。

     振る舞いは *note http_response(): 3f86. と同じです。


File: python.info,  Node: 使用例<37>,  Next: レガシーインターフェース<2>,  Prev: HTTPErrorProcessor オブジェクト,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.23 使用例
................

以下の例の他に *note urllib
パッケージを使ってインターネット上のリソースを取得するには: 3f8a. に多く
の例があります。

以下の例では、python.org のメインページを取得して、その最初の 300 バイト
分を表示します。

     >>> import urllib.request
     >>> with urllib.request.urlopen('http://www.python.org/') as f:
     ...     print(f.read(300))
     ...
     b'<!doctype html>\n<!--[if lt IE 7]>   <html class="no-js ie6 lt-ie7 lt-ie8 lt-ie9">   <![endif]-->\n<!--[if IE 7]>      <html class="no-js ie7 lt-ie8 lt-ie9">          <![endif]-->\n<!--[if IE 8]>      <html class="no-js ie8 lt-ie9">

urlopen は bytes オブジェクトを返すことに注意してください。これは
urlopen が、HTTP サーバーから受信したバイトストリームのエンコーディング
を自動的に決定できないためです。一般に、返された bytes オブジェクトを文
字列にデコードするためのエンコーディングの決定あるいは推測はプログラム側
が行います。

以下の HTML の仕様ドキュメント ttps://html.spec.whatwg.org/#charset には
HTML や XML ドキュメントでそのエンコーディング情報を指定するさまざまな方
法の一覧があります。

For additional information, see the W3C document:
‘https://www.w3.org/International/questions/qa-html-encoding-declarations’.

python.org ウェブサイトでは 'utf-8' エンコーディングを使用しており、それ
をその meta タグで指定していますので、bytes オブジェクトのデコードも同様
に行います。

     >>> with urllib.request.urlopen('http://www.python.org/') as f:
     ...     print(f.read(100).decode('utf-8'))
     ...
     <!doctype html>
     <!--[if lt IE 7]>   <html class="no-js ie6 lt-ie7 lt-ie8 lt-ie9">   <![endif]-->
     <!-

*note コンテキストマネージャー: 1e1. を使用しないアプローチでも同様の結
果を得ることができます。

     >>> import urllib.request
     >>> f = urllib.request.urlopen('http://www.python.org/')
     >>> try:
     ...     print(f.read(100).decode('utf-8'))
     ... finally:
     ...     f.close()
     ...
     <!doctype html>
     <!--[if lt IE 7]>   <html class="no-js ie6 lt-ie7 lt-ie8 lt-ie9">   <![endif]-->
     <!--

以下の例では、データストリームを CGI の標準入力へ送信し、返されたデータ
を読み込みます。この例は Python が SSL をサポートするように設定してイン
ストールされている場合のみ動作します。

     >>> import urllib.request
     >>> req = urllib.request.Request(url='https://localhost/cgi-bin/test.cgi',
     ...                       data=b'This data is passed to stdin of the CGI')
     >>> with urllib.request.urlopen(req) as f:
     ...     print(f.read().decode('utf-8'))
     ...
     Got Data: "This data is passed to stdin of the CGI"

上の例で使われているサンプルの CGI は以下のようになっています:

     #!/usr/bin/env python
     import sys
     data = sys.stdin.read()
     print('Content-type: text/plain\n\nGot Data: "%s"' % data)

これは *note Request: 11da. を使った ‘PUT’ リクエストの例です:

     import urllib.request
     DATA = b'some data'
     req = urllib.request.Request(url='http://localhost:8080', data=DATA, method='PUT')
     with urllib.request.urlopen(req) as f:
         pass
     print(f.status)
     print(f.reason)

以下はベーシック HTTP 認証の例です:

     import urllib.request
     # Create an OpenerDirector with support for Basic HTTP Authentication...
     auth_handler = urllib.request.HTTPBasicAuthHandler()
     auth_handler.add_password(realm='PDQ Application',
                               uri='https://mahler:8092/site-updates.py',
                               user='klem',
                               passwd='kadidd!ehopper')
     opener = urllib.request.build_opener(auth_handler)
     # ...and install it globally so it can be used with urlopen.
     urllib.request.install_opener(opener)
     with urllib.request.urlopen('http://www.example.com/login.html') as f:
         print(f.read().decode('utf-8'))

*note build_opener(): 309. はデフォルトで沢山のハンドラを提供しており、
その中に *note ProxyHandler: 1db5. があります。デフォルトでは、 *note
ProxyHandler: 1db5. は ‘<scheme>_proxy’ という環境変数を使います。 ここ
で ‘<scheme>’ は URL スキームです。例えば、 HTTP プロキシの URL を得るに
は、環境変数 ‘http_proxy’ を読み出します。

この例では、デフォルトの *note ProxyHandler: 1db5. を置き換えてプログラ
ム的に作成したプロキシ URL を使うようにし、 *note ProxyBasicAuthHandler:
3f28. でプロキシ認証サポートを追加します。

     proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example.com:3128/'})
     proxy_auth_handler = urllib.request.ProxyBasicAuthHandler()
     proxy_auth_handler.add_password('realm', 'host', 'username', 'password')

     opener = urllib.request.build_opener(proxy_handler, proxy_auth_handler)
     # This time, rather than install the OpenerDirector, we use it directly:
     with opener.open('http://www.example.com/login.html') as f:
        print(f.read().decode('utf-8'))

以下は HTTP ヘッダーを追加する例です:

'headers' 引数を使って *note Request: 11da. コンストラクタを呼び出す方法
の他に、以下のようにできます:

     import urllib.request
     req = urllib.request.Request('http://www.example.com/')
     req.add_header('Referer', 'http://www.python.org/')
     # Customize the default User-Agent header value:
     req.add_header('User-Agent', 'urllib-example/0.1 (Contact: . . .)')
     with urllib.request.urlopen(req) as f:
         print(f.read().decode('utf-8'))

*note OpenerDirector: 3f18. は全ての *note Request: 11da. に
‘User-Agent’ ヘッダーを自動的に追加します。これを変更するには以下のよう
にします:

     import urllib.request
     opener = urllib.request.build_opener()
     opener.addheaders = [('User-agent', 'Mozilla/5.0')]
     with opener.open('http://www.example.com/') as f:
        print(f.read().decode('utf-8'))

また、 *note Request: 11da. が *note urlopen(): 307. (や *note
OpenerDirector.open(): 11de.)に渡される際には、いくつかの標準ヘッダー
(‘Content-Length’, ‘Content-Type’ および ‘Host’) も追加されることを忘れ
ないでください。 以下は ‘GET’ メソッドを使ってパラメータを含む URL を取
得するセッションの例です:

     >>> import urllib.request
     >>> import urllib.parse
     >>> params = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
     >>> url = "http://www.musi-cal.com/cgi-bin/query?%s" % params
     >>> with urllib.request.urlopen(url) as f:
     ...     print(f.read().decode('utf-8'))
     ...

以下の例では、‘POST’ メソッドを使用しています。urlencode から出力された
パラメーターは urlopen にデータとして渡される前に bytes にエンコードされ
ていることに注意してください:

     >>> import urllib.request
     >>> import urllib.parse
     >>> data = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
     >>> data = data.encode('ascii')
     >>> with urllib.request.urlopen("http://requestb.in/xrbl82xr", data) as f:
     ...     print(f.read().decode('utf-8'))
     ...

以下の例では、環境変数による設定内容に対して上書きする形で HTTP プロキシ
を明示的に設定しています:

     >>> import urllib.request
     >>> proxies = {'http': 'http://proxy.example.com:8080/'}
     >>> opener = urllib.request.build_opener(urllib.request.ProxyHandler(proxies))
     >>> with opener.open("http://www.python.org") as f:
     ...     f.read().decode('utf-8')
     ...

以下の例では、環境変数による設定内容に対して上書きする形で、まったくプロ
キシを使わないよう設定しています:

     >>> import urllib.request
     >>> opener = urllib.request.build_opener(urllib.request.ProxyHandler({}}))
     >>> with opener.open("http://www.python.org/") as f:
     ...     f.read().decode('utf-8')
     ...


File: python.info,  Node: レガシーインターフェース<2>,  Next: urllib request Restrictions,  Prev: 使用例<37>,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.24 レガシーインターフェース
..................................

以下の関数およびクラスは、Python 2 のモジュール ‘urllib’ (‘urllib2’ では
ありません) から移植されたものです。これらは将来的に廃止されるかもしれま
せん。

 -- の関数: urllib.request.urlretrieve (url, filename=None,
          reporthook=None, data=None)

     URL で表されるネットワークオブジェクトをローカルファイルにコピーし
     ます。 URL がローカルファイルを示している場合は、ファイル名が与えら
     れない限りオブジェクトはコピーされません。戻り値はタプル
     ‘(filename, headers)’ になり、 'filename' はオブジェクトが保存され
     たローカルファイル名、 'headers' は (リモートオブジェクトに対しては
     ) *note urlopen(): 307. が返したオブジェクトの ‘info()’ メソッドが
     返すものすべてになります。例外は *note urlopen(): 307. のものと同じ
     になります。

     The second argument, if present, specifies the file location to
     copy to (if absent, the location will be a tempfile with a
     generated name).  The third argument, if present, is a callable
     that will be called once on establishment of the network connection
     and once after each block read thereafter.  The callable will be
     passed three arguments; a count of blocks transferred so far, a
     block size in bytes, and the total size of the file.  The third
     argument may be ‘-1’ on older FTP servers which do not return a
     file size in response to a retrieval request.

     以下は最も一般的な使用例です:

          >>> import urllib.request
          >>> local_filename, headers = urllib.request.urlretrieve('http://python.org/')
          >>> html = open(local_filename)
          >>> html.close()

     'url' が ‘http:’ スキーム識別子を使用していた場合、任意の引数
     'data' は ‘POST’ リクエストの指定に使用される場合があります (通常の
     リクエストタイプは ‘GET’ です)。引数 'data' は標準
     ‘application/x-www-form-urlencoded’ 形式のバイトオブジェクトでなけ
     ればなりません。 *note urllib.parse.urlencode(): 1095. 関数を参照し
     てください。

     *note urlretrieve(): 308. は、予想 (これは 'Content-Length' ヘッダ
     ーにより通知されるサイズです) よりも取得できるデータ量が少ないこと
     を検知した場合、 *note ContentTooShortError: 3f8d. を発生します。こ
     れは、例えば、ダウンロードが中断された場合などに発生します。

     'Content-Length' はデータ量の下限です: 読み込むデータ量がこれを超え
     ている場合 urlretrieve はそれらも読み込みますが、利用できるデータが
     これを下回った場合、例外が送出されます。

     このような場合にもダウンロードされたデータを取得することは可能で、
     これは exception インスタンスの ‘content’ 属性に保存されています。

     'Content-Length' ヘッダーが与えられなれけば urlretrieve はダウンロ
     ードしたデータのサイズをチェックできません。この場合ダウンロードは
     正常に完了したとみなすしかありません。

 -- の関数: urllib.request.urlcleanup ()

     以前の *note urlretrieve(): 308. 呼び出し後に残っているかもしれない
     一時ファイルをクリーンアップします。


File: python.info,  Node: urllib request Restrictions,  Prev: レガシーインターフェース<2>,  Up: urllib request --- URL を開くための大規模なライブラリ

5.22.4.25 ‘urllib.request’ Restrictions
.......................................

   * 現在、次のプロトコルのみサポートされています: HTTP (バージョン 0.9
     および 1.0)、FTP、ローカルファイル、およびデータ URL

     バージョン 3.4 で変更: データ URL サポートが追加されました。

   * *note urlretrieve(): 308. のキャッシュ機能は、誰かが Expiration
     time ヘッダーの正しい処理をハックする時間を見つけるまで無効にされて
     います。

   * ある URL がキャッシュにあるかどうか調べるような関数があればと思って
     います。

   * 後方互換性のため、 URL がローカルシステム上のファイルを指しているよ
     うに見えるにも関わらずファイルを開くことができなければ、 URL は FTP
     プロトコルを使って再解釈されます。この機能は時として混乱を招くエラ
     ーメッセージを引き起こします。

   * 関数 *note urlopen(): 307. および *note urlretrieve(): 308. は、ネ
     ットワーク接続が確立されるまでの間、一定でない長さの遅延を引き起こ
     すことがあります。このことは、これらの関数を使ってインタラクティブ
     な Web クライアントを構築するのはスレッドなしには難しいことを意味し
     ます。

   * *note urlopen(): 307. あるいは *note urlretrieve(): 308. が返すデー
     タはサーバーから返された生データです。これは (画像のような) バイナ
     リ、プレーンテキスト、あるいは (例えば) HTML などになります。HTTP プ
     ロトコルはレスポンスヘッダー内でタイプ情報を提供しており、
     ‘Content-Type’ ヘッダーを見ることで調査できます。返されたデータが
     HTML の場合、モジュール *note html.parser: 71. を使用してこれを解析
     できます。

   * FTP プロトコルを扱うコードでは、ファイルとディレクトリを区別できま
     せん。このことから、アクセスできないファイルを指している URL からデ
     ータを読み出そうとすると、予期しない動作を引き起こす場合があります
     。 URL が ‘/’ で終わっていれば、ディレクトリを指しているものとみな
     して、それに適した処理を行います。しかし、ファイルの読み出し操作が
     550 エラー (URL が存在しないか、主にパーミッションの理由でアクセス
     できない) になった場合、 URL がディレクトリを指していて、末尾の ‘/’
     を忘れたケースを処理するため、パスをディレクトリとして扱います。こ
     のために、パーミッションのためにアクセスできないファイルを fetch し
     ようとすると、FTP コードはそのファイルを開こうとして 550 エラーに陥
     り、次にディレクトリ一覧を表示しようとするため、誤解を生むような結
     果を引き起こす可能性があるのです。よく調整された制御が必要なら、
     *note ftplib: 62. モジュールを使用します。


File: python.info,  Node: urllib response --- Response classes used by urllib,  Next: urllib parse --- URL を構成要素に解析する,  Prev: urllib request --- URL を開くための大規模なライブラリ,  Up: インターネットプロトコルとサポート

5.22.5 ‘urllib.response’ -- Response classes used by urllib
-----------------------------------------------------------

The ‘urllib.response’ module defines functions and classes which define
a minimal file-like interface, including ‘read()’ and ‘readline()’.
Functions defined by this module are used internally by the
‘urllib.request’ module.  The typical response object is a *note
urllib.response.addinfourl: 3f16. instance:

 -- クラス: urllib.response.addinfourl

      -- の属性: url

          取得されたリソースの URL、主にリダイレクトが発生したかどうかを
          確認するために利用します。

      -- の属性: headers

          Returns the headers of the response in the form of an *note
          EmailMessage: 580. instance.

      -- の属性: status

          Added in version 3.9.

          サーバから返される状態コードです。

      -- メソッド: geturl ()

          バージョン 3.9 で非推奨: 非推奨となったので *note url: 18e8. を
          使用してください。

      -- メソッド: info ()

          バージョン 3.9 で非推奨: 非推奨となったので *note headers:
          3f90. を使用してください。

      -- の属性: code

          バージョン 3.9 で非推奨: 非推奨となったので *note status:
          3f91. を使用してください。

      -- メソッド: getcode ()

          バージョン 3.9 で非推奨: 非推奨となったので *note status:
          3f91. を使用してください。


File: python.info,  Node: urllib parse --- URL を構成要素に解析する,  Next: urllib error --- urllib request によって送出される例外クラス,  Prev: urllib response --- Response classes used by urllib,  Up: インターネットプロトコルとサポート

5.22.6 ‘urllib.parse’ -- URL を構成要素に解析する
-------------------------------------------------

'ソースコード:' Lib/urllib/parse.py(1)

__________________________________________________________________

このモジュールでは URL (Uniform Resource Locator) 文字列をその構成要素
(アドレススキーム、ネットワーク上の位置、パスその他) に分解したり、構成
要素を URL に組みなおしたり、 "相対 URL (relative URL)" を指定した "基底
URL (base URL)" に基づいて絶対 URL に変換するための標準的なインターフェ
ースを定義しています。

このモジュールは Relative Uniform Resource Locators (相対 URL) に関する
インターネット RFC に適合するよう設計されており、次の URL スキームをサポ
ートしています: ‘file’, ‘ftp’, ‘gopher’, ‘hdl’, ‘http’, ‘https’, ‘imap’,
‘itms-services’, ‘mailto’, ‘mms’, ‘news’, ‘nntp’, ‘prospero’, ‘rsync’,
‘rtsp’, ‘rtsps’, ‘rtspu’, ‘sftp’, ‘shttp’, ‘sip’, ‘sips’, ‘snews’,
‘svn’, ‘svn+ssh’, ‘telnet’, ‘wais’, ‘ws’, ‘wss’

'CPython 実装の詳細:' The inclusion of the ‘itms-services’ URL scheme
can prevent an app from passing Apple's App Store review process for the
macOS and iOS App Stores.  Handling for the ‘itms-services’ scheme is
always removed on iOS; on macOS, it 'may' be removed if CPython has been
built with the *note -with-app-store-compliance: 1997. option.

The ‘urllib.parse’ module defines functions that fall into two broad
categories: URL parsing and URL quoting.  These are covered in detail in
the following sections.

This module's functions use the deprecated term ‘netloc’ (or ‘net_loc’),
which was introduced in RFC 1808(2).  However, this term has been
obsoleted by RFC 3986(3), which introduced the term ‘authority’ as its
replacement.  The use of ‘netloc’ is continued for backward
compatibility.

* Menu:

* URL の解析::
* URL parsing security::
* ASCII エンコードバイト列の解析::
* 構造化された解析結果::
* URL のクオート::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/urllib/parse.py

   (2) https://datatracker.ietf.org/doc/html/rfc1808.html

   (3) https://datatracker.ietf.org/doc/html/rfc3986.html


File: python.info,  Node: URL の解析,  Next: URL parsing security,  Up: urllib parse --- URL を構成要素に解析する

5.22.6.1 URL の解析
...................

URL 解析関数は、URL 文字列を各構成要素に分割するか、あるいは URL の構成
要素を組み合わせて URL 文字列を生成します。

 -- の関数: urllib.parse.urlsplit (urlstring, scheme=None,
          allow_fragments=True)

     Parse a URL into five components, returning a 5-item *note named
     tuple: 85e. *note SplitResult: 3f9a. or *note SplitResultBytes:
     3f9b.  This corresponds to the general structure of a URL:
     ‘scheme://netloc/path?query#fragment’.  Each tuple item is a
     string, possibly empty.  The components are not broken up into
     smaller parts (for example, the network location is a single
     string), and % escapes are not expanded.  The delimiters as shown
     above are not part of the result, except for a leading slash in the
     'path' component, which is retained if present.  For example:

          >>> from urllib.parse import urlsplit
          >>> urlsplit("scheme://netloc/path?query#fragment")
          SplitResult(scheme='scheme', netloc='netloc', path='/path',
                      query='query', fragment='fragment')
          >>> o = urlsplit("http://docs.python.org:80/3/library/urllib.parse.html?"
          ...              "highlight=params#url-parsing")
          >>> o
          SplitResult(scheme='http', netloc='docs.python.org:80',
                      path='/3/library/urllib.parse.html',
                      query='highlight=params', fragment='url-parsing')
          >>> o.scheme
          'http'
          >>> o.netloc
          'docs.python.org:80'
          >>> o.hostname
          'docs.python.org'
          >>> o.port
          80
          >>> o._replace(fragment="").geturl()
          'http://docs.python.org:80/3/library/urllib.parse.html?highlight=params'

     Following the syntax specifications in RFC 1808(1), ‘urlsplit()’
     recognizes a netloc only if it is properly introduced by '//'.
     Otherwise the input is presumed to be a relative URL and thus to
     start with a path component.

          >>> from urllib.parse import urlsplit
          >>> urlsplit('//www.cwi.nl:80/%7Eguido/Python.html')
          SplitResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python.html',
                      query='', fragment='')
          >>> urlsplit('www.cwi.nl/%7Eguido/Python.html')
          SplitResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html',
                      query='', fragment='')
          >>> urlsplit('help/Python.html')
          SplitResult(scheme='', netloc='', path='help/Python.html',
                      query='', fragment='')

     'scheme' 引数によってデフォルトのアドレススキームを与えると、アドレ
     ススキームを指定していない URL のみに使用されます。常に許されるデフ
     ォルトの ‘''’ (‘b''’ に自動変換出来る)を除き、 'urlstring' と同じ型
     (テキストもしくはバイト列)であるべきです。

     引数 'allow_fragments' が false の場合、フラグメント識別子は認識さ
     れません。その代わり、それはパス、パラメータ、またはクエリ要素の一
     部として解析され、戻り値の ‘fragment’ は空文字に設定されます。

     戻り値は *note 名前付きタプル: 85e. です。これは、インデックス指定
     もしくは以下のような名前属性で要素にアクセスできることを意味します:

     属性                   インデッ    値                            指定されなかった場合の値
                            クス                                      
                            
     ----------------------------------------------------------------------------------------------
                                                                      
     ‘scheme’               0           URL スキーム                  'scheme' パラメータ
                                                                      
                                                                      
     ‘netloc’               1           ネットワーク上の位置          空文字列
                                                                      
                                                                      
     ‘path’                 2           階層的パス                    空文字列
                                                                      
                                                                      
     ‘query’                3           クエリ要素                    空文字列
                                                                      
                                                                      
     ‘fragment’             4           フラグメント識別子            空文字列
                                                                      
                                                                      
     ‘username’                         ユーザ名                      *note None: 885.
                                                                      
                                                                      
     ‘password’                         パスワード                    *note None: 885.
                                                                      
                                                                      
     ‘hostname’                         ホスト名 (小文字)             *note None: 885.
                                                                      
                                                                      
     ‘port’                             ポート番号を表わす整数 (も    *note None: 885.
                                        しあれば)                     
                                        

     URL中で不正なポートが指定されている場合、 ‘port’ 属性を読みだすと、
     *note ValueError: 2ec. を送出します。結果オブジェクトのより詳しい情
     報は *note 構造化された解析結果: 3f9c. 節を参照してください。

     ‘netloc’ 属性にマッチしなかった角括弧があると *note ValueError:
     2ec. を送出します。

     Characters in the ‘netloc’ attribute that decompose under NFKC
     normalization (as used by the IDNA encoding) into any of ‘/’, ‘?’,
     ‘#’, ‘@’, or ‘:’ will raise a *note ValueError: 2ec.  If the URL is
     decomposed before parsing, no error will be raised.

     Following some of the WHATWG spec(2) that updates RFC 3986(3),
     leading C0 control and space characters are stripped from the URL.
     ‘\n’, ‘\r’ and tab ‘\t’ characters are removed from the URL at any
     position.

     As is the case with all named tuples, the subclass has a few
     additional methods and attributes that are particularly useful.
     One such method is ‘_replace()’.  The ‘_replace()’ method will
     return a new *note SplitResult: 3f9a. object replacing specified
     fields with new values.

          >>> from urllib.parse import urlsplit
          >>> u = urlsplit('//www.cwi.nl:80/%7Eguido/Python.html')
          >>> u
          SplitResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python.html',
                      query='', fragment='')
          >>> u._replace(scheme='http')
          SplitResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/Python.html',
                      query='', fragment='')

          警告: *note urlsplit(): f3a. does not perform validation.  See
          *note URL parsing security: 3f9d. for details.

     バージョン 3.2 で変更: IPv6 URL の解析も行えるようになりました。

     バージョン 3.3 で変更: The fragment is now parsed for all URL
     schemes (unless 'allow_fragments' is false), in accordance with RFC
     3986(4).  Previously, an allowlist of schemes that support
     fragments existed.

     バージョン 3.6 で変更: 範囲外のポート番号を指定すると、 *note None:
     885. を返す代わりに、*note ValueError: 2ec. を送出するようになりま
     した。

     バージョン 3.8 で変更: Characters that affect netloc parsing under
     NFKC normalization will now raise *note ValueError: 2ec.

     バージョン 3.10 で変更: ASCII newline and tab characters are
     stripped from the URL.

     バージョン 3.12 で変更: Leading WHATWG C0 control and space
     characters are stripped from the URL.

 -- の関数: urllib.parse.parse_qs (qs, keep_blank_values=False,
          strict_parsing=False, encoding='utf-8', errors='replace',
          max_num_fields=None, separator='&')

     文字列引数として渡されたクエリ文字列
     (‘application/x-www-form-urlencoded’ 型のデータ) を解析します。解析
     されたデータを辞書として返します。辞書のキーは一意なクエリ変数名で
     、値は各変数名に対する値からなるリストです。

     任意の引数 'keep_blank_values' は、パーセントエンコードされたクエリ
     の中の値が入っていないクエリの値を空白文字列と見なすかどうかを示す
     フラグです。値が真であれば、値の入っていないフィールドは空文字列の
     ままになります。標準では偽で、値の入っていないフィールドを無視し、
     そのフィールドはクエリに含まれていないものとして扱います。

     任意の引数 'strict_parsing' はパース時のエラーをどう扱うかを決める
     フラグです。値が偽なら (デフォルトの設定です)、エラーは暗黙のうちに
     無視します。値が真なら *note ValueError: 2ec. 例外を送出します。

     任意のパラメータ 'encoding' および 'errors' はパーセントエンコード
     されたシーケンスを Unicode 文字にデコードする方法を指定します。これ
     は *note bytes.decode(): ad3. メソッドに渡されます。

     The optional argument 'max_num_fields' is the maximum number of
     fields to read.  If set, then throws a *note ValueError: 2ec. if
     there are more than 'max_num_fields' fields read.

     The optional argument 'separator' is the symbol to use for
     separating the query arguments.  It defaults to ‘&’.

     このような辞書をクエリ文字列に変換するには *note
     urllib.parse.urlencode(): 1095. 関数を (‘doseq’ パラメータに ‘True’
     を指定して) 使用します。

     バージョン 3.2 で変更: 'encoding' および 'errors' パラメータが追加
     されました。

     バージョン 3.8 で変更: 'max_num_fields' パラメータが追加されました
     。

     バージョン 3.10 で変更: Added 'separator' parameter with the
     default value of ‘&’.  Python versions earlier than Python 3.10
     allowed using both ‘;’ and ‘&’ as query parameter separator.  This
     has been changed to allow only a single separator key, with ‘&’ as
     the default separator.

     バージョン 3.14 で非推奨: Accepting objects with false values (like
     ‘0’ and ‘[]’) except empty strings and byte-like objects and ‘None’
     is now deprecated.

 -- の関数: urllib.parse.parse_qsl (qs, keep_blank_values=False,
          strict_parsing=False, encoding='utf-8', errors='replace',
          max_num_fields=None, separator='&')

     文字列引数として渡されたクエリ文字列
     (‘application/x-www-form-urlencoded’ 型のデータ) を解析します。解析
     されたデータは名前と値のペアからなるリストです。

     任意の引数 'keep_blank_values' は、パーセントエンコードされたクエリ
     の中の値が入っていないクエリの値を空白文字列と見なすかどうかを示す
     フラグです。値が真であれば、値の入っていないフィールドは空文字列の
     ままになります。標準では偽で、値の入っていないフィールドを無視し、
     そのフィールドはクエリに含まれていないものとして扱います。

     任意の引数 'strict_parsing' はパース時のエラーをどう扱うかを決める
     フラグです。値が偽なら (デフォルトの設定です)、エラーは暗黙のうちに
     無視します。値が真なら *note ValueError: 2ec. 例外を送出します。

     任意のパラメータ 'encoding' および 'errors' はパーセントエンコード
     されたシーケンスを Unicode 文字にデコードする方法を指定します。これ
     は *note bytes.decode(): ad3. メソッドに渡されます。

     The optional argument 'max_num_fields' is the maximum number of
     fields to read.  If set, then throws a *note ValueError: 2ec. if
     there are more than 'max_num_fields' fields read.

     The optional argument 'separator' is the symbol to use for
     separating the query arguments.  It defaults to ‘&’.

     ペアのリストからクエリ文字列を生成する場合には *note
     urllib.parse.urlencode(): 1095. 関数を使用します。

     バージョン 3.2 で変更: 'encoding' および 'errors' パラメータが追加
     されました。

     バージョン 3.8 で変更: 'max_num_fields' パラメータが追加されました
     。

     バージョン 3.10 で変更: Added 'separator' parameter with the
     default value of ‘&’.  Python versions earlier than Python 3.10
     allowed using both ‘;’ and ‘&’ as query parameter separator.  This
     has been changed to allow only a single separator key, with ‘&’ as
     the default separator.

 -- の関数: urllib.parse.urlunsplit (parts)

     Construct a URL from a tuple as returned by ‘urlsplit()’.  The
     'parts' argument can be any five-item iterable.  This may result in
     a slightly different, but equivalent URL, if the URL that was
     parsed originally had unnecessary delimiters (for example, a ‘?’
     with an empty query; the RFC states that these are equivalent).

 -- の関数: urllib.parse.urlparse (urlstring, scheme=None,
          allow_fragments=True)

     This is similar to *note urlsplit(): f3a, but additionally splits
     the 'path' component on 'path' and 'params'.  This function returns
     a 6-item *note named tuple: 85e. *note ParseResult: 3f9e. or *note
     ParseResultBytes: 3f9f.  Its items are the same as for the
     ‘urlsplit()’ result, except that 'params' is inserted at index 3,
     between 'path' and 'query'.

     This function is based on obsoleted RFC 1738(5) and RFC 1808(6),
     which listed 'params' as the main URL component.  The more recent
     URL syntax allows parameters to be applied to each segment of the
     'path' portion of the URL (see RFC 3986(7)).  *note urlsplit():
     f3a. should generally be used instead of *note urlparse(): 362.  A
     separate function is needed to separate the path segments and
     parameters.

 -- の関数: urllib.parse.urlunparse (parts)

     Combine the elements of a tuple as returned by *note urlparse():
     362. into a complete URL as a string.  The 'parts' argument can be
     any six-item iterable.  This may result in a slightly different,
     but equivalent URL, if the URL that was parsed originally had
     unnecessary delimiters (for example, a ?  with an empty query; the
     RFC states that these are equivalent).

 -- の関数: urllib.parse.urljoin (base, url, allow_fragments=True)

     "基底 URL"('base')と別のURL('url')を組み合わせて、完全な URL ("絶対
     URL") を構成します。くだけて言えば、この関数は相対 URL にない要素を
     提供するために基底 URL の要素、特にアドレススキーム、ネットワーク上
     の位置、およびパス (の一部) を使います。例えば:

          >>> from urllib.parse import urljoin
          >>> urljoin('http://www.cwi.nl/%7Eguido/Python.html', 'FAQ.html')
          'http://www.cwi.nl/%7Eguido/FAQ.html'

     The 'allow_fragments' argument has the same meaning and default as
     for *note urlsplit(): f3a.

          注釈: 'url' が (‘//’ か ‘scheme://’ で始まる) 絶対URLであれば
          、その 'url' のホスト名と / もしくは scheme は結果に反映されま
          す。例えば:

               >>> urljoin('http://www.cwi.nl/%7Eguido/Python.html',
               ...         '//www.python.org/%7Eguido')
               'http://www.python.org/%7Eguido'

          もしこの動作が望みのものでない場合は、 'url' を *note
          urlsplit(): f3a. と *note urlunsplit(): 193e. で先に処理して、
          'scheme' と 'netloc' を削除してください。

          警告: Because an absolute URL may be passed as the ‘url’
          parameter, it is generally 'not secure' to use ‘urljoin’ with
          an attacker-controlled ‘url’.  For example in,
          ‘urljoin("https://website.com/users/", username)’, if
          ‘username’ can contain an absolute URL, the result of
          ‘urljoin’ will be the absolute URL.

     バージョン 3.5 で変更: RFC 3986(8) で定義された意味論とマッチするよ
     うに挙動がアップデートされました。

 -- の関数: urllib.parse.urldefrag (url)

     'url' がフラグメント識別子を含む場合、フラグメント識別子を持たない
     バージョンに修正された 'url' と、別の文字列に分割されたフラグメント
     識別子を返します。'url' 中にフラグメント識別子がない場合、そのまま
     の 'url' と空文字列を返します。

     戻り値は *note 名前付きタプル: 85e. で、インデックスによってもしく
     は名前属性として要素にアクセスできます:

     属性                   インデッ    値                            指定されなかった場合の値
                            クス                                      
                            
     --------------------------------------------------------------------------------------------
                                                                      
     ‘url’                  0           フラグメントのない URL        空文字列
                                                                      
                                                                      
     ‘fragment’             1           フラグメント識別子            空文字列
                                                                      

     結果オブジェクトのより詳しい情報は *note 構造化された解析結果:
     3f9c. 節を参照してください。

     バージョン 3.2 で変更: 結果はシンプルな 2 要素のタプルから構造化オ
     ブジェクトに変更されました。

 -- の関数: urllib.parse.unwrap (url)

     Extract the url from a wrapped URL (that is, a string formatted as
     ‘<URL:scheme://host/path>’, ‘<scheme://host/path>’,
     ‘URL:scheme://host/path’ or ‘scheme://host/path’).  If 'url' is not
     a wrapped URL, it is returned without changes.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc1808.html

   (2) https://url.spec.whatwg.org/#concept-basic-url-parser

   (3) https://datatracker.ietf.org/doc/html/rfc3986.html

   (4) https://datatracker.ietf.org/doc/html/rfc3986.html

   (5) https://datatracker.ietf.org/doc/html/rfc1738.html

   (6) https://datatracker.ietf.org/doc/html/rfc1808.html

   (7) https://datatracker.ietf.org/doc/html/rfc3986.html

   (8) https://datatracker.ietf.org/doc/html/rfc3986.html


File: python.info,  Node: URL parsing security,  Next: ASCII エンコードバイト列の解析,  Prev: URL の解析,  Up: urllib parse --- URL を構成要素に解析する

5.22.6.2 URL parsing security
.............................

The *note urlsplit(): f3a. and *note urlparse(): 362. APIs do not
perform 'validation' of inputs.  They may not raise errors on inputs
that other applications consider invalid.  They may also succeed on some
inputs that might not be considered URLs elsewhere.  Their purpose is
for practical functionality rather than purity.

Instead of raising an exception on unusual input, they may instead
return some component parts as empty strings.  Or components may contain
more than perhaps they should.

We recommend that users of these APIs where the values may be used
anywhere with security implications code defensively.  Do some
verification within your code before trusting a returned component part.
Does that ‘scheme’ make sense?  Is that a sensible ‘path’?  Is there
anything strange about that ‘hostname’?  etc.

What constitutes a URL is not universally well defined.  Different
applications have different needs and desired constraints.  For instance
the living WHATWG spec(1) describes what user facing web clients such as
a web browser require.  While RFC 3986(2) is more general.  These
functions incorporate some aspects of both, but cannot be claimed
compliant with either.  The APIs and existing user code with
expectations on specific behaviors predate both standards leading us to
be very cautious about making API behavior changes.

   ---------- Footnotes ----------

   (1) https://url.spec.whatwg.org/#concept-basic-url-parser

   (2) https://datatracker.ietf.org/doc/html/rfc3986.html


File: python.info,  Node: ASCII エンコードバイト列の解析,  Next: 構造化された解析結果,  Prev: URL parsing security,  Up: urllib parse --- URL を構成要素に解析する

5.22.6.3 ASCII エンコードバイト列の解析
.......................................

URL を解析する関数は元々文字列のみ操作するよう設計されていました。実際の
ところ、それは URL が正しくクオートされエンコードされた ASCII バイト列を
操作できた方が有用でした。結果的にこのモジュールの URL 解析関数はすべて
*note bytes: 192. および *note bytearray: 344. オブジェクトに加えて
*note str: 169. オブジェクトでも処理するようになりました。

*note str: 169. データが渡された場合、戻り値は *note str: 169. データの
みを含んだものになります。*note bytes: 192. あるいは *note bytearray:
344. が渡された場合、戻り値は *note bytes: 192. データのみを含んだものに
なります。

単一の関数を呼び出す時に *note bytes: 192. または *note bytearray: 344.
が混在した *note str: 169. を渡した場合、*note TypeError: 198. が、非
ASCII バイト値が渡された場合 *note UnicodeDecodeError: c08. が送出されま
す。

*note str: 169. と *note bytes: 192. 間で容易に変換を行えるよう、すべて
の URL 解析関数は ‘encode()’ メソッド (結果に *note str: 169. データが含
まれる時用) か ‘decode()’ メソッド (結果に *note bytes: 192. データが含
まれる時用) のどちらかを提供しています。これらメソッドの動作は対応する
*note str: 169. と *note bytes: 192. メソッドが持つものと同じです (ただ
しデフォルトのエンコーディングは ‘'utf-8'’ ではなく ‘'ascii'’ になります
)。それぞれは ‘encode()’ メソッドを持つ *note bytes: 192. データか
‘decode()’ メソッドを持つ *note str: 169. データのどちらかに対応した型を
生成します。

非 ASCII データを含むなど、不適切にクオートされた URL を操作する可能性の
あるアプリケーションでは、URL 解析メソッドを呼び出す前に独自にバイト列か
ら文字列にデコードする必要があります。

この項で説明された挙動は URL 解析関数にのみ該当します。URL クオート関数
でバイトシーケンスを生成もしくは消化する際には、別にURL クオート関数の項
で詳説されている通りのルールに従います。

バージョン 3.2 で変更: URL 解析関数は ASCII エンコードバイトシーケンスも
受け付けるようになりました


File: python.info,  Node: 構造化された解析結果,  Next: URL のクオート,  Prev: ASCII エンコードバイト列の解析,  Up: urllib parse --- URL を構成要素に解析する

5.22.6.4 構造化された解析結果
.............................

The result objects from the *note urlsplit(): f3a, *note urlparse():
362. and *note urldefrag(): 145f. functions are subclasses of the *note
tuple: 614. type.  These subclasses add the attributes listed in the
documentation for those functions, the encoding and decoding support
described in the previous section, as well as an additional method:

 -- メソッド: urllib.parse.SplitResult.geturl ()

     オリジナルの URL を再結合した場合は文字列で返されます。これはスキー
     ムが小文字に正規化されていたり、空の構成要素が除去されるなど、オリ
     ジナルの URL とは異なる場合があります。特に、空のパラメータ、クエリ
     、およびフラグメント識別子は削除されます。

     *note urldefrag(): 145f. の戻り値では、空のフラグメント識別子のみ削
     除されます。*note urlsplit(): f3a. および *note urlparse(): 362. の
     戻り値では、このメソッドが返す URL には説明されているすべての変更が
     加えられます。

     加えた解析関数を逆に行えばこのメソッドの戻り値は元の URL になります
     :

          >>> from urllib.parse import urlsplit
          >>> url = 'HTTP://www.Python.org/doc/#'
          >>> r1 = urlsplit(url)
          >>> r1.geturl()
          'http://www.Python.org/doc/'
          >>> r2 = urlsplit(r1.geturl())
          >>> r2.geturl()
          'http://www.Python.org/doc/'

以下のクラスは *note str: 169. オブジェクトを操作した場合、構造化された
解析結果の実装を提供します:

 -- クラス: urllib.parse.DefragResult (url, fragment)

     *note urldefrag(): 145f. の具象クラスの結果には *note str: 169. デ
     ータが含まれます。‘encode()’ メソッドは *note DefragResultBytes:
     3fa6. インスタンスを返します。

     Added in version 3.2.

 -- クラス: urllib.parse.ParseResult (scheme, netloc, path, params,
          query, fragment)

     *note urlparse(): 362. の具象クラスの結果には *note str: 169. デー
     タが含まれます。‘encode()’ メソッドは *note ParseResultBytes: 3f9f.
     インスタンスを返します。

 -- クラス: urllib.parse.SplitResult (scheme, netloc, path, query,
          fragment)

     *note urlsplit(): f3a. の具象クラスの結果には *note str: 169. デー
     タが含まれます。‘encode()’ メソッドは *note SplitResultBytes: 3f9b.
     インスタンスを返します。

以下のクラスは *note bytes: 192. または *note bytearray: 344. オブジェク
トを操作した時に解析結果の実装を提供します:

 -- クラス: urllib.parse.DefragResultBytes (url, fragment)

     *note urldefrag(): 145f. の具象クラスの結果には *note bytes: 192. デ
     ータが含まれます。‘decode()’ メソッドは *note DefragResult: 3fa5. イ
     ンスタンスを返します。

     Added in version 3.2.

 -- クラス: urllib.parse.ParseResultBytes (scheme, netloc, path, params,
          query, fragment)

     *note urlparse(): 362. の具象クラスの結果には *note bytes: 192. が
     含まれます。‘decode()’ メソッドは *note ParseResult: 3f9e. インスタ
     ンスを返します。

     Added in version 3.2.

 -- クラス: urllib.parse.SplitResultBytes (scheme, netloc, path, query,
          fragment)

     *note urlsplit(): f3a. の具象クラスの結果には *note bytes: 192. デ
     ータが含まれます。‘decode()’ メソッドは *note SplitResult: 3f9a. イ
     ンスタンスを返します。

     Added in version 3.2.


File: python.info,  Node: URL のクオート,  Prev: 構造化された解析結果,  Up: urllib parse --- URL を構成要素に解析する

5.22.6.5 URL のクオート
.......................

URL クオート関数は、プログラムデータを取り URL 構成要素として使用できる
よう特殊文字をクオートしたり非 ASCII 文字を適切にエンコードすることに焦
点を当てています。これらは上述の URL 解析関数でカバーされていない URL 構
成要素からオリジナルデータの再作成もサポートしています。

 -- の関数: urllib.parse.quote (string, safe='/', encoding=None,
          errors=None)

     'string' 内の特殊文字を ‘%XX’ を使用してエスケープします。文字、数
     字、および ‘'_.-~'’ はクオートされません。デフォルトでは、この関数
     は URL のパス部分のクオートのために用意されています。任意のパラメー
     タ 'safe' を指定すると、指定した ASCII 文字もクオートされません。デ
     フォルトは ‘'/'’ です。

     'string' に使用できるのは *note str: 169. か *note bytes: 192. オブ
     ジェクトです。

     バージョン 3.7 で変更: Moved from RFC 2396(1) to RFC 3986(2) for
     quoting URL strings.  "~" is now included in the set of unreserved
     characters.

     任意のパラメータ 'encoding' と 'errors' は *note str.encode(): ad2.
     で受け付けられる非 ASCII 文字への対処法を指定します。'encoding' の
     デフォルトは ‘'utf-8'’、'errors' のデフォルトは ‘'strict'’ で、非サ
     ポート文字があると *note UnicodeEncodeError: 887. を送出します。
     'string' が *note bytes: 192. の場合 'encoding' と 'errors' を指定
     してはいけません。指定すると *note TypeError: 198. が送出されます。

     ‘quote(string, safe, encoding, errors)’ は
     ‘quote_from_bytes(string.encode(encoding, errors), safe)’ と等価で
     あることに留意してください。

     例: ‘quote('/El Niño/')’ は ‘'/El%20Ni%C3%B1o/'’ を返します。

 -- の関数: urllib.parse.quote_plus (string, safe='', encoding=None,
          errors=None)

     Like *note quote(): d9c, but also replace spaces with plus signs,
     as required for quoting HTML form values when building up a query
     string to go into a URL. Plus signs in the original string are
     escaped unless they are included in 'safe'.  It also does not have
     'safe' default to ‘'/'’.

     例: ‘quote_plus('/El Niño/')’ は ‘'%2FEl+Ni%C3%B1o%2F'’ を返します
     。

 -- の関数: urllib.parse.quote_from_bytes (bytes, safe='/')

     *note quote(): d9c. と似ていますが、*note str: 169. ではなく *note
     bytes: 192. オブジェクトを取り、文字列からバイト列へのエンコードを
     行いません。

     例: ‘quote_from_bytes(b'a&\xef')’ は ‘'a%26%EF'’ を返します。

 -- の関数: urllib.parse.unquote (string, encoding='utf-8',
          errors='replace')

     エスケープされた ‘%XX’ をそれに対応した単一文字に置き換えます。オプ
     ション引数の 'encoding' と 'errors' は *note bytes.decode(): ad3. メ
     ソッドで受け付けられるパーセントエンコードされたシーケンスから
     Unicode 文字へのデコード法を指定します。

     'string' に使用できるのは *note str: 169. か *note bytes: 192. オブ
     ジェクトです。

     'encoding' のデフォルトは ‘'utf-8'’、'errors' のデフォルトは
     ‘'replace'’ で、不正なシーケンスはプレースホルダー文字に置き換えら
     れます。

     例: ‘unquote('/El%20Ni%C3%B1o/')’ は ‘'/El Niño/'’ を返します。

     バージョン 3.9 で変更: 'string' parameter supports bytes and str
     objects (previously only str).

 -- の関数: urllib.parse.unquote_plus (string, encoding='utf-8',
          errors='replace')

     *note unquote(): 1afb. と似ていますが、HTML フォームの値のアンクオ
     ートのために「+」を空白に置き換えます。

     'string' は *note str: 169. でなければなりません。

     例: ‘unquote_plus('/El+Ni%C3%B1o/')’ は ‘'/El Niño/'’ を返します。

 -- の関数: urllib.parse.unquote_to_bytes (string)

     スケープされた ‘%XX’ をそれに対応した 1 オクテットに置き換え、*note
     bytes: 192. オブジェクトを返します。

     'string' に使用できるのは *note str: 169. か *note bytes: 192. オブ
     ジェクトです。

     *note str: 169. だった場合、'string' 内のエスケープされていない非
     ASCII 文字は UTF-8 バイト列にエンコードされます。

     例: ‘unquote_to_bytes('a%26%EF')’ は ‘b'a&\xef'’ を返します。

 -- の関数: urllib.parse.urlencode (query, doseq=False, safe='',
          encoding=None, errors=None, quote_via=quote_plus)

     マッピング型オブジェクトまたは 2 個の要素からなるタプルのシーケンス
     (*note str: 169. か *note bytes: 192. オブジェクトが含まれているか
     もしれません) を、パーセントエンコードされた ASCII 文字列に変換しま
     す。戻り値の文字列が *note urlopen(): 307. 関数での POST 操作の
     'data' で使用される場合はバイト列にエンコードしなければなりません。
     そうでない場合は *note TypeError: 198. が送出されます。

     戻り値は ‘'&'’ 文字で区切られた ‘key=value’ のペアからなる一組の文
     字列になります。 'key' と 'value' は 'quote_via' を使用してクオート
     されます。デフォルトで、値をクォートするために *note quote_plus():
     1460. が使用されます。つまり、スペースは ‘'+'’ 文字に、 '/' 文字は
     ‘%2F’ にクォートされます。これは GET リクエストの標準に準拠します
     (‘application/x-www-form-urlencoded’)。 'quote_via' として渡すこと
     ができる別の関数は *note quote(): d9c. です。それはスペースを ‘%20’
     にエンコードし、 '/' をエンコードしません。何がクォートされるかを最
     大限コントロールしたければ、 ‘quote’ を使って 'safe' に値を指定して
     ください。

     引数 'query' が 2 要素のタプルのシーケンスの場合、各タプルの第一要
     素はキーに、第二要素は値になります。 値となる要素はシーケンスを取る
     こともでき、この場合、オプションのパラメーター 'doseq' が ‘True’ と
     評価されるのであれば、キーに対し値シーケンスの各要素を個別に結び付
     けた ‘key=value’ のペアを、 ‘'&'’ 文字でつないだものを生成します。
     エンコードされた文字列内のパラメーターの順序はシーケンス内のパラメ
     ータータプルの順序と一致します。

     'safe', 'encoding', および 'errors' パラメータは 'quote_via' にその
     まま渡されます (クエリ要素が *note str: 169. の場合は、 'encoding'
     と 'errors' パラメータだけが渡されます)。

     このエンコード処理の逆を行うには、このモジュールで提供されている
     *note parse_qs(): 31f. と *note parse_qsl(): 31e. を使用して、クエ
     リ文字列を Python データ構造に変換できます。

     POST リクエストのデータ、あるいは URL クエリ文字列を生成するために
     、 *note urllib.parse.urlencode(): 1095. メソッドをどのように使えば
     よいかを見るには、*note urllib の使用例: 3f8b. を参照してください。

     バージョン 3.2 で変更: 'query' はバイト列と文字列オブジェクトをサポ
     ートします。

     バージョン 3.5 で変更: 'quote_via' パラメータが追加されました。

     バージョン 3.14 で非推奨: Accepting objects with false values (like
     ‘0’ and ‘[]’) except empty strings and byte-like objects and ‘None’
     is now deprecated.

参考
....

WHATWG(3) - URL Living standard

     Working Group for the URL Standard that defines URLs, domains, IP
     addresses, the application/x-www-form-urlencoded format, and their
     API.

RFC 3986(4) - Uniform Resource Identifiers

     これが現在の標準規格 (STD66) です。urllib.parse モジュールに対する
     すべての変更はこの規格に準拠していなければなりませんが、若干の逸脱
     はありえます。これは主には後方互換性のため、また主要なブラウザで一
     般的に見られる、URL を解析する上でのいくつかの事実上の要件を満たす
     ためです。

RFC 2732(5) - Format for Literal IPv6 Addresses in URL's.

     この規格は IPv6 の URL を解析するときの要求事項を記述しています。

RFC 2396(6) - Uniform Resource Identifiers (URI): Generic Syntax

     この RFC では Uniform Resource Name (URN) と Uniform Resource
     Locator (URL) の両方に対する一般的な文法的要求事項を記述しています
     。

RFC 2368(7) - The mailto URL scheme.

     mailto URL スキームに対する文法的要求事項です。

RFC 1808(8) - Relative Uniform Resource Locators

     この RFC には絶対 URL と相対 URL を結合するための規則がボーダケース
     の取扱い方を決定する "異常な例" つきで収められています。

RFC 1738(9) - Uniform Resource Locators (URL)

     この RFC では絶対 URL の形式的な文法と意味付けを仕様化しています。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2396.html

   (2) https://datatracker.ietf.org/doc/html/rfc3986.html

   (3) https://url.spec.whatwg.org/

   (4) https://datatracker.ietf.org/doc/html/rfc3986.html

   (5) https://datatracker.ietf.org/doc/html/rfc2732.html

   (6) https://datatracker.ietf.org/doc/html/rfc2396.html

   (7) https://datatracker.ietf.org/doc/html/rfc2368.html

   (8) https://datatracker.ietf.org/doc/html/rfc1808.html

   (9) https://datatracker.ietf.org/doc/html/rfc1738.html


File: python.info,  Node: urllib error --- urllib request によって送出される例外クラス,  Next: urllib robotparser --- robots txt 用のパーサー,  Prev: urllib parse --- URL を構成要素に解析する,  Up: インターネットプロトコルとサポート

5.22.7 ‘urllib.error’ -- urllib.request によって送出される例外クラス
--------------------------------------------------------------------

'ソースコード:' Lib/urllib/error.py(1)

__________________________________________________________________

The ‘urllib.error’ module defines the exception classes for exceptions
raised by *note urllib.request: 111.  The base exception class is *note
URLError: 2be.

The following exceptions are raised by ‘urllib.error’ as appropriate:

 -- 例外: urllib.error.URLError

     ハンドラが何らかの問題に遭遇した場合、この例外 (またはこの例外から
     派生した例外)を送出します。この例外は *note OSError: 2c0. のサブク
     ラスです。

      -- の属性: reason

          このエラーの理由。メッセージ文字列あるいは他の例外インスタンス
          です。

     バージョン 3.3 で変更: *note URLError: 2be. は以前は *note IOError:
     125e. のサブタイプでしたが、 *note OSError: 2c0. のエイリアスになり
     ました。

 -- 例外: urllib.error.HTTPError (url, code, msg, hdrs, fp)

     *note HTTPError: 11e0. は例外 (*note URLError: 2be. のサブクラス) で
     すが、同時に例外ではない file-like な戻り値を返す関数でもあります
     (*note urlopen(): 307. の戻り値と同じです)。これは、例えばサーバか
     らの認証リクエストのように、変わった HTTP エラーを処理するのに役立
     ちます。

      -- の属性: url

          リクエスト URL を含みます。 'filename' 属性のエイリアスです。

      -- の属性: code

          RFC 2616(2) に定義されているHTTPステータスコード。 この数値型
          の値は、 *note http.server.BaseHTTPRequestHandler.responses:
          3faf. の辞書に登録されているコードに対応します。

      -- の属性: reason

          これは通常、このエラーの原因を説明する文字列です。 'msg' 属性
          のエイリアスです。

      -- の属性: headers

          *note HTTPError: 11e0. の原因となった HTTP リクエストの HTTP レ
          スポンスヘッダ。 'hdrs' 属性のエイリアスです。

          Added in version 3.4.

      -- の属性: fp

          HTTP エラーの body を読み出し可能なファイルライクオブジェクト
          。

 -- 例外: urllib.error.ContentTooShortError (msg, content)

     この例外は *note urlretrieve(): 308. 関数が、ダウンロードされたデー
     タの量が予期した量 ('Content-Length' ヘッダで与えられる) よりも少な
     いことを検知した際に発生します。

      -- の属性: content

          ダウンロードされた、 (おそらく切り捨てられた) データ。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/urllib/error.py

   (2) https://datatracker.ietf.org/doc/html/rfc2616.html


File: python.info,  Node: urllib robotparser --- robots txt 用のパーサー,  Next: http --- HTTP モジュール群,  Prev: urllib error --- urllib request によって送出される例外クラス,  Up: インターネットプロトコルとサポート

5.22.8 ‘urllib.robotparser’ -- robots.txt 用のパーサー
------------------------------------------------------

'ソースコード:' Lib/urllib/robotparser.py(1)

__________________________________________________________________

This module provides a single class, *note RobotFileParser: efa, which
answers questions about whether or not a particular user agent can fetch
a URL on the website that published the ‘robots.txt’ file.  For more
details on the structure of ‘robots.txt’ files, see
‘http://www.robotstxt.org/orig.html’.

 -- クラス: urllib.robotparser.RobotFileParser (url='')

     'url' の ‘robots.txt’ に対し読み込み、パーズ、応答するメソッドを提
     供します。

      -- メソッド: set_url (url)

          ‘robots.txt’ ファイルを参照するための URL を設定します。

      -- メソッド: read ()

          ‘robots.txt’ URL を読み出し、パーザに入力します。

      -- メソッド: parse (lines)

          引数 'lines' の内容を解釈します。

      -- メソッド: can_fetch (useragent, url)

          解釈された ‘robots.txt’ ファイル中に記載された規則に従ったとき
          、 'useragent' が 'url' を取得してもよい場合には ‘True’ を返し
          ます。

      -- メソッド: mtime ()

          ‘robots.txt’ ファイルを最後に取得した時刻を返します。この値は
          、定期的に新たな ‘robots.txt’ をチェックする必要がある、長時間
          動作する Web スパイダープログラムを実装する際に便利です。

      -- メソッド: modified ()

          ‘robots.txt’ ファイルを最後に取得した時刻を現在の時刻に設定し
          ます。

      -- メソッド: crawl_delay (useragent)

          当該の 'ユーザーエージェント' 用の ‘robots.txt’ の
          ‘Crawl-delay’ パラメーターの値を返します。そのようなパラメータ
          ーが存在しないか、指定された 'ユーザーエージェント' にあてはま
          らない、もしくは ‘robots.txt’ のこのパラメーターのエントリの構
          文が無効な場合は、 ‘None’ を返します。

          Added in version 3.6.

      -- メソッド: request_rate (useragent)

          ‘robots.txt’ の ‘Request-rate’ パラメーターの内容を *note
          named tuple: 85e. ‘RequestRate(requests, seconds)’ として返し
          ます。そのようなパラメーターが存在しないか、指定された 'ユーザ
          ーエージェント' にあてはまらない、もしくは ‘robots.txt’ のこの
          パラメーターのエントリの構文が無効な場合は、 ‘None’ を返します
          。

          Added in version 3.6.

      -- メソッド: site_maps ()

          ‘robots.txt’ の ‘Sitemap’ パラメーターの内容を *note list():
          24d. の形式で返します。そのようなパラメーターが存在しないか、
          ‘robots.txt’ のこのパラメーターのエントリの構文が無効な場合は
          、 ‘None’ を返します。

          Added in version 3.8.

以下に *note RobotFileParser: efa. クラスの利用例を示します。

     >>> import urllib.robotparser
     >>> rp = urllib.robotparser.RobotFileParser()
     >>> rp.set_url("http://www.pythontest.net/robots.txt")
     >>> rp.read()
     >>> rrate = rp.request_rate("*")
     >>> rrate.requests
     1
     >>> rrate.seconds
     1
     >>> rp.crawl_delay("*")
     6
     >>> rp.can_fetch("*", "http://www.pythontest.net/")
     True
     >>> rp.can_fetch("*", "http://www.pythontest.net/no-robots-here/")
     False

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/urllib/robotparser.py


File: python.info,  Node: http --- HTTP モジュール群,  Next: http client --- HTTP プロトコルクライアント,  Prev: urllib robotparser --- robots txt 用のパーサー,  Up: インターネットプロトコルとサポート

5.22.9 ‘http’ -- HTTP モジュール群
----------------------------------

'ソースコード:' Lib/http/__init__.py(1)

__________________________________________________________________

‘http’ is a package that collects several modules for working with the
HyperText Transfer Protocol:

   * *note http.client: 73. は低水準のHTTPプロトコルのクライアントです。
     高水準の URL を開く操作には *note urllib.request: 111. を使ってくだ
     さい

   * *note http.server: 76. は *note socketserver: d2. をベースにした基
     礎的な HTTP サーバーを実装しています

   * *note http.cookies: 75. は cookie の状態管理を実装するためのユーテ
     ィリティーを提供しています

   * *note http.cookiejar: 74. は cookie の永続化機能を提供しています

The ‘http’ module also defines the following enums that help you work
with http related code:

 -- クラス: http.HTTPStatus

     Added in version 3.5.

     一連の HTTP ステータスコード、理由の表現、英語で書かれた長い記述を
     定義した *note enum.IntEnum: edb. のサブクラスです。

     使い方:

          >>> from http import HTTPStatus
          >>> HTTPStatus.OK
          HTTPStatus.OK
          >>> HTTPStatus.OK == 200
          True
          >>> HTTPStatus.OK.value
          200
          >>> HTTPStatus.OK.phrase
          'OK'
          >>> HTTPStatus.OK.description
          'Request fulfilled, document follows'
          >>> list(HTTPStatus)
          [HTTPStatus.CONTINUE, HTTPStatus.SWITCHING_PROTOCOLS, ...]

* Menu:

* HTTP ステータスコード::
* HTTP ステータスコードカテゴリ::
* HTTP メソッド::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/http/__init__.py


File: python.info,  Node: HTTP ステータスコード,  Next: HTTP ステータスコードカテゴリ,  Up: http --- HTTP モジュール群

5.22.9.1 HTTP ステータスコード
..............................

*note http.HTTPStatus: afc. で利用可能な、サポートされている、IANA に登
録されたステータスコード(1) は:

コード      列挙名                                  詳細
                                                    
----------------------------------------------------------------------------------------------------------------------------------------
                                                    
‘100’       ‘CONTINUE’                              HTTP Semantics RFC 9110(2), Section 15.2.1
                                                    
                                                    
‘101’       ‘SWITCHING_PROTOCOLS’                   HTTP Semantics RFC 9110(3), Section 15.2.2
                                                    
                                                    
‘102’       ‘PROCESSING’                            WebDAV RFC 2518(4), Section 10.1
                                                    
                                                    
‘103’       ‘EARLY_HINTS’                           An HTTP Status Code for Indicating Hints RFC 8297(5)
                                                    
                                                    
‘200’       ‘OK’                                    HTTP Semantics RFC 9110(6), Section 15.3.1
                                                    
                                                    
‘201’       ‘CREATED’                               HTTP Semantics RFC 9110(7), Section 15.3.2
                                                    
                                                    
‘202’       ‘ACCEPTED’                              HTTP Semantics RFC 9110(8), Section 15.3.3
                                                    
                                                    
‘203’       ‘NON_AUTHORITATIVE_INFORMATION’         HTTP Semantics RFC 9110(9), Section 15.3.4
                                                    
                                                    
‘204’       ‘NO_CONTENT’                            HTTP Semantics RFC 9110(10), Section 15.3.5
                                                    
                                                    
‘205’       ‘RESET_CONTENT’                         HTTP Semantics RFC 9110(11), Section 15.3.6
                                                    
                                                    
‘206’       ‘PARTIAL_CONTENT’                       HTTP Semantics RFC 9110(12), Section 15.3.7
                                                    
                                                    
‘207’       ‘MULTI_STATUS’                          WebDAV RFC 4918(13), Section 11.1
                                                    
                                                    
‘208’       ‘ALREADY_REPORTED’                      WebDAV Binding Extensions RFC 5842(14), Section 7.1 (Experimental)
                                                    
                                                    
‘226’       ‘IM_USED’                               Delta Encoding in HTTP RFC 3229(15), Section 10.4.1
                                                    
                                                    
‘300’       ‘MULTIPLE_CHOICES’                      HTTP Semantics RFC 9110(16), Section 15.4.1
                                                    
                                                    
‘301’       ‘MOVED_PERMANENTLY’                     HTTP Semantics RFC 9110(17), Section 15.4.2
                                                    
                                                    
‘302’       ‘FOUND’                                 HTTP Semantics RFC 9110(18), Section 15.4.3
                                                    
                                                    
‘303’       ‘SEE_OTHER’                             HTTP Semantics RFC 9110(19), Section 15.4.4
                                                    
                                                    
‘304’       ‘NOT_MODIFIED’                          HTTP Semantics RFC 9110(20), Section 15.4.5
                                                    
                                                    
‘305’       ‘USE_PROXY’                             HTTP Semantics RFC 9110(21), Section 15.4.6
                                                    
                                                    
‘307’       ‘TEMPORARY_REDIRECT’                    HTTP Semantics RFC 9110(22), Section 15.4.8
                                                    
                                                    
‘308’       ‘PERMANENT_REDIRECT’                    HTTP Semantics RFC 9110(23), Section 15.4.9
                                                    
                                                    
‘400’       ‘BAD_REQUEST’                           HTTP Semantics RFC 9110(24), Section 15.5.1
                                                    
                                                    
‘401’       ‘UNAUTHORIZED’                          HTTP Semantics RFC 9110(25), Section 15.5.2
                                                    
                                                    
‘402’       ‘PAYMENT_REQUIRED’                      HTTP Semantics RFC 9110(26), Section 15.5.3
                                                    
                                                    
‘403’       ‘FORBIDDEN’                             HTTP Semantics RFC 9110(27), Section 15.5.4
                                                    
                                                    
‘404’       ‘NOT_FOUND’                             HTTP Semantics RFC 9110(28), Section 15.5.5
                                                    
                                                    
‘405’       ‘METHOD_NOT_ALLOWED’                    HTTP Semantics RFC 9110(29), Section 15.5.6
                                                    
                                                    
‘406’       ‘NOT_ACCEPTABLE’                        HTTP Semantics RFC 9110(30), Section 15.5.7
                                                    
                                                    
‘407’       ‘PROXY_AUTHENTICATION_REQUIRED’         HTTP Semantics RFC 9110(31), Section 15.5.8
                                                    
                                                    
‘408’       ‘REQUEST_TIMEOUT’                       HTTP Semantics RFC 9110(32), Section 15.5.9
                                                    
                                                    
‘409’       ‘CONFLICT’                              HTTP Semantics RFC 9110(33), Section 15.5.10
                                                    
                                                    
‘410’       ‘GONE’                                  HTTP Semantics RFC 9110(34), Section 15.5.11
                                                    
                                                    
‘411’       ‘LENGTH_REQUIRED’                       HTTP Semantics RFC 9110(35), Section 15.5.12
                                                    
                                                    
‘412’       ‘PRECONDITION_FAILED’                   HTTP Semantics RFC 9110(36), Section 15.5.13
                                                    
                                                    
‘413’       ‘CONTENT_TOO_LARGE’                     HTTP Semantics RFC 9110(37), Section 15.5.14
                                                    
                                                    
‘414’       ‘URI_TOO_LONG’                          HTTP Semantics RFC 9110(38), Section 15.5.15
                                                    
                                                    
‘415’       ‘UNSUPPORTED_MEDIA_TYPE’                HTTP Semantics RFC 9110(39), Section 15.5.16
                                                    
                                                    
‘416’       ‘RANGE_NOT_SATISFIABLE’                 HTTP Semantics RFC 9110(40), Section 15.5.17
                                                    
                                                    
‘417’       ‘EXPECTATION_FAILED’                    HTTP Semantics RFC 9110(41), Section 15.5.18
                                                    
                                                    
‘418’       ‘IM_A_TEAPOT’                           HTCPCP/1.0 RFC 2324(42), Section 2.3.2
                                                    
                                                    
‘421’       ‘MISDIRECTED_REQUEST’                   HTTP Semantics RFC 9110(43), Section 15.5.20
                                                    
                                                    
‘422’       ‘UNPROCESSABLE_CONTENT’                 HTTP Semantics RFC 9110(44), Section 15.5.21
                                                    
                                                    
‘423’       ‘LOCKED’                                WebDAV RFC 4918(45), Section 11.3
                                                    
                                                    
‘424’       ‘FAILED_DEPENDENCY’                     WebDAV RFC 4918(46), Section 11.4
                                                    
                                                    
‘425’       ‘TOO_EARLY’                             Using Early Data in HTTP RFC 8470(47)
                                                    
                                                    
‘426’       ‘UPGRADE_REQUIRED’                      HTTP Semantics RFC 9110(48), Section 15.5.22
                                                    
                                                    
‘428’       ‘PRECONDITION_REQUIRED’                 Additional HTTP Status Codes RFC 6585(49)
                                                    
                                                    
‘429’       ‘TOO_MANY_REQUESTS’                     Additional HTTP Status Codes RFC 6585(50)
                                                    
                                                    
‘431’       ‘REQUEST_HEADER_FIELDS_TOO_LARGE’       Additional HTTP Status Codes RFC 6585(51)
                                                    
                                                    
‘451’       ‘UNAVAILABLE_FOR_LEGAL_REASONS’         An HTTP Status Code to Report Legal Obstacles RFC 7725(52)
                                                    
                                                    
‘500’       ‘INTERNAL_SERVER_ERROR’                 HTTP Semantics RFC 9110(53), Section 15.6.1
                                                    
                                                    
‘501’       ‘NOT_IMPLEMENTED’                       HTTP Semantics RFC 9110(54), Section 15.6.2
                                                    
                                                    
‘502’       ‘BAD_GATEWAY’                           HTTP Semantics RFC 9110(55), Section 15.6.3
                                                    
                                                    
‘503’       ‘SERVICE_UNAVAILABLE’                   HTTP Semantics RFC 9110(56), Section 15.6.4
                                                    
                                                    
‘504’       ‘GATEWAY_TIMEOUT’                       HTTP Semantics RFC 9110(57), Section 15.6.5
                                                    
                                                    
‘505’       ‘HTTP_VERSION_NOT_SUPPORTED’            HTTP Semantics RFC 9110(58), Section 15.6.6
                                                    
                                                    
‘506’       ‘VARIANT_ALSO_NEGOTIATES’               Transparent Content Negotiation in HTTP RFC 2295(59), Section 8.1 (Experimental)
                                                    
                                                    
‘507’       ‘INSUFFICIENT_STORAGE’                  WebDAV RFC 4918(60), Section 11.5
                                                    
                                                    
‘508’       ‘LOOP_DETECTED’                         WebDAV Binding Extensions RFC 5842(61), Section 7.2 (Experimental)
                                                    
                                                    
‘510’       ‘NOT_EXTENDED’                          An HTTP Extension Framework RFC 2774(62), Section 7 (Experimental)
                                                    
                                                    
‘511’       ‘NETWORK_AUTHENTICATION_REQUIRED’       Additional HTTP Status Codes RFC 6585(63), Section 6
                                                    

後方互換性を保つために列挙値は *note http.client: 73. にも定数という形で
存在します。 列挙名は定数名と同じです (すなわち ‘http.HTTPStatus.OK’ は
‘http.client.OK’ としても利用可能です)。

バージョン 3.7 で変更: ステータスコード ‘421 MISDIRECTED_REQUEST’ が追加
されました。

Added in version 3.8: ステータスコード ‘451
UNAVAILABLE_FOR_LEGAL_REASONS’ が追加されました。

Added in version 3.9: ステータスコード ‘103 EARLY_HINTS’, ‘418
IM_A_TEAPOT’, ‘425 TOO_EARLY’ が追加されました。

バージョン 3.13 で変更: Implemented RFC9110 naming for status constants.
Old constant names are preserved for backwards compatibility: ‘413
REQUEST_ENTITY_TOO_LARGE’, ‘414 REQUEST_URI_TOO_LONG’, ‘416
REQUESTED_RANGE_NOT_SATISFIABLE’ and ‘422 UNPROCESSABLE_ENTITY’.

   ---------- Footnotes ----------

   (1) 
https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml

   (2) https://datatracker.ietf.org/doc/html/rfc9110.html

   (3) https://datatracker.ietf.org/doc/html/rfc9110.html

   (4) https://datatracker.ietf.org/doc/html/rfc2518.html

   (5) https://datatracker.ietf.org/doc/html/rfc8297.html

   (6) https://datatracker.ietf.org/doc/html/rfc9110.html

   (7) https://datatracker.ietf.org/doc/html/rfc9110.html

   (8) https://datatracker.ietf.org/doc/html/rfc9110.html

   (9) https://datatracker.ietf.org/doc/html/rfc9110.html

   (10) https://datatracker.ietf.org/doc/html/rfc9110.html

   (11) https://datatracker.ietf.org/doc/html/rfc9110.html

   (12) https://datatracker.ietf.org/doc/html/rfc9110.html

   (13) https://datatracker.ietf.org/doc/html/rfc4918.html

   (14) https://datatracker.ietf.org/doc/html/rfc5842.html

   (15) https://datatracker.ietf.org/doc/html/rfc3229.html

   (16) https://datatracker.ietf.org/doc/html/rfc9110.html

   (17) https://datatracker.ietf.org/doc/html/rfc9110.html

   (18) https://datatracker.ietf.org/doc/html/rfc9110.html

   (19) https://datatracker.ietf.org/doc/html/rfc9110.html

   (20) https://datatracker.ietf.org/doc/html/rfc9110.html

   (21) https://datatracker.ietf.org/doc/html/rfc9110.html

   (22) https://datatracker.ietf.org/doc/html/rfc9110.html

   (23) https://datatracker.ietf.org/doc/html/rfc9110.html

   (24) https://datatracker.ietf.org/doc/html/rfc9110.html

   (25) https://datatracker.ietf.org/doc/html/rfc9110.html

   (26) https://datatracker.ietf.org/doc/html/rfc9110.html

   (27) https://datatracker.ietf.org/doc/html/rfc9110.html

   (28) https://datatracker.ietf.org/doc/html/rfc9110.html

   (29) https://datatracker.ietf.org/doc/html/rfc9110.html

   (30) https://datatracker.ietf.org/doc/html/rfc9110.html

   (31) https://datatracker.ietf.org/doc/html/rfc9110.html

   (32) https://datatracker.ietf.org/doc/html/rfc9110.html

   (33) https://datatracker.ietf.org/doc/html/rfc9110.html

   (34) https://datatracker.ietf.org/doc/html/rfc9110.html

   (35) https://datatracker.ietf.org/doc/html/rfc9110.html

   (36) https://datatracker.ietf.org/doc/html/rfc9110.html

   (37) https://datatracker.ietf.org/doc/html/rfc9110.html

   (38) https://datatracker.ietf.org/doc/html/rfc9110.html

   (39) https://datatracker.ietf.org/doc/html/rfc9110.html

   (40) https://datatracker.ietf.org/doc/html/rfc9110.html

   (41) https://datatracker.ietf.org/doc/html/rfc9110.html

   (42) https://datatracker.ietf.org/doc/html/rfc2324.html

   (43) https://datatracker.ietf.org/doc/html/rfc9110.html

   (44) https://datatracker.ietf.org/doc/html/rfc9110.html

   (45) https://datatracker.ietf.org/doc/html/rfc4918.html

   (46) https://datatracker.ietf.org/doc/html/rfc4918.html

   (47) https://datatracker.ietf.org/doc/html/rfc8470.html

   (48) https://datatracker.ietf.org/doc/html/rfc9110.html

   (49) https://datatracker.ietf.org/doc/html/rfc6585.html

   (50) https://datatracker.ietf.org/doc/html/rfc6585.html

   (51) https://datatracker.ietf.org/doc/html/rfc6585.html

   (52) https://datatracker.ietf.org/doc/html/rfc7725.html

   (53) https://datatracker.ietf.org/doc/html/rfc9110.html

   (54) https://datatracker.ietf.org/doc/html/rfc9110.html

   (55) https://datatracker.ietf.org/doc/html/rfc9110.html

   (56) https://datatracker.ietf.org/doc/html/rfc9110.html

   (57) https://datatracker.ietf.org/doc/html/rfc9110.html

   (58) https://datatracker.ietf.org/doc/html/rfc9110.html

   (59) https://datatracker.ietf.org/doc/html/rfc2295.html

   (60) https://datatracker.ietf.org/doc/html/rfc4918.html

   (61) https://datatracker.ietf.org/doc/html/rfc5842.html

   (62) https://datatracker.ietf.org/doc/html/rfc2774.html

   (63) https://datatracker.ietf.org/doc/html/rfc6585.html


File: python.info,  Node: HTTP ステータスコードカテゴリ,  Next: HTTP メソッド,  Prev: HTTP ステータスコード,  Up: http --- HTTP モジュール群

5.22.9.2 HTTP ステータスコードカテゴリ
......................................

Added in version 3.12.

列挙型の値は HTTP ステータスカテゴリを示すいくつかのプロパティを持ちます
。

プロパティ               示していること               詳細
                                                      
-------------------------------------------------------------------------------------------------
                                                      
‘is_informational’       ‘100 <= status <= 199’       HTTP Semantics RFC 9110(1), Section 15
                                                      
                                                      
‘is_success’             ‘200 <= status <= 299’       HTTP Semantics RFC 9110(2), Section 15
                                                      
                                                      
‘is_redirection’         ‘300 <= status <= 399’       HTTP Semantics RFC 9110(3), Section 15
                                                      
                                                      
‘is_client_error’        ‘400 <= status <= 499’       HTTP Semantics RFC 9110(4), Section 15
                                                      
                                                      
‘is_server_error’        ‘500 <= status <= 599’       HTTP Semantics RFC 9110(5), Section 15
                                                      

     使い方:

          >>> from http import HTTPStatus
          >>> HTTPStatus.OK.is_success
          True
          >>> HTTPStatus.OK.is_client_error
          False

 -- クラス: http.HTTPMethod

     Added in version 3.11.

     一連の HTTP メソッド、英語で書かれた記述を定義した *note
     enum.StrEnum: 82d. のサブクラスです。

     使い方:

          >>> from http import HTTPMethod
          >>>
          >>> HTTPMethod.GET
          <HTTPMethod.GET>
          >>> HTTPMethod.GET == 'GET'
          True
          >>> HTTPMethod.GET.value
          'GET'
          >>> HTTPMethod.GET.description
          'Retrieve the target.'
          >>> list(HTTPMethod)
          [<HTTPMethod.CONNECT>,
           <HTTPMethod.DELETE>,
           <HTTPMethod.GET>,
           <HTTPMethod.HEAD>,
           <HTTPMethod.OPTIONS>,
           <HTTPMethod.PATCH>,
           <HTTPMethod.POST>,
           <HTTPMethod.PUT>,
           <HTTPMethod.TRACE>]

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc9110.html

   (2) https://datatracker.ietf.org/doc/html/rfc9110.html

   (3) https://datatracker.ietf.org/doc/html/rfc9110.html

   (4) https://datatracker.ietf.org/doc/html/rfc9110.html

   (5) https://datatracker.ietf.org/doc/html/rfc9110.html


File: python.info,  Node: HTTP メソッド,  Prev: HTTP ステータスコードカテゴリ,  Up: http --- HTTP モジュール群

5.22.9.3 HTTP メソッド
......................

*note http.HTTPMethod: 3fc2. で利用可能な、サポートされている、IANA に登
録されたメソッド(1) は:

メソッド        列挙名                                  詳細
                                                        
-------------------------------------------------------------------------------------------------------------------------------
                                                        
‘GET’           ‘GET’                                   HTTP Semantics RFC 9110(2), Section 9.3.1
                                                        
                                                        
‘HEAD’          ‘HEAD’                                  HTTP Semantics RFC 9110(3), Section 9.3.2
                                                        
                                                        
‘POST’          ‘POST’                                  HTTP Semantics RFC 9110(4), Section 9.3.3
                                                        
                                                        
‘PUT’           ‘PUT’                                   HTTP Semantics RFC 9110(5), Section 9.3.4
                                                        
                                                        
‘DELETE’        ‘DELETE’                                HTTP Semantics RFC 9110(6), Section 9.3.5
                                                        
                                                        
‘CONNECT’       ‘CONNECT’                               HTTP Semantics RFC 9110(7), Section 9.3.6
                                                        
                                                        
‘OPTIONS’       ‘OPTIONS’                               HTTP Semantics RFC 9110(8), Section 9.3.7
                                                        
                                                        
‘TRACE’         ‘TRACE’                                 HTTP Semantics RFC 9110(9), Section 9.3.8
                                                        
                                                        
‘PATCH’         ‘PATCH’                                 HTTP/1.1 RFC 5789(10)
                                                        

   ---------- Footnotes ----------

   (1) https://www.iana.org/assignments/http-methods/http-methods.xhtml

   (2) https://datatracker.ietf.org/doc/html/rfc9110.html

   (3) https://datatracker.ietf.org/doc/html/rfc9110.html

   (4) https://datatracker.ietf.org/doc/html/rfc9110.html

   (5) https://datatracker.ietf.org/doc/html/rfc9110.html

   (6) https://datatracker.ietf.org/doc/html/rfc9110.html

   (7) https://datatracker.ietf.org/doc/html/rfc9110.html

   (8) https://datatracker.ietf.org/doc/html/rfc9110.html

   (9) https://datatracker.ietf.org/doc/html/rfc9110.html

   (10) https://datatracker.ietf.org/doc/html/rfc5789.html


File: python.info,  Node: http client --- HTTP プロトコルクライアント,  Next: ftplib --- FTP プロトコルクライアント,  Prev: http --- HTTP モジュール群,  Up: インターネットプロトコルとサポート

5.22.10 ‘http.client’ -- HTTP プロトコルクライアント
----------------------------------------------------

'ソースコード:' Lib/http/client.py(1)

__________________________________________________________________

このモジュールでは HTTP および HTTPS プロトコルのクライアントサイドを実
装しているクラスを定義しています。通常、このモジュールは直接使いません
-- *note urllib.request: 111. モジュールが HTTP や HTTPS を使った URL を
扱う上でこのモジュールを使います。

参考
....

より高水準の HTTP クライアントインターフェースとして Requests パッケージ
(2) が推奨されています。

     注釈: HTTPS のサポートは、Python が SSL サポート付きでコンパイルさ
     れている場合にのみ利用できます (*note ssl: d5. モジュールによって
     )。

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

このモジュールでは以下のクラスを提供しています:

 -- クラス: http.client.HTTPConnection (host, port=None[, timeout],
          source_address=None, blocksize=8192)

     *note HTTPConnection: d35. インスタンスは、HTTP サーバとの一回のト
     ランザクションを表現します。 インスタンスの生成はホスト名とオプショ
     ンのポート番号を与えることで行います。 ポート番号を指定しなかった場
     合、ホスト名文字列が ‘host:port’ の形式であれば、ホスト名からポート
     番号を抽出し、そうでない場合には標準の HTTP ポート番号 (80) を使い
     ます。 オプションの引数 'timeout' が渡された場合、ブロックする処理
     (コネクション接続など) のタイムアウト時間(秒数)として利用されます
     (渡されなかった場合は、グローバルのデフォルトタイムアウト設定が利用
     されます)。 オプションの引数 'source_address' を (host, port) とい
     う形式のタプルにすると HTTP 接続の接続元アドレスとして使用します。
     オプションの 'blocksize' 引数は、送信するファイル類メッセージボディ
     のバッファサイズをバイト単位で設定します。

     例えば、以下の呼び出しは全て同じサーバの同じポートに接続するインス
     タンスを生成します:

          >>> h1 = http.client.HTTPConnection('www.python.org')
          >>> h2 = http.client.HTTPConnection('www.python.org:80')
          >>> h3 = http.client.HTTPConnection('www.python.org', 80)
          >>> h4 = http.client.HTTPConnection('www.python.org', 80, timeout=10)

     バージョン 3.2 で変更: 'source_address' が追加されました。

     バージョン 3.4 で変更: 'strict' パラメータは廃止されました。HTTP
     0.9 の "シンプルなレスポンス" のような形式はもはやサポートされませ
     ん。

     バージョン 3.7 で変更: 'blocksize' 引数が追加されました。

 -- クラス: http.client.HTTPSConnection (host, port=None, *[, timeout],
          source_address=None, context=None, blocksize=8192)

     *note HTTPConnection: d35. のサブクラスはセキュア・サーバとやりとり
     する為の SSL を使う場合に用います。デフォルトのポート番号は ‘443’ で
     す。'context' が指定されれば、それは様々な SSL オプションを記述する
     *note ssl.SSLContext: 357. インスタンスでなければなりません。

     ベストプラクティスに関するより良い情報が *note
     セキュリティで考慮すべき点: 3895. にありますのでお読みください。

     バージョン 3.2 で変更: 'source_address'、'context' そして
     'check_hostname' が追加されました。

     バージョン 3.2 で変更: このクラスは現在、可能であれば (つまり *note
     ssl.HAS_SNI: 39d6. が真の場合) HTTPS のバーチャルホストをサポートし
     ています。

     バージョン 3.4 で変更: 'strict' パラメータは廃止されました。HTTP
     0.9 の "シンプルなレスポンス" のような形式はもはやサポートされませ
     ん。

     バージョン 3.4.3 で変更: このクラスは今や全ての必要な証明書とホスト
     名の検証をデフォルトで行うようになりました。 'context' パラメーター
     に ‘ssl._create_unverified_context()’ を渡すことで、昔の、検証を行
     わない振る舞いに戻すことができます。

     バージョン 3.8 で変更: This class now enables TLS 1.3 *note
     ssl.SSLContext.post_handshake_auth: c26. for the default 'context'
     or when 'cert_file' is passed with a custom 'context'.

     バージョン 3.10 で変更: This class now sends an ALPN extension with
     protocol indicator ‘http/1.1’ when no 'context' is given.  Custom
     'context' should set ALPN protocols with *note
     set_alpn_protocols(): 1064.

     バージョン 3.12 で変更: The deprecated 'key_file', 'cert_file' and
     'check_hostname' parameters have been removed.

 -- クラス: http.client.HTTPResponse (sock, debuglevel=0, method=None,
          url=None)

     コネクションに成功したときに、このクラスのインスタンスが返されます
     。ユーザーから直接利用されることはありません。

     バージョン 3.4 で変更: 'strict' パラメータは廃止されました。HTTP
     0.9 の "シンプルなレスポンス" のような形式はもはやサポートされませ
     ん。

このモジュールは以下の関数を提供します:

 -- の関数: http.client.parse_headers (fp)

     Parse the headers from a file pointer 'fp' representing a HTTP
     request/response.  The file has to be a *note BufferedIOBase: 8a3.
     reader (i.e.  not text) and must provide a valid RFC 5322(3) style
     header.

     This function returns an instance of *note http.client.HTTPMessage:
     3fc8. that holds the header fields, but no payload (the same as
     *note HTTPResponse.msg: 3fc9. and *note
     http.server.BaseHTTPRequestHandler.headers: 3fca.).  After
     returning, the file pointer 'fp' is ready to read the HTTP body.

          注釈: *note parse_headers(): 1e28. does not parse the
          start-line of a HTTP message; it only parses the ‘Name: value’
          lines.  The file has to be ready to read these field lines, so
          the first line should already be consumed before calling the
          function.

状況に応じて、以下の例外が送出されます:

 -- 例外: http.client.HTTPException

     このモジュールにおける他の例外クラスの基底クラスです。 *note
     Exception: bcd. のサブクラスです。

 -- 例外: http.client.NotConnected

     *note HTTPException: 3fcb. サブクラスです。

 -- 例外: http.client.InvalidURL

     *note HTTPException: 3fcb. のサブクラスです。ポート番号を指定したも
     のの、その値が数字でなかったり空のオブジェクトであった場合に送出さ
     れます。

 -- 例外: http.client.UnknownProtocol

     *note HTTPException: 3fcb. サブクラスです。

 -- 例外: http.client.UnknownTransferEncoding

     *note HTTPException: 3fcb. サブクラスです。

 -- 例外: http.client.UnimplementedFileMode

     *note HTTPException: 3fcb. サブクラスです。

 -- 例外: http.client.IncompleteRead

     *note HTTPException: 3fcb. サブクラスです。

 -- 例外: http.client.ImproperConnectionState

     *note HTTPException: 3fcb. サブクラスです。

 -- 例外: http.client.CannotSendRequest

     *note ImproperConnectionState: 3fd2. のサブクラスです。

 -- 例外: http.client.CannotSendHeader

     *note ImproperConnectionState: 3fd2. のサブクラスです。

 -- 例外: http.client.ResponseNotReady

     *note ImproperConnectionState: 3fd2. のサブクラスです。

 -- 例外: http.client.BadStatusLine

     *note HTTPException: 3fcb. のサブクラスです。サーバが理解できない
     HTTP 状態コードで応答した場合に送出されます。

 -- 例外: http.client.LineTooLong

     A subclass of *note HTTPException: 3fcb.  Raised if an excessively
     long line is received in the HTTP protocol from the server.

 -- 例外: http.client.RemoteDisconnected

     A subclass of *note ConnectionResetError: 126a. and *note
     BadStatusLine: 3fd6.  Raised by *note HTTPConnection.getresponse():
     1009. when the attempt to read the response results in no data read
     from the connection, indicating that the remote end has closed the
     connection.

     Added in version 3.5: Previously, *note BadStatusLine: 3fd6.‘('')’
     was raised.

このモジュールで定義されている定数は以下の通りです:

 -- データ: http.client.HTTP_PORT

     HTTP プロトコルの標準のポート (通常は ‘80’) です。

 -- データ: http.client.HTTPS_PORT

     HTTPS プロトコルの標準のポート (通常は ‘443’) です。

 -- データ: http.client.responses

     このディクショナリは、HTTP 1.1ステータスコードをW3Cの名前にマップし
     たものです。

     例: ‘http.client.responses[http.client.NOT_FOUND]’ は ‘'Not Found'’
     を示します。

See *note HTTP ステータスコード: 3fbf. for a list of HTTP status codes
that are available in this module as constants.

* Menu:

* HTTPConnection オブジェクト::
* HTTPResponse オブジェクト::
* 使用例: 使用例<38>.
* HTTPMessage オブジェクト::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/http/client.py

   (2) https://requests.readthedocs.io/en/latest/

   (3) https://datatracker.ietf.org/doc/html/rfc5322.html


File: python.info,  Node: HTTPConnection オブジェクト,  Next: HTTPResponse オブジェクト,  Up: http client --- HTTP プロトコルクライアント

5.22.10.1 HTTPConnection オブジェクト
.....................................

*note HTTPConnection: d35. インスタンスには以下のメソッドがあります:

 -- メソッド: HTTPConnection.request (method, url, body=None,
          headers={}, *, encode_chunked=False)

     This will send a request to the server using the HTTP request
     method 'method' and the request URI 'url'.  The provided 'url' must
     be an absolute path to conform with RFC 2616 §5.1.2(1) (unless
     connecting to an HTTP proxy server or using the ‘OPTIONS’ or
     ‘CONNECT’ methods).

     If 'body' is specified, the specified data is sent after the
     headers are finished.  It may be a *note str: 169, a *note
     bytes-like object: 193, an open *note file object: 13db, or an
     iterable of *note bytes: 192.  If 'body' is a string, it is encoded
     as ISO-8859-1, the default for HTTP. If it is a bytes-like object,
     the bytes are sent as is.  If it is a *note file object: 13db, the
     contents of the file is sent; this file object should support at
     least the ‘read()’ method.  If the file object is an instance of
     *note io.TextIOBase: 8a4, the data returned by the ‘read()’ method
     will be encoded as ISO-8859-1, otherwise the data returned by
     ‘read()’ is sent as is.  If 'body' is an iterable, the elements of
     the iterable are sent as is until the iterable is exhausted.

     The 'headers' argument should be a mapping of extra HTTP headers to
     send with the request.  A Host header(2) must be provided to
     conform with RFC 2616 §5.1.2(3) (unless connecting to an HTTP proxy
     server or using the ‘OPTIONS’ or ‘CONNECT’ methods).

     If 'headers' contains neither Content-Length nor Transfer-Encoding,
     but there is a request body, one of those header fields will be
     added automatically.  If 'body' is ‘None’, the Content-Length
     header is set to ‘0’ for methods that expect a body (‘PUT’, ‘POST’,
     and ‘PATCH’).  If 'body' is a string or a bytes-like object that is
     not also a *note file: 13db, the Content-Length header is set to
     its length.  Any other type of 'body' (files and iterables in
     general) will be chunk-encoded, and the Transfer-Encoding header
     will automatically be set instead of Content-Length.

     The 'encode_chunked' argument is only relevant if Transfer-Encoding
     is specified in 'headers'.  If 'encode_chunked' is ‘False’, the
     HTTPConnection object assumes that all encoding is handled by the
     calling code.  If it is ‘True’, the body will be chunk-encoded.

     For example, to perform a ‘GET’ request to
     ‘https://docs.python.org/3/’:

          >>> import http.client
          >>> host = "docs.python.org"
          >>> conn = http.client.HTTPSConnection(host)
          >>> conn.request("GET", "/3/", headers={"Host": host})
          >>> response = conn.getresponse()
          >>> print(response.status, response.reason)
          200 OK

          注釈: Chunked transfer encoding has been added to the HTTP
          protocol version 1.1.  Unless the HTTP server is known to
          handle HTTP 1.1, the caller must either specify the
          Content-Length, or must pass a *note str: 169. or bytes-like
          object that is not also a file as the body representation.

          注釈: Note that you must have read the whole response or call
          *note close(): 3fdd. if *note getresponse(): 1009. raised an
          non-*note ConnectionError: 100b. exception before you can send
          a new request to the server.

     バージョン 3.2 で変更: 'body' は iterable オブジェクトとして使用で
     きます。

     バージョン 3.6 で変更: If neither Content-Length nor
     Transfer-Encoding are set in 'headers', file and iterable 'body'
     objects are now chunk-encoded.  The 'encode_chunked' argument was
     added.  No attempt is made to determine the Content-Length for file
     objects.

 -- メソッド: HTTPConnection.getresponse ()

     サーバに対して HTTP 要求を送り出した後に呼び出されなければりません
     。要求に対する応答を取得します。 *note HTTPResponse: 12e5. インスタ
     ンスを返します。

     バージョン 3.5 で変更: If a *note ConnectionError: 100b. or
     subclass is raised, the *note HTTPConnection: d35. object will be
     ready to reconnect when a new request is sent.

     Note that this does not apply to *note OSError: 2c0.s raised by the
     underlying socket.  Instead the caller is responsible to call *note
     close(): 3fdd. on the existing connection.

 -- メソッド: HTTPConnection.set_debuglevel (level)

     Set the debugging level.  The default debug level is ‘0’, meaning
     no debugging output is printed.  Any value greater than ‘0’ will
     cause all currently defined debug output to be printed to stdout.
     The ‘debuglevel’ is passed to any new *note HTTPResponse: 12e5.
     objects that are created.

     Added in version 3.1.

 -- メソッド: HTTPConnection.set_tunnel (host, port=None, headers=None)

     HTTP トンネリング接続のホスト名とポート番号を設定します。これにより
     プロキシサーバを通しての接続を実行できます。

     The 'host' and 'port' arguments specify the endpoint of the
     tunneled connection (i.e.  the address included in the CONNECT
     request, 'not' the address of the proxy server).

     The 'headers' argument should be a mapping of extra HTTP headers to
     send with the CONNECT request.

     As HTTP/1.1 is used for HTTP CONNECT tunnelling request, as per the
     RFC(4), a HTTP ‘Host:’ header must be provided, matching the
     authority-form of the request target provided as the destination
     for the CONNECT request.  If a HTTP ‘Host:’ header is not provided
     via the headers argument, one is generated and transmitted
     automatically.

     For example, to tunnel through a HTTPS proxy server running locally
     on port 8080, we would pass the address of the proxy to the *note
     HTTPSConnection: d36. constructor, and the address of the host that
     we eventually want to reach to the *note set_tunnel(): 1440.
     method:

          >>> import http.client
          >>> conn = http.client.HTTPSConnection("localhost", 8080)
          >>> conn.set_tunnel("www.python.org")
          >>> conn.request("HEAD","/index.html")

     Added in version 3.2.

     バージョン 3.12 で変更: HTTP CONNECT tunnelling requests use
     protocol HTTP/1.1, upgraded from protocol HTTP/1.0.  ‘Host:’ HTTP
     headers are mandatory for HTTP/1.1, so one will be automatically
     generated and transmitted if not provided in the headers argument.

 -- メソッド: HTTPConnection.get_proxy_response_headers ()

     Returns a dictionary with the headers of the response received from
     the proxy server to the CONNECT request.

     If the CONNECT request was not sent, the method returns ‘None’.

     Added in version 3.12.

 -- メソッド: HTTPConnection.connect ()

     Connect to the server specified when the object was created.  By
     default, this is called automatically when making a request if the
     client does not already have a connection.

     Raises an *note auditing event: 1c6e. ‘http.client.connect’ with
     arguments ‘self’, ‘host’, ‘port’.

 -- メソッド: HTTPConnection.close ()

     サーバへの接続を閉じます。

 -- の属性: HTTPConnection.blocksize

     Buffer size in bytes for sending a file-like message body.

     Added in version 3.7.

As an alternative to using the *note request(): ea7. method described
above, you can also send your request step by step, by using the four
functions below.

 -- メソッド: HTTPConnection.putrequest (method, url, skip_host=False,
          skip_accept_encoding=False)

     サーバへの接続が確立したら、最初にこのメソッドを呼び出さなくてはな
     りません。このメソッドは 'method' 文字列、'url' 文字列、そして HTTP
     バージョン (‘HTTP/1.1’) からなる一行を送信します。‘Host:’ や
     ‘Accept-Encoding:’ ヘッダの自動送信を無効にしたい場合 (例えば別のコ
     ンテンツエンコーディングを受け入れたい場合) には、'skip_host' や
     'skip_accept_encoding' を偽でない値に設定してください。

 -- メソッド: HTTPConnection.putheader (header, argument[, ...])

     RFC 822(5) 形式のヘッダをサーバに送ります。この処理では、 'header'
     、コロンとスペース、そして最初の引数からなる 1 行をサーバに送ります
     。追加の引数を指定した場合、継続して各行にタブ一つと引数の入った引
     数行が送信されます。

 -- メソッド: HTTPConnection.endheaders (message_body=None, *,
          encode_chunked=False)

     サーバに空行を送り、ヘッダ部が終了したことを通知します。オプション
     の 'message_body' 引数を、リクエストに関連したメッセージボディを渡
     すのに使うことが出来ます。

     If 'encode_chunked' is ‘True’, the result of each iteration of
     'message_body' will be chunk-encoded as specified in RFC 7230(6),
     Section 3.3.1.  How the data is encoded is dependent on the type of
     'message_body'.  If 'message_body' implements the *note buffer
     interface: 260. the encoding will result in a single chunk.  If
     'message_body' is a *note collections.abc.Iterable: 26ae, each
     iteration of 'message_body' will result in a chunk.  If
     'message_body' is a *note file object: 13db, each call to ‘.read()’
     will result in a chunk.  The method automatically signals the end
     of the chunk-encoded data immediately after 'message_body'.

          注釈: Due to the chunked encoding specification, empty chunks
          yielded by an iterator body will be ignored by the
          chunk-encoder.  This is to avoid premature termination of the
          read of the request by the target server due to malformed
          encoding.

     バージョン 3.6 で変更: Added chunked encoding support and the
     'encode_chunked' parameter.

 -- メソッド: HTTPConnection.send (data)

     サーバにデータを送ります。このメソッドは *note endheaders(): ea8. が
     呼び出された直後で、かつ *note getresponse(): 1009. が呼び出される
     前に使わなければなりません。

     Raises an *note auditing event: 1c6e. ‘http.client.send’ with
     arguments ‘self’, ‘data’.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2616.html#section-5.1.2

   (2) https://datatracker.ietf.org/doc/html/rfc2616.html#section-14.23

   (3) https://datatracker.ietf.org/doc/html/rfc2616.html#section-5.1.2

   (4) https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.6

   (5) https://datatracker.ietf.org/doc/html/rfc822.html

   (6) https://datatracker.ietf.org/doc/html/rfc7230.html


File: python.info,  Node: HTTPResponse オブジェクト,  Next: 使用例<38>,  Prev: HTTPConnection オブジェクト,  Up: http client --- HTTP プロトコルクライアント

5.22.10.2 HTTPResponse オブジェクト
...................................

*note HTTPResponse: 12e5. インスタンスはサーバからのHTTPレスポンスをラッ
プします。これを使用してリクエストヘッダとエンティティボディへアクセスす
ることができます。レスポンスはイテレート可能なオブジェクトであり、また
with文と使うことも可能です。

バージョン 3.5 で変更: The *note io.BufferedIOBase: 8a3. interface is
now implemented and all of its reader operations are supported.

 -- メソッド: HTTPResponse.read ([amt])

     応答の本体全体か、'amt' バイトまで読み出して返します。

 -- メソッド: HTTPResponse.readinto (b)

     バッファ 'b' にレスポンスボディの次のデータを最大 len(b) バイト読み
     込みます。何バイト読んだかを返します。

     Added in version 3.3.

 -- メソッド: HTTPResponse.getheader (name, default=None)

     Return the value of the header 'name', or 'default' if there is no
     header matching 'name'.  If there is more than one header with the
     name 'name', return all of the values joined by ', '.  If 'default'
     is any iterable other than a single string, its elements are
     similarly returned joined by commas.

 -- メソッド: HTTPResponse.getheaders ()

     (header, value) のタプルからなるリストを返します。

 -- メソッド: HTTPResponse.fileno ()

     ソケットの ‘fileno’ を返します。

 -- の属性: HTTPResponse.msg

     A *note http.client.HTTPMessage: 3fc8. instance containing the
     response headers.  *note http.client.HTTPMessage: 3fc8. is a
     subclass of *note email.message.Message: 581.

 -- の属性: HTTPResponse.version

     サーバが使用した HTTP プロトコルバージョンです。10 は HTTP/1.0 を、
     11 は HTTP/1.1 を表します。

 -- の属性: HTTPResponse.url

     取得されたリソースの URL、主にリダイレクトが発生したかどうかを確認
     するために利用します。

 -- の属性: HTTPResponse.headers

     Headers of the response in the form of an *note
     email.message.EmailMessage: 580. instance.

 -- の属性: HTTPResponse.status

     サーバから返される状態コードです。

 -- の属性: HTTPResponse.reason

     サーバから返される応答の理由文です。

 -- の属性: HTTPResponse.debuglevel

     A debugging hook.  If *note debuglevel: 3fed. is greater than zero,
     messages will be printed to stdout as the response is read and
     parsed.

 -- の属性: HTTPResponse.closed

     ストリームが閉じている場合 ‘True’ となります。

 -- メソッド: HTTPResponse.geturl ()

     バージョン 3.9 で非推奨: 非推奨となったので *note url: 3fea. を使用
     してください。

 -- メソッド: HTTPResponse.info ()

     バージョン 3.9 で非推奨: 非推奨となったので *note headers: 3feb. を
     使用してください。

 -- メソッド: HTTPResponse.getcode ()

     バージョン 3.9 で非推奨: 非推奨となったので *note status: 3fec. を
     使用してください。


File: python.info,  Node: 使用例<38>,  Next: HTTPMessage オブジェクト,  Prev: HTTPResponse オブジェクト,  Up: http client --- HTTP プロトコルクライアント

5.22.10.3 使用例
................

以下は ‘GET’ リクエストの送信方法を示した例です:

     >>> import http.client
     >>> conn = http.client.HTTPSConnection("www.python.org")
     >>> conn.request("GET", "/")
     >>> r1 = conn.getresponse()
     >>> print(r1.status, r1.reason)
     200 OK
     >>> data1 = r1.read()  # This will return entire content.
     >>> # The following example demonstrates reading data in chunks.
     >>> conn.request("GET", "/")
     >>> r1 = conn.getresponse()
     >>> while chunk := r1.read(200):
     ...     print(repr(chunk))
     b'<!doctype html>\n<!--[if"...
     ...
     >>> # Example of an invalid request
     >>> conn = http.client.HTTPSConnection("docs.python.org")
     >>> conn.request("GET", "/parrot.spam")
     >>> r2 = conn.getresponse()
     >>> print(r2.status, r2.reason)
     404 Not Found
     >>> data2 = r2.read()
     >>> conn.close()

次の例のセッションでは、‘HEAD’ メソッドを利用しています。‘HEAD’ メソッド
は全くデータを返さないことに注目してください。

     >>> import http.client
     >>> conn = http.client.HTTPSConnection("www.python.org")
     >>> conn.request("HEAD", "/")
     >>> res = conn.getresponse()
     >>> print(res.status, res.reason)
     200 OK
     >>> data = res.read()
     >>> print(len(data))
     0
     >>> data == b''
     True

Here is an example session that uses the ‘POST’ method:

     >>> import http.client, urllib.parse
     >>> params = urllib.parse.urlencode({'@number': 12524, '@type': 'issue', '@action': 'show'})
     >>> headers = {"Content-type": "application/x-www-form-urlencoded",
     ...            "Accept": "text/plain"}
     >>> conn = http.client.HTTPConnection("bugs.python.org")
     >>> conn.request("POST", "", params, headers)
     >>> response = conn.getresponse()
     >>> print(response.status, response.reason)
     302 Found
     >>> data = response.read()
     >>> data
     b'Redirecting to <a href="https://bugs.python.org/issue12524">https://bugs.python.org/issue12524</a>'
     >>> conn.close()

Client side HTTP ‘PUT’ requests are very similar to ‘POST’ requests.
The difference lies only on the server side where HTTP servers will
allow resources to be created via ‘PUT’ requests.  It should be noted
that custom HTTP methods are also handled in *note
urllib.request.Request: 11da. by setting the appropriate method
attribute.  Here is an example session that uses the ‘PUT’ method:

     >>> # This creates an HTTP request
     >>> # with the content of BODY as the enclosed representation
     >>> # for the resource http://localhost:8080/file
     ...
     >>> import http.client
     >>> BODY = "***filecontents***"
     >>> conn = http.client.HTTPConnection("localhost", 8080)
     >>> conn.request("PUT", "/file", BODY)
     >>> response = conn.getresponse()
     >>> print(response.status, response.reason)
     200, OK


File: python.info,  Node: HTTPMessage オブジェクト,  Prev: 使用例<38>,  Up: http client --- HTTP プロトコルクライアント

5.22.10.4 HTTPMessage オブジェクト
..................................

 -- クラス: http.client.HTTPMessage (email.message.Message)

*note http.client.HTTPMessage: 3fc8. のインスタンスは HTTP レスポンスヘ
ッダを格納します。 *note email.message.Message: 581. クラスを利用して実
装されています。


File: python.info,  Node: ftplib --- FTP プロトコルクライアント,  Next: poplib --- POP3 プロトコルクライアント,  Prev: http client --- HTTP プロトコルクライアント,  Up: インターネットプロトコルとサポート

5.22.11 ‘ftplib’ -- FTP プロトコルクライアント
----------------------------------------------

'ソースコード:' Lib/ftplib.py(1)

__________________________________________________________________

このモジュールでは *note FTP: af6. クラスと、それに関連するいくつかの項
目を定義しています。 *note FTP: af6. クラスは、FTPプロトコルのクライアン
ト側の機能を備えています。このクラスを使うとFTPのいろいろな機能の自動化
、例えば他のFTPサーバのミラーリングといったことを実行するPythonプログラ
ムを書くことができます。また、 *note urllib.request: 111. モジュールも
FTPを使うURLを操作するのにこのクラスを使っています。 FTP (File Transfer
Protocol)についての詳しい情報はinternet RFC 959(2) を参照して下さい。

The default encoding is UTF-8, following RFC 2640(3).

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

Here's a sample session using the ‘ftplib’ module:

     >>> from ftplib import FTP
     >>> ftp = FTP('ftp.us.debian.org')  # connect to host, default port
     >>> ftp.login()                     # user anonymous, passwd anonymous@
     '230 Login successful.'
     >>> ftp.cwd('debian')               # change into "debian" directory
     '250 Directory successfully changed.'
     >>> ftp.retrlines('LIST')           # list directory contents
     -rw-rw-r--    1 1176     1176         1063 Jun 15 10:18 README
     ...
     drwxr-sr-x    5 1176     1176         4096 Dec 19  2000 pool
     drwxr-sr-x    4 1176     1176         4096 Nov 17  2008 project
     drwxr-xr-x    3 1176     1176         4096 Oct 10  2012 tools
     '226 Directory send OK.'
     >>> with open('README', 'wb') as fp:
     >>>     ftp.retrbinary('RETR README', fp.write)
     '226 Transfer complete.'
     >>> ftp.quit()
     '221 Goodbye.'

* Menu:

* リファレンス: リファレンス<7>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/ftplib.py

   (2) https://datatracker.ietf.org/doc/html/rfc959.html

   (3) https://datatracker.ietf.org/doc/html/rfc2640.html


File: python.info,  Node: リファレンス<7>,  Up: ftplib --- FTP プロトコルクライアント

5.22.11.1 リファレンス
......................

* Menu:

* FTP オブジェクト::
* FTP_TLS オブジェクト::
* モジュール変数::


File: python.info,  Node: FTP オブジェクト,  Next: FTP_TLS オブジェクト,  Up: リファレンス<7>

5.22.11.2 FTP オブジェクト
..........................

 -- クラス: ftplib.FTP (host='', user='', passwd='', acct='',
          timeout=None, source_address=None, *, encoding='utf-8')

     Return a new instance of the *note FTP: af6. class.


     パラメータ:

        * ‘host’ (*note str: 169.) - The hostname to connect to.  If
          given, ‘connect(host)’ is implicitly called by the
          constructor.

        * ‘user’ (*note str: 169.) - The username to log in with
          (default: ‘'anonymous'’).  If given, ‘login(host, passwd,
          acct)’ is implicitly called by the constructor.

        * ‘passwd’ (*note str: 169.) - The password to use when logging
          in.  If not given, and if 'passwd' is the empty string or
          ‘"-"’, a password will be automatically generated.

        * ‘acct’ (*note str: 169.) - Account information to be used for
          the ‘ACCT’ FTP command.  Few systems implement this.  See
          RFC-959(1) for more details.

        * ‘timeout’ (*note float: 196.‘ | ’‘None’) - A timeout in
          seconds for blocking operations like *note connect(): 3ffc.
          (default: the global default timeout setting).

        * ‘source_address’ (*note tuple: 614.‘ | ’‘None’) - A 2-tuple
          ‘(host, port)’ for the socket to bind to as its source address
          before connecting.

        * ‘encoding’ (*note str: 169.) - The encoding for directories
          and filenames (default: ‘'utf-8'’).

     *note FTP: af6. クラスは *note with: 186. 文をサポートしています。
     例えば:

          >>> from ftplib import FTP
          >>> with FTP("ftp1.at.proftpd.org") as ftp:
          ...     ftp.login()
          ...     ftp.dir()
          ...
          '230 Anonymous login ok, restrictions apply.'
          dr-xr-xr-x   9 ftp      ftp           154 May  6 10:43 .
          dr-xr-xr-x   9 ftp      ftp           154 May  6 10:43 ..
          dr-xr-xr-x   5 ftp      ftp          4096 May  6 10:43 CentOS
          dr-xr-xr-x   3 ftp      ftp            18 Jul 10  2008 Fedora
          >>>

     バージョン 3.2 で変更: *note with: 186. 構文のサポートが追加されま
     した。

     バージョン 3.3 で変更: 'source_address' 引数が追加されました。

     バージョン 3.9 で変更: If the 'timeout' parameter is set to be
     zero, it will raise a *note ValueError: 2ec. to prevent the
     creation of a non-blocking socket.  The 'encoding' parameter was
     added, and the default was changed from Latin-1 to UTF-8 to follow
     RFC 2640(2).

     Several ‘FTP’ methods are available in two flavors: one for
     handling text files and another for binary files.  The methods are
     named for the command which is used followed by ‘lines’ for the
     text version or ‘binary’ for the binary version.

     *note FTP: af6. インスタンスには以下のメソッドがあります:

      -- メソッド: set_debuglevel (level)

          Set the instance's debugging level as an *note int: 19b.  This
          controls the amount of debugging output printed.  The debug
          levels are:

             * ‘0’ (default): No debug output.

             * ‘1’: Produce a moderate amount of debug output, generally
               a single line per request.

             * ‘2’ or higher: Produce the maximum amount of debugging
               output, logging each line sent and received on the
               control connection.

      -- メソッド: connect (host='', port=0, timeout=None,
               source_address=None)

          Connect to the given host and port.  This function should be
          called only once for each instance; it should not be called if
          a 'host' argument was given when the *note FTP: af6. instance
          was created.  All other ‘FTP’ methods can only be called after
          a connection has successfully been made.


          パラメータ:

             * ‘host’ (*note str: 169.) - The host to connect to.

             * ‘port’ (*note int: 19b.) - The TCP port to connect to
               (default: ‘21’, as specified by the FTP protocol
               specification).  It is rarely needed to specify a
               different port number.

             * ‘timeout’ (*note float: 196.‘ | ’‘None’) - A timeout in
               seconds for the connection attempt (default: the global
               default timeout setting).

             * ‘source_address’ (*note tuple: 614.‘ | ’‘None’) - A
               2-tuple ‘(host, port)’ for the socket to bind to as its
               source address before connecting.

          引数 ‘self’, ‘host’, ‘port’ を指定して *note 監査イベント:
          1c6e. ‘ftplib.connect’ を送出します。

          バージョン 3.3 で変更: 'source_address' 引数が追加されました。

      -- メソッド: getwelcome ()

          サーバに最初に接続した際に送信される応答中のウェルカムメッセー
          ジを返します。(このメッセージには時に、ユーザにとって重要な免
          責事項や ヘルプ情報が入っています。)

      -- メソッド: login (user='anonymous', passwd='', acct='')

          Log on to the connected FTP server.  This function should be
          called only once for each instance, after a connection has
          been established; it should not be called if the 'host' and
          'user' arguments were given when the *note FTP: af6. instance
          was created.  Most FTP commands are only allowed after the
          client has logged in.


          パラメータ:

             * ‘user’ (*note str: 169.) - The username to log in with
               (default: ‘'anonymous'’).

             * ‘passwd’ (*note str: 169.) - The password to use when
               logging in.  If not given, and if 'passwd' is the empty
               string or ‘"-"’, a password will be automatically
               generated.

             * ‘acct’ (*note str: 169.) - Account information to be used
               for the ‘ACCT’ FTP command.  Few systems implement this.
               See RFC-959(3) for more details.

      -- メソッド: abort ()

          実行中のファイル転送を中止します。これはいつも機能するわけでは
          ありませんが、やってみる価値はあります。

      -- メソッド: sendcmd (cmd)

          シンプルなコマンド文字列をサーバに送信して、受信した文字列を返
          します。

          引数 ‘self’, ‘cmd’ を指定して *note 監査イベント: 1c6e.
          ‘ftplib.sendcmd’ を送出します。

      -- メソッド: voidcmd (cmd)

          Send a simple command string to the server and handle the
          response.  Return the response string if the response code
          corresponds to success (codes in the range 200-299).  Raise
          *note error_reply: 4003. otherwise.

          引数 ‘self’, ‘cmd’ を指定して *note 監査イベント: 1c6e.
          ‘ftplib.sendcmd’ を送出します。

      -- メソッド: retrbinary (cmd, callback, blocksize=8192, rest=None)

          Retrieve a file in binary transfer mode.


          パラメータ:

             * ‘cmd’ (*note str: 169.) - An appropriate ‘RETR’ command:
               ‘"RETR FILENAME"’.

             * ‘callback’ (*note callable: 2d7b.) - A single parameter
               callable that is called for each block of data received,
               with its single argument being the data as *note bytes:
               192.

             * ‘blocksize’ (*note int: 19b.) - The maximum chunk size to
               read on the low-level *note socket: fa1. object created
               to do the actual transfer.  This also corresponds to the
               largest size of data that will be passed to 'callback'.
               Defaults to ‘8192’.

             * ‘rest’ (*note int: 19b.) - A ‘REST’ command to be sent to
               the server.  See the documentation for the 'rest'
               parameter of the *note transfercmd(): 4005. method.

      -- メソッド: retrlines (cmd, callback=None)

          Retrieve a file or directory listing in the encoding specified
          by the 'encoding' parameter at initialization.  'cmd' should
          be an appropriate ‘RETR’ command (see *note retrbinary():
          4004.) or a command such as ‘LIST’ or ‘NLST’ (usually just the
          string ‘'LIST'’).  ‘LIST’ retrieves a list of files and
          information about those files.  ‘NLST’ retrieves a list of
          file names.  The 'callback' function is called for each line
          with a string argument containing the line with the trailing
          CRLF stripped.  The default 'callback' prints the line to
          *note sys.stdout: ccd.

      -- メソッド: set_pasv (val)

          'val' が真の場合 "パッシブ" モードを有効化し、偽の場合は無効化
          します。 デフォルトではパッシブモードです。

      -- メソッド: storbinary (cmd, fp, blocksize=8192, callback=None,
               rest=None)

          Store a file in binary transfer mode.


          パラメータ:

             * ‘cmd’ (*note str: 169.) - An appropriate ‘STOR’ command:
               ‘"STOR FILENAME"’.

             * ‘fp’ (*note file object: 13db.) - A file object (opened
               in binary mode) which is read until EOF, using its *note
               read(): 101d. method in blocks of size 'blocksize' to
               provide the data to be stored.

             * ‘blocksize’ (*note int: 19b.) - The read block size.
               Defaults to ‘8192’.

             * ‘callback’ (*note callable: 2d7b.) - A single parameter
               callable that is called for each block of data sent, with
               its single argument being the data as *note bytes: 192.

             * ‘rest’ (*note int: 19b.) - A ‘REST’ command to be sent to
               the server.  See the documentation for the 'rest'
               parameter of the *note transfercmd(): 4005. method.

          バージョン 3.2 で変更: The 'rest' parameter was added.

      -- メソッド: storlines (cmd, fp, callback=None)

          Store a file in line mode.  'cmd' should be an appropriate
          ‘STOR’ command (see *note storbinary(): 1521.).  Lines are
          read until EOF from the *note file object: 13db. 'fp' (opened
          in binary mode) using its *note readline(): 1541. method to
          provide the data to be stored.  'callback' is an optional
          single parameter callable that is called on each line after it
          is sent.

      -- メソッド: transfercmd (cmd, rest=None)

          データ接続中に転送を初期化します。もし転送中なら、‘EPRT’ ある
          いは ‘PORT’ コマンドと、'cmd' で指定したコマンドを送信し、接続
          を続けます。サーバがパッシブなら、‘EPSV’ あるいは ‘PASV’ コマ
          ンドを送信して接続し、転送コマンドを開始します。どちらの場合も
          、接続のためのソケットを返します。

          If optional 'rest' is given, a ‘REST’ command is sent to the
          server, passing 'rest' as an argument.  'rest' is usually a
          byte offset into the requested file, telling the server to
          restart sending the file's bytes at the requested offset,
          skipping over the initial bytes.  Note however that the *note
          transfercmd(): 4005. method converts 'rest' to a string with
          the 'encoding' parameter specified at initialization, but no
          check is performed on the string's contents.  If the server
          does not recognize the ‘REST’ command, an *note error_reply:
          4003. exception will be raised.  If this happens, simply call
          *note transfercmd(): 4005. without a 'rest' argument.

      -- メソッド: ntransfercmd (cmd, rest=None)

          *note transfercmd(): 4005. と同様ですが、データと予想されるサ
          イズとのタプルを返します。もしサイズが計算できないなら、サイズ
          の代わりに ‘None’ が返されます。 'cmd' と 'rest' は *note
          transfercmd(): 4005. のものと同じです。

      -- メソッド: mlsd (path='', facts=[])

          List a directory in a standardized format by using ‘MLSD’
          command ( RFC 3659(4)).  If 'path' is omitted the current
          directory is assumed.  'facts' is a list of strings
          representing the type of information desired (e.g.  ‘["type",
          "size", "perm"]’).  Return a generator object yielding a tuple
          of two elements for every file found in path.  First element
          is the file name, the second one is a dictionary containing
          facts about the file name.  Content of this dictionary might
          be limited by the 'facts' argument but server is not
          guaranteed to return all requested facts.

          Added in version 3.3.

      -- メソッド: nlst (argument[, ...])

          ‘NLST’ コマンドで返されるファイル名のリストを返します。省略可
          能な 'argument' は、リストアップするディレクトリです（デフォル
          トではサーバのカレントディレクトリです）。 ‘NLST’ コマンドに非
          標準である複数の引数を渡すことができます。

               注釈: If your server supports the command, *note mlsd():
               12d9. offers a better API.

      -- メソッド: dir (argument[, ...])

          Produce a directory listing as returned by the ‘LIST’ command,
          printing it to standard output.  The optional 'argument' is a
          directory to list (default is the current server directory).
          Multiple arguments can be used to pass non-standard options to
          the ‘LIST’ command.  If the last argument is a function, it is
          used as a 'callback' function as for *note retrlines(): 4006.;
          the default prints to *note sys.stdout: ccd.  This method
          returns ‘None’.

               注釈: If your server supports the command, *note mlsd():
               12d9. offers a better API.

      -- メソッド: rename (fromname, toname)

          サーバ上のファイルのファイル名 'fromname' を 'toname' へ変更し
          ます。

      -- メソッド: delete (filename)

          サーバからファイル 'filename' を削除します。成功したら応答のテ
          キストを返し、そうでないならパーミッションエラーでは *note
          error_perm: 400c. を、他のエラーでは *note error_reply: 4003.
          を返します。

      -- メソッド: cwd (pathname)

          サーバのカレントディレクトリを設定します。

      -- メソッド: mkd (pathname)

          サーバ上に新たにディレクトリを作ります。

      -- メソッド: pwd ()

          サーバ上のカレントディレクトリのパスを返します。

      -- メソッド: rmd (dirname)

          サーバ上のディレクトリ 'dirname' を削除します。

      -- メソッド: size (filename)

          サーバ上のファイル 'filename' のサイズを尋ねます。成功したらフ
          ァイルサイズが整数で返され、そうでないなら ‘None’ が返されます
          。 ‘SIZE’ コマンドは標準化されていませんが、多くの普通のサーバ
          で実装されていることに注意して下さい。

      -- メソッド: quit ()

          サーバに ‘QUIT’ コマンドを送信し、接続を閉じます。これは接続を
          閉じるのに"礼儀正しい"方法ですが、 ‘QUIT’ コマンドに反応してサ
          ーバの例外が発生するかもしれません。この例外は、 *note
          close(): 4013. メソッドによって *note FTP: af6. インスタンスに
          対するその後のコマンド使用が不可になっていることを示しています
          （下記参照）。

      -- メソッド: close ()

          接続を一方的に閉じます。既に閉じた接続に対して実行すべきではあ
          りません（例えば *note quit(): 4012. を呼び出して成功した後な
          ど）。この実行の後、 *note FTP: af6. インスタンスはもう使用す
          べきではありません（ *note close(): 4013. あるいは *note
          quit(): 4012. を呼び出した後で、 *note login(): 3fff. メソッド
          をもう一度実行して再び接続を開くことはできません）。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc959.html

   (2) https://datatracker.ietf.org/doc/html/rfc2640.html

   (3) https://datatracker.ietf.org/doc/html/rfc959.html

   (4) https://datatracker.ietf.org/doc/html/rfc3659.html


File: python.info,  Node: FTP_TLS オブジェクト,  Next: モジュール変数,  Prev: FTP オブジェクト,  Up: リファレンス<7>

5.22.11.3 FTP_TLS オブジェクト
..............................

 -- クラス: ftplib.FTP_TLS (host='', user='', passwd='', acct='', *,
          context=None, timeout=None, source_address=None,
          encoding='utf-8')

     An *note FTP: af6. subclass which adds TLS support to FTP as
     described in RFC 4217(1).  Connect to port 21 implicitly securing
     the FTP control connection before authenticating.

          注釈: The user must explicitly secure the data connection by
          calling the *note prot_p(): 4015. method.


     パラメータ:

        * ‘host’ (*note str: 169.) - The hostname to connect to.  If
          given, ‘connect(host)’ is implicitly called by the
          constructor.

        * ‘user’ (*note str: 169.) - The username to log in with
          (default: ‘'anonymous'’).  If given, ‘login(host, passwd,
          acct)’ is implicitly called by the constructor.

        * ‘passwd’ (*note str: 169.) - The password to use when logging
          in.  If not given, and if 'passwd' is the empty string or
          ‘"-"’, a password will be automatically generated.

        * ‘acct’ (*note str: 169.) - Account information to be used for
          the ‘ACCT’ FTP command.  Few systems implement this.  See
          RFC-959(2) for more details.

        * ‘context’ (*note ssl.SSLContext: 357.) - An SSL context object
          which allows bundling SSL configuration options, certificates
          and private keys into a single, potentially long-lived,
          structure.  Please read *note セキュリティで考慮すべき点:
          3895. for best practices.

        * ‘timeout’ (*note float: 196.‘ | ’‘None’) - A timeout in
          seconds for blocking operations like *note connect(): 3ffc.
          (default: the global default timeout setting).

        * ‘source_address’ (*note tuple: 614.‘ | ’‘None’) - A 2-tuple
          ‘(host, port)’ for the socket to bind to as its source address
          before connecting.

        * ‘encoding’ (*note str: 169.) - The encoding for directories
          and filenames (default: ‘'utf-8'’).

     Added in version 3.2.

     バージョン 3.3 で変更: Added the 'source_address' parameter.

     バージョン 3.4 で変更: このクラスは *note
     ssl.SSLContext.check_hostname: 39c4. と 'Server Name Indication' で
     ホスト名のチェックをサポートしました。(*note ssl.HAS_SNI: 39d6. を
     参照してください)。

     バージョン 3.9 で変更: If the 'timeout' parameter is set to be
     zero, it will raise a *note ValueError: 2ec. to prevent the
     creation of a non-blocking socket.  The 'encoding' parameter was
     added, and the default was changed from Latin-1 to UTF-8 to follow
     RFC 2640(3).

     バージョン 3.12 で変更: 非推奨の 'keyfile' と 'certfile' 引数を削除
     しました。

     *note FTP_TLS: af7. クラスを使ったサンプルセッションはこちらです:

          >>> ftps = FTP_TLS('ftp.pureftpd.org')
          >>> ftps.login()
          '230 Anonymous user logged in'
          >>> ftps.prot_p()
          '200 Data protection level set to "private"'
          >>> ftps.nlst()
          ['6jack', 'OpenBSD', 'antilink', 'blogbench', 'bsdcam', 'clockspeed', 'djbdns-jedi', 'docs', 'eaccelerator-jedi', 'favicon.ico', 'francotone', 'fugu', 'ignore', 'libpuzzle', 'metalog', 'minidentd', 'misc', 'mysql-udf-global-user-variables', 'php-jenkins-hash', 'php-skein-hash', 'php-webdav', 'phpaudit', 'phpbench', 'pincaster', 'ping', 'posto', 'pub', 'public', 'public_keys', 'pure-ftpd', 'qscan', 'qtc', 'sharedance', 'skycache', 'sound', 'tmp', 'ucarp']

     ‘FTP_TLS’ class inherits from *note FTP: af6, defining these
     additional methods and attributes:

      -- の属性: ssl_version

          The SSL version to use (defaults to *note ssl.PROTOCOL_SSLv23:
          39c8.).

      -- メソッド: auth ()

          *note ssl_version: 4016. 属性で指定されたものに従って、 TLS ま
          たは SSL を使い、セキュアコントロール接続をセットアップします
          。

          バージョン 3.4 で変更: The method now supports hostname check
          with *note ssl.SSLContext.check_hostname: 39c4. and 'Server
          Name Indication' (see *note ssl.HAS_SNI: 39d6.).

      -- メソッド: ccc ()

          Revert control channel back to plaintext.  This can be useful
          to take advantage of firewalls that know how to handle NAT
          with non-secure FTP without opening fixed ports.

          Added in version 3.3.

      -- メソッド: prot_p ()

          セキュアデータ接続をセットアップします。

      -- メソッド: prot_c ()

          平文データ接続をセットアップします。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc4217.html

   (2) https://datatracker.ietf.org/doc/html/rfc959.html

   (3) https://datatracker.ietf.org/doc/html/rfc2640.html


File: python.info,  Node: モジュール変数,  Prev: FTP_TLS オブジェクト,  Up: リファレンス<7>

5.22.11.4 モジュール変数
........................

 -- 例外: ftplib.error_reply

     サーバから想定外の応答があったときに送出される例外。

 -- 例外: ftplib.error_temp

     一時的エラーを表すエラーコード(400-499の範囲の応答コード)を受け取っ
     た時に発生する例外。

 -- 例外: ftplib.error_perm

     永久エラーを表すエラーコード(500-599の範囲の応答コード)を受け取った
     時に発生する例外。

 -- 例外: ftplib.error_proto

     File Transfer Protocol の応答仕様に適合しない、すなわち1-5の数字で
     始まらない応答コードをサーバから受け取った時に発生する例外。

 -- データ: ftplib.all_errors

     *note FTP: af6. インスタンスのメソッド実行時、FTP接続で (プログラミ
     ングのエラーと考えられるメソッドの実行によって) 発生する全ての例外
     (タプル形式)。この例外には以上の４つのエラーはもちろん、 *note
     OSError: 2c0. と *note EOFError: 14f1. も含まれます。

参考
....

*note netrc: 9f. モジュール

     ‘.netrc’ ファイルフォーマットのパーザ。 ‘.netrc’ ファイルは、 FTPク
     ライアントがユーザにプロンプトを出す前に、ユーザ認証情報をロードす
     るのによく使われます。


File: python.info,  Node: poplib --- POP3 プロトコルクライアント,  Next: imaplib --- IMAP4 プロトコルクライアント,  Prev: ftplib --- FTP プロトコルクライアント,  Up: インターネットプロトコルとサポート

5.22.12 ‘poplib’ -- POP3 プロトコルクライアント
-----------------------------------------------

'ソースコード:' Lib/poplib.py(1)

__________________________________________________________________

このモジュールはクラス *note POP3: b1d. を定義しています。 *note POP3:
b1d. はPOP3 サーバへの接続をカプセル化し、 RFC 1939(2) で定義されている
プロトコルを実装しています。 *note POP3: b1d. クラスは RFC 1939(3) の最
小限のコマンドセットとオプションのコマンドセットをサポートしています。 既
に確立されている接続で暗号化された通信を行うために、 RFC 2595(4) で導入
された ‘STLS’ コマンドもサポートされています。

加えて、このモジュールはクラス *note POP3_SSL: b1e. を提供しています。
*note POP3_SSL: b1e. は SSL を下層のプロトコルレイヤーとして使う POP3 サ
ーバへの接続をサポートしています。

POP3についての注意事項は、それが広くサポートされているにもかかわらず、既
に時代遅れだということです。幾つも実装されているPOP3サーバーの品質は、貧
弱なものが多数を占めています。もし、お使いのメールサーバーがIMAPをサポー
トしているなら、 *note imaplib.IMAP4: aff. クラスが使えます。 IMAPサーバ
ーは、より良く実装されている傾向があります。

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

The ‘poplib’ module provides two classes:

 -- クラス: poplib.POP3 (host, port=POP3_PORT[, timeout])

     このクラスが、実際にPOP3プロトコルを実装します。インスタンスが初期
     化されるときに、コネクションが作成されます。 'port' が省略されると
     、POP3標準のポート(110)が使われます。オプションの 'timeout' 引数は
     、接続時のタイムアウト時間を秒数で指定します (指定されなかった場合
     は、グローバルのデフォルトタイムアウト設定が利用されます)。

     引数 ‘self’, ‘host’, ‘port’ 付きで *note 監査イベント: 1c6e.
     ‘poplib.connect’ を送出します。

     全てのコマンドは引数 ‘self’ と ‘line’ を指定して *note auditing
     event: 1c6e. ‘poplib.putline’ を送出します。ここで ‘line’ はリモー
     トホストに送信されるバイト数です。

     バージョン 3.9 で変更: 'timeout' パラメータが0に設定されている場合
     、非ブロッキングソケットの作成を防ぐために *note ValueError: 2ec. を
     送出します。

 -- クラス: poplib.POP3_SSL (host, port=POP3_SSL_PORT, *, timeout=None,
          context=None)

     *note POP3: b1d. クラスのサブクラスで、SSL でカプセル化されたソケッ
     トによる POP サーバへの接続を提供します。 'port' が指定されていない
     場合、 POP3-over-SSL 標準の 995 番ポートが使われます。'timeout' に
     ついては *note POP3: b1d. クラスのコンストラクタの引数と同じです。
     'context' は SSL の設定、証明書、秘密鍵を一つの (POP3_SSL オブジェ
     クトよりも長く存在し続けうる) 構造にまとめた *note ssl.SSLContext:
     357. オブジェクトで、省略可能です。ベストプラクティスについては
     *note セキュリティで考慮すべき点: 3895. を参照してください。

     引数 ‘self’, ‘host’, ‘port’ 付きで *note 監査イベント: 1c6e.
     ‘poplib.connect’ を送出します。

     全てのコマンドは引数 ‘self’ と ‘line’ を指定して *note auditing
     event: 1c6e. ‘poplib.putline’ を送出します。ここで ‘line’ はリモー
     トホストに送信されるバイト数です。

     バージョン 3.2 で変更: 'context' 引数が追加されました。

     バージョン 3.4 で変更: このクラスは *note
     ssl.SSLContext.check_hostname: 39c4. と 'Server Name Indication' で
     ホスト名のチェックをサポートしました。(*note ssl.HAS_SNI: 39d6. を
     参照してください)。

     バージョン 3.9 で変更: 'timeout' パラメータが0に設定されている場合
     、非ブロッキングソケットの作成を防ぐために *note ValueError: 2ec. を
     送出します。

     バージョン 3.12 で変更: 非推奨の 'keyfile' と 'certfile' 引数を削除
     しました。

One exception is defined as an attribute of the ‘poplib’ module:

 -- 例外: poplib.error_proto

     このモジュール内で起こったあらゆるエラーで送出される例外です (*note
     socket: d1. モジュールからのエラーは捕捉されません)。例外の理由は文
     字列としてコンストラクタに渡されます。

参考
....

モジュール *note imaplib: 78.

     標準 Python IMAP モジュールです。

Frequently Asked Questions About Fetchmail(5)

     POP/IMAPクライアント ‘fetchmail’ のFAQ。POPプロトコルをベースにした
     アプリケーションを書くときに有用な、POP3サーバの種類や RFCへの適合
     度といった情報を収集しています。

* Menu:

* POP3 オブジェクト::
* POP3 の例::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/poplib.py

   (2) https://datatracker.ietf.org/doc/html/rfc1939.html

   (3) https://datatracker.ietf.org/doc/html/rfc1939.html

   (4) https://datatracker.ietf.org/doc/html/rfc2595.html

   (5) http://www.catb.org/~esr/fetchmail/fetchmail-FAQ.html


File: python.info,  Node: POP3 オブジェクト,  Next: POP3 の例,  Up: poplib --- POP3 プロトコルクライアント

5.22.12.1 POP3 オブジェクト
...........................

POP3コマンドはすべて、それと同じ名前のメソッドとして小文字で表現されます
。そしてそのほとんどは、サーバからのレスポンスとなるテキストを返します。

*note POP3: b1d. クラスのインスタンスは以下のメソッドを持ちます:

 -- メソッド: POP3.set_debuglevel (level)

     インスタンスのデバッグレベルを設定します。この設定によってデバッグ
     時に出力される量を調節します。デフォルトは ‘0’ で、何も出力されませ
     ん。 ‘1’ なら、一般的に１つのコマンドあたり１行の適当な量のデバッグ
     出力を行います。 ‘2’ 以上なら、コントロール接続で受信した各行を出力
     して、最大のデバッグ出力をします。

 -- メソッド: POP3.getwelcome ()

     POP3サーバーから送られるグリーティングメッセージを返します。

 -- メソッド: POP3.capa ()

     RFC 2449(1) で規定されている機能についてサーバに問い合わせます。
     ‘{'name': ['param'...]}’ という形の辞書を返します。

     Added in version 3.4.

 -- メソッド: POP3.user (username)

     userコマンドを送出します。応答はパスワード要求を表示します。

 -- メソッド: POP3.pass_ (password)

     パスワードを送出します。応答は、メッセージ数とメールボックスのサイ
     ズを含みます。注意：サーバー上のメールボックスは *note quit():
     13b3. が呼ばれるまでロックされます。

 -- メソッド: POP3.apop (user, secret)

     POP3サーバーにログオンするのに、よりセキュアなAPOP認証を使用します
     。

 -- メソッド: POP3.rpop (user)

     POP3サーバーにログオンするのに、（UNIXのr-コマンドと同様の）RPOP認
     証を使用します。

 -- メソッド: POP3.stat ()

     メールボックスの状態を得ます。結果は2つのintegerからなるタプルとな
     ります。 ‘(message count, mailbox size)’.

 -- メソッド: POP3.list ([which])

     メッセージのリストを要求します。結果は ‘(response, ['mesg_num
     octets', ...], octets)’ という形式で表されます。 'which' が与えられ
     ると、それによりメッセージを指定します。

 -- メソッド: POP3.retr (which)

     'which' 番のメッセージ全体を取り出し、そのメッセージに既読フラグを
     立てます。結果は ‘(response, ['line', ...], octets)’ という形式で表
     されます。

 -- メソッド: POP3.dele (which)

     'which' 番のメッセージに削除のためのフラグを立てます。ほとんどのサ
     ーバで、QUITコマンドが実行されるまでは実際の削除は行われません（も
     っとも良く知られた例外は Eudora QPOPで、その配送メカニズムはRFCに違
     反しており、どんな切断状況でも削除操作を未解決にしています）。

 -- メソッド: POP3.rset ()

     メールボックスの削除マークすべてを取り消します。

 -- メソッド: POP3.noop ()

     何もしません。接続保持のために使われます。

 -- メソッド: POP3.quit ()

     サインオフ: 変更をコミットし、メールボックスをアンロックして、接続
     を破棄します。

 -- メソッド: POP3.top (which, howmuch)

     メッセージヘッダと 'howmuch' で指定した行数のメッセージを、 'which'
     で指定したメッセージ分取り出します。結果は以下のような形式となりま
     す。 ‘(response, ['line', ...], octets)’.

     このメソッドはPOP3のTOPコマンドを利用し、RETRコマンドのように、メッ
     セージに既読フラグをセットしません。残念ながら、TOPコマンドはRFCで
     は貧弱な仕様しか定義されておらず、しばしばノーブランドのサーバーで
     は（その仕様が）守られていません。このメソッドを信用してしまう前に
     、実際に使用するPOPサーバーでテストをしてください。

 -- メソッド: POP3.uidl (which=None)

     （ユニークIDによる）メッセージダイジェストのリストを返します。
     'which' が設定されている場合、結果はユニークIDを含みます。それは
     ‘'response mesgnum uid’ という形式のメッセージ、または ‘(response,
     ['mesgnum uid', ...], octets)’ という形式のリストとなります。

 -- メソッド: POP3.utf8 ()

     UTF-8 モードへの切り替えを試行します。成功した場合はサーバの応答を
     返し、失敗した場合は *note error_proto: 13b4. を送出します。 RFC
     6856(2) で規定されています。

     Added in version 3.5.

 -- メソッド: POP3.stls (context=None)

     アクティブな接続にて RFC 2595(3) で定められた方法で TLS セッション
     を開始します。TLS セッションはユーザ認証を行う前に開始する必要があ
     ります。

     'context' は SSL の設定、証明書、秘密鍵を一つの (POP3 オブジェクト
     よりも長く存在し続けうる) 構造にまとめた *note ssl.SSLContext: 357.
     オブジェクトです。ベストプラクティスについては *note
     セキュリティで考慮すべき点: 3895. を参照してください。

     このメソッドは *note ssl.SSLContext.check_hostname: 39c4. と
     'Server Name Indication' でホスト名のチェックをサポートしました。
     (*note ssl.HAS_SNI: 39d6. を参照してください)。

     Added in version 3.4.

*note POP3_SSL: b1e. クラスのインスタンスは追加のメソッドを持ちません。
このサブクラスのインターフェイスは親クラスと同じです。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2449.html

   (2) https://datatracker.ietf.org/doc/html/rfc6856.html

   (3) https://datatracker.ietf.org/doc/html/rfc2595.html


File: python.info,  Node: POP3 の例,  Prev: POP3 オブジェクト,  Up: poplib --- POP3 プロトコルクライアント

5.22.12.2 POP3 の例
...................

以下にメールボックスを開き、全てのメッセージを取得して印刷する最小の (エ
ラーチェックをしない) 使用例を示します:

     import getpass, poplib

     M = poplib.POP3('localhost')
     M.user(getpass.getuser())
     M.pass_(getpass.getpass())
     numMessages = len(M.list()[1])
     for i in range(numMessages):
         for j in M.retr(i+1)[1]:
             print(j)

モジュールの末尾に、より拡張的な使用例が収められたテストセクションがあり
ます。


File: python.info,  Node: imaplib --- IMAP4 プロトコルクライアント,  Next: smtplib --- SMTP プロトコルクライアント,  Prev: poplib --- POP3 プロトコルクライアント,  Up: インターネットプロトコルとサポート

5.22.13 ‘imaplib’ -- IMAP4 プロトコルクライアント
-------------------------------------------------

'ソースコード:' Lib/imaplib.py(1)

__________________________________________________________________

このモジュールでは三つのクラス、 *note IMAP4: aff, *note IMAP4_SSL: b00.
と *note IMAP4_stream: b02. を定義します。これらのクラスは IMAP4 サーバ
への接続をカプセル化し、 RFC 2060(2) に定義されている IMAP4rev1 クライア
ントプロトコルの大規模なサブセットを実装しています。このクラスは IMAP4 (
RFC 1730(3)) 準拠のサーバと後方互換性がありますが、 ‘STATUS’ コマンドは
IMAP4 ではサポートされていないので注意してください。

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

Three classes are provided by the ‘imaplib’ module, *note IMAP4: aff. is
the base class:

 -- クラス: imaplib.IMAP4 (host='', port=IMAP4_PORT, timeout=None)

     This class implements the actual IMAP4 protocol.  The connection is
     created and protocol version (IMAP4 or IMAP4rev1) is determined
     when the instance is initialized.  If 'host' is not specified, ‘''’
     (the local host) is used.  If 'port' is omitted, the standard IMAP4
     port (143) is used.  The optional 'timeout' parameter specifies a
     timeout in seconds for the connection attempt.  If timeout is not
     given or is ‘None’, the global default socket timeout is used.

     The *note IMAP4: aff. class supports the *note with: 186.
     statement.  When used like this, the IMAP4 ‘LOGOUT’ command is
     issued automatically when the ‘with’ statement exits.  E.g.:

          >>> from imaplib import IMAP4
          >>> with IMAP4("domain.org") as M:
          ...     M.noop()
          ...
          ('OK', [b'Nothing Accomplished. d25if65hy903weo.87'])

     バージョン 3.5 で変更: *note with: 186. 構文のサポートが追加されま
     した。

     バージョン 3.9 で変更: オプションの 'timeout' 引数が追加されました
     。

例外は *note IMAP4: aff. クラスの属性として定義されています:

 -- 例外: IMAP4.error

     何らかのエラー発生の際に送出される例外です。例外の理由は文字列とし
     てコンストラクタに渡されます。

 -- 例外: IMAP4.abort

     IMAP4 サーバのエラーが生じると、この例外が送出されます。この例外は
     *note IMAP4.error: 17f7. のサブクラスです。通常、インスタンスを閉じ
     、新たなインスタンスを再び生成することで、この例外から復旧できます
     。

 -- 例外: IMAP4.readonly

     この例外は書き込み可能なメールボックスの状態がサーバによって変更さ
     れた際に送出されます。この例外は *note IMAP4.error: 17f7. のサブク
     ラスです。他の何らかのクライアントが現在書き込み権限を獲得しており
     、メールボックスを開きなおして書き込み権限を再獲得する必要がありま
     す。

このモジュールではもう一つ、安全 (secure) な接続を使ったサブクラスがあり
ます:

 -- クラス: imaplib.IMAP4_SSL (host='', port=IMAP4_SSL_PORT, *,
          ssl_context=None, timeout=None)

     This is a subclass derived from *note IMAP4: aff. that connects
     over an SSL encrypted socket (to use this class you need a socket
     module that was compiled with SSL support).  If 'host' is not
     specified, ‘''’ (the local host) is used.  If 'port' is omitted,
     the standard IMAP4-over-SSL port (993) is used.  'ssl_context' is a
     *note ssl.SSLContext: 357. object which allows bundling SSL
     configuration options, certificates and private keys into a single
     (potentially long-lived) structure.  Please read *note
     セキュリティで考慮すべき点: 3895. for best practices.

     The optional 'timeout' parameter specifies a timeout in seconds for
     the connection attempt.  If timeout is not given or is ‘None’, the
     global default socket timeout is used.

     バージョン 3.3 で変更: 'ssl_context' 引数が追加されました。

     バージョン 3.4 で変更: このクラスは *note
     ssl.SSLContext.check_hostname: 39c4. と 'Server Name Indication' で
     ホスト名のチェックをサポートしました。(*note ssl.HAS_SNI: 39d6. を
     参照してください)。

     バージョン 3.9 で変更: オプションの 'timeout' 引数が追加されました
     。

     バージョン 3.12 で変更: 非推奨の 'keyfile' と 'certfile' 引数を削除
     しました。

さらにもう一つのサブクラスは、子プロセスで確立した接続を使用する場合に使
用します:

 -- クラス: imaplib.IMAP4_stream (command)

     *note IMAP4: aff. から派生したサブクラスで、 'command' を
     ‘subprocess.Popen()’ に渡して作成される ‘stdin/stdout’ ディスクリプ
     タと接続します。

以下のユーティリティ関数が定義されています:

 -- の関数: imaplib.Internaldate2tuple (datestr)

     IMAP4 の ‘INTERNALDATE’ 文字列を解析してそれに相当するローカルタイ
     ムを返します。戻り値は *note time.struct_time: ee6. のタプルか、文
     字列のフォーマットが不正な場合は ‘None’ です。

 -- の関数: imaplib.Int2AP (num)

     整数を [‘A’ ..  ‘P’] からなる文字集合を用いて表現した bytes に変換
     します。

 -- の関数: imaplib.ParseFlags (flagstr)

     IMAP4 ‘FLAGS’ 応答を個々のフラグからなるタプルに変換します。

 -- の関数: imaplib.Time2Internaldate (date_time)

     Convert 'date_time' to an IMAP4 ‘INTERNALDATE’ representation.  The
     return value is a string in the form: ‘"DD-Mmm-YYYY HH:MM:SS
     +HHMM"’ (including double-quotes).  The 'date_time' argument can be
     a number (int or float) representing seconds since epoch (as
     returned by *note time.time(): 55d.), a 9-tuple representing local
     time an instance of *note time.struct_time: ee6. (as returned by
     *note time.localtime(): 1712.), an aware instance of *note
     datetime.datetime: 4e2, or a double-quoted string.  In the last
     case, it is assumed to already be in the correct format.

IMAP4 メッセージ番号は、メールボックスに対する変更が行われた後には変化し
ます; 特に、‘EXPUNGE’ 命令はメッセージの削除を行いますが、残ったメッセー
ジには再度番号を振りなおします。従って、メッセージ番号ではなく、UID 命令
を使い、その UID を利用するよう強く勧めます。

モジュールの末尾に、より拡張的な使用例が収められたテストセクションがあり
ます。

参考
....

Documents describing the protocol, sources for servers implementing it,
by the University of Washington's IMAP Information Center can all be
found at ('Source Code') ‘https://github.com/uw-imap/imap’ ('Not
Maintained').

* Menu:

* IMAP4 オブジェクト::
* IMAP4 の使用例::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/imaplib.py

   (2) https://datatracker.ietf.org/doc/html/rfc2060.html

   (3) https://datatracker.ietf.org/doc/html/rfc1730.html


File: python.info,  Node: IMAP4 オブジェクト,  Next: IMAP4 の使用例,  Up: imaplib --- IMAP4 プロトコルクライアント

5.22.13.1 IMAP4 オブジェクト
............................

All IMAP4rev1 commands are represented by methods of the same name,
either uppercase or lowercase.

命令に対する引数は全て文字列に変換されます。例外は ‘AUTHENTICATE’ の引数
と ‘APPEND’ の最後の引数で、これは IMAP4 リテラルとして渡されます。必要
に応じて (IMAP4 プロトコルが感知対象としている文字が文字列に入っており、
かつ丸括弧か二重引用符で囲われていなかった場合) 文字列はクオートされます
。しかし、‘LOGIN’ 命令の 'password' 引数は常にクオートされます。文字列が
クオートされないようにしたい (例えば ‘STORE’ 命令の 'flags' 引数) 場合、
文字列を丸括弧で囲んでください (例: ‘r'(\Deleted)'’)。

Most commands return a tuple: ‘(type, [data, ...])’ where 'type' is
usually ‘'OK'’ or ‘'NO'’, and 'data' is either the text from the command
response, or mandated results from the command.  Each 'data' is either a
‘bytes’, or a tuple.  If a tuple, then the first part is the header of
the response, and the second part contains the data (ie: 'literal'
value).

以下のコマンドにおける 'message_set' オプションは、操作の対象となるひと
つあるいは複数のメッセージを指す文字列です。単一のメッセージ番号 (‘'1'’)
かメッセージ番号の範囲 (‘'2:4'’)、あるいは連続していないメッセージをカン
マでつなげたもの (‘'1:3,6:9'’) となります。範囲指定でアスタリスクを使用
すると、上限を無限とすることができます (‘'3:*'’)。

*note IMAP4: aff. のインスタンスは以下のメソッドを持っています:

 -- メソッド: IMAP4.append (mailbox, flags, date_time, message)

     指定された名前のメールボックスに 'message' を追加します。

 -- メソッド: IMAP4.authenticate (mechanism, authobject)

     認証命令です -- 応答の処理が必要です。

     'mechanism' は利用する認証メカニズムを与えます。認証メカニズムはイ
     ンスタンス変数 ‘capabilities’ の中に ‘AUTH=mechanism’ という形式で
     現れる必要があります。

     'authobject' は呼び出し可能なオブジェクトである必要があります:

          data = authobject(response)

     It will be called to process server continuation responses; the
     'response' argument it is passed will be ‘bytes’.  It should return
     ‘bytes’ 'data' that will be base64 encoded and sent to the server.
     It should return ‘None’ if the client abort response ‘*’ should be
     sent instead.

     バージョン 3.5 で変更: string usernames and passwords are now
     encoded to ‘utf-8’ instead of being limited to ASCII.

 -- メソッド: IMAP4.check ()

     サーバ上のメールボックスにチェックポイントを設定します。

 -- メソッド: IMAP4.close ()

     現在選択されているメールボックスを閉じます。削除されたメッセージは
     書き込み可能メールボックスから除去されます。‘LOGOUT’ 前に実行するこ
     とを勧めます。

 -- メソッド: IMAP4.copy (message_set, new_mailbox)

     'message_set' で指定したメッセージ群を 'new_mailbox' の末尾にコピー
     します。

 -- メソッド: IMAP4.create (mailbox)

     'mailbox' と名づけられた新たなメールボックスを生成します。

 -- メソッド: IMAP4.delete (mailbox)

     'mailbox' と名づけられた古いメールボックスを削除します。

 -- メソッド: IMAP4.deleteacl (mailbox, who)

     mailbox における who についてのACLを削除(権限を削除)します。

 -- メソッド: IMAP4.enable (capability)

     Enable 'capability' (see RFC 5161(1)).  Most capabilities do not
     need to be enabled.  Currently only the ‘UTF8=ACCEPT’ capability is
     supported (see RFC 6855(2)).

     Added in version 3.5: The *note enable(): 100e. method itself, and
     RFC 6855(3) support.

 -- メソッド: IMAP4.expunge ()

     選択されたメールボックスから削除された要素を永久に除去します。各々
     の削除されたメッセージに対して、‘EXPUNGE’ 応答を生成します。返され
     るデータには ‘EXPUNGE’ メッセージ番号を受信した順番に並べたリストが
     入っています。

 -- メソッド: IMAP4.fetch (message_set, message_parts)

     メッセージ (の一部) を取りよせます。'message_parts' はメッセージパ
     ートの名前を表す文字列を丸括弧で囲ったもので、例えば: ‘"(UID
     BODY[TEXT])"’ のようになります。返されるデータはメッセージパートの
     エンベロープ情報とデータからなるタプルです。

 -- メソッド: IMAP4.getacl (mailbox)

     'mailbox' に対する ‘ACL’ を取得します。このメソッドは非標準ですが、
     ‘Cyrus’ サーバでサポートされています。

 -- メソッド: IMAP4.getannotation (mailbox, entry, attribute)

     'mailbox' に対する ‘ANNOTATION’ を取得します。このメソッドは非標準
     ですが、‘Cyrus’ サーバでサポートされています。

 -- メソッド: IMAP4.getquota (root)

     ‘quota’ 'root' により、リソース使用状況と制限値を取得します。このメ
     ソッドは RFC 2087(4) で定義されている IMAP4 QUOTA 拡張の一部です。

 -- メソッド: IMAP4.getquotaroot (mailbox)

     'mailbox' に対して ‘quota’ 'root' を実行した結果のリストを取得しま
     す。このメソッドは RFC 2087(5) で定義されている IMAP4 QUOTA 拡張の
     一部です。

 -- メソッド: IMAP4.idle (duration=None)

     Return an ‘Idler’: an iterable context manager implementing the
     IMAP4 ‘IDLE’ command as defined in RFC 2177(6).

     The returned object sends the ‘IDLE’ command when activated by the
     *note with: 186. statement, produces IMAP untagged responses via
     the *note iterator: 4c8. protocol, and sends ‘DONE’ upon context
     exit.

     All untagged responses that arrive after sending the ‘IDLE’ command
     (including any that arrive before the server acknowledges the
     command) will be available via iteration.  Any leftover responses
     (those not iterated in the *note with: 186. context) can be
     retrieved in the usual way after ‘IDLE’ ends, using *note
     IMAP4.response(): 404a.

     Responses are represented as ‘(type, [data, ...])’ tuples, as
     described in *note IMAP4 Objects: 403c.

     The 'duration' argument sets a maximum duration (in seconds) to
     keep idling, after which any ongoing iteration will stop.  It can
     be an *note int: 19b. or *note float: 196, or ‘None’ for no time
     limit.  Callers wishing to avoid inactivity timeouts on servers
     that impose them should keep this at most 29 minutes (1740
     seconds).  Requires a socket connection; 'duration' must be ‘None’
     on *note IMAP4_stream: b02. connections.

          >>> with M.idle(duration=29 * 60) as idler:
          ...     for typ, data in idler:
          ...         print(typ, data)
          ...
          EXISTS [b'1']
          RECENT [b'1']

      -- メソッド: Idler.burst (interval=0.1)

          Yield a burst of responses no more than 'interval' seconds
          apart (expressed as an *note int: 19b. or *note float: 196.).

          This *note generator: 126c. is an alternative to iterating one
          response at a time, intended to aid in efficient batch
          processing.  It retrieves the next response along with any
          immediately available subsequent responses.  (For example, a
          rapid series of ‘EXPUNGE’ responses after a bulk delete.)

          Requires a socket connection; does not work on *note
          IMAP4_stream: b02. connections.

               >>> with M.idle() as idler:
               ...     # get a response and any others following by < 0.1 seconds
               ...     batch = list(idler.burst())
               ...     print(f'processing {len(batch)} responses...')
               ...     print(batch)
               ...
               processing 3 responses...
               [('EXPUNGE', [b'2']), ('EXPUNGE', [b'1']), ('RECENT', [b'0'])]

               Tip: The ‘IDLE’ context's maximum duration, as passed to
               *note IMAP4.idle(): 22d, is respected when waiting for
               the first response in a burst.  Therefore, an expired
               ‘Idler’ will cause this generator to return immediately
               without producing anything.  Callers should consider this
               if using it in a loop.

          注釈: The iterator returned by *note IMAP4.idle(): 22d. is
          usable only within a *note with: 186. statement.  Before or
          after that context, unsolicited responses are collected
          internally whenever a command finishes, and can be retrieved
          with *note IMAP4.response(): 404a.

          注釈: The ‘Idler’ class name and structure are internal
          interfaces, subject to change.  Calling code can rely on its
          context management, iteration, and public method to remain
          stable, but should not subclass, instantiate, compare, or
          otherwise directly reference the class.

     Added in version 3.14.

 -- メソッド: IMAP4.list ([directory[, pattern]])

     'pattern' にマッチする 'directory' メールボックス名を列挙します。
     'directory' の標準の設定値は最上レベルのメールフォルダで、'pattern'
     は標準の設定では全てにマッチします。返されるデータには ‘LIST’ 応答
     のリストが入っています。

 -- メソッド: IMAP4.login (user, password)

     平文パスワードを使ってクライアントを照合します。'password' はクオー
     トされます。

 -- メソッド: IMAP4.login_cram_md5 (user, password)

     パスワードの保護のため、クライアント認証時に ‘CRAM-MD5’ だけを使用
     します。これは、‘CAPABILITY’ レスポンスに ‘AUTH=CRAM-MD5’ が含まれ
     る場合のみ有効です。

     バージョン 3.14 で変更: An *note IMAP4.error: 17f7. is raised if
     MD5 support is not available.

 -- メソッド: IMAP4.logout ()

     サーバへの接続を遮断します。サーバからの ‘BYE’ 応答を返します。

     バージョン 3.8 で変更: The method no longer ignores silently
     arbitrary exceptions.

 -- メソッド: IMAP4.lsub (directory='""', pattern='*')

     購読しているメールボックス名のうち、ディレクトリ内でパターンにマッ
     チするものを列挙します。'directory' の標準の設定値は最上レベルのメ
     ールフォルダで、'pattern' は標準の設定では全てにマッチします。返さ
     れるデータには返されるデータはメッセージパートエンベロープ情報とデ
     ータからなるタプルです。

 -- メソッド: IMAP4.myrights (mailbox)

     mailboxにおける自分のACLを返します (すなわち自分がmailboxで持ってい
     る権限を返します)。

 -- メソッド: IMAP4.namespace ()

     RFC 2342(7) で定義されるIMAP名前空間を返します。

 -- メソッド: IMAP4.noop ()

     サーバに ‘NOOP’ を送信します。

 -- メソッド: IMAP4.open (host, port, timeout=None)

     Opens socket to 'port' at 'host'.  The optional 'timeout' parameter
     specifies a timeout in seconds for the connection attempt.  If
     timeout is not given or is ‘None’, the global default socket
     timeout is used.  Also note that if the 'timeout' parameter is set
     to be zero, it will raise a *note ValueError: 2ec. to reject
     creating a non-blocking socket.  This method is implicitly called
     by the *note IMAP4: aff. constructor.  The connection objects
     established by this method will be used in the *note IMAP4.read():
     4052, *note IMAP4.readline(): 4053, *note IMAP4.send(): 4054, and
     *note IMAP4.shutdown(): 4055. methods.  You may override this
     method.

     引数 ‘self’, ‘host’, ‘port’ を指定して *note 監査イベント: 1c6e.
     ‘imaplib.open’ を送出します。

     バージョン 3.9 で変更: 'timeout' 引数が追加されました。

 -- メソッド: IMAP4.partial (message_num, message_part, start, length)

     メッセージの後略された部分を取り寄せます。返されるデータはメッセー
     ジパートエンベロープ情報とデータからなるタプルです。

 -- メソッド: IMAP4.proxyauth (user)

     'user' として認証されたものとします。認証された管理者がユーザの代理
     としてメールボックスにアクセスする際に使用します。

 -- メソッド: IMAP4.read (size)

     遠隔のサーバから 'size' バイト読み出します。このメソッドはオーバラ
     イドすることができます。

 -- メソッド: IMAP4.readline ()

     遠隔のサーバから一行読み出します。このメソッドはオーバライドするこ
     とができます。

 -- メソッド: IMAP4.recent ()

     サーバに更新を促します。新たなメッセージがない場合応答は ‘None’ に
     なり、そうでない場合 ‘RECENT’ 応答の値になります。

 -- メソッド: IMAP4.rename (oldmailbox, newmailbox)

     'oldmailbox' という名前のメールボックスを 'newmailbox' に名称変更し
     ます。

 -- メソッド: IMAP4.response (code)

     応答 'code' を受信していれば、そのデータを返し、そうでなければ
     ‘None’ を返します。通常の形式 (usual type) ではなく指定したコードを
     返します。

 -- メソッド: IMAP4.search (charset, criterion[, ...])

     Search mailbox for matching messages.  'charset' may be ‘None’, in
     which case no ‘CHARSET’ will be specified in the request to the
     server.  The IMAP protocol requires that at least one criterion be
     specified; an exception will be raised when the server returns an
     error.  'charset' must be ‘None’ if the ‘UTF8=ACCEPT’ capability
     was enabled using the *note enable(): 100e. command.

     以下はプログラム例です:

          # M is a connected IMAP4 instance...
          typ, msgnums = M.search(None, 'FROM', '"LDJ"')

          # or:
          typ, msgnums = M.search(None, '(FROM "LDJ")')

 -- メソッド: IMAP4.select (mailbox='INBOX', readonly=False)

     メールボックスを選択します。返されるデータは 'mailbox' 内のメッセー
     ジ数 (‘EXISTS’ 応答) です。標準の設定では 'mailbox' は ‘'INBOX'’ で
     す。'readonly' が設定された場合、メールボックスに対する変更はできま
     せん。

 -- メソッド: IMAP4.send (data)

     遠隔のサーバに ‘data’ を送信します。このメソッドはオーバライドする
     ことができます。

     引数 ‘self’, ‘data’ を指定して *note 監査イベント: 1c6e.
     ‘imaplib.send’ を送出します。

 -- メソッド: IMAP4.setacl (mailbox, who, what)

     ‘ACL’ を 'mailbox' に設定します。このメソッドは非標準ですが、
     ‘Cyrus’ サーバでサポートされています。

 -- メソッド: IMAP4.setannotation (mailbox, entry, attribute[, ...])

     ‘ANNOTATION’ を 'mailbox' に設定します。このメソッドは非標準ですが
     、‘Cyrus’ サーバでサポートされています。

 -- メソッド: IMAP4.setquota (root, limits)

     ‘quota’ 'root' のリソースを 'limits' に設定します。このメソッドは
     RFC 2087(8) で定義されている IMAP4 QUOTA 拡張の一部です。

 -- メソッド: IMAP4.shutdown ()

     ‘open’ で確立された接続を閉じます。 *note IMAP4.logout(): c84. は暗
     黙的にこのメソッドを呼び出します。このメソッドはオーバライドするこ
     とができます。

 -- メソッド: IMAP4.socket ()

     サーバへの接続に使われているソケットインスタンスを返します。

 -- メソッド: IMAP4.sort (sort_criteria, charset, search_criterion[,
          ...])

     ‘sort’ 命令は ‘search’ に結果の並べ替え (sort) 機能をつけた変種です
     。返されるデータには、条件に合致するメッセージ番号をスペースで分割
     したリストが入っています。

     sort 命令は 'search_criterion' の前に二つの引数を持ちます;
     'sort_criteria' のリストを丸括弧で囲ったものと、検索時の 'charset'
     です。‘search’ と違って、検索時の 'charset' は必須です。‘uid sort’
     命令もあり、‘search’ に対する ‘uid search’ と同じように ‘sort’ 命令
     に対応します。‘sort’ 命令はまず、charset 引数の指定に従って
     searching criteria の文字列を解釈し、メールボックスから与えられた検
     索条件に合致するメッセージを探します。次に、合致したメッセージの数
     を返します。

     ‘IMAP4rev1’ 拡張命令です。

 -- メソッド: IMAP4.starttls (ssl_context=None)

     Send a ‘STARTTLS’ command.  The 'ssl_context' argument is optional
     and should be a *note ssl.SSLContext: 357. object.  This will
     enable encryption on the IMAP connection.  Please read *note
     セキュリティで考慮すべき点: 3895. for best practices.

     Added in version 3.2.

     バージョン 3.4 で変更: The method now supports hostname check with
     *note ssl.SSLContext.check_hostname: 39c4. and 'Server Name
     Indication' (see *note ssl.HAS_SNI: 39d6.).

 -- メソッド: IMAP4.status (mailbox, names)

     'mailbox' の指定ステータス名の状態情報を要求します。

 -- メソッド: IMAP4.store (message_set, command, flag_list)

     メールボックス内のメッセージ群のフラグ設定を変更します。 'command'
     は RFC 2060(9) のセクション 6.4.6 で指定されているもので、 "FLAGS",
     "+FLAGS", あるいは "-FLAGS" のいずれかとなります。オプションで末尾
     に ".SILENT" がつくこともあります。

     たとえば、すべてのメッセージに削除フラグを設定するには次のようにし
     ます:

          typ, data = M.search(None, 'ALL')
          for num in data[0].split():
             M.store(num, '+FLAGS', '\\Deleted')
          M.expunge()

          注釈: Creating flags containing ']' (for example: "[test]")
          violates RFC 3501(10) (the IMAP protocol).  However, imaplib
          has historically allowed creation of such tags, and popular
          IMAP servers, such as Gmail, accept and produce such flags.
          There are non-Python programs which also create such tags.
          Although it is an RFC violation and IMAP clients and servers
          are supposed to be strict, imaplib still continues to allow
          such tags to be created for backward compatibility reasons,
          and as of Python 3.6, handles them if they are sent from the
          server, since this improves real-world compatibility.

 -- メソッド: IMAP4.subscribe (mailbox)

     新たなメールボックスを購読 (subscribe) します。

 -- メソッド: IMAP4.thread (threading_algorithm, charset,
          search_criterion[, ...])

     ‘thread’ コマンドは ‘search’ にスレッドの概念を加えた変形版です。返
     されるデータは空白で区切られたスレッドメンバのリストを含んでいます
     。

     各スレッドメンバは0以上のメッセージ番号からなり、空白で区切られてお
     り、親子関係を示しています。

     Thread has two arguments before the 'search_criterion' argument(s);
     a 'threading_algorithm', and the searching 'charset'.  Note that
     unlike ‘search’, the searching 'charset' argument is mandatory.
     There is also a ‘uid thread’ command which corresponds to ‘thread’
     the way that ‘uid search’ corresponds to ‘search’.  The ‘thread’
     command first searches the mailbox for messages that match the
     given searching criteria using the 'charset' argument for the
     interpretation of strings in the searching criteria.  It then
     returns the matching messages threaded according to the specified
     threading algorithm.

     ‘IMAP4rev1’ 拡張命令です。

 -- メソッド: IMAP4.uid (command, arg[, ...])

     command args を、メッセージ番号ではなく UID で指定されたメッセージ
     群に対して実行します。命令内容に応じた応答を返します。少なくとも一
     つの引数を与えなくてはなりません; 何も与えない場合、サーバはエラー
     を返し、例外が送出されます。

 -- メソッド: IMAP4.unsubscribe (mailbox)

     古いメールボックスの購読を解除 (unsubscribe) します。

 -- メソッド: IMAP4.unselect ()

     *note imaplib.IMAP4.unselect(): b03. frees server's resources
     associated with the selected mailbox and returns the server to the
     authenticated state.  This command performs the same actions as
     *note imaplib.IMAP4.close(): b04, except that no messages are
     permanently removed from the currently selected mailbox.

     Added in version 3.9.

 -- メソッド: IMAP4.xatom (name[, ...])

     サーバから ‘CAPABILITY’ 応答で通知された単純な拡張命令を許容
     (allow) します。

以下の属性が *note IMAP4: aff. のインスタンス上で定義されています:

 -- の属性: IMAP4.PROTOCOL_VERSION

     サーバから返された ‘CAPABILITY’ 応答にある、サポートされている最新
     のプロトコルです。

 -- の属性: IMAP4.debug

     デバッグ出力を制御するための整数値です。初期値はモジュール変数
     ‘Debug’ から取られます。3 以上の値にすると各命令をトレースします。

 -- の属性: IMAP4.utf8_enabled

     Boolean value that is normally ‘False’, but is set to ‘True’ if an
     *note enable(): 100e. command is successfully issued for the
     ‘UTF8=ACCEPT’ capability.

     Added in version 3.5.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc5161.html

   (2) https://datatracker.ietf.org/doc/html/rfc6855.html

   (3) https://datatracker.ietf.org/doc/html/rfc6855.html

   (4) https://datatracker.ietf.org/doc/html/rfc2087.html

   (5) https://datatracker.ietf.org/doc/html/rfc2087.html

   (6) https://datatracker.ietf.org/doc/html/rfc2177.html

   (7) https://datatracker.ietf.org/doc/html/rfc2342.html

   (8) https://datatracker.ietf.org/doc/html/rfc2087.html

   (9) https://datatracker.ietf.org/doc/html/rfc2060.html

   (10) https://datatracker.ietf.org/doc/html/rfc3501.html


File: python.info,  Node: IMAP4 の使用例,  Prev: IMAP4 オブジェクト,  Up: imaplib --- IMAP4 プロトコルクライアント

5.22.13.2 IMAP4 の使用例
........................

以下にメールボックスを開き、全てのメッセージを取得して印刷する最小の (エ
ラーチェックをしない) 使用例を示します:

     import getpass, imaplib

     M = imaplib.IMAP4(host='example.org')
     M.login(getpass.getuser(), getpass.getpass())
     M.select()
     typ, data = M.search(None, 'ALL')
     for num in data[0].split():
         typ, data = M.fetch(num, '(RFC822)')
         print('Message %s\n%s\n' % (num, data[0][1]))
     M.close()
     M.logout()


File: python.info,  Node: smtplib --- SMTP プロトコルクライアント,  Next: uuid --- RFC 9562 に基づく UUID オブジェクト,  Prev: imaplib --- IMAP4 プロトコルクライアント,  Up: インターネットプロトコルとサポート

5.22.14 ‘smtplib’ -- SMTP プロトコルクライアント
------------------------------------------------

'ソースコード:' Lib/smtplib.py(1)

__________________________________________________________________

The ‘smtplib’ module defines an SMTP client session object that can be
used to send mail to any internet machine with an SMTP or ESMTP listener
daemon.  For details of SMTP and ESMTP operation, consult RFC 821(2)
(Simple Mail Transfer Protocol) and RFC 1869(3) (SMTP Service
Extensions).

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

 -- クラス: smtplib.SMTP (host='', port=0, local_hostname=None[,
          timeout], source_address=None)

     *note SMTP: b27. インスタンスはSMTP接続をカプセル化します。SMTPと
     ESMTP操作の完全なレパートリーをサポートするメソッドがあります。オプ
     ションパラメータの 'host' および 'port' が指定されている場合、
     SMTPの *note connect(): 1daf. メソッドは初期化中にこれらのパラメー
     タを使って呼び出されます。 'local_hostname' を指定した場合、それは
     HELO/EHLOコマンドのローカルホストのFQDNとして使用されます。指定しな
     い場合、ローカルホスト名は *note socket.getfqdn(): 1aed. を使用して
     検索されます。 *note connect(): 1daf. 呼び出しが成功コード以外を返
     すと、 *note SMTPConnectError: 406f. が送出されます。オプションの
     'timeout' パラメータは、接続試行のようなブロッキング操作のタイムア
     ウトを秒単位で指定します（指定されていない場合、グローバルなデフォ
     ルトのタイムアウト設定が使用されます）。タイムアウトが切れると、
     *note TimeoutError: a36. が送出されます。オプションの
     'source_address' パラメータを使用すると、複数のネットワークインター
     フェースを持つマシンの特定の送信元アドレス、かつ（または）特定の送
     信元TCPポートにバインドできます。接続する前にソケットを送信元アドレ
     スとしてバインドするためにタプル ‘(host, port)’ が必要です。省略さ
     れた場合（あるいは、'host' または 'port' がそれぞれ ‘''’ かつ/また
     は ‘0’ の場合）、OSのデフォルト動作が使用されます。

     普通に使う場合は、初期化と接続を行ってから、 *note sendmail():
     1059. と *note SMTP.quit(): 4070. メソッドを呼びます。使用例は先の
     方で記載しています。

     The *note SMTP: b27. class supports the *note with: 186. statement.
     When used like this, the SMTP ‘QUIT’ command is issued
     automatically when the ‘with’ statement exits.  E.g.:

          >>> from smtplib import SMTP
          >>> with SMTP("domain.org") as smtp:
          ...     smtp.noop()
          ...
          (250, b'Ok')
          >>>

     全てのコマンドは引数 ‘self’ と ‘data’ を指定して *note auditing
     event: 1c6e. ‘smtplib.SMTP.send’ を送出します。ここで ‘data’ はリモ
     ートホストに送信されるバイト数です。

     バージョン 3.3 で変更: *note with: 186. 構文のサポートが追加されま
     した。

     バージョン 3.3 で変更: 'source_address' argument was added.

     Added in version 3.5: SMTPUTF8 拡張 ( RFC 6531(4)) がサポートされま
     した。

     バージョン 3.9 で変更: 'timeout' パラメータが0に設定されている場合
     、非ブロッキングソケットの作成を防ぐために *note ValueError: 2ec. を
     送出します。

 -- クラス: smtplib.SMTP_SSL (host='', port=0, local_hostname=None, *[,
          timeout], context=None, source_address=None)

     An *note SMTP_SSL: b28. instance behaves exactly the same as
     instances of *note SMTP: b27.  *note SMTP_SSL: b28. should be used
     for situations where SSL is required from the beginning of the
     connection and using *note starttls(): 1350. is not appropriate.
     If 'host' is not specified, the local host is used.  If 'port' is
     zero, the standard SMTP-over-SSL port (465) is used.  The optional
     arguments 'local_hostname', 'timeout' and 'source_address' have the
     same meaning as they do in the *note SMTP: b27. class.  'context',
     also optional, can contain a *note SSLContext: 357. and allows
     configuring various aspects of the secure connection.  Please read
     *note セキュリティで考慮すべき点: 3895. for best practices.

     バージョン 3.3 で変更: 'context' が追加されました。

     バージョン 3.3 で変更: The 'source_address' argument was added.

     バージョン 3.4 で変更: このクラスは *note
     ssl.SSLContext.check_hostname: 39c4. と 'Server Name Indication' で
     ホスト名のチェックをサポートしました。(*note ssl.HAS_SNI: 39d6. を
     参照してください)。

     バージョン 3.9 で変更: 'timeout' パラメータが0に設定されている場合
     、非ブロッキングソケットの作成を防ぐために *note ValueError: 2ec. を
     送出します。

     バージョン 3.12 で変更: 非推奨の 'keyfile' と 'certfile' 引数を削除
     しました。

 -- クラス: smtplib.LMTP (host='', port=LMTP_PORT, local_hostname=None,
          source_address=None[, timeout])

     The LMTP protocol, which is very similar to ESMTP, is heavily based
     on the standard SMTP client.  It's common to use Unix sockets for
     LMTP, so our *note connect(): 1daf. method must support that as
     well as a regular host:port server.  The optional arguments
     'local_hostname' and 'source_address' have the same meaning as they
     do in the *note SMTP: b27. class.  To specify a Unix socket, you
     must use an absolute path for 'host', starting with a '/'.

     認証は、通常のSMTP機構を利用してサポートされています。 Unixソケット
     を利用する場合、LMTPは通常認証をサポートしたり要求したりはしません
     。しかし、あなたが必要であれば、利用することができます。

     バージョン 3.9 で変更: オプションの 'timeout' 引数が追加されました
     。

このモジュールの例外には次のものがあります:

 -- 例外: smtplib.SMTPException

     *note OSError: 2c0. の派生クラスで、このモジュールが提供する他の全
     ての例外の基底クラスです。

     バージョン 3.4 で変更: SMTPException が *note OSError: 2c0. の派生
     クラスになりました。

 -- 例外: smtplib.SMTPServerDisconnected

     この例外はサーバが突然接続が切断されるか、*note SMTP: b27. インスタ
     ンスを生成する前に接続しようとした場合に送出されます。

 -- 例外: smtplib.SMTPResponseException

     Base class for all exceptions that include an SMTP error code.
     These exceptions are generated in some instances when the SMTP
     server returns an error code.

      -- の属性: smtp_code

          エラーコード。

      -- の属性: smtp_error

          The error message.

 -- 例外: smtplib.SMTPSenderRefused

     送信者のアドレスが弾かれたときに送出される例外です。全ての *note
     SMTPResponseException: 4072. 例外に、 SMTPサーバが弾いた 'sender' ア
     ドレスの文字列がセットされます。

 -- 例外: smtplib.SMTPRecipientsRefused

     All recipient addresses refused.

      -- の属性: recipients

          A dictionary of exactly the same sort as returned by *note
          SMTP.sendmail(): 1059. containing the errors for each
          recipient.

 -- 例外: smtplib.SMTPDataError

     SMTPサーバが、メッセージのデータを受け入れることを拒絶したときに送
     出される例外です。

 -- 例外: smtplib.SMTPConnectError

     サーバへの接続時にエラーが発生したときに送出される例外です。

 -- 例外: smtplib.SMTPHeloError

     サーバーが ‘HELO’ メッセージを弾いたときに送出される例外です。

 -- 例外: smtplib.SMTPNotSupportedError

     試行したコマンドやオプションはサーバにサポートされていません。

     Added in version 3.5.

 -- 例外: smtplib.SMTPAuthenticationError

     SMTP 認証が失敗しました。最もあり得るのは、サーバーがユーザ名/パス
     ワードのペアを受け付なかった事です。

参考
....

RFC 821(5) - Simple Mail Transfer Protocol

     SMTP のプロトコル定義です。このドキュメントでは SMTP のモデル、操作
     手順、プロトコルの詳細についてカバーしています。

RFC 1869(6) - SMTP Service Extensions

     SMTP に対する ESMTP 拡張の定義です。このドキュメントでは、新たな命
     令による SMTP の拡張、サーバによって提供される命令を動的に発見する
     機能のサポート、およびいくつかの追加命令定義について記述しています
     。

* Menu:

* SMTP オブジェクト::
* SMTP 使用例::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/smtplib.py

   (2) https://datatracker.ietf.org/doc/html/rfc821.html

   (3) https://datatracker.ietf.org/doc/html/rfc1869.html

   (4) https://datatracker.ietf.org/doc/html/rfc6531.html

   (5) https://datatracker.ietf.org/doc/html/rfc821.html

   (6) https://datatracker.ietf.org/doc/html/rfc1869.html


File: python.info,  Node: SMTP オブジェクト,  Next: SMTP 使用例,  Up: smtplib --- SMTP プロトコルクライアント

5.22.14.1 SMTP オブジェクト
...........................

*note SMTP: b27. クラスインスタンスは次のメソッドを提供します:

 -- メソッド: SMTP.set_debuglevel (level)

     デバッグ出力レベルを設定します。'level' が 1 や ‘True’ の場合、接続
     ならびにサーバとの送受信のメッセージがデバッグメッセージとなります
     。'level' が 2 の場合、それらのメッセージにタイムスタンプが付きます
     。

     バージョン 3.5 で変更: デバッグレベル2が追加されました。

 -- メソッド: SMTP.docmd (cmd, args='')

     サーバへコマンド 'cmd' を送信します。オプション引数 'args' はスペー
     ス文字でコマンドに連結します。戻り値は、整数値のレスポンスコードと
     、サーバからの応答の値をタプルで返します (サーバからの応答が数行に
     渡る場合でも一つの大きな文字列で返します)。

     数値応答コードと実際の応答行 (複数の応答は 1 つの長い行に結合されま
     す) からなる 2 値タプルを返します。

     通常、このメソッドを明示的に使う必要はありません。他のメソッドを実
     装するのに使い、自分で拡張したものをテストするのに役立つかもしれま
     せん。

     応答待ちのときにサーバへの接続が切れると *note
     SMTPServerDisconnected: 4071. が送出されます。

 -- メソッド: SMTP.connect (host='localhost', port=0)

     ホスト名とポート番号をもとに接続します。デフォルトはlocalhostの標準
     的なSMTPポート(25番)に接続します。もしホスト名の末尾がコロン
     (‘':'’)で、後に番号がついている場合は、「ホスト名:ポート番号」とし
     て扱われます。このメソッドはコンストラクタにホスト名及びポート番号
     が指定されている場合、自動的に呼び出されます。戻り値は、この接続の
     応答内でサーバによって送信された応答コードとメッセージの2要素タプル
     です。

     引数 ‘self’, ‘host’, ‘port’ を指定して *note 監査イベント: 1c6e.
     ‘smtplib.connect’ を送出します。

 -- メソッド: SMTP.helo (name='')

     SMTPサーバに ‘HELO’ コマンドで身元を示します。デフォルトでは
     hostname引数はローカルホストを指します。サーバーが返したメッセージ
     は、オブジェクトの *note helo_resp: 407f. 属性に格納されます。

     通常は *note sendmail(): 1059. が呼びだすため、これを明示的に呼び出
     す必要はありません。

 -- メソッド: SMTP.ehlo (name='')

     ‘EHLO’ を利用し、ESMTPサーバに身元を明かします。デフォルトでは
     hostname引数はローカルホストのFQDNです。また、ESMTPオプションのため
     に応答を調べたものは、 *note has_extn(): 4081. に備えて保存されます
     。また、幾つかの情報を属性に保存します: サーバーが返したメッセージ
     は *note ehlo_resp: 4082. 属性に、 *note does_esmtp: 4083. 属性はサ
     ーバーがESMTPをサポートしているかどうかによって ‘True’ か ‘False’ に
     、 *note esmtp_features: 4084. 属性は辞書で、サーバーが対応している
     SMTP サービス拡張の名前と、もしあればそのパラメータを格納します。

     メールを送信する前に *note has_extn(): 4081. を使おうとしない限り、
     このメソッドを明示的に呼ぶ必要はないはずです。必要な場合は *note
     sendmail(): 1059. に暗黙的に呼ばれます。

 -- メソッド: SMTP.ehlo_or_helo_if_needed ()

     このメソッドは、現在のセッションでまだ ‘EHLO’ か ‘HELO’ コマンドが
     実行されていない場合、 *note ehlo(): 4080. and/or *note helo():
     407e. メソッドを呼び出します。このメソッドは先に ESMTP ‘EHLO’ を試
     します。

     *note SMTPHeloError: 4079.

          サーバーが ‘HELO’ に正しく返答しませんでした。

 -- メソッド: SMTP.has_extn (name)

     'name' が拡張SMTPサービスセットに含まれている場合には *note True:
     e07. を返し、そうでなければ *note False: d2b. を返します。大小文字
     は区別されません。

 -- メソッド: SMTP.verify (address)

     ‘VRFY’ を利用してSMTPサーバにアドレスの妥当性をチェックします。妥当
     である場合はコード250と完全な RFC 822(1) アドレス (人名を含む) のタ
     プルを返します。それ以外の場合は、400以上のエラーコードとエラー文字
     列を返します。

          注釈: ほとんどのサイトはスパマーの裏をかくためにSMTPの ‘VRFY’
          は使用不可になっています。

 -- メソッド: SMTP.login (user, password, *, initial_response_ok=True)

     認証が必要なSMTPサーバにログインします。認証に使用する引数はユーザ
     名とパスワードです。まだセッションが無い場合は、 ‘EHLO’ または
     ‘HELO’ コマンドでセッションを作ります。ESMTPの場合は ‘EHLO’ が先に
     試されます。認証が成功した場合は通常このメソッドは戻りますが、例外
     が起こった場合は以下の例外が上がります:

     *note SMTPHeloError: 4079.

          サーバーが ‘HELO’ に正しく返答しませんでした。

     *note SMTPAuthenticationError: 407a.

          サーバがユーザ名/パスワードでの認証に失敗しました。

     *note SMTPNotSupportedError: 1dae.

          ‘AUTH’ コマンドはサーバにサポートされていません。

     *note SMTPException: 11a3.

          適当な認証方法が見付かりませんでした。

     Each of the authentication methods supported by ‘smtplib’ are tried
     in turn if they are advertised as supported by the server.  See
     *note auth(): 1057. for a list of supported authentication methods.
     'initial_response_ok' is passed through to *note auth(): 1057.

     オプションのキーワード引数 'initial_response_ok' は、それをサポート
     する認証方法に対して、チャレンジ/レスポンスを要求するのではなく、
     "AUTH"コマンドとともに RFC 4954(2) で指定された"初期応答"を送信でき
     るかどうかを指定します。

     バージョン 3.5 で変更: *note SMTPNotSupportedError: 1dae. が送出さ
     れる場合があります。'initial_response_ok' 引数が追加されました。

 -- メソッド: SMTP.auth (mechanism, authobject, *,
          initial_response_ok=True)

     Issue an ‘SMTP’ ‘AUTH’ command for the specified authentication
     'mechanism', and handle the challenge response via 'authobject'.

     'mechanism' specifies which authentication mechanism is to be used
     as argument to the ‘AUTH’ command; the valid values are those
     listed in the ‘auth’ element of *note esmtp_features: 4084.

     'authobject' must be a callable object taking an optional single
     argument:

          data = authobject(challenge=None)

     If optional keyword argument 'initial_response_ok' is true,
     ‘authobject()’ will be called first with no argument.  It can
     return the RFC 4954(3) "initial response" ASCII ‘str’ which will be
     encoded and sent with the ‘AUTH’ command as below.  If the
     ‘authobject()’ does not support an initial response (e.g.  because
     it requires a challenge), it should return ‘None’ when called with
     ‘challenge=None’.  If 'initial_response_ok' is false, then
     ‘authobject()’ will not be called first with ‘None’.

     If the initial response check returns ‘None’, or if
     'initial_response_ok' is false, ‘authobject()’ will be called to
     process the server's challenge response; the 'challenge' argument
     it is passed will be a ‘bytes’.  It should return ASCII ‘str’
     'data' that will be base64 encoded and sent to the server.

     The ‘SMTP’ class provides ‘authobjects’ for the ‘CRAM-MD5’,
     ‘PLAIN’, and ‘LOGIN’ mechanisms; they are named
     ‘SMTP.auth_cram_md5’, ‘SMTP.auth_plain’, and ‘SMTP.auth_login’
     respectively.  They all require that the ‘user’ and ‘password’
     properties of the ‘SMTP’ instance are set to appropriate values.

     User code does not normally need to call ‘auth’ directly, but can
     instead call the *note login(): 4087. method, which will try each
     of the above mechanisms in turn, in the order listed.  ‘auth’ is
     exposed to facilitate the implementation of authentication methods
     not (or not yet) supported directly by ‘smtplib’.

     Added in version 3.5.

 -- メソッド: SMTP.starttls (*, context=None)

     TLS (Transport Layer Security) モードで SMTP 接続します。続く全ての
     SMTP コマンドは暗号化されます。その後、もう一度 *note ehlo(): 4080.
     を呼んでください。

     If 'keyfile' and 'certfile' are provided, they are used to create
     an *note ssl.SSLContext: 357.

     Optional 'context' parameter is an *note ssl.SSLContext: 357.
     object; This is an alternative to using a keyfile and a certfile
     and if specified both 'keyfile' and 'certfile' should be ‘None’.

     もしまだ ‘EHLO’ か ‘HELO’ コマンドが実行されていない場合、このメソ
     ッドは ESMTP ‘EHLO’ を先に試します。

     バージョン 3.12 で変更: 非推奨の 'keyfile' と 'certfile' 引数を削除
     しました。

     *note SMTPHeloError: 4079.

          サーバーが ‘HELO’ に正しく返答しませんでした。

     *note SMTPNotSupportedError: 1dae.

          サーバーが STARTTLS 拡張に対応していません。

     *note RuntimeError: 244.

          実行中の Python インタプリタで、SSL/TLS サポートが利用できませ
          ん。

     バージョン 3.3 で変更: 'context' が追加されました。

     バージョン 3.4 で変更: The method now supports hostname check with
     *note ssl.SSLContext.check_hostname: 39c4. and 'Server Name
     Indicator' (see *note HAS_SNI: 39d6.).

     バージョン 3.5 で変更: The error raised for lack of STARTTLS
     support is now the *note SMTPNotSupportedError: 1dae. subclass
     instead of the base *note SMTPException: 11a3.

 -- メソッド: SMTP.sendmail (from_addr, to_addrs, msg, mail_options=(),
          rcpt_options=())

     Send mail.  The required arguments are an RFC 822(4) from-address
     string, a list of RFC 822(5) to-address strings (a bare string will
     be treated as a list with 1 address), and a message string.  The
     caller may pass a list of ESMTP options (such as ‘"8bitmime"’) to
     be used in ‘MAIL FROM’ commands as 'mail_options'.  ESMTP options
     (such as ‘DSN’ commands) that should be used with all ‘RCPT’
     commands can be passed as 'rcpt_options'.  Each option should be
     passed as a string containing the full text of the option,
     including any potential key (for instance,
     ‘"NOTIFY=SUCCESS,FAILURE"’).  (If you need to use different ESMTP
     options to different recipients you have to use the low-level
     methods such as ‘mail()’, ‘rcpt()’ and ‘data()’ to send the
     message.)

          注釈: 配送エージェントは 'from_addr'、'to_addrs' 引数を使い、
          メッセージのエンベロープを構成します。‘sendmail’ はメッセージ
          ヘッダを修正しません。

     'msg' may be a string containing characters in the ASCII range, or
     a byte string.  A string is encoded to bytes using the ascii codec,
     and lone ‘\r’ and ‘\n’ characters are converted to ‘\r\n’
     characters.  A byte string is not modified.

     まだセッションが無い場合は、 ‘EHLO’ または ‘HELO’ コマンドでセッシ
     ョンを作ります。ESMTPの場合は ‘EHLO’ が先に試されます。また、サーバ
     がESMTP対応ならば、メッセージサイズとそれぞれ指定されたオプションも
     渡します。(featureオプションがあればサーバの広告をセットします)
     ‘EHLO’ が失敗した場合は、ESMTPオプションの無い ‘HELO’ が試されます
     。

     このメソッドは最低でも1人の受信者にメールが受け取られたときは正常に
     戻ります。そうでない場合は例外を投げます。つまり、このメソッドが例
     外を送出しないときは誰かが送信したメールを受け取ったはずです。また
     、例外を送出しない場合は拒絶された受信者ごとに項目のある辞書を返し
     ます。各項目はサーバーが送ったSMTPエラーコードと付随するエラーメッ
     セージのタプルを持ちます。

     'mail_options' に ‘SMTPUTF8’ があり、サーバがサポートしている場合は
     、'from_addr' と 'to_addrs' に非 ASCII 文字を含めることが出来ます。

     このメソッドは次の例外を送出することがあります:

     *note SMTPRecipientsRefused: 4076.

          All recipients were refused.  Nobody got the mail.

     *note SMTPHeloError: 4079.

          サーバーが ‘HELO’ に正しく返答しませんでした。

     *note SMTPSenderRefused: 4075.

          サーバが 'from_addr' を受理しませんでした。

     *note SMTPDataError: 4078.

          サーバが予期しないエラーコードを返しました (受信拒否以外)。

     *note SMTPNotSupportedError: 1dae.

          'mail_options' に ‘SMTPUTF8’ が与えられましたが、サーバがサポ
          ートしていません。

     また、この他の注意として、例外が上がった後もコネクションは開いたま
     まになっています。

     バージョン 3.2 で変更: 'msg' はバイト文字列でも構いません。

     バージョン 3.5 で変更: ‘SMTPUTF8’ のサポートが追加されました。
     ‘SMTPUTF8’ が与えられたが、サーバがサポートしていない場合は *note
     SMTPNotSupportedError: 1dae. が送出されます。

 -- メソッド: SMTP.send_message (msg, from_addr=None, to_addrs=None,
          mail_options=(), rcpt_options=())

     This is a convenience method for calling *note sendmail(): 1059.
     with the message represented by an *note email.message.Message:
     581. object.  The arguments have the same meaning as for *note
     sendmail(): 1059, except that 'msg' is a ‘Message’ object.

     If 'from_addr' is ‘None’ or 'to_addrs' is ‘None’, ‘send_message’
     fills those arguments with addresses extracted from the headers of
     'msg' as specified in RFC 5322(6): 'from_addr' is set to the
     ‘Sender’ field if it is present, and otherwise to the ‘From’ field.
     'to_addrs' combines the values (if any) of the ‘To’, ‘Cc’, and
     ‘Bcc’ fields from 'msg'.  If exactly one set of ‘Resent-*’ headers
     appear in the message, the regular headers are ignored and the
     ‘Resent-*’ headers are used instead.  If the message contains more
     than one set of ‘Resent-*’ headers, a *note ValueError: 2ec. is
     raised, since there is no way to unambiguously detect the most
     recent set of ‘Resent-’ headers.

     ‘send_message’ serializes 'msg' using *note BytesGenerator: 13e7.
     with ‘\r\n’ as the 'linesep', and calls *note sendmail(): 1059. to
     transmit the resulting message.  Regardless of the values of
     'from_addr' and 'to_addrs', ‘send_message’ does not transmit any
     ‘Bcc’ or ‘Resent-Bcc’ headers that may appear in 'msg'.  If any of
     the addresses in 'from_addr' and 'to_addrs' contain non-ASCII
     characters and the server does not advertise ‘SMTPUTF8’ support, an
     *note SMTPNotSupportedError: 1dae. is raised.  Otherwise the
     ‘Message’ is serialized with a clone of its *note policy: 53. with
     the *note utf8: ff9. attribute set to ‘True’, and ‘SMTPUTF8’ and
     ‘BODY=8BITMIME’ are added to 'mail_options'.

     Added in version 3.2.

     Added in version 3.5: 国際化アドレスのサポート (‘SMTPUTF8’)。

 -- メソッド: SMTP.quit ()

     SMTPセッションを終了し、接続を閉じます。SMTP ‘QUIT’ コマンドの結果
     を返します。

下位レベルのメソッドは標準SMTP/ESMTPコマンド ‘HELP’ 、 ‘RSET’ 、 ‘NOOP’
、 ‘MAIL’ 、 ‘RCPT’ 、 ‘DATA’ に対応しています。通常これらは直接呼ぶ必要
はなく、また、ドキュメントもありません。詳細はモジュールのコードを調べて
ください。

Additionally, an SMTP instance has the following attributes:

 -- の属性: SMTP.helo_resp

     The response to the ‘HELO’ command, see *note helo(): 407e.

 -- の属性: SMTP.ehlo_resp

     The response to the ‘EHLO’ command, see *note ehlo(): 4080.

 -- の属性: SMTP.does_esmtp

     A boolean value indicating whether the server supports ESMTP, see
     *note ehlo(): 4080.

 -- の属性: SMTP.esmtp_features

     A dictionary of the names of SMTP service extensions supported by
     the server, see *note ehlo(): 4080.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc822.html

   (2) https://datatracker.ietf.org/doc/html/rfc4954.html

   (3) https://datatracker.ietf.org/doc/html/rfc4954.html

   (4) https://datatracker.ietf.org/doc/html/rfc822.html

   (5) https://datatracker.ietf.org/doc/html/rfc822.html

   (6) https://datatracker.ietf.org/doc/html/rfc5322.html


File: python.info,  Node: SMTP 使用例,  Prev: SMTP オブジェクト,  Up: smtplib --- SMTP プロトコルクライアント

5.22.14.2 SMTP 使用例
.....................

This example prompts the user for addresses needed in the message
envelope ('To' and 'From' addresses), and the message to be delivered.
Note that the headers to be included with the message must be included
in the message as entered; this example doesn't do any processing of the
RFC 822(1) headers.  In particular, the 'To' and 'From' addresses must
be included in the message headers explicitly:

     import smtplib

     def prompt(title):
         return input(title).strip()

     from_addr = prompt("From: ")
     to_addrs  = prompt("To: ").split()
     print("Enter message, end with ^D (Unix) or ^Z (Windows):")

     # Add the From: and To: headers at the start!
     lines = [f"From: {from_addr}", f"To: {', '.join(to_addrs)}", ""]
     while True:
         try:
             line = input()
         except EOFError:
             break
         else:
             lines.append(line)

     msg = "\r\n".join(lines)
     print("Message length is", len(msg))

     server = smtplib.SMTP("localhost")
     server.set_debuglevel(1)
     server.sendmail(from_addr, to_addrs, msg)
     server.quit()

     注釈: 多くの場合、 *note email: 3f. パッケージの機能を使って email
     メッセージを構築し、それを、 *note send_message(): 105a. で送信する
     、という手順を用います。 *note email; 使用例: 113e. を参照してくだ
     さい。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc822.html


File: python.info,  Node: uuid --- RFC 9562 に基づく UUID オブジェクト,  Next: socketserver --- ネットワークサーバーのフレームワーク,  Prev: smtplib --- SMTP プロトコルクライアント,  Up: インターネットプロトコルとサポート

5.22.15 ‘uuid’ --
-----------------

'RFC 9562' に基づく UUID オブジェクト

'ソースコード:' Lib/uuid.py(1)

__________________________________________________________________

This module provides immutable *note UUID: c56. objects (the *note UUID:
c56. class) and *note functions: 408d. for generating UUIDs
corresponding to a specific UUID version as specified in RFC 9562(2)
(which supersedes RFC 4122(3)), for example, *note uuid1(): da1. for
UUID version 1, *note uuid3(): 2e5. for UUID version 3, and so on.  Note
that UUID version 2 is deliberately omitted as it is outside the scope
of the RFC.

もしユニークな ID が必要なだけであれば、おそらく *note uuid1(): da1. か
*note uuid4(): 2e7. を呼び出せば良いでしょう。 *note uuid1(): da1. はコ
ンピュータのネットワークアドレスを含む UUID を生成するためにプライバシー
を侵害するかもしれない点に注意してください。 *note uuid4(): 2e7. はラン
ダムな UUID を生成します。

Depending on support from the underlying platform, *note uuid1(): da1.
may or may not return a "safe" UUID. A safe UUID is one which is
generated using synchronization methods that ensure no two processes can
obtain the same UUID. All instances of *note UUID: c56. have an *note
is_safe: d9f. attribute which relays any information about the UUID's
safety, using this enumeration:

 -- クラス: uuid.SafeUUID

     Added in version 3.7.

      -- の属性: safe

          UUID は並列処理に対して安全なプラットフォームで生成された

      -- の属性: unsafe

          UUID は並列処理に対して安全なプラットフォームで生成されなかっ
          た

      -- の属性: unknown

          プラットフォームは、UUID が安全に生成されたかどうかの情報を提
          供しなかった

 -- クラス: uuid.UUID (hex=None, bytes=None, bytes_le=None, fields=None,
          int=None, version=None, *, is_safe=SafeUUID.unknown)

     32 桁の 16 進数文字列、'bytes' に 16 バイトのビッグエンディアンの文
     字列、'bytes_le' 引数に 16 バイトのリトルエンディアンの文字列、
     'fields' 引数に 6 つの整数のタプル（32ビット 'time_low', 16 ビット
     'time_mid', 16ビット 'time_hi_version', 8ビット
     'clock_seq_hi_variant', 8ビット 'clock_seq_low', 48ビット 'node' ）
     、または 'int' に一つの 128 ビット整数のいずれかから UUID を生成し
     ます。16 進数が与えられた時、波括弧、ハイフン、それと URN 接頭辞は
     無視されます。例えば、これらの表現は全て同じ UUID を払い出します:

          UUID('{12345678-1234-5678-1234-567812345678}')
          UUID('12345678123456781234567812345678')
          UUID('urn:uuid:12345678-1234-5678-1234-567812345678')
          UUID(bytes=b'\x12\x34\x56\x78'*4)
          UUID(bytes_le=b'\x78\x56\x34\x12\x34\x12\x78\x56' +
                        b'\x12\x34\x56\x78\x12\x34\x56\x78')
          UUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678))
          UUID(int=0x12345678123456781234567812345678)

     Exactly one of 'hex', 'bytes', 'bytes_le', 'fields', or 'int' must
     be given.  The 'version' argument is optional; if given, the
     resulting UUID will have its variant and version number set
     according to RFC 9562(4), overriding bits in the given 'hex',
     'bytes', 'bytes_le', 'fields', or 'int'.

     2つのUUIDオブジェクトの比較は、*note UUID.int: 4092. 属性の比較によ
     って行われます。UUIDではないオブジェクトとの比較は、 *note
     TypeError: 198. を送出します。

     ‘str(uuid)’ は 32桁の16進でUUIDを表す
     ''12345678-1234-5678-1234-567812345678'' 形式の文字列を返します。

*note UUID: c56. インスタンスは以下の読み出し専用属性を持ちます:

 -- の属性: UUID.bytes

     16 バイト文字列（バイトオーダーがビッグエンディアンの 6 つの整数フ
     ィールドを持つ）のUUID。

 -- の属性: UUID.bytes_le

     16 バイト文字列（ 'time_low', 'time_mid', 'time_hi_version' をリト
     ルエンディアンで持つ）の UUID。

 -- の属性: UUID.fields

     UUID の 6 つの整数フィールドを持つタプルで、これは 6 つの個別の属性
     と 2 つの派生した属性としても取得可能です:

フィールド                                             意味
                                                       
                                                       
 -- の属性: UUID.time_low                              The first 32 bits of the UUID. Only relevant to
                                                       version 1.
                                                       
                                                       
 -- の属性: UUID.time_mid                              The next 16 bits of the UUID. Only relevant to
                                                       version 1.
                                                       
                                                       
 -- の属性: UUID.time_hi_version                       The next 16 bits of the UUID. Only relevant to
                                                       version 1.
                                                       
                                                       
 -- の属性: UUID.clock_seq_hi_variant                  The next 8 bits of the UUID. Only relevant to
                                                       versions 1 and 6.
                                                       
                                                       
 -- の属性: UUID.clock_seq_low                         The next 8 bits of the UUID. Only relevant to
                                                       versions 1 and 6.
                                                       
                                                       
 -- の属性: UUID.node                                  The last 48 bits of the UUID. Only relevant to
                                                       version 1.
                                                       
                                                       
 -- の属性: UUID.time                                  The 60-bit timestamp as a count of 100-nanosecond
                                                       intervals since Gregorian epoch (1582-10-15
                                                       00:00:00) for versions 1 and 6, or the 48-bit
                                                       timestamp in milliseconds since Unix epoch
                                                       (1970-01-01 00:00:00) for version 7.
                                                       
                                                       
 -- の属性: UUID.clock_seq                             The 14-bit sequence number.  Only relevant to
                                                       versions 1 and 6.
                                                       

 -- の属性: UUID.hex

     32 文字の小文字 16 進数文字列での UUID。

 -- の属性: UUID.int

     128 ビット整数での UUID。

 -- の属性: UUID.urn

     The UUID as a URN as specified in RFC 9562(5).

 -- の属性: UUID.variant

     UUID の内部レイアウトを決定する UUID の variant。これは定数 *note
     RESERVED_NCS: 40a0, *note RFC_4122: 40a1, *note RESERVED_MICROSOFT:
     40a2, *note RESERVED_FUTURE: 40a3. のいずれかです。

 -- の属性: UUID.version

     The UUID version number (1 through 8, meaningful only when the
     variant is *note RFC_4122: 40a1.).

     バージョン 3.14 で変更: Added UUID versions 6, 7 and 8.

 -- の属性: UUID.is_safe

     *note SafeUUID: 408e. の列挙で、UUID は並列処理に対して安全なプラッ
     トフォームで生成されたかを示す。

     Added in version 3.7.

The ‘uuid’ module defines the following functions:

 -- の関数: uuid.getnode ()

     48 ビットの正の整数としてハードウェアアドレスを取得します。最初にこ
     れを起動すると、別個のプログラムが立ち上がって非常に遅くなることが
     あります。もしハードウェアを取得する試みが全て失敗すると、ランダム
     な 48 ビットを、 RFC 4122(6) で推奨されているように、マルチキャスト
     ビット (最初のオクテットの最下位ビット) を 1 に設定して使います。
     "ハードウェアアドレス" とはネットワークインターフェースの MAC アド
     レスを指します。複数のネットワークインターフェースを持つマシンの場
     合、全域管理されたMACアドレス (最初のオクテットの下位より2番目のビ
     ットが '設定されていない' MACアドレス) が、他の個別管理アドレスより
     も優先的に使用されます。この優先順序は保証されません。

     バージョン 3.7 で変更: 全域管理されたMACアドレスは、グローバルに固
     有であると保証されるため、固有である保証のない個別管理アドレスより
     も好ましいです。

 -- の関数: uuid.uuid1 (node=None, clock_seq=None)

     Generate a UUID from a host ID, sequence number, and the current
     time according to RFC 9562, §5.1(7).

     When 'node' is not specified, *note getnode(): da0. is used to
     obtain the hardware address as a 48-bit positive integer.  When a
     sequence number 'clock_seq' is not specified, a pseudo-random
     14-bit positive integer is generated.

     If 'node' or 'clock_seq' exceed their expected bit count, only
     their least significant bits are kept.

 -- の関数: uuid.uuid3 (namespace, name)

     Generate a UUID based on the MD5 hash of a namespace identifier
     (which is a UUID) and a name (which is a *note bytes: 192. object
     or a string that will be encoded using UTF-8) according to RFC
     9562, §5.3(8).

 -- の関数: uuid.uuid4 ()

     Generate a random UUID in a cryptographically-secure method
     according to RFC 9562, §5.4(9).

 -- の関数: uuid.uuid5 (namespace, name)

     Generate a UUID based on the SHA-1 hash of a namespace identifier
     (which is a UUID) and a name (which is a *note bytes: 192. object
     or a string that will be encoded using UTF-8) according to RFC
     9562, §5.5(10).

 -- の関数: uuid.uuid6 (node=None, clock_seq=None)

     Generate a UUID from a sequence number and the current time
     according to RFC 9562, §5.6(11).

     This is an alternative to *note uuid1(): da1. to improve database
     locality.

     When 'node' is not specified, *note getnode(): da0. is used to
     obtain the hardware address as a 48-bit positive integer.  When a
     sequence number 'clock_seq' is not specified, a pseudo-random
     14-bit positive integer is generated.

     If 'node' or 'clock_seq' exceed their expected bit count, only
     their least significant bits are kept.

     Added in version 3.14.

 -- の関数: uuid.uuid7 ()

     Generate a time-based UUID according to RFC 9562, §5.7(12).

     For portability across platforms lacking sub-millisecond precision,
     UUIDs produced by this function embed a 48-bit timestamp and use a
     42-bit counter to guarantee monotonicity within a millisecond.

     Added in version 3.14.

 -- の関数: uuid.uuid8 (a=None, b=None, c=None)

     Generate a pseudo-random UUID according to RFC 9562, §5.8(13).

     When specified, the parameters 'a', 'b' and 'c' are expected to be
     positive integers of 48, 12 and 62 bits respectively.  If they
     exceed their expected bit count, only their least significant bits
     are kept; non-specified arguments are substituted for a
     pseudo-random integer of appropriate size.

     By default, 'a', 'b' and 'c' are not generated by a
     cryptographically secure pseudo-random number generator (CSPRNG).
     Use *note uuid4(): 2e7. when a UUID needs to be used in a
     security-sensitive context.

     Added in version 3.14.

The ‘uuid’ module defines the following namespace identifiers for use
with *note uuid3(): 2e5. or *note uuid5(): 2e6.

 -- データ: uuid.NAMESPACE_DNS

     この名前空間が指定された場合、'name' 文字列は完全修飾ドメイン名です
     。

 -- データ: uuid.NAMESPACE_URL

     この名前空間が指定された場合、'name' 文字列は URL です。

 -- データ: uuid.NAMESPACE_OID

     この名前空間が指定された場合、'name' 文字列は ISO OID です。

 -- データ: uuid.NAMESPACE_X500

     この名前空間が指定された場合、'name' 文字列は X.500 DN の DER また
     はテキスト出力形式です。

The ‘uuid’ module defines the following constants for the possible
values of the *note variant: 409f. attribute:

 -- データ: uuid.RESERVED_NCS

     NCS 互換性のために予約されています。

 -- データ: uuid.RFC_4122

     Specifies the UUID layout given in RFC 4122(14).  This constant is
     kept for backward compatibility even though RFC 4122(15) has been
     superseded by RFC 9562(16).

 -- データ: uuid.RESERVED_MICROSOFT

     Microsoft の互換性のために予約されています。

 -- データ: uuid.RESERVED_FUTURE

     将来のために予約されています。

The ‘uuid’ module defines the special Nil and Max UUID values:

 -- データ: uuid.NIL

     A special form of UUID that is specified to have all 128 bits set
     to zero according to RFC 9562, §5.9(17).

     Added in version 3.14.

 -- データ: uuid.MAX

     A special form of UUID that is specified to have all 128 bits set
     to one according to RFC 9562, §5.10(18).

     Added in version 3.14.

参考
....

RFC 9562(19) - A Universally Unique IDentifier (UUID) URN Namespace

     この仕様は UUID のための Uniform Resource Name 名前空間、UUID の内
     部フォーマットと UUID の生成方法を定義しています。

* Menu:

* コマンドラインからの使用::
* 使用例: 使用例<39>.
* Command-Line Example::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/uuid.py

   (2) https://datatracker.ietf.org/doc/html/rfc9562.html

   (3) https://datatracker.ietf.org/doc/html/rfc4122.html

   (4) https://datatracker.ietf.org/doc/html/rfc9562.html

   (5) https://datatracker.ietf.org/doc/html/rfc9562.html

   (6) https://datatracker.ietf.org/doc/html/rfc4122.html

   (7) https://datatracker.ietf.org/doc/html/rfc9562.html#section-5.1

   (8) https://datatracker.ietf.org/doc/html/rfc9562.html#section-5.3

   (9) https://datatracker.ietf.org/doc/html/rfc9562.html#section-5.4

   (10) https://datatracker.ietf.org/doc/html/rfc9562.html#section-5.5

   (11) https://datatracker.ietf.org/doc/html/rfc9562.html#section-5.6

   (12) https://datatracker.ietf.org/doc/html/rfc9562.html#section-5.7

   (13) https://datatracker.ietf.org/doc/html/rfc9562.html#section-5.8

   (14) https://datatracker.ietf.org/doc/html/rfc4122.html

   (15) https://datatracker.ietf.org/doc/html/rfc4122.html

   (16) https://datatracker.ietf.org/doc/html/rfc9562.html

   (17) https://datatracker.ietf.org/doc/html/rfc9562.html#section-5.9

   (18) https://datatracker.ietf.org/doc/html/rfc9562.html#section-5.10

   (19) https://datatracker.ietf.org/doc/html/rfc9562.html


File: python.info,  Node: コマンドラインからの使用,  Next: 使用例<39>,  Up: uuid --- RFC 9562 に基づく UUID オブジェクト

5.22.15.1 コマンドラインからの使用
..................................

Added in version 3.12.

The ‘uuid’ module can be executed as a script from the command line.

     python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5,uuid6,uuid7,uuid8}] [-n NAMESPACE] [-N NAME]

以下のオプションが使用できます:

 -- Option: -h, --help

     ヘルプメッセージを表示して終了します。

 -- Option: -u <uuid>
 -- Option: --uuid <uuid>

     Specify the function name to use to generate the uuid.  By default
     *note uuid4(): 2e7. is used.

     バージョン 3.14 で変更: Allow generating UUID versions 6, 7 and 8.

 -- Option: -n <namespace>
 -- Option: --namespace <namespace>

     The namespace is a ‘UUID’, or ‘@ns’ where ‘ns’ is a well-known
     predefined UUID addressed by namespace name.  Such as ‘@dns’,
     ‘@url’, ‘@oid’, and ‘@x500’.  Only required for *note uuid3(): 2e5.
     / *note uuid5(): 2e6. functions.

 -- Option: -N <name>
 -- Option: --name <name>

     The name used as part of generating the uuid.  Only required for
     *note uuid3(): 2e5. / *note uuid5(): 2e6. functions.

 -- Option: -C <num>
 -- Option: --count <num>

     Generate 'num' fresh UUIDs.

     Added in version 3.14.


File: python.info,  Node: 使用例<39>,  Next: Command-Line Example,  Prev: コマンドラインからの使用,  Up: uuid --- RFC 9562 に基づく UUID オブジェクト

5.22.15.2 使用例
................

Here are some examples of typical usage of the ‘uuid’ module:

     >>> import uuid

     >>> # make a UUID based on the host ID and current time
     >>> uuid.uuid1()
     UUID('a8098c1a-f86e-11da-bd1a-00112444be1e')

     >>> # make a UUID using an MD5 hash of a namespace UUID and a name
     >>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')
     UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')

     >>> # make a random UUID
     >>> uuid.uuid4()
     UUID('16fd2706-8baf-433b-82eb-8c7fada847da')

     >>> # make a UUID using a SHA-1 hash of a namespace UUID and a name
     >>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')
     UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')

     >>> # make a UUID from a string of hex digits (braces and hyphens ignored)
     >>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')

     >>> # convert a UUID to a string of hex digits in standard form
     >>> str(x)
     '00010203-0405-0607-0809-0a0b0c0d0e0f'

     >>> # get the raw 16 bytes of the UUID
     >>> x.bytes
     b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f'

     >>> # make a UUID from a 16-byte string
     >>> uuid.UUID(bytes=x.bytes)
     UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')

     >>> # get the Nil UUID
     >>> uuid.NIL
     UUID('00000000-0000-0000-0000-000000000000')

     >>> # get the Max UUID
     >>> uuid.MAX
     UUID('ffffffff-ffff-ffff-ffff-ffffffffffff')

     >>> # same as UUIDv1 but with fields reordered to improve DB locality
     >>> uuid.uuid6()
     UUID('1f0799c0-98b9-62db-92c6-a0d365b91053')

     >>> # get UUIDv7 creation (local) time as a timestamp in milliseconds
     >>> u = uuid.uuid7()
     >>> u.time
     1743936859822

     >>> # get UUIDv7 creation (local) time as a datetime object
     >>> import datetime as dt
     >>> dt.datetime.fromtimestamp(u.time / 1000)
     datetime.datetime(...)

     >>> # make a UUID with custom blocks
     >>> uuid.uuid8(0x12345678, 0x9abcdef0, 0x11223344)
     UUID('00001234-5678-8ef0-8000-000011223344')


File: python.info,  Node: Command-Line Example,  Prev: 使用例<39>,  Up: uuid --- RFC 9562 に基づく UUID オブジェクト

5.22.15.3 Command-Line Example
..............................

Here are some examples of typical usage of the ‘uuid’ command-line
interface:

     # generate a random UUID - by default uuid4() is used
     $ python -m uuid

     # generate a UUID using uuid1()
     $ python -m uuid -u uuid1

     # generate a UUID using uuid5
     $ python -m uuid -u uuid5 -n @url -N example.com

     # generate 42 random UUIDs
     $ python -m uuid -C 42


File: python.info,  Node: socketserver --- ネットワークサーバーのフレームワーク,  Next: http server --- HTTP サーバー,  Prev: uuid --- RFC 9562 に基づく UUID オブジェクト,  Up: インターネットプロトコルとサポート

5.22.16 ‘socketserver’ -- ネットワークサーバーのフレームワーク
--------------------------------------------------------------

'ソースコード:' Lib/socketserver.py(1)

__________________________________________________________________

The ‘socketserver’ module simplifies the task of writing network
servers.

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

基本的な具象サーバクラスが4つあります:

 -- クラス: socketserver.TCPServer (server_address, RequestHandlerClass,
          bind_and_activate=True)

     This uses the internet TCP protocol, which provides for continuous
     streams of data between the client and server.  If
     'bind_and_activate' is true, the constructor automatically attempts
     to invoke *note server_bind(): 40ba. and *note server_activate():
     40bb.  The other parameters are passed to the *note BaseServer:
     1355. base class.

 -- クラス: socketserver.UDPServer (server_address, RequestHandlerClass,
          bind_and_activate=True)

     This uses datagrams, which are discrete packets of information that
     may arrive out of order or be lost while in transit.  The
     parameters are the same as for *note TCPServer: 1537.

 -- クラス: socketserver.UnixStreamServer (server_address,
          RequestHandlerClass, bind_and_activate=True)
 -- クラス: socketserver.UnixDatagramServer (server_address,
          RequestHandlerClass, bind_and_activate=True)

     These more infrequently used classes are similar to the TCP and UDP
     classes, but use Unix domain sockets; they're not available on
     non-Unix platforms.  The parameters are the same as for *note
     TCPServer: 1537.

これらの 4 つのクラスは要求を '同期的に (synchronously)' 処理します; 各
要求は次の要求を開始する前に完結していなければなりません。同期的な処理は
、サーバで大量の計算を必要とする、あるいはクライアントが処理するには時間
がかかりすぎるような大量のデータを返す、といった理由によってリクエストに
長い時間がかかる状況には向いていません。こうした状況の解決方法は別のプロ
セスを生成するか、個々の要求を扱うスレッドを生成することです; *note
ForkingMixIn: d71. および *note ThreadingMixIn: d3a. 配合クラス (mix-in
classes) を使えば、非同期的な動作をサポートできます。

サーバの作成にはいくつかのステップが必要です。最初に、 *note
BaseRequestHandler: 40bf. クラスをサブクラス化して要求処理クラス
(request hander class) を生成し、その *note handle(): 40c0. メソッドをオ
ーバーライドしなければなりません; このメソッドは入力される要求を処理しま
す。次に、サーバクラスのうち一つを、サーバのアドレスと要求処理クラスを渡
してインスタンス化しなければなりません。サーバを *note with: 186. 文中で
使うことが推奨されます。そして、*note handle_request(): 153a. または
*note serve_forever(): 1357. メソッドを呼び出して、一つのまたは多数の要
求を処理します。最後に、(‘with’ 文を使っていなかったなら) *note
server_close(): d6f. を呼び出してソケットを閉じます。

*note ThreadingMixIn: d3a. から継承してスレッドを利用した接続を行う場合
、突発的な通信切断時の処理を明示的に指定する必要があります。 *note
ThreadingMixIn: d3a. クラスには 'daemon_threads' 属性があり、サーバがス
レッドの終了を待ち合わせるかどうかを指定する事ができます。スレッドが独自
の処理を行う場合は、このフラグを明示的に指定します。デフォルトは *note
False: d2b. で、Pythonは *note ThreadingMixIn: d3a. クラスが起動した全て
のスレッドが終了するまで実行し続けます。

サーバクラス群は使用するネットワークプロトコルに関わらず、同じ外部メソッ
ドおよび属性を持ちます。

* Menu:

* サーバ生成に関するノート::
* Serverオブジェクト: Serverオブジェクト<2>.
* Request Handler Objects::
* 使用例: 使用例<40>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/socketserver.py


File: python.info,  Node: サーバ生成に関するノート,  Next: Serverオブジェクト<2>,  Up: socketserver --- ネットワークサーバーのフレームワーク

5.22.16.1 サーバ生成に関するノート
..................................

継承図にある五つのクラスのうち四つは四種類の同期サーバを表わしています:

     +------------+
     | BaseServer |
     +------------+
           |
           v
     +-----------+        +------------------+
     | TCPServer |------->| UnixStreamServer |
     +-----------+        +------------------+
           |
           v
     +-----------+        +--------------------+
     | UDPServer |------->| UnixDatagramServer |
     +-----------+        +--------------------+

*note UnixDatagramServer: 40be. は *note UDPServer: 40bc. から派生してい
て、 *note UnixStreamServer: 40bd. からではないことに注意してください --
IP と Unix サーバの唯一の違いはアドレスファミリーです。

 -- クラス: socketserver.ForkingMixIn
 -- クラス: socketserver.ThreadingMixIn

     それぞれのタイプのサーバのフォークしたりスレッド実行したりするバー
     ジョンはそれらのミクシン(mix-in)クラスを使って作ることができます。
     たとえば、*note ThreadingUDPServer: 40c2. は以下のようにして作られ
     ます:

          class ThreadingUDPServer(ThreadingMixIn, UDPServer):
              pass

     ミクシンクラスは *note UDPServer: 40bc. で定義されるメソッドをオー
     バライドするために、最初に来ます。様々な属性を設定することで元にな
     るサーバ機構の振る舞いを変えられます。

     *note ForkingMixIn: d71. and the Forking classes mentioned below
     are only available on POSIX platforms that support *note fork():
     4b5.

      -- の属性: block_on_close

          *note ForkingMixIn.server_close: d6f. waits until all child
          processes complete, except if *note block_on_close: d70.
          attribute is ‘False’.

          *note ThreadingMixIn.server_close: d6f. waits until all
          non-daemon threads complete, except if *note block_on_close:
          d70. attribute is ‘False’.

      -- の属性: max_children

          Specify how many child processes will exist to handle requests
          at a time for *note ForkingMixIn: d71.  If the limit is
          reached, new requests will wait until one child process has
          finished.

      -- の属性: daemon_threads

          For *note ThreadingMixIn: d3a. use daemonic threads by setting
          *note ThreadingMixIn.daemon_threads: 40c4. to ‘True’ to not
          wait until threads complete.

     バージョン 3.7 で変更: *note ForkingMixIn.server_close: d6f. and
     *note ThreadingMixIn.server_close: d6f. now waits until all child
     processes and non-daemonic threads complete.  Add a new *note
     ForkingMixIn.block_on_close: d70. class attribute to opt-in for the
     pre-3.7 behaviour.

 -- クラス: socketserver.ForkingTCPServer
 -- クラス: socketserver.ForkingUDPServer
 -- クラス: socketserver.ThreadingTCPServer
 -- クラス: socketserver.ThreadingUDPServer
 -- クラス: socketserver.ForkingUnixStreamServer
 -- クラス: socketserver.ForkingUnixDatagramServer
 -- クラス: socketserver.ThreadingUnixStreamServer
 -- クラス: socketserver.ThreadingUnixDatagramServer

     These classes are pre-defined using the mix-in classes.

Added in version 3.12: The ‘ForkingUnixStreamServer’ and
‘ForkingUnixDatagramServer’ classes were added.

サービスの実装には、 *note BaseRequestHandler: 40bf. からクラスを派生さ
せてその *note handle(): 40c0. メソッドを再定義しなければなりません。こ
のようにすれば、サーバクラスと要求処理クラスを結合して様々なバージョンの
サービスを実行することができます。要求処理クラスはデータグラムサービスか
ストリームサービスかで異なることでしょう。この違いは処理サブクラス *note
StreamRequestHandler: ed6. または *note DatagramRequestHandler: 40cc. を
使うという形で隠蔽できます。

もちろん、まだ頭を使わなければなりません!  たとえば、サービスがリクエス
トによっては書き換えられるようなメモリ上の状態を使うならば、フォークする
サーバを使うのは馬鹿げています。というのも子プロセスでの書き換えは親プロ
セスで保存されている初期状態にも親プロセスから分配される各子プロセスの状
態にも届かないからです。この場合、スレッド実行するサーバを使うことはでき
ますが、共有データの一貫性を保つためにロックを使わなければならなくなるで
しょう。

一方、全てのデータが外部に(たとえばファイルシステムに)保存される HTTP サ
ーバを作っているのだとすると、同期クラスではどうしても一つの要求が処理さ
れている間サービスが「耳の聞こえない」状態を呈することになります -- この
状態はもしクライアントが要求した全てのデータをゆっくり受け取るととても長
い時間続きかねません。こういう場合にはサーバをスレッド実行したりフォーク
することが適切です。

ある場合には、要求の一部を同期的に処理する一方で、要求データに依って子プ
ロセスをフォークして処理を終了させる、といった方法も適当かもしれません。
こうした処理方法は同期サーバを使って要求処理クラスの *note handle():
40c0. メソッドの中で自分でフォークするようにして実装することができます。

Another approach to handling multiple simultaneous requests in an
environment that supports neither threads nor *note fork(): 4b5. (or
where these are too expensive or inappropriate for the service) is to
maintain an explicit table of partially finished requests and to use
*note selectors: c7. to decide which request to work on next (or whether
to handle a new incoming request).  This is particularly important for
stream services where each client can potentially be connected for a
long time (if threads or subprocesses cannot be used).


File: python.info,  Node: Serverオブジェクト<2>,  Next: Request Handler Objects,  Prev: サーバ生成に関するノート,  Up: socketserver --- ネットワークサーバーのフレームワーク

5.22.16.2 Serverオブジェクト
............................

 -- クラス: socketserver.BaseServer (server_address,
          RequestHandlerClass)

     This is the superclass of all Server objects in the module.  It
     defines the interface, given below, but does not implement most of
     the methods, which is done in subclasses.  The two parameters are
     stored in the respective *note server_address: 40ce. and *note
     RequestHandlerClass: 40cf. attributes.

      -- メソッド: fileno ()

          サーバが要求待ちを行っているソケットのファイル記述子を整数で返
          します。この関数は一般的に、同じプロセス中の複数のサーバを監視
          できるようにするために、 *note selectors: c7. に渡されます。

      -- メソッド: handle_request ()

          単一の要求を処理します。この関数は以下のメソッド: *note
          get_request(): 40d1. 、 *note verify_request(): 40d2. 、および
          *note process_request(): 40d3. を順番に呼び出します。ハンドラ
          中でユーザによって提供された *note handle(): 40c0. が例外を送
          出した場合、サーバの *note handle_error(): f3d. メソッドが呼び
          出されます。 *note timeout: 1538. 秒以内にリクエストが来なかっ
          た場合、 *note handle_timeout(): 1539. が呼ばれて、 *note
          handle_request(): 153a. が終了します。

      -- メソッド: serve_forever (poll_interval=0.5)

          Handle requests until an explicit *note shutdown(): 1e16.
          request.  Poll for shutdown every 'poll_interval' seconds.
          Ignores the *note timeout: 1538. attribute.  It also calls
          *note service_actions(): 1356, which may be used by a subclass
          or mixin to provide actions specific to a given service.  For
          example, the *note ForkingMixIn: d71. class uses *note
          service_actions(): 1356. to clean up zombie child processes.

          バージョン 3.3 で変更: Added ‘service_actions’ call to the
          ‘serve_forever’ method.

      -- メソッド: service_actions ()

          This is called in the *note serve_forever(): 1357. loop.  This
          method can be overridden by subclasses or mixin classes to
          perform actions specific to a given service, such as cleanup
          actions.

          Added in version 3.3.

      -- メソッド: shutdown ()

          Tell the *note serve_forever(): 1357. loop to stop and wait
          until it does.  *note shutdown(): 1e16. must be called while
          *note serve_forever(): 1357. is running in a different thread
          otherwise it will deadlock.

      -- メソッド: server_close ()

          サーバをクリーンアップします。上書き出来ます。

      -- の属性: address_family

          The family of protocols to which the server's socket belongs.
          Common examples are *note socket.AF_INET: 1bad, *note
          socket.AF_INET6: 1bae, and *note socket.AF_UNIX: 1bb0.
          Subclass the TCP or UDP server classes in this module with
          class attribute ‘address_family = AF_INET6’ set if you want
          IPv6 server classes.

      -- の属性: RequestHandlerClass

          ユーザが提供する要求処理クラスです; 要求ごとにこのクラスのイン
          スタンスが生成されます。

      -- の属性: server_address

          サーバが要求待ちを行うアドレスです。アドレスの形式はプロトコル
          ファミリによって異なります。詳細は *note socket: d1. モジュー
          ルを参照してください。インターネットプロトコルでは、この値は例
          えば ‘('127.0.0.1', 80)’ のようにアドレスを与える文字列と整数
          のポート番号を含むタプルです。

      -- の属性: socket

          サーバが入力の要求待ちを行うためのソケットオブジェクトです。

     サーバクラスは以下のクラス変数をサポートします:

      -- の属性: allow_reuse_address

          サーバがアドレスの再使用を許すかどうかを示す値です。この値は標
          準で *note False: d2b. で、サブクラスで再使用ポリシを変更する
          ために設定することができます。

      -- の属性: request_queue_size

          要求待ち行列 (queue) のサイズです。単一の要求を処理するのに長
          時間かかる場合には、サーバが処理中に届いた要求は最大 *note
          request_queue_size: 40d7. 個まで待ち行列に置かれます。待ち行列
          が一杯になると、それ以降のクライアントからの要求は "接続拒否
          (Connection denied)" エラーになります。標準の値は通常 5 ですが
          、この値はサブクラスで上書きすることができます。

      -- の属性: socket_type

          サーバが使うソケットの型です; 一般的な2つの値は、 *note
          socket.SOCK_STREAM: 150b. と *note socket.SOCK_DGRAM: 150a. で
          す。

      -- の属性: timeout

          タイムアウト時間(秒)、もしくは、タイムアウトを望まない場合に
          *note None: 885. 。 *note handle_request(): 153a. がこの時間内
          にリクエストを受信しない場合、 *note handle_timeout(): 1539. メ
          ソッドが呼ばれます。

     *note TCPServer: 1537. のような基底クラスのサブクラスで上書きできる
     サーバメソッドは多数あります; これらのメソッドはサーバオブジェクト
     の外部のユーザにとっては役にたたないものです。

      -- メソッド: finish_request (request, client_address)

          *note RequestHandlerClass: 40cf. をインスタンス化し、 *note
          handle(): 40c0. メソッドを呼び出して、実際に要求を処理します。

      -- メソッド: get_request ()

          ソケットから要求を受理して、クライアントとの通信に使われる '新
          しい' ソケットオブジェクト、およびクライアントのアドレスからな
          る、2 要素のタプルを返します。

      -- メソッド: handle_error (request, client_address)

          この関数は *note RequestHandlerClass: 40cf. インスタンスの
          *note handle(): 40c0. メソッドが例外を送出した際に呼び出されま
          す。標準の動作では標準エラー出力へトレースバックを出力し、後続
          する要求を継続して処理します。

          バージョン 3.6 で変更: Now only called for exceptions derived
          from the *note Exception: bcd. class.

      -- メソッド: handle_timeout ()

          この関数は *note timeout: 1538. 属性が *note None: 885. 以外に
          設定されて、リクエストがないままタイムアウト秒数が過ぎたときに
          呼ばれます。 fork型サーバーでのデフォルトの動作は、終了した子
          プロセスの情報を集めるようになっています。スレッド型サーバーで
          はこのメソッドは何もしません。

      -- メソッド: process_request (request, client_address)

          *note finish_request(): 40d9. を呼び出して、 *note
          RequestHandlerClass: 40cf. のインスタンスを生成します。必要な
          ら、この関数から新たなプロセスかスレッドを生成して要求を処理す
          ることができます; その処理は *note ForkingMixIn: d71. または
          *note ThreadingMixIn: d3a. クラスが行います。

      -- メソッド: server_activate ()

          Called by the server's constructor to activate the server.
          The default behavior for a TCP server just invokes *note
          listen(): 105e. on the server's socket.  May be overridden.

      -- メソッド: server_bind ()

          サーバのコンストラクタによって呼び出され、適切なアドレスにソケ
          ットをバインドします。このメソッドは上書きできます。

      -- メソッド: verify_request (request, client_address)

          ブール値を返さなければなりません; 値が *note True: e07. の場合
          には要求が処理され、 *note False: d2b. の場合には要求は拒否さ
          れます。サーバへのアクセス制御を実装するためにこの関数を上書き
          することができます。標準の実装では常に *note True: e07. を返し
          ます。

     バージョン 3.6 で変更: *note context manager: 1e1. プロトコルのサポ
     ートが追加されました。コンテキストマネージャを終了することは、
     *note server_close(): d6f. を呼ぶことと同一です。


File: python.info,  Node: Request Handler Objects,  Next: 使用例<40>,  Prev: Serverオブジェクト<2>,  Up: socketserver --- ネットワークサーバーのフレームワーク

5.22.16.3 Request Handler Objects
.................................

 -- クラス: socketserver.BaseRequestHandler

     This is the superclass of all request handler objects.  It defines
     the interface, given below.  A concrete request handler subclass
     must define a new *note handle(): 40c0. method, and can override
     any of the other methods.  A new instance of the subclass is
     created for each request.

      -- メソッド: setup ()

          *note handle(): 40c0. メソッドより前に呼び出され、何らかの必要
          な初期化処理を行います。標準の実装では何も行いません。

      -- メソッド: handle ()

          This function must do all the work required to service a
          request.  The default implementation does nothing.  Several
          instance attributes are available to it; the request is
          available as *note request: 40dc.; the client address as *note
          client_address: 40dd.; and the server instance as *note
          server: 40de, in case it needs access to per-server
          information.

          The type of *note request: 40dc. is different for datagram or
          stream services.  For stream services, *note request: 40dc. is
          a socket object; for datagram services, *note request: 40dc.
          is a pair of string and socket.

      -- メソッド: finish ()

          *note handle(): 40c0. メソッドより後に呼び出され、何らかの必要
          なクリーンアップ処理を行います。標準の実装では何も行いません。
          *note setup(): 40db. メソッドが例外を送出した場合、このメソッ
          ドは呼び出されません。

      -- の属性: request

          The 'new' *note socket.socket: fa1. object to be used to
          communicate with the client.

      -- の属性: client_address

          Client address returned by *note BaseServer.get_request():
          40d1.

      -- の属性: server

          *note BaseServer: 1355. object used for handling the request.

 -- クラス: socketserver.StreamRequestHandler
 -- クラス: socketserver.DatagramRequestHandler

     These *note BaseRequestHandler: 40bf. subclasses override the *note
     setup(): 40db. and *note finish(): 40df. methods, and provide *note
     rfile: 40e0. and *note wfile: ed5. attributes.

      -- の属性: rfile

          A file object from which receives the request is read.
          Support the *note io.BufferedIOBase: 8a3. readable interface.

      -- の属性: wfile

          A file object to which the reply is written.  Support the
          *note io.BufferedIOBase: 8a3. writable interface

     バージョン 3.6 で変更: *note wfile: ed5. also supports the *note
     io.BufferedIOBase: 8a3. writable interface.


File: python.info,  Node: 使用例<40>,  Prev: Request Handler Objects,  Up: socketserver --- ネットワークサーバーのフレームワーク

5.22.16.4 使用例
................

* Menu:

* socketserver.TCPServer の例: socketserver TCPServer の例.
* socketserver.UDPServer の例: socketserver UDPServer の例.
* 非同期処理の Mix-in::


File: python.info,  Node: socketserver TCPServer の例,  Next: socketserver UDPServer の例,  Up: 使用例<40>

5.22.16.5 ‘socketserver.TCPServer’ の例
.......................................

サーバサイドの例です:

     import socketserver

     class MyTCPHandler(socketserver.BaseRequestHandler):
         """
         The request handler class for our server.

         It is instantiated once per connection to the server, and must
         override the handle() method to implement communication to the
         client.
         """

         def handle(self):
             # self.request is the TCP socket connected to the client
             pieces = [b'']
             total = 0
             while b'\n' not in pieces[-1] and total < 10_000:
                 pieces.append(self.request.recv(2000))
                 total += len(pieces[-1])
             self.data = b''.join(pieces)
             print(f"Received from {self.client_address[0]}:")
             print(self.data.decode("utf-8"))
             # just send back the same data, but upper-cased
             self.request.sendall(self.data.upper())
             # after we return, the socket will be closed.

     if __name__ == "__main__":
         HOST, PORT = "localhost", 9999

         # Create the server, binding to localhost on port 9999
         with socketserver.TCPServer((HOST, PORT), MyTCPHandler) as server:
             # Activate the server; this will keep running until you
             # interrupt the program with Ctrl-C
             server.serve_forever()

別の、ストリーム(標準のファイル型のインターフェースを利用して通信をシン
プルにしたファイルライクオブジェクト)を使うリクエストハンドラクラスの例
です:

     class MyTCPHandler(socketserver.StreamRequestHandler):

         def handle(self):
             # self.rfile is a file-like object created by the handler.
             # We can now use e.g. readline() instead of raw recv() calls.
             # We limit ourselves to 10000 bytes to avoid abuse by the sender.
             self.data = self.rfile.readline(10000).rstrip()
             print(f"{self.client_address[0]} wrote:")
             print(self.data.decode("utf-8"))
             # Likewise, self.wfile is a file-like object used to write back
             # to the client
             self.wfile.write(self.data.upper())

The difference is that the ‘readline()’ call in the second handler will
call ‘recv()’ multiple times until it encounters a newline character,
while the first handler had to use a ‘recv()’ loop to accumulate data
until a newline itself.  If it had just used a single ‘recv()’ without
the loop it would just have returned what has been received so far from
the client.  TCP is stream based: data arrives in the order it was sent,
but there is no correlation between client ‘send()’ or ‘sendall()’ calls
and the number of ‘recv()’ calls on the server required to receive it.

クライアントサイドの例:

     import socket
     import sys

     HOST, PORT = "localhost", 9999
     data = " ".join(sys.argv[1:])

     # Create a socket (SOCK_STREAM means a TCP socket)
     with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
         # Connect to server and send data
         sock.connect((HOST, PORT))
         sock.sendall(bytes(data, "utf-8"))
         sock.sendall(b"\n")

         # Receive data from the server and shut down
         received = str(sock.recv(1024), "utf-8")

     print("Sent:    ", data)
     print("Received:", received)

この例の出力は次のようになります:

サーバー:

     $ python TCPServer.py
     127.0.0.1 wrote:
     b'hello world with TCP'
     127.0.0.1 wrote:
     b'python is nice'

クライアント:

     $ python TCPClient.py hello world with TCP
     Sent:     hello world with TCP
     Received: HELLO WORLD WITH TCP
     $ python TCPClient.py python is nice
     Sent:     python is nice
     Received: PYTHON IS NICE


File: python.info,  Node: socketserver UDPServer の例,  Next: 非同期処理の Mix-in,  Prev: socketserver TCPServer の例,  Up: 使用例<40>

5.22.16.6 ‘socketserver.UDPServer’ の例
.......................................

サーバサイドの例です:

     import socketserver

     class MyUDPHandler(socketserver.BaseRequestHandler):
         """
         This class works similar to the TCP handler class, except that
         self.request consists of a pair of data and client socket, and since
         there is no connection the client address must be given explicitly
         when sending data back via sendto().
         """

         def handle(self):
             data = self.request[0].strip()
             socket = self.request[1]
             print(f"{self.client_address[0]} wrote:")
             print(data)
             socket.sendto(data.upper(), self.client_address)

     if __name__ == "__main__":
         HOST, PORT = "localhost", 9999
         with socketserver.UDPServer((HOST, PORT), MyUDPHandler) as server:
             server.serve_forever()

クライアントサイドの例:

     import socket
     import sys

     HOST, PORT = "localhost", 9999
     data = " ".join(sys.argv[1:])

     # SOCK_DGRAM is the socket type to use for UDP sockets
     sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

     # As you can see, there is no connect() call; UDP has no connections.
     # Instead, data is directly sent to the recipient via sendto().
     sock.sendto(bytes(data + "\n", "utf-8"), (HOST, PORT))
     received = str(sock.recv(1024), "utf-8")

     print("Sent:    ", data)
     print("Received:", received)

この例の出力は、TCPサーバーの例と全く同じようになります。


File: python.info,  Node: 非同期処理の Mix-in,  Prev: socketserver UDPServer の例,  Up: 使用例<40>

5.22.16.7 非同期処理の Mix-in
.............................

複数の接続を非同期に処理するハンドラを作るには、 *note ThreadingMixIn:
d3a. か *note ForkingMixIn: d71. クラスを利用します。

*note ThreadingMixIn: d3a. クラスの利用例:

     import socket
     import threading
     import socketserver

     class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):

         def handle(self):
             data = str(self.request.recv(1024), 'ascii')
             cur_thread = threading.current_thread()
             response = bytes("{}: {}".format(cur_thread.name, data), 'ascii')
             self.request.sendall(response)

     class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
         pass

     def client(ip, port, message):
         with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
             sock.connect((ip, port))
             sock.sendall(bytes(message, 'ascii'))
             response = str(sock.recv(1024), 'ascii')
             print("Received: {}".format(response))

     if __name__ == "__main__":
         # Port 0 means to select an arbitrary unused port
         HOST, PORT = "localhost", 0

         server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler)
         with server:
             ip, port = server.server_address

             # Start a thread with the server -- that thread will then start one
             # more thread for each request
             server_thread = threading.Thread(target=server.serve_forever)
             # Exit the server thread when the main thread terminates
             server_thread.daemon = True
             server_thread.start()
             print("Server loop running in thread:", server_thread.name)

             client(ip, port, "Hello World 1")
             client(ip, port, "Hello World 2")
             client(ip, port, "Hello World 3")

             server.shutdown()

この例の出力は次のようになります:

     $ python ThreadedTCPServer.py
     Server loop running in thread: Thread-1
     Received: Thread-2: Hello World 1
     Received: Thread-3: Hello World 2
     Received: Thread-4: Hello World 3

*note ForkingMixIn: d71. クラスは同じように利用することができます。この
場合、サーバーはリクエスト毎に新しいプロセスを作成します。*note fork():
4b5. をサポートする POSIX プラットフォームでのみ利用可能です。


File: python.info,  Node: http server --- HTTP サーバー,  Next: http cookies --- HTTP の状態管理,  Prev: socketserver --- ネットワークサーバーのフレームワーク,  Up: インターネットプロトコルとサポート

5.22.17 ‘http.server’ -- HTTP サーバー
--------------------------------------

'ソースコード:' Lib/http/server.py(1)

__________________________________________________________________

このモジュールは HTTP サーバを実装するためのクラスを提供しています。

     警告: ‘http.server’ is not recommended for production.  It only
     implements *note basic security checks: 40e8.

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

クラス *note HTTPServer: 3ee5. は *note socketserver.TCPServer: 1537. の
サブクラスです。 *note HTTPServer: 3ee5. は HTTP ソケットを生成してリク
エスト待ち (listen) を行い、リクエストをハンドラに渡します。 サーバを作
成して動作させるためのコードは以下のようになります:

     def run(server_class=HTTPServer, handler_class=BaseHTTPRequestHandler):
         server_address = ('', 8000)
         httpd = server_class(server_address, handler_class)
         httpd.serve_forever()

 -- クラス: http.server.HTTPServer (server_address, RequestHandlerClass)

     このクラスは *note TCPServer: 1537. クラスの上に構築されており、サ
     ーバのアドレスをインスタンス変数 ‘server_name’ および ‘server_port’
     に記憶します。 サーバはハンドラからアクセス可能で、通常ハンドラの
     ‘server’ インスタンス変数からアクセスします。

 -- クラス: http.server.ThreadingHTTPServer (server_address,
          RequestHandlerClass)

     This class is identical to HTTPServer but uses threads to handle
     requests by using the *note ThreadingMixIn: d3a.  This is useful to
     handle web browsers pre-opening sockets, on which *note HTTPServer:
     3ee5. would wait indefinitely.

     Added in version 3.7.

 -- クラス: http.server.HTTPSServer (server_address,
          RequestHandlerClass, bind_and_activate=True, *, certfile,
          keyfile=None, password=None, alpn_protocols=None)

     Subclass of *note HTTPServer: 3ee5. with a wrapped socket using the
     *note ssl: d5. module.  If the *note ssl: d5. module is not
     available, instantiating a ‘HTTPSServer’ object fails with a *note
     RuntimeError: 244.

     The 'certfile' argument is the path to the SSL certificate chain
     file, and the 'keyfile' is the path to file containing the private
     key.

     A 'password' can be specified for files protected and wrapped with
     PKCS#8, but beware that this could possibly expose hardcoded
     passwords in clear.

     参考
     ....

     See *note ssl.SSLContext.load_cert_chain(): 598. for additional
     information on the accepted values for 'certfile', 'keyfile' and
     'password'.

     When specified, the 'alpn_protocols' argument must be a sequence of
     strings specifying the "Application-Layer Protocol Negotiation"
     (ALPN) protocols supported by the server.  ALPN allows the server
     and the client to negotiate the application protocol during the TLS
     handshake.

     By default, it is set to ‘["http/1.1"]’, meaning the server
     supports HTTP/1.1.

     Added in version 3.14.

 -- クラス: http.server.ThreadingHTTPSServer (server_address,
          RequestHandlerClass, bind_and_activate=True, *, certfile,
          keyfile=None, password=None, alpn_protocols=None)

     This class is identical to *note HTTPSServer: 228. but uses threads
     to handle requests by inheriting from *note ThreadingMixIn: d3a.
     This is analogous to *note ThreadingHTTPServer: d39. only using
     *note HTTPSServer: 228.

     Added in version 3.14.

The *note HTTPServer: 3ee5, *note ThreadingHTTPServer: d39, *note
HTTPSServer: 228. and *note ThreadingHTTPSServer: 40e9. must be given a
'RequestHandlerClass' on instantiation, of which this module provides
three different variants:

 -- クラス: http.server.BaseHTTPRequestHandler (request, client_address,
          server)

     このクラスはサーバに到着したリクエストを処理します。 このメソッド自
     体では、実際のリクエストに応答することはできません; (GET や POST の
     ような) 各リクエストメソッドを処理するためにはサブクラス化しなけれ
     ばなりません。 *note BaseHTTPRequestHandler: 12e2. では、サブクラス
     で使うためのクラスやインスタンス変数、メソッド群を数多く提供してい
     ます。

     The handler will parse the request and the headers, then call a
     method specific to the request type.  The method name is
     constructed from the request.  For example, for the request method
     ‘SPAM’, the ‘do_SPAM()’ method will be called with no arguments.
     All of the relevant information is stored in instance variables of
     the handler.  Subclasses should not need to override or extend the
     ‘__init__()’ method.

     *note BaseHTTPRequestHandler: 12e2. は以下のインスタンス変数を持っ
     ています:

      -- の属性: client_address

          HTTP クライアントのアドレスを参照している、‘(host, port)’ の形
          式をとるタプルが入っています。

      -- の属性: server

          server インスタンスが入っています。

      -- の属性: close_connection

          *note handle_one_request(): 40ed. が返る前に設定すべき真偽値で
          、別のリクエストが期待されているかどうか、もしくはコネクション
          を切断すべきかどうかを指し示しています。

      -- の属性: requestline

          HTTP リクエスト行の文字列表現を保持しています。 末尾の CRLF は
          除去されています。 この属性は *note handle_one_request():
          40ed. によって設定されるべきです。 妥当なリクエスト行が1行も処
          理されなかった場合は、空文字列に設定されるべきです。

      -- の属性: command

          HTTP 命令 (リクエスト形式) が入っています。例えば ‘'GET'’ です
          。

      -- の属性: path

          Contains the request path.  If query component of the URL is
          present, then ‘path’ includes the query.  Using the
          terminology of RFC 3986(2), ‘path’ here includes ‘hier-part’
          and the ‘query’.

      -- の属性: request_version

          リクエストのバージョン文字列が入っています。例えば
          ‘'HTTP/1.0'’ です。

      -- の属性: headers

          Holds an instance of the class specified by the *note
          MessageClass: 40f2. class variable.  This instance parses and
          manages the headers in the HTTP request.  The *note
          parse_headers(): 1e28. function from *note http.client: 73. is
          used to parse the headers and it requires that the HTTP
          request provide a valid RFC 5322(3) style header.

      -- の属性: rfile

          An *note io.BufferedIOBase: 8a3. input stream, ready to read
          from the start of the optional input data.

      -- の属性: wfile

          Contains the output stream for writing a response back to the
          client.  Proper adherence to the HTTP protocol must be used
          when writing to this stream in order to achieve successful
          interoperation with HTTP clients.

          バージョン 3.6 で変更: This is an *note io.BufferedIOBase:
          8a3. stream.

     *note BaseHTTPRequestHandler: 12e2. は以下の属性を持っています:

      -- の属性: server_version

          サーバのソフトウェアバージョンを指定します。この値は上書きする
          必要が生じるかもしれません。書式は複数の文字列を空白で分割した
          もので、各文字列はソフトウェア名[/バージョン] の形式をとります
          。例えば、‘'BaseHTTP/0.2'’ です。

      -- の属性: sys_version

          Python 処理系のバージョンが, *note version_string: 40f7. メソ
          ッドや *note server_version: 40f5. クラス変数で利用可能な形式
          で入っています。例えば ‘'Python/1.4'’ です。

      -- の属性: error_message_format

          Specifies a format string that should be used by *note
          send_error(): 1151. method for building an error response to
          the client.  The string is filled by default with variables
          from *note responses: 3faf. based on the status code that
          passed to *note send_error(): 1151.

      -- の属性: error_content_type

          エラーレスポンスをクライアントに送信する時に使う Content-Type
          HTTP ヘッダを指定します。デフォルトでは ‘'text/html'’ です。

      -- の属性: protocol_version

          Specifies the HTTP version to which the server is conformant.
          It is sent in responses to let the client know the server's
          communication capabilities for future requests.  If set to
          ‘'HTTP/1.1'’, the server will permit HTTP persistent
          connections; however, your server 'must' then include an
          accurate ‘Content-Length’ header (using *note send_header():
          40fa.) in all of its responses to clients.  For backwards
          compatibility, the setting defaults to ‘'HTTP/1.0'’.

      -- の属性: MessageClass

          HTTP ヘッダを解釈するための *note email.message.Message: 581.
          類似のクラスを指定します。 通常この値が上書きされることはなく
          、デフォルトの *note http.client.HTTPMessage: 3fc8. になってい
          ます。

      -- の属性: responses

          This attribute contains a mapping of error code integers to
          two-element tuples containing a short and long message.  For
          example, ‘{code: (shortmessage, longmessage)}’.  The
          'shortmessage' is usually used as the 'message' key in an
          error response, and 'longmessage' as the 'explain' key.  It is
          used by *note send_response_only(): 40fb. and *note
          send_error(): 1151. methods.

     *note BaseHTTPRequestHandler: 12e2. インスタンスは以下のメソッドを
     持っています:

      -- メソッド: handle ()

          Calls *note handle_one_request(): 40ed. once (or, if
          persistent connections are enabled, multiple times) to handle
          incoming HTTP requests.  You should never need to override it;
          instead, implement appropriate ‘do_*()’ methods.

      -- メソッド: handle_one_request ()

          This method will parse and dispatch the request to the
          appropriate ‘do_*()’ method.  You should never need to
          override it.

      -- メソッド: handle_expect_100 ()

          HTTP/1.1 準拠のサーバが ‘Expect: 100-continue’ リクエストヘッ
          ダを受け取ったとき、 ‘100 Continue’ を返し、その後に ‘200 OK’
          がきます。 このメソッドは、サーバがクライアントに継続を要求し
          ない場合、エラーを送出するようにオーバーライドできます。 例え
          ば、サーバはレスポンスヘッダとして ‘417 Expectation Failed’ を
          送る選択をし、 ‘return False’ とできます。

          Added in version 3.2.

      -- メソッド: send_error (code, message=None, explain=None)

          Sends and logs a complete error reply to the client.  The
          numeric 'code' specifies the HTTP error code, with 'message'
          as an optional, short, human readable description of the
          error.  The 'explain' argument can be used to provide more
          detailed information about the error; it will be formatted
          using the *note error_message_format: 1152. attribute and
          emitted, after a complete set of headers, as the response
          body.  The *note responses: 3faf. attribute holds the default
          values for 'message' and 'explain' that will be used if no
          value is provided; for unknown codes the default value for
          both is the string ‘???’.  The body will be empty if the
          method is HEAD or the response code is one of the following:
          ‘1XX’, ‘204 No Content’, ‘205 Reset Content’, ‘304 Not
          Modified’.

          バージョン 3.4 で変更: The error response includes a
          Content-Length header.  Added the 'explain' argument.

      -- メソッド: send_response (code, message=None)

          Adds a response header to the headers buffer and logs the
          accepted request.  The HTTP response line is written to the
          internal buffer, followed by 'Server' and 'Date' headers.  The
          values for these two headers are picked up from the *note
          version_string(): 40f7. and *note date_time_string(): 40ff.
          methods, respectively.  If the server does not intend to send
          any other headers using the *note send_header(): 40fa. method,
          then *note send_response(): 40fe. should be followed by an
          *note end_headers(): 12e3. call.

          バージョン 3.3 で変更: Headers are stored to an internal
          buffer and *note end_headers(): 12e3. needs to be called
          explicitly.

      -- メソッド: send_header (keyword, value)

          Adds the HTTP header to an internal buffer which will be
          written to the output stream when either *note end_headers():
          12e3. or *note flush_headers(): 12e4. is invoked.  'keyword'
          should specify the header keyword, with 'value' specifying its
          value.  Note that, after the send_header calls are done, *note
          end_headers(): 12e3. MUST BE called in order to complete the
          operation.

          バージョン 3.2 で変更: ヘッダは内部バッファに保存されます。

      -- メソッド: send_response_only (code, message=None)

          Sends the response header only, used for the purposes when
          ‘100 Continue’ response is sent by the server to the client.
          The headers not buffered and sent directly the output
          stream.If the 'message' is not specified, the HTTP message
          corresponding the response 'code' is sent.

          Added in version 3.2.

      -- メソッド: end_headers ()

          Adds a blank line (indicating the end of the HTTP headers in
          the response) to the headers buffer and calls *note
          flush_headers(): 12e4.

          バージョン 3.2 で変更: バッファされたヘッダは出力ストリームに
          書き出されます。

      -- メソッド: flush_headers ()

          最終的にヘッダを出力ストリームに送り、内部ヘッダバッファをフラ
          ッシュします。

          Added in version 3.3.

      -- メソッド: log_request (code='-', size='-')

          受理された (成功した) リクエストをログに記録します。'code' に
          はこの応答に関連付けられた HTTP コード番号を指定します。応答メ
          ッセージの大きさを知ることができる場合、'size' パラメタに渡す
          とよいでしょう。

      -- メソッド: log_error (...)

          リクエストを遂行できなかった際に、エラーをログに記録します。標
          準では、メッセージを *note log_message(): 4102. に渡します。従
          って同じ引数 ('format' と追加の値) を取ります。

      -- メソッド: log_message (format, ...)

          任意のメッセージを ‘sys.stderr’ にログ記録します。このメソッド
          は通常、カスタムのエラーログ記録機構を作成するために上書きされ
          ます。 'format' 引数は標準の printf 形式の書式文字列で、 *note
          log_message(): 4102. に渡された追加の引数は書式化の入力として
          適用されます。ログ記録される全てのメッセージには、クライアント
          の IP アドレスおよび現在の日付、時刻が先頭に付けられます。

      -- メソッド: version_string ()

          サーバーのソフトウェアのバージョンを示す文字列を返します。 そ
          の文字列は、*note server_version: 40f5. と *note sys_version:
          40f6. の属性が含まれます。

      -- メソッド: date_time_string (timestamp=None)

          メッセージヘッダ向けに書式化された、 'timestamp' (‘None’ また
          は *note time.time(): 55d. のフォーマットである必要があります
          )で与えられた日時を返します。もし 'timestamp' が省略された場合
          には、現在の日時が使われます。

          出力は ‘'Sun, 06 Nov 1994 08:49:37 GMT'’ のようになります。

      -- メソッド: log_date_time_string ()

          ログ記録向けに書式化された、現在の日付および時刻を返します。

      -- メソッド: address_string ()

          クライアントのアドレスを返します。

          バージョン 3.3 で変更: Previously, a name lookup was
          performed.  To avoid name resolution delays, it now always
          returns the IP address.

 -- クラス: http.server.SimpleHTTPRequestHandler (request,
          client_address, server, directory=None)

     This class serves files from the directory 'directory' and below,
     or the current directory if 'directory' is not provided, directly
     mapping the directory structure to HTTP requests.

     バージョン 3.7 で変更: Added the 'directory' parameter.

     バージョン 3.9 で変更: The 'directory' parameter accepts a *note
     path-like object: 5a1.

     リクエストの解釈のような、多くの作業は基底クラス *note
     BaseHTTPRequestHandler: 12e2. で行われます。このクラスは関数 *note
     do_GET(): 4105. および *note do_HEAD(): 4106. を実装しています。

     *note SimpleHTTPRequestHandler: d38. では以下のメンバ変数を定義して
     います:

      -- の属性: server_version

          この値は ‘"SimpleHTTP/" + __version__’ になります。
          ‘__version__’ はこのモジュールで定義されている値です。

      -- の属性: extensions_map

          A dictionary mapping suffixes into MIME types, contains custom
          overrides for the default system mappings.  The mapping is
          used case-insensitively, and so should contain only
          lower-cased keys.

          バージョン 3.9 で変更: This dictionary is no longer filled
          with the default system mappings, but only contains overrides.

     *note SimpleHTTPRequestHandler: d38. では以下のメソッドを定義してい
     ます:

      -- メソッド: do_HEAD ()

          このメソッドは ‘'HEAD'’ 型のリクエスト処理を実行します: すなわ
          ち、 ‘GET’ リクエストの時に送信されるものと同じヘッダを送信し
          ます。送信される可能性のあるヘッダについての完全な説明は *note
          do_GET(): 4105. メソッドを参照してください。

      -- メソッド: do_GET ()

          リクエストを現在の作業ディレクトリからの相対的なパスとして解釈
          することで、リクエストをローカルシステム上のファイルと対応付け
          ます。

          リクエストがディレクトリに対応付けられた場合、 ‘index.html’ ま
          たは ‘index.htm’ を (この順序で) チェックします。もしファイル
          を発見できればその内容を、そうでなければディレクトリ一覧を
          ‘list_directory()’ メソッドで生成して、返します。このメソッド
          は *note os.listdir(): 1312. をディレクトリのスキャンに用いて
          おり、 *note listdir(): 1312. が失敗した場合には ‘404’ 応答が
          返されます。

          If the request was mapped to a file, it is opened.  Any *note
          OSError: 2c0. exception in opening the requested file is
          mapped to a ‘404’, ‘'File not found'’ error.  If there was an
          ‘'If-Modified-Since'’ header in the request, and the file was
          not modified after this time, a ‘304’, ‘'Not Modified'’
          response is sent.  Otherwise, the content type is guessed by
          calling the ‘guess_type()’ method, which in turn uses the
          'extensions_map' variable, and the file contents are returned.

          出力は ‘'Content-type:'’ と推測されたコンテントタイプで、その
          後にファイルサイズを示す ‘'Content-Length;'’ ヘッダと、ファイ
          ルの更新日時を示す ‘'Last-Modified:'’ ヘッダが続きます。

          Then follows a blank line signifying the end of the headers,
          and then the contents of the file are output.

          For example usage, see the implementation of the ‘test’
          function in Lib/http/server.py(4).

          バージョン 3.7 で変更: Support of the ‘'If-Modified-Since'’
          header.

The *note SimpleHTTPRequestHandler: d38. class can be used in the
following manner in order to create a very basic webserver serving files
relative to the current directory:

     import http.server
     import socketserver

     PORT = 8000

     Handler = http.server.SimpleHTTPRequestHandler

     with socketserver.TCPServer(("", PORT), Handler) as httpd:
         print("serving at port", PORT)
         httpd.serve_forever()

*note SimpleHTTPRequestHandler: d38. can also be subclassed to enhance
behavior, such as using different index file names by overriding the
class attribute ‘index_pages’.

 -- クラス: http.server.CGIHTTPRequestHandler (request, client_address,
          server)

     このクラスは、現在のディレクトリかその下のディレクトリにおいて、フ
     ァイルか CGI スクリプト出力を提供するために使われます。 HTTP 階層構
     造からローカルなディレクトリ構造への対応付けは *note
     SimpleHTTPRequestHandler: d38. と全く同じなので注意してください。

          注釈: *note CGIHTTPRequestHandler: 325. クラスで実行される CGI
          スクリプトは HTTP コード 200 (スクリプトの出力が後に続く) を実
          行に先立って出力される (これがステータスコードになります) ため
          、リダイレクト(コード302) を行なうことができません。

     このクラスでは、ファイルが CGI スクリプトであると推測された場合、こ
     れをファイルとして提供する代わりにスクリプトを実行します。 -- 他の
     一般的なサーバ設定は特殊な拡張子を使って CGI スクリプトであることを
     示すのに対し、ディレクトリベースの CGI だけが使われます。

     ‘do_GET()’ および ‘do_HEAD()’ 関数は、HTTP 要求が ‘cgi_directories’
     パス以下のどこかを指している場合、ファイルを提供するのではなく、CGI
     スクリプトを実行してその出力を提供するように変更されています。

     *note CGIHTTPRequestHandler: 325. では以下のデータメンバを定義して
     います:

      -- の属性: cgi_directories

          この値は標準で ‘['/cgi-bin', '/htbin']’ であり、CGI スクリプト
          を含んでいることを示すディレクトリを記述します。

     *note CGIHTTPRequestHandler: 325. は以下のメソッドを定義しています:

      -- メソッド: do_POST ()

          このメソッドは、CGI スクリプトでのみ許されている ‘'POST'’ 型の
          HTTP 要求に対するサービスを行います。CGI でない url に対して
          POST を試みた場合、出力は Error 501, "Can only POST to CGI
          scripts" になります。

     セキュリティ上の理由から、CGI スクリプトはユーザ nobody の UID で動
     作するので注意してください。 CGI スクリプトが原因で発生した問題は、
     Error 403 に変換されます。

     Deprecated since version 3.13, will be removed in version 3.15:
     *note CGIHTTPRequestHandler: 325. is being removed in 3.15.  CGI
     has not been considered a good way to do things for well over a
     decade.  This code has been unmaintained for a while now and sees
     very little practical use.  Retaining it could lead to further
     *note security considerations: 40e8.

* Menu:

* コマンドライン・インターフェース: コマンドライン・インターフェース<7>.
* セキュリティで考慮すべき点: セキュリティで考慮すべき点<5>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/http/server.py

   (2) https://datatracker.ietf.org/doc/html/rfc3986.html

   (3) https://datatracker.ietf.org/doc/html/rfc5322.html

   (4) https://github.com/python/cpython/tree/3.14/Lib/http/server.py


File: python.info,  Node: コマンドライン・インターフェース<7>,  Next: セキュリティで考慮すべき点<5>,  Up: http server --- HTTP サーバー

5.22.17.1 コマンドライン・インターフェース
..........................................

‘http.server’ can also be invoked directly using the *note -m: 23c.
switch of the interpreter.  The following example illustrates how to
serve files relative to the current directory:

     python -m http.server [OPTIONS] [port]

以下のオプションが使用できます:

 -- Option: port

     The server listens to port 8000 by default.  The default can be
     overridden by passing the desired port number as an argument:

          python -m http.server 9000

 -- Option: -b, --bind <address>

     Specifies a specific address to which it should bind.  Both IPv4
     and IPv6 addresses are supported.  By default, the server binds
     itself to all interfaces.  For example, the following command
     causes the server to bind to localhost only:

          python -m http.server --bind 127.0.0.1

     Added in version 3.4.

     バージョン 3.8 で変更: Support IPv6 in the ‘--bind’ option.

 -- Option: -d, --directory <dir>

     Specifies a directory to which it should serve the files.  By
     default, the server uses the current directory.  For example, the
     following command uses a specific directory:

          python -m http.server --directory /tmp/

     Added in version 3.7.

 -- Option: -p, --protocol <version>

     Specifies the HTTP version to which the server is conformant.  By
     default, the server is conformant to HTTP/1.0.  For example, the
     following command runs an HTTP/1.1 conformant server:

          python -m http.server --protocol HTTP/1.1

     Added in version 3.11.

 -- Option: --cgi

     *note CGIHTTPRequestHandler: 325. can be enabled in the command
     line by passing the ‘--cgi’ option:

          python -m http.server --cgi

     Deprecated since version 3.13, will be removed in version 3.15:
     ‘http.server’ command line ‘--cgi’ support is being removed because
     *note CGIHTTPRequestHandler: 325. is being removed.

     警告: *note CGIHTTPRequestHandler: 325. and the ‘--cgi’
     command-line option are not intended for use by untrusted clients
     and may be vulnerable to exploitation.  Always use within a secure
     environment.

 -- Option: --tls-cert

     Specifies a TLS certificate chain for HTTPS connections:

          python -m http.server --tls-cert fullchain.pem

     Added in version 3.14.

 -- Option: --tls-key

     Specifies a private key file for HTTPS connections.

     This option requires ‘--tls-cert’ to be specified.

     Added in version 3.14.

 -- Option: --tls-password-file

     Specifies the password file for password-protected private keys:

          python -m http.server \
                 --tls-cert cert.pem \
                 --tls-key key.pem \
                 --tls-password-file password.txt

     This option requires ‘-tls-cert'’ to be specified.

     Added in version 3.14.


File: python.info,  Node: セキュリティで考慮すべき点<5>,  Prev: コマンドライン・インターフェース<7>,  Up: http server --- HTTP サーバー

5.22.17.2 セキュリティで考慮すべき点
....................................

*note SimpleHTTPRequestHandler: d38. will follow symbolic links when
handling requests, this makes it possible for files outside of the
specified directory to be served.

Earlier versions of Python did not scrub control characters from the log
messages emitted to stderr from ‘python -m http.server’ or the default
*note BaseHTTPRequestHandler: 12e2. ‘.log_message’ implementation.  This
could allow remote clients connecting to your server to send nefarious
control codes to your terminal.

バージョン 3.12 で変更: Control characters are scrubbed in stderr logs.


File: python.info,  Node: http cookies --- HTTP の状態管理,  Next: http cookiejar --- HTTP クライアント用の Cookie 処理,  Prev: http server --- HTTP サーバー,  Up: インターネットプロトコルとサポート

5.22.18 ‘http.cookies’ -- HTTP の状態管理
-----------------------------------------

'ソースコード:' Lib/http/cookies.py(1)

__________________________________________________________________

The ‘http.cookies’ module defines classes for abstracting the concept of
cookies, an HTTP state management mechanism.  It supports both simple
string-only cookies, and provides an abstraction for having any
serializable data-type as cookie value.

このモジュールは元々 RFC 2109(2) と RFC 2068(3) に定義されている構文解析
の規則を厳密に守っていました。しかし、MSIE 3.0x がこれらの RFC で定義さ
れた文字の規則に従っていなかったことが判明し、現在の多くのブラウザーとサ
ーバーも Cookie の処理に関しては緩い解析を行っています。結局、このモジュ
ールは昔よりもやや厳密さを欠く構文解析規則になっています。

文字集合 *note string.ascii_letters: 14db. 、 *note string.digits: 2722.
、 ‘!#$%&'*+-.^_`|~:’ を、このモジュールは cookie 名 (*note key: dfb.) と
して有効と認めています。

バージョン 3.3 で変更: ':' が有効な cookie 名の文字として認められました
。

     注釈: 不正な cookie に遭遇した場合、 *note CookieError: 4117. 例外
     を送出します。そのため、ブラウザから持ってきた cookie データをパー
     スするときには常に不正なデータに備え *note CookieError: 4117. 例外
     を捕捉してください。

 -- 例外: http.cookies.CookieError

     属性や ‘Set-Cookie’ ヘッダが正しくないなど、 RFC 2109(4) に合致して
     いないときに発生する例外です。

 -- クラス: http.cookies.BaseCookie ([input])

     このクラスはキーが文字列、値が *note Morsel: dfe. インスタンスで構
     成される辞書風オブジェクトです。値に対するキーを設定するときは、値
     がキーと値を含む *note Morsel: dfe. に変換されることに注意してくだ
     さい。

     'input' が与えられたときは、そのまま *note load(): 4119. メソッドへ
     渡されます。

 -- クラス: http.cookies.SimpleCookie ([input])

     このクラスは *note BaseCookie: 4118. を継承し、 *note
     value_decode(): 411a. と *note value_encode(): 411b. をオーバーライ
     ドします。 ‘SimpleCookie’ は文字列と cookie 値をサポートします。値
     を設定するとき、 ‘SimpleCookie’ は組み込みの *note str(): 169. を呼
     び出して値を文字列に変換します。HTTP から受け取った値は文字列として
     保持されます。

参考
....

モジュール *note http.cookiejar: 74.

     HTTP cookie handling for web 'clients'.  The *note http.cookiejar:
     74. and ‘http.cookies’ modules do not depend on each other.

RFC 2109(5) - HTTP State Management Mechanism

     このモジュールが実装しているHTTPの状態管理に関する規格です。

* Menu:

* Cookieオブジェクト::
* Morselオブジェクト::
* 使用例: 使用例<41>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/http/cookies.py

   (2) https://datatracker.ietf.org/doc/html/rfc2109.html

   (3) https://datatracker.ietf.org/doc/html/rfc2068.html

   (4) https://datatracker.ietf.org/doc/html/rfc2109.html

   (5) https://datatracker.ietf.org/doc/html/rfc2109.html


File: python.info,  Node: Cookieオブジェクト,  Next: Morselオブジェクト,  Up: http cookies --- HTTP の状態管理

5.22.18.1 Cookieオブジェクト
............................

 -- メソッド: BaseCookie.value_decode (val)

     文字列表現のタプル ‘(real_value, coded_value)’ を返します。
     ‘real_value’ の型はどのようなものでも許容されます。このメソッドは
     *note BaseCookie: 4118. においてデコードを行わず、オーバーライドさ
     れるためにだけ存在します。

 -- メソッド: BaseCookie.value_encode (val)

     タプル ‘(real_value, coded_value)’ を返します。 'val' の型はどのよ
     うなものでも許容されますが、 ‘coded_value’ は常に文字列に変換されま
     す。このメソッドは *note BaseCookie: 4118. においてエンコードを行わ
     ず、オーバーライドされるためにだけ存在します。

     通常 *note value_encode(): 411b. と *note value_decode(): 411a. は
     ともに 'value_decode' の処理内容から逆算した範囲に収まっていなけれ
     ばなりません。

 -- メソッド: BaseCookie.output (attrs=None, header='Set-Cookie:',
          sep='\r\n')

     Return a string representation suitable to be sent as HTTP headers.
     'attrs' and 'header' are sent to each *note Morsel: dfe.'s *note
     output(): 411f. method.  'sep' is used to join the headers
     together, and is by default the combination ‘'\r\n'’ (CRLF).

 -- メソッド: BaseCookie.js_output (attrs=None)

     ブラウザがJavaScriptをサポートしている場合、HTTPヘッダを送信した場
     合と同様に動作する埋め込み可能なJavaScript snippetを返します。

     'attrs' の意味は *note output(): 411e. と同じです。

 -- メソッド: BaseCookie.load (rawdata)

     'rawdata' が文字列であれば、 ‘HTTP_COOKIE’ として処理し、その値を
     *note Morsel: dfe. として追加します。辞書の場合は次と同様の処理をお
     こないます。

          for k, v in rawdata.items():
              cookie[k] = v


File: python.info,  Node: Morselオブジェクト,  Next: 使用例<41>,  Prev: Cookieオブジェクト,  Up: http cookies --- HTTP の状態管理

5.22.18.2 Morselオブジェクト
............................

 -- クラス: http.cookies.Morsel

     RFC 2109(1) の属性をキーと値で保持するabstractクラスです。

     Morselは辞書風のオブジェクトで、キーは次のような RFC 2109(2) 準拠の
     定数となっています:

           -- の属性: expires
           -- の属性: path
           -- の属性: comment
           -- の属性: domain

           -- の属性: max-age
           -- の属性: secure
           -- の属性: version
           -- の属性: httponly
           -- の属性: samesite
           -- の属性: partitioned

     *note httponly: 15e9. 属性は、 cookie が HTTP リクエストでのみ送信
     されて、 JavaScript からのはアクセスできない事を示します。これはい
     くつかのクロスサイトスクリプティングの脅威を和らげることを意図して
     います。

     The attribute *note samesite: 4129. controls when the browser sends
     the cookie with cross-site requests.  This helps to mitigate CSRF
     attacks.  Valid values are "Strict" (only sent with same-site
     requests), "Lax" (sent with same-site requests and top-level
     navigations), and "None" (sent with same-site and cross-site
     requests).  When using "None", the "secure" attribute must also be
     set, as required by modern browsers.

     The attribute *note partitioned: 412a. indicates to user agents
     that these cross-site cookies 'should' only be available in the
     same top-level context that the cookie was first set in.  For this
     to be accepted by the user agent, you 'must' also set ‘Secure’.

     In addition, it is recommended to use the ‘__Host’ prefix when
     setting partitioned cookies to make them bound to the hostname and
     not the registrable domain.  Read CHIPS (Cookies Having Independent
     Partitioned State)(3) for full details and examples.

     キーの大小文字は区別されません。そのデフォルト値は ‘''’ です。

     バージョン 3.5 で変更: ‘__eq__()’ は *note key: dfb. 及び *note
     value: dfc. を考慮するようになりました。

     バージョン 3.7 で変更: *note key: dfb. と *note value: dfc. 、
     *note coded_value: dfd. 属性は読み出し専用です。設定には、 *note
     set(): dff. を使用してください。

     バージョン 3.8 で変更: *note samesite: 4129. 属性がサポートされまし
     た。

     バージョン 3.14 で変更: Added support for the *note partitioned:
     412a. attribute.

 -- の属性: Morsel.value

     クッキーの値。

 -- の属性: Morsel.coded_value

     実際に送信する形式にエンコードされたcookieの値。

 -- の属性: Morsel.key

     cookieの名前。

 -- メソッド: Morsel.set (key, value, coded_value)

     属性 'key' 、 'value' 、 'coded_value' に値をセットします。

 -- メソッド: Morsel.isReservedKey (K)

     'K' が *note Morsel: dfe. のキーであるかどうかを判定します。

 -- メソッド: Morsel.output (attrs=None, header='Set-Cookie:')

     MoselをHTTPヘッダ形式の文字列表現にして返します。 'attrs' を指定し
     ない場合、デフォルトですべての属性を含めます。 'attrs' を指定する場
     合、属性をリストで渡さなければなりません。 'header' のデフォルトは
     ‘"Set-Cookie:"’ です。

 -- メソッド: Morsel.js_output (attrs=None)

     ブラウザがJavaScriptをサポートしている場合、HTTPヘッダを送信した場
     合と同様に動作する埋め込み可能なJavaScript snippetを返します。

     'attrs' の意味は *note output(): 411f. と同じです。

 -- メソッド: Morsel.OutputString (attrs=None)

     Moselの文字列表現をHTTPやJavaScriptで囲まずに出力します。

     'attrs' の意味は *note output(): 411f. と同じです。

 -- メソッド: Morsel.update (values)

     Morsel 辞書の値を辞書 'values' の値で更新します。'values' 辞書のキ
     ーのいずれかが有効な RFC 2109(4) 属性でない場合エラーを送出します。

     バージョン 3.5 で変更: 不正なキーではエラーが送出されます。

 -- メソッド: Morsel.copy (value)

     Morsel オブジェクトの浅いコピーを返します。

     バージョン 3.5 で変更: 辞書ではなく Morsel オブジェクトを返します。

 -- メソッド: Morsel.setdefault (key, value=None)

     キーが有効な RFC 2109(5) 属性でない場合エラーを送出します。そうでな
     い場合は *note dict.setdefault(): 1285. と同じように振る舞います。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2109.html

   (2) https://datatracker.ietf.org/doc/html/rfc2109.html

   (3) https://github.com/privacycg/CHIPS/blob/main/README.md

   (4) https://datatracker.ietf.org/doc/html/rfc2109.html

   (5) https://datatracker.ietf.org/doc/html/rfc2109.html


File: python.info,  Node: 使用例<41>,  Prev: Morselオブジェクト,  Up: http cookies --- HTTP の状態管理

5.22.18.3 使用例
................

The following example demonstrates how to use the ‘http.cookies’ module.

     >>> from http import cookies
     >>> C = cookies.SimpleCookie()
     >>> C["fig"] = "newton"
     >>> C["sugar"] = "wafer"
     >>> print(C) # generate HTTP headers
     Set-Cookie: fig=newton
     Set-Cookie: sugar=wafer
     >>> print(C.output()) # same thing
     Set-Cookie: fig=newton
     Set-Cookie: sugar=wafer
     >>> C = cookies.SimpleCookie()
     >>> C["rocky"] = "road"
     >>> C["rocky"]["path"] = "/cookie"
     >>> print(C.output(header="Cookie:"))
     Cookie: rocky=road; Path=/cookie
     >>> print(C.output(attrs=[], header="Cookie:"))
     Cookie: rocky=road
     >>> C = cookies.SimpleCookie()
     >>> C.load("chips=ahoy; vienna=finger") # load from a string (HTTP header)
     >>> print(C)
     Set-Cookie: chips=ahoy
     Set-Cookie: vienna=finger
     >>> C = cookies.SimpleCookie()
     >>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=;";')
     >>> print(C)
     Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=;"
     >>> C = cookies.SimpleCookie()
     >>> C["oreo"] = "doublestuff"
     >>> C["oreo"]["path"] = "/"
     >>> print(C)
     Set-Cookie: oreo=doublestuff; Path=/
     >>> C = cookies.SimpleCookie()
     >>> C["twix"] = "none for you"
     >>> C["twix"].value
     'none for you'
     >>> C = cookies.SimpleCookie()
     >>> C["number"] = 7 # equivalent to C["number"] = str(7)
     >>> C["string"] = "seven"
     >>> C["number"].value
     '7'
     >>> C["string"].value
     'seven'
     >>> print(C)
     Set-Cookie: number=7
     Set-Cookie: string=seven


File: python.info,  Node: http cookiejar --- HTTP クライアント用の Cookie 処理,  Next: xmlrpc --- XMLRPC サーバーとクライアントモジュール群,  Prev: http cookies --- HTTP の状態管理,  Up: インターネットプロトコルとサポート

5.22.19 ‘http.cookiejar’ -- HTTP クライアント用の Cookie 処理
-------------------------------------------------------------

'ソースコード:' Lib/http/cookiejar.py(1)

__________________________________________________________________

The ‘http.cookiejar’ module defines classes for automatic handling of
HTTP cookies.  It is useful for accessing websites that require small
pieces of data - 'cookies' - to be set on the client machine by an HTTP
response from a web server, and then returned to the server in later
HTTP requests.

Both the regular Netscape cookie protocol and the protocol defined by
RFC 2965(2) are handled.  RFC 2965 handling is switched off by default.
RFC 2109(3) cookies are parsed as Netscape cookies and subsequently
treated either as Netscape or RFC 2965 cookies according to the 'policy'
in effect.  Note that the great majority of cookies on the internet are
Netscape cookies.  ‘http.cookiejar’ attempts to follow the de-facto
Netscape cookie protocol (which differs substantially from that set out
in the original Netscape specification), including taking note of the
‘max-age’ and ‘port’ cookie-attributes introduced with RFC 2965.

     注釈: ‘Set-Cookie’ や ‘Set-Cookie2’ ヘッダに現れる多種多様なパラメ
     ータの名前 (‘domain’ や ‘expires’ など) は便宜上 '属性' と呼ばれま
     すが、ここでは Python の属性と区別するため、かわりに 'クッキー属性'
     と呼ぶことにします。

このモジュールは以下の例外を定義しています:

 -- 例外: http.cookiejar.LoadError

     この例外は *note FileCookieJar: 4135. インスタンスがファイルからク
     ッキーを読み込むのに失敗した場合に発生します。 *note LoadError:
     4134. は *note OSError: 2c0. のサブクラスです。

     バージョン 3.3 で変更: *note LoadError: 4134. は以前は *note
     IOError: 125e. のサブタイプでしたが、 *note OSError: 2c0. のエイリ
     アスになりました。

以下のクラスが提供されています:

 -- クラス: http.cookiejar.CookieJar (policy=None)

     'policy' は *note CookiePolicy: 4136. インターフェイスを実装するオ
     ブジェクトです。

     *note CookieJar: 3f53. クラスには HTTP クッキーを保管します。これは
     HTTP リクエストに応じてクッキーを取り出し、それを HTTP レスポンスの
     中で返します。必要に応じて、 *note CookieJar: 3f53. インスタンスは
     保管されているクッキーを自動的に破棄します。このサブクラスは、クッ
     キーをファイルやデータベースに格納したり取り出したりする操作をおこ
     なう役割を負っています。

 -- クラス: http.cookiejar.FileCookieJar (filename=None, delayload=None,
          policy=None)

     'policy' は *note CookiePolicy: 4136. インターフェイスを実装するオ
     ブジェクトです。これ以外の引数については、該当する属性の説明を参照
     してください。

     *note FileCookieJar: 4135. はディスク上のファイルからのクッキーの読
     み込み、もしくは書き込みをサポートします。実際には、 *note load():
     4137. または *note revert(): 4138. のどちらかのメソッドが呼ばれるま
     でクッキーは指定されたファイルからはロード 'されません' 。このクラ
     スのサブクラスは *note FileCookieJar のサブクラスと web
     ブラウザとの連携: 4139. 節で説明します。

     これは直接初期化されるべきではありません。以下のサブクラスを代わり
     に使用してください。

     バージョン 3.8 で変更: 'filename' 引数が *note path-like object:
     5a1. を受け付けるようになりました。

 -- クラス: http.cookiejar.CookiePolicy

     このクラスは、あるクッキーをサーバから受け入れるべきか、そしてサー
     バに返すべきかを決定する役割を負っています。

 -- クラス: http.cookiejar.DefaultCookiePolicy (blocked_domains=None,
          allowed_domains=None, netscape=True, rfc2965=False,
          rfc2109_as_netscape=None, hide_cookie2=False,
          strict_domain=False, strict_rfc2965_unverifiable=True,
          strict_ns_unverifiable=False,
          strict_ns_domain=DefaultCookiePolicy.DomainLiberal,
          strict_ns_set_initial_dollar=False, strict_ns_set_path=False,
          secure_protocols=('https', 'wss'))

     コンストラクタはキーワード引数しか取りません。 'blocked_domains' は
     ドメイン名からなるシーケンスで、ここからは決してクッキーを受けとら
     ないし、このドメインにクッキーを返すこともありません。
     'allowed_domains' が *note None: 885. でない場合、クッキーを受けと
     り、返すのはこのシーケンスのドメインに限定されます。
     'secure_protocols' は、安全なクッキーを追加できるプロトコルのシーケ
     ンスです。デフォルトでは、 'https' と 'wss' (secure websocket) が安
     全なプロトコルとみなされます。これ以外の引数については *note
     CookiePolicy: 4136. および *note DefaultCookiePolicy: 1df4. オブジ
     ェクトの説明をごらんください。

     *note DefaultCookiePolicy: 1df4. は Netscape および RFC 2965(4) ク
     ッキーの標準的な許可 / 拒絶のルールを実装しています。デフォルトでは
     、 RFC 2109(5) のクッキー (‘Set-Cookie’ の version クッキー属性が 1
     で受けとられるもの) は RFC 2965 のルールで扱われます。しかし、RFC
     2965 処理が無効に設定されているか *note rfc2109_as_netscape: 413a.
     が ‘True’ の場合、RFC 2109 クッキーは *note CookieJar: 3f53. インス
     タンスによって *note Cookie: 413b. のインスタンスの ‘version’ 属性
     を 0 に設定する事で Netscapeクッキーに「ダウングレード」されます。
     また *note DefaultCookiePolicy: 1df4. にはいくつかの細かいポリシー
     設定をおこなうパラメータが用意されています。

 -- クラス: http.cookiejar.Cookie

     This class represents Netscape, RFC 2109(6) and RFC 2965(7)
     cookies.  It is not expected that users of ‘http.cookiejar’
     construct their own *note Cookie: 413b. instances.  Instead, if
     necessary, call ‘make_cookies()’ on a *note CookieJar: 3f53.
     instance.

参考
....

*note urllib.request: 111. モジュール

     クッキーの自動処理をおこない URL を開くモジュールです。

*note http.cookies: 75. モジュール

     HTTP cookie classes, principally useful for server-side code.  The
     ‘http.cookiejar’ and *note http.cookies: 75. modules do not depend
     on each other.

‘https://curl.se/rfc/cookie_spec.html’

     The specification of the original Netscape cookie protocol.  Though
     this is still the dominant protocol, the 'Netscape cookie protocol'
     implemented by all the major browsers (and ‘http.cookiejar’) only
     bears a passing resemblance to the one sketched out in
     ‘cookie_spec.html’.

RFC 2109(8) - HTTP State Management Mechanism

     RFC 2965(9) によって過去の遺物になりました。 ‘Set-Cookie’ の
     version=1 で使います。

RFC 2965(10) - HTTP State Management Mechanism

     Netscape プロトコルのバグを修正したものです。 ‘Set-Cookie’ のかわり
     に ‘Set-Cookie2’ を使いますが、普及してはいません。

‘https://kristol.org/cookie/errata.html’

     RFC 2965(11) に対する未完の正誤表です。

RFC 2964(12) - Use of HTTP State Management

* Menu:

* CookieJar および FileCookieJar オブジェクト::
* FileCookieJar のサブクラスと web ブラウザとの連携::
* CookiePolicy オブジェクト::
* DefaultCookiePolicy オブジェクト::
* Cookieオブジェクト: Cookieオブジェクト<2>.
* 使用例: 使用例<42>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/http/cookiejar.py

   (2) https://datatracker.ietf.org/doc/html/rfc2965.html

   (3) https://datatracker.ietf.org/doc/html/rfc2109.html

   (4) https://datatracker.ietf.org/doc/html/rfc2965.html

   (5) https://datatracker.ietf.org/doc/html/rfc2109.html

   (6) https://datatracker.ietf.org/doc/html/rfc2109.html

   (7) https://datatracker.ietf.org/doc/html/rfc2965.html

   (8) https://datatracker.ietf.org/doc/html/rfc2109.html

   (9) https://datatracker.ietf.org/doc/html/rfc2965.html

   (10) https://datatracker.ietf.org/doc/html/rfc2965.html

   (11) https://datatracker.ietf.org/doc/html/rfc2965.html

   (12) https://datatracker.ietf.org/doc/html/rfc2964.html


File: python.info,  Node: CookieJar および FileCookieJar オブジェクト,  Next: FileCookieJar のサブクラスと web ブラウザとの連携,  Up: http cookiejar --- HTTP クライアント用の Cookie 処理

5.22.19.1 CookieJar および FileCookieJar オブジェクト
.....................................................

*note CookieJar: 3f53. オブジェクトは保管されている *note Cookie: 413b.
オブジェクトをひとつずつ取り出すための、 *note イテレータ: 4c8. プロトコ
ルをサポートしています。

*note CookieJar: 3f53. は以下のようなメソッドを持っています:

 -- メソッド: CookieJar.add_cookie_header (request)

     'request' に正しい ‘Cookie’ ヘッダを追加します。

     ポリシーが許すようであれば (*note CookieJar: 3f53. の *note
     CookiePolicy: 4136. インスタンスにある属性のうち、 ‘rfc2965’ および
     ‘hide_cookie2’ がそれぞれ真と偽であるような場合)、必要に応じて
     ‘Cookie2’ ヘッダも追加されます。

     'request' オブジェクト (通常は *note urllib.request.Request: 11da.
     インスタンス) は、 *note urllib.request: 111. のドキュメントに記さ
     れているように、メソッド ‘get_full_url()’, ‘has_header()’,
     ‘get_header()’, ‘header_items()’, ‘add_unredirected_header()’ およ
     び属性 ‘host’, ‘type’, ‘unverifiable’, ‘origin_req_host’ をサポート
     している必要があります。

     バージョン 3.3 で変更: 'request' オブジェクトには ‘origin_req_host’
     属性が必要です。非推奨のメソッド ‘get_origin_req_host()’ への依存は
     解消されました。

 -- メソッド: CookieJar.extract_cookies (response, request)

     HTTP 'response' からクッキーを取り出し、ポリシーによって許可されて
     いればこれを *note CookieJar: 3f53. 内に保管します。

     *note CookieJar: 3f53. は 'response' 引数の中から許可されている
     ‘Set-Cookie’ および ‘Set-Cookie2’ ヘッダを探しだし、適切に (*note
     CookiePolicy.set_ok(): 4140. メソッドの承認におうじて) クッキーを保
     管します。

     'response' オブジェクト (通常は *note urllib.request.urlopen():
     307. あるいはそれに類似する呼び出しによって得られます) は ‘info()’
     メソッドをサポートしている必要があります。これは *note
     email.message.Message: 581. メソッドのあるオブジェクトを返すもので
     す。

     'request' オブジェクト (通常は *note urllib.request.Request: 11da.
     インスタンス) は *note urllib.request: 111. のドキュメントに記され
     ているように、メソッド ‘get_full_url()’, および属性 ‘host’,
     ‘unverifiable’, ‘origin_req_host’ をサポートしている必要があります
     。この request はそのクッキーの保存が許可されているかを検査するとと
     もに、クッキー属性のデフォルト値を設定するのに使われます。

     バージョン 3.3 で変更: 'request' オブジェクトには ‘origin_req_host’
     属性が必要です。非推奨のメソッド ‘get_origin_req_host()’ への依存は
     解消されました。

 -- メソッド: CookieJar.set_policy (policy)

     使用する *note CookiePolicy: 4136. インスタンスを指定します。

 -- メソッド: CookieJar.make_cookies (response, request)

     'response' オブジェクトから得られた *note Cookie: 413b. オブジェク
     トからなるシーケンスを返します。

     'response' および 'request' 引数で要求されるインスタンスについては
     、 *note extract_cookies(): 413f. の説明を参照してください。

 -- メソッド: CookieJar.set_cookie_if_ok (cookie, request)

     ポリシーが許すのであれば、与えられた *note Cookie: 413b. を設定しま
     す。

 -- メソッド: CookieJar.set_cookie (cookie)

     与えられた *note Cookie: 413b. を、それが設定されるべきかどうかのポ
     リシーのチェックを行わずに設定します。

 -- メソッド: CookieJar.clear ([domain[, path[, name]]])

     いくつかのクッキーを消去します。

     引数なしで呼ばれた場合は、すべてのクッキーを消去します。引数がひと
     つ与えられた場合、その 'domain' に属するクッキーのみを消去します。
     ふたつの引数が与えられた場合、指定された 'domain' と URL 'path' に
     属するクッキーのみを消去します。引数が 3つ与えられた場合、'domain',
     'path' および 'name' で指定されるクッキーが消去されます。

     与えられた条件に一致するクッキーがない場合は *note KeyError: 5e7. を
     発生させます。

 -- メソッド: CookieJar.clear_session_cookies ()

     すべてのセッションクッキーを消去します。

     保存されているクッキーのうち、 ‘discard’ 属性が真になっているものす
     べてを消去します (通常これは ‘max-age’ または ‘expires’ のどちらの
     クッキー属性もないか、あるいは明示的に ‘discard’ クッキー属性が指定
     されているものです)。対話的なブラウザの場合、セッションの終了はふつ
     うブラウザのウィンドウを閉じることに相当します。

     注意: 'ignore_discard' 引数に真を指定しないかぎり、 ‘save()’ メソッ
     ドはセッションクッキーは保存しません。

さらに *note FileCookieJar: 4135. は以下のようなメソッドを実装しています
:

 -- メソッド: FileCookieJar.save (filename=None, ignore_discard=False,
          ignore_expires=False)

     クッキーをファイルに保存します。

     この基底クラスは *note NotImplementedError: 36b. を発生させます。サ
     ブクラスはこのメソッドを実装しないままにしておいてもかまいません。

     'filename' はクッキーを保存するファイルの名前です。 'filename' が指
     定されない場合、 ‘self.filename’ が使用されます (このデフォルト値は
     、それが存在する場合は、コンストラクタに渡されています)。
     ‘self.filename’ も *note None: 885. の場合は *note ValueError: 2ec.
     が発生します。

     'ignore_discard' : 破棄されるよう指示されていたクッキーでも保存しま
     す。'ignore_expires' : 期限の切れたクッキーでも保存します。

     ここで指定されたファイルがもしすでに存在する場合は上書きされるため
     、以前にあったクッキーはすべて消去されます。保存したクッキーはあと
     で *note load(): 4137. または *note revert(): 4138. メソッドを使っ
     て復元することができます。

 -- メソッド: FileCookieJar.load (filename=None, ignore_discard=False,
          ignore_expires=False)

     ファイルからクッキーを読み込みます。

     それまでのクッキーは新しいものに上書きされない限り残ります。

     ここでの引数の値は *note save(): 4147. と同じです。

     名前のついたファイルはこのクラスがわかるやり方で指定する必要があり
     ます。さもないと *note LoadError: 4134. が発生します。さらに、例え
     ばファイルが存在しないような時に *note OSError: 2c0. が発生する場合
     があります。

     バージョン 3.3 で変更: 以前は *note IOError: 125e. が送出されました
     ; それは現在 *note OSError: 2c0. のエイリアスです。

 -- メソッド: FileCookieJar.revert (filename=None, ignore_discard=False,
          ignore_expires=False)

     すべてのクッキーを破棄し、保存されているファイルから読み込み直しま
     す。

     *note revert(): 4138. は *note load(): 4137. と同じ例外を発生させる
     事ができます。失敗した場合、オブジェクトの状態は変更されません。

*note FileCookieJar: 4135. インスタンスは以下のような公開の属性をもって
います:

 -- の属性: FileCookieJar.filename

     クッキーを保存するデフォルトのファイル名を指定します。この属性には
     代入することができます。

 -- の属性: FileCookieJar.delayload

     真であれば、クッキーを読み込むさいにディスクから遅延読み込みします
     。この属性には代入することができません。この情報は単なるヒントであ
     り、 (ディスク上のクッキーが変わらない限りは) インスタンスのふるま
     いには影響を与えず、パフォーマンスのみに影響します。 *note
     CookieJar: 3f53. オブジェクトはこの値を無視することもあります。標準
     ライブラリに含まれている *note FileCookieJar: 4135. クラスで遅延読
     み込みをおこなうものはありません。


File: python.info,  Node: FileCookieJar のサブクラスと web ブラウザとの連携,  Next: CookiePolicy オブジェクト,  Prev: CookieJar および FileCookieJar オブジェクト,  Up: http cookiejar --- HTTP クライアント用の Cookie 処理

5.22.19.2 FileCookieJar のサブクラスと web ブラウザとの連携
...........................................................

クッキーの読み書きのために、以下の *note CookieJar: 3f53. サブクラスが提
供されています。

 -- クラス: http.cookiejar.MozillaCookieJar (filename=None,
          delayload=None, policy=None)

     Mozilla の ‘cookies.txt’ ファイル形式 (この形式はまた curl や Lynx
     と Netscape ブラウザによっても使われています) でディスクにクッキー
     を読み書きするための *note FileCookieJar: 4135. です。

          注釈: このクラスは RFC 2965(1) クッキーに関する情報を失います
          。また、より新しいか、標準でない ‘port’ などのクッキー属性につ
          いての情報も失います。

          警告: もしクッキーの損失や欠損が望ましくない場合は、クッキーを
          保存する前にバックアップを取っておくようにしてください (ファイ
          ルへの読み込み / 保存をくり返すと微妙な変化が生じる場合があり
          ます)。

     また、Mozilla の起動中にクッキーを保存すると、Mozilla によって内容
     が破壊されてしまうことにも注意してください。

 -- クラス: http.cookiejar.LWPCookieJar (filename=None, delayload=None,
          policy=None)

     libwww-perl のライブラリである ‘Set-Cookie3’ ファイル形式でディスク
     にクッキーを読み書きするための *note FileCookieJar: 4135. です。こ
     れはクッキーを人間に可読な形式で保存するのに向いています。

     バージョン 3.8 で変更: 'filename' 引数が *note path-like object:
     5a1. を受け付けるようになりました。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2965.html


File: python.info,  Node: CookiePolicy オブジェクト,  Next: DefaultCookiePolicy オブジェクト,  Prev: FileCookieJar のサブクラスと web ブラウザとの連携,  Up: http cookiejar --- HTTP クライアント用の Cookie 処理

5.22.19.3 CookiePolicy オブジェクト
...................................

*note CookiePolicy: 4136. インターフェイスを実装するオブジェクトは以下の
ようなメソッドを持っています:

 -- メソッド: CookiePolicy.set_ok (cookie, request)

     クッキーがサーバから受け入れられるべきかどうかを表わす boolean 値を
     返します。

     'cookie' は *note Cookie: 413b. インスタンスです。 'request' は
     *note CookieJar.extract_cookies(): 413f. の説明で定義されているイン
     ターフェイスを実装するオブジェクトです。

 -- メソッド: CookiePolicy.return_ok (cookie, request)

     クッキーがサーバに返されるべきかどうかを表わす boolean 値を返します
     。

     'cookie' は *note Cookie: 413b. インスタンスです。 'request' は
     *note CookieJar.add_cookie_header(): 413e. の説明で定義されているイ
     ンターフェイスを実装するオブジェクトです。

 -- メソッド: CookiePolicy.domain_return_ok (domain, request)

     与えられたクッキーのドメインに対して、そこにクッキーを返すべきでな
     い場合には ‘False’ を返します。

     このメソッドは高速化のためのものです。これにより、すべてのクッキー
     をある特定のドメインに対してチェックする (これには多数のファイル読
     みこみを伴なう場合があります) 必要がなくなります。 *note
     domain_return_ok(): 4150. および *note path_return_ok(): 4151. の両
     方から true が返された場合、すべての決定は *note return_ok(): 414f.
     に委ねられます。

     もし、このクッキードメインに対して *note domain_return_ok(): 4150.
     が true を返すと、つぎにそのクッキーのパス名に対して *note
     path_return_ok(): 4151. が呼ばれます。そうでない場合、そのクッキー
     ドメインに対する *note path_return_ok(): 4151. および *note
     return_ok(): 414f. は決して呼ばれることはありません。 *note
     path_return_ok(): 4151. が true を返すと、 *note return_ok(): 414f.
     がその *note Cookie: 413b. オブジェクト自身の全チェックのために呼ば
     れます。そうでない場合、そのクッキーパス名に対する *note
     return_ok(): 414f. は決して呼ばれることはありません。

     注意: *note domain_return_ok(): 4150. は 'request' ドメインだけでは
     なく、すべての 'cookie' ドメインに対して呼ばれます。たとえば
     request ドメインが ‘"www.example.com"’ だった場合、この関数は
     ‘".example.com"’ および ‘"www.example.com"’ の両方に対して呼ばれる
     ことがあります。同じことは *note path_return_ok(): 4151. にもいえま
     す。

     'request' 引数は *note return_ok(): 414f. で説明されているとおりで
     す。

 -- メソッド: CookiePolicy.path_return_ok (path, request)

     与えられたクッキーのパス名に対して、そこにクッキーを返すべきでない
     場合には ‘False’ を返します。

     *note domain_return_ok(): 4150. の説明を参照してください。

上のメソッドの実装にくわえて、 *note CookiePolicy: 4136. インターフェイ
スの実装では以下の属性を設定する必要があります。これはどのプロトコルがど
のように使われるべきかを示すもので、これらの属性にはすべて代入することが
許されています。

 -- の属性: CookiePolicy.netscape

     Netscape プロトコルを実装していることを示します。

 -- の属性: CookiePolicy.rfc2965

     RFC 2965(1) プロトコルを実装していることを示します。

 -- の属性: CookiePolicy.hide_cookie2

     ‘Cookie2’ ヘッダをリクエストに含めないようにします (このヘッダが存
     在する場合、私たちは RFC 2965(2) クッキーを理解するということをサー
     バに示すことになります)。

もっとも有用な方法は、 *note DefaultCookiePolicy: 1df4. をサブクラス化し
た *note CookiePolicy: 4136. クラスを定義して、いくつか (あるいはすべて)
のメソッドをオーバーライドすることでしょう。 *note CookiePolicy: 4136. 自
体はどのようなクッキーも受け入れて設定を許可する「ポリシー無し」ポリシー
として使うこともできます (これが役に立つことはあまりありませんが)。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2965.html

   (2) https://datatracker.ietf.org/doc/html/rfc2965.html


File: python.info,  Node: DefaultCookiePolicy オブジェクト,  Next: Cookieオブジェクト<2>,  Prev: CookiePolicy オブジェクト,  Up: http cookiejar --- HTTP クライアント用の Cookie 処理

5.22.19.4 DefaultCookiePolicy オブジェクト
..........................................

クッキーを受けつけ、またそれを返す際の標準的なルールを実装します。

RFC 2965(1) クッキーと Netscape クッキーの両方に対応しています。デフォル
トでは、RFC 2965 の処理はオフになっています。

自分のポリシーを提供するいちばん簡単な方法は、このクラスを継承して、自分
用の追加チェックの前にオーバーライドした元のメソッドを呼び出すことです:

     import http.cookiejar
     class MyCookiePolicy(http.cookiejar.DefaultCookiePolicy):
         def set_ok(self, cookie, request):
             if not http.cookiejar.DefaultCookiePolicy.set_ok(self, cookie, request):
                 return False
             if i_dont_want_to_store_this_cookie(cookie):
                 return False
             return True

*note CookiePolicy: 4136. インターフェイスを実装するのに必要な機能に加え
て、このクラスではクッキーを受けとったり設定したりするドメインを許可した
り拒絶したりできるようになっています。ほかにも、 Netscape プロトコルのか
なり緩い規則をややきつくするために、いくつかの厳密性のスイッチがついてい
ます (いくつかの良性クッキーをブロックする危険性もありますが)。

ドメインの拒否リストや許可リストも提供されています (デフォルトではどちら
もオフです)。拒否リストになく、(許可リストがアクティブなら) 許可リストに
あるドメインのみがクッキーを設定したり返したりできます。コンストラクタの
引数 'blocked_domains' 、および ‘blocked_domains()’ と
‘set_blocked_domains()’ メソッド ( そして 'allowed_domains' に対応する引
数とメソッド) を使ってください。許可リストを設定した場合は、それを *note
None: 885. にすることでオフに戻せます。

拒否あるいは許可リスト中にあるドメインのうち、ドット (.)  で始まっていな
いものは、正確にそれと一致するドメインのクッキーにしか適用されません。た
とえば拒否リスト中のエントリ ‘"example.com"’ は、‘"example.com"’ にはマ
ッチしますが、‘"www.example.com"’ にはマッチしません。一方ドット (.)  で
始まっているドメインは、より特化されたドメインともマッチします。たとえば
、‘".example.com"’ は、‘"www.example.com"’ と ‘"www.coyote.example.com"’
の両方にマッチします (が、‘"example.com"’ 自身にはマッチしません)。IP ア
ドレスは例外で、つねに正確に一致する必要があります。たとえば、
'blocked_domains' が ‘"192.168.1.2"’ と ‘".168.1.2"’ を含んでいるとする
と、192.168.1.2 はブロックされますが、193.168.1.2 はブロックされません。

*note DefaultCookiePolicy: 1df4. は以下のような追加メソッドを実装してい
ます:

 -- メソッド: DefaultCookiePolicy.blocked_domains ()

     ブロックしているドメインのシーケンスを (タプルとして) 返します。

 -- メソッド: DefaultCookiePolicy.set_blocked_domains (blocked_domains)

     ブロックするドメインを設定します。

 -- メソッド: DefaultCookiePolicy.is_blocked (domain)

     'domain' がクッキーを授受しない拒否リストに載っていれば ‘True’ を返
     します。

 -- メソッド: DefaultCookiePolicy.allowed_domains ()

     *note None: 885. あるいは明示的に許可されているドメインを (タプルと
     して) 返します。

 -- メソッド: DefaultCookiePolicy.set_allowed_domains (allowed_domains)

     許可するドメイン、あるいは *note None: 885. を設定します。

 -- メソッド: DefaultCookiePolicy.is_not_allowed (domain)

     'domain' がクッキーを授受する許可リストに載っていれば ‘True’ を返し
     ます。

*note DefaultCookiePolicy: 1df4. インスタンスは以下の属性をもっています
。これらはすべてコンストラクタから同じ名前の引数をつかって初期化すること
ができ、代入してもかまいません。

 -- の属性: DefaultCookiePolicy.rfc2109_as_netscape

     真の場合、 *note CookieJar: 3f53. のインスタンスに RFC 2109(2) クッ
     キー (即ち ‘Set-Cookie’ ヘッダのクッキー属性 Version の値が 1 のク
     ッキー) を Netscapeクッキーへ、 *note Cookie: 413b. インスタンスの
     version 属性を 0 に設定する事でダウングレードするように要求します。
     デフォルトの値は *note None: 885. であり、この場合 RFC 2109 クッキ
     ーは RFC 2965(3) 処理が無効に設定されている場合に限りダウングレード
     されます。それ故に RFC 2109 クッキーはデフォルトではダウングレード
     されます。

一般的な厳密性のスイッチ:

 -- の属性: DefaultCookiePolicy.strict_domain

     サイトに、国別コードとトップレベルドメインだけからなるドメイン名
     (‘.co.uk’, ‘.gov.uk’, ‘.co.nz’ など) を設定させないようにします。こ
     れは完璧からはほど遠い実装であり、いつもうまくいくとは限りません!

RFC 2965(4) プロトコルの厳密性に関するスイッチ:

 -- の属性: DefaultCookiePolicy.strict_rfc2965_unverifiable

     検証不可能なトランザクション (通常これはリダイレクトか、別のサイト
     がホスティングしているイメージの読み込み要求です) に関する RFC
     2965(5) の規則に従います。この値が偽の場合、検証可能性を基準にして
     クッキーがブロックされることは '決して' ありません

Netscape プロトコルの厳密性に関するスイッチ:

 -- の属性: DefaultCookiePolicy.strict_ns_unverifiable

     検証不可能なトランザクションに関する RFC 2965(6) の規則を Netscape
     クッキーに対しても適用します。

 -- の属性: DefaultCookiePolicy.strict_ns_domain

     Netscape クッキーに対するドメインマッチングの規則をどの程度厳しくす
     るかを指示するフラグです。とりうる値については下の説明を見てくださ
     い。

 -- の属性: DefaultCookiePolicy.strict_ns_set_initial_dollar

     Set-Cookie: ヘッダで、‘'$'’ で始まる名前のクッキーを無視します。

 -- の属性: DefaultCookiePolicy.strict_ns_set_path

     要求した URI にパスがマッチしないクッキーの設定を禁止します。

*note strict_ns_domain: 4160. is a collection of flags.  Its value is
constructed by or-ing together (for example,
‘DomainStrictNoDots|DomainStrictNonDomain’ means both flags are set).

 -- の属性: DefaultCookiePolicy.DomainStrictNoDots

     クッキーを設定するさい、ホスト名のプレフィクスにドットが含まれるの
     を禁止します (例: ‘www.foo.bar.com’ は ‘.bar.com’ のクッキーを設定
     することはできません、なぜなら ‘www.foo’ はドットを含んでいるからで
     す)。

 -- の属性: DefaultCookiePolicy.DomainStrictNonDomain

     ‘domain’ クッキー属性を明示的に指定していないクッキーは、そのクッキ
     ーを設定したドメインと同一のドメインだけに返されます (例:
     ‘example.com’ からのクッキーに ‘domain’ クッキー属性がない場合、そ
     のクッキーが ‘spam.example.com’ に返されることはありません)。

 -- の属性: DefaultCookiePolicy.DomainRFC2965Match

     クッキーを設定するさい、 RFC 2965(7) の完全ドメインマッチングを要求
     します。

以下の属性は上記のフラグのうちもっともよく使われる組み合わせで、便宜をは
かるために提供されています:

 -- の属性: DefaultCookiePolicy.DomainLiberal

     0 と同じです (つまり、上述の Netscape のドメイン厳密性フラグがすべ
     てオフにされます)。

 -- の属性: DefaultCookiePolicy.DomainStrict

     ‘DomainStrictNoDots|DomainStrictNonDomain’ と同じです。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2965.html

   (2) https://datatracker.ietf.org/doc/html/rfc2109.html

   (3) https://datatracker.ietf.org/doc/html/rfc2965.html

   (4) https://datatracker.ietf.org/doc/html/rfc2965.html

   (5) https://datatracker.ietf.org/doc/html/rfc2965.html

   (6) https://datatracker.ietf.org/doc/html/rfc2965.html

   (7) https://datatracker.ietf.org/doc/html/rfc2965.html


File: python.info,  Node: Cookieオブジェクト<2>,  Next: 使用例<42>,  Prev: DefaultCookiePolicy オブジェクト,  Up: http cookiejar --- HTTP クライアント用の Cookie 処理

5.22.19.5 Cookieオブジェクト
............................

*note Cookie: 413b. instances have Python attributes roughly
corresponding to the standard cookie-attributes specified in the various
cookie standards.  The correspondence is not one-to-one, because there
are complicated rules for assigning default values, because the
‘max-age’ and ‘expires’ cookie-attributes contain equivalent
information, and because RFC 2109(1) cookies may be 'downgraded' by
‘http.cookiejar’ from version 1 to version 0 (Netscape) cookies.

*note CookiePolicy: 4136. メソッド内でのごくわずかな例外を除けば、これら
の属性に代入する必要はないはずです。このクラスは内部の一貫性を保つように
はしていないため、代入するのは自分のやっていることを理解している場合のみ
にしてください。

 -- の属性: Cookie.version

     Integer or *note None: 885.  Netscape cookies have *note version:
     4169. 0.  RFC 2965(2) and RFC 2109(3) cookies have a ‘version’
     cookie-attribute of 1.  However, note that ‘http.cookiejar’ may
     'downgrade' RFC 2109 cookies to Netscape cookies, in which case
     *note version: 4169. is 0.

 -- の属性: Cookie.name

     クッキーの名前 (文字列)。

 -- の属性: Cookie.value

     クッキーの値 (文字列)、あるいは *note None: 885. 。

 -- の属性: Cookie.port

     ポートあるいはポートの集合をあらわす文字列 (例: '80' または
     '80,8080')、あるいは *note None: 885. 。

 -- の属性: Cookie.domain

     クッキーのドメイン (文字列) 。

 -- の属性: Cookie.path

     クッキーのパス名 (文字列、例: ‘'/acme/rocket_launchers'’)。

 -- の属性: Cookie.secure

     そのクッキーを返せるのがセキュアな接続のみならば ‘True’ を返します
     。

 -- の属性: Cookie.expires

     クッキーの期限が切れる日時をあわらす整数 (エポックから経過した秒数
     )、あるいは *note None: 885. 。 *note is_expired(): 4171. も参照し
     てください。

 -- の属性: Cookie.discard

     これがセッションクッキーであれば ‘True’ を返します。

 -- の属性: Cookie.comment

     このクッキーの働きを説明する、サーバからのコメント文字列、あるいは
     *note None: 885. 。

 -- の属性: Cookie.comment_url

     このクッキーの働きを説明する、サーバからのコメントのリンク URL、あ
     るいは *note None: 885. 。

 -- の属性: Cookie.rfc2109

     ‘True’ if this cookie was received as an RFC 2109(4) cookie (ie.
     the cookie arrived in a ‘Set-Cookie’ header, and the value of the
     Version cookie-attribute in that header was 1).  This attribute is
     provided because ‘http.cookiejar’ may 'downgrade' RFC 2109 cookies
     to Netscape cookies, in which case *note version: 4169. is 0.

 -- の属性: Cookie.port_specified

     サーバがポート、あるいはポートの集合を (‘Set-Cookie’ /
     ‘Set-Cookie2’ ヘッダ内で) 明示的に指定していれば ‘True’ を返します
     。

 -- の属性: Cookie.domain_specified

     サーバにより明示的にドメインが指定されていれば ‘True’ を返します。

 -- の属性: Cookie.domain_initial_dot

     サーバが明示的に指定したドメインがドット (‘'.'’) で始まっていれば
     ‘True’ を返します。

クッキーは、オプションとして標準的でないクッキー属性を持つこともできます
。これらは以下のメソッドでアクセスできます:

 -- メソッド: Cookie.has_nonstandard_attr (name)

     そのクッキーが指定された名前のクッキー属性をもっている場合には
     ‘True’ を返します。

 -- メソッド: Cookie.get_nonstandard_attr (name, default=None)

     クッキーが指定された名前のクッキー属性をもっていれば、その値を返し
     ます。そうでない場合は 'default' を返します。

 -- メソッド: Cookie.set_nonstandard_attr (name, value)

     指定された名前のクッキー属性を設定します。

*note Cookie: 413b. クラスは以下のメソッドも定義しています:

 -- メソッド: Cookie.is_expired (now=None)

     サーバが要求するクッキーの有効期限を過ぎていれば ‘True’ を返します
     。 'now' が (エポックからの経過秒で) 指定されているときは、特定の時
     刻で期限切れかどうかを判定します。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2109.html

   (2) https://datatracker.ietf.org/doc/html/rfc2965.html

   (3) https://datatracker.ietf.org/doc/html/rfc2109.html

   (4) https://datatracker.ietf.org/doc/html/rfc2109.html


File: python.info,  Node: 使用例<42>,  Prev: Cookieオブジェクト<2>,  Up: http cookiejar --- HTTP クライアント用の Cookie 処理

5.22.19.6 使用例
................

The first example shows the most common usage of ‘http.cookiejar’:

     import http.cookiejar, urllib.request
     cj = http.cookiejar.CookieJar()
     opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
     r = opener.open("http://example.com/")

以下の例では、URL を開く際に Netscape や Mozilla または Lynx のクッキー
を使う方法を示しています (クッキーファイルの位置は Unix/Netscape の慣例
にしたがうものと仮定しています):

     import os, http.cookiejar, urllib.request
     cj = http.cookiejar.MozillaCookieJar()
     cj.load(os.path.join(os.path.expanduser("~"), ".netscape", "cookies.txt"))
     opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
     r = opener.open("http://example.com/")

つぎの例は *note DefaultCookiePolicy: 1df4. の使用例です。 RFC 2965(1) ク
ッキーをオンにし、Netscape クッキーを設定したり返したりするドメインに対
してより厳密な規則を適用します。そしていくつかのドメインからクッキーを設
定あるいは返還するのをブロックしています:

     import urllib.request
     from http.cookiejar import CookieJar, DefaultCookiePolicy
     policy = DefaultCookiePolicy(
         rfc2965=True, strict_ns_domain=Policy.DomainStrict,
         blocked_domains=["ads.net", ".ads.net"])
     cj = CookieJar(policy)
     opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
     r = opener.open("http://example.com/")

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2965.html


File: python.info,  Node: xmlrpc --- XMLRPC サーバーとクライアントモジュール群,  Next: xmlrpc client --- XML-RPC クライアントアクセス,  Prev: http cookiejar --- HTTP クライアント用の Cookie 処理,  Up: インターネットプロトコルとサポート

5.22.20 ‘xmlrpc’ -- XMLRPC サーバーとクライアントモジュール群
-------------------------------------------------------------

XML-RPC は HTTP 経由の XML を使って遠隔手続き呼び出し (Remote Procedure
Call) を実現する方法です。XML-RPC を使うと、クライアントはリモートサーバ
ー (サーバーは URI で名前付けられます) 上のメソッドを引数付きで呼び出し
て、構造化されたデータを受け取る事ができます。

‘xmlrpc’ パッケージは XML-RPC のサーバーとクライアントを実装したモジュー
ルを持っています。モジュール一覧:

   * *note xmlrpc.client: 134.

   * *note xmlrpc.server: 135.


File: python.info,  Node: xmlrpc client --- XML-RPC クライアントアクセス,  Next: xmlrpc server --- 基本的な XML-RPC サーバー,  Prev: xmlrpc --- XMLRPC サーバーとクライアントモジュール群,  Up: インターネットプロトコルとサポート

5.22.21 ‘xmlrpc.client’ -- XML-RPC クライアントアクセス
-------------------------------------------------------

'ソースコード:' Lib/xmlrpc/client.py(1)

__________________________________________________________________

XML-RPCはXMLを利用した遠隔手続き呼び出し(Remote Procedure Call)の一種で
、HTTP(S)をトランスポートとして使用します。XML- RPCでは、クライアントは
リモートサーバ(URIで指定されたサーバ)上のメソッドをパラメータを指定して
呼び出し、構造化されたデータを取得します。このモジュールは、XML-RPCクラ
イアントの開発をサポートしており、Pythonオブジェクトに適合する転送用
XMLの変換の全てを行います。

     警告: The ‘xmlrpc.client’ module is not secure against maliciously
     constructed data.  If you need to parse untrusted or
     unauthenticated data, see *note XML security: 3ce9.

バージョン 3.5 で変更: For HTTPS URIs, ‘xmlrpc.client’ now performs all
the necessary certificate and hostname checks by default.

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

 -- クラス: xmlrpc.client.ServerProxy (uri, transport=None,
          encoding=None, verbose=False, allow_none=False,
          use_datetime=False, use_builtin_types=False, *, headers=(),
          context=None)

     *note ServerProxy: c4c. は、リモートのXML-RPCサーバとの通信を管理す
     るオブジェクトです。最初のパラメータはURI(Uniform Resource
     Indicator)で、通常はサーバのURLを指定します。2番目のパラメータには
     トランスポート・ファクトリを指定する事ができます。トランスポート・
     ファクトリを省略した場合、URLが https: ならモジュール内部の
     ‘SafeTransport’ インスタンスを使用し、それ以外の場合にはモジュール
     内部の ‘Transport’ インスタンスを使用します。オプションの 3 番目の
     引数はエンコード方法で、デフォルトでは UTF-8 です。オプションの 4 番
     目の引数はデバッグフラグです。

     The following parameters govern the use of the returned proxy
     instance.  If 'allow_none' is true, the Python constant ‘None’ will
     be translated into XML; the default behaviour is for ‘None’ to
     raise a *note TypeError: 198.  This is a commonly used extension to
     the XML-RPC specification, but isn't supported by all clients and
     servers; see http://ontosys.com/xml-rpc/extensions.php(2) for a
     description.  The 'use_builtin_types' flag can be used to cause
     date/time values to be presented as *note datetime.datetime: 4e2.
     objects and binary data to be presented as *note bytes: 192.
     objects; this flag is false by default.  *note datetime.datetime:
     4e2, *note bytes: 192. and *note bytearray: 344. objects may be
     passed to calls.  The 'headers' parameter is an optional sequence
     of HTTP headers to send with each request, expressed as a sequence
     of 2-tuples representing the header name and value.  (e.g.
     ‘[('Header-Name', 'value')]’).  If an HTTPS URL is provided,
     'context' may be *note ssl.SSLContext: 357. and configures the SSL
     settings of the underlying HTTPS connection.  The obsolete
     'use_datetime' flag is similar to 'use_builtin_types' but it
     applies only to date/time values.

     バージョン 3.3 で変更: 'use_builtin_types' フラグが追加されました。

     バージョン 3.8 で変更: 'headers' 引数が追加されました。

     HTTP及びHTTPS通信の両方で、 ‘http://user:pass@host:port/path’ のよ
     うなHTTP基本認証のための拡張URL構文をサポートしています。
     ‘user:pass’ はbase64でエンコードしてHTTPの'Authorization 'ヘッダと
     なり、XML-RPCメソッド呼び出し時に接続処理の一部としてリモートサーバ
     に送信されます。リモートサーバが基本認証を要求する場合のみ、この機
     能を利用する必要があります。

     生成されるインスタンスはリモートサーバへのプロクシオブジェクトで、
     RPC呼び出しを行う為のメソッドを持ちます。リモートサーバがイントロス
     ペクション APIをサポートしている場合は、リモートサーバのサポートす
     るメソッドを検索 (サービス検索)やサーバのメタデータの取得なども行え
     ます。

     以下の型をXMLに変換(XMLを通じてマーシャルする)する事ができます (特
     別な指定がない限り、逆変換でも同じ型として変換されます):

     XML-RPC の型               Python の型
                                
     ---------------------------------------------------------------------------------------
                                
     ‘boolean’                  *note bool: 3c3.
                                
                                
     ‘int’, ‘i1’, ‘i2’, ‘i4’,   *note int: 19b. in range from -2147483648 to 2147483647.
     ‘i8’ または ‘biginteger’   Values get the ‘<int>’ tag.
                                
                                
     ‘double’ または ‘float’    *note float: 196.  Values get the ‘<double>’ tag.
                                
                                
     ‘string’                   *note str: 169.
                                
                                
     ‘array’                    適合する要素を持つ *note list: 24d. または
                                *note tuple: 614.。array は *note list: 24d. として返しま
                                す。
                                
                                
     ‘struct’                   *note dict: 183. 。キーは文字列のみ。全ての値は変換可能で
                                なくてはならない。ユーザー定義型を渡すこともできます。
                                *note __dict__: 77d. の属性のみ転送されます。
                                
                                
     ‘dateTime.iso8601’         *note DateTime: 15fc. または
                                *note datetime.datetime: 4e2.。返される型は
                                'use_builtin_types' および 'use_datetime' の値に依ります
                                。
                                
                                
     ‘base64’                   *note Binary: 4183.、 *note bytes: 192. または
                                *note bytearray: 344.。返される型は 'use_builtin_types' フ
                                ラグの値に依ります。
                                
                                
     ‘nil’                      ‘None’ 定数。 'allow_none' が真の場合にのみ渡すことが出来
                                ます。
                                
                                
     ‘bigdecimal’               *note decimal.Decimal: 1fe.  Returned type only.
                                

     上記のXML-RPCでサポートする全データ型を使用することができます。メソ
     ッド呼び出し時、XML- RPCサーバエラーが発生すると *note Fault: 4184.
     インスタンスを送出し、HTTP/HTTPSトランスポート層でエラーが発生した
     場合には *note ProtocolError: 4185. を送出します。 ‘Error’ をベース
     とする *note Fault: 4184. と *note ProtocolError: 4185. の両方が発
     生します。現在のところxmlrpclibでは組み込み型のサブクラスのインスタ
     ンスをマーシャルすることはできません。

     文字列を渡す場合、 ‘<’, ‘>’, ‘&’ などのXMLで特殊な意味を持つ文字は
     自動的にエスケープされます。しかし、ASCII値0〜31の制御文字(もちろん
     、タブ'TAB',改行'LF',リターン'CR'は除く)などのXMLで使用することので
     きない文字を使用することはできず、使用するとそのXML-RPCリクエストは
     well-formedなXMLとはなりません。そのようなバイト列を渡す必要がある
     場合は、 *note bytes: 192, *note bytearray: 344. クラスまたは後述の
     *note Binary: 4183. ラッパークラスを使用してください。

     ‘Server’ は、後方互換性の為に *note ServerProxy: c4c. の別名として
     残されています。新しいコードでは *note ServerProxy: c4c. を使用して
     ください。

     バージョン 3.5 で変更: 'context' 引数が追加されました。

     バージョン 3.6 で変更: Added support of type tags with prefixes
     (e.g.  ‘ex:nil’).  Added support of unmarshalling additional types
     used by Apache XML-RPC implementation for numerics: ‘i1’, ‘i2’,
     ‘i8’, ‘biginteger’, ‘float’ and ‘bigdecimal’.  See
     ‘https://ws.apache.org/xmlrpc/types.html’ for a description.

参考
....

XML-RPC HOWTO(3)

     数種類のプログラミング言語で記述された XML-RPCの操作とクライアント
     ソフトウェアの素晴らしい説明が掲載されています。 XML- RPCクライアン
     トの開発者が知っておくべきことがほとんど全て記載されています。

XML-RPC Introspection(4)

     インストロペクションをサポートする、 XML-RPC プロトコルの拡張を解説
     しています。

XML-RPC Specification(5)

     公式の仕様

* Menu:

* ServerProxy オブジェクト::
* DateTime オブジェクト::
* Binary オブジェクト::
* Fault オブジェクト::
* ProtocolError オブジェクト::
* MultiCall オブジェクト::
* 補助関数::
* クライアントのサンプル::
* クライアントとサーバーの利用例::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/xmlrpc/client.py

   (2) 
https://web.archive.org/web/20130120074804/http://ontosys.com/xml-rpc/extensions.php

   (3) https://tldp.org/HOWTO/XML-RPC-HOWTO/index.html

   (4) https://xmlrpc-c.sourceforge.io/introspection.html

   (5) http://xmlrpc.scripting.com/spec.html


File: python.info,  Node: ServerProxy オブジェクト,  Next: DateTime オブジェクト,  Up: xmlrpc client --- XML-RPC クライアントアクセス

5.22.21.1 ServerProxy オブジェクト
..................................

*note ServerProxy: c4c. インスタンスの各メソッドはそれぞれXML-RPCサーバ
の遠隔手続き呼び出しに対応しており、メソッドが呼び出されると名前と引数を
シグネチャとしてRPCを実行します(同じ名前のメソッドでも、異なる引数シグネ
チャによってオーバロードされます)。RPC実行後、変換された値を返すか、また
は *note Fault: 4184. オブジェクトもしくは *note ProtocolError: 4185. オ
ブジェクトでエラーを通知します。

予約属性 ‘system’ から、XMLイントロスペクションAPIの一般的なメソッドを利
用する事ができます:

 -- メソッド: ServerProxy.system.listMethods ()

     XML-RPCサーバがサポートするメソッド名(system以外)を格納する文字列の
     リストを返します。

 -- メソッド: ServerProxy.system.methodSignature (name)

     XML-RPCサーバで実装されているメソッドの名前を指定し、利用可能なシグ
     ネチャの配列を取得します。シグネチャは型のリストで、先頭の型は戻り
     値の型を示し、以降はパラメータの型を示します。

     XML-RPCでは複数のシグネチャ(オーバロード)を使用することができるので
     、単独のシグネチャではなく、シグネチャのリストを返します。

     シグネチャは、メソッドが使用する最上位のパラメータにのみ適用されま
     す。例えばあるメソッドのパラメータが構造体の配列で戻り値が文字列の
     場合、シグネチャは単に"string, array" となります。パラメータが三つ
     の整数で戻り値が文字列の場合は"string, int, int, int"となります。

     メソッドにシグネチャが定義されていない場合、配列以外の値が返ります
     。 Pythonでは、この値はlist以外の値となります。

 -- メソッド: ServerProxy.system.methodHelp (name)

     XML-RPCサーバで実装されているメソッドの名前を指定し、そのメソッドを
     解説する文書文字列を取得します。文書文字列を取得できない場合は空文
     字列を返します。文書文字列にはHTMLマークアップが含まれます。

バージョン 3.5 で変更: Instances of *note ServerProxy: c4c. support the
*note context manager: 1e1. protocol for closing the underlying
transport.

以下は、動作する例です。サーバ側のコード:

     from xmlrpc.server import SimpleXMLRPCServer

     def is_even(n):
         return n % 2 == 0

     server = SimpleXMLRPCServer(("localhost", 8000))
     print("Listening on port 8000...")
     server.register_function(is_even, "is_even")
     server.serve_forever()

上記のサーバーに対するクライアントコード:

     import xmlrpc.client

     with xmlrpc.client.ServerProxy("http://localhost:8000/") as proxy:
         print("3 is even: %s" % str(proxy.is_even(3)))
         print("100 is even: %s" % str(proxy.is_even(100)))


File: python.info,  Node: DateTime オブジェクト,  Next: Binary オブジェクト,  Prev: ServerProxy オブジェクト,  Up: xmlrpc client --- XML-RPC クライアントアクセス

5.22.21.2 DateTime オブジェクト
...............................

 -- クラス: xmlrpc.client.DateTime

     このクラスは、エポックからの秒数、タプルで表現された時刻、ISO 8601形
     式の時間/日付文字列、 *note datetime.datetime: 4e2, のインスタンス
     のいずれかで初期化することができます。このクラスには以下のメソッド
     があり、主にコードをマーシャル/アンマーシャルするための内部処理を行
     います:

      -- メソッド: decode (string)

          文字列をインスタンスの新しい時間を示す値として指定します。

      -- メソッド: encode (out)

          出力ストリームオブジェクト 'out' に、XML-RPCエンコーディングの
          *note DateTime: 15fc. 値を出力します。

     It also supports certain of Python's built-in operators through
     *note rich comparison: 14b8. and *note __repr__(): 82f. methods.

以下は、動作する例です。サーバ側のコード:

     import datetime
     from xmlrpc.server import SimpleXMLRPCServer
     import xmlrpc.client

     def today():
         today = datetime.datetime.today()
         return xmlrpc.client.DateTime(today)

     server = SimpleXMLRPCServer(("localhost", 8000))
     print("Listening on port 8000...")
     server.register_function(today, "today")
     server.serve_forever()

上記のサーバーに対するクライアントコード:

     import xmlrpc.client
     import datetime

     proxy = xmlrpc.client.ServerProxy("http://localhost:8000/")

     today = proxy.today()
     # convert the ISO8601 string to a datetime object
     converted = datetime.datetime.strptime(today.value, "%Y%m%dT%H:%M:%S")
     print("Today: %s" % converted.strftime("%d.%m.%Y, %H:%M"))


File: python.info,  Node: Binary オブジェクト,  Next: Fault オブジェクト,  Prev: DateTime オブジェクト,  Up: xmlrpc client --- XML-RPC クライアントアクセス

5.22.21.3 Binary オブジェクト
.............................

 -- クラス: xmlrpc.client.Binary

     このクラスは、バイト列データ(NULを含む)で初期化することができます。
     *note Binary: 4183. の内容は、属性で参照します:

      -- の属性: data

          *note Binary: 4183. インスタンスがカプセル化しているバイナリデ
          ータ。このデータは *note bytes: 192. オブジェクトです。

     *note Binary: 4183. オブジェクトは以下のメソッドを持ち、主に内部的
     にマーシャル/アンマーシャル時に使用されます:

      -- メソッド: decode (bytes)

          指定されたbase64 *note bytes: 192. オブジェクトをデコードし、
          インスタンスのデータとします。

      -- メソッド: encode (out)

          バイナリ値をbase64でエンコードし、出力ストリームオブジェクト
          'out' に出力します。

          エンコードされたデータは、 RFC 2045 section 6.8(1) にある通り
          、76文字ごとに改行されます。これは、XMC-RPC仕様が作成された時
          のデ・ファクト・スタンダードのbase64です。

     It also supports certain of Python's built-in operators through
     *note __eq__(): cf2. and *note __ne__(): 1730. methods.

バイナリオブジェクトの使用例です。 XML-RPCごしに画像を転送します。

     from xmlrpc.server import SimpleXMLRPCServer
     import xmlrpc.client

     def python_logo():
         with open("python_logo.jpg", "rb") as handle:
             return xmlrpc.client.Binary(handle.read())

     server = SimpleXMLRPCServer(("localhost", 8000))
     print("Listening on port 8000...")
     server.register_function(python_logo, 'python_logo')

     server.serve_forever()

クライアントは画像を取得して、ファイルに保存します。

     import xmlrpc.client

     proxy = xmlrpc.client.ServerProxy("http://localhost:8000/")
     with open("fetched_python_logo.jpg", "wb") as handle:
         handle.write(proxy.python_logo().data)

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2045.html#section-6.8


File: python.info,  Node: Fault オブジェクト,  Next: ProtocolError オブジェクト,  Prev: Binary オブジェクト,  Up: xmlrpc client --- XML-RPC クライアントアクセス

5.22.21.4 Fault オブジェクト
............................

 -- クラス: xmlrpc.client.Fault

     *note Fault: 4184. オブジェクトは、XML-RPCのfaultタグの内容をカプセ
     ル化しており、以下の属性を持ちます:

      -- の属性: faultCode

          失敗のタイプを示す整数。

      -- の属性: faultString

          失敗の診断メッセージを含む文字列。

以下のサンプルでは、複素数型のオブジェクトを返そうとして、故意に *note
Fault: 4184. を起こしています。

     from xmlrpc.server import SimpleXMLRPCServer

     # A marshalling error is going to occur because we're returning a
     # complex number
     def add(x, y):
         return x+y+0j

     server = SimpleXMLRPCServer(("localhost", 8000))
     print("Listening on port 8000...")
     server.register_function(add, 'add')

     server.serve_forever()

上記のサーバーに対するクライアントコード:

     import xmlrpc.client

     proxy = xmlrpc.client.ServerProxy("http://localhost:8000/")
     try:
         proxy.add(2, 5)
     except xmlrpc.client.Fault as err:
         print("A fault occurred")
         print("Fault code: %d" % err.faultCode)
         print("Fault string: %s" % err.faultString)


File: python.info,  Node: ProtocolError オブジェクト,  Next: MultiCall オブジェクト,  Prev: Fault オブジェクト,  Up: xmlrpc client --- XML-RPC クライアントアクセス

5.22.21.5 ProtocolError オブジェクト
....................................

 -- クラス: xmlrpc.client.ProtocolError

     *note ProtocolError: 4185. オブジェクトはトランスポート層で発生した
     エラー(URI で指定したサーバが見つからなかった場合に発生する404 'not
     found'など)の内容を示し、以下の属性を持ちます:

      -- の属性: url

          エラーの原因となったURIまたはURL。

      -- の属性: errcode

          エラーコード。

      -- の属性: errmsg

          エラーメッセージまたは診断文字列。

      -- の属性: headers

          エラーの原因となったHTTP/HTTPSリクエストを含む辞書。

次の例では、不適切な URI を利用して、故意に *note ProtocolError: 4185. を
発生させています:

     import xmlrpc.client

     # create a ServerProxy with a URI that doesn't respond to XMLRPC requests
     proxy = xmlrpc.client.ServerProxy("http://google.com/")

     try:
         proxy.some_method()
     except xmlrpc.client.ProtocolError as err:
         print("A protocol error occurred")
         print("URL: %s" % err.url)
         print("HTTP/HTTPS headers: %s" % err.headers)
         print("Error code: %d" % err.errcode)
         print("Error message: %s" % err.errmsg)


File: python.info,  Node: MultiCall オブジェクト,  Next: 補助関数,  Prev: ProtocolError オブジェクト,  Up: xmlrpc client --- XML-RPC クライアントアクセス

5.22.21.6 MultiCall オブジェクト
................................

*note MultiCall: 419f. オブジェクトは遠隔のサーバに対する複数の呼び出し
をひとつのリクエストにカプセル化する方法を提供します (1)。

 -- クラス: xmlrpc.client.MultiCall (server)

     巨大な (boxcar) メソッド呼び出しに使えるオブジェクトを作成します。
     'server' には最終的に呼び出しを行う対象を指定します。作成した
     MultiCall オブジェクトを使って呼び出しを行うと、即座に ‘None’ を返
     し、呼び出したい手続き名とパラメタを *note MultiCall: 419f. オブジ
     ェクトに保存するだけに留まります。オブジェクト自体を呼び出すと、そ
     れまでに保存しておいたすべての呼び出しを単一の ‘system.multicall’ リ
     クエストの形で伝送します。呼び出し結果は *note ジェネレータ: 126c.
     になります。このジェネレータにわたってイテレーションを行うと、個々
     の呼び出し結果を返します。

以下は、このクラスの使用例です。サーバ側のコード:

     from xmlrpc.server import SimpleXMLRPCServer

     def add(x, y):
         return x + y

     def subtract(x, y):
         return x - y

     def multiply(x, y):
         return x * y

     def divide(x, y):
         return x // y

     # A simple server with simple arithmetic functions
     server = SimpleXMLRPCServer(("localhost", 8000))
     print("Listening on port 8000...")
     server.register_multicall_functions()
     server.register_function(add, 'add')
     server.register_function(subtract, 'subtract')
     server.register_function(multiply, 'multiply')
     server.register_function(divide, 'divide')
     server.serve_forever()

上記のサーバーに対するクライアントコード:

     import xmlrpc.client

     proxy = xmlrpc.client.ServerProxy("http://localhost:8000/")
     multicall = xmlrpc.client.MultiCall(proxy)
     multicall.add(7, 3)
     multicall.subtract(7, 3)
     multicall.multiply(7, 3)
     multicall.divide(7, 3)
     result = multicall()

     print("7+3=%d, 7-3=%d, 7*3=%d, 7//3=%d" % tuple(result))

   ---------- Footnotes ----------

   (1) このアプローチは a discussion on xmlrpc.com
(https://web.archive.org/web/20060624230303/http://www.xmlrpc.com/discuss/msgReader$1208?mode=topic)
にて最初に著されました。


File: python.info,  Node: 補助関数,  Next: クライアントのサンプル,  Prev: MultiCall オブジェクト,  Up: xmlrpc client --- XML-RPC クライアントアクセス

5.22.21.7 補助関数
..................

 -- の関数: xmlrpc.client.dumps (params, methodname=None,
          methodresponse=None, encoding=None, allow_none=False)

     Convert 'params' into an XML-RPC request, or into a response if
     'methodresponse' is true.  'params' can be either a tuple of
     arguments or an instance of the *note Fault: 4184. exception class.
     If 'methodresponse' is true, only a single value can be returned,
     meaning that 'params' must be of length 1.  'encoding', if
     supplied, is the encoding to use in the generated XML; the default
     is UTF-8.  Python's *note None: 885. value cannot be used in
     standard XML-RPC; to allow using it via an extension, provide a
     true value for 'allow_none'.

 -- の関数: xmlrpc.client.loads (data, use_datetime=False,
          use_builtin_types=False)

     XML-RPC リクエストまたはレスポンスを ‘(params, methodname)’ の形式
     をとる Python オブジェクトにします。 'params' は引数のタプルです。
     'methodname' は文字列で、パケット中にメソッド名がない場合には
     ‘None’ になります。例外条件を示す XML-RPC パケットの場合には、
     *note Fault: 4184. 例外を送出します。 'use_builtin_types' フラグは
     *note datetime.datetime: 4e2. のオブジェクトとして日付/時刻を、
     *note bytes: 192. のオブジェクトとしてバイナリデータを表現する時に
     使用し、デフォルトでは false に設定されています。

     非推奨となった 'use_datetime' フラグは 'use_builtin_types' に似てい
     ますが date/time 値にのみ適用されます。

     バージョン 3.3 で変更: 'use_builtin_types' フラグが追加されました。


File: python.info,  Node: クライアントのサンプル,  Next: クライアントとサーバーの利用例,  Prev: 補助関数,  Up: xmlrpc client --- XML-RPC クライアントアクセス

5.22.21.8 クライアントのサンプル
................................

     # simple test program (from the XML-RPC specification)
     from xmlrpc.client import ServerProxy, Error

     # server = ServerProxy("http://localhost:8000") # local server
     with ServerProxy("http://betty.userland.com") as proxy:

         print(proxy)

         try:
             print(proxy.examples.getStateName(41))
         except Error as v:
             print("ERROR", v)

XML-RPC サーバに HTTP プロキシを経由して接続する場合、カスタムトランスポ
ートを定義する必要があります。以下に例を示します:

     import http.client
     import xmlrpc.client

     class ProxiedTransport(xmlrpc.client.Transport):

         def set_proxy(self, host, port=None, headers=None):
             self.proxy = host, port
             self.proxy_headers = headers

         def make_connection(self, host):
             connection = http.client.HTTPConnection(*self.proxy)
             connection.set_tunnel(host, headers=self.proxy_headers)
             self._connection = host, connection
             return connection

     transport = ProxiedTransport()
     transport.set_proxy('proxy-server', 8080)
     server = xmlrpc.client.ServerProxy('http://betty.userland.com', transport=transport)
     print(server.examples.getStateName(41))


File: python.info,  Node: クライアントとサーバーの利用例,  Prev: クライアントのサンプル,  Up: xmlrpc client --- XML-RPC クライアントアクセス

5.22.21.9 クライアントとサーバーの利用例
........................................

*note SimpleXMLRPCServer の例: 41a5. を参照してください。

脚注
....


File: python.info,  Node: xmlrpc server --- 基本的な XML-RPC サーバー,  Next: ipaddress --- IPv4/IPv6 操作ライブラリ,  Prev: xmlrpc client --- XML-RPC クライアントアクセス,  Up: インターネットプロトコルとサポート

5.22.22 ‘xmlrpc.server’ -- 基本的な XML-RPC サーバー
----------------------------------------------------

'ソースコード:' Lib/xmlrpc/server.py(1)

__________________________________________________________________

The ‘xmlrpc.server’ module provides a basic server framework for XML-RPC
servers written in Python.  Servers can either be free standing, using
*note SimpleXMLRPCServer: 41a9, or embedded in a CGI environment, using
*note CGIXMLRPCRequestHandler: 41aa.

     警告: The ‘xmlrpc.server’ module is not secure against maliciously
     constructed data.  If you need to parse untrusted or
     unauthenticated data, see *note XML security: 3ce9.

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

 -- クラス: xmlrpc.server.SimpleXMLRPCServer (addr,
          requestHandler=SimpleXMLRPCRequestHandler, logRequests=True,
          allow_none=False, encoding=None, bind_and_activate=True,
          use_builtin_types=False)

     サーバーインスタンスを新たに作成します。 このクラスは XML-RPC プロ
     トコルで呼ばれる関数の登録のためのメソッドを提供します。 引数
     'requestHandler' にはリクエストハンドラーインスタンスのファクトリー
     を設定します。 デフォルトは *note SimpleXMLRPCRequestHandler: 153f.
     です。 引数 'addr' と 'requestHandler' は *note
     socketserver.TCPServer: 1537. のコンストラクターに渡されます。
     'logRequests' が真の場合 (デフォルト)、 リクエストはログに記録され
     ます。 この引数を偽にするとはログは記録されません。 引数
     'allow_none' と 'encoding' は *note xmlrpc.client: 134. に渡され、
     サーバーが返す XML-RPC 応答を制御します。 'bind_and_activate' 引数
     はコンストラクタが直ちに ‘server_bind()’ と ‘server_activate()’ を
     呼ぶかどうかを制御します。デフォルトでは真です。 この引数に ‘False’
     を設定することで、アドレスを束縛する前に 'allow_reuse_address' クラ
     ス変数を操作することが出来ます。 'use_builtin_types' 引数は *note
     loads(): 164e. 関数に渡されます。 この引数は日付/時刻の値やバイナリ
     データを受け取ったときにどの型が処理されるかを制御します。デフォル
     トでは偽です。

     バージョン 3.3 で変更: 'use_builtin_types' フラグが追加されました。

 -- クラス: xmlrpc.server.CGIXMLRPCRequestHandler (allow_none=False,
          encoding=None, use_builtin_types=False)

     CGI 環境における XML-RPC リクエストハンドラーを新たに作成します。 引
     数 'allow_none' と 'encoding' は *note xmlrpc.client: 134. に渡され
     、サーバーが返す XML-RPC 応答を制御します。 'use_builtin_types' 引
     数は *note loads(): 164e. 関数に渡されます。 この引数は日付/時刻の
     値やバイナリデータを受け取ったときにどの型が処理されるかを制御しま
     す。デフォルトは偽です。

     バージョン 3.3 で変更: 'use_builtin_types' フラグが追加されました。

 -- クラス: xmlrpc.server.SimpleXMLRPCRequestHandler

     リクエストハンドラーインスタンスを新たに作成します。このリクエスト
     ハンドラーは ‘POST’ リクエストをサポートし、 *note
     SimpleXMLRPCServer: 41a9. コンストラクターの引数 'logRequests' に従
     ってログ出力を行います。

* Menu:

* SimpleXMLRPCServer オブジェクト::
* CGIXMLRPCRequestHandler::
* XMLRPC サーバの文書化::
* DocXMLRPCServer オブジェクト::
* DocCGIXMLRPCRequestHandler::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/xmlrpc/server.py


File: python.info,  Node: SimpleXMLRPCServer オブジェクト,  Next: CGIXMLRPCRequestHandler,  Up: xmlrpc server --- 基本的な XML-RPC サーバー

5.22.22.1 SimpleXMLRPCServer オブジェクト
.........................................

*note SimpleXMLRPCServer: 41a9. クラスは *note socketserver.TCPServer:
1537. のサブクラスで、基本的なスタンドアロンの XML-RPC サーバーを作成す
る手段を提供します。

 -- メソッド: SimpleXMLRPCServer.register_function (function=None,
          name=None)

     XML-RPC リクエストに応答可能な関数を登録します。引数 'name' が与え
     られた場合は、それが関数 'function' に関連付けられたメソッド名とな
     ります。そうでない場合は、 *note function.__name__: 14ec. の値が用
     いられます。引数 'name' は文字列で、例えばピリオド "."  のような
     Pythonで識別子として正しくない文字を含んでいても構いません。

     このメソッドはデコレーターとしても使用することができます。デコレー
     ターとして使用するときは、 'name' は関数を 'name' で登録するキーワ
     ード引数としてのみ渡すことができます。 'name' が与えられていないと
     きは、 *note function.__name__: 14ec. が使用されます。

     バージョン 3.7 で変更: *note register_function(): 41ad. はデコレー
     ターとして使用できます。

 -- メソッド: SimpleXMLRPCServer.register_instance (instance,
          allow_dotted_names=False)

     オブジェクトを登録します。 オブジェクトは *note
     register_function(): 41ad. を使用して登録されていないメソッド名を公
     開するのに使われます。 'instance' に ‘_dispatch()’ メソッドがあった
     場合、リクエストされたメソッド名と引数で ‘_dispatch()’ を呼び出しま
     す。 API は ‘def _dispatch(self, method, params)’ ('params' 可変引
     数リストではないことに注意) です。 タスクを実行するのに下層の関数を
     呼び出す場合、その関数は ‘func(*params)’ のように引数リストを展開し
     て呼び出されます。 ‘_dispatch()’ の返り値は結果としてクライアントに
     返されます。 'instance' に ‘_dispatch()’ メソッドがない場合、リクエ
     ストされたメソッド名にマッチする属性を検索します。

     オプション引数 'allow_dotted_names' が真でインスタンスに
     ‘_dispatch()’ メソッドがない場合、リクエストされたメソッド名がピリ
     オドを含むなら、メソッド名の各要素が個々に検索され、簡単な階層的検
     索が行われます。 その検索で発見された値をリクエストの引数で呼び出し
     、クライアントに返り値を返します。

          警告: 'allow_dotted_names' オプションを有効にすると、侵入者は
          あなたのモジュールのグローバル変数にアクセスすることができ、あ
          なたのマシンで任意のコードを実行できる可能性があります。このオ
          プションは閉じた安全なネットワークでのみお使い下さい。

 -- メソッド: SimpleXMLRPCServer.register_introspection_functions ()

     XML-RPC のイントロスペクション関数、 ‘system.listMethods’ 、
     ‘system.methodHelp’ 、 ‘system.methodSignature’ を登録します。

 -- メソッド: SimpleXMLRPCServer.register_multicall_functions ()

     XML-RPC における複数の要求を処理する関数 system.multicall を登録し
     ます。

 -- の属性: SimpleXMLRPCRequestHandler.rpc_paths

     この属性値はXML-RPCリクエストを受け付けるURLの有効なパス部分をリス
     トするタプルでなければなりません。これ以外のパスへのリクエストは
     404「そのようなページはありません」 HTTPエラーになります。このタプ
     ルが空の場合は全てのパスが有効であると見なされます。デフォルト値は
     ‘('/', '/RPC2')’ です。

* Menu:

* SimpleXMLRPCServer の例::


File: python.info,  Node: SimpleXMLRPCServer の例,  Up: SimpleXMLRPCServer オブジェクト

5.22.22.2 SimpleXMLRPCServer の例
.................................

サーバーのコード:

     from xmlrpc.server import SimpleXMLRPCServer
     from xmlrpc.server import SimpleXMLRPCRequestHandler

     # Restrict to a particular path.
     class RequestHandler(SimpleXMLRPCRequestHandler):
         rpc_paths = ('/RPC2',)

     # Create server
     with SimpleXMLRPCServer(('localhost', 8000),
                             requestHandler=RequestHandler) as server:
         server.register_introspection_functions()

         # Register pow() function; this will use the value of
         # pow.__name__ as the name, which is just 'pow'.
         server.register_function(pow)

         # Register a function under a different name
         def adder_function(x, y):
             return x + y
         server.register_function(adder_function, 'add')

         # Register an instance; all the methods of the instance are
         # published as XML-RPC methods (in this case, just 'mul').
         class MyFuncs:
             def mul(self, x, y):
                 return x * y

         server.register_instance(MyFuncs())

         # Run the server's main loop
         server.serve_forever()

以下のクライアントコードは上のサーバーで使えるようになったメソッドを呼び
出します:

     import xmlrpc.client

     s = xmlrpc.client.ServerProxy('http://localhost:8000')
     print(s.pow(2,3))  # Returns 2**3 = 8
     print(s.add(2,3))  # Returns 5
     print(s.mul(5,2))  # Returns 5*2 = 10

     # Print list of available methods
     print(s.system.listMethods())

‘register_function()’ はデコレーターとしても使用できます。前のサーバーの
例は、デコレーターの方法で関数を登録することもできます。

     from xmlrpc.server import SimpleXMLRPCServer
     from xmlrpc.server import SimpleXMLRPCRequestHandler

     class RequestHandler(SimpleXMLRPCRequestHandler):
         rpc_paths = ('/RPC2',)

     with SimpleXMLRPCServer(('localhost', 8000),
                             requestHandler=RequestHandler) as server:
         server.register_introspection_functions()

         # Register pow() function; this will use the value of
         # pow.__name__ as the name, which is just 'pow'.
         server.register_function(pow)

         # Register a function under a different name, using
         # register_function as a decorator. *name* can only be given
         # as a keyword argument.
         @server.register_function(name='add')
         def adder_function(x, y):
             return x + y

         # Register a function under function.__name__.
         @server.register_function
         def mul(x, y):
             return x * y

         server.serve_forever()

‘Lib/xmlrpc/server.py’ モジュール内にある以下の例はドット付名前を許容し
複数呼び出し関数を登録するサーバです。

     警告: Enabling the 'allow_dotted_names' option allows intruders to
     access your module's global variables and may allow intruders to
     execute arbitrary code on your machine.  Only use this example
     within a secure, closed network.

     import datetime

     class ExampleService:
         def getData(self):
             return '42'

         class currentTime:
             @staticmethod
             def getCurrentTime():
                 return datetime.datetime.now()

     with SimpleXMLRPCServer(("localhost", 8000)) as server:
         server.register_function(pow)
         server.register_function(lambda x,y: x+y, 'add')
         server.register_instance(ExampleService(), allow_dotted_names=True)
         server.register_multicall_functions()
         print('Serving XML-RPC on localhost port 8000')
         try:
             server.serve_forever()
         except KeyboardInterrupt:
             print("\nKeyboard interrupt received, exiting.")
             sys.exit(0)

この ExampleService デモはコマンドラインから起動することができます。

     python -m xmlrpc.server

上記のサーバとやりとりするクライアントは ‘Lib/xmlrpc/client.py’ にありま
す:

     server = ServerProxy("http://localhost:8000")

     try:
         print(server.currentTime.getCurrentTime())
     except Error as v:
         print("ERROR", v)

     multi = MultiCall(server)
     multi.getData()
     multi.pow(2,9)
     multi.add(1,2)
     try:
         for response in multi():
             print(response)
     except Error as v:
         print("ERROR", v)

デモ XMLRPC サーバとやりとりするクライアントは以下のように呼び出します:

     python -m xmlrpc.client


File: python.info,  Node: CGIXMLRPCRequestHandler,  Next: XMLRPC サーバの文書化,  Prev: SimpleXMLRPCServer オブジェクト,  Up: xmlrpc server --- 基本的な XML-RPC サーバー

5.22.22.3 CGIXMLRPCRequestHandler
.................................

*note CGIXMLRPCRequestHandler: 41aa. クラスは、Python の CGI スクリプト
に送られた XML-RPC リクエストを処理するときに使用できます。

 -- メソッド: CGIXMLRPCRequestHandler.register_function (function=None,
          name=None)

     XML-RPC リクエストに応答可能な関数を登録します。引数 'name' が与え
     られた場合は、それが関数 'function' に関連付けられたメソッド名とな
     ります。そうでない場合は、 *note function.__name__: 14ec. の値が用
     いられます。引数 'name' は文字列で、例えばピリオド "."  のような
     Pythonで識別子として正しくない文字を含んでいても構いません。

     このメソッドはデコレーターとしても使用することができます。デコレー
     ターとして使用するときは、 'name' は関数を 'name' で登録するキーワ
     ード引数としてのみ渡すことができます。 'name' が与えられていないと
     きは、 *note function.__name__: 14ec. が使用されます。

     バージョン 3.7 で変更: *note register_function(): 41b4. はデコレー
     ターとして使用できます。

 -- メソッド: CGIXMLRPCRequestHandler.register_instance (instance)

     オブジェクトを登録します。 オブジェクトは *note
     register_function(): 41b4. を使用して登録されていないメソッド名を公
     開するのに使われます。 'instance' に ‘_dispatch()’ メソッドがあった
     場合、リクエストされたメソッド名と引数で ‘_dispatch()’ を呼び出しま
     す。 返り値は結果としてクライアントに返されます。 'instance' に
     ‘_dispatch()’ メソッドがなかった場合、リクエストされたメソッド名に
     マッチする属性を検索します。 リクエストされたメソッド名がピリオドを
     含む場合、モジュール名の各要素が個々に検索され、簡単な階層的検索が
     実行されます。 その検索で発見された値をリクエストの引数で呼び出し、
     クライアントに返り値を返します。

 -- メソッド: CGIXMLRPCRequestHandler.register_introspection_functions
          ()

     XML-RPC のイントロスペクション関数、 ‘system.listMethods’ 、
     ‘system.methodHelp’ 、 ‘system.methodSignature’ を登録します。

 -- メソッド: CGIXMLRPCRequestHandler.register_multicall_functions ()

     XML-RPC マルチコール関数 ‘system.multicall’ を登録します。

 -- メソッド: CGIXMLRPCRequestHandler.handle_request (request_text=None)

     XML-RPC リクエストを処理します。 与えられた場合、 'request_text' は
     HTTP サーバが提供する POST データでなければなりません。 そうでない
     場合、標準入力の内容が使われます。

以下はプログラム例です:

     class MyFuncs:
         def mul(self, x, y):
             return x * y


     handler = CGIXMLRPCRequestHandler()
     handler.register_function(pow)
     handler.register_function(lambda x,y: x+y, 'add')
     handler.register_introspection_functions()
     handler.register_instance(MyFuncs())
     handler.handle_request()


File: python.info,  Node: XMLRPC サーバの文書化,  Next: DocXMLRPCServer オブジェクト,  Prev: CGIXMLRPCRequestHandler,  Up: xmlrpc server --- 基本的な XML-RPC サーバー

5.22.22.4 XMLRPC サーバの文書化
...............................

これらのクラスは HTTP GET 要求への応答内で HTML 文書となるよう上記クラス
を拡張します。 サーバは独立していても CGI 環境に埋め込まれていてもかまい
ません。 前者では *note DocXMLRPCServer: 1da6. を、後者では *note
DocCGIXMLRPCRequestHandler: 41ba. を使用します。

 -- クラス: xmlrpc.server.DocXMLRPCServer (addr,
          requestHandler=DocXMLRPCRequestHandler, logRequests=True,
          allow_none=False, encoding=None, bind_and_activate=True,
          use_builtin_types=True)

     サーバ・インスタンスを新たに生成します。全ての引数の意味は *note
     SimpleXMLRPCServer: 41a9. のものと同じですが、 'requestHandler' の
     デフォルトは *note DocXMLRPCRequestHandler: 41bb. になっています。

     バージョン 3.3 で変更: 'use_builtin_types' フラグが追加されました。

 -- クラス: xmlrpc.server.DocCGIXMLRPCRequestHandler

     CGI環境で XMR-RPC リクエストを処理するインスタンスを新たに生成しま
     す。

 -- クラス: xmlrpc.server.DocXMLRPCRequestHandler

     リクエスト・ハンドラのインスタンスを新たに生成します。このリクエス
     ト・ハンドラは XML-RPC POST 要求とドキュメントの GET 要求をサポート
     し、 *note DocXMLRPCServer: 1da6. コンストラクタに与えられた引数
     'logRequests' を優先するためにロギングを変更します。


File: python.info,  Node: DocXMLRPCServer オブジェクト,  Next: DocCGIXMLRPCRequestHandler,  Prev: XMLRPC サーバの文書化,  Up: xmlrpc server --- 基本的な XML-RPC サーバー

5.22.22.5 DocXMLRPCServer オブジェクト
......................................

*note DocXMLRPCServer: 1da6. は *note SimpleXMLRPCServer: 41a9. の派生ク
ラスで、自己文書化するスタンドアローン XML-RPC サーバの作成手段を提供し
ます。 HTTP POST リクエストは XML-RPC メソッドの呼び出しとして処理されま
す。 HTTP GET リクエストは pydoc スタイルの HTML 文書の生成に処理されま
す。 これによりサーバは自身の web ベースの文書を提供できます。

 -- メソッド: DocXMLRPCServer.set_server_title (server_title)

     生成する HTML 文書で使用されるタイトルを設定します。このタイトルは
     HTML の title 要素内で使われます。

 -- メソッド: DocXMLRPCServer.set_server_name (server_name)

     生成する HTML 文書内で使用される名前を設定します。この名前は生成し
     た文書冒頭の h1 要素内で使われます。

 -- メソッド: DocXMLRPCServer.set_server_documentation
          (server_documentation)

     生成する HTML 文書内で使用される説明を設定します。この説明は文書中
     のサーバ名の下にパラグラフとして出力されます。


File: python.info,  Node: DocCGIXMLRPCRequestHandler,  Prev: DocXMLRPCServer オブジェクト,  Up: xmlrpc server --- 基本的な XML-RPC サーバー

5.22.22.6 DocCGIXMLRPCRequestHandler
....................................

*note DocCGIXMLRPCRequestHandler: 41ba. は *note
CGIXMLRPCRequestHandler: 41aa. の派生クラスで、自己文書化する XML-RPC
CGI スクリプトの作成手段を提供します。 HTTP POST リクエストは XML-RCP メ
ソッドの呼び出しとして処理されます。 HTTP GET リクエストは pydoc スタイ
ルの HTML 文書の生成に処理されます。 これによりサーバは自身の web ベース
の文書を提供できます。

 -- メソッド: DocCGIXMLRPCRequestHandler.set_server_title (server_title)

     生成する HTML 文書で使用されるタイトルを設定します。このタイトルは
     HTML の title 要素内で使われます。

 -- メソッド: DocCGIXMLRPCRequestHandler.set_server_name (server_name)

     生成する HTML 文書内で使用される名前を設定します。この名前は生成し
     た文書冒頭の h1 要素内で使われます。

 -- メソッド: DocCGIXMLRPCRequestHandler.set_server_documentation
          (server_documentation)

     生成する HTML 文書内で使用される説明を設定します。この説明は文書中
     のサーバ名の下にパラグラフとして出力されます。


File: python.info,  Node: ipaddress --- IPv4/IPv6 操作ライブラリ,  Prev: xmlrpc server --- 基本的な XML-RPC サーバー,  Up: インターネットプロトコルとサポート

5.22.23 ‘ipaddress’ -- IPv4/IPv6 操作ライブラリ
-----------------------------------------------

'ソースコード:' Lib/ipaddress.py(1)

__________________________________________________________________

‘ipaddress’ provides the capabilities to create, manipulate and operate
on IPv4 and IPv6 addresses and networks.

このモジュールの関数やクラスを使うと、IPアドレスに関する様々なタスク、例
えば2つのホストが同じサブネットに属しているかどうかをチェックしたり、特
定のサブネット内の全てのホストをイテレートしたり、文字列が正しい IP アド
レスかネットワークを定義しているかどうかをチェックするなどを簡単に実現す
ることができます。

これはモジュールの完全な API リファレンスです。概要や紹介は *note
ipaddressモジュールの紹介: 41c8. を参照してください。

Added in version 3.3.

* Menu:

* 便利なファクトリ関数::
* IP アドレス::
* IP ネットワーク定義::
* インターフェイスオブジェクト::
* その他のモジュールレベル関数::
* Custom Exceptions::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/ipaddress.py


File: python.info,  Node: 便利なファクトリ関数,  Next: IP アドレス,  Up: ipaddress --- IPv4/IPv6 操作ライブラリ

5.22.23.1 便利なファクトリ関数
..............................

The ‘ipaddress’ module provides factory functions to conveniently create
IP addresses, networks and interfaces:

 -- の関数: ipaddress.ip_address (address)

     引数に渡された IP address に応じて、 *note IPv4Address: 50c. か
     *note IPv6Address: 50d. のオブジェクトを返します。 IPv4 か IPv6 の
     アドレスを受け取ります; ‘2**32’ より小さい整数はデフォルトでは IPv4
     アドレスだと判断されます。 'address' が正しい IPv4, IPv6 アドレスを
     表現していない場合は *note ValueError: 2ec. を発生させます。

          >>> ipaddress.ip_address('192.168.0.1')
          IPv4Address('192.168.0.1')
          >>> ipaddress.ip_address('2001:db8::')
          IPv6Address('2001:db8::')

 -- の関数: ipaddress.ip_network (address, strict=True)

     引数に渡された IP address に応じて、 *note IPv4Network: 50e. か
     *note IPv6Network: 50f. のオブジェクトを返します。 'address' は IP
     ネットワークを示す文字列あるいは整数です。 IPv4 か IPv6 のネットワ
     ークを受け取ります; ‘2**32’ より小さい整数はデフォルトでは IPv4 ア
     ドレスだと判断されます。 'strict' は *note IPv4Network: 50e. か
     *note IPv6Network: 50f. のコンストラクタに渡されます。 'address' が
     正しい IPv4, IPv6 アドレスを表現していない場合や、ネットワークの
     host bit がセットされていた場合は *note ValueError: 2ec. を発生させ
     ます。

          >>> ipaddress.ip_network('192.168.0.0/28')
          IPv4Network('192.168.0.0/28')

 -- の関数: ipaddress.ip_interface (address)

     引数に渡された IP address に応じて、 *note IPv4Interface: 1b99. か
     *note IPv6Interface: 1b9a. のオブジェクトを返します。 'address' は
     IP ネットワークを示す文字列あるいは整数です。 IPv4 か IPv6 のネット
     ワークを受け取ります; ‘2**32’ より小さい整数はデフォルトでは IPv4 ア
     ドレスだと判断されます。 'address' が正しい IPv4, IPv6 アドレスを表
     現していない場合は *note ValueError: 2ec. を発生させます。

これらの便利関数を利用するデメリットとして、IPv4 と IPv6 両方のフォーマ
ットを扱う必要性があるために、どちらを期待されていたのかを知ることができ
ず、エラーメッセージが最小限の情報しか提供できないことです。利用したいバ
ージョンの特定のコンストラクタを直接呼ぶことで、より詳細なエラーレポート
を得ることができます。


File: python.info,  Node: IP アドレス,  Next: IP ネットワーク定義,  Prev: 便利なファクトリ関数,  Up: ipaddress --- IPv4/IPv6 操作ライブラリ

5.22.23.2 IP アドレス
.....................

* Menu:

* Address オブジェクト::
* 文字列と整数への変換::
* 演算子: 演算子<2>.


File: python.info,  Node: Address オブジェクト,  Next: 文字列と整数への変換,  Up: IP アドレス

5.22.23.3 Address オブジェクト
..............................

*note IPv4Address: 50c. と *note IPv6Address: 50d. オブジェクトは多くの
共通した属性を持っています。両方の IP バージョンを扱うコードを書きやすく
するために、IPv6 アドレスでしか意味が無いいくつかの属性も *note
IPv4Address: 50c. オブジェクトに実装されています。アドレスオブジェクトは
*note hashable: 824. なので、辞書のキーとして利用できます。

 -- クラス: ipaddress.IPv4Address (address)

     IPv4 アドレスを構築する。 'address' が正しい IPv4 アドレスでない場
     合、 *note AddressValueError: 41cf. を発生させます。

     以下のものが正しい IPv4 アドレスを構築します:

       1. A string in decimal-dot notation, consisting of four decimal
          integers in the inclusive range 0-255, separated by dots (e.g.
          ‘192.168.0.1’).  Each integer represents an octet (byte) in
          the address.  Leading zeroes are not tolerated to prevent
          confusion with octal notation.

       2. 32bit に収まる整数。

       3. 大きさ4の *note bytes: 192. オブジェクトに (最上位オクテットが
          最初になるように) パックされた整数。

          >>> ipaddress.IPv4Address('192.168.0.1')
          IPv4Address('192.168.0.1')
          >>> ipaddress.IPv4Address(3232235521)
          IPv4Address('192.168.0.1')
          >>> ipaddress.IPv4Address(b'\xC0\xA8\x00\x01')
          IPv4Address('192.168.0.1')

     バージョン 3.8 で変更: Leading zeros are tolerated, even in
     ambiguous cases that look like octal notation.

     バージョン 3.9.5 で変更: Leading zeros are no longer tolerated and
     are treated as an error.  IPv4 address strings are now parsed as
     strict as glibc *note inet_pton(): b5b.

      -- の属性: version

          適切なバージョン番号: IPv4 なら ‘4’, IPv6 なら ‘6’.

          バージョン 3.14 で変更: Made available on the class.

      -- の属性: max_prefixlen

          このバージョンのアドレスを表現するのに必要なビット数: IPv4 な
          ら ‘32’, IPv6 なら ‘128’.

          prefix は、アドレスがネットワークに含まれるかどうかを決定する
          ために比較する、アドレスの先頭ビット数を定義します。

          バージョン 3.14 で変更: Made available on the class.

      -- の属性: compressed

      -- の属性: exploded

          ドットと10進数を使った表現の文字列。この表現には先頭の 0 は含
          まれません。

          IPv4 はアドレスの 0 オクテットを省略する記法を定義していないの
          で、IPv4 アドレスにおいてこれらの2つの属性は常に ‘str(addr)’ と
          等しくなります。これらの属性を用意することで、IPv4 と IPv6 ア
          ドレス両方を扱う、表示用コードが書きやすくなります。

      -- の属性: packed

          このアドレスのバイナリ表現 - 適切な長さをもった *note bytes:
          192. オブジェクト(最上位オクテットが先頭)。 IPv4 では 4 byte で
          、 IPv6 では 16 byte。

      -- の属性: reverse_pointer

          The name of the reverse DNS PTR record for the IP address,
          e.g.:

               >>> ipaddress.ip_address("127.0.0.1").reverse_pointer
               '1.0.0.127.in-addr.arpa'
               >>> ipaddress.ip_address("2001:db8::1").reverse_pointer
               '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'

          This is the name that could be used for performing a PTR
          lookup, not the resolved hostname itself.

          Added in version 3.5.

      -- の属性: is_multicast

          アドレスがマルチキャスト用に予約されている場合は ‘True’ 。 RFC
          3171(1) (IPv4) か RFC 2373(2) (IPv6) を参照。

      -- の属性: is_private

          ‘True’ if the address is defined as not globally reachable by
          iana-ipv4-special-registry(3) (for IPv4) or
          iana-ipv6-special-registry(4) (for IPv6) with the following
          exceptions:

             * ‘is_private’ is ‘False’ for the shared address space
               (‘100.64.0.0/10’)

             * For IPv4-mapped IPv6-addresses the ‘is_private’ value is
               determined by the semantics of the underlying IPv4
               addresses and the following condition holds (see *note
               IPv6Address.ipv4_mapped: 41d6.):

                    address.is_private == address.ipv4_mapped.is_private

          ‘is_private’ has value opposite to *note is_global: 1161,
          except for the shared address space (‘100.64.0.0/10’ range)
          where they are both ‘False’.

          バージョン 3.13 で変更: Fixed some false positives and false
          negatives.

             * ‘192.0.0.0/24’ is considered private with the exception
               of ‘192.0.0.9/32’ and ‘192.0.0.10/32’ (previously: only
               the ‘192.0.0.0/29’ sub-range was considered private).

             * ‘64:ff9b:1::/48’ is considered private.

             * ‘2002::/16’ is considered private.

             * There are exceptions within ‘2001::/23’ (otherwise
               considered private): ‘2001:1::1/128’, ‘2001:1::2/128’,
               ‘2001:3::/32’, ‘2001:4:112::/48’, ‘2001:20::/28’,
               ‘2001:30::/28’.  The exceptions are not considered
               private.

      -- の属性: is_global

          ‘True’ if the address is defined as globally reachable by
          iana-ipv4-special-registry(5) (for IPv4) or
          iana-ipv6-special-registry(6) (for IPv6) with the following
          exception:

          For IPv4-mapped IPv6-addresses the ‘is_private’ value is
          determined by the semantics of the underlying IPv4 addresses
          and the following condition holds (see *note
          IPv6Address.ipv4_mapped: 41d6.):

               address.is_global == address.ipv4_mapped.is_global

          ‘is_global’ has value opposite to *note is_private: 19c3,
          except for the shared address space (‘100.64.0.0/10’ range)
          where they are both ‘False’.

          Added in version 3.4.

          バージョン 3.13 で変更: Fixed some false positives and false
          negatives, see *note is_private: 19c3. for details.

      -- の属性: is_unspecified

          アドレスが未定義の時に ‘True’.  RFC 5735(7) (IPv4) か RFC
          2373(8) (IPv6) を参照。

      -- の属性: is_reserved

          ‘True’ if the address is noted as reserved by the IETF. For
          IPv4, this is only ‘240.0.0.0/4’, the ‘Reserved’ address
          block.  For IPv6, this is all addresses allocated(9) as
          ‘Reserved by IETF’ for future use.

               注釈: For IPv4, ‘is_reserved’ is not related to the
               address block value of the ‘Reserved-by-Protocol’ column
               in iana-ipv4-special-registry(10).

               注意: For IPv6, ‘fec0::/10’ a former Site-Local scoped
               address prefix is currently excluded from that list (see
               *note is_site_local: 41d9. & RFC 3879(11)).

      -- の属性: is_loopback

          ループバックアドレスである場合に ‘True’.  RFC 3330(12) (IPv4)
          か RFC 2373(13) (IPv6) を参照。

      -- の属性: is_link_local

          アドレスがリンクローカル用に予約されいている場合に ‘True’.
          RFC 3927(14) を参照。

      -- の属性: ipv6_mapped

          *note IPv4Address: 50c. object representing the IPv4-mapped
          IPv6 address.  See RFC 4291(15).

          Added in version 3.13.

 -- メソッド: IPv4Address.__format__ (fmt)

     Returns a string representation of the IP address, controlled by an
     explicit format string.  'fmt' can be one of the following: ‘'s'’,
     the default option, equivalent to *note str(): 169, ‘'b'’ for a
     zero-padded binary string, ‘'X'’ or ‘'x'’ for an uppercase or
     lowercase hexadecimal representation, or ‘'n'’, which is equivalent
     to ‘'b'’ for IPv4 addresses and ‘'x'’ for IPv6.  For binary and
     hexadecimal representations, the form specifier ‘'#'’ and the
     grouping option ‘'_'’ are available.  ‘__format__’ is used by
     ‘format’, ‘str.format’ and f-strings.

          >>> format(ipaddress.IPv4Address('192.168.0.1'))
          '192.168.0.1'
          >>> '{:#b}'.format(ipaddress.IPv4Address('192.168.0.1'))
          '0b11000000101010000000000000000001'
          >>> f'{ipaddress.IPv6Address("2001:db8::1000"):s}'
          '2001:db8::1000'
          >>> format(ipaddress.IPv6Address('2001:db8::1000'), '_X')
          '2001_0DB8_0000_0000_0000_0000_0000_1000'
          >>> '{:#_n}'.format(ipaddress.IPv6Address('2001:db8::1000'))
          '0x2001_0db8_0000_0000_0000_0000_0000_1000'

     Added in version 3.9.

 -- クラス: ipaddress.IPv6Address (address)

     IPv6 アドレスを構築する。 'address' が正しい IPv6 アドレスでない場
     合、 *note AddressValueError: 41cf. を発生させます。

     以下のものが正しい IPv6 アドレスを構築します:

       1. 4桁の16進数からなるグループ8個で構成された文字列。各グループは
          16bitを表現している。グループはコロンで区切られる。これは
          'exploded' (長い) 記法を表す。文字列は 'compressed' (省略) 記
          法でも良い。詳細は RFC 4291(16) を参照。例えば、
          ‘"0000:0000:0000:0000:0000:0abc:0007:0def"’ は ‘"::abc:7:def"’
          と省略できる。

          Optionally, the string may also have a scope zone ID,
          expressed with a suffix ‘%scope_id’.  If present, the scope ID
          must be non-empty, and may not contain ‘%’.  See RFC 4007(17)
          for details.  For example, ‘fe80::1234%1’ might identify
          address ‘fe80::1234’ on the first link of the node.

       2. 128bit に収まる整数。

       3. ビッグエンディアンで 16 バイトの長さの *note bytes: 192. オブ
          ジェクトにパックされた整数。

          >>> ipaddress.IPv6Address('2001:db8::1000')
          IPv6Address('2001:db8::1000')
          >>> ipaddress.IPv6Address('ff02::5678%1')
          IPv6Address('ff02::5678%1')

      -- の属性: compressed

     アドレス表現の短い形式で、グループ内の先頭の 0 を省略し、連続する完
     全に0のグループの一番長いシーケンスを1つの空グループに折りたたんだ
     もの。

     これは IPv6 アドレスに対して ‘str(addr)’ が返す値と同じです。

      -- の属性: exploded

     アドレス表現の長い形式。全てのグループの先頭の0は省略されず、完全に
     0のグループも省略されない。

     以降の属性とメソッドについては、*note IPv4Address: 50c. クラスの対
     応するドキュメントを参照してください:

      -- の属性: packed

      -- の属性: reverse_pointer

      -- の属性: version

      -- の属性: max_prefixlen

      -- の属性: is_multicast

      -- の属性: is_private

      -- の属性: is_global

          Added in version 3.4.

      -- の属性: is_unspecified

      -- の属性: is_reserved

      -- の属性: is_loopback

      -- の属性: is_link_local

      -- の属性: is_site_local

          アドレスがサイトローカルな目的のために予約されいている場合に
          ‘True’.  サイトローカルアドレスは RFC 3879(18) によって廃止さ
          れている事に注意してください。アドレスが RFC 4193(19) で定義さ
          れているユニークローカルアドレスの範囲に含まれているかどうかを
          テストするには、 *note is_private: 19c3. を利用してください。

      -- の属性: ipv4_mapped

          IPv4 にマップされた(‘::FFFF/96’ で始まる)アドレスの場合、この
          プロパティは埋め込まれた IPv4 Address を返します。それ以外のア
          ドレスに対しては、このプロパティは ‘None’ になります。

      -- の属性: scope_id

          For scoped addresses as defined by RFC 4007(20), this property
          identifies the particular zone of the address's scope that the
          address belongs to, as a string.  When no scope zone is
          specified, this property will be ‘None’.

      -- の属性: sixtofour

          RFC 3056(21) で定義された 6to4 (‘2002::/16’ で始まる)アドレス
          の場合、このプロパティは埋め込まれた IPv4 Address を返します。
          それ以外のアドレスに対しては、このプロパティは ‘None’ になりま
          す。

      -- の属性: teredo

          RFC 4380(22) で定義された Teredo (‘2001::/32’ で始まる)アドレ
          スの場合、このプロパティは埋め込まれた ‘(server, client)’ IP ア
          ドレスペアを返します。それ以外のアドレスに対しては、このプロパ
          ティは ‘None’ になります。

 -- メソッド: IPv6Address.__format__ (fmt)

     *note IPv4Address: 50c. の対応するメソッドのドキュメントを参照して
     ください。

     Added in version 3.9.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc3171.html

   (2) https://datatracker.ietf.org/doc/html/rfc2373.html

   (3) 
https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml

   (4) 
https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml

   (5) 
https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml

   (6) 
https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml

   (7) https://datatracker.ietf.org/doc/html/rfc5735.html

   (8) https://datatracker.ietf.org/doc/html/rfc2373.html

   (9) 
https://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xhtml

   (10) 
https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml

   (11) https://datatracker.ietf.org/doc/html/rfc3879.html

   (12) https://datatracker.ietf.org/doc/html/rfc3330.html

   (13) https://datatracker.ietf.org/doc/html/rfc2373.html

   (14) https://datatracker.ietf.org/doc/html/rfc3927.html

   (15) https://datatracker.ietf.org/doc/html/rfc4291.html

   (16) https://datatracker.ietf.org/doc/html/rfc4291.html

   (17) https://datatracker.ietf.org/doc/html/rfc4007.html

   (18) https://datatracker.ietf.org/doc/html/rfc3879.html

   (19) https://datatracker.ietf.org/doc/html/rfc4193.html

   (20) https://datatracker.ietf.org/doc/html/rfc4007.html

   (21) https://datatracker.ietf.org/doc/html/rfc3056.html

   (22) https://datatracker.ietf.org/doc/html/rfc4380.html


File: python.info,  Node: 文字列と整数への変換,  Next: 演算子<2>,  Prev: Address オブジェクト,  Up: IP アドレス

5.22.23.4 文字列と整数への変換
..............................

socket モジュールなどのネットワークインターフェースを利用するには、アド
レスを文字列や整数に変換しなければなりません。これには組み込みの *note
str(): 169. と *note int(): 19b. 関数を利用します:

     >>> str(ipaddress.IPv4Address('192.168.0.1'))
     '192.168.0.1'
     >>> int(ipaddress.IPv4Address('192.168.0.1'))
     3232235521
     >>> str(ipaddress.IPv6Address('::1'))
     '::1'
     >>> int(ipaddress.IPv6Address('::1'))
     1

Note that IPv6 scoped addresses are converted to integers without scope
zone ID.


File: python.info,  Node: 演算子<2>,  Prev: 文字列と整数への変換,  Up: IP アドレス

5.22.23.5 演算子
................

Address オブジェクトはいくつかの演算子をサポートします。明記されない限り
、演算子は互換性のあるオブジェクト間 (つまり IPv4 同士や IPv6 同士) での
み利用できます。

* Menu:

* 比較演算子::
* 算術演算::


File: python.info,  Node: 比較演算子,  Next: 算術演算,  Up: 演算子<2>

5.22.23.6 比較演算子
....................

Address objects can be compared with the usual set of comparison
operators.  Same IPv6 addresses with different scope zone IDs are not
equal.  Some examples:

     >>> IPv4Address('127.0.0.2') > IPv4Address('127.0.0.1')
     True
     >>> IPv4Address('127.0.0.2') == IPv4Address('127.0.0.1')
     False
     >>> IPv4Address('127.0.0.2') != IPv4Address('127.0.0.1')
     True
     >>> IPv6Address('fe80::1234') == IPv6Address('fe80::1234%1')
     False
     >>> IPv6Address('fe80::1234%1') != IPv6Address('fe80::1234%2')
     True


File: python.info,  Node: 算術演算,  Prev: 比較演算子,  Up: 演算子<2>

5.22.23.7 算術演算
..................

アドレスオブジェクトから整数を加減算できます。いくつかの例:

     >>> IPv4Address('127.0.0.2') + 3
     IPv4Address('127.0.0.5')
     >>> IPv4Address('127.0.0.2') - 3
     IPv4Address('126.255.255.255')
     >>> IPv4Address('255.255.255.255') + 1
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     ipaddress.AddressValueError: 4294967296 (>= 2**32) is not permitted as an IPv4 address


File: python.info,  Node: IP ネットワーク定義,  Next: インターフェイスオブジェクト,  Prev: IP アドレス,  Up: ipaddress --- IPv4/IPv6 操作ライブラリ

5.22.23.8 IP ネットワーク定義
.............................

*note IPv4Network: 50e. と *note IPv6Network: 50f. オブジェクトは IP ネ
ットワークの定義とインスペクトのための機構を提供します。ネットワーク定義
は 'mask' と 'ネットワークアドレス' からなり、 'mask' でマスク(bitごとの
AND) するとネットワークアドレスと同じになる IP アドレスの範囲を定義しま
す。例えば、 ‘255.255.255.0’ という 'mask' と ‘192.168.1.0’ というネット
ワークアドレスからなるネットワーク定義は、 ‘192.168.1.0’ から
‘192.168.1.255’ を含む範囲を表します。

* Menu:

* プリフィックス, ネットマスク、ホストマスク: プリフィックス ネットマスク、ホストマスク.
* Network オブジェクト::
* 演算子: 演算子<3>.


File: python.info,  Node: プリフィックス ネットマスク、ホストマスク,  Next: Network オブジェクト,  Up: IP ネットワーク定義

5.22.23.9 プリフィックス, ネットマスク、ホストマスク
....................................................

IP ネットワークマスクを定義する幾つかの等価な方法があります。'プリフィッ
クス' ‘/<nbits>’ は先頭の何bitがネットワークマスクで立っているかを示しま
す。'ネットマスク' は先頭の幾つかのbitが立っている IP アドレスです。プリ
フィックス ‘/24’ はIPv4 ではネットマスク ‘255.255.255.0’ と、IPv6 では
‘ffff:ff00::’ と同じになります。加えて、'ネットマスク' と論理が逆の 'ホ
ストマスク' があり、ときどき (例えば Cisco のアクセスコントロールリスト)
ネットワークマスクを表すために利用されます。‘/24’ と等しい IPv4 のホスト
マスクは ‘0.0.0.255’ になります。


File: python.info,  Node: Network オブジェクト,  Next: 演算子<3>,  Prev: プリフィックス ネットマスク、ホストマスク,  Up: IP ネットワーク定義

5.22.23.10 Network オブジェクト
...............................

address オブジェクトで実装されていた属性は全て network オブジェクトにも
実装されています。 network はそれに追加で幾つかの属性を実装しています。
全ての追加属性は *note IPv4Network: 50e. と *note IPv6Network: 50f. で共
通なので、重複を避けるために *note IPv4Network: 50e. にだけドキュメント
されています。ネットワークオブジェクトは *note hashable: 824. なので、辞
書のキーとして使用できます。

 -- クラス: ipaddress.IPv4Network (address, strict=True)

     IPv4 ネットワーク定義を構築します。'address' は以下の1つです:

       1. IPアドレスと、オプションでスラッシュ (‘/’) で区切られたマスク
          を持つ文字列。IPアドレスはネットワークアドレスで、マスクは 'プ
          リフィックス' を意味する1つの数値か、 IPv4 アドレスの文字列表
          現です。マスクがIPv4アドレスのとき、非ゼロのフィールドで始まる
          ときは 'ネットマスク' として、ゼロのフィールドで始まるときは
          'ホストマスク' として解釈されます。ただし、すべてのフィールド
          が0の場合は、'ネットマスク' として扱われます。マスクが省略され
          た場合、 ‘/32’ が指定されたものとします。

          例えば、次の 'address' 指定は全て等しくなります:
          ‘192.168.1.0/24’, ‘192.168.1.0/255.255.255.0’
          ‘192.168.1.0/0.0.0.255’.

       2. 32bit に収まる整数。これは1つのアドレスのネットワークと等しく
          、ネットワークアドレスが 'address' に、マスクが ‘/32’ になりま
          す。

       3. 4byte の *note bytes: 192. オブジェクトにビッグエンディアンで
          パックされた整数。これは整数の 'address' と同じように解釈され
          ます。

       4. A two-tuple of an address description and a netmask, where the
          address description is either a string, a 32-bits integer, a
          4-bytes packed integer, or an existing *note IPv4Address: 50c.
          object; and the netmask is either an integer representing the
          prefix length (e.g.  ‘24’) or a string representing the prefix
          mask (e.g.  ‘255.255.255.0’).

     'address' が有効な IPv4 アドレスでない場合に *note
     AddressValueError: 41cf. 例外を発生させます。マスクが IPv4 アドレス
     に対して有効でない場合に *note NetmaskValueError: 41f0. 例外を発生
     させます。

     'strict' が ‘True’ の場合、与えられたアドレスのホストビットが立って
     いたら *note ValueError: 2ec. を発生させます。そうでない場合、ホス
     トビットをマスクして正しいネットワークアドレスを計算します。

     特に明記されない場合、他の network や address を受け取る network の
     メソッドは、引数の IP バージョンが ‘self’ と異なる場合に *note
     TypeError: 198. を発生させます。

     バージョン 3.5 で変更: 'address' コンストラクタ引数に2要素のタプル
     形式を追加しました

      -- の属性: version

      -- の属性: max_prefixlen

          *note IPv4Address: 50c. の対応する属性のドキュメントを参照して
          ください。

      -- の属性: is_multicast

      -- の属性: is_private

      -- の属性: is_unspecified

      -- の属性: is_reserved

      -- の属性: is_loopback

      -- の属性: is_link_local

          These attributes are true for the network as a whole if they
          are true for both the network address and the broadcast
          address.

      -- の属性: network_address

          この network のネットワークアドレス。ネットワークアドレスとプ
          リフィックス長によってユニークにネットワークが定義されます。

      -- の属性: broadcast_address

          このネットワークのブロードキャストアドレス。ブロードキャストア
          ドレスに投げられたパケットはそのネットワーク内の全てのホストに
          受信されます。

      -- の属性: hostmask

          *note IPv4Address: 50c. オブジェクトとして表現された ホストマ
          スク。

      -- の属性: netmask

          *note IPv4Address: 50c. オブジェクトとして表現された ネットマ
          スク。

      -- の属性: with_prefixlen

      -- の属性: compressed

      -- の属性: exploded

          A string representation of the network, with the mask in
          prefix notation.

          ‘with_prefixlen’ and ‘compressed’ are always the same as
          ‘str(network)’.  ‘exploded’ uses the exploded form the network
          address.

      -- の属性: with_netmask

          A string representation of the network, with the mask in net
          mask notation.

      -- の属性: with_hostmask

          A string representation of the network, with the mask in host
          mask notation.

      -- の属性: num_addresses

          ネットワーク内のアドレスの総数

      -- の属性: prefixlen

          ネットワークプレフィックスのビット長。

      -- メソッド: hosts ()

          Returns an iterator over the usable hosts in the network.  The
          usable hosts are all the IP addresses that belong to the
          network, except the network address itself and the network
          broadcast address.  For networks with a mask length of 31, the
          network address and network broadcast address are also
          included in the result.  Networks with a mask of 32 will
          return a list containing the single host address.

               >>> list(ip_network('192.0.2.0/29').hosts())
               [IPv4Address('192.0.2.1'), IPv4Address('192.0.2.2'),
                IPv4Address('192.0.2.3'), IPv4Address('192.0.2.4'),
                IPv4Address('192.0.2.5'), IPv4Address('192.0.2.6')]
               >>> list(ip_network('192.0.2.0/31').hosts())
               [IPv4Address('192.0.2.0'), IPv4Address('192.0.2.1')]
               >>> list(ip_network('192.0.2.1/32').hosts())
               [IPv4Address('192.0.2.1')]

      -- メソッド: overlaps (other)

          ‘True’ if this network is partly or wholly contained in
          'other' or 'other' is wholly contained in this network.

      -- メソッド: address_exclude (network)

          Computes the network definitions resulting from removing the
          given 'network' from this one.  Returns an iterator of network
          objects.  Raises *note ValueError: 2ec. if 'network' is not
          completely contained in this network.

               >>> n1 = ip_network('192.0.2.0/28')
               >>> n2 = ip_network('192.0.2.1/32')
               >>> list(n1.address_exclude(n2))
               [IPv4Network('192.0.2.8/29'), IPv4Network('192.0.2.4/30'),
                IPv4Network('192.0.2.2/31'), IPv4Network('192.0.2.0/32')]

      -- メソッド: subnets (prefixlen_diff=1, new_prefix=None)

          The subnets that join to make the current network definition,
          depending on the argument values.  'prefixlen_diff' is the
          amount our prefix length should be increased by.  'new_prefix'
          is the desired new prefix of the subnets; it must be larger
          than our prefix.  One and only one of 'prefixlen_diff' and
          'new_prefix' must be set.  Returns an iterator of network
          objects.

               >>> list(ip_network('192.0.2.0/24').subnets())
               [IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/25')]
               >>> list(ip_network('192.0.2.0/24').subnets(prefixlen_diff=2))
               [IPv4Network('192.0.2.0/26'), IPv4Network('192.0.2.64/26'),
                IPv4Network('192.0.2.128/26'), IPv4Network('192.0.2.192/26')]
               >>> list(ip_network('192.0.2.0/24').subnets(new_prefix=26))
               [IPv4Network('192.0.2.0/26'), IPv4Network('192.0.2.64/26'),
                IPv4Network('192.0.2.128/26'), IPv4Network('192.0.2.192/26')]
               >>> list(ip_network('192.0.2.0/24').subnets(new_prefix=23))
               Traceback (most recent call last):
                 File "<stdin>", line 1, in <module>
                   raise ValueError('new prefix must be longer')
               ValueError: new prefix must be longer
               >>> list(ip_network('192.0.2.0/24').subnets(new_prefix=25))
               [IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/25')]

      -- メソッド: supernet (prefixlen_diff=1, new_prefix=None)

          The supernet containing this network definition, depending on
          the argument values.  'prefixlen_diff' is the amount our
          prefix length should be decreased by.  'new_prefix' is the
          desired new prefix of the supernet; it must be smaller than
          our prefix.  One and only one of 'prefixlen_diff' and
          'new_prefix' must be set.  Returns a single network object.

               >>> ip_network('192.0.2.0/24').supernet()
               IPv4Network('192.0.2.0/23')
               >>> ip_network('192.0.2.0/24').supernet(prefixlen_diff=2)
               IPv4Network('192.0.0.0/22')
               >>> ip_network('192.0.2.0/24').supernet(new_prefix=20)
               IPv4Network('192.0.0.0/20')

      -- メソッド: subnet_of (other)

          このネットワークが 'other' のサブネットの場合に ‘True’ を返し
          ます。

               >>> a = ip_network('192.168.1.0/24')
               >>> b = ip_network('192.168.1.128/30')
               >>> b.subnet_of(a)
               True

          Added in version 3.7.

      -- メソッド: supernet_of (other)

          このネットワークが 'other' のスーパーネットの場合に ‘True’ を
          返します。

               >>> a = ip_network('192.168.1.0/24')
               >>> b = ip_network('192.168.1.128/30')
               >>> a.supernet_of(b)
               True

          Added in version 3.7.

      -- メソッド: compare_networks (other)

          このネットワークを 'other' と比較します。比較ではネットワーク
          アドレスのみが考慮され、ホストアドレスは考慮されません。‘-1’、
          ‘0’、‘1’ のいずれかを返します。

               >>> ip_network('192.0.2.1/32').compare_networks(ip_network('192.0.2.2/32'))
               -1
               >>> ip_network('192.0.2.1/32').compare_networks(ip_network('192.0.2.0/32'))
               1
               >>> ip_network('192.0.2.1/32').compare_networks(ip_network('192.0.2.1/32'))
               0

          バージョン 3.7 で非推奨: It uses the same ordering and
          comparison algorithm as "<", "==", and ">"

 -- クラス: ipaddress.IPv6Network (address, strict=True)

     IPv6 ネットワーク定義を構築します。'address' は以下の1つです:

       1. A string consisting of an IP address and an optional prefix
          length, separated by a slash (‘/’).  The IP address is the
          network address, and the prefix length must be a single
          number, the 'prefix'.  If no prefix length is provided, it's
          considered to be ‘/128’.

          Note that currently expanded netmasks are not supported.  That
          means ‘2001:db00::0/24’ is a valid argument while
          ‘2001:db00::0/ffff:ff00::’ is not.

       2. 128bit に収まる整数。これは1つのアドレスのネットワークと等しく
          、ネットワークアドレスが 'address' に、マスクが ‘/128’ になり
          ます。

       3. 16byte の *note bytes: 192. オブジェクトにビッグエンディアンで
          パックされた整数。これは整数の 'address' と同じように解釈され
          ます。

       4. A two-tuple of an address description and a netmask, where the
          address description is either a string, a 128-bits integer, a
          16-bytes packed integer, or an existing *note IPv6Address:
          50d. object; and the netmask is an integer representing the
          prefix length.

     'address' が有効な IPv6 アドレスでない場合に *note
     AddressValueError: 41cf. 例外を発生させます。マスクが IPv6 アドレス
     に対して有効でない場合に *note NetmaskValueError: 41f0. 例外を発生
     させます。

     'strict' が ‘True’ の場合、与えられたアドレスのホストビットが立って
     いたら *note ValueError: 2ec. を発生させます。そうでない場合、ホス
     トビットをマスクして正しいネットワークアドレスを計算します。

     バージョン 3.5 で変更: 'address' コンストラクタ引数に2要素のタプル
     形式を追加しました

      -- の属性: version

      -- の属性: max_prefixlen

      -- の属性: is_multicast

      -- の属性: is_private

      -- の属性: is_unspecified

      -- の属性: is_reserved

      -- の属性: is_loopback

      -- の属性: is_link_local

      -- の属性: network_address

      -- の属性: broadcast_address

      -- の属性: hostmask

      -- の属性: netmask

      -- の属性: with_prefixlen

      -- の属性: compressed

      -- の属性: exploded

      -- の属性: with_netmask

      -- の属性: with_hostmask

      -- の属性: num_addresses

      -- の属性: prefixlen

      -- メソッド: hosts ()

          Returns an iterator over the usable hosts in the network.  The
          usable hosts are all the IP addresses that belong to the
          network, except the Subnet-Router anycast address.  For
          networks with a mask length of 127, the Subnet-Router anycast
          address is also included in the result.  Networks with a mask
          of 128 will return a list containing the single host address.

      -- メソッド: overlaps (other)

      -- メソッド: address_exclude (network)

      -- メソッド: subnets (prefixlen_diff=1, new_prefix=None)

      -- メソッド: supernet (prefixlen_diff=1, new_prefix=None)

      -- メソッド: subnet_of (other)

      -- メソッド: supernet_of (other)

      -- メソッド: compare_networks (other)

          *note IPv4Network: 50e. の対応する属性のドキュメントを参照して
          ください。

      -- の属性: is_site_local

          This attribute is true for the network as a whole if it is
          true for both the network address and the broadcast address.


File: python.info,  Node: 演算子<3>,  Prev: Network オブジェクト,  Up: IP ネットワーク定義

5.22.23.11 演算子
.................

Network オブジェクトはいくつかの演算子をサポートします。明記されない限り
、演算子は互換性のあるオブジェクト間 (つまり IPv4 同士や IPv6 同士) での
み利用できます。

* Menu:

* 論理演算子::
* イテレーション::
* アドレスのコンテナとしてのネットワーク::


File: python.info,  Node: 論理演算子,  Next: イテレーション,  Up: 演算子<3>

5.22.23.12 論理演算子
.....................

Network objects can be compared with the usual set of logical operators.
Network objects are ordered first by network address, then by net mask.


File: python.info,  Node: イテレーション,  Next: アドレスのコンテナとしてのネットワーク,  Prev: 論理演算子,  Up: 演算子<3>

5.22.23.13 イテレーション
.........................

Network objects can be iterated to list all the addresses belonging to
the network.  For iteration, 'all' hosts are returned, including
unusable hosts (for usable hosts, use the *note hosts(): 17ae. method).
An example:

     >>> for addr in IPv4Network('192.0.2.0/28'):
     ...     addr
     ...
     IPv4Address('192.0.2.0')
     IPv4Address('192.0.2.1')
     IPv4Address('192.0.2.2')
     IPv4Address('192.0.2.3')
     IPv4Address('192.0.2.4')
     IPv4Address('192.0.2.5')
     IPv4Address('192.0.2.6')
     IPv4Address('192.0.2.7')
     IPv4Address('192.0.2.8')
     IPv4Address('192.0.2.9')
     IPv4Address('192.0.2.10')
     IPv4Address('192.0.2.11')
     IPv4Address('192.0.2.12')
     IPv4Address('192.0.2.13')
     IPv4Address('192.0.2.14')
     IPv4Address('192.0.2.15')


File: python.info,  Node: アドレスのコンテナとしてのネットワーク,  Prev: イテレーション,  Up: 演算子<3>

5.22.23.14 アドレスのコンテナとしてのネットワーク
.................................................

ネットワークオブジェクトは、アドレスのコンテナとして振舞えます。いくつか
例をあげます:

     >>> IPv4Network('192.0.2.0/28')[0]
     IPv4Address('192.0.2.0')
     >>> IPv4Network('192.0.2.0/28')[15]
     IPv4Address('192.0.2.15')
     >>> IPv4Address('192.0.2.6') in IPv4Network('192.0.2.0/28')
     True
     >>> IPv4Address('192.0.3.6') in IPv4Network('192.0.2.0/28')
     False


File: python.info,  Node: インターフェイスオブジェクト,  Next: その他のモジュールレベル関数,  Prev: IP ネットワーク定義,  Up: ipaddress --- IPv4/IPv6 操作ライブラリ

5.22.23.15 インターフェイスオブジェクト
.......................................

インターフェースオブジェクトは *note hashable: 824. なので、辞書のキーと
して使用できます。

 -- クラス: ipaddress.IPv4Interface (address)

     Construct an IPv4 interface.  The meaning of 'address' is as in the
     constructor of *note IPv4Network: 50e, except that arbitrary host
     addresses are always accepted.

     *note IPv4Interface: 1b99. is a subclass of *note IPv4Address: 50c,
     so it inherits all the attributes from that class.  In addition,
     the following attributes are available:

      -- の属性: ip

          The address (*note IPv4Address: 50c.) without network
          information.

               >>> interface = IPv4Interface('192.0.2.5/24')
               >>> interface.ip
               IPv4Address('192.0.2.5')

      -- の属性: network

          The network (*note IPv4Network: 50e.) this interface belongs
          to.

               >>> interface = IPv4Interface('192.0.2.5/24')
               >>> interface.network
               IPv4Network('192.0.2.0/24')

      -- の属性: with_prefixlen

          A string representation of the interface with the mask in
          prefix notation.

               >>> interface = IPv4Interface('192.0.2.5/24')
               >>> interface.with_prefixlen
               '192.0.2.5/24'

      -- の属性: with_netmask

          A string representation of the interface with the network as a
          net mask.

               >>> interface = IPv4Interface('192.0.2.5/24')
               >>> interface.with_netmask
               '192.0.2.5/255.255.255.0'

      -- の属性: with_hostmask

          A string representation of the interface with the network as a
          host mask.

               >>> interface = IPv4Interface('192.0.2.5/24')
               >>> interface.with_hostmask
               '192.0.2.5/0.0.0.255'

 -- クラス: ipaddress.IPv6Interface (address)

     Construct an IPv6 interface.  The meaning of 'address' is as in the
     constructor of *note IPv6Network: 50f, except that arbitrary host
     addresses are always accepted.

     *note IPv6Interface: 1b9a. is a subclass of *note IPv6Address: 50d,
     so it inherits all the attributes from that class.  In addition,
     the following attributes are available:

      -- の属性: ip

      -- の属性: network

      -- の属性: with_prefixlen

      -- の属性: with_netmask

      -- の属性: with_hostmask

          *note IPv4Interface: 1b99. の対応する属性のドキュメントを参照
          してください。

* Menu:

* 演算子: 演算子<4>.


File: python.info,  Node: 演算子<4>,  Up: インターフェイスオブジェクト

5.22.23.16 演算子
.................

Interface オブジェクトはいくつかの演算子をサポートします。明記されない限
り、演算子は互換性のあるオブジェクト間 (つまり IPv4 同士や IPv6 同士) で
のみ利用できます。

* Menu:

* 論理演算子: 論理演算子<2>.


File: python.info,  Node: 論理演算子<2>,  Up: 演算子<4>

5.22.23.17 論理演算子
.....................

Interface objects can be compared with the usual set of logical
operators.

For equality comparison (‘==’ and ‘!=’), both the IP address and network
must be the same for the objects to be equal.  An interface will not
compare equal to any address or network object.

For ordering (‘<’, ‘>’, etc) the rules are different.  Interface and
address objects with the same IP version can be compared, and the
address objects will always sort before the interface objects.  Two
interface objects are first compared by their networks and, if those are
the same, then by their IP addresses.


File: python.info,  Node: その他のモジュールレベル関数,  Next: Custom Exceptions,  Prev: インターフェイスオブジェクト,  Up: ipaddress --- IPv4/IPv6 操作ライブラリ

5.22.23.18 その他のモジュールレベル関数
.......................................

このモジュールは以下のモジュールレベル関数も提供しています:

 -- の関数: ipaddress.v4_int_to_packed (address)

     アドレスをネットワークバイトオーダー(ビッグエンディアン)でパックさ
     れた4バイトで表現します。 'address' は IPv4 IPアドレスを整数で表し
     たものです。整数が負だったり IPv4 IPアドレスとして大きすぎる場合は
     *note ValueError: 2ec. 例外を発生させます。

          >>> ipaddress.ip_address(3221225985)
          IPv4Address('192.0.2.1')
          >>> ipaddress.v4_int_to_packed(3221225985)
          b'\xc0\x00\x02\x01'

 -- の関数: ipaddress.v6_int_to_packed (address)

     アドレスをネットワークバイトオーダー(ビッグエンディアン)でパックさ
     れた16バイトで表現します。 'address' は IPv6 IPアドレスを整数で表し
     たものです。整数が負だったり IPv6 IPアドレスとして大きすぎる場合は
     *note ValueError: 2ec. 例外を発生させます。

 -- の関数: ipaddress.summarize_address_range (first, last)

     first と last で指定された IPアドレス帯に対するイテレーターを返しま
     す。 'first' はアドレス帯の中の最初の *note IPv4Address: 50c. か
     *note IPv6Address: 50d. で、 'last' はアドレス帯の中の最後の *note
     IPv4Address: 50c. か *note IPv6Address: 50d. です。 'first' か
     'last' がIPアドレスでない場合や、2つの型が揃っていない場合に、
     *note TypeError: 198. を発生させます。 'last' が 'first' より大きく
     ない場合や、 'first' アドレスのバージョンが 4 でも 6 でもない場合は
     *note ValueError: 2ec. を発生させます。

          >>> [ipaddr for ipaddr in ipaddress.summarize_address_range(
          ...    ipaddress.IPv4Address('192.0.2.0'),
          ...    ipaddress.IPv4Address('192.0.2.130'))]
          [IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/31'), IPv4Network('192.0.2.130/32')]

 -- の関数: ipaddress.collapse_addresses (addresses)

     Return an iterator of the collapsed *note IPv4Network: 50e. or
     *note IPv6Network: 50f. objects.  'addresses' is an *note iterable:
     12f1. of *note IPv4Network: 50e. or *note IPv6Network: 50f.
     objects.  A *note TypeError: 198. is raised if 'addresses' contains
     mixed version objects.

          >>> [ipaddr for ipaddr in
          ... ipaddress.collapse_addresses([ipaddress.IPv4Network('192.0.2.0/25'),
          ... ipaddress.IPv4Network('192.0.2.128/25')])]
          [IPv4Network('192.0.2.0/24')]

 -- の関数: ipaddress.get_mixed_type_key (obj)

     ネットワークとアドレスをソートするための key 関数を返します。アドレ
     スとネットワークは本質的に違うものなので、デフォルトでは比較できま
     せん。そのため、次の式は:

          IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24')

     doesn't make sense.  There are some times however, where you may
     wish to have ‘ipaddress’ sort these anyway.  If you need to do
     this, you can use this function as the 'key' argument to *note
     sorted(): dc7.

     'obj' はネットワークオブジェクトかアドレスオブジェクトのどちらかで
     す。


File: python.info,  Node: Custom Exceptions,  Prev: その他のモジュールレベル関数,  Up: ipaddress --- IPv4/IPv6 操作ライブラリ

5.22.23.19 Custom Exceptions
............................

クラスのコンストラクタがより具体的なエラー報告をするために、このモジュー
ルでは以下の例外を定義します:

 -- 例外: ipaddress.AddressValueError (ValueError)

     Any value error related to the address.

 -- 例外: ipaddress.NetmaskValueError (ValueError)

     Any value error related to the net mask.


File: python.info,  Node: マルチメディアサービス,  Next: 国際化,  Prev: インターネットプロトコルとサポート,  Up: Python 標準ライブラリ

5.23 マルチメディアサービス
===========================

この章で記述されているモジュールは、主にマルチメディアアプリケーションに
役立つさまざまなアルゴリズムまたはインターフェイスを実装しています。これ
らのモジュールはインストール時の自由裁量に応じて利用できます:

* Menu:

* wave: wave --- WAV ファイルの読み書き. WAV ファイルの読み書き
* colorsys: colorsys --- 色体系間の変換. 色体系間の変換


File: python.info,  Node: wave --- WAV ファイルの読み書き,  Next: colorsys --- 色体系間の変換,  Up: マルチメディアサービス

5.23.1 ‘wave’ -- WAV ファイルの読み書き
---------------------------------------

'ソースコード:' Lib/wave.py(1)

__________________________________________________________________

The ‘wave’ module provides a convenient interface to the Waveform Audio
"WAVE" (or "WAV") file format.  Only uncompressed PCM encoded wave files
are supported.

バージョン 3.12 で変更: Support for ‘WAVE_FORMAT_EXTENSIBLE’ headers was
added, provided that the extended format is ‘KSDATAFORMAT_SUBTYPE_PCM’.

The ‘wave’ module defines the following function and exception:

 -- の関数: wave.open (file, mode=None)

     'file' が文字列ならその名前のファイルを開き、そうでないなら file
     like オブジェクトとして扱います。 'mode' は以下のうちのいずれかです
     :

     ‘'rb'’

          読み出しのみのモード。

     ‘'wb'’

          書き込みのみのモード。

     WAVファイルに対して読み込み／書き込み両方のモードで開くことはできな
     いことに注意して下さい。

     'mode' が ‘'rb'’ の場合 *note Wave_read: 336. オブジェクトを返し、
     ‘'wb'’ の場合 *note Wave_write: 337. オブジェクトを返します。
     'mode' が省略されていて、 file-like オブジェクトが 'file' として渡
     されると、 ‘file.mode’ が 'mode' のデフォルト値として使われます。

     If you pass in a file-like object, the wave object will not close
     it when its ‘close()’ method is called; it is the caller's
     responsibility to close the file object.

     The *note open(): b45. function may be used in a *note with: 186.
     statement.  When the ‘with’ block completes, the *note
     Wave_read.close(): 4240. or *note Wave_write.close(): 4241. method
     is called.

     バージョン 3.4 で変更: シーク不能なファイルのサポートが追加されまし
     た。

 -- 例外: wave.Error

     WAVの仕様を犯したり、実装の欠陥に遭遇して何か実行不可能となった時に
     発生するエラー。

* Menu:

* Wave_read オブジェクト::
* Wave_write オブジェクト::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/wave.py


File: python.info,  Node: Wave_read オブジェクト,  Next: Wave_write オブジェクト,  Up: wave --- WAV ファイルの読み書き

5.23.1.1 Wave_read オブジェクト
...............................

 -- クラス: wave.Wave_read

     Read a WAV file.

     *note open(): b45. によって返される Wave_read オブジェクトには、以
     下のメソッドがあります:

      -- メソッド: close ()

          Close the stream if it was opened by ‘wave’, and make the
          instance unusable.  This is called automatically on object
          collection.

      -- メソッド: getnchannels ()

          オーディオチャンネル数（モノラルなら ‘1’ 、ステレオなら ‘2’ ）
          を返します。

      -- メソッド: getsampwidth ()

          サンプルサイズをバイト数で返します。

      -- メソッド: getframerate ()

          サンプリングレートを返します。

      -- メソッド: getnframes ()

          オーディオフレーム数を返します。

      -- メソッド: getcomptype ()

          圧縮形式を返します（ ‘'NONE'’ だけがサポートされている形式です
          ）。

      -- メソッド: getcompname ()

          *note getcomptype(): 4249. を人に判読可能な形にしたものです。
          通常、 ‘'NONE'’ に対して ‘'not compressed'’ が返されます。

      -- メソッド: getparams ()

          Returns a *note namedtuple(): 4e0. ‘(nchannels, sampwidth,
          framerate, nframes, comptype, compname)’, equivalent to output
          of the ‘get*()’ methods.

      -- メソッド: readframes (n)

          最大 'n' 個のオーディオフレームを読み込んで、 *note bytes:
          192. オブジェクトとして返します。

      -- メソッド: rewind ()

          ファイルのポインタをオーディオストリームの先頭に戻します。

     The following two methods are defined for compatibility with the
     old ‘aifc’ module, and don't do anything interesting.

      -- メソッド: getmarkers ()

          ‘None’ を返します。

          Deprecated since version 3.13, will be removed in version
          3.15: The method only existed for compatibility with the
          ‘aifc’ module which has been removed in Python 3.13.

      -- メソッド: getmark (id)

          エラーを発生します。

          Deprecated since version 3.13, will be removed in version
          3.15: The method only existed for compatibility with the
          ‘aifc’ module which has been removed in Python 3.13.

     以下の2つのメソッドは共通の"位置"を定義しています。"位置"は他の関数
     とは独立して実装されています。

      -- メソッド: setpos (pos)

          ファイルのポインタを指定した位置に設定します。

      -- メソッド: tell ()

          ファイルの現在のポインタ位置を返します。


File: python.info,  Node: Wave_write オブジェクト,  Prev: Wave_read オブジェクト,  Up: wave --- WAV ファイルの読み書き

5.23.1.2 Wave_write オブジェクト
................................

 -- クラス: wave.Wave_write

     Write a WAV file.

     Wave_write objects, as returned by *note open(): b45.

     For seekable output streams, the ‘wave’ header will automatically
     be updated to reflect the number of frames actually written.  For
     unseekable streams, the 'nframes' value must be accurate when the
     first frame data is written.  An accurate 'nframes' value can be
     achieved either by calling *note setnframes(): 4250. or *note
     setparams(): 4251. with the number of frames that will be written
     before *note close(): 4241. is called and then using *note
     writeframesraw(): 11ee. to write the frame data, or by calling
     *note writeframes(): 11ef. with all of the frame data to be
     written.  In the latter case *note writeframes(): 11ef. will
     calculate the number of frames in the data and set 'nframes'
     accordingly before writing the frame data.

     バージョン 3.4 で変更: シーク不能なファイルのサポートが追加されまし
     た。

     Wave_write objects have the following methods:

      -- メソッド: close ()

          Make sure 'nframes' is correct, and close the file if it was
          opened by ‘wave’.  This method is called upon object
          collection.  It will raise an exception if the output stream
          is not seekable and 'nframes' does not match the number of
          frames actually written.

      -- メソッド: setnchannels (n)

          チャンネル数を設定します。

      -- メソッド: setsampwidth (n)

          サンプルサイズを 'n' バイトに設定します。

      -- メソッド: setframerate (n)

          サンプリングレートを 'n' に設定します。

          バージョン 3.2 で変更: 整数ではない値がこのメソッドに入力され
          た場合は、直近の整数に丸められます。

      -- メソッド: setnframes (n)

          フレーム数を 'n' に設定します。もし実際に書き込まれたフレーム
          の数と異なるなら、これは後で変更されます (出力ストリームがシー
          ク不能なら、更新しようとした時にエラーが起きます)。

      -- メソッド: setcomptype (type, name)

          圧縮形式とその記述を設定します。現在のところ、非圧縮を示す圧縮
          形式 ‘NONE’ だけがサポートされています。

      -- メソッド: setparams (tuple)

          The 'tuple' should be ‘(nchannels, sampwidth, framerate,
          nframes, comptype, compname)’, with values valid for the
          ‘set*()’ methods.  Sets all parameters.

      -- メソッド: tell ()

          ファイルの中の現在位置を返します。 *note Wave_read.tell():
          424e. と *note Wave_read.setpos(): 424d. メソッドでお断りした
          ことがこのメソッドにも当てはまります。

      -- メソッド: writeframesraw (data)

          'nframes' の修正なしにオーディオフレームを書き込みます。

          バージョン 3.4 で変更: どのような *note bytes-like object:
          193. も使用できるようになりました。

      -- メソッド: writeframes (data)

          出力ストリームが seek 不可能で、 'data' が書き込まれた後でそれ
          以前に 'nframes' に設定された値と書き込まれた全フレーム数が一
          致しなければ、エラーを送出します。

          バージョン 3.4 で変更: どのような *note bytes-like object:
          193. も使用できるようになりました。

          *note writeframes(): 11ef. や *note writeframesraw(): 11ee. メ
          ソッドを呼び出したあとで、どんなパラメータを設定しようとしても
          不正となることに注意して下さい。そうすると *note wave.Error:
          4242. を発生します。


File: python.info,  Node: colorsys --- 色体系間の変換,  Prev: wave --- WAV ファイルの読み書き,  Up: マルチメディアサービス

5.23.2 ‘colorsys’ -- 色体系間の変換
-----------------------------------

'ソースコード:' Lib/colorsys.py(1)

__________________________________________________________________

The ‘colorsys’ module defines bidirectional conversions of color values
between colors expressed in the RGB (Red Green Blue) color space used in
computer monitors and three other coordinate systems: YIQ, HLS (Hue
Lightness Saturation) and HSV (Hue Saturation Value).  Coordinates in
all of these color spaces are floating-point values.  In the YIQ space,
the Y coordinate is between 0 and 1, but the I and Q coordinates can be
positive or negative.  In all other spaces, the coordinates are all
between 0 and 1.

参考
....

色空間に関するより詳細な情報は ‘https://poynton.ca/ColorFAQ.html’ と
‘https://www.cambridgeincolour.com/tutorials/color-spaces.htm’ にありま
す。

The ‘colorsys’ module defines the following functions:

 -- の関数: colorsys.rgb_to_yiq (r, g, b)

     RGB から YIQ に変換します。

 -- の関数: colorsys.yiq_to_rgb (y, i, q)

     YIQ から RGB に変換します。

 -- の関数: colorsys.rgb_to_hls (r, g, b)

     RGB から HLS に変換します。

 -- の関数: colorsys.hls_to_rgb (h, l, s)

     HLS から RGB に変換します。

 -- の関数: colorsys.rgb_to_hsv (r, g, b)

     RGB から HSV に変換します。

 -- の関数: colorsys.hsv_to_rgb (h, s, v)

     HSV から RGB に変換します。

以下はプログラム例です:

     >>> import colorsys
     >>> colorsys.rgb_to_hsv(0.2, 0.4, 0.4)
     (0.5, 0.5, 0.4)
     >>> colorsys.hsv_to_rgb(0.5, 0.5, 0.4)
     (0.2, 0.4, 0.4)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/colorsys.py


File: python.info,  Node: 国際化,  Next: Graphical user interfaces with Tk,  Prev: マルチメディアサービス,  Up: Python 標準ライブラリ

5.24 国際化
===========

この章で解説されるモジュールは、プログラムのメッセージで使用される言語を
選択したり、または出力を地域の習慣に従って変更するメカニズムを提供して、
言語やロケールに依存しないソフトの開発を手助けします。

この章で解説されるモジュールのリスト:

* Menu:

* gettext: gettext --- 多言語国際化サービス. 多言語国際化サービス
* locale: locale --- 国際化サービス. 国際化サービス


File: python.info,  Node: gettext --- 多言語国際化サービス,  Next: locale --- 国際化サービス,  Up: 国際化

5.24.1 ‘gettext’ -- 多言語国際化サービス
----------------------------------------

'ソースコード:' Lib/gettext.py(1)

__________________________________________________________________

The ‘gettext’ module provides internationalization (I18N) and
localization (L10N) services for your Python modules and applications.
It supports both the GNU ‘gettext’ message catalog API and a higher
level, class-based API that may be more appropriate for Python files.
The interface described below allows you to write your module and
application messages in one natural language, and provide a catalog of
translated messages for running under different natural languages.

ここでは Python のモジュールやアプリケーションを地域化するためのいくつか
のヒントも提供しています。

* Menu:

* GNU gettext API::
* クラス形式の API::
* プログラムやモジュールを国際化する::
* 謝辞: 謝辞<9>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/gettext.py


File: python.info,  Node: GNU gettext API,  Next: クラス形式の API,  Up: gettext --- 多言語国際化サービス

5.24.1.1 GNU ‘gettext’ API
..........................

The ‘gettext’ module defines the following API, which is very similar to
the GNU ‘gettext’ API. If you use this API you will affect the
translation of your entire application globally.  Often this is what you
want if your application is monolingual, with the choice of language
dependent on the locale of your user.  If you are localizing a Python
module, or if your application needs to switch languages on the fly, you
probably want to use the class-based API instead.

 -- の関数: gettext.bindtextdomain (domain, localedir=None)

     Bind the 'domain' to the locale directory 'localedir'.  More
     concretely, ‘gettext’ will look for binary ‘.mo’ files for the
     given domain using the path (on Unix):
     ‘`localedir'/`language'/LC_MESSAGES/`domain'.mo’, where 'language'
     is searched for in the environment variables ‘LANGUAGE’, ‘LC_ALL’,
     ‘LC_MESSAGES’, and ‘LANG’ respectively.

     'localedir' が省略されるか ‘None’ の場合、現在 'domain' に対応付け
     られているロケールディレクトリが返されます。 (1)

 -- の関数: gettext.textdomain (domain=None)

     現在のグローバルドメインを変更したり調べたりします。 'domain' が
     ‘None’ の場合、現在のグローバルドメインが返されます。それ以外の場合
     には、グローバルドメインに 'domain' を設定し、その設定されたグロー
     バルドメインを返します。

 -- の関数: gettext.gettext (message)

     Return the localized translation of 'message', based on the current
     global domain, language, and locale directory.  This function is
     usually aliased as ‘_()’ in the local namespace (see examples
     below).

 -- の関数: gettext.dgettext (domain, message)

     *note gettext(): 1682. と同様ですが、指定された 'domain' からメッセ
     ージを探します。

 -- の関数: gettext.ngettext (singular, plural, n)

     *note gettext(): 1682. と同様ですが、複数形を考慮しています。 翻訳
     が見つかった場合、複数形の選択公式を 'n' に適用し、その結果得られた
     メッセージを返します (言語によっては二つ以上の複数形があります)。 翻
     訳が見つからなかった場合、 'n' が 1 なら 'singular' を返します; そ
     うでない場合 'plural' を返します。

     複数形の選択公式はカタログのヘッダから取得されます。 選択公式は自由
     変数 'n' を持つ C または Python の式です; その式の評価結果はカタロ
     グにある複数形のインデックスになります。 ‘.po’ ファイルで用いられる
     詳細な文法と、様々な言語における選択公式については GNU gettext ドキ
     ュメント(2) を参照してください。

 -- の関数: gettext.dngettext (domain, singular, plural, n)

     *note ngettext(): 4269. と同様ですが、指定された 'domain' からメッ
     セージを探します。

 -- の関数: gettext.pgettext (context, message)

 -- の関数: gettext.dpgettext (domain, context, message)

 -- の関数: gettext.npgettext (context, singular, plural, n)

 -- の関数: gettext.dnpgettext (domain, context, singular, plural, n)

     Similar to the corresponding functions without the ‘p’ in the
     prefix (that is, *note gettext(): 67, *note dgettext(): 4268, *note
     ngettext(): 4269, *note dngettext(): 426a.), but the translation is
     restricted to the given message 'context'.

     Added in version 3.8.

Note that GNU ‘gettext’ also defines a ‘dcgettext()’ method, but this
was deemed not useful and so it is currently unimplemented.

以下にこの API の典型的な使用法を示します:

     import gettext
     gettext.bindtextdomain('myapplication', '/path/to/my/language/directory')
     gettext.textdomain('myapplication')
     _ = gettext.gettext
     # ...
     print(_('This is a translatable string.'))

   ---------- Footnotes ----------

   (1) The default locale directory is system dependent; for example, on
Red Hat Linux it is ‘/usr/share/locale’, but on Solaris it is
‘/usr/lib/locale’.  The ‘gettext’ module does not try to support these
system dependent defaults; instead its default is
‘`sys.base_prefix'/share/locale’ (see *note sys.base_prefix: 3e6.).  For
this reason, it is always best to call *note bindtextdomain(): 4266.
with an explicit absolute path at the start of your application.

   (2) https://www.gnu.org/software/gettext/manual/gettext.html


File: python.info,  Node: クラス形式の API,  Next: プログラムやモジュールを国際化する,  Prev: GNU gettext API,  Up: gettext --- 多言語国際化サービス

5.24.1.2 クラス形式の API
.........................

The class-based API of the ‘gettext’ module gives you more flexibility
and greater convenience than the GNU ‘gettext’ API. It is the
recommended way of localizing your Python applications and modules.
‘gettext’ defines a *note GNUTranslations: 426f. class which implements
the parsing of GNU ‘.mo’ format files, and has methods for returning
strings.  Instances of this class can also install themselves in the
built-in namespace as the function ‘_()’.

 -- の関数: gettext.find (domain, localedir=None, languages=None,
          all=False)

     この関数は標準的な ‘.mo’ ファイル検索アルゴリズムを実装しています。
     *note textdomain(): 4267. と同じく、 'domain' を引数にとります。オ
     プションの 'localedir' は *note bindtextdomain(): 4266. と同じです
     。またオプションの 'languages' は文字列を列挙したリストで、各文字列
     は言語コードを表します。

     'localedir' が与えられていない場合、標準のシステムロケールディレク
     トリが使われます。 (1) 'languages' が与えられなかった場合、以下の環
     境変数: ‘LANGUAGE’ 、 ‘LC_ALL’ 、 ‘LC_MESSAGES’ 、および ‘LANG’ が
     検索されます。空でない値を返した最初の候補が 'languages' 変数として
     使われます。この環境変数は言語名をコロンで分かち書きしたリストを含
     んでいなければなりません。 *note find(): 4270. はこの文字列をコロン
     で分割し、言語コードの候補リストを生成します。

     *note find(): 4270. は次に言語コードを展開および正規化し、リストの
     各要素について、以下のパス構成:

     ‘`localedir'/`language'/LC_MESSAGES/`domain'.mo’

     からなる実在するファイルの探索を反復的に行います。 *note find():
     4270. は上記のような実在するファイルで最初に見つかったものを返しま
     す。該当するファイルが見つからなかった場合、 ‘None’ が返されます。
     'all' が与えられていれば、全ファイル名のリストが言語リストまたは環
     境変数で指定されている順番に並べられたものを返します。

 -- の関数: gettext.translation (domain, localedir=None, languages=None,
          class_=None, fallback=False)

     Return a ‘*Translations’ instance based on the 'domain',
     'localedir', and 'languages', which are first passed to *note
     find(): 4270. to get a list of the associated ‘.mo’ file paths.
     Instances with identical ‘.mo’ file names are cached.  The actual
     class instantiated is 'class_' if provided, otherwise *note
     GNUTranslations: 426f.  The class's constructor must take a single
     *note file object: 13db. argument.

     複数の ‘.mo’ ファイルがあった場合、後ろのファイルは前のファイルのフ
     ォールバックとして利用されます。 フォールバックの設定のために、
     *note copy.copy(): 757. を使いキャッシュから翻訳オブジェクトを複製
     します; こうすることで、実際のインスタンスデータはキャッシュのもの
     と共有されたままになります。

     ‘.mo’ ファイルが見つからなかった場合、 'fallback' が偽 (デフォルト
     値) ならこの関数は *note OSError: 2c0. を送出し、 'fallback' が真な
     ら *note NullTranslations: 4271. インスタンスが返されます。

     バージョン 3.3 で変更: 以前は *note IOError: 125e. が送出されました
     ; それは現在 *note OSError: 2c0. のエイリアスです。

     バージョン 3.11 で変更: 'codeset' parameter is removed.

 -- の関数: gettext.install (domain, localedir=None, *, names=None)

     This installs the function ‘_()’ in Python's builtins namespace,
     based on 'domain' and 'localedir' which are passed to the function
     *note translation(): c6d.

     'names' パラメータについては、翻訳オブジェクトの *note install():
     4272. メソッドの説明を参照ください。

     As seen below, you usually mark the strings in your application
     that are candidates for translation, by wrapping them in a call to
     the ‘_()’ function, like this:

          print(_('This string will be translated.'))

     For convenience, you want the ‘_()’ function to be installed in
     Python's builtins namespace, so it is easily accessible in all
     modules of your application.

     バージョン 3.11 で変更: 'names' is now a keyword-only parameter.

* Menu:

* NullTranslations クラス::
* GNUTranslations クラス::
* Solaris メッセージカタログ機構のサポート::
* Catalog コンストラクタ::

   ---------- Footnotes ----------

   (1) 上の *note bindtextdomain(): 4266. に関する脚注を参照してください
。


File: python.info,  Node: NullTranslations クラス,  Next: GNUTranslations クラス,  Up: クラス形式の API

5.24.1.3 ‘NullTranslations’ クラス
..................................

翻訳クラスは、元のソースファイル中のメッセージ文字列から翻訳されたメッセ
ージ文字列への変換処理が実際に実装されているクラスです。 全ての翻訳クラ
スで基底クラスとして使われているクラスが *note NullTranslations: 4271. で
す; このクラスは、独自の翻訳クラスを実装するのに使える基本的なインターフ
ェースを提供しています。 以下に ‘NullTranslations’ のメソッドを示します:

 -- クラス: gettext.NullTranslations (fp=None)

     オプションの *note ファイルオブジェクト: 13db. 'fp' を取ります。こ
     の引数は基底クラスでは無視されます。このメソッドは "保護された
     (protected)" インスタンス変数 '_info' および '_charset' を初期化し
     ます。これらの変数の値は派生クラスで設定することができます。同様に
     '_fallback' も初期化しますが、この値は *note add_fallback(): 4274.
     で設定されます。その後、 'fp' が ‘None’ でない場合
     ‘self._parse(fp)’ を呼び出します。

      -- メソッド: _parse (fp)

          基底クラスでは何もしない (no-op) ようになっています。このメソ
          ッドの役割はファイルオブジェクト 'fp' を引数に取り、ファイルか
          らデータを読み出し、メッセージカタログを初期化することです。サ
          ポートされていないメッセージカタログ形式を使っている場合、その
          形式を解釈するためにはこのメソッドを上書きしなくてはなりません
          。

      -- メソッド: add_fallback (fallback)

          'fallback' を現在の翻訳オブジェクトの代替オブジェクトとして追
          加します。翻訳オブジェクトが与えられたメッセージに対して翻訳メ
          ッセージを提供できない場合、この代替オブジェクトに問い合わせる
          ことになります。

      -- メソッド: gettext (message)

          フォールバックが設定されている場合、フォールバックの
          ‘gettext()’ に処理を移譲します。 そうでない場合、引数として受
          け取った 'message' を返します。 派生クラスで上書きするメソッド
          です。

      -- メソッド: ngettext (singular, plural, n)

          フォールバックが設定されている場合、フォールバックの
          ‘ngettext()’ に処理を移譲します。 そうでない場合、 'n' が 1 な
          ら 'singular' を返します; それ以外なら 'plural' を返します。 派
          生クラスで上書きするメソッドです。

      -- メソッド: pgettext (context, message)

          代替オブジェクトが設定されている場合、 *note pgettext(): be8.
          を代替オブジェクトに転送します。そうでない場合、翻訳されたメッ
          セージを返します。派生クラスで上書きするメソッドです。

          Added in version 3.8.

      -- メソッド: npgettext (context, singular, plural, n)

          代替オブジェクトが設定されている場合、 *note npgettext():
          426c. を代替オブジェクトに転送します。そうでない場合、翻訳され
          たメッセージを返します。派生クラスで上書きするメソッドです。

          Added in version 3.8.

      -- メソッド: info ()

          Return a dictionary containing the metadata found in the
          message catalog file.

      -- メソッド: charset ()

          メッセージカタログファイルのエンコーディングを返します。

      -- メソッド: install (names=None)

          このメソッドは *note gettext(): 4276. を組み込み名前空間にイン
          ストールし、変数 ‘_’ に束縛します。

          If the 'names' parameter is given, it must be a sequence
          containing the names of functions you want to install in the
          builtins namespace in addition to ‘_()’.  Supported names are
          ‘'gettext'’, ‘'ngettext'’, ‘'pgettext'’, and ‘'npgettext'’.

          Note that this is only one way, albeit the most convenient
          way, to make the ‘_()’ function available to your application.
          Because it affects the entire application globally, and
          specifically the built-in namespace, localized modules should
          never install ‘_()’.  Instead, they should use this code to
          make ‘_()’ available to their module:

               import gettext
               t = gettext.translation('mymodule', ...)
               _ = t.gettext

          This puts ‘_()’ only in the module's global namespace and so
          only affects calls within this module.

          バージョン 3.8 で変更: ‘'pgettext'’ と ‘'npgettext'’ が追加さ
          れました。


File: python.info,  Node: GNUTranslations クラス,  Next: Solaris メッセージカタログ機構のサポート,  Prev: NullTranslations クラス,  Up: クラス形式の API

5.24.1.4 ‘GNUTranslations’ クラス
.................................

The ‘gettext’ module provides one additional class derived from *note
NullTranslations: 4271.: *note GNUTranslations: 426f.  This class
overrides ‘_parse()’ to enable reading GNU ‘gettext’ format ‘.mo’ files
in both big-endian and little-endian format.

*note GNUTranslations: 426f. parses optional metadata out of the
translation catalog.  It is convention with GNU ‘gettext’ to include
metadata as the translation for the empty string.  This metadata is in
RFC 822(1)-style ‘key: value’ pairs, and should contain the
‘Project-Id-Version’ key.  If the key ‘Content-Type’ is found, then the
‘charset’ property is used to initialize the "protected" ‘_charset’
instance variable, defaulting to ‘None’ if not found.  If the charset
encoding is specified, then all message ids and message strings read
from the catalog are converted to Unicode using this encoding, else
ASCII is assumed.

Since message ids are read as Unicode strings too, all ‘*gettext()’
methods will assume message ids as Unicode strings, not byte strings.

The entire set of key/value pairs are placed into a dictionary and set
as the "protected" ‘_info’ instance variable.

‘.mo’ ファイルのマジックナンバーが不正な場合や、メジャーバージョン番号が
予期されないものの場合、あるいはその他の問題がファイルの読み出し中に発生
した場合、 *note GNUTranslations: 426f. クラスのインスタンス化で *note
OSError: 2c0. が送出されることがあります。

 -- クラス: gettext.GNUTranslations

     以下のメソッドは基底クラスの実装からオーバライドされています:

      -- メソッド: gettext (message)

          カタログから 'message' id を検索して、対応するメッセージ文字列
          を Unicode でエンコードして返します。 'message' id に対応する
          エントリがカタログに存在せず、フォールバックが設定されている場
          合、検索処理をフォールバックの *note gettext(): 4276. メソッド
          に移譲します。 それ以外の場合は、 'message' id 自体が返されま
          す。

      -- メソッド: ngettext (singular, plural, n)

          メッセージ id に対する複数形を検索します。カタログに対する検索
          では 'singular' がメッセージ id として用いられ、 'n' にはどの
          複数形を用いるかを指定します。返されるメッセージ文字列は
          Unicode 文字列です。

          メッセージ id がカタログ中に見つからず、フォールバックが指定さ
          れている場合は、メッセージ検索要求はフォールバックの *note
          ngettext(): 4277. メソッドに移譲されます。 それ以外の場合、
          'n' が 1 ならば 'singular' が返され、それ以外なら 'plural' が
          返されます。

          以下に例を示します。:

               n = len(os.listdir('.'))
               cat = GNUTranslations(somefile)
               message = cat.ngettext(
                   'There is %(num)d file in this directory',
                   'There are %(num)d files in this directory',
                   n) % {'num': n}

      -- メソッド: pgettext (context, message)

          カタログから 'context' と 'message' id を検索して、対応するメ
          ッセージ文字列を、 Unicode でエンコードして返します。
          'message' id と 'context' に対するエントリがカタログに存在せず
          、フォールバックが設定されている場合、フォールバック検索はオブ
          ジェクトの *note pgettext(): be8. メソッドに転送されます。そう
          でない場合、 'message' id 自体が返されます。

          Added in version 3.8.

      -- メソッド: npgettext (context, singular, plural, n)

          メッセージ id に対する複数形を検索します。カタログに対する検索
          では 'singular' がメッセージ id として用いられ、 'n' にはどの
          複数形を用いるかを指定します。

          'context' に対するメッセージ id がカタログ中に見つからず、フォ
          ールバックオブジェクトが指定されている場合、メッセージ検索要求
          はフォールバックオブジェクトの *note npgettext(): 426c. メソッ
          ドに転送されます。そうでない場合、 'n' が 1 ならば 'singular'
          が返され、それ以外に対しては 'plural' が返されます。

          Added in version 3.8.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc822.html


File: python.info,  Node: Solaris メッセージカタログ機構のサポート,  Next: Catalog コンストラクタ,  Prev: GNUTranslations クラス,  Up: クラス形式の API

5.24.1.5 Solaris メッセージカタログ機構のサポート
.................................................

Solaris オペレーティングシステムでは、独自の ‘.mo’ バイナリファイル形式
を定義していますが、この形式に関するドキュメントが手に入らないため、現時
点ではサポートされていません。


File: python.info,  Node: Catalog コンストラクタ,  Prev: Solaris メッセージカタログ機構のサポート,  Up: クラス形式の API

5.24.1.6 Catalog コンストラクタ
...............................

GNOME uses a version of the ‘gettext’ module by James Henstridge, but
this version has a slightly different API. Its documented usage was:

     import gettext
     cat = gettext.Catalog(domain, localedir)
     _ = cat.gettext
     print(_('hello world'))

For compatibility with this older module, the function ‘Catalog()’ is an
alias for the *note translation(): c6d. function described above.

このモジュールと Henstridge のバージョンとの間には一つ相違点があります:
彼のカタログオブジェクトはマップ型の API を介したアクセスがサポートされ
ていましたが、この API は使われていないらしく、現在はサポートされていま
せん。


File: python.info,  Node: プログラムやモジュールを国際化する,  Next: 謝辞<9>,  Prev: クラス形式の API,  Up: gettext --- 多言語国際化サービス

5.24.1.7 プログラムやモジュールを国際化する
...........................................

国際化 (I18N, I-nternationalizatio-N) とは、プログラムを複数の言語に対応
させる操作を指します。地域化 (L10N, L-ocalizatio-N) とは、すでに国際化さ
れているプログラムを特定地域の言語や文化的な事情に対応させることを指しま
す。Python プログラムに多言語メッセージ機能を追加するには、以下の手順を
踏む必要があります:

  1. プログラムやモジュールで翻訳対象とする文字列に特殊なマークをつけて
     準備します

  2. マークづけをしたファイルに一連のツールを走らせ、生のメッセージカタ
     ログを生成します

  3. 特定の言語へのメッセージカタログの翻訳を作成します

  4. use the ‘gettext’ module so that message strings are properly
     translated

In order to prepare your code for I18N, you need to look at all the
strings in your files.  Any string that needs to be translated should be
marked by wrapping it in ‘_('...')’ -- that is, a call to the function
*note _: 67.  For example:

     filename = 'mylog.txt'
     message = _('writing a log message')
     with open(filename, 'w') as fp:
         fp.write(message)

この例では、文字列 ‘'writing a log message'’ が翻訳対象候補としてマーク
付けされており、文字列 ‘'mylog.txt'’ および ‘'w'’ はされていません。

翻訳対象の文字列を抽出するツールもあります。 オリジナルの GNU ‘gettext’
は C と C++ のソースコードしかサポートしませんが、拡張版の ‘xgettext’ は
Python を含めた多くの言語で書かれたコードを読み取り、翻訳できる文字列を
発見します。 Babel(1) は Python の国際化ライブラリで、翻訳文字列の抽出と
メッセージカタログのコンパイルを行う ‘pybabel’ スクリプトがあります。
François Pinard が開発した ‘xpot’ と呼ばれるプログラムは同じような処理を
行え、彼の po-utils package(2) の一部として利用可能です。

(Python には ‘pygettext.py’ および ‘msgfmt.py’ という名前の pure-Python
版プログラムもあります; これをインストールしてくれる Python ディストリビ
ューションもあります。 ‘pygettext.py’ は ‘xgettext’ に似たプログラムです
が Python のソースコードしか理解できず、 C や C++ のような他のプログラミ
ング言語を扱えません。 ‘pygettext.py’ は ‘xgettext’ と同様のコマンドライ
ンインターフェースをサポートしています; 詳しい使い方については
‘pygettext.py --help’ と実行してください。 ‘msgfmt.py’ は GNU ‘msgfmt’ と
バイナリ互換性があります。 この2つのプログラムがあれば、 GNU ‘gettext’ パ
ッケージを使わずに Python アプリケーションを国際化できるでしょう。)

‘xgettext’ や ‘pygettext’ のようなツールは、メッセージカタログである
‘.po’ ファイルを生成します。 このファイルは人間が判読可能な構造をしてい
て、ソースコード中のマークが着けられた文字列と、その文字列の仮置きの訳文
が一緒に書き込まれています。

Copies of these ‘.po’ files are then handed over to the individual human
translators who write translations for every supported natural language.
They send back the completed language-specific versions as a
‘<language-name>.po’ file that's compiled into a machine-readable ‘.mo’
binary catalog file using the ‘msgfmt’ program.  The ‘.mo’ files are
used by the ‘gettext’ module for the actual translation processing at
run-time.

How you use the ‘gettext’ module in your code depends on whether you are
internationalizing a single module or your entire application.  The next
two sections will discuss each case.

* Menu:

* モジュールを地域化する::
* アプリケーションを地域化する::
* 動作中 (on the fly) に言語を切り替える: 動作中 on the fly に言語を切り替える.
* 翻訳処理の遅延解決::

   ---------- Footnotes ----------

   (1) https://babel.pocoo.org/

   (2) https://github.com/pinard/po-utils


File: python.info,  Node: モジュールを地域化する,  Next: アプリケーションを地域化する,  Up: プログラムやモジュールを国際化する

5.24.1.8 モジュールを地域化する
...............................

モジュールを地域化する場合、グローバルな変更、例えば組み込み名前空間への
変更を行わないように注意しなければなりません。GNU ‘gettext’ API ではなく
、クラス形式の API を使うべきです。

仮に対象のモジュール名を "spam" とし、モジュールの各言語における翻訳が収
められた ‘.mo’ ファイルが ‘/usr/share/locale’ に GNU ‘gettext’ 形式で置
かれているとします。この場合、モジュールの最初で以下のようにします:

     import gettext
     t = gettext.translation('spam', '/usr/share/locale')
     _ = t.gettext


File: python.info,  Node: アプリケーションを地域化する,  Next: 動作中 on the fly に言語を切り替える,  Prev: モジュールを地域化する,  Up: プログラムやモジュールを国際化する

5.24.1.9 アプリケーションを地域化する
.....................................

If you are localizing your application, you can install the ‘_()’
function globally into the built-in namespace, usually in the main
driver file of your application.  This will let all your
application-specific files just use ‘_('...')’ without having to
explicitly install it in each file.

単純な場合では、単に以下の短いコードをアプリケーションの主ドライバファイ
ルに追加するだけです:

     import gettext
     gettext.install('myapplication')

ロケールの辞書を設定する必要がある場合、*note install(): c6e. 関数に渡す
ことが出来ます:

     import gettext
     gettext.install('myapplication', '/usr/share/locale')


File: python.info,  Node: 動作中 on the fly に言語を切り替える,  Next: 翻訳処理の遅延解決,  Prev: アプリケーションを地域化する,  Up: プログラムやモジュールを国際化する

5.24.1.10 動作中 (on the fly) に言語を切り替える
................................................

多くの言語を同時にサポートする必要がある場合、複数の翻訳インスタンスを生
成して、例えば以下のコードのように、インスタンスを明示的に切り替えてもか
まいません。:

     import gettext

     lang1 = gettext.translation('myapplication', languages=['en'])
     lang2 = gettext.translation('myapplication', languages=['fr'])
     lang3 = gettext.translation('myapplication', languages=['de'])

     # start by using language1
     lang1.install()

     # ... time goes by, user selects language 2
     lang2.install()

     # ... more time goes by, user selects language 3
     lang3.install()


File: python.info,  Node: 翻訳処理の遅延解決,  Prev: 動作中 on the fly に言語を切り替える,  Up: プログラムやモジュールを国際化する

5.24.1.11 翻訳処理の遅延解決
............................

コードを書く上では、ほとんどの状況で文字列はコードされた場所で翻訳されま
す。しかし場合によっては、翻訳対象として文字列をマークはするが、その後実
際に翻訳が行われるように遅延させる必要が生じます。古典的な例は以下のよう
なコートです:

     animals = ['mollusk',
                'albatross',
                'rat',
                'penguin',
                'python', ]
     # ...
     for a in animals:
         print(a)

ここで、リスト ‘animals’ 内の文字列は翻訳対象としてマークはしたいが、文
字列が出力されるまで実際に翻訳を行うのは避けたいとします。

こうした状況を処理する一つの方法を以下に示します:

     def _(message): return message

     animals = [_('mollusk'),
                _('albatross'),
                _('rat'),
                _('penguin'),
                _('python'), ]

     del _

     # ...
     for a in animals:
         print(_(a))

This works because the dummy definition of ‘_()’ simply returns the
string unchanged.  And this dummy definition will temporarily override
any definition of ‘_()’ in the built-in namespace (until the *note del:
1b1f. command).  Take care, though if you have a previous definition of
‘_()’ in the local namespace.

Note that the second use of ‘_()’ will not identify "a" as being
translatable to the ‘gettext’ program, because the parameter is not a
string literal.

もう一つの処理法は、以下の例のようなやり方です:

     def N_(message): return message

     animals = [N_('mollusk'),
                N_('albatross'),
                N_('rat'),
                N_('penguin'),
                N_('python'), ]

     # ...
     for a in animals:
         print(_(a))

In this case, you are marking translatable strings with the function
‘N_()’, which won't conflict with any definition of ‘_()’.  However, you
will need to teach your message extraction program to look for
translatable strings marked with ‘N_()’.  ‘xgettext’, ‘pygettext’,
‘pybabel extract’, and ‘xpot’ all support this through the use of the
‘-k’ command-line switch.  The choice of ‘N_()’ here is totally
arbitrary; it could have just as easily been
‘MarkThisStringForTranslation()’.


File: python.info,  Node: 謝辞<9>,  Prev: プログラムやモジュールを国際化する,  Up: gettext --- 多言語国際化サービス

5.24.1.12 謝辞
..............

以下の人々が、このモジュールのコード、フィードバック、設計に関する助言、
過去の実装、そして有益な経験談による貢献をしてくれました:

   * Peter Funk

   * James Henstridge

   * Juan David Ibáñez Palomar

   * Marc-André Lemburg

   * Martin von Löwis

   * François Pinard

   * Barry Warsaw

   * Gustavo Niemeyer

脚注
....


File: python.info,  Node: locale --- 国際化サービス,  Prev: gettext --- 多言語国際化サービス,  Up: 国際化

5.24.2 ‘locale’ -- 国際化サービス
---------------------------------

'ソースコード:' Lib/locale.py(1)

__________________________________________________________________

The ‘locale’ module opens access to the POSIX locale database and
functionality.  The POSIX locale mechanism allows programmers to deal
with certain cultural issues in an application, without requiring the
programmer to know all the specifics of each country where the software
is executed.

The ‘locale’ module is implemented on top of the ‘_locale’ module, which
in turn uses an ANSI C locale implementation if available.

The ‘locale’ module defines the following exception and functions:

 -- 例外: locale.Error

     *note setlocale(): 328. に渡されたロケールが認識されない場合例外が
     送出されます。

 -- の関数: locale.setlocale (category, locale=None)

     If 'locale' is given and not ‘None’, *note setlocale(): 328.
     modifies the locale setting for the 'category'.  The available
     categories are listed in the data description below.  'locale' may
     be a *note string: 428d, or a pair, language code and encoding.  An
     empty string specifies the user's default settings.  If the
     modification of the locale fails, the exception *note Error: 428c.
     is raised.  If successful, the new locale setting is returned.

     If 'locale' is a pair, it is converted to a locale name using the
     locale aliasing engine.  The language code has the same format as a
     *note locale name: 428d, but without encoding and ‘@’-modifier.
     The language code and encoding can be ‘None’.

     'locale' が省略されたり ‘None’ の場合、'category' の現在の設定が返
     されます。

     以下はプログラム例です:

          >>> import locale
          >>> loc = locale.setlocale(locale.LC_ALL)  # get current locale
          # use German locale; name and availability varies with platform
          >>> locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
          >>> locale.strcoll('f\xe4n', 'foo')  # compare a string containing an umlaut
          >>> locale.setlocale(locale.LC_ALL, '')   # use user's preferred locale
          >>> locale.setlocale(locale.LC_ALL, 'C')  # use default (C) locale
          >>> locale.setlocale(locale.LC_ALL, loc)  # restore saved locale

     *note setlocale(): 328. is not thread-safe on most systems.
     Applications typically start with a call of:

          import locale
          locale.setlocale(locale.LC_ALL, '')

     から書き始めます。これは全てのカテゴリをユーザの環境における標準設
     定 (大抵は環境変数 ‘LANG’ で指定されています) に設定します。その後
     複数スレッドを使ってロケールを変更したりしない限り、問題は起こらな
     いはずです。

 -- の関数: locale.localeconv ()

     地域的な慣行のデータベースを辞書として返します。辞書は以下の文字列
     をキーとして持っています:

     カテゴリ                   キー                                      意味
                                                                          
     ----------------------------------------------------------------------------------------------------------
                                                                          
     *note LC_NUMERIC: 428e.    ‘'decimal_point'’                         小数点を表す文字です。
                                                                          
                                                                          
                                ‘'grouping'’                              ‘'thousands_sep'’ が来るかもしれな
                                                                          い場所を相対的に表した数からなる配
                                                                          列です。配列が
                                                                          *note CHAR_MAX: 428f. で終端されて
                                                                          いる場合、それ以上の桁では桁数字の
                                                                          グループ化を行いません。配列が ‘0’
                                                                          で終端されている場合、最後に指定し
                                                                          たグループが反復的に使われます。
                                                                          
                                                                          
                                ‘'thousands_sep'’                         桁グループ間を区切るために使われる
                                                                          文字です。
                                                                          
                                                                          
     *note LC_MONETARY: 4290.   ‘'int_curr_symbol'’                       国際通貨を表現する記号です。
                                                                          
                                                                          
                                ‘'currency_symbol'’                       地域的な通貨を表現する記号です。
                                                                          
                                                                          
                                ‘'p_cs_precedes/n_cs_precedes'’           通貨記号が値の前につくかどうかです
                                                                          (それぞれ正の値、負の値を表します
                                                                          )。
                                                                          
                                                                          
                                ‘'p_sep_by_space/n_sep_by_space'’         通貨記号と値との間にスペースを入れ
                                                                          るかどうかです (それぞれ正の値、負
                                                                          の値を表します)。
                                                                          
                                                                          
                                ‘'mon_decimal_point'’                     金額表示の際に使われる小数点です。
                                                                          
                                                                          
                                ‘'frac_digits'’                           金額を地域的な方法で表現する際の小
                                                                          数点以下の桁数です。
                                                                          
                                                                          
                                ‘'int_frac_digits'’                       金額を国際的な方法で表現する際の小
                                                                          数点以下の桁数です。
                                                                          
                                                                          
                                ‘'mon_thousands_sep'’                     金額表示の際に桁区切り記号です。
                                                                          
                                                                          
                                ‘'mon_grouping'’                          ‘'grouping'’ と同じで、金額表示の
                                                                          際に使われます。
                                                                          
                                                                          
                                ‘'positive_sign'’                         正の値の金額表示に使われる記号です
                                                                          。
                                                                          
                                                                          
                                ‘'negative_sign'’                         負の値の金額表示に使われる記号です
                                                                          。
                                                                          
                                                                          
                                ‘'p_sign_posn/n_sign_posn'’               符号の位置です (それぞれ正の値と負
                                                                          の値を表します)。以下を参照してく
                                                                          ださい。
                                                                          

     数値形式の値に *note CHAR_MAX: 428f. を設定すると、そのロケールでは
     値が指定されていないことを表します。

     ‘'p_sign_posn'’ および ‘'n_sign_posn'’ の取り得る値は以下の通りです
     。

     値                 説明
                        
     -----------------------------------------------------------------
                        
     ‘0’                通貨記号および値は丸括弧で囲われます。
                        
                        
     ‘1’                符号は値と通貨記号より前に来ます。
                        
                        
     ‘2’                符号は値と通貨記号の後に続きます。
                        
                        
     ‘3’                符号は値の直前に来ます。
                        
                        
     ‘4’                符号は値の直後に来ます。
                        
                        
     ‘CHAR_MAX’         このロケールでは特に指定しません。
                        

     ‘LC_NUMERIC’ ロケールや ‘LC_MONETARY’ ロケールが ‘LC_CTYPE’ ロケー
     ルと異なっていて、数値文字列や通貨文字列が非 ASCII 文字列の場合、こ
     の関数は一時的に ‘LC_NUMERIC’ ロケールや ‘LC_MONETARY’ ロケールに
     ‘LC_CTYPE’ ロケールを設定します。 この一時的な変更は他のスレッドに
     影響を及ぼします。

     バージョン 3.7 で変更: この関数は、一時的に ‘LC_NUMERIC’ ロケールに
     ‘LC_CTYPE’ ロケールを設定する場合があります。

 -- の関数: locale.nl_langinfo (option)

     ロケール特有の情報を文字列として返します。この関数は全てのシステム
     で利用可能なわけではなく、指定できる 'option' もプラットフォーム間
     で大きく異なります。引数として使えるのは、locale モジュールで利用可
     能なシンボル定数を表す数字です。

     関数 *note nl_langinfo(): 454. は以下のキーのうち一つを受理します。
     ほとんどの記述は GNU C ライブラリ中の対応する説明から引用されていま
     す。

      -- データ: locale.CODESET

          選択されたロケールで用いられている文字エンコーディングの名前を
          文字列で取得します。

      -- データ: locale.D_T_FMT

          日付と時刻をロケール特有の方法で表現するために、 *note
          time.strftime(): 1402. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: locale.D_FMT

          日付をロケール特有の方法で表現するために、 *note
          time.strftime(): 1402. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: locale.T_FMT

          時刻をロケール特有の方法で表現するために、 *note
          time.strftime(): 1402. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: locale.T_FMT_AMPM

          時刻を午前／午後の書式で表現するために、 *note
          time.strftime(): 1402. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: locale.DAY_1
      -- データ: locale.DAY_2
      -- データ: locale.DAY_3
      -- データ: locale.DAY_4
      -- データ: locale.DAY_5
      -- データ: locale.DAY_6
      -- データ: locale.DAY_7

          1 週間中の n 番目の曜日名を取得します。

               注釈: ロケール US における、 *note DAY_1: 4296. を日曜日
               とする慣行に従っています。国際的な (ISO 8601) 月曜日を週
               の初めとする慣行ではありません。

      -- データ: locale.ABDAY_1
      -- データ: locale.ABDAY_2
      -- データ: locale.ABDAY_3
      -- データ: locale.ABDAY_4
      -- データ: locale.ABDAY_5
      -- データ: locale.ABDAY_6
      -- データ: locale.ABDAY_7

          1 週間中の n 番目の曜日名を略式表記で取得します。

      -- データ: locale.MON_1
      -- データ: locale.MON_2
      -- データ: locale.MON_3
      -- データ: locale.MON_4
      -- データ: locale.MON_5
      -- データ: locale.MON_6
      -- データ: locale.MON_7
      -- データ: locale.MON_8
      -- データ: locale.MON_9
      -- データ: locale.MON_10
      -- データ: locale.MON_11
      -- データ: locale.MON_12

          n 番目の月の名前を取得します。

      -- データ: locale.ABMON_1
      -- データ: locale.ABMON_2
      -- データ: locale.ABMON_3
      -- データ: locale.ABMON_4
      -- データ: locale.ABMON_5
      -- データ: locale.ABMON_6
      -- データ: locale.ABMON_7
      -- データ: locale.ABMON_8
      -- データ: locale.ABMON_9
      -- データ: locale.ABMON_10
      -- データ: locale.ABMON_11
      -- データ: locale.ABMON_12

          n 番目の月の名前を略式表記で取得します。

      -- データ: locale.RADIXCHAR

          基数点 (小数点ドット、あるいは小数点コンマ、等) を取得します。

      -- データ: locale.THOUSEP

          1000 単位桁区切り (3 桁ごとのグループ化) の区切り文字を取得し
          ます。

      -- データ: locale.YESEXPR

          肯定／否定で答える質問に対する肯定回答を正規表現関数で認識する
          ために利用できる正規表現を取得します。

      -- データ: locale.NOEXPR

          Get a regular expression that can be used with the ‘regex(3)’
          function to recognize a negative response to a yes/no
          question.

               注釈: The regular expressions for *note YESEXPR: 42be.
               and *note NOEXPR: 42bf. use syntax suitable for the
               ‘regex’ function from the C library, which might differ
               from the syntax used in *note re: be.

      -- データ: locale.CRNCYSTR

          通貨シンボルを取得します。シンボルを値の前に表示させる場合には
          "-"、値の後ろに表示させる場合には "+"、シンボルを基数点と置き
          換える場合には "."  を前につけます。

      -- データ: locale.ERA

          Get a string which describes how years are counted and
          displayed for each era in a locale.

          ほとんどのロケールではこの値を定義していません。この値を設定し
          ているロケールの例は Japanese です。日本には日付の伝統的な表示
          法として、時の天皇に対応する元号名があります。

          Normally it should not be necessary to use this value
          directly.  Specifying the ‘E’ modifier in their format strings
          causes the *note time.strftime(): 1402. function to use this
          information.  The format of the returned string is specified
          in 'The Open Group Base Specifications Issue 8', paragraph
          7.3.5.2 LC_TIME C-Language Access(2).

      -- データ: locale.ERA_D_T_FMT

          日付および時間をロケール固有の年代に基づいた方法で表現するため
          に、 *note time.strftime(): 1402. の書式文字列として用いること
          のできる文字列を取得します。

      -- データ: locale.ERA_D_FMT

          日付をロケール固有の年代に基づいた方法で表現するために、 *note
          time.strftime(): 1402. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: locale.ERA_T_FMT

          時刻をロケール固有の年代に基づいた方法で表現するために、 *note
          time.strftime(): 1402. の書式文字列として用いることのできる文
          字列を取得します。

      -- データ: locale.ALT_DIGITS

          Get a string consisting of up to 100 semicolon-separated
          symbols used to represent the values 0 to 99 in a
          locale-specific way.  In most locales this is an empty string.

     The function temporarily sets the ‘LC_CTYPE’ locale to the locale
     of the category that determines the requested value (‘LC_TIME’,
     ‘LC_NUMERIC’, ‘LC_MONETARY’ or ‘LC_MESSAGES’) if locales are
     different and the resulting string is non-ASCII. This temporary
     change affects other threads.

     バージョン 3.14 で変更: The function now temporarily sets the
     ‘LC_CTYPE’ locale in some cases.

 -- の関数: locale.getdefaultlocale ([envvars])

     標準のロケール設定を取得しようと試み、結果をタプル ‘(language code,
     encoding)’ の形式で返します。

     POSIXによると、 ‘setlocale(LC_ALL, '')’ を呼ばなかったプログラムは
     、移植可能な ‘'C'’ ロケール設定を使います。 ‘setlocale(LC_ALL, '')’
     を呼ぶことで、 ‘LANG’ 変数で定義された標準のロケール設定を使うよう
     になります。 Python では現在のロケール設定に干渉したくないので、上
     で述べたような方法でその挙動をエミュレーションしています。

     他のプラットフォームとの互換性を維持するために、環境変数 ‘LANG’ だ
     けでなく、引数 'envvars' で指定された環境変数のリストも調べられます
     。最初に見つかった定義が使われます。 'envvars' は標準では GNU
     gettext で使われている検索順になります; これは常に変数名 ‘LANG’ を
     探します。GNU gettext では ‘'LC_ALL'’ 、 ‘'LC_CTYPE'’ 、 ‘'LANG'’ 、
     および ‘'LANGUAGE'’ の順に調べられます。

     The language code has the same format as a *note locale name: 428d,
     but without encoding and ‘@’-modifier.  The language code and
     encoding may be ‘None’ if their values cannot be determined.  The
     "C" locale is represented as ‘(None, None)’.

     Deprecated since version 3.11, will be removed in version 3.15.

 -- の関数: locale.getlocale (category=LC_CTYPE)

     Returns the current setting for the given locale category as a
     tuple containing the language code and encoding.  'category' may be
     one of the ‘LC_*’ values except *note LC_ALL: 42c6.  It defaults to
     *note LC_CTYPE: 42c7.

     The language code has the same format as a *note locale name: 428d,
     but without encoding and ‘@’-modifier.  The language code and
     encoding may be ‘None’ if their values cannot be determined.  The
     "C" locale is represented as ‘(None, None)’.

 -- の関数: locale.getpreferredencoding (do_setlocale=True)

     テキストデータに使われる *note ロケールエンコーディング: 54a. を、
     ユーザの設定に基づいて返します。ユーザの設定は異なるシステム間では
     異なった方法で表現され、システムによってはプログラミング的に得るこ
     とができないこともあるので、この関数が返すのはただの推測です。

     システムによっては、ユーザの設定を取得するために *note setlocale():
     328. を呼び出す必要があるため、この関数はスレッド安全ではありません
     。 *note setlocale(): 328. を呼び出す必要がない、または呼び出したく
     ない場合、 'do_setlocale' を ‘False’ に設定する必要があります。

     On Android or if the *note Python UTF-8 Mode: 866. is enabled,
     always return ‘'utf-8'’, the *note locale encoding: 54a. and the
     'do_setlocale' argument are ignored.

     The *note Python preinitialization: 42c8. configures the LC_CTYPE
     locale.  See also the *note filesystem encoding and error handler:
     75d.

     バージョン 3.7 で変更: この関数は、 Android 上あるいは *note Python
     UTF-8 モード: 866. が有効になっている場合、常に ‘"utf-8"’ を返すよ
     うになりました。

 -- の関数: locale.getencoding ()

     Get the current *note locale encoding: 54a.:

        * On Android and VxWorks, return ‘"utf-8"’.

        * On Unix, return the encoding of the current *note LC_CTYPE:
          42c7. locale.  Return ‘"utf-8"’ if ‘nl_langinfo(CODESET)’
          returns an empty string: for example, if the current LC_CTYPE
          locale is not supported.

        * On Windows, return the ANSI code page.

     The *note Python preinitialization: 42c8. configures the LC_CTYPE
     locale.  See also the *note filesystem encoding and error handler:
     75d.

     This function is similar to *note getpreferredencoding(False): 75c.
     except this function ignores the *note Python UTF-8 Mode: 866.

     Added in version 3.11.

 -- の関数: locale.normalize (localename)

     与えたロケール名を規格化したロケールコードを返します。返されるロケ
     ールコードは *note setlocale(): 328. で使うために書式化されています
     。規格化が失敗した場合、もとの名前がそのまま返されます。

     与えたエンコードがシステムにとって未知の場合、標準の設定では、この
     関数は *note setlocale(): 328. と同様に、エンコーディングをロケール
     コードにおける標準のエンコーディングに設定します。

 -- の関数: locale.strcoll (string1, string2)

     現在の *note LC_COLLATE: 42cb. 設定に従って二つの文字列を比較します
     。他の比較を行う関数と同じように、 'string1' が 'string2' に対して
     前に来るか、後に来るか、あるいは二つが等しいかによって、それぞれ負
     の値、正の値、あるいは ‘0’ を返します。

 -- の関数: locale.strxfrm (string)

     文字列を、ロケールを考慮した比較に使える形式に変換します。例えば、
     ‘strxfrm(s1) < strxfrm(s2)’ は ‘strcoll(s1, s2) < 0’ と等価です。こ
     の関数は同じ文字列が何度も比較される場合、例えば文字列からなるシー
     ケンスを順序付けて並べる際に使うことができます。

 -- の関数: locale.format_string (format, val, grouping=False,
          monetary=False)

     Formats a number 'val' according to the current *note LC_NUMERIC:
     428e. setting.  The format follows the conventions of the ‘%’
     operator.  For floating-point values, the decimal point is modified
     if appropriate.  If 'grouping' is ‘True’, also takes the grouping
     into account.

     'monetary' が真なら、桁区切り記号やグループ化文字列を用いて変換を行
     います。

     ‘format % val’ 形式のフォーマット指定子を、現在のロケール設定を考慮
     したうえで処理します。

     バージョン 3.7 で変更: 'monetary' キーワード引数が追加されました。

 -- の関数: locale.currency (val, symbol=True, grouping=False,
          international=False)

     数値 'val' を、現在の *note LC_MONETARY: 4290. の設定にあわせてフォ
     ーマットします。

     'symbol' が真の場合は、返される文字列に通貨記号が含まれるようになり
     ます。これはデフォルトの設定です。'grouping' が ‘True’ の場合(これ
     はデフォルトではありません)は、値をグループ化します。
     'international' が ‘True’ の場合(これはデフォルトではありません)は
     、国際的な通貨記号を使用します。

          注釈: この関数は 'C' ロケールでは動作しないので、まず *note
          setlocale(): 328. でロケールを設定する必要があります。

 -- の関数: locale.str (float)

     Formats a floating-point number using the same format as the
     built-in function ‘str(float)’, but takes the decimal point into
     account.

 -- の関数: locale.delocalize (string)

     文字列を *note LC_NUMERIC: 428e. で設定された慣行に従って正規化され
     た数値文字列に変換します。

     Added in version 3.5.

 -- の関数: locale.localize (string, grouping=False, monetary=False)

     Converts a normalized number string into a formatted string
     following the *note LC_NUMERIC: 428e. settings.

     Added in version 3.10.

 -- の関数: locale.atof (string, func=float)

     Converts a string to a number, following the *note LC_NUMERIC:
     428e. settings, by calling 'func' on the result of calling *note
     delocalize(): 1026. on 'string'.

 -- の関数: locale.atoi (string)

     文字列を *note LC_NUMERIC: 428e. で設定された慣行に従って整数に変換
     します。

 -- データ: locale.LC_CTYPE

     Locale category for the character type functions.  Most
     importantly, this category defines the text encoding, i.e.  how
     bytes are interpreted as Unicode codepoints.  See PEP 538(3) and
     PEP 540(4) for how this variable might be automatically coerced to
     ‘C.UTF-8’ to avoid issues created by invalid settings in containers
     or incompatible settings passed over remote SSH connections.

     Python doesn't internally use locale-dependent character
     transformation functions from ‘ctype.h’.  Instead, ‘pyctype.h’
     provides locale-independent equivalents like *note Py_TOLOWER:
     1570.

 -- データ: locale.LC_COLLATE

     Locale category for sorting strings.  The functions *note
     strcoll(): 42ca. and *note strxfrm(): 17bd. of the ‘locale’ module
     are affected.

 -- データ: locale.LC_TIME

     時刻を書式化するためのロケールカテゴリです。 *note time.strftime():
     1402. はこのカテゴリに設定されている慣行に従います。

 -- データ: locale.LC_MONETARY

     金額に関係する値を書式化するためのロケールカテゴリです。設定可能な
     オプションは関数 *note localeconv(): df8. で得ることができます。

 -- データ: locale.LC_MESSAGES

     メッセージ表示のためのロケールカテゴリです。現在 Python はアプリケ
     ーション毎にロケールに対応したメッセージを出力する機能はサポートし
     ていません。 *note os.strerror(): 3024. が返すような、オペレーティ
     ングシステムによって表示されるメッセージはこのカテゴリによって影響
     を受けます。

     This value may not be available on operating systems not conforming
     to the POSIX standard, most notably Windows.

 -- データ: locale.LC_NUMERIC

     Locale category for formatting numbers.  The functions *note
     format_string(): 742, *note atoi(): 42d0, *note atof(): 42cf. and
     *note str(): 42cd. of the ‘locale’ module are affected by that
     category.  All other numeric formatting operations are not
     affected.

 -- データ: locale.LC_ALL

     全てのロケール設定を総合したものです。ロケールを変更する際にこのフ
     ラグが使われた場合、そのロケールにおける全てのカテゴリを設定しよう
     と試みます。一つでも失敗したカテゴリがあった場合、全てのカテゴリに
     おいて設定変更を行いません。このフラグを使ってロケールを取得した場
     合、全てのカテゴリにおける設定を示す文字列が返されます。この文字列
     は、後に設定を元に戻すために使うことができます。

 -- データ: locale.CHAR_MAX

     *note localeconv(): df8. の返す特別な値のためのシンボル定数です。

* Menu:

* ロケールの背景、詳細、ヒント、助言および補足説明::
* Locale names::
* Python 拡張の作者と、Python を埋め込むようなプログラムに関して::
* メッセージカタログへのアクセス::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/locale.py

   (2) 
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap07.html#tag_07_03_05_02

   (3) https://peps.python.org/pep-0538/

   (4) https://peps.python.org/pep-0540/


File: python.info,  Node: ロケールの背景、詳細、ヒント、助言および補足説明,  Next: Locale names,  Up: locale --- 国際化サービス

5.24.2.1 ロケールの背景、詳細、ヒント、助言および補足説明
.........................................................

C 標準では、ロケールはプログラム全体にわたる特性であり、その変更は高価な
処理であるとしています。加えて、頻繁にロケールを変更するようなひどい実装
はコアダンプを引き起こすこともあります。このことがロケールを正しく利用す
る上で苦痛となっています。

最初、プログラムが起動したときには、ユーザの希望するロケールにかかわらず
ロケールは ‘C’ です。例外が1つあります: *note LC_CTYPE: 42c7. カテゴリは
、現在のロケールエンコーディングをユーザーの希望するロケールエンコーディ
ングに設定するために、スタートアップで変更されます。他のカテゴリについて
は、プログラムは ‘setlocale(LC_ALL, '')’ を呼び出して、明示的にユーザの
希望するロケール設定を行わなければなりません。

*note setlocale(): 328. をライブラリルーチン内で呼ぶことは、それがプログ
ラム全体に及ぼす副作用の面から、一般的によくない考えです。ロケールを保存
したり復帰したりするのもよくありません: 高価な処理であり、ロケールの設定
が復帰する以前に起動してしまった他のスレッドに悪影響を及ぼすからです。

もし、汎用を目的としたモジュールを作っていて、ロケールによって影響をうけ
るような操作 (例えば *note time.strftime(): 1402. の書式の一部) のロケー
ル独立のバージョンが必要ということになれば、標準ライブラリルーチンを使わ
ずに何とかしなければなりません。よりましな方法は、ロケール設定が正しく利
用できているか確かめることです。最後の手段は、あなたのモジュールが ‘C’ ロ
ケール以外の設定には互換性がないとドキュメントに書くことです。

The only way to perform numeric operations according to the locale is to
use the special functions defined by this module: *note atof(): 42cf,
*note atoi(): 42d0, *note format_string(): 742, *note str(): 42cd.

ロケールに従ってケース変換や文字分類を行う方法はありません。 (ユニコード
) テキスト文字列については、これらは文字の値のみによって行われます。その
一方、バイト文字列はバイトの ASCII 値に従って変換と分類が行われます。そ
して、上位ビットが立っているバイト (すなわち、non-ASCII バイト) は、決し
て変換されず、英字や空白などの文字クラスの一部とみなされることもありませ
ん。


File: python.info,  Node: Locale names,  Next: Python 拡張の作者と、Python を埋め込むようなプログラムに関して,  Prev: ロケールの背景、詳細、ヒント、助言および補足説明,  Up: locale --- 国際化サービス

5.24.2.2 Locale names
.....................

The format of the locale name is platform dependent, and the set of
supported locales can depend on the system configuration.

On Posix platforms, it usually has the format (1):

       language ["_" territory] ["." charset] ["@" modifier]

where 'language' is a two- or three-letter language code from ISO
639(2), 'territory' is a two-letter country or region code from ISO
3166(3), 'charset' is a locale encoding, and 'modifier' is a script
name, a language subtag, a sort order identifier, or other locale
modifier (for example, "latin", "valencia", "stroke" and "euro").

On Windows, several formats are supported.  (4)  (5)  A subset of IETF
BCP 47(6) tags:

       language ["-" script] ["-" territory] ["." charset]
       language ["-" script] "-" territory "-" modifier

where 'language' and 'territory' have the same meaning as in Posix,
'script' is a four-letter script code from ISO 15924(7), and 'modifier'
is a language subtag, a sort order identifier or custom modifier (for
example, "valencia", "stroke" or "x-python").  Both hyphen (‘'-'’) and
underscore (‘'_'’) separators are supported.  Only UTF-8 encoding is
allowed for BCP 47 tags.

Windows also supports locale names in the format:

       language ["_" territory] ["." charset]

where 'language' and 'territory' are full names, such as "English" and
"United States", and 'charset' is either a code page number (for
example, "1252") or UTF-8.  Only the underscore separator is supported
in this format.

The "C" locale is supported on all platforms.

   ---------- Footnotes ----------

   (1) IEEE Std 1003.1-2024; 8.2 Internationalization Variables
(https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap08.html#tag_08_02)

   (2) https://www.iso.org/iso-639-language-code

   (3) https://www.iso.org/iso-3166-country-codes.html

   (4) UCRT Locale names, Languages, and Country/Region strings
(https://learn.microsoft.com/en-us/cpp/c-runtime-library/locale-names-languages-and-country-region-strings)

   (5) Locale Names
(https://learn.microsoft.com/en-us/windows/win32/intl/locale-names)

   (6) https://www.rfc-editor.org/info/bcp47

   (7) https://www.unicode.org/iso15924/


File: python.info,  Node: Python 拡張の作者と、Python を埋め込むようなプログラムに関して,  Next: メッセージカタログへのアクセス,  Prev: Locale names,  Up: locale --- 国際化サービス

5.24.2.3 Python 拡張の作者と、Python を埋め込むようなプログラムに関して
.......................................................................

拡張モジュールは、現在のロケールを調べる以外は、決して *note
setlocale(): 328. を呼び出してはなりません。しかし、返される値もロケール
の復帰のために使えるだけなので、さほど便利とはいえません (例外はおそらく
ロケールが ‘C’ かどうか調べることでしょう)。

When Python code uses the ‘locale’ module to change the locale, this
also affects the embedding application.  If the embedding application
doesn't want this to happen, it should remove the ‘_locale’ extension
module (which does all the work) from the table of built-in modules in
the ‘config.c’ file, and make sure that the ‘_locale’ module is not
accessible as a shared library.


File: python.info,  Node: メッセージカタログへのアクセス,  Prev: Python 拡張の作者と、Python を埋め込むようなプログラムに関して,  Up: locale --- 国際化サービス

5.24.2.4 メッセージカタログへのアクセス
.......................................

 -- の関数: locale.gettext (msg)

 -- の関数: locale.dgettext (domain, msg)

 -- の関数: locale.dcgettext (domain, msg, category)

 -- の関数: locale.textdomain (domain)

 -- の関数: locale.bindtextdomain (domain, dir)

 -- の関数: locale.bind_textdomain_codeset (domain, codeset)

C ライブラリの gettext インタフェースが提供されているシステムでは、
locake モジュールでそのインタフェースを公開しています。このインタフェー
スは関数 *note gettext(): 67. 、 *note dgettext(): 42da. 、 *note
dcgettext(): 42db. 、 *note textdomain(): 42dc. 、 *note
bindtextdomain(): 42dd. 、および *note bind_textdomain_codeset(): 42de.
からなります。これらは *note gettext: 67. モジュールの同名の関数に似てい
ますが、メッセージカタログとして C ライブラリのバイナリフォーマットを使
い、メッセージカタログを探すために C ライブラリのサーチアルゴリズムを使
います。

Python applications should normally find no need to invoke these
functions, and should use *note gettext: 67. instead.  A known exception
to this rule are applications that link with additional C libraries
which internally invoke C functions ‘gettext’ or ‘dcgettext’.  For these
applications, it may be necessary to bind the text domain, so that the
libraries can properly locate their message catalogs.


File: python.info,  Node: Graphical user interfaces with Tk,  Next: 開発ツール,  Prev: 国際化,  Up: Python 標準ライブラリ

5.25 Graphical user interfaces with Tk
======================================

Tk/Tcl は長きにわたり Python の不可欠な一部でありつづけています。 Tk/Tcl
は頑健でプラットホームに依存しないウィンドウ構築ツールキットであり、
Python プログラマは *note tkinter: f6. パッケージやその拡張の *note
tkinter.ttk: ff. モジュールを使って利用できます。

*note tkinter: f6. パッケージはオブジェクトの薄い層で作ったTcl/Tkの最上
層です。*note tkinter: f6. を使うには、Tcl のコードを書く必要はありませ
んが、Tk のドキュメント、またはときどき、Tcl のドキュメントを調べる 必要
が出て来ます。*note tkinter: f6. は Python クラスとして実装した Tk ウィ
ジェットのラッパーの集合です。

*note tkinter: f6. の一番素晴らしい点は、速く、そしてほとんどの Python に
付属していることです。標準ドキュメントが頼りないものだとしても、代わりと
なる、リファレンス、チュートリアル、書籍その他が入手可能です。*note
tkinter: f6. は古臭いルックアンドフィールでも有名ですが、その点は Tk 8.5
で大きく改善されました。とはいえ、他にも興味を引きそうな GUI ライブラリ
は多数あります。 Python wiki には、いくつかの代替の GUI フレームワークと
ツール(1) の一覧があります。

* Menu:

* tkinter: tkinter --- Tcl/Tk の Python インターフェース. Tcl/Tk の Python インターフェース
* tkinter.colorchooser: tkinter colorchooser --- カラー選択ダイアログ. カラー選択ダイアログ
* tkinter.font: tkinter font --- Tkinter フォントラッパー. Tkinter フォントラッパー
* Tkinter ダイアログ::
* tkinter.messagebox: tkinter messagebox --- Tkinter メッセージプロンプト. Tkinter メッセージプロンプト
* tkinter.scrolledtext: tkinter scrolledtext --- スクロール可能なテキストウィジェット. スクロール可能なテキストウィジェット
* tkinter.dnd: tkinter dnd --- ドラッグアンドドロップのサポート. ドラッグアンドドロップのサポート
* tkinter.ttk: tkinter ttk --- Tk のテーマ付きウィジェット. Tk のテーマ付きウィジェット
* IDLE: IDLE --- Python のエディタとシェル<2>. Python のエディタとシェル
* turtle: turtle --- Turtle graphics. Turtle graphics

   ---------- Footnotes ----------

   (1) https://wiki.python.org/moin/GuiProgramming


File: python.info,  Node: tkinter --- Tcl/Tk の Python インターフェース,  Next: tkinter colorchooser --- カラー選択ダイアログ,  Up: Graphical user interfaces with Tk

5.25.1 ‘tkinter’ -- Tcl/Tk の Python インターフェース
-----------------------------------------------------

'ソースコード:' Lib/tkinter/__init__.py(1)

__________________________________________________________________

The ‘tkinter’ package ("Tk interface") is the standard Python interface
to the Tcl/Tk GUI toolkit.  Both Tk and ‘tkinter’ are available on most
Unix platforms, including macOS, as well as on Windows systems.

Running ‘python -m tkinter’ from the command line should open a window
demonstrating a simple Tk interface, letting you know that ‘tkinter’ is
properly installed on your system, and also showing what version of
Tcl/Tk is installed, so you can read the Tcl/Tk documentation specific
to that version.

Tkinter supports a range of Tcl/Tk versions, built either with or
without thread support.  The official Python binary release bundles
Tcl/Tk 8.6 threaded.  See the source code for the *note _tkinter: 3.
module for more information about supported versions.

Tkinter is not a thin wrapper, but adds a fair amount of its own logic
to make the experience more pythonic.  This documentation will
concentrate on these additions and changes, and refer to the official
Tcl/Tk documentation for details that are unchanged.

     注釈: Tcl/Tk 8.5 (2007) introduced a modern set of themed user
     interface components along with a new API to use them.  Both old
     and new APIs are still available.  Most documentation you will find
     online still uses the old API and can be woefully outdated.

This is an *note optional module: 215a.  If it is missing from your copy
of CPython, look for documentation from your distributor (that is,
whoever provided Python to you).  If you are the distributor, see *note
オプションのモジュールの要件: 2158.

参考
....

   * 
     TkDocs(2)

          Tkinterを使ったユーザインタフェースの作成に関する広範なチュー
          トリアルです。主要な概念を説明し、最新のAPI を使用した推奨され
          るアプローチを説明します。

   * 
     Tkinter 8.5 reference: a GUI for Python(3)

          参照: 利用可能なクラス、メソッド、オプションの詳細については、
          Tkinter 8.5のドキュメントを参照してください。

Tcl/Tk リソース:

   * 
     Tk commands(4)

          Comprehensive reference to each of the underlying Tcl/Tk
          commands used by Tkinter.

   * 
     Tcl/Tk ホームページ(5)

          Additional documentation, and links to Tcl/Tk core
          development.

Books:

   * 
     Modern Tkinter for Busy Python Developers(6)

          By Mark Roseman.  (ISBN 978-1999149567)

   * 
     Python GUI programming with Tkinter(7)

          By Alan D. Moore.  (ISBN 978-1788835886)

   * 
     Programming Python(8)

          By Mark Lutz; has excellent coverage of Tkinter.  (ISBN
          978-0596158101)

   * 
     Tcl and the Tk Toolkit (2nd edition)(9)

          By John Ousterhout, inventor of Tcl/Tk, and Ken Jones; does
          not cover Tkinter.  (ISBN 978-0321336330)

* Menu:

* Architecture::
* Tkinter モジュール::
* Tkinter お助け手帳::
* Threading model::
* 簡単なリファレンス::
* ファイルハンドラ::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/tkinter/__init__.py

   (2) https://tkdocs.com/

   (3) https://www.tkdocs.com/shipman/

   (4) https://www.tcl.tk/man/tcl8.6/TkCmd/contents.htm

   (5) https://www.tcl.tk

   (6) https://tkdocs.com/book.html

   (7) 
https://www.packtpub.com/en-us/product/python-gui-programming-with-tkinter-9781788835886

   (8) https://learning-python.com/about-pp4e.html

   (9) https://www.amazon.com/exec/obidos/ASIN/032133633X


File: python.info,  Node: Architecture,  Next: Tkinter モジュール,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.25.1.1 Architecture
.....................

Tcl/Tk is not a single library but rather consists of a few distinct
modules, each with separate functionality and its own official
documentation.  Python's binary releases also ship an add-on module
together with it.

Tcl

     Tcl is a dynamic interpreted programming language, just like
     Python.  Though it can be used on its own as a general-purpose
     programming language, it is most commonly embedded into C
     applications as a scripting engine or an interface to the Tk
     toolkit.  The Tcl library has a C interface to create and manage
     one or more instances of a Tcl interpreter, run Tcl commands and
     scripts in those instances, and add custom commands implemented in
     either Tcl or C. Each interpreter has an event queue, and there are
     facilities to send events to it and process them.  Unlike Python,
     Tcl's execution model is designed around cooperative multitasking,
     and Tkinter bridges this difference (see *note Threading model:
     42e6. for details).

Tk

     Tk is a Tcl package(1) implemented in C that adds custom commands
     to create and manipulate GUI widgets.  Each *note Tk: 19ac. object
     embeds its own Tcl interpreter instance with Tk loaded into it.
     Tk's widgets are very customizable, though at the cost of a dated
     appearance.  Tk uses Tcl's event queue to generate and process GUI
     events.

Ttk

     Themed Tk (Ttk) is a newer family of Tk widgets that provide a much
     better appearance on different platforms than many of the classic
     Tk widgets.  Ttk is distributed as part of Tk, starting with Tk
     version 8.5.  Python bindings are provided in a separate module,
     *note tkinter.ttk: ff.

Internally, Tk and Ttk use facilities of the underlying operating
system, i.e., Xlib on Unix/X11, Cocoa on macOS, GDI on Windows.

When your Python application uses a class in Tkinter, e.g., to create a
widget, the ‘tkinter’ module first assembles a Tcl/Tk command string.
It passes that Tcl command string to an internal *note _tkinter: 3.
binary module, which then calls the Tcl interpreter to evaluate it.  The
Tcl interpreter will then call into the Tk and/or Ttk packages, which
will in turn make calls to Xlib, Cocoa, or GDI.

   ---------- Footnotes ----------

   (1) https://wiki.tcl-lang.org/37432


File: python.info,  Node: Tkinter モジュール,  Next: Tkinter お助け手帳,  Prev: Architecture,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.25.1.2 Tkinter モジュール
...........................

Support for Tkinter is spread across several modules.  Most applications
will need the main ‘tkinter’ module, as well as the *note tkinter.ttk:
ff. module, which provides the modern themed widget set and API:

     from tkinter import *
     from tkinter import ttk

 -- クラス: tkinter.Tk (screenName=None, baseName=None, className='Tk',
          useTk=True, sync=False, use=None)

     Construct a toplevel Tk widget, which is usually the main window of
     an application, and initialize a Tcl interpreter for this widget.
     Each instance has its own associated Tcl interpreter.

     The *note Tk: 19ac. class is typically instantiated using all
     default values.  However, the following keyword arguments are
     currently recognized:

     'screenName'

          When given (as a string), sets the ‘DISPLAY’ environment
          variable.  (X11 only)

     'baseName'

          Name of the profile file.  By default, 'baseName' is derived
          from the program name (‘sys.argv[0]’).

     'className'

          Name of the widget class.  Used as a profile file and also as
          the name with which Tcl is invoked ('argv0' in 'interp').

     'useTk'

          If ‘True’, initialize the Tk subsystem.  The *note
          tkinter.Tcl(): 42e8. function sets this to ‘False’.

     'sync'

          If ‘True’, execute all X server commands synchronously, so
          that errors are reported immediately.  Can be used for
          debugging.  (X11 only)

     'use'

          Specifies the 'id' of the window in which to embed the
          application, instead of it being created as an independent
          toplevel window.  'id' must be specified in the same way as
          the value for the -use option for toplevel widgets (that is,
          it has a form like that returned by ‘winfo_id()’).

          Note that on some platforms this will only work correctly if
          'id' refers to a Tk frame or toplevel that has its -container
          option enabled.

     *note Tk: 19ac. reads and interprets profile files, named
     ‘.`className'.tcl’ and ‘.`baseName'.tcl’, into the Tcl interpreter
     and calls *note exec(): 4a2. on the contents of ‘.`className'.py’
     and ‘.`baseName'.py’.  The path for the profile files is the ‘HOME’
     environment variable or, if that isn't defined, then *note
     os.curdir: 2c57.

      -- の属性: tk

          The Tk application object created by instantiating *note Tk:
          19ac.  This provides access to the Tcl interpreter.  Each
          widget that is attached the same instance of *note Tk: 19ac.
          has the same value for its *note tk: 42e9. attribute.

      -- の属性: master

          The widget object that contains this widget.  For *note Tk:
          19ac, the ‘master’ is *note None: 885. because it is the main
          window.  The terms 'master' and 'parent' are similar and
          sometimes used interchangeably as argument names; however,
          calling ‘winfo_parent()’ returns a string of the widget name
          whereas ‘master’ returns the object.  'parent'/'child'
          reflects the tree-like relationship while 'master' (or
          'container')/'content' reflects the container structure.

      -- の属性: children

          The immediate descendants of this widget as a *note dict: 183.
          with the child widget names as the keys and the child instance
          objects as the values.

 -- の関数: tkinter.Tcl (screenName=None, baseName=None, className='Tk',
          useTk=False)

     *note Tcl(): 42e8. はファクトリ関数で、 *note Tk: 19ac. クラスで生
     成するオブジェクトとよく似たオブジェクトを生成します。ただし Tk サ
     ブシステムを初期化しません。この関数は、余分なトップレベルウィンド
     ウを作る必要がなかったり、 (X サーバを持たない Unix/Linux システム
     などのように) 作成できない環境において Tcl インタプリタを駆動したい
     場合に便利です。 *note Tcl(): 42e8. で生成したオブジェクトに対して
     ‘loadtk()’ メソッドを呼び出せば、トップレベルウィンドウを作成 (して
     、Tk サブシステムを初期化) します。

The modules that provide Tk support include:

‘tkinter’

     Main Tkinter module.

*note tkinter.colorchooser: f7.

     ユーザに色を選択させるためのダイアログです。

*note tkinter.commondialog: f8.

     このリストの他のモジュールが定義しているダイアログの基底クラスです
     。

*note tkinter.filedialog: fa.

     ユーザが開きたいファイルや保存したいファイルを指定できるようにする
     共通のダイアログです。

*note tkinter.font: fb.

     フォントの扱いを補助するためのユーティリティです。

*note tkinter.messagebox: fc.

     標準的な Tk のダイアログボックスにアクセスします。

*note tkinter.scrolledtext: fd.

     垂直スクロールバー付きのテキストウィジェットです。

*note tkinter.simpledialog: fe.

     基本的なダイアログと便宜関数 (convenience function) です。

*note tkinter.ttk: ff.

     Themed widget set introduced in Tk 8.5, providing modern
     alternatives for many of the classic widgets in the main ‘tkinter’
     module.

Additional modules:

*note _tkinter: 3.

     A binary module that contains the low-level interface to Tcl/Tk.
     It is automatically imported by the main ‘tkinter’ module, and
     should never be used directly by application programmers.  It is
     usually a shared library (or DLL), but might in some cases be
     statically linked with the Python interpreter.

*note idlelib: 77.

     Python's Integrated Development and Learning Environment (IDLE).
     Based on ‘tkinter’.

‘tkinter.constants’

     Symbolic constants that can be used in place of strings when
     passing various parameters to Tkinter calls.  Automatically
     imported by the main ‘tkinter’ module.

*note tkinter.dnd: f9.

     (experimental) Drag-and-drop support for ‘tkinter’.  This will
     become deprecated when it is replaced with the Tk DND.

*note turtle: 107.

     Tk ウィンドウ上でタートルグラフィックスを実現します。


File: python.info,  Node: Tkinter お助け手帳,  Next: Threading model,  Prev: Tkinter モジュール,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.25.1.3 Tkinter お助け手帳
...........................

This section is not designed to be an exhaustive tutorial on either Tk
or Tkinter.  For that, refer to one of the external resources noted
earlier.  Instead, this section provides a very quick orientation to
what a Tkinter application looks like, identifies foundational Tk
concepts, and explains how the Tkinter wrapper is structured.

The remainder of this section will help you to identify the classes,
methods, and options you'll need in your Tkinter application, and where
to find more detailed documentation on them, including in the official
Tcl/Tk reference manual.

* Menu:

* A Hello World Program::
* Important Tk Concepts::
* Understanding How Tkinter Wraps Tcl/Tk::
* How do I...? What option does...?: How do I ? What option does ?.
* Navigating the Tcl/Tk Reference Manual::


File: python.info,  Node: A Hello World Program,  Next: Important Tk Concepts,  Up: Tkinter お助け手帳

5.25.1.4 A Hello World Program
..............................

We'll start by walking through a "Hello World" application in Tkinter.
This isn't the smallest one we could write, but has enough to illustrate
some key concepts you'll need to know.

     from tkinter import *
     from tkinter import ttk
     root = Tk()
     frm = ttk.Frame(root, padding=10)
     frm.grid()
     ttk.Label(frm, text="Hello World!").grid(column=0, row=0)
     ttk.Button(frm, text="Quit", command=root.destroy).grid(column=1, row=0)
     root.mainloop()

After the imports, the next line creates an instance of the ‘Tk’ class,
which initializes Tk and creates its associated Tcl interpreter.  It
also creates a toplevel window, known as the root window, which serves
as the main window of the application.

The following line creates a frame widget, which in this case will
contain a label and a button we'll create next.  The frame is fit inside
the root window.

The next line creates a label widget holding a static text string.  The
‘grid()’ method is used to specify the relative layout (position) of the
label within its containing frame widget, similar to how tables in HTML
work.

A button widget is then created, and placed to the right of the label.
When pressed, it will call the ‘destroy()’ method of the root window.

Finally, the ‘mainloop()’ method puts everything on the display, and
responds to user input until the program terminates.


File: python.info,  Node: Important Tk Concepts,  Next: Understanding How Tkinter Wraps Tcl/Tk,  Prev: A Hello World Program,  Up: Tkinter お助け手帳

5.25.1.5 Important Tk Concepts
..............................

Even this simple program illustrates the following key Tk concepts:

widgets

     A Tkinter user interface is made up of individual 'widgets'.  Each
     widget is represented as a Python object, instantiated from classes
     like ‘ttk.Frame’, ‘ttk.Label’, and ‘ttk.Button’.

widget hierarchy

     Widgets are arranged in a 'hierarchy'.  The label and button were
     contained within a frame, which in turn was contained within the
     root window.  When creating each 'child' widget, its 'parent'
     widget is passed as the first argument to the widget constructor.

configuration options

     Widgets have 'configuration options', which modify their appearance
     and behavior, such as the text to display in a label or button.
     Different classes of widgets will have different sets of options.

geometry management

     Widgets aren't automatically added to the user interface when they
     are created.  A 'geometry manager' like ‘grid’ controls where in
     the user interface they are placed.

event loop

     Tkinter reacts to user input, changes from your program, and even
     refreshes the display only when actively running an 'event loop'.
     If your program isn't running the event loop, your user interface
     won't update.


File: python.info,  Node: Understanding How Tkinter Wraps Tcl/Tk,  Next: How do I ? What option does ?,  Prev: Important Tk Concepts,  Up: Tkinter お助け手帳

5.25.1.6 Understanding How Tkinter Wraps Tcl/Tk
...............................................

When your application uses Tkinter's classes and methods, internally
Tkinter is assembling strings representing Tcl/Tk commands, and
executing those commands in the Tcl interpreter attached to your
application's ‘Tk’ instance.

Whether it's trying to navigate reference documentation, trying to find
the right method or option, adapting some existing code, or debugging
your Tkinter application, there are times that it will be useful to
understand what those underlying Tcl/Tk commands look like.

To illustrate, here is the Tcl/Tk equivalent of the main part of the
Tkinter script above.

     ttk::frame .frm -padding 10
     grid .frm
     grid [ttk::label .frm.lbl -text "Hello World!"] -column 0 -row 0
     grid [ttk::button .frm.btn -text "Quit" -command "destroy ."] -column 1 -row 0

Tcl's syntax is similar to many shell languages, where the first word is
the command to be executed, with arguments to that command following it,
separated by spaces.  Without getting into too many details, notice the
following:

   * The commands used to create widgets (like ‘ttk::frame’) correspond
     to widget classes in Tkinter.

   * Tcl widget options (like ‘-text’) correspond to keyword arguments
     in Tkinter.

   * Widgets are referred to by a 'pathname' in Tcl (like ‘.frm.btn’),
     whereas Tkinter doesn't use names but object references.

   * A widget's place in the widget hierarchy is encoded in its
     (hierarchical) pathname, which uses a ‘.’ (dot) as a path
     separator.  The pathname for the root window is just ‘.’ (dot).  In
     Tkinter, the hierarchy is defined not by pathname but by specifying
     the parent widget when creating each child widget.

   * Operations which are implemented as separate 'commands' in Tcl
     (like ‘grid’ or ‘destroy’) are represented as 'methods' on Tkinter
     widget objects.  As you'll see shortly, at other times Tcl uses
     what appear to be method calls on widget objects, which more
     closely mirror what is used in Tkinter.


File: python.info,  Node: How do I ? What option does ?,  Next: Navigating the Tcl/Tk Reference Manual,  Prev: Understanding How Tkinter Wraps Tcl/Tk,  Up: Tkinter お助け手帳

5.25.1.7 How do I...? What option does...?
..........................................

If you're not sure how to do something in Tkinter, and you can't
immediately find it in the tutorial or reference documentation you're
using, there are a few strategies that can be helpful.

First, remember that the details of how individual widgets work may vary
across different versions of both Tkinter and Tcl/Tk.  If you're
searching documentation, make sure it corresponds to the Python and
Tcl/Tk versions installed on your system.

When searching for how to use an API, it helps to know the exact name of
the class, option, or method that you're using.  Introspection, either
in an interactive Python shell or with *note print(): 1177, can help you
identify what you need.

To find out what configuration options are available on any widget, call
its ‘configure()’ method, which returns a dictionary containing a
variety of information about each object, including its default and
current values.  Use ‘keys()’ to get just the names of each option.

     btn = ttk.Button(frm, ...)
     print(btn.configure().keys())

As most widgets have many configuration options in common, it can be
useful to find out which are specific to a particular widget class.
Comparing the list of options to that of a simpler widget, like a frame,
is one way to do that.

     print(set(btn.configure().keys()) - set(frm.configure().keys()))

Similarly, you can find the available methods for a widget object using
the standard *note dir(): 844. function.  If you try it, you'll see
there are over 200 common widget methods, so again identifying those
specific to a widget class is helpful.

     print(dir(btn))
     print(set(dir(btn)) - set(dir(frm)))


File: python.info,  Node: Navigating the Tcl/Tk Reference Manual,  Prev: How do I ? What option does ?,  Up: Tkinter お助け手帳

5.25.1.8 Navigating the Tcl/Tk Reference Manual
...............................................

As noted, the official Tk commands(1) reference manual (man pages) is
often the most accurate description of what specific operations on
widgets do.  Even when you know the name of the option or method that
you need, you may still have a few places to look.

While all operations in Tkinter are implemented as method calls on
widget objects, you've seen that many Tcl/Tk operations appear as
commands that take a widget pathname as its first parameter, followed by
optional parameters, e.g.

     destroy .
     grid .frm.btn -column 0 -row 0

Others, however, look more like methods called on a widget object (in
fact, when you create a widget in Tcl/Tk, it creates a Tcl command with
the name of the widget pathname, with the first parameter to that
command being the name of a method to call).

     .frm.btn invoke
     .frm.lbl configure -text "Goodbye"

In the official Tcl/Tk reference documentation, you'll find most
operations that look like method calls on the man page for a specific
widget (e.g., you'll find the ‘invoke()’ method on the ttk::button(2)
man page), while functions that take a widget as a parameter often have
their own man page (e.g., grid(3)).

You'll find many common options and methods in the options(4) or
ttk::widget(5) man pages, while others are found in the man page for a
specific widget class.

You'll also find that many Tkinter methods have compound names, e.g.,
‘winfo_x()’, ‘winfo_height()’, ‘winfo_viewable()’.  You'd find
documentation for all of these in the winfo(6) man page.

     注釈: Somewhat confusingly, there are also methods on all Tkinter
     widgets that don't actually operate on the widget, but operate at a
     global scope, independent of any widget.  Examples are methods for
     accessing the clipboard or the system bell.  (They happen to be
     implemented as methods in the base ‘Widget’ class that all Tkinter
     widgets inherit from).

   ---------- Footnotes ----------

   (1) https://www.tcl.tk/man/tcl8.6/TkCmd/contents.htm

   (2) https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_button.htm

   (3) https://www.tcl.tk/man/tcl8.6/TkCmd/grid.htm

   (4) https://www.tcl.tk/man/tcl8.6/TkCmd/options.htm

   (5) https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_widget.htm

   (6) https://www.tcl.tk/man/tcl8.6/TkCmd/winfo.htm


File: python.info,  Node: Threading model,  Next: 簡単なリファレンス,  Prev: Tkinter お助け手帳,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.25.1.9 Threading model
........................

Python and Tcl/Tk have very different threading models, which ‘tkinter’
tries to bridge.  If you use threads, you may need to be aware of this.

A Python interpreter may have many threads associated with it.  In Tcl,
multiple threads can be created, but each thread has a separate Tcl
interpreter instance associated with it.  Threads can also create more
than one interpreter instance, though each interpreter instance can be
used only by the one thread that created it.

Each ‘Tk’ object created by ‘tkinter’ contains a Tcl interpreter.  It
also keeps track of which thread created that interpreter.  Calls to
‘tkinter’ can be made from any Python thread.  Internally, if a call
comes from a thread other than the one that created the ‘Tk’ object, an
event is posted to the interpreter's event queue, and when executed, the
result is returned to the calling Python thread.

Tcl/Tk applications are normally event-driven, meaning that after
initialization, the interpreter runs an event loop (i.e.
‘Tk.mainloop()’) and responds to events.  Because it is single-threaded,
event handlers must respond quickly, otherwise they will block other
events from being processed.  To avoid this, any long-running
computations should not run in an event handler, but are either broken
into smaller pieces using timers, or run in another thread.  This is
different from many GUI toolkits where the GUI runs in a completely
separate thread from all application code including event handlers.

If the Tcl interpreter is not running the event loop and processing
events, any ‘tkinter’ calls made from threads other than the one running
the Tcl interpreter will fail.

A number of special cases exist:

   * Tcl/Tk libraries can be built so they are not thread-aware.  In
     this case, ‘tkinter’ calls the library from the originating Python
     thread, even if this is different than the thread that created the
     Tcl interpreter.  A global lock ensures only one call occurs at a
     time.

   * While ‘tkinter’ allows you to create more than one instance of a
     ‘Tk’ object (with its own interpreter), all interpreters that are
     part of the same thread share a common event queue, which gets ugly
     fast.  In practice, don't create more than one instance of ‘Tk’ at
     a time.  Otherwise, it's best to create them in separate threads
     and ensure you're running a thread-aware Tcl/Tk build.

   * Blocking event handlers are not the only way to prevent the Tcl
     interpreter from reentering the event loop.  It is even possible to
     run multiple nested event loops or abandon the event loop entirely.
     If you're doing anything tricky when it comes to events or threads,
     be aware of these possibilities.

   * There are a few select ‘tkinter’ functions that presently work only
     when called from the thread that created the Tcl interpreter.


File: python.info,  Node: 簡単なリファレンス,  Next: ファイルハンドラ,  Prev: Threading model,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.25.1.10 簡単なリファレンス
............................

* Menu:

* オプションの設定::
* Packer::
* Packer のオプション::
* ウィジェット変数を関連付ける::
* ウィンドウマネージャ::
* Tk オプションデータ型::
* バインドとイベント::
* index パラメータ::
* 画像::


File: python.info,  Node: オプションの設定,  Next: Packer,  Up: 簡単なリファレンス

5.25.1.11 オプションの設定
..........................

オプションは、色やウィジェットの境界線幅などを制御します。オプションの設
定には三通りの方法があります:

オブジェクト生成時、キーワード引数を使用する

          fred = Button(self, fg="red", bg="blue")

オブジェクト生成後、オプション名を辞書インデックスのように扱う

          fred["fg"] = "red"
          fred["bg"] = "blue"

オブジェクト生成後に、config()メソッドを使って複数の属性を更新する

          fred.config(fg="red", bg="blue")

オプションとその振る舞いに関する詳細な説明は、該当するウィジェットの Tk
の man ページを参照してください。

man ページには、各ウィジェットの "STANDARD OPTIONS (標準オプション)" と
"WIDGET SPECIFIC OPTIONS (ウィジェット固有のオプション)" がリストされて
いることに注意してください。前者は多くのウィジェットに共通のオプションの
リストで、後者は特定のウィジェットに特有のオプションです。標準オプション
の説明は man ページの ‘options(3)(1)’ にあります。

このドキュメントでは、標準オプションとウィジェット固有のオプションを区別
していません。オプションによっては、ある種のウィジェットに適用できません
。あるウィジェットがあるオプションに対応しているかどうかは、ウィジェット
のクラスによります。例えばボタンには ‘command’ オプションがありますが、
ラベルにはありません。

あるウィジェットがどんなオプションをサポートしているかは、ウィジェットの
man ページにリストされています。また、実行時にウィジェットの ‘config()’
メソッドを引数なしで呼び出したり、 ‘keys()’ メソッドを呼び出したりして問
い合わせることもできます。メソッド呼び出しを行うと辞書型の値を返します。
この辞書は、オプションの名前がキー (例えば ‘'relief'’) になっていて、値
が 5 要素のタプルになっています。

‘bg’ のように、いくつかのオプションはより長い名前を持つ共通のオプション
に対する同義語になっています (‘bg’ は "background" を短縮したものです)。
短縮形のオプション名を ‘config()’ に渡すと、 5 要素ではなく 2 要素のタプ
ルを返します。このタプルには、同義語の名前と「本当の」オプション名が入っ
ています (例えば ‘('bg', 'background')’)。

インデッ    意味                                  使用例
クス                                              

---------------------------------------------------------------------
                                                  
0           オプション名                          ‘'relief'’
                                                  
                                                  
1           データベース検索用のオプション名      ‘'relief'’
                                                  
                                                  
2           データベース検索用のオプションクラ    ‘'Relief'’
            ス                                    
            
                                                  
3           デフォルト値                          ‘'raised'’
                                                  
                                                  
4           現在の値                              ‘'groove'’
                                                  

以下はプログラム例です:

     >>> print(fred.config())
     {'relief': ('relief', 'relief', 'Relief', 'raised', 'groove')}

もちろん、実際に出力される辞書には利用可能なオプションが全て表示されます
。上の表示例は単なる例にすぎません。

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/options(3)


File: python.info,  Node: Packer,  Next: Packer のオプション,  Prev: オプションの設定,  Up: 簡単なリファレンス

5.25.1.12 Packer
................

The packer is one of Tk's geometry-management mechanisms.  Geometry
managers are used to specify the relative positioning of widgets within
their container.  In contrast to the more cumbersome 'placer' (which is
used less commonly, and we do not cover here), the packer takes
qualitative relationship specification - 'above', 'to the left of',
'filling', etc - and works everything out to determine the exact
placement coordinates for you.

The size of any container widget is determined by the size of the
"content widgets" inside.  The packer is used to control where content
widgets appear inside the container into which they are packed.  You can
pack widgets into frames, and frames into other frames, in order to
achieve the kind of layout you desire.  Additionally, the arrangement is
dynamically adjusted to accommodate incremental changes to the
configuration, once it is packed.

ジオメトリマネージャがウィジェットのジオメトリを確定するまで、ウィジェッ
トは表示されないので注意してください。初心者のころにはよくジオメトリの確
定を忘れてしまい、ウィジェットを生成したのに何も表示されず驚くことになり
ます。ウィジェットは、(例えば packer の ‘pack()’ メソッドを適用して) ジ
オメトリを確定した後で初めて表示されます。

pack() メソッドは、キーワード引数つきで呼び出せます。キーワード引数は、
ウィジェットをコンテナ内のどこに表示するか、メインのアプリケーションウィ
ンドウをリサイズしたときにウィジェットがどう振舞うかを制御します。以下に
例を示します:

     fred.pack()                     # defaults to side = "top"
     fred.pack(side="left")
     fred.pack(expand=1)


File: python.info,  Node: Packer のオプション,  Next: ウィジェット変数を関連付ける,  Prev: Packer,  Up: 簡単なリファレンス

5.25.1.13 Packer のオプション
.............................

packer と packer の取りえるオプションについての詳細は、man ページや John
Ousterhout の本の183ページを参照してください。

anchor

     Anchor type.  Denotes where the packer is to place each content in
     its parcel.

expand

     ブール値で、 ‘0’ または ‘1’ になります。

fill

     指定できる値は ‘'x'’ 、 ‘'y'’ 、 ‘'both'’ 、 ‘'none'’ です。

ipadx および ipady

     A distance - designating internal padding on each side of the
     content.

padx および pady

     A distance - designating external padding on each side of the
     content.

side

     指定できる値は ‘'left'’, ‘'right'’, ‘'top'’, ‘'bottom'’ です。


File: python.info,  Node: ウィジェット変数を関連付ける,  Next: ウィンドウマネージャ,  Prev: Packer のオプション,  Up: 簡単なリファレンス

5.25.1.14 ウィジェット変数を関連付ける
......................................

ウィジェットによっては、(テキスト入力ウィジェットのように) 特殊なオプシ
ョンを使って、現在設定されている値をアプリケーション内の変数に直接関連付
けできます。このようなオプションには ‘variable’, ‘textvariable’,
‘onvalue’, ‘offvalue’ および ‘value’ があります。この関連付けは双方向に
働きます: 変数の値が何らかの理由で変更されると、関連付けされているウィジ
ェットも更新され、新しい値を反映します。

Unfortunately, in the current implementation of ‘tkinter’ it is not
possible to hand over an arbitrary Python variable to a widget through a
‘variable’ or ‘textvariable’ option.  The only kinds of variables for
which this works are variables that are subclassed from a class called
Variable, defined in ‘tkinter’.

Variable には、 ‘StringVar’, ‘IntVar’, ‘DoubleVar’, ‘BooleanVar’ といっ
た便利なサブクラスがすでにすでに数多く定義されています。こうした変数の現
在の値を読み出したければ、 ‘get()’ メソッドを呼び出します。また、値を変
更したければ ‘set()’ メソッドを呼び出します。このプロトコルに従っている
限り、それ以上なにも手を加えなくてもウィジェットは常に現在値に追従します
。

例えば:

     import tkinter as tk

     class App(tk.Frame):
         def __init__(self, master):
             super().__init__(master)
             self.pack()

             self.entrythingy = tk.Entry()
             self.entrythingy.pack()

             # Create the application variable.
             self.contents = tk.StringVar()
             # Set it to some value.
             self.contents.set("this is a variable")
             # Tell the entry widget to watch this variable.
             self.entrythingy["textvariable"] = self.contents

             # Define a callback for when the user hits return.
             # It prints the current value of the variable.
             self.entrythingy.bind('<Key-Return>',
                                  self.print_contents)

         def print_contents(self, event):
             print("Hi. The current entry content is:",
                   self.contents.get())

     root = tk.Tk()
     myapp = App(root)
     myapp.mainloop()


File: python.info,  Node: ウィンドウマネージャ,  Next: Tk オプションデータ型,  Prev: ウィジェット変数を関連付ける,  Up: 簡単なリファレンス

5.25.1.15 ウィンドウマネージャ
..............................

In Tk, there is a utility command, ‘wm’, for interacting with the window
manager.  Options to the ‘wm’ command allow you to control things like
titles, placement, icon bitmaps, and the like.  In ‘tkinter’, these
commands have been implemented as methods on the ‘Wm’ class.  Toplevel
widgets are subclassed from the ‘Wm’ class, and so can call the ‘Wm’
methods directly.

To get at the toplevel window that contains a given widget, you can
often just refer to the widget's ‘master’.  Of course if the widget has
been packed inside of a frame, the ‘master’ won't represent a toplevel
window.  To get at the toplevel window that contains an arbitrary
widget, you can call the ‘_root()’ method.  This method begins with an
underscore to denote the fact that this function is part of the
implementation, and not an interface to Tk functionality.

以下に典型的な使い方の例をいくつか挙げます:

     import tkinter as tk

     class App(tk.Frame):
         def __init__(self, master=None):
             super().__init__(master)
             self.pack()

     # create the application
     myapp = App()

     #
     # here are method calls to the window manager class
     #
     myapp.master.title("My Do-Nothing Application")
     myapp.master.maxsize(1000, 400)

     # start the program
     myapp.mainloop()


File: python.info,  Node: Tk オプションデータ型,  Next: バインドとイベント,  Prev: ウィンドウマネージャ,  Up: 簡単なリファレンス

5.25.1.16 Tk オプションデータ型
...............................

anchor

     指定できる値はコンパスの方位です: ‘"n"’ 、 ‘"ne"’ 、 ‘"e"’ 、
     ‘"se"’ 、 ‘"s"’ 、 ‘"sw"’ 、 ‘"w"’ 、 ‘"nw"’ 、および ‘"center"’ 。

bitmap

     八つの組み込み、名前付きビットマップ: ‘'error'’ 、 ‘'gray25'’ 、
     ‘'gray50'’ 、 ‘'hourglass'’ 、 ‘'info'’ 、 ‘'questhead'’ 、
     ‘'question'’ 、 ‘'warning'’ 。 X ビットマップファイル名を指定するた
     めに、 ‘"@/usr/contrib/bitmap/gumby.bit"’ のような ‘@’ を先頭に付け
     たファイルへの完全なパスを与えてください。

boolean

     整数 0 または 1 、あるいは、文字列 ‘"yes"’ または ‘"no"’ を渡すこと
     ができます。

callback

     これは引数を取らない Python 関数ならどれでも構いません。例えば:

          def print_it():
              print("hi there")
          fred["command"] = print_it

color

     Colors can be given as the names of X colors in the rgb.txt file,
     or as strings representing RGB values in 4 bit: ‘"#RGB"’, 8 bit:
     ‘"#RRGGBB"’, 12 bit: ‘"#RRRGGGBBB"’, or 16 bit: ‘"#RRRRGGGGBBBB"’
     ranges, where R,G,B here represent any legal hex digit.  See page
     160 of Ousterhout's book for details.

cursor

     ‘cursorfont.h’ の標準Xカーソル名を、接頭語 ‘XC_’ 無しで使うことがで
     きます。例えば、handカーソル(‘XC_hand2’)を得るには、文字列
     ‘"hand2"’ を使ってください。あなた自身のビットマップとマスクファイ
     ルを指定することもできます。 Ousterhout の本の179ページを参照してく
     ださい。

distance

     スクリーン上の距離をピクセルか絶対距離のどちらかで指定できます。ピ
     クセルは数値として与えられ、絶対距離は文字列として与えられます。絶
     対距離を表す文字列は、単位を表す終了文字 (センチメートルには ‘c’ 、
     インチには ‘i’ 、ミリメートルには ‘m’ 、プリンタのポイントには
     ‘p’)を伴います。例えば、3.5インチは ‘"3.5i"’ と表現します。

font

     Tkはフォント名の形式に ‘{courier 10 bold}’ のようなリストを使います
     。正の数のフォントサイズはポイント単位で使用され、負の数のサイズは
     ピクセル単位と見なされます。

geometry

     これは ‘widthxheight’ 形式の文字列です。ここでは、ほとんどのウィジ
     ェットに対して幅と高さピクセル単位で (テキストを表示するウィジェッ
     トに対しては文字単位で)表されます。例えば: ‘fred["geometry"] =
     "200x100"’ 。

justify

     Legal values are the strings: ‘"left"’, ‘"center"’, and ‘"right"’.

region

     これは空白で区切られた四つの要素をもつ文字列です。各要素は指定可能
     な距離です(以下を参照)。例えば: ‘"2 3 4 5"’ と ‘"3i 2i 4.5i 2i"’ と
     ‘"3c 2c 4c 10.43c"’ は、すべて指定可能な範囲です。

relief

     ウィジェットのボーダのスタイルが何かを決めます。指定できる値は:
     ‘"raised"’ 、 ‘"sunken"’ 、 ‘"flat"’ 、 ‘"groove"’ 、と ‘"ridge"’ 。

scrollcommand

     これはほとんどの場合スクロールバーウィジェットの ‘set()’ メソッドで
     すが、1 個の引数を取るあらゆるウィジェットにもなりえます。

wrap

     次の中の一つでなければなりません: ‘"none"’ 、 ‘"char"’ 、あるいは
     ‘"word"’ 。


File: python.info,  Node: バインドとイベント,  Next: index パラメータ,  Prev: Tk オプションデータ型,  Up: 簡単なリファレンス

5.25.1.17 バインドとイベント
............................

ウィジェットコマンドからの bind メソッドによって、あるイベントを待つこと
と、そのイベント型が起きたときにコールバック関数を呼び出すことができるよ
うになります。 bind メソッドの形式は:

     def bind(self, sequence, func, add=''):

ここでは:

sequence

     is a string that denotes the target kind of event.  (See the
     ‘bind(3tk)(1)’ man page, and page 201 of John Ousterhout's book,
     ‘Tcl and the Tk Toolkit (2nd edition)’, for details).

func

     は一引数を取り、イベントが起きるときに呼び出される Python 関数です
     。イベント・インスタンスが引数として渡されます。 (このように実施さ
     れる関数は、一般に 'callbacks' として知られています。)

add

     はオプションで、 ‘''’ か ‘'+'’ のどちらかです。空文字列を渡すことは
     、このイベントが関係する他のどんなバインドをもこのバインドが置き換
     えることを意味します。 ‘'+'’ を使う仕方は、この関数がこのイベント型
     にバインドされる関数のリストに追加されることを意味しています。

例えば:

     def turn_red(self, event):
         event.widget["activeforeground"] = "red"

     self.button.bind("<Enter>", self.turn_red)

イベントのウィジェットフィールドが ‘turn_red()’ コールバック内でどのよう
にアクセスされているかに注目してください。このフィールドは X イベントを
捕らえたウィジェットを含んでいます。以下の表はアクセスできる他のイベント
フィールドとそれらの Tk での表現方法の一覧です。Tk man ページを参照する
ときに役に立つでしょう。

Tk       Tkinter イベントフィー    Tk       Tkinter イベントフィー
         ルド                               ルド
                                            
----------------------------------------------------------------------
                                            
%f       focus                     %A       char
                                            
                                            
%h       高さ                      %E       send_event
                                            
                                            
%k       keycode                   %K       keysym
                                            
                                            
%s       state                     %N       keysym_num
                                            
                                            
%t       time                      %T       type
                                            
                                            
%w       幅                        %W       widget
                                            
                                            
%x       x                         %X       x_root
                                            
                                            
%y       y                         %Y       y_root
                                            

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/bind(3tk)


File: python.info,  Node: index パラメータ,  Next: 画像,  Prev: バインドとイベント,  Up: 簡単なリファレンス

5.25.1.18 index パラメータ
..........................

多くのウィジェットにはパラメータ "index" を渡す必要があります。これらは
テキストウィジェット内の特定の位置や、エントリウィジェット内の特定の文字
、あるいはメニューウィジェット内の特定のメニューアイテムを指定するために
使用されます。

エントリウィジェットのインデックス(インデックス、ビューインデックスなど)

     Entry widgets have options that refer to character positions in the
     text being displayed.  You can use these ‘tkinter’ functions to
     access these special points in text widgets:

テキストウィジェットのインデックス

     テキストウィジェットに対するインデックス記法はとても機能が豊富で、
     Tk manページでよく説明されています。

メニューのインデックス(menu.invoke()、menu.entryconfig()など)

     メニューに対するいくつかのオプションとメソッドは特定のメニュー項目
     を操作します。メニューインデックスはオプションまたはパラメータのた
     めに必要とされるときはいつでも、以下のものを渡すことができます:

        * ウィジェット内の数字の先頭からの位置を指す整数。先頭は 0。

        * 文字列 ‘"active"’。現在カーソルがあるメニューの位置を指します
          。

        * 文字列 ‘"last"’ 。最後のメニューを指します。

        * ‘@6’ のような ‘@’ が前に来る整数。ここでは、整数がメニューの座
          標系における y ピクセル座標として解釈されます。

        * 文字列 ‘"none"’。どんなメニューエントリもまったく指しておらず
          、ほとんどの場合、すべてのエントリの動作を停止させるために
          menu.activate() と一緒に使われます。そして、最後に、

        * メニューの先頭から一番下までスキャンしたときに、メニューエント
          リのラベルに一致したパターンであるテキスト文字列。このインデッ
          クス型は他すべての後に考慮されることに注意してください。その代
          わりに、それは ‘last’ 、 ‘active’ または ‘none’ とラベル付けさ
          れたメニュー項目への一致は上のリテラルとして解釈されることを意
          味します。


File: python.info,  Node: 画像,  Prev: index パラメータ,  Up: 簡単なリファレンス

5.25.1.19 画像
..............

様々な形式の画像を、それに対応する ‘tkinter.Image’ のサブクラスを使って
作成できます:

   * XBM 形式の画像のための ‘BitmapImage’ 。

   * PGM, PPM, GIF, PNG 形式の画像のための ‘PhotoImage’ 。 最後のは Tk
     8.6 からサポートされるようになりました。

画像のどちらの型でも ‘file’ または ‘data’ オプションを使って作られます
(その上、他のオプションも利用できます)。

バージョン 3.13 で変更: Added the ‘PhotoImage’ method ‘copy_replace()’
to copy a region from one image to other image, possibly with pixel
zooming and/or subsampling.  Add 'from_coords' parameter to ‘PhotoImage’
methods ‘copy()’, ‘zoom()’ and ‘subsample()’.  Add 'zoom' and
'subsample' parameters to ‘PhotoImage’ method ‘copy()’.

‘image’ オプションがウィジェットにサポートされるところならどこでも、画像
オブジェクトを使うことができます (例えば、ラベル、ボタン、メニュー)。こ
れらの場合では、Tk は画像への参照を保持しないでしょう。画像オブジェクト
への最後の Python の参照が削除されたときに、画像データも削除されます。そ
して、どこで画像が使われていようとも、Tk は空の箱を表示します。

参考
....

The Pillow(1) package adds support for formats such as BMP, JPEG, TIFF,
and WebP, among others.

   ---------- Footnotes ----------

   (1) https://python-pillow.org/


File: python.info,  Node: ファイルハンドラ,  Prev: 簡単なリファレンス,  Up: tkinter --- Tcl/Tk の Python インターフェース

5.25.1.20 ファイルハンドラ
..........................

Tk を使うとコールバック関数の登録や解除ができ、ファイルディスクリプタに
対する入出力が可能なときに、Tk のメインループからその関数が呼ばれます。
ファイルディスクリプタ1つにつき、1つだけハンドラは登録されます。コード例
です:

     import tkinter
     widget = tkinter.Tk()
     mask = tkinter.READABLE | tkinter.WRITABLE
     widget.tk.createfilehandler(file, mask, callback)
     ...
     widget.tk.deletefilehandler(file)

これらの機能は Windows では利用できません。

読み込みに使えるバイト数は分からないので、 *note BufferedIOBase: 8a3. ク
ラスや *note TextIOBase: 8a4. クラスの *note read(): 1540. メソッドおよ
び *note readline(): 1541. メソッドを使おうとしないでください。これらは
読み込みの際に、あらかじめ決められたバイト数を要求するのです。ソケットに
は、 *note recv(): fa4. や *note recvfrom(): fa5. メソッドを使うといいで
す。その他のファイルには、 raw 読み込みか ‘os.read(file.fileno(),
maxbytecount)’ を使ってください。

 -- メソッド: Widget.tk.createfilehandler (file, mask, func)

     ファイルハンドラであるコールバック関数 'func' を登録します。 'file'
     引数は、 (ファイルやソケットオブジェクトのような) *note fileno():
     17ad. メソッドを持つオブジェクトか、整数のファイルディスクリプタと
     なります。 'mask' 引数は、以下にある3つの定数の組み合わせの OR を取
     ったものです。コールバックは次のように呼ばれます:

          callback(file, mask)

 -- メソッド: Widget.tk.deletefilehandler (file)

     ファイルハンドラの登録を解除します。

 -- データ: _tkinter.READABLE
 -- データ: _tkinter.WRITABLE
 -- データ: _tkinter.EXCEPTION

     'mask' 引数で使う定数です。


File: python.info,  Node: tkinter colorchooser --- カラー選択ダイアログ,  Next: tkinter font --- Tkinter フォントラッパー,  Prev: tkinter --- Tcl/Tk の Python インターフェース,  Up: Graphical user interfaces with Tk

5.25.2 ‘tkinter.colorchooser’ -- カラー選択ダイアログ
-----------------------------------------------------

'ソースコード:' Lib/tkinter/colorchooser.py(1)

__________________________________________________________________

The ‘tkinter.colorchooser’ module provides the *note Chooser: 4308.
class as an interface to the native color picker dialog.  ‘Chooser’
implements a modal color choosing dialog window.  The ‘Chooser’ class
inherits from the *note Dialog: 4309. class.

 -- クラス: tkinter.colorchooser.Chooser (master=None, **options)

 -- の関数: tkinter.colorchooser.askcolor (color=None, **options)

     カラー選択ダイアログを作成します。このメソッドを呼び出すと、ウィン
     ドウが表示されユーザーが選択するのを待ち、選択された色（もしくは
     ‘None’ ）を呼び出し元に返します。

参考
....

モジュール *note tkinter.commondialog: f8.

     Tkinter標準ダイアログモジュール

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/tkinter/colorchooser.py


File: python.info,  Node: tkinter font --- Tkinter フォントラッパー,  Next: Tkinter ダイアログ,  Prev: tkinter colorchooser --- カラー選択ダイアログ,  Up: Graphical user interfaces with Tk

5.25.3 ‘tkinter.font’ -- Tkinter フォントラッパー
-------------------------------------------------

'ソースコード:' Lib/tkinter/font.py(1)

__________________________________________________________________

The ‘tkinter.font’ module provides the *note Font: 1cce. class for
creating and using named fonts.

The different font weights and slants are:

 -- データ: tkinter.font.NORMAL
 -- データ: tkinter.font.BOLD
 -- データ: tkinter.font.ITALIC
 -- データ: tkinter.font.ROMAN

 -- クラス: tkinter.font.Font (root=None, font=None, name=None,
          exists=False, **options)

     The *note Font: 1cce. class represents a named font.  'Font'
     instances are given unique names and can be specified by their
     family, size, and style configuration.  Named fonts are Tk's method
     of creating and identifying fonts as a single object, rather than
     specifying a font by its attributes with each occurrence.

          arguments:

                    'font' - font specifier tuple (family, size, options)
                    'name' - unique font name
                    'exists' - self points to existing named font if true

          additional keyword options (ignored if 'font' is specified):

                    'family' - font family i.e. Courier, Times
                    'size' - font size
                         If 'size' is positive it is interpreted as size in points.
                         If 'size' is a negative number its absolute value is treated
                         as size in pixels.
                    'weight' - font emphasis (NORMAL, BOLD)
                    'slant' - ROMAN, ITALIC
                    'underline' - font underlining (0 - none, 1 - underline)
                    'overstrike' - font strikeout (0 - none, 1 - strikeout)

      -- メソッド: actual (option=None, displayof=None)

          Return the attributes of the font.

      -- メソッド: cget (option)

          Retrieve an attribute of the font.

      -- メソッド: config (**options)

          Modify attributes of the font.

      -- メソッド: copy ()

          Return new instance of the current font.

      -- メソッド: measure (text, displayof=None)

          Return amount of space the text would occupy on the specified
          display when formatted in the current font.  If no display is
          specified then the main application window is assumed.

      -- メソッド: metrics (*options, **kw)

          Return font-specific data.  Options include:

          'ascent' - distance between baseline and highest point that a

               character of the font can occupy

          'descent' - distance between baseline and lowest point that a

               character of the font can occupy

          'linespace' - minimum vertical separation necessary between any two

               characters of the font that ensures no vertical overlap
               between lines.

          'fixed' - 1 if font is fixed-width else 0

 -- の関数: tkinter.font.families (root=None, displayof=None)

     Return the different font families.

 -- の関数: tkinter.font.names (root=None)

     Return the names of defined fonts.

 -- の関数: tkinter.font.nametofont (name, root=None)

     Return a *note Font: 1cce. representation of a tk named font.

     バージョン 3.10 で変更: The 'root' parameter was added.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/tkinter/font.py


File: python.info,  Node: Tkinter ダイアログ,  Next: tkinter messagebox --- Tkinter メッセージプロンプト,  Prev: tkinter font --- Tkinter フォントラッパー,  Up: Graphical user interfaces with Tk

5.25.4 Tkinter ダイアログ
-------------------------

* Menu:

* tkinter.simpledialog: tkinter simpledialog --- Standard Tkinter input dialogs. Standard Tkinter input dialogs
* tkinter.filedialog: tkinter filedialog --- File selection dialogs. File selection dialogs
* tkinter.commondialog: tkinter commondialog --- Dialog window templates. Dialog window templates


File: python.info,  Node: tkinter simpledialog --- Standard Tkinter input dialogs,  Next: tkinter filedialog --- File selection dialogs,  Up: Tkinter ダイアログ

5.25.4.1 ‘tkinter.simpledialog’ -- Standard Tkinter input dialogs
.................................................................

'ソースコード:' Lib/tkinter/simpledialog.py(1)

__________________________________________________________________

The ‘tkinter.simpledialog’ module contains convenience classes and
functions for creating simple modal dialogs to get a value from the
user.

 -- の関数: tkinter.simpledialog.askfloat (title, prompt, **kw)
 -- の関数: tkinter.simpledialog.askinteger (title, prompt, **kw)
 -- の関数: tkinter.simpledialog.askstring (title, prompt, **kw)

     上の３つの関数は、ユーザーに期待する型の値を入力を促すダイアログを
     提供します。

 -- クラス: tkinter.simpledialog.Dialog (parent, title=None)

     カスタムダイアログ用の基底クラスです。

      -- メソッド: body (master)

          ダイアログインターフェースの構築をオーバーライドし、初期フォー
          カスを持つべきウィジットを返します。

      -- メソッド: buttonbox ()

          デフォルト動作はOKとCancelボタンを追加します。カスタムのボタン
          レイアウトが必要であればオーバーライドします。

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/tkinter/simpledialog.py


File: python.info,  Node: tkinter filedialog --- File selection dialogs,  Next: tkinter commondialog --- Dialog window templates,  Prev: tkinter simpledialog --- Standard Tkinter input dialogs,  Up: Tkinter ダイアログ

5.25.4.2 ‘tkinter.filedialog’ -- File selection dialogs
.......................................................

'ソースコード:' Lib/tkinter/filedialog.py(1)

__________________________________________________________________

The ‘tkinter.filedialog’ module provides classes and factory functions
for creating file/directory selection windows.

* Menu:

* ネイティブの読み込み/保存ダイアログ::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/tkinter/filedialog.py


File: python.info,  Node: ネイティブの読み込み/保存ダイアログ,  Up: tkinter filedialog --- File selection dialogs

5.25.4.3 ネイティブの読み込み/保存ダイアログ
............................................

下記のクラスは、振る舞いをカスタマイズできる設定オプション付きの、ネイテ
ィブルック＆フィールと統合したファイルダイアログを提供します。以下のキー
ワード引数は、下記で列挙するクラスや関数に適用できます。

          'parent' - ダイアログをその上に表示するウィンドウ

          'title' - ウィンドウのタイトル

          'initialdir' - 最初に表示するディレクトリ

          'initialfile' - ダイアログを表示した際に選択するファイル

          'filetypes' - (ラベル, パターン) のタプルからなるシーケンスで、'*' ワイルドカードが利用できます

          'defaultextension' - ファイルに追加するデフォルトの拡張子 (保存ダイアログ向け)

          'multiple' - 真の場合、複数要素の選択を許可します

'静的なファクトリ関数'

The below functions when called create a modal, native look-and-feel
dialog, wait for the user's selection, then return the selected value(s)
or ‘None’ to the caller.

 -- の関数: tkinter.filedialog.askopenfile (mode='r', **options)
 -- の関数: tkinter.filedialog.askopenfiles (mode='r', **options)

     The above two functions create an *note Open: 4327. dialog and
     return the opened file object(s) in read-only mode.

 -- の関数: tkinter.filedialog.asksaveasfile (mode='w', **options)

     Create a *note SaveAs: 4329. dialog and return a file object opened
     in write-only mode.

 -- の関数: tkinter.filedialog.askopenfilename (**options)
 -- の関数: tkinter.filedialog.askopenfilenames (**options)

     The above two functions create an *note Open: 4327. dialog and
     return the selected filename(s) that correspond to existing
     file(s).

 -- の関数: tkinter.filedialog.asksaveasfilename (**options)

     Create a *note SaveAs: 4329. dialog and return the selected
     filename.

 -- の関数: tkinter.filedialog.askdirectory (**options)

          Prompt user to select a directory.
          Additional keyword option:
               'mustexist' - determines if selection must be an existing directory.

 -- クラス: tkinter.filedialog.Open (master=None, **options)
 -- クラス: tkinter.filedialog.SaveAs (master=None, **options)

     The above two classes provide native dialog windows for saving and
     loading files.

'便利なクラス'

The below classes are used for creating file/directory windows from
scratch.  These do not emulate the native look-and-feel of the platform.

 -- クラス: tkinter.filedialog.Directory (master=None, **options)

     Create a dialog prompting the user to select a directory.

     注釈: The 'FileDialog' class should be subclassed for custom event
     handling and behaviour.

 -- クラス: tkinter.filedialog.FileDialog (master, title=None)

     Create a basic file selection dialog.

      -- メソッド: cancel_command (event=None)

          Trigger the termination of the dialog window.

      -- メソッド: dirs_double_event (event)

          Event handler for double-click event on directory.

      -- メソッド: dirs_select_event (event)

          Event handler for click event on directory.

      -- メソッド: files_double_event (event)

          Event handler for double-click event on file.

      -- メソッド: files_select_event (event)

          Event handler for single-click event on file.

      -- メソッド: filter_command (event=None)

          Filter the files by directory.

      -- メソッド: get_filter ()

          Retrieve the file filter currently in use.

      -- メソッド: get_selection ()

          Retrieve the currently selected item.

      -- メソッド: go (dir_or_file=os.curdir, pattern='*', default='',
               key=None)

          Render dialog and start event loop.

      -- メソッド: ok_event (event)

          Exit dialog returning current selection.

      -- メソッド: quit (how=None)

          Exit dialog returning filename, if any.

      -- メソッド: set_filter (dir, pat)

          Set the file filter.

      -- メソッド: set_selection (file)

          Update the current file selection to 'file'.

 -- クラス: tkinter.filedialog.LoadFileDialog (master, title=None)

     A subclass of FileDialog that creates a dialog window for selecting
     an existing file.

      -- メソッド: ok_command ()

          Test that a file is provided and that the selection indicates
          an already existing file.

 -- クラス: tkinter.filedialog.SaveFileDialog (master, title=None)

     A subclass of FileDialog that creates a dialog window for selecting
     a destination file.

      -- メソッド: ok_command ()

          Test whether or not the selection points to a valid file that
          is not a directory.  Confirmation is required if an already
          existing file is selected.


File: python.info,  Node: tkinter commondialog --- Dialog window templates,  Prev: tkinter filedialog --- File selection dialogs,  Up: Tkinter ダイアログ

5.25.4.4 ‘tkinter.commondialog’ -- Dialog window templates
..........................................................

'Source code:' Lib/tkinter/commondialog.py(1)

__________________________________________________________________

The ‘tkinter.commondialog’ module provides the *note Dialog: 4309. class
that is the base class for dialogs defined in other supporting modules.

 -- クラス: tkinter.commondialog.Dialog (master=None, **options)

      -- メソッド: show (**options)

          Render the Dialog window.

参考
....

Modules *note tkinter.messagebox: fc, *note ファイルを読み書きする:
2066.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/tkinter/commondialog.py


File: python.info,  Node: tkinter messagebox --- Tkinter メッセージプロンプト,  Next: tkinter scrolledtext --- スクロール可能なテキストウィジェット,  Prev: Tkinter ダイアログ,  Up: Graphical user interfaces with Tk

5.25.5 ‘tkinter.messagebox’ -- Tkinter メッセージプロンプト
-----------------------------------------------------------

'ソースコード:' Lib/tkinter/messagebox.py(1)

__________________________________________________________________

The ‘tkinter.messagebox’ module provides a template base class as well
as a variety of convenience methods for commonly used configurations.
The message boxes are modal and will return a subset of (‘True’,
‘False’, ‘None’, *note OK: 4346, *note CANCEL: 4347, *note YES: 4348,
*note NO: 4349.) based on the user's selection.  Common message box
styles and layouts include but are not limited to:

[image src="python-figures/tk_msg.png"]


Figure
 -- クラス: tkinter.messagebox.Message (master=None, **options)

     Create a message window with an application-specified message, an
     icon and a set of buttons.  Each of the buttons in the message
     window is identified by a unique symbolic name (see the 'type'
     options).

     The following options are supported:

          'command'

               Specifies the function to invoke when the user closes the
               dialog.  The name of the button clicked by the user to
               close the dialog is passed as argument.  This is only
               available on macOS.

          'default'

               Gives the *note symbolic name: 434b. of the default
               button for this message window (*note OK: 4346, *note
               CANCEL: 4347, and so on).  If this option is not
               specified, the first button in the dialog will be made
               the default.

          'detail'

               Specifies an auxiliary message to the main message given
               by the 'message' option.  The message detail will be
               presented beneath the main message and, where supported
               by the OS, in a less emphasized font than the main
               message.

          'icon'

               Specifies an *note icon: 434c. to display.  If this
               option is not specified, then the *note INFO: 434d. icon
               will be displayed.

          'message'

               Specifies the message to display in this message box.
               The default value is an empty string.

          'parent'

               Makes the specified window the logical parent of the
               message box.  The message box is displayed on top of its
               parent window.

          'title'

               Specifies a string to display as the title of the message
               box.  This option is ignored on macOS, where platform
               guidelines forbid the use of a title on this kind of
               dialog.

          'type'

               Arranges for a *note predefined set of buttons: 434e. to
               be displayed.

      -- メソッド: show (**options)

          Display a message window and wait for the user to select one
          of the buttons.  Then return the symbolic name of the selected
          button.  Keyword arguments can override options specified in
          the constructor.

'情報メッセージボックス'

 -- の関数: tkinter.messagebox.showinfo (title=None, message=None,
          **options)

     Creates and displays an information message box with the specified
     title and message.

'警告メッセージボックス'

 -- の関数: tkinter.messagebox.showwarning (title=None, message=None,
          **options)

     Creates and displays a warning message box with the specified title
     and message.

 -- の関数: tkinter.messagebox.showerror (title=None, message=None,
          **options)

     Creates and displays an error message box with the specified title
     and message.

'質問メッセージボックス'

 -- の関数: tkinter.messagebox.askquestion (title=None, message=None, *,
          type=YESNO, **options)

     Ask a question.  By default shows buttons *note YES: 4348. and
     *note NO: 4349.  Returns the symbolic name of the selected button.

 -- の関数: tkinter.messagebox.askokcancel (title=None, message=None,
          **options)

     Ask if operation should proceed.  Shows buttons *note OK: 4346. and
     *note CANCEL: 4347.  Returns ‘True’ if the answer is ok and ‘False’
     otherwise.

 -- の関数: tkinter.messagebox.askretrycancel (title=None, message=None,
          **options)

     Ask if operation should be retried.  Shows buttons *note RETRY:
     4356. and *note CANCEL: 4347.  Return ‘True’ if the answer is yes
     and ‘False’ otherwise.

 -- の関数: tkinter.messagebox.askyesno (title=None, message=None,
          **options)

     Ask a question.  Shows buttons *note YES: 4348. and *note NO: 4349.
     Returns ‘True’ if the answer is yes and ‘False’ otherwise.

 -- の関数: tkinter.messagebox.askyesnocancel (title=None, message=None,
          **options)

     Ask a question.  Shows buttons *note YES: 4348, *note NO: 4349. and
     *note CANCEL: 4347.  Return ‘True’ if the answer is yes, ‘None’ if
     cancelled, and ‘False’ otherwise.
Symbolic names of buttons:

 -- データ: tkinter.messagebox.ABORT = 'abort'

 -- データ: tkinter.messagebox.RETRY = 'retry'

 -- データ: tkinter.messagebox.IGNORE = 'ignore'

 -- データ: tkinter.messagebox.OK = 'ok'

 -- データ: tkinter.messagebox.CANCEL = 'cancel'

 -- データ: tkinter.messagebox.YES = 'yes'

 -- データ: tkinter.messagebox.NO = 'no'
Predefined sets of buttons:

 -- データ: tkinter.messagebox.ABORTRETRYIGNORE = 'abortretryignore'

     Displays three buttons whose symbolic names are *note ABORT: 4359,
     *note RETRY: 4356. and *note IGNORE: 435a.

 -- データ: tkinter.messagebox.OK = 'ok'

     Displays one button whose symbolic name is *note OK: 4346.

 -- データ: tkinter.messagebox.OKCANCEL = 'okcancel'

     Displays two buttons whose symbolic names are *note OK: 4346. and
     *note CANCEL: 4347.

 -- データ: tkinter.messagebox.RETRYCANCEL = 'retrycancel'

     Displays two buttons whose symbolic names are *note RETRY: 4356.
     and *note CANCEL: 4347.

 -- データ: tkinter.messagebox.YESNO = 'yesno'

     Displays two buttons whose symbolic names are *note YES: 4348. and
     *note NO: 4349.

 -- データ: tkinter.messagebox.YESNOCANCEL = 'yesnocancel'

     Displays three buttons whose symbolic names are *note YES: 4348,
     *note NO: 4349. and *note CANCEL: 4347.
Icon images:

 -- データ: tkinter.messagebox.ERROR = 'error'

 -- データ: tkinter.messagebox.INFO = 'info'

 -- データ: tkinter.messagebox.QUESTION = 'question'

 -- データ: tkinter.messagebox.WARNING = 'warning'

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/tkinter/messagebox.py


File: python.info,  Node: tkinter scrolledtext --- スクロール可能なテキストウィジェット,  Next: tkinter dnd --- ドラッグアンドドロップのサポート,  Prev: tkinter messagebox --- Tkinter メッセージプロンプト,  Up: Graphical user interfaces with Tk

5.25.6 ‘tkinter.scrolledtext’ -- スクロール可能なテキストウィジェット
---------------------------------------------------------------------

'ソースコード:' Lib/tkinter/scrolledtext.py(1)

__________________________________________________________________

The ‘tkinter.scrolledtext’ module provides a class of the same name
which implements a basic text widget which has a vertical scroll bar
configured to do the "right thing."  Using the *note ScrolledText: 4366.
class is a lot easier than setting up a text widget and scroll bar
directly.

テキストウィジェットとスクロールバーは ‘Frame’ の中に一緒にpackされ、
‘Grid’ と ‘Pack’ ジオメトリマネジャのメソッドは‘Frame’ オブジェクトから
得られます。これによって、もっとも標準的なジオメトリマネジャの振る舞いに
するために、直接 *note ScrolledText: 4366. ウィジェットを使えるようにな
ります。

特定の制御が必要ならば、以下の属性が利用できます:

 -- クラス: tkinter.scrolledtext.ScrolledText (master=None, **kw)

      -- の属性: frame

          テキストとスクロールバーウィジェットを取り囲むフレーム。

      -- の属性: vbar

          スクロールバーウィジェット。

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/tkinter/scrolledtext.py


File: python.info,  Node: tkinter dnd --- ドラッグアンドドロップのサポート,  Next: tkinter ttk --- Tk のテーマ付きウィジェット,  Prev: tkinter scrolledtext --- スクロール可能なテキストウィジェット,  Up: Graphical user interfaces with Tk

5.25.7 ‘tkinter.dnd’ -- ドラッグアンドドロップのサポート
--------------------------------------------------------

'ソースコード:' Lib/tkinter/dnd.py(1)

__________________________________________________________________

     注釈: This is experimental and due to be deprecated when it is
     replaced with the Tk DND.

The ‘tkinter.dnd’ module provides drag-and-drop support for objects
within a single application, within the same window or between windows.
To enable an object to be dragged, you must create an event binding for
it that starts the drag-and-drop process.  Typically, you bind a
ButtonPress event to a callback function that you write (see *note
バインドとイベント: 42fa.).  The function should call *note dnd_start():
436c, where 'source' is the object to be dragged, and 'event' is the
event that invoked the call (the argument to your callback function).

Selection of a target object occurs as follows:

  1. Top-down search of area under mouse for target widget

        * Target widget should have a callable 'dnd_accept' attribute

        * If 'dnd_accept' is not present or returns ‘None’, search moves
          to parent widget

        * If no target widget is found, then the target object is ‘None’

  2. Call to '<old_target>.dnd_leave(source, event)'

  3. Call to '<new_target>.dnd_enter(source, event)'

  4. Call to '<target>.dnd_commit(source, event)' to notify of drop

  5. Call to '<source>.dnd_end(target, event)' to signal end of
     drag-and-drop

 -- クラス: tkinter.dnd.DndHandler (source, event)

     The 'DndHandler' class handles drag-and-drop events tracking Motion
     and ButtonRelease events on the root of the event widget.

      -- メソッド: cancel (event=None)

          Cancel the drag-and-drop process.

      -- メソッド: finish (event, commit=0)

          Execute end of drag-and-drop functions.

      -- メソッド: on_motion (event)

          Inspect area below mouse for target objects while drag is
          performed.

      -- メソッド: on_release (event)

          Signal end of drag when the release pattern is triggered.

 -- の関数: tkinter.dnd.dnd_start (source, event)

     Factory function for drag-and-drop process.

参考
....

*note バインドとイベント: 42fa.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/tkinter/dnd.py


File: python.info,  Node: tkinter ttk --- Tk のテーマ付きウィジェット,  Next: IDLE --- Python のエディタとシェル<2>,  Prev: tkinter dnd --- ドラッグアンドドロップのサポート,  Up: Graphical user interfaces with Tk

5.25.8 ‘tkinter.ttk’ -- Tk のテーマ付きウィジェット
---------------------------------------------------

'ソースコード:' Lib/tkinter/ttk.py(1)

__________________________________________________________________

The ‘tkinter.ttk’ module provides access to the Tk themed widget set,
introduced in Tk 8.5.  It provides additional benefits including
anti-aliased font rendering under X11 and window transparency (requiring
a composition window manager on X11).

The basic idea for ‘tkinter.ttk’ is to separate, to the extent possible,
the code implementing a widget's behavior from the code implementing its
appearance.

参考
....

Tk Widget Styling Support(2)

     Tk のテーマサポートを紹介するドキュメント

* Menu:

* Ttk を使う::
* Ttk ウィジェット::
* ウィジェット::
* コンボボックス::
* Spinbox::
* ノートブック::
* プログレスバー::
* セパレータ::
* サイズグリップ::
* ツリービュー::
* Ttk スタイル::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/tkinter/ttk.py

   (2) https://core.tcl.tk/tips/doc/trunk/tip/48.md


File: python.info,  Node: Ttk を使う,  Next: Ttk ウィジェット,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.25.8.1 Ttk を使う
...................

Ttk を使い始めるために、モジュールをインポートします:

     from tkinter import ttk

基本的な Tk ウィジェットを上書きするため、次のように Tk のインポートに続
けてインポートを行います:

     from tkinter import *
     from tkinter.ttk import *

That code causes several ‘tkinter.ttk’ widgets (‘Button’, ‘Checkbutton’,
‘Entry’, ‘Frame’, ‘Label’, ‘LabelFrame’, ‘Menubutton’, ‘PanedWindow’,
‘Radiobutton’, ‘Scale’ and ‘Scrollbar’) to automatically replace the Tk
widgets.

これにはプラットフォームをまたいでより良い見た目を得られるという、直接的
な利益がありますが、ウィジェットは完全な互換性を持っているわけではありま
せん。一番の違いは "fg" や "bg" やその他のスタイルに関係するウィジェット
のオプションが Ttk ウィジェットから無くなっていることです。同じ (もしく
はより良い) 見た目にするためには ‘ttk.Style’ を使ってください。

参考
....

Converting existing applications to use Tile widgets(1)

     アプリケーションを移行して新しいウィジェットを使用する際に出くわす
     典型的な差異について (Tcl の用語を使って) 書かれている研究論文

   ---------- Footnotes ----------

   (1) https://tktable.sourceforge.net/tile/doc/converting.txt


File: python.info,  Node: Ttk ウィジェット,  Next: ウィジェット,  Prev: Ttk を使う,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.25.8.2 Ttk ウィジェット
.........................

Ttk には 18 のウィジェットがあり、そのうち 12 は Tkinter に既にあるもの
です: ‘Button’, ‘Checkbutton’, ‘Entry’, ‘Frame’, ‘Label’, ‘LabelFrame’,
‘Menubutton’, ‘PanedWindow’, ‘Radiobutton’, ‘Scale’, ‘Scrollbar’, *note
Spinbox: d8d. 。新しい 6 つは次のものです: *note Combobox: 4377, *note
Notebook: 4378, *note Progressbar: 4379, ‘Separator’, ‘Sizegrip’, *note
Treeview: c87. 。そして、これらは全て *note Widget: 437a. の子クラスです
。

Ttk ウィジェットを使用すると、アプリケーションの見た目と使いやすさが向上
します。上述の通り、書式をコーディングする方法は異なります。

Tk のコード

     l1 = tkinter.Label(text="Test", fg="black", bg="white")
     l2 = tkinter.Label(text="Test", fg="black", bg="white")

Ttk のコード:

     style = ttk.Style()
     style.configure("BW.TLabel", foreground="black", background="white")

     l1 = ttk.Label(text="Test", style="BW.TLabel")
     l2 = ttk.Label(text="Test", style="BW.TLabel")

*note TtkStyling: 437b. についての詳細は *note Style: 560. クラスの文書
を読んでください。


File: python.info,  Node: ウィジェット,  Next: コンボボックス,  Prev: Ttk ウィジェット,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.25.8.3 ウィジェット
.....................

‘ttk.Widget’ はTk のテーマ付きウィジェットがサポートしている標準のオプシ
ョンやメソッドを定義するもので、これを直接インスタンス化するものではあり
ません。

* Menu:

* 標準オプション::
* スクロール可能ウィジェットのオプション::
* ラベルオプション::
* 互換性オプション::
* ウィジェットの状態::
* ttk.Widget: ttk Widget.


File: python.info,  Node: 標準オプション,  Next: スクロール可能ウィジェットのオプション,  Up: ウィジェット

5.25.8.4 標準オプション
.......................

All the ‘ttk’ Widgets accept the following options:

オプション      説明
                
-----------------------------------------------------------------------------------
                
クラス          ウィンドウクラスを指定します。このクラスはオプションデータベース
                にウィンドウの他のオプションについて問い合わせを行うときに使われ
                、これによりウィンドウのデフォルトのバインドタグを決定したり、ウ
                ィジェットのデフォルトのレイアウトやスタイルを選択します。このオ
                プションは読み出し専用で、ウィンドウが作成されるときにのみ指定で
                きます。
                
                
cursor          このウィジェットで使うマウスカーソルを指定します。空文字列 (デフ
                ォルト) が設定されている場合は、カーソルは親ウィジェットのものを
                引き継ぎます。
                
                
takefocus       キーボードによる移動のときにウィンドウがフォーカスを受け入れるか
                を決定します。0、1、空文字列のいずれかを返します。0 が返されると
                、キーボードによる移動でそのウィンドウは常にスキップされます。1
                なら、そのウィンドウが表示されているときに限り入力フォーカスを受
                け入れます。そして空文字列は、移動スクリプトによってウィンドウに
                フォーカスを当てるかどうかが決まることを意味します。
                
                
style           独自のウィジェットスタイルを指定するのに使われます。
                


File: python.info,  Node: スクロール可能ウィジェットのオプション,  Next: ラベルオプション,  Prev: 標準オプション,  Up: ウィジェット

5.25.8.5 スクロール可能ウィジェットのオプション
...............................................

以下のオプションはスクロールバーで操作されるウィジェットが持っているオプ
ションです。

オプション           説明
                     
-----------------------------------------------------------------------------------
                     
xscrollcommand       水平方向のスクロールバーとのやり取りに使われます。
                     
                     ウィジェットのウィンドウが再描画されたとき, ウィジェットは
                     scrollcommand に基いて Tcl コマンドを生成します。
                     
                     通常このオプションにはあるスクロールバーのメソッド
                     ‘Scrollbar.set()’ が設定されます。こうすると、ウィンドウの
                     見た目が変わったときにスクロールバーの状態も更新されます。
                     
                     
yscrollcommand       垂直方向のスクロールバーとのやり取りに使われます。詳しくは
                     、上記を参照してください。
                     


File: python.info,  Node: ラベルオプション,  Next: 互換性オプション,  Prev: スクロール可能ウィジェットのオプション,  Up: ウィジェット

5.25.8.6 ラベルオプション
.........................

以下のオプションはラベルやボタンやボタンに類似したウィジェットが持ってい
るオプションです。

オプション         説明
                   
-----------------------------------------------------------------------------------
                   
text               ウィジェットに表示される文字列を指定します。
                   
                   
textvariable       text オプションの代わりに使う値の変数名を指定します。
                   
                   
underline          このオプションを設定すると、文字列の中で下線を引く文字のイン
                   デックス (0 基点) を指定します。下線が引かれた文字はショート
                   カットとして使われます。
                   
                   
image              表示する画像を指定します。これは 1 つ以上の要素を持つリストで
                   す。先頭の要素はデフォルトの画像名です。残りの要素は
                   *note Style.map(): 1ce6. で定義されているような状態名と値のペ
                   アの並びで、ウィジェットがある状態、もしくはある状態の組み合
                   わせにいるときに使用する別の画像を指定します。このリストにあ
                   る全ての画像は同じサイズでなればなりません。
                   
                   
compound           text オプションと image オプションが両方とも指定されていた場
                   合に、テキストに対して画像をどう配置するかを指定します。適当
                   な値は:
                   
                      * text: テキストのみ表示する
                   
                      * image: 画像のみ表示する
                   
                      * top, bottom, left, right: それぞれ画像をテキストの上、下
                        、左、右に配置する。
                   
                      * none: デフォルト。もしあれば画像を表示し、そうでなければ
                        テキストを表示する。
                   
                   
幅                 0 より大きい場合、テキストラベルを作成するのにどれくらいのス
                   ペースを使うかを文字の幅で指定します。0 より小さい場合、最小
                   の幅が指定されます。0 もしくは無指定の場合、テキストラベルに
                   対して自然な幅が使われます。
                   


File: python.info,  Node: 互換性オプション,  Next: ウィジェットの状態,  Prev: ラベルオプション,  Up: ウィジェット

5.25.8.7 互換性オプション
.........................

オプション   説明
             
----------------------------------------------------------------------------------
             
state        "normal" か "disabled" に設定され、 "disabled" 状態のビットをコン
             トロールします。これは書き込み専用のオプションです: これを設定する
             とウィジェットの状態を変更できますが、 *note Widget.state(): 4381.
             メソッドはこのオプションに影響を及ぼしません。
             


File: python.info,  Node: ウィジェットの状態,  Next: ttk Widget,  Prev: 互換性オプション,  Up: ウィジェット

5.25.8.8 ウィジェットの状態
...........................

ウィジェットの状態は独立した状態フラグのビットマップです。

Flag             説明
                 
-----------------------------------------------------------------------------------
                 
active           マウスカーソルがウィジェットの上にあり、マウスのボタンをクリッ
                 クすることで何らかの動作をさせられます
                 
                 
disabled         プログラムによってウィジェットは無効化されています
                 
                 
focus            ウィジェットにキーボードフォーカスがあります
                 
                 
pressed          ウィジェットは押されています
                 
                 
selected         チェックボタンやラジオボタンのようなウィジェットでの "オン" や
                 "チェック有" や "選択中" に当たります
                 
                 
background       Windows と Mac には "アクティブな" もしくは最前面のウィンドウと
                 いう概念があります。背面のウィンドウにあるウィジェットには
                 'background' 状態が設定され、最前面のウィンドウにあるウィジェッ
                 トでは解除されます
                 
                 
readonly         ウィジェットはユーザからの変更を受け付けません
                 
                 
alternate        ウィジェット特有の切り替え表示になっています
                 
                 
invalid          ウィジェットの値が不正です
                 

状態仕様は状態名の並びになっていて、状態名の先頭にはビットがオフになって
いることを示す感嘆符が付くことがあります。


File: python.info,  Node: ttk Widget,  Prev: ウィジェットの状態,  Up: ウィジェット

5.25.8.9 ttk.Widget
...................

以下に書かれているメソッドに加えて、 ‘ttk.Widget’ は
‘tkinter.Widget.cget()’ メソッドと ‘tkinter.Widget.configure()’ メソッド
をサポートしています。

 -- クラス: tkinter.ttk.Widget

      -- メソッド: identify (x, y)

          'x' 'y' の位置にある要素の名前、もしくはその位置に要素が無けれ
          ば空文字列を返します。

          'x' と 'y' はウィジェットに対するピクセル単位の座標です。

      -- メソッド: instate (statespec, callback=None, *args, **kw)

          ウィジェットの状態をチェックします。コールバックが指定されてい
          ない場合、ウィジェットの状態が 'statespec' に一致していれば
          ‘True’ 、そうでなければ ‘False’ を返します。コールバックが指定
          されていて、ウィジェットの状態が 'statespec' に一致している場
          合、引数に args を指定してそのコールバックを呼び出します。

      -- メソッド: state (statespec=None)

          ウィジェットの状態を変更したり、取得したりします。'statespec'
          が指定されている場合、それに応じてウィジェットの状態を設定し、
          どのフラグが変更されたかを示す新しい 'statespec' を返します。
          'statespec' が指定されていない場合、現在の状態フラグを返します
          。

     通常 'statespec' はリストもしくはタプルです。


File: python.info,  Node: コンボボックス,  Next: Spinbox,  Prev: ウィジェット,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.25.8.10 コンボボックス
........................

‘ttk.Combobox’ ウィジェットはテキストフィールドと値のポップダウンリスト
を結び付けます。このウィジェットは ‘Entry’ の子クラスです。

*note Widget: 437a. から継承したメソッド (‘Widget.cget()’,
‘Widget.configure()’, *note Widget.identify(): 4384, *note
Widget.instate(): 4385, *note Widget.state(): 4381.) と以下の ‘Entry’ か
ら継承したメソッド (‘Entry.bbox()’, ‘Entry.delete()’, ‘Entry.icursor()’,
‘Entry.index()’, ‘Entry.insert()’, ‘Entry.selection()’, ‘Entry.xview()’)
に加え、このクラスには ‘ttk.Combobox’ で説明するメソッドがあります。

* Menu:

* オプション::
* 仮想イベント::
* ttk.Combobox: ttk Combobox.


File: python.info,  Node: オプション,  Next: 仮想イベント,  Up: コンボボックス

5.25.8.11 オプション
....................

このウィジェットは以下の固有のオプションを受け付けます:

オプション            説明
                      
-----------------------------------------------------------------------------------
                      
exportselection       真偽値を取る。設定されている場合、ウィジェットの選択はウィ
                      ンドウマネージャの選択とリンクしています (例えば、
                      Misc.selection_get を実行することで得られます)。
                      
                      
justify               ウィジェットの中でテキストをどう配置するかを指定します。
                      "left", "center", "right" のうちのどれか 1 つです。
                      
                      
高さ                  ポップダウンリストの高さを行数で指定します。
                      
                      
postcommand           コンボボックスの値を表示する直前に呼び出される、
                      (Misc.register などで登録した) スクリプトです。どの値を表
                      示するかについても指定できます。
                      
                      
state                 "normal", "readonly", "disabled" のどれか 1 つです。
                      "readonly" 状態では、直接入力値を編集することはできず、ユ
                      ーザはドロップダウンリストから値を 1 つ選ぶことしかできま
                      せん。"normal" 状態では、テキストフィールドは直接編集でき
                      ます。"disabled" 状態では、コンボボックスは一切反応しませ
                      ん。
                      
                      
textvariable          コンボボックスの値とリンクさせる変数名を指定します。その変
                      数の値が変更されたとき、ウィジェットの値は更新されます。ウ
                      ィジェットの値が更新されたときも同様です。
                      ‘tkinter.StringVar’ を参照してください。
                      
                      
‘values’              ドロップダウンリストに表示する値のリストを指定します。
                      
                      
幅                    入力ウィンドウに必要な幅をウィジェットのフォントの平均的な
                      サイズの文字で測った、文字数を指定します。
                      


File: python.info,  Node: 仮想イベント,  Next: ttk Combobox,  Prev: オプション,  Up: コンボボックス

5.25.8.12 仮想イベント
......................

コンボボックスウィジェットは、ユーザが値のリストから1つ選んだときに仮想
イベント '<<ComboboxSelected>>' を生成します。


File: python.info,  Node: ttk Combobox,  Prev: 仮想イベント,  Up: コンボボックス

5.25.8.13 ttk.Combobox
......................

 -- クラス: tkinter.ttk.Combobox

      -- メソッド: current (newindex=None)

          'newindex' が指定されている場合、コンボボックスの値がドロップ
          ダウンリストの 'newindex' の位置にある値に設定されます。そうで
          ない場合、現在の値のインデックスを、もしくは現在の値がリストに
          含まれていないなら -1 を返します。

      -- メソッド: get ()

          コンボボックスの現在の値を返します。

      -- メソッド: set (value)

          コンボボックスの値を 'value' に設定します。


File: python.info,  Node: Spinbox,  Next: ノートブック,  Prev: コンボボックス,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.25.8.14 Spinbox
.................

The ‘ttk.Spinbox’ widget is a ‘ttk.Entry’ enhanced with increment and
decrement arrows.  It can be used for numbers or lists of string values.
This widget is a subclass of ‘Entry’.

*note Widget: 437a. から継承したメソッド: ‘Widget.cget()’,
‘Widget.configure()’, *note Widget.identify(): 4384, *note
Widget.instate(): 4385, *note Widget.state(): 4381. と、以下の ‘Entry’ か
ら継承したメソッド: ‘Entry.bbox()’, ‘Entry.delete()’, ‘Entry.icursor()’,
‘Entry.index()’, ‘Entry.insert()’, ‘Entry.xview()’ に加え、このクラスに
は ‘ttk.Spinbox’ で説明するいくつかのメソッドがあります。

* Menu:

* オプション: オプション<2>.
* 仮想イベント: 仮想イベント<2>.
* ttk.Spinbox: ttk Spinbox.


File: python.info,  Node: オプション<2>,  Next: 仮想イベント<2>,  Up: Spinbox

5.25.8.15 オプション
....................

このウィジェットは以下の固有のオプションを受け付けます:

オプション                 説明
                           
--------------------------------------------------------------------------------------
                           
from                       Float value.  If set, this is the minimum value to which
                           the decrement button will decrement.  Must be spelled as
                           ‘from_’ when used as an argument, since ‘from’ is a
                           Python keyword.
                           
                           
to                         Float value.  If set, this is the maximum value to which
                           the increment button will increment.
                           
                           
increment                  Float value.  Specifies the amount which the
                           increment/decrement buttons change the value.  Defaults
                           to 1.0.
                           
                           
‘values’                   Sequence of string or float values.  If specified, the
                           increment/decrement buttons will cycle through the items
                           in this sequence rather than incrementing or
                           decrementing numbers.
                           
                           
wrap                       Boolean value.  If ‘True’, increment and decrement
                           buttons will cycle from the ‘to’ value to the ‘from’
                           value or the ‘from’ value to the ‘to’ value,
                           respectively.
                           
                           
format                     String value.  This specifies the format of numbers set
                           by the increment/decrement buttons.  It must be in the
                           form "%W.Pf", where W is the padded width of the value,
                           P is the precision, and '%' and 'f' are literal.
                           
                           
command                    Python callable.  Will be called with no arguments
                           whenever either of the increment or decrement buttons
                           are pressed.
                           


File: python.info,  Node: 仮想イベント<2>,  Next: ttk Spinbox,  Prev: オプション<2>,  Up: Spinbox

5.25.8.16 仮想イベント
......................

The spinbox widget generates an '<<Increment>>' virtual event when the
user presses <Up>, and a '<<Decrement>>' virtual event when the user
presses <Down>.


File: python.info,  Node: ttk Spinbox,  Prev: 仮想イベント<2>,  Up: Spinbox

5.25.8.17 ttk.Spinbox
.....................

 -- クラス: tkinter.ttk.Spinbox

      -- メソッド: get ()

          Returns the current value of the spinbox.

      -- メソッド: set (value)

          Sets the value of the spinbox to 'value'.


File: python.info,  Node: ノートブック,  Next: プログレスバー,  Prev: Spinbox,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.25.8.18 ノートブック
......................

ノートブックウィジェットは複数のウィンドウを管理し、同時に 1 つのウィン
ドウを表示します。それぞれの子ウィンドウはタブの関連付けられていて、ユー
ザはそれを選択して表示されているウィンドウを切り替えます。

* Menu:

* オプション: オプション<3>.
* タブオプション::
* タブ識別子::
* 仮想イベント: 仮想イベント<3>.
* ttk.Notebook: ttk Notebook.


File: python.info,  Node: オプション<3>,  Next: タブオプション,  Up: ノートブック

5.25.8.19 オプション
....................

このウィジェットは以下の固有のオプションを受け付けます:

オプション    説明
              
-----------------------------------------------------------------------------------
              
高さ          0 より大きな値が設定されている場合、 (内部のパディングやタブを含ま
              ない) ペイン領域に必要な高さを指定します。設定されていない場合、全
              てのペインの高さの最大値が使われます。
              
              
padding       ノートブックの外周に付け足す追加の領域の量を指定します。パディング
              は最大 4 個の長さ指定のリストです: 左、上、右、下の順で指定します
              。4 個より少ない場合、デフォルトで下は上と、右は左と、上は左と同じ
              値が、それぞれ使われます。
              
              
幅            0 より大きな値が指定されている場合、(内部のパディングを含まない) ペ
              イン領域に必要な幅を指定します。設定されていない場合、全てのペイン
              の幅の最大値が使われます。
              


File: python.info,  Node: タブオプション,  Next: タブ識別子,  Prev: オプション<3>,  Up: ノートブック

5.25.8.20 タブオプション
........................

タブ用のオプションもあります:

オプション      説明
                
-----------------------------------------------------------------------------------
                
state           "normal", "disabled", "hidden" のうちどれか 1 つです。
                "disabled" の場合、タブは選択することができません。 "hidden" の
                場合、タブは表示されません。
                
                
sticky          ペイン領域の中に子ウィンドウがどう置かれるかを指定します。指定す
                る値は "n", "s", "e", "w" からなる 0 文字以上の文字列です。配置
                マネージャの ‘grid()’ と同様に、それぞれの文字は子ウィンドウが
                (北、南、東、西の) どの辺に対して追随するかに対応しています。
                
                
padding         ノートブックとこのペインの間に付け足す追加の領域の量を指定します
                。文法はこのウィジェットの padding オプションと同じです。
                
                
text            タブに表示するテキストを指定します。
                
                
image           タブに表示する画像を指定します。 *note Widget: 437a. のオプショ
                ン image の説明を参照してください。
                
                
compound        text オプションと image オプションが両方指定されているときにテキ
                ストに対して画像をどう表示するかを指定します。指定する値について
                は *note Label Options: 437f. を参照してください。
                
                
underline       テキスト中の下線を引く文字のインデックス (0 基点) を指定します。
                *note Notebook.enable_traversal(): 4396. が呼ばれていた場合、下
                線が引かれた文字はショートカットとして使われます。
                


File: python.info,  Node: タブ識別子,  Next: 仮想イベント<3>,  Prev: タブオプション,  Up: ノートブック

5.25.8.21 タブ識別子
....................

‘ttk.Notebook’ のいくつかのメソッドにある 'tab_id' は以下の形式を取りま
す:

   * 0 からタブの数の間の整数

   * 子ウィンドウの名前

   * タブを指し示す "@x,y" という形式の位置指定

   * 現在選択されているタブを指し示すリテラル文字列 "current"

   * タブ数を返すリテラル文字列 "end" (*note Notebook.index(): 4398. で
     のみ有効)


File: python.info,  Node: 仮想イベント<3>,  Next: ttk Notebook,  Prev: タブ識別子,  Up: ノートブック

5.25.8.22 仮想イベント
......................

このウィジェットは新しいタブが選択された後に仮想イベント
'<<NotebookTabChanged>>' を生成します。


File: python.info,  Node: ttk Notebook,  Prev: 仮想イベント<3>,  Up: ノートブック

5.25.8.23 ttk.Notebook
......................

 -- クラス: tkinter.ttk.Notebook

      -- メソッド: add (child, **kw)

          ノートブックに新しいタブを追加します。

          ウィンドウが現在ノートブックによって管理されているが隠れている
          場合、以前の位置に復元します。

          利用可能なオプションのリストについては *note Tab Options:
          4395. を参照してください。

      -- メソッド: forget (tab_id)

          'tab_id' で指定されたタブを削除します。関連付けられていたウィ
          ンドウは切り離され、管理対象でなくなります。

      -- メソッド: hide (tab_id)

          'tab_id' で指定されたタブを隠します。

          タブは表示されませんが、関連付いているウィンドウはノートブック
          によって保持されていて、その設定も記憶されています。隠れたタブ
          は *note add(): 439b. コマンドで復元できます。

      -- メソッド: identify (x, y)

          'x' 'y' の位置にあるタブの名前を、そこにタブが無ければ空文字列
          を返します。

      -- メソッド: index (tab_id)

          'tab_id' で指定されたタブのインデックスを、 'tab_id' が文字列
          の "end" だった場合はタブの総数を返します。

      -- メソッド: insert (pos, child, **kw)

          指定された位置にペインを挿入します。

          'pos' は文字列の "end" か整数のインデックスか管理されている子
          ウィンドウの名前です。 'child' が既にノートブックの管理対象だ
          った場合、指定された場所に移動させます。

          利用可能なオプションのリストについては *note Tab Options:
          4395. を参照してください。

      -- メソッド: select (tab_id=None)

          指定された 'tab_id' を選択します。

          関連付いている子ウィンドウは表示され、直前に選択されていたウィ
          ンドウは (もし異なれば) 表示されなくなります。 'tab_id' が指定
          されていない場合は、現在選択されているペインのウィジェット名を
          返します。

      -- メソッド: tab (tab_id, option=None, **kw)

          指定された 'tab_id' のオプションを問い合わせたり、変更したりし
          ます。

          'kw' が与えられなかった場合、タブのオプション値の辞書を返しま
          す。 'option' が指定されていた場合、その 'option' の値を返しま
          す。それ以外の場合は、オプションに対応する値が設定されます。

      -- メソッド: tabs ()

          ノートブックに管理されているウィンドウのリストを返します。

      -- メソッド: enable_traversal ()

          このノートブックを含む最上位にあるウィンドウでのキーボード移動
          を可能にします。

          これによりノートブックを含んだ最上位にあるウィンドウに対し、以
          下のキーバインディングが追加されます:

             * ‘Control’-‘Tab’: 現在選択されているタブの 1 つ次のタブを
               選択します。

             * ‘Shift’-‘Control’-‘Tab’: 現在選択されているタブの 1 つ前
               のタブを選択します。

             * ‘Alt’-‘K’: 'K' があるタブの (下線が引かれた) ショートカッ
               トキーだとして、そのタブを選択します。

          ネストしたノートブックも含め、1 つのウィンドウの最上位にある複
          数のノートブックのキーボード移動が可能になることもあります。し
          かしノートブック上の移動は、全てのペインが同じノートブックを親
          としているときのみ正しく動作します。


File: python.info,  Node: プログレスバー,  Next: セパレータ,  Prev: ノートブック,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.25.8.24 プログレスバー
........................

‘ttk.Progressbar’ ウィジェットは長く走る処理の状態を表示します。このウィ
ジェットは 2 つのモードで動作します: 1) 決定的モードでは、全ての処理の総
量のうち完了した量を表示します。 2) 非決定的モードでは、今作業が進んでい
ることをユーザに示します。

* Menu:

* オプション: オプション<4>.
* ttk.Progressbar: ttk Progressbar.


File: python.info,  Node: オプション<4>,  Next: ttk Progressbar,  Up: プログレスバー

5.25.8.25 オプション
....................

このウィジェットは以下の固有のオプションを受け付けます:

オプション     説明
               
-----------------------------------------------------------------------------------
               
orient         "horizontal" もしくは "vertical" のいずれかです。プログレスバーの
               方向を指定します。
               
               
length         プログレスバーの長さを指定します。 (水平方向の場合は幅、垂直方向
               の場合は高さです)
               
               
mode           "determinate" か "indeterminate" のいずれかです。
               
               
maximum        最大値を数値で指定します。デフォルトは 100 です。
               
               
value          プログレスバーの現在値です。決定的 ("determinate") モードでは、完
               了した処理の量を表します。非決定的 ("indeterminate") モードでは、
               'maximum' を法として解釈され、値が 'maximum' に達したときにプログ
               レスバーは 1 "サイクル" を完了したことになります。
               
               
variable       value オプションとリンクさせる変数名です。指定されている場合、変
               数の値が変更されるとプログレスバーの値は自動的にその値に設定され
               ます。
               
               
phase          読み出し専用のオプションです。このウィジェットの値が 0 より大きく
               、かつ決定的モードでは最大値より小さいときに、ウィジェットが定期
               的にこのオプションの値を増加させます。このオプションは現在の画面
               テーマが追加のアニメーション効果を出すのに使います。
               


File: python.info,  Node: ttk Progressbar,  Prev: オプション<4>,  Up: プログレスバー

5.25.8.26 ttk.Progressbar
.........................

 -- クラス: tkinter.ttk.Progressbar

      -- メソッド: start (interval=None)

          自動増加モードを開始します: 'interval' ミリ秒ごとに *note
          Progressbar.step(): 43a7. を繰り返し呼び出すタイマーイベントを
          設定します。引数で指定しない場合は、 'interval' はデフォルトで
          50 ミリ秒になります。

      -- メソッド: step (amount=None)

          プログレスバーの値を 'amount' だけ増加させます。

          引数で指定しない場合は、 'amount' はデフォルトで 1.0 になりま
          す。

      -- メソッド: stop ()

          自動増加モードを停止します: このプログレスバーの *note
          Progressbar.start(): 43a6. で開始された繰り返しのタイマーイベ
          ントを全てキャンセルします。


File: python.info,  Node: セパレータ,  Next: サイズグリップ,  Prev: プログレスバー,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.25.8.27 セパレータ
....................

‘ttk.Separator’ ウィジェットは水平もしくは垂直のセパレータを表示します。

‘ttk.Widget’ から継承したメソッド以外にメソッドを持ちません。

* Menu:

* オプション: オプション<5>.


File: python.info,  Node: オプション<5>,  Up: セパレータ

5.25.8.28 オプション
....................

このウィジェットは次の特定のオプションを受け付けます。

オプション   説明
             
----------------------------------------------------------------------------------
             
orient       "horizontal" か "vertical" のいずれかです。セパレータの方向を指定
             します。
             


File: python.info,  Node: サイズグリップ,  Next: ツリービュー,  Prev: セパレータ,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.25.8.29 サイズグリップ
........................

(グローボックスとしても知られる) ‘ttk.Sizegrip’ ウィジェットを使用すると
、つまみ部分を押してドラッグすることで、このウィジェットを含む最上位のウ
ィンドウのサイズを変更できます。

このウィジェットは ‘ttk.Widget’ から継承したもの以外のオプションとメソッ
ドを持ちません。

* Menu:

* プラットフォーム固有のメモ::
* バグ::


File: python.info,  Node: プラットフォーム固有のメモ,  Next: バグ,  Up: サイズグリップ

5.25.8.30 プラットフォーム固有のメモ
....................................

   * macOS では、最上位のウィンドウにはデフォルトで組み込みのサイズグリ
     ップが含まれています。組み込みのグリップが ‘Sizegrip’ を隠してしま
     うので、 ‘Sizegrip’ を追加しても問題ありません。


File: python.info,  Node: バグ,  Prev: プラットフォーム固有のメモ,  Up: サイズグリップ

5.25.8.31 バグ
..............

   * このウィジェットを含む最上位のウィンドウの位置がスクリーンの右端や
     下端に対して相対的に指定されている場合 (例: ....)  、 ‘Sizegrip’ ウ
     ィジェットはウィンドウのサイズ変更をしません。

   * このウィジェットは "南東" 方向のサイズ変更しかサポートしていません
     。


File: python.info,  Node: ツリービュー,  Next: Ttk スタイル,  Prev: サイズグリップ,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.25.8.32 ツリービュー
......................

‘ttk.Treeview’ ウィジェットは階層のある要素 (アイテム) の集まりを表示し
ます。それぞれの要素はテキストラベル、オプションの画像、オプションのデー
タのリストを持っています。データはラベルの後に続くカラムに表示されます。

データが表示される順序はウィジェットの ‘displaycolumns’ オプションで制御
されます。ツリーウィジェットはカラムヘッダを表示することもできます。カラ
ムには数字もしくはウィジェットの columns オプションにある名前でアクセス
できます。 *note Column Identifiers: 43af. を参照してください。

それぞれの要素は一意な名前で識別されます。要素の作成時に識別子が与えられ
なかった場合、ウィジェットが要素の識別子を生成します。このウィジェットに
は ‘{}’ という名前の特別なルート要素があります。ルート要素自身は表示され
ません; その子要素たちが階層の最上位に現れます。

それぞれの要素はタグのリストも持っていて、イベントバインディングと個別の
要素を関連付け、要素の見た目を管理するのに使えます。

ツリービューウィジェットは水平方向と垂直方向のスクロールをサポートしてい
て、 *note Scrollable Widget Options: 437e. に記述してあるオプションと
*note Treeview.xview(): 43b0. メソッドおよび *note Treeview.yview():
43b1. メソッドが使えます。

* Menu:

* オプション: オプション<6>.
* 要素オプション::
* タグオプション::
* カラム識別子::
* 仮想イベント: 仮想イベント<4>.
* ttk.Treeview: ttk Treeview.


File: python.info,  Node: オプション<6>,  Next: 要素オプション,  Up: ツリービュー

5.25.8.33 オプション
....................

このウィジェットは以下の固有のオプションを受け付けます:

オプション           説明
                     
----------------------------------------------------------------------------------
                     
columns              カラム数とその名前を指定するカラム識別子のリストです。
                     
                     
displaycolumns       どのデータカラムをどの順序で表示するかを指定する、 (名前も
                     しくは整数のインデックスの) カラム識別子のリストか、文字列
                     "#all" です。
                     
                     
高さ                 表示する行数を指定します。メモ: 表示に必要な幅はカラム幅の
                     合計から決定されます。
                     
                     
padding              ウィジェットの内部のパディングのサイズを指定します。パディ
                     ングは最大 4 個の長さ指定のリストです。
                     
                     
selectmode           組み込みのクラスバインディングが選択状態をどう管理するかを
                     指定します。設定する値は "extended", "browse", "none" のど
                     れか 1 つです。 "extended" に設定した場合 (デフォルト)、複
                     数の要素が選択できます。 "browse" に設定した場合、同時に 1
                     つの要素しか選択できません。 "none" に設定した場合、選択を
                     変更することはできません。
                     
                     このオプションの値によらず、アプリケーションのコードと関連
                     付けられているタグからは好きなように選択状態を設定できます
                     。
                     
                     
show                 ツリーのどの要素を表示するかを指定する、以下にある値を 0 個
                     以上含むリストです。
                     
                        * tree: カラム #0 にツリーのラベルを表示します。
                     
                        * headings: ヘッダ行を表示します。
                     
                     デフォルトは "tree headings" 、つまり全ての要素を表示しま
                     す。
                     
                     'メモ': show="tree" が指定されていない場合でも、カラム #0
                     は常にツリーカラムを参照します。
                     


File: python.info,  Node: 要素オプション,  Next: タグオプション,  Prev: オプション<6>,  Up: ツリービュー

5.25.8.34 要素オプション
........................

以下の要素オプションは、ウィジェットの insert コマンドと item コマンドで
要素に対して指定できます。

オプション   説明
             
---------------------------------------------------------------------------------
             
text         アイテムに表示するテキストラベルです。
             
             
image        ラベルの左に表示される Tk 画像です。
             
             
‘values’     要素に関連付けられている値のリストです。
             
             それぞれの要素はウィジェットの columns オプションと同じ数の値を持
             たなければいけません。 columns オプションより少ない場合、残りの値
             は空として扱われます。 columns オプションより多い場合、余計な値は
             無視されます。
             
             
open         要素の子供を表示するか隠すかを指示する ‘True’/‘False’ 値です。
             
             
tags         この要素に関連付いているタグのリストです。
             


File: python.info,  Node: タグオプション,  Next: カラム識別子,  Prev: 要素オプション,  Up: ツリービュー

5.25.8.35 タグオプション
........................

以下のオプションはタグに対して設定できます:

オプション       説明
                 
---------------------------------------------------------------------------------
                 
foreground       テキストの色を指定します。
                 
                 
background       セルや要素の背景色を指定します。
                 
                 
font             テキストを描画するときに使うフォントを指定します。
                 
                 
image            要素の image オプションが空だった場合に使用する画像を指定しま
                 す。
                 


File: python.info,  Node: カラム識別子,  Next: 仮想イベント<4>,  Prev: タグオプション,  Up: ツリービュー

5.25.8.36 カラム識別子
......................

カラム識別子は以下のいずれかの形式を取ります:

   * columns オプションのリストにある名前。

   * n 番目のデータカラムを指し示す整数 n 。

   * n を整数として n 番目の表示されているカラムを指し示す #n という形式
     の文字列。

注釈:

   * 要素のオプション値は実際に格納されている順序とは違った順序で表示さ
     れることがあります。

   * show="tree" が指定されていない場合でも、カラム #0 は常にツリーカラ
     ムを指しています。

データカラムを指す数字は、要素の values オプションのリストのインデックス
です; 表示カラムを指す数字は、値が表示されているツリーのカラム番号です。
ツリーラベルはカラム #0 に表示されます。 displaycolumns オプションが設定
されていない場合は、 n 番目のデータカラムはカラム #n+1 に表示されます。
再度言っておくと、 'カラム #0 は常にツリーカラムを指します' 。


File: python.info,  Node: 仮想イベント<4>,  Next: ttk Treeview,  Prev: カラム識別子,  Up: ツリービュー

5.25.8.37 仮想イベント
......................

ツリービューは以下の仮想イベントを生成します。

Event                    説明
                         
--------------------------------------------------------------------------------
                         
<<TreeviewSelect>>       選択状態が変更されたときに生成されます。
                         
                         
<<TreeviewOpen>>         フォーカスが当たっている要素に open=True が設定され
                         る直前に生成されます。
                         
                         
<<TreeviewClose>>        フォーカスが当たっている要素に open=False が設定され
                         た直後に生成されます。
                         

*note Treeview.focus(): 43b6. メソッドと *note Treeview.selection():
c86. メソッドは変更を受けた要素を判別するのに使えます。


File: python.info,  Node: ttk Treeview,  Prev: 仮想イベント<4>,  Up: ツリービュー

5.25.8.38 ttk.Treeview
......................

 -- クラス: tkinter.ttk.Treeview

      -- メソッド: bbox (item, column=None)

          (ツリービューウィジェットのウィンドウを基準として) 指定された
          'item' のバウンディングボックス情報を (x 座標, y 座標, 幅, 高
          さ) の形式で返します。

          'column' が指定されている場合は、セルのバウンディングボックス
          を返します。 (例えば、閉じた状態の要素の子供であったり、枠外に
          スクロールされていて) 'item' が見えなくなっている場合は、空文
          字列が返されます。

      -- メソッド: get_children (item=None)

          'item' の子要素のリストを返します。

          'item' が指定されていなかった場合は、ルート要素の子供が返され
          ます。

      -- メソッド: set_children (item, *newchildren)

          'item' の子要素を 'newchildren' で置き換えます。

          'item' にいる子供のうち 'newchildren' にないものはツリーから切
          り離されます。 'newchildren' にあるどの要素も 'item' の祖先で
          あってはいけません。 'newchildren' を指定しなかった場合は、
          'item' の子要素が全て切り離されることに注意してください。

      -- メソッド: column (column, option=None, **kw)

          指定した 'column' のオプションを問い合わせたり、変更したりしま
          す。

          'kw' が与えられなかった場合は、カラムのオプション値の辞書が返
          されます。 'option' が指定されていた場合は、その 'option' の値
          が返されます。それ以外の場合は、オプションに値を設定します。

          設定できるオプションとその値は次の通りです:

          'id'

               カラム名を返します。これは読み出し専用のオプションです。

          'anchor': One of the standard Tk anchor values.

               このカラムでセルに対してテキストをどう配置するかを指定し
               ます。

          'minwidth': width

               カラムの最小幅をピクセル単位で表したものです。ツリービュ
               ーウィジェットは、ウィジェットのサイズが変更されたりカラ
               ムをユーザがドラッグして移動させたりしたときに、このオプ
               ションで指定した幅より狭くすることはありません。

          'stretch': ‘True’/‘False’

               ウィジェットがサイズ変更されたとき、カラムの幅をそれに合
               わせるかどうかを指定します。

          'width': width

               カラムの幅をピクセル単位で表したものです。

          ツリーカラムの設定を行うには、 column = "#0" を付けてこのメソ
          ッドを呼び出してください。

      -- メソッド: delete (*items)

          指定された 'items' とその子孫たち全てを削除します。

          ルート要素は削除されません。

      -- メソッド: detach (*items)

          指定された 'items' を全てツリーから切り離します。

          その要素と子孫たちは依然として存在していて、ツリーの別の場所に
          再度挿入することができますが、隠された状態になり表示はされませ
          ん。

          ルート要素は切り離されません。

      -- メソッド: exists (item)

          指定された 'item' がツリーの中にあれば ‘True’ を返します。

      -- メソッド: focus (item=None)

          'item' が指定されていた場合は、 'item' にフォーカスを当てます
          。そうでない場合は、現在フォーカスが当たっている要素が、どの要
          素にもフォーカスが当たっていない場合は '' が返されます。

      -- メソッド: heading (column, option=None, **kw)

          指定された 'column' の heading のオプションを問い合わせたり、
          変更したりします。

          'kw' が与えられなかった場合は、見出しのオプション値の辞書が返
          されます。 'option' が指定されている場合は、 'option' の値が返
          されます。それ以外の場合は、オプションに値を設定します。

          設定できるオプションとその値は次の通りです:

          'text': text

               カラムの見出しに表示するテキスト。

          'image': imageName

               カラムの見出しの右に表示する画像を指定します。

          'anchor': anchor

               見出しのテキストをどう配置するかを指定します。標準の Tk
               anchor の値です。

          'command': callback

               見出しラベルがクリックされたときに実行されるコールバック
               です。

          ツリーカラムの見出しの設定を行うには、 column = "#0" を付けて
          このメソッドを呼び出してください。

      -- メソッド: identify (component, x, y)

          'x' 'y' で与えられた場所にある指定された 'component' の説明を
          返します。その場所に指定された 'component' が無い場合は空文字
          列を返します。 (訳注: component には "region", "item",
          "column", "row", "element" が指定でき、それぞれ "cell",
          "heading" などの場所の名前、要素の識別子、 #n という形式のカラ
          ム名、その行にある要素の識別子、 "text", "padding" などの画面
          構成要素の名前を返します。)

      -- メソッド: identify_row (y)

          y 座標が 'y' の位置にある要素の識別子を返します。

      -- メソッド: identify_column (x)

          x 座標が 'x' の位置にあるセルのデータカラムの識別子を返します
          。

          ツリーカラムは #0 という識別子を持ちます。

      -- メソッド: identify_region (x, y)

          以下のうち 1 つを返します:

          region          意味
                          
          -----------------------------------------------------------
                          
          heading         ツリーの見出し領域
                          
                          
          separator       2 つのカラム見出しの間のスペース
                          
                          
          tree            ツリーの領域
                          
                          
          cell            データセル
                          

          使用可能バージョン: Tk 8.6

      -- メソッド: identify_element (x, y)

          'x' 'y' の位置にある画面構成要素の名前を返します。

          使用可能バージョン: Tk 8.6

      -- メソッド: index (item)

          親要素の子要素リストの中での 'item' のインデックスを返します。

      -- メソッド: insert (parent, index, iid=None, **kw)

          新しい要素を作り、その要素の識別子を返します。

          'parent' は親となる要素の識別子で、空文字列にすると新しい要素
          を最上位に作成します。 'index' は整数もしくは "end" という値で
          、それによって親要素の子要素リストのどこに新しい要素を挿入する
          かを指定します。 'index' が 0 以下だった場合は、新しい要素は先
          頭に挿入されます; 'index' が現在の子要素の数以上だった場合は末
          尾に挿入されます。 'iid' が指定された場合は、要素の識別子とし
          て使われます; 'iid' はまだツリーに存在していないものに限ります
          。それ以外の場合は、一意な識別子が生成されます。

          See *note Item Options: 43b3. for the list of available
          options.

      -- メソッド: item (item, option=None, **kw)

          指定された 'item' のオプションを問い合わせたり、変更したりしま
          す。

          オプションが与えられなかった場合は、要素のオプションと値が辞書
          の形で返されます。 'option' が指定された場合は、そのオプション
          の値が返されます。それ以外の場合は、 'kw' で与えられたようにオ
          プションに値が設定されます。

      -- メソッド: move (item, parent, index)

          'item' を 'parent' の子要素リストの 'index' の位置に移動します
          。

          要素を自身の子孫の下に移動させるのは許されていません。 'index'
          が 0 以下の場合、 'item' は先頭に移動されます; 子要素の数以上
          だった場合、末尾に移動されます。 'item' が切り離された状態の場
          合は、再度取り付けられます。

      -- メソッド: next (item)

          'item' の 1 つ下の兄弟の識別子を、 'item' が親にとって一番下の
          子供だった場合 '' を返します。

      -- メソッド: parent (item)

          'item' の親の識別子を、 'item' が階層の最上位にいた場合 '' を
          返します。

      -- メソッド: prev (item)

          'item' の 1 つ上の兄弟の識別子を、 'item' が親にとって一番上の
          子供だった場合 '' を返します。

      -- メソッド: reattach (item, parent, index)

          *note Treeview.move(): 43c8. のエイリアスです。

      -- メソッド: see (item)

          'item' を見える状態にします。

          'item' の全ての子孫の open オプションを ‘True’ にし、必要であ
          れば 'item' がツリーの見える範囲に来るようにウィジェットをスク
          ロールさせます。

      -- メソッド: selection ()

          Returns a tuple of selected items.

          バージョン 3.8 で変更: ‘selection()’ no longer takes
          arguments.  For changing the selection state use the following
          selection methods.

      -- メソッド: selection_set (*items)

          新しく選択状態の要素が 'items' になります。

          バージョン 3.6 で変更: 'items' は 1 つのタプルとしてだけでなく
          、別々の引数としても渡せます。

      -- メソッド: selection_add (*items)

          選択状態の要素として 'items' を追加します。

          バージョン 3.6 で変更: 'items' は 1 つのタプルとしてだけでなく
          、別々の引数としても渡せます。

      -- メソッド: selection_remove (*items)

          選択状態の要素から 'items' を取り除きます。

          バージョン 3.6 で変更: 'items' は 1 つのタプルとしてだけでなく
          、別々の引数としても渡せます。

      -- メソッド: selection_toggle (*items)

          'items' のそれぞれの要素の選択状態を入れ替えます。

          バージョン 3.6 で変更: 'items' は 1 つのタプルとしてだけでなく
          、別々の引数としても渡せます。

      -- メソッド: set (item, column=None, value=None)

          1 引数で呼び出された場合、指定された 'item' のカラムと値のペア
          からなる辞書を返します。 2 引数で呼び出された場合、指定された
          'column' の現在の値を返します。 3 引数で呼び出された場合、与え
          られた 'item' の 'column' を指定された値 'value' に設定します
          。

      -- メソッド: tag_bind (tagname, sequence=None, callback=None)

          与えられたイベント 'sequence' 用のコールバックをタグ 'tagname'
          にバインドします。イベントが要素に渡ってきたときに、要素の
          tags オプションのそれぞれのコールバックが呼び出されます。

      -- メソッド: tag_configure (tagname, option=None, **kw)

          指定された 'tagname' のオプションを問い合わせたり、変更したり
          します。

          'kw' が与えられなかった場合、 'tagname' のオプション設定を辞書
          の形で返します。 'option' が指定された場合、指定された
          'tagname' の 'option' の値を返します。それ以外の場合、与えられ
          た 'tagname' のオプションに値を設定します。

      -- メソッド: tag_has (tagname, item=None)

          'item' が指定されていた場合、指定された 'item' が与えられた
          'tagname' を持っているかどうかに従って 1 または 0 が返されます
          。そうでない場合、指定されたタグを持つ全ての要素のリストを返し
          ます。

          使用可能バージョン: Tk 8.6

      -- メソッド: xview (*args)

          ツリービューの水平方向の位置を問い合わせたり、変更したりします
          。

      -- メソッド: yview (*args)

          ツリービューの垂直方向の位置を問い合わせたり、変更したりします
          。


File: python.info,  Node: Ttk スタイル,  Prev: ツリービュー,  Up: tkinter ttk --- Tk のテーマ付きウィジェット

5.25.8.39 Ttk スタイル
......................

‘ttk’ のそれぞれのウィジェットにはスタイルが関連付けられていて、それと動
的もしくはデフォルトで設定される要素のオプションによってウィジェットを構
成する要素とその配置を指定します。デフォルトではスタイル名はウィジェット
のクラス名と同じですが、ウィジェットの style オプションで上書きすること
ができます。ウィジェットのクラス名が分からない場合は、
‘Misc.winfo_class()’ (somewidget.winfo_class()) メソッドを使ってください
。

参考
....

Tcl'2004 conference のプレゼンテーション(1)

     この文書ではテーマエンジンがどう動くかを説明しています

 -- クラス: tkinter.ttk.Style

     このクラスはスタイルデータベースを操作するために使われます。

      -- メソッド: configure (style, query_opt=None, **kw)

          'style' の指定されたオプションのデフォルト値を問い合わせたり、
          設定したりします。

          'kw' のそれぞれのキーはオプション名で値はそのオプションの値の
          文字列です。

          例えば、全てのデフォルトのボタンをパディングのある平らな見た目
          にし、背景の色を変更するには以下のようにします:

               from tkinter import ttk
               import tkinter

               root = tkinter.Tk()

               ttk.Style().configure("TButton", padding=6, relief="flat",
                  background="#ccc")

               btn = ttk.Button(text="Sample")
               btn.pack()

               root.mainloop()

      -- メソッド: map (style, query_opt=None, **kw)

          'style' の指定されたオプションの動的な値を問い合わせたり、設定
          したりします。

          'kw' のそれぞれのキーはオプション名で、値はタプルやリストや何
          か他のお好みのものでグループ化された状態仕様 (statespec) を要
          素とするリストやタプルです。状態仕様は 1 つもしくは複数の状態
          と値の組み合わせです。

          以下のように、例を示す方がわかりやすいでしょう:

               import tkinter
               from tkinter import ttk

               root = tkinter.Tk()

               style = ttk.Style()
               style.map("C.TButton",
                   foreground=[('pressed', 'red'), ('active', 'blue')],
                   background=[('pressed', '!disabled', 'black'), ('active', 'white')]
                   )

               colored_btn = ttk.Button(text="Test", style="C.TButton").pack()

               root.mainloop()

          あるオプションに対する状態と値の組 (states, value) の並び順は
          スタイルに影響を与えることに注意してください。例えば、
          foreground オプションの順序を ‘[('active', 'blue'),
          ('pressed', 'red')]’ に変更した場合、ウィジェットがアクティブ
          もしくは押された状態のとき前面が青くなります。

      -- メソッド: lookup (style, option, state=None, default=None)

          'style' の指定された 'option' の値を返します。

          'state' を指定する場合は、1 つ以上の状態名の並びである必要があ
          ります。 'default' 引数が指定されていた場合は、オプション指定
          が見付からなかったときに代わりに返される値として使われます。

          デフォルトでボタンがどのフォントを使うかを調べるには、以下のよ
          うに実行します:

               from tkinter import ttk

               print(ttk.Style().lookup("TButton", "font"))

      -- メソッド: layout (style, layoutspec=None)

          与えられた 'style' でのウィジェットのレイアウトを定義します。
          'layoutspec' が省略されていた場合は、与えられたスタイルのレイ
          アウト仕様を返します。

          'layoutspec' を指定する場合は、リストもしくは (文字列を除いた)
          何か他のシーケンス型である必要があります。それぞれの要素はタプ
          ルで、レイアウト名を 1 番目の要素とし、2 番目の要素は *note
          Layouts: 43d9. で説明されているフォーマットである必要がありま
          す。

          フォーマットを理解するために以下の例を見てください (何かを使い
          易くするための例ではありません):

               from tkinter import ttk
               import tkinter

               root = tkinter.Tk()

               style = ttk.Style()
               style.layout("TMenubutton", [
                  ("Menubutton.background", None),
                  ("Menubutton.button", {"children":
                      [("Menubutton.focus", {"children":
                          [("Menubutton.padding", {"children":
                              [("Menubutton.label", {"side": "left", "expand": 1})]
                          })]
                      })]
                  }),
               ])

               mbtn = ttk.Menubutton(text='Text')
               mbtn.pack()
               root.mainloop()

      -- メソッド: element_create (elementname, etype, *args, **kw)

          Create a new element in the current theme, of the given
          'etype' which is expected to be either "image", "from" or
          "vsapi".  The latter is only available in Tk 8.6 on Windows.

          "image" が使われた場合、 'args' はデフォルトの画像名の後ろに状
          態仕様と値のペア (これが画像仕様です) を並べたものである必要が
          あります。 'kw' には以下のオプションが指定できます:

          border=padding

               padding は 4 個以下の整数のリストで、それぞれ左、上、右、
               下の縁の幅を指定します。

          height=height

               要素の最小の高さを指定します。0 より小さい場合は、画像の
               高さをデフォルトとして使用します。

          padding=padding

               要素の内部のパディングを指定します。指定されない場合は、
               border の値がデフォルトとして使われます。

          sticky=spec

               1 つ外側の枠に対し画像をどう配置するかを指定します。 spec
               は "n", "s", "w", "e" の文字を 0 個以上含みます。

          width=width

               要素の最小の幅を指定します。0 より小さい場合は、画像の幅
               をデフォルトとして使用します。

          以下はプログラム例です:

               img1 = tkinter.PhotoImage(master=root, file='button.png')
               img1 = tkinter.PhotoImage(master=root, file='button-pressed.png')
               img1 = tkinter.PhotoImage(master=root, file='button-active.png')
               style = ttk.Style(root)
               style.element_create('Button.button', 'image',
                                    img1, ('pressed', img2), ('active', img3),
                                    border=(2, 4), sticky='we')

          'etype' の値として "from" が使われた場合は、 *note
          element_create(): 55f. が現在の要素を複製します。 'args' は要
          素の複製元のテーマの名前と、オプションで複製する要素を含んでい
          る必要があります。複製元の要素が指定されていなかった場合、空要
          素が使用され、 'kw' は破棄されます。

          以下はプログラム例です:

               style = ttk.Style(root)
               style.element_create('plain.background', 'from', 'default')

          If "vsapi" is used as the value of 'etype', *note
          element_create(): 55f. will create a new element in the
          current theme whose visual appearance is drawn using the
          Microsoft Visual Styles API which is responsible for the
          themed styles on Windows XP and Vista.  'args' is expected to
          contain the Visual Styles class and part as given in the
          Microsoft documentation followed by an optional sequence of
          tuples of ttk states and the corresponding Visual Styles API
          state value.  'kw' may have the following options:

          padding=padding

               Specify the element's interior padding.  'padding' is a
               list of up to four integers specifying the left, top,
               right and bottom padding quantities respectively.  If
               fewer than four elements are specified, bottom defaults
               to top, right defaults to left, and top defaults to left.
               In other words, a list of three numbers specify the left,
               vertical, and right padding; a list of two numbers
               specify the horizontal and the vertical padding; a single
               number specifies the same padding all the way around the
               widget.  This option may not be mixed with any other
               options.

          margins=padding

               Specifies the elements exterior padding.  'padding' is a
               list of up to four integers specifying the left, top,
               right and bottom padding quantities respectively.  This
               option may not be mixed with any other options.

          width=width

               Specifies the width for the element.  If this option is
               set then the Visual Styles API will not be queried for
               the recommended size or the part.  If this option is set
               then 'height' should also be set.  The 'width' and
               'height' options cannot be mixed with the 'padding' or
               'margins' options.

          height=height

               Specifies the height of the element.  See the comments
               for 'width'.

          以下はプログラム例です:

               style = ttk.Style(root)
               style.element_create('pin', 'vsapi', 'EXPLORERBAR', 3, [
                                    ('pressed', '!selected', 3),
                                    ('active', '!selected', 2),
                                    ('pressed', 'selected', 6),
                                    ('active', 'selected', 5),
                                    ('selected', 4),
                                    ('', 1)])
               style.layout('Explorer.Pin',
                            [('Explorer.Pin.pin', {'sticky': 'news'})])
               pin = ttk.Checkbutton(style='Explorer.Pin')
               pin.pack(expand=True, fill='both')

          バージョン 3.13 で変更: Added support of the "vsapi" element
          factory.

      -- メソッド: element_names ()

          現在のテーマに定義されている要素のリストを返します。

      -- メソッド: element_options (elementname)

          'elementname' のオプションのリストを返します。

      -- メソッド: theme_create (themename, parent=None, settings=None)

          新しいテーマを作成します。

          'themename' が既に存在していた場合はエラーになります。
          'parent' が指定されていた場合は、新しいテーマは親テーマからス
          タイルや要素やレイアウトを継承します。 'settings' が指定された
          場合は、 *note theme_settings(): 43dd. で使われるのと同じ形式
          である必要があります。

      -- メソッド: theme_settings (themename, settings)

          一時的に現在のテーマを 'themename' に設定し、指定された
          'settings' を適用した後、元のテーマを復元します。

          'settings' のそれぞれのキーはスタイル名で値はさらに
          'configure', 'map', 'layout', 'element create' をキーとして持
          ち、その値はそれぞれ *note Style.configure(): 43d6, *note
          Style.map(): 1ce6, *note Style.layout(): 43d8, *note
          Style.element_create(): 55f. メソッドで指定するのと同じ形式で
          ある必要があります。

          例として、コンボボックスの default テーマを少し変更してみまし
          ょう

               from tkinter import ttk
               import tkinter

               root = tkinter.Tk()

               style = ttk.Style()
               style.theme_settings("default", {
                  "TCombobox": {
                      "configure": {"padding": 5},
                      "map": {
                          "background": [("active", "green2"),
                                         ("!disabled", "green4")],
                          "fieldbackground": [("!disabled", "green3")],
                          "foreground": [("focus", "OliveDrab1"),
                                         ("!disabled", "OliveDrab2")]
                      }
                  }
               })

               combo = ttk.Combobox().pack()

               root.mainloop()

      -- メソッド: theme_names ()

          全ての既存のテーマのリストを返します。

      -- メソッド: theme_use (themename=None)

          'themename' が与えられなかった場合は、現在使用中のテーマ名を返
          します。そうでない場合は、現在のテーマを 'themename' に設定し
          、全てのウィジェットを再描画し、 <<ThemeChanged>> イベントを発
          生させます。

* Menu:

* レイアウト::

   ---------- Footnotes ----------

   (1) https://tktable.sourceforge.net/tile/tile-tcl2004.pdf


File: python.info,  Node: レイアウト,  Up: Ttk スタイル

5.25.8.40 レイアウト
....................

A layout can be just ‘None’, if it takes no options, or a dict of
options specifying how to arrange the element.  The layout mechanism
uses a simplified version of the pack geometry manager: given an initial
cavity, each element is allocated a parcel.

設定できるオプションとその値は次の通りです:

'side': whichside

     要素を空間のどちら側に配置するかを指定します; top, right, bottom,
     left のどれか 1 つです。省略された場合は、要素は空間全体を占めます
     。

'sticky': nswe

     配分された空間の内部に要素をどう配置するかを指定します。

'unit': 0 or 1

     1 に設定されると、 *note Widget.identify(): 4384. などには要素とそ
     の子で単一の要素として扱われます。これは、グリップのついたスクロー
     ルバーサムのようなものに使われます。

'children': [sublayout... ]

     要素の内部に配置する要素のリストを指定します。リストのそれぞれの要
     素はタプル (もしくは他のシーケンス型) で、それの 1 番目の要素はレイ
     アウト名でそれ以降は *note Layout: 43d9. です。


File: python.info,  Node: IDLE --- Python のエディタとシェル<2>,  Next: turtle --- Turtle graphics,  Prev: tkinter ttk --- Tk のテーマ付きウィジェット,  Up: Graphical user interfaces with Tk

5.25.9 IDLE -- Python のエディタとシェル
----------------------------------------

'ソースコード:' Lib/idlelib/(1)

__________________________________________________________________

IDLE は Python の統合開発環境で、学習用環境です。

IDLE は次のような特徴があります:

   * クロスプラットホーム: Windows, Unix, macOS で動作します

   * コード入力、出力、エラーメッセージの色付け機能を持った Python shell
     (対話的インタプリタ) ウィンドウ

   * 多段 Undo、 Python 対応の色づけ、自動的な字下げ、呼び出し情報の表示
     、自動補完、他たくさんの機能をもつマルチウィンドウ・テキストエディ
     タ

   * 任意のウィンドウ内での検索、エディタウィンドウ内での置換、複数ファ
     イルを跨いだ検索 (grep)

   * 永続的なブレイクポイント、ステップ実行、グローバルとローカル名前空
     間の視覚化機能を持ったデバッガ

   * 設定、ブラウザ群、ほかダイアログ群

The IDLE application is implemented in the *note idlelib: 77. package.

This is an *note optional module: 215a.  If it is missing from your copy
of CPython, look for documentation from your distributor (that is,
whoever provided Python to you).  If you are the distributor, see *note
オプションのモジュールの要件: 2158.

* Menu:

* メニュー::
* Editing and Navigation::
* Startup and Code Execution::
* Help and Preferences::
* idlelib: idlelib --- implementation of IDLE application. implementation of IDLE application

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/idlelib/


File: python.info,  Node: メニュー,  Next: Editing and Navigation,  Up: IDLE --- Python のエディタとシェル<2>

5.25.9.1 メニュー
.................

IDLE には2種類のメインウィンドウ、Shell ウィンドウと Editor ウィンドウが
あります。 Editor ウィンドウは同時に複数開けます。 Windows と Linux では
、それぞれ個別のトップメニューがあります。 後で解説するそれぞれのメニュ
ーは、ウィンドウがどちらのウィンドウタイプなのかを示しています。

ファイル内の編集 (Edit) => 検索 (Find) で使われるような出力ウィンドウ
(Output ウィンドウ) は editor ウィンドウのサブタイプで、 Editor ウィンド
ウと同じトップメニューを持ちますが、デフォルトタイトルとコンテキストメニ
ューが違います。

On macOS, there is one application menu.  It dynamically changes
according to the window currently selected.  It has an IDLE menu, and
some entries described below are moved around to conform to Apple
guidelines.

* Menu:

* File メニュー (Shell ウィンドウ、Editor ウィンドウ): File メニュー Shell ウィンドウ、Editor ウィンドウ.
* Edit メニュー (Shell ウィンドウ、Editor ウィンドウ): Edit メニュー Shell ウィンドウ、Editor ウィンドウ.
* Format メニュー (Shell ウィンドウ、Editor ウィンドウ): Format メニュー Shell ウィンドウ、Editor ウィンドウ.
* Run メニュー (Editor ウィンドウのみ): Run メニュー Editor ウィンドウのみ.
* Shell メニュー (Shell ウィンドウのみ): Shell メニュー Shell ウィンドウのみ.
* Debug メニュー (Shell ウィンドウのみ): Debug メニュー Shell ウィンドウのみ.
* Options メニュー (Shell ウィンドウ、Editor ウィンドウ): Options メニュー Shell ウィンドウ、Editor ウィンドウ.
* Window メニュー (Shell ウィンドウ、Editor ウィンドウ): Window メニュー Shell ウィンドウ、Editor ウィンドウ.
* Help メニュー (Shell ウィンドウ、Editor ウィンドウ): Help メニュー Shell ウィンドウ、Editor ウィンドウ.
* Context menus::


File: python.info,  Node: File メニュー Shell ウィンドウ、Editor ウィンドウ,  Next: Edit メニュー Shell ウィンドウ、Editor ウィンドウ,  Up: メニュー

5.25.9.2 File メニュー (Shell ウィンドウ、Editor ウィンドウ)
............................................................

New File [新規ファイル]

     新しいファイル編集ウィンドウを作成します。

Open... [開く...]

     Open ダイアログを使って既存のファイルをオープンします。

Open Module... [モジュールを開く...]

     既存のモジュールをオープンします (sys.path を検索します)。

Recent Files [最近使ったファイル]

     最近使ったファイルのリストを開きます。ファイルを一つクリックすると
     それを開きます。

Module Browser

     現在 Editor が開いているファイル内にあるクラス、関数、メソッドを木
     構造で可視化します。 Shell からの場合は、先にモジュール選択のダイア
     ログが開きます。

Path Browser [パスブラウザ]

     sys.path ディレクトリ、モジュール、クラスおよびメソッドを木構造で可
     視化します。

Save [保存]

     現在のウィンドウを対応するファイルがあればそこに保存します。開いて
     から、または最後に保存したのちに編集があった場合のウィンドウには、
     ウィンドウタイトルの前後に * が付けられます。対応するファイルがなけ
     れば代わりに Save As が実行されます。

Save As... [名前を付けて保存...]

     Save the current window with a Save As dialog.  The file saved
     becomes the new associated file for the window.  (If your file
     manager is set to hide extensions, the current extension will be
     omitted in the file name box.  If the new filename has no '.',
     '.py' and '.txt' will be added for Python and text files, except
     that on macOS Aqua,'.py' is added for all files.)

Save Copy As... [コピーとして保存...]

     Save the current window to different file without changing the
     associated file.  (See Save As note above about filename
     extensions.)

Print Window [ウィンドウを印刷]

     現在のウィンドウをデフォルトプリンタで印刷します。

Close Window

     Close the current window (if an unsaved editor, ask to save; if an
     unsaved Shell, ask to quit execution).  Calling ‘exit()’ or
     ‘close()’ in the Shell window also closes Shell.  If this is the
     only window, also exit IDLE.

Exit IDLE

     Close all windows and quit IDLE (ask to save unsaved edit windows).


File: python.info,  Node: Edit メニュー Shell ウィンドウ、Editor ウィンドウ,  Next: Format メニュー Shell ウィンドウ、Editor ウィンドウ,  Prev: File メニュー Shell ウィンドウ、Editor ウィンドウ,  Up: メニュー

5.25.9.3 Edit メニュー (Shell ウィンドウ、Editor ウィンドウ)
............................................................

Undo [元に戻す]

     現在のウィンドウに対する最後の変更を Undo (取り消し) します。最大で
     1000 個の変更が Undo できます。

Redo [やり直し]

     現在のウィンドウに対する最後にundoされた変更をRedo(再スタート)しま
     す。

Select All [全て選択]

     カレントウィンドウの内容全体を選択します。

Cut [切り取り]

     システムのクリップボードへ選択された部分をコピーします。それから選
     択された部分を削除します。

Copy [コピー]

     選択された部分をシステムのクリップボードへコピーします。

Paste [貼り付け]

     システムのクリップボードの内容をカレントウィンドウへ挿入します。

クリップボードの機能はコンテキストメニューからも使えます。

Find... [検索...]

     たくさんのオプションをもつ検索ダイアログボックスを開きます。

Find Again [再検索]

     直前の検索があれば、それを繰り返します。

Find Selection [現在の選択を検索]

     現在選択された文字列があれば、それを検索します。

Find in Files... [ファイルから検索...]

     ファイル検索ダイアログを開きます。結果を新しい出力ウィンドウに出力
     します。

Replace... [置換...]

     検索と置換ダイアログを開きます。

Go to Line [指定行へジャンプ]

     Move the cursor to the beginning of the line requested and make
     that line visible.  A request past the end of the file goes to the
     end.  Clear any selection and update the line and column status.

Show Completions [補完候補の一覧]

     Open a scrollable list allowing selection of existing names.  See
     *note Completions: 43e7. in the Editing and Navigation section
     below.

Expand Word [語の展開]

     先頭だけタイプしたものを、同一ウィンドウ内の完全な語と合致するもの
     に展開します。異なる展開を得るためには繰り返します。

Show Call Tip

     After an unclosed parenthesis for a function, open a small window
     with function parameter hints.  See *note Calltips: 43e8. in the
     Editing and Navigation section below.

Show Surrounding Parens

     囲んでいる括弧をハイライトします。


File: python.info,  Node: Format メニュー Shell ウィンドウ、Editor ウィンドウ,  Next: Run メニュー Editor ウィンドウのみ,  Prev: Edit メニュー Shell ウィンドウ、Editor ウィンドウ,  Up: メニュー

5.25.9.4 Format メニュー (Shell ウィンドウ、Editor ウィンドウ)
..............................................................

Format Paragraph [パラグラフのフォーマット]

     Rewrap the text block containing the text insert cursor.  Avoid
     code lines.  See *note Format block: 43eb. in the Editing and
     Navigation section below.

Indent Region [領域をインデント]

     選択された行を右へインデント幅分シフトします (デフォルトは空白 4 個
     )。

Dedent Region [領域をインデント解除]

     選択された行を左へインデント幅分シフトします (デフォルトは空白 4 個
     )。

Comment Out Region [領域をコメントアウト]

     選択された行の先頭に ## を挿入します。

Uncomment Region [領域のコメントを解除]

     選択された行から先頭の # あるいは ## を取り除きます。

Tabify Region [領域のタブ化]

     '先頭' の一続きの空白をタブに置き換えます (注意: Python コードのイ
     ンデントには 4 つの空白を使うことをお勧めします)。

Untabify Region [領域の非タブ化]

     'すべての' タブを適切な数の空白に置き換えます。

Toggle Tabs [タブの切り替え]

     字下げのために空白を使うかタブを使うかを切り替えるダイアログを開き
     ます。

New Indent Width [新しいインデント幅]

     インデント幅を変更するダイアログを開きます。Python コミュニティによ
     って受け容れられているデフォルトは空白 4 個です。

Strip Trailing Whitespace

     Remove trailing space and other whitespace characters after the
     last non-whitespace character of a line by applying *note
     str.rstrip(): 16ca. to each line, including lines within multiline
     strings.  Except for Shell windows, remove extra newlines at the
     end of the file.


File: python.info,  Node: Run メニュー Editor ウィンドウのみ,  Next: Shell メニュー Shell ウィンドウのみ,  Prev: Format メニュー Shell ウィンドウ、Editor ウィンドウ,  Up: メニュー

5.25.9.5 Run メニュー (Editor ウィンドウのみ)
.............................................

Run Module [モジュールの実行]

     *note Check Module: 43ee. を実行します。エラーがなければ Shell の環
     境をクリーンにして再スタートした上で、モジュールを実行します。出力
     は Shell ウィンドウに表示されます。‘print’ や ‘write’ しない限り、
     この出力はされません。モジュール実行が完了すると Shell はフォーカス
     された状態のままで、プロンプトを表示します。これにより対話的に実行
     結果を調べることができます。この機能は、コマンドラインからファイル
     を ‘python -i file’ で実行することに相当します。

Run... Customized

     Same as *note Run Module: 43ed, but run the module with customized
     settings.  'Command Line Arguments' extend *note sys.argv: 147c. as
     if passed on a command line.  The module can be run in the Shell
     without restarting.

Check Module [モジュールのチェック]

     Editor ウィンドウでいま開いているモジュールを構文チェックします。モ
     ジュールが未保存の場合、 Options -> Configure IDLE -> General の
     "Autosave Preferences" の設定にもとづき、確認を求められるか自動的に
     保存します。構文エラーが見つかると Editor ウィンドウでそのおよその
     位置に移動します。

Python Shell [Python シェル]

     Python Shell ウィンドウを開くか、起こします。


File: python.info,  Node: Shell メニュー Shell ウィンドウのみ,  Next: Debug メニュー Shell ウィンドウのみ,  Prev: Run メニュー Editor ウィンドウのみ,  Up: メニュー

5.25.9.6 Shell メニュー (Shell ウィンドウのみ)
..............................................

View Last Restart [最後のリスタートを表示する]

     最後に Shell のリスタートを行った場所まで Shell ウインドウをスクロ
     ールします。

Restart Shell [Shell のリスタート]

     Restart the shell to clean the environment and reset display and
     exception handling.

Previous History

     Cycle through earlier commands in history which match the current
     entry.

Next History

     Cycle through later commands in history which match the current
     entry.

Interrupt Execution [実行の中断]

     プログラムの実行を停止します。


File: python.info,  Node: Debug メニュー Shell ウィンドウのみ,  Next: Options メニュー Shell ウィンドウ、Editor ウィンドウ,  Prev: Shell メニュー Shell ウィンドウのみ,  Up: メニュー

5.25.9.7 Debug メニュー (Shell ウィンドウのみ)
..............................................

Go to File/Line [ファイル/行へ移動]

     カーソルのある現在行の上にファイル名と行番号が見つかれば、(開かれて
     いなければ) そのファイルを開いてその行に飛びます。例外のトレースバ
     ックが参照しているソース行を見るのにこれを使いましょう。そのような
     ファイル名・行番号表示をしている行を見つけるのには Find を使えます
     。この機能は Shell ウィンドウと Output ウィンドウのコンテキストメニ
     ューからも使えます。

Debugger [デバッガ] (トグル切り替え)

     アクティブにすると、Shell または Editor に入力したコードをデバッガ
     のもとで実行します。Editor ではコンテキストメニューからブレイクポイ
     ントをセット出来ます。この機能はまだ不完全で、少々実験的です。

Stack Viewer [スタックビューア]

     最後の例外のスタックトレースと locals 辞書、 globals 辞書をツリーウ
     ィジットで表示します。

Auto-open Stack Viewer [スタックビューアの自動オープン]

     未捕捉の例外時にスタックビューアを自動的に開くかどうかを切り替えま
     す。


File: python.info,  Node: Options メニュー Shell ウィンドウ、Editor ウィンドウ,  Next: Window メニュー Shell ウィンドウ、Editor ウィンドウ,  Prev: Debug メニュー Shell ウィンドウのみ,  Up: メニュー

5.25.9.8 Options メニュー (Shell ウィンドウ、Editor ウィンドウ)
...............................................................

Configure IDLE [IDLE の設定]

     Open a configuration dialog and change preferences for the
     following: fonts, indentation, keybindings, text color themes,
     startup windows and size, additional help sources, and extensions.
     On macOS, open the configuration dialog by selecting Preferences in
     the application menu.  For more details, see *note Setting
     preferences: 43f4. under Help and preferences.

Most configuration options apply to all windows or all future windows.
The option items below only apply to the active window.

Show/Hide Code Context (Editor Window only)

     Editor ウィンドウの上部にペインが開き、そこにウィンドウの一番上のコ
     ードのブロックコンテキスト (訳注: コードが含まれているブロックのイ
     ンデント構造) が表示されます。 下の編集とナビゲーションの節にある
     *note コードコンテキスト: 43f5. の項を参照してください。

Show/Hide Line Numbers (Editor Window only)

     Open a column to the left of the edit window which shows the number
     of each line of text.  The default is off, which may be changed in
     the preferences (see *note Setting preferences: 43f4.).

Zoom/Restore Height

     Toggles the window between normal size and maximum height.  The
     initial size defaults to 40 lines by 80 chars unless changed on the
     General tab of the Configure IDLE dialog.  The maximum height for a
     screen is determined by momentarily maximizing a window the first
     time one is zoomed on the screen.  Changing screen settings may
     invalidate the saved height.  This toggle has no effect when a
     window is maximized.


File: python.info,  Node: Window メニュー Shell ウィンドウ、Editor ウィンドウ,  Next: Help メニュー Shell ウィンドウ、Editor ウィンドウ,  Prev: Options メニュー Shell ウィンドウ、Editor ウィンドウ,  Up: メニュー

5.25.9.9 Window メニュー (Shell ウィンドウ、Editor ウィンドウ)
..............................................................

Lists the names of all open windows; select one to bring it to the
foreground (deiconifying it if necessary).


File: python.info,  Node: Help メニュー Shell ウィンドウ、Editor ウィンドウ,  Next: Context menus,  Prev: Window メニュー Shell ウィンドウ、Editor ウィンドウ,  Up: メニュー

5.25.9.10 Help メニュー (Shell ウィンドウ、Editor ウィンドウ)
.............................................................

About IDLE [IDLE について]

     バージョン、コピーライト、ライセンス、クレジット、その他を表示しま
     す。

IDLE Help [IDLE ヘルプ]

     メニューオプション、基本的な編集やナビゲーションその他チップスを詳
     しく書いた IDLE のドキュメントを表示します。

Python Docs [Python ドキュメント]

     Python ドキュメントがローカルにインストールされていればそれを開きま
     す。もしくはウェブブラウザで最新の Python ドキュメント
     (‘https://docs.python.org’) を開きます。(訳注: いずれも何もしていな
     ければ英語。下記参照。)

Turtle Demo [Turtle デモ]

     Python コード例とタートルによる描画を使って turtledemo モジュールを
     実行します。

General タブの下の方にある Configure IDLE ダイアログで、追加のヘルプソー
スを Help メニューに加えられます。 下の編集とナビゲーションの節にある
*note ヘルプソース: 43f8. の項を参照してください。


File: python.info,  Node: Context menus,  Prev: Help メニュー Shell ウィンドウ、Editor ウィンドウ,  Up: メニュー

5.25.9.11 Context menus
.......................

ウィンドウ内で右クリック (macOS では Control-クリック) でコンテキストメ
ニューが開きます。コンテキストメニューには Edit メニューにもある標準的な
クリップボード機能が含まれています。

Cut [切り取り]

     システムのクリップボードへ選択された部分をコピーします。それから選
     択された部分を削除します。

Copy [コピー]

     選択された部分をシステムのクリップボードへコピーします。

Paste [貼り付け]

     システムのクリップボードの内容をカレントウィンドウへ挿入します。

Editor ウィンドウではさらにブレイクポイント機能が使えます。ブレイクポイ
ントがセットされた行には、特別に印がつきます。ブレイクポイントはデバッガ
のもとでの実行にだけ影響します。ファイルに付けたブレイクポイントはユーザ
の ‘.idlerc’ ディレクトリに保存されます。

Set Breakpoint [ブレークポイントのセット]

     現在行にブレークポイントをセットします。

Clear Breakpoint [ブレークポイントのクリア]

     その行のブレークポイントをクリアします。

Shell ウィンドウや Output ウィンドウには次のメニューもあります。

Go to file/line [ファイル/行へ移動]

     Debug メニューと同じものです。

The Shell window also has an output squeezing facility explained in the
'Python Shell window' subsection below.

Squeeze

     If the cursor is over an output line, squeeze all the output
     between the code above and the prompt below down to a 'Squeezed
     text' label.


File: python.info,  Node: Editing and Navigation,  Next: Startup and Code Execution,  Prev: メニュー,  Up: IDLE --- Python のエディタとシェル<2>

5.25.9.12 Editing and Navigation
................................

* Menu:

* Editor windows::
* Key bindings::
* 自動的な字下げ::
* 検索と置換::
* 補完 (Completions): 補完 Completions.
* 呼び出しヒント (Calltips): 呼び出しヒント Calltips.
* Format block::
* Code Context::
* Shell window::
* テキストの色::


File: python.info,  Node: Editor windows,  Next: Key bindings,  Up: Editing and Navigation

5.25.9.13 Editor windows
........................

IDLE may open editor windows when it starts, depending on settings and
how you start IDLE. Thereafter, use the File menu.  There can be only
one open editor window for a given file.

The title bar contains the name of the file, the full path, and the
version of Python and IDLE running the window.  The status bar contains
the line number ('Ln') and column number ('Col').  Line numbers start
with 1; column numbers with 0.

IDLE assumes that files with a known .py* extension contain Python code
and that other files do not.  Run Python code with the Run menu.


File: python.info,  Node: Key bindings,  Next: 自動的な字下げ,  Prev: Editor windows,  Up: Editing and Navigation

5.25.9.14 Key bindings
......................

The IDLE insertion cursor is a thin vertical bar between character
positions.  When characters are entered, the insertion cursor and
everything to its right moves right one character and the new character
is entered in the new space.

Several non-character keys move the cursor and possibly delete
characters.  Deletion does not puts text on the clipboard, but IDLE has
an undo list.  Wherever this doc discusses keys, 'C' refers to the
‘Control’ key on Windows and Unix and the ‘Command’ key on macOS. (And
all such discussions assume that the keys have not been re-bound to
something else.)

   * Arrow keys move the cursor one character or line.

   * ‘C’-‘LeftArrow’ and ‘C’-‘RightArrow’ moves left or right one word.

   * ‘Home’ and ‘End’ go to the beginning or end of the line.

   * ‘Page Up’ and ‘Page Down’ go up or down one screen.

   * ‘C’-‘Home’ and ‘C’-‘End’ go to beginning or end of the file.

   * ‘Backspace’ and ‘Del’ (or ‘C’-‘d’) delete the previous or next
     character.

   * ‘C’-‘Backspace’ and ‘C’-‘Del’ delete one word left or right.

   * ‘C’-‘k’ deletes ('kills') everything to the right.

標準的なキーバインディング (‘C’-‘c’ がコピーで ‘C’-‘v’ がペースト、など)
は機能するかもしれません。キーバインディングは Configure IDLE ダイアログ
で選択します。


File: python.info,  Node: 自動的な字下げ,  Next: 検索と置換,  Prev: Key bindings,  Up: Editing and Navigation

5.25.9.15 自動的な字下げ
........................

ブロックの始まりの文の後、次の行は 4 つの空白 (Python Shell ウィンドウで
は、一つのタブ) で字下げされます。あるキーワード (break、return など) の
後では、次の行は字下げが解除 (dedent) されます。先頭の字下げでは、
‘Backspace’ は 4 つの空白があれば削除します。 ‘Tab’ はインデント幅に対応
する数の空白 (Python Shell ウィンドウでは一つのタブ) を挿入します。現在
、タブは Tcl/Tk の制約のため 4 つの空白に固定されています。

*note Format メニュー: 43e9. の indent/dedent region コマンドも参照して
ください。


File: python.info,  Node: 検索と置換,  Next: 補完 Completions,  Prev: 自動的な字下げ,  Up: Editing and Navigation

5.25.9.16 検索と置換
....................

Any selection becomes a search target.  However, only selections within
a line work because searches are only performed within lines with the
terminal newline removed.  If ‘[x] Regular expression’ is checked, the
target is interpreted according to the Python re module.


File: python.info,  Node: 補完 Completions,  Next: 呼び出しヒント Calltips,  Prev: 検索と置換,  Up: Editing and Navigation

5.25.9.17 補完 (Completions)
............................

Completions are supplied, when requested and available, for module
names, attributes of classes or functions, or filenames.  Each request
method displays a completion box with existing names.  (See tab
completions below for an exception.)  For any box, change the name being
completed and the item highlighted in the box by typing and deleting
characters; by hitting ‘Up’, ‘Down’, ‘PageUp’, ‘PageDown’, ‘Home’, and
‘End’ keys; and by a single click within the box.  Close the box with
‘Escape’, ‘Enter’, and double ‘Tab’ keys or clicks outside the box.  A
double click within the box selects and closes.

One way to open a box is to type a key character and wait for a
predefined interval.  This defaults to 2 seconds; customize it in the
settings dialog.  (To prevent auto popups, set the delay to a large
number of milliseconds, such as 100000000.)  For imported module names
or class or function attributes, type '.'.  For filenames in the root
directory, type *note os.sep: 87a. or *note os.altsep: 87b. immediately
after an opening quote.  (On Windows, one can specify a drive first.)
Move into subdirectories by typing a directory name and a separator.

Instead of waiting, or after a box is closed, open a completion box
immediately with Show Completions on the Edit menu.  The default hot key
is ‘C’-‘space’.  If one types a prefix for the desired name before
opening the box, the first match or near miss is made visible.  The
result is the same as if one enters a prefix after the box is displayed.
Show Completions after a quote completes filenames in the current
directory instead of a root directory.

Hitting ‘Tab’ after a prefix usually has the same effect as Show
Completions.  (With no prefix, it indents.)  However, if there is only
one match to the prefix, that match is immediately added to the editor
text without opening a box.

Invoking 'Show Completions', or hitting ‘Tab’ after a prefix, outside of
a string and without a preceding '.'  opens a box with keywords, builtin
names, and available module-level names.

When editing code in an editor (as oppose to Shell), increase the
available module-level names by running your code and not restarting the
Shell thereafter.  This is especially useful after adding imports at the
top of a file.  This also increases possible attribute completions.

Completion boxes initially exclude names beginning with '_' or, for
modules, not included in '__all__'.  The hidden names can be accessed by
typing '_' after '.', either before or after the box is opened.


File: python.info,  Node: 呼び出しヒント Calltips,  Next: Format block,  Prev: 補完 Completions,  Up: Editing and Navigation

5.25.9.18 呼び出しヒント (Calltips)
...................................

A calltip is shown automatically when one types ‘(’ after the name of an
'accessible' function.  A function name expression may include dots and
subscripts.  A calltip remains until it is clicked, the cursor is moved
out of the argument area, or ‘)’ is typed.  Whenever the cursor is in
the argument part of a definition, select Edit and "Show Call Tip" on
the menu or enter its shortcut to display a calltip.

The calltip consists of the function's signature and docstring up to the
latter's first blank line or the fifth non-blank line.  (Some builtin
functions lack an accessible signature.)  A '/' or '*' in the signature
indicates that the preceding or following arguments are passed by
position or name (keyword) only.  Details are subject to change.

In Shell, the accessible functions depends on what modules have been
imported into the user process, including those imported by Idle itself,
and which definitions have been run, all since the last restart.

For example, restart the Shell and enter ‘itertools.count(’.  A calltip
appears because Idle imports itertools into the user process for its own
use.  (This could change.)  Enter ‘turtle.write(’ and nothing appears.
Idle does not itself import turtle.  The menu entry and shortcut also do
nothing.  Enter ‘import turtle’.  Thereafter, ‘turtle.write(’ will
display a calltip.

In an editor, import statements have no effect until one runs the file.
One might want to run a file after writing import statements, after
adding function definitions, or after opening an existing file.


File: python.info,  Node: Format block,  Next: Code Context,  Prev: 呼び出しヒント Calltips,  Up: Editing and Navigation

5.25.9.19 Format block
......................

Reformat Paragraph rewraps a block ('paragraph') of contiguous equally
indented non-blank comments, a similar block of text within a multiline
string, or a selected subset of either.  If needed, add a blank line to
separate string from code.  Partial lines in a selection expand to
complete lines.  The resulting lines have the same indent as before but
have maximum total length of N columns (characters).  Change the default
N of 72 on the Window tab of IDLE Settings.


File: python.info,  Node: Code Context,  Next: Shell window,  Prev: Format block,  Up: Editing and Navigation

5.25.9.20 Code Context
......................

Within an editor window containing Python code, code context can be
toggled in order to show or hide a pane at the top of the window.  When
shown, this pane freezes the opening lines for block code, such as those
beginning with ‘class’, ‘def’, or ‘if’ keywords, that would have
otherwise scrolled out of view.  The size of the pane will be expanded
and contracted as needed to show the all current levels of context, up
to the maximum number of lines defined in the Configure IDLE dialog
(which defaults to 15).  If there are no current context lines and the
feature is toggled on, a single blank line will display.  Clicking on a
line in the context pane will move that line to the top of the editor.

The text and background colors for the context pane can be configured
under the Highlights tab in the Configure IDLE dialog.


File: python.info,  Node: Shell window,  Next: テキストの色,  Prev: Code Context,  Up: Editing and Navigation

5.25.9.21 Shell window
......................

In IDLE's Shell, enter, edit, and recall complete statements.  (Most
consoles and terminals only work with a single physical line at a time).

Submit a single-line statement for execution by hitting ‘Return’ with
the cursor anywhere on the line.  If a line is extended with Backslash
(‘\’), the cursor must be on the last physical line.  Submit a
multi-line compound statement by entering a blank line after the
statement.

When one pastes code into Shell, it is not compiled and possibly
executed until one hits ‘Return’, as specified above.  One may edit
pasted code first.  If one pastes more than one statement into Shell,
the result will be a *note SyntaxError: 18e. when multiple statements
are compiled as if they were one.

Lines containing ‘RESTART’ mean that the user execution process has been
re-started.  This occurs when the user execution process has crashed,
when one requests a restart on the Shell menu, or when one runs code in
an editor window.

The editing features described in previous subsections work when
entering code interactively.  IDLE's Shell window also responds to the
following:

   * ‘C’-‘c’ attempts to interrupt statement execution (but may fail).

   * ‘C’-‘d’ closes Shell if typed at a ‘>>>’ prompt.

   * ‘Alt’-‘p’ and ‘Alt’-‘n’ (‘C’-‘p’ and ‘C’-‘n’ on macOS) retrieve to
     the current prompt the previous or next previously entered
     statement that matches anything already typed.

   * ‘Return’ while the cursor is on any previous statement appends the
     latter to anything already typed at the prompt.


File: python.info,  Node: テキストの色,  Prev: Shell window,  Up: Editing and Navigation

5.25.9.22 テキストの色
......................

IDLE の表示はデフォルトで白背景に黒字ですが、以下のような特別な意味を持
ったテキストには色が付きす。Shell では shell 出力、 shell エラー、ユーザ
エラー。Python コードでは Shell プロンプト内や Editor でのキーワード、組
み込みクラスや組み込み関数の名前、 ‘class’ や ‘def’ に続く名前、文字列、
そしてコメント。どんなテキストウィンドウでも、カーソル (あれば)、検索で
合致したテキスト (あれば)、そして選択されているテキストには色が付きます
。

IDLE also highlights the *note soft keywords: a0d. *note match: a0e,
*note case: a0e, and *note _: a0f. in pattern-matching statements.
However, this highlighting is not perfect and will be incorrect in some
rare cases, including some ‘_’-s in ‘case’ patterns.

このテキストの色付けはバックグラウンドで行われるため、たまに色が付いてな
い状態が見えてしまいます。カラースキームは、 Configure IDLE [IDLE の設定
] ダイアログの Highlighting タブで変更できます。ただし、エディタ内のデバ
ッガブレークポイント行のマーキングと、ポップアップとダイアログないのテキ
ストの色は、ユーザーにより変更することはできません。


File: python.info,  Node: Startup and Code Execution,  Next: Help and Preferences,  Prev: Editing and Navigation,  Up: IDLE --- Python のエディタとシェル<2>

5.25.9.23 Startup and Code Execution
....................................

‘-s’ オプションとともに起動すると、IDLE は環境変数 ‘IDLESTARTUP’ か
*note PYTHONSTARTUP: 1b8. で参照されているファイルを実行します。 IDLE は
まず ‘IDLESTARTUP’ をチェックし、あれば参照しているファイルを実行します
。 ‘IDLESTARTUP’ が無ければ、IDLE は ‘PYTHONSTARTUP’ をチェックします。
これらの環境変数で参照されているファイルは、IDLE シェルでよく使う関数を
置いたり、一般的なモジュールの import 文を実行するのに便利です。

加えて、‘Tk’ もスタートアップファイルがあればそれをロードします。その Tk
のファイルは無条件にロードされることに注意してください。このファイルは
‘.Idle.py’ で、ユーザーのホームディレクトリから探されます。このファイル
の中の文は Tk の名前空間で実行されるので、IDLE の Python シェルで使う関
数を import するのには便利ではありません。

* Menu:

* コマンドラインでの使用: コマンドラインでの使用<5>.
* Startup failure::
* Running user code::
* User output in Shell::
* Developing tkinter applications::
* サブプロセスを起こさずに起動する::


File: python.info,  Node: コマンドラインでの使用<5>,  Next: Startup failure,  Up: Startup and Code Execution

5.25.9.24 コマンドラインでの使用
................................

IDLE can be invoked from the command line with various options.  The
general syntax is:

     python -m idlelib [options] [file ...]

The following options are available:

 -- Option: -c <command>

     Run the specified Python command in the shell window.  For example,
     pass ‘-c "print('Hello, World!')"’.  On Windows, the outer quotes
     must be double quotes as shown.

 -- Option: -d

     Enable the debugger and open the shell window.

 -- Option: -e

     Open an editor window.

 -- Option: -h

     Print a help message with legal combinations of options and exit.

 -- Option: -i

     Open a shell window.

 -- Option: -r <file>

     Run the specified file in the shell window.

 -- Option: -s

     Run the startup file (as defined by the environment variables
     ‘IDLESTARTUP’ or *note PYTHONSTARTUP: 1b8.) before opening the
     shell window.

 -- Option: -t <title>

     Set the title of the shell window.

 -- Option: -

     Read and execute standard input in the shell window.  This option
     must be the last one before any arguments.

If arguments are provided:

   - If ‘-’, ‘-c’, or ‘-r’ is used, all arguments are placed in
     ‘sys.argv[1:]’, and ‘sys.argv[0]’ is set to ‘''’, ‘'-c'’, or ‘'-r'’
     respectively.  No editor window is opened, even if that is the
     default set in the 'Options' dialog.

   - Otherwise, arguments are treated as files to be opened for editing,
     and ‘sys.argv’ reflects the arguments passed to IDLE itself.


File: python.info,  Node: Startup failure,  Next: Running user code,  Prev: コマンドラインでの使用<5>,  Up: Startup and Code Execution

5.25.9.25 Startup failure
.........................

IDLE uses a socket to communicate between the IDLE GUI process and the
user code execution process.  A connection must be established whenever
the Shell starts or restarts.  (The latter is indicated by a divider
line that says 'RESTART'). If the user process fails to connect to the
GUI process, it usually displays a ‘Tk’ error box with a 'cannot
connect' message that directs the user here.  It then exits.

One specific connection failure on Unix systems results from
misconfigured masquerading rules somewhere in a system's network setup.
When IDLE is started from a terminal, one will see a message starting
with ‘** Invalid host:’.  The valid value is ‘127.0.0.1
(idlelib.rpc.LOCALHOST)’.  One can diagnose with ‘tcpconnect -irv
127.0.0.1 6543’ in one terminal window and ‘tcplisten <same args>’ in
another.

A common cause of failure is a user-written file with the same name as a
standard library module, such as 'random.py' and 'tkinter.py'.  When
such a file is located in the same directory as a file that is about to
be run, IDLE cannot import the stdlib file.  The current fix is to
rename the user file.

Though less common than in the past, an antivirus or firewall program
may stop the connection.  If the program cannot be taught to allow the
connection, then it must be turned off for IDLE to work.  It is safe to
allow this internal connection because no data is visible on external
ports.  A similar problem is a network mis-configuration that blocks
connections.

Python installation issues occasionally stop IDLE: multiple versions can
clash, or a single installation might need admin access.  If one undo
the clash, or cannot or does not want to run as admin, it might be
easiest to completely remove Python and start over.

A zombie pythonw.exe process could be a problem.  On Windows, use Task
Manager to check for one and stop it if there is.  Sometimes a restart
initiated by a program crash or Keyboard Interrupt (control-C) may fail
to connect.  Dismissing the error box or using Restart Shell on the
Shell menu may fix a temporary problem.

When IDLE first starts, it attempts to read user configuration files in
‘~/.idlerc/’ (~ is one's home directory).  If there is a problem, an
error message should be displayed.  Leaving aside random disk glitches,
this can be prevented by never editing the files by hand.  Instead, use
the configuration dialog, under Options.  Once there is an error in a
user configuration file, the best solution may be to delete it and start
over with the settings dialog.

If IDLE quits with no message, and it was not started from a console,
try starting it from a console or terminal (‘python -m idlelib’) and see
if this results in an error message.

On Unix-based systems with tcl/tk older than ‘8.6.11’ (see ‘About IDLE’)
certain characters of certain fonts can cause a tk failure with a
message to the terminal.  This can happen either if one starts IDLE to
edit a file with such a character or later when entering such a
character.  If one cannot upgrade tcl/tk, then re-configure IDLE to use
a font that works better.


File: python.info,  Node: Running user code,  Next: User output in Shell,  Prev: Startup failure,  Up: Startup and Code Execution

5.25.9.26 Running user code
...........................

With rare exceptions, the result of executing Python code with IDLE is
intended to be the same as executing the same code by the default
method, directly with Python in a text-mode system console or terminal
window.  However, the different interface and operation occasionally
affect visible results.  For instance, ‘sys.modules’ starts with more
entries, and ‘threading.active_count()’ returns 2 instead of 1.

By default, IDLE runs user code in a separate OS process rather than in
the user interface process that runs the shell and editor.  In the
execution process, it replaces ‘sys.stdin’, ‘sys.stdout’, and
‘sys.stderr’ with objects that get input from and send output to the
Shell window.  The original values stored in ‘sys.__stdin__’,
‘sys.__stdout__’, and ‘sys.__stderr__’ are not touched, but may be
‘None’.

Sending print output from one process to a text widget in another is
slower than printing to a system terminal in the same process.  This has
the most effect when printing multiple arguments, as the string for each
argument, each separator, the newline are sent separately.  For
development, this is usually not a problem, but if one wants to print
faster in IDLE, format and join together everything one wants displayed
together and then print a single string.  Both format strings and *note
str.join(): 2609. can help combine fields and lines.

IDLE's standard stream replacements are not inherited by subprocesses
created in the execution process, whether directly by user code or by
modules such as multiprocessing.  If such subprocess use ‘input’ from
sys.stdin or ‘print’ or ‘write’ to sys.stdout or sys.stderr, IDLE should
be started in a command line window.  (On Windows, use ‘python’ or ‘py’
rather than ‘pythonw’ or ‘pyw’.)  The secondary subprocess will then be
attached to that window for input and output.

If ‘sys’ is reset by user code, such as with ‘importlib.reload(sys)’,
IDLE's changes are lost and input from the keyboard and output to the
screen will not work correctly.

When Shell has the focus, it controls the keyboard and screen.  This is
normally transparent, but functions that directly access the keyboard
and screen will not work.  These include system-specific functions that
determine whether a key has been pressed and if so, which.

The IDLE code running in the execution process adds frames to the call
stack that would not be there otherwise.  IDLE wraps
‘sys.getrecursionlimit’ and ‘sys.setrecursionlimit’ to reduce the effect
of the additional stack frames.

When user code raises SystemExit either directly or by calling sys.exit,
IDLE returns to a Shell prompt instead of exiting.


File: python.info,  Node: User output in Shell,  Next: Developing tkinter applications,  Prev: Running user code,  Up: Startup and Code Execution

5.25.9.27 User output in Shell
..............................

When a program outputs text, the result is determined by the
corresponding output device.  When IDLE executes user code, ‘sys.stdout’
and ‘sys.stderr’ are connected to the display area of IDLE's Shell.
Some of its features are inherited from the underlying Tk Text widget.
Others are programmed additions.  Where it matters, Shell is designed
for development rather than production runs.

For instance, Shell never throws away output.  A program that sends
unlimited output to Shell will eventually fill memory, resulting in a
memory error.  In contrast, some system text windows only keep the last
n lines of output.  A Windows console, for instance, keeps a
user-settable 1 to 9999 lines, with 300 the default.

A Tk Text widget, and hence IDLE's Shell, displays characters
(codepoints) in the BMP (Basic Multilingual Plane) subset of Unicode.
Which characters are displayed with a proper glyph and which with a
replacement box depends on the operating system and installed fonts.
Tab characters cause the following text to begin after the next tab
stop.  (They occur every 8 'characters').  Newline characters cause
following text to appear on a new line.  Other control characters are
ignored or displayed as a space, box, or something else, depending on
the operating system and font.  (Moving the text cursor through such
output with arrow keys may exhibit some surprising spacing behavior.)

     >>> s = 'a\tb\a<\x02><\r>\bc\nd'  # Enter 22 chars.
     >>> len(s)
     14
     >>> s  # Display repr(s)
     'a\tb\x07<\x02><\r>\x08c\nd'
     >>> print(s, end='')  # Display s as is.
     # Result varies by OS and font.  Try it.

The ‘repr’ function is used for interactive echo of expression values.
It returns an altered version of the input string in which control
codes, some BMP codepoints, and all non-BMP codepoints are replaced with
escape codes.  As demonstrated above, it allows one to identify the
characters in a string, regardless of how they are displayed.

Normal and error output are generally kept separate (on separate lines)
from code input and each other.  They each get different highlight
colors.

For SyntaxError tracebacks, the normal '^' marking where the error was
detected is replaced by coloring the text with an error highlight.  When
code run from a file causes other exceptions, one may right click on a
traceback line to jump to the corresponding line in an IDLE editor.  The
file will be opened if necessary.

Shell has a special facility for squeezing output lines down to a
'Squeezed text' label.  This is done automatically for output over N
lines (N = 50 by default).  N can be changed in the PyShell section of
the General page of the Settings dialog.  Output with fewer lines can be
squeezed by right clicking on the output.  This can be useful lines long
enough to slow down scrolling.

Squeezed output is expanded in place by double-clicking the label.  It
can also be sent to the clipboard or a separate view window by
right-clicking the label.


File: python.info,  Node: Developing tkinter applications,  Next: サブプロセスを起こさずに起動する,  Prev: User output in Shell,  Up: Startup and Code Execution

5.25.9.28 Developing tkinter applications
.........................................

IDLE is intentionally different from standard Python in order to
facilitate development of tkinter programs.  Enter ‘import tkinter as
tk; root = tk.Tk()’ in standard Python and nothing appears.  Enter the
same in IDLE and a tk window appears.  In standard Python, one must also
enter ‘root.update()’ to see the window.  IDLE does the equivalent in
the background, about 20 times a second, which is about every 50
milliseconds.  Next enter ‘b = tk.Button(root, text='button');
b.pack()’.  Again, nothing visibly changes in standard Python until one
enters ‘root.update()’.

Most tkinter programs run ‘root.mainloop()’, which usually does not
return until the tk app is destroyed.  If the program is run with
‘python -i’ or from an IDLE editor, a ‘>>>’ shell prompt does not appear
until ‘mainloop()’ returns, at which time there is nothing left to
interact with.

When running a tkinter program from an IDLE editor, one can comment out
the mainloop call.  One then gets a shell prompt immediately and can
interact with the live application.  One just has to remember to
re-enable the mainloop call when running in standard Python.


File: python.info,  Node: サブプロセスを起こさずに起動する,  Prev: Developing tkinter applications,  Up: Startup and Code Execution

5.25.9.29 サブプロセスを起こさずに起動する
..........................................

デフォルトでは、IDLE でのユーザコードの実行は、内部的なループバックイン
ターフェイスを使用する、ソケット経由の分離されたサブプロセスで行われます
。この接続は外部からは見えませんし、インターネットとのデータの送受信は行
われません。ファイアウォールソフトウェアの警告が発生しても、無視して構い
ません。

ソケット接続の確立を試みて失敗した場合、IDLE によって通知されます。この
ような失敗は一過性の場合もありますが、永続的に失敗する場合は、ファイアウ
ォールが接続をブロックしているか、特定のシステムの設定が誤っていることが
原因かもしれません。問題が解決するまでは、 IDLE をコマンドラインオプショ
ン ‘-n’ で起動することもできます。

IDLE を ‘-n’ コマンドラインスイッチを使って開始した場合、IDLE は単一のプ
ロセス内で動作し、RPC Python 実行サーバを走らせるサブプロセスを作りませ
ん。これは、プラットフォーム上で Python がサブプロセスや RPC ソケットイ
ンターフェイスを作れない場合に有用かもしれません。ただし、このモードでは
ユーザコードが IDLE 自身から隔離されませんし、Run/Run Module (F5) 選択時
に環境が再起動されてまっさらな状態になることもありません。コードを変更し
た場合、影響するモジュールを reload() しないといけませんし、変更を反映す
るには、すべての特定の項目 (‘from foo import baz’ など) を再インポートし
ないといけません。これらの理由から、可能なら常にデフォルトのサブプロセス
を起こすモードで IDLE を起動するのが吉です。

バージョン 3.4 で非推奨.


File: python.info,  Node: Help and Preferences,  Next: idlelib --- implementation of IDLE application,  Prev: Startup and Code Execution,  Up: IDLE --- Python のエディタとシェル<2>

5.25.9.30 Help and Preferences
..............................

* Menu:

* Help sources::
* Setting preferences [お好み設定]::
* IDLE on macOS::
* Extensions [拡張]::


File: python.info,  Node: Help sources,  Next: Setting preferences [お好み設定],  Up: Help and Preferences

5.25.9.31 Help sources
......................

Help menu entry "IDLE Help" displays a formatted html version of the
IDLE chapter of the Library Reference.  The result, in a read-only
tkinter text window, is close to what one sees in a web browser.
Navigate through the text with a mousewheel, the scrollbar, or up and
down arrow keys held down.  Or click the TOC (Table of Contents) button
and select a section header in the opened box.

Help menu entry "Python Docs" opens the extensive sources of help,
including tutorials, available at ‘docs.python.org/x.y’, where 'x.y' is
the currently running Python version.  If your system has an off-line
copy of the docs (this may be an installation option), that will be
opened instead.

Selected URLs can be added or removed from the help menu at any time
using the General tab of the Configure IDLE dialog.


File: python.info,  Node: Setting preferences [お好み設定],  Next: IDLE on macOS,  Prev: Help sources,  Up: Help and Preferences

5.25.9.32 Setting preferences [お好み設定]
..........................................

The font preferences, highlighting, keys, and general preferences can be
changed via Configure IDLE on the Option menu.  Non-default user
settings are saved in a ‘.idlerc’ directory in the user's home
directory.  Problems caused by bad user configuration files are solved
by editing or deleting one or more of the files in ‘.idlerc’.

On the Font tab, see the text sample for the effect of font face and
size on multiple characters in multiple languages.  Edit the sample to
add other characters of personal interest.  Use the sample to select
monospaced fonts.  If particular characters have problems in Shell or an
editor, add them to the top of the sample and try changing first size
and then font.

On the Highlights and Keys tab, select a built-in or custom color theme
and key set.  To use a newer built-in color theme or key set with older
IDLEs, save it as a new custom theme or key set and it well be
accessible to older IDLEs.


File: python.info,  Node: IDLE on macOS,  Next: Extensions [拡張],  Prev: Setting preferences [お好み設定],  Up: Help and Preferences

5.25.9.33 IDLE on macOS
.......................

Under System Preferences: Dock, one can set "Prefer tabs when opening
documents" to "Always".  This setting is not compatible with the
tk/tkinter GUI framework used by IDLE, and it breaks a few IDLE
features.


File: python.info,  Node: Extensions [拡張],  Prev: IDLE on macOS,  Up: Help and Preferences

5.25.9.34 Extensions [拡張]
...........................

IDLE contains an extension facility.  Preferences for extensions can be
changed with the Extensions tab of the preferences dialog.  See the
beginning of config-extensions.def in the idlelib directory for further
information.  The only current default extension is zzdummy, an example
also used for testing.


File: python.info,  Node: idlelib --- implementation of IDLE application,  Prev: Help and Preferences,  Up: IDLE --- Python のエディタとシェル<2>

5.25.9.35 idlelib -- implementation of IDLE application
.......................................................

'Source code:' Lib/idlelib(1)

__________________________________________________________________

The Lib/idlelib package implements the IDLE application.  See the rest
of this page for how to use IDLE.

The files in idlelib are described in idlelib/README.txt.  Access it
either in idlelib or click Help => About IDLE on the IDLE menu.  This
file also maps IDLE menu items to the code that implements the item.
Except for files listed under 'Startup', the idlelib code is 'private'
in sense that feature changes can be backported (see PEP 434(2)).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/idlelib

   (2) https://peps.python.org/pep-0434/


File: python.info,  Node: turtle --- Turtle graphics,  Prev: IDLE --- Python のエディタとシェル<2>,  Up: Graphical user interfaces with Tk

5.25.10 ‘turtle’ -- Turtle graphics
-----------------------------------

'ソースコード:' Lib/turtle.py(1)

__________________________________________________________________

* Menu:

* はじめに: はじめに<12>.
* Get started::
* チュートリアル: チュートリアル<4>.
* How to...: How to.
* Turtle graphics reference::
* RawTurtle/Turtle のメソッドと対応する関数::
* TurtleScreen/Screen のメソッドと対応する関数::
* Public classes::
* 説明: 説明<2>.
* ヘルプと設定::
* turtledemo: turtledemo --- Demo scripts. Demo scripts
* python 2.6からの変更点: python 2 6からの変更点.
* python 3.0からの変更点: python 3 0からの変更点.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/turtle.py


File: python.info,  Node: はじめに<12>,  Next: Get started,  Up: turtle --- Turtle graphics

5.25.10.1 はじめに
..................

Turtle graphics is an implementation of the popular geometric drawing
tools introduced in Logo(1), developed by Wally Feurzeig, Seymour Papert
and Cynthia Solomon in 1967.

This is an *note optional module: 215a.  If it is missing from your copy
of CPython, look for documentation from your distributor (that is,
whoever provided Python to you).  If you are the distributor, see *note
オプションのモジュールの要件: 2158.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Turtle_(robot)


File: python.info,  Node: Get started,  Next: チュートリアル<4>,  Prev: はじめに<12>,  Up: turtle --- Turtle graphics

5.25.10.2 Get started
.....................

x-y 平面の (0, 0) から動き出すロボット亀を想像してみて下さい。
‘turtle.forward(15)’ という命令を出すと、その亀が (スクリーン上で!)  15
ピクセル分顔を向けている方向に動き、動きに沿って線を引きます。
‘turtle.left(25)’ という命令を出すと、今度はその場で25度反時計回りに回り
ます。

Turtle star
...........

Turtle can draw intricate shapes using programs that repeat simple
moves.

[image src="python-figures/turtle-star.png"]


In Python, turtle graphics provides a representation of a physical
"turtle" (a little robot with a pen) that draws on a sheet of paper on
the floor.

It's an effective and well-proven way for learners to encounter
programming concepts and interaction with software, as it provides
instant, visible feedback.  It also provides convenient access to
graphical output in general.

Turtle drawing was originally created as an educational tool, to be used
by teachers in the classroom.  For the programmer who needs to produce
some graphical output it can be a way to do that without the overhead of
introducing more complex or external libraries into their work.


File: python.info,  Node: チュートリアル<4>,  Next: How to,  Prev: Get started,  Up: turtle --- Turtle graphics

5.25.10.3 チュートリアル
........................

New users should start here.  In this tutorial we'll explore some of the
basics of turtle drawing.

* Menu:

* Starting a turtle environment::
* Basic drawing::
* Making algorithmic patterns::


File: python.info,  Node: Starting a turtle environment,  Next: Basic drawing,  Up: チュートリアル<4>

5.25.10.4 Starting a turtle environment
.......................................

In a Python shell, import all the objects of the ‘turtle’ module:

     from turtle import *

If you run into a ‘No module named '_tkinter'’ error, you'll have to
install the *note Tk interface package: f6. on your system.


File: python.info,  Node: Basic drawing,  Next: Making algorithmic patterns,  Prev: Starting a turtle environment,  Up: チュートリアル<4>

5.25.10.5 Basic drawing
.......................

Send the turtle forward 100 steps:

     forward(100)

You should see (most likely, in a new window on your display) a line
drawn by the turtle, heading East.  Change the direction of the turtle,
so that it turns 120 degrees left (anti-clockwise):

     left(120)

Let's continue by drawing a triangle:

     forward(100)
     left(120)
     forward(100)

Notice how the turtle, represented by an arrow, points in different
directions as you steer it.

Experiment with those commands, and also with ‘backward()’ and
‘right()’.

* Menu:

* Pen の制御::
* The turtle's position::


File: python.info,  Node: Pen の制御,  Next: The turtle's position,  Up: Basic drawing

5.25.10.6 Pen の制御
....................

Try changing the color - for example, ‘color('blue')’ - and width of the
line - for example, ‘width(3)’ - and then drawing again.

You can also move the turtle around without drawing, by lifting up the
pen: ‘up()’ before moving.  To start drawing again, use ‘down()’.


File: python.info,  Node: The turtle's position,  Prev: Pen の制御,  Up: Basic drawing

5.25.10.7 The turtle's position
...............................

Send your turtle back to its starting-point (useful if it has
disappeared off-screen):

     home()

The home position is at the center of the turtle's screen.  If you ever
need to know them, get the turtle's x-y coordinates with:

     pos()

Home is at ‘(0, 0)’.

And after a while, it will probably help to clear the window so we can
start anew:

     clearscreen()


File: python.info,  Node: Making algorithmic patterns,  Prev: Basic drawing,  Up: チュートリアル<4>

5.25.10.8 Making algorithmic patterns
.....................................

Using loops, it's possible to build up geometric patterns:

     for steps in range(100):
         for c in ('blue', 'red', 'green'):
             color(c)
             forward(steps)
             right(30)

- which of course, are limited only by the imagination!

Let's draw the star shape at the top of this page.  We want red lines,
filled in with yellow:

     color('red')
     fillcolor('yellow')

Just as ‘up()’ and ‘down()’ determine whether lines will be drawn,
filling can be turned on and off:

     begin_fill()

Next we'll create a loop:

     while True:
         forward(200)
         left(170)
         if abs(pos()) < 1:
             break

‘abs(pos()) < 1’ is a good way to know when the turtle is back at its
home position.

Finally, complete the filling:

     end_fill()

(Note that filling only actually takes place when you give the
‘end_fill()’ command.)


File: python.info,  Node: How to,  Next: Turtle graphics reference,  Prev: チュートリアル<4>,  Up: turtle --- Turtle graphics

5.25.10.9 How to...
...................

This section covers some typical turtle use-cases and approaches.

* Menu:

* Get started as quickly as possible::
* Automatically begin and end filling::
* Use the turtle module namespace::
* Use turtle graphics in a script::
* Use object-oriented turtle graphics::


File: python.info,  Node: Get started as quickly as possible,  Next: Automatically begin and end filling,  Up: How to

5.25.10.10 Get started as quickly as possible
.............................................

One of the joys of turtle graphics is the immediate, visual feedback
that's available from simple commands - it's an excellent way to
introduce children to programming ideas, with a minimum of overhead (not
just children, of course).

The turtle module makes this possible by exposing all its basic
functionality as functions, available with ‘from turtle import *’.  The
*note turtle graphics tutorial: 4422. covers this approach.

It's worth noting that many of the turtle commands also have even more
terse equivalents, such as ‘fd()’ for *note forward(): 360f.  These are
especially useful when working with learners for whom typing is not a
skill.

     You'll need to have the *note Tk interface package: f6. installed
     on your system for turtle graphics to work.  Be warned that this is
     not always straightforward, so check this in advance if you're
     planning to use turtle graphics with a learner.


File: python.info,  Node: Automatically begin and end filling,  Next: Use the turtle module namespace,  Prev: Get started as quickly as possible,  Up: How to

5.25.10.11 Automatically begin and end filling
..............................................

Starting with Python 3.14, you can use the *note fill(): 2a3. *note
context manager: 1e1. instead of *note begin_fill(): 442e. and *note
end_fill(): 442f. to automatically begin and end fill.  Here is an
example:

     with fill():
         for i in range(4):
             forward(100)
             right(90)

     forward(200)

The code above is equivalent to:

     begin_fill()
     for i in range(4):
         forward(100)
         right(90)
     end_fill()

     forward(200)


File: python.info,  Node: Use the turtle module namespace,  Next: Use turtle graphics in a script,  Prev: Automatically begin and end filling,  Up: How to

5.25.10.12 Use the ‘turtle’ module namespace
............................................

Using ‘from turtle import *’ is convenient - but be warned that it
imports a rather large collection of objects, and if you're doing
anything but turtle graphics you run the risk of a name conflict (this
becomes even more an issue if you're using turtle graphics in a script
where other modules might be imported).

The solution is to use ‘import turtle’ - ‘fd()’ becomes ‘turtle.fd()’,
‘width()’ becomes ‘turtle.width()’ and so on.  (If typing "turtle" over
and over again becomes tedious, use for example ‘import turtle as t’
instead.)


File: python.info,  Node: Use turtle graphics in a script,  Next: Use object-oriented turtle graphics,  Prev: Use the turtle module namespace,  Up: How to

5.25.10.13 Use turtle graphics in a script
..........................................

It's recommended to use the ‘turtle’ module namespace as described
immediately above, for example:

     import turtle as t
     from random import random

     for i in range(100):
         steps = int(random() * 100)
         angle = int(random() * 360)
         t.right(angle)
         t.fd(steps)

Another step is also required though - as soon as the script ends,
Python will also close the turtle's window.  Add:

     t.mainloop()

to the end of the script.  The script will now wait to be dismissed and
will not exit until it is terminated, for example by closing the turtle
graphics window.


File: python.info,  Node: Use object-oriented turtle graphics,  Prev: Use turtle graphics in a script,  Up: How to

5.25.10.14 Use object-oriented turtle graphics
..............................................

参考
....

*note Explanation of the object-oriented interface: 4433.

Other than for very basic introductory purposes, or for trying things
out as quickly as possible, it's more usual and much more powerful to
use the object-oriented approach to turtle graphics.  For example, this
allows multiple turtles on screen at once.

In this approach, the various turtle commands are methods of objects
(mostly of ‘Turtle’ objects).  You 'can' use the object-oriented
approach in the shell, but it would be more typical in a Python script.

The example above then becomes:

     from turtle import Turtle
     from random import random

     t = Turtle()
     for i in range(100):
         steps = int(random() * 100)
         angle = int(random() * 360)
         t.right(angle)
         t.fd(steps)

     t.screen.mainloop()

Note the last line.  ‘t.screen’ is an instance of the *note Screen:
4434. that a Turtle instance exists on; it's created automatically along
with the turtle.

The turtle's screen can be customised, for example:

     t.screen.title('Object-oriented turtle demo')
     t.screen.bgcolor("orange")


File: python.info,  Node: Turtle graphics reference,  Next: RawTurtle/Turtle のメソッドと対応する関数,  Prev: How to,  Up: turtle --- Turtle graphics

5.25.10.15 Turtle graphics reference
....................................

     注釈: 以下の文書では関数に対する引数リストが与えられています。メソ
     ッドでは、勿論、ここでは省略されている 'self' が第一引数になります
     。

* Menu:

* Turtle のメソッド::
* TurtleScreen/Screen のメソッド::


File: python.info,  Node: Turtle のメソッド,  Next: TurtleScreen/Screen のメソッド,  Up: Turtle graphics reference

5.25.10.16 Turtle のメソッド
............................

Turtle の動き

     移動および描画

               *note forward(): 360f. | *note fd(): 4437.
               *note backward(): 4438. | *note bk(): 4439. | *note back(): 443a.
               *note right(): 443b. | *note rt(): 443c.
               *note left(): 443d. | *note lt(): 443e.
               *note goto(): 443f. | *note setpos(): 4440. | *note setposition(): 4441.
               *note teleport(): 1a97.
               *note setx(): 4442.
               *note sety(): 4443.
               *note setheading(): 4444. | *note seth(): 4445.
               *note home(): 4446.
               *note circle(): 4447.
               *note dot(): 4448.
               *note stamp(): 4449.
               *note clearstamp(): 444a.
               *note clearstamps(): 444b.
               *note undo(): 444c.
               *note speed(): 444d.

     Turtle の状態を知る

               *note position(): 444e. | *note pos(): 444f.
               *note towards(): 4450.
               *note xcor(): 4451.
               *note ycor(): 4452.
               *note heading(): 4453.
               *note distance(): 4454.

     設定と計測

               *note degrees(): 4455.
               *note radians(): 4456.

Pen の制御

     描画状態

               *note pendown(): 4457. | *note pd(): 4458. | *note down(): 4459.
               *note penup(): 445a. | *note pu(): 445b. | *note up(): 445c.
               *note pensize(): 445d. | *note width(): 445e.
               *note pen(): 445f.
               *note isdown(): 4460.

     色の制御

               *note color(): 4461.
               *note pencolor(): 4462.
               *note fillcolor(): 4463.

     塗りつぶし

               *note filling(): 4464.
               *note fill(): 2a3.
               *note begin_fill(): 442e.
               *note end_fill(): 442f.

     さらなる描画の制御

               *note reset(): 4465.
               *note clear(): 4466.
               *note write(): 4467.

タートルの状態

     可視性

               *note showturtle(): 4468. | *note st(): 4469.
               *note hideturtle(): 446a. | *note ht(): 446b.
               *note isvisible(): 446c.

     見た目

               *note shape(): 446d.
               *note resizemode(): 446e.
               *note shapesize(): 446f. | *note turtlesize(): 4470.
               *note shearfactor(): 4471.
               *note tiltangle(): 92f.
               *note tilt(): 4472.
               *note shapetransform(): 4473.
               *note get_shapepoly(): 4474.

イベントを利用する

          *note onclick(): 4475.
          *note onrelease(): 4476.
          *note ondrag(): 4477.

特別な Turtle のメソッド

          *note poly(): 2a4.
          *note begin_poly(): 4478.
          *note end_poly(): 4479.
          *note get_poly(): 447a.
          *note clone(): 447b.
          *note getturtle(): 447c. | *note getpen(): 447d.
          *note getscreen(): 447e.
          *note setundobuffer(): 447f.
          *note undobufferentries(): 4480.


File: python.info,  Node: TurtleScreen/Screen のメソッド,  Prev: Turtle のメソッド,  Up: Turtle graphics reference

5.25.10.17 TurtleScreen/Screen のメソッド
.........................................

ウィンドウの制御

          *note bgcolor(): 4482.
          *note bgpic(): 4483.
          *note clearscreen(): 4484.
          *note resetscreen(): 4485.
          *note screensize(): 4486.
          *note setworldcoordinates(): 4487.

アニメーションの制御

          *note no_animation(): 2a5.
          *note delay(): 4488.
          *note tracer(): 4489.
          *note update(): 448a.

スクリーンイベントを利用する

          *note listen(): 448b.
          *note onkey(): 448c. | *note onkeyrelease(): 448d.
          *note onkeypress(): 448e.
          *note onclick(): 4475. | *note onscreenclick(): 448f.
          *note ontimer(): 4490.
          *note mainloop(): 4491. | *note done(): 4492.

設定と特殊なメソッド

          *note mode(): 4493.
          *note colormode(): 4494.
          *note getcanvas(): 4495.
          *note getshapes(): 4496.
          *note register_shape(): 4497. | *note addshape(): 4498.
          *note turtles(): 4499.
          *note window_height(): 449a.
          *note window_width(): 449b.

入力メソッド

          *note textinput(): 1c7a.
          *note numinput(): 1c7b.

Screen 独自のメソッド

          *note bye(): 449c.
          *note exitonclick(): 449d.
          *note save(): 1970.
          *note setup(): 449e.
          *note title(): 449f.


File: python.info,  Node: RawTurtle/Turtle のメソッドと対応する関数,  Next: TurtleScreen/Screen のメソッドと対応する関数,  Prev: Turtle graphics reference,  Up: turtle --- Turtle graphics

5.25.10.18 RawTurtle/Turtle のメソッドと対応する関数
....................................................

この節のほとんどの例では ‘turtle’ という名前の Turtle インスタンスを使い
ます。

* Menu:

* Turtle の動き::
* Turtle の状態を知る::
* 設定と計測::
* Pen の制御: Pen の制御<2>.
* タートルの状態::
* イベントを利用する::
* 特別な Turtle のメソッド::
* Compound shapes::


File: python.info,  Node: Turtle の動き,  Next: Turtle の状態を知る,  Up: RawTurtle/Turtle のメソッドと対応する関数

5.25.10.19 Turtle の動き
........................

 -- の関数: turtle.forward (distance)
 -- の関数: turtle.fd (distance)


     パラメータ: ‘distance’ - 数 (整数または浮動小数点数)

     タートルが頭を向けている方へ、タートルを距離 'distance' だけ前進さ
     せます。

          >>> turtle.position()
          (0.00,0.00)
          >>> turtle.forward(25)
          >>> turtle.position()
          (25.00,0.00)
          >>> turtle.forward(-75)
          >>> turtle.position()
          (-50.00,0.00)

 -- の関数: turtle.back (distance)
 -- の関数: turtle.bk (distance)
 -- の関数: turtle.backward (distance)


     パラメータ: ‘distance’ - 数

     タートルが頭を向けている方と反対方向へ、タートルを距離 'distance' だ
     け後退させます。 タートルの向きは変えません。

          >>> turtle.position()
          (0.00,0.00)
          >>> turtle.backward(30)
          >>> turtle.position()
          (-30.00,0.00)

 -- の関数: turtle.right (angle)
 -- の関数: turtle.rt (angle)


     パラメータ: ‘angle’ - 数 (整数または浮動小数点数)

     タートルを 'angle' 単位だけ右に回します。 (単位のデフォルトは度です
     が、 *note degrees(): 4455. と *note radians(): 4456. 関数を使って
     設定できます。) 角度の向きはタートルのモードによって意味が変わりま
     す。 *note mode(): 4493. を参照してください。

          >>> turtle.heading()
          22.0
          >>> turtle.right(45)
          >>> turtle.heading()
          337.0

 -- の関数: turtle.left (angle)
 -- の関数: turtle.lt (angle)


     パラメータ: ‘angle’ - 数 (整数または浮動小数点数)

     タートルを 'angle' 単位だけ左に回します。 (単位のデフォルトは度です
     が、 *note degrees(): 4455. と *note radians(): 4456. 関数を使って
     設定できます。) 角度の向きはタートルのモードによって意味が変わりま
     す。 *note mode(): 4493. を参照してください。

          >>> turtle.heading()
          22.0
          >>> turtle.left(45)
          >>> turtle.heading()
          67.0

 -- の関数: turtle.goto (x, y=None)
 -- の関数: turtle.setpos (x, y=None)
 -- の関数: turtle.setposition (x, y=None)


     パラメータ:

        * ‘x’ - 数または数のペア/ベクトル

        * ‘y’ - 数または ‘None’

     'y' が ‘None’ の場合、 'x' は座標のペアかまたは *note Vec2D: 44a2.
     (たとえば *note pos(): 444f. で返されます) でなければなりません。

     タートルを指定された絶対位置に移動します。ペンが下りていれば線を引
     きます。タートルの向きは変わりません。

          >>> tp = turtle.pos()
          >>> tp
          (0.00,0.00)
          >>> turtle.setpos(60,30)
          >>> turtle.pos()
          (60.00,30.00)
          >>> turtle.setpos((20,80))
          >>> turtle.pos()
          (20.00,80.00)
          >>> turtle.setpos(tp)
          >>> turtle.pos()
          (0.00,0.00)

 -- の関数: turtle.teleport (x, y=None, *, fill_gap=False)


     パラメータ:

        * ‘x’ - 数または ‘None’

        * ‘y’ - 数または ‘None’

        * ‘fill_gap’ - ブール値

     Move turtle to an absolute position.  Unlike goto(x, y), a line
     will not be drawn.  The turtle's orientation does not change.  If
     currently filling, the polygon(s) teleported from will be filled
     after leaving, and filling will begin again after teleporting.
     This can be disabled with fill_gap=True, which makes the imaginary
     line traveled during teleporting act as a fill barrier like in
     goto(x, y).

          >>> tp = turtle.pos()
          >>> tp
          (0.00,0.00)
          >>> turtle.teleport(60)
          >>> turtle.pos()
          (60.00,0.00)
          >>> turtle.teleport(y=10)
          >>> turtle.pos()
          (60.00,10.00)
          >>> turtle.teleport(20, 30)
          >>> turtle.pos()
          (20.00,30.00)

     Added in version 3.12.

 -- の関数: turtle.setx (x)


     パラメータ: ‘x’ - 数 (整数または浮動小数点数)

     タートルの第一座標を 'x' にします。第二座標は変わりません。

          >>> turtle.position()
          (0.00,240.00)
          >>> turtle.setx(10)
          >>> turtle.position()
          (10.00,240.00)

 -- の関数: turtle.sety (y)


     パラメータ: ‘y’ - 数 (整数または浮動小数点数)

     タートルの第二座標を 'y' にします。第一座標は変わりません。

          >>> turtle.position()
          (0.00,40.00)
          >>> turtle.sety(-10)
          >>> turtle.position()
          (0.00,-10.00)

 -- の関数: turtle.setheading (to_angle)
 -- の関数: turtle.seth (to_angle)


     パラメータ: ‘to_angle’ - 数 (整数または浮動小数点数)

     タートルの向きを 'to_angle' に設定します。以下はよく使われる方向を
     度で表わしたものです:

     標準モード              logo モード
                             
     -------------------------------------------------
                             
     0 - 東                  0 - 北
                             
                             
     90 - 北                 90 - 東
                             
                             
     180 - 西                180 - 南
                             
                             
     270 - 南                270 - 西
                             

          >>> turtle.setheading(90)
          >>> turtle.heading()
          90.0

 -- の関数: turtle.home ()

     タートルを原点 - 座標 (0, 0) - に移動し、向きを開始方向に設定します
     (開始方向はモードに依って違います。 *note mode(): 4493. を参照して
     ください)。

          >>> turtle.heading()
          90.0
          >>> turtle.position()
          (0.00,-10.00)
          >>> turtle.home()
          >>> turtle.position()
          (0.00,0.00)
          >>> turtle.heading()
          0.0

 -- の関数: turtle.circle (radius, extent=None, steps=None)


     パラメータ:

        * ‘radius’ - 数

        * ‘extent’ - 数 (または ‘None’)

        * ‘steps’ - 整数 (または ‘None’)

     半径 'radius' の円を描きます。中心はタートルの左 'radius' ユニット
     の点です。 'extent' - 角度です - は円のどの部分を描くかを決定します
     。 'extent' が与えられなければ、デフォルトで完全な円になります。
     'extent' が完全な円でない場合は、弧の一つの端点は、現在のペンの位置
     です。 'radius' が正の場合、弧は反時計回りに描かれます。そうでなけ
     れば、時計回りです。最後にタートルの向きが 'extent' 分だけ変わりま
     す。

     円は内接する正多角形で近似されます。 'steps' でそのために使うステッ
     プ数を決定します。この値は与えられなければ自動的に計算されます。ま
     た、これを正多角形の描画に利用することもできます。

          >>> turtle.home()
          >>> turtle.position()
          (0.00,0.00)
          >>> turtle.heading()
          0.0
          >>> turtle.circle(50)
          >>> turtle.position()
          (-0.00,0.00)
          >>> turtle.heading()
          0.0
          >>> turtle.circle(120, 180)  # draw a semicircle
          >>> turtle.position()
          (0.00,240.00)
          >>> turtle.heading()
          180.0

 -- の関数: turtle.dot ()

 -- の関数: turtle.dot (size)

 -- の関数: turtle.dot (color, /)

 -- の関数: turtle.dot (size, color, /)

 -- の関数: turtle.dot (size, r, g, b, /)


     パラメータ:

        * ‘size’ - 1 以上の整数 (与えられる場合には)

        * ‘color’ - 色を表わす文字列またはタプル

     Draw a circular dot with diameter 'size', using 'color'.  If 'size'
     is not given, the maximum of ‘pensize+4’ and ‘2*pensize’ is used.

          >>> turtle.home()
          >>> turtle.dot()
          >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50)
          >>> turtle.position()
          (100.00,-0.00)
          >>> turtle.heading()
          0.0

 -- の関数: turtle.stamp ()

     キャンバス上の現在タートルがいる位置にタートルの姿のハンコを押しま
     す。そのハンコに対して stamp_id が返されますが、これを使うと後で
     ‘clearstamp(stamp_id)’ のように呼び出して消すことができます。

          >>> turtle.color("blue")
          >>> stamp_id = turtle.stamp()
          >>> turtle.fd(50)

 -- の関数: turtle.clearstamp (stampid)


     パラメータ: ‘stampid’ - 整数で、先立つ *note stamp(): 4449. 呼出し
     で返された値でなければなりません

     'stampid' に対応するハンコを消します。

          >>> turtle.position()
          (150.00,-0.00)
          >>> turtle.color("blue")
          >>> astamp = turtle.stamp()
          >>> turtle.fd(50)
          >>> turtle.position()
          (200.00,-0.00)
          >>> turtle.clearstamp(astamp)
          >>> turtle.position()
          (200.00,-0.00)

 -- の関数: turtle.clearstamps (n=None)


     パラメータ: ‘n’ - 整数 (または ‘None’)

     全ての、または最初の/最後の 'n' 個のハンコを消します。 'n' が
     ‘None’ の場合、全てのハンコを消します。 'n' が正の場合には最初の
     'n' 個、 'n' が負の場合には最後の 'n' 個を消します。

          >>> for i in range(8):
          ...     unused_stamp_id = turtle.stamp()
          ...     turtle.fd(30)
          >>> turtle.clearstamps(2)
          >>> turtle.clearstamps(-2)
          >>> turtle.clearstamps()

 -- の関数: turtle.undo ()

     最後の(繰り返すことにより複数の)タートルの動きを取り消します。取り
     消しできる動きの最大数は undobuffer のサイズによって決まります。

          >>> for i in range(4):
          ...     turtle.fd(50); turtle.lt(80)
          ...
          >>> for i in range(8):
          ...     turtle.undo()

 -- の関数: turtle.speed (speed=None)


     パラメータ: ‘speed’ - 0 から 10 までの整数またはスピードを表わす文
     字列(以下の説明を参照)

     タートルのスピードを 0 から 10 までの範囲の整数に設定します。引数が
     与えられない場合は現在のスピードを返します。

     与えられた数字が 10 より大きかったり 0.5 より小さかったりした場合は
     、スピードは 0 になります。スピードを表わす文字列は次のように数字に
     変換されます:

        * "fastest": 0

        * "fast": 10

        * "normal": 6

        * "slow": 3

        * "slowest": 1

     1 から 10 までのスピードを上げていくにつれて線を描いたりタートルが
     回ったりするアニメーションがだんだん速くなります。

     注意: 'speed' = 0 はアニメーションを無くします。forward/backward で
     はタートルがジャンプし、left/right では瞬時に方向を変えます。

          >>> turtle.speed()
          3
          >>> turtle.speed('normal')
          >>> turtle.speed()
          6
          >>> turtle.speed(9)
          >>> turtle.speed()
          9


File: python.info,  Node: Turtle の状態を知る,  Next: 設定と計測,  Prev: Turtle の動き,  Up: RawTurtle/Turtle のメソッドと対応する関数

5.25.10.20 Turtle の状態を知る
..............................

 -- の関数: turtle.position ()
 -- の関数: turtle.pos ()

     タートルの現在位置を (*note Vec2D: 44a2. のベクトルとして) 返します
     。

          >>> turtle.pos()
          (440.00,-0.00)

 -- の関数: turtle.towards (x, y=None)


     パラメータ:

        * ‘x’ - 数または数のペア/ベクトルまたはタートルのインスタンス

        * ‘y’ - 'x' が数ならば数、そうでなければ ‘None’

     タートルの位置から指定された (x,y) への直線の角度を返します。この値
     はタートルの開始方向にそして開始方向はモード ("standard"/"world" ま
     たは "logo") に依存します。

          >>> turtle.goto(10, 10)
          >>> turtle.towards(0,0)
          225.0

 -- の関数: turtle.xcor ()

     タートルの x 座標を返します。

          >>> turtle.home()
          >>> turtle.left(50)
          >>> turtle.forward(100)
          >>> turtle.pos()
          (64.28,76.60)
          >>> print(round(turtle.xcor(), 5))
          64.27876

 -- の関数: turtle.ycor ()

     タートルの y 座標を返します。

          >>> turtle.home()
          >>> turtle.left(60)
          >>> turtle.forward(100)
          >>> print(turtle.pos())
          (50.00,86.60)
          >>> print(round(turtle.ycor(), 5))
          86.60254

 -- の関数: turtle.heading ()

     タートルの現在の向きを返します (返される値はタートルのモードに依存
     します。 *note mode(): 4493. を参照してください)。

          >>> turtle.home()
          >>> turtle.left(67)
          >>> turtle.heading()
          67.0

 -- の関数: turtle.distance (x, y=None)


     パラメータ:

        * ‘x’ - 数または数のペア/ベクトルまたはタートルのインスタンス

        * ‘y’ - 'x' が数ならば数、そうでなければ ‘None’

     タートルから与えられた (x,y) あるいはベクトルあるいは渡されたタート
     ルへの距離を、タートルのステップを単位として測った値を返します。

          >>> turtle.home()
          >>> turtle.distance(30,40)
          50.0
          >>> turtle.distance((30,40))
          50.0
          >>> joe = Turtle()
          >>> joe.forward(77)
          >>> turtle.distance(joe)
          77.0


File: python.info,  Node: 設定と計測,  Next: Pen の制御<2>,  Prev: Turtle の状態を知る,  Up: RawTurtle/Turtle のメソッドと対応する関数

5.25.10.21 設定と計測
.....................

 -- の関数: turtle.degrees (fullcircle=360.0)


     パラメータ: ‘fullcircle’ - 数

     角度を計る単位「度」を、円周を何等分するかという値に指定します。デ
     フォルトは360等分で通常の意味での度です。

          >>> turtle.home()
          >>> turtle.left(90)
          >>> turtle.heading()
          90.0

          >>> # Change angle measurement unit to grad (also known as gon,
          >>> # grade, or gradian and equals 1/100-th of the right angle.)
          >>> turtle.degrees(400.0)
          >>> turtle.heading()
          100.0
          >>> turtle.degrees(360)
          >>> turtle.heading()
          90.0

 -- の関数: turtle.radians ()

     角度を計る単位をラジアンにします。 ‘degrees(2*math.pi)’ と同じ意味
     です。

          >>> turtle.home()
          >>> turtle.left(90)
          >>> turtle.heading()
          90.0
          >>> turtle.radians()
          >>> turtle.heading()
          1.5707963267948966


File: python.info,  Node: Pen の制御<2>,  Next: タートルの状態,  Prev: 設定と計測,  Up: RawTurtle/Turtle のメソッドと対応する関数

5.25.10.22 Pen の制御
.....................

* Menu:

* 描画状態::
* 色の制御: 色の制御<2>.
* 塗りつぶし::
* さらなる描画の制御::


File: python.info,  Node: 描画状態,  Next: 色の制御<2>,  Up: Pen の制御<2>

5.25.10.23 描画状態
...................

 -- の関数: turtle.pendown ()
 -- の関数: turtle.pd ()
 -- の関数: turtle.down ()

     ペンを下ろします - 動くと線が引かれます。

 -- の関数: turtle.penup ()
 -- の関数: turtle.pu ()
 -- の関数: turtle.up ()

     ペンを上げます - 動いても線は引かれません。

 -- の関数: turtle.pensize (width=None)
 -- の関数: turtle.width (width=None)


     パラメータ: ‘width’ - 正の数

     線の太さを 'width' にするか、または現在の太さを返します。resizemode
     が "auto" でタートルの形が多角形の場合、その多角形も同じ太さで描画
     されます。引数が渡されなければ、現在の pensize が返されます。

          >>> turtle.pensize()
          1
          >>> turtle.pensize(10)   # from here on lines of width 10 are drawn

 -- の関数: turtle.pen (pen=None, **pendict)


     パラメータ:

        * ‘pen’ - 以下にリストされたキーをもった辞書

        * ‘pendict’ - 以下にリストされたキーをキーワードとするキーワード
          引数

     ペンの属性を "pen-dictionary" に以下のキー/値ペアで設定するかまたは
     返します:

        * "shown": True/False

        * "pendown": True/False

        * "pencolor": 色文字列または色タプル

        * "fillcolor": 色文字列または色タプル

        * "pensize": 正の数

        * "speed": 0 から 10 までの整数

        * "resizemode": "auto" または "user" または "noresize"

        * "stretchfactor": (正の数, 正の数)

        * "outline": 正の数

        * "tilt": 数

     この辞書を以降の *note pen(): 445f. 呼出しに渡して以前のペンの状態
     に復旧することができます。さらに一つ以上の属性をキーワード引数とし
     て渡すこともできます。一つの文で幾つものペンの属性を設定するのに使
     えます。

          >>> turtle.pen(fillcolor="black", pencolor="red", pensize=10)
          >>> sorted(turtle.pen().items())
          [('fillcolor', 'black'), ('outline', 1), ('pencolor', 'red'),
           ('pendown', True), ('pensize', 10), ('resizemode', 'noresize'),
           ('shearfactor', 0.0), ('shown', True), ('speed', 9),
           ('stretchfactor', (1.0, 1.0)), ('tilt', 0.0)]
          >>> penstate=turtle.pen()
          >>> turtle.color("yellow", "")
          >>> turtle.penup()
          >>> sorted(turtle.pen().items())[:3]
          [('fillcolor', ''), ('outline', 1), ('pencolor', 'yellow')]
          >>> turtle.pen(penstate, fillcolor="green")
          >>> sorted(turtle.pen().items())[:3]
          [('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red')]

 -- の関数: turtle.isdown ()

     もしペンが下りていれば ‘True’ を、上がっていれば ‘False’ を返します
     。

          >>> turtle.penup()
          >>> turtle.isdown()
          False
          >>> turtle.pendown()
          >>> turtle.isdown()
          True


File: python.info,  Node: 色の制御<2>,  Next: 塗りつぶし,  Prev: 描画状態,  Up: Pen の制御<2>

5.25.10.24 色の制御
...................

 -- の関数: turtle.pencolor ()

 -- の関数: turtle.pencolor (color, /)

 -- の関数: turtle.pencolor (r, g, b, /)

     ペンの色(pencolor)を設定するかまたは返します。

     4種類の入力形式が受け入れ可能です:

     ‘pencolor()’

          Return the current pencolor as color specification string or
          as a tuple (see example).  May be used as input to another
          color/pencolor/fillcolor/bgcolor call.

     ‘pencolor(colorstring)’

          ペンの色を 'colorstring' に設定します。その値は Tk の色指定文
          字列で、 ‘"red"’, ‘"yellow"’, ‘"#33cc8c"’ のような文字列です。

     ‘pencolor((r, g, b))’

          ペンの色を 'r', 'g', 'b' のタプルで表された RGB の色に設定しま
          す。各 'r', 'g', 'b' は 0 から colormode の間の値でなければな
          りません。ここで colormode は 1.0 か 255 のどちらかです (*note
          colormode(): 4494. を参照)。

     ‘pencolor(r, g, b)’

          ペンの色を 'r', 'g', 'b' で表された RGB の色に設定します。各
          'r', 'g', 'b' は 0 から colormode の間の値でなければなりません
          。

     タートルの形(turtleshape)が多角形の場合、多角形の外側が新しく設定さ
     れた色で描かれます。

          >>> colormode()
          1.0
          >>> turtle.pencolor()
          'red'
          >>> turtle.pencolor("brown")
          >>> turtle.pencolor()
          'brown'
          >>> tup = (0.2, 0.8, 0.55)
          >>> turtle.pencolor(tup)
          >>> turtle.pencolor()
          (0.2, 0.8, 0.5490196078431373)
          >>> colormode(255)
          >>> turtle.pencolor()
          (51.0, 204.0, 140.0)
          >>> turtle.pencolor('#32c18f')
          >>> turtle.pencolor()
          (50.0, 193.0, 143.0)

 -- の関数: turtle.fillcolor ()

 -- の関数: turtle.fillcolor (color, /)

 -- の関数: turtle.fillcolor (r, g, b, /)

     塗りつぶしの色(fillcolor)を設定するかまたは返します。

     4種類の入力形式が受け入れ可能です:

     ‘fillcolor()’

          Return the current fillcolor as color specification string,
          possibly in tuple format (see example).  May be used as input
          to another color/pencolor/fillcolor/bgcolor call.

     ‘fillcolor(colorstring)’

          塗りつぶしの色を 'colorstring' に設定します。その値は Tk の色
          指定文字列で、 ‘"red"’, ‘"yellow"’, ‘"#33cc8c"’ のような文字列
          です。

     ‘fillcolor((r, g, b))’

          塗りつぶしの色を 'r', 'g', 'b' のタプルで表された RGB の色に設
          定します。各 'r', 'g', 'b' は 0 から colormode の間の値でなけ
          ればなりません。ここで colormode は 1.0 か 255 のどちらかです
          (*note colormode(): 4494. を参照)。

     ‘fillcolor(r, g, b)’

          塗りつぶしの色を 'r', 'g', 'b' で表された RGB の色に設定します
          。各 'r', 'g', 'b' は 0 から colormode の間の値でなければなり
          ません。

     タートルの形(turtleshape)が多角形の場合、多角形の内側が新しく設定さ
     れた色で描かれます。

          >>> turtle.fillcolor("violet")
          >>> turtle.fillcolor()
          'violet'
          >>> turtle.pencolor()
          (50.0, 193.0, 143.0)
          >>> turtle.fillcolor((50, 193, 143))  # Integers, not floats
          >>> turtle.fillcolor()
          (50.0, 193.0, 143.0)
          >>> turtle.fillcolor('#ffffff')
          >>> turtle.fillcolor()
          (255.0, 255.0, 255.0)

 -- の関数: turtle.color ()

 -- の関数: turtle.color (color, /)

 -- の関数: turtle.color (r, g, b, /)

 -- の関数: turtle.color (pencolor, fillcolor, /)

     ペンの色(pencolor)と塗りつぶしの色(fillcolor)を設定するかまたは返し
     ます。

     いくつかの入力形式が受け入れ可能です。形式ごとに 0 から 3 個の引数
     を以下のように使います:

     ‘color()’

          現在のペンの色と塗りつぶしの色を *note pencolor(): 4462. およ
          び *note fillcolor(): 4463. で返される色指定文字列またはタプル
          のペアで返します。

     ‘color(colorstring)’, ‘color((r,g,b))’, ‘color(r,g,b)’

          *note pencolor(): 4462. の入力と同じですが、塗りつぶしの色とペ
          ンの色、両方を与えられた値に設定します。

     ‘color(colorstring1, colorstring2)’, ‘color((r1,g1,b1), (r2,g2,b2))’

          ‘pencolor(colorstring1)’ および ‘fillcolor(colorstring2)’ を呼
          び出すのと等価です。もう一つの入力形式についても同様です。

     タートルの形(turtleshape)が多角形の場合、多角形の内側も外側も新しく
     設定された色で描かれます。

          >>> turtle.color("red", "green")
          >>> turtle.color()
          ('red', 'green')
          >>> color("#285078", "#a0c8f0")
          >>> color()
          ((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))

こちらも参照: スクリーンのメソッド *note colormode(): 4494. 。


File: python.info,  Node: 塗りつぶし,  Next: さらなる描画の制御,  Prev: 色の制御<2>,  Up: Pen の制御<2>

5.25.10.25 塗りつぶし
.....................

 -- の関数: turtle.filling ()

     Return fillstate (‘True’ if filling, ‘False’ else).

          >>> turtle.begin_fill()
          >>> if turtle.filling():
          ...    turtle.pensize(5)
          ... else:
          ...    turtle.pensize(3)

 -- の関数: turtle.fill ()

     Fill the shape drawn in the ‘with turtle.fill():’ block.

          >>> turtle.color("black", "red")
          >>> with turtle.fill():
          ...     turtle.circle(80)

     Using ‘fill()’ is equivalent to adding the *note begin_fill():
     442e. before the fill-block and *note end_fill(): 442f. after the
     fill-block:

          >>> turtle.color("black", "red")
          >>> turtle.begin_fill()
          >>> turtle.circle(80)
          >>> turtle.end_fill()

     Added in version 3.14.

 -- の関数: turtle.begin_fill ()

     To be called just before drawing a shape to be filled.

 -- の関数: turtle.end_fill ()

     最後に呼び出された *note begin_fill(): 442e. の後に描かれた図形を塗
     りつぶします。

     Whether or not overlap regions for self-intersecting polygons or
     multiple shapes are filled depends on the operating system
     graphics, type of overlap, and number of overlaps.  For example,
     the Turtle star above may be either all yellow or have some white
     regions.

          >>> turtle.color("black", "red")
          >>> turtle.begin_fill()
          >>> turtle.circle(80)
          >>> turtle.end_fill()


File: python.info,  Node: さらなる描画の制御,  Prev: 塗りつぶし,  Up: Pen の制御<2>

5.25.10.26 さらなる描画の制御
.............................

 -- の関数: turtle.reset ()

     タートルの描いたものをスクリーンから消し、タートルを中心に戻して、
     全ての変数をデフォルト値に設定し直します。

          >>> turtle.goto(0,-22)
          >>> turtle.left(100)
          >>> turtle.position()
          (0.00,-22.00)
          >>> turtle.heading()
          100.0
          >>> turtle.reset()
          >>> turtle.position()
          (0.00,0.00)
          >>> turtle.heading()
          0.0

 -- の関数: turtle.clear ()

     タートルの描いたものをスクリーンから消します。タートルは動かしませ
     ん。タートルの状態と位置、それに他のタートルたちの描いたものは影響
     を受けません。

 -- の関数: turtle.write (arg, move=False, align='left', font=('Arial',
          8, 'normal'))


     パラメータ:

        * ‘arg’ - TurtleScreen に書かれるオブジェクト

        * ‘move’ - True/False

        * ‘align’ - 文字列 "left", "center", right" のどれか

        * ‘font’ - 三つ組み (fontname, fontsize, fonttype)

     文字を書きます— 'arg' の文字列表現を、現在のタートルの位置に、
     'align' ("left", "center", "right" のどれか) に従って、 与えられた
     フォントで。 もし 'move' が真ならば、ペンは書いた文の右下隅に移動し
     ます。 デフォルトでは、 'move' は ‘False’ です。

          >>> turtle.write("Home = ", True, align="center")
          >>> turtle.write((0,0), True)


File: python.info,  Node: タートルの状態,  Next: イベントを利用する,  Prev: Pen の制御<2>,  Up: RawTurtle/Turtle のメソッドと対応する関数

5.25.10.27 タートルの状態
.........................

* Menu:

* 可視性::
* 見た目::


File: python.info,  Node: 可視性,  Next: 見た目,  Up: タートルの状態

5.25.10.28 可視性
.................

 -- の関数: turtle.hideturtle ()
 -- の関数: turtle.ht ()

     タートルを見えなくします。 複雑な図を描いている途中、タートルが見え
     ないようにするのは良い考えです。 というのもタートルを隠すことで描画
     が目に見えて速くなるからです。

          >>> turtle.hideturtle()

 -- の関数: turtle.showturtle ()
 -- の関数: turtle.st ()

     タートルが見えるようにします。

          >>> turtle.showturtle()

 -- の関数: turtle.isvisible ()

     タートルが見えている状態ならば ‘True’ を、隠されていれば ‘False’ を
     返します。

          >>> turtle.hideturtle()
          >>> turtle.isvisible()
          False
          >>> turtle.showturtle()
          >>> turtle.isvisible()
          True


File: python.info,  Node: 見た目,  Prev: 可視性,  Up: タートルの状態

5.25.10.29 見た目
.................

 -- の関数: turtle.shape (name=None)


     パラメータ: ‘name’ - 形の名前(shapename)として正しい文字列

     タートルの形を与えられた名前('name')の形に設定するか、もしくは名前
     が与えられなければ現在の形の名前を返します。 'name' という名前の形
     は TurtleScreen の形の辞書に載っていなければなりません。最初は次の
     多角形が載っています: "arrow", "turtle", "circle", "square",
     "triangle", "classic"。形についての扱いを学ぶには Screen のメソッド
     *note register_shape(): 4497. を参照して下さい。

          >>> turtle.shape()
          'classic'
          >>> turtle.shape("turtle")
          >>> turtle.shape()
          'turtle'

 -- の関数: turtle.resizemode (rmode=None)


     パラメータ: ‘rmode’ - 文字列 "auto", "user", "noresize" のどれか

     サイズ変更のモード(resizemode)を "auto", "user", "noresize" のどれ
     かに設定します。もし 'rmode' が与えられなければ、現在のサイズ変更モ
     ードを返します。それぞれのサイズ変更モードは以下の効果を持ちます:

        - "auto": ペンのサイズに対応してタートルの見た目を調整します。

        - "user": 伸長係数(stretchfactor)およびアウトライン幅
          (outlinewidth)の値に対応してタートルの見た目を調整します。これ
          らの値は *note shapesize(): 446f. で設定します。

        - "noresize": タートルの見た目を調整しません。

     ‘resizemode("user")’ は *note shapesize(): 446f. に引数を渡したとき
     に呼び出されます。

          >>> turtle.resizemode()
          'noresize'
          >>> turtle.resizemode("auto")
          >>> turtle.resizemode()
          'auto'

 -- の関数: turtle.shapesize (stretch_wid=None, stretch_len=None,
          outline=None)
 -- の関数: turtle.turtlesize (stretch_wid=None, stretch_len=None,
          outline=None)


     パラメータ:

        * ‘stretch_wid’ - 正の数

        * ‘stretch_len’ - 正の数

        * ‘outline’ - 正の数

     ペンの属性 x/y-伸長係数および/またはアウトラインを返すかまたは設定
     します。サイズ変更のモードは "user" に設定されます。サイズ変更のモ
     ードが "user" に設定されたときかつそのときに限り、タートルは伸長係
     数(stretchfactor)に従って伸長されて表示されます。 'stretch_wid' は
     進行方向に直交する向きの伸長係数で、 'stretch_len' は進行方向に沿っ
     たの伸長係数、 'outline' は形のアウトラインの幅を決めるものです。

          >>> turtle.shapesize()
          (1.0, 1.0, 1)
          >>> turtle.resizemode("user")
          >>> turtle.shapesize(5, 5, 12)
          >>> turtle.shapesize()
          (5, 5, 12)
          >>> turtle.shapesize(outline=8)
          >>> turtle.shapesize()
          (5, 5, 8)

 -- の関数: turtle.shearfactor (shear=None)


     パラメータ: ‘shear’ - number (optional)

     Set or return the current shearfactor.  Shear the turtleshape
     according to the given shearfactor shear, which is the tangent of
     the shear angle.  Do 'not' change the turtle's heading (direction
     of movement).  If shear is not given: return the current
     shearfactor, i.  e.  the tangent of the shear angle, by which lines
     parallel to the heading of the turtle are sheared.

          >>> turtle.shape("circle")
          >>> turtle.shapesize(5,2)
          >>> turtle.shearfactor(0.5)
          >>> turtle.shearfactor()
          0.5

 -- の関数: turtle.tilt (angle)


     パラメータ: ‘angle’ - 数

     タートルの形(turtleshape)を現在の傾斜角から角度('angle')だけ回転し
     ます。このときタートルの進む方向は '変わりません' 。

          >>> turtle.reset()
          >>> turtle.shape("circle")
          >>> turtle.shapesize(5,2)
          >>> turtle.tilt(30)
          >>> turtle.fd(50)
          >>> turtle.tilt(30)
          >>> turtle.fd(50)

 -- の関数: turtle.tiltangle (angle=None)


     パラメータ: ‘angle’ - a number (optional)

     Set or return the current tilt-angle.  If angle is given, rotate
     the turtleshape to point in the direction specified by angle,
     regardless of its current tilt-angle.  Do 'not' change the turtle's
     heading (direction of movement).  If angle is not given: return the
     current tilt-angle, i.  e.  the angle between the orientation of
     the turtleshape and the heading of the turtle (its direction of
     movement).

          >>> turtle.reset()
          >>> turtle.shape("circle")
          >>> turtle.shapesize(5,2)
          >>> turtle.tilt(45)
          >>> turtle.tiltangle()
          45.0

 -- の関数: turtle.shapetransform (t11=None, t12=None, t21=None,
          t22=None)


     パラメータ:

        * ‘t11’ - a number (optional)

        * ‘t12’ - a number (optional)

        * ‘t21’ - a number (optional)

        * ‘t12’ - a number (optional)

     Set or return the current transformation matrix of the turtle
     shape.

     If none of the matrix elements are given, return the transformation
     matrix as a tuple of 4 elements.  Otherwise set the given elements
     and transform the turtleshape according to the matrix consisting of
     first row t11, t12 and second row t21, t22.  The determinant t11 *
     t22 - t12 * t21 must not be zero, otherwise an error is raised.
     Modify stretchfactor, shearfactor and tiltangle according to the
     given matrix.

          >>> turtle = Turtle()
          >>> turtle.shape("square")
          >>> turtle.shapesize(4,2)
          >>> turtle.shearfactor(-0.5)
          >>> turtle.shapetransform()
          (4.0, -1.0, -0.0, 2.0)

 -- の関数: turtle.get_shapepoly ()

     Return the current shape polygon as tuple of coordinate pairs.
     This can be used to define a new shape or components of a compound
     shape.

          >>> turtle.shape("square")
          >>> turtle.shapetransform(4, -1, 0, 2)
          >>> turtle.get_shapepoly()
          ((50, -20), (30, 20), (-50, 20), (-30, -20))


File: python.info,  Node: イベントを利用する,  Next: 特別な Turtle のメソッド,  Prev: タートルの状態,  Up: RawTurtle/Turtle のメソッドと対応する関数

5.25.10.30 イベントを利用する
.............................

 -- の関数: turtle.onclick (fun, btn=1, add=None)


     パラメータ:

        * ‘fun’ - 2引数の関数でキャンバスのクリックされた点の座標を引数
          として呼び出されるものです

        * ‘btn’ - マウスボタンの番号、デフォルトは 1 (左マウスボタン)

        * ‘add’ - ‘True’ または ‘False’ - ‘True’ ならば、 新しい束縛が追
          加されますが、そうでなければ、 以前の束縛を置き換えます。

     'fun' をタートルのマウスクリック(mouse-click)イベントに束縛します。
     'fun' が ‘None’ ならば、既存の束縛が取り除かれます。無名タートル、
     つまり手続き的なやり方の例です:

          >>> def turn(x, y):
          ...     left(180)
          ...
          >>> onclick(turn)  # Now clicking into the turtle will turn it.
          >>> onclick(None)  # event-binding will be removed

 -- の関数: turtle.onrelease (fun, btn=1, add=None)


     パラメータ:

        * ‘fun’ - 2引数の関数でキャンバスのクリックされた点の座標を引数
          として呼び出されるものです

        * ‘btn’ - マウスボタンの番号、デフォルトは 1 (左マウスボタン)

        * ‘add’ - ‘True’ または ‘False’ - ‘True’ ならば、 新しい束縛が追
          加されますが、そうでなければ、 以前の束縛を置き換えます。

     'fun' をタートルのマウスボタンリリース(mouse-button-release)イベン
     トに束縛します。 'fun' が ‘None’ ならば、既存の束縛が取り除かれます
     。

          >>> class MyTurtle(Turtle):
          ...     def glow(self,x,y):
          ...         self.fillcolor("red")
          ...     def unglow(self,x,y):
          ...         self.fillcolor("")
          ...
          >>> turtle = MyTurtle()
          >>> turtle.onclick(turtle.glow)     # clicking on turtle turns fillcolor red,
          >>> turtle.onrelease(turtle.unglow) # releasing turns it to transparent.

 -- の関数: turtle.ondrag (fun, btn=1, add=None)


     パラメータ:

        * ‘fun’ - 2引数の関数でキャンバスのクリックされた点の座標を引数
          として呼び出されるものです

        * ‘btn’ - マウスボタンの番号、デフォルトは 1 (左マウスボタン)

        * ‘add’ - ‘True’ または ‘False’ - ‘True’ ならば、 新しい束縛が追
          加されますが、そうでなければ、 以前の束縛を置き換えます。

     'fun' をタートルのマウスムーブ(mouse-move)イベントに束縛します。
     'fun' が ‘None’ ならば、既存の束縛が取り除かれます。

     注意: 全てのマウスムーブイベントのシーケンスに先立ってマウスクリッ
     クイベントが起こります。

          >>> turtle.ondrag(turtle.goto)

     この後、タートルをクリックしてドラッグするとタートルはスクリーン上
     を動きそれによって(ペンが下りていれば)手書きの線ができあがります。


File: python.info,  Node: 特別な Turtle のメソッド,  Next: Compound shapes,  Prev: イベントを利用する,  Up: RawTurtle/Turtle のメソッドと対応する関数

5.25.10.31 特別な Turtle のメソッド
...................................

 -- の関数: turtle.poly ()

     Record the vertices of a polygon drawn in the ‘with turtle.poly():’
     block.  The first and last vertices will be connected.

          >>> with turtle.poly():
          ...     turtle.forward(100)
          ...     turtle.right(60)
          ...     turtle.forward(100)

     Added in version 3.14.

 -- の関数: turtle.begin_poly ()

     多角形の頂点の記録を開始します。現在のタートル位置が最初の頂点です
     。

 -- の関数: turtle.end_poly ()

     多角形の頂点の記録を停止します。現在のタートル位置が最後の頂点です
     。この頂点が最初の頂点と結ばれます。

 -- の関数: turtle.get_poly ()

     最後に記録された多角形を返します。

          >>> turtle.home()
          >>> turtle.begin_poly()
          >>> turtle.fd(100)
          >>> turtle.left(20)
          >>> turtle.fd(30)
          >>> turtle.left(60)
          >>> turtle.fd(50)
          >>> turtle.end_poly()
          >>> p = turtle.get_poly()
          >>> register_shape("myFavouriteShape", p)

 -- の関数: turtle.clone ()

     位置、向きその他のプロパティがそっくり同じタートルのクローンを作っ
     て返します。

          >>> mick = Turtle()
          >>> joe = mick.clone()

 -- の関数: turtle.getturtle ()
 -- の関数: turtle.getpen ()

     Turtle オブジェクトそのものを返します。唯一の意味のある使い方: 無名
     タートルを返す関数として使う:

          >>> pet = getturtle()
          >>> pet.fd(50)
          >>> pet
          <turtle.Turtle object at 0x...>

 -- の関数: turtle.getscreen ()

     タートルが描画中の *note TurtleScreen: 44af. オブジェクトを返します
     。 TurtleScreen のメソッドをそのオブジェクトに対して呼び出すことが
     できます。

          >>> ts = turtle.getscreen()
          >>> ts
          <turtle._Screen object at 0x...>
          >>> ts.bgcolor("pink")

 -- の関数: turtle.setundobuffer (size)


     パラメータ: ‘size’ - 整数または ‘None’

     アンドゥバッファを設定または無効化します。 'size' が整数ならばその
     サイズの空のアンドゥバッファを用意します。 'size' の値はタートルの
     アクションを何度 *note undo(): 444c. メソッド/関数で取り消せるかの
     最大数を与えます。 'size' が ‘None’ ならば、アンドゥバッファは無効
     化されます。

          >>> turtle.setundobuffer(42)

 -- の関数: turtle.undobufferentries ()

     アンドゥバッファのエントリー数を返します。

          >>> while undobufferentries():
          ...     undo()


File: python.info,  Node: Compound shapes,  Prev: 特別な Turtle のメソッド,  Up: RawTurtle/Turtle のメソッドと対応する関数

5.25.10.32 Compound shapes
..........................

合成されたタートルの形、つまり幾つかの色の違う多角形から成るような形を使
うには、以下のように補助クラス *note Shape: 44b2. を直接使わなければなり
ません:

  1. タイプ "compound" の空の Shape オブジェクトを作ります。

  2. *note addcomponent(): 44b3. メソッドを使って、好きなだけここにコン
     ポーネントを追加します。

     例えば:

          >>> s = Shape("compound")
          >>> poly1 = ((0,0),(10,-5),(0,10),(-10,-5))
          >>> s.addcomponent(poly1, "red", "blue")
          >>> poly2 = ((0,0),(10,-5),(-10,-5))
          >>> s.addcomponent(poly2, "blue", "red")

  3. こうして作った Shape を Screen の形のリスト(shapelist) に追加して使
     います:

          >>> register_shape("myshape", s)
          >>> shape("myshape")

     注釈: *note Shape: 44b2. クラスは *note register_shape(): 4497. の
     内部では違った使われ方をします。アプリケーションを書く人が Shape ク
     ラスを扱わなければならないのは、上で示したように合成された形を使う
     とき 'だけ' です！


File: python.info,  Node: TurtleScreen/Screen のメソッドと対応する関数,  Next: Public classes,  Prev: RawTurtle/Turtle のメソッドと対応する関数,  Up: turtle --- Turtle graphics

5.25.10.33 TurtleScreen/Screen のメソッドと対応する関数
.......................................................

この節のほとんどの例では ‘screen’ という名前の TurtleScreen インスタンス
を使います。

* Menu:

* ウィンドウの制御::
* アニメーションの制御::
* スクリーンイベントを利用する::
* 入力メソッド::
* 設定と特殊なメソッド::
* Screen 独自のメソッド、TurtleScreen から継承したもの以外::


File: python.info,  Node: ウィンドウの制御,  Next: アニメーションの制御,  Up: TurtleScreen/Screen のメソッドと対応する関数

5.25.10.34 ウィンドウの制御
...........................

 -- の関数: turtle.bgcolor ()

 -- の関数: turtle.bgcolor (color, /)

 -- の関数: turtle.bgcolor (r, g, b, /)

     Return or set the background color of the TurtleScreen.

     4種類の入力形式が受け入れ可能です:

     ‘bgcolor()’

          Return the current background color as color specification
          string or as a tuple (see example).  May be used as input to
          another color/pencolor/fillcolor/bgcolor call.

     ‘bgcolor(colorstring)’

          Set the background color to 'colorstring', which is a Tk color
          specification string, such as ‘"red"’, ‘"yellow"’, or
          ‘"#33cc8c"’.

     ‘bgcolor((r, g, b))’

          Set the background color to the RGB color represented by the
          tuple of 'r', 'g', and 'b'.  Each of 'r', 'g', and 'b' must be
          in the range 0..colormode, where colormode is either 1.0 or
          255 (see *note colormode(): 4494.).

     ‘bgcolor(r, g, b)’

          Set the background color to the RGB color represented by 'r',
          'g', and 'b'.  Each of 'r', 'g', and 'b' must be in the range
          0..colormode.

          >>> screen.bgcolor("orange")
          >>> screen.bgcolor()
          'orange'
          >>> screen.bgcolor("#800080")
          >>> screen.bgcolor()
          (128.0, 0.0, 128.0)

 -- の関数: turtle.bgpic (picname=None)


     パラメータ: ‘picname’ - a string, name of an image file (PNG, GIF,
     PGM, and PPM) or ‘"nopic"’, or ‘None’

     背景の画像を設定するかまたは現在の背景画像(backgroundimage)の名前を
     返します。 'picname' がファイル名ならば、その画像を背景に設定します
     。 'picname' が ‘"nopic"’ ならば、(もしあれば)背景画像を削除します
     。 'picname' が ‘None’ ならば、現在の背景画像のファイル名を返します
     。

          >>> screen.bgpic()
          'nopic'
          >>> screen.bgpic("landscape.gif")
          >>> screen.bgpic()
          "landscape.gif"

 -- の関数: turtle.clear ()

          注釈: この TurtleScreen メソッドはグローバル関数としては
          ‘clearscreen’ という名前でだけ使えます。グローバル関数 ‘clear’
          は Turtle メソッドの ‘clear’ から派生した別ものです。

 -- の関数: turtle.clearscreen ()

     全ての図形と全てのタートルを TurtleScreen から削除します。そして空
     になった TurtleScreen をリセットして初期状態に戻します: 白い背景、
     背景画像もイベント束縛もなく、トレーシングはオンです。

 -- の関数: turtle.reset ()

          注釈: この TurtleScreen メソッドはグローバル関数としては
          ‘resetscreen’ という名前でだけ使えます。グローバル関数 ‘reset’
          は Turtle メソッドの ‘reset’ から派生した別ものです。

 -- の関数: turtle.resetscreen ()

     スクリーン上の全てのタートルをリセットしその初期状態に戻します。

 -- の関数: turtle.screensize (canvwidth=None, canvheight=None, bg=None)


     パラメータ:

        * ‘canvwidth’ - 正の整数でピクセル単位の新しいキャンバス幅
          (canvaswidth)

        * ‘canvheight’ - 正の整数でピクセル単位の新しいキャンバス高さ
          (canvasheight)

        * ‘bg’ - 色文字列または色タプルで新しい背景色

     引数が渡されなければ、現在の (キャンバス幅, キャンバス高さ) を返し
     ます。そうでなければタートルが描画するキャンバスのサイズを変更しま
     す。描画ウィンドウには影響しません。キャンバスの隠れた部分を見るた
     めにはスクロールバーを使って下さい。このメソッドを使うと、以前はキ
     ャンバスの外にあったそうした図形の一部を見えるようにすることができ
     ます。

          >>> screen.screensize()
          (400, 300)
          >>> screen.screensize(2000,1500)
          >>> screen.screensize()
          (2000, 1500)

     # 逃げ出してしまったタートルを探すためとかね ;-)

 -- の関数: turtle.setworldcoordinates (llx, lly, urx, ury)


     パラメータ:

        * ‘llx’ - 数でキャンバスの左下隅の x-座標

        * ‘lly’ - 数でキャンバスの左下隅の y-座標

        * ‘urx’ - 数でキャンバスの右上隅の x-座標

        * ‘ury’ - 数でキャンバスの右上隅の y-座標

     ユーザー定義座標系を準備し必要ならばモードを "world" に切り替えます
     。この動作は ‘screen.reset()’ を伴います。すでに "world" モードにな
     っていた場合、全ての図形は新しい座標に従って再描画されます。

     '重要なお知らせ': ユーザー定義座標系では角度が歪むかもしれません。

          >>> screen.reset()
          >>> screen.setworldcoordinates(-50,-7.5,50,7.5)
          >>> for _ in range(72):
          ...     left(10)
          ...
          >>> for _ in range(8):
          ...     left(45); fd(2)   # a regular octagon


File: python.info,  Node: アニメーションの制御,  Next: スクリーンイベントを利用する,  Prev: ウィンドウの制御,  Up: TurtleScreen/Screen のメソッドと対応する関数

5.25.10.35 アニメーションの制御
...............................

 -- の関数: turtle.no_animation ()

     Temporarily disable turtle animation.  The code written inside the
     ‘no_animation’ block will not be animated; once the code block is
     exited, the drawing will appear.

          >>> with screen.no_animation():
          ...     for dist in range(2, 400, 2):
          ...         fd(dist)
          ...         rt(90)

     Added in version 3.14.

 -- の関数: turtle.delay (delay=None)


     パラメータ: ‘delay’ - 正の整数

     描画の遅延('delay')をミリ秒単位で設定するかまたはその値を返します。
     (これは概ね引き続くキャンバス更新の時間間隔です。) 遅延が大きくなる
     と、アニメーションは遅くなります。

     オプション引数:

          >>> screen.delay()
          10
          >>> screen.delay(5)
          >>> screen.delay()
          5

 -- の関数: turtle.tracer (n=None, delay=None)


     パラメータ:

        * ‘n’ - 非負整数

        * ‘delay’ - 非負整数

     タートルのアニメーションをオン・オフし、描画更新の遅延を設定します
     。 'n' が与えられた場合、通常のスクリーン更新のうち 1/n しか実際に
     実行されません。 (複雑なグラフィックスの描画を加速するのに使えます
     。) 引数なしで呼び出されたなら、現在保存されている n の値を返します
     。二つ目の引数は遅延の値を設定します(*note delay(): 4488. も参照)。

          >>> screen.tracer(8, 25)
          >>> dist = 2
          >>> for i in range(200):
          ...     fd(dist)
          ...     rt(90)
          ...     dist += 2

 -- の関数: turtle.update ()

     TurtleScreen の更新を実行します。トレーサーがオフの時に使われます。

RawTurtle/Turtle のメソッド *note speed(): 444d. も参照して下さい。


File: python.info,  Node: スクリーンイベントを利用する,  Next: 入力メソッド,  Prev: アニメーションの制御,  Up: TurtleScreen/Screen のメソッドと対応する関数

5.25.10.36 スクリーンイベントを利用する
.......................................

 -- の関数: turtle.listen (xdummy=None, ydummy=None)

     TurtleScreen に(キー・イベントを収集するために)フォーカスします。ダ
     ミー引数は *note listen(): 448b. を onclick メソッドに渡せるように
     するためのものです。

 -- の関数: turtle.onkey (fun, key)
 -- の関数: turtle.onkeyrelease (fun, key)


     パラメータ:

        * ‘fun’ - 引数なしの関数または ‘None’

        * ‘key’ - 文字列: キー (例 "a") またはキー・シンボル (例
          "space")

     'fun' を指定されたキーのキーリリース(key-release)イベントに束縛しま
     す。 'fun' が ‘None’ ならばイベント束縛は除かれます。注意: キー・イ
     ベントを登録できるようにするためには TurtleScreen はフォーカスを持
     っていないとなりません(*note listen(): 448b. を参照)。

          >>> def f():
          ...     fd(50)
          ...     lt(60)
          ...
          >>> screen.onkey(f, "Up")
          >>> screen.listen()

 -- の関数: turtle.onkeypress (fun, key=None)


     パラメータ:

        * ‘fun’ - 引数なしの関数または ‘None’

        * ‘key’ - 文字列: キー (例 "a") またはキー・シンボル (例
          "space")

     Bind 'fun' to key-press event of key if key is given, or to any
     key-press-event if no key is given.  Remark: in order to be able to
     register key-events, TurtleScreen must have focus.  (See method
     *note listen(): 448b.)

          >>> def f():
          ...     fd(50)
          ...
          >>> screen.onkey(f, "Up")
          >>> screen.listen()

 -- の関数: turtle.onclick (fun, btn=1, add=None)
 -- の関数: turtle.onscreenclick (fun, btn=1, add=None)


     パラメータ:

        * ‘fun’ - 2引数の関数でキャンバスのクリックされた点の座標を引数
          として呼び出されるものです

        * ‘btn’ - マウスボタンの番号、デフォルトは 1 (左マウスボタン)

        * ‘add’ - ‘True’ または ‘False’ - ‘True’ ならば、 新しい束縛が追
          加されますが、そうでなければ、 以前の束縛を置き換えます。

     'fun' をタートルのマウスクリック(mouse-click)イベントに束縛します。
     'fun' が ‘None’ ならば、既存の束縛が取り除かれます。

     Example for a ‘screen’ という名の TurtleScreen インスタンスと
     ‘turtle’ という名前の Turtle インスタンスの例:

          >>> screen.onclick(turtle.goto) # Subsequently clicking into the TurtleScreen will
          >>>                             # make the turtle move to the clicked point.
          >>> screen.onclick(None)        # remove event binding again

          注釈: この TurtleScreen メソッドはグローバル関数としては
          ‘onscreenclick’ という名前でだけ使えます。グローバル関数
          ‘onclick’ は Turtle メソッドの ‘onclick’ から派生した別もので
          す。

 -- の関数: turtle.ontimer (fun, t=0)


     パラメータ:

        * ‘fun’ - 引数なし関数

        * ‘t’ - 数 >= 0

     't' ミリ秒後に 'fun' を呼び出すタイマーを仕掛けます。

          >>> running = True
          >>> def f():
          ...     if running:
          ...         fd(50)
          ...         lt(60)
          ...         screen.ontimer(f, 250)
          >>> f()   ### makes the turtle march around
          >>> running = False

 -- の関数: turtle.mainloop ()
 -- の関数: turtle.done ()

     Starts event loop - calling Tkinter's mainloop function.  Must be
     the last statement in a turtle graphics program.  Must 'not' be
     used if a script is run from within IDLE in -n mode (No subprocess)
     - for interactive use of turtle graphics.

          >>> screen.mainloop()


File: python.info,  Node: 入力メソッド,  Next: 設定と特殊なメソッド,  Prev: スクリーンイベントを利用する,  Up: TurtleScreen/Screen のメソッドと対応する関数

5.25.10.37 入力メソッド
.......................

 -- の関数: turtle.textinput (title, prompt)


     パラメータ:

        * ‘title’ - string

        * ‘prompt’ - string

     Pop up a dialog window for input of a string.  Parameter title is
     the title of the dialog window, prompt is a text mostly describing
     what information to input.  Return the string input.  If the dialog
     is canceled, return ‘None’.

          >>> screen.textinput("NIM", "Name of first player:")

 -- の関数: turtle.numinput (title, prompt, default=None, minval=None,
          maxval=None)


     パラメータ:

        * ‘title’ - string

        * ‘prompt’ - string

        * ‘default’ - number (optional)

        * ‘minval’ - number (optional)

        * ‘maxval’ - number (optional)

     Pop up a dialog window for input of a number.  title is the title
     of the dialog window, prompt is a text mostly describing what
     numerical information to input.  default: default value, minval:
     minimum value for input, maxval: maximum value for input.  The
     number input must be in the range minval ..  maxval if these are
     given.  If not, a hint is issued and the dialog remains open for
     correction.  Return the number input.  If the dialog is canceled,
     return ‘None’.

          >>> screen.numinput("Poker", "Your stakes:", 1000, minval=10, maxval=10000)


File: python.info,  Node: 設定と特殊なメソッド,  Next: Screen 独自のメソッド、TurtleScreen から継承したもの以外,  Prev: 入力メソッド,  Up: TurtleScreen/Screen のメソッドと対応する関数

5.25.10.38 設定と特殊なメソッド
...............................

 -- の関数: turtle.mode (mode=None)


     パラメータ: ‘mode’ - 文字列 "standard", "logo", "world" のいずれか

     タートルのモード("standard", "logo", "world" のいずれか)を設定して
     リセットします。モードが渡されなければ現在のモードが返されます。

     Mode "standard" is compatible with old ‘turtle’.  Mode "logo" is
     compatible with most Logo turtle graphics.  Mode "world" uses
     user-defined "world coordinates".  'Attention': in this mode angles
     appear distorted if ‘x/y’ unit-ratio doesn't equal 1.

     モード           タートルの向きの初期値        正の角度
                                                    
     -----------------------------------------------------------------------
                                                    
     "standard"       右 (東) 向き                  反時計回り
                                                    
                                                    
     "logo"           上 (北) 向き                  時計回り
                                                    

          >>> mode("logo")   # resets turtle heading to north
          >>> mode()
          'logo'

 -- の関数: turtle.colormode (cmode=None)


     パラメータ: ‘cmode’ - 1.0 か 255 のどちらかの値

     色モード(colormode)を返すか、または 1.0 か 255 のどちらかの値に設定
     します。設定した後は、色トリプルの 'r', 'g', 'b' 値は 0 から
     'cmode' の範囲になければなりません。

          >>> screen.colormode(1)
          >>> turtle.pencolor(240, 160, 80)
          Traceback (most recent call last):
               ...
          TurtleGraphicsError: bad color sequence: (240, 160, 80)
          >>> screen.colormode()
          1.0
          >>> screen.colormode(255)
          >>> screen.colormode()
          255
          >>> turtle.pencolor(240,160,80)

 -- の関数: turtle.getcanvas ()

     この TurtleScreen の Canvas を返します。Tkinter の Canvas を使って
     何をするか知っている人には有用です。

          >>> cv = screen.getcanvas()
          >>> cv
          <turtle.ScrolledCanvas object ...>

 -- の関数: turtle.getshapes ()

     現在使うことのできる全てのタートルの形のリストを返します。

          >>> screen.getshapes()
          ['arrow', 'blank', 'circle', ..., 'turtle']

 -- の関数: turtle.register_shape (name, shape=None)
 -- の関数: turtle.addshape (name, shape=None)

     There are four different ways to call this function:

       1. 'name' is the name of an image file (PNG, GIF, PGM, and PPM)
          and 'shape' is ‘None’: Install the corresponding image shape.

               >>> screen.register_shape("turtle.gif")

               注釈: 画像の形はタートルが向きを変えても '回転しません' の
               で、タートルがどちらを向いているか見ても判りません!

       2. 'name' is an arbitrary string and 'shape' is the name of an
          image file (PNG, GIF, PGM, and PPM): Install the corresponding
          image shape.

               >>> screen.register_shape("turtle", "turtle.gif")

               注釈: 画像の形はタートルが向きを変えても '回転しません' の
               で、タートルがどちらを向いているか見ても判りません!

       3. 'name' が任意の文字列で 'shape' が座標ペアのタプル: 対応する多
          角形を取り込みます。

               >>> screen.register_shape("triangle", ((5,-3), (0,5), (-5,-3)))

       4. 'name' が任意の文字列で 'shape' が (合成形の) *note Shape:
          44b2. オブジェクト: 対応する合成形を取り込みます。

     タートルの形を TurtleScreen の形リスト(shapelist)に加えます。このよ
     うに登録された形だけが ‘shape(shapename)’ コマンドに使えます。

     バージョン 3.14 で変更: Added support for PNG, PGM, and PPM image
     formats.  Both a shape name and an image file name can be
     specified.

 -- の関数: turtle.turtles ()

     スクリーン上のタートルのリストを返します。

          >>> for turtle in screen.turtles():
          ...     turtle.color("red")

 -- の関数: turtle.window_height ()

     タートルウィンドウの高さを返します。

          >>> screen.window_height()
          480

 -- の関数: turtle.window_width ()

     タートルウィンドウの幅を返します。

          >>> screen.window_width()
          640


File: python.info,  Node: Screen 独自のメソッド、TurtleScreen から継承したもの以外,  Prev: 設定と特殊なメソッド,  Up: TurtleScreen/Screen のメソッドと対応する関数

5.25.10.39 Screen 独自のメソッド、TurtleScreen から継承したもの以外
...................................................................

 -- の関数: turtle.bye ()

     タートルグラフィックス(turtlegraphics)のウィンドウを閉じます。

 -- の関数: turtle.exitonclick ()

     スクリーン上のマウスクリックに ‘bye()’ メソッドを束縛します。

     設定辞書中の "using_IDLE" の値が ‘False’ (デフォルトです) の場合、
     さらにメインループ(mainloop)に入ります。注意: もし IDLE が ‘-n’ ス
     イッチ(サブプロセスなし)付きで使われているときは、この値は
     ‘turtle.cfg’ の中で ‘True’ とされているべきです。この場合、IDLE の
     メインループもクライアントスクリプトから見てアクティブです。

 -- の関数: turtle.save (filename, overwrite=False)

     Save the current turtle drawing (and turtles) as a PostScript file.


     パラメータ:

        * ‘filename’ - the path of the saved PostScript file

        * ‘overwrite’ - if ‘False’ and there already exists a file with
          the given filename, then the function will raise a
          ‘FileExistsError’.  If it is ‘True’, the file will be
          overwritten.

          >>> screen.save("my_drawing.ps")
          >>> screen.save("my_drawing.ps", overwrite=True)

     Added in version 3.14.

 -- の関数: turtle.setup (width=_CFG['width'], height=_CFG['height'],
          startx=_CFG['leftright'], starty=_CFG['topbottom'])

     メインウィンドウのサイズとポジションを設定します。引数のデフォルト
     値は設定辞書に収められており、 ‘turtle.cfg’ ファイルを通じて変更で
     きます。


     パラメータ:

        * ‘width’ - 整数ならばピクセル単位のサイズ、浮動小数点数ならばス
          クリーンに対する割合 (スクリーンの 50% がデフォルト)

        * ‘height’ - 整数ならばピクセル単位の高さ、浮動小数点数ならばス
          クリーンに対する割合 (スクリーンの 75% がデフォルト)

        * ‘startx’ - 正の数ならばスクリーンの左端からピクセル単位で測っ
          た開始位置、 負の数ならば右端から、‘None’ ならば水平方向に真ん
          中

        * ‘starty’ - 正の数ならばスクリーンの上端からピクセル単位で測っ
          た開始位置、 負の数ならば下端から、‘None’ ならば垂直方向に真ん
          中

          >>> screen.setup (width=200, height=200, startx=0, starty=0)
          >>>              # sets window to 200x200 pixels, in upper left of screen
          >>> screen.setup(width=.75, height=0.5, startx=None, starty=None)
          >>>              # sets window to 75% of screen by 50% of screen and centers

 -- の関数: turtle.title (titlestring)


     パラメータ: ‘titlestring’ - タートルグラフィックスウィンドウのタイ
     トルバーに表示される文字列

     ウインドウのタイトルを 'titlestring' に設定します。

          >>> screen.title("Welcome to the turtle zoo!")


File: python.info,  Node: Public classes,  Next: 説明<2>,  Prev: TurtleScreen/Screen のメソッドと対応する関数,  Up: turtle --- Turtle graphics

5.25.10.40 Public classes
.........................

 -- クラス: turtle.RawTurtle (canvas)
 -- クラス: turtle.RawPen (canvas)


     パラメータ: ‘canvas’ - a ‘tkinter.Canvas’, a *note ScrolledCanvas:
     44bf. or a *note TurtleScreen: 44af.

     タートルを作ります。タートルには上の「Turtle/RawTurtle のメソッド」
     で説明した全てのメソッドがあります。

 -- クラス: turtle.Turtle

     RawTurtle のサブクラスで同じインターフェイスを持ちますが、最初に必
     要になったとき自動的に作られる *note Screen: 4434. オブジェクトに描
     画します。

 -- クラス: turtle.TurtleScreen (cv)


     パラメータ: ‘cv’ - a ‘tkinter.Canvas’

     上で説明した *note bgcolor(): 4482. のようなスクリーン向けのメソッ
     ドを提供します。

 -- クラス: turtle.Screen

     TurtleScreen のサブクラスで *note 4つのメソッドが加わっています:
     44bb. 。

 -- クラス: turtle.ScrolledCanvas (master)


     パラメータ: ‘master’ - この ScrolledCanvas すなわちスクロールバーの
     付いた Tkinter canvas を収める Tkinter ウィジェット

     タートルたちが遊び回る場所として自動的に ScrolledCanvas を提供する
     Screen クラスによって使われます。

 -- クラス: turtle.Shape (type_, data)


     パラメータ: ‘type_’ - 文字列 "polygon", "image", "compound" のいず
     れか

     形をモデル化するデータ構造。ペア ‘(type_, data)’ は以下の仕様に従わ
     なければなりません:

     'type_'         'data'
                     
     -------------------------------------------------------------------------------
                     
     "polygon"       多角形タプル、すなわち座標ペアのタプル
                     
                     
     "image"         画像 (この形式は内部的にのみ使用されます!)
                     
                     
     "compound"      ‘None’ (合成形は *note addcomponent(): 44b3. メソッドを使っ
                     て作らなければなりません)
                     

      -- メソッド: addcomponent (poly, fill, outline=None)


          パラメータ:

             * ‘poly’ - 多角形、すなわち数のペアのタプル

             * ‘fill’ - 'poly' を塗りつぶす色

             * ‘outline’ - 'poly' のアウトラインの色 (与えられた場合)

          例:

               >>> poly = ((0,0),(10,-5),(0,10),(-10,-5))
               >>> s = Shape("compound")
               >>> s.addcomponent(poly, "red", "blue")
               >>> # ... add more components and then use register_shape()

          *note Compound shapes: 44b1. を参照。

 -- クラス: turtle.Vec2D (x, y)

     2次元ベクトルのクラスで、タートルグラフィックスを実装するための補助
     クラス。タートルグラフィックスを使ったプログラムでも有用でしょう。
     タプルから派生しているので、ベクターはタプルです!

     以下の演算が使えます ('a', 'b' はベクトル、 'k' は数):

        * ‘a + b’ ベクトル和

        * ‘a - b’ ベクトル差

        * ‘a * b’ 内積

        * ‘k * a’ および ‘a * k’ スカラー倍

        * ‘abs(a)’ a の絶対値

        * ‘a.rotate(angle)’ 回転


File: python.info,  Node: 説明<2>,  Next: ヘルプと設定,  Prev: Public classes,  Up: turtle --- Turtle graphics

5.25.10.41 説明
...............

A turtle object draws on a screen object, and there a number of key
classes in the turtle object-oriented interface that can be used to
create them and relate them to each other.

A *note Turtle: 44c0. instance will automatically create a *note Screen:
4434. instance if one is not already present.

‘Turtle’ is a subclass of *note RawTurtle: 44bd, which 'doesn't'
automatically create a drawing surface - a 'canvas' will need to be
provided or created for it.  The 'canvas' can be a ‘tkinter.Canvas’,
*note ScrolledCanvas: 44bf. or *note TurtleScreen: 44af.

*note TurtleScreen: 44af. is the basic drawing surface for a turtle.
*note Screen: 4434. is a subclass of ‘TurtleScreen’, and includes *note
some additional methods: 44bb. for managing its appearance (including
size and title) and behaviour.  ‘TurtleScreen’'s constructor needs a
‘tkinter.Canvas’ or a *note ScrolledCanvas: 44bf. as an argument.

The functional interface for turtle graphics uses the various methods of
‘Turtle’ and ‘TurtleScreen’/‘Screen’.  Behind the scenes, a screen
object is automatically created whenever a function derived from a
‘Screen’ method is called.  Similarly, a turtle object is automatically
created whenever any of the functions derived from a Turtle method is
called.

To use multiple turtles on a screen, the object-oriented interface must
be used.


File: python.info,  Node: ヘルプと設定,  Next: turtledemo --- Demo scripts,  Prev: 説明<2>,  Up: turtle --- Turtle graphics

5.25.10.42 ヘルプと設定
.......................

* Menu:

* ヘルプの使い方::
* ドキュメント文字列の翻訳::
* Screen および Turtle の設定方法::


File: python.info,  Node: ヘルプの使い方,  Next: ドキュメント文字列の翻訳,  Up: ヘルプと設定

5.25.10.43 ヘルプの使い方
.........................

Screen と Turtle クラスのパブリックメソッドはドキュメント文字列で網羅的
に文書化されていますので、Python のヘルプ機能を通じてオンラインヘルプと
して利用できます:

   - IDLE を使っているときは、打ち込んだ関数/メソッド呼び出しのシグニチ
     ャとドキュメント文字列の一行目がツールチップとして表示されます。

   - *note help(): ad4. をメソッドや関数に対して呼び出すとドキュメント文
     字列が表示されます:

          >>> help(Screen.bgcolor)
          Help on method bgcolor in module turtle:

          bgcolor(self, *args) unbound turtle.Screen method
              Set or return backgroundcolor of the TurtleScreen.

              Arguments (if given): a color string or three numbers
              in the range 0..colormode or a 3-tuple of such numbers.


              >>> screen.bgcolor("orange")
              >>> screen.bgcolor()
              "orange"
              >>> screen.bgcolor(0.5,0,0.5)
              >>> screen.bgcolor()
              "#800080"

          >>> help(Turtle.penup)
          Help on method penup in module turtle:

          penup(self) unbound turtle.Turtle method
              Pull the pen up -- no drawing when moving.

              Aliases: penup | pu | up

              No argument

              >>> turtle.penup()

   - メソッドに由来する関数のドキュメント文字列は変更された形をとります:

          >>> help(bgcolor)
          Help on function bgcolor in module turtle:

          bgcolor(*args)
              Set or return backgroundcolor of the TurtleScreen.

              Arguments (if given): a color string or three numbers
              in the range 0..colormode or a 3-tuple of such numbers.

              Example::

                >>> bgcolor("orange")
                >>> bgcolor()
                "orange"
                >>> bgcolor(0.5,0,0.5)
                >>> bgcolor()
                "#800080"

          >>> help(penup)
          Help on function penup in module turtle:

          penup()
              Pull the pen up -- no drawing when moving.

              Aliases: penup | pu | up

              No argument

              Example:
              >>> penup()

これらの変更されたドキュメント文字列はインポート時にメソッドから導出され
る関数定義と一緒に自動的に作られます。


File: python.info,  Node: ドキュメント文字列の翻訳,  Next: Screen および Turtle の設定方法,  Prev: ヘルプの使い方,  Up: ヘルプと設定

5.25.10.44 ドキュメント文字列の翻訳
...................................

Screen と Turtle クラスのパブリックメソッドについて、キーがメソッド名で
値がドキュメント文字列である辞書を作るユーティリティがあります。

 -- の関数: turtle.write_docstringdict (filename='turtle_docstringdict')


     パラメータ: ‘filename’ - ファイル名として使われる文字列

     ドキュメント文字列辞書(docstring-dictionary)を作って与えられたファ
     イル名の Python スクリプトに書き込みます。この関数はわざわざ呼び出
     さなければなりません (タートルグラフィックスのクラスから使われるこ
     とはありません)。ドキュメント文字列辞書は ‘`filename'.py’ という
     Python スクリプトに書き込まれます。ドキュメント文字列の異なった言語
     への翻訳に対するテンプレートとして使われることを意図したものです。

If you (or your students) want to use ‘turtle’ with online help in your
native language, you have to translate the docstrings and save the
resulting file as e.g.  ‘turtle_docstringdict_german.py’.

さらに ‘turtle.cfg’ ファイルで適切な設定をしておけば、このファイルがイン
ポート時に読み込まれて元の英語のドキュメント文字列を置き換えます。

この文書を書いている時点ではドイツ語とイタリア語のドキュメント文字列辞書
が存在します。 ( <glingl@aon.at> にリクエストして下さい。)


File: python.info,  Node: Screen および Turtle の設定方法,  Prev: ドキュメント文字列の翻訳,  Up: ヘルプと設定

5.25.10.45 Screen および Turtle の設定方法
..........................................

初期デフォルト設定では古い turtle の見た目と振る舞いを真似るようにして、
互換性を最大限に保つようにしています。

このモジュールの特性を反映した、あるいは個々人の必要性 (たとえばクラスル
ームでの使用)に合致した、異なった設定を使いたい場合、設定ファイル
‘turtle.cfg’ を用意してインポート時に読み込ませその設定に従わせることが
できます。

初期設定は以下の ‘turtle.cfg’ に対応します:

     width = 0.5
     height = 0.75
     leftright = None
     topbottom = None
     canvwidth = 400
     canvheight = 300
     mode = standard
     colormode = 1.0
     delay = 10
     undobuffersize = 1000
     shape = classic
     pencolor = black
     fillcolor = black
     resizemode = noresize
     visible = True
     language = english
     exampleturtle = turtle
     examplescreen = screen
     title = Python Turtle Graphics
     using_IDLE = False

いくつかピックアップしたエントリーの短い説明:

   - 最初の4行は *note Screen.setup: 449e. メソッドの引数に当たります。

   - 5行目6行目は *note Screen.screensize: 4486. メソッドの引数に当たり
     ます。

   - 'shape' は最初から用意されている形ならどれでも使えます(arrow,
     turtle など)。詳しくは ‘help(shape)’ をお試し下さい。

   - 塗りつぶしの色(fill color)を使いたくない(つまりタートルを透明にした
     い)場合、 ‘fillcolor = ""’ と書かなければなりません (しかし全ての空
     でない文字列は cfg ファイル中で引用符を付けてはいけません)。

   - タートルにその状態を反映させるためには ‘resizemode = auto’ とします
     。

   - If you set e.g.  ‘language = italian’ the docstringdict
     ‘turtle_docstringdict_italian.py’ will be loaded at import time (if
     present on the import path, e.g.  in the same directory as
     ‘turtle’).

   - 'exampleturtle' および 'examplescreen' はこれらのオブジェクトのドキ
     ュメント文字列内での呼び名を決めます。メソッドのドキュメント文字列
     から関数のドキュメント文字列に変換する際に、これらの名前は取り除か
     れます。

   - 'using_IDLE': IDLE とその ‘-n’ スイッチ(サブプロセスなし)を常用する
     ならば、この値を ‘True’ に設定して下さい。これにより *note
     exitonclick(): 449d. がメインループ(mainloop)に入るのを阻止します。

There can be a ‘turtle.cfg’ file in the directory where ‘turtle’ is
stored and an additional one in the current working directory.  The
latter will override the settings of the first one.

‘Lib/turtledemo’ ディレクトリにも ‘turtle.cfg’ ファイルがあります。 デモ
を実際に(できればデモビュワーからでなく)実行してそこに書かれたものとその
効果を学びましょう。


File: python.info,  Node: turtledemo --- Demo scripts,  Next: python 2 6からの変更点,  Prev: ヘルプと設定,  Up: turtle --- Turtle graphics

5.25.10.46 ‘turtledemo’ -- Demo scripts
.......................................

The ‘turtledemo’ package includes a set of demo scripts.  These scripts
can be run and viewed using the supplied demo viewer as follows:

     python -m turtledemo

あるいは、個別にデモスクリプトを実行できます。たとえば 、:

     python -m turtledemo.bytedesign

The ‘turtledemo’ package directory contains:

   - ソースコードを眺めつつスクリプトを実行できるデモビュワー
     ‘__main__.py’ 。

   - Multiple scripts demonstrating different features of the ‘turtle’
     module.  Examples can be accessed via the Examples menu.  They can
     also be run standalone.

   - 設定ファイルの書き方や使い方の例として参考にできる ‘turtle.cfg’ フ
     ァイル。

デモスクリプトは以下の通りです:

名前                         説明                               フィーチャー
                                                                
-----------------------------------------------------------------------------------------------------------
                                                                
‘bytedesign’                 複雑な古典的タートルグラフィック   *note tracer(): 4489,
                             スパターン                         *note delay(): 4488,
                                                                *note update(): 448a.
                                                                
                                                                
‘chaos’                      verhust 力学系のグラフ化, コンピ   世界座標系
                             ュータの計算が常識的な予想に反す   
                             る場合があることを示します。
                             
                                                                
‘clock’                      コンピュータの時間を示すアナログ   turtles as clock's hands,
                             時計                               *note ontimer(): 4490.
                                                                
                                                                
‘colormixer’                 r, g, b の実験                     *note ondrag(): 4477.
                                                                
                                                                
‘forest’                     3 breadth-first trees              randomization
                                                                
                                                                
‘fractalcurves’              Hilbert & Koch 曲線                再帰
                                                                
                                                                
‘lindenmayer’                民俗的数学 (インド kolams)         L-システム
                                                                
                                                                
‘minimal_hanoi’              ハノイの塔                         Rectangular Turtles as Hanoi discs
                                                                (*note shape(): 446d,
                                                                *note shapesize(): 446f.)
                                                                
                                                                
‘nim’                        play the classical nim game with   turtles as nimsticks, event driven
                             three heaps of sticks against      (mouse, keyboard)
                             the computer.                      
                             
                                                                
‘paint’                      超極小主義的描画プログラム         *note onclick(): 4475.
                                                                
                                                                
‘peace’                      初歩的                             turtle: 見た目とアニメーション
                                                                
                                                                
‘penrose’                    凧と矢による非周期的タイリング     *note stamp(): 4449.
                                                                
                                                                
‘planet_and_moon’            重力系のシミュレーション           合成形, *note Vec2D: 44a2.
                                                                
                                                                
‘rosette’                    タートルグラフィックスについての   *note clone(): 447b, *note undo(): 444c.
                             wikipedia の記事の例               
                             
                                                                
‘round_dance’                dancing turtles rotating           compound shapes, *note clone(): 447b.
                             pairwise in opposite direction     *note shapesize(): 446f,
                                                                *note tilt(): 4472,
                                                                *note get_shapepoly(): 4474,
                                                                *note update(): 448a.
                                                                
                                                                
‘sorting_animate’            visual demonstration of            simple alignment, randomization
                             different sorting methods          
                             
                                                                
‘tree’                       (図形的) 幅優先木 (ジェネレータ    *note clone(): 447b.
                             を使って)                          
                             
                                                                
‘two_canvases’               simple design                      turtles on two canvases
                                                                
                                                                
‘yinyang’                    もう一つの初歩的な例               *note circle(): 4447.
                                                                

楽しんでね!


File: python.info,  Node: python 2 6からの変更点,  Next: python 3 0からの変更点,  Prev: turtledemo --- Demo scripts,  Up: turtle --- Turtle graphics

5.25.10.47 python 2.6からの変更点
.................................

   - The methods *note Turtle.tracer: 4489, *note Turtle.window_width:
     449b. and *note Turtle.window_height: 449a. have been eliminated.
     Methods with these names and functionality are now available only
     as methods of *note Screen: 4434.  The functions derived from these
     remain available.  (In fact already in Python 2.6 these methods
     were merely duplications of the corresponding *note TurtleScreen:
     44af./*note Screen: 4434. methods.)

   - The method ‘Turtle.fill()’ has been eliminated.  The behaviour of
     *note begin_fill(): 442e. and *note end_fill(): 442f. have changed
     slightly: now every filling process must be completed with an
     ‘end_fill()’ call.

   - A method *note Turtle.filling: 4464. has been added.  It returns a
     boolean value: ‘True’ if a filling process is under way, ‘False’
     otherwise.  This behaviour corresponds to a ‘fill()’ call without
     arguments in Python 2.6.


File: python.info,  Node: python 3 0からの変更点,  Prev: python 2 6からの変更点,  Up: turtle --- Turtle graphics

5.25.10.48 python 3.0からの変更点
.................................

   - The *note Turtle: 44c0. methods *note shearfactor(): 4471, *note
     shapetransform(): 4473. and *note get_shapepoly(): 4474. have been
     added.  Thus the full range of regular linear transforms is now
     available for transforming turtle shapes.  *note tiltangle(): 92f.
     has been enhanced in functionality: it now can be used to get or
     set the tilt angle.

   - The *note Screen: 4434. method *note onkeypress(): 448e. has been
     added as a complement to *note onkey(): 448c.  As the latter binds
     actions to the key release event, an alias: *note onkeyrelease():
     448d. was also added for it.

   - The method *note Screen.mainloop: 4491. has been added, so there is
     no longer a need to use the standalone *note mainloop(): 4491.
     function when working with *note Screen: 4434. and *note Turtle:
     44c0. objects.

   - Two input methods have been added: *note Screen.textinput: 1c7a.
     and *note Screen.numinput: 1c7b.  These pop up input dialogs and
     return strings and numbers respectively.


File: python.info,  Node: 開発ツール,  Next: デバッグとプロファイル,  Prev: Graphical user interfaces with Tk,  Up: Python 標準ライブラリ

5.26 開発ツール
===============

この章で紹介されるモジュールはソフトウェアを書くことを支援します。たとえ
ば、 *note pydoc: ba. モジュールはモジュールの内容からドキュメントを生成
します。 *note doctest: 3e. と *note unittest: 10c. モジュールでは、自動
的に実行して予想通りの出力が生成されるか確認するユニットテストを書くこと
ができます。

この章で解説されるモジュールのリスト:

* Menu:

* typing: typing --- Support for type hints. Support for type hints
* pydoc: pydoc --- ドキュメント生成とオンラインヘルプシステム. ドキュメント生成とオンラインヘルプシステム
* Python 開発モード::
* doctest: doctest --- 対話型の Python の例をテストする. 対話型の Python の例をテストする
* unittest: unittest --- ユニットテストフレームワーク. ユニットテストフレームワーク
* unittest.mock: unittest mock --- モックオブジェクトライブラリ. モックオブジェクトライブラリ
* unittest.mock: unittest mock --- 入門. 入門
* test: test --- Regression tests package for Python. Regression tests package for Python
* test.support: test support --- Utilities for the Python test suite. Utilities for the Python test suite
* test.support.socket_helper: test support socket_helper --- Utilities for socket tests. Utilities for socket tests
* test.support.script_helper: test support script_helper --- Utilities for the Python execution tests. Utilities for the Python execution tests
* test.support.bytecode_helper: test support bytecode_helper --- Support tools for testing correct bytecode generation. Support tools for testing correct bytecode
                                generation
* test.support.threading_helper: test support threading_helper --- Utilities for threading tests. Utilities for threading tests
* test.support.os_helper: test support os_helper --- Utilities for os tests. Utilities for os tests
* test.support.import_helper: test support import_helper --- Utilities for import tests. Utilities for import tests
* test.support.warnings_helper: test support warnings_helper --- Utilities for warnings tests. Utilities for warnings tests


File: python.info,  Node: typing --- Support for type hints,  Next: pydoc --- ドキュメント生成とオンラインヘルプシステム,  Up: 開発ツール

5.26.1 ‘typing’ -- Support for type hints
-----------------------------------------

Added in version 3.5.

'ソースコード:' Lib/typing.py(1)

     注釈: Python ランタイムは、関数や変数の型アノテーションを強制しませ
     ん。型アノテーションは、 *note type checkers: 574. や IDE、linterな
     どのサードパーティーツールで使われます。

__________________________________________________________________

このモジュールは型ヒントの実行時サポートを提供します。

以下の関数を例に考えてみます:

     def surface_area_of_cube(edge_length: float) -> str:
         return f"The surface area of the cube is {6 * edge_length ** 2}."

‘surface_area_of_cube’ 関数は、‘edge_length: float’ という *note type
hint: 23cb. で示されているように、引数が *note float: 196. のインスタン
スであるという前提です。 そして、‘-> str’ というヒントにある通り、この関
数は *note str: 169. のインスタンスを返すことになっています。

型ヒントは *note float: 196. や *note str: 169. のような単純な型を指定す
ることもできますし、もっと複雑な型も指定できます。 *note typing: 10a. モ
ジュールには、より高度な型ヒントを表現するためのいろいろな型が含まれてい
ます。

‘typing’ モジュールには新しい機能が頻繁に追加されます。
typing_extensions(2) パッケージを使うことで、古い Python バージョンから
もその新機能を使うことができます。

参考
....

Typing cheat sheet(3)

     型ヒントの簡単な概要 (mypy ドキュメンテーション)

Type System Reference section of the mypy docs(4)

     Python の型システムの規格は PEP によって定められているので、このレ
     ファレンスはほとんどの Python 型チェッカーに適用できるはずです。
     (mypy のみに適用される部分もあるかもしれません。)

Static Typing with Python(5)

     コミュニティーによって書かれた、型システムの機能や便利な型関連のツ
     ール、型に関するベストプラクティスを詳しく説明している、特定の型チ
     ェッカーに依らないドキュメンテーション。

* Menu:

* Python 型システムの仕様::
* 型エイリアス::
* NewType::
* 呼び出し可能オブジェクトのアノテーション::
* ジェネリクス::
* タプルのアノテーション::
* クラスオブジェクトの型::
* Annotating generators and coroutines::
* ユーザー定義のジェネリック型::
* Any 型::
* 名前的部分型 vs 構造的部分型::
* モジュールの内容: モジュールの内容<3>.
* メジャーな機能の非推奨時系列::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/typing.py

   (2) https://pypi.org/project/typing_extensions/

   (3) https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html

   (4) https://mypy.readthedocs.io/en/stable/index.html

   (5) https://typing.python.org/en/latest/


File: python.info,  Node: Python 型システムの仕様,  Next: 型エイリアス,  Up: typing --- Support for type hints

5.26.1.1 Python 型システムの仕様
................................

The canonical, up-to-date specification of the Python type system can be
found at Specification for the Python type system(1).

   ---------- Footnotes ----------

   (1) https://typing.python.org/en/latest/spec/index.html


File: python.info,  Node: 型エイリアス,  Next: NewType,  Prev: Python 型システムの仕様,  Up: typing --- Support for type hints

5.26.1.2 型エイリアス
.....................

型エイリアスは *note type: 66d. 文を用いて定義され、 *note
TypeAliasType: 2ae. インスタンスが生成されます。 この例では、静的型チェ
ッカーは ‘Vector’ と ‘list[float]’ を等しいものとして扱います

     type Vector = list[float]

     def scale(scalar: float, vector: Vector) -> Vector:
         return [scalar * num for num in vector]

     # floatのlistはVectorとして要件を満たすため、型チェックを通過する。
     new_vector = scale(2.0, [1.0, -4.2, 5.4])

型エイリアスは複雑な型シグネチャを単純化するのに有用です。例えば:

     from collections.abc import Sequence

     type ConnectionOptions = dict[str, str]
     type Address = tuple[str, int]
     type Server = tuple[Address, ConnectionOptions]

     def broadcast_message(message: str, servers: Sequence[Server]) -> None:
         ...

     # 静的型チェッカーでは、上記の型アノテーションと
     # 以下のアノテーションを同等のものとして扱う。
     def broadcast_message(
         message: str,
         servers: Sequence[tuple[tuple[str, int], dict[str, str]]]
     ) -> None:
         ...

*note type: 66d. 文はPython3.12で新しく導入されました。後方互換性のため
に、単に代入によって型エイリアスを作成することもできます：

     Vector = list[float]

あるいは、 *note TypeAlias: 9cc. でマークすることで、これが通常の変数代
入ではなく、型エイリアスであることを明示できます

     from typing import TypeAlias

     Vector: TypeAlias = list[float]


File: python.info,  Node: NewType,  Next: 呼び出し可能オブジェクトのアノテーション,  Prev: 型エイリアス,  Up: typing --- Support for type hints

5.26.1.3 NewType
................

異なる型を作るためには *note NewType: ef1. ヘルパークラスを使います:

     from typing import NewType

     UserId = NewType('UserId', int)
     some_id = UserId(524313)

静的型チェッカーは新しい型を元々の型のサブクラスのように扱います。この振
る舞いは論理的な誤りを見つける手助けとして役に立ちます。

     def get_user_name(user_id: UserId) -> str:
         ...

     # 型チェックを通過する
     user_a = get_user_name(UserId(42351))

     # 型チェックに失敗する。int型はUserId型ではないため。
     user_b = get_user_name(-1)

‘UserId’ 型の変数も ‘int’ の全ての演算が行えますが、その結果は常に ‘int’
型になります。 この振る舞いにより、 ‘int’ が期待されるところに ‘UserId’
を渡せますが、不正な方法で ‘UserId’ を作ってしまうことを防ぎます。

     # 'output' は'int'型となる。'UserId'型にはならない。
     output = UserId(23413) + UserId(54341)

これらのチェックは静的型チェッカーのみによって強制されるということに注意
してください。 実行時に ‘Derived = NewType('Derived', Base)’ という文は
渡された仮引数をただちに返す ‘Derived’ callable を作ります。 つまり
‘Derived(some_value)’ という式は新しいクラスを作ることはなく、通常の関数
呼び出しより多くのオーバーヘッドがないということを意味します。

より正確に言うと、式 ‘some_value is Derived(some_value)’ は実行時に常に
真を返します。

‘Derived’ のサブタイプを作成することはできません

     from typing import NewType

     UserId = NewType('UserId', int)

     # 実行時にエラーとなり、型チェックも通らない
     class AdminUserId(UserId): pass

しかし、 'derived' である ‘NewType’ をもとにした *note NewType: ef1. は
作ることが出来ます:

     from typing import NewType

     UserId = NewType('UserId', int)

     ProUserId = NewType('ProUserId', UserId)

そして ‘ProUserId’ に対する型検査は期待通りに動作します。

より詳しくは PEP 484(1) を参照してください。

     注釈: 型エイリアスの使用は、2つの型が互いに等価であることを宣言する
     ことを思い出してください。 ‘type Alias = Original’ とすると、静的型
     チェッカーは ‘Alias’ を ‘Original’ と"正確に等価な"ものとして扱いま
     す。これは、複雑な型シグネチャを単純化したい場合に便利です。

     これに対し、 ‘NewType’ はある型をもう一方の型の 'サブタイプ' として
     宣言します。 ‘Derived = NewType('Derived', Original)’ とすると静的
     型検査器は ‘Derived’ を ‘Original’ の 'サブクラス' として扱います。
     つまり ‘Original’ 型の値は ‘Derived’ 型の値が期待される場所で使うこ
     とが出来ないということです。これは論理的な誤りを最小の実行時のコス
     トで防ぎたい時に有用です。

Added in version 3.5.2.

バージョン 3.10 で変更: ‘NewType’ は関数ではなくクラスになりました。その
結果、通常の関数よりも ‘NewType’ を呼び出す際に多少の実行時コストが追加
されます。

バージョン 3.11 で変更: ‘NewType’ 呼び出し時のパフォーマンスが Python
3.9 のレベルに戻りました

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/


File: python.info,  Node: 呼び出し可能オブジェクトのアノテーション,  Next: ジェネリクス,  Prev: NewType,  Up: typing --- Support for type hints

5.26.1.4 呼び出し可能オブジェクトのアノテーション
.................................................

関数、または他の *note callable: 2d7b. なオブジェクトは、 *note
collections.abc.Callable: 9eb. または *note typing.Callable: 9c8. を使っ
てアノテーションすることができます。 ‘Callable[[int], str]’ は、 *note
int: 19b. 型のパラメータを1つ受け取り、 *note str: 169. を返す関数を意味
します。

例えば:

     from collections.abc import Callable, Awaitable

     def feeder(get_next_item: Callable[[], str]) -> None:
         ...  # Body

     def async_query(on_success: Callable[[int], None],
                     on_error: Callable[[int, Exception], None]) -> None:
         ...  # Body

     async def on_update(value: str) -> None:
         ...  # Body

     callback: Callable[[str], Awaitable[None]] = on_update

The subscription syntax must always be used with exactly two values: the
argument list and the return type.  The argument list must be a list of
types, a *note ParamSpec: 487, *note Concatenate: 9c7, or an ellipsis
(‘...’).  The return type must be a single type.

もしellipsisリテラル ‘...’ が引数リストとして与えられた場合、それは任意
のパラメータリストを持つ呼び出し可能オブジェクトを受け入れることを示しま
す。

     def concat(x: str, y: str) -> str:
         return x + y

     x: Callable[..., str]
     x = str     # OK
     x = concat  # これもOK

‘Callable’ は可変引数、*note オーバーロード関数: 44d6.、キーワード専用引
数などを含む複雑な型シグネチャを表現することはできません。 しかし、*note
Protocol: 56b. クラスとその *note __call__(): 77a. メソッドを定義すれば
表現することができます:

     from collections.abc import Iterable
     from typing import Protocol

     class Combiner(Protocol):
         def __call__(self, *vals: bytes, maxlen: int | None = None) -> list[bytes]: ...

     def batch_proc(data: Iterable[bytes], cb_results: Combiner) -> bytes:
         for item in data:
             ...

     def good_cb(*vals: bytes, maxlen: int | None = None) -> list[bytes]:
         ...
     def bad_cb(*vals: bytes, maxitems: int | None) -> list[bytes]:
         ...

     batch_proc([], good_cb)  # OK
     batch_proc([], bad_cb)   # Error! Argument 2 has incompatible type because of
                              # different name and kind in the callback

callable が別の callable を引数に取る場合は、*note ParamSpec: 487. を使
えば両者のパラメータ引数の依存関係を表現することができます。 さらに、あ
る callable が別の callable から引数を追加したり削除したりする場合は、
*note Concatenate: 9c7. 演算子を使うことで表現できます。 その場合、
callable の型は ‘Callable[ParamSpecVariable, ReturnType]’ と
‘Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable],
ReturnType]’ という形になります。

バージョン 3.10 で変更: ‘Callable’ は *note ParamSpec: 487. と *note
Concatenate: 9c7. をサポートしました。詳細は PEP 612(1) を参照してくださ
い。

参考
....

*note ParamSpec: 487. と *note Concatenate: 9c7. のドキュメントに、
‘Callable’ での使用例が記載されています。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0612/


File: python.info,  Node: ジェネリクス,  Next: タプルのアノテーション,  Prev: 呼び出し可能オブジェクトのアノテーション,  Up: typing --- Support for type hints

5.26.1.5 ジェネリクス
.....................

コンテナに含まれるオブジェクトに関する型情報は、一般的な方法で静的に推論
することができないため、標準ライブラリの多くのコンテナクラスは、要素に期
待する型を示す添字表記をサポートしています

     from collections.abc import Mapping, Sequence

     class Employee: ...

     # Sequence[Employee] indicates that all elements in the sequence
     # must be instances of "Employee".
     # Mapping[str, str] indicates that all keys and all values in the mapping
     # must be strings.
     def notify_by_email(employees: Sequence[Employee],
                         overrides: Mapping[str, str]) -> None: ...

Generic functions and classes can be parameterized by using *note type
parameter syntax: 5ad.:

     from collections.abc import Sequence

     def first[T](l: Sequence[T]) -> T:  # Function is generic over the TypeVar "T"
         return l[0]

Or by using the *note TypeVar: 486. factory directly:

     from collections.abc import Sequence
     from typing import TypeVar

     U = TypeVar('U')                  # Declare type variable "U"

     def second(l: Sequence[U]) -> U:  # Function is generic over the TypeVar "U"
         return l[1]

バージョン 3.12 で変更: Syntactic support for generics is new in Python
3.12.


File: python.info,  Node: タプルのアノテーション,  Next: クラスオブジェクトの型,  Prev: ジェネリクス,  Up: typing --- Support for type hints

5.26.1.6 タプルのアノテーション
...............................

For most containers in Python, the typing system assumes that all
elements in the container will be of the same type.  For example:

     from collections.abc import Mapping

     # Type checker will infer that all elements in ``x`` are meant to be ints
     x: list[int] = []

     # Type checker error: ``list`` only accepts a single type argument:
     y: list[int, str] = [1, 'foo']

     # Type checker will infer that all keys in ``z`` are meant to be strings,
     # and that all values in ``z`` are meant to be either strings or ints
     z: Mapping[str, str | int] = {}

*note list: 24d. は引数に1つの型のみ受け入れるので、型チェッカーは上記の
‘y’ への代入でエラーを出力します。同様に、*note Mapping: ac7. は引数に
2つの型のみ受け入れます。1つ目はキーの型を示し、2つ目は値の型を示します
。

しかし、他の多くのPythonのコンテナとは異なり、タプルがすべて同じ型ではな
い要素を持つことは、慣用的なPythonコードでは一般的です。このため、タプル
はPythonの型システムの中でも特殊です。*note tuple: 614. は任意の数の引数
を受け入れます

     # OK: ``x`` is assigned to a tuple of length 1 where the sole element is an int
     x: tuple[int] = (5,)

     # OK: ``y`` is assigned to a tuple of length 2;
     # element 1 is an int, element 2 is a str
     y: tuple[int, str] = (5, "foo")

     # Error: the type annotation indicates a tuple of length 1,
     # but ``z`` has been assigned to a tuple of length 3
     z: tuple[int] = (1, 2, 3)

To denote a tuple which could be of 'any' length, and in which all
elements are of the same type ‘T’, use the literal ellipsis ‘...’:
‘tuple[T, ...]’.  To denote an empty tuple, use ‘tuple[()]’.  Using
plain ‘tuple’ as an annotation is equivalent to using ‘tuple[Any, ...]’:

     x: tuple[int, ...] = (1, 2)
     # These reassignments are OK: ``tuple[int, ...]`` indicates x can be of any length
     x = (1, 2, 3)
     x = ()
     # This reassignment is an error: all elements in ``x`` must be ints
     x = ("foo", "bar")

     # ``y`` can only ever be assigned to an empty tuple
     y: tuple[()] = ()

     z: tuple = ("foo", "bar")
     # These reassignments are OK: plain ``tuple`` is equivalent to ``tuple[Any, ...]``
     z = (1, 2, 3)
     z = ()


File: python.info,  Node: クラスオブジェクトの型,  Next: Annotating generators and coroutines,  Prev: タプルのアノテーション,  Up: typing --- Support for type hints

5.26.1.7 クラスオブジェクトの型
...............................

A variable annotated with ‘C’ may accept a value of type ‘C’.  In
contrast, a variable annotated with ‘type[C]’ (or deprecated *note
typing.Type[C]: 44db.) may accept values that are classes themselves -
specifically, it will accept the 'class object' of ‘C’.  For example:

     a = 3         # Has type ``int``
     b = int       # Has type ``type[int]``
     c = type(a)   # Also has type ``type[int]``

Note that ‘type[C]’ is covariant:

     class User: ...
     class ProUser(User): ...
     class TeamUser(User): ...

     def make_new_user(user_class: type[User]) -> User:
         # ...
         return user_class()

     make_new_user(User)      # OK
     make_new_user(ProUser)   # Also OK: ``type[ProUser]`` is a subtype of ``type[User]``
     make_new_user(TeamUser)  # Still fine
     make_new_user(User())    # Error: expected ``type[User]`` but got ``User``
     make_new_user(int)       # Error: ``type[int]`` is not a subtype of ``type[User]``

The only legal parameters for *note type: f44. are classes, *note Any:
8bb, *note type variables: 23c9, and unions of any of these types.  For
example:

     def new_non_team_user(user_class: type[BasicUser | ProUser]): ...

     new_non_team_user(BasicUser)  # OK
     new_non_team_user(ProUser)    # OK
     new_non_team_user(TeamUser)   # Error: ``type[TeamUser]`` is not a subtype
                                   # of ``type[BasicUser | ProUser]``
     new_non_team_user(User)       # Also an error

‘type[Any]’ is equivalent to *note type: f44, which is the root of
Python's *note metaclass hierarchy: 23be.


File: python.info,  Node: Annotating generators and coroutines,  Next: ユーザー定義のジェネリック型,  Prev: クラスオブジェクトの型,  Up: typing --- Support for type hints

5.26.1.8 Annotating generators and coroutines
.............................................

A generator can be annotated using the generic type *note
Generator[YieldType, SendType, ReturnType]: fdb.  For example:

     def echo_round() -> Generator[int, float, str]:
         sent = yield 0
         while sent >= 0:
             sent = yield round(sent)
         return 'Done'

Note that unlike many other generic classes in the standard library, the
‘SendType’ of *note Generator: fdb. behaves contravariantly, not
covariantly or invariantly.

The ‘SendType’ and ‘ReturnType’ parameters default to ‘None’:

     def infinite_stream(start: int) -> Generator[int]:
         while True:
             yield start
             start += 1

It is also possible to set these types explicitly:

     def infinite_stream(start: int) -> Generator[int, None, None]:
         while True:
             yield start
             start += 1

Simple generators that only ever yield values can also be annotated as
having a return type of either *note Iterable[YieldType]: 26ae. or *note
Iterator[YieldType]: 26af.:

     def infinite_stream(start: int) -> Iterator[int]:
         while True:
             yield start
             start += 1

Async generators are handled in a similar fashion, but don't expect a
‘ReturnType’ type argument (*note AsyncGenerator[YieldType, SendType]:
e87.).  The ‘SendType’ argument defaults to ‘None’, so the following
definitions are equivalent:

     async def infinite_stream(start: int) -> AsyncGenerator[int]:
         while True:
             yield start
             start = await increment(start)

     async def infinite_stream(start: int) -> AsyncGenerator[int, None]:
         while True:
             yield start
             start = await increment(start)

As in the synchronous case, *note AsyncIterable[YieldType]: fdf. and
*note AsyncIterator[YieldType]: fde. are available as well:

     async def infinite_stream(start: int) -> AsyncIterator[int]:
         while True:
             yield start
             start = await increment(start)

Coroutines can be annotated using *note Coroutine[YieldType, SendType,
ReturnType]: fdd.  Generic arguments correspond to those of *note
Generator: fdb, for example:

     from collections.abc import Coroutine
     c: Coroutine[list[str], str, int]  # Some coroutine defined elsewhere
     x = c.send('hi')                   # Inferred type of 'x' is list[str]
     async def bar() -> None:
         y = await c                    # Inferred type of 'y' is int


File: python.info,  Node: ユーザー定義のジェネリック型,  Next: Any 型,  Prev: Annotating generators and coroutines,  Up: typing --- Support for type hints

5.26.1.9 ユーザー定義のジェネリック型
.....................................

ユーザー定義のクラスを、ジェネリッククラスとして定義できます。

     from logging import Logger

     class LoggedVar[T]:
         def __init__(self, value: T, name: str, logger: Logger) -> None:
             self.name = name
             self.logger = logger
             self.value = value

         def set(self, new: T) -> None:
             self.log('Set ' + repr(self.value))
             self.value = new

         def get(self) -> T:
             self.log('Get ' + repr(self.value))
             return self.value

         def log(self, message: str) -> None:
             self.logger.info('%s: %s', self.name, message)

This syntax indicates that the class ‘LoggedVar’ is parameterised around
a single *note type variable: 44de. ‘T’ .  This also makes ‘T’ valid as
a type within the class body.

Generic classes implicitly inherit from *note Generic: 17b6.  For
compatibility with Python 3.11 and lower, it is also possible to inherit
explicitly from *note Generic: 17b6. to indicate a generic class:

     from typing import TypeVar, Generic

     T = TypeVar('T')

     class LoggedVar(Generic[T]):
         ...

Generic classes have *note __class_getitem__(): 943. methods, meaning
they can be parameterised at runtime (e.g.  ‘LoggedVar[int]’ below):

     from collections.abc import Iterable

     def zero_all_vars(vars: Iterable[LoggedVar[int]]) -> None:
         for var in vars:
             var.set(0)

A generic type can have any number of type variables.  All varieties of
*note TypeVar: 486. are permissible as parameters for a generic type:

     from typing import TypeVar, Generic, Sequence

     class WeirdTrio[T, B: Sequence[bytes], S: (int, str)]:
         ...

     OldT = TypeVar('OldT', contravariant=True)
     OldB = TypeVar('OldB', bound=Sequence[bytes], covariant=True)
     OldS = TypeVar('OldS', int, str)

     class OldWeirdTrio(Generic[OldT, OldB, OldS]):
         ...

*note Generic: 17b6. の引数のそれぞれの型変数は別のものでなければなりま
せん。このため次のクラス定義は無効です:

     from typing import TypeVar, Generic
     ...

     class Pair[M, M]:  # SyntaxError
         ...

     T = TypeVar('T')

     class Pair(Generic[T, T]):   # INVALID
         ...

Generic classes can also inherit from other classes:

     from collections.abc import Sized

     class LinkedList[T](Sized):
         ...

When inheriting from generic classes, some type parameters could be
fixed:

     from collections.abc import Mapping

     class MyDict[T](Mapping[str, T]):
         ...

この場合では ‘MyDict’ は仮引数 ‘T’ を 1 つとります。

Using a generic class without specifying type parameters assumes *note
Any: 8bb. for each position.  In the following example, ‘MyIterable’ is
not generic but implicitly inherits from ‘Iterable[Any]’:

     from collections.abc import Iterable

     class MyIterable(Iterable): # Same as Iterable[Any]
         ...

User-defined generic type aliases are also supported.  Examples:

     from collections.abc import Iterable

     type Response[S] = Iterable[S] | int

     # Return type here is same as Iterable[str] | int
     def response(query: str) -> Response[str]:
         ...

     type Vec[T] = Iterable[tuple[T, T]]

     def inproduct[T: (int, float, complex)](v: Vec[T]) -> T: # Same as Iterable[tuple[T, T]]
         return sum(x*y for x, y in v)

For backward compatibility, generic type aliases can also be created
through a simple assignment:

     from collections.abc import Iterable
     from typing import TypeVar

     S = TypeVar("S")
     Response = Iterable[S] | int

バージョン 3.7 で変更: *note Generic: 17b6. にあった独自のメタクラスは無
くなりました。

バージョン 3.12 で変更: Syntactic support for generics and type aliases
is new in version 3.12.  Previously, generic classes had to explicitly
inherit from *note Generic: 17b6. or contain a type variable in one of
their bases.

User-defined generics for parameter expressions are also supported via
parameter specification variables in the form ‘[**P]’.  The behavior is
consistent with type variables' described above as parameter
specification variables are treated by the ‘typing’ module as a
specialized type variable.  The one exception to this is that a list of
types can be used to substitute a *note ParamSpec: 487.:

     >>> class Z[T, **P]: ...  # T is a TypeVar; P is a ParamSpec
     ...
     >>> Z[int, [dict, float]]
     __main__.Z[int, [dict, float]]

Classes generic over a *note ParamSpec: 487. can also be created using
explicit inheritance from *note Generic: 17b6.  In this case, ‘**’ is
not used:

     from typing import ParamSpec, Generic

     P = ParamSpec('P')

     class Z(Generic[P]):
         ...

Another difference between *note TypeVar: 486. and *note ParamSpec: 487.
is that a generic with only one parameter specification variable will
accept parameter lists in the forms ‘X[[Type1, Type2, ...]]’ and also
‘X[Type1, Type2, ...]’ for aesthetic reasons.  Internally, the latter is
converted to the former, so the following are equivalent:

     >>> class X[**P]: ...
     ...
     >>> X[int, str]
     __main__.X[[int, str]]
     >>> X[[int, str]]
     __main__.X[[int, str]]

Note that generics with *note ParamSpec: 487. may not have correct
‘__parameters__’ after substitution in some cases because they are
intended primarily for static type checking.

バージョン 3.10 で変更: *note Generic: 17b6. can now be parameterized
over parameter expressions.  See *note ParamSpec: 487. and PEP 612(1)
for more details.

A user-defined generic class can have ABCs as base classes without a
metaclass conflict.  Generic metaclasses are not supported.  The outcome
of parameterizing generics is cached, and most types in the ‘typing’
module are *note hashable: 824. and comparable for equality.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0612/


File: python.info,  Node: Any 型,  Next: 名前的部分型 vs 構造的部分型,  Prev: ユーザー定義のジェネリック型,  Up: typing --- Support for type hints

5.26.1.10 ‘Any’ 型
..................

*note Any: 8bb. は特別な種類の型です。静的型検査器はすべての型を *note
Any: 8bb. と互換として扱い、 *note Any: 8bb. をすべての型と互換として扱
います。

これは、 *note Any: 8bb. 型の値では、任意の演算やメソッドの呼び出しが行
えることを意味します:

     from typing import Any

     a: Any = None
     a = []          # OK
     a = 2           # OK

     s: str = ''
     s = a           # OK

     def foo(item: Any) -> int:
         # Passes type checking; 'item' could be any type,
         # and that type might have a 'bar' method
         item.bar()
         ...

*note Any: 8bb. 型の値をより詳細な型に代入する時に型検査が行われないこと
に注意してください。例えば、静的型検査器は ‘a’ を ‘s’ に代入する時、‘s’
が *note str: 169. 型として宣言されていて実行時に *note int: 19b. の値を
受け取るとしても、エラーを報告しません。

さらに、返り値や引数の型のないすべての関数は暗黙的に *note Any: 8bb. を
使用します。

     def legacy_parser(text):
         ...
         return data

     # A static type checker will treat the above
     # as having the same signature as:
     def legacy_parser(text: Any) -> Any:
         ...
         return data

この挙動により、動的型付けと静的型付けが混在したコードを書かなければなら
ない時に *note Any: 8bb. を '非常口' として使用することができます。

*note Any: 8bb. の挙動と *note object: c7e. の挙動を対比しましょう。
*note Any: 8bb. と同様に、すべての型は *note object: c7e. のサブタイプで
す。しかしながら、 *note Any: 8bb. と異なり、逆は成り立ちません: *note
object: c7e. はすべての他の型のサブタイプでは 'ありません'。

これは、ある値の型が *note object: c7e. のとき、型検査器はこれについての
ほとんどすべての操作を拒否し、これをより特殊化された変数に代入する (また
は返り値として利用する) ことは型エラーになることを意味します。例えば:

     def hash_a(item: object) -> int:
         # Fails type checking; an object does not have a 'magic' method.
         item.magic()
         ...

     def hash_b(item: Any) -> int:
         # Passes type checking
         item.magic()
         ...

     # Passes type checking, since ints and strs are subclasses of object
     hash_a(42)
     hash_a("foo")

     # Passes type checking, since Any is compatible with all types
     hash_b(42)
     hash_b("foo")

*note object: c7e. は、ある値が型安全な方法で任意の型として使えることを
示すために使用します。 *note Any: 8bb. はある値が動的に型付けられること
を示すために使用します。


File: python.info,  Node: 名前的部分型 vs 構造的部分型,  Next: モジュールの内容<3>,  Prev: Any 型,  Up: typing --- Support for type hints

5.26.1.11 名前的部分型 vs 構造的部分型
......................................

初めは PEP 484(1) は Python の静的型システムを '名前的部分型' を使って定
義していました。 名前的部分型とは、クラス ‘B’ が期待されているところにク
ラス ‘A’ が許容されるのは ‘A’ が ‘B’ のサブクラスの場合かつその場合に限
る、ということです。

前出の必要条件は、*note Iterable: 26ae. などの抽象基底クラスにも当て嵌ま
ります。 この型付け手法の問題は、この手法をサポートするためにクラスに明
確な型付けを行う必要があることで、これは pythonic ではなく、普段行ってい
る 慣用的な Python コードへの動的型付けとは似ていません。 例えば、次のコ
ードは PEP 484(2) に従ったものです

     from collections.abc import Sized, Iterable, Iterator

     class Bucket(Sized, Iterable[int]):
         ...
         def __len__(self) -> int: ...
         def __iter__(self) -> Iterator[int]: ...

PEP 544(3) solves this problem by allowing users to write the above code
without explicit base classes in the class definition, allowing ‘Bucket’
to be implicitly considered a subtype of both ‘Sized’ and
‘Iterable[int]’ by static type checkers.  This is known as 'structural
subtyping' (or static duck-typing):

     from collections.abc import Iterator, Iterable

     class Bucket:  # Note: no base classes
         ...
         def __len__(self) -> int: ...
         def __iter__(self) -> Iterator[int]: ...

     def collect(items: Iterable[int]) -> int: ...
     result = collect(Bucket())  # Passes type check

さらに、特別なクラス *note Protocol: 56b. のサブクラスを作ることで、新し
い独自のプロトコルを作って構造的部分型というものを満喫できます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/

   (2) https://peps.python.org/pep-0484/

   (3) https://peps.python.org/pep-0544/


File: python.info,  Node: モジュールの内容<3>,  Next: メジャーな機能の非推奨時系列,  Prev: 名前的部分型 vs 構造的部分型,  Up: typing --- Support for type hints

5.26.1.12 モジュールの内容
..........................

The ‘typing’ module defines the following classes, functions and
decorators.

* Menu:

* 特殊型付けプリミティブ::
* プロトコル: プロトコル<4>.
* ABCs and Protocols for working with I/O::
* Functions and decorators::
* Introspection helpers::
* 定数: 定数<10>.
* 非推奨のエイリアス::


File: python.info,  Node: 特殊型付けプリミティブ,  Next: プロトコル<4>,  Up: モジュールの内容<3>

5.26.1.13 特殊型付けプリミティブ
................................

* Menu:

* 特殊型::
* 特殊形式::
* Building generic types and type aliases::
* Other special directives::


File: python.info,  Node: 特殊型,  Next: 特殊形式,  Up: 特殊型付けプリミティブ

5.26.1.14 特殊型
................

These can be used as types in annotations.  They do not support
subscription using ‘[]’.

 -- データ: typing.Any

     制約のない型であることを示す特別な型です。

        * 任意の型は *note Any: 8bb. と互換です。

        * *note Any: 8bb. は任意の型と互換です。

     バージョン 3.11 で変更: *note Any: 8bb. can now be used as a base
     class.  This can be useful for avoiding type checker errors with
     classes that can duck type anywhere or are highly dynamic.

 -- データ: typing.AnyStr

     A *note constrained type variable: 44e4.

     Definition:

          AnyStr = TypeVar('AnyStr', str, bytes)

     ‘AnyStr’ is meant to be used for functions that may accept *note
     str: 169. or *note bytes: 192. arguments but cannot allow the two
     to mix.

     例えば:

          def concat(a: AnyStr, b: AnyStr) -> AnyStr:
              return a + b

          concat("foo", "bar")    # OK, output has type 'str'
          concat(b"foo", b"bar")  # OK, output has type 'bytes'
          concat("foo", b"bar")   # Error, cannot mix str and bytes

     Note that, despite its name, ‘AnyStr’ has nothing to do with the
     *note Any: 8bb. type, nor does it mean "any string".  In
     particular, ‘AnyStr’ and ‘str | bytes’ are different from each
     other and have different use cases:

          # Invalid use of AnyStr:
          # The type variable is used only once in the function signature,
          # so cannot be "solved" by the type checker
          def greet_bad(cond: bool) -> AnyStr:
              return "hi there!" if cond else b"greetings!"

          # The better way of annotating this function:
          def greet_proper(cond: bool) -> str | bytes:
              return "hi there!" if cond else b"greetings!"

     Deprecated since version 3.13, will be removed in version 3.18:
     Deprecated in favor of the new *note type parameter syntax: 5ad.
     Use ‘class A[T: (str, bytes)]: ...’ instead of importing ‘AnyStr’.
     See PEP 695(1) for more details.

     In Python 3.16, ‘AnyStr’ will be removed from ‘typing.__all__’, and
     deprecation warnings will be emitted at runtime when it is accessed
     or imported from ‘typing’.  ‘AnyStr’ will be removed from ‘typing’
     in Python 3.18.

 -- データ: typing.LiteralString

     Special type that includes only literal strings.

     Any string literal is compatible with ‘LiteralString’, as is
     another ‘LiteralString’.  However, an object typed as just ‘str’ is
     not.  A string created by composing ‘LiteralString’-typed objects
     is also acceptable as a ‘LiteralString’.

     例:

          def run_query(sql: LiteralString) -> None:
              ...

          def caller(arbitrary_string: str, literal_string: LiteralString) -> None:
              run_query("SELECT * FROM students")  # OK
              run_query(literal_string)  # OK
              run_query("SELECT * FROM " + literal_string)  # OK
              run_query(arbitrary_string)  # type checker error
              run_query(  # type checker error
                  f"SELECT * FROM students WHERE name = {arbitrary_string}"
              )

     ‘LiteralString’ is useful for sensitive APIs where arbitrary
     user-generated strings could generate problems.  For example, the
     two cases above that generate type checker errors could be
     vulnerable to an SQL injection attack.

     より詳しくは PEP 675(2) を参照してください。

     Added in version 3.11.

 -- データ: typing.Never
 -- データ: typing.NoReturn

     ‘Never’ and ‘NoReturn’ represent the bottom type(3), a type that
     has no members.

     They can be used to indicate that a function never returns, such as
     *note sys.exit(): 277.:

          from typing import Never  # or NoReturn

          def stop() -> Never:
              raise RuntimeError('no way')

     Or to define a function that should never be called, as there are
     no valid arguments, such as *note assert_never(): 8b6.:

          from typing import Never  # or NoReturn

          def never_call_me(arg: Never) -> None:
              pass

          def int_or_str(arg: int | str) -> None:
              never_call_me(arg)  # type checker error
              match arg:
                  case int():
                      print("It's an int")
                  case str():
                      print("It's a str")
                  case _:
                      never_call_me(arg)  # OK, arg is of type Never (or NoReturn)

     ‘Never’ and ‘NoReturn’ have the same meaning in the type system and
     static type checkers treat both equivalently.

     Added in version 3.6.2: Added *note NoReturn: 44e5.

     Added in version 3.11: Added *note Never: 8b7.

 -- データ: typing.Self

     Special type to represent the current enclosed class.

     例えば:

          from typing import Self, reveal_type

          class Foo:
              def return_self(self) -> Self:
                  ...
                  return self

          class SubclassOfFoo(Foo): pass

          reveal_type(Foo().return_self())  # Revealed type is "Foo"
          reveal_type(SubclassOfFoo().return_self())  # Revealed type is "SubclassOfFoo"

     This annotation is semantically equivalent to the following, albeit
     in a more succinct fashion:

          from typing import TypeVar

          Self = TypeVar("Self", bound="Foo")

          class Foo:
              def return_self(self: Self) -> Self:
                  ...
                  return self

     In general, if something returns ‘self’, as in the above examples,
     you should use ‘Self’ as the return annotation.  If
     ‘Foo.return_self’ was annotated as returning ‘"Foo"’, then the type
     checker would infer the object returned from
     ‘SubclassOfFoo.return_self’ as being of type ‘Foo’ rather than
     ‘SubclassOfFoo’.

     Other common use cases include:

        - *note classmethod: 48e.s that are used as alternative
          constructors and return instances of the ‘cls’ parameter.

        - Annotating an *note __enter__(): 7e4. method which returns
          self.

     You should not use ‘Self’ as the return annotation if the method is
     not guaranteed to return an instance of a subclass when the class
     is subclassed:

          class Eggs:
              # Self would be an incorrect return annotation here,
              # as the object returned is always an instance of Eggs,
              # even in subclasses
              def returns_eggs(self) -> "Eggs":
                  return Eggs()

     より詳しくは PEP 673(4) を参照してください。

     Added in version 3.11.

 -- データ: typing.TypeAlias

     Special annotation for explicitly declaring a *note type alias:
     683.

     例えば:

          from typing import TypeAlias

          Factors: TypeAlias = list[int]

     ‘TypeAlias’ is particularly useful on older Python versions for
     annotating aliases that make use of forward references, as it can
     be hard for type checkers to distinguish these from normal variable
     assignments:

          from typing import Generic, TypeAlias, TypeVar

          T = TypeVar("T")

          # "Box" does not exist yet,
          # so we have to use quotes for the forward reference on Python <3.12.
          # Using ``TypeAlias`` tells the type checker that this is a type alias declaration,
          # not a variable assignment to a string.
          BoxOfStrings: TypeAlias = "Box[str]"

          class Box(Generic[T]):
              @classmethod
              def make_box_of_strings(cls) -> BoxOfStrings: ...

     より詳しくは、 PEP 613(5) をご覧ください。

     Added in version 3.10.

     バージョン 3.12 で非推奨: *note TypeAlias: 9cc. is deprecated in
     favor of the *note type: 66d. statement, which creates instances of
     *note TypeAliasType: 2ae. and which natively supports forward
     references.  Note that while *note TypeAlias: 9cc. and *note
     TypeAliasType: 2ae. serve similar purposes and have similar names,
     they are distinct and the latter is not the type of the former.
     Removal of *note TypeAlias: 9cc. is not currently planned, but
     users are encouraged to migrate to *note type: 66d. statements.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0695/

   (2) https://peps.python.org/pep-0675/

   (3) https://en.wikipedia.org/wiki/Bottom_type

   (4) https://peps.python.org/pep-0673/

   (5) https://peps.python.org/pep-0613/


File: python.info,  Node: 特殊形式,  Next: Building generic types and type aliases,  Prev: 特殊型,  Up: 特殊型付けプリミティブ

5.26.1.15 特殊形式
..................

これらはアノテーションの型として使用できます。これらは全て ‘[]’ を使用し
た添字表記をサポートしますが、それぞれ固有の構文があります。

 -- クラス: typing.Union

     ユニオン型; ‘Union[X, Y]’ は ‘X | Y’ と等価で X または Y を表します
     。

     To define a union, use e.g.  ‘Union[int, str]’ or the shorthand
     ‘int | str’.  Using that shorthand is recommended.  Details:

        * 引数は型でなければならず、少なくとも一つ必要です。

        * ユニオン型のユニオン型は平滑化されます。例えば:

               Union[Union[int, str], float] == Union[int, str, float]

          However, this does not apply to unions referenced through a
          type alias, to avoid forcing evaluation of the underlying
          *note TypeAliasType: 2ae.:

               type A = Union[int, str]
               Union[A, float] != Union[int, str, float]

        * 引数が一つのユニオン型は消えます。例えば:

               Union[int] == int  # The constructor actually returns int

        * 冗長な実引数は飛ばされます。例えば:

               Union[int, str, int] == Union[int, str] == int | str

        * ユニオン型を比較するとき引数の順序は無視されます。例えば:

               Union[int, str] == Union[str, int]

        * ‘Union’ のサブクラスを作成したり、インスタンスを作成することは
          出来ません。

        * ‘Union[X][Y]’ と書くことは出来ません。

     バージョン 3.7 で変更: 明示的に書かれているサブクラスを、実行時に直
     和型から取り除かなくなりました。

     バージョン 3.10 で変更: ユニオン型は ‘X | Y’ のように書けるようにな
     りました。 *note union型の表現: 9c5. を参照ください。

     バージョン 3.14 で変更: *note types.UnionType: 2a7. is now an alias
     for *note Union: 2a8, and both ‘Union[int, str]’ and ‘int | str’
     create instances of the same class.  To check whether an object is
     a ‘Union’ at runtime, use ‘isinstance(obj, Union)’.  For
     compatibility with earlier versions of Python, use ‘get_origin(obj)
     is typing.Union or get_origin(obj) is types.UnionType’.

 -- データ: typing.Optional

     ‘Optional[X]’ は ‘X | None’ (や ‘Union[X, None]’) と同等です。

     これがデフォルト値を持つオプション引数とは同じ概念ではないというこ
     とに注意してください。 デフォルト値を持つオプション引数はオプション
     引数であるために、型アノテーションに ‘Optional’ 修飾子は必要ありま
     せん。 例えば次のようになります:

          def foo(arg: int = 0) -> None:
              ...

     それとは逆に、 ‘None’ という値が許されていることが明示されている場
     合は、引数がオプションであろうとなかろうと、 ‘Optional’ を使うのが
     好ましいです。 例えば次のようになります:

          def foo(arg: Optional[int] = None) -> None:
              ...

     バージョン 3.10 で変更: Optionalは ‘X | None’ のように書けるように
     なりました。 ref:‘union型の表現 <types-union>’ を参照ください。

 -- データ: typing.Concatenate

     Special form for annotating higher-order functions.

     ‘Concatenate’ can be used in conjunction with *note Callable: 26cf.
     and *note ParamSpec: 487. to annotate a higher-order callable which
     adds, removes, or transforms parameters of another callable.  Usage
     is in the form ‘Concatenate[Arg1Type, Arg2Type, ...,
     ParamSpecVariable]’.  ‘Concatenate’ is currently only valid when
     used as the first argument to a *note Callable: 26cf.  The last
     parameter to ‘Concatenate’ must be a *note ParamSpec: 487. or
     ellipsis (‘...’).

     For example, to annotate a decorator ‘with_lock’ which provides a
     *note threading.Lock: 19f4. to the decorated function,
     ‘Concatenate’ can be used to indicate that ‘with_lock’ expects a
     callable which takes in a ‘Lock’ as the first argument, and returns
     a callable with a different type signature.  In this case, the
     *note ParamSpec: 487. indicates that the returned callable's
     parameter types are dependent on the parameter types of the
     callable being passed in:

          from collections.abc import Callable
          from threading import Lock
          from typing import Concatenate

          # Use this lock to ensure that only one thread is executing a function
          # at any time.
          my_lock = Lock()

          def with_lock[**P, R](f: Callable[Concatenate[Lock, P], R]) -> Callable[P, R]:
              '''A type-safe decorator which provides a lock.'''
              def inner(*args: P.args, **kwargs: P.kwargs) -> R:
                  # Provide the lock as the first argument.
                  return f(my_lock, *args, **kwargs)
              return inner

          @with_lock
          def sum_threadsafe(lock: Lock, numbers: list[float]) -> float:
              '''Add a list of numbers together in a thread-safe manner.'''
              with lock:
                  return sum(numbers)

          # We don't need to pass in the lock ourselves thanks to the decorator.
          sum_threadsafe([1.1, 2.2, 3.3])

     Added in version 3.10.

     参考
     ....

        * PEP 612(1) - Parameter Specification Variables (the PEP which
          introduced ‘ParamSpec’ and ‘Concatenate’)

        * *note ParamSpec: 487.

        * *note 呼び出し可能オブジェクトのアノテーション: 26cf.

 -- データ: typing.Literal

     Special typing form to define "literal types".

     ‘Literal’ can be used to indicate to type checkers that the
     annotated object has a value equivalent to one of the provided
     literals.

     例えば:

          def validate_simple(data: Any) -> Literal[True]:  # always returns True
              ...

          type Mode = Literal['r', 'rb', 'w', 'wb']
          def open_helper(file: str, mode: Mode) -> str:
              ...

          open_helper('/some/path', 'r')      # Passes type check
          open_helper('/other/path', 'typo')  # Error in type checker

     ‘Literal[...]’ はサブクラスにはできません。 実行時に、任意の値が
     ‘Literal[...]’ の型引数として使えますが、型チェッカーが制約を課すこ
     とがあります。 リテラル型についてより詳しいことは PEP 586(2) を参照
     してください。

     Additional details:

        * The arguments must be literal values and there must be at
          least one.

        * Nested ‘Literal’ types are flattened, e.g.:

               assert Literal[Literal[1, 2], 3] == Literal[1, 2, 3]

          However, this does not apply to ‘Literal’ types referenced
          through a type alias, to avoid forcing evaluation of the
          underlying *note TypeAliasType: 2ae.:

               type A = Literal[1, 2]
               assert Literal[A, 3] != Literal[1, 2, 3]

        * 冗長な実引数は飛ばされます。例えば:

               assert Literal[1, 2, 1] == Literal[1, 2]

        * When comparing literals, the argument order is ignored, e.g.:

               assert Literal[1, 2] == Literal[2, 1]

        * You cannot subclass or instantiate a ‘Literal’.

        * You cannot write ‘Literal[X][Y]’.

     Added in version 3.8.

     バージョン 3.9.1 で変更: ‘Literal’ ではパラメータの重複を解消するよ
     うになりました。‘Literal’ オブジェクトの等値比較は順序に依存しない
     ようになりました。‘Literal’ オブジェクトは、等値比較する際に、パラ
     メータのうち 1 つでも *note hashable: 824. でない場合は *note
     TypeError: 198. を送出するようになりました。

 -- データ: typing.ClassVar

     クラス変数であることを示す特別な型構築子です。

     PEP 526(3) で導入された通り、 ClassVar でラップされた変数アノテーシ
     ョンによって、ある属性はクラス変数として使うつもりであり、そのクラ
     スのインスタンスから設定すべきではないということを示せます。使い方
     は次のようになります:

          class Starship:
              stats: ClassVar[dict[str, int]] = {} # class variable
              damage: int = 10                     # instance variable

     *note ClassVar: 56d. は型のみを受け入れ、それ以外は受け付けられませ
     ん。

     *note ClassVar: 56d. はクラスそのものではなく、*note isinstance():
     2ad. や *note issubclass(): 9c4. で使うべきではありません。 *note
     ClassVar: 56d. は Python の実行時の挙動を変えませんが、サードパーテ
     ィの型検査器で使えます。 例えば、型チェッカーは次のコードをエラーと
     するかもしれません:

          enterprise_d = Starship(3000)
          enterprise_d.stats = {} # Error, setting class variable on instance
          Starship.stats = {}     # This is OK

     Added in version 3.5.3.

     バージョン 3.13 で変更: *note ClassVar: 56d. can now be nested in
     *note Final: 56e. and vice versa.

 -- データ: typing.Final

     Special typing construct to indicate final names to type checkers.

     Final names cannot be reassigned in any scope.  Final names
     declared in class scopes cannot be overridden in subclasses.

     例えば:

          MAX_SIZE: Final = 9000
          MAX_SIZE += 1  # Error reported by type checker

          class Connection:
              TIMEOUT: Final[int] = 10

          class FastConnector(Connection):
              TIMEOUT = 1  # Error reported by type checker

     この機能は実行時には検査されません。詳細については PEP 591(4) を参
     照してください。

     Added in version 3.8.

     バージョン 3.13 で変更: *note Final: 56e. can now be nested in
     *note ClassVar: 56d. and vice versa.

 -- データ: typing.Required

     Special typing construct to mark a *note TypedDict: 332. key as
     required.

     This is mainly useful for ‘total=False’ TypedDicts.  See *note
     TypedDict: 332. and PEP 655(5) for more details.

     Added in version 3.11.

 -- データ: typing.NotRequired

     Special typing construct to mark a *note TypedDict: 332. key as
     potentially missing.

     より詳しくは、 *note TypedDict: 332. と PEP 655(6) を参照してくださ
     い。

     Added in version 3.11.

 -- データ: typing.ReadOnly

     A special typing construct to mark an item of a *note TypedDict:
     332. as read-only.

     例えば:

          class Movie(TypedDict):
             title: ReadOnly[str]
             year: int

          def mutate_movie(m: Movie) -> None:
             m["year"] = 1999  # allowed
             m["title"] = "The Matrix"  # typechecker error

     There is no runtime checking for this property.

     See *note TypedDict: 332. and PEP 705(7) for more details.

     Added in version 3.13.

 -- データ: typing.Annotated

     Special typing form to add context-specific metadata to an
     annotation.

     Add metadata ‘x’ to a given type ‘T’ by using the annotation
     ‘Annotated[T, x]’.  Metadata added using ‘Annotated’ can be used by
     static analysis tools or at runtime.  At runtime, the metadata is
     stored in a ‘__metadata__’ attribute.

     If a library or tool encounters an annotation ‘Annotated[T, x]’ and
     has no special logic for the metadata, it should ignore the
     metadata and simply treat the annotation as ‘T’.  As such,
     ‘Annotated’ can be useful for code that wants to use annotations
     for purposes outside Python's static typing system.

     Using ‘Annotated[T, x]’ as an annotation still allows for static
     typechecking of ‘T’, as type checkers will simply ignore the
     metadata ‘x’.  In this way, ‘Annotated’ differs from the *note
     @no_type_check: 8c3. decorator, which can also be used for adding
     annotations outside the scope of the typing system, but completely
     disables typechecking for a function or class.

     The responsibility of how to interpret the metadata lies with the
     tool or library encountering an ‘Annotated’ annotation.  A tool or
     library encountering an ‘Annotated’ type can scan through the
     metadata elements to determine if they are of interest (e.g., using
     *note isinstance(): 2ad.).

      -- Describe: Annotated[<type>, <metadata>]

     Here is an example of how you might use ‘Annotated’ to add metadata
     to type annotations if you were doing range analysis:

          @dataclass
          class ValueRange:
              lo: int
              hi: int

          T1 = Annotated[int, ValueRange(-10, 5)]
          T2 = Annotated[T1, ValueRange(-20, 3)]

     The first argument to ‘Annotated’ must be a valid type.  Multiple
     metadata elements can be supplied as ‘Annotated’ supports variadic
     arguments.  The order of the metadata elements is preserved and
     matters for equality checks:

          @dataclass
          class ctype:
               kind: str

          a1 = Annotated[int, ValueRange(3, 10), ctype("char")]
          a2 = Annotated[int, ctype("char"), ValueRange(3, 10)]

          assert a1 != a2  # Order matters

     It is up to the tool consuming the annotations to decide whether
     the client is allowed to add multiple metadata elements to one
     annotation and how to merge those annotations.

     Nested ‘Annotated’ types are flattened.  The order of the metadata
     elements starts with the innermost annotation:

          assert Annotated[Annotated[int, ValueRange(3, 10)], ctype("char")] == Annotated[
              int, ValueRange(3, 10), ctype("char")
          ]

     However, this does not apply to ‘Annotated’ types referenced
     through a type alias, to avoid forcing evaluation of the underlying
     *note TypeAliasType: 2ae.:

          type From3To10[T] = Annotated[T, ValueRange(3, 10)]
          assert Annotated[From3To10[int], ctype("char")] != Annotated[
             int, ValueRange(3, 10), ctype("char")
          ]

     Duplicated metadata elements are not removed:

          assert Annotated[int, ValueRange(3, 10)] != Annotated[
              int, ValueRange(3, 10), ValueRange(3, 10)
          ]

     ‘Annotated’ can be used with nested and generic aliases:

               @dataclass
               class MaxLen:
                   value: int

               type Vec[T] = Annotated[list[tuple[T, T]], MaxLen(10)]

               # When used in a type annotation, a type checker will treat "V" the same as
               # ``Annotated[list[tuple[int, int]], MaxLen(10)]``:
               type V = Vec[int]

     ‘Annotated’ cannot be used with an unpacked *note TypeVarTuple:
     488.:

          type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., Ann1]  # NOT valid

     where ‘T1’, ‘T2’, ...  are *note TypeVars: 486.  This is invalid as
     only one type should be passed to Annotated.

     By default, *note get_type_hints(): 8c0. strips the metadata from
     annotations.  Pass ‘include_extras=True’ to have the metadata
     preserved:

               >>> from typing import Annotated, get_type_hints
               >>> def func(x: Annotated[int, "metadata"]) -> None: pass
               ...
               >>> get_type_hints(func)
               {'x': <class 'int'>, 'return': <class 'NoneType'>}
               >>> get_type_hints(func, include_extras=True)
               {'x': typing.Annotated[int, 'metadata'], 'return': <class 'NoneType'>}

     At runtime, the metadata associated with an ‘Annotated’ type can be
     retrieved via the ‘__metadata__’ attribute:

               >>> from typing import Annotated
               >>> X = Annotated[int, "very", "important", "metadata"]
               >>> X
               typing.Annotated[int, 'very', 'important', 'metadata']
               >>> X.__metadata__
               ('very', 'important', 'metadata')

     If you want to retrieve the original type wrapped by ‘Annotated’,
     use the ‘__origin__’ attribute:

               >>> from typing import Annotated, get_origin
               >>> Password = Annotated[str, "secret"]
               >>> Password.__origin__
               <class 'str'>

     Note that using *note get_origin(): 2ab. will return ‘Annotated’
     itself:

               >>> get_origin(Password)
               typing.Annotated

     参考
     ....

     PEP 593(8) - Flexible function and variable annotations

          The PEP introducing ‘Annotated’ to the standard library.

     Added in version 3.9.

 -- データ: typing.TypeIs

     Special typing construct for marking user-defined type predicate
     functions.

     ‘TypeIs’ can be used to annotate the return type of a user-defined
     type predicate function.  ‘TypeIs’ only accepts a single type
     argument.  At runtime, functions marked this way should return a
     boolean and take at least one positional argument.

     ‘TypeIs’ aims to benefit 'type narrowing' - a technique used by
     static type checkers to determine a more precise type of an
     expression within a program's code flow.  Usually type narrowing is
     done by analyzing conditional code flow and applying the narrowing
     to a block of code.  The conditional expression here is sometimes
     referred to as a "type predicate":

          def is_str(val: str | float):
              # "isinstance" type predicate
              if isinstance(val, str):
                  # Type of ``val`` is narrowed to ``str``
                  ...
              else:
                  # Else, type of ``val`` is narrowed to ``float``.
                  ...

     Sometimes it would be convenient to use a user-defined boolean
     function as a type predicate.  Such a function should use
     ‘TypeIs[...]’ or *note TypeGuard: 48c. as its return type to alert
     static type checkers to this intention.  ‘TypeIs’ usually has more
     intuitive behavior than ‘TypeGuard’, but it cannot be used when the
     input and output types are incompatible (e.g., ‘list[object]’ to
     ‘list[int]’) or when the function does not return ‘True’ for all
     instances of the narrowed type.

     Using ‘-> TypeIs[NarrowedType]’ tells the static type checker that
     for a given function:

       1. The return value is a boolean.

       2. If the return value is ‘True’, the type of its argument is the
          intersection of the argument's original type and
          ‘NarrowedType’.

       3. If the return value is ‘False’, the type of its argument is
          narrowed to exclude ‘NarrowedType’.

     例えば:

          from typing import assert_type, final, TypeIs

          class Parent: pass
          class Child(Parent): pass
          @final
          class Unrelated: pass

          def is_parent(val: object) -> TypeIs[Parent]:
              return isinstance(val, Parent)

          def run(arg: Child | Unrelated):
              if is_parent(arg):
                  # Type of ``arg`` is narrowed to the intersection
                  # of ``Parent`` and ``Child``, which is equivalent to
                  # ``Child``.
                  assert_type(arg, Child)
              else:
                  # Type of ``arg`` is narrowed to exclude ``Parent``,
                  # so only ``Unrelated`` is left.
                  assert_type(arg, Unrelated)

     The type inside ‘TypeIs’ must be consistent with the type of the
     function's argument; if it is not, static type checkers will raise
     an error.  An incorrectly written ‘TypeIs’ function can lead to
     unsound behavior in the type system; it is the user's
     responsibility to write such functions in a type-safe manner.

     If a ‘TypeIs’ function is a class or instance method, then the type
     in ‘TypeIs’ maps to the type of the second parameter (after ‘cls’
     or ‘self’).

     In short, the form ‘def foo(arg: TypeA) -> TypeIs[TypeB]: ...’,
     means that if ‘foo(arg)’ returns ‘True’, then ‘arg’ is an instance
     of ‘TypeB’, and if it returns ‘False’, it is not an instance of
     ‘TypeB’.

     ‘TypeIs’ also works with type variables.  For more information, see
     PEP 742(9) (Narrowing types with ‘TypeIs’).

     Added in version 3.13.

 -- データ: typing.TypeGuard

     Special typing construct for marking user-defined type predicate
     functions.

     Type predicate functions are user-defined functions that return
     whether their argument is an instance of a particular type.
     ‘TypeGuard’ works similarly to *note TypeIs: 48b, but has subtly
     different effects on type checking behavior (see below).

     Using ‘-> TypeGuard’ tells the static type checker that for a given
     function:

       1. The return value is a boolean.

       2. If the return value is ‘True’, the type of its argument is the
          type inside ‘TypeGuard’.

     ‘TypeGuard’ also works with type variables.  See PEP 647(10) for
     more details.

     例えば:

          def is_str_list(val: list[object]) -> TypeGuard[list[str]]:
              '''Determines whether all objects in the list are strings'''
              return all(isinstance(x, str) for x in val)

          def func1(val: list[object]):
              if is_str_list(val):
                  # Type of ``val`` is narrowed to ``list[str]``.
                  print(" ".join(val))
              else:
                  # Type of ``val`` remains as ``list[object]``.
                  print("Not a list of strings!")

     ‘TypeIs’ and ‘TypeGuard’ differ in the following ways:

        * ‘TypeIs’ requires the narrowed type to be a subtype of the
          input type, while ‘TypeGuard’ does not.  The main reason is to
          allow for things like narrowing ‘list[object]’ to ‘list[str]’
          even though the latter is not a subtype of the former, since
          ‘list’ is invariant.

        * When a ‘TypeGuard’ function returns ‘True’, type checkers
          narrow the type of the variable to exactly the ‘TypeGuard’
          type.  When a ‘TypeIs’ function returns ‘True’, type checkers
          can infer a more precise type combining the previously known
          type of the variable with the ‘TypeIs’ type.  (Technically,
          this is known as an intersection type.)

        * When a ‘TypeGuard’ function returns ‘False’, type checkers
          cannot narrow the type of the variable at all.  When a
          ‘TypeIs’ function returns ‘False’, type checkers can narrow
          the type of the variable to exclude the ‘TypeIs’ type.

     Added in version 3.10.

 -- データ: typing.Unpack

     Typing operator to conceptually mark an object as having been
     unpacked.

     For example, using the unpack operator ‘*’ on a *note type variable
     tuple: 44e7. is equivalent to using ‘Unpack’ to mark the type
     variable tuple as having been unpacked:

          Ts = TypeVarTuple('Ts')
          tup: tuple[*Ts]
          # Effectively does:
          tup: tuple[Unpack[Ts]]

     In fact, ‘Unpack’ can be used interchangeably with ‘*’ in the
     context of *note typing.TypeVarTuple: 488. and *note
     builtins.tuple: 614. types.  You might see ‘Unpack’ being used
     explicitly in older versions of Python, where ‘*’ couldn't be used
     in certain places:

          # In older versions of Python, TypeVarTuple and Unpack
          # are located in the `typing_extensions` backports package.
          from typing_extensions import TypeVarTuple, Unpack

          Ts = TypeVarTuple('Ts')
          tup: tuple[*Ts]         # Syntax error on Python <= 3.10!
          tup: tuple[Unpack[Ts]]  # Semantically equivalent, and backwards-compatible

     ‘Unpack’ can also be used along with *note typing.TypedDict: 332.
     for typing ‘**kwargs’ in a function signature:

          from typing import TypedDict, Unpack

          class Movie(TypedDict):
              name: str
              year: int

          # This function expects two keyword arguments - `name` of type `str`
          # and `year` of type `int`.
          def foo(**kwargs: Unpack[Movie]): ...

     See PEP 692(11) for more details on using ‘Unpack’ for ‘**kwargs’
     typing.

     Added in version 3.11.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0612/

   (2) https://peps.python.org/pep-0586/

   (3) https://peps.python.org/pep-0526/

   (4) https://peps.python.org/pep-0591/

   (5) https://peps.python.org/pep-0655/

   (6) https://peps.python.org/pep-0655/

   (7) https://peps.python.org/pep-0705/

   (8) https://peps.python.org/pep-0593/

   (9) https://peps.python.org/pep-0742/

   (10) https://peps.python.org/pep-0647/

   (11) https://peps.python.org/pep-0692/


File: python.info,  Node: Building generic types and type aliases,  Next: Other special directives,  Prev: 特殊形式,  Up: 特殊型付けプリミティブ

5.26.1.16 Building generic types and type aliases
.................................................

The following classes should not be used directly as annotations.  Their
intended purpose is to be building blocks for creating generic types and
type aliases.

These objects can be created through special syntax (*note type
parameter lists: 5ad. and the *note type: 66d. statement).  For
compatibility with Python 3.11 and earlier, they can also be created
without the dedicated syntax, as documented below.

 -- クラス: typing.Generic

     ジェネリック型のための抽象基底クラスです。

     A generic type is typically declared by adding a list of type
     parameters after the class name:

          class Mapping[KT, VT]:
              def __getitem__(self, key: KT) -> VT:
                  ...
                  # Etc.

     Such a class implicitly inherits from ‘Generic’.  The runtime
     semantics of this syntax are discussed in the *note Language
     Reference: 2377.

     このクラスは次のように使用することが出来ます:

          def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:
              try:
                  return mapping[key]
              except KeyError:
                  return default

     Here the brackets after the function name indicate a *note generic
     function: 682.

     For backwards compatibility, generic classes can also be declared
     by explicitly inheriting from ‘Generic’.  In this case, the type
     parameters must be declared separately:

          KT = TypeVar('KT')
          VT = TypeVar('VT')

          class Mapping(Generic[KT, VT]):
              def __getitem__(self, key: KT) -> VT:
                  ...
                  # Etc.

 -- クラス: typing.TypeVar (name, *constraints, bound=None,
          covariant=False, contravariant=False, infer_variance=False,
          default=typing.NoDefault)

     型変数です。

     The preferred way to construct a type variable is via the dedicated
     syntax for *note generic functions: 682, *note generic classes:
     2377, and *note generic type aliases: 684.:

          class Sequence[T]:  # T is a TypeVar
              ...

     This syntax can also be used to create bounded and constrained type
     variables:

          class StrSequence[S: str]:  # S is a TypeVar with a `str` upper bound;
              ...                     # we can say that S is "bounded by `str`"


          class StrOrBytesSequence[A: (str, bytes)]:  # A is a TypeVar constrained to str or bytes
              ...

     However, if desired, reusable type variables can also be
     constructed manually, like so:

          T = TypeVar('T')  # Can be anything
          S = TypeVar('S', bound=str)  # Can be any subtype of str
          A = TypeVar('A', str, bytes)  # Must be exactly str or bytes

     Type variables exist primarily for the benefit of static type
     checkers.  They serve as the parameters for generic types as well
     as for generic function and type alias definitions.  See *note
     Generic: 17b6. for more information on generic types.  Generic
     functions work as follows:

          def repeat[T](x: T, n: int) -> Sequence[T]:
              """Return a list containing n references to x."""
              return [x]*n


          def print_capitalized[S: str](x: S) -> S:
              """Print x capitalized, and return x."""
              print(x.capitalize())
              return x


          def concatenate[A: (str, bytes)](x: A, y: A) -> A:
              """Add two strings or bytes objects together."""
              return x + y

     Note that type variables can be 'bounded', 'constrained', or
     neither, but cannot be both bounded 'and' constrained.

     The variance of type variables is inferred by type checkers when
     they are created through the *note type parameter syntax: 5ad. or
     when ‘infer_variance=True’ is passed.  Manually created type
     variables may be explicitly marked covariant or contravariant by
     passing ‘covariant=True’ or ‘contravariant=True’.  By default,
     manually created type variables are invariant.  See PEP 484(1) and
     PEP 695(2) for more details.

     Bounded type variables and constrained type variables have
     different semantics in several important ways.  Using a 'bounded'
     type variable means that the ‘TypeVar’ will be solved using the
     most specific type possible:

          x = print_capitalized('a string')
          reveal_type(x)  # revealed type is str

          class StringSubclass(str):
              pass

          y = print_capitalized(StringSubclass('another string'))
          reveal_type(y)  # revealed type is StringSubclass

          z = print_capitalized(45)  # error: int is not a subtype of str

     The upper bound of a type variable can be a concrete type, abstract
     type (ABC or Protocol), or even a union of types:

          # Can be anything with an __abs__ method
          def print_abs[T: SupportsAbs](arg: T) -> None:
              print("Absolute value:", abs(arg))

          U = TypeVar('U', bound=str|bytes)  # Can be any subtype of the union str|bytes
          V = TypeVar('V', bound=SupportsAbs)  # Can be anything with an __abs__ method
     Using a 'constrained' type variable, however, means that the
     ‘TypeVar’ can only ever be solved as being exactly one of the
     constraints given:

          a = concatenate('one', 'two')
          reveal_type(a)  # revealed type is str

          b = concatenate(StringSubclass('one'), StringSubclass('two'))
          reveal_type(b)  # revealed type is str, despite StringSubclass being passed in

          c = concatenate('one', b'two')  # error: type variable 'A' can be either str or bytes in a function call, but not both

     At runtime, ‘isinstance(x, T)’ will raise *note TypeError: 198.

      -- の属性: __name__

          The name of the type variable.

      -- の属性: __covariant__

          Whether the type var has been explicitly marked as covariant.

      -- の属性: __contravariant__

          Whether the type var has been explicitly marked as
          contravariant.

      -- の属性: __infer_variance__

          Whether the type variable's variance should be inferred by
          type checkers.

          Added in version 3.12.

      -- の属性: __bound__

          The upper bound of the type variable, if any.

          バージョン 3.12 で変更: For type variables created through
          *note type parameter syntax: 5ad, the bound is evaluated only
          when the attribute is accessed, not when the type variable is
          created (see *note Lazy evaluation: 685.).

      -- メソッド: evaluate_bound ()

          An *note evaluate function: 44ef. corresponding to the *note
          __bound__: 44ed. attribute.  When called directly, this method
          supports only the *note VALUE: 15e. format, which is
          equivalent to accessing the *note __bound__: 44ed. attribute
          directly, but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 44f0. to evaluate the
          value in a different format.

          Added in version 3.14.

      -- の属性: __constraints__

          A tuple containing the constraints of the type variable, if
          any.

          バージョン 3.12 で変更: For type variables created through
          *note type parameter syntax: 5ad, the constraints are
          evaluated only when the attribute is accessed, not when the
          type variable is created (see *note Lazy evaluation: 685.).

      -- メソッド: evaluate_constraints ()

          An *note evaluate function: 44ef. corresponding to the *note
          __constraints__: 44f1. attribute.  When called directly, this
          method supports only the *note VALUE: 15e. format, which is
          equivalent to accessing the *note __constraints__: 44f1.
          attribute directly, but the method object can be passed to
          *note annotationlib.call_evaluate_function(): 44f0. to
          evaluate the value in a different format.

          Added in version 3.14.

      -- の属性: __default__

          The default value of the type variable, or *note
          typing.NoDefault: 569. if it has no default.

          Added in version 3.13.

      -- メソッド: evaluate_default ()

          An *note evaluate function: 44ef. corresponding to the *note
          __default__: 44f3. attribute.  When called directly, this
          method supports only the *note VALUE: 15e. format, which is
          equivalent to accessing the *note __default__: 44f3. attribute
          directly, but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 44f0. to evaluate the
          value in a different format.

          Added in version 3.14.

      -- メソッド: has_default ()

          Return whether or not the type variable has a default value.
          This is equivalent to checking whether *note __default__:
          44f3. is not the *note typing.NoDefault: 569. singleton,
          except that it does not force evaluation of the *note lazily
          evaluated: 685. default value.

          Added in version 3.13.

     バージョン 3.12 で変更: Type variables can now be declared using
     the *note type parameter: 5ad. syntax introduced by PEP 695(3).
     The ‘infer_variance’ parameter was added.

     バージョン 3.13 で変更: Support for default values was added.

 -- クラス: typing.TypeVarTuple (name, *, default=typing.NoDefault)

     Type variable tuple.  A specialized form of *note type variable:
     44de. that enables 'variadic' generics.

     Type variable tuples can be declared in *note type parameter lists:
     5ad. using a single asterisk (‘*’) before the name:

          def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, T]:
              return (*tup[1:], tup[0])

     Or by explicitly invoking the ‘TypeVarTuple’ constructor:

          T = TypeVar("T")
          Ts = TypeVarTuple("Ts")

          def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:
              return (*tup[1:], tup[0])

     A normal type variable enables parameterization with a single type.
     A type variable tuple, in contrast, allows parameterization with an
     'arbitrary' number of types by acting like an 'arbitrary' number of
     type variables wrapped in a tuple.  For example:

          # T is bound to int, Ts is bound to ()
          # Return value is (1,), which has type tuple[int]
          move_first_element_to_last(tup=(1,))

          # T is bound to int, Ts is bound to (str,)
          # Return value is ('spam', 1), which has type tuple[str, int]
          move_first_element_to_last(tup=(1, 'spam'))

          # T is bound to int, Ts is bound to (str, float)
          # Return value is ('spam', 3.0, 1), which has type tuple[str, float, int]
          move_first_element_to_last(tup=(1, 'spam', 3.0))

          # This fails to type check (and fails at runtime)
          # because tuple[()] is not compatible with tuple[T, *Ts]
          # (at least one element is required)
          move_first_element_to_last(tup=())

     Note the use of the unpacking operator ‘*’ in ‘tuple[T, *Ts]’.
     Conceptually, you can think of ‘Ts’ as a tuple of type variables
     ‘(T1, T2, ...)’.  ‘tuple[T, *Ts]’ would then become ‘tuple[T, *(T1,
     T2, ...)]’, which is equivalent to ‘tuple[T, T1, T2, ...]’.  (Note
     that in older versions of Python, you might see this written using
     *note Unpack: 19a6. instead, as ‘Unpack[Ts]’.)

     Type variable tuples must 'always' be unpacked.  This helps
     distinguish type variable tuples from normal type variables:

          x: Ts          # Not valid
          x: tuple[Ts]   # Not valid
          x: tuple[*Ts]  # The correct way to do it

     Type variable tuples can be used in the same contexts as normal
     type variables.  For example, in class definitions, arguments, and
     return types:

          class Array[*Shape]:
              def __getitem__(self, key: tuple[*Shape]) -> float: ...
              def __abs__(self) -> "Array[*Shape]": ...
              def get_shape(self) -> tuple[*Shape]: ...

     Type variable tuples can be happily combined with normal type
     variables:

          class Array[DType, *Shape]:  # This is fine
              pass

          class Array2[*Shape, DType]:  # This would also be fine
              pass

          class Height: ...
          class Width: ...

          float_array_1d: Array[float, Height] = Array()     # Totally fine
          int_array_2d: Array[int, Height, Width] = Array()  # Yup, fine too

     However, note that at most one type variable tuple may appear in a
     single list of type arguments or type parameters:

          x: tuple[*Ts, *Ts]            # Not valid
          class Array[*Shape, *Shape]:  # Not valid
              pass

     Finally, an unpacked type variable tuple can be used as the type
     annotation of ‘*args’:

          def call_soon[*Ts](
              callback: Callable[[*Ts], None],
              *args: *Ts
          ) -> None:
              ...
              callback(*args)

     In contrast to non-unpacked annotations of ‘*args’ - e.g.  ‘*args:
     int’, which would specify that 'all' arguments are ‘int’ - ‘*args:
     *Ts’ enables reference to the types of the 'individual' arguments
     in ‘*args’.  Here, this allows us to ensure the types of the
     ‘*args’ passed to ‘call_soon’ match the types of the (positional)
     arguments of ‘callback’.

     See PEP 646(4) for more details on type variable tuples.

      -- の属性: __name__

          The name of the type variable tuple.

      -- の属性: __default__

          The default value of the type variable tuple, or *note
          typing.NoDefault: 569. if it has no default.

          Added in version 3.13.

      -- メソッド: evaluate_default ()

          An *note evaluate function: 44ef. corresponding to the *note
          __default__: 44f7. attribute.  When called directly, this
          method supports only the *note VALUE: 15e. format, which is
          equivalent to accessing the *note __default__: 44f7. attribute
          directly, but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 44f0. to evaluate the
          value in a different format.

          Added in version 3.14.

      -- メソッド: has_default ()

          Return whether or not the type variable tuple has a default
          value.  This is equivalent to checking whether *note
          __default__: 44f7. is not the *note typing.NoDefault: 569.
          singleton, except that it does not force evaluation of the
          *note lazily evaluated: 685. default value.

          Added in version 3.13.

     Added in version 3.11.

     バージョン 3.12 で変更: Type variable tuples can now be declared
     using the *note type parameter: 5ad. syntax introduced by PEP
     695(5).

     バージョン 3.13 で変更: Support for default values was added.

 -- クラス: typing.ParamSpec (name, *, bound=None, covariant=False,
          contravariant=False, default=typing.NoDefault)

     Parameter specification variable.  A specialized version of *note
     type variables: 44de.

     In *note type parameter lists: 5ad, parameter specifications can be
     declared with two asterisks (‘**’):

          type IntFunc[**P] = Callable[P, int]

     For compatibility with Python 3.11 and earlier, ‘ParamSpec’ objects
     can also be created as follows:

          P = ParamSpec('P')

     Parameter specification variables exist primarily for the benefit
     of static type checkers.  They are used to forward the parameter
     types of one callable to another callable - a pattern commonly
     found in higher order functions and decorators.  They are only
     valid when used in ‘Concatenate’, or as the first argument to
     ‘Callable’, or as parameters for user-defined Generics.  See *note
     Generic: 17b6. for more information on generic types.

     For example, to add basic logging to a function, one can create a
     decorator ‘add_logging’ to log function calls.  The parameter
     specification variable tells the type checker that the callable
     passed into the decorator and the new callable returned by it have
     inter-dependent type parameters:

          from collections.abc import Callable
          import logging

          def add_logging[T, **P](f: Callable[P, T]) -> Callable[P, T]:
              '''A type-safe decorator to add logging to a function.'''
              def inner(*args: P.args, **kwargs: P.kwargs) -> T:
                  logging.info(f'{f.__name__} was called')
                  return f(*args, **kwargs)
              return inner

          @add_logging
          def add_two(x: float, y: float) -> float:
              '''Add two numbers together.'''
              return x + y

     Without ‘ParamSpec’, the simplest way to annotate this previously
     was to use a *note TypeVar: 486. with upper bound ‘Callable[...,
     Any]’.  However this causes two problems:

       1. The type checker can't type check the ‘inner’ function because
          ‘*args’ and ‘**kwargs’ have to be typed *note Any: 8bb.

       2. *note cast(): 44fa. may be required in the body of the
          ‘add_logging’ decorator when returning the ‘inner’ function,
          or the static type checker must be told to ignore the ‘return
          inner’.

      -- の属性: args

      -- の属性: kwargs

          Since ‘ParamSpec’ captures both positional and keyword
          parameters, ‘P.args’ and ‘P.kwargs’ can be used to split a
          ‘ParamSpec’ into its components.  ‘P.args’ represents the
          tuple of positional parameters in a given call and should only
          be used to annotate ‘*args’.  ‘P.kwargs’ represents the
          mapping of keyword parameters to their values in a given call,
          and should be only be used to annotate ‘**kwargs’.  Both
          attributes require the annotated parameter to be in scope.  At
          runtime, ‘P.args’ and ‘P.kwargs’ are instances respectively of
          *note ParamSpecArgs: 9c9. and *note ParamSpecKwargs: 9ca.

      -- の属性: __name__

          The name of the parameter specification.

      -- の属性: __default__

          The default value of the parameter specification, or *note
          typing.NoDefault: 569. if it has no default.

          Added in version 3.13.

      -- メソッド: evaluate_default ()

          An *note evaluate function: 44ef. corresponding to the *note
          __default__: 44fe. attribute.  When called directly, this
          method supports only the *note VALUE: 15e. format, which is
          equivalent to accessing the *note __default__: 44fe. attribute
          directly, but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 44f0. to evaluate the
          value in a different format.

          Added in version 3.14.

      -- メソッド: has_default ()

          Return whether or not the parameter specification has a
          default value.  This is equivalent to checking whether *note
          __default__: 44fe. is not the *note typing.NoDefault: 569.
          singleton, except that it does not force evaluation of the
          *note lazily evaluated: 685. default value.

          Added in version 3.13.

     Parameter specification variables created with ‘covariant=True’ or
     ‘contravariant=True’ can be used to declare covariant or
     contravariant generic types.  The ‘bound’ argument is also
     accepted, similar to *note TypeVar: 486.  However the actual
     semantics of these keywords are yet to be decided.

     Added in version 3.10.

     バージョン 3.12 で変更: Parameter specifications can now be
     declared using the *note type parameter: 5ad. syntax introduced by
     PEP 695(6).

     バージョン 3.13 で変更: Support for default values was added.

          注釈: Only parameter specification variables defined in global
          scope can be pickled.

     参考
     ....

        * PEP 612(7) - Parameter Specification Variables (the PEP which
          introduced ‘ParamSpec’ and ‘Concatenate’)

        * *note Concatenate: 9c7.

        * *note 呼び出し可能オブジェクトのアノテーション: 26cf.

 -- データ: typing.ParamSpecArgs
 -- データ: typing.ParamSpecKwargs

     Arguments and keyword arguments attributes of a *note ParamSpec:
     487.  The ‘P.args’ attribute of a ‘ParamSpec’ is an instance of
     ‘ParamSpecArgs’, and ‘P.kwargs’ is an instance of
     ‘ParamSpecKwargs’.  They are intended for runtime introspection and
     have no special meaning to static type checkers.

     Calling *note get_origin(): 2ab. on either of these objects will
     return the original ‘ParamSpec’:

          >>> from typing import ParamSpec, get_origin
          >>> P = ParamSpec("P")
          >>> get_origin(P.args) is P
          True
          >>> get_origin(P.kwargs) is P
          True

     Added in version 3.10.

 -- クラス: typing.TypeAliasType (name, value, *, type_params=())

     The type of type aliases created through the *note type: 66d.
     statement.

     例:

          >>> type Alias = int
          >>> type(Alias)
          <class 'typing.TypeAliasType'>

     Added in version 3.12.

      -- の属性: __name__

          The name of the type alias:

               >>> type Alias = int
               >>> Alias.__name__
               'Alias'

      -- の属性: __module__

          The name of the module in which the type alias was defined:

               >>> type Alias = int
               >>> Alias.__module__
               '__main__'

      -- の属性: __type_params__

          The type parameters of the type alias, or an empty tuple if
          the alias is not generic:

               >>> type ListOrSet[T] = list[T] | set[T]
               >>> ListOrSet.__type_params__
               (T,)
               >>> type NotGeneric = int
               >>> NotGeneric.__type_params__
               ()

      -- の属性: __value__

          The type alias's value.  This is *note lazily evaluated: 685,
          so names used in the definition of the alias are not resolved
          until the ‘__value__’ attribute is accessed:

               >>> type Mutually = Recursive
               >>> type Recursive = Mutually
               >>> Mutually
               Mutually
               >>> Recursive
               Recursive
               >>> Mutually.__value__
               Recursive
               >>> Recursive.__value__
               Mutually

      -- メソッド: evaluate_value ()

          An *note evaluate function: 44ef. corresponding to the *note
          __value__: 4504. attribute.  When called directly, this method
          supports only the *note VALUE: 15e. format, which is
          equivalent to accessing the *note __value__: 4504. attribute
          directly, but the method object can be passed to *note
          annotationlib.call_evaluate_function(): 44f0. to evaluate the
          value in a different format:

               >>> type Alias = undefined
               >>> Alias.__value__
               Traceback (most recent call last):
               ...
               NameError: name 'undefined' is not defined
               >>> from annotationlib import Format, call_evaluate_function
               >>> Alias.evaluate_value(Format.VALUE)
               Traceback (most recent call last):
               ...
               NameError: name 'undefined' is not defined
               >>> call_evaluate_function(Alias.evaluate_value, Format.FORWARDREF)
               ForwardRef('undefined')

          Added in version 3.14.

     展開
     ....

     Type aliases support star unpacking using the ‘*Alias’ syntax.
     This is equivalent to using ‘Unpack[Alias]’ directly:

          >>> type Alias = tuple[int, str]
          >>> type Unpacked = tuple[bool, *Alias]
          >>> Unpacked.__value__
          tuple[bool, typing.Unpack[Alias]]

     Added in version 3.14.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/

   (2) https://peps.python.org/pep-0695/

   (3) https://peps.python.org/pep-0695/

   (4) https://peps.python.org/pep-0646/

   (5) https://peps.python.org/pep-0695/

   (6) https://peps.python.org/pep-0695/

   (7) https://peps.python.org/pep-0612/


File: python.info,  Node: Other special directives,  Prev: Building generic types and type aliases,  Up: 特殊型付けプリミティブ

5.26.1.17 Other special directives
..................................

These functions and classes should not be used directly as annotations.
Their intended purpose is to be building blocks for creating and
declaring types.

 -- クラス: typing.NamedTuple

     *note collections.namedtuple(): 4e0. の型付き版です。

     使い方:

          class Employee(NamedTuple):
              name: str
              id: int

     これは次と等価です:

          Employee = collections.namedtuple('Employee', ['name', 'id'])

     フィールドにデフォルト値を与えるにはクラス本体で代入してください:

          class Employee(NamedTuple):
              name: str
              id: int = 3

          employee = Employee('Guido')
          assert employee.id == 3

     デフォルト値のあるフィールドはデフォルト値のないフィールドの後でな
     ければなりません。

     最終的に出来上がるクラスには、フィールド名をフィールド型へ対応付け
     る辞書を提供する ‘__annotations__’ 属性が追加されています。 (フィー
     ルド名は ‘_fields’ 属性に、デフォルト値は ‘_field_defaults’ 属性に
     格納されていて、両方とも *note namedtuple(): 4e0. API の一部分です
     。)

     ‘NamedTuple’ のサブクラスは docstring やメソッドも持てます:

          class Employee(NamedTuple):
              """Represents an employee."""
              name: str
              id: int = 3

              def __repr__(self) -> str:
                  return f'<Employee {self.name}, id={self.id}>'

     ‘NamedTuple’ subclasses can be generic:

          class Group[T](NamedTuple):
              key: T
              group: list[T]

     後方互換な使用法:

          # For creating a generic NamedTuple on Python 3.11
          T = TypeVar("T")

          class Group(NamedTuple, Generic[T]):
              key: T
              group: list[T]

          # A functional syntax is also supported
          Employee = NamedTuple('Employee', [('name', str), ('id', int)])

     バージョン 3.6 で変更: PEP 526(1) 変数アノテーションのシンタックス
     が追加されました。

     バージョン 3.6.1 で変更: デフォルト値、メソッド、ドキュメンテーショ
     ン文字列への対応が追加されました。

     バージョン 3.8 で変更: ‘_field_types’ 属性および ‘__annotations__’
     属性は ‘OrderedDict’ インスタンスではなく普通の辞書になりました。

     バージョン 3.9 で変更: ‘_field_types’ 属性は削除されました。代わり
     に同じ情報を持つより標準的な ‘__annotations__’ 属性を使ってください
     。

     バージョン 3.9 で変更: ‘NamedTuple’ is now a function rather than a
     class.  It can still be used as a class base, as described above.

     バージョン 3.11 で変更: Added support for generic namedtuples.

     バージョン 3.14 で変更: Using *note super(): 1a6. (and the
     ‘__class__’ *note closure variable: 1893.) in methods of
     ‘NamedTuple’ subclasses is unsupported and causes a *note
     TypeError: 198.

     Deprecated since version 3.13, will be removed in version 3.15: The
     undocumented keyword argument syntax for creating NamedTuple
     classes (‘NT = NamedTuple("NT", x=int)’) is deprecated, and will be
     disallowed in 3.15.  Use the class-based syntax or the functional
     syntax instead.

     Deprecated since version 3.13, will be removed in version 3.15:
     When using the functional syntax to create a NamedTuple class,
     failing to pass a value to the 'fields' parameter (‘NT =
     NamedTuple("NT")’) is deprecated.  Passing ‘None’ to the 'fields'
     parameter (‘NT = NamedTuple("NT", None)’) is also deprecated.  Both
     will be disallowed in Python 3.15.  To create a NamedTuple class
     with 0 fields, use ‘class NT(NamedTuple): pass’ or ‘NT =
     NamedTuple("NT", [])’.

 -- クラス: typing.NewType (name, tp)

     Helper class to create low-overhead *note distinct types: 44d3.

     A ‘NewType’ is considered a distinct type by a typechecker.  At
     runtime, however, calling a ‘NewType’ returns its argument
     unchanged.

     使い方:

          UserId = NewType('UserId', int)  # Declare the NewType "UserId"
          first_user = UserId(1)  # "UserId" returns the argument unchanged at runtime

      -- の属性: __module__

          The name of the module in which the new type is defined.

      -- の属性: __name__

          The name of the new type.

      -- の属性: __supertype__

          The type that the new type is based on.

     Added in version 3.5.2.

     バージョン 3.10 で変更: ‘NewType’ is now a class rather than a
     function.

 -- クラス: typing.Protocol (Generic)

     Base class for protocol classes.

     Protocol classes are defined like this:

          class Proto(Protocol):
              def meth(self) -> int:
                  ...

     このようなクラスは主に構造的部分型 (静的ダックタイピング) を認識す
     る静的型チェッカーが使います。例えば:

          class C:
              def meth(self) -> int:
                  return 0

          def func(x: Proto) -> int:
              return x.meth()

          func(C())  # Passes static type check

     See PEP 544(2) for more details.  Protocol classes decorated with
     *note runtime_checkable(): 675. (described later) act as
     simple-minded runtime protocols that check only the presence of
     given attributes, ignoring their type signatures.  Protocol classes
     without this decorator cannot be used as the second argument to
     *note isinstance(): 2ad. or *note issubclass(): 9c4.

     プロトコルクラスはジェネリックにもできます。例えば:

          class GenProto[T](Protocol):
              def meth(self) -> T:
                  ...

     In code that needs to be compatible with Python 3.11 or older,
     generic Protocols can be written as follows:

          T = TypeVar("T")

          class GenProto(Protocol[T]):
              def meth(self) -> T:
                  ...

     Added in version 3.8.

 -- の関数: @typing.runtime_checkable

     Mark a protocol class as a runtime protocol.

     Such a protocol can be used with *note isinstance(): 2ad. and *note
     issubclass(): 9c4.  This allows a simple-minded structural check,
     very similar to "one trick ponies" in *note collections.abc: 1f.
     such as *note Iterable: 26ae.  For example:

          @runtime_checkable
          class Closable(Protocol):
              def close(self): ...

          assert isinstance(open('/some/file'), Closable)

          @runtime_checkable
          class Named(Protocol):
              name: str

          import threading
          assert isinstance(threading.Thread(name='Bob'), Named)

     This decorator raises *note TypeError: 198. when applied to a
     non-protocol class.

          注釈: ‘runtime_checkable()’ will check only the presence of
          the required methods or attributes, not their type signatures
          or types.  For example, *note ssl.SSLObject: d7a. is a class,
          therefore it passes an *note issubclass(): 9c4. check against
          *note Callable: 26cf.  However, the ‘ssl.SSLObject.__init__’
          method exists only to raise a *note TypeError: 198. with a
          more informative message, therefore making it impossible to
          call (instantiate) *note ssl.SSLObject: d7a.

          注釈: An *note isinstance(): 2ad. check against a
          runtime-checkable protocol can be surprisingly slow compared
          to an ‘isinstance()’ check against a non-protocol class.
          Consider using alternative idioms such as *note hasattr():
          6f9. calls for structural checks in performance-sensitive
          code.

     Added in version 3.8.

     バージョン 3.12 で変更: The internal implementation of *note
     isinstance(): 2ad. checks against runtime-checkable protocols now
     uses *note inspect.getattr_static(): 6bc. to look up attributes
     (previously, *note hasattr(): 6f9. was used).  As a result, some
     objects which used to be considered instances of a
     runtime-checkable protocol may no longer be considered instances of
     that protocol on Python 3.12+, and vice versa.  Most users are
     unlikely to be affected by this change.

     バージョン 3.12 で変更: The members of a runtime-checkable protocol
     are now considered "frozen" at runtime as soon as the class has
     been created.  Monkey-patching attributes onto a runtime-checkable
     protocol will still work, but will have no impact on *note
     isinstance(): 2ad. checks comparing objects to the protocol.  See
     *note What's new in Python 3.12: 6f8. for more details.

 -- クラス: typing.TypedDict (dict)

     Special construct to add type hints to a dictionary.  At runtime
     "‘TypedDict’ instances" are simply *note dicts: 183.

     ‘TypedDict’ は、その全てのインスタンスにおいてキーの集合が固定され
     ていて、各キーに対応する値が全てのインスタンスで同じ型を持つことが
     期待される辞書型を宣言します。 この期待は実行時にはチェックされず、
     型チェッカーでのみ強制されます。 使用方法は次の通りです:

          class Point2D(TypedDict):
              x: int
              y: int
              label: str

          a: Point2D = {'x': 1, 'y': 2, 'label': 'good'}  # OK
          b: Point2D = {'z': 3, 'label': 'bad'}           # Fails type check

          assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')

     An alternative way to create a ‘TypedDict’ is by using
     function-call syntax.  The second argument must be a literal *note
     dict: 183.:

          Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})

     This functional syntax allows defining keys which are not valid
     *note identifiers: 22a0, for example because they are keywords or
     contain hyphens, or when key names must not be *note mangled: 20a3.
     like regular private names:

          # raises SyntaxError
          class Point2D(TypedDict):
              in: int  # 'in' is a keyword
              x-y: int  # name with hyphens

          class Definition(TypedDict):
              __schema: str  # mangled to `_Definition__schema`

          # OK, functional syntax
          Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})
          Definition = TypedDict('Definition', {'__schema': str})  # not mangled

     By default, all keys must be present in a ‘TypedDict’.  It is
     possible to mark individual keys as non-required using *note
     NotRequired: 7e1.:

          class Point2D(TypedDict):
              x: int
              y: int
              label: NotRequired[str]

          # Alternative syntax
          Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': NotRequired[str]})

     This means that a ‘Point2D’ ‘TypedDict’ can have the ‘label’ key
     omitted.

     It is also possible to mark all keys as non-required by default by
     specifying a totality of ‘False’:

          class Point2D(TypedDict, total=False):
              x: int
              y: int

          # Alternative syntax
          Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)

     This means that a ‘Point2D’ ‘TypedDict’ can have any of the keys
     omitted.  A type checker is only expected to support a literal
     ‘False’ or ‘True’ as the value of the ‘total’ argument.  ‘True’ is
     the default, and makes all items defined in the class body
     required.

     Individual keys of a ‘total=False’ ‘TypedDict’ can be marked as
     required using *note Required: 7e0.:

          class Point2D(TypedDict, total=False):
              x: Required[int]
              y: Required[int]
              label: str

          # Alternative syntax
          Point2D = TypedDict('Point2D', {
              'x': Required[int],
              'y': Required[int],
              'label': str
          }, total=False)

     It is possible for a ‘TypedDict’ type to inherit from one or more
     other ‘TypedDict’ types using the class-based syntax.  Usage:

          class Point3D(Point2D):
              z: int

     ‘Point3D’ has three items: ‘x’, ‘y’ and ‘z’.  It is equivalent to
     this definition:

          class Point3D(TypedDict):
              x: int
              y: int
              z: int

     A ‘TypedDict’ cannot inherit from a non-‘TypedDict’ class, except
     for *note Generic: 17b6.  For example:

          class X(TypedDict):
              x: int

          class Y(TypedDict):
              y: int

          class Z(object): pass  # A non-TypedDict class

          class XY(X, Y): pass  # OK

          class XZ(X, Z): pass  # raises TypeError

     A ‘TypedDict’ can be generic:

          class Group[T](TypedDict):
              key: T
              group: list[T]

     To create a generic ‘TypedDict’ that is compatible with Python 3.11
     or lower, inherit from *note Generic: 17b6. explicitly:

          T = TypeVar("T")

          class Group(TypedDict, Generic[T]):
              key: T
              group: list[T]

     A ‘TypedDict’ can be introspected via annotations dicts (see *note
     Annotations Best Practices: 9d9. for more information on
     annotations best practices), *note __total__: 450a, *note
     __required_keys__: 450b, and *note __optional_keys__: 450c.

      -- の属性: __total__

          ‘Point2D.__total__’ gives the value of the ‘total’ argument.
          Example:

               >>> from typing import TypedDict
               >>> class Point2D(TypedDict): pass
               >>> Point2D.__total__
               True
               >>> class Point2D(TypedDict, total=False): pass
               >>> Point2D.__total__
               False
               >>> class Point3D(Point2D): pass
               >>> Point3D.__total__
               True

          This attribute reflects 'only' the value of the ‘total’
          argument to the current ‘TypedDict’ class, not whether the
          class is semantically total.  For example, a ‘TypedDict’ with
          ‘__total__’ set to ‘True’ may have keys marked with *note
          NotRequired: 7e1, or it may inherit from another ‘TypedDict’
          with ‘total=False’.  Therefore, it is generally better to use
          *note __required_keys__: 450b. and *note __optional_keys__:
          450c. for introspection.

      -- の属性: __required_keys__

          Added in version 3.9.

      -- の属性: __optional_keys__

          ‘Point2D.__required_keys__’ and ‘Point2D.__optional_keys__’
          return *note frozenset: 7f2. objects containing required and
          non-required keys, respectively.

          Keys marked with *note Required: 7e0. will always appear in
          ‘__required_keys__’ and keys marked with *note NotRequired:
          7e1. will always appear in ‘__optional_keys__’.

          For backwards compatibility with Python 3.10 and below, it is
          also possible to use inheritance to declare both required and
          non-required keys in the same ‘TypedDict’ .  This is done by
          declaring a ‘TypedDict’ with one value for the ‘total’
          argument and then inheriting from it in another ‘TypedDict’
          with a different value for ‘total’:

               >>> class Point2D(TypedDict, total=False):
               ...     x: int
               ...     y: int
               ...
               >>> class Point3D(Point2D):
               ...     z: int
               ...
               >>> Point3D.__required_keys__ == frozenset({'z'})
               True
               >>> Point3D.__optional_keys__ == frozenset({'x', 'y'})
               True

          Added in version 3.9.

               注釈: If ‘from __future__ import annotations’ is used or
               if annotations are given as strings, annotations are not
               evaluated when the ‘TypedDict’ is defined.  Therefore,
               the runtime introspection that ‘__required_keys__’ and
               ‘__optional_keys__’ rely on may not work properly, and
               the values of the attributes may be incorrect.

     Support for *note ReadOnly: 48a. is reflected in the following
     attributes:

      -- の属性: __readonly_keys__

          A *note frozenset: 7f2. containing the names of all read-only
          keys.  Keys are read-only if they carry the *note ReadOnly:
          48a. qualifier.

          Added in version 3.13.

      -- の属性: __mutable_keys__

          A *note frozenset: 7f2. containing the names of all mutable
          keys.  Keys are mutable if they do not carry the *note
          ReadOnly: 48a. qualifier.

          Added in version 3.13.

     See the TypedDict(3) section in the typing documentation for more
     examples and detailed rules.

     Added in version 3.8.

     バージョン 3.9 で変更: ‘TypedDict’ is now a function rather than a
     class.  It can still be used as a class base, as described above.

     バージョン 3.11 で変更: Added support for marking individual keys
     as *note Required: 7e0. or *note NotRequired: 7e1.  See PEP 655(4).

     バージョン 3.11 で変更: Added support for generic ‘TypedDict’s.

     バージョン 3.13 で変更: Removed support for the keyword-argument
     method of creating ‘TypedDict’s.

     バージョン 3.13 で変更: Support for the *note ReadOnly: 48a.
     qualifier was added.

     Deprecated since version 3.13, will be removed in version 3.15:
     When using the functional syntax to create a TypedDict class,
     failing to pass a value to the 'fields' parameter (‘TD =
     TypedDict("TD")’) is deprecated.  Passing ‘None’ to the 'fields'
     parameter (‘TD = TypedDict("TD", None)’) is also deprecated.  Both
     will be disallowed in Python 3.15.  To create a TypedDict class
     with 0 fields, use ‘class TD(TypedDict): pass’ or ‘TD =
     TypedDict("TD", {})’.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0526/

   (2) https://peps.python.org/pep-0544/

   (3) https://typing.python.org/en/latest/spec/typeddict.html#typeddict

   (4) https://peps.python.org/pep-0655/


File: python.info,  Node: プロトコル<4>,  Next: ABCs and Protocols for working with I/O,  Prev: 特殊型付けプリミティブ,  Up: モジュールの内容<3>

5.26.1.18 プロトコル
....................

The following protocols are provided by the ‘typing’ module.  All are
decorated with *note @runtime_checkable: 675.

 -- クラス: typing.SupportsAbs

     返り値の型と共変な抽象メソッド ‘__abs__’ を備えた ABC です。

 -- クラス: typing.SupportsBytes

     抽象メソッド ‘__bytes__’ を備えた ABC です。

 -- クラス: typing.SupportsComplex

     抽象メソッド ‘__complex__’ を備えた ABC です。

 -- クラス: typing.SupportsFloat

     抽象メソッド ‘__float__’ を備えた ABC です。

 -- クラス: typing.SupportsIndex

     抽象メソッド ‘__index__’ を備えた ABC です。

     Added in version 3.8.

 -- クラス: typing.SupportsInt

     抽象メソッド ‘__int__’ を備えた ABC です。

 -- クラス: typing.SupportsRound

     返り値の型と共変な抽象メソッド ‘__round__’ を備えた ABC です。


File: python.info,  Node: ABCs and Protocols for working with I/O,  Next: Functions and decorators,  Prev: プロトコル<4>,  Up: モジュールの内容<3>

5.26.1.19 ABCs and Protocols for working with I/O
.................................................

 -- クラス: typing.IO [AnyStr]
 -- クラス: typing.TextIO
 -- クラス: typing.BinaryIO

     Generic class ‘IO[AnyStr]’ and its subclasses ‘TextIO(IO[str])’ and
     ‘BinaryIO(IO[bytes])’ represent the types of I/O streams such as
     returned by *note open(): 316.  Please note that these classes are
     not protocols, and their interface is fairly broad.

The protocols *note io.Reader: 236. and *note io.Writer: 237. offer a
simpler alternative for argument types, when only the ‘read()’ or
‘write()’ methods are accessed, respectively:

     def read_and_write(reader: Reader[str], writer: Writer[bytes]):
         data = reader.read()
         writer.write(data.encode())

Also consider using *note collections.abc.Iterable: 26ae. for iterating
over the lines of an input stream:

     def read_config(stream: Iterable[str]):
         for line in stream:
             ...


File: python.info,  Node: Functions and decorators,  Next: Introspection helpers,  Prev: ABCs and Protocols for working with I/O,  Up: モジュールの内容<3>

5.26.1.20 Functions and decorators
..................................

 -- の関数: typing.cast (typ, val)

     値をある型にキャストします。

     この関数は値を変更せずに返します。 型検査器に対して、返り値が指定さ
     れた型を持っていることを通知しますが、実行時には意図的に何も検査し
     ません。 (その理由は、処理をできる限り速くしたかったためです。)

 -- の関数: typing.assert_type (val, typ, /)

     Ask a static type checker to confirm that 'val' has an inferred
     type of 'typ'.

     At runtime this does nothing: it returns the first argument
     unchanged with no checks or side effects, no matter the actual type
     of the argument.

     When a static type checker encounters a call to ‘assert_type()’, it
     emits an error if the value is not of the specified type:

          def greet(name: str) -> None:
              assert_type(name, str)  # OK, inferred type of `name` is `str`
              assert_type(name, int)  # type checker error

     This function is useful for ensuring the type checker's
     understanding of a script is in line with the developer's
     intentions:

          def complex_function(arg: object):
              # Do some complex type-narrowing logic,
              # after which we hope the inferred type will be `int`
              ...
              # Test whether the type checker correctly understands our function
              assert_type(arg, int)

     Added in version 3.11.

 -- の関数: typing.assert_never (arg, /)

     Ask a static type checker to confirm that a line of code is
     unreachable.

     以下はプログラム例です:

          def int_or_str(arg: int | str) -> None:
              match arg:
                  case int():
                      print("It's an int")
                  case str():
                      print("It's a str")
                  case _ as unreachable:
                      assert_never(unreachable)

     Here, the annotations allow the type checker to infer that the last
     case can never execute, because ‘arg’ is either an *note int: 19b.
     or a *note str: 169, and both options are covered by earlier cases.

     If a type checker finds that a call to ‘assert_never()’ is
     reachable, it will emit an error.  For example, if the type
     annotation for ‘arg’ was instead ‘int | str | float’, the type
     checker would emit an error pointing out that ‘unreachable’ is of
     type *note float: 196.  For a call to ‘assert_never’ to pass type
     checking, the inferred type of the argument passed in must be the
     bottom type, *note Never: 8b7, and nothing else.

     At runtime, this throws an exception when called.

     参考
     ....

     Unreachable Code and Exhaustiveness Checking(1) has more
     information about exhaustiveness checking with static typing.

     Added in version 3.11.

 -- の関数: typing.reveal_type (obj, /)

     Ask a static type checker to reveal the inferred type of an
     expression.

     When a static type checker encounters a call to this function, it
     emits a diagnostic with the inferred type of the argument.  For
     example:

          x: int = 1
          reveal_type(x)  # Revealed type is "builtins.int"

     This can be useful when you want to debug how your type checker
     handles a particular piece of code.

     At runtime, this function prints the runtime type of its argument
     to *note sys.stderr: b33. and returns the argument unchanged
     (allowing the call to be used within an expression):

          x = reveal_type(1)  # prints "Runtime type is int"
          print(x)  # prints "1"

     Note that the runtime type may be different from (more or less
     specific than) the type statically inferred by a type checker.

     Most type checkers support ‘reveal_type()’ anywhere, even if the
     name is not imported from ‘typing’.  Importing the name from
     ‘typing’, however, allows your code to run without runtime errors
     and communicates intent more clearly.

     Added in version 3.11.

 -- の関数: @typing.dataclass_transform (*, eq_default=True,
          order_default=False, kw_only_default=False,
          frozen_default=False, field_specifiers=(), **kwargs)

     Decorator to mark an object as providing *note dataclass: 4e1.-like
     behavior.

     ‘dataclass_transform’ may be used to decorate a class, metaclass,
     or a function that is itself a decorator.  The presence of
     ‘@dataclass_transform()’ tells a static type checker that the
     decorated object performs runtime "magic" that transforms a class
     in a similar way to *note @dataclasses.dataclass: 4e1.

     Example usage with a decorator function:

          @dataclass_transform()
          def create_model[T](cls: type[T]) -> type[T]:
              ...
              return cls

          @create_model
          class CustomerModel:
              id: int
              name: str

     On a base class:

          @dataclass_transform()
          class ModelBase: ...

          class CustomerModel(ModelBase):
              id: int
              name: str

     On a metaclass:

          @dataclass_transform()
          class ModelMeta(type): ...

          class ModelBase(metaclass=ModelMeta): ...

          class CustomerModel(ModelBase):
              id: int
              name: str

     The ‘CustomerModel’ classes defined above will be treated by type
     checkers similarly to classes created with *note
     @dataclasses.dataclass: 4e1.  For example, type checkers will
     assume these classes have ‘__init__’ methods that accept ‘id’ and
     ‘name’.

     The decorated class, metaclass, or function may accept the
     following bool arguments which type checkers will assume have the
     same effect as they would have on the *note @dataclasses.dataclass:
     4e1. decorator: ‘init’, ‘eq’, ‘order’, ‘unsafe_hash’, ‘frozen’,
     ‘match_args’, ‘kw_only’, and ‘slots’.  It must be possible for the
     value of these arguments (‘True’ or ‘False’) to be statically
     evaluated.

     The arguments to the ‘dataclass_transform’ decorator can be used to
     customize the default behaviors of the decorated class, metaclass,
     or function:


     パラメータ:

        * ‘eq_default’ (*note bool: 3c3.) - Indicates whether the ‘eq’
          parameter is assumed to be ‘True’ or ‘False’ if it is omitted
          by the caller.  Defaults to ‘True’.

        * ‘order_default’ (*note bool: 3c3.) - Indicates whether the
          ‘order’ parameter is assumed to be ‘True’ or ‘False’ if it is
          omitted by the caller.  Defaults to ‘False’.

        * ‘kw_only_default’ (*note bool: 3c3.) - Indicates whether the
          ‘kw_only’ parameter is assumed to be ‘True’ or ‘False’ if it
          is omitted by the caller.  Defaults to ‘False’.

        * ‘frozen_default’ (*note bool: 3c3.) - Indicates whether the
          ‘frozen’ parameter is assumed to be ‘True’ or ‘False’ if it is
          omitted by the caller.  Defaults to ‘False’.

          Added in version 3.12.

        * ‘field_specifiers’ (*note tuple: 614.‘[’*note Callable:
          9eb.‘[’‘...’‘, ’‘Any’‘]’‘, ’‘...’‘]’) - Specifies a static
          list of supported classes or functions that describe fields,
          similar to *note dataclasses.field(): 195a.  Defaults to ‘()’.

        * ‘**kwargs’ (‘Any’) - Arbitrary other keyword arguments are
          accepted in order to allow for possible future extensions.

     Type checkers recognize the following optional parameters on field
     specifiers: 'Recognised parameters for field specifiers'

     Parameter name           説明
                              
     --------------------------------------------------------------------------------------------------------------
                              
     ‘init’                   Indicates whether the field should be included in the synthesized ‘__init__’
                              method.  If unspecified, ‘init’ defaults to ‘True’.
                              
                              
     ‘default’                Provides the default value for the field.
                              
                              
     ‘default_factory’        Provides a runtime callback that returns the default value for the field.  If
                              neither ‘default’ nor ‘default_factory’ are specified, the field is assumed to
                              have no default value and must be provided a value when the class is instantiated.
                              
                              
     ‘factory’                An alias for the ‘default_factory’ parameter on field specifiers.
                              
                              
     ‘kw_only’                Indicates whether the field should be marked as keyword-only.  If ‘True’, the
                              field will be keyword-only.  If ‘False’, it will not be keyword-only.  If
                              unspecified, the value of the ‘kw_only’ parameter on the object decorated with
                              ‘dataclass_transform’ will be used, or if that is unspecified, the value of
                              ‘kw_only_default’ on ‘dataclass_transform’ will be used.
                              
                              
     ‘alias’                  Provides an alternative name for the field.  This alternative name is used in the
                              synthesized ‘__init__’ method.
                              

     At runtime, this decorator records its arguments in the
     ‘__dataclass_transform__’ attribute on the decorated object.  It
     has no other runtime effect.

     より詳しくは PEP 681(2) を参照してください。

     Added in version 3.11.

 -- の関数: @typing.overload

     Decorator for creating overloaded functions and methods.

     The ‘@overload’ decorator allows describing functions and methods
     that support multiple different combinations of argument types.  A
     series of ‘@overload’-decorated definitions must be followed by
     exactly one non-‘@overload’-decorated definition (for the same
     function/method).

     ‘@overload’-decorated definitions are for the benefit of the type
     checker only, since they will be overwritten by the
     non-‘@overload’-decorated definition.  The
     non-‘@overload’-decorated definition, meanwhile, will be used at
     runtime but should be ignored by a type checker.  At runtime,
     calling an ‘@overload’-decorated function directly will raise *note
     NotImplementedError: 36b.

     An example of overload that gives a more precise type than can be
     expressed using a union or a type variable:

          @overload
          def process(response: None) -> None:
              ...
          @overload
          def process(response: int) -> tuple[int, str]:
              ...
          @overload
          def process(response: bytes) -> str:
              ...
          def process(response):
              ...  # actual implementation goes here

     詳細と他の型付け意味論との比較は PEP 484(3) を参照してください。

     バージョン 3.11 で変更: Overloaded functions can now be
     introspected at runtime using *note get_overloads(): 8bd.

 -- の関数: typing.get_overloads (func)

     Return a sequence of *note @overload: 4515.-decorated definitions
     for 'func'.

     'func' is the function object for the implementation of the
     overloaded function.  For example, given the definition of
     ‘process’ in the documentation for *note @overload: 4515,
     ‘get_overloads(process)’ will return a sequence of three function
     objects for the three defined overloads.  If called on a function
     with no overloads, ‘get_overloads()’ returns an empty sequence.

     ‘get_overloads()’ can be used for introspecting an overloaded
     function at runtime.

     Added in version 3.11.

 -- の関数: typing.clear_overloads ()

     Clear all registered overloads in the internal registry.

     This can be used to reclaim the memory used by the registry.

     Added in version 3.11.

 -- の関数: @typing.final

     Decorator to indicate final methods and final classes.

     Decorating a method with ‘@final’ indicates to a type checker that
     the method cannot be overridden in a subclass.  Decorating a class
     with ‘@final’ indicates that it cannot be subclassed.

     例えば:

          class Base:
              @final
              def done(self) -> None:
                  ...
          class Sub(Base):
              def done(self) -> None:  # Error reported by type checker
                  ...

          @final
          class Leaf:
              ...
          class Other(Leaf):  # Error reported by type checker
              ...

     この機能は実行時には検査されません。詳細については PEP 591(4) を参
     照してください。

     Added in version 3.8.

     バージョン 3.11 で変更: The decorator will now attempt to set a
     ‘__final__’ attribute to ‘True’ on the decorated object.  Thus, a
     check like ‘if getattr(obj, "__final__", False)’ can be used at
     runtime to determine whether an object ‘obj’ has been marked as
     final.  If the decorated object does not support setting
     attributes, the decorator returns the object unchanged without
     raising an exception.

 -- の関数: @typing.no_type_check

     アノテーションが型ヒントでないことを示すデコレータです。

     This works as a class or function *note decorator: 93a.  With a
     class, it applies recursively to all methods and classes defined in
     that class (but not to methods defined in its superclasses or
     subclasses).  Type checkers will ignore all annotations in a
     function or class with this decorator.

     ‘@no_type_check’ mutates the decorated object in place.

 -- の関数: @typing.no_type_check_decorator

     別のデコレータに *note no_type_check(): 8c3. の効果を与えるデコレー
     タです。

     これは何かの関数をラップするデコレータを *note no_type_check():
     8c3. でラップします。

     Deprecated since version 3.13, will be removed in version 3.15: No
     type checker ever added support for ‘@no_type_check_decorator’.  It
     is therefore deprecated, and will be removed in Python 3.15.

 -- の関数: @typing.override

     Decorator to indicate that a method in a subclass is intended to
     override a method or attribute in a superclass.

     Type checkers should emit an error if a method decorated with
     ‘@override’ does not, in fact, override anything.  This helps
     prevent bugs that may occur when a base class is changed without an
     equivalent change to a child class.

     例えば:

          class Base:
              def log_status(self) -> None:
                  ...

          class Sub(Base):
              @override
              def log_status(self) -> None:  # Okay: overrides Base.log_status
                  ...

              @override
              def done(self) -> None:  # Error reported by type checker
                  ...

     There is no runtime checking of this property.

     The decorator will attempt to set an ‘__override__’ attribute to
     ‘True’ on the decorated object.  Thus, a check like ‘if
     getattr(obj, "__override__", False)’ can be used at runtime to
     determine whether an object ‘obj’ has been marked as an override.
     If the decorated object does not support setting attributes, the
     decorator returns the object unchanged without raising an
     exception.

     See PEP 698(5) for more details.

     Added in version 3.12.

 -- の関数: @typing.type_check_only

     Decorator to mark a class or function as unavailable at runtime.

     このデコレータ自身は実行時には使えません。 このデコレータは主に、実
     装がプライベートクラスのインスタンスを返す場合に、型スタブファイル
     に定義されているクラスに対して印を付けるためのものです:

          @type_check_only
          class Response:  # private or not available at runtime
              code: int
              def get_header(self, name: str) -> str: ...

          def fetch_response() -> Response: ...

     プライベートクラスのインスタンスを返すのは推奨されません。 そのよう
     なクラスは公開クラスにするのが望ましいです。

   ---------- Footnotes ----------

   (1) https://typing.python.org/en/latest/guides/unreachable.html

   (2) https://peps.python.org/pep-0681/

   (3) https://peps.python.org/pep-0484/

   (4) https://peps.python.org/pep-0591/

   (5) https://peps.python.org/pep-0698/


File: python.info,  Node: Introspection helpers,  Next: 定数<10>,  Prev: Functions and decorators,  Up: モジュールの内容<3>

5.26.1.21 Introspection helpers
...............................

 -- の関数: typing.get_type_hints (obj, globalns=None, localns=None,
          include_extras=False)

     関数、メソッド、モジュールまたはクラスのオブジェクトの型ヒントを含
     む辞書を返します。

     This is often the same as ‘obj.__annotations__’, but this function
     makes the following changes to the annotations dictionary:

        * Forward references encoded as string literals or *note
          ForwardRef: 1bda. objects are handled by evaluating them in
          'globalns', 'localns', and (where applicable) 'obj"s *note
          type parameter: 5ad. namespace.  If 'globalns' or 'localns' is
          not given, appropriate namespace dictionaries are inferred
          from 'obj'.

        * ‘None’ is replaced with *note types.NoneType: a52.

        * If *note @no_type_check: 8c3. has been applied to 'obj', an
          empty dictionary is returned.

        * If 'obj' is a class ‘C’, the function returns a dictionary
          that merges annotations from ‘C’'s base classes with those on
          ‘C’ directly.  This is done by traversing *note C.__mro__:
          2378. and iteratively combining ‘__annotations__’
          dictionaries.  Annotations on classes appearing earlier in the
          *note method resolution order: 25df. always take precedence
          over annotations on classes appearing later in the method
          resolution order.

        * The function recursively replaces all occurrences of
          ‘Annotated[T, ...]’, ‘Required[T]’, ‘NotRequired[T]’, and
          ‘ReadOnly[T]’ with ‘T’, unless 'include_extras' is set to
          ‘True’ (see *note Annotated: b37. for more information).

     See also *note annotationlib.get_annotations(): 459, a lower-level
     function that returns annotations more directly.

          注意: This function may execute arbitrary code contained in
          annotations.  See *note Security implications of introspecting
          annotations: 4518. for more information.

          注釈: If any forward references in the annotations of 'obj'
          are not resolvable or are not valid Python code, this function
          will raise an exception such as *note NameError: 452.  For
          example, this can happen with imported *note type aliases:
          683. that include forward references, or with names imported
          under *note if TYPE_CHECKING: ef0.

     バージョン 3.9 で変更: Added ‘include_extras’ parameter as part of
     PEP 593(1).  See the documentation on *note Annotated: b37. for
     more information.

     バージョン 3.11 で変更: Previously, ‘Optional[t]’ was added for
     function and method annotations if a default value equal to ‘None’
     was set.  Now the annotation is returned unchanged.

 -- の関数: typing.get_origin (tp)

     Get the unsubscripted version of a type: for a typing object of the
     form ‘X[Y, Z, ...]’ return ‘X’.

     If ‘X’ is a typing-module alias for a builtin or *note collections:
     1e. class, it will be normalized to the original class.  If ‘X’ is
     an instance of *note ParamSpecArgs: 9c9. or *note ParamSpecKwargs:
     9ca, return the underlying *note ParamSpec: 487.  Return ‘None’ for
     unsupported objects.

     例:

          assert get_origin(str) is None
          assert get_origin(Dict[str, int]) is dict
          assert get_origin(Union[int, str]) is Union
          assert get_origin(Annotated[str, "metadata"]) is Annotated
          P = ParamSpec('P')
          assert get_origin(P.args) is P
          assert get_origin(P.kwargs) is P

     Added in version 3.8.

 -- の関数: typing.get_args (tp)

     Get type arguments with all substitutions performed: for a typing
     object of the form ‘X[Y, Z, ...]’ return ‘(Y, Z, ...)’.

     If ‘X’ is a union or *note Literal: a55. contained in another
     generic type, the order of ‘(Y, Z, ...)’ may be different from the
     order of the original arguments ‘[Y, Z, ...]’ due to type caching.
     Return ‘()’ for unsupported objects.

     例:

          assert get_args(int) == ()
          assert get_args(Dict[int, str]) == (int, str)
          assert get_args(Union[int, str]) == (int, str)

     Added in version 3.8.

 -- の関数: typing.get_protocol_members (tp)

     Return the set of members defined in a *note Protocol: 56b.

          >>> from typing import Protocol, get_protocol_members
          >>> class P(Protocol):
          ...     def a(self) -> str: ...
          ...     b: int
          >>> get_protocol_members(P) == frozenset({'a', 'b'})
          True

     Raise *note TypeError: 198. for arguments that are not Protocols.

     Added in version 3.13.

 -- の関数: typing.is_protocol (tp)

     Determine if a type is a *note Protocol: 56b.

     例えば:

          class P(Protocol):
              def a(self) -> str: ...
              b: int

          is_protocol(P)    # => True
          is_protocol(int)  # => False

     Added in version 3.13.

 -- の関数: typing.is_typeddict (tp)

     Check if a type is a *note TypedDict: 332.

     例えば:

          class Film(TypedDict):
              title: str
              year: int

          assert is_typeddict(Film)
          assert not is_typeddict(list | str)

          # TypedDict is a factory for creating typed dicts,
          # not a typed dict itself
          assert not is_typeddict(TypedDict)

     Added in version 3.10.

 -- クラス: typing.ForwardRef

     Class used for internal typing representation of string forward
     references.

     For example, ‘List["SomeClass"]’ is implicitly transformed into
     ‘List[ForwardRef("SomeClass")]’.  ‘ForwardRef’ should not be
     instantiated by a user, but may be used by introspection tools.

          注釈: PEP 585(2) generic types such as ‘list["SomeClass"]’
          will not be implicitly transformed into
          ‘list[ForwardRef("SomeClass")]’ and thus will not
          automatically resolve to ‘list[SomeClass]’.

     Added in version 3.7.4.

     バージョン 3.14 で変更: This is now an alias for *note
     annotationlib.ForwardRef: 1776.  Several undocumented behaviors of
     this class have been changed; for example, after a ‘ForwardRef’ has
     been evaluated, the evaluated value is no longer cached.

 -- の関数: typing.evaluate_forward_ref (forward_ref, *, owner=None,
          globals=None, locals=None, type_params=None,
          format=annotationlib.Format.VALUE)

     Evaluate an *note annotationlib.ForwardRef: 1776. as a *note type
     hint: 23cb.

     This is similar to calling *note
     annotationlib.ForwardRef.evaluate(): 17b2, but unlike that method,
     ‘evaluate_forward_ref()’ also recursively evaluates forward
     references nested within the type hint.

     See the documentation for *note
     annotationlib.ForwardRef.evaluate(): 17b2. for the meaning of the
     'owner', 'globals', 'locals', 'type_params', and 'format'
     parameters.

          注意: This function may execute arbitrary code contained in
          annotations.  See *note Security implications of introspecting
          annotations: 4518. for more information.

     Added in version 3.14.

 -- データ: typing.NoDefault

     A sentinel object used to indicate that a type parameter has no
     default value.  For example:

          >>> T = TypeVar("T")
          >>> T.__default__ is typing.NoDefault
          True
          >>> S = TypeVar("S", default=None)
          >>> S.__default__ is None
          True

     Added in version 3.13.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0593/

   (2) https://peps.python.org/pep-0585/


File: python.info,  Node: 定数<10>,  Next: 非推奨のエイリアス,  Prev: Introspection helpers,  Up: モジュールの内容<3>

5.26.1.22 定数
..............

 -- データ: typing.TYPE_CHECKING

     A special constant that is assumed to be ‘True’ by 3rd party static
     type checkers.  It's ‘False’ at runtime.

     A module which is expensive to import, and which only contain types
     used for typing annotations, can be safely imported inside an ‘if
     TYPE_CHECKING:’ block.  This prevents the module from actually
     being imported at runtime; annotations aren't eagerly evaluated
     (see PEP 649(1)) so using undefined symbols in annotations is
     harmless-as long as you don't later examine them.  Your static type
     analysis tool will set ‘TYPE_CHECKING’ to ‘True’ during static type
     analysis, which means the module will be imported and the types
     will be checked properly during such analysis.

     使い方:

          if TYPE_CHECKING:
              import expensive_mod

          def fun(arg: expensive_mod.SomeType) -> None:
              local_var: expensive_mod.AnotherType = other_fun()

     If you occasionally need to examine type annotations at runtime
     which may contain undefined symbols, use *note
     annotationlib.get_annotations(): 459. with a ‘format’ parameter of
     *note annotationlib.Format.STRING: 160. or *note
     annotationlib.Format.FORWARDREF: 15f. to safely retrieve the
     annotations without raising *note NameError: 452.

     Added in version 3.5.2.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0649/


File: python.info,  Node: 非推奨のエイリアス,  Prev: 定数<10>,  Up: モジュールの内容<3>

5.26.1.23 非推奨のエイリアス
............................

This module defines several deprecated aliases to pre-existing standard
library classes.  These were originally included in the ‘typing’ module
in order to support parameterizing these generic classes using ‘[]’.
However, the aliases became redundant in Python 3.9 when the
corresponding pre-existing classes were enhanced to support ‘[]’ (see
PEP 585(1)).

The redundant types are deprecated as of Python 3.9.  However, while the
aliases may be removed at some point, removal of these aliases is not
currently planned.  As such, no deprecation warnings are currently
issued by the interpreter for these aliases.

If at some point it is decided to remove these deprecated aliases, a
deprecation warning will be issued by the interpreter for at least two
releases prior to removal.  The aliases are guaranteed to remain in the
‘typing’ module without deprecation warnings until at least Python 3.14.

Type checkers are encouraged to flag uses of the deprecated types if the
program they are checking targets a minimum Python version of 3.9 or
newer.

* Menu:

* Aliases to built-in types::
* Aliases to types in collections::
* Aliases to other concrete types::
* Aliases to container ABCs in collections.abc: Aliases to container ABCs in collections abc.
* Aliases to asynchronous ABCs in collections.abc: Aliases to asynchronous ABCs in collections abc.
* Aliases to other ABCs in collections.abc: Aliases to other ABCs in collections abc.
* Aliases to contextlib ABCs::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0585/


File: python.info,  Node: Aliases to built-in types,  Next: Aliases to types in collections,  Up: 非推奨のエイリアス

5.26.1.24 Aliases to built-in types
...................................

 -- クラス: typing.Dict (dict, MutableMapping[KT, VT])

     *note dict: 183. の非推奨なエイリアス。

     Note that to annotate arguments, it is preferred to use an abstract
     collection type such as *note Mapping: ac7. rather than to use
     *note dict: 183. or ‘typing.Dict’.

     バージョン 3.9 で非推奨: *note builtins.dict: 183. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(1) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.List (list, MutableSequence[T])

     *note list: 24d. の非推奨なエイリアス。

     Note that to annotate arguments, it is preferred to use an abstract
     collection type such as *note Sequence: 13dc. or *note Iterable:
     26ae. rather than to use *note list: 24d. or ‘typing.List’.

     バージョン 3.9 で非推奨: *note builtins.list: 24d. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(2) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.Set (set, MutableSet[T])

     Deprecated alias to *note builtins.set: 184.

     Note that to annotate arguments, it is preferred to use an abstract
     collection type such as *note collections.abc.Set: 26a6. rather
     than to use *note set: 184. or *note typing.Set: 4521.

     バージョン 3.9 で非推奨: *note builtins.set: 184. は添字表記 (‘[]’)
     をサポートするようになりました。 PEP 585(3) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.FrozenSet (frozenset, AbstractSet[T_co])

     Deprecated alias to *note builtins.frozenset: 7f2.

     バージョン 3.9 で非推奨: *note builtins.frozenset: 7f2. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(4) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- データ: typing.Tuple

     *note tuple: 614. の非推奨なエイリアス。

     *note tuple: 614. and ‘Tuple’ are special-cased in the type system;
     see *note タプルのアノテーション: 26d0. for more details.

     バージョン 3.9 で非推奨: *note builtins.tuple: 614. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(5) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.Type (Generic[CT_co])

     *note type: f44. の非推奨なエイリアス。

     See *note クラスオブジェクトの型: 44da. for details on using *note
     type: f44. or ‘typing.Type’ in type annotations.

     Added in version 3.5.2.

     バージョン 3.9 で非推奨: *note builtins.type: f44. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(6) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0585/

   (2) https://peps.python.org/pep-0585/

   (3) https://peps.python.org/pep-0585/

   (4) https://peps.python.org/pep-0585/

   (5) https://peps.python.org/pep-0585/

   (6) https://peps.python.org/pep-0585/


File: python.info,  Node: Aliases to types in collections,  Next: Aliases to other concrete types,  Prev: Aliases to built-in types,  Up: 非推奨のエイリアス

5.26.1.25 Aliases to types in ‘collections’
...........................................

 -- クラス: typing.DefaultDict (collections.defaultdict,
          MutableMapping[KT, VT])

     *note collections.defaultdict: 13d4. の非推奨なエイリアス。

     Added in version 3.5.2.

     バージョン 3.9 で非推奨: *note collections.defaultdict: 13d4. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(1) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.OrderedDict (collections.OrderedDict,
          MutableMapping[KT, VT])

     *note collections.OrderedDict: 7f3. の非推奨なエイリアス。

     Added in version 3.7.2.

     バージョン 3.9 で非推奨: *note collections.OrderedDict: 7f3. は添字
     表記 (‘[]’) をサポートするようになりました。 PEP 585(2) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.ChainMap (collections.ChainMap, MutableMapping[KT,
          VT])

     *note collections.ChainMap: e16. の非推奨なエイリアス。

     Added in version 3.6.1.

     バージョン 3.9 で非推奨: *note collections.ChainMap: e16. は添字表
     記 (‘[]’) をサポートするようになりました。 PEP 585(3) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.Counter (collections.Counter, Dict[T, int])

     *note collections.Counter: 12a3. の非推奨なエイリアス。

     Added in version 3.6.1.

     バージョン 3.9 で非推奨: *note collections.Counter: 12a3. は添字表
     記 (‘[]’) をサポートするようになりました。 PEP 585(4) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.Deque (deque, MutableSequence[T])

     *note collections.deque: 7f4. の非推奨なエイリアス。

     Added in version 3.6.1.

     バージョン 3.9 で非推奨: *note collections.deque: 7f4. は添字表記
     (‘[]’) をサポートするようになりました。 PEP 585(5) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0585/

   (2) https://peps.python.org/pep-0585/

   (3) https://peps.python.org/pep-0585/

   (4) https://peps.python.org/pep-0585/

   (5) https://peps.python.org/pep-0585/


File: python.info,  Node: Aliases to other concrete types,  Next: Aliases to container ABCs in collections abc,  Prev: Aliases to types in collections,  Up: 非推奨のエイリアス

5.26.1.26 Aliases to other concrete types
.........................................

 -- クラス: typing.Pattern
 -- クラス: typing.Match

     Deprecated aliases corresponding to the return types from *note
     re.compile(): dce. and *note re.match(): 1445.

     These types (and the corresponding functions) are generic over
     *note AnyStr: 5ac.  ‘Pattern’ can be specialised as ‘Pattern[str]’
     or ‘Pattern[bytes]’; ‘Match’ can be specialised as ‘Match[str]’ or
     ‘Match[bytes]’.

     バージョン 3.9 で非推奨: Classes ‘Pattern’ and ‘Match’ from *note
     re: be. now support ‘[]’.  See PEP 585(1) and *note
     ジェネリックエイリアス型: 8c1.

 -- クラス: typing.Text

     Deprecated alias for *note str: 169.

     ‘Text’ is provided to supply a forward compatible path for Python 2
     code: in Python 2, ‘Text’ is an alias for ‘unicode’.

     ‘Text’ は Python 2 と Python 3 の両方と互換性のある方法で値が
     unicode 文字列を含んでいなければならない場合に使用してください。

          def add_unicode_checkmark(text: Text) -> Text:
              return text + u' \u2713'

     Added in version 3.5.2.

     バージョン 3.11 で非推奨: Python 2 is no longer supported, and most
     type checkers also no longer support type checking Python 2 code.
     Removal of the alias is not currently planned, but users are
     encouraged to use *note str: 169. instead of ‘Text’.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0585/


File: python.info,  Node: Aliases to container ABCs in collections abc,  Next: Aliases to asynchronous ABCs in collections abc,  Prev: Aliases to other concrete types,  Up: 非推奨のエイリアス

5.26.1.27 Aliases to container ABCs in ‘collections.abc’
........................................................

 -- クラス: typing.AbstractSet (Collection[T_co])

     *note collections.abc.Set: 26a6. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Set: 26a6. は添字表
     記 (‘[]’) をサポートするようになりました。 PEP 585(1) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.ByteString (Sequence[int])

     Deprecated alias to *note collections.abc.ByteString: 342.

     Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
     implements the *note buffer protocol: 260. at runtime.  For use in
     type annotations, either use *note Buffer: 343. or a union that
     explicitly specifies the types your code supports (e.g., ‘bytes |
     bytearray | memoryview’).

     ‘ByteString’ was originally intended to be an abstract class that
     would serve as a supertype of both *note bytes: 192. and *note
     bytearray: 344.  However, since the ABC never had any methods,
     knowing that an object was an instance of ‘ByteString’ never
     actually told you anything useful about the object.  Other common
     buffer types such as *note memoryview: 165. were also never
     understood as subtypes of ‘ByteString’ (either at runtime or by
     static type checkers).

     See PEP 688(2) for more details.

     Deprecated since version 3.9, will be removed in version 3.17.

 -- クラス: typing.Collection (Sized, Iterable[T_co], Container[T_co])

     *note collections.abc.Collection: e84. の非推奨なエイリアス。

     Added in version 3.6.

     バージョン 3.9 で非推奨: *note collections.abc.Collection: e84. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(3) と
     *note ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.Container (Generic[T_co])

     *note collections.abc.Container: 26b0. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Container: 26b0. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(4) と
     *note ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.ItemsView (MappingView, AbstractSet[tuple[KT_co,
          VT_co]])

     *note collections.abc.ItemsView: 26b4. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.ItemsView: 26b4. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(5) と
     *note ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.KeysView (MappingView, AbstractSet[KT_co])

     *note collections.abc.KeysView: 26b3. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.KeysView: 26b3. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(6) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.Mapping (Collection[KT], Generic[KT, VT_co])

     *note collections.abc.Mapping: ac7. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Mapping: ac7. は添字
     表記 (‘[]’) をサポートするようになりました。 PEP 585(7) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.MappingView (Sized)

     *note collections.abc.MappingView: 26b2. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.MappingView: 26b2. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(8) と
     *note ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.MutableMapping (Mapping[KT, VT])

     *note collections.abc.MutableMapping: 12c0. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.MutableMapping:
     12c0. は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(9)
     と *note ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.MutableSequence (Sequence[T])

     *note collections.abc.MutableSequence: 4bf. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.MutableSequence:
     4bf. は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(10)
     と *note ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.MutableSet (AbstractSet[T])

     *note collections.abc.MutableSet: 26b1. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.MutableSet: 26b1. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(11) と
     *note ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.Sequence (Reversible[T_co], Collection[T_co])

     *note collections.abc.Sequence: 13dc. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Sequence: 13dc. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(12) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.ValuesView (MappingView, Collection[_VT_co])

     *note collections.abc.ValuesView: 26b5. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.ValuesView: 26b5. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(13) と
     *note ジェネリックエイリアス型: 8c1. を参照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0585/

   (2) https://peps.python.org/pep-0688/#current-options

   (3) https://peps.python.org/pep-0585/

   (4) https://peps.python.org/pep-0585/

   (5) https://peps.python.org/pep-0585/

   (6) https://peps.python.org/pep-0585/

   (7) https://peps.python.org/pep-0585/

   (8) https://peps.python.org/pep-0585/

   (9) https://peps.python.org/pep-0585/

   (10) https://peps.python.org/pep-0585/

   (11) https://peps.python.org/pep-0585/

   (12) https://peps.python.org/pep-0585/

   (13) https://peps.python.org/pep-0585/


File: python.info,  Node: Aliases to asynchronous ABCs in collections abc,  Next: Aliases to other ABCs in collections abc,  Prev: Aliases to container ABCs in collections abc,  Up: 非推奨のエイリアス

5.26.1.28 Aliases to asynchronous ABCs in ‘collections.abc’
...........................................................

 -- クラス: typing.Coroutine (Awaitable[ReturnType], Generic[YieldType,
          SendType, ReturnType])

     *note collections.abc.Coroutine: fdd. の非推奨なエイリアス。

     See *note Annotating generators and coroutines: 299c. for details
     on using *note collections.abc.Coroutine: fdd. and
     ‘typing.Coroutine’ in type annotations.

     Added in version 3.5.3.

     バージョン 3.9 で非推奨: *note collections.abc.Coroutine: fdd. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(1) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.AsyncGenerator (AsyncIterator[YieldType],
          Generic[YieldType, SendType])

     *note collections.abc.AsyncGenerator: e87. の非推奨なエイリアス。

     See *note Annotating generators and coroutines: 299c. for details
     on using *note collections.abc.AsyncGenerator: e87. and
     ‘typing.AsyncGenerator’ in type annotations.

     Added in version 3.6.1.

     バージョン 3.9 で非推奨: *note collections.abc.AsyncGenerator: e87.
     は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(2) と
     *note ジェネリックエイリアス型: 8c1. を参照してください。

     バージョン 3.13 で変更: The ‘SendType’ parameter now has a default.

 -- クラス: typing.AsyncIterable (Generic[T_co])

     *note collections.abc.AsyncIterable: fdf. の非推奨なエイリアス。

     Added in version 3.5.2.

     バージョン 3.9 で非推奨: *note collections.abc.AsyncIterable: fdf.
     は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(3) と
     *note ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.AsyncIterator (AsyncIterable[T_co])

     *note collections.abc.AsyncIterator: fde. の非推奨なエイリアス。

     Added in version 3.5.2.

     バージョン 3.9 で非推奨: *note collections.abc.AsyncIterator: fde.
     は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(4) と
     *note ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.Awaitable (Generic[T_co])

     *note collections.abc.Awaitable: fdc. の非推奨なエイリアス。

     Added in version 3.5.2.

     バージョン 3.9 で非推奨: *note collections.abc.Awaitable: fdc. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(5) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0585/

   (2) https://peps.python.org/pep-0585/

   (3) https://peps.python.org/pep-0585/

   (4) https://peps.python.org/pep-0585/

   (5) https://peps.python.org/pep-0585/


File: python.info,  Node: Aliases to other ABCs in collections abc,  Next: Aliases to contextlib ABCs,  Prev: Aliases to asynchronous ABCs in collections abc,  Up: 非推奨のエイリアス

5.26.1.29 Aliases to other ABCs in ‘collections.abc’
....................................................

 -- クラス: typing.Iterable (Generic[T_co])

     *note collections.abc.Iterable: 26ae. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Iterable: 26ae. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(1) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.Iterator (Iterable[T_co])

     *note collections.abc.Iterator: 26af. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Iterator: 26af. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(2) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

 -- データ: typing.Callable

     *note collections.abc.Callable: 9eb. の非推奨なエイリアス。

     See *note 呼び出し可能オブジェクトのアノテーション: 26cf. for
     details on how to use *note collections.abc.Callable: 9eb. and
     ‘typing.Callable’ in type annotations.

     バージョン 3.9 で非推奨: *note collections.abc.Callable: 9eb. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(3) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

     バージョン 3.10 で変更: ‘Callable’ は *note ParamSpec: 487. と
     *note Concatenate: 9c7. をサポートしました。詳細は PEP 612(4) を参
     照してください。

 -- クラス: typing.Generator (Iterator[YieldType], Generic[YieldType,
          SendType, ReturnType])

     *note collections.abc.Generator: fdb. の非推奨なエイリアス。

     See *note Annotating generators and coroutines: 299c. for details
     on using *note collections.abc.Generator: fdb. and
     ‘typing.Generator’ in type annotations.

     バージョン 3.9 で非推奨: *note collections.abc.Generator: fdb. は添
     字表記 (‘[]’) をサポートするようになりました。 PEP 585(5) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

     バージョン 3.13 で変更: Default values for the send and return
     types were added.

 -- クラス: typing.Hashable

     *note collections.abc.Hashable: 719. の非推奨なエイリアス。

     バージョン 3.12 で非推奨: 代わりに *note collections.abc.Hashable:
     719. を直接使用してください。

 -- クラス: typing.Reversible (Iterable[T_co])

     *note collections.abc.Reversible: e85. の非推奨なエイリアス。

     バージョン 3.9 で非推奨: *note collections.abc.Reversible: e85. は
     添字表記 (‘[]’) をサポートするようになりました。 PEP 585(6) と
     *note ジェネリックエイリアス型: 8c1. を参照してください。

 -- クラス: typing.Sized

     *note collections.abc.Sized: 71a. の非推奨なエイリアス。

     バージョン 3.12 で非推奨: 代わりに *note collections.abc.Sized:
     71a. を直接使用してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0585/

   (2) https://peps.python.org/pep-0585/

   (3) https://peps.python.org/pep-0585/

   (4) https://peps.python.org/pep-0612/

   (5) https://peps.python.org/pep-0585/

   (6) https://peps.python.org/pep-0585/


File: python.info,  Node: Aliases to contextlib ABCs,  Prev: Aliases to other ABCs in collections abc,  Up: 非推奨のエイリアス

5.26.1.30 Aliases to ‘contextlib’ ABCs
......................................

 -- クラス: typing.ContextManager (Generic[T_co, ExitT_co])

     *note contextlib.AbstractContextManager: e8a. の非推奨なエイリアス
     。

     The first type parameter, ‘T_co’, represents the type returned by
     the *note __enter__(): 7e4. method.  The optional second type
     parameter, ‘ExitT_co’, which defaults to ‘bool | None’, represents
     the type returned by the *note __exit__(): 1518. method.

     Added in version 3.5.4.

     バージョン 3.9 で非推奨: *note contextlib.AbstractContextManager:
     e8a. は添字表記 (‘[]’) をサポートするようになりました。 PEP 585(1)
     と *note ジェネリックエイリアス型: 8c1. を参照してください。

     バージョン 3.13 で変更: Added the optional second type parameter,
     ‘ExitT_co’.

 -- クラス: typing.AsyncContextManager (Generic[T_co, AExitT_co])

     *note contextlib.AbstractAsyncContextManager: d20. の非推奨なエイリ
     アス。

     The first type parameter, ‘T_co’, represents the type returned by
     the *note __aenter__(): 241d. method.  The optional second type
     parameter, ‘AExitT_co’, which defaults to ‘bool | None’, represents
     the type returned by the *note __aexit__(): 19a1. method.

     Added in version 3.6.2.

     バージョン 3.9 で非推奨: *note
     contextlib.AbstractAsyncContextManager: d20. は添字表記 (‘[]’) をサ
     ポートするようになりました。 PEP 585(2) と *note
     ジェネリックエイリアス型: 8c1. を参照してください。

     バージョン 3.13 で変更: Added the optional second type parameter,
     ‘AExitT_co’.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0585/

   (2) https://peps.python.org/pep-0585/


File: python.info,  Node: メジャーな機能の非推奨時系列,  Prev: モジュールの内容<3>,  Up: typing --- Support for type hints

5.26.1.31 メジャーな機能の非推奨時系列
......................................

‘typing’ の機能の中には非推奨のものがあり、Python の将来のバージョンで削
除される可能性があります。以下の表は主な非推奨機能をまとめたものです。こ
れは変更される可能性があり、すべての非推奨機能がリストされているわけでは
ありません。

機能                          非推奨となるバージョン        削除予定のバージョン          PEP/issue
                                                                                          
------------------------------------------------------------------------------------------------------------------------
                                                                                          
標準コレクションのエイリア    3.9                           未定（                        PEP 585(1)
ス                                                          *note 非推奨のエイリアス: 451b.
                                                            を参照）
                                                            
                                                                                          
*note typing.ByteString: 345. 3.9                           3.17                          gh-91896(2)
                                                                                          
                                                                                          
*note typing.Text: 360.       3.11                          未定                          gh-92332(3)
                                                                                          
                                                                                          
*note typing.Hashable: 717.、 3.12                          未定                          gh-94309(4)
*note typing.Sized: 718.                                                                  

*note typing.TypeAlias: 9cc.  3.12                          未定                          PEP 695(5)
                                                                                          
                                                                                          
*note @typing.no_type_check_decorator: 333.3.13             3.15                          gh-106309(6)
                                                                                          
                                                                                          
*note typing.AnyStr: 5ac.     3.13                          3.18                          gh-105578(7)
                                                                                          

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0585/

   (2) https://github.com/python/cpython/issues/91896

   (3) https://github.com/python/cpython/issues/92332

   (4) https://github.com/python/cpython/issues/94309

   (5) https://peps.python.org/pep-0695/

   (6) https://github.com/python/cpython/issues/106309

   (7) https://github.com/python/cpython/issues/105578


File: python.info,  Node: pydoc --- ドキュメント生成とオンラインヘルプシステム,  Next: Python 開発モード,  Prev: typing --- Support for type hints,  Up: 開発ツール

5.26.2 ‘pydoc’ -- ドキュメント生成とオンラインヘルプシステム
------------------------------------------------------------

'ソースコード:' Lib/pydoc.py(1)

__________________________________________________________________

The ‘pydoc’ module automatically generates documentation from Python
modules.  The documentation can be presented as pages of text on the
console, served to a web browser, or saved to HTML files.

For modules, classes, functions and methods, the displayed documentation
is derived from the docstring (i.e.  the *note __doc__: b21. attribute)
of the object, and recursively of its documentable members.  If there is
no docstring, ‘pydoc’ tries to obtain a description from the block of
comment lines just above the definition of the class, function or method
in the source file, or at the top of the module (see *note
inspect.getcomments(): 1938.).

The built-in function *note help(): ad4. invokes the online help system
in the interactive interpreter, which uses ‘pydoc’ to generate its
documentation as text on the console.  The same text documentation can
also be viewed from outside the Python interpreter by running ‘pydoc’ as
a script at the operating system's command prompt.  For example, running

     python -m pydoc sys

シェルから行うと *note sys: df. モジュールのドキュメントを、Unix の
‘man’ コマンドのような形式で表示させることができます。 ‘pydoc’ の引数と
して与えることができるのは、関数名・モジュール名・パッケージ名、また、モ
ジュールやパッケージ内のモジュールに含まれるクラス・メソッド・関数へのド
ット形式での参照です。 ‘pydoc’ への引数がパスと解釈されるような場合で(オ
ペレーティングシステムのパス区切り記号を含む場合です。例えばUnixならばス
ラッシュ含む場合になります)、さらに、そのパスがPythonのソースファイルを
指しているなら、そのファイルに対するドキュメントが生成されます。

     注釈: In order to find objects and their documentation, ‘pydoc’
     imports the module(s) to be documented.  Therefore, any code on
     module level will be executed on that occasion.  Use an ‘if
     __name__ == '__main__':’ guard to only execute code when a file is
     invoked as a script and not just imported.

When printing output to the console, ‘pydoc’ attempts to paginate the
output for easier reading.  If either the ‘MANPAGER’ or the ‘PAGER’
environment variable is set, ‘pydoc’ will use its value as a pagination
program.  When both are set, ‘MANPAGER’ is used.

引数の前に ‘-w’ フラグを指定すると、コンソールにテキストを表示させるかわ
りにカレントディレクトリにHTMLドキュメントを生成します。

引数の前に ‘-k’ フラグを指定すると、引数をキーワードとして利用可能な全て
のモジュールの概要を検索します。検索のやりかたは、Unixの ‘man’ コマンド
と同様です。モジュールの概要というのは、モジュールのドキュメントの一行目
のことです。

また、 ‘pydoc’ を使うことでローカルマシンにウェブブラウザから閲覧可能な
ドキュメントを提供するHTTPサーバーを起動することもできます。 ‘python -m
pydoc -p 1234’ とすると、HTTPサーバーをポート1234に起動します。これで、
お好きなウェブブラウザを使って ‘http://localhost:1234/’ からドキュメント
を見ることができます。ポート番号に ‘0’ を指定すると、任意の空きポートが
選択されます。

‘python -m pydoc -n <hostname>’ は、与えられたホスト名で listen するサー
バーを起動します。 デフォルトではホスト名は 'localhost' ですが、他のマシ
ンからサーバーへ疎通できるようにしたい場合は、サーバーが応答するホスト名
を変更したいと思うでしょう。 開発作業中に、コンテナ内で pydoc を走らせた
い場合は、これは特に便利です。

‘python -m pydoc -b’ では、サーバとして起動するとともにブラウザも起動し
、モジュールインデクスページを開きます。提供されるページには、個別のヘル
プページに飛ぶための 'Get' ボタン、全モジュールから概要行に基くキーワー
ド検索するための 'Search' ボタン、と、'Module index', 'Topics' ,
'Keywords' へのそれぞれリンクがついたナビゲーションバーがページの一番上
に付きます。

‘pydoc’ でドキュメントを生成する場合、その時点での環境とパス情報に基づい
てモジュールがどこにあるのか決定されます。そのため、 ‘pydoc spam’ を実行
した場合につくられるドキュメントは、 Pythonインタプリタを起動して
‘import spam’ と入力したときに読み込まれるモジュールに対するドキュメント
になります。

Module docs for core modules are assumed to reside in
‘https://docs.python.org/X.Y/library/’ where ‘X’ and ‘Y’ are the major
and minor version numbers of the Python interpreter.  This can be
overridden by setting the ‘PYTHONDOCS’ environment variable to a
different URL or to a local directory containing the Library Reference
Manual pages.

バージョン 3.2 で変更: ‘-b’ オプションが追加されました。

バージョン 3.3 で変更: ‘-g’ コマンドラインオプションが削除されました。

バージョン 3.4 で変更: ‘pydoc’ now uses *note inspect.signature(): 22f.
rather than *note inspect.getfullargspec(): 941. to extract signature
information from callables.

バージョン 3.7 で変更: ‘-n’ オプションが追加されました。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/pydoc.py


File: python.info,  Node: Python 開発モード,  Next: doctest --- 対話型の Python の例をテストする,  Prev: pydoc --- ドキュメント生成とオンラインヘルプシステム,  Up: 開発ツール

5.26.3 Python 開発モード
------------------------

Added in version 3.7.

The Python Development Mode introduces additional runtime checks that
are too expensive to be enabled by default.  It should not be more
verbose than the default if the code is correct; new warnings are only
emitted when an issue is detected.

It can be enabled using the *note -X dev: 16f. command line option or by
setting the *note PYTHONDEVMODE: ce7. environment variable to ‘1’.

See also *note Python debug build: 509.

* Menu:

* Python 開発モードの影響::
* ResourceWarning の例::
* Bad file descriptor error example::


File: python.info,  Node: Python 開発モードの影響,  Next: ResourceWarning の例,  Up: Python 開発モード

5.26.3.1 Python 開発モードの影響
................................

Python 開発モードを有効化することは次のコマンドに似ていますが、以下で説
明される追加の影響があります:

     PYTHONMALLOC=debug PYTHONASYNCIODEBUG=1 python -W default -X faulthandler

Python 開発モードの影響:

   * ‘default’ の *note 警告フィルタ: 212a. を追加します。次の警告が表示
     されます:

        * *note DeprecationWarning: 1a3.

        * *note ImportWarning: 71e.

        * *note PendingDeprecationWarning: ac5.

        * *note ResourceWarning: 54c.

     通常、上記の警告は デフォルトの *note 警告フィルタ: 212a. によりフ
     ィルタリングされます。

     It behaves as if the *note -W default: ac6. command line option is
     used.

     Use the *note -W error: ac6. command line option or set the *note
     PYTHONWARNINGS: da3. environment variable to ‘error’ to treat
     warnings as errors.

   * Install debug hooks on memory allocators to check for:

        * Buffer underflow

        * Buffer overflow

        * Memory allocator API violation

        * Unsafe usage of the GIL

     See the *note PyMem_SetupDebugHooks(): e64. C function.

     It behaves as if the *note PYTHONMALLOC: e5e. environment variable
     is set to ‘debug’.

     To enable the Python Development Mode without installing debug
     hooks on memory allocators, set the *note PYTHONMALLOC: e5e.
     environment variable to ‘default’.

   * Call *note faulthandler.enable(): 20f. at Python startup to install
     handlers for the *note SIGSEGV: 128c, *note SIGFPE: 128d, *note
     SIGABRT: 128e, *note SIGBUS: 128f. and *note SIGILL: 1290. signals
     to dump the Python traceback on a crash.

     It behaves as if the *note -X faulthandler: 16f. command line
     option is used or if the *note PYTHONFAULTHANDLER: 1291.
     environment variable is set to ‘1’.

   * Enable *note asyncio debug mode: 213a.  For example, *note asyncio:
     b. checks for coroutines that were not awaited and logs them.

     It behaves as if the *note PYTHONASYNCIODEBUG: 2139. environment
     variable is set to ‘1’.

   * Check the 'encoding' and 'errors' arguments for string encoding and
     decoding operations.  Examples: *note open(): 316, *note
     str.encode(): ad2. and *note bytes.decode(): ad3.

     By default, for best performance, the 'errors' argument is only
     checked at the first encoding/decoding error and the 'encoding'
     argument is sometimes ignored for empty strings.

   * The *note io.IOBase: 505. destructor logs ‘close()’ exceptions.

   * Set the *note dev_mode: 1e82. attribute of *note sys.flags: 89c. to
     ‘True’.

The Python Development Mode does not enable the *note tracemalloc: 105.
module by default, because the overhead cost (to performance and memory)
would be too large.  Enabling the *note tracemalloc: 105. module
provides additional information on the origin of some errors.  For
example, *note ResourceWarning: 54c. logs the traceback where the
resource was allocated, and a buffer overflow error logs the traceback
where the memory block was allocated.

The Python Development Mode does not prevent the *note -O: 18c. command
line option from removing *note assert: b60. statements nor from setting
*note __debug__: 9da. to ‘False’.

The Python Development Mode can only be enabled at the Python startup.
Its value can be read from *note sys.flags.dev_mode: 89c.

バージョン 3.8 で変更: The *note io.IOBase: 505. destructor now logs
‘close()’ exceptions.

バージョン 3.9 で変更: The 'encoding' and 'errors' arguments are now
checked for string encoding and decoding operations.


File: python.info,  Node: ResourceWarning の例,  Next: Bad file descriptor error example,  Prev: Python 開発モードの影響,  Up: Python 開発モード

5.26.3.2 ResourceWarning の例
.............................

Example of a script counting the number of lines of the text file
specified in the command line:

     import sys

     def main():
         fp = open(sys.argv[1])
         nlines = len(fp.readlines())
         print(nlines)
         # ファイルは暗黙的に閉じられる

     if __name__ == "__main__":
         main()

The script does not close the file explicitly.  By default, Python does
not emit any warning.  Example using README.txt, which has 269 lines:

     $ python script.py README.txt
     269

Enabling the Python Development Mode displays a *note ResourceWarning:
54c. warning:

     $ python -X dev script.py README.txt
     269
     script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='README.rst' mode='r' encoding='UTF-8'>
       main()
     ResourceWarning: Enable tracemalloc to get the object allocation traceback

In addition, enabling *note tracemalloc: 105. shows the line where the
file was opened:

     $ python -X dev -X tracemalloc=5 script.py README.rst
     269
     script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='README.rst' mode='r' encoding='UTF-8'>
       main()
     Object allocated at (most recent call last):
       File "script.py", lineno 10
         main()
       File "script.py", lineno 4
         fp = open(sys.argv[1])

The fix is to close explicitly the file.  Example using a context
manager:

     def main():
         # ブロックを終了する際に明示的にファイルを閉じる
         with open(sys.argv[1]) as fp:
             nlines = len(fp.readlines())
         print(nlines)

Not closing a resource explicitly can leave a resource open for way
longer than expected; it can cause severe issues upon exiting Python.
It is bad in CPython, but it is even worse in PyPy.  Closing resources
explicitly makes an application more deterministic and more reliable.


File: python.info,  Node: Bad file descriptor error example,  Prev: ResourceWarning の例,  Up: Python 開発モード

5.26.3.3 Bad file descriptor error example
..........................................

Script displaying the first line of itself:

     import os

     def main():
         fp = open(__file__)
         firstline = fp.readline()
         print(firstline.rstrip())
         os.close(fp.fileno())
         # ファイルは暗黙的に閉じられる

     main()

By default, Python does not emit any warning:

     $ python script.py
     import os

The Python Development Mode shows a *note ResourceWarning: 54c. and logs
a "Bad file descriptor" error when finalizing the file object:

     $ python -X dev script.py
     import os
     script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='script.py' mode='r' encoding='UTF-8'>
       main()
     ResourceWarning: Enable tracemalloc to get the object allocation traceback
     Exception ignored in: <_io.TextIOWrapper name='script.py' mode='r' encoding='UTF-8'>
     Traceback (most recent call last):
       File "script.py", line 10, in <module>
         main()
     OSError: [Errno 9] Bad file descriptor

‘os.close(fp.fileno())’ closes the file descriptor.  When the file
object finalizer tries to close the file descriptor again, it fails with
the ‘Bad file descriptor’ error.  A file descriptor must be closed only
once.  In the worst case scenario, closing it twice can lead to a crash
(see bpo-18748(1) for an example).

The fix is to remove the ‘os.close(fp.fileno())’ line, or open the file
with ‘closefd=False’.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=18748


File: python.info,  Node: doctest --- 対話型の Python の例をテストする,  Next: unittest --- ユニットテストフレームワーク,  Prev: Python 開発モード,  Up: 開発ツール

5.26.4 ‘doctest’ -- 対話型の Python の例をテストする
----------------------------------------------------

'ソースコード:' Lib/doctest.py(1)

__________________________________________________________________

The ‘doctest’ module searches for pieces of text that look like
interactive Python sessions, and then executes those sessions to verify
that they work exactly as shown.  There are several common ways to use
doctest:

   * モジュールの docstring (ドキュメンテーション文字列) 中にある対話実
     行例のすべてが書かれている通りに動作するか検証することで、docstring
     の内容が最新かどうかチェックする。

   * テストファイルやテストオブジェクト中の対話実行例が期待通りに動作す
     るかを検証することで、回帰テストを実現します。

   * 入出力例を豊富に使ったパッケージのチュートリアルドキュメントが書け
     ます。入出力例と解説文のどちらに注目するかによって、ドキュメントは
     「読めるテスト」にも「実行できるドキュメント」にもなります。

以下に完全かつ短い実行例を示します:

     """
     This is the "example" module.

     The example module supplies one function, factorial().  For example,

     >>> factorial(5)
     120
     """

     def factorial(n):
         """Return the factorial of n, an exact integer >= 0.

         >>> [factorial(n) for n in range(6)]
         [1, 1, 2, 6, 24, 120]
         >>> factorial(30)
         265252859812191058636308480000000
         >>> factorial(-1)
         Traceback (most recent call last):
             ...
         ValueError: n must be >= 0

         Factorials of floats are OK, but the float must be an exact integer:
         >>> factorial(30.1)
         Traceback (most recent call last):
             ...
         ValueError: n must be exact integer
         >>> factorial(30.0)
         265252859812191058636308480000000

         It must also not be ridiculously large:
         >>> factorial(1e100)
         Traceback (most recent call last):
             ...
         OverflowError: n too large
         """

         import math
         if not n >= 0:
             raise ValueError("n must be >= 0")
         if math.floor(n) != n:
             raise ValueError("n must be exact integer")
         if n+1 == n:  # catch a value like 1e300
             raise OverflowError("n too large")
         result = 1
         factor = 2
         while factor <= n:
             result *= factor
             factor += 1
         return result


     if __name__ == "__main__":
         import doctest
         doctest.testmod()

If you run ‘example.py’ directly from the command line, ‘doctest’ works
its magic:

     $ python example.py
     $

There's no output!  That's normal, and it means all the examples worked.
Pass ‘-v’ to the script, and ‘doctest’ prints a detailed log of what
it's trying, and prints a summary at the end:

     $ python example.py -v
     Trying:
         factorial(5)
     Expecting:
         120
     ok
     Trying:
         [factorial(n) for n in range(6)]
     Expecting:
         [1, 1, 2, 6, 24, 120]
     ok

といった具合で、最後には:

     Trying:
         factorial(1e100)
     Expecting:
         Traceback (most recent call last):
             ...
         OverflowError: n too large
     ok
     2 items passed all tests:
        1 test in __main__
        6 tests in __main__.factorial
     7 tests in 2 items.
     7 passed.
     Test passed.
     $

That's all you need to know to start making productive use of ‘doctest’!
Jump in.  The following sections provide full details.  Note that there
are many examples of doctests in the standard Python test suite and
libraries.  Especially useful examples can be found in the standard test
file ‘Lib/test/test_doctest/test_doctest.py’.

Added in version 3.13: Output is colorized by default and can be *note
controlled using environment variables: 1b7.

* Menu:

* 簡単な利用法; docstring 中の実行例をチェックする: 簡単な利用法 docstring 中の実行例をチェックする.
* 簡単な利用法; テキストファイル中の実行例をチェックする: 簡単な利用法 テキストファイル中の実行例をチェックする.
* コマンドラインでの使用: コマンドラインでの使用<6>.
* doctest のからくり::
* 基本 API::
* 単体テスト API::
* 拡張 API::
* デバッグ::
* アドバイス::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/doctest.py


File: python.info,  Node: 簡単な利用法 docstring 中の実行例をチェックする,  Next: 簡単な利用法 テキストファイル中の実行例をチェックする,  Up: doctest --- 対話型の Python の例をテストする

5.26.4.1 簡単な利用法: docstring 中の実行例をチェックする
.........................................................

doctest を試す簡単な方法 (とはいえ、いつもそうする必要はないのですが) は
、各モジュール ‘M’ の最後を、以下のようにして締めくくることです:

     if __name__ == "__main__":
         import doctest
         doctest.testmod()

こうすると、 ‘doctest’ は ‘M’ 中の docstring を検査します。

モジュールをスクリプトとして実行すると、docstring 中の実行例が実行され、
検証されます:

     python M.py

docstring に書かれた実行例の実行が失敗しない限り、何も表示されません。失
敗すると、失敗した実行例と、その原因が (場合によっては複数) 標準出力に印
字され、最後に ‘***Test Failed*** N failures.’ という行を出力します。こ
こで、'N' は失敗した実行例の数です。

一方、‘-v’ スイッチをつけて走らせると:

     python M.py -v

実行を試みたすべての実行例について詳細に報告し、最後に各種まとめを行った
内容が標準出力に印字されます。

‘verbose=True’ を *note testmod(): 1686. に渡せば、詳細報告 (verbose) モ
ードを強制できます。また、 ‘verbose=False’ にすれば禁止できます。どちら
の場合にも、 *note testmod(): 1686. は *note sys.argv: 147c. 上のスイッ
チを調べません。(したがって、 ‘-v’ をつけても効果はありません)。

There is also a command line shortcut for running *note testmod(): 1686,
see section *note コマンドラインでの使用: 4557.

*note testmod(): 1686. の詳しい情報は *note 基本 API: 4558. 節を参照して
ください。


File: python.info,  Node: 簡単な利用法 テキストファイル中の実行例をチェックする,  Next: コマンドラインでの使用<6>,  Prev: 簡単な利用法 docstring 中の実行例をチェックする,  Up: doctest --- 対話型の Python の例をテストする

5.26.4.2 簡単な利用法: テキストファイル中の実行例をチェックする
...............................................................

doctest のもう一つの簡単な用途は、テキストファイル中にある対話実行例に対
するテストです。これには *note testfile(): 455b. 関数を使います:

     import doctest
     doctest.testfile("example.txt")

この短いスクリプトは、 ‘example.txt’ というファイルの中に入っている対話
モードの Python 操作例すべてを実行して、その内容を検証します。ファイルの
内容は一つの巨大な docstring であるかのように扱われます; ファイルが
Python プログラムである必要はありません！例えば、 ‘example.txt’ には以下
のような内容が入っているとします:

     The ``example`` module
     ======================

     Using ``factorial``
     -------------------

     This is an example text file in reStructuredText format.  First import
     ``factorial`` from the ``example`` module:

         >>> from example import factorial

     Now use it:

         >>> factorial(6)
         120

‘doctest.testfile("example.txt")’ を実行すると、このドキュメント内のエラ
ーを見つけ出します:

     File "./example.txt", line 14, in example.txt
     Failed example:
         factorial(6)
     Expected:
         120
     Got:
         720

*note testmod(): 1686. と同じく、 *note testfile(): 455b. は実行例が失敗
しない限り何も表示しません。実行例が失敗すると、失敗した実行例とその原因
が (場合によっては複数) ‘testmod()’ と同じ書式で標準出力に書き出されます
。

デフォルトでは、 *note testfile(): 455b. は自分自身を呼び出したモジュー
ルのあるディレクトリを探します。その他の場所にあるファイルを見に行くよう
に *note testfile(): 455b. に指示するためのオプション引数についての説明
は *note 基本 API: 4558. 節を参照してください。

*note testmod(): 1686. と同様に *note testfile(): 455b. の冗長性
(verbosity) はコマンドラインスイッチ ‘-v’ またはオプションのキーワード引
数 'verbose' によって指定できます。

There is also a command line shortcut for running *note testfile():
455b, see section *note コマンドラインでの使用: 4557.

*note testfile(): 455b. の詳細は *note 基本 API: 4558. 節を参照してくだ
さい。


File: python.info,  Node: コマンドラインでの使用<6>,  Next: doctest のからくり,  Prev: 簡単な利用法 テキストファイル中の実行例をチェックする,  Up: doctest --- 対話型の Python の例をテストする

5.26.4.3 コマンドラインでの使用
...............................

The ‘doctest’ module can be invoked as a script from the command line:

     python -m doctest [-v] [-o OPTION] [-f] file [file ...]

 -- Option: -v, --verbose

     Detailed report of all examples tried is printed to standard
     output, along with assorted summaries at the end:

          python -m doctest -v example.py

     こうすると ‘example.py’ を単体モジュールとしてインポートして、それ
     に対して *note testmod(): 1686. を実行します。このファイルがパッケ
     ージの一部で他のサブモジュールをそのパッケージからインポートしてい
     る場合はうまく動かないことに注意してください。

     If the file name does not end with ‘.py’, ‘doctest’ infers that it
     must be run with *note testfile(): 455b. instead:

          python -m doctest -v example.txt

 -- Option: -o, --option <option>

     Option flags control various aspects of doctest's behavior, see
     section *note オプションフラグ: 1134.

     Added in version 3.4.

 -- Option: -f, --fail-fast

     This is shorthand for ‘-o FAIL_FAST’.

     Added in version 3.4.


File: python.info,  Node: doctest のからくり,  Next: 基本 API,  Prev: コマンドラインでの使用<6>,  Up: doctest --- 対話型の Python の例をテストする

5.26.4.4 doctest のからくり
...........................

この節では、doctest のからくり: どの docstring を見に行くのか、どのよう
に対話実行例を見つけ出すのか、どんな実行コンテキストを使うのか、例外をど
う扱うか、上記の振る舞いを制御するためにどのようなオプションフラグを使う
か、について詳しく吟味します。こうした情報は、doctest に対応した実行例を
書くために必要な知識です; 書いた実行例に対して実際に doctest を実行する
上で必要な情報については後続の節を参照してください。

* Menu:

* どの docstring が検証されるのか?::
* docstring 内の実行例をどのように認識するのか?::
* 実行コンテキストとは何か?::
* 例外はどう扱えばよいか?::
* オプションフラグ::
* ディレクティブ (Directives): ディレクティブ Directives.
* 警告: 警告<2>.


File: python.info,  Node: どの docstring が検証されるのか?,  Next: docstring 内の実行例をどのように認識するのか?,  Up: doctest のからくり

5.26.4.5 どの docstring が検証されるのか?
.........................................

モジュールの docstring と、すべての関数、クラスおよびメソッドの
docstring が検索されます。モジュールに import されたオブジェクトは検索さ
れません。

In addition, there are cases when you want tests to be part of a module
but not part of the help text, which requires that the tests not be
included in the docstring.  Doctest looks for a module-level variable
called ‘__test__’ and uses it to locate other tests.  If ‘M.__test__’
exists, it must be a dict, and each entry maps a (string) name to a
function object, class object, or string.  Function and class object
docstrings found from ‘M.__test__’ are searched, and strings are treated
as if they were docstrings.  In output, a key ‘K’ in ‘M.__test__’
appears with name ‘M.__test__.K’.

For example, place this block of code at the top of ‘example.py’:

     __test__ = {
         'numbers': """
     >>> factorial(6)
     720

     >>> [factorial(n) for n in range(6)]
     [1, 1, 2, 6, 24, 120]
     """
     }

The value of ‘example.__test__["numbers"]’ will be treated as a
docstring and all the tests inside it will be run.  It is important to
note that the value can be mapped to a function, class object, or
module; if so, ‘doctest’ searches them recursively for docstrings, which
are then scanned for tests.

検索中に見つかったクラスも同様に再帰的に検索が行われ、クラスに含まれてい
るメソッドおよびネストされたクラスについて docstring のテストが行われま
す。

     注釈: ‘doctest’ can only automatically discover classes and
     functions that are defined at the module level or inside other
     classes.

     Since nested classes and functions only exist when an outer
     function is called, they cannot be discovered.  Define them outside
     to make them visible.


File: python.info,  Node: docstring 内の実行例をどのように認識するのか?,  Next: 実行コンテキストとは何か?,  Prev: どの docstring が検証されるのか?,  Up: doctest のからくり

5.26.4.6 docstring 内の実行例をどのように認識するのか?
......................................................

ほとんどの場合、対話コンソールセッション上でのコピー／ペーストはうまく動
作します。とはいえ、*note doctest: 3e. は特定の Python シェルの振る舞い
を正確にエミュレーションしようとするわけではありません。

     >>> # comments are ignored
     >>> x = 12
     >>> x
     12
     >>> if x == 13:
     ...     print("yes")
     ... else:
     ...     print("no")
     ...     print("NO")
     ...     print("NO!!!")
     ...
     no
     NO
     NO!!!
     >>>

コードを含む最後の ‘'>>> '’ または ‘'... '’ 行の直下に期待する出力結果が
置かれます。(出力結果がもしあれば) それは次の ‘'>>> '’ 行か、すべて空白
文字の行まで続きます。

詳細事項:

   * 期待する出力結果には、空白だけの行が入っていてはなりません。そのよ
     うな行は期待する出力結果の終了を表すと見なされるからです。もし期待
     する出力結果の内容に空白行が入っている場合には、空白行が入るべき場
     所すべてに ‘<BLANKLINE>’ を入れてください。

   * 全てのタブ文字は 8 カラムのタブ位置でスペースに展開されます。テスト
     対象のコードが作成した出力にあるタブは変更されません。出力例にある
     どんなタブも展開 'される' ので、コードの出力がハードタブを含んでい
     た場合、 doctest が通るには *note NORMALIZE_WHITESPACE: 456a. オプ
     ションか *note directive: 456b. を有効にするしかありません。そうす
     る代わりに、テストが出力を読み取りテストの一部として期待される値と
     正しく比較するように、テストを書き直すこともできます。このソース中
     のタブの扱いは試行錯誤の結果であり、タブの扱いの中で最も問題の起き
     にくいものだということが分かっています。タブの扱いについては、独自
     の *note DocTestParser: 456c. クラスを実装して、別のアルゴリズムを
     使うこともできます。

   * 標準出力への出力は取り込まれますが、標準エラーは取り込まれません (例
     外発生時のトレースバックは別の方法で取り込まれます)。

   * 対話セッションにおいて、バックスラッシュを用いて次の行に続ける場合
     や、その他の理由でバックスラッシュを用いる場合、raw docstring を使
     ってバックスラッシュを入力どおりに扱わせるようにしなければなりませ
     ん:

          >>> def f(x):
          ...     r'''Backslashes in a raw docstring: m\n'''
          ...
          >>> print(f.__doc__)
          Backslashes in a raw docstring: m\n

     そうしない場合は、バックスラッシュは文字列の一部として解釈されます
     。例えば、上の ‘\n’ は改行文字として解釈されてしまいます。それ以外
     の方法では、doctest にあるバックスラッシュを二重にする (そして raw
     string を使わない) という方法もあります:

          >>> def f(x):
          ...     '''Backslashes in a raw docstring: m\\n'''
          ...
          >>> print(f.__doc__)
          Backslashes in a raw docstring: m\n

   * 開始カラムはどこでもかまいません:

          >>> assert "Easy!"
                >>> import math
                    >>> math.floor(1.9)
                    1

     期待する出力結果の先頭部にある空白文字列は、実行例の開始部分にあた
     る ‘'>>> '’ 行の先頭にある空白文字列と同じだけ取り除かれます。


File: python.info,  Node: 実行コンテキストとは何か?,  Next: 例外はどう扱えばよいか?,  Prev: docstring 内の実行例をどのように認識するのか?,  Up: doctest のからくり

5.26.4.7 実行コンテキストとは何か?
..................................

By default, each time ‘doctest’ finds a docstring to test, it uses a
'shallow copy' of ‘M’'s globals, so that running tests doesn't change
the module's real globals, and so that one test in ‘M’ can't leave
behind crumbs that accidentally allow another test to work.  This means
examples can freely use any names defined at top-level in ‘M’, and names
defined earlier in the docstring being run.  Examples cannot see names
defined in other docstrings.

*note testmod(): 1686. や *note testfile(): 455b. に ‘globs=your_dict’ を
渡し、自前の辞書を実行コンテキストとして使うこともできます。


File: python.info,  Node: 例外はどう扱えばよいか?,  Next: オプションフラグ,  Prev: 実行コンテキストとは何か?,  Up: doctest のからくり

5.26.4.8 例外はどう扱えばよいか?
................................

トレースバックが実行例によって生成される唯一の出力なら問題ありません。単
にトレースバックを貼り付けてください。(1) トレースバックには、頻繁に変更
されがちな情報 (例えばファイルパスや行番号など) が入っているものなので、
これは受け入れるテスト結果に柔軟性を持たせようと doctest が苦労している
部分の一つです。

簡単な例を示しましょう:

     >>> [1, 2, 3].remove(42)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     ValueError: list.remove(x): x not in list

この doctest は、 *note ValueError: 2ec. が送出され、その詳細情報が
‘list.remove(x): x not in list’ である場合に成功します。

例外が発生したときの期待する出力はトレースバックヘッダから始まっていなけ
ればなりません。トレースバックの形式は以下の二通りの行のいずれかで、実行
例の最初の行と同じインデントでなければりません:

     Traceback (most recent call last):
     Traceback (innermost last):

トレースバックヘッダの後ろにトレースバックスタックが続いてもかまいません
が、doctest はその内容を無視します。普通はトレースバックスタックを省略す
るか、対話セッションからそのままコピーしてきます。

トレースバックスタックの後ろにはもっとも有意義な部分、例外の型と詳細情報
の入った行があります。これは通常トレースバックの最後の行ですが、例外が複
数行の詳細情報を持っている場合、複数の行にわたることもあります:

     >>> raise ValueError('multi\n    line\ndetail')
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     ValueError: multi
         line
     detail

上の例では、最後の 3 行 (*note ValueError: 2ec. から始まる行) における例
外の型と詳細情報だけが比較され、それ以外の部分は無視されます。

例外を扱うコツは、実行例をドキュメントとして読む上で明らかに価値のある情
報でない限り、トレースバックスタックは省略する、ということです。したがっ
て、先ほどの例は以下のように書くべきでしょう:

     >>> raise ValueError('multi\n    line\ndetail')
     Traceback (most recent call last):
         ...
     ValueError: multi
         line
     detail

トレースバックの扱いは非常に特殊なので注意してください。特に、上の書き直
した実行例では、 ‘...’ の扱いは doctest の *note ELLIPSIS: 1687. オプシ
ョンとは独立しています。この例での省略記号は何かの省略を表しているかもし
れませんし、コンマや数字が 3 個 (または 300 個) かもしれませんし、 Monty
Python のスキットをインデントして書き写したものかもしれません。

以下の詳細はずっと覚えておく必要はないのですが、一度目を通しておいてくだ
さい:

   * doctest は期待する出力の出所が print 文なのか例外なのかを推測できま
     せん。したがって、例えば期待する出力が ‘ValueError: 42 is prime’ で
     あるような実行例は、 *note ValueError: 2ec. が実際に送出された場合
     と、万が一期待する出力と同じ文字列を print した場合の両方で成功して
     しまいます。現実的には、通常の出力がトレースバックヘッダから始まる
     ことはないので、実際に問題になることはないでしょう。

   * トレースバックスタック (がある場合) の各行は、実行例の最初の行より
     も深くインデントされているか、'または' 英数文字以外で始まっていなけ
     ればなりません。トレースバックヘッダ以後に現れる行のうち、インデン
     トが等しく英数文字で始まる最初の行は例外の詳細情報が書かれた行とみ
     なされるからです。もちろん、本物のトレースバックでは正しく動作しま
     す。

   * doctest のオプション *note IGNORE_EXCEPTION_DETAIL: 1520. を指定し
     た場合、最も左端のコロン以後の全ての内容と、例外名の中の全てのモジ
     ュール情報が無視されます。

   * 対話シェルでは、 *note SyntaxError: 18e. の場合にトレースバックヘッ
     ダが省略されることがあります。しかし doctest にとっては、例外を例外
     でないものと区別するためにトレースバックヘッダが必要です。そこで、
     トレースバックヘッダを省略するような ‘SyntaxError’ をテストする必要
     があるというごく稀なケースでは、実行例にトレースバックヘッダを手作
     業で追加する必要があるでしょう。

   * For some exceptions, Python displays the position of the error
     using ‘^’ markers and tildes:

          >>> 1 + None
            File "<stdin>", line 1
              1 + None
              ~~^~~~~~
          TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

     例外の型と詳細情報の前にエラー位置を示す行がくるため、doctest はこ
     の行を調べません。例えば、以下の例では、間違った場所に ‘^’ マーカを
     入れても成功してしまいます:

          >>> 1 + None
            File "<stdin>", line 1
              1 + None
              ^~~~~~~~
          TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

   ---------- Footnotes ----------

   (1) 期待する出力結果と例外の両方を含んだ例はサポートされていません。
一方の終わりと他方の始まりを見分けようとするのはエラーの元になりがちです
し、解りにくいテストになってしまいます。


File: python.info,  Node: オプションフラグ,  Next: ディレクティブ Directives,  Prev: 例外はどう扱えばよいか?,  Up: doctest のからくり

5.26.4.9 オプションフラグ
.........................

doctest の振る舞いは、数多くのオプションフラグによって様々な側面から制御
されています。フラグのシンボル名はモジュールの定数として提供され、 *note
ビット単位論理和: 24cd. でつないで様々な関数に渡すことができます。シンボ
ル名は *note doctest directives: 456b. でも使用でき、doctest コマンドラ
インインターフェースに ‘-o’ を通して与えることができます。

最初に説明するオプション群は、テストのセマンティクスを決めます。すなわち
、実際にテストを実行したときの出力と実行例中の期待する出力とが一致してい
るかどうかを doctest がどのように判断するかを制御します:

 -- データ: doctest.DONT_ACCEPT_TRUE_FOR_1

     デフォルトでは、期待する出力ブロックに単に ‘1’ だけが入っており、実
     際の出力ブロックに ‘1’ または ‘True’ だけが入っていた場合、これらの
     出力は一致しているとみなされます。 ‘0’ と ‘False’ の場合も同様です
     。 *note DONT_ACCEPT_TRUE_FOR_1: 4573. を指定すると、こうした値の読
     み替えを行いません。デフォルトの挙動で読み替えを行うのは、最近の
     Python で多くの関数の戻り値型が整数型からブール型に変更されたことに
     対応するためです; 読み替えを行う場合、"通常の整数" の出力を期待する
     出力とするような doctest も動作します。このオプションはそのうちなく
     なるでしょうが、ここ数年はそのままでしょう。

 -- データ: doctest.DONT_ACCEPT_BLANKLINE

     デフォルトでは、期待する出力ブロックに ‘<BLANKLINE>’ だけの入った行
     がある場合、その行は実際の出力における空行に一致するようになります
     。完全な空行を入れてしまうと期待する出力がそこで終わっているとみな
     されてしまうため、期待する出力に空行を入れたい場合にはこの方法を使
     わなければなりません。 *note DONT_ACCEPT_BLANKLINE: 4574. を指定す
     ると、 ‘<BLANKLINE>’ の読み替えを行わなくなります。

 -- データ: doctest.NORMALIZE_WHITESPACE

     このフラグを指定すると、連続する空白 (空白と改行文字) は互いに等価
     であるとみなします。期待する出力における任意の空白列は実際の出力に
     おける任意の空白と一致します。デフォルトでは、空白は厳密に一致しな
     ければなりません。 *note NORMALIZE_WHITESPACE: 456a. は、期待する出
     力の内容が非常に長いために、ソースコード中でその内容を複数行に折り
     返して書きたい場合に特に便利です。

 -- データ: doctest.ELLIPSIS

     このフラグを指定すると、期待する出力中の省略記号マーカ (‘...’) が実
     際の出力中の任意の部分文字列と一致するようになります。部分文字列は
     行境界にわたるものや空文字列を含みます。したがって、このフラグを使
     うのは単純な内容を対象にする場合にとどめましょう。複雑な使い方をす
     ると、正規表現に ‘.*’ を使ったときのように "しまった、マッチしすぎ
     た！ (match too much!)"  と驚くことになりかねません。

 -- データ: doctest.IGNORE_EXCEPTION_DETAIL

     When specified, doctests expecting exceptions pass so long as an
     exception of the expected type is raised, even if the details
     (message and fully qualified exception name) don't match.

     For example, an example expecting ‘ValueError: 42’ will pass if the
     actual exception raised is ‘ValueError: 3*14’, but will fail if,
     say, a *note TypeError: 198. is raised instead.  It will also
     ignore any fully qualified name included before the exception
     class, which can vary between implementations and versions of
     Python and the code/libraries in use.  Hence, all three of these
     variations will work with the flag specified:

          >>> raise Exception('message')
          Traceback (most recent call last):
          Exception: message

          >>> raise Exception('message')
          Traceback (most recent call last):
          builtins.Exception: message

          >>> raise Exception('message')
          Traceback (most recent call last):
          __main__.Exception: message

     Note that *note ELLIPSIS: 1687. can also be used to ignore the
     details of the exception message, but such a test may still fail
     based on whether the module name is present or matches exactly.

     バージョン 3.2 で変更: *note doctest: 3e. モジュールの *note
     IGNORE_EXCEPTION_DETAIL: 1520. フラグが、 テストされている例外を含
     むモジュールの名前を無視するようになりました。

 -- データ: doctest.SKIP

     このフラグを指定すると、実行例は一切実行されません。こうした機能は
     doctest の実行例がドキュメントとテストを兼ねていて、ドキュメントの
     ためには含めておかなければならないけれどチェックされなくても良い、
     というような文脈で役に立ちます。例えば、実行例の出力がランダムであ
     るとか、テストドライバーには利用できないリソースに依存している場合
     などです。

     SKIP フラグは一時的に実行例を"コメントアウト"するのにも使えます。

 -- データ: doctest.COMPARISON_FLAGS

     上記の比較フラグすべての論理和をとったビットマスクです。

二つ目のオプション群は、テストの失敗を報告する方法を制御します:

 -- データ: doctest.REPORT_UDIFF

     このオプションを指定すると、期待する出力および実際の出力が複数行に
     なるときにテストの失敗結果を unified diff 形式を使って表示します。

 -- データ: doctest.REPORT_CDIFF

     このオプションを指定すると、期待する出力および実際の出力が複数行に
     なるときにテストの失敗結果を context diff 形式を使って表示します。

 -- データ: doctest.REPORT_NDIFF

     このオプションを指定すると、期待する出力と実際の出力との間の差分を
     ‘difflib.Differ’ を使って算出します。使われているアルゴリズムは有名
     な ‘ndiff.py’ ユーティリティと同じです。これは、行単位の差分と同じ
     ように行内の差分にマーカをつけられるようにする唯一の手段です。例え
     ば、期待する出力のある行に数字の ‘1’ が入っていて、実際の出力には
     ‘l’ が入っている場合、不一致の起きているカラム位置を示すキャレット
     の入った行が一行挿入されます。

 -- データ: doctest.REPORT_ONLY_FIRST_FAILURE

     このオプションを指定すると、各 doctest で最初にエラーの起きた実行例
     だけを表示し、それ以後の実行例の出力を抑制します。これにより、正し
     く書かれた実行例が、それ以前の実行例の失敗によっておかしくなってし
     まった場合に、 doctest がそれを報告しないようになります。とはいえ、
     最初に失敗を引き起こした実行例とは関係なく誤って書かれた実行例の報
     告も抑制してしまいます。 *note REPORT_ONLY_FIRST_FAILURE: 4577. を
     指定した場合、実行例がどこかで失敗しても、それ以後の実行例を続けて
     実行し、失敗したテストの総数を報告します; 出力が抑制されるだけです
     。

 -- データ: doctest.FAIL_FAST

     このオプションを指定すると、最初に実行例が失敗した時点で終了し、残
     りの実行例を実行しません。つまり、報告される失敗の数はたかだか 1 つ
     になります。最初の失敗より後の例はデバッグ出力を生成しないため、こ
     のフラグはデバッグの際に有用でしょう。

 -- データ: doctest.REPORTING_FLAGS

     上記のエラー報告に関するフラグすべての論理和をとったビットマスクで
     す。

There is also a way to register new option flag names, though this isn't
useful unless you intend to extend ‘doctest’ internals via subclassing:

 -- の関数: doctest.register_optionflag (name)

     名前 'name' の新たなオプションフラグを作成し、作成されたフラグの整
     数値を返します。 *note register_optionflag(): 4579. は *note
     OutputChecker: 457a. や *note DocTestRunner: 457b. をサブクラス化し
     て、その中で新たに作成したオプションをサポートさせる際に使います。
     *note register_optionflag(): 4579. は以下のような定形文で呼び出さな
     ければなりません:

          MY_FLAG = register_optionflag('MY_FLAG')


File: python.info,  Node: ディレクティブ Directives,  Next: 警告<2>,  Prev: オプションフラグ,  Up: doctest のからくり

5.26.4.10 ディレクティブ (Directives)
.....................................

doctest ディレクティブは個々の実行例の *note オプションフラグ: 1134. を
操作するために使われます。 doctest ディレクティブは後のソースコード例に
あるような特殊な Python コメントです:

     directive:             "#" "doctest:" *note directive_options: 457e.
     directive_options:     *note directive_option: 457f. ("," *note directive_option: 457f.)*
     directive_option:      *note on_or_off: 4580. *note directive_option_name: 4581.
     on_or_off:             "+" | "-"
     directive_option_name: "DONT_ACCEPT_BLANKLINE" | "NORMALIZE_WHITESPACE" | ...

‘+’ や ‘-’ とディレクティブオプション名の間に空白を入れてはなりません。
ディレクティブオプション名は上で説明したオプションフラグ名のいずれかです
。

ある実行例の doctest ディレクティブは、その実行例だけの doctest の振る舞
いを変えます。ある特定の挙動を有効にしたければ ‘+’ を、無効にしたければ
‘-’ を使います。

例えば、以下のテストは成功します:

     >>> print(list(range(20)))  # doctest: +NORMALIZE_WHITESPACE
     [0,   1,  2,  3,  4,  5,  6,  7,  8,  9,
     10,  11, 12, 13, 14, 15, 16, 17, 18, 19]

ディレクティブがない場合、実際の出力には一桁の数字の間に二つスペースが入
っていないこと、実際の出力は 1 行になることから、テストは成功しないはず
です。別のディレクティブを使って、このテストを成功させることもできます:

     >>> print(list(range(20)))  # doctest: +ELLIPSIS
     [0, 1, ..., 18, 19]

複数のディレクティブは、一つの物理行の中にコンマで区切って指定できます:

     >>> print(list(range(20)))  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
     [0,    1, ...,   18,    19]

一つの実行例中で複数のディレクティブコメントを使った場合、それらは組み合
わされます:

     >>> print(list(range(20)))  # doctest: +ELLIPSIS
     ...                         # doctest: +NORMALIZE_WHITESPACE
     [0,    1, ...,   18,    19]

この実行例で分かるように、実行例にはディレクティブだけを含む ‘...’ 行を
追加することができます。この書きかたは、実行例が長すぎるためにディレクテ
ィブを同じ行に入れると収まりが悪い場合に便利です:

     >>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40)))
     ... # doctest: +ELLIPSIS
     [0, ..., 4, 10, ..., 19, 30, ..., 39]

フォルトではすべてのオプションが無効になっており、ディレクティブは特定の
実行例だけに影響を及ぼすので、通常意味があるのは有効にするためのオプショ
ン (‘+’ のついたディレクティブ) だけです。とはいえ、doctest を実行する関
数はオプションフラグを指定してデフォルトとは異なった挙動を実現できるので
、そのような場合には ‘-’ を使った無効化オプションも意味を持ちます。


File: python.info,  Node: 警告<2>,  Prev: ディレクティブ Directives,  Up: doctest のからくり

5.26.4.11 警告
..............

‘doctest’ is serious about requiring exact matches in expected output.
If even a single character doesn't match, the test fails.  This will
probably surprise you a few times, as you learn exactly what Python does
and doesn't guarantee about output.  For example, when printing a set,
Python doesn't guarantee that the element is printed in any particular
order, so a test like

     >>> foo()
     {"spam", "eggs"}

は失敗するかもしれないのです!  回避するには

     >>> foo() == {"spam", "eggs"}
     True

とするのが一つのやり方です。別のやり方は

     >>> d = sorted(foo())
     >>> d
     ['eggs', 'spam']

他のやり方もありますが、あとは自分で考えてみてください。

以下のように、オブジェクトアドレスを埋め込むような結果を print するのも
よくありません :

     >>> id(1.0)  # certain to fail some of the time
     7948648
     >>> class C: pass
     >>> C()  # the default repr() for instances embeds an address
     <C object at 0x00AC18F0>

*note ELLIPSIS: 1687. ディレクティブを使うと、上のような例をうまく解決で
きます:

     >>> C()  # doctest: +ELLIPSIS
     <C object at 0x...>

Floating-point numbers are also subject to small output variations
across platforms, because Python defers to the platform C library for
some floating-point calculations, and C libraries vary widely in quality
here.

     >>> 1000**0.1  # risky
     1.9952623149688797
     >>> round(1000**0.1, 9) # safer
     1.995262315
     >>> print(f'{1000**0.1:.4f}') # much safer
     1.9953

‘I/2.**J’ の形式になる数値はどのプラットフォームでもうまく動作するので、
私はこの形式の数値を生成するように doctest の実行例を工夫しています:

     >>> 3./4  # utterly safe
     0.75

単純な分数は人間にとっても理解しやすく、良いドキュメントを書くために役に
立ちます。


File: python.info,  Node: 基本 API,  Next: 単体テスト API,  Prev: doctest のからくり,  Up: doctest --- 対話型の Python の例をテストする

5.26.4.12 基本 API
..................

数 *note testmod(): 1686. と *note testfile(): 455b. は、ほとんどの基本
的な用途に十分な doctest インターフェースを提供しています。これら二つの
関数についてあまり形式的でない入門が読みたければ、 *note 簡単な利用法;
docstring 中の実行例をチェックする: 4555. 節や *note 簡単な利用法;
テキストファイル中の実行例をチェックする: 4559. 節を参照してください。

 -- の関数: doctest.testfile (filename, module_relative=True, name=None,
          package=None, globs=None, verbose=None, report=True,
          optionflags=0, extraglobs=None, raise_on_error=False,
          parser=DocTestParser(), encoding=None)

     'filename' 以外の引数はすべてオプションで、キーワード引数形式で指定
     しなければなりません。

     'filename' に指定したファイル内にある実行例をテストします。
     ‘(failure_count, test_count)’ を返します。

     オプション引数の 'module_relative' は、ファイル名をどのように解釈す
     るかを指定します:

        * 'module_relative' が ‘True’ (デフォルト) の場合、'filename' は
          OS に依存しないモジュールの相対パスになります。デフォルトでは
          、このパスは関数 *note testfile(): 455b. を呼び出しているモジ
          ュールからの相対パスになります; ただし、'package' 引数を指定し
          た場合には、パッケージからの相対になります。OS への依存性を除
          くため、'filename' ではパスを分割する文字に ‘/’ を使わなければ
          ならず、絶対パスにしてはなりません (パス文字列を ‘/’ で始めて
          はなりません)。

        * 'module_relative' が ‘False’ の場合、'filename' は OS 依存のパ
          スを示します。パスは絶対パスでも相対パスでもかまいません; 相対
          パスにした場合、現在の作業ディレクトリを基準に解決します。

     オプション引数 'name' には、テストの名前を指定します; デフォルトの
     場合や ‘None’ を指定した場合、‘os.path.basename(filename)’ になりま
     す。

     オプション引数 'package' には、Python パッケージを指定するか、モジ
     ュール相対のファイル名の場合には相対の基準ディレクトリとなる Python
     パッケージの名前を指定します。パッケージを指定しない場合、関数を呼
     び出しているモジュールのディレクトリを相対の基準ディレクトリとして
     使います。'module_relative' を ‘False’ に指定している場合、
     'package' を指定するとエラーになります。

     オプション引数 'globs' には辞書を指定します。この辞書は、実行例を実
     行する際のグローバル変数として用いられます。doctest はこの辞書の浅
     いコピーを生成するので、実行例は白紙の状態からスタートします。デフ
     ォルトの場合や ‘None’ を指定した場合、新たな空の辞書になります。

     オプション引数 'extraglobs' には辞書を指定します。この辞書は、実行
     例を実行する際にグローバル変数にマージされます。マージは *note
     dict.update(): 167e. のように振舞います: 'globs' と 'extraglobs' と
     の間に同じキー値がある場合、両者を合わせた辞書中には 'extraglobs' の
     方の値が入ります。デフォルト、または ‘None’ であるとき、追加のグロ
     ーバル変数は使われません。この仕様は、パラメータ付きで doctest を実
     行するという、やや進んだ機能です。例えば、一般的な名前を使って基底
     クラス向けに doctest を書いておき、その後で辞書で一般的な名前からテ
     ストしたいサブクラスへの対応付けを行う辞書を 'extraglobs' に渡して
     、様々なサブクラスをテストできます。

     オプション引数 'verbose' が真の場合、様々な情報を出力します。偽の場
     合にはテストの失敗だけを報告します。デフォルトの場合や ‘None’ を指
     定した場合、*note sys.argv: 147c. に ‘'-v'’ を指定しない限りこの値
     は真になりません。

     オプション引数 'report' が真の場合、テストの最後にサマリを出力しま
     す。それ以外の場合には何も出力しません。verbose モードの場合、サマ
     リには詳細な情報を出力しますが、そうでない場合にはサマリはとても簡
     潔になります (実際には、すべてのテストが成功した場合には何も出力し
     ません)。

     オプション引数 'optionflags' (デフォルト値 ‘0’) は、各オプションフ
     ラグの *note ビット単位論理和: 24cd. を取ります。 *note
     オプションフラグ: 1134. 節を参照してください。

     オプション引数 'raise_on_error' の値はデフォルトでは偽です。真にす
     ると、最初のテスト失敗や予期しない例外が起きたときに例外を送出しま
     す。このオプションを使うと、失敗の原因を検死デバッグ (post-mortem
     debug) できます。デフォルトの動作では、実行例の実行を継続します。

     オプション引数 'parser' には、 *note DocTestParser: 456c. (またはそ
     のサブクラス) を指定します。このクラスはファイルから実行例を抽出す
     るために使われます。デフォルトでは通常のパーザ (‘DocTestParser()’)
     です。

     オプション引数 'encoding' にはファイルをユニコードに変換する際に使
     われるエンコーディングを指定します。

 -- の関数: doctest.testmod (m=None, name=None, globs=None,
          verbose=None, report=True, optionflags=0, extraglobs=None,
          raise_on_error=False, exclude_empty=False)

     引数はすべてオプションで、'm' 以外の引数はキーワード引数として指定
     しなければなりません。

     モジュール 'm' ('m' を指定しないか ‘None’ にした場合には *note
     __main__: 1.) から到達可能な関数およびクラスの docstring 内にある実
     行例をテストします。 ‘m.__doc__’ 内の実行例からテストを開始します。

     Also test examples reachable from dict ‘m.__test__’, if it exists.
     ‘m.__test__’ maps names (strings) to functions, classes and
     strings; function and class docstrings are searched for examples;
     strings are searched directly, as if they were docstrings.

     モジュール 'm' に属するオブジェクトにつけられた docstring のみを検
     索します。

     ‘(failure_count, test_count)’ を返します。

     オプション引数 'name' には、モジュールの名前を指定します。デフォル
     トの場合や ‘None’ を指定した場合には、‘m.__name__’ を使います。

     オプション引数 'exclude_empty' はデフォルトでは偽になっています。こ
     の値を真にすると、doctest を持たないオブジェクトを考慮から外します
     。デフォルトの設定は依存のバージョンとの互換性を考えたハックであり
     、*note doctest.master.summarize: 4585. と *note testmod(): 1686. を
     合わせて利用しているようなコードでも、テスト実行例を持たないオブジ
     ェクトから出力を得るようにしています。新たに追加された *note
     DocTestFinder: 19a8. のコンストラクタの 'exclude_empty' はデフォル
     トで真になります。

     オプション引数 'extraglobs', 'verbose', 'report', 'optionflags',
     'raise_on_error', および 'globs' は上で説明した *note testfile():
     455b. の引数と同じです。ただし、 'globs' のデフォルト値は
     ‘m.__dict__’ になります。

 -- の関数: doctest.run_docstring_examples (f, globs, verbose=False,
          name='NoName', compileflags=None, optionflags=0)

     オブジェクト 'f' に関連付けられた実行例をテストします。 'f' は文字
     列、モジュール、関数、またはクラスオブジェクトです。

     引数 'globs' に辞書を指定すると、その浅いコピーを実行コンテキストに
     使います。

     オプション引数 'name' はテスト失敗時のメッセージに使われます。デフ
     ォルトの値は ‘'NoName'’ です。

     オプション引数 'verbose' の値を真にすると、テストが失敗しなくても出
     力を生成します。デフォルトでは、実行例のテストに失敗したときのみ出
     力を生成します。

     オプション引数 'compileflags' には、実行例を実行するときに Python バ
     イトコードコンパイラが使うフラグを指定します。デフォルトの場合や
     ‘None’ を指定した場合、フラグは 'globs' 内にある future 機能セット
     に対応したものになります。

     オプション引数 'optionflags' は、上で述べた *note testfile(): 455b.
     と同様の働きをします。


File: python.info,  Node: 単体テスト API,  Next: 拡張 API,  Prev: 基本 API,  Up: doctest --- 対話型の Python の例をテストする

5.26.4.13 単体テスト API
........................

As your collection of doctest'ed modules grows, you'll want a way to run
all their doctests systematically.  ‘doctest’ provides two functions
that can be used to create *note unittest: 10c. test suites from modules
and text files containing doctests.  To integrate with *note unittest:
10c. test discovery, include a *note load_tests: 4589. function in your
test module:

     import unittest
     import doctest
     import my_module_with_doctests

     def load_tests(loader, tests, ignore):
         tests.addTests(doctest.DocTestSuite(my_module_with_doctests))
         return tests

doctest の入ったテキストファイルやモジュールから *note
unittest.TestSuite: ff5. インスタンスを生成するための主な関数は二つあり
ます:

 -- の関数: doctest.DocFileSuite (*paths, module_relative=True,
          package=None, setUp=None, tearDown=None, globs=None,
          optionflags=0, parser=DocTestParser(), encoding=None)

     単一または複数のテキストファイルに入っている doctest 形式のテストを
     、 *note unittest.TestSuite: ff5. インスタンスに変換します。

     The returned *note unittest.TestSuite: ff5. is to be run by the
     unittest framework and runs the interactive examples in each file.
     If an example in any file fails, then the synthesized unit test
     fails, and a *note failureException: 458b. exception is raised
     showing the name of the file containing the test and a (sometimes
     approximate) line number.  If all the examples in a file are
     skipped, then the synthesized unit test is also marked as skipped.

     関数には、テストを行いたい一つまたは複数のファイルへのパスを (文字
     列で) 渡します。

     *note DocFileSuite(): 458a. には、キーワード引数でオプションを指定
     できます:

     オプション引数 'module_relative' は 'paths' に指定したファイル名を
     どのように解釈するかを指定します:

        * 'module_relative' が ‘True’ (デフォルト) の場合、'paths' 中の
          ファイル名は OS に依存しないモジュールの相対パスになります。デ
          フォルトでは、このパスは呼び出し元のモジュールのディレクトリか
          らの相対パスになります; ただし、'package' 引数を指定した場合に
          は、パッケージからの相対になります。OS への依存性を除くため、
          各ファイル名はパスを分割するのに ‘/’ 文字を使わなければならず
          、絶対パスにしてはなりません (パス文字列を ‘/’ で始めてはなり
          ません)。

        * 'module_relative' が ‘False’ の場合、'filename' は OS 依存のパ
          スを示します。パスは絶対パスでも相対パスでもかまいません; 相対
          パスにした場合、現在の作業ディレクトリを基準に解決します。

     オプション引数 'package' には、Python パッケージを指定するか、モジ
     ュール相対のファイル名の場合には相対の基準ディレクトリとなる Python
     パッケージの名前を指定します。パッケージを指定しない場合、関数を呼
     び出しているモジュールのディレクトリを相対の基準ディレクトリとして
     使います。'module_relative' を ‘False’ に指定している場合、
     'package' を指定するとエラーになります。

     オプション引数 'setUp' には、テストスイートのセットアップに使う関数
     を指定します。この関数は、各ファイルのテストを実行する前に呼び出さ
     れます。 setUp 関数は *note DocTest: 1a29. オブジェクトに引き渡され
     ます。 'setUp' は *note globs: 458c. 属性を介してテストのグローバル
     変数にアクセスできます。

     オプション引数 'tearDown' には、テストを解体 (tear-down) するための
     関数を指定します。この関数は、各ファイルのテストの実行を終了するた
     びに呼び出されます。 'tearDown' 関数は *note DocTest: 1a29. オブジ
     ェクトに引き渡されます。 'tearDown' は *note globs: 458c. 属性を介
     してテストのグローバル変数にアクセスできます。

     オプション引数 'globs' は辞書で、テストのグローバル変数の初期値が入
     ります。この辞書は各テストごとに新たにコピーして使われます。デフォ
     ルトでは 'globs' は空の新たな辞書です。

     オプション引数 'optionflags' には、テストを実行する際にデフォルトで
     適用される doctest オプションを OR で結合して指定します。 *note
     オプションフラグ: 1134. 節を参照してください。結果レポートに関する
     オプションを指定するより適切な方法は下記の *note
     set_unittest_reportflags(): 458d. の説明を参照してください。

     オプション引数 'parser' には、 *note DocTestParser: 456c. (またはそ
     のサブクラス) を指定します。このクラスはファイルから実行例を抽出す
     るために使われます。デフォルトでは通常のパーザ (‘DocTestParser()’)
     です。

     オプション引数 'encoding' にはファイルをユニコードに変換する際に使
     われるエンコーディングを指定します。

     *note DocFileSuite(): 458a. を使用してテキストファイルからロードさ
     れた doctests に提供される globals に、グローバル変数 ‘__file__’ が
     追加されます。

 -- の関数: doctest.DocTestSuite (module=None, globs=None,
          extraglobs=None, test_finder=None, setUp=None, tearDown=None,
          optionflags=0, checker=None)

     doctest のテストを *note unittest.TestSuite: ff5. に変換します。

     The returned *note unittest.TestSuite: ff5. is to be run by the
     unittest framework and runs each doctest in the module.  Each
     docstring is run as a separate unit test.  If any of the doctests
     fail, then the synthesized unit test fails, and a *note
     unittest.TestCase.failureException: 458b. exception is raised
     showing the name of the file containing the test and a (sometimes
     approximate) line number.  If all the examples in a docstring are
     skipped, then the

     オプション引数 'module' には、テストしたいモジュールの名前を指定し
     ます。'module' にはモジュールオブジェクトまたは (ドット表記の) モジ
     ュール名を指定できます。'module' を指定しない場合、この関数を呼び出
     しているモジュールになります。

     Optional argument 'globs' is a dictionary containing the initial
     global variables for the tests.  A new copy of this dictionary is
     created for each test.  By default, 'globs' is the module's *note
     __dict__: 236f.

     オプション引数 'extraglobs' には追加のグローバル変数セットを指定し
     ます。この変数セットは 'globs' に統合されます。デフォルトでは、追加
     のグローバル変数はありません。

     オプション引数 'test_finder' は、モジュールから doctest を抽出する
     ための *note DocTestFinder: 19a8. オブジェクト (またはその代替とな
     るオブジェクト) です。

     Optional arguments 'setUp', 'tearDown', and 'optionflags' are the
     same as for function *note DocFileSuite(): 458a. above, but they
     are called for each docstring.

     この関数は *note testmod(): 1686. と同じ検索方法を使います。

     バージョン 3.5 で変更: 'module' がドキュメンテーション文字列を含ま
     ない場合には、 *note DocTestSuite(): ff4. は *note ValueError: 2ec.
     を送出するのではなく空の *note unittest.TestSuite: ff5. を返します
     。

Under the covers, *note DocTestSuite(): ff4. creates a *note
unittest.TestSuite: ff5. out of ‘doctest.DocTestCase’ instances, and
‘DocTestCase’ is a subclass of *note unittest.TestCase: 2b3.
‘DocTestCase’ isn't documented here (it's an internal detail), but
studying its code can answer questions about the exact details of *note
unittest: 10c. integration.

Similarly, *note DocFileSuite(): 458a. creates a *note
unittest.TestSuite: ff5. out of ‘doctest.DocFileCase’ instances, and
‘DocFileCase’ is a subclass of ‘DocTestCase’.

So both ways of creating a *note unittest.TestSuite: ff5. run instances
of ‘DocTestCase’.  This is important for a subtle reason: when you run
‘doctest’ functions yourself, you can control the ‘doctest’ options in
use directly, by passing option flags to ‘doctest’ functions.  However,
if you're writing a *note unittest: 10c. framework, ‘unittest’
ultimately controls when and how tests get run.  The framework author
typically wants to control ‘doctest’ reporting options (perhaps, e.g.,
specified by command line options), but there's no way to pass options
through ‘unittest’ to ‘doctest’ test runners.

For this reason, ‘doctest’ also supports a notion of ‘doctest’ reporting
flags specific to *note unittest: 10c. support, via this function:

 -- の関数: doctest.set_unittest_reportflags (flags)

     Set the ‘doctest’ reporting flags to use.

     引数 'flags' はオプションフラグの *note ビット単位論理和: 24cd. を
     取ります。 *note オプションフラグ: 1134. 節を参照してください。「レ
     ポートフラグ」しか使えません。

     This is a module-global setting, and affects all future doctests
     run by module *note unittest: 10c.: the ‘runTest()’ method of
     ‘DocTestCase’ looks at the option flags specified for the test case
     when the ‘DocTestCase’ instance was constructed.  If no reporting
     flags were specified (which is the typical and expected case),
     ‘doctest’'s ‘unittest’ reporting flags are *note bitwise ORed:
     24cd. into the option flags, and the option flags so augmented are
     passed to the *note DocTestRunner: 457b. instance created to run
     the doctest.  If any reporting flags were specified when the
     ‘DocTestCase’ instance was constructed, ‘doctest’'s ‘unittest’
     reporting flags are ignored.

     この関数は、関数を呼び出す前に有効になっていた *note unittest: 10c.
     レポートフラグの値を返します。


File: python.info,  Node: 拡張 API,  Next: デバッグ,  Prev: 単体テスト API,  Up: doctest --- 対話型の Python の例をテストする

5.26.4.14 拡張 API
..................

基本 API は、doctest を使いやすくするための簡単なラッパであり、柔軟性が
あってほとんどのユーザの必要を満たしています; とはいえ、もっとテストをき
め細かに制御したい場合や、doctest の機能を拡張したい場合、拡張 API
(advanced API) を使わなければなりません。

拡張 API は、doctest ケースから抽出した対話モードでの実行例を記憶するた
めの二つのコンテナクラスを中心に構成されています:

   * *note Example: 4590.: 1つの Python *note 文: 2bfc. と、その期待する
     出力をペアにしたもの。

   * *note DocTest: 1a29.: *note Example: 4590. の集まり。通常一つの
     docstring やテキストファイルから抽出されます。

その他に、doctest の実行例を検索、構文解析、実行、チェックするための処理
クラスが以下のように定義されています:

   * *note DocTestFinder: 19a8.: 与えられたモジュールからすべての
     docstring を検索し、 *note DocTestParser: 456c. を使って対話モード
     での実行例が入ったすべての docstring から *note DocTest: 1a29. を生
     成します。

   * *note DocTestParser: 456c.: (オブジェクトの docstring 等の) 文字列
     から *note DocTest: 1a29. オブジェクトを生成します。

   * *note DocTestRunner: 457b.: *note DocTest: 1a29. 内の実行例を実行し
     、 *note OutputChecker: 457a. を使って出力を検証します。

   * *note OutputChecker: 457a.: doctest 実行例から実際に出力された結果
     を期待する出力と比較し、両者が一致するか判別します。

これらの処理クラスの関係を図にまとめると、以下のようになります:

                                 list of:
     +------+                   +---------+
     |module| --DocTestFinder-> | DocTest | --DocTestRunner-> results
     +------+    |        ^     +---------+     |       ^    (printed)
                 |        |     | Example |     |       |
                 v        |     |   ...   |     v       |
                DocTestParser   | Example |   OutputChecker
                                +---------+

* Menu:

* DocTest オブジェクト::
* Example オブジェクト::
* DocTestFinder オブジェクト::
* DocTestParser オブジェクト::
* TestResults objects::
* DocTestRunner オブジェクト::
* OutputChecker オブジェクト::


File: python.info,  Node: DocTest オブジェクト,  Next: Example オブジェクト,  Up: 拡張 API

5.26.4.15 DocTest オブジェクト
..............................

 -- クラス: doctest.DocTest (examples, globs, name, filename, lineno,
          docstring)

     単一の名前空間内で実行される doctest 実行例の集まりです。コンストラ
     クタの引数は *note DocTest: 1a29. インスタンス中の同名の属性の初期
     化に使われます。

     *note DocTest: 1a29. では、以下の属性を定義しています。これらの変数
     はコンストラクタで初期化されます。直接変更してはなりません。

      -- の属性: examples

          対話モードにおける実行例それぞれをエンコードしていて、テストで
          実行される、 *note Example: 4590. オブジェクトからなるリストで
          す。

      -- の属性: globs

          実行例を実行する名前空間 (いわゆるグローバル変数) です。このメ
          ンバは、名前から値への対応付けを行っている辞書です。実行例が名
          前空間に対して (新たな変数を束縛するなど) 何らかの変更を行った
          場合、 *note globs: 458c. への反映はテストの実行後に起こります
          。

      -- の属性: name

          *note DocTest: 1a29. を識別する名前の文字列です。通常、この値
          はテストを取り出したオブジェクトかファイルの名前になります。

      -- の属性: filename

          The name of the file that this *note DocTest: 1a29. was
          extracted from; or ‘None’ if the filename is unknown, or if
          the ‘DocTest’ was not extracted from a file.

      -- の属性: lineno

          *note filename: 4595. 中で *note DocTest: 1a29. のテスト実行例
          が始まっている行の行番号で、行番号が利用できなければ ‘None’ で
          す。行番号は、ファイルの先頭を 0 として数えます。

      -- の属性: docstring

          テストを取り出した docstring 自体を現す文字列です。docstring 文
          字列を得られない場合や、文字列からテスト実行例を取り出したので
          ない場合には ‘None’ になります。


File: python.info,  Node: Example オブジェクト,  Next: DocTestFinder オブジェクト,  Prev: DocTest オブジェクト,  Up: 拡張 API

5.26.4.16 Example オブジェクト
..............................

 -- クラス: doctest.Example (source, want, exc_msg=None, lineno=0,
          indent=0, options=None)

     ひとつの Python 文と、それに対する期待する出力からなる、単一の対話
     的モードの実行例です。コンストラクタの引数は *note Example: 4590. イ
     ンスタンス中の同名の属性の初期化に使われます。

     *note Example: 4590. では、以下の属性を定義しています。これらの変数
     はコンストラクタで初期化されます。直接変更してはなりません。

      -- の属性: source

          実行例のソースコードが入った文字列です。ソースコードは単一の
          Python で、末尾は常に改行です。コンストラクタは必要に応じて改
          行を追加します。

      -- の属性: want

          実行例のソースコードを実行した際の期待する出力 (標準出力と、例
          外が生じた場合にはトレースバック) です。 *note want: 459a. の
          末尾は、期待する出力がまったくない場合を除いて常に改行になりま
          す。期待する出力がない場合には空文字列になります。コンストラク
          タは必要に応じて改行を追加します。

      -- の属性: exc_msg

          実行例が例外を生成すると期待される場合の例外メッセージです。例
          外を送出しない場合には ‘None’ です。この例外メッセージは、
          *note traceback.format_exception_only(): a4e. の戻り値と比較さ
          れます。値が ‘None’ でない限り、 *note exc_msg: 459b. は改行で
          終わっていなければなりません; コンストラクタは必要に応じて改行
          を追加します。

      -- の属性: lineno

          この実行例を含む文字列における実行例が始まる行番号です。行番号
          は文字列の先頭を 0 として数えます。

      -- の属性: indent

          実行例の入っている文字列のインデント、すなわち実行例の最初のプ
          ロンプトより前にある空白文字の数です。

      -- の属性: options

          A dictionary mapping from option flags to ‘True’ or ‘False’,
          which is used to override default options for this example.
          Any option flags not contained in this dictionary are left at
          their default value (as specified by the *note DocTestRunner:
          457b.'s *note optionflags: 1134.).  By default, no options are
          set.


File: python.info,  Node: DocTestFinder オブジェクト,  Next: DocTestParser オブジェクト,  Prev: Example オブジェクト,  Up: 拡張 API

5.26.4.17 DocTestFinder オブジェクト
....................................

 -- クラス: doctest.DocTestFinder (verbose=False,
          parser=DocTestParser(), recurse=True, exclude_empty=True)

     与えられたオブジェクトについて、そのオブジェクト自身の docstring か
     、そのオブジェクトに含まれるオブジェクトの docstring から *note
     DocTest: 1a29. を抽出する処理クラスです。モジュール、クラス、関数、
     メソッド、静的メソッド、クラスメソッド、プロパティから *note
     DocTest: 1a29. を抽出できます。

     オプション引数 'verbose' を使うと、抽出処理の対象となるオブジェクト
     を表示できます。デフォルトは ‘False’ (出力を行わない) です。

     オプション引数 'parser' には、 docstring から *note DocTest: 1a29.
     を抽出するのに使う *note DocTestParser: 456c. オブジェクト (または
     その代替となるオブジェクト) を指定します。

     オプション引数 'recurse' が偽の場合、 *note DocTestFinder.find():
     1a6f. は与えられたオブジェクトだけを調べ、そのオブジェクトに含まれ
     る他のオブジェクトを調べません。

     オプション引数 'exclude_empty' が偽の場合、 *note
     DocTestFinder.find(): 1a6f. は空の docstring を持つオブジェクトもテ
     スト対象に含めます。

     *note DocTestFinder: 19a8. では以下のメソッドを定義しています:

      -- メソッド: find (obj[, name][, module][, globs][, extraglobs])

          'obj' または 'obj' 内に入っているオブジェクトの docstring 中で
          定義されている *note DocTest: 1a29. のリストを返します。

          オプション引数 'name' には、オブジェクトの名前を指定します。こ
          の名前は、関数が返す *note DocTest: 1a29. の名前になります。
          'name' を指定しない場合、 ‘obj.__name__’ を使います。

          オプションのパラメータ 'module' は、指定したオブジェクトを収め
          ているモジュールを指定します。 'module' を指定しないか、‘None’
          を指定した場合には、正しいモジュールを自動的に決定しようと試み
          ます。 オブジェクトのモジュールは以下のような役割を果たします:

             * 'globs' を指定していない場合、オブジェクトのモジュールは
               デフォルトの名前空間になります。

             * 他のモジュールから import されたオブジェクトに対して
               *note DocTestFinder: 19a8. が *note DocTest: 1a29. を抽出
               するのを避けるために使います。 ('module' 由来でないオブジ
               ェクトを無視します。)

             * オブジェクトの入っているファイル名を調べるために使います
               。

             * オブジェクトがファイル内の何行目にあるかを調べる手助けに
               します。

          'module' が ‘False’ の場合には、モジュールの検索を試みません。
          これは正確さを欠くような使い方で、通常 doctest 自体のテストに
          しか使いません。'module' が ‘False’ の場合、または 'module' が
          ‘None’ で自動的に的確なモジュールを見つけ出せない場合には、す
          べてのオブジェクトは ‘(non-existent)’ モジュールに属するとみな
          され、そのオブジェクト内のすべてのオブジェクトに対して (再帰的
          に) doctest の検索を行います。

          The globals for each *note DocTest: 1a29. is formed by
          combining 'globs' and 'extraglobs' (bindings in 'extraglobs'
          override bindings in 'globs').  A new shallow copy of the
          globals dictionary is created for each ‘DocTest’.  If 'globs'
          is not specified, then it defaults to the module's *note
          __dict__: 236f, if specified, or ‘{}’ otherwise.  If
          'extraglobs' is not specified, then it defaults to ‘{}’.


File: python.info,  Node: DocTestParser オブジェクト,  Next: TestResults objects,  Prev: DocTestFinder オブジェクト,  Up: 拡張 API

5.26.4.18 DocTestParser オブジェクト
....................................

 -- クラス: doctest.DocTestParser

     対話モードの実行例を文字列から抽出し、それを使って *note DocTest:
     1a29. オブジェクトを生成するために使われる処理クラスです。

     *note DocTestParser: 456c. では以下のメソッドを定義しています:

      -- メソッド: get_doctest (string, globs, name, filename, lineno)

          指定した文字列からすべての doctest 実行例を抽出し、 *note
          DocTest: 1a29. オブジェクト内に集めます。

          'globs', 'name', 'filename', and 'lineno' are attributes for
          the new ‘DocTest’ object.  See the documentation for *note
          DocTest: 1a29. for more information.

      -- メソッド: get_examples (string, name='<string>')

          指定した文字列からすべての doctest 実行例を抽出し、 *note
          Example: 4590. オブジェクトからなるリストにして返します。各
          *note Example: 4590. の行番号は 0 から数えます。オプション引数
          'name' はこの文字列につける名前で、エラーメッセージにしか使わ
          れません。

      -- メソッド: parse (string, name='<string>')

          Divide the given string into examples and intervening text,
          and return them as a list of alternating *note Example: 4590.s
          and strings.  Line numbers for the ‘Example’s are 0-based.
          The optional argument 'name' is a name identifying this
          string, and is only used for error messages.


File: python.info,  Node: TestResults objects,  Next: DocTestRunner オブジェクト,  Prev: DocTestParser オブジェクト,  Up: 拡張 API

5.26.4.19 TestResults objects
.............................

 -- クラス: doctest.TestResults (failed, attempted)

      -- の属性: failed

          Number of failed tests.

      -- の属性: attempted

          Number of attempted tests.

      -- の属性: skipped

          Number of skipped tests.

          Added in version 3.13.


File: python.info,  Node: DocTestRunner オブジェクト,  Next: OutputChecker オブジェクト,  Prev: TestResults objects,  Up: 拡張 API

5.26.4.20 DocTestRunner オブジェクト
....................................

 -- クラス: doctest.DocTestRunner (checker=None, verbose=None,
          optionflags=0)

     *note DocTest: 1a29. 内の対話モード実行例を実行し、検証する際に用い
     られる処理クラスです。

     The comparison between expected outputs and actual outputs is done
     by an *note OutputChecker: 457a.  This comparison may be customized
     with a number of option flags; see section *note オプションフラグ:
     1134. for more information.  If the option flags are insufficient,
     then the comparison may also be customized by passing a subclass of
     ‘OutputChecker’ to the constructor.

     The test runner's display output can be controlled in two ways.
     First, an output function can be passed to *note run(): 4ee.; this
     function will be called with strings that should be displayed.  It
     defaults to ‘sys.stdout.write’.  If capturing the output is not
     sufficient, then the display output can be also customized by
     subclassing DocTestRunner, and overriding the methods *note
     report_start(): 45ac, *note report_success(): 45ad, *note
     report_unexpected_exception(): 45ae, and *note report_failure():
     45af.

     オプションのキーワード引数 'checker' には、 *note OutputChecker:
     457a. オブジェクト (またはその代替となるオブジェクト) を指定します
     。このオブジェクトは doctest 実行例の期待する出力と実際の出力との比
     較を行う際に使われます。

     オプションのキーワード引数 'verbose' は、 *note DocTestRunner:
     457b. の出すメッセージの冗長性を制御します。 'verbose' が ‘True’ の
     場合、各実行例を実行する都度、その実行例についての情報を出力します
     。 'verbose' が ‘False’ の場合、テストの失敗だけを出力します。
     'verbose' を指定しない場合や ‘None’ を指定した場合、コマンドライン
     スイッチ ‘-v’ を使った場合にのみ 'verbose' 出力を適用します。

     オプションのキーワード引数 'optionflags' を使うと、テストランナーが
     期待される出力と実際の出力を比較する方法や、テストの失敗を表示する
     方法を制御できます。詳しくは *note オプションフラグ: 1134. 節を参照
     してください。

     The test runner accumulates statistics.  The aggregated number of
     attempted, failed and skipped examples is also available via the
     *note tries: 45b0, *note failures: 45b1. and *note skips: 4ef.
     attributes.  The *note run(): 4ee. and *note summarize(): 4585.
     methods return a *note TestResults: 45a7. instance.

     *note DocTestRunner: 457b. defines the following methods:

      -- メソッド: report_start (out, test, example)

          テストランナーが実行例を処理しようとしているときにレポートを出
          力します。 *note DocTestRunner: 457b. の出力をサブクラスでカス
          タマイズできるようにするためのメソッドです。直接呼び出してはな
          りません。

          'example' is the example about to be processed.  'test' is the
          test containing 'example'.  'out' is the output function that
          was passed to *note DocTestRunner.run(): 4ee.

      -- メソッド: report_success (out, test, example, got)

          与えられた実行例が正しく動作したことを報告します。このメソッド
          は *note DocTestRunner: 457b. のサブクラスで出力をカスタマイズ
          できるようにするために提供されています; 直接呼び出してはなりま
          せん。

          'example' は処理する実行例です。 'got' は実行例から実際に得ら
          れた出力です。 'test' は 'example' の入っているテストです。
          'out' は出力用の関数で、 *note DocTestRunner.run(): 4ee. に渡
          されます。

      -- メソッド: report_failure (out, test, example, got)

          与えられた実行例が正しく動作しなかったことを報告します。このメ
          ソッドは *note DocTestRunner: 457b. のサブクラスで出力をカスタ
          マイズできるようにするために提供されています; 直接呼び出しては
          なりません。

          'example' は処理する実行例です。 'got' は実行例から実際に得ら
          れた出力です。 'test' は 'example' の入っているテストです。
          'out' は出力用の関数で、 *note DocTestRunner.run(): 4ee. に渡
          されます。

      -- メソッド: report_unexpected_exception (out, test, example,
               exc_info)

          与えられた実行例が期待とは違う例外を送出したことを報告します。
          このメソッドは *note DocTestRunner: 457b. のサブクラスで出力を
          カスタマイズできるようにするために提供されています; 直接呼び出
          してはなりません。

          'example' は処理する実行例です。 'exc_info' には予期せず送出さ
          れた例外の情報を入れたタプル (*note sys.exc_info(): 89a. の返
          す内容) になります。 'test' は 'example' の入っているテストで
          す。 'out' は出力用の関数で、 *note DocTestRunner.run(): 4ee.
          に渡されます。

      -- メソッド: run (test, compileflags=None, out=None,
               clear_globs=True)

          Run the examples in 'test' (a *note DocTest: 1a29. object),
          and display the results using the writer function 'out'.
          Return a *note TestResults: 45a7. instance.

          実行例は名前空間 ‘test.globs’ の下で実行されます。
          'clear_globs' が真 (デフォルト) の場合、名前空間はテストの実行
          後に消去され、ガベージコレクションを促します。テストの実行完了
          後にその内容を調べたければ、'clear_globs=False' としてください
          。

          'compileflags' には、実行例を実行する際に Python コンパイラに
          適用するフラグセットを指定します。'compileflags' を指定しない
          場合、デフォルト値は 'globs' で適用されている future-import フ
          ラグセットになります。

          The output of each example is checked using the *note
          DocTestRunner: 457b.'s output checker, and the results are
          formatted by the ‘DocTestRunner.report_*()’ methods.

      -- メソッド: summarize (verbose=None)

          Print a summary of all the test cases that have been run by
          this DocTestRunner, and return a *note TestResults: 45a7.
          instance.

          オプションの 'verbose' 引数を使うと、どのくらいサマリを詳しく
          するかを制御できます。冗長度を指定しない場合、 *note
          DocTestRunner: 457b. 自体の冗長度を使います。

     *note DocTestParser: 456c. has the following attributes:

      -- の属性: tries

          Number of attempted examples.

      -- の属性: failures

          Number of failed examples.

      -- の属性: skips

          Number of skipped examples.

          Added in version 3.13.


File: python.info,  Node: OutputChecker オブジェクト,  Prev: DocTestRunner オブジェクト,  Up: 拡張 API

5.26.4.21 OutputChecker オブジェクト
....................................

 -- クラス: doctest.OutputChecker

     doctest 実行例を実際に実行したときの出力が期待する出力と一致するか
     どうかをチェックするために使われるクラスです。 *note OutputChecker:
     457a. では、与えられた二つの出力を比較して、一致する場合には ‘True’
     を返す *note check_output(): 45b4. と、二つの出力間の違いを説明する
     文字列を返す *note output_difference(): 45b5. の、二つのメソッドが
     あります。

     *note OutputChecker: 457a. では以下のメソッドを定義しています:

      -- メソッド: check_output (want, got, optionflags)

          実行例から実際に得られた出力 ('got') と、期待する出力 ('want')
          が一致する場合にのみ ‘True’ を返します。二つの文字列がまったく
          同一の場合には常に一致するとみなしますが、テストランナーの使っ
          ているオプションフラグにより、厳密には同じ内容になっていなくて
          も一致するとみなす場合もあります。オプションフラグについての詳
          しい情報は *note オプションフラグ: 1134. 節を参照してください
          。

      -- メソッド: output_difference (example, got, optionflags)

          与えられた実行例 ('example') の期待する出力と、実際に得られた
          出力 ('got') の間の差異を解説している文字列を返します。
          'optionflags' は 'want' と 'got' を比較する際に使われるオプシ
          ョンフラグのセットです。


File: python.info,  Node: デバッグ,  Next: アドバイス,  Prev: 拡張 API,  Up: doctest --- 対話型の Python の例をテストする

5.26.4.22 デバッグ
..................

*note doctest: 3e. では、doctest 実行例をデバッグするメカニズムをいくつ
か提供しています:

   * doctest を実行可能な Python プログラムに変換し、 Python デバッガ
     *note pdb: aa. で実行できるようにするための関数がいくつかあります。

   * *note DocTestRunner: 457b. のサブクラス *note DebugRunner: 45b8. ク
     ラスがあります。このクラスは、最初に失敗した実行例に対して例外を送
     出します。例外には実行例に関する情報が入っています。この情報は実行
     例の検死デバッグに利用できます。

   * *note DocTestSuite(): ff4. の生成する *note unittest: 10c. テストケ
     ースは、 *note debug(): 45b9. メソッドをサポートしています。 *note
     debug(): 45b9. は *note unittest.TestCase: 2b3. で定義されています
     。

   * *note pdb.set_trace(): 272. を doctest 実行例の中で呼び出しておけば
     、その行が実行されたときに Python デバッガが組み込まれます。デバッ
     ガを組み込んだあとは、変数の現在の値などを調べられます。たとえば、
     以下のようなモジュールレベルの docstring の入ったファイル ‘a.py’ が
     あるとします:

          """
          >>> def f(x):
          ...     g(x*2)
          >>> def g(x):
          ...     print(x+3)
          ...     import pdb; pdb.set_trace()
          >>> f(3)
          9
          """

     対話セッションは以下のようになるでしょう:

          >>> import a, doctest
          >>> doctest.testmod(a)
          --Return--
          > <doctest a[1]>(3)g()->None
          -> import pdb; pdb.set_trace()
          (Pdb) list
            1     def g(x):
            2         print(x+3)
            3  ->     import pdb; pdb.set_trace()
          [EOF]
          (Pdb) p x
          6
          (Pdb) step
          --Return--
          > <doctest a[0]>(2)f()->None
          -> g(x*2)
          (Pdb) list
            1     def f(x):
            2  ->     g(x*2)
          [EOF]
          (Pdb) p x
          3
          (Pdb) step
          --Return--
          > <doctest a[2]>(1)?()->None
          -> f(3)
          (Pdb) cont
          (0, 3)
          >>>

以下は、doctest を Python コードに変換して、できたコードをデバッガ下で実
行できるようにするための関数です:

 -- の関数: doctest.script_from_examples (s)

     実行例の入ったテキストをスクリプトに変換します。

     引数 's' は doctest 実行例の入った文字列です。この文字列は Python ス
     クリプトに変換され、その中では 's' の doctest 実行例が通常のコード
     に、それ以外は Python のコメント文になります。生成したスクリプトを
     文字列で返します。例えば、

          import doctest
          print(doctest.script_from_examples(r"""
              Set x and y to 1 and 2.
              >>> x, y = 1, 2

              Print their sum:
              >>> print(x+y)
              3
          """))

     は:

          # Set x and y to 1 and 2.
          x, y = 1, 2
          #
          # Print their sum:
          print(x+y)
          # Expected:
          ## 3

     この関数は内部的に他の関数から使われていますが (下記参照)、対話セッ
     ションを Python スクリプトに変換したいような場合にも便利でしょう。

 -- の関数: doctest.testsource (module, name)

     あるオブジェクトの doctest をスクリプトに変換します。

     Argument 'module' is a module object, or dotted name of a module,
     containing the object whose doctests are of interest.  Argument
     'name' is the name (within the module) of the object with the
     doctests of interest.  The result is a string, containing the
     object's docstring converted to a Python script, as described for
     *note script_from_examples(): 45ba. above.  For example, if module
     ‘a.py’ contains a top-level function ‘f()’, then

          import a, doctest
          print(doctest.testsource(a, "a.f"))

     prints a script version of function ‘f()’'s docstring, with
     doctests converted to code, and the rest placed in comments.

 -- の関数: doctest.debug (module, name, pm=False)

     オブジェクトの持つ doctest をデバッグします。

     'module' および 'name' 引数は上の *note testsource(): 45bb. と同じ
     です。指定したオブジェクトの docstring から合成された Python スクリ
     プトは一時ファイルに書き出され、その後 Python デバッガ *note pdb:
     aa. の制御下で実行されます。

     ローカルおよびグローバルの実行コンテキストには、‘module.__dict__’ の
     浅いコピーが使われます。

     オプション引数 'pm' は、検死デバッグを行うかどうかを指定します。
     'pm' が真の場合、スクリプトファイルは直接実行され、スクリプトが送出
     した例外が処理されないまま終了した場合にのみデバッガが立ち入ります
     。その場合、 *note pdb.post_mortem(): 15f3. によって検死デバッグを
     起動し、処理されなかった例外から得られたトレースバックオブジェクト
     を渡します。 'pm' を指定しないか値を偽にした場合、 *note pdb.run():
     45bc. に適切な *note exec(): 4a2. 呼び出しを渡して、最初からデバッ
     ガの下でスクリプトを実行します。

 -- の関数: doctest.debug_src (src, pm=False, globs=None)

     文字列中の doctest をデバッグします。

     上の *note debug(): 45b9. に似ていますが、doctest の入った文字列は
     'src' 引数で直接指定します。

     オプション引数 'pm' は上の *note debug(): 45b9. と同じ意味です。

     オプション引数 'globs' には、ローカルおよびグローバルな実行コンテキ
     ストの両方に使われる辞書を指定します。'globs' を指定しない場合や
     ‘None’ にした場合、空の辞書を使います。辞書を指定した場合、実際の実
     行コンテキストには浅いコピーが使われます。

*note DebugRunner: 45b8. クラス自体や *note DebugRunner: 45b8. クラスが
送出する特殊な例外は、テストフレームワークの作者にとって非常に興味のある
ところですが、ここでは概要しか述べられません。詳しくはソースコード、とり
わけ *note DebugRunner: 45b8. の docstring (それ自体 doctest です!)  を
参照してください:

 -- クラス: doctest.DebugRunner (checker=None, verbose=None,
          optionflags=0)

     テストの失敗に遭遇するとすぐに例外を送出するようになっている *note
     DocTestRunner: 457b. のサブクラスです。予期しない例外が生じると、
     *note UnexpectedException: 45be. 例外を送出します。この例外には、テ
     スト、実行例、もともと送出された例外が入っています。期待する出力と
     実際の出力が一致しないために失敗した場合には、 *note
     DocTestFailure: 45bf. 例外を送出します。この例外には、テスト、実行
     例、実際の出力が入っています。

     コンストラクタのパラメータやメソッドについては、 *note 拡張 API:
     458f. 節の *note DocTestRunner: 457b. のドキュメントを参照してくだ
     さい。

*note DebugRunner: 45b8. インスタンスの送出する例外には以下の二つがあり
ます:

 -- 例外: doctest.DocTestFailure (test, example, got)

     doctest 実行例の実際の出力が期待する出力と一致しなかったことを示す
     ために *note DocTestRunner: 457b. が送出する例外です。コンストラク
     タの引数は、インスタンスの同名の属性を初期化するために使われます。

*note DocTestFailure: 45bf. では以下の属性を定義しています:

 -- の属性: DocTestFailure.test

     実行例が失敗した時に実行されていた *note DocTest: 1a29. オブジェク
     トです。

 -- の属性: DocTestFailure.example

     失敗した *note Example: 4590. オブジェクトです。

 -- の属性: DocTestFailure.got

     実行例の実際の出力です。

 -- 例外: doctest.UnexpectedException (test, example, exc_info)

     doctest 実行例が予期しない例外を送出したことを示すために *note
     DocTestRunner: 457b. が送出する例外です。コンストラクタの引数は、イ
     ンスタンスの同名の属性を初期化するために使われます。

*note UnexpectedException: 45be. では以下の属性を定義しています:

 -- の属性: UnexpectedException.test

     実行例が失敗した時に実行されていた *note DocTest: 1a29. オブジェク
     トです。

 -- の属性: UnexpectedException.example

     失敗した *note Example: 4590. オブジェクトです。

 -- の属性: UnexpectedException.exc_info

     予期しない例外についての情報の入ったタプルで、 *note
     sys.exc_info(): 89a. が返すのと同じものです。


File: python.info,  Node: アドバイス,  Prev: デバッグ,  Up: doctest --- 対話型の Python の例をテストする

5.26.4.23 アドバイス
....................

As mentioned in the introduction, ‘doctest’ has grown to have three
primary uses:

  1. docstring 内の実行例をチェックする。

  2. 回帰テストを行う。

  3. 実行可能なドキュメント/読めるテストの実現。

これらの用途にはそれぞれ違った要求があるので、区別して考えるのが重要です
。特に、docstring を曖昧なテストケースに埋もれさせてしまうとドキュメント
としては最悪です。

When writing a docstring, choose docstring examples with care.  There's
an art to this that needs to be learned--it may not be natural at first.
Examples should add genuine value to the documentation.  A good example
can often be worth many words.  If done with care, the examples will be
invaluable for your users, and will pay back the time it takes to
collect them many times over as the years go by and things change.  I'm
still amazed at how often one of my ‘doctest’ examples stops working
after a "harmless" change.

説明テキストの作成をけちらなければ、*note doctest: 3e. は回帰テストの優
れたツールにもなり得ます。説明文と実行例を交互に記述していけば、実際に何
をどうしてテストしているのかもっと簡単に把握できるようになるでしょう。も
ちろん、コードベースのテストに詳しくコメントを入れるのも手ですが、そんな
ことをするプログラマはほとんどいません。多くの人々が、*note doctest: 3e.
のアプローチをとった方がきれいにテストを書けると気づいています。おそらく
、これは単にコード中にコメントを書くのが少し面倒だからという理由でしょう
。私はもう少し穿った見方もしています。doctest ベースのテストを書くときの
自然な態度は、自分のソフトウェアのよい点を説明しようとして、実行例を使っ
て説明しようとするときの態度そのものだからだ、という理由です。それゆえに
、テストファイルは自然と単純な機能の解説から始め、論理的により複雑で境界
条件的なケースに進むような形になります。結果的に、一見ランダムに見えるよ
うな個別の機能をテストしている個別の関数の集まりではなく、首尾一貫した説
明ができるようになるのです。*note doctest: 3e. によるテストの作成はまっ
たく別の取り組み方であり、テストと説明の区別をなくして、まったく違う結果
を生み出すのです。

回帰テストは特定のオブジェクトやファイルにまとめておくのがよいでしょう。
回帰テストの組み方にはいくつか選択肢があります:

   * テストケースを対話モードの実行例にして入れたテキストファイルを書き
     、 *note testfile(): 455b. や *note DocFileSuite(): 458a. を使って
     そのファイルをテストします。この方法をお勧めします。最初から
     doctest を使うようにしている新たなプロジェクトでは、この方法が一番
     簡単です。

   * ‘_regrtest_topic’ という名前の関数を定義します。この関数には、ある
     トピックに対応するテストケースの入った docstring が一つだけ入ってい
     ます。この関数はモジュールと同じファイルの中にも置けますし、別のテ
     ストファイルに分けてもかまいません。

   * Define a *note __test__: 4567. dictionary mapping from regression
     test topics to docstrings containing test cases.

テストコードをモジュールに組み込むことで、そのモジュールは、モジュール自
身がテストランナーになることができます。テストが失敗した場合には、問題箇
所をデバッグする際に、失敗したdoctestだけを再度実行することで、作成した
テストランナーを修正することができます。これがこのようなテストランナーの
最小例となります。

     if __name__ == '__main__':
         import doctest
         flags = doctest.REPORT_NDIFF|doctest.FAIL_FAST
         if len(sys.argv) > 1:
             name = sys.argv[1]
             if name in globals():
                 obj = globals()[name]
             else:
                 obj = __test__[name]
             doctest.run_docstring_examples(obj, globals(), name=name,
                                            optionflags=flags)
         else:
             fail, total = doctest.testmod(optionflags=flags)
             print(f"{fail} failures out of {total} tests")

脚注
....


File: python.info,  Node: unittest --- ユニットテストフレームワーク,  Next: unittest mock --- モックオブジェクトライブラリ,  Prev: doctest --- 対話型の Python の例をテストする,  Up: 開発ツール

5.26.5 ‘unittest’ -- ユニットテストフレームワーク
-------------------------------------------------

'ソースコード:' Lib/unittest/__init__.py(1)

__________________________________________________________________

(すでにテストの基本概念について詳しいようでしたら、この部分をとばして
*note アサートメソッド一覧: 45cb. に進むと良いでしょう。)

The ‘unittest’ unit testing framework was originally inspired by JUnit
and has a similar flavor as major unit testing frameworks in other
languages.  It supports test automation, sharing of setup and shutdown
code for tests, aggregation of tests into collections, and independence
of the tests from the reporting framework.

To achieve this, ‘unittest’ supports some important concepts in an
object-oriented way:

テストフィクスチャ (test fixture)

     テストフィクスチャ ('test fixture') とは、テスト実行のために必要な
     準備や終了処理を指します。例: テスト用データベースの作成・ディレク
     トリ・サーバプロセスの起動など。

テストケース (test case)

     A 'test case' is the individual unit of testing.  It checks for a
     specific response to a particular set of inputs.  ‘unittest’
     provides a base class, *note TestCase: 2b3, which may be used to
     create new test cases.

テストスイート (test suite)

     テストスイート ('test suite') はテストケースとテストスイートの集ま
     りで、同時に実行しなければならないテストをまとめる場合に使用します
     。

テストランナー (test runner)

     テストランナー ('test runner') はテストの実行を管理し結果を提供する
     要素です。ランナーはグラフィカルインターフェースやテキストインター
     フェースを使用しても構いませんし、テストの実行結果を示す特別な値を
     返しても構いません。

参考
....

*note doctest: 3e. モジュール

     テストをサポートするもうひとつのモジュールで、このモジュールとは趣
     きがだいぶ異なります。

Simple Smalltalk Testing: With Patterns(2)

     Kent Beck's original paper on testing frameworks using the pattern
     shared by ‘unittest’.

pytest(3)

     サードパーティのユニットテストフレームワークでより軽量な構文でテス
     トを書くことができます。例えば、‘assert func(10) == 42’ のように書
     きます。

The Python Testing Tools Taxonomy(4)

     多くの Python のテストツールが一覧で紹介されています。ファンクショ
     ナルテストのフレームワークやモックライブラリも掲載されています。

Testing in Python メーリングリスト(5)

     Python でテストやテストツールについての議論に特化したグループです。

Python のソースコード配布物にあるスクリプト
‘Tools/unittestgui/unittestgui.py’ はテストディスカバリとテスト実行のた
めの GUI ツールです。 主な目的は単体テストの初心者が簡単に使えるようにす
ることです。 実際の生産環境では、 Buildbot(6), Jenkins(7) 、 GitHub
Actions(8), AppVeyor(9) のような継続的インテグレーションシステムでテスト
を実行することを推奨します。

* Menu:

* 基本的な例: 基本的な例<2>.
* コマンドラインインターフェイス: コマンドラインインターフェイス<2>.
* テストディスカバリ::
* テストコードの構成::
* 既存テストコードの再利用::
* テストのスキップと予期された失敗::
* サブテストを利用して繰り返しテストの区別を付ける::
* クラスと関数::
* クラスとモジュールのフィクスチャ::
* シグナルハンドリング::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/unittest/__init__.py

   (2) 
https://web.archive.org/web/20150315073817/http://www.xprogramming.com/testfram.htm

   (3) https://docs.pytest.org/

   (4) https://wiki.python.org/moin/PythonTestingToolsTaxonomy

   (5) http://lists.idyll.org/listinfo/testing-in-python

   (6) https://buildbot.net/

   (7) https://www.jenkins.io/

   (8) https://github.com/features/actions

   (9) https://www.appveyor.com/


File: python.info,  Node: 基本的な例<2>,  Next: コマンドラインインターフェイス<2>,  Up: unittest --- ユニットテストフレームワーク

5.26.5.1 基本的な例
...................

The ‘unittest’ module provides a rich set of tools for constructing and
running tests.  This section demonstrates that a small subset of the
tools suffice to meet the needs of most users.

以下は、三つの文字列メソッドをテストするスクリプトです:

     import unittest

     class TestStringMethods(unittest.TestCase):

         def test_upper(self):
             self.assertEqual('foo'.upper(), 'FOO')

         def test_isupper(self):
             self.assertTrue('FOO'.isupper())
             self.assertFalse('Foo'.isupper())

         def test_split(self):
             s = 'hello world'
             self.assertEqual(s.split(), ['hello', 'world'])
             # check that s.split fails when the separator is not a string
             with self.assertRaises(TypeError):
                 s.split(2)

     if __name__ == '__main__':
         unittest.main()

テストケースは、 *note unittest.TestCase: 2b3. のサブクラスとして作成し
ます。メソッド名が ‘test’ で始まる三つのメソッドがテストです。テストラン
ナーはこの命名規約によってテストを行うメソッドを検索します。

これらのテスト内では、予定の結果が得られていることを確かめるために *note
assertEqual(): 74c. を、条件のチェックに *note assertTrue(): 74a. や
*note assertFalse(): 74b. を、例外が発生する事を確認するために *note
assertRaises(): 750. をそれぞれ呼び出しています。 *note assert: b60. 文
の代わりにこれらのメソッドを使用すると、テストランナーでテスト結果を集計
してレポートを作成する事ができます。

*note setUp(): 1551. および *note tearDown(): 1552. メソッドによって各テ
ストメソッドの前後に実行する命令を実装することが出来ます。 詳細は *note
テストコードの構成: 45ce. を参照してください。

最後のブロックは簡単なテストの実行方法を示しています。 *note
unittest.main(): 11e5. は、テストスクリプトのコマンドライン用インターフ
ェースを提供します。コマンドラインから起動された場合、上記のスクリプトは
以下のような結果を出力します:

     ...
     ----------------------------------------------------------------------
     Ran 3 tests in 0.000s

     OK

‘-v’ オプションをテストスクリプトに渡すことで *note unittest.main():
11e5. はより冗長になり、以下のような出力をします:

     test_isupper (__main__.TestStringMethods.test_isupper) ... ok
     test_split (__main__.TestStringMethods.test_split) ... ok
     test_upper (__main__.TestStringMethods.test_upper) ... ok

     ----------------------------------------------------------------------
     Ran 3 tests in 0.001s

     OK

The above examples show the most commonly used ‘unittest’ features which
are sufficient to meet many everyday testing needs.  The remainder of
the documentation explores the full feature set from first principles.

バージョン 3.11 で変更: テストメソッドが（デフォルトの''None''以外の）戻
り値を返す挙動は現在非推奨です。


File: python.info,  Node: コマンドラインインターフェイス<2>,  Next: テストディスカバリ,  Prev: 基本的な例<2>,  Up: unittest --- ユニットテストフレームワーク

5.26.5.2 コマンドラインインターフェイス
.......................................

ユニットテストモジュールはコマンドラインから使って、モジュール、クラス、
あるいは個別のテストメソッドで定義されたテストを実行することが出来ます:

     python -m unittest test_module1 test_module2
     python -m unittest test_module.TestClass
     python -m unittest test_module.TestClass.test_method

モジュール名ならびに完全修飾されたクラス名やメソッド名の任意の組み合わせ
を一覧で渡すことが出来ます。

テストモジュールはファイルパスで指定することも出来ます:

     python -m unittest tests/test_something.py

そのため、テストモジュールを指定するのにシェルのファイル名補完が使えます
。指定されたファイルはやはりモジュールとしてインポート可能でなければなり
ません。パスから '.py' を取り除き、パスセパレータを '.'  に置き換えるこ
とでモジュール名に変換されます。モジュールとしてインポート可能でないテス
トファイルを実行したい場合は、代わりにそのファイルを直接実行するのが良い
でしょう。

テスト実行時に (より冗長な) 詳細を表示するには -v フラグを渡します:

     python -m unittest -v test_module

引数無しで実行すると *note テストディスカバリ: 45d0. が開始されます:

     python -m unittest

コマンドラインプションの一覧を表示するには以下のコマンドを実行します:

     python -m unittest -h

バージョン 3.2 で変更: 以前のバージョンでは、個々のテストメソッドしか実
行することができず、モジュール単位やクラス単位で実行することは不可能でし
た。

Added in version 3.14: Output is colorized by default and can be *note
controlled using environment variables: 1b7.

* Menu:

* コマンドラインオプション: コマンドラインオプション<5>.


File: python.info,  Node: コマンドラインオプション<5>,  Up: コマンドラインインターフェイス<2>

5.26.5.3 コマンドラインオプション
.................................

‘unittest’ には以下のコマンドラインオプションがあります:

 -- Option: -b, --buffer

     標準出力と標準エラーのストリームをテストの実行中にバッファします。
     テストが成功している間は結果の出力は破棄されます。テストの失敗やエ
     ラーの場合、出力は通常通り表示され、エラーメッセージに追加されます
     。

 -- Option: -c, --catch

     ‘Control’-‘C’ を実行中のテストが終了するまで遅延させ、そこまでの結
     果を出力します。二回目の ‘Control’-‘C’ は、通常通り *note
     KeyboardInterrupt: bc5. の例外を発生させます。

     この機能の仕組みについては、*note シグナルハンドリング: 45d4. を参
     照してください。

 -- Option: -f, --failfast

     初回のエラーもしくは失敗の時にテストを停止します。

 -- Option: -k

     パターンや部分文字列にマッチするテストメソッドとテストクラスのみ実
     行します。このオプションは複数回使うことができ、その場合はすべての
     パターンにマッチするテストケースが実行対象に含まれます。

     ワイルドカード(‘*’) を含むパターンは *note fnmatch.fnmatchcase():
     1c55. を使用してテスト名と照合され、それ以外の場合は単純な大文字と
     小文字を区別した部分文字列マッチングが使用されます。

     パターンは、テストローダがインポートする時の完全修飾されたテストメ
     ソッド名と照合されます。

     たとえば、 ‘-k foo’ は ‘foo_tests.SomeTest.test_something’,
     ‘bar_tests.SomeTest.test_foo’ にマッチし、
     ‘bar_tests.FooTest.test_something’ はマッチしません。

 -- Option: --locals

     トレースバック内の局所変数を表示します。

 -- Option: --durations N

     Show the N slowest test cases (N=0 for all).

Added in version 3.2: コマンドラインオプションの ‘-b’、‘-c’、‘-f’ が追加
されました。

Added in version 3.5: コマンドラインオプション ‘--locals’。

Added in version 3.7: コマンドラインオプション ‘-k’。

Added in version 3.12: コマンドラインオプション ‘--durations’。

コマンドラインによってテストディスカバリ、すなわちプロジェクトの全テスト
を実行したりサブセットのみを実行したりすることも出来ます。


File: python.info,  Node: テストディスカバリ,  Next: テストコードの構成,  Prev: コマンドラインインターフェイス<2>,  Up: unittest --- ユニットテストフレームワーク

5.26.5.4 テストディスカバリ
...........................

Added in version 3.2.

unittest はシンプルなテストディスカバリをサポートします。このテストディ
スカバリに対応するために、テストが定義された全ファイルは *note modules:
203e. もしくは *note packages: 204e. としてプロジェクトの最上位のディス
カバリでインポート可能である必要があります (つまり、これらのファイルは
*note identifiers: 22a0. として有効である必要があるということです)。

テストディスカバリは *note TestLoader.discover(): 11e7. で実装されていま
すが、コマンドラインから使う事も出来ます。その基本的な使い方は:

     cd project_directory
     python -m unittest discover

     注釈: ‘python -m unittest’ は ‘python -m unittest discover’ と等価
     なショートカットです。テストディスカバリに引数を渡したい場合は、
     ‘discover’ サブコマンドを明示的に使用しなければなりません。

‘discover’ サブコマンドには以下のオプションがあります:

 -- Option: -v, --verbose

     詳細な出力

 -- Option: -s, --start-directory directory

     ディスカバリを開始するディレクトリ (デフォルトは ‘.’)

 -- Option: -p, --pattern pattern

     テストファイル名を識別するパターン (デフォルトは ‘test*.py’)

 -- Option: -t, --top-level-directory directory

     プロジェクトの最上位のディスカバリのディレクトリ (デフォルトは開始
     のディレクトリ)

*note -s: 45dc. 、 *note -p: 45de. 、および *note -t: 45e0. オプションは
、この順番であれば位置引数として渡す事ができます。以下の二つのコマンドは
等価です:

     python -m unittest discover -s project_directory -p "*_test.py"
     python -m unittest discover project_directory "*_test.py"

パスと同様にパッケージ名を、例えば ‘myproject.subpackage.test’ のように
、開始ディレクトリとして渡すことができます。 指定したパッケージ名はイン
ポートされ、そのファイルシステム上の場所が開始ディレクトリとして使われま
す。

     注意: テストディスカバリはインポートによりテストを読み込みます。 一
     旦テストディスカバリが指定された開始ディレクトリから全テストファイ
     ルを見付けると、パスはインポートするパッケージ名に変換されます。 例
     えば、 ‘foo/bar/baz.py’ は ‘foo.bar.baz’ としてインポートされます。

     グローバルにインストールされたパッケージがあり、それとは異なるコピ
     ーでディスカバリしようとしたとき、誤った場所からインポートが行われ
     る 'かもしれません'。 その場合テストディスカバリは警告し、停止しま
     す。

     ディレクトリのパスではなくパッケージ名を開始ディレクトリに指定した
     場合、ディスカバリはインポートするいずれの場所も意図した場所とする
     ため、警告を受けないはずです。

テストモジュールとパッケージは、 *note load_tests プロトコル: 45e2. によ
ってテストのロードとディスカバリをカスタマイズすることができます。

バージョン 3.4 で変更: ディスカバリが *note 名前空間パッケージ: 2b2. を
サポートしました。

バージョン 3.11 で変更: Test discovery dropped the *note namespace
packages: 2b2. support.  It has been broken since Python 3.7.  Start
directory and its subdirectories containing tests must be regular
package that have ‘__init__.py’ file.

If the start directory is the dotted name of the package, the ancestor
packages can be namespace packages.

バージョン 3.14 で変更: Test discovery supports *note namespace package:
2b2. as start directory again.  To avoid scanning directories unrelated
to Python, tests are not searched in subdirectories that do not contain
‘__init__.py’.


File: python.info,  Node: テストコードの構成,  Next: 既存テストコードの再利用,  Prev: テストディスカバリ,  Up: unittest --- ユニットテストフレームワーク

5.26.5.5 テストコードの構成
...........................

The basic building blocks of unit testing are 'test cases' -- single
scenarios that must be set up and checked for correctness.  In
‘unittest’, test cases are represented by *note unittest.TestCase: 2b3.
instances.  To make your own test cases you must write subclasses of
*note TestCase: 2b3. or use *note FunctionTestCase: 1a79.

*note TestCase: 2b3. インスタンスのテストコードは完全に独立していなけれ
ばなりません。 すなわち単独でか、他の様々なテストケースの任意の組み合わ
せのいずれかで実行可能でなければなりません。

最も単純な *note TestCase: 2b3. のサブクラスは、特定のテストコードを実行
するためのテストメソッド (すなわち名前が ‘test’ で始まるメソッド) を実装
するだけで簡単に書くことができます:

     import unittest

     class DefaultWidgetSizeTestCase(unittest.TestCase):
         def test_default_widget_size(self):
             widget = Widget('The widget')
             self.assertEqual(widget.size(), (50, 50))

Note that in order to test something, we use one of the *note assert*
methods: 45cb. provided by the *note TestCase: 2b3. base class.  If the
test fails, an exception will be raised with an explanatory message, and
‘unittest’ will identify the test case as a 'failure'.  Any other
exceptions will be treated as 'errors'.

テストは多くなり、それらの設定は繰り返しになるかもしれません。 幸いにも
、*note setUp(): 1551. メソッドを実装することで設定コードをくくり出すこ
とができます。 テストフレームワークは実行するテストごとに自動的に *note
setUp(): 1551. を呼びます:

     import unittest

     class WidgetTestCase(unittest.TestCase):
         def setUp(self):
             self.widget = Widget('The widget')

         def test_default_widget_size(self):
             self.assertEqual(self.widget.size(), (50,50),
                              'incorrect default size')

         def test_widget_resize(self):
             self.widget.resize(100,150)
             self.assertEqual(self.widget.size(), (100,150),
                              'wrong size after resize')

     注釈: いろいろなテストが実行される順序は、文字列の組み込みの順序で
     テストメソッド名をソートすることで決まります。

テスト中に *note setUp(): 1551. メソッドで例外が発生した場合、フレームワ
ークはそのテストに問題があるとみなし、そのテストメソッドは実行されません
。

同様に、テストメソッド実行後に片付けをする *note tearDown(): 1552. メソ
ッドを提供出来ます:

     import unittest

     class WidgetTestCase(unittest.TestCase):
         def setUp(self):
             self.widget = Widget('The widget')

         def tearDown(self):
             self.widget.dispose()

*note setUp(): 1551. が成功した場合、テストメソッドが成功したかどうかに
関わらず *note tearDown(): 1552. が実行されます。

そのようなテストコードのための作業環境は 'テストフィクスチャ (test
fixture)' と呼ばれます。 新しい TestCase インスタンスはある単一のテスト
フィクスチャとして作成され、個々のテストメソッドを実行するのに使われます
。 従って、 *note setUp(): 1551, *note tearDown(): 1552,
‘TestCase.__init__()’ は1回のテストにつき1回だけ呼び出されます。

It is recommended that you use TestCase implementations to group tests
together according to the features they test.  ‘unittest’ provides a
mechanism for this: the 'test suite', represented by ‘unittest’'s *note
TestSuite: ff5. class.  In most cases, calling *note unittest.main():
11e5. will do the right thing and collect all the module's test cases
for you and execute them.

しかし、テストスイートの構築をカスタマイズしたい場合、自分ですることがで
きます:

     def suite():
         suite = unittest.TestSuite()
         suite.addTest(WidgetTestCase('test_default_widget_size'))
         suite.addTest(WidgetTestCase('test_widget_resize'))
         return suite

     if __name__ == '__main__':
         runner = unittest.TextTestRunner()
         runner.run(suite())

テストケースやテストコードの定義を (‘widget.py’ のような) テスト対象コー
ドと同じモジュールに置くことが出来ますが、テストコードを
(‘test_widget.py’ のような) 独立したモジュールに置くのには以下のような利
点があります:

   * テストモジュールだけをコマンドラインから独立に実行することができる
     。

   * テストコードと出荷するコードをより簡単に分ける事ができる。

   * 余程のことがない限り、テスト対象のコードに合わせてテストコードを変
     更することになりにくい。

   * テストコードは、テスト対象コードほど頻繁に変更されない。

   * テストコードをより簡単にリファクタリングすることができる。

   * Cで書いたモジュールのテストはどうせ独立したモジュールなのだから、同
     様にしない理由がない

   * テストの方策を変更した場合でも、ソースコードを変更する必要がない。


File: python.info,  Node: 既存テストコードの再利用,  Next: テストのスキップと予期された失敗,  Prev: テストコードの構成,  Up: unittest --- ユニットテストフレームワーク

5.26.5.6 既存テストコードの再利用
.................................

Some users will find that they have existing test code that they would
like to run from ‘unittest’, without converting every old test function
to a *note TestCase: 2b3. subclass.

For this reason, ‘unittest’ provides a *note FunctionTestCase: 1a79.
class.  This subclass of *note TestCase: 2b3. can be used to wrap an
existing test function.  Set-up and tear-down functions can also be
provided.

以下のテストコードがあった場合:

     def testSomething():
         something = makeSomething()
         assert something.name is not None
         # ...

オプションの set-up と tear-down メソッドを持った同等のテストケースイン
スタンスは次のように作成します:

     testcase = unittest.FunctionTestCase(testSomething,
                                          setUp=makeSomethingDB,
                                          tearDown=deleteSomethingDB)

     注釈: Even though *note FunctionTestCase: 1a79. can be used to
     quickly convert an existing test base over to a ‘unittest’-based
     system, this approach is not recommended.  Taking the time to set
     up proper *note TestCase: 2b3. subclasses will make future test
     refactorings infinitely easier.

既存のテストが *note doctest: 3e. を使って書かれている場合もあるでしょう
。その場合、 *note doctest: 3e. は *note DocTestSuite: ff4. クラスを提供
します。このクラスは、既存の *note doctest: 3e.ベースのテストから、自動
的に *note unittest.TestSuite: ff5. のインスタンスを作成します。


File: python.info,  Node: テストのスキップと予期された失敗,  Next: サブテストを利用して繰り返しテストの区別を付ける,  Prev: 既存テストコードの再利用,  Up: unittest --- ユニットテストフレームワーク

5.26.5.7 テストのスキップと予期された失敗
.........................................

Added in version 3.1.

unittest は特定のテストメソッドやテストクラス全体をスキップする仕組みを
備えています。さらに、この機能はテスト結果を「予期された失敗 (expected
failure)」とすることができ、テストが失敗しても *note TestResult: 137f. の
失敗数にはカウントされなくなります。

テストをスキップするには、 *note skip(): 1dbe. *note デコレータ: 93a. か
その条件付きバージョンの一つを使うか、*note setUp(): 1551. やテストメソ
ッドの中で *note TestCase.skipTest(): 45e8. を呼び出すか、あるいは直接
*note SkipTest: 11e6. を送出するだけです。

基本的なスキップは以下のようになります:

     class MyTestCase(unittest.TestCase):

         @unittest.skip("demonstrating skipping")
         def test_nothing(self):
             self.fail("shouldn't happen")

         @unittest.skipIf(mylib.__version__ < (1, 3),
                          "not supported in this library version")
         def test_format(self):
             # Tests that work for only a certain version of the library.
             pass

         @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
         def test_windows_support(self):
             # windows specific testing code
             pass

         def test_maybe_skipped(self):
             if not external_resource_available():
                 self.skipTest("external resource not available")
             # test code that depends on the external resource
             pass

このサンプルを冗長モードで実行すると以下のように出力されます:

     test_format (__main__.MyTestCase.test_format) ... skipped 'not supported in this library version'
     test_nothing (__main__.MyTestCase.test_nothing) ... skipped 'demonstrating skipping'
     test_maybe_skipped (__main__.MyTestCase.test_maybe_skipped) ... skipped 'external resource not available'
     test_windows_support (__main__.MyTestCase.test_windows_support) ... skipped 'requires Windows'

     ----------------------------------------------------------------------
     Ran 4 tests in 0.005s

     OK (skipped=4)

テストクラスは以下のようにメソッドをスキップすることができます:

     @unittest.skip("showing class skipping")
     class MySkippedTestCase(unittest.TestCase):
         def test_not_run(self):
             pass

*note TestCase.setUp(): 1551. もスキップすることができます。この機能はセ
ットアップの対象のリソースが使用不可能な時に便利です。

予期された失敗の機能を使用するには *note expectedFailure(): 45e9. デコレ
ータを使います。

     class ExpectedFailureTestCase(unittest.TestCase):
         @unittest.expectedFailure
         def test_fail(self):
             self.assertEqual(1, 0, "broken")

独自のスキップ用のデコレータの作成は簡単です。 そのためには、独自のデコ
レータのスキップしたい時点で *note skip(): 1dbe. を呼び出します。 以下の
デコレータはオブジェクトに指定した属性が無い場合にテストをスキップします
:

     def skipUnlessHasattr(obj, attr):
         if hasattr(obj, attr):
             return lambda func: func
         return unittest.skip("{!r} doesn't have {!r}".format(obj, attr))

以下のデコレータと例外はテストのスキップと予期された失敗を実装しています
:

 -- の関数: @unittest.skip (reason)

     デコレートしたテストを無条件でスキップします。'reason' にはテストを
     スキップした理由を記載します。

 -- の関数: @unittest.skipIf (condition, reason)

     'condition' が真の場合、デコレートしたテストをスキップします。

 -- の関数: @unittest.skipUnless (condition, reason)

     'condition' が偽の場合、デコレートしたテストをスキップします。

 -- の関数: @unittest.expectedFailure

     失敗またはエラーが予測されるものとしてテストをマークします。テスト
     が失敗するか ('test fixture' メソッドのいずれかではなく、) テスト関
     数そのものでエラーとなった場合に成功したとみなされます。テストが成
     功した場合は失敗とみなされます。

 -- 例外: unittest.SkipTest (reason)

     この例外はテストをスキップするために送出されます。

     ふつうはこれを直接送出する代わりに *note TestCase.skipTest(): 45e8.
     やスキッピングデコレータの一つを使用出来ます。

スキップしたテストの前後では、 *note setUp(): 1551. および *note
tearDown(): 1552. は実行されません。同様に、スキップしたクラスの前後では
、 *note setUpClass(): c43. および *note tearDownClass(): 154f. は実行さ
れません。スキップしたモジュールの前後では、 *note setUpModule(): c42. お
よび *note tearDownModule(): 154e. は実行されません。


File: python.info,  Node: サブテストを利用して繰り返しテストの区別を付ける,  Next: クラスと関数,  Prev: テストのスキップと予期された失敗,  Up: unittest --- ユニットテストフレームワーク

5.26.5.8 サブテストを利用して繰り返しテストの区別を付ける
.........................................................

Added in version 3.4.

テストの間にとても小さな差異がある場合（例えばいくつかのパラメータなど）
、unittestでは *note subTest(): 11e3. コンテキストマネージャを使用してテ
ストメソッドの内部でそれらを区別することができます。

例えば以下のテストは:

     class NumbersTest(unittest.TestCase):

         def test_even(self):
             """
             Test that numbers between 0 and 5 are all even.
             """
             for i in range(0, 6):
                 with self.subTest(i=i):
                     self.assertEqual(i % 2, 0)

以下の出力をします:

     ======================================================================
     FAIL: test_even (__main__.NumbersTest.test_even) (i=1)
     Test that numbers between 0 and 5 are all even.
     ----------------------------------------------------------------------
     Traceback (most recent call last):
       File "subtests.py", line 11, in test_even
         self.assertEqual(i % 2, 0)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
     AssertionError: 1 != 0

     ======================================================================
     FAIL: test_even (__main__.NumbersTest.test_even) (i=3)
     Test that numbers between 0 and 5 are all even.
     ----------------------------------------------------------------------
     Traceback (most recent call last):
       File "subtests.py", line 11, in test_even
         self.assertEqual(i % 2, 0)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
     AssertionError: 1 != 0

     ======================================================================
     FAIL: test_even (__main__.NumbersTest.test_even) (i=5)
     Test that numbers between 0 and 5 are all even.
     ----------------------------------------------------------------------
     Traceback (most recent call last):
       File "subtests.py", line 11, in test_even
         self.assertEqual(i % 2, 0)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
     AssertionError: 1 != 0

サブテスト無しの場合、最初の失敗で実行は停止し、‘i’ の値が表示されないた
めエラーの原因を突き止めるのは困難になります:

     ======================================================================
     FAIL: test_even (__main__.NumbersTest.test_even)
     ----------------------------------------------------------------------
     Traceback (most recent call last):
       File "subtests.py", line 32, in test_even
         self.assertEqual(i % 2, 0)
     AssertionError: 1 != 0


File: python.info,  Node: クラスと関数,  Next: クラスとモジュールのフィクスチャ,  Prev: サブテストを利用して繰り返しテストの区別を付ける,  Up: unittest --- ユニットテストフレームワーク

5.26.5.9 クラスと関数
.....................

This section describes in depth the API of ‘unittest’.

* Menu:

* テストクラス::
* テストのグループ化::
* テストのロードと起動::


File: python.info,  Node: テストクラス,  Next: テストのグループ化,  Up: クラスと関数

5.26.5.10 テストクラス
......................

 -- クラス: unittest.TestCase (methodName='runTest')

     Instances of the *note TestCase: 2b3. class represent the logical
     test units in the ‘unittest’ universe.  This class is intended to
     be used as a base class, with specific tests being implemented by
     concrete subclasses.  This class implements the interface needed by
     the test runner to allow it to drive the tests, and methods that
     the test code can use to check for and report various kinds of
     failure.

     *note TestCase: 2b3. の各インスタンスは 'methodName' という名前の単
     一の基底メソッドを実行します。 *note TestCase: 2b3. を使用する大半
     の場合 'methodName' を変更したりデフォルトの ‘runTest()’ メソッドを
     再実装することはありません。

     バージョン 3.2 で変更: *note TestCase: 2b3. が 'methodName' を指定
     しなくてもインスタンス化できるようになりました。これにより対話的イ
     ンタプリタから *note TestCase: 2b3. を簡単に試せるようになりました
     。

     *note TestCase: 2b3. のインスタンスのメソッドは3種類のグループを提
     供します。 1つ目のグループはテストの実行で使用されます。 2つ目のグ
     ループは条件のチェックおよび失敗のレポートを行うテストの実装で使用
     されます。 3つ目のグループである問い合わせ用のメソッドによってテス
     ト自身の情報が収集されます。

     はじめのグループ (テスト実行) に含まれるメソッドは以下の通りです:

      -- メソッド: setUp ()

          テストフィクスチャの準備のために呼び出されるメソッドです。テス
          トメソッドの直前に呼び出されます。このメソッドで *note
          AssertionError: 8b8. や *note SkipTest: 11e6. 以外の例外が発生
          した場合、テストの失敗ではなくエラーとされます。デフォルトの実
          装では何も行いません。

      -- メソッド: tearDown ()

          テストメソッドが実行され、結果が記録された直後に呼び出されるメ
          ソッドです。 このメソッドはテストメソッドで例外が投げられても
          呼び出されます。 そのため、サブクラスでこのメソッドを実装する
          場合は、内部状態を確認することが必要になるでしょう。 このメソ
          ッドで *note AssertionError: 8b8. や *note SkipTest: 11e6. 以
          外の例外が発生した場合、テストの失敗とは別のエラーとみなされま
          す (従って報告されるエラーの総数は増えます)。 このメソッドは、
          テストの結果に関わらず *note setUp(): 1551. が成功した場合にの
          み呼ばれます。 デフォルトの実装では何も行いません。

      -- メソッド: setUpClass ()

          個別のクラス内のテストが実行される前に呼び出されるクラスメソッ
          ドです。 ‘setUpClass’ はクラスを唯一の引数として取り、 *note
          classmethod(): 48e. でデコレートされていなければなりません:

               @classmethod
               def setUpClass(cls):
                   ...

          詳しくは *note クラスとモジュールのフィクスチャ: 45f1. を参照
          してください。

          Added in version 3.2.

      -- メソッド: tearDownClass ()

          個別のクラス内のテストが実行された後に呼び出されるクラスメソッ
          ドです。 ‘tearDownClass’ はクラスを唯一の引数として取り、
          *note classmethod(): 48e. でデコレートされていなければなりませ
          ん:

               @classmethod
               def tearDownClass(cls):
                   ...

          詳しくは *note クラスとモジュールのフィクスチャ: 45f1. を参照
          してください。

          Added in version 3.2.

      -- メソッド: run (result=None)

          テストを実行し、テスト結果を 'result' に指定された *note
          TestResult: 137f. オブジェクトにまとめます。 'result' が省略さ
          れるか ‘None’ が渡された場合、 (*note defaultTestResult():
          45f2. メソッドを呼んで) 一時的な結果オブジェクトを生成し、使用
          します。 結果オブジェクトは *note run(): 137e. の呼び出し元に
          返されます。

          このメソッドは、単に *note TestCase: 2b3. インスタンスを呼び出
          した場合と同様に振る舞います。

          バージョン 3.3 で変更: 以前のバージョンの ‘run’ は結果オブジェ
          クトを返しませんでした。また *note TestCase: 2b3. インスタンス
          を呼び出した場合も同様でした。

      -- メソッド: skipTest (reason)

          テストメソッドや *note setUp(): 1551. が現在のテストをスキップ
          する間に呼ばれます。詳細については、 *note
          テストのスキップと予期された失敗: 45e7. を参照してください。

          Added in version 3.1.

      -- メソッド: subTest (msg=None, **params)

          このメソッドを囲っているブロックをサブテストとして実行するコン
          テキストマネージャを返します。 'msg' と 'params' はサブテスト
          が失敗したときに表示されるオプションの任意の値で、どんな値が使
          われたかを明確にするものです。

          テストケースには subtest 宣言を幾らでも含めることができ、任意
          にネストすることができます。

          詳細は *note サブテストを利用して繰り返しテストの区別を付ける:
          11e4. を参照してください。

          Added in version 3.4.

      -- メソッド: debug ()

          テスト結果を収集せずにテストを実行します。例外が呼び出し元に通
          知されます。また、テストをデバッガで実行することができます。
     *note TestCase: 2b3. クラスは失敗の検査と報告を行う多くのメソッドを
     提供しています。 以下の表は最も一般的に使われるメソッドを列挙してい
     ます (より多くのアサートメソッドについては表の下を見てください):

     メソッド                                      確認事項                          初出
                                                                                     
     ----------------------------------------------------------------------------------------------------
                                                                                     
     *note assertEqual(a, b): 74c.                 ‘a == b’
                                                   
                                                                                     
     *note assertNotEqual(a, b): 74d.              ‘a != b’
                                                   
                                                                                     
     *note assertTrue(x): 74a.                     ‘bool(x) is True’
                                                   
                                                                                     
     *note assertFalse(x): 74b.                    ‘bool(x) is False’
                                                   
                                                                                     
     *note assertIs(a, b): 1553.                   ‘a is b’                          3.1
                                                                                     
                                                                                     
     *note assertIsNot(a, b): 1554.                ‘a is not b’                      3.1
                                                                                     
                                                                                     
     *note assertIsNone(x): 14a2.                  ‘x is None’                       3.1
                                                                                     
                                                                                     
     *note assertIsNotNone(x): 14a3.               ‘x is not None’                   3.1
                                                                                     
                                                                                     
     *note assertIn(a, b): 155c.                   ‘a in b’                          3.1
                                                                                     
                                                                                     
     *note assertNotIn(a, b): 155d.                ‘a not in b’                      3.1
                                                                                     
                                                                                     
     *note assertIsInstance(a, b): 1555.           ‘isinstance(a, b)’                3.2
                                                                                     
                                                                                     
     *note assertNotIsInstance(a, b): 1556.        ‘not isinstance(a, b)’            3.2
                                                                                     
                                                                                     
     *note assertIsSubclass(a, b): 2b6.            ‘issubclass(a, b)’                3.14
                                                                                     
                                                                                     
     *note assertNotIsSubclass(a, b): 2b7.         ‘not issubclass(a, b)’            3.14
                                                                                     

     全てのアサートメソッドは 'msg' 引数を受け取り、指定された場合、失敗
     時のエラーメッセージとして使われます。 (*note longMessage: 154d. も
     参照してください)。 'msg' キーワード引数は *note assertRaises():
     750. 、 *note assertRaisesRegex(): 752. 、 *note assertWarns():
     137c. 、 *note assertWarnsRegex(): 137d. には、そのメソッドをコンテ
     キストマネージャとして使った場合にのみ使えます。

      -- メソッド: assertEqual (first, second, msg=None)

          'first' と 'second' が等しいことをテストします。両者が等しくな
          い場合、テストは失敗です。

          さらに、 'first' と 'second' が厳密に同じ型であり、list、
          tuple、dict、set、frozenset もしくは str のいずれか、またはサ
          ブクラスが *note addTypeEqualityFunc(): 1560. に登録されている
          任意の型の場合、より有用なデフォルトのエラーメッセージを生成す
          るために、その型特有の比較関数が呼ばれます（*note
          型固有のメソッドの一覧: 45f3. も参照してください）。

          バージョン 3.1 で変更: 自動で型固有の比較関数が呼ばれるように
          なりました。

          バージョン 3.2 で変更: 文字列比較のデフォルトの比較関数として
          *note assertMultiLineEqual(): 155b. が追加されました。

      -- メソッド: assertNotEqual (first, second, msg=None)

          'first' と 'second' が等しくないことをテストします。両者が等し
          い場合、テストは失敗です。

      -- メソッド: assertTrue (expr, msg=None)
      -- メソッド: assertFalse (expr, msg=None)

          'expr' が真 (偽) であることをテストします。

          このメソッドは、‘bool(expr) is True’ と等価であり、‘expr is
          True’ と等価ではないことに注意が必要です (後者のためには、
          ‘assertIs(expr, True)’ が用意されています)。また、専用のメソッ
          ドが使用できる場合には、そちらを使用してください (例えば
          ‘assertTrue(a == b)’ の代わりに ‘assertEqual(a, b)’ を使用して
          ください)。そうすることにより、テスト失敗時のエラーメッセージ
          を詳細に表示することができます。

      -- メソッド: assertIs (first, second, msg=None)
      -- メソッド: assertIsNot (first, second, msg=None)

          'first' と 'second' が同じオブジェクトであること (またはそうで
          ないこと) をテストします。

          Added in version 3.1.

      -- メソッド: assertIsNone (expr, msg=None)
      -- メソッド: assertIsNotNone (expr, msg=None)

          'expr' が ‘None’ であること (および、そうでないこと) をテスト
          します。

          Added in version 3.1.

      -- メソッド: assertIn (member, container, msg=None)
      -- メソッド: assertNotIn (member, container, msg=None)

          'member' が 'container' に含まれること (またはそうでないこと)
          をテストします。

          Added in version 3.1.

      -- メソッド: assertIsInstance (obj, cls, msg=None)
      -- メソッド: assertNotIsInstance (obj, cls, msg=None)

          'obj' が 'cls' のインスタンスであること (あるいはそうでないこ
          と) をテストします (この 'cls' は、 *note isinstance(): 2ad. が
          扱うことのできる、クラスもしくはクラスのタプルである必要があり
          ます)。正確な型をチェックするためには、 *note
          assertIs(type(obj), cls): 1553. を使用してください。

          Added in version 3.2.

      -- メソッド: assertIsSubclass (cls, superclass, msg=None)
      -- メソッド: assertNotIsSubclass (cls, superclass, msg=None)

          Test that 'cls' is (or is not) a subclass of 'superclass'
          (which can be a class or a tuple of classes, as supported by
          *note issubclass(): 9c4.).  To check for the exact type, use
          *note assertIs(cls, superclass): 1553.

          Added in version 3.14.

     以下のメソッドを使用して例外、警告、およびログメッセージの発生を確
     認することが出来ます:

     メソッド                                                      確認事項                                   初出
                                                                                                              
     --------------------------------------------------------------------------------------------------------------------------
                                                                                                              
     *note assertRaises(exc, fun, *args, **kwds): 750.             ‘fun(*args, **kwds)’ が 'exc' を送出する
                                                                   
                                                                                                              
     *note assertRaisesRegex(exc, r, fun, *args, **kwds): 752.     ‘fun(*args, **kwds)’ が 'exc' を送出して   3.1
                                                                   メッセージが正規表現 'r' とマッチする      
                                                                   
                                                                                                              
     *note assertWarns(warn, fun, *args, **kwds): 137c.            ‘fun(*args, **kwds)’ が 'warn' を送出す    3.2
                                                                   る                                         
                                                                   
                                                                                                              
     *note assertWarnsRegex(warn, r, fun, *args, **kwds): 137d.    ‘fun(*args, **kwds)’ が 'warn' を送出し    3.2
                                                                   てメッセージが正規表現 'r' とマッチする    
                                                                   
                                                                                                              
     *note assertLogs(logger, level): a59.                         ‘with’ ブロックが 最低 'level' で          3.4
                                                                   'logger' を使用する                        
                                                                   
                                                                                                              
     *note assertNoLogs(logger, level): a58.                       The ‘with’ block does not log on           3.10
                                                                                                              
                                                                        'logger' with minimum 'level'
                                                                   

      -- メソッド: assertRaises (exception, callable, *args, **kwds)

      -- メソッド: assertRaises (exception, *, msg=None)

          'callable' を呼び出した時に例外が発生することをテストします。
          *note assertRaises(): 750. で指定した位置パラメータとキーワー
          ドパラメータを該当メソッドに渡します。 'exception' が送出され
          た場合、テストは成功です。また、他の例外が投げられた場合はエラ
          ー、例外が送出されなかった場合は失敗になります。複数の例外をキ
          ャッチする場合には、例外クラスのタプルを 'exception' に指定し
          てください。

          'exception' 引数のみ（またはそれに加えて 'msg' 引数）が渡され
          た場合には、コンテキストマネージャが返されます。これにより関数
          名を渡す形式ではなく、インラインでテスト対象のコードを書くこと
          ができます:

               with self.assertRaises(SomeException):
                   do_something()

          コンテキストマネージャとして使われたときは、 *note
          assertRaises(): 750. は加えて 'msg' キーワード引数も受け付けま
          す。

          このコンテキストマネージャは ‘exception’ で指定されたオブジェ
          クトを格納します。これにより、例外発生時の詳細な確認をおこなう
          ことができます:

               with self.assertRaises(SomeException) as cm:
                   do_something()

               the_exception = cm.exception
               self.assertEqual(the_exception.error_code, 3)

          バージョン 3.1 で変更: *note assertRaises(): 750. がコンテキス
          トマネージャとして使えるようになりました。

          バージョン 3.2 で変更: ‘exception’ 属性が追加されました。

          バージョン 3.3 で変更: コンテキストマネージャとして使用したと
          きに 'msg' キーワード引数が追加されました。

      -- メソッド: assertRaisesRegex (exception, regex, callable, *args,
               **kwds)

      -- メソッド: assertRaisesRegex (exception, regex, *, msg=None)

          *note assertRaises(): 750. と同等ですが、例外の文字列表現が
          'regex' にマッチすることもテストします。 'regex' は正規表現オ
          ブジェクトか、 *note re.search(): 1444. が扱える正規表現が書か
          れた文字列である必要があります。例えば以下のようになります:

               self.assertRaisesRegex(ValueError, "invalid literal for.*XYZ'$",
                                      int, 'XYZ')

          もしくは:

               with self.assertRaisesRegex(ValueError, 'literal'):
                  int('XYZ')

          Added in version 3.1: ‘assertRaisesRegexp’ という名前で追加さ
          れました。

          バージョン 3.2 で変更: *note assertRaisesRegex(): 752. にリネ
          ームされました。

          バージョン 3.3 で変更: コンテキストマネージャとして使用したと
          きに 'msg' キーワード引数が追加されました。

      -- メソッド: assertWarns (warning, callable, *args, **kwds)

      -- メソッド: assertWarns (warning, *, msg=None)

          'callable' を呼び出した時に警告が発生することをテストします。
          *note assertWarns(): 137c. で指定した位置パラメータとキーワー
          ドパラメータを該当メソッドに渡します。 'warning' が発生した場
          合にテストが成功し、そうでなければ失敗になります。例外が送出さ
          れた場合はエラーになります。複数の警告を捕捉する場合には、警告
          クラスのタプルを 'warnings' に指定してください。

          'warning' 引数のみ（またはそれに加えて 'msg' 引数）が渡された
          場合には、コンテキストマネージャが返されます。これにより関数名
          を渡す形式ではなく、インラインでテスト対象のコードを書くことが
          できます:

               with self.assertWarns(SomeWarning):
                   do_something()

          コンテキストマネージャとして使われたときは、 *note
          assertWarns(): 137c. は加えて 'msg' キーワード引数も受け付けま
          す。

          このコンテキストマネージャは、捕捉した警告オブジェクトを
          ‘warning’ 属性に、警告が発生したソース行を ‘filename’ 属性と
          ‘lineno’ 属性に格納します。これは警告発生時に捕捉された警告に
          対して追加の確認を行いたい場合に便利です:

               with self.assertWarns(SomeWarning) as cm:
                   do_something()

               self.assertIn('myfile.py', cm.filename)
               self.assertEqual(320, cm.lineno)

          このメソッドは呼び出されたときに警告フィルタを無視して動作しま
          す。

          Added in version 3.2.

          バージョン 3.3 で変更: コンテキストマネージャとして使用したと
          きに 'msg' キーワード引数が追加されました。

      -- メソッド: assertWarnsRegex (warning, regex, callable, *args,
               **kwds)

      -- メソッド: assertWarnsRegex (warning, regex, *, msg=None)

          *note assertWarns(): 137c. と同等ですが、警告メッセージが
          'regex' にマッチすることもテストします。 'regex' は正規表現オ
          ブジェクトか、 *note re.search(): 1444. が扱える正規表現が書か
          れた文字列である必要があります。例えば以下のようになります:

               self.assertWarnsRegex(DeprecationWarning,
                                     r'legacy_function\(\) is deprecated',
                                     legacy_function, 'XYZ')

          もしくは:

               with self.assertWarnsRegex(RuntimeWarning, 'unsafe frobnicating'):
                   frobnicate('/etc/passwd')

          Added in version 3.2.

          バージョン 3.3 で変更: コンテキストマネージャとして使用したと
          きに 'msg' キーワード引数が追加されました。

      -- メソッド: assertLogs (logger=None, level=None)

          'logger' かその子ロガーのうちの1つに、少なくとも1つのログメッ
          セージが少なくとも与えられた 'level' で出力されることをテスト
          するコンテキストマネージャです。

          If given, 'logger' should be a *note logging.Logger: d46.
          object or a *note str: 169. giving the name of a logger.  The
          default is the root logger, which will catch all messages that
          were not blocked by a non-propagating descendent logger.

          'level' が与えられた場合、ログレベルを表す数値もしくはそれに相
          当する文字列 (例えば ‘"ERROR"’ もしくは *note logging.ERROR:
          20e1.) であるべきです。 デフォルトは *note logging.INFO: 20df.
          です。

          ‘with’ ブロック内で出たメッセージの少なくとも一つが 'logger' お
          よび 'level' 条件に合っている場合、このテストをパスします。そ
          れ以外の場合は失敗です。

          コンテキストマネージャから返されるオブジェクトは、条件に該当す
          るログメッセージを追跡し続ける記録のためのヘルパーです。 この
          オブジェクトには2つの属性があります:

           -- の属性: records

               該当するログメッセージを表す *note logging.LogRecord:
               11e8. オブジェクトのリスト。

           -- の属性: output

               該当するメッセージ出力をフォーマットした *note str: 169.
               オブジェクトのリスト。

          以下はプログラム例です:

               with self.assertLogs('foo', level='INFO') as cm:
                   logging.getLogger('foo').info('first message')
                   logging.getLogger('foo.bar').error('second message')
               self.assertEqual(cm.output, ['INFO:foo:first message',
                                            'ERROR:foo.bar:second message'])

          Added in version 3.4.

      -- メソッド: assertNoLogs (logger=None, level=None)

          A context manager to test that no messages are logged on the
          'logger' or one of its children, with at least the given
          'level'.

          'logger' が与えられた場合、 *note logging.Logger: d46. オブジ
          ェクトもしくはロガーの名前である *note str: 169. であるべきで
          す。 デフォルトはルートロガーで、これは全てのメッセージを掴ま
          えます。

          'level' が与えられた場合、ログレベルを表す数値もしくはそれに相
          当する文字列 (例えば ‘"ERROR"’ もしくは *note logging.ERROR:
          20e1.) であるべきです。 デフォルトは *note logging.INFO: 20df.
          です。

          *note assertLogs(): a59. と異なり、このコンテキストマネージャ
          は何も返しません。

          Added in version 3.10.

     より具体的な確認を行うために以下のメソッドが用意されています:

     メソッド                                    確認事項                             初出
                                                                                      
     ----------------------------------------------------------------------------------------------------
                                                                                      
     *note assertAlmostEqual(a, b): 74e.         ‘round(a-b, 7) == 0’
                                                 
                                                                                      
     *note assertNotAlmostEqual(a, b): 74f.      ‘round(a-b, 7) != 0’
                                                 
                                                                                      
     *note assertGreater(a, b): 1557.            ‘a > b’                              3.1
                                                                                      
                                                                                      
     *note assertGreaterEqual(a, b): 1558.       ‘a >= b’                             3.1
                                                                                      
                                                                                      
     *note assertLess(a, b): 1559.               ‘a < b’                              3.1
                                                                                      
                                                                                      
     *note assertLessEqual(a, b): 155a.          ‘a <= b’                             3.1
                                                                                      
                                                                                      
     *note assertRegex(s, r): 751.               ‘r.search(s)’                        3.1
                                                                                      
                                                                                      
     *note assertNotRegex(s, r): 753.            ‘not r.search(s)’                    3.2
                                                                                      
                                                                                      
     *note assertCountEqual(a, b): 1442.         'a' と 'b' に、順番によらず同じ要    3.2
                                                 素が同じ数だけある。                 
                                                 
                                                                                      
     *note assertStartsWith(a, b): 2b8.          ‘a.startswith(b)’                    3.14
                                                                                      
                                                                                      
     *note assertNotStartsWith(a, b): 2b9.       ‘not a.startswith(b)’                3.14
                                                                                      
                                                                                      
     *note assertEndsWith(a, b): 2ba.            ‘a.endswith(b)’                      3.14
                                                                                      
                                                                                      
     *note assertNotEndsWith(a, b): 2bb.         ‘not a.endswith(b)’                  3.14
                                                                                      
                                                                                      
     *note assertHasAttr(a, b): 2b4.             ‘hastattr(a, b)’                     3.14
                                                                                      
                                                                                      
     *note assertNotHasAttr(a, b): 2b5.          ‘not hastattr(a, b)’                 3.14
                                                                                      

      -- メソッド: assertAlmostEqual (first, second, places=7, msg=None,
               delta=None)
      -- メソッド: assertNotAlmostEqual (first, second, places=7,
               msg=None, delta=None)

          'first' と 'second' が近似的に等しい (等しくない) ことをテスト
          します。これは、'places' (デフォルト7) で指定した小数位で丸め
          た差分をゼロと比較することで行われます。これらのメソッドは
          (*note round(): 14f2. と同様に) '小数位' を指定するのであって
          、'有効桁数' を指定するのではないことに注意してください。

          'places' の代わりに 'delta' が渡された場合には、'first' と
          'second' の差分が 'delta' 以下 (以上) であることをテストします
          。

          'delta' と 'places' の両方が指定された場合は *note TypeError:
          198. が送出されます。

          バージョン 3.2 で変更: *note assertAlmostEqual(): 74e. は、オ
          ブジェクトが等しい場合には自動で近似的に等しいとみなすようにな
          りました。 *note assertNotAlmostEqual(): 74f. は、オブジェクト
          が等しい場合には自動的に失敗するようになりました。 'delta' 引
          数が追加されました。

      -- メソッド: assertGreater (first, second, msg=None)
      -- メソッド: assertGreaterEqual (first, second, msg=None)
      -- メソッド: assertLess (first, second, msg=None)
      -- メソッド: assertLessEqual (first, second, msg=None)

          'first' が 'second' と比べて、メソッド名に対応して >, >=, < も
          しくは <= であることをテストします。そうでない場合はテストは失
          敗です:

               >>> self.assertGreaterEqual(3, 4)
               AssertionError: "3" unexpectedly not greater than or equal to "4"

          Added in version 3.1.

      -- メソッド: assertRegex (text, regex, msg=None)
      -- メソッド: assertNotRegex (text, regex, msg=None)

          'regex' の検索が 'text' とマッチする (またはマッチしない) こと
          をテストします。テスト失敗時には、エラーメッセージにパターンと
          'text' が表示されます（もしくは、パターンと意図しないかたちで
          マッチした 'text' の一部が表示されます）。 'regex' は正規表現
          オブジェクトか、 *note re.search(): 1444. が扱える正規表現が書
          かれた文字列である必要があります。

          Added in version 3.1: ‘assertRegexpMatches’ という名前で追加さ
          れました。

          バージョン 3.2 で変更: メソッド ‘assertRegexpMatches()’ は
          *note assertRegex(): 751. にリネームされました。

          Added in version 3.2: *note assertNotRegex(): 753.。

      -- メソッド: assertCountEqual (first, second, msg=None)

          シーケンス 'first' が 'second' と同じ要素を含んでいることをテ
          ストします。要素の順序はテスト結果に影響しません。要素が含まれ
          ていない場合には、シーケンスの差分がエラーメッセージとして表示
          されます。

          'first' と 'second' の比較では、重複した要素は無視 'されません
          '。両者に同じ数の要素が含まれていることを検証します。このメソ
          ッドは ‘assertEqual(Counter(list(first)),
          Counter(list(second)))’ と同等に振る舞うことに加えて、ハッシュ
          化できないオブジェクトのシーケンスでも動作します。

          Added in version 3.2.

      -- メソッド: assertStartsWith (s, prefix, msg=None)

      -- メソッド: assertNotStartsWith (s, prefix, msg=None)

          Test that the Unicode or byte string 's' starts (or does not
          start) with a 'prefix'.  'prefix' can also be a tuple of
          strings to try.

          Added in version 3.14.

      -- メソッド: assertEndsWith (s, suffix, msg=None)

      -- メソッド: assertNotEndsWith (s, suffix, msg=None)

          Test that the Unicode or byte string 's' ends (or does not
          end) with a 'suffix'.  'suffix' can also be a tuple of strings
          to try.

          Added in version 3.14.

      -- メソッド: assertHasAttr (obj, name, msg=None)

      -- メソッド: assertNotHasAttr (obj, name, msg=None)

          Test that the object 'obj' has (or has not) an attribute
          'name'.

          Added in version 3.14.

     *note assertEqual(): 74c. メソッドは、同じ型のオブジェクトの等価性
     確認のために、型ごとに特有のメソッドにディスパッチします。これらの
     メソッドは、ほとんどの組み込み型用のメソッドは既に実装されています
     。さらに、 *note addTypeEqualityFunc(): 1560. を使う事で新たなメソ
     ッドを登録することができます:

      -- メソッド: addTypeEqualityFunc (typeobj, function)

          *note assertEqual(): 74c. で呼び出される型特有のメソッドを登録
          します。登録するメソッドは、比較する2つのオブジェクトの型が厳
          密に 'typeobj' と同じ (サブクラスでもいけません) の場合に等価
          性を確認します。 'function' は *note assertEqual(): 74c. と同
          様に、2つの位置引数と、3番目に msg=None のキーワード引数を取れ
          る必要があります。このメソッドは、始めの2つに指定したパラメー
          タ間の差分を検出した時に *note self.failureException(msg):
          458b. の例外を投げる必要があります。この例外を投げる際は、出来
          る限り、エラーの内容が分かる有用な情報と差分の詳細をエラーメッ
          セージに含めてください。

          Added in version 3.1.

     *note assertEqual(): 74c. が自動的に呼び出す型特有のメソッドの概要
     を以下の表示に記載しています。これらのメソッドは通常は直接呼び出す
     必要がないことに注意が必要です。

     メソッド                                      比較の対象                        初出
                                                                                     
     ---------------------------------------------------------------------------------------------------
                                                                                     
     *note assertMultiLineEqual(a, b): 155b.       文字列                            3.1
                                                                                     
                                                                                     
     *note assertSequenceEqual(a, b): 14a1.        シーケンス                        3.1
                                                                                     
                                                                                     
     *note assertListEqual(a, b): 149f.            リスト                            3.1
                                                                                     
                                                                                     
     *note assertTupleEqual(a, b): 14a0.           タプル                            3.1
                                                                                     
                                                                                     
     *note assertSetEqual(a, b): 149d.             set または frozenset              3.1
                                                                                     
                                                                                     
     *note assertDictEqual(a, b): 149e.            辞書                              3.1
                                                                                     

      -- メソッド: assertMultiLineEqual (first, second, msg=None)

          複数行の文字列 'first' が文字列 'second' と等しいことをテスト
          します。等しくない場合には、両者の差分がハイライトされてエラー
          メッセージに表示されます。このメソッドは、デフォルトで、 *note
          assertEqual(): 74c. が string を比較するときに自動的に使用しま
          す。

          Added in version 3.1.

      -- メソッド: assertSequenceEqual (first, second, msg=None,
               seq_type=None)

          2つのシーケンスが等しいことをテストします。'seq_type' が指定さ
          れた場合、'first' と 'second' が 'seq_type' のインスタンスで無
          い場合にはテストが失敗します。シーケンスどうしが異なる場合には
          、両者の差分がエラーメッセージに表示されます。

          このメソッドは直接 *note assertEqual(): 74c. からは呼ばれませ
          んが、 *note assertListEqual(): 149f. と *note
          assertTupleEqual(): 14a0. の実装で使われています。

          Added in version 3.1.

      -- メソッド: assertListEqual (first, second, msg=None)
      -- メソッド: assertTupleEqual (first, second, msg=None)

          2つのリストまたはタプルが等しいかどうかをテストします。等しく
          ない場合には、両者の差分を表示します。2つのパラメータの型が異
          なる場合にはテストがエラーになります。このメソッドは、デフォル
          トで、 *note assertEqual(): 74c. が list または tuple を比較す
          るときに自動的に使用します。

          Added in version 3.1.

      -- メソッド: assertSetEqual (first, second, msg=None)

          2つのセットが等しいかどうかをテストします。等しくない場合には
          、両者の差分を表示します。このメソッドは、デフォルトで、 *note
          assertEqual(): 74c. が set もしくは frozenset を比較するときに
          自動的に使用します。

          'first' or 'second' のいずれかに *note difference(): 2698. が
          無い場合にはテストは失敗します。

          Added in version 3.1.

      -- メソッド: assertDictEqual (first, second, msg=None)

          2つの辞書が等しいかどうかをテストします。等しくない場合には、
          両者の差分を表示します。このメソッドは、デフォルトで、 *note
          assertEqual(): 74c. が dict を比較するときに自動的に使用します
          。

          Added in version 3.1.

     最後に、 *note TestCase: 2b3. の残りのメソッドと属性を紹介します:

      -- メソッド: fail (msg=None)

          無条件にテストを失敗させます。エラーメッセージの表示に、'msg'
          または ‘None’ が使われます。

      -- の属性: failureException

          *note test(): e8. メソッドが送出する例外を指定するクラス属性で
          す。例えばテストフレームワークで追加情報を付した特殊な例外が必
          要になる場合、この例外のサブクラスとして作成します。この属性の
          初期値は *note AssertionError: 8b8. です。

      -- の属性: longMessage

          このクラス属性は、失敗した assertXYY の呼び出しで独自の失敗時
          のメッセージが msg 引数として渡されていたときにどうするかを決
          定します。 ‘True’ がデフォルト値です。 この場合、標準の失敗時
          のメッセージの後に独自のメッセージが追記されます。 ‘False’ に
          設定したときは、標準のメッセージを独自のメッセージで置き換えま
          す。

          アサートメソッドを呼び出す前に、個別のテストメソッドの中でイン
          スタンス属性 self.longMessage を ‘True’ または ‘False’ に設定
          して、この設定を上書きできます。

          このクラスの設定はそれぞれのテストを呼び出す前にリセットされま
          す。

          Added in version 3.1.

      -- の属性: maxDiff

          この属性は、アサーションメソッドが失敗をレポートする時に表示す
          る差分の長さをコントロールします。デフォルトは 80*8 文字です。
          この属性が影響するメソッドは、 *note assertSequenceEqual():
          14a1. (およびこのメソッドに委譲するシーケンス比較メソッド)、
          *note assertDictEqual(): 149e. と *note
          assertMultiLineEqual(): 155b. です。

          ‘maxDiff’ を ‘None’ に設定すると差分表示の上限がなくなります。

          Added in version 3.2.

     テストフレームワークは、テスト情報を収集するために以下のメソッドを
     使用します:

      -- メソッド: countTestCases ()

          テストオブジェクトに含まれるテストの数を返します。 *note
          TestCase: 2b3. インスタンスは常に ‘1’ を返します。

      -- メソッド: defaultTestResult ()

          このテストケースクラスで使われるテスト結果クラスのインスタンス
          を (もし *note run(): 137e. メソッドに他の結果インスタンスが提
          供されないならば) 返します。

          *note TestCase: 2b3. インスタンスに対しては、いつも *note
          TestResult: 137f. のインスタンスですので、 *note TestCase:
          2b3. のサブクラスでは必要に応じてこのメソッドをオーバライドし
          てください。

      -- メソッド: id ()

          テストケースを特定する文字列を返します。通常、'id' はモジュー
          ル名・クラス名を含む、テストメソッドのフルネームを指定します。

      -- メソッド: shortDescription ()

          テストの説明を一行分、または説明がない場合には ‘None’ を返しま
          す。デフォルトでは、テストメソッドの docstring の先頭の一行、
          または ‘None’ を返します。

          バージョン 3.1 で変更: 3.1で docstring があったとしても、返さ
          れる短い説明文字列にテスト名が付けられるようになりました。 こ
          の変更によって unittest 拡張に互換性の問題が発生し、 Python
          3.2 でテスト名が追加される場所は *note TextTestResult: 754. へ
          移動しました。

      -- メソッド: addCleanup (function, /, *args, **kwargs)

          *note tearDown(): 1552. の後に呼び出される関数を追加します。こ
          の関数はリソースのクリーンアップのために使用します。追加された
          関数は、追加された順と逆の順番で呼び出されます（LIFO）。 *note
          addCleanup(): c74. に渡された引数とキーワード引数が追加された
          関数にも渡されます。

          *note setUp(): 1551. が失敗した場合、つまり *note tearDown():
          1552. が呼ばれなかった場合でも、追加されたクリーンアップ関数は
          呼び出されます。

          Added in version 3.1.

      -- メソッド: enterContext (cm)

          Enter the supplied *note context manager: 1e1.  If successful,
          also add its *note __exit__(): 1518. method as a cleanup
          function by *note addCleanup(): c74. and return the result of
          the *note __enter__(): 7e4. method.

          Added in version 3.11.

      -- メソッド: doCleanups ()

          このメソッドは、 *note tearDown(): 1552. の後、もしくは、
          *note setUp(): 1551. が例外を投げた場合は *note setUp(): 1551.
          の後に、無条件で呼ばれます。

          このメソッドは、 *note addCleanup(): c74. で追加された関数を呼
          び出す責務を担います。もし、クリーンアップ関数を *note
          tearDown(): 1552. より前に呼び出す必要がある場合には、 *note
          doCleanups(): 1550. を明示的に呼び出してください。

          *note doCleanups(): 1550. は、どこで呼び出されても、クリーンア
          ップ関数をスタックから削除して実行します。

          Added in version 3.1.

      -- メソッド: classmethod addClassCleanup (function, /, *args,
               **kwargs)

          *note tearDownClass(): 154f. の後に呼び出される関数を追加しま
          す。この関数はリソースのクリーンアップのために使用します。追加
          された関数は、追加された順と逆の順番で呼び出されます（LIFO）。
          *note addClassCleanup(): c41. に渡された引数とキーワード引数が
          追加された関数にも渡されます。

          *note setUpClass(): c43. が失敗した場合、つまり *note
          tearDownClass(): 154f. が呼ばれなかった場合でも、追加されたク
          リーンアップ関数は呼び出されます。

          Added in version 3.8.

      -- メソッド: classmethod enterClassContext (cm)

          Enter the supplied *note context manager: 1e1.  If successful,
          also add its *note __exit__(): 1518. method as a cleanup
          function by *note addClassCleanup(): c41. and return the
          result of the *note __enter__(): 7e4. method.

          Added in version 3.11.

      -- メソッド: classmethod doClassCleanups ()

          このメソッドは、 *note tearDownClass(): 154f. の後、もしくは、
          *note setUpClass(): c43. が例外を投げた場合は *note
          setUpClass(): c43. の後に、無条件で呼ばれます。

          このメソッドは、 *note addClassCleanup(): c41. で追加された関
          数を呼び出す責務を担います。もし、クリーンアップ関数を *note
          tearDownClass(): 154f. より前に呼び出す必要がある場合には、
          *note doClassCleanups(): 45fb. を明示的に呼び出してください。

          *note doClassCleanups(): 45fb. は、どこで呼び出されても、クリ
          ーンアップ関数をスタックから削除して実行します。

          Added in version 3.8.

 -- クラス: unittest.IsolatedAsyncioTestCase (methodName='runTest')

     このクラスは *note TestCase: 2b3. と似たAPIを提供し、テスト関数とし
     てコルーチンも許容します。

     Added in version 3.8.

      -- の属性: loop_factory

          The 'loop_factory' passed to *note asyncio.Runner: 2f5.
          Override in subclasses with *note asyncio.EventLoop: 1a67. to
          avoid using the asyncio policy system.

          Added in version 3.13.

      -- メソッド: async asyncSetUp ()

          テストフィクスチャを用意するために呼び出されるメソッドです。こ
          れは *note TestCase.setUp(): 1551. の後に呼び出されます。これ
          はテストメソッドを呼び出す直前に呼び出されます。*note
          AssertionError: 8b8. と *note SkipTest: 11e6. を除いて、このメ
          ソッドのによって送出されたあらゆる例外はテストの失敗ではなくエ
          ラーとみなされます。デフォルトの実装では何もしません。

      -- メソッド: async asyncTearDown ()

          テストメソッドが呼び出され、その結果が記録された直後に呼び出さ
          れるメソッドです。これは *note tearDown(): 1552. の前に呼び出
          されます。これはテストメソッドが例外を送出した場合でも呼び出さ
          れるので、サブクラスの実装では内部状態のチェックに特に気を付け
          る必要があります。このメソッドで送出された *note
          AssertionError: 8b8. と *note SkipTest: 11e6. 以外の例外は、テ
          ストの失敗ではなく追加のエラーとみなされます(そのため、報告さ
          れるエラーの総数が増えることになります)。このメソッドはテスト
          メソッドの結果に関係なく、*note asyncSetUp(): 45fd. が成功した
          場合にのみ呼び出されます。デフォルトの実装では何もしません。

      -- メソッド: addAsyncCleanup (function, /, *args, **kwargs)

          このメソッドはクリーンアップ関数として使用できるコルーチンを受
          け入れます。

      -- メソッド: async enterAsyncContext (cm)

          Enter the supplied *note asynchronous context manager: 7f0.
          If successful, also add its *note __aexit__(): 19a1. method as
          a cleanup function by *note addAsyncCleanup(): 45ff. and
          return the result of the *note __aenter__(): 241d. method.

          Added in version 3.11.

      -- メソッド: run (result=None)

          テストを実行するための新しいイベントループを作成し、 'result'
          として渡された *note TestResult: 137f. オブジェクトに結果を収
          集します。'result' が省略された場合や ‘None’ の場合は、一時的
          なresultオブジェクトが(*note defaultTestResult(): 45f2. メソッ
          ドの呼び出しによって)作成され、使用されます。このresultオブジ
          ェクトは *note run(): 4600. の呼び出し元に返されます。テスト終
          了時には、イベントループ内のすべてのタスクがキャンセルされます
          。

     順番を示す例です:

          from unittest import IsolatedAsyncioTestCase

          events = []


          class Test(IsolatedAsyncioTestCase):


              def setUp(self):
                  events.append("setUp")

              async def asyncSetUp(self):
                  self._async_connection = await AsyncConnection()
                  events.append("asyncSetUp")

              async def test_response(self):
                  events.append("test_response")
                  response = await self._async_connection.get("https://example.com")
                  self.assertEqual(response.status_code, 200)
                  self.addAsyncCleanup(self.on_cleanup)

              def tearDown(self):
                  events.append("tearDown")

              async def asyncTearDown(self):
                  await self._async_connection.close()
                  events.append("asyncTearDown")

              async def on_cleanup(self):
                  events.append("cleanup")

          if __name__ == "__main__":
              unittest.main()

     テスト実行後、‘events’ には ‘["setUp", "asyncSetUp",
     "test_response", "asyncTearDown", "tearDown", "cleanup"]’ が含まれ
     ます。

 -- クラス: unittest.FunctionTestCase (testFunc, setUp=None,
          tearDown=None, description=None)

     This class implements the portion of the *note TestCase: 2b3.
     interface which allows the test runner to drive the test, but does
     not provide the methods which test code can use to check and report
     errors.  This is used to create test cases using legacy test code,
     allowing it to be integrated into a ‘unittest’-based test
     framework.


File: python.info,  Node: テストのグループ化,  Next: テストのロードと起動,  Prev: テストクラス,  Up: クラスと関数

5.26.5.11 テストのグループ化
............................

 -- クラス: unittest.TestSuite (tests=())

     このクラスは、個々のテストケースやテストスイートの集合を表現してい
     ます。 通常のテストケースと同じようにテストランナーで実行するための
     インターフェースを備えています。 *note TestSuite: ff5. インスタンス
     を実行することはスイートをイテレートして得られる個々のテストを実行
     することと同じです。

     引数 'tests' が指定された場合、それはテストケースに亘る繰り返し可能
     オブジェクトまたは内部でスイートを組み立てるための他のテストスイー
     トでなければなりません。後からテストケースやスイートをコレクション
     に付け加えるためのメソッドも提供されています。

     *note TestSuite: ff5. は *note TestCase: 2b3. オブジェクトのように
     振る舞います。違いは、スイートにはテストを実装しない点にあります。
     代わりに、テストをまとめてグループ化して、同時に実行します。 *note
     TestSuite: ff5. のインスタンスにテスト追加するためのメソッドが用意
     されています:

      -- メソッド: addTest (test)

          *note TestCase: 2b3. 又は *note TestSuite: ff5. のインスタンス
          をスイートに追加します。

      -- メソッド: addTests (tests)

          イテラブル 'tests' に含まれる全ての *note TestCase: 2b3. 又は
          *note TestSuite: ff5. のインスタンスをスイートに追加します。

          このメソッドは 'tests' 上のイテレーションをしながらそれぞれの
          要素に *note addTest(): 4603. を呼び出すのと等価です。

     *note TestSuite: ff5. クラスは *note TestCase: 2b3. と以下のメソッ
     ドを共有します:

      -- メソッド: run (result)

          スイート内のテストを実行し、結果を 'result' で指定した結果オブ
          ジェクトに収集します。 *note TestCase.run(): 137e. と異なり、
          *note TestSuite.run(): 4605. では必ず結果オブジェクトを指定す
          る必要があります。

      -- メソッド: debug ()

          このスイートに関連づけられたテストを結果を収集せずに実行します
          。これによりテストで送出された例外は呼び出し元に伝わるようにな
          り、デバッガの下でのテスト実行をサポートできるようになります。

      -- メソッド: countTestCases ()

          このテストオブジェクトによって表現されるテストの数を返します。
          これには個別のテストと下位のスイートも含まれます。

      -- メソッド: __iter__ ()

          *note TestSuite: ff5. でグループ化されたテストは反復アクセスで
          きます。 サブクラスは ‘__iter__()’ をオーバーライドすることで
          、遅延処理でテストを提供できます。 1つのスイート内でこのメソッ
          ドは何度も呼ばれる可能性があることに注意してください (例えば、
          テスト数のカウントや等価性の比較)。 そのため、 *note
          TestSuite.run(): 4605. を実行する前に反復アクセスを何度繰り返
          しても同じテスト群を返すようにしなければなりません。 呼び出し
          側が ‘TestSuite._removeTestAtIndex()’ をオーバーライドしたサブ
          クラスを使いテストへの参照を保存していない限り、 *note
          TestSuite.run(): 4605. を実行した後はこのメソッドが返すテスト
          群を信頼すべきではありません。

          バージョン 3.2 で変更: 以前のバージョンでは *note TestSuite:
          ff5. はイテレータではなく、直接テストにアクセスしていました。
          そのため、 ‘__iter__()’ をオーバーラードしてもテストにアクセス
          できませんでした。

          バージョン 3.4 で変更: 以前のバージョンでは、 *note
          TestSuite.run(): 4605. の実行後は *note TestSuite: ff5. が各
          *note TestCase: 2b3. への参照を保持していました。 サブクラスで
          ‘TestSuite._removeTestAtIndex()’ をオーバーライドすることでこ
          の振る舞いを復元できます。

     通常、 *note TestSuite: ff5. の *note run(): 4605. メソッドは
     ‘TestRunner’ が起動するため、ユーザが直接実行する必要はありません。


File: python.info,  Node: テストのロードと起動,  Prev: テストのグループ化,  Up: クラスと関数

5.26.5.12 テストのロードと起動
..............................

 -- クラス: unittest.TestLoader

     The *note TestLoader: 593. class is used to create test suites from
     classes and modules.  Normally, there is no need to create an
     instance of this class; the ‘unittest’ module provides an instance
     that can be shared as *note unittest.defaultTestLoader: 4609.
     Using a subclass or instance, however, allows customization of some
     configurable properties.

     *note TestLoader: 593. オブジェクトには以下の属性があります:

      -- の属性: errors

          テストの読み込み中に起きた致命的でないエラーのリストです。 ど
          の時点でもローダーからリセットされることはありません。 致命的
          なエラーは適切なメソッドが例外を送出して、呼び出し元に通知しま
          す。 致命的でないエラーも、実行したときのエラーを総合テストが
          通知してくれます。

          Added in version 3.5.

     *note TestLoader: 593. のオブジェクトには以下のメソッドがあります:

      -- メソッド: loadTestsFromTestCase (testCaseClass)

          *note TestCase: 2b3. の派生クラス ‘testCaseClass’ に含まれる全
          テストケースのスイートを返します。

          *note getTestCaseNames(): 596. で指定されたメソッドに対し、テ
          ストケースインスタンスが作成されます。 デフォルトでは ‘test’ で
          始まる名前のメソッド群です。 *note getTestCaseNames(): 596. が
          メソッド名を返さなかったが、 ‘runTest()’ メソッドが実装されて
          いる場合は、そのメソッドに対するテストケースが代わりに作成され
          ます。

      -- メソッド: loadTestsFromModule (module, *, pattern=None)

          指定したモジュールに含まれる全テストケースのスイートを返します
          。このメソッドは 'module' 内の *note TestCase: 2b3. 派生クラス
          を検索し、見つかったクラスのテストメソッドごとにクラスのインス
          タンスを作成します。

               注釈: *note TestCase: 2b3. クラスを基底クラスとしてクラス
               階層を構築するとテストフィクスチャや補助的な関数をうまく
               共用することができますが、基底クラスに直接インスタンス化
               できないテストメソッドがあると、この
               ‘loadTestsFromModule()’ を使うことができません。この場合
               でも、 fixture が全て別々で定義がサブクラスにある場合は使
               用することができます。

          モジュールが ‘load_tests’ 関数を用意している場合、この関数がテ
          ストの読み込みに使われます。 これによりテストの読み込み処理が
          カスタマイズできます。 これが *note load_tests プロトコル:
          45e2. です。 'pattern' 引数は ‘load_tests’ に第3引数として渡さ
          れます。

          バージョン 3.2 で変更: ‘load_tests’ のサポートが追加されました
          。

          バージョン 3.5 で変更: Support for a keyword-only argument
          'pattern' has been added.

          バージョン 3.12 で変更: The undocumented and unofficial
          'use_load_tests' parameter has been removed.

      -- メソッド: loadTestsFromName (name, module=None)

          文字列で指定される全テストケースを含むスイートを返します。

          'name' には "ドット修飾名" でモジュールかテストケースクラス、
          テストケースクラス内のメソッド、 *note TestSuite: ff5. インス
          タンスまたは *note TestCase: 2b3. か *note TestSuite: ff5. の
          インスタンスを返す呼び出し可能オブジェクトを指定します。このチ
          ェックはここで挙げた順番に行なわれます。すなわち、候補テストケ
          ースクラス内のメソッドは「呼び出し可能オブジェクト」としてでは
          なく「テストケースクラス内のメソッド」として拾い出されます。

          例えば モジュールに *note TestCase: 2b3. から派生した クラスが
          あり、 ‘SampleTestCase’ にはテストメソッド ‘test_one()’、
          ‘test_two()’、‘test_three()’ があるとします。この場合、 'name'
          に ‘'SampleTests.SampleTestCase'’ と指定すると、 ‘SampleTests’
          の三つのテストメソッドを実行するテストスイートが作成されます。
          ‘'SampleTests.SampleTestCase.test_two'’ と指定すれば、
          ‘test_two()’ だけを実行するテストスイートが作成されます。イン
          ポートされていないモジュールやパッケージ名を含んだ名前を指定し
          た場合は自動的にインポートされます。

          また、'module' を指定した場合、'module' 内の 'name' を取得しま
          す。

          バージョン 3.5 で変更: 'name' を巡回している間に *note
          ImportError: 65b. か *note AttributeError: 5f0. が発生した場合
          、実行するとその例外を発生させるようなテストを合成して返します
          。それらのエラーは self.errors に集められます。

      -- メソッド: loadTestsFromNames (names, module=None)

          *note loadTestsFromName(): 155e. と同じですが、名前を一つだけ
          指定するのではなく、複数の名前のシーケンスを指定する事ができま
          す。戻り値は 'names' 中の名前で指定されるテスト全てを含むテス
          トスイートです。

      -- メソッド: getTestCaseNames (testCaseClass)

          'testCaseClass' 中の全てのメソッド名を含むソート済みシーケンス
          を返します。 'testCaseClass' は *note TestCase: 2b3. のサブク
          ラスでなければなりません。

      -- メソッド: discover (start_dir, pattern='test*.py',
               top_level_dir=None)

          指定された開始ディレクトリからサブディレクトリに再帰することで
          すべてのテストモジュールを検索し、それらを含む TestSuite オブ
          ジェクトを返します。'pattern' にマッチしたテストファイルだけが
          ロードの対象になります。 (シェルスタイルのパターンマッチングが
          使われます)。その中で、インポート可能なもジュール (つまり
          Python の識別子として有効であるということです) がロードされま
          す。

          すべてのテストモジュールはプロジェクトのトップレベルからインポ
          ート可能である必要があります。開始ディレクトリがトップレベルデ
          ィレクトリでない場合は、'top_level_dir' を個別に指定しなければ
          なりません。

          シンタックスエラーなどでモジュールのインポートに失敗した場合、
          エラーが記録され、ディスカバリ自体は続けられます。 import の失
          敗が *note SkipTest: 11e6. 例外が発生したためだった場合は、そ
          のモジュールはエラーではなく skip として記録されます。

          パッケージ (‘__init__.py’ という名前のファイルがあるディレクト
          リ) が見付かった場合、そのパッケージに ‘load_tests’ 関数がある
          かをチェックします。 関数があった場合、次に
          ‘package.load_tests(loader, tests, pattern)’ が呼ばれます。 テ
          ストの検索の実行では、たとえ load_tests 関数自身が
          ‘loader.discover’ を呼んだとしても、パッケージのチェックは1回
          のみとなることが保証されています。

          ‘load_tests’ が存在して、ディスカバリがパッケージ内を再帰的な
          検索を続けている途中で 'ない' 場合、‘load_tests’ はそのパッケ
          ージ内の全てのテストをロードする責務を担います。

          The pattern is deliberately not stored as a loader attribute
          so that packages can continue discovery themselves.

          'top_level_dir' is stored internally, and used as a default to
          any nested calls to ‘discover()’.  That is, if a package's
          ‘load_tests’ calls ‘loader.discover()’, it does not need to
          pass this argument.

          'start_dir' はドット付のモジュール名でもディレクトリでも構いま
          せん。

          Added in version 3.2.

          バージョン 3.4 で変更: インポート時に *note SkipTest: 11e6. を
          送出するモジュールはエラーではなくスキップとして記録されます。

          'start_dir' に *note 名前空間パッケージ: 2b2. を指定できます。

          ファイルシステムの順序がファイル名に従わないとしても実行順序が
          一定になるように、パスはインポートする前にソートされます。

          バージョン 3.5 で変更: パッケージ名がデフォルトのパターンに適
          合するのは不可能なので、パスが 'pattern' に適合するかどうかに
          関係無く、見付けたパッケージに ‘load_tests’ があるかをチェック
          するようになりました。

          バージョン 3.11 で変更: 'start_dir' can not be a *note
          namespace packages: 2b2.  It has been broken since Python 3.7,
          and Python 3.11 officially removes it.

          バージョン 3.13 で変更: 'top_level_dir' is only stored for the
          duration of 'discover' call.

          バージョン 3.14 で変更: 'start_dir' can once again be a *note
          namespace package: 2b2.

     以下の属性は、サブクラス化またはインスタンスの属性値を変更して
     *note TestLoader: 593. をカスタマイズする場合に使用します:

      -- の属性: testMethodPrefix

          テストメソッドの名前と判断されるメソッド名の接頭語を示す文字列
          。デフォルト値は ‘'test'’ です。

          この値は *note getTestCaseNames(): 596. と全ての
          ‘loadTestsFrom*’ メソッドに影響を与えます。

      -- の属性: sortTestMethodsUsing

          *note getTestCaseNames(): 596. および全ての ‘loadTestsFrom*’ メ
          ソッドでメソッド名をソートする際に使用する比較関数。

      -- の属性: suiteClass

          テストのリストからテストスイートを構築する呼び出し可能オブジェ
          クト。メソッドを持つ必要はありません。デフォルト値は *note
          TestSuite: ff5. です。

          この値は全ての ‘loadTestsFrom*’ メソッドに影響を与えます。

      -- の属性: testNamePatterns

          テストメソッドがテストスイートに含まれるためにマッチしなければ
          ならないUnixシェルスタイルのワイルドカードテスト名パターンのリ
          ストです(‘-k’ オプションを参照)。

          この属性が ‘None’ (デフォルト)でない場合、テストスイートに含ま
          れるすべてのテストメソッドはこのリストのパターンのいずれかにマ
          ッチしていなければなりません。マッチは常に *note
          fnmatch.fnmatchcase(): 1c55. を使用して実行されるため、‘-k’ オ
          プションに渡されるパターンとは異なり、単純な部分文字列パターン
          は ‘*’ ワイルドカードを使用して変換する必要があることに注意し
          てください。

          この値は全ての ‘loadTestsFrom*’ メソッドに影響を与えます。

          Added in version 3.7.

 -- クラス: unittest.TestResult

     このクラスはどのテストが成功しどのテストが失敗したかという情報を収
     集するのに使います。

     *note TestResult: 137f. は、複数のテスト結果を記録します。 *note
     TestCase: 2b3. クラスと *note TestSuite: ff5. クラスのテスト結果を
     正しく記録しますので、テスト開発者が独自にテスト結果を管理する処理
     を開発する必要はありません。

     Testing frameworks built on top of ‘unittest’ may want access to
     the *note TestResult: 137f. object generated by running a set of
     tests for reporting purposes; a *note TestResult: 137f. instance is
     returned by the ‘TestRunner.run()’ method for this purpose.

     *note TestResult: 137f. インスタンスの以下の属性は、テストの実行結
     果を検査する際に使用することができます:

      -- の属性: errors

          *note TestCase: 2b3. と例外のトレースバック情報をフォーマット
          した文字列の 2 要素タプルからなるリスト。それぞれのタプルは予
          想外の例外を送出したテストに対応します。

      -- の属性: failures

          *note TestCase: 2b3. と例外のトレースバック情報をフォーマット
          した文字列の 2 要素タプルからなるリスト。それぞれのタプルは
          ref:‘assert* メソッド <assert-methods>’ を使って見つけ出した失
          敗に対応します。

      -- の属性: skipped

          *note TestCase: 2b3. インスタンスとテストをスキップした理由を
          保持する文字列の2要素タプルからなるリストです。

          Added in version 3.1.

      -- の属性: expectedFailures

          *note TestCase: 2b3. と例外のトレースバック情報をフォーマット
          済の文字列の 2 要素タプルからなるリストです。それぞれのタプル
          は予期された失敗またはエラーに対応します。

      -- の属性: unexpectedSuccesses

          予期された失敗とされていながら成功してしまった *note TestCase:
          2b3. のインスタンスのリスト。

      -- の属性: collectedDurations

          A list containing 2-tuples of test case names and floats
          representing the elapsed time of each test which was run.

          Added in version 3.12.

      -- の属性: shouldStop

          ‘True’ が設定されると *note stop(): 4614. によりテストの実行が
          停止します。

      -- の属性: testsRun

          これまでに実行したテストの総数です。

      -- の属性: buffer

          ‘True’ が設定されると、 ‘sys.stdout’ と ‘sys.stderr’ は、
          *note startTest(): 4617. から *note stopTest(): 4618. が呼ばれ
          るまでの間バッファリングされます。実際に、結果が ‘sys.stdout’
          と ‘sys.stderr’ に出力されるのは、テストが失敗するかエラーが発
          生した時になります。表示の際には、全ての失敗 / エラーメッセー
          ジが表示されます。

          Added in version 3.2.

      -- の属性: failfast

          真の場合 *note stop(): 4614. が始めの失敗もしくはエラーの時に
          呼び出され、テストの実行が終了します。

          Added in version 3.2.

      -- の属性: tb_locals

          真の場合、局所変数がトレースバックに表示されます。

          Added in version 3.5.

      -- メソッド: wasSuccessful ()

          これまでに実行したテストが全て成功していれば ‘True’ を、それ以
          外なら ‘False’ を返します。

          バージョン 3.4 で変更: *note expectedFailure(): 45e9. デコレ－
          タでマークされたテストに *note unexpectedSuccesses: 4612. があ
          った場合 ‘False’ を返します。

      -- メソッド: stop ()

          このメソッドを呼び出して *note TestResult: 137f. の *note
          shouldStop: 4613. 属性に ‘True’ をセットすることで、実行中のテ
          ストは中断しなければならないというシグナルを送ることができます
          。 ‘TestRunner’ オブジェクトはこのフラグを順守してそれ以上のテ
          ストを実行することなく復帰しなければなりません。

          たとえばこの機能は、ユーザのキーボード割り込みを受け取って
          *note TextTestRunner: 1ab6. クラスがテストフレームワークを停止
          させるのに使えます。 ‘TestRunner’ の実装を提供する対話的なツー
          ルでも同じように使用することができます。

     *note TestResult: 137f. クラスの以下のメソッドは内部データ管理用の
     メソッドですが、対話的にテスト結果をレポートするテストツールを開発
     する場合などにはサブクラスで拡張することができます。

      -- メソッド: startTest (test)

          'test' を実行する直前に呼び出されます。

      -- メソッド: stopTest (test)

          'test' の実行直後に、テスト結果に関わらず呼び出されます。

      -- メソッド: startTestRun ()

          全てのテストが実行される前に一度だけ実行されます。

          Added in version 3.1.

      -- メソッド: stopTestRun ()

          全てのテストが実行された後に一度だけ実行されます。

          Added in version 3.1.

      -- メソッド: addError (test, err)

          テスト 'test' 実行中に、想定外の例外が発生した場合に呼び出され
          ます。 'err' は *note sys.exc_info(): 89a. が返すタプル
          ‘(type, value, traceback)’ です。

          デフォルトの実装では、タプル、 ‘(test, formatted_err)’ をイン
          スタンスの *note errors: 460e. 属性に追加します。ここで、
          'formatted_err' は、 'err' から導出される、整形されたトレース
          バックです。

      -- メソッド: addFailure (test, err)

          テストケース 'test' が失敗した場合に呼び出されます。 'err' は
          *note sys.exc_info(): 89a. が返すタプル ‘(type, value,
          traceback)’ です。

          デフォルトの実装では、タプル、 ‘(test, formatted_err)’ をイン
          スタンスの *note failures: 460f. 属性に追加します。ここで、
          'formatted_err' は、 'err' から導出される、整形されたトレース
          バックです。

      -- メソッド: addSuccess (test)

          テストケース 'test' が成功した場合に呼び出されます。

          デフォルトの実装では何もしません。

      -- メソッド: addSkip (test, reason)

          'test' がスキップされた時に呼び出されます。'reason' はスキップ
          の際に渡された理由の文字列です。

          デフォルトの実装では、 ‘(test, reason)’ のタプルをインスタンス
          の *note skipped: 4610. 属性に追加します。

      -- メソッド: addExpectedFailure (test, err)

          *note expectedFailure(): 45e9. のデコレータでマークされた
          'test' が失敗またはエラーの時に呼び出されます。

          デフォルトの実装では ‘(test, formatted_err)’ のタプルをインス
          タンスの *note expectedFailures: 4611. に追加します。ここで
          'formatted_err' は 'err' から派生した整形されたトレースバック
          です。

      -- メソッド: addUnexpectedSuccess (test)

          *note expectedFailure(): 45e9. のデコレータでマークされた
          'test' が成功した時に呼び出されます。

          デフォルトの実装ではテストをインスタンスの *note
          unexpectedSuccesses: 4612. 属性に追加します。

      -- メソッド: addSubTest (test, subtest, outcome)

          サブテストが終了すると呼ばれます。 'test' はテストメソッドに対
          応するテストケースです。 'subtest' はサブテストを記述するカス
          タムの *note TestCase: 2b3. インスタンスです。

          'outcome' が *note None: 885. の場合サブテストは成功です。 そ
          れ以外の場合は失敗で、*note sys.exc_info(): 89a. が返す形式
          ‘(type, value, traceback)’ の 'outcome' を持つ例外を伴います。

          結果が成功の場合デフォルトの実装では何もせず、サブテストの失敗
          を通常の失敗として報告します。

          Added in version 3.4.

      -- メソッド: addDuration (test, elapsed)

          Called when the test case finishes.  'elapsed' is the time
          represented in seconds, and it includes the execution of
          cleanup functions.

          Added in version 3.12.

 -- クラス: unittest.TextTestResult (stream, descriptions, verbosity, *,
          durations=None)

     A concrete implementation of *note TestResult: 137f. used by the
     *note TextTestRunner: 1ab6.  Subclasses should accept ‘**kwargs’ to
     ensure compatibility as the interface changes.

     Added in version 3.2.

     バージョン 3.12 で変更: 'durations' キーワード引数が追加されました
     。

 -- データ: unittest.defaultTestLoader

     *note TestLoader: 593. のインスタンスで、共用することが目的です。
     *note TestLoader: 593. をカスタマイズする必要がなければ、新しい
     *note TestLoader: 593. オブジェクトを作らずにこのインスタンスを使用
     します。

 -- クラス: unittest.TextTestRunner (stream=None, descriptions=True,
          verbosity=1, failfast=False, buffer=False, resultclass=None,
          warnings=None, *, tb_locals=False, durations=None)

     結果をストリームに出力する、基本的なテストランナーの実装です。
     'stream' が ‘None’ の場合、デフォルトで *note sys.stderr: b33. が出
     力ストリームとして使われます。 このクラスはいくつかの設定項目がある
     だけで、基本的に非常に単純です。 グラフィカルなテスト実行アプリケー
     ションでは、独自のテストランナーを実装してください。 テストランナー
     の実装は、 unittest に新しい機能が追加されランナーを構築するインタ
     ーフェースが変更されたときに備えて ‘**kwargs’ を受け取れるようにす
     るべきです。

     By default this runner shows *note DeprecationWarning: 1a3, *note
     PendingDeprecationWarning: ac5, *note ResourceWarning: 54c. and
     *note ImportWarning: 71e. even if they are *note ignored by
     default: 461f.  This behavior can be overridden using Python's
     ‘-Wd’ or ‘-Wa’ options (see *note Warning control: 2129.) and
     leaving 'warnings' to ‘None’.

     バージョン 3.2 で変更: 'warnings' 引数が追加されました。

     バージョン 3.2 で変更: インポート時でなくインスタンス化時にデフォル
     トのストリームが *note sys.stderr: b33. に設定されます。

     バージョン 3.5 で変更: 'tb_locals' 引数が追加されました。

     バージョン 3.12 で変更: 'durations' 引数が追加されました。

      -- メソッド: _makeResult ()

          このメソッドは *note run(): 4621. で使われる ‘TestResult’ のイ
          ンスタンスを返します。このメソッドは明示的に呼び出す必要はあり
          ませんが、サブクラスで ‘TestResult’ をカスタマイズすることがで
          きます。

          ‘_makeResult()’ は、 ‘TextTestRunner’ のコンストラクタで
          ‘resultclass’ 引数として渡されたクラスもしくはコーラブルオブジ
          ェクトをインスタンス化します。 ‘resultclass’ が指定されていな
          い場合には、デフォルトで *note TextTestResult: 754. が使用され
          ます。結果のクラスは以下の引数が渡されインスタンス化されます:

               stream, descriptions, verbosity

      -- メソッド: run (test)

          このメソッドは ‘TextTestRunner’ へのメインの公開インターフェー
          スです。 このメソッドは *note TestSuite: ff5. インスタンスある
          いは *note TestCase: 2b3. インスタンスを受け取ります。 *note
          _makeResult(): 4620. が呼ばれて *note TestResult: 137f. が作成
          され、テストが実行され、結果が標準出力に表示されます。

 -- の関数: unittest.main (module='__main__', defaultTest=None,
          argv=None, testRunner=None,
          testLoader=unittest.defaultTestLoader, exit=True, verbosity=1,
          failfast=None, catchbreak=None, buffer=None, warnings=None)

     'module' から複数のテストを読み込んで実行するためのコマンドラインプ
     ログラム。この関数を使えば、簡単に実行可能なテストモジュールを作成
     する事ができます。一番簡単なこの関数の使い方は、以下の行をテストス
     クリプトの最後に置くことです:

          if __name__ == '__main__':
              unittest.main()

     より詳細な情報は verbosity 引数を指定して実行すると得られます:

          if __name__ == '__main__':
              unittest.main(verbosity=2)

     'defaultTest' 引数は、 'argv' にテスト名が指定されていない場合に実
     行する、ある1つのテストの名前もしくはテスト名のイテラブルです。 こ
     の引数を指定しないか ‘None’ を指定し、かつ 'argv' にテスト名が与え
     られない場合は、 'module' にある全てのテストを実行します。

     'argv' 引数には、プログラムに渡されたオプションのリストを、最初の要
     素がプログラム名のままで渡せます。指定しないか ‘None’ の場合は
     *note sys.argv: 147c. が使われます。

     The 'testRunner' argument can either be a test runner class or an
     already created instance of it.  By default ‘main’ calls *note
     sys.exit(): 277. with an exit code indicating success (0) or
     failure (1) of the tests run.  An exit code of 5 indicates that no
     tests were run or skipped.

     'testLoader' 引数は *note TestLoader: 593. インスタンスでなければな
     りません。デフォルトは *note defaultTestLoader: 4609. です。

     ‘main’ は、 ‘exit=False’ を指定する事で対話的なインタプリタから使用
     することもできます。この引数を指定すると、 *note sys.exit(): 277. を
     呼ばずに、結果のみを出力します:

          >>> from unittest import main
          >>> main(module='test_module', exit=False)

     'failfast', 'catchbreak', 'buffer' は、*note
     コマンドラインオプション: 45d1. にある同名のオプションと同じ効果の
     あるパラメータです。

     'warnings' 引数では、テストの実行中に使うべき *note 警告フィルタ:
     1b1. を指定します。 この引数が指定されない場合には、 ‘-W’ オプショ
     ンが ‘python’ に渡されていなければ ‘None’ のまま (*note 警告の制御:
     2129. を参照してください) で、そうでなければ ‘'default'’ が設定され
     ます。

     Calling ‘main’ returns an object with the ‘result’ attribute that
     contains the result of the tests run as a *note
     unittest.TestResult: 137f.

     バージョン 3.1 で変更: 'exit' パラメータが追加されました。

     バージョン 3.2 で変更: 'verbosity'、'failfast'、'catchbreak'、
     'buffer'、'warnings' 引数が追加されました。

     バージョン 3.4 で変更: 'defaultTest' 引数がテスト名のイテラブルも受
     け取るようになりました。

* Menu:

* load_tests プロトコル::


File: python.info,  Node: load_tests プロトコル,  Up: テストのロードと起動

5.26.5.13 load_tests プロトコル
...............................

Added in version 3.2.

モジュールやパッケージには、‘load_tests’ と呼ばれる関数を実装できます。
これにより、通常のテスト実行時やテストディスカバリ時のテストのロードされ
方をカスタマイズできます。

テストモジュールが ‘load_tests’ を定義していると、それが *note
TestLoader.loadTestsFromModule(): 594. から呼ばれます。引数は以下です:

     load_tests(loader, standard_tests, pattern)

'pattern' は ‘loadTestsFromModule’ からそのまま渡されます。デフォルトは
‘None’ です。

これは *note TestSuite: ff5. を返すべきです。

'loader' はローディングを行う *note TestLoader: 593. のインスタンスです
。 'standard_tests' は、そのモジュールからデフォルトでロードされるテスト
です。これは、テストの標準セットのテストの追加や削除のみを行いたいテスト
モジュールに一般に使われます。第三引数は、パッケージをテストディスカバリ
の一部としてロードするときに使われます。

特定の *note TestCase: 2b3. クラスのセットからテストをロードする典型的な
‘load_tests’ 関数は、このようになります:

     test_cases = (TestCase1, TestCase2, TestCase3)

     def load_tests(loader, tests, pattern):
         suite = TestSuite()
         for test_class in test_cases:
             tests = loader.loadTestsFromTestCase(test_class)
             suite.addTests(tests)
         return suite

コマンドラインからでも *note TestLoader.discover(): 11e7. の呼び出しでも
、パッケージを含むディレクトリで検索を始めた場合、そのパッケージの
‘__init__.py’ をチェックして ‘load_tests’ を探します。 その関数が存在し
ない場合、他のディレクトリであるかのようにパッケージの中を再帰的に検索し
ます。 その関数が存在した場合、パッケージのテストの検索をそちらに任せ、
‘load_tests’ が次の引数で呼び出されます:

     load_tests(loader, standard_tests, pattern)

これはパッケージ内のすべてのテストを表す *note TestSuite: ff5. を返すべ
きです。 (‘standard_tests’ には、 ‘__init__.py’ から収集されたテストのみ
が含まれます。)

パターンは ‘load_tests’ に渡されるので、パッケージは自由にテストディスカ
バリを継続 (必要なら変更) できます。テストパッケージに '何もしない'
‘load_tests’ 関数は次のようになります:

     def load_tests(loader, standard_tests, pattern):
         # top level directory cached on loader instance
         this_dir = os.path.dirname(__file__)
         package_tests = loader.discover(start_dir=this_dir, pattern=pattern)
         standard_tests.addTests(package_tests)
         return standard_tests

バージョン 3.5 で変更: パッケージ名がデフォルトのパターンに適合するのが
不可能なため、検索ではパッケージ名が 'pattern' に適合するかのチェックは
行われなくなりました。


File: python.info,  Node: クラスとモジュールのフィクスチャ,  Next: シグナルハンドリング,  Prev: クラスと関数,  Up: unittest --- ユニットテストフレームワーク

5.26.5.14 クラスとモジュールのフィクスチャ
..........................................

クラスレベルとモジュールレベルのフィクスチャが *note TestSuite: ff5. に
実装されました。 テストスイートが新しいクラスのテストを始める時、以前の
クラス (あれば)の *note tearDownClass(): 154f. を呼び出し、その後に新し
いクラスの *note setUpClass(): c43. を呼び出します。

同様に、今回のテストのモジュールが前回のテストとは異なる場合、以前のモジ
ュールの ‘tearDownModule’ を実行し、次に新しいモジュールの ‘setUpModule’
を実行します。

すべてのテストが実行された後、最後の ‘tearDownClass’ と ‘tearDownModule’
が実行されます。

なお、共有フィクスチャは、テストの並列化などの [潜在的な] 機能と同時には
うまくいかず、テストの分離を壊すので、気をつけて使うべきです。

unittest テストローダによるテスト作成のデフォルトの順序では、同じモジュ
ールやクラスからのテストはすべて同じグループにまとめられます。これにより
、‘setUpClass’ / ‘setUpModule’ (など) は、一つのクラスやモジュールにつき
一度だけ呼ばれます。この順序をバラバラにし、異なるモジュールやクラスのテ
ストが並ぶようにすると、共有フィクスチャ関数は、一度のテストで複数回呼ば
れるようにもなります。

共有フィクスチャは標準でない順序で実行されることを意図していません。 共
有フィクスチャをサポートしたくないフレームワークのために、
‘BaseTestSuite’ がまだ存在しています。

共有フィクスチャ関数のいずれかで例外が発生した場合、そのテストはエラーと
して報告されます。 そのとき、対応するテストインスタンスが無いので(*note
TestCase: 2b3. と同じインターフェースの) ‘_ErrorHolder’ オブジェクトが生
成され、エラーを表します。 標準 unittest テストランナーを使っている場合
はこの詳細は問題になりませんが、あなたがフレームワークの作者である場合は
注意してください。

* Menu:

* setUpClass と tearDownClass::
* setUpModule と tearDownModule::


File: python.info,  Node: setUpClass と tearDownClass,  Next: setUpModule と tearDownModule,  Up: クラスとモジュールのフィクスチャ

5.26.5.15 setUpClass と tearDownClass
.....................................

これらはクラスメソッドとして実装されなければなりません:

     import unittest

     class Test(unittest.TestCase):
         @classmethod
         def setUpClass(cls):
             cls._connection = createExpensiveConnectionObject()

         @classmethod
         def tearDownClass(cls):
             cls._connection.destroy()

基底クラスの ‘setUpClass’ および ‘tearDownClass’ を使いたいなら、それら
を自分で呼び出さなければなりません。 *note TestCase: 2b3. の実装は空です
。

‘setUpClass’ の中で例外が送出されたら、クラス内のテストは実行されず、
‘tearDownClass’ も実行されません。スキップされたクラスは ‘setUpClass’ も
‘tearDownClass’ も実行されません。例外が *note SkipTest: 11e6. 例外であ
れば、そのクラスはエラーではなくスキップされたものとして報告されます。


File: python.info,  Node: setUpModule と tearDownModule,  Prev: setUpClass と tearDownClass,  Up: クラスとモジュールのフィクスチャ

5.26.5.16 setUpModule と tearDownModule
.......................................

これらは関数として実装されなければなりません:

     def setUpModule():
         createConnection()

     def tearDownModule():
         closeConnection()

‘setUpModule’ の中で例外が送出されたら、モジュール内のテストは実行されず
、 ‘tearDownModule’ も実行されません。例外が *note SkipTest: 11e6. 例外
であれば、そのモジュールはエラーではなくスキップされたものとして報告され
ます。

例外が発生した場合でも実行しなければならないクリーンアップコードを追加す
るには''addModuleCleanup''を使用します:

 -- の関数: unittest.addModuleCleanup (function, /, *args, **kwargs)

     *note tearDownModule(): 154e. の後に呼び出される関数を追加します。
     この関数はリソースのクリーンアップのために使用します。追加された関
     数は、追加された順と逆の順番で呼び出されます（LIFO）。 *note
     addModuleCleanup(): c40. に渡された引数とキーワード引数が追加された
     関数にも渡されます。

     *note setUpModule(): c42. が失敗した場合、つまり *note
     tearDownModule(): 154e. が呼ばれなかった場合でも、追加されたクリー
     ンアップ関数は呼び出されます。

     Added in version 3.8.

 -- の関数: unittest.enterModuleContext (cm)

     Enter the supplied *note context manager: 1e1.  If successful, also
     add its *note __exit__(): 1518. method as a cleanup function by
     *note addModuleCleanup(): c40. and return the result of the *note
     __enter__(): 7e4. method.

     Added in version 3.11.

 -- の関数: unittest.doModuleCleanups ()

     この関数は、 *note tearDownModule(): 154e. の後、もしくは、 *note
     setUpModule(): c42. が例外を投げた場合は *note setUpModule(): c42.
     の後に、無条件で呼ばれます。

     このメソッドは、 *note addModuleCleanup(): c40. で追加された関数を
     呼び出す責務を担います。もし、クリーンアップ関数を *note
     tearDownModule(): 154e. より前に呼び出す必要がある場合には、 *note
     doModuleCleanups(): 1bd3. を明示的に呼び出してください。

     *note doModuleCleanups(): 1bd3. は、どこで呼び出されても、クリーン
     アップ関数をスタックから削除して実行します。

     Added in version 3.8.


File: python.info,  Node: シグナルハンドリング,  Prev: クラスとモジュールのフィクスチャ,  Up: unittest --- ユニットテストフレームワーク

5.26.5.17 シグナルハンドリング
..............................

Added in version 3.2.

unittest の *note -c/-catch: 154a. コマンドラインオプションや、 *note
unittest.main(): 11e5. の ‘catchbreak’ パラメタは、テスト実行中の
control-C の処理をよりフレンドリーにします。中断捕捉動作を有効である場合
、 control-C が押されると、現在実行されているテストまで完了され、そのテ
ストランが終わると今までの結果が報告されます。control-C がもう一度押され
ると、通常通り *note KeyboardInterrupt: bc5. が送出されます。

シグナルハンドラを処理する control-c は、独自の *note signal.SIGINT:
253. ハンドラをインストールするコードやテストの互換性を保とうとします。
‘unittest’ ハンドラが呼ばれ、それがインストールされた *note
signal.SIGINT: 253. ハンドラで 'なければ' 、すなわちテスト中のシステムに
置き換えられて移譲されたなら、それはデフォルトのハンドラを呼び出します。
インストールされたハンドラを置き換えて委譲するようなコードは、通常その動
作を期待するからです。 ‘unittest’ の control-c 処理を無効にしたいような
個別のテストには、 *note removeHandler(): 154b. デコレータが使えます。

フレームワークの作者がテストフレームワーク内で control-c 処理を有効にす
るための、いくつかのユーティリティ関数があります。

 -- の関数: unittest.installHandler ()

     control-c ハンドラをインストールします。(主にユーザが control-c を
     押したことにより) *note signal.SIGINT: 253. が受け取られると、登録
     した結果すべてに *note stop(): 4614. が呼び出されます。

 -- の関数: unittest.registerResult (result)

     control-c 処理のために *note TestResult: 137f. を登録します。結果を
     登録するとそれに対する弱参照が格納されるので、結果がガベージコレク
     トされるのを妨げません。

     control-c 処理が有効でなければ、 *note TestResult: 137f. オブジェク
     トの登録には副作用がありません。ですからテストフレームワークは、処
     理が有効か無効かにかかわらず、作成する全ての結果を無条件に登録でき
     ます。

 -- の関数: unittest.removeResult (result)

     登録された結果を削除します。一旦結果が削除されると、control-c が押
     された際にその結果オブジェクトに対して *note stop(): 4614. が呼び出
     されなくなります。

 -- の関数: unittest.removeHandler (function=None)

     引数なしで呼び出されると、この関数はCtrl+Cのシグナルハンドラを（そ
     れがインストールされていた場合）削除します。また、この関数はテスト
     が実行されている間、Ctrl+Cのハンドラを一時的に削除するテストデコレ
     ーターとしても使用できます。

          @unittest.removeHandler
          def test_signal_handling(self):
              ...


File: python.info,  Node: unittest mock --- モックオブジェクトライブラリ,  Next: unittest mock --- 入門,  Prev: unittest --- ユニットテストフレームワーク,  Up: 開発ツール

5.26.6 ‘unittest.mock’ -- モックオブジェクトライブラリ
------------------------------------------------------

Added in version 3.3.

'ソースコード:' Lib/unittest/mock.py(1)

__________________________________________________________________

‘unittest.mock’ is a library for testing in Python.  It allows you to
replace parts of your system under test with mock objects and make
assertions about how they have been used.

‘unittest.mock’ provides a core *note Mock: c3f. class removing the need
to create a host of stubs throughout your test suite.  After performing
an action, you can make assertions about which methods / attributes were
used and arguments they were called with.  You can also specify return
values and set needed attributes in the normal way.

加えて、 mock はテストのスコープ内にあるモジュールやクラスの属性を変更す
る *note patch(): 1092. デコレータを提供します。さらに、ユニークなオブジ
ェクトの作成には *note sentinel: d99. が利用できます。 *note Mock: c3f.
や *note MagicMock: 108f. 、 *note patch(): 1092. の利用例は *note quick
guide: 462a. を参照してください。

Mock は *note unittest: 10c. で利用するために設計されており、多くのモッ
クフレームワークで使われる 'record -> replay' パターンの代わりに、
'action -> assertion' パターンに基づいています。

There is a backport of ‘unittest.mock’ for earlier versions of Python,
available as mock(2) on PyPI.

* Menu:

* クイックガイド::
* Mock クラス::
* patcher::
* MagicMock と magic method のサポート::
* ヘルパー::
* Order of precedence of side_effect, return_value and wraps: Order of precedence of side_effect return_value and wraps.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/unittest/mock.py

   (2) https://pypi.org/project/mock/


File: python.info,  Node: クイックガイド,  Next: Mock クラス,  Up: unittest mock --- モックオブジェクトライブラリ

5.26.6.1 クイックガイド
.......................

*note Mock: c3f. および *note MagicMock: 108f. オブジェクトはアクセスし
たすべての属性とメソッドを作成し、どのように使用されたかについての詳細な
情報を格納します。戻り値を指定したり利用できる属性を制限するために *note
Mock: c3f. および *note MagicMock: 108f. を設定でき、どのよう使用された
かについてアサートできます:

     >>> from unittest.mock import MagicMock
     >>> thing = ProductionClass()
     >>> thing.method = MagicMock(return_value=3)
     >>> thing.method(3, 4, 5, key='value')
     3
     >>> thing.method.assert_called_with(3, 4, 5, key='value')

*note side_effect: 462b. によって、モック呼び出し時の例外発生などの副作
用を実行できます:

     >>> from unittest.mock import Mock
     >>> mock = Mock(side_effect=KeyError('foo'))
     >>> mock()
     Traceback (most recent call last):
      ...
     KeyError: 'foo'

     >>> values = {'a': 1, 'b': 2, 'c': 3}
     >>> def side_effect(arg):
     ...     return values[arg]
     ...
     >>> mock.side_effect = side_effect
     >>> mock('a'), mock('b'), mock('c')
     (1, 2, 3)
     >>> mock.side_effect = [5, 4, 3, 2, 1]
     >>> mock(), mock(), mock()
     (5, 4, 3)

モックには多くの設定法や挙動の制御法があります。例えば 'spec' 引数によっ
て別のオブジェクトからの仕様を受け取るよう設定できます。 spec にないモッ
クの属性やメソッドにアクセスを試みた場合、 *note AttributeError: 5f0. で
失敗します。

*note patch(): 1092. デコレータ / コンテキストマネージャーによってテスト
対象のモジュール内のクラスやオブジェクトを簡単にモックできます。指定した
オブジェクトはテスト中はモック (または別のオブジェクト) に置換され、テス
ト終了時に復元されます:

     >>> from unittest.mock import patch
     >>> @patch('module.ClassName2')
     ... @patch('module.ClassName1')
     ... def test(MockClass1, MockClass2):
     ...     module.ClassName1()
     ...     module.ClassName2()
     ...     assert MockClass1 is module.ClassName1
     ...     assert MockClass2 is module.ClassName2
     ...     assert MockClass1.called
     ...     assert MockClass2.called
     ...
     >>> test()

     注釈: patch デコレータをネストした場合、モックは適用されるときと同
     じ順番 (デコレータを適用するときの通常の 'Python' の順番) でデコレ
     ートされた関数に渡されます。 つまり下から順に適用されるため、上の例
     では ‘module.ClassName1’ のモックが最初に渡されます。

     *note patch(): 1092. では探索される名前空間内のオブジェクトにパッチ
     をあてることが重要です。通常は単純ですが、詳しくは *note
     どこにパッチするか: 462c. を参照してください。

*note patch(): 1092. デコレータと同様に with 文でコンテキストマネージャ
ーとして使用できます:

     >>> with patch.object(ProductionClass, 'method', return_value=None) as mock_method:
     ...     thing = ProductionClass()
     ...     thing.method(1, 2, 3)
     ...
     >>> mock_method.assert_called_once_with(1, 2, 3)

また、 *note patch.dict(): 1967. を使うと、スコープ内だけで辞書に値を設
定し、テスト終了時には元の状態に復元されます:

     >>> foo = {'key': 'value'}
     >>> original = foo.copy()
     >>> with patch.dict(foo, {'newkey': 'newvalue'}, clear=True):
     ...     assert foo == {'newkey': 'newvalue'}
     ...
     >>> assert foo == original

mock は Python の *note マジックメソッド: 462d. のモックをサポートしてい
ます。 マジックメソッドのもっとも簡単な利用法は *note MagicMock: 108f. ク
ラスと使うことです。以下のように利用します:

     >>> mock = MagicMock()
     >>> mock.__str__.return_value = 'foobarbaz'
     >>> str(mock)
     'foobarbaz'
     >>> mock.__str__.assert_called_with()

mock によってマジックメソッドに関数 (あるいは他の Mock インスタンス) を
割り当てることができ、それらは適切に呼び出されます。 *note MagicMock:
108f. クラスは、すべてのマジックメソッドがあらかじめ作成されている点を除
けば *note Mock: c3f. クラスと一緒です (まあ、とにかく便利ってこと)。

以下は通常の Mock クラスでマジックメソッドを利用する例です:

     >>> mock = Mock()
     >>> mock.__str__ = Mock(return_value='wheeeeee')
     >>> str(mock)
     'wheeeeee'

テスト内のモックオブジェクトが置換するオブジェクトと同じ API を持つこと
を保証するには、 *note auto-speccing: 462e. を使うことができます。パッチ
をあてる 'autospec' 引数、または *note create_autospec(): 1934. 関数を通
じて auto-speccing は行われます。 auto-speccing は置換するオブジェクトと
同じ属性とメソッドを持つモックオブジェクトを作成し、すべての関数および
(コンストラクタを含む) メソッドは本物のオブジェクトと同じ呼び出しシグネ
チャを持ちます。

誤って使用された場合、モックは製品コードと同じように失敗されることが保証
されています:

     >>> from unittest.mock import create_autospec
     >>> def function(a, b, c):
     ...     pass
     ...
     >>> mock_function = create_autospec(function, return_value='fishy')
     >>> mock_function(1, 2, 3)
     'fishy'
     >>> mock_function.assert_called_once_with(1, 2, 3)
     >>> mock_function('wrong arguments')
     Traceback (most recent call last):
      ...
     TypeError: missing a required argument: 'b'

*note create_autospec(): 1934. はクラスにおいても利用でき、 ‘__init__’ メ
ソッドのシグニチャをコピーします。また、呼び出し可能オブジェクトについて
も ‘__call__’ メソッドのシグニチャをコピーします。


File: python.info,  Node: Mock クラス,  Next: patcher,  Prev: クイックガイド,  Up: unittest mock --- モックオブジェクトライブラリ

5.26.6.2 Mock クラス
....................

*note Mock: c3f. は、コードにおけるスタブの使用やテストダブルを置き換え
るための柔軟なモックオブジェクトです。モックは呼び出し可能で、属性にアク
セスした場合それを新たなモックとして作成します (1)。同じ属性にアクセスし
た場合は常に同じモックを返します。 モックはどのように使われたかを記録す
るので、コードがモックに行うことについてアサートできます。

*note MagicMock: 108f. は *note Mock: c3f. のサブクラスで、すべてのマジ
ックメソッドが事前に作成され、利用できます。また、呼び出し不可能なモック
を作成する場合には、呼び出し不能な変種の *note NonCallableMock: 4630. や
*note NonCallableMagicMock: 4631. があります。

*note patch(): 1092. デコレータによって特定のモジュール内のクラスを
*note Mock: c3f. オブジェクトで一時的に置換することが簡単にできます。デ
フォルトでは *note patch(): 1092. は *note MagicMock: 108f. を作成します
。 *note patch(): 1092. に渡す 'new_callable' 引数によって、別の *note
Mock: c3f. クラスを指定できます。

 -- クラス: unittest.mock.Mock (spec=None, side_effect=None,
          return_value=DEFAULT, wraps=None, name=None, spec_set=None,
          unsafe=False, **kwargs)

     新しい *note Mock: c3f. オブジェクトを作成します。 *note Mock: c3f.
     はモックオブジェクトの挙動を指定するオプション引数をいくつか取りま
     す:

        * 'spec': モックオブジェクトの仕様として働く文字列のリストもしく
          は存在するオブジェクト (クラスもしくはインスタンス) を指定しま
          す。オブジェクトを渡した場合には、 dir 関数によって文字列のリ
          ストが生成されます (サポートされない特殊属性や特殊メソッドは除
          く) 。このリストにない属性にアクセスした際には *note
          AttributeError: 5f0. が発生します。

          'spec' が (文字列のリストではなく) オブジェクトの場合、 *note
          __class__: 16c6. はスペックオブジェクトのクラスを返します。こ
          れによってモックが *note isinstance(): 2ad. テストに通るように
          なります。

        * 'spec_set': より厳しい 'spec' です。こちらを利用した場合、
          'spec_set' に渡されたオブジェクトに存在しない属性に対し '設定'
          や取得をしようとした際に *note AttributeError: 5f0. が発生しま
          す。

        * 'side_effect': モックが呼び出された際に呼び出される関数を指定
          します。 *note side_effect: 462b. 属性を参考にしてください。例
          外を発生させたり、動的に戻り値を変更する場合に便利です。関数に
          は、モックと同じ引数が渡され、 *note DEFAULT: 4632. を返さない
          限りはこの関数の戻り値が使われます。

          一方で、 'side_effect' には、例外クラスやインスタンスを指定で
          きます。この場合は、モックが呼び出された際に指定された例外を発
          生します。

          もし、 'side_effect' にイテレート可能オブジェクトを指定した場
          合には、モックの呼び出しごとに順に値を返します。

          'side_effect' に ‘None’ を指定した場合には、設定がクリアされま
          す。

        * 'return_value': モックが呼び出された際に返す値です。デフォルト
          では (最初にアクセスされた際に生成される) 新しい Mock を返しま
          す。 *note return_value: 4633. を参照してください。

        * 'unsafe': By default, accessing any attribute whose name
          starts with 'assert', 'assret', 'asert', 'aseert' or 'assrt'
          will raise an *note AttributeError: 5f0.  Passing
          ‘unsafe=True’ will allow access to these attributes.

          Added in version 3.5.

        * 'wraps': このモックオブジェクトがラップするものです。 'wraps'
          が ‘None’ でなければ、このモックを呼び出すと、その呼び出しがラ
          ップされたオブジェクトに渡され (て実際の結果を返し) ます。モッ
          クの属性アクセスは、ラップされたオブジェクトの対応する属性をラ
          ップする Mock オブジェクトを返します (なので、存在しない属性に
          アクセスしようとすると *note AttributeError: 5f0. を送出します
          )。

          モックが明示的に 'return_value' を設定されていると、呼び出しは
          ラップされたオブジェクトに渡されず、代わりに 'return_value' が
          返されます。

        * 'name': モックに名前があるなら、それがモックの repr として使わ
          れます。これはデバッグの際に役立つでしょう。この名前は子のモッ
          クにも伝播します。

     モックは、任意のキーワード引数を与えることができます。これらはモッ
     クの生成後、属性の設定に使われます。詳細は *note configure_mock():
     4634. を参照してください。

      -- メソッド: assert_called ()

          モックが少なくとも一度は呼び出されたことをアサートします。

               >>> mock = Mock()
               >>> mock.method()
               <Mock name='mock.method()' id='...'>
               >>> mock.method.assert_called()

          Added in version 3.6.

      -- メソッド: assert_called_once ()

          モックが一度だけ呼び出されたことをアサートします。

               >>> mock = Mock()
               >>> mock.method()
               <Mock name='mock.method()' id='...'>
               >>> mock.method.assert_called_once()
               >>> mock.method()
               <Mock name='mock.method()' id='...'>
               >>> mock.method.assert_called_once()
               Traceback (most recent call last):
               ...
               AssertionError: Expected 'method' to have been called once. Called 2 times.
               Calls: [call(), call()].

          Added in version 3.6.

      -- メソッド: assert_called_with (*args, **kwargs)

          This method is a convenient way of asserting that the last
          call has been made in a particular way:

               >>> mock = Mock()
               >>> mock.method(1, 2, 3, test='wow')
               <Mock name='mock.method()' id='...'>
               >>> mock.method.assert_called_with(1, 2, 3, test='wow')

      -- メソッド: assert_called_once_with (*args, **kwargs)

          モックが一度だけ呼び出され、かつ指定された引数で呼び出されたこ
          とをアサートします。

               >>> mock = Mock(return_value=None)
               >>> mock('foo', bar='baz')
               >>> mock.assert_called_once_with('foo', bar='baz')
               >>> mock('other', bar='values')
               >>> mock.assert_called_once_with('other', bar='values')
               Traceback (most recent call last):
                 ...
               AssertionError: Expected 'mock' to be called once. Called 2 times.
               Calls: [call('foo', bar='baz'), call('other', bar='values')].

      -- メソッド: assert_any_call (*args, **kwargs)

          モックが特定の引数で呼び出されたことがあるのをアサートします。

          The assert passes if the mock has 'ever' been called, unlike
          *note assert_called_with(): 1e03. and *note
          assert_called_once_with(): 4635. that only pass if the call is
          the most recent one, and in the case of *note
          assert_called_once_with(): 4635. it must also be the only
          call.

               >>> mock = Mock(return_value=None)
               >>> mock(1, 2, arg='thing')
               >>> mock('some', 'thing', 'else')
               >>> mock.assert_any_call(1, 2, arg='thing')

      -- メソッド: assert_has_calls (calls, any_order=False)

          モックが特定の呼び出しで呼ばれたことをアサートします。呼び出し
          では *note mock_calls: 4637. のリストがチェックされます。

          'any_order' が false の場合、呼び出しは連続していなければなり
          ません。指定された呼び出しの前、あるいは呼び出しの後に余分な呼
          び出しがある場合があります。

          'any_order' が true の場合、呼び出しは任意の順番でも構いません
          が、それらがすべて *note mock_calls: 4637. に現われなければな
          りません。

               >>> mock = Mock(return_value=None)
               >>> mock(1)
               >>> mock(2)
               >>> mock(3)
               >>> mock(4)
               >>> calls = [call(2), call(3)]
               >>> mock.assert_has_calls(calls)
               >>> calls = [call(4), call(2), call(3)]
               >>> mock.assert_has_calls(calls, any_order=True)

      -- メソッド: assert_not_called ()

          モックが一度も呼ばれなかったことをアサートします。

               >>> m = Mock()
               >>> m.hello.assert_not_called()
               >>> obj = m.hello()
               >>> m.hello.assert_not_called()
               Traceback (most recent call last):
                 ...
               AssertionError: Expected 'hello' to not have been called. Called 1 times.
               Calls: [call()].

          Added in version 3.5.

      -- メソッド: reset_mock (*, return_value=False, side_effect=False)

          モックオブジェクトのすべての呼び出し属性をリセットします:

               >>> mock = Mock(return_value=None)
               >>> mock('hello')
               >>> mock.called
               True
               >>> mock.reset_mock()
               >>> mock.called
               False

          This can be useful where you want to make a series of
          assertions that reuse the same object.

          'return_value' parameter when set to ‘True’ resets *note
          return_value: 4633.:

               >>> mock = Mock(return_value=5)
               >>> mock('hello')
               5
               >>> mock.reset_mock(return_value=True)
               >>> mock('hello')
               <Mock name='mock()' id='...'>

          'side_effect' parameter when set to ‘True’ resets *note
          side_effect: 462b.:

               >>> mock = Mock(side_effect=ValueError)
               >>> mock('hello')
               Traceback (most recent call last):
                 ...
               ValueError
               >>> mock.reset_mock(side_effect=True)
               >>> mock('hello')
               <Mock name='mock()' id='...'>

          Note that *note reset_mock(): ef6. 'doesn't' clear the *note
          return_value: 4633, *note side_effect: 462b. or any child
          attributes you have set using normal assignment by default.

          Child mocks are reset as well.

          バージョン 3.6 で変更: 2つのキーワード専用引数が reset_mock 関
          数に追加されました。

      -- メソッド: mock_add_spec (spec, spec_set=False)

          モックに仕様を追加します。 'spec' にはオブジェクトもしくは文字
          列のリストを指定してください。 'spec' で設定した属性は、モック
          の属性としてのみアクセスできます。

          'spec_set' が真なら、 spec 以外の属性は設定できません。

      -- メソッド: attach_mock (mock, attribute)

          属性として mock を設定して、その名前と親を入れ替えます。設定さ
          れたモックの呼び出しは、 *note method_calls: 4639. や *note
          mock_calls: 4637. 属性に記録されます。

      -- メソッド: configure_mock (**kwargs)

          モックの属性をキーワード引数で設定します。

          属性に加え、子の戻り値や副作用もドット表記を用いて設定でき、辞
          書はメソッドの呼び出し時にアンパックされます:

               >>> mock = Mock()
               >>> attrs = {'method.return_value': 3, 'other.side_effect': KeyError}
               >>> mock.configure_mock(**attrs)
               >>> mock.method()
               3
               >>> mock.other()
               Traceback (most recent call last):
                 ...
               KeyError

          コンストラクタの呼び出しでも同様に行うことができます:

               >>> attrs = {'method.return_value': 3, 'other.side_effect': KeyError}
               >>> mock = Mock(some_attribute='eggs', **attrs)
               >>> mock.some_attribute
               'eggs'
               >>> mock.method()
               3
               >>> mock.other()
               Traceback (most recent call last):
                 ...
               KeyError

          *note configure_mock(): 4634. は、モック生成後のコンフィギュレ
          ーションを容易に行うために存在します。

      -- メソッド: __dir__ ()

          *note Mock: c3f. オブジェクトは、有用な結果を得るために
          ‘dir(some_mock)’ の結果を制限します。 'spec' を設定したモック
          に対しては、許可された属性のみを含みます。

          このフィルタが何をしていて、どのように停止させるかは、 *note
          FILTER_DIR: 463b. を参照してください。

      -- メソッド: _get_child_mock (**kw)

          子のモックを作成し、その値を返すようにしてください。デフォルト
          では親と同じタイプで作成されます。サブクラスで子モックの作成さ
          れる方法をカスタマイズしたい場合には、このメソッドをオーバーラ
          イドします。

          呼び出し不可能なモックに対しては、(カスタムのサブクラスではな
          く) 呼び出し可能なモックが使われます。

      -- の属性: called

          このモックが呼び出されたかどうかを表します:

               >>> mock = Mock(return_value=None)
               >>> mock.called
               False
               >>> mock()
               >>> mock.called
               True

      -- の属性: call_count

          このモックオブジェクトが呼び出された回数を返します:

               >>> mock = Mock(return_value=None)
               >>> mock.call_count
               0
               >>> mock()
               >>> mock()
               >>> mock.call_count
               2

      -- の属性: return_value

          モックが呼び出された際に返す値を設定します:

               >>> mock = Mock()
               >>> mock.return_value = 'fish'
               >>> mock()
               'fish'

          デフォルトの戻り値はモックオブジェクトです。通常の方法で設定す
          ることもできます:

               >>> mock = Mock()
               >>> mock.return_value.attribute = sentinel.Attribute
               >>> mock.return_value()
               <Mock name='mock()()' id='...'>
               >>> mock.return_value.assert_called_with()

          *note return_value: 4633. は生成時にも設定可能です:

               >>> mock = Mock(return_value=3)
               >>> mock.return_value
               3
               >>> mock()
               3

      -- の属性: side_effect

          このモックが呼ばれた際に呼び出される関数、イテラブル、もしくは
          発生させる例外 (クラスまたはインスタンス) を設定できます。

          関数を渡した場合はモックと同じ引数で呼び出され、 *note
          DEFAULT: 4632. を返さない限りはその関数の戻り値が返されます。
          関数が *note DEFAULT: 4632. を返した場合は ( *note
          return_value: 4633. によって) モックの通常の値を返します。

          iterable が渡された場合、その値はイテレータを取り出すために使
          用されます。イテレータは毎回の呼び出しにおいて値を yield しな
          ければなりません。この値は、送出される例外インスタンスか、呼び
          出しからモックに返される値のいずれかです (*note DEFAULT: 4632.
          の処理は関数の場合と同一です)。

          以下はモックが (API による例外の扱いをテストするために) 例外を
          発生させる例です:

               >>> mock = Mock()
               >>> mock.side_effect = Exception('Boom!')
               >>> mock()
               Traceback (most recent call last):
                 ...
               Exception: Boom!

          *note side_effect: 462b. を使用して連続的に値を返します:

               >>> mock = Mock()
               >>> mock.side_effect = [3, 2, 1]
               >>> mock(), mock(), mock()
               (3, 2, 1)

          呼び出し可能オブジェクトを使います:

               >>> mock = Mock(return_value=3)
               >>> def side_effect(*args, **kwargs):
               ...     return DEFAULT
               ...
               >>> mock.side_effect = side_effect
               >>> mock()
               3

          *note side_effect: 462b. は生成時にも設定可能です。呼び出し時
          の値に 1 を加えて返す例を以下に示します:

               >>> side_effect = lambda value: value + 1
               >>> mock = Mock(side_effect=side_effect)
               >>> mock(3)
               4
               >>> mock(-8)
               -7

          *note side_effect: 462b. に ‘None’ を設定した場合はクリアされ
          ます:

               >>> m = Mock(side_effect=KeyError, return_value=3)
               >>> m()
               Traceback (most recent call last):
                ...
               KeyError
               >>> m.side_effect = None
               >>> m()
               3

      -- の属性: call_args

          This is either ‘None’ (if the mock hasn't been called), or the
          arguments that the mock was last called with.  This will be in
          the form of a tuple: the first member, which can also be
          accessed through the ‘args’ property, is any positional
          arguments the mock was called with (or an empty tuple) and the
          second member, which can also be accessed through the ‘kwargs’
          property, is any keyword arguments (or an empty dictionary).

               >>> mock = Mock(return_value=None)
               >>> print(mock.call_args)
               None
               >>> mock()
               >>> mock.call_args
               call()
               >>> mock.call_args == ()
               True
               >>> mock(3, 4)
               >>> mock.call_args
               call(3, 4)
               >>> mock.call_args == ((3, 4),)
               True
               >>> mock.call_args.args
               (3, 4)
               >>> mock.call_args.kwargs
               {}
               >>> mock(3, 4, 5, key='fish', next='w00t!')
               >>> mock.call_args
               call(3, 4, 5, key='fish', next='w00t!')
               >>> mock.call_args.args
               (3, 4, 5)
               >>> mock.call_args.kwargs
               {'key': 'fish', 'next': 'w00t!'}

          *note call_args: 1d69. は、 *note call_args_list: 463e. や
          *note method_calls: 4639. 、 *note mock_calls: 4637. と同様、
          *note call: 1db3. オブジェクトです。これらはタプルとしてアンパ
          ックすることで個別に取り出すことができます。そして、より複雑な
          アサーションを行うことができます。 *note calls as tuples:
          463f. を参照してください。

          バージョン 3.8 で変更: ‘args’ と ‘kwargs’ 属性が追加されました
          。

      -- の属性: call_args_list

          モックの呼び出しを順に記録したリストです (よって、このリストの
          長さはモックが呼び出された回数と等しくなります)。モックを作成
          してから一度も呼び出しを行なっていない場合は、空のリストが返さ
          れます。 *note call: 1db3. オブジェクトは、 *note
          call_args_list: 463e. の比較対象となる呼び出しのリストを作成す
          る際に便利です。

               >>> mock = Mock(return_value=None)
               >>> mock()
               >>> mock(3, 4)
               >>> mock(key='fish', next='w00t!')
               >>> mock.call_args_list
               [call(), call(3, 4), call(key='fish', next='w00t!')]
               >>> expected = [(), ((3, 4),), ({'key': 'fish', 'next': 'w00t!'},)]
               >>> mock.call_args_list == expected
               True

          *note call_args_list: 463e. のメンバは *note call: 1db3. オブ
          ジェクトです。タプルとしてアンパックすることで個別に取り出すこ
          とができます。 *note calls as tuples: 463f. を参照してください
          。

      -- の属性: method_calls

          自身の呼び出しと同様に、モックはメソッドや属性、そして 'それら
          の' メソッドや属性の呼び出しも追跡します:

               >>> mock = Mock()
               >>> mock.method()
               <Mock name='mock.method()' id='...'>
               >>> mock.property.method.attribute()
               <Mock name='mock.property.method.attribute()' id='...'>
               >>> mock.method_calls
               [call.method(), call.property.method.attribute()]

          *note method_calls: 4639. のメンバは *note call: 1db3. オブジ
          ェクトです。タプルとしてアンパックすることで個別に取り出すこと
          ができます。 *note calls as tuples: 463f. を参照してください。

      -- の属性: mock_calls

          *note mock_calls: 4637. は、メソッド、特殊メソッド、 'そして'
          戻り値のモックまで、モックオブジェクトに対する 'すべての' 呼び
          出しを記録します。

               >>> mock = MagicMock()
               >>> result = mock(1, 2, 3)
               >>> mock.first(a=3)
               <MagicMock name='mock.first()' id='...'>
               >>> mock.second()
               <MagicMock name='mock.second()' id='...'>
               >>> int(mock)
               1
               >>> result(1)
               <MagicMock name='mock()()' id='...'>
               >>> expected = [call(1, 2, 3), call.first(a=3), call.second(),
               ... call.__int__(), call()(1)]
               >>> mock.mock_calls == expected
               True

          *note mock_calls: 4637. のメンバは *note call: 1db3. オブジェ
          クトです。タプルとしてアンパックすることで個別に取り出すことが
          できます。 *note calls as tuples: 463f. を参照してください。

               注釈: The way *note mock_calls: 4637. are recorded means
               that where nested calls are made, the parameters of
               ancestor calls are not recorded and so will always
               compare equal:

                    >>> mock = MagicMock()
                    >>> mock.top(a=3).bottom()
                    <MagicMock name='mock.top().bottom()' id='...'>
                    >>> mock.mock_calls
                    [call.top(a=3), call.top().bottom()]
                    >>> mock.mock_calls[-1] == call.top(a=-1).bottom()
                    True

      -- の属性: __class__

          通常、オブジェクトの ‘__class__’ 属性はその型を返します。
          ‘spec’ を設定したオブジェクトの場合、 ‘__class__’ は代わりに
          ‘spec’ のクラスを返します。これにより、置き換え / 偽装している
          オブジェクトに対する *note isinstance(): 2ad. も通過することが
          できます:

               >>> mock = Mock(spec=3)
               >>> isinstance(mock, int)
               True

          ‘__class__’ は書き換え可能で、 *note isinstance(): 2ad. を通る
          ために必ず spec を使う必要はありません:

               >>> mock = Mock()
               >>> mock.__class__ = dict
               >>> isinstance(mock, dict)
               True

 -- クラス: unittest.mock.NonCallableMock (spec=None, wraps=None,
          name=None, spec_set=None, **kwargs)

     呼び出しができない *note Mock: c3f. です。コンストラクタのパラメー
     タは *note Mock: c3f. と同様ですが、 'return_value' や
     'side_effect' は意味を持ちません。

‘spec’ か ‘spec_set’ にクラスかインスタンスを渡した mock は *note
isinstance(): 2ad. テストをパスします:

     >>> mock = Mock(spec=SomeClass)
     >>> isinstance(mock, SomeClass)
     True
     >>> mock = Mock(spec_set=SomeClass())
     >>> isinstance(mock, SomeClass)
     True

*note Mock: c3f. クラスは、 特殊メソッドをサポートしています。すべての詳
細は *note magic methods: 462d. を参照してください。

モッククラスや *note patch(): 1092. デコレータは、任意のキーワード引数を
設定できます。 *note patch(): 1092. デコレータへのキーワード引数は、モッ
クが作られる際のコンストラクタに渡されます。キーワード引数は、モックの属
性を設定します:

     >>> m = MagicMock(attribute=3, other='fish')
     >>> m.attribute
     3
     >>> m.other
     'fish'

子の戻り値や副作用も、ドットで表記することで同様に設定できます。呼び出し
時に直接ドットのついた名前を使用できないので、作成した辞書を ‘**’ でアン
パックする必要があります:

     >>> attrs = {'method.return_value': 3, 'other.side_effect': KeyError}
     >>> mock = Mock(some_attribute='eggs', **attrs)
     >>> mock.some_attribute
     'eggs'
     >>> mock.method()
     3
     >>> mock.other()
     Traceback (most recent call last):
       ...
     KeyError

'spec' (または 'spec_set') によって作成された呼び出し可能なモックは、モ
ックへの呼び出しがマッチしたときに仕様オブジェクトのシグネチャを内省しま
す。したがって、引数を位置引数として渡したか名前で渡したかどうかに関わら
ず、実際の呼び出しの引数とマッチすることができます:

     >>> def f(a, b, c): pass
     ...
     >>> mock = Mock(spec=f)
     >>> mock(1, 2, c=3)
     <Mock name='mock()' id='140161580456576'>
     >>> mock.assert_called_with(1, 2, 3)
     >>> mock.assert_called_with(a=1, b=2, c=3)

これは *note assert_called_with(): 1e03, *note
assert_called_once_with(): 4635, *note assert_has_calls(): 1a22. and
*note assert_any_call(): 4636. にも適用されます。 *note autospec を使う:
462e. と、 モックオブジェクトのメソッド呼び出しにも適用されます。

バージョン 3.4 で変更: spec や autospec を用いて生成されたモックオブジェ
クトは、シグネチャを考慮するようになりました。

 -- クラス: unittest.mock.PropertyMock (*args, **kwargs)

     *note property: 4b3. もしくは:term:‘デスクリプタ <descriptor>’ とし
     て使われるためのモックです。 *note PropertyMock: 4641. は、 *note
     __get__(): 1701. と *note __set__(): 23b5. メソッドを提供し、戻り値
     を指定することができます。

     オブジェクトから *note PropertyMock: 4641. のインスタンスを取得する
     ことは、引数を与えないモックの呼び出しに相当します。設定は、 設定す
     る値を伴った呼び出しになります。:

          >>> class Foo:
          ...     @property
          ...     def foo(self):
          ...         return 'something'
          ...     @foo.setter
          ...     def foo(self, value):
          ...         pass
          ...
          >>> with patch('__main__.Foo.foo', new_callable=PropertyMock) as mock_foo:
          ...     mock_foo.return_value = 'mockity-mock'
          ...     this_foo = Foo()
          ...     print(this_foo.foo)
          ...     this_foo.foo = 6
          ...
          mockity-mock
          >>> mock_foo.mock_calls
          [call(), call(6)]

*note PropertyMock: 4641. を直接モックに取り付ける方法は、モックの属性を
保存する方法によりうまく動作しません。代わりに、モック型に取り付けてくだ
さい:

     >>> m = MagicMock()
     >>> p = PropertyMock(return_value=3)
     >>> type(m).foo = p
     >>> m.foo
     3
     >>> p.assert_called_once_with()

     注意: If an *note AttributeError: 5f0. is raised by *note
     PropertyMock: 4641, it will be interpreted as a missing descriptor
     and *note __getattr__(): 6fa. will be called on the parent mock:

          >>> m = MagicMock()
          >>> no_attribute = PropertyMock(side_effect=AttributeError)
          >>> type(m).my_property = no_attribute
          >>> m.my_property
          <MagicMock name='mock.my_property' id='140165240345424'>

     詳細は *note __getattr__(): 6fa. を参照してください。

 -- クラス: unittest.mock.AsyncMock (spec=None, side_effect=None,
          return_value=DEFAULT, wraps=None, name=None, spec_set=None,
          unsafe=False, **kwargs)

     An asynchronous version of *note MagicMock: 108f.  The *note
     AsyncMock: c3e. object will behave so the object is recognized as
     an async function, and the result of a call is an awaitable.

          >>> mock = AsyncMock()
          >>> inspect.iscoroutinefunction(mock)
          True
          >>> inspect.isawaitable(mock())
          True

     The result of ‘mock()’ is an async function which will have the
     outcome of ‘side_effect’ or ‘return_value’ after it has been
     awaited:

        - if ‘side_effect’ is a function, the async function will return
          the result of that function,

        - if ‘side_effect’ is an exception, the async function will
          raise the exception,

        - if ‘side_effect’ is an iterable, the async function will
          return the next value of the iterable, however, if the
          sequence of result is exhausted, ‘StopAsyncIteration’ is
          raised immediately,

        - if ‘side_effect’ is not defined, the async function will
          return the value defined by ‘return_value’, hence, by default,
          the async function returns a new *note AsyncMock: c3e. object.

     Setting the 'spec' of a *note Mock: c3f. or *note MagicMock: 108f.
     to an async function will result in a coroutine object being
     returned after calling.

          >>> async def async_func(): pass
          ...
          >>> mock = MagicMock(async_func)
          >>> mock
          <MagicMock spec='function' id='...'>
          >>> mock()
          <coroutine object AsyncMockMixin._mock_call at ...>

     Setting the 'spec' of a *note Mock: c3f, *note MagicMock: 108f, or
     *note AsyncMock: c3e. to a class with asynchronous and synchronous
     functions will automatically detect the synchronous functions and
     set them as *note MagicMock: 108f. (if the parent mock is *note
     AsyncMock: c3e. or *note MagicMock: 108f.) or *note Mock: c3f. (if
     the parent mock is *note Mock: c3f.).  All asynchronous functions
     will be *note AsyncMock: c3e.

          >>> class ExampleClass:
          ...     def sync_foo():
          ...         pass
          ...     async def async_foo():
          ...         pass
          ...
          >>> a_mock = AsyncMock(ExampleClass)
          >>> a_mock.sync_foo
          <MagicMock name='mock.sync_foo' id='...'>
          >>> a_mock.async_foo
          <AsyncMock name='mock.async_foo' id='...'>
          >>> mock = Mock(ExampleClass)
          >>> mock.sync_foo
          <Mock name='mock.sync_foo' id='...'>
          >>> mock.async_foo
          <AsyncMock name='mock.async_foo' id='...'>

     Added in version 3.8.

      -- メソッド: assert_awaited ()

          Assert that the mock was awaited at least once.  Note that
          this is separate from the object having been called, the
          ‘await’ keyword must be used:

               >>> mock = AsyncMock()
               >>> async def main(coroutine_mock):
               ...     await coroutine_mock
               ...
               >>> coroutine_mock = mock()
               >>> mock.called
               True
               >>> mock.assert_awaited()
               Traceback (most recent call last):
               ...
               AssertionError: Expected mock to have been awaited.
               >>> asyncio.run(main(coroutine_mock))
               >>> mock.assert_awaited()

      -- メソッド: assert_awaited_once ()

          Assert that the mock was awaited exactly once.

               >>> mock = AsyncMock()
               >>> async def main():
               ...     await mock()
               ...
               >>> asyncio.run(main())
               >>> mock.assert_awaited_once()
               >>> asyncio.run(main())
               >>> mock.assert_awaited_once()
               Traceback (most recent call last):
               ...
               AssertionError: Expected mock to have been awaited once. Awaited 2 times.

      -- メソッド: assert_awaited_with (*args, **kwargs)

          Assert that the last await was with the specified arguments.

               >>> mock = AsyncMock()
               >>> async def main(*args, **kwargs):
               ...     await mock(*args, **kwargs)
               ...
               >>> asyncio.run(main('foo', bar='bar'))
               >>> mock.assert_awaited_with('foo', bar='bar')
               >>> mock.assert_awaited_with('other')
               Traceback (most recent call last):
               ...
               AssertionError: expected await not found.
               Expected: mock('other')
               Actual: mock('foo', bar='bar')

      -- メソッド: assert_awaited_once_with (*args, **kwargs)

          Assert that the mock was awaited exactly once and with the
          specified arguments.

               >>> mock = AsyncMock()
               >>> async def main(*args, **kwargs):
               ...     await mock(*args, **kwargs)
               ...
               >>> asyncio.run(main('foo', bar='bar'))
               >>> mock.assert_awaited_once_with('foo', bar='bar')
               >>> asyncio.run(main('foo', bar='bar'))
               >>> mock.assert_awaited_once_with('foo', bar='bar')
               Traceback (most recent call last):
               ...
               AssertionError: Expected mock to have been awaited once. Awaited 2 times.

      -- メソッド: assert_any_await (*args, **kwargs)

          Assert the mock has ever been awaited with the specified
          arguments.

               >>> mock = AsyncMock()
               >>> async def main(*args, **kwargs):
               ...     await mock(*args, **kwargs)
               ...
               >>> asyncio.run(main('foo', bar='bar'))
               >>> asyncio.run(main('hello'))
               >>> mock.assert_any_await('foo', bar='bar')
               >>> mock.assert_any_await('other')
               Traceback (most recent call last):
               ...
               AssertionError: mock('other') await not found

      -- メソッド: assert_has_awaits (calls, any_order=False)

          Assert the mock has been awaited with the specified calls.
          The *note await_args_list: 1d68. list is checked for the
          awaits.

          If 'any_order' is false then the awaits must be sequential.
          There can be extra calls before or after the specified awaits.

          If 'any_order' is true then the awaits can be in any order,
          but they must all appear in *note await_args_list: 1d68.

               >>> mock = AsyncMock()
               >>> async def main(*args, **kwargs):
               ...     await mock(*args, **kwargs)
               ...
               >>> calls = [call("foo"), call("bar")]
               >>> mock.assert_has_awaits(calls)
               Traceback (most recent call last):
               ...
               AssertionError: Awaits not found.
               Expected: [call('foo'), call('bar')]
               Actual: []
               >>> asyncio.run(main('foo'))
               >>> asyncio.run(main('bar'))
               >>> mock.assert_has_awaits(calls)

      -- メソッド: assert_not_awaited ()

          Assert that the mock was never awaited.

               >>> mock = AsyncMock()
               >>> mock.assert_not_awaited()

      -- メソッド: reset_mock (*args, **kwargs)

          See *note Mock.reset_mock(): ef6.  Also sets *note
          await_count: 464a. to 0, *note await_args: 464b. to None, and
          clears the *note await_args_list: 1d68.

      -- の属性: await_count

          An integer keeping track of how many times the mock object has
          been awaited.

               >>> mock = AsyncMock()
               >>> async def main():
               ...     await mock()
               ...
               >>> asyncio.run(main())
               >>> mock.await_count
               1
               >>> asyncio.run(main())
               >>> mock.await_count
               2

      -- の属性: await_args

          This is either ‘None’ (if the mock hasn’t been awaited), or
          the arguments that the mock was last awaited with.  Functions
          the same as *note Mock.call_args: 1d69.

               >>> mock = AsyncMock()
               >>> async def main(*args):
               ...     await mock(*args)
               ...
               >>> mock.await_args
               >>> asyncio.run(main('foo'))
               >>> mock.await_args
               call('foo')
               >>> asyncio.run(main('bar'))
               >>> mock.await_args
               call('bar')

      -- の属性: await_args_list

          This is a list of all the awaits made to the mock object in
          sequence (so the length of the list is the number of times it
          has been awaited).  Before any awaits have been made it is an
          empty list.

               >>> mock = AsyncMock()
               >>> async def main(*args):
               ...     await mock(*args)
               ...
               >>> mock.await_args_list
               []
               >>> asyncio.run(main('foo'))
               >>> mock.await_args_list
               [call('foo')]
               >>> asyncio.run(main('bar'))
               >>> mock.await_args_list
               [call('foo'), call('bar')]

 -- クラス: unittest.mock.ThreadingMock (spec=None, side_effect=None,
          return_value=DEFAULT, wraps=None, name=None, spec_set=None,
          unsafe=False, *, timeout=UNSET, **kwargs)

     A version of *note MagicMock: 108f. for multithreading tests.  The
     *note ThreadingMock: 464c. object provides extra methods to wait
     for a call to be invoked, rather than assert on it immediately.

     The default timeout is specified by the ‘timeout’ argument, or if
     unset by the *note ThreadingMock.DEFAULT_TIMEOUT: 464d. attribute,
     which defaults to blocking (‘None’).

     You can configure the global default timeout by setting *note
     ThreadingMock.DEFAULT_TIMEOUT: 464d.

      -- メソッド: wait_until_called (*, timeout=UNSET)

          Waits until the mock is called.

          If a timeout was passed at the creation of the mock or if a
          timeout argument is passed to this function, the function
          raises an *note AssertionError: 8b8. if the call is not
          performed in time.

               >>> mock = ThreadingMock()
               >>> thread = threading.Thread(target=mock)
               >>> thread.start()
               >>> mock.wait_until_called(timeout=1)
               >>> thread.join()

      -- メソッド: wait_until_any_call_with (*args, **kwargs)

          Waits until the mock is called with the specified arguments.

          If a timeout was passed at the creation of the mock the
          function raises an *note AssertionError: 8b8. if the call is
          not performed in time.

               >>> mock = ThreadingMock()
               >>> thread = threading.Thread(target=mock, args=("arg1", "arg2",), kwargs={"arg": "thing"})
               >>> thread.start()
               >>> mock.wait_until_any_call_with("arg1", "arg2", arg="thing")
               >>> thread.join()

      -- の属性: DEFAULT_TIMEOUT

          Global default timeout in seconds to create instances of *note
          ThreadingMock: 464c.

     Added in version 3.13.

* Menu:

* 呼び出し::
* 属性の削除::
* Mock の名前と name 属性::
* 属性として設定されるモック::

   ---------- Footnotes ----------

   (1) 例外は特殊メソッドと属性だけです (これらは2つのアンダースコアで開
始・終了します)。モックはこれらの代わりに *note AttributeError: 5f0. を
発生させます。これは、インタープリタが暗黙的にこれらのメソッドを要求する
ためであり、特殊メソッドを予測する際に '非常に' 混乱してしまいます。もし
特殊メソッドのサポートが必要な場合は、 *note magic methods: 462d. を参照
してください。


File: python.info,  Node: 呼び出し,  Next: 属性の削除,  Up: Mock クラス

5.26.6.3 呼び出し
.................

モックオブジェクトは呼び出し可能です。呼び出しの戻り値は *note
return_value: 4633. 属性に設定された値です。デフォルトでは新しいモックオ
ブジェクトを返します。この新しいモックは、属性に最初にアクセスした際に作
成されます (明示もしくはモックの呼び出しによって)。 そしてそれは保存され
、それ以降は同じものが返されます。

呼び出しはオブジェクトとして *note call_args: 1d69. や *note
call_args_list: 463e. に記録されます。

If *note side_effect: 462b. is set then it will be called after the call
has been recorded, so if ‘side_effect’ raises an exception the call is
still recorded.

呼び出された際に例外を発生させるモックを作成するためには、 *note
side_effect: 462b. を例外クラスかインスタンスにする方法が最もシンプルで
す:

     >>> m = MagicMock(side_effect=IndexError)
     >>> m(1, 2, 3)
     Traceback (most recent call last):
       ...
     IndexError
     >>> m.mock_calls
     [call(1, 2, 3)]
     >>> m.side_effect = KeyError('Bang!')
     >>> m('two', 'three', 'four')
     Traceback (most recent call last):
       ...
     KeyError: 'Bang!'
     >>> m.mock_calls
     [call(1, 2, 3), call('two', 'three', 'four')]

If *note side_effect: 462b. is a function then whatever that function
returns is what calls to the mock return.  The ‘side_effect’ function is
called with the same arguments as the mock.  This allows you to vary the
return value of the call dynamically, based on the input:

     >>> def side_effect(value):
     ...     return value + 1
     ...
     >>> m = MagicMock(side_effect=side_effect)
     >>> m(1)
     2
     >>> m(2)
     3
     >>> m.mock_calls
     [call(1), call(2)]

If you want the mock to still return the default return value (a new
mock), or any set return value, then there are two ways of doing this.
Either return *note return_value: 4633. from inside *note side_effect:
462b, or return *note DEFAULT: 4632.:

     >>> m = MagicMock()
     >>> def side_effect(*args, **kwargs):
     ...     return m.return_value
     ...
     >>> m.side_effect = side_effect
     >>> m.return_value = 3
     >>> m()
     3
     >>> def side_effect(*args, **kwargs):
     ...     return DEFAULT
     ...
     >>> m.side_effect = side_effect
     >>> m()
     3

To remove a *note side_effect: 462b, and return to the default
behaviour, set the ‘side_effect’ to ‘None’:

     >>> m = MagicMock(return_value=6)
     >>> def side_effect(*args, **kwargs):
     ...     return 3
     ...
     >>> m.side_effect = side_effect
     >>> m()
     3
     >>> m.side_effect = None
     >>> m()
     6

The *note side_effect: 462b. can also be any iterable object.  Repeated
calls to the mock will return values from the iterable (until the
iterable is exhausted and a *note StopIteration: df5. is raised):

     >>> m = MagicMock(side_effect=[1, 2, 3])
     >>> m()
     1
     >>> m()
     2
     >>> m()
     3
     >>> m()
     Traceback (most recent call last):
       ...
     StopIteration

もしイテレート可能オブジェクトの要素が例外だった場合には、戻り値として返
される代わりに例外が発生します:

     >>> iterable = (33, ValueError, 66)
     >>> m = MagicMock(side_effect=iterable)
     >>> m()
     33
     >>> m()
     Traceback (most recent call last):
      ...
     ValueError
     >>> m()
     66


File: python.info,  Node: 属性の削除,  Next: Mock の名前と name 属性,  Prev: 呼び出し,  Up: Mock クラス

5.26.6.4 属性の削除
...................

モックオブジェクトは要求に応じて属性を生成することで，任意のオブジェクト
として振る舞うことができます。

You may want a mock object to return ‘False’ to a *note hasattr(): 6f9.
call, or raise an *note AttributeError: 5f0. when an attribute is
fetched.  You can do this by providing an object as a ‘spec’ for a mock,
but that isn't always convenient.

属性を削除することで， *note AttributeError: 5f0. を発生させ，アクセスを
"妨げる" ようになります．

     >>> mock = MagicMock()
     >>> hasattr(mock, 'm')
     True
     >>> del mock.m
     >>> hasattr(mock, 'm')
     False
     >>> del mock.f
     >>> mock.f
     Traceback (most recent call last):
         ...
     AttributeError: f


File: python.info,  Node: Mock の名前と name 属性,  Next: 属性として設定されるモック,  Prev: 属性の削除,  Up: Mock クラス

5.26.6.5 Mock の名前と name 属性
................................

"name" は *note Mock: c3f. コンストラクタの引数なので、モックオブジェク
トが "name" 属性を持つことを望む場合、単に生成時にそれを渡すことはできま
せん。2つの選択肢があります。1つのオプションは *note configure_mock():
4634. を使用することです:

     >>> mock = MagicMock()
     >>> mock.configure_mock(name='my_name')
     >>> mock.name
     'my_name'

より単純なオプションはモックの生成後に単に "name" 属性をセットすることで
す:

     >>> mock = MagicMock()
     >>> mock.name = "foo"


File: python.info,  Node: 属性として設定されるモック,  Prev: Mock の名前と name 属性,  Up: Mock クラス

5.26.6.6 属性として設定されるモック
...................................

属性 (もしくは戻り値) に他のモックを設定した場合、このモックは "子" にな
ります。この子に対する呼び出しは、親の *note method_calls: 4639. や
*note mock_calls: 4637. に記録されます。これは、子のモックを構成し、親に
そのモックを設定する際に有用です。また、親に対して設定したすべての子の呼
び出しを記録するため、それらの間の順番を確認する際にも有用です:

     >>> parent = MagicMock()
     >>> child1 = MagicMock(return_value=None)
     >>> child2 = MagicMock(return_value=None)
     >>> parent.child1 = child1
     >>> parent.child2 = child2
     >>> child1(1)
     >>> child2(2)
     >>> parent.mock_calls
     [call.child1(1), call.child2(2)]

モックが名前をもつ場合は、例外的に扱われます。何らかの理由で "子守り" が
発生してほしくないときに、それを防ぐことができます。

     >>> mock = MagicMock()
     >>> not_a_child = MagicMock(name='not-a-child')
     >>> mock.attribute = not_a_child
     >>> mock.attribute()
     <MagicMock name='not-a-child()' id='...'>
     >>> mock.mock_calls
     []

*note patch(): 1092. を用いて作成したモックには、自動的に名前が与えられ
ます。名前を持つモックを設定したい場合には、親に対して *note
attach_mock(): 1955. メソッドを呼び出します:

     >>> thing1 = object()
     >>> thing2 = object()
     >>> parent = MagicMock()
     >>> with patch('__main__.thing1', return_value=None) as child1:
     ...     with patch('__main__.thing2', return_value=None) as child2:
     ...         parent.attach_mock(child1, 'child1')
     ...         parent.attach_mock(child2, 'child2')
     ...         child1('one')
     ...         child2('two')
     ...
     >>> parent.mock_calls
     [call.child1('one'), call.child2('two')]


File: python.info,  Node: patcher,  Next: MagicMock と magic method のサポート,  Prev: Mock クラス,  Up: unittest mock --- モックオブジェクトライブラリ

5.26.6.7 patcher
................

patch デコレータは、その関数のスコープ内でパッチを適用するオブジェクトに
対して使用されます。たとえ例外が発生したとしても、パッチは自動的に解除さ
れます。これらすべての機能は文やクラスのデコレータとしても使用できます。

* Menu:

* patch::
* patch.object: patch object.
* patch.dict: patch dict.
* patch.multiple: patch multiple.
* patch のメソッド; start と stop: patch のメソッド start と stop.
* ビルトインをパッチする::
* TEST_PREFIX::
* patch デコレータをネストする::
* どこにパッチするか::
* デスクリプタやプロキシオブジェクトにパッチする::


File: python.info,  Node: patch,  Next: patch object,  Up: patcher

5.26.6.8 patch
..............

     注釈: 重要なのは正しい名前空間に対して patch することです。*note
     where to patch: 4657. セクションを参照してください。

 -- の関数: unittest.mock.patch (target, new=DEFAULT, spec=None,
          create=False, spec_set=None, autospec=None, new_callable=None,
          **kwargs)

     *note patch(): 1092. は関数デコレータ、クラスデコレータ、コンテキス
     トマネージャーとして利用できます。関数や with 文の body では、
     'target' は 'new' オブジェクトにパッチされます。関数/with 文が終了
     すると、パッチは元に戻されます。

     If 'new' is omitted, then the target is replaced with an *note
     AsyncMock: c3e. if the patched object is an async function or a
     *note MagicMock: 108f. otherwise.  If *note patch(): 1092. is used
     as a decorator and 'new' is omitted, the created mock is passed in
     as an extra argument to the decorated function.  If *note patch():
     1092. is used as a context manager the created mock is returned by
     the context manager.

     'target' は ‘'package.module.ClassName'’ の形式の文字列でなければな
     りません。 ‘target’ はインポートされ、指定されたオブジェクトが
     ‘new’ オブジェクトに置き換えられます。なので、 'target' は *note
     patch(): 1092. を呼び出した環境からインポート可能でなければなりませ
     ん。 target がインポートされるのは、デコレートした時ではなく、デコ
     レートされた関数が呼び出された時です。

     patch が *note MagicMock: 108f. を生成する場合、 'spec' と
     'spec_set' キーワード引数は *note MagicMock: 108f. に渡されます。

     加えて、 ‘spec=True’ もしくは ‘spec_set=True’ を渡すことで、モック
     対象のオブジェクトが spec/spec_set に渡されます。

     'new_callable' allows you to specify a different class, or callable
     object, that will be called to create the 'new' object.  By default
     *note AsyncMock: c3e. is used for async functions and *note
     MagicMock: 108f. for the rest.

     より強力な 'spec' の形は 'autospec' です。 ‘autospec=True’ を指定し
     た場合、 mock は置換対象となるオブジェクトから得られる spec で生成
     されます。 mock のすべての属性もまた置換対象となるオブジェクトの属
     性に応じた spec を持ちます。 mock されたメソッドや関数は引数をチェ
     ックし、間違ったシグネチャで呼び出された場合は *note TypeError:
     198. を発生させます。クラスを置き換える mock の場合、その戻り値 (つ
     まりインスタンス) はそのクラスと同じ spec を持ちます。 *note
     create_autospec(): 1934. 関数と *note autospec を使う: 462e. を参照
     してください。

     置換対象ではなく任意のオブジェクトを spec として使うために、
     ‘autospec=True’ の代わりに、 ‘autospec=some_object’ と指定すること
     ができます。

     By default *note patch(): 1092. will fail to replace attributes
     that don't exist.  If you pass in ‘create=True’, and the attribute
     doesn't exist, patch will create the attribute for you when the
     patched function is called, and delete it again after the patched
     function has exited.  This is useful for writing tests against
     attributes that your production code creates at runtime.  It is off
     by default because it can be dangerous.  With it switched on you
     can write passing tests against APIs that don't actually exist!

          注釈: 
          バージョン 3.5 で変更: モジュールのビルトインにパッチを当てよ
          うとしているなら、 ‘create=True’ を渡す必要はありません。それ
          はデフォルトで追加されます。

     Patch can be used as a *note TestCase: 2b3. class decorator.  It
     works by decorating each test method in the class.  This reduces
     the boilerplate code when your test methods share a common
     patchings set.  *note patch(): 1092. finds tests by looking for
     method names that start with ‘patch.TEST_PREFIX’.  By default this
     is ‘'test'’, which matches the way *note unittest: 10c. finds
     tests.  You can specify an alternative prefix by setting
     ‘patch.TEST_PREFIX’.

     patch は with 文を使ってコンテキストマネージャーとして使うこともで
     きます。その場合パッチは with 文のブロック内でのみ適用されます。
     "as" を使って、 "as" に続いて指定した変数にパッチされたオブジェクト
     が代入されます。これは *note patch(): 1092. が mock オブジェクトを
     生成するときに便利です。

     *note patch(): 1092. takes arbitrary keyword arguments.  These will
     be passed to *note AsyncMock: c3e. if the patched object is
     asynchronous, to *note MagicMock: 108f. otherwise or to
     'new_callable' if specified.

     異なるユースケースのために、 ‘patch.dict(...)’,
     ‘patch.multiple(...)’, ‘patch.object(...)’ が用意されています。

*note patch(): 1092. を関数デコレータとして利用し、 mock を生成してそれ
をデコレートされた関数に渡します:

     >>> @patch('__main__.SomeClass')
     ... def function(normal_argument, mock_class):
     ...     print(mock_class is SomeClass)
     ...
     >>> function(None)
     True

クラスをパッチするとそのクラスを *note MagicMock: 108f. の 'インスタンス
' に置き換えます。テスト中のコードからそのクラスがインスタンス化される場
合、 mock の *note return_value: 4633. が利用されます。

クラスが複数回インスタンス化される場合、 *note side_effect: 462b. を利用
して毎回新しい mock を返すようにできます。もしくは、 'return_value' に、
何でも好きなものを設定できます。

To configure return values on methods of 'instances' on the patched
class you must do this on the *note return_value: 4633.  For example:

     >>> class Class:
     ...     def method(self):
     ...         pass
     ...
     >>> with patch('__main__.Class') as MockClass:
     ...     instance = MockClass.return_value
     ...     instance.method.return_value = 'foo'
     ...     assert Class() is instance
     ...     assert Class().method() == 'foo'
     ...

'spec' か 'spec_set' を指定し、 *note patch(): 1092. が 'クラス' を置換
するとき、生成された mock の戻り値は同じ spec を持ちます。:

     >>> Original = Class
     >>> patcher = patch('__main__.Class', spec=True)
     >>> MockClass = patcher.start()
     >>> instance = MockClass()
     >>> assert isinstance(instance, Original)
     >>> patcher.stop()

'new_callable' 引数は、デフォルトの *note MagicMock: 108f. の代わりに別
のクラスをモックとして生成したい場合に便利です。例えば、 *note
NonCallableMock: 4630. を利用したい場合:

     >>> thing = object()
     >>> with patch('__main__.thing', new_callable=NonCallableMock) as mock_thing:
     ...     assert thing is mock_thing
     ...     thing()
     ...
     Traceback (most recent call last):
       ...
     TypeError: 'NonCallableMock' object is not callable

別のユースケースとしては、オブジェクトを *note io.StringIO: 112a. インス
タンスで置き換えることがあります:

     >>> from io import StringIO
     >>> def foo():
     ...     print('Something')
     ...
     >>> @patch('sys.stdout', new_callable=StringIO)
     ... def test(mock_stdout):
     ...     foo()
     ...     assert mock_stdout.getvalue() == 'Something\n'
     ...
     >>> test()

*note patch(): 1092. に mock を生成させる場合、たいてい最初に必要なこと
はその mock をセットアップすることです。幾らかのセットアップは patch の
呼び出しから行うことができます。任意のキーワード引数が、生成された mock
の属性に設定されます:

     >>> patcher = patch('__main__.thing', first='one', second='two')
     >>> mock_thing = patcher.start()
     >>> mock_thing.first
     'one'
     >>> mock_thing.second
     'two'

生成された mock の属性のさらに属性、 *note return_value: 4633. *note
side_effect: 462b. などもセットアップできます。これらはキーワード引数の
シンタックスでは直接指定できませんが、それらをキーとする辞書を ‘**’ を使
って *note patch(): 1092. に渡すことができます:

     >>> config = {'method.return_value': 3, 'other.side_effect': KeyError}
     >>> patcher = patch('__main__.thing', **config)
     >>> mock_thing = patcher.start()
     >>> mock_thing.method()
     3
     >>> mock_thing.other()
     Traceback (most recent call last):
       ...
     KeyError

By default, attempting to patch a function in a module (or a method or
an attribute in a class) that does not exist will fail with *note
AttributeError: 5f0.:

     >>> @patch('sys.non_existing_attribute', 42)
     ... def test():
     ...     assert sys.non_existing_attribute == 42
     ...
     >>> test()
     Traceback (most recent call last):
       ...
     AttributeError: <module 'sys' (built-in)> does not have the attribute 'non_existing_attribute'

but adding ‘create=True’ in the call to *note patch(): 1092. will make
the previous example work as expected:

     >>> @patch('sys.non_existing_attribute', 42, create=True)
     ... def test(mock_stdout):
     ...     assert sys.non_existing_attribute == 42
     ...
     >>> test()

バージョン 3.8 で変更: *note patch(): 1092. now returns an *note
AsyncMock: c3e. if the target is an async function.


File: python.info,  Node: patch object,  Next: patch dict,  Prev: patch,  Up: patcher

5.26.6.9 patch.object
.....................

 -- の関数: patch.object (target, attribute, new=DEFAULT, spec=None,
          create=False, spec_set=None, autospec=None, new_callable=None,
          **kwargs)

     オブジェクト ('target') の指定された名前のメンバー ('attribute') を
     mock オブジェクトでパッチします。

     *note patch.object(): 1906. はデコレータ、クラスデコレータ、コンテ
     キストマネージャーとして利用できます。引数の 'new', 'spec',
     'create', 'spec_set', 'autospec', 'new_callable' は *note patch():
     1092. と同じ意味を持ちます。 *note patch(): 1092. と同じく、 *note
     patch.object(): 1906. も mock を生成するための任意のキーワード引数
     を受け取ります。

     クラスデコレータとして利用する場合、 *note patch.object(): 1906. は
     ‘patch.TEST_PREFIX’ にしたがってラップするメソッドを選択します。

*note patch.object(): 1906. の呼び出しには3引数の形式と2引数の形式があり
ます。 3引数の場合、 patch 対象のオブジェクト、属性名、その属性を置き換
えるオブジェクトを取ります。

2引数の形式では、置き換えるオブジェクトを省略し、生成された mock がデコ
レート対象となる関数に追加の引数として渡されます:

     >>> @patch.object(SomeClass, 'class_method')
     ... def test(mock_method):
     ...     SomeClass.class_method(3)
     ...     mock_method.assert_called_with(3)
     ...
     >>> test()

'spec', 'create' やその他の *note patch.object(): 1906. の引数は *note
patch(): 1092. の引数と同じ意味を持ちます。


File: python.info,  Node: patch dict,  Next: patch multiple,  Prev: patch object,  Up: patcher

5.26.6.10 patch.dict
....................

 -- の関数: patch.dict (in_dict, values=(), clear=False, **kwargs)

     Patch a dictionary, or dictionary like object, and restore the
     dictionary to its original state after the test, where the restored
     dictionary is a copy of the dictionary as it was before the test.

     'in_dict' は辞書やその他のマップ型のコンテナです。マップ型の場合、
     最低限 get, set, del 操作とキーに対するイテレートをサポートしている
     必要があります。

     'in_dict' に辞書を指定する文字列を渡した場合、それをインポートして
     取得します。

     'values' は対象の辞書にセットする値を含む、辞書か ‘(key, value)’ ペ
     アの iterable です。

     'clear' が true なら、新しい値が設定される前に辞書がクリアされます
     。

     *note patch.dict(): 1967. はまた、任意のキーワード引数を受け取って
     辞書に設定します。

     バージョン 3.8 で変更: *note patch.dict(): 1967. now returns the
     patched dictionary when used as a context manager.

*note patch.dict(): 1967. can be used as a context manager, decorator or
class decorator:

     >>> foo = {}
     >>> @patch.dict(foo, {'newkey': 'newvalue'})
     ... def test():
     ...     assert foo == {'newkey': 'newvalue'}
     ...
     >>> test()
     >>> assert foo == {}

When used as a class decorator *note patch.dict(): 1967. honours
‘patch.TEST_PREFIX’ (default to ‘'test'’) for choosing which methods to
wrap:

     >>> import os
     >>> import unittest
     >>> from unittest.mock import patch
     >>> @patch.dict('os.environ', {'newkey': 'newvalue'})
     ... class TestSample(unittest.TestCase):
     ...     def test_sample(self):
     ...         self.assertEqual(os.environ['newkey'], 'newvalue')

If you want to use a different prefix for your test, you can inform the
patchers of the different prefix by setting ‘patch.TEST_PREFIX’.  For
more details about how to change the value of see *note TEST_PREFIX:
465a.

*note patch.dict(): 1967. を使うと、辞書にメンバーを追加するか、または単
にテストが辞書を変更して、その後テストが終了した時にその辞書が確実に復元
されるようにすることができます。

     >>> foo = {}
     >>> with patch.dict(foo, {'newkey': 'newvalue'}) as patched_foo:
     ...     assert foo == {'newkey': 'newvalue'}
     ...     assert patched_foo == {'newkey': 'newvalue'}
     ...     # You can add, update or delete keys of foo (or patched_foo, it's the same dict)
     ...     patched_foo['spam'] = 'eggs'
     ...
     >>> assert foo == {}
     >>> assert patched_foo == {}

     >>> import os
     >>> with patch.dict('os.environ', {'newkey': 'newvalue'}):
     ...     print(os.environ['newkey'])
     ...
     newvalue
     >>> assert 'newkey' not in os.environ

*note patch.dict(): 1967. を呼び出すときにキーワード引数を使って辞書に値
をセットすることができます。

     >>> mymodule = MagicMock()
     >>> mymodule.function.return_value = 'fish'
     >>> with patch.dict('sys.modules', mymodule=mymodule):
     ...     import mymodule
     ...     mymodule.function('some', 'args')
     ...
     'fish'

*note patch.dict(): 1967. can be used with dictionary like objects that
aren't actually dictionaries.  At the very minimum they must support
item getting, setting, deleting and either iteration or membership test.
This corresponds to the magic methods *note __getitem__(): 588, *note
__setitem__(): 14e3, *note __delitem__(): 14e4. and either *note
__iter__(): 20aa. or *note __contains__(): 15d3.

     >>> class Container:
     ...     def __init__(self):
     ...         self.values = {}
     ...     def __getitem__(self, name):
     ...         return self.values[name]
     ...     def __setitem__(self, name, value):
     ...         self.values[name] = value
     ...     def __delitem__(self, name):
     ...         del self.values[name]
     ...     def __iter__(self):
     ...         return iter(self.values)
     ...
     >>> thing = Container()
     >>> thing['one'] = 1
     >>> with patch.dict(thing, one=2, two=3):
     ...     assert thing['one'] == 2
     ...     assert thing['two'] == 3
     ...
     >>> assert thing['one'] == 1
     >>> assert list(thing) == ['one']


File: python.info,  Node: patch multiple,  Next: patch のメソッド start と stop,  Prev: patch dict,  Up: patcher

5.26.6.11 patch.multiple
........................

 -- の関数: patch.multiple (target, spec=None, create=False,
          spec_set=None, autospec=None, new_callable=None, **kwargs)

     1回の呼び出しで複数のパッチを実行します。パッチ対象のオブジェクト
     (あるいはそのオブジェクトをインポートするための文字列) と、パッチ用
     のキーワード引数を取ります:

          with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):
              ...

     *note patch.multiple(): 465c. に mock を生成させたい場合、キーワー
     ド引数の値に *note DEFAULT: 4632. を指定します。この場合生成された
     モックはデコレート対象の関数にキーワード引数として渡され、コンテキ
     ストマネージャーとして *note patch.multiple(): 465c. が利用された場
     合は辞書として返します。

     *note patch.multiple(): 465c. はデコレータ、クラスデコレータ、コン
     テキストマネージャーとして使えます。引数の 'spec', 'spec_set',
     'create', 'autospec', 'new_callable' は *note patch(): 1092. の引数
     と同じ意味を持ちます。これらの引数は *note patch.multiple(): 465c.
     によって適用される 'すべての' パッチに対して適用されます。

     クラスデコレータとして利用する場合、 *note patch.multiple(): 465c.
     は ‘patch.TEST_PREFIX’ にしたがってラップするメソッドを選択します。

*note patch.multiple(): 465c. に mock を生成させたい場合、キーワード引数
の値に *note DEFAULT: 4632. を指定します。*note patch.multiple(): 465c.
をデコレータとして使った場合生成されたモックはデコレート対象の関数にキー
ワード引数として渡されます。:

     >>> thing = object()
     >>> other = object()

     >>> @patch.multiple('__main__', thing=DEFAULT, other=DEFAULT)
     ... def test_function(thing, other):
     ...     assert isinstance(thing, MagicMock)
     ...     assert isinstance(other, MagicMock)
     ...
     >>> test_function()

*note patch.multiple(): 465c. は他の ‘patch’ デコレータとネストして利用
できますが、キーワード引数は *note patch(): 1092. によって作られる通常の
引数の '後ろ' で受け取る必要があります:

     >>> @patch('sys.exit')
     ... @patch.multiple('__main__', thing=DEFAULT, other=DEFAULT)
     ... def test_function(mock_exit, other, thing):
     ...     assert 'other' in repr(other)
     ...     assert 'thing' in repr(thing)
     ...     assert 'exit' in repr(mock_exit)
     ...
     >>> test_function()

*note patch.multiple(): 465c. がコンテキストマネージャーとして利用される
場合、コンテキストマネージャーが返す値は、名前がキーで値が生成された
mock となる辞書です:

     >>> with patch.multiple('__main__', thing=DEFAULT, other=DEFAULT) as values:
     ...     assert 'other' in repr(values['other'])
     ...     assert 'thing' in repr(values['thing'])
     ...     assert values['thing'] is thing
     ...     assert values['other'] is other
     ...


File: python.info,  Node: patch のメソッド start と stop,  Next: ビルトインをパッチする,  Prev: patch multiple,  Up: patcher

5.26.6.12 patch のメソッド: start と stop
.........................................

All the patchers have ‘start()’ and ‘stop()’ methods.  These make it
simpler to do patching in ‘setUp’ methods or where you want to do
multiple patches without nesting decorators or with statements.

To use them call *note patch(): 1092, *note patch.object(): 1906. or
*note patch.dict(): 1967. as normal and keep a reference to the returned
‘patcher’ object.  You can then call ‘start()’ to put the patch in place
and ‘stop()’ to undo it.

*note patch(): 1092. に mock を生成させる場合、 ‘patcher.start’ の呼び出
しの戻り値として mock を受け取れます。:

     >>> patcher = patch('package.module.ClassName')
     >>> from package import module
     >>> original = module.ClassName
     >>> new_mock = patcher.start()
     >>> assert module.ClassName is not original
     >>> assert module.ClassName is new_mock
     >>> patcher.stop()
     >>> assert module.ClassName is original
     >>> assert module.ClassName is not new_mock

A typical use case for this might be for doing multiple patches in the
‘setUp’ method of a *note TestCase: 2b3.:

     >>> class MyTest(unittest.TestCase):
     ...     def setUp(self):
     ...         self.patcher1 = patch('package.module.Class1')
     ...         self.patcher2 = patch('package.module.Class2')
     ...         self.MockClass1 = self.patcher1.start()
     ...         self.MockClass2 = self.patcher2.start()
     ...
     ...     def tearDown(self):
     ...         self.patcher1.stop()
     ...         self.patcher2.stop()
     ...
     ...     def test_something(self):
     ...         assert package.module.Class1 is self.MockClass1
     ...         assert package.module.Class2 is self.MockClass2
     ...
     >>> MyTest('test_something').run()

     注意: この方式を使う場合、必ず ‘stop’ メソッドを呼び出してパッチが
     解除する必要があります。 ‘setUp’ の中で例外が発生した場合
     ‘tearDown’ が呼び出されないので、これは意外に面倒です。 *note
     unittest.TestCase.addCleanup(): c74. を使うと簡単にできます:

          >>> class MyTest(unittest.TestCase):
          ...     def setUp(self):
          ...         patcher = patch('package.module.Class')
          ...         self.MockClass = patcher.start()
          ...         self.addCleanup(patcher.stop)
          ...
          ...     def test_something(self):
          ...         assert package.module.Class is self.MockClass
          ...

     この方式を使うと ‘patcher’ オブジェクトの参照を維持する必要がなくな
     るという特典も付きます。

*note patch.stopall(): 465f. を利用してすべての start されたパッチを
stop することもできます。

 -- の関数: patch.stopall ()

     すべての有効なパッチを stop します。 ‘start’ で開始したパッチしか
     stop しません。


File: python.info,  Node: ビルトインをパッチする,  Next: TEST_PREFIX,  Prev: patch のメソッド start と stop,  Up: patcher

5.26.6.13 ビルトインをパッチする
................................

モジュール内の任意のビルトインに対してパッチを当てることができます。以下
の例はビルトインの *note ord(): 233b. を修正します:

     >>> @patch('__main__.ord')
     ... def test(mock_ord):
     ...     mock_ord.return_value = 101
     ...     print(ord('c'))
     ...
     >>> test()
     101


File: python.info,  Node: TEST_PREFIX,  Next: patch デコレータをネストする,  Prev: ビルトインをパッチする,  Up: patcher

5.26.6.14 TEST_PREFIX
.....................

すべての patcher はクラスデコレータとして利用できます。この場合、そのク
ラスのすべてのテストメソッドをラップします。 patcher は ‘'test'’ で始ま
る名前のメソッドをテストメソッドだと認識します。これはデフォルトで *note
unittest.TestLoader: 593. がテストメソッドを見つける方法と同じです。

他の prefix を使う事もできます。その場合、 patcher にその prefix を
‘patch.TEST_PREFIX’ に設定することで教えることができます:

     >>> patch.TEST_PREFIX = 'foo'
     >>> value = 3
     >>>
     >>> @patch('__main__.value', 'not three')
     ... class Thing:
     ...     def foo_one(self):
     ...         print(value)
     ...     def foo_two(self):
     ...         print(value)
     ...
     >>>
     >>> Thing().foo_one()
     not three
     >>> Thing().foo_two()
     not three
     >>> value
     3


File: python.info,  Node: patch デコレータをネストする,  Next: どこにパッチするか,  Prev: TEST_PREFIX,  Up: patcher

5.26.6.15 patch デコレータをネストする
......................................

複数のパッチを行いたい場合、シンプルにデコレータを重ねることができます。

次のパターンのように patch デコレータを重ねることができます:

     >>> @patch.object(SomeClass, 'class_method')
     ... @patch.object(SomeClass, 'static_method')
     ... def test(mock1, mock2):
     ...     assert SomeClass.static_method is mock1
     ...     assert SomeClass.class_method is mock2
     ...     SomeClass.static_method('foo')
     ...     SomeClass.class_method('bar')
     ...     return mock1, mock2
     ...
     >>> mock1, mock2 = test()
     >>> mock1.assert_called_once_with('foo')
     >>> mock2.assert_called_once_with('bar')

デコレータは下から上へと適用されることに注意してください。これは Python
がデコレータを適用する標準的な方法です。テスト関数に渡される生成された
mock の順番もこれに一致します。


File: python.info,  Node: どこにパッチするか,  Next: デスクリプタやプロキシオブジェクトにパッチする,  Prev: patch デコレータをネストする,  Up: patcher

5.26.6.16 どこにパッチするか
............................

*note patch(): 1092. は (一時的に) ある '名前' が参照しているオブジェク
トを別のものに変更することで適用されます。任意のオブジェクトには、それを
参照するたくさんの名前が存在しえます。なので、必ずテスト対象のシステムが
使っている名前に対して patch しなければなりません。

基本的な原則は、オブジェクトが 'ルックアップ' されるところにパッチするこ
とです。その場所はオブジェクトが定義されたところとは限りません。これを説
明するためにいくつかの例を挙げます。

次のような構造を持ったプロジェクトをテストしようとしていると仮定してくだ
さい:

     a.py
         -> Defines SomeClass

     b.py
         -> from a import SomeClass
         -> some_function instantiates SomeClass

Now we want to test ‘some_function’ but we want to mock out ‘SomeClass’
using *note patch(): 1092.  The problem is that when we import module b,
which we will have to do when it imports ‘SomeClass’ from module a.  If
we use *note patch(): 1092. to mock out ‘a.SomeClass’ then it will have
no effect on our test; module b already has a reference to the 'real'
‘SomeClass’ and it looks like our patching had no effect.

重要なのは、 ‘SomeClass’ が使われている (もしくはルックアップされている)
場所にパッチすることです。この場合、 ‘some_function’ はモジュール b の中
にインポートされた ‘SomeClass’ をルックアップしています。なのでパッチは
次のようにしなければなりません:

     @patch('b.SomeClass')

ですが、別のシナリオとして、module b が ‘from a import SomeClass’ ではな
く ‘import a’ をしていて、 ‘some_function’ が ‘a.SomeClass’ を利用してい
たとします。どちらのインポートも一般的なものです。この場合、パッチしたい
クラスはそのモジュールからルックアップされているので、 ‘a.SomeClass’ を
パッチする必要があります:

     @patch('a.SomeClass')


File: python.info,  Node: デスクリプタやプロキシオブジェクトにパッチする,  Prev: どこにパッチするか,  Up: patcher

5.26.6.17 デスクリプタやプロキシオブジェクトにパッチする
........................................................

*note patch: 4656. と *note patch.object: 4658. はどちらも デスクリプタ
(クラスメソッド、static メソッド、プロパティ) を正しく patch できます。
デスクリプタに patch する場合、インスタンスではなく 'class' にパッチする
必要があります。これらはまた '幾らかの' 属性アクセスをプロキシするオブジ
ェクト、例えば django の setttings オブジェクト(1) に対しても機能します
。

   ---------- Footnotes ----------

   (1) 
https://web.archive.org/web/20200603181648/http://www.voidspace.org.uk/python/weblog/arch_d7_2010_12_04.shtml#e1198


File: python.info,  Node: MagicMock と magic method のサポート,  Next: ヘルパー,  Prev: patcher,  Up: unittest mock --- モックオブジェクトライブラリ

5.26.6.18 MagicMock と magic method のサポート
..............................................

* Menu:

* Magic Method をモックする::
* Magic Mock::


File: python.info,  Node: Magic Method をモックする,  Next: Magic Mock,  Up: MagicMock と magic method のサポート

5.26.6.19 Magic Method をモックする
...................................

*note Mock: c3f. supports mocking the Python protocol methods, also
known as *note "magic methods": 4667.  This allows mock objects to
replace containers or other objects that implement Python protocols.

magic method は通常のメソッドとはルックアップ方法が異なるので (1), magic
method のサポートは特別に実装されています。そのため、サポートされている
のは特定の magic method のみです。'ほとんど' すべてのメソッドをサポート
していますが、足りないものを見つけたら私達に教えてください。

magic method を mock するには、対象の method に対して関数や mock のイン
スタンスをセットします。もし関数を使う場合、それは第一引数に ‘self’ を取
る '必要があります' (2).

     >>> def __str__(self):
     ...     return 'fooble'
     ...
     >>> mock = Mock()
     >>> mock.__str__ = __str__
     >>> str(mock)
     'fooble'

     >>> mock = Mock()
     >>> mock.__str__ = Mock()
     >>> mock.__str__.return_value = 'fooble'
     >>> str(mock)
     'fooble'

     >>> mock = Mock()
     >>> mock.__iter__ = Mock(return_value=iter([]))
     >>> list(mock)
     []

ユースケースの1つは *note with: 186. 文の中でコンテキストマネージャーと
して使われるオブジェクトを mock することです。

     >>> mock = Mock()
     >>> mock.__enter__ = Mock(return_value='foo')
     >>> mock.__exit__ = Mock(return_value=False)
     >>> with mock as m:
     ...     assert m == 'foo'
     ...
     >>> mock.__enter__.assert_called_with()
     >>> mock.__exit__.assert_called_with(None, None, None)

magic method の呼び出しは *note method_calls: 4639. に含まれませんが、
*note mock_calls: 4637. には記録されます。

     注釈: mock を生成するのに 'spec' キーワード引数を使った場合、 spec
     に含まれない magic method を設定しようとすると *note
     AttributeError: 5f0. が発生します。

サポートしている magic method の完全なリスト:

   * ‘__hash__’, ‘__sizeof__’, ‘__repr__’, ‘__str__’

   * ‘__dir__’, ‘__format__’, ‘__subclasses__’

   * ‘__round__’, ‘__floor__’, ‘__trunc__’ と ‘__ceil__’

   * 比較: ‘__lt__’, ‘__gt__’, ‘__le__’, ‘__ge__’, ‘__eq__’, ‘__ne__’

   * コンテナメソッド: ‘__getitem__’, ‘__setitem__’, ‘__delitem__’,
     ‘__contains__’, ‘__len__’, ‘__iter__’, ‘__reversed__’,
     ‘__missing__’

   * Context manager: ‘__enter__’, ‘__exit__’, ‘__aenter__’ and
     ‘__aexit__’

   * 単項算術メソッド: ‘__neg__’, ‘__pos__’, ‘__invert__’

   * The numeric methods (including right hand and in-place variants):
     ‘__add__’, ‘__sub__’, ‘__mul__’, ‘__matmul__’, ‘__truediv__’,
     ‘__floordiv__’, ‘__mod__’, ‘__divmod__’, ‘__lshift__’,
     ‘__rshift__’, ‘__and__’, ‘__xor__’, ‘__or__’, and ‘__pow__’

   * 算術変換メソッド: ‘__complex__’, ‘__int__’, ‘__float__’,
     ‘__index__’

   * デスクリプタメソッド: ‘__get__’, ‘__set__’, ‘__delete__’

   * pickle: ‘__reduce__’, ‘__reduce_ex__’, ‘__getinitargs__’,
     ‘__getnewargs__’, ‘__getstate__’, ‘__setstate__’

   * File system path representation: ‘__fspath__’

   * Asynchronous iteration methods: ‘__aiter__’ and ‘__anext__’

バージョン 3.8 で変更: Added support for *note os.PathLike.__fspath__():
e4c.

バージョン 3.8 で変更: Added support for ‘__aenter__’, ‘__aexit__’,
‘__aiter__’ and ‘__anext__’.

以下のメソッドは存在しますが、mock が利用している、動的に設定不可能、そ
の他の問題が発生する可能性があるなどの理由で 'サポートされていません':

   * ‘__getattr__’, ‘__setattr__’, ‘__init__’, ‘__new__’

   * ‘__prepare__’, ‘__instancecheck__’, ‘__subclasscheck__’, ‘__del__’

   ---------- Footnotes ----------

   (1) Magic method はインスタンスではなくクラスからルックアップされるは
ずです。Python のバージョンによってこのルールが適用されるかどうかに違い
があります。サポートされているプロトコルメソッドは、サポートされているす
べての Python のバージョンで動作するはずです。

   (2) 関数はクラスまで hook しますが、各 ‘Mock’ インスタンス間の独立性
は保たれます。


File: python.info,  Node: Magic Mock,  Prev: Magic Method をモックする,  Up: MagicMock と magic method のサポート

5.26.6.20 Magic Mock
....................

‘MagicMock’ 系のクラスは2種類あります: *note MagicMock: 108f. と *note
NonCallableMagicMock: 4631. です。

 -- クラス: unittest.mock.MagicMock (*args, **kw)

     ‘MagicMock’ is a subclass of *note Mock: c3f. with default
     implementations of most of the *note magic methods: 4667.  You can
     use ‘MagicMock’ without having to configure the magic methods
     yourself.

     コンストラクタの引数は *note Mock: c3f. と同じ意味を持っています。

     'spec' か 'spec_set' 引数を利用した場合、 spec に存在する magic
     method 'のみ' が生成されます。

 -- クラス: unittest.mock.NonCallableMagicMock (*args, **kw)

     callable でないバージョンの *note MagicMock: 108f.

     コンストラクタの引数は *note MagicMock: 108f. と同じ意味を持ちます
     が、 'return_value' と 'side_effect' は callable でない mock では意
     味を持ちません。

*note MagicMock: 108f. が magic method をセットアップするので、あとは通
常の方法で構成したり利用したりできます:

     >>> mock = MagicMock()
     >>> mock[3] = 'fish'
     >>> mock.__setitem__.assert_called_with(3, 'fish')
     >>> mock.__getitem__.return_value = 'result'
     >>> mock[2]
     'result'

デフォルトでは、多くのプロトコルメソッドは特定の型の戻り値を要求されます
。それらのメソッドではその型のデフォルトの戻り値がデフォルトの戻り値とし
て設定されているので、戻り値に興味が有る場合以外は何もしなくても利用可能
です。デフォルトの値を変更したい場合は手動で戻り値を設定可能です。

メソッドとそのデフォルト値:

   * ‘__lt__’: *note NotImplemented: 1a2.

   * ‘__gt__’: ‘NotImplemented’

   * ‘__le__’: ‘NotImplemented’

   * ‘__ge__’: ‘NotImplemented’

   * ‘__int__’: ‘1’

   * ‘__contains__’: ‘False’

   * ‘__len__’: ‘0’

   * ‘__iter__’: ‘iter([])’

   * ‘__exit__’: ‘False’

   * ‘__aexit__’: ‘False’

   * ‘__complex__’: ‘1j’

   * ‘__float__’: ‘1.0’

   * ‘__bool__’: ‘True’

   * ‘__index__’: ‘1’

   * ‘__hash__’: mock のデフォルトの hash

   * ‘__str__’: mock のデフォルトの str

   * ‘__sizeof__’: mock のデフォルトの sizeof

例えば:

     >>> mock = MagicMock()
     >>> int(mock)
     1
     >>> len(mock)
     0
     >>> list(mock)
     []
     >>> object() in mock
     False

The two equality methods, ‘__eq__()’ and ‘__ne__()’, are special.  They
do the default equality comparison on identity, using the *note
side_effect: 462b. attribute, unless you change their return value to
return something else:

     >>> MagicMock() == 3
     False
     >>> MagicMock() != 3
     True
     >>> mock = MagicMock()
     >>> mock.__eq__.return_value = True
     >>> mock == 3
     True

‘MagicMock.__iter__()’ の return_value は任意の iterable で、イテレータ
である必要はありません:

     >>> mock = MagicMock()
     >>> mock.__iter__.return_value = ['a', 'b', 'c']
     >>> list(mock)
     ['a', 'b', 'c']
     >>> list(mock)
     ['a', 'b', 'c']

return_value が iterator であった場合、最初のイテレートでその iterator を
消費してしまい、2回目以降のイテレートの結果が空になってしまいます:

     >>> mock.__iter__.return_value = iter(['a', 'b', 'c'])
     >>> list(mock)
     ['a', 'b', 'c']
     >>> list(mock)
     []

‘MagicMock’ はいくつかの曖昧であったり時代遅れなものをのぞいて、対応して
いる magic method を事前にセットアップします。自動でセットアップされてい
ないものも必要なら手動でセットアップすることができます。

‘MagicMock’ がサポートしているもののデフォルトではセットアップしない
magic method:

   * ‘__subclasses__’

   * ‘__dir__’

   * ‘__format__’

   * ‘__get__’, ‘__set__’, ‘__delete__’

   * ‘__reversed__’, ‘__missing__’

   * ‘__reduce__’, ‘__reduce_ex__’, ‘__getinitargs__’, ‘__getnewargs__’,
     ‘__getstate__’, ‘__setstate__’

   * ‘__getformat__’


File: python.info,  Node: ヘルパー,  Next: Order of precedence of side_effect return_value and wraps,  Prev: MagicMock と magic method のサポート,  Up: unittest mock --- モックオブジェクトライブラリ

5.26.6.21 ヘルパー
..................

* Menu:

* sentinel::
* DEFAULT::
* call::
* create_autospec::
* ANY::
* FILTER_DIR::
* mock_open::
* autospec を使う::
* Sealing mocks::


File: python.info,  Node: sentinel,  Next: DEFAULT,  Up: ヘルパー

5.26.6.22 sentinel
..................

 -- データ: unittest.mock.sentinel

     ‘sentinel’ オブジェクトはテストで必要なユニークなオブジェクトを簡単
     に提供します。

     属性はアクセス時にオンデマンドで生成されます。同じ属性に複数回アク
     セスすると必ず同じオブジェクトが返されます。返されるオブジェクトは
     、テスト失敗のメッセージがわかりやすくなるように気が利いた repr を
     持ちます。

     バージョン 3.7 で変更: The ‘sentinel’ attributes now preserve their
     identity when they are *note copied: 29. or *note pickled: ab.

特定のオブジェクトが他のメソッドに引数として渡されることをテストしたり、
返されることをテストしたい場合があります。このテストのために名前がついた
sentinel オブジェクトを作るのが一般的です。 *note sentinel: d99. はこの
ようなオブジェクトを生成し、同一性をテストするのに便利な方法を提供します
。

次の例では、 ‘method’ が ‘sentinel.some_object’ を返すようにモンキーパッ
チしています:

     >>> real = ProductionClass()
     >>> real.method = Mock(name="method")
     >>> real.method.return_value = sentinel.some_object
     >>> result = real.method()
     >>> assert result is sentinel.some_object
     >>> result
     sentinel.some_object


File: python.info,  Node: DEFAULT,  Next: call,  Prev: sentinel,  Up: ヘルパー

5.26.6.23 DEFAULT
.................

 -- データ: unittest.mock.DEFAULT

     *note DEFAULT: 4632. オブジェクトは事前に生成された sentinel (実際
     には ‘sentinel.DEFAULT’) オブジェクトです。 *note side_effect:
     462b. 関数が、通常の戻り値を使うことを示すために使います。


File: python.info,  Node: call,  Next: create_autospec,  Prev: DEFAULT,  Up: ヘルパー

5.26.6.24 call
..............

 -- の関数: unittest.mock.call (*args, **kwargs)

     *note call(): 1db3. は *note call_args: 1d69, *note call_args_list:
     463e, *note mock_calls: 4637, *note method_calls: 4639. と比較して
     より簡単に assert できるようにするためのヘルパーオブジェクトです。
     *note call(): 1db3. は *note assert_has_calls(): 1a22. と組み合わせ
     て使うこともできます。

          >>> m = MagicMock(return_value=None)
          >>> m(1, 2, a='foo', b='bar')
          >>> m()
          >>> m.call_args_list == [call(1, 2, a='foo', b='bar'), call()]
          True

 -- メソッド: call.call_list ()

     複数回の呼び出しを表す call オブジェクトに対して、 *note
     call_list(): 466d. はすべての途中の呼び出しと最終の呼び出しを含むリ
     ストを返します。

‘call_list’ は特に "chained call" に対して assert するのに便利です。
"chained call" は1行のコードにおける複数の呼び出しです。この結果は mock
の *note mock_calls: 4637. に複数の call エントリとして格納されます。こ
の call のシーケンスを手動で構築するのは退屈な作業になります。

*note call_list(): 466d. は同じ chained call からその call のシーケンス
を構築することができます:

     >>> m = MagicMock()
     >>> m(1).method(arg='foo').other('bar')(2.0)
     <MagicMock name='mock().method().other()()' id='...'>
     >>> kall = call(1).method(arg='foo').other('bar')(2.0)
     >>> kall.call_list()
     [call(1),
      call().method(arg='foo'),
      call().method().other('bar'),
      call().method().other()(2.0)]
     >>> m.mock_calls == kall.call_list()
     True
‘call’ オブジェクトは、どう構築されたかによって、 (位置引数、キーワード
引数) のタプルか、 (名前、位置引数、キーワード引数) のタプルになります。
自分で call オブジェクトを構築するときはこれを意識する必要はありませんが
、 *note Mock.call_args: 1d69, *note Mock.call_args_list: 463e, *note
Mock.mock_calls: 4637. 属性の中の ‘call’ オブジェクトを解析して個々の引
数を解析することができます。

*note Mock.call_args: 1d69. と *note Mock.call_args_list: 463e. の中の
‘call’ オブジェクトは (位置引数, キーワード引数) のタプルで、 *note
Mock.mock_calls: 4637. の中の ‘call’ オブジェクトや自分で構築したオブジ
ェクトは (名前, 位置引数, キーワード引数) のタプルになります。

call オブジェクトの "タプル性" を使って、より複雑な内省とアサートを行う
ために各引数を取り出しすことができます。位置引数はタプル (位置引数が存在
しない場合は空のタプル) で、キーワード引数は辞書になります:

     >>> m = MagicMock(return_value=None)
     >>> m(1, 2, 3, arg='one', arg2='two')
     >>> kall = m.call_args
     >>> kall.args
     (1, 2, 3)
     >>> kall.kwargs
     {'arg': 'one', 'arg2': 'two'}
     >>> kall.args is kall[0]
     True
     >>> kall.kwargs is kall[1]
     True

     >>> m = MagicMock()
     >>> m.foo(4, 5, 6, arg='two', arg2='three')
     <MagicMock name='mock.foo()' id='...'>
     >>> kall = m.mock_calls[0]
     >>> name, args, kwargs = kall
     >>> name
     'foo'
     >>> args
     (4, 5, 6)
     >>> kwargs
     {'arg': 'two', 'arg2': 'three'}
     >>> name is m.mock_calls[0][0]
     True


File: python.info,  Node: create_autospec,  Next: ANY,  Prev: call,  Up: ヘルパー

5.26.6.25 create_autospec
.........................

 -- の関数: unittest.mock.create_autospec (spec, spec_set=False,
          instance=False, **kwargs)

     他のオブジェクトを spec として利用して mock オブジェクトを作ります
     。 mock の属性も、 'spec' オブジェクトの該当する属性を spec として
     利用します。

     mock された関数やメソッドは、正しいシグネチャで呼び出されたことを確
     認するために引数をチェックします。

     'spec_set' が ‘True’ のとき、 spec オブジェクトにない属性をセットし
     ようとすると *note AttributeError: 5f0. を発生させます。

     spec にクラスが指定された場合、 mock の戻り値 (そのクラスのインスタ
     ンス) は同じ spec を持ちます。 ‘instance=True’ を指定すると、インス
     タンスオブジェクトの spec としてクラスを利用できます。返される mock
     は、モックのインスタンスが callable な場合にだけ callable となりま
     す。

     *note create_autospec(): 1934. は任意のキーワード引数を受け取り、生
     成する mock のコンストラクタに渡します。

*note create_autospec(): 1934. や、 *note patch(): 1092. の 'autospec' 引
数で autospec を使うサンプルは *note autospec を使う: 462e. を参照してく
ださい。

バージョン 3.8 で変更: *note create_autospec(): 1934. now returns an
*note AsyncMock: c3e. if the target is an async function.


File: python.info,  Node: ANY,  Next: FILTER_DIR,  Prev: create_autospec,  Up: ヘルパー

5.26.6.26 ANY
.............

 -- データ: unittest.mock.ANY

mock の呼び出しのうち '幾つか' の引数に対して assert したいけれども、そ
れ以外の引数は気にしない、あるいは *note call_args: 1d69. から個別に取り
出してより高度な assert を行いたい場合があります。

特定の引数を無視するために、 'すべて' と等しくなるオブジェクトを使うこと
ができます。そうすると、 *note assert_called_with(): 1e03. と *note
assert_called_once_with(): 4635. は、実際の引数が何であったかに関わらず
成功します。

     >>> mock = Mock(return_value=None)
     >>> mock('foo', bar=object())
     >>> mock.assert_called_once_with('foo', bar=ANY)

*note mock_calls: 4637. などの call list との比較に *note ANY: 1db1. を
使うこともできます:

     >>> m = MagicMock(return_value=None)
     >>> m(1)
     >>> m(1, 2)
     >>> m(object())
     >>> m.mock_calls == [call(1), call(1, 2), ANY]
     True

*note ANY: 1db1. is not limited to comparisons with call objects and so
can also be used in test assertions:

     class TestStringMethods(unittest.TestCase):

         def test_split(self):
             s = 'hello world'
             self.assertEqual(s.split(), ['hello', ANY])


File: python.info,  Node: FILTER_DIR,  Next: mock_open,  Prev: ANY,  Up: ヘルパー

5.26.6.27 FILTER_DIR
....................

 -- データ: unittest.mock.FILTER_DIR

*note FILTER_DIR: 463b. は mock オブジェクトが *note dir(): 844. に何を
返すかを制御するためのモジュールレベル変数です。デフォルトは ‘True’ で、
以下に示すフィルタリングを行い、有用なメンバーだけを表示します。このフィ
ルタリングが嫌な場合や、何かの診断のためにフィルタリングを切りたい場合は
、 ‘mock.FILTER_DIR = False’ と設定してください。

フィルタリングが有効な場合、 ‘dir(some_mock)’ は有用な属性だけを表示し、
また通常は表示されない動的に生成される属性も表示します。 mock が 'spec'
を使って(もちろん 'autospec' でも)生成された場合、元のオブジェクトのすべ
ての属性が、まだアクセスされていなかったとしても、表示されます。

     >>> dir(Mock())
     ['assert_any_call',
      'assert_called',
      'assert_called_once',
      'assert_called_once_with',
      'assert_called_with',
      'assert_has_calls',
      'assert_not_called',
      'attach_mock',
      ...
     >>> from urllib import request
     >>> dir(Mock(spec=request))
     ['AbstractBasicAuthHandler',
      'AbstractDigestAuthHandler',
      'AbstractHTTPHandler',
      'BaseHandler',
      ...

多くのあまり有用ではない (mock 対象のものではなく、 *note Mock: c3f. 自
身のプライベートな) 属性は、アンダースコアと2つのアンダースコアで prefix
された属性は *note Mock: c3f. に対して *note dir(): 844. した結果からフ
ィルタリングされます。この動作が嫌な場合は、モジュールレベルの *note
FILTER_DIR: 463b. スイッチを設定することでフィルターを切ることができます
。

     >>> from unittest import mock
     >>> mock.FILTER_DIR = False
     >>> dir(mock.Mock())
     ['_NonCallableMock__get_return_value',
      '_NonCallableMock__get_side_effect',
      '_NonCallableMock__return_value_doc',
      '_NonCallableMock__set_return_value',
      '_NonCallableMock__set_side_effect',
      '__call__',
      '__class__',
      ...

Alternatively you can just use ‘vars(my_mock)’ (instance members) and
‘dir(type(my_mock))’ (type members) to bypass the filtering irrespective
of *note FILTER_DIR: 463b.


File: python.info,  Node: mock_open,  Next: autospec を使う,  Prev: FILTER_DIR,  Up: ヘルパー

5.26.6.28 mock_open
...................

 -- の関数: unittest.mock.mock_open (mock=None, read_data=None)

     *note open(): 316. の利用を置き換えるための mock を作るヘルパー関数
     。 *note open(): 316. を直接呼んだりコンテキストマネージャーとして
     利用する場合に使うことができます。

     'mock' 引数は構成する mock オブジェクトです。 ‘None’ (デフォルト) な
     ら、通常のファイルハンドルと同じ属性やメソッドにAPIが制限された
     *note MagicMock: 108f. が生成されます。

     'read_data' is a string for the *note read(): 101d, *note
     readline(): 1541, and *note readlines(): 27a1. methods of the file
     handle to return.  Calls to those methods will take data from
     'read_data' until it is depleted.  The mock of these methods is
     pretty simplistic: every time the 'mock' is called, the 'read_data'
     is rewound to the start.  If you need more control over the data
     that you are feeding to the tested code you will need to customize
     this mock for yourself.  When that is insufficient, one of the
     in-memory filesystem packages on PyPI(1) can offer a realistic
     filesystem for testing.

     バージョン 3.4 で変更: Added *note readline(): 1541. and *note
     readlines(): 27a1. support.  The mock of *note read(): 101d.
     changed to consume 'read_data' rather than returning it on each
     call.

     バージョン 3.5 で変更: 'read_data' は 'mock' を呼び出す度に毎回リセ
     ットされるようになりました。

     バージョン 3.8 で変更: Added *note __iter__(): 20aa. to
     implementation so that iteration (such as in for loops) correctly
     consumes 'read_data'.

*note open(): 316. をコンテキストマネージャーとして使う方法は、ファイル
が必ず適切に閉じられるようにする素晴らしい方法で、今では一般的になってい
ます:

     with open('/some/path', 'w') as f:
         f.write('something')

The issue is that even if you mock out the call to *note open(): 316. it
is the 'returned object' that is used as a context manager (and has
*note __enter__(): 7e4. and *note __exit__(): 1518. called).

コンテキストマネージャーを *note MagicMock: 108f. でモックするのは一般的
かつ面倒なので、ヘルパー関数を用意しています。:

     >>> m = mock_open()
     >>> with patch('__main__.open', m):
     ...     with open('foo', 'w') as h:
     ...         h.write('some stuff')
     ...
     >>> m.mock_calls
     [call('foo', 'w'),
      call().__enter__(),
      call().write('some stuff'),
      call().__exit__(None, None, None)]
     >>> m.assert_called_once_with('foo', 'w')
     >>> handle = m()
     >>> handle.write.assert_called_once_with('some stuff')

ファイルの読み込みをモックする例:

     >>> with patch('__main__.open', mock_open(read_data='bibble')) as m:
     ...     with open('foo') as h:
     ...         result = h.read()
     ...
     >>> m.assert_called_once_with('foo')
     >>> assert result == 'bibble'

   ---------- Footnotes ----------

   (1) https://pypi.org


File: python.info,  Node: autospec を使う,  Next: Sealing mocks,  Prev: mock_open,  Up: ヘルパー

5.26.6.29 autospec を使う
.........................

Autospeccing is based on the existing ‘spec’ feature of mock.  It limits
the api of mocks to the api of an original object (the spec), but it is
recursive (implemented lazily) so that attributes of mocks only have the
same api as the attributes of the spec.  In addition mocked functions /
methods have the same call signature as the original so they raise a
*note TypeError: 198. if they are called incorrectly.

autospec の動作について説明する前に、それが必要となる背景から説明してい
きます。

*note Mock: c3f. is a very powerful and flexible object, but it suffers
from a flaw which is general to mocking.  If you refactor some of your
code, rename members and so on, any tests for code that is still using
the 'old api' but uses mocks instead of the real objects will still
pass.  This means your tests can all pass even though your code is
broken.

バージョン 3.5 で変更: Before 3.5, tests with a typo in the word assert
would silently pass when they should raise an error.  You can still
achieve this behavior by passing ‘unsafe=True’ to Mock.

各ユニットが互いにどのように接続されるかをテストしない場合、依然としてテ
ストで見つけることができるバグの余地が多く残っています。

‘unittest.mock’ already provides a feature to help with this, called
speccing.  If you use a class or instance as the ‘spec’ for a mock then
you can only access attributes on the mock that exist on the real class:

     >>> from urllib import request
     >>> mock = Mock(spec=request.Request)
     >>> mock.assret_called_with  # Intentional typo!
     Traceback (most recent call last):
      ...
     AttributeError: Mock object has no attribute 'assret_called_with'

spec はその mock 自体にしか適用されません。なので、同じ問題がその mock の
すべてのメソッドに対して発生します:

     >>> mock.header_items()
     <mock.Mock object at 0x...>
     >>> mock.header_items.assret_called_with()  # Intentional typo!

autospec はこの問題を解決します。 *note patch(): 1092. か *note
patch.object(): 1906. に ‘autospec=True’ を渡すか、 *note
create_autospec(): 1934. 関数を使って spec をもとに mock を作ることがで
きます。 *note patch(): 1092. の引数に ‘autospec=True’ を渡した場合、置
換対象のオブジェクトが spec オブジェクトとして利用されます。 spec は遅延
処理される (mock の属性にアクセスされた時に spec が生成される) ので、非
常に複雑だったり深くネストしたオブジェクト (例えばモジュールをインポート
するモジュールをインポートするモジュール) に対しても大きなパフォーマンス
の問題なしに autospec を使うことができます。

autospec の利用例:

     >>> from urllib import request
     >>> patcher = patch('__main__.request', autospec=True)
     >>> mock_request = patcher.start()
     >>> request is mock_request
     True
     >>> mock_request.Request
     <MagicMock name='request.Request' spec='Request' id='...'>

You can see that ‘request.Request’ has a spec.  ‘request.Request’ takes
two arguments in the constructor (one of which is 'self').  Here's what
happens if we try to call it incorrectly:

     >>> req = request.Request()
     Traceback (most recent call last):
      ...
     TypeError: <lambda>() takes at least 2 arguments (1 given)

spec はクラスがインスタンス化されたとき (つまり spec が適用された mock の
戻り値) にも適用されます:

     >>> req = request.Request('foo')
     >>> req
     <NonCallableMagicMock name='request.Request()' spec='Request' id='...'>

‘Request’ objects are not callable, so the return value of instantiating
our mocked out ‘request.Request’ is a non-callable mock.  With the spec
in place any typos in our asserts will raise the correct error:

     >>> req.add_header('spam', 'eggs')
     <MagicMock name='request.Request().add_header()' id='...'>
     >>> req.add_header.assret_called_with  # Intentional typo!
     Traceback (most recent call last):
      ...
     AttributeError: Mock object has no attribute 'assret_called_with'
     >>> req.add_header.assert_called_with('spam', 'eggs')

多くの場合、単に既存の *note patch(): 1092. 呼び出しに ‘autospec=True’ を
加えるだけで、ミススペルやAPI変更に伴うバグから守られます。

*note patch(): 1092. を経由する以外にも、 *note create_autospec(): 1934.
を使って 'autospec' が適用された mock を直接作る方法もあります:

     >>> from urllib import request
     >>> mock_request = create_autospec(request)
     >>> mock_request.Request('foo', 'bar')
     <NonCallableMagicMock name='mock.Request()' spec='Request' id='...'>

とはいえ、autospec には注意しなければならない点や制限があり、そのためデ
フォルトでは無効になっています。spec オブジェクトでどんな属性が使えるか
どうかを調べるために、autospec は spec オブジェクトをイントロスペクト (実
際に属性にアクセスする) 必要があります。mock の属性を利用するとき、水面
下で元のオブジェクトに対しても同じ属性の探索が行われます。spec したオブ
ジェクトのどれかがコードを実行するプロパティやデスクリプタを持っている場
合、autospec は正しく動きません。もしくは、イントロスペクションしても安
全なようにオブジェクトを設計するのがよいでしょう (1)。

A more serious problem is that it is common for instance attributes to
be created in the *note __init__(): 8bf. method and not to exist on the
class at all.  'autospec' can't know about any dynamically created
attributes and restricts the api to visible attributes.

     >>> class Something:
     ...   def __init__(self):
     ...     self.a = 33
     ...
     >>> with patch('__main__.Something', autospec=True):
     ...   thing = Something()
     ...   thing.a
     ...
     Traceback (most recent call last):
       ...
     AttributeError: Mock object has no attribute 'a'

この問題を解決するためにいくつかの方法があります。一番簡単な、ただし一番
面倒でないとは限らない方法は、必要とされる属性を mock が生成された後に設
定することです。 'autospec' は属性を参照することを禁止しますが、設定する
ことは禁止していません:

     >>> with patch('__main__.Something', autospec=True):
     ...   thing = Something()
     ...   thing.a = 33
     ...

'spec' と 'autospec' にはよりアグレッシブなバージョンがあり、存在しない
属性への設定も禁止します。これはコードが正しい属性にのみ代入することを保
証したいときに便利ですが、もちろん先ほどの方法も制限されてしまいます:

     >>> with patch('__main__.Something', autospec=True, spec_set=True):
     ...   thing = Something()
     ...   thing.a = 33
     ...
     Traceback (most recent call last):
      ...
     AttributeError: Mock object has no attribute 'a'

Probably the best way of solving the problem is to add class attributes
as default values for instance members initialised in *note __init__():
8bf.  Note that if you are only setting default attributes in
‘__init__()’ then providing them via class attributes (shared between
instances of course) is faster too.  e.g.

     class Something:
         a = 33

クラス属性を使ってもまた別の問題があります。メンバーのデフォルト値に
‘None’ を利用し、後から別の型のオブジェクトを代入するのは比較的よくある
パターンです。 spec として ‘None’ を使うと 'すべての' 属性やメソッドへの
アクセスも許されなくなるので使い物になりません。 ‘None’ を spec にするこ
とが有用な場面は '決して' なく、おそらくそのメンバーは他の何かの型のメン
バーになることを示すので、 autospec は ‘None’ に設定されているメンバーに
は spec を使いません。その属性は通常の mock (MagicMocks) になります。

     >>> class Something:
     ...     member = None
     ...
     >>> mock = create_autospec(Something)
     >>> mock.member.foo.bar.baz()
     <MagicMock name='mock.member.foo.bar.baz()' id='...'>

すでに利用されているクラスにデフォルト値属性を追加するのが嫌な場合は、他
の選択肢もあります。選択肢の1つは、クラスではなくインスタンスを spec に
使うことです。別の選択肢は、実際のクラスのサブクラスを作り、実際に利用さ
れている方に影響を与えずにデフォルト値属性を追加することです。どちらの方
法も spec として代替オブジェクトを利用することが必要です。 *note
patch(): 1092. はこれをサポートしていて、 'autospec' 引数に代替オブジェ
クトを渡すことができます:

     >>> class Something:
     ...   def __init__(self):
     ...     self.a = 33
     ...
     >>> class SomethingForTest(Something):
     ...   a = 33
     ...
     >>> p = patch('__main__.Something', autospec=SomethingForTest)
     >>> mock = p.start()
     >>> mock.a
     <NonCallableMagicMock name='Something.a' spec='int' id='...'>

   ---------- Footnotes ----------

   (1) これはクラスやすでにインスタンス化されたオブジェクトにだけ当ては
まります。 mock されたクラスを呼び出して mock インスタンスを作っても、実
際のオブジェクトのインスタンスは生成されません。 mock は属性を - *note
dir(): 844. を呼び出して - 検索するだけです。


File: python.info,  Node: Sealing mocks,  Prev: autospec を使う,  Up: ヘルパー

5.26.6.30 Sealing mocks
.......................

 -- の関数: unittest.mock.seal (mock)

     Seal will disable the automatic creation of mocks when accessing an
     attribute of the mock being sealed or any of its attributes that
     are already mocks recursively.

     If a mock instance with a name or a spec is assigned to an
     attribute it won't be considered in the sealing chain.  This allows
     one to prevent seal from fixing part of the mock object.

          >>> mock = Mock()
          >>> mock.submock.attribute1 = 2
          >>> mock.not_submock = mock.Mock(name="sample_name")
          >>> seal(mock)
          >>> mock.new_attribute  # This will raise AttributeError.
          >>> mock.submock.attribute2  # This will raise AttributeError.
          >>> mock.not_submock.attribute2  # This won't raise.

     Added in version 3.7.


File: python.info,  Node: Order of precedence of side_effect return_value and wraps,  Prev: ヘルパー,  Up: unittest mock --- モックオブジェクトライブラリ

5.26.6.31 Order of precedence of ‘side_effect’, ‘return_value’ and 'wraps'
..........................................................................

The order of their precedence is:

  1. *note side_effect: 462b.

  2. *note return_value: 4633.

  3. 'wraps'

If all three are set, mock will return the value from *note side_effect:
462b, ignoring *note return_value: 4633. and the wrapped object
altogether.  If any two are set, the one with the higher precedence will
return the value.  Regardless of the order of which was set first, the
order of precedence remains unchanged.

     >>> from unittest.mock import Mock
     >>> class Order:
     ...     @staticmethod
     ...     def get_value():
     ...         return "third"
     ...
     >>> order_mock = Mock(spec=Order, wraps=Order)
     >>> order_mock.get_value.side_effect = ["first"]
     >>> order_mock.get_value.return_value = "second"
     >>> order_mock.get_value()
     'first'

As ‘None’ is the default value of *note side_effect: 462b, if you
reassign its value back to ‘None’, the order of precedence will be
checked between *note return_value: 4633. and the wrapped object,
ignoring *note side_effect: 462b.

     >>> order_mock.get_value.side_effect = None
     >>> order_mock.get_value()
     'second'

If the value being returned by *note side_effect: 462b. is *note
DEFAULT: 4632, it is ignored and the order of precedence moves to the
successor to obtain the value to return.

     >>> from unittest.mock import DEFAULT
     >>> order_mock.get_value.side_effect = [DEFAULT]
     >>> order_mock.get_value()
     'second'

When *note Mock: c3f. wraps an object, the default value of *note
return_value: 4633. will be *note DEFAULT: 4632.

     >>> order_mock = Mock(spec=Order, wraps=Order)
     >>> order_mock.return_value
     sentinel.DEFAULT
     >>> order_mock.get_value.return_value
     sentinel.DEFAULT

The order of precedence will ignore this value and it will move to the
last successor which is the wrapped object.

As the real call is being made to the wrapped object, creating an
instance of this mock will return the real instance of the class.  The
positional arguments, if any, required by the wrapped object must be
passed.

     >>> order_mock_instance = order_mock()
     >>> isinstance(order_mock_instance, Order)
     True
     >>> order_mock_instance.get_value()
     'third'

     >>> order_mock.get_value.return_value = DEFAULT
     >>> order_mock.get_value()
     'third'

     >>> order_mock.get_value.return_value = "second"
     >>> order_mock.get_value()
     'second'

But if you assign ‘None’ to it, this will not be ignored as it is an
explicit assignment.  So, the order of precedence will not move to the
wrapped object.

     >>> order_mock.get_value.return_value = None
     >>> order_mock.get_value() is None
     True

Even if you set all three at once when initializing the mock, the order
of precedence remains the same:

     >>> order_mock = Mock(spec=Order, wraps=Order,
     ...                   **{"get_value.side_effect": ["first"],
     ...                      "get_value.return_value": "second"}
     ...                   )
     ...
     >>> order_mock.get_value()
     'first'
     >>> order_mock.get_value.side_effect = None
     >>> order_mock.get_value()
     'second'
     >>> order_mock.get_value.return_value = DEFAULT
     >>> order_mock.get_value()
     'third'

If *note side_effect: 462b. is exhausted, the order of precedence will
not cause a value to be obtained from the successors.  Instead,
‘StopIteration’ exception is raised.

     >>> order_mock = Mock(spec=Order, wraps=Order)
     >>> order_mock.get_value.side_effect = ["first side effect value",
     ...                                     "another side effect value"]
     >>> order_mock.get_value.return_value = "second"

     >>> order_mock.get_value()
     'first side effect value'
     >>> order_mock.get_value()
     'another side effect value'

     >>> order_mock.get_value()
     Traceback (most recent call last):
      ...
     StopIteration


File: python.info,  Node: unittest mock --- 入門,  Next: test --- Regression tests package for Python,  Prev: unittest mock --- モックオブジェクトライブラリ,  Up: 開発ツール

5.26.7 ‘unittest.mock’ -- 入門
------------------------------

Added in version 3.3.

* Menu:

* Mock を使う::
* patch デコレータ::
* さらなる例::


File: python.info,  Node: Mock を使う,  Next: patch デコレータ,  Up: unittest mock --- 入門

5.26.7.1 Mock を使う
....................

* Menu:

* Mock のパッチ用メソッド::
* オブジェクトのメソッド呼び出しに対するモック::
* クラスをモックする::
* モックに名前をつける::
* 全ての呼び出しのトラッキング::
* 戻り値や属性を設定する::
* モックから例外を発生させる::
* side_effect の関数と iterable::
* 非同期イテレータをモックする::
* 非同期コンテキストマネージャをモックする::
* 既存のオブジェクトから Mock を作る::
* Using side_effect to return per file content::


File: python.info,  Node: Mock のパッチ用メソッド,  Next: オブジェクトのメソッド呼び出しに対するモック,  Up: Mock を使う

5.26.7.2 Mock のパッチ用メソッド
................................

一般的な *note Mock: c3f. の使い方の中には次のものがあります:

   * メソッドにパッチを当てる

   * オブジェクトに対するメソッド呼び出しを記録する

システムの他の部分からメソッドが正しい引数で呼び出されたかどうかを確認す
るために、そのオブジェクトのメソッドを置き換えることができます:

     >>> real = SomeClass()
     >>> real.method = MagicMock(name='method')
     >>> real.method(3, 4, 5, key='value')
     <MagicMock name='method()' id='...'>

モック(上の例では ‘real.method’)が利用された場合、どう使われたかを
assert できるようにする属性やメソッドがモックにあります。

     注釈: この例のような場合、たいてい *note Mock: c3f. と *note
     MagicMock: 108f. は互換です。 ‘MagicMock’ の方が強力なので、デフォ
     ルトではこちらを使うといいでしょう。

モックが呼び出されると、その *note called: 463d. 属性が ‘True’ に設定さ
れます。そして *note assert_called_with(): 1e03. や *note
assert_called_once_with(): 4635. メソッドを使ってそのメソッドが正しい引
数で呼び出されたかどうかをチェックできます。

次の例では ‘ProductionClass().method’ が ‘something’ メソッドを呼び出し
たことをテストしています:

     >>> class ProductionClass:
     ...     def method(self):
     ...         self.something(1, 2, 3)
     ...     def something(self, a, b, c):
     ...         pass
     ...
     >>> real = ProductionClass()
     >>> real.something = MagicMock()
     >>> real.method()
     >>> real.something.assert_called_once_with(1, 2, 3)


File: python.info,  Node: オブジェクトのメソッド呼び出しに対するモック,  Next: クラスをモックする,  Prev: Mock のパッチ用メソッド,  Up: Mock を使う

5.26.7.3 オブジェクトのメソッド呼び出しに対するモック
.....................................................

上の例ではオブジェクトのメソッドに対して直接パッチを当てて、それが正しく
呼び出されていたかどうかをテストしていました。もう一つのよくあるユースケ
ースが、モックをメソッド (またはテスト対象のシステムのどこか) に渡して、
それが正しく利用されたかどうかをチェックする方法です。

次の例で、‘ProductionClass’ は ‘closer’ メソッドを持っています。このメソ
ッドは渡されたオブジェクトの ‘close’ メソッドを呼び出します。

     >>> class ProductionClass:
     ...     def closer(self, something):
     ...         something.close()
     ...

ですからこれをテストするには、‘close’ メソッドを持ったオブジェクトを渡し
て、それが正しく呼び出されたかどうかをテストしなければなりません。

     >>> real = ProductionClass()
     >>> mock = Mock()
     >>> real.closer(mock)
     >>> mock.close.assert_called_with()

モックに ‘close’ メソッドを持たせるために何か準備する必要はありません。
‘close’ メソッドにアクセスすると自動的にそれが作られます。なので、もし
‘close’ が呼び出されなかったとしてもテスト時に生成されるのですが、 *note
assert_called_with(): 1e03. が failure 例外を発生させます。


File: python.info,  Node: クラスをモックする,  Next: モックに名前をつける,  Prev: オブジェクトのメソッド呼び出しに対するモック,  Up: Mock を使う

5.26.7.4 クラスをモックする
...........................

他のよくあるユースケースが、テスト対象のコードによってインスタンス化され
ているクラスをモックに置き換えることです。クラスに patch すると、そのク
ラスがモックに置き換えられます。インスタンスは 'クラスを呼び出した時に'
作られます。なので、モックの戻り値を使うことで、「モックのインスタンス」
にアクセスできます。

次の例では、 ‘some_function’ という関数が ‘Foo’ をインスタンス化し、その
method を呼び出しています。 *note patch(): 1092. を呼び出すと ‘Foo’ クラ
スをモックに置き換えます。 ‘Foo’ のインスタンスはモックを呼び出して作ら
れるので、モックの *note return_value: 4633. を変更することでカスタマイ
ズできます。:

     >>> def some_function():
     ...     instance = module.Foo()
     ...     return instance.method()
     ...
     >>> with patch('module.Foo') as mock:
     ...     instance = mock.return_value
     ...     instance.method.return_value = 'the result'
     ...     result = some_function()
     ...     assert result == 'the result'


File: python.info,  Node: モックに名前をつける,  Next: 全ての呼び出しのトラッキング,  Prev: クラスをモックする,  Up: Mock を使う

5.26.7.5 モックに名前をつける
.............................

モックに名前をつけると便利なことがあります。その名前はモックを repr した
ときに表示されるので、モックがテスト失敗のメッセージ内に現れた時に便利で
す。また、モックの名前はそのモックの属性やメソッドにも伝播します:

     >>> mock = MagicMock(name='foo')
     >>> mock
     <MagicMock name='foo' id='...'>
     >>> mock.method
     <MagicMock name='foo.method' id='...'>


File: python.info,  Node: 全ての呼び出しのトラッキング,  Next: 戻り値や属性を設定する,  Prev: モックに名前をつける,  Up: Mock を使う

5.26.7.6 全ての呼び出しのトラッキング
.....................................

メソッドの複数回の呼び出しをトラックしたいことがあります。 *note
mock_calls: 4637. 属性は、そのモックの子属性やさらにその子孫に対する呼び
出しすべてを記録しています。

     >>> mock = MagicMock()
     >>> mock.method()
     <MagicMock name='mock.method()' id='...'>
     >>> mock.attribute.method(10, x=53)
     <MagicMock name='mock.attribute.method()' id='...'>
     >>> mock.mock_calls
     [call.method(), call.attribute.method(10, x=53)]

‘mock_calls’ に対して assert すると、予期していないメソッド呼び出しがあ
ったときにその assert が失敗します。これはあるメソッド呼び出しが期待通り
に実行されたかどうかだけでなく、その呼び出し順序や期待した以外の呼び出し
が起こらなかったことまでテストできるので便利です:

‘mock_calls’ と比較するリストを作るために *note call: 1db3. オブジェクト
を利用できます:

     >>> expected = [call.method(), call.attribute.method(10, x=53)]
     >>> mock.mock_calls == expected
     True

However, parameters to calls that return mocks are not recorded, which
means it is not possible to track nested calls where the parameters used
to create ancestors are important:

     >>> m = Mock()
     >>> m.factory(important=True).deliver()
     <Mock name='mock.factory().deliver()' id='...'>
     >>> m.mock_calls[-1] == call.factory(important=False).deliver()
     True


File: python.info,  Node: 戻り値や属性を設定する,  Next: モックから例外を発生させる,  Prev: 全ての呼び出しのトラッキング,  Up: Mock を使う

5.26.7.7 戻り値や属性を設定する
...............................

モックオブジェクトに戻り値を設定するのはとっても簡単です:

     >>> mock = Mock()
     >>> mock.return_value = 3
     >>> mock()
     3

もちろん同じことがモックのメソッドに対しても行えます:

     >>> mock = Mock()
     >>> mock.method.return_value = 3
     >>> mock.method()
     3

コンストラクターで戻り値を設定することもできます:

     >>> mock = Mock(return_value=3)
     >>> mock()
     3

モックに属性を設定したかったら、普通に設定するだけです:

     >>> mock = Mock()
     >>> mock.x = 3
     >>> mock.x
     3

‘mock.connection.cursor().execute("SELECT 1")’ のような複雑なケースでモ
ックを使いたい場合もあります。この呼出があるリストを返すようにしたい場合
、このネストした呼び出しを構成しなければなりません。

*note call: 1db3. を使って "chained call" 内の呼び出しを構成して、
assert で使うことができます:

     >>> mock = Mock()
     >>> cursor = mock.connection.cursor.return_value
     >>> cursor.execute.return_value = ['foo']
     >>> mock.connection.cursor().execute("SELECT 1")
     ['foo']
     >>> expected = call.connection.cursor().execute("SELECT 1").call_list()
     >>> mock.mock_calls
     [call.connection.cursor(), call.connection.cursor().execute('SELECT 1')]
     >>> mock.mock_calls == expected
     True

call object を chained call を表す list にするために ‘.call_list()’ を使
います。


File: python.info,  Node: モックから例外を発生させる,  Next: side_effect の関数と iterable,  Prev: 戻り値や属性を設定する,  Up: Mock を使う

5.26.7.8 モックから例外を発生させる
...................................

*note side_effect: 462b. という便利な属性があります。この属性に例外クラ
スやそのインスタンスを設定すると、モックが呼ばれた時にその例外を発生させ
ます。

     >>> mock = Mock(side_effect=Exception('Boom!'))
     >>> mock()
     Traceback (most recent call last):
       ...
     Exception: Boom!


File: python.info,  Node: side_effect の関数と iterable,  Next: 非同期イテレータをモックする,  Prev: モックから例外を発生させる,  Up: Mock を使う

5.26.7.9 side_effect の関数と iterable
......................................

‘side_effect’ には関数や iterable を設定することもできます。
‘side_effect’ に iterable を設定するユースケースは、そのモックが複数回呼
び出され、そのたびに違う値を返したい場合です。‘side_effect’ に iterable
を設定すると、そのモックに対するすべての呼び出しは iterable の次の値を返
します:

     >>> mock = MagicMock(side_effect=[4, 5, 6])
     >>> mock()
     4
     >>> mock()
     5
     >>> mock()
     6

より高度なユースケースとして、mock が呼び出された時の引数によって戻り値
を変化させたい場合は、‘side_effect’ に関数を設定することができます。その
関数は mock と同じ引数で呼び出されます。その関数の戻り値がそのモック呼び
出しの戻り値になります:

     >>> vals = {(1, 2): 1, (2, 3): 2}
     >>> def side_effect(*args):
     ...     return vals[args]
     ...
     >>> mock = MagicMock(side_effect=side_effect)
     >>> mock(1, 2)
     1
     >>> mock(2, 3)
     2


File: python.info,  Node: 非同期イテレータをモックする,  Next: 非同期コンテキストマネージャをモックする,  Prev: side_effect の関数と iterable,  Up: Mock を使う

5.26.7.10 非同期イテレータをモックする
......................................

Python 3.8以降、‘AsyncMock’ と ‘MagicMock’ は ‘__aiter__’ を通じて *note
非同期イテレータ (Asynchronous Iterator): f77. のモックをサポートしてい
ます。‘__aiter__’ の *note return_value: 4633. 属性はイテレーションに使
用される戻り値を設定するために使用できます。

     >>> mock = MagicMock()  # AsyncMock also works here
     >>> mock.__aiter__.return_value = [1, 2, 3]
     >>> async def main():
     ...     return [i async for i in mock]
     ...
     >>> asyncio.run(main())
     [1, 2, 3]


File: python.info,  Node: 非同期コンテキストマネージャをモックする,  Next: 既存のオブジェクトから Mock を作る,  Prev: 非同期イテレータをモックする,  Up: Mock を使う

5.26.7.11 非同期コンテキストマネージャをモックする
..................................................

Python 3.8以降、‘AsyncMock’ と ‘MagicMock’ は ‘__aenter__’ と
‘__aexit__’ を通じて *note 非同期コンテキストマネージャ (Asynchronous
Context Manager): 812. のモックをサポートしています。デフォルトでは、
‘__aenter__’ と ‘__aexit__’ は非同期関数を返す ‘AsyncMock’ インスタンス
です。

     >>> class AsyncContextManager:
     ...     async def __aenter__(self):
     ...         return self
     ...     async def __aexit__(self, exc_type, exc, tb):
     ...         pass
     ...
     >>> mock_instance = MagicMock(AsyncContextManager())  # AsyncMock also works here
     >>> async def main():
     ...     async with mock_instance as result:
     ...         pass
     ...
     >>> asyncio.run(main())
     >>> mock_instance.__aenter__.assert_awaited_once()
     >>> mock_instance.__aexit__.assert_awaited_once()


File: python.info,  Node: 既存のオブジェクトから Mock を作る,  Next: Using side_effect to return per file content,  Prev: 非同期コンテキストマネージャをモックする,  Up: Mock を使う

5.26.7.12 既存のオブジェクトから Mock を作る
............................................

mock を使いすぎることの問題の一つは、テストが実際のコードではなく mock の
実装をテストするようになってしまうことです。‘some_method’ というメソッド
を実装したクラスがあるとします。他のクラスをテストするときに、
‘some_method’ を提供する mock を使います。最初のクラスをリファクタリング
して ‘some_method’ がなくなった時、コードは壊れているのにテストは通る状
態になってしまいます

*note Mock: c3f. は 'spec' というキーワード引数で mock の定義となるオブ
ジェクトを指定できます。定義オブジェクトに存在しないメソッドや属性にアク
セスすると AttributeError を発生させます。定義となるクラスの実装を変更し
た場合、テストの中でそのクラスをインスタンス化させなくても、テストを失敗
させる事ができます。

     >>> mock = Mock(spec=SomeClass)
     >>> mock.old_method()
     Traceback (most recent call last):
        ...
     AttributeError: Mock object has no attribute 'old_method'. Did you mean: 'class_method'?

また、定義を指定することで、パラメータが位置引数と名前付き引数のどちらで
渡されたかに関わらず、モックへの呼び出しをよりスマートに照合することがで
きます。

     >>> def f(a, b, c): pass
     ...
     >>> mock = Mock(spec=f)
     >>> mock(1, 2, 3)
     <Mock name='mock()' id='140161580456576'>
     >>> mock.assert_called_with(a=1, b=2, c=3)

このよりスマートなマッチングをモックのメソッド呼び出しにも適用したい場合
は、*note auto-speccing: 462e. を使用します。

任意の属性の参照だけでなく代入も禁止するより強い定義を利用したい場合は、
'spec' の代わりに 'spec_set' を使います。


File: python.info,  Node: Using side_effect to return per file content,  Prev: 既存のオブジェクトから Mock を作る,  Up: Mock を使う

5.26.7.13 Using side_effect to return per file content
......................................................

*note mock_open(): 11e9. is used to patch *note open(): 316. method.
*note side_effect: 462b. can be used to return a new Mock object per
call.  This can be used to return different contents per file stored in
a dictionary:

     DEFAULT = "default"
     data_dict = {"file1": "data1",
                  "file2": "data2"}

     def open_side_effect(name):
         return mock_open(read_data=data_dict.get(name, DEFAULT))()

     with patch("builtins.open", side_effect=open_side_effect):
         with open("file1") as file1:
             assert file1.read() == "data1"

         with open("file2") as file2:
             assert file2.read() == "data2"

         with open("file3") as file2:
             assert file2.read() == "default"


File: python.info,  Node: patch デコレータ,  Next: さらなる例,  Prev: Mock を使う,  Up: unittest mock --- 入門

5.26.7.14 patch デコレータ
..........................

     注釈: *note patch(): 1092. では探索される名前空間内のオブジェクトに
     パッチをあてることが重要です。通常は単純ですが、クイックガイドには
     *note どこにパッチするか: 462c. を読んでください。

テストの中でクラス属性やモジュール属性、例えば組み込み関数や、テスト対象
モジュールにあるインスタンス化されるクラスに対してパッチしたいことがあり
ます。モジュールやクラスは実際はグローバルなので、パッチするときは必ずテ
スト後にパッチを解除しないと、そのパッチが永続化されて他のテストに影響を
与え、解析しにくい問題になります。

mock はこのために3つの便利なデコレータを提供しています: *note patch():
1092, *note patch.object(): 1906, *note patch.dict(): 1967. です。
‘patch’ はパッチ対象を指定する ‘package.module.Class.attribute’ の形式の
文字列を引数に取ります。オプションでその属性 (やクラスなど) を置き換える
オブジェクトを渡すことができます。 'patch.object' はオブジェクトとパッチ
したい属性名、それにオプションで置き換えるオブジェクトを受け取ります。

‘patch.object’:

     >>> original = SomeClass.attribute
     >>> @patch.object(SomeClass, 'attribute', sentinel.attribute)
     ... def test():
     ...     assert SomeClass.attribute == sentinel.attribute
     ...
     >>> test()
     >>> assert SomeClass.attribute == original

     >>> @patch('package.module.attribute', sentinel.attribute)
     ... def test():
     ...     from package.module import attribute
     ...     assert attribute is sentinel.attribute
     ...
     >>> test()

モジュール (*note builtins: 13. を含む) をパッチしようとする場合、 *note
patch.object(): 1906. の代わりに *note patch(): 1092. を使用してください
:

     >>> mock = MagicMock(return_value=sentinel.file_handle)
     >>> with patch('builtins.open', mock):
     ...     handle = open('filename', 'r')
     ...
     >>> mock.assert_called_with('filename', 'r')
     >>> assert handle == sentinel.file_handle, "incorrect file handle returned"

モジュール名は必要に応じて ‘package.module’ のようにドットを含むことがで
きます:

     >>> @patch('package.module.ClassName.attribute', sentinel.attribute)
     ... def test():
     ...     from package.module import ClassName
     ...     assert ClassName.attribute == sentinel.attribute
     ...
     >>> test()

テストメソッド自体をデコレートするのは良いパターンです:

     >>> class MyTest(unittest.TestCase):
     ...     @patch.object(SomeClass, 'attribute', sentinel.attribute)
     ...     def test_something(self):
     ...         self.assertEqual(SomeClass.attribute, sentinel.attribute)
     ...
     >>> original = SomeClass.attribute
     >>> MyTest('test_something').test_something()
     >>> assert SomeClass.attribute == original

Mock を使ってパッチしたい場合は、 *note patch(): 1092. を1引数で (または
*note patch.object(): 1906. を2引数で) 使うことができます。mock が自動で
生成され、テスト関数/メソッドに渡されます:

     >>> class MyTest(unittest.TestCase):
     ...     @patch.object(SomeClass, 'static_method')
     ...     def test_something(self, mock_method):
     ...         SomeClass.static_method()
     ...         mock_method.assert_called_with()
     ...
     >>> MyTest('test_something').test_something()

次のパターンのように patch デコレータを重ねることができます:

     >>> class MyTest(unittest.TestCase):
     ...     @patch('package.module.ClassName1')
     ...     @patch('package.module.ClassName2')
     ...     def test_something(self, MockClass2, MockClass1):
     ...         self.assertIs(package.module.ClassName1, MockClass1)
     ...         self.assertIs(package.module.ClassName2, MockClass2)
     ...
     >>> MyTest('test_something').test_something()

patch デコレータをネストした際、モックは (デコレータを適用する 'Python'
の通常の) 順に適用されます。つまり引数は下から上の順になり、よって上記の
例では ‘test_module.ClassName2’ が先になります。

また、 *note patch.dict(): 1967. を使うと、スコープ内だけで辞書に値を設
定し、テスト終了時には元の状態に復元されます:

     >>> foo = {'key': 'value'}
     >>> original = foo.copy()
     >>> with patch.dict(foo, {'newkey': 'newvalue'}, clear=True):
     ...     assert foo == {'newkey': 'newvalue'}
     ...
     >>> assert foo == original

‘patch’, ‘patch.object’, ‘patch.dict’ は全てコンテキストマネージャーとし
ても利用できます。

*note patch(): 1092. に mock を生成させる場合、その参照を with 文の as を
使って受け取れます:

     >>> class ProductionClass:
     ...     def method(self):
     ...         pass
     ...
     >>> with patch.object(ProductionClass, 'method') as mock_method:
     ...     mock_method.return_value = None
     ...     real = ProductionClass()
     ...     real.method(1, 2, 3)
     ...
     >>> mock_method.assert_called_with(1, 2, 3)

他の方法として、‘patch’, ‘patch.object’, ‘patch.dict’ はクラスデコレータ
としても利用できます。その場合、"test" で始まる全てのメソッドにデコレー
タを適用するのと同じになります。


File: python.info,  Node: さらなる例,  Prev: patch デコレータ,  Up: unittest mock --- 入門

5.26.7.15 さらなる例
....................

より高度なシナリオを想定した例をあげていきます。

* Menu:

* chained call をモックする::
* 部分的なモック::
* ジェネレータメソッドをモックする::
* 同じパッチを全てのメソッドに適用する::
* Unboundメソッドをモックする::
* モックで複数回の呼び出しをチェックする::
* ミュータブルな引数に対処する::
* patch をネストする::
* MagicMock で辞書をモックする::
* Mock のサブクラスと属性::
* patch.dict で import をモックする: patch dict で import をモックする.
* Tracking order of calls and less verbose call assertions::
* More complex argument matching::


File: python.info,  Node: chained call をモックする,  Next: 部分的なモック,  Up: さらなる例

5.26.7.16 chained call をモックする
...................................

chained call を mock するのは、一度 *note return_value: 4633. 属性を理解
してしまえば簡単です。mock が最初に呼ばれた時や、呼び出される前に
‘return_value’ を参照した場合、新しい *note Mock: c3f. が生成されます。

つまり、戻り値のオブジェクトがどう利用されたかは、‘return_value’ mock を
調べれば分かります:

     >>> mock = Mock()
     >>> mock().foo(a=2, b=3)
     <Mock name='mock().foo()' id='...'>
     >>> mock.return_value.foo.assert_called_with(a=2, b=3)

これをもとに、mock を構成して chained call に対する assert を行うのは簡
単です。もちろん、元のコードを最初からもっとテストしやすく書くという選択
肢もありますが...

では、例として次のようなコードがあるとします:

     >>> class Something:
     ...     def __init__(self):
     ...         self.backend = BackendProvider()
     ...     def method(self):
     ...         response = self.backend.get_endpoint('foobar').create_call('spam', 'eggs').start_call()
     ...         # more code

‘BackendProvider’ はすでに十分テストされているとします。‘method()’ をど
うテストしましょうか？特に、response オブジェクトを使う ‘# more code’ の
部分のコードをテストしたいとします。

この chained call はインスタンス属性を起点にしているので、 ‘Something’ イ
ンスタンスの ‘backend’ 属性に対してモンキーパッチすることができます。今
回の場合だと、最後の ‘start_call’ の呼び出しが返す値にだけ興味があるので
、あまり多くの構成は必要ありません。このメソッドが返すのが 'file-like' オ
ブジェクトだとしましょう。そうすると、 response オブジェクトは組み込みの
*note open(): 316. を ‘spec’ として利用できます。

これをするために、backend のモックとしてモックインスタンスを作成し、それ
に対するモックの response オブジェクトを作成します。最終的な
‘start_call’ の返り値として response をセットすると、このようにすること
ができます:

     mock_backend.get_endpoint.return_value.create_call.return_value.start_call.return_value = mock_response

これより少し良いやり方として、返り値を直接セットする *note
configure_mock(): 4634. メソッドを使用して次のようにすることができます:

     >>> something = Something()
     >>> mock_response = Mock(spec=open)
     >>> mock_backend = Mock()
     >>> config = {'get_endpoint.return_value.create_call.return_value.start_call.return_value': mock_response}
     >>> mock_backend.configure_mock(**config)

これらによって「モックの backend」をその場で monkey patch して、実際の呼
び出しを行うことができます:

     >>> something.backend = mock_backend
     >>> something.method()

*note mock_calls: 4637. を使用すると、チェーンされた呼び出しを単一のアサ
ーションでチェックすることができます。チェーンされた呼び出しは、1行のコ
ードの中で行われる複数の呼び出しです。したがって、 ‘mock_calls’ には複数
のエントリーがあるでしょう。 *note call.call_list(): 466d. を使用するこ
とで、この呼び出しのリストを作成することができます:

     >>> chained = call.get_endpoint('foobar').create_call('spam', 'eggs').start_call()
     >>> call_list = chained.call_list()
     >>> assert mock_backend.mock_calls == call_list


File: python.info,  Node: 部分的なモック,  Next: ジェネレータメソッドをモックする,  Prev: chained call をモックする,  Up: さらなる例

5.26.7.17 部分的なモック
........................

For some tests, you may want to mock out a call to *note
datetime.date.today(): 16e3. to return a known date, but don't want to
prevent the code under test from creating new date objects.
Unfortunately *note datetime.date: 1fa. is written in C, so you cannot
just monkey-patch out the static *note datetime.date.today(): 16e3.
method.

Instead, you can effectively wrap the date class with a mock, while
passing through calls to the constructor to the real class (and
returning real instances).

ここで、テスト対象のモジュール中の ‘date’ クラスをモックするために *note
patch decorator: 1092. が使用されています。そして、モックの date クラス
の *note side_effect: 462b. 属性は、本物の date を返すラムダ関数にセット
されます。モックの date クラスが呼ばれる時、 ‘side_effect’ によって本物
の date が構築されて返されます。:

     >>> from datetime import date
     >>> with patch('mymodule.date') as mock_date:
     ...     mock_date.today.return_value = date(2010, 10, 8)
     ...     mock_date.side_effect = lambda *args, **kw: date(*args, **kw)
     ...
     ...     assert mymodule.date.today() == date(2010, 10, 8)
     ...     assert mymodule.date(2009, 6, 8) == date(2009, 6, 8)

グローバルに *note datetime.date: 1fa. にパッチするのではなく、それを使
用するモジュールの中の ‘date’ にパッチしていることに留意してください。
*note どこにパッチするか: 462c. を参照してください。

When ‘date.today()’ is called a known date is returned, but calls to the
‘date(...)’ constructor still return normal dates.  Without this you can
find yourself having to calculate an expected result using exactly the
same algorithm as the code under test, which is a classic testing
anti-pattern.

dateコンストラクタの呼び出しは、‘mock_date’ の属性(‘call_count’ とその仲
間)に記録され、テストに役立つこともあります。

日付や他の組み込みクラスのモックに対処する別の方法は このブログエントリ
(1).で議論されています。

   ---------- Footnotes ----------

   (1) 
https://williambert.online/2011/07/how-to-unit-testing-in-django-with-mocking-and-patching/


File: python.info,  Node: ジェネレータメソッドをモックする,  Next: 同じパッチを全てのメソッドに適用する,  Prev: 部分的なモック,  Up: さらなる例

5.26.7.18 ジェネレータメソッドをモックする
..........................................

Pythonのジェネレータは、反復処理された時に一連の値を返す *note yield:
bc2. 文を使用した関数やメソッドです (1)。

ジェネレータメソッド/関数はジェネレータオブジェクトを返すために呼び出さ
れます。そしてこのジェネレータオブジェクトが反復処理されます。イテレーシ
ョンのためのプロトコルメソッドは *note __iter__(): 20aa. なので、*note
MagicMock: 108f. を使ってこれをモックすることができます。

ここでは"iter"メソッドをジェネレータとして実装したクラスの例を紹介します
:

     >>> class Foo:
     ...     def iter(self):
     ...         for i in [1, 2, 3]:
     ...             yield i
     ...
     >>> foo = Foo()
     >>> list(foo.iter())
     [1, 2, 3]

このクラス、特に "iter"メソッドをどのようにモックするのでしょうか。

(*note list: 24d. の呼び出しの中での暗黙的な)イテレーションから返される
値を設定するには、‘foo.iter()’ の呼び出しで返されるオブジェクトを設定す
る必要がある。

     >>> mock_foo = MagicMock()
     >>> mock_foo.iter.return_value = iter([1, 2, 3])
     >>> list(mock_foo.iter())
     [1, 2, 3]

   ---------- Footnotes ----------

   (1) ジェネレータ式やジェネレータのより'高度な使い方
<‘http://www.dabeaz.com/coroutines/index.html’>'_ もありますが、ここでは
それらについては触れません。ジェネレータとその強力さについての非常に良い
紹介記事があります: Generator Tricks for Systems Programmers
(http://www.dabeaz.com/generators/)。


File: python.info,  Node: 同じパッチを全てのメソッドに適用する,  Next: Unboundメソッドをモックする,  Prev: ジェネレータメソッドをモックする,  Up: さらなる例

5.26.7.19 同じパッチを全てのメソッドに適用する
..............................................

複数のテストメソッドに複数のパッチを適用したい場合、当然のことながらすべ
てのメソッドにパッチデコレータを適用することになります。これは不要な繰り
返しのように感じられます。代わりに、(あらゆる形態の) *note patch():
1092. をクラスデコレータとして使用することができます。これはそのクラスの
すべてのテストメソッドにパッチを適用します。テストメソッドは名前が
‘test’ で始まるメソッドで識別されます。

     >>> @patch('mymodule.SomeClass')
     ... class MyTest(unittest.TestCase):
     ...
     ...     def test_one(self, MockSomeClass):
     ...         self.assertIs(mymodule.SomeClass, MockSomeClass)
     ...
     ...     def test_two(self, MockSomeClass):
     ...         self.assertIs(mymodule.SomeClass, MockSomeClass)
     ...
     ...     def not_a_test(self):
     ...         return 'something'
     ...
     >>> MyTest('test_one').test_one()
     >>> MyTest('test_two').test_two()
     >>> MyTest('test_two').not_a_test()
     'something'

パッチを管理する別の方法として、*note patch のメソッド; start と stop:
465e.を使用する方法があります。これらを使うと、パッチを ‘setUp’ と
''tearDown''メソッドに移すことができます。

     >>> class MyTest(unittest.TestCase):
     ...     def setUp(self):
     ...         self.patcher = patch('mymodule.foo')
     ...         self.mock_foo = self.patcher.start()
     ...
     ...     def test_foo(self):
     ...         self.assertIs(mymodule.foo, self.mock_foo)
     ...
     ...     def tearDown(self):
     ...         self.patcher.stop()
     ...
     >>> MyTest('test_foo').run()

この方式を使う場合、必ず ‘stop’ メソッドを呼び出してパッチが解除する必要
があります。setUp の中で例外が発生した場合 tearDown が呼び出されないので
、これは意外に面倒です。 *note unittest.TestCase.addCleanup(): c74. を使
うと簡単にできます:

     >>> class MyTest(unittest.TestCase):
     ...     def setUp(self):
     ...         patcher = patch('mymodule.foo')
     ...         self.addCleanup(patcher.stop)
     ...         self.mock_foo = patcher.start()
     ...
     ...     def test_foo(self):
     ...         self.assertIs(mymodule.foo, self.mock_foo)
     ...
     >>> MyTest('test_foo').run()


File: python.info,  Node: Unboundメソッドをモックする,  Next: モックで複数回の呼び出しをチェックする,  Prev: 同じパッチを全てのメソッドに適用する,  Up: さらなる例

5.26.7.20 Unboundメソッドをモックする
.....................................

Sometimes a test needs to patch an 'unbound method', which means
patching the method on the class rather than on the instance.  In order
to make assertions about which objects were calling this particular
method, you need to pass ‘self’ as the first argument.  The issue is
that you can't patch with a mock for this, because if you replace an
unbound method with a mock it doesn't become a bound method when fetched
from the instance, and so it doesn't get ‘self’ passed in.  The
workaround is to patch the unbound method with a real function instead.
The *note patch(): 1092. decorator makes it so simple to patch out
methods with a mock that having to create a real function becomes a
nuisance.

If you pass ‘autospec=True’ to patch then it does the patching with a
'real' function object.  This function object has the same signature as
the one it is replacing, but delegates to a mock under the hood.  You
still get your mock auto-created in exactly the same way as before.
What it means though, is that if you use it to patch out an unbound
method on a class the mocked function will be turned into a bound method
if it is fetched from an instance.  It will have ‘self’ passed in as the
first argument, which is exactly what was needed:

     >>> class Foo:
     ...   def foo(self):
     ...     pass
     ...
     >>> with patch.object(Foo, 'foo', autospec=True) as mock_foo:
     ...   mock_foo.return_value = 'foo'
     ...   foo = Foo()
     ...   foo.foo()
     ...
     'foo'
     >>> mock_foo.assert_called_once_with(foo)

‘autospec=True’ を使用しない場合、束縛されていないメソッドは代わりに
Mockインスタンスでパッチされ、‘self’ で呼び出されることはありません。


File: python.info,  Node: モックで複数回の呼び出しをチェックする,  Next: ミュータブルな引数に対処する,  Prev: Unboundメソッドをモックする,  Up: さらなる例

5.26.7.21 モックで複数回の呼び出しをチェックする
................................................

モックには、モックオブジェクトがどのように使用されるかをアサートするため
の素晴らしいAPIがあります。

     >>> mock = Mock()
     >>> mock.foo_bar.return_value = None
     >>> mock.foo_bar('baz', spam='eggs')
     >>> mock.foo_bar.assert_called_with('baz', spam='eggs')

If your mock is only being called once you can use the *note
assert_called_once_with(): 4635. method that also asserts that the *note
call_count: 1783. is one.

     >>> mock.foo_bar.assert_called_once_with('baz', spam='eggs')
     >>> mock.foo_bar()
     >>> mock.foo_bar.assert_called_once_with('baz', spam='eggs')
     Traceback (most recent call last):
         ...
     AssertionError: Expected 'foo_bar' to be called once. Called 2 times.
     Calls: [call('baz', spam='eggs'), call()].

Both ‘assert_called_with’ and ‘assert_called_once_with’ make assertions
about the 'most recent' call.  If your mock is going to be called
several times, and you want to make assertions about 'all' those calls
you can use *note call_args_list: 463e.:

     >>> mock = Mock(return_value=None)
     >>> mock(1, 2, 3)
     >>> mock(4, 5, 6)
     >>> mock()
     >>> mock.call_args_list
     [call(1, 2, 3), call(4, 5, 6), call()]

*note call: 1db3. ヘルパーを使えば、これらの呼び出しについて簡単にアサー
トすることができます。予想される呼び出しのリストを作成し、それを
''call_args_list''と比較することができます。これは''call_args_list''の
reprと驚くほど似ています:

     >>> expected = [call(1, 2, 3), call(4, 5, 6), call()]
     >>> mock.call_args_list == expected
     True


File: python.info,  Node: ミュータブルな引数に対処する,  Next: patch をネストする,  Prev: モックで複数回の呼び出しをチェックする,  Up: さらなる例

5.26.7.22 ミュータブルな引数に対処する
......................................

稀ではありますが、問題となることがあるのはミュータブルな引数でモックが呼
び出された場合です。‘call_args’ や''call_args_list'' は引数への*参照*を
保存します。もしテスト対象のコードによって引数が変更されてしまうと、モッ
クが呼び出された時の値をアサートすることはできなくなります。

この問題を示すサンプルコードを示します。

     def frob(val):
         pass

     def grob(val):
         "First frob and then clear val"
         frob(val)
         val.clear()

‘grob’ が''frob''を正しい引数で呼び出していることをテストしようとすると
何が起こるか見てみましょう:

     >>> with patch('mymodule.frob') as mock_frob:
     ...     val = {6}
     ...     mymodule.grob(val)
     ...
     >>> val
     set()
     >>> mock_frob.assert_called_with({6})
     Traceback (most recent call last):
         ...
     AssertionError: Expected: (({6},), {})
     Called with: ((set(),), {})

一つの選択肢は、あなたが渡す引数をモックがコピーすることです。この方法は
、オブジェクトidの同一性に依存したアサーションを行う場合に問題を引き起こ
す可能性があります。

Here's one solution that uses the *note side_effect: 462b.
functionality.  If you provide a ‘side_effect’ function for a mock then
‘side_effect’ will be called with the same args as the mock.  This gives
us an opportunity to copy the arguments and store them for later
assertions.  In this example I'm using 'another' mock to store the
arguments so that I can use the mock methods for doing the assertion.
Again a helper function sets this up for me.

     >>> from copy import deepcopy
     >>> from unittest.mock import Mock, patch, DEFAULT
     >>> def copy_call_args(mock):
     ...     new_mock = Mock()
     ...     def side_effect(*args, **kwargs):
     ...         args = deepcopy(args)
     ...         kwargs = deepcopy(kwargs)
     ...         new_mock(*args, **kwargs)
     ...         return DEFAULT
     ...     mock.side_effect = side_effect
     ...     return new_mock
     ...
     >>> with patch('mymodule.frob') as mock_frob:
     ...     new_mock = copy_call_args(mock_frob)
     ...     val = {6}
     ...     mymodule.grob(val)
     ...
     >>> new_mock.assert_called_with({6})
     >>> new_mock.call_args
     call({6})

‘copy_call_args’ は、テストで呼び出されるモックとともに呼び出されます。
この関数はアサーションで使用するための新しいモックを返します。
‘side_effect’ 関数は引数のコピーを作成し、そのコピーを使って ‘new_mock’
を呼び出します。

     注釈: もしモックが一度しか使われないのであれば、呼び出された時点で
     引数をチェックする簡単な方法があります。単純に''side_effect''関数の
     中でチェックを行えばいいのです。

          >>> def side_effect(arg):
          ...     assert arg == {6}
          ...
          >>> mock = Mock(side_effect=side_effect)
          >>> mock({6})
          >>> mock(set())
          Traceback (most recent call last):
              ...
          AssertionError

別の方法としては、（ *note copy.deepcopy(): d65. を使用して）引数をコピ
ーする、 *note Mock: c3f. や *note MagicMock: 108f. のサブクラスを作成す
る方法があります。以下に実装例を示します。

     >>> from copy import deepcopy
     >>> class CopyingMock(MagicMock):
     ...     def __call__(self, /, *args, **kwargs):
     ...         args = deepcopy(args)
     ...         kwargs = deepcopy(kwargs)
     ...         return super().__call__(*args, **kwargs)
     ...
     >>> c = CopyingMock(return_value=None)
     >>> arg = set()
     >>> c(arg)
     >>> arg.add(1)
     >>> c.assert_called_with(set())
     >>> c.assert_called_with(arg)
     Traceback (most recent call last):
         ...
     AssertionError: expected call not found.
     Expected: mock({1})
     Actual: mock(set())
     >>> c.foo
     <CopyingMock name='mock.foo' id='...'>

When you subclass ‘Mock’ or ‘MagicMock’ all dynamically created
attributes, and the ‘return_value’ will use your subclass automatically.
That means all children of a ‘CopyingMock’ will also have the type
‘CopyingMock’.


File: python.info,  Node: patch をネストする,  Next: MagicMock で辞書をモックする,  Prev: ミュータブルな引数に対処する,  Up: さらなる例

5.26.7.23 patch をネストする
............................

Using patch as a context manager is nice, but if you do multiple patches
you can end up with nested with statements indenting further and further
to the right:

     >>> class MyTest(unittest.TestCase):
     ...
     ...     def test_foo(self):
     ...         with patch('mymodule.Foo') as mock_foo:
     ...             with patch('mymodule.Bar') as mock_bar:
     ...                 with patch('mymodule.Spam') as mock_spam:
     ...                     assert mymodule.Foo is mock_foo
     ...                     assert mymodule.Bar is mock_bar
     ...                     assert mymodule.Spam is mock_spam
     ...
     >>> original = mymodule.Foo
     >>> MyTest('test_foo').test_foo()
     >>> assert mymodule.Foo is original

With unittest ‘cleanup’ functions and the *note patch のメソッド; start
と stop: 465e. we can achieve the same effect without the nested
indentation.  A simple helper method, ‘create_patch’, puts the patch in
place and returns the created mock for us:

     >>> class MyTest(unittest.TestCase):
     ...
     ...     def create_patch(self, name):
     ...         patcher = patch(name)
     ...         thing = patcher.start()
     ...         self.addCleanup(patcher.stop)
     ...         return thing
     ...
     ...     def test_foo(self):
     ...         mock_foo = self.create_patch('mymodule.Foo')
     ...         mock_bar = self.create_patch('mymodule.Bar')
     ...         mock_spam = self.create_patch('mymodule.Spam')
     ...
     ...         assert mymodule.Foo is mock_foo
     ...         assert mymodule.Bar is mock_bar
     ...         assert mymodule.Spam is mock_spam
     ...
     >>> original = mymodule.Foo
     >>> MyTest('test_foo').run()
     >>> assert mymodule.Foo is original


File: python.info,  Node: MagicMock で辞書をモックする,  Next: Mock のサブクラスと属性,  Prev: patch をネストする,  Up: さらなる例

5.26.7.24 MagicMock で辞書をモックする
......................................

You may want to mock a dictionary, or other container object, recording
all access to it whilst having it still behave like a dictionary.

We can do this with *note MagicMock: 108f, which will behave like a
dictionary, and using *note side_effect: 462b. to delegate dictionary
access to a real underlying dictionary that is under our control.

When the *note __getitem__(): 588. and *note __setitem__(): 14e3.
methods of our ‘MagicMock’ are called (normal dictionary access) then
‘side_effect’ is called with the key (and in the case of ‘__setitem__’
the value too).  We can also control what is returned.

After the ‘MagicMock’ has been used we can use attributes like *note
call_args_list: 463e. to assert about how the dictionary was used:

     >>> my_dict = {'a': 1, 'b': 2, 'c': 3}
     >>> def getitem(name):
     ...      return my_dict[name]
     ...
     >>> def setitem(name, val):
     ...     my_dict[name] = val
     ...
     >>> mock = MagicMock()
     >>> mock.__getitem__.side_effect = getitem
     >>> mock.__setitem__.side_effect = setitem

     注釈: An alternative to using ‘MagicMock’ is to use ‘Mock’ and
     'only' provide the magic methods you specifically want:

          >>> mock = Mock()
          >>> mock.__getitem__ = Mock(side_effect=getitem)
          >>> mock.__setitem__ = Mock(side_effect=setitem)

     A 'third' option is to use ‘MagicMock’ but passing in ‘dict’ as the
     'spec' (or 'spec_set') argument so that the ‘MagicMock’ created
     only has dictionary magic methods available:

          >>> mock = MagicMock(spec_set=dict)
          >>> mock.__getitem__.side_effect = getitem
          >>> mock.__setitem__.side_effect = setitem

With these side effect functions in place, the ‘mock’ will behave like a
normal dictionary but recording the access.  It even raises a *note
KeyError: 5e7. if you try to access a key that doesn't exist.

     >>> mock['a']
     1
     >>> mock['c']
     3
     >>> mock['d']
     Traceback (most recent call last):
         ...
     KeyError: 'd'
     >>> mock['b'] = 'fish'
     >>> mock['d'] = 'eggs'
     >>> mock['b']
     'fish'
     >>> mock['d']
     'eggs'

After it has been used you can make assertions about the access using
the normal mock methods and attributes:

     >>> mock.__getitem__.call_args_list
     [call('a'), call('c'), call('d'), call('b'), call('d')]
     >>> mock.__setitem__.call_args_list
     [call('b', 'fish'), call('d', 'eggs')]
     >>> my_dict
     {'a': 1, 'b': 'fish', 'c': 3, 'd': 'eggs'}


File: python.info,  Node: Mock のサブクラスと属性,  Next: patch dict で import をモックする,  Prev: MagicMock で辞書をモックする,  Up: さらなる例

5.26.7.25 Mock のサブクラスと属性
.................................

There are various reasons why you might want to subclass *note Mock:
c3f.  One reason might be to add helper methods.  Here's a silly
example:

     >>> class MyMock(MagicMock):
     ...     def has_been_called(self):
     ...         return self.called
     ...
     >>> mymock = MyMock(return_value=None)
     >>> mymock
     <MyMock id='...'>
     >>> mymock.has_been_called()
     False
     >>> mymock()
     >>> mymock.has_been_called()
     True

The standard behaviour for ‘Mock’ instances is that attributes and the
return value mocks are of the same type as the mock they are accessed
on.  This ensures that ‘Mock’ attributes are ‘Mocks’ and ‘MagicMock’
attributes are ‘MagicMocks’ (1).  So if you're subclassing to add helper
methods then they'll also be available on the attributes and return
value mock of instances of your subclass.

     >>> mymock.foo
     <MyMock name='mock.foo' id='...'>
     >>> mymock.foo.has_been_called()
     False
     >>> mymock.foo()
     <MyMock name='mock.foo()' id='...'>
     >>> mymock.foo.has_been_called()
     True

Sometimes this is inconvenient.  For example, one user(2) is subclassing
mock to created a Twisted adaptor(3).  Having this applied to attributes
too actually causes errors.

‘Mock’ (in all its flavours) uses a method called ‘_get_child_mock’ to
create these "sub-mocks" for attributes and return values.  You can
prevent your subclass being used for attributes by overriding this
method.  The signature is that it takes arbitrary keyword arguments
(‘**kwargs’) which are then passed onto the mock constructor:

     >>> class Subclass(MagicMock):
     ...     def _get_child_mock(self, /, **kwargs):
     ...         return MagicMock(**kwargs)
     ...
     >>> mymock = Subclass()
     >>> mymock.foo
     <MagicMock name='mock.foo' id='...'>
     >>> assert isinstance(mymock, Subclass)
     >>> assert not isinstance(mymock.foo, Subclass)
     >>> assert not isinstance(mymock(), Subclass)

   ---------- Footnotes ----------

   (1) An exception to this rule are the non-callable mocks.  Attributes
use the callable variant because otherwise non-callable mocks couldn't
have callable methods.

   (2) https://code.google.com/archive/p/mock/issues/105

   (3) 
https://twisted.org/documents/11.0.0/api/twisted.python.components.html


File: python.info,  Node: patch dict で import をモックする,  Next: Tracking order of calls and less verbose call assertions,  Prev: Mock のサブクラスと属性,  Up: さらなる例

5.26.7.26 patch.dict で import をモックする
...........................................

One situation where mocking can be hard is where you have a local import
inside a function.  These are harder to mock because they aren't using
an object from the module namespace that we can patch out.

Generally local imports are to be avoided.  They are sometimes done to
prevent circular dependencies, for which there is 'usually' a much
better way to solve the problem (refactor the code) or to prevent "up
front costs" by delaying the import.  This can also be solved in better
ways than an unconditional local import (store the module as a class or
module attribute and only do the import on first use).

That aside there is a way to use ‘mock’ to affect the results of an
import.  Importing fetches an 'object' from the *note sys.modules: 17e6.
dictionary.  Note that it fetches an 'object', which need not be a
module.  Importing a module for the first time results in a module
object being put in ‘sys.modules’, so usually when you import something
you get a module back.  This need not be the case however.

This means you can use *note patch.dict(): 1967. to 'temporarily' put a
mock in place in *note sys.modules: 17e6.  Any imports whilst this patch
is active will fetch the mock.  When the patch is complete (the
decorated function exits, the with statement body is complete or
‘patcher.stop()’ is called) then whatever was there previously will be
restored safely.

Here's an example that mocks out the 'fooble' module.

     >>> import sys
     >>> mock = Mock()
     >>> with patch.dict('sys.modules', {'fooble': mock}):
     ...    import fooble
     ...    fooble.blob()
     ...
     <Mock name='mock.blob()' id='...'>
     >>> assert 'fooble' not in sys.modules
     >>> mock.blob.assert_called_once_with()

As you can see the ‘import fooble’ succeeds, but on exit there is no
'fooble' left in *note sys.modules: 17e6.

This also works for the ‘from module import name’ form:

     >>> mock = Mock()
     >>> with patch.dict('sys.modules', {'fooble': mock}):
     ...    from fooble import blob
     ...    blob.blip()
     ...
     <Mock name='mock.blob.blip()' id='...'>
     >>> mock.blob.blip.assert_called_once_with()

With slightly more work you can also mock package imports:

     >>> mock = Mock()
     >>> modules = {'package': mock, 'package.module': mock.module}
     >>> with patch.dict('sys.modules', modules):
     ...    from package.module import fooble
     ...    fooble()
     ...
     <Mock name='mock.module.fooble()' id='...'>
     >>> mock.module.fooble.assert_called_once_with()


File: python.info,  Node: Tracking order of calls and less verbose call assertions,  Next: More complex argument matching,  Prev: patch dict で import をモックする,  Up: さらなる例

5.26.7.27 Tracking order of calls and less verbose call assertions
..................................................................

The *note Mock: c3f. class allows you to track the 'order' of method
calls on your mock objects through the *note method_calls: 4639.
attribute.  This doesn't allow you to track the order of calls between
separate mock objects, however we can use *note mock_calls: 4637. to
achieve the same effect.

Because mocks track calls to child mocks in ‘mock_calls’, and accessing
an arbitrary attribute of a mock creates a child mock, we can create our
separate mocks from a parent one.  Calls to those child mock will then
all be recorded, in order, in the ‘mock_calls’ of the parent:

     >>> manager = Mock()
     >>> mock_foo = manager.foo
     >>> mock_bar = manager.bar

     >>> mock_foo.something()
     <Mock name='mock.foo.something()' id='...'>
     >>> mock_bar.other.thing()
     <Mock name='mock.bar.other.thing()' id='...'>

     >>> manager.mock_calls
     [call.foo.something(), call.bar.other.thing()]

We can then assert about the calls, including the order, by comparing
with the ‘mock_calls’ attribute on the manager mock:

     >>> expected_calls = [call.foo.something(), call.bar.other.thing()]
     >>> manager.mock_calls == expected_calls
     True

If ‘patch’ is creating, and putting in place, your mocks then you can
attach them to a manager mock using the *note attach_mock(): 1955.
method.  After attaching calls will be recorded in ‘mock_calls’ of the
manager.

     >>> manager = MagicMock()
     >>> with patch('mymodule.Class1') as MockClass1:
     ...     with patch('mymodule.Class2') as MockClass2:
     ...         manager.attach_mock(MockClass1, 'MockClass1')
     ...         manager.attach_mock(MockClass2, 'MockClass2')
     ...         MockClass1().foo()
     ...         MockClass2().bar()
     <MagicMock name='mock.MockClass1().foo()' id='...'>
     <MagicMock name='mock.MockClass2().bar()' id='...'>
     >>> manager.mock_calls
     [call.MockClass1(),
     call.MockClass1().foo(),
     call.MockClass2(),
     call.MockClass2().bar()]

If many calls have been made, but you're only interested in a particular
sequence of them then an alternative is to use the *note
assert_has_calls(): 1a22. method.  This takes a list of calls
(constructed with the *note call: 1db3. object).  If that sequence of
calls are in *note mock_calls: 4637. then the assert succeeds.

     >>> m = MagicMock()
     >>> m().foo().bar().baz()
     <MagicMock name='mock().foo().bar().baz()' id='...'>
     >>> m.one().two().three()
     <MagicMock name='mock.one().two().three()' id='...'>
     >>> calls = call.one().two().three().call_list()
     >>> m.assert_has_calls(calls)

Even though the chained call ‘m.one().two().three()’ aren't the only
calls that have been made to the mock, the assert still succeeds.

Sometimes a mock may have several calls made to it, and you are only
interested in asserting about 'some' of those calls.  You may not even
care about the order.  In this case you can pass ‘any_order=True’ to
‘assert_has_calls’:

     >>> m = MagicMock()
     >>> m(1), m.two(2, 3), m.seven(7), m.fifty('50')
     (...)
     >>> calls = [call.fifty('50'), call(1), call.seven(7)]
     >>> m.assert_has_calls(calls, any_order=True)


File: python.info,  Node: More complex argument matching,  Prev: Tracking order of calls and less verbose call assertions,  Up: さらなる例

5.26.7.28 More complex argument matching
........................................

Using the same basic concept as *note ANY: 1db1. we can implement
matchers to do more complex assertions on objects used as arguments to
mocks.

Suppose we expect some object to be passed to a mock that by default
compares equal based on object identity (which is the Python default for
user defined classes).  To use *note assert_called_with(): 1e03. we
would need to pass in the exact same object.  If we are only interested
in some of the attributes of this object then we can create a matcher
that will check these attributes for us.

You can see in this example how a 'standard' call to
‘assert_called_with’ isn't sufficient:

     >>> class Foo:
     ...     def __init__(self, a, b):
     ...         self.a, self.b = a, b
     ...
     >>> mock = Mock(return_value=None)
     >>> mock(Foo(1, 2))
     >>> mock.assert_called_with(Foo(1, 2))
     Traceback (most recent call last):
         ...
     AssertionError: expected call not found.
     Expected: mock(<__main__.Foo object at 0x...>)
     Actual: mock(<__main__.Foo object at 0x...>)

A comparison function for our ‘Foo’ class might look something like
this:

     >>> def compare(self, other):
     ...     if not type(self) == type(other):
     ...         return False
     ...     if self.a != other.a:
     ...         return False
     ...     if self.b != other.b:
     ...         return False
     ...     return True
     ...

And a matcher object that can use comparison functions like this for its
equality operation would look something like this:

     >>> class Matcher:
     ...     def __init__(self, compare, some_obj):
     ...         self.compare = compare
     ...         self.some_obj = some_obj
     ...     def __eq__(self, other):
     ...         return self.compare(self.some_obj, other)
     ...

全てをつなぎ合わせて:

     >>> match_foo = Matcher(compare, Foo(1, 2))
     >>> mock.assert_called_with(match_foo)

The ‘Matcher’ is instantiated with our compare function and the ‘Foo’
object we want to compare against.  In ‘assert_called_with’ the
‘Matcher’ equality method will be called, which compares the object the
mock was called with against the one we created our matcher with.  If
they match then ‘assert_called_with’ passes, and if they don't an *note
AssertionError: 8b8. is raised:

     >>> match_wrong = Matcher(compare, Foo(3, 4))
     >>> mock.assert_called_with(match_wrong)
     Traceback (most recent call last):
         ...
     AssertionError: Expected: ((<Matcher object at 0x...>,), {})
     Called with: ((<Foo object at 0x...>,), {})

With a bit of tweaking you could have the comparison function raise the
*note AssertionError: 8b8. directly and provide a more useful failure
message.

As of version 1.5, the Python testing library PyHamcrest(1) provides
similar functionality, that may be useful here, in the form of its
equality matcher (hamcrest.library.integration.match_equality(2)).

   ---------- Footnotes ----------

   (1) https://pyhamcrest.readthedocs.io/

   (2) 
https://pyhamcrest.readthedocs.io/en/release-1.8/integration/#module-hamcrest.library.integration.match_equality


File: python.info,  Node: test --- Regression tests package for Python,  Next: test support --- Utilities for the Python test suite,  Prev: unittest mock --- 入門,  Up: 開発ツール

5.26.8 ‘test’ -- Regression tests package for Python
----------------------------------------------------

     注釈: The ‘test’ package is meant for internal use by Python only.
     It is documented for the benefit of the core developers of Python.
     Any use of this package outside of Python's standard library is
     discouraged as code mentioned here can change or be removed without
     notice between releases of Python.

__________________________________________________________________

The ‘test’ package contains all regression tests for Python as well as
the modules *note test.support: ea. and *note test.regrtest: e9.  *note
test.support: ea. is used to enhance your tests while *note
test.regrtest: e9. drives the testing suite.

Each module in the ‘test’ package whose name starts with ‘test_’ is a
testing suite for a specific module or feature.  All new tests should be
written using the *note unittest: 10c. or *note doctest: 3e. module.
Some older tests are written using a "traditional" testing style that
compares output printed to ‘sys.stdout’; this style of test is
considered deprecated.

参考
....

*note unittest: 10c. モジュール

     PyUnit 回帰テストを書く。

*note doctest: 3e. モジュール

     ドキュメンテーション文字列に埋め込まれたテスト。

* Menu:

* Writing Unit Tests for the test package::
* コマンドラインインターフェースを利用してテストを実行する::


File: python.info,  Node: Writing Unit Tests for the test package,  Next: コマンドラインインターフェースを利用してテストを実行する,  Up: test --- Regression tests package for Python

5.26.8.1 Writing Unit Tests for the ‘test’ package
..................................................

*note unittest: 10c. モジュールを使ってテストを書く場合、幾つかのガイド
ラインに従うことが推奨されます。 1つは、テストモジュールの名前を、
‘test_’ で始め、テスト対象となるモジュール名で終えることです。テストモジ
ュール中のテストメソッドは名前を ‘test_’ で始めて、そのメソッドが何をテ
ストしているかという説明で終えます。これはテスト実行プログラムが、そのメ
ソッドをテストメソッドとして認識するために必要です。また、テストメソッド
にはドキュメンテーション文字列を入れるべきではありません。コメント（例え
ば ‘# True あるいは False だけを返すテスト関数’ ）を使用して、テストメソ
ッドのドキュメントを記述してください。これは、ドキュメンテーション文字列
が存在する場合はその内容が出力されてしまうため、どのテストを実行している
のかをいちいち表示したくないからです。

以下のような決まり文句を使います:

     import unittest
     from test import support

     class MyTestCase1(unittest.TestCase):

         # Only use setUp() and tearDown() if necessary

         def setUp(self):
             ... code to execute in preparation for tests ...

         def tearDown(self):
             ... code to execute to clean up after tests ...

         def test_feature_one(self):
             # Test feature one.
             ... testing code ...

         def test_feature_two(self):
             # Test feature two.
             ... testing code ...

         ... more test methods ...

     class MyTestCase2(unittest.TestCase):
         ... same structure as MyTestCase1 ...

     ... more test classes ...

     if __name__ == '__main__':
         unittest.main()

このコードのパターンを使うと *note test.regrtest: e9. からテストスイート
を実行でき、 *note unittest: 10c. のコマンドラインインターフェースをサポ
ートしているスクリプトとして自分自身を起動したり、 ‘python -m unittest’
というコマンドラインインターフェースを通して起動したりできます。

回帰テストの目的はコードを解き明かすことです。そのためには以下のいくつか
のガイドラインに従ってください:

   * テストスイートから、すべてのクラス、関数および定数を実行するべきで
     す。これには外部に公開される外部APIだけでなく「プライベートな」コー
     ドも含みます。

   * ホワイトボックス・テスト（対象のコードの詳細を元にテストを書くこと
     ）を推奨します。ブラックボックス・テスト（公開されるインターフェー
     ス仕様だけをテストすること）は、すべての境界条件を確実にテストする
     には完全ではありません。

   * すべての取りうる値を、無効値も含めてテストするようにしてください。
     そのようなテストを書くことで、全ての有効値が通るだけでなく、不適切
     な値が正しく処理されることも確認できます。

   * コード内のできる限り多くのパスを網羅してください。分岐するように入
     力を調整したテストを書くことで、コードの多くのパスをたどることがで
     きます。

   * テスト対象のコードにバグが発見された場合は、明示的にテスト追加する
     ようにしてください。そのようなテストを追加することで、将来コードを
     変更した際にエラーが再発することを防止できます。

   * テストの後始末 (例えば一時ファイルをすべて閉じたり削除したりするこ
     と) を必ず行ってください。

   * テストがオペレーティングシステムの特定の状況に依存する場合、テスト
     開始時に条件を満たしているかを検証してください。

   * インポートするモジュールをできるかぎり少なくし、可能な限り早期にイ
     ンポートを行ってください。そうすることで、テストの外部依存性を最小
     限にし、モジュールのインポートによる副作用から生じる変則的な動作を
     最小限にできます。

   * できる限りテストコードを再利用するようにしましょう。時として、入力
     の違いだけを記述すれば良くなるくらい、テストコードを小さくすること
     ができます。例えば以下のように、サブクラスで入力を指定することで、
     コードの重複を最小化することができます:

          class TestFuncAcceptsSequencesMixin:

              func = mySuperWhammyFunction

              def test_func(self):
                  self.func(self.arg)

          class AcceptLists(TestFuncAcceptsSequencesMixin, unittest.TestCase):
              arg = [1, 2, 3]

          class AcceptStrings(TestFuncAcceptsSequencesMixin, unittest.TestCase):
              arg = 'abc'

          class AcceptTuples(TestFuncAcceptsSequencesMixin, unittest.TestCase):
              arg = (1, 2, 3)

     When using this pattern, remember that all classes that inherit
     from *note unittest.TestCase: 2b3. are run as tests.  The
     ‘TestFuncAcceptsSequencesMixin’ class in the example above does not
     have any data and so can't be run by itself, thus it does not
     inherit from *note unittest.TestCase: 2b3.

参考
....

Test Driven Development

     コードより前にテストを書く方法論に関する Kent Beck の著書。


File: python.info,  Node: コマンドラインインターフェースを利用してテストを実行する,  Prev: Writing Unit Tests for the test package,  Up: test --- Regression tests package for Python

5.26.8.2 コマンドラインインターフェースを利用してテストを実行する
.................................................................

The ‘test’ package can be run as a script to drive Python's regression
test suite, thanks to the *note -m: 23c. option: ‘python -m test’.
Under the hood, it uses ‘test.regrtest’; the call ‘python -m
test.regrtest’ used in previous Python versions still works.  Running
the script by itself automatically starts running all regression tests
in the ‘test’ package.  It does this by finding all modules in the
package whose name starts with ‘test_’, importing them, and executing
the function ‘test_main()’ if present or loading the tests via
unittest.TestLoader.loadTestsFromModule if ‘test_main’ does not exist.
The names of tests to execute may also be passed to the script.
Specifying a single regression test (‘python -m test test_spam’) will
minimize output and only print whether the test passed or failed.

Running ‘test’ directly allows what resources are available for tests to
use to be set.  You do this by using the ‘-u’ command-line option.
Specifying ‘all’ as the value for the ‘-u’ option enables all possible
resources: ‘python -m test -uall’.  If all but one resource is desired
(a more common case), a comma-separated list of resources that are not
desired may be listed after ‘all’.  The command ‘python -m test
-uall,-audio,-largefile’ will run ‘test’ with all resources except the
‘audio’ and ‘largefile’ resources.  For a list of all resources and more
command-line options, run ‘python -m test -h’.

テストを実行しようとするプラットフォームによっては、回帰テストを実行する
別の方法があります。 Unix では、Python をビルドしたトップレベルディレク
トリで ‘make test’ を実行できます。 Windows上では、 ‘PCbuild’ ディレクト
リから ‘rt.bat’ を実行すると、すべての回帰テストを実行します。

Added in version 3.14: Output is colorized by default and can be *note
controlled using environment variables: 1b7.


File: python.info,  Node: test support --- Utilities for the Python test suite,  Next: test support socket_helper --- Utilities for socket tests,  Prev: test --- Regression tests package for Python,  Up: 開発ツール

5.26.9 ‘test.support’ -- Utilities for the Python test suite
------------------------------------------------------------

The ‘test.support’ module provides support for Python's regression test
suite.

     注釈: ‘test.support’ is not a public module.  It is documented here
     to help Python developers write tests.  The API of this module is
     subject to change without backwards compatibility concerns between
     releases.

このモジュールは次の例外を定義しています:

 -- 例外: test.support.TestFailed

     テストが失敗したとき送出される例外です。これは、 *note unittest:
     10c. ベースのテストでは廃止予定で、 *note unittest.TestCase: 2b3. の
     assertXXX メソッドが推奨されます。

 -- 例外: test.support.ResourceDenied

     *note unittest.SkipTest: 11e6. のサブクラスです。 (ネットワーク接続
     のような) リソースが利用できないとき送出されます。 *note
     requires(): 469f. 関数によって送出されます。

The ‘test.support’ module defines the following constants:

 -- データ: test.support.verbose

     冗長な出力が有効な場合は ‘True’ です。実行中のテストについてのより
     詳細な情報が欲しいときにチェックします。 'verbose' は *note
     test.regrtest: e9. によって設定されます。

 -- データ: test.support.is_jython

     実行中のインタプリタが Jython ならば ‘True’ になります。

 -- データ: test.support.is_android

     ‘True’ if ‘sys.platform’ is ‘android’.

 -- データ: test.support.is_emscripten

     ‘True’ if ‘sys.platform’ is ‘emscripten’.

 -- データ: test.support.is_wasi

     ‘True’ if ‘sys.platform’ is ‘wasi’.

 -- データ: test.support.is_apple_mobile

     ‘True’ if ‘sys.platform’ is ‘ios’, ‘tvos’, or ‘watchos’.

 -- データ: test.support.is_apple

     ‘True’ if ‘sys.platform’ is ‘darwin’ or ‘is_apple_mobile’ is
     ‘True’.

 -- データ: test.support.unix_shell

     Windows 以外ではシェルのパスです; そうでない場合は ‘None’ です。

 -- データ: test.support.LOOPBACK_TIMEOUT

     Timeout in seconds for tests using a network server listening on
     the network local loopback interface like ‘127.0.0.1’.

     The timeout is long enough to prevent test failure: it takes into
     account that the client and the server can run in different threads
     or even different processes.

     The timeout should be long enough for *note connect(): fa3, *note
     recv(): fa4. and *note send(): fa7. methods of *note socket.socket:
     fa1.

     デフォルト値は5秒です。

     *note INTERNET_TIMEOUT: 1d9d. も参照してください。

 -- データ: test.support.INTERNET_TIMEOUT

     Timeout in seconds for network requests going to the internet.

     The timeout is short enough to prevent a test to wait for too long
     if the internet request is blocked for whatever reason.

     Usually, a timeout using *note INTERNET_TIMEOUT: 1d9d. should not
     mark a test as failed, but skip the test instead: see *note
     transient_internet(): 46a8.

     デフォルト値は1分です。

     *note LOOPBACK_TIMEOUT: 1d9c. も参照してください。

 -- データ: test.support.SHORT_TIMEOUT

     Timeout in seconds to mark a test as failed if the test takes "too
     long".

     The timeout value depends on the regrtest ‘--timeout’ command line
     option.

     If a test using *note SHORT_TIMEOUT: 1c63. starts to fail randomly
     on slow buildbots, use *note LONG_TIMEOUT: 1d9e. instead.

     デフォルト値は30秒です。

 -- データ: test.support.LONG_TIMEOUT

     Timeout in seconds to detect when a test hangs.

     It is long enough to reduce the risk of test failure on the slowest
     Python buildbots.  It should not be used to mark a test as failed
     if the test takes "too long".  The timeout value depends on the
     regrtest ‘--timeout’ command line option.

     デフォルト値は5分です。

     See also *note LOOPBACK_TIMEOUT: 1d9c, *note INTERNET_TIMEOUT:
     1d9d. and *note SHORT_TIMEOUT: 1c63.

 -- データ: test.support.PGO

     テストが PGO (Profile Guided Optimization) の役に立たないときにスキ
     ップできるなら設定します。

 -- データ: test.support.PIPE_MAX_SIZE

     書き込みをブロックするための、基底にある OS のパイプバッファサイズ
     より大きいであろう定数。

 -- データ: test.support.Py_DEBUG

     ‘True’ if Python was built with the *note Py_DEBUG: 1834. macro
     defined, that is, if Python was *note built in debug mode: 509.

     Added in version 3.12.

 -- データ: test.support.SOCK_MAX_SIZE

     書き込みをブロックするための、基底にある OS のソケットバッファサイ
     ズより大きいであろう定数。

 -- データ: test.support.TEST_SUPPORT_DIR

     Set to the top level directory that contains ‘test.support’.

 -- データ: test.support.TEST_HOME_DIR

     テストパッケージのトップディレクトリを設定します。

 -- データ: test.support.TEST_DATA_DIR

     テストパッケージ内の ‘data’ ディレクトリを設定します。

 -- データ: test.support.MAX_Py_ssize_t

     大量のメモリを使うテストのための *note sys.maxsize: 13dd. を設定し
     ます。

 -- データ: test.support.max_memuse

     大量のメモリを使うテストのためのメモリ上限となる *note
     set_memlimit(): 46b2. を設定します。 *note MAX_Py_ssize_t: 46b0. が
     設定上限です。

 -- データ: test.support.real_max_memuse

     大量のメモリを使うテストのためのメモリ上限となる *note
     set_memlimit(): 46b2. を設定します。 *note MAX_Py_ssize_t: 46b0. の
     設定上限はありません。

 -- データ: test.support.MISSING_C_DOCSTRINGS

     Set to ‘True’ if Python is built without docstrings (the
     ‘WITH_DOC_STRINGS’ macro is not defined).  See the *note configure
     -without-doc-strings: 21a2. option.

     See also the *note HAVE_DOCSTRINGS: 46b5. variable.

 -- データ: test.support.HAVE_DOCSTRINGS

     Set to ‘True’ if function docstrings are available.  See the *note
     python -OO: 18c. option, which strips docstrings of functions
     implemented in Python.

     See also the *note MISSING_C_DOCSTRINGS: 46b4. variable.

 -- データ: test.support.TEST_HTTP_URL

     ネットワークテスト専用の HTTP サーバーの URL を定義します。

 -- データ: test.support.ALWAYS_EQ

     Object that is equal to anything.  Used to test mixed type
     comparison.

 -- データ: test.support.NEVER_EQ

     Object that is not equal to anything (even to *note ALWAYS_EQ:
     46b7.).  Used to test mixed type comparison.

 -- データ: test.support.LARGEST

     Object that is greater than anything (except itself).  Used to test
     mixed type comparison.

 -- データ: test.support.SMALLEST

     Object that is less than anything (except itself).  Used to test
     mixed type comparison.

The ‘test.support’ module defines the following functions:

 -- の関数: test.support.busy_retry (timeout, err_msg=None, /, *,
          error=True)

     Run the loop body until ‘break’ stops the loop.

     After 'timeout' seconds, raise an *note AssertionError: 8b8. if
     'error' is true, or just stop the loop if 'error' is false.

     以下はプログラム例です:

          for _ in support.busy_retry(support.SHORT_TIMEOUT):
              if check():
                  break

     Example of error=False usage:

          for _ in support.busy_retry(support.SHORT_TIMEOUT, error=False):
              if check():
                  break
          else:
              raise RuntimeError('my custom error')

 -- の関数: test.support.sleeping_retry (timeout, err_msg=None, /, *,
          init_delay=0.010, max_delay=1.0, error=True)

     Wait strategy that applies exponential backoff.

     Run the loop body until ‘break’ stops the loop.  Sleep at each loop
     iteration, but not at the first iteration.  The sleep delay is
     doubled at each iteration (up to 'max_delay' seconds).

     See *note busy_retry(): 46bb. documentation for the parameters
     usage.

     Example raising an exception after SHORT_TIMEOUT seconds:

          for _ in support.sleeping_retry(support.SHORT_TIMEOUT):
              if check():
                  break

     Example of error=False usage:

          for _ in support.sleeping_retry(support.SHORT_TIMEOUT, error=False):
              if check():
                  break
          else:
              raise RuntimeError('my custom error')

 -- の関数: test.support.is_resource_enabled (resource)

     'resource' が有効で利用可能ならば ‘True’ を返します。利用可能なリソ
     ースのリストは、 *note test.regrtest: e9. がテストを実行している間
     のみ設定されます。

 -- の関数: test.support.get_resource_value (resource)

     Return the value specified for 'resource' (as ‘-u RESOURCE=VALUE’).
     Return ‘None’ if 'resource' is disabled or no value is specified.

 -- の関数: test.support.python_is_optimized ()

     Return ‘True’ if Python was not built with ‘-O0’ or ‘-Og’.

 -- の関数: test.support.with_pymalloc ()

     Return ‘_testcapi.WITH_PYMALLOC’.

 -- の関数: test.support.requires (resource, msg=None)

     'resource' が利用できなければ、 *note ResourceDenied: 469e. を送出
     します。その場合、 'msg' は *note ResourceDenied: 469e. の引数にな
     ります。 ‘__name__’ が ‘'__main__'’ である関数にから呼び出された場
     合には常に ‘True’ を返します。テストを *note test.regrtest: e9. か
     ら実行するときに使われます。

 -- の関数: test.support.sortdict (dict)

     Return a repr of 'dict' with keys sorted.

 -- の関数: test.support.findfile (filename, subdir=None)

     'filename' という名前のファイルへのパスを返します。一致するものが見
     つからなければ、 'filename' 自体を返します。 'filename' 自体もファ
     イルへのパスでありえるので、 'filename' が返っても失敗ではありませ
     ん。

     'subdir' を設定することで、パスのディレクトリを直接見に行くのではな
     く、相対パスを使って見付けにいくように指示できます。

 -- の関数: test.support.get_pagesize ()

     Get size of a page in bytes.

     Added in version 3.12.

 -- の関数: test.support.setswitchinterval (interval)

     Set the *note sys.setswitchinterval(): b44. to the given
     'interval'.  Defines a minimum interval for Android systems to
     prevent the system from hanging.

 -- の関数: test.support.check_impl_detail (**guards)

     Use this check to guard CPython's implementation-specific tests or
     to run them only on the implementations guarded by the arguments.
     This function returns ‘True’ or ‘False’ depending on the host
     platform.  Example usage:

          check_impl_detail()               # Only on CPython (default).
          check_impl_detail(jython=True)    # Only on Jython.
          check_impl_detail(cpython=False)  # Everywhere except CPython.

 -- の関数: test.support.set_memlimit (limit)

     Set the values for *note max_memuse: 46b1. and *note
     real_max_memuse: 46b3. for big memory tests.

 -- の関数: test.support.record_original_stdout (stdout)

     Store the value from 'stdout'.  It is meant to hold the stdout at
     the time the regrtest began.

 -- の関数: test.support.get_original_stdout ()

     Return the original stdout set by *note record_original_stdout():
     46c6. or ‘sys.stdout’ if it's not set.

 -- の関数: test.support.args_from_interpreter_flags ()

     Return a list of command line arguments reproducing the current
     settings in ‘sys.flags’ and ‘sys.warnoptions’.

 -- の関数: test.support.optim_args_from_interpreter_flags ()

     Return a list of command line arguments reproducing the current
     optimization settings in ‘sys.flags’.

 -- の関数: test.support.captured_stdin ()
 -- の関数: test.support.captured_stdout ()
 -- の関数: test.support.captured_stderr ()

     名前付きストリ－ムを *note io.StringIO: 112a. オブジェクトで一時的
     に置き換えるコンテキストマネージャです。

     出力ストリームの使用例:

          with captured_stdout() as stdout, captured_stderr() as stderr:
              print("hello")
              print("error", file=sys.stderr)
          assert stdout.getvalue() == "hello\n"
          assert stderr.getvalue() == "error\n"

     入力ストリ－ムの使用例:

          with captured_stdin() as stdin:
              stdin.write('hello\n')
              stdin.seek(0)
              # call test code that consumes from sys.stdin
              captured = input()
          self.assertEqual(captured, "hello")

 -- の関数: test.support.disable_faulthandler ()

     A context manager that temporary disables *note faulthandler: 5c.

 -- の関数: test.support.gc_collect ()

     Force as many objects as possible to be collected.  This is needed
     because timely deallocation is not guaranteed by the garbage
     collector.  This means that ‘__del__’ methods may be called later
     than expected and weakrefs may remain alive for longer than
     expected.

 -- の関数: test.support.disable_gc ()

     A context manager that disables the garbage collector on entry.  On
     exit, the garbage collector is restored to its prior state.

 -- の関数: test.support.swap_attr (obj, attr, new_val)

     Context manager to swap out an attribute with a new object.

     使い方:

          with swap_attr(obj, "attr", 5):
              ...

     This will set ‘obj.attr’ to 5 for the duration of the ‘with’ block,
     restoring the old value at the end of the block.  If ‘attr’ doesn't
     exist on ‘obj’, it will be created and then deleted at the end of
     the block.

     The old value (or ‘None’ if it doesn't exist) will be assigned to
     the target of the "as" clause, if there is one.

 -- の関数: test.support.swap_item (obj, attr, new_val)

     Context manager to swap out an item with a new object.

     使い方:

          with swap_item(obj, "item", 5):
              ...

     This will set ‘obj["item"]’ to 5 for the duration of the ‘with’
     block, restoring the old value at the end of the block.  If ‘item’
     doesn't exist on ‘obj’, it will be created and then deleted at the
     end of the block.

     The old value (or ‘None’ if it doesn't exist) will be assigned to
     the target of the "as" clause, if there is one.

 -- の関数: test.support.flush_std_streams ()

     Call the ‘flush()’ method on *note sys.stdout: ccd. and then on
     *note sys.stderr: b33.  It can be used to make sure that the logs
     order is consistent before writing into stderr.

     Added in version 3.11.

 -- の関数: test.support.print_warning (msg)

     Print a warning into *note sys.__stderr__: 46d3.  Format the
     message as: ‘f"Warning -- {msg}"’.  If 'msg' is made of multiple
     lines, add ‘"Warning -- "’ prefix to each line.

     Added in version 3.9.

 -- の関数: test.support.wait_process (pid, *, exitcode, timeout=None)

     Wait until process 'pid' completes and check that the process exit
     code is 'exitcode'.

     Raise an *note AssertionError: 8b8. if the process exit code is not
     equal to 'exitcode'.

     If the process runs longer than 'timeout' seconds (*note
     SHORT_TIMEOUT: 1c63. by default), kill the process and raise an
     *note AssertionError: 8b8.  The timeout feature is not available on
     Windows.

     Added in version 3.9.

 -- の関数: test.support.calcobjsize (fmt)

     Return the size of the *note PyObject: 5df. whose structure members
     are defined by 'fmt'.  The returned value includes the size of the
     Python object header and alignment.

 -- の関数: test.support.calcvobjsize (fmt)

     Return the size of the *note PyVarObject: 46d6. whose structure
     members are defined by 'fmt'.  The returned value includes the size
     of the Python object header and alignment.

 -- の関数: test.support.checksizeof (test, o, size)

     For testcase 'test', assert that the ‘sys.getsizeof’ for 'o' plus
     the GC header size equals 'size'.

 -- の関数: @test.support.anticipate_failure (condition)

     ある条件で *note unittest.expectedFailure(): 45e9. の印をテストに付
     けるデコレータ。 このデコレータを使うときはいつも、関連する問題を指
     し示すコメントを付けておくべきです。

 -- の関数: test.support.system_must_validate_cert (f)

     A decorator that skips the decorated test on TLS certification
     validation failures.

 -- の関数: @test.support.run_with_locale (catstr, *locales)

     別のロケールで関数を実行し、完了したら適切に元の状態に戻すためのデ
     コレータ。 'catstr' は (例えば ‘"LC_ALL"’ のような) ロケールカテゴ
     リを文字列で表したものです。 渡された 'locales' が順々に試され、一
     番最初に出てきた妥当なロケールが使われます。

 -- の関数: @test.support.run_with_tz (tz)

     A decorator for running a function in a specific timezone,
     correctly resetting it after it has finished.

 -- の関数: @test.support.requires_freebsd_version (*min_version)

     Decorator for the minimum version when running test on FreeBSD. If
     the FreeBSD version is less than the minimum, the test is skipped.

 -- の関数: @test.support.requires_linux_version (*min_version)

     Decorator for the minimum version when running test on Linux.  If
     the Linux version is less than the minimum, the test is skipped.

 -- の関数: @test.support.requires_mac_version (*min_version)

     Decorator for the minimum version when running test on macOS. If
     the macOS version is less than the minimum, the test is skipped.

 -- の関数: @test.support.requires_gil_enabled

     Decorator for skipping tests on the free-threaded build.  If the
     *note GIL: 164. is disabled, the test is skipped.

 -- の関数: @test.support.requires_IEEE_754

     Decorator for skipping tests on non-IEEE 754 platforms.

 -- の関数: @test.support.requires_zlib

     Decorator for skipping tests if *note zlib: 139. doesn't exist.

 -- の関数: @test.support.requires_gzip

     Decorator for skipping tests if *note gzip: 6b. doesn't exist.

 -- の関数: @test.support.requires_bz2

     Decorator for skipping tests if *note bz2: 14. doesn't exist.

 -- の関数: @test.support.requires_lzma

     Decorator for skipping tests if *note lzma: 8e. doesn't exist.

 -- の関数: @test.support.requires_resource (resource)

     Decorator for skipping tests if 'resource' is not available.

 -- の関数: @test.support.requires_docstrings

     Decorator for only running the test if *note HAVE_DOCSTRINGS: 46b5.

 -- の関数: @test.support.requires_limited_api

     Decorator for only running the test if *note Limited C API: 637. is
     available.

 -- の関数: @test.support.cpython_only

     Decorator for tests only applicable to CPython.

 -- の関数: @test.support.impl_detail (msg=None, **guards)

     Decorator for invoking *note check_impl_detail(): 46c5. on
     'guards'.  If that returns ‘False’, then uses 'msg' as the reason
     for skipping the test.

 -- の関数: @test.support.thread_unsafe (reason=None)

     Decorator for marking tests as thread-unsafe.  This test always
     runs in one thread even when invoked with ‘--parallel-threads’.

 -- の関数: @test.support.no_tracing

     Decorator to temporarily turn off tracing for the duration of the
     test.

 -- の関数: @test.support.refcount_test

     Decorator for tests which involve reference counting.  The
     decorator does not run the test if it is not run by CPython.  Any
     trace function is unset for the duration of the test to prevent
     unexpected refcounts caused by the trace function.

 -- の関数: @test.support.bigmemtest (size, memuse, dry_run=True)

     Decorator for bigmem tests.

     'size' is a requested size for the test (in arbitrary,
     test-interpreted units.)  'memuse' is the number of bytes per unit
     for the test, or a good estimate of it.  For example, a test that
     needs two byte buffers, of 4 GiB each, could be decorated with
     ‘@bigmemtest(size=_4G, memuse=2)’.

     The 'size' argument is normally passed to the decorated test method
     as an extra argument.  If 'dry_run' is ‘True’, the value passed to
     the test method may be less than the requested value.  If 'dry_run'
     is ‘False’, it means the test doesn't support dummy runs when ‘-M’
     is not specified.

 -- の関数: @test.support.bigaddrspacetest

     Decorator for tests that fill the address space.

 -- の関数: test.support.linked_to_musl ()

     Return ‘False’ if there is no evidence the interpreter was compiled
     with ‘musl’, otherwise return a version triple, either ‘(0, 0, 0)’
     if the version is unknown, or the actual version if it is known.
     Intended for use in ‘skip’ decorators.  ‘emscripten’ and ‘wasi’ are
     assumed to be compiled with ‘musl’; otherwise ‘platform.libc_ver’
     is checked.

 -- の関数: test.support.check_syntax_error (testcase, statement,
          errtext='', *, lineno=None, offset=None)

     Test for syntax errors in 'statement' by attempting to compile
     'statement'.  'testcase' is the *note unittest: 10c. instance for
     the test.  'errtext' is the regular expression which should match
     the string representation of the raised *note SyntaxError: 18e.  If
     'lineno' is not ‘None’, compares to the line of the exception.  If
     'offset' is not ‘None’, compares to the offset of the exception.

 -- の関数: test.support.open_urlresource (url, *args, **kw)

     Open 'url'.  If open fails, raises *note TestFailed: 469d.

 -- の関数: test.support.reap_children ()

     Use this at the end of ‘test_main’ whenever sub-processes are
     started.  This will help ensure that no extra children (zombies)
     stick around to hog resources and create problems when looking for
     refleaks.

 -- の関数: test.support.get_attribute (obj, name)

     Get an attribute, raising *note unittest.SkipTest: 11e6. if *note
     AttributeError: 5f0. is raised.

 -- の関数: test.support.catch_unraisable_exception ()

     Context manager catching unraisable exception using *note
     sys.unraisablehook(): 507.

     Storing the exception value (‘cm.unraisable.exc_value’) creates a
     reference cycle.  The reference cycle is broken explicitly when the
     context manager exits.

     Storing the object (‘cm.unraisable.object’) can resurrect it if it
     is set to an object which is being finalized.  Exiting the context
     manager clears the stored object.

     使い方:

          with support.catch_unraisable_exception() as cm:
              # code creating an "unraisable exception"
              ...

              # check the unraisable exception: use cm.unraisable
              ...

          # cm.unraisable attribute no longer exists at this point
          # (to break a reference cycle)

     Added in version 3.8.

 -- の関数: test.support.load_package_tests (pkg_dir, loader,
          standard_tests, pattern)

     Generic implementation of the *note unittest: 10c. ‘load_tests’
     protocol for use in test packages.  'pkg_dir' is the root directory
     of the package; 'loader', 'standard_tests', and 'pattern' are the
     arguments expected by ‘load_tests’.  In simple cases, the test
     package's ‘__init__.py’ can be the following:

          import os
          from test.support import load_package_tests

          def load_tests(*args):
              return load_package_tests(os.path.dirname(__file__), *args)

 -- の関数: test.support.detect_api_mismatch (ref_api, other_api, *,
          ignore=())

     Returns the set of attributes, functions or methods of 'ref_api'
     not found on 'other_api', except for a defined list of items to be
     ignored in this check specified in 'ignore'.

     By default this skips private attributes beginning with '_' but
     includes all magic methods, i.e.  those starting and ending in
     '__'.

     Added in version 3.5.

 -- の関数: test.support.patch (test_instance, object_to_patch,
          attr_name, new_value)

     Override 'object_to_patch.attr_name' with 'new_value'.  Also add
     cleanup procedure to 'test_instance' to restore 'object_to_patch'
     for 'attr_name'.  The 'attr_name' should be a valid attribute for
     'object_to_patch'.

 -- の関数: test.support.run_in_subinterp (code)

     Run 'code' in subinterpreter.  Raise *note unittest.SkipTest: 11e6.
     if *note tracemalloc: 105. is enabled.

 -- の関数: test.support.check_free_after_iterating (test, iter, cls,
          args=())

     Assert instances of 'cls' are deallocated after iterating.

 -- の関数: test.support.missing_compiler_executable (cmd_names=[])

     Check for the existence of the compiler executables whose names are
     listed in 'cmd_names' or all the compiler executables when
     'cmd_names' is empty and return the first missing executable or
     ‘None’ when none is found missing.

 -- の関数: test.support.check__all__ (test_case, module,
          name_of_module=None, extra=(), not_exported=())

     Assert that the ‘__all__’ variable of 'module' contains all public
     names.

     The module's public names (its API) are detected automatically
     based on whether they match the public name convention and were
     defined in 'module'.

     The 'name_of_module' argument can specify (as a string or tuple
     thereof) what module(s) an API could be defined in order to be
     detected as a public API. One case for this is when 'module'
     imports part of its public API from other modules, possibly a C
     backend (like ‘csv’ and its ‘_csv’).

     The 'extra' argument can be a set of names that wouldn't otherwise
     be automatically detected as "public", like objects without a
     proper *note __module__: 26d7. attribute.  If provided, it will be
     added to the automatically detected ones.

     The 'not_exported' argument can be a set of names that must not be
     treated as part of the public API even though their names indicate
     otherwise.

     使用例:

          import bar
          import foo
          import unittest
          from test import support

          class MiscTestCase(unittest.TestCase):
              def test__all__(self):
                  support.check__all__(self, foo)

          class OtherTestCase(unittest.TestCase):
              def test__all__(self):
                  extra = {'BAR_CONST', 'FOO_CONST'}
                  not_exported = {'baz'}  # Undocumented name.
                  # bar imports part of its API from _bar.
                  support.check__all__(self, bar, ('bar', '_bar'),
                                       extra=extra, not_exported=not_exported)

     Added in version 3.6.

 -- の関数: test.support.skip_if_broken_multiprocessing_synchronize ()

     Skip tests if the ‘multiprocessing.synchronize’ module is missing,
     if there is no available semaphore implementation, or if creating a
     lock raises an *note OSError: 2c0.

     Added in version 3.10.

 -- の関数: test.support.check_disallow_instantiation (test_case, tp,
          *args, **kwds)

     Assert that type 'tp' cannot be instantiated using 'args' and
     'kwds'.

     Added in version 3.10.

 -- の関数: test.support.adjust_int_max_str_digits (max_digits)

     This function returns a context manager that will change the global
     *note sys.set_int_max_str_digits(): 18f1. setting for the duration
     of the context to allow execution of test code that needs a
     different limit on the number of digits when converting between an
     integer and string.

     Added in version 3.11.

The ‘test.support’ module defines the following classes:

 -- クラス: test.support.SuppressCrashReport

     A context manager used to try to prevent crash dialog popups on
     tests that are expected to crash a subprocess.

     On Windows, it disables Windows Error Reporting dialogs using
     SetErrorMode(1).

     On UNIX, *note resource.setrlimit(): 17c6. is used to set *note
     resource.RLIMIT_CORE: 46fd.'s soft limit to 0 to prevent coredump
     file creation.

     On both platforms, the old value is restored by *note __exit__():
     1518.

 -- クラス: test.support.SaveSignals

     Class to save and restore signal handlers registered by the Python
     signal handler.

      -- メソッド: save (self)

          Save the signal handlers to a dictionary mapping signal
          numbers to the current signal handler.

      -- メソッド: restore (self)

          Set the signal numbers from the *note save(): 46ff. dictionary
          to the saved handler.

 -- クラス: test.support.Matcher

      -- メソッド: matches (self, d, **kwargs)

          Try to match a single dict with the supplied arguments.

      -- メソッド: match_value (self, k, dv, v)

          Try to match a single stored value ('dv') with a supplied
          value ('v').

   ---------- Footnotes ----------

   (1) 
https://msdn.microsoft.com/en-us/library/windows/desktop/ms680621.aspx


File: python.info,  Node: test support socket_helper --- Utilities for socket tests,  Next: test support script_helper --- Utilities for the Python execution tests,  Prev: test support --- Utilities for the Python test suite,  Up: 開発ツール

5.26.10 ‘test.support.socket_helper’ -- Utilities for socket tests
------------------------------------------------------------------

The ‘test.support.socket_helper’ module provides support for socket
tests.

Added in version 3.9.

 -- データ: test.support.socket_helper.IPV6_ENABLED

     Set to ‘True’ if IPv6 is enabled on this host, ‘False’ otherwise.

 -- の関数: test.support.socket_helper.find_unused_port
          (family=socket.AF_INET, socktype=socket.SOCK_STREAM)

     Returns an unused port that should be suitable for binding.  This
     is achieved by creating a temporary socket with the same family and
     type as the ‘sock’ parameter (default is *note AF_INET: 1bad, *note
     SOCK_STREAM: 150b.), and binding it to the specified host address
     (defaults to ‘0.0.0.0’) with the port set to 0, eliciting an unused
     ephemeral port from the OS. The temporary socket is then closed and
     deleted, and the ephemeral port is returned.

     Either this method or *note bind_port(): 4707. should be used for
     any tests where a server socket needs to be bound to a particular
     port for the duration of the test.  Which one to use depends on
     whether the calling code is creating a Python socket, or if an
     unused port needs to be provided in a constructor or passed to an
     external program (i.e.  the ‘-accept’ argument to openssl's
     s_server mode).  Always prefer *note bind_port(): 4707. over *note
     find_unused_port(): 4706. where possible.  Using a hard coded port
     is discouraged since it can make multiple instances of the test
     impossible to run simultaneously, which is a problem for buildbots.

 -- の関数: test.support.socket_helper.bind_port (sock, host=HOST)

     Bind the socket to a free port and return the port number.  Relies
     on ephemeral ports in order to ensure we are using an unbound port.
     This is important as many tests may be running simultaneously,
     especially in a buildbot environment.  This method raises an
     exception if the ‘sock.family’ is *note AF_INET: 1bad. and
     ‘sock.type’ is *note SOCK_STREAM: 150b, and the socket has
     ‘SO_REUSEADDR’ or ‘SO_REUSEPORT’ set on it.  Tests should never set
     these socket options for TCP/IP sockets.  The only case for setting
     these options is testing multicasting via multiple UDP sockets.

     Additionally, if the ‘SO_EXCLUSIVEADDRUSE’ socket option is
     available (i.e.  on Windows), it will be set on the socket.  This
     will prevent anyone else from binding to our host/port for the
     duration of the test.

 -- の関数: test.support.socket_helper.bind_unix_socket (sock, addr)

     Bind a Unix socket, raising *note unittest.SkipTest: 11e6. if *note
     PermissionError: f3e. is raised.

 -- の関数: @test.support.socket_helper.skip_unless_bind_unix_socket

     A decorator for running tests that require a functional ‘bind()’
     for Unix sockets.

 -- の関数: test.support.socket_helper.transient_internet
          (resource_name, *, timeout=30.0, errnos=())

     A context manager that raises *note ResourceDenied: 469e. when
     various issues with the internet connection manifest themselves as
     exceptions.


File: python.info,  Node: test support script_helper --- Utilities for the Python execution tests,  Next: test support bytecode_helper --- Support tools for testing correct bytecode generation,  Prev: test support socket_helper --- Utilities for socket tests,  Up: 開発ツール

5.26.11 ‘test.support.script_helper’ -- Utilities for the Python execution tests
--------------------------------------------------------------------------------

The ‘test.support.script_helper’ module provides support for Python's
script execution tests.

 -- の関数: test.support.script_helper.interpreter_requires_environment
          ()

     Return ‘True’ if ‘sys.executable interpreter’ requires environment
     variables in order to be able to run at all.

     This is designed to be used with ‘@unittest.skipIf()’ to annotate
     tests that need to use an ‘assert_python*()’ function to launch an
     isolated mode (‘-I’) or no environment mode (‘-E’) sub-interpreter
     process.

     A normal build & test does not run into this situation but it can
     happen when trying to run the standard library test suite from an
     interpreter that doesn't have an obvious home with Python's current
     home finding logic.

     Setting *note PYTHONHOME: 3f0. is one way to get most of the
     testsuite to run in that situation.  *note PYTHONPATH: 121f. or
     ‘PYTHONUSERSITE’ are other common environment variables that might
     impact whether or not the interpreter can start.

 -- の関数: test.support.script_helper.run_python_until_end (*args,
          **env_vars)

     Set up the environment based on 'env_vars' for running the
     interpreter in a subprocess.  The values can include ‘__isolated’,
     ‘__cleanenv’, ‘__cwd’, and ‘TERM’.

     バージョン 3.9 で変更: The function no longer strips whitespaces
     from 'stderr'.

 -- の関数: test.support.script_helper.assert_python_ok (*args,
          **env_vars)

     Assert that running the interpreter with 'args' and optional
     environment variables 'env_vars' succeeds (‘rc == 0’) and return a
     ‘(return code, stdout, stderr)’ tuple.

     If the '__cleanenv' keyword-only parameter is set, 'env_vars' is
     used as a fresh environment.

     Python is started in isolated mode (command line option ‘-I’),
     except if the '__isolated' keyword-only parameter is set to
     ‘False’.

     バージョン 3.9 で変更: The function no longer strips whitespaces
     from 'stderr'.

 -- の関数: test.support.script_helper.assert_python_failure (*args,
          **env_vars)

     Assert that running the interpreter with 'args' and optional
     environment variables 'env_vars' fails (‘rc != 0’) and return a
     ‘(return code, stdout, stderr)’ tuple.

     See *note assert_python_ok(): 470d. for more options.

     バージョン 3.9 で変更: The function no longer strips whitespaces
     from 'stderr'.

 -- の関数: test.support.script_helper.spawn_python (*args,
          stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **kw)

     Run a Python subprocess with the given arguments.

     'kw' is extra keyword args to pass to *note subprocess.Popen():
     4b7.  Returns a *note subprocess.Popen: 4b7. object.

 -- の関数: test.support.script_helper.kill_python (p)

     Run the given *note subprocess.Popen: 4b7. process until completion
     and return stdout.

 -- の関数: test.support.script_helper.make_script (script_dir,
          script_basename, source, omit_suffix=False)

     Create script containing 'source' in path 'script_dir' and
     'script_basename'.  If 'omit_suffix' is ‘False’, append ‘.py’ to
     the name.  Return the full script path.

 -- の関数: test.support.script_helper.make_zip_script (zip_dir,
          zip_basename, script_name, name_in_zip=None)

     Create zip file at 'zip_dir' and 'zip_basename' with extension
     ‘zip’ which contains the files in 'script_name'.  'name_in_zip' is
     the archive name.  Return a tuple containing ‘(full path, full path
     of archive name)’.

 -- の関数: test.support.script_helper.make_pkg (pkg_dir,
          init_source='')

     Create a directory named 'pkg_dir' containing an ‘__init__’ file
     with 'init_source' as its contents.

 -- の関数: test.support.script_helper.make_zip_pkg (zip_dir,
          zip_basename, pkg_name, script_basename, source, depth=1,
          compiled=False)

     Create a zip package directory with a path of 'zip_dir' and
     'zip_basename' containing an empty ‘__init__’ file and a file
     'script_basename' containing the 'source'.  If 'compiled' is
     ‘True’, both source files will be compiled and added to the zip
     package.  Return a tuple of the full zip path and the archive name
     for the zip file.


File: python.info,  Node: test support bytecode_helper --- Support tools for testing correct bytecode generation,  Next: test support threading_helper --- Utilities for threading tests,  Prev: test support script_helper --- Utilities for the Python execution tests,  Up: 開発ツール

5.26.12 ‘test.support.bytecode_helper’ -- Support tools for testing correct bytecode generation
-----------------------------------------------------------------------------------------------

The ‘test.support.bytecode_helper’ module provides support for testing
and inspecting bytecode generation.

Added in version 3.9.

The module defines the following class:

 -- クラス: test.support.bytecode_helper.BytecodeTestCase
          (unittest.TestCase)

     This class has custom assertion methods for inspecting bytecode.

 -- メソッド: BytecodeTestCase.get_disassembly_as_string (co)

     Return the disassembly of 'co' as string.

 -- メソッド: BytecodeTestCase.assertInBytecode (x, opname,
          argval=_UNSPECIFIED)

     Return instr if 'opname' is found, otherwise throws *note
     AssertionError: 8b8.

 -- メソッド: BytecodeTestCase.assertNotInBytecode (x, opname,
          argval=_UNSPECIFIED)

     Throws *note AssertionError: 8b8. if 'opname' is found.


File: python.info,  Node: test support threading_helper --- Utilities for threading tests,  Next: test support os_helper --- Utilities for os tests,  Prev: test support bytecode_helper --- Support tools for testing correct bytecode generation,  Up: 開発ツール

5.26.13 ‘test.support.threading_helper’ -- Utilities for threading tests
------------------------------------------------------------------------

The ‘test.support.threading_helper’ module provides support for
threading tests.

Added in version 3.10.

 -- の関数: test.support.threading_helper.join_thread (thread,
          timeout=None)

     Join a 'thread' within 'timeout'.  Raise an *note AssertionError:
     8b8. if thread is still alive after 'timeout' seconds.

 -- の関数: @test.support.threading_helper.reap_threads

     Decorator to ensure the threads are cleaned up even if the test
     fails.

 -- の関数: test.support.threading_helper.start_threads (threads,
          unlock=None)

     Context manager to start 'threads', which is a sequence of threads.
     'unlock' is a function called after the threads are started, even
     if an exception was raised; an example would be *note
     threading.Event.set(): 3636.  ‘start_threads’ will attempt to join
     the started threads upon exit.

 -- の関数: test.support.threading_helper.threading_cleanup
          (*original_values)

     Cleanup up threads not specified in 'original_values'.  Designed to
     emit a warning if a test leaves running threads in the background.

 -- の関数: test.support.threading_helper.threading_setup ()

     Return current thread count and copy of dangling threads.

 -- の関数: test.support.threading_helper.wait_threads_exit
          (timeout=None)

     Context manager to wait until all threads created in the ‘with’
     statement exit.

 -- の関数: test.support.threading_helper.catch_threading_exception ()

     Context manager catching *note threading.Thread: 176. exception
     using *note threading.excepthook(): a4b.

     Attributes set when an exception is caught:

        * ‘exc_type’

        * ‘exc_value’

        * ‘exc_traceback’

        * ‘thread’

     See *note threading.excepthook(): a4b. documentation.

     These attributes are deleted at the context manager exit.

     使い方:

          with threading_helper.catch_threading_exception() as cm:
              # code spawning a thread which raises an exception
              ...

              # check the thread exception, use cm attributes:
              # exc_type, exc_value, exc_traceback, thread
              ...

          # exc_type, exc_value, exc_traceback, thread attributes of cm no longer
          # exists at this point
          # (to avoid reference cycles)

     Added in version 3.8.

 -- の関数: test.support.threading_helper.run_concurrently (worker_func,
          nthreads, args=(), kwargs={})

     Run the worker function concurrently in multiple threads.
     Re-raises an exception if any thread raises one, after all threads
     have finished.


File: python.info,  Node: test support os_helper --- Utilities for os tests,  Next: test support import_helper --- Utilities for import tests,  Prev: test support threading_helper --- Utilities for threading tests,  Up: 開発ツール

5.26.14 ‘test.support.os_helper’ -- Utilities for os tests
----------------------------------------------------------

The ‘test.support.os_helper’ module provides support for os tests.

Added in version 3.10.

 -- データ: test.support.os_helper.FS_NONASCII

     *note os.fsencode(): e4f. でエンコードできる 非 ASCII 文字。

 -- データ: test.support.os_helper.SAVEDCWD

     *note os.getcwd(): 1909. に設定されます。

 -- データ: test.support.os_helper.TESTFN

     テンポラリファイルの名前として安全に利用できる名前に設定されます。
     作成した一時ファイルは全て閉じ、unlink (削除) しなければなりません
     。

 -- データ: test.support.os_helper.TESTFN_NONASCII

     Set to a filename containing the *note FS_NONASCII: 4724.
     character, if it exists.  This guarantees that if the filename
     exists, it can be encoded and decoded with the default filesystem
     encoding.  This allows tests that require a non-ASCII filename to
     be easily skipped on platforms where they can't work.

 -- データ: test.support.os_helper.TESTFN_UNENCODABLE

     strictモードのファイルシステムエンコーディングでエンコードできない
     ファイル名（str型）に設定します。そのようなファイル名を生成できない
     場合は、 ‘None’ になる可能性があります。

 -- データ: test.support.os_helper.TESTFN_UNDECODABLE

     strictモードのファイルシステムエンコーディングでデコードできないフ
     ァイル名（bytes型）に設定します。そのようなファイル名を生成できない
     場合は、 ‘None’ になる可能性があります。

 -- データ: test.support.os_helper.TESTFN_UNICODE

     非 ASCII 名を一時ファイルに設定します。

 -- クラス: test.support.os_helper.EnvironmentVarGuard

     一時的に環境変数をセット・アンセットするためのクラスです。このクラ
     スのインスタンスはコンテキストマネージャーとして利用されます。また
     、 ‘os.environ’ に対する参照・更新を行う完全な辞書のインターフェー
     スを持ちます。コンテキストマネージャーが終了した時、このインスタン
     ス経由で環境変数へ行った全ての変更はロールバックされます。

     バージョン 3.1 で変更: 辞書のインターフェースを追加しました。

 -- クラス: test.support.os_helper.FakePath (path)

     Simple *note path-like object: 5a1.  It implements the *note
     __fspath__(): e4c. method which just returns the 'path' argument.
     If 'path' is an exception, it will be raised in ‘__fspath__()’.

 -- メソッド: EnvironmentVarGuard.set (envvar, value)

     一時的に、 ‘envvar’ を ‘value’ にセットします。

 -- メソッド: EnvironmentVarGuard.unset (envvar, *others)

     Temporarily unset one or more environment variables.

     バージョン 3.14 で変更: More than one environment variable can be
     unset.

 -- の関数: test.support.os_helper.can_symlink ()

     OS がシンボリックリンクをサポートする場合 ‘True’ を返し、その他の場
     合は ‘False’ を返します。

 -- の関数: test.support.os_helper.can_xattr ()

     Return ‘True’ if the OS supports xattr, ‘False’ otherwise.

 -- の関数: test.support.os_helper.change_cwd (path, quiet=False)

     カレントディレクトリを一時的に 'path' に変更し与えるコンテキストマ
     ネージャです。

     'quiet' が ‘False’ の場合、コンテキストマネージャはエラーが起きると
     例外を送出します。 それ以外の場合には、警告を出すだけでカレントディ
     レクトリは同じままにしておきます。

 -- の関数: test.support.os_helper.create_empty_file (filename)

     Create an empty file with 'filename'.  If it already exists,
     truncate it.

 -- の関数: test.support.os_helper.fd_count ()

     Count the number of open file descriptors.

 -- の関数: test.support.os_helper.fs_is_case_insensitive (directory)

     Return ‘True’ if the file system for 'directory' is
     case-insensitive.

 -- の関数: test.support.os_helper.make_bad_fd ()

     一時ファイルを開いた後に閉じ、そのファイル記述子を返すことで無効な
     記述子を作成します。

 -- の関数: test.support.os_helper.rmdir (filename)

     Call *note os.rmdir(): 130b. on 'filename'.  On Windows platforms,
     this is wrapped with a wait loop that checks for the existence of
     the file, which is needed due to antivirus programs that can hold
     files open and prevent deletion.

 -- の関数: test.support.os_helper.rmtree (path)

     Call *note shutil.rmtree(): 356. on 'path' or call *note
     os.lstat(): 6c8. and *note os.rmdir(): 130b. to remove a path and
     its contents.  As with *note rmdir(): 4734, on Windows platforms
     this is wrapped with a wait loop that checks for the existence of
     the files.

 -- の関数: @test.support.os_helper.skip_unless_symlink

     シンボリックリンクのサポートが必要なテストを実行することを表すデコ
     レータ。

 -- の関数: @test.support.os_helper.skip_unless_xattr

     A decorator for running tests that require support for xattr.

 -- の関数: test.support.os_helper.temp_cwd (name='tempcwd',
          quiet=False)

     一時的に新しいディレクトリを作成し、カレントディレクトリ (current
     working directory, CWD) を変更するコンテキストマネージャです。

     一時的にカレントディレクトリを変更する前に、カレントディレクトリに
     'name' という名前のディレクトリを作成します。 'name' が ‘None’ の場
     合は、一時ディレクトリは *note tempfile.mkdtemp(): 52d. を使って作
     成されます。

     'quiet' が ‘False’ でカレントディレクトリの作成や変更ができない場合
     、例外を送出します。 それ以外の場合には、警告を出すだけで元のカレン
     トディレクトリが使われます。

 -- の関数: test.support.os_helper.temp_dir (path=None, quiet=False)

     'path' に一時ディレクトリを作成し与えるコンテキストマネージャです。

     If 'path' is ‘None’, the temporary directory is created using *note
     tempfile.mkdtemp(): 52d.  If 'quiet' is ‘False’, the context
     manager raises an exception on error.  Otherwise, if 'path' is
     specified and cannot be created, only a warning is issued.

 -- の関数: test.support.os_helper.temp_umask (umask)

     一時的にプロセスの umask を設定するコンテキストマネージャ。

 -- の関数: test.support.os_helper.unlink (filename)

     Call *note os.unlink(): 130d. on 'filename'.  As with *note
     rmdir(): 4734, on Windows platforms, this is wrapped with a wait
     loop that checks for the existence of the file.


File: python.info,  Node: test support import_helper --- Utilities for import tests,  Next: test support warnings_helper --- Utilities for warnings tests,  Prev: test support os_helper --- Utilities for os tests,  Up: 開発ツール

5.26.15 ‘test.support.import_helper’ -- Utilities for import tests
------------------------------------------------------------------

The ‘test.support.import_helper’ module provides support for import
tests.

Added in version 3.10.

 -- の関数: test.support.import_helper.forget (module_name)

     モジュール名 'module_name' を ‘sys.modules’ から取り除き、モジュー
     ルのバイトコンパイル済みファイルを全て削除します。

 -- の関数: test.support.import_helper.import_fresh_module (name,
          fresh=(), blocked=(), deprecated=False)

     この関数は、 'name' で指定された Python モジュールを、インポート前
     に ‘sys.modules’ から削除することで新規にインポートしてそのコピーを
     返します。 ‘reload()’ 関数と違い、もとのモジュールはこの操作によっ
     て影響をうけません。

     'fresh' は、同じようにインポート前に ‘sys.modules’ から削除されるモ
     ジュール名の iterable です。

     'blocked' もモジュール名のイテラブルで、インポート中にモジュールキ
     ャッシュ内でその名前を ‘None’ に置き換えることで、そのモジュールを
     インポートしようとすると *note ImportError: 65b. を発生させます。

     指定されたモジュールと 'fresh' や 'blocked' 引数内のモジュール名は
     インポート前に保存され、フレッシュなインポートが完了したら
     ‘sys.modules’ に戻されます。

     'deprecated' が ‘True’ の場合、インポート中はモジュールとパッケージ
     の廃止メッセージが抑制されます。

     指定したモジュールがインポートできなかった場合に、この関数は *note
     ImportError: 65b. を送出します。

     使用例:

          # Get copies of the warnings module for testing without affecting the
          # version being used by the rest of the test suite. One copy uses the
          # C implementation, the other is forced to use the pure Python fallback
          # implementation
          py_warnings = import_fresh_module('warnings', blocked=['_warnings'])
          c_warnings = import_fresh_module('warnings', fresh=['_warnings'])

     Added in version 3.1.

 -- の関数: test.support.import_helper.import_module (name,
          deprecated=False, *, required_on=())

     この関数は 'name' で指定されたモジュールをインポートして返します。
     通常のインポートと異なり、この関数はモジュールをインポートできなか
     った場合に *note unittest.SkipTest: 11e6. 例外を発生させます。

     Module and package deprecation messages are suppressed during this
     import if 'deprecated' is ‘True’.  If a module is required on a
     platform but optional for others, set 'required_on' to an iterable
     of platform prefixes which will be compared against *note
     sys.platform: 291.

     Added in version 3.1.

 -- の関数: test.support.import_helper.modules_setup ()

     Return a copy of *note sys.modules: 17e6.

 -- の関数: test.support.import_helper.modules_cleanup (oldmodules)

     Remove modules except for 'oldmodules' and ‘encodings’ in order to
     preserve internal cache.

 -- の関数: test.support.import_helper.unload (name)

     ‘sys.modules’ から 'name' を削除します。

 -- の関数: test.support.import_helper.make_legacy_pyc (source)

     Move a PEP 3147(1)/ PEP 488(2) pyc file to its legacy pyc location
     and return the file system path to the legacy pyc file.  The
     'source' value is the file system path to the source file.  It does
     not need to exist, however the PEP 3147/488 pyc file must exist.

 -- クラス: test.support.import_helper.CleanImport (*module_names)

     A context manager to force import to return a new module reference.
     This is useful for testing module-level behaviors, such as the
     emission of a *note DeprecationWarning: 1a3. on import.  Example
     usage:

          with CleanImport('foo'):
              importlib.import_module('foo')  # New reference.

 -- クラス: test.support.import_helper.DirsOnSysPath (*paths)

     A context manager to temporarily add directories to *note sys.path:
     3e4.

     This makes a copy of *note sys.path: 3e4, appends any directories
     given as positional arguments, then reverts *note sys.path: 3e4. to
     the copied settings when the context ends.

     Note that 'all' *note sys.path: 3e4. modifications in the body of
     the context manager, including replacement of the object, will be
     reverted at the end of the block.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3147/

   (2) https://peps.python.org/pep-0488/


File: python.info,  Node: test support warnings_helper --- Utilities for warnings tests,  Prev: test support import_helper --- Utilities for import tests,  Up: 開発ツール

5.26.16 ‘test.support.warnings_helper’ -- Utilities for warnings tests
----------------------------------------------------------------------

The ‘test.support.warnings_helper’ module provides support for warnings
tests.

Added in version 3.10.

 -- の関数: test.support.warnings_helper.ignore_warnings (*, category)

     Suppress warnings that are instances of 'category', which must be
     *note Warning: 2712. or a subclass.  Roughly equivalent to *note
     warnings.catch_warnings(): 179. with *note
     warnings.simplefilter('ignore', category=category): 8d0.  For
     example:

          @warning_helper.ignore_warnings(category=DeprecationWarning)
          def test_suppress_warning():
              # do something

     Added in version 3.8.

 -- の関数: test.support.warnings_helper.check_no_resource_warning
          (testcase)

     Context manager to check that no *note ResourceWarning: 54c. was
     raised.  You must remove the object which may emit *note
     ResourceWarning: 54c. before the end of the context manager.

 -- の関数: test.support.warnings_helper.check_syntax_warning (testcase,
          statement, errtext='', *, lineno=1, offset=None)

     Test for syntax warning in 'statement' by attempting to compile
     'statement'.  Test also that the *note SyntaxWarning: 1ae. is
     emitted only once, and that it will be converted to a *note
     SyntaxError: 18e. when turned into error.  'testcase' is the *note
     unittest: 10c. instance for the test.  'errtext' is the regular
     expression which should match the string representation of the
     emitted *note SyntaxWarning: 1ae. and raised *note SyntaxError:
     18e.  If 'lineno' is not ‘None’, compares to the line of the
     warning and exception.  If 'offset' is not ‘None’, compares to the
     offset of the exception.

     Added in version 3.8.

 -- の関数: test.support.warnings_helper.check_warnings (*filters,
          quiet=True)

     A convenience wrapper for *note warnings.catch_warnings(): 179.
     that makes it easier to test that a warning was correctly raised.
     It is approximately equivalent to calling
     ‘warnings.catch_warnings(record=True)’ with *note
     warnings.simplefilter(): 8d0. set to ‘always’ and with the option
     to automatically validate the results that are recorded.

     ‘check_warnings’ は ‘("message regexp", WarningCategory)’ の形をし
     た 2要素タプルを位置引数として受け取ります。1つ以上の 'filters' が
     与えられた場合や、オプションのキーワード引数 'quiet' が ‘False’ の
     場合、警告が期待通りであるかどうかをチェックします。指定された各
     filter は最低でも1回は囲われたコード内で発生した警告とマッチしなけ
     ればテストが失敗しますし、指定されたどの filter ともマッチしない警
     告が発生してもテストが失敗します。前者のチェックを無効にするには、
     'quiet' を ‘True’ にします。

     引数が1つもない場合、デフォルトでは次のようになります:

          check_warnings(("", Warning), quiet=True)

     この場合、全ての警告は補足され、エラーは発生しません。

     コンテキストマネージャーに入る時、 ‘WarningRecorder’ インスタンスが
     返されます。このレコーダーオブジェクトの *note warnings: 118. 属性
     から、 *note catch_warnings(): 179. から得られる警告のリストを取得
     することができます。便利さのために、レコーダーオブジェクトから直接
     、一番最近に発生した警告を表すオブジェクトの属性にアクセスできます
     (以下にある例を参照してください)。警告が1つも発生しなかった場合、そ
     れらの全ての属性は ‘None’ を返します。

     レコーダーオブジェクトの ‘reset()’ メソッドは警告リストをクリアしま
     す。

     コンテキストマネージャーは次のようにして使います:

          with check_warnings(("assertion is always true", SyntaxWarning),
                              ("", UserWarning)):
              exec('assert(False, "Hey!")')
              warnings.warn(UserWarning("Hide me!"))

     この場合、どちらの警告も発生しなかった場合や、それ以外の警告が発生
     した場合は、 *note check_warnings(): 4749. はエラーを発生させます。

     警告が発生したかどうかだけでなく、もっと詳しいチェックが必要な場合
     は、次のようなコードになります:

          with check_warnings(quiet=True) as w:
              warnings.warn("foo")
              assert str(w.args[0]) == "foo"
              warnings.warn("bar")
              assert str(w.args[0]) == "bar"
              assert str(w.warnings[0].args[0]) == "foo"
              assert str(w.warnings[1].args[0]) == "bar"
              w.reset()
              assert len(w.warnings) == 0

     全ての警告をキャプチャし、テストコードがその警告を直接テストします
     。

     バージョン 3.2 で変更: 新しいオプション引数 'filters' と 'quiet'

 -- クラス: test.support.warnings_helper.WarningsRecorder

     ユニットテスト時に warning を記録するためのクラスです。上の、 *note
     check_warnings(): 4749. のドキュメントを参照してください。


File: python.info,  Node: デバッグとプロファイル,  Next: ソフトウェア・パッケージと配布,  Prev: 開発ツール,  Up: Python 標準ライブラリ

5.27 デバッグとプロファイル
===========================

ここに含まれるライブラリは Python での開発を手助けするものです。デバッガ
を使うと、コードのステップ実行や、スタックフレームの解析、ブレークポイン
トの設定などができます。プロファイラはコードを実行して実行時間の詳細を提
供し、プログラムのボトルネックを特定できるようにします。

* Menu:

* 監査イベント表::
* bdb: bdb --- デバッガーフレームワーク. デバッガーフレームワーク
* faulthandler: faulthandler --- Python トレースバックをダンプする. Python トレースバックをダンプする
* pdb: pdb --- The Python Debugger. The Python Debugger
* Python プロファイラ::
* timeit: timeit --- 小さなコードスニペットの実行時間計測. 小さなコードスニペットの実行時間計測
* trace: trace --- Python 文実行のトレースと追跡. Python 文実行のトレースと追跡
* tracemalloc: tracemalloc --- メモリ割り当ての追跡. メモリ割り当ての追跡


File: python.info,  Node: 監査イベント表,  Next: bdb --- デバッガーフレームワーク,  Up: デバッグとプロファイル

5.27.1 監査イベント表
---------------------

この表は、 CPython ランタイムと標準ライブラリ全体で *note sys.audit():
191b. または *note PySys_Audit(): 613. の呼び出しによって送出されるすべ
てのイベントを含んでいます。これらの呼び出しは、 3.8 以降に追加されまし
た ( PEP 578(1) を参照) 。

これらのイベントの処理についての情報は *note sys.addaudithook(): 4750. と
*note PySys_AddAuditHook(): 4751. を参照してください。

この表は CPython ドキュメントから生成されており、他の実装により送出され
るイベントを表示していない可能性があります。実際に送出されるイベントは、
ランタイム固有のドキュメントを参照してください。

Audit event                        Arguments                                                   References
                                                                                               
-------------------------------------------------------------------------------------------------------------------
                                                                                               
_thread.start_new_thread           ‘function’, ‘args’, ‘kwargs’                                *note [1]: 4752.
                                                                                               
                                                                                               
array.__new__                      ‘typecode’, ‘initializer’                                   *note [1]: 4be.
                                                                                               
                                                                                               
builtins.breakpoint                ‘breakpointhook’                                            *note [1]: 271.
                                                                                               
                                                                                               
builtins.id                        ‘id’                                                        *note [1]: 163c.
                                                                                               
                                                                                               
builtins.input                     ‘prompt’                                                    *note [1]: 14f0.
                                                                                               
                                                                                               
builtins.input/result              ‘result’                                                    *note [1]: 14f0.
                                                                                               
                                                                                               
code.__new__                       ‘code’, ‘filename’, ‘name’, ‘argcount’,                     *note [1]: 32f.
                                   ‘posonlyargcount’, ‘kwonlyargcount’, ‘nlocals’,             
                                   ‘stacksize’, ‘flags’
                                   
                                                                                               
compile                            ‘source’, ‘filename’                                        *note [1]: 4b1.
                                                                                               
                                                                                               
cpython.PyConfig_Set               ‘name’, ‘value’                                             *note [1]: 37d.
                                                                                               
                                                                                               
cpython.PyInterpreterState_Clear                                                               *note [1]: 4753.
                                                                                               
                                                                                               
cpython.PyInterpreterState_New                                                                 *note [1]: 4754.
                                                                                               
                                                                                               
cpython._PySys_ClearAuditHooks                                                                 *note [1]: f11.
                                                                                               
                                                                                               
cpython.remote_debugger_script     ‘script_path’                                               *note [1]: 4755.
                                                                                               
                                                                                               
cpython.run_command                ‘command’                                                   *note [1]: 1a8.
                                                                                               
                                                                                               
cpython.run_file                   ‘filename’                                                  *note [1]: 4756.
                                                                                               
                                                                                               
cpython.run_interactivehook        ‘hook’                                                      *note [1]: 11ca.
                                                                                               
                                                                                               
cpython.run_module                 ‘module-name’                                               *note [1]: 23c.
                                                                                               
                                                                                               
cpython.run_startup                ‘filename’                                                  *note [1]: 1b8.
                                                                                               
                                                                                               
cpython.run_stdin                                                                              *note [1]: 4757.*note [2]: 4758.*note [3]: 4759.
                                                                                               
                                                                                               
ctypes.addressof                   ‘obj’                                                       *note [1]: 3335.
                                                                                               
                                                                                               
ctypes.call_function               ‘func_pointer’, ‘arguments’                                 *note [1]: 332f.
                                                                                               
                                                                                               
ctypes.cdata                       ‘address’                                                   *note [1]: 3340.
                                                                                               
                                                                                               
ctypes.cdata/buffer                ‘pointer’, ‘size’, ‘offset’                                 *note [1]: 3345.*note [2]: 3346.
                                                                                               
                                                                                               
ctypes.create_string_buffer        ‘init’, ‘size’                                              *note [1]: 32ed.
                                                                                               
                                                                                               
ctypes.create_unicode_buffer       ‘init’, ‘size’                                              *note [1]: 1db4.
                                                                                               
                                                                                               
ctypes.dlopen                      ‘name’                                                      *note [1]: 332d.
                                                                                               
                                                                                               
ctypes.dlsym                       ‘library’, ‘name’                                           *note [1]: 332d.
                                                                                               
                                                                                               
ctypes.dlsym/handle                ‘handle’, ‘name’                                            *note [1]: 332d.
                                                                                               
                                                                                               
ctypes.get_errno                                                                               *note [1]: 3327.
                                                                                               
                                                                                               
ctypes.get_last_error                                                                          *note [1]: 3329.
                                                                                               
                                                                                               
ctypes.memoryview_at               ‘address’, ‘size’, ‘readonly’                               *note [1]: 475a.
                                                                                               
                                                                                               
ctypes.set_errno                   ‘errno’                                                     *note [1]: 3328.
                                                                                               
                                                                                               
ctypes.set_exception               ‘code’                                                      *note [1]: 332f.
                                                                                               
                                                                                               
ctypes.set_last_error              ‘error’                                                     *note [1]: 332a.
                                                                                               
                                                                                               
ctypes.string_at                   ‘ptr’, ‘size’                                               *note [1]: 1ec.
                                                                                               
                                                                                               
ctypes.wstring_at                  ‘ptr’, ‘size’                                               *note [1]: 333f.
                                                                                               
                                                                                               
ensurepip.bootstrap                ‘root’                                                      *note [1]: 475b.
                                                                                               
                                                                                               
exec                               ‘code_object’                                               *note [1]: 4a3.*note [2]: 4a2.
                                                                                               
                                                                                               
fcntl.fcntl                        ‘fd’, ‘cmd’, ‘arg’                                          *note [1]: 1851.
                                                                                               
                                                                                               
fcntl.flock                        ‘fd’, ‘operation’                                           *note [1]: 475c.
                                                                                               
                                                                                               
fcntl.ioctl                        ‘fd’, ‘request’, ‘arg’                                      *note [1]: 1694.
                                                                                               
                                                                                               
fcntl.lockf                        ‘fd’, ‘cmd’, ‘len’, ‘start’, ‘whence’                       *note [1]: 1605.
                                                                                               
                                                                                               
ftplib.connect                     ‘self’, ‘host’, ‘port’                                      *note [1]: 3ffc.
                                                                                               
                                                                                               
ftplib.sendcmd                     ‘self’, ‘cmd’                                               *note [1]: 4001.*note [2]: 4002.
                                                                                               
                                                                                               
function.__new__                   ‘code’                                                      *note [1]: a83.
                                                                                               
                                                                                               
gc.get_objects                     ‘generation’                                                *note [1]: a04.
                                                                                               
                                                                                               
gc.get_referents                   ‘objs’                                                      *note [1]: a06.
                                                                                               
                                                                                               
gc.get_referrers                   ‘objs’                                                      *note [1]: a05.
                                                                                               
                                                                                               
glob.glob                          ‘pathname’, ‘recursive’                                     *note [1]: 5a0.*note [2]: a08.
                                                                                               
                                                                                               
glob.glob/2                        ‘pathname’, ‘recursive’, ‘root_dir’, ‘dir_fd’               *note [1]: 5a0.*note [2]: a08.
                                                                                               
                                                                                               
http.client.connect                ‘self’, ‘host’, ‘port’                                      *note [1]: 3fdf.
                                                                                               
                                                                                               
http.client.send                   ‘self’, ‘data’                                              *note [1]: 3fe3.
                                                                                               
                                                                                               
imaplib.open                       ‘self’, ‘host’, ‘port’                                      *note [1]: b01.
                                                                                               
                                                                                               
imaplib.send                       ‘self’, ‘data’                                              *note [1]: 4054.
                                                                                               
                                                                                               
import                             ‘module’, ‘filename’, ‘sys.path’, ‘sys.meta_path’,          *note [1]: 7f8.
                                   ‘sys.path_hooks’                                            
                                   
                                                                                               
marshal.dumps                      ‘value’, ‘version’                                          *note [1]: 2d43.
                                                                                               
                                                                                               
marshal.load                                                                                   *note [1]: 1df6.
                                                                                               
                                                                                               
marshal.loads                      ‘bytes’                                                     *note [1]: 1df6.
                                                                                               
                                                                                               
mmap.__new__                       ‘fileno’, ‘length’, ‘access’, ‘offset’                      *note [1]: 519.
                                                                                               
                                                                                               
msvcrt.get_osfhandle               ‘fd’                                                        *note [1]: 475d.
                                                                                               
                                                                                               
msvcrt.locking                     ‘fd’, ‘mode’, ‘nbytes’                                      *note [1]: 475e.
                                                                                               
                                                                                               
msvcrt.open_osfhandle              ‘handle’, ‘flags’                                           *note [1]: 475f.
                                                                                               
                                                                                               
object.__delattr__                 ‘obj’, ‘name’                                               *note [1]: 237d.
                                                                                               
                                                                                               
object.__getattr__                 ‘obj’, ‘name’                                               *note [1]: dcb.
                                                                                               
                                                                                               
object.__setattr__                 ‘obj’, ‘name’, ‘value’                                      *note [1]: 237c.
                                                                                               
                                                                                               
open                               ‘path’, ‘mode’, ‘flags’                                     *note [1]: 316.*note [2]: 740.*note [3]: f92.
                                                                                               
                                                                                               
os.add_dll_directory               ‘path’                                                      *note [1]: bdd.
                                                                                               
                                                                                               
os.chdir                           ‘path’                                                      *note [1]: 821.*note [2]: f89.
                                                                                               
                                                                                               
os.chflags                         ‘path’, ‘flags’                                             *note [1]: 1305.*note [2]: 307a.
                                                                                               
                                                                                               
os.chmod                           ‘path’, ‘mode’, ‘dir_fd’                                    *note [1]: 529.*note [2]: 52a.*note [3]: 528.
                                                                                               
                                                                                               
os.chown                           ‘path’, ‘uid’, ‘gid’, ‘dir_fd’                              *note [1]: 1306.*note [2]: f8a.*note [3]: 307b.
                                                                                               
                                                                                               
os.exec                            ‘path’, ‘args’, ‘env’                                       *note [1]: 30b4.
                                                                                               
                                                                                               
os.fork                                                                                        *note [1]: 4b5.
                                                                                               
                                                                                               
os.forkpty                                                                                     *note [1]: 4b6.
                                                                                               
                                                                                               
os.fwalk                           ‘top’, ‘topdown’, ‘onerror’, ‘follow_symlinks’, ‘dir_fd’    *note [1]: d52.
                                                                                               
                                                                                               
os.getxattr                        ‘path’, ‘attribute’                                         *note [1]: 131c.
                                                                                               
                                                                                               
os.kill                            ‘pid’, ‘sig’                                                *note [1]: 157f.
                                                                                               
                                                                                               
os.killpg                          ‘pgid’, ‘sig’                                               *note [1]: 1dbb.
                                                                                               
                                                                                               
os.link                            ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’                    *note [1]: 1307.
                                                                                               
                                                                                               
os.listdir                         ‘path’                                                      *note [1]: 1312.
                                                                                               
                                                                                               
os.listdrives                                                                                  *note [1]: 6c5.
                                                                                               
                                                                                               
os.listmounts                      ‘volume’                                                    *note [1]: 6c7.
                                                                                               
                                                                                               
os.listvolumes                                                                                 *note [1]: 6c6.
                                                                                               
                                                                                               
os.listxattr                       ‘path’                                                      *note [1]: 131d.
                                                                                               
                                                                                               
os.lockf                           ‘fd’, ‘cmd’, ‘len’                                          *note [1]: 132b.
                                                                                               
                                                                                               
os.mkdir                           ‘path’, ‘mode’, ‘dir_fd’                                    *note [1]: 52c.*note [2]: 52b.
                                                                                               
                                                                                               
os.posix_spawn                     ‘path’, ‘argv’, ‘env’                                       *note [1]: 52e.*note [2]: 1e11.
                                                                                               
                                                                                               
os.putenv                          ‘key’, ‘value’                                              *note [1]: 25b.
                                                                                               
                                                                                               
os.remove                          ‘path’, ‘dir_fd’                                            *note [1]: 1308.*note [2]: 307f.*note [3]: 130d.
                                                                                               
                                                                                               
os.removexattr                     ‘path’, ‘attribute’                                         *note [1]: 131e.
                                                                                               
                                                                                               
os.rename                          ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’                    *note [1]: 1309.*note [2]: 3080.*note [3]: 130a.
                                                                                               
                                                                                               
os.rmdir                           ‘path’, ‘dir_fd’                                            *note [1]: 130b.
                                                                                               
                                                                                               
os.scandir                         ‘path’                                                      *note [1]: c54.
                                                                                               
                                                                                               
os.setxattr                        ‘path’, ‘attribute’, ‘value’, ‘flags’                       *note [1]: 131f.
                                                                                               
                                                                                               
os.spawn                           ‘mode’, ‘path’, ‘args’, ‘env’                               *note [1]: 31b.
                                                                                               
                                                                                               
os.startfile                       ‘path’, ‘operation’                                         *note [1]: 1c83.
                                                                                               
                                                                                               
os.startfile/2                     ‘path’, ‘operation’, ‘arguments’, ‘cwd’, ‘show_cmd’         *note [1]: 1c83.
                                                                                               
                                                                                               
os.symlink                         ‘src’, ‘dst’, ‘dir_fd’                                      *note [1]: 130c.
                                                                                               
                                                                                               
os.system                          ‘command’                                                   *note [1]: 1676.
                                                                                               
                                                                                               
os.truncate                        ‘fd’, ‘length’                                              *note [1]: f8f.*note [2]: 103c.
                                                                                               
                                                                                               
os.unsetenv                        ‘key’                                                       *note [1]: 25c.
                                                                                               
                                                                                               
os.utime                           ‘path’, ‘times’, ‘ns’, ‘dir_fd’                             *note [1]: 130e.
                                                                                               
                                                                                               
os.walk                            ‘top’, ‘topdown’, ‘onerror’, ‘followlinks’                  *note [1]: 6d0.
                                                                                               
                                                                                               
pathlib.Path.glob                  ‘self’, ‘pattern’                                           *note [1]: 537.
                                                                                               
                                                                                               
pathlib.Path.rglob                 ‘self’, ‘pattern’                                           *note [1]: 538.
                                                                                               
                                                                                               
pdb.Pdb                                                                                        *note [1]: 273.
                                                                                               
                                                                                               
pickle.find_class                  ‘module’, ‘name’                                            *note [1]: 2d19.
                                                                                               
                                                                                               
poplib.connect                     ‘self’, ‘host’, ‘port’                                      *note [1]: b1d.*note [2]: b1e.
                                                                                               
                                                                                               
poplib.putline                     ‘self’, ‘line’                                              *note [1]: b1d.*note [2]: b1e.
                                                                                               
                                                                                               
pty.spawn                          ‘argv’                                                      *note [1]: 1184.
                                                                                               
                                                                                               
resource.prlimit                   ‘pid’, ‘resource’, ‘limits’                                 *note [1]: 118c.
                                                                                               
                                                                                               
resource.setrlimit                 ‘resource’, ‘limits’                                        *note [1]: 17c6.
                                                                                               
                                                                                               
setopencodehook                                                                                *note [1]: 1a9a.
                                                                                               
                                                                                               
shutil.chown                       ‘path’, ‘user’, ‘group’                                     *note [1]: 548.
                                                                                               
                                                                                               
shutil.copyfile                    ‘src’, ‘dst’                                                *note [1]: c4f.*note [2]: c50.*note [3]: c4e.
                                                                                               
                                                                                               
shutil.copymode                    ‘src’, ‘dst’                                                *note [1]: c4f.*note [2]: 1a24.
                                                                                               
                                                                                               
shutil.copystat                    ‘src’, ‘dst’                                                *note [1]: c50.*note [2]: 1346.
                                                                                               
                                                                                               
shutil.copytree                    ‘src’, ‘dst’                                                *note [1]: c1e.
                                                                                               
                                                                                               
shutil.make_archive                ‘base_name’, ‘format’, ‘root_dir’, ‘base_dir’               *note [1]: 6da.
                                                                                               
                                                                                               
shutil.move                        ‘src’, ‘dst’                                                *note [1]: c51.
                                                                                               
                                                                                               
shutil.rmtree                      ‘path’, ‘dir_fd’                                            *note [1]: 356.
                                                                                               
                                                                                               
shutil.unpack_archive              ‘filename’, ‘extract_dir’, ‘format’                         *note [1]: 696.
                                                                                               
                                                                                               
signal.pthread_kill                ‘thread_id’, ‘signalnum’                                    *note [1]: 1349.
                                                                                               
                                                                                               
smtplib.connect                    ‘self’, ‘host’, ‘port’                                      *note [1]: 1daf.
                                                                                               
                                                                                               
smtplib.send                       ‘self’, ‘data’                                              *note [1]: b27.
                                                                                               
                                                                                               
socket.__new__                     ‘self’, ‘family’, ‘type’, ‘protocol’                        *note [1]: fa1.
                                                                                               
                                                                                               
socket.bind                        ‘self’, ‘address’                                           *note [1]: 12d7.
                                                                                               
                                                                                               
socket.connect                     ‘self’, ‘address’                                           *note [1]: fa3.*note [2]: 1753.
                                                                                               
                                                                                               
socket.getaddrinfo                 ‘host’, ‘port’, ‘family’, ‘type’, ‘protocol’                *note [1]: 1ac3.
                                                                                               
                                                                                               
socket.gethostbyaddr               ‘ip_address’                                                *note [1]: 1c84.
                                                                                               
                                                                                               
socket.gethostbyname               ‘hostname’                                                  *note [1]: 3996.*note [2]: 1c85.
                                                                                               
                                                                                               
socket.gethostname                                                                             *note [1]: 3026.
                                                                                               
                                                                                               
socket.getnameinfo                 ‘sockaddr’                                                  *note [1]: 1a3a.
                                                                                               
                                                                                               
socket.getservbyname               ‘servicename’, ‘protocolname’                               *note [1]: 3998.
                                                                                               
                                                                                               
socket.getservbyport               ‘port’, ‘protocolname’                                      *note [1]: 3999.
                                                                                               
                                                                                               
socket.sendmsg                     ‘self’, ‘address’                                           *note [1]: 6a1.
                                                                                               
                                                                                               
socket.sendto                      ‘self’, ‘address’                                           *note [1]: fa9.
                                                                                               
                                                                                               
socket.sethostname                 ‘name’                                                      *note [1]: 1353.
                                                                                               
                                                                                               
sqlite3.connect                    ‘database’                                                  *note [1]: 5a6.
                                                                                               
                                                                                               
sqlite3.connect/handle             ‘connection_handle’                                         *note [1]: 5a6.
                                                                                               
                                                                                               
sqlite3.enable_load_extension      ‘connection’, ‘enabled’                                     *note [1]: a3f.
                                                                                               
                                                                                               
sqlite3.load_extension             ‘connection’, ‘path’                                        *note [1]: 6df.
                                                                                               
                                                                                               
subprocess.Popen                   ‘executable’, ‘args’, ‘cwd’, ‘env’                          *note [1]: 4b7.
                                                                                               
                                                                                               
sys._current_exceptions                                                                        *note [1]: 6e9.
                                                                                               
                                                                                               
sys._current_frames                                                                            *note [1]: 164c.
                                                                                               
                                                                                               
sys._getframe                      ‘frame’                                                     *note [1]: 8f0.
                                                                                               
                                                                                               
sys._getframemodulename            ‘depth’                                                     *note [1]: 1adf.
                                                                                               
                                                                                               
sys.addaudithook                                                                               *note [1]: 4751.*note [2]: 4750.
                                                                                               
                                                                                               
sys.excepthook                     ‘hook’, ‘type’, ‘value’, ‘traceback’                        *note [1]: a0c.
                                                                                               
                                                                                               
sys.monitoring.register_callback   ‘func’                                                      *note [1]: 4760.
                                                                                               
                                                                                               
sys.remote_exec                    ‘pid’                                                       *note [1]: 4761.
                                                                                               
                                                                                               
sys.set_asyncgen_hooks_finalizer                                                               *note [1]: 199d.
                                                                                               
                                                                                               
sys.set_asyncgen_hooks_firstiter                                                               *note [1]: 199d.
                                                                                               
                                                                                               
sys.setprofile                                                                                 *note [1]: 1717.
                                                                                               
                                                                                               
sys.settrace                                                                                   *note [1]: 2e1.
                                                                                               
                                                                                               
sys.unraisablehook                 ‘hook’, ‘unraisable’                                        *note [1]: 507.
                                                                                               
                                                                                               
syslog.closelog                                                                                *note [1]: 761.
                                                                                               
                                                                                               
syslog.openlog                     ‘ident’, ‘logoption’, ‘facility’                            *note [1]: 760.
                                                                                               
                                                                                               
syslog.setlogmask                  ‘maskpri’                                                   *note [1]: 4762.
                                                                                               
                                                                                               
syslog.syslog                      ‘priority’, ‘message’                                       *note [1]: 762.
                                                                                               
                                                                                               
tempfile.mkdtemp                   ‘fullpath’                                                  *note [1]: 144c.*note [2]: 52d.
                                                                                               
                                                                                               
tempfile.mkstemp                   ‘fullpath’                                                  *note [1]: 6ed.*note [2]: 2cc9.*note [3]: 2cca.
                                                                                               
                                                                                               
time.sleep                         ‘secs’                                                      *note [1]: 4763.
                                                                                               
                                                                                               
urllib.Request                     ‘fullurl’, ‘data’, ‘headers’, ‘method’                      *note [1]: 307.
                                                                                               
                                                                                               
webbrowser.open                    ‘url’                                                       *note [1]: 1889.
                                                                                               
                                                                                               
winreg.ConnectRegistry             ‘computer_name’, ‘key’                                      *note [1]: 4764.
                                                                                               
                                                                                               
winreg.CreateKey                   ‘key’, ‘sub_key’, ‘access’                                  *note [1]: 4765.*note [2]: 157a.
                                                                                               
                                                                                               
winreg.DeleteKey                   ‘key’, ‘sub_key’, ‘access’                                  *note [1]: 4766.*note [2]: 157b.
                                                                                               
                                                                                               
winreg.DeleteValue                 ‘key’, ‘value’                                              *note [1]: 4767.
                                                                                               
                                                                                               
winreg.DisableReflectionKey        ‘key’                                                       *note [1]: 157c.
                                                                                               
                                                                                               
winreg.EnableReflectionKey         ‘key’                                                       *note [1]: 157d.
                                                                                               
                                                                                               
winreg.EnumKey                     ‘key’, ‘index’                                              *note [1]: 4768.
                                                                                               
                                                                                               
winreg.EnumValue                   ‘key’, ‘index’                                              *note [1]: 4769.
                                                                                               
                                                                                               
winreg.ExpandEnvironmentStrings    ‘str’                                                       *note [1]: 1611.
                                                                                               
                                                                                               
winreg.LoadKey                     ‘key’, ‘sub_key’, ‘file_name’                               *note [1]: 476a.
                                                                                               
                                                                                               
winreg.OpenKey                     ‘key’, ‘sub_key’, ‘access’                                  *note [1]: 476b.
                                                                                               
                                                                                               
winreg.OpenKey/result              ‘key’                                                       *note [1]: 4765.*note [2]: 157a.*note [3]: 476b.
                                                                                               
                                                                                               
winreg.PyHKEY.Detach               ‘key’                                                       *note [1]: 476c.
                                                                                               
                                                                                               
winreg.QueryInfoKey                ‘key’                                                       *note [1]: 476d.
                                                                                               
                                                                                               
winreg.QueryReflectionKey          ‘key’                                                       *note [1]: 157e.
                                                                                               
                                                                                               
winreg.QueryValue                  ‘key’, ‘sub_key’, ‘value_name’                              *note [1]: 476e.*note [2]: 1784.
                                                                                               
                                                                                               
winreg.SaveKey                     ‘key’, ‘file_name’                                          *note [1]: 476f.
                                                                                               
                                                                                               
winreg.SetValue                    ‘key’, ‘sub_key’, ‘type’, ‘value’                           *note [1]: 4770.*note [2]: 1b03.
                                                                                               

以下のイベントは内部で送出され、 CPython の公開 API に対応しません。

監査イベント                     引数
                                 
---------------------------------------------------------------------------------
                                 
_winapi.CreateFile               ‘file_name’, ‘desired_access’, ‘share_mode’,
                                 ‘creation_disposition’,
                                 ‘flags_and_attributes’
                                 
                                 
_winapi.CreateJunction           ‘src_path’, ‘dst_path’
                                 
                                 
_winapi.CreateNamedPipe          ‘name’, ‘open_mode’, ‘pipe_mode’
                                 
                                 
_winapi.CreatePipe

_winapi.CreateProcess            ‘application_name’, ‘command_line’,
                                 ‘current_directory’
                                 
                                 
_winapi.OpenProcess              ‘process_id’, ‘desired_access’
                                 
                                 
_winapi.TerminateProcess         ‘handle’, ‘exit_code’
                                 
                                 
_posixsubprocess.fork_exec       ‘exec_list’, ‘args’, ‘env’
                                 
                                 
ctypes.PyObj_FromPtr             ‘obj’
                                 

Added in version 3.14: The ‘_posixsubprocess.fork_exec’ internal audit
event.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0578/


File: python.info,  Node: bdb --- デバッガーフレームワーク,  Next: faulthandler --- Python トレースバックをダンプする,  Prev: 監査イベント表,  Up: デバッグとプロファイル

5.27.2 ‘bdb’ -- デバッガーフレームワーク
----------------------------------------

'ソースコード:' Lib/bdb.py(1)

__________________________________________________________________

The ‘bdb’ module handles basic debugger functions, like setting
breakpoints or managing execution via the debugger.

以下の例外が定義されています:

 -- 例外: bdb.BdbQuit

     *note Bdb: 2d5. クラスが、デバッガーを終了させるために投げる例外。

The ‘bdb’ module also defines two classes:

 -- クラス: bdb.Breakpoint (self, file, line, temporary=False,
          cond=None, funcname=None)

     このクラスはテンポラリブレークポイント、無視するカウント、無効化と
     再有効化、条件付きブレークポイントを実装しています。

     ブレークポイントは *note bpbynumber: 4775. という名前のリストで番号
     によりインデックスされ、 *note bplist: 4776. により ‘(file, line)’
     の形でインデックスされます。 *note bpbynumber: 4775. は *note
     Breakpoint: 4774. クラスのインスタンスを指しています。一方 *note
     bplist: 4776. は、同じ行に複数のブレークポイントが設定される場合が
     あるので、インスタンスのリストを指しています。

     ブレークポイントを作るとき、関連付けられる *note ファイル名: 4777.
     は正規化されていなければなりません。*note funcname: 4778. が定義さ
     れると、ブレークポイントの *note ヒット: 4779. はその関数の最初の行
     が実行されたときにカウントされます。*note 条件付き: 477a. ブレーク
     ポイントは毎回 *note ヒット: 4779. をカウントします。

     *note Breakpoint: 4774. インスタンスは以下のメソッドを持ちます:

      -- メソッド: deleteMe ()

          このブレークポイントをファイル/行に関連付けられたリストから削
          除します。このブレークポイントがその行に設定された最後のブレー
          クポイントだった場合、そのファイル/行に対するエントリ自体を削
          除します。

      -- メソッド: enable ()

          このブレークポイントを有効にします。

      -- メソッド: disable ()

          このブレークポイントを無効にします。

      -- メソッド: bpformat ()

          ブレークポイントに関する情報を持つ文字列をフォーマットして返し
          ます:

             * Breakpoint number.

             * Temporary status (del or keep).

             * File/line position.

             * Break condition.

             * Number of times to ignore.

             * Number of times hit.

          Added in version 3.2.

      -- メソッド: bpprint (out=None)

          ファイル 'out' に、またはそれが ‘None’ の場合は標準出力に、
          *note bpformat(): 477e. の出力を表示する。

     *note Breakpoint: 4774. インスタンスは以下の属性を持ちます:

      -- の属性: file

          File name of the *note Breakpoint: 4774.

      -- の属性: line

          Line number of the *note Breakpoint: 4774. within *note file:
          4777.

      -- の属性: temporary

          ‘True’ if a *note Breakpoint: 4774. at (file, line) is
          temporary.

      -- の属性: cond

          Condition for evaluating a *note Breakpoint: 4774. at (file,
          line).

      -- の属性: funcname

          Function name that defines whether a *note Breakpoint: 4774.
          is hit upon entering the function.

      -- の属性: enabled

          ‘True’ if *note Breakpoint: 4774. is enabled.

      -- の属性: bpbynumber

          Numeric index for a single instance of a *note Breakpoint:
          4774.

      -- の属性: bplist

          Dictionary of *note Breakpoint: 4774. instances indexed by
          (*note file: 4777, *note line: 4780.) tuples.

      -- の属性: ignore

          Number of times to ignore a *note Breakpoint: 4774.

      -- の属性: hits

          Count of the number of times a *note Breakpoint: 4774. has
          been hit.

 -- クラス: bdb.Bdb (skip=None, backend='settrace')

     *note Bdb: 2d5. クラスは一般的なPythonデバッガーの基本クラスとして
     振舞います。

     このクラスはトレース機能の詳細を扱います。ユーザーとのインタラクシ
     ョンは、派生クラスが実装するべきです。標準ライブラリのデバッガクラ
     ス (*note pdb.Pdb: 273.) がその利用例です。

     'skip' 引数は、もし与えられたならグロブ形式のモジュール名パターンの
     iterable でなければなりません。デバッガはこれらのパターンのどれかに
     マッチするモジュールで発生したフレームにステップインしなくなります
     。フレームが特定のモジュールで発生したかどうかは、フレームのグロー
     バル変数の ‘__name__’ によって決定されます。

     The 'backend' argument specifies the backend to use for *note Bdb:
     2d5.  It can be either ‘'settrace'’ or ‘'monitoring'’.
     ‘'settrace'’ uses *note sys.settrace(): 2e1. which has the best
     backward compatibility.  The ‘'monitoring'’ backend uses the new
     *note sys.monitoring: e0. that was introduced in Python 3.12, which
     can be much more efficient because it can disable unused events.
     We are trying to keep the exact interfaces for both backends, but
     there are some differences.  The debugger developers are encouraged
     to use the ‘'monitoring'’ backend to achieve better performance.

     バージョン 3.1 で変更: 'skip' パラメータが追加されました。

     バージョン 3.14 で変更: Added the 'backend' parameter.

     以下の *note Bdb: 2d5. のメソッドは、通常オーバーライドする必要はあ
     りません。

      -- メソッド: canonic (filename)

          Return canonical form of 'filename'.

          For real file names, the canonical form is an
          operating-system-dependent, *note case-normalized: 2c56. *note
          absolute path: 1532.  A 'filename' with angle brackets, such
          as ‘"<stdin>"’ generated in interactive mode, is returned
          unchanged.

      -- メソッド: start_trace (self)

          Start tracing.  For ‘'settrace'’ backend, this method is
          equivalent to ‘sys.settrace(self.trace_dispatch)’

          Added in version 3.14.

      -- メソッド: stop_trace (self)

          Stop tracing.  For ‘'settrace'’ backend, this method is
          equivalent to ‘sys.settrace(None)’

          Added in version 3.14.

      -- メソッド: reset ()

          Set the ‘botframe’, ‘stopframe’, ‘returnframe’ and *note
          quitting: 4788. attributes with values ready to start
          debugging.

      -- メソッド: trace_dispatch (frame, event, arg)

          この関数は、デバッグされているフレームのトレース関数としてイン
          ストールされます。戻り値は新しいトレース関数(殆どの場合はこの
          関数自身)です。

          デフォルトの実装は、実行しようとしている 'event' (文字列として
          渡されます) の種類に基づいてフレームのディスパッチ方法を決定し
          ます。'event' は次のうちのどれかです:

             * ‘"line"’: 新しい行を実行しようとしています。

             * ‘"call"’: 関数が呼び出されているか、別のコードブロックに
               入ります。

             * ‘"return"’: 関数か別のコードブロックからreturnしようとし
               ています。

             * ‘"exception"’: 例外が発生しました。

             * ‘"c_call"’: C関数を呼び出そうとしています。

             * ‘"c_return"’: C関数からreturnしました。

             * ‘"c_exception"’: C関数が例外を発生させました。

          Pythonのイベントに対しては、以下の専用の関数群が呼ばれます。
          Cのイベントに対しては何もしません。

          'arg' 引数は以前のイベントに依存します。

          トレース関数についてのより詳しい情報は、 *note sys.settrace():
          2e1. のドキュメントを参照してください。コードとフレームオブジ
          ェクトについてのより詳しい情報は、 *note 標準型の階層: 232f. を
          参照してください。

      -- メソッド: dispatch_line (frame)

          If the debugger should stop on the current line, invoke the
          *note user_line(): 478b. method (which should be overridden in
          subclasses).  Raise a *note BdbQuit: 278. exception if the
          *note quitting: 4788. flag is set (which can be set from *note
          user_line(): 478b.).  Return a reference to the *note
          trace_dispatch(): 4789. method for further tracing in that
          scope.

      -- メソッド: dispatch_call (frame, arg)

          If the debugger should stop on this function call, invoke the
          *note user_call(): 478d. method (which should be overridden in
          subclasses).  Raise a *note BdbQuit: 278. exception if the
          *note quitting: 4788. flag is set (which can be set from *note
          user_call(): 478d.).  Return a reference to the *note
          trace_dispatch(): 4789. method for further tracing in that
          scope.

      -- メソッド: dispatch_return (frame, arg)

          If the debugger should stop on this function return, invoke
          the *note user_return(): 478f. method (which should be
          overridden in subclasses).  Raise a *note BdbQuit: 278.
          exception if the *note quitting: 4788. flag is set (which can
          be set from *note user_return(): 478f.).  Return a reference
          to the *note trace_dispatch(): 4789. method for further
          tracing in that scope.

      -- メソッド: dispatch_exception (frame, arg)

          If the debugger should stop at this exception, invokes the
          *note user_exception(): 4791. method (which should be
          overridden in subclasses).  Raise a *note BdbQuit: 278.
          exception if the *note quitting: 4788. flag is set (which can
          be set from *note user_exception(): 4791.).  Return a
          reference to the *note trace_dispatch(): 4789. method for
          further tracing in that scope.

     通常、継承クラスは以下のメソッド群をオーバーライドしません。しかし
     、停止やブレークポイント機能を再定義したい場合には、オーバーライド
     することもあります。

      -- メソッド: is_skipped_module (module_name)

          Return ‘True’ if 'module_name' matches any skip pattern.

      -- メソッド: stop_here (frame)

          Return ‘True’ if 'frame' is below the starting frame in the
          stack.

      -- メソッド: break_here (frame)

          Return ‘True’ if there is an effective breakpoint for this
          line.

          Check whether a line or function breakpoint exists and is in
          effect.  Delete temporary breakpoints based on information
          from *note effective(): 4795.

      -- メソッド: break_anywhere (frame)

          Return ‘True’ if any breakpoint exists for 'frame"s filename.

     継承クラスはデバッガー操作をするために以下のメソッド群をオーバーラ
     イドするべきです。

      -- メソッド: user_call (frame, argument_list)

          Called from *note dispatch_call(): 478c. if a break might stop
          inside the called function.

          'argument_list' is not used anymore and will always be ‘None’.
          The argument is kept for backwards compatibility.

      -- メソッド: user_line (frame)

          *note stop_here(): 4793. か *note break_here(): 4794. が
          ‘True’ を返したときに、 *note dispatch_line(): 478a. から呼び
          出されます。

      -- メソッド: user_return (frame, return_value)

          *note stop_here(): 4793. が ‘True’ を返したときに、 *note
          dispatch_return(): 478e. から呼び出されます。

      -- メソッド: user_exception (frame, exc_info)

          *note stop_here(): 4793. が ‘True’ を返したときに、 *note
          dispatch_exception(): 4790. から呼び出されます。

      -- メソッド: do_clear (arg)

          ブレークポイントがテンポラリブレークポイントだったときに、それ
          をどう削除するかを決定します。

          継承クラスはこのメソッドを実装しなければなりません。

     継承クラスとクライアントは、ステップ状態に影響を及ぼすために以下の
     メソッドを呼び出すことができます。

      -- メソッド: set_step ()

          コードの次の行でストップします。

      -- メソッド: set_next (frame)

          与えられたフレームかそれより下(のフレーム)にある、次の行でスト
          ップします。

      -- メソッド: set_return (frame)

          指定されたフレームから抜けるときにストップします。

      -- メソッド: set_until (frame, lineno=None)

          現在の行番号よりも大きい 'lineno' に到達したとき、あるいは、現
          在のフレームから戻るときにストップします。

      -- メソッド: set_trace ([frame])

          'frame' からデバッグを開始します。'frame' が指定されなかった場
          合、デバッグは呼び出し元のフレームから開始します。

          バージョン 3.13 で変更: *note set_trace(): 479d. will enter
          the debugger immediately, rather than on the next line of code
          to be executed.

      -- メソッド: set_continue ()

          ブレークポイントに到達するか終了したときにストップします。もし
          ブレークポイントが1つも無い場合、システムのトレース関数を
          ‘None’ に設定します。

      -- メソッド: set_quit ()

          Set the ‘quitting’ attribute to ‘True’.  This raises *note
          BdbQuit: 278. in the next call to one of the ‘dispatch_*()’
          methods.

     継承クラスとクライアントは以下のメソッドをブレークポイント操作に利
     用できます。これらのメソッドは、何か悪いことがあればエラーメッセー
     ジを含む文字列を返し、すべてが順調であれば ‘None’ を返します。

      -- メソッド: set_break (filename, lineno, temporary=False,
               cond=None, funcname=None)

          新しいブレークポイントを設定します。引数の 'lineno' 行が
          'filename' に存在しない場合、エラーメッセージを返します。
          'filename' は、 *note canonic(): 4784. メソッドで説明されてい
          るような、標準形である必要があります。

      -- メソッド: clear_break (filename, lineno)

          'filename' の 'lineno' 行にあるブレークポイントを削除します。
          もしブレークポイントが無かった場合、エラーメッセージを返します
          。

      -- メソッド: clear_bpbynumber (arg)

          *note Breakpoint.bpbynumber: 4775. の中で 'arg' のインデックス
          を持つブレークポイントを削除します。 'arg' が数値でないか範囲
          外の場合、エラーメッセージを返します。

      -- メソッド: clear_all_file_breaks (filename)

          'filename' にあるすべてのブレークポイントを削除します。もしブ
          レークポイントが無かった場合、エラーメッセージを返します。

      -- メソッド: clear_all_breaks ()

          存在するすべてのブレークポイントを削除します。もしブレークポイ
          ントが無かった場合、エラーメッセージを返します。

      -- メソッド: get_bpbynumber (arg)

          与えられた数値によって指定されるブレークポイントを返します。
          'arg' が文字列なら数値に変換されます。 'arg' が非数値の文字列
          である場合、指定されたブレークポイントが存在しないか削除された
          場合、 *note ValueError: 2ec. が上げられます。

          Added in version 3.2.

      -- メソッド: get_break (filename, lineno)

          Return ‘True’ if there is a breakpoint for 'lineno' in
          'filename'.

      -- メソッド: get_breaks (filename, lineno)

          'filename' の 'lineno' にあるすべてのブレークポイントを返しま
          す。ブレークポイントが存在しない場合は空のリストを返します。

      -- メソッド: get_file_breaks (filename)

          'filename' の中のすべてのブレークポイントを返します。ブレーク
          ポイントが存在しない場合は空のリストを返します。

      -- メソッド: get_all_breaks ()

          セットされているすべてのブレークポイントを返します。

     Derived classes and clients can call the following methods to
     disable and restart events to achieve better performance.  These
     methods only work when using the ‘'monitoring'’ backend.

      -- メソッド: disable_current_event ()

          Disable the current event until the next time *note
          restart_events(): 47aa. is called.  This is helpful when the
          debugger is not interested in the current line.

          Added in version 3.14.

      -- メソッド: restart_events ()

          Restart all the disabled events.  This function is
          automatically called in ‘dispatch_*’ methods after ‘user_*’
          methods are called.  If the ‘dispatch_*’ methods are not
          overridden, the disabled events will be restarted after each
          user interaction.

          Added in version 3.14.

     継承クラスとクライアントは以下のメソッドを呼んでスタックトレースを
     表現するデータ構造を取得することができます。

      -- メソッド: get_stack (f, t)

          Return a list of (frame, lineno) tuples in a stack trace, and
          a size.

          The most recently called frame is last in the list.  The size
          is the number of frames below the frame where the debugger was
          invoked.

      -- メソッド: format_stack_entry (frame_lineno, lprefix=': ')

          Return a string with information about a stack entry, which is
          a ‘(frame, lineno)’ tuple.  The return string contains:

             * The canonical filename which contains the frame.

             * 関数名もしくは ‘"<lambda>"’。

             * 入力された引数。

             * 戻り値。

             * (あれば)その行のコード。

     以下の2つのメソッドは、文字列として渡された *note 文: 2bfc. をデバ
     ッグするもので、クライアントから利用されます。

      -- メソッド: run (cmd, globals=None, locals=None)

          Debug a statement executed via the *note exec(): 4a2.
          function.  'globals' defaults to ‘__main__.__dict__’, 'locals'
          defaults to 'globals'.

      -- メソッド: runeval (expr, globals=None, locals=None)

          *note eval(): 4a3. 関数を利用して式を実行しデバッグします。
          'globals' と 'locals' は *note run(): 47ad. と同じ意味です。

      -- メソッド: runctx (cmd, globals, locals)

          後方互換性のためのメソッドです。 *note run(): 47ad. を使ってく
          ださい。

      -- メソッド: runcall (func, /, *args, **kwds)

          1つの関数呼び出しをデバッグし、その結果を返します。

最後に、このモジュールは以下の関数を提供しています:

 -- の関数: bdb.checkfuncname (b, frame)

     Return ‘True’ if we should break here, depending on the way the
     *note Breakpoint: 4774. 'b' was set.

     If it was set via line number, it checks if *note b.line: 4780. is
     the same as the one in 'frame'.  If the breakpoint was set via
     *note function name: 4778, we have to check we are in the right
     'frame' (the right function) and if we are on its first executable
     line.

 -- の関数: bdb.effective (file, line, frame)

     Return ‘(active breakpoint, delete temporary flag)’ or ‘(None,
     None)’ as the breakpoint to act upon.

     The 'active breakpoint' is the first entry in *note bplist: 4776.
     for the (*note file: 4777, *note line: 4780.) (which must exist)
     that is *note enabled: 4782, for which *note checkfuncname(): 47b0.
     is true, and that has neither a false *note condition: 477a. nor
     positive *note ignore: 4783. count.  The 'flag', meaning that a
     temporary breakpoint should be deleted, is ‘False’ only when the
     *note cond: 477a. cannot be evaluated (in which case, *note ignore:
     4783. count is ignored).

     If no such entry exists, then ‘(None, None)’ is returned.

 -- の関数: bdb.set_trace ()

     *note Bdb: 2d5. クラスのインスタンスを使って、呼び出し元のフレーム
     からデバッグを開始します。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/bdb.py


File: python.info,  Node: faulthandler --- Python トレースバックをダンプする,  Next: pdb --- The Python Debugger,  Prev: bdb --- デバッガーフレームワーク,  Up: デバッグとプロファイル

5.27.3 ‘faulthandler’ -- Python トレースバックをダンプする
----------------------------------------------------------

Added in version 3.3.

__________________________________________________________________

このモジュールは、例外発生時、タイムアウト時、ユーザシグナルの発生時など
のタイミングでpython tracebackを明示的にダンプするための関数を含んでいま
す。これらのシグナル、*note SIGSEGV: 128c.、*note SIGFPE: 128d.、*note
SIGABRT: 128e.、*note SIGBUS: 128f.、*note SIGILL: 1290. に対するフォー
ルトハンドラをインストールするには *note faulthandler.enable(): 20f. を
実行してください。python起動時に有効にするには環境変数 *note
PYTHONFAULTHANDLER: 1291. を設定するか、コマンドライン引数に *note -X:
16f. ‘faulthandler’ を指定してください。

Pythonのフォールトハンドラは、apportやWindowsのフォールトハンドラのよう
なシステムフォールトハンドラと互換性があります。このモジュールは
‘sigaltstack()’ 関数が使用可能であればシグナルハンドラ用に代替スタックを
利用します。これによってスタックオーバーフロー時にもトレースバックを出力
することができます。

フォールトハンドラは絶望的なケースで呼び出されます。そのためシグナルセー
フな関数しか使うことができません (例: ヒープメモリ上にメモリ確保はできま
せん)。この制限により、tracebackのダンプ機能は通常のPythonのtracebackと
比べてごく僅かなものです:

   * ASCIIのみサポートされます。エンコード時には ‘backslashreplace’ エラ
     ーハンドラを使用します。

   * すべての文字列は500文字以内に制限されています。

   * ファイル名、関数名、行数のみ表示します。(ソースコードの表示はありま
     せん)

   * 100フレーム、100スレッドに制限されています。

   * 順番は保持されます: 最新の呼び出しが最初に表示されます。

デフォルトでは、Pythonのtracebackは *note sys.stderr: b33. に書き出され
ます。tracebackを見るには、対象アプリケーションはターミナル上で実行しな
ければなりません。 *note faulthandler.enable(): 20f. に渡す引数によって
ログファイルを指定することができます。

モジュールはC言語で実装されているので、アプリのクラッシュ時でもPythonが
デッドロックした場合でもダンプができます。

The *note Python Development Mode: 508. calls *note
faulthandler.enable(): 20f. at Python startup.

参考
....

*note pdb: aa. モジュール

     Interactive source code debugger for Python programs.

*note traceback: 104. モジュール

     Standard interface to extract, format and print stack traces of
     Python programs.

* Menu:

* tracebackのダンプ::
* Dumping the C stack::
* フォールトハンドラの状態::
* タイムアウト後にtracebackをダンプする::
* ユーザシグナルに対してtracebackをダンプする::
* ファイル記述子の問題::
* 使用例: 使用例<43>.


File: python.info,  Node: tracebackのダンプ,  Next: Dumping the C stack,  Up: faulthandler --- Python トレースバックをダンプする

5.27.3.1 tracebackのダンプ
..........................

 -- の関数: faulthandler.dump_traceback (file=sys.stderr,
          all_threads=True)

     全スレッドのtracebackを 'file' へダンプします。もし 'all_threads' が
     ‘False’ であれば、現在のスレッドのみダンプします。

     参考
     ....

     *note traceback.print_tb(): 1085, which can be used to print a
     traceback object.

     バージョン 3.5 で変更: Added support for passing file descriptor to
     this function.


File: python.info,  Node: Dumping the C stack,  Next: フォールトハンドラの状態,  Prev: tracebackのダンプ,  Up: faulthandler --- Python トレースバックをダンプする

5.27.3.2 Dumping the C stack
............................

Added in version 3.14.

 -- の関数: faulthandler.dump_c_stack (file=sys.stderr)

     Dump the C stack trace of the current thread into 'file'.

     If the Python build does not support it or the operating system
     does not provide a stack trace, then this prints an error in place
     of a dumped C stack.

* Menu:

* C Stack Compatibility::


File: python.info,  Node: C Stack Compatibility,  Up: Dumping the C stack

5.27.3.3 C Stack Compatibility
..............................

If the system does not support the C-level ‘backtrace(3)(1)’ or
‘dladdr1(3)(2)’, then C stack dumps will not work.  An error will be
printed instead of the stack.

Additionally, some compilers do not support *note CPython's: 905.
implementation of C stack dumps.  As a result, a different error may be
printed instead of the stack, even if the operating system supports
dumping stacks.

     注釈: Dumping C stacks can be arbitrarily slow, depending on the
     DWARF level of the binaries in the call stack.

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/backtrace(3)

   (2) https://manpages.debian.org/dladdr1(3)


File: python.info,  Node: フォールトハンドラの状態,  Next: タイムアウト後にtracebackをダンプする,  Prev: Dumping the C stack,  Up: faulthandler --- Python トレースバックをダンプする

5.27.3.4 フォールトハンドラの状態
.................................

 -- の関数: faulthandler.enable (file=sys.stderr, all_threads=True,
          c_stack=True)

     Enable the fault handler: install handlers for the *note SIGSEGV:
     128c, *note SIGFPE: 128d, *note SIGABRT: 128e, *note SIGBUS: 128f.
     and *note SIGILL: 1290. signals to dump the Python traceback.  If
     'all_threads' is ‘True’, produce tracebacks for every running
     thread.  Otherwise, dump only the current thread.

     The 'file' must be kept open until the fault handler is disabled:
     see *note issue with file descriptors: 47b8.

     If 'c_stack' is ‘True’, then the C stack trace is printed after the
     Python traceback, unless the system does not support it.  See *note
     dump_c_stack(): 20e. for more information on compatibility.

     バージョン 3.5 で変更: Added support for passing file descriptor to
     this function.

     バージョン 3.6 で変更: On Windows, a handler for Windows exception
     is also installed.

     バージョン 3.10 で変更: The dump now mentions if a garbage
     collector collection is running if 'all_threads' is true.

     バージョン 3.14 で変更: Only the current thread is dumped if the
     *note GIL: 164. is disabled to prevent the risk of data races.

     バージョン 3.14 で変更: The dump now displays the C stack trace if
     'c_stack' is true.

 -- の関数: faulthandler.disable ()

     フォールトハンドラを無効にします: *note enable(): 20f. によってイン
     ストールされたシグナルハンドラをアンインストールします。

 -- の関数: faulthandler.is_enabled ()

     フォールトハンドラが有効かどうかチェックします。


File: python.info,  Node: タイムアウト後にtracebackをダンプする,  Next: ユーザシグナルに対してtracebackをダンプする,  Prev: フォールトハンドラの状態,  Up: faulthandler --- Python トレースバックをダンプする

5.27.3.5 タイムアウト後にtracebackをダンプする
..............................................

 -- の関数: faulthandler.dump_traceback_later (timeout, repeat=False,
          file=sys.stderr, exit=False)

     Dump the tracebacks of all threads, after a timeout of 'timeout'
     seconds, or every 'timeout' seconds if 'repeat' is ‘True’.  If
     'exit' is ‘True’, call ‘_exit()’ with status=1 after dumping the
     tracebacks.  (Note ‘_exit()’ exits the process immediately, which
     means it doesn't do any cleanup like flushing file buffers.)  If
     the function is called twice, the new call replaces previous
     parameters and resets the timeout.  The timer has a sub-second
     resolution.

     The 'file' must be kept open until the traceback is dumped or *note
     cancel_dump_traceback_later(): 47bc. is called: see *note issue
     with file descriptors: 47b8.

     This function is implemented using a watchdog thread.

     バージョン 3.5 で変更: Added support for passing file descriptor to
     this function.

     バージョン 3.7 で変更: This function is now always available.

 -- の関数: faulthandler.cancel_dump_traceback_later ()

     *note dump_traceback_later(): 1000. の最新の呼び出しをキャンセルし
     ます。


File: python.info,  Node: ユーザシグナルに対してtracebackをダンプする,  Next: ファイル記述子の問題,  Prev: タイムアウト後にtracebackをダンプする,  Up: faulthandler --- Python トレースバックをダンプする

5.27.3.6 ユーザシグナルに対してtracebackをダンプする
....................................................

 -- の関数: faulthandler.register (signum, file=sys.stderr,
          all_threads=True, chain=False)

     ユーザシグナルを登録します: すべてのスレッドでtracebackをダンプする
     ために 'signum' シグナルをインストールします。ただし 'all_threads'
     が ‘False’ であれば現在のスレッドのみ 'file' にダンプします。もし
     chain が ‘True’ であれば以前のハンドラも呼び出します。

     The 'file' must be kept open until the signal is unregistered by
     *note unregister(): 47be.: see *note issue with file descriptors:
     47b8.

     Windowsでは利用不可です。

     バージョン 3.5 で変更: Added support for passing file descriptor to
     this function.

 -- の関数: faulthandler.unregister (signum)

     ユーザシグナルを登録解除します: *note register(): ffe. でインストー
     ルした 'signum' シグナルハンドラをアンインストールします。シグナル
     が登録された場合は ‘True’ を返し、そうでなければ ‘False’ を返します
     。

     Windowsでは利用不可です。


File: python.info,  Node: ファイル記述子の問題,  Next: 使用例<43>,  Prev: ユーザシグナルに対してtracebackをダンプする,  Up: faulthandler --- Python トレースバックをダンプする

5.27.3.7 ファイル記述子の問題
.............................

*note enable(): 20f.、*note dump_traceback_later(): 1000. ならびに *note
register(): ffe. は引数 'file' に渡されたファイル記述子を保持します。フ
ァイルが閉じられファイル記述子が新しいファイルで再利用された場合や、
*note os.dup2(): d5a. の使用でファイル記述子が置き換えた場合、 traceback
の結果は別のファイルへ書き込まれます。ファイルが置き換えられた場合は、毎
回これらの関数を呼び出しなおしてください。


File: python.info,  Node: 使用例<43>,  Prev: ファイル記述子の問題,  Up: faulthandler --- Python トレースバックをダンプする

5.27.3.8 使用例
...............

フォールトハンドラを有効化・無効化したときの Linuxでのセグメンテーション
フォールトの例:

     $ python -c "import ctypes; ctypes.string_at(0)"
     Segmentation fault

     $ python -q -X faulthandler
     >>> import ctypes
     >>> ctypes.string_at(0)
     Fatal Python error: Segmentation fault

     Current thread 0x00007fb899f39700 (most recent call first):
       File "/opt/python/Lib/ctypes/__init__.py", line 486 in string_at
       File "<stdin>", line 1 in <module>

     Current thread's C stack trace (most recent call first):
       Binary file "/opt/python/python", at _Py_DumpStack+0x42 [0x5b27f7d7147e]
       Binary file "/opt/python/python", at +0x32dcbd [0x5b27f7d85cbd]
       Binary file "/opt/python/python", at +0x32df8a [0x5b27f7d85f8a]
       Binary file "/usr/lib/libc.so.6", at +0x3def0 [0x77b73226bef0]
       Binary file "/usr/lib/libc.so.6", at +0x17ef9c [0x77b7323acf9c]
       Binary file "/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-x86_64-linux-gnu.so", at +0xcdf6 [0x77b7315dddf6]
       Binary file "/usr/lib/libffi.so.8", at +0x7976 [0x77b73158f976]
       Binary file "/usr/lib/libffi.so.8", at +0x413c [0x77b73158c13c]
       Binary file "/usr/lib/libffi.so.8", at ffi_call+0x12e [0x77b73158ef0e]
       Binary file "/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-x86_64-linux-gnu.so", at +0x15a33 [0x77b7315e6a33]
       Binary file "/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-x86_64-linux-gnu.so", at +0x164fa [0x77b7315e74fa]
       Binary file "/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-x86_64-linux-gnu.so", at +0xc624 [0x77b7315dd624]
       Binary file "/opt/python/python", at _PyObject_MakeTpCall+0xce [0x5b27f7b73883]
       Binary file "/opt/python/python", at +0x11bab6 [0x5b27f7b73ab6]
       Binary file "/opt/python/python", at PyObject_Vectorcall+0x23 [0x5b27f7b73b04]
       Binary file "/opt/python/python", at _PyEval_EvalFrameDefault+0x490c [0x5b27f7cbb302]
       Binary file "/opt/python/python", at +0x2818e6 [0x5b27f7cd98e6]
       Binary file "/opt/python/python", at +0x281aab [0x5b27f7cd9aab]
       Binary file "/opt/python/python", at PyEval_EvalCode+0xc5 [0x5b27f7cd9ba3]
       Binary file "/opt/python/python", at +0x255957 [0x5b27f7cad957]
       Binary file "/opt/python/python", at +0x255ab4 [0x5b27f7cadab4]
       Binary file "/opt/python/python", at _PyEval_EvalFrameDefault+0x6c3e [0x5b27f7cbd634]
       Binary file "/opt/python/python", at +0x2818e6 [0x5b27f7cd98e6]
       Binary file "/opt/python/python", at +0x281aab [0x5b27f7cd9aab]
       Binary file "/opt/python/python", at +0x11b6e1 [0x5b27f7b736e1]
       Binary file "/opt/python/python", at +0x11d348 [0x5b27f7b75348]
       Binary file "/opt/python/python", at +0x11d626 [0x5b27f7b75626]
       Binary file "/opt/python/python", at PyObject_Call+0x20 [0x5b27f7b7565e]
       Binary file "/opt/python/python", at +0x32a67a [0x5b27f7d8267a]
       Binary file "/opt/python/python", at +0x32a7f8 [0x5b27f7d827f8]
       Binary file "/opt/python/python", at +0x32ac1b [0x5b27f7d82c1b]
       Binary file "/opt/python/python", at Py_RunMain+0x31 [0x5b27f7d82ebe]
       <truncated rest of calls>
     Segmentation fault


File: python.info,  Node: pdb --- The Python Debugger,  Next: Python プロファイラ,  Prev: faulthandler --- Python トレースバックをダンプする,  Up: デバッグとプロファイル

5.27.4 ‘pdb’ -- The Python Debugger
-----------------------------------

'ソースコード:' Lib/pdb.py(1)

__________________________________________________________________

The module ‘pdb’ defines an interactive source code debugger for Python
programs.  It supports setting (conditional) breakpoints and single
stepping at the source line level, inspection of stack frames, source
code listing, and evaluation of arbitrary Python code in the context of
any stack frame.  It also supports post-mortem debugging and can be
called under program control.

デバッガーは拡張可能です - 実際にはクラス *note Pdb: 273. として定義され
ています。現在これについてのドキュメントはありませんが、ソースを読めば簡
単に理解できます。拡張インターフェースはモジュール *note bdb: 10. と
*note cmd: 1a. を使っています。

参考
....

*note faulthandler: 5c. モジュール

     Used to dump Python tracebacks explicitly, on a fault, after a
     timeout, or on a user signal.

*note traceback: 104. モジュール

     Standard interface to extract, format and print stack traces of
     Python programs.

The typical usage to break into the debugger is to insert:

     import pdb; pdb.set_trace()

もしくは:

     breakpoint()

at the location you want to break into the debugger, and then run the
program.  You can then step through the code following this statement,
and continue running without the debugger using the *note continue:
47c5. command.

バージョン 3.7 で変更: The built-in *note breakpoint(): 271, when called
with defaults, can be used instead of ‘import pdb; pdb.set_trace()’.

     def double(x):
        breakpoint()
        return x * 2
     val = 3
     print(f"{val} * 2 is {double(val)}")

The debugger's prompt is ‘(Pdb)’, which is the indicator that you are in
debug mode:

     > ...(2)double()
     -> breakpoint()
     (Pdb) p x
     3
     (Pdb) continue
     3 * 2 is 6

バージョン 3.3 で変更: *note readline: bf. モジュールによるコマンドおよ
びコマンド引数のタブ補完が利用できます。たとえば、‘p’ コマンドの引数では
現在のグローバルおよびローカル名が候補として表示されます。

* Menu:

* コマンドライン・インターフェース: コマンドライン・インターフェース<8>.
* Debugger commands::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/pdb.py


File: python.info,  Node: コマンドライン・インターフェース<8>,  Next: Debugger commands,  Up: pdb --- The Python Debugger

5.27.4.1 コマンドライン・インターフェース
.........................................

You can also invoke ‘pdb’ from the command line to debug other scripts.
For example:

     python -m pdb [-c command] (-m module | -p pid | pyfile) [args ...]

モジュールとして pdb を起動すると、デバッグ中のプログラムが異常終了した
ときに pdb が自動的に事後デバッグモードに入ります。事後デバッグ後 (また
はプログラムの正常終了後)、pdb はプログラムを再起動します。自動再起動を
行った場合、pdb の状態 (ブレークポイントなど) はそのまま維持されるので、
たいていの場合、プログラム終了時にデバッガーも終了させるよりも便利なはず
です。

 -- Option: -c, --command <command>

     To execute commands as if given in a ‘.pdbrc’ file; see *note
     Debugger commands: 47c9.

     バージョン 3.2 で変更: ‘-c’ オプションが追加されました。

 -- Option: -m <module>

     To execute modules similar to the way ‘python -m’ does.  As with a
     script, the debugger will pause execution just before the first
     line of the module.

     バージョン 3.7 で変更: ‘-m’ オプションが追加されました。

 -- Option: -p, --pid <pid>

     Attach to the process with the specified PID.

     Added in version 3.14.

To attach to a running Python process for remote debugging, use the ‘-p’
or ‘--pid’ option with the target process's PID:

     python -m pdb -p 1234

     注釈: Attaching to a process that is blocked in a system call or
     waiting for I/O will only work once the next bytecode instruction
     is executed or when the process receives a signal.

Typical usage to execute a statement under control of the debugger is:

     >>> import pdb
     >>> def f(x):
     ...     print(1 / x)
     >>> pdb.run("f(2)")
     > <string>(1)<module>()
     (Pdb) continue
     0.5
     >>>

クラッシュしたプログラムを調べるための典型的な使い方は以下のようになりま
す:

     >>> import pdb
     >>> def f(x):
     ...     print(1 / x)
     ...
     >>> f(0)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
       File "<stdin>", line 2, in f
     ZeroDivisionError: division by zero
     >>> pdb.pm()
     > <stdin>(2)f()
     (Pdb) p x
     0
     (Pdb)

バージョン 3.13 で変更: The implementation of PEP 667(1) means that name
assignments made via ‘pdb’ will immediately affect the active scope,
even when running inside an *note optimized scope: 4a1.

このモジュールは以下の関数を定義しています。それぞれが少しづつ違った方法
でデバッガに入ります:

 -- の関数: pdb.run (statement, globals=None, locals=None)

     デバッガーに制御された状態で (文字列またはコードオブジェクトとして
     与えられた) 'statement' を実行します。あらゆるコードが実行される前
     にデバッガープロンプトが現れます。ブレークポイントを設定し、*note
     continue: 47c5. とタイプできます。あるいは、文を *note step: 47cc.
     や *note next: 47cd. を使って一つづつ実行することができます (これら
     のコマンドはすべて下で説明します)。オプションの 'globals' と
     'locals' 引数はコードを実行する環境を指定します。デフォルトでは、モ
     ジュール *note __main__: 1. の辞書が使われます。(組み込み関数 *note
     exec(): 4a2. または *note eval(): 4a3. の説明を参照してください。)

 -- の関数: pdb.runeval (expression, globals=None, locals=None)

     デバッガーに制御された状態で (文字列またはコードオブジェクトとして
     与えられる) 'expression' を評価します。*note runeval(): 47ce. から
     復帰するとき、式の値を返します。その他の点では、この関数は *note
     run(): 45bc. と同様です。

 -- の関数: pdb.runcall (function, *args, **kwds)

     'function' (関数またはメソッドオブジェクト、文字列ではありません) を
     与えられた引数とともに呼び出します。 *note runcall(): 47cf. から復
     帰するとき、関数呼び出しが返したものはなんでも返します。関数に入る
     とすぐにデバッガプロンプトが現れます。

 -- の関数: pdb.set_trace (*, header=None, commands=None)

     Enter the debugger at the calling stack frame.  This is useful to
     hard-code a breakpoint at a given point in a program, even if the
     code is not otherwise being debugged (e.g.  when an assertion
     fails).  If given, 'header' is printed to the console just before
     debugging begins.  The 'commands' argument, if given, is a list of
     commands to execute when the debugger starts.

     バージョン 3.7 で変更: 'header' キーワード専用引数。

     バージョン 3.13 で変更: *note set_trace(): 272. will enter the
     debugger immediately, rather than on the next line of code to be
     executed.

     Added in version 3.14: The 'commands' argument.

 -- の関数: awaitable pdb.set_trace_async (*, header=None,
          commands=None)

     async version of *note set_trace(): 272.  This function should be
     used inside an async function with *note await: 18d.

          async def f():
              await pdb.set_trace_async()

     *note await: 18d. statements are supported if the debugger is
     invoked by this function.

     Added in version 3.14.

 -- の関数: pdb.post_mortem (t=None)

     Enter post-mortem debugging of the given exception or *note
     traceback object: cec.  If no value is given, it uses the exception
     that is currently being handled, or raises ‘ValueError’ if there
     isn’t one.

     バージョン 3.13 で変更: 例外オブジェクトのサポートが追加されました
     。

 -- の関数: pdb.pm ()

     Enter post-mortem debugging of the exception found in *note
     sys.last_exc: 6e5.

 -- の関数: pdb.set_default_backend (backend)

     There are two supported backends for pdb: ‘'settrace'’ and
     ‘'monitoring'’.  See *note bdb.Bdb: 2d5. for details.  The user can
     set the default backend to use if none is specified when
     instantiating *note Pdb: 273.  If no backend is specified, the
     default is ‘'settrace'’.

          注釈: *note breakpoint(): 271. and *note set_trace(): 272.
          will not be affected by this function.  They always use
          ‘'monitoring'’ backend.

     Added in version 3.14.

 -- の関数: pdb.get_default_backend ()

     Returns the default backend for pdb.

     Added in version 3.14.

‘run*’ 関数と *note set_trace(): 272. は、 *note Pdb: 273. クラスをイン
スタンス化して同名のメソッドを実行することのエイリアス関数です。それ以上
の機能を利用したい場合は、インスタンス化を自分で行わなければなりません:

 -- クラス: pdb.Pdb (completekey='tab', stdin=None, stdout=None,
          skip=None, nosigint=False, readrc=True, mode=None,
          backend=None, colorize=False)

     *note Pdb: 273. はデバッガクラスです。

     'completekey', 'stdin', 'stdout' 引数は、基底にある *note cmd.Cmd:
     184e. クラスに渡されます。そちらの解説を参照してください。

     'skip' 引数が指定された場合、 glob スタイルのモジュール名パターンの
     iterable (イテレート可能オブジェクト) でなければなりません。デバッ
     ガはこのパターンのどれかにマッチするモジュールに属するフレームには
     ステップインしません。 (2)

     デフォルトでは、Pdb は *note continue: 47c5. コマンドが投入されると
     、(ユーザーがコンソールから ‘Ctrl’-‘C’ を押したときに送られる)
     SIGINT シグナル用ハンドラーを設定します。これにより ‘Ctrl’-‘C’ を押
     すことで再度デバッガーを起動することができます。Pdb に SIGINT ハン
     ドラーを変更させたくない場合は 'nosigint' を true に設定してくださ
     い。

     'readrc' 引数はデフォルトでは真で、 Pdb が .pdbrc ファイルをファイ
     ルシステムから読み込むかどうかを制御します。

     The 'mode' argument specifies how the debugger was invoked.  It
     impacts the workings of some debugger commands.  Valid values are
     ‘'inline'’ (used by the breakpoint() builtin), ‘'cli'’ (used by the
     command line invocation) or ‘None’ (for backwards compatible
     behaviour, as before the 'mode' argument was added).

     The 'backend' argument specifies the backend to use for the
     debugger.  If ‘None’ is passed, the default backend will be used.
     See *note set_default_backend(): 47d0.  Otherwise the supported
     backends are ‘'settrace'’ and ‘'monitoring'’.

     The 'colorize' argument, if set to ‘True’, will enable colorized
     output in the debugger, if color is supported.  This will highlight
     source code displayed in pdb.

     'skip' を使ってトレースする呼び出しの例:

          import pdb; pdb.Pdb(skip=['django.*']).set_trace()

     引数無しで *note 監査イベント: 1c6e. ‘pdb.Pdb’ を送出します。

     バージョン 3.1 で変更: 'skip' パラメータが追加されました。

     バージョン 3.2 で変更: Added the 'nosigint' parameter.  Previously,
     a SIGINT handler was never set by Pdb.

     バージョン 3.6 で変更: 'readrc' 引数。

     Added in version 3.14: 'mode' 引数が追加されました。

     Added in version 3.14: 'backend' 引数が追加されました。

     Added in version 3.14: 'colorize' 引数が追加されました。

     バージョン 3.14 で変更: Inline breakpoints like *note breakpoint():
     271. or *note pdb.set_trace(): 272. will always stop the program at
     calling frame, ignoring the 'skip' pattern (if any).

      -- メソッド: run (statement, globals=None, locals=None)
      -- メソッド: runeval (expression, globals=None, locals=None)
      -- メソッド: runcall (function, *args, **kwds)
      -- メソッド: set_trace ()

          前述のこれら関数のドキュメントを参照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0667/

   (2) フレームが属するモジュールは、そのフレームのグローバルの
‘__name__’ によって決定されます。


File: python.info,  Node: Debugger commands,  Prev: コマンドライン・インターフェース<8>,  Up: pdb --- The Python Debugger

5.27.4.2 Debugger commands
..........................

デバッガーに認識されるコマンドは以下に一覧されています。たいていのコマン
ドは以下のように 1、2 文字に省略できます。例えば ‘h(elp)’ は ‘h’ か
‘help’ がで help コマンドを呼び出すことを意味します (ただし ‘he’, ‘hel’,
‘H’, ‘Help’, ‘HELP’ は使用できません)。コマンドの引数はホワイトスペース
(スペースかタブ) で区切ってください。コマンド構文として任意の引数は大括
弧 (‘[]’) で括られています (実際に大括弧はタイプしないでください)。いく
つかから選択できる引数は縦線 (‘|’) で分割されて記述されています。

空行を入力すると入力された直前のコマンドを繰り返します。例外: 直前のコマ
ンドが *note list: 47d6. コマンドならば、次の 11 行がリストされます。

デバッガが認識しないコマンドは Python 文とみなして、デバッグしているプロ
グラムのコンテキストおいて実行されます。先頭にに感嘆符 (‘!’) を付けるこ
とで Python 文であると明示することもできます。これはデバッグ中のプログラ
ムを調査する強力な方法です。変数を変更したり関数を呼び出したりすることも
可能です。このような文で例外が発生した場合には例外名が出力されますが、デ
バッガの状態は変化しません。

バージョン 3.13 で変更: Expressions/Statements whose prefix is a pdb
command are now correctly identified and executed.

デバッガーは *note エイリアス: 47d7. をサポートしています。エイリアスは
デバッグ中のコンテキストに適用可能な一定レベルのパラメータを保持すること
ができます。

Multiple commands may be entered on a single line, separated by ‘;;’.
(A single ‘;’ is not used as it is the separator for multiple commands
in a line that is passed to the Python parser.)  No intelligence is
applied to separating the commands; the input is split at the first ‘;;’
pair, even if it is in the middle of a quoted string.  A workaround for
strings with double semicolons is to use implicit string concatenation
‘';'';'’ or ‘";"";"’.

To set a temporary global variable, use a 'convenience variable'.  A
'convenience variable' is a variable whose name starts with ‘$’.  For
example, ‘$foo = 1’ sets a global variable ‘$foo’ which you can use in
the debugger session.  The 'convenience variables' are cleared when the
program resumes execution so it's less likely to interfere with your
program compared to using normal variables like ‘foo = 1’.

There are four preset 'convenience variables':

   * ‘$_frame’: the current frame you are debugging

   * ‘$_retval’: the return value if the frame is returning

   * ‘$_exception’: the exception if the frame is raising an exception

   * ‘$_asynctask’: the asyncio task if pdb stops in an async function

Added in version 3.12: Added the 'convenience variable' feature.

Added in version 3.14: Added the ‘$_asynctask’ convenience variable.

If a file ‘.pdbrc’ exists in the user's home directory or in the current
directory, it is read with ‘'utf-8'’ encoding and executed as if it had
been typed at the debugger prompt, with the exception that empty lines
and lines starting with ‘#’ are ignored.  This is particularly useful
for aliases.  If both files exist, the one in the home directory is read
first and aliases defined there can be overridden by the local file.

バージョン 3.2 で変更: ‘.pdbrc’ に *note continue: 47c5. や *note next:
47cd. のようなデバッグを続行するコマンドが使用できるようになりました。以
前はこのようなコマンドは無視されていました。

バージョン 3.11 で変更: ‘.pdbrc’ is now read with ‘'utf-8'’ encoding.
Previously, it was read with the system locale encoding.

 -- Pdbcommand: h(elp) [command]

     引数を指定しない場合、利用できるコマンドの一覧が表示されます。引数
     として 'command' が与えられた場合、そのコマンドのヘルプが表示されま
     す。‘help pdb’ で完全なドキュメント (*note pdb: aa. モジュールの
     doctring) が表示されます。'command' 引数は識別子でなければならない
     ため、‘!’ コマンドのヘルプを表示するには ‘help exec’ と入力します。

 -- Pdbcommand: w(here) [count]

     Print a stack trace, with the most recent frame at the bottom.  if
     'count' is 0, print the current frame entry.  If 'count' is
     negative, print the least recent - 'count' frames.  If 'count' is
     positive, print the most recent 'count' frames.  An arrow (‘>’)
     indicates the current frame, which determines the context of most
     commands.

     バージョン 3.14 で変更: 'count' argument is added.

 -- Pdbcommand: d(own) [count]

     スタックフレーム内で現在のフレームを 'count' レベル (デフォルトは
     1) 新しいフレーム方向に移動します。

 -- Pdbcommand: u(p) [count]

     スタックフレーム内で現在のフレームを 'count' レベル (デフォルトは
     1) 古いフレーム方向に移動します。

 -- Pdbcommand: b(reak) [([filename:]lineno | function) [, condition]]

     With a 'lineno' argument, set a break at line 'lineno' in the
     current file.  The line number may be prefixed with a 'filename'
     and a colon, to specify a breakpoint in another file (possibly one
     that hasn't been loaded yet).  The file is searched on *note
     sys.path: 3e4.  Acceptable forms of 'filename' are
     ‘/abspath/to/file.py’, ‘relpath/file.py’, ‘module’ and
     ‘package.module’.

     With a 'function' argument, set a break at the first executable
     statement within that function.  'function' can be any expression
     that evaluates to a function in the current namespace.

     第二引数を指定する場合、その値は式で、その評価値が真でなければブレ
     ークポイントは有効になりません。

     引数なしの場合は、それぞれのブレークポイントに対して、そのブレーク
     ポイントに行き当たった回数、現在の通過カウント ( ignore count ) と
     、もしあれば関連条件を含めてすべてのブレークポイントをリストします
     。

     Each breakpoint is assigned a number to which all the other
     breakpoint commands refer.

 -- Pdbcommand: tbreak [([filename:]lineno | function) [, condition]]

     一時的なブレークポイントで、最初にそこに達したときに自動的に取り除
     かれます。引数は *note break: 47dc. と同じです。

 -- Pdbcommand: cl(ear) [filename:lineno | bpnumber ...]

     'filename:lineno' 引数を与えると、その行にある全てのブレークポイン
     トを解除します。スペースで区切られたブレークポイントナンバーのリス
     トを与えると、それらのブレークポイントを解除します。引数なしの場合
     は、すべてのブレークポイントを解除します ( が、はじめに確認します )
     。

 -- Pdbcommand: disable bpnumber [bpnumber ...]

     ブレークポイント番号 'bpnumber' のブレークポイントを無効にします。
     ブレークポイントを無効にすると、プログラムの実行を止めることができ
     なくなりますが、ブレークポイントの解除と違いブレークポイントのリス
     トに残っており、(再び) 有効にできます。

 -- Pdbcommand: enable bpnumber [bpnumber ...]

     指定したブレークポイントを有効にします。

 -- Pdbcommand: ignore bpnumber [count]

     与えられたブレークポイントナンバーに通過カウントを設定します。count
     が省略されると、通過カウントは 0 に設定されます。通過カウントがゼロ
     になったとき、ブレークポイントが機能する状態になります。ゼロでない
     ときは、そのブレークポイントが無効にされず、どんな関連条件も真に評
     価されていて、ブレークポイントに来るたびに 'count' が減らされます。

 -- Pdbcommand: condition bpnumber [condition]

     ブレークポイントに新しい 'condition' を設定します。'condition' はブ
     レークポイントを制御する条件式で、この式が真を返す場合のみブレーク
     ポイントが有効になります。'condition' を指定しないと既存の条件が除
     去されます; ブレークポイントは常に有効になります。

 -- Pdbcommand: commands [bpnumber]

     ブレークポイントナンバー 'bpnumber' にコマンドのリストを指定します
     。コマンドそのものはその後の行に続けます。‘end’ だけからなる行を入
     力することでコマンド群の終わりを示します。例を挙げます:

          (Pdb) commands 1
          (com) p some_variable
          (com) end
          (Pdb)

     ブレークポイントからコマンドを取り除くには、 ‘commands’ のあとに
     ‘end’ だけを続けます。つまり、コマンドを一つも指定しないようにしま
     す。

     'bpnumber' 引数を指定しない場合、‘commands’ は最後にセットしたブレ
     ークポイントを参照します。

     ブレークポイントコマンドはプログラムを走らせ直すのに使えます。単に
     *note continue: 47c5. コマンドや *note step: 47cc.、その他実行を再
     開するコマンドを使えば良いのです。

     Specifying any command resuming execution (currently *note
     continue: 47c5, *note step: 47cc, *note next: 47cd, *note return:
     47e3, *note until: 47e4, *note jump: 47e5, *note quit: 47e6. and
     their abbreviations) terminates the command list (as if that
     command was immediately followed by end).  This is because any time
     you resume execution (even with a simple next or step), you may
     encounter another breakpoint—which could have its own command list,
     leading to ambiguities about which list to execute.

     If the list of commands contains the ‘silent’ command, or a command
     that resumes execution, then the breakpoint message containing
     information about the frame is not displayed.

     バージョン 3.14 で変更: Frame information will not be displayed if
     a command that resumes execution is present in the command list.

 -- Pdbcommand: s(tep)

     現在の行を実行し、最初に実行可能なものがあらわれたときに (呼び出さ
     れた関数の中か、現在の関数の次の行で) 停止します。

 -- Pdbcommand: n(ext)

     現在の関数の次の行に達するか、あるいは関数が返るまで実行を継続しま
     す。 (*note next: 47cd. と *note step: 47cc. の差は *note step:
     47cc. が呼び出された関数の内部で停止するのに対し、 *note next:
     47cd. は呼び出された関数を (ほぼ) 全速力で実行し、現在の関数内の次
     の行で停止するだけです。)

 -- Pdbcommand: unt(il) [lineno]

     引数なしだと、現在の行から 1 行先まで実行します。

     'lineno' を指定すると、番号が 'lineno' 以上である行に到達するまで実
     行します。どちらにしても現在のフレームが返ってきた時点で停止します
     。

     バージョン 3.2 で変更: 明示的に行数指定ができるようになりました。

 -- Pdbcommand: r(eturn)

     現在の関数が返るまで実行を継続します。

 -- Pdbcommand: c(ont(inue))

     ブレークポイントに出会うまで、実行を継続します。

 -- Pdbcommand: j(ump) lineno

     次に実行する行を指定します。最も底のフレーム中でのみ実行可能です。
     前に戻って実行したり、不要な部分をスキップして先の処理を実行する場
     合に使用します。

     ジャンプには制限があり、例えば *note for: 34a. ループの中には飛び込
     めませんし、 *note finally: 1b0. 節の外にも飛ぶ事ができません。

 -- Pdbcommand: l(ist) [first[, last]]

     現在のファイルのソースコードを表示します。引数を指定しないと、現在
     の行の前後 11 行分を表示するか、直前の表示を続行します。引数に ‘.’
     を指定すると、現在の行の前後 11 行分を表示します。数値を 1 個指定す
     ると、その行番号の前後 11 行分を表示します。数値を 2 個指定すると、
     開始行と最終行として表示します; 2 個めの引数が 1 個め未満だった場合
     、1 個目を開始行、2 個めを開始行からの行数とみなします。

     現在のフレーム内の現在の行は ‘->’ で表示されます。例外をデバッグ中
     の場合、例外が発生または伝搬した行は、それが現在の行とは異なるとき
     ‘>>’ で表示されます。

     バージョン 3.2 で変更: ‘>>’ マーカーが追加されました。

 -- Pdbcommand: ll | longlist

     現在の関数またはフレームの全ソースコードを表示します。注目する行は
     *note list: 47d6. と同じようにマーカーがつきます。

     Added in version 3.2.

 -- Pdbcommand: a(rgs)

     Print the arguments of the current function and their current
     values.

 -- Pdbcommand: p expression

     現在のコンテキストにおいて 'expression' を評価し、その値をプリント
     します。

          注釈: ‘print()’ も使えますが、これはデバッガーコマンドではあり
          ません -- これは Python の関数 *note print(): 1177. が実行され
          ます。

 -- Pdbcommand: pp expression

     *note p: 1178. コマンドに似ていますが、'expression' の値以外は
     *note pprint: b3. モジュールを使用して "pretty-print" されます。

 -- Pdbcommand: whatis expression

     'expression' の型を表示します。

 -- Pdbcommand: source expression

     'expression' のソースコードの取得を試み、可能であれば表示します。

     Added in version 3.2.

 -- Pdbcommand: display [expression]

     'expression' の値が変更されていれば表示します。毎回実行は現在のフレ
     ームで停止します。

     'expression' を指定しない場合、現在のフレームのすべての式を表示しま
     す。

          注釈: Display evaluates 'expression' and compares to the
          result of the previous evaluation of 'expression', so when the
          result is mutable, display may not be able to pick up the
          changes.

     以下はプログラム例です:

          lst = []
          breakpoint()
          pass
          lst.append(1)
          print(lst)

     Display won't realize ‘lst’ has been changed because the result of
     evaluation is modified in place by ‘lst.append(1)’ before being
     compared:

          > example.py(3)<module>()
          -> pass
          (Pdb) display lst
          display lst: []
          (Pdb) n
          > example.py(4)<module>()
          -> lst.append(1)
          (Pdb) n
          > example.py(5)<module>()
          -> print(lst)
          (Pdb)

     You can do some tricks with copy mechanism to make it work:

          > example.py(3)<module>()
          -> pass
          (Pdb) display lst[:]
          display lst[:]: []
          (Pdb) n
          > example.py(4)<module>()
          -> lst.append(1)
          (Pdb) n
          > example.py(5)<module>()
          -> print(lst)
          display lst[:]: [1]  [old: []]
          (Pdb)

     Added in version 3.2.

 -- Pdbcommand: undisplay [expression]

     現在のフレーム内で 'expression' をこれ以上表示しないようにします。
     'expression' を指定しない場合、現在のフレームで display 指定されて
     いる式を全てクリアします。

     Added in version 3.2.

 -- Pdbcommand: interact

     Start an interactive interpreter (using the *note code: 1b. module)
     in a new global namespace initialised from the local and global
     namespaces for the current scope.  Use ‘exit()’ or ‘quit()’ to exit
     the interpreter and return to the debugger.

          注釈: As ‘interact’ creates a new dedicated namespace for code
          execution, assignments to variables will not affect the
          original namespaces.  However, modifications to any referenced
          mutable objects will be reflected in the original namespaces
          as usual.

     Added in version 3.2.

     バージョン 3.13 で変更: ‘exit()’ and ‘quit()’ can be used to exit
     the *note interact: 47ed. command.

     バージョン 3.13 で変更: *note interact: 47ed. directs its output to
     the debugger's output channel rather than *note sys.stderr: b33.

 -- Pdbcommand: alias [name [command]]

     Create an alias called 'name' that executes 'command'.  The
     'command' must 'not' be enclosed in quotes.  Replaceable parameters
     can be indicated by ‘%1’, ‘%2’, ...  and ‘%9’, while ‘%*’ is
     replaced by all the parameters.  If 'command' is omitted, the
     current alias for 'name' is shown.  If no arguments are given, all
     aliases are listed.

     エイリアスは入れ子になってもよく、pdb プロンプトで合法的にタイプで
     きるどんなものでも含めることができます。内部 pdb コマンドをエイリア
     スによって上書きすることが 'できます'。そのとき、このようなコマンド
     はエイリアスが取り除かれるまで隠されます。エイリアス化はコマンド行
     の最初の語へ再帰的に適用されます。行の他のすべての語はそのままです
     。

     例として、二つの便利なエイリアスがあります (特に ‘.pdbrc’ ファイル
     に置かれたときに):

          # Print instance variables (usage "pi classInst")
          alias pi for k in %1.__dict__.keys(): print(f"%1.{k} = {%1.__dict__[k]}")
          # Print instance variables in self
          alias ps pi self

 -- Pdbcommand: unalias name

     指定したエイリアス 'name' を削除します。

 -- Pdbcommand: ! statement

     Execute the (one-line) 'statement' in the context of the current
     stack frame.  The exclamation point can be omitted unless the first
     word of the statement resembles a debugger command, e.g.:

          (Pdb) ! n=42
          (Pdb)

     To set a global variable, you can prefix the assignment command
     with a *note global: 4ac. statement on the same line, e.g.:

          (Pdb) global list_options; list_options = ['-l']
          (Pdb)

 -- Pdbcommand: run [args ...]
 -- Pdbcommand: restart [args ...]

     デバッグ中の Python プログラムを再実行します。'args' が与えられると
     、 *note shlex: c9. で分割され、結果が新しい *note sys.argv: 147c.
     として使われます。ヒストリー、ブレークポイント、アクション、そして
     、デバッガーオプションは引き継がれます。 *note restart: 47f2. は
     *note run: 47f1. の別名です。

     バージョン 3.14 で変更: *note run: 47f1. and *note restart: 47f2.
     commands are disabled when the debugger is invoked in ‘'inline'’
     mode.

 -- Pdbcommand: q(uit)

     Quit from the debugger.  The program being executed is aborted.  An
     end-of-file input is equivalent to *note quit: 47e6.

     A confirmation prompt will be shown if the debugger is invoked in
     ‘'inline'’ mode.  Either ‘y’, ‘Y’, ‘<Enter>’ or ‘EOF’ will confirm
     the quit.

     バージョン 3.14 で変更: A confirmation prompt will be shown if the
     debugger is invoked in ‘'inline'’ mode.  After the confirmation,
     the debugger will call *note sys.exit(): 277. immediately, instead
     of raising *note bdb.BdbQuit: 278. in the next trace event.

 -- Pdbcommand: debug code

     Enter a recursive debugger that steps through 'code' (which is an
     arbitrary expression or statement to be executed in the current
     environment).

 -- Pdbcommand: retval

     Print the return value for the last return of the current function.

 -- Pdbcommand: exceptions [excnumber]

     List or jump between chained exceptions.

     When using ‘pdb.pm()’ or ‘Pdb.post_mortem(...)’ with a chained
     exception instead of a traceback, it allows the user to move
     between the chained exceptions using ‘exceptions’ command to list
     exceptions, and ‘exceptions <number>’ to switch to that exception.

     以下はプログラム例です:

          def out():
              try:
                  middle()
              except Exception as e:
                  raise ValueError("reraise middle() error") from e

          def middle():
              try:
                  return inner(0)
              except Exception as e:
                  raise ValueError("Middle fail")

          def inner(x):
              1 / x

           out()

     calling ‘pdb.pm()’ will allow to move between exceptions:

          > example.py(5)out()
          -> raise ValueError("reraise middle() error") from e

          (Pdb) exceptions
            0 ZeroDivisionError('division by zero')
            1 ValueError('Middle fail')
          > 2 ValueError('reraise middle() error')

          (Pdb) exceptions 0
          > example.py(16)inner()
          -> 1 / x

          (Pdb) up
          > example.py(10)middle()
          -> return inner(0)

     Added in version 3.13.

脚注
....


File: python.info,  Node: Python プロファイラ,  Next: timeit --- 小さなコードスニペットの実行時間計測,  Prev: pdb --- The Python Debugger,  Up: デバッグとプロファイル

5.27.5 Python プロファイラ
--------------------------

'ソースコード:' Lib/profile.py(1) と Lib/pstats.py(2)

__________________________________________________________________

* Menu:

* プロファイラとは::
* かんたんユーザマニュアル::
* profile and cProfile Module Reference::
* Stats クラス::
* 決定論的プロファイリングとは::
* 制限事項: 制限事項<2>.
* キャリブレーション (補正): キャリブレーション 補正.
* カスタムな時刻取得用関数を使う::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/profile.py

   (2) https://github.com/python/cpython/tree/3.14/Lib/pstats.py


File: python.info,  Node: プロファイラとは,  Next: かんたんユーザマニュアル,  Up: Python プロファイラ

5.27.5.1 プロファイラとは
.........................

*note cProfile: 2b. と *note profile: b4. は '決定論的プロファイリング
(deterministic profiling)' を行います。 'プロファイル (profile)' とは、
プログラムの各部分がどれだけ頻繁に呼ばれたか、そして実行にどれだけ時間が
かかったかという統計情報です。 *note pstats: b5. モジュールを使ってこの
統計情報をフォーマットし表示することができます。

Python 標準ライブラリは同じインターフェイスを提供するプロファイラの実装
を2つ提供しています:

  1. *note cProfile: 2b. はほとんどのユーザーに推奨されるモジュールです
     。 C言語で書かれた拡張モジュールで、オーバーヘッドが少ないため長時
     間実行されるプログラムのプロファイルに適しています。 Brett Rosen と
     Ted Czotter によって提供された ‘lsprof’ に基づいています。

  2. *note profile: b4. はピュア Python モジュールで、 *note cProfile:
     2b. モジュールはこのモジュールのインターフェースを真似ています。対
     象プログラムに相当のオーバーヘッドが生じます。もしプロファイラに何
     らかの拡張をしたいのであれば、こちらのモジュールを拡張する方が簡単
     でしょう。このモジュールはもともと Jim Roskind により設計、実装され
     ました。

     注釈: 2つのプロファイラモジュールは、与えられたプログラムの実行時プ
     ロファイルを取得するために設計されており、ベンチマークのためのもの
     ではありません (ベンチマーク用途には *note timeit: f5. のほうが正確
     な計測結果を求められます)。これは Python コードと C で書かれたコー
     ドをベンチマークするときに特に大きく影響します。プロファイラは
     Python コードに対してオーバーヘッドを発生しますが、C言語レベルの関
     数に対してはオーバーヘッドを生じません。なのでC言語で書かれたコード
     が、実際の速度と関係なく、Pythonで書かれたコードより速く見えるでし
     ょう。


File: python.info,  Node: かんたんユーザマニュアル,  Next: profile and cProfile Module Reference,  Prev: プロファイラとは,  Up: Python プロファイラ

5.27.5.2 かんたんユーザマニュアル
.................................

この節は "マニュアルなんか読みたくない人"のために書かれています。ここで
はきわめて簡単な概要説明とアプリケーションのプロファイリングを手っ取り早
く行う方法だけを解説します。

1つの引数を取る関数をプロファイルしたい場合、次のようにできます:

     import cProfile
     import re
     cProfile.run('re.compile("foo|bar")')

(お使いのシステムで *note cProfile: 2b. が使えないときは代わりに *note
profile: b4. を使って下さい)

上のコードは *note re.compile(): dce. を実行して、プロファイル結果を次の
ように表示します:

           214 function calls (207 primitive calls) in 0.002 seconds

     Ordered by: cumulative time

     ncalls  tottime  percall  cumtime  percall filename:lineno(function)
          1    0.000    0.000    0.002    0.002 {built-in method builtins.exec}
          1    0.000    0.000    0.001    0.001 <string>:1(<module>)
          1    0.000    0.000    0.001    0.001 __init__.py:250(compile)
          1    0.000    0.000    0.001    0.001 __init__.py:289(_compile)
          1    0.000    0.000    0.000    0.000 _compiler.py:759(compile)
          1    0.000    0.000    0.000    0.000 _parser.py:937(parse)
          1    0.000    0.000    0.000    0.000 _compiler.py:598(_code)
          1    0.000    0.000    0.000    0.000 _parser.py:435(_parse_sub)

The first line indicates that 214 calls were monitored.  Of those calls,
207 were 'primitive', meaning that the call was not induced via
recursion.  The next line: ‘Ordered by: cumulative time’ indicates the
output is sorted by the ‘cumtime’ values.  The column headings include:

ncalls

     呼び出し回数

tottime

     与えられた関数に消費された合計時間 (sub-function の呼び出しで消費さ
     れた時間は除外されています)

percall

     ‘tottime’ を ‘ncalls’ で割った値

cumtime

     この関数と全ての subfunction に消費された累積時間 (起動から終了まで
     )。この数字は再帰関数に 'ついても' 正確です。

percall

     ‘cumtime’ をプリミティブな呼び出し回数で割った値

filename:lineno(function)

     その関数のファイル名、行番号、関数名

最初の行に 2 つの数字がある場合 (たとえば ‘3/1’) は、関数が再帰的に呼び
出されたということです。2 つ目の数字はプリミティブな呼び出しの回数で、1
つ目の数字は総呼び出し回数です。関数が再帰的に呼び出されなかった場合、そ
れらは同じ値で数字は 1 つしか表示されないことに留意してください。

‘run()’ 関数でファイル名を指定することで、プロファイル実行の終了時に出力
を表示する代わりに、ファイルに保存することが出来ます。

     import cProfile
     import re
     cProfile.run('re.compile("foo|bar")', 'restats')

*note pstats.Stats: 47fd. クラスはファイルからプロファイルの結果を読み込
んで様々な書式に整えます。 ファイル *note cProfile: 2b. と *note
profile: b4. は他のスクリプトをプロファイルするためのスクリプトとして起
動することも出来ます。例えば:

     python -m cProfile [-o output_file] [-s sort_order] (-m module | myscript.py)

 -- Option: -o <output_file>

     Writes the profile results to a file instead of to stdout.

 -- Option: -s <sort_order>

     Specifies one of the *note sort_stats(): 4801. sort values to sort
     the output by.  This only applies when *note -o: 47ff. is not
     supplied.

 -- Option: -m <module>

     Specifies that a module is being profiled instead of a script.

     Added in version 3.7: Added the ‘-m’ option to *note cProfile: 2b.

     Added in version 3.8: Added the ‘-m’ option to *note profile: b4.

*note pstats: b5. モジュールの *note Stats: 47fd. クラスにはプロファイル
結果のファイルに保存されているデータを処理して出力するための様々なメソッ
ドがあります。

     import pstats
     from pstats import SortKey
     p = pstats.Stats('restats')
     p.strip_dirs().sort_stats(-1).print_stats()

*note strip_dirs(): 4803. メソッドによって全モジュール名から無関係なパス
が取り除かれました。*note sort_stats(): 4801. メソッドにより、出力される
標準的な モジュール/行/名前 文字列にしたがって全項目がソートされました。
*note print_stats(): 4804. メソッドによって全統計が出力されました。以下
のようなソート呼び出しを試すことができます:

     p.sort_stats(SortKey.NAME)
     p.print_stats()

最初の行ではリストを関数名でソートしています。2行目で情報を出力していま
す。さらに次の内容も試してください:

     p.sort_stats(SortKey.CUMULATIVE).print_stats(10)

このようにすると、関数が消費した累計時間でソートして、さらにその上位10件
だけを表示します。どのアルゴリズムが時間を多く消費しているのか知りたいと
きは、この方法が役に立つはずです。

ループで多くの時間を消費している関数はどれか調べたいときは、次のようにし
ます:

     p.sort_stats(SortKey.TIME).print_stats(10)

上記はそれぞれの関数で消費された時間でソートして、上位10件の関数の情報が
表示されます。

次の内容も試してください:

     p.sort_stats(SortKey.FILENAME).print_stats('__init__')

このようにするとファイル名でソートされ、そのうちクラスの初期化メソッド
(メソッド名 ‘__init__’) に関する統計情報だけが表示されます:

     p.sort_stats(SortKey.TIME, SortKey.CUMULATIVE).print_stats(.5, 'init')

上記は時間 (time) をプライマリキー、累計時間 (cumulative time) をセカン
ダリキーにしてソートした後でさらに条件を絞って統計情報を出力します。
‘.5’ は上位 50% だけを選択することを意味し、さらにその中から文字列
‘init’ を含むものだけが表示されます。

どの関数がどの関数を呼び出しているのかを知りたければ、次のようにします
(‘p’ は最後に実行したときの状態でソートされています):

     p.print_callers(.5, 'init')

このようにすると、関数ごとの呼び出し側関数の一覧が得られます。

さらに詳しい機能を知りたければマニュアルを読むか、次の関数の実行結果から
内容を推察してください:

     p.print_callees()
     p.add('restats')

スクリプトとして起動した場合、 *note pstats: b5. モジュールはプロファイ
ルのダンプを読み込み、分析するための統計ブラウザとして動きます。シンプル
な行指向のインターフェース (*note cmd: 1a. を使って実装) とヘルプ機能を
備えています。


File: python.info,  Node: profile and cProfile Module Reference,  Next: Stats クラス,  Prev: かんたんユーザマニュアル,  Up: Python プロファイラ

5.27.5.3 ‘profile’ and ‘cProfile’ Module Reference
..................................................

Both the *note profile: b4. and ‘cProfile’ modules provide the following
functions:

 -- の関数: profile.run (command, filename=None, sort=-1)

     この関数は *note exec(): 4a2. 関数に渡せる一つの引数と、オプション
     引数としてファイル名を指定できます。全ての場合でこのルーチンは以下
     を実行します:

          exec(command, __main__.__dict__, __main__.__dict__)

     そして実行結果からプロファイル情報を収集します。 ファイル名が指定さ
     れていない場合は、 *note Stats: 47fd. のインスタンスが自動的に作ら
     れ、簡単なプロファイルレポートが表示されます。 'sort' が指定されて
     いる場合は、 *note Stats: 47fd. インスタンスに渡され、結果をどのよ
     うに並び替えるかを制御します。

 -- の関数: profile.runctx (command, globals, locals, filename=None,
          sort=-1)

     This function is similar to *note run(): 4806, with added arguments
     to supply the globals and locals mappings for the 'command' string.
     This routine executes:

          exec(command, globals, locals)

     そしてプロファイル統計情報を *note run(): 4806. 同様に収集します。

 -- クラス: profile.Profile (timer=None, timeunit=0.0, subcalls=True,
          builtins=True)

     このクラスは普通、プロファイリングを ‘cProfile.run()’ 関数が提供す
     るもの以上に正確に制御したい場合にのみ使われます。

     'timer' 引数に、コードの実行時間を計測するためのカスタムな時刻取得
     用関数を渡せます。これは現在時刻を表す単一の数値を返す関数でなけれ
     ばなりません。もしこれが整数を返す関数ならば、 'timeunit' には単位
     時間当たりの実際の持続時間を指定します。たとえば関数が 1000 分の 1
     秒単位で計測した時間を返すとすると、 'timeunit' は ‘.001’ でしょう
     。

     *note Profile: bd6. クラスを直接使うと、プロファイルデータをファイ
     ルに書き出すことなしに結果をフォーマット出来ます:

          import cProfile, pstats, io
          from pstats import SortKey
          pr = cProfile.Profile()
          pr.enable()
          # ... do something ...
          pr.disable()
          s = io.StringIO()
          sortby = SortKey.CUMULATIVE
          ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
          ps.print_stats()
          print(s.getvalue())

     The *note Profile: bd6. class can also be used as a context manager
     (supported only in ‘cProfile’ module.  see *note
     コンテキストマネージャ型: 240d.):

          import cProfile

          with cProfile.Profile() as pr:
              # ... do something ...

              pr.print_stats()

     バージョン 3.8 で変更: コンテキストマネージャーサポートが追加されま
     した。

      -- メソッド: enable ()

          Start collecting profiling data.  Only in ‘cProfile’.

      -- メソッド: disable ()

          Stop collecting profiling data.  Only in ‘cProfile’.

      -- メソッド: create_stats ()

          プロファイリングデータの収集を停止し、現在のプロファイルとして
          結果を内部で記録します。

      -- メソッド: print_stats (sort=-1)

          現在のプロファイルに基づいて *note Stats: 47fd. オブジェクトを
          作成し、結果を標準出力に出力します。

          The 'sort' parameter specifies the sorting order of the
          displayed statistics.  It accepts a single key or a tuple of
          keys to enable multi-level sorting, as in *note
          Stats.sort_stats: 4801.

          Added in version 3.13: *note print_stats(): 480b. now accepts
          a tuple of keys.

      -- メソッド: dump_stats (filename)

          現在のプロファイルの結果を 'filename' に書き出します。

      -- メソッド: run (cmd)

          *note exec(): 4a2. を用いて cmd をプロファイルします。

      -- メソッド: runctx (cmd, globals, locals)

          *note exec(): 4a2. を用いて指定されたグローバルおよびローカル
          な環境で cmd をプロファイルします。

      -- メソッド: runcall (func, /, *args, **kwargs)

          ‘func(*args, **kwargs)’ をプロファイルします。

Note that profiling will only work if the called command/function
actually returns.  If the interpreter is terminated (e.g.  via a *note
sys.exit(): 277. call during the called command/function execution) no
profiling results will be printed.


File: python.info,  Node: Stats クラス,  Next: 決定論的プロファイリングとは,  Prev: profile and cProfile Module Reference,  Up: Python プロファイラ

5.27.5.4 ‘Stats’ クラス
.......................

*note Stats: 47fd. クラスを使用してプロファイラデータを解析します。

 -- クラス: pstats.Stats (*filenames or profile, stream=sys.stdout)

     このコンストラクタは 'filename' で指定した (単一または複数の) ファ
     イルもしくは ‘Profile’ のインスタンスから "統計情報オブジェクト" の
     インスタンスを生成します。出力は 'stream' で指定したストリームに出
     力されます。

     上記コンストラクタで指定するファイルは、使用する *note Stats: 47fd.
     に対応したバージョンの *note profile: b4. または *note cProfile:
     2b. で作成されたものでなければなりません。将来のバージョンのプロフ
     ァイラとの互換性は '保証されておらず' 、他のプロファイラで生成され
     たファイルや異なるオペレーティングシステムで実行される同じプロファ
     イルとの互換性もないことに注意してください。複数のファイルを指定し
     た場合、同一の関数の統計情報はすべて合算され、複数のプロセスで構成
     される全体をひとつのレポートで検証することが可能になります。既存の
     *note Stats: 47fd. オブジェクトに別のファイルの情報を追加するときは
     、 *note add(): 4811. メソッドを使用します。

     プロファイルデータをファイルから読み込む代わりに、
     ‘cProfile.Profile’ または *note profile.Profile: bd6. オブジェクト
     をプロファイルデータのソースとして使うことができます。

     *note Stats: 47fd. には次のメソッドがあります:

      -- メソッド: strip_dirs ()

          *note Stats: 47fd. クラスのこのメソッドは、ファイル名の前に付
          いているすべてのパス情報を取り除くためのものです。出力の幅を
          80文字以内に収めたいときに重宝します。このメソッドはオブジェク
          トを変更するため、取り除いたパス情報は失われます。パス情報除去
          の操作後、オブジェクトが保持するデータエントリは、オブジェクト
          の初期化、ロード直後と同じように "ランダムに" 並んでいます。
          *note strip_dirs(): 4803. を実行した結果、2つの関数名が区別で
          きない (両者が同じファイルの同じ行番号で同じ関数名となった) 場
          合、一つのエントリに合算されされます。

      -- メソッド: add (*filenames)

          *note Stats: 47fd. クラスのこのメソッドは、既存のプロファイリ
          ングオブジェクトに情報を追加します。引数は対応するバージョンの
          *note profile.run(): 4806. または ‘cProfile.run()’ によって生
          成されたファイルの名前でなくてはなりません。関数の名前が区別で
          きない (ファイル名、行番号、関数名が同じ) 場合、一つの関数の統
          計情報として合算されます。

      -- メソッド: dump_stats (filename)

          *note Stats: 47fd. オブジェクトに読み込まれたデータを、ファイ
          ル名 'filename' のファイルに保存します。ファイルが存在しない場
          合は新たに作成され、すでに存在する場合には上書きされます。この
          メソッドは *note profile.Profile: bd6. クラスおよび
          ‘cProfile.Profile’ クラスの同名のメソッドと等価です。

      -- メソッド: sort_stats (*keys)

          This method modifies the *note Stats: 47fd. object by sorting
          it according to the supplied criteria.  The argument can be
          either a string or a SortKey enum identifying the basis of a
          sort (example: ‘'time'’, ‘'name'’, ‘SortKey.TIME’ or
          ‘SortKey.NAME’).  The SortKey enums argument have advantage
          over the string argument in that it is more robust and less
          error prone.

          2つ以上のキーが指定された場合、2つ目以降のキーは、それ以前のキ
          ーで等価となったデータエントリの再ソートに使われます。たとえば
          ‘sort_stats(SortKey.NAME, SortKey.FILE)’ とした場合、まずすべ
          てのエントリが関数名でソートされた後、同じ関数名で複数のエント
          リがあればファイル名でソートされます。

          For the string argument, abbreviations can be used for any key
          names, as long as the abbreviation is unambiguous.

          The following are the valid string and SortKey:

          Valid String Arg       Valid enum Arg            意味
                                                           
          ----------------------------------------------------------------------------
                                                           
          ‘'calls'’              SortKey.CALLS             呼び出し数
                                                           
                                                           
          ‘'cumulative'’         SortKey.CUMULATIVE        累積時間
                                                           
                                                           
          ‘'cumtime'’            N/A                       累積時間
                                                           
                                                           
          ‘'file'’               N/A                       ファイル名
                                                           
                                                           
          ‘'filename'’           SortKey.FILENAME          ファイル名
                                                           
                                                           
          ‘'module'’             N/A                       ファイル名
                                                           
                                                           
          ‘'ncalls'’             N/A                       呼び出し数
                                                           
                                                           
          ‘'pcalls'’             SortKey.PCALLS            プリミティブな呼び出し回
                                                           数
                                                           
                                                           
          ‘'line'’               SortKey.LINE              行番号
                                                           
                                                           
          ‘'name'’               SortKey.NAME              関数名
                                                           
                                                           
          ‘'nfl'’                SortKey.NFL               関数名/ファイル名/行番号
                                                           
                                                           
          ‘'stdname'’            SortKey.STDNAME           標準名
                                                           
                                                           
          ‘'time'’               SortKey.TIME              内部時間
                                                           
                                                           
          ‘'tottime'’            N/A                       内部時間
                                                           

          すべての統計情報のソート結果は降順 (最も多く時間を消費したもの
          が一番上に来る) となることに注意してください。ただし、関数名、
          ファイル名、行数に関しては昇順 (アルファベット順) になります。
          ‘SortKey.NFL’ と ‘SortKey.STDNAME’ には微妙な違いがあります。
          標準名 (standard name) とは表示された名前によるソートで、埋め
          込まれた行番号のソート順が特殊です。たとえば、 (ファイル名が同
          じで) 3、20、40という行番号のエントリがあった場合、20、3、40 の
          順に表示されます。一方 ‘SortKey.NFL’ は行番号を数値として比較
          します。要するに、 ‘sort_stats(SortKey.NFL)’ は
          ‘sort_stats(SortKey.NAME, SortKey.FILENAME, SortKey.LINE)’ と
          指定した場合と同じになります。

          後方互換性のため、数値を引数に使った ‘-1’, ‘0’, ‘1’, ‘2’ の形
          式もサポートしています。それぞれ ‘'stdname'’, ‘'calls'’,
          ‘'time'’, ‘'cumulative'’ として処理されます。引数をこの旧スタ
          イルで指定した場合、最初のキー (数値キー) だけが使われ、複数の
          キーを指定しても2番目以降は無視されます。

          Added in version 3.7: Added the SortKey enum.

      -- メソッド: reverse_order ()

          *note Stats: 47fd. クラスのこのメソッドは、オブジェクト内の情
          報のリストを逆順にソートします。デフォルトでは選択したキーに応
          じて昇順、降順が適切に選ばれることに注意してください。

      -- メソッド: print_stats (*restrictions)

          *note Stats: 47fd. クラスのこのメソッドは、 *note
          profile.run(): 4806. の項で述べたプロファイルのレポートを出力
          します。

          出力するデータの順序はオブジェクトに対し最後に行った *note
          sort_stats(): 4801. による操作に基づきます (*note add(): 4811.
          と *note strip_dirs(): 4803. による制限にも支配されます)。

          The arguments provided (if any) can be used to limit the list
          down to the significant entries.  Initially, the list is taken
          to be the complete set of profiled functions.  Each
          restriction is either an integer (to select a count of lines),
          or a decimal fraction between 0.0 and 1.0 inclusive (to select
          a percentage of lines), or a string that will be interpreted
          as a regular expression (to pattern match the standard name
          that is printed).  If several restrictions are provided, then
          they are applied sequentially.  For example:

               print_stats(.1, 'foo:')

          上記の場合まず出力するリストは全体の10%に制限され、さらにファ
          イル名の一部に文字列 ‘.*foo:’ を持つ関数だけが出力されます:

               print_stats('foo:', .1)

          こちらの例の場合、リストはまずファイル名に ‘.*foo:’ を持つ関数
          だけに制限され、その中の最初の 10% だけが出力されます。

      -- メソッド: print_callers (*restrictions)

          *note Stats: 47fd. クラスのこのメソッドは、プロファイルのデー
          タベースの中から何らかの関数呼び出しを行った関数をすべて出力し
          ます。出力の順序は *note print_stats(): 4804. によって与えられ
          るものと同じです。出力を制限する引数も同じです。各呼び出し側関
          数についてそれぞれ一行ずつ表示されます。フォーマットは統計を作
          り出したプロファイラごとに微妙に異なります:

             * *note profile: b4. の場合、呼び出し側関数の後に括弧で囲ま
               れて表示される数値はその呼び出しが何回行われたかを示して
               います。利便性のため、 2番目の括弧なしで表示される数値に
               よって、関数が消費した累積時間を表しています。

             * *note cProfile: 2b. の場合、各呼び出し側関数の後に3つの数
               字が付きます。呼び出しが何回行われたかと、この呼び出し側
               関数からの呼び出しによって現在の関数内で消費された合計時
               間および累積時間です。

      -- メソッド: print_callees (*restrictions)

          *note Stats: 47fd. クラスのこのメソッドは、指定した関数から呼
          び出された関数のリストを出力します。呼び出し側、呼び出される側
          の方向は逆ですが、引数と出力の順序に関しては *note
          print_callers(): 4814. と同じです。

      -- メソッド: get_stats_profile ()

          This method returns an instance of StatsProfile, which
          contains a mapping of function names to instances of
          FunctionProfile.  Each FunctionProfile instance holds
          information related to the function's profile such as how long
          the function took to run, how many times it was called, etc...

          Added in version 3.9: Added the following dataclasses:
          StatsProfile, FunctionProfile.  Added the following function:
          get_stats_profile.


File: python.info,  Node: 決定論的プロファイリングとは,  Next: 制限事項<2>,  Prev: Stats クラス,  Up: Python プロファイラ

5.27.5.5 決定論的プロファイリングとは
.....................................

'決定論的プロファイリング' とは、すべての '関数呼び出し', '関数からのリ
ターン', '例外発生' をモニターし、正確なタイミングを記録することで、イベ
ント間の時間、つまりどの時間にユーザコードが実行されているのかを計測する
やり方です。もう一方の '統計的プロファイリング' (このモジュールでこの方
法は採用していません) とは、有効なインストラクションポインタからランダム
にサンプリングを行い、プログラムのどこで時間が使われているかを推定する方
法です。後者の方法は、オーバヘッドが少ないものの、プログラムのどこで多く
の時間が使われているか、その相対的な示唆に留まります。

Python の場合、実行中は必ずインタプリタが動作しているため、決定論的プロ
ファイリングを行うために計測用のコードを追加する必要はありません。
Python は自動的に各イベントに 'フック' (オプションのコールバック) を提供
します。加えて Python のインタプリタという性質によって、実行時に大きなオ
ーバーヘッドを伴う傾向がありますが、それに比べると一般的なアプリケーショ
ンでは決定論的プロファイリングで追加される処理のオーバーヘッドは少ない傾
向にあります。結果的に、決定論的プロファイリングは少ないコストで Python
プログラムの実行時間に関する詳細な統計を得られる方法となっているのです。

呼び出し回数はコード中のバグ発見にも使用できます (とんでもない数の呼び出
しが行われている部分)。インライン拡張の対象とすべき部分を見つけるために
も使えます (呼び出し頻度の高い部分)。内部時間の統計は、注意深く最適化す
べき"ホットループ"の発見にも役立ちます。累積時間の統計は、アルゴリズム選
択に関連した高レベルのエラー検知に役立ちます。なお、このプロファイラは再
帰的なアルゴリズム実装の累計時間を計ることが可能で、通常のループを使った
実装と直接比較することもできるようになっています。


File: python.info,  Node: 制限事項<2>,  Next: キャリブレーション 補正,  Prev: 決定論的プロファイリングとは,  Up: Python プロファイラ

5.27.5.6 制限事項
.................

一つの制限はタイミング情報の正確さに関するものです。決定論的プロファイラ
には正確さに関する根本的問題があります。最も明白な制限は、 (一般に) "ク
ロック"は .001 秒の精度しかないということです。これ以上の精度で計測する
ことはできません。仮に充分な精度が得られたとしても、"誤差"が計測の平均値
に影響を及ぼすことがあります。この最初の誤差を取り除いたとしても、それが
また別の誤差を引き起こす原因となります。

もう一つの問題として、イベントを検知してからプロファイラがその時刻を実際
に '取得' するまでに "いくらかの時間がかかる" ことです。同様に、イベント
ハンドラが終了する時にも、時刻を取得して (そしてその値を保存して) から、
ユーザコードが処理を再開するまでの間に遅延が発生します。結果的に多く呼び
出される関数または多数の関数から呼び出される関数の情報にはこの種の誤差が
蓄積する傾向にあります。このようにして蓄積される誤差は、典型的にはクロッ
クの精度を下回ります (1クロック以下) が、一方でこの時間が累計して非常に
大きな値になることも 'あり得ます' 。

この問題はオーバーヘッドの小さい *note cProfile: 2b. よりも *note
profile: b4. においてより重要です。そのため、 *note profile: b4. は誤差
が確率的に (平均値で) 減少するようにプラットフォームごとに補正する機能を
備えています。プロファイラに補正を施すと (最小二乗の意味で) 正確さが増し
ますが、ときには数値が負の値になってしまうこともあります (呼び出し回数が
極めて少なく、確率の神があなたに意地悪をしたとき :-) )。プロファイルの結
果に負の値が出力されても '驚かないでください' 。これは補正を行った場合に
のみ生じることで、補正を行わない場合に比べて計測結果は実際にはより正確に
なっているはずだからです。


File: python.info,  Node: キャリブレーション 補正,  Next: カスタムな時刻取得用関数を使う,  Prev: 制限事項<2>,  Up: Python プロファイラ

5.27.5.7 キャリブレーション (補正)
..................................

*note profile: b4. のプロファイラは time 関数呼び出しおよびその値を保存
するためのオーバーヘッドを補正するために、各イベントの処理時間から定数を
引きます。デフォルトでこの定数の値は 0 です。以下の手順で、プラットフォ
ームに合った、より適切な定数が得られます (*note 制限事項: 481a. 参照)。

     import profile
     pr = profile.Profile()
     for i in range(5):
         print(pr.calibrate(10000))

calibrate メソッドは引数として与えられた数だけ Python の呼び出しを行いま
す。直接呼び出す場合と、プロファイラを使って呼び出す場合の両方が実施され
、それぞれの時間が計測されます。その結果、プロファイラのイベントに隠され
たオーバーヘッドが計算され、その値は浮動小数として返されます。たとえば、
1.8 GHz の Intel Core i5 で macOS を使用、 Python の time.process_time()
をタイマとして使った場合、値はおよそ 4.04e-6 となります。

この手順で使用しているオブジェクトはほぼ一定の結果を返します。 '非常に'
早いコンピュータを使う場合、もしくはタイマの性能が貧弱な場合は、一定の結
果を得るために引数に 100000 や 1000000 といった大きな値を指定する必要が
あるかもしれません。

一定の結果が得られたら、それを使う方法には3通りあります:

     import profile

     # 1. Apply computed bias to all Profile instances created hereafter.
     profile.Profile.bias = your_computed_bias

     # 2. Apply computed bias to a specific Profile instance.
     pr = profile.Profile()
     pr.bias = your_computed_bias

     # 3. Specify computed bias in instance constructor.
     pr = profile.Profile(bias=your_computed_bias)

選択肢がある場合は、補正値は小さめに設定した方が良いでしょう。プロファイ
ルの結果に負の値が表われる"頻度が低く"なるはずです。


File: python.info,  Node: カスタムな時刻取得用関数を使う,  Prev: キャリブレーション 補正,  Up: Python プロファイラ

5.27.5.8 カスタムな時刻取得用関数を使う
.......................................

プロファイラが時刻を取得する方法を変更したいなら (たとえば、実測時間やプ
ロセスの経過時間を使いたい場合)、時刻取得用の関数を ‘Profile’ クラスのコ
ンストラクタに指定することができます:

     pr = profile.Profile(your_time_func)

この結果生成されるプロファイラは時刻取得に ‘your_time_func()’ を呼び出す
ようになります。 *note profile.Profile: bd6. と ‘cProfile.Profile’ のど
ちらを使っているかにより、 ‘your_time_func’ の戻り値は異なって解釈されま
す:

*note profile.Profile: bd6.

     ‘your_time_func()’ は単一の数値、あるいは (*note os.times(): 132d.
     と同じように) その合計が累計時間を示すリストを返すようになっていな
     ければなりません。関数が1つの数値、あるいは長さ2の数値のリストを返
     すようになっていれば、ディスパッチルーチンには特別な高速化バージョ
     ンが使われます。

     Be warned that you should calibrate the profiler class for the
     timer function that you choose (see *note キャリブレーション
     (補正): 481c.).  For most machines, a timer that returns a lone
     integer value will provide the best results in terms of low
     overhead during profiling.  (*note os.times(): 132d. is 'pretty'
     bad, as it returns a tuple of floating-point values).  If you want
     to substitute a better timer in the cleanest fashion, derive a
     class and hardwire a replacement dispatch method that best handles
     your timer call, along with the appropriate calibration constant.

‘cProfile.Profile’

     ‘your_time_func()’ は単一の数値を返すようになっていなければなりませ
     ん。単一の整数を返すのであれば、クラスコンストラクタの第二引数に単
     位時間当たりの実際の持続時間を渡せます。例えば
     ‘your_integer_time_func’ が 1000 分の 1 秒単位で計測した時間を返す
     とすると、 ‘Profile’ インスタンスを以下のように構築出来ます:

          pr = cProfile.Profile(your_integer_time_func, 0.001)

     As the ‘cProfile.Profile’ class cannot be calibrated, custom timer
     functions should be used with care and should be as fast as
     possible.  For the best results with a custom timer, it might be
     necessary to hard-code it in the C source of the internal ‘_lsprof’
     module.

Python 3.3 で *note time: f4. に、プロセス時間や実時間の精密な計測に使え
る新しい関数が追加されました。 例えば、 *note time.perf_counter(): c7a.
を参照してください。


File: python.info,  Node: timeit --- 小さなコードスニペットの実行時間計測,  Next: trace --- Python 文実行のトレースと追跡,  Prev: Python プロファイラ,  Up: デバッグとプロファイル

5.27.6 ‘timeit’ -- 小さなコードスニペットの実行時間計測
-------------------------------------------------------

'ソースコード:' Lib/timeit.py(1)

__________________________________________________________________

このモジュールは小さい Python コードをの時間を計測するシンプルな手段を提
供しています。*note コマンドラインインターフェイス: 4822. の他 *note
呼び出しも可能: 4823. です。このモジュールは実行時間を計測するときに共通
するいくつかの罠を回避します。O'Reilly 出版の 'Python Cookbook' 第2版に
ある、Tim Peter による "Algorithms" 章も参照してください。

* Menu:

* 基本的な例: 基本的な例<3>.
* Python インターフェイス::
* コマンドラインインターフェイス: コマンドラインインターフェイス<3>.
* 使用例: 使用例<44>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/timeit.py


File: python.info,  Node: 基本的な例<3>,  Next: Python インターフェイス,  Up: timeit --- 小さなコードスニペットの実行時間計測

5.27.6.1 基本的な例
...................

次の例は *note コマンドラインインターフェイス: 4822. を使って 3 つの異な
る式の時間を測定する方法を示しています。

     $ python -m timeit "'-'.join(str(n) for n in range(100))"
     10000 loops, best of 5: 30.2 usec per loop
     $ python -m timeit "'-'.join([str(n) for n in range(100)])"
     10000 loops, best of 5: 27.5 usec per loop
     $ python -m timeit "'-'.join(map(str, range(100)))"
     10000 loops, best of 5: 23.2 usec per loop

同じ事を *note Python インターフェイス: 4823. を使って実現することもでき
ます:

     >>> import timeit
     >>> timeit.timeit('"-".join(str(n) for n in range(100))', number=10000)
     0.3018611848820001
     >>> timeit.timeit('"-".join([str(n) for n in range(100)])', number=10000)
     0.2727368790656328
     >>> timeit.timeit('"-".join(map(str, range(100)))', number=10000)
     0.23702679807320237

呼び出し可能オブジェクトは *note Python インターフェイス: 4823. から渡す
こともできます:

     >>> timeit.timeit(lambda: "-".join(map(str, range(100))), number=10000)
     0.19665591977536678

ただし、*note timeit(): 107e. はコマンドラインインターフェイスを使った時
だけ繰り返し回数を自動で決定する事に注意してください。*note 使用例:
4825. 節でより高度な例を説明しています。


File: python.info,  Node: Python インターフェイス,  Next: コマンドラインインターフェイス<3>,  Prev: 基本的な例<3>,  Up: timeit --- 小さなコードスニペットの実行時間計測

5.27.6.2 Python インターフェイス
................................

このモジュールは 3 つの有用な関数と 1 つの公開クラスを持っています:

 -- の関数: timeit.timeit (stmt='pass', setup='pass', timer=<default
          timer>, number=1000000, globals=None)

     与えられた文、'setup' コードおよび 'timer' 関数で *note Timer:
     16e1. インスタンスを作成し、その *note timeit(): ee9. メソッドを
     'number' 回実行します。 任意の 'globals' 引数はコードを実行する名前
     空間を指定します。

     バージョン 3.5 で変更: 任意の 'globals' 引数が追加されました。

 -- の関数: timeit.repeat (stmt='pass', setup='pass', timer=<default
          timer>, repeat=5, number=1000000, globals=None)

     与えられた文、'setup' コードおよび 'timer' 関数で *note Timer:
     16e1. インスタンスを作成し、その *note repeat(): 4828. メソッドを
     'repeat' 回繰り返すのを 'number' 回実行します。 任意の 'globals' 引
     数はコードを実行する名前空間を指定します。

     バージョン 3.5 で変更: 任意の 'globals' 引数が追加されました。

     バージョン 3.7 で変更: 'repeat' のデフォルト値が 3 から 5 へ変更さ
     れました。

 -- の関数: timeit.default_timer ()

     浮動小数点数の秒数を返すデフォルトのタイマーで、常に
     time.perf_counter() でとなります。代わりに、 time.perf_counter_ns は
     整数のナノ秒を返します。

     バージョン 3.3 で変更: デフォルトのタイマーが *note
     time.perf_counter(): c7a. になりました。

 -- クラス: timeit.Timer (stmt='pass', setup='pass', timer=<timer
          function>, globals=None)

     小さなコード片の実行時間を計測するためのクラスです。

     コンストラクターは計測する文、セットアップのための追加の文、ならび
     にタイマー関数を取ります。 両文のデフォルトは ‘'pass'’ です。 タイ
     マー関数はプラットフォーム依存です (モジュールの doctring を参照)。
     'stmt' および 'setup' には、複数行の文字列リテラルを含まない限り、
     ‘;’ や改行で区切られた複数の文でも構いません。 デフォルトでは文は
     timeit の名前空間内で実行されます。 この挙動は名前空間を 'globals'
     に渡すことで制御出来ます。

     最初の命令文の実行時間を計測するには、*note timeit(): ee9. メソッド
     を使用します。*note repeat(): 4828. と *note autorange(): ee8. メソ
     ッドは *note timeit(): ee9. を複数回呼び出したい時に使用します。

     'setup' の実行時間は全実行時間から除外されています。

     'stmt' および 'setup' パラメータは、引数なしの呼び出し可能オブジェ
     クトをとることもできます。呼び出し可能オブジェクトを指定すると、そ
     のオブジェクトの呼び出しがタイマー関数に埋め込まれ、その関数が
     *note timeit(): ee9. メソッドによって実行されます。この場合、関数呼
     び出しが増えるためにタイミングのオーバーヘッドが少し増える点に注意
     してください。

     バージョン 3.5 で変更: 任意の 'globals' 引数が追加されました。

      -- メソッド: timeit (number=1000000)

          メイン文を 'number' 回実行した時間を計測します。このメソッドは
          セットアップ文を1回だけ実行し、メイン文を指定回数実行するのに
          かかった時間を返します。デフォルトのタイマーは秒数を浮動小数点
          数で返します。引数はループを何回実行するかの指定で、デフォルト
          値は 100万回です。メイン文、セットアップ文、タイマー関数はコン
          ストラクターで指定されたものを使用します。

               注釈: デフォルトでは、*note timeit(): ee9. は計測中、一時
               的に *note ガベージコレクション: 17d8. を停止します。 こ
               の手法の利点は個々の計測結果がより比較しやすくなることで
               す。 欠点は、ガベージコレクションが計測される関数の性能の
               重要な要素である場合があることです。 その場合、'setup' 文
               字列の最初の文でガベージコレクションを有効にできます。 以
               下に例を示します:

                    timeit.Timer('for i in range(10): oct(i)', 'gc.enable()').timeit()

      -- メソッド: autorange (callback=None)

          *note timeit(): ee9. を呼び出す回数を自動的に決定します。

          これは総時間が0.2秒以上になるように *note timeit(): ee9. を繰
          り返し呼び出す便利な関数で、最終的な結果（ループ回数、ループ回
          数に要した時間）を返します。 要した時間が少なくとも0.2秒になる
          まで、シーケンス1, 2, 5, 10, 20, 50, ...  から増加する回数で
          *note timeit(): ee9. を呼び出します。

          'callback' が与えられ、Noneでない場合は、 callback(number,
          time_taken) という2つの引数を指定して試行された後に呼び出され
          ます。

          Added in version 3.6.

      -- メソッド: repeat (repeat=5, number=1000000)

          *note timeit(): ee9. を複数回繰り返します。

          これは *note timeit(): ee9. を繰り返し呼び出したい時に有用で、
          結果をリストにして返します。最初の引数で何回 *note timeit():
          ee9. を呼ぶか指定します。第 2 引数で *note timeit(): ee9. の引
          数 'number' を指定します。

               注釈: 結果のベクトルから平均値や標準偏差を計算して出力さ
               せたいと思うかもしれませんが、それはあまり意味がありませ
               ん。多くの場合、最も低い値がそのマシンが与えられたコード
               断片を実行する場合の下限値です。結果のうち高めの値は、
               Python のスピードが一定しないために生じたものではなく、そ
               の他の計測精度に影響を及ぼすプロセスによるものです。した
               がって、結果のうち *note min(): 110b. だけが見るべき値と
               なるでしょう。この点を押さえた上で、統計的な分析よりも常
               識的な判断で結果を見るようにしてください。

          バージョン 3.7 で変更: 'repeat' のデフォルト値が 3 から 5 へ変
          更されました。

      -- メソッド: print_exc (file=None)

          計測対象コードのトレースバックを出力するためのヘルパーです。

          利用例:

               t = Timer(...)       # outside the try/except
               try:
                   t.timeit(...)    # or t.repeat(...)
               except Exception:
                   t.print_exc()

          これの標準のトレースバックより優れた点は、コンパイルしたテンプ
          レートのソース行が表示されることです。オプションの引数 'file'
          にはトレースバックの出力先を指定します。デフォルトは *note
          sys.stderr: b33. になります。


File: python.info,  Node: コマンドラインインターフェイス<3>,  Next: 使用例<44>,  Prev: Python インターフェイス,  Up: timeit --- 小さなコードスニペットの実行時間計測

5.27.6.3 コマンドラインインターフェイス
.......................................

コマンドラインからプログラムとして呼び出す場合は、次の書式を使います:

     python -m timeit [-n N] [-r N] [-u U] [-s S] [-p] [-v] [-h] [statement ...]

以下のオプションが使用できます:

 -- Option: -n N, --number=N

     'statement' を実行する回数

 -- Option: -r N, --repeat=N

     timer を繰り返す回数（デフォルトは5）

 -- Option: -s S, --setup=S

     最初に1回だけ実行する文 (デフォルトは ‘pass’)

 -- Option: -p, --process

     デフォルトの *note time.perf_counter(): c7a. の代わり *note
     time.process_time(): c7b. を利用して、実時間ではなくプロセス時間を
     計測します

     Added in version 3.3.

 -- Option: -u, --unit=U

     timer 出力の時間の単位を指定します。 ‘nsec’、‘usec’、‘msec’、‘sec’
     を選択できます。

     Added in version 3.5.

 -- Option: -v, --verbose

     時間計測の結果をそのまま詳細な数値でくり返し表示する

 -- Option: -h, --help

     簡単な使い方を表示して終了する

文は複数行指定することもできます。その場合、各行は独立した文として引数に
指定されたものとして処理します。クォートと行頭のスペースを使って、インデ
ントした文を使うことも可能です。この複数行のオプションは *note -s: 4830.
においても同じ形式で指定可能です。

オプション *note -n: 482c. でループの回数が指定されていない場合、1, 2,
5, 10, 20, 50, ...  という数列で、少なくとも総時間が 0.2 秒になるまで回
数を増やしていって、適切なループ回数が計算されます。

*note default_timer(): 4829. の測定値は、同じマシン上で実行されている他
のプログラムの影響を受ける可能性があるため、正確な時間計測が必要な場合は
、計測を数回繰り返し、最適な時間を使用することをおすすめします。 *note
-r: 482e. オプションはこれに適しています。ほとんどの場合、デフォルトの
5回の繰り返しで十分でしょう。 *note time.process_time(): c7b. を使用すれ
ばCPU時間を測定できます。

     注釈: pass 文の実行には基本的なオーバーヘッドが存在します。ここにあ
     るコードはこの事実を隠そうとはしていませんが、注意する必要がありま
     す。基本的なオーバーヘッドは引数なしでプログラムを起動することによ
     り計測でき、それは Python のバージョンによって異なるでしょう。


File: python.info,  Node: 使用例<44>,  Prev: コマンドラインインターフェイス<3>,  Up: timeit --- 小さなコードスニペットの実行時間計測

5.27.6.4 使用例
...............

最初に 1 回だけ実行されるセットアップ文を指定することが可能です:

     $ python -m timeit -s "text = 'sample string'; char = 'g'" "char in text"
     5000000 loops, best of 5: 0.0877 usec per loop
     $ python -m timeit -s "text = 'sample string'; char = 'g'" "text.find(char)"
     1000000 loops, best of 5: 0.342 usec per loop

出力には、3つのフィールドがあります。ループ回数は、ループの反復ごとに何
回文の内容が実行されたかを示します。反復回数 ('best of 5') は計時ループ
が何回繰り返されたかを示し、最後に文の内容が平均して計時ループの中の最良
の反復で要した時間を示します。つまり、最速の反復をループ回数で割った時間
です。

     >>> import timeit
     >>> timeit.timeit('char in text', setup='text = "sample string"; char = "g"')
     0.41440500499993504
     >>> timeit.timeit('text.find(char)', setup='text = "sample string"; char = "g"')
     1.7246671520006203

同じことは *note Timer: 16e1. クラスとそのメソッドを使用して行うこともで
きます:

     >>> import timeit
     >>> t = timeit.Timer('char in text', setup='text = "sample string"; char = "g"')
     >>> t.timeit()
     0.3955516149999312
     >>> t.repeat()
     [0.40183617287970225, 0.37027556854118704, 0.38344867356679524, 0.3712595970846668, 0.37866875250654886]

以下の例は、複数行を含んだ式を計測する方法を示しています。ここでは、オブ
ジェクトの存在する属性と存在しない属性に対してテストするために *note
hasattr(): 6f9. と *note try: 8f8./*note except: 1ab. を使用した場合のコ
ストを比較しています:

     $ python -m timeit "try:" "  str.__bool__" "except AttributeError:" "  pass"
     20000 loops, best of 5: 15.7 usec per loop
     $ python -m timeit "if hasattr(str, '__bool__'): pass"
     50000 loops, best of 5: 4.26 usec per loop

     $ python -m timeit "try:" "  int.__bool__" "except AttributeError:" "  pass"
     200000 loops, best of 5: 1.43 usec per loop
     $ python -m timeit "if hasattr(int, '__bool__'): pass"
     100000 loops, best of 5: 2.23 usec per loop

     >>> import timeit
     >>> # attribute is missing
     >>> s = """\
     ... try:
     ...     str.__bool__
     ... except AttributeError:
     ...     pass
     ... """
     >>> timeit.timeit(stmt=s, number=100000)
     0.9138244460009446
     >>> s = "if hasattr(str, '__bool__'): pass"
     >>> timeit.timeit(stmt=s, number=100000)
     0.5829014980008651
     >>>
     >>> # attribute is present
     >>> s = """\
     ... try:
     ...     int.__bool__
     ... except AttributeError:
     ...     pass
     ... """
     >>> timeit.timeit(stmt=s, number=100000)
     0.04215312199994514
     >>> s = "if hasattr(int, '__bool__'): pass"
     >>> timeit.timeit(stmt=s, number=100000)
     0.08588060699912603

To give the ‘timeit’ module access to functions you define, you can pass
a 'setup' parameter which contains an import statement:

     def test():
         """Stupid test function"""
         L = [i for i in range(100)]

     if __name__ == '__main__':
         import timeit
         print(timeit.timeit("test()", setup="from __main__ import test"))

他のオプションは *note globals(): 1c0a. を 'globals' 引数に渡すことです
。 これによりコードはあなたのグローバル名前空間内で実行されます。 これは
それぞれでインポートするより 便利です:

     def f(x):
         return x**2
     def g(x):
         return x**4
     def h(x):
         return x**8

     import timeit
     print(timeit.timeit('[func(42) for func in (f,g,h)]', globals=globals()))


File: python.info,  Node: trace --- Python 文実行のトレースと追跡,  Next: tracemalloc --- メモリ割り当ての追跡,  Prev: timeit --- 小さなコードスニペットの実行時間計測,  Up: デバッグとプロファイル

5.27.7 ‘trace’ -- Python 文実行のトレースと追跡
-----------------------------------------------

'ソースコード:' Lib/trace.py(1)

__________________________________________________________________

The ‘trace’ module allows you to trace program execution, generate
annotated statement coverage listings, print caller/callee relationships
and list functions executed during a program run.  It can be used in
another program or from the command line.

参考
....

Coverage.py(2)

     サードパーティの人気なカバレッジツールで、 HTML 出力に加えて分岐カ
     バレッジのような高度な機能も提供しています。

* Menu:

* コマンドラインからの使用: コマンドラインからの使用<2>.
* プログラミングインターフェース::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/trace.py

   (2) https://coverage.readthedocs.io/


File: python.info,  Node: コマンドラインからの使用<2>,  Next: プログラミングインターフェース,  Up: trace --- Python 文実行のトレースと追跡

5.27.7.1 コマンドラインからの使用
.................................

The ‘trace’ module can be invoked from the command line.  It can be as
simple as

     python -m trace --count -C . somefile.py ...

これで、 ‘somefile.py’ の実行中に import された Python モジュールの注釈
付きリストがカレントディレクトリに生成されます。

 -- Option: --help

     使い方を表示して終了します。

 -- Option: --version

     モジュールのバージョンを表示して終了します。

Added in version 3.8: Added ‘--module’ option that allows running an
executable module.

* Menu:

* 主要なオプション::
* 修飾的オプション::
* フィルターオプション::


File: python.info,  Node: 主要なオプション,  Next: 修飾的オプション,  Up: コマンドラインからの使用<2>

5.27.7.2 主要なオプション
.........................

At least one of the following options must be specified when invoking
‘trace’.  The *note -listfuncs: 4843. option is mutually exclusive with
the *note -trace: 4844. and *note -count: 4845. options.  When *note
-listfuncs: 4843. is provided, neither *note -count: 4845. nor *note
-trace: 4844. are accepted, and vice versa.

 -- Option: -c, --count

     プログラム完了時に、それぞれの文が何回実行されたかを示す注釈付きリ
     ストのファイルを生成します。下記の *note -coverdir: 4847, *note
     -file: 4848, *note -no-report: 4849. も参照してください。

 -- Option: -t, --trace

     実行された通りに行を表示します。

 -- Option: -l, --listfuncs

     プログラム実行の際に実行された関数を表示します。

 -- Option: -r, --report

     *note -count: 4845. と *note -file: 4848. 引数を使った過去のプログ
     ラム実行結果から、注釈付きリストのファイルを生成します。コードを実
     行するわけではありません。

 -- Option: -T, --trackcalls

     プログラム実行によって明らかになった呼び出しの関係を表示します。


File: python.info,  Node: 修飾的オプション,  Next: フィルターオプション,  Prev: 主要なオプション,  Up: コマンドラインからの使用<2>

5.27.7.3 修飾的オプション
.........................

 -- Option: -f, --file=<file>

     複数回にわたるトレース実行についてカウント (count) を累積するファイ
     ルに名前をつけます。 *note -count: 4845. オプションと一緒に使って下
     さい。

 -- Option: -C, --coverdir=<dir>

     レポートファイルを保存するディレクトリを指定します。
     ‘package.module’ についてのカバレッジレポートは
     ‘`dir'/`package'/`module'.cover’ に書き込まれます。

 -- Option: -m, --missing

     注釈付きリストの生成時に、実行されなかった行に ‘>>>>>>’ の印を付け
     ます。

 -- Option: -s, --summary

     *note -count: 4845. または *note -report: 484c. の利用時に、処理さ
     れたファイルそれぞれの簡潔な概要を標準出力 (stdout) に書き出します
     。

 -- Option: -R, --no-report

     注釈付きリストを生成しません。これは *note -count: 4845. を何度か走
     らせてから最後に単一の注釈付きリストを生成するような場合に便利です
     。

 -- Option: -g, --timing

     各行の先頭にプログラム開始からの時間を付けます。トレース中にだけ使
     われます。


File: python.info,  Node: フィルターオプション,  Prev: 修飾的オプション,  Up: コマンドラインからの使用<2>

5.27.7.4 フィルターオプション
.............................

これらのオプションは複数回指定できます。

 -- Option: --ignore-module=<mod>

     指定されたモジュールと（パッケージだった場合は）そのサブモジュール
     を無視します。引数はカンマ区切りのモジュール名リストです。

 -- Option: --ignore-dir=<dir>

     指定されたディレクトリとサブディレクトリ中のモジュールとパッケージ
     を全て無視します。引数は *note os.pathsep: 2134. で区切られたディレ
     クトリのリストです。


File: python.info,  Node: プログラミングインターフェース,  Prev: コマンドラインからの使用<2>,  Up: trace --- Python 文実行のトレースと追跡

5.27.7.5 プログラミングインターフェース
.......................................

 -- クラス: trace.Trace (count=1, trace=1, countfuncs=0, countcallers=0,
          ignoremods=(), ignoredirs=(), infile=None, outfile=None,
          timing=False)

     文 (statement) や式 (expression) の実行をトレースするオブジェクトを
     作成します。引数は全てオプションです。'count' は行数を数えます。
     'trace' は行実行のトレースを行います。'countfuncs' は実行中に呼ばれ
     た関数を列挙します。'countcallers' は呼び出しの関係を追跡します。
     'ignoremods' は無視するモジュールやパッケージのリストです。
     'ignoredirs' は無視するパッケージやモジュールを含むディレクトリのリ
     ストです。'infile' は保存された集計 (count) 情報を読むファイルの名
     前です。'outfile' は更新された集計 (count) 情報を書き出すファイルの
     名前です。'timing' は、タイムスタンプをトレース開始時点からの相対秒
     数で表示します。

      -- メソッド: run (cmd)

          コマンドを実行して、現在のトレースパラメータに基づいてその実行
          から統計情報を集めます。 'cmd' は、 *note exec(): 4a2. に渡せ
          るような文字列か code オブジェクトです。

      -- メソッド: runctx (cmd, globals=None, locals=None)

          指定された globals と locals 環境下で、コマンドを実行して、現
          在のトレースパラメータに基づいてその実行から統計情報を集めます
          。定義しない場合、'globals' と 'locals' はデフォルトで空の辞書
          となります。

      -- メソッド: runfunc (func, /, *args, **kwds)

          与えられた引数の 'func' を、 *note Trace: 485f. オブジェクトの
          コントロール下で現在のトレースパラメタのもとに呼び出します。

      -- メソッド: results ()

          与えられた *note Trace: 485f. インスタンスの ‘run’, ‘runctx’,
          ‘runfunc’ の以前の呼び出しについて集計した結果を納めた *note
          CoverageResults: 4863. オブジェクトを返します。蓄積されたトレ
          ース結果はリセットしません。

 -- クラス: trace.CoverageResults

     カバレッジ結果のコンテナで、 *note Trace.results(): 4862. で生成さ
     れるものです。ユーザーが直接生成するものではありません。

      -- メソッド: update (other)

          別の *note CoverageResults: 4863. オブジェクトのデータを統合し
          ます。

      -- メソッド: write_results (show_missing=True, summary=False,
               coverdir=None, *, ignore_missing_files=False)

          カバレッジ結果を書き出します。ヒットしなかった行も出力するには
          'show_missing' を指定します。モジュールごとの概要を出力に含め
          るには 'summary' を指定します。'coverdir' に指定するのは結果フ
          ァイルを出力するディレクトリです。‘None’ の場合は各ソースファ
          イルごとの結果がそれぞれのディレクトリに置かれます。

          'ignore_missing_files' が ‘True’ の場合には、すでに存在しない
          ファイルのカバレッジカウントはサイレントに無視されます。そうで
          なければ、ファイルが見つからないと *note FileNotFoundError:
          264. が発生します。

          バージョン 3.13 で変更: 'ignore_missing_files' 引数が追加され
          ました。

簡単な例でプログラミングインターフェースの使い方を見てみましょう:

     import sys
     import trace

     # create a Trace object, telling it what to ignore, and whether to
     # do tracing or line-counting or both.
     tracer = trace.Trace(
         ignoredirs=[sys.prefix, sys.exec_prefix],
         trace=0,
         count=1)

     # run the new command using the given tracer
     tracer.run('main()')

     # make a report, placing output in the current directory
     r = tracer.results()
     r.write_results(show_missing=True, coverdir=".")


File: python.info,  Node: tracemalloc --- メモリ割り当ての追跡,  Prev: trace --- Python 文実行のトレースと追跡,  Up: デバッグとプロファイル

5.27.8 ‘tracemalloc’ -- メモリ割り当ての追跡
--------------------------------------------

Added in version 3.4.

'ソースコード:' Lib/tracemalloc.py(1)

__________________________________________________________________

tracemallocモジュールは、Python が割り当てたメモリブロックをトレースする
ためのデバッグツールです。このモジュールは以下の情報を提供します。

   * オブジェクトが割り当てられた場所のトレースバック

   * ファイル名ごと、及び行ごとに割り当てられたメモリブロックの以下の統
     計を取ります：総サイズ、ブロック数、割り当てられたブロックの平均サ
     イズ

   * メモリリークを検出するために2つのスナップショットの差を計算します。

Python が割り当てたメモリブロックの大半をトレースするには、 *note
PYTHONTRACEMALLOC: 212d. 環境変数を ‘1’ に設定して可能な限り早くモジュー
ルを開始させるか、*note -X: 16f. ‘tracemalloc’ コマンドラインオプション
を使用してください。実行時に *note tracemalloc.start(): 212c. を呼んで
Python のメモリ割り当てのトレースを開始することが出来ます。

デフォルトでは、割り当てられたメモリブロック1つのトレースは最新1フレーム
を保存します。開始時に25フレームを保存するには、 *note
PYTHONTRACEMALLOC: 212d. 環境変数を ‘25’ に設定するか、*note -X: 16f.
‘tracemalloc=25’ コマンドラインオプションを使用してください。

* Menu:

* 使用例: 使用例<45>.
* API::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/tracemalloc.py


File: python.info,  Node: 使用例<45>,  Next: API,  Up: tracemalloc --- メモリ割り当ての追跡

5.27.8.1 使用例
...............

* Menu:

* 上位10を表示する::
* 差を計算する::
* メモリブロックのトレースバックを取得する::
* top を整形化する::


File: python.info,  Node: 上位10を表示する,  Next: 差を計算する,  Up: 使用例<45>

5.27.8.2 上位10を表示する
.........................

最も多くのメモリを割り当てているファイル10を表示します:

     import tracemalloc

     tracemalloc.start()

     # ... run your application ...

     snapshot = tracemalloc.take_snapshot()
     top_stats = snapshot.statistics('lineno')

     print("[ Top 10 ]")
     for stat in top_stats[:10]:
         print(stat)

Python テストスイートの出力例です:

     [ Top 10 ]
     <frozen importlib._bootstrap>:716: size=4855 KiB, count=39328, average=126 B
     <frozen importlib._bootstrap>:284: size=521 KiB, count=3199, average=167 B
     /usr/lib/python3.4/collections/__init__.py:368: size=244 KiB, count=2315, average=108 B
     /usr/lib/python3.4/unittest/case.py:381: size=185 KiB, count=779, average=243 B
     /usr/lib/python3.4/unittest/case.py:402: size=154 KiB, count=378, average=416 B
     /usr/lib/python3.4/abc.py:133: size=88.7 KiB, count=347, average=262 B
     <frozen importlib._bootstrap>:1446: size=70.4 KiB, count=911, average=79 B
     <frozen importlib._bootstrap>:1454: size=52.0 KiB, count=25, average=2131 B
     <string>:5: size=49.7 KiB, count=148, average=344 B
     /usr/lib/python3.4/sysconfig.py:411: size=48.0 KiB, count=1, average=48.0 KiB

Python がモジュールから ‘4855 KiB’ のデータ (バイトコードで定数) を読み
込んでいることと、*note collections: 1e. モジュールが *note namedtuple:
4e0. 型をビルドするのに ‘244 KiB’ を割り当てていることが分かります。

オプションの詳細については *note Snapshot.statistics(): 486b. を参照して
ください。


File: python.info,  Node: 差を計算する,  Next: メモリブロックのトレースバックを取得する,  Prev: 上位10を表示する,  Up: 使用例<45>

5.27.8.3 差を計算する
.....................

スナップショットを2つ取り、差を表示します:

     import tracemalloc
     tracemalloc.start()
     # ... start your application ...

     snapshot1 = tracemalloc.take_snapshot()
     # ... call the function leaking memory ...
     snapshot2 = tracemalloc.take_snapshot()

     top_stats = snapshot2.compare_to(snapshot1, 'lineno')

     print("[ Top 10 differences ]")
     for stat in top_stats[:10]:
         print(stat)

Python テストスイートのテストを実行する前後の出力例です:

     [ Top 10 differences ]
     <frozen importlib._bootstrap>:716: size=8173 KiB (+4428 KiB), count=71332 (+39369), average=117 B
     /usr/lib/python3.4/linecache.py:127: size=940 KiB (+940 KiB), count=8106 (+8106), average=119 B
     /usr/lib/python3.4/unittest/case.py:571: size=298 KiB (+298 KiB), count=589 (+589), average=519 B
     <frozen importlib._bootstrap>:284: size=1005 KiB (+166 KiB), count=7423 (+1526), average=139 B
     /usr/lib/python3.4/mimetypes.py:217: size=112 KiB (+112 KiB), count=1334 (+1334), average=86 B
     /usr/lib/python3.4/http/server.py:848: size=96.0 KiB (+96.0 KiB), count=1 (+1), average=96.0 KiB
     /usr/lib/python3.4/inspect.py:1465: size=83.5 KiB (+83.5 KiB), count=109 (+109), average=784 B
     /usr/lib/python3.4/unittest/mock.py:491: size=77.7 KiB (+77.7 KiB), count=143 (+143), average=557 B
     /usr/lib/python3.4/urllib/parse.py:476: size=71.8 KiB (+71.8 KiB), count=969 (+969), average=76 B
     /usr/lib/python3.4/contextlib.py:38: size=67.2 KiB (+67.2 KiB), count=126 (+126), average=546 B

Python がモジュールデータ ‘8173 KiB’ (バイトコードと定数) を読み込み、 前
回スナップショットを取ったとき、すなわちテストの前に読み込んだ量より
‘4428 KiB’ 多いということが分かります。 同様に、 *note linecache: 89. モ
ジュールはトレースバックの書式化に Python ソースコード ‘940 KiB’ をキャ
ッシュし、その全ては前回のスナップショットの後に行われたことが分かります
。

システムに空きメモリがほとんどない場合、スナップショットをオフラインで解
析するための *note Snapshot.dump(): 486d. メソッドを使用して、スナップシ
ョットをディスクに書き込むことが出来ます。 そして *note Snapshot.load():
486e. メソッドを使用してスナップショットを再読み込みします。


File: python.info,  Node: メモリブロックのトレースバックを取得する,  Next: top を整形化する,  Prev: 差を計算する,  Up: 使用例<45>

5.27.8.4 メモリブロックのトレースバックを取得する
.................................................

最大のメモリブロックのトレースバックを表示するコードです:

     import tracemalloc

     # Store 25 frames
     tracemalloc.start(25)

     # ... run your application ...

     snapshot = tracemalloc.take_snapshot()
     top_stats = snapshot.statistics('traceback')

     # pick the biggest memory block
     stat = top_stats[0]
     print("%s memory blocks: %.1f KiB" % (stat.count, stat.size / 1024))
     for line in stat.traceback.format():
         print(line)

Python テストスイートの出力例です (トレースバックは 25 フレームに制限さ
れています):

     903 memory blocks: 870.1 KiB
       File "<frozen importlib._bootstrap>", line 716
       File "<frozen importlib._bootstrap>", line 1036
       File "<frozen importlib._bootstrap>", line 934
       File "<frozen importlib._bootstrap>", line 1068
       File "<frozen importlib._bootstrap>", line 619
       File "<frozen importlib._bootstrap>", line 1581
       File "<frozen importlib._bootstrap>", line 1614
       File "/usr/lib/python3.4/doctest.py", line 101
         import pdb
       File "<frozen importlib._bootstrap>", line 284
       File "<frozen importlib._bootstrap>", line 938
       File "<frozen importlib._bootstrap>", line 1068
       File "<frozen importlib._bootstrap>", line 619
       File "<frozen importlib._bootstrap>", line 1581
       File "<frozen importlib._bootstrap>", line 1614
       File "/usr/lib/python3.4/test/support/__init__.py", line 1728
         import doctest
       File "/usr/lib/python3.4/test/test_pickletools.py", line 21
         support.run_doctest(pickletools)
       File "/usr/lib/python3.4/test/regrtest.py", line 1276
         test_runner()
       File "/usr/lib/python3.4/test/regrtest.py", line 976
         display_failure=not verbose)
       File "/usr/lib/python3.4/test/regrtest.py", line 761
         match_tests=ns.match_tests)
       File "/usr/lib/python3.4/test/regrtest.py", line 1563
         main()
       File "/usr/lib/python3.4/test/__main__.py", line 3
         regrtest.main_in_temp_cwd()
       File "/usr/lib/python3.4/runpy.py", line 73
         exec(code, run_globals)
       File "/usr/lib/python3.4/runpy.py", line 160
         "__main__", fname, loader, pkg_name)

We can see that the most memory was allocated in the *note importlib:
7b. module to load data (bytecode and constants) from modules: ‘870.1
KiB’.  The traceback is where the *note importlib: 7b. loaded data most
recently: on the ‘import pdb’ line of the *note doctest: 3e. module.
The traceback may change if a new module is loaded.


File: python.info,  Node: top を整形化する,  Prev: メモリブロックのトレースバックを取得する,  Up: 使用例<45>

5.27.8.5 top を整形化する
.........................

‘<frozen importlib._bootstrap>’ および ‘<unknown>’ ファイルを無視して、
メモリ割り当て量の上位10を整形化して表示するコードです:

     import linecache
     import os
     import tracemalloc

     def display_top(snapshot, key_type='lineno', limit=10):
         snapshot = snapshot.filter_traces((
             tracemalloc.Filter(False, "<frozen importlib._bootstrap>"),
             tracemalloc.Filter(False, "<unknown>"),
         ))
         top_stats = snapshot.statistics(key_type)

         print("Top %s lines" % limit)
         for index, stat in enumerate(top_stats[:limit], 1):
             frame = stat.traceback[0]
             print("#%s: %s:%s: %.1f KiB"
                   % (index, frame.filename, frame.lineno, stat.size / 1024))
             line = linecache.getline(frame.filename, frame.lineno).strip()
             if line:
                 print('    %s' % line)

         other = top_stats[limit:]
         if other:
             size = sum(stat.size for stat in other)
             print("%s other: %.1f KiB" % (len(other), size / 1024))
         total = sum(stat.size for stat in top_stats)
         print("Total allocated size: %.1f KiB" % (total / 1024))

     tracemalloc.start()

     # ... run your application ...

     snapshot = tracemalloc.take_snapshot()
     display_top(snapshot)

Python テストスイートの出力例です:

     Top 10 lines
     #1: Lib/base64.py:414: 419.8 KiB
         _b85chars2 = [(a + b) for a in _b85chars for b in _b85chars]
     #2: Lib/base64.py:306: 419.8 KiB
         _a85chars2 = [(a + b) for a in _a85chars for b in _a85chars]
     #3: collections/__init__.py:368: 293.6 KiB
         exec(class_definition, namespace)
     #4: Lib/abc.py:133: 115.2 KiB
         cls = super().__new__(mcls, name, bases, namespace)
     #5: unittest/case.py:574: 103.1 KiB
         testMethod()
     #6: Lib/linecache.py:127: 95.4 KiB
         lines = fp.readlines()
     #7: urllib/parse.py:476: 71.8 KiB
         for a in _hexdig for b in _hexdig}
     #8: <string>:5: 62.0 KiB
     #9: Lib/_weakrefset.py:37: 60.0 KiB
         self.data = set()
     #10: Lib/base64.py:142: 59.8 KiB
         _b32tab2 = [a + b for a in _b32tab for b in _b32tab]
     6220 other: 3602.8 KiB
     Total allocated size: 5303.1 KiB

オプションの詳細については *note Snapshot.statistics(): 486b. を参照して
ください。

* Menu:

* Record the current and peak size of all traced memory blocks::


File: python.info,  Node: Record the current and peak size of all traced memory blocks,  Up: top を整形化する

5.27.8.6 Record the current and peak size of all traced memory blocks
.....................................................................

The following code computes two sums like ‘0 + 1 + 2 + ...’
inefficiently, by creating a list of those numbers.  This list consumes
a lot of memory temporarily.  We can use *note get_traced_memory():
4872. and *note reset_peak(): b35. to observe the small memory usage
after the sum is computed as well as the peak memory usage during the
computations:

     import tracemalloc

     tracemalloc.start()

     # Example code: compute a sum with a large temporary list
     large_sum = sum(list(range(100000)))

     first_size, first_peak = tracemalloc.get_traced_memory()

     tracemalloc.reset_peak()

     # Example code: compute a sum with a small temporary list
     small_sum = sum(list(range(1000)))

     second_size, second_peak = tracemalloc.get_traced_memory()

     print(f"{first_size=}, {first_peak=}")
     print(f"{second_size=}, {second_peak=}")

出力:

     first_size=664, first_peak=3592984
     second_size=804, second_peak=29704

Using *note reset_peak(): b35. ensured we could accurately record the
peak during the computation of ‘small_sum’, even though it is much
smaller than the overall peak size of memory blocks since the *note
start(): 212c. call.  Without the call to *note reset_peak(): b35,
‘second_peak’ would still be the peak from the computation ‘large_sum’
(that is, equal to ‘first_peak’).  In this case, both peaks are much
higher than the final memory usage, and which suggests we could optimise
(by removing the unnecessary call to *note list: 24d, and writing
‘sum(range(...))’).


File: python.info,  Node: API,  Prev: 使用例<45>,  Up: tracemalloc --- メモリ割り当ての追跡

5.27.8.7 API
............

* Menu:

* 関数: 関数<11>.
* DomainFilter::
* Filter::
* Frame::
* Snapshot::
* Statistic::
* StatisticDiff::
* Trace::
* Traceback::


File: python.info,  Node: 関数<11>,  Next: DomainFilter,  Up: API

5.27.8.8 関数
.............

 -- の関数: tracemalloc.clear_traces ()

     Python が割り当てたメモリブロックのトレースを消去します。

     *note stop(): 18ad. を参照してください。

 -- の関数: tracemalloc.get_object_traceback (obj)

     Get the traceback where the Python object 'obj' was allocated.
     Return a *note Traceback: d8f. instance, or ‘None’ if the
     ‘tracemalloc’ module is not tracing memory allocations or did not
     trace the allocation of the object.

     *note gc.get_referrers(): a05. や *note sys.getsizeof(): 1adb. 関数
     も参照してください。

 -- の関数: tracemalloc.get_traceback_limit ()

     トレースのトレースバック内に格納されている最大フレーム数を取得しま
     す。

     The ‘tracemalloc’ module must be tracing memory allocations to get
     the limit, otherwise an exception is raised.

     *note start(): 212c. 関数で上限を設定します。

 -- の関数: tracemalloc.get_traced_memory ()

     Get the current size and peak size of memory blocks traced by the
     ‘tracemalloc’ module as a tuple: ‘(current: int, peak: int)’.

 -- の関数: tracemalloc.reset_peak ()

     Set the peak size of memory blocks traced by the ‘tracemalloc’
     module to the current size.

     Do nothing if the ‘tracemalloc’ module is not tracing memory
     allocations.

     This function only modifies the recorded peak size, and does not
     modify or clear any traces, unlike *note clear_traces(): 4875.
     Snapshots taken with *note take_snapshot(): 4877. before a call to
     *note reset_peak(): b35. can be meaningfully compared to snapshots
     taken after the call.

     *note get_traced_memory(): 4872. も参照してください。

     Added in version 3.9.

 -- の関数: tracemalloc.get_tracemalloc_memory ()

     Get the memory usage in bytes of the ‘tracemalloc’ module used to
     store traces of memory blocks.  Return an *note int: 19b.

 -- の関数: tracemalloc.is_tracing ()

     ‘True’ if the ‘tracemalloc’ module is tracing Python memory
     allocations, ‘False’ otherwise.

     *note start(): 212c. ならびに *note stop(): 18ad. 関数も参照してく
     ださい。

 -- の関数: tracemalloc.start (nframe: int = 1)

     Python のメモリ割り当てのトレースを開始します: Python メモリアロケ
     ータにフックします。 トレースの収集されたトレースバックは 'nframe'
     フレームに制限されます。 デフォルトでは、あるブロックのトレースは最
     新のフレームのみを保存します、つまり上限は ‘1’ です。 'nframe' は
     ‘1’ 以上でなければなりません。

     You can still read the original number of total frames that
     composed the traceback by looking at the *note
     Traceback.total_nframe: 487a. attribute.

     ‘1’ より多くのフレームを保存するのは ‘'traceback'’ でグループ化され
     た統計や累積的な統計を計算する場合にのみ有用です。 *note
     Snapshot.compare_to(): 487b. および *note Snapshot.statistics():
     486b. メソッドを参照してください。

     Storing more frames increases the memory and CPU overhead of the
     ‘tracemalloc’ module.  Use the *note get_tracemalloc_memory():
     4878. function to measure how much memory is used by the
     ‘tracemalloc’ module.

     *note PYTHONTRACEMALLOC: 212d. 環境変数
     (‘PYTHONTRACEMALLOC=NFRAME’) と *note -X: 16f. ‘tracemalloc=NFRAME’
     コマンドラインオプションを使って実行開始時にトレースを始めることが
     出来ます。

     *note stop(): 18ad.、*note is_tracing(): 4879.、*note
     get_traceback_limit(): 4876. 関数を参照してください。

 -- の関数: tracemalloc.stop ()

     Python のメモリ割り当てのトレースを停止します。つまり、Python のメ
     モリ割り当てへのフックをアンインストールします。 Python が割り当て
     たメモリブロックについてこれまで集めたトレースも全てクリアします。

     トレースが全部クリアされる前にスナップショットを取りたい場合は
     *note take_snapshot(): 4877. 関数を呼んでください。

     *note start(): 212c.、*note is_tracing(): 4879.、*note
     clear_traces(): 4875. 関数も参照してください。

 -- の関数: tracemalloc.take_snapshot ()

     Python が割り当てたメモリブロックのトレースのスナップショットを取り
     ます。新しい *note Snapshot: 487c. インスタンスを返します。

     The snapshot does not include memory blocks allocated before the
     ‘tracemalloc’ module started to trace memory allocations.

     トレースのトレースバックは *note get_traceback_limit(): 4876. フレ
     ームに制限されています。より多くのフレームを保存するには *note
     start(): 212c. 関数の 'nframe' 引数を使用してください。

     The ‘tracemalloc’ module must be tracing memory allocations to take
     a snapshot, see the *note start(): 212c. function.

     *note get_object_traceback(): 1f39. 関数を参照してください。


File: python.info,  Node: DomainFilter,  Next: Filter,  Prev: 関数<11>,  Up: API

5.27.8.9 DomainFilter
.....................

 -- クラス: tracemalloc.DomainFilter (inclusive: bool, domain: int)

     Filter traces of memory blocks by their address space (domain).

     Added in version 3.6.

      -- の属性: inclusive

          If 'inclusive' is ‘True’ (include), match memory blocks
          allocated in the address space *note domain: 487f.

          If 'inclusive' is ‘False’ (exclude), match memory blocks not
          allocated in the address space *note domain: 487f.

      -- の属性: domain

          Address space of a memory block (‘int’).  Read-only property.


File: python.info,  Node: Filter,  Next: Frame,  Prev: DomainFilter,  Up: API

5.27.8.10 Filter
................

 -- クラス: tracemalloc.Filter (inclusive: bool, filename_pattern: str,
          lineno: int = None, all_frames: bool = False, domain: int =
          None)

     メモリブロックのトレースをフィルターします。

     'filename_pattern' のシンタックスについては *note
     fnmatch.fnmatch(): 1c54. 関数を参照してください。‘'.pyc'’ 拡張子は
     ‘'.py'’ に置換されます。

     例:

        * ‘Filter(True, subprocess.__file__)’ は *note subprocess: dc. モ
          ジュールのみを含みます

        * ‘Filter(False, tracemalloc.__file__)’ excludes traces of the
          ‘tracemalloc’ module

        * ‘Filter(False, "<unknown>")’ は空のトレースバックを除外します

     バージョン 3.5 で変更: ‘'.pyo'’ ファイル拡張子が ‘'.py'’ に置換され
     ることはもうありません。

     バージョン 3.6 で変更: *note domain: 4882. 属性が追加されました。

      -- の属性: domain

          Address space of a memory block (‘int’ or ‘None’).

          tracemalloc uses the domain ‘0’ to trace memory allocations
          made by Python.  C extensions can use other domains to trace
          other resources.

      -- の属性: inclusive

          If 'inclusive' is ‘True’ (include), only match memory blocks
          allocated in a file with a name matching *note
          filename_pattern: 4884. at line number *note lineno: 4885.

          If 'inclusive' is ‘False’ (exclude), ignore memory blocks
          allocated in a file with a name matching *note
          filename_pattern: 4884. at line number *note lineno: 4885.

      -- の属性: lineno

          フィルタの行番号です (‘int’)。'lineno' が ‘None’ の場合フィル
          タはあらゆる行番号にマッチします。

      -- の属性: filename_pattern

          フィルタのファイル名のパターンです (‘str’)。読み出し専用のプロ
          パティです。

      -- の属性: all_frames

          'all_frames' が ‘True’ の場合トレースバックの全てのフレームを
          チェックします。'all_frames' が ‘False’ の場合最新のフレームを
          チェックします。

          トレースバックの上限が ‘1’ の場合この属性の影響はありません。
          *note get_traceback_limit(): 4876. 関数と *note
          Snapshot.traceback_limit: 4887. 属性を参照してください。


File: python.info,  Node: Frame,  Next: Snapshot,  Prev: Filter,  Up: API

5.27.8.11 Frame
...............

 -- クラス: tracemalloc.Frame

     トレースバックのフレームです。

     *note Traceback: d8f. クラスは *note Frame: 4889. インスタンスのシ
     ークエンスです。

      -- の属性: filename

          ファイル名 (‘str’)。

      -- の属性: lineno

          行番号 (‘int’)。


File: python.info,  Node: Snapshot,  Next: Statistic,  Prev: Frame,  Up: API

5.27.8.12 Snapshot
..................

 -- クラス: tracemalloc.Snapshot

     Python が割り当てたメモリブロックのトレースのスナップショットです。

     *note take_snapshot(): 4877. 関数はスナップショットのインスタンスを
     作ります。

      -- メソッド: compare_to (old_snapshot: Snapshot, key_type: str,
               cumulative: bool = False)

          古いスナップショットとの差を計算します。 'key_type' でグループ
          化された *note StatisticDiff: 488d. インスタンスのソート済みリ
          ストとして統計を取得します。

          'key_type' および 'cumulative' 引数については *note
          Snapshot.statistics(): 486b. メソッドを参照してください。

          結果は降順でソートされます: キーは *note
          StatisticDiff.size_diff: 488e. の絶対値、 *note
          StatisticDiff.size: 488f.、 *note StatisticDiff.count_diff:
          4890. の絶対置、 *note Statistic.count: 4891.、そして *note
          StatisticDiff.traceback: 4892. です。

      -- メソッド: dump (filename)

          スナップショットをファイルに書き込みます。

          スナップショットをリロードするには *note load(): 486e. を使用
          します。

      -- メソッド: filter_traces (filters)

          Create a new *note Snapshot: 487c. instance with a filtered
          *note traces: 4894. sequence, 'filters' is a list of *note
          DomainFilter: eed. and *note Filter: 4881. instances.  If
          'filters' is an empty list, return a new *note Snapshot: 487c.
          instance with a copy of the traces.

          All inclusive filters are applied at once, a trace is ignored
          if no inclusive filters match it.  A trace is ignored if at
          least one exclusive filter matches it.

          バージョン 3.6 で変更: *note DomainFilter: eed. instances are
          now also accepted in 'filters'.

      -- メソッド: classmethod load (filename)

          スナップショットをファイルからロードします。

          *note dump(): 486d. を参照してください。

      -- メソッド: statistics (key_type: str, cumulative: bool = False)

          'key_type' でグループ化された *note Statistic: 4895. インスタ
          ンスのソート済みリストとして統計を取得します:

          key_type                  description
                                    
          -------------------------------------------------------
                                    
          ‘'filename'’              ファイル名
                                    
                                    
          ‘'lineno'’                ファイル名と行番号
                                    
                                    
          ‘'traceback'’             traceback
                                    

          If 'cumulative' is ‘True’, cumulate size and count of memory
          blocks of all frames of the traceback of a trace, not only the
          most recent frame.  The cumulative mode can only be used with
          'key_type' equal to ‘'filename'’ and ‘'lineno'’.

          結果は降順でソートされます: キーは *note Statistic.size: 4896,
          *note Statistic.count: 4891, *note Statistic.traceback: 4897.
          です。

      -- の属性: traceback_limit

          *note traces: 4894. のトレースバック内に保存されるフレーム数の
          最大値です。 スナップショットが取られたときの *note
          get_traceback_limit(): 4876. の結果です。

      -- の属性: traces

          Python が割り当てた全メモリブロックのトレースで、 *note Trace:
          4898. インスタンスのシークェンスです。

          シークェンスの順序は未定義です。統計のソート済みリストを取得す
          るには *note Snapshot.statistics(): 486b. を使用してください。


File: python.info,  Node: Statistic,  Next: StatisticDiff,  Prev: Snapshot,  Up: API

5.27.8.13 Statistic
...................

 -- クラス: tracemalloc.Statistic

     メモリ割り当ての統計です。

     *note Snapshot.statistics(): 486b. は *note Statistic: 4895. インス
     タンスの一覧を返します。

     *note StatisticDiff: 488d. クラスも参照してください。

      -- の属性: count

          メモリブロック数 (‘int’)。

      -- の属性: size

          メモリブロックのバイト単位の総サイズ (‘int’)。

      -- の属性: traceback

          メモリブロックが割り当てられているトレースバック。*note
          Traceback: d8f. インスタンス。


File: python.info,  Node: StatisticDiff,  Next: Trace,  Prev: Statistic,  Up: API

5.27.8.14 StatisticDiff
.......................

 -- クラス: tracemalloc.StatisticDiff

     新旧 *note Snapshot: 487c. インスタンスのメモリ割り当ての統計差です
     。

     *note Snapshot.compare_to(): 487b. は *note StatisticDiff: 488d. イ
     ンスタンスのリストを返します。 *note Statistic: 4895. クラスも参照
     してください。

      -- の属性: count

          新しいスナップショット内のメモリブロックの数 (‘int’) です。新
          しいスナップショット内でメモリブロックが解放された場合は ‘0’ で
          す。

      -- の属性: count_diff

          新旧スナップショットのメモリブロック数の差 (‘int’) です。メモ
          リブロックが新しいスナップショット内で割り当てられた場合は ‘0’
          です。

      -- の属性: size

          新しいスナップショット内のメモリブロックのバイト単位での総サイ
          ズ (‘int’) です。新しいスナップショット内でメモリブロックが解
          放された場合は ‘0’ です。

      -- の属性: size_diff

          新旧スナップショットのバイト単位での総サイズの差 (‘int’) です
          。メモリブロックが新しいスナップショット内で割り当てられた場合
          は ‘0’ です。

      -- の属性: traceback

          メモリブロックが割り当てられたトレースバックで、 *note
          Traceback: d8f. のインスタンスです。


File: python.info,  Node: Trace,  Next: Traceback,  Prev: StatisticDiff,  Up: API

5.27.8.15 Trace
...............

 -- クラス: tracemalloc.Trace

     メモリブロックをトレースします。

     *note Snapshot.traces: 4894. 属性は *note Trace: 4898. インスタンス
     のシークエンスです。

     バージョン 3.6 で変更: *note domain: 489d. 属性が追加されました。

      -- の属性: domain

          Address space of a memory block (‘int’).  Read-only property.

          tracemalloc uses the domain ‘0’ to trace memory allocations
          made by Python.  C extensions can use other domains to trace
          other resources.

      -- の属性: size

          メモリブロックのバイト単位のサイズ (‘int’)。

      -- の属性: traceback

          メモリブロックが割り当てられているトレースバック。*note
          Traceback: d8f. インスタンス。


File: python.info,  Node: Traceback,  Prev: Trace,  Up: API

5.27.8.16 Traceback
...................

 -- クラス: tracemalloc.Traceback

     Sequence of *note Frame: 4889. instances sorted from the oldest
     frame to the most recent frame.

     A traceback contains at least ‘1’ frame.  If the ‘tracemalloc’
     module failed to get a frame, the filename ‘"<unknown>"’ at line
     number ‘0’ is used.

     When a snapshot is taken, tracebacks of traces are limited to *note
     get_traceback_limit(): 4876. frames.  See the *note
     take_snapshot(): 4877. function.  The original number of frames of
     the traceback is stored in the *note Traceback.total_nframe: 487a.
     attribute.  That allows one to know if a traceback has been
     truncated by the traceback limit.

     The *note Trace.traceback: 489f. attribute is a *note Traceback:
     d8f. instance.

     バージョン 3.7 で変更: Frames are now sorted from the oldest to the
     most recent, instead of most recent to oldest.

      -- の属性: total_nframe

          Total number of frames that composed the traceback before
          truncation.  This attribute can be set to ‘None’ if the
          information is not available.

     バージョン 3.9 で変更: *note Traceback.total_nframe: 487a. 属性が追
     加されました。

      -- メソッド: format (limit=None, most_recent_first=False)

          Format the traceback as a list of lines.  Use the *note
          linecache: 89. module to retrieve lines from the source code.
          If 'limit' is set, format the 'limit' most recent frames if
          'limit' is positive.  Otherwise, format the ‘abs(limit)’
          oldest frames.  If 'most_recent_first' is ‘True’, the order of
          the formatted frames is reversed, returning the most recent
          frame first instead of last.

          Similar to the *note traceback.format_tb(): 48a1. function,
          except that *note format(): d90. does not include newlines.

          以下はプログラム例です:

               print("Traceback (most recent call first):")
               for line in traceback:
                   print(line)

          出力:

               Traceback (most recent call first):
                 File "test.py", line 9
                   obj = Object()
                 File "test.py", line 12
                   tb = tracemalloc.get_object_traceback(f())


File: python.info,  Node: ソフトウェア・パッケージと配布,  Next: Python ランタイムサービス,  Prev: デバッグとプロファイル,  Up: Python 標準ライブラリ

5.28 ソフトウェア・パッケージと配布
===================================

以下のライブラリは Python で書かれたソフトウェアを配布、インストールする
ためのものです。これらのモジュールは Python Package Index(1) に対して動
作するように設計されていますが、ローカルのインデックスサーバーや、インデ
ックスサーバーなしに使うこともできます。

* Menu:

* ensurepip: ensurepip --- pip インストーラーのブートストラップ. pip インストーラーのブートストラップ
* venv: venv --- 仮想環境の作成. 仮想環境の作成
* zipapp: zipapp --- 実行可能な Python zip アーカイブを管理する. 実行可能な Python zip アーカイブを管理する

   ---------- Footnotes ----------

   (1) https://pypi.org


File: python.info,  Node: ensurepip --- pip インストーラーのブートストラップ,  Next: venv --- 仮想環境の作成,  Up: ソフトウェア・パッケージと配布

5.28.1 ‘ensurepip’ -- ‘pip’ インストーラーのブートストラップ
------------------------------------------------------------

Added in version 3.4.

'ソースコード:' Lib/ensurepip(1)

__________________________________________________________________

The ‘ensurepip’ package provides support for bootstrapping the ‘pip’
installer into an existing Python installation or virtual environment.
This bootstrapping approach reflects the fact that ‘pip’ is an
independent project with its own release cycle, and the latest available
stable version is bundled with maintenance and feature releases of the
CPython reference interpreter.

ほとんどの場合、Python のエンドユーザーがこのモジュールを直接呼び出す必
要はないでしょう(‘pip’ はデフォルトでブートストラップされるからです)。し
かし、もし Python のインストール時に ‘pip’ のインストールをスキップした
り、仮想環境を構築したり、明示的に ‘pip’ をアンインストールした場合、直
接呼び出す必要があるかもしれません。

     注釈: このモジュールはインターネットに 'アクセスしません'。‘pip’ の
     ブートストラップに必要な全てはこのパッケージの一部として含まれてい
     ます。

This is an *note optional module: 215a.  If it is missing from your copy
of CPython, look for documentation from your distributor (that is,
whoever provided Python to you).  If you are the distributor, see *note
オプションのモジュールの要件: 2158.

参考
....

*note Python モジュールのインストール: 10f8.

     エンドユーザーが Python パッケージをインストールする際のガイドです
     。

PEP 453(2): Python インストールの際の明示的なpipのブートストラッピング

     このモジュールのもともとの論拠と仕様。

*note Availability: 213f.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 225c. と *note
WebAssemblyプラットフォーム: 1b6a. をサポートしません。

* Menu:

* コマンドライン・インターフェース: コマンドライン・インターフェース<9>.
* モジュール API::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/ensurepip

   (2) https://peps.python.org/pep-0453/


File: python.info,  Node: コマンドライン・インターフェース<9>,  Next: モジュール API,  Up: ensurepip --- pip インストーラーのブートストラップ

5.28.1.1 コマンドライン・インターフェース
.........................................

コマンドラインインターフェースを起動するには ‘-m’ スイッチをつけてインタ
ープリターを使用します。

最も簡単な起動方法は:

     python -m ensurepip

この起動方法は ‘pip’ をインストールします。既にインストールされていた場
合は何もしません。インストールされた ‘pip’ のバージョンを ‘ensurepip’ で
利用できるもののうち、できるだけ新しいものにするためには、‘--upgrade’ オ
プションを追加して:

     python -m ensurepip --upgrade

デフォルトでは、‘pip’ は現在の仮想環境(もしアクティブなら)か、システムの
サイトパッケージ(もしアクティブな仮想環境がなければ)にインストールされま
す。インストール先は２つの追加コマンドラインオプションで制御できます:

 -- Option: --root <dir>

     Installs ‘pip’ relative to the given root directory rather than the
     root of the currently active virtual environment (if any) or the
     default root for the current Python installation.

 -- Option: --user

     Installs ‘pip’ into the user site packages directory rather than
     globally for the current Python installation (this option is not
     permitted inside an active virtual environment).

デフォルトでは ‘pipX’ と ‘pipX.Y’ がインストールされます(X.Yは
‘ensurepip’ を起動したPythonのバージョン)。インストールされるスクリプト
は2つの追加コマンドラインオプションで制御できます:

 -- Option: --altinstall

     If an alternate installation is requested, the ‘pipX’ script will
     'not' be installed.

 -- Option: --default-pip

     If a "default pip" installation is requested, the ‘pip’ script will
     be installed in addition to the two regular scripts.

2つのスクリプト選択オプションを指定すると例外が発生します。


File: python.info,  Node: モジュール API,  Prev: コマンドライン・インターフェース<9>,  Up: ensurepip --- pip インストーラーのブートストラップ

5.28.1.2 モジュール API
.......................

‘ensurepip’ exposes two functions for programmatic use:

 -- の関数: ensurepip.version ()

     環境にブートストラップする際にインストールされることになる利用可能
     な pip のバージョンを示す文字列を返します。

 -- の関数: ensurepip.bootstrap (root=None, upgrade=False, user=False,
          altinstall=False, default_pip=False, verbosity=0)

     現在の環境あるいは指示された環境へ ‘pip’ をブートストラップします。

     'root' で、インストールの root ディレクトリを変更します。 'root' が
     ‘None’ の場合は、インストールは現在の環境でのデフォルトの場所を使い
     ます。

     'upgrade' で、 ‘pip’ の利用可能なバージョンとして、インストール済み
     の以前のバージョンをアップグレードするかどうかを指定します。

     'user' で、グローバルなインストールではなく user スキームを使うかど
     うかを指定します。

     デフォルトではスクリプト ‘pipX’ と ‘pipX.Y’ はインストールされます
     (X.YはPythonの現在のバージョンです)。

     'altinstall' が設定されていた場合は ‘pipX’ はインストール 'されませ
     ん'。

     'default_pip' がセットされていれば、 ‘pip’ スクリプトが2つの標準ス
     クリプトと共にインストールされます。

     'altinstall' と 'default_pip' の両方を指定すると、 *note
     ValueError: 2ec. を起こします。

     'verbosity' でブートストラップ操作からの *note sys.stdout: ccd. へ
     の出力の冗長レベルをコントロールします。

     引数 ‘root’ 付きで *note 監査イベント: 1c6e. ‘ensurepip.bootstrap’
     を送出します。

          注釈: ブートストラップ処理は ‘sys.path’, ‘os.environ’ の両方に
          対して副作用を持ちます。代わりに、サブプロセスとしてコマンドラ
          インインターフェイスを使うことで、これら副作用を避けることが出
          来ます。

          注釈: ブートストラップ処理は ‘pip’ によって必要とされるモジュ
          ールを追加インストールするかもしれませんが、ほかのソフトウェア
          はそれら依存物がいつもデフォルトで存在していることを仮定すべき
          ではありません(将来のバージョンの ‘pip’ ではその依存はなくなる
          かもしれませんので)。


File: python.info,  Node: venv --- 仮想環境の作成,  Next: zipapp --- 実行可能な Python zip アーカイブを管理する,  Prev: ensurepip --- pip インストーラーのブートストラップ,  Up: ソフトウェア・パッケージと配布

5.28.2 ‘venv’ -- 仮想環境の作成
-------------------------------

Added in version 3.3.

'ソースコード:' Lib/venv/(1)

__________________________________________________________________

The ‘venv’ module supports creating lightweight "virtual environments",
each with their own independent set of Python packages installed in
their *note site: cc. directories.  A virtual environment is created on
top of an existing Python installation, known as the virtual
environment's "base" Python, and by default is isolated from the
packages in the base environment, so that only those explicitly
installed in the virtual environment are available.  See *note Virtual
Environments: 48b3. and *note site: cc.'s *note virtual environments
documentation: 48b4. for more information.

仮想環境の中から使われると、 pip(2) のような一般的なインストールツールは
明示的に指定しなくても仮想環境に Python パッケージをインストールします。

A virtual environment is (amongst other things):

   * Used to contain a specific Python interpreter and software
     libraries and binaries which are needed to support a project
     (library or application).  These are by default isolated from
     software in other virtual environments and Python interpreters and
     libraries installed in the operating system.

   * Contained in a directory, conventionally named ‘.venv’ or ‘venv’ in
     the project directory, or under a container directory for lots of
     virtual environments, such as ‘~/.virtualenvs’.

   * Not checked into source control systems such as Git.

   * Considered as disposable - it should be simple to delete and
     recreate it from scratch.  You don't place any project code in the
     environment.

   * Not considered as movable or copyable - you just recreate the same
     environment in the target location.

Python仮想環境の背景についてより詳しくは PEP 405(3) を参照してください。

参考
....

Python Packaging User Guide: Creating and using virtual environments(4)

*note Availability: 213f.: not Android, not iOS, not WASI.

このモジュールは *note モバイルプラットフォーム: 225c. と *note
WebAssemblyプラットフォーム: 1b6a. をサポートしません。

* Menu:

* 仮想環境の作成: 仮想環境の作成<2>.
* 仮想環境のしくみ::
* API: API<2>.
* EnvBuilder を拡張する例::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/venv/

   (2) https://pypi.org/project/pip/

   (3) https://peps.python.org/pep-0405/

   (4) 
https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#create-and-use-virtual-environments


File: python.info,  Node: 仮想環境の作成<2>,  Next: 仮想環境のしくみ,  Up: venv --- 仮想環境の作成

5.28.2.1 仮想環境の作成
.......................

*note Virtual environments: 3e8. are created by executing the ‘venv’
module:

     python -m venv /path/to/new/virtual/environment

This creates the target directory (including parent directories as
needed) and places a ‘pyvenv.cfg’ file in it with a ‘home’ key pointing
to the Python installation from which the command was run.  It also
creates a ‘bin’ (or ‘Scripts’ on Windows) subdirectory containing a copy
or symlink of the Python executable (as appropriate for the platform or
arguments used at environment creation time).  It also creates a
‘lib/pythonX.Y/site-packages’ subdirectory (on Windows, this is
‘Lib\site-packages’).  If an existing directory is specified, it will be
re-used.

バージョン 3.5 で変更: 仮想環境の作成には、 ‘venv’ の使用が今は推奨され
ています。

Deprecated since version 3.6, removed in version 3.8: ‘pyvenv’ was the
recommended tool for creating virtual environments for Python 3.3 and
3.4, and replaced in 3.5 by executing ‘venv’ directly.

Windows では、 ‘venv’ コマンドは次のように実行します:

     PS> python -m venv C:\path\to\new\virtual\environment

このコマンドを ‘-h’ をつけて実行すると利用できるオプションが表示されます
:

     usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear]
                 [--upgrade] [--without-pip] [--prompt PROMPT] [--upgrade-deps]
                 [--without-scm-ignore-files]
                 ENV_DIR [ENV_DIR ...]

     Creates virtual Python environments in one or more target directories.

     Once an environment has been created, you may wish to activate it, e.g. by
     sourcing an activate script in its bin directory.

 -- Option: ENV_DIR

     A required argument specifying the directory to create the
     environment in.

 -- Option: --system-site-packages

     Give the virtual environment access to the system site-packages
     directory.

 -- Option: --symlinks

     Try to use symlinks rather than copies, when symlinks are not the
     default for the platform.

 -- Option: --copies

     Try to use copies rather than symlinks, even when symlinks are the
     default for the platform.

 -- Option: --clear

     Delete the contents of the environment directory if it already
     exists, before environment creation.

 -- Option: --upgrade

     Upgrade the environment directory to use this version of Python,
     assuming Python has been upgraded in-place.

 -- Option: --without-pip

     Skips installing or upgrading pip in the virtual environment (pip
     is bootstrapped by default).

 -- Option: --prompt <PROMPT>

     Provides an alternative prompt prefix for this environment.

 -- Option: --upgrade-deps

     Upgrade core dependencies (pip) to the latest version in PyPI.

 -- Option: --without-scm-ignore-files

     Skips adding SCM ignore files to the environment directory (Git is
     supported by default).

バージョン 3.4 で変更: デフォルトで pip をインストールします。
‘--without-pip’ と ‘--copies’ オプションを追加しました。

バージョン 3.4 で変更: 以前のバージョンでは、対象となるディレクトリが既
に存在していた場合は、 ‘--clear’ オプションや ‘--upgrade’ オプションを付
けない限りはエラーを送出していました。

バージョン 3.9 で変更: pip と setuptools を PyPI での最新版に更新するに
は、‘--upgrade-deps’ オプションを追加してください。

バージョン 3.12 で変更: ‘setuptools’ is no longer a core venv
dependency.

バージョン 3.13 で変更: ‘--without-scm-ignore-files’ オプションが追加さ
れました。

バージョン 3.13 で変更: ‘venv’ now creates a ‘.gitignore’ file for Git
by default.

     注釈: Windows でもシンボリックリンクはサポートされていますが、シン
     ボリックリンクを使うのは推奨されません。 特に注目すべきなのは、ファ
     イルエクスプローラ上で ‘python.exe’ をダブルクリックすると、シンボ
     リックリンクを貪欲に解決し仮想環境を無視するということです。

     注釈: Microsoft Windows では、ユーザー向けの実行ポリシーを設定して
     ‘Activate.ps1’ スクリプトが使えるようにする必要があるかもしれません
     。 この設定は次の PowerShell コマンドでできます:

          PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

     さらに詳しくは About Execution Policies(1) を参照してください。

作成された ‘pyvenv.cfg’ ファイルには、‘include-system-site-packages’ キ
ーも含まれます。これは ‘venv’ が ‘--system-site-packages’ オプションをつ
けて実行されたなら ‘true’ で、そうでなければ ‘false’ です。

‘--without-pip’ オプションが与えられない限り、‘pip’ を仮想環境でブートす
るために *note ensurepip: 59. が呼ばれます。

‘venv’ には複数のパスを渡すことができ、その場合はそれぞれのパスに同一の
仮想環境が作成されます。

   ---------- Footnotes ----------

   (1) https://go.microsoft.com/fwlink/?LinkID=135170


File: python.info,  Node: 仮想環境のしくみ,  Next: API<2>,  Prev: 仮想環境の作成<2>,  Up: venv --- 仮想環境の作成

5.28.2.2 仮想環境のしくみ
.........................

Python インタプリタが仮想環境で実行しているとき、*note sys.prefix: 3e7.
と *note sys.exec_prefix: 3eb. は仮想環境のディレクトリを指し示し、
*note sys.base_prefix: 3e6. と *note sys.base_exec_prefix: 3ea. は仮想環
境の作成に使われたベース Python のディレクトリを指し示します。
‘sys.prefix != sys.base_prefix’ を調べれば、現在のインタプリタが仮想環境
で実行しているかを判定できます。

A virtual environment may be "activated" using a script in its binary
directory (‘bin’ on POSIX; ‘Scripts’ on Windows).  This will prepend
that directory to your ‘PATH’, so that running ‘python’ will invoke the
environment's Python interpreter and you can run installed scripts
without having to use their full path.  The invocation of the activation
script is platform-specific (‘<VENV>’ must be replaced by the path to
the directory containing the virtual environment):

プラットフォー    シェル           仮想環境を有効化するためのコマンド
ム                                 

------------------------------------------------------------------------------------------
                                   
POSIX             bash/zsh         ‘$ source <VENV>/bin/activate’
                                   
                  
fish              ‘$ source
                  <VENV>/bin/activate.fish’
                  
                  
csh/tcsh          ‘$ source
                  <VENV>/bin/activate.csh’
                  
                  
pwsh              ‘$
                  <VENV>/bin/Activate.ps1’
                  
                                   
Windows           cmd.exe          ‘C:\> <VENV>\Scripts\activate.bat’
                                   
                  
PowerShell        ‘PS C:\>
                  <VENV>\Scripts\Activate.ps1’
                  

Added in version 3.4: ‘fish’ および ‘csh’ の有効化スクリプト。

Added in version 3.8: PowerShell Core のサポートのために POSIX 環境にイ
ンストールされた、PowerShell 有効化スクリプト。

Python を呼び出すときに仮想環境の Python インタプリタへのフルパスを指定
すれば良いだけなので、仮想環境をアクティベートする '必要' はありません。
さらに、仮想環境にインストールされたすべてのスクリプトはアクティベートせ
ずとも実行可能なはずです。

これを達成するため、仮想環境にインストールされたスクリプトは、仮想環境の
Python インタープリターを指し示す "shebang" の行
‘#!/<PATH-TO-VENV>/bin/python’ を含みます。つまり、 ‘PATH’ の値に関係な
くそのスクリプトはそのインタープリターを使って実行されます。Windows では
、"shebang" の行の処理は *note Python install manager: 7da. がインストー
ルされていれば可能です。したがって、Windows のエクスプローラのウィンドウ
で、インストールされたスクリプトをダブルクリックすると、仮想環境をアクテ
ィベートしたり ‘PATH’ を編集したりしなくても、正しいインタープリターでス
クリプトが実行されるはずです。

仮想環境がアクティベートされると、‘VIRTUAL_ENV’ 環境変数の値が仮想環境へ
のパスに設定されます。アクティベートしなくても仮想環境を使うことは可能な
ため、仮想環境が使われているか否かの判断を ‘VIRTUAL_ENV’ に頼ることはで
きません。

     警告: 仮想環境にインストールされたスクリプトは仮想環境がアクティベ
     ートされていることを前提とすべきではないため、shebang の行は仮想環
     境のインタプリタへの絶対パスを含みます。このため、本質的に、仮想環
     境は一般の場合ポータブルではありません。いつでも仮想環境を再作成で
     きる簡単な方法を持っておくべきです（例えば、‘requirements.txt’ とい
     う requirements ファイルがあれば、仮想環境の ‘pip’ を用いて、‘pip
     install -r requirements.txt’ を呼び出すことで、仮想環境が必要とする
     すべてのパッケージをインストールできます）。何らかの理由で仮想環境
     を別の場所に移動する必要がある場合は、新しい場所で仮想環境を再作成
     し、古い場所にある仮想環境を削除してください。仮想環境の親ディレク
     トリを移動したため仮想環境も移動された場合は、新しい場所で仮想環境
     を再作成する必要があります。さもなくば、仮想環境にインストールされ
     たソフトウェアが想定通りに動作しない可能性があります。

シェルで ‘deactivate’ と入力することで仮想環境を無効化できます。 厳密な
仕組みはプラットフォーム固有であり、内部の実装詳細です (たいていはスクリ
プトかシェル関数が使われます)。


File: python.info,  Node: API<2>,  Next: EnvBuilder を拡張する例,  Prev: 仮想環境のしくみ,  Up: venv --- 仮想環境の作成

5.28.2.3 API
............

上述の高水準のメソッドは、サードパーティの仮想環境の作成者が環境の作成を
必要に応じてカスタマイズするための機構を提供する簡素な API を利用します
。それが *note EnvBuilder: 571. クラスです。

 -- クラス: venv.EnvBuilder (system_site_packages=False, clear=False,
          symlinks=False, upgrade=False, with_pip=False, prompt=None,
          upgrade_deps=False, *, scm_ignore_files=frozenset())

     *note EnvBuilder: 571. クラスを実体化するときに、以下のキーワード引
     数を受け取ります:

        * 'system_site_packages' - 真偽値で、システムの Python の
          site-packages を仮想環境から利用できるかどうかを示します (デフ
          ォルト: ‘False’)。

        * 'clear' - 真偽値で、真の場合環境を作成する前に既存の対象ディレ
          クトリの中身を削除します。

        * 'symlinks' - 真偽値で、Python のバイナリをコピーせずにシンボリ
          ックの作成を試みるかどうかを示します。

        * 'upgrade' - 真偽値で、真の場合実行中の Python で既存の環境をア
          ップグレードします。その Python がインプレースでアップグレード
          されたときに用います。デフォルトは ‘False’ です。

        * 'with_pip' - 真偽値で、真の場合仮想環境に pip がインストールさ
          れていることを保証します。‘--default-pip’ オプションで *note
          ensurepip: 59. を使用します。

        * 'prompt' - 仮想環境がアクティベートされたときに使う文字列（デ
          フォルトは ‘None’ のため、仮想環境のディレクトリ名が使われます
          ）。もし特殊な文字列 ‘"."’ が渡された場合、カレントディレクト
          リのベース名がプロンプトとして用いられます。

        * 'upgrade_deps' - venv のベースのモジュールを PyPI での最新版に
          アップデートします。

        * 'scm_ignore_files' - Create ignore files based for the
          specified source control managers (SCM) in the iterable.
          Support is defined by having a method named
          ‘create_{scm}_ignore_file’.  The only value supported by
          default is ‘"git"’ via *note create_git_ignore_file(): 48c3.

     バージョン 3.4 で変更: ‘with_pip’ 引数が追加されました。

     バージョン 3.6 で変更: ‘prompt’ 引数が追加されました。

     バージョン 3.9 で変更: ‘upgrade_deps’ 引数が追加されました。

     バージョン 3.13 で変更: ‘scm_ignore_files’ 引数が追加されました。

     *note EnvBuilder: 571. may be used as a base class.

      -- メソッド: create (env_dir)

          仮想環境を持つことになるターゲットディレクトリ (絶対パスあるい
          は現在のディレクトリからの相対パス) を指定し、仮想環境を作成し
          ます。 ‘create’ メソッドは、指定されたディレクトリに仮想環境を
          構築するか、適切な例外を送出します。

          *note EnvBuilder: 571. クラスの ‘create’ メソッドは、サブクラ
          スのカスタマイズに使えるフックを説明します:

               def create(self, env_dir):
                   """
                   Create a virtualized Python environment in a directory.
                   env_dir is the target directory to create an environment in.
                   """
                   env_dir = os.path.abspath(env_dir)
                   context = self.ensure_directories(env_dir)
                   self.create_configuration(context)
                   self.setup_python(context)
                   self.setup_scripts(context)
                   self.post_setup(context)

          メソッド *note ensure_directories(): 48c5, *note
          create_configuration(): 48c6, *note setup_python(): 48c7,
          *note setup_scripts(): 48c8, *note post_setup(): 48c9. はそれ
          ぞれオーバーライドできます。

      -- メソッド: ensure_directories (env_dir)

          仮想環境のディレクトリとすべての必要なサブディレクトリのうちま
          だ存在しないものを作成し、コンテキストオブジェクトを返します。
          このコンテキストオブジェクトは他のメソッドで使うために（パスな
          どの）属性を保持しているだけです。もし *note EnvBuilder: 571.
          が ‘clear=True’ の引数で作成された場合、仮想環境のディレクトリ
          の中身は消去され、すべての必要なサブディレクトリが再作成されま
          す。

          返されるコンテキストオブジェクトは以下の属性を持った *note
          types.SimpleNamespace: 4e5. です:

             * ‘env_dir’ - 仮想環境の場所。アクティベートスクリプトの中
               の ‘__VENV_DIR__’ で使われます（*note install_scripts():
               48ca. を参照してください）。

             * ‘env_name’ - 仮想環境の名前。アクティベートスクリプトの中
               の ‘__VENV_NAME__’ で使われます（*note install_scripts():
               48ca. を参照してください）。

             * ‘prompt’ - アクティベートスクリプトで使われるプロンプト。
               アクティベートスクリプトの中の ‘__VENV_PROMPT__’ で使われ
               ます（*note install_scripts(): 48ca. を参照してください）
               。

             * ‘executable’ - 仮想環境の元になっている Python 実行可能フ
               ァイル。これは仮想環境が別の仮想環境から作られた場合も考
               慮に入れます。

             * ‘inc_path’ - 仮想環境の include パス。

             * ‘lib_path’ - 仮想環境の purelib パス。

             * ‘bin_path’ - 仮想環境のスクリプトのパス。

             * ‘bin_name’ - 仮想環境の場所に相対的な、スクリプトのパス。
               アクティベートスクリプトの中の ‘__VENV_BIN_NAME__’ で使わ
               れます（*note install_scripts(): 48ca. を参照してください
               ）。

             * ‘env_exe’ - 仮想環境の中の Python インタプリタの名前。ア
               クティベートスクリプトの中の ‘__VENV_PYTHON__’ で使われま
               す（*note install_scripts(): 48ca. を参照してください）。

             * ‘env_exec_cmd’ - ファイルシステムのリダイレクトを考慮に入
               れた、Python インタプリタの名前。これは仮想環境の中で
               Python を実行するのに使えます。

          バージョン 3.11 で変更: 'venv' *note
          システム構成インストールスキーム: 449. は作成されたディレクト
          リのパスを構築するために使われます。

          バージョン 3.12 で変更: コンテキストに ‘lib_path’ 属性が追加さ
          れ、コンテキストオブジェクトがドキュメントに追加されました。

      -- メソッド: create_configuration (context)

          仮想環境に ‘pyvenv.cfg’ 設定ファイルを作成します。

      -- メソッド: setup_python (context)

          Python 実行ファイルのコピーまたはシンボリックリンクを仮想環境
          に作成します。 POSIX システムで、特定の ‘python3.x’ 実行ファイ
          ルが使われている場合、同じ名前のファイルが既に存在していない限
          り、 ‘python’ および ‘python3’ へのシンボリックリンクがその実
          行ファイルを指すように作成されます。

      -- メソッド: setup_scripts (context)

          プラットフォームに対応した有効化スクリプトを仮想環境にインスト
          ールします。

      -- メソッド: upgrade_dependencies (context)

          仮想環境の中の venv のコア依存関係パッケージ（現在は ‘pip’）を
          アップグレードします。これは仮想環境の中の ‘pip’ 実行可能ファ
          イルによって行われます。

          Added in version 3.9.

          バージョン 3.12 で変更: setuptools(1) is no longer a core venv
          dependency.

      -- メソッド: post_setup (context)

          サードパーティーライブラリがオーバーライドするための空のメソッ
          ドです。このメソッドをオーバーライドして、仮想環境構築後にパッ
          ケージのプリインストールなどのステップを実装できます。

      -- メソッド: install_scripts (context, path)

          This method can be called from *note setup_scripts(): 48c8. or
          *note post_setup(): 48c9. in subclasses to assist in
          installing custom scripts into the virtual environment.

          'path' は ‘common’, ‘posix’, ‘nt’ ディレクトリを格納したディレ
          クトリへのパスです。各サブディレクトリには仮想環境の ‘bin’ デ
          ィレクトリにインストールするスクリプトを格納します。 ‘common’
          の中身と、 *note os.name: 3003. に一致するディレクトリの中身を
          、以下の置換処理を行いながらコピーします:

             * ‘__VENV_DIR__’ は仮想環境ディレクトリの絶対パスに置換され
               ます。

             * ‘__VENV_NAME__’ は仮想環境の名前 (仮想環境ディレクトリの
               パスの最後の部分) に置換されます。

             * ‘__VENV_PROMPT__’ はプロンプトに置換されます (括弧で囲ま
               れ空白が続く環境名)。

             * ‘__VENV_BIN_NAME__’ は bin ディレクトリ名 (‘bin’ か
               ‘Scripts’) に置換されます。

             * ‘__VENV_PYTHON__’ は仮想環境の Python 実行ファイルの絶対
               パスに置換されます。

          (既存環境のアップグレード中は) ディレクトリは存在しても構いま
          せん。

      -- メソッド: create_git_ignore_file (context)

          Creates a ‘.gitignore’ file within the virtual environment
          that causes the entire directory to be ignored by the Git
          source control manager.

          Added in version 3.13.

     バージョン 3.7.2 で変更: Windows では、バイナリそのものをコピーする
     のではなく、‘python[w].exe’ にリダイレクトを行うスクリプトを使うよ
     うになりました。 3.7.2 でのみ、ソース群でビルドを実行しているのでな
     ければ *note setup_python(): 48c7. だけは何もしません。

     バージョン 3.7.3 で変更: Windows では、 *note setup_scripts():
     48c8. の代わりに *note setup_python(): 48c7. の一部としてリダイレク
     トを行うスクリプトをコピーします。 これは 3.7.2 には当てはまりませ
     ん。 シンボリックリンクを使ったときは、オリジナルの実行ファイルをコ
     ピーします。

モジュールレベルの簡易関数もあります:

 -- の関数: venv.create (env_dir, system_site_packages=False,
          clear=False, symlinks=False, with_pip=False, prompt=None,
          upgrade_deps=False, *, scm_ignore_files=frozenset())

     *note EnvBuilder: 571. を指定されたキーワード引数を使って作成し、そ
     の *note create(): 48c4. メソッドに 'env_dir' 引数を渡して実行しま
     す。

     Added in version 3.3.

     バージョン 3.4 で変更: 'with_pip' 引数が追加されました。

     バージョン 3.6 で変更: 'prompt' 引数が追加されました。

     バージョン 3.9 で変更: 'upgrade_deps' 引数が追加されました。

     バージョン 3.13 で変更: 'scm_ignore_files' 引数が追加されました。

   ---------- Footnotes ----------

   (1) https://pypi.org/project/setuptools/


File: python.info,  Node: EnvBuilder を拡張する例,  Prev: API<2>,  Up: venv --- 仮想環境の作成

5.28.2.4 ‘EnvBuilder’ を拡張する例
..................................

次のスクリプトで、作成された仮想環境に setuptools と pip をインストール
するサブクラスを実装して *note EnvBuilder: 571. を拡張する方法を示します
:

     import os
     import os.path
     from subprocess import Popen, PIPE
     import sys
     from threading import Thread
     from urllib.parse import urlsplit
     from urllib.request import urlretrieve
     import venv

     class ExtendedEnvBuilder(venv.EnvBuilder):
         """
         This builder installs setuptools and pip so that you can pip or
         easy_install other packages into the created virtual environment.

         :param nodist: If true, setuptools and pip are not installed into the
                        created virtual environment.
         :param nopip: If true, pip is not installed into the created
                       virtual environment.
         :param progress: If setuptools or pip are installed, the progress of the
                          installation can be monitored by passing a progress
                          callable. If specified, it is called with two
                          arguments: a string indicating some progress, and a
                          context indicating where the string is coming from.
                          The context argument can have one of three values:
                          'main', indicating that it is called from virtualize()
                          itself, and 'stdout' and 'stderr', which are obtained
                          by reading lines from the output streams of a subprocess
                          which is used to install the app.

                          If a callable is not specified, default progress
                          information is output to sys.stderr.
         """

         def __init__(self, *args, **kwargs):
             self.nodist = kwargs.pop('nodist', False)
             self.nopip = kwargs.pop('nopip', False)
             self.progress = kwargs.pop('progress', None)
             self.verbose = kwargs.pop('verbose', False)
             super().__init__(*args, **kwargs)

         def post_setup(self, context):
             """
             Set up any packages which need to be pre-installed into the
             virtual environment being created.

             :param context: The information for the virtual environment
                             creation request being processed.
             """
             os.environ['VIRTUAL_ENV'] = context.env_dir
             if not self.nodist:
                 self.install_setuptools(context)
             # Can't install pip without setuptools
             if not self.nopip and not self.nodist:
                 self.install_pip(context)

         def reader(self, stream, context):
             """
             Read lines from a subprocess' output stream and either pass to a progress
             callable (if specified) or write progress information to sys.stderr.
             """
             progress = self.progress
             while True:
                 s = stream.readline()
                 if not s:
                     break
                 if progress is not None:
                     progress(s, context)
                 else:
                     if not self.verbose:
                         sys.stderr.write('.')
                     else:
                         sys.stderr.write(s.decode('utf-8'))
                     sys.stderr.flush()
             stream.close()

         def install_script(self, context, name, url):
             _, _, path, _, _ = urlsplit(url)
             fn = os.path.split(path)[-1]
             binpath = context.bin_path
             distpath = os.path.join(binpath, fn)
             # Download script into the virtual environment's binaries folder
             urlretrieve(url, distpath)
             progress = self.progress
             if self.verbose:
                 term = '\n'
             else:
                 term = ''
             if progress is not None:
                 progress('Installing %s ...%s' % (name, term), 'main')
             else:
                 sys.stderr.write('Installing %s ...%s' % (name, term))
                 sys.stderr.flush()
             # Install in the virtual environment
             args = [context.env_exe, fn]
             p = Popen(args, stdout=PIPE, stderr=PIPE, cwd=binpath)
             t1 = Thread(target=self.reader, args=(p.stdout, 'stdout'))
             t1.start()
             t2 = Thread(target=self.reader, args=(p.stderr, 'stderr'))
             t2.start()
             p.wait()
             t1.join()
             t2.join()
             if progress is not None:
                 progress('done.', 'main')
             else:
                 sys.stderr.write('done.\n')
             # Clean up - no longer needed
             os.unlink(distpath)

         def install_setuptools(self, context):
             """
             Install setuptools in the virtual environment.

             :param context: The information for the virtual environment
                             creation request being processed.
             """
             url = "https://bootstrap.pypa.io/ez_setup.py"
             self.install_script(context, 'setuptools', url)
             # clear up the setuptools archive which gets downloaded
             pred = lambda o: o.startswith('setuptools-') and o.endswith('.tar.gz')
             files = filter(pred, os.listdir(context.bin_path))
             for f in files:
                 f = os.path.join(context.bin_path, f)
                 os.unlink(f)

         def install_pip(self, context):
             """
             Install pip in the virtual environment.

             :param context: The information for the virtual environment
                             creation request being processed.
             """
             url = 'https://bootstrap.pypa.io/get-pip.py'
             self.install_script(context, 'pip', url)


     def main(args=None):
         import argparse

         parser = argparse.ArgumentParser(prog=__name__,
                                          description='Creates virtual Python '
                                                      'environments in one or '
                                                      'more target '
                                                      'directories.')
         parser.add_argument('dirs', metavar='ENV_DIR', nargs='+',
                             help='A directory in which to create the '
                                  'virtual environment.')
         parser.add_argument('--no-setuptools', default=False,
                             action='store_true', dest='nodist',
                             help="Don't install setuptools or pip in the "
                                  "virtual environment.")
         parser.add_argument('--no-pip', default=False,
                             action='store_true', dest='nopip',
                             help="Don't install pip in the virtual "
                                  "environment.")
         parser.add_argument('--system-site-packages', default=False,
                             action='store_true', dest='system_site',
                             help='Give the virtual environment access to the '
                                  'system site-packages dir.')
         if os.name == 'nt':
             use_symlinks = False
         else:
             use_symlinks = True
         parser.add_argument('--symlinks', default=use_symlinks,
                             action='store_true', dest='symlinks',
                             help='Try to use symlinks rather than copies, '
                                  'when symlinks are not the default for '
                                  'the platform.')
         parser.add_argument('--clear', default=False, action='store_true',
                             dest='clear', help='Delete the contents of the '
                                                'virtual environment '
                                                'directory if it already '
                                                'exists, before virtual '
                                                'environment creation.')
         parser.add_argument('--upgrade', default=False, action='store_true',
                             dest='upgrade', help='Upgrade the virtual '
                                                  'environment directory to '
                                                  'use this version of '
                                                  'Python, assuming Python '
                                                  'has been upgraded '
                                                  'in-place.')
         parser.add_argument('--verbose', default=False, action='store_true',
                             dest='verbose', help='Display the output '
                                                  'from the scripts which '
                                                  'install setuptools and pip.')
         options = parser.parse_args(args)
         if options.upgrade and options.clear:
             raise ValueError('you cannot supply --upgrade and --clear together.')
         builder = ExtendedEnvBuilder(system_site_packages=options.system_site,
                                        clear=options.clear,
                                        symlinks=options.symlinks,
                                        upgrade=options.upgrade,
                                        nodist=options.nodist,
                                        nopip=options.nopip,
                                        verbose=options.verbose)
         for d in options.dirs:
             builder.create(d)

     if __name__ == '__main__':
         rc = 1
         try:
             main()
             rc = 0
         except Exception as e:
             print('Error: %s' % e, file=sys.stderr)
         sys.exit(rc)

このスクリプトは オンライン(1) よりダウンロードすることも可能です。

   ---------- Footnotes ----------

   (1) https://gist.github.com/vsajip/4673395


File: python.info,  Node: zipapp --- 実行可能な Python zip アーカイブを管理する,  Prev: venv --- 仮想環境の作成,  Up: ソフトウェア・パッケージと配布

5.28.3 ‘zipapp’ -- 実行可能な Python zip アーカイブを管理する
-------------------------------------------------------------

Added in version 3.5.

'ソースコード:' Lib/zipapp.py(1)

__________________________________________________________________

このモジュールは Python コードを含む zip ファイルの作成を行うツールを提
供します。 zip ファイルは *note Python
インタープリタで直接実行することが出来ます: 211b.。 このモジュールは
*note コマンドラインインターフェイス: 48d0. と *note Python API: 48d1. の
両方を提供します。

* Menu:

* 基本的な例: 基本的な例<4>.
* コマンドラインインターフェイス: コマンドラインインターフェイス<4>.
* Python API::
* 使用例: 使用例<46>.
* インタープリタの指定::
* Creating Standalone Applications with zipapp::
* The Python Zip Application Archive Format::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/zipapp.py


File: python.info,  Node: 基本的な例<4>,  Next: コマンドラインインターフェイス<4>,  Up: zipapp --- 実行可能な Python zip アーカイブを管理する

5.28.3.1 基本的な例
...................

実行可能なアーカイブを Python コードを含むディレクトリから作成する為に
*note コマンドラインインターフェイス: 48d0. をどのように利用することがで
きるかを以下に例示します。アーカイブは実行時にアーカイブ内の ‘myapp’ モ
ジュールから ‘main’ 関数を実行します。

     $ python -m zipapp myapp -m "myapp:main"
     $ python myapp.pyz
     <output from myapp>


File: python.info,  Node: コマンドラインインターフェイス<4>,  Next: Python API,  Prev: 基本的な例<4>,  Up: zipapp --- 実行可能な Python zip アーカイブを管理する

5.28.3.2 コマンドラインインターフェイス
.......................................

コマンドラインからプログラムとして呼び出す場合は、次の形式を使用います:

     $ python -m zipapp source [options]

'source' がディレクトリである場合、 'source' ディレクトリの内容からアー
カイブを作成します。 'source' がファイルである場合、 'source' ファイル自
身をアーカイブ化し、保存先アーカイブへコピーします。(または -info オプシ
ョンが指定されている場合はファイルのシェバン行が表示されます。)

以下のオプションが解釈されます:

 -- Option: -o <output>, --output=<output>

     出力を 'output' に指定した名前のファイルへ書込みます。このオプショ
     ンが指定されていない場合、出力先ファイル名は入力元 'source' と同じ
     になり、 ‘.pyz’ 拡張子が付与されます。 ファイル名が明示的に指定され
     ている場合は、指定されたファイル名を使用します。(必要であれば
     ‘.pyz’ 拡張子が含まれます。)

     'source' がアーカイブである場合は、出力先ファイル名を必ず指定しなけ
     ればなりません。 ('source' がアーカイブである場合は 'output' を必ず
     'source' とは別の名前にしてください。)

 -- Option: -p <interpreter>, --python=<interpreter>

     実行コマンドとしての 'interpreter' を指定する ‘#!’ 行を書庫に追加し
     ます。 また、POSIX では書庫を実行可能にします。 デフォルトでは ‘#!’
     行を書かず、ファイルを実行可能にはしません。

 -- Option: -m <mainfn>, --main=<mainfn>

     'mainfn' を実行するアーカイブへ ‘__main__.py’ ファイルを書込んでく
     ださい。 'mainfn' 引数は "pkg.mod:fn" の形式で指定します。
     "pkg.mod" の場所はアーカイブ内の package/module です。 "fn" は指定
     した module から呼出すことのできる関数です。 ‘__main__.py’ ファイル
     が module から呼出すことのできる関数を実行します。

     書庫をコピーする際、 *note -main: 48d8. を指定することは出来ません
     。

 -- Option: -c, --compress

     Compress files with the deflate method, reducing the size of the
     output file.  By default, files are stored uncompressed in the
     archive.

     書庫をコピーする際、 *note -compress: 48da. に効果はありません。

     Added in version 3.7.

 -- Option: --info

     診断するために書庫に埋め込まれたインタープリタを表示します。 この場
     合、他の全てのオプションは無視され、SOURCE はディレクトリではなく書
     庫でなければなりません。

 -- Option: -h, --help

     簡単な使用法を表示して終了します。


File: python.info,  Node: Python API,  Next: 使用例<46>,  Prev: コマンドラインインターフェイス<4>,  Up: zipapp --- 実行可能な Python zip アーカイブを管理する

5.28.3.3 Python API
...................

このモジュールは 2 つの簡便関数を定義しています:

 -- の関数: zipapp.create_archive (source, target=None,
          interpreter=None, main=None, filter=None, compressed=False)

     'source' からアプリケーション書庫を作成します。 ソースは以下のいず
     れかです:

        * ディレクトリ名、または 新しいアプリケーションアーカイブがディ
          レクトリのコンテンツから作成される場合に *note path-like
          object: 5a1. オブジェクトが参照するディレクトリ。

        * 既存のアプリケーションアーカイブファイルの名前、 または
          ('interpreter' 引数に指定した値を反映し、修正する)アーカイブへ
          ファイルがコピーされる場合に *note path-like object: 5a1. オブ
          ジェクトが参照するファイル。

        * バイトモードの読込みで開くファイルオブジェクト。 ファイルの内
          容がアプリケーションアーカイブとなり、 ファイルオブジェクトが
          アーカイブの起点となります。

     'target' 引数は作成される書庫が書き込まれる場所を決めます:

        * ファイル名、または *note path-like object: 5a1. オブジェクトを
          指定した場合、アーカイブは指定したファイルへ書き込まれます。

        * 開いているファイルオブジェクトを指定した場合、 アーカイブはそ
          のファイルオブジェクトへ書込みを行ないます。 ファイルオブジェ
          クトは必ずバイトモードの書込みで開いてください。

        * target を指定しないか ‘None’ を渡した場合、 source は必ずディ
          レクトリでなければならず、target は source のファイル名に
          ‘.pyz’ 拡張子を付与したファイル名となります。

     'interpreter' 引数はアーカイブが実行時に使用する Python インタープ
     リタの名前を指定します。 インタープリタ名は "シェバン" 行としてアー
     カイブの起点に書込まれます。 POSIX では OS によってシェバンが解釈さ
     れ、 Windows では Python ランチャーによって扱われます。 シェバン行
     が書込まれていない場合は 'interpreter' の結果を無視します。
     interpreter が指定されており、 target がファイル名である場合、
     target ファイルの実行可能ビットが設定されます。

     'main' 引数はアーカイブのメインプログラムとして使用する callable の
     名前を指定します。 'main' 引数は source がディレクトリであり、
     source が既に ‘__main__.py’ ファイルを保持していない場合に限り、指
     定することができます。 'main' 引数は "pkg.module:callable" の形式を
     取り、 アーカイブは "pkg.module" をインポートして実行され、 指定し
     た callable を引数なしで実行します。 source がディレクトリであり、
     ‘__main__.py’ が含まれていない場合、 'main' は無視すべきエラーとな
     り、 作成されたアーカイブには実行可能ビットが設定されません。

     The optional 'filter' argument specifies a callback function that
     is passed a Path object representing the path to the file being
     added (relative to the source directory).  It should return ‘True’
     if the file is to be added.

     The optional 'compressed' argument determines whether files are
     compressed.  If set to ‘True’, files in the archive are compressed
     with the deflate method; otherwise, files are stored uncompressed.
     This argument has no effect when copying an existing archive.

     'source' または 'target' へファイルオブジェクトを指定した場合、
     caller が create_archive の呼出し後にオブジェクトを閉じます。

     既存のアーカイブをコピーする際、ファイルオブジェクトは ‘read’ ,
     ‘readline’ , ‘write’ メソッドのみを提供します。 アーカイブをディレ
     クトリから作成する際、 target がファイルオブジェクトである場合は、
     ‘zipfile.ZipFile’ クラスへ渡されます。必ずクラスが必要とするメソッ
     ドを提供してください。

     バージョン 3.7 で変更: Added the 'filter' and 'compressed'
     parameters.

 -- の関数: zipapp.get_interpreter (archive)

     アーカイブの最初の行の ‘#!’ に指定されたインタープリタを返します。
     ‘#!’ が無い場合は *note None: 885. を返します。 'archive' 引数は、
     ファイル名またはバイトモードの読込みで開いた ファイルに準じるオブジ
     ェクトを指定することができ、アーカイブの起点で決定されます。


File: python.info,  Node: 使用例<46>,  Next: インタープリタの指定,  Prev: Python API,  Up: zipapp --- 実行可能な Python zip アーカイブを管理する

5.28.3.4 使用例
...............

ディレクトリを書庫に圧縮し、実行します。

     $ python -m zipapp myapp
     $ python myapp.pyz
     <output from myapp>

同じことを *note create_archive(): da9. 関数を使用して行うことができます
:

     >>> import zipapp
     >>> zipapp.create_archive('myapp', 'myapp.pyz')

POSIX でアプリケーションを直接実行可能にするには使用するインタープリタを
指定します。

     $ python -m zipapp myapp -p "/usr/bin/env python"
     $ ./myapp.pyz
     <output from myapp>

シバン行を既存の書庫で置換するには、 *note create_archive(): da9.
function: を使用して変更された書庫を作成します:

     >>> import zipapp
     >>> zipapp.create_archive('old_archive.pyz', 'new_archive.pyz', '/usr/bin/python3')

アーカイブ内のファイルを更新するには *note BytesIO: 10a4. オブジェクトを
使用してメモリーへ格納し、 元のファイルを上書きして置換してください。 フ
ァイルを上書きする際にエラーが発生し、元のファイルが失われる危険性がある
ことに注意してください。 このコードは上記のようなエラーからファイルを保
護しませんが、プロダクションコードは保護するべきです。 この方法はアーカ
イブがメモリーに収まる場合にのみ動作します:

     >>> import zipapp
     >>> import io
     >>> temp = io.BytesIO()
     >>> zipapp.create_archive('myapp.pyz', temp, '/usr/bin/python2')
     >>> with open('myapp.pyz', 'wb') as f:
     >>>     f.write(temp.getvalue())


File: python.info,  Node: インタープリタの指定,  Next: Creating Standalone Applications with zipapp,  Prev: 使用例<46>,  Up: zipapp --- 実行可能な Python zip アーカイブを管理する

5.28.3.5 インタープリタの指定
.............................

Note that if you specify an interpreter and then distribute your
application archive, you need to ensure that the interpreter used is
portable.  The Python launcher for Windows supports most common forms of
POSIX ‘#!’ line, but there are other issues to consider:

   * If you use "/usr/bin/env python" (or other forms of the "python"
     command, such as "/usr/bin/python"), you need to consider that your
     users may have either Python 2 or Python 3 as their default, and
     write your code to work under both versions.

   * If you use an explicit version, for example "/usr/bin/env python3"
     your application will not work for users who do not have that
     version.  (This may be what you want if you have not made your code
     Python 2 compatible).

   * There is no way to say "python X.Y or later", so be careful of
     using an exact version like "/usr/bin/env python3.4" as you will
     need to change your shebang line for users of Python 3.5, for
     example.

Typically, you should use an "/usr/bin/env python2" or "/usr/bin/env
python3", depending on whether your code is written for Python 2 or 3.


File: python.info,  Node: Creating Standalone Applications with zipapp,  Next: The Python Zip Application Archive Format,  Prev: インタープリタの指定,  Up: zipapp --- 実行可能な Python zip アーカイブを管理する

5.28.3.6 Creating Standalone Applications with zipapp
.....................................................

Using the ‘zipapp’ module, it is possible to create self-contained
Python programs, which can be distributed to end users who only need to
have a suitable version of Python installed on their system.  The key to
doing this is to bundle all of the application's dependencies into the
archive, along with the application code.

The steps to create a standalone archive are as follows:

  1. Create your application in a directory as normal, so you have a
     ‘myapp’ directory containing a ‘__main__.py’ file, and any
     supporting application code.

  2. Install all of your application's dependencies into the ‘myapp’
     directory, using pip:

          $ python -m pip install -r requirements.txt --target myapp

     (this assumes you have your project requirements in a
     ‘requirements.txt’ file - if not, you can just list the
     dependencies manually on the pip command line).

  3. Package the application using:

          $ python -m zipapp -p "interpreter" myapp

This will produce a standalone executable, which can be run on any
machine with the appropriate interpreter available.  See *note
インタープリタの指定: 48e4. for details.  It can be shipped to users as
a single file.

On Unix, the ‘myapp.pyz’ file is executable as it stands.  You can
rename the file to remove the ‘.pyz’ extension if you prefer a "plain"
command name.  On Windows, the ‘myapp.pyz[w]’ file is executable by
virtue of the fact that the Python interpreter registers the ‘.pyz’ and
‘.pyzw’ file extensions when installed.

* Menu:

* Caveats::


File: python.info,  Node: Caveats,  Up: Creating Standalone Applications with zipapp

5.28.3.7 Caveats
................

If your application depends on a package that includes a C extension,
that package cannot be run from a zip file (this is an OS limitation, as
executable code must be present in the filesystem for the OS loader to
load it).  In this case, you can exclude that dependency from the
zipfile, and either require your users to have it installed, or ship it
alongside your zipfile and add code to your ‘__main__.py’ to include the
directory containing the unzipped module in ‘sys.path’.  In this case,
you will need to make sure to ship appropriate binaries for your target
architecture(s) (and potentially pick the correct version to add to
‘sys.path’ at runtime, based on the user's machine).


File: python.info,  Node: The Python Zip Application Archive Format,  Prev: Creating Standalone Applications with zipapp,  Up: zipapp --- 実行可能な Python zip アーカイブを管理する

5.28.3.8 The Python Zip Application Archive Format
..................................................

Python has been able to execute zip files which contain a ‘__main__.py’
file since version 2.6.  In order to be executed by Python, an
application archive simply has to be a standard zip file containing a
‘__main__.py’ file which will be run as the entry point for the
application.  As usual for any Python script, the parent of the script
(in this case the zip file) will be placed on *note sys.path: 3e4. and
thus further modules can be imported from the zip file.

The zip file format allows arbitrary data to be prepended to a zip file.
The zip application format uses this ability to prepend a standard POSIX
"shebang" line to the file (‘#!/path/to/interpreter’).

Formally, the Python zip application format is therefore:

  1. An optional shebang line, containing the characters ‘b'#!'’
     followed by an interpreter name, and then a newline (‘b'\n'’)
     character.  The interpreter name can be anything acceptable to the
     OS "shebang" processing, or the Python launcher on Windows.  The
     interpreter should be encoded in UTF-8 on Windows, and in *note
     sys.getfilesystemencoding(): e53. on POSIX.

  2. Standard zipfile data, as generated by the *note zipfile: 137.
     module.  The zipfile content 'must' include a file called
     ‘__main__.py’ (which must be in the "root" of the zipfile - i.e.,
     it cannot be in a subdirectory).  The zipfile data can be
     compressed or uncompressed.

If an application archive has a shebang line, it may have the executable
bit set on POSIX systems, to allow it to be executed directly.

There is no requirement that the tools in this module are used to create
application archives - the module is a convenience, but archives in the
above format created by any means are acceptable to Python.


File: python.info,  Node: Python ランタイムサービス,  Next: カスタム Python インタプリタ,  Prev: ソフトウェア・パッケージと配布,  Up: Python 標準ライブラリ

5.29 Python ランタイムサービス
==============================

この章では、Python インタープリタや Python 環境に深く関連する各種の機能
を解説します。以下に一覧を示します:

* Menu:

* sys: sys --- システム固有のパラメーターと関数. システム固有のパラメーターと関数
* sys.monitoring: sys monitoring --- 実行イベントモニタリング. 実行イベントモニタリング
* sysconfig: sysconfig --- Python の構成情報へのアクセスを提供する. Python の構成情報へのアクセスを提供する
* builtins: builtins --- 組み込みオブジェクト. 組み込みオブジェクト
* __main__: __main__ --- トップレベルのコード環境. トップレベルのコード環境
* warnings: warnings --- 警告の制御. 警告の制御
* dataclasses: dataclasses --- データクラス. データクラス
* contextlib: contextlib --- with 文コンテキスト用ユーティリティ. with 文コンテキスト用ユーティリティ
* abc: abc --- 抽象基底クラス. 抽象基底クラス
* atexit: atexit --- 終了ハンドラー. 終了ハンドラー
* traceback: traceback --- スタックトレースの表示または取得. スタックトレースの表示または取得
* __future__: __future__ --- future 文の定義. future 文の定義
* gc: gc --- ガベージコレクターインターフェース. ガベージコレクターインターフェース
* inspect: inspect --- 活動中のオブジェクトを調査する. 活動中のオブジェクトを調査する
* annotationlib: annotationlib --- Functionality for introspecting annotations. Functionality for introspecting annotations
* site: site --- サイト固有の設定フック. サイト固有の設定フック


File: python.info,  Node: sys --- システム固有のパラメーターと関数,  Next: sys monitoring --- 実行イベントモニタリング,  Up: Python ランタイムサービス

5.29.1 ‘sys’ -- システム固有のパラメーターと関数
------------------------------------------------

__________________________________________________________________

This module provides access to some variables used or maintained by the
interpreter and to functions that interact strongly with the
interpreter.  It is always available.  Unless explicitly noted
otherwise, all variables are read-only.

 -- データ: sys.abiflags

     Python が標準的な ‘configure’ でビルトされた POSIX システムにおいて
     、 PEP 3149(1) に記述された ABI フラグを含みます。

     Added in version 3.2.

     バージョン 3.8 で変更: デフォルトのフラグは空文字列になりました。
     (pymalloc のための ‘m’ フラグが取り除かれました)

     *note Availability: 213f.: Unix.

 -- の関数: sys.addaudithook (hook)

     呼び出し可能な 'hook' を現在の(サブ)インタープリタのアクティブな監
     査用フックのリストに加えます。

     When an auditing event is raised through the *note sys.audit():
     191b. function, each hook will be called in the order it was added
     with the event name and the tuple of arguments.  Native hooks added
     by *note PySys_AddAuditHook(): 4751. are called first, followed by
     hooks added in the current (sub)interpreter.  Hooks can then log
     the event, raise an exception to abort the operation, or terminate
     the process entirely.

     Note that audit hooks are primarily for collecting information
     about internal or otherwise unobservable actions, whether by Python
     or libraries written in Python.  They are not suitable for
     implementing a "sandbox".  In particular, malicious code can
     trivially disable or bypass hooks added using this function.  At a
     minimum, any security-sensitive hooks must be added using the C API
     *note PySys_AddAuditHook(): 4751. before initialising the runtime,
     and any modules allowing arbitrary memory modification (such as
     *note ctypes: 2e.) should be completely removed or closely
     monitored.

     Calling *note sys.addaudithook(): 4750. will itself raise an
     auditing event named ‘sys.addaudithook’ with no arguments.  If any
     existing hooks raise an exception derived from *note RuntimeError:
     244, the new hook will not be added and the exception suppressed.
     As a result, callers cannot assume that their hook has been added
     unless they control all existing hooks.

     See the *note audit events table: 1c13. for all events raised by
     CPython, and PEP 578(2) for the original design discussion.

     Added in version 3.8.

     バージョン 3.8.1 で変更: *note RuntimeError: 244. ではない *note
     Exception: bcd. は抑制されなくなりました。

     'CPython 実装の詳細:' When tracing is enabled (see *note
     settrace(): 2e1.), Python hooks are only traced if the callable has
     a ‘__cantrace__’ member that is set to a true value.  Otherwise,
     trace functions will skip the hook.

 -- データ: sys.argv

     Pythonスクリプトに渡されたコマンドライン引数のリスト。 ‘argv[0]’ は
     スクリプトの名前となりますが、フルパス名かどうかは、OSによって異な
     ります。コマンドライン引数に *note -c: 1a8. を付けて Pythonを起動し
     た場合、 ‘argv[0]’ は文字列 ‘'-c'’ となります。スクリプト名なしで
     Pythonを起動した場合、 ‘argv[0]’ は空文字列になります。

     標準入力もしくはコマンドライン引数で指定されたファイルのリストに渡
     ってループするには、 *note fileinput: 5f. モジュールを参照してくだ
     さい。

     See also *note sys.orig_argv: a41.

          注釈: Unix では、コマンドライン引数は OS からバイト列で渡され
          ます。 Python はそれをファイルシステムエンコーディングと
          "surrogateescape" エラーハンドラを使ってデコードします。 オリ
          ジナルのバイト列が必要なときには、 ‘[os.fsencode(arg) for arg
          in sys.argv]’ で取得できます。

 -- の関数: sys.audit (event, *args)

     Raise an auditing event and trigger any active auditing hooks.
     'event' is a string identifying the event, and 'args' may contain
     optional arguments with more information about the event.  The
     number and types of arguments for a given event are considered a
     public and stable API and should not be modified between releases.

     For example, one auditing event is named ‘os.chdir’.  This event
     has one argument called 'path' that will contain the requested new
     working directory.

     *note sys.audit(): 191b. will call the existing auditing hooks,
     passing the event name and arguments, and will re-raise the first
     exception from any hook.  In general, if an exception is raised, it
     should not be handled and the process should be terminated as
     quickly as possible.  This allows hook implementations to decide
     how to respond to particular events: they can merely log the event
     or abort the operation by raising an exception.

     Hooks are added using the *note sys.addaudithook(): 4750. or *note
     PySys_AddAuditHook(): 4751. functions.

     The native equivalent of this function is *note PySys_Audit(): 613.
     Using the native function is preferred when possible.

     See the *note audit events table: 1c13. for all events raised by
     CPython.

     Added in version 3.8.

 -- データ: sys.base_exec_prefix

     Equivalent to *note exec_prefix: 3eb, but referring to the base
     Python installation.

     When running under *note Virtual Environments: 48b3, *note
     exec_prefix: 3eb. gets overwritten to the virtual environment
     prefix.  *note base_exec_prefix: 3ea, conversely, does not change,
     and always points to the base Python installation.  Refer to *note
     Virtual Environments: 48b3. for more information.

     Added in version 3.3.

 -- データ: sys.base_prefix

     Equivalent to *note prefix: 3e7, but referring to the base Python
     installation.

     When running under *note virtual environment: 3e8, *note prefix:
     3e7. gets overwritten to the virtual environment prefix.  *note
     base_prefix: 3e6, conversely, does not change, and always points to
     the base Python installation.  Refer to *note Virtual Environments:
     48b3. for more information.

     Added in version 3.3.

 -- データ: sys.byteorder

     プラットフォームのバイト順を示します。ビッグエンディアン (最上位バ
     イトが先頭) のプラットフォームでは ‘'big'’, リトルエンディアン (最
     下位バイトが先頭) では ‘'little'’ となります。

 -- データ: sys.builtin_module_names

     コンパイル時にPythonインタプリタに組み込まれた、全てのモジュール名
     を含む文字列のタプル(この情報は、他の手段では取得することができませ
     ん。 ‘modules.keys()’ は、インポートされたモジュールのみのリストを
     返します。)

     See also the *note sys.stdlib_module_names: a42. list.

 -- の関数: sys.call_tracing (func, args)

     Call ‘func(*args)’, while tracing is enabled.  The tracing state is
     saved, and restored afterwards.  This is intended to be called from
     a debugger from a checkpoint, to recursively debug or profile some
     other code.

     Tracing is suspended while calling a tracing function set by *note
     settrace(): 2e1. or *note setprofile(): 1717. to avoid infinite
     recursion.  ‘call_tracing()’ enables explicit recursion of the
     tracing function.

 -- データ: sys.copyright

     Python インタプリタの著作権を表示する文字列です。

 -- の関数: sys._clear_type_cache ()

     内部の型キャッシュをクリアします。型キャッシュは属性とメソッドの検
     索を高速化するために利用されます。この関数は、参照リークをデバッグ
     するときに不要な参照を削除するため 'だけ' に利用してください。

     この関数は、内部的かつ特殊な目的にのみ利用されるべきです。

     バージョン 3.13 で非推奨: Use the more general *note
     _clear_internal_caches(): 364. function instead.

 -- の関数: sys._clear_internal_caches ()

     Clear all internal performance-related caches.  Use this function
     'only' to release unnecessary references and memory blocks when
     hunting for leaks.

     Added in version 3.13.

 -- の関数: sys._current_frames ()

     各スレッドの識別子を関数が呼ばれた時点のそのスレッドでアクティブに
     なっている一番上のスタックフレームに結びつける辞書を返します。モジ
     ュール *note traceback: 104. の関数を使えばそのように与えられたフレ
     ームのコールスタックを構築できます。

     この関数はデッドロックをデバッグするのに非常に有効です。デッドロッ
     ク状態のスレッドの協調動作を必要としませんし、そういったスレッドの
     コールスタックはデッドロックである限りフリーズしたままです。デッド
     ロックにないスレッドのフレームについては、そのフレームを調べるコー
     ドを呼んだ時にはそのスレッドの現在の実行状況とは関係ないところを指
     し示しているかもしれません。

     この関数は、内部的かつ特殊な目的にのみ利用されるべきです。

     引数無しで *note 監査イベント: 1c6e. ‘sys._current_frames’ を送出し
     ます。

 -- の関数: sys._current_exceptions ()

     Return a dictionary mapping each thread's identifier to the topmost
     exception currently active in that thread at the time the function
     is called.  If a thread is not currently handling an exception, it
     is not included in the result dictionary.

     This is most useful for statistical profiling.

     この関数は、内部的かつ特殊な目的にのみ利用されるべきです。

     引数無しで *note 監査イベント: 1c6e. ‘sys._current_exceptions’ を送
     出します。

     バージョン 3.12 で変更: Each value in the dictionary is now a
     single exception instance, rather than a 3-tuple as returned from
     ‘sys.exc_info()’.

 -- の関数: sys.breakpointhook ()

     このフック関数は組み込みの *note breakpoint(): 271. から呼ばれます
     。 デフォルトでは、この関数は *note pdb: aa. デバッガに処理を移行さ
     せますが、他の関数を設定することもでき、使用するデバッガを選べます
     。

     この関数のシグネチャは何を呼び出すかに依存します。 例えば、
     (‘pdb.set_trace()’ などの) デフォルトの結び付けでは引数は求められま
     せんが、追加の引数 (位置引数およびキーワード引数) を求める関数に結
     び付けるかもしれません。 組み込みの ‘breakpoint()’ 関数は、自身の
     ‘*args’ と ‘**kws’ をそのまま渡します。 ‘breakpointhooks()’ の返り
     値が何であれ、そのまま ‘breakpoint()’ から返されます。

     デフォルトの実装では、最初に環境変数 *note PYTHONBREAKPOINT: cd2. を
     調べます。 それが ‘"0"’ に設定されていた場合は、この関数はすぐに終
     了します。つまり何もしません。 この環境変数が設定されていないか、空
     文字列に設定されていた場合は、 ‘pdb.set_trace()’ が呼ばれます。 そ
     れ以外の場合は、この変数は実行する関数の名前である必要があります。
     関数名の指定では、例えば ‘package.subpackage.module.function’ のよ
     うなドットでつながれた Python のインポートの命名体系を使ったを使い
     ます。 この場合では、 ‘package.subpackage.module’ がインポートされ
     、そのインポートされたモジュールには ‘function()’ という呼び出し可
     能オブジェクトがなくてはなりません。 この関数が渡された ‘*args’ と
     ‘**kws’ で実行され、 ‘function()’ の返り値が何であれ
     ‘sys.breakpointhook()’ は組み込みの *note breakpoint(): 271. 関数に
     その値をそのまま返します。

     *note PYTHONBREAKPOINT: cd2. で指名された呼び出し可能オブジェクトの
     インポートで何かしら問題が起きた場合、 *note RuntimeWarning: 4d7. が
     報告されブレークポイントは無視されることに注意してください。

     また、 ‘sys.breakpointhook()’ がプログラム上で上書きされていた場合
     は *note PYTHONBREAKPOINT: cd2. は '調べられない' ことにも注意して
     ください。

     Added in version 3.7.

 -- の関数: sys._debugmallocstats ()

     CPython のメモリアロケータの状態に関する低レベルの情報を標準エラー
     出力に出力します。

     If Python is *note built in debug mode: 509. (*note configure
     -with-pydebug option: 666.), it also performs some expensive
     internal consistency checks.

     Added in version 3.3.

     この関数は CPython 固有です。正確な出力形式は定義されていませんし、
     変更されるかもしれません。

 -- データ: sys.dllhandle

     Python DLLのハンドルを示す整数です。

     *note Availability: 213f.: Windows.

 -- の関数: sys.displayhook (value)

     'value' が ‘None’ 以外の時、‘repr(value)’ を ‘sys.stdout’ に出力し
     、‘builtins._’ に保存します。‘repr(value)’ がエラーハンドラを
     ‘sys.stdout.errors’ (おそらく ‘'strict'’) として
     ‘sys.stdout.encoding’ にエンコードできない場合、エラーハンドラを
     ‘'backslashreplace'’ として ‘sys.stdout.encoding’ にエンコードしま
     す。

     ‘sys.displayhook’ は、Pythonの対話セッションで入力された *note 式:
     23cf. が評価されたときに呼び出されます。対話セッションの出力をカス
     タマイズする場合、 ‘sys.displayhook’ に引数の数が一つの関数を指定し
     ます。

     擬似コード:

          def displayhook(value):
              if value is None:
                  return
              # Set '_' to None to avoid recursion
              builtins._ = None
              text = repr(value)
              try:
                  sys.stdout.write(text)
              except UnicodeEncodeError:
                  bytes = text.encode(sys.stdout.encoding, 'backslashreplace')
                  if hasattr(sys.stdout, 'buffer'):
                      sys.stdout.buffer.write(bytes)
                  else:
                      text = bytes.decode(sys.stdout.encoding, 'strict')
                      sys.stdout.write(text)
              sys.stdout.write("\n")
              builtins._ = value

     バージョン 3.2 で変更: *note UnicodeEncodeError: 887. には
     ‘'backslashreplace'’ エラーハンドラを指定してください。

 -- データ: sys.dont_write_bytecode

     この値が真の時、Python はソースモジュールをインポートする時に
     ‘.pyc’ ファイルを生成しません。この値は *note -B: 15e6. コマンドラ
     インオプションと *note PYTHONDONTWRITEBYTECODE: 15e7. 環境変数の値
     によって、起動時に ‘True’ か ‘False’ に設定されますが、実行時にこの
     変数を変更してバイトコード生成を制御することもできます。

 -- データ: sys._emscripten_info

     A *note named tuple: 85e. holding information about the environment
     on the 'wasm32-emscripten' platform.  The named tuple is
     provisional and may change in the future.

      -- の属性: _emscripten_info.emscripten_version

          Emscripten version as tuple of ints (major, minor, micro),
          e.g.  ‘(3, 1, 8)’.

      -- の属性: _emscripten_info.runtime

          Runtime string, e.g.  browser user agent, ‘'Node.js
          v14.18.2'’, or ‘'UNKNOWN'’.

      -- の属性: _emscripten_info.pthreads

          ‘True’ if Python is compiled with Emscripten pthreads support.

      -- の属性: _emscripten_info.shared_memory

          ‘True’ if Python is compiled with shared memory support.

     *note Availability: 213f.: Emscripten.

     Added in version 3.11.

 -- データ: sys.pycache_prefix

     If this is set (not ‘None’), Python will write bytecode-cache
     ‘.pyc’ files to (and read them from) a parallel directory tree
     rooted at this directory, rather than from ‘__pycache__’
     directories in the source code tree.  Any ‘__pycache__’ directories
     in the source code tree will be ignored and new ‘.pyc’ files
     written within the pycache prefix.  Thus if you use *note
     compileall: 21. as a pre-build step, you must ensure you run it
     with the same pycache prefix (if any) that you will use at runtime.

     A relative path is interpreted relative to the current working
     directory.

     This value is initially set based on the value of the *note -X:
     16f. ‘pycache_prefix=PATH’ command-line option or the *note
     PYTHONPYCACHEPREFIX: b9b. environment variable (command-line takes
     precedence).  If neither are set, it is ‘None’.

     Added in version 3.8.

 -- の関数: sys.excepthook (type, value, traceback)

     指定したトレースバックと例外を ‘sys.stderr’ に出力します。

     When an exception other than *note SystemExit: f3c. is raised and
     uncaught, the interpreter calls ‘sys.excepthook’ with three
     arguments, the exception class, exception instance, and a traceback
     object.  In an interactive session this happens just before control
     is returned to the prompt; in a Python program this happens just
     before the program exits.  The handling of such top-level
     exceptions can be customized by assigning another three-argument
     function to ‘sys.excepthook’.

     Raise an auditing event ‘sys.excepthook’ with arguments ‘hook’,
     ‘type’, ‘value’, ‘traceback’ when an uncaught exception occurs.  If
     no hook has been set, ‘hook’ may be ‘None’.  If any hook raises an
     exception derived from *note RuntimeError: 244. the call to the
     hook will be suppressed.  Otherwise, the audit hook exception will
     be reported as unraisable and ‘sys.excepthook’ will be called.

     参考
     ....

     The *note sys.unraisablehook(): 507. function handles unraisable
     exceptions and the *note threading.excepthook(): a4b. function
     handles exception raised by *note threading.Thread.run(): c31.

 -- データ: sys.__breakpointhook__
 -- データ: sys.__displayhook__
 -- データ: sys.__excepthook__
 -- データ: sys.__unraisablehook__

     これらのオブジェクトはそれぞれ、プログラム起動時の
     ‘breakpointhook’, ‘displayhook’, ‘excepthook’, ‘unraisablehook’ の
     値を保存しています。 この値は、 ‘breakpointhook’, ‘displayhook’,
     ‘excepthook’, ‘unraisablehook’ に不正なオブジェクトや別のオブジェク
     トが指定された場合に、元の値に復旧するために使用します。

     Added in version 3.7: __breakpointhook__

     Added in version 3.8: __unraisablehook__

 -- の関数: sys.exception ()

     This function, when called while an exception handler is executing
     (such as an ‘except’ or ‘except*’ clause), returns the exception
     instance that was caught by this handler.  When exception handlers
     are nested within one another, only the exception handled by the
     innermost handler is accessible.

     If no exception handler is executing, this function returns ‘None’.

     Added in version 3.11.

 -- の関数: sys.exc_info ()

     This function returns the old-style representation of the handled
     exception.  If an exception ‘e’ is currently handled (so *note
     exception(): 89b. would return ‘e’), *note exc_info(): 89a. returns
     the tuple ‘(type(e), e, e.__traceback__)’.  That is, a tuple
     containing the type of the exception (a subclass of *note
     BaseException: 7d6.), the exception itself, and a *note traceback
     object: cec. which typically encapsulates the call stack at the
     point where the exception last occurred.

     If no exception is being handled anywhere on the stack, this
     function return a tuple containing three ‘None’ values.

     バージョン 3.11 で変更: The ‘type’ and ‘traceback’ fields are now
     derived from the ‘value’ (the exception instance), so when an
     exception is modified while it is being handled, the changes are
     reflected in the results of subsequent calls to *note exc_info():
     89a.

 -- データ: sys.exec_prefix

     Python のプラットフォーム依存なファイルがインストールされているディ
     レクトリ名を示す文字列です。この値はサイト固有であり、デフォルトは
     ‘'/usr/local'’ ですが、ビルド時に ‘configure’ の ‘--exec-prefix’ 引
     数で指定することができます。すべての設定ファイル (‘pyconfig.h’ など
     ) は ‘`exec_prefix'/lib/python`X.Y'/config’ に、共有ライブラリは
     ‘`exec_prefix'/lib/python`X.Y'/lib-dynload’ にインストールされます
     ('X.Y' は ‘3.2’ のような Python のバージョン番号)。

          注釈: If a *note virtual environment: 3e8. is in effect, this
          *note exec_prefix: 3eb. will point to the virtual environment.
          The value for the Python installation will still be available,
          via *note base_exec_prefix: 3ea.  Refer to *note Virtual
          Environments: 48b3. for more information.

     バージョン 3.14 で変更: When running under a *note virtual
     environment: 3e8, *note prefix: 3e7. and *note exec_prefix: 3eb.
     are now set to the virtual environment prefix by the *note path
     initialization: 18dc, instead of *note site: cc.  This means that
     *note prefix: 3e7. and *note exec_prefix: 3eb. always point to the
     virtual environment, even when *note site: cc. is disabled (*note
     -S: 13c0.).

 -- データ: sys.executable

     Python インタプリタの実行ファイルの絶対パスを示す文字列です。このよ
     うな名前が意味を持つシステムで利用可能です。Python が自身の実行ファ
     イルの実際のパスを取得できない場合、*note sys.executable: 3ed. は空
     の文字列または ‘None’ になります。

 -- の関数: sys.exit ([arg])

     Raise a *note SystemExit: f3c. exception, signaling an intention to
     exit the interpreter.

     The optional argument 'arg' can be an integer giving the exit
     status (defaulting to zero), or another type of object.  If it is
     an integer, zero is considered "successful termination" and any
     nonzero value is considered "abnormal termination" by shells and
     the like.  Most systems require it to be in the range 0-127, and
     produce undefined results otherwise.  Some systems have a
     convention for assigning specific meanings to specific exit codes,
     but these are generally underdeveloped; Unix programs generally use
     2 for command line syntax errors and 1 for all other kinds of
     errors.  If another type of object is passed, ‘None’ is equivalent
     to passing zero, and any other object is printed to *note stderr:
     b33. and results in an exit code of 1.  In particular,
     ‘sys.exit("some error message")’ is a quick way to exit a program
     when an error occurs.

     Since *note exit(): 25e7. ultimately "only" raises an exception, it
     will only exit the process when called from the main thread, and
     the exception is not intercepted.  Cleanup actions specified by
     finally clauses of *note try: 8f8. statements are honored, and it
     is possible to intercept the exit attempt at an outer level.

     バージョン 3.6 で変更: Python インタープリタが (バッファされたデー
     タを標準ストリームに吐き出すときのエラーなどの) *note SystemExit:
     f3c. を捕捉した後の後始末でエラーが起きた場合、終了ステータスは 120
     に変更されます。

 -- データ: sys.flags

     The *note named tuple: 85e. 'flags' exposes the status of command
     line flags.  Flags should only be accessed only by name and not by
     index.  The attributes are read only.

      -- の属性: flags.debug                                *note -d: 2123.
                                                            
                                                            
      -- の属性: flags.inspect                              *note -i: 16f4.
                                                            
                                                            
      -- の属性: flags.interactive                          *note -i: 16f4.
                                                            
                                                            
      -- の属性: flags.isolated                             *note -I: b57.
                                                            
                                                            
      -- の属性: flags.optimize                             *note -O: 18c. または *note -OO: fb5.
                                                            
                                                            
      -- の属性: flags.dont_write_bytecode                  *note -B: 15e6.
                                                            
                                                            
      -- の属性: flags.no_user_site                         *note -s: 15a6.
                                                            
                                                            
      -- の属性: flags.no_site                              *note -S: 13c0.
                                                            
                                                            
      -- の属性: flags.ignore_environment                   *note -E: b56.
                                                            
                                                            
      -- の属性: flags.verbose                              *note -v: 163e.
                                                            
                                                            
      -- の属性: flags.bytes_warning                        *note -b: 7f9.
                                                            
                                                            
      -- の属性: flags.quiet                                *note -q: 177e.
                                                            
                                                            
      -- の属性: flags.hash_randomization                   *note -R: 1e78.
                                                            
                                                            
      -- の属性: flags.dev_mode                             *note -X dev: 16f.
                                                            (*note Python Development Mode: 508.)
                                                            
                                                            
      -- の属性: flags.utf8_mode                            *note -X utf8: 16f.
                                                            
                                                            
      -- の属性: flags.safe_path                            *note -P: 7c1.
                                                            
                                                            
      -- の属性: flags.int_max_str_digits                   *note -X int_max_str_digits: 16f.
                                                            (*note integer string conversion length limitation: 80b.)
                                                            
                                                            
      -- の属性: flags.warn_default_encoding                *note -X warn_default_encoding: 16f.
                                                            
                                                            
      -- の属性: flags.gil                                  *note -X gil: 16f. and *note PYTHON_GIL: 49a.
                                                            
                                                            
      -- の属性: flags.thread_inherit_context               *note -X thread_inherit_context: 16f. and
                                                            *note PYTHON_THREAD_INHERIT_CONTEXT: 1868.
                                                            
                                                            
      -- の属性: flags.context_aware_warnings               *note -X context_aware_warnings: 16f. and
                                                            *note PYTHON_CONTEXT_AWARE_WARNINGS: 185b.
                                                            

     バージョン 3.2 で変更: 新しい *note -q: 177e. 向けに ‘quiet’ 属性が
     追加されました。

     Added in version 3.2.3: ‘hash_randomization’ 属性が追加されました。

     バージョン 3.3 で変更: 廃止済みの ‘division_warning’ 属性を削除しま
     した。

     バージョン 3.4 で変更: *note -I: b57. ‘isolated’ フラグ向けに
     ‘isolated’ 属性が追加されました。

     バージョン 3.7 で変更: 新しい *note Python 開発モード: 508. 向けに
     ‘dev_mode’ 属性が、新しい *note -X: 16f. ‘utf8’ フラグ向けに
     ‘utf8_mode’ 属性が追加されました。

     バージョン 3.10 で変更: Added ‘warn_default_encoding’ attribute for
     *note -X: 16f. ‘warn_default_encoding’ flag.

     バージョン 3.11 で変更: Added the ‘safe_path’ attribute for *note
     -P: 7c1. option.

     バージョン 3.11 で変更: Added the ‘int_max_str_digits’ attribute.

     バージョン 3.13 で変更: Added the ‘gil’ attribute.

     バージョン 3.14 で変更: Added the ‘thread_inherit_context’
     attribute.

     バージョン 3.14 で変更: Added the ‘context_aware_warnings’
     attribute.

 -- データ: sys.float_info

     float 型に関する情報を保持している *note 名前付きタプル: 85e. です
     。精度と内部表現に関する低レベル情報を含んでいます。これらの値は
     'C' 言語の標準ヘッダファイル ‘float.h’ で定義されている様々な浮動小
     数点定数に対応しています。詳細は 1999 ISO/IEC C standard *note
     [C99]: 4909. の 5.2.4.2.2 節 'Characteristics of floating types' を
     参照してください。 Attributes of the ‘float_info’ named tuple

     属性                                  float.h のマクロ                      説明
                                                                                 
     ------------------------------------------------------------------------------------------------------------------
                                                                                 
      -- の属性: float_info.epsilon        ‘DBL_EPSILON’                         difference between 1.0 and the
                                                                                 least value greater than 1.0 that
                                                                                 is representable as a float.
                                                                                 
                                                                                 *note math.ulp(): b0e. を参照してく
                                                                                 ださい。
                                                                                 
                                                                                 
      -- の属性: float_info.dig            ‘DBL_DIG’                             The maximum number of decimal
                                                                                 digits that can be faithfully
                                                                                 represented in a float; see below.
                                                                                 
                                                                                 
      -- の属性: float_info.mant_dig       ‘DBL_MANT_DIG’                        Float precision: the number of
                                                                                 base-‘radix’ digits in the
                                                                                 significand of a float.
                                                                                 
                                                                                 
      -- の属性: float_info.max            ‘DBL_MAX’                             The maximum representable positive
                                                                                 finite float.
                                                                                 
                                                                                 
      -- の属性: float_info.max_exp        ‘DBL_MAX_EXP’                         The maximum integer 'e' such that
                                                                                 ‘radix**(e-1)’ is a representable
                                                                                 finite float.
                                                                                 
                                                                                 
      -- の属性: float_info.max_10_exp     ‘DBL_MAX_10_EXP’                      The maximum integer 'e' such that
                                                                                 ‘10**e’ is in the range of
                                                                                 representable finite floats.
                                                                                 
                                                                                 
      -- の属性: float_info.min            ‘DBL_MIN’                             The minimum representable positive
                                                                                 'normalized' float.
                                                                                 
                                                                                 Use *note math.ulp(0.0): b0e. to
                                                                                 get the smallest positive
                                                                                 'denormalized' representable float.
                                                                                 
                                                                                 
      -- の属性: float_info.min_exp        ‘DBL_MIN_EXP’                         The minimum integer 'e' such that
                                                                                 ‘radix**(e-1)’ is a normalized
                                                                                 float.
                                                                                 
                                                                                 
      -- の属性: float_info.min_10_exp     ‘DBL_MIN_10_EXP’                      The minimum integer 'e' such that
                                                                                 ‘10**e’ is a normalized float.
                                                                                 
                                                                                 
      -- の属性: float_info.radix          ‘FLT_RADIX’                           The radix of exponent
                                                                                 representation.
                                                                                 
                                                                                 
      -- の属性: float_info.rounds         ‘FLT_ROUNDS’                          An integer representing the
                                                                                 rounding mode for floating-point
                                                                                 arithmetic.  This reflects the
                                                                                 value of the system ‘FLT_ROUNDS’
                                                                                 macro at interpreter startup time:
                                                                                 
                                                                                    * ‘-1’: indeterminable
                                                                                 
                                                                                    * ‘0’: toward zero
                                                                                 
                                                                                    * ‘1’: to nearest
                                                                                 
                                                                                    * ‘2’: toward positive infinity
                                                                                 
                                                                                    * ‘3’: toward negative infinity
                                                                                 
                                                                                 All other values for ‘FLT_ROUNDS’
                                                                                 characterize implementation-defined
                                                                                 rounding behavior.
                                                                                 

     The attribute *note sys.float_info.dig: 490b. needs further
     explanation.  If ‘s’ is any string representing a decimal number
     with at most ‘sys.float_info.dig’ significant digits, then
     converting ‘s’ to a float and back again will recover a string
     representing the same decimal value:

          >>> import sys
          >>> sys.float_info.dig
          15
          >>> s = '3.14159265358979'    # decimal string with 15 significant digits
          >>> format(float(s), '.15g')  # convert to float and back -> same value
          '3.14159265358979'

     ただし、文字列が有効桁数 *note sys.float_info.dig: 490b. より大きい
     場合には、常に復元されるとは限りません:

          >>> s = '9876543211234567'    # 16 significant digits is too many!
          >>> format(float(s), '.16g')  # conversion changes value
          '9876543211234568'

 -- データ: sys.float_repr_style

     *note repr(): 1c1. 関数が浮動小数点数に対してどう振る舞うかを示す文
     字列です。この文字列が値 ‘'short'’ を持てば、有限の浮動小数点数 ‘x’
     に対して、‘repr(x)’ は ‘float(repr(x)) == x’ を満たす短い文字列を返
     そうとします。これは、Python 3.1 以降での標準の振る舞いです。それ以
     外の場合、‘float_repr_style’ は値 ‘'legacy'’ を持ち、‘repr(x)’ は
     3.1 以前のバージョンの Python と同じように振る舞います。

     Added in version 3.1.

 -- の関数: sys.getallocatedblocks ()

     Return the number of memory blocks currently allocated by the
     interpreter, regardless of their size.  This function is mainly
     useful for tracking and debugging memory leaks.  Because of the
     interpreter's internal caches, the result can vary from call to
     call; you may have to call *note _clear_internal_caches(): 364. and
     *note gc.collect(): 1b3. to get more predictable results.

     If a Python build or implementation cannot reasonably compute this
     information, *note getallocatedblocks(): 11c9. is allowed to return
     0 instead.

     Added in version 3.4.

 -- の関数: sys.getunicodeinternedsize ()

     Return the number of unicode objects that have been interned.

     Added in version 3.12.

 -- の関数: sys.getandroidapilevel ()

     Return the build-time API level of Android as an integer.  This
     represents the minimum version of Android this build of Python can
     run on.  For runtime version information, see *note
     platform.android_ver(): 19c6.

     *note Availability: 213f.: Android.

     Added in version 3.7.

 -- の関数: sys.getdefaultencoding ()

     Return ‘'utf-8'’.  This is the name of the default string encoding,
     used in methods like *note str.encode(): ad2.

 -- の関数: sys.getdlopenflags ()

     Return the current value of the flags that are used for ‘dlopen()’
     calls.  Symbolic names for the flag values can be found in the
     *note os: a5. module (‘RTLD_XXX’ constants, e.g.  *note
     os.RTLD_LAZY: 1330.).

     *note Availability: 213f.: Unix.

 -- の関数: sys.getfilesystemencoding ()

     Get the *note filesystem encoding: 75d.: the encoding used with the
     *note filesystem error handler: 75d. to convert between Unicode
     filenames and bytes filenames.  The filesystem error handler is
     returned from *note getfilesystemencodeerrors(): ee2.

     最良の互換性のために、たとえファイル名の表現に bytes がサポートされ
     ていたとしても、全てのケースで str をファイル名に使うべきです。 フ
     ァイル名を受け取ったり返したりする関数は str と bytes をサポートし
     、すぐにシステムにとって好ましい表現に変換すべきです。

     *note os.fsencode(): e4f. や *note os.fsdecode(): e4e. を、正しいエ
     ンコーディングやエラーモードが使われていることを保証するために使う
     べきです。

     term:‘ファイルシステムのエンコーディングとエラーハンドラ
     <filesystem encoding and error handler>’ は、Pythonの開始時に
     :c:func:‘PyConfig_Read’ 関数により設定されます。 *note PyConfig:
     3f7. のメンバー *note filesystem_encoding: 41b. と *note
     filesystem_errors: 41c. を参照してください。

     バージョン 3.2 で変更: *note getfilesystemencoding(): e53. の結果が
     ‘None’ になることはなくなりました。

     バージョン 3.6 で変更: Windows はもう ‘'mbcs'’ を返す保証は無くなり
     ました。 より詳しいことは PEP 529(3) および *note
     _enablelegacywindowsfsencoding(): 33e. を参照してください。

     バージョン 3.7 で変更: *note Python UTF-8 モード: 866. が有効なら
     ‘"utf-8"’ を返します。

 -- の関数: sys.getfilesystemencodeerrors ()

     Get the *note filesystem error handler: 75d.: the error handler
     used with the *note filesystem encoding: 75d. to convert between
     Unicode filenames and bytes filenames.  The filesystem encoding is
     returned from *note getfilesystemencoding(): e53.

     *note os.fsencode(): e4f. や *note os.fsdecode(): e4e. を、正しいエ
     ンコーディングやエラーモードが使われていることを保証するために使う
     べきです。

     term:‘ファイルシステムのエンコーディングとエラーハンドラ
     <filesystem encoding and error handler>’ は、Pythonの開始時に
     :c:func:‘PyConfig_Read’ 関数により設定されます。 *note PyConfig:
     3f7. のメンバー *note filesystem_encoding: 41b. と *note
     filesystem_errors: 41c. を参照してください。

     Added in version 3.6.

 -- の関数: sys.get_int_max_str_digits ()

     Returns the current value for the *note integer string conversion
     length limitation: 80b.  See also *note set_int_max_str_digits():
     18f1.

     Added in version 3.11.

 -- の関数: sys.getrefcount (object)

     'object' の参照数を返します。 'object' は (一時的に) *note
     getrefcount(): 2ce. からも参照されるため、参照数は予想される数より
     も 1 多くなります。

     戻り値は、実際に保持されているオブジェクトの参照の数を実際に反映し
     ているとは限らないことに注意してください。例えば、一部のオブジェク
     トは永続 (*note immortal: 290.) であり、実際の参照の数を反映しない
     非常に高い参照数を持ちます。したがって、 0 か 1 の値以外では、正確
     な戻り値に頼らないでください。

     'CPython 実装の詳細:' *note Immortal: 290. objects with a large
     reference count can be identified via *note _is_immortal(): 28f.

     バージョン 3.12 で変更: Immortal objects have very large refcounts
     that do not match the actual number of references to the object.

 -- の関数: sys.getrecursionlimit ()

     現在の最大再帰数を返します。最大再帰数は、Python インタプリタスタッ
     クの最大の深さです。この制限は Python プログラムが無限に再帰し、C ス
     タックがオーバーフローしてクラッシュすることを防止するために設けら
     れています。この値は *note setrecursionlimit(): 6ea. で指定すること
     ができます。

 -- の関数: sys.getsizeof (object[, default])

     'object' のサイズをバイト数で返します。'object' は任意の型のオブジ
     ェクトです。すべての組み込みオブジェクトは正しい値を返します。サー
     ドパーティー製の型については実装依存になります。

     オブジェクトに直接起因するメモリ消費のみを表し、参照するオブジェク
     トは含みません。

     オブジェクトがサイズを取得する手段を提供していない時は 'default' が
     返されます。'default' が指定されていない場合は *note TypeError:
     198. が送出されます。

     *note getsizeof(): 1adb. は 'object' の ‘__sizeof__’ メソッドを呼び
     出し、そのオブジェクトがガベージコレクタに管理されていた場合はガベ
     ージコレクタのオーバーヘッドを増やします。

     See recursive sizeof recipe(4) for an example of using *note
     getsizeof(): 1adb. recursively to find the size of containers and
     all their contents.

 -- の関数: sys.getswitchinterval ()

     Return the interpreter's "thread switch interval" in seconds; see
     *note setswitchinterval(): b44.

     Added in version 3.2.

 -- の関数: sys._getframe ([depth])

     コールスタックからフレームオブジェクトを返します。オプション引数
     'depth' を指定すると、スタックのトップから 'depth' だけ下のフレーム
     オブジェクトを取得します。 'depth' がコールスタックよりも深ければ、
     *note ValueError: 2ec. が発生します。 'depth' のデフォルト値は 0 で
     、この場合はコールスタックのトップのフレームを返します。

     引数 ‘frame’ で *note 監査イベント: 1c6e. ‘sys._getframe’ を送出し
     ます。

     この関数は、内部的かつ特殊な目的にのみ利用されるべきです。全ての
     Python 実装で存在することが保証されているわけではありません。

 -- の関数: sys._getframemodulename ([depth])

     Return the name of a module from the call stack.  If optional
     integer 'depth' is given, return the module that many calls below
     the top of the stack.  If that is deeper than the call stack, or if
     the module is unidentifiable, ‘None’ is returned.  The default for
     'depth' is zero, returning the module at the top of the call stack.

     Raises an *note auditing event: 1c6e. ‘sys._getframemodulename’
     with argument ‘depth’.

     この関数は、内部的かつ特殊な目的にのみ利用されるべきです。全ての
     Python 実装で存在することが保証されているわけではありません。

     Added in version 3.12.

 -- の関数: sys.getobjects (limit[, type])

     This function only exists if CPython was built using the
     specialized configure option *note -with-trace-refs: 636.  It is
     intended only for debugging garbage-collection issues.

     Return a list of up to 'limit' dynamically allocated Python
     objects.  If 'type' is given, only objects of that exact type (not
     subtypes) are included.

     Objects from the list are not safe to use.  Specifically, the
     result will include objects from all interpreters that share their
     object allocator state (that is, ones created with *note
     PyInterpreterConfig.use_main_obmalloc: 4917. set to 1 or using
     *note Py_NewInterpreter(): 1b31, and the *note main interpreter:
     163.).  Mixing objects from different interpreters may lead to
     crashes or other unexpected behavior.

     'CPython 実装の詳細:' This function should be used for specialized
     purposes only.  It is not guaranteed to exist in all
     implementations of Python.

     バージョン 3.14 で変更: The result may include objects from other
     interpreters.

 -- の関数: sys.getprofile ()

     *note setprofile(): 1717. 関数で設定したプロファイラ関数を取得しま
     す。

 -- の関数: sys.gettrace ()

     *note settrace(): 2e1. 関数で設定したトレース関数を取得します。

     *note gettrace(): 15fa. 関数は、デバッガ、プロファイラ、カバレッジ
     ツールなどの実装に使うことのみを想定しています。この関数の振る舞い
     は言語定義ではなく実装プラットフォームの一部です。そのため、他の
     Python 実装では利用できないかもしれません。

 -- の関数: sys.getwindowsversion ()

     実行中の Windows バージョンを示す、名前付きタプルを返します。 名前
     の付いている要素は、 'major', 'minor', 'build', 'platform',
     'service_pack', 'service_pack_minor', 'service_pack_major',
     'suite_mask', 'product_type', 'platform_version' です。
     'service_pack' は文字列を含み、 'platform_version' は 3-タプル、そ
     れ以外は整数です。 この構成要素には名前でもアクセスできるので、
     ‘sys.getwindowsversion()[0]’ は ‘sys.getwindowsversion().major’ と
     等価です。 先行のバージョンとの互換性のため、最初の 5 要素のみが添
     字の指定で取得できます。

     'platform' will be ‘2’ (VER_PLATFORM_WIN32_NT).

     'product_type' は、以下の値のいずれかになります。:

     定数                                        意味
                                                 
     ----------------------------------------------------------------------------------
                                                 
     ‘1’ (VER_NT_WORKSTATION)                    システムはワークステーションです。
                                                 
                                                 
     ‘2’ (VER_NT_DOMAIN_CONTROLLER)              システムはドメインコントローラです
                                                 。
                                                 
                                                 
     ‘3’ (VER_NT_SERVER)                         システムはサーバですが、ドメインコ
                                                 ントローラではありません。
                                                 

     This function wraps the Win32 ‘GetVersionEx()’ function; see the
     Microsoft documentation on ‘OSVERSIONINFOEX()’ for more information
     about these fields.

     'platform_version' は、プロセスでエミュレートされているバージョンで
     はなく、現在のオペレーティングシステムのメジャーバージョン、マイナ
     ーバージョン、ビルドナンバーを返します。 この関数は機能の検知ではな
     くロギングで使うためのものです。

          注釈: 'platform_version' derives the version from kernel32.dll
          which can be of a different version than the OS version.
          Please use *note platform: af. module for achieving accurate
          OS version.

     *note Availability: 213f.: Windows.

     バージョン 3.2 で変更: 名前付きタプルに変更され、
     'service_pack_minor', 'service_pack_major', 'suite_mask', および
     'product_type' が追加されました。

     バージョン 3.6 で変更: 'platform_version' の追加

 -- の関数: sys.get_asyncgen_hooks ()

     'asyncgen_hooks' オブジェクトを返します。このオブジェクトは
     ‘(firstiter, finalizer)’ という形の *note namedtuple: 4e0. に似た形
     をしています。 'firstiter' と 'finalizer' は両方とも ‘None’ か、
     *note asynchronous generator iterator: 4918. を引数に取る関数と、イ
     ベントループが非同期ジェネレータの終了処理をスケジューリングするの
     に使う関数であることが求められます。

     Added in version 3.6: より詳しくは PEP 525(5) を参照してください。

          注釈: This function has been added on a provisional basis (see
          PEP 411(6) for details.)

 -- の関数: sys.get_coroutine_origin_tracking_depth ()

     Get the current coroutine origin tracking depth, as set by *note
     set_coroutine_origin_tracking_depth(): d85.

     Added in version 3.7.

          注釈: This function has been added on a provisional basis (see
          PEP 411(7) for details.)  Use it only for debugging purposes.

 -- データ: sys.hash_info

     数値のハッシュ実装のパラメータを与える *note named tuple: 85e. です
     。数値型のハッシュ化についての詳細は *note 数値型のハッシュ化:
     25fe. を参照してください。

      -- の属性: hash_info.width

          The width in bits used for hash values

      -- の属性: hash_info.modulus

          The prime modulus P used for numeric hash scheme

      -- の属性: hash_info.inf

          The hash value returned for a positive infinity

      -- の属性: hash_info.nan

          (This attribute is no longer used)

      -- の属性: hash_info.imag

          The multiplier used for the imaginary part of a complex number

      -- の属性: hash_info.algorithm

          The name of the algorithm for hashing of str, bytes, and
          memoryview

      -- の属性: hash_info.hash_bits

          The internal output size of the hash algorithm

      -- の属性: hash_info.seed_bits

          The size of the seed key of the hash algorithm

      -- の属性: hash_info.cutoff

          Cutoff for small string DJBX33A optimization in range ‘[1,
          cutoff)’.

     Added in version 3.2.

     バージョン 3.4 で変更: Added 'algorithm', 'hash_bits', 'seed_bits',
     and 'cutoff'.

 -- データ: sys.hexversion

     単精度整数にエンコードされたバージョン番号。この値は新バージョン(正
     規リリース以外であっても)ごとにかならず増加します。例えば、Python
     1.5.2 以降でのみ動作するプログラムでは、以下のようなチェックを行い
     ます。

          if sys.hexversion >= 0x010502F0:
              # use some advanced feature
              ...
          else:
              # use an alternative implementation or warn the user
              ...

     ‘hexversion’ は *note hex(): 14e7. 関数を使って 16 進数に変換しなけ
     れば値の意味を持ちません。より読みやすいバージョン番号が必要な場合
     には *note named tuple: 85e. *note sys.version_info: 8af. を使用し
     てください。

     ‘hexversion’ のより詳しい情報については *note API と ABI
     のバージョニング: 4922. を参照してください。

 -- データ: sys.implementation

     現在起動している Python インタプリタに関する情報が格納されたオブジ
     ェクトです。すべての Python 実装において、以下の属性が存在すること
     が要求されています。

     'name' は実装の識別子です (例: ‘'cpython'’)。実際の文字列は Python
     実装によって定義されますが、小文字であることが保証されています。

     'version' は *note sys.version_info: 8af. と同じ形式の、Python '実
     装' のバージョンを表す名前付きタプルです。これは現在起動しているイ
     ンタプリタ固有のバージョンを意味します。‘sys.version_info’ は
     Python '言語' のバージョンであり、これはそのバージョンに準拠した '実
     装' のバージョンです。例えば、PyPy 1.8 の
     ‘sys.implementation.version’ は ‘sys.version_info(1, 8, 0, 'final',
     0)’ になるのに対し、 ‘sys.version_info’ は ‘sys.version_info(2, 7,
     2, 'final', 0)’ になります。CPython は、それがリファレンス実装であ
     るため、両者は同じ値になります。

     'hexversion' は *note sys.hexversion: 4921. と同形式の、16 進数での
     実装のバージョンです。

     'cache_tag' は、キャッシュされたモジュールのファイル名に使用される
     タグです。慣例により、これは実装名とバージョンを組み合わせた文字列
     になります (例: ‘'cpython-33'’) が、Python 実装はその他の適切な値を
     使う場合があります。‘cache_tag’ に ‘None’ が設定された場合、モジュ
     ールのキャッシングが無効になっていることを示します。

     'supports_isolated_interpreters' is a boolean value, whether this
     implementation supports multiple isolated interpreters.  It is
     ‘True’ for CPython on most platforms.  Platforms with this support
     implement the low-level ‘_interpreters’ module.

     参考
     ....

     PEP 684(8), PEP 734(9), and *note concurrent.interpreters: 25.

     *note sys.implementation: 73b. には Python 実装固有の属性を追加する
     ことができます。それら非標準属性の名前はアンダースコアから始めなく
     てはならず、そしてここでは説明されません。その内容に関係なく、*note
     sys.implementation: 73b. はインタプリタ起動中や実装のバージョン間で
     変更することはありません (ただし Python 言語のバージョン間について
     はその限りではありません)。詳細は PEP 421(10) を参照してください。

     Added in version 3.3.

     バージョン 3.14 で変更: Added ‘supports_isolated_interpreters’
     field.

          注釈: The addition of new required attributes must go through
          the normal PEP process.  See PEP 421(11) for more information.

 -- データ: sys.int_info

     Python における整数の内部表現に関する情報を保持する、*note named
     tuple: 85e. です。この属性は読み出し専用です。

      -- の属性: int_info.bits_per_digit

          The number of bits held in each digit.  Python integers are
          stored internally in base ‘2**int_info.bits_per_digit’.

      -- の属性: int_info.sizeof_digit

          The size in bytes of the C type used to represent a digit.

      -- の属性: int_info.default_max_str_digits

          The default value for *note sys.get_int_max_str_digits():
          1818. when it is not otherwise explicitly configured.

      -- の属性: int_info.str_digits_check_threshold

          The minimum non-zero value for *note
          sys.set_int_max_str_digits(): 18f1, *note
          PYTHONINTMAXSTRDIGITS: 1b3a, or *note -X int_max_str_digits:
          16f.

     Added in version 3.1.

     バージョン 3.11 で変更: Added *note default_max_str_digits: 26dc.
     and *note str_digits_check_threshold: 4925.

 -- データ: sys.__interactivehook__

     この属性が存在する場合、インタープリタが *note 対話モード: 443. で
     起動したときに値は (引数なしで) 自動的に呼ばれます。これは *note
     PYTHONSTARTUP: 1b8. ファイルの読み込み後に行われるため、それにこの
     フックを設定することが出来ます。*note site: cc. モジュールで *note
     設定します: 11cb.。

     Raises an *note auditing event: 1c6e. ‘cpython.run_interactivehook’
     with the hook object as the argument when the hook is called on
     startup.

     Added in version 3.4.

 -- の関数: sys.intern (string)

     'string' を "隔離" された文字列のテーブルに入力し、隔離された文字列
     を返します - この文字列は 'string' 自体かコピーです。隔離された文字
     列は辞書検索のパフォーマンスを少しだけ向上させるのに有効です - 辞書
     中のキーが隔離されており、検索するキーが隔離されている場合、(ハッシ
     ュ化後の) キーの比較は文字列の比較ではなくポインタの比較で行うこと
     ができるからです。通常、Python プログラム内で利用されている名前は自
     動的に隔離され、モジュール、クラス、またはインスタンス属性を保持す
     るための辞書は隔離されたキーを持っています。

     Interned strings are not *note immortal: 290.; you must keep a
     reference to the return value of *note intern(): 14f3. around to
     benefit from it.

 -- の関数: sys._is_gil_enabled ()

     Return *note True: e07. if the *note GIL: 164. is enabled and *note
     False: d2b. if it is disabled.

     Added in version 3.13.

     'CPython 実装の詳細:' It is not guaranteed to exist in all
     implementations of Python.

 -- の関数: sys.is_finalizing ()

     Return *note True: e07. if the main Python interpreter is *note
     shutting down: 479.  Return *note False: d2b. otherwise.

     See also the *note PythonFinalizationError: 47a. exception.

     Added in version 3.5.

 -- データ: sys._jit

     Utilities for observing just-in-time compilation.

     'CPython 実装の詳細:' JIT compilation is an 'experimental
     implementation detail' of CPython.  ‘sys._jit’ is not guaranteed to
     exist or behave the same way in all Python implementations,
     versions, or build configurations.

     Added in version 3.14.

      -- の関数: _jit.is_available ()

          Return ‘True’ if the current Python executable supports JIT
          compilation, and ‘False’ otherwise.  This can be controlled by
          building CPython with the ‘--experimental-jit’ option on
          Windows, and the *note -enable-experimental-jit: 44e. option
          on all other platforms.

      -- の関数: _jit.is_enabled ()

          Return ‘True’ if JIT compilation is enabled for the current
          Python process (implies *note sys._jit.is_available(): 44f.),
          and ‘False’ otherwise.  If JIT compilation is available, this
          can be controlled by setting the *note PYTHON_JIT: 44d.
          environment variable to ‘0’ (disabled) or ‘1’ (enabled) at
          interpreter startup.

      -- の関数: _jit.is_active ()

          Return ‘True’ if the topmost Python frame is currently
          executing JIT code (implies *note sys._jit.is_enabled():
          450.), and ‘False’ otherwise.

               注釈: This function is intended for testing and debugging
               the JIT itself.  It should be avoided for any other
               purpose.

               注釈: Due to the nature of tracing JIT compilers,
               repeated calls to this function may give surprising
               results.  For example, branching on its return value will
               likely lead to unexpected behavior (if doing so causes
               JIT code to be entered or exited):

                    >>> for warmup in range(BIG_NUMBER):
                    ...     # This line is "hot", and is eventually JIT-compiled:
                    ...     if sys._jit.is_active():
                    ...         # This line is "cold", and is run in the interpreter:
                    ...         assert sys._jit.is_active()
                    ...
                    Traceback (most recent call last):
                      File "<stdin>", line 5, in <module>
                        assert sys._jit.is_active()
                               ~~~~~~~~~~~~~~~~~~^^
                    AssertionError

 -- データ: sys.last_exc

     This variable is not always defined; it is set to the exception
     instance when an exception is not handled and the interpreter
     prints an error message and a stack traceback.  Its intended use is
     to allow an interactive user to import a debugger module and engage
     in post-mortem debugging without having to re-execute the command
     that caused the error.  (Typical use is ‘import pdb; pdb.pm()’ to
     enter the post-mortem debugger; see *note pdb: aa. module for more
     information.)

     Added in version 3.12.

 -- の関数: sys._is_immortal (op)

     Return *note True: e07. if the given object is *note immortal: 290,
     *note False: d2b. otherwise.

          注釈: Objects that are immortal (and thus return ‘True’ upon
          being passed to this function) are not guaranteed to be
          immortal in future versions, and vice versa for mortal
          objects.

     Added in version 3.14.

     'CPython 実装の詳細:' This function should be used for specialized
     purposes only.  It is not guaranteed to exist in all
     implementations of Python.

 -- の関数: sys._is_interned (string)

     Return *note True: e07. if the given string is "interned", *note
     False: d2b. otherwise.

     Added in version 3.13.

     'CPython 実装の詳細:' It is not guaranteed to exist in all
     implementations of Python.

 -- データ: sys.last_type
 -- データ: sys.last_value
 -- データ: sys.last_traceback

     These three variables are deprecated; use *note sys.last_exc: 6e5.
     instead.  They hold the legacy representation of ‘sys.last_exc’, as
     returned from *note exc_info(): 89a. above.

 -- データ: sys.maxsize

     *note Py_ssize_t: c55. 型の変数が取りうる最大値を示す整数です。通常
     、32 ビットプラットフォームでは ‘2**31 - 1’、64 ビットプラットフォ
     ームでは ‘2**63 - 1’ になります。

 -- データ: sys.maxunicode

     Unicode コードポイントの最大値を示す整数、すなわち ‘1114111’ (16 進
     数で ‘0x10FFFF’) です。

     バージョン 3.3 で変更: PEP 393(12) 以前は、オプション設定に
     Unicode文字の保存形式がUCS-2とUCS-4のどちらを指定したかによって、
     ‘sys.maxunicode’ の値は ‘0xFFFF’ が ‘0x10FFFF’ になっていました。

 -- データ: sys.meta_path

     A list of *note meta path finder: 127c. objects that have their
     *note find_spec(): a68. methods called to see if one of the objects
     can find the module to be imported.  By default, it holds entries
     that implement Python's default import semantics.  The *note
     find_spec(): a68. method is called with at least the absolute name
     of the module being imported.  If the module to be imported is
     contained in a package, then the parent package's *note __path__:
     2054. attribute is passed in as a second argument.  The method
     returns a *note module spec: 2363, or ‘None’ if the module cannot
     be found.

     参考
     ....

     *note importlib.abc.MetaPathFinder: a6e.

          The abstract base class defining the interface of finder
          objects on *note meta_path: f27.

     *note importlib.machinery.ModuleSpec: 226c.

          The concrete class which *note find_spec(): a68. should return
          instances of.

     バージョン 3.4 で変更: *note Module specs: 2363. were introduced in
     Python 3.4, by PEP 451(13).

     バージョン 3.12 で変更: Removed the fallback that looked for a
     ‘find_module()’ method if a *note meta_path: f27. entry didn't have
     a *note find_spec(): a68. method.

 -- データ: sys.modules

     This is a dictionary that maps module names to modules which have
     already been loaded.  This can be manipulated to force reloading of
     modules and other tricks.  However, replacing the dictionary will
     not necessarily work as expected and deleting essential items from
     the dictionary may cause Python to fail.  If you want to iterate
     over this global dictionary always use ‘sys.modules.copy()’ or
     ‘tuple(sys.modules)’ to avoid exceptions as its size may change
     during iteration as a side effect of code or activity in other
     threads.

 -- データ: sys.orig_argv

     The list of the original command line arguments passed to the
     Python executable.

     The elements of *note sys.orig_argv: a41. are the arguments to the
     Python interpreter, while the elements of *note sys.argv: 147c. are
     the arguments to the user's program.  Arguments consumed by the
     interpreter itself will be present in *note sys.orig_argv: a41. and
     missing from *note sys.argv: 147c.

     Added in version 3.10.

 -- データ: sys.path

     モジュールを検索するパスを示す文字列のリスト。 *note PYTHONPATH:
     121f. 環境変数と、インストール時に指定したデフォルトパスで初期化さ
     れます。

     By default, as initialized upon program startup, a potentially
     unsafe path is prepended to *note sys.path: 3e4. ('before' the
     entries inserted as a result of *note PYTHONPATH: 121f.):

        * ‘python -m module’ command line: prepend the current working
          directory.

        * ‘python script.py’ command line: prepend the script's
          directory.  If it's a symbolic link, resolve symbolic links.

        * ‘python -c code’ and ‘python’ (REPL) command lines: prepend an
          empty string, which means the current working directory.

     To not prepend this potentially unsafe path, use the *note -P: 7c1.
     command line option or the *note PYTHONSAFEPATH: 7c2. environment
     variable.

     プログラムはその目的のために、このリストを自由に修正できます。文字
     列だけが *note sys.path: 3e4. に追加でき、 ほかの全てのデータ型はイ
     ンポート中に無視されます。

     参考
     ....

        * *note site: cc. モジュールのドキュメントで、 .pth ファイルを使
          って *note sys.path: 3e4. を拡張する方法を解説しています。

 -- データ: sys.path_hooks

     path を引数にとって、その path に対する *note finder: 236a. の作成
     を試みる呼び出し可能オブジェクトのリスト。 finder の作成に成功した
     ら、その呼出可能オブジェクトのは finder を返します。失敗した場合は
     、 *note ImportError: 65b. を発生させます。

     オリジナルの仕様は PEP 302(14) を参照してください。

 -- データ: sys.path_importer_cache

     *note finder: 236a. オブジェクトのキャッシュ機能を果たす辞書です。
     キーは *note sys.path_hooks: 1225. に渡されているパスで、値は見つか
     った finder になります。パスが正常なファイルシステムパスであり、
     finder が *note sys.path_hooks: 1225. 上に見つからない場合は ‘None’
     が格納されます。

     オリジナルの仕様は PEP 302(15) を参照してください。

 -- データ: sys.platform

     A string containing a platform identifier.  Known values are:

     システム             ‘platform’ の値
                          
     -----------------------------------------------------
                          
     AIX                  ‘'aix'’
                          
                          
     Android              ‘'android'’
                          
                          
     Emscripten           ‘'emscripten'’
                          
                          
     FreeBSD              ‘'freebsd'’
                          
                          
     iOS                  ‘'ios'’
                          
                          
     Linux                ‘'linux'’
                          
                          
     macOS                ‘'darwin'’
                          
                          
     Windows              ‘'win32'’
                          
                          
     Windows/Cygwin       ‘'cygwin'’
                          
                          
     WASI                 ‘'wasi'’
                          

     On Unix systems not listed in the table, the value is the
     lowercased OS name as returned by ‘uname -s’, with the first part
     of the version as returned by ‘uname -r’ appended, e.g.
     ‘'sunos5'’, 'at the time when Python was built'.  Unless you want
     to test for a specific system version, it is therefore recommended
     to use the following idiom:

          if sys.platform.startswith('sunos'):
              # SunOS-specific code here...

     バージョン 3.3 で変更: On Linux, *note sys.platform: 291. doesn't
     contain the major version anymore.  It is always ‘'linux'’, instead
     of ‘'linux2'’ or ‘'linux3'’.

     バージョン 3.8 で変更: On AIX, *note sys.platform: 291. doesn't
     contain the major version anymore.  It is always ‘'aix'’, instead
     of ‘'aix5'’ or ‘'aix7'’.

     バージョン 3.13 で変更: On Android, *note sys.platform: 291. now
     returns ‘'android'’ rather than ‘'linux'’.

     バージョン 3.14 で変更: On FreeBSD, *note sys.platform: 291.
     doesn't contain the major version anymore.  It is always
     ‘'freebsd'’, instead of ‘'freebsd13'’ or ‘'freebsd14'’.

     参考
     ....

     *note os.name: 3003. has a coarser granularity.  *note os.uname():
     132e. gives system-dependent version information.

     *note platform: af. モジュールはシステムの詳細な識別情報をチェック
     する機能を提供しています。

 -- データ: sys.platlibdir

     Name of the platform-specific library directory.  It is used to
     build the path of standard library and the paths of installed
     extension modules.

     It is equal to ‘"lib"’ on most platforms.  On Fedora and SuSE, it
     is equal to ‘"lib64"’ on 64-bit platforms which gives the following
     ‘sys.path’ paths (where ‘X.Y’ is the Python ‘major.minor’ version):

        * ‘/usr/lib64/pythonX.Y/’: Standard library (like ‘os.py’ of the
          *note os: a5. module)

        * ‘/usr/lib64/pythonX.Y/lib-dynload/’: C extension modules of
          the standard library (like the *note errno: 5b. module, the
          exact filename is platform specific)

        * ‘/usr/lib/pythonX.Y/site-packages/’ (always use ‘lib’, not
          *note sys.platlibdir: b32.): Third-party modules

        * ‘/usr/lib64/pythonX.Y/site-packages/’: C extension modules of
          third-party packages

     Added in version 3.9.

 -- データ: sys.prefix

     A string giving the site-specific directory prefix where the
     platform independent Python files are installed; on Unix, the
     default is ‘/usr/local’.  This can be set at build time with the
     *note -prefix: 214f. argument to the ‘configure’ script.  See *note
     インストールパス: 449. for derived paths.

          注釈: If a *note virtual environment: 3e8. is in effect, this
          *note prefix: 3e7. will point to the virtual environment.  The
          value for the Python installation will still be available, via
          *note base_prefix: 3e6.  Refer to *note Virtual Environments:
          48b3. for more information.

     バージョン 3.14 で変更: When running under a *note virtual
     environment: 3e8, *note prefix: 3e7. and *note exec_prefix: 3eb.
     are now set to the virtual environment prefix by the *note path
     initialization: 18dc, instead of *note site: cc.  This means that
     *note prefix: 3e7. and *note exec_prefix: 3eb. always point to the
     virtual environment, even when *note site: cc. is disabled (*note
     -S: 13c0.).

 -- データ: sys.ps1
 -- データ: sys.ps2

     インタプリタの一次プロンプト、二次プロンプトを指定する文字列。対話
     モードで実行中のみ定義され、初期値は ‘'>>> '’ と ‘'... '’ です。文
     字列以外のオブジェクトを指定した場合、インタプリタが対話コマンドを
     読み込むごとにオブジェクトの *note str(): 169. を評価します。この機
     能は、動的に変化するプロンプトを実装する場合に利用します。

 -- の関数: sys.setdlopenflags (n)

     Set the flags used by the interpreter for ‘dlopen()’ calls, such as
     when the interpreter loads extension modules.  Among other things,
     this will enable a lazy resolving of symbols when importing a
     module, if called as ‘sys.setdlopenflags(0)’.  To share symbols
     across extension modules, call as
     ‘sys.setdlopenflags(os.RTLD_GLOBAL)’.  Symbolic names for the flag
     values can be found in the *note os: a5. module (‘RTLD_XXX’
     constants, e.g.  *note os.RTLD_LAZY: 1330.).

     *note Availability: 213f.: Unix.

 -- の関数: sys.set_int_max_str_digits (maxdigits)

     Set the *note integer string conversion length limitation: 80b.
     used by this interpreter.  See also *note get_int_max_str_digits():
     1818.

     Added in version 3.11.

 -- の関数: sys.setprofile (profilefunc)

     Set the system's profile function, which allows you to implement a
     Python source code profiler in Python.  See chapter *note Python
     プロファイラ: 47f6. for more information on the Python profiler.
     The system's profile function is called similarly to the system's
     trace function (see *note settrace(): 2e1.), but it is called with
     different events, for example it isn't called for each executed
     line of code (only on call and return, but the return event is
     reported even when an exception has been set).  The function is
     thread-specific, but there is no way for the profiler to know about
     context switches between threads, so it does not make sense to use
     this in the presence of multiple threads.  Also, its return value
     is not used, so it can simply return ‘None’.  Error in the profile
     function will cause itself unset.

          注釈: The same tracing mechanism is used for ‘setprofile()’ as
          *note settrace(): 2e1.  To trace calls with ‘setprofile()’
          inside a tracing function (e.g.  in a debugger breakpoint),
          see *note call_tracing(): 1bc3.

     Profile関数は 3 個の引数、'frame'、'event'、および 'arg' を受け取る
     必要があります。'frame' は現在のスタックフレームです。'event' は文
     字列で、‘'call'’, ‘'return'’, ‘'c_call'’, ‘'c_return'’,
     ‘'c_exception'’ のどれかが渡されます。'arg' はイベントの種類によっ
     て異なります。

     'event' には以下の意味があります。

     ‘'call'’

          関数が呼び出された(もしくは、何かのコードブロックに入った)。プ
          ロファイル関数が呼ばれる。 'arg' は ‘None’ が渡される。

     ‘'return'’

          関数(あるいは別のコードブロック)から戻ろうとしている。プロファ
          イル関数が呼ばれる。 'arg' は返されようとしている値、または、
          このイベントが例外が送出されることによって起こったなら ‘None’
          。

     ‘'c_call'’

          C 関数(拡張関数かビルトイン関数)が呼ばれようとしている。 'arg'
          は C 関数オブジェクト。

     ‘'c_return'’

          C 関数から戻った。 'arg' は C の関数オブジェクト。

     ‘'c_exception'’

          C 関数が例外を発生させた。 'arg' は C の関数オブジェクト。

     引数無しで *note 監査イベント: 1c6e. ‘sys.setprofile’ を送出します
     。

 -- の関数: sys.setrecursionlimit (limit)

     Python インタプリタの、スタックの最大の深さを 'limit' に設定します
     。この制限は Python プログラムが無限に再帰し、 C スタックがオーバー
     フローしてクラッシュすることを防止するために設けられています。

     'limit' の最大値はプラットフォームによって異なります。深い再帰処理
     が必要な場合にはプラットフォームがサポートしている範囲内でより大き
     な値を指定することができますが、この値が大きすぎればクラッシュする
     ので注意が必要です。

     If the new limit is too low at the current recursion depth, a *note
     RecursionError: f68. exception is raised.

     バージョン 3.5.1 で変更: A *note RecursionError: f68. exception is
     now raised if the new limit is too low at the current recursion
     depth.

 -- の関数: sys.setswitchinterval (interval)

     インタプリタのスレッド切り替え間隔を秒で指定します。この浮動小数点
     値が、並列に動作しているPythonスレッドに割り当てられたタイムスライ
     スの理想的な処理時間です。特に長時間実行される内部関数やメソッドが
     実行されたとき、実際の値はより高くなることがあります。また、どのス
     レッドがスレッド切り替え間隔の終わりにスケジュールされる（次に実行
     される）かはオペレーティングシステムが決定します。インタプリタは自
     身のスケジューラを持ちません。

     Added in version 3.2.

 -- の関数: sys.settrace (tracefunc)

     Set the system's trace function, which allows you to implement a
     Python source code debugger in Python.  The function is
     thread-specific; for a debugger to support multiple threads, it
     must register a trace function using *note settrace(): 2e1. for
     each thread being debugged or use *note threading.settrace(): a48.

     Trace functions should have three arguments: 'frame', 'event', and
     'arg'.  'frame' is the *note current stack frame: 8ef.  'event' is
     a string: ‘'call'’, ‘'line'’, ‘'return'’, ‘'exception'’ or
     ‘'opcode'’.  'arg' depends on the event type.

     trace 関数は ('event' に ‘'call'’ を渡された状態で) 新しいローカル
     スコープに入るたびに呼ばれます。この場合、新しいスコープで利用する
     ローカルの trace 関数への参照か、そのスコープを trace しないのであ
     れば ‘None’ を返します。

     The local trace function should return a reference to itself, or to
     another function which would then be used as the local trace
     function for the scope.

     If there is any error occurred in the trace function, it will be
     unset, just like ‘settrace(None)’ is called.

          注釈: Tracing is disabled while calling the trace function
          (e.g.  a function set by ‘settrace()’).  For recursive tracing
          see *note call_tracing(): 1bc3.

     'event' には以下の意味があります。

     ‘'call'’

          関数が呼び出された(もしくは、何かのコードブロックに入った)。グ
          ローバルの trace 関数が呼ばれる。 'arg' は ‘None’ が渡される。
          戻り値はローカルの trace 関数。

     ‘'line'’

          The interpreter is about to execute a new line of code or
          re-execute the condition of a loop.  The local trace function
          is called; 'arg' is ‘None’; the return value specifies the new
          local trace function.  See ‘Objects/lnotab_notes.txt’ for a
          detailed explanation of how this works.  Per-line events may
          be disabled for a frame by setting *note f_trace_lines: dd6.
          to *note False: d2b. on that *note frame: 8ef.

     ‘'return'’

          関数(あるいは別のコードブロック)から戻ろうとしている。ローカル
          の trace 関数が呼ばれる。 'arg' は返されようとしている値、また
          は、このイベントが例外が送出されることによって起こったなら
          ‘None’ 。 trace 関数の戻り値は無視される。

     ‘'exception'’

          例外が発生した。ローカルの trace 関数が呼ばれる。 'arg' は
          ‘(exception, value, traceback)’ のタプル。戻り値は新しいローカ
          ルの trace 関数。

     ‘'opcode'’

          The interpreter is about to execute a new opcode (see *note
          dis: 3c. for opcode details).  The local trace function is
          called; 'arg' is ‘None’; the return value specifies the new
          local trace function.  Per-opcode events are not emitted by
          default: they must be explicitly requested by setting *note
          f_trace_opcodes: dd7. to *note True: e07. on the *note frame:
          8ef.

     例外が呼び出しチェインを辿って伝播していくことに注意してください。
     ‘'exception'’ イベントは各レベルで発生します。

     For more fine-grained usage, it's possible to set a trace function
     by assigning ‘frame.f_trace = tracefunc’ explicitly, rather than
     relying on it being set indirectly via the return value from an
     already installed trace function.  This is also required for
     activating the trace function on the current frame, which *note
     settrace(): 2e1. doesn't do.  Note that in order for this to work,
     a global tracing function must have been installed with *note
     settrace(): 2e1. in order to enable the runtime tracing machinery,
     but it doesn't need to be the same tracing function (e.g.  it could
     be a low overhead tracing function that simply returns ‘None’ to
     disable itself immediately on each frame).

     code と frame オブジェクトについては、 *note 標準型の階層: 232f. を
     参照してください。

     引数無しで *note 監査イベント: 1c6e. ‘sys.settrace’ を送出します。

     *note settrace(): 2e1. 関数は、デバッガ、プロファイラ、カバレッジツ
     ール等で使うためだけのものです。この関数の挙動は言語定義よりも実装
     プラットフォームの分野の問題で、全ての Python 実装で利用できるとは
     限りません。

     バージョン 3.7 で変更: ‘'opcode'’ event type added; *note
     f_trace_lines: dd6. and *note f_trace_opcodes: dd7. attributes
     added to frames

 -- の関数: sys.set_asyncgen_hooks ([firstiter] [, finalizer])

     Accepts two optional keyword arguments which are callables that
     accept an *note asynchronous generator iterator: 4918. as an
     argument.  The 'firstiter' callable will be called when an
     asynchronous generator is iterated for the first time.  The
     'finalizer' will be called when an asynchronous generator is about
     to be garbage collected.

     引数無しで *note 監査イベント: 1c6e.
     ‘sys.set_asyncgen_hooks_firstiter’ を送出します。

     引数無しで *note 監査イベント: 1c6e.
     ‘sys.set_asyncgen_hooks_finalizer’ を送出します。

     Two auditing events are raised because the underlying API consists
     of two calls, each of which must raise its own event.

     Added in version 3.6: See PEP 525(16) for more details, and for a
     reference example of a 'finalizer' method see the implementation of
     ‘asyncio.Loop.shutdown_asyncgens’ in Lib/asyncio/base_events.py(17)

          注釈: This function has been added on a provisional basis (see
          PEP 411(18) for details.)

 -- の関数: sys.set_coroutine_origin_tracking_depth (depth)

     Allows enabling or disabling coroutine origin tracking.  When
     enabled, the ‘cr_origin’ attribute on coroutine objects will
     contain a tuple of (filename, line number, function name) tuples
     describing the traceback where the coroutine object was created,
     with the most recent call first.  When disabled, ‘cr_origin’ will
     be ‘None’.

     To enable, pass a 'depth' value greater than zero; this sets the
     number of frames whose information will be captured.  To disable,
     set 'depth' to zero.

     This setting is thread-specific.

     Added in version 3.7.

          注釈: This function has been added on a provisional basis (see
          PEP 411(19) for details.)  Use it only for debugging purposes.

 -- の関数: sys.activate_stack_trampoline (backend, /)

     Activate the stack profiler trampoline 'backend'.  The only
     supported backend is ‘"perf"’.

     Stack trampolines cannot be activated if the JIT is active.

     *note Availability: 213f.: Linux.

     Added in version 3.12.

     参考
     ....

        * *note Python support for the Linux perf profiler: 4ae.

        * ‘https://perf.wiki.kernel.org’

 -- の関数: sys.deactivate_stack_trampoline ()

     Deactivate the current stack profiler trampoline backend.

     If no stack profiler is activated, this function has no effect.

     *note Availability: 213f.: Linux.

     Added in version 3.12.

 -- の関数: sys.is_stack_trampoline_active ()

     Return ‘True’ if a stack profiler trampoline is active.

     *note Availability: 213f.: Linux.

     Added in version 3.12.

 -- の関数: sys.remote_exec (pid, script)

     Executes 'script', a file containing Python code in the remote
     process with the given 'pid'.

     This function returns immediately, and the code will be executed by
     the target process's main thread at the next available opportunity,
     similarly to how signals are handled.  There is no interface to
     determine when the code has been executed.  The caller is
     responsible for making sure that the file still exists whenever the
     remote process tries to read it and that it hasn't been
     overwritten.

     The remote process must be running a CPython interpreter of the
     same major and minor version as the local process.  If either the
     local or remote interpreter is pre-release (alpha, beta, or release
     candidate) then the local and remote interpreters must be the same
     exact version.

     See *note Remote debugging attachment protocol: 4927. for more
     information about the remote debugging mechanism.

     When the code is executed in the remote process, an *note auditing
     event: 1c6e. ‘sys.remote_exec’ is raised with the 'pid' and the
     path to the script file.  This event is raised in the process that
     called *note sys.remote_exec(): 16d.

     When the script is executed in the remote process, an *note
     auditing event: 1c6e. ‘cpython.remote_debugger_script’ is raised
     with the path in the remote process.  This event is raised in the
     remote process, not the one that called *note sys.remote_exec():
     16d.

     *note Availability: 213f.: Unix, Windows.

     Added in version 3.14: See PEP 768(20) for more details.

 -- の関数: sys._enablelegacywindowsfsencoding ()

     Changes the *note filesystem encoding and error handler: 75d. to
     'mbcs' and 'replace' respectively, for consistency with versions of
     Python prior to 3.6.

     This is equivalent to defining the *note
     PYTHONLEGACYWINDOWSFSENCODING: 33f. environment variable before
     launching Python.

     See also *note sys.getfilesystemencoding(): e53. and *note
     sys.getfilesystemencodeerrors(): ee2.

     *note Availability: 213f.: Windows.

          注釈: Changing the filesystem encoding after Python startup is
          risky because the old fsencoding or paths encoded by the old
          fsencoding may be cached somewhere.  Use *note
          PYTHONLEGACYWINDOWSFSENCODING: 33f. instead.

     Added in version 3.6: より詳しくは PEP 529(21) を参照してください。

     Deprecated since version 3.13, will be removed in version 3.16: Use
     *note PYTHONLEGACYWINDOWSFSENCODING: 33f. instead.

 -- データ: sys.stdin
 -- データ: sys.stdout
 -- データ: sys.stderr

     インタプリタが使用する、それぞれ標準入力、標準出力、および標準エラ
     ー出力の *note ファイルオブジェクト: 13db. です:

        * ‘stdin’ は (*note input(): 14f0. の呼び出しも含む) すべての対
          話型入力に使われます。

        * ‘stdout’ は *note print(): 1177. および *note expression:
          23cf. 文の出力と、*note input(): 14f0. のプロンプトに使用され
          ます。

        * インタプリタ自身のプロンプトおよびエラーメッセージは ‘stderr’
          に出力されます。

     これらのストリームは *note open(): 316. が返すような通常の *note
     テキストファイル: 206d. です。引数は以下のように選択されます:

        * The encoding and error handling are is initialized from *note
          PyConfig.stdio_encoding: 644. and *note PyConfig.stdio_errors:
          4928.

          On Windows, UTF-8 is used for the console device.
          Non-character devices such as disk files and pipes use the
          system locale encoding (i.e.  the ANSI codepage).  Non-console
          character devices such as NUL (i.e.  where ‘isatty()’ returns
          ‘True’) use the value of the console input and output
          codepages at startup, respectively for stdin and
          stdout/stderr.  This defaults to the system *note locale
          encoding: 54a. if the process is not initially attached to a
          console.

          The special behaviour of the console can be overridden by
          setting the environment variable PYTHONLEGACYWINDOWSSTDIO
          before starting Python.  In that case, the console codepages
          are used as for any other character device.

          Under all platforms, you can override the character encoding
          by setting the *note PYTHONIOENCODING: 120c. environment
          variable before starting Python or by using the new *note -X:
          16f. ‘utf8’ command line option and *note PYTHONUTF8: ccf.
          environment variable.  However, for the Windows console, this
          only applies when *note PYTHONLEGACYWINDOWSSTDIO: e55. is also
          set.

        * When interactive, the ‘stdout’ stream is line-buffered.
          Otherwise, it is block-buffered like regular text files.  The
          ‘stderr’ stream is line-buffered in both cases.  You can make
          both streams unbuffered by passing the *note -u: 1d8d.
          command-line option or setting the *note PYTHONUNBUFFERED:
          1d8e. environment variable.

     バージョン 3.9 で変更: Non-interactive ‘stderr’ is now
     line-buffered instead of fully buffered.

          注釈: 標準ストリームにバイナリーデータの読み書きを行うには下位
          のバイナリー *note buffer: 14bb. オブジェクトを使用してくださ
          い。例えば *note bytes: 192. を *note stdout: ccd. に書き出す
          場合は ‘sys.stdout.buffer.write(b'abc')’ を使用してください。

          However, if you are writing a library (and do not control in
          which context its code will be executed), be aware that the
          standard streams may be replaced with file-like objects like
          *note io.StringIO: 112a. which do not support the ‘buffer’
          attribute.

 -- データ: sys.__stdin__
 -- データ: sys.__stdout__
 -- データ: sys.__stderr__

     それぞれ起動時の ‘stdin’, ‘stderr’, ‘stdout’ の値を保存しています。
     終了処理時に利用されます。また、 ‘sys.std*’ オブジェクトが(訳注:別
     のファイルライクオブジェクトに)リダイレクトされている場合でも、実際
     の標準ストリームへの出力に利用できます。

     また、標準ストリームが壊れたオブジェクトに置き換えられた場合に、動
     作する実際のファイルを復元するために利用することもできます。しかし
     、明示的に置き換え前のストリームを保存しておき、そのオブジェクトを
     復元する事を推奨します。

          注釈: 一部の条件下では、‘stdin’, ‘stdout’, ‘stderr’ も、オリジ
          ナルの ‘__stdin__’, ‘__stdout__’, ‘__stderr__’ も ‘None’ にな
          ることがあります。これはコンソールに接続しない Windows GUI ア
          プリケーションであり、かつ ‘pythonw’ で起動された Python アプ
          リケーションが該当します。

 -- データ: sys.stdlib_module_names

     A frozenset of strings containing the names of standard library
     modules.

     It is the same on all platforms.  Modules which are not available
     on some platforms and modules disabled at Python build are also
     listed.  All module kinds are listed: pure Python, built-in, frozen
     and extension modules.  Test modules are excluded.

     For packages, only the main package is listed: sub-packages and
     sub-modules are not listed.  For example, the ‘email’ package is
     listed, but the ‘email.mime’ sub-package and the ‘email.message’
     sub-module are not listed.

     See also the *note sys.builtin_module_names: 2047. list.

     Added in version 3.10.

 -- データ: sys.thread_info

     スレッドの実装に関する情報が格納された *note named tuple: 85e. です
     。

      -- の属性: thread_info.name

          The name of the thread implementation:

             * ‘"nt"’: Windows threads

             * ‘"pthread"’: POSIX threads

             * ‘"pthread-stubs"’: stub POSIX threads (on WebAssembly
               platforms without threading support)

             * ‘"solaris"’: Solaris threads

      -- の属性: thread_info.lock

          The name of the lock implementation:

             * ‘"semaphore"’: a lock uses a semaphore

             * ‘"mutex+cond"’: a lock uses a mutex and a condition
               variable

             * ‘None’ この情報が不明の場合

      -- の属性: thread_info.version

          The name and version of the thread library.  It is a string,
          or ‘None’ if this information is unknown.

     Added in version 3.3.

 -- データ: sys.tracebacklimit

     捕捉されない例外が発生した時、出力されるトレースバック情報の最大レ
     ベル数を指定する整数値(デフォルト値は ‘1000’)。 ‘0’ 以下の値が設定
     された場合、トレースバック情報は出力されず例外型と例外値のみが出力
     されます。

 -- の関数: sys.unraisablehook (unraisable, /)

     Handle an unraisable exception.

     Called when an exception has occurred but there is no way for
     Python to handle it.  For example, when a destructor raises an
     exception or during garbage collection (*note gc.collect(): 1b3.).

     The 'unraisable' argument has the following attributes:

        * ‘exc_type’: Exception type.

        * ‘exc_value’: Exception value, can be ‘None’.

        * ‘exc_traceback’: Exception traceback, can be ‘None’.

        * ‘err_msg’: Error message, can be ‘None’.

        * ‘object’: Object causing the exception, can be ‘None’.

     The default hook formats ‘err_msg’ and ‘object’ as: ‘f'{err_msg}:
     {object!r}'’; use "Exception ignored in" error message if ‘err_msg’
     is ‘None’.

     *note sys.unraisablehook(): 507. can be overridden to control how
     unraisable exceptions are handled.

     参考
     ....

     *note excepthook(): a0c. which handles uncaught exceptions.

          警告: Storing ‘exc_value’ using a custom hook can create a
          reference cycle.  It should be cleared explicitly to break the
          reference cycle when the exception is no longer needed.

          Storing ‘object’ using a custom hook can resurrect it if it is
          set to an object which is being finalized.  Avoid storing
          ‘object’ after the custom hook completes to avoid resurrecting
          objects.

     Raise an auditing event ‘sys.unraisablehook’ with arguments 'hook',
     'unraisable' when an exception that cannot be handled occurs.  The
     'unraisable' object is the same as what will be passed to the hook.
     If no hook has been set, 'hook' may be ‘None’.

     Added in version 3.8.

 -- データ: sys.version

     Python インタプリタのバージョン番号の他、ビルド番号や使用コンパイラ
     などの情報を示す文字列です。この文字列は Python 対話型インタプリタ
     が起動した時に表示されます。バージョン情報はここから抜き出さずに、
     *note version_info: 8af. および *note platform: af. が提供する関数
     を使って下さい。

 -- データ: sys.api_version

     The C API version, equivalent to the C macro *note
     PYTHON_API_VERSION: 492e.  Defined for backwards compatibility.

     Currently, this constant is not updated in new Python versions, and
     is not useful for versioning.  This may change in the future.

 -- データ: sys.version_info

     バージョン番号を示す 5 要素タプル:'major', 'minor', 'micro',
     'releaselevel', 'serial' 。 'releaselevel' 以外は全て整数です。
     'releaselevel' の値は、 ‘'alpha'’, ‘'beta'’, ‘'candidate'’,
     ‘'final'’ の何れかです。 Python 2.0 の ‘version_info’ は、 ‘(2, 0,
     0, 'final', 0)’ となります。構成要素には名前でもアクセスできるので
     、 ‘sys.version_info[0]’ は ‘sys.version_info.major’ と等価、などに
     なります。

     バージョン 3.1 で変更: 名前を使った要素アクセスがサポートされました
     。

 -- データ: sys.warnoptions

     この値は、warnings フレームワーク内部のみ使用され、変更することはで
     きません。詳細は *note warnings: 118. を参照してください。

 -- データ: sys.winver

     The version number used to form registry keys on Windows platforms.
     This is stored as string resource 1000 in the Python DLL. The value
     is normally the major and minor versions of the running Python
     interpreter.  It is provided in the ‘sys’ module for informational
     purposes; modifying this value has no effect on the registry keys
     used by Python.

     *note Availability: 213f.: Windows.

 -- データ: sys.monitoring

     Namespace containing functions and constants for register callbacks
     and controlling monitoring events.  See *note sys.monitoring: e0.
     for details.

 -- データ: sys._xoptions

     コマンドラインオプション *note -X: 16f. で渡された様々な実装固有の
     フラグの辞書です。オプション名にはその値が明示されていればそれが、
     それ以外の場合は *note True: e07. がマップされます。例えば:

          $ ./python -Xa=b -Xc
          Python 3.2a3+ (py3k, Oct 16 2010, 20:14:50)
          [GCC 4.4.3] on linux2
          Type "help", "copyright", "credits" or "license" for more information.
          >>> import sys
          >>> sys._xoptions
          {'a': 'b', 'c': True}

     この *note -X: 16f. によって渡されたオプションにアクセスする方法は
     CPython 固有です。他の実装ではそれらは他の意味でエクスポートされる
     か、あるいは何もしません。

     Added in version 3.2.

出典
....

(C99) ISO/IEC 9899:1999.  "Programming languages - C." この標準のパブリ
ックドラフトが参照できます:
‘https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf’。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3149/

   (2) https://peps.python.org/pep-0578/

   (3) https://peps.python.org/pep-0529/

   (4) 
https://code.activestate.com/recipes/577504-compute-memory-footprint-of-an-object-and-its-cont/

   (5) https://peps.python.org/pep-0525/

   (6) https://peps.python.org/pep-0411/

   (7) https://peps.python.org/pep-0411/

   (8) https://peps.python.org/pep-0684/

   (9) https://peps.python.org/pep-0734/

   (10) https://peps.python.org/pep-0421/

   (11) https://peps.python.org/pep-0421/

   (12) https://peps.python.org/pep-0393/

   (13) https://peps.python.org/pep-0451/

   (14) https://peps.python.org/pep-0302/

   (15) https://peps.python.org/pep-0302/

   (16) https://peps.python.org/pep-0525/

   (17) 
https://github.com/python/cpython/tree/3.14/Lib/asyncio/base_events.py

   (18) https://peps.python.org/pep-0411/

   (19) https://peps.python.org/pep-0411/

   (20) https://peps.python.org/pep-0768/

   (21) https://peps.python.org/pep-0529/


File: python.info,  Node: sys monitoring --- 実行イベントモニタリング,  Next: sysconfig --- Python の構成情報へのアクセスを提供する,  Prev: sys --- システム固有のパラメーターと関数,  Up: Python ランタイムサービス

5.29.2 ‘sys.monitoring’ -- 実行イベントモニタリング
---------------------------------------------------

Added in version 3.12.

__________________________________________________________________

     注釈: ‘sys.monitoring’ is a namespace within the *note sys: df.
     module, not an independent module, so there is no need to ‘import
     sys.monitoring’, simply ‘import sys’ and then use ‘sys.monitoring’.

この名前空間は、イベントモニタリングの有効化と制御に必要な関数と定数への
アクセスを提供します。

As programs execute, events occur that might be of interest to tools
that monitor execution.  The ‘sys.monitoring’ namespace provides means
to receive callbacks when events of interest occur.

The monitoring API consists of three components:

   * *note Tool identifiers: 4933.

   * *note Events: 4934.

   * *note Callbacks: 4935.

* Menu:

* Tool identifiers::
* Events::
* Turning events on and off::
* Registering callback functions::


File: python.info,  Node: Tool identifiers,  Next: Events,  Up: sys monitoring --- 実行イベントモニタリング

5.29.2.1 Tool identifiers
.........................

A tool identifier is an integer and the associated name.  Tool
identifiers are used to discourage tools from interfering with each
other and to allow multiple tools to operate at the same time.
Currently tools are completely independent and cannot be used to monitor
each other.  This restriction may be lifted in the future.

Before registering or activating events, a tool should choose an
identifier.  Identifiers are integers in the range 0 to 5 inclusive.

* Menu:

* Registering and using tools::


File: python.info,  Node: Registering and using tools,  Up: Tool identifiers

5.29.2.2 Registering and using tools
....................................

 -- の関数: sys.monitoring.use_tool_id (tool_id: int, name: str, /) ->
          None

     Must be called before 'tool_id' can be used.  'tool_id' must be in
     the range 0 to 5 inclusive.  Raises a *note ValueError: 2ec. if
     'tool_id' is in use.

 -- の関数: sys.monitoring.clear_tool_id (tool_id: int, /) -> None

     Unregister all events and callback functions associated with
     'tool_id'.

 -- の関数: sys.monitoring.free_tool_id (tool_id: int, /) -> None

     Should be called once a tool no longer requires 'tool_id'.  Will
     call *note clear_tool_id(): 192e. before releasing 'tool_id'.

 -- の関数: sys.monitoring.get_tool (tool_id: int, /) -> str | None

     Returns the name of the tool if 'tool_id' is in use, otherwise it
     returns ‘None’.  'tool_id' must be in the range 0 to 5 inclusive.

All IDs are treated the same by the VM with regard to events, but the
following IDs are pre-defined to make co-operation of tools easier:

     sys.monitoring.DEBUGGER_ID = 0
     sys.monitoring.COVERAGE_ID = 1
     sys.monitoring.PROFILER_ID = 2
     sys.monitoring.OPTIMIZER_ID = 5


File: python.info,  Node: Events,  Next: Turning events on and off,  Prev: Tool identifiers,  Up: sys monitoring --- 実行イベントモニタリング

5.29.2.3 Events
...............

The following events are supported:

 -- monitoring-event: sys.monitoring.events.BRANCH_LEFT

     A conditional branch goes left.

     It is up to the tool to determine how to present "left" and "right"
     branches.  There is no guarantee which branch is "left" and which
     is "right", except that it will be consistent for the duration of
     the program.

 -- monitoring-event: sys.monitoring.events.BRANCH_RIGHT

     A conditional branch goes right.

 -- monitoring-event: sys.monitoring.events.CALL

     A call in Python code (event occurs before the call).

 -- monitoring-event: sys.monitoring.events.C_RAISE

     An exception raised from any callable, except for Python functions
     (event occurs after the exit).

 -- monitoring-event: sys.monitoring.events.C_RETURN

     Return from any callable, except for Python functions (event occurs
     after the return).

 -- monitoring-event: sys.monitoring.events.EXCEPTION_HANDLED

     An exception is handled.

 -- monitoring-event: sys.monitoring.events.INSTRUCTION

     A VM instruction is about to be executed.

 -- monitoring-event: sys.monitoring.events.JUMP

     An unconditional jump in the control flow graph is made.

 -- monitoring-event: sys.monitoring.events.LINE

     An instruction is about to be executed that has a different line
     number from the preceding instruction.

 -- monitoring-event: sys.monitoring.events.PY_RESUME

     Resumption of a Python function (for generator and coroutine
     functions), except for ‘throw()’ calls.

 -- monitoring-event: sys.monitoring.events.PY_RETURN

     Return from a Python function (occurs immediately before the
     return, the callee's frame will be on the stack).

 -- monitoring-event: sys.monitoring.events.PY_START

     Start of a Python function (occurs immediately after the call, the
     callee's frame will be on the stack)

 -- monitoring-event: sys.monitoring.events.PY_THROW

     A Python function is resumed by a ‘throw()’ call.

 -- monitoring-event: sys.monitoring.events.PY_UNWIND

     Exit from a Python function during exception unwinding.  This
     includes exceptions raised directly within the function and that
     are allowed to continue to propagate.

 -- monitoring-event: sys.monitoring.events.PY_YIELD

     Yield from a Python function (occurs immediately before the yield,
     the callee's frame will be on the stack).

 -- monitoring-event: sys.monitoring.events.RAISE

     An exception is raised, except those that cause a *note
     STOP_ITERATION: 4945. event.

 -- monitoring-event: sys.monitoring.events.RERAISE

     An exception is re-raised, for example at the end of a *note
     finally: 1b0. block.

 -- monitoring-event: sys.monitoring.events.STOP_ITERATION

     An artificial *note StopIteration: df5. is raised; see *note the
     STOP_ITERATION event: 4947.

More events may be added in the future.

These events are attributes of the ‘sys.monitoring.events’ namespace.
Each event is represented as a power-of-2 integer constant.  To define a
set of events, simply bitwise OR the individual events together.  For
example, to specify both *note PY_RETURN: 4941. and *note PY_START:
4942. events, use the expression ‘PY_RETURN | PY_START’.

 -- monitoring-event: sys.monitoring.events.NO_EVENTS

     An alias for ‘0’ so users can do explicit comparisons like:

          if get_events(DEBUGGER_ID) == NO_EVENTS:
              ...

     Setting this event deactivates all events.

* Menu:

* Local events::
* Deprecated event::
* Ancillary events::
* Other events::
* The STOP_ITERATION event::


File: python.info,  Node: Local events,  Next: Deprecated event,  Up: Events

5.29.2.4 Local events
.....................

Local events are associated with normal execution of the program and
happen at clearly defined locations.  All local events can be disabled.
The local events are:

   * *note PY_START: 4942.

   * *note PY_RESUME: 4940.

   * *note PY_RETURN: 4941.

   * *note PY_YIELD: 4944.

   * *note CALL: 19bd.

   * *note LINE: 493f.

   * *note INSTRUCTION: 493d.

   * *note JUMP: 493e.

   * *note BRANCH_LEFT: 295.

   * *note BRANCH_RIGHT: 296.

   * *note STOP_ITERATION: 4945.


File: python.info,  Node: Deprecated event,  Next: Ancillary events,  Prev: Local events,  Up: Events

5.29.2.5 Deprecated event
.........................

   * ‘BRANCH’

The ‘BRANCH’ event is deprecated in 3.14.  Using *note BRANCH_LEFT: 295.
and *note BRANCH_RIGHT: 296. events will give much better performance as
they can be disabled independently.


File: python.info,  Node: Ancillary events,  Next: Other events,  Prev: Deprecated event,  Up: Events

5.29.2.6 Ancillary events
.........................

Ancillary events can be monitored like other events, but are controlled
by another event:

   * *note C_RAISE: 493a.

   * *note C_RETURN: 493b.

The *note C_RETURN: 493b. and *note C_RAISE: 493a. events are controlled
by the *note CALL: 19bd. event.  *note C_RETURN: 493b. and *note
C_RAISE: 493a. events will only be seen if the corresponding *note CALL:
19bd. event is being monitored.


File: python.info,  Node: Other events,  Next: The STOP_ITERATION event,  Prev: Ancillary events,  Up: Events

5.29.2.7 Other events
.....................

Other events are not necessarily tied to a specific location in the
program and cannot be individually disabled via *note DISABLE: 494f.

The other events that can be monitored are:

   * *note PY_THROW: 1855.

   * *note PY_UNWIND: 4943.

   * *note RAISE: 1974.

   * *note EXCEPTION_HANDLED: 493c.


File: python.info,  Node: The STOP_ITERATION event,  Prev: Other events,  Up: Events

5.29.2.8 The STOP_ITERATION event
.................................

PEP 380(1) specifies that a *note StopIteration: df5. exception is
raised when returning a value from a generator or coroutine.  However,
this is a very inefficient way to return a value, so some Python
implementations, notably CPython 3.12+, do not raise an exception unless
it would be visible to other code.

To allow tools to monitor for real exceptions without slowing down
generators and coroutines, the *note STOP_ITERATION: 4945. event is
provided.  *note STOP_ITERATION: 4945. can be locally disabled, unlike
*note RAISE: 1974.

Note that the *note STOP_ITERATION: 4945. event and the *note RAISE:
1974. event for a *note StopIteration: df5. exception are equivalent,
and are treated as interchangeable when generating events.
Implementations will favor *note STOP_ITERATION: 4945. for performance
reasons, but may generate a *note RAISE: 1974. event with a *note
StopIteration: df5.

   ---------- Footnotes ----------

   (1) 
https://peps.python.org/pep-0380/#use-of-stopiteration-to-return-values


File: python.info,  Node: Turning events on and off,  Next: Registering callback functions,  Prev: Events,  Up: sys monitoring --- 実行イベントモニタリング

5.29.2.9 Turning events on and off
..................................

In order to monitor an event, it must be turned on and a corresponding
callback must be registered.  Events can be turned on or off by setting
the events either globally and/or for a particular code object.  An
event will trigger only once, even if it is turned on both globally and
locally.

* Menu:

* Setting events globally::
* Per code object events::
* Disabling events::


File: python.info,  Node: Setting events globally,  Next: Per code object events,  Up: Turning events on and off

5.29.2.10 Setting events globally
.................................

Events can be controlled globally by modifying the set of events being
monitored.

 -- の関数: sys.monitoring.get_events (tool_id: int, /) -> int

     Returns the ‘int’ representing all the active events.

 -- の関数: sys.monitoring.set_events (tool_id: int, event_set: int, /)
          -> None

     Activates all events which are set in 'event_set'.  Raises a *note
     ValueError: 2ec. if 'tool_id' is not in use.

No events are active by default.


File: python.info,  Node: Per code object events,  Next: Disabling events,  Prev: Setting events globally,  Up: Turning events on and off

5.29.2.11 Per code object events
................................

Events can also be controlled on a per code object basis.  The functions
defined below which accept a *note types.CodeType: 32f. should be
prepared to accept a look-alike object from functions which are not
defined in Python (see *note Monitoring C API: 485.).

 -- の関数: sys.monitoring.get_local_events (tool_id: int, code:
          CodeType, /) -> int

     Returns all the *note local events: 494a. for 'code'

 -- の関数: sys.monitoring.set_local_events (tool_id: int, code:
          CodeType, event_set: int, /) -> None

     Activates all the *note local events: 494a. for 'code' which are
     set in 'event_set'.  Raises a *note ValueError: 2ec. if 'tool_id'
     is not in use.


File: python.info,  Node: Disabling events,  Prev: Per code object events,  Up: Turning events on and off

5.29.2.12 Disabling events
..........................

 -- データ: sys.monitoring.DISABLE

     A special value that can be returned from a callback function to
     disable events for the current code location.

*note Local events: 494a. can be disabled for a specific code location
by returning *note sys.monitoring.DISABLE: 494f. from a callback
function.  This does not change which events are set, or any other code
locations for the same event.

Disabling events for specific locations is very important for high
performance monitoring.  For example, a program can be run under a
debugger with no overhead if the debugger disables all monitoring except
for a few breakpoints.

If *note DISABLE: 494f. is returned by a callback for a *note global
event: 494d, *note ValueError: 2ec. will be raised by the interpreter in
a non-specific location (that is, no traceback will be provided).

 -- の関数: sys.monitoring.restart_events () -> None

     Enable all the events that were disabled by *note
     sys.monitoring.DISABLE: 494f. for all tools.


File: python.info,  Node: Registering callback functions,  Prev: Turning events on and off,  Up: sys monitoring --- 実行イベントモニタリング

5.29.2.13 Registering callback functions
........................................

 -- の関数: sys.monitoring.register_callback (tool_id: int, event: int,
          func: Callable | None, /) -> Callable | None

     Registers the callable 'func' for the 'event' with the given
     'tool_id'

     If another callback was registered for the given 'tool_id' and
     'event', it is unregistered and returned.  Otherwise *note
     register_callback(): 4760. returns ‘None’.

     Raises an *note auditing event: 1c6e.
     ‘sys.monitoring.register_callback’ with argument ‘func’.

Functions can be unregistered by calling
‘sys.monitoring.register_callback(tool_id, event, None)’.

Callback functions can be registered and unregistered at any time.

Callbacks are called only once regardless if the event is turned on both
globally and locally.  As such, if an event could be turned on for both
global and local events by your code then the callback needs to be
written to handle either trigger.

* Menu:

* Callback function arguments::


File: python.info,  Node: Callback function arguments,  Up: Registering callback functions

5.29.2.14 Callback function arguments
.....................................

 -- データ: sys.monitoring.MISSING

     A special value that is passed to a callback function to indicate
     that there are no arguments to the call.

When an active event occurs, the registered callback function is called.
Callback functions returning an object other than *note DISABLE: 494f.
will have no effect.  Different events will provide the callback
function with different arguments, as follows:

   * *note PY_START: 4942. and *note PY_RESUME: 4940.:

          func(code: CodeType, instruction_offset: int) -> object

   * *note PY_RETURN: 4941. and *note PY_YIELD: 4944.:

          func(code: CodeType, instruction_offset: int, retval: object) -> object

   * *note CALL: 19bd, *note C_RAISE: 493a. and *note C_RETURN: 493b.
     ('arg0' can be *note MISSING: 495b. specifically):

          func(code: CodeType, instruction_offset: int, callable: object, arg0: object) -> object

     'code' represents the code object where the call is being made,
     while 'callable' is the object that is about to be called (and thus
     triggered the event).  If there are no arguments, 'arg0' is set to
     *note sys.monitoring.MISSING: 495b.

     For instance methods, 'callable' will be the function object as
     found on the class with 'arg0' set to the instance (i.e.  the
     ‘self’ argument to the method).

   * *note RAISE: 1974, *note RERAISE: 4946, *note EXCEPTION_HANDLED:
     493c, *note PY_UNWIND: 4943, *note PY_THROW: 1855. and *note
     STOP_ITERATION: 4945.:

          func(code: CodeType, instruction_offset: int, exception: BaseException) -> object

   * *note LINE: 493f.:

          func(code: CodeType, line_number: int) -> object

   * *note BRANCH_LEFT: 295, *note BRANCH_RIGHT: 296. and *note JUMP:
     493e.:

          func(code: CodeType, instruction_offset: int, destination_offset: int) -> object

     Note that the 'destination_offset' is where the code will next
     execute.

   * *note INSTRUCTION: 493d.:

          func(code: CodeType, instruction_offset: int) -> object


File: python.info,  Node: sysconfig --- Python の構成情報へのアクセスを提供する,  Next: builtins --- 組み込みオブジェクト,  Prev: sys monitoring --- 実行イベントモニタリング,  Up: Python ランタイムサービス

5.29.3 ‘sysconfig’ -- Python の構成情報へのアクセスを提供する
-------------------------------------------------------------

Added in version 3.2.

'ソースコード:' Lib/sysconfig(1)

__________________________________________________________________

The ‘sysconfig’ module provides access to Python's configuration
information like the list of installation paths and the configuration
variables relevant for the current platform.

* Menu:

* 構成変数::
* インストールパス::
* User scheme::
* Home scheme::
* Prefix scheme::
* Installation path functions::
* その他の関数: その他の関数<3>.
* コマンドラインでの使用: コマンドラインでの使用<7>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/sysconfig


File: python.info,  Node: 構成変数,  Next: インストールパス,  Up: sysconfig --- Python の構成情報へのアクセスを提供する

5.29.3.1 構成変数
.................

Python の配布物は、Python 自体のバイナリや、 ‘setuptools’ によってコンパ
イルされるサードパーティの C 拡張をビルドするために必要な、‘Makefile’ と
‘pyconfig.h’ ヘッダーファイルを含んでいます。

‘sysconfig’ puts all variables found in these files in a dictionary that
can be accessed using *note get_config_vars(): 298. or *note
get_config_var(): 174.

Windows では構成変数はだいぶ少なくなります。

 -- の関数: sysconfig.get_config_vars (*args)

     引数がない場合、現在のプラットフォームに関するすべての構成変数の辞
     書を返します。

     引数がある場合、各引数を構成変数辞書から検索した結果の変数のリスト
     を返します。

     各引数において、変数が見つからなかった場合は ‘None’ が返されます。

 -- の関数: sysconfig.get_config_var (name)

     1つの変数 'name' を返します。‘get_config_vars().get(name)’ と同じで
     す。

     'name' が見つからない場合、‘None’ を返します。

Example of usage:

     >>> import sysconfig
     >>> sysconfig.get_config_var('Py_ENABLE_SHARED')
     0
     >>> sysconfig.get_config_var('LIBDIR')
     '/usr/local/lib'
     >>> sysconfig.get_config_vars('AR', 'CXX')
     ['ar', 'g++']


File: python.info,  Node: インストールパス,  Next: User scheme,  Prev: 構成変数,  Up: sysconfig --- Python の構成情報へのアクセスを提供する

5.29.3.2 インストールパス
.........................

Python uses an installation scheme that differs depending on the
platform and on the installation options.  These schemes are stored in
‘sysconfig’ under unique identifiers based on the value returned by
*note os.name: 3003.  The schemes are used by package installers to
determine where to copy files to.

Python は現在9つのスキームをサポートしています:

   - 'posix_prefix': Linux や macOS などの POSIX プラットフォーム用のス
     キームです。これは Python やコンポーネントをインストールするときに
     使われるデフォルトのスキームです。

   - 'posix_home': scheme for POSIX platforms, when the 'home' option is
     used.  This scheme defines paths located under a specific home
     prefix.

   - 'posix_user': scheme for POSIX platforms, when the 'user' option is
     used.  This scheme defines paths located under the user's home
     directory (*note site.USER_BASE: 1534.).

   - 'posix_venv': scheme for *note Python virtual environments: 117. on
     POSIX platforms; by default it is the same as 'posix_prefix'.

   - 'nt': scheme for Windows.  This is the default scheme used when
     Python or a component is installed.

   - 'nt_user': scheme for Windows, when the 'user' option is used.

   - 'nt_venv': scheme for *note Python virtual environments: 117. on
     Windows; by default it is the same as 'nt'.

   - 'venv': a scheme with values from either 'posix_venv' or 'nt_venv'
     depending on the platform Python runs on.

   - 'osx_framework_user' オプションが利用された場合の、macOS 用のスキー
     ムです。

各スキームは、ユニークな識別子を持ったいくつかのパスの集合から成っていま
す。現在 Python は8つのパスを利用します:

   - 'stdlib': プラットフォーム非依存の、標準 Python ライブラリファイル
     を格納するディレクトリ.

   - 'platstdlib': プラットフォーム依存の、標準 Python ライブラリファイ
     ルを格納するディレクトリ.

   - 'platlib': プラットフォーム依存の、site ごとのファイルを格納するデ
     ィレクトリ。

   - 'purelib': directory for site-specific, non-platform-specific files
     ('pure' Python).

   - 'include': directory for non-platform-specific header files for the
     Python C-API.

   - 'platinclude': directory for platform-specific header files for the
     Python C-API.

   - 'scripts': スクリプトファイルのためのディレクトリ。

   - 'data': データファイルのためのディレクトリ。


File: python.info,  Node: User scheme,  Next: Home scheme,  Prev: インストールパス,  Up: sysconfig --- Python の構成情報へのアクセスを提供する

5.29.3.3 User scheme
....................

This scheme is designed to be the most convenient solution for users
that don't have write permission to the global site-packages directory
or don't want to install into it.

Files will be installed into subdirectories of *note site.USER_BASE:
1534. (written as ‘`userbase'’ hereafter).  This scheme installs pure
Python modules and extension modules in the same location (also known as
*note site.USER_SITE: 2126.).

* Menu:

* posix_user::
* nt_user::
* osx_framework_user::


File: python.info,  Node: posix_user,  Next: nt_user,  Up: User scheme

5.29.3.4 ‘posix_user’
.....................

Path               インストールディレクトリ
                   
-----------------------------------------------------------------------------------
                   
'stdlib'           ‘`userbase'/lib/python`X.Y'’
                   
                   
'platstdlib'       ‘`userbase'/lib/python`X.Y'’
                   
                   
'platlib'          ‘`userbase'/lib/python`X.Y'/site-packages’
                   
                   
'purelib'          ‘`userbase'/lib/python`X.Y'/site-packages’
                   
                   
'include'          ‘`userbase'/include/python`X.Y'’
                   
                   
'scripts'          ‘`userbase'/bin’
                   
                   
'data'             ‘`userbase'’
                   


File: python.info,  Node: nt_user,  Next: osx_framework_user,  Prev: posix_user,  Up: User scheme

5.29.3.5 ‘nt_user’
..................

Path               インストールディレクトリ
                   
-----------------------------------------------------------------------------------
                   
'stdlib'           ‘`userbase'\Python`XY'’
                   
                   
'platstdlib'       ‘`userbase'\Python`XY'’
                   
                   
'platlib'          ‘`userbase'\Python`XY'\site-packages’
                   
                   
'purelib'          ‘`userbase'\Python`XY'\site-packages’
                   
                   
'include'          ‘`userbase'\Python`XY'\Include’
                   
                   
'scripts'          ‘`userbase'\Python`XY'\Scripts’
                   
                   
'data'             ‘`userbase'’
                   


File: python.info,  Node: osx_framework_user,  Prev: nt_user,  Up: User scheme

5.29.3.6 ‘osx_framework_user’
.............................

Path               インストールディレクトリ
                   
-----------------------------------------------------------------------------------
                   
'stdlib'           ‘`userbase'/lib/python’
                   
                   
'platstdlib'       ‘`userbase'/lib/python’
                   
                   
'platlib'          ‘`userbase'/lib/python/site-packages’
                   
                   
'purelib'          ‘`userbase'/lib/python/site-packages’
                   
                   
'include'          ‘`userbase'/include/python`X.Y'’
                   
                   
'scripts'          ‘`userbase'/bin’
                   
                   
'data'             ‘`userbase'’
                   


File: python.info,  Node: Home scheme,  Next: Prefix scheme,  Prev: User scheme,  Up: sysconfig --- Python の構成情報へのアクセスを提供する

5.29.3.7 Home scheme
....................

"home スキーム" の背後にある考え方は、Python モジュールを個人用のモジュ
ール置き場でビルドし、維持するというものです。このスキームの名前は Unixの
「ホーム」ディレクトリの概念からとりました。というのも、 Unixのユーザに
とって、自分のホームディレクトリを ‘/usr/’ や ‘/usr/local/’ のようにレイ
アウトするのはよくあることだからです。とはいえ、このスキームはどのオペレ
ーティングシステムのユーザでも使えます。

* Menu:

* posix_home::


File: python.info,  Node: posix_home,  Up: Home scheme

5.29.3.8 ‘posix_home’
.....................

Path               インストールディレクトリ
                   
-----------------------------------------------------------------------------------
                   
'stdlib'           ‘`home'/lib/python’
                   
                   
'platstdlib'       ‘`home'/lib/python’
                   
                   
'platlib'          ‘`home'/lib/python’
                   
                   
'purelib'          ‘`home'/lib/python’
                   
                   
'include'          ‘`home'/include/python’
                   
                   
'platinclude'      ‘`home'/include/python’
                   
                   
'scripts'          ‘`home'/bin’
                   
                   
'data'             ‘`home'’
                   


File: python.info,  Node: Prefix scheme,  Next: Installation path functions,  Prev: Home scheme,  Up: sysconfig --- Python の構成情報へのアクセスを提供する

5.29.3.9 Prefix scheme
......................

あるインストール済みの Python を使ってモジュールのビルド/インストールを
(例えば setup スクリプトを実行して) 行いたいけれども、 別のインストール
済みの Python のサードパーティ製モジュール置き場 (あるいは、そう見えるよ
うなディレクトリ構造) に、ビルドされた モジュールをインストールしたい場
合には、"prefix スキーム" が便利です。そんな作業はまったくありえそうにな
い、と思うなら、確かにその通りです -- "home スキーム" を先に説明したのも
そのためです。とはいえ、prefix スキームが有用なケースは少なくとも二つあ
ります。

First, consider that many Linux distributions put Python in ‘/usr’,
rather than the more traditional ‘/usr/local’.  This is entirely
appropriate, since in those cases Python is part of "the system" rather
than a local add-on.  However, if you are installing Python modules from
source, you probably want them to go in ‘/usr/local/lib/python2.`X'’
rather than ‘/usr/lib/python2.`X'’.

Another possibility is a network filesystem where the name used to write
to a remote directory is different from the name used to read it: for
example, the Python interpreter accessed as ‘/usr/local/bin/python’
might search for modules in ‘/usr/local/lib/python2.`X'’, but those
modules would have to be installed to, say,
‘/mnt/`@server'/export/lib/python2.`X'’.

* Menu:

* posix_prefix::
* nt::


File: python.info,  Node: posix_prefix,  Next: nt,  Up: Prefix scheme

5.29.3.10 ‘posix_prefix’
........................

Path               インストールディレクトリ
                   
----------------------------------------------------------------------------------
                   
'stdlib'           ‘`prefix'/lib/python`X.Y'’
                   
                   
'platstdlib'       ‘`prefix'/lib/python`X.Y'’
                   
                   
'platlib'          ‘`prefix'/lib/python`X.Y'/site-packages’
                   
                   
'purelib'          ‘`prefix'/lib/python`X.Y'/site-packages’
                   
                   
'include'          ‘`prefix'/include/python`X.Y'’
                   
                   
'platinclude'      ‘`prefix'/include/python`X.Y'’
                   
                   
'scripts'          ‘`prefix'/bin’
                   
                   
'data'             ‘`prefix'’
                   


File: python.info,  Node: nt,  Prev: posix_prefix,  Up: Prefix scheme

5.29.3.11 ‘nt’
..............

Path               インストールディレクトリ
                   
----------------------------------------------------------------------------------
                   
'stdlib'           ‘`prefix'\Lib’
                   
                   
'platstdlib'       ‘`prefix'\Lib’
                   
                   
'platlib'          ‘`prefix'\Lib\site-packages’
                   
                   
'purelib'          ‘`prefix'\Lib\site-packages’
                   
                   
'include'          ‘`prefix'\Include’
                   
                   
'platinclude'      ‘`prefix'\Include’
                   
                   
'scripts'          ‘`prefix'\Scripts’
                   
                   
'data'             ‘`prefix'’
                   


File: python.info,  Node: Installation path functions,  Next: その他の関数<3>,  Prev: Prefix scheme,  Up: sysconfig --- Python の構成情報へのアクセスを提供する

5.29.3.12 Installation path functions
.....................................

‘sysconfig’ provides some functions to determine these installation
paths.

 -- の関数: sysconfig.get_scheme_names ()

     Return a tuple containing all schemes currently supported in
     ‘sysconfig’.

 -- の関数: sysconfig.get_default_scheme ()

     Return the default scheme name for the current platform.

     Added in version 3.10: This function was previously named
     ‘_get_default_scheme()’ and considered an implementation detail.

     バージョン 3.11 で変更: When Python runs from a virtual
     environment, the 'venv' scheme is returned.

 -- の関数: sysconfig.get_preferred_scheme (key)

     Return a preferred scheme name for an installation layout specified
     by 'key'.

     'key' must be either ‘"prefix"’, ‘"home"’, or ‘"user"’.

     The return value is a scheme name listed in *note
     get_scheme_names(): 496d.  It can be passed to ‘sysconfig’
     functions that take a 'scheme' argument, such as *note get_paths():
     340.

     Added in version 3.10.

     バージョン 3.11 で変更: When Python runs from a virtual environment
     and ‘key="prefix"’, the 'venv' scheme is returned.

 -- の関数: sysconfig._get_preferred_schemes ()

     Return a dict containing preferred scheme names on the current
     platform.  Python implementers and redistributors may add their
     preferred schemes to the ‘_INSTALL_SCHEMES’ module-level global
     value, and modify this function to return those scheme names, to
     e.g.  provide different schemes for system and language package
     managers to use, so packages installed by either do not mix with
     those by the other.

     End users should not use this function, but *note
     get_default_scheme(): 1bb5. and *note get_preferred_scheme(): 89f.
     instead.

     Added in version 3.10.

 -- の関数: sysconfig.get_path_names ()

     Return a tuple containing all path names currently supported in
     ‘sysconfig’.

 -- の関数: sysconfig.get_path (name[, scheme[, vars[, expand]]])

     'scheme' で指定されたインストールスキームから、パス 'name' に従って
     インストールパスを返します。

     'name' は *note get_path_names(): 496f. が返すリストに含まれる値で
     なければなりません。

     ‘sysconfig’ stores installation paths corresponding to each path
     name, for each platform, with variables to be expanded.  For
     instance the 'stdlib' path for the 'nt' scheme is: ‘{base}/Lib’.

     *note get_path(): 1545. はパスを展開するのに *note
     get_config_vars(): 298. が返す変数を利用します。すべての変数は各プ
     ラットフォームにおいてデフォルト値を持っていて、この関数を呼び出し
     たときにデフォルト値を取得する場合があります。

     'scheme' が指定された場合、*note get_scheme_names(): 496d. が返すリ
     ストに含まれる値でなければなりません。指定されなかった場合は、現在
     のプラットフォームでのデフォルトスキームが利用されます。

     If 'vars' is provided, it must be a dictionary of variables that
     will update the dictionary returned by *note get_config_vars():
     298.

     'expand' が ‘False’ に設定された場合、パスは変数を使って展開されま
     せん。

     'name' が見つからない場合、*note KeyError: 5e7. を送出します。

 -- の関数: sysconfig.get_paths ([scheme[, vars[, expand]]])

     インストールスキームに基づいたすべてのインストールパスを格納した辞
     書を返します。詳しい情報は *note get_path(): 1545. を参照してくださ
     い。

     'scheme' が指定されない場合、現在のプラットフォームでのデフォルトス
     キーマが使用されます。

     'vars' を指定する場合、パスを展開するために使用される辞書を更新する
     値の辞書でなければなりません。

     'expand' に偽を指定すると、パスは展開されません。

     'scheme' が実在するスキームでなかった場合、*note get_paths(): 340.
     は *note KeyError: 5e7. を発生させます。


File: python.info,  Node: その他の関数<3>,  Next: コマンドラインでの使用<7>,  Prev: Installation path functions,  Up: sysconfig --- Python の構成情報へのアクセスを提供する

5.29.3.13 その他の関数
......................

 -- の関数: sysconfig.get_python_version ()

     ‘MAJOR.MINOR’ の型の Python バージョン番号文字列を返します。
     ‘'%d.%d' % sys.version_info[:2]’ に似ています。

 -- の関数: sysconfig.get_platform ()

     現在のプラットフォームを識別するための文字列を返します。

     This is used mainly to distinguish platform-specific build
     directories and platform-specific built distributions.  Typically
     includes the OS name and version and the architecture (as supplied
     by *note os.uname(): 132e.), although the exact information
     included depends on the OS; e.g., on Linux, the kernel version
     isn't particularly important.

     返される値の例:

     Windows:

        - win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and
          EM64T)

        - win-arm64 (64-bit Windows on ARM64, aka AArch64)

        - win32 (その他すべて - 具体的には sys.platform が返す値)

     POSIX based OS:

        - linux-x86_64

        - macosx-15.5-arm64

        - macosx-26.0-universal2 (macOS on Apple Silicon or Intel)

        - android-24-arm64_v8a

     その他の非 POSIX プラットフォームでは、現在のところ単に *note
     sys.platform: 291. を返します。

 -- の関数: sysconfig.is_python_build ()

     実行中の Python インタプリタがソースからビルドされ、かつそのビルド
     された場所から実行されている場合に ‘True’ を返します。 ‘make
     install’ を実行した場所からの実行やバイナリインストーラによるインス
     トールではいけません。

 -- の関数: sysconfig.parse_config_h (fp[, vars])

     ‘config.h’ スタイルのファイルを解析します。

     'fp' は ‘config.h’ スタイルのファイルを指すファイルライクオブジェク
     トです。

     name/value ペアを格納した辞書を返します。第二引数にオプションの辞書
     が渡された場合、新しい辞書ではなくその辞書を利用し、ファイルから読
     み込んだ値で更新します。

 -- の関数: sysconfig.get_config_h_filename ()

     ‘pyconfig.h’ のパスを返します。

 -- の関数: sysconfig.get_makefile_filename ()

     ‘Makefile’ のパスを返します。


File: python.info,  Node: コマンドラインでの使用<7>,  Prev: その他の関数<3>,  Up: sysconfig --- Python の構成情報へのアクセスを提供する

5.29.3.14 コマンドラインでの使用
................................

You can use ‘sysconfig’ as a script with Python's '-m' option:

     $ python -m sysconfig
     Platform: "macosx-10.4-i386"
     Python version: "3.2"
     Current installation scheme: "posix_prefix"

     Paths:
             data = "/usr/local"
             include = "/Users/tarek/Dev/svn.python.org/py3k/Include"
             platinclude = "."
             platlib = "/usr/local/lib/python3.2/site-packages"
             platstdlib = "/usr/local/lib/python3.2"
             purelib = "/usr/local/lib/python3.2/site-packages"
             scripts = "/usr/local/bin"
             stdlib = "/usr/local/lib/python3.2"

     Variables:
             AC_APPLE_UNIVERSAL_BUILD = "0"
             AIX_GENUINE_CPLUSPLUS = "0"
             AR = "ar"
             ARFLAGS = "rc"
             ...

これは、*note get_platform(): 145a.、*note get_python_version(): 145b.、
*note get_path(): 1545. および *note get_config_vars(): 298. が返す情報
を標準出力に出力します。


File: python.info,  Node: builtins --- 組み込みオブジェクト,  Next: __main__ --- トップレベルのコード環境,  Prev: sysconfig --- Python の構成情報へのアクセスを提供する,  Up: Python ランタイムサービス

5.29.4 ‘builtins’ -- 組み込みオブジェクト
-----------------------------------------

__________________________________________________________________

This module provides direct access to all 'built-in' identifiers of
Python; for example, ‘builtins.open’ is the full name for the built-in
function *note open(): 316.

通常このモジュールはほとんどのアプリケーションで明示的にアクセスされるこ
とはありませんが、組み込みの値と同じ名前のオブジェクトを提供するモジュー
ルが同時にその名前の組み込みオブジェクトも必要とするような場合には有用で
す。たとえば、組み込みの *note open(): 316. をラップした *note open():
316. という関数を実装したいモジュールがあったとすると、このモジュールは
次のように直接的に使われます:

     import builtins

     def open(path):
         f = builtins.open(path, 'r')
         return UpperCaser(f)

     class UpperCaser:
         '''Wrapper around a file that converts output to uppercase.'''

         def __init__(self, f):
             self._f = f

         def read(self, count=-1):
             return self._f.read(count).upper()

         # ...

ほとんどのモジュールではグローバル変数の一部として ‘__builtins__’ が利用
できるようになっています。 ‘__builtins__’ の内容は通常このモジュールその
ものか、あるいはこのモジュールの *note __dict__: 77d. 属性です。これは実
装の詳細部分なので、異なる Python の実装では ‘__builtins__’ は使われてい
ないこともあります。

参考
....

   * *note 組み込み定数: 2477.

   * *note 組み込み例外: 1c27.

   * *note 組み込み関数: 1474.

   * *note 組み込み型: 25e9.


File: python.info,  Node: __main__ --- トップレベルのコード環境,  Next: warnings --- 警告の制御,  Prev: builtins --- 組み込みオブジェクト,  Up: Python ランタイムサービス

5.29.5 ‘__main__’ -- トップレベルのコード環境
---------------------------------------------

__________________________________________________________________

Python では、 ‘__main__’ という特別な名前が次の二つの重要な用途で使われ
ます:

  1. プログラムのトップレベル環境の名前。 ‘__name__ == '__main__'’ とい
     う式でチェックすることができる。

  2. Python パッケージにおける ‘__main__.py’ ファイル。

どちらも Python のモジュールに関わる機能です。 １つ目はユーザーがどうモ
ジュールを使うか、２つ目はモジュールとモジュールがどうやりとりするかに関
係します。 詳細は以下で説明します。 Python モジュールがどういうものかに
ついては、 *note モジュール: 203e. を参照してください。

* Menu:

* __name__ == '__main__'::
* __main__.py in Python Packages: __main__ py in Python Packages.
* import __main__::


File: python.info,  Node: __name__ == '__main__',  Next: __main__ py in Python Packages,  Up: __main__ --- トップレベルのコード環境

5.29.5.1 ‘__name__ == '__main__'’
.................................

Python モジュールやパッケージがインポートされるとき、 ‘__name__’ の値は
そのモジュールの名前となります。 通常、インポートされる Python ファイル
自体のファイル名から拡張子 ‘.py’ を除いたものとなります:

     >>> import configparser
     >>> configparser.__name__
     'configparser'

インポートされるファイルがパッケージの一部である場合は、 ‘__name__’ には
そのパッケージのパスも含まれます:

     >>> from concurrent.futures import process
     >>> process.__name__
     'concurrent.futures.process'

しかし、モジュールがトップレベルのスクリプト環境で実行される場合は、
‘__name__’ が ‘'__main__'’ という文字列になります。

* Menu:

* 「トップレベルのスクリプト環境」とは::
* 通常の使われ方::
* パッケージングで考慮すべき点::


File: python.info,  Node: 「トップレベルのスクリプト環境」とは,  Next: 通常の使われ方,  Up: __name__ == '__main__'

5.29.5.2 「トップレベルのスクリプト環境」とは
.............................................

‘__main__’ は、トップレベルのコードが実行される環境の名前です。 "トップ
レベルのコード" は、実行を開始する最初のユーザー指定の Python モジュール
です。これは、このモジュールがプログラムに必要なすべての他のモジュールを
インポートするために、 "トップレベル" なのです。時折、 "トップレベルのコ
ード" は、アプリケーションには 'エントリーポイント' と呼ばれます。

以下のものがトップレベルのスクリプト環境となります:

   * インタラクティブプロンプトのスコープ:

          >>> __name__
          '__main__'

   * Python インタープリタにファイル引数として渡される Python モジュール
     :

          $ python helloworld.py
          Hello, world!

   * Python インタープリタにPython *note -m: 23c. オプションとして渡され
     る Python モジュールまたはパッケージ:

          $ python -m tarfile
          usage: tarfile.py [-h] [-v] (...)

   * 標準入力から Python インタープリタが読み込む Python コード:

          $ echo "import this" | python
          The Zen of Python, by Tim Peters

          Beautiful is better than ugly.
          Explicit is better than implicit.
          ...

   * Python インタープリタに *note -c: 1a8. オプションで渡される Python
     コード:

          $ python -c "import this"
          The Zen of Python, by Tim Peters

          Beautiful is better than ugly.
          Explicit is better than implicit.
          ...

上記それぞれの場合で、トップレベルのモジュールの ‘__name__’ の値が
‘'__main__'’ となります。

これにより、 ‘__name__’ をチェックすれば各モジュールは自分がトップレベル
環境で実行されているかどうかを知ることができます。 このことから、モジュ
ールが import 文で初期化された場合以外の場合でのみコードを実行するため、
次のコードがしばしば用いられます:

     if __name__ == '__main__':
         # Execute when the module is not initialized from an import statement.
         ...

参考
....

あらゆる場合に ‘__name__’ の値がどうセットされるのかについて、詳しくはチ
ュートリアルの *note モジュール: 203e. セクションを参照してください。


File: python.info,  Node: 通常の使われ方,  Next: パッケージングで考慮すべき点,  Prev: 「トップレベルのスクリプト環境」とは,  Up: __name__ == '__main__'

5.29.5.3 通常の使われ方
.......................

一部のモジュールでは、コマンドライン引数をパースしたり標準入力からデータ
を取得したなど、スクリプト用途のみのコードが含まれています。 このような
モジュールが、例えばユニットテストのため、別のモジュールからインポートさ
れると、そのスクリプト用コードが意図に反して実行されてしまいます。

‘if __name__ == '__main__'’ というコードは、このようなときに役立ちます。
このブロックの中にあるコードは、当該のモジュールがトップレベル環境で実行
されていない限り、実行されません。

‘if __name__ == '__main__'’ の下のブロックにあるコードはできるだけ少なく
した方が、コードの分かりやすさや正確さにつながります。 最もよくあるのが
、プログラムの主要な処理を ‘main’ 関数の中にカプセル化することです:

     # echo.py

     import shlex
     import sys

     def echo(phrase: str) -> None:
        """A dummy wrapper around print."""
        # for demonstration purposes, you can imagine that there is some
        # valuable and reusable logic inside this function
        print(phrase)

     def main() -> int:
         """Echo the input arguments to standard output"""
         phrase = shlex.join(sys.argv)
         echo(phrase)
         return 0

     if __name__ == '__main__':
         sys.exit(main())  # next section explains the use of sys.exit

注意すべき点として、もし ‘main’ 関数内のコードをカプセル化せず ‘if
__name__ == '__main__'’ の下に直接書いた場合、 ‘phrase’ 変数はモジュール
全体からグローバルにアクセスできてしまいます。 モジュール内の他の関数が
意図せずローカル変数ではなくそのグローバル変数を使用してしまう可能性があ
るため、ミスにつながります。 ‘main’ 関数を用意することでこの問題は解決で
きます。

‘main’ 関数を使うことのもう一つのメリットとして、 ‘echo’ 関数が分離し、
別の場所からインポートできるようになることです。 ‘echo.py’ がインポート
されるとき、 ‘echo’ 関数と ‘main’ 関数が定義されますが、 ‘__name__ !=
'__main__'’ であるため、どちらの関数も呼び出されません。


File: python.info,  Node: パッケージングで考慮すべき点,  Prev: 通常の使われ方,  Up: __name__ == '__main__'

5.29.5.4 パッケージングで考慮すべき点
.....................................

‘main’ functions are often used to create command-line tools by
specifying them as entry points for console scripts.  When this is done,
pip(1) inserts the function call into a template script, where the
return value of ‘main’ is passed into *note sys.exit(): 277.  For
example:

     sys.exit(main())

Since the call to ‘main’ is wrapped in *note sys.exit(): 277, the
expectation is that your function will return some value acceptable as
an input to *note sys.exit(): 277.; typically, an integer or ‘None’
(which is implicitly returned if your function does not have a return
statement).

By proactively following this convention ourselves, our module will have
the same behavior when run directly (i.e.  ‘python echo.py’) as it will
have if we later package it as a console script entry-point in a
pip-installable package.

In particular, be careful about returning strings from your ‘main’
function.  *note sys.exit(): 277. will interpret a string argument as a
failure message, so your program will have an exit code of ‘1’,
indicating failure, and the string will be written to *note sys.stderr:
b33.  The ‘echo.py’ example from earlier exemplifies using the
‘sys.exit(main())’ convention.

参考
....

Python Packaging User Guide(2) contains a collection of tutorials and
references on how to distribute and install Python packages with modern
tools.

   ---------- Footnotes ----------

   (1) https://pip.pypa.io/

   (2) https://packaging.python.org/


File: python.info,  Node: __main__ py in Python Packages,  Next: import __main__,  Prev: __name__ == '__main__',  Up: __main__ --- トップレベルのコード環境

5.29.5.5 ‘__main__.py’ in Python Packages
.........................................

If you are not familiar with Python packages, see section *note
パッケージ: 204e. of the tutorial.  Most commonly, the ‘__main__.py’
file is used to provide a command-line interface for a package.
Consider the following hypothetical package, "bandclass":

     bandclass
       ├── __init__.py
       ├── __main__.py
       └── student.py

‘__main__.py’ will be executed when the package itself is invoked
directly from the command line using the *note -m: 23c. flag.  For
example:

     $ python -m bandclass

This command will cause ‘__main__.py’ to run.  How you utilize this
mechanism will depend on the nature of the package you are writing, but
in this hypothetical case, it might make sense to allow the teacher to
search for students:

     # bandclass/__main__.py

     import sys
     from .student import search_students

     student_name = sys.argv[1] if len(sys.argv) >= 2 else ''
     print(f'Found student: {search_students(student_name)}')

Note that ‘from .student import search_students’ is an example of a
relative import.  This import style can be used when referencing modules
within a package.  For more details, see *note パッケージ内参照: 2052.
in the *note モジュール: 203e. section of the tutorial.

* Menu:

* 通常の使われ方: 通常の使われ方<2>.


File: python.info,  Node: 通常の使われ方<2>,  Up: __main__ py in Python Packages

5.29.5.6 通常の使われ方
.......................

The content of ‘__main__.py’ typically isn't fenced with an ‘if __name__
== '__main__'’ block.  Instead, those files are kept short and import
functions to execute from other modules.  Those other modules can then
be easily unit-tested and are properly reusable.

If used, an ‘if __name__ == '__main__'’ block will still work as
expected for a ‘__main__.py’ file within a package, because its
‘__name__’ attribute will include the package's path if imported:

     >>> import asyncio.__main__
     >>> asyncio.__main__.__name__
     'asyncio.__main__'

This won't work for ‘__main__.py’ files in the root directory of a
‘.zip’ file though.  Hence, for consistency, a minimal ‘__main__.py’
without a ‘__name__’ check is preferred.

参考
....

See *note venv: 117. for an example of a package with a minimal
‘__main__.py’ in the standard library.  It doesn't contain a ‘if
__name__ == '__main__'’ block.  You can invoke it with ‘python -m venv
[directory]’.

See *note runpy: c3. for more details on the *note -m: 23c. flag to the
interpreter executable.

See *note zipapp: 136. for how to run applications packaged as '.zip'
files.  In this case Python looks for a ‘__main__.py’ file in the root
directory of the archive.


File: python.info,  Node: import __main__,  Prev: __main__ py in Python Packages,  Up: __main__ --- トップレベルのコード環境

5.29.5.7 ‘import __main__’
..........................

Regardless of which module a Python program was started with, other
modules running within that same program can import the top-level
environment's scope (*note namespace: 203f.) by importing the ‘__main__’
module.  This doesn't import a ‘__main__.py’ file but rather whichever
module that received the special name ‘'__main__'’.

Here is an example module that consumes the ‘__main__’ namespace:

     # namely.py

     import __main__

     def did_user_define_their_name():
         return 'my_name' in dir(__main__)

     def print_user_name():
         if not did_user_define_their_name():
             raise ValueError('Define the variable `my_name`!')

         print(__main__.my_name)

Example usage of this module could be as follows:

     # start.py

     import sys

     from namely import print_user_name

     # my_name = "Dinsdale"

     def main():
         try:
             print_user_name()
         except ValueError as ve:
             return str(ve)

     if __name__ == "__main__":
         sys.exit(main())

Now, if we started our program, the result would look like this:

     $ python start.py
     Define the variable `my_name`!

The exit code of the program would be 1, indicating an error.
Uncommenting the line with ‘my_name = "Dinsdale"’ fixes the program and
now it exits with status code 0, indicating success:

     $ python start.py
     Dinsdale

Note that importing ‘__main__’ doesn't cause any issues with
unintentionally running top-level code meant for script use which is put
in the ‘if __name__ == "__main__"’ block of the ‘start’ module.  Why
does this work?

Python inserts an empty ‘__main__’ module in *note sys.modules: 17e6. at
interpreter startup, and populates it by running top-level code.  In our
example this is the ‘start’ module which runs line by line and imports
‘namely’.  In turn, ‘namely’ imports ‘__main__’ (which is really
‘start’).  That's an import cycle!  Fortunately, since the partially
populated ‘__main__’ module is present in *note sys.modules: 17e6,
Python passes that to ‘namely’.  See *note Special considerations for
__main__: 245f. in the import system's reference for details on how this
works.

The Python REPL is another example of a "top-level environment", so
anything defined in the REPL becomes part of the ‘__main__’ scope:

     >>> import namely
     >>> namely.did_user_define_their_name()
     False
     >>> namely.print_user_name()
     Traceback (most recent call last):
     ...
     ValueError: Define the variable `my_name`!
     >>> my_name = 'Jabberwocky'
     >>> namely.did_user_define_their_name()
     True
     >>> namely.print_user_name()
     Jabberwocky

The ‘__main__’ scope is used in the implementation of *note pdb: aa. and
*note rlcompleter: c2.


File: python.info,  Node: warnings --- 警告の制御,  Next: dataclasses --- データクラス,  Prev: __main__ --- トップレベルのコード環境,  Up: Python ランタイムサービス

5.29.6 ‘warnings’ -- 警告の制御
-------------------------------

'ソースコード:' Lib/warnings.py(1)

__________________________________________________________________

警告メッセージは一般に、ユーザに警告しておいた方がよいような状況下にプロ
グラムが置かれているが、その状況は (通常は) 例外を送出したりそのプログラ
ムを終了させるほどの正当な理由がないといった状況で発されます。例えば、プ
ログラムが古いモジュールを使っている場合には警告を発したくなるかもしれま
せん。

Python プログラマは、このモジュールの *note warn(): 1732. 関数を使って警
告を発することができます。(C 言語のプログラマは *note PyErr_WarnEx():
1665. を使います; 詳細は *note 例外処理: 4988. を参照してください)。

警告メッセージは通常 *note sys.stderr: b33. に出力されますが、すべての警
告を無視したり、警告を例外にしたりと、その処理を柔軟に変更することができ
ます。 警告の処理は *note warning category: 2711. 、警告メッセージのテキ
スト、警告が発行されたソースの位置に基づいて変化します。 同じソースの位
置で特定の警告が繰り返された場合、通常は抑制されます。

警告制御には 2 つの段階 (stage) があります: 第一に、警告が発されるたびに
、メッセージを出力すべきかどうかの決定が行われます; 次に、メッセージを出
力するなら、メッセージはユーザによって設定が可能なフックを使って書式化さ
れ印字されます。

警告メッセージを出力するかどうかの決定は、 *note 警告フィルタ: 1b1. によ
って制御されます。警告フィルタは一致規則 (matching rule)と動作からなるシ
ーケンスです。 *note filterwarnings(): 16c2. を呼び出して一致規則をフィ
ルタに追加することができ、 *note resetwarnings(): 4989. を呼び出してフィ
ルタを標準設定の状態にリセットすることができます。

警告メッセージの印字は *note showwarning(): 498a. を呼び出して行うことが
でき、この関数は上書きすることができます; この関数の標準の実装では、
*note formatwarning(): 1df8. を呼び出して警告メッセージを書式化しますが
、この関数についても自作の実装を使うことができます。

参考
....

*note logging.captureWarnings(): 31a4. を使うことで、標準ロギング基盤で
すべての警告を扱うことができます。

* Menu:

* 警告カテゴリ::
* 警告フィルタ::
* 一時的に警告を抑制する::
* 警告のテスト::
* Updating Code For New Versions of Dependencies::
* 利用可能な関数::
* 利用可能なコンテキストマネージャー::
* Concurrent safety of Context Managers::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/warnings.py


File: python.info,  Node: 警告カテゴリ,  Next: 警告フィルタ,  Up: warnings --- 警告の制御

5.29.6.1 警告カテゴリ
.....................

警告カテゴリを表現する組み込み例外は数多くあります。このカテゴリ化は警告
をグループごとフィルタする上で便利です。

これらは厳密に言えば *note 組み込み例外: 270f. ですが、概念的には警告メ
カニズムに属しているのでここで記述されています。

標準の警告カテゴリをユーザの作成したコード上でサブクラス化することで、さ
らに別の警告カテゴリを定義することができます。警告カテゴリは常に *note
Warning: 2712. クラスのサブクラスでなければなりません。

現在以下の警告カテゴリクラスが定義されています:

クラス                                 説明
                                       
-------------------------------------------------------------------------------------------
                                       
*note Warning: 2712.                   すべての警告カテゴリクラスの基底クラスです。
                                       *note Exception: bcd. のサブクラスです。
                                       
                                       
*note UserWarning: 2713.               *note warn(): 1732. の標準のカテゴリです。
                                       
                                       
*note DeprecationWarning: 1a3.         他の Python 開発者へ向けて警告を発するときの、非
                                       推奨の機能についての警告の基底カテゴリです
                                       (‘__main__’ によって引き起こされない限り通常は無
                                       視されます)。
                                       
                                       
*note SyntaxWarning: 1ae.              Base category for warnings about dubious
                                       syntactic features (typically emitted when
                                       compiling Python source code, and hence may not
                                       be suppressed by runtime filters)
                                       
                                       
*note RuntimeWarning: 4d7.             そのランタイム機能があいまいであることを示す警告
                                       カテゴリの基底クラスです。
                                       
                                       
*note FutureWarning: 659.              Python で書かれたアプリケーションのエンドユーザー
                                       へ向けて警告を発するときの、非推奨の機能について
                                       の警告の基底カテゴリです。
                                       
                                       
*note PendingDeprecationWarning: ac5.  将来その機能が非推奨になることを示す警告カテゴリ
                                       の基底クラスです(デフォルトでは無視されます)。
                                       
                                       
*note ImportWarning: 71e.              モジュールのインポート処理中に引き起こされる警告
                                       カテゴリの基底クラスです (デフォルトでは無視され
                                       ます)。
                                       
                                       
*note UnicodeWarning: 163d.            Unicode に関係した警告カテゴリの基底クラスです。
                                       
                                       
*note BytesWarning: e1c.               *note bytes: 192. や *note bytearray: 344. に関連
                                       した警告カテゴリの基底クラスです。
                                       
                                       
*note ResourceWarning: 54c.            リソースの使用に関連した警告カテゴリの基底クラス
                                       です (デフォルトでは無視されます)。
                                       

バージョン 3.7 で変更: Previously *note DeprecationWarning: 1a3. and
*note FutureWarning: 659. were distinguished based on whether a feature
was being removed entirely or changing its behaviour.  They are now
distinguished based on their intended audience and the way they're
handled by the default warnings filters.


File: python.info,  Node: 警告フィルタ,  Next: 一時的に警告を抑制する,  Prev: 警告カテゴリ,  Up: warnings --- 警告の制御

5.29.6.2 警告フィルタ
.....................

警告フィルタは、ある警告を無視すべきか、表示すべきか、あるいは (例外を送
出する) エラーにするべきかを制御します。

概念的には、警告フィルタは複数のフィルタ仕様からなる順番リストを維持して
います; 何らかの特定の警告が生じると、一致するものが見つかるまでリスト中
の各フィルタとの照合が行われます; 一致したフィルタ仕様がその警告の処理方
法を決定します。フィルタの各エントリは ('action', 'message', 'category',
'module', 'lineno') からなるタプルです。ここで:

   * 'action' は以下の文字列のうちの一つです:

     値                  処理方法
                         
     -----------------------------------------------------------------------
                         
     ‘"default"’         print the first occurrence of matching warnings
                         for each location (module + line number) where
                         the warning is issued
                         
                         
     ‘"error"’           一致した警告を例外に変えます
                         
                         
     ‘"ignore"’          一致した警告を出力しません
                         
                         
     ‘"always"’          一致した警告を常に出力します
                         
                         
     ‘"all"’             alias to "always"
                         
                         
     ‘"module"’          print the first occurrence of matching warnings
                         for each module where the warning is issued
                         (regardless of line number)
                         
                         
     ‘"once"’            一致した警告のうち、警告の原因になった場所にかか
                         わらず最初の警告のみ出力します
                         

   * 'message' is a string containing a regular expression that the
     start of the warning message must match, case-insensitively.  In
     *note -W: ac6. and *note PYTHONWARNINGS: da3, 'message' is a
     literal string that the start of the warning message must contain
     (case-insensitively), ignoring any whitespace at the start or end
     of 'message'.

   * 'category' はクラス (*note Warning: 2712. のサブクラス) です。警告
     クラスはこのクラスのサブクラスに一致しなければなりません。

   * 'module' is a string containing a regular expression that the start
     of the fully qualified module name must match, case-sensitively.
     In *note -W: ac6. and *note PYTHONWARNINGS: da3, 'module' is a
     literal string that the fully qualified module name must be equal
     to (case-sensitively), ignoring any whitespace at the start or end
     of 'module'.

   * 'lineno' は整数で、警告が発生した場所の行番号に一致しなければなりま
     せん。‘0’ の場合はすべての行と一致します。

*note Warning: 2712. クラスは組み込みの *note Exception: bcd. クラスから
派生しているので、警告をエラーに変換するには単に ‘category(message)’ を
‘raise’ します。

If a warning is reported and doesn't match any registered filter then
the "default" action is applied (hence its name).

* Menu:

* Repeated Warning Suppression Criteria::
* Describing Warning Filters::
* デフォルトの警告フィルタ::
* Overriding the default filter::


File: python.info,  Node: Repeated Warning Suppression Criteria,  Next: Describing Warning Filters,  Up: 警告フィルタ

5.29.6.3 Repeated Warning Suppression Criteria
..............................................

The filters that suppress repeated warnings apply the following criteria
to determine if a warning is considered a repeat:

   - ‘"default"’: A warning is considered a repeat only if the
     ('message', 'category', 'module', 'lineno') are all the same.

   - ‘"module"’: A warning is considered a repeat if the ('message',
     'category', 'module') are the same, ignoring the line number.

   - ‘"once"’: A warning is considered a repeat if the ('message',
     'category') are the same, ignoring the module and line number.


File: python.info,  Node: Describing Warning Filters,  Next: デフォルトの警告フィルタ,  Prev: Repeated Warning Suppression Criteria,  Up: 警告フィルタ

5.29.6.4 Describing Warning Filters
...................................

The warnings filter is initialized by *note -W: ac6. options passed to
the Python interpreter command line and the *note PYTHONWARNINGS: da3.
environment variable.  The interpreter saves the arguments for all
supplied entries without interpretation in *note sys.warnoptions: 3f5.;
the ‘warnings’ module parses these when it is first imported (invalid
options are ignored, after printing a message to *note sys.stderr:
b33.).

Individual warnings filters are specified as a sequence of fields
separated by colons:

     action:message:category:module:line

The meaning of each of these fields is as described in *note
警告フィルタ: 1b1.  When listing multiple filters on a single line (as
for *note PYTHONWARNINGS: da3.), the individual filters are separated by
commas and the filters listed later take precedence over those listed
before them (as they're applied left-to-right, and the most recently
applied filters take precedence over earlier ones).

Commonly used warning filters apply to either all warnings, warnings in
a particular category, or warnings raised by particular modules or
packages.  Some examples:

     default                      # Show all warnings (even those ignored by default)
     ignore                       # Ignore all warnings
     error                        # Convert all warnings to errors
     error::ResourceWarning       # Treat ResourceWarning messages as errors
     default::DeprecationWarning  # Show DeprecationWarning messages
     ignore,default:::mymodule    # Only report warnings triggered by "mymodule"
     error:::mymodule             # Convert warnings to errors in "mymodule"


File: python.info,  Node: デフォルトの警告フィルタ,  Next: Overriding the default filter,  Prev: Describing Warning Filters,  Up: 警告フィルタ

5.29.6.5 デフォルトの警告フィルタ
.................................

デフォルトで、 Python はいくつかの警告フィルタをインストールします。これ
は *note -W: ac6. コマンドラインオプション、 *note PYTHONWARNINGS: da3.
環境変数または *note filterwarnings(): 16c2. の呼び出しでオーバーライド
できます。

In regular release builds, the default warning filter has the following
entries (in order of precedence):

     default::DeprecationWarning:__main__
     ignore::DeprecationWarning
     ignore::PendingDeprecationWarning
     ignore::ImportWarning
     ignore::ResourceWarning

In a *note debug build: 509, the list of default warning filters is
empty.

バージョン 3.2 で変更: *note PendingDeprecationWarning: ac5. に加えて、
*note DeprecationWarning: 1a3. もデフォルトで無視されるようになりました
。

バージョン 3.7 で変更: *note DeprecationWarning: 1a3. is once again
shown by default when triggered directly by code in ‘__main__’.

バージョン 3.7 で変更: *note BytesWarning: e1c. no longer appears in the
default filter list and is instead configured via *note sys.warnoptions:
3f5. when *note -b: 7f9. is specified twice.


File: python.info,  Node: Overriding the default filter,  Prev: デフォルトの警告フィルタ,  Up: 警告フィルタ

5.29.6.6 Overriding the default filter
......................................

Developers of applications written in Python may wish to hide 'all'
Python level warnings from their users by default, and only display them
when running tests or otherwise working on the application.  The *note
sys.warnoptions: 3f5. attribute used to pass filter configurations to
the interpreter can be used as a marker to indicate whether or not
warnings should be disabled:

     import sys

     if not sys.warnoptions:
         import warnings
         warnings.simplefilter("ignore")

Developers of test runners for Python code are advised to instead ensure
that 'all' warnings are displayed by default for the code under test,
using code like:

     import sys

     if not sys.warnoptions:
         import os, warnings
         warnings.simplefilter("default") # Change the filter in this process
         os.environ["PYTHONWARNINGS"] = "default" # Also affect subprocesses

Finally, developers of interactive shells that run user code in a
namespace other than ‘__main__’ are advised to ensure that *note
DeprecationWarning: 1a3. messages are made visible by default, using
code like the following (where ‘user_ns’ is the module used to execute
code entered interactively):

     import warnings
     warnings.filterwarnings("default", category=DeprecationWarning,
                                        module=user_ns.get("__name__"))


File: python.info,  Node: 一時的に警告を抑制する,  Next: 警告のテスト,  Prev: 警告フィルタ,  Up: warnings --- 警告の制御

5.29.6.7 一時的に警告を抑制する
...............................

If you are using code that you know will raise a warning, such as a
deprecated function, but do not want to see the warning (even when
warnings have been explicitly configured via the command line), then it
is possible to suppress the warning using the *note catch_warnings: 179.
context manager:

     import warnings

     def fxn():
         warnings.warn("deprecated", DeprecationWarning)

     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         fxn()

While within the context manager all warnings will simply be ignored.
This allows you to use known-deprecated code without having to see the
warning while not suppressing the warning for other code that might not
be aware of its use of deprecated code.

          注釈: See *note Concurrent safety of Context Managers: 4996.
          for details on the concurrency-safety of the *note
          catch_warnings: 179. context manager when used in programs
          using multiple threads or async functions.


File: python.info,  Node: 警告のテスト,  Next: Updating Code For New Versions of Dependencies,  Prev: 一時的に警告を抑制する,  Up: warnings --- 警告の制御

5.29.6.8 警告のテスト
.....................

コードが警告を発生させることをテストするには、 *note catch_warnings:
179. コンテキストマネージャーを利用します。このクラスを使うと、一時的に
警告フィルタを操作してテストに利用できます。例えば、次のコードでは、発生
したすべての警告を取得してチェックしています:

     import warnings

     def fxn():
         warnings.warn("deprecated", DeprecationWarning)

     with warnings.catch_warnings(record=True) as w:
         # Cause all warnings to always be triggered.
         warnings.simplefilter("always")
         # Trigger a warning.
         fxn()
         # Verify some things
         assert len(w) == 1
         assert issubclass(w[-1].category, DeprecationWarning)
         assert "deprecated" in str(w[-1].message)

‘always’ の代わりに ‘error’ を利用することで、すべての警告で例外を発生さ
せることができます。1つ気をつけないといけないのは、一度 ‘once’/‘default’
ルールによって発生した警告は、フィルタに何をセットしているかにかかわらず
、警告レジストリをクリアしない限りは 2度と発生しません。

Once the context manager exits, the warnings filter is restored to its
state when the context was entered.  This prevents tests from changing
the warnings filter in unexpected ways between tests and leading to
indeterminate test results.

          注釈: See *note Concurrent safety of Context Managers: 4996.
          for details on the concurrency-safety of the *note
          catch_warnings: 179. context manager when used in programs
          using multiple threads or async functions.

同じ種類の警告を発生させる複数の操作をテストする場合、各操作が新しい警告
を発生させている事を確認するのは大切な事です (例えば、警告を例外として発
生させて各操作が例外を発生させることを確認したり、警告リストの長さが各操
作で増加していることを確認したり、警告リストを各操作の前に毎回クリアする
事ができます)。


File: python.info,  Node: Updating Code For New Versions of Dependencies,  Next: 利用可能な関数,  Prev: 警告のテスト,  Up: warnings --- 警告の制御

5.29.6.9 Updating Code For New Versions of Dependencies
.......................................................

Warning categories that are primarily of interest to Python developers
(rather than end users of applications written in Python) are ignored by
default.

Notably, this "ignored by default" list includes *note
DeprecationWarning: 1a3. (for every module except ‘__main__’), which
means developers should make sure to test their code with typically
ignored warnings made visible in order to receive timely notifications
of future breaking API changes (whether in the standard library or third
party packages).

In the ideal case, the code will have a suitable test suite, and the
test runner will take care of implicitly enabling all warnings when
running tests (the test runner provided by the *note unittest: 10c.
module does this).

In less ideal cases, applications can be checked for use of deprecated
interfaces by passing *note -Wd: ac6. to the Python interpreter (this is
shorthand for ‘-W default’) or setting ‘PYTHONWARNINGS=default’ in the
environment.  This enables default handling for all warnings, including
those that are ignored by default.  To change what action is taken for
encountered warnings you can change what argument is passed to *note -W:
ac6. (e.g.  ‘-W error’).  See the *note -W: ac6. flag for more details
on what is possible.


File: python.info,  Node: 利用可能な関数,  Next: 利用可能なコンテキストマネージャー,  Prev: Updating Code For New Versions of Dependencies,  Up: warnings --- 警告の制御

5.29.6.10 利用可能な関数
........................

 -- の関数: warnings.warn (message, category=None, stacklevel=1,
          source=None, *, skip_file_prefixes=())

     警告を発するか、無視するか、あるいは例外を送出します。 'category' 引
     数が与えられた場合、 *note 警告カテゴリクラス: 2711. でなければなり
     ません; 標準の値は *note UserWarning: 2713. です。 'message' を
     *note Warning: 2712. インスタンスで代用することもできますが、この場
     合 'category' は無視され、 ‘message.__class__’ が使われ、メッセージ
     文は ‘str(message)’ になります。発された例外が前述した *note
     警告フィルタ: 1b1. によってエラーに変更された場合、この関数は例外を
     送出します。引数 'stacklevel' は Python でラッパー関数を書く際に利
     用することができます。例えば:

          def deprecated_api(message):
              warnings.warn(message, DeprecationWarning, stacklevel=2)

     This makes the warning refer to ‘deprecated_api’'s caller, rather
     than to the source of ‘deprecated_api’ itself (since the latter
     would defeat the purpose of the warning message).

     The 'skip_file_prefixes' keyword argument can be used to indicate
     which stack frames are ignored when counting stack levels.  This
     can be useful when you want the warning to always appear at call
     sites outside of a package when a constant 'stacklevel' does not
     fit all call paths or is otherwise challenging to maintain.  If
     supplied, it must be a tuple of strings.  When prefixes are
     supplied, stacklevel is implicitly overridden to be ‘max(2,
     stacklevel)’.  To cause a warning to be attributed to the caller
     from outside of the current package you might write:

          # example/lower.py
          _warn_skips = (os.path.dirname(__file__),)

          def one_way(r_luxury_yacht=None, t_wobbler_mangrove=None):
              if r_luxury_yacht:
                  warnings.warn("Please migrate to t_wobbler_mangrove=.",
                                skip_file_prefixes=_warn_skips)

          # example/higher.py
          from . import lower

          def another_way(**kw):
              lower.one_way(**kw)

     This makes the warning refer to both the ‘example.lower.one_way()’
     and ‘example.higher.another_way()’ call sites only from calling
     code living outside of ‘example’ package.

     'source' 引数が与えられた場合、これは *note ResourceWarning: 54c. を
     発生させた破壊されたオブジェクトです。

     バージョン 3.6 で変更: 'source' 引数を追加しました。

     バージョン 3.12 で変更: Added 'skip_file_prefixes'.

 -- の関数: warnings.warn_explicit (message, category, filename, lineno,
          module=None, registry=None, module_globals=None, source=None)

     This is a low-level interface to the functionality of *note warn():
     1732, passing in explicitly the message, category, filename and
     line number, and optionally other arguments.  'message' must be a
     string and 'category' a subclass of *note Warning: 2712. or
     'message' may be a *note Warning: 2712. instance, in which case
     'category' will be ignored.

     'module', if supplied, should be the module name.  If no module is
     passed, the filename with ‘.py’ stripped is used.

     'registry', if supplied, should be the ‘__warningregistry__’
     dictionary of the module.  If no registry is passed, each warning
     is treated as the first occurrence, that is, filter actions
     ‘"default"’, ‘"module"’ and ‘"once"’ are handled as ‘"always"’.

     'module_globals' は、もし与えられるならば、警告が発せられるコードが
     使っているグローバル名前空間でなければなりません (この引数は
     zipfile やその他の非ファイルシステムのインポート元の中にあるモジュ
     ールのソースを表示することをサポートするためのものです)。

     'source' 引数が与えられた場合、これは *note ResourceWarning: 54c. を
     発生させた破壊されたオブジェクトです。

     バージョン 3.6 で変更: 'source' 引数を追加しました。

 -- の関数: warnings.showwarning (message, category, filename, lineno,
          file=None, line=None)

     警告をファイルに書き込みます。標準の実装では、
     ‘formatwarning(message, category, filename, lineno, line)’ を呼び出
     し、返された文字列を 'file' に書き込みます。 'file' は標準では
     *note sys.stderr: b33. です。この関数は ‘warnings.showwarning’ に任
     意の呼び出し可能オブジェクトを代入して置き換えることができます。
     'line' は警告メッセージに含めるソースコードの1行です。 'line' が与
     えられない場合、 *note showwarning(): 498a. は 'filename' と
     'lineno' から行を取得することを試みます。

 -- の関数: warnings.formatwarning (message, category, filename, lineno,
          line=None)

     警告を通常の方法で書式化します。返される文字列内には改行が埋め込ま
     れている可能性があり、かつ文字列は改行で終端されています。 'line' は
     警告メッセージに含まれるソースコードの1行です。 'line' が渡されない
     場合、 *note formatwarning(): 1df8. は 'filename' と 'lineno' から
     行の取得を試みます。

 -- の関数: warnings.filterwarnings (action, message='',
          category=Warning, module='', lineno=0, append=False)

     *note 警告フィルタ仕様: 1b1. のリストにエントリを一つ挿入します。標
     準ではエントリは先頭に挿入されます; 'append' が真ならば、末尾に挿入
     されます。この関数は引数の型をチェックし、 'message' および
     'module' の正規表現をコンパイルしてから、これらをタプルにして警告フ
     ィルタのリストに挿入します。二つのエントリが特定の警告に合致した場
     合、リストの先頭に近い方のエントリが後方にあるエントリに優先します
     。引数が省略されると、標準ではすべてにマッチする値に設定されます。

 -- の関数: warnings.simplefilter (action, category=Warning, lineno=0,
          append=False)

     単純なエントリを *note 警告フィルタ仕様: 1b1. のリストに挿入します
     。引数の意味は *note filterwarnings(): 16c2. と同じですが、この関数
     により挿入されるフィルタはカテゴリと行番号が一致していればすべての
     モジュールのすべてのメッセージに合致しますので、正規表現は必要あり
     ません。

 -- の関数: warnings.resetwarnings ()

     警告フィルタをリセットします。これにより、 *note -W: ac6. コマンド
     ラインオプションによるもの *note simplefilter(): 8d0. 呼び出しによ
     るものを含め、 *note filterwarnings(): 16c2. の呼び出しによる影響は
     すべて無効化されます。

 -- の関数: @warnings.deprecated (msg, *, category=DeprecationWarning,
          stacklevel=1)

     Decorator to indicate that a class, function or overload is
     deprecated.

     When this decorator is applied to an object, deprecation warnings
     may be emitted at runtime when the object is used.  *note static
     type checkers: 574. will also generate a diagnostic on usage of the
     deprecated object.

     使い方:

          from warnings import deprecated
          from typing import overload

          @deprecated("Use B instead")
          class A:
              pass

          @deprecated("Use g instead")
          def f():
              pass

          @overload
          @deprecated("int support is deprecated")
          def g(x: int) -> int: ...
          @overload
          def g(x: str) -> int: ...

     The warning specified by 'category' will be emitted at runtime on
     use of deprecated objects.  For functions, that happens on calls;
     for classes, on instantiation and on creation of subclasses.  If
     the 'category' is ‘None’, no warning is emitted at runtime.  The
     'stacklevel' determines where the warning is emitted.  If it is ‘1’
     (the default), the warning is emitted at the direct caller of the
     deprecated object; if it is higher, it is emitted further up the
     stack.  Static type checker behavior is not affected by the
     'category' and 'stacklevel' arguments.

     The deprecation message passed to the decorator is saved in the
     ‘__deprecated__’ attribute on the decorated object.  If applied to
     an overload, the decorator must be after the *note
     @~typing.overload: 4515. decorator for the attribute to exist on
     the overload as returned by *note typing.get_overloads(): 8bd.

     Added in version 3.13: See PEP 702(1).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0702/


File: python.info,  Node: 利用可能なコンテキストマネージャー,  Next: Concurrent safety of Context Managers,  Prev: 利用可能な関数,  Up: warnings --- 警告の制御

5.29.6.11 利用可能なコンテキストマネージャー
............................................

 -- クラス: warnings.catch_warnings (*, record=False, module=None,
          action=None, category=Warning, lineno=0, append=False)

     警告フィルタと *note showwarning(): 498a. 関数をコピーし、終了時に
     復元するコンテキストマネージャーです。 'record' 引数が *note False:
     d2b. (デフォルト値)だった場合、コンテキスト開始時には *note None:
     885. を返します。もし 'record' が *note True: e07. だった場合、リス
     トを返します。このリストにはカスタムの *note showwarning(): 498a. 関
     数(この関数は同時に ‘sys.stdout’ への出力を抑制します)によってオブ
     ジェクトが継続的に追加されます。リストの中の各オブジェクトは、
     *note showwarning(): 498a. 関数の引数と同じ名前の属性を持っています
     。

     The 'module' argument takes a module that will be used instead of
     the module returned when you import ‘warnings’ whose filter will be
     protected.  This argument exists primarily for testing the
     ‘warnings’ module itself.

     If the 'action' argument is not ‘None’, the remaining arguments are
     passed to *note simplefilter(): 8d0. as if it were called
     immediately on entering the context.

     See *note 警告フィルタ: 1b1. for the meaning of the 'category' and
     'lineno' parameters.

          注釈: See *note Concurrent safety of Context Managers: 4996.
          for details on the concurrency-safety of the *note
          catch_warnings: 179. context manager when used in programs
          using multiple threads or async functions.

     バージョン 3.11 で変更: Added the 'action', 'category', 'lineno',
     and 'append' parameters.


File: python.info,  Node: Concurrent safety of Context Managers,  Prev: 利用可能なコンテキストマネージャー,  Up: warnings --- 警告の制御

5.29.6.12 Concurrent safety of Context Managers
...............................................

The behavior of *note catch_warnings: 179. context manager depends on
the *note sys.flags.context_aware_warnings: 18a. flag.  If the flag is
true, the context manager behaves in a concurrent-safe fashion and
otherwise not.  Concurrent-safe means that it is both thread-safe and
safe to use within *note asyncio coroutines: 37b8. and tasks.  Being
thread-safe means that behavior is predictable in a multi-threaded
program.  The flag defaults to true for free-threaded builds and false
otherwise.

If the *note context_aware_warnings: 18a. flag is false, then *note
catch_warnings: 179. will modify the global attributes of the ‘warnings’
module.  This is not safe if used within a concurrent program (using
multiple threads or using asyncio coroutines).  For example, if two or
more threads use the *note catch_warnings: 179. class at the same time,
the behavior is undefined.

If the flag is true, *note catch_warnings: 179. will not modify global
attributes and will instead use a *note ContextVar: 1875. to store the
newly established warning filtering state.  A context variable provides
thread-local storage and it makes the use of *note catch_warnings: 179.
thread-safe.

The 'record' parameter of the context handler also behaves differently
depending on the value of the flag.  When 'record' is true and the flag
is false, the context manager works by replacing and then later
restoring the module's *note showwarning(): 498a. function.  That is not
concurrent-safe.

When 'record' is true and the flag is true, the *note showwarning():
498a. function is not replaced.  Instead, the recording status is
indicated by an internal property in the context variable.  In this
case, the *note showwarning(): 498a. function will not be restored when
exiting the context handler.

The *note context_aware_warnings: 18a. flag can be set the *note -X
context_aware_warnings: 16f. command-line option or by the *note
PYTHON_CONTEXT_AWARE_WARNINGS: 185b. environment variable.

          注釈: It is likely that most programs that desire thread-safe
          behaviour of the warnings module will also want to set the
          *note thread_inherit_context: 175. flag to true.  That flag
          causes threads created by *note threading.Thread: 176. to
          start with a copy of the context variables from the thread
          starting it.  When true, the context established by *note
          catch_warnings: 179. in one thread will also apply to new
          threads started by it.  If false, new threads will start with
          an empty warnings context variable, meaning that any filtering
          that was established by a *note catch_warnings: 179. context
          manager will no longer be active.

バージョン 3.14 で変更: Added the *note
sys.flags.context_aware_warnings: 18a. flag and the use of a context
variable for *note catch_warnings: 179. if the flag is true.  Previous
versions of Python acted as if the flag was always set to false.


File: python.info,  Node: dataclasses --- データクラス,  Next: contextlib --- with 文コンテキスト用ユーティリティ,  Prev: warnings --- 警告の制御,  Up: Python ランタイムサービス

5.29.7 ‘dataclasses’ -- データクラス
------------------------------------

'ソースコード:' Lib/dataclasses.py(1)

__________________________________________________________________

このモジュールは、*note __init__(): 8bf. や *note __repr__(): 82f. のよ
うな *note 特殊メソッド: 1c60. を生成し、ユーザー定義のクラスに自動的に
追加するデコレーターや関数を提供します。このモジュールは元々、 PEP
557(2) で説明されていました。

これらの生成されたメソッドで利用されるメンバー変数は PEP 526(3) 型アノテ
ーションを用いて定義されます。例えば、このコードでは:

     from dataclasses import dataclass

     @dataclass
     class InventoryItem:
         """Class for keeping track of an item in inventory."""
         name: str
         unit_price: float
         quantity_on_hand: int = 0

         def total_cost(self) -> float:
             return self.unit_price * self.quantity_on_hand

とりわけ、以下のような ‘__init__()’ が追加されます:

     def __init__(self, name: str, unit_price: float, quantity_on_hand: int = 0):
         self.name = name
         self.unit_price = unit_price
         self.quantity_on_hand = quantity_on_hand

このメソッドは自動的にクラスに追加される点に留意して下さい。上記の
‘InventoryItem’ クラスの定義中にこのメソッドが直接明記されるわけではあり
ません。

Added in version 3.7.

* Menu:

* モジュールの内容: モジュールの内容<4>.
* 初期化後の処理::
* クラス変数::
* 初期化限定変数::
* 凍結されたインスタンス::
* 継承: 継承<2>.
* Re-ordering of keyword-only parameters in __init__(): Re-ordering of keyword-only parameters in __init__.
* デフォルトファクトリ関数::
* 可変なデフォルト値::
* Descriptor-typed fields::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/dataclasses.py

   (2) https://peps.python.org/pep-0557/

   (3) https://peps.python.org/pep-0526/


File: python.info,  Node: モジュールの内容<4>,  Next: 初期化後の処理,  Up: dataclasses --- データクラス

5.29.7.1 モジュールの内容
.........................

 -- の関数: @dataclasses.dataclass (*, init=True, repr=True, eq=True,
          order=False, unsafe_hash=False, frozen=False, match_args=True,
          kw_only=False, slots=False, weakref_slot=False)

     この関数は、後述する *note 特殊メソッド: 1c60. を生成し、クラスに追
     加する *note decorator: 93a. です。

     ‘@dataclass’ デコレータは、‘field’ を探すためにクラスを検査します。
     ‘field’ は *note 型アノテーション: f51. を持つクラス変数として定義
     されます。後述する２つの例外を除き、 ‘@dataclass’ は変数アノテーシ
     ョンで指定した型を検査しません。

     生成されるすべてのメソッドの中でのフィールドの順序は、それらのフィ
     ールドがクラス定義に現れた順序です。

     ‘@dataclass’ デコレータは、後述する様々な "ダンダー" メソッド (訳注
     ：dunderはdouble underscoreの略で、メソッド名の前後にアンダースコア
     が2つ付いているメソッド) をクラスに追加します。クラスに既にこれらの
     メソッドが存在する場合の動作は、後述する引数によって異なります。デ
     コレータは呼び出した際に指定したクラスと同じクラスを返します。新し
     いクラスは生成されません。

     If ‘@dataclass’ is used just as a simple decorator with no
     parameters, it acts as if it has the default values documented in
     this signature.  That is, these three uses of ‘@dataclass’ are
     equivalent:

          @dataclass
          class C:
              ...

          @dataclass()
          class C:
              ...

          @dataclass(init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False,
                     match_args=True, kw_only=False, slots=False, weakref_slot=False)
          class C:
              ...

     The parameters to ‘@dataclass’ are:

        - 'init': If true (the default), a *note __init__(): 8bf. method
          will be generated.

          If the class already defines ‘__init__()’, this parameter is
          ignored.

        - 'repr': If true (the default), a *note __repr__(): 82f. method
          will be generated.  The generated repr string will have the
          class name and the name and repr of each field, in the order
          they are defined in the class.  Fields that are marked as
          being excluded from the repr are not included.  For example:
          ‘InventoryItem(name='widget', unit_price=3.0,
          quantity_on_hand=10)’.

          If the class already defines ‘__repr__()’, this parameter is
          ignored.

        - 'eq': If true (the default), an *note __eq__(): cf2. method
          will be generated.  This method compares the class as if it
          were a tuple of its fields, in order.  Both instances in the
          comparison must be of the identical type.

          If the class already defines ‘__eq__()’, this parameter is
          ignored.

        - 'order': If true (the default is ‘False’), *note __lt__():
          14b8, *note __le__(): 1522, *note __gt__(): 1523, and *note
          __ge__(): 1524. methods will be generated.  These compare the
          class as if it were a tuple of its fields, in order.  Both
          instances in the comparison must be of the identical type.  If
          'order' is true and 'eq' is false, a *note ValueError: 2ec. is
          raised.

          If the class already defines any of ‘__lt__()’, ‘__le__()’,
          ‘__gt__()’, or ‘__ge__()’, then *note TypeError: 198. is
          raised.

        - 'unsafe_hash': If true, force ‘dataclasses’ to create a *note
          __hash__(): cf3. method, even though it may not be safe to do
          so.  Otherwise, generate a *note __hash__(): cf3. method
          according to how 'eq' and 'frozen' are set.  The default value
          is ‘False’.

          ‘__hash__()’ is used by built-in *note hash(): 801, and when
          objects are added to hashed collections such as dictionaries
          and sets.  Having a ‘__hash__()’ implies that instances of the
          class are immutable.  Mutability is a complicated property
          that depends on the programmer's intent, the existence and
          behavior of ‘__eq__()’, and the values of the 'eq' and
          'frozen' flags in the ‘@dataclass’ decorator.

          By default, ‘@dataclass’ will not implicitly add a *note
          __hash__(): cf3. method unless it is safe to do so.  Neither
          will it add or change an existing explicitly defined
          ‘__hash__()’ method.  Setting the class attribute ‘__hash__ =
          None’ has a specific meaning to Python, as described in the
          ‘__hash__()’ documentation.

          If ‘__hash__()’ is not explicitly defined, or if it is set to
          ‘None’, then ‘@dataclass’ 'may' add an implicit ‘__hash__()’
          method.  Although not recommended, you can force ‘@dataclass’
          to create a ‘__hash__()’ method with ‘unsafe_hash=True’.  This
          might be the case if your class is logically immutable but can
          still be mutated.  This is a specialized use case and should
          be considered carefully.

          Here are the rules governing implicit creation of a
          ‘__hash__()’ method.  Note that you cannot both have an
          explicit ‘__hash__()’ method in your dataclass and set
          ‘unsafe_hash=True’; this will result in a *note TypeError:
          198.

          If 'eq' and 'frozen' are both true, by default ‘@dataclass’
          will generate a ‘__hash__()’ method for you.  If 'eq' is true
          and 'frozen' is false, ‘__hash__()’ will be set to ‘None’,
          marking it unhashable (which it is, since it is mutable).  If
          'eq' is false, ‘__hash__()’ will be left untouched meaning the
          ‘__hash__()’ method of the superclass will be used (if the
          superclass is *note object: c7e, this means it will fall back
          to id-based hashing).

        - 'frozen': If true (the default is ‘False’), assigning to
          fields will generate an exception.  This emulates read-only
          frozen instances.  See the *note discussion: 49a2. below.

          If *note __setattr__(): 237c. or *note __delattr__(): 237d. is
          defined in the class and 'frozen' is true, then *note
          TypeError: 198. is raised.

        - 'match_args': If true (the default is ‘True’), the *note
          __match_args__: 1c75. tuple will be created from the list of
          non keyword-only parameters to the generated *note __init__():
          8bf. method (even if ‘__init__()’ is not generated, see
          above).  If false, or if ‘__match_args__’ is already defined
          in the class, then ‘__match_args__’ will not be generated.

          Added in version 3.10.

        - 'kw_only': If true (the default value is ‘False’), then all
          fields will be marked as keyword-only.  If a field is marked
          as keyword-only, then the only effect is that the *note
          __init__(): 8bf. parameter generated from a keyword-only field
          must be specified with a keyword when ‘__init__()’ is called.
          See the *note parameter: 234b. glossary entry for details.
          Also see the *note KW_ONLY: 49a3. section.

          Keyword-only fields are not included in ‘__match_args__’.

          Added in version 3.10.

        - 'slots': If true (the default is ‘False’), *note __slots__:
          1704. attribute will be generated and new class will be
          returned instead of the original one.  If ‘__slots__’ is
          already defined in the class, then *note TypeError: 198. is
          raised.

               警告: Passing parameters to a base class *note
               __init_subclass__(): 843. when using ‘slots=True’ will
               result in a *note TypeError: 198.  Either use
               ‘__init_subclass__’ with no parameters or use default
               values as a workaround.  See gh-91126(1) for full
               details.

          Added in version 3.10.

          バージョン 3.11 で変更: If a field name is already included in
          the ‘__slots__’ of a base class, it will not be included in
          the generated ‘__slots__’ to prevent *note overriding them:
          23ba.  Therefore, do not use ‘__slots__’ to retrieve the field
          names of a dataclass.  Use *note fields(): 1935. instead.  To
          be able to determine inherited slots, base class ‘__slots__’
          may be any iterable, but 'not' an iterator.

        - 'weakref_slot': If true (the default is ‘False’), add a slot
          named "__weakref__", which is required to make an instance
          *note weakref-able: 11f2.  It is an error to specify
          ‘weakref_slot=True’ without also specifying ‘slots=True’.

          Added in version 3.11.

     ‘フィールド’ には、通常の Python の文法でデフォルト値を指定できます
     。

          @dataclass
          class C:
              a: int       # 'a' has no default value
              b: int = 0   # assign a default value for 'b'

     In this example, both ‘a’ and ‘b’ will be included in the added
     *note __init__(): 8bf. method, which will be defined as:

          def __init__(self, a: int, b: int = 0):

     デフォルト値を指定しないフィールドを、デフォルト値を指定したフィー
     ルドの後ろに定義すると、 *note TypeError: 198. が送出されます。これ
     は、単一のクラスであっても、クラス継承の結果でも起きえます。

 -- の関数: dataclasses.field (*, default=MISSING,
          default_factory=MISSING, init=True, repr=True, hash=None,
          compare=True, metadata=None, kw_only=MISSING, doc=None)

     For common and simple use cases, no other functionality is
     required.  There are, however, some dataclass features that require
     additional per-field information.  To satisfy this need for
     additional information, you can replace the default field value
     with a call to the provided ‘field()’ function.  For example:

          @dataclass
          class C:
              mylist: list[int] = field(default_factory=list)

          c = C()
          c.mylist += [1, 2, 3]

     As shown above, the *note MISSING: 49a4. value is a sentinel object
     used to detect if some parameters are provided by the user.  This
     sentinel is used because ‘None’ is a valid value for some
     parameters with a distinct meaning.  No code should directly use
     the *note MISSING: 49a4. value.

     The parameters to ‘field()’ are:

        - 'default': If provided, this will be the default value for
          this field.  This is needed because the ‘field()’ call itself
          replaces the normal position of the default value.

        - 'default_factory': If provided, it must be a zero-argument
          callable that will be called when a default value is needed
          for this field.  Among other purposes, this can be used to
          specify fields with mutable default values, as discussed
          below.  It is an error to specify both 'default' and
          'default_factory'.

        - 'init': If true (the default), this field is included as a
          parameter to the generated *note __init__(): 8bf. method.

        - 'repr': If true (the default), this field is included in the
          string returned by the generated *note __repr__(): 82f.
          method.

        - 'hash': This can be a bool or ‘None’.  If true, this field is
          included in the generated *note __hash__(): cf3. method.  If
          false, this field is excluded from the generated *note
          __hash__(): cf3.  If ‘None’ (the default), use the value of
          'compare': this would normally be the expected behavior, since
          a field should be included in the hash if it's used for
          comparisons.  Setting this value to anything other than ‘None’
          is discouraged.

          フィールドのハッシュ値を計算するコストが高い場合に、
          ‘hash=False’ だが ‘compare=True’ と設定する理由が 1 つあるとす
          れば、フィールドが等価検査に必要かつ、その型のハッシュ値を計算
          するのに他のフィールドも使われることです。 フィールドがハッシ
          ュから除外されていたとしても、比較には使えます。

        - 'compare': If true (the default), this field is included in
          the generated equality and comparison methods (*note __eq__():
          cf2, *note __gt__(): 1523, et al.).

        - 'metadata': This can be a mapping or ‘None’.  ‘None’ is
          treated as an empty dict.  This value is wrapped in *note
          MappingProxyType(): 698. to make it read-only, and exposed on
          the *note Field: 195b. object.  It is not used at all by Data
          Classes, and is provided as a third-party extension mechanism.
          Multiple third-parties can each have their own key, to use as
          a namespace in the metadata.

        - 'kw_only': If true, this field will be marked as keyword-only.
          This is used when the generated *note __init__(): 8bf.
          method's parameters are computed.

          Keyword-only fields are also not included in ‘__match_args__’.

          Added in version 3.10.

        - 'doc': optional docstring for this field.

          Added in version 3.14.

     If the default value of a field is specified by a call to
     ‘field()’, then the class attribute for this field will be replaced
     by the specified 'default' value.  If 'default' is not provided,
     then the class attribute will be deleted.  The intent is that after
     the *note @dataclass: 4e1. decorator runs, the class attributes
     will all contain the default values for the fields, just as if the
     default value itself were specified.  For example, after:

          @dataclass
          class C:
              x: int
              y: int = field(repr=False)
              z: int = field(repr=False, default=10)
              t: int = 20

     The class attribute ‘C.z’ will be ‘10’, the class attribute ‘C.t’
     will be ‘20’, and the class attributes ‘C.x’ and ‘C.y’ will not be
     set.

 -- クラス: dataclasses.Field

     ‘Field’ objects describe each defined field.  These objects are
     created internally, and are returned by the *note fields(): 1935.
     module-level method (see below).  Users should never instantiate a
     ‘Field’ object directly.  Its documented attributes are:

        - ‘name’: The name of the field.

        - ‘type’: The type of the field.

        - ‘default’, ‘default_factory’, ‘init’, ‘repr’, ‘hash’,
          ‘compare’, ‘metadata’, and ‘kw_only’ have the identical
          meaning and values as they do in the *note field(): 195a.
          function.

     他の属性があることもありますが、それらはプライベートであり、調べた
     り、依存したりしてはなりません。

 -- クラス: dataclasses.InitVar

     ‘InitVar[T]’ type annotations describe variables that are *note
     init-only: 49a5.  Fields annotated with ‘InitVar’ are considered
     pseudo-fields, and thus are neither returned by the *note fields():
     1935. function nor used in any way except adding them as parameters
     to *note __init__(): 8bf. and an optional *note __post_init__():
     49a6.

 -- の関数: dataclasses.fields (class_or_instance)

     このデータクラスのフィールドを定義する *note Field: 195b. オブジェ
     クトをタプルで返します。 データクラスあるいはデータクラスのインスタ
     ンスを受け付けます。 データクラスやデータクラスのインスタンスが渡さ
     れなかった場合は、 *note TypeError: 198. を送出します。 ‘ClassVar’
     や ‘InitVar’ といった疑似フィールドは返しません。

 -- の関数: dataclasses.asdict (obj, *, dict_factory=dict)

     Converts the dataclass 'obj' to a dict (by using the factory
     function 'dict_factory').  Each dataclass is converted to a dict of
     its fields, as ‘name: value’ pairs.  dataclasses, dicts, lists, and
     tuples are recursed into.  Other objects are copied with *note
     copy.deepcopy(): d65.

     Example of using ‘asdict()’ on nested dataclasses:

          @dataclass
          class Point:
               x: int
               y: int

          @dataclass
          class C:
               mylist: list[Point]

          p = Point(10, 20)
          assert asdict(p) == {'x': 10, 'y': 20}

          c = C([Point(0, 0), Point(10, 4)])
          assert asdict(c) == {'mylist': [{'x': 0, 'y': 0}, {'x': 10, 'y': 4}]}

     To create a shallow copy, the following workaround may be used:

          {field.name: getattr(obj, field.name) for field in fields(obj)}

     ‘asdict()’ raises *note TypeError: 198. if 'obj' is not a dataclass
     instance.

 -- の関数: dataclasses.astuple (obj, *, tuple_factory=tuple)

     Converts the dataclass 'obj' to a tuple (by using the factory
     function 'tuple_factory').  Each dataclass is converted to a tuple
     of its field values.  dataclasses, dicts, lists, and tuples are
     recursed into.  Other objects are copied with *note
     copy.deepcopy(): d65.

     1つ前の例の続きです:

          assert astuple(p) == (10, 20)
          assert astuple(c) == ([(0, 0), (10, 4)],)

     To create a shallow copy, the following workaround may be used:

          tuple(getattr(obj, field.name) for field in dataclasses.fields(obj))

     ‘astuple()’ raises *note TypeError: 198. if 'obj' is not a
     dataclass instance.

 -- の関数: dataclasses.make_dataclass (cls_name, fields, *, bases=(),
          namespace=None, init=True, repr=True, eq=True, order=False,
          unsafe_hash=False, frozen=False, match_args=True,
          kw_only=False, slots=False, weakref_slot=False, module=None,
          decorator=dataclass)

     Creates a new dataclass with name 'cls_name', fields as defined in
     'fields', base classes as given in 'bases', and initialized with a
     namespace as given in 'namespace'.  'fields' is an iterable whose
     elements are each either ‘name’, ‘(name, type)’, or ‘(name, type,
     Field)’.  If just ‘name’ is supplied, *note typing.Any: 8bb. is
     used for ‘type’.  The values of 'init', 'repr', 'eq', 'order',
     'unsafe_hash', 'frozen', 'match_args', 'kw_only', 'slots', and
     'weakref_slot' have the same meaning as they do in *note
     @dataclass: 4e1.

     If 'module' is defined, the ‘__module__’ attribute of the dataclass
     is set to that value.  By default, it is set to the module name of
     the caller.

     The 'decorator' parameter is a callable that will be used to create
     the dataclass.  It should take the class object as a first argument
     and the same keyword arguments as *note @dataclass: 4e1.  By
     default, the *note @dataclass: 4e1. function is used.

     This function is not strictly required, because any Python
     mechanism for creating a new class with *note __annotations__: 458.
     can then apply the *note @dataclass: 4e1. function to convert that
     class to a dataclass.  This function is provided as a convenience.
     For example:

          C = make_dataclass('C',
                             [('x', int),
                               'y',
                              ('z', int, field(default=5))],
                             namespace={'add_one': lambda self: self.x + 1})

     は、次のコードと等しいです:

          @dataclass
          class C:
              x: int
              y: 'typing.Any'
              z: int = 5

              def add_one(self):
                  return self.x + 1

     Added in version 3.14: Added the 'decorator' parameter.

 -- の関数: dataclasses.replace (obj, /, **changes)

     Creates a new object of the same type as 'obj', replacing fields
     with values from 'changes'.  If 'obj' is not a Data Class, raises
     *note TypeError: 198.  If keys in 'changes' are not field names of
     the given dataclass, raises *note TypeError: 198.

     The newly returned object is created by calling the *note
     __init__(): 8bf. method of the dataclass.  This ensures that *note
     __post_init__(): 49a6, if present, is also called.

     Init-only variables without default values, if any exist, must be
     specified on the call to ‘replace()’ so that they can be passed to
     ‘__init__()’ and *note __post_init__(): 49a6.

     It is an error for 'changes' to contain any fields that are defined
     as having ‘init=False’.  A *note ValueError: 2ec. will be raised in
     this case.

     Be forewarned about how ‘init=False’ fields work during a call to
     ‘replace()’.  They are not copied from the source object, but
     rather are initialized in *note __post_init__(): 49a6, if they're
     initialized at all.  It is expected that ‘init=False’ fields will
     be rarely and judiciously used.  If they are used, it might be wise
     to have alternate class constructors, or perhaps a custom
     ‘replace()’ (or similarly named) method which handles instance
     copying.

     Dataclass instances are also supported by generic function *note
     copy.replace(): 1c0.

 -- の関数: dataclasses.is_dataclass (obj)

     Return ‘True’ if its parameter is a dataclass (including subclasses
     of a dataclass) or an instance of one, otherwise return ‘False’.

     引数がデータクラスのインスタンスである (そして、データクラスそのも
     のではない) かどうかを知る必要がある場合は、 ‘not isinstance(obj,
     type)’ で追加のチェックをしてください:

          def is_dataclass_instance(obj):
              return is_dataclass(obj) and not isinstance(obj, type)

 -- データ: dataclasses.MISSING

     デフォルト値やdefault_factoryが設定されてない場合の番兵の値を設定し
     ます。

 -- データ: dataclasses.KW_ONLY

     A sentinel value used as a type annotation.  Any fields after a
     pseudo-field with the type of ‘KW_ONLY’ are marked as keyword-only
     fields.  Note that a pseudo-field of type ‘KW_ONLY’ is otherwise
     completely ignored.  This includes the name of such a field.  By
     convention, a name of ‘_’ is used for a ‘KW_ONLY’ field.
     Keyword-only fields signify *note __init__(): 8bf. parameters that
     must be specified as keywords when the class is instantiated.

     このサンプルでは ‘y’ と ‘z’ がキーワード専用フィールドとなります:

          @dataclass
          class Point:
              x: float
              _: KW_ONLY
              y: float
              z: float

          p = Point(0, y=1.5, z=2.0)

     In a single dataclass, it is an error to specify more than one
     field whose type is ‘KW_ONLY’.

     Added in version 3.10.

 -- 例外: dataclasses.FrozenInstanceError

     ‘frozen=True’ 付きで定義されたデータクラスで、暗黙的に定義された
     *note __setattr__(): 237c. または *note __delattr__(): 237d. が呼び
     出されたときに送出されます。これは *note AttributeError: 5f0. のサ
     ブクラスです。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/91126


File: python.info,  Node: 初期化後の処理,  Next: クラス変数,  Prev: モジュールの内容<4>,  Up: dataclasses --- データクラス

5.29.7.2 初期化後の処理
.......................

 -- の関数: dataclasses.__post_init__ ()

     When defined on the class, it will be called by the generated *note
     __init__(): 8bf, normally as ‘self.__post_init__()’.  However, if
     any ‘InitVar’ fields are defined, they will also be passed to
     ‘__post_init__()’ in the order they were defined in the class.  If
     no ‘__init__()’ method is generated, then ‘__post_init__()’ will
     not automatically be called.

     他の機能と組み合わせることで、他の 1 つ以上のフィールドに依存してい
     るフィールドが初期化できます。 例えば次のようにできます:

          @dataclass
          class C:
              a: float
              b: float
              c: float = field(init=False)

              def __post_init__(self):
                  self.c = self.a + self.b

The *note __init__(): 8bf. method generated by *note @dataclass: 4e1.
does not call base class ‘__init__()’ methods.  If the base class has an
‘__init__()’ method that has to be called, it is common to call this
method in a *note __post_init__(): 49a6. method:

     class Rectangle:
         def __init__(self, height, width):
             self.height = height
             self.width = width

     @dataclass
     class Square(Rectangle):
         side: float

         def __post_init__(self):
             super().__init__(self.side, self.side)

Note, however, that in general the dataclass-generated ‘__init__()’
methods don't need to be called, since the derived dataclass will take
care of initializing all fields of any base class that is a dataclass
itself.

下にある初期化限定変数についての節で、 ‘__post_init__()’ にパラメータを
渡す方法を参照してください。 *note replace(): 1a6a. が ‘init=False’ であ
るフィールドをどう取り扱うかについての警告も参照してください。


File: python.info,  Node: クラス変数,  Next: 初期化限定変数,  Prev: 初期化後の処理,  Up: dataclasses --- データクラス

5.29.7.3 クラス変数
...................

One of the few places where *note @dataclass: 4e1. actually inspects the
type of a field is to determine if a field is a class variable as
defined in PEP 526(1).  It does this by checking if the type of the
field is *note typing.ClassVar: 56d.  If a field is a ‘ClassVar’, it is
excluded from consideration as a field and is ignored by the dataclass
mechanisms.  Such ‘ClassVar’ pseudo-fields are not returned by the
module-level *note fields(): 1935. function.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0526/


File: python.info,  Node: 初期化限定変数,  Next: 凍結されたインスタンス,  Prev: クラス変数,  Up: dataclasses --- データクラス

5.29.7.4 初期化限定変数
.......................

Another place where *note @dataclass: 4e1. inspects a type annotation is
to determine if a field is an init-only variable.  It does this by
seeing if the type of a field is of type *note InitVar: 1bb4.  If a
field is an *note InitVar: 1bb4, it is considered a pseudo-field called
an init-only field.  As it is not a true field, it is not returned by
the module-level *note fields(): 1935. function.  Init-only fields are
added as parameters to the generated *note __init__(): 8bf. method, and
are passed to the optional *note __post_init__(): 49a6. method.  They
are not otherwise used by dataclasses.

例えば、あるフィールドがデータベースから初期化されると仮定して、クラスを
作成するときには値が与えられない次の場合を考えます:

     @dataclass
     class C:
         i: int
         j: int | None = None
         database: InitVar[DatabaseType | None] = None

         def __post_init__(self, database):
             if self.j is None and database is not None:
                 self.j = database.lookup('j')

     c = C(10, database=my_database)

In this case, *note fields(): 1935. will return *note Field: 195b.
objects for ‘i’ and ‘j’, but not for ‘database’.


File: python.info,  Node: 凍結されたインスタンス,  Next: 継承<2>,  Prev: 初期化限定変数,  Up: dataclasses --- データクラス

5.29.7.5 凍結されたインスタンス
...............................

It is not possible to create truly immutable Python objects.  However,
by passing ‘frozen=True’ to the *note @dataclass: 4e1. decorator you can
emulate immutability.  In that case, dataclasses will add *note
__setattr__(): 237c. and *note __delattr__(): 237d. methods to the
class.  These methods will raise a *note FrozenInstanceError: 49a7. when
invoked.

There is a tiny performance penalty when using ‘frozen=True’: *note
__init__(): 8bf. cannot use simple assignment to initialize fields, and
must use ‘object.__setattr__()’.


File: python.info,  Node: 継承<2>,  Next: Re-ordering of keyword-only parameters in __init__,  Prev: 凍結されたインスタンス,  Up: dataclasses --- データクラス

5.29.7.6 継承
.............

When the dataclass is being created by the *note @dataclass: 4e1.
decorator, it looks through all of the class's base classes in reverse
MRO (that is, starting at *note object: c7e.) and, for each dataclass
that it finds, adds the fields from that base class to an ordered
mapping of fields.  After all of the base class fields are added, it
adds its own fields to the ordered mapping.  All of the generated
methods will use this combined, calculated ordered mapping of fields.
Because the fields are in insertion order, derived classes override base
classes.  An example:

     @dataclass
     class Base:
         x: Any = 15.0
         y: int = 0

     @dataclass
     class C(Base):
         z: int = 10
         x: int = 15

The final list of fields is, in order, ‘x’, ‘y’, ‘z’.  The final type of
‘x’ is *note int: 19b, as specified in class ‘C’.

The generated *note __init__(): 8bf. method for ‘C’ will look like:

     def __init__(self, x: int = 15, y: int = 0, z: int = 10):


File: python.info,  Node: Re-ordering of keyword-only parameters in __init__,  Next: デフォルトファクトリ関数,  Prev: 継承<2>,  Up: dataclasses --- データクラス

5.29.7.7 Re-ordering of keyword-only parameters in ‘__init__()’
...............................................................

*note __init__(): 8bf. で必要なパラメータが算出されると、キーワード専用
引数は他の一般的な（非キーワード専用）パラメータの後に移動します。これは
、すべてのキーワード専用引数は、非キーワード専用パラメータの末尾にこなけ
ればならないという、キーワード専用パラメータのPythonの実装の都合で必要な
ことです。

In this example, ‘Base.y’, ‘Base.w’, and ‘D.t’ are keyword-only fields,
and ‘Base.x’ and ‘D.z’ are regular fields:

     @dataclass
     class Base:
         x: Any = 15.0
         _: KW_ONLY
         y: int = 0
         w: int = 1

     @dataclass
     class D(Base):
         z: int = 10
         t: int = field(kw_only=True, default=0)

The generated ‘__init__()’ method for ‘D’ will look like:

     def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: int = 0):

パラメータは、フィールドのリストの表示方法によって並べ替えられます。通常
のフィールドから派生したパラメータの後に、キーワードのみのフィールドから
派生したパラメータが続きます。

The relative ordering of keyword-only parameters is maintained in the
re-ordered ‘__init__()’ parameter list.


File: python.info,  Node: デフォルトファクトリ関数,  Next: 可変なデフォルト値,  Prev: Re-ordering of keyword-only parameters in __init__,  Up: dataclasses --- データクラス

5.29.7.8 デフォルトファクトリ関数
.................................

If a *note field(): 195a. specifies a 'default_factory', it is called
with zero arguments when a default value for the field is needed.  For
example, to create a new instance of a list, use:

     mylist: list = field(default_factory=list)

If a field is excluded from *note __init__(): 8bf. (using ‘init=False’)
and the field also specifies 'default_factory', then the default factory
function will always be called from the generated ‘__init__()’ function.
This happens because there is no other way to give the field an initial
value.


File: python.info,  Node: 可変なデフォルト値,  Next: Descriptor-typed fields,  Prev: デフォルトファクトリ関数,  Up: dataclasses --- データクラス

5.29.7.9 可変なデフォルト値
...........................

Python はメンバ変数のデフォルト値をクラス属性に保持します。 データクラス
を使っていない、この例を考えてみましょう:

     class C:
         x = []
         def add(self, element):
             self.x.append(element)

     o1 = C()
     o2 = C()
     o1.add(1)
     o2.add(2)
     assert o1.x == [1, 2]
     assert o1.x is o2.x

Note that the two instances of class ‘C’ share the same class variable
‘x’, as expected.

データクラスを使っているこのコードが 'もし仮に' 有効なものだとしたら:

     @dataclass
     class D:
         x: list = []      # This code raises ValueError
         def add(self, element):
             self.x.append(element)

データクラスは次のようなコードを生成するでしょう:

     class D:
         x = []
         def __init__(self, x=x):
             self.x = x
         def add(self, element):
             self.x.append(element)

     assert D().x is D().x

This has the same issue as the original example using class ‘C’.  That
is, two instances of class ‘D’ that do not specify a value for ‘x’ when
creating a class instance will share the same copy of ‘x’.  Because
dataclasses just use normal Python class creation they also share this
behavior.  There is no general way for Data Classes to detect this
condition.  Instead, the *note @dataclass: 4e1. decorator will raise a
*note ValueError: 2ec. if it detects an unhashable default parameter.
The assumption is that if a value is unhashable, it is mutable.  This is
a partial solution, but it does protect against many common errors.

デフォルトファクトリ関数を使うのが、フィールドのデフォルト値として可変な
型の新しいインスタンスを作成する手段です:

     @dataclass
     class D:
         x: list = field(default_factory=list)

     assert D().x is not D().x

バージョン 3.11 で変更: Instead of looking for and disallowing objects
of type *note list: 24d, *note dict: 183, or *note set: 184, unhashable
objects are now not allowed as default values.  Unhashability is used to
approximate mutability.


File: python.info,  Node: Descriptor-typed fields,  Prev: 可変なデフォルト値,  Up: dataclasses --- データクラス

5.29.7.10 Descriptor-typed fields
.................................

Fields that are assigned *note descriptor objects: e49. as their default
value have the following special behaviors:

   * The value for the field passed to the dataclass's *note __init__():
     8bf. method is passed to the descriptor's *note __set__(): 23b5.
     method rather than overwriting the descriptor object.

   * Similarly, when getting or setting the field, the descriptor's
     *note __get__(): 1701. or ‘__set__()’ method is called rather than
     returning or overwriting the descriptor object.

   * To determine whether a field contains a default value, *note
     @dataclass: 4e1. will call the descriptor's ‘__get__()’ method
     using its class access form: ‘descriptor.__get__(obj=None,
     type=cls)’.  If the descriptor returns a value in this case, it
     will be used as the field's default.  On the other hand, if the
     descriptor raises *note AttributeError: 5f0. in this situation, no
     default value will be provided for the field.

     class IntConversionDescriptor:
         def __init__(self, *, default):
             self._default = default

         def __set_name__(self, owner, name):
             self._name = "_" + name

         def __get__(self, obj, type):
             if obj is None:
                 return self._default

             return getattr(obj, self._name, self._default)

         def __set__(self, obj, value):
             setattr(obj, self._name, int(value))

     @dataclass
     class InventoryItem:
         quantity_on_hand: IntConversionDescriptor = IntConversionDescriptor(default=100)

     i = InventoryItem()
     print(i.quantity_on_hand)   # 100
     i.quantity_on_hand = 2.5    # calls __set__ with 2.5
     print(i.quantity_on_hand)   # 2

Note that if a field is annotated with a descriptor type, but is not
assigned a descriptor object as its default value, the field will act
like a normal field.


File: python.info,  Node: contextlib --- with 文コンテキスト用ユーティリティ,  Next: abc --- 抽象基底クラス,  Prev: dataclasses --- データクラス,  Up: Python ランタイムサービス

5.29.8 ‘contextlib’ -- ‘with’ 文コンテキスト用ユーティリティ
------------------------------------------------------------

'ソースコード:' Lib/contextlib.py(1)

__________________________________________________________________

このモジュールは *note with: 186. 文に関わる一般的なタスクのためのユーテ
ィリティを提供します。詳しい情報は、 *note コンテキストマネージャ型:
240d. と *note with文とコンテキストマネージャ: 240b. を参照してください
。

* Menu:

* ユーティリティ::
* 例とレシピ: 例とレシピ<3>.
* 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/contextlib.py


File: python.info,  Node: ユーティリティ,  Next: 例とレシピ<3>,  Up: contextlib --- with 文コンテキスト用ユーティリティ

5.29.8.1 ユーティリティ
.......................

以下の関数とクラスを提供しています:

 -- クラス: contextlib.AbstractContextManager

     *note object.__enter__(): 7e4. と *note object.__exit__(): 1518. の
     2つのメソッドを実装した抽象基底クラス (*note abstract base class:
     13ce.) です。 *note object.__enter__(): 7e4. は ‘self’ を返すデフォ
     ルトの実装が提供されるいっぽう、 *note object.__exit__(): 1518. は
     デフォルトで ‘None’ を返す抽象メソッドです。 *note
     コンテキストマネージャ型: 240d. の定義も参照してください。

     Added in version 3.6.

 -- クラス: contextlib.AbstractAsyncContextManager

     *note object.__aenter__(): 241d. と *note object.__aexit__(): 19a1.
     の2つのメソッドを実装するクラスのための抽象基底クラス (*note
     abstract base class: 13ce.) です。 *note object.__aenter__(): 241d.
     は ‘self’ を返すデフォルト実装が提供されるいっぽう、 *note
     object.__aexit__(): 19a1. はデフォルトで ‘None’ を返す抽象メソッド
     です。 *note 非同期コンテキストマネージャ (Asynchronous Context
     Manager): 812. の定義も参照してください。

     Added in version 3.7.

 -- の関数: @contextlib.contextmanager

     この関数は *note with: 186. 文コンテキストマネージャのファクトリ関
     数を定義するために利用できる *note デコレータ: 93a. です。新しいク
     ラスや *note __enter__(): 7e4. と *note __exit__(): 1518. メソッド
     を別々に定義しなくても、ファクトリ関数を定義することができます。

     While many objects natively support use in with statements,
     sometimes a resource needs to be managed that isn't a context
     manager in its own right, and doesn't implement a ‘close()’ method
     for use with ‘contextlib.closing’.

     リソースを正しく管理するよう保証する抽象的な例は以下のようなもので
     しょう:

          from contextlib import contextmanager

          @contextmanager
          def managed_resource(*args, **kwds):
              # Code to acquire resource, e.g.:
              resource = acquire_resource(*args, **kwds)
              try:
                  yield resource
              finally:
                  # Code to release resource, e.g.:
                  release_resource(resource)

     このとき、関数は次のように使うことができます:

          >>> with managed_resource(timeout=3600) as resource:
          ...     # Resource is released at the end of this block,
          ...     # even if code in the block raises an exception

     デコレート対象の関数は呼び出されたときに *note ジェネレータ:
     126c.-イテレータを返す必要があります。このイテレータは必ず値を1つ
     yield しなければなりません。 *note with: 186. 文の ‘as’ 節が存在す
     るなら、その値は as 節のターゲットへ束縛されることになります。

     ジェネレータが yield を実行した箇所で *note with: 186. 文のネストさ
     れたブロックが実行されます。ブロックから抜けた後でジェネレータは再
     開されます。ブロック内で処理されない例外が発生した場合は、ジェネレ
     ータ内部の yield を実行した箇所で例外が再送出されます。なので、(も
     しあれば) エラーを捕捉したり、クリーンアップ処理を確実に実行したり
     するために、*note try: 8f8...*note except: 1ab...*note finally:
     1b0. 構文を使用できます。例外を捕捉する目的が、(完全に例外を抑制し
     てしまうのではなく) 単に例外のログをとるため、もしくはあるアクショ
     ンを実行するためなら、ジェネレータはその例外を再送出しなければなり
     ません。例外を再送出しない場合、ジェネレータのコンテキストマネージ
     ャは ‘with’ 文に対して例外が処理されたことを示し、‘with’ 文の直後の
     文から実行を再開します。

     *note contextmanager(): 141b. は *note ContextDecorator: 141a. を使
     っているので、 *note contextmanager(): 141b. で作ったコンテキストマ
     ネージャは *note with: 186. 文だけでなくデコレータとしても利用でき
     ます。デコレーターとして利用された場合、新しい generator インスタン
     スが関数呼び出しのたびに暗黙に生成されます (このことによって、
     *note contextmanager(): 141b. によって作られたなにがしか「単発」コ
     ンテキストマネージャを、コンテキストマネージャがデコレータとして使
     われるためには多重に呼び出されることをサポートする必要がある、とい
     う要件に合致させることが出来ます。)

     バージョン 3.2 で変更: *note ContextDecorator: 141a. の使用。

 -- の関数: @contextlib.asynccontextmanager

     *note contextmanager(): 141b. と似ていますが、 *note
     非同期コンテキストマネージャ (asynchronous context manager): 812. を
     生成します。

     この関数は *note async with: 185. 文のための非同期コンテキストマネ
     ージャのファクトリ関数を定義するために利用できるデコレータ (*note
     decorator: 93a.) です。新しいクラスや *note __aenter__(): 241d. と
     *note __aexit__(): 19a1. メソッドを個別に定義する必要はありません。
     このデコレータは非同期ジェネレータ (*note asynchronous generator:
     249b.) 関数に適用しなければなりません。

     簡単な例:

          from contextlib import asynccontextmanager

          @asynccontextmanager
          async def get_connection():
              conn = await acquire_db_connection()
              try:
                  yield conn
              finally:
                  await release_db_connection(conn)

          async def get_all_users():
              async with get_connection() as conn:
                  return conn.query('SELECT ...')

     Added in version 3.7.

     *note asynccontextmanager(): d1f. とともに定義されたコンテキストマ
     ネージャは、デコレータとして使うことも *note async with: 185. 文と
     組み合わせて使うこともできます:

          import time
          from contextlib import asynccontextmanager

          @asynccontextmanager
          async def timeit():
              now = time.monotonic()
              try:
                  yield
              finally:
                  print(f'it took {time.monotonic() - now}s to run')

          @timeit()
          async def main():
              # ... async code ...

     デコレータとして使われた場合は、各関数呼び出しに対して暗黙のうちに
     新しいジェネレータインスタンスが生成されます。これにより、 *note
     asynccontextmanager(): d1f. で生成された単回使用のコンテキストマネ
     ージャが複数回呼び出し可能となり、コンテキストマネージャをデコレー
     タとして使うことができるための要件を満たすようにすることができます
     。

     バージョン 3.10 で変更: *note asynccontextmanager(): d1f. により生
     成された非同期コンテキストマネージャをデコレータとして使うことがで
     きるようになりました。

 -- の関数: contextlib.closing (thing)

     ブロックの完了時に 'thing' を close するコンテキストマネージャを返
     します。これは基本的に以下と等価です:

          from contextlib import contextmanager

          @contextmanager
          def closing(thing):
              try:
                  yield thing
              finally:
                  thing.close()

     そして、明示的に ‘page’ を close する必要なしに、次のように書くこと
     ができます:

          from contextlib import closing
          from urllib.request import urlopen

          with closing(urlopen('https://www.python.org')) as page:
              for line in page:
                  print(line)

     ‘page’ を明示的に close する必要は無く、エラーが発生した場合でも、
     *note with: 186. ブロックを出るときに ‘page.close()’ が呼ばれます。

          注釈: Most types managing resources support the *note context
          manager: 1e1. protocol, which closes 'thing' on leaving the
          *note with: 186. statement.  As such, ‘closing()’ is most
          useful for third party types that don't support context
          managers.  This example is purely for illustration purposes,
          as *note urlopen(): 307. would normally be used in a context
          manager.

 -- の関数: contextlib.aclosing (thing)

     ブロックの完了時に 'thing' の ‘aclose()’ メソッドを呼び出すような非
     同期コンテキストマネージャを返します。これは基本的に以下と等価です:

          from contextlib import asynccontextmanager

          @asynccontextmanager
          async def aclosing(thing):
              try:
                  yield thing
              finally:
                  await thing.aclose()

     重要なことは、たとえば次の例のように *note break: 17f. や例外によっ
     て早期にブロックが終了した場合に、 ‘aclosing()’ は非同期ジェネレー
     タの決定論的なクリーンアップをサポートすることです:

          from contextlib import aclosing

          async with aclosing(my_generator()) as values:
              async for value in values:
                  if value == 42:
                      break

     このパターンは、ジェネレータの非同期な終了のコードがイテレーション
     処理と同じコンテキストの中で実行されることを保証します (すなわち例
     外とコンテキスト変数は期待通りに動作し、またジェネレータが依存する
     タスクの寿命が尽きたあとに終了のコードが実行されることもありません
     )。

     Added in version 3.10.

 -- の関数: contextlib.nullcontext (enter_result=None)

     'enter_result' を ‘__enter__’ メソッドが返すだけで、その他は何もし
     ないコンテキストマネージャを返します。たとえば以下のように、ある機
     能を持った別のコンテキストマネージャに対する、選択可能な代役として
     使われることが意図されています:

          def myfunction(arg, ignore_exceptions=False):
              if ignore_exceptions:
                  # Use suppress to ignore all exceptions.
                  cm = contextlib.suppress(Exception)
              else:
                  # Do not ignore any exceptions, cm has no effect.
                  cm = contextlib.nullcontext()
              with cm:
                  # Do something

     'enter_result' を使った例です:

          def process_file(file_or_path):
              if isinstance(file_or_path, str):
                  # If string, open file
                  cm = open(file_or_path)
              else:
                  # Caller is responsible for closing file
                  cm = nullcontext(file_or_path)

              with cm as file:
                  # Perform processing on the file

     *note 非同期コンテキストマネージャ: 812. の代役として使うこともでき
     ます:

          async def send_http(session=None):
              if not session:
                  # If no http session, create it with aiohttp
                  cm = aiohttp.ClientSession()
              else:
                  # Caller is responsible for closing the session
                  cm = nullcontext(session)

              async with cm as session:
                  # Send http requests with session

     Added in version 3.7.

     バージョン 3.10 で変更: 非同期コンテキストマネージャ (*note
     asynchronous context manager: 7f0.) のサポートが追加されました。

 -- の関数: contextlib.suppress (*exceptions)

     ‘with’ 文の内部で指定された例外の発生を抑えるコンテキストマネージャ
     を返します。 ‘with’ 文の後に続く最初の文から処理が再開されます。

     ほかの完全に例外を抑制するメカニズム同様、このコンテキストマネージ
     ャは、黙ってプログラム実行を続けることが正しいことであるとわかって
     いる、非常に限定的なエラーをカバーする以上の使い方はしてはいけませ
     ん。

     例えば:

          from contextlib import suppress

          with suppress(FileNotFoundError):
              os.remove('somefile.tmp')

          with suppress(FileNotFoundError):
              os.remove('someotherfile.tmp')

     これは以下と等価です:

          try:
              os.remove('somefile.tmp')
          except FileNotFoundError:
              pass

          try:
              os.remove('someotherfile.tmp')
          except FileNotFoundError:
              pass

     このコンテキストマネージャは *note 再入可能(リエントラント): 49b9.
     です。

     If the code within the ‘with’ block raises a *note
     BaseExceptionGroup: 566, suppressed exceptions are removed from the
     group.  Any exceptions of the group which are not suppressed are
     re-raised in a new group which is created using the original
     group's *note derive(): 1a37. method.

     Added in version 3.4.

     バージョン 3.12 で変更: ‘suppress’ now supports suppressing
     exceptions raised as part of a *note BaseExceptionGroup: 566.

 -- の関数: contextlib.redirect_stdout (new_target)

     *note sys.stdout: ccd. を一時的に別のファイルまたは file-like オブ
     ジェクトにリダイレクトするコンテキストマネージャです。

     このツールは、出力先が標準出力 (stdout) に固定されている既存の関数
     やクラスに出力先の柔軟性を追加します。

     たとえば、 *note help(): ad4. の出力は通常標準出力 ('sys.stdout') に
     送られます。出力される文字列を *note io.StringIO: 112a. オブジェク
     トにリダイレクトすることによって捕捉することができます。代替の出力
     ストリームは ‘__enter__’ メソッドによって返されるので、 *note with:
     186. 文のターゲットとして利用可能です:

          with redirect_stdout(io.StringIO()) as f:
              help(pow)
          s = f.getvalue()

     *note help(): ad4. の出力をディスク上のファイルに送るためには、出力
     を通常のファイルにリダイレクトします:

          with open('help.txt', 'w') as f:
              with redirect_stdout(f):
                  help(pow)

     *note help(): ad4. の出力を標準エラー出力 ('sys.stderr') に送るには
     以下のようにします:

          with redirect_stdout(sys.stderr):
              help(pow)

     *note sys.stdout: ccd. のシステム全体にわたる副作用により、このコン
     テキストマネージャはライブラリコードやマルチスレッドアプリケーショ
     ンでの使用には適していません。また、サブプロセスの出力に対しても効
     果がありません。そのような制限はありますが、それでも多くのユーティ
     リティスクリプトに対して有用なアプローチです。

     このコンテキストマネージャは *note 再入可能(リエントラント): 49b9.
     です。

     Added in version 3.4.

 -- の関数: contextlib.redirect_stderr (new_target)

     *note redirect_stdout(): fe7. と同じですが、標準エラー出力 (*note
     sys.stderr: b33.) を別のファイルや file-like オブジェクトにリダイレ
     クトします。

     このコンテキストマネージャは *note 再入可能(リエントラント): 49b9.
     です。

     Added in version 3.5.

 -- の関数: contextlib.chdir (path)

     現在の作業ディレクトリを変更するパラレル非安全なコンテキストマネー
     ジャです。グローバルな状態である作業ディレクトリを変更するため、ほ
     とんどのマルチスレッドまたは非同期のコンテキストに対する利用は適切
     ではありません。また、プログラムの実行権限を一時的に放棄するジェネ
     レータのような、直線的でないコードを実行する場合も適切ではありませ
     ん - 明確に必要でないかぎり、このコンテキストマネージャがアクティブ
     な状態で yield すべきではありません。

     これは *note chdir(): 821. の単純なラッパーで、コンテキストに入ると
     きに現在の作業ディレクトリを変更し、終了時に元の作業ディレクトリを
     復元します。

     このコンテキストマネージャは *note 再入可能(リエントラント): 49b9.
     です。

     Added in version 3.11.

 -- クラス: contextlib.ContextDecorator

     コンテキストマネージャをデコレータとしても使用できるようにする基底
     クラスです。

     ‘ContextDecorator’ から継承したコンテキストマネージャは、通常のコン
     テキストマネージャーと同じく ‘__enter__’ および ‘__exit__’ を実装す
     る必要があります。‘__exit__’ はデコレータとして使用された場合でも例
     外をオプションの引数として受け取ります。

     *note contextmanager(): 141b. は ‘ContextDecorator’ を利用している
     ので、自動的にデコレーターとしても利用できるようになります。

     ‘ContextDecorator’ の例:

          from contextlib import ContextDecorator

          class mycontext(ContextDecorator):
              def __enter__(self):
                  print('Starting')
                  return self

              def __exit__(self, *exc):
                  print('Finishing')
                  return False

     このとき、クラスは次のように使うことができます:

          >>> @mycontext()
          ... def function():
          ...     print('The bit in the middle')
          ...
          >>> function()
          Starting
          The bit in the middle
          Finishing

          >>> with mycontext():
          ...     print('The bit in the middle')
          ...
          Starting
          The bit in the middle
          Finishing

     これは次のような形のコードに対するシンタックスシュガーになります:

          def f():
              with cm():
                  # Do stuff

     ‘ContextDecorator’ を使うと代わりに次のように書けます:

          @cm()
          def f():
              # Do stuff

     デコレーターを使うと、‘cm’ が関数の一部ではなく全体に適用されている
     ことが明確になります (インデントレベルを1つ節約できるのもメリットで
     す)。

     すでに基底クラスを持っているコンテキストマネージャーも、
     ‘ContextDecorator’ を mixin クラスとして利用することで拡張できます:

          from contextlib import ContextDecorator

          class mycontext(ContextBaseClass, ContextDecorator):
              def __enter__(self):
                  return self

              def __exit__(self, *exc):
                  return False

          注釈: デコレートされた関数が複数回呼び出せるように、内部のコン
          テキストマネージャーは複数の *note with: 186. 文に対応する必要
          があります。そうでないなら、明示的な ‘with’ 文を関数内で利用す
          るべきです。

     Added in version 3.2.

 -- クラス: contextlib.AsyncContextDecorator

     *note ContextDecorator: 141a. と同じですが、非同期関数専用のクラス
     です。

     ‘AsyncContextDecorator’ の使用例:

          from asyncio import run
          from contextlib import AsyncContextDecorator

          class mycontext(AsyncContextDecorator):
              async def __aenter__(self):
                  print('Starting')
                  return self

              async def __aexit__(self, *exc):
                  print('Finishing')
                  return False

     このとき、クラスは次のように使うことができます:

          >>> @mycontext()
          ... async def function():
          ...     print('The bit in the middle')
          ...
          >>> run(function())
          Starting
          The bit in the middle
          Finishing

          >>> async def function():
          ...    async with mycontext():
          ...         print('The bit in the middle')
          ...
          >>> run(function())
          Starting
          The bit in the middle
          Finishing

     Added in version 3.10.

 -- クラス: contextlib.ExitStack

     他の、特にオプションであったり入力に依存するようなコンテキストマネ
     ージャーやクリーンアップ関数を動的に組み合わせるためのコンテキスト
     マネージャーです。

     例えば、複数のファイルを1つの with 文で簡単に扱うことができます:

          with ExitStack() as stack:
              files = [stack.enter_context(open(fname)) for fname in filenames]
              # All opened files will automatically be closed at the end of
              # the with statement, even if attempts to open files later
              # in the list raise an exception

     The *note __enter__(): 7e4. method returns the *note ExitStack:
     d1e. instance, and performs no additional operations.

     各インスタンスは登録されたコールバックのスタックを管理し、インスタ
     ンスが (明示的に、あるいは *note with: 186. 文の終わりに暗黙的に)
     close されるときに逆順でそれを呼び出します。コンテキストスタックの
     インスタンスが暗黙的にガベージコレクトされたときには callback は呼
     び出され 'ません' 。

     このスタックモデルは、(file オブジェクトのように) ‘__init__’ メソッ
     ドでリソースを確保するコンテキストマネージャーを正しく扱うためのも
     のです。

     登録されたコールバックが登録の逆順で実行されるので、複数のネストさ
     れた *note with: 186. 文を利用するのと同じ振る舞いをします。これは
     例外処理にも適用されます。内側のコールバックが例外を抑制したり置き
     換えたりした場合、外側のコールバックには更新された状態に応じた引数
     が渡されます。

     これは正しく exit callback の stack を巻き戻すための、比較的低レベ
     ルな API です。アプリケーション独自のより高レベルなコンテキストマネ
     ージャーを作るための基板として使うのに適しています。

     Added in version 3.3.

      -- メソッド: enter_context (cm)

          Enters a new context manager and adds its *note __exit__():
          1518. method to the callback stack.  The return value is the
          result of the context manager's own *note __enter__(): 7e4.
          method.

          コンテキストマネージャーは、普段 *note with: 186. 文で利用され
          た時と同じように、例外を抑制することができます。

          バージョン 3.11 で変更: 'cm' がコンテキストマネージャでなかっ
          た場合、 *note AttributeError: 5f0. の代わりに *note
          TypeError: 198. 例外を送出します。

      -- メソッド: push (exit)

          Adds a context manager's *note __exit__(): 1518. method to the
          callback stack.

          As ‘__enter__’ is 'not' invoked, this method can be used to
          cover part of an *note __enter__(): 7e4. implementation with a
          context manager's own *note __exit__(): 1518. method.

          If passed an object that is not a context manager, this method
          assumes it is a callback with the same signature as a context
          manager's *note __exit__(): 1518. method and adds it directly
          to the callback stack.

          By returning true values, these callbacks can suppress
          exceptions the same way context manager *note __exit__():
          1518. methods can.

          この関数はデコレータとしても使えるように、受け取ったオブジェク
          トをそのまま返します。

      -- メソッド: callback (callback, /, *args, **kwds)

          任意の関数と引数を受け取り、コールバックスタックに追加します。

          他のメソッドと異なり、このメソッドで追加されたコールバックは例
          外を抑制しません (例外の詳細も渡されません)。

          この関数はデコレータとしても使えるように、受け取った callback
          をそのまま返します。

      -- メソッド: pop_all ()

          コールバックスタックを新しい *note ExitStack: d1e. インスタン
          スに移して、それを返します。このメソッドは callback を実行しま
          せん。代わりに、新しい stack が (明示的に、あるいは *note
          with: 186. 文の終わりに暗黙的に) close されるときに実行されま
          す。

          例えば、複数のファイルを "all or nothing" に開く処理を次のよう
          に書けます:

               with ExitStack() as stack:
                   files = [stack.enter_context(open(fname)) for fname in filenames]
                   # Hold onto the close method, but don't call it yet.
                   close_files = stack.pop_all().close
                   # If opening any file fails, all previously opened files will be
                   # closed automatically. If all files are opened successfully,
                   # they will remain open even after the with statement ends.
                   # close_files() can then be invoked explicitly to close them all.

      -- メソッド: close ()

          すぐにコールバックスタックを巻き戻し、コールバック関数を登録の
          逆順に呼び出します。登録されたすべてのコンテキストマネージャー
          と終了 callback に、例外が起こらなかった場合の引数が渡されます
          。

 -- クラス: contextlib.AsyncExitStack

     *note ExitStack: d1e. に似た *note 非同期コンテキストマネージャ:
     812. です。スタック上で同期と非同期の両方のコンテキストマネージャの
     組み合わせをサポートします。また、後処理のためのコルーチンも持って
     います。

     The *note close(): 49bc. method is not implemented; *note aclose():
     49bd. must be used instead.

      -- メソッド: async enter_async_context (cm)

          Similar to *note ExitStack.enter_context(): 7ee. but expects
          an asynchronous context manager.

          バージョン 3.11 で変更: 'cm' が非同期コンテキストマネージャで
          なかった場合、 *note AttributeError: 5f0. の代わりに *note
          TypeError: 198. 例外を送出します。

      -- メソッド: push_async_exit (exit)

          Similar to *note ExitStack.push(): 49ba. but expects either an
          asynchronous context manager or a coroutine function.

      -- メソッド: push_async_callback (callback, /, *args, **kwds)

          Similar to *note ExitStack.callback(): c76. but expects a
          coroutine function.

      -- メソッド: async aclose ()

          Similar to *note ExitStack.close(): 49bc. but properly handles
          awaitables.

     *note asynccontextmanager(): d1f. の使用例の続きです:

          async with AsyncExitStack() as stack:
              connections = [await stack.enter_async_context(get_connection())
                  for i in range(5)]
              # All opened connections will automatically be released at the end of
              # the async with statement, even if attempts to open a connection
              # later in the list raise an exception.

     Added in version 3.7.


File: python.info,  Node: 例とレシピ<3>,  Next: 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ,  Prev: ユーティリティ,  Up: contextlib --- with 文コンテキスト用ユーティリティ

5.29.8.2 例とレシピ
...................

This section describes some examples and recipes for making effective
use of the tools provided by ‘contextlib’.

* Menu:

* 可変数個のコンテキストマネージャーをサポートする::
* __enter__ メソッドからの例外をキャッチする::
* __enter__ 実装内のクリーンアップ::
* try-finally + flag 変数パターンを置き換える::
* コンテキストマネージャーを関数デコレーターとして使う::


File: python.info,  Node: 可変数個のコンテキストマネージャーをサポートする,  Next: __enter__ メソッドからの例外をキャッチする,  Up: 例とレシピ<3>

5.29.8.3 可変数個のコンテキストマネージャーをサポートする
.........................................................

*note ExitStack: d1e. の第一のユースケースは、クラスのドキュメントにかか
れている通り、一つの *note with: 186. 文で可変数個のコンテキストマネージ
ャーや他のクリーンアップ関数をサポートすることです。ユーザーの入力 (指定
された複数個のファイルを開く場合など) に応じて複数個のコンテキストマネー
ジャーが必要となる場合や、いくつかのコンテキストマネージャーがオプション
となる場合に、可変数個のコンテキストマネージャーが必要になります:

     with ExitStack() as stack:
         for resource in resources:
             stack.enter_context(resource)
         if need_special_resource():
             special = acquire_special_resource()
             stack.callback(release_special_resource, special)
         # Perform operations that use the acquired resources

上の例にあるように、 *note ExitStack: d1e. はコンテキストマネージャープ
ロトコルをサポートしていないリソースの管理を *note with: 186. 文を使って
簡単に行えるようにします。


File: python.info,  Node: __enter__ メソッドからの例外をキャッチする,  Next: __enter__ 実装内のクリーンアップ,  Prev: 可変数個のコンテキストマネージャーをサポートする,  Up: 例とレシピ<3>

5.29.8.4 ‘__enter__’ メソッドからの例外をキャッチする
.....................................................

稀に、 ‘__enter__’ メソッドからの例外を、 *note with: 186. 文の body や
コンテキストマネージャーの ‘__exit__’ メソッドからの例外は間違えて捕まえ
ないように、 catch したい場合があります。 *note ExitStack: d1e. を使って
、コンテキストマネージャープロトコル内のステップを分離することができます
:

     stack = ExitStack()
     try:
         x = stack.enter_context(cm)
     except Exception:
         # handle __enter__ exception
     else:
         with stack:
             # Handle normal case

実際のところ、このようなコードが必要になるのならば、利用している API 側
で *note try: 8f8./*note except: 1ab./*note finally: 1b0. 文を使った直接
的なリソース管理インターフェースを提供するべきです。しかし、すべての API
がそのようによく設計されているとは限りません。もしコンテキストマネージャ
ーが提供されている唯一のリソース管理APIであるなら、 *note ExitStack:
d1e. を使って *note with: 186. 文を使って処理することができない様々なシ
チュエーションの処理をすることができます。


File: python.info,  Node: __enter__ 実装内のクリーンアップ,  Next: try-finally + flag 変数パターンを置き換える,  Prev: __enter__ メソッドからの例外をキャッチする,  Up: 例とレシピ<3>

5.29.8.5 ‘__enter__’ 実装内のクリーンアップ
...........................................

As noted in the documentation of *note ExitStack.push(): 49ba, this
method can be useful in cleaning up an already allocated resource if
later steps in the *note __enter__(): 7e4. implementation fail.

次の例では、リソースの確保と開放の関数に加えて、オプションのバリデーショ
ン関数を受け取るコンテキストマネージャーで、この方法を使ってコンテキスト
マネージャープロトコルを提供しています:

     from contextlib import contextmanager, AbstractContextManager, ExitStack

     class ResourceManager(AbstractContextManager):

         def __init__(self, acquire_resource, release_resource, check_resource_ok=None):
             self.acquire_resource = acquire_resource
             self.release_resource = release_resource
             if check_resource_ok is None:
                 def check_resource_ok(resource):
                     return True
             self.check_resource_ok = check_resource_ok

         @contextmanager
         def _cleanup_on_error(self):
             with ExitStack() as stack:
                 stack.push(self)
                 yield
                 # The validation check passed and didn't raise an exception
                 # Accordingly, we want to keep the resource, and pass it
                 # back to our caller
                 stack.pop_all()

         def __enter__(self):
             resource = self.acquire_resource()
             with self._cleanup_on_error():
                 if not self.check_resource_ok(resource):
                     msg = "Failed validation for {!r}"
                     raise RuntimeError(msg.format(resource))
             return resource

         def __exit__(self, *exc_details):
             # We don't need to duplicate any of our resource release logic
             self.release_resource()


File: python.info,  Node: try-finally + flag 変数パターンを置き換える,  Next: コンテキストマネージャーを関数デコレーターとして使う,  Prev: __enter__ 実装内のクリーンアップ,  Up: 例とレシピ<3>

5.29.8.6 ‘try-finally’ + flag 変数パターンを置き換える
......................................................

‘try-finally’ 文に、‘finally’ 句の内容を実行するかどうかを示すフラグ変数
を組み合わせたパターンを目にすることがあるかもしれません。一番シンプルな
(単に ‘except’ 句を使うだけでは処理できない) ケースでは次のようなコード
になります:

     cleanup_needed = True
     try:
         result = perform_operation()
         if result:
             cleanup_needed = False
     finally:
         if cleanup_needed:
             cleanup_resources()

‘try’ 文を使ったコードでは、セットアップとクリーンアップのコードが任意の
長さのコードで分離してしまうので、開発者やレビューアにとって問題になりえ
ます。

*note ExitStack: d1e. を使えば、代わりに ‘with’ 文の終わりに実行されるコ
ールバックを登録し、後でそのコールバックをスキップするかどうかを決定でき
ます:

     from contextlib import ExitStack

     with ExitStack() as stack:
         stack.callback(cleanup_resources)
         result = perform_operation()
         if result:
             stack.pop_all()

This allows the intended cleanup behaviour to be made explicit up front,
rather than requiring a separate flag variable.

もしあるアプリケーションがこのパターンを多用するのであれば、小さいヘルパ
ークラスを導入してよりシンプルにすることができます:

     from contextlib import ExitStack

     class Callback(ExitStack):
         def __init__(self, callback, /, *args, **kwds):
             super().__init__()
             self.callback(callback, *args, **kwds)

         def cancel(self):
             self.pop_all()

     with Callback(cleanup_resources) as cb:
         result = perform_operation()
         if result:
             cb.cancel()

もしリソースのクリーンアップが単体の関数にまとまってない場合でも、 *note
ExitStack.callback(): c76. のデコレーター形式を利用してリソース開放処理
を宣言することができます:

     from contextlib import ExitStack

     with ExitStack() as stack:
         @stack.callback
         def cleanup_resources():
             ...
         result = perform_operation()
         if result:
             stack.pop_all()

デコレータープロトコルの使用上、このように宣言されたコールバック関数は引
数を取ることができません。その代わりに、リリースするリソースをクロージャ
ー変数としてアクセスできる必要があります。


File: python.info,  Node: コンテキストマネージャーを関数デコレーターとして使う,  Prev: try-finally + flag 変数パターンを置き換える,  Up: 例とレシピ<3>

5.29.8.7 コンテキストマネージャーを関数デコレーターとして使う
.............................................................

*note ContextDecorator: 141a. はコンテキストマネージャーを通常の ‘with’
文に加えて関数デコレーターとしても利用できるようにします。

例えば、関数やまとまった文を、そこに入った時と出た時の時間をトラックする
ロガーでラップしたい場合があります。そのために関数デコレーターとコンテキ
ストマネージャーを別々に書く代わりに、 *note ContextDecorator: 141a. を
継承すると1つの定義で両方の機能を提供できます:

     from contextlib import ContextDecorator
     import logging

     logging.basicConfig(level=logging.INFO)

     class track_entry_and_exit(ContextDecorator):
         def __init__(self, name):
             self.name = name

         def __enter__(self):
             logging.info('Entering: %s', self.name)

         def __exit__(self, exc_type, exc, exc_tb):
             logging.info('Exiting: %s', self.name)

このクラスのインスタンスはコンテキストマネージャーとしても利用でき:

     with track_entry_and_exit('widget loader'):
         print('Some time consuming activity goes here')
         load_widget()

また関数デコレーターとしても利用できます:

     @track_entry_and_exit('widget loader')
     def activity():
         print('Some time consuming activity goes here')
         load_widget()

Note that there is one additional limitation when using context managers
as function decorators: there's no way to access the return value of
*note __enter__(): 7e4.  If that value is needed, then it is still
necessary to use an explicit ‘with’ statement.

参考
....

PEP 343(1) - "with" ステートメント

     Python の *note with: 186. 文の仕様、背景、および例が記載されていま
     す。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0343/


File: python.info,  Node: 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ,  Prev: 例とレシピ<3>,  Up: contextlib --- with 文コンテキスト用ユーティリティ

5.29.8.8 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ
...........................................................................

ほとんどのコンテキストマネージャは、 *note with: 186. 文の中で一度だけ使
われるような場合に効果的になるように書かれています。これら単回使用のコン
テキストマネージャは毎回新規に生成されなければなりません - それらを再利
用しようとすると、例外を引き起こすか、正しく動作しません。

この共通の制限が意味することは、コンテキストマネージャは (上記すべての使
用例に示すとおり) 一般に *note with: 186. 文のヘッダ部分で直接生成するこ
とが推奨されるということです。

ファイルオブジェクトは単回使用のコンテキストマネージャ有効に利用した例で
す。最初の *note with: 186. 文によりファイルがクローズされ、それ以降その
ファイルオブジェクトに対するすべての IO 操作を防止します。

*note contextmanager(): 141b. により生成されたコンテキストマネージャも単
回使用のコンテキスト マネージャです。二回目に使おうとした場合、内部にあ
るジェネレータが値の生成に失敗したと訴えるでしょう:

     >>> from contextlib import contextmanager
     >>> @contextmanager
     ... def singleuse():
     ...     print("Before")
     ...     yield
     ...     print("After")
     ...
     >>> cm = singleuse()
     >>> with cm:
     ...     pass
     ...
     Before
     After
     >>> with cm:
     ...     pass
     ...
     Traceback (most recent call last):
         ...
     RuntimeError: generator didn't yield

* Menu:

* リエントラントなコンテキストマネージャ::
* 再利用可能なコンテキストマネージャ::


File: python.info,  Node: リエントラントなコンテキストマネージャ,  Next: 再利用可能なコンテキストマネージャ,  Up: 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ

5.29.8.9 リエントラントなコンテキストマネージャ
...............................................

より洗練されたコンテキストマネージャには"リエントラント"なものがあります
。そのようなコンテキストマネージャは、複数の *note with: 186. 文で使える
だけでなく、同じコンテキストマネージャをすでに使っている ‘with’ 文の '内
部' でも使うことができます。

*note threading.RLock: 32e. はリエントラントなコンテキストマネージャの例
であり、また *note suppress(): 1129, *note redirect_stdout(): fe7, そし
て *note chdir(): 820. もリエントラントです。以下はリエントラントな利用
法の非常に単純な例です:

     >>> from contextlib import redirect_stdout
     >>> from io import StringIO
     >>> stream = StringIO()
     >>> write_to_stream = redirect_stdout(stream)
     >>> with write_to_stream:
     ...     print("This is written to the stream rather than stdout")
     ...     with write_to_stream:
     ...         print("This is also written to the stream")
     ...
     >>> print("This is written directly to stdout")
     This is written directly to stdout
     >>> print(stream.getvalue())
     This is written to the stream rather than stdout
     This is also written to the stream

リエントラントな性質の実例はお互いを呼び出しあう複数の関数を含んでいる可
能性が高く、したがってこの例よりもはるかに複雑です。

リエントラントであることはスレッドセーフであることと同じ 'ではない' こと
には注意が必要です。たとえば *note redirect_stdout(): fe7. は、 *note
sys.stdout: ccd. を異なるストリームに束縛することによりシステムの状態に
対してグローバルな変更を行うことから、明らかにスレッドセーフではありませ
ん。


File: python.info,  Node: 再利用可能なコンテキストマネージャ,  Prev: リエントラントなコンテキストマネージャ,  Up: 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ

5.29.8.10 再利用可能なコンテキストマネージャ
............................................

単回使用のコンテキストマネージャとリエントラントなコンテキストマネージャ
のいずれとも異なるタイプに "再利用可能" なコンテキストマネージャがありま
す (あるいは、より明確には、"再利用可能だがリエントラントでない" コンテ
キストマネージャです。リエントラントなコンテキストマネージャもまた再利用
可能だからです)。再利用可能なコンテキストマネージャは複数回利用をサポー
トしますが、同じコンテキストマネージャのインスタンスがすでに with 文で使
われている場合には失敗します (もしくは正しく動作しません)。

*note threading.Lock: 19f4. は再利用可能だがリエントラントでないコンテキ
ストマネージャの例です (リエントラントなロックのためには *note
threading.RLock: 32e. を代わりに使う必要があります)。

再利用可能だがリエントラントでないコンテキストマネージャのもうひとつの例
は *note ExitStack: d1e. です。これは現在登録されている '全ての' コール
バック関数を、どこで登録されたかにかかわらず、呼び出します:

     >>> from contextlib import ExitStack
     >>> stack = ExitStack()
     >>> with stack:
     ...     stack.callback(print, "Callback: from first context")
     ...     print("Leaving first context")
     ...
     Leaving first context
     Callback: from first context
     >>> with stack:
     ...     stack.callback(print, "Callback: from second context")
     ...     print("Leaving second context")
     ...
     Leaving second context
     Callback: from second context
     >>> with stack:
     ...     stack.callback(print, "Callback: from outer context")
     ...     with stack:
     ...         stack.callback(print, "Callback: from inner context")
     ...         print("Leaving inner context")
     ...     print("Leaving outer context")
     ...
     Leaving inner context
     Callback: from inner context
     Callback: from outer context
     Leaving outer context

例における出力が示すように、ひとつのスタックオブジェクトを複数の with 文
で再利用しても正しく動作します。しかし入れ子にして使った場合は、一番内側
の with 文を抜ける際にスタックが空になります。これは望ましい動作とは思え
ません。

ひとつの *note ExitStack: d1e. インスタンスを再利用する代わりに複数のイ
ンスタンスを使うことにより、この問題は回避することができます:

     >>> from contextlib import ExitStack
     >>> with ExitStack() as outer_stack:
     ...     outer_stack.callback(print, "Callback: from outer context")
     ...     with ExitStack() as inner_stack:
     ...         inner_stack.callback(print, "Callback: from inner context")
     ...         print("Leaving inner context")
     ...     print("Leaving outer context")
     ...
     Leaving inner context
     Callback: from inner context
     Leaving outer context
     Callback: from outer context


File: python.info,  Node: abc --- 抽象基底クラス,  Next: atexit --- 終了ハンドラー,  Prev: contextlib --- with 文コンテキスト用ユーティリティ,  Up: Python ランタイムサービス

5.29.9 ‘abc’ -- 抽象基底クラス
------------------------------

'ソースコード:' Lib/abc.py(1)

__________________________________________________________________

このモジュールは Python に PEP 3119(2) で概要が示された *note
抽象基底クラス: 13ce. (ABC) を定義する基盤を提供します。なぜこれが
Python に付け加えられたかについてはその PEP を参照してください。 (ABC に
基づいた数の型階層を扱った PEP 3141(3) と *note numbers: a2. モジュール
も参照してください。)

*note collections: 1e. モジュール には、抽象基底クラス から派生するいく
つかの具象クラスがある。もちろん、これらはさらに派生させることができる。
さらに、‘collections.抽象基底クラス’ サブモジュールには、クラスやインス
タンス が特定のインターフェース 、たとえば 、:term:>>'<<hashable'である
か、:term:>>'<<mapping'であるかをテストするために使用できる抽象基底クラ
ス があります。

このモジュールは、 抽象基底クラスを定義するためのメタクラス *note
ABCMeta: 111c. と、 継承を利用して抽象基底クラスを代替的に定義するヘルパ
ークラス *note ABC: 111b. を提供します。

 -- クラス: abc.ABC

     メタクラスとして *note ABCMeta: 111c. を持つヘルパークラスです。こ
     のクラスを使うことで、‘ABC’ を継承するだけで抽象基底クラスを作成で
     き、しばしば混乱しがちなメタクラスの使用を避けることができます。例
     えば:

          from abc import ABC

          class MyABC(ABC):
              pass

     Note that the type of ‘ABC’ is still *note ABCMeta: 111c, therefore
     inheriting from ‘ABC’ requires the usual precautions regarding
     metaclass usage, as multiple inheritance may lead to metaclass
     conflicts.  One may also define an abstract base class by passing
     the metaclass keyword and using ‘ABCMeta’ directly, for example:

          from abc import ABCMeta

          class MyABC(metaclass=ABCMeta):
              pass

     Added in version 3.4.

 -- クラス: abc.ABCMeta

     抽象基底クラス(ABC)を定義するためのメタクラス。

     ABC を作るときにこのメタクラスを使います。ABC は直接的にサブクラス
     化することができ、ミックスイン(mix-in)クラスのように振る舞います。
     また、無関係な具象クラス(組み込み型でも構いません)と無関係な ABC を
     "仮想的サブクラス" として登録できます - これらとその子孫は組み込み
     関数 *note issubclass(): 9c4. によって登録した ABC のサブクラスと判
     定されますが、登録した ABC は MRO (Method Resolution Order, メソッ
     ド解決順)には現れませんし、この ABC のメソッド実装が(*note super():
     1a6. を通してだけでなく)呼び出し可能になるわけでもありません。 (4)

     Classes created with a metaclass of ‘ABCMeta’ have the following
     method:

      -- メソッド: register (subclass)

          'subclass' を "仮想的サブクラス" としてこの ABC に登録します。
          たとえば:

               from abc import ABC

               class MyABC(ABC):
                   pass

               MyABC.register(tuple)

               assert issubclass(tuple, MyABC)
               assert isinstance((), MyABC)

          バージョン 3.3 で変更: クラスデコレータとして使うことができる
          ように、登録されたサブクラスを返します。

          バージョン 3.4 で変更: To detect calls to ‘register()’, you
          can use the *note get_cache_token(): 111a. function.

     また、次のメソッドを抽象基底クラスの中でオーバーライドできます:

      -- メソッド: __subclasshook__ (subclass)

          (クラスメソッドとして定義しなければなりません。)

          Check whether 'subclass' is considered a subclass of this ABC.
          This means that you can customize the behavior of *note
          issubclass(): 9c4. further without the need to call *note
          register(): 129a. on every class you want to consider a
          subclass of the ABC. (This class method is called from the
          *note __subclasscheck__(): 23c7. method of the ABC.)

          This method should return ‘True’, ‘False’ or *note
          NotImplemented: 1a2.  If it returns ‘True’, the 'subclass' is
          considered a subclass of this ABC. If it returns ‘False’, the
          'subclass' is not considered a subclass of this ABC, even if
          it would normally be one.  If it returns ‘NotImplemented’, the
          subclass check is continued with the usual mechanism.

     この概念のデモとして、次の ABC 定義の例を見てください:

          class Foo:
              def __getitem__(self, index):
                  ...
              def __len__(self):
                  ...
              def get_iterator(self):
                  return iter(self)

          class MyIterable(ABC):

              @abstractmethod
              def __iter__(self):
                  while False:
                      yield None

              def get_iterator(self):
                  return self.__iter__()

              @classmethod
              def __subclasshook__(cls, C):
                  if cls is MyIterable:
                      if any("__iter__" in B.__dict__ for B in C.__mro__):
                          return True
                  return NotImplemented

          MyIterable.register(Foo)

     The ABC ‘MyIterable’ defines the standard iterable method, *note
     __iter__(): e69, as an abstract method.  The implementation given
     here can still be called from subclasses.  The ‘get_iterator()’
     method is also part of the ‘MyIterable’ abstract base class, but it
     does not have to be overridden in non-abstract derived classes.

     The *note __subclasshook__(): 299a. class method defined here says
     that any class that has an *note __iter__(): e69. method in its
     *note __dict__: 77d. (or in that of one of its base classes,
     accessed via the *note __mro__: 2378. list) is considered a
     ‘MyIterable’ too.

     Finally, the last line makes ‘Foo’ a virtual subclass of
     ‘MyIterable’, even though it does not define an *note __iter__():
     e69. method (it uses the old-style iterable protocol, defined in
     terms of *note __len__(): 178f. and *note __getitem__(): 588.).
     Note that this will not make ‘get_iterator’ available as a method
     of ‘Foo’, so it is provided separately.

The ‘abc’ module also provides the following decorator:

 -- の関数: @abc.abstractmethod

     抽象メソッドを示すデコレータです。

     Using this decorator requires that the class's metaclass is *note
     ABCMeta: 111c. or is derived from it.  A class that has a metaclass
     derived from ‘ABCMeta’ cannot be instantiated unless all of its
     abstract methods and properties are overridden.  The abstract
     methods can be called using any of the normal 'super' call
     mechanisms.  ‘abstractmethod()’ may be used to declare abstract
     methods for properties and descriptors.

     Dynamically adding abstract methods to a class, or attempting to
     modify the abstraction status of a method or class once it is
     created, are only supported using the *note
     update_abstractmethods(): 49cc. function.  The ‘abstractmethod()’
     only affects subclasses derived using regular inheritance; "virtual
     subclasses" registered with the ABC's *note register(): 129a.
     method are not affected.

     When ‘abstractmethod()’ is applied in combination with other method
     descriptors, it should be applied as the innermost decorator, as
     shown in the following usage examples:

          class C(ABC):
              @abstractmethod
              def my_abstract_method(self, arg1):
                  ...
              @classmethod
              @abstractmethod
              def my_abstract_classmethod(cls, arg2):
                  ...
              @staticmethod
              @abstractmethod
              def my_abstract_staticmethod(arg3):
                  ...

              @property
              @abstractmethod
              def my_abstract_property(self):
                  ...
              @my_abstract_property.setter
              @abstractmethod
              def my_abstract_property(self, val):
                  ...

              @abstractmethod
              def _get_x(self):
                  ...
              @abstractmethod
              def _set_x(self, val):
                  ...
              x = property(_get_x, _set_x)

     In order to correctly interoperate with the abstract base class
     machinery, the descriptor must identify itself as abstract using
     ‘__isabstractmethod__’.  In general, this attribute should be
     ‘True’ if any of the methods used to compose the descriptor are
     abstract.  For example, Python's built-in *note property: 4b3. does
     the equivalent of:

          class Descriptor:
              ...
              @property
              def __isabstractmethod__(self):
                  return any(getattr(f, '__isabstractmethod__', False) for
                             f in (self._fget, self._fset, self._fdel))

          注釈: Java の抽象メソッドと違い、これらの抽象メソッドは実装を
          持ち得ます。この実装は *note super(): 1a6. メカニズムを通して
          それをオーバーライドしたクラスから呼び出すことができます。これ
          は協調的多重継承を使ったフレームワークにおいて super 呼び出し
          の終点として有効です。

The ‘abc’ module also supports the following legacy decorators:

 -- の関数: @abc.abstractclassmethod

     Added in version 3.2.

     バージョン 3.3 で非推奨: *note classmethod: 48e. を *note
     abstractmethod(): 1297. と一緒に使えるようになったため、このデコレ
     ータは冗長になりました。

     組み込みの *note classmethod(): 48e. のサブクラスで、抽象クラスメソ
     ッドであることを示します。それ以外は *note abstractmethod(): 1297.
     と同じです。

     この特殊ケースは *note classmethod(): 48e. デコレータが抽象メソッド
     に適用された場合に抽象的だと正しく認識されるようになったため撤廃さ
     れます:

          class C(ABC):
              @classmethod
              @abstractmethod
              def my_abstract_classmethod(cls, arg):
                  ...

 -- の関数: @abc.abstractstaticmethod

     Added in version 3.2.

     バージョン 3.3 で非推奨: *note staticmethod: 453. を *note
     abstractmethod(): 1297. と一緒に使えるようになったため、このデコレ
     ータは冗長になりました。

     組み込みの *note staticmethod(): 453. のサブクラスで、抽象静的メソ
     ッドであることを示します。それ以外は *note abstractmethod(): 1297.
     と同じです。

     この特殊ケースは *note staticmethod(): 453. デコレータが抽象メソッ
     ドに適用された場合に抽象的だと正しく認識されるようになったため撤廃
     されます:

          class C(ABC):
              @staticmethod
              @abstractmethod
              def my_abstract_staticmethod(arg):
                  ...

 -- の関数: @abc.abstractproperty

     バージョン 3.3 で非推奨: *note property: 4b3. 、 *note
     property.getter(): 19d9. 、 *note property.setter(): 19da. および
     *note property.deleter(): 19db. を *note abstractmethod(): 1297. と
     一緒に使えるようになったため、このデコレータは冗長になりました。

     組み込みの *note property(): 4b3. のサブクラスで、抽象プロパティで
     あることを示します。

     この特殊ケースは *note property(): 4b3. デコレータが抽象メソッドに
     適用された場合に抽象的だと正しく認識されるようになったため撤廃され
     ます:

          class C(ABC):
              @property
              @abstractmethod
              def my_abstract_property(self):
                  ...

     この例は読み出し専用のプロパティを定義しています。プロパティを構成
     するメソッドの1つ以上を abstract にすることで、読み書きできる抽象プ
     ロパティを定義することができます:

          class C(ABC):
              @property
              def x(self):
                  ...

              @x.setter
              @abstractmethod
              def x(self, val):
                  ...

     構成するメソッド全てが abstract でない場合、abstract と定義されたメ
     ソッドのみが、具象サブクラスによってオーバーライドする必要がありま
     す:

          class D(C):
              @C.x.setter
              def x(self, val):
                  ...

The ‘abc’ module also provides the following functions:

 -- の関数: abc.get_cache_token ()

     現在の抽象基底クラスのキャッシュトークンを返します。

     このトークンは、仮想サブクラスのための抽象基底クラスの現在のバージ
     ョンを特定する (等価性検査をサポートしている) 不透明なオブジェクト
     です。 任意のABCでの *note ABCMeta.register(): 129a. の呼び出しごと
     に、トークンは変更されます。

     Added in version 3.4.

 -- の関数: abc.update_abstractmethods (cls)

     A function to recalculate an abstract class's abstraction status.
     This function should be called if a class's abstract methods have
     been implemented or changed after it was created.  Usually, this
     function should be called from within a class decorator.

     Returns 'cls', to allow usage as a class decorator.

     If 'cls' is not an instance of *note ABCMeta: 111c, does nothing.

          注釈: This function assumes that 'cls"s superclasses are
          already updated.  It does not update any subclasses.

     Added in version 3.10.

脚注
....

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/abc.py

   (2) https://peps.python.org/pep-3119/

   (3) https://peps.python.org/pep-3141/

   (4) C++ プログラマは Python の仮想的基底クラスの概念は C++ のものと同
じではないということを銘記すべきです。


File: python.info,  Node: atexit --- 終了ハンドラー,  Next: traceback --- スタックトレースの表示または取得,  Prev: abc --- 抽象基底クラス,  Up: Python ランタイムサービス

5.29.10 ‘atexit’ -- 終了ハンドラー
----------------------------------

__________________________________________________________________

The ‘atexit’ module defines functions to register and unregister cleanup
functions.  Functions thus registered are automatically executed upon
normal interpreter termination.  ‘atexit’ runs these functions in the
'reverse' order in which they were registered; if you register ‘A’, ‘B’,
and ‘C’, at interpreter termination time they will be run in the order
‘C’, ‘B’, ‘A’.

'注意:' このモジュールを使用して登録された関数は、プログラムが Python が
扱わないシグナルによって kill された場合、Python 内部で致命的なエラーが
検出された場合、あるいは *note os._exit(): 26f9. が呼び出された場合は実
行されません。

'注意:' クリーンアップ関数内からの関数の登録・登録解除効果は定義されてい
ません。

バージョン 3.7 で変更: C-API のサブインタープリタで使われているとき、登
録された関数は登録先のインタープリタのローカルな関数になります。

 -- の関数: atexit.register (func, *args, **kwargs)

     'func' を終了時に実行する関数として登録します。'func' に渡す引数は
     *note register(): a7e. の引数として指定しなければなりません。同じ関
     数を同じ引数で複数回登録できます。

     通常のプログラムの終了時、例えば *note sys.exit(): 277. が呼び出さ
     れるとき、あるいは、メインモジュールの実行が完了したときに、登録さ
     れた全ての関数を、最後に登録されたものから順に呼び出します。通常、
     より低レベルのモジュールはより高レベルのモジュールより前に import さ
     れるので、後で後始末が行われるという仮定に基づいています。

     終了ハンドラの実行中に例外が発生すると、(*note SystemExit: f3c. 以
     外の場合は)トレースバックを表示して、例外の情報を保存します。全ての
     終了ハンドラに動作するチャンスを与えた後に、最後に送出された例外を
     再送出します。

     この関数は 'func' を返し、これをデコレータとして利用できます。

          警告: 登録された関数から新しいスレッドを開始したり、 *note
          os.fork(): 4b5. を呼び出したりすると、メインの Python ランタイ
          ムスレッドがスレッド状態を開放する一方で、内部の *note
          threading: f3. ルーチンや新しいプロセスがそのスレッド状態を使
          用しようと試みる競合が発生します。これはクリーンなシャットダウ
          ンではなく、クラッシュにつながる恐れがあります。

     バージョン 3.12 で変更: 登録された関数から新しいスレッドの開始また
     は新しいプロセスの *note os.fork(): 4b5. が試みられた場合は、 *note
     RuntimeError: 244. が発生するようになりました。

 -- の関数: atexit.unregister (func)

     Remove 'func' from the list of functions to be run at interpreter
     shutdown.  *note unregister(): 177f. silently does nothing if
     'func' was not previously registered.  If 'func' has been
     registered more than once, every occurrence of that function in the
     ‘atexit’ call stack will be removed.  Equality comparisons (‘==’)
     are used internally during unregistration, so function references
     do not need to have matching identities.

参考
....

*note readline: bf. モジュール

     Useful example of ‘atexit’ to read and write *note readline: bf.
     history files.

* Menu:

* atexit Example::


File: python.info,  Node: atexit Example,  Up: atexit --- 終了ハンドラー

5.29.10.1 ‘atexit’ Example
..........................

次の簡単な例では、あるモジュールを import した時にカウンタを初期化してお
き、プログラムが終了するときにアプリケーションがこのモジュールを明示的に
呼び出さなくてもカウンタが更新されるようにする方法を示しています。

     try:
         with open('counterfile') as infile:
             _count = int(infile.read())
     except FileNotFoundError:
         _count = 0

     def incrcounter(n):
         global _count
         _count = _count + n

     def savecounter():
         with open('counterfile', 'w') as outfile:
             outfile.write('%d' % _count)

     import atexit

     atexit.register(savecounter)

*note register(): a7e. に指定した位置引数とキーワード引数は登録した関数
を呼び出す際に渡されます:

     def goodbye(name, adjective):
         print('Goodbye %s, it was %s to meet you.' % (name, adjective))

     import atexit

     atexit.register(goodbye, 'Donny', 'nice')
     # or:
     atexit.register(goodbye, adjective='nice', name='Donny')

*note デコレータ: 93a. として利用する例:

     import atexit

     @atexit.register
     def goodbye():
         print('You are now leaving the Python sector.')

デコレータとして利用できるのは、その関数が引数なしで呼び出された場合に限
られます。


File: python.info,  Node: traceback --- スタックトレースの表示または取得,  Next: __future__ --- future 文の定義,  Prev: atexit --- 終了ハンドラー,  Up: Python ランタイムサービス

5.29.11 ‘traceback’ -- スタックトレースの表示または取得
-------------------------------------------------------

'ソースコード:' Lib/traceback.py(1)

__________________________________________________________________

This module provides a standard interface to extract, format and print
stack traces of Python programs.  It is more flexible than the
interpreter's default traceback display, and therefore makes it possible
to configure certain aspects of the output.  Finally, it contains a
utility for capturing enough information about an exception to print it
later, without the need to save a reference to the actual exception.
Since exceptions can be the roots of large objects graph, this utility
can significantly improve memory management.

The module uses *note traceback objects: cec. -- these are objects of
type *note types.TracebackType: cea, which are assigned to the *note
__traceback__: 14de. field of *note BaseException: 7d6. instances.

参考
....

*note faulthandler: 5c. モジュール

     Used to dump Python tracebacks explicitly, on a fault, after a
     timeout, or on a user signal.

*note pdb: aa. モジュール

     Interactive source code debugger for Python programs.

The module's API can be divided into two parts:

   * Module-level functions offering basic functionality, which are
     useful for interactive inspection of exceptions and tracebacks.

   * *note TracebackException: 563. class and its helper classes *note
     StackSummary: 1083. and *note FrameSummary: 1084.  These offer both
     more flexibility in the output generated and the ability to store
     the information necessary for later formatting without holding
     references to actual exception and traceback objects.

Added in version 3.13: Output is colorized by default and can be *note
controlled using environment variables: 1b7.

* Menu:

* モジュールレベルの関数: モジュールレベルの関数<2>.
* TracebackException オブジェクト::
* StackSummary オブジェクト::
* FrameSummary オブジェクト::
* Examples of Using the Module-Level Functions::
* Examples of Using TracebackException::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/traceback.py


File: python.info,  Node: モジュールレベルの関数<2>,  Next: TracebackException オブジェクト,  Up: traceback --- スタックトレースの表示または取得

5.29.11.1 モジュールレベルの関数
................................

 -- の関数: traceback.print_tb (tb, limit=None, file=None)

     Print up to 'limit' stack trace entries from *note traceback
     object: cec. 'tb' (starting from the caller's frame) if 'limit' is
     positive.  Otherwise, print the last ‘abs(limit)’ entries.  If
     'limit' is omitted or ‘None’, all entries are printed.  If 'file'
     is omitted or ‘None’, the output goes to *note sys.stderr: b33.;
     otherwise it should be an open *note file: 13db. or *note file-like
     object: 17ac. to receive the output.

          注釈: The meaning of the 'limit' parameter is different than
          the meaning of *note sys.tracebacklimit: 1944.  A negative
          'limit' value corresponds to a positive value of
          ‘sys.tracebacklimit’, whereas the behaviour of a positive
          'limit' value cannot be achieved with ‘sys.tracebacklimit’.

     バージョン 3.5 で変更: 負の 'limit' がサポートされました。

 -- の関数: traceback.print_exception (exc, /[, value, tb], limit=None,
          file=None, chain=True)

     *note トレースバックオブジェクト: cec. 'tb' から例外の情報とスタッ
     クトレースの項目を 'file' に出力します。 この関数は以下の点で *note
     print_tb(): 1085. と異なります:

        * 'tb' が ‘None’ でない場合ヘッダ ‘Traceback (most recent call
          last):’ を出力します

        * スタックトレースの後に例外タイプと 'value' を出力します

        * 'type(value)' が *note SyntaxError: 18e. であり、 'value' が適
          切な形式を持っていれば、そのエラーのおおよその位置を示すマーク
          と共にシンタックスエラーが発生した行が表示されます。

     Since Python 3.10, instead of passing 'value' and 'tb', an
     exception object can be passed as the first argument.  If 'value'
     and 'tb' are provided, the first argument is ignored in order to
     provide backwards compatibility.

     オプション引数 'limit' の意味は *note print_tb(): 1085. のものと同
     じです。 'chain' が真の場合 (デフォルト)、連鎖した例外 (例外の
     *note __cause__: 14e0. か *note __context__: 14df. 属性) も出力され
     ます。 これはインタープリタ自身が処理されていない例外を出力するとき
     と同じです。

     バージョン 3.5 で変更: 引数 'etype' は無視され、 'value' の型から推
     論されます。

     バージョン 3.10 で変更: The 'etype' parameter has been renamed to
     'exc' and is now positional-only.

 -- の関数: traceback.print_exc (limit=None, file=None, chain=True)

     ‘print_exception(sys.exception(), limit=limit, file=file,
     chain=chain)’ の省略表現です。

 -- の関数: traceback.print_last (limit=None, file=None, chain=True)

     ‘print_exception(sys.last_exc, limit=limit, file=file,
     chain=chain)’ の省略表現です。 一般に、例外が対話的なプロンプトに達
     した後にのみ機能します (*note sys.last_exc: 6e5. 参照)。

 -- の関数: traceback.print_stack (f=None, limit=None, file=None)

     'limit' が正の場合、最大 'limit' 個のスタックトレース項目 (呼び出し
     地点から開始) を出力します。 そうでない場合、最新の ‘abs(limit)’ 個
     を出力します。 'limit' が省略されるか ‘None’ の場合、すべての項目が
     出力されます。オプションの 'f' 引数は、開始する *note
     スタックフレーム: 8ef. を指定するために用いることができます。オプシ
     ョンの 'file' 引数は *note print_tb(): 1085. の 'file' 引数と同様の
     意味を持っています。

     バージョン 3.5 で変更: 負の 'limit' がサポートされました。

 -- の関数: traceback.extract_tb (tb, limit=None)

     *note トレースバックオブジェクト: cec. 'tb' から取り出された "前処
     理済み" スタックトレース項目のリストを表す *note StackSummary:
     1083. オブジェクトを返します。これはスタックトレースの異なる書式化
     を行うために役に立ちます。オプションの 'limit' 引数は *note
     print_tb(): 1085. の 'limit' 引数と同様の意味を持っています。 "前処
     理済み" スタックトレース項目は 属性 *note filename: 49d8, *note
     lineno: 49d9, *note name: 49da, および *note line: 49db. を含む
     *note FrameSummary: 1084. オブジェクトで、スタックトレースに対して
     通常出力される情報を表しています。

 -- の関数: traceback.extract_stack (f=None, limit=None)

     現在の *note スタックフレーム: 8ef. から生のトレースバックを取り出
     します。戻り値は *note extract_tb(): 49d7. と同じ形式です。オプショ
     ンの 'f' と 'limit' 引数は *note print_stack(): 1086. と同じ意味を
     持ちます。

 -- の関数: traceback.print_list (extracted_list, file=None)

     Print the list of tuples as returned by *note extract_tb(): 49d7.
     or *note extract_stack(): 49dc. as a formatted stack trace to the
     given file.  If 'file' is ‘None’, the output is written to *note
     sys.stderr: b33.

 -- の関数: traceback.format_list (extracted_list)

     *note extract_tb(): 49d7. または *note extract_stack(): 49dc. が返
     すタプルのリストまたは *note FrameSummary: 1084. オブジェクトが与え
     られると、出力の準備を整えた文字列のリストを返します。結果として生
     じるリストの中の各文字列は、引数リストの中の同じインデックスの要素
     に対応します。各文字列は末尾に改行が付いています。さらに、ソーステ
     キスト行が ‘None’ でないそれらの要素に対しては、文字列は内部に改行
     を含んでいるかもしれません。

 -- の関数: traceback.format_exception_only (exc, /[, value], *,
          show_group=False)

     Format the exception part of a traceback using an exception value
     such as given by *note sys.last_value: 6e7.  The return value is a
     list of strings, each ending in a newline.  The list contains the
     exception's message, which is normally a single string; however,
     for *note SyntaxError: 18e. exceptions, it contains several lines
     that (when printed) display detailed information about where the
     syntax error occurred.  Following the message, the list contains
     the exception's *note notes: 26e4.

     Since Python 3.10, instead of passing 'value', an exception object
     can be passed as the first argument.  If 'value' is provided, the
     first argument is ignored in order to provide backwards
     compatibility.

     When 'show_group' is ‘True’, and the exception is an instance of
     *note BaseExceptionGroup: 566, the nested exceptions are included
     as well, recursively, with indentation relative to their nesting
     depth.

     バージョン 3.10 で変更: The 'etype' parameter has been renamed to
     'exc' and is now positional-only.

     バージョン 3.11 で変更: The returned list now includes any *note
     notes: 26e4. attached to the exception.

     バージョン 3.13 で変更: 'show_group' 引数が追加されました。

 -- の関数: traceback.format_exception (exc, /[, value, tb], limit=None,
          chain=True)

     スタックトレースと例外情報を書式化します。引数は *note
     print_exception(): a4f. の対応する引数と同じ意味を持ちます。戻り値
     は文字列のリストで、それぞれの文字列は改行で終わり、そのいくつかは
     内部に改行を含みます。これらの行が連結されて出力される場合は、厳密
     に *note print_exception(): a4f. と同じテキストが出力されます。

     バージョン 3.5 で変更: 引数 'etype' は無視され、 'value' の型から推
     論されます。

     バージョン 3.10 で変更: This function's behavior and signature were
     modified to match *note print_exception(): a4f.

 -- の関数: traceback.format_exc (limit=None, chain=True)

     これは、‘print_exc(limit)’ に似ていますが、ファイルに出力する代わり
     に文字列を返します。

 -- の関数: traceback.format_tb (tb, limit=None)

     ‘format_list(extract_tb(tb, limit))’ の省略表現です。

 -- の関数: traceback.format_stack (f=None, limit=None)

     ‘format_list(extract_stack(f, limit))’ の省略表現です。

 -- の関数: traceback.clear_frames (tb)

     Clears the local variables of all the stack frames in a *note
     traceback: cec. 'tb' by calling the *note clear(): 585. method of
     each *note frame object: 8ef.

     Added in version 3.4.

 -- の関数: traceback.walk_stack (f)

     Walk a stack following *note f.f_back: 98f. from the given frame,
     yielding the frame and line number for each frame.  If 'f' is
     ‘None’, the current stack is used.  This helper is used with *note
     StackSummary.extract(): 49e0.

     Added in version 3.5.

     バージョン 3.14 で変更: This function previously returned a
     generator that would walk the stack when first iterated over.  The
     generator returned now is the state of the stack when ‘walk_stack’
     is called.

 -- の関数: traceback.walk_tb (tb)

     Walk a traceback following *note tb_next: ceb. yielding the frame
     and line number for each frame.  This helper is used with *note
     StackSummary.extract(): 49e0.

     Added in version 3.5.


File: python.info,  Node: TracebackException オブジェクト,  Next: StackSummary オブジェクト,  Prev: モジュールレベルの関数<2>,  Up: traceback --- スタックトレースの表示または取得

5.29.11.2 ‘TracebackException’ オブジェクト
...........................................

Added in version 3.5.

‘TracebackException’ objects are created from actual exceptions to
capture data for later printing.  They offer a more lightweight method
of storing this information by avoiding holding references to *note
traceback: cec. and *note frame: 8ef. objects.  In addition, they expose
more options to configure the output compared to the module-level
functions described above.

 -- クラス: traceback.TracebackException (exc_type, exc_value,
          exc_traceback, *, limit=None, lookup_lines=True,
          capture_locals=False, compact=False, max_group_width=15,
          max_group_depth=10)

     Capture an exception for later rendering.  The meaning of 'limit',
     'lookup_lines' and 'capture_locals' are as for the *note
     StackSummary: 1083. class.

     If 'compact' is true, only data that is required by
     ‘TracebackException’'s *note format(): 199. method is saved in the
     class attributes.  In particular, the *note __context__: 49e2.
     field is calculated only if *note __cause__: 49e3. is ‘None’ and
     *note __suppress_context__: 49e4. is false.

     局所変数がキャプチャされたとき、それらはトレースバックに表示される
     ことに注意してください。

     'max_group_width' and 'max_group_depth' control the formatting of
     exception groups (see *note BaseExceptionGroup: 566.).  The depth
     refers to the nesting level of the group, and the width refers to
     the size of a single exception group's exceptions array.  The
     formatted output is truncated when either limit is exceeded.

     バージョン 3.10 で変更: 'compact' 引数が追加されました。

     バージョン 3.11 で変更: 'max_group_width' と 'max_group_depth' 引数
     が追加されました。

      -- の属性: __cause__

          元々の *note __cause__: 14e0. の ‘TracebackException’。

      -- の属性: __context__

          元々の *note __context__: 14df. の ‘TracebackException’。

      -- の属性: exceptions

          If ‘self’ represents an *note ExceptionGroup: 4d2, this field
          holds a list of ‘TracebackException’ instances representing
          the nested exceptions.  Otherwise it is ‘None’.

          Added in version 3.11.

      -- の属性: __suppress_context__

          元々の例外からの *note __suppress_context__: 2514.。

      -- の属性: __notes__

          The *note __notes__: 26e4. value from the original exception,
          or ‘None’ if the exception does not have any notes.  If it is
          not ‘None’ is it formatted in the traceback after the
          exception string.

          Added in version 3.11.

      -- の属性: stack

          トレースバックを表す *note StackSummary: 1083.。

      -- の属性: exc_type

          元々のトレースバックのクラス。

          バージョン 3.13 で非推奨.

      -- の属性: exc_type_str

          String display of the class of the original exception.

          Added in version 3.13.

      -- の属性: filename

          構文エラー用 - エラーが発生したファイルの名前。

      -- の属性: lineno

          構文エラー用 - エラーが発生した行番号。

      -- の属性: end_lineno

          For syntax errors - the end line number where the error
          occurred.  Can be ‘None’ if not present.

          Added in version 3.10.

      -- の属性: text

          構文エラー用 - エラーが発生したテクスト。

      -- の属性: offset

          構文エラー用 - エラーが発生したテクストへのオフセット。

      -- の属性: end_offset

          For syntax errors - the end offset into the text where the
          error occurred.  Can be ‘None’ if not present.

          Added in version 3.10.

      -- の属性: msg

          構文エラー用 - コンパイラのエラーメッセージ。

      -- メソッド: classmethod from_exception (exc, *, limit=None,
               lookup_lines=True, capture_locals=False)

          後のレンダリングのために例外をキャプチャします。 'limit'、
          'lookup_lines'、'capture_locals' は *note StackSummary: 1083.
          class のものです。

          局所変数がキャプチャされたとき、それらはトレースバックに表示さ
          れることに注意してください。

      -- メソッド: print (*, file=None, chain=True)

          Print to 'file' (default ‘sys.stderr’) the exception
          information returned by *note format(): 199.

          Added in version 3.11.

      -- メソッド: format (*, chain=True)

          例外を書式化します。

          'chain' が ‘True’ でない場合 *note __cause__: 49e3. と *note
          __context__: 49e2. は書式化されません。

          返り値は文字列のジェネレータで、それぞれ改行で終わりますが、内
          部に改行を持つものもあります。 *note print_exception(): a4f. は
          このメソッドのラッパで、単にファイルに出力します。

      -- メソッド: format_exception_only (*, show_group=False)

          トレースバックの例外部を書式化します。

          返り値は文字列のジェネレータで、それぞれ改行で終わります。

          When 'show_group' is ‘False’, the generator emits the
          exception's message followed by its notes (if it has any).
          The exception message is normally a single string; however,
          for *note SyntaxError: 18e. exceptions, it consists of several
          lines that (when printed) display detailed information about
          where the syntax error occurred.

          When 'show_group' is ‘True’, and the exception is an instance
          of *note BaseExceptionGroup: 566, the nested exceptions are
          included as well, recursively, with indentation relative to
          their nesting depth.

          バージョン 3.11 で変更: The exception's *note notes: 26e4. are
          now included in the output.

          バージョン 3.13 で変更: 'show_group' パラメータが追加されまし
          た。


File: python.info,  Node: StackSummary オブジェクト,  Next: FrameSummary オブジェクト,  Prev: TracebackException オブジェクト,  Up: traceback --- スタックトレースの表示または取得

5.29.11.3 ‘StackSummary’ オブジェクト
.....................................

Added in version 3.5.

‘StackSummary’ オブジェクトは書式化の準備ができているコールスタックを表
します。

 -- クラス: traceback.StackSummary

      -- メソッド: classmethod extract (frame_gen, *, limit=None,
               lookup_lines=True, capture_locals=False)

          ジェネレータ (例えば *note walk_stack(): 1081. や *note
          walk_tb(): 1082. が返すもの) から ‘StackSummary’ を構築します
          。

          If 'limit' is supplied, only this many frames are taken from
          'frame_gen'.  If 'lookup_lines' is ‘False’, the returned *note
          FrameSummary: 1084. objects will not have read their lines in
          yet, making the cost of creating the ‘StackSummary’ cheaper
          (which may be valuable if it may not actually get formatted).
          If 'capture_locals' is ‘True’ the local variables in each
          ‘FrameSummary’ are captured as object representations.

          バージョン 3.12 で変更: Exceptions raised from *note repr():
          1c1. on a local variable (when 'capture_locals' is ‘True’) are
          no longer propagated to the caller.

      -- メソッド: classmethod from_list (a_list)

          Construct a ‘StackSummary’ object from a supplied list of
          *note FrameSummary: 1084. objects or old-style list of tuples.
          Each tuple should be a 4-tuple with 'filename', 'lineno',
          'name', 'line' as the elements.

      -- メソッド: format ()

          Returns a list of strings ready for printing.  Each string in
          the resulting list corresponds to a single *note frame: 8ef.
          from the stack.  Each string ends in a newline; the strings
          may contain internal newlines as well, for those items with
          source text lines.

          For long sequences of the same frame and line, the first few
          repetitions are shown, followed by a summary line stating the
          exact number of further repetitions.

          バージョン 3.6 で変更: Long sequences of repeated frames are
          now abbreviated.

      -- メソッド: format_frame_summary (frame_summary)

          Returns a string for printing one of the *note frames: 8ef.
          involved in the stack.  This method is called for each *note
          FrameSummary: 1084. object to be printed by *note
          StackSummary.format(): 49f3.  If it returns ‘None’, the frame
          is omitted from the output.

          Added in version 3.11.


File: python.info,  Node: FrameSummary オブジェクト,  Next: Examples of Using the Module-Level Functions,  Prev: StackSummary オブジェクト,  Up: traceback --- スタックトレースの表示または取得

5.29.11.4 ‘FrameSummary’ オブジェクト
.....................................

Added in version 3.5.

A ‘FrameSummary’ object represents a single *note frame: 8ef. in a *note
traceback: cec.

 -- クラス: traceback.FrameSummary (filename, lineno, name, *,
          lookup_line=True, locals=None, line=None, end_lineno=None,
          colno=None, end_colno=None)

     Represents a single *note frame: 8ef. in the *note traceback: cec.
     or stack that is being formatted or printed.  It may optionally
     have a stringified version of the frame's locals included in it.
     If 'lookup_line' is ‘False’, the source code is not looked up until
     the ‘FrameSummary’ has the *note line: 49db. attribute accessed
     (which also happens when casting it to a *note tuple: 614.).  *note
     line: 49db. may be directly provided, and will prevent line lookups
     happening at all.  'locals' is an optional local variable mapping,
     and if supplied the variable representations are stored in the
     summary for later display.

     ‘FrameSummary’ インスタンスは以下の属性を持ちます:

      -- の属性: filename

          The filename of the source code for this frame.  Equivalent to
          accessing *note f.f_code.co_filename: 1585. on a *note frame
          object: 8ef. 'f'.

      -- の属性: lineno

          The line number of the source code for this frame.

      -- の属性: name

          Equivalent to accessing *note f.f_code.co_name: 2385. on a
          *note frame object: 8ef. 'f'.

      -- の属性: line

          A string representing the source code for this frame, with
          leading and trailing whitespace stripped.  If the source is
          not available, it is ‘None’.

      -- の属性: end_lineno

          The last line number of the source code for this frame.  By
          default, it is set to ‘lineno’ and indexation starts from 1.

          バージョン 3.13 で変更: The default value changed from ‘None’
          to ‘lineno’.

      -- の属性: colno

          The column number of the source code for this frame.  By
          default, it is ‘None’ and indexation starts from 0.

      -- の属性: end_colno

          The last column number of the source code for this frame.  By
          default, it is ‘None’ and indexation starts from 0.


File: python.info,  Node: Examples of Using the Module-Level Functions,  Next: Examples of Using TracebackException,  Prev: FrameSummary オブジェクト,  Up: traceback --- スタックトレースの表示または取得

5.29.11.5 Examples of Using the Module-Level Functions
......................................................

この簡単な例では基本的な read-eval-print ループを実装しています。標準的
な Python の対話インタープリタループに似ていますが、 Python のものより便
利ではありません。インタープリタループのより完全な実装については、 *note
code: 1b. モジュールを参照してください。

     import sys, traceback

     def run_user_code(envdir):
         source = input(">>> ")
         try:
             exec(source, envdir)
         except Exception:
             print("Exception in user code:")
             print("-"*60)
             traceback.print_exc(file=sys.stdout)
             print("-"*60)

     envdir = {}
     while True:
         run_user_code(envdir)

次の例は例外とトレースバックの出力並びに形式が異なることを示します:

     import sys, traceback

     def lumberjack():
         bright_side_of_life()

     def bright_side_of_life():
         return tuple()[0]

     try:
         lumberjack()
     except IndexError as exc:
         print("*** print_tb:")
         traceback.print_tb(exc.__traceback__, limit=1, file=sys.stdout)
         print("*** print_exception:")
         traceback.print_exception(exc, limit=2, file=sys.stdout)
         print("*** print_exc:")
         traceback.print_exc(limit=2, file=sys.stdout)
         print("*** format_exc, first and last line:")
         formatted_lines = traceback.format_exc().splitlines()
         print(formatted_lines[0])
         print(formatted_lines[-1])
         print("*** format_exception:")
         print(repr(traceback.format_exception(exc)))
         print("*** extract_tb:")
         print(repr(traceback.extract_tb(exc.__traceback__)))
         print("*** format_tb:")
         print(repr(traceback.format_tb(exc.__traceback__)))
         print("*** tb_lineno:", exc.__traceback__.tb_lineno)

この例の出力は次のようになります:

     *** print_tb:
       File "<doctest...>", line 10, in <module>
         lumberjack()
         ~~~~~~~~~~^^
     *** print_exception:
     Traceback (most recent call last):
       File "<doctest...>", line 10, in <module>
         lumberjack()
         ~~~~~~~~~~^^
       File "<doctest...>", line 4, in lumberjack
         bright_side_of_life()
         ~~~~~~~~~~~~~~~~~~~^^
     IndexError: tuple index out of range
     *** print_exc:
     Traceback (most recent call last):
       File "<doctest...>", line 10, in <module>
         lumberjack()
         ~~~~~~~~~~^^
       File "<doctest...>", line 4, in lumberjack
         bright_side_of_life()
         ~~~~~~~~~~~~~~~~~~~^^
     IndexError: tuple index out of range
     *** format_exc, first and last line:
     Traceback (most recent call last):
     IndexError: tuple index out of range
     *** format_exception:
     ['Traceback (most recent call last):\n',
      '  File "<doctest default[0]>", line 10, in <module>\n    lumberjack()\n    ~~~~~~~~~~^^\n',
      '  File "<doctest default[0]>", line 4, in lumberjack\n    bright_side_of_life()\n    ~~~~~~~~~~~~~~~~~~~^^\n',
      '  File "<doctest default[0]>", line 7, in bright_side_of_life\n    return tuple()[0]\n           ~~~~~~~^^^\n',
      'IndexError: tuple index out of range\n']
     *** extract_tb:
     [<FrameSummary file <doctest...>, line 10 in <module>>,
      <FrameSummary file <doctest...>, line 4 in lumberjack>,
      <FrameSummary file <doctest...>, line 7 in bright_side_of_life>]
     *** format_tb:
     ['  File "<doctest default[0]>", line 10, in <module>\n    lumberjack()\n    ~~~~~~~~~~^^\n',
      '  File "<doctest default[0]>", line 4, in lumberjack\n    bright_side_of_life()\n    ~~~~~~~~~~~~~~~~~~~^^\n',
      '  File "<doctest default[0]>", line 7, in bright_side_of_life\n    return tuple()[0]\n           ~~~~~~~^^^\n']
     *** tb_lineno: 10

次の例は、スタックの print と format の違いを示しています:

     >>> import traceback
     >>> def another_function():
     ...     lumberstack()
     ...
     >>> def lumberstack():
     ...     traceback.print_stack()
     ...     print(repr(traceback.extract_stack()))
     ...     print(repr(traceback.format_stack()))
     ...
     >>> another_function()
       File "<doctest>", line 10, in <module>
         another_function()
       File "<doctest>", line 3, in another_function
         lumberstack()
       File "<doctest>", line 6, in lumberstack
         traceback.print_stack()
     [('<doctest>', 10, '<module>', 'another_function()'),
      ('<doctest>', 3, 'another_function', 'lumberstack()'),
      ('<doctest>', 7, 'lumberstack', 'print(repr(traceback.extract_stack()))')]
     ['  File "<doctest>", line 10, in <module>\n    another_function()\n',
      '  File "<doctest>", line 3, in another_function\n    lumberstack()\n',
      '  File "<doctest>", line 8, in lumberstack\n    print(repr(traceback.format_stack()))\n']

最後の例は、残りの幾つかの関数のデモをします:

     >>> import traceback
     >>> traceback.format_list([('spam.py', 3, '<module>', 'spam.eggs()'),
     ...                        ('eggs.py', 42, 'eggs', 'return "bacon"')])
     ['  File "spam.py", line 3, in <module>\n    spam.eggs()\n',
      '  File "eggs.py", line 42, in eggs\n    return "bacon"\n']
     >>> an_error = IndexError('tuple index out of range')
     >>> traceback.format_exception_only(an_error)
     ['IndexError: tuple index out of range\n']


File: python.info,  Node: Examples of Using TracebackException,  Prev: Examples of Using the Module-Level Functions,  Up: traceback --- スタックトレースの表示または取得

5.29.11.6 Examples of Using ‘TracebackException’
................................................

With the helper class, we have more options:

     >>> import sys
     >>> from traceback import TracebackException
     >>>
     >>> def lumberjack():
     ...     bright_side_of_life()
     ...
     >>> def bright_side_of_life():
     ...     t = "bright", "side", "of", "life"
     ...     return t[5]
     ...
     >>> try:
     ...     lumberjack()
     ... except IndexError as e:
     ...     exc = e
     ...
     >>> try:
     ...     try:
     ...         lumberjack()
     ...     except:
     ...         1/0
     ... except Exception as e:
     ...     chained_exc = e
     ...
     >>> # limit works as with the module-level functions
     >>> TracebackException.from_exception(exc, limit=-2).print()
     Traceback (most recent call last):
       File "<python-input-1>", line 6, in lumberjack
         bright_side_of_life()
         ~~~~~~~~~~~~~~~~~~~^^
       File "<python-input-1>", line 10, in bright_side_of_life
         return t[5]
                ~^^^
     IndexError: tuple index out of range

     >>> # capture_locals adds local variables in frames
     >>> TracebackException.from_exception(exc, limit=-2, capture_locals=True).print()
     Traceback (most recent call last):
       File "<python-input-1>", line 6, in lumberjack
         bright_side_of_life()
         ~~~~~~~~~~~~~~~~~~~^^
       File "<python-input-1>", line 10, in bright_side_of_life
         return t[5]
                ~^^^
         t = ("bright", "side", "of", "life")
     IndexError: tuple index out of range

     >>> # The *chain* kwarg to print() controls whether chained
     >>> # exceptions are displayed
     >>> TracebackException.from_exception(chained_exc).print()
     Traceback (most recent call last):
       File "<python-input-19>", line 4, in <module>
         lumberjack()
         ~~~~~~~~~~^^
       File "<python-input-8>", line 7, in lumberjack
         bright_side_of_life()
         ~~~~~~~~~~~~~~~~~~~^^
       File "<python-input-8>", line 11, in bright_side_of_life
         return t[5]
                ~^^^
     IndexError: tuple index out of range

     During handling of the above exception, another exception occurred:

     Traceback (most recent call last):
       File "<python-input-19>", line 6, in <module>
         1/0
         ~^~
     ZeroDivisionError: division by zero

     >>> TracebackException.from_exception(chained_exc).print(chain=False)
     Traceback (most recent call last):
       File "<python-input-19>", line 6, in <module>
         1/0
         ~^~
     ZeroDivisionError: division by zero


File: python.info,  Node: __future__ --- future 文の定義,  Next: gc --- ガベージコレクターインターフェース,  Prev: traceback --- スタックトレースの表示または取得,  Up: Python ランタイムサービス

5.29.12 ‘__future__’ -- future 文の定義
---------------------------------------

'ソースコード:' Lib/__future__.py(1)

__________________________________________________________________

‘from __future__ import feature’ の形式でのインポートは *note future 文:
45d. の定義と呼ばれています。これらは特殊なケースで、 Python の新機能が
標準になるリリースの前に Python コンパイラーが future 文を含むモジュール
で Python の新機能を使用できるようにします。

While these future statements are given additional special meaning by
the Python compiler, they are still executed like any other import
statement and the ‘__future__’ exists and is handled by the import
system the same way any other Python module would be.  This design
serves three purposes:

   * import 文を解析する既存のツールを混乱させることを避け、インポートし
     ようとしているモジュールを見つけられるようにするため。

   * To document when incompatible changes were introduced, and when
     they will be -- or were -- made mandatory.  This is a form of
     executable documentation, and can be inspected programmatically via
     importing ‘__future__’ and examining its contents.

   * To ensure that *note future statements: 45d. run under releases
     prior to Python 2.1 at least yield runtime exceptions (the import
     of ‘__future__’ will fail, because there was no module of that name
     prior to 2.1).

* Menu:

* モジュールコンテンツ: モジュールコンテンツ<5>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/__future__.py


File: python.info,  Node: モジュールコンテンツ<5>,  Up: __future__ --- future 文の定義

5.29.12.1 モジュールコンテンツ
..............................

No feature description will ever be deleted from ‘__future__’.  Since
its introduction in Python 2.1 the following features have found their
way into the language using this mechanism:

feature                       optional in                   mandatory in                  effect
                                                                                          
------------------------------------------------------------------------------------------------------------------------
                                                                                          
 -- データ:                   2.1.0b1                       2.2                           PEP 227(1): 'Statically
          __future__.nested_scopes                                                        Nested Scopes'
                                                                                          
                                                                                          
 -- データ:                   2.2.0a1                       2.3                           PEP 255(2): 'Simple
          __future__.generators                                                           Generators'
                                                                                          
                                                                                          
 -- データ:                   2.2.0a2                       3.0                           PEP 238(3): 'Changing the
          __future__.division                                                             Division Operator'
                                                                                          
                                                                                          
 -- データ:                   2.5.0a1                       3.0                           PEP 328(4): 'Imports:
          __future__.absolute_import                                                      Multi-Line and
                                                                                          Absolute/Relative'
                                                                                          
                                                                                          
 -- データ:                   2.5.0a1                       2.6                           PEP 343(5): 'The “with”
          __future__.with_statement                                                       Statement'
                                                                                          
                                                                                          
 -- データ:                   2.6.0a2                       3.0                           PEP 3105(6): 'Make print a
          __future__.print_function                                                       function'
                                                                                          
                                                                                          
 -- データ:                   2.6.0a2                       3.0                           PEP 3112(7): 'Bytes
          __future__.unicode_literals                                                     literals in Python 3000'
                                                                                          
                                                                                          
 -- データ:                   3.5.0b1                       3.7                           PEP 479(8): 'StopIteration
          __future__.generator_stop                                                       handling inside generators'
                                                                                          
                                                                                          
 -- データ:                   3.7.0b1                       Never (9)                     PEP 563(10): 'Postponed
          __future__.annotations                                                          evaluation of annotations',
                                                                                          PEP 649(11): 'Deferred
                                                                                          evaluation of annotations
                                                                                          using descriptors'
                                                                                          

 -- クラス: __future__._Feature

     ‘__future__.py’ のそれぞれの文は次のような形式をしています:

          FeatureName = _Feature(OptionalRelease, MandatoryRelease,
                                 CompilerFlag)

     ここで、普通は、 'OptionalRelease' は 'MandatoryRelease' より小さく
     、2つとも *note sys.version_info: 8af. と同じフォーマットの5つのタ
     プルからなります:

          (PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int
           PY_MINOR_VERSION, # the 1; an int
           PY_MICRO_VERSION, # the 0; an int
           PY_RELEASE_LEVEL, # "alpha", "beta", "candidate" or "final"; string
           PY_RELEASE_SERIAL # the 3; an int
          )

 -- メソッド: _Feature.getOptionalRelease ()

     'OptionalRelease' はその機能が導入された最初のリリースを記録します
     。

 -- メソッド: _Feature.getMandatoryRelease ()

     まだ時期が来ていない 'MandatoryRelease' の場合、'MandatoryRelease'
     はその機能が言語の一部となるリリースを記します。

     その他の場合、'MandatoryRelease' はその機能がいつ言語の一部になった
     のかを記録します。そのリリースから、あるいはそれ以降のリリースでは
     、この機能を使う際に future 文は必要ではありませんが、future 文を使
     い続けても構いません。

     'MandatoryRelease' は ‘None’ になるかもしれません。つまり、予定され
     た機能が破棄されたか、まだ決定されていないということです。

 -- の属性: _Feature.compiler_flag

     'CompilerFlag' は、動的にコンパイルされるコードでその機能を有効にす
     るために、組み込み関数 *note compile(): 4b1. の第4引数に渡す(ビット
     フィールド)フラグです。このフラグは *note _Feature: 25c8. インスタ
     ンスの *note _Feature.compiler_flag: 2393. 属性に保存されています。

参考
....

*note future 文 (future statement): 45d.

     コンパイラがどのように future インポートを扱うか。

PEP 236(12) - Back to the __future__

     __future__ 機構の原案

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0227/

   (2) https://peps.python.org/pep-0255/

   (3) https://peps.python.org/pep-0238/

   (4) https://peps.python.org/pep-0328/

   (5) https://peps.python.org/pep-0343/

   (6) https://peps.python.org/pep-3105/

   (7) https://peps.python.org/pep-3112/

   (8) https://peps.python.org/pep-0479/

   (9) ‘from __future__ import annotations’ was previously scheduled to
become mandatory in Python 3.10, but the change was delayed and
ultimately canceled.  This feature will eventually be deprecated and
removed.  See PEP 649 (https://peps.python.org/pep-0649/) and PEP 749
(https://peps.python.org/pep-0749/).

   (10) https://peps.python.org/pep-0563/

   (11) https://peps.python.org/pep-0649/

   (12) https://peps.python.org/pep-0236/


File: python.info,  Node: gc --- ガベージコレクターインターフェース,  Next: inspect --- 活動中のオブジェクトを調査する,  Prev: __future__ --- future 文の定義,  Up: Python ランタイムサービス

5.29.13 ‘gc’ -- ガベージコレクターインターフェース
--------------------------------------------------

__________________________________________________________________

このモジュールは、循環ガベージコレクタの無効化・検出頻度の調整・デバッグ
オブションの設定などを行うインターフェースを提供します。また、検出した到
達不能オブジェクトのうち、解放する事ができないオブジェクトを参照する事も
できます。循環ガベージコレクタはPythonの参照カウントを補うためのものなの
で、もしプログラム中で循環参照が発生しない事が明らかな場合には検出をする
必要はありません。自動検出は、 ‘gc.disable()’ で停止する事ができます。メ
モリリークをデバッグするときには、 ‘gc.set_debug(gc.DEBUG_LEAK)’ としま
す。これは ‘gc.DEBUG_SAVEALL’ を含んでいることに注意しましょう。ガベージ
として検出されたオブジェクトは、インスペクション用に gc.garbage に保存さ
れます。

The ‘gc’ module provides the following functions:

 -- の関数: gc.enable ()

     自動ガベージコレクションを有効にします。

 -- の関数: gc.disable ()

     自動ガベージコレクションを無効にします。

 -- の関数: gc.isenabled ()

     自動ガベージコレクションが有効なら ‘True’ を返します。

 -- の関数: gc.collect (generation=2)

     Perform a collection.  The optional argument 'generation' may be an
     integer specifying which generation to collect (from 0 to 2).  A
     *note ValueError: 2ec. is raised if the generation number is
     invalid.  The sum of collected objects and uncollectable objects is
     returned.

     Calling ‘gc.collect(0)’ will perform a GC collection on the young
     generation.

     Calling ‘gc.collect(1)’ will perform a GC collection on the young
     generation and an increment of the old generation.

     Calling ‘gc.collect(2)’ or ‘gc.collect()’ performs a full
     collection

     ビルトイン型が持っている free list は、フルGCか最高世代(2)のGCの時
     にクリアされます。 *note float: 196. など、実装によって幾つかの
     free list では全ての要素が解放されるわけではありません。

     The effect of calling ‘gc.collect()’ while the interpreter is
     already performing a collection is undefined.

     バージョン 3.14 で変更: ‘generation=1’ performs an increment of
     collection.

 -- の関数: gc.set_debug (flags)

     ガベージコレクションのデバッグフラグを設定します。デバッグ情報は
     ‘sys.stderr’ に出力されます。デバッグフラグは、下の値の組み合わせを
     指定する事ができます。

 -- の関数: gc.get_debug ()

     現在のデバッグフラグを返します。

 -- の関数: gc.get_objects (generation=None)

     Returns a list of all objects tracked by the collector, excluding
     the list returned.  If 'generation' is not ‘None’, return only the
     objects as follows:

        * 0: All objects in the young generation

        * 1: No objects, as there is no generation 1 (as of Python 3.14)

        * 2: All objects in the old generation

     バージョン 3.8 で変更: 新しい 'generation' パラメータ。

     バージョン 3.14 で変更: Generation 1 is removed

     引数 ‘generation’ で *note 監査イベント: 1c6e. ‘gc.get_objects’ を
     送出します。

 -- の関数: gc.get_stats ()

     インタプリタが開始してからの、世代ごと回収統計を持つ辞書の、3 世代
     ぶんのリストを返します。キーの数は将来変わるかもしれませんが、現在
     のところそれぞれの辞書には以下の項目が含まれています:

        * ‘collections’ は、この世代が検出を行った回数です;

        * ‘collected’ は、この世代内で回収されたオブジェクトの総数です;

        * ‘uncollectable’ は、この世代内で回収不能であることがわかった
          (そしてそれゆえに *note garbage: 13d9. リストに移動した) オブ
          ジェクトの総数です。

     Added in version 3.4.

 -- の関数: gc.set_threshold (threshold0[, threshold1[, threshold2]])

     ガベージコレクションの閾値（検出頻度）を指定します。 'threshold0' を
     0 にすると、検出は行われません。

     The GC classifies objects into two generations depending on whether
     they have survived a collection.  New objects are placed in the
     young generation.  If an object survives a collection it is moved
     into the old generation.

     In order to decide when to run, the collector keeps track of the
     number of object allocations and deallocations since the last
     collection.  When the number of allocations minus the number of
     deallocations exceeds 'threshold0', collection starts.  For each
     collection, all the objects in the young generation and some
     fraction of the old generation is collected.

     In the free-threaded build, the increase in process memory usage is
     also checked before running the collector.  If the memory usage has
     not increased by 10% since the last collection and the net number
     of object allocations has not exceeded 40 times 'threshold0', the
     collection is not run.

     The fraction of the old generation that is collected is 'inversely'
     proportional to 'threshold1'.  The larger 'threshold1' is, the
     slower objects in the old generation are collected.  For the
     default value of 10, 1% of the old generation is scanned during
     each collection.

     'threshold2' is ignored.

     See Garbage collector design(1) for more information.

     バージョン 3.14 で変更: 'threshold2' is ignored

 -- の関数: gc.get_count ()

     現在の検出数を、 ‘(count0, count1, count2)’ のタプルで返します。

 -- の関数: gc.get_threshold ()

     現在の検出閾値を、 ‘(threshold0, threshold1, threshold2)’ のタプル
     で返します。

 -- の関数: gc.get_referrers (*objs)

     objsで指定したオブジェクトのいずれかを参照しているオブジェクトのリ
     ストを返します。この関数では、ガベージコレクションをサポートしてい
     るコンテナのみを返します。他のオブジェクトを参照していても、ガベー
     ジコレクションをサポートしていない拡張型は含まれません。

     尚、戻り値のリストには、すでに参照されなくなっているが、循環参照の
     一部でまだガベージコレクションで回収されていないオブジェクトも含ま
     れるので注意が必要です。有効なオブジェクトのみを取得する場合、
     *note get_referrers(): a05. の前に *note collect(): 1b3. を呼び出し
     てください。

          警告: *note get_referrers(): a05. から返されるオブジェクトは作
          りかけや利用できない状態である場合があるので、利用する際には注
          意が必要です。 *note get_referrers(): a05. をデバッグ以外の目
          的で利用するのは避けてください。

     引数 ‘objs’ を指定して *note 監査イベント: 1c6e. ‘gc.get_referrers’
     を送出します。

 -- の関数: gc.get_referents (*objs)

     引数で指定したオブジェクトのいずれかから参照されている、全てのオブ
     ジェクトのリストを返します。参照先のオブジェクトは、引数で指定した
     オブジェクトの Cレベルメソッド *note tp_traverse: 982. で取得し、全
     てのオブジェクトが直接到達可能な全てのオブジェクトを返すわけではあ
     りません。 *note tp_traverse: 982. はガベージコレクションをサポート
     するオブジェクトのみが実装しており、ここで取得できるオブジェクトは
     循環参照の一部となる可能性のあるオブジェクトのみです。従って、例え
     ば整数オブジェクトが直接到達可能であっても、このオブジェクトは戻り
     値には含まれません。

     引数 ‘objs’ を指定して *note 監査イベント: 1c6e. ‘gc.get_referents’
     を送出します。

 -- の関数: gc.is_tracked (obj)

     ‘obj’ がガベージコレクタに管理されていたら ‘True’ を返し、それ以外
     の場合は ‘False’ を返します。 一般的なルールとして、アトミックな (訳
     注: 他のオブジェクトを参照しないで単一で値を表す型。 int や str な
     ど) 型のインスタンスは管理されず、それ以外の型 (コンテナ型、ユーザ
     ー定義型など) のインスタンスは管理されます。 しかし、いくつかの型で
     は専用の最適化を行い、シンプルなインスタンスの場合に GCのオーバーヘ
     ッドを減らしています。 (例: 全ての key と value がアトミック型の値
     である dict)

          >>> gc.is_tracked(0)
          False
          >>> gc.is_tracked("a")
          False
          >>> gc.is_tracked([])
          True
          >>> gc.is_tracked({})
          False
          >>> gc.is_tracked({"a": 1})
          True

     Added in version 3.1.

 -- の関数: gc.is_finalized (obj)

     Returns ‘True’ if the given object has been finalized by the
     garbage collector, ‘False’ otherwise.

          >>> x = None
          >>> class Lazarus:
          ...     def __del__(self):
          ...         global x
          ...         x = self
          ...
          >>> lazarus = Lazarus()
          >>> gc.is_finalized(lazarus)
          False
          >>> del lazarus
          >>> gc.is_finalized(x)
          True

     Added in version 3.9.

 -- の関数: gc.freeze ()

     Freeze all the objects tracked by the garbage collector; move them
     to a permanent generation and ignore them in all the future
     collections.

     If a process will ‘fork()’ without ‘exec()’, avoiding unnecessary
     copy-on-write in child processes will maximize memory sharing and
     reduce overall memory usage.  This requires both avoiding creation
     of freed "holes" in memory pages in the parent process and ensuring
     that GC collections in child processes won't touch the ‘gc_refs’
     counter of long-lived objects originating in the parent process.
     To accomplish both, call ‘gc.disable()’ early in the parent
     process, ‘gc.freeze()’ right before ‘fork()’, and ‘gc.enable()’
     early in child processes.

     Added in version 3.7.

 -- の関数: gc.unfreeze ()

     Permanent世代領域にあるオブジェクトを解凍します。つまり、最も古い世
     代へ戻します。

     Added in version 3.7.

 -- の関数: gc.get_freeze_count ()

     Permanent世代領域にあるオブジェクトの数を返します。

     Added in version 3.7.

以下の変数は読み出し専用アクセスのために提供されています。(この変数を操
作することはできますが、その値は記憶されません):

 -- データ: gc.garbage

     到達不能であることが検出されたが、解放する事ができないオブジェクト
     のリスト（回収不能オブジェクト）。Python 3.4 からは、‘NULL’ でない
     ‘tp_del’ スロットを持つ C 拡張型のインスタンスを使っている場合を除
     き、このリストはほとんど常に空であるはずです。

     *note DEBUG_SAVEALL: 4a13. が設定されている場合、全ての到達不能オブ
     ジェクトは解放されずにこのリストに格納されます。

     バージョン 3.2 で変更: *note インタプリタシャットダウン: 479. 時に
     このリストが空でない場合、(デフォルトでは黙りますが) *note
     ResourceWarning: 54c. が発行されます。 *note DEBUG_UNCOLLECTABLE:
     13da. がセットされていると、加えて回収不能オブジェクトを出力します
     。

     バージョン 3.4 で変更: Following PEP 442(2), objects with a *note
     __del__(): 11ff. method don't end up in *note gc.garbage: 13d9.
     anymore.

 -- データ: gc.callbacks

     ガベージコレクタの起動前と終了後に呼び出されるコールバック関数のリ
     スト。コールバックは 'phase' と 'info' の2つの引数で呼び出されます
     。

     'phase' は以下 2 つのいずれかです:

          "start": ガベージコレクションを始めます。

          "stop": ガベージコレクションが終了しました。

     'info' はコールバックに付加情報を提供する辞書です。現在のところ以下
     のキーが定義されています:

          "generation": 回収される最も古い世代。

          "collected": 'phase' が "stop" のとき、正常に回収されたオブジ
          ェクトの数。

          "uncollectable": 'phase' が "stop" のとき、回収出来ずに *note
          garbage: 13d9. リストに入れられたオブジェクトの数。

     アプリケーションは自身のコールバックをこのリストに追加出来ます。基
     本的なユースケースは以下のようなものでしょう:

          世代が回収される頻度やガベージコレクションにかかった時間の長さ
          といった、ガベージコレクションの統計情報を集めます。

          *note garbage: 13d9. に回収できない独自の型のオブジェクトが現
          れたとき、アプリケーションがそれらを特定し消去できるようにする
          。

     Added in version 3.3.

以下は *note set_debug(): 4a11. に指定することのできる定数です:

 -- データ: gc.DEBUG_STATS

     検出中に統計情報を出力します。この情報は、検出頻度を最適化する際に
     有益です。

 -- データ: gc.DEBUG_COLLECTABLE

     見つかった回収可能オブジェクトの情報を出力します。

 -- データ: gc.DEBUG_UNCOLLECTABLE

     見つかった回収不能オブジェクト（到達不能だが、ガベージコレクション
     で解放する事ができないオブジェクト）の情報を出力します。回収不能オ
     ブジェクトは、 ‘garbage’ リストに追加されます。

     バージョン 3.2 で変更: *note インタプリタシャットダウン: 479. 時に
     *note garbage: 13d9. リストが空でない場合に、その中身の出力も行いま
     す。

 -- データ: gc.DEBUG_SAVEALL

     設定されている場合、全ての到達不能オブジェクトは解放されずに
     'garbage' に追加されます。これはプログラムのメモリリークをデバッグ
     するときに便利です。

 -- データ: gc.DEBUG_LEAK

     プログラムのメモリリークをデバッグするときに指定します（
     ‘DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | DEBUG_SAVEALL’ と同じ）
     。

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/blob/3.14/InternalDocs/garbage_collector.md

   (2) https://peps.python.org/pep-0442/


File: python.info,  Node: inspect --- 活動中のオブジェクトを調査する,  Next: annotationlib --- Functionality for introspecting annotations,  Prev: gc --- ガベージコレクターインターフェース,  Up: Python ランタイムサービス

5.29.14 ‘inspect’ -- 活動中のオブジェクトを調査する
---------------------------------------------------

'ソースコード:' Lib/inspect.py(1)

__________________________________________________________________

The ‘inspect’ module provides several useful functions to help get
information about live objects such as modules, classes, methods,
functions, tracebacks, frame objects, and code objects.  For example, it
can help you examine the contents of a class, retrieve the source code
of a method, extract and format the argument list for a function, or get
all the information you need to display a detailed traceback.

このモジュールの機能は4種類に分類することができます。型チェック、ソース
コードの情報取得、クラスや関数からの情報取得、インタープリタのスタック情
報の調査です。

* Menu:

* 型とメンバー::
* ソースコードの情報取得::
* Signature オブジェクトで呼び出し可能オブジェクトを内省する::
* クラスと関数: クラスと関数<2>.
* インタープリタスタック::
* 属性の静的なフェッチ::
* Current State of Generators, Coroutines, and Asynchronous Generators: Current State of Generators Coroutines and Asynchronous Generators.
* Code Objects Bit Flags::
* Buffer flags::
* コマンドライン・インターフェース: コマンドライン・インターフェース<10>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/inspect.py


File: python.info,  Node: 型とメンバー,  Next: ソースコードの情報取得,  Up: inspect --- 活動中のオブジェクトを調査する

5.29.14.1 型とメンバー
......................

*note getmembers(): 1bf1. は、クラスやモジュールなどのオブジェクトからメ
ンバーを取得します。名前が "is" で始まる関数は、主に *note getmembers():
1bf1. の第2引数として利用するために提供されています。以下のような特殊属
性を参照できるかどうか調べる時にも使えるでしょう (モジュール属性について
は *note Import-related attributes on module objects: 2361. を参照してく
ださい):

型                    属性                    説明
                                              
------------------------------------------------------------------------------
                                              
クラス                __doc__                 ドキュメント文字列
                                              
                                              
                      __name__                クラスの定義名
                                              
                                              
                      __qualname__            qualified name
                                              
                                              
                      __module__              クラスを定義しているモジュー
                                              ルの名前
                                              
                                              
                      __type_params__         ジェネリッククラスの
                                              *note 型パラメータ (type parameters): 5ad.
                                              を含むタプル
                                              
                                              
メソッド              __doc__                 ドキュメント文字列
                                              
                                              
                      __name__                メソッドの定義名
                                              
                                              
                      __qualname__            qualified name
                                              
                                              
                      __func__                メソッドを実装している関数オ
                                              ブジェクト
                                              
                                              
                      __self__                メソッドに結合しているインス
                                              タンス、または ‘None’
                                              
                                              
                      __module__              このメソッドが定義されている
                                              モジュールの名前
                                              
                                              
関数                  __doc__                 ドキュメント文字列
                                              
                                              
                      __name__                関数の定義名
                                              
                                              
                      __qualname__            qualified name
                                              
                                              
                      __code__                関数をコンパイルした
                                              *note バイトコード: 4aa. を格
                                              納するコードオブジェクト
                                              
                                              
                      __defaults__            位置またはキーワード引数の全
                                              ての既定値のタプル
                                              
                                              
                      __kwdefaults__          キーワード専用引数の全ての既
                                              定値のマッピング
                                              
                                              
                      __globals__             関数が定義されたグローバル名
                                              前空間
                                              
                                              
                      __builtins__            組み込みモジュールの名前空間
                                              
                                              
                      __annotations__         仮引数名からアノテーションへ
                                              のマッピング; ‘"return"’ キー
                                              は return アノテーションに予
                                              約されています
                                              
                                              
                      __type_params__         ジェネリック関数の
                                              *note 型パラメータ (type parameters): 5ad.
                                              を含むタプル
                                              
                                              
                      __module__              この関数が定義されているモジ
                                              ュールの名前
                                              
                                              
traceback             tb_frame                このレベルのフレームオブジェ
                                              クト
                                              
                                              
                      tb_lasti                最後に実行しようとしたバイト
                                              コード中のインストラクション
                                              を示すインデックス
                                              
                                              
                      tb_lineno               現在の Python ソースコードの
                                              行番号
                                              
                                              
                      tb_next                 このオブジェクトの内側 (この
                                              レベルから呼び出された) のト
                                              レースバックオブジェクト
                                              
                                              
フレーム              f_back                  外側 (このフレームを呼び出し
                                              た) のフレームオブジェクト
                                              
                                              
                      f_builtins              このフレームで参照している組
                                              み込み名前空間
                                              
                                              
                      f_code                  このフレームで実行しているコ
                                              ードオブジェクト
                                              
                                              
                      f_globals               このフレームで参照しているグ
                                              ローバル名前空間
                                              
                                              
                      f_lasti                 最後に実行しようとしたバイト
                                              コード中のインストラクション
                                              を示すインデックス
                                              
                                              
                      f_lineno                現在の Python ソースコードの
                                              行番号
                                              
                                              
                      f_locals                このフレームで参照しているロ
                                              ーカル名前空間
                                              
                                              
                      f_generator             returns the generator or
                                              coroutine object that owns
                                              this frame, or ‘None’ if the
                                              frame is of a regular
                                              function
                                              
                                              
                      f_trace                 このフレームのトレース関数、
                                              または ‘None’
                                              
                                              
                      f_trace_lines           indicate whether a tracing
                                              event is triggered for each
                                              source source line
                                              
                                              
                      f_trace_opcodes         indicate whether per-opcode
                                              events are requested
                                              
                                              
                      clear()                 used to clear all references
                                              to local variables
                                              
                                              
コード                co_argcount             引数の数 (キーワード限定引数
                                              、および * や ** は含まない)
                                              
                                              
                      co_code                 コンパイルされたバイトコード
                                              そのままの文字列
                                              
                                              
                      co_cellvars             (自身が包含するスコープから参
                                              照される) セル変数の名前のタ
                                              プル
                                              
                                              
                      co_consts               バイトコード中で使用している
                                              定数のタプル
                                              
                                              
                      co_filename             コードオブジェクトを生成した
                                              ファイルのファイル名
                                              
                                              
                      co_firstlineno          Python ソースコードの先頭行
                                              
                                              
                      co_flags                ‘CO_*’ ビットフラグのマップ。
                                              詳細は *note こちら: 2392. を
                                              参照。
                                              
                                              
                      co_lnotab               行番号からバイトコードインデ
                                              ックスへの変換表を文字列にエ
                                              ンコードしたもの
                                              
                                              
                      co_freevars             (関数のクロージャを介して参照
                                              される) 自由変数の名前のタプ
                                              ル
                                              
                                              
                      co_posonlyargcount      位置専用引数の数
                                              
                                              
                      co_kwonlyargcount       キーワード専用引数 (** 引数を
                                              含まない) の数
                                              
                                              
                      co_name                 コードオブジェクトが定義され
                                              たときの名前
                                              
                                              
                      co_qualname             このコードオブジェクトが定義
                                              されたときの完全修飾名 (fully
                                              qualified name)
                                              
                                              
                      co_names                関数の引数でもローカル変数で
                                              もない名前のタプル
                                              
                                              
                      co_nlocals              ローカル変数の数
                                              
                                              
                      co_stacksize            必要とされる仮想マシンのスタ
                                              ックスペース
                                              
                                              
                      co_varnames             引数名とローカル変数名のタプ
                                              ル
                                              
                                              
                      co_lines()              returns an iterator that
                                              yields successive bytecode
                                              ranges
                                              
                                              
                      co_positions()          returns an iterator of source
                                              code positions for each
                                              bytecode instruction
                                              
                                              
                      replace()               returns a copy of the code
                                              object with new values
                                              
                                              
ジェネレータ          __name__                name
                                              
                                              
                      __qualname__            qualified name
                                              
                                              
                      gi_frame                フレーム
                                              
                                              
                      gi_running              ジェネレータが実行中かどうか
                                              
                                              
                      gi_suspended            is the generator suspended?
                                              
                                              
                      gi_code                 コード
                                              
                                              
                      gi_yieldfrom            ‘yield from’ でイテレートされ
                                              ているオブジェクト、または
                                              ‘None’
                                              
                                              
非同期ジェネレータ    __name__                name
                                              
                                              
                      __qualname__            qualified name
                                              
                                              
                      ag_await                待機されているオブジェクト、
                                              または ‘None’
                                              
                                              
                      ag_frame                フレーム
                                              
                                              
                      ag_running              ジェネレータが実行中かどうか
                                              
                                              
                      ag_suspended            is the generator suspended?
                                              
                                              
                      ag_code                 コード
                                              
                                              
コルーチン            __name__                name
                                              
                                              
                      __qualname__            qualified name
                                              
                                              
                      cr_await                待機されているオブジェクト、
                                              または ‘None’
                                              
                                              
                      cr_frame                フレーム
                                              
                                              
                      cr_running              コルーチンが実行中かどうか
                                              
                                              
                      cr_suspended            is the coroutine suspended?
                                              
                                              
                      cr_code                 コード
                                              
                                              
                      cr_origin               ‘None’ またはコルーチンが生成
                                              された場所。
                                              *note sys.set_coroutine_origin_tracking_depth(): d85.
                                              を参照。
                                              
                                              
組み込み              __doc__                 ドキュメント文字列
                                              
                                              
                      __name__                関数、メソッドの元々の名前
                                              
                                              
                      __qualname__            qualified name
                                              
                                              
                      __self__                メソッドが結合しているインス
                                              タンス、または ‘None’
                                              

バージョン 3.5 で変更: ジェネレータに ‘__qualname__’ と ‘gi_yieldfrom’ 属
性が追加されました。

ジェネレータの ‘__name__’ 属性がコード名ではなく関数名から設定されるよう
になり、変更できるようになりました。

バージョン 3.7 で変更: コルーチンに ‘cr_origin’ 属性を追加しました。

バージョン 3.10 で変更: 関数に ‘__builtins__’ 属性を追加しました。

バージョン 3.11 で変更: Add ‘gi_suspended’ attribute to generators.

バージョン 3.11 で変更: Add ‘cr_suspended’ attribute to coroutines.

バージョン 3.12 で変更: Add ‘ag_suspended’ attribute to async
generators.

バージョン 3.14 で変更: Add ‘f_generator’ attribute to frames.

 -- の関数: inspect.getmembers (object[, predicate])

     オブジェクトの全てのメンバーを ‘(name, value)’ ペアのリストで返しま
     す。リストは名前 (name) でソートされます。オプション引数
     'predicate' が指定された場合、各メンバーの ‘value’ オブジェクトを引
     数として 'predicate' が呼ばれ、その戻り値が真となるとなるメンバーだ
     けがリストに含まれます。

          注釈: 引数がクラスでその属性がメタクラスで特別に定義された
          *note __dir__(): 17e2. に列挙されている場合、*note
          getmembers(): 1bf1. はメタクラスで定義されたクラス属性のみを返
          します。

 -- の関数: inspect.getmembers_static (object[, predicate])

     オブジェクトの全てのメンバーを ‘(name, value)’ ペアのリストで返しま
     す。ただし、デスクリプタプロトコルの __getattr__ や
     __getattribute__ を介した動的なルックアップは行いません。オプション
     として、引数に与えられた predicate を満たすメンバーのみを返すことも
     できます。

          注釈: *note getmembers_static(): 859. は getmembers が取得でき
          るメンバーの全てを取り出すことはできないかもしれません (たとえ
          ば動的に生成された属性など)が、逆に getmembers が見つけること
          のできなかったメンバーを取得できることもあります
          (AttributeError を送出するデスクリプタなど)。また、時にはイン
          スタンスメンバーの代わりにデスクリプタオブジェクトを返すことも
          あります。

     Added in version 3.11.

 -- の関数: inspect.getmodulename (path)

     ファイル 'path' で指定されたモジュールの名前を、そのモジュールを含
     むパッケージの名前を含まない形で返します。ファイル拡張子は、 *note
     importlib.machinery.all_suffixes(): 4a1b. の全てのエントリに対して
     一致するかどうかをチェックされます。拡張子が一致した場合、最後のパ
     ス成分から拡張子を除いたものを返します。それ以外の場合は ‘None’ を
     返します。

     この関数は、実際の Python モジュールとして意味のある名前 'だけ' を
     返します。すなわち、 Python パッケージを指している可能性のあるパス
     に対しては、依然として ‘None’ を返します。

     バージョン 3.3 で変更: この関数は直接 *note importlib: 7b. に依存す
     るようになりました。

 -- の関数: inspect.ismodule (object)

     オブジェクトがモジュールの場合 ‘True’ を返します。

 -- の関数: inspect.isclass (object)

     オブジェクトが組み込みか Python が生成したクラスの場合に ‘True’ を
     返します。

 -- の関数: inspect.ismethod (object)

     オブジェクトがメソッドの場合 ‘True’ を返します。

 -- の関数: inspect.ispackage (object)

     Return ‘True’ if the object is a *note package: 233.

     Added in version 3.14.

 -- の関数: inspect.isfunction (object)

     オブジェクトが、 *note lambda: 2bb3. 式で生成されたものを含む
     Python 関数の場合に ‘True’ を返します。

 -- の関数: inspect.isgeneratorfunction (object)

     オブジェクトが Python のジェネレータ関数の場合 ‘True’ を返します。

     バージョン 3.8 で変更: *note functools.partial(): 217. でラップした
     関数に対して、ラップされた関数が Python のジェネレータ関数である場
     合は ‘True’ を返すようになりました。

     バージョン 3.13 で変更: *note functools.partialmethod(): 218. でラ
     ップした関数に対して、ラップされた関数が Python のジェネレータ関数
     である場合は ‘True’ を返すようになりました。

 -- の関数: inspect.isgenerator (object)

     オブジェクトがジェネレータの場合 ‘True’ を返します。

 -- の関数: inspect.iscoroutinefunction (object)

     オブジェクトがコルーチン関数 *note coroutine function: f73. (*note
     async def: 7ed. 構文で定義された関数)、コルーチン関数 *note
     coroutine function: f73. をラップしている *note
     functools.partial(): 217. もしくは *note markcoroutinefunction():
     6b8. とマークされた同期関数のいずれかの場合に ‘True’ を返します

     Added in version 3.5.

     バージョン 3.8 で変更: *note functools.partial(): 217. でラップした
     関数に対して、ラップされた関数が コルーチン関数 *note coroutine
     function: f73. である場合は ‘True’ を返すようになりました。

     バージョン 3.12 で変更: *note markcoroutinefunction(): 6b8. とマー
     クされた同期関数に対して ‘True’ を返すようになりました。

     バージョン 3.13 で変更: *note functools.partialmethod(): 218. でラ
     ップした関数に対して、ラップされた関数がコルーチン関数 *note
     coroutine function: f73. である場合は ‘True’ を返すようになりました
     。

 -- の関数: inspect.markcoroutinefunction (func)

     そのままであれば *note iscoroutinefunction(): 30d. がコルーチン関数
     と判定しないような呼び出し可能オブジェクトを、コルーチン関数 *note
     coroutine function: f73. とマークするためのデコレータです。

     これは、コルーチン *note coroutine: 6b9. を返す同期関数が、 *note
     iscoroutinefunction(): 30d. が真であることを要求するAPIに渡される場
     合に役に立つかもしれません。

     可能なら、 *note async def: 7ed. を使った関数定義が好ましいです。ま
     た、関数を呼び出した上でその戻り値を *note iscoroutine(): 1017. で
     テストする方法も容認できます。

     Added in version 3.12.

 -- の関数: inspect.iscoroutine (object)

     オブジェクトが *note async def: 7ed. で生成された *note コルーチン:
     6b9. の場合 ‘True’ を返します。

     Added in version 3.5.

 -- の関数: inspect.isawaitable (object)

     オブジェクトを *note await: 18d. 式内で使用できる場合 ‘True’ を返し
     ます。

     ジェネレータベースのコルーチンと通常のジェネレータを区別するのにも
     使えます:

          import types

          def gen():
              yield
          @types.coroutine
          def gen_coro():
              yield

          assert not isawaitable(gen())
          assert isawaitable(gen_coro())

     Added in version 3.5.

 -- の関数: inspect.isasyncgenfunction (object)

     オブジェクトが非同期ジェネレータ *note asynchronous generator:
     249b. 関数である場合に ‘True’ を返します。使用例:

          >>> async def agen():
          ...     yield 1
          ...
          >>> inspect.isasyncgenfunction(agen)
          True

     Added in version 3.6.

     バージョン 3.8 で変更: *note functools.partial(): 217. でラップされ
     た関数でも、元の関数が非同期ジェネレータ *note asynchronous
     generator: 249b. 関数であれば ‘True’ を返すようになりました。

     バージョン 3.13 で変更: Functions wrapped in *note
     functools.partialmethod(): 218. now return ‘True’ if the wrapped
     function is a *note asynchronous generator: 249b. function.

 -- の関数: inspect.isasyncgen (object)

     オブジェクトが *note asynchronous generator: 249b. 関数によって生成
     された *note asynchronous generator iterator: 4918. である場合に
     ‘True’ を返します。

     Added in version 3.6.

 -- の関数: inspect.istraceback (object)

     オブジェクトがトレースバックの場合は ‘True’ を返します。

 -- の関数: inspect.isframe (object)

     オブジェクトがフレームの場合は ‘True’ を返します。

 -- の関数: inspect.iscode (object)

     オブジェクトがコードの場合は ‘True’ を返します。

 -- の関数: inspect.isbuiltin (object)

     オブジェクトが組み込み関数か束縛済みの組み込みメソッドの場合に
     ‘True’ を返します。

 -- の関数: inspect.ismethodwrapper (object)

     オブジェクトの型が *note MethodWrapperType: 85b. である場合に
     ‘True’ を返します。

     真を返すのは *note MethodWrapperType: 85b. のインスタンスで、 *note
     __str__(): 830, *note __eq__(): cf2, *note __repr__(): 82f. などで
     す。

     Added in version 3.11.

 -- の関数: inspect.isroutine (object)

     オブジェクトがユーザ定義か組み込みの関数またはメソッドの場合は
     ‘True’ を返します。

 -- の関数: inspect.isabstract (object)

     オブジェクトが抽象基底クラスであるときに ‘True’ を返します。

 -- の関数: inspect.ismethoddescriptor (object)

     オブジェクトがメソッドデスクリプタであり、 *note ismethod(): 4a1e,
     *note isclass(): 4a1d, *note isfunction(): 4a1f, *note isbuiltin():
     4a25. でない場合に ‘True’ を返します。

     これはたとえば、 ‘int.__add__’ で真を返します。この関数によるテスト
     をパスする（真を返す）オブジェクトは *note __get__(): 1701. メソッ
     ドを持ちますが、 *note __set__(): 23b5. メソッドや *note
     __delete__(): 194f. メソッドは持ちません。それ以外の属性の有無はさ
     まざまです。 *note __name__: 1272. 属性は普通は存在しますし、 *note
     __doc__: b21. 属性もしばしば見られます。

     デスクリプタによって実装されたメソッドがこのメソッド以外のテストを
     パスする場合、 *note ismethoddescriptor(): 194e. によるテストでは
     ‘False’ を返します。これは単純に、他のテストはより多くを約束するか
     らです - たとえば、あるオブジェクトが *note ismethod(): 4a1e. のテ
     ストをパスするとき、そのオブジェクトが *note __func__: 1514. 属性
     (など) を持っていることを期待することができます。

     バージョン 3.13 で変更: この関数は、 *note __get__(): 1701. 属性と
     *note __delete__(): 194f. 属性を持ち、 *note __set__(): 23b5. 属性
     を持たないオブジェクトをメソッドデスクリプタであると不正に報告する
     ことはなくなりました (そのようなオブジェクトはデータデスクリプタで
     あって、メソッドデスクリプタではありません)。

 -- の関数: inspect.isdatadescriptor (object)

     オブジェクトがデータデスクリプタの場合に ‘True’ を返します。

     データデスクリプタは *note __set__: 23b5. メソッドか *note
     __delete__: 194f. メソッドのいずれかを持ちます。例としては、
     (Python で定義された) プロパティ、 getset デスクリプタ、メンバーデ
     スクリプタがあります。後者2つは C で定義されており、それぞれの型に
     対して特別なテストが存在します。それらのテストは、全ての Python 実
     装に対して堅牢です。概して、データデスクリプタは *note __name__:
     1272. 属性や ‘__doc__’ 属性も持ちますが、このことは保証されてはいま
     せん (一方でプロパティ、 getset デスクリプタ、メンバーデスクリプタ
     はこれら2つの属性を両方持っています)。

 -- の関数: inspect.isgetsetdescriptor (object)

     オブジェクトが getset デスクリプタの場合に ‘True’ を返します。

     getset とは、拡張モジュールで *note PyGetSetDef: db2. 構造体を用い
     て定義された属性のことです。そのような型を持たない Python 実装の場
     合は、このメソッドは常に ‘False’ を返します。

 -- の関数: inspect.ismemberdescriptor (object)

     オブジェクトがメンバーデスクリプタの場合に ‘True’ を返します。

     メンバーデスクリプタとは、拡張モジュールで *note PyMemberDef: 771.
     構造体を用いて定義された属性のことです。そのような型を持たない
     Python 実装の場合は、このメソッドは常に ‘False’ を返します。


File: python.info,  Node: ソースコードの情報取得,  Next: Signature オブジェクトで呼び出し可能オブジェクトを内省する,  Prev: 型とメンバー,  Up: inspect --- 活動中のオブジェクトを調査する

5.29.14.2 ソースコードの情報取得
................................

 -- の関数: inspect.getdoc (object)

     オブジェクトのドキュメンテーション文字列を、 *note cleandoc():
     1a2c. で整理した上で取得します。オブジェクトに対するドキュメンテー
     ション文字列が与えられていない場合で、かつオブジェクトがクラス、メ
     ソッド、プロパティ、デスクリプタのいずれかである場合、継承の階層構
     造からドキュメンテーション文字列を探し出して返します。ドキュメンテ
     ーション文字列がないか、または不正な場合は ‘None’ を返します。

     バージョン 3.5 で変更: ドキュメンテーション文字列がオーバーライドさ
     れていない場合は継承されるようになりました。

 -- の関数: inspect.getcomments (object)

     オブジェクトのソースコード直前 (クラス、関数、メソッドの場合) また
     は Python ソースファイルの先頭 (モジュールの場合) の任意の行数にわ
     たるコメントを、ひとつの文字列として返します。オブジェクトのソース
     コードが存在しない場合は ‘None’ を返します。オブジェクトが C で定義
     されている場合や、対話型シェルで定義したオブジェクトの場合にこのよ
     うなことが起こり得ます。

 -- の関数: inspect.getfile (object)

     オブジェクトを定義している (テキストまたはバイナリの) ファイルの名
     前を返します。オブジェクトが組み込みモジュール、クラス、関数の場合
     は *note TypeError: 198. 例外が発生します。

 -- の関数: inspect.getmodule (object)

     オブジェクトが定義されているモジュールの推定を試みます。モジュール
     が決められない場合は ‘None’ を返します。

 -- の関数: inspect.getsourcefile (object)

     オブジェクトが定義されている Python ソースファイルの名前を返します
     。ソースを取得する方法がない場合は ‘None’ を返します。組み込みのモ
     ジュール、クラス、関数に対しては *note TypeError: 198. で失敗します
     。

 -- の関数: inspect.getsourcelines (object)

     オブジェクトを定義しているソースコードの行のリストと、定義の開始行
     番号を返します。引数にはモジュール、クラス、メソッド、関数、トレー
     スバック、またはコードオブジェクトを渡すことができます。オブジェク
     トに対応するソースコードが行のリストとして返されます。また行番号は
     、元のソースファイル中でコードが見つかった最初の行を示します。ソー
     スコードを探し出すことができなかった場合、 *note OSError: 2c0. 例外
     が送出されます。オブジェクトが組み込みのモジュール、クラス、または
     関数である場合は *note TypeError: 198. 例外が送出されます。

     バージョン 3.3 で変更: *note IOError: 125e. の代わりに *note
     OSError: 2c0. を送出します。前者は後者のエイリアスです。

 -- の関数: inspect.getsource (object)

     オブジェクトを定義しているソースコードのテキストを返します。引数に
     はモジュール、クラス、メソッド、関数、トレースバック、フレーム、ま
     たはコードオブジェクトを渡すことができます。ソースコードはひとつの
     文字列として返されます。ソースコードを探し出すことができなかった場
     合、 *note OSError: 2c0. 例外が送出されます。オブジェクトが組み込み
     のモジュール、クラス、または関数である場合は *note TypeError: 198.
     例外が送出されます。

     バージョン 3.3 で変更: *note IOError: 125e. の代わりに *note
     OSError: 2c0. を送出します。前者は後者のエイリアスです。

 -- の関数: inspect.cleandoc (doc)

     コードブロックと位置を合わせるためのインデントを docstring から削除
     します。

     先頭行の行頭の空白文字は全て削除されます。 2行目以降では全行で同じ
     数の行頭の空白文字が、削除できるだけ削除されます。 その後、先頭と末
     尾の空白行が削除され、全てのタブが空白に展開されます。


File: python.info,  Node: Signature オブジェクトで呼び出し可能オブジェクトを内省する,  Next: クラスと関数<2>,  Prev: ソースコードの情報取得,  Up: inspect --- 活動中のオブジェクトを調査する

5.29.14.3 Signature オブジェクトで呼び出し可能オブジェクトを内省する
....................................................................

Added in version 3.3.

*note Signature: 4e3. オブジェクトは、呼び出し可能オブジェクトの呼び出し
シグネチャと戻り値のアノテーションを表現します。 ‘Signature’ オブジェク
トを取得するには、 ‘signature()’ 関数を使ってください。

 -- の関数: inspect.signature (callable, *, follow_wrapped=True,
          globals=None, locals=None, eval_str=False,
          annotation_format=Format.VALUE)

     'callable' で与えられたオブジェクトに対する *note Signature: 4e3. オ
     ブジェクトを返します:

          >>> from inspect import signature
          >>> def foo(a, *, b:int, **kwargs):
          ...     pass

          >>> sig = signature(foo)

          >>> str(sig)
          '(a, *, b: int, **kwargs)'

          >>> str(sig.parameters['b'])
          'b: int'

          >>> sig.parameters['b'].annotation
          <class 'int'>

     単純な関数やクラスから、 *note functools.partial(): 217. オブジェク
     トまで、幅広い Python の呼び出し可能なオブジェクトを受け付けます。

     アノテーションのいくつかが (たとえば ‘from __future__ import
     annotations’ が使われていることを理由に) 文字列である場合、 *note
     signature(): 22f. は *note annotationlib.get_annotations(): 459. を
     使って「非文字列化」すなわち文字列アノテーションを解決して本来のア
     ノテーションに戻すことを試みます。アノテーションの解決を行う際には
     'globals', 'locals', および 'eval_str' パラメータが
     ‘annotationlib.get_annotations()’ に渡されます; これらのパラメータ
     を使う方法についての説明は ‘annotationlib.get_annotations()’ のドキ
     ュメンテーションを参照してください。返されるアノテーションの形式を
     制御するため、 'annotation_format' パラメータには *note
     annotationlib.Format: 230. 列挙型のメンバーを渡すことができます。た
     とえばアノテーションを文字列形式で返すためには
     ‘annotation_format=annotationlib.Format.STRING’ を使ってください。

     シグネチャを提供できない場合は *note ValueError: 2ec. 例外を送出し
     ます。またオブジェクトの型がサポートされていない場合は *note
     TypeError: 198. 例外を送出します。さらに、アノテーションが文字列化
     されており、 'eval_str' が偽でない場合、アノテーションを「非文字列
     化」するために *note annotationlib.get_annotations(): 459. 内部で呼
     ばれる ‘eval()’ により、いかなる種類の例外も送出される可能性があり
     ます。

     関数シグネチャにおけるスラッシュ (/) は、それより前のパラメータが位
     置専用引数であることを示します。より詳しい情報は、 *note
     位置専用引数に関する FAQ エントリ: 25d6. を参照してください。

     バージョン 3.5 で変更: 'follow_wrapped' パラメータが追加されました
     。parameter was added.  特に 'callable' そのものについてのシグネチ
     ャを取得するためには ‘False’ を指定してください (そうすることで、デ
     コレータで修飾された呼び出し可能オブジェクトに対して
     ''callable.__wrapped__'' が使われなくなります)。

     バージョン 3.10 で変更: 'globals', 'locals', および 'eval_str' パラ
     メータが追加されました。

     バージョン 3.14 で変更: 'annotation_format' パラメータが追加されま
     した。

          注釈: いくつかの呼び出し可能オブジェクトは、ある Python 実装の
          下ではイントロスペクション (実行時オブジェクト調査) ができない
          かもしれません。たとえば CPython では、 C で定義されたいくつか
          の組み込み関数はそれらの引数に関するメタデータを提供しません。

     渡されたオブジェクトが ‘__signature__’ 属性を持つ場合、それにもとづ
     いてシグネチャを作ることができるかもしれません。厳密なセマンティク
     スは実装レベルの詳細であり、予告なく変更される可能性があります。現
     在のセマンティクスについてはソースコードをを参照してください。

 -- クラス: inspect.Signature (parameters=None, *,
          return_annotation=Signature.empty)

     ‘Signature’ オブジェクトは、関数の呼び出しシグネチャと戻り値のアノ
     テーションを表現します。このオブジェクトは *note parameters: 4a2e.
     集合として、関数が受け取るパラメータそれぞれについての *note
     Parameter: 4e4. オブジェクトを保存します。

     オプション引数 'parameters' は *note Parameter: 4e4. オブジェクトの
     シーケンスで、重複した名前のパラメータはないか、パラメータの並び順
     は正しいか、すなわち位置専用引数からはじまり次に位置引数としてもキ
     ーワード引数としても指定可能なパラメータが続くかどうか、またデフォ
     ルト値のあるパラメータがデフォルト値のないパラメータの後にあるかど
     うか、といった項目をチェックするための検証が行われます。

     オプション引数 'return_annotation' は任意の Python オブジェクトをと
     ることができます。この引数は、呼び出し可能オブジェクトの "戻り値" に
     対するアノテーションを表します。

     ‘Signature’ オブジェクトは 'immutable' すなわち変更不可能です。変更
     されたコピーを生成するためには、 *note Signature.replace(): 4a2f. ま
     たは *note copy.replace(): 1c0. を使ってください。

     バージョン 3.5 で変更: ‘Signature’ オブジェクトは pickle 可能かつ ハ
     ッシュ可能 になりました。

      -- の属性: empty

          return アノテーションがないことを指すクラスレベルの特殊マーカ
          です。

      -- の属性: parameters

          パラメータの名前と対応する *note Parameter: 4e4. オブジェクト
          の、順序ありマッピングです。パラメータは、キーワード専用パラメ
          ータも含めて、厳密な定義順に現れます。

          バージョン 3.7 で変更: バージョン 3.7 までは、Python はキーワ
          ード専用パラメータだけしか順序を保つことを明確に保証していませ
          んでした。とはいえ Python 3 では事実上パラメータの順序は維持さ
          れていました。

      -- の属性: return_annotation

          呼び出し可能オブジェクトの "return" アノテーションです。呼び出
          し可能オブジェクトに "return" アノテーションがない場合、この属
          性は *note Signature.empty: 4a30. に設定されます。

      -- メソッド: bind (*args, **kwargs)

          位置引数およびキーワード引数からパラメータへのマッピングを生成
          します。 ‘*args’ と ‘**kwargs’ がシグネチャに一致した場合
          *note BoundArguments: 1275. を返します。引数がシグネチャと一致
          しない場合は *note TypeError: 198. 例外を送出します。

      -- メソッド: bind_partial (*args, **kwargs)

          *note Signature.bind(): 1892. と同様に動作しますが、いくつかの
          必要な引数を省略することができます (*note functools.partial():
          217. の振る舞いによく似たものです) 。 *note BoundArguments:
          1275. を返します。引数がシグネチャと一致しない場合は *note
          TypeError: 198. 例外を送出します。

      -- メソッド: replace (*[, parameters][, return_annotation])

          *note replace(): 4a2f. メソッドが呼び出されたインスタンスから
          、新しい *note Signature: 4e3. インスタンスを生成します。元に
          なるシグネチャのプロパティをオーバーライドするために異なる
          'parameters' や 'return_annotation' を渡すことが可能です。
          ‘return_annotation’ をコピーされた ‘Signature’ インスタンスか
          ら削除したい場合、 *note Signature.empty: 4a30. を渡してくださ
          い。

               >>> def test(a, b):
               ...     pass
               ...
               >>> sig = signature(test)
               >>> new_sig = sig.replace(return_annotation="new return anno")
               >>> str(new_sig)
               "(a, b) -> 'new return anno'"

          *note Signature: 4e3. オブジェクトのコピーは、汎用の関数 *note
          copy.replace(): 1c0. でもサポートされています。

      -- メソッド: format (*, max_width=None,
               quote_annotation_strings=True)

          *note Signature: 4e3. オブジェクトの文字列表現を生成します。

          'max_width' が指定されると、メソッドはシグネチャをそれぞれの行
          が最大 'max_width' 文字になるようにフォーマットを試みます。シ
          グネチャが 'max_width' よりも長くなってしまう場合は、全てのパ
          ラメータごとに改行されます。

          'quote_annotation_strings' が偽の場合、文字列で表されたシグネ
          チャの中の *note アノテーション: 15c. は、最初と最後のクォート
          記号無しで表示されます。この挙動は、シグネチャが *note STRING:
          160. フォーマットで作られた場合や ‘from __future__ import
          annotations’ が使われた場合に有用です。

          Added in version 3.13.

          バージョン 3.14 で変更: 'unquote_annotations' パラメータが追加
          されました。

      -- メソッド: classmethod from_callable (obj, *,
               follow_wrapped=True, globals=None, locals=None,
               eval_str=False)

          与えられた呼び出し可能オブジェクト 'obj' に対する *note
          Signature: 4e3. (またはそのサブクラスの) オブジェクトを返しま
          す。

          このメソッドは *note Signature: 4e3. からサブクラスを作る作業
          を簡素化します:

               class MySignature(Signature):
                   pass
               sig = MySignature.from_callable(sum)
               assert isinstance(sig, MySignature)

          このメソッドの振る舞いは、上記を除けば *note signature(): 22f.
          と同じです。

          Added in version 3.5.

          バージョン 3.10 で変更: 'globals', 'locals', および 'eval_str'
          パラメータが追加されました。

 -- クラス: inspect.Parameter (name, kind, *, default=Parameter.empty,
          annotation=Parameter.empty)

     ‘Parameter’ オブジェクトはイミュータブル ('immutable') すなわち変更
     不可能です。 ‘Parameter’ オブジェクトを変更する代わりに、 *note
     Parameter.replace(): 4a33. や *note copy.replace(): 1c0. を使ってオ
     ブジェクトの内容を変更したコピーを作成することができます。

     バージョン 3.5 で変更: Parameter オブジェクトはピックル化可能
     (picklable) かつ ハッシュ化可能 (*note hashable: 824.) になりました
     。

      -- の属性: empty

          デフォルト値とアノテーションがないことを指すクラスレベルの特殊
          マーカです。

      -- の属性: name

          仮引数名 (文字列) です。名前は有効な Python 識別子でなければな
          りません。

          CPython は内包表記やジェネレータ式を実装するためのコードオブジ
          ェクトにおいて、 ‘.0’ という形式で暗黙のパラメータ名を生成しま
          す。

          バージョン 3.6 で変更: このモジュールにより、これら暗黙のパラ
          メータ名は ‘implicit0’ のような名前で公開されるようになりまし
          た。

      -- の属性: default

          引数のデフォルト値です。引数にデフォルト値がない場合、この属性
          は *note Parameter.empty: 4a34. に設定されます。

      -- の属性: annotation

          引数のアノテーションです。引数にアノテーションがない場合、この
          属性は *note Parameter.empty: 4a34. に設定されます。

      -- の属性: kind

          引数の値がどのようにパラメータと紐付けられるかを記述します。指
          定可能な値は *note Parameter: 4e4. を介して
          (‘Parameter.KEYWORD_ONLY’ のように) アクセス可能で、以下に示す
          順番で比較や順序付けをサポートしています:

          名前                         意味
                                       
          --------------------------------------------------------------------------------
                                       
          'POSITIONAL_ONLY'            値は位置引数として渡されなければなりません。
                                       Python の関数定義において、位置専用引数は (もし
                                       存在すれば) ‘/’ エントリの前に現れるものを指しま
                                       す。
                                       
                                       
          'POSITIONAL_OR_KEYWORD'      値をキーワードまたは位置引数として渡すことができ
                                       ます (これは Python で実装された関数の標準的な束
                                       縛動作です)。
                                       
                                       
          'VAR_POSITIONAL'             その他の仮引数に束縛されていない位置引数のタプル
                                       です。Python の関数定義における ‘*args’ 仮引数に
                                       対応します。
                                       
                                       
          'KEYWORD_ONLY'               値をキーワード引数として渡さなければなりません。
                                       キーワード専用引数は Python の関数定義において
                                       ‘*’ や ‘*args’ の後に現れる引数です。
                                       
                                       
          'VAR_KEYWORD'                その他の仮引数に束縛されていないキーワード引数の
                                       辞書です。Python の関数定義における ‘**kwargs’ 仮
                                       引数に対応します。
                                       

          例: デフォルト値を持たないキーワード専用引数を全て出力します:

               >>> def foo(a, b, *, c, d=10):
               ...     pass

               >>> sig = signature(foo)
               >>> for param in sig.parameters.values():
               ...     if (param.kind == param.KEYWORD_ONLY and
               ...                        param.default is param.empty):
               ...         print('Parameter:', param)
               Parameter: c

      -- の属性: kind.description

          *note Parameter.kind: 4a38. 列挙型の各定数を説明します。

          Added in version 3.8.

          例: 全ての引数に対する説明を出力します:

               >>> def foo(a, b, *, c, d=10):
               ...     pass

               >>> sig = signature(foo)
               >>> for param in sig.parameters.values():
               ...     print(param.kind.description)
               positional or keyword
               positional or keyword
               keyword-only
               keyword-only

      -- メソッド: replace (*[, name][, kind][, default][, annotation])

          このメソッドの呼び出し元のインスタンスをもとにして、新たな
          *note Parameter: 4e4. インスタンスを生成します。 ‘Parameter’ の
          属性をオーバーライドするには、対応する引数をこのメソッドに渡し
          てください。 ‘Parameter’ からデフォルト値やアノテーションを取
          り除きたい場合は、 *note Parameter.empty: 4a34. を渡してくださ
          い。

               >>> from inspect import Parameter
               >>> param = Parameter('foo', Parameter.KEYWORD_ONLY, default=42)
               >>> str(param)
               'foo=42'

               >>> str(param.replace()) # Will create a shallow copy of 'param'
               'foo=42'

               >>> str(param.replace(default=Parameter.empty, annotation='spam'))
               "foo: 'spam'"

          *note Parameter: 4e4. オブジェクトは汎用関数 *note
          copy.replace(): 1c0. でもサポートされています。

     バージョン 3.4 で変更: Python 3.3 では、‘kind’ が ‘POSITIONAL_ONLY’
     の場合に限り、 ‘name’ が ‘None’ であるような *note Parameter: 4e4.
     オブジェクトが許されていました。ですが、そのようなオブジェクトはも
     はや許可されていません。

 -- クラス: inspect.BoundArguments

     *note Signature.bind(): 1892. または *note
     Signature.bind_partial(): 4a32. を呼び出して得られる結果です。引数
     と関数のパラメータとの間のマッピング情報を保持します。

      -- の属性: arguments

          パラメータの名前と引数の値との間のミュータブルなマッピングです
          。明示的に紐付けされた引数だけを含みます。 *note arguments:
          b08. に対する変更は *note args: 4a3a. と *note kwargs: 4a3b. に
          反映されます。

          いかなる引数処理の目的でも、 *note Signature.parameters: 4a2e.
          とあわせて使うようにしてください。

               注釈: *note Signature.bind(): 1892. または *note
               Signature.bind_partial(): 4a32. でデフォルト値をあてにす
               るとされた引数は、スキップされます。それらをマッピングに
               加えたい場合は、必要に応じて *note
               BoundArguments.apply_defaults(): 1016. を使ってください。

          バージョン 3.9 で変更: *note arguments: b08. の型が *note
          dict: 183. になりました。以前は *note collections.OrderedDict:
          7f3. 型でした。

      -- の属性: args

          位置引数の値のタプルです。*note arguments: b08. 属性から動的に
          計算されます。

      -- の属性: kwargs

          キーワード引数の値の辞書です。 *note arguments: b08. 属性から
          動的に計算されます。位置引数として渡すことができる引数は、
          *note args: 4a3a. に含まれることに注意してください。

      -- の属性: signature

          親の *note Signature: 4e3. オブジェクトへの参照です。

      -- メソッド: apply_defaults ()

          存在しない引数のデフォルト値を設定します。

          可変長位置引数 (‘*args’) に対するデフォルト値は、空のタプルで
          す。

          可変長キーワード引数 (‘**kwargs’) に対するデフォルト値は、空の
          辞書です。

               >>> def foo(a, b='ham', *args): pass
               >>> ba = inspect.signature(foo).bind('spam')
               >>> ba.apply_defaults()
               >>> ba.arguments
               {'a': 'spam', 'b': 'ham', 'args': ()}

          Added in version 3.5.

     *note args: 4a3a. と *note kwargs: 4a3b. の2つのプロパティは、関数
     の呼び出しに使うことができます:

          def test(a, *, b):
              ...

          sig = signature(test)
          ba = sig.bind(10, b=20)
          test(*ba.args, **ba.kwargs)

参考
....

PEP 362(1): - 関数シグニチャオブジェクト

     仕様の詳細、実装の詳細および使用例を示しています。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0362/


File: python.info,  Node: クラスと関数<2>,  Next: インタープリタスタック,  Prev: Signature オブジェクトで呼び出し可能オブジェクトを内省する,  Up: inspect --- 活動中のオブジェクトを調査する

5.29.14.4 クラスと関数
......................

 -- の関数: inspect.getclasstree (classes, unique=False)

     リストで指定したクラスの継承関係から、ネストしたリストを作成します
     。ネストしたリストには、直前の要素から派生したクラスが格納されます
     。各要素は長さ2のタプルで、クラスと基底クラスのタプルを格納していま
     す。'unique' が真の場合、各クラスは戻り値のリスト内に一つだけしか格
     納されません。真でなければ、多重継承を利用したクラスとその派生クラ
     スは複数回格納される場合があります。

 -- の関数: inspect.getfullargspec (func)

     Python 関数のパラメータの名前とデフォルト値を取得します。 *note
     named tuple: 85e. を返します:

     ‘FullArgSpec(args, varargs, varkw, defaults, kwonlyargs,
     kwonlydefaults, annotations)’

     'args' は位置引数の名前のリストです。 'varargs' は ‘*’ で始まる可変
     長位置引数の名前で、この引数を受け付けない場合は ‘None’ です。
     'varkw' は ‘**’ で始まる可変長キーワード引数の名前で、この引数を受
     け付けない場合は ‘None’ です。 'defaults' は末尾 'n' 個の位置引数に
     対応するデフォルト引数の 'n'-タプルで、 そのようなデフォルト値が定
     義されていない場合は ‘None’ です。 'kwonlyargs' は宣言順に並んだキ
     ーワード専用引数の名前のリストです。 'kwonlydefaults' はそれらに対
     して値が渡されなかった場合の、 'kwonlyargs' の名前からデフォルト値
     へのマッピングを行う辞書です。 'annotations' 引数名からアノテーショ
     ンへのマッピングを行う辞書です。特殊キー ‘"return"’ は (もしあれば)
     関数の戻り値に対するアノテーションを伝えるために使われます。

     *note signature(): 22f. と *note Signature オブジェクト: 4a2c. が呼
     び出し可能オブジェクトのイントロスペクション (実行時オブジェクト調
     査) のための推奨される API を提供しており、かつ拡張モジュール API で
     ときどき遭遇する追加の振る舞い (位置専用引数など) もサポートしてい
     ることに注意してください。この関数は、主に Python 2 の ‘inspect’ モ
     ジュール API との互換性を維持することが必要なコードで利用されるため
     に残されています。

     バージョン 3.4 で変更: この関数は *note signature(): 22f. をもとに
     実装されています。ただし、 ‘__wrapped__’ 属性を無視します。また、束
     縛されたメソッドに対するシグネチャの出力において、すでに束縛された
     最初のパラメータを含みます。

     バージョン 3.6 で変更: This method was previously documented as
     deprecated in favour of *note signature(): 22f. in Python 3.5, but
     that decision has been reversed in order to restore a clearly
     supported standard interface for single-source Python 2/3 code
     migrating away from the legacy ‘getargspec()’ API.

     バージョン 3.7 で変更: バージョン 3.7 までは、Python はキーワード専
     用パラメータだけしか順序を保つことを明確に保証していませんでした。
     とはいえ Python 3 では事実上パラメータの順序は維持されていました。

 -- の関数: inspect.getargvalues (frame)

     指定したフレームに渡された引数の情報を取得します。戻り値は *note
     名前付きタプル: 85e. ‘ArgInfo(args, varargs, keywords, locals)’ で
     す。'args' は引数名のリストです。 'varargs' と 'keywords' は ‘*’ 引
     数と ‘**’ 引数の名前で、引数がなければ ‘None’ となります。 'locals'
     は指定したフレームのローカル変数の辞書です。

          注釈: この関数は Python 3.5 において、不注意により非推奨とされ
          ていました。

 -- の関数: inspect.formatargvalues (args[, varargs, varkw, locals,
          formatarg, formatvarargs, formatvarkw, formatvalue])

     *note getargvalues(): 10bf. で取得した4つの値を読みやすく整形します
     。 format* 引数はオプションで、名前と値を文字列に変換する整形関数を
     指定することができます。

          注釈: この関数は Python 3.5 において、不注意により非推奨とされ
          ていました。

 -- の関数: inspect.getmro (cls)

     'cls' クラスの基底クラス ('cls' 自身も含む) を、メソッドの優先順位
     順に並べたタプルを返します。結果のリスト内で各クラスは一度だけ格納
     されます。メソッドの優先順位はクラスの型によって異なります。非常に
     特殊なユーザ定義のメタクラスを使用していない限り、'cls' が戻り値の
     先頭要素となります。

 -- の関数: inspect.getcallargs (func, /, *args, **kwds)

     'args' と 'kwds' を、あたかもそれらをパラメータとして呼ばれたかのよ
     うに、 Python 関数またはメソッド 'func' に束縛します。また、第一引
     数 (通常 ‘self’ という名前です) を関連するインスタンスに束縛します
     。引数名 (もし存在すれば ‘*’ や ‘**’ で始まる引数も含む) を 'args'
     および 'kwds' で与えられた値にマッピングする辞書を返します。 'func'
     を不正に呼び出した場合、すなわち ‘func(*args, **kwds)’ の呼び出しが
     不完全なシグネチャにより例外を送出するような場合は、同じ型の例外を
     同一またはよく似たメッセージとともに送出します。以下は使用例です:

          >>> from inspect import getcallargs
          >>> def f(a, b=1, *pos, **named):
          ...     pass
          ...
          >>> getcallargs(f, 1, 2, 3) == {'a': 1, 'named': {}, 'b': 2, 'pos': (3,)}
          True
          >>> getcallargs(f, a=2, x=4) == {'a': 2, 'named': {'x': 4}, 'b': 1, 'pos': ()}
          True
          >>> getcallargs(f)
          Traceback (most recent call last):
          ...
          TypeError: f() missing 1 required positional argument: 'a'

     Added in version 3.2.

     バージョン 3.5 で非推奨: 代わりに *note Signature.bind(): 1892. や
     *note Signature.bind_partial(): 4a32. を使ってください。

 -- の関数: inspect.getclosurevars (func)

     Python 関数またはメソッド 'func' の外部の名前参照と、それらの現在の
     値のマッピングを取得します。 *note named tuple: 85e.
     ‘ClosureVars(nonlocals, globals, builtins, unbound)’ を返します。参
     照名を、 'nonlocals' はレキシカルクロージャ変数、すなわち外側のスコ
     ープで定義された変数の値にマップし、 'globals' は関数が属するモジュ
     ールのグローバル変数にマップし、 'builtins' は関数本体から見える組
     み込み変数にマップします。 'unbound' は、現在のモジュールにおけるグ
     ローバル変数や組み込み変数において解決できないにもかかわらず、関数
     内で参照されている名前の集合です。

     'func' が Python の関数やメソッドでない場合 *note TypeError: 198. が
     送出されます。

     Added in version 3.3.

 -- の関数: inspect.unwrap (func, *, stop=None)

     'func' によりラップされたオブジェクトを取得します。 ‘__wrapped__’ 属
     性の連鎖をたどり、ラップの連鎖の最後にあるオブジェクトを返します。

     'stop' はオプションで指定可能なコールバック関数で、ラッパーの連鎖に
     おけるオブジェクトをただひとつの引数として取ります。このコールバッ
     ク関数が真値を返した段階で、オブジェクトのアンラップを早期に終了さ
     せることができます。コールバック関数が真値を返さない場合は、通常通
     りラッパーの連鎖における最後のオブジェクトを返します。例えば、
     *note signature(): 22f. は、オブジェクトに ‘__signature__’ 属性が定
     義されていたらオブジェクトのアンラップを停止するために、このオプシ
     ョンを使っています。

     循環を検知した場合は *note ValueError: 2ec. を送出します。

     Added in version 3.4.

 -- の関数: inspect.get_annotations (obj, *, globals=None, locals=None,
          eval_str=False, format=annotationlib.Format.VALUE)

     オブジェクトに対するアノテーション辞書を計算します。

     これは *note annotationlib.get_annotations(): 459. のエイリアスです
     ; 詳細はその関数のドキュメントを参照してください。

          注意: This function may execute arbitrary code contained in
          annotations.  See *note Security implications of introspecting
          annotations: 4518. for more information.

     Added in version 3.10.

     バージョン 3.14 で変更: この関数は *note
     annotationlib.get_annotations(): 459. のエイリアスになりました。
     ‘inspect.get_annotations’ として呼び出しても、引き続き正しく動作し
     ます。


File: python.info,  Node: インタープリタスタック,  Next: 属性の静的なフェッチ,  Prev: クラスと関数<2>,  Up: inspect --- 活動中のオブジェクトを調査する

5.29.14.5 インタープリタスタック
................................

以下の関数のうちいくつかは *note FrameInfo: 85c. オブジェクトを返します
。これらのオブジェクトは、後方互換性のために ‘positions’ を除く全ての属
性に対して、タプル的な演算を許可します。この振る舞いは非推奨と考えられて
おり、将来削除されるかもしれません。

 -- クラス: inspect.FrameInfo

      -- の属性: frame

          そのレコードに相当する *note フレームオブジェクト: 8ef. です。

      -- の属性: filename

          このレコードに相当するフレームによって実行されるコードのファイ
          ル名です。

      -- の属性: lineno

          このレコードに相当するフレームによって実行されるコードの、現在
          の行の行番号です。

      -- の属性: function

          このレコードに相当するフレームによって実行される関数名です。

      -- の属性: code_context

          このレコードに相当するフレームによって実行される、ソースコード
          から生成されたコンテキストの行のリストです。

      -- の属性: index

          *note code_context: 4a47. リストにおいて実行される現在の行のイ
          ンデックスです。

      -- の属性: positions

          このレコードに相当するフレームによって実行される命令に結びつい
          た *note dis.Positions: 1940. オブジェクトで、開始行番号、終了
          行番号、開始カラムオフセット、終了カラムオフセットを含んでいま
          す。

     バージョン 3.5 で変更: *note tuple: 614. ではなく *note named
     tuple: 85e. を返すようになりました。

     バージョン 3.11 で変更: ‘FrameInfo’ はクラスインスタンスになりまし
     た (ただしそれ以前の *note named tuple: 85e. とは後方互換です) 。

 -- クラス: inspect.Traceback

      -- の属性: filename

          このトレースバックに対応するフレームによって実行されるコードの
          ファイル名です。

      -- の属性: lineno

          このトレースバックに対応するフレームによって実行されるコードの
          、現在の行の行番号です。

      -- の属性: function

          このトレースバックに対応するフレームによって実行される関数名で
          す。

      -- の属性: code_context

          このトレースバックに対応するフレームによって実行される、ソース
          コードから生成されたコンテキストの行のリストです。

      -- の属性: index

          *note code_context: 4a4d. リストにおいて実行される現在の行のイ
          ンデックスです。

      -- の属性: positions

          このトレースバックに対応するフレームによって実行される命令の開
          始行番号、終了行番号、開始カラムオフセット、終了カラムオフセッ
          トを含む *note dis.Positions: 1940. オブジェクトです。

     バージョン 3.11 で変更: ‘Traceback’ はクラスインスタンスになりまし
     た (ただしそれ以前の *note named tuple: 85e. とは後方互換です) 。

     注釈: フレームレコードの最初の要素などのフレームオブジェクトへの参
     照を保存すると、循環参照になってしまう場合があります。循環参照がで
     きると、Python の循環参照検出機能を有効にしていたとしても関連するオ
     ブジェクトが参照しているすべてのオブジェクトが解放されにくくなり、
     明示的に参照を削除しないとメモリ消費量が増大する恐れがあります。

     参照の削除を Python の循環参照検出機能にまかせることもできますが、
     *note finally: 1b0. 節で循環参照を解除すれば確実にフレーム (とその
     ローカル変数) は削除されます。また、循環参照検出機能は Python のコ
     ンパイルオプションや *note gc.disable(): 4a0f. で無効とされている場
     合がありますので注意が必要です。例:

          def handle_stackframe_without_leak():
              frame = inspect.currentframe()
              try:
                  # フレーム上で何か処理をします
              finally:
                  del frame

     (たとえばトレースバックをあとで表示したいなどの理由で) フレームを削
     除せずにとっておきたい場合は、 *note frame.clear(): 585. メソッドを
     使って循環参照を壊すこともできます。

以下の関数でオプション引数 'context' には、戻り値のソース行リストに何行
分のソースを含めるかを指定します。ソース行リストには、実行中の行を中心と
して指定された行数分のリストを返します。

 -- の関数: inspect.getframeinfo (frame, context=1)

     フレームまたはトレースバックオブジェクトの情報を取得します。 *note
     Traceback: 85d. オブジェクトが返されます。

     バージョン 3.11 で変更: 名前付きタプルの代わりに *note Traceback:
     85d. オブジェクトが返されるようになりました。

 -- の関数: inspect.getouterframes (frame, context=1)

     指定したフレームと、その外側の全フレームの *note FrameInfo: 85c. オ
     ブジェクトのリストを取得します。外側のフレームとは 'frame' が生成さ
     れるまでのすべての関数呼び出しを示します。戻り値のリストの先頭は
     'frame' のフレームレコードで、末尾の要素は 'frame' のスタックにある
     最も外側のフレームのフレームレコードとなります。

     バージョン 3.5 で変更: *note 名前付きタプル: 85e. ‘FrameInfo(frame,
     filename, lineno, function, code_context, index)’ のリストが返され
     ます。

     バージョン 3.11 で変更: *note FrameInfo: 85c. オブジェクトのリスト
     が返されるようになりました。

 -- の関数: inspect.getinnerframes (traceback, context=1)

     トレースバックのフレームと、その内側の全フレームの *note FrameInfo:
     85c. オブジェクトのリストを取得します。内のフレームとは 'frame' か
     ら続く一連の関数呼び出しを示します。戻り値のリストの先頭は
     'traceback' のフレームレコードで、末尾の要素は例外が発生した位置を
     示します。

     バージョン 3.5 で変更: *note 名前付きタプル: 85e. ‘FrameInfo(frame,
     filename, lineno, function, code_context, index)’ のリストが返され
     ます。

     バージョン 3.11 で変更: *note FrameInfo: 85c. オブジェクトのリスト
     が返されるようになりました。

 -- の関数: inspect.currentframe ()

     呼び出し元のフレームオブジェクトを返します。

     この関数はインタプリタの Python スタックフレームサポートに依存しま
     す。これは Python のすべての実装に存在している保証はありません。
     Python スタックフレームサポートのない環境では、この関数は ‘None’ を
     返します。

 -- の関数: inspect.stack (context=1)

     呼び出し元スタックの *note FrameInfo: 85c. オブジェクトのリストを返
     します。最初の要素は呼び出し元のフレームレコードで、末尾の要素はス
     タックにある最も外側のフレームのフレームレコードとなります。

     バージョン 3.5 で変更: *note 名前付きタプル: 85e. ‘FrameInfo(frame,
     filename, lineno, function, code_context, index)’ のリストが返され
     ます。

     バージョン 3.11 で変更: *note FrameInfo: 85c. オブジェクトのリスト
     が返されるようになりました。

 -- の関数: inspect.trace (context=1)

     実行中のフレームと処理中の例外が発生したフレームの間の *note
     FrameInfo: 85c. オブジェクトのリストを返します。最初の要素は呼び出
     し元のフレームレコードで、末尾の要素は例外が発生した位置を示します
     。

     バージョン 3.5 で変更: *note 名前付きタプル: 85e. ‘FrameInfo(frame,
     filename, lineno, function, code_context, index)’ のリストが返され
     ます。

     バージョン 3.11 で変更: *note FrameInfo: 85c. オブジェクトのリスト
     が返されるようになりました。


File: python.info,  Node: 属性の静的なフェッチ,  Next: Current State of Generators Coroutines and Asynchronous Generators,  Prev: インタープリタスタック,  Up: inspect --- 活動中のオブジェクトを調査する

5.29.14.6 属性の静的なフェッチ
..............................

*note getattr(): dca. や *note hasattr(): 6f9. は属性の存在確認や属性値
の取得に際してコードの実行を伴うことがあります。プロパティなどのデスクリ
プタが呼び出され、また *note __getattr__(): 6fa. や *note
__getattribute__(): dcb. が呼び出されたりするかもしれません。

たとえばドキュメントツールのように受動的なイントロスペクションをしたい場
合、この振る舞いは不便です。 *note getattr_static(): 6bc. は *note
getattr(): dca. と同じシグネチャを持ちますが、属性値を取得する際にコード
の実行をしないようにします。

 -- の関数: inspect.getattr_static (obj, attr, default=None)

     Retrieve attributes without triggering dynamic lookup via the
     descriptor protocol, *note __getattr__(): 6fa. or *note
     __getattribute__(): dcb.

     Note: this function may not be able to retrieve all attributes that
     getattr can fetch (like dynamically created attributes) and may
     find attributes that getattr can't (like descriptors that raise
     AttributeError).  It can also return descriptors objects instead of
     instance members.

     If the instance *note __dict__: 77d. is shadowed by another member
     (for example a property) then this function will be unable to find
     instance members.

     Added in version 3.2.

*note getattr_static(): 6bc. does not resolve descriptors, for example
slot descriptors or getset descriptors on objects implemented in C. The
descriptor object is returned instead of the underlying attribute.

You can handle these with code like the following.  Note that for
arbitrary getset descriptors invoking these may trigger code execution:

     # example code for resolving the builtin descriptor types
     class _foo:
         __slots__ = ['foo']

     slot_descriptor = type(_foo.foo)
     getset_descriptor = type(type(open(__file__)).name)
     wrapper_descriptor = type(str.__dict__['__add__'])
     descriptor_types = (slot_descriptor, getset_descriptor, wrapper_descriptor)

     result = getattr_static(some_object, 'foo')
     if type(result) in descriptor_types:
         try:
             result = result.__get__()
         except AttributeError:
             # descriptors can raise AttributeError to
             # indicate there is no underlying value
             # in which case the descriptor itself will
             # have to do
             pass


File: python.info,  Node: Current State of Generators Coroutines and Asynchronous Generators,  Next: Code Objects Bit Flags,  Prev: 属性の静的なフェッチ,  Up: inspect --- 活動中のオブジェクトを調査する

5.29.14.7 Current State of Generators, Coroutines, and Asynchronous Generators
..............................................................................

When implementing coroutine schedulers and for other advanced uses of
generators, it is useful to determine whether a generator is currently
executing, is waiting to start or resume or execution, or has already
terminated.  *note getgeneratorstate(): 144e. allows the current state
of a generator to be determined easily.

 -- の関数: inspect.getgeneratorstate (generator)

     ジェネレータイテレータの現在の状態を取得します。

     取り得る状態は:

        * GEN_CREATED: 実行開始を待機しています。

        * GEN_RUNNING: インタープリタによって現在実行されています。

        * GEN_SUSPENDED: yield 式で現在サスペンドされています。

        * GEN_CLOSED: 実行が完了しました。

     Added in version 3.2.

 -- の関数: inspect.getcoroutinestate (coroutine)

     Get current state of a coroutine object.  The function is intended
     to be used with coroutine objects created by *note async def: 7ed.
     functions, but will accept any coroutine-like object that has
     ‘cr_running’ and ‘cr_frame’ attributes.

     取り得る状態は:

        * CORO_CREATED: 実行開始を待機しています。

        * CORO_RUNNING: インタープリタにより現在実行中です。

        * CORO_SUSPENDED: await 式により現在停止中です。

        * CORO_CLOSED: 実行が完了しました。

     Added in version 3.5.

 -- の関数: inspect.getasyncgenstate (agen)

     Get current state of an asynchronous generator object.  The
     function is intended to be used with asynchronous iterator objects
     created by *note async def: 7ed. functions which use the *note
     yield: bc2. statement, but will accept any asynchronous
     generator-like object that has ‘ag_running’ and ‘ag_frame’
     attributes.

     取り得る状態は:

        * AGEN_CREATED: Waiting to start execution.

        * AGEN_RUNNING: Currently being executed by the interpreter.

        * AGEN_SUSPENDED: Currently suspended at a yield expression.

        * AGEN_CLOSED: Execution has completed.

     Added in version 3.12.

ジェネレータの現在の内部状態を問い合わせることも出来ます。これは主に内部
状態が期待通り更新されているかどうかを確認するためのテストの目的に有用で
す。

 -- の関数: inspect.getgeneratorlocals (generator)

     Get the mapping of live local variables in 'generator' to their
     current values.  A dictionary is returned that maps from variable
     names to values.  This is the equivalent of calling *note locals():
     46f. in the body of the generator, and all the same caveats apply.

     If 'generator' is a *note generator: 126c. with no currently
     associated frame, then an empty dictionary is returned.  *note
     TypeError: 198. is raised if 'generator' is not a Python generator
     object.

     'CPython 実装の詳細:' This function relies on the generator
     exposing a Python stack frame for introspection, which isn't
     guaranteed to be the case in all implementations of Python.  In
     such cases, this function will always return an empty dictionary.

     Added in version 3.3.

 -- の関数: inspect.getcoroutinelocals (coroutine)

     This function is analogous to *note getgeneratorlocals(): 12ed, but
     works for coroutine objects created by *note async def: 7ed.
     functions.

     Added in version 3.5.

 -- の関数: inspect.getasyncgenlocals (agen)

     This function is analogous to *note getgeneratorlocals(): 12ed, but
     works for asynchronous generator objects created by *note async
     def: 7ed. functions which use the *note yield: bc2. statement.

     Added in version 3.12.


File: python.info,  Node: Code Objects Bit Flags,  Next: Buffer flags,  Prev: Current State of Generators Coroutines and Asynchronous Generators,  Up: inspect --- 活動中のオブジェクトを調査する

5.29.14.8 Code Objects Bit Flags
................................

Python code objects have a *note co_flags: 18db. attribute, which is a
bitmap of the following flags:

 -- データ: inspect.CO_OPTIMIZED

     The code object is optimized, using fast locals.

 -- データ: inspect.CO_NEWLOCALS

     If set, a new dict will be created for the frame's *note f_locals:
     4a5. when the code object is executed.

 -- データ: inspect.CO_VARARGS

     The code object has a variable positional parameter (‘*args’-like).

 -- データ: inspect.CO_VARKEYWORDS

     The code object has a variable keyword parameter (‘**kwargs’-like).

 -- データ: inspect.CO_NESTED

     The flag is set when the code object is a nested function.

 -- データ: inspect.CO_GENERATOR

     The flag is set when the code object is a generator function, i.e.
     a generator object is returned when the code object is executed.

 -- データ: inspect.CO_COROUTINE

     The flag is set when the code object is a coroutine function.  When
     the code object is executed it returns a coroutine object.  See PEP
     492(1) for more details.

     Added in version 3.5.

 -- データ: inspect.CO_ITERABLE_COROUTINE

     The flag is used to transform generators into generator-based
     coroutines.  Generator objects with this flag can be used in
     ‘await’ expression, and can ‘yield from’ coroutine objects.  See
     PEP 492(2) for more details.

     Added in version 3.5.

 -- データ: inspect.CO_ASYNC_GENERATOR

     The flag is set when the code object is an asynchronous generator
     function.  When the code object is executed it returns an
     asynchronous generator object.  See PEP 525(3) for more details.

     Added in version 3.6.

 -- データ: inspect.CO_HAS_DOCSTRING

     The flag is set when there is a docstring for the code object in
     the source code.  If set, it will be the first item in *note
     co_consts: 189b.

     Added in version 3.14.

 -- データ: inspect.CO_METHOD

     The flag is set when the code object is a function defined in class
     scope.

     Added in version 3.14.

     注釈: The flags are specific to CPython, and may not be defined in
     other Python implementations.  Furthermore, the flags are an
     implementation detail, and can be removed or deprecated in future
     Python releases.  It's recommended to use public APIs from the
     ‘inspect’ module for any introspection needs.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0492/

   (2) https://peps.python.org/pep-0492/

   (3) https://peps.python.org/pep-0525/


File: python.info,  Node: Buffer flags,  Next: コマンドライン・インターフェース<10>,  Prev: Code Objects Bit Flags,  Up: inspect --- 活動中のオブジェクトを調査する

5.29.14.9 Buffer flags
......................

 -- クラス: inspect.BufferFlags

     This is an *note enum.IntFlag: e9a. that represents the flags that
     can be passed to the *note __buffer__(): 68c. method of objects
     implementing the *note buffer protocol: 260.

     The meaning of the flags is explained at *note
     バッファリクエストのタイプ: 1249.

      -- の属性: SIMPLE

      -- の属性: WRITABLE

      -- の属性: FORMAT

      -- の属性: ND

      -- の属性: STRIDES

      -- の属性: C_CONTIGUOUS

      -- の属性: F_CONTIGUOUS

      -- の属性: ANY_CONTIGUOUS

      -- の属性: INDIRECT

      -- の属性: CONTIG

      -- の属性: CONTIG_RO

      -- の属性: STRIDED

      -- の属性: STRIDED_RO

      -- の属性: RECORDS

      -- の属性: RECORDS_RO

      -- の属性: FULL

      -- の属性: FULL_RO

      -- の属性: READ

      -- の属性: WRITE

     Added in version 3.12.


File: python.info,  Node: コマンドライン・インターフェース<10>,  Prev: Buffer flags,  Up: inspect --- 活動中のオブジェクトを調査する

5.29.14.10 コマンドライン・インターフェース
...........................................

The ‘inspect’ module also provides a basic introspection capability from
the command line.

By default, accepts the name of a module and prints the source of that
module.  A class or function within the module can be printed instead by
appended a colon and the qualified name of the target object.

 -- Option: --details

     Print information about the specified object rather than the source
     code


File: python.info,  Node: annotationlib --- Functionality for introspecting annotations,  Next: site --- サイト固有の設定フック,  Prev: inspect --- 活動中のオブジェクトを調査する,  Up: Python ランタイムサービス

5.29.15 ‘annotationlib’ -- Functionality for introspecting annotations
----------------------------------------------------------------------

Added in version 3.14.

'Source code:' Lib/annotationlib.py(1)

__________________________________________________________________

The ‘annotationlib’ module provides tools for introspecting *note
annotations: 15c. on modules, classes, and functions.

Annotations are *note lazily evaluated: 685. and often contain forward
references to objects that are not yet defined when the annotation is
created.  This module provides a set of low-level tools that can be used
to retrieve annotations in a reliable way, even in the presence of
forward references and other edge cases.

This module supports retrieving annotations in three main formats (see
*note Format: 230.), each of which works best for different use cases:

   * *note VALUE: 15e. evaluates the annotations and returns their
     value.  This is most straightforward to work with, but it may raise
     errors, for example if the annotations contain references to
     undefined names.

   * *note FORWARDREF: 15f. returns *note ForwardRef: 1776. objects for
     annotations that cannot be resolved, allowing you to inspect the
     annotations without evaluating them.  This is useful when you need
     to work with annotations that may contain unresolved forward
     references.

   * *note STRING: 160. returns the annotations as a string, similar to
     how it would appear in the source file.  This is useful for
     documentation generators that want to display annotations in a
     readable way.

The *note get_annotations(): 459. function is the main entry point for
retrieving annotations.  Given a function, class, or module, it returns
an annotations dictionary in the requested format.  This module also
provides functionality for working directly with the *note annotate
function: 15d. that is used to evaluate annotations, such as *note
get_annotate_from_class_namespace(): 45b. and *note
call_annotate_function(): 17be, as well as the *note
call_evaluate_function(): 44f0. function for working with *note evaluate
functions: 44ef.

     注意: Most functionality in this module can execute arbitrary code;
     see *note the security section: 4518. for more information.

参考
....

PEP 649(2) proposed the current model for how annotations work in
Python.

PEP 749(3) expanded on various aspects of PEP 649(4) and introduced the
‘annotationlib’ module.

*note Annotations Best Practices: 9d9. provides best practices for
working with annotations.

typing-extensions(5) provides a backport of *note get_annotations():
459. that works on earlier versions of Python.

* Menu:

* Annotation semantics::
* クラス: クラス<5>.
* 関数: 関数<12>.
* レシピ: レシピ<3>.
* Limitations of the STRING format::
* Limitations of the FORWARDREF format::
* Security implications of introspecting annotations::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/annotationlib.py

   (2) https://peps.python.org/pep-0649/

   (3) https://peps.python.org/pep-0749/

   (4) https://peps.python.org/pep-0649/

   (5) https://pypi.org/project/typing-extensions/


File: python.info,  Node: Annotation semantics,  Next: クラス<5>,  Up: annotationlib --- Functionality for introspecting annotations

5.29.15.1 Annotation semantics
..............................

The way annotations are evaluated has changed over the history of Python
3, and currently still depends on a *note future import: 45d.  There
have been execution models for annotations:

   * 'Stock semantics' (default in Python 3.0 through 3.13; see PEP
     3107(1) and PEP 526(2)): Annotations are evaluated eagerly, as they
     are encountered in the source code.

   * 'Stringified annotations' (used with ‘from __future__ import
     annotations’ in Python 3.7 and newer; see PEP 563(3)): Annotations
     are stored as strings only.

   * 'Deferred evaluation' (default in Python 3.14 and newer; see PEP
     649(4) and PEP 749(5)): Annotations are evaluated lazily, only when
     they are accessed.

As an example, consider the following program:

     def func(a: Cls) -> None:
         print(a)

     class Cls: pass

     print(func.__annotations__)

This will behave as follows:

   * Under stock semantics (Python 3.13 and earlier), it will throw a
     *note NameError: 452. at the line where ‘func’ is defined, because
     ‘Cls’ is an undefined name at that point.

   * Under stringified annotations (if ‘from __future__ import
     annotations’ is used), it will print ‘{'a': 'Cls', 'return':
     'None'}’.

   * Under deferred evaluation (Python 3.14 and later), it will print
     ‘{'a': <class 'Cls'>, 'return': None}’.

Stock semantics were used when function annotations were first
introduced in Python 3.0 (by PEP 3107(6)) because this was the simplest,
most obvious way to implement annotations.  The same execution model was
used when variable annotations were introduced in Python 3.6 (by PEP
526(7)).  However, stock semantics caused problems when using
annotations as type hints, such as a need to refer to names that are not
yet defined when the annotation is encountered.  In addition, there were
performance problems with executing annotations at module import time.
Therefore, in Python 3.7, PEP 563(8) introduced the ability to store
annotations as strings using the ‘from __future__ import annotations’
syntax.  The plan at the time was to eventually make this behavior the
default, but a problem appeared: stringified annotations are more
difficult to process for those who introspect annotations at runtime.
An alternative proposal, PEP 649(9), introduced the third execution
model, deferred evaluation, and was implemented in Python 3.14.
Stringified annotations are still used if ‘from __future__ import
annotations’ is present, but this behavior will eventually be removed.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3107/

   (2) https://peps.python.org/pep-0526/

   (3) https://peps.python.org/pep-0563/

   (4) https://peps.python.org/pep-0649/

   (5) https://peps.python.org/pep-0749/

   (6) https://peps.python.org/pep-3107/

   (7) https://peps.python.org/pep-0526/

   (8) https://peps.python.org/pep-0563/

   (9) https://peps.python.org/pep-0649/


File: python.info,  Node: クラス<5>,  Next: 関数<12>,  Prev: Annotation semantics,  Up: annotationlib --- Functionality for introspecting annotations

5.29.15.2 クラス
................

 -- クラス: annotationlib.Format

     An *note IntEnum: edb. describing the formats in which annotations
     can be returned.  Members of the enum, or their equivalent integer
     values, can be passed to *note get_annotations(): 459. and other
     functions in this module, as well as to *note __annotate__: 1983.
     functions.

      -- の属性: VALUE = 1

          Values are the result of evaluating the annotation
          expressions.

      -- の属性: VALUE_WITH_FAKE_GLOBALS = 2

          Special value used to signal that an annotate function is
          being evaluated in a special environment with fake globals.
          When passed this value, annotate functions should either
          return the same value as for the *note Format.VALUE: 15e.
          format, or raise *note NotImplementedError: 36b. to signal
          that they do not support execution in this environment.  This
          format is only used internally and should not be passed to the
          functions in this module.

      -- の属性: FORWARDREF = 3

          Values are real annotation values (as per *note Format.VALUE:
          15e. format) for defined values, and *note ForwardRef: 1776.
          proxies for undefined values.  Real objects may contain
          references to *note ForwardRef: 1776. proxy objects.

      -- の属性: STRING = 4

          Values are the text string of the annotation as it appears in
          the source code, up to modifications including, but not
          restricted to, whitespace normalizations and constant values
          optimizations.

          The exact values of these strings may change in future
          versions of Python.

     Added in version 3.14.

 -- クラス: annotationlib.ForwardRef

     A proxy object for forward references in annotations.

     Instances of this class are returned when the *note FORWARDREF:
     15f. format is used and annotations contain a name that cannot be
     resolved.  This can happen when a forward reference is used in an
     annotation, such as when a class is referenced before it is
     defined.

      -- の属性: __forward_arg__

          A string containing the code that was evaluated to produce the
          *note ForwardRef: 1776.  The string may not be exactly
          equivalent to the original source.

      -- メソッド: evaluate (*, owner=None, globals=None, locals=None,
               type_params=None, format=Format.VALUE)

          Evaluate the forward reference, returning its value.

          If the 'format' argument is *note VALUE: 15e. (the default),
          this method may throw an exception, such as *note NameError:
          452, if the forward reference refers to a name that cannot be
          resolved.  The arguments to this method can be used to provide
          bindings for names that would otherwise be undefined.  If the
          'format' argument is *note FORWARDREF: 15f, the method will
          never throw an exception, but may return a *note ForwardRef:
          1776. instance.  For example, if the forward reference object
          contains the code ‘list[undefined]’, where ‘undefined’ is a
          name that is not defined, evaluating it with the *note
          FORWARDREF: 15f. format will return
          ‘list[ForwardRef('undefined')]’.  If the 'format' argument is
          *note STRING: 160, the method will return *note
          __forward_arg__: 4a77.

          The 'owner' parameter provides the preferred mechanism for
          passing scope information to this method.  The owner of a
          *note ForwardRef: 1776. is the object that contains the
          annotation from which the *note ForwardRef: 1776. derives,
          such as a module object, type object, or function object.

          The 'globals', 'locals', and 'type_params' parameters provide
          a more precise mechanism for influencing the names that are
          available when the *note ForwardRef: 1776. is evaluated.
          'globals' and 'locals' are passed to *note eval(): 4a3,
          representing the global and local namespaces in which the name
          is evaluated.  The 'type_params' parameter is relevant for
          objects created using the native syntax for *note generic
          classes: 2377. and *note functions: 682.  It is a tuple of
          *note type parameters: 5ad. that are in scope while the
          forward reference is being evaluated.  For example, if
          evaluating a *note ForwardRef: 1776. retrieved from an
          annotation found in the class namespace of a generic class
          ‘C’, 'type_params' should be set to ‘C.__type_params__’.

          *note ForwardRef: 1776. instances returned by *note
          get_annotations(): 459. retain references to information about
          the scope they originated from, so calling this method with no
          further arguments may be sufficient to evaluate such objects.
          *note ForwardRef: 1776. instances created by other means may
          not have any information about their scope, so passing
          arguments to this method may be necessary to evaluate them
          successfully.

          If no 'owner', 'globals', 'locals', or 'type_params' are
          provided and the *note ForwardRef: 1776. does not contain
          information about its origin, empty globals and locals
          dictionaries are used.

     Added in version 3.14.


File: python.info,  Node: 関数<12>,  Next: レシピ<3>,  Prev: クラス<5>,  Up: annotationlib --- Functionality for introspecting annotations

5.29.15.3 関数
..............

 -- の関数: annotationlib.annotations_to_string (annotations)

     Convert an annotations dict containing runtime values to a dict
     containing only strings.  If the values are not already strings,
     they are converted using *note type_repr(): 1856.  This is meant as
     a helper for user-provided annotate functions that support the
     *note STRING: 160. format but do not have access to the code
     creating the annotations.

     For example, this is used to implement the *note STRING: 160. for
     *note typing.TypedDict: 332. classes created through the functional
     syntax:

          >>> from typing import TypedDict
          >>> Movie = TypedDict("movie", {"name": str, "year": int})
          >>> get_annotations(Movie, format=Format.STRING)
          {'name': 'str', 'year': 'int'}

     Added in version 3.14.

 -- の関数: annotationlib.call_annotate_function (annotate, format, *,
          owner=None)

     Call the *note annotate function: 15d. 'annotate' with the given
     'format', a member of the *note Format: 230. enum, and return the
     annotations dictionary produced by the function.

     This helper function is required because annotate functions
     generated by the compiler for functions, classes, and modules only
     support the *note VALUE: 15e. format when called directly.  To
     support other formats, this function calls the annotate function in
     a special environment that allows it to produce annotations in the
     other formats.  This is a useful building block when implementing
     functionality that needs to partially evaluate annotations while a
     class is being constructed.

     'owner' is the object that owns the annotation function, usually a
     function, class, or module.  If provided, it is used in the *note
     FORWARDREF: 15f. format to produce a *note ForwardRef: 1776. object
     that carries more information.

     参考
     ....

     PEP 649(1) contains an explanation of the implementation technique
     used by this function.

     Added in version 3.14.

 -- の関数: annotationlib.call_evaluate_function (evaluate, format, *,
          owner=None)

     Call the *note evaluate function: 44ef. 'evaluate' with the given
     'format', a member of the *note Format: 230. enum, and return the
     value produced by the function.  This is similar to *note
     call_annotate_function(): 17be, but the latter always returns a
     dictionary mapping strings to annotations, while this function
     returns a single value.

     This is intended for use with the evaluate functions generated for
     lazily evaluated elements related to type aliases and type
     parameters:

        * *note typing.TypeAliasType.evaluate_value(): 4505, the value
          of type aliases

        * *note typing.TypeVar.evaluate_bound(): 44ee, the bound of type
          variables

        * *note typing.TypeVar.evaluate_constraints(): 44f2, the
          constraints of type variables

        * *note typing.TypeVar.evaluate_default(): 44f4, the default
          value of type variables

        * *note typing.ParamSpec.evaluate_default(): 44ff, the default
          value of parameter specifications

        * *note typing.TypeVarTuple.evaluate_default(): 44f8, the
          default value of type variable tuples

     'owner' is the object that owns the evaluate function, such as the
     type alias or type variable object.

     'format' can be used to control the format in which the value is
     returned:

          >>> type Alias = undefined
          >>> call_evaluate_function(Alias.evaluate_value, Format.VALUE)
          Traceback (most recent call last):
          ...
          NameError: name 'undefined' is not defined
          >>> call_evaluate_function(Alias.evaluate_value, Format.FORWARDREF)
          ForwardRef('undefined')
          >>> call_evaluate_function(Alias.evaluate_value, Format.STRING)
          'undefined'

     Added in version 3.14.

 -- の関数: annotationlib.get_annotate_from_class_namespace (namespace)

     Retrieve the *note annotate function: 15d. from a class namespace
     dictionary 'namespace'.  Return ‘None’ if the namespace does not
     contain an annotate function.  This is primarily useful before the
     class has been fully created (e.g., in a metaclass); after the
     class exists, the annotate function can be retrieved with
     ‘cls.__annotate__’.  See *note below: 4a7a. for an example using
     this function in a metaclass.

     Added in version 3.14.

 -- の関数: annotationlib.get_annotations (obj, *, globals=None,
          locals=None, eval_str=False, format=Format.VALUE)

     オブジェクトに対するアノテーション辞書を計算します。

     'obj' may be a callable, class, module, or other object with *note
     __annotate__: 1983. or *note __annotations__: 458. attributes.
     Passing any other object raises *note TypeError: 198.

     The 'format' parameter controls the format in which annotations are
     returned, and must be a member of the *note Format: 230. enum or
     its integer equivalent.  The different formats work as follows:

        * VALUE: ‘object.__annotations__’ is tried first; if that does
          not exist, the ‘object.__annotate__’ function is called if it
          exists.

        * FORWARDREF: If ‘object.__annotations__’ exists and can be
          evaluated successfully, it is used; otherwise, the
          ‘object.__annotate__’ function is called.  If it does not
          exist either, ‘object.__annotations__’ is tried again and any
          error from accessing it is re-raised.

             * When calling ‘object.__annotate__’ it is first called
               with *note FORWARDREF: 15f.  If this is not implemented,
               it will then check if *note VALUE_WITH_FAKE_GLOBALS:
               4a76. is supported and use that in the fake globals
               environment.  If neither of these formats are supported,
               it will fall back to using *note VALUE: 15e.  If *note
               VALUE: 15e. fails, the error from this call will be
               raised.

        * STRING: If ‘object.__annotate__’ exists, it is called first;
          otherwise, ‘object.__annotations__’ is used and stringified
          using *note annotations_to_string(): 4a79.

             * When calling ‘object.__annotate__’ it is first called
               with *note STRING: 160.  If this is not implemented, it
               will then check if *note VALUE_WITH_FAKE_GLOBALS: 4a76.
               is supported and use that in the fake globals
               environment.  If neither of these formats are supported,
               it will fall back to using *note VALUE: 15e. with the
               result converted using *note annotations_to_string():
               4a79.  If *note VALUE: 15e. fails, the error from this
               call will be raised.

     Returns a dict.  ‘get_annotations()’ returns a new dict every time
     it's called; calling it twice on the same object will return two
     different but equivalent dicts.

     This function handles several details for you:

        * If 'eval_str' is true, values of type ‘str’ will be
          un-stringized using *note eval(): 4a3.  This is intended for
          use with stringized annotations (‘from __future__ import
          annotations’).  It is an error to set 'eval_str' to true with
          formats other than *note Format.VALUE: 15e.

        * If 'obj' doesn't have an annotations dict, returns an empty
          dict.  (Functions and methods always have an annotations dict;
          classes, modules, and other types of callables may not.)

        * Ignores inherited annotations on classes, as well as
          annotations on metaclasses.  If a class doesn't have its own
          annotations dict, returns an empty dict.

        * All accesses to object members and dict values are done using
          ‘getattr()’ and ‘dict.get()’ for safety.

     'eval_str' controls whether or not values of type ‘str’ are
     replaced with the result of calling *note eval(): 4a3. on those
     values:

        * If eval_str is true, *note eval(): 4a3. is called on values of
          type ‘str’.  (Note that ‘get_annotations()’ doesn't catch
          exceptions; if *note eval(): 4a3. raises an exception, it will
          unwind the stack past the ‘get_annotations()’ call.)

        * If 'eval_str' is false (the default), values of type ‘str’ are
          unchanged.

     'globals' and 'locals' are passed in to *note eval(): 4a3.; see the
     documentation for *note eval(): 4a3. for more information.  If
     'globals' or 'locals' is ‘None’, this function may replace that
     value with a context-specific default, contingent on ‘type(obj)’:

        * If 'obj' is a module, 'globals' defaults to ‘obj.__dict__’.

        * If 'obj' is a class, 'globals' defaults to
          ‘sys.modules[obj.__module__].__dict__’ and 'locals' defaults
          to the 'obj' class namespace.

        * If 'obj' is a callable, 'globals' defaults to *note
          obj.__globals__: 14eb, although if 'obj' is a wrapped function
          (using *note functools.update_wrapper(): 1223.) or a *note
          functools.partial: 217. object, it is unwrapped until a
          non-wrapped function is found.

     Calling ‘get_annotations()’ is best practice for accessing the
     annotations dict of any object.  See *note Annotations Best
     Practices: 9d9. for more information on annotations best practices.

          >>> def f(a: int, b: str) -> float:
          ...     pass
          >>> get_annotations(f)
          {'a': <class 'int'>, 'b': <class 'str'>, 'return': <class 'float'>}

     Added in version 3.14.

 -- の関数: annotationlib.type_repr (value)

     Convert an arbitrary Python value to a format suitable for use by
     the *note STRING: 160. format.  This calls *note repr(): 1c1. for
     most objects, but has special handling for some objects, such as
     type objects.

     This is meant as a helper for user-provided annotate functions that
     support the *note STRING: 160. format but do not have access to the
     code creating the annotations.  It can also be used to provide a
     user-friendly string representation for other objects that contain
     values that are commonly encountered in annotations.

     Added in version 3.14.

   ---------- Footnotes ----------

   (1) 
https://peps.python.org/pep-0649/#the-stringizer-and-the-fake-globals-environment


File: python.info,  Node: レシピ<3>,  Next: Limitations of the STRING format,  Prev: 関数<12>,  Up: annotationlib --- Functionality for introspecting annotations

5.29.15.4 レシピ
................

* Menu:

* Using annotations in a metaclass::


File: python.info,  Node: Using annotations in a metaclass,  Up: レシピ<3>

5.29.15.5 Using annotations in a metaclass
..........................................

A *note metaclass: 23be. may want to inspect or even modify the
annotations in a class body during class creation.  Doing so requires
retrieving annotations from the class namespace dictionary.  For classes
created with ‘from __future__ import annotations’, the annotations will
be in the ‘__annotations__’ key of the dictionary.  For other classes
with annotations, *note get_annotate_from_class_namespace(): 45b. can be
used to get the annotate function, and *note call_annotate_function():
17be. can be used to call it and retrieve the annotations.  Using the
*note FORWARDREF: 15f. format will usually be best, because this allows
the annotations to refer to names that cannot yet be resolved when the
class is created.

To modify the annotations, it is best to create a wrapper annotate
function that calls the original annotate function, makes any necessary
adjustments, and returns the result.

Below is an example of a metaclass that filters out all *note
typing.ClassVar: 56d. annotations from the class and puts them in a
separate attribute:

     import annotationlib
     import typing

     class ClassVarSeparator(type):
        def __new__(mcls, name, bases, ns):
           if "__annotations__" in ns:  # from __future__ import annotations
              annotations = ns["__annotations__"]
              classvar_keys = {
                 key for key, value in annotations.items()
                 # Use string comparison for simplicity; a more robust solution
                 # could use annotationlib.ForwardRef.evaluate
                 if value.startswith("ClassVar")
              }
              classvars = {key: annotations[key] for key in classvar_keys}
              ns["__annotations__"] = {
                 key: value for key, value in annotations.items()
                 if key not in classvar_keys
              }
              wrapped_annotate = None
           elif annotate := annotationlib.get_annotate_from_class_namespace(ns):
              annotations = annotationlib.call_annotate_function(
                 annotate, format=annotationlib.Format.FORWARDREF
              )
              classvar_keys = {
                 key for key, value in annotations.items()
                 if typing.get_origin(value) is typing.ClassVar
              }
              classvars = {key: annotations[key] for key in classvar_keys}

              def wrapped_annotate(format):
                 annos = annotationlib.call_annotate_function(annotate, format, owner=typ)
                 return {key: value for key, value in annos.items() if key not in classvar_keys}

           else:  # no annotations
              classvars = {}
              wrapped_annotate = None
           typ = super().__new__(mcls, name, bases, ns)

           if wrapped_annotate is not None:
              # Wrap the original __annotate__ with a wrapper that removes ClassVars
              typ.__annotate__ = wrapped_annotate
           typ.classvars = classvars  # Store the ClassVars in a separate attribute
           return typ


File: python.info,  Node: Limitations of the STRING format,  Next: Limitations of the FORWARDREF format,  Prev: レシピ<3>,  Up: annotationlib --- Functionality for introspecting annotations

5.29.15.6 Limitations of the ‘STRING’ format
............................................

The *note STRING: 160. format is meant to approximate the source code of
the annotation, but the implementation strategy used means that it is
not always possible to recover the exact source code.

First, the stringifier of course cannot recover any information that is
not present in the compiled code, including comments, whitespace,
parenthesization, and operations that get simplified by the compiler.

Second, the stringifier can intercept almost all operations that involve
names looked up in some scope, but it cannot intercept operations that
operate fully on constants.  As a corollary, this also means it is not
safe to request the ‘STRING’ format on untrusted code: Python is
powerful enough that it is possible to achieve arbitrary code execution
even with no access to any globals or builtins.  For example:

     >>> def f(x: (1).__class__.__base__.__subclasses__()[-1].__init__.__builtins__["print"]("Hello world")): pass
     ...
     >>> annotationlib.get_annotations(f, format=annotationlib.Format.STRING)
     Hello world
     {'x': 'None'}

     注釈: This particular example works as of the time of writing, but
     it relies on implementation details and is not guaranteed to work
     in the future.

Among the different kinds of expressions that exist in Python, as
represented by the *note ast: 9. module, some expressions are supported,
meaning that the ‘STRING’ format can generally recover the original
source code; others are unsupported, meaning that they may result in
incorrect output or an error.

The following are supported (sometimes with caveats):

   * *note ast.BinOp: 1db2.

   * *note ast.UnaryOp: 4a7e.

        * *note ast.Invert: 4a7f. (‘~’), *note ast.UAdd: 4a80. (‘+’),
          and *note ast.USub: 4a81. (‘-’) are supported

        * *note ast.Not: 4a82. (‘not’) is not supported

   * *note ast.Dict: 1d49. (except when using ‘**’ unpacking)

   * *note ast.Set: 4a83.

   * *note ast.Compare: 4a84.

        * *note ast.Eq: 4a85. and *note ast.NotEq: 4a86. are supported

        * *note ast.Lt: 4a87, *note ast.LtE: 4a88, *note ast.Gt: 4a89,
          and *note ast.GtE: 4a8a. are supported, but the operand may be
          flipped

        * *note ast.Is: 4a8b, *note ast.IsNot: 4a8c, *note ast.In: 4a8d,
          and *note ast.NotIn: 4a8e. are not supported

   * *note ast.Call: 4a8f. (except when using ‘**’ unpacking)

   * *note ast.Constant: 2ef. (though not the exact representation of
     the constant; for example, escape sequences in strings are lost;
     hexadecimal numbers are converted to decimal)

   * *note ast.Attribute: 4a90. (assuming the value is not a constant)

   * *note ast.Subscript: 4a91. (assuming the value is not a constant)

   * *note ast.Starred: 4a92. (‘*’ unpacking)

   * *note ast.Name: 1d22.

   * *note ast.List: 4a93.

   * *note ast.Tuple: 4a94.

   * *note ast.Slice: 4a95.

The following are unsupported, but throw an informative error when
encountered by the stringifier:

   * *note ast.FormattedValue: 4a96. (f-strings; error is not detected
     if conversion specifiers like ‘!r’ are used)

   * *note ast.JoinedStr: 1a5c. (f-strings)

The following are unsupported and result in incorrect output:

   * *note ast.BoolOp: 4a97. (‘and’ and ‘or’)

   * *note ast.IfExp: 4a98.

   * *note ast.Lambda: 4a99.

   * *note ast.ListComp: 4a9a.

   * *note ast.SetComp: 4a9b.

   * *note ast.DictComp: 4a9c.

   * *note ast.GeneratorExp: 4a9d.

The following are disallowed in annotation scopes and therefore not
relevant:

   * *note ast.NamedExpr: 4a9e. (‘:=’)

   * *note ast.Await: 4a9f.

   * *note ast.Yield: 4aa0.

   * *note ast.YieldFrom: 4aa1.


File: python.info,  Node: Limitations of the FORWARDREF format,  Next: Security implications of introspecting annotations,  Prev: Limitations of the STRING format,  Up: annotationlib --- Functionality for introspecting annotations

5.29.15.7 Limitations of the ‘FORWARDREF’ format
................................................

The *note FORWARDREF: 15f. format aims to produce real values as much as
possible, with anything that cannot be resolved replaced with *note
ForwardRef: 1776. objects.  It is affected by broadly the same
Limitations as the *note STRING: 160. format: annotations that perform
operations on literals or that use unsupported expression types may
raise exceptions when evaluated using the *note FORWARDREF: 15f. format.

Below are a few examples of the behavior with unsupported expressions:

     >>> from annotationlib import get_annotations, Format
     >>> def zerodiv(x: 1 / 0): ...
     >>> get_annotations(zerodiv, format=Format.STRING)
     Traceback (most recent call last):
       ...
     ZeroDivisionError: division by zero
     >>> get_annotations(zerodiv, format=Format.FORWARDREF)
     Traceback (most recent call last):
       ...
     ZeroDivisionError: division by zero
     >>> def ifexp(x: 1 if y else 0): ...
     >>> get_annotations(ifexp, format=Format.STRING)
     {'x': '1'}


File: python.info,  Node: Security implications of introspecting annotations,  Prev: Limitations of the FORWARDREF format,  Up: annotationlib --- Functionality for introspecting annotations

5.29.15.8 Security implications of introspecting annotations
............................................................

Much of the functionality in this module involves executing code related
to annotations, which can then do arbitrary things.  For example, *note
get_annotations(): 459. may call an arbitrary *note annotate function:
15d, and *note ForwardRef.evaluate(): 17b2. may call *note eval(): 4a3.
on an arbitrary string.  Code contained in an annotation might make
arbitrary system calls, enter an infinite loop, or perform any other
operation.  This is also true for any access of the *note
__annotations__: 458. attribute, and for various functions in the *note
typing: 10a. module that work with annotations, such as *note
typing.get_type_hints(): 8c0.

Any security issue arising from this also applies immediately after
importing code that may contain untrusted annotations: importing code
can always cause arbitrary operations to be performed.  However, it is
unsafe to accept strings or other input from an untrusted source and
pass them to any of the APIs for introspecting annotations, for example
by editing an ‘__annotations__’ dictionary or directly creating a *note
ForwardRef: 1776. object.


File: python.info,  Node: site --- サイト固有の設定フック,  Prev: annotationlib --- Functionality for introspecting annotations,  Up: Python ランタイムサービス

5.29.16 ‘site’ -- サイト固有の設定フック
----------------------------------------

'ソースコード:' Lib/site.py(1)

__________________________________________________________________

'このモジュールは初期化中に自動的にインポートされます。' 自動インポート
はインタプリタの *note -S: 13c0. オプションで禁止できます。

Importing this module normally appends site-specific paths to the module
search path and adds *note callables: 25e5, including *note help(): ad4.
to the built-in namespace.  However, Python startup option *note -S:
13c0. blocks this and this module can be safely imported with no
automatic modifications to the module search path or additions to the
builtins.  To explicitly trigger the usual site-specific additions, call
the *note main(): 2127. function.

バージョン 3.3 で変更: 以前は *note -S: 13c0. を使っているときでも、モジ
ュールをインポートするとパス変更が起動されていました。

It starts by constructing up to four directories from a head and a tail
part.  For the head part, it uses ‘sys.prefix’ and ‘sys.exec_prefix’;
empty heads are skipped.  For the tail part, it uses the empty string
and then ‘lib/site-packages’ (on Windows) or
‘lib/python`X.Y[t]'/site-packages’ (on Unix and macOS). (The optional
suffix "t" indicates the *note free-threaded build: 176d, and is
appended if ‘"t"’ is present in the *note sys.abiflags: c59. constant.)
For each of the distinct head-tail combinations, it sees if it refers to
an existing directory, and if so, adds it to ‘sys.path’ and also
inspects the newly added path for configuration files.

バージョン 3.5 で変更: "site-python" ディレクトリのサポートは削除されま
した。

バージョン 3.13 で変更: On Unix, *note Free threading: 1f4. Python
installations are identified by the "t" suffix in the version-specific
directory name, such as ‘lib/python3.13t/’.

バージョン 3.14 で変更: ‘site’ is no longer responsible for updating
*note sys.prefix: 3e7. and *note sys.exec_prefix: 3eb. on *note Virtual
Environments: 48b3.  This is now done during the *note path
initialization: 18dc.  As a result, under *note Virtual Environments:
48b3, *note sys.prefix: 3e7. and *note sys.exec_prefix: 3eb. no longer
depend on the ‘site’ initialization, and are therefore unaffected by
*note -S: 13c0.

When running under a *note virtual environment: 48b3, the ‘pyvenv.cfg’
file in *note sys.prefix: 3e7. is checked for site-specific
configurations.  If the ‘include-system-site-packages’ key exists and is
set to ‘true’ (case-insensitive), the system-level prefixes will be
searched for site-packages, otherwise they won't.

パス設定ファイルは ‘`name'.pth’ という形式の名前をもつファイルで、上の
4つのディレクトリのひとつにあります。その内容は ‘sys.path’ に追加される
追加項目(一行に一つ)です。存在しない項目は ‘sys.path’ へは決して追加され
ませんが、項目がファイルではなくディレクトリを参照しているかどうかはチェ
ックされません。項目が ‘sys.path’ へ二回以上追加されることはありません。
空行と ‘#’ で始まる行は読み飛ばされます。 ‘import’ で始まる(そしてその後
ろにスペースかタブが続く)行は実行されます。

     注釈: ‘.pth’ ファイル内の実行可能な行は、特定のモジュールが実際に使
     用されるかどうかに関係なく、Pythonの起動時に毎回実行されます。した
     がって、その影響は最小限に抑えられるべきです。実行可能な行の主な目
     的は、対応するモジュールをインポート可能にすることです(サードパーテ
     ィ製インポートフックのロード、 ‘PATH’ の調整など)。その他の初期化は
     、モジュールが実際にインポートされたときに行われます。コードのチャ
     ンクを1行に制限することは、より複雑なものをここに入れないようにする
     ための意図的な手段です。

バージョン 3.13 で変更: ‘.pth’ ファイルは、最初に UTF-8 で、失敗した場合
は *note locale encoding: 54a. でデコードされるようになります。

例えば、 ‘sys.prefix’ と ‘sys.exec_prefix’ が ‘/usr/local’ に設定されて
いると仮定します。そのときPython X.Y ライブラリは
‘/usr/local/lib/python`X.Y'’ にインストールされています。ここにはサブデ
ィレクトリ ‘/usr/local/lib/python`X.Y'/site-packages’ があり、その中に三
つのサブディレクトリ ‘foo’, ‘bar’ および ‘spam’ と二つのパス設定ファイル
‘foo.pth’ と ‘bar.pth’ をもつと仮定します。 ‘foo.pth’ には以下のものが記
載されていると想定してください:

     # foo package configuration

     foo
     bar
     bletch

また、 ‘bar.pth’ には:

     # bar package configuration

     bar

が記載されているとします。そのとき、次のバージョンごとのディレクトリが
‘sys.path’ へこの順番で追加されます:

     /usr/local/lib/pythonX.Y/site-packages/bar
     /usr/local/lib/pythonX.Y/site-packages/foo

‘bletch’ は存在しないため省略されるということに注意してください。 ‘bar’
ディレクトリは ‘foo’ ディレクトリの前に来ます。なぜなら、 ‘bar.pth’ がア
ルファベット順で ‘foo.pth’ の前に来るからです。また、 ‘spam’ はどちらの
パス設定ファイルにも記載されていないため、省略されます。

* Menu:

* sitecustomize::
* usercustomize::
* readline の設定::
* モジュールの内容: モジュールの内容<5>.
* コマンドライン・インターフェース: コマンドライン・インターフェース<11>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/site.py


File: python.info,  Node: sitecustomize,  Next: usercustomize,  Up: site --- サイト固有の設定フック

5.29.16.1 ‘sitecustomize’
.........................

After these path manipulations, an attempt is made to import a module
named ‘sitecustomize’, which can perform arbitrary site-specific
customizations.  It is typically created by a system administrator in
the site-packages directory.  If this import fails with an *note
ImportError: 65b. or its subclass exception, and the exception's *note
name: 26ea. attribute equals ‘'sitecustomize'’, it is silently ignored.
If Python is started without output streams available, as with
‘pythonw.exe’ on Windows (which is used by default to start IDLE),
attempted output from ‘sitecustomize’ is ignored.  Any other exception
causes a silent and perhaps mysterious failure of the process.


File: python.info,  Node: usercustomize,  Next: readline の設定,  Prev: sitecustomize,  Up: site --- サイト固有の設定フック

5.29.16.2 ‘usercustomize’
.........................

After this, an attempt is made to import a module named ‘usercustomize’,
which can perform arbitrary user-specific customizations, if *note
ENABLE_USER_SITE: 4aa9. is true.  This file is intended to be created in
the user site-packages directory (see below), which is part of
‘sys.path’ unless disabled by *note -s: 15a6.  If this import fails with
an *note ImportError: 65b. or its subclass exception, and the
exception's *note name: 26ea. attribute equals ‘'usercustomize'’, it is
silently ignored.

Note that for some non-Unix systems, ‘sys.prefix’ and ‘sys.exec_prefix’
are empty, and the path manipulations are skipped; however the import of
*note sitecustomize: cd. and ‘usercustomize’ is still attempted.


File: python.info,  Node: readline の設定,  Next: モジュールの内容<5>,  Prev: usercustomize,  Up: site --- サイト固有の設定フック

5.29.16.3 readline の設定
.........................

On systems that support *note readline: bf, this module will also import
and configure the *note rlcompleter: c2. module, if Python is started in
*note interactive mode: 443. and without the *note -S: 13c0. option.
The default behavior is to enable tab completion and to use
‘~/.python_history’ as the history save file.  To disable it, delete (or
override) the *note sys.__interactivehook__: 11ca. attribute in your
*note sitecustomize: cd. or *note usercustomize: 114. module or your
*note PYTHONSTARTUP: 1b8. file.

バージョン 3.4 で変更: rlcompleter とhistory のアクティベーションが自動
で行われるようになりました。


File: python.info,  Node: モジュールの内容<5>,  Next: コマンドライン・インターフェース<11>,  Prev: readline の設定,  Up: site --- サイト固有の設定フック

5.29.16.4 モジュールの内容
..........................

 -- データ: site.PREFIXES

     siteパッケージディレクトリのprefixのリスト。

 -- データ: site.ENABLE_USER_SITE

     ユーザサイトディレクトリのステータスを示すフラグ。 ‘True’ の場合、
     ユーザサイトディレクトリが有効で ‘sys.path’ に追加されていることを
     意味しています。 ‘False’ の場合、ユーザによるリクエスト(オプション
     *note -s: 15a6. か *note PYTHONNOUSERSITE: 15a7.)によって、 ‘None’
     の場合セキュリティ上の理由(ユーザまたはグループIDと実効IDの間のミス
     マッチ)あるいは管理者によって、ユーザサイトディレクトリが無効になっ
     ていることを示しています。

 -- データ: site.USER_SITE

     Path to the user site-packages for the running Python.  Can be
     ‘None’ if *note getusersitepackages(): 1458. hasn't been called
     yet.  Default value is ‘~/.local/lib/python`X.Y'[t]/site-packages’
     for UNIX and non-framework macOS builds,
     ‘~/Library/Python/`X.Y'/lib/python/site-packages’ for macOS
     framework builds, and ‘`%APPDATA%'\Python\Python`XY'\site-packages’
     on Windows.  The optional "t" indicates the free-threaded build.
     This directory is a site directory, which means that ‘.pth’ files
     in it will be processed.

 -- データ: site.USER_BASE

     ユーザの site-packages のベースとなるディレクトリへのパスです。
     *note getuserbase(): 1457. がまだ呼び出されていなければ ‘None’ かも
     しれません。デフォルト値は UNIX と frameworkなしの macOS ビルドでは
     ‘~/.local’ 、macOS framework ビルドでは ‘~/Library/Python/`X.Y'’ 、
     Windows では ‘`%APPDATA%'\Python’ です。この値は、スクリプト、デー
     タファイル、Python モジュールなどのインストール先のディレクトリを
     *note ユーザーインストールスキーム: 2137. で計算するのに使われます
     。 *note PYTHONUSERBASE: 15a5. も参照してください。

 -- の関数: site.main ()

     モジュール検索パスに標準のサイト固有ディレクトリを追加します。この
     関数は、Python インタプリタが *note -S: 13c0. で開始されていない限
     り、このモジュールインポート時に自動的に呼び出されます。

     バージョン 3.3 で変更: この関数は以前は無条件に呼び出されていました
     。

 -- の関数: site.addsitedir (sitedir, known_paths=None)

     sys.path にディレクトリを追加し、その ‘.pth’ ファイル群を処理します
     。典型的には *note sitecustomize: cd. か *note usercustomize: 114.
     内で使われます(上述)。

 -- の関数: site.getsitepackages ()

     全てのグローバルな site-packages ディレクトリのリストを返します。

     Added in version 3.2.

 -- の関数: site.getuserbase ()

     ユーザのベースディレクトリへのパス *note USER_BASE: 1534. を返しま
     す。未初期化であればこの関数は *note PYTHONUSERBASE: 15a5. を参考に
     して、設定もします。

     Added in version 3.2.

 -- の関数: site.getusersitepackages ()

     ユーザ固有の site パッケージのディレクトリへのパス *note USER_SITE:
     2126. を返します。未初期化であればこの関数は *note USER_BASE: 1534.
     を参考にして、設定もします。 ユーザ固有の site パッケージが
     ‘sys.path’ に追加されたかどうかを確認するには *note
     ENABLE_USER_SITE: 4aa9. を使ってください。

     Added in version 3.2.


File: python.info,  Node: コマンドライン・インターフェース<11>,  Prev: モジュールの内容<5>,  Up: site --- サイト固有の設定フック

5.29.16.5 コマンドライン・インターフェース
..........................................

The ‘site’ module also provides a way to get the user directories from
the command line:

     $ python -m site --user-site
     /home/user/.local/lib/python3.11/site-packages

引数なしで呼び出された場合、*note sys.path: 3e4. の中身を表示し、続けて
*note USER_BASE: 1534. とそのディレクトリが存在するかどうか、 *note
USER_SITE: 2126. とそのディレクトリが存在するかどうか、最後に *note
ENABLE_USER_SITE: 4aa9. の値を、標準出力に出力します。

 -- Option: --user-base

     ユーザのベースディレクトリを表示します。

 -- Option: --user-site

     ユーザの site-packages ディレクトリを表示します。

両方のオプションが指定された場合、ユーザのベースとユーザの site が(常に
この順序で) *note os.pathsep: 2134. 区切りで表示されます。

いずれかのオプションが与えられた場合に、このスクリプトは次のいずれかの終
了コードで終了します: ユーザの site-packages が有効ならば ‘0’ 、ユーザに
より無効にされていれば ‘1’ 、セキュリティ的な理由あるいは管理者によって
無効にされている場合 ‘2’ 、そして何かエラーがあった場合は 2 より大きな値
。

参考
....

   * PEP 370(1) - ユーザごとの ‘site-packages’ ディレクトリ

   * *note sys.path モジュール検索パスの初期化: 18dc. - *note sys.path:
     3e4.  の初期化。

参考
....

   * See the *note concurrent.interpreters: 25. module, which similarly
     exposes core runtime functionality.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0370/


File: python.info,  Node: カスタム Python インタプリタ,  Next: モジュールのインポート,  Prev: Python ランタイムサービス,  Up: Python 標準ライブラリ

5.30 カスタム Python インタプリタ
=================================

この章で解説されるモジュールで Python の対話型インタープリターに似たイン
ターフェースを書くことができます。もし Python そのもの以外に何か特殊な機
能をサポートした Python インタープリターを作りたければ、 *note code: 1b.
モジュールを参照してください。 (*note codeop: 1d. モジュールはより低レベ
ルで、不完全かもしれない Python コード断片のコンパイルをサポートするため
に使われます。)

この章で解説されるモジュールの完全な一覧は:

* Menu:

* code: code --- インタープリター基底クラス. インタープリター基底クラス
* codeop: codeop --- Python コードをコンパイルする. Python コードをコンパイルする


File: python.info,  Node: code --- インタープリター基底クラス,  Next: codeop --- Python コードをコンパイルする,  Up: カスタム Python インタプリタ

5.30.1 ‘code’ -- インタープリター基底クラス
-------------------------------------------

'ソースコード:' Lib/code.py(1)

__________________________________________________________________

‘code’ モジュールはread-eval-print (読み込み-評価-表示)ループをPythonで
実装するための機能を提供します。対話的なインタプリタプロンプトを提供する
アプリケーションを作るために使える二つのクラスと便利な関数が含まれていま
す。

 -- クラス: code.InteractiveInterpreter (locals=None)

     このクラスは構文解析とインタープリター状態(ユーザの名前空間)を取り
     扱います。入力バッファリングやプロンプト出力、または入力ファイル指
     定を扱いません(ファイル名は常に明示的に渡されます)。オプションの
     'locals' 引数はその中でコードが実行される名前空間として使用されるマ
     ッピングを指定します。その初期値は、キー ‘'__name__'’ が
     ‘'__console__'’ に設定され、キー ‘'__doc__'’ が ‘None’ に設定された
     新しく作られた辞書です。

     Note that functions and classes objects created under an
     ‘InteractiveInterpreter’ instance will belong to the namespace
     specified by 'locals'.  They are only pickleable if 'locals' is the
     namespace of an existing module.

 -- クラス: code.InteractiveConsole (locals=None, filename='<console>',
          local_exit=False)

     Python の対話型インタープリターの振る舞いを忠実にエミュレートします
     。このクラスは *note InteractiveInterpreter: 1943. を継承しており、
     よく知られた ‘sys.ps1’ と ‘sys.ps2’ を使用してプロンプトと入力バッ
     ファリングを追加します。 'local_exit' が真の場合、コンソールでの
     ‘exit()’ と ‘quit()’ は *note SystemExit: f3c. を送出せず、代わりに
     呼び出し元のコードに戻ります。

     バージョン 3.13 で変更: 'local_exit' 引数が追加されました。

 -- の関数: code.interact (banner=None, readfunc=None, local=None,
          exitmsg=None, local_exit=False)

     read-eval-print ループを実行するための便利な関数。これは *note
     InteractiveConsole: 2807. の新しいインスタンスを作り、 'readfunc' が
     与えられた場合は *note InteractiveConsole.raw_input(): 4ab7. メソッ
     ドとして使われるように設定します。 'local' が与えられた場合は、イン
     タープリターループのデフォルト名前空間として使うために *note
     InteractiveConsole: 2807. コンストラクタへ渡されます。 'local_exit'
     が与えられた場合は、 *note InteractiveConsole: 2807. コンストラクタ
     へ渡されます。そして、インスタンスの *note interact(): 4ab8. メソッ
     ドは、もし提供されていれば、見出しと終了メッセージして使うために
     'banner' と 'exitmsg' を受け取り実行されます。コンソールオブジェク
     トは使われた後捨てられます。

     バージョン 3.6 で変更: 'exitmsg' 引数が追加されました.

     バージョン 3.13 で変更: 'local_exit' 引数が追加されました。

 -- の関数: code.compile_command (source, filename='<input>',
          symbol='single')

     この関数はPythonのインタプリタメインループ(別名、read-eval-printル
     ープ)をエミュレートしようとするプログラムにとって役に立ちます。扱い
     にくい部分は、ユーザが(完全なコマンドや構文エラーではなく)さらにテ
     キストを入力すれば完全になりうる不完全なコマンドを入力したときを決
     定することです。この関数は 'ほとんど' の場合に実際のインタプリタメ
     インループと同じ決定を行います。

     'source' はソース文字列です。'filename' はオプションのソースが読み
     出されたファイル名で、デフォルトで ‘'<input>'’ です。'symbol' はオ
     プションの文法の開始記号で、‘'single'’ (デフォルト)または ‘'eval'’
     か ‘'exec'’ にすべきです。

     コマンドが完全で有効ならば、コードオブジェクトを返します
     (‘compile(source, filename, symbol)’ と同じ)。コマンドが完全でない
     ならば、 ‘None’ を返します。コマンドが完全で構文エラーを含む場合は
     、 *note SyntaxError: 18e. を発生させます。または、コマンドが無効な
     リテラルを含む場合は、 *note OverflowError: a81. もしくは *note
     ValueError: 2ec. を発生させます。

* Menu:

* 対話的なインタプリタオブジェクト::
* 対話的なコンソールオブジェクト::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/code.py


File: python.info,  Node: 対話的なインタプリタオブジェクト,  Next: 対話的なコンソールオブジェクト,  Up: code --- インタープリター基底クラス

5.30.1.1 対話的なインタプリタオブジェクト
.........................................

 -- メソッド: InteractiveInterpreter.runsource (source,
          filename='<input>', symbol='single')

     インタプリタ内のあるソースをコンパイルし実行します。引数は *note
     compile_command(): 4ab9. のものと同じです。 'filename' のデフォルト
     は ‘'<input>'’ で、 'symbol' は ‘'single'’ です。あるいくつかのこと
     が起きる可能性があります:

        * 入力が不正。 *note compile_command(): 4ab9. が例外(*note
          SyntaxError: 18e. か *note OverflowError: a81.)を起こした場合
          。 *note showsyntaxerror(): 4abd. メソッドの呼び出によって、構
          文トレースバックが表示されるでしょう。 *note runsource():
          4abc. は ‘False’ を返します。

        * 入力が完全でなく、さらに入力が必要。 *note compile_command():
          4ab9. が ‘None’ を返した場合。 *note runsource(): 4abc. は
          ‘True’ を返します。

        * 入力が完全。 *note compile_command(): 4ab9. がコードオブジェク
          トを返した場合。 (*note SystemExit: f3c. を除く実行時例外も処
          理する) *note runcode(): 4abe. を呼び出すことによって、コード
          は実行されます。 *note runsource(): 4abc. は ‘False’ を返しま
          す。

     戻り値は、次の行のプロンプトに ‘sys.ps1’ か ‘sys.ps2’ のどちらを使
     うのか判断するために使えます。

 -- メソッド: InteractiveInterpreter.runcode (code)

     コードオブジェクトを実行します。例外が生じたときは、トレースバック
     を表示するために *note showtraceback(): fce. が呼び出されます。伝搬
     することが許されている *note SystemExit: f3c. を除くすべての例外が
     捉えられます。

     *note KeyboardInterrupt: bc5. についての注意。このコードの他の場所
     でこの例外が生じる可能性がありますし、常に捕らえることができるとは
     限りません。呼び出し側はそれを処理するために準備しておくべきです。

 -- メソッド: InteractiveInterpreter.showsyntaxerror (filename=None)

     起きたばかりの構文エラーを表示します。複数の構文エラーに対して一つ
     あるのではないため、これはスタックトレースを表示しません。
     'filename' が与えられた場合は、Pythonのパーサが与えるデフォルトのフ
     ァイル名の代わりに例外の中へ入れられます。なぜなら、文字列から読み
     込んでいるときはパーサは常に ‘'<string>'’ を使うからです。出力は
     *note write(): 4abf. メソッドによって書き込まれます。

 -- メソッド: InteractiveInterpreter.showtraceback ()

     起きたばかりの例外を表示します。スタックの最初の項目を取り除きます
     。なぜなら、それはインタプリタオブジェクトの実装の内部にあるからで
     す。出力は *note write(): 4abf. メソッドによって書き込まれます。

     バージョン 3.5 で変更: 最初のトレースバックではなく、完全なトレース
     バックの連鎖が表示されます。

 -- メソッド: InteractiveInterpreter.write (data)

     文字列を標準エラーストリーム(‘sys.stderr’)へ書き込みます。必要に応
     じて適切な出力処理を提供するために、派生クラスはこれをオーバーライ
     ドすべきです。


File: python.info,  Node: 対話的なコンソールオブジェクト,  Prev: 対話的なインタプリタオブジェクト,  Up: code --- インタープリター基底クラス

5.30.1.2 対話的なコンソールオブジェクト
.......................................

*note InteractiveConsole: 2807. クラスは *note InteractiveInterpreter:
1943. のサブクラスです。以下の追加メソッドだけでなく、インタプリタオブジ
ェクトのすべてのメソッドも提供します。

 -- メソッド: InteractiveConsole.interact (banner=None, exitmsg=None)

     対話的な Python コンソールをそっくりにエミュレートします。オプショ
     ンの 'banner' 引数は最初のやりとりの前に表示するバナーを指定します
     。デフォルトでは、標準 Python インタプリタが表示するものと同じよう
     なバナーを表示します。それに続けて、実際のインタプリタと混乱しない
     ように (とても似ているから!)  括弧の中にコンソールオブジェクトのク
     ラス名を表示します。

     オプション引数の 'exitmsg' は、終了時に出力される終了メッセージを指
     定します。空文字列を渡すと、出力メッセージを抑止します。もし、
     'exitmsg' が与えられないか、‘None’ の場合は、デフォルトのメッセージ
     が出力されます。

     バージョン 3.4 で変更: バナーの表示を抑制するには、空の文字列を渡し
     てください。

     バージョン 3.6 で変更: 終了時に、終了メッセージを表示します。

 -- メソッド: InteractiveConsole.push (line)

     ソーステキストの一行をインタープリターへ送ります。その行の末尾に改
     行がついていてはいけません。内部に改行を持っているかもしれません。
     その行はバッファへ追加され、ソースとして連結されたバッファの内容が
     渡されインタープリターの *note runsource(): 4abc. メソッドが呼び出
     されます。コマンドが実行されたか、有効であることをこれが示している
     場合は、バッファはリセットされます。そうでなければ、コマンドが不完
     全で、その行が付加された後のままバッファは残されます。さらに入力が
     必要ならば、戻り値は ‘True’ です。その行がある方法で処理されたなら
     ば、 ‘False’ です(これは ‘runsource()’ と同じです)。

 -- メソッド: InteractiveConsole.resetbuffer ()

     入力バッファから処理されていないソーステキストを取り除きます。

 -- メソッド: InteractiveConsole.raw_input (prompt='')

     プロンプトを書き込み、一行を読み込みます。返る行は末尾に改行を含み
     ません。ユーザがEOFキーシーケンスを入力したときは、 *note EOFError:
     14f1. を発生させます。基本実装では、 ‘sys.stdin’ から読み込みます。
     サブクラスはこれを異なる実装と置き換えるかもしれません。


File: python.info,  Node: codeop --- Python コードをコンパイルする,  Prev: code --- インタープリター基底クラス,  Up: カスタム Python インタプリタ

5.30.2 ‘codeop’ -- Python コードをコンパイルする
------------------------------------------------

'ソースコード:' Lib/codeop.py(1)

__________________________________________________________________

The ‘codeop’ module provides utilities upon which the Python
read-eval-print loop can be emulated, as is done in the *note code: 1b.
module.  As a result, you probably don't want to use the module
directly; if you want to include such a loop in your program you
probably want to use the *note code: 1b. module instead.

この仕事には二つの部分があります:

  1. 入力の一行がPythonの文として完全であるかどうかを見分けられること: 簡
     単に言えば、次が '‘>>>’' か、あるいは '‘...’' かどうかを見分けます
     。

  2. どのfuture文をユーザが入力したのかを覚えていること。したがって、実
     質的にそれに続く入力をこれらとともにコンパイルすることができます。

The ‘codeop’ module provides a way of doing each of these things, and a
way of doing them both.

前者は実行するには:

 -- の関数: codeop.compile_command (source, filename='<input>',
          symbol='single')

     Pythonコードの文字列であるべき 'source' をコンパイルしてみて、
     'source' が有効なPythonコードの場合はコードオブジェクトを返します。
     このような場合、コードオブジェクトのファイル名属性は、デフォルトで
     ‘'<input>'’ である 'filename' でしょう。'source' が有効なPythonコー
     ドでは 'ない' が、有効なPythonコードの接頭語である場合には、‘None’
     を返します。

     'source' に問題がある場合は、例外を発生させます。無効なPython構文が
     ある場合は、 *note SyntaxError: 18e. を発生させます。また、無効なリ
     テラルがある場合は、 *note OverflowError: a81. または *note
     ValueError: 2ec. を発生させます。

     'symbol' 引数は 'source' が文としてコンパイルされるか(‘'single'’ 、
     デフォルト) 、*note 文: 2bfc. のシーケンスとしてか (‘'exec'’) 、ま
     たは *note 式: 23cf. としてコンパイルされるかを決定します
     (‘'eval'’)。他のどんな値も *note ValueError: 2ec. を送出させます。

          注釈: ソースの終わりに達する前に、成功した結果をもってパーサは
          構文解析を止めることがあります。このような場合、後ろに続く記号
          はエラーとならずに無視されます。例えば、バックスラッシュの後ろ
          に改行が2つあって、その後ろにゴミがあるかもしれません。パーサ
          のAPIがより良くなればすぐに、この挙動は修正されるでしょう。

 -- クラス: codeop.Compile

     このクラスのインスタンスは組み込み関数 *note compile(): 4b1. とシグ
     ネチャが一致する *note __call__(): 77a. メソッドを持っていますが、
     インスタンスが *note __future__: 0. 文を含むプログラムテキストをコ
     ンパイルする場合は、インスタンスは有効なその文とともに続くすべての
     プログラムテキストを'覚えていて'コンパイルするという違いがあります
     。

 -- クラス: codeop.CommandCompiler

     このクラスのインスタンスは *note compile_command(): 1b53. とシグネ
     チャが一致する *note __call__(): 77a. メソッドを持っています。イン
     スタンスが *note __future__: 0. 文を含むプログラムテキストをコンパ
     イルする場合に、インスタンスは有効なその文とともにそれに続くすべて
     のプログラムテキストを'覚えていて'コンパイルするという違いがありま
     す。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/codeop.py


File: python.info,  Node: モジュールのインポート,  Next: Python言語サービス,  Prev: カスタム Python インタプリタ,  Up: Python 標準ライブラリ

5.31 モジュールのインポート
===========================

この章で解説されるモジュールは他のPythonモジュールをインポートする新しい
方法と、インポート処理をカスタマイズするためのフックを提供します。

この章で解説されるモジュールの完全な一覧は:

* Menu:

* zipimport: zipimport --- Zip アーカイブからモジュールをインポートする. Zip アーカイブからモジュールをインポートする
* pkgutil: pkgutil --- パッケージ拡張ユーティリティ. パッケージ拡張ユーティリティ
* modulefinder: modulefinder --- スクリプト中で使用されているモジュールの検索. スクリプト中で使用されているモジュールの検索
* runpy: runpy --- Python モジュールの位置特定と実行. Python モジュールの位置特定と実行
* importlib: importlib --- import の実装. import の実装
* importlib.resources: importlib resources -- パッケージリソースの読み取り、オープン、アクセス. パッケージリソースの読み取り、オープン、アクセス
* importlib.resources.abc: importlib resources abc -- リソースの抽象基底クラス. リソースの抽象基底クラス
* importlib.metadata: importlib metadata -- パッケージメタデータへのアクセス. パッケージメタデータへのアクセス
* sys.path モジュール検索パスの初期化: sys path モジュール検索パスの初期化.


File: python.info,  Node: zipimport --- Zip アーカイブからモジュールをインポートする,  Next: pkgutil --- パッケージ拡張ユーティリティ,  Up: モジュールのインポート

5.31.1 ‘zipimport’ -- Zip アーカイブからモジュールをインポートする
------------------------------------------------------------------

'ソースコード:' Lib/zipimport.py(1)

__________________________________________________________________

This module adds the ability to import Python modules (‘*.py’, ‘*.pyc’)
and packages from ZIP-format archives.  It is usually not needed to use
the ‘zipimport’ module explicitly; it is automatically used by the
built-in *note import: 7f8. mechanism for *note sys.path: 3e4. items
that are paths to ZIP archives.

普通、 *note sys.path: 3e4. はディレクトリ名の文字列からなるリストです。
このモジュールを使うと、 *note sys.path: 3e4. の要素に ZIP ファイルアー
カイブを示す文字列を使えるようになります。ZIP アーカイブにはサブディレク
トリ構造を含めることができ、パッケージの import をサポートさせたり、アー
カイブ内のパスを指定してサブディレクトリ下から import を行わせたりできま
す。例えば、 ‘example.zip/lib/’ のように指定すると、アーカイブ中の
‘lib/’ サブディレクトリ下だけから import を行います。

ZIP アーカイブ内にはどんなファイルを置いてもかまいませんが、インポートは
‘.py’ および ‘.pyc’ ファイルにのみ呼び出されます。動的モジュール
(‘.pyd’, ‘.so’) の ZIP インポートは行えません。アーカイブ内に ‘.py’ ファ
イルしかない場合、 Python は対応する ‘.pyc’ ファイルを追加してアーカイブ
を変更しようとはしません。つまり、 ZIP アーカイブ内に ‘.pyc’ がない場合
は、インポートが多少遅くなるかもしれないので注意してください。

バージョン 3.13 で変更: ZIP64 is supported

バージョン 3.8 で変更: 以前は、アーカイブコメント付きの ZIP アーカイブは
サポートされていませんでした。

参考
....

PKZIP Application Note(2)

     ZIP ファイルフォーマットおよびアルゴリズムを作成した Phil Katz によ
     るドキュメント。

PEP 273(3) - Zip アーカイブからモジュールをインポートする

     このモジュールの実装も行った、James C. Ahlstrom による PEP です。
     Python 2.3 は PEP 273(4) の仕様に従っていますが、Just van Rossum の
     書いた import フックによる実装を使っています。インポートフックは
     PEP 302(5) で解説されています。

*note importlib: 7b. - *note import: 7f8. の実装

     Package providing the relevant protocols for all importers to
     implement.

このモジュールでは例外を一つ定義しています:

 -- 例外: zipimport.ZipImportError

     zipimporter オブジェクトが送出する例外です。 *note ImportError:
     65b. のサブクラスなので、 *note ImportError: 65b. としても捕捉でき
     ます。

* Menu:

* zipimporter オブジェクト::
* 使用例: 使用例<47>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/zipimport.py

   (2) https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

   (3) https://peps.python.org/pep-0273/

   (4) https://peps.python.org/pep-0273/

   (5) https://peps.python.org/pep-0302/


File: python.info,  Node: zipimporter オブジェクト,  Next: 使用例<47>,  Up: zipimport --- Zip アーカイブからモジュールをインポートする

5.31.1.1 zipimporter オブジェクト
.................................

*note zipimporter: 4ad2. は ZIP ファイルを import するためのクラスです。

 -- クラス: zipimport.zipimporter (archivepath)

     新たな zipimporter インスタンスを生成します。 'archivepath' は ZIP
     ファイルへのパスまたは ZIP ファイル中の特定のパスへのパスでなければ
     なりません。たとえば、 ‘foo/bar.zip/lib’ という 'archivepath' の場
     合、 ‘foo/bar.zip’ という ZIP ファイルの中の ‘lib’ ディレクトリにあ
     るモジュールを (存在するものとして) 検索します。

     'archivepath' が有効な ZIP アーカイブを指していない場合、 *note
     ZipImportError: 4acf. を送出します。

     バージョン 3.12 で変更: Methods ‘find_loader()’ and
     ‘find_module()’, deprecated in 3.10 are now removed.  Use *note
     find_spec(): a5e. instead.

      -- メソッド: create_module (spec)

          Implementation of *note importlib.abc.Loader.create_module():
          eac. that returns *note None: 885. to explicitly request the
          default semantics.

          Added in version 3.10.

      -- メソッド: exec_module (module)

          *note importlib.abc.Loader.exec_module(): a6a. の実装です。

          Added in version 3.10.

      -- メソッド: find_spec (fullname, target=None)

          *note importlib.abc.PathEntryFinder.find_spec(): a6c. の実装で
          す。

          Added in version 3.10.

      -- メソッド: get_code (fullname)

          'fullname' に指定したモジュールのコードオブジェクトを返します
          。モジュールがインポートできなかった場合には *note
          ZipImportError: 4acf. を送出します。

      -- メソッド: get_data (pathname)

          'pathname' に関連付けられたデータを返します。該当するファイル
          が見つからなかった場合には *note OSError: 2c0. を送出します。

          バージョン 3.3 で変更: 以前は *note IOError: 125e. が送出され
          ました; それは現在 *note OSError: 2c0. のエイリアスです。

      -- メソッド: get_filename (fullname)

          指定されたモジュールが import された場合、そのモジュールに設定
          した ‘__file__’ の値を返します。モジュールがインポートできなか
          った場合、 *note ZipImportError: 4acf. を送出します。

          Added in version 3.1.

      -- メソッド: get_source (fullname)

          'fullname' で指定されたモジュールのソースコードを返します。モ
          ジュールが見つからない場合、*note ZipImportError: 4acf. を送出
          します。アーカイブにはモジュールがあるもののソースコードがない
          場合、 *note None: 885. を返します。

      -- メソッド: is_package (fullname)

          'fullname' で指定されたモジュールがパッケージの場合 ‘True’ を
          返します。モジュールを見つけられない場合 *note ZipImportError:
          4acf. を送出します。

      -- メソッド: load_module (fullname)

          Load the module specified by 'fullname'.  'fullname' must be
          the fully qualified (dotted) module name.  Returns the
          imported module on success, raises *note ZipImportError: 4acf.
          on failure.

          Deprecated since version 3.10, will be removed in version
          3.15: 代わりに *note exec_module(): 339. を使用してください。

      -- メソッド: invalidate_caches ()

          Clear out the internal cache of information about files found
          within the ZIP archive.

          Added in version 3.10.

      -- の属性: archive

          importer に関連付けられた ZIP ファイルのファイル名です。サブパ
          スは含まれません。

      -- の属性: prefix

          モジュールを検索する ZIP ファイル中のサブパスです。この文字列
          は ZIP ファイルのルートを指している zipimporter オブジェクトで
          は空です。

     スラッシュでつなげると、*note archive: 4ad8. と *note prefix: 4ad9.
     属性は *note zipimporter: 4ad2. コンストラクタに渡された元々の
     'archivepath' 引数と等しくなります。


File: python.info,  Node: 使用例<47>,  Prev: zipimporter オブジェクト,  Up: zipimport --- Zip アーカイブからモジュールをインポートする

5.31.1.2 使用例
...............

Here is an example that imports a module from a ZIP archive - note that
the ‘zipimport’ module is not explicitly used.

     $ unzip -l example_archive.zip
     Archive:  example_archive.zip
       Length     Date   Time    Name
      --------    ----   ----    ----
          8467  01-01-00 12:30   example.py
      --------                   -------
          8467                   1 file

     >>> import sys
     >>> # Add the archive to the front of the module search path
     >>> sys.path.insert(0, 'example_archive.zip')
     >>> import example
     >>> example.__file__
     'example_archive.zip/example.py'


File: python.info,  Node: pkgutil --- パッケージ拡張ユーティリティ,  Next: modulefinder --- スクリプト中で使用されているモジュールの検索,  Prev: zipimport --- Zip アーカイブからモジュールをインポートする,  Up: モジュールのインポート

5.31.2 ‘pkgutil’ -- パッケージ拡張ユーティリティ
------------------------------------------------

'ソースコード:' Lib/pkgutil.py(1)

__________________________________________________________________

このモジュールはインポートシステムの、特にパッケージサポートに関するユー
ティリティです。

 -- クラス: pkgutil.ModuleInfo (module_finder, name, ispkg)

     モジュールの概要情報を格納する namedtuple

     Added in version 3.6.

 -- の関数: pkgutil.extend_path (path, name)

     パッケージを構成するモジュールの検索パスを拡張します。パッケージの
     ‘__init__.py’ で次のように書くことを意図したものです:

          from pkgutil import extend_path
          __path__ = extend_path(__path__, __name__)

     For each directory on *note sys.path: 3e4. that has a subdirectory
     that matches the package name, add the subdirectory to the
     package's *note __path__: 2054.  This is useful if one wants to
     distribute different parts of a single logical package as multiple
     directories.

     It also looks for ‘*.pkg’ files beginning where ‘*’ matches the
     'name' argument.  This feature is similar to ‘*.pth’ files (see the
     *note site: cc. module for more information), except that it
     doesn't special-case lines starting with ‘import’.  A ‘*.pkg’ file
     is trusted at face value: apart from skipping blank lines and
     ignoring comments, all entries found in a ‘*.pkg’ file are added to
     the path, regardless of whether they exist on the filesystem (this
     is a feature).

     入力パスがリストでない場合(フリーズされたパッケージのとき)は何もせ
     ずにリターンします。入力パスが変更されていなければ、アイテムを末尾
     に追加しただけのコピーを返します。

     *note sys.path: 3e4. はシーケンスであることが前提になっています。
     *note sys.path: 3e4. の要素の内、実在するディレクトリを指す文字列と
     なっていないものは無視されます。ファイル名として使ったときにエラー
     が発生する *note sys.path: 3e4. の Unicode要素がある場合、この関数
     (*note os.path.isdir(): c05. を実行している行) で例外が発生する可能
     性があります。

 -- の関数: pkgutil.get_importer (path_item)

     指定された 'path_item' に対する *note finder: 236a. を取得します。

     path hook により新しい finder が作成された場合は、それは *note
     sys.path_importer_cache: 7fa. にキャッシュされます。

     キャッシュ (やその一部) は、 *note sys.path_hooks: 1225. のリスキャ
     ンが必要になった場合は手動でクリアすることができます。

     バージョン 3.3 で変更: パッケージ内部の PEP 302(2) エミュレーション
     に依存するのではなく直接的に *note importlib: 7b. に基くように更新
     されました。

 -- の関数: pkgutil.iter_importers (fullname='')

     Yield *note finder: 236a. objects for the given module name.

     If 'fullname' contains a ‘'.'’, the finders will be for the package
     containing 'fullname', otherwise they will be all registered top
     level finders (i.e.  those on both *note sys.meta_path: f27. and
     *note sys.path_hooks: 1225.).

     その名前のついたモジュールがパッケージ内に含まれている場合、この関
     数を実行した副作用としてそのパッケージが import されます。

     モジュール名が指定されない場合は全てのトップレベルの finder が生成
     されます。

     バージョン 3.3 で変更: パッケージ内部の PEP 302(3) エミュレーション
     に依存するのではなく直接的に *note importlib: 7b. に基くように更新
     されました。

 -- の関数: pkgutil.iter_modules (path=None, prefix='')

     'path' を指定すればそのすべてのサブモジュールに対して、 'path' が
     ‘None’ なら *note sys.path: 3e4. のすべてのトップレベルモジュールに
     対して、*note ModuleInfo: f48. を yield します。

     'path' は ‘None’ か、モジュールを検索する path のリストのどちらかで
     なければなりません。

     'prefix' は出力の全てのモジュール名の頭に出力する文字列です。

          注釈: これは ‘iter_modules()’ メソッドを定義している *note
          finder: 236a. に対してのみ動作します。このインターフェイスは非
          標準なので、モジュールは *note importlib.machinery.FileFinder:
          127e. と *note zipimport.zipimporter: 4ad2. の実装も提供します
          。

     バージョン 3.3 で変更: パッケージ内部の PEP 302(4) エミュレーション
     に依存するのではなく直接的に *note importlib: 7b. に基くように更新
     されました。

 -- の関数: pkgutil.walk_packages (path=None, prefix='', onerror=None)

     'path' を指定すれば再帰的にその中のモジュールすべてに対して、
     'path' が ‘None’ ならばアクセスできるすべてのモジュールに対して、
     *note ModuleInfo: f48. を yield します。

     'path' は ‘None’ か、モジュールを検索する path のリストのどちらかで
     なければなりません。

     'prefix' は出力の全てのモジュール名の頭に出力する文字列です。

     この関数は与えられた 'path' 上の全ての 'パッケージ' (全てのモジュー
     ル 'ではない') を、サブモジュールを検索するのに必要な ‘__path__’ 属
     性にアクセスするために import します。

     'onerror' は、パッケージを import しようとしたときに何かの例外が発
     生した場合に、 1つの引数 (import しようとしていたパッケージの名前)
     で呼び出される関数です。 'onerror' 関数が提供されない場合、 *note
     ImportError: 65b. は補足され無視されます。それ以外の全ての例外は伝
     播し、検索を停止させます。

     例:

          # list all modules python can access
          walk_packages()

          # list all submodules of ctypes
          walk_packages(ctypes.__path__, ctypes.__name__ + '.')

          注釈: これは ‘iter_modules()’ メソッドを定義している *note
          finder: 236a. に対してのみ動作します。このインターフェイスは非
          標準なので、モジュールは *note importlib.machinery.FileFinder:
          127e. と *note zipimport.zipimporter: 4ad2. の実装も提供します
          。

     バージョン 3.3 で変更: パッケージ内部の PEP 302(5) エミュレーション
     に依存するのではなく直接的に *note importlib: 7b. に基くように更新
     されました。

 -- の関数: pkgutil.get_data (package, resource)

     パッケージからリソースを取得します。

     この関数は *note loader: 1a28. *note get_data: 4ae1. API のラッパー
     です。 'package' 引数は標準的なモジュール形式 (‘foo.bar’) のパッケ
     ージ名でなければなりません。 'resource' 引数は ‘/’ をパス区切りに使
     った相対ファイル名の形式です。親ディレクトリを ‘..’ としたり、ルー
     トからの (‘/’ で始まる) 名前を使うことはできません。

     この関数が返すのは指定されたリソースの内容であるバイナリ文字列です
     。

     ファイルシステム中に位置するパッケージで既にインポートされているも
     のに対しては、次と大体同じです:

          d = os.path.dirname(sys.modules[package].__file__)
          data = open(os.path.join(d, resource), 'rb').read()

     If the package cannot be located or loaded, or it uses a *note
     loader: 1a28. which does not support *note get_data: 4ae1, then
     ‘None’ is returned.  In particular, the *note loader: 1a28. for
     *note namespace packages: 2b2. does not support *note get_data:
     4ae1.

 -- の関数: pkgutil.resolve_name (name)

     Resolve a name to an object.

     This functionality is used in numerous places in the standard
     library (see bpo-12915(6)) - and equivalent functionality is also
     in widely used third-party packages such as setuptools, Django and
     Pyramid.

     It is expected that 'name' will be a string in one of the following
     formats, where W is shorthand for a valid Python identifier and dot
     stands for a literal period in these pseudo-regexes:

        * ‘W(.W)*’

        * ‘W(.W)*:(W(.W)*)?’

     The first form is intended for backward compatibility only.  It
     assumes that some part of the dotted name is a package, and the
     rest is an object somewhere within that package, possibly nested
     inside other objects.  Because the place where the package stops
     and the object hierarchy starts can't be inferred by inspection,
     repeated attempts to import must be done with this form.

     In the second form, the caller makes the division point clear
     through the provision of a single colon: the dotted name to the
     left of the colon is a package to be imported, and the dotted name
     to the right is the object hierarchy within that package.  Only one
     import is needed in this form.  If it ends with the colon, then a
     module object is returned.

     The function will return an object (which might be a module), or
     raise one of the following exceptions:

     *note ValueError: 2ec. - if 'name' isn't in a recognised format.

     *note ImportError: 65b. - if an import failed when it shouldn't
     have.

     *note AttributeError: 5f0. - If a failure occurred when traversing
     the object hierarchy within the imported package to get to the
     desired object.

     Added in version 3.9.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/pkgutil.py

   (2) https://peps.python.org/pep-0302/

   (3) https://peps.python.org/pep-0302/

   (4) https://peps.python.org/pep-0302/

   (5) https://peps.python.org/pep-0302/

   (6) https://bugs.python.org/issue?@action=redirect&bpo=12915


File: python.info,  Node: modulefinder --- スクリプト中で使用されているモジュールの検索,  Next: runpy --- Python モジュールの位置特定と実行,  Prev: pkgutil --- パッケージ拡張ユーティリティ,  Up: モジュールのインポート

5.31.3 ‘modulefinder’ -- スクリプト中で使用されているモジュールの検索
---------------------------------------------------------------------

'ソースコード:' Lib/modulefinder.py(1)

__________________________________________________________________

このモジュールでは、スクリプト中で import されているモジュールセットを調
べるために使える *note ModuleFinder: 1de5. クラスを提供しています。
‘modulefinder.py’ はまた、Python スクリプトのファイル名を引数に指定して
スクリプトとして実行し、 import されているモジュールのレポートを出力させ
ることもできます。

 -- の関数: modulefinder.AddPackagePath (pkg_name, path)

     'pkg_name' という名前のパッケージの在り処が 'path' であることを記録
     します。

 -- の関数: modulefinder.ReplacePackage (oldname, newname)

     実際にはパッケージ内で 'oldname' という名前になっているモジュールを
     'newname' という名前で指定できるようにします。

 -- クラス: modulefinder.ModuleFinder (path=None, debug=0, excludes=[],
          replace_paths=[])

     このクラスでは *note run_script(): 4ae8. および *note report():
     4ae9. メソッドを提供しています。これらのメソッドは何らかのスクリプ
     ト中で import されているモジュールの集合を調べます。 'path' はモジ
     ュールを検索する先のディレクトリ名からなるリストです。 'path' を指
     定しない場合、 ‘sys.path’ を使います。 'debug' にはデバッグレベルを
     設定します; 値を大きくすると、実行している内容を表すデバッグメッセ
     ージを出力します。 'excludes' は検索から除外するモジュール名です。
     'replace_paths' には、モジュールパス内で置き換えられるパスをタプル
     ‘(oldpath, newpath)’ からなるリストで指定します。

      -- メソッド: report ()

          スクリプトで import しているモジュールと、そのパスからなるリス
          トを列挙したレポートを標準出力に出力します。モジュールを見つけ
          られなかったり、モジュールがないように見える場合にも報告します
          。

      -- メソッド: run_script (pathname)

          'pathname' に指定したファイルの内容を解析します。ファイルには
          Python コードが入っていなければなりません。

      -- の属性: modules

          モジュール名をモジュールに結びつける辞書。 *note ModuleFinder
          の使用例: 4aeb. を参照して下さい。

* Menu:

* ModuleFinder の使用例::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/modulefinder.py


File: python.info,  Node: ModuleFinder の使用例,  Up: modulefinder --- スクリプト中で使用されているモジュールの検索

5.31.3.1 ‘ModuleFinder’ の使用例
................................

解析対象のスクリプトはこれ (bacon.py) です:

     import re, itertools

     try:
         import baconhameggs
     except ImportError:
         pass

     try:
         import guido.python.ham
     except ImportError:
         pass

bacon.py のレポートを出力するスクリプトです:

     from modulefinder import ModuleFinder

     finder = ModuleFinder()
     finder.run_script('bacon.py')

     print('Loaded modules:')
     for name, mod in finder.modules.items():
         print('%s: ' % name, end='')
         print(','.join(list(mod.globalnames.keys())[:3]))

     print('-'*50)
     print('Modules not imported:')
     print('\n'.join(finder.badmodules.keys()))

出力例です (アーキテクチャに依って違ってくるかもしれません):

     Loaded modules:
     _types:
     copyreg:  _inverted_registry,_slotnames,__all__
     re._compiler:  isstring,_sre,_optimize_unicode
     _sre:
     re._constants:  REPEAT_ONE,makedict,AT_END_LINE
     sys:
     re:  __module__,finditer,_expand
     itertools:
     __main__:  re,itertools,baconhameggs
     re._parser:  _PATTERNENDERS,SRE_FLAG_UNICODE
     array:
     types:  __module__,IntType,TypeType
     ---------------------------------------------------
     Modules not imported:
     guido.python.ham
     baconhameggs


File: python.info,  Node: runpy --- Python モジュールの位置特定と実行,  Next: importlib --- import の実装,  Prev: modulefinder --- スクリプト中で使用されているモジュールの検索,  Up: モジュールのインポート

5.31.4 ‘runpy’ -- Python モジュールの位置特定と実行
---------------------------------------------------

'ソースコード:' Lib/runpy.py(1)

__________________________________________________________________

The ‘runpy’ module is used to locate and run Python modules without
importing them first.  Its main use is to implement the *note -m: 23c.
command line switch that allows scripts to be located using the Python
module namespace rather than the filesystem.

これはサンドボックスモジュール 'ではない' ことに注意してください。すべて
のコードは現在のプロセスで実行され、あらゆる副作用 (たとえば他のモジュー
ルのキャッシュされたインポート等) は関数から戻った後にそのまま残ります。

Furthermore, any functions and classes defined by the executed code are
not guaranteed to work correctly after a ‘runpy’ function has returned.
If that limitation is not acceptable for a given use case, *note
importlib: 7b. is likely to be a more suitable choice than this module.

The ‘runpy’ module provides two functions:

 -- の関数: runpy.run_module (mod_name, init_globals=None,
          run_name=None, alter_sys=False)

     Execute the code of the specified module and return the resulting
     module's globals dictionary.  The module's code is first located
     using the standard import mechanism (refer to PEP 302(2) for
     details) and then executed in a fresh module namespace.

     The 'mod_name' argument should be an absolute module name.  If the
     module name refers to a package rather than a normal module, then
     that package is imported and the *note __main__: 1. submodule
     within that package is then executed and the resulting module
     globals dictionary returned.

     The optional dictionary argument 'init_globals' may be used to
     pre-populate the module's globals dictionary before the code is
     executed.  'init_globals' will not be modified.  If any of the
     special global variables below are defined in 'init_globals', those
     definitions are overridden by *note run_module(): 1b97.

     The special global variables ‘__name__’, ‘__spec__’, ‘__file__’,
     ‘__cached__’, ‘__loader__’ and ‘__package__’ are set in the globals
     dictionary before the module code is executed.  (Note that this is
     a minimal set of variables - other variables may be set implicitly
     as an interpreter implementation detail.)

     ‘__name__’ は、オプション引数 'run_name' が *note None: 885. でない
     場合、指定されたモジュールがパッケージであれば ‘mod_name +
     '.__main__'’ に、そうでなければ 'mod_name' 引数の値がセットされます
     。

     ‘__spec__’ will be set appropriately for the 'actually' imported
     module (that is, ‘__spec__.name’ will always be 'mod_name' or
     ‘mod_name + '.__main__'’, never 'run_name').

     ‘__file__’, ‘__cached__’, ‘__loader__’ and ‘__package__’ are *note
     set as normal: 2361. based on the module spec.

     引数 'alter_sys' が与えられて *note True: e07. に評価されるならば、
     ‘sys.argv[0]’ は ‘__file__’ の値で更新され ‘sys.modules[__name__]’
     は実行されるモジュールの一時的モジュールオブジェクトで更新されます
     。 ‘sys.argv[0]’ と ‘sys.modules[__name__]’ はどちらも関数が処理を
     戻す前にもとの値に復旧します。

     Note that this manipulation of *note sys: df. is not thread-safe.
     Other threads may see the partially initialised module, as well as
     the altered list of arguments.  It is recommended that the ‘sys’
     module be left alone when invoking this function from threaded
     code.

     参考
     ....

     コマンドラインから、 *note -m: 23c. オプションを与えることで同じ機
     能を実現出来ます。

     バージョン 3.1 で変更: Added ability to execute packages by looking
     for a *note __main__: 1. submodule.

     バージョン 3.2 で変更: ‘__cached__’ グローバル変数が追加されました
     ( PEP 3147(3) を参照)。

     バージョン 3.4 で変更: Updated to take advantage of the module spec
     feature added by PEP 451(4).  This allows ‘__cached__’ to be set
     correctly for modules run this way, as well as ensuring the real
     module name is always accessible as ‘__spec__.name’.

     バージョン 3.12 で変更: The setting of ‘__cached__’, ‘__loader__’,
     and ‘__package__’ are deprecated.  See *note ModuleSpec: 226c. for
     alternatives.

 -- の関数: runpy.run_path (path_name, init_globals=None, run_name=None)

     Execute the code at the named filesystem location and return the
     resulting module's globals dictionary.  As with a script name
     supplied to the CPython command line, 'file_path' may refer to a
     Python source file, a compiled bytecode file or a valid *note
     sys.path: 3e4. entry containing a *note __main__: 1. module (e.g.
     a zipfile containing a top-level ‘__main__.py’ file).

     For a simple script, the specified code is simply executed in a
     fresh module namespace.  For a valid *note sys.path: 3e4. entry
     (typically a zipfile or directory), the entry is first added to the
     beginning of ‘sys.path’.  The function then looks for and executes
     a *note __main__: 1. module using the updated path.  Note that
     there is no special protection against invoking an existing
     ‘__main__’ entry located elsewhere on ‘sys.path’ if there is no
     such module at the specified location.

     The optional dictionary argument 'init_globals' may be used to
     pre-populate the module's globals dictionary before the code is
     executed.  'init_globals' will not be modified.  If any of the
     special global variables below are defined in 'init_globals', those
     definitions are overridden by *note run_path(): 4a4.

     The special global variables ‘__name__’, ‘__spec__’, ‘__file__’,
     ‘__cached__’, ‘__loader__’ and ‘__package__’ are set in the globals
     dictionary before the module code is executed.  (Note that this is
     a minimal set of variables - other variables may be set implicitly
     as an interpreter implementation detail.)

     ‘__name__’ は、オプション引数 'run_name' が *note None: 885. でない
     場合、 'run_name' に設定され、それ以外の場合は ‘'<run_path>'’ に設
     定されます。

     If 'file_path' directly references a script file (whether as source
     or as precompiled byte code), then ‘__file__’ will be set to
     'file_path', and ‘__spec__’, ‘__cached__’, ‘__loader__’ and
     ‘__package__’ will all be set to *note None: 885.

     If 'file_path' is a reference to a valid *note sys.path: 3e4.
     entry, then ‘__spec__’ will be set appropriately for the imported
     *note __main__: 1. module (that is, ‘__spec__.name’ will always be
     ‘__main__’).  ‘__file__’, ‘__cached__’, ‘__loader__’ and
     ‘__package__’ will be *note set as normal: 2361. based on the
     module spec.

     A number of alterations are also made to the *note sys: df. module.
     Firstly, *note sys.path: 3e4. may be altered as described above.
     ‘sys.argv[0]’ is updated with the value of 'file_path' and
     ‘sys.modules[__name__]’ is updated with a temporary module object
     for the module being executed.  All modifications to items in *note
     sys: df. are reverted before the function returns.

     Note that, unlike *note run_module(): 1b97, the alterations made to
     *note sys: df. are not optional in this function as these
     adjustments are essential to allowing the execution of *note
     sys.path: 3e4. entries.  As the thread-safety limitations still
     apply, use of this function in threaded code should be either
     serialised with the import lock or delegated to a separate process.

     参考
     ....

     コマンドラインから *note インターフェイスオプション: 211b. で同じ機
     能を使えます (‘python path/to/script’)。

     Added in version 3.2.

     バージョン 3.4 で変更: Updated to take advantage of the module spec
     feature added by PEP 451(5).  This allows ‘__cached__’ to be set
     correctly in the case where ‘__main__’ is imported from a valid
     *note sys.path: 3e4. entry rather than being executed directly.

     バージョン 3.12 で変更: The setting of ‘__cached__’, ‘__loader__’,
     and ‘__package__’ are deprecated.

参考
....

PEP 338(6) - モジュールをスクリプトとして実行する

     PEP written and implemented by Nick Coghlan.

PEP 366(7) - main モジュールの明示的な相対インポート

     PEP written and implemented by Nick Coghlan.

PEP 451(8) - インポートシステムのための ModuleSpec 型

     PEP written and implemented by Eric Snow

*note コマンドラインと環境: 1da7. - CPython コマンドライン詳細

*note importlib.import_module(): 73c. 関数

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/runpy.py

   (2) https://peps.python.org/pep-0302/

   (3) https://peps.python.org/pep-3147/

   (4) https://peps.python.org/pep-0451/

   (5) https://peps.python.org/pep-0451/

   (6) https://peps.python.org/pep-0338/

   (7) https://peps.python.org/pep-0366/

   (8) https://peps.python.org/pep-0451/


File: python.info,  Node: importlib --- import の実装,  Next: importlib resources -- パッケージリソースの読み取り、オープン、アクセス,  Prev: runpy --- Python モジュールの位置特定と実行,  Up: モジュールのインポート

5.31.5 ‘importlib’ -- ‘import’ の実装
-------------------------------------

Added in version 3.1.

'ソースコード:' Lib/importlib/__init__.py(1)

__________________________________________________________________

* Menu:

* はじめに: はじめに<13>.
* 関数: 関数<13>.
* importlib.abc: importlib abc -- Abstract base classes related to import. Abstract base classes related to import
* importlib.machinery: importlib machinery -- Importers and path hooks. Importers and path hooks
* importlib.util: importlib util -- Utility code for importers. Utility code for importers
* 使用例: 使用例<48>.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/importlib/__init__.py


File: python.info,  Node: はじめに<13>,  Next: 関数<13>,  Up: importlib --- import の実装

5.31.5.1 はじめに
.................

The purpose of the ‘importlib’ package is three-fold.

1つ目は Python ソースコード中にある *note import: 7f8. 文の(そして、拡張
として、 *note __import__(): ad1. 関数の)実装を提供することです。このパ
ッケージは ‘import’ 文の、どの Python インタープリターでも動作する実装を
提供します。また、 Python 以外の言語で実装されたどの実装よりも把握しやす
い実装を提供します。

2つ目の目的は、このパッケージが公開している *note import: 7f8. を実装す
るための要素を利用して、(*note インポーター: 2448. として知られる) イン
ポートプロセスで動作するカスタムのオブジェクトを実装しやすくすることです
。

Three, the package contains modules exposing additional functionality
for managing aspects of Python packages:

   * *note importlib.metadata: 7e. presents access to metadata from
     third-party distributions.

   * *note importlib.resources: 7f. provides routines for accessing
     non-code "resources" from Python packages.

参考
....

*note import 文: 7f8.

     *note import: 7f8. 文の言語リファレンス。

Packages specification(1)

     パッケージの元の仕様。幾つかの動作はこの仕様が書かれた頃から変更さ
     れています (例: *note sys.modules: 17e6. で ‘None’ に基づくリダイレ
     クト)。

*note __import__(): 1279. 関数

     *note import: 7f8. 文はこの関数のシンタックスシュガーです。

*note sys.path モジュール検索パスの初期化: 18dc.

     The initialization of *note sys.path: 3e4.

PEP 235(2)

     大文字小文字を区別しないプラットフォームでのインポート

PEP 263(3)

     Python のソースコードのエンコーディング

PEP 302(4)

     新しいインポートフック

PEP 328(5)

     複数行のインポートと、絶対/相対インポート

PEP 366(6)

     main モジュールの明示的な相対インポート

PEP 420(7)

     暗黙的な名前空間パッケージ

PEP 451(8)

     インポートシステムのための ModuleSpec 型

PEP 488(9)

     PYO ファイルの撤廃

PEP 489(10)

     複数フェーズでの拡張モジュールの初期化

PEP 552(11)

     決定論的 pyc

PEP 3120(12)

     デフォルトのソースエンコーディングとして UTF-8 を使用

PEP 3147(13)

     PYC リポジトリディレクトリ

   ---------- Footnotes ----------

   (1) https://www.python.org/doc/essays/packages/

   (2) https://peps.python.org/pep-0235/

   (3) https://peps.python.org/pep-0263/

   (4) https://peps.python.org/pep-0302/

   (5) https://peps.python.org/pep-0328/

   (6) https://peps.python.org/pep-0366/

   (7) https://peps.python.org/pep-0420/

   (8) https://peps.python.org/pep-0451/

   (9) https://peps.python.org/pep-0488/

   (10) https://peps.python.org/pep-0489/

   (11) https://peps.python.org/pep-0552/

   (12) https://peps.python.org/pep-3120/

   (13) https://peps.python.org/pep-3147/


File: python.info,  Node: 関数<13>,  Next: importlib abc -- Abstract base classes related to import,  Prev: はじめに<13>,  Up: importlib --- import の実装

5.31.5.2 関数
.............

 -- の関数: importlib.__import__ (name, globals=None, locals=None,
          fromlist=(), level=0)

     組み込みの *note __import__(): ad1. 関数の実装です。

          注釈: プログラムからモジュールをインポートする場合はこの関数の
          代わりに *note import_module(): 73c. を使ってください。

 -- の関数: importlib.import_module (name, package=None)

     モジュールをインポートします。'name' 引数は、インポートするモジュー
     ルを絶対または相対表現 (例えば ‘pkg.mod’ または ‘..mod’) で指定しま
     す。name が相対表現で与えられたら、'package' 引数を、パッケージ名を
     解決するためのアンカーとなるパッケージの名前に設定する必要がありま
     す (例えば ‘import_module('..mod', 'pkg.subpkg')’ は ‘pkg.mod’ をイ
     ンポートします)。

     *note import_module(): 73c. 関数は *note importlib.__import__():
     1279. を単純化するラッパーとして働きます。つまり、この関数のすべて
     の意味は *note importlib.__import__(): 1279. から受け継いでいます。
     これらの2つの関数の最も重要な違いは、 *note import_module(): 73c. が
     指定されたパッケージやモジュール (例えば ‘pkg.mod’) を返すのに対し
     、 *note __import__(): ad1. はトップレベルのパッケージやモジュール
     (例えば ‘pkg’) を返すことです。

     もしモジュールを動的にインポートしていて、インタープリタの実行開始
     後にモジュールが作成された (例えば、 Python ソースファイルを作成し
     た) 場合、インポートシステムが新しいモジュールを見つけられるように
     、 *note invalidate_caches(): e0a. を呼ぶ必要があるでしょう。

     バージョン 3.3 で変更: 親パッケージは自動的にインポートされます。

 -- の関数: importlib.invalidate_caches ()

     *note sys.meta_path: f27. に保存されたファインダーの内部キャッシュ
     を無効にします。ファインダーが ‘invalidate_caches()’ を実装していれ
     ば、無効化を行うためにそれが呼び出されます。すべてのファインダーが
     新しいモジュールの存在に気づくことを保証しているプログラムの実行中
     に、モジュールが作成またはインストールされたなら、この関数が呼び出
     されるべきです。

     Added in version 3.3.

     バージョン 3.10 で変更: Namespace packages created/installed in a
     different *note sys.path: 3e4. location after the same namespace
     was already imported are noticed.

 -- の関数: importlib.reload (module)

     以前にインポートされた 'module' をリロードします。引数はモジュール
     オブジェクトでなければならず、したがってそれ以前に必ずインポートに
     成功していなければなりません。この関数は、モジュールのソースファイ
     ルを外部エディタで編集していて Python インタープリタから離れること
     なく新しいバージョンを試したい際に便利です。戻り値はモジュールオブ
     ジェクトです。 (もし再インポートが異なるオブジェクトを *note
     sys.modules: 17e6. に配置したら、元の 'module' とは異なるかもしれま
     せん。)

     *note reload(): 73d. が実行された場合:

        * Python モジュールのコードは再コンパイルされ、モジュールレベル
          のコードが再度実行されます。モジュールの辞書中にある何らかの名
          前に結び付けられたオブジェクトは、そのモジュールを最初にロード
          したときの *note ローダー: 1a28. を再利用して新たに定義されま
          す。拡張モジュールの ‘init’ 関数が二度呼び出されることはありま
          せん。

        * Python における他のオブジェクトと同様、以前のオブジェクトのメ
          モリ領域は、参照カウントがゼロにならないかぎり再利用されません
          。

        * モジュール名前空間内の名前は新しいオブジェクト (または更新され
          たオブジェクト) を指すよう更新されます。

        * 以前のオブジェクトが (外部の他のモジュールなどからの) 参照を受
          けている場合、それらを新たなオブジェクトに再束縛し直すことはな
          いので、必要なら自分で名前空間を更新しなければなりません。

     いくつか補足説明があります:

     モジュールが再ロードされた際、その辞書 (モジュールのグローバル変数
     を含みます) はそのまま残ります。名前の再定義を行うと、以前の定義を
     上書きするので、一般的には問題はありません。新たなバージョンのモジ
     ュールが古いバージョンで定義された名前を定義していない場合、古い定
     義がそのまま残ります。辞書がグローバルテーブルやオブジェクトのキャ
     ッシュを維持していれば、この機能をモジュールを有効性を引き出すため
     に使うことができます -- つまり、 *note try: 8f8. 文を使えば、必要に
     応じてテーブルがあるかどうかをテストし、その初期化を飛ばすことがで
     きます:

          try:
              cache
          except NameError:
              cache = {}

     組み込みモジュールや動的にロードされるモジュールを再ロードすること
     は、一般的にそれほど便利ではありません。 *note sys: df, *note
     __main__: 1, *note builtins: 13. やその他重要なモジュールの再ロード
     はお勧め出来ません。多くの場合、拡張モジュールは 1 度以上初期化され
     るようには設計されておらず、再ロードされた場合には何らかの理由で失
     敗するかもしれません。

     一方のモジュールが *note from: 14c3. ...  *note import: 7f8. ...  を
     使って、オブジェクトを他方のモジュールからインポートしているなら、
     他方のモジュールを *note reload(): 73d. で呼び出しても、そのモジュ
     ールからインポートされたオブジェクトを再定義することはできません --
     この問題を回避する一つの方法は、 *note from: 14c3. 文を再度実行する
     ことで、もう一つの方法は ‘from’ 文の代わりに ‘import’ と限定的な名
     前 ('module.name') を使うことです。

     あるモジュールがクラスのインスタンスを生成している場合、そのクラス
     を定義しているモジュールの再ロードはそれらインスタンスのメソッド定
     義に影響しません -- それらは古いクラス定義を使い続けます。これは派
     生クラスの場合でも同じです。

     Added in version 3.4.

     バージョン 3.7 で変更: リロードされたモジュールの *note ModuleSpec:
     226c. が欠けていたときは *note ModuleNotFoundError: d3d. が送出され
     ます。

          警告: This function is not thread-safe.  Calling it from
          multiple threads can result in unexpected behavior.  It's
          recommended to use the *note threading.Lock: 19f4. or other
          synchronization primitives for thread-safe module reloading.


File: python.info,  Node: importlib abc -- Abstract base classes related to import,  Next: importlib machinery -- Importers and path hooks,  Prev: 関数<13>,  Up: importlib --- import の実装

5.31.5.3 ‘importlib.abc’ - Abstract base classes related to import
..................................................................

'ソースコード:' Lib/importlib/abc.py(1)

__________________________________________________________________

The ‘importlib.abc’ module contains all of the core abstract base
classes used by *note import: 7f8.  Some subclasses of the core abstract
base classes are also provided to help in implementing the core ABCs.

抽象基底クラス階層:

     object
      +-- MetaPathFinder
      +-- PathEntryFinder
      +-- Loader
           +-- ResourceLoader --------+
           +-- InspectLoader          |
                +-- ExecutionLoader --+
                                      +-- FileLoader
                                      +-- SourceLoader

 -- クラス: importlib.abc.MetaPathFinder

     *note meta path finder: 127c. を表す抽象基底クラスです。

     Added in version 3.3.

     バージョン 3.10 で変更: No longer a subclass of ‘Finder’.

      -- メソッド: find_spec (fullname, path, target=None)

          An abstract method for finding a *note spec: 2363. for the
          specified module.  If this is a top-level import, 'path' will
          be ‘None’.  Otherwise, this is a search for a subpackage or
          module and 'path' will be the value of *note __path__: 2054.
          from the parent package.  If a spec cannot be found, ‘None’ is
          returned.  When passed in, ‘target’ is a module object that
          the finder may use to make a more educated guess about what
          spec to return.  *note importlib.util.spec_from_loader(): a6d.
          may be useful for implementing concrete ‘MetaPathFinders’.

          Added in version 3.4.

      -- メソッド: invalidate_caches ()

          このファインダーで使われている内部キャッシュがあれば無効にする
          オプションのメソッドです。 *note sys.meta_path: f27. 上のすべ
          てのファインダーのキャッシュを無効化する際、 *note
          importlib.invalidate_caches(): e0a. によって使われます。

          バージョン 3.4 で変更: Returns ‘None’ when called instead of
          *note NotImplemented: 1a2.

 -- クラス: importlib.abc.PathEntryFinder

     *note path entry finder: 127d. を表す抽象基底クラスです。 *note
     MetaPathFinder: a6e. と似ているところがありますが、
     ‘PathEntryFinder’ は *note importlib.machinery.PathFinder: 1224. が
     提供するパスに基づく import サブシステムの中でのみ使うことが意図さ
     れています。

     Added in version 3.3.

     バージョン 3.10 で変更: No longer a subclass of ‘Finder’.

      -- メソッド: find_spec (fullname, target=None)

          指定されたモジュールに対応する *note スペック: 2363. を検索す
          る抽象メソッド。ファインダーは、割り当てられている *note
          パス・エントリー: 2458. 内のモジュールだけを検索します。スペッ
          クが見つからなければ ‘None’ が返されます。 ‘target’ は、渡され
          てきたならモジュールオブジェクトです。これはファインダーがどの
          ようなスペックを返せばよいか推測するために使用します。具体的な
          ‘PathEntryFinders’ を実装するためには *note
          importlib.util.spec_from_loader(): a6d. が便利かもしれません。

          Added in version 3.4.

      -- メソッド: invalidate_caches ()

          このファインダーで使われている内部キャッシュがあれば無効にする
          オプションのメソッドです。キャッシュされたすべてのファインダー
          の無効化する際、 *note
          importlib.machinery.PathFinder.invalidate_caches(): e09. によ
          って使われます。

 -- クラス: importlib.abc.Loader

     *note loader: 1a28. の抽象基底クラスです。ローダーの厳密な定義は
     PEP 302(2) を参照してください。

     リソースの読み出しをサポートさせたいローダーには、 *note
     importlib.resources.abc.ResourceReader: 4af8. で指定されている
     ‘get_resource_reader()’ メソッドを実装してください。

     バージョン 3.7 で変更: オプションの ‘get_resource_reader()’ メソッ
     ドが導入されました。

      -- メソッド: create_module (spec)

          モジュールをインポートする際に使用されるモジュールオブジェクト
          を返すメソッド。このメソッドは ‘None’ を戻すことができ、その場
          合はデフォルトのモジュール作成のセマンティクスが適用されること
          を示します。

          Added in version 3.4.

          バージョン 3.6 で変更: *note exec_module(): a6a. が定義されて
          いる場合は、このメソッドはオプションではなくなりました。

      -- メソッド: exec_module (module)

          モジュールがインポートまたはリロードされる際に、そのモジュール
          をモジュール自身の名前空間の中で実行する抽象的なメソッド。
          *note exec_module(): a6a. が呼ばれる時点で、モジュールはすでに
          初期設定されている必要があります。 このメソッドが存在するとき
          は、 *note create_module(): eac. の定義が必須です。

          Added in version 3.4.

          バージョン 3.6 で変更: *note create_module(): eac. の定義が必
          須となりました。

      -- メソッド: load_module (fullname)

          モジュールをロードするためのレガシーなメソッドです。モジュール
          がロードできなければ *note ImportError: 65b. を送出し、ロード
          できればロードされたモジュールを返します。

          If the requested module already exists in *note sys.modules:
          17e6, that module should be used and reloaded.  Otherwise the
          loader should create a new module and insert it into *note
          sys.modules: 17e6. before any loading begins, to prevent
          recursion from the import.  If the loader inserted a module
          and the load fails, it must be removed by the loader from
          *note sys.modules: 17e6.; modules already in *note
          sys.modules: 17e6. before the loader began execution should be
          left alone.

          ローダーはモジュールにいくつかの属性を設定する必要があります。
          (なお、これらの属性には、モジュールがリロードされた際に変化す
          るものがあります):

             - *note module.__name__: 15a3.

             - *note module.__file__: 2369.

             - *note module.__cached__: 321. '(deprecated)'

             - *note module.__path__: 2054.

             - *note module.__package__: 323. '(deprecated)'

             - *note module.__loader__: 33b. '(deprecated)'

          *note exec_module(): a6a. が利用可能な場合、後方互換な機能が提
          供されます。

          バージョン 3.4 で変更: Raise *note ImportError: 65b. when
          called instead of *note NotImplementedError: 36b.
          Functionality provided when *note exec_module(): a6a. is
          available.

          Deprecated since version 3.4, will be removed in version 3.15:
          モジュールをロードするための推奨される API は、 *note
          exec_module(): a6a. (および *note create_module(): eac.) です
          。ローダーは *note load_module(): a69. の代わりにそれを実装す
          るべきです。 *note exec_module(): a6a. が実装されている場合、
          インポート機構は *note load_module(): a69. の他のすべての責任
          を肩代わりします。

 -- クラス: importlib.abc.ResourceLoader

     'TraversableResources に取って代わられました'

          *note loader: 1a28. の抽象基底クラスで、ストレージバックエンド
          から任意のリソースをロードするオプションの PEP 302(3) プロトコ
          ルを実装します。

          バージョン 3.7 で非推奨: This ABC is deprecated in favour of
          supporting resource loading through *note
          importlib.resources.abc.TraversableResources: 2f9.  This class
          exists for backwards compatibility only with other ABCs in
          this module.

           -- メソッド: abstractmethod get_data (path)

                    An abstract method to return the bytes for the data
                    located at 'path'.  Loaders that have a file-like
                    storage back-end that allows storing arbitrary data
                    can implement this abstract method to give direct
                    access to the data stored.  *note OSError: 2c0. is
                    to be raised if the 'path' cannot be found.  The
                    'path' is expected to be constructed using a
                    module's *note __file__: 2369. attribute or an item
                    from a package's *note __path__: 2054.

                    バージョン 3.4 で変更: *note NotImplementedError:
                    36b. の代わりに *note OSError: 2c0. を送出します。

 -- クラス: importlib.abc.InspectLoader

     *note loader: 1a28. の抽象基底クラスで、ローダーがモジュールを検査
     するためのオプションの PEP 302(4) プロトコルを実装します。

      -- メソッド: get_code (fullname)

          モジュールの *note code: 1b. オブジェクトを返すか、 (例えば組
          み込みモジュールの場合に) モジュールがコードオブジェクトを持た
          なければ ‘None’ を返します。要求されたモジュールをローダーが見
          つけられなかった場合は *note ImportError: 65b. を送出します。

               注釈: このメソッドにはデフォルト実装がありますが、とはい
               えパフォーマンスのために、可能ならばオーバライドしたほう
               が良いです。

          バージョン 3.4 で変更: このメソッドはもはや抽象メソッドではな
          く、具象実装が提供されます。

      -- メソッド: abstractmethod get_source (fullname)

               モジュールのソースを返す抽象メソッドです。これは認識され
               たすべての行セパレータを ‘'\n'’ 文字に変換し、 *note
               universal newlines: f35. を使ったテキスト文字列として返さ
               れます。利用できるソースがなければ (例えば組み込みモジュ
               ール)、 ‘None’ を返します。指定されたモジュールが見つから
               なければ、 *note ImportError: 65b. を送出します。

               バージョン 3.4 で変更: *note NotImplementedError: 36b. の
               代わりに *note ImportError: 65b. を送出します。

      -- メソッド: is_package (fullname)

          モジュールがパッケージであれば True を返し、そうでなければ
          False を返すオプションのメソッドです。 *note ローダー: 1a28. が
          モジュールを見つけられなかったなら *note ImportError: 65b. が
          送出されます。

          バージョン 3.4 で変更: *note NotImplementedError: 36b. の代わ
          りに *note ImportError: 65b. を送出します。

      -- メソッド: static source_to_code (data, path='<string>')

          Python のソースからコードオブジェクトを作ります。

          'data' 引数は *note compile(): 4b1. 関数がサポートするもの (す
          なわち文字列かバイト) なら何でも構いません。'path' 引数はソー
          スコードの元々の場所への "パス" でなければなりませんが、抽象概
          念 (例えば zip ファイル内の場所) でも構いません。

          結果のコードオブジェクトを使って、 ‘exec(code,
          module.__dict__)’ を呼ぶことでモジュール内でコードを実行できま
          す。

          Added in version 3.4.

          バージョン 3.5 で変更: スタティックメソッドになりました。

      -- メソッド: exec_module (module)

          *note Loader.exec_module(): a6a. の実装です。

          Added in version 3.4.

      -- メソッド: load_module (fullname)

          *note Loader.load_module(): a69. の実装です。

          Deprecated since version 3.4, will be removed in version 3.15:
          代わりに *note exec_module(): 1214. を使用してください。

 -- クラス: importlib.abc.ExecutionLoader

     *note InspectLoader: 1156. から継承された抽象基底クラスで、実装され
     ていれば、モジュールをスクリプトとして実行する助けになります。この
     抽象基底クラスはオプションの PEP 302(5) プロトコルを表します。

      -- メソッド: abstractmethod get_filename (fullname)

               An abstract method that is to return the value of *note
               __file__: 2369. for the specified module.  If no path is
               available, *note ImportError: 65b. is raised.

               ソースコードが利用できるなら、そのモジュールのロードにバ
               イトコードが使われたかにかかわらず、このメソッドはそのソ
               ースファイルへのパスを返す必要があります。

               バージョン 3.4 で変更: *note NotImplementedError: 36b. の
               代わりに *note ImportError: 65b. を送出します。

 -- クラス: importlib.abc.FileLoader (fullname, path)

     *note ResourceLoader: de2. と *note ExecutionLoader: 4afb. から継承
     された抽象基底クラスで、 *note ResourceLoader.get_data(): 4ae1. お
     よび *note ExecutionLoader.get_filename(): 4afc. の具象実装を提供し
     ます。

     'fullname' 引数は、ローダーが解決しようとするモジュールの、完全に解
     決された名前です。'path' 引数は、モジュールのファイルへのパスです。

     Added in version 3.3.

      -- の属性: name

          ローダーが扱えるモジュールの名前です。

      -- の属性: path

          モジュールのファイルへのパスです。

      -- メソッド: load_module (fullname)

          親クラスの ‘load_module()’ を呼び出します。

          Deprecated since version 3.4, will be removed in version 3.15:
          代わりに *note Loader.exec_module(): a6a. を使用してください。

      -- メソッド: abstractmethod get_filename (fullname)

          *note path: 4afe. を返します。

      -- メソッド: abstractmethod get_data (path)

          'path' をバイナリファイルとして読み込み、そのバイト列を返しま
          す。

 -- クラス: importlib.abc.SourceLoader

     ソース (オプションでバイトコード) ファイルのロードを実装する抽象基
     底クラスです。このクラスは、 *note ResourceLoader: de2. と *note
     ExecutionLoader: 4afb. の両方を継承し、以下の実装が必要です:

        * *note ResourceLoader.get_data(): 4ae1.

        * 
          *note ExecutionLoader.get_filename(): 4afc.

               ソースファイルへのパスのみを返す必要があります。ソースな
               しのロードはサポートされていません。

     このクラスでこれらの抽象メソッドを定義することで、バイトコードファ
     イルを追加でサポートします。これらのメソッドを定義しなければ (また
     はそのモジュールが *note NotImplementedError: 36b. を送出すれば)、
     このローダーはソースコードに対してのみ働きます。これらのメソッドを
     実装することで、ローダーはソースとバイトコードファイル 'の組み合わ
     せ' に対して働きます。バイトコードのみを与えた 'ソースのない' ロー
     ドは認められません。バイトコードファイルは、 Python コンパイラによ
     る解析の工程をなくして速度を上げる最適化です。ですから、バイトコー
     ド特有の API は公開されていません。

      -- メソッド: path_stats (path)

          指定されたパスについてのメタデータを含む *note dict: 183. を返
          す、オプションの抽象メソッドです。サポートされる辞書のキーは:

             - ‘'mtime'’ (必須): ソースコードの更新時刻を表す整数または
               浮動小数点数です。

             - ‘'size'’ (任意): バイト数で表したソースコードのサイズです
               。

          未来の拡張のため、辞書内の他のキーは無視されます。パスが扱えな
          ければ、 *note OSError: 2c0. が送出されます。

          Added in version 3.3.

          バージョン 3.4 で変更: *note NotImplementedError: 36b. の代わ
          りに *note OSError: 2c0. を送出します。

      -- メソッド: path_mtime (path)

          指定されたパスの更新時刻を返す、オプションの抽象メソッドです。

          バージョン 3.3 で非推奨: このメソッドは廃止され、 *note
          path_stats(): 13a1. が推奨されます。このモジュールを実装する必
          要はありませんが、互換性のため現在も利用できます。パスが扱えな
          ければ、 *note OSError: 2c0. が送出されます。

          バージョン 3.4 で変更: *note NotImplementedError: 36b. の代わ
          りに *note OSError: 2c0. を送出します。

      -- メソッド: set_data (path, data)

          ファイルパスに指定されたバイト列を書き込むオプションの抽象メソ
          ッドです。存在しない中間ディレクトリがあれば、自動で作成されま
          す。

          When writing to the path fails because the path is read-only
          (*note errno.EACCES: 270c./*note PermissionError: f3e.), do
          not propagate the exception.

          バージョン 3.4 で変更: 呼ばれたときに *note
          NotImplementedError: 36b. を送出することは最早ありません。

      -- メソッド: get_code (fullname)

          *note InspectLoader.get_code(): 1157. の具象実装です。

      -- メソッド: exec_module (module)

          *note Loader.exec_module(): a6a. の具象実装です。

          Added in version 3.4.

      -- メソッド: load_module (fullname)

          *note Loader.load_module(): a69. の具象実装です。

          Deprecated since version 3.4, will be removed in version 3.15:
          代わりに *note exec_module(): 1215. を使用してください。

      -- メソッド: get_source (fullname)

          *note InspectLoader.get_source(): 115a. の具象実装です。

      -- メソッド: is_package (fullname)

          *note InspectLoader.is_package(): 4af9. の具象実装です。モジュ
          ールは、次の '両方' を満たすならパッケージであると決定されます
          。モジュールの (*note ExecutionLoader.get_filename(): 4afc. で
          与えられる) ファイルパスが、ファイル拡張子を除くと ‘__init__’
          という名のファイルであること。モジュール名自体が ‘__init__’ で
          終わらないこと。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/importlib/abc.py

   (2) https://peps.python.org/pep-0302/

   (3) https://peps.python.org/pep-0302/

   (4) https://peps.python.org/pep-0302/

   (5) https://peps.python.org/pep-0302/


File: python.info,  Node: importlib machinery -- Importers and path hooks,  Next: importlib util -- Utility code for importers,  Prev: importlib abc -- Abstract base classes related to import,  Up: importlib --- import の実装

5.31.5.4 ‘importlib.machinery’ - Importers and path hooks
.........................................................

'ソースコード:' Lib/importlib/machinery.py(1)

__________________________________________________________________

このモジュールには、 *note import: 7f8. がモジュールを検索してロードする
のに役立つ様々なオブジェクトがあります。

 -- データ: importlib.machinery.SOURCE_SUFFIXES

     認識されているソースモジュールのファイル接尾辞を表す文字列のリスト
     です。

     Added in version 3.3.

 -- データ: importlib.machinery.DEBUG_BYTECODE_SUFFIXES

     最適化されていないバイトコードモジュールのファイル接尾辞を表す文字
     列のリストです。

     Added in version 3.3.

     バージョン 3.5 で非推奨: Use *note BYTECODE_SUFFIXES: 73a. instead.

 -- データ: importlib.machinery.OPTIMIZED_BYTECODE_SUFFIXES

     最適化されたバイトコードモジュールのファイル接尾辞を表す文字列のリ
     ストです。

     Added in version 3.3.

     バージョン 3.5 で非推奨: Use *note BYTECODE_SUFFIXES: 73a. instead.

 -- データ: importlib.machinery.BYTECODE_SUFFIXES

     認識されているバイトコードモジュールのファイル接尾辞を表す文字列の
     リストです (先頭のドットを含みます)。

     Added in version 3.3.

     バージョン 3.5 で変更: この値は ‘__debug__’ に依存しなくなりました
     。

 -- データ: importlib.machinery.EXTENSION_SUFFIXES

     認識されている最適化された拡張モジュールのファイル接尾辞を表す文字
     列のリストです。

     Added in version 3.3.

 -- の関数: importlib.machinery.all_suffixes ()

     標準のインポート機構によって認識されているすべてのファイル接尾辞を
     表す文字列の組み合わせられたリストを返します。これが役立つのは、あ
     るファイルシステムパスがモジュールを参照する可能性があるかだけを知
     りたくて、そのモジュールの種類を詳しく知る必要はないコード (例えば
     *note inspect.getmodulename(): f34.) です。

     Added in version 3.3.

 -- クラス: importlib.machinery.BuiltinImporter

     組み込みモジュールの *note importer: 2448. です。すべての既知のモジ
     ュールは *note sys.builtin_module_names: 2047. に列挙されています。
     このクラスは *note importlib.abc.MetaPathFinder: a6e. および *note
     importlib.abc.InspectLoader: 1156. 抽象基底クラスを実装します。

     インスタンス化の必要性を軽減するため、このクラスにはクラスメソッド
     だけが定義されています。

     バージョン 3.5 で変更: PEP 489(2) の一環として、ビルトインインポー
     ターは ‘Loader.create_module()’ と ‘Loader.exec_module()’ を実装し
     ています。

 -- クラス: importlib.machinery.FrozenImporter

     フリーズされたモジュールの *note インポーター: 2448. です。このクラ
     スは *note importlib.abc.MetaPathFinder: a6e. および *note
     importlib.abc.InspectLoader: 1156. 抽象基底クラスを実装します。

     インスタンス化の必要性を軽減するため、このクラスにはクラスメソッド
     だけが定義されています。

     バージョン 3.4 で変更: Gained ‘create_module()’ and ‘exec_module()’
     methods.

 -- クラス: importlib.machinery.WindowsRegistryFinder

     Windows レジストリで宣言されたモジュールの *note finder: 236a. です
     。このクラスは *note importlib.abc.MetaPathFinder: a6e. 抽象基底ク
     ラスを実装します。

     インスタンス化の必要性を軽減するため、このクラスにはクラスメソッド
     だけが定義されています。

     Added in version 3.3.

     バージョン 3.6 で非推奨: 代わりに *note site: cc. の設定を使ってく
     ださい。 Python の将来のバージョンでは、デフォルトでこのファインダ
     ーが使えなくなるかもしれません。

 -- クラス: importlib.machinery.PathFinder

     *note sys.path: 3e4. およびパッケージの ‘__path__’ 属性の *note
     Finder: 236a. です。このクラスは *note
     importlib.abc.MetaPathFinder: a6e. 抽象基底クラスを実装します。

     インスタンス化の必要性を軽減するため、このクラスにはクラスメソッド
     だけが定義されています。

      -- メソッド: classmethod find_spec (fullname, path=None,
               target=None)

          *note sys.path: 3e4. または定義されていれば 'path' から、
          'fullname' で指定されたモジュールの *note スペック: 2363. の検
          索を試みるクラスメソッドです。検索されるそれぞれのパスエントリ
          に対して *note sys.path_importer_cache: 7fa. が検査されます。
          偽でないオブジェクトが見つかれば、それが目的のモジュールを検索
          するための *note パスエントリ・ファインダー: 127d. として使わ
          れます。 *note sys.path_importer_cache: 7fa. に目的のエントリ
          が見つからなければ、パスエントリに対するファインダーが *note
          sys.path_hooks: 1225. から検索され、見つかれば、それが *note
          sys.path_importer_cache: 7fa. に保管されるとともに、モジュール
          について問い合わせられます。それでもファインダーが見つからなけ
          れば ‘None’ が保管され、また返されます。

          Added in version 3.4.

          バージョン 3.5 で変更: もしカレントワーキングディレクトリ - 空
          の文字列によって表されている - がすでに有効でなければ、 ‘None’
          が返されますが値は *note sys.path_importer_cache: 7fa. にキャ
          ッシュされません。

      -- メソッド: classmethod invalidate_caches ()

          Calls *note importlib.abc.PathEntryFinder.invalidate_caches():
          4af7. on all finders stored in *note sys.path_importer_cache:
          7fa. that define the method.  Otherwise entries in *note
          sys.path_importer_cache: 7fa. set to ‘None’ are deleted.

          バージョン 3.7 で変更: Entries of ‘None’ in *note
          sys.path_importer_cache: 7fa. are deleted.

     バージョン 3.4 で変更: ‘''’ (すなわち空の文字列) に対してはカレント
     ワーキングディレクトリとともに *note sys.path_hooks: 1225. のオブジ
     ェクトを呼び出します。

 -- クラス: importlib.machinery.FileFinder (path, *loader_details)

     ファイルシステムからの結果をキャッシュする *note
     importlib.abc.PathEntryFinder: a6f. の具象実装です。

     'path' 引数は検索を担当するファインダーのディレクトリです。

     'loader_details' 引数は、可変個の 2 要素タプルで、それぞれがローダ
     ーとローダーが認識するファイル接尾辞のシーケンスとを含みます。ロー
     ダーは、呼び出し可能でモジュール名と見つかったファイルのパスとの 2
     引数を受け付けることを期待されます。

     ファインダーはモジュール検索のたびに stat を呼び出し、必要に応じて
     ディレクトリの内容をキャッシュすることで、コードキャッシュが古くな
     っていないことを確かめます。キャッシュの古さはオペレーティングシス
     テムのファイルシステムのステート情報の粒度に依存しますから、モジュ
     ールを検索し、新しいファイルを作成し、その後に新しいファイルが表す
     モジュールを検索する、という競合状態の可能性があります。この操作が
     stat の呼び出しの粒度に収まるほど速く起こると、モジュールの検索が失
     敗します。これを防ぐためには、モジュールを動的に作成する際に、必ず
     *note importlib.invalidate_caches(): e0a. を呼び出してください。

     Added in version 3.3.

      -- の属性: path

          ファインダーが検索されるパスです。

      -- メソッド: find_spec (fullname, target=None)

          *note path: 4b08. 内で 'fullname' を扱うスペックの探索を試みま
          す。

          Added in version 3.4.

      -- メソッド: invalidate_caches ()

          内部キャッシュを完全に消去します。

      -- メソッド: classmethod path_hook (*loader_details)

          A class method which returns a closure for use on *note
          sys.path_hooks: 1225.  An instance of *note FileFinder: 127e.
          is returned by the closure using the path argument given to
          the closure directly and 'loader_details' indirectly.

          クロージャへの引数が存在するディレクトリでなければ、 *note
          ImportError: 65b. が送出されます。

 -- クラス: importlib.machinery.SourceFileLoader (fullname, path)

     *note importlib.abc.FileLoader: 127f. を継承し、その他いくつかのメ
     ソッドの具象実装を提供する、 *note importlib.abc.SourceLoader:
     4b02. の具象実装です。

     Added in version 3.3.

      -- の属性: name

          このローダーが扱うモジュールの名前です。

      -- の属性: path

          ソースファイルへのパスです。

      -- メソッド: is_package (fullname)

          *note path: 4b0c. がパッケージを表すとき ‘True’ を返します。

      -- メソッド: path_stats (path)

          *note importlib.abc.SourceLoader.path_stats(): 13a1. の具象実
          装です。

      -- メソッド: set_data (path, data)

          *note importlib.abc.SourceLoader.set_data(): 4b03. の具象実装
          です。

      -- メソッド: load_module (name=None)

          ロードするモジュールの名前指定がオプションの、 *note
          importlib.abc.Loader.load_module(): a69. の具象実装です。

          Deprecated since version 3.6, will be removed in version 3.15:
          代わりに *note importlib.abc.Loader.exec_module(): a6a. を使用
          してください。

 -- クラス: importlib.machinery.SourcelessFileLoader (fullname, path)

     バイトコードファイル (すなわちソースコードファイルが存在しない) を
     インポートできる *note importlib.abc.FileLoader: 127f. の具象実装で
     す。

     注意として、バイトコードを直接使う (つまりソースコードファイルがな
     い) と、そのモジュールはすべての Python 実装では使用できないし、新
     しいバージョンの Python ではバイトコードフォーマットが変更されてい
     たら使用できません。

     Added in version 3.3.

      -- の属性: name

          ローダーが扱うモジュールの名前です。

      -- の属性: path

          バイトコードファイルへのパスです。

      -- メソッド: is_package (fullname)

          そのモジュールがパッケージであるかを *note path: 4b11. に基づ
          いて決定します。

      -- メソッド: get_code (fullname)

          *note path: 4b11. から作成された *note name: 4b10. のコードオ
          ブジェクトを返します。

      -- メソッド: get_source (fullname)

          このローダーが使われたとき、バイトコードファイルのソースがなけ
          れば ‘None’ を返します。

      -- メソッド: load_module (name=None)

     ロードするモジュールの名前指定がオプションの、 *note
     importlib.abc.Loader.load_module(): a69. の具象実装です。

     Deprecated since version 3.6, will be removed in version 3.15: 代わ
     りに *note importlib.abc.Loader.exec_module(): a6a. を使用してくだ
     さい。

 -- クラス: importlib.machinery.ExtensionFileLoader (fullname, path)

     拡張モジュールのための *note importlib.abc.ExecutionLoader: 4afb. の
     具象実装です。

     'fullname' 引数はローダーがサポートするモジュールの名前を指定します
     。'path' 引数は拡張モジュールのファイルへのパスです。

     Note that, by default, importing an extension module will fail in
     subinterpreters if it doesn't implement multi-phase init (see PEP
     489(3)), even if it would otherwise import successfully.

     Added in version 3.3.

     バージョン 3.12 で変更: Multi-phase init is now required for use in
     subinterpreters.

      -- の属性: name

          ローダーがサポートするモジュールの名前です。

      -- の属性: path

          拡張モジュールへのパスです。

      -- メソッド: create_module (spec)

          与えられたスペックから PEP 489(4) に従ってモジュールオブジェク
          トを作成します。

          Added in version 3.5.

      -- メソッド: exec_module (module)

          与えられたモジュールオブジェクトを PEP 489(5) に従って初期化し
          ます。

          Added in version 3.5.

      -- メソッド: is_package (fullname)

          Returns ‘True’ if the file path points to a package's
          ‘__init__’ module based on *note EXTENSION_SUFFIXES: 739.

      -- メソッド: get_code (fullname)

          拡張モジュールにコードオブジェクトがなければ ‘None’ を返します
          。

      -- メソッド: get_source (fullname)

          拡張モジュールにソースコードがなければ ‘None’ を返します。

      -- メソッド: get_filename (fullname)

          *note path: 4b16. を返します。

          Added in version 3.4.

 -- クラス: importlib.machinery.NamespaceLoader (name, path,
          path_finder)

     A concrete implementation of *note importlib.abc.InspectLoader:
     1156. for namespace packages.  This is an alias for a private class
     and is only made public for introspecting the ‘__loader__’
     attribute on namespace packages:

          >>> from importlib.machinery import NamespaceLoader
          >>> import my_namespace
          >>> isinstance(my_namespace.__loader__, NamespaceLoader)
          True
          >>> import importlib.abc
          >>> isinstance(my_namespace.__loader__, importlib.abc.Loader)
          True

     Added in version 3.11.

 -- クラス: importlib.machinery.ModuleSpec (name, loader, *,
          origin=None, loader_state=None, is_package=None)

     A specification for a module's import-system-related state.  This
     is typically exposed as the module's *note __spec__: 2364.
     attribute.  Many of these attributes are also available directly on
     a module: for example, ‘module.__spec__.origin == module.__file__’.
     Note, however, that while the 'values' are usually equivalent, they
     can differ since there is no synchronization between the two
     objects.  For example, it is possible to update the module's *note
     __file__: 2369. at runtime and this will not be automatically
     reflected in the module's *note __spec__.origin: 4b1c, and vice
     versa.

     Added in version 3.4.

      -- の属性: name

          The module's fully qualified name (see *note module.__name__:
          15a3.).  The *note finder: 236a. should always set this
          attribute to a non-empty string.

      -- の属性: loader

          The *note loader: 1a28. used to load the module (see *note
          module.__loader__: 33b.).  The *note finder: 236a. should
          always set this attribute.

      -- の属性: origin

          The location the *note loader: 1a28. should use to load the
          module (see *note module.__file__: 2369.).  For example, for
          modules loaded from a ‘.py’ file this is the filename.  The
          *note finder: 236a. should always set this attribute to a
          meaningful value for the *note loader: 1a28. to use.  In the
          uncommon case that there is not one (like for namespace
          packages), it should be set to ‘None’.

      -- の属性: submodule_search_locations

          A (possibly empty) *note sequence: 716. of strings enumerating
          the locations in which a package's submodules will be found
          (see *note module.__path__: 2054.).  Most of the time there
          will only be a single directory in this list.

          The *note finder: 236a. should set this attribute to a
          sequence, even an empty one, to indicate to the import system
          that the module is a package.  It should be set to ‘None’ for
          non-package modules.  It is set automatically later to a
          special object for namespace packages.

      -- の属性: loader_state

          The *note finder: 236a. may set this attribute to an object
          containing additional, module-specific data to use when
          loading the module.  Otherwise it should be set to ‘None’.

      -- の属性: cached

          The filename of a compiled version of the module's code (see
          *note module.__cached__: 321.).  The *note finder: 236a.
          should always set this attribute but it may be ‘None’ for
          modules that do not need compiled code stored.

      -- の属性: parent

          (Read-only) The fully qualified name of the package the module
          is in (or the empty string for a top-level module).  See *note
          module.__package__: 323.  If the module is a package then this
          is the same as *note name: 2365.

      -- の属性: has_location

          ‘True’ if the spec's *note origin: 4b1c. refers to a loadable
          location, ‘False’ otherwise.  This value impacts how ‘origin’
          is interpreted and how the module's *note __file__: 2369. is
          populated.

 -- クラス: importlib.machinery.AppleFrameworkLoader (name, path)

     フレームワーク形式の拡張モジュールを読み込み事ができる、特殊な
     *note importlib.machinery.ExtensionFileLoader: eae. です。

     iOS App Store との互換性のため、 iOS アプリの 'すべての' バイナリモ
     ジュールは、パッケージ化されたアプリの ‘Frameworks’ フォルダーに保
     存された、適切なメタデータ付きのフレームワークにある動的ライブラリ
     である必要があります。フレームワークごとにバイナリは一つだけで、
     Frameworks フォルダーの外に実行可能バイナリデータを設置することはで
     きません。

     To accommodate this requirement, when running on iOS, extension
     module binaries are 'not' packaged as ‘.so’ files on ‘sys.path’,
     but as individual standalone frameworks.  To discover those
     frameworks, this loader is registered against the ‘.fwork’ file
     extension, with a ‘.fwork’ file acting as a placeholder in the
     original location of the binary on ‘sys.path’.  The ‘.fwork’ file
     contains the path of the actual binary in the ‘Frameworks’ folder,
     relative to the app bundle.  To allow for resolving a
     framework-packaged binary back to the original location, the
     framework is expected to contain a ‘.origin’ file that contains the
     location of the ‘.fwork’ file, relative to the app bundle.

     例えば、‘from foo.bar import _whiz’ をインポートする場合を考えてみ
     ましょう。 ‘_whiz’ がバイナリモジュール
     ‘sources/foo/bar/_whiz.abi3.so’ で実装されており、 ‘sources’ のアプ
     リケーションバンドルからの相対パスが ‘sys.path’ に登録されています
     。このモジュールは
     ‘Frameworks/foo.bar._whiz.framework/foo.bar._whiz’ （フレームワーク
     名はモジュールの完全なインポートパスから命名されています）として、
     ‘Info.plist’ ファイルをバイナリをフレームワークとして識別する
     ‘.framework’ ディレクトリ内に設置して配布しなければなりません。
     ‘foo.bar._whiz’ モジュールは、元の場所で、
     ‘Frameworks/foo.bar._whiz/foo.bar._whiz’ のパスを含む
     ‘sources/foo/bar/_whiz.abi3.fwork’ マーカーファイルに記述されます。
     また、フレームワークは、 ‘.fwork’ へのパスを含む
     ‘Frameworks/foo.bar._whiz.framework/foo.bar._whiz.origin’ も含まな
     ければなりません。

     When a module is loaded with this loader, the ‘__file__’ for the
     module will report as the location of the ‘.fwork’ file.  This
     allows code to use the ‘__file__’ of a module as an anchor for file
     system traversal.  However, the spec origin will reference the
     location of the 'actual' binary in the ‘.framework’ folder.

     The Xcode project building the app is responsible for converting
     any ‘.so’ files from wherever they exist in the ‘PYTHONPATH’ into
     frameworks in the ‘Frameworks’ folder (including stripping
     extensions from the module file, the addition of framework
     metadata, and signing the resulting framework), and creating the
     ‘.fwork’ and ‘.origin’ files.  This will usually be done with a
     build step in the Xcode project; see the iOS documentation for
     details on how to construct this build step.

     Added in version 3.13.

     *note Availability: 213f.: iOS.

      -- の属性: name

          ローダーがサポートするモジュールの名前です。

      -- の属性: path

          拡張モジュールの ‘.fwork’ ファイルへのパス。

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/importlib/machinery.py

   (2) https://peps.python.org/pep-0489/

   (3) https://peps.python.org/pep-0489/

   (4) https://peps.python.org/pep-0489/

   (5) https://peps.python.org/pep-0489/


File: python.info,  Node: importlib util -- Utility code for importers,  Next: 使用例<48>,  Prev: importlib machinery -- Importers and path hooks,  Up: importlib --- import の実装

5.31.5.5 ‘importlib.util’ - Utility code for importers
......................................................

'ソースコード:' Lib/importlib/util.py(1)

__________________________________________________________________

このモジュールには、 *note インポーター: 2448. の構築を助ける様々なオブ
ジェクトがあります。

 -- データ: importlib.util.MAGIC_NUMBER

     バイトコードバージョン番号を表しているバイト列。バイトコードのロー
     ド／書き込みについてヘルプが必要なら *note
     importlib.abc.SourceLoader: 4b02. を参照してください。

     Added in version 3.4.

 -- の関数: importlib.util.cache_from_source (path, debug_override=None,
          *, optimization=None)

     ソース 'path' に関連付けられたバイトコンパイルされたファイルの PEP
     3147(2)/ PEP 488(3) パスを返します。例えば、 'path' が
     ‘/foo/bar/baz.py’ なら、 Python 3.2 の場合返り値は
     ‘/foo/bar/__pycache__/baz.cpython-32.pyc’ になります。 ‘cpython-32’
     という文字列は、現在のマジックタグから得られます (マジックタグにつ
     いては ‘get_tag()’ を参照; ‘sys.implementation.cache_tag’ が未定義
     なら *note NotImplementedError: 36b. が送出されます。)

     'optimization' パラメータは、バイトコードファイルの最適化レベルを指
     定するために使われます。空文字列は最適化しないことを表します。した
     がって、 'optimization' が ‘''’ のとき ‘/foo/bar/baz.py’ に対して
     ‘/foo/bar/__pycache__/baz.cpython-32.pyc’ というバイトコードパスが
     返ります。 ‘None’ にするとインタープリタの最適化レベルが使われます
     。それ以外では値の文字列表現が使われます。したがって、
     'optimization' が ‘2’ のとき ‘/foo/bar/baz.py’ に対して
     ‘/foo/bar/__pycache__/baz.cpython-32.opt-2.pyc’ というバイトコード
     パスが返ります。 'optimization' の文字列表現は英数字だけが可能で、
     そうでなければ *note ValueError: 2ec. が上げられます。

     'debug_override' パラメータは deprecated で、システムの ‘__debug__’
     値をオーバーライドするために使用できます。 ‘True’ 値は
     'optimization' を空文字列に設定するのと等価です。 ‘False’ 値は
     'optimization' を ‘1’ に設定するのと同等です。もし 'debug_override'
     と 'optimization' のどちらも ‘None’ 以外であれば *note TypeError:
     198. が上げられます。

     Added in version 3.4.

     バージョン 3.5 で変更: 'optimization' パラメータが追加され、
     'debug_override' パラメータは deprecated になりました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: importlib.util.source_from_cache (path)

     PEP 3147(4) ファイル名への 'path' が与えられると、関連するソースコ
     ードのファイルパスを返します。例えば、 'path' が
     ‘/foo/bar/__pycache__/baz.cpython-32.pyc’ なら、返されるパスは
     ‘/foo/bar/baz.py’ になります。 'path' は存在する必要はありませんが
     、 PEP 3147(5) または PEP 488(6) フォーマットに一致しない場合は
     *note ValueError: 2ec. が送出されます。
     ‘sys.implementation.cache_tag’ が定義されていない場合、 *note
     NotImplementedError: 36b. が送出されます。

     Added in version 3.4.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: importlib.util.decode_source (source_bytes)

     与えられたソースコードを表すバイト列をデコードして、文字列としてそ
     れを一般的な改行形式 (universal newlines) で返します (*note
     importlib.abc.InspectLoader.get_source(): 115a. で要求されるように
     )。

     Added in version 3.4.

 -- の関数: importlib.util.resolve_name (name, package)

     相対的なモジュール名を解決して絶対的なものにします。

     'name' の先頭にドットがなければ、単に 'name' が返されます。これによ
     り、例えば ‘importlib.util.resolve_name('sys', __spec__.parent)’ を
     使うときに 'package' 変数が必要かどうかを確認する必要がなくなります
     。

     'name' が相対的なモジュール名であるにもかかわらず 'package' が偽値
     (例えば ‘None’ や空文字列) ならば、 *note ImportError: 65b. が送出
     されます。相対的な名前がそれを含むパッケージから抜け出る (例えば
     ‘spam’ パッケージ内から ‘..bacon’ を要求する) 場合にも *note
     ImportError: 65b. が送出されます。

     Added in version 3.3.

     バージョン 3.9 で変更: To improve consistency with import
     statements, raise *note ImportError: 65b. instead of *note
     ValueError: 2ec. for invalid relative import attempts.

 -- の関数: importlib.util.find_spec (name, package=None)

     Find the *note spec: 2363. for a module, optionally relative to the
     specified 'package' name.  If the module is in *note sys.modules:
     17e6, then ‘sys.modules[name].__spec__’ is returned (unless the
     spec would be ‘None’ or is not set, in which case *note ValueError:
     2ec. is raised).  Otherwise a search using *note sys.meta_path:
     f27. is done.  ‘None’ is returned if no spec is found.

     'name' がサブモジュールを示している (ドットを含む) 場合、親モジュー
     ルは自動的にインポートされます。

     'name' と 'package' は ‘import_module()’ に対するものと同じように機
     能します。

     Added in version 3.4.

     バージョン 3.7 で変更: Raises *note ModuleNotFoundError: d3d.
     instead of *note AttributeError: 5f0. if 'package' is in fact not a
     package (i.e.  lacks a *note __path__: 2054. attribute).

 -- の関数: importlib.util.module_from_spec (spec)

     'spec' と *note spec.loader.create_module: eac. に基づいて新しいモ
     ジュールを作ります。

     *note spec.loader.create_module: eac. が ‘None’ を返さない場合は、
     既に存在するどの属性もリセットされません。また、 'spec' にアクセス
     したり属性をモジュールに設定したりする際に *note AttributeError:
     5f0. 例外が起きても例外は送出されません。

     この関数は、新しいモジュールを作る方法として *note
     types.ModuleType: 1014. よりも推奨されます。なぜなら、できるだけ多
     くのインポートコントロールされた属性をモジュールに設定するために
     'spec' が使用されるからです。

     Added in version 3.5.

 -- の関数: importlib.util.spec_from_loader (name, loader, *,
          origin=None, is_package=None)

     この関数は、スペックに不足している情報を埋めるために *note
     ModuleSpec: 226c. のような利用可能な *note loader: 1a28. API を使い
     ます。

     Added in version 3.4.

 -- の関数: importlib.util.spec_from_file_location (name, location, *,
          loader=None, submodule_search_locations=None)

     ファイルへのパスにもとづいて *note ModuleSpec: 226c. インスタンスを
     生成するためのファクトリー関数。不足している情報は、ローダー API を
     利用してスペックから得られる情報と、モジュールがファイルベースであ
     るという暗黙的な情報によって埋められます。

     Added in version 3.4.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- の関数: importlib.util.source_hash (source_bytes)

     Return the hash of 'source_bytes' as bytes.  A hash-based ‘.pyc’
     file embeds the *note source_hash(): d3e. of the corresponding
     source file's contents in its header.

     Added in version 3.7.

 -- の関数: importlib.util._incompatible_extension_module_restrictions
          (*, disable_check)

     A context manager that can temporarily skip the compatibility check
     for extension modules.  By default the check is enabled and will
     fail when a single-phase init module is imported in a
     subinterpreter.  It will also fail for a multi-phase init module
     that doesn't explicitly support a per-interpreter GIL, when
     imported in an interpreter with its own GIL.

     Note that this function is meant to accommodate an unusual case;
     one which is likely to eventually go away.  There's is a pretty
     good chance this is not what you were looking for.

     You can get the same effect as this function by implementing the
     basic interface of multi-phase init ( PEP 489(7)) and lying about
     support for multiple interpreters (or per-interpreter GIL).

          警告: Using this function to disable the check can lead to
          unexpected behavior and even crashes.  It should only be used
          during extension module development.

     Added in version 3.12.

 -- クラス: importlib.util.LazyLoader (loader)

     モジュールが属性アクセスできるようになるまで、モジュールのローダー
     の実行を遅延するクラス。

     This class 'only' works with loaders that define *note
     exec_module(): a6a. as control over what module type is used for
     the module is required.  For those same reasons, the loader's *note
     create_module(): eac. method must return ‘None’ or a type for which
     its ‘__class__’ attribute can be mutated along with not using *note
     slots: 7f7.  Finally, modules which substitute the object placed
     into *note sys.modules: 17e6. will not work as there is no way to
     properly replace the module references throughout the interpreter
     safely; *note ValueError: 2ec. is raised if such a substitution is
     detected.

          注釈: 起動時間が重要なプロジェクトでは、もし決して使われないモ
          ジュールがあれば、このクラスを使ってモジュールをロードするコス
          トを最小化できるかもしれません。スタートアップ時間が重要でない
          プロジェクトでは、遅延されたロードの際に発生して文脈の外で起こ
          るエラーメッセージのため、このクラスの使用は '著しく' 推奨され
          ません。

     Added in version 3.5.

     バージョン 3.6 で変更: Began calling *note create_module(): eac,
     removing the compatibility warning for *note
     importlib.machinery.BuiltinImporter: ead. and *note
     importlib.machinery.ExtensionFileLoader: eae.

      -- メソッド: classmethod factory (loader)

          遅延ローダを生成する callable を返すクラスメソッド。これは、ロ
          ーダーをインスタンスとしてではなくクラスとして渡すような状況に
          おいて使われることを意図しています。

               suffixes = importlib.machinery.SOURCE_SUFFIXES
               loader = importlib.machinery.SourceFileLoader
               lazy_loader = importlib.util.LazyLoader.factory(loader)
               finder = importlib.machinery.FileFinder(path, (lazy_loader, suffixes))

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/importlib/util.py

   (2) https://peps.python.org/pep-3147/

   (3) https://peps.python.org/pep-0488/

   (4) https://peps.python.org/pep-3147/

   (5) https://peps.python.org/pep-3147/

   (6) https://peps.python.org/pep-0488/

   (7) https://peps.python.org/pep-0489/


File: python.info,  Node: 使用例<48>,  Prev: importlib util -- Utility code for importers,  Up: importlib --- import の実装

5.31.5.6 使用例
...............

* Menu:

* プログラムからのインポート::
* モジュールがインポートできるか確認する::
* ソースファイルから直接インポートする::
* Implementing lazy imports::
* インポーターのセットアップ::
* Approximating importlib.import_module(): Approximating importlib import_module.


File: python.info,  Node: プログラムからのインポート,  Next: モジュールがインポートできるか確認する,  Up: 使用例<48>

5.31.5.7 プログラムからのインポート
...................................

プログラムからモジュールをインポートするには、 *note
importlib.import_module(): 73c. を使ってください。

     import importlib

     itertools = importlib.import_module('itertools')


File: python.info,  Node: モジュールがインポートできるか確認する,  Next: ソースファイルから直接インポートする,  Prev: プログラムからのインポート,  Up: 使用例<48>

5.31.5.8 モジュールがインポートできるか確認する
...............................................

インポートを実際に行わずに、あるモジュールがインポートできるかを知る必要
がある場合は、 *note importlib.util.find_spec(): 5af. を使ってください。

Note that if ‘name’ is a submodule (contains a dot), *note
importlib.util.find_spec(): 5af. will import the parent module.

     import importlib.util
     import sys

     # For illustrative purposes.
     name = 'itertools'

     if name in sys.modules:
         print(f"{name!r} already in sys.modules")
     elif (spec := importlib.util.find_spec(name)) is not None:
         # If you chose to perform the actual import ...
         module = importlib.util.module_from_spec(spec)
         sys.modules[name] = module
         spec.loader.exec_module(module)
         print(f"{name!r} has been imported")
     else:
         print(f"can't find the {name!r} module")


File: python.info,  Node: ソースファイルから直接インポートする,  Next: Implementing lazy imports,  Prev: モジュールがインポートできるか確認する,  Up: 使用例<48>

5.31.5.9 ソースファイルから直接インポートする
.............................................

This recipe should be used with caution: it is an approximation of an
import statement where the file path is specified directly, rather than
*note sys.path: 3e4. being searched.  Alternatives should first be
considered first, such as modifying *note sys.path: 3e4. when a proper
module is required, or using *note runpy.run_path(): 4a4. when the
global namespace resulting from running a Python file is appropriate.

To import a Python source file directly from a path, use the following
recipe:

     import importlib.util
     import sys


     def import_from_path(module_name, file_path):
         spec = importlib.util.spec_from_file_location(module_name, file_path)
         module = importlib.util.module_from_spec(spec)
         sys.modules[module_name] = module
         spec.loader.exec_module(module)
         return module


     # For illustrative purposes only (use of `json` is arbitrary).
     import json
     file_path = json.__file__
     module_name = json.__name__

     # Similar outcome as `import json`.
     json = import_from_path(module_name, file_path)


File: python.info,  Node: Implementing lazy imports,  Next: インポーターのセットアップ,  Prev: ソースファイルから直接インポートする,  Up: 使用例<48>

5.31.5.10 Implementing lazy imports
...................................

The example below shows how to implement lazy imports:

     >>> import importlib.util
     >>> import sys
     >>> def lazy_import(name):
     ...     spec = importlib.util.find_spec(name)
     ...     loader = importlib.util.LazyLoader(spec.loader)
     ...     spec.loader = loader
     ...     module = importlib.util.module_from_spec(spec)
     ...     sys.modules[name] = module
     ...     loader.exec_module(module)
     ...     return module
     ...
     >>> lazy_typing = lazy_import("typing")
     >>> #lazy_typing is a real module object,
     >>> #but it is not loaded in memory yet.
     >>> lazy_typing.TYPE_CHECKING
     False


File: python.info,  Node: インポーターのセットアップ,  Next: Approximating importlib import_module,  Prev: Implementing lazy imports,  Up: 使用例<48>

5.31.5.11 インポーターのセットアップ
....................................

For deep customizations of import, you typically want to implement an
*note importer: 2448.  This means managing both the *note finder: 236a.
and *note loader: 1a28. side of things.  For finders there are two
flavours to choose from depending on your needs: a *note meta path
finder: 127c. or a *note path entry finder: 127d.  The former is what
you would put on *note sys.meta_path: f27. while the latter is what you
create using a *note path entry hook: 245a. on *note sys.path_hooks:
1225. which works with *note sys.path: 3e4. entries to potentially
create a finder.  This example will show you how to register your own
importers so that import will use them (for creating an importer for
yourself, read the documentation for the appropriate classes defined
within this package):

     import importlib.machinery
     import sys

     # For illustrative purposes only.
     SpamMetaPathFinder = importlib.machinery.PathFinder
     SpamPathEntryFinder = importlib.machinery.FileFinder
     loader_details = (importlib.machinery.SourceFileLoader,
                       importlib.machinery.SOURCE_SUFFIXES)

     # Setting up a meta path finder.
     # Make sure to put the finder in the proper location in the list in terms of
     # priority.
     sys.meta_path.append(SpamMetaPathFinder)

     # Setting up a path entry finder.
     # Make sure to put the path hook in the proper location in the list in terms
     # of priority.
     sys.path_hooks.append(SpamPathEntryFinder.path_hook(loader_details))


File: python.info,  Node: Approximating importlib import_module,  Prev: インポーターのセットアップ,  Up: 使用例<48>

5.31.5.12 Approximating ‘importlib.import_module()’
...................................................

Import itself is implemented in Python code, making it possible to
expose most of the import machinery through importlib.  The following
helps illustrate the various APIs that importlib exposes by providing an
approximate implementation of *note importlib.import_module(): 73c.:

     import importlib.util
     import sys

     def import_module(name, package=None):
         """An approximate implementation of import."""
         absolute_name = importlib.util.resolve_name(name, package)
         try:
             return sys.modules[absolute_name]
         except KeyError:
             pass

         path = None
         if '.' in absolute_name:
             parent_name, _, child_name = absolute_name.rpartition('.')
             parent_module = import_module(parent_name)
             path = parent_module.__spec__.submodule_search_locations
         for finder in sys.meta_path:
             spec = finder.find_spec(absolute_name, path)
             if spec is not None:
                 break
         else:
             msg = f'No module named {absolute_name!r}'
             raise ModuleNotFoundError(msg, name=absolute_name)
         module = importlib.util.module_from_spec(spec)
         sys.modules[absolute_name] = module
         spec.loader.exec_module(module)
         if path is not None:
             setattr(parent_module, child_name, module)
         return module


File: python.info,  Node: importlib resources -- パッケージリソースの読み取り、オープン、アクセス,  Next: importlib resources abc -- リソースの抽象基底クラス,  Prev: importlib --- import の実装,  Up: モジュールのインポート

5.31.6 ‘importlib.resources’ - パッケージリソースの読み取り、オープン、アクセス
-------------------------------------------------------------------------------

'ソースコード:' Lib/importlib/resources/__init__.py(1)

__________________________________________________________________

Added in version 3.7.

This module leverages Python's import system to provide access to
'resources' within 'packages'.

"Resources" are file-like resources associated with a module or package
in Python.  The resources may be contained directly in a package, within
a subdirectory contained in that package, or adjacent to modules outside
a package.  Resources may be text or binary.  As a result, a package's
Python module sources (.py), compilation artifacts (pycache), and
installation artifacts (like *note reserved filenames: 32b. in
directories) are technically de-facto resources of that package.  In
practice, however, resources are primarily those non-Python artifacts
exposed specifically by the package author.

Resources can be opened or read in either binary or text mode.

リソースは大体ディレクトリの中のファイルに似ていますが、これは単なる例え
話であることを頭に入れておくことが重要です。例えば、パッケージとそのリソ
ースは *note zipimport: 138. を使って zip ファイルからインポートすること
ができます。

     注釈: このモジュールは、 pkg_resources(2) Basic Resource Access(3)
     に似た機能を、そのパッケージのパフォーマンスのオーバーヘッドを伴わ
     ずに提供します。 これにより、パッケージに含まれるリソースの読み込み
     がより簡単になり、より安定した一貫した意味付けができるようになりま
     す。

     このモジュールのスタンドアローンバックポートでは、
     importlib.resources の使用(4) と pkg_resources から
     importlib.resources への移行(5) についての詳細情報を提供しています
     。

*note Loaders: 10c7. でリソースの読み込みをサポートしたい場合は、 *note
importlib.resources.abc.ResourceReader: 4af8. で指定された
‘get_resource_reader(fullname)’ メソッドを実装しなければいけません。

 -- クラス: importlib.resources.Anchor

     Represents an anchor for resources, either a *note module object:
     1014. or a module name as a string.  Defined as ‘Union[str,
     ModuleType]’.

 -- の関数: importlib.resources.files (anchor: Anchor | None = None)

     Returns a *note Traversable: 2fa. object representing the resource
     container (think directory) and its resources (think files).  A
     Traversable may contain other containers (think subdirectories).

     'anchor' is an optional *note Anchor: 4b2f.  If the anchor is a
     package, resources are resolved from that package.  If a module,
     resources are resolved adjacent to that module (in the same package
     or the package root).  If the anchor is omitted, the caller's
     module is used.

     Added in version 3.9.

     バージョン 3.12 で変更: 'package' parameter was renamed to
     'anchor'.  'anchor' can now be a non-package module and if omitted
     will default to the caller's module.  'package' is still accepted
     for compatibility but will raise a *note DeprecationWarning: 1a3.
     Consider passing the anchor positionally or using
     ‘importlib_resources >= 5.10’ for a compatible interface on older
     Pythons.

 -- の関数: importlib.resources.as_file (traversable)

     Given a *note Traversable: 2fa. object representing a file or
     directory, typically from *note importlib.resources.files(): 6b6,
     return a context manager for use in a *note with: 186. statement.
     The context manager provides a *note pathlib.Path: 266. object.

     Exiting the context manager cleans up any temporary file or
     directory created when the resource was extracted from e.g.  a zip
     file.

     Use ‘as_file’ when the Traversable methods (‘read_text’, etc) are
     insufficient and an actual file or directory on the file system is
     required.

     Added in version 3.9.

     バージョン 3.12 で変更: Added support for 'traversable'
     representing a directory.

* Menu:

* 関数 API::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/importlib/resources/__init__.py

   (2) https://setuptools.readthedocs.io/en/latest/pkg_resources.html

   (3) 
https://setuptools.readthedocs.io/en/latest/pkg_resources.html#basic-resource-access

   (4) https://importlib-resources.readthedocs.io/en/latest/using.html

   (5) 
https://importlib-resources.readthedocs.io/en/latest/migration.html


File: python.info,  Node: 関数 API,  Up: importlib resources -- パッケージリソースの読み取り、オープン、アクセス

5.31.6.1 関数 API
.................

A set of simplified, backwards-compatible helpers is available.  These
allow common operations in a single function call.

For all the following functions:

   - 'anchor' is an *note Anchor: 4b2f, as in *note files(): 6b6.
     Unlike in ‘files’, it may not be omitted.

   - 'path_names' are components of a resource's path name, relative to
     the anchor.  For example, to get the text of resource named
     ‘info.txt’, use:

          importlib.resources.read_text(my_module, "info.txt")

     Like *note Traversable.joinpath: 2fa, The individual components
     should use forward slashes (‘/’) as path separators.  For example,
     the following are equivalent:

          importlib.resources.read_binary(my_module, "pics/painting.png")
          importlib.resources.read_binary(my_module, "pics", "painting.png")

     For backward compatibility reasons, functions that read text
     require an explicit 'encoding' argument if multiple 'path_names'
     are given.  For example, to get the text of ‘info/chapter1.txt’,
     use:

          importlib.resources.read_text(my_module, "info", "chapter1.txt",
                                        encoding='utf-8')

 -- の関数: importlib.resources.open_binary (anchor, *path_names)

     Open the named resource for binary reading.

     See *note the introduction: 4b31. for details on 'anchor' and
     'path_names'.

     This function returns a *note BinaryIO: 23a. object, that is, a
     binary stream open for reading.

     This function is roughly equivalent to:

          files(anchor).joinpath(*path_names).open('rb')

     バージョン 3.13 で変更: Multiple 'path_names' are accepted.

 -- の関数: importlib.resources.open_text (anchor, *path_names,
          encoding='utf-8', errors='strict')

     Open the named resource for text reading.  By default, the contents
     are read as strict UTF-8.

     See *note the introduction: 4b31. for details on 'anchor' and
     'path_names'.  'encoding' and 'errors' have the same meaning as in
     built-in *note open(): 316.

     For backward compatibility reasons, the 'encoding' argument must be
     given explicitly if there are multiple 'path_names'.  This
     limitation is scheduled to be removed in Python 3.15.

     This function returns a *note TextIO: 239. object, that is, a text
     stream open for reading.

     This function is roughly equivalent to:

          files(anchor).joinpath(*path_names).open('r', encoding=encoding)

     バージョン 3.13 で変更: Multiple 'path_names' are accepted.
     'encoding' and 'errors' must be given as keyword arguments.

 -- の関数: importlib.resources.read_binary (anchor, *path_names)

     Read and return the contents of the named resource as *note bytes:
     192.

     See *note the introduction: 4b31. for details on 'anchor' and
     'path_names'.

     This function is roughly equivalent to:

          files(anchor).joinpath(*path_names).read_bytes()

     バージョン 3.13 で変更: Multiple 'path_names' are accepted.

 -- の関数: importlib.resources.read_text (anchor, *path_names,
          encoding='utf-8', errors='strict')

     Read and return the contents of the named resource as *note str:
     169.  By default, the contents are read as strict UTF-8.

     See *note the introduction: 4b31. for details on 'anchor' and
     'path_names'.  'encoding' and 'errors' have the same meaning as in
     built-in *note open(): 316.

     For backward compatibility reasons, the 'encoding' argument must be
     given explicitly if there are multiple 'path_names'.  This
     limitation is scheduled to be removed in Python 3.15.

     This function is roughly equivalent to:

          files(anchor).joinpath(*path_names).read_text(encoding=encoding)

     バージョン 3.13 で変更: Multiple 'path_names' are accepted.
     'encoding' and 'errors' must be given as keyword arguments.

 -- の関数: importlib.resources.path (anchor, *path_names)

     Provides the path to the 'resource' as an actual file system path.
     This function returns a context manager for use in a *note with:
     186. statement.  The context manager provides a *note pathlib.Path:
     266. object.

     Exiting the context manager cleans up any temporary files created,
     e.g.  when the resource needs to be extracted from a zip file.

     For example, the *note stat(): a24. method requires an actual file
     system path; it can be used like this:

          with importlib.resources.path(anchor, "resource.txt") as fspath:
              result = fspath.stat()

     See *note the introduction: 4b31. for details on 'anchor' and
     'path_names'.

     This function is roughly equivalent to:

          as_file(files(anchor).joinpath(*path_names))

     バージョン 3.13 で変更: Multiple 'path_names' are accepted.
     'encoding' and 'errors' must be given as keyword arguments.

 -- の関数: importlib.resources.is_resource (anchor, *path_names)

     Return ‘True’ if the named resource exists, otherwise ‘False’.
     This function does not consider directories to be resources.

     See *note the introduction: 4b31. for details on 'anchor' and
     'path_names'.

     This function is roughly equivalent to:

          files(anchor).joinpath(*path_names).is_file()

     バージョン 3.13 で変更: Multiple 'path_names' are accepted.

 -- の関数: importlib.resources.contents (anchor, *path_names)

     Return an iterable over the named items within the package or path.
     The iterable returns names of resources (e.g.  files) and
     non-resources (e.g.  directories) as *note str: 169.  The iterable
     does not recurse into subdirectories.

     See *note the introduction: 4b31. for details on 'anchor' and
     'path_names'.

     This function is roughly equivalent to:

          for resource in files(anchor).joinpath(*path_names).iterdir():
              yield resource.name

     バージョン 3.11 で非推奨: Prefer ‘iterdir()’ as above, which offers
     more control over the results and richer functionality.


File: python.info,  Node: importlib resources abc -- リソースの抽象基底クラス,  Next: importlib metadata -- パッケージメタデータへのアクセス,  Prev: importlib resources -- パッケージリソースの読み取り、オープン、アクセス,  Up: モジュールのインポート

5.31.7 ‘importlib.resources.abc’ - リソースの抽象基底クラス
-----------------------------------------------------------

'ソースコード:' Lib/importlib/resources/abc.py(1)

__________________________________________________________________

Added in version 3.11.

 -- クラス: importlib.resources.abc.ResourceReader

     'TraversableResources に取って代わられました'

     'resources' の読み出し機能を提供する *note 抽象基底クラス (abstract
     base class, ABC): 13ce. です。

     From the perspective of this ABC, a 'resource' is a binary artifact
     that is shipped within a package.  Typically this is something like
     a data file that lives next to the ‘__init__.py’ file of the
     package.  The purpose of this class is to help abstract out the
     accessing of such data files so that it does not matter if the
     package and its data file(s) are stored e.g.  in a zip file versus
     on the file system.

     For any of methods of this class, a 'resource' argument is expected
     to be a *note path-like object: 5a1. which represents conceptually
     just a file name.  This means that no subdirectory paths should be
     included in the 'resource' argument.  This is because the location
     of the package the reader is for, acts as the "directory".  Hence
     the metaphor for directories and file names is packages and
     resources, respectively.  This is also why instances of this class
     are expected to directly correlate to a specific package (instead
     of potentially representing multiple packages or a module).

     Loaders that wish to support resource reading are expected to
     provide a method called ‘get_resource_reader(fullname)’ which
     returns an object implementing this ABC's interface.  If the module
     specified by fullname is not a package, this method should return
     *note None: 885.  An object compatible with this ABC should only be
     returned when the specified module is a package.

     バージョン 3.12 で非推奨: Use *note
     importlib.resources.abc.TraversableResources: 2f9. instead.

      -- メソッド: abstractmethod open_resource (resource)

          Returns an opened, *note file-like object: 17ac. for binary
          reading of the 'resource'.

          リソースが見付からない場合は、 *note FileNotFoundError: 264. が
          送出されます。

      -- メソッド: abstractmethod resource_path (resource)

          'resource' へのファイルシステムパスを返します。

          リソースの実体がファイルシステムに存在しない場合、 *note
          FileNotFoundError: 264. が送出されます。

      -- メソッド: abstractmethod is_resource (path)

          Returns ‘True’ if the named 'path' is considered a resource.
          *note FileNotFoundError: 264. is raised if 'path' does not
          exist.

          バージョン 3.10 で変更: The argument 'name' was renamed to
          'path'.

      -- メソッド: abstractmethod contents ()

          Returns an *note iterable: 12f1. of strings over the contents
          of the package.  Do note that it is not required that all
          names returned by the iterator be actual resources, e.g.  it
          is acceptable to return names for which *note is_resource():
          4b37. would be false.

          Allowing non-resource names to be returned is to allow for
          situations where how a package and its resources are stored
          are known a priori and the non-resource names would be useful.
          For instance, returning subdirectory names is allowed so that
          when it is known that the package and resources are stored on
          the file system then those subdirectory names can be used
          directly.

          The abstract method returns an iterable of no items.

 -- クラス: importlib.resources.abc.Traversable

     An object with a subset of *note pathlib.Path: 266. methods
     suitable for traversing directories and opening files.

     For a representation of the object on the file-system, use *note
     importlib.resources.as_file(): 6b5.

      -- の属性: name

          Abstract.  The base name of this object without any parent
          references.

      -- メソッド: abstractmethod iterdir ()

          Yield Traversable objects in self.

      -- メソッド: abstractmethod is_dir ()

          Return ‘True’ if self is a directory.

      -- メソッド: abstractmethod is_file ()

          Return ‘True’ if self is a file.

      -- メソッド: abstractmethod joinpath (*pathsegments)

          Traverse directories according to 'pathsegments' and return
          the result as ‘Traversable’.

          Each 'pathsegments' argument may contain multiple names
          separated by forward slashes (‘/’, ‘posixpath.sep’ ).  For
          example, the following are equivalent:

               files.joinpath('subdir', 'subsuddir', 'file.txt')
               files.joinpath('subdir/subsuddir/file.txt')

          Note that some ‘Traversable’ implementations might not be
          updated to the latest version of the protocol.  For
          compatibility with such implementations, provide a single
          argument without path separators to each call to ‘joinpath’.
          For example:

               files.joinpath('subdir').joinpath('subsubdir').joinpath('file.txt')

          バージョン 3.11 で変更: ‘joinpath’ accepts multiple
          'pathsegments', and these segments may contain forward slashes
          as path separators.  Previously, only a single 'child'
          argument was accepted.

      -- メソッド: abstractmethod __truediv__ (child)

          Return Traversable child in self.  Equivalent to
          ‘joinpath(child)’.

      -- メソッド: abstractmethod open (mode='r', *args, **kwargs)

          'mode' may be 'r' or 'rb' to open as text or binary.  Return a
          handle suitable for reading (same as *note pathlib.Path.open:
          2c3a.).

          When opening as text, accepts encoding parameters such as
          those accepted by *note io.TextIOWrapper: 9be.

      -- メソッド: read_bytes ()

          Read contents of self as bytes.

      -- メソッド: read_text (encoding=None)

          Read contents of self as text.

 -- クラス: importlib.resources.abc.TraversableResources

     An abstract base class for resource readers capable of serving the
     *note importlib.resources.files(): 6b6. interface.  Subclasses
     *note ResourceReader: 4af8. and provides concrete implementations
     of the ‘ResourceReader’'s abstract methods.  Therefore, any loader
     supplying ‘TraversableResources’ also supplies ‘ResourceReader’.

     Loaders that wish to support resource reading are expected to
     implement this interface.

      -- メソッド: abstractmethod files ()

          Returns a *note importlib.resources.abc.Traversable: 2fa.
          object for the loaded package.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/importlib/resources/abc.py


File: python.info,  Node: importlib metadata -- パッケージメタデータへのアクセス,  Next: sys path モジュール検索パスの初期化,  Prev: importlib resources abc -- リソースの抽象基底クラス,  Up: モジュールのインポート

5.31.8 ‘importlib.metadata’ - パッケージメタデータへのアクセス
--------------------------------------------------------------

Added in version 3.8.

バージョン 3.10 で変更: ‘importlib.metadata’ は暫定的なものではなくなり
ました。

'ソースコード:' Lib/importlib/metadata/__init__.py(1)

‘importlib.metadata’ is a library that provides access to the metadata
of an installed Distribution Package(2), such as its entry points or its
top-level names (Import Package(3)s, modules, if any).  Built in part on
Python's import system, this library intends to replace similar
functionality in the entry point API(4) and metadata API(5) of
‘pkg_resources’.  Along with *note importlib.resources: 7f, this package
can eliminate the need to use the older and less efficient
‘pkg_resources’ package.

‘importlib.metadata’ は、Pythonの ‘site-packages’ ディレクトリに pip(6)
などのツールでインストールしたサードパーティの '配布パッケージ' に対して
動作します。具体的には、 ‘dist-info’ や ‘egg-info’ ディレクトリを持つ配
布物や、 コアとなるメタデータの仕様(7) で定義されたメタデータを検出でき
るようにします。

     重要: これらはPythonコード内でインポートできるトップレベルの 'パッ
     ケージ' 名と '必ずしも' 同等であったり、1:1 で対応するものではあり
     ません。1つの '配布パッケージ' は複数の 'パッケージ' (および単一の
     モジュール) を含むことができ、1つのトップレベルの 'パッケージ' は、
     それが名前空間パッケージであれば複数の '配布パッケージ' にマップす
     ることができます。これらのマッピングを得るには *note
     packages_distributions(): a11. を使用します。

By default, distribution metadata can live on the file system or in zip
archives on *note sys.path: 3e4.  Through an extension mechanism, the
metadata can live almost anywhere.

参考
....

‘https://importlib-metadata.readthedocs.io/’

     ‘importlib_metadata’ のドキュメントは ‘importlib.metadata’ のバック
     ポートです。これには、このモジュールのクラスと関数の APIリファレン
     ス(8) と、 ‘pkg_resources’ の既存のユーザーのための 移行ガイド(9) が
     あります。

* Menu:

* 概要: 概要<3>.
* 機能 API::
* Distributions::
* Distribution Discovery::
* Implementing Custom Providers::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/importlib/metadata/__init__.py

   (2) 
https://packaging.python.org/en/latest/glossary/#term-Distribution-Package

   (3) 
https://packaging.python.org/en/latest/glossary/#term-Import-Package

   (4) 
https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points

   (5) 
https://setuptools.readthedocs.io/en/latest/pkg_resources.html#metadata-api

   (6) https://pypi.org/project/pip/

   (7) 
https://packaging.python.org/ja/latest/specifications/core-metadata/#core-metadata

   (8) https://importlib-metadata.readthedocs.io/en/latest/api.html

   (9) 
https://importlib-metadata.readthedocs.io/en/latest/migration.html


File: python.info,  Node: 概要<3>,  Next: 機能 API,  Up: importlib metadata -- パッケージメタデータへのアクセス

5.31.8.1 概要
.............

Let's say you wanted to get the version string for a Distribution
Package(1) you've installed using ‘pip’.  We start by creating a virtual
environment and installing something into it:

     $ python -m venv example
     $ source example/bin/activate
     (example) $ python -m pip install wheel

以下のように実行することで、‘wheel’ のバージョン文字列を取得することがで
きます:

     (example) $ python
     >>> from importlib.metadata import version
     >>> version('wheel')
     '0.32.3'

You can also get a collection of entry points selectable by properties
of the EntryPoint (typically 'group' or 'name'), such as
‘console_scripts’, ‘distutils.commands’ and others.  Each group contains
a collection of *note EntryPoint: 589. objects.

*note ディストリビューションのメタデータ: 4b48. を取得することができます
。:

     >>> list(metadata('wheel'))
     ['Metadata-Version', 'Name', 'Version', 'Summary', 'Home-page', 'Author', 'Author-email', 'Maintainer', 'Maintainer-email', 'License', 'Project-URL', 'Project-URL', 'Project-URL', 'Keywords', 'Platform', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Requires-Python', 'Provides-Extra', 'Requires-Dist', 'Requires-Dist']

また、 *note 配布物のバージョン番号: 4b49. を取得し、 *note
構成ファイル: 4b4a. をリストアップし、配布物の *note 配布物の要件: 4b4b.
のリストを取得することができます。

 -- 例外: importlib.metadata.PackageNotFoundError

     Subclass of *note ModuleNotFoundError: d3d. raised by several
     functions in this module when queried for a distribution package
     which is not installed in the current Python environment.

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/en/latest/glossary/#term-Distribution-Package


File: python.info,  Node: 機能 API,  Next: Distributions,  Prev: 概要<3>,  Up: importlib metadata -- パッケージメタデータへのアクセス

5.31.8.2 機能 API
.................

本パッケージは、公開APIを通じて以下の機能を提供します。

* Menu:

* エントリポイント::
* 配布物メタデータ::
* 配布物バージョン::
* 配布物ファイル::
* 配布物の要件::
* Mapping import to distribution packages::


File: python.info,  Node: エントリポイント,  Next: 配布物メタデータ,  Up: 機能 API

5.31.8.3 エントリポイント
.........................

 -- の関数: importlib.metadata.entry_points (**select_params)

     Returns a *note EntryPoints: 4b50. instance describing entry points
     for the current environment.  Any given keyword parameters are
     passed to the ‘select()’ method for comparison to the attributes of
     the individual entry point definitions.

     Note: it is not currently possible to query for entry points based
     on their ‘EntryPoint.dist’ attribute (as different ‘Distribution’
     instances do not currently compare equal, even if they have the
     same attributes)

 -- クラス: importlib.metadata.EntryPoints

     Details of a collection of installed entry points.

     Also provides a ‘.groups’ attribute that reports all identified
     entry point groups, and a ‘.names’ attribute that reports all
     identified entry point names.

 -- クラス: importlib.metadata.EntryPoint

     Details of an installed entry point.

     Each ‘EntryPoint’ instance has ‘.name’, ‘.group’, and ‘.value’
     attributes and a ‘.load()’ method to resolve the value.  There are
     also ‘.module’, ‘.attr’, and ‘.extras’ attributes for getting the
     components of the ‘.value’ attribute, and ‘.dist’ for obtaining
     information regarding the distribution package that provides the
     entry point.

すべてのエントリポイントに問い合わせる:

     >>> eps = entry_points()

The ‘entry_points()’ function returns a ‘EntryPoints’ object, a
collection of all ‘EntryPoint’ objects with ‘names’ and ‘groups’
attributes for convenience:

     >>> sorted(eps.groups)
     ['console_scripts', 'distutils.commands', 'distutils.setup_keywords', 'egg_info.writers', 'setuptools.installation']

‘EntryPoints’ has a ‘select()’ method to select entry points matching
specific properties.  Select entry points in the ‘console_scripts’
group:

     >>> scripts = eps.select(group='console_scripts')

Equivalently, since ‘entry_points()’ passes keyword arguments through to
select:

     >>> scripts = entry_points(group='console_scripts')

"wheel" という名前の特定のスクリプトを選択します。(wheelプロジェクトにあ
ります):

     >>> 'wheel' in scripts.names
     True
     >>> wheel = scripts['wheel']

同様に、選択時にそのエントリポイントを問い合わせます:

     >>> (wheel,) = entry_points(group='console_scripts', name='wheel')
     >>> (wheel,) = entry_points().select(group='console_scripts', name='wheel')

解決したエントリポイントを検証する:

     >>> wheel
     EntryPoint(name='wheel', value='wheel.cli:main', group='console_scripts')
     >>> wheel.module
     'wheel.cli'
     >>> wheel.attr
     'main'
     >>> wheel.extras
     []
     >>> main = wheel.load()
     >>> main
     <function main at 0x103528488>

The ‘group’ and ‘name’ are arbitrary values defined by the package
author and usually a client will wish to resolve all entry points for a
particular group.  Read the setuptools docs(1) for more information on
entry points, their definition, and usage.

バージョン 3.12 で変更: The "selectable" entry points were introduced in
‘importlib_metadata’ 3.6 and Python 3.10.  Prior to those changes,
‘entry_points’ accepted no parameters and always returned a dictionary
of entry points, keyed by group.  With ‘importlib_metadata’ 5.0 and
Python 3.12, ‘entry_points’ always returns an ‘EntryPoints’ object.  See
backports.entry_points_selectable(2) for compatibility options.

バージョン 3.13 で変更: ‘EntryPoint’ objects no longer present a
tuple-like interface (*note __getitem__(): 588.).

   ---------- Footnotes ----------

   (1) https://setuptools.pypa.io/en/latest/userguide/entry_point.html

   (2) https://pypi.org/project/backports.entry_points_selectable/


File: python.info,  Node: 配布物メタデータ,  Next: 配布物バージョン,  Prev: エントリポイント,  Up: 機能 API

5.31.8.4 配布物メタデータ
.........................

 -- の関数: importlib.metadata.metadata (distribution_name)

     Return the distribution metadata corresponding to the named
     distribution package as a *note PackageMetadata: 4b54. instance.

     Raises *note PackageNotFoundError: 4b4c. if the named distribution
     package is not installed in the current Python environment.

 -- クラス: importlib.metadata.PackageMetadata

     A concrete implementation of the PackageMetadata protocol(1).

     In addition to providing the defined protocol methods and
     attributes, subscripting the instance is equivalent to calling the
     ‘get()’ method.

Every Distribution Package(2) includes some metadata, which you can
extract using the ‘metadata()’ function:

     >>> wheel_metadata = metadata('wheel')

The keys of the returned data structure name the metadata keywords, and
the values are returned unparsed from the distribution metadata:

     >>> wheel_metadata['Requires-Python']
     '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'

*note PackageMetadata: 4b54. also presents a ‘json’ attribute that
returns all the metadata in a JSON-compatible form per PEP 566(3):

     >>> wheel_metadata.json['requires_python']
     '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'

The full set of available metadata is not described here.  See the PyPA
Core metadata specification(4) for additional details.

バージョン 3.10 で変更: ペイロードを通して提示されるとき、 ‘Description’
がメタデータに含まれるようになりました。行の継続文字は削除されました。

‘json’ 属性が追加されました。

   ---------- Footnotes ----------

   (1) 
https://importlib-metadata.readthedocs.io/en/latest/api.html#importlib_metadata.PackageMetadata

   (2) 
https://packaging.python.org/en/latest/glossary/#term-Distribution-Package

   (3) https://peps.python.org/pep-0566/

   (4) 
https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata


File: python.info,  Node: 配布物バージョン,  Next: 配布物ファイル,  Prev: 配布物メタデータ,  Up: 機能 API

5.31.8.5 配布物バージョン
.........................

 -- の関数: importlib.metadata.version (distribution_name)

     Return the installed distribution package version(1) for the named
     distribution package.

     Raises *note PackageNotFoundError: 4b4c. if the named distribution
     package is not installed in the current Python environment.

The ‘version()’ function is the quickest way to get a Distribution
Package(2)'s version number, as a string:

     >>> version('wheel')
     '0.32.3'

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/en/latest/specifications/core-metadata/#version

   (2) 
https://packaging.python.org/en/latest/glossary/#term-Distribution-Package


File: python.info,  Node: 配布物ファイル,  Next: 配布物の要件,  Prev: 配布物バージョン,  Up: 機能 API

5.31.8.6 配布物ファイル
.......................

 -- の関数: importlib.metadata.files (distribution_name)

     Return the full set of files contained within the named
     distribution package.

     Raises *note PackageNotFoundError: 4b4c. if the named distribution
     package is not installed in the current Python environment.

     Returns *note None: 885. if the distribution is found but the
     installation database records reporting the files associated with
     the distribution package are missing.

 -- クラス: importlib.metadata.PackagePath

     A *note pathlib.PurePath: 6cd. derived object with additional
     ‘dist’, ‘size’, and ‘hash’ properties corresponding to the
     distribution package's installation metadata for that file.

The ‘files()’ function takes a Distribution Package(1) name and returns
all of the files installed by this distribution.  Each file is reported
as a *note PackagePath: 4b58. instance.  For example:

     >>> util = [p for p in files('wheel') if 'util.py' in str(p)][0]
     >>> util
     PackagePath('wheel/util.py')
     >>> util.size
     859
     >>> util.dist
     <importlib.metadata._hooks.PathDistribution object at 0x101e0cef0>
     >>> util.hash
     <FileHash mode: sha256 value: bYkw5oMccfazVCoYQwKkkemoVyMAFoR34mmKBx8R1NI>

ファイルを取得したら、その内容を読むこともできます:

     >>> print(util.read_text())
     import base64
     import sys
     ...
     def as_bytes(s):
         if isinstance(s, text_type):
             return s.encode('utf-8')
         return s

You can also use the ‘locate()’ method to get the absolute path to the
file:

     >>> util.locate()
     PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')

In the case where the metadata file listing files (‘RECORD’ or
‘SOURCES.txt’) is missing, ‘files()’ will return *note None: 885.  The
caller may wish to wrap calls to ‘files()’ in always_iterable(2) or
otherwise guard against this condition if the target distribution is not
known to have the metadata present.

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/en/latest/glossary/#term-Distribution-Package

   (2) 
https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.always_iterable


File: python.info,  Node: 配布物の要件,  Next: Mapping import to distribution packages,  Prev: 配布物ファイル,  Up: 機能 API

5.31.8.7 配布物の要件
.....................

 -- の関数: importlib.metadata.requires (distribution_name)

     Return the declared dependency specifiers for the named
     distribution package.

     Raises *note PackageNotFoundError: 4b4c. if the named distribution
     package is not installed in the current Python environment.

To get the full set of requirements for a Distribution Package(1), use
the ‘requires()’ function:

     >>> requires('wheel')
     ["pytest (>=3.0.0) ; extra == 'test'", "pytest-cov ; extra == 'test'"]

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/en/latest/glossary/#term-Distribution-Package


File: python.info,  Node: Mapping import to distribution packages,  Prev: 配布物の要件,  Up: 機能 API

5.31.8.8 Mapping import to distribution packages
................................................

 -- の関数: importlib.metadata.packages_distributions ()

     Return a mapping from the top level module and import package names
     found via *note sys.meta_path: f27. to the names of the
     distribution packages (if any) that provide the corresponding
     files.

     To allow for namespace packages (which may have members provided by
     multiple distribution packages), each top level import name maps to
     a list of distribution names rather than mapping directly to a
     single name.

インポート可能なトップレベルのPythonモジュールまたは パッケージ(1) を提
供する 配布パッケージ(2) 名(名前空間パッケージの場合はその名前)を解決す
る便利なメソッドです:

     >>> packages_distributions()
     {'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': ['jaraco.classes', 'jaraco.functools'], ...}

Some editable installs, do not supply top-level names(3), and thus this
function is not reliable with such installs.

Added in version 3.10.

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/ja/latest/glossary/#term-Import-Package

   (2) 
https://packaging.python.org/en/latest/glossary/#term-Distribution-Package

   (3) https://github.com/pypa/packaging-problems/issues/609


File: python.info,  Node: Distributions,  Next: Distribution Discovery,  Prev: 機能 API,  Up: importlib metadata -- パッケージメタデータへのアクセス

5.31.8.9 Distributions
......................

 -- の関数: importlib.metadata.distribution (distribution_name)

     Return a *note Distribution: 4b60. instance describing the named
     distribution package.

     Raises *note PackageNotFoundError: 4b4c. if the named distribution
     package is not installed in the current Python environment.

 -- クラス: importlib.metadata.Distribution

     Details of an installed distribution package.

     Note: different ‘Distribution’ instances do not currently compare
     equal, even if they relate to the same installed distribution and
     accordingly have the same attributes.

While the module level API described above is the most common and
convenient usage, you can get all of that information from the
‘Distribution’ class.  ‘Distribution’ is an abstract object that
represents the metadata for a Python Distribution Package(1).  You can
get the concrete ‘Distribution’ subclass instance for an installed
distribution package by calling the *note distribution(): 4b5f.
function:

     >>> from importlib.metadata import distribution
     >>> dist = distribution('wheel')
     >>> type(dist)
     <class 'importlib.metadata.PathDistribution'>

Thus, an alternative way to get the version number is through the
‘Distribution’ instance:

     >>> dist.version
     '0.32.3'

There are all kinds of additional metadata available on ‘Distribution’
instances:

     >>> dist.metadata['Requires-Python']
     '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'
     >>> dist.metadata['License']
     'MIT'

For editable packages, an ‘origin’ property may present PEP 610(2)
metadata:

     >>> dist.origin.url
     'file:///path/to/wheel-0.32.3.editable-py3-none-any.whl'

The full set of available metadata is not described here.  See the PyPA
Core metadata specification(3) for additional details.

Added in version 3.13: The ‘.origin’ property was added.

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/en/latest/glossary/#term-Distribution-Package

   (2) https://peps.python.org/pep-0610/

   (3) 
https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata


File: python.info,  Node: Distribution Discovery,  Next: Implementing Custom Providers,  Prev: Distributions,  Up: importlib metadata -- パッケージメタデータへのアクセス

5.31.8.10 Distribution Discovery
................................

デフォルトでは、このパッケージは組み込みで、ファイルシステムおよび zip フ
ァイル 配布パッケージ(1) のメタデータを発見するためのサポートを提供しま
す。このメタデータ検索のデフォルトは ‘sys.path’ ですが、その値をどのよう
に解釈するかは、他のインポート機構が行う方法とは若干異なります。具体的に
は:

   - ‘importlib.metadata’ は ‘sys.path’ の *note bytes: 192. オブジェク
     トを受け入れません。

   - ‘importlib.metadata’ は、インポート時には無視されますが、
     ‘sys.path’ 上の *note pathlib.Path: 266. オブジェクトを優先的に使用
     します。

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/ja/latest/glossary/#term-Distribution-Package


File: python.info,  Node: Implementing Custom Providers,  Prev: Distribution Discovery,  Up: importlib metadata -- パッケージメタデータへのアクセス

5.31.8.11 Implementing Custom Providers
.......................................

‘importlib.metadata’ address two API surfaces, one for 'consumers' and
another for 'providers'.  Most users are consumers, consuming metadata
provided by the packages.  There are other use-cases, however, where
users wish to expose metadata through some other mechanism, such as
alongside a custom importer.  Such a use case calls for a 'custom
provider'.

Because Distribution Package(1) metadata is not available through *note
sys.path: 3e4. searches, or package loaders directly, the metadata for a
distribution is found through import system *note finders: 2446.  To
find a distribution package's metadata, ‘importlib.metadata’ queries the
list of *note meta path finders: 127c. on *note sys.meta_path: f27.

The implementation has hooks integrated into the ‘PathFinder’, serving
metadata for distribution packages found on the file system.

抽象クラス *note importlib.abc.MetaPathFinder: a6e. はPythonの importシ
ステムによってファインダーに期待されるインターフェイスを定義しています。
‘importlib.metadata’ はこのプロトコルを拡張し、 *note sys.meta_path:
f27. からファインダーにオプションの ‘find_distributions’ を呼び出すこと
ができるようにし、この拡張インターフェースを ‘DistributionFinder’ 抽象基
底クラスとして提示し、この抽象メソッドを定義しています:

     @abc.abstractmethod
     def find_distributions(context=DistributionFinder.Context()) -> Iterable[Distribution]:
         """Return an iterable of all Distribution instances capable of
         loading the metadata for packages for the indicated ``context``.
         """

The ‘DistributionFinder.Context’ object provides ‘.path’ and ‘.name’
properties indicating the path to search and name to match and may
supply other relevant context sought by the consumer.

In practice, to support finding distribution package metadata in
locations other than the file system, subclass ‘Distribution’ and
implement the abstract methods.  Then from a custom finder, return
instances of this derived ‘Distribution’ in the ‘find_distributions()’
method.

* Menu:

* 使用例: 使用例<49>.

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/en/latest/glossary/#term-Distribution-Package


File: python.info,  Node: 使用例<49>,  Up: Implementing Custom Providers

5.31.8.12 使用例
................

Imagine a custom finder that loads Python modules from a database:

     class DatabaseImporter(importlib.abc.MetaPathFinder):
         def __init__(self, db):
             self.db = db

         def find_spec(self, fullname, target=None) -> ModuleSpec:
             return self.db.spec_from_name(fullname)

     sys.meta_path.append(DatabaseImporter(connect_db(...)))

That importer now presumably provides importable modules from a
database, but it provides no metadata or entry points.  For this custom
importer to provide metadata, it would also need to implement
‘DistributionFinder’:

     from importlib.metadata import DistributionFinder

     class DatabaseImporter(DistributionFinder):
         ...

         def find_distributions(self, context=DistributionFinder.Context()):
             query = dict(name=context.name) if context.name else {}
             for dist_record in self.db.query_distributions(query):
                 yield DatabaseDistribution(dist_record)

In this way, ‘query_distributions’ would return records for each
distribution served by the database matching the query.  For example, if
‘requests-1.0’ is in the database, ‘find_distributions’ would yield a
‘DatabaseDistribution’ for ‘Context(name='requests')’ or
‘Context(name=None)’.

For the sake of simplicity, this example ignores ‘context.path’.  The
‘path’ attribute defaults to ‘sys.path’ and is the set of import paths
to be considered in the search.  A ‘DatabaseImporter’ could potentially
function without any concern for a search path.  Assuming the importer
does no partitioning, the "path" would be irrelevant.  In order to
illustrate the purpose of ‘path’, the example would need to illustrate a
more complex ‘DatabaseImporter’ whose behavior varied depending on
‘sys.path’/‘PYTHONPATH’.  In that case, the ‘find_distributions’ should
honor the ‘context.path’ and only yield ‘Distribution’s pertinent to
that path.

‘DatabaseDistribution’, then, would look something like:

     class DatabaseDistribution(importlib.metadata.Distribution):
         def __init__(self, record):
             self.record = record

         def read_text(self, filename):
             """
             Read a file like "METADATA" for the current distribution.
             """
             if filename == "METADATA":
                 return f"""Name: {self.record.name}
     Version: {self.record.version}
     """
             if filename == "entry_points.txt":
                 return "\n".join(
                   f"""[{ep.group}]\n{ep.name}={ep.value}"""
                   for ep in self.record.entry_points)

         def locate_file(self, path):
             raise RuntimeError("This distribution has no file system")

This basic implementation should provide metadata and entry points for
packages served by the ‘DatabaseImporter’, assuming that the ‘record’
supplies suitable ‘.name’, ‘.version’, and ‘.entry_points’ attributes.

The ‘DatabaseDistribution’ may also provide other metadata files, like
‘RECORD’ (required for ‘Distribution.files’) or override the
implementation of ‘Distribution.files’.  See the source for more
inspiration.


File: python.info,  Node: sys path モジュール検索パスの初期化,  Prev: importlib metadata -- パッケージメタデータへのアクセス,  Up: モジュールのインポート

5.31.9 ‘sys.path’ モジュール検索パスの初期化
--------------------------------------------

モジュール検索パスは Python の開始時に初期化されます。このモジュール検索
パスは、 *note sys.path: 3e4. でアクセス可能です。

The first entry in the module search path is the directory that contains
the input script, if there is one.  Otherwise, the first entry is the
current directory, which is the case when executing the interactive
shell, a *note -c: 1a8. command, or *note -m: 23c. module.

The *note PYTHONPATH: 121f. environment variable is often used to add
directories to the search path.  If this environment variable is found
then the contents are added to the module search path.

     注釈: *note PYTHONPATH: 121f. will affect all installed Python
     versions/environments.  Be wary of setting this in your shell
     profile or global environment variables.  The *note site: cc.
     module offers more nuanced techniques as mentioned below.

The next items added are the directories containing standard Python
modules as well as any *note extension module: 2251.s that these modules
depend on.  Extension modules are ‘.pyd’ files on Windows and ‘.so’
files on other platforms.  The directory with the platform-independent
Python modules is called ‘prefix’.  The directory with the extension
modules is called ‘exec_prefix’.

The *note PYTHONHOME: 3f0. environment variable may be used to set the
‘prefix’ and ‘exec_prefix’ locations.  Otherwise these directories are
found by using the Python executable as a starting point and then
looking for various 'landmark' files and directories.  Note that any
symbolic links are followed so the real Python executable location is
used as the search starting point.  The Python executable location is
called ‘home’.

Once ‘home’ is determined, the ‘prefix’ directory is found by first
looking for ‘python`majorversion'`minorversion'.zip’ (‘python311.zip’).
On Windows the zip archive is searched for in ‘home’ and on Unix the
archive is expected to be in ‘lib’.  Note that the expected zip archive
location is added to the module search path even if the archive does not
exist.  If no archive was found, Python on Windows will continue the
search for ‘prefix’ by looking for ‘Lib\os.py’.  Python on Unix will
look for ‘lib/python`majorversion'.`minorversion'/os.py’
(‘lib/python3.11/os.py’).  On Windows ‘prefix’ and ‘exec_prefix’ are the
same, however on other platforms
‘lib/python`majorversion'.`minorversion'/lib-dynload’
(‘lib/python3.11/lib-dynload’) is searched for and used as an anchor for
‘exec_prefix’.  On some platforms ‘lib’ may be ‘lib64’ or another value,
see *note sys.platlibdir: b32. and *note PYTHONPLATLIBDIR: 1d23.

Once found, ‘prefix’ and ‘exec_prefix’ are available at *note
sys.base_prefix: 3e6. and *note sys.base_exec_prefix: 3ea. respectively.

If *note PYTHONHOME: 3f0. is not set, and a ‘pyvenv.cfg’ file is found
alongside the main executable, or in its parent directory, *note
sys.prefix: 3e7. and *note sys.exec_prefix: 3eb. get set to the
directory containing ‘pyvenv.cfg’, otherwise they are set to the same
value as *note sys.base_prefix: 3e6. and *note sys.base_exec_prefix:
3ea, respectively.  This is used by *note Virtual Environments: 48b3.

Finally, the *note site: cc. module is processed and ‘site-packages’
directories are added to the module search path.  A common way to
customize the search path is to create *note sitecustomize: cd. or *note
usercustomize: 114. modules as described in the *note site: cc. module
documentation.

     注釈: Certain command line options may further affect path
     calculations.  See *note -E: b56, *note -I: b57, *note -s: 15a6.
     and *note -S: 13c0. for further details.

バージョン 3.14 で変更: *note sys.prefix: 3e7. and *note
sys.exec_prefix: 3eb. are now set to the ‘pyvenv.cfg’ directory during
the path initialization.  This was previously done by *note site: cc,
therefore affected by *note -S: 13c0.

* Menu:

* Virtual Environments::
* _pth files::
* 埋め込みの Python::


File: python.info,  Node: Virtual Environments,  Next: _pth files,  Up: sys path モジュール検索パスの初期化

5.31.9.1 Virtual Environments
.............................

Virtual environments place a ‘pyvenv.cfg’ file in their prefix, which
causes *note sys.prefix: 3e7. and *note sys.exec_prefix: 3eb. to point
to them, instead of the base installation.

The ‘prefix’ and ‘exec_prefix’ values of the base installation are
available at *note sys.base_prefix: 3e6. and *note sys.base_exec_prefix:
3ea.

As well as being used as a marker to identify virtual environments,
‘pyvenv.cfg’ may also be used to configure the *note site: cc.
initialization.  Please refer to *note site: cc.'s *note virtual
environments documentation: 48b4.

     注釈: *note PYTHONHOME: 3f0. overrides the ‘pyvenv.cfg’ detection.

     注釈: There are other ways how "virtual environments" could be
     implemented, this documentation refers implementations based on the
     ‘pyvenv.cfg’ mechanism, such as *note venv: 117.  Most virtual
     environment implementations follow the model set by *note venv:
     117, but there may be exotic implementations that diverge from it.


File: python.info,  Node: _pth files,  Next: 埋め込みの Python,  Prev: Virtual Environments,  Up: sys path モジュール検索パスの初期化

5.31.9.2 _pth files
...................

To completely override *note sys.path: 3e4. create a ‘._pth’ file with
the same name as the shared library or executable (‘python._pth’ or
‘python311._pth’).  The shared library path is always known on Windows,
however it may not be available on other platforms.  In the ‘._pth’ file
specify one line for each path to add to *note sys.path: 3e4.  The file
based on the shared library name overrides the one based on the
executable, which allows paths to be restricted for any program loading
the runtime if desired.

ファイルが存在したときは、全てのレジストリと環境変数は無視され、隔離モー
ドになり、そのファイルに ‘import site’ と指定していない限りは *note
site: cc. がインポートできなくなります。 空行と ‘#’ で始まる行は無視され
ます。 それぞれのパスはファイルの場所を指す絶対パスあるいは相対パスです
。 ‘site’ 以外のインポート文は許可されておらず、任意のコードも書けません
。

‘import site’ を指定したときは、(アンダースコアが前に付かない) ‘.pth’ フ
ァイルは *note site: cc. モジュールにより通常通り処理されることに注意し
てください。


File: python.info,  Node: 埋め込みの Python,  Prev: _pth files,  Up: sys path モジュール検索パスの初期化

5.31.9.3 埋め込みの Python
..........................

Python が他のアプリケーションに埋め込まれている場合は、 *note
Py_InitializeFromConfig(): 3f6. と *note PyConfig: 3f7. 構造体が Python
の初期化に使用可能です。パス固有の詳細は、 *note Python Path
Configuration: aaa. で説明されています。

参考
....

   * Windows の詳細についてのメモは、 *note モジュールの検索: e1a. を参
     照。

   * Unix の詳細は、 *note Unix プラットフォームで Python を使う: 2144.
     を参照。


File: python.info,  Node: Python言語サービス,  Next: MS Windows 固有のサービス,  Prev: モジュールのインポート,  Up: Python 標準ライブラリ

5.32 Python言語サービス
=======================

PythonにはPython言語を使って作業するときに役に立つモジュールがたくさん提
供されています。これらのモジュールはトークンの切り出し、パース、構文解析
、バイトコードのディスアセンブリおよびその他のさまざまな機能をサポートし
ています。

これらのモジュールには、次のものが含まれています:

* Menu:

* ast: ast --- Abstract syntax trees. Abstract syntax trees
* symtable: symtable --- コンパイラーの記号表へのアクセス. コンパイラーの記号表へのアクセス
* token: token --- Python 解析木で使われる定数. Python 解析木で使われる定数
* keyword: keyword --- Python キーワードのテスト. Python キーワードのテスト
* tokenize: tokenize --- Python ソース用のトークナイザー. Python ソース用のトークナイザー
* tabnanny: tabnanny --- あいまいなインデントの検出. あいまいなインデントの検出
* pyclbr: pyclbr --- Python モジュールブラウザーサポート. Python モジュールブラウザーサポート
* py_compile: py_compile --- Python ソースファイルをコンパイルする. Python ソースファイルをコンパイルする
* compileall: compileall --- Python ライブラリをバイトコンパイルする. Python ライブラリをバイトコンパイルする
* dis: dis --- Python バイトコードの逆アセンブラー. Python バイトコードの逆アセンブラー
* pickletools: pickletools --- pickle 開発者用のツール群. pickle 開発者用のツール群


File: python.info,  Node: ast --- Abstract syntax trees,  Next: symtable --- コンパイラーの記号表へのアクセス,  Up: Python言語サービス

5.32.1 ‘ast’ -- Abstract syntax trees
-------------------------------------

'ソースコード:' Lib/ast.py(1)

__________________________________________________________________

The ‘ast’ module helps Python applications to process trees of the
Python abstract syntax grammar.  The abstract syntax itself might change
with each Python release; this module helps to find out programmatically
what the current grammar looks like.

抽象構文木を作成するには、 *note ast.PyCF_ONLY_AST: 4b70. を組み込み関数
*note compile(): 4b1. のフラグとして渡すか、あるいはこのモジュールで提供
されているヘルパー関数 *note parse(): 1c2. を使います。その結果は、
*note ast.AST: 4c3. を継承したクラスのオブジェクトのツリーとなります。抽
象構文木は組み込み関数 *note compile(): 4b1. を使って Python コード・オ
ブジェクトにコンパイルすることができます。

* Menu:

* Abstract grammar::
* Node クラス::
* ast helpers::
* Compiler flags: Compiler flags<2>.
* コマンドラインでの使用: コマンドラインでの使用<8>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/ast.py


File: python.info,  Node: Abstract grammar,  Next: Node クラス,  Up: ast --- Abstract syntax trees

5.32.1.1 Abstract grammar
.........................

抽象文法は、現在次のように定義されています:

     -- ASDL's 4 builtin types are:
     -- identifier, int, string, constant

     module Python
     {
         mod = Module(stmt* body, type_ignore* type_ignores)
             | Interactive(stmt* body)
             | Expression(expr body)
             | FunctionType(expr* argtypes, expr returns)

         stmt = FunctionDef(identifier name, arguments args,
                            stmt* body, expr* decorator_list, expr? returns,
                            string? type_comment, type_param* type_params)
               | AsyncFunctionDef(identifier name, arguments args,
                                  stmt* body, expr* decorator_list, expr? returns,
                                  string? type_comment, type_param* type_params)

               | ClassDef(identifier name,
                  expr* bases,
                  keyword* keywords,
                  stmt* body,
                  expr* decorator_list,
                  type_param* type_params)
               | Return(expr? value)

               | Delete(expr* targets)
               | Assign(expr* targets, expr value, string? type_comment)
               | TypeAlias(expr name, type_param* type_params, expr value)
               | AugAssign(expr target, operator op, expr value)
               -- 'simple' indicates that we annotate simple name without parens
               | AnnAssign(expr target, expr annotation, expr? value, int simple)

               -- use 'orelse' because else is a keyword in target languages
               | For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
               | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
               | While(expr test, stmt* body, stmt* orelse)
               | If(expr test, stmt* body, stmt* orelse)
               | With(withitem* items, stmt* body, string? type_comment)
               | AsyncWith(withitem* items, stmt* body, string? type_comment)

               | Match(expr subject, match_case* cases)

               | Raise(expr? exc, expr? cause)
               | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)
               | TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)
               | Assert(expr test, expr? msg)

               | Import(alias* names)
               | ImportFrom(identifier? module, alias* names, int? level)

               | Global(identifier* names)
               | Nonlocal(identifier* names)
               | Expr(expr value)
               | Pass | Break | Continue

               -- col_offset is the byte offset in the utf8 string the parser uses
               attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)

               -- BoolOp() can use left & right?
         expr = BoolOp(boolop op, expr* values)
              | NamedExpr(expr target, expr value)
              | BinOp(expr left, operator op, expr right)
              | UnaryOp(unaryop op, expr operand)
              | Lambda(arguments args, expr body)
              | IfExp(expr test, expr body, expr orelse)
              | Dict(expr?* keys, expr* values)
              | Set(expr* elts)
              | ListComp(expr elt, comprehension* generators)
              | SetComp(expr elt, comprehension* generators)
              | DictComp(expr key, expr value, comprehension* generators)
              | GeneratorExp(expr elt, comprehension* generators)
              -- the grammar constrains where yield expressions can occur
              | Await(expr value)
              | Yield(expr? value)
              | YieldFrom(expr value)
              -- need sequences for compare to distinguish between
              -- x < 4 < 3 and (x < 4) < 3
              | Compare(expr left, cmpop* ops, expr* comparators)
              | Call(expr func, expr* args, keyword* keywords)
              | FormattedValue(expr value, int conversion, expr? format_spec)
              | Interpolation(expr value, constant str, int conversion, expr? format_spec)
              | JoinedStr(expr* values)
              | TemplateStr(expr* values)
              | Constant(constant value, string? kind)

              -- the following expression can appear in assignment context
              | Attribute(expr value, identifier attr, expr_context ctx)
              | Subscript(expr value, expr slice, expr_context ctx)
              | Starred(expr value, expr_context ctx)
              | Name(identifier id, expr_context ctx)
              | List(expr* elts, expr_context ctx)
              | Tuple(expr* elts, expr_context ctx)

              -- can appear only in Subscript
              | Slice(expr? lower, expr? upper, expr? step)

               -- col_offset is the byte offset in the utf8 string the parser uses
               attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)

         expr_context = Load | Store | Del

         boolop = And | Or

         operator = Add | Sub | Mult | MatMult | Div | Mod | Pow | LShift
                      | RShift | BitOr | BitXor | BitAnd | FloorDiv

         unaryop = Invert | Not | UAdd | USub

         cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn

         comprehension = (expr target, expr iter, expr* ifs, int is_async)

         excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)
                         attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)

         arguments = (arg* posonlyargs, arg* args, arg? vararg, arg* kwonlyargs,
                      expr?* kw_defaults, arg? kwarg, expr* defaults)

         arg = (identifier arg, expr? annotation, string? type_comment)
                attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)

         -- keyword arguments supplied to call (NULL identifier for **kwargs)
         keyword = (identifier? arg, expr value)
                    attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)

         -- import name with optional 'as' alias.
         alias = (identifier name, identifier? asname)
                  attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)

         withitem = (expr context_expr, expr? optional_vars)

         match_case = (pattern pattern, expr? guard, stmt* body)

         pattern = MatchValue(expr value)
                 | MatchSingleton(constant value)
                 | MatchSequence(pattern* patterns)
                 | MatchMapping(expr* keys, pattern* patterns, identifier? rest)
                 | MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)

                 | MatchStar(identifier? name)
                 -- The optional "rest" MatchMapping parameter handles capturing extra mapping keys

                 | MatchAs(pattern? pattern, identifier? name)
                 | MatchOr(pattern* patterns)

                  attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)

         type_ignore = TypeIgnore(int lineno, string tag)

         type_param = TypeVar(identifier name, expr? bound, expr? default_value)
                    | ParamSpec(identifier name, expr? default_value)
                    | TypeVarTuple(identifier name, expr? default_value)
                    attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)
     }


File: python.info,  Node: Node クラス,  Next: ast helpers,  Prev: Abstract grammar,  Up: ast --- Abstract syntax trees

5.32.1.2 Node クラス
....................

 -- クラス: ast.AST

     This is the base of all AST node classes.  The actual node classes
     are derived from the ‘Parser/Python.asdl’ file, which is reproduced
     *note above: 4b71.  They are defined in the ‘_ast’ C module and
     re-exported in ‘ast’.

     抽象文法の左辺のシンボル一つずつにそれぞれ一つのクラスがあります (た
     とえば ‘ast.stmt’ や ‘ast.expr’)。それに加えて、右辺のコンストラク
     タ一つずつにそれぞれ一つのクラスがあり、これらのクラスは左辺のツリ
     ーのクラスを継承しています。たとえば、 *note ast.BinOp: 1db2. は
     ‘ast.expr’ から継承しています。代替を伴った生成規則 (production
     rules with alternatives) (別名 "sums") の場合、左辺は抽象クラスとな
     り、特定のコンストラクタ・ノードのインスタンスのみが作成されます。

      -- の属性: _fields

          各具象クラスは属性 ‘_fields’ を持っており、すべての子ノードの
          名前をそこに保持しています。

          具象クラスのインスタンスは、各子ノードに対してそれぞれひとつの
          属性を持っています。この属性は、文法で定義された型となります。
          たとえば *note ast.BinOp: 1db2. のインスタンスは ‘left’ という
          属性を持っており、その型は ‘ast.expr’ です。

          これらの属性が、文法上 (クエスチョンマークを用いて) オプション
          であるとマークされている場合は、その値が ‘None’ となることもあ
          ります。属性が0個以上の複数の値をとりうる場合 (アスタリスクで
          マークされている場合) は、値は Python のリストで表されます。全
          ての属性は AST を *note compile(): 4b1. でコンパイルする際には
          存在しなければならず、そして妥当な値でなければなりません。

      -- の属性: _field_types

          The ‘_field_types’ attribute on each concrete class is a
          dictionary mapping field names (as also listed in *note
          _fields: 17d7.) to their types.

               >>> ast.TypeVar._field_types
               {'name': <class 'str'>, 'bound': ast.expr | None, 'default_value': ast.expr | None}

          Added in version 3.13.

      -- の属性: lineno
      -- の属性: col_offset
      -- の属性: end_lineno
      -- の属性: end_col_offset

          ‘ast.expr’ や ‘ast.stmt’ のサブクラスのインスタンスは *note
          lineno: 4b74, *note col_offset: 4b75, *note end_lineno: 4b76,
          および *note end_col_offset: 4b77. 属性を持ちます。 *note
          lineno: 4b74. と *note end_lineno: 4b76. はソーステキストの範
          囲を最初と最後の行番号で表し (1 から数え始めるので、最初の行の
          行番号は 1 となります)、 *note col_offset: 4b75. と *note
          end_col_offset: 4b77. はノードが生成した最初と最後のトークンの
          UTF-8 バイトオフセットです。 UTF-8 オフセットはパーサが内部で
          使用するので記録されます。

          コンパイラは終了位置を必要としないことに注意してください。この
          ため終了位置は省略可能です。終了位置を示すオフセットは最後のシ
          ンボルの '後の位置' になります。例えば一行で書かれた式のソース
          コードのセグメントは ‘source_line[node.col_offset :
          node.end_col_offset]’ により取得できます。

     クラス ‘ast.T’ のコンストラクタは引数を次のように解析します:

        * 位置引数があるとすれば、 ‘T._fields’ にあるのと同じだけの個数
          が無ければなりません。これらの引数はそこにある名前を持った属性
          として割り当てられます。

        * キーワード引数があるとすれば、それらはその名前の属性にその値を
          割り当てられます。

     たとえば、 *note ast.UnaryOp: 4a7e. ノードを生成して属性を埋めるに
     は、次のようにすることができます

          node = ast.UnaryOp(ast.USub(), ast.Constant(5, lineno=0, col_offset=0),
                             lineno=0, col_offset=0)

     If a field that is optional in the grammar is omitted from the
     constructor, it defaults to ‘None’.  If a list field is omitted, it
     defaults to the empty list.  If a field of type ‘ast.expr_context’
     is omitted, it defaults to *note Load(): 4c2.  If any other field
     is omitted, a *note DeprecationWarning: 1a3. is raised and the AST
     node will not have this field.  In Python 3.15, this condition will
     raise an error.

バージョン 3.8 で変更: *note ast.Constant: 2ef. が全ての定数に使われるよ
うになりました。

バージョン 3.9 で変更: 単純なインデックスはその値で表現され、幅を持つス
ライスはタプルで表現されます。

バージョン 3.14 で変更: The *note __repr__(): 82f. output of *note AST:
4c3. nodes includes the values of the node fields.

Deprecated since version 3.8, removed in version 3.14: Previous versions
of Python provided the AST classes ‘ast.Num’, ‘ast.Str’, ‘ast.Bytes’,
‘ast.NameConstant’ and ‘ast.Ellipsis’, which were deprecated in Python
3.8.  These classes were removed in Python 3.14, and their functionality
has been replaced with *note ast.Constant: 2ef.

バージョン 3.9 で非推奨: Old classes ‘ast.Index’ and ‘ast.ExtSlice’ are
still available, but they will be removed in future Python releases.  In
the meantime, instantiating them will return an instance of a different
class.

Deprecated since version 3.13, will be removed in version 3.15: Previous
versions of Python allowed the creation of AST nodes that were missing
required fields.  Similarly, AST node constructors allowed arbitrary
keyword arguments that were set as attributes of the AST node, even if
they did not match any of the fields of the AST node.  This behavior is
deprecated and will be removed in Python 3.15.

     注釈: ここに示されている特定のノードクラスについての記述は、素晴ら
     しい Green Tree Snakes(1) プロジェクトとそのすべての貢献者の成果物
     をもとにしています。

* Menu:

* Root nodes::
* リテラル: リテラル<3>.
* 変数::
* 式 (expression): 式 expression<2>.
* 文 (Statements): 文 Statements.
* 制御フロー::
* Pattern matching::
* Type annotations::
* Type parameters::
* 関数およびクラス定義::
* async と await::

   ---------- Footnotes ----------

   (1) https://greentreesnakes.readthedocs.io/en/latest/


File: python.info,  Node: Root nodes,  Next: リテラル<3>,  Up: Node クラス

5.32.1.3 Root nodes
...................

 -- クラス: ast.Module (body, type_ignores)

     A Python module, as with *note file input: 259e.  Node type
     generated by *note ast.parse(): 1c2. in the default ‘"exec"’
     'mode'.

     ‘body’ is a *note list: 24d. of the module's *note 文 (Statements):
     4b7b.

     ‘type_ignores’ is a *note list: 24d. of the module's type ignore
     comments; see *note ast.parse(): 1c2. for more details.

          >>> print(ast.dump(ast.parse('x = 1'), indent=4))
          Module(
              body=[
                  Assign(
                      targets=[
                          Name(id='x', ctx=Store())],
                      value=Constant(value=1))])

 -- クラス: ast.Expression (body)

     A single Python *note expression input: 25a4.  Node type generated
     by *note ast.parse(): 1c2. when 'mode' is ‘"eval"’.

     ‘body’ is a single node, one of the *note expression types: 4b7d.

          >>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))
          Expression(
              body=Constant(value=123))

 -- クラス: ast.Interactive (body)

     A single *note interactive input: 25a1, like in *note 対話モード:
     494.  Node type generated by *note ast.parse(): 1c2. when 'mode' is
     ‘"single"’.

     ‘body’ is a *note list: 24d. of *note statement nodes: 4b7b.

          >>> print(ast.dump(ast.parse('x = 1; y = 2', mode='single'), indent=4))
          Interactive(
              body=[
                  Assign(
                      targets=[
                          Name(id='x', ctx=Store())],
                      value=Constant(value=1)),
                  Assign(
                      targets=[
                          Name(id='y', ctx=Store())],
                      value=Constant(value=2))])

 -- クラス: ast.FunctionType (argtypes, returns)

     A representation of an old-style type comments for functions, as
     Python versions prior to 3.5 didn't support PEP 484(1) annotations.
     Node type generated by *note ast.parse(): 1c2. when 'mode' is
     ‘"func_type"’.

     Such type comments would look like this:

          def sum_two_number(a, b):
              # type: (int, int) -> int
              return a + b

     ‘argtypes’ is a *note list: 24d. of *note expression nodes: 4b7d.

     ‘returns’ is a single *note expression node: 4b7d.

          >>> print(ast.dump(ast.parse('(int, str) -> List[int]', mode='func_type'), indent=4))
          FunctionType(
              argtypes=[
                  Name(id='int', ctx=Load()),
                  Name(id='str', ctx=Load())],
              returns=Subscript(
                  value=Name(id='List', ctx=Load()),
                  slice=Name(id='int', ctx=Load()),
                  ctx=Load()))

     Added in version 3.8.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/


File: python.info,  Node: リテラル<3>,  Next: 変数,  Prev: Root nodes,  Up: Node クラス

5.32.1.4 リテラル
.................

 -- クラス: ast.Constant (value)

     A constant value.  The ‘value’ attribute of the ‘Constant’ literal
     contains the Python object it represents.  The values represented
     can be instances of *note str: 169, *note bytes: 192, *note int:
     19b, *note float: 196, *note complex: 197, and *note bool: 3c3, and
     the constants *note None: 885. and *note Ellipsis: 2328.

          >>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))
          Expression(
              body=Constant(value=123))

 -- クラス: ast.FormattedValue (value, conversion, format_spec)

     このノードは f-string における単一の書式指定置換フィールドを表現し
     ます。文字列が単一の置換フィールドしか持たず、他に何も含まない場合
     は、ノードは単独で存在できます。そうでない場合は *note JoinedStr:
     1a5c. の一部としてあらわれます。

        * ‘value’ は式ツリーのノードのいずれか (リテラル、変数、関数呼び
          出しなど) です。

        * ‘conversion’ は整数です:

             * -1: 書式指定なし

             * 97 (‘ord('a')’): ‘!a’ *note ASCII: 15ff. formatting

             * 114 (‘ord('r')’): ‘!r’ *note repr(): 1c1. formatting

             * 115 (‘ord('s')’): ‘!s’ *note string: 169. formatting

        * ‘format_spec’ は値の書式指定を表現する *note JoinedStr: 1a5c.
          ノード、もしくは書式指定がない場合は ‘None’ です。
          ‘conversion’ と ‘format_spec’ を同時に設定することができます。

 -- クラス: ast.JoinedStr (values)

     *note FormattedValue: 4a96. ノードと *note Constant: 2ef. ノードの
     集まりからなる f-string です。

          >>> print(ast.dump(ast.parse('f"sin({a}) is {sin(a):.3}"', mode='eval'), indent=4))
          Expression(
              body=JoinedStr(
                  values=[
                      Constant(value='sin('),
                      FormattedValue(
                          value=Name(id='a', ctx=Load()),
                          conversion=-1),
                      Constant(value=') is '),
                      FormattedValue(
                          value=Call(
                              func=Name(id='sin', ctx=Load()),
                              args=[
                                  Name(id='a', ctx=Load())]),
                          conversion=-1,
                          format_spec=JoinedStr(
                              values=[
                                  Constant(value='.3')]))]))

 -- クラス: ast.TemplateStr (values, /)

     Added in version 3.14.

     Node representing a template string literal, comprising a series of
     *note Interpolation: 17b5. and *note Constant: 2ef. nodes.  These
     nodes may be any order, and do not need to be interleaved.

          >>> expr = ast.parse('t"{name} finished {place:ordinal}"', mode='eval')
          >>> print(ast.dump(expr, indent=4))
          Expression(
              body=TemplateStr(
                  values=[
                      Interpolation(
                          value=Name(id='name', ctx=Load()),
                          str='name',
                          conversion=-1),
                      Constant(value=' finished '),
                      Interpolation(
                          value=Name(id='place', ctx=Load()),
                          str='place',
                          conversion=-1,
                          format_spec=JoinedStr(
                              values=[
                                  Constant(value='ordinal')]))]))

 -- クラス: ast.Interpolation (value, str, conversion, format_spec=None)

     Added in version 3.14.

     Node representing a single interpolation field in a template string
     literal.

        * ‘value’ is any expression node (such as a literal, a variable,
          or a function call).  This has the same meaning as
          ‘FormattedValue.value’.

        * ‘str’ is a constant containing the text of the interpolation
          expression.

          If ‘str’ is set to ‘None’, then ‘value’ is used to generate
          code when calling *note ast.unparse(): ae2.  This no longer
          guarantees that the generated code is identical to the
          original and is intended for code generation.

        * ‘conversion’ は整数です:

             * -1: no conversion

             * 97 (‘ord('a')’): ‘!a’ *note ASCII: 15ff. conversion

             * 114 (‘ord('r')’): ‘!r’ *note repr(): 1c1. conversion

             * 115 (‘ord('s')’): ‘!s’ *note string: 169. conversion

          This has the same meaning as ‘FormattedValue.conversion’.

        * ‘format_spec’ is a *note JoinedStr: 1a5c. node representing
          the formatting of the value, or ‘None’ if no format was
          specified.  Both ‘conversion’ and ‘format_spec’ can be set at
          the same time.  This has the same meaning as
          ‘FormattedValue.format_spec’.

 -- クラス: ast.List (elts, ctx)
 -- クラス: ast.Tuple (elts, ctx)

     リストまたはタプルをあらわします。 ‘elts’ は内包する要素を表現する
     ノードのリストを保持します。 ‘ctx’ はコンテナが代入のターゲットであ
     る場合 (たとえば ‘(x,y)=something’ のような場合) は *note Store:
     4b81. であり、そうでない場合は *note Load: 4c2. です。

          >>> print(ast.dump(ast.parse('[1, 2, 3]', mode='eval'), indent=4))
          Expression(
              body=List(
                  elts=[
                      Constant(value=1),
                      Constant(value=2),
                      Constant(value=3)],
                  ctx=Load()))
          >>> print(ast.dump(ast.parse('(1, 2, 3)', mode='eval'), indent=4))
          Expression(
              body=Tuple(
                  elts=[
                      Constant(value=1),
                      Constant(value=2),
                      Constant(value=3)],
                  ctx=Load()))

 -- クラス: ast.Set (elts)

     集合 (set) をあらわします。 ‘elts’ は集合の各要素を表現するノードの
     リストを保持します。

          >>> print(ast.dump(ast.parse('{1, 2, 3}', mode='eval'), indent=4))
          Expression(
              body=Set(
                  elts=[
                      Constant(value=1),
                      Constant(value=2),
                      Constant(value=3)]))

 -- クラス: ast.Dict (keys, values)

     辞書をあらわします。 ‘keys’ と ‘values’ はそれぞれキーと値のノード
     のリスト を順序が一致した形で (それぞれ ‘dictionary.keys()’ と
     ‘dictionary.values()’ を呼び出したときに返される順序で) 保持します
     。

     辞書リテラルを使って辞書を展開した場合、展開された式ツリーにおいて
     辞書は ‘values’ リストに入り、 ‘keys’ の対応する位置には ‘None’ が
     入ります。

          >>> print(ast.dump(ast.parse('{"a":1, **d}', mode='eval'), indent=4))
          Expression(
              body=Dict(
                  keys=[
                      Constant(value='a'),
                      None],
                  values=[
                      Constant(value=1),
                      Name(id='d', ctx=Load())]))


File: python.info,  Node: 変数,  Next: 式 expression<2>,  Prev: リテラル<3>,  Up: Node クラス

5.32.1.5 変数
.............

 -- クラス: ast.Name (id, ctx)

     変数名をあらわします。 ‘id’ は変数名を文字列で保持し、 ‘ctx’ は以下
     に示す型のいずれかです。

 -- クラス: ast.Load
 -- クラス: ast.Store
 -- クラス: ast.Del

     変数の参照は変数の値をロードするか、新しい値を割り当てるか、または
     値を削除するために使うことができます。変数の参照はこれら3つの場合を
     区別するためのコンテキストによって与えられます。

          >>> print(ast.dump(ast.parse('a'), indent=4))
          Module(
              body=[
                  Expr(
                      value=Name(id='a', ctx=Load()))])

          >>> print(ast.dump(ast.parse('a = 1'), indent=4))
          Module(
              body=[
                  Assign(
                      targets=[
                          Name(id='a', ctx=Store())],
                      value=Constant(value=1))])

          >>> print(ast.dump(ast.parse('del a'), indent=4))
          Module(
              body=[
                  Delete(
                      targets=[
                          Name(id='a', ctx=Del())])])

 -- クラス: ast.Starred (value, ctx)

     ‘*var’ 形式の変数の参照をあらわします。 ‘value’ は変数、典型的には
     *note Name: 1d22. ノード、を保持します。この型は ‘*args’ を伴う関数
     呼び出しノード *note Call: 4a8f. を構築する際に使用します。

          >>> print(ast.dump(ast.parse('a, *b = it'), indent=4))
          Module(
              body=[
                  Assign(
                      targets=[
                          Tuple(
                              elts=[
                                  Name(id='a', ctx=Store()),
                                  Starred(
                                      value=Name(id='b', ctx=Store()),
                                      ctx=Store())],
                              ctx=Store())],
                      value=Name(id='it', ctx=Load()))])


File: python.info,  Node: 式 expression<2>,  Next: 文 Statements,  Prev: 変数,  Up: Node クラス

5.32.1.6 式 (expression)
........................

 -- クラス: ast.Expr (value)

     関数呼び出しのような式がそれ自身で文となり、戻り値が使われないかま
     たは保存されないとき、その式はこのコンテナでラップされます。
     ‘value’ はこの節で説明する他のノード、 *note Constant: 2ef. ノード
     、 *note Name: 1d22. ノード、 *note Lambda: 4a99. ノード *note
     Yield: 4aa0. ノードまたは *note YieldFrom: 4aa1. ノードのいずれかを
     保持します。

          >>> print(ast.dump(ast.parse('-a'), indent=4))
          Module(
              body=[
                  Expr(
                      value=UnaryOp(
                          op=USub(),
                          operand=Name(id='a', ctx=Load())))])

 -- クラス: ast.UnaryOp (op, operand)

     単項演算をあらわします。 ‘op’ は演算子で、 ‘operand’ は任意の式ツリ
     ーのノードです。

 -- クラス: ast.UAdd
 -- クラス: ast.USub
 -- クラス: ast.Not
 -- クラス: ast.Invert

     単項演算の演算子をあらわします。 *note Not: 4a82. は論理否定キーワ
     ード ‘not’ であり、 *note Invert: 4a7f. はビット反転演算子 ‘~’ です
     。

          >>> print(ast.dump(ast.parse('not x', mode='eval'), indent=4))
          Expression(
              body=UnaryOp(
                  op=Not(),
                  operand=Name(id='x', ctx=Load())))

 -- クラス: ast.BinOp (left, op, right)

     (加算や減算のような) 二項演算をあらわします。 ‘op’ は演算子、
     ‘left’ と ‘right’ は任意の式ツリーのノードです。

          >>> print(ast.dump(ast.parse('x + y', mode='eval'), indent=4))
          Expression(
              body=BinOp(
                  left=Name(id='x', ctx=Load()),
                  op=Add(),
                  right=Name(id='y', ctx=Load())))

 -- クラス: ast.Add
 -- クラス: ast.Sub
 -- クラス: ast.Mult
 -- クラス: ast.Div
 -- クラス: ast.FloorDiv
 -- クラス: ast.Mod
 -- クラス: ast.Pow
 -- クラス: ast.LShift
 -- クラス: ast.RShift
 -- クラス: ast.BitOr
 -- クラス: ast.BitXor
 -- クラス: ast.BitAnd
 -- クラス: ast.MatMult

     二項演算の演算子をあらわします。

 -- クラス: ast.BoolOp (op, values)

     'or' や 'and' のような論理演算をあらわします。 ‘op’ は *note Or:
     4b93. または *note And: 4b94. です。 ‘values’ は必要な値のリストで
     す。 ‘a or b or c’ のように同じ演算子を使う連続した演算は、複数の値
     を持った単一のノードとして表現されます。

     ‘not’ は単項演算 *note UnaryOp: 4a7e. のため、ここには含まれません
     。

          >>> print(ast.dump(ast.parse('x or y', mode='eval'), indent=4))
          Expression(
              body=BoolOp(
                  op=Or(),
                  values=[
                      Name(id='x', ctx=Load()),
                      Name(id='y', ctx=Load())]))

 -- クラス: ast.And
 -- クラス: ast.Or

     論理演算の演算子をあらわします。

 -- クラス: ast.Compare (left, ops, comparators)

     2つ以上の値の比較をあらわします。 ‘left’ 比較の中の最初の値、‘ops’
     は演算子のリスト、 ‘comparators’ は2つ目以降の値のリストです。

          >>> print(ast.dump(ast.parse('1 <= a < 10', mode='eval'), indent=4))
          Expression(
              body=Compare(
                  left=Constant(value=1),
                  ops=[
                      LtE(),
                      Lt()],
                  comparators=[
                      Name(id='a', ctx=Load()),
                      Constant(value=10)]))

 -- クラス: ast.Eq
 -- クラス: ast.NotEq
 -- クラス: ast.Lt
 -- クラス: ast.LtE
 -- クラス: ast.Gt
 -- クラス: ast.GtE
 -- クラス: ast.Is
 -- クラス: ast.IsNot
 -- クラス: ast.In
 -- クラス: ast.NotIn

     比較演算の演算子をあらわします。

 -- クラス: ast.Call (func, args, keywords)

     関数呼び出しをあらわします。 ‘func’ は関数で、多くの場合 *note
     Name: 1d22. または *note Attribute: 4a90. のオブジェクトです。 関数
     呼び出しの引数:

        * ‘args’ は位置引数のリストを保持します。

        * ‘keywords’ holds a list of *note keyword: 4b95. objects
          representing arguments passed by keyword.

     The ‘args’ and ‘keywords’ arguments are optional and default to
     empty lists.

          >>> print(ast.dump(ast.parse('func(a, b=c, *d, **e)', mode='eval'), indent=4))
          Expression(
              body=Call(
                  func=Name(id='func', ctx=Load()),
                  args=[
                      Name(id='a', ctx=Load()),
                      Starred(
                          value=Name(id='d', ctx=Load()),
                          ctx=Load())],
                  keywords=[
                      keyword(
                          arg='b',
                          value=Name(id='c', ctx=Load())),
                      keyword(
                          value=Name(id='e', ctx=Load()))]))

 -- クラス: ast.keyword (arg, value)

     関数呼び出しまたはクラス定義のキーワード引数をあらわします。 ‘arg’
     はパラメータ名をあらわす文字列、 ‘value’ は引数に渡す値をあらわすノ
     ードです。

 -- クラス: ast.IfExp (test, body, orelse)

     ‘a if b else c’ のような式をあらわします。各フィールドは単一のノー
     ドを保持します。以下の例では、3つの式ノードはすべて *note Name:
     1d22. ノードです。

          >>> print(ast.dump(ast.parse('a if b else c', mode='eval'), indent=4))
          Expression(
              body=IfExp(
                  test=Name(id='b', ctx=Load()),
                  body=Name(id='a', ctx=Load()),
                  orelse=Name(id='c', ctx=Load())))

 -- クラス: ast.Attribute (value, attr, ctx)

     たとえば ‘d.keys’ のような属性へのアクセスです。 ‘value’ はノードで
     、典型的には *note Name: 1d22. です。 ‘attr’ は属性名を与える生の文
     字列で、 ‘ctx’ はその属性がどのように振る舞うかに応じて *note Load:
     4c2.、 *note Store: 4b81. または *note Del: 4b83. のいずれかです。

          >>> print(ast.dump(ast.parse('snake.colour', mode='eval'), indent=4))
          Expression(
              body=Attribute(
                  value=Name(id='snake', ctx=Load()),
                  attr='colour',
                  ctx=Load()))

 -- クラス: ast.NamedExpr (target, value)

     代入式です。この AST ノードは代入式演算子（ウォルラス演算子、または
     「セイウチ演算子」としても知られています）によって生成されます。第
     一引数が複数のノードであってもよい *note Assign: 4b96. ノードと異な
     り、このノードの場合は ‘target’ と ‘value’ の両方が単一のノードでな
     ければなりません。

          >>> print(ast.dump(ast.parse('(x := 4)', mode='eval'), indent=4))
          Expression(
              body=NamedExpr(
                  target=Name(id='x', ctx=Store()),
                  value=Constant(value=4)))

     Added in version 3.8.

* Menu:

* 配列要素の参照 (Subscripting): 配列要素の参照 Subscripting.
* 内包表記 (Comprehension): 内包表記 Comprehension.


File: python.info,  Node: 配列要素の参照 Subscripting,  Next: 内包表記 Comprehension,  Up: 式 expression<2>

5.32.1.7 配列要素の参照 (Subscripting)
......................................

 -- クラス: ast.Subscript (value, slice, ctx)

     ‘l[1]’ のような配列要素の参照をあらわします。 ‘value’ は参照元のオ
     ブジェクトです (通常シーケンス型またはマッピング型)。 ‘slice’ はイ
     ンデックス、スライス、またはキーです。 *note Slice: 4a95. を含む
     *note Tuple: 4a94. でもかまいません。 ‘ctx’ は要素の参照により実行
     されるアクションに応じて *note Load: 4c2.、 *note Store: 4b81. また
     は *note Del: 4b83. のいずれかです。

          >>> print(ast.dump(ast.parse('l[1:2, 3]', mode='eval'), indent=4))
          Expression(
              body=Subscript(
                  value=Name(id='l', ctx=Load()),
                  slice=Tuple(
                      elts=[
                          Slice(
                              lower=Constant(value=1),
                              upper=Constant(value=2)),
                          Constant(value=3)],
                      ctx=Load()),
                  ctx=Load()))

 -- クラス: ast.Slice (lower, upper, step)

     基本的なスライス操作 (‘lower:upper’ や ‘lower:upper:step’ の形式) を
     あらわします。 *note Subscript: 4a91. の 'slice' フィールドでの直接
     指定か、または *note Tuple: 4a94. の要素として指定する場合のみ利用
     可能です。

          >>> print(ast.dump(ast.parse('l[1:2]', mode='eval'), indent=4))
          Expression(
              body=Subscript(
                  value=Name(id='l', ctx=Load()),
                  slice=Slice(
                      lower=Constant(value=1),
                      upper=Constant(value=2)),
                  ctx=Load()))


File: python.info,  Node: 内包表記 Comprehension,  Prev: 配列要素の参照 Subscripting,  Up: 式 expression<2>

5.32.1.8 内包表記 (Comprehension)
.................................

 -- クラス: ast.ListComp (elt, generators)
 -- クラス: ast.SetComp (elt, generators)
 -- クラス: ast.GeneratorExp (elt, generators)
 -- クラス: ast.DictComp (key, value, generators)

     リストや集合の内包表記、ジェネレータ、および辞書の内包表記です。
     ‘elt’ (または ‘key’ と ‘value’) は各要素として評価される部品をあら
     わす単一のノードです。

     ‘generators’ は *note comprehension: 4b99. ノードのリストです。

          >>> print(ast.dump(
          ...     ast.parse('[x for x in numbers]', mode='eval'),
          ...     indent=4,
          ... ))
          Expression(
              body=ListComp(
                  elt=Name(id='x', ctx=Load()),
                  generators=[
                      comprehension(
                          target=Name(id='x', ctx=Store()),
                          iter=Name(id='numbers', ctx=Load()),
                          is_async=0)]))
          >>> print(ast.dump(
          ...     ast.parse('{x: x**2 for x in numbers}', mode='eval'),
          ...     indent=4,
          ... ))
          Expression(
              body=DictComp(
                  key=Name(id='x', ctx=Load()),
                  value=BinOp(
                      left=Name(id='x', ctx=Load()),
                      op=Pow(),
                      right=Constant(value=2)),
                  generators=[
                      comprehension(
                          target=Name(id='x', ctx=Store()),
                          iter=Name(id='numbers', ctx=Load()),
                          is_async=0)]))
          >>> print(ast.dump(
          ...     ast.parse('{x for x in numbers}', mode='eval'),
          ...     indent=4,
          ... ))
          Expression(
              body=SetComp(
                  elt=Name(id='x', ctx=Load()),
                  generators=[
                      comprehension(
                          target=Name(id='x', ctx=Store()),
                          iter=Name(id='numbers', ctx=Load()),
                          is_async=0)]))

 -- クラス: ast.comprehension (target, iter, ifs, is_async)

     内包表記におけるひとつの ‘for’ 節をあらわします。 ‘target’ は各要素
     への参照です - 典型的には *note Name: 1d22. または *note Tuple:
     4a94. ノードです。 ‘iter’ はイテレートする対象のオブジェクトです。
     ‘ifs’ は条件節のリストです: 各 ‘for’ 節は複数の ‘ifs’ を持つことが
     できます。

     ‘is_async’ は内包表記が非同期であることを示します (‘async for’ を
     ‘for’ の代わりに使います)。値は整数です (0 または 1)。

          >>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', mode='eval'),
          ...                indent=4)) # Multiple comprehensions in one.
          Expression(
              body=ListComp(
                  elt=Call(
                      func=Name(id='ord', ctx=Load()),
                      args=[
                          Name(id='c', ctx=Load())]),
                  generators=[
                      comprehension(
                          target=Name(id='line', ctx=Store()),
                          iter=Name(id='file', ctx=Load()),
                          is_async=0),
                      comprehension(
                          target=Name(id='c', ctx=Store()),
                          iter=Name(id='line', ctx=Load()),
                          is_async=0)]))

          >>> print(ast.dump(ast.parse('(n**2 for n in it if n>5 if n<10)', mode='eval'),
          ...                indent=4)) # generator comprehension
          Expression(
              body=GeneratorExp(
                  elt=BinOp(
                      left=Name(id='n', ctx=Load()),
                      op=Pow(),
                      right=Constant(value=2)),
                  generators=[
                      comprehension(
                          target=Name(id='n', ctx=Store()),
                          iter=Name(id='it', ctx=Load()),
                          ifs=[
                              Compare(
                                  left=Name(id='n', ctx=Load()),
                                  ops=[
                                      Gt()],
                                  comparators=[
                                      Constant(value=5)]),
                              Compare(
                                  left=Name(id='n', ctx=Load()),
                                  ops=[
                                      Lt()],
                                  comparators=[
                                      Constant(value=10)])],
                          is_async=0)]))

          >>> print(ast.dump(ast.parse('[i async for i in soc]', mode='eval'),
          ...                indent=4)) # Async comprehension
          Expression(
              body=ListComp(
                  elt=Name(id='i', ctx=Load()),
                  generators=[
                      comprehension(
                          target=Name(id='i', ctx=Store()),
                          iter=Name(id='soc', ctx=Load()),
                          is_async=1)]))


File: python.info,  Node: 文 Statements,  Next: 制御フロー,  Prev: 式 expression<2>,  Up: Node クラス

5.32.1.9 文 (Statements)
........................

 -- クラス: ast.Assign (targets, value, type_comment)

     代入です。 ‘targets’ はノードのリスト、 ‘value’ は単一のノードです
     。

     ‘targets’ の複数のノードは、それぞれに対して同じ値を代入することを
     あらわします。分割代入は ‘targets’ 内に *note Tuple: 4a94. または
     *note List: 4a93. を置くことで表現されます。

      -- の属性: type_comment

          ‘type_comment’ はコメントとして型アノテーションをあらわすオプ
          ション文字列です。

          >>> print(ast.dump(ast.parse('a = b = 1'), indent=4)) # Multiple assignment
          Module(
              body=[
                  Assign(
                      targets=[
                          Name(id='a', ctx=Store()),
                          Name(id='b', ctx=Store())],
                      value=Constant(value=1))])

          >>> print(ast.dump(ast.parse('a,b = c'), indent=4)) # Unpacking
          Module(
              body=[
                  Assign(
                      targets=[
                          Tuple(
                              elts=[
                                  Name(id='a', ctx=Store()),
                                  Name(id='b', ctx=Store())],
                              ctx=Store())],
                      value=Name(id='c', ctx=Load()))])

 -- クラス: ast.AnnAssign (target, annotation, value, simple)

     An assignment with a type annotation.  ‘target’ is a single node
     and can be a *note Name: 1d22, an *note Attribute: 4a90. or a *note
     Subscript: 4a91.  ‘annotation’ is the annotation, such as a *note
     Constant: 2ef. or *note Name: 1d22. node.  ‘value’ is a single
     optional node.

     ‘simple’ is always either 0 (indicating a "complex" target) or 1
     (indicating a "simple" target).  A "simple" target consists solely
     of a *note Name: 1d22. node that does not appear between
     parentheses; all other targets are considered complex.  Only simple
     targets appear in the *note __annotations__: 458. dictionary of
     modules and classes.

          >>> print(ast.dump(ast.parse('c: int'), indent=4))
          Module(
              body=[
                  AnnAssign(
                      target=Name(id='c', ctx=Store()),
                      annotation=Name(id='int', ctx=Load()),
                      simple=1)])

          >>> print(ast.dump(ast.parse('(a): int = 1'), indent=4)) # Annotation with parenthesis
          Module(
              body=[
                  AnnAssign(
                      target=Name(id='a', ctx=Store()),
                      annotation=Name(id='int', ctx=Load()),
                      value=Constant(value=1),
                      simple=0)])

          >>> print(ast.dump(ast.parse('a.b: int'), indent=4)) # Attribute annotation
          Module(
              body=[
                  AnnAssign(
                      target=Attribute(
                          value=Name(id='a', ctx=Load()),
                          attr='b',
                          ctx=Store()),
                      annotation=Name(id='int', ctx=Load()),
                      simple=0)])

          >>> print(ast.dump(ast.parse('a[1]: int'), indent=4)) # Subscript annotation
          Module(
              body=[
                  AnnAssign(
                      target=Subscript(
                          value=Name(id='a', ctx=Load()),
                          slice=Constant(value=1),
                          ctx=Store()),
                      annotation=Name(id='int', ctx=Load()),
                      simple=0)])

 -- クラス: ast.AugAssign (target, op, value)

     ‘a += 1’ のような累積代入をあらわします。下記の例では、 ‘target’ は
     (*note Store: 4b81. コンテキストを伴う) ‘x’ のための *note Name:
     1d22. ノード、 ‘op’ は *note Add: 4b86. 演算子、そして ‘value’ は定
     数1をあらわす *note Constant: 2ef. ノードです。

     *note Assign: 4b96. と異なり、 ‘target’ 属性は class *note Tuple:
     4a94. や *note List: 4a93. であってはいけません。

          >>> print(ast.dump(ast.parse('x += 2'), indent=4))
          Module(
              body=[
                  AugAssign(
                      target=Name(id='x', ctx=Store()),
                      op=Add(),
                      value=Constant(value=2))])

 -- クラス: ast.Raise (exc, cause)

     ‘raise’ 文をあらわします。 ‘exc’ は送出される例外オブジェクトで、通
     常は *note Call: 4a8f. または *note Name: 1d22.、 もしくは単独の
     ‘raise’ では ‘None’ を指定します。 ‘cause’ はオプションで、 ‘raise
     x from y’ の ‘y’ にあたります。

          >>> print(ast.dump(ast.parse('raise x from y'), indent=4))
          Module(
              body=[
                  Raise(
                      exc=Name(id='x', ctx=Load()),
                      cause=Name(id='y', ctx=Load()))])

 -- クラス: ast.Assert (test, msg)

     アサーションです。 ‘test’ は *note Compare: 4a84. ノードなどのよう
     な条件を保持します。 ‘msg’ は失敗した時のメッセージを保持します。

          >>> print(ast.dump(ast.parse('assert x,y'), indent=4))
          Module(
              body=[
                  Assert(
                      test=Name(id='x', ctx=Load()),
                      msg=Name(id='y', ctx=Load()))])

 -- クラス: ast.Delete (targets)

     ‘del’ 文をあらわします。 ‘targets’ は *note Name: 1d22, *note
     Attribute: 4a90, *note Subscript: 4a91. などのノードのリストです。

          >>> print(ast.dump(ast.parse('del x,y,z'), indent=4))
          Module(
              body=[
                  Delete(
                      targets=[
                          Name(id='x', ctx=Del()),
                          Name(id='y', ctx=Del()),
                          Name(id='z', ctx=Del())])])

 -- クラス: ast.Pass

     ‘pass’ 文をあらわします。

          >>> print(ast.dump(ast.parse('pass'), indent=4))
          Module(
              body=[
                  Pass()])

 -- クラス: ast.TypeAlias (name, type_params, value)

     A *note type alias: 683. created through the *note type: 66d.
     statement.  ‘name’ is the name of the alias, ‘type_params’ is a
     list of *note type parameters: 4ba2, and ‘value’ is the value of
     the type alias.

          >>> print(ast.dump(ast.parse('type Alias = int'), indent=4))
          Module(
              body=[
                  TypeAlias(
                      name=Name(id='Alias', ctx=Store()),
                      value=Name(id='int', ctx=Load()))])

     Added in version 3.12.

関数またはループの内部でのみ適用可能な他の文は、別のセクションで説明しま
す。

* Menu:

* インポート::


File: python.info,  Node: インポート,  Up: 文 Statements

5.32.1.10 インポート
....................

 -- クラス: ast.Import (names)

     インポート文です。 ‘names’ は *note alias: 1c74. ノードのリストです
     。

          >>> print(ast.dump(ast.parse('import x,y,z'), indent=4))
          Module(
              body=[
                  Import(
                      names=[
                          alias(name='x'),
                          alias(name='y'),
                          alias(name='z')])])

 -- クラス: ast.ImportFrom (module, names, level)

     ‘from x import y’ をあらわします。 ‘module’ は 'from' でインポート
     する先頭がドットでないモジュール名をあらわす文字列か、または ‘from
     . import foo’ のような構文の場合は ‘None’ を指定します。 ‘level’ は
     相対インポートのレベルを表す整数を保持します (0 は絶対インポートを
     意味します)。

          >>> print(ast.dump(ast.parse('from y import x,y,z'), indent=4))
          Module(
              body=[
                  ImportFrom(
                      module='y',
                      names=[
                          alias(name='x'),
                          alias(name='y'),
                          alias(name='z')],
                      level=0)])

 -- クラス: ast.alias (name, asname)

     いずれのパラメータも名前をあらわす生の文字列です。 ‘asname’ は標準
     の名前を使う場合は ‘None’ を指定できます。

          >>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4))
          Module(
              body=[
                  ImportFrom(
                      module='foo.bar',
                      names=[
                          alias(name='a', asname='b'),
                          alias(name='c')],
                      level=2)])


File: python.info,  Node: 制御フロー,  Next: Pattern matching,  Prev: 文 Statements,  Up: Node クラス

5.32.1.11 制御フロー
....................

     注釈: ‘else’ 節のようなオプションの節が存在しない場合は、空のリスト
     として保存されます。

 -- クラス: ast.If (test, body, orelse)

     ‘if’ 文です。 ‘test’ は *note Compare: 4a84. ノードなどの単一のノー
     ドを保持します。 ‘body’ と ‘orelse’ はそれぞれノードのリストを保持
     します。

     ‘elif’ 節は AST において固有の表現を持たず、先行する節をあらわすノ
     ードの ‘orelse’ セクションに追加の *note If: 4ba7. ノードとして現れ
     ます。

          >>> print(ast.dump(ast.parse("""
          ... if x:
          ...    ...
          ... elif y:
          ...    ...
          ... else:
          ...    ...
          ... """), indent=4))
          Module(
              body=[
                  If(
                      test=Name(id='x', ctx=Load()),
                      body=[
                          Expr(
                              value=Constant(value=Ellipsis))],
                      orelse=[
                          If(
                              test=Name(id='y', ctx=Load()),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))],
                              orelse=[
                                  Expr(
                                      value=Constant(value=Ellipsis))])])])

 -- クラス: ast.For (target, iter, body, orelse, type_comment)

     A ‘for’ loop.  ‘target’ holds the variable(s) the loop assigns to,
     as a single *note Name: 1d22, *note Tuple: 4a94, *note List: 4a93,
     *note Attribute: 4a90. or *note Subscript: 4a91. node.  ‘iter’
     holds the item to be looped over, again as a single node.  ‘body’
     and ‘orelse’ contain lists of nodes to execute.  Those in ‘orelse’
     are executed if the loop finishes normally, rather than via a
     ‘break’ statement.

      -- の属性: type_comment

          ‘type_comment’ はコメントとして型アノテーションをあらわすオプ
          ション文字列です。

          >>> print(ast.dump(ast.parse("""
          ... for x in y:
          ...     ...
          ... else:
          ...     ...
          ... """), indent=4))
          Module(
              body=[
                  For(
                      target=Name(id='x', ctx=Store()),
                      iter=Name(id='y', ctx=Load()),
                      body=[
                          Expr(
                              value=Constant(value=Ellipsis))],
                      orelse=[
                          Expr(
                              value=Constant(value=Ellipsis))])])

 -- クラス: ast.While (test, body, orelse)

     ‘while’ ループです。 ‘test’ は *note Compare: 4a84. のような条件を
     あらわすノードを保持します。

          >>> print(ast.dump(ast.parse("""
          ... while x:
          ...    ...
          ... else:
          ...    ...
          ... """), indent=4))
          Module(
              body=[
                  While(
                      test=Name(id='x', ctx=Load()),
                      body=[
                          Expr(
                              value=Constant(value=Ellipsis))],
                      orelse=[
                          Expr(
                              value=Constant(value=Ellipsis))])])

 -- クラス: ast.Break
 -- クラス: ast.Continue

     ‘break’ 文および ‘continue’ 文です。

          >>> print(ast.dump(ast.parse("""\
          ... for a in b:
          ...     if a > 5:
          ...         break
          ...     else:
          ...         continue
          ...
          ... """), indent=4))
          Module(
              body=[
                  For(
                      target=Name(id='a', ctx=Store()),
                      iter=Name(id='b', ctx=Load()),
                      body=[
                          If(
                              test=Compare(
                                  left=Name(id='a', ctx=Load()),
                                  ops=[
                                      Gt()],
                                  comparators=[
                                      Constant(value=5)]),
                              body=[
                                  Break()],
                              orelse=[
                                  Continue()])])])

 -- クラス: ast.Try (body, handlers, orelse, finalbody)

     ‘try’ ブロックです。 *note ExceptHandler: 4bae. ノードのリストであ
     る ‘handlers’ を除き、全ての属性はそれぞれの節で実行するノードのリ
     ストです。

          >>> print(ast.dump(ast.parse("""
          ... try:
          ...    ...
          ... except Exception:
          ...    ...
          ... except OtherException as e:
          ...    ...
          ... else:
          ...    ...
          ... finally:
          ...    ...
          ... """), indent=4))
          Module(
              body=[
                  Try(
                      body=[
                          Expr(
                              value=Constant(value=Ellipsis))],
                      handlers=[
                          ExceptHandler(
                              type=Name(id='Exception', ctx=Load()),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))]),
                          ExceptHandler(
                              type=Name(id='OtherException', ctx=Load()),
                              name='e',
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))])],
                      orelse=[
                          Expr(
                              value=Constant(value=Ellipsis))],
                      finalbody=[
                          Expr(
                              value=Constant(value=Ellipsis))])])

 -- クラス: ast.TryStar (body, handlers, orelse, finalbody)

     ‘try’ blocks which are followed by ‘except*’ clauses.  The
     attributes are the same as for *note Try: 4bad. but the *note
     ExceptHandler: 4bae. nodes in ‘handlers’ are interpreted as
     ‘except*’ blocks rather then ‘except’.

          >>> print(ast.dump(ast.parse("""
          ... try:
          ...    ...
          ... except* Exception:
          ...    ...
          ... """), indent=4))
          Module(
              body=[
                  TryStar(
                      body=[
                          Expr(
                              value=Constant(value=Ellipsis))],
                      handlers=[
                          ExceptHandler(
                              type=Name(id='Exception', ctx=Load()),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))])])])

     Added in version 3.11.

 -- クラス: ast.ExceptHandler (type, name, body)

     単一の ‘except’ 節をあらわします。 ‘type’ はこの節にマッチする例外
     のタイプで、典型的には *note Name: 1d22. ノードです (‘None’ を指定
     すると全ての例外をキャッチする ‘except:’ 節をあらわします)。 ‘name’
     は例外オブジェクトを保持する変数の名前をあらわす生の文字列で、 ‘as
     foo’ を持たない節の場合は ‘None’ を指定します。 ‘body’ はノードのリ
     ストです。

          >>> print(ast.dump(ast.parse("""\
          ... try:
          ...     a + 1
          ... except TypeError:
          ...     pass
          ... """), indent=4))
          Module(
              body=[
                  Try(
                      body=[
                          Expr(
                              value=BinOp(
                                  left=Name(id='a', ctx=Load()),
                                  op=Add(),
                                  right=Constant(value=1)))],
                      handlers=[
                          ExceptHandler(
                              type=Name(id='TypeError', ctx=Load()),
                              body=[
                                  Pass()])])])

 -- クラス: ast.With (items, body, type_comment)

     ‘with’ ブロックです。 ‘items’ は *note withitem: 4bb1. ノードのリス
     トで、コンテキストマネージャのリストをあらわします。また ‘body’ は
     コンテキスト内にインデントされたブロックです。

      -- の属性: type_comment

          ‘type_comment’ はコメントとして型アノテーションをあらわすオプ
          ション文字列です。

 -- クラス: ast.withitem (context_expr, optional_vars)

     ‘with’ ブロックにおける単一のコンテキストマネージャをあらわします。
     ‘context_expr’ はコンテキストマネージャで、しばしば *note Call:
     4a8f. ノードが設定されます。 ‘optional_vars’ は ‘as foo’ に相当する
     *note Name: 1d22, *note Tuple: 4a94. または *note List: 4a93. のい
     ずれかのノードか、または、この部分が不要な場合は ‘None’ を設定しま
     す。

          >>> print(ast.dump(ast.parse("""\
          ... with a as b, c as d:
          ...    something(b, d)
          ... """), indent=4))
          Module(
              body=[
                  With(
                      items=[
                          withitem(
                              context_expr=Name(id='a', ctx=Load()),
                              optional_vars=Name(id='b', ctx=Store())),
                          withitem(
                              context_expr=Name(id='c', ctx=Load()),
                              optional_vars=Name(id='d', ctx=Store()))],
                      body=[
                          Expr(
                              value=Call(
                                  func=Name(id='something', ctx=Load()),
                                  args=[
                                      Name(id='b', ctx=Load()),
                                      Name(id='d', ctx=Load())]))])])


File: python.info,  Node: Pattern matching,  Next: Type annotations,  Prev: 制御フロー,  Up: Node クラス

5.32.1.12 Pattern matching
..........................

 -- クラス: ast.Match (subject, cases)

     A ‘match’ statement.  ‘subject’ holds the subject of the match (the
     object that is being matched against the cases) and ‘cases’
     contains an iterable of *note match_case: 4bb5. nodes with the
     different cases.

     Added in version 3.10.

 -- クラス: ast.match_case (pattern, guard, body)

     A single case pattern in a ‘match’ statement.  ‘pattern’ contains
     the match pattern that the subject will be matched against.  Note
     that the *note AST: 4c3. nodes produced for patterns differ from
     those produced for expressions, even when they share the same
     syntax.

     The ‘guard’ attribute contains an expression that will be evaluated
     if the pattern matches the subject.

     ‘body’ contains a list of nodes to execute if the pattern matches
     and the result of evaluating the guard expression is true.

          >>> print(ast.dump(ast.parse("""
          ... match x:
          ...     case [x] if x>0:
          ...         ...
          ...     case tuple():
          ...         ...
          ... """), indent=4))
          Module(
              body=[
                  Match(
                      subject=Name(id='x', ctx=Load()),
                      cases=[
                          match_case(
                              pattern=MatchSequence(
                                  patterns=[
                                      MatchAs(name='x')]),
                              guard=Compare(
                                  left=Name(id='x', ctx=Load()),
                                  ops=[
                                      Gt()],
                                  comparators=[
                                      Constant(value=0)]),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))]),
                          match_case(
                              pattern=MatchClass(
                                  cls=Name(id='tuple', ctx=Load())),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))])])])

     Added in version 3.10.

 -- クラス: ast.MatchValue (value)

     A match literal or value pattern that compares by equality.
     ‘value’ is an expression node.  Permitted value nodes are
     restricted as described in the match statement documentation.  This
     pattern succeeds if the match subject is equal to the evaluated
     value.

          >>> print(ast.dump(ast.parse("""
          ... match x:
          ...     case "Relevant":
          ...         ...
          ... """), indent=4))
          Module(
              body=[
                  Match(
                      subject=Name(id='x', ctx=Load()),
                      cases=[
                          match_case(
                              pattern=MatchValue(
                                  value=Constant(value='Relevant')),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))])])])

     Added in version 3.10.

 -- クラス: ast.MatchSingleton (value)

     A match literal pattern that compares by identity.  ‘value’ is the
     singleton to be compared against: ‘None’, ‘True’, or ‘False’.  This
     pattern succeeds if the match subject is the given constant.

          >>> print(ast.dump(ast.parse("""
          ... match x:
          ...     case None:
          ...         ...
          ... """), indent=4))
          Module(
              body=[
                  Match(
                      subject=Name(id='x', ctx=Load()),
                      cases=[
                          match_case(
                              pattern=MatchSingleton(value=None),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))])])])

     Added in version 3.10.

 -- クラス: ast.MatchSequence (patterns)

     A match sequence pattern.  ‘patterns’ contains the patterns to be
     matched against the subject elements if the subject is a sequence.
     Matches a variable length sequence if one of the subpatterns is a
     ‘MatchStar’ node, otherwise matches a fixed length sequence.

          >>> print(ast.dump(ast.parse("""
          ... match x:
          ...     case [1, 2]:
          ...         ...
          ... """), indent=4))
          Module(
              body=[
                  Match(
                      subject=Name(id='x', ctx=Load()),
                      cases=[
                          match_case(
                              pattern=MatchSequence(
                                  patterns=[
                                      MatchValue(
                                          value=Constant(value=1)),
                                      MatchValue(
                                          value=Constant(value=2))]),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))])])])

     Added in version 3.10.

 -- クラス: ast.MatchStar (name)

     Matches the rest of the sequence in a variable length match
     sequence pattern.  If ‘name’ is not ‘None’, a list containing the
     remaining sequence elements is bound to that name if the overall
     sequence pattern is successful.

          >>> print(ast.dump(ast.parse("""
          ... match x:
          ...     case [1, 2, *rest]:
          ...         ...
          ...     case [*_]:
          ...         ...
          ... """), indent=4))
          Module(
              body=[
                  Match(
                      subject=Name(id='x', ctx=Load()),
                      cases=[
                          match_case(
                              pattern=MatchSequence(
                                  patterns=[
                                      MatchValue(
                                          value=Constant(value=1)),
                                      MatchValue(
                                          value=Constant(value=2)),
                                      MatchStar(name='rest')]),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))]),
                          match_case(
                              pattern=MatchSequence(
                                  patterns=[
                                      MatchStar()]),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))])])])

     Added in version 3.10.

 -- クラス: ast.MatchMapping (keys, patterns, rest)

     A match mapping pattern.  ‘keys’ is a sequence of expression nodes.
     ‘patterns’ is a corresponding sequence of pattern nodes.  ‘rest’ is
     an optional name that can be specified to capture the remaining
     mapping elements.  Permitted key expressions are restricted as
     described in the match statement documentation.

     This pattern succeeds if the subject is a mapping, all evaluated
     key expressions are present in the mapping, and the value
     corresponding to each key matches the corresponding subpattern.  If
     ‘rest’ is not ‘None’, a dict containing the remaining mapping
     elements is bound to that name if the overall mapping pattern is
     successful.

          >>> print(ast.dump(ast.parse("""
          ... match x:
          ...     case {1: _, 2: _}:
          ...         ...
          ...     case {**rest}:
          ...         ...
          ... """), indent=4))
          Module(
              body=[
                  Match(
                      subject=Name(id='x', ctx=Load()),
                      cases=[
                          match_case(
                              pattern=MatchMapping(
                                  keys=[
                                      Constant(value=1),
                                      Constant(value=2)],
                                  patterns=[
                                      MatchAs(),
                                      MatchAs()]),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))]),
                          match_case(
                              pattern=MatchMapping(rest='rest'),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))])])])

     Added in version 3.10.

 -- クラス: ast.MatchClass (cls, patterns, kwd_attrs, kwd_patterns)

     A match class pattern.  ‘cls’ is an expression giving the nominal
     class to be matched.  ‘patterns’ is a sequence of pattern nodes to
     be matched against the class defined sequence of pattern matching
     attributes.  ‘kwd_attrs’ is a sequence of additional attributes to
     be matched (specified as keyword arguments in the class pattern),
     ‘kwd_patterns’ are the corresponding patterns (specified as keyword
     values in the class pattern).

     This pattern succeeds if the subject is an instance of the
     nominated class, all positional patterns match the corresponding
     class-defined attributes, and any specified keyword attributes
     match their corresponding pattern.

     Note: classes may define a property that returns self in order to
     match a pattern node against the instance being matched.  Several
     builtin types are also matched that way, as described in the match
     statement documentation.

          >>> print(ast.dump(ast.parse("""
          ... match x:
          ...     case Point2D(0, 0):
          ...         ...
          ...     case Point3D(x=0, y=0, z=0):
          ...         ...
          ... """), indent=4))
          Module(
              body=[
                  Match(
                      subject=Name(id='x', ctx=Load()),
                      cases=[
                          match_case(
                              pattern=MatchClass(
                                  cls=Name(id='Point2D', ctx=Load()),
                                  patterns=[
                                      MatchValue(
                                          value=Constant(value=0)),
                                      MatchValue(
                                          value=Constant(value=0))]),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))]),
                          match_case(
                              pattern=MatchClass(
                                  cls=Name(id='Point3D', ctx=Load()),
                                  kwd_attrs=[
                                      'x',
                                      'y',
                                      'z'],
                                  kwd_patterns=[
                                      MatchValue(
                                          value=Constant(value=0)),
                                      MatchValue(
                                          value=Constant(value=0)),
                                      MatchValue(
                                          value=Constant(value=0))]),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))])])])

     Added in version 3.10.

 -- クラス: ast.MatchAs (pattern, name)

     A match "as-pattern", capture pattern or wildcard pattern.
     ‘pattern’ contains the match pattern that the subject will be
     matched against.  If the pattern is ‘None’, the node represents a
     capture pattern (i.e a bare name) and will always succeed.

     The ‘name’ attribute contains the name that will be bound if the
     pattern is successful.  If ‘name’ is ‘None’, ‘pattern’ must also be
     ‘None’ and the node represents the wildcard pattern.

          >>> print(ast.dump(ast.parse("""
          ... match x:
          ...     case [x] as y:
          ...         ...
          ...     case _:
          ...         ...
          ... """), indent=4))
          Module(
              body=[
                  Match(
                      subject=Name(id='x', ctx=Load()),
                      cases=[
                          match_case(
                              pattern=MatchAs(
                                  pattern=MatchSequence(
                                      patterns=[
                                          MatchAs(name='x')]),
                                  name='y'),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))]),
                          match_case(
                              pattern=MatchAs(),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))])])])

     Added in version 3.10.

 -- クラス: ast.MatchOr (patterns)

     A match "or-pattern".  An or-pattern matches each of its
     subpatterns in turn to the subject, until one succeeds.  The
     or-pattern is then deemed to succeed.  If none of the subpatterns
     succeed the or-pattern fails.  The ‘patterns’ attribute contains a
     list of match pattern nodes that will be matched against the
     subject.

          >>> print(ast.dump(ast.parse("""
          ... match x:
          ...     case [x] | (y):
          ...         ...
          ... """), indent=4))
          Module(
              body=[
                  Match(
                      subject=Name(id='x', ctx=Load()),
                      cases=[
                          match_case(
                              pattern=MatchOr(
                                  patterns=[
                                      MatchSequence(
                                          patterns=[
                                              MatchAs(name='x')]),
                                      MatchAs(name='y')]),
                              body=[
                                  Expr(
                                      value=Constant(value=Ellipsis))])])])

     Added in version 3.10.


File: python.info,  Node: Type annotations,  Next: Type parameters,  Prev: Pattern matching,  Up: Node クラス

5.32.1.13 Type annotations
..........................

 -- クラス: ast.TypeIgnore (lineno, tag)

     A ‘# type: ignore’ comment located at 'lineno'.  'tag' is the
     optional tag specified by the form ‘# type: ignore <tag>’.

          >>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), indent=4))
          Module(
              body=[
                  Assign(
                      targets=[
                          Name(id='x', ctx=Store())],
                      value=Constant(value=1))],
              type_ignores=[
                  TypeIgnore(lineno=1, tag='')])
          >>> print(ast.dump(ast.parse('x: bool = 1 # type: ignore[assignment]', type_comments=True), indent=4))
          Module(
              body=[
                  AnnAssign(
                      target=Name(id='x', ctx=Store()),
                      annotation=Name(id='bool', ctx=Load()),
                      value=Constant(value=1),
                      simple=1)],
              type_ignores=[
                  TypeIgnore(lineno=1, tag='[assignment]')])

          注釈: ‘TypeIgnore’ nodes are not generated when the
          'type_comments' parameter is set to ‘False’ (default).  See
          *note ast.parse(): 1c2. for more details.

     Added in version 3.8.


File: python.info,  Node: Type parameters,  Next: 関数およびクラス定義,  Prev: Type annotations,  Up: Node クラス

5.32.1.14 Type parameters
.........................

*note Type parameters: 5ad. can exist on classes, functions, and type
aliases.

 -- クラス: ast.TypeVar (name, bound, default_value)

     A *note typing.TypeVar: 486.  ‘name’ is the name of the type
     variable.  ‘bound’ is the bound or constraints, if any.  If ‘bound’
     is a *note Tuple: 4a94, it represents constraints; otherwise it
     represents the bound.  ‘default_value’ is the default value; if the
     ‘TypeVar’ has no default, this attribute will be set to ‘None’.

          >>> print(ast.dump(ast.parse("type Alias[T: int = bool] = list[T]"), indent=4))
          Module(
              body=[
                  TypeAlias(
                      name=Name(id='Alias', ctx=Store()),
                      type_params=[
                          TypeVar(
                              name='T',
                              bound=Name(id='int', ctx=Load()),
                              default_value=Name(id='bool', ctx=Load()))],
                      value=Subscript(
                          value=Name(id='list', ctx=Load()),
                          slice=Name(id='T', ctx=Load()),
                          ctx=Load()))])

     Added in version 3.12.

     バージョン 3.13 で変更: Added the 'default_value' parameter.

 -- クラス: ast.ParamSpec (name, default_value)

     A *note typing.ParamSpec: 487.  ‘name’ is the name of the parameter
     specification.  ‘default_value’ is the default value; if the
     ‘ParamSpec’ has no default, this attribute will be set to ‘None’.

          >>> print(ast.dump(ast.parse("type Alias[**P = [int, str]] = Callable[P, int]"), indent=4))
          Module(
              body=[
                  TypeAlias(
                      name=Name(id='Alias', ctx=Store()),
                      type_params=[
                          ParamSpec(
                              name='P',
                              default_value=List(
                                  elts=[
                                      Name(id='int', ctx=Load()),
                                      Name(id='str', ctx=Load())],
                                  ctx=Load()))],
                      value=Subscript(
                          value=Name(id='Callable', ctx=Load()),
                          slice=Tuple(
                              elts=[
                                  Name(id='P', ctx=Load()),
                                  Name(id='int', ctx=Load())],
                              ctx=Load()),
                          ctx=Load()))])

     Added in version 3.12.

     バージョン 3.13 で変更: Added the 'default_value' parameter.

 -- クラス: ast.TypeVarTuple (name, default_value)

     A *note typing.TypeVarTuple: 488.  ‘name’ is the name of the type
     variable tuple.  ‘default_value’ is the default value; if the
     ‘TypeVarTuple’ has no default, this attribute will be set to
     ‘None’.

          >>> print(ast.dump(ast.parse("type Alias[*Ts = ()] = tuple[*Ts]"), indent=4))
          Module(
              body=[
                  TypeAlias(
                      name=Name(id='Alias', ctx=Store()),
                      type_params=[
                          TypeVarTuple(
                              name='Ts',
                              default_value=Tuple(ctx=Load()))],
                      value=Subscript(
                          value=Name(id='tuple', ctx=Load()),
                          slice=Tuple(
                              elts=[
                                  Starred(
                                      value=Name(id='Ts', ctx=Load()),
                                      ctx=Load())],
                              ctx=Load()),
                          ctx=Load()))])

     Added in version 3.12.

     バージョン 3.13 で変更: Added the 'default_value' parameter.


File: python.info,  Node: 関数およびクラス定義,  Next: async と await,  Prev: Type parameters,  Up: Node クラス

5.32.1.15 関数およびクラス定義
..............................

 -- クラス: ast.FunctionDef (name, args, body, decorator_list, returns,
          type_comment, type_params)

     関数定義です。

        * ‘name’ は関数名をあらわす生の文字列です。

        * ‘args’ は引数をあらわす *note arguments: 4bc4. ノードです。

        * ‘body’ は関数の本体をあらわすノードのリストです。

        * ‘decorator_list’ は関数に適用されるデコレータのリストで、外側
          のデコレータがリストの先頭に保存されます (すなわち、リストの先
          頭にあるデコレータが最後に適用されます)。

        * ‘returns’ は戻り値に対する注釈です。

        * ‘type_params’ is a list of *note type parameters: 4ba2.

      -- の属性: type_comment

          ‘type_comment’ はコメントとして型アノテーションをあらわすオプ
          ション文字列です。

     バージョン 3.12 で変更: Added ‘type_params’.

 -- クラス: ast.Lambda (args, body)

     ‘lambda’ は式の中で使うことができる最小限の関数定義です。 *note
     FunctionDef: 1a78. ノードと異なり、 ‘body’ は単一のノードとなります
     。

          >>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))
          Module(
              body=[
                  Expr(
                      value=Lambda(
                          args=arguments(
                              args=[
                                  arg(arg='x'),
                                  arg(arg='y')]),
                          body=Constant(value=Ellipsis)))])

 -- クラス: ast.arguments (posonlyargs, args, vararg, kwonlyargs,
          kw_defaults, kwarg, defaults)

     関数の引数

        * ‘posonlyargs’, ‘args’ および ‘kwonlyargs’ はそれぞれ *note
          arg: 4bc6. ノードのリストです。

        * ‘vararg’ と ‘kwarg’ はそれぞれ単一の *note arg: 4bc6. ノードで
          、 ‘*args, **kwargs’ パラメータに相当します。

        * ‘kw_defaults’ はキーワード専用引数に対するデフォルト値のリスト
          です。値が ‘None’ の場合、対応する引数は必須となります。

        * ‘defaults’ は位置引数として渡すことのできる引数に対するデフォ
          ルト値のリストです。デフォルト値の数nが位置引数の数より少ない
          場合、それらは最後のn個の引数に割り当てられます。

 -- クラス: ast.arg (arg, annotation, type_comment)

     A single argument in a list.  ‘arg’ is a raw string of the argument
     name; ‘annotation’ is its annotation, such as a *note Name: 1d22.
     node.

      -- の属性: type_comment

          ‘type_comment’ はコメントとして型アノテーションをあらわすオプ
          ション文字列です。

          >>> print(ast.dump(ast.parse("""\
          ... @decorator1
          ... @decorator2
          ... def f(a: 'annotation', b=1, c=2, *d, e, f=3, **g) -> 'return annotation':
          ...     pass
          ... """), indent=4))
          Module(
              body=[
                  FunctionDef(
                      name='f',
                      args=arguments(
                          args=[
                              arg(
                                  arg='a',
                                  annotation=Constant(value='annotation')),
                              arg(arg='b'),
                              arg(arg='c')],
                          vararg=arg(arg='d'),
                          kwonlyargs=[
                              arg(arg='e'),
                              arg(arg='f')],
                          kw_defaults=[
                              None,
                              Constant(value=3)],
                          kwarg=arg(arg='g'),
                          defaults=[
                              Constant(value=1),
                              Constant(value=2)]),
                      body=[
                          Pass()],
                      decorator_list=[
                          Name(id='decorator1', ctx=Load()),
                          Name(id='decorator2', ctx=Load())],
                      returns=Constant(value='return annotation'))])

 -- クラス: ast.Return (value)

     ‘return’ 文です。

          >>> print(ast.dump(ast.parse('return 4'), indent=4))
          Module(
              body=[
                  Return(
                      value=Constant(value=4))])

 -- クラス: ast.Yield (value)
 -- クラス: ast.YieldFrom (value)

     A ‘yield’ or ‘yield from’ expression.  Because these are
     expressions, they must be wrapped in an *note Expr: 4b85. node if
     the value sent back is not used.

          >>> print(ast.dump(ast.parse('yield x'), indent=4))
          Module(
              body=[
                  Expr(
                      value=Yield(
                          value=Name(id='x', ctx=Load())))])

          >>> print(ast.dump(ast.parse('yield from x'), indent=4))
          Module(
              body=[
                  Expr(
                      value=YieldFrom(
                          value=Name(id='x', ctx=Load())))])

 -- クラス: ast.Global (names)
 -- クラス: ast.Nonlocal (names)

     ‘global’ および ‘nonlocal’ 文です。 ‘names’ は生の文字列のリストで
     す。

          >>> print(ast.dump(ast.parse('global x,y,z'), indent=4))
          Module(
              body=[
                  Global(
                      names=[
                          'x',
                          'y',
                          'z'])])

          >>> print(ast.dump(ast.parse('nonlocal x,y,z'), indent=4))
          Module(
              body=[
                  Nonlocal(
                      names=[
                          'x',
                          'y',
                          'z'])])

 -- クラス: ast.ClassDef (name, bases, keywords, body, decorator_list,
          type_params)

     クラス定義です。

        * ‘name’ はクラス名をあらわす生の文字列です。

        * ‘bases’ は明示的に指定された基底クラスをあらわすノードのリスト
          です。

        * ‘keywords’ is a list of *note keyword: 4b95. nodes,
          principally for 'metaclass'.  Other keywords will be passed to
          the metaclass, as per PEP 3115(1).

        * ‘body’ はクラス定義に含まれるコードをあらわすノードのリストで
          す。

        * ‘decorator_list’ はノードのリストで、関数定義 *note
          FunctionDef: 1a78. の場合と同様に解釈されます。

        * ‘type_params’ is a list of *note type parameters: 4ba2.

          >>> print(ast.dump(ast.parse("""\
          ... @decorator1
          ... @decorator2
          ... class Foo(base1, base2, metaclass=meta):
          ...     pass
          ... """), indent=4))
          Module(
              body=[
                  ClassDef(
                      name='Foo',
                      bases=[
                          Name(id='base1', ctx=Load()),
                          Name(id='base2', ctx=Load())],
                      keywords=[
                          keyword(
                              arg='metaclass',
                              value=Name(id='meta', ctx=Load()))],
                      body=[
                          Pass()],
                      decorator_list=[
                          Name(id='decorator1', ctx=Load()),
                          Name(id='decorator2', ctx=Load())])])

     バージョン 3.12 で変更: Added ‘type_params’.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3115/


File: python.info,  Node: async と await,  Prev: 関数およびクラス定義,  Up: Node クラス

5.32.1.16 async と await
........................

 -- クラス: ast.AsyncFunctionDef (name, args, body, decorator_list,
          returns, type_comment, type_params)

     ‘async def’ 形式の関数定義です。通常の関数定義 *note FunctionDef:
     1a78. と同じフィールドを持ちます。

     バージョン 3.12 で変更: Added ‘type_params’.

 -- クラス: ast.Await (value)

     ‘await’ 式をあらわします。 ‘value’ は待ち受ける値です。 *note
     AsyncFunctionDef: 1a77. の本体 (body) の中でのみ有効です。

     >>> print(ast.dump(ast.parse("""\
     ... async def f():
     ...     await other_func()
     ... """), indent=4))
     Module(
         body=[
             AsyncFunctionDef(
                 name='f',
                 args=arguments(),
                 body=[
                     Expr(
                         value=Await(
                             value=Call(
                                 func=Name(id='other_func', ctx=Load()))))])])

 -- クラス: ast.AsyncFor (target, iter, body, orelse, type_comment)
 -- クラス: ast.AsyncWith (items, body, type_comment)

     ‘async for’ ループと ‘async with’ コンテキストマネージャです。それ
     ぞれ *note For: 4ba8. および *note With: 4bb0. と同じフィールドを持
     ちます。 *note AsyncFunctionDef: 1a77. の本体 (body) の中でのみ有効
     です。

     注釈: When a string is parsed by *note ast.parse(): 1c2, operator
     nodes (subclasses of ‘ast.operator’, ‘ast.unaryop’, ‘ast.cmpop’,
     ‘ast.boolop’ and ‘ast.expr_context’) on the returned tree will be
     singletons.  Changes to one will be reflected in all other
     occurrences of the same value (for example, *note ast.Add: 4b86.).


File: python.info,  Node: ast helpers,  Next: Compiler flags<2>,  Prev: Node クラス,  Up: ast --- Abstract syntax trees

5.32.1.17 ‘ast’ helpers
.......................

Apart from the node classes, the ‘ast’ module defines these utility
functions and classes for traversing abstract syntax trees:

 -- の関数: ast.parse (source, filename='<unknown>', mode='exec', *,
          type_comments=False, feature_version=None, optimize=-1)

     Parse the source into an AST node.  Equivalent to ‘compile(source,
     filename, mode, flags=FLAGS_VALUE, optimize=optimize)’, where
     ‘FLAGS_VALUE’ is ‘ast.PyCF_ONLY_AST’ if ‘optimize <= 0’ and
     ‘ast.PyCF_OPTIMIZED_AST’ otherwise.

     If ‘type_comments=True’ is given, the parser is modified to check
     and return type comments as specified by PEP 484(1) and PEP 526(2).
     This is equivalent to adding *note ast.PyCF_TYPE_COMMENTS: 4bcf. to
     the flags passed to *note compile(): 4b1.  This will report syntax
     errors for misplaced type comments.  Without this flag, type
     comments will be ignored, and the ‘type_comment’ field on selected
     AST nodes will always be ‘None’.  In addition, the locations of ‘#
     type: ignore’ comments will be returned as the ‘type_ignores’
     attribute of *note Module: 4b7a. (otherwise it is always an empty
     list).

     さらに ‘mode’ が ‘'func_type'’ の場合、入力構文は、たとえば ‘(str,
     int) -> List[str]’ のような PEP 484(3) の "シグネチャ型コメント
     (signature type comments)" に対応するように修正されます。

     Setting ‘feature_version’ to a tuple ‘(major, minor)’ will result
     in a "best-effort" attempt to parse using that Python version's
     grammar.  For example, setting ‘feature_version=(3, 9)’ will
     attempt to disallow parsing of *note match: a0e. statements.
     Currently ‘major’ must equal to ‘3’.  The lowest supported version
     is ‘(3, 7)’ (and this may increase in future Python versions); the
     highest is ‘sys.version_info[0:2]’.  "Best-effort" attempt means
     there is no guarantee that the parse (or success of the parse) is
     the same as when run on the Python version corresponding to
     ‘feature_version’.

     If source contains a null character (‘\0’), *note ValueError: 2ec.
     is raised.

          警告: Note that successfully parsing source code into an AST
          object doesn't guarantee that the source code provided is
          valid Python code that can be executed as the compilation step
          can raise further *note SyntaxError: 18e. exceptions.  For
          instance, the source ‘return 42’ generates a valid AST node
          for a return statement, but it cannot be compiled alone (it
          needs to be inside a function node).

          In particular, *note ast.parse(): 1c2. won't do any scoping
          checks, which the compilation step does.

          警告: 十分に大きい文字列や複雑な文字列によって Python の抽象構
          文木コンパイラのスタックの深さの限界を越えることで、 Python イ
          ンタプリタをクラッシュさせることができます。

     バージョン 3.8 で変更: ‘type_comments’、‘mode='func_type'’、
     ‘feature_version’ が追加されました。

     バージョン 3.13 で変更: The minimum supported version for
     ‘feature_version’ is now ‘(3, 7)’.  The ‘optimize’ argument was
     added.

 -- の関数: ast.unparse (ast_obj)

     *note ast.AST: 4c3. オブジェクトを逆に構文解析して、 *note
     ast.parse(): 1c2. が元の *note ast.AST: 4c3. と等価なオブジェクトを
     生成できるような文字列を生成します。

          警告: 生成されたコード文字列は、生成元のコードである *note
          ast.AST: 4c3. オブジェクトと必ずしも等価であるとは限りません
          (定数タプルや frozenset などに対するコンパイラ最適化なしのコー
          ドです)。

          警告: 非常に複雑な式を逆構文解析すると *note RecursionError:
          f68. となることがあります。

     Added in version 3.9.

 -- の関数: ast.literal_eval (node_or_string)

     Python のリテラルやコンテナ表現のみを含む式ノードまたは文字列を評価
     します。与えられる文字列またはノードは次の Python リテラル構造のみ
     からなるものに限られます: 文字列、バイト列、数、タプル、リスト、辞
     書、集合、ブール値、‘None’、‘Ellipsis’。

     この関数は Python の式を含んだ文字列を、値自身を解析することなしに
     評価するのに使えます。この関数は、例えば演算や添え字を含んだ任意の
     複雑な表現を評価するのには使えません。

     This function had been documented as "safe" in the past without
     defining what that meant.  That was misleading.  This is
     specifically designed not to execute Python code, unlike the more
     general *note eval(): 4a3.  There is no namespace, no name lookups,
     or ability to call out.  But it is not free from attack: A
     relatively small input can lead to memory exhaustion or to C stack
     exhaustion, crashing the process.  There is also the possibility
     for excessive CPU consumption denial of service on some inputs.
     Calling it on untrusted data is thus not recommended.

          警告: Python の抽象構文木コンパイラのスタックの深さの限界を越
          えることで、 Python インタプリタをクラッシュさせる可能性があり
          ます。

          It can raise *note ValueError: 2ec, *note TypeError: 198,
          *note SyntaxError: 18e, *note MemoryError: 179e. and *note
          RecursionError: f68. depending on the malformed input.

     バージョン 3.2 で変更: バイト列リテラルと集合リテラルが受け取れるよ
     うになりました。

     バージョン 3.9 で変更: ‘'set()'’ による空の集合の生成をサポートする
     ようになりました。

     バージョン 3.10 で変更: For string inputs, leading spaces and tabs
     are now stripped.

 -- の関数: ast.get_docstring (node, clean=True)

     与えられた 'node' (これは *note FunctionDef: 1a78, *note
     AsyncFunctionDef: 1a77, *note ClassDef: 1a76, *note Module: 4b7a. の
     いずれかのノードでなければなりません) のドキュメント文字列を返しま
     す。もしドキュメント文字列が無ければ ‘None’ を返します。 'clean' が
     真ならば、ドキュメント文字列のインデントを *note
     inspect.cleandoc(): 1a2c. を用いて一掃します。

     バージョン 3.5 で変更: *note AsyncFunctionDef: 1a77. がサポートされ
     ました。

 -- の関数: ast.get_source_segment (source, node, *, padded=False)

     Get source code segment of the 'source' that generated 'node'.  If
     some location information (*note lineno: 4b74, *note end_lineno:
     4b76, *note col_offset: 4b75, or *note end_col_offset: 4b77.) is
     missing, return ‘None’.

     'padded' が ‘True’ の場合、複数行にわたる文の最初の行が元の位置に一
     致するように空白文字でパディングされます。

     Added in version 3.8.

 -- の関数: ast.fix_missing_locations (node)

     When you compile a node tree with *note compile(): 4b1, the
     compiler expects *note lineno: 4b74. and *note col_offset: 4b75.
     attributes for every node that supports them.  This is rather
     tedious to fill in for generated nodes, so this helper adds these
     attributes recursively where not already set, by setting them to
     the values of the parent node.  It works recursively starting at
     'node'.

 -- の関数: ast.increment_lineno (node, n=1)

     'node' で始まるツリー内の各ノードの行番号と終了行番号を 'n' ずつ増
     やします。これはファイルの中で別の場所に "コードを移動する" ときに
     便利です。

 -- の関数: ast.copy_location (new_node, old_node)

     Copy source location (*note lineno: 4b74, *note col_offset: 4b75,
     *note end_lineno: 4b76, and *note end_col_offset: 4b77.) from
     'old_node' to 'new_node' if possible, and return 'new_node'.

 -- の関数: ast.iter_fields (node)

     'node' にある ‘node._fields’ のそれぞれのフィールドを ‘(フィールド
     名, 値)’ のタプルとして yield します。

 -- の関数: ast.iter_child_nodes (node)

     'node' の直接の子ノード全てを yield します。すなわち、yield される
     のは、ノードであるような全てのフィールドおよびノードのリストである
     ようなフィールドの全てのアイテムです。

 -- の関数: ast.walk (node)

     'node' の全ての子孫ノード('node' 自体を含む)を再帰的に yield します
     。順番は決められていません。この関数はノードをその場で変更するだけ
     で文脈を気にしないような場合に便利です。

 -- クラス: ast.NodeVisitor

     抽象構文木を渡り歩いてビジター関数を見つけたノードごとに呼び出すノ
     ード・ビジターの基底クラスです。この関数は *note visit(): 4bd5. メ
     ソッドに送られる値を返してもかまいません。

     このクラスはビジター・メソッドを付け加えたサブクラスを派生させるこ
     とを意図しています。

      -- メソッド: visit (node)

          ノードを訪れます。デフォルトの実装では ‘self.visit_CLASSNAME’
          というメソッド (ここで 'classname' はノードのクラス名です) を
          呼び出すか、そのメソッドがなければ *note generic_visit():
          4bd6. を呼び出します。

      -- メソッド: generic_visit (node)

          このビジターはノードの全ての子について *note visit(): 4bd5. を
          呼び出します。

          注意して欲しいのは、専用のビジター・メソッドを具えたノードの子
          ノードは、このビジターが *note generic_visit(): 4bd6. を呼び出
          すかそれ自身で子ノードを訪れない限り訪れられないということです
          。

      -- メソッド: visit_Constant (node)

          Handles all constant nodes.

     トラバースの途中でノードを変化させたいならば *note NodeVisitor:
     2f0. を使ってはいけません。そうした目的のために変更を許す特別なビジ
     ター (*note NodeTransformer: 4bd7.) があります。

     Deprecated since version 3.8, removed in version 3.14: Methods
     ‘visit_Num()’, ‘visit_Str()’, ‘visit_Bytes()’,
     ‘visit_NameConstant()’ and ‘visit_Ellipsis()’ will not be called in
     Python 3.14+.  Add the *note visit_Constant(): c63. method instead
     to handle all constant nodes.

 -- クラス: ast.NodeTransformer

     *note NodeVisitor: 2f0. のサブクラスで抽象構文木を渡り歩きながらノ
     ードを変更することを許すものです。

     *note NodeTransformer: 4bd7. は抽象構文木(AST)を渡り歩き、ビジター
     ・メソッドの戻り値を使って古いノードを置き換えたり削除したりします
     。ビジター・メソッドの戻り値が ‘None’ ならば、ノードはその場から取
     り去られ、そうでなければ戻り値で置き換えられます。置き換えない場合
     は戻り値が元のノードそのものであってもかまいません。

     それでは例を示しましょう。Name (たとえば ‘foo’) を見つけるたび全て
     ‘data['foo']’ に書き換える変換器 (transformer) です:

          class RewriteName(NodeTransformer):

              def visit_Name(self, node):
                  return Subscript(
                      value=Name(id='data', ctx=Load()),
                      slice=Constant(value=node.id),
                      ctx=node.ctx
                  )

     Keep in mind that if the node you're operating on has child nodes
     you must either transform the child nodes yourself or call the
     *note generic_visit(): 4bd6. method for the node first.

     文のコレクションであるようなノード (全ての文のノードが当てはまりま
     す) に対して、このビジターは単独のノードではなくノードのリストを返
     すかもしれません。

     If *note NodeTransformer: 4bd7. introduces new nodes (that weren't
     part of original tree) without giving them location information
     (such as *note lineno: 4b74.), *note fix_missing_locations(): 4bd0.
     should be called with the new sub-tree to recalculate the location
     information:

          tree = ast.parse('foo', mode='eval')
          new_tree = fix_missing_locations(RewriteName().visit(tree))

     たいてい、変換器の使い方は次のようになります:

          node = YourTransformer().visit(node)

 -- の関数: ast.dump (node, annotate_fields=True,
          include_attributes=False, *, indent=None, show_empty=False)

     'node' 内のツリーのフォーマットされたダンプを返します。主な使い道は
     デバッグです。 'annotate_fields' が true の場合 (デフォルト)、返さ
     れる文字列はフィールドの名前と値を示します。 'annotate_fields' が
     false の場合、あいまいさのないフィールド名を省略することにより、結
     果文字列はよりコンパクトになります。行番号や列オフセットのような属
     性はデフォルトではダンプされません。これが必要であれば、
     'include_attributes' を true にすると表示できます。

     'indent' が非負の整数または文字列の場合、ツリーは指定されたインデン
     トレベルで整形されて出力されます (pretty-printed)。インデントレベル
     がゼロ、負の数、または ‘""’ の場合は改行だけを挿入します。 ‘None’
     (デフォルト値) は単一行での表記になります。正の整数を指定すると各イ
     ンデントレベルでその数だけの空白でインデントされます。 'indent' が
     文字列 (‘"\t"’ など) の場合、その文字列が各レベルのインデントに使わ
     れます。

     If 'show_empty' is false (the default), optional empty lists will
     be omitted from the output.  Optional ‘None’ values are always
     omitted.

     バージョン 3.9 で変更: 'indent' オプションを追加しました。

     バージョン 3.13 で変更: Added the 'show_empty' option.

          >>> print(ast.dump(ast.parse("""\
          ... async def f():
          ...     await other_func()
          ... """), indent=4, show_empty=True))
          Module(
              body=[
                  AsyncFunctionDef(
                      name='f',
                      args=arguments(
                          posonlyargs=[],
                          args=[],
                          kwonlyargs=[],
                          kw_defaults=[],
                          defaults=[]),
                      body=[
                          Expr(
                              value=Await(
                                  value=Call(
                                      func=Name(id='other_func', ctx=Load()),
                                      args=[],
                                      keywords=[])))],
                      decorator_list=[],
                      type_params=[])],
              type_ignores=[])

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/

   (2) https://peps.python.org/pep-0526/

   (3) https://peps.python.org/pep-0484/


File: python.info,  Node: Compiler flags<2>,  Next: コマンドラインでの使用<8>,  Prev: ast helpers,  Up: ast --- Abstract syntax trees

5.32.1.18 Compiler flags
........................

以下のフラグはプログラムのコンパイルにおける効果を変更するために *note
compile(): 4b1. に渡すことができます:

 -- データ: ast.PyCF_ALLOW_TOP_LEVEL_AWAIT

     トップレベルの ‘await’, ‘async for’, ‘async with’ および async 内包
     表記のサポートを有効化します。

     Added in version 3.8.

 -- データ: ast.PyCF_ONLY_AST

     コンパイルされたコードオブジェクトの代わりに抽象構文木を生成して返
     します。

 -- データ: ast.PyCF_OPTIMIZED_AST

     The returned AST is optimized according to the 'optimize' argument
     in *note compile(): 4b1. or *note ast.parse(): 1c2.

     Added in version 3.13.

 -- データ: ast.PyCF_TYPE_COMMENTS

     PEP 484(1) および PEP 526(2) 形式の型コメント (‘# type: <type>’, ‘#
     type: ignore <stuff>’) のサポートを有効化します。

     Added in version 3.8.

 -- の関数: ast.compare (a, b, /, *, compare_attributes=False)

     Recursively compares two ASTs.

     'compare_attributes' affects whether AST attributes are considered
     in the comparison.  If 'compare_attributes' is ‘False’ (default),
     then attributes are ignored.  Otherwise they must all be equal.
     This option is useful to check whether the ASTs are structurally
     equal but differ in whitespace or similar details.  Attributes
     include line numbers and column offsets.

     Added in version 3.14.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/

   (2) https://peps.python.org/pep-0526/


File: python.info,  Node: コマンドラインでの使用<8>,  Prev: Compiler flags<2>,  Up: ast --- Abstract syntax trees

5.32.1.19 コマンドラインでの使用
................................

Added in version 3.9.

The ‘ast’ module can be executed as a script from the command line.  It
is as simple as:

     python -m ast [-m <mode>] [-a] [infile]

以下のオプションが使用できます:

 -- Option: -h, --help

     ヘルプメッセージを表示して終了します。

 -- Option: -m <mode>
 -- Option: --mode <mode>

     *note parse(): 1c2. 関数の 'mode' 引数と同様、コンパイルするコード
     の種類を指定します。

 -- Option: --no-type-comments

     型コメントをパースしません。

 -- Option: -a, --include-attributes

     行番号や列オフセットなどの属性を含めます。

 -- Option: -i <indent>
 -- Option: --indent <indent>

     AST におけるノードのインデント (空白の数) です。

 -- Option: --feature-version <version>

     Python version in the format 3.x (for example, 3.10).  Defaults to
     the current version of the interpreter.

     Added in version 3.14.

 -- Option: -O <level>
 -- Option: --optimize <level>

     Optimization level for parser.  Defaults to no optimization.

     Added in version 3.14.

 -- Option: --show-empty

     Show empty lists and fields that are ‘None’.  Defaults to not
     showing empty objects.

     Added in version 3.14.

‘infile’ を指定するとその内容が AST にパースされて標準出力に出力されます
。そうでない場合は標準入力から入力を読み込みます。

参考
....

外部ドキュメント Green Tree Snakes(1) には Python AST についての詳細が書
かれています。

ASTTokens(2) は Python AST を、生成元のソースコードのトークン位置やテキ
ストで注解します。これはソースコード変換を行うツールで有用です。

leoAst.py(3) unifies the token-based and parse-tree-based views of
python programs by inserting two-way links between tokens and ast nodes.

LibCST(4) はコードを ast ツリーに似た構文木 (Concrete Syntax Tree) にパ
ースし、かつ全ての書式設定の詳細を保持します。これは自動リファクタリング
アプリケーション (codemod) やリンタを作成する際に有用です。

Parso(5) is a Python parser that supports error recovery and round-trip
parsing for different Python versions (in multiple Python versions).
Parso is also able to list multiple syntax errors in your Python file.

   ---------- Footnotes ----------

   (1) https://greentreesnakes.readthedocs.io/

   (2) https://asttokens.readthedocs.io/en/latest/user-guide.html

   (3) https://leo-editor.github.io/leo-editor/appendices.html#leoast-py

   (4) https://libcst.readthedocs.io/

   (5) https://parso.readthedocs.io


File: python.info,  Node: symtable --- コンパイラーの記号表へのアクセス,  Next: token --- Python 解析木で使われる定数,  Prev: ast --- Abstract syntax trees,  Up: Python言語サービス

5.32.2 ‘symtable’ -- コンパイラーの記号表へのアクセス
-----------------------------------------------------

'ソースコード:' Lib/symtable.py(1)

__________________________________________________________________

Symbol tables are generated by the compiler from AST just before
bytecode is generated.  The symbol table is responsible for calculating
the scope of every identifier in the code.  ‘symtable’ provides an
interface to examine these tables.

* Menu:

* 記号表の生成::
* 記号表の検査::
* コマンドラインからの使用: コマンドラインからの使用<3>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/symtable.py


File: python.info,  Node: 記号表の生成,  Next: 記号表の検査,  Up: symtable --- コンパイラーの記号表へのアクセス

5.32.2.1 記号表の生成
.....................

 -- の関数: symtable.symtable (code, filename, compile_type)

     Python ソース 'code' に対するトップレベルの *note SymbolTable:
     4beb. を返します。 'filename' はコードを収めてあるファイルの名前で
     す。 'compile_type' は *note compile(): 4b1. の 'mode' 引数のような
     ものです。


File: python.info,  Node: 記号表の検査,  Next: コマンドラインからの使用<3>,  Prev: 記号表の生成,  Up: symtable --- コンパイラーの記号表へのアクセス

5.32.2.2 記号表の検査
.....................

 -- クラス: symtable.SymbolTableType

     An enumeration indicating the type of a *note SymbolTable: 4beb.
     object.

      -- の属性: MODULE = "module"

          Used for the symbol table of a module.

      -- の属性: FUNCTION = "function"

          Used for the symbol table of a function.

      -- の属性: CLASS = "class"

          Used for the symbol table of a class.

     The following members refer to different flavors of *note
     annotation scopes: 4ab.

      -- の属性: ANNOTATION = "annotation"

          Used for annotations if ‘from __future__ import annotations’
          is active.

      -- の属性: TYPE_ALIAS = "type alias"

          Used for the symbol table of *note type: 66d. constructions.

      -- の属性: TYPE_PARAMETERS = "type parameters"

          Used for the symbol table of *note generic functions: 682. or
          *note generic classes: 2377.

      -- の属性: TYPE_VARIABLE = "type variable"

          Used for the symbol table of the bound, the constraint tuple
          or the default value of a single type variable in the formal
          sense, i.e., a TypeVar, a TypeVarTuple or a ParamSpec object
          (the latter two do not support a bound or a constraint tuple).

     Added in version 3.13.

 -- クラス: symtable.SymbolTable

     ブロックに対する名前空間の記号表。コンストラクタはパブリックではあ
     りません。

      -- メソッド: get_type ()

          Return the type of the symbol table.  Possible values are
          members of the *note SymbolTableType: 1952. enumeration.

          バージョン 3.12 で変更: Added ‘'annotation'’, ‘'TypeVar
          bound'’, ‘'type alias'’, and ‘'type parameter'’ as possible
          return values.

          バージョン 3.13 で変更: Return values are members of the *note
          SymbolTableType: 1952. enumeration.

          The exact values of the returned string may change in the
          future, and thus, it is recommended to use *note
          SymbolTableType: 1952. members instead of hard-coded strings.

      -- メソッド: get_id ()

          記号表の識別子を返します。

      -- メソッド: get_name ()

          Return the table's name.  This is the name of the class if the
          table is for a class, the name of the function if the table is
          for a function, or ‘'top'’ if the table is global (*note
          get_type(): 1953. returns ‘'module'’).  For type parameter
          scopes (which are used for generic classes, functions, and
          type aliases), it is the name of the underlying class,
          function, or type alias.  For type alias scopes, it is the
          name of the type alias.  For *note TypeVar: 486. bound scopes,
          it is the name of the ‘TypeVar’.

      -- メソッド: get_lineno ()

          この記号表に対応するブロックの一行目の行番号を返します。

      -- メソッド: is_optimized ()

          この記号表に含まれるローカル変数が最適化できるならば ‘True’ を
          返します。

      -- メソッド: is_nested ()

          ブロックが入れ子のクラスまたは関数のとき ‘True’ を返します。

      -- メソッド: has_children ()

          ブロックが入れ子の名前空間を含んでいるならば ‘True’ を返します
          。入れ子の名前空間は *note get_children(): 4bfa. で得られます
          。

      -- メソッド: get_identifiers ()

          Return a view object containing the names of symbols in the
          table.  See the *note documentation of view objects: 2618.

      -- メソッド: lookup (name)

          記号表から名前 'name' を見つけ出して *note Symbol: 289. インス
          タンスとして返します。

      -- メソッド: get_symbols ()

          記号表中の名前を表す *note Symbol: 289. インスタンスのリストを
          返します。

      -- メソッド: get_children ()

          入れ子になった記号表のリストを返します。

 -- クラス: symtable.Function

     A namespace for a function or method.  This class inherits from
     *note SymbolTable: 4beb.

      -- メソッド: get_parameters ()

          この関数の引数名からなるタプルを返します。

      -- メソッド: get_locals ()

          この関数のローカル変数の名前からなるタプルを返します。

      -- メソッド: get_globals ()

          この関数のグローバル変数の名前からなるタプルを返します。

      -- メソッド: get_nonlocals ()

          Return a tuple containing names of explicitly declared
          nonlocals in this function.

      -- メソッド: get_frees ()

          Return a tuple containing names of *note free (closure)
          variables: 1893. in this function.

 -- クラス: symtable.Class

     A namespace of a class.  This class inherits from *note
     SymbolTable: 4beb.

      -- メソッド: get_methods ()

          Return a tuple containing the names of method-like functions
          declared in the class.

          Here, the term 'method' designates 'any' function defined in
          the class body via *note def: 1673. or *note async def: 7ed.

          Functions defined in a deeper scope (e.g., in an inner class)
          are not picked up by *note get_methods(): 31d.

          例えば:

               >>> import symtable
               >>> st = symtable.symtable('''
               ... def outer(): pass
               ...
               ... class A:
               ...    def f():
               ...        def w(): pass
               ...
               ...    def g(self): pass
               ...
               ...    @classmethod
               ...    async def h(cls): pass
               ...
               ...    global outer
               ...    def outer(self): pass
               ... ''', 'test', 'exec')
               >>> class_A = st.get_children()[2]
               >>> class_A.get_methods()
               ('f', 'g', 'h')

          Although ‘A().f()’ raises *note TypeError: 198. at runtime,
          ‘A.f’ is still considered as a method-like function.

          Deprecated since version 3.14, will be removed in version
          3.16.

 -- クラス: symtable.Symbol

     *note SymbolTable: 4beb. のエントリーでソースの識別子に対応するもの
     です。コンストラクタはパブリックではありません。

      -- メソッド: get_name ()

          記号の名前を返します。

      -- メソッド: is_referenced ()

          記号がそのブロックの中で使われていれば ‘True’ を返します。

      -- メソッド: is_imported ()

          記号が import 文で作られたものならば ‘True’ を返します。

      -- メソッド: is_parameter ()

          記号がパラメータならば ‘True’ を返します。

      -- メソッド: is_type_parameter ()

          Return ‘True’ if the symbol is a type parameter.

          Added in version 3.14.

      -- メソッド: is_global ()

          記号がグローバルならば ‘True’ を返します。

      -- メソッド: is_nonlocal ()

          記号が非ローカルならば ‘True’ を返します。

      -- メソッド: is_declared_global ()

          記号が global 文によってグローバルであると宣言されているなら
          ‘True’ を返します。

      -- メソッド: is_local ()

          記号がそのブロックに対してローカルならば ‘True’ を返します。

      -- メソッド: is_annotated ()

          記号が注釈付きならば ‘True’ を返します。

          Added in version 3.6.

      -- メソッド: is_free ()

          記号がそのブロックの中で参照されていて、しかし代入は行われない
          ならば ‘True’ を返します。

      -- メソッド: is_free_class ()

          Return 'True' if a class-scoped symbol is free from the
          perspective of a method.

          次に示す例について考えてみてください。:

               def f():
                   x = 1  # function-scoped
                   class C:
                       x = 2  # class-scoped
                       def method(self):
                           return x

          In this example, the class-scoped symbol ‘x’ is considered to
          be free from the perspective of ‘C.method’, thereby allowing
          the latter to return '1' at runtime and not '2'.

          Added in version 3.14.

      -- メソッド: is_assigned ()

          記号がそのブロックの中で代入されているならば ‘True’ を返します
          。

      -- メソッド: is_comp_iter ()

          Return ‘True’ if the symbol is a comprehension iteration
          variable.

          Added in version 3.14.

      -- メソッド: is_comp_cell ()

          Return ‘True’ if the symbol is a cell in an inlined
          comprehension.

          Added in version 3.14.

      -- メソッド: is_namespace ()

          名前の束縛が新たな名前空間を導入するならば ‘True’ を返します。

          名前が関数または class 文のターゲットとして使われるならば、真
          です。

          例えば:

               >>> table = symtable.symtable("def some_func(): pass", "string", "exec")
               >>> table.lookup("some_func").is_namespace()
               True

          一つの名前が複数のオブジェクトに束縛されうることに注意しましょ
          う。結果が ‘True’ であったとしても、その名前は他のオブジェクト
          にも束縛されるかもしれず、それがたとえば整数やリストであれば、
          そこでは新たな名前空間は導入されません。

      -- メソッド: get_namespaces ()

          この名前に束縛された名前空間のリストを返します。

      -- メソッド: get_namespace ()

          この名前に束縛された名前空間を返します。この名前に束縛された名
          前空間が複数あるか一つもないなら *note ValueError: 2ec. が送出
          されます。


File: python.info,  Node: コマンドラインからの使用<3>,  Prev: 記号表の検査,  Up: symtable --- コンパイラーの記号表へのアクセス

5.32.2.3 コマンドラインからの使用
.................................

Added in version 3.13.

The ‘symtable’ module can be executed as a script from the command line.

     python -m symtable [infile...]

Symbol tables are generated for the specified Python source files and
dumped to stdout.  If no input file is specified, the content is read
from stdin.


File: python.info,  Node: token --- Python 解析木で使われる定数,  Next: keyword --- Python キーワードのテスト,  Prev: symtable --- コンパイラーの記号表へのアクセス,  Up: Python言語サービス

5.32.3 ‘token’ -- Python 解析木で使われる定数
---------------------------------------------

'ソースコード:' Lib/token.py(1)

__________________________________________________________________

このモジュールは解析木の葉ノード(終端記号)の数値を表す定数を提供します。
言語の文法のコンテキストにおける名前の定義については、 Python ディストリ
ビューションのファイル file:‘Grammar/Tokens’ を参照してください。名前が
マップする特定の数値は Python のバージョン間で変わります。

このモジュールは、数値コードから名前へのマッピングと、いくつかの関数も提
供しています。関数は Python の C ヘッダファイルの定義を反映します。

Note that a token's value may depend on tokenizer options.  For example,
a ‘"+"’ token may be reported as either *note PLUS: 4c16. or *note OP:
228a, or a ‘"match"’ token may be either *note NAME: 22b9. or *note
SOFT_KEYWORD: 4c17.

 -- データ: token.tok_name

     ディクショナリはこのモジュールで定義されている定数の数値を名前の文
     字列へマップし、より人が読みやすいように解析木を表現します。

 -- の関数: token.ISTERMINAL (x)

     終端トークンの値に対して ‘True’ を返します。

 -- の関数: token.ISNONTERMINAL (x)

     非終端トークンの値に対して ‘True’ を返します。

 -- の関数: token.ISEOF (x)

     'x' が入力の終わりを示すマーカーならば、 ‘True’ を返します。

token の定数一覧:

 -- データ: token.NAME

     Token value that indicates an *note identifier or keyword: 22a0.

 -- データ: token.NUMBER

     Token value that indicates a *note numeric literal: 22a1.

 -- データ: token.STRING

     Token value that indicates a *note string or byte literal: 229f,
     excluding *note formatted string literals: 19a.  The token string
     is not interpreted: it includes the surrounding quotation marks and
     the prefix (if given); backslashes are included literally, without
     processing escape sequences.

 -- データ: token.OP

     A generic token value that indicates an *note operator: 228c. or
     *note delimiter: 228b.

     'CPython 実装の詳細:' This value is only reported by the *note
     tokenize: 101. module.  Internally, the tokenizer uses *note exact
     token types: 231e. instead.

 -- データ: token.COMMENT

     Token value used to indicate a comment.  The parser ignores
     ‘COMMENT’ tokens.

 -- データ: token.NEWLINE

     Token value that indicates the end of a *note logical line: 22a5.

 -- データ: token.NL

     Token value used to indicate a non-terminating newline.  ‘NL’
     tokens are generated when a logical line of code is continued over
     multiple physical lines.  The parser ignores ‘NL’ tokens.

 -- データ: token.INDENT

     Token value used at the beginning of a *note logical line: 22a5. to
     indicate the start of an *note indented block: 229c.

 -- データ: token.DEDENT

     Token value used at the beginning of a *note logical line: 22a5. to
     indicate the end of an *note indented block: 229c.

 -- データ: token.FSTRING_START

     Token value used to indicate the beginning of an *note f-string
     literal: 19a.

     'CPython 実装の詳細:' The token string includes the prefix and the
     opening quote(s), but none of the contents of the literal.

 -- データ: token.FSTRING_MIDDLE

     Token value used for literal text inside an *note f-string literal:
     19a, including format specifications.

     'CPython 実装の詳細:' Replacement fields (that is, the non-literal
     parts of f-strings) use the same tokens as other expressions, and
     are delimited by *note LBRACE: 4c1e, *note RBRACE: 4c1f, *note
     EXCLAMATION: 4c20. and *note COLON: 4c21. tokens.

 -- データ: token.FSTRING_END

     Token value used to indicate the end of a *note f-string: 19a.

     'CPython 実装の詳細:' The token string contains the closing
     quote(s).

 -- データ: token.TSTRING_START

     Token value used to indicate the beginning of a template string
     literal.

     'CPython 実装の詳細:' The token string includes the prefix and the
     opening quote(s), but none of the contents of the literal.

     Added in version 3.14.

 -- データ: token.TSTRING_MIDDLE

     Token value used for literal text inside a template string literal
     including format specifications.

     'CPython 実装の詳細:' Replacement fields (that is, the non-literal
     parts of t-strings) use the same tokens as other expressions, and
     are delimited by *note LBRACE: 4c1e, *note RBRACE: 4c1f, *note
     EXCLAMATION: 4c20. and *note COLON: 4c21. tokens.

     Added in version 3.14.

 -- データ: token.TSTRING_END

     Token value used to indicate the end of a template string literal.

     'CPython 実装の詳細:' The token string contains the closing
     quote(s).

     Added in version 3.14.

 -- データ: token.ENDMARKER

     Token value that indicates the end of input.  Used in *note
     top-level grammar rules: 259a.

 -- データ: token.ENCODING

     ソースの bytes をテキストにデコードするために使われるエンコーディン
     グを示すトークン値。*note tokenize.tokenize(): 700. は常に最初に
     ENCODING トークンを返します。

     'CPython 実装の詳細:' This token type isn't used by the C tokenizer
     but is needed for the *note tokenize: 101. module.

The following token types are not produced by the *note tokenize: 101.
module, and are defined for special uses in the tokenizer or parser:

 -- データ: token.TYPE_IGNORE

     Token value indicating that a ‘type: ignore’ comment was
     recognized.  Such tokens are produced instead of regular *note
     COMMENT: 4c1c. tokens only with the *note PyCF_TYPE_COMMENTS: 4bcf.
     flag.

 -- データ: token.TYPE_COMMENT

     Token value indicating that a type comment was recognized.  Such
     tokens are produced instead of regular *note COMMENT: 4c1c. tokens
     only with the *note PyCF_TYPE_COMMENTS: 4bcf. flag.

 -- データ: token.SOFT_KEYWORD

     Token value indicating a *note soft keyword: a0d.

     The tokenizer never produces this value.  To check for a soft
     keyword, pass a *note NAME: 22b9. token's string to *note
     keyword.issoftkeyword(): 4c28.

 -- データ: token.ERRORTOKEN

     Token value used to indicate wrong input.

     The *note tokenize: 101. module generally indicates errors by
     raising exceptions instead of emitting this token.  It can also
     emit tokens such as *note OP: 228a. or *note NAME: 22b9. with
     strings that are later rejected by the parser.
The remaining tokens represent specific *note operators: 228c. and *note
delimiters: 228b.  (The *note tokenize: 101. module reports these as
*note OP: 228a.; see ‘exact_type’ in the *note tokenize: 101.
documentation for details.)

Token                                                  値
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
 -- データ: token.LPAR                                 ‘"("’
                                                       
                                                       
 -- データ: token.RPAR                                 ‘")"’
                                                       
                                                       
 -- データ: token.LSQB                                 ‘"["’
                                                       
                                                       
 -- データ: token.RSQB                                 ‘"]"’
                                                       
                                                       
 -- データ: token.COLON                                ‘":"’
                                                       
                                                       
 -- データ: token.COMMA                                ‘","’
                                                       
                                                       
 -- データ: token.SEMI                                 ‘";"’
                                                       
                                                       
 -- データ: token.PLUS                                 ‘"+"’
                                                       
                                                       
 -- データ: token.MINUS                                ‘"-"’
                                                       
                                                       
 -- データ: token.STAR                                 ‘"*"’
                                                       
                                                       
 -- データ: token.SLASH                                ‘"/"’
                                                       
                                                       
 -- データ: token.VBAR                                 ‘"|"’
                                                       
                                                       
 -- データ: token.AMPER                                ‘"&"’
                                                       
                                                       
 -- データ: token.LESS                                 ‘"<"’
                                                       
                                                       
 -- データ: token.GREATER                              ‘">"’
                                                       
                                                       
 -- データ: token.EQUAL                                ‘"="’
                                                       
                                                       
 -- データ: token.DOT                                  ‘"."’
                                                       
                                                       
 -- データ: token.PERCENT                              ‘"%"’
                                                       
                                                       
 -- データ: token.LBRACE                               ‘"{"’
                                                       
                                                       
 -- データ: token.RBRACE                               ‘"}"’
                                                       
                                                       
 -- データ: token.EQEQUAL                              ‘"=="’
                                                       
                                                       
 -- データ: token.NOTEQUAL                             ‘"!="’
                                                       
                                                       
 -- データ: token.LESSEQUAL                            ‘"<="’
                                                       
                                                       
 -- データ: token.GREATEREQUAL                         ‘">="’
                                                       
                                                       
 -- データ: token.TILDE                                ‘"~"’
                                                       
                                                       
 -- データ: token.CIRCUMFLEX                           ‘"^"’
                                                       
                                                       
 -- データ: token.LEFTSHIFT                            ‘"<<"’
                                                       
                                                       
 -- データ: token.RIGHTSHIFT                           ‘">>"’
                                                       
                                                       
 -- データ: token.DOUBLESTAR                           ‘"**"’
                                                       
                                                       
 -- データ: token.PLUSEQUAL                            ‘"+="’
                                                       
                                                       
 -- データ: token.MINEQUAL                             ‘"-="’
                                                       
                                                       
 -- データ: token.STAREQUAL                            ‘"*="’
                                                       
                                                       
 -- データ: token.SLASHEQUAL                           ‘"/="’
                                                       
                                                       
 -- データ: token.PERCENTEQUAL                         ‘"%="’
                                                       
                                                       
 -- データ: token.AMPEREQUAL                           ‘"&="’
                                                       
                                                       
 -- データ: token.VBAREQUAL                            ‘"|="’
                                                       
                                                       
 -- データ: token.CIRCUMFLEXEQUAL                      ‘"^="’
                                                       
                                                       
 -- データ: token.LEFTSHIFTEQUAL                       ‘"<<="’
                                                       
                                                       
 -- データ: token.RIGHTSHIFTEQUAL                      ‘">>="’
                                                       
                                                       
 -- データ: token.DOUBLESTAREQUAL                      ‘"**="’
                                                       
                                                       
 -- データ: token.DOUBLESLASH                          ‘"//"’
                                                       
                                                       
 -- データ: token.DOUBLESLASHEQUAL                     ‘"//="’
                                                       
                                                       
 -- データ: token.AT                                   ‘"@"’
                                                       
                                                       
 -- データ: token.ATEQUAL                              ‘"@="’
                                                       
                                                       
 -- データ: token.RARROW                               ‘"->"’
                                                       
                                                       
 -- データ: token.ELLIPSIS                             ‘"..."’
                                                       
                                                       
 -- データ: token.COLONEQUAL                           ‘":="’
                                                       
                                                       
 -- データ: token.EXCLAMATION                          ‘"!"’
                                                       

The following non-token constants are provided:

 -- データ: token.N_TOKENS

     The number of token types defined in this module.

 -- データ: token.EXACT_TOKEN_TYPES

     A dictionary mapping the string representation of a token to its
     numeric code.

     Added in version 3.8.

バージョン 3.5 で変更: Added ‘AWAIT’ and ‘ASYNC’ tokens.

バージョン 3.7 で変更: *note COMMENT: 4c1c. 、*note NL: 4c1d.、*note
ENCODING: 4c25. トークンが追加されました。

バージョン 3.7 で変更: Removed ‘AWAIT’ and ‘ASYNC’ tokens.  "async" and
"await" are now tokenized as *note NAME: 22b9. tokens.

バージョン 3.8 で変更: Added *note TYPE_COMMENT: 4c27, *note
TYPE_IGNORE: 4c26, *note COLONEQUAL: 4c54.  Added ‘AWAIT’ and ‘ASYNC’
tokens back (they're needed to support parsing older Python versions for
*note ast.parse(): 1c2. with ‘feature_version’ set to 6 or lower).

バージョン 3.12 で変更: Added *note EXCLAMATION: 4c20.

バージョン 3.13 で変更: Removed ‘AWAIT’ and ‘ASYNC’ tokens again.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/token.py


File: python.info,  Node: keyword --- Python キーワードのテスト,  Next: tokenize --- Python ソース用のトークナイザー,  Prev: token --- Python 解析木で使われる定数,  Up: Python言語サービス

5.32.4 ‘keyword’ -- Python キーワードのテスト
---------------------------------------------

'ソースコード:' Lib/keyword.py(1)

__________________________________________________________________

このモジュールでは、Python プログラムで文字列が *note キーワード: 2289.
や *note ソフトキーワード: a0d. か否かをチェックする機能を提供します。

 -- の関数: keyword.iskeyword (s)

     's' が Python の *note キーワード: 2289. であれば ‘True’ を返します
     。

 -- データ: keyword.kwlist

     インタープリタで定義している全ての *note キーワード: 2289. のシーケ
     ンス。特定の *note __future__: 0. 宣言がなければ有効ではないキーワ
     ードでもこのリストには含まれます。

 -- の関数: keyword.issoftkeyword (s)

     's' が Python の *note ソフトキーワード: a0d. であれば ‘True’ を返
     します。

     Added in version 3.9.

 -- データ: keyword.softkwlist

     インタープリタで定義している全ての *note ソフトキーワード: a0d. の
     シーケンス。特定の *note __future__: 0. 宣言がなければ有効ではない
     ソフトキーワードでもこのリストには含まれます。

     Added in version 3.9.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/keyword.py


File: python.info,  Node: tokenize --- Python ソース用のトークナイザー,  Next: tabnanny --- あいまいなインデントの検出,  Prev: keyword --- Python キーワードのテスト,  Up: Python言語サービス

5.32.5 ‘tokenize’ -- Python ソース用のトークナイザー
----------------------------------------------------

'ソースコード:' Lib/tokenize.py(1)

__________________________________________________________________

The ‘tokenize’ module provides a lexical scanner for Python source code,
implemented in Python.  The scanner in this module returns comments as
tokens as well, making it useful for implementing "pretty-printers",
including colorizers for on-screen displays.

トークン・ストリームの扱いをシンプルにするために、全ての *note operator:
228c. と *note delimiter: 228b. トークンおよび *note Ellipsis: 2328. は
ジェネリックな *note OP: 228a. トークンタイプとして返されます。正確な型
は *note tokenize.tokenize(): 700. が返す *note named tuple: 85e. の
‘exact_type’ プロパティをチェックすれば解ります。

     警告: Note that the functions in this module are only designed to
     parse syntactically valid Python code (code that does not raise
     when parsed using *note ast.parse(): 1c2.).  The behavior of the
     functions in this module is 'undefined' when providing invalid
     Python code and it can change at any point.

* Menu:

* 入力のトークナイズ::
* コマンドラインからの使用: コマンドラインからの使用<4>.
* 使用例: 使用例<50>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/tokenize.py


File: python.info,  Node: 入力のトークナイズ,  Next: コマンドラインからの使用<4>,  Up: tokenize --- Python ソース用のトークナイザー

5.32.5.1 入力のトークナイズ
...........................

第一のエントリポイントは *note ジェネレータ: 126c. です:

 -- の関数: tokenize.tokenize (readline)

     *note tokenize(): 700. ジェネレータは一つの引数 'readline' を必要と
     します。この引数は呼び出し可能オブジェクトで、ファイルオブジェクト
     の *note io.IOBase.readline(): 1541. メソッドと同じインタフェースを
     提供している必要があります。この関数は呼び出しのたびに入力の一行を
     bytes で返さなければなりません。

     このジェネレータは次の5要素のタプルを返します; トークンタイプ; トー
     クン文字列; ソース内でそのトークンがどの行、列で開始するかを示す
     int の ‘(srow, scol)’ タプル; どの行、列で終了するかを示す int の
     ‘(erow, ecol)’ タプル; トークンが見つかった行。 (タプルの最後の要素
     にある) 行は '物理' 行です。この5要素のタプルは *note named tuple:
     85e. として返され、フィールド名は ‘type string start end line’ にな
     ります。

     返される *note named tuple: 85e. は追加のプロパティ ‘exact_type’ を
     持ちます。このプロパティは *note OP: 228a. トークンに対して正確な演
     算子のタイプを持ちます。それ以外のトークンタイプについては、
     ‘exact_type’ は ‘type’ フィールドと同じ値を持ちます。

     バージョン 3.1 で変更: named tuple のサポートを追加。

     バージョン 3.3 で変更: ‘exact_type’ のサポートを追加。

     *note tokenize(): 700. は PEP 263(1) にしたがって、ソースのエンコー
     ディングを UTF-8 BOM か encoding cookie を見つけて決定します。

 -- の関数: tokenize.generate_tokens (readline)

     Tokenize a source reading unicode strings instead of bytes.

     Like *note tokenize(): 700, the 'readline' argument is a callable
     returning a single line of input.  However, *note
     generate_tokens(): 701. expects 'readline' to return a str object
     rather than bytes.

     The result is an iterator yielding named tuples, exactly like *note
     tokenize(): 700.  It does not yield an *note ENCODING: 4c25. token.

All constants from the *note token: 100. module are also exported from
‘tokenize’.

もう一つの関数がトークン化プロセスを逆転するために提供されています。これ
は、スクリプトを字句解析し、トークンのストリームに変更を加え、変更された
スクリプトを書き戻すようなツールを作成する際に便利です。

 -- の関数: tokenize.untokenize (iterable)

     トークンの列を Python ソースコードに変換します。 'iterable' は少な
     くとも二つの要素、トークンタイプおよびトークン文字列、からなるシー
     ケンスを返さなければいけません。 その他のシーケンスの要素は無視され
     ます。

     The result is guaranteed to tokenize back to match the input so
     that the conversion is lossless and round-trips are assured.  The
     guarantee applies only to the token type and token string as the
     spacing between tokens (column positions) may change.

     It returns bytes, encoded using the *note ENCODING: 4c25. token,
     which is the first token sequence output by *note tokenize(): 700.
     If there is no encoding token in the input, it returns a str
     instead.

*note tokenize(): 700. はトークナイズしようとしているソースファイルのエ
ンコーディングを検出する必要があります。これを行うために使っている関数が
公開されています:

 -- の関数: tokenize.detect_encoding (readline)

     *note detect_encoding(): 17b8. 関数は Python のソースファイルをデコ
     ードするのに使うエンコーディングを検出するために使われます。 *note
     tokenize(): 700. ジェネレータと同じ readline を引数として取ります。

     readline を最大2回呼び出し、利用するエンコーディング (文字列として)
     と、読み込んだ行を (bytes からデコードされないままの状態で) 返しま
     す。

     UTF-8 BOM か PEP 263(2) で定義されている encoding cookie からエンコ
     ーディングを検出します。BOMと cookie の両方が存在し、一致していない
     場合、*note SyntaxError: 18e. が送出されます。 BOM が見つかった場合
     はエンコーディングとして ‘'utf-8-sig'’ が返されます。

     エンコーディングが指定されていない場合、デフォルトの ‘'utf-8'’ が返
     されます。

     Python のソースファイルを開くには *note open(): 2cdf. を使ってくだ
     さい。これは *note detect_encoding(): 17b8. を利用してファイルエン
     コーディングを検出します。

 -- の関数: tokenize.open (filename)

     *note detect_encoding(): 17b8. を使って検出したエンコーディングを利
     用して、ファイルを読み出し専用モードで開きます。

     Added in version 3.2.

 -- 例外: tokenize.TokenError

     docstring や複数行にわたることが許される式がファイル内のどこかで終
     わっていない場合に送出されます。例えば:

          """Beginning of
          docstring

     もしくは:

          [1,
           2,
           3

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0263/

   (2) https://peps.python.org/pep-0263/


File: python.info,  Node: コマンドラインからの使用<4>,  Next: 使用例<50>,  Prev: 入力のトークナイズ,  Up: tokenize --- Python ソース用のトークナイザー

5.32.5.2 コマンドラインからの使用
.................................

Added in version 3.3.

The ‘tokenize’ module can be executed as a script from the command line.
It is as simple as:

     python -m tokenize [-e] [filename.py]

以下のオプションが使用できます:

 -- Option: -h, --help

     このヘルプメッセージを出力して終了します

 -- Option: -e, --exact

     exact type を使ってトークン名を表示します

‘filename.py’ が指定された場合、その内容がトークナイズされ stdout に出力
されます。指定されなかった場合は stdin からトークナイズします。


File: python.info,  Node: 使用例<50>,  Prev: コマンドラインからの使用<4>,  Up: tokenize --- Python ソース用のトークナイザー

5.32.5.3 使用例
...............

スクリプト書き換えの例で、浮動小数点数リテラルを Decimal オブジェクトに
変換します:

     from tokenize import tokenize, untokenize, NUMBER, STRING, NAME, OP
     from io import BytesIO

     def decistmt(s):
         """Substitute Decimals for floats in a string of statements.

         >>> from decimal import Decimal
         >>> s = 'print(+21.3e-5*-.1234/81.7)'
         >>> decistmt(s)
         "print (+Decimal ('21.3e-5')*-Decimal ('.1234')/Decimal ('81.7'))"

         The format of the exponent is inherited from the platform C library.
         Known cases are "e-007" (Windows) and "e-07" (not Windows).  Since
         we're only showing 12 digits, and the 13th isn't close to 5, the
         rest of the output should be platform-independent.

         >>> exec(s)  #doctest: +ELLIPSIS
         -3.21716034272e-0...7

         Output from calculations with Decimal should be identical across all
         platforms.

         >>> exec(decistmt(s))
         -3.217160342717258261933904529E-7
         """
         result = []
         g = tokenize(BytesIO(s.encode('utf-8')).readline)  # tokenize the string
         for toknum, tokval, _, _, _ in g:
             if toknum == NUMBER and '.' in tokval:  # replace NUMBER tokens
                 result.extend([
                     (NAME, 'Decimal'),
                     (OP, '('),
                     (STRING, repr(tokval)),
                     (OP, ')')
                 ])
             else:
                 result.append((toknum, tokval))
         return untokenize(result).decode('utf-8')

コマンドラインからトークナイズする例。次のスクリプトが:

     def say_hello():
         print("Hello, World!")

     say_hello()

トークナイズされて次のような出力になります。最初のカラムはトークンが現れ
た行／カラム、次のカラムはトークンの名前、最後のカラムは (あれば) トーク
ンの値です

     $ python -m tokenize hello.py
     0,0-0,0:            ENCODING       'utf-8'
     1,0-1,3:            NAME           'def'
     1,4-1,13:           NAME           'say_hello'
     1,13-1,14:          OP             '('
     1,14-1,15:          OP             ')'
     1,15-1,16:          OP             ':'
     1,16-1,17:          NEWLINE        '\n'
     2,0-2,4:            INDENT         '    '
     2,4-2,9:            NAME           'print'
     2,9-2,10:           OP             '('
     2,10-2,25:          STRING         '"Hello, World!"'
     2,25-2,26:          OP             ')'
     2,26-2,27:          NEWLINE        '\n'
     3,0-3,1:            NL             '\n'
     4,0-4,0:            DEDENT         ''
     4,0-4,9:            NAME           'say_hello'
     4,9-4,10:           OP             '('
     4,10-4,11:          OP             ')'
     4,11-4,12:          NEWLINE        '\n'
     5,0-5,0:            ENDMARKER      ''

トークンの exact_type 名は *note -e: 4c63. オプションで表示できます:

     $ python -m tokenize -e hello.py
     0,0-0,0:            ENCODING       'utf-8'
     1,0-1,3:            NAME           'def'
     1,4-1,13:           NAME           'say_hello'
     1,13-1,14:          LPAR           '('
     1,14-1,15:          RPAR           ')'
     1,15-1,16:          COLON          ':'
     1,16-1,17:          NEWLINE        '\n'
     2,0-2,4:            INDENT         '    '
     2,4-2,9:            NAME           'print'
     2,9-2,10:           LPAR           '('
     2,10-2,25:          STRING         '"Hello, World!"'
     2,25-2,26:          RPAR           ')'
     2,26-2,27:          NEWLINE        '\n'
     3,0-3,1:            NL             '\n'
     4,0-4,0:            DEDENT         ''
     4,0-4,9:            NAME           'say_hello'
     4,9-4,10:           LPAR           '('
     4,10-4,11:          RPAR           ')'
     4,11-4,12:          NEWLINE        '\n'
     5,0-5,0:            ENDMARKER      ''

Example of tokenizing a file programmatically, reading unicode strings
instead of bytes with *note generate_tokens(): 701.:

     import tokenize

     with tokenize.open('hello.py') as f:
         tokens = tokenize.generate_tokens(f.readline)
         for token in tokens:
             print(token)

Or reading bytes directly with *note tokenize(): 700.:

     import tokenize

     with open('hello.py', 'rb') as f:
         tokens = tokenize.tokenize(f.readline)
         for token in tokens:
             print(token)


File: python.info,  Node: tabnanny --- あいまいなインデントの検出,  Next: pyclbr --- Python モジュールブラウザーサポート,  Prev: tokenize --- Python ソース用のトークナイザー,  Up: Python言語サービス

5.32.6 ‘tabnanny’ -- あいまいなインデントの検出
-----------------------------------------------

'ソースコード:' Lib/tabnanny.py(1)

__________________________________________________________________

差し当たり、このモジュールはスクリプトとして呼び出すことを意図しています
。しかし、IDE 上にインポートして下で説明する関数 *note check(): 4c69. を
使うことができます。

     注釈: このモジュールが提供する API を将来のリリースで変更する確率が
     高いです。このような変更は後方互換性がないかもしれません。

 -- の関数: tabnanny.check (file_or_dir)

     'file_or_dir' がディレクトリであってシンボリックリンクでないときに
     、 'file_or_dir' という名前のディレクトリツリーを再帰的に下って行き
     、この通り道に沿ってすべての ‘.py’ ファイルをチェックします。
     'file_or_dir' が通常の Python ソースファイルの場合には、問題のある
     空白をチェックします。診断メッセージは *note print(): 1177. 関数を
     使って標準出力に書き込まれます。

 -- データ: tabnanny.verbose

     冗長なメッセージをプリントするかどうかを示すフラグ。スクリプトとし
     て呼び出された場合は、‘-v’ オプションによって増加します。

 -- データ: tabnanny.filename_only

     問題のある空白を含むファイルのファイル名のみをプリントするかどうか
     を示すフラグ。スクリプトとして呼び出された場合は、‘-q’ オプションに
     よって真に設定されます。

 -- 例外: tabnanny.NannyNag

     あいまいなインデントを検出した場合に *note process_tokens(): 4c6d.
     が送出します。 この例外は *note check(): 4c69. で捕捉され処理されま
     す。

 -- の関数: tabnanny.process_tokens (tokens)

     この関数は、 *note tokenize: 101. モジュールによって生成されたトー
     クンを *note check(): 4c69. が処理するために使われます。

参考
....

*note tokenize: 101. モジュール

     Pythonソースコードの字句解析器。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/tabnanny.py


File: python.info,  Node: pyclbr --- Python モジュールブラウザーサポート,  Next: py_compile --- Python ソースファイルをコンパイルする,  Prev: tabnanny --- あいまいなインデントの検出,  Up: Python言語サービス

5.32.7 ‘pyclbr’ -- Python モジュールブラウザーサポート
------------------------------------------------------

'ソースコード:' Lib/pyclbr.py(1)

__________________________________________________________________

The ‘pyclbr’ module provides limited information about the functions,
classes, and methods defined in a Python-coded module.  The information
is sufficient to implement a module browser.  The information is
extracted from the Python source code rather than by importing the
module, so this module is safe to use with untrusted code.  This
restriction makes it impossible to use this module with modules not
implemented in Python, including all standard and optional extension
modules.

 -- の関数: pyclbr.readmodule (module, path=None)

     Return a dictionary mapping module-level class names to class
     descriptors.  If possible, descriptors for imported base classes
     are included.  Parameter 'module' is a string with the name of the
     module to read; it may be the name of a module within a package.
     If given, 'path' is a sequence of directory paths prepended to
     ‘sys.path’, which is used to locate the module source code.

     This function is the original interface and is only kept for back
     compatibility.  It returns a filtered version of the following.

 -- の関数: pyclbr.readmodule_ex (module, path=None)

     Return a dictionary-based tree containing a function or class
     descriptors for each function and class defined in the module with
     a ‘def’ or ‘class’ statement.  The returned dictionary maps
     module-level function and class names to their descriptors.  Nested
     objects are entered into the children dictionary of their parent.
     As with readmodule, 'module' names the module to be read and 'path'
     is prepended to sys.path.  If the module being read is a package,
     the returned dictionary has a key ‘'__path__'’ whose value is a
     list containing the package search path.

Added in version 3.7: Descriptors for nested definitions.  They are
accessed through the new children attribute.  Each has a new parent
attribute.

The descriptors returned by these functions are instances of Function
and Class classes.  Users are not expected to create instances of these
classes.

* Menu:

* Function オブジェクト::
* クラスオブジェクト: クラスオブジェクト<2>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/pyclbr.py


File: python.info,  Node: Function オブジェクト,  Next: クラスオブジェクト<2>,  Up: pyclbr --- Python モジュールブラウザーサポート

5.32.7.1 Function オブジェクト
..............................

 -- クラス: pyclbr.Function

     Class ‘Function’ instances describe functions defined by def
     statements.  They have the following attributes:

      -- の属性: file

          Name of the file in which the function is defined.

      -- の属性: module

          The name of the module defining the function described.

      -- の属性: name

          関数の名前です。

      -- の属性: lineno

          The line number in the file where the definition starts.

      -- の属性: parent

          For top-level functions, ‘None’.  For nested functions, the
          parent.

          Added in version 3.7.

      -- の属性: children

          A *note dictionary: 183. mapping names to descriptors for
          nested functions and classes.

          Added in version 3.7.

      -- の属性: is_async

          ‘True’ for functions that are defined with the *note async:
          7ed. prefix, ‘False’ otherwise.

          Added in version 3.10.


File: python.info,  Node: クラスオブジェクト<2>,  Prev: Function オブジェクト,  Up: pyclbr --- Python モジュールブラウザーサポート

5.32.7.2 クラスオブジェクト
...........................

 -- クラス: pyclbr.Class

     Class ‘Class’ instances describe classes defined by class
     statements.  They have the same attributes as *note Functions:
     4c73. and two more.

      -- の属性: file

          Name of the file in which the class is defined.

      -- の属性: module

          The name of the module defining the class described.

      -- の属性: name

          クラスの名前です。

      -- の属性: lineno

          The line number in the file where the definition starts.

      -- の属性: parent

          For top-level classes, ‘None’.  For nested classes, the
          parent.

          Added in version 3.7.

      -- の属性: children

          A dictionary mapping names to descriptors for nested functions
          and classes.

          Added in version 3.7.

      -- の属性: super

          A list of ‘Class’ objects which describe the immediate base
          classes of the class being described.  Classes which are named
          as superclasses but which are not discoverable by *note
          readmodule_ex(): a2d. are listed as a string with the class
          name instead of as ‘Class’ objects.

      -- の属性: methods

          A *note dictionary: 183. mapping method names to line numbers.
          This can be derived from the newer *note children: 4c83.
          dictionary, but remains for back-compatibility.


File: python.info,  Node: py_compile --- Python ソースファイルをコンパイルする,  Next: compileall --- Python ライブラリをバイトコンパイルする,  Prev: pyclbr --- Python モジュールブラウザーサポート,  Up: Python言語サービス

5.32.8 ‘py_compile’ -- Python ソースファイルをコンパイルする
------------------------------------------------------------

'ソースコード:' Lib/py_compile.py(1)

__________________________________________________________________

The ‘py_compile’ module provides a function to generate a byte-code file
from a source file, and another function used when the module source
file is invoked as a script.

頻繁に必要となるわけではありませんが、共有ライブラリとしてモジュールをイ
ンストールする場合や、特にソースコードのあるディレクトリにバイトコードの
キャッシュファイルを書き込む権限がないユーザがいるときには、この関数は役
に立ちます。

 -- 例外: py_compile.PyCompileError

     ファイルをコンパイル中にエラーが発生すると送出される例外。

 -- の関数: py_compile.compile (file, cfile=None, dfile=None,
          doraise=False, optimize=-1,
          invalidation_mode=PycInvalidationMode.TIMESTAMP, quiet=0)

     Compile a source file to byte-code and write out the byte-code
     cache file.  The source code is loaded from the file named 'file'.
     The byte-code is written to 'cfile', which defaults to the PEP
     3147(2)/ PEP 488(3) path, ending in ‘.pyc’.  For example, if 'file'
     is ‘/foo/bar/baz.py’ 'cfile' will default to
     ‘/foo/bar/__pycache__/baz.cpython-32.pyc’ for Python 3.2.  If
     'dfile' is specified, it is used instead of 'file' as the name of
     the source file from which source lines are obtained for display in
     exception tracebacks.  If 'doraise' is true, a *note
     PyCompileError: 4c89. is raised when an error is encountered while
     compiling 'file'.  If 'doraise' is false (the default), an error
     string is written to ‘sys.stderr’, but no exception is raised.
     This function returns the path to byte-compiled file, i.e.
     whatever 'cfile' value was used.

     The 'doraise' and 'quiet' arguments determine how errors are
     handled while compiling file.  If 'quiet' is 0 or 1, and 'doraise'
     is false, the default behaviour is enabled: an error string is
     written to ‘sys.stderr’, and the function returns ‘None’ instead of
     a path.  If 'doraise' is true, a *note PyCompileError: 4c89. is
     raised instead.  However if 'quiet' is 2, no message is written,
     and 'doraise' has no effect.

     (明示的に指定されたか計算された結果の) 'cfile' のパスがシンボリック
     リンクだったり通常のファイルでなかったりした場合は、 *note
     FileExistsError: 1221. が送出されます。この動作は、それらのパスにバ
     イトコンパイルされたファイルを書き込む権限がある場合、インポートの
     ときにそのパスを通常のファイルに変えてしまうことを警告するためのも
     のです。これはリネームを使ってバイトコンパイルされたファイルを配置
     するインポートで、同時にファイル書き込みをしてしまう問題を避けるた
     めの副作用です。

     'optimize' は最適化レベルを制御するもので、組み込みの *note
     compile(): 4b1. 関数に渡されます。デフォルトは現在のインタープリタ
     の最適化レベルを選ぶ ‘-1’ です。

     'invalidation_mode' should be a member of the *note
     PycInvalidationMode: 4c8a. enum and controls how the generated
     bytecode cache is invalidated at runtime.  The default is *note
     PycInvalidationMode.CHECKED_HASH: 4c8b. if the ‘SOURCE_DATE_EPOCH’
     environment variable is set, otherwise the default is *note
     PycInvalidationMode.TIMESTAMP: 4c8c.

     バージョン 3.2 で変更: PEP 3147(4) に準拠し 'cfile' のデフォルト値
     を変更しました。以前のデフォルトは 'file' + ‘'c'’ (最適化が有効な場
     合は ‘'o'’) でした。同時に 'optimize' パラメータも追加されました。

     バージョン 3.4 で変更: バイトコードをキャッシュするファイルへの書き
     込みに *note importlib: 7b. を使うようにコードを変更しました。これ
     により、例えば権限や write-and-move セマンティクスなどの、ファイル
     の作成や書き込みの動作が *note importlib: 7b. と一致するようになり
     ました。 'cfile' がシンボリックリンクであるか通常のファイルでない場
     合、 *note FileExistsError: 1221. を送出するという注意書きも追加さ
     れました。

     バージョン 3.7 で変更: The 'invalidation_mode' parameter was added
     as specified in PEP 552(5).  If the ‘SOURCE_DATE_EPOCH’ environment
     variable is set, 'invalidation_mode' will be forced to *note
     PycInvalidationMode.CHECKED_HASH: 4c8b.

     バージョン 3.7.2 で変更: The ‘SOURCE_DATE_EPOCH’ environment
     variable no longer overrides the value of the 'invalidation_mode'
     argument, and determines its default value instead.

     バージョン 3.8 で変更: 'quiet' パラメータが追加されました。

 -- クラス: py_compile.PycInvalidationMode

     An enumeration of possible methods the interpreter can use to
     determine whether a bytecode file is up to date with a source file.
     The ‘.pyc’ file indicates the desired invalidation mode in its
     header.  See *note キャッシュされたバイトコードの無効化: 802. for
     more information on how Python invalidates ‘.pyc’ files at runtime.

     Added in version 3.7.

      -- の属性: TIMESTAMP

          The ‘.pyc’ file includes the timestamp and size of the source
          file, which Python will compare against the metadata of the
          source file at runtime to determine if the ‘.pyc’ file needs
          to be regenerated.

      -- の属性: CHECKED_HASH

          The ‘.pyc’ file includes a hash of the source file content,
          which Python will compare against the source at runtime to
          determine if the ‘.pyc’ file needs to be regenerated.

      -- の属性: UNCHECKED_HASH

          Like *note CHECKED_HASH: 4c8b, the ‘.pyc’ file includes a hash
          of the source file content.  However, Python will at runtime
          assume the ‘.pyc’ file is up to date and not validate the
          ‘.pyc’ against the source file at all.

          This option is useful when the ‘.pycs’ are kept up to date by
          some system external to Python like a build system.

* Menu:

* コマンドラインインターフェイス: コマンドラインインターフェイス<5>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/py_compile.py

   (2) https://peps.python.org/pep-3147/

   (3) https://peps.python.org/pep-0488/

   (4) https://peps.python.org/pep-3147/

   (5) https://peps.python.org/pep-0552/


File: python.info,  Node: コマンドラインインターフェイス<5>,  Up: py_compile --- Python ソースファイルをコンパイルする

5.32.8.1 コマンドラインインターフェイス
.......................................

This module can be invoked as a script to compile several source files.
The files named in 'filenames' are compiled and the resulting bytecode
is cached in the normal manner.  This program does not search a
directory structure to locate source files; it only compiles files named
explicitly.  The exit status is nonzero if one of the files could not be
compiled.

 -- Option: <file> ... <fileN>
 -- Option: -

     Positional arguments are files to compile.  If ‘-’ is the only
     parameter, the list of files is taken from standard input.

 -- Option: -q, --quiet

     Suppress errors output.

バージョン 3.2 で変更: ‘-’ のサポートが追加されました。

バージョン 3.10 で変更: *note -q: 4c92. のサポートが追加されました。

参考
....

*note compileall: 21. モジュール

     ディレクトリツリー内の Python ソースファイルを全てコンパイルするラ
     イブラリ。


File: python.info,  Node: compileall --- Python ライブラリをバイトコンパイルする,  Next: dis --- Python バイトコードの逆アセンブラー,  Prev: py_compile --- Python ソースファイルをコンパイルする,  Up: Python言語サービス

5.32.9 ‘compileall’ -- Python ライブラリをバイトコンパイルする
--------------------------------------------------------------

'ソースコード:' Lib/compileall.py(1)

__________________________________________________________________

このモジュールは、Python ライブラリのインストールを助けるユーティリティ
関数群を提供します。この関数群は、ディレクトリツリー内の Python ソースフ
ァイルをコンパイルします。このモジュールを使って、キャッシュされたバイト
コードファイルをライブラリのインストール時に生成することで、ライブラリデ
ィレクトリに書き込み権限をもたないユーザでも、これらを利用できるようにな
ります。

*note Availability: 213f.: not WASI.

このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、
*note WebAssembly プラットフォーム: 1b6a. を見てください。

* Menu:

* コマンドラインでの使用: コマンドラインでの使用<9>.
* パブリックな関数::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/compileall.py


File: python.info,  Node: コマンドラインでの使用<9>,  Next: パブリックな関数,  Up: compileall --- Python ライブラリをバイトコンパイルする

5.32.9.1 コマンドラインでの使用
...............................

このモジュールは、 (‘python -m compileall’ を使って) Python ソースをコン
パイルするスクリプトとして機能します。

 -- Option: directory ...
 -- Option: file ...

     位置引数は、コンパイルするファイル群か、再帰的に横断されるディレク
     トリでソースファイル群を含むものです。引数が与えられなければ、 ‘-l
     <DIRECTORIES FROM SYS.PATH>’ を渡したのと同じように動作します。

 -- Option: -l

     サブディレクトリを再帰処理せず、指名または暗示されたディレクトリ群
     に含まれるソースコードファイル群だけをコンパイルします。

 -- Option: -f

     タイムスタンプが最新であってもリビルドを強制します。

 -- Option: -q

     コンパイルされたファイルのリストを出力しません。 一つ渡された場合で
     もエラーメッセージは出力されます。 二つ (‘-qq’) の場合全ての出力は
     抑制されます。

 -- Option: -d destdir

     コンパイルされるそれぞれのファイルへのパスの先頭に、ディレクトリを
     追加します。これはコンパイル時トレースバックに使われ、バイトコード
     ファイルが実行される時点でソースファイルが存在しない場合に、トレー
     スバックやその他のメッセージに使われるバイトコードファイルにもコン
     パイルされます。

 -- Option: -s strip_prefix

     Remove the given prefix from paths recorded in the ‘.pyc’ files.
     Paths are made relative to the prefix.

     This option can be used with ‘-p’ but not with ‘-d’.

 -- Option: -p prepend_prefix

     Prepend the given prefix to paths recorded in the ‘.pyc’ files.
     Use ‘-p /’ to make the paths absolute.

     This option can be used with ‘-s’ but not with ‘-d’.

 -- Option: -x regex

     regex を使って、コンパイル候補のそれぞれのファイルのフルパスを検索
     し、regex がマッチしたファイルを除外します。

 -- Option: -i list

     ファイル ‘list’ を読み込み、そのファイルのそれぞれの行を、コンパイ
     ルするファイルとディレクトリのリストに加えます。‘list’ が ‘-’ なら
     、‘stdin’ の行を読み込みます。

 -- Option: -b

     バイトコードファイルを、他のバージョンの Python によって生成された
     バイトコードファイルを上書きするかもしれない、レガシーな場所に生成
     します。デフォルトでは PEP 3147(1) で決められた場所と名前を使い、複
     数のバージョンの Python が共存できるようにします。

 -- Option: -r

     サブディレクトリの最大再起深度を制御します。 このオプションが与えら
     れた場合、‘-l’ オプションは無視されます。 ‘python -m compileall
     <directory> -r 0’ は ‘python -m compileall <directory> -l’ と等価で
     す。

 -- Option: -j N

     Use 'N' workers to compile the files within the given directory.
     If ‘0’ is used, then the result of *note os.process_cpu_count():
     4da. will be used.

 -- Option: --invalidation-mode [timestamp|checked-hash|unchecked-hash]

     生成したバイトコードファイルを実行時に無効化する方法を制御します。
     ‘timestamp’ を指定すると、生成した''.pyc'' ファイルにソースファイル
     のタイムスタンプとサイズを埋め込みます。‘checked-hash’ と
     ‘unchecked-hash’ を指定すると、ハッシュベースの pycファイルが生成さ
     れます。ハッシュベースのpycファイルは、ソースファイルにタイムスタン
     プではなくハッシュ値を埋め込みます。Python がバイトコードキャッシュ
     ファイルを実行時に検証する方法の詳細を知るには、*note
     キャッシュされたバイトコードの無効化: 802. を参照してください。デフ
     ォルト値は、 ‘SOURCE_DATE_EPOCH’ 環境変数が設定されていなければ
     ‘timestamp’ で、‘SOURCE_DATE_EPOCH’ 環境変数が設定されていれば、
     ‘checked-hash’ になります。

 -- Option: -o level

     Compile with the given optimization level.  May be used multiple
     times to compile for multiple levels at a time (for example,
     ‘compileall -o 1 -o 2’).

 -- Option: -e dir

     Ignore symlinks pointing outside the given directory.

 -- Option: --hardlink-dupes

     If two ‘.pyc’ files with different optimization level have the same
     content, use hard links to consolidate duplicate files.

バージョン 3.2 で変更: ‘-i’, ‘-b’, ‘-h’ オプションを追加。

バージョン 3.5 で変更: ‘-j’, ‘-r’, ‘-qq’ オプションが追加されました。
‘-q’ オプションが複数のレベルの値に変更されました。‘-b’ は常に拡張子
‘.pyc’ のバイトエンコーディングファイルを生成し、‘.pyo’ を作りません。

バージョン 3.7 で変更: ‘--invalidation-mode’ オプションが追加されました
。

バージョン 3.9 で変更: Added the ‘-s’, ‘-p’, ‘-e’ and ‘--hardlink-dupes’
options.  Raised the default recursion limit from 10 to *note
sys.getrecursionlimit(): 6eb.  Added the possibility to specify the ‘-o’
option multiple times.

*note compile(): 4b1. 関数で利用される最適化レベルを制御するコマンドライ
ンオプションはありません。 Python インタプリタ自体のオプションを使ってく
ださい: ‘python -O -m compileall’.

Similarly, the *note compile(): 4b1. function respects the *note
sys.pycache_prefix: b9c. setting.  The generated bytecode cache will
only be useful if *note compile(): 4b1. is run with the same *note
sys.pycache_prefix: b9c. (if any) that will be used at runtime.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3147/


File: python.info,  Node: パブリックな関数,  Prev: コマンドラインでの使用<9>,  Up: compileall --- Python ライブラリをバイトコンパイルする

5.32.9.2 パブリックな関数
.........................

 -- の関数: compileall.compile_dir (dir,
          maxlevels=sys.getrecursionlimit(), ddir=None, force=False,
          rx=None, quiet=0, legacy=False, optimize=-1, workers=1,
          invalidation_mode=None, *, stripdir=None, prependdir=None,
          limit_sl_dest=None, hardlink_dupes=False)

     'dir' という名前のディレクトリーツリーをたどり、途中で見つけた全て
     の ‘.py’ をコンパイルします。全ファイルのコンパイルが成功した場合は
     真を、それ以外の場合は偽を返します。

     'maxlevels' パラメータで最大再帰深度を制限します。デフォルトは
     ‘sys.getrecursionlimit()’ です。

     'ddir' が与えられた場合、コンパイルされるそれぞれのファイルへのパス
     の先頭に、そのディレクトリを追加します。これはコンパイル時トレース
     バックに使われ、バイトコードファイルが実行される時点でソースファイ
     ルが存在しない場合に、トレースバックやその他のメッセージに使われる
     バイトコードファイルにもコンパイルされます。

     'force' が真の場合、タイムスタンプが最新のであってもモジュールは再
     コンパイルされます。

     If 'rx' is given, its ‘search’ method is called on the complete
     path to each file considered for compilation, and if it returns a
     true value, the file is skipped.  This can be used to exclude files
     matching a regular expression, given as a *note re.Pattern: 1189.
     object.

     'quiet' が ‘False’ か ‘0’ (デフォルト) の場合、ファイル名とその他の
     情報は標準出力に表示されます。 ‘1’ の場合エラーのみが表示されます。
     ‘2’ の場合出力はすべて抑制されます。

     'legacy' が真の時、バイトコードファイルは古い場所と名前に書かれ、他
     のバージョンの Python によって作られたバイトコードファイルを上書き
     する可能性があります。デフォルトは PEP 3147(1) で決められた場所と名
     前を使い、複数のバージョンの Python のバイトコードファイルが共存で
     きるようにします。

     'optimize' specifies the optimization level for the compiler.  It
     is passed to the built-in *note compile(): 4b1. function.  Accepts
     also a sequence of optimization levels which lead to multiple
     compilations of one ‘.py’ file in one call.

     The argument 'workers' specifies how many workers are used to
     compile files in parallel.  The default is to not use multiple
     workers.  If the platform can't use multiple workers and 'workers'
     argument is given, then sequential compilation will be used as a
     fallback.  If 'workers' is 0, the number of cores in the system is
     used.  If 'workers' is lower than ‘0’, a *note ValueError: 2ec.
     will be raised.

     'invalidation_mode' は、*note py_compile.PycInvalidationMode: 4c8a.
     のメンバーでなければならず、生成されたpycファイルを実行時に無効化す
     る方法を制御します。

     The 'stripdir', 'prependdir' and 'limit_sl_dest' arguments
     correspond to the ‘-s’, ‘-p’ and ‘-e’ options described above.
     They may be specified as ‘str’ or *note os.PathLike: e4b.

     If 'hardlink_dupes' is true and two ‘.pyc’ files with different
     optimization level have the same content, use hard links to
     consolidate duplicate files.

     バージョン 3.2 で変更: 'legacy' と 'optimize' 引数が追加されました
     。

     バージョン 3.5 で変更: ‘workers’ パラメータが追加されました。

     バージョン 3.5 で変更: 'quiet' 引数が複数のレベルの値に変更されまし
     た。

     バージョン 3.5 で変更: 'optimize' の値に関わらず、'legacy' 引数は
     ‘.pyc’ ファイルのみを書き出し、‘.pyo’ ファイルを書き出さないように
     なりました。

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

     バージョン 3.7 で変更: 'invalidation_mode' 引数を追加しました。

     バージョン 3.7.2 で変更: The 'invalidation_mode' parameter's
     default value is updated to ‘None’.

     バージョン 3.8 で変更: Setting 'workers' to 0 now chooses the
     optimal number of cores.

     バージョン 3.9 で変更: Added 'stripdir', 'prependdir',
     'limit_sl_dest' and 'hardlink_dupes' arguments.  Default value of
     'maxlevels' was changed from ‘10’ to ‘sys.getrecursionlimit()’

 -- の関数: compileall.compile_file (fullname, ddir=None, force=False,
          rx=None, quiet=0, legacy=False, optimize=-1,
          invalidation_mode=None, *, stripdir=None, prependdir=None,
          limit_sl_dest=None, hardlink_dupes=False)

     パス 'fullname' のファイルをコンパイルします。コンパイルが成功すれ
     ば真を、そうでなければ偽を返します。

     'ddir' が与えられた場合、コンパイルされるファイルのパスの先頭にその
     ディレクトリを追加します。これはコンパイル時トレースバックに使われ
     、バイトコードファイルが実行される時点でソースファイルが存在しない
     場合に、トレースバックやその他のメッセージに使われるバイトコードフ
     ァイルにもコンパイルされます。

     If 'rx' is given, its ‘search’ method is passed the full path name
     to the file being compiled, and if it returns a true value, the
     file is not compiled and ‘True’ is returned.  This can be used to
     exclude files matching a regular expression, given as a *note
     re.Pattern: 1189. object.

     'quiet' が ‘False’ か ‘0’ (デフォルト) の場合、ファイル名とその他の
     情報は標準出力に表示されます。 ‘1’ の場合エラーのみが表示されます。
     ‘2’ の場合出力はすべて抑制されます。

     'legacy' が真の時、バイトコードファイルは古い場所と名前に書かれ、他
     のバージョンの Python によって作られたバイトコードファイルを上書き
     する可能性があります。デフォルトは PEP 3147(2) で決められた場所と名
     前を使い、複数のバージョンの Python のバイトコードファイルが共存で
     きるようにします。

     'optimize' specifies the optimization level for the compiler.  It
     is passed to the built-in *note compile(): 4b1. function.  Accepts
     also a sequence of optimization levels which lead to multiple
     compilations of one ‘.py’ file in one call.

     'invalidation_mode' は、*note py_compile.PycInvalidationMode: 4c8a.
     のメンバーでなければならず、生成されたpycファイルを実行時に無効化す
     る方法を制御します。

     The 'stripdir', 'prependdir' and 'limit_sl_dest' arguments
     correspond to the ‘-s’, ‘-p’ and ‘-e’ options described above.
     They may be specified as ‘str’ or *note os.PathLike: e4b.

     If 'hardlink_dupes' is true and two ‘.pyc’ files with different
     optimization level have the same content, use hard links to
     consolidate duplicate files.

     Added in version 3.2.

     バージョン 3.5 で変更: 'quiet' 引数が複数のレベルの値に変更されまし
     た。

     バージョン 3.5 で変更: 'optimize' の値に関わらず、'legacy' 引数は
     ‘.pyc’ ファイルのみを書き出し、‘.pyo’ ファイルを書き出さないように
     なりました。

     バージョン 3.7 で変更: 'invalidation_mode' 引数を追加しました。

     バージョン 3.7.2 で変更: The 'invalidation_mode' parameter's
     default value is updated to ‘None’.

     バージョン 3.9 で変更: 引数 'stripdir' 、 'prependdir' 、
     'limit_sl_dest' 、および 'hardlink_dupes' を追加しました。

 -- の関数: compileall.compile_path (skip_curdir=True, maxlevels=0,
          force=False, quiet=0, legacy=False, optimize=-1,
          invalidation_mode=None)

     ‘sys.path’ からたどって見つけたすべての ‘.py’ ファイルをバイトコン
     パイルします。 すべてのファイルを問題なくコンパイルできたときに真を
     、それ以外のときに偽を返します。

     'skip_curdir' が真(デフォルト)のとき、カレントディレクトリは走査か
     ら除外されます。 それ以外のすべての引数は *note compile_dir(): d1b.
     関数に渡されます。 その他の compile 関数群と異なり、 ‘maxlevels’ の
     デフォルトが ‘0’ になっていることに注意してください。

     バージョン 3.2 で変更: 'legacy' と 'optimize' 引数が追加されました
     。

     バージョン 3.5 で変更: 'quiet' 引数が複数のレベルの値に変更されまし
     た。

     バージョン 3.5 で変更: 'optimize' の値に関わらず、'legacy' 引数は
     ‘.pyc’ ファイルのみを書き出し、‘.pyo’ ファイルを書き出さないように
     なりました。

     バージョン 3.7 で変更: 'invalidation_mode' 引数を追加しました。

     バージョン 3.7.2 で変更: The 'invalidation_mode' parameter's
     default value is updated to ‘None’.

‘Lib/’ ディレクトリ以下にある全ての ‘.py’ ファイルを強制的に再コンパイル
するには、以下のようにします:

     import compileall

     compileall.compile_dir('Lib/', force=True)

     # Perform same compilation, excluding files in .svn directories.
     import re
     compileall.compile_dir('Lib/', rx=re.compile(r'[/\\][.]svn'), force=True)

     # pathlib.Path objects can also be used.
     import pathlib
     compileall.compile_dir(pathlib.Path('Lib/'), force=True)

参考
....

Module *note py_compile: b8.

     一つのソースファイルをバイトコンパイルします。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3147/

   (2) https://peps.python.org/pep-3147/


File: python.info,  Node: dis --- Python バイトコードの逆アセンブラー,  Next: pickletools --- pickle 開発者用のツール群,  Prev: compileall --- Python ライブラリをバイトコンパイルする,  Up: Python言語サービス

5.32.10 ‘dis’ -- Python バイトコードの逆アセンブラー
----------------------------------------------------

'ソースコード:' Lib/dis.py(1)

__________________________________________________________________

The ‘dis’ module supports the analysis of CPython *note bytecode: 4aa.
by disassembling it.  The CPython bytecode which this module takes as an
input is defined in the file ‘Include/opcode.h’ and used by the compiler
and the interpreter.

バイトコードは CPython インタプリタの実装詳細です。Python のバージョン間
でバイトコードの追加や、削除、変更がないという保証はありません。このモジ
ュールを使用することによって Python の異なる VM または異なるリリースの間
で動作すると考えるべきではありません。

バージョン 3.6 で変更: 従来は使用されるバイト数は命令ごとに異なりました
が、このモジュールでは各々一つの命令につき2バイト使用することとなってい
ます。

バージョン 3.10 で変更: The argument of jump, exception handling and
loop instructions is now the instruction offset rather than the byte
offset.

バージョン 3.11 で変更: Some instructions are accompanied by one or more
inline cache entries, which take the form of *note CACHE: 908.
instructions.  These instructions are hidden by default, but can be
shown by passing ‘show_caches=True’ to any ‘dis’ utility.  Furthermore,
the interpreter now adapts the bytecode to specialize it for different
runtime conditions.  The adaptive bytecode can be shown by passing
‘adaptive=True’.

バージョン 3.12 で変更: The argument of a jump is the offset of the
target instruction relative to the instruction that appears immediately
after the jump instruction's *note CACHE: 908. entries.

As a consequence, the presence of the *note CACHE: 908. instructions is
transparent for forward jumps but needs to be taken into account when
reasoning about backward jumps.

バージョン 3.13 で変更: The output shows logical labels rather than
instruction offsets for jump targets and exception handlers.  The ‘-O’
command line option and the ‘show_offsets’ argument were added.

バージョン 3.14 で変更: The *note -P: 208. command-line option and the
‘show_positions’ argument were added.

The *note -S: 209. command-line option is added.

Example: Given the function ‘myfunc()’:

     def myfunc(alist):
         return len(alist)

the following command can be used to display the disassembly of
‘myfunc()’:

     >>> dis.dis(myfunc)
       2           RESUME                   0

       3           LOAD_GLOBAL              1 (len + NULL)
                   LOAD_FAST_BORROW         0 (alist)
                   CALL                     1
                   RETURN_VALUE

("2" は行番号です)。

* Menu:

* コマンドライン・インターフェース: コマンドライン・インターフェース<12>.
* バイトコード解析::
* 解析関数::
* Python バイトコード命令::
* 命令コードコレクション::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/dis.py


File: python.info,  Node: コマンドライン・インターフェース<12>,  Next: バイトコード解析,  Up: dis --- Python バイトコードの逆アセンブラー

5.32.10.1 コマンドライン・インターフェース
..........................................

The ‘dis’ module can be invoked as a script from the command line:

     python -m dis [-h] [-C] [-O] [-P] [-S] [infile]

以下のオプションが使用できます:

 -- Option: -h, --help

     使い方を表示して終了します。

 -- Option: -C, --show-caches

     Show inline caches.

     Added in version 3.13.

 -- Option: -O, --show-offsets

     Show offsets of instructions.

     Added in version 3.13.

 -- Option: -P, --show-positions

     Show positions of instructions in the source code.

     Added in version 3.14.

 -- Option: -S, --specialized

     Show specialized bytecode.

     Added in version 3.14.

If ‘infile’ is specified, its disassembled code will be written to
stdout.  Otherwise, disassembly is performed on compiled source code
received from stdin.


File: python.info,  Node: バイトコード解析,  Next: 解析関数,  Prev: コマンドライン・インターフェース<12>,  Up: dis --- Python バイトコードの逆アセンブラー

5.32.10.2 バイトコード解析
..........................

Added in version 3.4.

バイトコード解析の API を使うと、 Python のコード片を *note Bytecode:
204. オブジェクトでラップでき、コンパイルされたコードの細かいところに簡
単にアクセスできます。

 -- クラス: dis.Bytecode (x, *, first_line=None, current_offset=None,
          show_caches=False, adaptive=False, show_offsets=False,
          show_positions=False)

     関数、ジェネレータ、非同期ジェネレータ、コルーチン、メソッド、ソー
     スコード文字列、(*note compile(): 4b1. が返すような) コードオブジェ
     クトに対応するバイトコードを解析します。

     これは、下で並べられている関数の多くのものをまとめた便利なラッパー
     です。 とりわけ目立つのは *note get_instructions(): 4ec. で、 *note
     Bytecode: 204. インスタンスに対し反復処理をしながら、バイトコード命
     令を *note Instruction: 203. インスタンスとして返します。

     'first_line' が ‘None’ でない場合は、それを逆アセンブルしたコードの
     ソースの最初の行に表示する行番号とします。 そうでない場合は、ソース
     の行の情報 (もしあれば) を逆アセンブルされたコードオブジェクトから
     直接取得します。

     'current_offset' が ‘None’ でない場合は、逆アセンブルされたコードで
     のあるインストラクションのオフセット位置を示します。 これを設定する
     と、 *note dis(): 1130. の出力において、指定された命令コード
     (opcode) に "現在の命令 (instruction)" を表す印が表示されます。

     If 'show_caches' is ‘True’, *note dis(): 1130. will display inline
     cache entries used by the interpreter to specialize the bytecode.

     If 'adaptive' is ‘True’, *note dis(): 1130. will display
     specialized bytecode that may be different from the original
     bytecode.

     If 'show_offsets' is ‘True’, *note dis(): 1130. will include
     instruction offsets in the output.

     If 'show_positions' is ‘True’, *note dis(): 1130. will include
     instruction source code positions in the output.

      -- メソッド: classmethod from_traceback (tb, *, show_caches=False)

          与えられたトレースバックから *note Bytecode: 204. インスタンス
          を構築し、 'current_offset' がその例外の原因となった命令となる
          よう設定します。

      -- データ: codeobj

          コンパイルされたコードオブジェクト。

      -- データ: first_line

          コードオブジェクトのソースの最初の行 (利用可能であれば)

      -- メソッド: dis ()

          バイトコード命令の整形された表示を返します (*note dis.dis():
          205. と同じ出力になりますが、複数行文字列として返されます)。

      -- メソッド: info ()

          *note code_info(): 1451. のようなコードオブジェクトの詳細を含
          んだ整形された複数行文字列を返します。

     バージョン 3.7 で変更: This can now handle coroutine and
     asynchronous generator objects.

     バージョン 3.11 で変更: Added the 'show_caches' and 'adaptive'
     parameters.

     バージョン 3.13 で変更: Added the 'show_offsets' parameter

     バージョン 3.14 で変更: Added the 'show_positions' parameter.

例:

     >>> bytecode = dis.Bytecode(myfunc)
     >>> for instr in bytecode:
     ...     print(instr.opname)
     ...
     RESUME
     LOAD_GLOBAL
     LOAD_FAST_BORROW
     CALL
     RETURN_VALUE


File: python.info,  Node: 解析関数,  Next: Python バイトコード命令,  Prev: バイトコード解析,  Up: dis --- Python バイトコードの逆アセンブラー

5.32.10.3 解析関数
..................

The ‘dis’ module also defines the following analysis functions that
convert the input directly to the desired output.  They can be useful if
only a single operation is being performed, so the intermediate analysis
object isn't useful:

 -- の関数: dis.code_info (x)

     渡された関数、ジェネレータ、非同期ジェネレータ、コルーチン、メソッ
     ド、ソースコード文字列、コードオブジェクトに対する、詳細なコードオ
     ブジェクトの情報を、整形された複数行の文字列として返します。

     この結果は実装に強く依存しており、Python VM や Python のバージョン
     によって異なることがあります。

     Added in version 3.2.

     バージョン 3.7 で変更: This can now handle coroutine and
     asynchronous generator objects.

 -- の関数: dis.show_code (x, *, file=None)

     渡された関数、メソッド、ソースコード文字列、コードオブジェクトに対
     する、詳細なコードオブジェクトの情報を、'file' (または 'file' が指
     定されていなければ ‘sys.stdout’) に表示します。

     これは、インタラクティブシェル上で使うことを想定した、
     ‘print(code_info(x), file=file)’ の便利なショートカットです。

     Added in version 3.2.

     バージョン 3.4 で変更: 'file' 引数が追加されました。

 -- の関数: dis.dis (x=None, *, file=None, depth=None,
          show_caches=False, adaptive=False, show_offsets=False,
          show_positions=False)

     Disassemble the 'x' object.  'x' can denote either a module, a
     class, a method, a function, a generator, an asynchronous
     generator, a coroutine, a code object, a string of source code or a
     byte sequence of raw bytecode.  For a module, it disassembles all
     functions.  For a class, it disassembles all methods (including
     class and static methods).  For a code object or sequence of raw
     bytecode, it prints one line per bytecode instruction.  It also
     recursively disassembles nested code objects.  These can include
     generator expressions, nested functions, the bodies of nested
     classes, and the code objects used for *note annotation scopes:
     4ab.  Strings are first compiled to code objects with the *note
     compile(): 4b1. built-in function before being disassembled.  If no
     object is provided, this function disassembles the last traceback.

     'file' 引数が渡された場合は、アセンブリをそこに書き込みます。 そう
     でない場合は ‘sys.stdout’ に出力します。

     The maximal depth of recursion is limited by 'depth' unless it is
     ‘None’.  ‘depth=0’ means no recursion.

     If 'show_caches' is ‘True’, this function will display inline cache
     entries used by the interpreter to specialize the bytecode.

     If 'adaptive' is ‘True’, this function will display specialized
     bytecode that may be different from the original bytecode.

     バージョン 3.4 で変更: 'file' 引数が追加されました。

     バージョン 3.7 で変更: Implemented recursive disassembling and
     added 'depth' parameter.

     バージョン 3.7 で変更: This can now handle coroutine and
     asynchronous generator objects.

     バージョン 3.11 で変更: Added the 'show_caches' and 'adaptive'
     parameters.

     バージョン 3.13 で変更: Added the 'show_offsets' parameter.

     バージョン 3.14 で変更: Added the 'show_positions' parameter.

 -- の関数: dis.distb (tb=None, *, file=None, show_caches=False,
          adaptive=False, show_offset=False, show_positions=False)

     トレースバックのスタックの先頭の関数を逆アセンブルします。Noneが渡
     された場合は最後のトレースバックを使います。例外を引き起こした命令
     が表示されます。

     'file' 引数が渡された場合は、アセンブリをそこに書き込みます。 そう
     でない場合は ‘sys.stdout’ に出力します。

     バージョン 3.4 で変更: 'file' 引数が追加されました。

     バージョン 3.11 で変更: Added the 'show_caches' and 'adaptive'
     parameters.

     バージョン 3.13 で変更: Added the 'show_offsets' parameter.

     バージョン 3.14 で変更: Added the 'show_positions' parameter.

 -- の関数: dis.disassemble (code, lasti=-1, *, file=None,
          show_caches=False, adaptive=False, show_offsets=False,
          show_positions=False)
 -- の関数: dis.disco (code, lasti=-1, *, file=None, show_caches=False,
          adaptive=False, show_offsets=False, show_positions=False)

     コードオブジェクトを逆アセンブルします。'lasti' が与えられた場合は
     、最後の命令を示します。出力は次のようなカラムに分割されます:

       1. the source code location of the instruction.  Complete
          location information is shown if 'show_positions' is true.
          Otherwise (the default) only the line number is displayed.

       2. 現在の命令。 ‘-->’ として示されます。

       3. ラベル付けされた命令。 ‘>>’ とともに表示されます。

       4. 命令のアドレス。

       5. 命令コード名。

       6. 命令パラメタ。

       7. パラメタの解釈を括弧で囲んだもの。

     パラメタの解釈は、ローカル変数とグローバル変数の名前、定数の値、 分
     岐先、比較命令を認識します。

     'file' 引数が渡された場合は、アセンブリをそこに書き込みます。 そう
     でない場合は ‘sys.stdout’ に出力します。

     バージョン 3.4 で変更: 'file' 引数が追加されました。

     バージョン 3.11 で変更: Added the 'show_caches' and 'adaptive'
     parameters.

     バージョン 3.13 で変更: Added the 'show_offsets' parameter.

     バージョン 3.14 で変更: Added the 'show_positions' parameter.

 -- の関数: dis.get_instructions (x, *, first_line=None,
          show_caches=False, adaptive=False)

     渡された関数、メソッド、ソースコード文字列、コードオブジェクトにあ
     る命令のイテレータを返します。

     イテレータは、与えられたコードの各命令の詳細情報を保持する名前付き
     タプル *note Instruction: 203. からなる列を生成します。

     'first_line' が ‘None’ でない場合は、それを逆アセンブルしたコードの
     ソースの最初の行に表示する行番号とします。 そうでない場合は、ソース
     の行の情報 (もしあれば) を逆アセンブルされたコードオブジェクトから
     直接取得します。

     The 'adaptive' parameter works as it does in *note dis(): 3c.

     Added in version 3.4.

     バージョン 3.11 で変更: Added the 'show_caches' and 'adaptive'
     parameters.

     バージョン 3.13 で変更: The 'show_caches' parameter is deprecated
     and has no effect.  The iterator generates the *note Instruction:
     203. instances with the 'cache_info' field populated (regardless of
     the value of 'show_caches') and it no longer generates separate
     items for the cache entries.

 -- の関数: dis.findlinestarts (code)

     This generator function uses the *note co_lines(): 350. method of
     the *note code object: 4e6. 'code' to find the offsets which are
     starts of lines in the source code.  They are generated as
     ‘(offset, lineno)’ pairs.

     バージョン 3.6 で変更: Line numbers can be decreasing.  Before,
     they were always increasing.

     バージョン 3.10 で変更: The PEP 626(1) *note co_lines(): 350.
     method is used instead of the *note co_firstlineno: 2390. and *note
     co_lnotab: 330. attributes of the *note code object: 4e6.

     バージョン 3.13 で変更: Line numbers can be ‘None’ for bytecode
     that does not map to source lines.

 -- の関数: dis.findlabels (code)

     Detect all offsets in the raw compiled bytecode string 'code' which
     are jump targets, and return a list of these offsets.

 -- の関数: dis.stack_effect (opcode, oparg=None, *, jump=None)

     'opcode' と引数 'oparg' がスタックに与える影響を計算します。

     If the code has a jump target and 'jump' is ‘True’, *note
     stack_effect(): 1132. will return the stack effect of jumping.  If
     'jump' is ‘False’, it will return the stack effect of not jumping.
     And if 'jump' is ‘None’ (default), it will return the maximal stack
     effect of both cases.

     Added in version 3.4.

     バージョン 3.8 で変更: Added 'jump' parameter.

     バージョン 3.13 で変更: If ‘oparg’ is omitted (or ‘None’), the
     stack effect is now returned for ‘oparg=0’.  Previously this was an
     error for opcodes that use their arg.  It is also no longer an
     error to pass an integer ‘oparg’ when the ‘opcode’ does not use it;
     the ‘oparg’ in this case is ignored.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0626/


File: python.info,  Node: Python バイトコード命令,  Next: 命令コードコレクション,  Prev: 解析関数,  Up: dis --- Python バイトコードの逆アセンブラー

5.32.10.4 Python バイトコード命令
.................................

*note get_instructions(): 4ec. 関数と *note Bytecode: 204. クラスはバイ
トコード命令の詳細を *note Instruction: 203. インスタンスの形で提供しま
す:

 -- クラス: dis.Instruction

     バイトコード命令の詳細

      -- データ: opcode

          以下の命令コードの値と *note 命令コードコレクション: 4cc1. の
          バイトコードの値に対応する、命令の数値コードです。

      -- データ: opname

          人間が読むための命令名

      -- データ: baseopcode

          numeric code for the base operation if operation is
          specialized; otherwise equal to *note opcode: 4cc0.

      -- データ: baseopname

          human readable name for the base operation if operation is
          specialized; otherwise equal to *note opname: 4cc5.

      -- データ: arg

          (ある場合は) 命令の数値引数、無ければ ‘None’

      -- データ: oparg

          alias for *note arg: 4cc6.

      -- データ: argval

          resolved arg value (if any), otherwise ‘None’

      -- データ: argrepr

          human readable description of operation argument (if any),
          otherwise an empty string.

      -- データ: offset

          バイトコード列の中での命令の開始位置

      -- データ: start_offset

          start index of operation within bytecode sequence, including
          prefixed ‘EXTENDED_ARG’ operations if present; otherwise equal
          to *note offset: 4cca.

      -- データ: cache_offset

          start index of the cache entries following the operation

      -- データ: end_offset

          end index of the cache entries following the operation

      -- データ: starts_line

          ‘True’ if this opcode starts a source line, otherwise ‘False’

      -- データ: line_number

          source line number associated with this opcode (if any),
          otherwise ‘None’

      -- データ: is_jump_target

          他のコードからここへジャンプする場合は ‘True’ 、そうでない場合
          は ‘False’

      -- データ: jump_target

          bytecode index of the jump target if this is a jump operation,
          otherwise ‘None’

      -- データ: positions

          *note dis.Positions: 1940. object holding the start and end
          locations that are covered by this instruction.

      -- データ: cache_info

          Information about the cache entries of this instruction, as
          triplets of the form ‘(name, size, data)’, where the ‘name’
          and ‘size’ describe the cache format and data is the contents
          of the cache.  ‘cache_info’ is ‘None’ if the instruction does
          not have caches.

     Added in version 3.4.

     バージョン 3.11 で変更: Field ‘positions’ is added.

     バージョン 3.13 で変更: Changed field ‘starts_line’.

     Added fields ‘start_offset’, ‘cache_offset’, ‘end_offset’,
     ‘baseopname’, ‘baseopcode’, ‘jump_target’, ‘oparg’, ‘line_number’
     and ‘cache_info’.

 -- クラス: dis.Positions

     In case the information is not available, some fields might be
     ‘None’.

      -- データ: lineno

      -- データ: end_lineno

      -- データ: col_offset

      -- データ: end_col_offset

     Added in version 3.11.

現在 Python コンパイラは次のバイトコード命令を生成します。

'一般的な命令'

In the following, We will refer to the interpreter stack as ‘STACK’ and
describe operations on it as if it was a Python list.  The top of the
stack corresponds to ‘STACK[-1]’ in this language.

 -- Opcode: NOP

     Do nothing code.  Used as a placeholder by the bytecode optimizer,
     and to generate line tracing events.

 -- Opcode: NOT_TAKEN

     Do nothing code.  Used by the interpreter to record *note
     BRANCH_LEFT: 295. and *note BRANCH_RIGHT: 296. events for *note
     sys.monitoring: e0.

     Added in version 3.14.

 -- Opcode: POP_ITER

     Removes the iterator from the top of the stack.

     Added in version 3.14.

 -- Opcode: POP_TOP

     Removes the top-of-stack item:

          STACK.pop()

 -- Opcode: END_FOR

     Removes the top-of-stack item.  Equivalent to ‘POP_TOP’.  Used to
     clean up at the end of loops, hence the name.

     Added in version 3.12.

 -- Opcode: END_SEND

     Implements ‘del STACK[-2]’.  Used to clean up when a generator
     exits.

     Added in version 3.12.

 -- Opcode: COPY (i)

     Push the i-th item to the top of the stack without removing it from
     its original location:

          assert i > 0
          STACK.append(STACK[-i])

     Added in version 3.11.

 -- Opcode: SWAP (i)

     Swap the top of the stack with the i-th element:

          STACK[-i], STACK[-1] = STACK[-1], STACK[-i]

     Added in version 3.11.

 -- Opcode: CACHE

     Rather than being an actual instruction, this opcode is used to
     mark extra space for the interpreter to cache useful data directly
     in the bytecode itself.  It is automatically hidden by all ‘dis’
     utilities, but can be viewed with ‘show_caches=True’.

     Logically, this space is part of the preceding instruction.  Many
     opcodes expect to be followed by an exact number of caches, and
     will instruct the interpreter to skip over them at runtime.

     Populated caches can look like arbitrary instructions, so great
     care should be taken when reading or modifying raw, adaptive
     bytecode containing quickened data.

     Added in version 3.11.

'1オペランド命令'

1オペランド命令はスタックの先頭を取り出して操作を適用し、結果をスタック
へプッシュし戻します。

 -- Opcode: UNARY_NEGATIVE

     Implements ‘STACK[-1] = -STACK[-1]’.

 -- Opcode: UNARY_NOT

     Implements ‘STACK[-1] = not STACK[-1]’.

     バージョン 3.13 で変更: This instruction now requires an exact
     *note bool: 3c3. operand.

 -- Opcode: UNARY_INVERT

     Implements ‘STACK[-1] = ~STACK[-1]’.

 -- Opcode: GET_ITER

     Implements ‘STACK[-1] = iter(STACK[-1])’.

 -- Opcode: GET_YIELD_FROM_ITER

     If ‘STACK[-1]’ is a *note generator iterator: dd9. or *note
     coroutine: 6b9. object it is left as is.  Otherwise, implements
     ‘STACK[-1] = iter(STACK[-1])’.

     Added in version 3.5.

 -- Opcode: TO_BOOL

     Implements ‘STACK[-1] = bool(STACK[-1])’.

     Added in version 3.13.

'Binary and in-place operations'

Binary operations remove the top two items from the stack (‘STACK[-1]’
and ‘STACK[-2]’).  They perform the operation, then put the result back
on the stack.

In-place operations are like binary operations, but the operation is
done in-place when ‘STACK[-2]’ supports it, and the resulting
‘STACK[-1]’ may be (but does not have to be) the original ‘STACK[-2]’.

 -- Opcode: BINARY_OP (op)

     Implements the binary and in-place operators (depending on the
     value of 'op'):

          rhs = STACK.pop()
          lhs = STACK.pop()
          STACK.append(lhs op rhs)

     Added in version 3.11.

     バージョン 3.14 で変更: With oparg :‘NB_SUBSCR’, implements binary
     subscript (replaces opcode ‘BINARY_SUBSCR’)

 -- Opcode: STORE_SUBSCR

     Implements:

          key = STACK.pop()
          container = STACK.pop()
          value = STACK.pop()
          container[key] = value

 -- Opcode: DELETE_SUBSCR

     Implements:

          key = STACK.pop()
          container = STACK.pop()
          del container[key]

 -- Opcode: BINARY_SLICE

     Implements:

          end = STACK.pop()
          start = STACK.pop()
          container = STACK.pop()
          STACK.append(container[start:end])

     Added in version 3.12.

 -- Opcode: STORE_SLICE

     Implements:

          end = STACK.pop()
          start = STACK.pop()
          container = STACK.pop()
          value = STACK.pop()
          container[start:end] = value

     Added in version 3.12.

'コルーチン命令コード'

 -- Opcode: GET_AWAITABLE (where)

     Implements ‘STACK[-1] = get_awaitable(STACK[-1])’, where
     ‘get_awaitable(o)’ returns ‘o’ if ‘o’ is a coroutine object or a
     generator object with the *note CO_ITERABLE_COROUTINE: 4a5a. flag,
     or resolves ‘o.__await__’.

          If the ‘where’ operand is nonzero, it indicates where the
          instruction occurs:

             * ‘1’: After a call to ‘__aenter__’

             * ‘2’: After a call to ‘__aexit__’

     Added in version 3.5.

     バージョン 3.11 で変更: Previously, this instruction did not have
     an oparg.

 -- Opcode: GET_AITER

     Implements ‘STACK[-1] = STACK[-1].__aiter__()’.

     Added in version 3.5.

     バージョン 3.7 で変更: Returning awaitable objects from ‘__aiter__’
     is no longer supported.

 -- Opcode: GET_ANEXT

     Implement ‘STACK.append(get_awaitable(STACK[-1].__anext__()))’ to
     the stack.  See ‘GET_AWAITABLE’ for details about ‘get_awaitable’.

     Added in version 3.5.

 -- Opcode: END_ASYNC_FOR

     Terminates an *note async for: ca1. loop.  Handles an exception
     raised when awaiting a next item.  The stack contains the async
     iterable in ‘STACK[-2]’ and the raised exception in ‘STACK[-1]’.
     Both are popped.  If the exception is not *note StopAsyncIteration:
     1e0f, it is re-raised.

     Added in version 3.8.

     バージョン 3.11 で変更: Exception representation on the stack now
     consist of one, not three, items.

 -- Opcode: CLEANUP_THROW

     Handles an exception raised during a *note throw(): 71c. or *note
     close(): 1793. call through the current frame.  If ‘STACK[-1]’ is
     an instance of *note StopIteration: df5, pop three values from the
     stack and push its ‘value’ member.  Otherwise, re-raise
     ‘STACK[-1]’.

     Added in version 3.12.

'その他の命令コード'

 -- Opcode: SET_ADD (i)

     Implements:

          item = STACK.pop()
          set.add(STACK[-i], item)

     Used to implement set comprehensions.

 -- Opcode: LIST_APPEND (i)

     Implements:

          item = STACK.pop()
          list.append(STACK[-i], item)

     Used to implement list comprehensions.

 -- Opcode: MAP_ADD (i)

     Implements:

          value = STACK.pop()
          key = STACK.pop()
          dict.__setitem__(STACK[-i], key, value)

     Used to implement dict comprehensions.

     Added in version 3.1.

     バージョン 3.8 で変更: Map value is ‘STACK[-1]’ and map key is
     ‘STACK[-2]’.  Before, those were reversed.

*note SET_ADD: 4ce3, *note LIST_APPEND: 4ce4, *note MAP_ADD: ca2. は、追
加した値または key/value ペアをスタックから取り除きますが、コンテナオブ
ジェクトはループの次のイテレーションで利用できるようにスタックに残してお
きます。

 -- Opcode: RETURN_VALUE

     Returns with ‘STACK[-1]’ to the caller of the function.

 -- Opcode: YIELD_VALUE

     Yields ‘STACK.pop()’ from a *note generator: 126c.

     バージョン 3.11 で変更: oparg set to be the stack depth.

     バージョン 3.12 で変更: oparg set to be the exception block depth,
     for efficient closing of generators.

     バージョン 3.13 で変更: oparg is ‘1’ if this instruction is part of
     a yield-from or await, and ‘0’ otherwise.

 -- Opcode: SETUP_ANNOTATIONS

     Checks whether ‘__annotations__’ is defined in ‘locals()’, if not
     it is set up to an empty ‘dict’.  This opcode is only emitted if a
     class or module body contains *note variable annotations: f51.
     statically.

     Added in version 3.6.

 -- Opcode: POP_EXCEPT

     Pops a value from the stack, which is used to restore the exception
     state.

     バージョン 3.11 で変更: Exception representation on the stack now
     consist of one, not three, items.

 -- Opcode: RERAISE

     Re-raises the exception currently on top of the stack.  If oparg is
     non-zero, pops an additional value from the stack which is used to
     set *note f_lasti: a88. of the current frame.

     Added in version 3.9.

     バージョン 3.11 で変更: Exception representation on the stack now
     consist of one, not three, items.

 -- Opcode: PUSH_EXC_INFO

     Pops a value from the stack.  Pushes the current exception to the
     top of the stack.  Pushes the value originally popped back to the
     stack.  Used in exception handlers.

     Added in version 3.11.

 -- Opcode: CHECK_EXC_MATCH

     Performs exception matching for ‘except’.  Tests whether the
     ‘STACK[-2]’ is an exception matching ‘STACK[-1]’.  Pops ‘STACK[-1]’
     and pushes the boolean result of the test.

     Added in version 3.11.

 -- Opcode: CHECK_EG_MATCH

     Performs exception matching for ‘except*’.  Applies
     ‘split(STACK[-1])’ on the exception group representing ‘STACK[-2]’.

     In case of a match, pops two items from the stack and pushes the
     non-matching subgroup (‘None’ in case of full match) followed by
     the matching subgroup.  When there is no match, pops one item (the
     match type) and pushes ‘None’.

     Added in version 3.11.

 -- Opcode: WITH_EXCEPT_START

     Calls the function in position 4 on the stack with arguments (type,
     val, tb) representing the exception at the top of the stack.  Used
     to implement the call ‘context_manager.__exit__(*exc_info())’ when
     an exception has occurred in a *note with: 186. statement.

     Added in version 3.9.

     バージョン 3.11 で変更: The ‘__exit__’ function is in position 4 of
     the stack rather than 7.  Exception representation on the stack now
     consist of one, not three, items.

 -- Opcode: LOAD_COMMON_CONSTANT

     Pushes a common constant onto the stack.  The interpreter contains
     a hardcoded list of constants supported by this instruction.  Used
     by the *note assert: b60. statement to load *note AssertionError:
     8b8.

     Added in version 3.14.

 -- Opcode: LOAD_BUILD_CLASS

     Pushes ‘builtins.__build_class__()’ onto the stack.  It is later
     called to construct a class.

 -- Opcode: GET_LEN

     Perform ‘STACK.append(len(STACK[-1]))’.  Used in *note match: a0e.
     statements where comparison with structure of pattern is needed.

     Added in version 3.10.

 -- Opcode: MATCH_MAPPING

     If ‘STACK[-1]’ is an instance of *note collections.abc.Mapping:
     ac7. (or, more technically: if it has the *note Py_TPFLAGS_MAPPING:
     1c58. flag set in its *note tp_flags: 1c71.), push ‘True’ onto the
     stack.  Otherwise, push ‘False’.

     Added in version 3.10.

 -- Opcode: MATCH_SEQUENCE

     If ‘STACK[-1]’ is an instance of *note collections.abc.Sequence:
     13dc. and is 'not' an instance of *note str: 169./*note bytes:
     192./*note bytearray: 344. (or, more technically: if it has the
     *note Py_TPFLAGS_SEQUENCE: 1c59. flag set in its *note tp_flags:
     1c71.), push ‘True’ onto the stack.  Otherwise, push ‘False’.

     Added in version 3.10.

 -- Opcode: MATCH_KEYS

     ‘STACK[-1]’ is a tuple of mapping keys, and ‘STACK[-2]’ is the
     match subject.  If ‘STACK[-2]’ contains all of the keys in
     ‘STACK[-1]’, push a *note tuple: 614. containing the corresponding
     values.  Otherwise, push ‘None’.

     Added in version 3.10.

     バージョン 3.11 で変更: Previously, this instruction also pushed a
     boolean value indicating success (‘True’) or failure (‘False’).

 -- Opcode: STORE_NAME (namei)

     Implements ‘name = STACK.pop()’.  'namei' is the index of 'name' in
     the attribute *note co_names: 238f. of the *note code object: 4e6.
     The compiler tries to use *note STORE_FAST: 1a63. or *note
     STORE_GLOBAL: 4ced. if possible.

 -- Opcode: DELETE_NAME (namei)

     Implements ‘del name’, where 'namei' is the index into *note
     co_names: 238f. attribute of the *note code object: 4e6.

 -- Opcode: UNPACK_SEQUENCE (count)

     Unpacks ‘STACK[-1]’ into 'count' individual values, which are put
     onto the stack right-to-left.  Require there to be exactly 'count'
     values.:

          assert(len(STACK[-1]) == count)
          STACK.extend(STACK.pop()[:-count-1:-1])

 -- Opcode: UNPACK_EX (counts)

     Implements assignment with a starred target: Unpacks an iterable in
     ‘STACK[-1]’ into individual values, where the total number of
     values can be smaller than the number of items in the iterable: one
     of the new values will be a list of all leftover items.

     The number of values before and after the list value is limited to
     255.

     The number of values before the list value is encoded in the
     argument of the opcode.  The number of values after the list if any
     is encoded using an ‘EXTENDED_ARG’.  As a consequence, the argument
     can be seen as a two bytes values where the low byte of 'counts' is
     the number of values before the list value, the high byte of
     'counts' the number of values after it.

     The extracted values are put onto the stack right-to-left, i.e.
     ‘a, *b, c = d’ will be stored after execution as ‘STACK.extend((a,
     b, c))’.

 -- Opcode: STORE_ATTR (namei)

     Implements:

          obj = STACK.pop()
          value = STACK.pop()
          obj.name = value

     where 'namei' is the index of name in *note co_names: 238f. of the
     *note code object: 4e6.

 -- Opcode: DELETE_ATTR (namei)

     Implements:

          obj = STACK.pop()
          del obj.name

     where 'namei' is the index of name into *note co_names: 238f. of
     the *note code object: 4e6.

 -- Opcode: STORE_GLOBAL (namei)

     *note STORE_NAME: 4cec. と同じように動作しますが、 name をグローバ
     ルとして保存します。

 -- Opcode: DELETE_GLOBAL (namei)

     *note DELETE_NAME: 4cee. と同じように動作しますが、グローバルの
     name を削除します。

 -- Opcode: LOAD_CONST (consti)

     ‘co_consts[consti]’ をスタックにプッシュします。

 -- Opcode: LOAD_SMALL_INT (i)

     Pushes the integer ‘i’ onto the stack.  ‘i’ must be in ‘range(256)’

     Added in version 3.14.

 -- Opcode: LOAD_NAME (namei)

     Pushes the value associated with ‘co_names[namei]’ onto the stack.
     The name is looked up within the locals, then the globals, then the
     builtins.

 -- Opcode: LOAD_LOCALS

     Pushes a reference to the locals dictionary onto the stack.  This
     is used to prepare namespace dictionaries for *note
     LOAD_FROM_DICT_OR_DEREF: 70c. and *note LOAD_FROM_DICT_OR_GLOBALS:
     70d.

     Added in version 3.12.

 -- Opcode: LOAD_FROM_DICT_OR_GLOBALS (i)

     Pops a mapping off the stack and looks up the value for
     ‘co_names[namei]’.  If the name is not found there, looks it up in
     the globals and then the builtins, similar to *note LOAD_GLOBAL:
     1a5a.  This is used for loading global variables in *note
     annotation scopes: 4ab. within class bodies.

     Added in version 3.12.

 -- Opcode: BUILD_TEMPLATE

     Constructs a new *note Template: 16a. instance from a tuple of
     strings and a tuple of interpolations and pushes the resulting
     object onto the stack:

          interpolations = STACK.pop()
          strings = STACK.pop()
          STACK.append(_build_template(strings, interpolations))

     Added in version 3.14.

 -- Opcode: BUILD_INTERPOLATION (format)

     Constructs a new *note Interpolation: 16b. instance from a value
     and its source expression and pushes the resulting object onto the
     stack.

     If no conversion or format specification is present, ‘format’ is
     set to ‘2’.

     If the low bit of ‘format’ is set, it indicates that the
     interpolation contains a format specification.

     If ‘format >> 2’ is non-zero, it indicates that the interpolation
     contains a conversion.  The value of ‘format >> 2’ is the
     conversion type (‘0’ for no conversion, ‘1’ for ‘!s’, ‘2’ for ‘!r’,
     and ‘3’ for ‘!a’):

          conversion = format >> 2
          if format & 1:
              format_spec = STACK.pop()
          else:
              format_spec = None
          expression = STACK.pop()
          value = STACK.pop()
          STACK.append(_build_interpolation(value, expression, conversion, format_spec))

     Added in version 3.14.

 -- Opcode: BUILD_TUPLE (count)

     Creates a tuple consuming 'count' items from the stack, and pushes
     the resulting tuple onto the stack:

          if count == 0:
              value = ()
          else:
              value = tuple(STACK[-count:])
              STACK = STACK[:-count]

          STACK.append(value)

 -- Opcode: BUILD_LIST (count)

     *note BUILD_TUPLE: 4cf4. と同じように動作しますが、この命令はリスト
     を作り出します。

 -- Opcode: BUILD_SET (count)

     *note BUILD_TUPLE: 4cf4. と同じように動作しますが、この命令は set を
     作り出します。

 -- Opcode: BUILD_MAP (count)

     Pushes a new dictionary object onto the stack.  Pops ‘2 * count’
     items so that the dictionary holds 'count' entries: ‘{...,
     STACK[-4]: STACK[-3], STACK[-2]: STACK[-1]}’.

     バージョン 3.5 で変更: The dictionary is created from stack items
     instead of creating an empty dictionary pre-sized to hold 'count'
     items.

 -- Opcode: BUILD_STRING (count)

     Concatenates 'count' strings from the stack and pushes the
     resulting string onto the stack.

     Added in version 3.6.

 -- Opcode: LIST_EXTEND (i)

     Implements:

          seq = STACK.pop()
          list.extend(STACK[-i], seq)

     Used to build lists.

     Added in version 3.9.

 -- Opcode: SET_UPDATE (i)

     Implements:

          seq = STACK.pop()
          set.update(STACK[-i], seq)

     Used to build sets.

     Added in version 3.9.

 -- Opcode: DICT_UPDATE (i)

     Implements:

          map = STACK.pop()
          dict.update(STACK[-i], map)

     Used to build dicts.

     Added in version 3.9.

 -- Opcode: DICT_MERGE (i)

     Like *note DICT_UPDATE: 4cf9. but raises an exception for duplicate
     keys.

     Added in version 3.9.

 -- Opcode: LOAD_ATTR (namei)

     If the low bit of ‘namei’ is not set, this replaces ‘STACK[-1]’
     with ‘getattr(STACK[-1], co_names[namei>>1])’.

     If the low bit of ‘namei’ is set, this will attempt to load a
     method named ‘co_names[namei>>1]’ from the ‘STACK[-1]’ object.
     ‘STACK[-1]’ is popped.  This bytecode distinguishes two cases: if
     ‘STACK[-1]’ has a method with the correct name, the bytecode pushes
     the unbound method and ‘STACK[-1]’.  ‘STACK[-1]’ will be used as
     the first argument (‘self’) by *note CALL: 915. or *note CALL_KW:
     372. when calling the unbound method.  Otherwise, ‘NULL’ and the
     object returned by the attribute lookup are pushed.

     バージョン 3.12 で変更: If the low bit of ‘namei’ is set, then a
     ‘NULL’ or ‘self’ is pushed to the stack before the attribute or
     unbound method respectively.

 -- Opcode: LOAD_SUPER_ATTR (namei)

     This opcode implements *note super(): 1a6, both in its
     zero-argument and two-argument forms (e.g.  ‘super().method()’,
     ‘super().attr’ and ‘super(cls, self).method()’, ‘super(cls,
     self).attr’).

     It pops three values from the stack (from top of stack down):

        * ‘self’: the first argument to the current method

        * ‘cls’: the class within which the current method was defined

        * the global ‘super’

     With respect to its argument, it works similarly to *note
     LOAD_ATTR: 704, except that ‘namei’ is shifted left by 2 bits
     instead of 1.

     The low bit of ‘namei’ signals to attempt a method load, as with
     *note LOAD_ATTR: 704, which results in pushing ‘NULL’ and the
     loaded method.  When it is unset a single value is pushed to the
     stack.

     The second-low bit of ‘namei’, if set, means that this was a
     two-argument call to *note super(): 1a6. (unset means
     zero-argument).

     Added in version 3.12.

 -- Opcode: COMPARE_OP (opname)

     Performs a Boolean operation.  The operation name can be found in
     ‘cmp_op[opname >> 5]’.  If the fifth-lowest bit of ‘opname’ is set
     (‘opname & 16’), the result should be coerced to ‘bool’.

     バージョン 3.13 で変更: The fifth-lowest bit of the oparg now
     indicates a forced conversion to *note bool: 3c3.

 -- Opcode: IS_OP (invert)

     Performs ‘is’ comparison, or ‘is not’ if ‘invert’ is 1.

     Added in version 3.9.

 -- Opcode: CONTAINS_OP (invert)

     Performs ‘in’ comparison, or ‘not in’ if ‘invert’ is 1.

     Added in version 3.9.

 -- Opcode: IMPORT_NAME (namei)

     Imports the module ‘co_names[namei]’.  ‘STACK[-1]’ and ‘STACK[-2]’
     are popped and provide the 'fromlist' and 'level' arguments of
     *note __import__(): ad1.  The module object is pushed onto the
     stack.  The current namespace is not affected: for a proper import
     statement, a subsequent *note STORE_FAST: 1a63. instruction
     modifies the namespace.

 -- Opcode: IMPORT_FROM (namei)

     Loads the attribute ‘co_names[namei]’ from the module found in
     ‘STACK[-1]’.  The resulting object is pushed onto the stack, to be
     subsequently stored by a *note STORE_FAST: 1a63. instruction.

 -- Opcode: JUMP_FORWARD (delta)

     バイトコードカウンタを 'delta' だけ増加させます。

 -- Opcode: JUMP_BACKWARD (delta)

     Decrements bytecode counter by 'delta'.  Checks for interrupts.

     Added in version 3.11.

 -- Opcode: JUMP_BACKWARD_NO_INTERRUPT (delta)

     Decrements bytecode counter by 'delta'.  Does not check for
     interrupts.

     Added in version 3.11.

 -- Opcode: POP_JUMP_IF_TRUE (delta)

     If ‘STACK[-1]’ is true, increments the bytecode counter by 'delta'.
     ‘STACK[-1]’ is popped.

     バージョン 3.11 で変更: The oparg is now a relative delta rather
     than an absolute target.  This opcode is a pseudo-instruction,
     replaced in final bytecode by the directed versions
     (forward/backward).

     バージョン 3.12 で変更: This is no longer a pseudo-instruction.

     バージョン 3.13 で変更: This instruction now requires an exact
     *note bool: 3c3. operand.

 -- Opcode: POP_JUMP_IF_FALSE (delta)

     If ‘STACK[-1]’ is false, increments the bytecode counter by
     'delta'.  ‘STACK[-1]’ is popped.

     バージョン 3.11 で変更: The oparg is now a relative delta rather
     than an absolute target.  This opcode is a pseudo-instruction,
     replaced in final bytecode by the directed versions
     (forward/backward).

     バージョン 3.12 で変更: This is no longer a pseudo-instruction.

     バージョン 3.13 で変更: This instruction now requires an exact
     *note bool: 3c3. operand.

 -- Opcode: POP_JUMP_IF_NOT_NONE (delta)

     If ‘STACK[-1]’ is not ‘None’, increments the bytecode counter by
     'delta'.  ‘STACK[-1]’ is popped.

     Added in version 3.11.

     バージョン 3.12 で変更: This is no longer a pseudo-instruction.

 -- Opcode: POP_JUMP_IF_NONE (delta)

     If ‘STACK[-1]’ is ‘None’, increments the bytecode counter by
     'delta'.  ‘STACK[-1]’ is popped.

     Added in version 3.11.

     バージョン 3.12 で変更: This is no longer a pseudo-instruction.

 -- Opcode: FOR_ITER (delta)

     ‘STACK[-1]’ is an *note iterator: 4c8.  Call its *note __next__():
     14e5. method.  If this yields a new value, push it on the stack
     (leaving the iterator below it).  If the iterator indicates it is
     exhausted then the byte code counter is incremented by 'delta'.

     バージョン 3.12 で変更: Up until 3.11 the iterator was popped when
     it was exhausted.

 -- Opcode: LOAD_GLOBAL (namei)

     ‘co_names[namei>>1]’ という名前のグローバルをスタック上にロードしま
     す。

     バージョン 3.11 で変更: If the low bit of ‘namei’ is set, then a
     ‘NULL’ is pushed to the stack before the global variable.

 -- Opcode: LOAD_FAST (var_num)

     ローカルな ‘co_varnames[var_num]’ への参照をスタックにプッシュしま
     す。

     バージョン 3.12 で変更: This opcode is now only used in situations
     where the local variable is guaranteed to be initialized.  It
     cannot raise *note UnboundLocalError: 174f.

 -- Opcode: LOAD_FAST_BORROW (var_num)

     Pushes a borrowed reference to the local ‘co_varnames[var_num]’
     onto the stack.

     Added in version 3.14.

 -- Opcode: LOAD_FAST_LOAD_FAST (var_nums)

     Pushes references to ‘co_varnames[var_nums >> 4]’ and
     ‘co_varnames[var_nums & 15]’ onto the stack.

     Added in version 3.13.

 -- Opcode: LOAD_FAST_BORROW_LOAD_FAST_BORROW (var_nums)

     Pushes borrowed references to ‘co_varnames[var_nums >> 4]’ and
     ‘co_varnames[var_nums & 15]’ onto the stack.

     Added in version 3.14.

 -- Opcode: LOAD_FAST_CHECK (var_num)

     Pushes a reference to the local ‘co_varnames[var_num]’ onto the
     stack, raising an *note UnboundLocalError: 174f. if the local
     variable has not been initialized.

     Added in version 3.12.

 -- Opcode: LOAD_FAST_AND_CLEAR (var_num)

     Pushes a reference to the local ‘co_varnames[var_num]’ onto the
     stack (or pushes ‘NULL’ onto the stack if the local variable has
     not been initialized) and sets ‘co_varnames[var_num]’ to ‘NULL’.

     Added in version 3.12.

 -- Opcode: STORE_FAST (var_num)

     Stores ‘STACK.pop()’ into the local ‘co_varnames[var_num]’.

 -- Opcode: STORE_FAST_STORE_FAST (var_nums)

     Stores ‘STACK[-1]’ into ‘co_varnames[var_nums >> 4]’ and
     ‘STACK[-2]’ into ‘co_varnames[var_nums & 15]’.

     Added in version 3.13.

 -- Opcode: STORE_FAST_LOAD_FAST (var_nums)

     Stores ‘STACK.pop()’ into the local ‘co_varnames[var_nums >> 4]’
     and pushes a reference to the local ‘co_varnames[var_nums & 15]’
     onto the stack.

     Added in version 3.13.

 -- Opcode: DELETE_FAST (var_num)

     ローカルな ‘co_varnames[var_num]’ を削除します。

 -- Opcode: MAKE_CELL (i)

     Creates a new cell in slot ‘i’.  If that slot is nonempty then that
     value is stored into the new cell.

     Added in version 3.11.

 -- Opcode: LOAD_DEREF (i)

     Loads the cell contained in slot ‘i’ of the "fast locals" storage.
     Pushes a reference to the object the cell contains on the stack.

     バージョン 3.11 で変更: ‘i’ is no longer offset by the length of
     *note co_varnames: 238b.

 -- Opcode: LOAD_FROM_DICT_OR_DEREF (i)

     Pops a mapping off the stack and looks up the name associated with
     slot ‘i’ of the "fast locals" storage in this mapping.  If the name
     is not found there, loads it from the cell contained in slot ‘i’,
     similar to *note LOAD_DEREF: 4d02.  This is used for loading *note
     closure variables: 1893. in class bodies (which previously used
     ‘LOAD_CLASSDEREF’) and in *note annotation scopes: 4ab. within
     class bodies.

     Added in version 3.12.

 -- Opcode: STORE_DEREF (i)

     Stores ‘STACK.pop()’ into the cell contained in slot ‘i’ of the
     "fast locals" storage.

     バージョン 3.11 で変更: ‘i’ is no longer offset by the length of
     *note co_varnames: 238b.

 -- Opcode: DELETE_DEREF (i)

     Empties the cell contained in slot ‘i’ of the "fast locals"
     storage.  Used by the *note del: 1b1f. statement.

     Added in version 3.2.

     バージョン 3.11 で変更: ‘i’ is no longer offset by the length of
     *note co_varnames: 238b.

 -- Opcode: COPY_FREE_VARS (n)

     Copies the ‘n’ *note free (closure) variables: 1893. from the
     closure into the frame.  Removes the need for special code on the
     caller's side when calling closures.

     Added in version 3.11.

 -- Opcode: RAISE_VARARGS (argc)

     Raises an exception using one of the 3 forms of the ‘raise’
     statement, depending on the value of 'argc':

        * 0: ‘raise’ (re-raise previous exception)

        * 1: ‘raise STACK[-1]’ (raise exception instance or type at
          ‘STACK[-1]’)

        * 2: ‘raise STACK[-2] from STACK[-1]’ (raise exception instance
          or type at ‘STACK[-2]’ with ‘__cause__’ set to ‘STACK[-1]’)

 -- Opcode: CALL (argc)

     Calls a callable object with the number of arguments specified by
     ‘argc’.  On the stack are (in ascending order):

        * The callable

        * ‘self’ or ‘NULL’

        * The remaining positional arguments

     ‘argc’ is the total of the positional arguments, excluding ‘self’.

     ‘CALL’ pops all arguments and the callable object off the stack,
     calls the callable object with those arguments, and pushes the
     return value returned by the callable object.

     Added in version 3.11.

     バージョン 3.13 で変更: The callable now always appears at the same
     position on the stack.

     バージョン 3.13 で変更: Calls with keyword arguments are now
     handled by *note CALL_KW: 372.

 -- Opcode: CALL_KW (argc)

     Calls a callable object with the number of arguments specified by
     ‘argc’, including one or more named arguments.  On the stack are
     (in ascending order):

        * The callable

        * ‘self’ or ‘NULL’

        * The remaining positional arguments

        * The named arguments

        * A *note tuple: 614. of keyword argument names

     ‘argc’ is the total of the positional and named arguments,
     excluding ‘self’.  The length of the tuple of keyword argument
     names is the number of named arguments.

     ‘CALL_KW’ pops all arguments, the keyword names, and the callable
     object off the stack, calls the callable object with those
     arguments, and pushes the return value returned by the callable
     object.

     Added in version 3.13.

 -- Opcode: CALL_FUNCTION_EX (flags)

     Calls a callable object with variable set of positional and keyword
     arguments.  If the lowest bit of 'flags' is set, the top of the
     stack contains a mapping object containing additional keyword
     arguments.  Before the callable is called, the mapping object and
     iterable object are each "unpacked" and their contents passed in as
     keyword and positional arguments respectively.  ‘CALL_FUNCTION_EX’
     pops all arguments and the callable object off the stack, calls the
     callable object with those arguments, and pushes the return value
     returned by the callable object.

     Added in version 3.6.

 -- Opcode: PUSH_NULL

     Pushes a ‘NULL’ to the stack.  Used in the call sequence to match
     the ‘NULL’ pushed by ‘LOAD_METHOD’ for non-method calls.

     Added in version 3.11.

 -- Opcode: MAKE_FUNCTION

     Pushes a new function object on the stack built from the code
     object at ‘STACK[-1]’.

     バージョン 3.10 で変更: Flag value ‘0x04’ is a tuple of strings
     instead of dictionary

     バージョン 3.11 で変更: Qualified name at ‘STACK[-1]’ was removed.

     バージョン 3.13 で変更: Extra function attributes on the stack,
     signaled by oparg flags, were removed.  They now use *note
     SET_FUNCTION_ATTRIBUTE: 4d06.

 -- Opcode: SET_FUNCTION_ATTRIBUTE (flag)

     Sets an attribute on a function object.  Expects the function at
     ‘STACK[-1]’ and the attribute value to set at ‘STACK[-2]’; consumes
     both and leaves the function at ‘STACK[-1]’.  The flag determines
     which attribute to set:

        * ‘0x01’ a tuple of default values for positional-only and
          positional-or-keyword parameters in positional order

        * ‘0x02’ a dictionary of keyword-only parameters' default values

        * ‘0x04’ a tuple of strings containing parameters' annotations

        * ‘0x08’ a tuple containing cells for free variables, making a
          closure

        * ‘0x10’ the *note annotate function: 15d. for the function
          object

     Added in version 3.13.

     バージョン 3.14 で変更: Added ‘0x10’ to indicate the annotate
     function for the function object.

 -- Opcode: BUILD_SLICE (argc)

     Pushes a slice object on the stack.  'argc' must be 2 or 3.  If it
     is 2, implements:

          end = STACK.pop()
          start = STACK.pop()
          STACK.append(slice(start, end))

     if it is 3, implements:

          step = STACK.pop()
          end = STACK.pop()
          start = STACK.pop()
          STACK.append(slice(start, end, step))

     See the *note slice(): 694. built-in function for more information.

 -- Opcode: EXTENDED_ARG (ext)

     Prefixes any opcode which has an argument too big to fit into the
     default one byte.  'ext' holds an additional byte which act as
     higher bits in the argument.  For each opcode, at most three
     prefixal ‘EXTENDED_ARG’ are allowed, forming an argument from
     two-byte to four-byte.

 -- Opcode: CONVERT_VALUE (oparg)

     Convert value to a string, depending on ‘oparg’:

          value = STACK.pop()
          result = func(value)
          STACK.append(result)

        * ‘oparg == 1’: call *note str(): 169. on 'value'

        * ‘oparg == 2’: call *note repr(): 1c1. on 'value'

        * ‘oparg == 3’: call *note ascii(): 15ff. on 'value'

     Used for implementing formatted string literals (f-strings).

     Added in version 3.13.

 -- Opcode: FORMAT_SIMPLE

     Formats the value on top of stack:

          value = STACK.pop()
          result = value.__format__("")
          STACK.append(result)

     Used for implementing formatted string literals (f-strings).

     Added in version 3.13.

 -- Opcode: FORMAT_WITH_SPEC

     Formats the given value with the given format spec:

          spec = STACK.pop()
          value = STACK.pop()
          result = value.__format__(spec)
          STACK.append(result)

     Used for implementing formatted string literals (f-strings).

     Added in version 3.13.

 -- Opcode: MATCH_CLASS (count)

     ‘STACK[-1]’ is a tuple of keyword attribute names, ‘STACK[-2]’ is
     the class being matched against, and ‘STACK[-3]’ is the match
     subject.  'count' is the number of positional sub-patterns.

     Pop ‘STACK[-1]’, ‘STACK[-2]’, and ‘STACK[-3]’.  If ‘STACK[-3]’ is
     an instance of ‘STACK[-2]’ and has the positional and keyword
     attributes required by 'count' and ‘STACK[-1]’, push a tuple of
     extracted attributes.  Otherwise, push ‘None’.

     Added in version 3.10.

     バージョン 3.11 で変更: Previously, this instruction also pushed a
     boolean value indicating success (‘True’) or failure (‘False’).

 -- Opcode: RESUME (context)

     A no-op.  Performs internal tracing, debugging and optimization
     checks.

     The ‘context’ operand consists of two parts.  The lowest two bits
     indicate where the ‘RESUME’ occurs:

        * ‘0’ The start of a function, which is neither a generator,
          coroutine nor an async generator

        * ‘1’ After a ‘yield’ expression

        * ‘2’ After a ‘yield from’ expression

        * ‘3’ After an ‘await’ expression

     The next bit is ‘1’ if the RESUME is at except-depth ‘1’, and ‘0’
     otherwise.

     Added in version 3.11.

     バージョン 3.13 で変更: The oparg value changed to include
     information about except-depth

 -- Opcode: RETURN_GENERATOR

     Create a generator, coroutine, or async generator from the current
     frame.  Used as first opcode of in code object for the above
     mentioned callables.  Clear the current frame and return the newly
     created generator.

     Added in version 3.11.

 -- Opcode: SEND (delta)

     Equivalent to ‘STACK[-1] = STACK[-2].send(STACK[-1])’.  Used in
     ‘yield from’ and ‘await’ statements.

     If the call raises *note StopIteration: df5, pop the top value from
     the stack, push the exception's ‘value’ attribute, and increment
     the bytecode counter by 'delta'.

     Added in version 3.11.

 -- Opcode: HAVE_ARGUMENT

     This is not really an opcode.  It identifies the dividing line
     between opcodes in the range [0,255] which don't use their argument
     and those that do (‘< HAVE_ARGUMENT’ and ‘>= HAVE_ARGUMENT’,
     respectively).

     If your application uses pseudo instructions or specialized
     instructions, use the *note hasarg: 59f. collection instead.

     バージョン 3.6 で変更: Now every instruction has an argument, but
     opcodes ‘< HAVE_ARGUMENT’ ignore it.  Before, only opcodes ‘>=
     HAVE_ARGUMENT’ had an argument.

     バージョン 3.12 で変更: Pseudo instructions were added to the ‘dis’
     module, and for them it is not true that comparison with
     ‘HAVE_ARGUMENT’ indicates whether they use their arg.

     バージョン 3.13 で非推奨: Use *note hasarg: 59f. instead.

 -- Opcode: CALL_INTRINSIC_1

     Calls an intrinsic function with one argument.  Passes ‘STACK[-1]’
     as the argument and sets ‘STACK[-1]’ to the result.  Used to
     implement functionality that is not performance critical.

     The operand determines which intrinsic function is called:

     Operand                                 説明
                                             
     --------------------------------------------------------------------------------
                                             
     ‘INTRINSIC_1_INVALID’                   Not valid
                                             
                                             
     ‘INTRINSIC_PRINT’                       Prints the argument to standard out.
                                             Used in the REPL.
                                             
                                             
     ‘INTRINSIC_IMPORT_STAR’                 Performs ‘import *’ for the named
                                             module.
                                             
                                             
     ‘INTRINSIC_STOPITERATION_ERROR’         Extracts the return value from a
                                             ‘StopIteration’ exception.
                                             
                                             
     ‘INTRINSIC_ASYNC_GEN_WRAP’              Wraps an async generator value
                                             
                                             
     ‘INTRINSIC_UNARY_POSITIVE’              Performs the unary ‘+’ operation
                                             
                                             
     ‘INTRINSIC_LIST_TO_TUPLE’               Converts a list to a tuple
                                             
                                             
     ‘INTRINSIC_TYPEVAR’                     Creates a *note typing.TypeVar: 486.
                                             
                                             
     ‘INTRINSIC_PARAMSPEC’                   Creates a
                                             *note typing.ParamSpec: 487.
                                             
                                             
     ‘INTRINSIC_TYPEVARTUPLE’                Creates a
                                             *note typing.TypeVarTuple: 488.
                                             
                                             
     ‘INTRINSIC_SUBSCRIPT_GENERIC’           Returns *note typing.Generic: 17b6.
                                             subscripted with the argument
                                             
                                             
     ‘INTRINSIC_TYPEALIAS’                   Creates a
                                             *note typing.TypeAliasType: 2ae.;
                                             used in the *note type: 66d.
                                             statement.  The argument is a tuple
                                             of the type alias's name, type
                                             parameters, and value.
                                             

     Added in version 3.12.

 -- Opcode: CALL_INTRINSIC_2

     Calls an intrinsic function with two arguments.  Used to implement
     functionality that is not performance critical:

          arg2 = STACK.pop()
          arg1 = STACK.pop()
          result = intrinsic2(arg1, arg2)
          STACK.append(result)

     The operand determines which intrinsic function is called:

     Operand                                      説明
                                                  
     -------------------------------------------------------------------------------------
                                                  
     ‘INTRINSIC_2_INVALID’                        Not valid
                                                  
                                                  
     ‘INTRINSIC_PREP_RERAISE_STAR’                Calculates the
                                                  *note ExceptionGroup: 4d2. to raise
                                                  from a ‘try-except*’.
                                                  
                                                  
     ‘INTRINSIC_TYPEVAR_WITH_BOUND’               Creates a *note typing.TypeVar: 486.
                                                  with a bound.
                                                  
                                                  
     ‘INTRINSIC_TYPEVAR_WITH_CONSTRAINTS’         Creates a *note typing.TypeVar: 486.
                                                  with constraints.
                                                  
                                                  
     ‘INTRINSIC_SET_FUNCTION_TYPE_PARAMS’         Sets the ‘__type_params__’ attribute
                                                  of a function.
                                                  

     Added in version 3.12.

 -- Opcode: LOAD_SPECIAL

     Performs special method lookup on ‘STACK[-1]’.  If
     ‘type(STACK[-1]).__xxx__’ is a method, leave
     ‘type(STACK[-1]).__xxx__; STACK[-1]’ on the stack.  If
     ‘type(STACK[-1]).__xxx__’ is not a method, leave
     ‘STACK[-1].__xxx__; NULL’ on the stack.

     Added in version 3.14.

'Pseudo-instructions'

These opcodes do not appear in Python bytecode.  They are used by the
compiler but are replaced by real opcodes or removed before bytecode is
generated.

 -- Opcode: SETUP_FINALLY (target)

     Set up an exception handler for the following code block.  If an
     exception occurs, the value stack level is restored to its current
     state and control is transferred to the exception handler at
     ‘target’.

 -- Opcode: SETUP_CLEANUP (target)

     Like ‘SETUP_FINALLY’, but in case of an exception also pushes the
     last instruction (‘lasti’) to the stack so that ‘RERAISE’ can
     restore it.  If an exception occurs, the value stack level and the
     last instruction on the frame are restored to their current state,
     and control is transferred to the exception handler at ‘target’.

 -- Opcode: SETUP_WITH (target)

     Like ‘SETUP_CLEANUP’, but in case of an exception one more item is
     popped from the stack before control is transferred to the
     exception handler at ‘target’.

     This variant is used in *note with: 186. and *note async with: 185.
     constructs, which push the return value of the context manager's
     *note __enter__(): 7e4. or *note __aenter__(): 241d. to the stack.

 -- Opcode: POP_BLOCK

     Marks the end of the code block associated with the last
     ‘SETUP_FINALLY’, ‘SETUP_CLEANUP’ or ‘SETUP_WITH’.

 -- Opcode: LOAD_CONST_IMMORTAL (consti)

     Works as *note LOAD_CONST: 4cf2, but is more efficient for immortal
     objects.

 -- Opcode: JUMP
 -- Opcode: JUMP_NO_INTERRUPT

     Undirected relative jump instructions which are replaced by their
     directed (forward/backward) counterparts by the assembler.

 -- Opcode: JUMP_IF_TRUE
 -- Opcode: JUMP_IF_FALSE

     Conditional jumps which do not impact the stack.  Replaced by the
     sequence ‘COPY 1’, ‘TO_BOOL’, ‘POP_JUMP_IF_TRUE/FALSE’.

 -- Opcode: LOAD_CLOSURE (i)

     Pushes a reference to the cell contained in slot ‘i’ of the "fast
     locals" storage.

     Note that ‘LOAD_CLOSURE’ is replaced with ‘LOAD_FAST’ in the
     assembler.

     バージョン 3.13 で変更: This opcode is now a pseudo-instruction.


File: python.info,  Node: 命令コードコレクション,  Prev: Python バイトコード命令,  Up: dis --- Python バイトコードの逆アセンブラー

5.32.10.5 命令コードコレクション
................................

これらのコレクションは、自動でバイトコード命令を解析するために提供されて
います:

バージョン 3.12 で変更: The collections now contain pseudo instructions
and instrumented instructions as well.  These are opcodes with values
‘>= MIN_PSEUDO_OPCODE’ and ‘>= MIN_INSTRUMENTED_OPCODE’.

 -- データ: dis.opname

     命令コード名のリスト。 バイトコードをインデックスに使って参照できま
     す。

 -- データ: dis.opmap

     命令コード名をバイトコードに対応づける辞書。

 -- データ: dis.cmp_op

     すべての比較命令の名前のリスト。

 -- データ: dis.hasarg

     Sequence of bytecodes that use their argument.

     Added in version 3.12.

 -- データ: dis.hasconst

     定数にアクセスするバイトコードのリスト。

 -- データ: dis.hasfree

     Sequence of bytecodes that access a *note free (closure) variable:
     1893.  'free' in this context refers to names in the current scope
     that are referenced by inner scopes or names in outer scopes that
     are referenced from this scope.  It does 'not' include references
     to global or builtin scopes.

 -- データ: dis.hasname

     名前によって属性にアクセスするバイトコードのリスト。

 -- データ: dis.hasjump

     Sequence of bytecodes that have a jump target.  All jumps are
     relative.

     Added in version 3.13.

 -- データ: dis.haslocal

     ローカル変数にアクセスするバイトコードのリスト。

 -- データ: dis.hascompare

     ブール命令のバイトコードのリスト。

 -- データ: dis.hasexc

     Sequence of bytecodes that set an exception handler.

     Added in version 3.12.

 -- データ: dis.hasjrel

     相対ジャンプ先を持つバイトコードのリスト。

     バージョン 3.13 で非推奨: All jumps are now relative.  Use *note
     hasjump: 4d16.

 -- データ: dis.hasjabs

     絶対ジャンプ先を持つバイトコードのリスト。

     バージョン 3.13 で非推奨: All jumps are now relative.  This list is
     empty.


File: python.info,  Node: pickletools --- pickle 開発者用のツール群,  Prev: dis --- Python バイトコードの逆アセンブラー,  Up: Python言語サービス

5.32.11 ‘pickletools’ -- pickle 開発者用のツール群
--------------------------------------------------

'ソースコード:' Lib/pickletools.py(1)

__________________________________________________________________

This module contains various constants relating to the intimate details
of the *note pickle: ab. module, some lengthy comments about the
implementation, and a few useful functions for analyzing pickled data.
The contents of this module are useful for Python core developers who
are working on the *note pickle: ab.; ordinary users of the *note
pickle: ab. module probably won't find the ‘pickletools’ module
relevant.

* Menu:

* コマンドラインでの使用: コマンドラインでの使用<10>.
* Programmatic interface::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/pickletools.py


File: python.info,  Node: コマンドラインでの使用<10>,  Next: Programmatic interface,  Up: pickletools --- pickle 開発者用のツール群

5.32.11.1 コマンドラインでの使用
................................

Added in version 3.2.

コマンドラインから実行するとき、‘python -m pickletools’ は 1 つもしくは
複数の pickle ファイルの内容を逆アセンブルします。pickle 形式の詳細では
なく pickle に保存された Python オブジェクトを見たい場合は、そのコマンド
ではなく ‘-m pickle’ を使いたいと思うかもしれません。しかし、調べたい
pickle ファイルが信頼できないソースから来たものであるとき、‘-m
pickletools’ は pickle のバイトコードを実行しないので、より安全な選択肢
です。

例えば、 ‘x.pickle’ ファイルに pickle 化されているタプル ‘(1, 2)’ に対し
て実行すると次のようになります:

     $ python -m pickle x.pickle
     (1, 2)

     $ python -m pickletools x.pickle
         0: \x80 PROTO      3
         2: K    BININT1    1
         4: K    BININT1    2
         6: \x86 TUPLE2
         7: q    BINPUT     0
         9: .    STOP
     highest protocol among opcodes = 2

* Menu:

* コマンドラインオプション: コマンドラインオプション<6>.


File: python.info,  Node: コマンドラインオプション<6>,  Up: コマンドラインでの使用<10>

5.32.11.2 コマンドラインオプション
..................................

 -- Option: -a, --annotate

     注釈として短い命令コードの説明を各行に表示します。

 -- Option: -o, --output=<file>

     出力結果を書き込むファイル名。

 -- Option: -l, --indentlevel=<num>

     新しい MARK レベルのインデントに使われる空白の数。

 -- Option: -m, --memo

     複数のオブジェクトが逆アセンブルされたとき、逆アセンブリ間でメモを
     保持します。

 -- Option: -p, --preamble=<preamble>

     When more than one pickle file is specified, print given preamble
     before each disassembly.

 -- Option: pickle_file

     A pickle file to read, or ‘-’ to indicate reading from standard
     input.


File: python.info,  Node: Programmatic interface,  Prev: コマンドラインでの使用<10>,  Up: pickletools --- pickle 開発者用のツール群

5.32.11.3 Programmatic interface
................................

 -- の関数: pickletools.dis (pickle, out=None, memo=None, indentlevel=4,
          annotate=0)

     pickle の抽象的な逆アセンブリを file-like オブジェクト 'out' (デフ
     ォルトは ‘sys.stdout’) に出力します。'pickle' は文字列または
     file-like オブジェクトです。'memo' は Python の辞書で、pickle のメ
     モとして使われます; これは、pickle 処理を行う 1 つのオブジェクトが
     、複数の pickle にわたって逆アセンブルを行うために使われます。スト
     リーム上の ‘MARK’ 命令コードが示す後続のレベルは、'indentlevel' 個
     の空白でインデントされます。'annotate' に非ゼロの値が与えられた場合
     、出力される各命令コードは短い命令コードに注釈が付けられます。
     'annotate' の値は、注釈の先頭の位置のヒントとして使われます。

     バージョン 3.2 で変更: 'annotate' パラメーターを追加しました。

 -- の関数: pickletools.genops (pickle)

     pickle 内の全ての opcode を取り出す *note イテレータ: 4c8. を返しま
     す。このイテレータは ‘(opcode, arg, pos)’ の三つ組みからなる配列を
     返します。 'opcode' は ‘OpcodeInfo’ クラスのインスタンスのクラスで
     す。 'arg' は 'opcode' の引数としてデコードされた Python オブジェク
     トの値です。 'pos' は 'opcode' の場所を表す値です。 'pickle' は文字
     列でもファイル類似オブジェクトでもかまいません。

 -- の関数: pickletools.optimize (picklestring)

     使われていない ‘PUT’ 命令コードを除去した上で、その新しい pickle 文
     字列を返します。最適化された pickle は、長さがより短く、転送時間が
     より少なく、必要とするストレージ領域がより狭く、unpickle 化がより効
     率的になります。


File: python.info,  Node: MS Windows 固有のサービス,  Next: Unix-specific services,  Prev: Python言語サービス,  Up: Python 標準ライブラリ

5.33 MS Windows 固有のサービス
==============================

この章では、MS Windows プラットフォーム上でのみ利用可能なモジュール群に
ついて記述します。

* Menu:

* msvcrt: msvcrt --- MS VC++ ランタイムの有用なルーチン群. MS VC++ ランタイムの有用なルーチン群
* winreg: winreg --- Windows レジストリへのアクセス. Windows レジストリへのアクセス
* winsound: winsound --- Windows 用の音声再生インターフェース. Windows 用の音声再生インターフェース


File: python.info,  Node: msvcrt --- MS VC++ ランタイムの有用なルーチン群,  Next: winreg --- Windows レジストリへのアクセス,  Up: MS Windows 固有のサービス

5.33.1 ‘msvcrt’ -- MS VC++ ランタイムの有用なルーチン群
-------------------------------------------------------

__________________________________________________________________

このモジュールの関数は、 Windows プラットフォームの便利な機能のいくつか
に対するアクセス機構を提供しています。高レベルモジュールのいくつかは、提
供するサービスを Windows で実装するために、これらの関数を使っています。
例えば、 *note getpass: 66. モジュールは関数 *note getpass(): 66. を実装
するためにこのモジュールの関数を使います。

ここに挙げた関数の詳細なドキュメントについては、プラットフォーム API ド
キュメントで見つけることができます。

このモジュールは、通常版とワイド文字列版の両方のコンソールI/O APIを実装
しています。通常版の API は ASCII 文字列のためのもので、国際化アプリケー
ションでは利用が制限されます。可能な限りワイド文字列版APIを利用するべき
です。

*note Availability: 213f.: Windows.

バージョン 3.3 で変更: このモジュールの操作で以前は *note IOError: 125e.
が送出されていたところで *note OSError: 2c0. が送出されるようになりまし
た。

* Menu:

* ファイル操作関連::
* コンソール I/O 関連::
* その多の関数::


File: python.info,  Node: ファイル操作関連,  Next: コンソール I/O 関連,  Up: msvcrt --- MS VC++ ランタイムの有用なルーチン群

5.33.1.1 ファイル操作関連
.........................

 -- の関数: msvcrt.locking (fd, mode, nbytes)

     Lock part of a file based on file descriptor 'fd' from the C
     runtime.  Raises *note OSError: 2c0. on failure.  The locked region
     of the file extends from the current file position for 'nbytes'
     bytes, and may continue beyond the end of the file.  'mode' must be
     one of the ‘LK_*’ constants listed below.  Multiple regions in a
     file may be locked at the same time, but may not overlap.  Adjacent
     regions are not merged; they must be unlocked individually.

     引数 ‘fd’, ‘mode’, ‘nbytes’ を指定して *note 監査イベント: 1c6e.
     ‘msvcrt.locking’ を送出します。

 -- データ: msvcrt.LK_LOCK
 -- データ: msvcrt.LK_RLCK

     Locks the specified bytes.  If the bytes cannot be locked, the
     program immediately tries again after 1 second.  If, after 10
     attempts, the bytes cannot be locked, *note OSError: 2c0. is
     raised.

 -- データ: msvcrt.LK_NBLCK
 -- データ: msvcrt.LK_NBRLCK

     指定されたバイト列にロックをかけます。指定領域がロックできなかった
     場合、 *note OSError: 2c0. が送出されます。

 -- データ: msvcrt.LK_UNLCK

     指定されたバイト列のロックを解除します。指定領域はあらかじめロック
     されていなければなりません。

 -- の関数: msvcrt.setmode (fd, flags)

     ファイル記述子 'fd' に対して、行末文字の変換モードを設定します。テ
     キストモードに設定するには、 'flags' を *note os.O_TEXT: 3054. にし
     ます; バイナリモードにするには *note os.O_BINARY: 3045. にします。

 -- の関数: msvcrt.open_osfhandle (handle, flags)

     Create a C runtime file descriptor from the file handle 'handle'.
     The 'flags' parameter should be a bitwise OR of *note os.O_APPEND:
     3047, *note os.O_RDONLY: 3043, *note os.O_TEXT: 3054. and *note
     os.O_NOINHERIT: 304f.  The returned file descriptor may be used as
     a parameter to *note os.fdopen(): 2381. to create a file object.

     The file descriptor is inheritable by default.  Pass *note
     os.O_NOINHERIT: 304f. flag to make it non inheritable.

     引数 ‘handle’, ‘flags’ を指定して *note 監査イベント: 1c6e.
     ‘msvcrt.open_osfhandle’ を送出します。

 -- の関数: msvcrt.get_osfhandle (fd)

     Return the file handle for the file descriptor 'fd'.  Raises *note
     OSError: 2c0. if 'fd' is not recognized.

     引数 ‘fd’ を指定して *note 監査イベント: 1c6e.
     ‘msvcrt.get_osfhandle’ を送出します。


File: python.info,  Node: コンソール I/O 関連,  Next: その多の関数,  Prev: ファイル操作関連,  Up: msvcrt --- MS VC++ ランタイムの有用なルーチン群

5.33.1.2 コンソール I/O 関連
............................

 -- の関数: msvcrt.kbhit ()

     Returns a nonzero value if a keypress is waiting to be read.
     Otherwise, return 0.

 -- の関数: msvcrt.getch ()

     Read a keypress and return the resulting character as a byte
     string.  Nothing is echoed to the console.  This call will block if
     a keypress is not already available, but will not wait for ‘Enter’
     to be pressed.  If the pressed key was a special function key, this
     will return ‘'\000'’ or ‘'\xe0'’; the next call will return the
     keycode.  The ‘Control’-‘C’ keypress cannot be read with this
     function.

 -- の関数: msvcrt.getwch ()

     *note getch(): 4d3d. のワイド文字列版。Unicode の値を返します。

 -- の関数: msvcrt.getche ()

     Similar to *note getch(): 4d3d, but the keypress will be echoed if
     it represents a printable character.

 -- の関数: msvcrt.getwche ()

     *note getche(): 4d3e. のワイド文字列版。Unicode の値を返します。

 -- の関数: msvcrt.putch (char)

     バイト文字列 'char' をバッファリングを行わないでコンソールに出力し
     ます。

 -- の関数: msvcrt.putwch (unicode_char)

     *note putch(): 4d3f. のワイド文字列版。Unicode の値を引数に取ります
     。

 -- の関数: msvcrt.ungetch (char)

     バイト文字列 'char' をコンソールバッファに "押し戻し (push back)" ま
     す; これにより、押し戻された文字は *note getch(): 4d3d. や *note
     getche(): 4d3e. で次に読み出される文字になります。

 -- の関数: msvcrt.ungetwch (unicode_char)

     *note ungetch(): 4d40. のワイド文字列版。Unicode の値を引数に取りま
     す。


File: python.info,  Node: その多の関数,  Prev: コンソール I/O 関連,  Up: msvcrt --- MS VC++ ランタイムの有用なルーチン群

5.33.1.3 その多の関数
.....................

 -- の関数: msvcrt.heapmin ()

     Force the ‘malloc()’ heap to clean itself up and return unused
     blocks to the operating system.  On failure, this raises *note
     OSError: 2c0.

 -- の関数: msvcrt.set_error_mode (mode)

     Changes the location where the C runtime writes an error message
     for an error that might end the program.  'mode' must be one of the
     ‘OUT_*’ constants listed below or *note REPORT_ERRMODE: 4d46.
     Returns the old setting or -1 if an error occurs.  Only available
     in *note debug build of Python: 509.

 -- データ: msvcrt.OUT_TO_DEFAULT

     Error sink is determined by the app's type.  Only available in
     *note debug build of Python: 509.

 -- データ: msvcrt.OUT_TO_STDERR

     Error sink is a standard error.  Only available in *note debug
     build of Python: 509.

 -- データ: msvcrt.OUT_TO_MSGBOX

     Error sink is a message box.  Only available in *note debug build
     of Python: 509.

 -- データ: msvcrt.REPORT_ERRMODE

     Report the current error mode value.  Only available in *note debug
     build of Python: 509.

 -- の関数: msvcrt.CrtSetReportMode (type, mode)

     Specifies the destination or destinations for a specific report
     type generated by ‘_CrtDbgReport()’ in the MS VC++ runtime.  'type'
     must be one of the ‘CRT_*’ constants listed below.  'mode' must be
     one of the ‘CRTDBG_*’ constants listed below.  Only available in
     *note debug build of Python: 509.

 -- の関数: msvcrt.CrtSetReportFile (type, file)

     After you use *note CrtSetReportMode(): 4d4a. to specify *note
     CRTDBG_MODE_FILE: 4d4c, you can specify the file handle to receive
     the message text.  'type' must be one of the ‘CRT_*’ constants
     listed below.  'file' should be the file handle your want
     specified.  Only available in *note debug build of Python: 509.

 -- データ: msvcrt.CRT_WARN

     Warnings, messages, and information that doesn't need immediate
     attention.

 -- データ: msvcrt.CRT_ERROR

     Errors, unrecoverable problems, and issues that require immediate
     attention.

 -- データ: msvcrt.CRT_ASSERT

     Assertion failures.

 -- データ: msvcrt.CRTDBG_MODE_DEBUG

     Writes the message to the debugger's output window.

 -- データ: msvcrt.CRTDBG_MODE_FILE

     Writes the message to a user-supplied file handle.  *note
     CrtSetReportFile(): 4d4b. should be called to define the specific
     file or stream to use as the destination.

 -- データ: msvcrt.CRTDBG_MODE_WNDW

     Creates a message box to display the message along with the
     ‘Abort’, ‘Retry’, and ‘Ignore’ buttons.

 -- データ: msvcrt.CRTDBG_REPORT_MODE

     Returns current 'mode' for the specified 'type'.

 -- データ: msvcrt.CRT_ASSEMBLY_VERSION

     The CRT Assembly version, from the ‘crtassem.h’ header file.

 -- データ: msvcrt.VC_ASSEMBLY_PUBLICKEYTOKEN

     The VC Assembly public key token, from the ‘crtassem.h’ header
     file.

 -- データ: msvcrt.LIBRARIES_ASSEMBLY_NAME_PREFIX

     The Libraries Assembly name prefix, from the ‘crtassem.h’ header
     file.


File: python.info,  Node: winreg --- Windows レジストリへのアクセス,  Next: winsound --- Windows 用の音声再生インターフェース,  Prev: msvcrt --- MS VC++ ランタイムの有用なルーチン群,  Up: MS Windows 固有のサービス

5.33.2 ‘winreg’ -- Windows レジストリへのアクセス
-------------------------------------------------

__________________________________________________________________

これらの関数は Windows レジストリ API を Python から使えるようにします。
プログラマがレジストリハンドルを明示的にクローズするのを忘れた場合でも、
確実にハンドルがクローズされるようにするために、レジストリハンドルとして
整数値ではなく *note ハンドルオブジェクト: 4d56. が使われます。

*note Availability: 213f.: Windows.

バージョン 3.3 で変更: このモジュールのいくつかの関数は以前は *note
WindowsError: 1260. を送出していました。それは今では *note OSError: 2c0.
の別名です。

* Menu:

* 関数: 関数<14>.
* 定数: 定数<11>.
* レジストリハンドルオブジェクト::


File: python.info,  Node: 関数<14>,  Next: 定数<11>,  Up: winreg --- Windows レジストリへのアクセス

5.33.2.1 関数
.............

このモジュールでは以下の関数を提供します:

 -- の関数: winreg.CloseKey (hkey)

     以前開かれたレジストリキーを閉じます。'hkey' 引数は以前開かれたレジ
     ストリキーを指定します。

          注釈: このメソッドを使って (または *note hkey.Close(): 4d5b. に
          よって) 'hkey' が閉じられなかった場合、Python が 'hkey' オブジ
          ェクトを破壊する際に閉じられます。

 -- の関数: winreg.ConnectRegistry (computer_name, key)

     他のコンピュータ上にある事前に定義されたレジストリハンドルとの接続
     を確立し、 *note ハンドルオブジェクト: 4d56. を返します。

     'computer_name' はリモートコンピュータの名前で、‘r"\\computername"’
     の形式をとります。‘None’ の場合、ローカルのコンピュータが使われます
     。

     'key' は、事前に定義された接続先のハンドルです。

     戻り値は開かれたキーのハンドルです。関数が失敗した場合、 *note
     OSError: 2c0. 例外が送出されます。

     引数 ‘computer_name’, ‘key’ を指定して *note 監査イベント: 1c6e.
     ‘winreg.ConnectRegistry’ を送出します。

     バージョン 3.3 で変更: *note 上記: 4d57. を参照。

 -- の関数: winreg.CreateKey (key, sub_key)

     指定されたキーを生成するか開き、 *note ハンドルオブジェクト: 4d56.
     を返します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     'sub_key' はこのメソッドが開く、または新規作成するキーの名前です。

     'key' が事前に定義されたキーのうちの一つなら、'sub_key' は ‘None’ で
     かまいません。その場合、この関数に渡されるキーハンドルと同じハンド
     ルが返されます。

     キーがすでに存在する場合、この関数はその既存のキーを開きます。

     戻り値は開かれたキーのハンドルです。関数が失敗した場合、 *note
     OSError: 2c0. 例外が送出されます。

     引数 ‘key’, ‘sub_key’, ‘access’ を指定して *note 監査イベント:
     1c6e. ‘winreg.CreateKey’ を送出します。

     引数 ‘key’ を指定して *note 監査イベント: 1c6e.
     ‘winreg.OpenKey/result’ を送出します。

     バージョン 3.3 で変更: *note 上記: 4d57. を参照。

 -- の関数: winreg.CreateKeyEx (key, sub_key, reserved=0,
          access=KEY_WRITE)

     指定されたキーを生成するか開き、 *note ハンドルオブジェクト: 4d56.
     を返します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     'sub_key' はこのメソッドが開く、または新規作成するキーの名前です。

     'reserved' は予約された整数で、 0 でなくてはなりません。デフォルト
     値は 0 です。

     'access' は、 key に対して想定されるセキュリティアクセスを示すアク
     セスマスクを指定する整数です。デフォルトは *note KEY_WRITE: 4d5d. で
     す。その他の利用可能な値については *note アクセス権: 4d5e. を参照し
     てください。

     'key' が事前に定義されたキーのうちの一つなら、'sub_key' は ‘None’ で
     かまいません。その場合、この関数に渡されるキーハンドルと同じハンド
     ルが返されます。

     キーがすでに存在する場合、この関数はその既存のキーを開きます。

     戻り値は開かれたキーのハンドルです。関数が失敗した場合、 *note
     OSError: 2c0. 例外が送出されます。

     引数 ‘key’, ‘sub_key’, ‘access’ を指定して *note 監査イベント:
     1c6e. ‘winreg.CreateKey’ を送出します。

     引数 ‘key’ を指定して *note 監査イベント: 1c6e.
     ‘winreg.OpenKey/result’ を送出します。

     Added in version 3.2.

     バージョン 3.3 で変更: *note 上記: 4d57. を参照。

 -- の関数: winreg.DeleteKey (key, sub_key)

     指定されたキーを削除します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     'sub_key' は文字列で、'key' 引数によって指定されたキーのサブキーで
     なければなりません。この値は ‘None’ であってはならず、キーはサブキ
     ーを持っていなくてもかまいません。

     'このメソッドはサブキーをもつキーを削除することはできません。'

     このメソッドの実行が成功すると、キー全体が、その値すべてを含めて削
     除されます。このメソッドが失敗した場合、 *note OSError: 2c0. 例外が
     送出されます。

     Raises an *note auditing event: 1c6e. ‘winreg.DeleteKey’ with
     arguments ‘key’, ‘sub_key’, ‘access’.

     バージョン 3.3 で変更: *note 上記: 4d57. を参照。

 -- の関数: winreg.DeleteKeyEx (key, sub_key, access=KEY_WOW64_64KEY,
          reserved=0)

     指定されたキーを削除します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     'sub_key' は 'key' 引数によって指定された key の subkey でなければ
     なりません。この値は ‘None’ であってはなりません。また、key は
     subkey を持たないかもしれません。

     'reserved' は予約された整数で、 0 でなくてはなりません。デフォルト
     値は 0 です。

     'access' は、 key に対して想定されるセキュリティアクセスを示すアク
     セスマスクを指定する整数です。デフォルトは *note KEY_WOW64_64KEY:
     4d5f. です。32 bit Windows では、WOW64 定数は無視されます。その他の
     利用可能な値については *note アクセス権: 4d5e. を参照してください。

     'このメソッドはサブキーをもつキーを削除することはできません。'

     このメソッドの実行が成功すると、キー全体が、その値すべてを含めて削
     除されます。このメソッドが失敗した場合、 *note OSError: 2c0. 例外が
     送出されます。

     サポートされていない Windows バージョンでは、 *note
     NotImplementedError: 36b. 例外を発生させます。

     Raises an *note auditing event: 1c6e. ‘winreg.DeleteKey’ with
     arguments ‘key’, ‘sub_key’, ‘access’.

     Added in version 3.2.

     バージョン 3.3 で変更: *note 上記: 4d57. を参照。

 -- の関数: winreg.DeleteValue (key, value)

     レジストリキーから指定された名前つきの値を削除します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     'value' は削除したい値を指定するための文字列です。

     引数 ‘key’, ‘value’ を指定して *note 監査イベント: 1c6e.
     ‘winreg.DeleteValue’ を送出します。

 -- の関数: winreg.EnumKey (key, index)

     開かれているレジストリキーのサブキーを列挙し、文字列で返します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     'index' は整数値で、取得するキーのインデクスを指定します。

     この関数は、呼び出されるたびに一つのサブキーの名前を取得します。こ
     の関数は通常、これ以上値がないことを示す *note OSError: 2c0. 例外が
     送出されるまで繰り返し呼び出されます。

     引数 ‘key’, ‘index’ を指定して *note 監査イベント: 1c6e.
     ‘winreg.EnumKey’ を送出します。

     バージョン 3.3 で変更: *note 上記: 4d57. を参照。

 -- の関数: winreg.EnumValue (key, index)

     開かれているレジストリキーの値を列挙し、タプルで返します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     'index' は整数値で、取得する値のインデクスを指定します。

     この関数は、呼び出されるたびに一つのサブキーの名前を取得します。こ
     の関数は通常、これ以上値がないことを示す *note OSError: 2c0. 例外が
     送出されるまで繰り返し呼び出されます。

     結果は 3 要素のタプルになります:

     インデッ    意味
     クス        

     -------------------------------------------------------------
                 
     ‘0’         値の名前を指定する文字列
                 
                 
     ‘1’         値のデータを保持するためのオブジェクトで、その
                 型は背後のレジストリ型に依存します
                 
                 
     ‘2’         値のデータ型を指定する整数です
                 (*note SetValueEx(): 1b03. のドキュメント内の
                 テーブルを参照してください)
                 

     引数 ‘key’, ‘index’ を指定して *note 監査イベント: 1c6e.
     ‘winreg.EnumValue’ を送出します。

     バージョン 3.3 で変更: *note 上記: 4d57. を参照。

 -- の関数: winreg.ExpandEnvironmentStrings (str)

     *note REG_EXPAND_SZ: 4d60. のように、環境変数プレースホルダ
     ‘%NAME%’ を文字列で展開します:

          >>> ExpandEnvironmentStrings('%windir%')
          'C:\\Windows'

     引数 ‘str’ を指定して *note 監査イベント: 1c6e.
     ‘winreg.ExpandEnvironmentStrings’ を送出します。

 -- の関数: winreg.FlushKey (key)

     キーのすべての属性をレジストリに書き込みます。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     キーを変更するために *note FlushKey(): 4d61. を呼ぶ必要はありません
     。レジストリの変更は怠惰なフラッシュ機構 (lazy flusher) を使ってフ
     ラッシュされます。また、システムの遮断時にもディスクにフラッシュさ
     れます。 *note CloseKey(): 4d5a. と違って、 *note FlushKey(): 4d61.
     メソッドはレジストリに全てのデータを書き終えたときにのみ返ります。
     アプリケーションは、レジストリへの変更を絶対に確実にディスク上に反
     映させる必要がある場合にのみ、 *note FlushKey(): 4d61. を呼ぶべきで
     す。

          注釈: *note FlushKey(): 4d61. を呼び出す必要があるかどうか分か
          らない場合、おそらくその必要はありません。

 -- の関数: winreg.LoadKey (key, sub_key, file_name)

     指定されたキーの下にサブキーを生成し、サブキーに指定されたファイル
     のレジストリ情報を記録します。

     'key' は *note ConnectRegistry(): 4764. が返したハンドルか、定数
     *note HKEY_USERS: 4d62. と *note HKEY_LOCAL_MACHINE: 4d63. のどちら
     かです。

     'sub_key' は記録先のサブキーを指定する文字列です。

     'file_name' はレジストリデータを読み出すためのファイル名です。この
     ファイルは *note SaveKey(): 476f. 関数で生成されたファイルでなくて
     はなりません。ファイル割り当てテーブル (FAT) ファイルシステム下では
     、ファイル名は拡張子を持っていてはなりません。

     A call to *note LoadKey(): 476a. fails if the calling process does
     not have the ‘SE_RESTORE_PRIVILEGE’ privilege.  Note that
     privileges are different from permissions - see the RegLoadKey
     documentation(1) for more details.

     'key' が *note ConnectRegistry(): 4764. によって返されたハンドルの
     場合、 'file_name' に指定されたパスはリモートコンピュータに対する相
     対パス名になります。

     引数 ‘key’, ‘sub_key’, ‘file_name’ を指定して *note 監査イベント:
     1c6e. ‘winreg.LoadKey’ を送出します。

 -- の関数: winreg.OpenKey (key, sub_key, reserved=0, access=KEY_READ)
 -- の関数: winreg.OpenKeyEx (key, sub_key, reserved=0, access=KEY_READ)

     指定されたキーを開き、 *note ハンドルオブジェクト: 4d56. を返します
     。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     'sub_key' は開くサブキーを指定する文字列です。

     'reserved' は予約された整数で、 0 でなくてはなりません。デフォルト
     値は 0 です。

     'access' は、 key に対して想定されるセキュリティアクセスを示すアク
     セスマスクを指定する整数です。デフォルトは *note KEY_READ: 4d65. で
     す。その他の利用可能な値については *note アクセス権: 4d5e. を参照し
     てください。

     指定されたキーへの新しいハンドルが返されます。

     この関数が失敗すると、 *note OSError: 2c0. が送出されます。

     引数 ‘key’, ‘sub_key’, ‘access’ を指定して *note 監査イベント:
     1c6e. ‘winreg.OpenKey’ を送出します。

     引数 ‘key’ を指定して *note 監査イベント: 1c6e.
     ‘winreg.OpenKey/result’ を送出します。

     バージョン 3.2 で変更: 名前付き引数が使用できるようになりました。

     バージョン 3.3 で変更: *note 上記: 4d57. を参照。

 -- の関数: winreg.QueryInfoKey (key)

     キーに関する情報をタプルとして返します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     結果は 3 要素のタプルになります:

     インデッ    意味
     クス        

     --------------------------------------------------------------
                 
     ‘0’         このキーが持つサブキーの数を表す整数。
                 
                 
     ‘1’         このキーが持つ値の数を表す整数。
                 
                 
     ‘2’         最後のキーの変更が (あれば) いつだったかを表す
                 整数で、1601 年 1 月 1 日からの 100 ナノ秒単位
                 で数えたもの。
                 

     引数 ‘key’ を指定して *note 監査イベント: 1c6e.
     ‘winreg.QueryInfoKey’ を送出します。

 -- の関数: winreg.QueryValue (key, sub_key)

     キーに対する、名前付けられていない値を文字列で取得します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     'sub_key' は値が関連付けられているサブキーの名前を保持する文字列で
     す。この引数が ‘None’ または空文字列の場合、この関数は 'key' で指定
     されたキーに対して *note SetValue(): 4770. メソッドで設定された値を
     取得します。

     レジストリ中の値は名前、型、およびデータから構成されています。この
     メソッドはあるキーのデータ中で、名前 ‘NULL’ をもつ最初の値を取得し
     ます。しかし背後のAPI 呼び出しは型情報を返しません。なので、可能な
     らいつでも *note QueryValueEx(): 1784. を使うべきです。

     引数 ‘key’, ‘sub_key’, ‘value_name’ を指定して *note 監査イベント:
     1c6e. ‘winreg.QueryValue’ を送出します。

 -- の関数: winreg.QueryValueEx (key, value_name)

     開かれたレジストリキーに関連付けられている、指定した名前の値に対し
     て、型およびデータを取得します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     'value_name' は要求する値を指定する文字列です。

     結果は 2 つの要素からなるタプルです:

     インデッ    意味
     クス        

     ----------------------------------------------------------
                 
     ‘0’         レジストリ要素の値。
                 
                 
     ‘1’         この値のレジストリ型を表す整数。
                 (*note SetValueEx(): 1b03. のドキュメント内
                 のテーブルを参照してください。)
                 

     引数 ‘key’, ‘sub_key’, ‘value_name’ を指定して *note 監査イベント:
     1c6e. ‘winreg.QueryValue’ を送出します。

 -- の関数: winreg.SaveKey (key, file_name)

     指定されたキーと、そのサブキー全てを指定したファイルに保存します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     'file_name' はレジストリデータを保存するファイルの名前です、このフ
     ァイルはすでに存在していてはいけません。このファイル名が拡張子を含
     んでいる場合、 *note LoadKey(): 476a. メソッドは、FAT ファイルシス
     テムを使うことができません。

     If 'key' represents a key on a remote computer, the path described
     by 'file_name' is relative to the remote computer.  The caller of
     this method must possess the 'SeBackupPrivilege' security
     privilege.  Note that privileges are different than permissions -
     see the Conflicts Between User Rights and Permissions
     documentation(2) for more details.

     この関数は 'security_attributes' を ‘NULL’ にして API に渡します。

     引数 ‘key’, ‘file_name’ を指定して *note 監査イベント: 1c6e.
     ‘winreg.SaveKey’ を送出します。

 -- の関数: winreg.SetValue (key, sub_key, type, value)

     値を指定したキーに関連付けます。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     'sub_key' は値が関連付けられているサブキーの名前を表す文字列です。

     'type' はデータの型を指定する整数です。現状では、この値は *note
     REG_SZ: 4d66. でなければならず、これは文字列だけがサポートされてい
     ることを示します。他のデータ型をサポートするには *note
     SetValueEx(): 1b03. を使ってください。

     'value' は新たな値を指定する文字列です。

     'sub_key' 引数で指定されたキーが存在しなければ、SetValue 関数で生成
     されます。

     値の長さは利用可能なメモリによって制限されます。(2048 バイト以上の)
     長い値はファイルに保存して、そのファイル名を設定レジストリに保存す
     るべきです。そうすればレジストリを効率的に動作させる役に立ちます。

     'key' 引数に指定されたキーは *note KEY_SET_VALUE: 4d67. アクセスで
     開かれていなければなりません。

     引数 ‘key’, ‘sub_key’, ‘type’, ‘value’ を指定して *note
     監査イベント: 1c6e. ‘winreg.SetValue’ を送出します。

 -- の関数: winreg.SetValueEx (key, value_name, reserved, type, value)

     開かれたレジストリキーの値フィールドにデータを記録します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     'value_name' は値が関連付けられているサブキーの名前を表す文字列です
     。

     'reserved' は何もしません - API には常にゼロが渡されます。

     'type' はデータの型を指定する整数です。利用できる型については *note
     値の型: 4d68. を参照してください。

     'value' は新たな値を指定する文字列です。

     このメソッドではまた、指定されたキーに対して、さらに別の値や型情報
     を設定することができます。 'key' 引数で指定されたキーは *note
     KEY_SET_VALUE: 4d67. アクセスで開かれていなければなりません。

     キーを開くには、 *note CreateKey(): 4765. または *note OpenKey():
     476b. メソッドを使ってください。

     値の長さは利用可能なメモリによって制限されます。(2048 バイト以上の)
     長い値はファイルに保存して、そのファイル名を設定レジストリに保存す
     るべきです。そうすればレジストリを効率的に動作させる役に立ちます。

     引数 ‘key’, ‘sub_key’, ‘type’, ‘value’ を指定して *note
     監査イベント: 1c6e. ‘winreg.SetValue’ を送出します。

 -- の関数: winreg.DisableReflectionKey (key)

     64ビット OS上で動作している 32bit プロセスに対するレジストリリフレ
     クションを無効にします。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     32bit OS上では一般的に *note NotImplementedError: 36b. 例外を発生さ
     せます。

     key がリフレクションリストに無い場合は、この関数は成功しますが効果
     はありません。あるキーのリフレクションを無効にしても、そのキーのサ
     ブキーのリフレクションには全く影響しません。

     引数 ‘key’ を指定して *note 監査イベント: 1c6e.
     ‘winreg.DisableReflectionKey’ を送出します。

 -- の関数: winreg.EnableReflectionKey (key)

     指定された、リフレクションが無効にされたキーのリフレクションを再び
     有効にします。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     32bit OS上では一般的に *note NotImplementedError: 36b. 例外を発生さ
     せます。

     あるキーのリフレクションを再開しても、その全てのサブキーには影響し
     ません。

     引数 ‘key’ を指定して *note 監査イベント: 1c6e.
     ‘winreg.EnableReflectionKey’ を送出します。

 -- の関数: winreg.QueryReflectionKey (key)

     指定されたキーのリフレクション状態を確認します。

     'key' はすでに開かれたキーか、既定の *note HKEY_* 定数: 4d5c. のう
     ちの一つです。

     リフレクションが無効になっている場合、‘True’ を返します。

     32bit OS上では一般的に *note NotImplementedError: 36b. 例外を発生さ
     せます。

     引数 ‘key’ を指定して *note 監査イベント: 1c6e.
     ‘winreg.QueryReflectionKey’ を送出します。

   ---------- Footnotes ----------

   (1) 
https://msdn.microsoft.com/en-us/library/ms724889%28v=VS.85%29.aspx

   (2) 
https://msdn.microsoft.com/en-us/library/ms724878%28v=VS.85%29.aspx


File: python.info,  Node: 定数<11>,  Next: レジストリハンドルオブジェクト,  Prev: 関数<14>,  Up: winreg --- Windows レジストリへのアクセス

5.33.2.2 定数
.............

The following constants are defined for use in many ‘winreg’ functions.

* Menu:

* HKEY_* 定数::
* アクセス権限::
* 値の型::


File: python.info,  Node: HKEY_* 定数,  Next: アクセス権限,  Up: 定数<11>

5.33.2.3 HKEY_* 定数
....................

 -- データ: winreg.HKEY_CLASSES_ROOT

     このキー以下のレジストリエントリは、ドキュメントのタイプ（またはク
     ラス）や、それに関連付けられたプロパティを定義しています。シェルと
     COM アプリケーションがこの情報を利用します。

 -- データ: winreg.HKEY_CURRENT_USER

     このキー以下のレジストリエントリは、現在のユーザーの設定を定義しま
     す。この設定には、環境変数、プログラムグループに関するデータ、カラ
     ー、プリンター、ネットワーク接続、アプリケーション設定などが含まれ
     ます。

 -- データ: winreg.HKEY_LOCAL_MACHINE

     このキー以下のレジストリエントリは、コンピュータの物理的な状態を定
     義します。これには、バスタイプ、システムメモリ、インストールされて
     いるソフトウェアやハードウェアが含まれます。

 -- データ: winreg.HKEY_USERS

     このキー以下のレジストリエントリは、ローカルコンピュータの新規ユー
     ザーのためのデフォルト設定や、現在のユーザーの設定を定義しています
     。

 -- データ: winreg.HKEY_PERFORMANCE_DATA

     このキー以下のレジストリエントリは、パフォーマンスデータへのアクセ
     スを可能にしています。実際にはデータはレジストリには格納されていま
     せん。レジストリ関数がシステムにソースからデータを集めさせます。

 -- データ: winreg.HKEY_CURRENT_CONFIG

     ローカルコンピュータシステムの現在のハードウェアプロファイルに関す
     る情報を含みます。

 -- データ: winreg.HKEY_DYN_DATA

     このキーは Windows の 98 以降のバージョンでは利用されていません。


File: python.info,  Node: アクセス権限,  Next: 値の型,  Prev: HKEY_* 定数,  Up: 定数<11>

5.33.2.4 アクセス権限
.....................

より詳しい情報については、 Registry Key Security and Access(1) を参照し
てください。

 -- データ: winreg.KEY_ALL_ACCESS

     STANDARD_RIGHTS_REQUIRED (*note KEY_QUERY_VALUE: 4d73, *note
     KEY_SET_VALUE: 4d67, *note KEY_CREATE_SUB_KEY: 4d74, *note
     KEY_ENUMERATE_SUB_KEYS: 4d75, *note KEY_NOTIFY: 4d76, *note
     KEY_CREATE_LINK: 4d77.) アクセス権限の組み合わせ。

 -- データ: winreg.KEY_WRITE

     STANDARD_RIGHTS_WRITE (*note KEY_SET_VALUE: 4d67, *note
     KEY_CREATE_SUB_KEY: 4d74.) アクセス権限の組み合わせ。

 -- データ: winreg.KEY_READ

     STANDARD_RIGHTS_READ (*note KEY_QUERY_VALUE: 4d73, *note
     KEY_ENUMERATE_SUB_KEYS: 4d75, *note KEY_NOTIFY: 4d76.) アクセス権限
     の組み合わせ。

 -- データ: winreg.KEY_EXECUTE

     *note KEY_READ: 4d65. と同じ。

 -- データ: winreg.KEY_QUERY_VALUE

     レジストリキーの値を問い合わせるのに必要。

 -- データ: winreg.KEY_SET_VALUE

     レジストリの値を作成、削除、設定するのに必要。

 -- データ: winreg.KEY_CREATE_SUB_KEY

     レジストリキーのサブキーを作るのに必要。

 -- データ: winreg.KEY_ENUMERATE_SUB_KEYS

     レジストリキーのサブキーを列挙するのに必要。

 -- データ: winreg.KEY_NOTIFY

     レジストリキーやそのサブキーに対する変更通知を要求するのに必要。

 -- データ: winreg.KEY_CREATE_LINK

     システムでの利用のために予約されている。

* Menu:

* 64-bit 特有のアクセス権::

   ---------- Footnotes ----------

   (1) 
https://msdn.microsoft.com/en-us/library/ms724878%28v=VS.85%29.aspx


File: python.info,  Node: 64-bit 特有のアクセス権,  Up: アクセス権限

5.33.2.5 64-bit 特有のアクセス権
................................

より詳しい情報については、 Accessing an Alternate Registry View(1) を参
照してください。

 -- データ: winreg.KEY_WOW64_64KEY

     64 bit Windows 上のアプリケーションが、64 bit のレジストリビュー上
     で操作する事を示します。32 bit Windows では、この定数は無視されます
     。

 -- データ: winreg.KEY_WOW64_32KEY

     64 bit Windows 上のアプリケーションが、32 bit のレジストリビュー上
     で操作する事を示します。32 bit Windows では、この定数は無視されます
     。

   ---------- Footnotes ----------

   (1) https://msdn.microsoft.com/en-us/library/aa384129(v=VS.85).aspx


File: python.info,  Node: 値の型,  Prev: アクセス権限,  Up: 定数<11>

5.33.2.6 値の型
...............

より詳しい情報については、 Registry Value Types(1) を参照してください。

 -- データ: winreg.REG_BINARY

     何らかの形式のバイナリデータ。

 -- データ: winreg.REG_DWORD

     32 ビットの数。

 -- データ: winreg.REG_DWORD_LITTLE_ENDIAN

     32 ビットのリトルエンディアン形式の数。*note REG_DWORD: 4d7e. と等
     価。

 -- データ: winreg.REG_DWORD_BIG_ENDIAN

     32 ビットのビッグエンディアン形式の数。

 -- データ: winreg.REG_EXPAND_SZ

     環境変数を参照している、ヌル文字で終端された文字列。(‘%PATH%’)。

 -- データ: winreg.REG_LINK

     Unicode のシンボリックリンク。

 -- データ: winreg.REG_MULTI_SZ

     ヌル文字で終端された文字列からなり、二つのヌル文字で終端されている
     配列。 (Python はこの終端の処理を自動的に行います。)

 -- データ: winreg.REG_NONE

     定義されていない値の形式。

 -- データ: winreg.REG_QWORD

     64 ビットの数。

     Added in version 3.6.

 -- データ: winreg.REG_QWORD_LITTLE_ENDIAN

     64 ビットのリトルエンディアン形式の数。*note REG_QWORD: eff. と等価
     。

     Added in version 3.6.

 -- データ: winreg.REG_RESOURCE_LIST

     デバイスドライバリソースのリスト。

 -- データ: winreg.REG_FULL_RESOURCE_DESCRIPTOR

     ハードウェアセッティング。

 -- データ: winreg.REG_RESOURCE_REQUIREMENTS_LIST

     ハードウェアリソースリスト。

 -- データ: winreg.REG_SZ

     ヌル文字で終端された文字列。

   ---------- Footnotes ----------

   (1) 
https://msdn.microsoft.com/en-us/library/ms724884%28v=VS.85%29.aspx


File: python.info,  Node: レジストリハンドルオブジェクト,  Prev: 定数<11>,  Up: winreg --- Windows レジストリへのアクセス

5.33.2.7 レジストリハンドルオブジェクト
.......................................

このオブジェクトは Windows の HKEY オブジェクトをラップし、オブジェクト
が破壊されたときに自動的にハンドルを閉じます。オブジェクトの *note
Close(): 4d5b. メソッドと *note CloseKey(): 4d5a. 関数のどちらも、後始末
がきちんと行われることを保証するために呼び出すことができます。

このモジュールのレジストリ関数は全て、これらのハンドルオブジェクトの一つ
を返します。

このモジュールのレジストリ関数でハンドルオブジェクトを受理するものは全て
整数も受理しますが、ハンドルオブジェクトを利用することを推奨します。

Handle objects provide semantics for *note __bool__(): 14ed. - thus

     if handle:
         print("Yes")

は、ハンドルが現在有効な (閉じられたり切り離されたりしていない) 場合には
‘Yes’ となります。

ハンドルオブジェクトは (例えば組み込みの *note int(): 19b. 関数を使って)
整数に変換することができます。この場合、背後の Windows ハンドル値が返さ
れます、また、 *note Detach(): 476c. メソッドを使って整数のハンドル値を
返させると同時に、ハンドルオブジェクトから Windows ハンドルを切り離すこ
ともできます。

 -- メソッド: PyHKEY.Close ()

     背後の Windows ハンドルを閉じます。

     ハンドルがすでに閉じられていてもエラーは送出されません。

 -- メソッド: PyHKEY.Detach ()

     ハンドルオブジェクトから Windows ハンドルを切り離します。

     切り離される以前にそのハンドルを保持していた整数オブジェクトが返さ
     れます。ハンドルがすでに切り離されていたり閉じられていたりした場合
     、ゼロが返されます。

     この関数を呼び出した後、ハンドルは確実に無効化されますが、閉じられ
     るわけではありません。背後の Win32 ハンドルがハンドルオブジェクトよ
     りも長く維持される必要がある場合にはこの関数を呼び出すとよいでしょ
     う。

     Raises an *note auditing event: 1c6e. ‘winreg.PyHKEY.Detach’ with
     argument ‘key’.

 -- メソッド: PyHKEY.__enter__ ()
 -- メソッド: PyHKEY.__exit__ (*exc_info)

     HKEY オブジェクトは *note __enter__(): 7e4, *note __exit__(): 1518.
     メソッドを実装していて、 *note with: 186. 文のためのコンテキストプ
     ロトコルをサポートしています:

          with OpenKey(HKEY_LOCAL_MACHINE, "foo") as key:
              ...  # work with key

     このコードは、 *note with: 186. ブロックから抜けるときに自動的に
     'key' を閉じます。


File: python.info,  Node: winsound --- Windows 用の音声再生インターフェース,  Prev: winreg --- Windows レジストリへのアクセス,  Up: MS Windows 固有のサービス

5.33.3 ‘winsound’ -- Windows 用の音声再生インターフェース
---------------------------------------------------------

__________________________________________________________________

The ‘winsound’ module provides access to the basic sound-playing
machinery provided by Windows platforms.  It includes functions and
several constants.

*note Availability: 213f.: Windows.

 -- の関数: winsound.Beep (frequency, duration)

     PC のスピーカを鳴らします。引数 'frequency' は鳴らす音の周波数の指
     定で、単位は Hz です。値は 37 から 32,767 でなくてはなりません。引
     数 'duration' は音を何ミリ秒鳴らすかの指定です。システムがスピーカ
     を鳴らすことができない場合、例外 *note RuntimeError: 244. が送出さ
     れます。

 -- の関数: winsound.PlaySound (sound, flags)

     プラットフォームの API から関数 ‘PlaySound()’ を呼び出します。引数
     'sound' はファイル名、システム音エイリアス、音声データの *note
     bytes-like オブジェクト: 193.、または ‘None’ をとり得ます。 'sound'
     の解釈は 'flags' の値に依存します。この値は以下に述べる定数をビット
     単位OR して組み合わせたものになります。 'sound' 引数が ‘None’ だっ
     た場合、現在再生中のWave形式サウンドの再生を停止します。システムの
     エラーが発生した場合、例外 *note RuntimeError: 244. が送出されます
     。

 -- の関数: winsound.MessageBeep (type=MB_OK)

     根底にある ‘MessageBeep()’ 関数をプラットフォームの API から呼び出
     します。この関数は音声をレジストリの指定に従って再生します。 'type'
     引数はどの音声を再生するかを指定します; とり得る値は ‘-1’,
     ‘MB_ICONASTERISK’, ‘MB_ICONEXCLAMATION’, ‘MB_ICONHAND’,
     ‘MB_ICONQUESTION’,および ‘MB_OK’ で、全て以下に記述されています。値
     ‘-1’ は "単純なビープ音" を再生します; この値は他の場合で音声を再生
     することができなかった際の最終的な代替音です。システムがエラーを示
     したら、*note RuntimeError: 244. が送出されます。

 -- データ: winsound.SND_FILENAME

     'sound' パラメタが WAV ファイル名であることを示します。 *note
     SND_ALIAS: 4d8e. と同時に使ってはいけません。

 -- データ: winsound.SND_ALIAS

     引数 'sound' はレジストリにある音声データに関連付けられた名前である
     ことを示します。指定した名前がレジストリ上にない場合、定数 *note
     SND_NODEFAULT: 4d8f. が同時に指定されていない限り、システム標準の音
     声データが再生されます。標準の音声データが登録されていない場合、例
     外 *note RuntimeError: 244. が送出されます。 *note SND_FILENAME:
     4d8d. と同時に使ってはいけません。

     全ての Win32 システムは少なくとも以下の名前をサポートします; ほとん
     どのシステムでは他に多数あります:

     *note PlaySound(): f03.        対応するコントロールパネルでの音声名
     'name'                         

     ----------------------------------------------------------------------------
                                    
     ‘'SystemAsterisk'’             Asterisk
                                    
                                    
     ‘'SystemExclamation'’          Exclamation
                                    
                                    
     ‘'SystemExit'’                 Exit Windows
                                    
                                    
     ‘'SystemHand'’                 Critical Stop
                                    
                                    
     ‘'SystemQuestion'’             Question
                                    

     例えば:

          import winsound
          # Play Windows exit sound.
          winsound.PlaySound("SystemExit", winsound.SND_ALIAS)

          # Probably play Windows default sound, if any is registered (because
          # "*" probably isn't the registered name of any sound).
          winsound.PlaySound("*", winsound.SND_ALIAS)

 -- データ: winsound.SND_LOOP

     音声データを繰り返し再生します。システムがブロックしないようにする
     ため、 *note SND_ASYNC: 4d91. フラグを同時に使わなくてはなりません
     。 *note SND_MEMORY: 4d92. と同時に使うことはできません。

 -- データ: winsound.SND_MEMORY

     *note PlaySound(): f03. の引数 'sound' が *note bytes-like
     オブジェクト: 193. の形式をとった WAV ファイルのメモリ上のイメージ
     であることを示します。

          注釈: このモジュールはメモリ上のイメージを非同期に再生する機能
          をサポートしていません。従って、このフラグと *note SND_ASYNC:
          4d91. を組み合わせると例外 *note RuntimeError: 244. が送出され
          ます。

 -- データ: winsound.SND_PURGE

     指定した音声の全てのインスタンスについて再生処理を停止します。

          注釈: このフラグは現代のWindowsプラットフォームではサポートさ
          れていません。

 -- データ: winsound.SND_ASYNC

     音声を非同期に再生するようにして、関数呼び出しを即座に返します。

 -- データ: winsound.SND_NODEFAULT

     指定した音声が見つからなかった場合にシステム標準の音声を鳴らさない
     ようにします。

 -- データ: winsound.SND_NOSTOP

     現在鳴っている音声を中断させないようにします。

 -- データ: winsound.SND_NOWAIT

     サウンドドライバがビジー状態にある場合、関数がすぐ返るようにします
     。

          注釈: このフラグは現代のWindowsプラットフォームではサポートさ
          れていません。

 -- データ: winsound.SND_APPLICATION

     The 'sound' parameter is an application-specific alias in the
     registry.  This flag can be combined with the *note SND_ALIAS:
     4d8e. flag to specify an application-defined sound alias.

 -- データ: winsound.SND_SENTRY

     Triggers a SoundSentry event when the sound is played.

     Added in version 3.14.

 -- データ: winsound.SND_SYNC

     The sound is played synchronously.  This is the default behavior.

     Added in version 3.14.

 -- データ: winsound.SND_SYSTEM

     Assign the sound to the audio session for system notification
     sounds.

     Added in version 3.14.

 -- データ: winsound.MB_ICONASTERISK

     音声 ‘SystemDefault’ を再生します。

 -- データ: winsound.MB_ICONEXCLAMATION

     音声 ‘SystemExclamation’ を再生します。

 -- データ: winsound.MB_ICONHAND

     音声 ‘SystemHand’ を再生します。

 -- データ: winsound.MB_ICONQUESTION

     音声 ‘SystemQuestion’ を再生します。

 -- データ: winsound.MB_OK

     音声 ‘SystemDefault’ を再生します。

 -- データ: winsound.MB_ICONERROR

     音声 ‘SystemHand’ を再生します。

     Added in version 3.14.

 -- データ: winsound.MB_ICONINFORMATION

     音声 ‘SystemDefault’ を再生します。

     Added in version 3.14.

 -- データ: winsound.MB_ICONSTOP

     音声 ‘SystemHand’ を再生します。

     Added in version 3.14.

 -- データ: winsound.MB_ICONWARNING

     音声 ‘SystemExclamation’ を再生します。

     Added in version 3.14.


File: python.info,  Node: Unix-specific services,  Next: モジュールのコマンドラインインターフェース CLI,  Prev: MS Windows 固有のサービス,  Up: Python 標準ライブラリ

5.34 Unix-specific services
===========================

本章に記述されたモジュールは、Unix オペレーティングシステム、あるいはそ
れから派生した多くのものに固有の機能のためのインターフェースを提供します
。その概要を以下に述べます:

* Menu:

* shlex: shlex --- 単純な字句解析. 単純な字句解析
* posix: posix --- 最も一般的な POSIX システムコール群. 最も一般的な POSIX システムコール群
* pwd: pwd --- パスワードデータベース. パスワードデータベース
* grp: grp --- グループデータベース. グループデータベース
* termios: termios --- POSIX スタイルの端末制御. POSIX スタイルの端末制御
* tty: tty --- 端末制御用の関数群. 端末制御用の関数群
* pty: pty --- 擬似端末ユーティリティ. 擬似端末ユーティリティ
* fcntl: fcntl --- fcntl および ioctl システムコール. fcntl および ioctl システムコール
* resource: resource --- リソース使用情報. リソース使用情報
* syslog: syslog --- Unix syslog ライブラリルーチン群. Unix syslog ライブラリルーチン群


File: python.info,  Node: shlex --- 単純な字句解析,  Next: posix --- 最も一般的な POSIX システムコール群,  Up: Unix-specific services

5.34.1 ‘shlex’ -- 単純な字句解析
--------------------------------

'ソースコード:' Lib/shlex.py(1)

__________________________________________________________________

*note shlex: ec8. クラスは Unix シェルに似た、単純な構文に対する字句解析
器を簡単に書けるようにします。このクラスはしばしば、 Python アプリケーシ
ョンのための実行制御ファイルのような小規模言語を書く上で便利です。

The ‘shlex’ module defines the following functions:

 -- の関数: shlex.split (s, comments=False, posix=True)

     シェルに似た文法を使って、文字列 's' を分割します。 'comments' が
     *note False: d2b. (デフォルト値) の場合、受理した文字列内のコメント
     を解析しません (*note shlex: ec8. インスタンスの *note commenters:
     4da9. メンバの値を空文字列にします)。この関数はデフォルトでは POSIX
     モードで動作し、 'posix' 引数が偽の場合は非 POSIX モードで動作しま
     す。

     バージョン 3.12 で変更: Passing ‘None’ for 's' argument now raises
     an exception, rather than reading *note sys.stdin: 75f.

 -- の関数: shlex.join (split_command)

     Concatenate the tokens of the list 'split_command' and return a
     string.  This function is the inverse of *note split(): 75e.

          >>> from shlex import join
          >>> print(join(['echo', '-n', 'Multiple words']))
          echo -n 'Multiple words'

     The returned value is shell-escaped to protect against injection
     vulnerabilities (see *note quote(): 582.).

     Added in version 3.8.

 -- の関数: shlex.quote (s)

     文字列 's' をシェルエスケープして返します。戻り値は、リストを使えな
     いようなケースで、シェルコマンドライン内で一つのトークンとして安全
     に利用出来る文字列です。
          警告: The ‘shlex’ module is 'only designed for Unix shells'.

          The *note quote(): 582. function is not guaranteed to be
          correct on non-POSIX compliant shells or shells from other
          operating systems such as Windows.  Executing commands quoted
          by this module on such shells can open up the possibility of a
          command injection vulnerability.

          Consider using functions that pass command arguments with
          lists such as *note subprocess.run(): d7f. with ‘shell=False’.

     以下のイディオムは安全ではないかもしれません:

          >>> filename = 'somefile; rm -rf ~'
          >>> command = 'ls -l {}'.format(filename)
          >>> print(command)  # executed by a shell: boom!
          ls -l somefile; rm -rf ~

     *note quote(): 582. がそのセキュリティホールをふさぎます:

          >>> from shlex import quote
          >>> command = 'ls -l {}'.format(quote(filename))
          >>> print(command)
          ls -l 'somefile; rm -rf ~'
          >>> remote_command = 'ssh home {}'.format(quote(command))
          >>> print(remote_command)
          ssh home 'ls -l '"'"'somefile; rm -rf ~'"'"''

     クォーティングは UNIX シェルならびに *note split(): 75e. と互換です
     :

          >>> from shlex import split
          >>> remote_command = split(remote_command)
          >>> remote_command
          ['ssh', 'home', "ls -l 'somefile; rm -rf ~'"]
          >>> command = split(remote_command[-1])
          >>> command
          ['ls', '-l', 'somefile; rm -rf ~']

     Added in version 3.3.

The ‘shlex’ module defines the following class:

 -- クラス: shlex.shlex (instream=None, infile=None, posix=False,
          punctuation_chars=False)

     A *note shlex: ec8. instance or subclass instance is a lexical
     analyzer object.  The initialization argument, if present,
     specifies where to read characters from.  It must be a
     file-/stream-like object with *note read(): 206c. and *note
     readline(): 20a6. methods, or a string.  If no argument is given,
     input will be taken from ‘sys.stdin’.  The second optional argument
     is a filename string, which sets the initial value of the *note
     infile: 4daa. attribute.  If the 'instream' argument is omitted or
     equal to ‘sys.stdin’, this second argument defaults to "stdin".
     The 'posix' argument defines the operational mode: when 'posix' is
     not true (default), the *note shlex: ec8. instance will operate in
     compatibility mode.  When operating in POSIX mode, *note shlex:
     ec8. will try to be as close as possible to the POSIX shell parsing
     rules.  The 'punctuation_chars' argument provides a way to make the
     behaviour even closer to how real shells parse.  This can take a
     number of values: the default value, ‘False’, preserves the
     behaviour seen under Python 3.5 and earlier.  If set to ‘True’,
     then parsing of the characters ‘();<>|&’ is changed: any run of
     these characters (considered punctuation characters) is returned as
     a single token.  If set to a non-empty string of characters, those
     characters will be used as the punctuation characters.  Any
     characters in the *note wordchars: 4dab. attribute that appear in
     'punctuation_chars' will be removed from *note wordchars: 4dab.
     See *note Improved Compatibility with Shells: ec9. for more
     information.  'punctuation_chars' can be set only upon *note shlex:
     ec8. instance creation and can't be modified later.

     バージョン 3.6 で変更: 'punctuation_chars' 引数が追加されました。

参考
....

*note configparser: 26. モジュール

     Windows ‘.ini’ ファイルに似た設定ファイルのパーザ。

* Menu:

* shlex オブジェクト::
* 解析規則::
* Improved Compatibility with Shells::

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/shlex.py


File: python.info,  Node: shlex オブジェクト,  Next: 解析規則,  Up: shlex --- 単純な字句解析

5.34.1.1 shlex オブジェクト
...........................

*note shlex: ec8. インスタンスは以下のメソッドを持っています:

 -- メソッド: shlex.get_token ()

     トークンを一つ返します。トークンが *note push_token(): 4daf. で使っ
     てスタックに積まれていた場合、トークンをスタックからポップします。
     そうでない場合、トークンを一つ入力ストリームから読み出します。読み
     出し即時にファイル終了子に遭遇した場合、 *note eof: 4db0. (非 POSIX
     モードでは空文字列 (‘''’)、POSIX モードでは ‘None’) が返されます。

 -- メソッド: shlex.push_token (str)

     トークンスタックに引数文字列をスタックします。

 -- メソッド: shlex.read_token ()

     生 (raw) のトークンを読み出します。プッシュバックスタックを無視し、
     かつソースリクエストを解釈しません (通常これは便利なエントリポイン
     トではありません。完全性のためにここで記述されています)。

 -- メソッド: shlex.sourcehook (filename)

     *note shlex: ec8. がソースリクエスト (下の *note source: 4db3. を参
     照してください) を検出した際、このメソッドはその後に続くトークンを
     引数として渡され、ファイル名と開かれたファイル類似オブジェクトから
     なるタプルを返すとされています。

     通常、このメソッドはまず引数から何らかのクオートを取り除きます。処
     理後の引数が絶対パス名であった場合か、以前に有効になったソースリク
     エストが存在しない場合か、以前のソースが (‘sys.stdin’ のような) ス
     トリームであった場合、この結果はそのままにされます。そうでない場合
     で、処理後の引数が相対パス名の場合、ソースインクルードスタックにあ
     る直前のファイル名からディレクトリ部分が取り出され、相対パスの前の
     部分に追加されます (この動作は C 言語プリプロセッサにおける
     ‘#include "file.h"’ の扱いと同様です)。

     これらの操作の結果はファイル名として扱われ、タプルの最初の要素とし
     て返されます。同時にこのファイル名で *note open(): 316. を呼び出し
     た結果が二つ目の要素になります (注意: インスタンス初期化のときとは
     引数の並びが逆になっています！)

     このフックはディレクトリサーチパスや、ファイル拡張子の追加、その他
     の名前空間に関するハックを実装できるようにするために公開されていま
     す。 'close' フックに対応するものはありませんが、shlex インスタンス
     はソースリクエストされている入力ストリームが EOF を返した時には
     *note close(): 506. を呼び出します。

     ソーススタックをより明示的に操作するには、 *note push_source():
     4db4. および *note pop_source(): 4db5. メソッドを使ってください。

 -- メソッド: shlex.push_source (newstream, newfile=None)

     入力ソースストリームを入力スタックにプッシュします。ファイル名引数
     が指定された場合、以後のエラーメッセージ中で利用することができます
     。 *note sourcehook(): 4db2. メソッドが内部で使用しているのと同じメ
     ソッドです。

 -- メソッド: shlex.pop_source ()

     最後にプッシュされた入力ソースを入力スタックからポップします。字句
     解析器がスタック上の入力ストリームの EOF に到達した際に利用するメソ
     ッドと同じです。

 -- メソッド: shlex.error_leader (infile=None, lineno=None)

     このメソッドはエラーメッセージの論述部分を Unix C コンパイラエラー
     ラベルの形式で生成します; この書式は ‘'"%s", line %d: '’ で、 ‘%s’
     は現在のソースファイル名で置き換えられ、 ‘%d’ は現在の入力行番号で
     置き換えられます (オプションの引数を使ってこれらを上書きすることも
     できます)。

     This convenience is provided to encourage ‘shlex’ users to generate
     error messages in the standard, parseable format understood by
     Emacs and other Unix tools.

*note shlex: ec8. サブクラスのインスタンスは、字句解析を制御したり、デバ
ッグに使えるような public なインスタンス変数を持っています:

 -- の属性: shlex.commenters

     コメントの開始として認識される文字列です。コメントの開始から行末ま
     でのすべてのキャラクタ文字は無視されます。標準では単に ‘'#'’ が入っ
     ています。

 -- の属性: shlex.wordchars

     The string of characters that will accumulate into multi-character
     tokens.  By default, includes all ASCII alphanumerics and
     underscore.  In POSIX mode, the accented characters in the Latin-1
     set are also included.  If *note punctuation_chars: 1db6. is not
     empty, the characters ‘~-./*?=’, which can appear in filename
     specifications and command line parameters, will also be included
     in this attribute, and any characters which appear in
     ‘punctuation_chars’ will be removed from ‘wordchars’ if they are
     present there.  If *note whitespace_split: 4db7. is set to ‘True’,
     this will have no effect.

 -- の属性: shlex.whitespace

     空白と見なされ、読み飛ばされる文字群です。空白はトークンの境界を作
     ります。標準では、スペース、タブ、改行 (linefeed) および復帰
     (carriage-return) が入っています。

 -- の属性: shlex.escape

     エスケープ文字と見なされる文字群です。これは POSIX モードでのみ使わ
     れ、デフォルトでは ‘'\'’ だけが入っています。

 -- の属性: shlex.quotes

     文字列引用符と見なされる文字群です。トークンを構成する際、同じクオ
     ートが再び出現するまで文字をバッファに蓄積します (すなわち、異なる
     クオート形式はシェル中で互いに保護し合う関係にあります)。標準では、
     ASCII 単引用符および二重引用符が入っています。

 -- の属性: shlex.escapedquotes

     *note quotes: 4dba. のうち、 *note escape: 4db9. で定義されたエスケ
     ープ文字を解釈する文字群です。これは POSIX モードでのみ使われ、デフ
     ォルトでは ‘'"'’ だけが入っています。

 -- の属性: shlex.whitespace_split

     If ‘True’, tokens will only be split in whitespaces.  This is
     useful, for example, for parsing command lines with *note shlex:
     ec8, getting tokens in a similar way to shell arguments.  When used
     in combination with *note punctuation_chars: 1db6, tokens will be
     split on whitespace in addition to those characters.

     バージョン 3.8 で変更: The *note punctuation_chars: 1db6. attribute
     was made compatible with the *note whitespace_split: 4db7.
     attribute.

 -- の属性: shlex.infile

     現在の入力ファイル名です。クラスのインスタンス化時に初期設定される
     か、その後のソースリクエストでスタックされます。エラーメッセージを
     構成する際にこの値を調べると便利なことがあります。

 -- の属性: shlex.instream

     *note shlex: ec8. インスタンスが文字を読み出している入力ストリーム
     です。

 -- の属性: shlex.source

     このメンバ変数は標準で *note None: 885. を取ります。この値に文字列
     を代入すると、その文字列は多くのシェルにおける ‘source’ キーワード
     に似た、字句解析レベルでのインクルード要求として認識されます。すな
     わち、その直後に現れるトークンをファイル名として新たなストリームを
     開き、そのストリームを入力として、EOF に到達するまで読み込まれます
     。新たなストリームの EOF に到達した時点で *note close(): 506. が呼
     び出され、入力は元の入力ストリームに戻されます。ソースリクエストは
     任意のレベルの深さまでスタックしてかまいません。

 -- の属性: shlex.debug

     このメンバ変数が数値で、かつ ‘1’ またはそれ以上の値の場合、 *note
     shlex: ec8. インスタンスは動作に関する冗長な進捗報告を出力します。
     この出力を使いたいなら、モジュールのソースコードを読めば詳細を学ぶ
     ことができます。

 -- の属性: shlex.lineno

     ソース行番号 (遭遇した改行の数に 1 を加えたもの) です。

 -- の属性: shlex.token

     トークンバッファです。例外を捕捉した際にこの値を調べると便利なこと
     があります。

 -- の属性: shlex.eof

     ファイルの終端を決定するのに使われるトークンです。非 POSIX モードで
     は空文字列 (‘''’) 、POSIX モードでは ‘None’ が入ります。

 -- の属性: shlex.punctuation_chars

     A read-only property.  Characters that will be considered
     punctuation.  Runs of punctuation characters will be returned as a
     single token.  However, note that no semantic validity checking
     will be performed: for example, '>>>' could be returned as a token,
     even though it may not be recognised as such by shells.

     Added in version 3.6.


File: python.info,  Node: 解析規則,  Next: Improved Compatibility with Shells,  Prev: shlex オブジェクト,  Up: shlex --- 単純な字句解析

5.34.1.2 解析規則
.................

When operating in non-POSIX mode, *note shlex: ec8. will try to obey the
following rules.

   * ワード内の引用符を認識しない (‘Do"Not"Separate’ は単一ワード
     ‘Do"Not"Separate’ として解析されます)

   * エスケープ文字を認識しない

   * 引用符で囲まれた文字列は、引用符内の全ての文字リテラルを保持する

   * 閉じ引用符でワードを区切る (‘"Do"Separate’ は、 ‘"Do"’ と
     ‘Separate’ であると解析されます)

   * *note whitespace_split: 4db7. が ‘False’ の場合、wordchar、
     whitespace または quote として宣言されていない全ての文字を、単一の
     文字トークンとして返す。 ‘True’ の場合、 *note shlex: ec8. は空白文
     字でのみ単語を区切る。

   * 空文字列 (‘''’) で EOF を送出する

   * 引用符に囲んであっても、空文字列を解析しない

When operating in POSIX mode, *note shlex: ec8. will try to obey the
following parsing rules.

   * 引用符を取り除き、引用符で単語を分解しない (‘"Do"Not"Separate"’ は
     単一ワード ‘DoNotSeparate’ として解析されます)

   * 引用符で囲まれないエスケープ文字群 (‘'\'’ など) は直後に続く文字の
     リテラル値を保持する

   * *note escapedquotes: 4dbb. でない引用符文字 (‘"'"’ など) で囲まれて
     いる全ての文字のリテラル値を保持する

   * Enclosing characters in quotes which are part of *note
     escapedquotes: 4dbb. (e.g.  ‘'"'’)  preserves the literal value of
     all characters within the quotes, with the exception of the
     characters mentioned in *note escape: 4db9.  The escape characters
     retain their special meaning only when followed by the quote in
     use, or the escape character itself.  Otherwise the escape
     character will be considered a normal character.

   * *note None: 885. で EOF を送出する

   * 引用符に囲まれた空文字列 (‘''’) を許す。


File: python.info,  Node: Improved Compatibility with Shells,  Prev: 解析規則,  Up: shlex --- 単純な字句解析

5.34.1.3 Improved Compatibility with Shells
...........................................

Added in version 3.6.

The *note shlex: c9. class provides compatibility with the parsing
performed by common Unix shells like ‘bash’, ‘dash’, and ‘sh’.  To take
advantage of this compatibility, specify the ‘punctuation_chars’
argument in the constructor.  This defaults to ‘False’, which preserves
pre-3.6 behaviour.  However, if it is set to ‘True’, then parsing of the
characters ‘();<>|&’ is changed: any run of these characters is returned
as a single token.  While this is short of a full parser for shells
(which would be out of scope for the standard library, given the
multiplicity of shells out there), it does allow you to perform
processing of command lines more easily than you could otherwise.  To
illustrate, you can see the difference in the following snippet:

     >>> import shlex
     >>> text = "a && b; c && d || e; f >'abc'; (def \"ghi\")"
     >>> s = shlex.shlex(text, posix=True)
     >>> s.whitespace_split = True
     >>> list(s)
     ['a', '&&', 'b;', 'c', '&&', 'd', '||', 'e;', 'f', '>abc;', '(def', 'ghi)']
     >>> s = shlex.shlex(text, posix=True, punctuation_chars=True)
     >>> s.whitespace_split = True
     >>> list(s)
     ['a', '&&', 'b', ';', 'c', '&&', 'd', '||', 'e', ';', 'f', '>', 'abc', ';',
     '(', 'def', 'ghi', ')']

Of course, tokens will be returned which are not valid for shells, and
you'll need to implement your own error checks on the returned tokens.

Instead of passing ‘True’ as the value for the punctuation_chars
parameter, you can pass a string with specific characters, which will be
used to determine which characters constitute punctuation.  For example:

     >>> import shlex
     >>> s = shlex.shlex("a && b || c", punctuation_chars="|")
     >>> list(s)
     ['a', '&', '&', 'b', '||', 'c']

     注釈: When ‘punctuation_chars’ is specified, the *note wordchars:
     4dab. attribute is augmented with the characters ‘~-./*?=’.  That
     is because these characters can appear in file names (including
     wildcards) and command-line arguments (e.g.  ‘--color=auto’).
     Hence:

          >>> import shlex
          >>> s = shlex.shlex('~/a && b-c --color=auto || d *.py?',
          ...                 punctuation_chars=True)
          >>> list(s)
          ['~/a', '&&', 'b-c', '--color=auto', '||', 'd', '*.py?']

     However, to match the shell as closely as possible, it is
     recommended to always use ‘posix’ and *note whitespace_split: 4db7.
     when using *note punctuation_chars: 1db6, which will negate *note
     wordchars: 4dab. entirely.

For best effect, ‘punctuation_chars’ should be set in conjunction with
‘posix=True’.  (Note that ‘posix=False’ is the default for *note shlex:
ec8.)


File: python.info,  Node: posix --- 最も一般的な POSIX システムコール群,  Next: pwd --- パスワードデータベース,  Prev: shlex --- 単純な字句解析,  Up: Unix-specific services

5.34.2 ‘posix’ -- 最も一般的な POSIX システムコール群
-----------------------------------------------------

__________________________________________________________________

このモジュールはオペレーティングシステムの機能のうち、C 言語標準および
(Unix インターフェースをほんの少し隠蔽した) POSIX 標準で標準化されている
機能に対するアクセス機構を提供します。

*note Availability: 213f.: Unix.

'Do not import this module directly.'  Instead, import the module *note
os: a5, which provides a 'portable' version of this interface.  On Unix,
the *note os: a5. module provides a superset of the ‘posix’ interface.
On non-Unix operating systems the ‘posix’ module is not available, but a
subset is always available through the *note os: a5. interface.  Once
*note os: a5. is imported, there is 'no' performance penalty in using it
instead of ‘posix’.  In addition, *note os: a5. provides some additional
functionality, such as automatically calling *note putenv(): 25b. when
an entry in ‘os.environ’ is changed.

エラーは例外として報告されます; よくある例外は型エラーです。一方、システ
ムコールから報告されたエラーは以下に述べるように *note OSError: 2c0. を
送出します。

* Menu:

* ラージファイルのサポート::
* 注目すべきモジュールの内容::


File: python.info,  Node: ラージファイルのサポート,  Next: 注目すべきモジュールの内容,  Up: posix --- 最も一般的な POSIX システムコール群

5.34.2.1 ラージファイルのサポート
.................................

いくつかのオペレーティングシステム (AIX および Solaris が含まれます) は
、 int および long を 32 ビット値とする C プログラムモデルで 2GB を超え
るサイズのファイルのサポートを提供しています。このサポートは典型的には関
連するサイズとオフセットの組合せを 64-bit 値として定義することで実現して
います。このようなファイルは時にラージファイル ('large files') と呼ばれ
ます。

Python では、 ‘off_t’ のサイズが long より大きく、かつ long long が少な
くとも ‘off_t’ と同じくらい大きなサイズであるとき、ラージファイルのサポ
ートが有効になります。 この場合、ファイルのサイズ、オフセットおよび
Python の通常整数型の範囲を超えるような値の表現には Python の長整数型が
使われます。 このモードを有効にするのに、 ‘configure’ で Python のコンパ
イルに特定のコンパイルフラグを必要とするかもしれません。 例えば、Solaris
2.6 および 2.7 では、以下のようにする必要があります:

     CFLAGS="`getconf LFS_CFLAGS`" OPT="-g -O2 $CFLAGS" \
             ./configure

ラージファイル対応の Linux システムでは、以下のようにすれば良いでしょう:

     CFLAGS='-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64' OPT="-g -O2 $CFLAGS" \
             ./configure


File: python.info,  Node: 注目すべきモジュールの内容,  Prev: ラージファイルのサポート,  Up: posix --- 最も一般的な POSIX システムコール群

5.34.2.2 注目すべきモジュールの内容
...................................

In addition to many functions described in the *note os: a5. module
documentation, ‘posix’ defines the following data item:

 -- データ: posix.environ

     インタプリタが起動したときの環境を表す文字列辞書です。キーと値は
     Unix ではバイト列、 Windows では文字列です。例えば、
     ‘environ[b'HOME']’ (Windows では ‘environ['HOME']’) はホームディレ
     クトリのパス名で、 C の ‘getenv("HOME")’ と同じ値です。

     この辞書を編集しても、 *note execv(): 3019. 、 *note popen(): 31a.
     、 *note system(): 1676. で渡された環境変数文字列には影響は与えませ
     ん; 環境変数を変更したい場合は、 ‘environ’ を *note execve(): 1311.
     に渡すか、変数への代入文と export 文を *note system(): 1676. や
     *note popen(): 31a. に渡すコマンド文字列に追加してください。

     バージョン 3.2 で変更: Unix ではキーと値はバイト列になりました。

          注釈: The *note os: a5. module provides an alternate
          implementation of ‘environ’ which updates the environment on
          modification.  Note also that updating *note os.environ: 259.
          will render this dictionary obsolete.  Use of the *note os:
          a5. module version of this is recommended over direct access
          to the ‘posix’ module.


File: python.info,  Node: pwd --- パスワードデータベース,  Next: grp --- グループデータベース,  Prev: posix --- 最も一般的な POSIX システムコール群,  Up: Unix-specific services

5.34.3 ‘pwd’ -- パスワードデータベース
--------------------------------------

__________________________________________________________________

このモジュールは Unix のユーザアカウントとパスワードのデータベースへのア
クセスを提供します。全ての Unix 系 OS で利用できます。

*note Availability: 213f.: Unix, not WASI, not iOS.

パスワードデータベースの各エントリはタプルのようなオブジェクトで提供され
、それぞれの属性は ‘passwd’ 構造体のメンバに対応しています(下の属性欄に
ついては、‘<pwd.h>’ を見てください):

インデッ    属性                意味
クス                            

------------------------------------------------------------------
                                
0           ‘pw_name’           ログイン名
                                
                                
1           ‘pw_passwd’         暗号化されたパスワード
                                (optional))
                                
                                
2           ‘pw_uid’            ユーザID(UID)
                                
                                
3           ‘pw_gid’            グループID(GID)
                                
                                
4           ‘pw_gecos’          実名またはコメント
                                
                                
5           ‘pw_dir’            ホームディレクトリ
                                
                                
6           ‘pw_shell’          シェル
                                

UIDとGIDは整数で、それ以外は全て文字列です。検索したエントリが見つからな
いと *note KeyError: 5e7. が発生します。

     注釈: 伝統的なUnixでは、 ‘pw_passwd’ フィールドはDES由来のアルゴリ
     ズムで暗号化されたパスワードが含まれています。しかし、近代的な
     UNIX系OSでは 'シャドウパスワード' とよばれる仕組みを利用しています
     。この場合には 'pw_passwd' フィールドにはアスタリスク(‘'*'’)か、
     ‘'x'’ という一文字だけが含まれており、暗号化されたパスワードは、一
     般には見えない ‘/etc/shadow’ というファイルに入っています。
     'pw_passwd' フィールドに有用な値が入っているかはシステムに依存しま
     す。

このモジュールでは以下の内容を定義しています:

 -- の関数: pwd.getpwuid (uid)

     与えられたUIDに対応するパスワードデータベースのエントリを返します。

 -- の関数: pwd.getpwnam (name)

     与えられたユーザ名に対応するパスワードデータベースのエントリを返し
     ます。

 -- の関数: pwd.getpwall ()

     パスワードデータベースの全てのエントリを、任意の順番で並べたリスト
     を返します。

参考
....

*note grp: 6a. モジュール

     このモジュールに似た、グループデータベースへのアクセスを提供するモ
     ジュール。


File: python.info,  Node: grp --- グループデータベース,  Next: termios --- POSIX スタイルの端末制御,  Prev: pwd --- パスワードデータベース,  Up: Unix-specific services

5.34.4 ‘grp’ -- グループデータベース
------------------------------------

__________________________________________________________________

このモジュールでは Unix グループ (group) データベースへのアクセス機構を
提供します。全ての Unix バージョンで利用可能です。

*note Availability: 213f.: Unix, not WASI, not Android, not iOS.

このモジュールはグループデータベースのエントリをタプルに似たオブジェクト
として報告されます。このオブジェクトの属性は ‘group’ 構造体の各メンバ (以
下の属性フィールド、‘<grp.h>’ を参照) に対応します:

インデッ    属性            意味
クス                        

------------------------------------------------------------------
                            
0           gr_name         グループ名
                            
                            
1           gr_passwd       (暗号化された) グループパスワード;
                            しばしば空文字列になります
                            
                            
2           gr_gid          数字のグループ ID
                            
                            
3           gr_mem          グループメンバの全てのユーザ名
                            

gid は整数、名前およびパスワードは文字列、そしてメンバリストは文字列から
なるリストです。 (ほとんどのユーザは、パスワードデータベースで自分が入れ
られているグループのメンバとしてグループデータベース内では明示的に列挙さ
れていないので注意してください。完全なメンバ情報を取得するには両方のデー
タベースを調べてください。また、 ‘+’ や ‘-’ で始まる ‘gr_name’ は YP/NIS
参照である可能性があり、 *note getgrnam(): 3746. や *note getgrgid():
f22. でアクセスできないかもしれないことにも注意してください。)

このモジュールでは以下の内容を定義しています:

 -- の関数: grp.getgrgid (id)

     与えられたグループ ID に対するグループデータベースエントリを返しま
     す。要求したエントリが見つからなかった場合、 *note KeyError: 5e7. が
     送出されます。

     バージョン 3.10 で変更: 浮動小数点数や文字列のような、整数でない引
     数には *note TypeError: 198. が送出されます。

 -- の関数: grp.getgrnam (name)

     与えられたグループ名に対するグループデータベースエントリを返します
     。要求したエントリが見つからなかった場合、 *note KeyError: 5e7. が
     送出されます。

 -- の関数: grp.getgrall ()

     全ての入手可能なグループエントリを返します。順番は決まっていません
     。

参考
....

*note pwd: b7. モジュール

     このモジュールと類似の、ユーザデータベースへのインターフェース。


File: python.info,  Node: termios --- POSIX スタイルの端末制御,  Next: tty --- 端末制御用の関数群,  Prev: grp --- グループデータベース,  Up: Unix-specific services

5.34.5 ‘termios’ -- POSIX スタイルの端末制御
--------------------------------------------

__________________________________________________________________

このモジュールでは端末 I/O 制御のための POSIX 準拠の関数呼び出しインター
フェースを提供します。これら呼び出しのための完全な記述については、 Unix
マニュアルページの ‘termios(3)(1)’ を参照してください。これは POSIX
'termios' 形式の端末制御をサポートしていてインストール時に有効にした
Unix のバージョンでのみ利用可能です。

*note Availability: 213f.: Unix.

このモジュールの関数は全て、ファイル記述子 'fd' を最初の引数としてとりま
す。この値は、 ‘sys.stdin.fileno()’ が返すような整数のファイル記述子でも
、 ‘sys.stdin’ 自体のような *note file object: 13db. でもかまいません。

このモジュールではまた、モジュールで提供されている関数を使う上で必要とな
る全ての定数を定義しています; これらの定数は C の対応する関数と同じ名前
を持っています。これらの端末制御インターフェースを利用する上でのさらなる
情報については、あなたのシステムのドキュメンテーションを参考にしてくださ
い。

このモジュールには、以下の関数が定義されています:

 -- の関数: termios.tcgetattr (fd)

     Return a list containing the tty attributes for file descriptor
     'fd', as follows: ‘[iflag, oflag, cflag, lflag, ispeed, ospeed,
     cc]’ where 'cc' is a list of the tty special characters (each a
     string of length 1, except the items with indices ‘VMIN’ and
     ‘VTIME’, which are integers when these fields are defined).  The
     interpretation of the flags and the speeds as well as the indexing
     in the 'cc' array must be done using the symbolic constants defined
     in the ‘termios’ module.

 -- の関数: termios.tcsetattr (fd, when, attributes)

     Set the tty attributes for file descriptor 'fd' from the
     'attributes', which is a list like the one returned by *note
     tcgetattr(): 19f3.  The 'when' argument determines when the
     attributes are changed:

      -- データ: termios.TCSANOW

          Change attributes immediately.

      -- データ: termios.TCSADRAIN

          Change attributes after transmitting all queued output.

      -- データ: termios.TCSAFLUSH

          Change attributes after transmitting all queued output and
          discarding all queued input.

 -- の関数: termios.tcsendbreak (fd, duration)

     ファイル記述子 'fd' にブレークを送信します。'duration' をゼロにする
     と、0.25〜0.5 秒間のブレークを送信します; 'duration' の値がゼロでな
     い場合、その意味はシステム依存です。

 -- の関数: termios.tcdrain (fd)

     ファイル記述子 'fd' に書き込まれた全ての出力が転送されるまで待ちま
     す。

 -- の関数: termios.tcflush (fd, queue)

     ファイル記述子 'fd' にキューされたデータを無視します。どのキューか
     は 'queue' セレクタで指定します: ‘TCIFLUSH’ は入力キュー、
     ‘TCOFLUSH’ は出力キュー、 ‘TCIOFLUSH’ は両方のキューです。

 -- の関数: termios.tcflow (fd, action)

     ファイル記述子 'fd' の入力または出力をサスペンドしたりレジュームし
     たりします。引数 'action' は出力をサスペンドする ‘TCOOFF’ 、出力を
     レジュームする ‘TCOON’ 、入力をサスペンドする ‘TCIOFF’ 、入力をレジ
     ュームする ‘TCION’ をとることができます。

 -- の関数: termios.tcgetwinsize (fd)

     Return a tuple ‘(ws_row, ws_col)’ containing the tty window size
     for file descriptor 'fd'.  Requires ‘termios.TIOCGWINSZ’ or
     ‘termios.TIOCGSIZE’.

     Added in version 3.11.

 -- の関数: termios.tcsetwinsize (fd, winsize)

     Set the tty window size for file descriptor 'fd' from 'winsize',
     which is a two-item tuple ‘(ws_row, ws_col)’ like the one returned
     by *note tcgetwinsize(): 4ddc.  Requires at least one of the pairs
     (‘termios.TIOCGWINSZ’, ‘termios.TIOCSWINSZ’); (‘termios.TIOCGSIZE’,
     ‘termios.TIOCSSIZE’) to be defined.

     Added in version 3.11.

参考
....

*note tty: 106. モジュール

     一般的な端末制御操作のための便利な関数。

* Menu:

* 使用例: 使用例<51>.

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/termios(3)


File: python.info,  Node: 使用例<51>,  Up: termios --- POSIX スタイルの端末制御

5.34.5.1 使用例
...............

以下はエコーバックを切った状態でパスワード入力を促す関数です。ユーザの入
力に関わらず以前の端末属性を正確に回復するために、二つの *note
tcgetattr(): 19f3. と *note try: 8f8. ...  *note finally: 1b0. 文による
テクニックが使われています:

     def getpass(prompt="Password: "):
         import termios, sys
         fd = sys.stdin.fileno()
         old = termios.tcgetattr(fd)
         new = termios.tcgetattr(fd)
         new[3] = new[3] & ~termios.ECHO          # lflags
         try:
             termios.tcsetattr(fd, termios.TCSADRAIN, new)
             passwd = input(prompt)
         finally:
             termios.tcsetattr(fd, termios.TCSADRAIN, old)
         return passwd


File: python.info,  Node: tty --- 端末制御用の関数群,  Next: pty --- 擬似端末ユーティリティ,  Prev: termios --- POSIX スタイルの端末制御,  Up: Unix-specific services

5.34.6 ‘tty’ -- 端末制御用の関数群
----------------------------------

'ソースコード:' Lib/tty.py(1)

__________________________________________________________________

The ‘tty’ module defines functions for putting the tty into cbreak and
raw modes.

*note Availability: 213f.: Unix.

このモジュールは *note termios: e7. モジュールを必要とするため、 Unix で
しか動作しません。

The ‘tty’ module defines the following functions:

 -- の関数: tty.cfmakeraw (mode)

     Convert the tty attribute list 'mode', which is a list like the one
     returned by *note termios.tcgetattr(): 19f3, to that of a tty in
     raw mode.

     Added in version 3.12.

 -- の関数: tty.cfmakecbreak (mode)

     Convert the tty attribute list 'mode', which is a list like the one
     returned by *note termios.tcgetattr(): 19f3, to that of a tty in
     cbreak mode.

     This clears the ‘ECHO’ and ‘ICANON’ local mode flags in 'mode' as
     well as setting the minimum input to 1 byte with no delay.

     Added in version 3.12.

     バージョン 3.12.2 で変更: The ‘ICRNL’ flag is no longer cleared.
     This matches Linux and macOS ‘stty cbreak’ behavior and what *note
     setcbreak(): 19f5. historically did.

 -- の関数: tty.setraw (fd, when=termios.TCSAFLUSH)

     Change the mode of the file descriptor 'fd' to raw.  If 'when' is
     omitted, it defaults to *note termios.TCSAFLUSH: 4dd7, and is
     passed to *note termios.tcsetattr(): 1a69.  The return value of
     *note termios.tcgetattr(): 19f3. is saved before setting 'fd' to
     raw mode; this value is returned.

     バージョン 3.12 で変更: The return value is now the original tty
     attributes, instead of ‘None’.

 -- の関数: tty.setcbreak (fd, when=termios.TCSAFLUSH)

     Change the mode of file descriptor 'fd' to cbreak.  If 'when' is
     omitted, it defaults to *note termios.TCSAFLUSH: 4dd7, and is
     passed to *note termios.tcsetattr(): 1a69.  The return value of
     *note termios.tcgetattr(): 19f3. is saved before setting 'fd' to
     cbreak mode; this value is returned.

     This clears the ‘ECHO’ and ‘ICANON’ local mode flags as well as
     setting the minimum input to 1 byte with no delay.

     バージョン 3.12 で変更: The return value is now the original tty
     attributes, instead of ‘None’.

     バージョン 3.12.2 で変更: The ‘ICRNL’ flag is no longer cleared.
     This restores the behavior of Python 3.11 and earlier as well as
     matching what Linux, macOS, & BSDs describe in their ‘stty(1)’ man
     pages regarding cbreak mode.

参考
....

モジュール *note termios: e7.

     低水準端末制御インターフェース。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/tty.py


File: python.info,  Node: pty --- 擬似端末ユーティリティ,  Next: fcntl --- fcntl および ioctl システムコール,  Prev: tty --- 端末制御用の関数群,  Up: Unix-specific services

5.34.7 ‘pty’ -- 擬似端末ユーティリティ
--------------------------------------

'ソースコード:' Lib/pty.py(1)

__________________________________________________________________

The ‘pty’ module defines operations for handling the pseudo-terminal
concept: starting another process and being able to write to and read
from its controlling terminal programmatically.

*note Availability: 213f.: Unix.

Pseudo-terminal handling is highly platform dependent.  This code is
mainly tested on Linux, FreeBSD, and macOS (it is supposed to work on
other POSIX platforms but it's not been thoroughly tested).

The ‘pty’ module defines the following functions:

 -- の関数: pty.fork ()

     forkします。子プロセスの制御端末を擬似端末に接続します。返り値は
     ‘(pid, fd)’ です。子プロセスは 'pid' として0、'fd' として 'invalid'
     をそれぞれ受けとります。親プロセスは 'pid' として子プロセスのPID、
     'fd' として子プロセスの制御端末 (子プロセスの標準入出力に接続されて
     いる)のファイル記述子を受けとります。

          警告: On macOS the use of this function is unsafe when mixed
          with using higher-level system APIs, and that includes using
          *note urllib.request: 111.

 -- の関数: pty.openpty ()

     新しい擬似端末のペアを開きます。利用できるなら *note os.openpty():
     305a. を使い、利用できなければ一般的なUnixシステム用のエミュレーシ
     ョンコードを使います。マスター、スレーブそれぞれのためのファイル記
     述子、 ‘(master, slave)’ のタプルを返します。

 -- の関数: pty.spawn (argv[, master_read[, stdin_read]])

     Spawn a process, and connect its controlling terminal with the
     current process's standard io.  This is often used to baffle
     programs which insist on reading from the controlling terminal.  It
     is expected that the process spawned behind the pty will eventually
     terminate, and when it does 'spawn' will return.

     A loop copies STDIN of the current process to the child and data
     received from the child to STDOUT of the current process.  It is
     not signaled to the child if STDIN of the current process closes
     down.

     The functions 'master_read' and 'stdin_read' are passed a file
     descriptor which they should read from, and they should always
     return a byte string.  In order to force spawn to return before the
     child process exits an empty byte array should be returned to
     signal end of file.

     The default implementation for both functions will read and return
     up to 1024 bytes each time the function is called.  The
     'master_read' callback is passed the pseudoterminal’s master file
     descriptor to read output from the child process, and 'stdin_read'
     is passed file descriptor 0, to read from the parent process's
     standard input.

     Returning an empty byte string from either callback is interpreted
     as an end-of-file (EOF) condition, and that callback will not be
     called after that.  If 'stdin_read' signals EOF the controlling
     terminal can no longer communicate with the parent process OR the
     child process.  Unless the child process will quit without any
     input, 'spawn' will then loop forever.  If 'master_read' signals
     EOF the same behavior results (on linux at least).

     Return the exit status value from *note os.waitpid(): f9a. on the
     child process.

     *note os.waitstatus_to_exitcode(): b17. can be used to convert the
     exit status into an exit code.

     引数 ‘argv’ を指定して *note 監査イベント: 1c6e. ‘pty.spawn’ を送出
     します。

     バージョン 3.4 で変更: *note spawn(): 1184. が *note os.waitpid():
     f9a. が返す子プロセスのステータス値を返すようになりました。

* Menu:

* 使用例: 使用例<52>.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/pty.py


File: python.info,  Node: 使用例<52>,  Up: pty --- 擬似端末ユーティリティ

5.34.7.1 使用例
...............

下記のプログラムは Unix コマンド ‘script(1)(1)’ のように動作します。疑似
端末を使用して、端末セッションのすべての入出力を "typescript" に記録しま
す。

     import argparse
     import os
     import pty
     import sys
     import time

     parser = argparse.ArgumentParser()
     parser.add_argument('-a', dest='append', action='store_true')
     parser.add_argument('-p', dest='use_python', action='store_true')
     parser.add_argument('filename', nargs='?', default='typescript')
     options = parser.parse_args()

     shell = sys.executable if options.use_python else os.environ.get('SHELL', 'sh')
     filename = options.filename
     mode = 'ab' if options.append else 'wb'

     with open(filename, mode) as script:
         def read(fd):
             data = os.read(fd, 1024)
             script.write(data)
             return data

         print('Script started, file is', filename)
         script.write(('Script started on %s\n' % time.asctime()).encode())

         pty.spawn(shell, read)

         script.write(('Script done on %s\n' % time.asctime()).encode())
         print('Script done, file is', filename)

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/script(1)


File: python.info,  Node: fcntl --- fcntl および ioctl システムコール,  Next: resource --- リソース使用情報,  Prev: pty --- 擬似端末ユーティリティ,  Up: Unix-specific services

5.34.8 ‘fcntl’ -- ‘fcntl’ および ‘ioctl’ システムコール
-------------------------------------------------------

__________________________________________________________________

This module performs file and I/O control on file descriptors.  It is an
interface to the ‘fcntl()’ and ‘ioctl()’ Unix routines.  See the
‘fcntl(2)(1)’ and ‘ioctl(2)(2)’ Unix manual pages for full details.

*note Availability: 213f.: Unix, not WASI.

このモジュール内の全ての関数はファイル記述子 'fd' を最初の引数に取ります
。 この値は ‘sys.stdin.fileno()’ が返すような整数のファイル記述子でも、
‘sys.stdin’ 自体のような、純粋にファイル記述子だけを返す *note fileno():
17ad. メソッドを提供している *note io.IOBase: 505. オブジェクトでもかま
いません。

バージョン 3.3 で変更: 以前は *note IOError: 125e. を送出していたこのモ
ジュールの操作が、 *note OSError: 2c0. を送出するようになりました。

バージョン 3.8 で変更: The ‘fcntl’ module now contains ‘F_ADD_SEALS’,
‘F_GET_SEALS’, and ‘F_SEAL_*’ constants for sealing of *note
os.memfd_create(): bfe. file descriptors.

バージョン 3.9 で変更: On macOS, the ‘fcntl’ module exposes the
‘F_GETPATH’ constant, which obtains the path of a file from a file
descriptor.  On Linux(>=3.15), the ‘fcntl’ module exposes the
‘F_OFD_GETLK’, ‘F_OFD_SETLK’ and ‘F_OFD_SETLKW’ constants, which are
used when working with open file description locks.

バージョン 3.10 で変更: On Linux >= 2.6.11, the ‘fcntl’ module exposes
the ‘F_GETPIPE_SZ’ and ‘F_SETPIPE_SZ’ constants, which allow to check
and modify a pipe's size respectively.

バージョン 3.11 で変更: On FreeBSD, the ‘fcntl’ module exposes the
‘F_DUP2FD’ and ‘F_DUP2FD_CLOEXEC’ constants, which allow to duplicate a
file descriptor, the latter setting ‘FD_CLOEXEC’ flag in addition.

バージョン 3.12 で変更: On Linux >= 4.5, the ‘fcntl’ module exposes the
‘FICLONE’ and ‘FICLONERANGE’ constants, which allow to share some data
of one file with another file by reflinking on some filesystems (e.g.,
btrfs, OCFS2, and XFS). This behavior is commonly referred to as
"copy-on-write".

バージョン 3.13 で変更: On Linux >= 2.6.32, the ‘fcntl’ module exposes
the ‘F_GETOWN_EX’, ‘F_SETOWN_EX’, ‘F_OWNER_TID’, ‘F_OWNER_PID’,
‘F_OWNER_PGRP’ constants, which allow to direct I/O availability signals
to a specific thread, process, or process group.  On Linux >= 4.13, the
‘fcntl’ module exposes the ‘F_GET_RW_HINT’, ‘F_SET_RW_HINT’,
‘F_GET_FILE_RW_HINT’, ‘F_SET_FILE_RW_HINT’, and ‘RWH_WRITE_LIFE_*’
constants, which allow to inform the kernel about the relative expected
lifetime of writes on a given inode or via a particular open file
description.  On Linux >= 5.1 and NetBSD, the ‘fcntl’ module exposes the
‘F_SEAL_FUTURE_WRITE’ constant for use with ‘F_ADD_SEALS’ and
‘F_GET_SEALS’ operations.  On FreeBSD, the ‘fcntl’ module exposes the
‘F_READAHEAD’, ‘F_ISUNIONSTACK’, and ‘F_KINFO’ constants.  On macOS and
FreeBSD, the ‘fcntl’ module exposes the ‘F_RDAHEAD’ constant.  On NetBSD
and AIX, the ‘fcntl’ module exposes the ‘F_CLOSEM’ constant.  On NetBSD,
the ‘fcntl’ module exposes the ‘F_MAXFD’ constant.  On macOS and NetBSD,
the ‘fcntl’ module exposes the ‘F_GETNOSIGPIPE’ and ‘F_SETNOSIGPIPE’
constant.

バージョン 3.14 で変更: On Linux >= 6.1, the ‘fcntl’ module exposes the
‘F_DUPFD_QUERY’ to query a file descriptor pointing to the same file.

このモジュールには、以下の関数が定義されています:

 -- の関数: fcntl.fcntl (fd, cmd, arg=0, /)

     Perform the operation 'cmd' on file descriptor 'fd' (file objects
     providing a *note fileno(): 17ad. method are accepted as well).
     The values used for 'cmd' are operating system dependent, and are
     available as constants in the ‘fcntl’ module, using the same names
     as used in the relevant C header files.  The argument 'arg' can
     either be an integer value, a *note bytes-like object: 193, or a
     string.  The type and size of 'arg' must match the type and size of
     the argument of the operation as specified in the relevant C
     documentation.

     When 'arg' is an integer, the function returns the integer return
     value of the C ‘fcntl()’ call.

     When the argument is bytes-like object, it represents a binary
     structure, for example, created by *note struct.pack(): 148e.  A
     string value is encoded to binary using the UTF-8 encoding.  The
     binary data is copied to a buffer whose address is passed to the C
     ‘fcntl()’ call.  The return value after a successful call is the
     contents of the buffer, converted to a *note bytes: 192. object.
     The length of the returned object will be the same as the length of
     the 'arg' argument.  This is limited to 1024 bytes.

     If the ‘fcntl()’ call fails, an *note OSError: 2c0. is raised.

          注釈: If the type or the size of 'arg' does not match the type
          or size of the argument of the operation (for example, if an
          integer is passed when a pointer is expected, or the
          information returned in the buffer by the operating system is
          larger than 1024 bytes), this is most likely to result in a
          segmentation violation or a more subtle data corruption.

     引数 ‘fd’, ‘cmd’, ‘arg’ を指定して *note 監査イベント: 1c6e.
     ‘fcntl.fcntl’ を送出します。

     バージョン 3.14 で変更: Add support of arbitrary *note bytes-like
     objects: 193, not only *note bytes: 192.

 -- の関数: fcntl.ioctl (fd, request, arg=0, mutate_flag=True, /)

     この関数は *note fcntl(): 1851. 関数と同じですが、引数の扱いがより
     複雑であるところが異なります。

     The 'request' parameter is limited to values that can fit in
     32-bits or 64-bits, depending on the platform.  Additional
     constants of interest for use as the 'request' argument can be
     found in the *note termios: e7. module, under the same names as
     used in the relevant C header files.

     The parameter 'arg' can be an integer, a *note bytes-like object:
     193, or a string.  The type and size of 'arg' must match the type
     and size of the argument of the operation as specified in the
     relevant C documentation.

     If 'arg' does not support the read-write buffer interface or the
     'mutate_flag' is false, behavior is as for the *note fcntl(): 1851.
     function.

     If 'arg' supports the read-write buffer interface (like *note
     bytearray: 344.) and 'mutate_flag' is true (the default), then the
     buffer is (in effect) passed to the underlying ‘ioctl()’ system
     call, the latter's return code is passed back to the calling
     Python, and the buffer's new contents reflect the action of the
     ‘ioctl()’.  This is a slight simplification, because if the
     supplied buffer is less than 1024 bytes long it is first copied
     into a static buffer 1024 bytes long which is then passed to *note
     ioctl(): 1694. and copied back into the supplied buffer.

     If the ‘ioctl()’ call fails, an *note OSError: 2c0. exception is
     raised.

          注釈: If the type or size of 'arg' does not match the type or
          size of the operation's argument (for example, if an integer
          is passed when a pointer is expected, or the information
          returned in the buffer by the operating system is larger than
          1024 bytes, or the size of the mutable bytes-like object is
          too small), this is most likely to result in a segmentation
          violation or a more subtle data corruption.

     以下に例を示します:

          >>> import array, fcntl, struct, termios, os
          >>> os.getpgrp()
          13341
          >>> struct.unpack('h', fcntl.ioctl(0, termios.TIOCGPGRP, "  "))[0]
          13341
          >>> buf = array.array('h', [0])
          >>> fcntl.ioctl(0, termios.TIOCGPGRP, buf, 1)
          0
          >>> buf
          array('h', [13341])

     引数 ‘fd’, ‘request’, ‘arg’ を指定して *note 監査イベント: 1c6e.
     ‘fcntl.ioctl’ を送出します。

     バージョン 3.14 で変更: The GIL is always released during a system
     call.  System calls failing with EINTR are automatically retried.

 -- の関数: fcntl.flock (fd, operation, /)

     ファイル記述子 'fd' (*note fileno(): 17ad. メソッドを提供しているフ
     ァイルオブジェクトも含む) に対してロック操作 'operation' を実行しま
     す。 詳細は Unix マニュアルの ‘flock(2)(3)’ を参照してください (シ
     ステムによっては、この関数は ‘fcntl()’ を使ってエミュレーションされ
     ています)。

     If the ‘flock()’ call fails, an *note OSError: 2c0. exception is
     raised.

     引数 ‘fd’, ‘operation’ を指定して *note 監査イベント: 1c6e.
     ‘fcntl.flock’ を送出します。

 -- の関数: fcntl.lockf (fd, cmd, len=0, start=0, whence=0, /)

     本質的に *note fcntl(): 1851. によるロッキングの呼び出しをラップし
     たものです。 'fd' はロックまたはアンロックするファイルのファイル記
     述子 (*note fileno(): 17ad. メソッドを提供するファイルオブジェクト
     も受け付けられます) で、 'cmd' は以下の値のうちいずれかになります:

      -- データ: fcntl.LOCK_UN

          Release an existing lock.

      -- データ: fcntl.LOCK_SH

          Acquire a shared lock.

      -- データ: fcntl.LOCK_EX

          Acquire an exclusive lock.

      -- データ: fcntl.LOCK_NB

          Bitwise OR with any of the other three ‘LOCK_*’ constants to
          make the request non-blocking.

     If ‘LOCK_NB’ is used and the lock cannot be acquired, an *note
     OSError: 2c0. will be raised and the exception will have an 'errno'
     attribute set to *note EACCES: 270c. or *note EAGAIN: 26fd.
     (depending on the operating system; for portability, check for both
     values).  On at least some systems, ‘LOCK_EX’ can only be used if
     the file descriptor refers to a file opened for writing.

     'len' はロックを行いたいバイト数、 'start' はロック領域先頭の
     'whence' からの相対的なバイトオフセット、 'whence' は *note
     io.IOBase.seek(): 14a4. と同じで、具体的には:

        * ‘0’ - relative to the start of the file (*note os.SEEK_SET:
          14a5.)

        * ‘1’ - relative to the current buffer position (*note
          os.SEEK_CUR: 14a6.)

        * ‘2’ - relative to the end of the file (*note os.SEEK_END:
          14a7.)

     'start' の標準の値は 0 で、ファイルの先頭から開始することを意味しま
     す。'len' の標準の値は 0 で、ファイルの終了までロックすることを表し
     ます。'whence' の標準の値も 0 です。

     引数 ‘fd’, ‘cmd’, ‘len’, ‘start’, ‘whence’ を指定して *note
     監査イベント: 1c6e. ‘fcntl.lockf’ を送出します。

以下に (全ての SVR4 互換システムでの) 例を示します:

     import struct, fcntl, os

     f = open(...)
     rv = fcntl.fcntl(f, fcntl.F_SETFL, os.O_NDELAY)

     lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)
     rv = fcntl.fcntl(f, fcntl.F_SETLKW, lockdata)

最初の例では、戻り値 'rv' は整数値を保持しています; 二つ目の例では *note
bytes: 192. オブジェクトを保持しています。 'lockdata' 変数の構造体レイア
ウトはシステム依存です -- 従って *note flock(): 475c. を呼ぶ方が良いでし
ょう。

参考
....

*note os: a5. モジュール

     If the locking flags *note O_SHLOCK: 1648. and *note O_EXLOCK:
     1649. are present in the *note os: a5. module (on BSD only), the
     *note os.open(): f92. function provides an alternative to the *note
     lockf(): 1605. and *note flock(): 475c. functions.

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/fcntl(2)

   (2) https://manpages.debian.org/ioctl(2)

   (3) https://manpages.debian.org/flock(2)


File: python.info,  Node: resource --- リソース使用情報,  Next: syslog --- Unix syslog ライブラリルーチン群,  Prev: fcntl --- fcntl および ioctl システムコール,  Up: Unix-specific services

5.34.9 ‘resource’ -- リソース使用情報
-------------------------------------

__________________________________________________________________

このモジュールでは、プログラムによって使用されているシステムリソースを計
測したり制御するための基本的なメカニズムを提供します。

*note Availability: 213f.: Unix, not WASI.

特定のシステムリソースを指定したり、現在のプロセスやその子プロセスのリソ
ース使用情報を要求するためにシンボル定数が使われます。

システムコールが失敗した場合 *note OSError: 2c0. を送出します。

 -- 例外: resource.error

     *note OSError: 2c0. の非推奨のエイリアスです。

     バージョン 3.3 で変更: PEP 3151(1) に基づき、このクラスは *note
     OSError: 2c0. のエイリアスになりました。

* Menu:

* リソースの制限::
* リソースの使用状態::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3151/


File: python.info,  Node: リソースの制限,  Next: リソースの使用状態,  Up: resource --- リソース使用情報

5.34.9.1 リソースの制限
.......................

リソースの使用は下に述べる *note setrlimit(): 17c6. 関数を使って制限する
ことができます。各リソースは二つ組の制限値: ソフトリミット (soft limit)
、およびハードリミット (hard limit) 、で制御されます。ソフトリミットは現
在の制限値で、時間とともにプロセスによって下げたり上げたりできます。ソフ
トリミットはハードリミットを超えることはできません。ハードリミットはソフ
トリミットよりも高い任意の値まで下げることができますが、上げることはでき
ません。 (スーパユーザの有効な UID を持つプロセスのみがハードリミットを
上げることができます。)

制限をかけるべく指定できるリソースはシステムに依存します。指定できるリソ
ースは ‘getrlimit(2)(1)’ マニュアルページで解説されています。以下に列挙
するリソースは背後のオペレーティングシステムがサポートする場合にサポート
されています; オペレーティングシステム側で値を調べたり制御したりできない
リソースは、そのプラットフォーム向けのこのモジュール内では定義されていま
せん。

 -- データ: resource.RLIM_INFINITY

     無制限のリソースの上限を示すための定数です。

 -- の関数: resource.getrlimit (resource)

     'resource' の現在のソフトおよびハードリミットを表すタプル ‘(soft,
     hard)’ を返します。無効なリソースが指定された場合には *note
     ValueError: 2ec. が、背後のシステムコールが予期せず失敗した場合には
     *note error: 4df1. が送出されます。

 -- の関数: resource.setrlimit (resource, limits)

     Sets new limits of consumption of 'resource'.  The 'limits'
     argument must be a tuple ‘(soft, hard)’ of two integers describing
     the new limits.  A value of *note RLIM_INFINITY: 17c5. can be used
     to request a limit that is unlimited.

     Raises *note ValueError: 2ec. if an invalid resource is specified,
     if the new soft limit exceeds the hard limit, or if a process tries
     to raise its hard limit.  Specifying a limit of *note
     RLIM_INFINITY: 17c5. when the hard or system limit for that
     resource is not unlimited will result in a *note ValueError: 2ec.
     A process with the effective UID of super-user can request any
     valid limit value, including unlimited, but *note ValueError: 2ec.
     will still be raised if the requested limit exceeds the system
     imposed limit.

     ‘setrlimit’ は背後のシステムコールが予期せず失敗した場合に、 *note
     error: 4df1. を送出する場合があります。

     VxWorks only supports setting *note RLIMIT_NOFILE: 4df3.

     引数 ‘src’, ‘dst`, ``limits’ を指定して *note 監査イベント: 1c6e.
     ‘resource.setrlimit’ を送出します。

 -- の関数: resource.prlimit (pid, resource[, limits])

     1つの関数の中で *note setrlimit(): 17c6. と *note getrlimit():
     17c4. を組み合わせ、任意のプロセスのリソースの制限値を取得したり設
     定したりします。 'pid' が 0 の場合は、現在のプロセスに適用されます
     。 'resource' および 'limits' は、 'limits' がオプションであること
     を除けば、 *note setrlimit(): 17c6. と同じ意味です。

     'limits' が与えられないときは、関数はプロセス 'pid' の 'resource' の
     制限値を返します。 'limits' が与えられたときは、プロセスの
     'resource' の制限値が設定され、設定が変更される前のリソースの制限値
     が返されます。

     'pid' が見付からないときは *note ProcessLookupError: 1266. を、ユー
     ザがプロセスの ‘CAP_SYS_RESOURCE’ を持ってないときは *note
     PermissionError: f3e. を送出します。

     引数 ‘pid’, ‘dst`, ``limits’ を指定して *note 監査イベント: 1c6e.
     ‘resource.prlimit’ を送出します。

     *note Availability: 213f.: Linux >= 2.6.36 with glibc >= 2.13.

     Added in version 3.4.

以下のシンボルは、後に述べる関数 *note setrlimit(): 17c6. および *note
getrlimit(): 17c4. を使って消費量を制御することができるリソースを定義し
ています。これらのシンボルの値は、C プログラムで使われているシンボルと全
く同じです。

‘getrlimit(2)(2)’ の Unix マニュアルページには、指定可能なリソースが列挙
されています。全てのシステムで同じシンボルが使われているわけではなく、ま
た同じリソースを表すために同じ値が使われているとも限らないので注意してく
ださい。このモジュールはプラットフォーム間の相違を隠蔽しようとはしていま
せん -- あるプラットフォームで定義されていないシンボルは、そのプラットフ
ォーム向けの本モジュールでは利用することができません。

 -- データ: resource.RLIMIT_CORE

     現在のプロセスが生成できるコアファイルの最大 (バイト) サイズです。
     プロセスの全体イメージを入れるためにこの値より大きなサイズのコアフ
     ァイルが要求された結果、部分的なコアファイルが生成される可能性があ
     ります。

 -- データ: resource.RLIMIT_CPU

     The maximum amount of processor time (in seconds) that a process
     can use.  If this limit is exceeded, a *note SIGXCPU: 3a70. signal
     is sent to the process.  (See the *note signal: cb. module
     documentation for information about how to catch this signal and do
     something useful, e.g.  flush open files to disk.)

 -- データ: resource.RLIMIT_FSIZE

     プロセスが作成するファイルの最大サイズです。

 -- データ: resource.RLIMIT_DATA

     プロセスのヒープの最大 (バイト) サイズです。

 -- データ: resource.RLIMIT_STACK

     現在のプロセスのコールスタックの最大サイズ (バイト単位) です。 これ
     はマルチスレッドプロセスのメインスレッドのスタックのみに影響します
     。

 -- データ: resource.RLIMIT_RSS

     プロセスが取りうる最大 RAM 常駐ページサイズ (resident set size) で
     す。

 -- データ: resource.RLIMIT_NPROC

     現在のプロセスが生成できるプロセスの上限です。

 -- データ: resource.RLIMIT_NOFILE

     現在のプロセスが開けるファイル記述子の上限です。

 -- データ: resource.RLIMIT_OFILE

     *note RLIMIT_NOFILE: 4df3. の BSD での名称です。

 -- データ: resource.RLIMIT_MEMLOCK

     メモリ中でロックできる最大アドレス空間です。

 -- データ: resource.RLIMIT_VMEM

     The largest area of mapped memory which the process may occupy.
     Usually an alias of *note RLIMIT_AS: 4dfd.

     *note Availability: 213f.: Solaris, FreeBSD, NetBSD.

 -- データ: resource.RLIMIT_AS

     アドレス空間でプロセスが占有できる最大領域 (バイト単位) です。

 -- データ: resource.RLIMIT_MSGQUEUE

     POSIX メッセージキューに割り当てることの出来るバイト数です。

     *note Availability: 213f.: Linux >= 2.6.8.

     Added in version 3.4.

 -- データ: resource.RLIMIT_NICE

     プロセスの nice の上限です (20 - rlim_cur)。

     *note Availability: 213f.: Linux >= 2.6.12.

     Added in version 3.4.

 -- データ: resource.RLIMIT_RTPRIO

     リアルタイム優先順位の上限です。

     *note Availability: 213f.: Linux >= 2.6.12.

     Added in version 3.4.

 -- データ: resource.RLIMIT_RTTIME

     リアルタイムスケジューリングにおいて、プロセスがブロッキングシステ
     ムコールを行わずに使用できるCPU時間の制限値（マイクロ秒単位）。

     *note Availability: 213f.: Linux >= 2.6.25.

     Added in version 3.4.

 -- データ: resource.RLIMIT_SIGPENDING

     プロセスがキュー出来るシグナルの数です。

     *note Availability: 213f.: Linux >= 2.6.8.

     Added in version 3.4.

 -- データ: resource.RLIMIT_SBSIZE

     このユーザが使用するソケットバッファの最大サイズ(バイト単位)。これ
     は、このユーザが常に保持できるネットワークメモリの量、つまり mbuf の
     量を制限します。

     *note Availability: 213f.: FreeBSD, NetBSD.

     Added in version 3.4.

 -- データ: resource.RLIMIT_SWAP

     このユーザ ID のすべてのプロセスで予約または使用できるスワップスペ
     ースの最大サイズ (バイト単位)。この制限は vm.overcommit sysctl のビ
     ット 1 が設定されている場合のみ適用されます。この sysctl の完全な説
     明については tuning(7)(3) を参照してください。

     *note Availability: 213f.: FreeBSD >= 8.

     Added in version 3.4.

 -- データ: resource.RLIMIT_NPTS

     このユーザ ID が作成する擬似端末の数の上限です。

     *note Availability: 213f.: FreeBSD >= 8.

     Added in version 3.4.

 -- データ: resource.RLIMIT_KQUEUES

     The maximum number of kqueues this user id is allowed to create.

     *note Availability: 213f.: FreeBSD >= 11.

     Added in version 3.10.

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/getrlimit(2)

   (2) https://manpages.debian.org/getrlimit(2)

   (3) https://man.freebsd.org/cgi/man.cgi?query=tuning&sektion=7


File: python.info,  Node: リソースの使用状態,  Prev: リソースの制限,  Up: resource --- リソース使用情報

5.34.9.2 リソースの使用状態
...........................

以下の関数はリソース使用情報を取得するために使われます:

 -- の関数: resource.getrusage (who)

     This function returns an object that describes the resources
     consumed by either the current process or its children, as
     specified by the 'who' parameter.  The 'who' parameter should be
     specified using one of the ‘RUSAGE_*’ constants described below.

     簡単な例:

          from resource import *
          import time

          # a non CPU-bound task
          time.sleep(3)
          print(getrusage(RUSAGE_SELF))

          # a CPU-bound task
          for i in range(10 ** 8):
             _ = 1 + 1
          print(getrusage(RUSAGE_SELF))

     The fields of the return value each describe how a particular
     system resource has been used, e.g.  amount of time spent running
     in user mode or number of times the process was swapped out of main
     memory.  Some values are dependent on the clock tick interval, e.g.
     the amount of memory the process is using.

     以前のバージョンとの互換性のため、返される値は 16 要素からなるタプ
     ルとしてアクセスすることもできます。

     The fields ‘ru_utime’ and ‘ru_stime’ of the return value are
     floating-point values representing the amount of time spent
     executing in user mode and the amount of time spent executing in
     system mode, respectively.  The remaining values are integers.
     Consult the ‘getrusage(2)(1)’ man page for detailed information
     about these values.  A brief summary is presented here:

     インデック   フィールド                 リソース
     ス                                      

     ------------------------------------------------------------------------------------
                                             
     ‘0’          ‘ru_utime’                 time in user mode (float seconds)
                                             
                                             
     ‘1’          ‘ru_stime’                 time in system mode (float seconds)
                                             
                                             
     ‘2’          ‘ru_maxrss’                最大常駐ページサイズ
                                             
                                             
     ‘3’          ‘ru_ixrss’                 共有メモリサイズ
                                             
                                             
     ‘4’          ‘ru_idrss’                 非共有メモリサイズ
                                             
                                             
     ‘5’          ‘ru_isrss’                 非共有スタックサイズ
                                             
                                             
     ‘6’          ‘ru_minflt’                I/O を必要としないページフォールト数
                                             
                                             
     ‘7’          ‘ru_majflt’                I/O を必要とするページフォールト数
                                             
                                             
     ‘8’          ‘ru_nswap’                 スワップアウト回数
                                             
                                             
     ‘9’          ‘ru_inblock’               ブロック入力操作数
                                             
                                             
     ‘10’         ‘ru_oublock’               ブロック出力操作数
                                             
                                             
     ‘11’         ‘ru_msgsnd’                送信メッセージ数
                                             
                                             
     ‘12’         ‘ru_msgrcv’                受信メッセージ数
                                             
                                             
     ‘13’         ‘ru_nsignals’              受信シグナル数
                                             
                                             
     ‘14’         ‘ru_nvcsw’                 自発的な実行コンテキスト切り替え数
                                             
                                             
     ‘15’         ‘ru_nivcsw’                非自発的な実行コンテキスト切り替え数
                                             

     この関数は無効な 'who' 引数を指定した場合には *note ValueError:
     2ec. を送出します。また、異常が発生した場合には *note error: 4df1.
     例外が送出される可能性があります。

 -- の関数: resource.getpagesize ()

     システムページ内のバイト数を返します。(ハードウェアページサイズと同
     じとは限りません。)

The following ‘RUSAGE_*’ symbols are passed to the *note getrusage():
164a. function to specify which processes information should be provided
for.

 -- データ: resource.RUSAGE_SELF

     *note getrusage(): 164a. に渡すと呼び出し中のプロセスが消費している
     リソースを要求します。そのプロセスの全スレッドが使用するリソースの
     合計です。

 -- データ: resource.RUSAGE_CHILDREN

     呼び出し元のプロセスの子プロセスが消費するリソースを要求するために
     、 *note getrusage(): 164a. に渡して終了させ、待機させることができ
     ます。

 -- データ: resource.RUSAGE_BOTH

     *note getrusage(): 164a. に渡すと現在のプロセスおよび子プロセスの両
     方が消費しているリソースを要求します。全てのシステムで利用可能なわ
     けではありません。

 -- データ: resource.RUSAGE_THREAD

     *note getrusage(): 164a. に渡すと現在のスレッドが消費しているリソー
     スを要求します。全てのシステムで利用可能なわけではありません。

     Added in version 3.2.

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/getrusage(2)


File: python.info,  Node: syslog --- Unix syslog ライブラリルーチン群,  Prev: resource --- リソース使用情報,  Up: Unix-specific services

5.34.10 ‘syslog’ -- Unix syslog ライブラリルーチン群
----------------------------------------------------

__________________________________________________________________

このモジュールでは Unix ‘syslog’ ライブラリルーチン群へのインターフェー
スを提供します。‘syslog’ の便宜レベルに関する詳細な記述は Unix マニュア
ルページを参照してください。

*note Availability: 213f.: Unix, not WASI, not iOS.

このモジュールはシステムの ‘syslog’ ファミリのルーチンをラップしています
。 syslog サーバーと通信できる pure Python のライブラリが、 *note
logging.handlers: 8d. モジュールの *note SysLogHandler: 86c. にあります
。

このモジュールには、以下の関数が定義されています:

 -- の関数: syslog.syslog (message)

 -- の関数: syslog.syslog (priority, message)

     文字列 'message' をシステムログ機構に送信します。末尾の改行文字は必
     要に応じて追加されます。各メッセージは 'facility' および 'level' か
     らなる優先度でタグ付けされます。オプションの 'priority' 引数はメッ
     セージの優先度を定義します。標準の値は *note LOG_INFO: 4e07. です。
     'priority' 中に、便宜レベルが (‘LOG_INFO | LOG_USER’ のように) 論理
     和を使ってコード化されていない場合、 *note openlog(): 760. を呼び出
     した際の値が使われます。

     *note syslog(): e2. が呼び出される前に *note openlog(): 760. が呼び
     出されなかった場合、 *note openlog(): 760. が引数なしで呼び出されま
     す。

     引数 ‘priority’, ‘message’ を指定して *note 監査イベント: 1c6e.
     ‘syslog.syslog’ を送出します。

     バージョン 3.2 で変更: In previous versions, *note openlog(): 760.
     would not be called automatically if it wasn't called prior to the
     call to *note syslog(): e2, deferring to the syslog implementation
     to call ‘openlog()’.

     バージョン 3.12 で変更: This function is restricted in
     subinterpreters.  (Only code that runs in multiple interpreters is
     affected and the restriction is not relevant for most users.)
     *note openlog(): 760. must be called in the main interpreter before
     *note syslog(): e2. may be used in a subinterpreter.  Otherwise it
     will raise *note RuntimeError: 244.

 -- の関数: syslog.openlog ([ident[, logoption[, facility]]])

     *note openlog(): 760. 関数を呼び出すことで以降の *note syslog():
     e2. の呼び出しに対するログオプションを設定することができます。ログ
     がまだ開かれていない状態で *note syslog(): e2. を呼び出すと *note
     openlog(): 760. が引数なしで呼び出されます。

     オプションの 'ident' キーワード引数は全てのメッセージの先頭に付く文
     字列で、デフォルトでは ‘sys.argv[0]’ から前方のパス部分を取り除いた
     ものです。オプションの 'logoption' キーワード引数 (デフォルトは 0)
     はビットフィールドです。組み合わせられる値については下記を参照して
     ください。オプションの 'facility' キーワード引数 (デフォルトは
     *note LOG_USER: 4e08.) は明示的に facility が encode されていないメ
     ッセージに設定される facility です。

     引数 ‘ident’, ‘logoptiona'’, ‘facility’ を指定して *note
     監査イベント: 1c6e. ‘syslog.openlog’ を送出します。

     バージョン 3.2 で変更: In previous versions, keyword arguments were
     not allowed, and 'ident' was required.

     バージョン 3.12 で変更: This function is restricted in
     subinterpreters.  (Only code that runs in multiple interpreters is
     affected and the restriction is not relevant for most users.)  This
     may only be called in the main interpreter.  It will raise *note
     RuntimeError: 244. if called in a subinterpreter.

 -- の関数: syslog.closelog ()

     syslog モジュールの値をリセットし、システムライブラリの
     ‘closelog()’ を呼び出します。

     この関数を呼ぶと、モジュールが最初に import されたときと同じように
     ふるまいます。例えば、(*note openlog(): 760. を呼び出さないで)
     *note syslog(): e2. を最初に呼び出したときに、 *note openlog():
     760. が呼び出され、 'ident' やその他の *note openlog(): 760. の引数
     はデフォルト値にリセットされます。

     引数無しで *note 監査イベント: 1c6e. ‘syslog.closelog’ を送出します
     。

     バージョン 3.12 で変更: This function is restricted in
     subinterpreters.  (Only code that runs in multiple interpreters is
     affected and the restriction is not relevant for most users.)  This
     may only be called in the main interpreter.  It will raise *note
     RuntimeError: 244. if called in a subinterpreter.

 -- の関数: syslog.setlogmask (maskpri)

     優先度マスクを 'maskpri' に設定し、以前のマスク値を返します。
     'maskpri' に設定されていない優先度レベルを持った *note syslog():
     e2. の呼び出しは無視されます。標準では全ての優先度をログ出力します
     。関数 ‘LOG_MASK(pri)’ は個々の優先度 'pri' に対する優先度マスクを
     計算します。関数 ‘LOG_UPTO(pri)’ は優先度 'pri' までの全ての優先度
     を含むようなマスクを計算します。

     引数 ‘maskpri’ を指定して *note 監査イベント: 1c6e.
     ‘socket.setlogmask’ を送出します。

このモジュールでは以下の定数を定義しています:

 -- データ: syslog.LOG_EMERG
 -- データ: syslog.LOG_ALERT
 -- データ: syslog.LOG_CRIT
 -- データ: syslog.LOG_ERR
 -- データ: syslog.LOG_WARNING
 -- データ: syslog.LOG_NOTICE
 -- データ: syslog.LOG_INFO
 -- データ: syslog.LOG_DEBUG

     優先度 (高いものから低いもの) 。

 -- データ: syslog.LOG_AUTH
 -- データ: syslog.LOG_AUTHPRIV
 -- データ: syslog.LOG_CRON
 -- データ: syslog.LOG_DAEMON
 -- データ: syslog.LOG_FTP
 -- データ: syslog.LOG_INSTALL
 -- データ: syslog.LOG_KERN
 -- データ: syslog.LOG_LAUNCHD
 -- データ: syslog.LOG_LPR
 -- データ: syslog.LOG_MAIL
 -- データ: syslog.LOG_NETINFO
 -- データ: syslog.LOG_NEWS
 -- データ: syslog.LOG_RAS
 -- データ: syslog.LOG_REMOTEAUTH
 -- データ: syslog.LOG_SYSLOG
 -- データ: syslog.LOG_USER
 -- データ: syslog.LOG_UUCP
 -- データ: syslog.LOG_LOCAL0
 -- データ: syslog.LOG_LOCAL1
 -- データ: syslog.LOG_LOCAL2
 -- データ: syslog.LOG_LOCAL3
 -- データ: syslog.LOG_LOCAL4
 -- データ: syslog.LOG_LOCAL5
 -- データ: syslog.LOG_LOCAL6
 -- データ: syslog.LOG_LOCAL7

     Facilities, depending on availability in ‘<syslog.h>’ for *note
     LOG_AUTHPRIV: 4e11, *note LOG_FTP: 4e14, *note LOG_NETINFO: 4e1a,
     *note LOG_REMOTEAUTH: 4e1d, *note LOG_INSTALL: 4e15. and *note
     LOG_RAS: 4e1c.

     バージョン 3.13 で変更: Added *note LOG_FTP: 4e14, *note
     LOG_NETINFO: 4e1a, *note LOG_REMOTEAUTH: 4e1d, *note LOG_INSTALL:
     4e15, *note LOG_RAS: 4e1c, and *note LOG_LAUNCHD: 4e17.

 -- データ: syslog.LOG_PID
 -- データ: syslog.LOG_CONS
 -- データ: syslog.LOG_NDELAY
 -- データ: syslog.LOG_ODELAY
 -- データ: syslog.LOG_NOWAIT
 -- データ: syslog.LOG_PERROR

     Log options, depending on availability in ‘<syslog.h>’ for *note
     LOG_ODELAY: 4e2b, *note LOG_NOWAIT: 4e2c. and *note LOG_PERROR:
     4e2d.

* Menu:

* 使用例: 使用例<53>.


File: python.info,  Node: 使用例<53>,  Up: syslog --- Unix syslog ライブラリルーチン群

5.34.10.1 使用例
................

* Menu:

* シンプルな例::


File: python.info,  Node: シンプルな例,  Up: 使用例<53>

5.34.10.2 シンプルな例
......................

1つ目のシンプルな例:

     import syslog

     syslog.syslog('Processing started')
     if error:
         syslog.syslog(syslog.LOG_ERR, 'Processing started')

いくつかのログオプションを設定する例。ログメッセージにプロセスIDを含み、
メッセージをメールのログ用の facility にメッセージを書きます:

     syslog.openlog(logoption=syslog.LOG_PID, facility=syslog.LOG_MAIL)
     syslog.syslog('E-mail processing initiated...')


File: python.info,  Node: モジュールのコマンドラインインターフェース CLI,  Next: 取って代わられたモジュール群,  Prev: Unix-specific services,  Up: Python 標準ライブラリ

5.35 モジュールのコマンドラインインターフェース (CLI)
=====================================================

以下のモジュールにはコマンドラインインターフェースがあります。

   * *note ast: 4bdb.

   * *note asyncio: 37c2.

   * *note base64: f.

   * *note calendar: 1d0.

   * *note code: 1b.

   * *note compileall: 4c98.

   * *note cProfile: 2b.: *note profile: 47fe. を参照

   * *note dis: 4caf.

   * *note doctest: 4557.

   * ‘encodings.rot_13’

   * *note ensurepip: 48a8.

   * *note filecmp: 5e.

   * *note fileinput: 5f.

   * *note ftplib: 62.

   * *note gzip: 2e5a.

   * *note http.server: 1153.

   * *note idlelib: 4408.

   * *note inspect: 115d.

   * *note json: 23e.

   * *note mimetypes: 247.

   * *note pdb: 2e2.

   * *note pickle: 2d2e.

   * *note pickletools: 2d2f.

   * *note platform: 3244.

   * *note poplib: b1.

   * *note profile: 47fe.

   * *note pstats: b5.

   * *note py_compile: 4c8f.

   * *note pyclbr: b9.

   * *note pydoc: ba.

   * *note quopri: bc.

   * *note random: 47f.

   * *note runpy: c3.

   * *note site: 4aae.

   * *note sqlite3: 674.

   * *note symtable: 4c12.

   * *note sysconfig: 4974.

   * *note tabnanny: e3.

   * *note tarfile: 11cd.

   * ‘this’

   * *note timeit: 4822.

   * *note tokenize: 4c60.

   * *note trace: 483f.

   * *note turtledemo: 108.

   * *note unittest: 1136.

   * *note uuid: 676.

   * *note venv: 48b6.

   * *note webbrowser: 3ec3.

   * *note zipapp: 48d0.

   * *note zipfile: 2ec9.

*note Python コマンドラインインターフェース: 1da7. も参照してください。


File: python.info,  Node: 取って代わられたモジュール群,  Next: 削除されたモジュール,  Prev: モジュールのコマンドラインインターフェース CLI,  Up: Python 標準ライブラリ

5.36 取って代わられたモジュール群
=================================

The modules described in this chapter have been superseded by other
modules for most use cases, and are retained primarily to preserve
backwards compatibility.

Modules may appear in this chapter because they only cover a limited
subset of a problem space, and a more generally applicable solution is
available elsewhere in the standard library (for example, *note getopt:
65. covers the very specific task of "mimic the C ‘getopt()’ API in
Python", rather than the broader command line option parsing and
argument parsing capabilities offered by *note optparse: a4. and *note
argparse: 7.).

Alternatively, modules may appear in this chapter because they are
deprecated outright, and awaiting removal in a future release, or they
are *note soft deprecated: 23d. and their use is actively discouraged in
new projects.  With the removal of various obsolete modules through PEP
594(1), there are currently no modules in this latter category.

* Menu:

* getopt: getopt --- C-style parser for command line options. C-style parser for command line options

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/


File: python.info,  Node: getopt --- C-style parser for command line options,  Up: 取って代わられたモジュール群

5.36.1 ‘getopt’ -- C-style parser for command line options
----------------------------------------------------------

'ソースコード:' Lib/getopt.py(1)

     注釈: This module is considered feature complete.  A more
     declarative and extensible alternative to this API is provided in
     the *note optparse: a4. module.  Further functional enhancements
     for command line parameter processing are provided either as third
     party modules on PyPI, or else as features in the *note argparse:
     7. module.

__________________________________________________________________

This module helps scripts to parse the command line arguments in
‘sys.argv’.  It supports the same conventions as the Unix ‘getopt()’
function (including the special meanings of arguments of the form '‘-’'
and '‘--’').  Long options similar to those supported by GNU software
may be used as well via an optional third argument.

Users who are unfamiliar with the Unix ‘getopt()’ function should
consider using the *note argparse: 7. module instead.  Users who are
familiar with the Unix ‘getopt()’ function, but would like to get
equivalent behavior while writing less code and getting better help and
error messages should consider using the *note optparse: a4. module.
See *note Choosing an argument parsing library: 336b. for additional
details.

このモジュールは2つの関数と1つの例外を提供しています:

 -- の関数: getopt.getopt (args, shortopts, longopts=[])

     Parses command line options and parameter list.  'args' is the
     argument list to be parsed, without the leading reference to the
     running program.  Typically, this means ‘sys.argv[1:]’.
     'shortopts' is the string of option letters that the script wants
     to recognize, with options that require an argument followed by a
     colon (‘':'’) and options that accept an optional argument followed
     by two colons (‘'::'’); i.e., the same format that Unix ‘getopt()’
     uses.

          注釈: Unlike GNU ‘getopt()’, after a non-option argument, all
          further arguments are considered also non-options.  This is
          similar to the way non-GNU Unix systems work.

     'longopts', if specified, must be a list of strings with the names
     of the long options which should be supported.  The leading ‘'--'’
     characters should not be included in the option name.  Long options
     which require an argument should be followed by an equal sign
     (‘'='’).  Long options which accept an optional argument should be
     followed by an equal sign and question mark (‘'=?'’).  To accept
     only long options, 'shortopts' should be an empty string.  Long
     options on the command line can be recognized so long as they
     provide a prefix of the option name that matches exactly one of the
     accepted options.  For example, if 'longopts' is ‘['foo', 'frob']’,
     the option ‘--fo’ will match as ‘--foo’, but ‘--f’ will not match
     uniquely, so *note GetoptError: 18ea. will be raised.

     返り値は2つの要素から成っています: 最初は ‘(option, value)’ のタプ
     ルのリスト、2つ目はオプションリストを取り除いたあとに残ったプログラ
     ムの引数リストです ('args' の末尾部分のスライスになります)。それぞ
     れの引数と値のタプルの最初の要素は、短形式の時はハイフン 1つで始ま
     る文字列 (例: ‘'-x'’)、長形式の時はハイフン2つで始まる文字列 (例:
     ‘'--long-option'’) となり、引数が2番目の要素になります。引数をとら
     ない場合には空文字列が入ります。オプションは見つかった順に並んでい
     て、複数回同じオプションを指定できます。長形式と短形式のオプション
     は混在できます。

     バージョン 3.14 で変更: Optional arguments are supported.

 -- の関数: getopt.gnu_getopt (args, shortopts, longopts=[])

     この関数はデフォルトで GNU スタイルのスキャンモードを使う以外は
     *note getopt(): 65. と同じように動作します。つまり、オプションとオ
     プションでない引数とを混在させることができます。*note getopt(): 65.
     関数はオプションでない引数を見つけると解析を停止します。

     If the first character of the option string is ‘'+'’, or if the
     environment variable ‘POSIXLY_CORRECT’ is set, then option
     processing stops as soon as a non-option argument is encountered.

     If the first character of the option string is ‘'-'’, non-option
     arguments that are followed by options are added to the list of
     option-and-value pairs as a pair that has ‘None’ as its first
     element and the list of non-option arguments as its second element.
     The second element of the ‘gnu_getopt()’ result is a list of
     program arguments after the last option.

     バージョン 3.14 で変更: Support for returning intermixed options
     and non-option arguments in order.

 -- 例外: getopt.GetoptError

     This is raised when an unrecognized option is found in the argument
     list or when an option requiring an argument is given none.  The
     argument to the exception is a string indicating the cause of the
     error.  For long options, an argument given to an option which does
     not require one will also cause this exception to be raised.  The
     attributes ‘msg’ and ‘opt’ give the error message and related
     option; if there is no specific option to which the exception
     relates, ‘opt’ is an empty string.

 -- 例外: getopt.error

     *note GetoptError: 18ea. へのエイリアスです。後方互換性のために残さ
     れています。

Unix スタイルのオプションを使った例です:

     >>> import getopt
     >>> args = '-a -b -cfoo -d bar a1 a2'.split()
     >>> args
     ['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']
     >>> optlist, args = getopt.getopt(args, 'abc:d:')
     >>> optlist
     [('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]
     >>> args
     ['a1', 'a2']

長形式のオプションを使っても同様です:

     >>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'
     >>> args = s.split()
     >>> args
     ['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', 'a2']
     >>> optlist, args = getopt.getopt(args, 'x', [
     ...     'condition=', 'output-file=', 'testing'])
     >>> optlist
     [('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-x', '')]
     >>> args
     ['a1', 'a2']

Optional arguments should be specified explicitly:

     >>> s = '-Con -C --color=off --color a1 a2'
     >>> args = s.split()
     >>> args
     ['-Con', '-C', '--color=off', '--color', 'a1', 'a2']
     >>> optlist, args = getopt.getopt(args, 'C::', ['color=?'])
     >>> optlist
     [('-C', 'on'), ('-C', ''), ('--color', 'off'), ('--color', '')]
     >>> args
     ['a1', 'a2']

The order of options and non-option arguments can be preserved:

     >>> s = 'a1 -x a2 a3 a4 --long a5 a6'
     >>> args = s.split()
     >>> args
     ['a1', '-x', 'a2', 'a3', 'a4', '--long', 'a5', 'a6']
     >>> optlist, args = getopt.gnu_getopt(args, '-x:', ['long='])
     >>> optlist
     [(None, ['a1']), ('-x', 'a2'), (None, ['a3', 'a4']), ('--long', 'a5')]
     >>> args
     ['a6']

In a script, typical usage is something like this:

     import getopt, sys

     def main():
         try:
             opts, args = getopt.getopt(sys.argv[1:], "ho:v", ["help", "output="])
         except getopt.GetoptError as err:
             # print help information and exit:
             print(err)  # will print something like "option -a not recognized"
             usage()
             sys.exit(2)
         output = None
         verbose = False
         for o, a in opts:
             if o == "-v":
                 verbose = True
             elif o in ("-h", "--help"):
                 usage()
                 sys.exit()
             elif o in ("-o", "--output"):
                 output = a
             else:
                 assert False, "unhandled option"
         process(args, output=output, verbose=verbose)

     if __name__ == "__main__":
         main()

Note that an equivalent command line interface could be produced with
less code and more informative help and error messages by using the
*note optparse: a4. module:

     import optparse

     if __name__ == '__main__':
         parser = optparse.OptionParser()
         parser.add_option('-o', '--output')
         parser.add_option('-v', dest='verbose', action='store_true')
         opts, args = parser.parse_args()
         process(args, output=opts.output, verbose=opts.verbose)

A roughly equivalent command line interface for this case can also be
produced by using the *note argparse: 7. module:

     import argparse

     if __name__ == '__main__':
         parser = argparse.ArgumentParser()
         parser.add_argument('-o', '--output')
         parser.add_argument('-v', dest='verbose', action='store_true')
         parser.add_argument('rest', nargs='*')
         args = parser.parse_args()
         process(args.rest, output=args.output, verbose=args.verbose)

See *note Choosing an argument parsing library: 336b. for details on how
the ‘argparse’ version of this code differs in behaviour from the
‘optparse’ (and ‘getopt’) version.

参考
....

Module *note optparse: a4.

     Declarative command line option parsing.

*note argparse: 7. モジュール

     More opinionated command line option and argument parsing library.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Lib/getopt.py


File: python.info,  Node: 削除されたモジュール,  Next: セキュリティで考慮すべき点<6>,  Prev: 取って代わられたモジュール群,  Up: Python 標準ライブラリ

5.37 削除されたモジュール
=========================

この章で説明されているモジュールは Python 標準ライブラリから削除されまし
た。代替を探す手助けとなるよう、ここに記載されています。

* Menu:

* aifc: aifc --- Read and write AIFF and AIFC files. Read and write AIFF and AIFC files
* asynchat: asynchat --- Asynchronous socket command/response handler. Asynchronous socket command/response handler
* asyncore: asyncore --- Asynchronous socket handler. Asynchronous socket handler
* audioop: audioop --- Manipulate raw audio data. Manipulate raw audio data
* cgi: cgi --- Common Gateway Interface のサポート. Common Gateway Interface のサポート
* cgitb: cgitb --- Traceback manager for CGI scripts. Traceback manager for CGI scripts
* chunk: chunk --- Read IFF chunked data. Read IFF chunked data
* crypt: crypt --- Function to check Unix passwords. Function to check Unix passwords
* distutils: distutils --- Building and installing Python modules. Building and installing Python modules
* imghdr: imghdr --- Determine the type of an image. Determine the type of an image
* imp: imp --- Access the import internals. Access the import internals
* mailcap: mailcap --- Mailcap file handling. Mailcap file handling
* msilib: msilib --- Read and write Microsoft Installer files. Read and write Microsoft Installer files
* nis: nis --- Interface to Sun’s NIS Yellow Pages. Interface to Sun’s NIS (Yellow Pages)
* nntplib: nntplib --- NNTP protocol client. NNTP protocol client
* ossaudiodev: ossaudiodev --- Access to OSS-compatible audio devices. Access to OSS-compatible audio devices
* pipes: pipes --- Interface to shell pipelines. Interface to shell pipelines
* smtpd: smtpd --- SMTP Server. SMTP Server
* sndhdr: sndhdr --- Determine type of sound file. Determine type of sound file
* spwd: spwd --- The shadow password database. The shadow password database
* sunau: sunau --- Read and write Sun AU files. Read and write Sun AU files
* telnetlib: telnetlib --- Telnet client. Telnet client
* uu: uu --- Encode and decode uuencode files. Encode and decode uuencode files
* xdrlib: xdrlib --- Encode and decode XDR data. Encode and decode XDR data


File: python.info,  Node: aifc --- Read and write AIFF and AIFC files,  Next: asynchat --- Asynchronous socket command/response handler,  Up: 削除されたモジュール

5.37.1 ‘aifc’ -- Read and write AIFF and AIFC files
---------------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

The last version of Python that provided the ‘aifc’ module was Python
3.12(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://docs.python.org/3.12/library/aifc.html


File: python.info,  Node: asynchat --- Asynchronous socket command/response handler,  Next: asyncore --- Asynchronous socket handler,  Prev: aifc --- Read and write AIFF and AIFC files,  Up: 削除されたモジュール

5.37.2 ‘asynchat’ -- Asynchronous socket command/response handler
-----------------------------------------------------------------

Deprecated since version 3.6, removed in version 3.12.

This module is no longer part of the Python standard library.  It was
*note removed in Python 3.12: 726. after being deprecated in Python 3.6.
The removal was decided in PEP 594(1).

Applications should use the *note asyncio: b. module instead.

The last version of Python that provided the ‘asynchat’ module was
Python 3.11(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://docs.python.org/3.11/library/asynchat.html


File: python.info,  Node: asyncore --- Asynchronous socket handler,  Next: audioop --- Manipulate raw audio data,  Prev: asynchat --- Asynchronous socket command/response handler,  Up: 削除されたモジュール

5.37.3 ‘asyncore’ -- Asynchronous socket handler
------------------------------------------------

Deprecated since version 3.6, removed in version 3.12.

This module is no longer part of the Python standard library.  It was
*note removed in Python 3.12: 726. after being deprecated in Python 3.6.
The removal was decided in PEP 594(1).

Applications should use the *note asyncio: b. module instead.

The last version of Python that provided the ‘asyncore’ module was
Python 3.11(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://docs.python.org/3.11/library/asyncore.html


File: python.info,  Node: audioop --- Manipulate raw audio data,  Next: cgi --- Common Gateway Interface のサポート,  Prev: asyncore --- Asynchronous socket handler,  Up: 削除されたモジュール

5.37.4 ‘audioop’ -- Manipulate raw audio data
---------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

The last version of Python that provided the ‘audioop’ module was Python
3.12(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://docs.python.org/3.12/library/audioop.html


File: python.info,  Node: cgi --- Common Gateway Interface のサポート,  Next: cgitb --- Traceback manager for CGI scripts,  Prev: audioop --- Manipulate raw audio data,  Up: 削除されたモジュール

5.37.5 ‘cgi’ -- Common Gateway Interface のサポート
---------------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、 *note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

代替として、PyPI 上にあるこのモジュールのフォーク legacy-cgi(2) を利用で
きます。これは cgi モジュールのコピーであり、もはやコア Python チームに
よってメンテナンスもサポートもされていません。

‘cgi’ モジュールを提供していた最後の Python バージョンは Python 3.12(3)
です。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://pypi.org/project/legacy-cgi/

   (3) https://docs.python.org/3.12/library/cgi.html


File: python.info,  Node: cgitb --- Traceback manager for CGI scripts,  Next: chunk --- Read IFF chunked data,  Prev: cgi --- Common Gateway Interface のサポート,  Up: 削除されたモジュール

5.37.6 ‘cgitb’ -- Traceback manager for CGI scripts
---------------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

A fork of the module on PyPI can now be used instead: legacy-cgi(2).
This is a copy of the cgi module, no longer maintained or supported by
the core Python team.

The last version of Python that provided the ‘cgitb’ module was Python
3.12(3).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://pypi.org/project/legacy-cgi/

   (3) https://docs.python.org/3.12/library/cgitb.html


File: python.info,  Node: chunk --- Read IFF chunked data,  Next: crypt --- Function to check Unix passwords,  Prev: cgitb --- Traceback manager for CGI scripts,  Up: 削除されたモジュール

5.37.7 ‘chunk’ -- Read IFF chunked data
---------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

The last version of Python that provided the ‘chunk’ module was Python
3.12(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://docs.python.org/3.12/library/chunk.html


File: python.info,  Node: crypt --- Function to check Unix passwords,  Next: distutils --- Building and installing Python modules,  Prev: chunk --- Read IFF chunked data,  Up: 削除されたモジュール

5.37.8 ‘crypt’ -- Function to check Unix passwords
--------------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

Applications can use the *note hashlib: 6c. module from the standard
library.  Other possible replacements are third-party libraries from
PyPI: legacycrypt(2), bcrypt(3), or argon2-cffi(4).  These are not
supported or maintained by the Python core team.

The last version of Python that provided the ‘crypt’ module was Python
3.12(5).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://pypi.org/project/legacycrypt/

   (3) https://pypi.org/project/bcrypt/

   (4) https://pypi.org/project/argon2-cffi/

   (5) https://docs.python.org/3.12/library/crypt.html


File: python.info,  Node: distutils --- Building and installing Python modules,  Next: imghdr --- Determine the type of an image,  Prev: crypt --- Function to check Unix passwords,  Up: 削除されたモジュール

5.37.9 ‘distutils’ -- Building and installing Python modules
------------------------------------------------------------

Deprecated since version 3.10, removed in version 3.12.

This module is no longer part of the Python standard library.  It was
*note removed in Python 3.12: 72c. after being deprecated in Python
3.10.  The removal was decided in PEP 632(1), which has migration
advice(2).

The last version of Python that provided the ‘distutils’ module was
Python 3.11(3).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0632/

   (2) https://peps.python.org/pep-0632/#migration-advice

   (3) https://docs.python.org/3.11/library/distutils.html


File: python.info,  Node: imghdr --- Determine the type of an image,  Next: imp --- Access the import internals,  Prev: distutils --- Building and installing Python modules,  Up: 削除されたモジュール

5.37.10 ‘imghdr’ -- Determine the type of an image
--------------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

Possible replacements are third-party libraries from PyPI: filetype(2),
puremagic(3), or python-magic(4).  These are not supported or maintained
by the Python core team.

The last version of Python that provided the ‘imghdr’ module was Python
3.12(5).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://pypi.org/project/filetype/

   (3) https://pypi.org/project/puremagic/

   (4) https://pypi.org/project/python-magic/

   (5) https://docs.python.org/3.12/library/imghdr.html


File: python.info,  Node: imp --- Access the import internals,  Next: mailcap --- Mailcap file handling,  Prev: imghdr --- Determine the type of an image,  Up: 削除されたモジュール

5.37.11 ‘imp’ -- Access the import internals
--------------------------------------------

Deprecated since version 3.4, removed in version 3.12.

This module is no longer part of the Python standard library.  It was
*note removed in Python 3.12: 736. after being deprecated in Python 3.4.

The *note removal notice: 736. includes guidance for migrating code from
‘imp’ to *note importlib: 7b.

The last version of Python that provided the ‘imp’ module was Python
3.11(1).

   ---------- Footnotes ----------

   (1) https://docs.python.org/3.11/library/imp.html


File: python.info,  Node: mailcap --- Mailcap file handling,  Next: msilib --- Read and write Microsoft Installer files,  Prev: imp --- Access the import internals,  Up: 削除されたモジュール

5.37.12 ‘mailcap’ -- Mailcap file handling
------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

The last version of Python that provided the ‘mailcap’ module was Python
3.12(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://docs.python.org/3.12/library/mailcap.html


File: python.info,  Node: msilib --- Read and write Microsoft Installer files,  Next: nis --- Interface to Sun’s NIS Yellow Pages,  Prev: mailcap --- Mailcap file handling,  Up: 削除されたモジュール

5.37.13 ‘msilib’ -- Read and write Microsoft Installer files
------------------------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

The last version of Python that provided the ‘msilib’ module was Python
3.12(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://docs.python.org/3.12/library/msilib.html


File: python.info,  Node: nis --- Interface to Sun’s NIS Yellow Pages,  Next: nntplib --- NNTP protocol client,  Prev: msilib --- Read and write Microsoft Installer files,  Up: 削除されたモジュール

5.37.14 ‘nis’ -- Interface to Sun’s NIS (Yellow Pages)
------------------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

The last version of Python that provided the ‘nis’ module was Python
3.12(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://docs.python.org/3.12/library/nis.html


File: python.info,  Node: nntplib --- NNTP protocol client,  Next: ossaudiodev --- Access to OSS-compatible audio devices,  Prev: nis --- Interface to Sun’s NIS Yellow Pages,  Up: 削除されたモジュール

5.37.15 ‘nntplib’ -- NNTP protocol client
-----------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

The last version of Python that provided the ‘nntplib’ module was Python
3.12(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://docs.python.org/3.12/library/nntplib.html


File: python.info,  Node: ossaudiodev --- Access to OSS-compatible audio devices,  Next: pipes --- Interface to shell pipelines,  Prev: nntplib --- NNTP protocol client,  Up: 削除されたモジュール

5.37.16 ‘ossaudiodev’ -- Access to OSS-compatible audio devices
---------------------------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

The last version of Python that provided the ‘ossaudiodev’ module was
Python 3.12(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://docs.python.org/3.12/library/ossaudiodev.html


File: python.info,  Node: pipes --- Interface to shell pipelines,  Next: smtpd --- SMTP Server,  Prev: ossaudiodev --- Access to OSS-compatible audio devices,  Up: 削除されたモジュール

5.37.17 ‘pipes’ -- Interface to shell pipelines
-----------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

Applications should use the *note subprocess: dc. module instead.

The last version of Python that provided the ‘pipes’ module was Python
3.12(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://docs.python.org/3.12/library/pipes.html


File: python.info,  Node: smtpd --- SMTP Server,  Next: sndhdr --- Determine type of sound file,  Prev: pipes --- Interface to shell pipelines,  Up: 削除されたモジュール

5.37.18 ‘smtpd’ -- SMTP Server
------------------------------

Deprecated since version 3.6, removed in version 3.12.

This module is no longer part of the Python standard library.  It was
*note removed in Python 3.12: 726. after being deprecated in Python 3.6.
The removal was decided in PEP 594(1).

A possible replacement is the third-party aiosmtpd(2) library.  This
library is not maintained or supported by the Python core team.

The last version of Python that provided the ‘smtpd’ module was Python
3.11(3).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://pypi.org/project/aiosmtpd/

   (3) https://docs.python.org/3.11/library/smtpd.html


File: python.info,  Node: sndhdr --- Determine type of sound file,  Next: spwd --- The shadow password database,  Prev: smtpd --- SMTP Server,  Up: 削除されたモジュール

5.37.19 ‘sndhdr’ -- Determine type of sound file
------------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

Possible replacements are third-party modules from PyPI: filetype(2),
puremagic(3), or python-magic(4).  These are not supported or maintained
by the Python core team.

The last version of Python that provided the ‘sndhdr’ module was Python
3.12(5).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://pypi.org/project/filetype/

   (3) https://pypi.org/project/puremagic/

   (4) https://pypi.org/project/python-magic/

   (5) https://docs.python.org/3.12/library/sndhdr.html


File: python.info,  Node: spwd --- The shadow password database,  Next: sunau --- Read and write Sun AU files,  Prev: sndhdr --- Determine type of sound file,  Up: 削除されたモジュール

5.37.20 ‘spwd’ -- The shadow password database
----------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

A possible replacement is the third-party library python-pam(2).  This
library is not supported or maintained by the Python core team.

The last version of Python that provided the ‘spwd’ module was Python
3.12(3).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://pypi.org/project/python-pam/

   (3) https://docs.python.org/3.12/library/spwd.html


File: python.info,  Node: sunau --- Read and write Sun AU files,  Next: telnetlib --- Telnet client,  Prev: spwd --- The shadow password database,  Up: 削除されたモジュール

5.37.21 ‘sunau’ -- Read and write Sun AU files
----------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

The last version of Python that provided the ‘sunau’ module was Python
3.12(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://docs.python.org/3.12/library/sunau.html


File: python.info,  Node: telnetlib --- Telnet client,  Next: uu --- Encode and decode uuencode files,  Prev: sunau --- Read and write Sun AU files,  Up: 削除されたモジュール

5.37.22 ‘telnetlib’ -- Telnet client
------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

Possible replacements are third-party libraries from PyPI: telnetlib3(2)
or Exscript(3).  These are not supported or maintained by the Python
core team.

The last version of Python that provided the ‘telnetlib’ module was
Python 3.12(4).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://pypi.org/project/telnetlib3/

   (3) https://pypi.org/project/Exscript/

   (4) https://docs.python.org/3.12/library/telnetlib.html


File: python.info,  Node: uu --- Encode and decode uuencode files,  Next: xdrlib --- Encode and decode XDR data,  Prev: telnetlib --- Telnet client,  Up: 削除されたモジュール

5.37.23 ‘uu’ -- Encode and decode uuencode files
------------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

The last version of Python that provided the ‘uu’ module was Python
3.12(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://docs.python.org/3.12/library/uu.html


File: python.info,  Node: xdrlib --- Encode and decode XDR data,  Prev: uu --- Encode and decode uuencode files,  Up: 削除されたモジュール

5.37.24 ‘xdrlib’ -- Encode and decode XDR data
----------------------------------------------

Deprecated since version 3.11, removed in version 3.13.

このモジュールは今や Python 標準ライブラリの一部ではありません。このモジ
ュールは Python 3.11 で非推奨となったあと、*note Python 3.13 で削除:
471. されました。削除の決定は PEP 594(1) でなされました。

The last version of Python that provided the ‘xdrlib’ module was Python
3.12(2).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0594/

   (2) https://docs.python.org/3.12/library/xdrlib.html


File: python.info,  Node: セキュリティで考慮すべき点<6>,  Prev: 削除されたモジュール,  Up: Python 標準ライブラリ

5.38 セキュリティで考慮すべき点
===============================

The following modules have specific security considerations:

   * *note base64: f.: *note base64 security considerations: 3cb5. in
     RFC 4648(1)

   * *note hashlib: 6c.: *note all constructors take a "usedforsecurity"
     keyword-only argument disabling known insecure and blocked
     algorithms: 2fc8.

   * *note http.server: 76. is not suitable for production use, only
     implementing basic security checks.  See the *note security
     considerations: 40e8.

   * *note logging: 8b.: *note Logging configuration uses eval(): 31ac.

   * *note multiprocessing: 98.: *note Connection.recv() uses pickle:
     3686.

   * *note pickle: ab.: *note Restricting globals in pickle: 2d1a.

   * *note random: bd. shouldn't be used for security purposes, use
     *note secrets: c5. instead

   * *note shelve: c8.: *note shelve is based on pickle and thus
     unsuitable for dealing with untrusted sources: 2d3c.

   * *note ssl: d5.: *note SSL/TLS security considerations: 3895.

   * *note subprocess: dc.: *note Subprocess security considerations:
     3756.

   * *note tempfile: e6.: *note mktemp is deprecated due to
     vulnerability to race conditions: 2cd4.

   * *note xml: 126.: *note XML security: 3ce9.

   * *note zipfile: 137.: *note maliciously prepared .zip files can
     cause disk volume exhaustion: 2ed8.

The *note -I: b57. command line option can be used to run Python in
isolated mode.  When it cannot be used, the *note -P: 7c1. option or the
*note PYTHONSAFEPATH: 7c2. environment variable can be used to not
prepend a potentially unsafe path to *note sys.path: 3e4. such as the
current directory, the script's directory or an empty string.

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc4648.html


File: python.info,  Node: Python インタプリタの拡張と埋め込み,  Next: Python/C API リファレンスマニュアル,  Prev: Python 標準ライブラリ,  Up: Top

6 Python インタプリタの拡張と埋め込み
*************************************

このドキュメントでは、Pythonインタプリンタを拡張する新しいモジュールをで
C またはC++ で書く方法を解説しています。このようなモジュールでは新しい関
数を定義するだけではなく、新しい型や、そのメソッドを定義することができま
す。ドキュメントでは他のアプリケーションでPythonを拡張言語として使用する
ために、Pythonインタプリタをアプリケーションに埋め込む方法についても解説
します。最後に、下層のオペレーティングシステムが動的(実行時)ロードをサポ
ートしていれば、拡張モジュールが動的にライブラリにロードされるように、モ
ジュールをコンパイルしリンクする方法について解説します。

このドキュメントでは、読者は Python について基礎的な知識を持ち合わせてい
るものと仮定しています。形式ばらない Python 言語の入門には、 *note
Python チュートリアル: 1fbc. を読んでください。 *note Python
言語リファレンス: 14a. を読めば、 Python 言語についてより形式的な定義を
得られます。また、 *note Python 標準ライブラリ: 149. では、Python に広い
適用範囲をもたらしている既存のオブジェクト型、関数、および (組み込み、お
よび Python で書かれたものの両方の) モジュールについて解説しています。

Python/C API 全体の詳しい説明は、別のドキュメントである、 *note Python/C
API リファレンスマニュアル: 1fbe. を参照してください。

* Menu:

* おすすめのサードパーティツール::
* サードパーティツールなしで拡張を作る::
* 大規模なアプリケーションへの Python ランタイムの埋め込み::


File: python.info,  Node: おすすめのサードパーティツール,  Next: サードパーティツールなしで拡張を作る,  Up: Python インタプリタの拡張と埋め込み

6.1 おすすめのサードパーティツール
==================================

このガイドは、このバージョンの CPython の一部として提供されている拡張作
成用の基礎的なツールのみをカバーしています。 Python 用の C と C++ 拡張を
作成するより単純で高度なアプローチを提供する *note
サードパーティのツール: 4e8e. もあります。


File: python.info,  Node: サードパーティツールなしで拡張を作る,  Next: 大規模なアプリケーションへの Python ランタイムの埋め込み,  Prev: おすすめのサードパーティツール,  Up: Python インタプリタの拡張と埋め込み

6.2 サードパーティツールなしで拡張を作る
========================================

ガイドのこの節ではサードパーティツールの補助無しに C および C++ 拡張を作
成する方法を説明します。 これは自分自身の C 拡張を作成するおすすめの方法
というよりも、主にそれらのツールを作成する人向けのものです。

参考
....

PEP 489(1) - 拡張モジュールの多段階初期化

* Menu:

* C や C++ による Python の拡張::
* 拡張の型の定義; チュートリアル: 拡張の型の定義 チュートリアル.
* 拡張の型の定義; 雑多なトピック: 拡張の型の定義 雑多なトピック.
* C および C++ 拡張のビルド::
* Windows 上での C および C++ 拡張モジュールのビルド::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0489/


File: python.info,  Node: C や C++ による Python の拡張,  Next: 拡張の型の定義 チュートリアル,  Up: サードパーティツールなしで拡張を作る

6.2.1 C や C++ による Python の拡張
-----------------------------------

C プログラムの書き方を知っているなら、Python に新たな組み込みモジュール
を追加するのはきわめて簡単です。この新たなモジュール、拡張モジュール
('extension module') を使うと、Python が直接行えない二つのこと: 新しい組
み込みオブジェクトの実装、そして全ての C ライブラリ関数とシステムコール
に対する呼び出し、ができるようになります。

拡張モジュールをサポートするため、Python API (Application Programmer's
Interface) では一連の関数、マクロおよび変数を提供していて、Python ランタ
イムシステムのほとんどの側面へのアクセス手段を提供しています。 Python
API は、ヘッダ ‘"Python.h"’ をインクルードして C ソースに取り込みます。

拡張モジュールのコンパイル方法は、モジュールの用途やシステムの設定方法に
依存します。詳細は後の章で説明します。

     注釈: C 拡張のインターフェイスは CPython に固有のものであり、これに
     よる拡張モジュールはほかの Python 実装では動作しません。多くの場合
     、C 拡張を書くことを避けてほかの Python 実装のために移植性を確保す
     ることは可能です。たとえば、あなたがしたいことが C ライブラリの関数
     やシステムコールを呼び出すことである場合、 *note ctypes: 2e. あるい
     は cffi(1) ライブラリの利用を検討すべきです。これらのモジュールは C
     コードとインターフェイスし、C 拡張を書いてコンパイルするのに較べて
     Python 実装間のより高い移植性をもった Python コードを書かせてくれま
     す。

* Menu:

* 簡単な例::
* 幕間小話; エラーと例外: 幕間小話 エラーと例外.
* 例に戻る::
* モジュールのメソッドテーブルと初期化関数::
* コンパイルとリンク::
* C から Python 関数を呼び出す::
* 拡張モジュール関数でのパラメタ展開::
* 拡張モジュール関数のキーワードパラメタ::
* 任意の値を構築する::
* 参照カウント法::
* C++での拡張モジュール作成::
* 拡張モジュールに C API を提供する::

   ---------- Footnotes ----------

   (1) https://cffi.readthedocs.io/


File: python.info,  Node: 簡単な例,  Next: 幕間小話 エラーと例外,  Up: C や C++ による Python の拡張

6.2.1.1 簡単な例
................

‘spam’ (Monty Python ファンの好物ですね) という名の拡張モジュールを作成
することにして、C ライブラリ関数 ‘system()’ に対する Python インターフェ
イスを作成したいとします。 (1) この関数は null で終端されたキャラクタ文
字列を引数にとり、整数を返します。この関数を以下のようにして Python から
呼び出せるようにしたいとします。

     >>> import spam
     >>> status = spam.system("ls -l")

まずは ‘spammodule.c’ を作成するところから始めます。 (伝統として、
‘spam’ という名前のモジュールを作成する場合、モジュールの実装が入った C
ファイルを ‘spammodule.c’ と呼ぶことになっています; ‘spammify’ のように
長すぎるモジュール名の場合には、単に ‘spammify.c’ にもできます。)

このファイルの最初の 2 行は以下のようにします:

     #define PY_SSIZE_T_CLEAN
     #include <Python.h>

これで、Python API を取り込みます (必要なら、モジュールの用途に関する説
明や、著作権表示を追加します)。

     注釈: Python は、システムによっては標準ヘッダの定義に影響するような
     プリプロセッサ定義を行っているので、 ‘Python.h’ をいずれの標準ヘッ
     ダよりも前にインクルード 'せねばなりません' 。

     ‘#define PY_SSIZE_T_CLEAN’ は、いくつかの API では ‘int’ の代わりに
     ‘Py_ssize_t’ が使われるべきであることを示すために使われていました。
     これは Python 3.13 以降では不要となりましたが、後方互換性のために維
     持されています。このマクロの説明は *note 文字列とバッファ: 62c. に
     あります。

All user-visible symbols defined by ‘Python.h’ have a prefix of ‘Py’ or
‘PY’, except those defined in standard header files.

     Tip: For backward compatibility, ‘Python.h’ includes several
     standard header files.  C extensions should include the standard
     headers that they use, and should not rely on these implicit
     includes.  If using the limited C API version 3.13 or newer, the
     implicit includes are:

        * ‘<assert.h>’

        * ‘<intrin.h>’ (on Windows)

        * ‘<inttypes.h>’

        * ‘<limits.h>’

        * ‘<math.h>’

        * ‘<stdarg.h>’

        * ‘<wchar.h>’

        * ‘<sys/types.h>’ (if present)

     If *note Py_LIMITED_API: 660. is not defined, or is set to version
     3.12 or older, the headers below are also included:

        * ‘<ctype.h>’

        * ‘<unistd.h>’ (on POSIX)

     If *note Py_LIMITED_API: 660. is not defined, or is set to version
     3.10 or older, the headers below are also included:

        * ‘<errno.h>’

        * ‘<stdio.h>’

        * ‘<stdlib.h>’

        * ‘<string.h>’

次にファイルに追加する内容は、Python 式 ‘spam.system(string)’ を評価する
際に呼び出されることになる C 関数です (この関数を最終的にどのように呼び
出すかは、後ですぐわかります):

     static PyObject *
     spam_system(PyObject *self, PyObject *args)
     {
         const char *command;
         int sts;

         if (!PyArg_ParseTuple(args, "s", &command))
             return NULL;
         sts = system(command);
         return PyLong_FromLong(sts);
     }

ここでは、Python の引数リスト (例えば、単一の式 ‘"ls -l"’) から C 関数に
渡す引数にそのまま変換しています。 C 関数は常に二つの引数を持ち、便宜的
に 'self' および 'args' と呼ばれます。

'self' 引数には、モジュールレベルの関数であればモジュールが、メソッドに
はオブジェクトインスタンスが渡されます。

'args' 引数は、引数の入った Python タプルオブジェクトへのポインタになり
ます。タプル内の各要素は、呼び出しの際の引数リストにおける各引数に対応し
ます。引数は Python オブジェクトです -- C 関数で引数を使って何かを行うに
は、オブジェクトから C の値に変換せねばなりません。Python API の関数
*note PyArg_ParseTuple(): 3c1. は引数の型をチェックし、C の値に変換しま
す。 *note PyArg_ParseTuple(): 3c1. はテンプレート文字列を使って、引数オ
ブジェクトの型と、変換された値を入れる C 変数の型を判別します。これにつ
いては後で詳しく説明します。

*note PyArg_ParseTuple(): 3c1. は、全ての引数が正しい型を持っていて、ア
ドレス渡しされた各変数に各引数要素を保存したときに真 (非ゼロ) を返します
。この関数は不正な引数リストを渡すと偽 (ゼロ) を返します。後者の場合、関
数は適切な例外を送出するので、呼び出し側は (例にもあるように) すぐに
‘NULL’ を返すようにしてください。

   ---------- Footnotes ----------

   (1) この関数へのインターフェースはすでに標準モジュール *note os: a5.
にあります -- この関数を選んだのは、単純で直接的な例を示したいからです。


File: python.info,  Node: 幕間小話 エラーと例外,  Next: 例に戻る,  Prev: 簡単な例,  Up: C や C++ による Python の拡張

6.2.1.2 幕間小話: エラーと例外
..............................

An important convention throughout the Python interpreter is the
following: when a function fails, it should set an exception condition
and return an error value (usually ‘-1’ or a ‘NULL’ pointer).  Exception
information is stored in three members of the interpreter's thread
state.  These are ‘NULL’ if there is no exception.  Otherwise they are
the C equivalents of the members of the Python tuple returned by *note
sys.exc_info(): 89a.  These are the exception type, exception instance,
and a traceback object.  It is important to know about them to
understand how errors are passed around.

Python API では、様々な型の例外をセットするための関数をいくつか定義して
います。

もっともよく用いられるのは *note PyErr_SetString(): 79c. です。引数は例
外オブジェクトと C 文字列です。例外オブジェクトは通常、 *note
PyExc_ZeroDivisionError: 4e97. のような定義済みのオブジェクトです。 C 文
字列はエラーの原因を示し、Python 文字列オブジェクトに変換されて例外の "付
属値" に保存されます。

もう一つ有用な関数として *note PyErr_SetFromErrno(): 4e98. があります。
この関数は引数に例外だけをとり、付属値はグローバル変数 ‘errno’ から構築
します。もっとも汎用的な関数は *note PyErr_SetObject(): 79b. で、二つの
オブジェクト、例外と付属値を引数にとります。これら関数に渡すオブジェクト
には *note Py_INCREF(): 78f. を使う必要はありません。

例外がセットされているかどうかは、 *note PyErr_Occurred(): 1caf. を使っ
て非破壊的に調べられます。この関数は現在の例外オブジェクトを返します。例
外が発生していない場合には ‘NULL’ を返します。通常は、関数の戻り値からエ
ラーが発生したかを判別できるはずなので、 *note PyErr_Occurred(): 1caf. を
呼び出す必要はありません。

関数 'g' を呼び出す 'f' が、前者の関数の呼び出しに失敗したことを検出する
と、 'f' 自体はエラー値 (大抵は ‘NULL’ や ‘-1’) を返さねばなりません。し
かし、 ‘PyErr_*’ 関数群のいずれかを呼び出す必要は 'ありません' -- なぜな
ら、 'g' がすでに呼び出しているからです。次いで 'f' を呼び出したコードも
エラーを示す値を '自らを呼び出したコード' に返すことになりますが、同様に
‘PyErr_*’ は '呼び出しません' 。以下同様に続きます -- エラーの最も詳しい
原因は、最初にエラーを検出した関数がすでに報告しているからです。エラーが
Python インタプリタのメインループに到達すると、現在実行中の Python コー
ドは一時停止し、 Python プログラマが指定した例外ハンドラを探し出そうとし
ます。

(モジュールが ‘PyErr_*’ 関数をもう一度呼び出して、より詳細なエラーメッセ
ージを提供するような状況があります。このような状況ではそうすべきです。と
はいえ、一般的な規則としては、この関数を何度も呼び出す必要はなく、ともす
ればエラーの原因に関する情報を失う結果になりがちです: これにより、ほとん
どの操作が様々な理由から失敗するかもしれません)

ある関数呼び出しでの処理の失敗によってセットされた例外を無視するには、
*note PyErr_Clear(): 1232. を呼び出して例外状態を明示的に消去しなくては
なりません。エラーをインタプリタには渡したくなく、自前で (何か他の作業を
行ったり、何も起こらなかったかのように見せかけるような) エラー処理を完全
に行う場合にのみ、 *note PyErr_Clear(): 1232. を呼び出すようにすべきです
。

‘malloc()’ の呼び出し失敗は、常に例外にしなくてはなりません --
‘malloc()’ (または ‘realloc()’) を直接呼び出しているコードは、 *note
PyErr_NoMemory(): 4e99. を呼び出して、失敗を示す値を返さねばなりません。
オブジェクトを生成する全ての関数 (例えば *note PyLong_FromLong(): 1bd0.)
は *note PyErr_NoMemory(): 4e99. の呼び出しを済ませてしまうので、この規
則が関係するのは直接 ‘malloc()’ を呼び出すコードだけです。

また、 *note PyArg_ParseTuple(): 3c1. という重要な例外を除いて、整数の状
態コードを返す関数はたいてい、Unix のシステムコールと同じく、処理が成功
した際にはゼロまたは正の値を返し、失敗した場合には ‘-1’ を返します。

最後に、エラー標示値を返す際に、(エラーが発生するまでに既に生成してしま
ったオブジェクトに対して *note Py_XDECREF(): 992. や *note Py_DECREF():
790. を呼び出して) ごみ処理を注意深く行ってください!

The choice of which exception to raise is entirely yours.  There are
predeclared C objects corresponding to all built-in Python exceptions,
such as *note PyExc_ZeroDivisionError: 4e97, which you can use directly.
Of course, you should choose exceptions wisely -- don't use *note
PyExc_TypeError: 4e9a. to mean that a file couldn't be opened (that
should probably be *note PyExc_OSError: 4e9b.).  If something's wrong
with the argument list, the *note PyArg_ParseTuple(): 3c1. function
usually raises *note PyExc_TypeError: 4e9a.  If you have an argument
whose value must be in a particular range or must satisfy other
conditions, *note PyExc_ValueError: 4e9c. is appropriate.

You can also define a new exception that is unique to your module.  The
simplest way to do this is to declare a static global object variable at
the beginning of the file:

     static PyObject *SpamError = NULL;

and initialize it by calling *note PyErr_NewException(): 1481. in the
module's *note Py_mod_exec: b75. function (‘spam_module_exec()’):

     SpamError = PyErr_NewException("spam.error", NULL, NULL);

Since ‘SpamError’ is a global variable, it will be overwritten every
time the module is reinitialized, when the *note Py_mod_exec: b75.
function is called.

For now, let's avoid the issue: we will block repeated initialization by
raising an *note ImportError: 65b.:

     static PyObject *SpamError = NULL;

     static int
     spam_module_exec(PyObject *m)
     {
         if (SpamError != NULL) {
             PyErr_SetString(PyExc_ImportError,
                             "cannot initialize spam module more than once");
             return -1;
         }
         SpamError = PyErr_NewException("spam.error", NULL, NULL);
         if (PyModule_AddObjectRef(m, "SpamError", SpamError) < 0) {
             return -1;
         }

         return 0;
     }

     static PyModuleDef_Slot spam_module_slots[] = {
         {Py_mod_exec, spam_module_exec},
         {0, NULL}
     };

     static struct PyModuleDef spam_module = {
         .m_base = PyModuleDef_HEAD_INIT,
         .m_name = "spam",
         .m_size = 0,  // non-negative
         .m_slots = spam_module_slots,
     };

     PyMODINIT_FUNC
     PyInit_spam(void)
     {
         return PyModuleDef_Init(&spam_module);
     }

Note that the Python name for the exception object is ‘spam.error’.  The
*note PyErr_NewException(): 1481. function may create a class with the
base class being *note Exception: bcd. (unless another class is passed
in instead of ‘NULL’), described in *note 組み込み例外: 1c27.

Note also that the ‘SpamError’ variable retains a reference to the newly
created exception class; this is intentional!  Since the exception could
be removed from the module by external code, an owned reference to the
class is needed to ensure that it will not be discarded, causing
‘SpamError’ to become a dangling pointer.  Should it become a dangling
pointer, C code which raises the exception could cause a core dump or
other unintended side effects.

For now, the *note Py_DECREF(): 790. call to remove this reference is
missing.  Even when the Python interpreter shuts down, the global
‘SpamError’ variable will not be garbage-collected.  It will "leak".  We
did, however, ensure that this will happen at most once per process.

We discuss the use of *note PyMODINIT_FUNC: 16ec. as a function return
type later in this sample.

The ‘spam.error’ exception can be raised in your extension module using
a call to *note PyErr_SetString(): 79c. as shown below:

     static PyObject *
     spam_system(PyObject *self, PyObject *args)
     {
         const char *command;
         int sts;

         if (!PyArg_ParseTuple(args, "s", &command))
             return NULL;
         sts = system(command);
         if (sts < 0) {
             PyErr_SetString(SpamError, "System command failed");
             return NULL;
         }
         return PyLong_FromLong(sts);
     }


File: python.info,  Node: 例に戻る,  Next: モジュールのメソッドテーブルと初期化関数,  Prev: 幕間小話 エラーと例外,  Up: C や C++ による Python の拡張

6.2.1.3 例に戻る
................

先ほどの関数の例に戻ると、今度は以下の実行文を理解できるはずです:

     if (!PyArg_ParseTuple(args, "s", &command))
         return NULL;

It returns ‘NULL’ (the error indicator for functions returning object
pointers) if an error is detected in the argument list, relying on the
exception set by *note PyArg_ParseTuple(): 3c1.  Otherwise the string
value of the argument has been copied to the local variable ‘command’.
This is a pointer assignment and you are not supposed to modify the
string to which it points (so in Standard C, the variable ‘command’
should properly be declared as ‘const char *command’).

次の文では、 *note PyArg_ParseTuple(): 3c1. で得た文字列を渡して Unix 関
数 ‘system()’ を呼び出しています:

     sts = system(command);

Our ‘spam.system()’ function must return the value of ‘sts’ as a Python
object.  This is done using the function *note PyLong_FromLong(): 1bd0.

     return PyLong_FromLong(sts);

上の場合では、整数オブジェクトを返します。(そう、整数ですら、 Python に
おいてはヒープ上のオブジェクトなのです!  )

何ら有用な値を返さない関数 (void を返す関数) に対応する Python の関数は
‘None’ を返さねばなりません。関数に ‘None’ を返させるには、以下のような
慣用句を使います (この慣用句は *note Py_RETURN_NONE: 168c. マクロに実装
されています):

     Py_INCREF(Py_None);
     return Py_None;

*note Py_None: 4e9f. は特殊な Pyhton オブジェクトである ‘None’ に対応す
る C での名前です。これまで見てきたようにほとんどのコンテキストで "エラ
ー" を意味する ‘NULL’ ポインタとは違い、 ‘None’ は純粋な Python のオブジ
ェクトです。


File: python.info,  Node: モジュールのメソッドテーブルと初期化関数,  Next: コンパイルとリンク,  Prev: 例に戻る,  Up: C や C++ による Python の拡張

6.2.1.4 モジュールのメソッドテーブルと初期化関数
................................................

I promised to show how ‘spam_system()’ is called from Python programs.
First, we need to list its name and address in a "method table":

     static PyMethodDef spam_methods[] = {
         ...
         {"system",  spam_system, METH_VARARGS,
          "Execute a shell command."},
         ...
         {NULL, NULL, 0, NULL}        /* Sentinel */
     };

リスト要素の三つ目のエントリ (‘METH_VARARGS’) に注意してください。このエ
ントリは、C 関数が使う呼び出し規約をインタプリタに教えるためのフラグです
。通常この値は ‘METH_VARARGS’ か ‘METH_VARARGS | METH_KEYWORDS’ のはずで
す; ‘0’ は旧式の *note PyArg_ParseTuple(): 3c1. の変化形が使われることを
意味します。

‘METH_VARARGS’ だけを使う場合、C 関数は、Python レベルでの引数が *note
PyArg_ParseTuple(): 3c1. が受理できるタプルの形式で渡されるものと想定し
なければなりません; この関数についての詳細は下で説明します。

The *note METH_KEYWORDS: 4ea2. bit may be set in the third field if
keyword arguments should be passed to the function.  In this case, the C
function should accept a third ‘PyObject *’ parameter which will be a
dictionary of keywords.  Use *note PyArg_ParseTupleAndKeywords(): 624.
to parse the arguments to such a function.

メソッドテーブルはモジュール定義の構造体から参照されていなければなりませ
ん:

     static struct PyModuleDef spam_module = {
         ...
         .m_methods = spam_methods,
         ...
     };

This structure, in turn, must be passed to the interpreter in the
module's initialization function.  The initialization function must be
named ‘PyInit_name()’, where 'name' is the name of the module, and
should be the only non-‘static’ item defined in the module file:

     PyMODINIT_FUNC
     PyInit_spam(void)
     {
         return PyModuleDef_Init(&spam_module);
     }

Note that *note PyMODINIT_FUNC: 16ec. declares the function as ‘PyObject
*’ return type, declares any special linkage declarations required by
the platform, and for C++ declares the function as ‘extern "C"’.

‘PyInit_spam()’ is called when each interpreter imports its module
‘spam’ for the first time.  (See below for comments about embedding
Python.)  A pointer to the module definition must be returned via *note
PyModuleDef_Init(): 4ea3, so that the import machinery can create the
module and store it in ‘sys.modules’.

When embedding Python, the ‘PyInit_spam()’ function is not called
automatically unless there's an entry in the *note PyImport_Inittab:
1b1b. table.  To add the module to the initialization table, use *note
PyImport_AppendInittab(): 1b1c, optionally followed by an import of the
module:

     #define PY_SSIZE_T_CLEAN
     #include <Python.h>

     int
     main(int argc, char *argv[])
     {
         PyStatus status;
         PyConfig config;
         PyConfig_InitPythonConfig(&config);

         /* Add a built-in module, before Py_Initialize */
         if (PyImport_AppendInittab("spam", PyInit_spam) == -1) {
             fprintf(stderr, "Error: could not extend in-built modules table\n");
             exit(1);
         }

         /* Pass argv[0] to the Python interpreter */
         status = PyConfig_SetBytesString(&config, &config.program_name, argv[0]);
         if (PyStatus_Exception(status)) {
             goto exception;
         }

         /* Initialize the Python interpreter.  Required.
            If this step fails, it will be a fatal error. */
         status = Py_InitializeFromConfig(&config);
         if (PyStatus_Exception(status)) {
             goto exception;
         }
         PyConfig_Clear(&config);

         /* Optionally import the module; alternatively,
            import can be deferred until the embedded script
            imports it. */
         PyObject *pmodule = PyImport_ImportModule("spam");
         if (!pmodule) {
             PyErr_Print();
             fprintf(stderr, "Error: could not import module 'spam'\n");
         }

         // ... use Python C API here ...

         return 0;

       exception:
          PyConfig_Clear(&config);
          Py_ExitStatusException(status);
     }

     注釈: If you declare a global variable or a local static one, the
     module may experience unintended side-effects on re-initialisation,
     for example when removing entries from ‘sys.modules’ or importing
     compiled modules into multiple interpreters within a process (or
     following a ‘fork()’ without an intervening ‘exec()’).  If module
     state is not yet fully *note isolated: 166, authors should consider
     marking the module as having no support for subinterpreters (via
     *note Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED: 4ea4.).

A more substantial example module is included in the Python source
distribution as ‘Modules/xxlimited.c’.  This file may be used as a
template or simply read as an example.


File: python.info,  Node: コンパイルとリンク,  Next: C から Python 関数を呼び出す,  Prev: モジュールのメソッドテーブルと初期化関数,  Up: C や C++ による Python の拡張

6.2.1.5 コンパイルとリンク
..........................

新しい拡張モジュールを使えるようになるまで、まだ二つの作業: コンパイルと
、Python システムへのリンク、が残っています。動的読み込み (dynamic
loading) を使っているのなら、作業の詳細は自分のシステムが使っている動的
読み込みの形式によって変わるかもしれません; 詳しくは、拡張モジュールのビ
ルドに関する章 (*note C および C++ 拡張のビルド: 4ea7. 章) や、Windows に
おけるビルドに関係する追加情報の章 (*note Windows 上での C および C++
拡張モジュールのビルド: 2224. 章) を参照してください。

動的読み込みを使えなかったり、モジュールを常時 Python インタプリタの一部
にしておきたい場合には、インタプリタのビルド設定を変更して再ビルドしなけ
ればならなくなるでしょう。Unixでは、幸運なことにこの作業はとても単純です
: 単に自作のモジュールファイル (例えば ‘spammodule.c’) を展開したソース
配布物の ‘Modules/’ ディレクトリに置き、 ‘Modules/Setup.local’ に自分の
ファイルを説明する以下の一行:

     spam spammodule.o

を追加して、トップレベルのディレクトリで ‘make’ を実行して、インタプリタ
を再ビルドするだけです。 ‘Modules/’ サブディレクトリでも ‘make’ を実行で
きますが、前もって '‘make’ Makefile' を実行して ‘Makefile’ を再ビルドし
ておかなければならりません。(この作業は ‘Setup’ ファイルを変更するたびに
必要です。)

モジュールが別のライブラリとリンクされている必要がある場合、ライブラリも
設定ファイルに列挙できます。例えば以下のようにします。

     spam spammodule.o -lX11


File: python.info,  Node: C から Python 関数を呼び出す,  Next: 拡張モジュール関数でのパラメタ展開,  Prev: コンパイルとリンク,  Up: C や C++ による Python の拡張

6.2.1.6 C から Python 関数を呼び出す
....................................

これまでは、Python からの C 関数の呼び出しに重点を置いて述べてきました。
ところでこの逆: C からの Python 関数の呼び出しもまた有用です。とりわけ、
いわゆる "コールバック" 関数をサポートするようなライブラリを作成する際に
はこの機能が便利です。ある C インターフェースがコールバックを利用してい
る場合、同等の機能を提供する Python コードでは、しばしば Python プログラ
マにコールバック機構を提供する必要があります; このとき実装では、 C で書
かれたコールバック関数から Python で書かれたコールパック関数を呼び出すよ
うにする必要があるでしょう。もちろん、他の用途も考えられます。

幸運なことに、Python インタプリタは簡単に再帰呼び出しでき、 Python 関数
を呼び出すための標準インターフェースもあります。 (Python パーザを特定の
入力文字を使って呼び出す方法について詳説するつもりはありません -- この方
法に興味があるなら、 Python ソースコードの ‘Modules/main.c’ にある、コマ
ンドラインオプション *note -c: 1a8. の実装を見てください)

Python 関数の呼び出しは簡単です。まず、C のコードに対してコールバックを
登録しようとする Python プログラムは、何らかの方法で Python の関数オブジ
ェクトを渡さねばなりません。このために、コールバック登録関数 (またはその
他のインターフェース) を提供せねばなりません。このコールバック登録関数が
呼び出された際に、引き渡された Python 関数オブジェクトへのポインタをグロ
ーバル変数に -- あるいは、どこか適切な場所に -- 保存します (関数オブジェ
クトを *note Py_INCREF(): 78f. するようよく注意してください!)。例えば、
以下のような関数がモジュールの一部になっていることでしょう:

     static PyObject *my_callback = NULL;

     static PyObject *
     my_set_callback(PyObject *dummy, PyObject *args)
     {
         PyObject *result = NULL;
         PyObject *temp;

         if (PyArg_ParseTuple(args, "O:set_callback", &temp)) {
             if (!PyCallable_Check(temp)) {
                 PyErr_SetString(PyExc_TypeError, "parameter must be callable");
                 return NULL;
             }
             Py_XINCREF(temp);         /* Add a reference to new callback */
             Py_XDECREF(my_callback);  /* Dispose of previous callback */
             my_callback = temp;       /* Remember new callback */
             /* Boilerplate to return "None" */
             Py_INCREF(Py_None);
             result = Py_None;
         }
         return result;
     }

This function must be registered with the interpreter using the *note
METH_VARARGS: 1721. flag; this is described in section *note
モジュールのメソッドテーブルと初期化関数: 4ea0.  The *note
PyArg_ParseTuple(): 3c1. function and its arguments are documented in
section *note 拡張モジュール関数でのパラメタ展開: 4eaa.

*note Py_XINCREF(): c5a. および *note Py_XDECREF(): 992. は、オブジェク
トに対する参照カウントをインクリメント/デクリメントするためのマクロで、
‘NULL’ ポインタが渡されても安全に操作できる形式です (とはいえ、上の流れ
では 'temp' が ‘NULL’ になることはありません)。これらのマクロと参照カウ
ントについては、 *note 参照カウント法: 4eab. で説明しています。

その後、コールバック関数を呼び出す時が来たら、C 関数 *note
PyObject_CallObject(): 4eac. を呼び出します。この関数には二つの引数:
Python 関数と Python 関数の引数リストがあり、いずれも任意の Python オブ
ジェクトを表すポインタ型です。引数リストは常にタプルオブジェクトでなけれ
ばならず、その長さは引数の数になります。Python 関数を引数なしで呼び出す
のなら、 ‘NULL’ か空のタプルを渡します; 単一の引数で関数を呼び出すのなら
、単要素 (singleton) のタプルを渡します。 *note Py_BuildValue(): 3c2. の
書式文字列中に、ゼロ個または一個以上の書式化コードが入った丸括弧がある場
合、この関数はタプルを返します。以下に例を示します:

     int arg;
     PyObject *arglist;
     PyObject *result;
     ...
     arg = 123;
     ...
     /* Time to call the callback */
     arglist = Py_BuildValue("(i)", arg);
     result = PyObject_CallObject(my_callback, arglist);
     Py_DECREF(arglist);

*note PyObject_CallObject(): 4eac. は Python オブジェクトへのポインタを
返します: これは Python 関数からの戻り値になります。 *note
PyObject_CallObject(): 4eac. は、引数に対して "参照カウント中立
(reference-count- neutral)" です。上の例ではタプルを生成して引数リストと
して提供しており、このタプルは *note PyObject_CallObject(): 4eac. の呼び
出し直後に *note Py_DECREF(): 790. されています。

*note PyObject_CallObject(): 4eac. は戻り値として "新しい" オブジェクト:
新規に作成されたオブジェクトか、既存のオブジェクトの参照カウントをインク
リメントしたものを返します。従って、このオブジェクトをグローバル変数に保
存したいのでないかぎり、たとえこの戻り値に興味がなくても (むしろ、そうで
あればなおさら!)  何がしかの方法で戻り値オブジェクトを *note
Py_DECREF(): 790. しなければなりません。

とはいえ、戻り値を *note Py_DECREF(): 790. する前には、値が ‘NULL’ でな
いかチェックしておくことが重要です。もし ‘NULL’ なら、呼び出した Python
関数は例外を送出して終了させられています。 *note PyObject_CallObject():
4eac. を呼び出しているコード自体もまた Python から呼び出されているのであ
れば、今度は C コードが自分を呼び出している Python コードにエラー標示値
を返さねばなりません。それにより、インタプリタはスタックトレースを出力し
たり、例外を処理するための Python コードを呼び出したりできます。例外の送
出が不可能だったり、したくないのなら、 *note PyErr_Clear(): 1232. を呼ん
で例外を消去しておかねばなりません。例えば以下のようにします:

     if (result == NULL)
         return NULL; /* Pass error back */
     ...use result...
     Py_DECREF(result);

Python コールバック関数をどんなインターフェースにしたいかによっては、引
数リストを *note PyObject_CallObject(): 4eac. に与えなければならない場合
もあります。あるケースでは、コールバック関数を指定したのと同じインターフ
ェースを介して、引数リストも渡されているかもしれません。また別のケースで
は、新しいタプルを構築して引数リストを渡さねばならないかもしれません。こ
の場合最も簡単なのは *note Py_BuildValue(): 3c2. を呼ぶやり方です。例え
ば、整数のイベントコードを渡したければ、以下のようなコードを使うことにな
るでしょう:

     PyObject *arglist;
     ...
     arglist = Py_BuildValue("(l)", eventcode);
     result = PyObject_CallObject(my_callback, arglist);
     Py_DECREF(arglist);
     if (result == NULL)
         return NULL; /* Pass error back */
     /* Here maybe use the result */
     Py_DECREF(result);

‘Py_DECREF(arglist)’ が呼び出しの直後、エラーチェックよりも前に置かれて
いることに注意してください!  また、厳密に言えば、このコードは完全ではあ
りません: *note Py_BuildValue(): 3c2. はメモリ不足におちいるかもしれず、
チェックしておくべきです。

通常の引数とキーワード引数をサポートする *note PyObject_Call(): 63d. を
使って、キーワード引数を伴う関数呼び出しをすることができます。上の例と同
じように、 *note Py_BuildValue(): 3c2. を作って辞書を作ります。

     PyObject *dict;
     ...
     dict = Py_BuildValue("{s:i}", "name", val);
     result = PyObject_Call(my_callback, NULL, dict);
     Py_DECREF(dict);
     if (result == NULL)
         return NULL; /* Pass error back */
     /* Here maybe use the result */
     Py_DECREF(result);


File: python.info,  Node: 拡張モジュール関数でのパラメタ展開,  Next: 拡張モジュール関数のキーワードパラメタ,  Prev: C から Python 関数を呼び出す,  Up: C や C++ による Python の拡張

6.2.1.7 拡張モジュール関数でのパラメタ展開
..........................................

*note PyArg_ParseTuple(): 3c1. 関数は以下のように宣言されています:

     int PyArg_ParseTuple(PyObject *arg, const char *format, ...);

引数 'arg' は C 関数から Python に渡される引数リストが入ったタプルオブジ
ェクトでなければなりません。 'format' 引数は書式文字列で、 Python/C API
リファレンスマニュアルの *note 引数の解釈と値の構築: 3d5. で解説されてい
る書法に従わねばなりません。残りの引数は、それぞれの変数のアドレスで、書
式化文字列から決まる型になっていなければなりません。

*note PyArg_ParseTuple(): 3c1. は Python 側から与えられた引数が必要な型
になっているか調べるのに対し、 *note PyArg_ParseTuple(): 3c1. は呼び出し
の際に渡された C 変数のアドレスが有効な値を持つか調べられないことに注意
してください: ここで間違いを犯すと、コードがクラッシュするかもしれません
し、少なくともでたらめなビットをメモリに上書きしてしまいます。慎重に!

呼び出し側に提供されるオブジェクトへの参照はすべて '借用' 参照 (borrowed
reference) になります; これらのオブジェクトの参照カウントをデクリメント
してはなりません!

以下にいくつかの呼び出し例を示します:

     #define PY_SSIZE_T_CLEAN
     #include <Python.h>

     int ok;
     int i, j;
     long k, l;
     const char *s;
     Py_ssize_t size;

     ok = PyArg_ParseTuple(args, ""); /* No arguments */
         /* Python call: f() */

     ok = PyArg_ParseTuple(args, "s", &s); /* A string */
         /* Possible Python call: f('whoops!') */

     ok = PyArg_ParseTuple(args, "lls", &k, &l, &s); /* Two longs and a string */
         /* Possible Python call: f(1, 2, 'three') */

     ok = PyArg_ParseTuple(args, "(ii)s#", &i, &j, &s, &size);
         /* A pair of ints and a string, whose size is also returned */
         /* Possible Python call: f((1, 2), 'three') */

     {
         const char *file;
         const char *mode = "r";
         int bufsize = 0;
         ok = PyArg_ParseTuple(args, "s|si", &file, &mode, &bufsize);
         /* A string, and optionally another string and an integer */
         /* Possible Python calls:
            f('spam')
            f('spam', 'w')
            f('spam', 'wb', 100000) */
     }

     {
         int left, top, right, bottom, h, v;
         ok = PyArg_ParseTuple(args, "((ii)(ii))(ii)",
                  &left, &top, &right, &bottom, &h, &v);
         /* A rectangle and a point */
         /* Possible Python call:
            f(((0, 0), (400, 300)), (10, 10)) */
     }

     {
         Py_complex c;
         ok = PyArg_ParseTuple(args, "D:myfunction", &c);
         /* a complex, also providing a function name for errors */
         /* Possible Python call: myfunction(1+2j) */
     }


File: python.info,  Node: 拡張モジュール関数のキーワードパラメタ,  Next: 任意の値を構築する,  Prev: 拡張モジュール関数でのパラメタ展開,  Up: C や C++ による Python の拡張

6.2.1.8 拡張モジュール関数のキーワードパラメタ
..............................................

*note PyArg_ParseTupleAndKeywords(): 624. は、以下のように宣言されていま
す:

     int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,
                                     const char *format, char * const *kwlist, ...);

'arg' と 'format' パラメタは *note PyArg_ParseTuple(): 3c1. のものと同じ
です。 'kwdict' パラメタはキーワード引数の入った辞書で、 Python ランタイ
ムシステムから第三パラメタとして受け取ります。 'kwlist' パラメタは各パラ
メタを識別するための文字列からなる、 ‘NULL’ 終端されたリストです; 各パラ
メタ名は 'format' 中の型情報に対して左から右の順に照合されます。成功する
と *note PyArg_ParseTupleAndKeywords(): 624. は真を返し、それ以外の場合
には適切な例外を送出して偽を返します。

     注釈: キーワード引数を使っている場合、タプルは入れ子にして使えませ
     ん!  'kwlist' 内に存在しないキーワードパラメタが渡された場合、
     *note TypeError: 198. の送出を引き起こします。

以下にキーワードを使ったモジュール例を示します。これは Geoff Philbrick
(<philbrick@hks.com>) によるプログラム例をもとにしています:

     #define PY_SSIZE_T_CLEAN
     #include <Python.h>

     static PyObject *
     keywdarg_parrot(PyObject *self, PyObject *args, PyObject *keywds)
     {
         int voltage;
         const char *state = "a stiff";
         const char *action = "voom";
         const char *type = "Norwegian Blue";

         static char *kwlist[] = {"voltage", "state", "action", "type", NULL};

         if (!PyArg_ParseTupleAndKeywords(args, keywds, "i|sss", kwlist,
                                          &voltage, &state, &action, &type))
             return NULL;

         printf("-- This parrot wouldn't %s if you put %i Volts through it.\n",
                action, voltage);
         printf("-- Lovely plumage, the %s -- It's %s!\n", type, state);

         Py_RETURN_NONE;
     }

     static PyMethodDef keywdarg_methods[] = {
         /* The cast of the function is necessary since PyCFunction values
          * only take two PyObject* parameters, and keywdarg_parrot() takes
          * three.
          */
         {"parrot", (PyCFunction)(void(*)(void))keywdarg_parrot, METH_VARARGS | METH_KEYWORDS,
          "Print a lovely skit to standard output."},
         {NULL, NULL, 0, NULL}   /* sentinel */
     };

     static struct PyModuleDef keywdarg_module = {
         .m_base = PyModuleDef_HEAD_INIT,
         .m_name = "keywdarg",
         .m_size = 0,
         .m_methods = keywdarg_methods,
     };

     PyMODINIT_FUNC
     PyInit_keywdarg(void)
     {
         return PyModuleDef_Init(&keywdarg_module);
     }


File: python.info,  Node: 任意の値を構築する,  Next: 参照カウント法,  Prev: 拡張モジュール関数のキーワードパラメタ,  Up: C や C++ による Python の拡張

6.2.1.9 任意の値を構築する
..........................

*note Py_BuildValue(): 3c2. は *note PyArg_ParseTuple(): 3c1. の対極に位
置するものです。この関数は以下のように定義されています:

     PyObject *Py_BuildValue(const char *format, ...);

*note Py_BuildValue(): 3c2. は、 *note PyArg_ParseTuple(): 3c1. の認識す
る一連の書式単位に似た書式単位を認識します。ただし (関数への出力ではなく
、入力に使われる) 引数はポインタではなく、ただの値でなければなりません。
Python から呼び出された C 関数が返す値として適切な、新たな Python オブジ
ェクトを返します。

*note PyArg_ParseTuple(): 3c1. とは一つ違う点があります: *note
PyArg_ParseTuple(): 3c1. は第一引数をタプルにする必要があります (Python
の引数リストは内部的には常にタプルとして表現されるからです) が、 *note
Py_BuildValue(): 3c2. はタプルを生成するとは限りません。 *note
Py_BuildValue(): 3c2. は書式文字列中に書式単位が二つかそれ以上入っている
場合にのみタプルを構築します。書式文字列が空なら、 ‘None’ を返します。き
っかり一つの書式単位なら、その書式単位が記述している何らかのオブジェクト
になります。サイズが 0 や 1 のタプル返させたいのなら、書式文字列を丸括弧
で囲います。

以下に例を示します (左に呼び出し例を、右に構築される Python 値を示します
):

     Py_BuildValue("")                        None
     Py_BuildValue("i", 123)                  123
     Py_BuildValue("iii", 123, 456, 789)      (123, 456, 789)
     Py_BuildValue("s", "hello")              'hello'
     Py_BuildValue("y", "hello")              b'hello'
     Py_BuildValue("ss", "hello", "world")    ('hello', 'world')
     Py_BuildValue("s#", "hello", 4)          'hell'
     Py_BuildValue("y#", "hello", 4)          b'hell'
     Py_BuildValue("()")                      ()
     Py_BuildValue("(i)", 123)                (123,)
     Py_BuildValue("(ii)", 123, 456)          (123, 456)
     Py_BuildValue("(i,i)", 123, 456)         (123, 456)
     Py_BuildValue("[i,i]", 123, 456)         [123, 456]
     Py_BuildValue("{s:i,s:i}",
                   "abc", 123, "def", 456)    {'abc': 123, 'def': 456}
     Py_BuildValue("((ii)(ii)) (ii)",
                   1, 2, 3, 4, 5, 6)          (((1, 2), (3, 4)), (5, 6))


File: python.info,  Node: 参照カウント法,  Next: C++での拡張モジュール作成,  Prev: 任意の値を構築する,  Up: C や C++ による Python の拡張

6.2.1.10 参照カウント法
.......................

C や C++のような言語では、プログラマはヒープ上のメモリを動的に確保したり
解放したりする責任があります。こうした作業は C では関数 ‘malloc()’ や
‘free()’ で行います。C++では本質的に同じ意味で演算子 ‘new’ や ‘delete’ が
使われます。そこで、以下の議論は C の場合に限定して行います。

Every block of memory allocated with ‘malloc()’ should eventually be
returned to the pool of available memory by exactly one call to
‘free()’.  It is important to call ‘free()’ at the right time.  If a
block's address is forgotten but ‘free()’ is not called for it, the
memory it occupies cannot be reused until the program terminates.  This
is called a 'memory leak'.  On the other hand, if a program calls
‘free()’ for a block and then continues to use the block, it creates a
conflict with reuse of the block through another ‘malloc()’ call.  This
is called 'using freed memory'.  It has the same bad consequences as
referencing uninitialized data -- core dumps, wrong results, mysterious
crashes.

よくあるメモリリークの原因はコード中の普通でない処理経路です。例えば、あ
る関数があるメモリブロックを確保し、何らかの計算を行って、再度ブロックを
解放するとします。さて、関数の要求仕様を変更して、計算に対するテストを追
加すると、エラー条件を検出し、関数の途中で処理を戻すようになるかもしれま
せん。この途中での終了が起きるとき、確保されたメモリブロックは解放し忘れ
やすいのです。コードが後で追加された場合には特にそうです。このようなメモ
リリークが一旦紛れ込んでしまうと、長い間検出されないままになることがよく
あります: エラーによる関数の終了は、全ての関数呼び出しのに対してほんのわ
ずかな割合しか起きず、その一方でほとんどの近代的な計算機は相当量の仮想記
憶を持っているため、メモリリークが明らかになるのは、長い間動作していたプ
ロセスがリークを起こす関数を何度も使った場合に限られるからです。従って、
この種のエラーを最小限にとどめるようなコーディング規約や戦略を設けて、不
慮のメモリリークを避けることが重要なのです。

Python は ‘malloc()’ や ‘free()’ を非常によく利用するため、メモリリーク
の防止に加え、解放されたメモリの使用を防止する戦略が必要です。このために
選ばれたのが参照カウント法 ('reference counting') と呼ばれる手法です。参
照カウント法の原理は簡単です: 全てのオブジェクトにはカウンタがあり、オブ
ジェクトに対する参照がどこかに保存されたらカウンタをインクリメントし、オ
ブジェクトに対する参照が削除されたらデクリメントします。カウンタがゼロに
なったら、オブジェクトへの最後の参照が削除されたことになり、オブジェクト
は解放されます。

もう一つの戦略は自動ガベージコレクション ('automatic garbage
collection') と呼ばれています。 (参照カウント法はガベージコレクション戦
略の一つとして挙げられることもあるので、二つを区別するために筆者は "自動
(automatic)" を使っています。) 自動ガベージコレクションの大きな利点は、
ユーザが ‘free()’ を明示的によばなくてよいことにあります。 (速度やメモリ
の有効利用性も利点として主張されています -- が、これは確たる事実ではあり
ません。) C における自動ガベージコレクションの欠点は、真に可搬性のあるガ
ベージコレクタが存在しないということです。それに対し、参照カウント法は可
搬性のある実装ができます (‘malloc()’ や ‘free()’ を利用できるのが前提で
す -- C 標準はこれを保証しています)。いつの日か、十分可搬性のあるガベー
ジコレクタが C で使えるようになるかもしれませんが、それまでは参照カウン
ト法でやっていく以外にはないのです。

Python では、伝統的な参照カウント法の実装を行っている一方で、参照の循環
を検出するために働く循環参照検出機構 (cycle detector) も提供しています。
循環参照検出機構のおかげで、直接、間接にかかわらず循環参照の生成を気にせ
ずにアプリケーションを構築できます; というのも、参照カウント法だけを使っ
たガベージコレクション実装にとって循環参照は弱点だからです。循環参照は、
(間接参照の場合も含めて) 相互への参照が入ったオブジェクトから形成される
ため、循環内のオブジェクトは各々非ゼロの参照カウントを持ちます。典型的な
参照カウント法の実装では、たとえ循環参照を形成するオブジェクトに対して他
に全く参照がないとしても、循環参照内のどのオブジェクトに属するメモリも再
利用できません。

循環参照検出機構はそのようなガベージサイクル (前述したような循環参照オブ
ジェクト) を検出して回収することができます。 *note gc: 64. モジュールそ
のような検出機構の実行 (*note collect(): 1b3. 関数) を提供するとともに、
設定のためのインタフェースおよび検出機構を実行時に無効にする方法も提供し
ています。

* Menu:

* Python における参照カウント法::
* 所有権にまつわる規則::
* 薄氷::
* NULL ポインタ::


File: python.info,  Node: Python における参照カウント法,  Next: 所有権にまつわる規則,  Up: 参照カウント法

6.2.1.11 Python における参照カウント法
......................................

Python には、参照カウントのインクリメントやデクリメントを処理する二つの
マクロ、 ‘Py_INCREF(x)’ と ‘Py_DECREF(x)’ があります。 *note
Py_DECREF(): 790. は、参照カウントがゼロに到達した際に、オブジェクトのメ
モリ解放も行います。柔軟性を持たせるために、 ‘free()’ を直接呼び出しませ
ん -- その代わりにオブジェクトの型オブジェクト ('type object') を介しま
す。このために (他の目的もありますが)、全てのオブジェクトには自身の型オ
ブジェクトに対するポインタが入っています。

さて、まだ重大な疑問が残っています: いつ ‘Py_INCREF(x)’ や
‘Py_DECREF(x)’ を使えばよいのでしょうか?  まず、いくつかの用語説明から始
めさせてください。まず、オブジェクトは "占有 (own)" されることはありませ
ん; しかし、あるオブジェクトに対する参照の所有 'own a reference' はでき
ます。オブジェクトの参照カウントは、そのオブジェクトが参照の所有を受けて
いる回数と定義されています。参照の所有者は、参照が必要なくなった際に
*note Py_DECREF(): 790. を呼び出す役割を担います。参照の所有権は委譲
(transfer) できます。所有参照 (owned reference) の放棄には、渡す、保存す
る、 *note Py_DECREF(): 790. を呼び出す、という三つの方法があります。所
有参照を処理し忘れると、メモリリークを引き起こします。

オブジェクトに対する参照は、借用 ('borrow') も可能です。 (1) 参照の借用
者は、 *note Py_DECREF(): 790. を呼んではなりません。借用者は、参照の所
有者から借用した期間を超えて参照を保持し続けてはなりません。所有者が参照
を放棄した後で借用参照を使うと、解放済みメモリを使用してしまう危険がある
ので、絶対に避けねばなりません。 (2)

参照の借用が参照の所有よりも優れている点は、コードがとりうるあらゆる処理
経路で参照を廃棄しておくよう注意しなくて済むことです -- 別の言い方をすれ
ば、借用参照の場合には、処理の途中で関数を終了してもメモリリークの危険を
冒すことがない、ということです。逆に、所有よりも不利な点は、ごくまともに
見えるコードが、実際には参照の借用元で放棄されてしまった後にその参照を使
うかもしれないような微妙な状況があるということです。

*note Py_INCREF(): 78f. を呼び出すと、借用参照を所有参照に変更できます。
この操作は参照の借用元の状態には影響しません -- *note Py_INCREF(): 78f.
は新たな所有参照を生成し、参照の所有者が担うべき全ての責任を課します (つ
まり、新たな参照の所有者は、以前の所有者と同様、参照の放棄を適切に行わね
ばなりません)。

   ---------- Footnotes ----------

   (1) 参照を "借用する" というメタファは厳密には正しくありません: なぜ
なら、参照の所有者は依然として参照のコピーを持っているからです。

   (2) 参照カウントが 1 以上かどうか調べる方法は 'うまくいきません' -- 参
照カウント自体も解放されたメモリ上にあるため、その領域が他のオブジェクト
に使われている可能性があります!


File: python.info,  Node: 所有権にまつわる規則,  Next: 薄氷,  Prev: Python における参照カウント法,  Up: 参照カウント法

6.2.1.12 所有権にまつわる規則
.............................

オブジェクトへの参照を関数の内外に渡す場合には、オブジェクトの所有権が参
照と共に渡されるか否かが常に関数インターフェース仕様の一部となります。

オブジェクトへの参照を返すほとんどの関数は、参照とともに所有権も渡します
。特に、 *note PyLong_FromLong(): 1bd0. や *note Py_BuildValue(): 3c2. の
ように、新しいオブジェクトを生成する関数は全て所有権を相手に渡します。オ
ブジェクトが実際には新たなオブジェクトでなくても、そのオブジェクトに対す
る新たな参照の所有権を得ます。例えば、 *note PyLong_FromLong(): 1bd0. は
よく使う値をキャッシュしており、キャッシュされた値への参照を返すことがあ
ります。

*note PyObject_GetAttrString(): 5ef. のように、あるオブジェクトから別の
オブジェクトを抽出するような関数もまた、参照とともに所有権を委譲します。
こちらの方はやや理解しにくいかもしれません。というのはよく使われるルーチ
ンのいくつかが例外となっているからです: *note PyTuple_GetItem(): 4eb7. 、
*note PyList_GetItem(): 5ff. 、 *note PyDict_GetItem(): 628. 、および
*note PyDict_GetItemString(): 629. は全て、タプル、リスト、または辞書か
ら借用参照を返します。

*note PyImport_AddModule(): 5fc. は、実際にはオブジェクトを生成して返す
ことがあるにもかかわらず、借用参照を返します: これが可能なのは、生成され
たオブジェクトに対する所有参照は ‘sys.modules’ に保持されるからです。

オブジェクトへの参照を別の関数に渡す場合、一般的には、関数側は呼び出し手
から参照を借用します -- 参照を保存する必要があるなら、関数側は *note
Py_INCREF(): 78f. を呼び出して独立した所有者になります。とはいえ、この規
則には二つの重要な例外: *note PyTuple_SetItem(): 4eb8. と *note
PyList_SetItem(): 18ba. があります。これらの関数は、渡された引数要素に対
して所有権を乗っ取り (take over) ます -- たとえ失敗してもです!  (*note
PyDict_SetItem(): 4eb9. とその仲間は所有権を乗っ取りません -- これらはい
わば "普通の" 関数です。)

Python から C 関数が呼び出される際には、C 関数は呼び出し側から引数への参
照を借用します。C 関数の呼び出し側はオブジェクトへの参照を所有しているの
で、借用参照の生存期間が保証されるのは関数が処理を返すまでです。このよう
にして借用参照を保存したり他に渡したりしたい場合にのみ、 *note
Py_INCREF(): 78f. を使って所有参照にする必要があります。

Python から呼び出された C 関数が返す参照は所有参照でなければなりません
-- 所有権は関数から呼び出し側へと委譲されます。


File: python.info,  Node: 薄氷,  Next: NULL ポインタ,  Prev: 所有権にまつわる規則,  Up: 参照カウント法

6.2.1.13 薄氷
.............

数少ない状況において、一見無害に見える借用参照の利用が問題をひきおこすこ
とがあります。この問題はすべて、インタプリタが非明示的に呼び出され、イン
タプリタが参照の所有者に参照を放棄させてしまう状況と関係しています。

知っておくべきケースのうち最初の、そして最も重要なものは、リスト要素に対
する参照を借りている際に起きる、関係ないオブジェクトに対する *note
Py_DECREF(): 790. の使用です。例えば:

     void
     bug(PyObject *list)
     {
         PyObject *item = PyList_GetItem(list, 0);

         PyList_SetItem(list, 1, PyLong_FromLong(0L));
         PyObject_Print(item, stdout, 0); /* BUG! */
     }

上の関数はまず、 ‘list[0]’ への参照を借用し、次に ‘list[1]’ を値 ‘0’ で
置き換え、最後にさきほど借用した参照を出力しています。何も問題ないように
見えますね?  でもそうではないのです!

Let's follow the control flow into *note PyList_SetItem(): 18ba.  The
list owns references to all its items, so when item 1 is replaced, it
has to dispose of the original item 1.  Now let's suppose the original
item 1 was an instance of a user-defined class, and let's further
suppose that the class defined a ‘__del__()’ method.  If this class
instance has a reference count of 1, disposing of it will call its
‘__del__()’ method.  Internally, *note PyList_SetItem(): 18ba. calls
*note Py_DECREF(): 790. on the replaced item, which invokes replaced
item's corresponding *note tp_dealloc: 4ebc. function.  During
deallocation, *note tp_dealloc: 4ebc. calls *note tp_finalize: c9d,
which is mapped to the ‘__del__()’ method for class instances (see PEP
442(1)).  This entire sequence happens synchronously within the *note
PyList_SetItem(): 18ba. call.

Since it is written in Python, the ‘__del__()’ method can execute
arbitrary Python code.  Could it perhaps do something to invalidate the
reference to ‘item’ in ‘bug()’?  You bet!  Assuming that the list passed
into ‘bug()’ is accessible to the ‘__del__()’ method, it could execute a
statement to the effect of ‘del list[0]’, and assuming this was the last
reference to that object, it would free the memory associated with it,
thereby invalidating ‘item’.

問題の原因が分かれば、解決は簡単です。一時的に参照回数を増やせばよいので
す。正しく動作するバージョンは以下のようになります:

     void
     no_bug(PyObject *list)
     {
         PyObject *item = PyList_GetItem(list, 0);

         Py_INCREF(item);
         PyList_SetItem(list, 1, PyLong_FromLong(0L));
         PyObject_Print(item, stdout, 0);
         Py_DECREF(item);
     }

This is a true story.  An older version of Python contained variants of
this bug and someone spent a considerable amount of time in a C debugger
to figure out why his ‘__del__()’ methods would fail...

The second case of problems with a borrowed reference is a variant
involving threads.  Normally, multiple threads in the Python interpreter
can't get in each other's way, because there is a *note global lock:
474. protecting Python's entire object space.  However, it is possible
to temporarily release this lock using the macro *note
Py_BEGIN_ALLOW_THREADS: 4ebd, and to re-acquire it using *note
Py_END_ALLOW_THREADS: c7f.  This is common around blocking I/O calls, to
let other threads use the processor while waiting for the I/O to
complete.  Obviously, the following function has the same problem as the
previous one:

     void
     bug(PyObject *list)
     {
         PyObject *item = PyList_GetItem(list, 0);
         Py_BEGIN_ALLOW_THREADS
         ...some blocking I/O call...
         Py_END_ALLOW_THREADS
         PyObject_Print(item, stdout, 0); /* BUG! */
     }

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0442/


File: python.info,  Node: NULL ポインタ,  Prev: 薄氷,  Up: 参照カウント法

6.2.1.14 NULL ポインタ
......................

一般論として、オブジェクトへの参照を引数にとる関数はユーザが ‘NULL’ ポイ
ンタを渡すとは予想しておらず、渡そうとするとコアダンプになる (か、あとで
コアダンプを引き起こす) ことでしょう。一方、オブジェクトへの参照を返すよ
うな関数は一般に、例外の発生を示す場合にのみ ‘NULL’ を返します。引数に対
して ‘NULL’ テストを行わない理由は、関数はしばしば受け取ったオブジェクト
を他の関数へと引き渡すからです -- 各々の関数が ‘NULL’ テストを行えば、冗
長なテストが大量に行われ、コードはより低速に動くことになります。

従って、 ‘NULL’ のテストはオブジェクトの "発生源"、すなわち値が ‘NULL’ に
なるかもしれないポインタを受け取ったときだけにしましょう。 ‘malloc()’ や
、例外を送出する可能性のある関数がその例です。

マクロ *note Py_INCREF(): 78f. および *note Py_DECREF(): 790. は ‘NULL’
ポインタのチェックを行いません -- しかし、これらのマクロの変化形である
*note Py_XINCREF(): c5a. および *note Py_XDECREF(): 992. はチェックを行
います。

特定のオブジェクト型について調べるマクロ (‘Pytype_Check()’) は 'NULL' ポ
インタのチェックを行いません -- 繰り返しますが、様々な異なる型を想定して
オブジェクトの型を調べる際には、こうしたマクロを続けて呼び出す必要がある
ので、個別に ‘NULL’ ポインタのチェックをすると冗長なテストになってしまう
のです。型を調べるマクロには、 ‘NULL’ チェックを行う変化形はありません。

Python から C 関数を呼び出す機構は、C 関数に渡される引数リスト (例でいう
ところの ‘args’) が決して ‘NULL’ にならないよう保証しています -- 実際に
は、常にタプル型になるよう保証しています。(1)

‘NULL’ ポインタを Python ユーザレベルに "逃がし" てしまうと、深刻なエラ
ーを引き起こします。

   ---------- Footnotes ----------

   (1) "旧式の" 呼び出し規約を使っている場合には、この保証は適用されませ
ん -- 既存のコードにはいまだに旧式の呼び出し規約が多々あります。


File: python.info,  Node: C++での拡張モジュール作成,  Next: 拡張モジュールに C API を提供する,  Prev: 参照カウント法,  Up: C や C++ による Python の拡張

6.2.1.15 C++での拡張モジュール作成
..................................

C++でも拡張モジュールは作成できます。ただしいくつか制限があります。メイ
ンプログラム (Python インタプリタ) は C コンパイラでコンパイルされリンク
されているので、グローバル変数や静的オブジェクトをコンストラクタで作成で
きません。メインプログラムが C++ コンパイラでリンクされているならこれは
問題ではありません。 Python インタプリタから呼び出される関数 (特にモジュ
ール初期化関数) は、 ‘extern "C"’ を使って宣言しなければなりません。また
、Python ヘッダファイルを ‘extern "C" {...}’ に入れる必要はありません--
シンボル ‘__cplusplus’ (最近の C++ コンパイラは全てこのシンボルを定義し
ています) が定義されているときに ‘extern "C" {...}’ が行われるように、ヘ
ッダファイル内にすでに書かれているからです。


File: python.info,  Node: 拡張モジュールに C API を提供する,  Prev: C++での拡張モジュール作成,  Up: C や C++ による Python の拡張

6.2.1.16 拡張モジュールに C API を提供する
..........................................

多くの拡張モジュールは単に Python から使える新たな関数や型を提供するだけ
ですが、時に拡張モジュール内のコードが他の拡張モジュールでも便利なことが
あります。例えば、あるモジュールでは順序概念のないリストのように動作する
"コレクション (collection)" クラスを実装しているかもしれません。ちょうど
リストを生成したり操作したりできる C API を備えた標準の Python リスト型
のように、この新たなコレクション型も他の拡張モジュールから直接操作できる
ようにするには一連の C 関数を持っていなければなりません。

一見するとこれは簡単なこと: 単に関数を (もちろん ‘static’ などとは宣言せ
ずに) 書いて、適切なヘッダファイルを提供し、C API を書けばよいだけ、に思
えます。そして実際のところ、全ての拡張モジュールが Python インタプリタに
常に静的にリンクされている場合にはうまく動作します。ところがモジュールが
共有ライブラリの場合には、一つのモジュールで定義されているシンボルが他の
モジュールから不可視なことがあります。可視性の詳細はオペレーティングシス
テムによります; あるシステムは Python インタプリタと全ての拡張モジュール
用に単一のグローバルな名前空間を用意しています (例えば Windows)。別のシ
ステムはモジュールのリンク時に取り込まれるシンボルを明示的に指定する必要
があります (AIX がその一例です)、また別のシステム (ほとんどの Unix) では
、違った戦略を選択肢として提供しています。そして、たとえシンボルがグロー
バル変数として可視であっても、呼び出したい関数の入ったモジュールがまだロ
ードされていないことだってあります!

従って、可搬性の点からシンボルの可視性には何ら仮定をしてはならないことに
なります。つまり拡張モジュール中の全てのシンボルは ‘static’ と宣言せねば
なりません。例外はモジュールの初期化関数で、これは (*note
モジュールのメソッドテーブルと初期化関数: 4ea0. で述べたように) 他の拡張
モジュールとの間で名前が衝突するのを避けるためです。また、他の拡張モジュ
ールからアクセスを '受けるべきではない' シンボルは別のやり方で公開せねば
なりません。

Python はある拡張モジュールの C レベルの情報 (ポインタ) を別のモジュール
に渡すための特殊な機構: Capsule (カプセル)を提供しています。 Capsule は
ポインタ (void*) を記憶する Python のデータ型です。 Capsule は C API を
介してのみ生成したりアクセスしたりできますが、他の Python オブジェクトと
同じように受け渡しできます。とりわけ、Capsule は拡張モジュールの名前空間
内にある名前に代入できます。他の拡張モジュールはこのモジュールを import
でき、次に名前を取得し、最後にCapsule へのポインタを取得します。

拡張モジュールの C API を公開するために、様々な方法で Capsule が使われま
す。各関数を1つのオブジェクトに入れたり、全ての C API のポインタ配列を
Capsule に入れることができます。そして、ポインタに対する保存や取得といっ
た様々な作業は、コードを提供しているモジュールとクライアントモジュールと
の間では異なる方法で分散できます。

どの方法を選ぶにしても、 Capsule の name を正しく設定することは重要です
。 *note PyCapsule_New(): 4ec3. は name 引数 (const char*) を取ります。
‘NULL’ を name に渡すことも許可されていますが、 name を設定することを強
く推奨します。正しく名前を付けられた Capsule はある程度の実行時型安全性
を持ちます。名前を付けられていない Capsule を他の Capsule と区別する現実
的な方法はありません。

特に、 C API を公開するための Capsule には次のルールに従った名前を付ける
べきです:

     modulename.attributename

*note PyCapsule_Import(): 1c10. という便利関数は、 Capsule の名前がこの
ルールに一致しているときにのみ、簡単に Capsule 経由で公開されている C
API をロードすることができます。この挙動により、 C API のユーザーが、確
実に正しい C API を格納している Capsule をロードできたことを確かめること
ができます。

以下の例では、名前を公開するモジュールの作者にほとんどの負荷が掛かります
が、よく使われるライブラリを作る際に適切なアプローチを実演します。このア
プローチでは、全ての C API ポインタ (例中では一つだけですが!)  を、
Capsule の値となる void ポインタの配列に保存します。拡張モジュールに対応
するヘッダファイルは、モジュールの import と C API ポインタを取得するよ
う手配するマクロを提供します; クライアントモジュールは、C API にアクセス
する前にこのマクロを呼ぶだけです。

The exporting module is a modification of the ‘spam’ module from section
*note 簡単な例: 4e94.  The function ‘spam.system()’ does not call the C
library function ‘system()’ directly, but a function ‘PySpam_System()’,
which would of course do something more complicated in reality (such as
adding "spam" to every command).  This function ‘PySpam_System()’ is
also exported to other extension modules.

The function ‘PySpam_System()’ is a plain C function, declared ‘static’
like everything else:

     static int
     PySpam_System(const char *command)
     {
         return system(command);
     }

The function ‘spam_system()’ is modified in a trivial way:

     static PyObject *
     spam_system(PyObject *self, PyObject *args)
     {
         const char *command;
         int sts;

         if (!PyArg_ParseTuple(args, "s", &command))
             return NULL;
         sts = PySpam_System(command);
         return PyLong_FromLong(sts);
     }

モジュールの先頭にある以下の行

     #include <Python.h>

の直後に、以下の二行を必ず追加してください:

     #define SPAM_MODULE
     #include "spammodule.h"

The ‘#define’ is used to tell the header file that it is being included
in the exporting module, not a client module.  Finally, the module's
*note mod_exec: b75. function must take care of initializing the C API
pointer array:

     static int
     spam_module_exec(PyObject *m)
     {
         static void *PySpam_API[PySpam_API_pointers];
         PyObject *c_api_object;

         /* Initialize the C API pointer array */
         PySpam_API[PySpam_System_NUM] = (void *)PySpam_System;

         /* Create a Capsule containing the API pointer array's address */
         c_api_object = PyCapsule_New((void *)PySpam_API, "spam._C_API", NULL);

         if (PyModule_Add(m, "_C_API", c_api_object) < 0) {
             return -1;
         }

         return 0;
     }

Note that ‘PySpam_API’ is declared ‘static’; otherwise the pointer array
would disappear when ‘PyInit_spam()’ terminates!

からくりの大部分はヘッダファイル ‘spammodule.h’ 内にあり、以下のようにな
っています:

     #ifndef Py_SPAMMODULE_H
     #define Py_SPAMMODULE_H
     #ifdef __cplusplus
     extern "C" {
     #endif

     /* Header file for spammodule */

     /* C API functions */
     #define PySpam_System_NUM 0
     #define PySpam_System_RETURN int
     #define PySpam_System_PROTO (const char *command)

     /* Total number of C API pointers */
     #define PySpam_API_pointers 1


     #ifdef SPAM_MODULE
     /* This section is used when compiling spammodule.c */

     static PySpam_System_RETURN PySpam_System PySpam_System_PROTO;

     #else
     /* This section is used in modules that use spammodule's API */

     static void **PySpam_API;

     #define PySpam_System \
      (*(PySpam_System_RETURN (*)PySpam_System_PROTO) PySpam_API[PySpam_System_NUM])

     /* Return -1 on error, 0 on success.
      * PyCapsule_Import will set an exception if there's an error.
      */
     static int
     import_spam(void)
     {
         PySpam_API = (void **)PyCapsule_Import("spam._C_API", 0);
         return (PySpam_API != NULL) ? 0 : -1;
     }

     #endif

     #ifdef __cplusplus
     }
     #endif

     #endif /* !defined(Py_SPAMMODULE_H) */

All that a client module must do in order to have access to the function
‘PySpam_System()’ is to call the function (or rather macro)
‘import_spam()’ in its *note mod_exec: b75. function:

     static int
     client_module_exec(PyObject *m)
     {
         if (import_spam() < 0) {
             return -1;
         }
         /* additional initialization can happen here */
         return 0;
     }

このアプローチの主要な欠点は、 ‘spammodule.h’ がやや難解になるということ
です。とはいえ、各関数の基本的な構成は公開されるものと同じなので、書き方
を一度だけ学べばすみます。

最後に、Capsule は、自身に保存されているポインタをメモリ確保したり解放し
たりする際に特に便利な、もう一つの機能を提供しているということに触れてお
かねばなりません。詳細は Python/C API リファレンスマニュアルの *note
カプセル: 29f3, および Capsule の実装部分 (Python ソースコード配布物中の
ファイル ‘Include/pycapsule.h’ および ‘Objects/pycapsule.c’ に述べられて
います。

脚注
....


File: python.info,  Node: 拡張の型の定義 チュートリアル,  Next: 拡張の型の定義 雑多なトピック,  Prev: C や C++ による Python の拡張,  Up: サードパーティツールなしで拡張を作る

6.2.2 拡張の型の定義: チュートリアル
------------------------------------

Python では、組み込みの *note str: 169. 型や *note list: 24d. 型のような
Python コードから操作できる新しい型を C 拡張モジュールの作者が定義できま
す。 全ての拡張の型のコードはあるパターンに従うのですが、書き始める前に
理解しておくべき細かいことがあります。 このドキュメントはその話題につい
てのやさしい入門です。

* Menu:

* 基本的なこと::
* 基本のサンプルにデータとメソッドを追加する::
* データ属性をこまかく制御する::
* 循環ガベージコレクションをサポートする::
* 他の型のサブクラスを作る::


File: python.info,  Node: 基本的なこと,  Next: 基本のサンプルにデータとメソッドを追加する,  Up: 拡張の型の定義 チュートリアル

6.2.2.1 基本的なこと
....................

*note CPython: 905. ランタイムは Python の全てのオブジェクトを、 Python
の全てのオブジェクトの "基底型 (base type)" である *note PyObject: 5df.*
型の変数と見なします。 *note PyObject: 5df. 構造体自身は *note
参照カウント: 4ec9. と、オブジェクトの "型オブジェクト" へのポインタのみ
を持ちます。ここには動作が定義されています; 型オブジェクトは、例えば、あ
る属性があるオブジェクトから検索されたり、メソッドが呼ばれたり、他のオブ
ジェクトによって操作されたりしたときに、どの (C) 関数がインタープリター
から呼ばれるのかを決定します。これらの C 関数は "型メソッド (type
method)" と呼ばれます。

それなので、新しい拡張の型を定義したいときは、新しい型オブジェクトを作成
すればよいわけです。

この手のことは例を見たほうが早いでしょうから、以下に C 拡張モジュール
‘custom’ にある ‘Custom’ という名前の新しい型を定義する、最小限ながら完
全なモジュールをあげておきます:

     注釈: ここで紹介している例は、 '静的な' 拡張の型を定義する伝統的な
     実装方法です。 これはほとんどの場面で十分なものなのです。 C API で
     は、 *note PyType_FromSpec(): 79d. 関数を使い、ヒープ上に配置された
     拡張の型も定義できますが、これについてはこのチュートリアルでは扱い
     ません。

     #define PY_SSIZE_T_CLEAN
     #include <Python.h>

     typedef struct {
         PyObject_HEAD
         /* Type-specific fields go here. */
     } CustomObject;

     static PyTypeObject CustomType = {
         .ob_base = PyVarObject_HEAD_INIT(NULL, 0)
         .tp_name = "custom.Custom",
         .tp_doc = PyDoc_STR("Custom objects"),
         .tp_basicsize = sizeof(CustomObject),
         .tp_itemsize = 0,
         .tp_flags = Py_TPFLAGS_DEFAULT,
         .tp_new = PyType_GenericNew,
     };

     static int
     custom_module_exec(PyObject *m)
     {
         if (PyType_Ready(&CustomType) < 0) {
             return -1;
         }

         if (PyModule_AddObjectRef(m, "Custom", (PyObject *) &CustomType) < 0) {
             return -1;
         }

         return 0;
     }

     static PyModuleDef_Slot custom_module_slots[] = {
         {Py_mod_exec, custom_module_exec},
         // Just use this while using static types
         {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
         {0, NULL}
     };

     static PyModuleDef custom_module = {
         .m_base = PyModuleDef_HEAD_INIT,
         .m_name = "custom",
         .m_doc = "Example module that creates an extension type.",
         .m_size = 0,
         .m_slots = custom_module_slots,
     };

     PyMODINIT_FUNC
     PyInit_custom(void)
     {
         return PyModuleDef_Init(&custom_module);
     }

一度に把握するにはちょっと量が多いですが、前の章よりはとっつきやすくなっ
ていることと思います。このファイルでは、3つの要素が定義されています:

  1. ‘Custom’ 'オブジェクト' が何を含んでいるか: これが ‘CustomObject’ 構
     造体で、 ‘Custom’ インスタンスごとに1回だけメモリ確保が行われます。

  2. ‘Custom’ '型' がどのように振る舞うか: これが ‘CustomType’ 構造体で
     、フラグと関数ポインタの集まりを定義しています。特定の操作が要求さ
     れたときに、この関数ポインタをインタープリターが見に行きます。

  3. How to define and execute the ‘custom’ module: this is the
     ‘PyInit_custom’ function and the associated ‘custom_module’ struct
     for defining the module, and the ‘custom_module_exec’ function to
     set up a fresh module object.

まず最初はこれです:

     typedef struct {
         PyObject_HEAD
     } CustomObject;

これが Custom オブジェクトの内容です。 ‘PyObject_HEAD’ はそれぞれのオブ
ジェクト構造体の先頭に必須なもので、 *note PyObject: 5df. 型の ‘ob_base’
という名前のフィールドを定義します。 *note PyObject: 5df. 型には (それぞ
れ *note Py_TYPE: 3c9. マクロおよび *note Py_REFCNT: 2cf. マクロからアク
セスできる) 型オブジェクトへのポインタと参照カウントが格納されています。
このマクロが用意されている理由は、構造体のレイアウトを抽象化し、デバッグ
ビルドでフィールドを追加できるようにするためです。

     注釈: 上の例では *note PyObject_HEAD: 14f5. マクロの後にセミコロン
     はありません。 うっかりセミコロンを追加しないように気を付けてくださ
     い: これを警告するコンパイラもあります。

もちろん、一般的にはオブジェクトは標準的な ‘PyObject_HEAD’ ボイラープレ
ートの他にもデータを保持しています; 例えば、これは Python 標準の浮動小数
点数の定義です:

     typedef struct {
         PyObject_HEAD
         double ob_fval;
     } PyFloatObject;

2つ目は型オブジェクトの定義です。

     static PyTypeObject CustomType = {
         .ob_base = PyVarObject_HEAD_INIT(NULL, 0)
         .tp_name = "custom.Custom",
         .tp_doc = PyDoc_STR("Custom objects"),
         .tp_basicsize = sizeof(CustomObject),
         .tp_itemsize = 0,
         .tp_flags = Py_TPFLAGS_DEFAULT,
         .tp_new = PyType_GenericNew,
     };

     注釈: 上にあるように C99 スタイルの指示付き初期化子を使って、 *note
     PyTypeObject: c9c. の特に関心の無いフィールドまで全て並べたり、フィ
     ールドを宣言する順序に気を使ったりせずに済ませるのをお薦めします。

‘object.h’ にある実際の *note PyTypeObject: c9c. の定義には上の定義にあ
るよりももっと多くの *note フィールド: b84. があります。 ここに出てきて
いないフィールドは C コンパイラによってゼロで埋められるので、必要でない
限り明示的には値の指定をしないのが一般的な作法になっています。

一度に1つずつフィールドを取り上げていきましょう:

     .ob_base = PyVarObject_HEAD_INIT(NULL, 0)

この行は、上で触れた ‘ob_base’ フィールドの初期化に必須のボイラープレー
トです。

     .tp_name = "custom.Custom",

実装している型の名前です。 これは、オブジェクトのデフォルトの文字列表現
やエラーメッセージに現れます。例えば次の通りです:

     >>> "" + custom.Custom()
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: can only concatenate str (not "custom.Custom") to str

型の名前が、モジュール名とモジュールにおける型の名前の両方をドットでつな
いだ名前になっていることに注意してください。この場合は、モジュールは
‘custom’ で型は ‘Custom’ なので、型の名前を ‘custom.Custom’ に設定しまし
た。実際のドット付きのインポートパスを使うのは、 *note pydoc: ba. モジュ
ールや *note pickle: ab. モジュールと互換性を持たせるために重要なのです
。

     .tp_basicsize = sizeof(CustomObject),
     .tp_itemsize = 0,

これは、新しい ‘Custom’ インスタンスを作るときに Python が割り当てるべき
メモリがどのくらいなのかを知るためのものです。 *note tp_itemsize: 23bb.
は可変サイズのオブジェクトでのみ使うものなので、サイズが可変でないオブジ
ェクトでは 0 にすべきです。

     注釈: If you want your type to be subclassable from Python, and
     your type has the same *note tp_basicsize: b7e. as its base type,
     you may have problems with multiple inheritance.  A Python subclass
     of your type will have to list your type first in its *note
     __bases__: 16c5, or else it will not be able to call your type's
     *note __new__(): 7a0. method without getting an error.  You can
     avoid this problem by ensuring that your type has a larger value
     for *note tp_basicsize: b7e. than its base type does.  Most of the
     time, this will be true anyway, because either your base type will
     be *note object: c7e, or else you will be adding data members to
     your base type, and therefore increasing its size.

*note Py_TPFLAGS_DEFAULT: 4eca. にクラスフラグを設定します。

     .tp_flags = Py_TPFLAGS_DEFAULT,

すべての型はフラグにこの定数を含めておく必要があります。これは最低でも
Python 3.3 までに定義されているすべてのメンバを許可します。それ以上のメ
ンバが必要なら、対応するフラグの OR をとる必要があります。

この型の docstring は *note tp_doc: 4ecb. に入れます。

     .tp_doc = PyDoc_STR("Custom objects"),

オブジェクトが生成できるように、 *note tp_new: 79f. ハンドラを提供する必
要があります。これは Python のメソッド *note __new__(): 7a0. と同等のも
のですが、明示的に与える必要があります。今の場合では、 API 関数の *note
PyType_GenericNew(): 4ecc. として提供されるデフォルトの実装をそのまま使
えます。

     .tp_new = PyType_GenericNew,

Everything else in the file should be familiar, except for some code in
‘custom_module_exec()’:

     if (PyType_Ready(&CustomType) < 0) {
         return -1;
     }

これは、 ‘NULL’ に初期化された *note ob_type: 4ecd. も含めて、いくつかの
メンバーを適切なデフォルト値で埋めて、 ‘Custom’ 型を初期化します。

     if (PyModule_AddObjectRef(m, "Custom", (PyObject *) &CustomType) < 0) {
         return -1;
     }

これは型をモジュールの辞書に追加します。こうすることで ‘Custom’ クラスの
呼び出しで ‘Custom’ インスタンスが作成できるようになります:

     >>> import custom
     >>> mycustom = custom.Custom()

以上です!残りの作業はビルドだけです; ‘custom.c’ という名前のファイルにこ
こまでのコードを書き込み、

     [build-system]
     requires = ["setuptools"]
     build-backend = "setuptools.build_meta"

     [project]
     name = "custom"
     version = "1"

‘pyproject.toml’ というファイルにこれを書き込み、

     from setuptools import Extension, setup
     setup(ext_modules=[Extension("custom", ["custom.c"])])

そして ‘setup.py’ というファイルにこのように書き込み、そして、以下のよう
に

     $ python -m pip install .

シェルに入力します。これにより、サブディレクトリに ‘custom.so’ が生成さ
れ、インストールされます。これで、 Python を立ち上げて、 ‘import custom’
すると ‘Custom’ オブジェクトで遊べるようになっているはずです。

そんなにむずかしくありません、よね?

もちろん、現在の Custom 型は面白みに欠けています。何もデータを持っていな
いし、何もできません。継承してサブクラスを作ることさえできないのです。


File: python.info,  Node: 基本のサンプルにデータとメソッドを追加する,  Next: データ属性をこまかく制御する,  Prev: 基本的なこと,  Up: 拡張の型の定義 チュートリアル

6.2.2.2 基本のサンプルにデータとメソッドを追加する
..................................................

この基本のサンプルにデータとメソッドを追加してみましょう。ついでに、この
型を基底クラスとしても利用できるようにします。ここでは新しいモジュール
‘custom2’ をつくり、これらの機能を追加します:

     #define PY_SSIZE_T_CLEAN
     #include <Python.h>
     #include <stddef.h> /* for offsetof() */

     typedef struct {
         PyObject_HEAD
         PyObject *first; /* first name */
         PyObject *last;  /* last name */
         int number;
     } CustomObject;

     static void
     Custom_dealloc(PyObject *op)
     {
         CustomObject *self = (CustomObject *) op;
         Py_XDECREF(self->first);
         Py_XDECREF(self->last);
         Py_TYPE(self)->tp_free(self);
     }

     static PyObject *
     Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     {
         CustomObject *self;
         self = (CustomObject *) type->tp_alloc(type, 0);
         if (self != NULL) {
             self->first = Py_GetConstant(Py_CONSTANT_EMPTY_STR);
             if (self->first == NULL) {
                 Py_DECREF(self);
                 return NULL;
             }
             self->last = Py_GetConstant(Py_CONSTANT_EMPTY_STR);
             if (self->last == NULL) {
                 Py_DECREF(self);
                 return NULL;
             }
             self->number = 0;
         }
         return (PyObject *) self;
     }

     static int
     Custom_init(PyObject *op, PyObject *args, PyObject *kwds)
     {
         CustomObject *self = (CustomObject *) op;
         static char *kwlist[] = {"first", "last", "number", NULL};
         PyObject *first = NULL, *last = NULL;

         if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist,
                                          &first, &last,
                                          &self->number))
             return -1;

         if (first) {
             Py_XSETREF(self->first, Py_NewRef(first));
         }
         if (last) {
             Py_XSETREF(self->last, Py_NewRef(last));
         }
         return 0;
     }

     static PyMemberDef Custom_members[] = {
         {"first", Py_T_OBJECT_EX, offsetof(CustomObject, first), 0,
          "first name"},
         {"last", Py_T_OBJECT_EX, offsetof(CustomObject, last), 0,
          "last name"},
         {"number", Py_T_INT, offsetof(CustomObject, number), 0,
          "custom number"},
         {NULL}  /* Sentinel */
     };

     static PyObject *
     Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))
     {
         CustomObject *self = (CustomObject *) op;
         if (self->first == NULL) {
             PyErr_SetString(PyExc_AttributeError, "first");
             return NULL;
         }
         if (self->last == NULL) {
             PyErr_SetString(PyExc_AttributeError, "last");
             return NULL;
         }
         return PyUnicode_FromFormat("%S %S", self->first, self->last);
     }

     static PyMethodDef Custom_methods[] = {
         {"name", Custom_name, METH_NOARGS,
          "Return the name, combining the first and last name"
         },
         {NULL}  /* Sentinel */
     };

     static PyTypeObject CustomType = {
         .ob_base = PyVarObject_HEAD_INIT(NULL, 0)
         .tp_name = "custom2.Custom",
         .tp_doc = PyDoc_STR("Custom objects"),
         .tp_basicsize = sizeof(CustomObject),
         .tp_itemsize = 0,
         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
         .tp_new = Custom_new,
         .tp_init = Custom_init,
         .tp_dealloc = Custom_dealloc,
         .tp_members = Custom_members,
         .tp_methods = Custom_methods,
     };

     static int
     custom_module_exec(PyObject *m)
     {
         if (PyType_Ready(&CustomType) < 0) {
             return -1;
         }

         if (PyModule_AddObjectRef(m, "Custom", (PyObject *) &CustomType) < 0) {
             return -1;
         }

         return 0;
     }

     static PyModuleDef_Slot custom_module_slots[] = {
         {Py_mod_exec, custom_module_exec},
         {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
         {0, NULL}
     };

     static PyModuleDef custom_module = {
         .m_base = PyModuleDef_HEAD_INIT,
         .m_name = "custom2",
         .m_doc = "Example module that creates an extension type.",
         .m_size = 0,
         .m_slots = custom_module_slots,
     };

     PyMODINIT_FUNC
     PyInit_custom2(void)
     {
         return PyModuleDef_Init(&custom_module);
     }

モジュールのこのバージョンでは、いくつもの変更をおこないます。

‘Custom’ 型は そのC構造体に 3つのデータ属性 'first' 、 'last' 、および
'number' をもつようになりました。 'first' と 'last' 属性はファーストネー
ムとラストネームを格納した Python 文字列で、 'number' 属性は C言語での整
数の値です。

これにしたがうと、オブジェクトの構造体は次のようになります:

     typedef struct {
         PyObject_HEAD
         PyObject *first; /* first name */
         PyObject *last;  /* last name */
         int number;
     } CustomObject;

いまや管理すべきデータができたので、オブジェクトの割り当てと解放に際して
はより慎重になる必要があります。最低限、オブジェクトの解放メソッドが必要
です:

     static void
     Custom_dealloc(PyObject *op)
     {
         CustomObject *self = (CustomObject *) op;
         Py_XDECREF(self->first);
         Py_XDECREF(self->last);
         Py_TYPE(self)->tp_free(self);
     }

この関数は *note tp_dealloc: 4ebc. メンバに代入されます。

     .tp_dealloc = Custom_dealloc,

このメソッドは、まず二つのPython 属性の参照カウントをクリアします。
*note Py_XDECREF(): 992. は引数が ‘NULL’ のケースを正しく扱えます (これ
は、‘tp_new’ が途中で失敗した場合に起こりえます) 。このメソッドは、つぎ
にオブジェクトの型 (‘Py_TYPE(self)’ で算出します) のメンバ *note
tp_free: 4ecf. を呼び出し、オブジェクトのメモリを開放します。オブジェク
トの型が ‘CustomType’ であるとは限らない点に注意してください。なぜなら、
オブジェクトはサブクラスのインスタンスかもしれないからです。

     注釈: The explicit cast to ‘CustomObject *’ above is needed because
     we defined ‘Custom_dealloc’ to take a ‘PyObject *’ argument, as the
     ‘tp_dealloc’ function pointer expects to receive a ‘PyObject *’
     argument.  By assigning to the ‘tp_dealloc’ slot of a type, we
     declare that it can only be called with instances of our
     ‘CustomObject’ class, so the cast to ‘(CustomObject *)’ is safe.
     This is object-oriented polymorphism, in C!

     In existing code, or in previous versions of this tutorial, you
     might see similar functions take a pointer to the subtype object
     structure (‘CustomObject*’) directly, like this:

          Custom_dealloc(CustomObject *self)
          {
              Py_XDECREF(self->first);
              Py_XDECREF(self->last);
              Py_TYPE(self)->tp_free((PyObject *) self);
          }
          ...
          .tp_dealloc = (destructor) Custom_dealloc,

     This does the same thing on all architectures that CPython
     supports, but according to the C standard, it invokes undefined
     behavior.

ファーストネームとラストネームを空文字列に初期化しておきたいので、
‘tp_new’ の実装を追加することにしましょう:

     static PyObject *
     Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     {
         CustomObject *self;
         self = (CustomObject *) type->tp_alloc(type, 0);
         if (self != NULL) {
             self->first = PyUnicode_FromString("");
             if (self->first == NULL) {
                 Py_DECREF(self);
                 return NULL;
             }
             self->last = PyUnicode_FromString("");
             if (self->last == NULL) {
                 Py_DECREF(self);
                 return NULL;
             }
             self->number = 0;
         }
         return (PyObject *) self;
     }

そしてこれを *note tp_new: 79f. メンバとしてインストールします:

     .tp_new = Custom_new,

The ‘tp_new’ handler is responsible for creating (as opposed to
initializing) objects of the type.  It is exposed in Python as the *note
__new__(): 7a0. method.  It is not required to define a ‘tp_new’ member,
and indeed many extension types will simply reuse *note
PyType_GenericNew(): 4ecc. as done in the first version of the ‘Custom’
type above.  In this case, we use the ‘tp_new’ handler to initialize the
‘first’ and ‘last’ attributes to non-‘NULL’ default values.

‘tp_new’ is passed the type being instantiated (not necessarily
‘CustomType’, if a subclass is instantiated) and any arguments passed
when the type was called, and is expected to return the instance
created.  ‘tp_new’ handlers always accept positional and keyword
arguments, but they often ignore the arguments, leaving the argument
handling to initializer (a.k.a.  ‘tp_init’ in C or ‘__init__’ in Python)
methods.

     注釈: ‘tp_new’ は明示的に ‘tp_init’ を呼び出してはいけません、これ
     はインタープリタが自分で行うためです。

この ‘tp_new’ の実装は、*note tp_alloc: 4ed0. スロットを呼び出してメモリ
を割り当てます:

     self = (CustomObject *) type->tp_alloc(type, 0);

メモリ割り当ては失敗するかもしれないので、先に進む前に *note tp_alloc:
4ed0. の結果が ‘NULL’ でないかチェックしなければなりません。

     注釈: We didn't fill the *note tp_alloc: 4ed0. slot ourselves.
     Rather *note PyType_Ready(): 980. fills it for us by inheriting it
     from our base class, which is *note object: c7e. by default.  Most
     types use the default allocation strategy.

     注釈: もし協力的な *note tp_new: 79f. (基底タイプの *note tp_new:
     79f. または *note __new__(): 7a0. を呼んでいるもの) を作りたいのな
     らば、実行時のメソッド解決順序をつかってどのメソッドを呼びだすかを
     決定しようとしては 'いけません' 。常に呼び出す型を静的に決めておき
     、直接その *note tp_new: 79f. を呼び出すか、あるいは
     ‘type->tp_base->tp_new’ を経由してください。こうしないと、あなたが
     作成したタイプの Python サブクラスが他の Python で定義されたクラス
     も継承している場合にうまく動かない場合があります。 (とりわけ、その
     ようなサブクラスのインスタンスを *note TypeError: 198. を出さずに作
     ることが不可能になります。)

We also define an initialization function which accepts arguments to
provide initial values for our instance:

     static int
     Custom_init(PyObject *op, PyObject *args, PyObject *kwds)
     {
         CustomObject *self = (CustomObject *) op;
         static char *kwlist[] = {"first", "last", "number", NULL};
         PyObject *first = NULL, *last = NULL, *tmp;

         if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist,
                                          &first, &last,
                                          &self->number))
             return -1;

         if (first) {
             tmp = self->first;
             Py_INCREF(first);
             self->first = first;
             Py_XDECREF(tmp);
         }
         if (last) {
             tmp = self->last;
             Py_INCREF(last);
             self->last = last;
             Py_XDECREF(tmp);
         }
         return 0;
     }

これは *note tp_init: 7a1. メンバに代入されます。

     .tp_init = Custom_init,

The *note tp_init: 7a1. slot is exposed in Python as the *note
__init__(): 8bf. method.  It is used to initialize an object after it's
created.  Initializers always accept positional and keyword arguments,
and they should return either ‘0’ on success or ‘-1’ on error.

Unlike the ‘tp_new’ handler, there is no guarantee that ‘tp_init’ is
called at all (for example, the *note pickle: ab. module by default
doesn't call *note __init__(): 8bf. on unpickled instances).  It can
also be called multiple times.  Anyone can call the ‘__init__()’ method
on our objects.  For this reason, we have to be extra careful when
assigning the new attribute values.  We might be tempted, for example to
assign the ‘first’ member like this:

     if (first) {
         Py_XDECREF(self->first);
         Py_INCREF(first);
         self->first = first;
     }

But this would be risky.  Our type doesn't restrict the type of the
‘first’ member, so it could be any kind of object.  It could have a
destructor that causes code to be executed that tries to access the
‘first’ member; or that destructor could detach the *note thread state:
4ed1. and let arbitrary code run in other threads that accesses and
modifies our object.

To be paranoid and protect ourselves against this possibility, we almost
always reassign members before decrementing their reference counts.
When don't we have to do this?

   * その参照カウントが 1 より大きいと確信できる場合

   * when we know that deallocation of the object (1) will neither
     detach the *note thread state: 4ed1. nor cause any calls back into
     our type's code;

   * when decrementing a reference count in a *note tp_dealloc: 4ebc.
     handler on a type which doesn't support cyclic garbage collection
     (2).

ここではインスタンス変数を属性として見えるようにしたいのですが、これには
いくつもの方法があります。もっとも簡単な方法は、メンバの定義を与えること
です:

     static PyMemberDef Custom_members[] = {
         {"first", Py_T_OBJECT_EX, offsetof(CustomObject, first), 0,
          "first name"},
         {"last", Py_T_OBJECT_EX, offsetof(CustomObject, last), 0,
          "last name"},
         {"number", Py_T_INT, offsetof(CustomObject, number), 0,
          "custom number"},
         {NULL}  /* Sentinel */
     };

そして、この定義を *note tp_members: 4ed2. スロットに入れましょう:

     .tp_members = Custom_members,

Each member definition has a member name, type, offset, access flags and
documentation string.  See the *note 総称的な属性を管理する: 4ed3.
section below for details.

A disadvantage of this approach is that it doesn't provide a way to
restrict the types of objects that can be assigned to the Python
attributes.  We expect the first and last names to be strings, but any
Python objects can be assigned.  Further, the attributes can be deleted,
setting the C pointers to ‘NULL’.  Even though we can make sure the
members are initialized to non-‘NULL’ values, the members can be set to
‘NULL’ if the attributes are deleted.

We define a single method, ‘Custom.name()’, that outputs the objects
name as the concatenation of the first and last names.

     static PyObject *
     Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))
     {
         CustomObject *self = (CustomObject *) op;
         if (self->first == NULL) {
             PyErr_SetString(PyExc_AttributeError, "first");
             return NULL;
         }
         if (self->last == NULL) {
             PyErr_SetString(PyExc_AttributeError, "last");
             return NULL;
         }
         return PyUnicode_FromFormat("%S %S", self->first, self->last);
     }

The method is implemented as a C function that takes a ‘Custom’ (or
‘Custom’ subclass) instance as the first argument.  Methods always take
an instance as the first argument.  Methods often take positional and
keyword arguments as well, but in this case we don't take any and don't
need to accept a positional argument tuple or keyword argument
dictionary.  This method is equivalent to the Python method:

     def name(self):
         return "%s %s" % (self.first, self.last)

Note that we have to check for the possibility that our ‘first’ and
‘last’ members are ‘NULL’.  This is because they can be deleted, in
which case they are set to ‘NULL’.  It would be better to prevent
deletion of these attributes and to restrict the attribute values to be
strings.  We'll see how to do that in the next section.

さて、メソッドを定義したので、ここでメソッド定義用の配列を作成する必要が
あります:

     static PyMethodDef Custom_methods[] = {
         {"name", Custom_name, METH_NOARGS,
          "Return the name, combining the first and last name"
         },
         {NULL}  /* Sentinel */
     };

(note that we used the *note METH_NOARGS: 16ed. flag to indicate that
the method is expecting no arguments other than 'self')

and assign it to the *note tp_methods: 4ed4. slot:

     .tp_methods = Custom_methods,

Finally, we'll make our type usable as a base class for subclassing.
We've written our methods carefully so far so that they don't make any
assumptions about the type of the object being created or used, so all
we need to do is to add the *note Py_TPFLAGS_BASETYPE: 4ed5. to our
class flag definition:

     .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,

We rename ‘PyInit_custom()’ to ‘PyInit_custom2()’, update the module
name in the *note PyModuleDef: b74. struct, and update the full class
name in the *note PyTypeObject: c9c. struct.

Finally, we update our ‘setup.py’ file to include the new module,

     from setuptools import Extension, setup
     setup(ext_modules=[
         Extension("custom", ["custom.c"]),
         Extension("custom2", ["custom2.c"]),
     ])

and then we re-install so that we can ‘import custom2’:

     $ python -m pip install .

   ---------- Footnotes ----------

   (1) これはそのオブジェクトが文字列や実数などの基本タイプであるような
時に成り立ちます。

   (2) We relied on this in the *note tp_dealloc: 4ebc. handler in this
example, because our type doesn't support garbage collection.


File: python.info,  Node: データ属性をこまかく制御する,  Next: 循環ガベージコレクションをサポートする,  Prev: 基本のサンプルにデータとメソッドを追加する,  Up: 拡張の型の定義 チュートリアル

6.2.2.3 データ属性をこまかく制御する
....................................

In this section, we'll provide finer control over how the ‘first’ and
‘last’ attributes are set in the ‘Custom’ example.  In the previous
version of our module, the instance variables ‘first’ and ‘last’ could
be set to non-string values or even deleted.  We want to make sure that
these attributes always contain strings.

     #define PY_SSIZE_T_CLEAN
     #include <Python.h>
     #include <stddef.h> /* for offsetof() */

     typedef struct {
         PyObject_HEAD
         PyObject *first; /* first name */
         PyObject *last;  /* last name */
         int number;
     } CustomObject;

     static void
     Custom_dealloc(PyObject *op)
     {
         CustomObject *self = (CustomObject *) op;
         Py_XDECREF(self->first);
         Py_XDECREF(self->last);
         Py_TYPE(self)->tp_free(self);
     }

     static PyObject *
     Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     {
         CustomObject *self;
         self = (CustomObject *) type->tp_alloc(type, 0);
         if (self != NULL) {
             self->first = Py_GetConstant(Py_CONSTANT_EMPTY_STR);
             if (self->first == NULL) {
                 Py_DECREF(self);
                 return NULL;
             }
             self->last = Py_GetConstant(Py_CONSTANT_EMPTY_STR);
             if (self->last == NULL) {
                 Py_DECREF(self);
                 return NULL;
             }
             self->number = 0;
         }
         return (PyObject *) self;
     }

     static int
     Custom_init(PyObject *op, PyObject *args, PyObject *kwds)
     {
         CustomObject *self = (CustomObject *) op;
         static char *kwlist[] = {"first", "last", "number", NULL};
         PyObject *first = NULL, *last = NULL;

         if (!PyArg_ParseTupleAndKeywords(args, kwds, "|UUi", kwlist,
                                          &first, &last,
                                          &self->number))
             return -1;

         if (first) {
             Py_SETREF(self->first, Py_NewRef(first));
         }
         if (last) {
             Py_SETREF(self->last, Py_NewRef(last));
         }
         return 0;
     }

     static PyMemberDef Custom_members[] = {
         {"number", Py_T_INT, offsetof(CustomObject, number), 0,
          "custom number"},
         {NULL}  /* Sentinel */
     };

     static PyObject *
     Custom_getfirst(PyObject *op, void *closure)
     {
         CustomObject *self = (CustomObject *) op;
         return Py_NewRef(self->first);
     }

     static int
     Custom_setfirst(PyObject *op, PyObject *value, void *closure)
     {
         CustomObject *self = (CustomObject *) op;
         if (value == NULL) {
             PyErr_SetString(PyExc_TypeError, "Cannot delete the first attribute");
             return -1;
         }
         if (!PyUnicode_Check(value)) {
             PyErr_SetString(PyExc_TypeError,
                             "The first attribute value must be a string");
             return -1;
         }
         Py_SETREF(self->first, Py_NewRef(value));
         return 0;
     }

     static PyObject *
     Custom_getlast(PyObject *op, void *closure)
     {
         CustomObject *self = (CustomObject *) op;
         return Py_NewRef(self->last);
     }

     static int
     Custom_setlast(PyObject *op, PyObject *value, void *closure)
     {
         CustomObject *self = (CustomObject *) op;
         if (value == NULL) {
             PyErr_SetString(PyExc_TypeError, "Cannot delete the last attribute");
             return -1;
         }
         if (!PyUnicode_Check(value)) {
             PyErr_SetString(PyExc_TypeError,
                             "The last attribute value must be a string");
             return -1;
         }
         Py_SETREF(self->last, Py_NewRef(value));
         return 0;
     }

     static PyGetSetDef Custom_getsetters[] = {
         {"first", Custom_getfirst, Custom_setfirst,
          "first name", NULL},
         {"last", Custom_getlast, Custom_setlast,
          "last name", NULL},
         {NULL}  /* Sentinel */
     };

     static PyObject *
     Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))
     {
         CustomObject *self = (CustomObject *) op;
         return PyUnicode_FromFormat("%S %S", self->first, self->last);
     }

     static PyMethodDef Custom_methods[] = {
         {"name", Custom_name, METH_NOARGS,
          "Return the name, combining the first and last name"
         },
         {NULL}  /* Sentinel */
     };

     static PyTypeObject CustomType = {
         .ob_base = PyVarObject_HEAD_INIT(NULL, 0)
         .tp_name = "custom3.Custom",
         .tp_doc = PyDoc_STR("Custom objects"),
         .tp_basicsize = sizeof(CustomObject),
         .tp_itemsize = 0,
         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
         .tp_new = Custom_new,
         .tp_init = Custom_init,
         .tp_dealloc = Custom_dealloc,
         .tp_members = Custom_members,
         .tp_methods = Custom_methods,
         .tp_getset = Custom_getsetters,
     };

     static int
     custom_module_exec(PyObject *m)
     {
         if (PyType_Ready(&CustomType) < 0) {
             return -1;
         }

         if (PyModule_AddObjectRef(m, "Custom", (PyObject *) &CustomType) < 0) {
             return -1;
         }

         return 0;
     }

     static PyModuleDef_Slot custom_module_slots[] = {
         {Py_mod_exec, custom_module_exec},
         {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
         {0, NULL}
     };

     static PyModuleDef custom_module = {
         .m_base = PyModuleDef_HEAD_INIT,
         .m_name = "custom3",
         .m_doc = "Example module that creates an extension type.",
         .m_size = 0,
         .m_slots = custom_module_slots,
     };

     PyMODINIT_FUNC
     PyInit_custom3(void)
     {
         return PyModuleDef_Init(&custom_module);
     }

To provide greater control, over the ‘first’ and ‘last’ attributes,
we'll use custom getter and setter functions.  Here are the functions
for getting and setting the ‘first’ attribute:

     static PyObject *
     Custom_getfirst(PyObject *op, void *closure)
     {
         CustomObject *self = (CustomObject *) op;
         Py_INCREF(self->first);
         return self->first;
     }

     static int
     Custom_setfirst(PyObject *op, PyObject *value, void *closure)
     {
         CustomObject *self = (CustomObject *) op;
         PyObject *tmp;
         if (value == NULL) {
             PyErr_SetString(PyExc_TypeError, "Cannot delete the first attribute");
             return -1;
         }
         if (!PyUnicode_Check(value)) {
             PyErr_SetString(PyExc_TypeError,
                             "The first attribute value must be a string");
             return -1;
         }
         tmp = self->first;
         Py_INCREF(value);
         self->first = value;
         Py_DECREF(tmp);
         return 0;
     }

The getter function is passed a ‘Custom’ object and a "closure", which
is a void pointer.  In this case, the closure is ignored.  (The closure
supports an advanced usage in which definition data is passed to the
getter and setter.  This could, for example, be used to allow a single
set of getter and setter functions that decide the attribute to get or
set based on data in the closure.)

The setter function is passed the ‘Custom’ object, the new value, and
the closure.  The new value may be ‘NULL’, in which case the attribute
is being deleted.  In our setter, we raise an error if the attribute is
deleted or if its new value is not a string.

ここでは *note PyGetSetDef: db2. 構造体の配列をつくります:

     static PyGetSetDef Custom_getsetters[] = {
         {"first", Custom_getfirst, Custom_setfirst,
          "first name", NULL},
         {"last", Custom_getlast, Custom_setlast,
          "last name", NULL},
         {NULL}  /* Sentinel */
     };

そしてこれを *note tp_getset: 4ed7. スロットに登録します:

     .tp_getset = Custom_getsetters,

The last item in a *note PyGetSetDef: db2. structure is the "closure"
mentioned above.  In this case, we aren't using a closure, so we just
pass ‘NULL’.

また、メンバ定義からはこれらの属性を除いておきましょう:

     static PyMemberDef Custom_members[] = {
         {"number", Py_T_INT, offsetof(CustomObject, number), 0,
          "custom number"},
         {NULL}  /* Sentinel */
     };

また、ここでは *note tp_init: 7a1. ハンドラも渡されるものとして文字列の
みを許可するように修正する必要があります (1):

     static int
     Custom_init(PyObject *op, PyObject *args, PyObject *kwds)
     {
         CustomObject *self = (CustomObject *) op;
         static char *kwlist[] = {"first", "last", "number", NULL};
         PyObject *first = NULL, *last = NULL, *tmp;

         if (!PyArg_ParseTupleAndKeywords(args, kwds, "|UUi", kwlist,
                                          &first, &last,
                                          &self->number))
             return -1;

         if (first) {
             tmp = self->first;
             Py_INCREF(first);
             self->first = first;
             Py_DECREF(tmp);
         }
         if (last) {
             tmp = self->last;
             Py_INCREF(last);
             self->last = last;
             Py_DECREF(tmp);
         }
         return 0;
     }

With these changes, we can assure that the ‘first’ and ‘last’ members
are never ‘NULL’ so we can remove checks for ‘NULL’ values in almost all
cases.  This means that most of the *note Py_XDECREF(): 992. calls can
be converted to *note Py_DECREF(): 790. calls.  The only place we can't
change these calls is in the ‘tp_dealloc’ implementation, where there is
the possibility that the initialization of these members failed in
‘tp_new’.

さて、先ほどもしたように、このモジュール初期化関数と初期化関数内にあるモ
ジュール名を変更しましょう。そして ‘setup.py’ ファイルに追加の定義をくわ
えます。

   ---------- Footnotes ----------

   (1) We now know that the first and last members are strings, so
perhaps we could be less careful about decrementing their reference
counts, however, we accept instances of string subclasses.  Even though
deallocating normal strings won't call back into our objects, we can't
guarantee that deallocating an instance of a string subclass won't call
back into our objects.


File: python.info,  Node: 循環ガベージコレクションをサポートする,  Next: 他の型のサブクラスを作る,  Prev: データ属性をこまかく制御する,  Up: 拡張の型の定義 チュートリアル

6.2.2.4 循環ガベージコレクションをサポートする
..............................................

Python は *note 循環ガベージコレクタ (GC) 機能: 17d8. をもっており、これ
は不要なオブジェクトを、たとえ参照カウントがゼロでなくても発見することが
できます。そのような状況はオブジェクトの参照が循環しているときに起こりえ
ます。たとえば以下の例を考えてください:

     >>> l = []
     >>> l.append(l)
     >>> del l

この例では、自分自身をふくむリストを作りました。たとえこのリストを 削除
しても、それは自分自身への参照をまだ持ちつづけますから、参照カウントはゼ
ロにはなりません。嬉しいことに Python には循環ガベージコレクタは最終的に
はこのリストが不要であることを検出し、解放できます。

In the second version of the ‘Custom’ example, we allowed any kind of
object to be stored in the ‘first’ or ‘last’ attributes (1).  Besides,
in the second and third versions, we allowed subclassing ‘Custom’, and
subclasses may add arbitrary attributes.  For any of those two reasons,
‘Custom’ objects can participate in cycles:

     >>> import custom3
     >>> class Derived(custom3.Custom): pass
     ...
     >>> n = Derived()
     >>> n.some_attribute = n

To allow a ‘Custom’ instance participating in a reference cycle to be
properly detected and collected by the cyclic GC, our ‘Custom’ type
needs to fill two additional slots and to enable a flag that enables
these slots:

     #define PY_SSIZE_T_CLEAN
     #include <Python.h>
     #include <stddef.h> /* for offsetof() */

     typedef struct {
         PyObject_HEAD
         PyObject *first; /* first name */
         PyObject *last;  /* last name */
         int number;
     } CustomObject;

     static int
     Custom_traverse(PyObject *op, visitproc visit, void *arg)
     {
         CustomObject *self = (CustomObject *) op;
         Py_VISIT(self->first);
         Py_VISIT(self->last);
         return 0;
     }

     static int
     Custom_clear(PyObject *op)
     {
         CustomObject *self = (CustomObject *) op;
         Py_CLEAR(self->first);
         Py_CLEAR(self->last);
         return 0;
     }

     static void
     Custom_dealloc(PyObject *op)
     {
         PyObject_GC_UnTrack(op);
         (void)Custom_clear(op);
         Py_TYPE(op)->tp_free(op);
     }

     static PyObject *
     Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     {
         CustomObject *self;
         self = (CustomObject *) type->tp_alloc(type, 0);
         if (self != NULL) {
             self->first = Py_GetConstant(Py_CONSTANT_EMPTY_STR);
             if (self->first == NULL) {
                 Py_DECREF(self);
                 return NULL;
             }
             self->last = Py_GetConstant(Py_CONSTANT_EMPTY_STR);
             if (self->last == NULL) {
                 Py_DECREF(self);
                 return NULL;
             }
             self->number = 0;
         }
         return (PyObject *) self;
     }

     static int
     Custom_init(PyObject *op, PyObject *args, PyObject *kwds)
     {
         CustomObject *self = (CustomObject *) op;
         static char *kwlist[] = {"first", "last", "number", NULL};
         PyObject *first = NULL, *last = NULL;

         if (!PyArg_ParseTupleAndKeywords(args, kwds, "|UUi", kwlist,
                                          &first, &last,
                                          &self->number))
             return -1;

         if (first) {
             Py_SETREF(self->first, Py_NewRef(first));
         }
         if (last) {
             Py_SETREF(self->last, Py_NewRef(last));
         }
         return 0;
     }

     static PyMemberDef Custom_members[] = {
         {"number", Py_T_INT, offsetof(CustomObject, number), 0,
          "custom number"},
         {NULL}  /* Sentinel */
     };

     static PyObject *
     Custom_getfirst(PyObject *op, void *closure)
     {
         CustomObject *self = (CustomObject *) op;
         return Py_NewRef(self->first);
     }

     static int
     Custom_setfirst(PyObject *op, PyObject *value, void *closure)
     {
         CustomObject *self = (CustomObject *) op;
         if (value == NULL) {
             PyErr_SetString(PyExc_TypeError, "Cannot delete the first attribute");
             return -1;
         }
         if (!PyUnicode_Check(value)) {
             PyErr_SetString(PyExc_TypeError,
                             "The first attribute value must be a string");
             return -1;
         }
         Py_XSETREF(self->first, Py_NewRef(value));
         return 0;
     }

     static PyObject *
     Custom_getlast(PyObject *op, void *closure)
     {
         CustomObject *self = (CustomObject *) op;
         return Py_NewRef(self->last);
     }

     static int
     Custom_setlast(PyObject *op, PyObject *value, void *closure)
     {
         CustomObject *self = (CustomObject *) op;
         if (value == NULL) {
             PyErr_SetString(PyExc_TypeError, "Cannot delete the last attribute");
             return -1;
         }
         if (!PyUnicode_Check(value)) {
             PyErr_SetString(PyExc_TypeError,
                             "The last attribute value must be a string");
             return -1;
         }
         Py_XSETREF(self->last, Py_NewRef(value));
         return 0;
     }

     static PyGetSetDef Custom_getsetters[] = {
         {"first", Custom_getfirst, Custom_setfirst,
          "first name", NULL},
         {"last", Custom_getlast, Custom_setlast,
          "last name", NULL},
         {NULL}  /* Sentinel */
     };

     static PyObject *
     Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))
     {
         CustomObject *self = (CustomObject *) op;
         return PyUnicode_FromFormat("%S %S", self->first, self->last);
     }

     static PyMethodDef Custom_methods[] = {
         {"name", Custom_name, METH_NOARGS,
          "Return the name, combining the first and last name"
         },
         {NULL}  /* Sentinel */
     };

     static PyTypeObject CustomType = {
         .ob_base = PyVarObject_HEAD_INIT(NULL, 0)
         .tp_name = "custom4.Custom",
         .tp_doc = PyDoc_STR("Custom objects"),
         .tp_basicsize = sizeof(CustomObject),
         .tp_itemsize = 0,
         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
         .tp_new = Custom_new,
         .tp_init = Custom_init,
         .tp_dealloc = Custom_dealloc,
         .tp_traverse = Custom_traverse,
         .tp_clear = Custom_clear,
         .tp_members = Custom_members,
         .tp_methods = Custom_methods,
         .tp_getset = Custom_getsetters,
     };

     static int
     custom_module_exec(PyObject *m)
     {
         if (PyType_Ready(&CustomType) < 0) {
             return -1;
         }

         if (PyModule_AddObjectRef(m, "Custom", (PyObject *) &CustomType) < 0) {
             return -1;
         }

         return 0;
     }

     static PyModuleDef_Slot custom_module_slots[] = {
         {Py_mod_exec, custom_module_exec},
         {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
         {0, NULL}
     };

     static PyModuleDef custom_module = {
         .m_base = PyModuleDef_HEAD_INIT,
         .m_name = "custom4",
         .m_doc = "Example module that creates an extension type.",
         .m_size = 0,
         .m_slots = custom_module_slots,
     };

     PyMODINIT_FUNC
     PyInit_custom4(void)
     {
         return PyModuleDef_Init(&custom_module);
     }

First, the traversal method lets the cyclic GC know about subobjects
that could participate in cycles:

     static int
     Custom_traverse(PyObject *op, visitproc visit, void *arg)
     {
         CustomObject *self = (CustomObject *) op;
         int vret;
         if (self->first) {
             vret = visit(self->first, arg);
             if (vret != 0)
                 return vret;
         }
         if (self->last) {
             vret = visit(self->last, arg);
             if (vret != 0)
                 return vret;
         }
         return 0;
     }

For each subobject that can participate in cycles, we need to call the
‘visit()’ function, which is passed to the traversal method.  The
‘visit()’ function takes as arguments the subobject and the extra
argument 'arg' passed to the traversal method.  It returns an integer
value that must be returned if it is non-zero.

Python provides a *note Py_VISIT(): 4ed9. macro that automates calling
visit functions.  With *note Py_VISIT(): 4ed9, we can minimize the
amount of boilerplate in ‘Custom_traverse’:

     static int
     Custom_traverse(PyObject *op, visitproc visit, void *arg)
     {
         CustomObject *self = (CustomObject *) op;
         Py_VISIT(self->first);
         Py_VISIT(self->last);
         return 0;
     }

     注釈: The *note tp_traverse: 982. implementation must name its
     arguments exactly 'visit' and 'arg' in order to use *note
     Py_VISIT(): 4ed9.

Second, we need to provide a method for clearing any subobjects that can
participate in cycles:

     static int
     Custom_clear(PyObject *op)
     {
         CustomObject *self = (CustomObject *) op;
         Py_CLEAR(self->first);
         Py_CLEAR(self->last);
         return 0;
     }

Notice the use of the *note Py_CLEAR(): 798. macro.  It is the
recommended and safe way to clear data attributes of arbitrary types
while decrementing their reference counts.  If you were to call *note
Py_XDECREF(): 992. instead on the attribute before setting it to ‘NULL’,
there is a possibility that the attribute's destructor would call back
into code that reads the attribute again ('especially' if there is a
reference cycle).

     注釈: You could emulate *note Py_CLEAR(): 798. by writing:

          PyObject *tmp;
          tmp = self->first;
          self->first = NULL;
          Py_XDECREF(tmp);

     Nevertheless, it is much easier and less error-prone to always use
     *note Py_CLEAR(): 798. when deleting an attribute.  Don't try to
     micro-optimize at the expense of robustness!

The deallocator ‘Custom_dealloc’ may call arbitrary code when clearing
attributes.  It means the circular GC can be triggered inside the
function.  Since the GC assumes reference count is not zero, we need to
untrack the object from the GC by calling *note PyObject_GC_UnTrack():
171e. before clearing members.  Here is our reimplemented deallocator
using *note PyObject_GC_UnTrack(): 171e. and ‘Custom_clear’:

     static void
     Custom_dealloc(PyObject *op)
     {
         PyObject_GC_UnTrack(op);
         (void)Custom_clear(op);
         Py_TYPE(op)->tp_free(op);
     }

Finally, we add the *note Py_TPFLAGS_HAVE_GC: 981. flag to the class
flags:

     .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,

これで完了です。 *note tp_alloc: 4ed0. スロットまたは *note tp_free:
4ecf. ハンドラが書かれていれば、それらを循環ガベージコレクションに使える
よう修正すればよいのです。ほとんどの拡張機能は自動的に提供されるバージョ
ンを使うでしょう。

   ---------- Footnotes ----------

   (1) Also, even with our attributes restricted to strings instances,
the user could pass arbitrary *note str: 169. subclasses and therefore
still create reference cycles.


File: python.info,  Node: 他の型のサブクラスを作る,  Prev: 循環ガベージコレクションをサポートする,  Up: 拡張の型の定義 チュートリアル

6.2.2.5 他の型のサブクラスを作る
................................

既存の型を継承した新しい拡張型を作成することができます。組み込み型から継
承するのは特に簡単です。必要な *note PyTypeObject: c9c. を簡単に利用でき
るからです。それに比べて、 *note PyTypeObject: c9c. 構造体を拡張モジュー
ル間で共有するのは難しいです。

In this example we will create a ‘SubList’ type that inherits from the
built-in *note list: 24d. type.  The new type will be completely
compatible with regular lists, but will have an additional ‘increment()’
method that increases an internal counter:

     >>> import sublist
     >>> s = sublist.SubList(range(3))
     >>> s.extend(s)
     >>> print(len(s))
     6
     >>> print(s.increment())
     1
     >>> print(s.increment())
     2

     #define PY_SSIZE_T_CLEAN
     #include <Python.h>

     typedef struct {
         PyListObject list;
         int state;
     } SubListObject;

     static PyObject *
     SubList_increment(PyObject *op, PyObject *Py_UNUSED(dummy))
     {
         SubListObject *self = (SubListObject *) op;
         self->state++;
         return PyLong_FromLong(self->state);
     }

     static PyMethodDef SubList_methods[] = {
         {"increment", SubList_increment, METH_NOARGS,
          PyDoc_STR("increment state counter")},
         {NULL},
     };

     static int
     SubList_init(PyObject *op, PyObject *args, PyObject *kwds)
     {
         SubListObject *self = (SubListObject *) op;
         if (PyList_Type.tp_init(op, args, kwds) < 0)
             return -1;
         self->state = 0;
         return 0;
     }

     static PyTypeObject SubListType = {
         .ob_base = PyVarObject_HEAD_INIT(NULL, 0)
         .tp_name = "sublist.SubList",
         .tp_doc = PyDoc_STR("SubList objects"),
         .tp_basicsize = sizeof(SubListObject),
         .tp_itemsize = 0,
         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
         .tp_init = SubList_init,
         .tp_methods = SubList_methods,
     };

     static int
     sublist_module_exec(PyObject *m)
     {
         SubListType.tp_base = &PyList_Type;
         if (PyType_Ready(&SubListType) < 0) {
             return -1;
         }

         if (PyModule_AddObjectRef(m, "SubList", (PyObject *) &SubListType) < 0) {
             return -1;
         }

         return 0;
     }

     static PyModuleDef_Slot sublist_module_slots[] = {
         {Py_mod_exec, sublist_module_exec},
         {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
         {0, NULL}
     };

     static PyModuleDef sublist_module = {
         .m_base = PyModuleDef_HEAD_INIT,
         .m_name = "sublist",
         .m_doc = "Example module that creates an extension type.",
         .m_size = 0,
         .m_slots = sublist_module_slots,
     };

     PyMODINIT_FUNC
     PyInit_sublist(void)
     {
         return PyModuleDef_Init(&sublist_module);
     }

As you can see, the source code closely resembles the ‘Custom’ examples
in previous sections.  We will break down the main differences between
them.

     typedef struct {
         PyListObject list;
         int state;
     } SubListObject;

The primary difference for derived type objects is that the base type's
object structure must be the first value.  The base type will already
include the *note PyObject_HEAD(): 14f5. at the beginning of its
structure.

When a Python object is a ‘SubList’ instance, its ‘PyObject *’ pointer
can be safely cast to both ‘PyListObject *’ and ‘SubListObject *’:

     static int
     SubList_init(PyObject *op, PyObject *args, PyObject *kwds)
     {
         SubListObject *self = (SubListObject *) op;
         if (PyList_Type.tp_init(op, args, kwds) < 0)
             return -1;
         self->state = 0;
         return 0;
     }

We see above how to call through to the *note __init__(): 8bf. method of
the base type.

This pattern is important when writing a type with custom *note tp_new:
79f. and *note tp_dealloc: 4ebc. members.  The *note tp_new: 79f.
handler should not actually create the memory for the object with its
*note tp_alloc: 4ed0, but let the base class handle it by calling its
own *note tp_new: 79f.

The *note PyTypeObject: c9c. struct supports a *note tp_base: 2375.
specifying the type's concrete base class.  Due to cross-platform
compiler issues, you can't fill that field directly with a reference to
*note PyList_Type: 4edb.; it should be done in the *note Py_mod_exec:
b75. function:

     static int
     sublist_module_exec(PyObject *m)
     {
         SubListType.tp_base = &PyList_Type;
         if (PyType_Ready(&SubListType) < 0) {
             return -1;
         }

         if (PyModule_AddObjectRef(m, "SubList", (PyObject *) &SubListType) < 0) {
             return -1;
         }

         return 0;
     }

‘PyType_Read()’ を呼ぶ前に、型の構造体の *note tp_base: 2375. スロットは
埋められていなければなりません。既存の型を継承する際には、 *note
tp_alloc: 4ed0. スロットを *note PyType_GenericNew(): 4ecc. で埋める必要
はありません。 - 基底型のアロケーション関数が継承されます。

After that, calling *note PyType_Ready(): 980. and adding the type
object to the module is the same as with the basic ‘Custom’ examples.

脚注
....


File: python.info,  Node: 拡張の型の定義 雑多なトピック,  Next: C および C++ 拡張のビルド,  Prev: 拡張の型の定義 チュートリアル,  Up: サードパーティツールなしで拡張を作る

6.2.3 拡張の型の定義: 雑多なトピック
------------------------------------

この節ではさまざまな実装可能なタイプメソッドと、それらが何をするものであ
るかについて、ざっと説明します。

以下は *note PyTypeObject: c9c. の定義です。 *note デバッグビルド: 509.
でしか使われないいくつかのメンバは省いてあります:

     typedef struct _typeobject {
         PyObject_VAR_HEAD
         const char *tp_name; /* For printing, in format "<module>.<name>" */
         Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */

         /* Methods to implement standard operations */

         destructor tp_dealloc;
         Py_ssize_t tp_vectorcall_offset;
         getattrfunc tp_getattr;
         setattrfunc tp_setattr;
         PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2)
                                         or tp_reserved (Python 3) */
         reprfunc tp_repr;

         /* Method suites for standard classes */

         PyNumberMethods *tp_as_number;
         PySequenceMethods *tp_as_sequence;
         PyMappingMethods *tp_as_mapping;

         /* More standard operations (here for binary compatibility) */

         hashfunc tp_hash;
         ternaryfunc tp_call;
         reprfunc tp_str;
         getattrofunc tp_getattro;
         setattrofunc tp_setattro;

         /* Functions to access object as input/output buffer */
         PyBufferProcs *tp_as_buffer;

         /* Flags to define presence of optional/expanded features */
         unsigned long tp_flags;

         const char *tp_doc; /* Documentation string */

         /* Assigned meaning in release 2.0 */
         /* call function for all accessible objects */
         traverseproc tp_traverse;

         /* delete references to contained objects */
         inquiry tp_clear;

         /* Assigned meaning in release 2.1 */
         /* rich comparisons */
         richcmpfunc tp_richcompare;

         /* weak reference enabler */
         Py_ssize_t tp_weaklistoffset;

         /* Iterators */
         getiterfunc tp_iter;
         iternextfunc tp_iternext;

         /* Attribute descriptor and subclassing stuff */
         PyMethodDef *tp_methods;
         PyMemberDef *tp_members;
         PyGetSetDef *tp_getset;
         // Strong reference on a heap type, borrowed reference on a static type
         PyTypeObject *tp_base;
         PyObject *tp_dict;
         descrgetfunc tp_descr_get;
         descrsetfunc tp_descr_set;
         Py_ssize_t tp_dictoffset;
         initproc tp_init;
         allocfunc tp_alloc;
         newfunc tp_new;
         freefunc tp_free; /* Low-level free-memory routine */
         inquiry tp_is_gc; /* For PyObject_IS_GC */
         PyObject *tp_bases;
         PyObject *tp_mro; /* method resolution order */
         PyObject *tp_cache; /* no longer used */
         void *tp_subclasses;  /* for static builtin types this is an index */
         PyObject *tp_weaklist; /* not used for static builtin types */
         destructor tp_del;

         /* Type attribute cache version tag. Added in version 2.6.
          * If zero, the cache is invalid and must be initialized.
          */
         unsigned int tp_version_tag;

         destructor tp_finalize;
         vectorcallfunc tp_vectorcall;

         /* bitset of which type-watchers care about this type */
         unsigned char tp_watched;

         /* Number of tp_version_tag values used.
          * Set to _Py_ATTR_CACHE_UNUSED if the attribute cache is
          * disabled for this type (e.g. due to custom MRO entries).
          * Otherwise, limited to MAX_VERSIONS_PER_CLASS (defined elsewhere).
          */
         uint16_t tp_versions_used;
     } PyTypeObject;

'たくさんの' メソッドがありますね。でもそんなに心配する必要はありません
。定義したい型があるなら、実装するのはこのうちのごくわずかですむことがほ
とんどです。

すでに予想されているでしょうが、この構造体について入念に見ていき、様々な
ハンドラについてより詳しい情報を提供します。 しかしこれらのメンバが構造
体中で定義されている順番は無視します。というのは、これらのメンバの現れる
順序は歴史的な遺産によるものだからです。 多くの場合いちばん簡単なのは、
必要とするメンバがすべて含まれている例をとってきて、新しく作る型に合わせ
て値を変更することです。

     const char *tp_name; /* For printing */

これは型の名前です。前の章で説明したように、これは色々な場面で現れ、ほと
んどは診断目的で使われるものです。 それなので、そのような場面で役に立つ
であろう名前を選んでください!

     Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */

これらのフィールドは、この型のオブジェクトが新しく作成されるときにどれだ
けのメモリを割り当てればよいのかをランタイムに指示します。Python には可
変長の構造体 (文字列やタプルなどを想像してください) に対する組み込みのサ
ポートがある程度あり、ここで *note tp_itemsize: 23bb. メンバが使われます
。これらについてはあとでふれます。

     const char *tp_doc;

ここには Python スクリプトリファレンス ‘obj.__doc__’ が doc string を返
すときの文字列 (あるいはそのアドレス) を入れます。

では次に、型の基本的なメソッドに進みます。ほとんどの拡張の型がこのメソッ
ドを実装します。

* Menu:

* ファイナライズとメモリ解放::
* オブジェクト表現::
* 属性を管理する::
* オブジェクトの比較::
* 抽象的なプロトコルのサポート::
* 弱参照(Weak Reference)のサポート: 弱参照 Weak Reference のサポート.
* その他いろいろ::


File: python.info,  Node: ファイナライズとメモリ解放,  Next: オブジェクト表現,  Up: 拡張の型の定義 雑多なトピック

6.2.3.1 ファイナライズとメモリ解放
..................................

     destructor tp_dealloc;

型のインスタンスの参照カウントがゼロになり、Python インタプリタがそれを
潰して再利用したくなると、この関数が呼ばれます。解放すべきメモリをその型
が保持していたり、それ以外にも実行すべき後処理がある場合は、それらをここ
に入れられます。オブジェクトそれ自体もここで解放される必要があります。こ
の関数の例は、以下のようなものです:

     static void
     newdatatype_dealloc(PyObject *op)
     {
         newdatatypeobject *self = (newdatatypeobject *) op;
         free(self->obj_UnderlyingDatatypePtr);
         Py_TYPE(self)->tp_free(self);
     }

If your type supports garbage collection, the destructor should call
*note PyObject_GC_UnTrack(): 171e. before clearing any member fields:

     static void
     newdatatype_dealloc(PyObject *op)
     {
         newdatatypeobject *self = (newdatatypeobject *) op;
         PyObject_GC_UnTrack(op);
         Py_CLEAR(self->other_obj);
         ...
         Py_TYPE(self)->tp_free(self);
     }

メモリ解放関数でひとつ重要なのは、処理待ちの例外にいっさい手をつけないこ
とです。なぜなら、解放用の関数は Python インタプリタがスタックを元の状態
に戻すときに呼ばれることが多いからです。そして (通常の関数からの復帰でな
く) 例外のためにスタックが巻き戻されるときは、すでに発生している例外から
メモリ解放関数を守るものはありません。解放用の関数がおこなう動作が追加の
Python のコードを実行してしまうと、それらは例外が発生していることを検知
するかもしれません。これはインタプリタが誤解させるエラーを発生させること
につながります。これを防ぐ正しい方法は、安全でない操作を実行する前に処理
待ちの例外を保存しておき、終わったらそれを元に戻すことです。これは *note
PyErr_Fetch(): 428. および *note PyErr_Restore(): 42b. 関数を使うことに
よって可能になります:

     static void
     my_dealloc(PyObject *obj)
     {
         MyObject *self = (MyObject *) obj;
         PyObject *cbresult;

         if (self->my_callback != NULL) {
             PyObject *err_type, *err_value, *err_traceback;

             /* This saves the current exception state */
             PyErr_Fetch(&err_type, &err_value, &err_traceback);

             cbresult = PyObject_CallNoArgs(self->my_callback);
             if (cbresult == NULL) {
                PyErr_WriteUnraisable(self->my_callback);
             }
             else {
                 Py_DECREF(cbresult);
             }

             /* This restores the saved exception state */
             PyErr_Restore(err_type, err_value, err_traceback);

             Py_DECREF(self->my_callback);
         }
         Py_TYPE(self)->tp_free(self);
     }

     注釈: メモリ解放関数の中で安全に行えることにはいくつか制限がありま
     す。 1つ目は、その型が (*note tp_traverse: 982. および *note
     tp_clear: 4ee2. を使って) ガベージコレクションをサポートしている場
     合、 *note tp_dealloc: 4ebc. が呼び出されるまでに、消去されファイナ
     ライズされてしまうオブジェクトのメンバーが有り得ることです。 2つ目
     は、 *note tp_dealloc: 4ebc. の中ではオブジェクトは不安定な状態にあ
     ることです: つまり参照カウントが0であるということです。 (上の例にあ
     るような) 複雑なオブジェクトや API の呼び出しでは、 *note
     tp_dealloc: 4ebc. を再度呼び出し、二重解放からクラッシュすることに
     なるかもしれません。

     Python 3.4 からは、複雑なファイナライズのコードは *note tp_dealloc:
     4ebc. に置かず、代わりに新しく導入された *note tp_finalize: c9d. と
     いう型メソッドを使うことが推奨されています。

     参考
     ....

     PEP 442(1) で新しいファイナライズの仕組みが説明されています。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0442/


File: python.info,  Node: オブジェクト表現,  Next: 属性を管理する,  Prev: ファイナライズとメモリ解放,  Up: 拡張の型の定義 雑多なトピック

6.2.3.2 オブジェクト表現
........................

Python では、オブジェクトの文字列表現を生成するのに 2つのやり方がありま
す: *note repr(): 1c1. 関数を使う方法と、 *note str(): 169. 関数を使う方
法です。 (*note print(): 1177. 関数は単に *note str(): 169. を呼び出しま
す。) これらのハンドラはどちらも省略できます。

     reprfunc tp_repr;
     reprfunc tp_str;

*note tp_repr: 4ee4. ハンドラは呼び出されたインスタンスの文字列表現を格
納した文字列オブジェクトを返す必要があります。簡単な例は以下のようなもの
です:

     static PyObject *
     newdatatype_repr(PyObject *op)
     {
         newdatatypeobject *self = (newdatatypeobject *) op;
         return PyUnicode_FromFormat("Repr-ified_newdatatype{{size:%d}}",
                                     self->obj_UnderlyingDatatypePtr->size);
     }

If no *note tp_repr: 4ee4. handler is specified, the interpreter will
supply a representation that uses the type's *note tp_name: 1cb0. and a
uniquely identifying value for the object.

*note tp_str: 4ee5. ハンドラと *note str(): 169. の関係は、上の *note
tp_repr: 4ee4. ハンドラと *note repr(): 1c1. の関係に相当します。つまり
、これは Python のコードがオブジェクトのインスタンスに対して *note
str(): 169. を呼び出したときに呼ばれます。この関数の実装は *note
tp_repr: 4ee4. ハンドラのそれと非常に似ていますが、得られる文字列表現は
人間が読むことを意図されています。 *note tp_str: 4ee5. が指定されていな
い場合、かわりに *note tp_repr: 4ee4. ハンドラが使われます。

以下は簡単な例です:

     static PyObject *
     newdatatype_str(PyObject *op)
     {
         newdatatypeobject *self = (newdatatypeobject *) op;
         return PyUnicode_FromFormat("Stringified_newdatatype{{size:%d}}",
                                     self->obj_UnderlyingDatatypePtr->size);
     }


File: python.info,  Node: 属性を管理する,  Next: オブジェクトの比較,  Prev: オブジェクト表現,  Up: 拡張の型の定義 雑多なトピック

6.2.3.3 属性を管理する
......................

For every object which can support attributes, the corresponding type
must provide the functions that control how the attributes are resolved.
There needs to be a function which can retrieve attributes (if any are
defined), and another to set attributes (if setting attributes is
allowed).  Removing an attribute is a special case, for which the new
value passed to the handler is ‘NULL’.

Python supports two pairs of attribute handlers; a type that supports
attributes only needs to implement the functions for one pair.  The
difference is that one pair takes the name of the attribute as a char*,
while the other accepts a *note PyObject: 5df.*.  Each type can use
whichever pair makes more sense for the implementation's convenience.

     getattrfunc  tp_getattr;        /* char * version */
     setattrfunc  tp_setattr;
     /* ... */
     getattrofunc tp_getattro;       /* PyObject * version */
     setattrofunc tp_setattro;

If accessing attributes of an object is always a simple operation (this
will be explained shortly), there are generic implementations which can
be used to provide the *note PyObject: 5df.* version of the attribute
management functions.  The actual need for type-specific attribute
handlers almost completely disappeared starting with Python 2.2, though
there are many examples which have not been updated to use some of the
new generic mechanism that is available.

* Menu:

* 総称的な属性を管理する::
* 特定の型に特化した属性の管理::


File: python.info,  Node: 総称的な属性を管理する,  Next: 特定の型に特化した属性の管理,  Up: 属性を管理する

6.2.3.4 総称的な属性を管理する
..............................

ほとんどの型は '単純な' 属性を使うだけです。では、どのような属性が単純だ
といえるのでしょうか?  それが満たすべき条件はごくわずかです:

  1. *note PyType_Ready(): 980. が呼ばれたとき、すでに属性の名前がわかっ
     ていること。

  2. 属性を参照したり設定したりするときに、特別な記録のための処理が必要
     でなく、また参照したり設定した値に対してどんな操作も実行する必要が
     ないこと。

これらの条件は、属性の値や、値が計算されるタイミング、または格納されたデ
ータがどの程度妥当なものであるかといったことになんら制約を課すものではな
いことに注意してください。

When *note PyType_Ready(): 980. is called, it uses three tables
referenced by the type object to create *note descriptor: 1881.s which
are placed in the dictionary of the type object.  Each descriptor
controls access to one attribute of the instance object.  Each of the
tables is optional; if all three are ‘NULL’, instances of the type will
only have attributes that are inherited from their base type, and should
leave the *note tp_getattro: 1a64. and *note tp_setattro: 4ee8. fields
‘NULL’ as well, allowing the base type to handle attributes.

テーブルはタイプオブジェクト中の 3つのメンバとして宣言されています:

     struct PyMethodDef *tp_methods;
     struct PyMemberDef *tp_members;
     struct PyGetSetDef *tp_getset;

If *note tp_methods: 4ed4. is not ‘NULL’, it must refer to an array of
*note PyMethodDef: 16f0. structures.  Each entry in the table is an
instance of this structure:

     typedef struct PyMethodDef {
         const char  *ml_name;       /* method name */
         PyCFunction  ml_meth;       /* implementation function */
         int          ml_flags;      /* flags */
         const char  *ml_doc;        /* docstring */
     } PyMethodDef;

One entry should be defined for each method provided by the type; no
entries are needed for methods inherited from a base type.  One
additional entry is needed at the end; it is a sentinel that marks the
end of the array.  The *note ml_name: 4ee9. field of the sentinel must
be ‘NULL’.

2番目のテーブルは、インスタンス中に格納されるデータと直接対応づけられた
属性を定義するのに使います。いくつもの C の原始的な型がサポートされてお
り、アクセスを読み出し専用にも読み書き可能にもできます。このテーブルで使
われる構造体は次のように定義されています:

     typedef struct PyMemberDef {
         const char *name;
         int         type;
         int         offset;
         int         flags;
         const char *doc;
     } PyMemberDef;

For each entry in the table, a *note descriptor: 1881. will be
constructed and added to the type which will be able to extract a value
from the instance structure.  The *note type: 4eea. field should contain
a type code like *note Py_T_INT: 7ac. or *note Py_T_DOUBLE: 7ad.; the
value will be used to determine how to convert Python values to and from
C values.  The *note flags: 4eeb. field is used to store flags which
control how the attribute can be accessed: you can set it to *note
Py_READONLY: 7ae. to prevent Python code from setting it.

An interesting advantage of using the *note tp_members: 4ed2. table to
build descriptors that are used at runtime is that any attribute defined
this way can have an associated doc string simply by providing the text
in the table.  An application can use the introspection API to retrieve
the descriptor from the class object, and get the doc string using its
*note __doc__: 2095. attribute.

As with the *note tp_methods: 4ed4. table, a sentinel entry with a *note
ml_name: 4ee9. value of ‘NULL’ is required.


File: python.info,  Node: 特定の型に特化した属性の管理,  Prev: 総称的な属性を管理する,  Up: 属性を管理する

6.2.3.5 特定の型に特化した属性の管理
....................................

For simplicity, only the char* version will be demonstrated here; the
type of the name parameter is the only difference between the char* and
*note PyObject: 5df.* flavors of the interface.  This example
effectively does the same thing as the generic example above, but does
not use the generic support added in Python 2.2.  It explains how the
handler functions are called, so that if you do need to extend their
functionality, you'll understand what needs to be done.

The *note tp_getattr: 4eed. handler is called when the object requires
an attribute look-up.  It is called in the same situations where the
*note __getattr__(): 6fa. method of a class would be called.

以下に例を示します。:

     static PyObject *
     newdatatype_getattr(PyObject *op, char *name)
     {
         newdatatypeobject *self = (newdatatypeobject *) op;
         if (strcmp(name, "data") == 0) {
             return PyLong_FromLong(self->data);
         }

         PyErr_Format(PyExc_AttributeError,
                      "'%.100s' object has no attribute '%.400s'",
                      Py_TYPE(self)->tp_name, name);
         return NULL;
     }

The *note tp_setattr: 4eee. handler is called when the *note
__setattr__(): 237c. or *note __delattr__(): 237d. method of a class
instance would be called.  When an attribute should be deleted, the
third parameter will be ‘NULL’.  Here is an example that simply raises
an exception; if this were really all you wanted, the *note tp_setattr:
4eee. handler should be set to ‘NULL’.

     static int
     newdatatype_setattr(PyObject *op, char *name, PyObject *v)
     {
         PyErr_Format(PyExc_RuntimeError, "Read-only attribute: %s", name);
         return -1;
     }


File: python.info,  Node: オブジェクトの比較,  Next: 抽象的なプロトコルのサポート,  Prev: 属性を管理する,  Up: 拡張の型の定義 雑多なトピック

6.2.3.6 オブジェクトの比較
..........................

     richcmpfunc tp_richcompare;

The *note tp_richcompare: 4ef0. handler is called when comparisons are
needed.  It is analogous to the *note rich comparison methods: 23ae,
like ‘__lt__()’, and also called by *note PyObject_RichCompare(): 4ef1.
and *note PyObject_RichCompareBool(): 1d8c.

This function is called with two Python objects and the operator as
arguments, where the operator is one of ‘Py_EQ’, ‘Py_NE’, ‘Py_LE’,
‘Py_GE’, ‘Py_LT’ or ‘Py_GT’.  It should compare the two objects with
respect to the specified operator and return ‘Py_True’ or ‘Py_False’ if
the comparison is successful, ‘Py_NotImplemented’ to indicate that
comparison is not implemented and the other object's comparison method
should be tried, or ‘NULL’ if an exception was set.

これは内部ポインタのサイズが等しければ等しいと見なすデータ型のサンプル実
装です:

     static PyObject *
     newdatatype_richcmp(PyObject *lhs, PyObject *rhs, int op)
     {
         newdatatypeobject *obj1 = (newdatatypeobject *) lhs;
         newdatatypeobject *obj2 = (newdatatypeobject *) rhs;
         PyObject *result;
         int c, size1, size2;

         /* code to make sure that both arguments are of type
            newdatatype omitted */

         size1 = obj1->obj_UnderlyingDatatypePtr->size;
         size2 = obj2->obj_UnderlyingDatatypePtr->size;

         switch (op) {
         case Py_LT: c = size1 <  size2; break;
         case Py_LE: c = size1 <= size2; break;
         case Py_EQ: c = size1 == size2; break;
         case Py_NE: c = size1 != size2; break;
         case Py_GT: c = size1 >  size2; break;
         case Py_GE: c = size1 >= size2; break;
         }
         result = c ? Py_True : Py_False;
         return Py_NewRef(result);
      }


File: python.info,  Node: 抽象的なプロトコルのサポート,  Next: 弱参照 Weak Reference のサポート,  Prev: オブジェクトの比較,  Up: 拡張の型の定義 雑多なトピック

6.2.3.7 抽象的なプロトコルのサポート
....................................

Python はいくつもの '抽象的な' “プロトコル”をサポートしています。これら
を使用する特定のインターフェイスについては *note 抽象オブジェクトレイヤ
(Abstract Objects Layer): 4ef3. で解説されています。

A number of these abstract interfaces were defined early in the
development of the Python implementation.  In particular, the number,
mapping, and sequence protocols have been part of Python since the
beginning.  Other protocols have been added over time.  For protocols
which depend on several handler routines from the type implementation,
the older protocols have been defined as optional blocks of handlers
referenced by the type object.  For newer protocols there are additional
slots in the main type object, with a flag bit being set to indicate
that the slots are present and should be checked by the interpreter.
(The flag bit does not indicate that the slot values are non-‘NULL’.
The flag may be set to indicate the presence of a slot, but a slot may
still be unfilled.)

     PyNumberMethods   *tp_as_number;
     PySequenceMethods *tp_as_sequence;
     PyMappingMethods  *tp_as_mapping;

お使いのオブジェクトを数値やシーケンス、あるいは辞書のようにふるまうよう
にしたいならば、それぞれに C の *note PyNumberMethods: 1637. 構造体、
*note PySequenceMethods: 4ef4. 構造体、または *note PyMappingMethods:
4ef5. 構造体のアドレスを入れます。これらに適切な値を入れても入れなくても
かまいません。これらを使った例は Python の配布ソースにある ‘Objects’ で
みつけることができるでしょう。

     hashfunc tp_hash;

この関数は、もし使うことにしたならば、データ型のインスタンスのハッシュ番
号を返すようにします。次のは単純な例です:

     static Py_hash_t
     newdatatype_hash(PyObject *op)
     {
         newdatatypeobject *self = (newdatatypeobject *) op;
         Py_hash_t result;
         result = self->some_size + 32767 * self->some_number;
         if (result == -1) {
             result = -2;
         }
         return result;
     }

*note Py_hash_t: 147b. is a signed integer type with a platform-varying
width.  Returning ‘-1’ from *note tp_hash: 4ef6. indicates an error,
which is why you should be careful to avoid returning it when hash
computation is successful, as seen above.

     ternaryfunc tp_call;

この関数は、その型のインスタンスが「関数として呼び出される」ときに呼ばれ
ます。たとえばもし ‘obj1’ にそのインスタンスが入っていて、Python スクリ
プトで ‘obj1('hello')’ を実行したとすると、 *note tp_call: 77b. ハンドラ
が呼ばれます。

この関数は 3つの引数をとります:

  1. 'self' は呼び出しの対象となるデータ型のインスタンスです。 たとえば
     呼び出しが ‘obj1('hello')’ の場合、'self' は ‘obj1’ になります。

  2. 'args' は呼び出しの引数を格納しているタプルです。ここから引数を取り
     出すには *note PyArg_ParseTuple(): 3c1. を使います。

  3. 'kwds' is a dictionary of keyword arguments that were passed.  If
     this is non-‘NULL’ and you support keyword arguments, use *note
     PyArg_ParseTupleAndKeywords(): 624. to extract the arguments.  If
     you do not want to support keyword arguments and this is
     non-‘NULL’, raise a *note TypeError: 198. with a message saying
     that keyword arguments are not supported.

以下は ‘tp_call’ の簡易な実装です:

     static PyObject *
     newdatatype_call(PyObject *op, PyObject *args, PyObject *kwds)
     {
         newdatatypeobject *self = (newdatatypeobject *) op;
         PyObject *result;
         const char *arg1;
         const char *arg2;
         const char *arg3;

         if (!PyArg_ParseTuple(args, "sss:call", &arg1, &arg2, &arg3)) {
             return NULL;
         }
         result = PyUnicode_FromFormat(
             "Returning -- value: [%d] arg1: [%s] arg2: [%s] arg3: [%s]\n",
             self->obj_UnderlyingDatatypePtr->size,
             arg1, arg2, arg3);
         return result;
     }

     /* Iterators */
     getiterfunc tp_iter;
     iternextfunc tp_iternext;

These functions provide support for the iterator protocol.  Both
handlers take exactly one parameter, the instance for which they are
being called, and return a new reference.  In the case of an error, they
should set an exception and return ‘NULL’.  *note tp_iter: 1708.
corresponds to the Python *note __iter__(): e69. method, while *note
tp_iternext: 1709. corresponds to the Python *note __next__(): 14e5.
method.

Any *note iterable: 12f1. object must implement the *note tp_iter: 1708.
handler, which must return an *note iterator: 4c8. object.  Here the
same guidelines apply as for Python classes:

   * For collections (such as lists and tuples) which can support
     multiple independent iterators, a new iterator should be created
     and returned by each call to *note tp_iter: 1708.

   * Objects which can only be iterated over once (usually due to side
     effects of iteration, such as file objects) can implement *note
     tp_iter: 1708. by returning a new reference to themselves - and
     should also therefore implement the *note tp_iternext: 1709.
     handler.

Any *note iterator: 4c8. object should implement both *note tp_iter:
1708. and *note tp_iternext: 1709.  An iterator's *note tp_iter: 1708.
handler should return a new reference to the iterator.  Its *note
tp_iternext: 1709. handler should return a new reference to the next
object in the iteration, if there is one.  If the iteration has reached
the end, *note tp_iternext: 1709. may return ‘NULL’ without setting an
exception, or it may set *note StopIteration: df5. 'in addition' to
returning ‘NULL’; avoiding the exception can yield slightly better
performance.  If an actual error occurs, *note tp_iternext: 1709. should
always set an exception and return ‘NULL’.


File: python.info,  Node: 弱参照 Weak Reference のサポート,  Next: その他いろいろ,  Prev: 抽象的なプロトコルのサポート,  Up: 拡張の型の定義 雑多なトピック

6.2.3.8 弱参照(Weak Reference)のサポート
........................................

One of the goals of Python's weak reference implementation is to allow
any type to participate in the weak reference mechanism without
incurring the overhead on performance-critical objects (such as
numbers).

参考
....

Documentation for the *note weakref: 11a. module.

For an object to be weakly referenceable, the extension type must set
the ‘Py_TPFLAGS_MANAGED_WEAKREF’ bit of the *note tp_flags: 1c71. field.
The legacy *note tp_weaklistoffset: b7f. field should be left as zero.

Concretely, here is how the statically declared type object would look:

     static PyTypeObject TrivialType = {
         PyVarObject_HEAD_INIT(NULL, 0)
         /* ... other members omitted for brevity ... */
         .tp_flags = Py_TPFLAGS_MANAGED_WEAKREF | ...,
     };

The only further addition is that ‘tp_dealloc’ needs to clear any weak
references (by calling *note PyObject_ClearWeakRefs(): 796.):

     static void
     Trivial_dealloc(PyObject *op)
     {
         /* Clear weakrefs first before calling any destructors */
         PyObject_ClearWeakRefs(op);
         /* ... remainder of destruction code omitted for brevity ... */
         Py_TYPE(op)->tp_free(op);
     }


File: python.info,  Node: その他いろいろ,  Prev: 弱参照 Weak Reference のサポート,  Up: 拡張の型の定義 雑多なトピック

6.2.3.9 その他いろいろ
......................

In order to learn how to implement any specific method for your new data
type, get the *note CPython: 905. source code.  Go to the ‘Objects’
directory, then search the C source files for ‘tp_’ plus the function
you want (for example, ‘tp_richcompare’).  You will find examples of the
function you want to implement.

When you need to verify that an object is a concrete instance of the
type you are implementing, use the *note PyObject_TypeCheck(): 1cb5.
function.  A sample of its use might be something like the following:

     if (!PyObject_TypeCheck(some_object, &MyType)) {
         PyErr_SetString(PyExc_TypeError, "arg #1 not a mything");
         return NULL;
     }

参考
....

Download CPython source releases.

     ‘https://www.python.org/downloads/source/’

The CPython project on GitHub, where the CPython source code is developed.

     ‘https://github.com/python/cpython’


File: python.info,  Node: C および C++ 拡張のビルド,  Next: Windows 上での C および C++ 拡張モジュールのビルド,  Prev: 拡張の型の定義 雑多なトピック,  Up: サードパーティツールなしで拡張を作る

6.2.4 C および C++ 拡張のビルド
-------------------------------

A C extension for CPython is a shared library (for example, a ‘.so’ file
on Linux, ‘.pyd’ on Windows), which exports an 'initialization
function'.

See *note 拡張モジュールの定義: 4efc. for details.
* Menu:

* setuptools による C および C++ 拡張のビルド::


File: python.info,  Node: setuptools による C および C++ 拡張のビルド,  Up: C および C++ 拡張のビルド

6.2.4.1 setuptools による C および C++ 拡張のビルド
...................................................

拡張モジュールのビルド、パッケージ化および配布には、サードパーティのツー
ルが最適であり、このドキュメントの範囲外です。適切なツールの一つは
Setuptools であり、ドキュメントは
‘https://setuptools.pypa.io/en/latest/setuptools.html’ にあります。

The *note distutils: 3d. module, which was included in the standard
library until Python 3.12, is now maintained as part of Setuptools.


File: python.info,  Node: Windows 上での C および C++ 拡張モジュールのビルド,  Prev: C および C++ 拡張のビルド,  Up: サードパーティツールなしで拡張を作る

6.2.5 Windows 上での C および C++ 拡張モジュールのビルド
--------------------------------------------------------

この章では Windows 向けの Python 拡張モジュールを Microsoft Visual C++ を
使って作成する方法について簡単に述べ、その後に拡張モジュールのビルドがど
のように動作するのかについて詳しい背景を述べます。この説明は、Python 拡
張モジュールを作成する Windows プログラマと、Unix と Windows の双方でう
まくビルドできるようなソフトウェアの作成に興味がある Unix プログラマの双
方にとって有用です。

モジュールの作者には、この節で説明している方法よりも、distutils によるア
プローチで拡張モジュールをビルドするよう勧めます。また、Python をビルド
した際に使われた C コンパイラが必要です; 通常は Microsoft Visual C++です
。

     注釈: この章では、Python のバージョン番号が符号化されて入っているた
     くさんのファイル名について触れます。これらのファイル名は ‘XY’ で表
     されるバージョン名付きで表現されます; ‘'X'’ は使っている Python リ
     リースのメジャーバージョン番号、‘'Y'’ はマイナーバージョン番号です
     。例えば、Python 2.2.1 を使っているなら、‘XY’ は実際には ‘22’ にな
     ります。

* Menu:

* 型どおりのアプローチ::
* Unix と Windows の相違点::
* DLL 使用の実際::


File: python.info,  Node: 型どおりのアプローチ,  Next: Unix と Windows の相違点,  Up: Windows 上での C および C++ 拡張モジュールのビルド

6.2.5.1 型どおりのアプローチ
............................

There are two approaches to building extension modules on Windows, just
as there are on Unix: use the ‘setuptools’ package to control the build
process, or do things manually.  The setuptools approach works well for
most extensions; documentation on using ‘setuptools’ to build and
package extension modules is available in *note setuptools による C
および C++ 拡張のビルド: 10fa.  If you find you really need to do things
manually, it may be instructive to study the project file for the
winsound(1) standard library module.

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/PCbuild/winsound.vcxproj


File: python.info,  Node: Unix と Windows の相違点,  Next: DLL 使用の実際,  Prev: 型どおりのアプローチ,  Up: Windows 上での C および C++ 拡張モジュールのビルド

6.2.5.2 Unix と Windows の相違点
................................

Unix と Windows では、コードの実行時読み込みに全く異なるパラダイムを用い
ています。動的ロードされるようなモジュールをビルドしようとする前に、自分
のシステムがどのように動作するか知っておいてください。

Unix では、共有オブジェクト (‘.so’) ファイルにプログラムが使うコード、そ
してプログラム内で使う関数名やデータが入っています。ファイルがプログラム
に結合されると、これらの関数やデータに対するファイルのコード内の全ての参
照は、メモリ内で関数やデータが配置されている、プログラム中の実際の場所を
指すように変更されます。これは基本的にはリンク操作にあたります。

Windows では、動的リンクライブラリ (‘.dll’) ファイルにはぶら下がり参照
(dangling reference) はありません。その代わり、関数やデータへのアクセス
はルックアップテーブルを介します。従って DLL コードの場合、実行時にポイ
ンタがプログラムメモリ上の正しい場所を指すように修正する必要はありません
; その代わり、コードは常に DLL のルックアップテーブルを使い、ルックアッ
プテーブル自体は実行時に実際の関数やデータを指すように修正されます。

Unix には、唯一のライブラリファイル形式 (‘.a’) しかありません。 ‘.a’ フ
ァイルには複数のオブジェクトファイル (‘.o’) 由来のコードが入っています。
共有オブジェクトファイル (‘.so’) を作成するリンク処理の段階中に、リンカ
は定義場所の不明な識別子に遭遇することがあります。このときリンカはライブ
ラリ内のオブジェクトファイルを検索します; もし識別子が見つかると、リンカ
はそのオブジェクトファイルから全てのコードを取り込みます。

Windows では、二つの形式のライブラリ、静的ライブラリとインポートライブラ
リがあります (どちらも ‘.lib’ と呼ばれています)。静的ライブラリは Unix に
おける ‘.a’ ファイルに似ています; このファイルには、必要に応じて取り込ま
れるようなコードが入っています。インポートライブラリは、基本的には特定の
識別子が不正ではなく、 DLL がロードされた時点で存在することを保証するた
めにだけ使われます。リンカはインポートライブラリからの情報を使ってルック
アップテーブルを作成し、DLL に入っていない識別子を使えるようにします。ア
プリケーションや DLL がリンクされるさい、インポートライブラリが生成され
ることがあります。このライブラリは、アプリケーションや DLL 内のシンボル
に依存するような、将来作成される全ての DLL で使うために必要になります。

二つの動的ロードモジュール、B と C を作成し、別のコードブロック A を共有
するとします。Unix では、 ‘A.a’ を ‘B.so’ や ‘C.so’ をビルドするときのリ
ンカに渡したりは 'しません' ; そんなことをすれば、コードは二度取り込まれ
、B と C のそれぞれが自分用のコピーを持ってしまいます。 Windows では、
‘A.dll’ をビルドすると ‘A.lib’ もビルドされます。 B や C のリンクには
‘A.lib’ を渡します。 ‘A.lib’ にはコードは入っていません; 単に A のコード
にアクセスするするために実行時に用いられる情報が入っているだけです。

Windows ではインポートライブラリの使用は ‘import spam’ とするようなもの
です; この操作によって spam の名前にアクセスできますが、コードのコピーを
個別に作成したりはしません。Unix では、ライブラリとのリンクはむしろ
‘from spam import *’ に似ています; この操作では個別にコードのコピーを生
成します。

 -- C のマクロ: Py_NO_LINK_LIB

     Turn off the implicit, ‘#pragma’-based linkage with the Python
     library, performed inside CPython header files.

     Added in version 3.14.


File: python.info,  Node: DLL 使用の実際,  Prev: Unix と Windows の相違点,  Up: Windows 上での C および C++ 拡張モジュールのビルド

6.2.5.3 DLL 使用の実際
......................

Windows Python is built in Microsoft Visual C++; using other compilers
may or may not work.  The rest of this section is MSVC++ specific.

When creating DLLs in Windows, you can use the CPython library in two
ways:

  1. By default, inclusion of ‘PC/pyconfig.h’ directly or via ‘Python.h’
     triggers an implicit, configure-aware link with the library.  The
     header file chooses ‘pythonXY_d.lib’ for Debug, ‘pythonXY.lib’ for
     Release, and ‘pythonX.lib’ for Release with the *note Limited API:
     4f07. enabled.

     To build two DLLs, spam and ni (which uses C functions found in
     spam), you could use these commands:

          cl /LD /I/python/include spam.c
          cl /LD /I/python/include ni.c spam.lib

     The first command created three files: ‘spam.obj’, ‘spam.dll’ and
     ‘spam.lib’.  ‘Spam.dll’ does not contain any Python functions (such
     as *note PyArg_ParseTuple(): 3c1.), but it does know how to find
     the Python code thanks to the implicitly linked ‘pythonXY.lib’.

     二つ目のコマンドでは、 ‘ni.dll’ (および ‘.obj’ と ‘.lib’) ができ、
     このライブラリは spam と Python 実行形式中の必要な関数をどうやって
     見つければよいか知っています。

  2. Manually by defining *note Py_NO_LINK_LIB: 444. macro before
     including ‘Python.h’.  You must pass ‘pythonXY.lib’ to the linker.

     To build two DLLs, spam and ni (which uses C functions found in
     spam), you could use these commands:

          cl /LD /DPy_NO_LINK_LIB /I/python/include spam.c ../libs/pythonXY.lib
          cl /LD /DPy_NO_LINK_LIB /I/python/include ni.c spam.lib ../libs/pythonXY.lib

     最初のコマンドで、三つのファイル: ‘spam.obj’ 、 ‘spam.dll’ および
     ‘spam.lib’ ができます。 ‘Spam.dll’ には (*note PyArg_ParseTuple():
     3c1. のような) Python 関数は全く入っていませんが、 ‘pythonXY.lib’ の
     おかげで Python コードを見つけることはできます。

     二つ目のコマンドでは、 ‘ni.dll’ (および ‘.obj’ と ‘.lib’) ができ、
     このライブラリは spam と Python 実行形式中の必要な関数をどうやって
     見つければよいか知っています。

全ての識別子がルックアップテーブル上に公開されるわけではありません。他の
モジュール (Python 自体を含みます) から、自作の識別子が見えるようにする
には、‘void _declspec(dllexport) initspam(void)’ や ‘PyObject
_declspec(dllexport) *NiGetSpamData(void)’ のように、
‘_declspec(dllexport)’ で宣言せねばなりません。

Developer Studio will throw in a lot of import libraries that you do not
really need, adding about 100K to your executable.  To get rid of them,
use the Project Settings dialog, Link tab, to specify 'ignore default
libraries'.  Add the correct ‘msvcrt`xx'.lib’ to the list of libraries.


File: python.info,  Node: 大規模なアプリケーションへの Python ランタイムの埋め込み,  Prev: サードパーティツールなしで拡張を作る,  Up: Python インタプリタの拡張と埋め込み

6.3 大規模なアプリケーションへの Python ランタイムの埋め込み
============================================================

Python インタープリタの中でメインアプリケーションとして実行される拡張を
作るのではなく、 CPython をより大きなアプリケーションの中に埋め込む方が
望ましいことがあります。 この節ではその上手い埋め込みに関わる詳細につい
て説明します。

* Menu:

* 他のアプリケーションへの Python の埋め込み::


File: python.info,  Node: 他のアプリケーションへの Python の埋め込み,  Up: 大規模なアプリケーションへの Python ランタイムの埋め込み

6.3.1 他のアプリケーションへの Python の埋め込み
------------------------------------------------

前章では、 Python を拡張する方法、すなわち C 関数のライブラリを Python に
結びつけて機能を拡張する方法について述べました。同じようなことを別の方法
でも実行できます: それは、自分の C/C++ アプリケーションに Python を埋め
込んで機能を強化する、というものです。埋め込みを行うことで、アプリケーシ
ョンの何らかの機能を C や C++ の代わりに Python で実装できるようになりま
す。埋め込みは多くの用途で利用できます; ユーザが Python でスクリプトを書
き、アプリケーションを自分好みに仕立てられるようにする、というのがその一
例です。プログラマが、特定の機能を Python でより楽に書ける場合に自分自身
のために埋め込みを行うこともできます。

Python の埋め込みは Python の拡張と似ていますが、全く同じというわけでは
ありません。その違いは、Python を拡張した場合にはアプリケーションのメイ
ンプログラムは依然として Python インタプリタである一方、 Python を組み込
みんだ場合には、メインプログラムには Python が関係しない -- その代わりに
、アプリケーションのある一部分が時折 Python インタプリタを呼び出して何ら
かの Python コードを実行させる -- かもしれない、ということです。

従って、 Python の埋め込みを行う場合、自作のメインプログラムを提供しなけ
ればなりません。メインプログラムがやらなければならないことの一つに、
Python インタプリタの初期化があります。とにかく少なくとも関数 *note
Py_Initialize(): 460. を呼び出さねばなりません。オプションとして、Python
側にコマンドライン引数を渡すために関数呼び出しを行います。その後、アプリ
ケーションのどこでもインタプリタを呼び出せるようになります。

インタプリタを呼び出すには、異なるいくつかの方法があります: Python 文が
入った文字列を *note PyRun_SimpleString(): 4f0b. に渡す、 stdio ファイル
ポインタとファイル名 (これはエラーメッセージ内でコードを識別するためだけ
のものです) を *note PyRun_SimpleFile(): 4f0c. に渡す、といった具合です
。これまでの各章で説明した低水準の操作を呼び出して、Python オブジェクト
を構築したり使用したりもできます。

参考
....

*note Python/C API リファレンスマニュアル: 1fbe.

     Python C インターフェースの詳細はこのマニュアルに書かれています。必
     要な情報の大部分はここにあるはずです。

* Menu:

* 高水準の埋め込み::
* 超高水準の埋め込みから踏み出す; 概要: 超高水準の埋め込みから踏み出す 概要.
* 純粋な埋め込み::
* 埋め込まれた Python の拡張::
* C++による Python の埋め込み::
* Unix 系システムにおけるコンパイルとリンク::


File: python.info,  Node: 高水準の埋め込み,  Next: 超高水準の埋め込みから踏み出す 概要,  Up: 他のアプリケーションへの Python の埋め込み

6.3.1.1 高水準の埋め込み
........................

Python の埋め込みの最も簡単な形式は、超高水準インターフェースの利用です
。このインターフェースは、アプリケーションとやり取りする必要がない
Python スクリプトを実行するためのものです。例えばこれは、一つのファイル
上で何らかの操作を実現するのに利用できます。

     #define PY_SSIZE_T_CLEAN
     #include <Python.h>

     int
     main(int argc, char *argv[])
     {
         PyStatus status;
         PyConfig config;
         PyConfig_InitPythonConfig(&config);

         /* optional but recommended */
         status = PyConfig_SetBytesString(&config, &config.program_name, argv[0]);
         if (PyStatus_Exception(status)) {
             goto exception;
         }

         status = Py_InitializeFromConfig(&config);
         if (PyStatus_Exception(status)) {
             goto exception;
         }
         PyConfig_Clear(&config);

         PyRun_SimpleString("from time import time,ctime\n"
                            "print('Today is', ctime(time()))\n");
         if (Py_FinalizeEx() < 0) {
             exit(120);
         }
         return 0;

       exception:
          PyConfig_Clear(&config);
          Py_ExitStatusException(status);
     }

     注釈: ‘#define PY_SSIZE_T_CLEAN’ は、いくつかの API では ‘int’ の代
     わりに ‘Py_ssize_t’ が使われるべきであることを示すために使われてい
     ました。これは Python 3.13 以降では不要となりましたが、後方互換性の
     ために維持されています。このマクロの説明は *note 文字列とバッファ:
     62c. にあります。

Setting *note PyConfig.program_name: 3f2. should be called before *note
Py_InitializeFromConfig(): 3f6. to inform the interpreter about paths to
Python run-time libraries.  Next, the Python interpreter is initialized
with *note Py_Initialize(): 460, followed by the execution of a
hard-coded Python script that prints the date and time.  Afterwards, the
*note Py_FinalizeEx(): f11. call shuts the interpreter down, followed by
the end of the program.  In a real program, you may want to get the
Python script from another source, perhaps a text-editor routine, a
file, or a database.  Getting the Python code from a file can better be
done by using the *note PyRun_SimpleFile(): 4f0c. function, which saves
you the trouble of allocating memory space and loading the file
contents.


File: python.info,  Node: 超高水準の埋め込みから踏み出す 概要,  Next: 純粋な埋め込み,  Prev: 高水準の埋め込み,  Up: 他のアプリケーションへの Python の埋め込み

6.3.1.2 超高水準の埋め込みから踏み出す: 概要
............................................

高水準インターフェースは、断片的な Python コードをアプリケーションから実
行できるようにしてくれますが、アプリケーションと Python コードの間でのデ
ータのやり取りは、控えめに言っても煩わしいものです。データのやり取りをし
たいなら、より低水準のインターフェース呼び出しを利用しなくてはなりません
。より多く C コードを書かねばならない代わりに、ほぼ何でもできるようにな
ります。

Python の拡張と埋め込みは、趣旨こそ違え、同じ作業であるということに注意
せねばなりません。これまでの章で議論してきたトピックのほとんどが埋め込み
でもあてはまります。これを示すために、 Python から C への拡張を行うコー
ドが実際には何をするか考えてみましょう:

  1. データ値を Python から C に変換する。

  2. 変換された値を使って C ルーチンの関数呼び出しを行い、

  3. 呼び出しで得られたデータ値 C から Python に変換する。

Python を埋め込む場合には、インターフェースコードが行う作業は以下のよう
になります:

  1. データ値を C から Python に変換する。

  2. 変換された値を使って Python インターフェースルーチンの関数呼び出し
     を行い、

  3. 呼び出しで得られたデータ値 Python から C に変換する。

一見して分かるように、データ変換のステップは、言語間でデータを転送する方
向が変わったのに合わせて単に入れ替えただけです。唯一の相違点は、データ変
換の間にあるルーチンです。拡張を行う際には C ルーチンを呼び出しますが、
埋め込みの際には Python ルーチンを呼び出します。

この章では、Python から C へ、そしてその逆へとデータを変換する方法につい
ては議論しません。また、正しい参照の使い方やエラーの扱い方についてすでに
理解しているものと仮定します。これらの側面についてはインタプリタの拡張と
何ら変わるところがないので、必要な情報については以前の章を参照できます。


File: python.info,  Node: 純粋な埋め込み,  Next: 埋め込まれた Python の拡張,  Prev: 超高水準の埋め込みから踏み出す 概要,  Up: 他のアプリケーションへの Python の埋め込み

6.3.1.3 純粋な埋め込み
......................

最初に例示するプログラムは、Python スクリプト内の関数を実行するためのも
のです。超高水準インターフェースに関する節で挙げた例と同様に、Python イ
ンタプリタはアプリケーションと直接やりとりはしません (が、次の節でやりと
りするよう変更します)。

Python スクリプト内で定義されている関数を実行するためのコードは以下のよ
うになります:

     #define PY_SSIZE_T_CLEAN
     #include <Python.h>

     int
     main(int argc, char *argv[])
     {
         PyObject *pName, *pModule, *pFunc;
         PyObject *pArgs, *pValue;
         int i;

         if (argc < 3) {
             fprintf(stderr,"Usage: call pythonfile funcname [args]\n");
             return 1;
         }

         Py_Initialize();
         pName = PyUnicode_DecodeFSDefault(argv[1]);
         /* Error checking of pName left out */

         pModule = PyImport_Import(pName);
         Py_DECREF(pName);

         if (pModule != NULL) {
             pFunc = PyObject_GetAttrString(pModule, argv[2]);
             /* pFunc is a new reference */

             if (pFunc && PyCallable_Check(pFunc)) {
                 pArgs = PyTuple_New(argc - 3);
                 for (i = 0; i < argc - 3; ++i) {
                     pValue = PyLong_FromLong(atoi(argv[i + 3]));
                     if (!pValue) {
                         Py_DECREF(pArgs);
                         Py_DECREF(pModule);
                         fprintf(stderr, "Cannot convert argument\n");
                         return 1;
                     }
                     /* pValue reference stolen here: */
                     PyTuple_SetItem(pArgs, i, pValue);
                 }
                 pValue = PyObject_CallObject(pFunc, pArgs);
                 Py_DECREF(pArgs);
                 if (pValue != NULL) {
                     printf("Result of call: %ld\n", PyLong_AsLong(pValue));
                     Py_DECREF(pValue);
                 }
                 else {
                     Py_DECREF(pFunc);
                     Py_DECREF(pModule);
                     PyErr_Print();
                     fprintf(stderr,"Call failed\n");
                     return 1;
                 }
             }
             else {
                 if (PyErr_Occurred())
                     PyErr_Print();
                 fprintf(stderr, "Cannot find function \"%s\"\n", argv[2]);
             }
             Py_XDECREF(pFunc);
             Py_DECREF(pModule);
         }
         else {
             PyErr_Print();
             fprintf(stderr, "Failed to load \"%s\"\n", argv[1]);
             return 1;
         }
         if (Py_FinalizeEx() < 0) {
             return 120;
         }
         return 0;
     }

このコードは ‘argv[1]’ を使って Python スクリプトをロードし、 ‘argv[2]’
内に指定された名前の関数を呼び出します。関数の整数引数は ‘argv’ 配列中の
他の値になります。このプログラムを *note コンパイルしてリンク: 4f13. し
(できた実行可能形式を ‘call’ と呼びましょう)、以下のような Python スクリ
プトを実行することにします:

     def multiply(a,b):
         print("Will compute", a, "times", b)
         c = 0
         for i in range(0, a):
             c = c + b
         return c

実行結果は以下のようになるはずです:

     $ call multiply multiply 3 2
     Will compute 3 times 2
     Result of call: 6

この程度の機能を実現するにはプログラムがいささか大きすぎますが、ほとんど
は Python から C へのデータ変換やエラー報告のためのコードです。Python の
埋め込みという観点から最も興味深い部分は以下のコードから始まる部分です:

     Py_Initialize();
     pName = PyUnicode_DecodeFSDefault(argv[1]);
     /* Error checking of pName left out */
     pModule = PyImport_Import(pName);

After initializing the interpreter, the script is loaded using *note
PyImport_Import(): 1615.  This routine needs a Python string as its
argument, which is constructed using the *note
PyUnicode_DecodeFSDefault(): 1a88. data conversion routine.

     pFunc = PyObject_GetAttrString(pModule, argv[2]);
     /* pFunc is a new reference */

     if (pFunc && PyCallable_Check(pFunc)) {
         ...
     }
     Py_XDECREF(pFunc);

ひとたびスクリプトが読み込まれると、 *note PyObject_GetAttrString():
5ef. を使って必要な名前を取得できます。名前がスクリプト中に存在し、取得
したオブジェクトが呼び出し可能オブジェクトであれば、このオブジェクトが関
数であると考えて差し支えないでしょう。そこでプログラムは定石どおりに引数
のタプル構築に進みます。その後、Python 関数を以下のコードで呼び出します:

     pValue = PyObject_CallObject(pFunc, pArgs);

関数が処理を戻す際、 ‘pValue’ は ‘NULL’ になるか、関数の戻り値への参照が
入っています。値を調べた後には忘れずに参照を解放してください。


File: python.info,  Node: 埋め込まれた Python の拡張,  Next: C++による Python の埋め込み,  Prev: 純粋な埋め込み,  Up: 他のアプリケーションへの Python の埋め込み

6.3.1.4 埋め込まれた Python の拡張
..................................

ここまでは、埋め込み Python インタプリタはアプリケーション本体の機能にア
クセスする手段がありませんでした。 Python API を使うと、埋め込みインタプ
リタを拡張することでアプリケーション本体へのアクセスを可能にします。つま
り、アプリケーションで提供されているルーチンを使って、埋め込みインタプリ
タを拡張するのです。複雑なことのように思えますが、それほどひどいわけでは
ありません。さしあたって、アプリケーションが Python インタプリタを起動し
たということをちょっと忘れてみてください。その代わり、アプリケーションが
サブルーチンの集まりで、あたかも普通の Python 拡張モジュールを書くかのよ
うに、Python から各ルーチンにアクセスできるようにするグルー(glue, 糊) コ
ードを書くと考えてください。例えば以下のようにです:

     static int numargs=0;

     /* Return the number of arguments of the application command line */
     static PyObject*
     emb_numargs(PyObject *self, PyObject *args)
     {
         if(!PyArg_ParseTuple(args, ":numargs"))
             return NULL;
         return PyLong_FromLong(numargs);
     }

     static PyMethodDef emb_module_methods[] = {
         {"numargs", emb_numargs, METH_VARARGS,
          "Return the number of arguments received by the process."},
         {NULL, NULL, 0, NULL}
     };

     static struct PyModuleDef emb_module = {
         .m_base = PyModuleDef_HEAD_INIT,
         .m_name = "emb",
         .m_size = 0,
         .m_methods = emb_module_methods,
     };

     static PyObject*
     PyInit_emb(void)
     {
         return PyModuleDef_Init(&emb_module);
     }

上のコードを ‘main()’ 関数のすぐ上に挿入します。また、以下の二つの文を
*note Py_Initialize(): 460. の呼び出しの前に挿入します:

     numargs = argc;
     PyImport_AppendInittab("emb", &PyInit_emb);

These two lines initialize the ‘numargs’ variable, and make the
‘emb.numargs()’ function accessible to the embedded Python interpreter.
With these extensions, the Python script can do things like

     import emb
     print("Number of arguments", emb.numargs())

実際のアプリケーションでは、こうしたメソッドでアプリケーション内の API を
Python に公開することになります。


File: python.info,  Node: C++による Python の埋め込み,  Next: Unix 系システムにおけるコンパイルとリンク,  Prev: 埋め込まれた Python の拡張,  Up: 他のアプリケーションへの Python の埋め込み

6.3.1.5 C++による Python の埋め込み
...................................

C++ プログラム中にも Python を埋め込めます; 厳密に言うと、どうやって埋め
込むかは使っているC++ 処理系の詳細に依存します; 一般的には、メインプログ
ラムをC++で書き、C++ コンパイラを使ってプログラムをコンパイル・リンクす
る必要があるでしょう。 Python 自体を C++でコンパイルしなおす必要はありま
せん。


File: python.info,  Node: Unix 系システムにおけるコンパイルとリンク,  Prev: C++による Python の埋め込み,  Up: 他のアプリケーションへの Python の埋め込み

6.3.1.6 Unix 系システムにおけるコンパイルとリンク
.................................................

Python インタプリタをアプリケーションに埋め込むためにコンパイラ (とリン
カ) に渡すべき正しいフラグを見出すのは簡単でないかもしれません。これは特
に、Python がライブラリモジュールに対してリンクされた C 動的拡張 (‘.so’
ファイル) として実装されたものをロードする必要があるためです。

必要なコンパイル・リンクのオプションを知るために、 ‘python`X.Y'-config’
スクリプトが使えます(これは Python インストール時に生成されたもので、
‘python3-config’ スクリプトも利用出来るかもしれません)。このスクリプトに
はオプションが多くありますが、直接的に有用なのはこれでしょう:

   * ‘pythonX.Y-config --cflags’ は推奨のコンパイルオプションを出力しま
     す:

          $ /opt/bin/python3.11-config --cflags
          -I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare  -DNDEBUG -g -fwrapv -O3 -Wall

   * ‘pythonX.Y-config --ldflags --embed’ は推奨のリンクオプションを出力
     します:

          $ /opt/bin/python3.11-config --ldflags --embed
          -L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 -lpthread -ldl  -lutil -lm

     注釈: 複数 Python バージョン共存(とりわけシステムの Python とあなた
     自身でビルドした Python)での混乱を避けるために、上での例のように
     ‘python`X.Y'-config’ は絶対パスで起動したほうが良いです。

もしこの手順でうまくいかなければ(たしかにこれは全ての Unix 的なプラット
フォームで動作することを保障するものではないですが、 *note bug reports:
4f19. は歓迎です)、あなたのシステムのダイナミックリンクについてのドキュ
メントを読み、Python の ‘Makefile’ のコンパイルオプションを調べる必要が
あるでしょう(Makefile の場所を調べるには *note
sysconfig.get_makefile_filename(): 4973. を使ってください)。この場合、
*note sysconfig: e1. モジュールが役に立つ道具になります。これによってあ
なたが付け加えたいコンパイル・リンクのオプション構成をプログラム的に抽出
できます。例えば:

     >>> import sysconfig
     >>> sysconfig.get_config_var('LIBS')
     '-lpthread -ldl  -lutil'
     >>> sysconfig.get_config_var('LINKFORSHARED')
     '-Xlinker -export-dynamic'


File: python.info,  Node: Python/C API リファレンスマニュアル,  Next: Python モジュールのインストール,  Prev: Python インタプリタの拡張と埋め込み,  Up: Top

7 Python/C API リファレンスマニュアル
*************************************

このマニュアルでは、拡張モジュールを書いたり Python インタプリタをアプリ
ケーションに埋め込んだりしたい C/C++ プログラマが利用できる API について
述べています。 *note Python インタプリタの拡張と埋め込み: 1fbd. は拡張モ
ジュールを書く際の一般的な決まりごとについて記述していますが、 API の詳
細までは記述していないので、このドキュメントが手引きになります。

* Menu:

* はじめに: はじめに<14>.
* C API の安定性::
* 超高水準レイヤ::
* 参照カウント::
* 例外処理::
* 拡張モジュールの定義::
* ユーティリティ: ユーティリティ<2>.
* 抽象オブジェクトレイヤ (Abstract Objects Layer): 抽象オブジェクトレイヤ Abstract Objects Layer.
* 具象オブジェクト (concrete object) レイヤ: 具象オブジェクト concrete object レイヤ.
* 初期化 (initialization)、終了処理 (finalization)、スレッド: 初期化 initialization 、終了処理 finalization 、スレッド.
* Python 初期化設定::
* メモリ管理::
* オブジェクト実装サポート (object implementation support): オブジェクト実装サポート object implementation support.
* API と ABI のバージョニング::
* Monitoring C API::
* Generating Execution Events::


File: python.info,  Node: はじめに<14>,  Next: C API の安定性,  Up: Python/C API リファレンスマニュアル

7.1 はじめに
============

Python のアプリケーションプログラマ用インタフェース (Application
Programmer's Interface, API) は、 Python インタプリタに対する様々なレベ
ルでのアクセス手段を C や C++ のプログラマに提供しています。この API は
通常 C++ からも全く同じように利用できるのですが、簡潔な呼び名にするため
に Python/C API と名づけられています。根本的に異なる二つの目的から、
Python/C API が用いられます。第一は、特定用途の '拡張モジュール
(extension module)' 、すなわち Python インタプリタを拡張する C で書かれ
たモジュールを記述する、という目的です。第二は、より大規模なアプリケーシ
ョン内で Python を構成要素 (component) として利用するという目的です; こ
のテクニックは、一般的にはアプリケーションへの Python の埋め込み
('embedding') と呼びます。

拡張モジュールの作成は比較的わかりやすいプロセスで、 "手引書 (cookbook)"
的なアプローチでうまく実現できます。作業をある程度まで自動化してくれるツ
ールもいくつかあります。一方、他のアプリケーションへの Python の埋め込み
は、Python ができてから早い時期から行われてきましたが、拡張モジュールの
作成に比べるとやや難解です。

多くの API 関数は、Python の埋め込みであるか拡張であるかに関わらず役立ち
ます; とはいえ、Python を埋め込んでいるほとんどのアプリケーションは、同
時に自作の拡張モジュールも提供する必要が生じることになるでしょうから、
Python を実際にアプリケーションに埋め込んでみる前に拡張モジュールの書き
方に詳しくなっておくのはよい考えだと思います。

* Menu:

* 言語バージョン互換性::
* コーディング基準::
* インクルードファイル::
* 便利なマクロ::
* オブジェクト、型および参照カウント::
* 例外: 例外<24>.
* Python の埋め込み: Python の埋め込み<2>.
* デバッグ版ビルド (Debugging Builds): デバッグ版ビルド Debugging Builds.
* おすすめのサードパーティツール: おすすめのサードパーティツール<2>.


File: python.info,  Node: 言語バージョン互換性,  Next: コーディング基準,  Up: はじめに<14>

7.1.1 言語バージョン互換性
--------------------------

Pythonの C API は C11 や C++11 バージョンの C と C++ に互換性があります
。

This is a lower limit: the C API does not require features from later
C/C++ versions.  You do 'not' need to enable your compiler's "c11 mode".


File: python.info,  Node: コーディング基準,  Next: インクルードファイル,  Prev: 言語バージョン互換性,  Up: はじめに<14>

7.1.2 コーディング基準
----------------------

CPython に含める C コードを書いている場合は、 PEP 7(1) のガイドラインと
基準に従わなければ 'なりません' 。 このガイドラインは、コントリビュート
対象の Python のバージョンに関係無く適用されます。 自身のサードパーティ
ーのモジュールでは、それをいつか Python にコントリビュートするつもりでな
ければ、この慣習に従う必要はありません。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0007/


File: python.info,  Node: インクルードファイル,  Next: 便利なマクロ,  Prev: コーディング基準,  Up: はじめに<14>

7.1.3 インクルードファイル
--------------------------

Python/C API を使うために必要な、関数、型およびマクロの全ての定義をイン
クルードするには、以下の行:

     #define PY_SSIZE_T_CLEAN
     #include <Python.h>

をソースコードに記述します。この行を記述すると、標準ヘッダ: ‘<stdio.h>’,
‘<string.h>’, ‘<errno.h>’, ‘<limits.h>’, ‘<assert.h>’, ‘<stdlib.h>’ を
(利用できれば) インクルードします。

     注釈: Python は、システムによっては標準ヘッダの定義に影響するような
     プリプロセッサ定義を行っているので、 ‘Python.h’ をいずれの標準ヘッ
     ダよりも前にインクルード 'せねばなりません' 。

     ‘Python.h’ をインクルードする前に、常に ‘PY_SSIZE_T_CLEAN’ を定義す
     ることが推奨されます。 このマクロの解説については *note
     引数の解釈と値の構築: 3d5. を参照してください。

Python.h で定義されている、ユーザから見える名前全て (Python.h がインクル
ードしている標準ヘッダの名前は除きます) には、接頭文字列 ‘Py’ または
‘_Py’ が付きます。‘_Py’ で始まる名前は Python 実装で内部使用するための名
前で、拡張モジュールの作者は使ってはなりません。構造体のメンバには予約済
みの接頭文字列はありません。

     注釈: API のユーザは、‘Py’ や ‘_Py’ で始まる名前を定義するコードを
     絶対に書いてはなりません。 後からコードを読む人を混乱させたり、将来
     の Python のバージョンで同じ名前が定義されて、ユーザの書いたコード
     の可搬性を危うくする可能性があります。

ヘッダファイル群は通常 Python と共にインストールされます。 Unixでは
‘`prefix'/include/pythonversion/’ および
‘`exec_prefix'/include/pythonversion/’ に置かれます。 *note prefix:
214f. と *note exec_prefix: 2150. は Python をビルドする際の ‘configure’
スクリプトに与えたパラメタに対応し、 'version' は ‘'%d.%d' %
sys.version_info[:2]’ に対応します。 Windows では、ヘッダは
‘`prefix'/include’ に置かれます。 ‘prefix’ はインストーラに指定したイン
ストールディレクトリです。

ヘッダをインクルードするには、各ヘッダの入ったディレクトリ (別々のディレ
クトリの場合は両方) を、コンパイラがインクルードファイルを検索するための
パスに入れます。親ディレクトリをサーチパスに入れて、 ‘#include
<pythonX.Y/Python.h>’ のようにしては 'なりません' ; *note prefix: 214f.
内のプラットフォームに依存しないヘッダは、 *note exec_prefix: 2150. から
プラットフォーム依存のヘッダをインクルードしているので、このような操作を
行うと複数のプラットフォームでのビルドができなくなります。

C++ users should note that although the API is defined entirely using C,
the header files properly declare the entry points to be ‘extern "C"’.
As a result, there is no need to do anything special to use the API from
C++.


File: python.info,  Node: 便利なマクロ,  Next: オブジェクト、型および参照カウント,  Prev: インクルードファイル,  Up: はじめに<14>

7.1.4 便利なマクロ
------------------

Several useful macros are defined in the Python header files.  Many are
defined closer to where they are useful (for example, *note
Py_RETURN_NONE: 168c, *note PyMODINIT_FUNC: 16ec.).  Others of a more
general utility are defined here.  This is not necessarily a complete
listing.

 -- C のマクロ: Py_CAN_START_THREADS

     If this macro is defined, then the current system is able to start
     threads.

     Currently, all systems supported by CPython (per PEP 11(1)), with
     the exception of some WebAssembly platforms, support starting
     threads.

     Added in version 3.13.

 -- C のマクロ: Py_GETENV (s)

     Like ‘getenv(S)’, but returns ‘NULL’ if *note -E: b56. was passed
     on the command line (see *note PyConfig.use_environment: 40b.).

* Menu:

* Docstring macros::
* General utility macros::
* Declaration utilities::
* Outdated macros::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0011/


File: python.info,  Node: Docstring macros,  Next: General utility macros,  Up: 便利なマクロ

7.1.4.1 Docstring macros
........................

 -- C のマクロ: PyDoc_STRVAR (name, str)

     Creates a variable with name 'name' that can be used in docstrings.
     If Python is built without docstrings (*note -without-doc-strings:
     21a2.), the value will be an empty string.

     以下はプログラム例です:

          PyDoc_STRVAR(pop_doc, "Remove and return the rightmost element.");

          static PyMethodDef deque_methods[] = {
              // ...
              {"pop", (PyCFunction)deque_pop, METH_NOARGS, pop_doc},
              // ...
          }

     Expands to ‘PyDoc_VAR(NAME) = PyDoc_STR(STR)’.

 -- C のマクロ: PyDoc_STR (str)

     Expands to the given input string, or an empty string if docstrings
     are disabled (*note -without-doc-strings: 21a2.).

     以下はプログラム例です:

          static PyMethodDef pysqlite_row_methods[] = {
              {"keys", (PyCFunction)pysqlite_row_keys, METH_NOARGS,
                  PyDoc_STR("Returns the keys of the row.")},
              {NULL, NULL}
          };

 -- C のマクロ: PyDoc_VAR (name)

     Declares a static character array variable with the given 'name'.
     Expands to ‘static const char NAME[]’

     例えば:

          PyDoc_VAR(python_doc) = PyDoc_STR(
             "A genus of constricting snakes in the Pythonidae family native "
             "to the tropics and subtropics of the Eastern Hemisphere.");


File: python.info,  Node: General utility macros,  Next: Declaration utilities,  Prev: Docstring macros,  Up: 便利なマクロ

7.1.4.2 General utility macros
..............................

The following macros are for common tasks not specific to Python.

 -- C のマクロ: Py_UNUSED (arg)

     コンパイラ警告を抑えるために関数定義の使用されない引数に使用してく
     ださい。例えば: ‘int func(int a, int Py_UNUSED(b)) { return a; }’ 。

     Added in version 3.4.

 -- C のマクロ: Py_GCC_ATTRIBUTE (name)

     Use a GCC attribute 'name', hiding it from compilers that don't
     support GCC attributes (such as MSVC).

     This expands to ‘__attribute__((NAME))’ on a GCC compiler, and
     expands to nothing on compilers that don't support GCC attributes.

* Menu:

* Numeric utilities::
* Assertion utilities::
* Type size utilities::
* Macro definition utilities::


File: python.info,  Node: Numeric utilities,  Next: Assertion utilities,  Up: General utility macros

7.1.4.3 Numeric utilities
.........................

 -- C のマクロ: Py_ABS (x)

     ‘x’ の絶対値を返します。

     The argument may be evaluated more than once.  Consequently, do not
     pass an expression with side-effects directly to this macro.

     If the result cannot be represented (for example, if ‘x’ has
     ‘INT_MIN’ value for int type), the behavior is undefined.

     Corresponds roughly to ‘((X) < 0 ? -(X) : (X))’

     Added in version 3.3.

 -- C のマクロ: Py_MAX (x, y)
 -- C のマクロ: Py_MIN (x, y)

     Return the larger or smaller of the arguments, respectively.

     Any arguments may be evaluated more than once.  Consequently, do
     not pass an expression with side-effects directly to this macro.

     ‘Py_MAX’ corresponds roughly to ‘(((X) > (Y)) ? (X) : (Y))’.

     Added in version 3.3.

 -- C のマクロ: Py_ARITHMETIC_RIGHT_SHIFT (type, integer, positions)

     Similar to ‘INTEGER >> POSITIONS’, but forces sign extension, as
     the C standard does not define whether a right-shift of a signed
     integer will perform sign extension or a zero-fill.

     'integer' should be any signed integer type.  'positions' is the
     number of positions to shift to the right.

     Both 'integer' and 'positions' can be evaluated more than once;
     consequently, avoid directly passing a function call or some other
     operation with side-effects to this macro.  Instead, store the
     result as a variable and then pass it.

     'type' is unused and only kept for backwards compatibility.
     Historically, 'type' was used to cast 'integer'.

     バージョン 3.1 で変更: This macro is now valid for all signed
     integer types, not just those for which ‘unsigned type’ is legal.
     As a result, 'type' is no longer used.

 -- C のマクロ: Py_CHARMASK (c)

     引数は文字か、[-128, 127] あるいは [0, 255] の範囲の整数でなければ
     なりません。 このマクロは ‘符号なし文字’ にキャストした ‘c’ を返し
     ます。


File: python.info,  Node: Assertion utilities,  Next: Type size utilities,  Prev: Numeric utilities,  Up: General utility macros

7.1.4.4 Assertion utilities
...........................

 -- C のマクロ: Py_UNREACHABLE ()

     Use this when you have a code path that cannot be reached by
     design.  For example, in the ‘default:’ clause in a ‘switch’
     statement for which all possible values are covered in ‘case’
     statements.  Use this in places where you might be tempted to put
     an ‘assert(0)’ or ‘abort()’ call.

     In release mode, the macro helps the compiler to optimize the code,
     and avoids a warning about unreachable code.  For example, the
     macro is implemented with ‘__builtin_unreachable()’ on GCC in
     release mode.

     In debug mode, and on unsupported compilers, the macro expands to a
     call to *note Py_FatalError(): b7a.

     A use for ‘Py_UNREACHABLE()’ is following a call to a function that
     never returns but that is not declared ‘_Noreturn’.

     If a code path is very unlikely code but can be reached under
     exceptional case, this macro must not be used.  For example, under
     low memory condition or if a system call returns a value out of the
     expected range.  In this case, it's better to report the error to
     the caller.  If the error cannot be reported to caller, *note
     Py_FatalError(): b7a. can be used.

     Added in version 3.7.

 -- C のマクロ: Py_SAFE_DOWNCAST (value, larger, smaller)

     Cast 'value' to type 'smaller' from type 'larger', validating that
     no information was lost.

     On release builds of Python, this is roughly equivalent to
     ‘((SMALLER) VALUE)’ (in C++, ‘static_cast<SMALLER>(VALUE)’ will be
     used instead).

     On debug builds (implying that *note Py_DEBUG: 1834. is defined),
     this asserts that no information was lost with the cast from
     'larger' to 'smaller'.

     'value', 'larger', and 'smaller' may all be evaluated more than
     once in the expression; consequently, do not pass an expression
     with side-effects directly to this macro.

 -- C のマクロ: Py_BUILD_ASSERT (cond)

     Asserts a compile-time condition 'cond', as a statement.  The build
     will fail if the condition is false or cannot be evaluated at
     compile time.

     Corresponds roughly to ‘static_assert(COND)’ on C23 and above.

     例えば:

          Py_BUILD_ASSERT(sizeof(PyTime_t) == sizeof(int64_t));

     Added in version 3.3.

 -- C のマクロ: Py_BUILD_ASSERT_EXPR (cond)

     Asserts a compile-time condition 'cond', as an expression that
     evaluates to ‘0’.  The build will fail if the condition is false or
     cannot be evaluated at compile time.

     例えば:

          #define foo_to_char(foo) \
              ((char *)(foo) + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0))

     Added in version 3.3.


File: python.info,  Node: Type size utilities,  Next: Macro definition utilities,  Prev: Assertion utilities,  Up: General utility macros

7.1.4.5 Type size utilities
...........................

 -- C のマクロ: Py_ARRAY_LENGTH (array)

     Compute the length of a statically allocated C array at compile
     time.

     The 'array' argument must be a C array with a size known at compile
     time.  Passing an array with an unknown size, such as a
     heap-allocated array, will result in a compilation error on some
     compilers, or otherwise produce incorrect results.

     This is roughly equivalent to:

          sizeof(array) / sizeof((array)[0])

 -- C のマクロ: Py_MEMBER_SIZE (type, member)

     Return the size of a structure ('type') 'member' in bytes.

     Corresponds roughly to ‘sizeof(((TYPE *)NULL)->MEMBER)’.

     Added in version 3.6.


File: python.info,  Node: Macro definition utilities,  Prev: Type size utilities,  Up: General utility macros

7.1.4.6 Macro definition utilities
..................................

 -- C のマクロ: Py_FORCE_EXPANSION (X)

     This is equivalent to ‘X’, which is useful for token-pasting in
     macros, as macro expansions in 'X' are forcefully evaluated by the
     preprocessor.

 -- C のマクロ: Py_STRINGIFY (x)

     Convert ‘x’ to a C string.  For example, ‘Py_STRINGIFY(123)’
     returns ‘"123"’.

     Added in version 3.4.


File: python.info,  Node: Declaration utilities,  Next: Outdated macros,  Prev: General utility macros,  Up: 便利なマクロ

7.1.4.7 Declaration utilities
.............................

The following macros can be used in declarations.  They are most useful
for defining the C API itself, and have limited use for extension
authors.  Most of them expand to compiler-specific spellings of common
extensions to the C language.

 -- C のマクロ: Py_ALWAYS_INLINE

     Ask the compiler to always inline a static inline function.  The
     compiler can ignore it and decide to not inline the function.

     Corresponds to ‘always_inline’ attribute in GCC and ‘__forceinline’
     in MSVC.

     It can be used to inline performance critical static inline
     functions when building Python in debug mode with function inlining
     disabled.  For example, MSC disables function inlining when
     building in debug mode.

     Marking blindly a static inline function with Py_ALWAYS_INLINE can
     result in worse performances (due to increased code size for
     example).  The compiler is usually smarter than the developer for
     the cost/benefit analysis.

     If Python is *note built in debug mode: 509. (if the *note
     Py_DEBUG: 1834. macro is defined), the *note Py_ALWAYS_INLINE:
     1c6b. macro does nothing.

     It must be specified before the function return type.  Usage:

          static inline Py_ALWAYS_INLINE int random(void) { return 4; }

     Added in version 3.11.

 -- C のマクロ: Py_NO_INLINE

     Disable inlining on a function.  For example, it reduces the C
     stack consumption: useful on LTO+PGO builds which heavily inline
     code (see bpo-33720(1)).

     Corresponds to the ‘noinline’ attribute/specification on GCC and
     MSVC.

     使い方:

          Py_NO_INLINE static int random(void) { return 4; }

     Added in version 3.11.

 -- C のマクロ: Py_DEPRECATED (version)

     Use this to declare APIs that were deprecated in a specific CPython
     version.  The macro must be placed before the symbol name.

     以下はプログラム例です:

          Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);

     バージョン 3.8 で変更: MSVC サポートが追加されました。

 -- C のマクロ: Py_LOCAL (type)

     Declare a function returning the specified 'type' using a
     fast-calling qualifier for functions that are local to the current
     file.  Semantically, this is equivalent to ‘static TYPE’.

 -- C のマクロ: Py_LOCAL_INLINE (type)

     Equivalent to *note Py_LOCAL: 1663. but additionally requests the
     function be inlined.

 -- C のマクロ: Py_LOCAL_SYMBOL

     Macro used to declare a symbol as local to the shared library
     (hidden).  On supported platforms, it ensures the symbol is not
     exported.

     On compatible versions of GCC/Clang, it expands to
     ‘__attribute__((visibility("hidden")))’.

 -- C のマクロ: Py_EXPORTED_SYMBOL

     Macro used to declare a symbol (function or data) as exported.  On
     Windows, this expands to ‘__declspec(dllexport)’.  On compatible
     versions of GCC/Clang, it expands to
     ‘__attribute__((visibility("default")))’.  This macro is for
     defining the C API itself; extension modules should not use it.

 -- C のマクロ: Py_IMPORTED_SYMBOL

     Macro used to declare a symbol as imported.  On Windows, this
     expands to ‘__declspec(dllimport)’.  This macro is for defining the
     C API itself; extension modules should not use it.

 -- C のマクロ: PyAPI_FUNC (type)

     Macro used by CPython to declare a function as part of the C API.
     Its expansion depends on the platform and build configuration.
     This macro is intended for defining CPython's C API itself;
     extension modules should not use it for their own symbols.

 -- C のマクロ: PyAPI_DATA (type)

     Macro used by CPython to declare a public global variable as part
     of the C API. Its expansion depends on the platform and build
     configuration.  This macro is intended for defining CPython's C API
     itself; extension modules should not use it for their own symbols.

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=33720


File: python.info,  Node: Outdated macros,  Prev: Declaration utilities,  Up: 便利なマクロ

7.1.4.8 Outdated macros
.......................

The following macros have been used to features that have been
standardized in C11.

 -- C のマクロ: Py_ALIGNED (num)

     Specify alignment to 'num' bytes on compilers that support it.

     Consider using the C11 standard ‘_Alignas’ specifier over this
     macro.

 -- C のマクロ: Py_LL (number)
 -- C のマクロ: Py_ULL (number)

     Use 'number' as a ‘long long’ or ‘unsigned long long’ integer
     literal, respectively.

     Expands to 'number' followed by ‘LL’ or ‘LLU’, respectively, but
     will expand to some compiler-specific suffixes on some older
     compilers.

     Consider using the C99 standard suffixes ‘LL’ and ‘LLU’ directly.

 -- C のマクロ: Py_MEMCPY (dest, src, n)

     This is a *note soft deprecated: 23d. alias to ‘memcpy()’.  Use
     ‘memcpy()’ directly instead.

     バージョン 3.14 で非推奨: The macro is *note soft deprecated: 23d.

 -- C のマクロ: Py_VA_COPY

     This is a *note soft deprecated: 23d. alias to the C99-standard
     ‘va_copy’ function.

     Historically, this would use a compiler-specific method to copy a
     ‘va_list’.

     バージョン 3.6 で変更: This is now an alias to ‘va_copy’.


File: python.info,  Node: オブジェクト、型および参照カウント,  Next: 例外<24>,  Prev: 便利なマクロ,  Up: はじめに<14>

7.1.5 オブジェクト、型および参照カウント
----------------------------------------

Python/C API 関数は、 *note PyObject: 5df.* 型の一つ以上の引数と戻り値を
持ちます。この型は、任意の Python オブジェクトを表現する不透明 (opaque)
なデータ型へのポインタです。 Python 言語は、全ての Python オブジェクト型
をほとんどの状況 (例えば代入、スコープ規則 (scope rule)、引数渡し) で同
様に扱います。ほとんど全ての Python オブジェクトはヒープ (heap) 上に置か
れます: このため、 *note PyObject: 5df. 型のオブジェクトは、自動記憶
(automatic) としても静的記憶 (static) としても宣言できません。 *note
PyObject: 5df.* 型のポインタ変数のみ宣言できます。唯一の例外は、型オブジ
ェクトです; 型オブジェクトはメモリ解放 (deallocate) してはならないので、
通常は静的記憶の *note PyTypeObject: c9c. オブジェクトにします。

全ての Python オブジェクトには (Python 整数型ですら) 型 ('type') と参照
カウント ('reference count') があります。あるオブジェクトの型は、そのオ
ブジェクトがどの種類のオブジェクトか (例えば整数、リスト、ユーザ定義関数
、など; その他多数については *note 標準型の階層: 232f. で説明しています)
を決定します。よく知られている型については、各々マクロが存在して、あるオ
ブジェクトがその型かどうか調べられます; 例えば、 ‘PyList_Check(a)’ は、
'a' で示されたオブジェクトが Python リスト型のとき (かつそのときに限り)
真値を返します。

* Menu:

* 参照カウント法: 参照カウント法<2>.
* 型: 型<2>.


File: python.info,  Node: 参照カウント法<2>,  Next: 型<2>,  Up: オブジェクト、型および参照カウント

7.1.5.1 参照カウント法
......................

The reference count is important because today's computers have a finite
(and often severely limited) memory size; it counts how many different
places there are that have a *note strong reference: 5e2. to an object.
Such a place could be another object, or a global (or static) C
variable, or a local variable in some C function.  When the last *note
strong reference: 5e2. to an object is released (i.e.  its reference
count becomes zero), the object is deallocated.  If it contains
references to other objects, those references are released.  Those other
objects may be deallocated in turn, if there are no more references to
them, and so on.  (There's an obvious problem with objects that
reference each other here; for now, the solution is "don't do that.")

Reference counts are always manipulated explicitly.  The normal way is
to use the macro *note Py_INCREF(): 78f. to take a new reference to an
object (i.e.  increment its reference count by one), and *note
Py_DECREF(): 790. to release that reference (i.e.  decrement the
reference count by one).  The *note Py_DECREF(): 790. macro is
considerably more complex than the incref one, since it must check
whether the reference count becomes zero and then cause the object's
deallocator to be called.  The deallocator is a function pointer
contained in the object's type structure.  The type-specific deallocator
takes care of releasing references for other objects contained in the
object if this is a compound object type, such as a list, as well as
performing any additional finalization that's needed.  There's no chance
that the reference count can overflow; at least as many bits are used to
hold the reference count as there are distinct memory locations in
virtual memory (assuming ‘sizeof(Py_ssize_t) >= sizeof(void*)’).  Thus,
the reference count increment is a simple operation.

It is not necessary to hold a *note strong reference: 5e2. (i.e.
increment the reference count) for every local variable that contains a
pointer to an object.  In theory, the object's reference count goes up
by one when the variable is made to point to it and it goes down by one
when the variable goes out of scope.  However, these two cancel each
other out, so at the end the reference count hasn't changed.  The only
real reason to use the reference count is to prevent the object from
being deallocated as long as our variable is pointing to it.  If we know
that there is at least one other reference to the object that lives at
least as long as our variable, there is no need to take a new *note
strong reference: 5e2. (i.e.  increment the reference count)
temporarily.  An important situation where this arises is in objects
that are passed as arguments to C functions in an extension module that
are called from Python; the call mechanism guarantees to hold a
reference to every argument for the duration of the call.

However, a common pitfall is to extract an object from a list and hold
on to it for a while without taking a new reference.  Some other
operation might conceivably remove the object from the list, releasing
that reference, and possibly deallocating it.  The real danger is that
innocent-looking operations may invoke arbitrary Python code which could
do this; there is a code path which allows control to flow back to the
user from a *note Py_DECREF(): 790, so almost any operation is
potentially dangerous.

A safe approach is to always use the generic operations (functions whose
name begins with ‘PyObject_’, ‘PyNumber_’, ‘PySequence_’ or
‘PyMapping_’).  These operations always create a new *note strong
reference: 5e2. (i.e.  increment the reference count) of the object they
return.  This leaves the caller with the responsibility to call *note
Py_DECREF(): 790. when they are done with the result; this soon becomes
second nature.

* Menu:

* 参照カウントの詳細::


File: python.info,  Node: 参照カウントの詳細,  Up: 参照カウント法<2>

7.1.5.2 参照カウントの詳細
..........................

The reference count behavior of functions in the Python/C API is best
explained in terms of 'ownership of references'.  Ownership pertains to
references, never to objects (objects are not owned: they are always
shared).  "Owning a reference" means being responsible for calling
Py_DECREF on it when the reference is no longer needed.  Ownership can
also be transferred, meaning that the code that receives ownership of
the reference then becomes responsible for eventually releasing it by
calling *note Py_DECREF(): 790. or *note Py_XDECREF(): 992. when it's no
longer needed--or passing on this responsibility (usually to its
caller).  When a function passes ownership of a reference on to its
caller, the caller is said to receive a 'new' reference.  When no
ownership is transferred, the caller is said to 'borrow' the reference.
Nothing needs to be done for a *note borrowed reference: 3d7.

逆に、ある関数呼び出しで、あるオブジェクトへの参照を呼び出される関数に渡
す際には、二つの可能性: 関数がオブジェクトへの参照を '盗み取る' (steal)
場合と、そうでない場合があります。'参照を盗む' とは、関数に参照を渡した
ときに、参照の所有者がその関数になったと仮定し、関数の呼び出し元には所有
権がなくなるということです。

参照を盗み取る関数はほとんどありません; 例外としてよく知られているのは、
*note PyList_SetItem(): 18ba. と *note PyTuple_SetItem(): 4eb8. で、これ
らはシーケンスに入れる要素に対する参照を盗み取ります (しかし、要素の入る
先のタプルやリストの参照は盗み取りません!)。これらの関数は、リストやタプ
ルの中に新たに作成されたオブジェクトを入れていく際の常套的な書き方をしや
すくするために、参照を盗み取るように設計されています; 例えば、 ‘(1, 2,
"three")’ というタプルを生成するコードは以下のようになります (とりあえず
例外処理のことは忘れておきます; もっとよい書き方を後で示します):

     PyObject *t;

     t = PyTuple_New(3);
     PyTuple_SetItem(t, 0, PyLong_FromLong(1L));
     PyTuple_SetItem(t, 1, PyLong_FromLong(2L));
     PyTuple_SetItem(t, 2, PyUnicode_FromString("three"));

ここで、 *note PyLong_FromLong(): 1bd0. は新しい参照を返し、すぐに *note
PyTuple_SetItem(): 4eb8. に盗まれます。参照が盗まれた後もそのオブジェク
トを利用したい場合は、参照盗む関数を呼び出す前に、 *note Py_INCREF():
78f. を利用してもう一つの参照を取得してください。

ちなみに、 *note PyTuple_SetItem(): 4eb8. はタプルに値をセットするための
'唯一の' 方法です; タプルは変更不能なデータ型なので、 *note
PySequence_SetItem(): 1e35. や *note PyObject_SetItem(): 4f48. を使うと
上の操作は拒否されてしまいます。自分でタプルの値を入れていくつもりなら、
*note PyTuple_SetItem(): 4eb8. だけしか使えません。

同じく、リストに値を入れていくコードは *note PyList_New(): 4f49. と
*note PyList_SetItem(): 18ba. で書けます。

しかし実際には、タプルやリストを生成して値を入れる際には、上記のような方
法はほとんど使いません。より汎用性のある関数、 *note Py_BuildValue():
3c2. があり、ほとんどの主要なオブジェクトをフォーマット文字列 'format
string' の指定に基づいて C の値から生成できます。例えば、上の二種類のコ
ードブロックは、以下のように置き換えられます (エラーチェックにも配慮して
います):

     PyObject *tuple, *list;

     tuple = Py_BuildValue("(iis)", 1, 2, "three");
     list = Py_BuildValue("[iis]", 1, 2, "three");

It is much more common to use *note PyObject_SetItem(): 4f48. and
friends with items whose references you are only borrowing, like
arguments that were passed in to the function you are writing.  In that
case, their behaviour regarding references is much saner, since you
don't have to take a new reference just so you can give that reference
away ("have it be stolen").  For example, this function sets all items
of a list (actually, any mutable sequence) to a given item:

     int
     set_all(PyObject *target, PyObject *item)
     {
         Py_ssize_t i, n;

         n = PyObject_Length(target);
         if (n < 0)
             return -1;
         for (i = 0; i < n; i++) {
             PyObject *index = PyLong_FromSsize_t(i);
             if (!index)
                 return -1;
             if (PyObject_SetItem(target, index, item) < 0) {
                 Py_DECREF(index);
                 return -1;
             }
             Py_DECREF(index);
         }
         return 0;
     }

関数の戻り値の場合には、状況は少し異なります。ほとんどの関数については、
参照を渡してもその参照に対する所有権が変わることがない一方で、あるオブジ
ェクトに対する参照を返すような多くの関数は、参照に対する所有権を呼び出し
側に与えます。理由は簡単です: 多くの場合、関数が返すオブジェクトはその場
で (on the fly) 生成されるため、呼び出し側が得る参照は生成されたオブジェ
クトに対する唯一の参照になるからです。従って、 *note PyObject_GetItem():
5ea. や *note PySequence_GetItem(): 1e34. のように、オブジェクトに対する
参照を返す汎用の関数は、常に新たな参照を返します (呼び出し側が参照の所有
者になります)。

重要なのは、関数が返す参照の所有権を持てるかどうかは、どの関数を呼び出す
かだけによる、と理解することです -- 関数呼び出し時の 'お飾り' (関数に引
数として渡したオブジェクトの型) は 'この問題には関係ありません!'  従って
、 *note PyList_GetItem(): 5ff. を使ってリスト内の要素を得た場合には、参
照の所有者にはなりません -- が、同じ要素を同じリストから *note
PySequence_GetItem(): 1e34. (図らずもこの関数は全く同じ引数をとります) を
使って取り出すと、返されたオブジェクトに対する参照を得ます。

以下は、整数からなるリストに対して各要素の合計を計算する関数をどのように
して書けるかを示した例です; 一つは *note PyList_GetItem(): 5ff. を使って
いて、もう一つは *note PySequence_GetItem(): 1e34. を使っています。

     long
     sum_list(PyObject *list)
     {
         Py_ssize_t i, n;
         long total = 0, value;
         PyObject *item;

         n = PyList_Size(list);
         if (n < 0)
             return -1; /* Not a list */
         for (i = 0; i < n; i++) {
             item = PyList_GetItem(list, i); /* Can't fail */
             if (!PyLong_Check(item)) continue; /* Skip non-integers */
             value = PyLong_AsLong(item);
             if (value == -1 && PyErr_Occurred())
                 /* Integer too big to fit in a C long, bail out */
                 return -1;
             total += value;
         }
         return total;
     }

     long
     sum_sequence(PyObject *sequence)
     {
         Py_ssize_t i, n;
         long total = 0, value;
         PyObject *item;
         n = PySequence_Length(sequence);
         if (n < 0)
             return -1; /* Has no length */
         for (i = 0; i < n; i++) {
             item = PySequence_GetItem(sequence, i);
             if (item == NULL)
                 return -1; /* Not a sequence, or other failure */
             if (PyLong_Check(item)) {
                 value = PyLong_AsLong(item);
                 Py_DECREF(item);
                 if (value == -1 && PyErr_Occurred())
                     /* Integer too big to fit in a C long, bail out */
                     return -1;
                 total += value;
             }
             else {
                 Py_DECREF(item); /* Discard reference ownership */
             }
         }
         return total;
     }


File: python.info,  Node: 型<2>,  Prev: 参照カウント法<2>,  Up: オブジェクト、型および参照カウント

7.1.5.3 型
..........

他にも Python/C API において重要な役割を持つデータ型がいくつかあります;
ほとんどは int, long, double, および char* といった、単なる C のデータ型
です。また、モジュールで公開している関数を列挙する際に用いられる静的なテ
ーブルや、新しいオブジェクト型におけるデータ属性を記述したり、複素数の値
を記述したりするために構造体をいくつか使っています。これらの型については
、その型を使う関数とともに説明してゆきます。

 -- C のデータ型: type Py_ssize_t
     ' 次に属します: *note Stable ABI: 775.'  A signed integral type
     such that ‘sizeof(Py_ssize_t) == sizeof(size_t)’.  C99 doesn't
     define such a thing directly (size_t is an unsigned integral type).
     See PEP 353(1) for details.  ‘PY_SSIZE_T_MAX’ is the largest
     positive value of type *note Py_ssize_t: c55.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0353/


File: python.info,  Node: 例外<24>,  Next: Python の埋め込み<2>,  Prev: オブジェクト、型および参照カウント,  Up: はじめに<14>

7.1.6 例外
----------

Python プログラマは、特定のエラー処理が必要なときだけしか例外を扱う必要
はありません; 処理しなかった例外は、処理の呼び出し側、そのまた呼び出し側
、といった具合に、トップレベルのインタプリタ層まで自動的に伝播します。イ
ンタプリタ層は、スタックトレースバックと合わせて例外をユーザに報告します
。

ところが、 C プログラマの場合、エラーチェックは常に明示的に行わねばなり
ません。 Python/C API の全ての関数は、関数のドキュメントで明確に説明がな
い限り例外を発行する可能性があります。一般的な話として、ある関数が何らか
のエラーに遭遇すると、関数は例外を設定して、関数内における参照の所有権を
全て放棄し、エラー値 (error indicator) を返します。ドキュメントに書かれ
てない場合、このエラー値は関数の戻り値の型によって、 ‘NULL’ か ‘-1’ のど
ちらかになります。いくつかの関数ではブール型で真/偽を返し、偽はエラーを
示します。きわめて少数の関数では明確なエラー指標を返さなかったり、あいま
いな戻り値を返したりするので、 *note PyErr_Occurred(): 1caf. で明示的に
エラーテストを行う必要があります。これらの例外は常に明示的にドキュメント
化されます。

例外時の状態情報 (exception state)は、スレッド単位に用意された記憶領域
(per-thread storage) 内で管理されます (この記憶領域は、スレッドを使わな
いアプリケーションではグローバルな記憶領域と同じです)。一つのスレッドは
二つの状態のどちらか: 例外が発生したか、まだ発生していないか、をとります
。関数 *note PyErr_Occurred(): 1caf. を使うと、この状態を調べられます: こ
の関数は例外が発生した際にはその例外型オブジェクトに対する借用参照
(borrowed reference) を返し、そうでないときには ‘NULL’ を返します。例外
状態を設定する関数は数多くあります: *note PyErr_SetString(): 79c. はもっ
ともよく知られている (が、もっとも汎用性のない) 例外を設定するための関数
で、 *note PyErr_Clear(): 1232. は例外状態情報を消し去る関数です。

完全な例外状態情報は、3 つのオブジェクト: 例外の型、例外の値、そしてトレ
ースバック、からなります (どのオブジェクトも ‘NULL’ を取り得ます)。これ
らの情報は、 Python の ‘sys.exc_info()’ の結果と同じ意味を持ちます; とは
いえ、 C と Python の例外状態情報は全く同じではありません: Python におけ
る例外オブジェクトは、Python の *note try: 8f8. ...  *note except: 1ab.
文で最近処理したオブジェクトを表す一方、 C レベルの例外状態情報が存続す
るのは、渡された例外情報を ‘sys.exc_info()’ その他に転送するよう取り計ら
う Python のバイトコードインタプリタのメインループに到達するまで、例外が
関数の間で受け渡しされている間だけです。

Python 1.5 からは、Python で書かれたコードから例外状態情報にアクセスする
方法として、推奨されていてスレッドセーフな方法は *note sys.exc_info():
89a. になっているので注意してください。この関数は Python コードの実行さ
れているスレッドにおける例外状態情報を返します。また、これらの例外状態情
報に対するアクセス手段は、両方とも意味づけ (semantics) が変更され、ある
関数が例外を捕捉すると、その関数を実行しているスレッドの例外状態情報を保
存して、呼び出し側の例外状態情報を維持するようになりました。この変更によ
って、無害そうに見える関数が現在扱っている例外を上書きすることで引き起こ
される、例外処理コードでよくおきていたバグを抑止しています; また、トレー
スバック内のスタックフレームで参照されているオブジェクトがしばしば不必要
に寿命を永らえていたのをなくしています。

一般的な原理として、ある関数が別の関数を呼び出して何らかの作業をさせると
き、呼び出し先の関数が例外を送出していないか調べなくてはならず、もし送出
していれば、その例外状態情報は呼び出し側に渡されなければなりません。呼び
出し元の関数はオブジェクト参照の所有権をすべて放棄し、エラー指標を返さな
くてはなりませんが、余計に例外を設定する必要は 'ありません' -- そんなこ
とをすれば、たった今送出されたばかりの例外を上書きしてしまい、エラーの原
因そのものに関する重要な情報を失うことになります。

A simple example of detecting exceptions and passing them on is shown in
the ‘sum_sequence()’ example above.  It so happens that this example
doesn't need to clean up any owned references when it detects an error.
The following example function shows some error cleanup.  First, to
remind you why you like Python, we show the equivalent Python code:

     def incr_item(dict, key):
         try:
             item = dict[key]
         except KeyError:
             item = 0
         dict[key] = item + 1

以下は対応するコードを C で完璧に書いたものです:

     int
     incr_item(PyObject *dict, PyObject *key)
     {
         /* Objects all initialized to NULL for Py_XDECREF */
         PyObject *item = NULL, *const_one = NULL, *incremented_item = NULL;
         int rv = -1; /* Return value initialized to -1 (failure) */

         item = PyObject_GetItem(dict, key);
         if (item == NULL) {
             /* Handle KeyError only: */
             if (!PyErr_ExceptionMatches(PyExc_KeyError))
                 goto error;

             /* Clear the error and use zero: */
             PyErr_Clear();
             item = PyLong_FromLong(0L);
             if (item == NULL)
                 goto error;
         }
         const_one = PyLong_FromLong(1L);
         if (const_one == NULL)
             goto error;

         incremented_item = PyNumber_Add(item, const_one);
         if (incremented_item == NULL)
             goto error;

         if (PyObject_SetItem(dict, key, incremented_item) < 0)
             goto error;
         rv = 0; /* Success */
         /* Continue with cleanup code */

      error:
         /* Cleanup code, shared by success and failure path */

         /* Use Py_XDECREF() to ignore NULL references */
         Py_XDECREF(item);
         Py_XDECREF(const_one);
         Py_XDECREF(incremented_item);

         return rv; /* -1 for error, 0 for success */
     }

なんとこの例は C で ‘goto’ 文を使うお勧めの方法まで示していますね!  この
例では、特定の例外を処理するために *note PyErr_ExceptionMatches(): 4f4e.
および *note PyErr_Clear(): 1232. をどう使うかを示しています。また、所有
権を持っている参照で、値が ‘NULL’ になるかもしれないものを捨てるために
*note Py_XDECREF(): 992. をどう使うかも示しています (関数名に ‘'X'’ が付
いていることに注意してください; *note Py_DECREF(): 790. は ‘NULL’ 参照に
出くわすとクラッシュします)。正しく動作させるためには、所有権を持つ参照
を保持するための変数を ‘NULL’ で初期化することが重要です; 同様に、あらか
じめ戻り値を定義する際には値を ‘-1’ (失敗) で初期化しておいて、最後の関
数呼び出しまでうまくいった場合にのみ ‘0’ (成功) に設定します。


File: python.info,  Node: Python の埋め込み<2>,  Next: デバッグ版ビルド Debugging Builds,  Prev: 例外<24>,  Up: はじめに<14>

7.1.7 Python の埋め込み
-----------------------

Python インタプリタの埋め込みを行う人 (いわば拡張モジュールの書き手の対
極) が気にかけなければならない重要なタスクは、Python インタプリタの初期
化処理 (initialization)、そしておそらくは終了処理 (finalization) です。
インタプリタのほとんどの機能は、インタプリタの起動後しか使えません。

基本的な初期化処理を行う関数は *note Py_Initialize(): 460. です。この関
数はロード済みのモジュールからなるテーブルを作成し、土台となるモジュール
*note builtins: 13, *note __main__: 1, および *note sys: df. を作成しま
す。また、モジュール検索パス (‘sys.path’) の初期化も行います。

*note Py_Initialize(): 460. does not set the "script argument list"
(‘sys.argv’).  If this variable is needed by Python code that will be
executed later, setting *note PyConfig.argv: 3f1. and *note
PyConfig.parse_argv: 1cf1. must be set: see *note Python Initialization
Configuration: 646.

ほとんどのシステムでは (特に Unix と Windows は、詳細がわずかに異なりは
しますが)、 *note Py_Initialize(): 460. は標準の Python インタプリタ実行
形式の場所に対する推定結果に基づいて、 Python のライブラリが Python イン
タプリタ実行形式からの相対パスで見つかるという仮定の下にモジュール検索パ
スを計算します。とりわけこの検索では、シェルコマンド検索パス (環境変数
‘PATH’) 上に見つかった ‘python’ という名前の実行ファイルの置かれているデ
ィレクトリの親ディレクトリからの相対で、 ‘lib/python`X.Y'’ という名前の
ディレクトリを探します。

例えば、 Python 実行形式が ‘/usr/local/bin/python’ で見つかったとすると
、ライブラリが ‘/usr/local/lib/python`X.Y'’ にあるものと仮定します。 (実
際には、このパスは "フォールバック (fallback)" のライブラリ位置でもあり
、 ‘python’ が ‘PATH’ 上に無い場合に使われます。) ユーザは *note
PYTHONHOME: 3f0. を設定することでこの動作をオーバーライドしたり、 *note
PYTHONPATH: 121f. を設定して追加のディレクトリを標準モジュール検索パスの
前に挿入したりできます。

The embedding application can steer the search by setting *note
PyConfig.program_name: 3f2. 'before' calling *note
Py_InitializeFromConfig(): 3f6.  Note that *note PYTHONHOME: 3f0. still
overrides this and *note PYTHONPATH: 121f. is still inserted in front of
the standard path.  An application that requires total control has to
provide its own implementation of *note Py_GetPath(): 3e3, *note
Py_GetPrefix(): 3e5, *note Py_GetExecPrefix(): 3e9, and *note
Py_GetProgramFullPath(): 3ec. (all defined in ‘Modules/getpath.c’).

たまに、 Python を初期化前の状態にもどしたいことがあります。例えば、ある
アプリケーションでは実行を最初からやりなおし (start over) させる (*note
Py_Initialize(): 460. をもう一度呼び出させる) ようにしたいかもしれません
。あるいは、アプリケーションが Python を一旦使い終えて、Python が確保し
たメモリを解放させたいかもしれません。 *note Py_FinalizeEx(): f11. を使
うとこうした処理を実現できます。また、関数 *note Py_IsInitialized():
4f51. は、Python が現在初期化済みの状態にある場合に真を返します。これら
の関数についてのさらなる情報は、後の章で説明します。 *note
Py_FinalizeEx(): f11. がPythonインタプリタに確保された全てのメモリを '解
放するわけではない' ことに注意してください。例えば、拡張モジュールによっ
て確保されたメモリは、現在のところ解放する事ができません。


File: python.info,  Node: デバッグ版ビルド Debugging Builds,  Next: おすすめのサードパーティツール<2>,  Prev: Python の埋め込み<2>,  Up: はじめに<14>

7.1.8 デバッグ版ビルド (Debugging Builds)
-----------------------------------------

インタプリタと拡張モジュールに対しての追加チェックをするためのいくつかの
マクロを有効にしてPythonをビルドすることができます。これらのチェックは、
実行時に大きなオーバーヘッドを生じる傾向があります。なので、デフォルトで
は有効にされていません。

Pythonデバッグ版ビルドの全ての種類のリストが、Pythonソース配布(source
distribution)の中の ‘Misc/SpecialBuilds.txt’ にあります。参照カウントの
トレース、メモリアロケータのデバッグ、インタプリタのメインループの低レベ
ルプロファイリングが利用可能です。よく使われるビルドについてのみ、この節
の残りの部分で説明します。

 -- C のマクロ: Py_DEBUG

Compiling the interpreter with the ‘Py_DEBUG’ macro defined produces
what is generally meant by *note a debug build of Python: 509.
‘Py_DEBUG’ is enabled in the Unix build by adding *note -with-pydebug:
666. to the ‘./configure’ command.  It is also implied by the presence
of the not-Python-specific ‘_DEBUG’ macro.  When ‘Py_DEBUG’ is enabled
in the Unix build, compiler optimization is disabled.

In addition to the reference count debugging described below, extra
checks are performed, see *note Python Debug Build: 509.

‘Py_TRACE_REFS’ を宣言すると、参照トレースが有効になります (*note
configure -with-trace-refs オプション: 636. を参照してください)。全ての
*note PyObject: 5df. に二つのフィールドを追加することで、使用中のオブジ
ェクトの循環二重連結リストが管理されます。全ての割り当て(allocation)がト
レースされます。終了時に、全ての残っているオブジェクトが表示されます。
(インタラクティブモードでは、インタプリタによる文の実行のたびに表示され
ます。)

より詳しい情報については、Pythonのソース配布(source distribution)の中の
‘Misc/SpecialBuilds.txt’ を参照してください。


File: python.info,  Node: おすすめのサードパーティツール<2>,  Prev: デバッグ版ビルド Debugging Builds,  Up: はじめに<14>

7.1.9 おすすめのサードパーティツール
------------------------------------

The following third party tools offer both simpler and more
sophisticated approaches to creating C, C++ and Rust extensions for
Python:

   * Cython(1)

   * cffi(2)

   * HPy(3)

   * nanobind(4) (C++)

   * Numba(5)

   * pybind11(6) (C++)

   * PyO3(7) (Rust)

   * SWIG(8)

Using tools such as these can help avoid writing code that is tightly
bound to a particular version of CPython, avoid reference counting
errors, and focus more on your own code than on using the CPython API.
In general, new versions of Python can be supported by updating the
tool, and your code will often use newer and more efficient APIs
automatically.  Some tools also support compiling for other
implementations of Python from a single set of sources.

These projects are not supported by the same people who maintain Python,
and issues need to be raised with the projects directly.  Remember to
check that the project is still maintained and supported, as the list
above may become outdated.

参考
....

Python Packaging User Guide: Binary Extensions(9)

     Python Packaging User Guideはバイナリ拡張の作成が簡単になる便利なツ
     ールをカバーしているだけではなく、まず始めになぜ拡張モジュールを作
     ることが望ましいかの様々な理由について議論しています。

   ---------- Footnotes ----------

   (1) https://cython.org/

   (2) https://cffi.readthedocs.io

   (3) https://hpyproject.org/

   (4) https://github.com/wjakob/nanobind

   (5) https://numba.pydata.org/

   (6) https://pybind11.readthedocs.io/

   (7) https://pyo3.rs/

   (8) https://www.swig.org

   (9) https://packaging.python.org/guides/packaging-binary-extensions/


File: python.info,  Node: C API の安定性,  Next: 超高水準レイヤ,  Prev: はじめに<14>,  Up: Python/C API リファレンスマニュアル

7.2 C API の安定性
==================

Unless documented otherwise, Python's C API is covered by the Backwards
Compatibility Policy, PEP 387(1).  Most changes to it are
source-compatible (typically by only adding new API). Changing existing
API or removing API is only done after a deprecation period or to fix
serious issues.

CPython's Application Binary Interface (ABI) is forward- and
backwards-compatible across a minor release (if these are compiled the
same way; see *note プラットフォームで考慮すべき点: 4f58. below).  So,
code compiled for Python 3.10.0 will work on 3.10.8 and vice versa, but
will need to be compiled separately for 3.9.x and 3.11.x.

There are two tiers of C API with different stability expectations:

   - *note Unstable API: 769, may change in minor versions without a
     deprecation period.  It is marked by the ‘PyUnstable’ prefix in
     names.

   - *note Limited API: 637, is compatible across several minor
     releases.  When *note Py_LIMITED_API: 660. is defined, only this
     subset is exposed from ‘Python.h’.

These are discussed in more detail below.

Names prefixed by an underscore, such as ‘_Py_InternalState’, are
private API that can change without notice even in patch releases.  If
you need to use this API, consider reaching out to CPython developers(2)
to discuss adding public API for your use case.

* Menu:

* Unstable C API::
* 安定 ABI (Stable Appliction Binary Interface): 安定 ABI Stable Appliction Binary Interface.
* プラットフォームで考慮すべき点::
* 限定版APIの内容::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0387/

   (2) https://discuss.python.org/c/core-dev/c-api/30


File: python.info,  Node: Unstable C API,  Next: 安定 ABI Stable Appliction Binary Interface,  Up: C API の安定性

7.2.1 Unstable C API
--------------------

Any API named with the ‘PyUnstable’ prefix exposes CPython
implementation details, and may change in every minor release (e.g.
from 3.9 to 3.10) without any deprecation warnings.  However, it will
not change in a bugfix release (e.g.  from 3.10.0 to 3.10.1).

It is generally intended for specialized, low-level tools like
debuggers.

Projects that use this API are expected to follow CPython development
and spend extra effort adjusting to changes.


File: python.info,  Node: 安定 ABI Stable Appliction Binary Interface,  Next: プラットフォームで考慮すべき点,  Prev: Unstable C API,  Up: C API の安定性

7.2.2 安定 ABI (Stable Appliction Binary Interface)
---------------------------------------------------

For simplicity, this document talks about 'extensions', but the Limited
API and Stable ABI work the same way for all uses of the API – for
example, embedding Python.

* Menu:

* Limited C API::
* Stable ABI::
* APIスコープとパフォーマンスの制限::
* 制限付きAPIの注意点::


File: python.info,  Node: Limited C API,  Next: Stable ABI,  Up: 安定 ABI Stable Appliction Binary Interface

7.2.2.1 Limited C API
.....................

Python 3.2 introduced the 'Limited API', a subset of Python's C API.
Extensions that only use the Limited API can be compiled once and be
loaded on multiple versions of Python.  Contents of the Limited API are
*note listed below: 99d.

 -- C のマクロ: Py_LIMITED_API

     このマクロを ‘Python.h’ をインクルードする前に定義することで、
     Limited API のみを使用することを選択し、 Limited API バージョンを選
     択することができます。

     Define ‘Py_LIMITED_API’ to the value of *note PY_VERSION_HEX: 382.
     corresponding to the lowest Python version your extension supports.
     The extension will be ABI-compatible with all Python 3 releases
     from the specified one onward, and can use Limited API introduced
     up to that version.

     ‘PY_VERSION_HEX’ マクロを直接使うのではなく、将来の Python のバージ
     ョンでコンパイルするときの安定性のために、最小のマイナーバージョン
     (例えば、 Python 3.10なら ‘0x030A0000’ )をハードコードします。

     また、 ‘Py_LIMITED_API’ を ‘3’ に定義することができます。これは
     ‘0x03020000’ (Python 3.2, Limited API が導入されたバージョン)と同じ
     ように動作します。


File: python.info,  Node: Stable ABI,  Next: APIスコープとパフォーマンスの制限,  Prev: Limited C API,  Up: 安定 ABI Stable Appliction Binary Interface

7.2.2.2 Stable ABI
..................

To enable this, Python provides a 'Stable ABI': a set of symbols that
will remain ABI-compatible across Python 3.x versions.

     注釈: The Stable ABI prevents ABI issues, like linker errors due to
     missing symbols or data corruption due to changes in structure
     layouts or function signatures.  However, other changes in Python
     can change the 'behavior' of extensions.  See Python's Backwards
     Compatibility Policy ( PEP 387(1)) for details.

The Stable ABI contains symbols exposed in the *note Limited API: 637,
but also other ones – for example, functions necessary to support older
versions of the Limited API.

Windows では、 Stable ABI を使用する拡張機能は、 ‘python39.dll’ のような
バージョン固有のライブラリではなく、 ‘python3.dll’ に対してリンクする必
要があります。

いくつかのプラットフォームでは、 Python は ‘abi3’ タグで名付けられた共有
ライブラリファイルを探して読み込みます(例: ‘mymodule.abi3.so’)。このよう
な拡張モジュールが Stable ABI に適合しているかどうかはチェックされません
。ユーザー(またはそのパッケージングツール)は、たとえば 3.10+ Limited API
でビルドされた拡張モジュールが、それ以下のバージョンの Python にインスト
ールされないことを確認する必要があります。

Stable ABI に含まれるすべての関数は、マクロとしてだけでなく、 Python の
共有ライブラリの関数として存在します。そのため、Cプリプロセッサを使用し
ない言語から使用することができます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0387/


File: python.info,  Node: APIスコープとパフォーマンスの制限,  Next: 制限付きAPIの注意点,  Prev: Stable ABI,  Up: 安定 ABI Stable Appliction Binary Interface

7.2.2.3 APIスコープとパフォーマンスの制限
.........................................

Limited API の目標は、フル C API で可能なすべてのことを実現することです
が、おそらく性能上の制約があります。

例えば、 *note PyList_GetItem(): 5ff. は利用可能ですが、その “unsafe” マ
クロの変種 *note PyList_GET_ITEM(): 4f5f. は利用できません。このマクロは
、リストオブジェクトのバージョン固有の実装の詳細に依存することができるた
め、より高速に処理することができます。

‘Py_LIMITED_API’ を定義しないと、いくつかの C API 関数がインライン化され
たり、マクロに置き換わったりします。‘Py_LIMITED_API’ を定義すると、この
インライン化が無効になり、 Python のデータ構造が改善されても安定した動作
が可能になりますが、性能が低下する可能性があります。

‘Py_LIMITED_API’ の定義を省くことで、 Limited API 拡張をバージョン固有の
ABI でコンパイルすることが可能です。これにより、その Python のバージョン
でパフォーマンスを向上させることができますが、互換性は制限されます。
‘Py_LIMITED_API’ でコンパイルすると、バージョンに依存しない拡張機能が利
用できない場合、例えば、次期 Python バージョンのプレリリースに対応した拡
張モジュールを配布することができるようになります。


File: python.info,  Node: 制限付きAPIの注意点,  Prev: APIスコープとパフォーマンスの制限,  Up: 安定 ABI Stable Appliction Binary Interface

7.2.2.4 制限付きAPIの注意点
...........................

Note that compiling with ‘Py_LIMITED_API’ is 'not' a complete guarantee
that code conforms to the *note Limited API: 637. or the *note Stable
ABI: 4f5d.  ‘Py_LIMITED_API’ only covers definitions, but an API also
includes other issues, such as expected semantics.

‘Py_LIMITED_API’ が防げない問題の1つは、 Python の下位バージョンでは無効
な引数を持つ関数を呼び出すことです。例えば、引数に ‘NULL’ を受け取る関数
を考えてみましょう。Python 3.9 では ‘NULL’ はデフォルトの挙動を選択しま
すが、Python 3.8 ではこの引数は直接使用され、 ‘NULL’ の参照外れを起こし
クラッシュします。同様の引数は、構造体のフィールドに対しても機能します。

もう一つの問題は、一部の構造体フィールドがLimited APIの一部であるにもか
かわらず、 ‘Py_LIMITED_API’ が定義されたときに現在非表示になっていないこ
とです。

これらの理由から、私たちは拡張モジュールがサポートする 'すべての' マイナ
ーな Python バージョンでテストすること、そしてできれば '最も低い' バージ
ョンでビルドすることを推奨します。

また、使用するすべての API のドキュメントを確認し、それが明示的に
Limited API の一部であるかどうかをチェックすることをお勧めします。
‘Py_LIMITED_API’ が定義されていても、技術的な理由で(あるいはバグとして意
図せず)いくつかのプライベート宣言が公開されることがあります。

Python 3.8 で ‘Py_LIMITED_API’ をコンパイルすると、その拡張モジュールは
Python 3.12 で動作しますが、必ずしも Python 3.12 で 'コンパイル' できる
とは限らないことに注意してください。特に、Limited API の一部は、 Stable
ABI が安定している限り、非推奨で削除されるかもしれません。


File: python.info,  Node: プラットフォームで考慮すべき点,  Next: 限定版APIの内容,  Prev: 安定 ABI Stable Appliction Binary Interface,  Up: C API の安定性

7.2.3 プラットフォームで考慮すべき点
------------------------------------

ABI stability depends not only on Python, but also on the compiler used,
lower-level libraries and compiler options.  For the purposes of the
*note Stable ABI: 4f5d, these details define a “platform”.  They usually
depend on the OS type and processor architecture

特定のプラットフォーム上のすべての Python バージョンが安定版 ABI を破壊
しない方法でビルドされていることを保証するのは、 Python の各特定配布者の
責任です。これは ‘python.org’ や多くのサードパーティーの配布元からの
Windows と macOS のリリースの場合です。


File: python.info,  Node: 限定版APIの内容,  Prev: プラットフォームで考慮すべき点,  Up: C API の安定性

7.2.4 限定版APIの内容
---------------------

Currently, the *note Limited API: 637. includes the following items:

   * *note METH_CLASS: 16ee.

   * *note METH_COEXIST: 1690.

   * *note METH_FASTCALL: 199e.

   * *note METH_METHOD: b68.

   * *note METH_NOARGS: 16ed.

   * *note METH_O: 1720.

   * *note METH_STATIC: 16ef.

   * *note METH_VARARGS: 1721.

   * *note PY_VECTORCALL_ARGUMENTS_OFFSET: 780.

   * *note PyAIter_Check(): 4f63.

   * *note PyArg_Parse(): 180e.

   * *note PyArg_ParseTuple(): 3c1.

   * *note PyArg_ParseTupleAndKeywords(): 624.

   * *note PyArg_UnpackTuple(): 171f.

   * *note PyArg_VaParse(): 4f64.

   * *note PyArg_VaParseTupleAndKeywords(): 625.

   * *note PyArg_ValidateKeywordArguments(): 4f65.

   * *note PyBUF_ANY_CONTIGUOUS: 4f66.

   * *note PyBUF_CONTIG: 4f67.

   * *note PyBUF_CONTIG_RO: 4f68.

   * *note PyBUF_C_CONTIGUOUS: 15d0.

   * *note PyBUF_FORMAT: 4f69.

   * *note PyBUF_FULL: 4f6a.

   * *note PyBUF_FULL_RO: 4f6b.

   * *note PyBUF_F_CONTIGUOUS: 15d1.

   * *note PyBUF_INDIRECT: 4f6c.

   * *note PyBUF_MAX_NDIM: 4f6d.

   * *note PyBUF_ND: 4f6e.

   * *note PyBUF_READ: 1a0b.

   * *note PyBUF_RECORDS: 4f6f.

   * *note PyBUF_RECORDS_RO: 4f70.

   * *note PyBUF_SIMPLE: 4f71.

   * *note PyBUF_STRIDED: 4f72.

   * *note PyBUF_STRIDED_RO: 4f73.

   * *note PyBUF_STRIDES: 4f74.

   * *note PyBUF_WRITABLE: 15cf.

   * *note PyBUF_WRITE: 1a0c.

   * *note PyBaseObject_Type: 4f75.

   * *note PyBool_FromLong(): 4f76.

   * *note PyBool_Type: 4f77.

   * *note PyBuffer_FillContiguousStrides(): 963.

   * *note PyBuffer_FillInfo(): 964.

   * *note PyBuffer_FromContiguous(): 960.

   * *note PyBuffer_GetPointer(): 95d.

   * *note PyBuffer_IsContiguous(): 962.

   * *note PyBuffer_Release(): 63b.

   * *note PyBuffer_SizeFromFormat(): 95e.

   * *note PyBuffer_ToContiguous(): 95f.

   * *note PyByteArrayIter_Type: 4f78.

   * *note PyByteArray_AsString(): 4f79.

   * *note PyByteArray_Concat(): 4f7a.

   * *note PyByteArray_FromObject(): 15c2.

   * *note PyByteArray_FromStringAndSize(): 15c3.

   * *note PyByteArray_Resize(): 4f7b.

   * *note PyByteArray_Size(): 4f7c.

   * *note PyByteArray_Type: 4f7d.

   * *note PyBytesIter_Type: 4f7e.

   * *note PyBytes_AsString(): a87.

   * *note PyBytes_AsStringAndSize(): 4f7f.

   * *note PyBytes_Concat(): 4f80.

   * *note PyBytes_ConcatAndDel(): 4f81.

   * *note PyBytes_DecodeEscape(): 4f82.

   * *note PyBytes_FromFormat(): 1e0b.

   * *note PyBytes_FromFormatV(): 4f83.

   * *note PyBytes_FromObject(): 4f84.

   * *note PyBytes_FromString(): 4f85.

   * *note PyBytes_FromStringAndSize(): 15b8.

   * *note PyBytes_Repr(): 4f86.

   * *note PyBytes_Size(): 4f87.

   * *note PyBytes_Type: 4f88.

   * *note PyCFunction: 1691.

   * *note PyCFunctionFast: 4f89.

   * *note PyCFunctionFastWithKeywords: 4f8a.

   * *note PyCFunctionWithKeywords: 4f8b.

   * *note PyCFunction_GetFlags(): 4f8c.

   * *note PyCFunction_GetFunction(): 4f8d.

   * *note PyCFunction_GetSelf(): 4f8e.

   * *note PyCFunction_New(): 1cb1.

   * *note PyCFunction_NewEx(): 1d76.

   * *note PyCFunction_Type: 4f8f.

   * *note PyCMethod_New(): 1cab.

   * *note PyCallIter_New(): 4f90.

   * *note PyCallIter_Type: 4f91.

   * *note PyCallable_Check(): 4f92.

   * *note PyCapsule_Destructor: 4f93.

   * *note PyCapsule_GetContext(): 4f94.

   * *note PyCapsule_GetDestructor(): 4f95.

   * *note PyCapsule_GetName(): 4f96.

   * *note PyCapsule_GetPointer(): 4f97.

   * *note PyCapsule_Import(): 1c10.

   * *note PyCapsule_IsValid(): 1574.

   * *note PyCapsule_New(): 4ec3.

   * *note PyCapsule_SetContext(): 4f98.

   * *note PyCapsule_SetDestructor(): 4f99.

   * *note PyCapsule_SetName(): 4f9a.

   * *note PyCapsule_SetPointer(): 4f9b.

   * *note PyCapsule_Type: 4f9c.

   * *note PyClassMethodDescr_Type: 4f9d.

   * *note PyCodec_BackslashReplaceErrors(): 4f9e.

   * *note PyCodec_Decode(): 3e1.

   * *note PyCodec_Decoder(): 4f9f.

   * *note PyCodec_Encode(): 3e2.

   * *note PyCodec_Encoder(): 4fa0.

   * *note PyCodec_IgnoreErrors(): 4fa1.

   * *note PyCodec_IncrementalDecoder(): 4fa2.

   * *note PyCodec_IncrementalEncoder(): 4fa3.

   * *note PyCodec_KnownEncoding(): 4fa4.

   * *note PyCodec_LookupError(): 4fa5.

   * *note PyCodec_NameReplaceErrors(): 10af.

   * *note PyCodec_Register(): 4fa6.

   * *note PyCodec_RegisterError(): 4fa7.

   * *note PyCodec_ReplaceErrors(): 4fa8.

   * *note PyCodec_StreamReader(): 4fa9.

   * *note PyCodec_StreamWriter(): 4faa.

   * *note PyCodec_StrictErrors(): 4fab.

   * *note PyCodec_Unregister(): a97.

   * *note PyCodec_XMLCharRefReplaceErrors(): 4fac.

   * *note PyComplex_FromDoubles(): 4fad.

   * *note PyComplex_ImagAsDouble(): 1a13.

   * *note PyComplex_RealAsDouble(): 1a12.

   * *note PyComplex_Type: 4fae.

   * *note PyDescr_NewClassMethod(): 4faf.

   * *note PyDescr_NewGetSet(): 4fb0.

   * *note PyDescr_NewMember(): 4fb1.

   * *note PyDescr_NewMethod(): 1d75.

   * *note PyDictItems_Type: 4fb2.

   * *note PyDictIterItem_Type: 4fb3.

   * *note PyDictIterKey_Type: 4fb4.

   * *note PyDictIterValue_Type: 4fb5.

   * *note PyDictKeys_Type: 4fb6.

   * *note PyDictProxy_New(): 4fb7.

   * *note PyDictProxy_Type: 4fb8.

   * *note PyDictRevIterItem_Type: 4fb9.

   * *note PyDictRevIterKey_Type: 4fba.

   * *note PyDictRevIterValue_Type: 4fbb.

   * *note PyDictValues_Type: 4fbc.

   * *note PyDict_Clear(): 4fbd.

   * *note PyDict_Contains(): 5de.

   * *note PyDict_Copy(): 662.

   * *note PyDict_DelItem(): 4fbe.

   * *note PyDict_DelItemString(): 4fbf.

   * *note PyDict_GetItem(): 628.

   * *note PyDict_GetItemRef(): 5e0.

   * *note PyDict_GetItemString(): 629.

   * *note PyDict_GetItemStringRef(): 421.

   * *note PyDict_GetItemWithError(): 5e1.

   * *note PyDict_Items(): 4fc0.

   * *note PyDict_Keys(): 4fc1.

   * *note PyDict_Merge(): 4fc2.

   * *note PyDict_MergeFromSeq2(): 4fc3.

   * *note PyDict_New(): 4fc4.

   * *note PyDict_Next(): 198f.

   * *note PyDict_SetItem(): 4eb9.

   * *note PyDict_SetItemString(): 198d.

   * *note PyDict_Size(): 4fc5.

   * *note PyDict_Type: 4fc6.

   * *note PyDict_Update(): 4fc7.

   * *note PyDict_Values(): 4fc8.

   * *note PyEllipsis_Type: 4fc9.

   * *note PyEnum_Type: 4fca.

   * *note PyErr_BadArgument(): 4fcb.

   * *note PyErr_BadInternalCall(): 4fcc.

   * *note PyErr_CheckSignals(): 693.

   * *note PyErr_Clear(): 1232.

   * ‘PyErr_Display()’

   * *note PyErr_DisplayException(): 435.

   * *note PyErr_ExceptionMatches(): 4f4e.

   * *note PyErr_Fetch(): 428.

   * *note PyErr_Format(): 10b1.

   * *note PyErr_FormatV(): 10b0.

   * *note PyErr_GetExcInfo(): 976.

   * *note PyErr_GetHandledException(): 973.

   * *note PyErr_GetRaisedException(): 429.

   * *note PyErr_GivenExceptionMatches(): 4fcd.

   * *note PyErr_NewException(): 1481.

   * *note PyErr_NewExceptionWithDoc(): 1480.

   * *note PyErr_NoMemory(): 4e99.

   * *note PyErr_NormalizeException(): 42a.

   * *note PyErr_Occurred(): 1caf.

   * *note PyErr_Print(): 1d2c.

   * *note PyErr_PrintEx(): 4fce.

   * *note PyErr_ProgramText(): 4fcf.

   * *note PyErr_ResourceWarning(): f13.

   * *note PyErr_Restore(): 42b.

   * *note PyErr_SetExcFromWindowsErr(): 4fd0.

   * *note PyErr_SetExcFromWindowsErrWithFilename(): 1a86.

   * *note PyErr_SetExcFromWindowsErrWithFilenameObject(): 4fd1.

   * *note PyErr_SetExcFromWindowsErrWithFilenameObjects(): 4fd2.

   * *note PyErr_SetExcInfo(): 975.

   * *note PyErr_SetFromErrno(): 4e98.

   * *note PyErr_SetFromErrnoWithFilename(): 1a85.

   * *note PyErr_SetFromErrnoWithFilenameObject(): 4fd3.

   * *note PyErr_SetFromErrnoWithFilenameObjects(): 4fd4.

   * *note PyErr_SetFromWindowsErr(): 4fd5.

   * *note PyErr_SetFromWindowsErrWithFilename(): 1a87.

   * *note PyErr_SetHandledException(): 974.

   * *note PyErr_SetImportError(): f39.

   * *note PyErr_SetImportErrorSubclass(): f12.

   * *note PyErr_SetInterrupt(): 4fd6.

   * *note PyErr_SetInterruptEx(): a9e.

   * *note PyErr_SetNone(): 4fd7.

   * *note PyErr_SetObject(): 79b.

   * *note PyErr_SetRaisedException(): 42c.

   * *note PyErr_SetString(): 79c.

   * *note PyErr_SyntaxLocation(): 4fd8.

   * *note PyErr_SyntaxLocationEx(): 4fd9.

   * *note PyErr_WarnEx(): 1665.

   * *note PyErr_WarnExplicit(): 1a8d.

   * *note PyErr_WarnFormat(): 4fda.

   * *note PyErr_WriteUnraisable(): 5f2.

   * *note PyEval_AcquireThread(): 649.

   * *note PyEval_EvalCode(): a86.

   * *note PyEval_EvalCodeEx(): 1ada.

   * *note PyEval_EvalFrame(): 4fdb.

   * *note PyEval_EvalFrameEx(): 122f.

   * *note PyEval_GetBuiltins(): 5f4.

   * *note PyEval_GetFrame(): 1b39.

   * *note PyEval_GetFrameBuiltins(): 5f3.

   * *note PyEval_GetFrameGlobals(): 5f5.

   * *note PyEval_GetFrameLocals(): 5f7.

   * *note PyEval_GetFuncDesc(): 4fdc.

   * *note PyEval_GetFuncName(): 4fdd.

   * *note PyEval_GetGlobals(): 5f6.

   * *note PyEval_GetLocals(): 5f8.

   * *note PyEval_InitThreads(): 19b9.

   * *note PyEval_ReleaseThread(): 4fde.

   * *note PyEval_RestoreThread(): 648.

   * *note PyEval_SaveThread(): 647.

   * *note PyExc_ArithmeticError: 4fdf.

   * *note PyExc_AssertionError: 4fe0.

   * *note PyExc_AttributeError: 4fe1.

   * *note PyExc_BaseException: 4fe2.

   * *note PyExc_BaseExceptionGroup: 4fe3.

   * *note PyExc_BlockingIOError: 4fe4.

   * *note PyExc_BrokenPipeError: 4fe5.

   * *note PyExc_BufferError: 4fe6.

   * *note PyExc_BytesWarning: 4fe7.

   * *note PyExc_ChildProcessError: 4fe8.

   * *note PyExc_ConnectionAbortedError: 4fe9.

   * *note PyExc_ConnectionError: 4fea.

   * *note PyExc_ConnectionRefusedError: 4feb.

   * *note PyExc_ConnectionResetError: 4fec.

   * *note PyExc_DeprecationWarning: 4fed.

   * *note PyExc_EOFError: 4fee.

   * *note PyExc_EncodingWarning: 4fef.

   * *note PyExc_EnvironmentError: 4ff0.

   * *note PyExc_Exception: 4ff1.

   * *note PyExc_FileExistsError: 4ff2.

   * *note PyExc_FileNotFoundError: 4ff3.

   * *note PyExc_FloatingPointError: 4ff4.

   * *note PyExc_FutureWarning: 4ff5.

   * *note PyExc_GeneratorExit: 4ff6.

   * *note PyExc_IOError: 4ff7.

   * *note PyExc_ImportError: 4ff8.

   * *note PyExc_ImportWarning: 4ff9.

   * *note PyExc_IndentationError: 4ffa.

   * *note PyExc_IndexError: 4ffb.

   * *note PyExc_InterruptedError: 4ffc.

   * *note PyExc_IsADirectoryError: 4ffd.

   * *note PyExc_KeyError: 4ffe.

   * *note PyExc_KeyboardInterrupt: 4fff.

   * *note PyExc_LookupError: 5000.

   * *note PyExc_MemoryError: 5001.

   * *note PyExc_ModuleNotFoundError: 5002.

   * *note PyExc_NameError: 5003.

   * *note PyExc_NotADirectoryError: 5004.

   * *note PyExc_NotImplementedError: 5005.

   * *note PyExc_OSError: 4e9b.

   * *note PyExc_OverflowError: 5006.

   * *note PyExc_PendingDeprecationWarning: 5007.

   * *note PyExc_PermissionError: 5008.

   * *note PyExc_ProcessLookupError: 5009.

   * *note PyExc_RecursionError: 10b2.

   * *note PyExc_ReferenceError: 500a.

   * *note PyExc_ResourceWarning: 500b.

   * *note PyExc_RuntimeError: 500c.

   * *note PyExc_RuntimeWarning: 500d.

   * *note PyExc_StopAsyncIteration: 500e.

   * *note PyExc_StopIteration: 500f.

   * *note PyExc_SyntaxError: 5010.

   * *note PyExc_SyntaxWarning: 5011.

   * *note PyExc_SystemError: 5012.

   * *note PyExc_SystemExit: 5013.

   * *note PyExc_TabError: 5014.

   * *note PyExc_TimeoutError: 5015.

   * *note PyExc_TypeError: 4e9a.

   * *note PyExc_UnboundLocalError: 5016.

   * *note PyExc_UnicodeDecodeError: 5017.

   * *note PyExc_UnicodeEncodeError: 5018.

   * *note PyExc_UnicodeError: 5019.

   * *note PyExc_UnicodeTranslateError: 501a.

   * *note PyExc_UnicodeWarning: 501b.

   * *note PyExc_UserWarning: 501c.

   * *note PyExc_ValueError: 4e9c.

   * *note PyExc_Warning: 501d.

   * *note PyExc_WindowsError: 501e.

   * *note PyExc_ZeroDivisionError: 4e97.

   * *note PyExceptionClass_Name(): c5b.

   * *note PyException_GetArgs(): 78b.

   * *note PyException_GetCause(): 501f.

   * *note PyException_GetContext(): 5020.

   * *note PyException_GetTraceback(): 5021.

   * *note PyException_SetArgs(): 78c.

   * *note PyException_SetCause(): 5022.

   * *note PyException_SetContext(): 5023.

   * *note PyException_SetTraceback(): 1dce.

   * *note PyFile_FromFd(): 5024.

   * *note PyFile_GetLine(): 5025.

   * *note PyFile_WriteObject(): 5026.

   * *note PyFile_WriteString(): 5027.

   * *note PyFilter_Type: 5028.

   * *note PyFloat_AsDouble(): c5f.

   * *note PyFloat_FromDouble(): 5029.

   * *note PyFloat_FromString(): 502a.

   * *note PyFloat_GetInfo(): 1609.

   * *note PyFloat_GetMax(): 1607.

   * *note PyFloat_GetMin(): 1608.

   * *note PyFloat_Type: 502b.

   * *note PyFrameObject: 98c.

   * *note PyFrame_GetCode(): 98d.

   * *note PyFrame_GetLineNumber(): 98e.

   * *note PyFrozenSet_New(): 165e.

   * *note PyFrozenSet_Type: 502c.

   * *note PyGC_Collect(): b85.

   * *note PyGC_Disable(): aa5.

   * *note PyGC_Enable(): aa4.

   * *note PyGC_IsEnabled(): aa6.

   * *note PyGILState_Ensure(): 64a.

   * *note PyGILState_GetThisThreadState(): 502d.

   * *note PyGILState_Release(): 64b.

   * *note PyGILState_STATE: 502e.

   * *note PyGetSetDef: db2.

   * *note PyGetSetDescr_Type: 502f.

   * *note PyImport_AddModule(): 5fc.

   * *note PyImport_AddModuleObject(): 5030.

   * *note PyImport_AddModuleRef(): 5fb.

   * *note PyImport_AppendInittab(): 1b1c.

   * *note PyImport_ExecCodeModule(): 5031.

   * *note PyImport_ExecCodeModuleEx(): 5032.

   * *note PyImport_ExecCodeModuleObject(): 5033.

   * *note PyImport_ExecCodeModuleWithPathnames(): 5034.

   * *note PyImport_GetImporter(): 1a84.

   * *note PyImport_GetMagicNumber(): 13bb.

   * *note PyImport_GetMagicTag(): 5035.

   * *note PyImport_GetModule(): dac.

   * *note PyImport_GetModuleDict(): 5036.

   * *note PyImport_Import(): 1615.

   * *note PyImport_ImportFrozenModule(): 5037.

   * *note PyImport_ImportFrozenModuleObject(): 5038.

   * *note PyImport_ImportModule(): 3dc.

   * *note PyImport_ImportModuleLevel(): 13bc.

   * *note PyImport_ImportModuleLevelObject(): 5039.

   * *note PyImport_ImportModuleNoBlock(): 3db.

   * *note PyImport_ReloadModule(): 503a.

   * *note PyIndex_Check(): b81.

   * *note PyInterpreterState: aba.

   * *note PyInterpreterState_Clear(): 4753.

   * *note PyInterpreterState_Delete(): 503b.

   * *note PyInterpreterState_Get(): 64c.

   * *note PyInterpreterState_GetDict(): 503c.

   * *note PyInterpreterState_GetID(): dbf.

   * *note PyInterpreterState_New(): 4754.

   * *note PyIter_Check(): 1cb2.

   * *note PyIter_Next(): 399.

   * *note PyIter_NextItem(): 398.

   * *note PyIter_Send(): a98.

   * *note PyListIter_Type: 503d.

   * *note PyListRevIter_Type: 503e.

   * *note PyList_Append(): 503f.

   * *note PyList_AsTuple(): 5040.

   * *note PyList_GetItem(): 5ff.

   * *note PyList_GetItemRef(): 5fe.

   * *note PyList_GetSlice(): 5041.

   * *note PyList_Insert(): 18b9.

   * *note PyList_New(): 4f49.

   * *note PyList_Reverse(): 5042.

   * *note PyList_SetItem(): 18ba.

   * *note PyList_SetSlice(): 5043.

   * *note PyList_Size(): 1633.

   * *note PyList_Sort(): 5044.

   * *note PyList_Type: 4edb.

   * *note PyLongObject: 39e.

   * *note PyLongRangeIter_Type: 5045.

   * *note PyLong_AsDouble(): 1975.

   * *note PyLong_AsInt(): 604.

   * *note PyLong_AsInt32(): 39f.

   * *note PyLong_AsInt64(): 3a0.

   * *note PyLong_AsLong(): 605.

   * *note PyLong_AsLongAndOverflow(): 147d.

   * *note PyLong_AsLongLong(): 5046.

   * *note PyLong_AsLongLongAndOverflow(): 147e.

   * *note PyLong_AsNativeBytes(): 606.

   * *note PyLong_AsSize_t(): 5047.

   * *note PyLong_AsSsize_t(): 5048.

   * *note PyLong_AsUInt32(): 3a1.

   * *note PyLong_AsUInt64(): 3a2.

   * *note PyLong_AsUnsignedLong(): 5049.

   * *note PyLong_AsUnsignedLongLong(): 14ac.

   * *note PyLong_AsUnsignedLongLongMask(): 1dca.

   * *note PyLong_AsUnsignedLongMask(): 504a.

   * *note PyLong_AsVoidPtr(): 504b.

   * *note PyLong_FromDouble(): b3c.

   * *note PyLong_FromInt32(): 3a3.

   * *note PyLong_FromInt64(): 3a4.

   * *note PyLong_FromLong(): 1bd0.

   * *note PyLong_FromLongLong(): 1bd1.

   * *note PyLong_FromNativeBytes(): 607.

   * *note PyLong_FromSize_t(): 18bf.

   * *note PyLong_FromSsize_t(): 189e.

   * *note PyLong_FromString(): 504c.

   * *note PyLong_FromUInt32(): 3a5.

   * *note PyLong_FromUInt64(): 3a6.

   * *note PyLong_FromUnsignedLong(): 18bd.

   * *note PyLong_FromUnsignedLongLong(): 18be.

   * *note PyLong_FromUnsignedNativeBytes(): 608.

   * *note PyLong_FromVoidPtr(): 504d.

   * *note PyLong_GetInfo(): 504e.

   * *note PyLong_Type: 504f.

   * *note PyMap_Type: 5050.

   * *note PyMapping_Check(): 5051.

   * *note PyMapping_GetItemString(): 5eb.

   * *note PyMapping_GetOptionalItem(): 5e8.

   * *note PyMapping_GetOptionalItemString(): 5e9.

   * *note PyMapping_HasKey(): 620.

   * *note PyMapping_HasKeyString(): 622.

   * *note PyMapping_HasKeyStringWithError(): 621.

   * *note PyMapping_HasKeyWithError(): 61f.

   * *note PyMapping_Items(): db7.

   * *note PyMapping_Keys(): db5.

   * *note PyMapping_Length(): 5052.

   * *note PyMapping_SetItemString(): 5053.

   * *note PyMapping_Size(): 1e37.

   * *note PyMapping_Values(): db6.

   * *note PyMem_Calloc(): 10ad.

   * *note PyMem_Free(): 165b.

   * *note PyMem_Malloc(): e5f.

   * *note PyMem_RawCalloc(): 632.

   * *note PyMem_RawFree(): 634.

   * *note PyMem_RawMalloc(): 631.

   * *note PyMem_RawRealloc(): 633.

   * *note PyMem_Realloc(): 1233.

   * *note PyMemberDef: 771.

   * *note PyMemberDescr_Type: 5054.

   * *note PyMember_GetOne(): 7aa.

   * *note PyMember_SetOne(): 7ab.

   * *note PyMemoryView_FromBuffer(): 965.

   * *note PyMemoryView_FromMemory(): 1388.

   * *note PyMemoryView_FromObject(): 5055.

   * *note PyMemoryView_GetContiguous(): 5056.

   * *note PyMemoryView_Type: 5057.

   * *note PyMethodDef: 16f0.

   * *note PyMethodDescr_Type: 5058.

   * *note PyModuleDef: b74.

   * ‘PyModuleDef_Base’

   * *note PyModuleDef_Init(): 4ea3.

   * *note PyModuleDef_Slot: 5059.

   * ‘PyModuleDef_Type’

   * *note PyModule_Add(): 609.

   * *note PyModule_AddFunctions(): 505a.

   * *note PyModule_AddIntConstant(): 1755.

   * *note PyModule_AddObject(): 60b.

   * *note PyModule_AddObjectRef(): 60a.

   * *note PyModule_AddStringConstant(): 1756.

   * *note PyModule_AddType(): b6c.

   * *note PyModule_Create2(): 505b.

   * *note PyModule_ExecDef(): 10b5.

   * *note PyModule_FromDefAndSpec2(): 10b4.

   * *note PyModule_GetDef(): 505c.

   * *note PyModule_GetDict(): 505d.

   * *note PyModule_GetFilename(): 42d.

   * *note PyModule_GetFilenameObject(): 42e.

   * *note PyModule_GetName(): 505e.

   * *note PyModule_GetNameObject(): 505f.

   * *note PyModule_GetState(): b77.

   * *note PyModule_New(): 5060.

   * *note PyModule_NewObject(): 5061.

   * *note PyModule_SetDocString(): 5062.

   * *note PyModule_Type: 5063.

   * *note PyNumber_Absolute(): 5064.

   * *note PyNumber_Add(): 5065.

   * *note PyNumber_And(): 5066.

   * *note PyNumber_AsSsize_t(): 5067.

   * *note PyNumber_Check(): c5c.

   * *note PyNumber_Divmod(): 5068.

   * *note PyNumber_Float(): c5e.

   * *note PyNumber_FloorDivide(): 5069.

   * *note PyNumber_InPlaceAdd(): 506a.

   * *note PyNumber_InPlaceAnd(): 506b.

   * *note PyNumber_InPlaceFloorDivide(): 506c.

   * *note PyNumber_InPlaceLshift(): 506d.

   * *note PyNumber_InPlaceMatrixMultiply(): 10b7.

   * *note PyNumber_InPlaceMultiply(): 506e.

   * *note PyNumber_InPlaceOr(): 506f.

   * *note PyNumber_InPlacePower(): 5070.

   * *note PyNumber_InPlaceRemainder(): 5071.

   * *note PyNumber_InPlaceRshift(): 5072.

   * *note PyNumber_InPlaceSubtract(): 5073.

   * *note PyNumber_InPlaceTrueDivide(): 5074.

   * *note PyNumber_InPlaceXor(): 5075.

   * *note PyNumber_Index(): a93.

   * *note PyNumber_Invert(): 5076.

   * *note PyNumber_Long(): c5d.

   * *note PyNumber_Lshift(): 5077.

   * *note PyNumber_MatrixMultiply(): 10b6.

   * *note PyNumber_Multiply(): 5078.

   * *note PyNumber_Negative(): 5079.

   * *note PyNumber_Or(): 507a.

   * *note PyNumber_Positive(): 507b.

   * *note PyNumber_Power(): 507c.

   * *note PyNumber_Remainder(): 507d.

   * *note PyNumber_Rshift(): 507e.

   * *note PyNumber_Subtract(): 507f.

   * *note PyNumber_ToBase(): 1b73.

   * *note PyNumber_TrueDivide(): 5080.

   * *note PyNumber_Xor(): 5081.

   * *note PyOS_AfterFork(): 42f.

   * *note PyOS_AfterFork_Child(): 430.

   * *note PyOS_AfterFork_Parent(): db9.

   * *note PyOS_BeforeFork(): db8.

   * *note PyOS_CheckStack(): 1ba1.

   * *note PyOS_FSPath(): f14.

   * *note PyOS_InputHook: 7a4.

   * *note PyOS_InterruptOccurred(): 1d42.

   * *note PyOS_double_to_string(): 5082.

   * *note PyOS_getsig(): 1757.

   * *note PyOS_mystricmp(): 1d3b.

   * *note PyOS_mystrnicmp(): 1d3a.

   * *note PyOS_setsig(): 1758.

   * *note PyOS_sighandler_t: 5083.

   * *note PyOS_snprintf(): 1722.

   * *note PyOS_string_to_double(): 14ad.

   * *note PyOS_strtol(): 5084.

   * *note PyOS_strtoul(): 5085.

   * *note PyOS_vsnprintf(): 1723.

   * *note PyObject: 5df.

   * *note PyObject.ob_refcnt: a9f.

   * *note PyObject.ob_type: 4ecd.

   * *note PyObject_ASCII(): 5086.

   * *note PyObject_AsFileDescriptor(): 5087.

   * *note PyObject_Bytes(): 5088.

   * *note PyObject_Call(): 63d.

   * *note PyObject_CallFunction(): 63f.

   * *note PyObject_CallFunctionObjArgs(): 5089.

   * *note PyObject_CallMethod(): 640.

   * *note PyObject_CallMethodObjArgs(): 1ddf.

   * *note PyObject_CallNoArgs(): 63c.

   * *note PyObject_CallObject(): 4eac.

   * *note PyObject_Calloc(): 10ae.

   * *note PyObject_CheckBuffer(): 639.

   * *note PyObject_ClearWeakRefs(): 796.

   * *note PyObject_CopyData(): 961.

   * *note PyObject_DelAttr(): 1831.

   * *note PyObject_DelAttrString(): 1832.

   * *note PyObject_DelItem(): 508a.

   * *note PyObject_DelItemString(): 508b.

   * *note PyObject_Dir(): 508c.

   * *note PyObject_Format(): 508d.

   * *note PyObject_Free(): e60.

   * *note PyObject_GC_Del(): 171c.

   * *note PyObject_GC_IsFinalized(): b6e.

   * *note PyObject_GC_IsTracked(): b6d.

   * *note PyObject_GC_Track(): 171d.

   * *note PyObject_GC_UnTrack(): 171e.

   * *note PyObject_GenericGetAttr(): 508e.

   * *note PyObject_GenericGetDict(): 1d05.

   * *note PyObject_GenericSetAttr(): 508f.

   * *note PyObject_GenericSetDict(): 5090.

   * *note PyObject_GetAIter(): 5091.

   * *note PyObject_GetAttr(): 5ee.

   * *note PyObject_GetAttrString(): 5ef.

   * *note PyObject_GetBuffer(): 63a.

   * *note PyObject_GetItem(): 5ea.

   * *note PyObject_GetIter(): 5092.

   * *note PyObject_GetOptionalAttr(): 5ec.

   * *note PyObject_GetOptionalAttrString(): 5ed.

   * *note PyObject_GetTypeData(): 76b.

   * *note PyObject_HasAttr(): 61c.

   * *note PyObject_HasAttrString(): 61e.

   * *note PyObject_HasAttrStringWithError(): 61d.

   * *note PyObject_HasAttrWithError(): 61b.

   * *note PyObject_Hash(): 436.

   * *note PyObject_HashNotImplemented(): 15e0.

   * *note PyObject_Init(): c60.

   * *note PyObject_InitVar(): 1d40.

   * *note PyObject_IsInstance(): 10a6.

   * *note PyObject_IsSubclass(): 10a7.

   * *note PyObject_IsTrue(): 5093.

   * *note PyObject_Length(): 5094.

   * *note PyObject_Malloc(): e62.

   * *note PyObject_Not(): 5095.

   * *note PyObject_Realloc(): 165c.

   * *note PyObject_Repr(): 1230.

   * *note PyObject_RichCompare(): 4ef1.

   * *note PyObject_RichCompareBool(): 1d8c.

   * *note PyObject_SelfIter(): 5096.

   * *note PyObject_SetAttr(): 5097.

   * *note PyObject_SetAttrString(): 198e.

   * *note PyObject_SetItem(): 4f48.

   * *note PyObject_Size(): 5098.

   * *note PyObject_Str(): 1231.

   * *note PyObject_Type(): 5099.

   * *note PyObject_Vectorcall(): 77e.

   * *note PyObject_VectorcallMethod(): 77f.

   * *note PyProperty_Type: 509a.

   * *note PyRangeIter_Type: 509b.

   * *note PyRange_Type: 509c.

   * *note PyReversed_Type: 509d.

   * *note PySeqIter_New(): 509e.

   * *note PySeqIter_Type: 509f.

   * *note PySequence_Check(): 50a0.

   * *note PySequence_Concat(): 50a1.

   * *note PySequence_Contains(): 3d9.

   * *note PySequence_Count(): 50a2.

   * *note PySequence_DelItem(): 1e36.

   * *note PySequence_DelSlice(): 50a3.

   * *note PySequence_Fast(): 18a2.

   * *note PySequence_GetItem(): 1e34.

   * *note PySequence_GetSlice(): 50a4.

   * *note PySequence_In(): 3d8.

   * *note PySequence_InPlaceConcat(): 50a5.

   * *note PySequence_InPlaceRepeat(): 50a6.

   * *note PySequence_Index(): 50a7.

   * *note PySequence_Length(): 50a8.

   * *note PySequence_List(): 50a9.

   * *note PySequence_Repeat(): 50aa.

   * *note PySequence_SetItem(): 1e35.

   * *note PySequence_SetSlice(): 50ab.

   * *note PySequence_Size(): 1e33.

   * *note PySequence_Tuple(): 50ac.

   * *note PySetIter_Type: 50ad.

   * *note PySet_Add(): 165f.

   * *note PySet_Clear(): 50ae.

   * *note PySet_Contains(): 1661.

   * *note PySet_Discard(): 1660.

   * *note PySet_New(): 165d.

   * *note PySet_Pop(): 50af.

   * *note PySet_Size(): 1662.

   * *note PySet_Type: 50b0.

   * *note PySlice_AdjustIndices(): 433.

   * *note PySlice_GetIndices(): 50b1.

   * *note PySlice_GetIndicesEx(): 431.

   * *note PySlice_New(): 50b2.

   * *note PySlice_Type: 50b3.

   * *note PySlice_Unpack(): 432.

   * *note PyState_AddModule(): 50b4.

   * *note PyState_FindModule(): 50b5.

   * *note PyState_RemoveModule(): 50b6.

   * *note PyStructSequence_Desc: db4.

   * *note PyStructSequence_Field: db3.

   * *note PyStructSequence_GetItem(): 50b7.

   * *note PyStructSequence_New(): 50b8.

   * *note PyStructSequence_NewType(): 50b9.

   * *note PyStructSequence_SetItem(): 50ba.

   * *note PyStructSequence_UnnamedField: b79.

   * *note PySuper_Type: 50bb.

   * *note PySys_Audit(): 613.

   * *note PySys_AuditTuple(): 612.

   * *note PySys_FormatStderr(): 50bc.

   * *note PySys_FormatStdout(): 50bd.

   * *note PySys_GetObject(): 62a.

   * *note PySys_GetXOptions(): 50be.

   * *note PySys_ResetWarnOptions(): 3f4.

   * *note PySys_SetArgv(): 19b8.

   * *note PySys_SetArgvEx(): 19b7.

   * *note PySys_SetObject(): 50bf.

   * *note PySys_WriteStderr(): 50c0.

   * *note PySys_WriteStdout(): 50c1.

   * *note PyThreadState: 990.

   * *note PyThreadState_Clear(): 1991.

   * *note PyThreadState_Delete(): 1d89.

   * *note PyThreadState_Get(): 615.

   * *note PyThreadState_GetDict(): 50c2.

   * *note PyThreadState_GetFrame(): 991.

   * *note PyThreadState_GetID(): b6a.

   * *note PyThreadState_GetInterpreter(): b69.

   * *note PyThreadState_New(): 50c3.

   * *note PyThreadState_SetAsyncExc(): dbd.

   * *note PyThreadState_Swap(): 50c4.

   * *note PyThread_GetInfo(): 50c5.

   * *note PyThread_ReInitTLS(): 441.

   * *note PyThread_acquire_lock(): 50c6.

   * *note PyThread_acquire_lock_timed(): 50c7.

   * *note PyThread_allocate_lock(): 50c8.

   * *note PyThread_create_key(): 437.

   * *note PyThread_delete_key(): 439.

   * *note PyThread_delete_key_value(): 43f.

   * *note PyThread_exit_thread(): 50c9.

   * *note PyThread_free_lock(): 50ca.

   * *note PyThread_get_key_value(): 43d.

   * *note PyThread_get_stacksize(): 50cb.

   * *note PyThread_get_thread_ident(): 50cc.

   * *note PyThread_get_thread_native_id(): 1ba2.

   * *note PyThread_init_thread(): 50cd.

   * *note PyThread_release_lock(): 50ce.

   * *note PyThread_set_key_value(): 43b.

   * *note PyThread_set_stacksize(): 50cf.

   * *note PyThread_start_new_thread(): 1e2b.

   * *note PyThread_tss_alloc(): 438.

   * *note PyThread_tss_create(): 50d0.

   * *note PyThread_tss_delete(): 440.

   * *note PyThread_tss_free(): 43a.

   * *note PyThread_tss_get(): 43e.

   * *note PyThread_tss_is_created(): 50d1.

   * *note PyThread_tss_set(): 43c.

   * *note PyTraceBack_Here(): 50d2.

   * *note PyTraceBack_Print(): 50d3.

   * *note PyTraceBack_Type: 50d4.

   * *note PyTupleIter_Type: 50d5.

   * *note PyTuple_GetItem(): 4eb7.

   * *note PyTuple_GetSlice(): 50d6.

   * *note PyTuple_New(): 63e.

   * *note PyTuple_Pack(): 50d7.

   * *note PyTuple_SetItem(): 4eb8.

   * *note PyTuple_Size(): 50d8.

   * *note PyTuple_Type: 50d9.

   * *note PyTypeObject: c9c.

   * *note PyType_ClearCache(): 50da.

   * *note PyType_Freeze(): 3af.

   * *note PyType_FromMetaclass(): 772.

   * *note PyType_FromModuleAndSpec(): 773.

   * *note PyType_FromSpec(): 79d.

   * *note PyType_FromSpecWithBases(): 79e.

   * *note PyType_GenericAlloc(): c61.

   * *note PyType_GenericNew(): 4ecc.

   * *note PyType_GetBaseByToken(): 3b0.

   * *note PyType_GetFlags(): 1d3d.

   * *note PyType_GetFullyQualifiedName(): 616.

   * *note PyType_GetModule(): b66.

   * *note PyType_GetModuleByDef(): 635.

   * *note PyType_GetModuleName(): 618.

   * *note PyType_GetModuleState(): b67.

   * *note PyType_GetName(): 958.

   * *note PyType_GetQualName(): 959.

   * *note PyType_GetSlot(): a9c.

   * *note PyType_GetTypeDataSize(): 76c.

   * *note PyType_IsSubtype(): 50db.

   * *note PyType_Modified(): 1b7b.

   * *note PyType_Ready(): 980.

   * *note PyType_Slot: 50dc.

   * *note PyType_Spec: 1a89.

   * *note PyType_Type: 76f.

   * *note PyUnicodeDecodeError_Create(): 50dd.

   * *note PyUnicodeDecodeError_GetEncoding(): 50de.

   * *note PyUnicodeDecodeError_GetEnd(): 50df.

   * *note PyUnicodeDecodeError_GetObject(): 50e0.

   * *note PyUnicodeDecodeError_GetReason(): 50e1.

   * *note PyUnicodeDecodeError_GetStart(): 50e2.

   * *note PyUnicodeDecodeError_SetEnd(): 50e3.

   * *note PyUnicodeDecodeError_SetReason(): 50e4.

   * *note PyUnicodeDecodeError_SetStart(): 50e5.

   * *note PyUnicodeEncodeError_GetEncoding(): 50e6.

   * *note PyUnicodeEncodeError_GetEnd(): 18fb.

   * *note PyUnicodeEncodeError_GetObject(): 50e7.

   * *note PyUnicodeEncodeError_GetReason(): 50e8.

   * *note PyUnicodeEncodeError_GetStart(): 18fe.

   * *note PyUnicodeEncodeError_SetEnd(): 50e9.

   * *note PyUnicodeEncodeError_SetReason(): 50ea.

   * *note PyUnicodeEncodeError_SetStart(): 50eb.

   * *note PyUnicodeIter_Type: 50ec.

   * *note PyUnicodeTranslateError_GetEnd(): 50ed.

   * *note PyUnicodeTranslateError_GetObject(): 50ee.

   * *note PyUnicodeTranslateError_GetReason(): 50ef.

   * *note PyUnicodeTranslateError_GetStart(): 50f0.

   * *note PyUnicodeTranslateError_SetEnd(): 50f1.

   * *note PyUnicodeTranslateError_SetReason(): 50f2.

   * *note PyUnicodeTranslateError_SetStart(): 50f3.

   * *note PyUnicode_Append(): 50f4.

   * *note PyUnicode_AppendAndDel(): 50f5.

   * *note PyUnicode_AsASCIIString(): 13aa.

   * *note PyUnicode_AsCharmapString(): 50f6.

   * ‘PyUnicode_AsDecodedObject()’

   * ‘PyUnicode_AsDecodedUnicode()’

   * ‘PyUnicode_AsEncodedObject()’

   * *note PyUnicode_AsEncodedString(): 50f7.

   * ‘PyUnicode_AsEncodedUnicode()’

   * *note PyUnicode_AsLatin1String(): 13a9.

   * *note PyUnicode_AsMBCSString(): 13ab.

   * *note PyUnicode_AsRawUnicodeEscapeString(): 13a8.

   * *note PyUnicode_AsUCS4(): 1390.

   * *note PyUnicode_AsUCS4Copy(): ab8.

   * *note PyUnicode_AsUTF16String(): 50f8.

   * *note PyUnicode_AsUTF32String(): 50f9.

   * *note PyUnicode_AsUTF8AndSize(): a99.

   * *note PyUnicode_AsUTF8String(): 13a6.

   * *note PyUnicode_AsUnicodeEscapeString(): 13a7.

   * *note PyUnicode_AsWideChar(): 1e38.

   * *note PyUnicode_AsWideCharString(): ab9.

   * *note PyUnicode_BuildEncodingMap(): 1a62.

   * *note PyUnicode_Compare(): ab4.

   * *note PyUnicode_CompareWithASCIIString(): 147f.

   * *note PyUnicode_Concat(): 13b9.

   * *note PyUnicode_Contains(): 50fa.

   * *note PyUnicode_Count(): 50fb.

   * *note PyUnicode_Decode(): 1dc7.

   * *note PyUnicode_DecodeASCII(): 50fc.

   * *note PyUnicode_DecodeCharmap(): 50fd.

   * *note PyUnicode_DecodeCodePageStateful(): 50fe.

   * *note PyUnicode_DecodeFSDefault(): 1a88.

   * *note PyUnicode_DecodeFSDefaultAndSize(): 50ff.

   * *note PyUnicode_DecodeLatin1(): 5100.

   * *note PyUnicode_DecodeLocale(): 5101.

   * *note PyUnicode_DecodeLocaleAndSize(): dc2.

   * *note PyUnicode_DecodeMBCS(): 5102.

   * *note PyUnicode_DecodeMBCSStateful(): 5103.

   * *note PyUnicode_DecodeRawUnicodeEscape(): 5104.

   * *note PyUnicode_DecodeUTF16(): 5105.

   * *note PyUnicode_DecodeUTF16Stateful(): 5106.

   * *note PyUnicode_DecodeUTF32(): 5107.

   * *note PyUnicode_DecodeUTF32Stateful(): 5108.

   * *note PyUnicode_DecodeUTF7(): 5109.

   * *note PyUnicode_DecodeUTF7Stateful(): 510a.

   * *note PyUnicode_DecodeUTF8(): 510b.

   * *note PyUnicode_DecodeUTF8Stateful(): 1b17.

   * *note PyUnicode_DecodeUnicodeEscape(): 510c.

   * *note PyUnicode_EncodeCodePage(): 13ac.

   * *note PyUnicode_EncodeFSDefault(): 1e31.

   * *note PyUnicode_EncodeLocale(): dc3.

   * *note PyUnicode_Equal(): 3b2.

   * *note PyUnicode_EqualToUTF8(): 61a.

   * *note PyUnicode_EqualToUTF8AndSize(): 619.

   * *note PyUnicode_FSConverter(): f15.

   * *note PyUnicode_FSDecoder(): 797.

   * *note PyUnicode_Find(): 510d.

   * *note PyUnicode_FindChar(): ab6.

   * *note PyUnicode_Format(): 510e.

   * *note PyUnicode_FromEncodedObject(): 510f.

   * *note PyUnicode_FromFormat(): 62b.

   * *note PyUnicode_FromFormatV(): 794.

   * *note PyUnicode_FromObject(): 5110.

   * *note PyUnicode_FromOrdinal(): 5111.

   * *note PyUnicode_FromString(): 5112.

   * *note PyUnicode_FromStringAndSize(): 5113.

   * *note PyUnicode_FromWideChar(): 13a4.

   * *note PyUnicode_GetDefaultEncoding(): 5114.

   * *note PyUnicode_GetLength(): ab0.

   * *note PyUnicode_InternFromString(): 198c.

   * *note PyUnicode_InternInPlace(): aae.

   * *note PyUnicode_IsIdentifier(): 1d86.

   * *note PyUnicode_Join(): 13ba.

   * *note PyUnicode_Partition(): 1898.

   * *note PyUnicode_RPartition(): 1899.

   * *note PyUnicode_RSplit(): 1897.

   * *note PyUnicode_ReadChar(): 1389.

   * *note PyUnicode_Replace(): 5115.

   * *note PyUnicode_Resize(): 5116.

   * *note PyUnicode_RichCompare(): 5117.

   * *note PyUnicode_Split(): 5118.

   * *note PyUnicode_Splitlines(): 5119.

   * *note PyUnicode_Substring(): ab3.

   * *note PyUnicode_Tailmatch(): ab5.

   * *note PyUnicode_Translate(): 511a.

   * *note PyUnicode_Type: 511b.

   * *note PyUnicode_WriteChar(): 138a.

   * *note PyVarObject: 46d6.

   * ‘PyVarObject.ob_base’

   * *note PyVarObject.ob_size: 511c.

   * *note PyVectorcall_Call(): 778.

   * *note PyVectorcall_NARGS(): 777.

   * ‘PyWeakReference’

   * *note PyWeakref_GetObject(): 3dd.

   * *note PyWeakref_GetRef(): 3df.

   * *note PyWeakref_NewProxy(): 511d.

   * *note PyWeakref_NewRef(): 1be6.

   * *note PyWrapperDescr_Type: 511e.

   * *note PyWrapper_New(): 511f.

   * *note PyZip_Type: 5120.

   * *note Py_ASNATIVEBYTES_ALLOW_INDEX: 5121.

   * *note Py_ASNATIVEBYTES_BIG_ENDIAN: 5122.

   * *note Py_ASNATIVEBYTES_DEFAULTS: 5123.

   * *note Py_ASNATIVEBYTES_LITTLE_ENDIAN: 5124.

   * *note Py_ASNATIVEBYTES_NATIVE_ENDIAN: 5125.

   * *note Py_ASNATIVEBYTES_REJECT_NEGATIVE: 5126.

   * *note Py_ASNATIVEBYTES_UNSIGNED_BUFFER: 5127.

   * *note Py_AUDIT_READ: 7af.

   * *note Py_AddPendingCall(): b78.

   * *note Py_AtExit(): 5128.

   * *note Py_BEGIN_ALLOW_THREADS: 4ebd.

   * *note Py_BLOCK_THREADS: 5129.

   * *note Py_BuildValue(): 3c2.

   * *note Py_BytesMain(): bb8.

   * *note Py_CompileString(): a85.

   * *note Py_DecRef(): 512a.

   * *note Py_DecodeLocale(): dc0.

   * *note Py_END_ALLOW_THREADS: c7f.

   * *note Py_EncodeLocale(): dc1.

   * *note Py_EndInterpreter(): 1845.

   * *note Py_EnterRecursiveCall(): 3d2.

   * *note Py_Exit(): f4b.

   * *note Py_FatalError(): b7a.

   * ‘Py_FileSystemDefaultEncodeErrors’

   * ‘Py_FileSystemDefaultEncoding’

   * *note Py_Finalize(): 45f.

   * *note Py_FinalizeEx(): f11.

   * *note Py_GenericAlias(): 512b.

   * *note Py_GenericAliasType: 512c.

   * *note Py_GetBuildInfo(): 164b.

   * *note Py_GetCompiler(): 512d.

   * *note Py_GetConstant(): 5f9.

   * *note Py_GetConstantBorrowed(): 5fa.

   * *note Py_GetCopyright(): 512e.

   * *note Py_GetExecPrefix(): 3e9.

   * *note Py_GetPath(): 3e3.

   * *note Py_GetPlatform(): 512f.

   * *note Py_GetPrefix(): 3e5.

   * *note Py_GetProgramFullPath(): 3ec.

   * *note Py_GetProgramName(): 3ee.

   * *note Py_GetPythonHome(): 3ef.

   * *note Py_GetRecursionLimit(): 5130.

   * *note Py_GetVersion(): 5131.

   * ‘Py_HasFileSystemDefaultEncoding’

   * *note Py_IncRef(): 5132.

   * *note Py_Initialize(): 460.

   * *note Py_InitializeEx(): 5133.

   * *note Py_Is(): aa0.

   * *note Py_IsFalse(): aa3.

   * *note Py_IsFinalizing(): 5fd.

   * *note Py_IsInitialized(): 4f51.

   * *note Py_IsNone(): aa1.

   * *note Py_IsTrue(): aa2.

   * *note Py_LeaveRecursiveCall(): b6b.

   * *note Py_Main(): e1e.

   * *note Py_MakePendingCalls(): 5134.

   * *note Py_NewInterpreter(): 1b31.

   * *note Py_NewRef(): a9a.

   * *note Py_PACK_FULL_VERSION(): 380.

   * *note Py_PACK_VERSION(): 37f.

   * *note Py_READONLY: 7ae.

   * *note Py_REFCNT(): 2cf.

   * *note Py_RELATIVE_OFFSET: 770.

   * *note Py_ReprEnter(): 5135.

   * *note Py_ReprLeave(): 5136.

   * *note Py_SetProgramName(): 19b6.

   * *note Py_SetPythonHome(): 19b5.

   * *note Py_SetRecursionLimit(): 5137.

   * *note Py_TPFLAGS_BASETYPE: 4ed5.

   * *note Py_TPFLAGS_DEFAULT: 4eca.

   * *note Py_TPFLAGS_HAVE_GC: 981.

   * *note Py_TPFLAGS_HAVE_VECTORCALL: 776.

   * *note Py_TPFLAGS_ITEMS_AT_END: 76d.

   * *note Py_TPFLAGS_METHOD_DESCRIPTOR: 5138.

   * *note Py_TP_USE_SPEC: 5139.

   * *note Py_TYPE(): 3c9.

   * *note Py_T_BOOL: 513a.

   * *note Py_T_BYTE: 513b.

   * *note Py_T_CHAR: 513c.

   * *note Py_T_DOUBLE: 7ad.

   * *note Py_T_FLOAT: 513d.

   * *note Py_T_INT: 7ac.

   * *note Py_T_LONG: 513e.

   * *note Py_T_LONGLONG: 513f.

   * *note Py_T_OBJECT_EX: 7b1.

   * *note Py_T_PYSSIZET: 5140.

   * *note Py_T_SHORT: 5141.

   * *note Py_T_STRING: 5142.

   * *note Py_T_STRING_INPLACE: 5143.

   * *note Py_T_UBYTE: 5144.

   * *note Py_T_UINT: 5145.

   * *note Py_T_ULONG: 5146.

   * *note Py_T_ULONGLONG: 5147.

   * *note Py_T_USHORT: 5148.

   * *note Py_UCS4: 33d.

   * *note Py_UNBLOCK_THREADS: 5149.

   * ‘Py_UTF8Mode’

   * *note Py_VaBuildValue(): 514a.

   * *note Py_Version: 381.

   * *note Py_XNewRef(): a9b.

   * *note Py_am_aiter: 514b.

   * *note Py_am_anext: 514c.

   * *note Py_am_await: 514d.

   * *note Py_am_send: 514e.

   * *note Py_bf_getbuffer: 514f.

   * *note Py_bf_releasebuffer: 5150.

   * *note Py_buffer: 95c.

   * ‘Py_intptr_t’

   * *note Py_mod_create: 5151.

   * *note Py_mod_exec: b75.

   * *note Py_mod_gil: 482.

   * *note Py_mod_multiple_interpreters: 5152.

   * *note Py_mp_ass_subscript: 5153.

   * *note Py_mp_length: 5154.

   * *note Py_mp_subscript: 5155.

   * *note Py_nb_absolute: 5156.

   * *note Py_nb_add: 5157.

   * *note Py_nb_and: 5158.

   * *note Py_nb_bool: 5159.

   * *note Py_nb_divmod: 515a.

   * *note Py_nb_float: 515b.

   * *note Py_nb_floor_divide: 515c.

   * *note Py_nb_index: 515d.

   * *note Py_nb_inplace_add: 515e.

   * *note Py_nb_inplace_and: 515f.

   * *note Py_nb_inplace_floor_divide: 5160.

   * *note Py_nb_inplace_lshift: 5161.

   * *note Py_nb_inplace_matrix_multiply: 5162.

   * *note Py_nb_inplace_multiply: 5163.

   * *note Py_nb_inplace_or: 5164.

   * *note Py_nb_inplace_power: 5165.

   * *note Py_nb_inplace_remainder: 5166.

   * *note Py_nb_inplace_rshift: 5167.

   * *note Py_nb_inplace_subtract: 5168.

   * *note Py_nb_inplace_true_divide: 5169.

   * *note Py_nb_inplace_xor: 516a.

   * *note Py_nb_int: 516b.

   * *note Py_nb_invert: 516c.

   * *note Py_nb_lshift: 516d.

   * *note Py_nb_matrix_multiply: 516e.

   * *note Py_nb_multiply: 516f.

   * *note Py_nb_negative: 5170.

   * *note Py_nb_or: 5171.

   * *note Py_nb_positive: 5172.

   * *note Py_nb_power: 5173.

   * *note Py_nb_remainder: 5174.

   * *note Py_nb_rshift: 5175.

   * *note Py_nb_subtract: 5176.

   * *note Py_nb_true_divide: 5177.

   * *note Py_nb_xor: 5178.

   * *note Py_sq_ass_item: 5179.

   * *note Py_sq_concat: 517a.

   * *note Py_sq_contains: 517b.

   * *note Py_sq_inplace_concat: 517c.

   * *note Py_sq_inplace_repeat: 517d.

   * *note Py_sq_item: 517e.

   * *note Py_sq_length: 517f.

   * *note Py_sq_repeat: 5180.

   * *note Py_ssize_t: c55.

   * *note Py_tp_alloc: 5181.

   * *note Py_tp_base: 5182.

   * *note Py_tp_bases: 5183.

   * *note Py_tp_call: 5184.

   * *note Py_tp_clear: 5185.

   * *note Py_tp_dealloc: 5186.

   * *note Py_tp_del: 5187.

   * *note Py_tp_descr_get: 5188.

   * *note Py_tp_descr_set: 5189.

   * *note Py_tp_doc: 518a.

   * *note Py_tp_finalize: 518b.

   * *note Py_tp_free: 518c.

   * *note Py_tp_getattr: 518d.

   * *note Py_tp_getattro: 518e.

   * *note Py_tp_getset: 518f.

   * *note Py_tp_hash: 5190.

   * *note Py_tp_init: 5191.

   * *note Py_tp_is_gc: 5192.

   * *note Py_tp_iter: 5193.

   * *note Py_tp_iternext: 5194.

   * *note Py_tp_members: 5195.

   * *note Py_tp_methods: 5196.

   * *note Py_tp_new: 5197.

   * *note Py_tp_repr: 5198.

   * *note Py_tp_richcompare: 5199.

   * *note Py_tp_setattr: 519a.

   * *note Py_tp_setattro: 519b.

   * *note Py_tp_str: 519c.

   * *note Py_tp_token: 3b1.

   * *note Py_tp_traverse: 519d.

   * *note Py_tp_vectorcall: 519e.

   * ‘Py_uintptr_t’

   * *note allocfunc: 519f.

   * *note binaryfunc: 51a0.

   * *note descrgetfunc: 51a1.

   * *note descrsetfunc: 51a2.

   * *note destructor: 51a3.

   * *note getattrfunc: 51a4.

   * *note getattrofunc: 51a5.

   * *note getbufferproc: 51a6.

   * *note getiterfunc: 51a7.

   * *note getter: 51a8.

   * *note hashfunc: 51a9.

   * *note initproc: 51aa.

   * *note inquiry: 51ab.

   * *note iternextfunc: 51ac.

   * *note lenfunc: 51ad.

   * *note newfunc: 51ae.

   * *note objobjargproc: 51af.

   * *note objobjproc: 51b0.

   * *note releasebufferproc: 51b1.

   * *note reprfunc: 51b2.

   * *note richcmpfunc: 51b3.

   * *note setattrfunc: 51b4.

   * *note setattrofunc: 51b5.

   * *note setter: 51b6.

   * *note ssizeargfunc: 51b7.

   * *note ssizeobjargproc: 51b8.

   * ‘ssizessizeargfunc’

   * ‘ssizessizeobjargproc’

   * ‘symtable’

   * *note ternaryfunc: 51b9.

   * *note traverseproc: 51ba.

   * *note unaryfunc: 51bb.

   * *note vectorcallfunc: 779.

   * *note visitproc: 51bc.


File: python.info,  Node: 超高水準レイヤ,  Next: 参照カウント,  Prev: C API の安定性,  Up: Python/C API リファレンスマニュアル

7.3 超高水準レイヤ
==================

この章の関数を使うとファイルまたはバッファにある Python ソースコードを実
行できますが、より詳細なやり取りをインタプリタとすることはできないでしょ
う。

Several of these functions accept a start symbol from the grammar as a
parameter.  The available start symbols are *note Py_eval_input: 51c1,
*note Py_file_input: 51c2, *note Py_single_input: 51c3, and *note
Py_func_type_input: 51c4.  These are described following the functions
which accept them as parameters.

Note also that several of these functions take FILE* parameters.  One
particular issue which needs to be handled carefully is that the ‘FILE’
structure for different C libraries can be different and incompatible.
Under Windows (at least), it is possible for dynamically linked
extensions to actually use different libraries, so care should be taken
that FILE* parameters are only passed to these functions if it is
certain that they were created by the same library that the Python
runtime is using.

 -- C の関数: int PyRun_AnyFile (FILE *fp, const char *filename)

     下記の *note PyRun_AnyFileExFlags(): 51c6. の 'closeit' を ‘0’ に、
     'flags' を ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: int PyRun_AnyFileFlags (FILE *fp, const char *filename,
          PyCompilerFlags *flags)

     下記の *note PyRun_AnyFileExFlags(): 51c6. の 'closeit' を ‘0’ にし
     て単純化したインターフェースです。

 -- C の関数: int PyRun_AnyFileEx (FILE *fp, const char *filename, int
          closeit)

     下記の *note PyRun_AnyFileExFlags(): 51c6. の 'flags' を ‘NULL’ に
     して単純化したインターフェースです。

 -- C の関数: int PyRun_AnyFileExFlags (FILE *fp, const char *filename,
          int closeit, PyCompilerFlags *flags)

     'fp' が対話的デバイス (コンソールや端末入力あるいは Unix 仮想端末)
     と関連づけられたファイルを参照している場合は、 *note
     PyRun_InteractiveLoop(): 51c9. の値を返します。それ以外の場合は、
     *note PyRun_SimpleFile(): 4f0c. の結果を返します。 'filename' はフ
     ァイルシステムのエンコーディング (*note
     sys.getfilesystemencoding(): e53.) でデコードされます。 'filename'
     が ‘NULL’ ならば、この関数はファイル名として ‘"???"’ を使います。
     'closeit' が真なら、ファイルは ‘PyRun_SimpleFileExFlags()’ が処理を
     戻す前に閉じられます。

 -- C の関数: int PyRun_SimpleString (const char *command)

     下記の *note PyRun_SimpleStringFlags(): 51ca. の *note
     PyCompilerFlags: c98.* を ‘NULL’ にして単純化したインタフェースです
     。

 -- C の関数: int PyRun_SimpleStringFlags (const char *command,
          PyCompilerFlags *flags)

     *note __main__: 1. モジュールの中で 'flags' に従って 'command' に含
     まれる Python ソースコードを実行します。 *note __main__: 1. がまだ
     存在しない場合は作成されます。正常終了の場合は ‘0’ を返し、また例外
     が発生した場合は ‘-1’ を返します。エラーがあっても、例外情報を得る
     方法はありません。 'flags' の意味については、後述します。

     Note that if an otherwise unhandled *note SystemExit: f3c. is
     raised, this function will not return ‘-1’, but exit the process,
     as long as *note PyConfig.inspect: 401. is zero.

 -- C の関数: int PyRun_SimpleFile (FILE *fp, const char *filename)

     下記の *note PyRun_SimpleFileExFlags(): 1cca. の 'closeit' を ‘0’ に
     、 'flags' を ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: int PyRun_SimpleFileEx (FILE *fp, const char *filename,
          int closeit)

     下記の *note PyRun_SimpleFileExFlags(): 1cca. の 'flags' を ‘NULL’
     にして単純化したインターフェースです。

 -- C の関数: int PyRun_SimpleFileExFlags (FILE *fp, const char
          *filename, int closeit, PyCompilerFlags *flags)

     *note PyRun_SimpleStringFlags(): 51ca. と似ていますが、Pythonソース
     コードをメモリ内の文字列ではなく 'fp' から読み込みます。 'filename'
     はそのファイルの名前でなければならず、 *note
     ファイルシステムのエンコーディングとエラーハンドラ: 75d. でデコード
     されます。 'closeit' に真を指定した場合は、
     ‘PyRun_SimpleFileExFlags()’ が処理を戻す前にファイルを閉じます。

          注釈: Windowsでは、 'fp' はバイナリモードで開くべきです (例え
          ば ‘fopen(filename, "rb")’)。 そうしない場合は、 Python は行末
          が LF のスクリプトを正しく扱えないでしょう。

 -- C の関数: int PyRun_InteractiveOneObject (FILE *fp, PyObject
          *filename, PyCompilerFlags *flags)

     Read and execute a single statement from a file associated with an
     interactive device according to the 'flags' argument.  The user
     will be prompted using ‘sys.ps1’ and ‘sys.ps2’.  'filename' must be
     a Python *note str: 169. object.

     入力が正常に実行されたときは ‘0’ を返します。例外が発生した場合は
     ‘-1’ を返します。パースエラーの場合はPythonの一部として配布されてい
     る ‘errcode.h’ インクルードファイルにあるエラーコードを返します。
     (‘Python.h’ は ‘errcode.h’ をインクルードしません。従って、 必要な
     場合はその都度インクルードしなければならないことに注意してください
     。)

 -- C の関数: int PyRun_InteractiveOne (FILE *fp, const char *filename)

     下記の *note PyRun_InteractiveOneFlags(): 51ce. の 'flags' を
     ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: int PyRun_InteractiveOneFlags (FILE *fp, const char
          *filename, PyCompilerFlags *flags)

     Similar to *note PyRun_InteractiveOneObject(): 51cc, but 'filename'
     is a const char*, which is decoded from the *note filesystem
     encoding and error handler: 75d.

 -- C の関数: int PyRun_InteractiveLoop (FILE *fp, const char *filename)

     下記の *note PyRun_InteractiveLoopFlags(): 51cf. の 'flags' を
     ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: int PyRun_InteractiveLoopFlags (FILE *fp, const char
          *filename, PyCompilerFlags *flags)

     対話的デバイスに関連付けられたファイルから EOF に達するまで文を読み
     込み実行します。 ‘sys.ps1’ と ‘sys.ps2’ を使って、ユーザにプロンプ
     トを表示します。 'filename' は *note
     ファイルシステムのエンコーディングとエラーハンドラ: 75d. でデコード
     されます。 EOFに達すると ‘0’ を返すか、失敗したら負の数を返します。

 -- C 変数: int (*PyOS_InputHook)(void)
     ' 次に属します: *note Stable ABI: 775.'  Can be set to point to a
     function with the prototype ‘int func(void)’.  The function will be
     called when Python's interpreter prompt is about to become idle and
     wait for user input from the terminal.  The return value is
     ignored.  Overriding this hook can be used to integrate the
     interpreter's prompt with other event loops, as done in
     ‘Modules/_tkinter.c’ in the Python source code.

     バージョン 3.12 で変更: This function is only called from the *note
     main interpreter: 163.

 -- C 変数: char *(*PyOS_ReadlineFunctionPointer)(FILE*, FILE*, const
          char*)

     ‘char *func(FILE *stdin, FILE *stdout, char *prompt)’ というプロト
     タイプの関数へのポインタが設定でき、デフォルトの関数を上書きするこ
     とでインタプリタのプロンプトへの入力を1行だけ読めます。 この関数は
     、文字列 'prompt' が ‘NULL’ でない場合は 'prompt' を出力し、与えら
     れた標準入力ファイルから入力を1行読み、結果の文字列を返すという動作
     が期待されています。 例えば、 *note readline: bf. モジュールはこの
     フックを設定して、行編集機能やタブ補完機能を提供しています。

     返り値は *note PyMem_RawMalloc(): 631. または *note
     PyMem_RawRealloc(): 633. でメモリ確保した文字列、あるいはエラーが起
     きた場合には ‘NULL’ でなければなりません。

     バージョン 3.4 で変更: 返り値は、 *note PyMem_Malloc(): e5f. や
     *note PyMem_Realloc(): 1233. ではなく、 *note PyMem_RawMalloc():
     631. または *note PyMem_RawRealloc(): 633. でメモリ確保したものでな
     ければなりません。

     バージョン 3.12 で変更: This function is only called from the *note
     main interpreter: 163.

 -- C の関数: *note PyObject: 5df. *PyRun_String (const char *str, int
          start, PyObject *globals, PyObject *locals)
     '戻り値: 新しい参照。' 下記の *note PyRun_StringFlags(): 51d0. の
     'flags' を ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: *note PyObject: 5df. *PyRun_StringFlags (const char *str,
          int start, PyObject *globals, PyObject *locals,
          PyCompilerFlags *flags)
     '戻り値: 新しい参照。' Execute Python source code from 'str' in the
     context specified by the objects 'globals' and 'locals' with the
     compiler flags specified by 'flags'.  'globals' must be a
     dictionary; 'locals' can be any object that implements the mapping
     protocol.  The parameter 'start' specifies the start symbol and
     must be one of the *note available start symbols: 51d1.

     コードを実行した結果をPythonオブジェクトとして返します。または、例
     外が発生したならば ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyRun_File (FILE *fp, const char
          *filename, int start, PyObject *globals, PyObject *locals)
     '戻り値: 新しい参照。' 下記の *note PyRun_FileExFlags(): 51d3. の
     'closeit' を ‘0’ にし、 'flags' を ‘NULL’ にして単純化したインター
     フェースです。

 -- C の関数: *note PyObject: 5df. *PyRun_FileEx (FILE *fp, const char
          *filename, int start, PyObject *globals, PyObject *locals, int
          closeit)
     '戻り値: 新しい参照。' 下記の *note PyRun_FileExFlags(): 51d3. の
     'flags' を ‘NULL’ にして単純化したインターフェースです。

 -- C の関数: *note PyObject: 5df. *PyRun_FileFlags (FILE *fp, const
          char *filename, int start, PyObject *globals, PyObject
          *locals, PyCompilerFlags *flags)
     '戻り値: 新しい参照。' 下記の *note PyRun_FileExFlags(): 51d3. の
     'closeit' を ‘0’ にして単純化したインターフェースです。

 -- C の関数: *note PyObject: 5df. *PyRun_FileExFlags (FILE *fp, const
          char *filename, int start, PyObject *globals, PyObject
          *locals, int closeit, PyCompilerFlags *flags)
     '戻り値: 新しい参照。' *note PyRun_StringFlags(): 51d0. と似ていま
     すが、Pythonソースコードをメモリ内の文字列ではなく 'fp' から読み込
     みます。 'filename' はそのファイルの名前でなければならず、 *note
     ファイルシステムのエンコーディングとエラーハンドラ: 75d. でデコード
     されます。 'closeit' に真を指定した場合は、*note
     PyRun_FileExFlags(): 51d3. が処理を戻す前にファイルを閉じます。

 -- C の関数: *note PyObject: 5df. *Py_CompileString (const char *str,
          const char *filename, int start)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  下記
     の *note Py_CompileStringFlags(): 51d6. の 'flags' を ‘NULL’ にして
     単純化したインターフェースです。

 -- C の関数: *note PyObject: 5df. *Py_CompileStringFlags (const char
          *str, const char *filename, int start, PyCompilerFlags *flags)
     '戻り値: 新しい参照。' 下記の *note Py_CompileStringExFlags():
     51d7. の 'optimize' を ‘-1’ にして単純化したインターフェースです。

 -- C の関数: *note PyObject: 5df. *Py_CompileStringObject (const char
          *str, PyObject *filename, int start, PyCompilerFlags *flags,
          int optimize)
     '戻り値: 新しい参照。' Parse and compile the Python source code in
     'str', returning the resulting code object.  The start symbol is
     given by 'start'; this can be used to constrain the code which can
     be compiled and should be *note available start symbols: 51d1.  The
     filename specified by 'filename' is used to construct the code
     object and may appear in tracebacks or *note SyntaxError: 18e.
     exception messages.  This returns ‘NULL’ if the code cannot be
     parsed or compiled.

     整数 'optimize' は、コンパイラの最適化レベルを指定します; ‘-1’ は、
     インタプリタの *note -O: 18c. オプションで与えられるのと同じ最適化
     レベルを選びます。明示的なレベルは、 ‘0’ (最適化なし、 ‘__debug__’
     は真)、 ‘1’ (assert は取り除かれ、 ‘__debug__’ は偽)、 ‘2’
     (docstring も取り除かれる) です。

     Added in version 3.4.

 -- C の関数: *note PyObject: 5df. *Py_CompileStringExFlags (const char
          *str, const char *filename, int start, PyCompilerFlags *flags,
          int optimize)
     '戻り値: 新しい参照。' *note Py_CompileStringObject(): 51d8. と似て
     いますが、 'filename' は *note
     ファイルシステムのエンコーディングとエラーハンドラ: 75d. でデコード
     されたバイト文字列です。

     Added in version 3.2.

 -- C の関数: *note PyObject: 5df. *PyEval_EvalCode (PyObject *co,
          PyObject *globals, PyObject *locals)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     *note PyEval_EvalCodeEx(): 1ada. のシンプルなインターフェースで、コ
     ードオブジェクトと、グローバル変数とローカル変数だけを受け取ります
     。 他の引数には ‘NULL’ が渡されます。

 -- C の関数: *note PyObject: 5df. *PyEval_EvalCodeEx (PyObject *co,
          PyObject *globals, PyObject *locals, PyObject *const *args,
          int argcount, PyObject *const *kws, int kwcount, PyObject
          *const *defs, int defcount, PyObject *kwdefs, PyObject
          *closure)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  与え
     られた特定の環境で、コンパイル済みのコードオブジェクトを評価します
     。この環境はグローバル変数の辞書と、ローカル変数のマッピングオブジ
     ェクト、引数の配列、キーワードとデフォルト値、*note キーワード専用:
     5a5. 引数のデフォルト値の辞書と、セルのクロージャタプルで構成されま
     す。

 -- C の関数: *note PyObject: 5df. *PyEval_EvalFrame (PyFrameObject *f)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  実行
     フレームを評価します。これは *note PyEval_EvalFrameEx(): 122f. に対
     するシンプルなインターフェースで、後方互換性のためのものです。

 -- C の関数: *note PyObject: 5df. *PyEval_EvalFrameEx (PyFrameObject
          *f, int throwflag)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Python のインタープリタの主要な、直接的な関数です。実行フレーム 'f'
     に関連付けられたコードオブジェクトを実行します。 バイトコードを解釈
     して、必要に応じて呼び出しを実行します。 追加の 'throwflag' 引数は
     ほとんど無視できます。 - もし true なら、 すぐに例外を発生させます
     。これはジェネレータオブジェクトの *note throw(): 71c. メソッドで利
     用されます。

     バージョン 3.4 で変更: アクティブな例外を黙って捨てないことを保証す
     るのに便利なように、この関数はデバッグアサーションを含むようになり
     ました。

 -- C の関数: int PyEval_MergeCompilerFlags (PyCompilerFlags *cf)

     現在の評価フレームのフラグを変更します。成功したら true を、失敗し
     たら false を返します。

 -- C Struct: struct PyCompilerFlags

     コンパイラフラグを収めておくための構造体です。コードをコンパイルす
     るだけの場合、この構造体が ‘int flags’ として渡されます。コードを実
     行する場合には ‘PyCompilerFlags *flags’ として渡されます。この場合
     、‘from __future__ import’ は 'flags' の内容を変更できます。

     Whenever ‘PyCompilerFlags *flags’ is ‘NULL’, *note cf_flags: 51da.
     is treated as equal to ‘0’, and any modification due to ‘from
     __future__ import’ is discarded.

      -- C のメンバ変数: int cf_flags

          コンパイラフラグ。

      -- C のメンバ変数: int cf_feature_version

          'cf_feature_version' is the minor Python version.  It should
          be initialized to ‘PY_MINOR_VERSION’.

          The field is ignored by default, it is used if and only if
          ‘PyCF_ONLY_AST’ flag is set in *note cf_flags: 51da.

     バージョン 3.8 で変更: Added 'cf_feature_version' field.

     The available compiler flags are accessible as macros:

      -- C のマクロ: PyCF_ALLOW_TOP_LEVEL_AWAIT
      -- C のマクロ: PyCF_ONLY_AST
      -- C のマクロ: PyCF_OPTIMIZED_AST
      -- C のマクロ: PyCF_TYPE_COMMENTS

          See *note compiler flags: 25c7. in documentation of the ‘ast’
          Python module, which exports these constants under the same
          names.

     The "‘PyCF’" flags above can be combined with "‘CO_FUTURE’" flags
     such as *note CO_FUTURE_ANNOTATIONS: 51e0. to enable features
     normally selectable using *note future statements: 45d.  See *note
     Code Object Flags: 51e1. for a complete list.

* Menu:

* Available start symbols::
* Stack Effects::


File: python.info,  Node: Available start symbols,  Next: Stack Effects,  Up: 超高水準レイヤ

7.3.1 Available start symbols
-----------------------------

 -- C 変数: int Py_eval_input

     単独の式に対するPython文法の開始記号で、 *note Py_CompileString():
     a85. と一緒に使います。

 -- C 変数: int Py_file_input

     ファイルあるいは他のソースから読み込まれた文の並びに対するPython文
     法の開始記号で、 *note Py_CompileString(): a85. と一緒に使います。
     これは任意の長さのPythonソースコードをコンパイルするときに使う記号
     です。

 -- C 変数: int Py_single_input

     単一の文に対するPython文法の開始記号で、 *note Py_CompileString():
     a85. と一緒に使います。これは対話式のインタプリタループのための記号
     です。

 -- C 変数: int Py_func_type_input

     The start symbol from the Python grammar for a function type; for
     use with *note Py_CompileString(): a85.  This is used to parse
     "signature type comments" from PEP 484(1).

     This requires the *note PyCF_ONLY_AST: 51dd. flag to be set.

     参考
     ....

        * *note ast.FunctionType: 4b7e.

        * PEP 484(2)

     Added in version 3.8.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/

   (2) https://peps.python.org/pep-0484/


File: python.info,  Node: Stack Effects,  Prev: Available start symbols,  Up: 超高水準レイヤ

7.3.2 Stack Effects
-------------------

参考
....

*note dis.stack_effect(): 1132.

 -- C のマクロ: PY_INVALID_STACK_EFFECT

     Sentinel value representing an invalid stack effect.

     This is currently equivalent to ‘INT_MAX’.

     Added in version 3.8.

 -- C の関数: int PyCompile_OpcodeStackEffect (int opcode, int oparg)

     'opcode' と引数 'oparg' がスタックに与える影響を計算します。

     On success, this function returns the stack effect; on failure,
     this returns *note PY_INVALID_STACK_EFFECT: 51e4.

     Added in version 3.4.

 -- C の関数: int PyCompile_OpcodeStackEffectWithJump (int opcode, int
          oparg, int jump)

     Similar to *note PyCompile_OpcodeStackEffect(): 51e5, but don't
     include the stack effect of jumping if 'jump' is zero.

     If 'jump' is ‘0’, this will not include the stack effect of
     jumping, but if 'jump' is ‘1’ or ‘-1’, this will include it.

     On success, this function returns the stack effect; on failure,
     this returns *note PY_INVALID_STACK_EFFECT: 51e4.

     Added in version 3.8.


File: python.info,  Node: 参照カウント,  Next: 例外処理,  Prev: 超高水準レイヤ,  Up: Python/C API リファレンスマニュアル

7.4 参照カウント
================

このセクションにある関数とマクロは、 Python オブジェクトの参照カウントの
管理に使用されます。

 -- C の関数: *note Py_ssize_t: c55. Py_REFCNT (PyObject *o)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Python オブジェクト 'o' の参照カウントを取得します。

     戻り値は、実際に保持されているオブジェクトの参照の数を実際に反映し
     ているとは限らないことに注意してください。例えば、一部のオブジェク
     トは永続 (*note immortal: 290.) であり、実際の参照の数を反映しない
     非常に高い参照数を持ちます。したがって、 0 か 1 の値以外では、正確
     な戻り値に頼らないでください。

     オブジェクトの参照カウントを設定するためには、 *note
     Py_SET_REFCNT(): aa8. 関数を使用してください。

          注釈: On *note free-threaded builds: 176d. of Python,
          returning 1 isn't sufficient to determine if it's safe to
          treat 'o' as having no access by other threads.  Use *note
          PyUnstable_Object_IsUniquelyReferenced(): 3c6. for that
          instead.

          See also the function *note
          PyUnstable_Object_IsUniqueReferencedTemporary(): 3c7.

     バージョン 3.10 で変更: *note Py_REFCNT(): 2cf. は static なインラ
     イン関数に変更されました。

     バージョン 3.11 で変更: 引数の型は const *note PyObject: 5df.* では
     なくなりました。

 -- C の関数: void Py_SET_REFCNT (PyObject *o, Py_ssize_t refcnt)

     オブジェクト 'o' の参照カウントを 'refcnt' に設定します。

     *note フリースレッドな Python ビルド: 216e. では、 'refcnt' が
     ‘UINT32_MAX’ より大きい場合、オブジェクトは永続 (*note immortal:
     290.) となります。

     この関数は永続 (*note immortal: 290.) オブジェクトには何もしません
     。

     Added in version 3.9.

     バージョン 3.12 で変更: 永続オブジェクトは変更されません。

 -- C の関数: void Py_INCREF (PyObject *o)

     オブジェクト 'o' への新しい *note 強参照: 5e2. を取得し、それが使用
     中で破棄されてはならないことを示します。

     この関数は永続 (*note immortal: 290.) オブジェクトには何もしません
     。

     This function is usually used to convert a *note borrowed
     reference: 3d7. to a *note strong reference: 5e2. in-place.  The
     *note Py_NewRef(): a9a. function can be used to create a new *note
     strong reference: 5e2.

     When done using the object, release is by calling *note
     Py_DECREF(): 790.

     オブジェクトが ‘NULL’ であってはいけません。それが ‘NULL’ ではない
     と確信が持てないならば、 *note Py_XINCREF(): c5a. を使ってください
     。

     Do not expect this function to actually modify 'o' in any way.  For
     at least some objects(1), this function has no effect.

     バージョン 3.12 で変更: 永続オブジェクトは変更されません。

 -- C の関数: void Py_XINCREF (PyObject *o)

     Similar to *note Py_INCREF(): 78f, but the object 'o' can be
     ‘NULL’, in which case this has no effect.

     See also *note Py_XNewRef(): a9b.

 -- C の関数: *note PyObject: 5df. *Py_NewRef (PyObject *o)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Create a new *note strong reference: 5e2. to an object: call *note
     Py_INCREF(): 78f. on 'o' and return the object 'o'.

     When the *note strong reference: 5e2. is no longer needed, *note
     Py_DECREF(): 790. should be called on it to release the reference.

     The object 'o' must not be ‘NULL’; use *note Py_XNewRef(): a9b. if
     'o' can be ‘NULL’.

     例えば:

          Py_INCREF(obj);
          self->attr = obj;

     can be written as:

          self->attr = Py_NewRef(obj);

     See also *note Py_INCREF(): 78f.

     Added in version 3.10.

 -- C の関数: *note PyObject: 5df. *Py_XNewRef (PyObject *o)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Similar to *note Py_NewRef(): a9a, but the object 'o' can be NULL.

     If the object 'o' is ‘NULL’, the function just returns ‘NULL’.

     Added in version 3.10.

 -- C の関数: void Py_DECREF (PyObject *o)

     Release a *note strong reference: 5e2. to object 'o', indicating
     the reference is no longer used.

     この関数は永続 (*note immortal: 290.) オブジェクトには何もしません
     。

     Once the last *note strong reference: 5e2. is released (i.e.  the
     object's reference count reaches 0), the object's type's
     deallocation function (which must not be ‘NULL’) is invoked.

     This function is usually used to delete a *note strong reference:
     5e2. before exiting its scope.

     オブジェクトが ‘NULL’ であってはいけません。それが ‘NULL’ ではない
     と確信が持てないならば、 *note Py_XDECREF(): 992. を使ってください
     。

     Do not expect this function to actually modify 'o' in any way.  For
     at least some objects(2), this function has no effect.

          警告: The deallocation function can cause arbitrary Python
          code to be invoked (e.g.  when a class instance with a *note
          __del__(): 11ff. method is deallocated).  While exceptions in
          such code are not propagated, the executed code has free
          access to all Python global variables.  This means that any
          object that is reachable from a global variable should be in a
          consistent state before *note Py_DECREF(): 790. is invoked.
          For example, code to delete an object from a list should copy
          a reference to the deleted object in a temporary variable,
          update the list data structure, and then call *note
          Py_DECREF(): 790. for the temporary variable.

     バージョン 3.12 で変更: 永続オブジェクトは変更されません。

 -- C の関数: void Py_XDECREF (PyObject *o)

     Similar to *note Py_DECREF(): 790, but the object 'o' can be
     ‘NULL’, in which case this has no effect.  The same warning from
     *note Py_DECREF(): 790. applies here as well.

 -- C の関数: void Py_CLEAR (PyObject *o)

     Release a *note strong reference: 5e2. for object 'o'.  The object
     may be ‘NULL’, in which case the macro has no effect; otherwise the
     effect is the same as for *note Py_DECREF(): 790, except that the
     argument is also set to ‘NULL’.  The warning for *note Py_DECREF():
     790. does not apply with respect to the object passed because the
     macro carefully uses a temporary variable and sets the argument to
     ‘NULL’ before releasing the reference.

     It is a good idea to use this macro whenever releasing a reference
     to an object that might be traversed during garbage collection.

     バージョン 3.12 で変更: The macro argument is now only evaluated
     once.  If the argument has side effects, these are no longer
     duplicated.

 -- C の関数: void Py_IncRef (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'  Indicate taking a new
     *note strong reference: 5e2. to object 'o'.  A function version of
     *note Py_XINCREF(): c5a.  It can be used for runtime dynamic
     embedding of Python.

 -- C の関数: void Py_DecRef (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'  Release a *note strong
     reference: 5e2. to object 'o'.  A function version of *note
     Py_XDECREF(): 992.  It can be used for runtime dynamic embedding of
     Python.

 -- C のマクロ: Py_SETREF (dst, src)

     Macro safely releasing a *note strong reference: 5e2. to object
     'dst' and setting 'dst' to 'src'.

     As in case of *note Py_CLEAR(): 798, "the obvious" code can be
     deadly:

          Py_DECREF(dst);
          dst = src;

     The safe way is:

          Py_SETREF(dst, src);

     That arranges to set 'dst' to 'src' 'before' releasing the
     reference to the old value of 'dst', so that any code triggered as
     a side-effect of 'dst' getting torn down no longer believes 'dst'
     points to a valid object.

     Added in version 3.6.

     バージョン 3.12 で変更: The macro arguments are now only evaluated
     once.  If an argument has side effects, these are no longer
     duplicated.

 -- C のマクロ: Py_XSETREF (dst, src)

     Variant of *note Py_SETREF: 799. macro that uses *note
     Py_XDECREF(): 992. instead of *note Py_DECREF(): 790.

     Added in version 3.6.

     バージョン 3.12 で変更: The macro arguments are now only evaluated
     once.  If an argument has side effects, these are no longer
     duplicated.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0683/

   (2) https://peps.python.org/pep-0683/


File: python.info,  Node: 例外処理,  Next: 拡張モジュールの定義,  Prev: 参照カウント,  Up: Python/C API リファレンスマニュアル

7.5 例外処理
============

この章で説明する関数を使うと、 Python の例外の処理や例外の送出ができるよ
うになります。 Python の例外処理の基本をいくらか理解することが大切です。
例外は POSIX ‘errno’ 変数にやや似た機能を果たします: 発生した中で最も新
しいエラーの (スレッド毎の) グローバルなインジケータがあります。実行に成
功した場合にはほとんどの C API 関数がこれをクリアしませんが、失敗したと
きにはエラーの原因を示すために設定します。ほとんどの C API 関数はエラー
インジケータも返し、通常は関数がポインタを返すことになっている場合は
‘NULL’ であり、関数が整数を返す場合は ‘-1’ です。(例外: ‘PyArg_*’ 関数は
実行に成功したときに ‘1’ を返し、失敗したときに ‘0’ を返します).

具体的には、エラーインジケータは、例外の型、例外の値、トレースバックオブ
ジェクトの３つのオブジェクトポインタで構成されます。これらのポインタはど
れでも、設定されない場合は ‘NULL’ になりえます（ただし、いくつかの組み合
わせは禁止されており、例えば、例外の型が ‘NULL’ の場合は、トレースバック
は非 ‘NULL’ の値になりません）

ある関数が呼び出した関数がいくつか失敗したために、その関数が失敗しなけれ
ばならないとき、一般的にエラーインジケータを設定しません。呼び出した関数
がすでに設定しています。エラーを処理して例外をクリアするか、あるいは (オ
ブジェクト参照またはメモリ割り当てのような)それが持つどんなリソースも取
り除いた後に戻るかのどちらか一方を行う責任があります。エラーを処理する準
備をしていなければ、普通に続けるべきでは 'ありません'。エラーのために戻
る場合は、エラーが設定されていると呼び出し元に知らせることが大切です。エ
ラーが処理されていない場合または丁寧に伝えられている場合には、Python/C
APIのさらなる呼び出しは意図した通りには動かない可能性があり、不可解な形
で失敗するかもしれません。

     注釈: The error indicator is 'not' the result of *note
     sys.exc_info(): 89a.  The former corresponds to an exception that
     is not yet caught (and is therefore still propagating), while the
     latter returns an exception after it is caught (and has therefore
     stopped propagating).

* Menu:

* 出力とクリア::
* 例外の送出::
* 警告: 警告<3>.
* エラーインジケータの問い合わせ::
* シグナルハンドリング: シグナルハンドリング<2>.
* 例外クラス: 例外クラス<2>.
* 例外オブジェクト::
* Unicode 例外オブジェクト::
* 再帰の管理::
* Exception and warning types::
* Tracebacks::


File: python.info,  Node: 出力とクリア,  Next: 例外の送出,  Up: 例外処理

7.5.1 出力とクリア
------------------

 -- C の関数: void PyErr_Clear ()
     ' 次に属します: *note Stable ABI: 775.'  エラーインジケータをクリア
     します。エラーインジケータが設定されていないならば、効果はありませ
     ん。

 -- C の関数: void PyErr_PrintEx (int set_sys_last_vars)
     ' 次に属します: *note Stable ABI: 775.'  標準のトレースバックを
     ‘sys.stderr’ に出力し、エラーインジケータをクリアします。 ただし、
     エラーが ‘SystemExit’ 'である場合を除いて' です。 その場合、トレー
     スバックは出力されず、 Python プロセスは ‘SystemExit’ インスタンス
     で指定されたエラーコードで終了します。

     エラーインジケータが設定されているときに 'だけ'、この関数を呼び出し
     てください。 それ以外の場合、致命的なエラーを引き起こすでしょう!

     If 'set_sys_last_vars' is nonzero, the variable *note sys.last_exc:
     6e5. is set to the printed exception.  For backwards compatibility,
     the deprecated variables *note sys.last_type: 6e6, *note
     sys.last_value: 6e7. and *note sys.last_traceback: 6e8. are also
     set to the type, value and traceback of this exception,
     respectively.

     バージョン 3.12 で変更: The setting of *note sys.last_exc: 6e5. was
     added.

 -- C の関数: void PyErr_Print ()
     ' 次に属します: *note Stable ABI: 775.'  ‘PyErr_PrintEx(1)’ のエイ
     リアスです。

 -- C の関数: void PyErr_WriteUnraisable (PyObject *obj)
     ' 次に属します: *note Stable ABI: 775.'  現在の例外と 'obj' 引数で
     *note sys.unraisablehook(): 507. を呼び出します。

     This utility function prints a warning message to ‘sys.stderr’ when
     an exception has been set but it is impossible for the interpreter
     to actually raise the exception.  It is used, for example, when an
     exception occurs in an *note __del__(): 11ff. method.

     The function is called with a single argument 'obj' that identifies
     the context in which the unraisable exception occurred.  If
     possible, the repr of 'obj' will be printed in the warning message.
     If 'obj' is ‘NULL’, only the traceback is printed.

     この関数を呼び出すときには、例外がセットされていなければなりません
     。

     バージョン 3.4 で変更: Print a traceback.  Print only traceback if
     'obj' is ‘NULL’.

     バージョン 3.8 で変更: Use *note sys.unraisablehook(): 507.

 -- C の関数: void PyErr_FormatUnraisable (const char *format, ...)

     Similar to *note PyErr_WriteUnraisable(): 5f2, but the 'format' and
     subsequent parameters help format the warning message; they have
     the same meaning and values as in *note PyUnicode_FromFormat():
     62b.  ‘PyErr_WriteUnraisable(obj)’ is roughly equivalent to
     ‘PyErr_FormatUnraisable("Exception ignored in: %R", obj)’.  If
     'format' is ‘NULL’, only the traceback is printed.

     Added in version 3.13.

 -- C の関数: void PyErr_DisplayException (PyObject *exc)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'
     Print the standard traceback display of ‘exc’ to ‘sys.stderr’,
     including chained exceptions and notes.

     Added in version 3.12.


File: python.info,  Node: 例外の送出,  Next: 警告<3>,  Prev: 出力とクリア,  Up: 例外処理

7.5.2 例外の送出
----------------

以下の関数は、現在のスレッドのエラーインジケータの設定を補助します。利便
性のため、これらの関数のいくつかは、 ‘return’ 文で利用できるように常に
‘NULL’ ポインタを返します。

 -- C の関数: void PyErr_SetString (PyObject *type, const char *message)
     ' 次に属します: *note Stable ABI: 775.'  This is the most common
     way to set the error indicator.  The first argument specifies the
     exception type; it is normally one of the standard exceptions, e.g.
     *note PyExc_RuntimeError: 500c.  You need not create a new *note
     strong reference: 5e2. to it (e.g.  with *note Py_INCREF(): 78f.).
     The second argument is an error message; it is decoded from
     ‘'utf-8'’.

 -- C の関数: void PyErr_SetObject (PyObject *type, PyObject *value)
     ' 次に属します: *note Stable ABI: 775.'  この関数は *note
     PyErr_SetString(): 79c. に似ていますが、例外の "値(value)" として任
     意のPythonオブジェクトを指定することができます。

 -- C の関数: *note PyObject: 5df. *PyErr_Format (PyObject *exception,
          const char *format, ...)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775.'  この
     関数はエラーインジケータを設定し ‘NULL’ を返します。 'exception' は
     Python例外クラスであるべきです。 'format' と以降の引数はエラーメッ
     セージを作るためのもので, *note PyUnicode_FromFormat(): 62b. の引数
     と同じ意味を持っています。 'format' は ASCII エンコードされた文字列
     です。

 -- C の関数: *note PyObject: 5df. *PyErr_FormatV (PyObject *exception,
          const char *format, va_list vargs)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.5 より).'  *note PyErr_Format(): 10b1. と同じですが、可変
     長引数の代わりに ‘va_list’ 引数を受け取ります。

     Added in version 3.5.

 -- C の関数: void PyErr_SetNone (PyObject *type)
     ' 次に属します: *note Stable ABI: 775.'  これは
     ‘PyErr_SetObject(type, Py_None)’ を省略したものです。

 -- C の関数: int PyErr_BadArgument ()
     ' 次に属します: *note Stable ABI: 775.'  これは
     ‘PyErr_SetString(PyExc_TypeError, message)’ を省略したもので、ここ
     で 'message' は組み込み操作が不正な引数で呼び出されたということを表
     しています。主に内部で使用するためのものです。

 -- C の関数: *note PyObject: 5df. *PyErr_NoMemory ()
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775.'  これ
     は ‘PyErr_SetNone(PyExc_MemoryError)’ を省略したもので、‘NULL’ を返
     します。したがって、メモリ不足になったとき、オブジェクト割り当て関
     数は ‘return PyErr_NoMemory();’ と書くことができます。

 -- C の関数: *note PyObject: 5df. *PyErr_SetFromErrno (PyObject *type)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775.'

     This is a convenience function to raise an exception when a C
     library function has returned an error and set the C variable
     ‘errno’.  It constructs a tuple object whose first item is the
     integer ‘errno’ value and whose second item is the corresponding
     error message (gotten from ‘strerror()’), and then calls
     ‘PyErr_SetObject(type, object)’.  On Unix, when the ‘errno’ value
     is ‘EINTR’, indicating an interrupted system call, this calls *note
     PyErr_CheckSignals(): 693, and if that set the error indicator,
     leaves it set to that.  The function always returns ‘NULL’, so a
     wrapper function around a system call can write ‘return
     PyErr_SetFromErrno(type);’ when the system call returns an error.

 -- C の関数: *note PyObject: 5df. *PyErr_SetFromErrnoWithFilenameObject
          (PyObject *type, PyObject *filenameObject)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775.'
     Similar to *note PyErr_SetFromErrno(): 4e98, with the additional
     behavior that if 'filenameObject' is not ‘NULL’, it is passed to
     the constructor of 'type' as a third parameter.  In the case of
     *note OSError: 2c0. exception, this is used to define the
     ‘filename’ attribute of the exception instance.

 -- C の関数: *note PyObject: 5df.
          *PyErr_SetFromErrnoWithFilenameObjects (PyObject *type,
          PyObject *filenameObject, PyObject *filenameObject2)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'  *note PyErr_SetFromErrnoWithFilenameObject():
     4fd3. に似てますが、ファイル名を2つ取る関数が失敗したときに例外を送
     出するために、2つ目のファイル名オブジェクトを受け取ります。

     Added in version 3.4.

 -- C の関数: *note PyObject: 5df. *PyErr_SetFromErrnoWithFilename
          (PyObject *type, const char *filename)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775.'
     *note PyErr_SetFromErrnoWithFilenameObject(): 4fd3. に似ていますが
     、ファイル名は C 文字列として与えられます。 'filename' は *note
     ファイルシステムのエンコーディングとエラーハンドラ: 75d. でデコード
     されます。

 -- C の関数: *note PyObject: 5df. *PyErr_SetFromWindowsErr (int ierr)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775. on
     Windows (バージョン 3.7 より).'  This is a convenience function to
     raise *note OSError: 2c0.  If called with 'ierr' of ‘0’, the error
     code returned by a call to ‘GetLastError()’ is used instead.  It
     calls the Win32 function ‘FormatMessage()’ to retrieve the Windows
     description of error code given by 'ierr' or ‘GetLastError()’, then
     it constructs a *note OSError: 2c0. object with the *note winerror:
     26ef. attribute set to the error code, the *note strerror: 26f0.
     attribute set to the corresponding error message (gotten from
     ‘FormatMessage()’), and then calls ‘PyErr_SetObject(PyExc_OSError,
     object)’.  This function always returns ‘NULL’.

     *note Availability: 213f.: Windows.

 -- C の関数: *note PyObject: 5df. *PyErr_SetExcFromWindowsErr (PyObject
          *type, int ierr)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775. on
     Windows (バージョン 3.7 より).'  *note PyErr_SetFromWindowsErr():
     4fd5. に似ていますが、送出する例外の型を指定する引数が追加されてい
     ます。

     *note Availability: 213f.: Windows.

 -- C の関数: *note PyObject: 5df. *PyErr_SetFromWindowsErrWithFilename
          (int ierr, const char *filename)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775. on
     Windows (バージョン 3.7 より).'  Similar to *note
     PyErr_SetFromWindowsErr(): 4fd5, with the additional behavior that
     if 'filename' is not ‘NULL’, it is decoded from the filesystem
     encoding (*note os.fsdecode(): e4e.) and passed to the constructor
     of *note OSError: 2c0. as a third parameter to be used to define
     the ‘filename’ attribute of the exception instance.

     *note Availability: 213f.: Windows.

 -- C の関数: *note PyObject: 5df.
          *PyErr_SetExcFromWindowsErrWithFilenameObject (PyObject *type,
          int ierr, PyObject *filename)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775. on
     Windows (バージョン 3.7 より).'  Similar to *note
     PyErr_SetExcFromWindowsErr(): 4fd0, with the additional behavior
     that if 'filename' is not ‘NULL’, it is passed to the constructor
     of *note OSError: 2c0. as a third parameter to be used to define
     the ‘filename’ attribute of the exception instance.

     *note Availability: 213f.: Windows.

 -- C の関数: *note PyObject: 5df.
          *PyErr_SetExcFromWindowsErrWithFilenameObjects (PyObject
          *type, int ierr, PyObject *filename, PyObject *filename2)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775. on
     Windows (バージョン 3.7 より).'  *note
     PyErr_SetExcFromWindowsErrWithFilenameObject(): 4fd1. に似てますが
     、2つ目のファイル名オブジェクトを受け取ります。

     *note Availability: 213f.: Windows.

     Added in version 3.4.

 -- C の関数: *note PyObject: 5df.
          *PyErr_SetExcFromWindowsErrWithFilename (PyObject *type, int
          ierr, const char *filename)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775. on
     Windows (バージョン 3.7 より).'  *note
     PyErr_SetFromWindowsErrWithFilename(): 1a87. に似ていますが、送出す
     る例外の型を指定する引数が追加されています。

     *note Availability: 213f.: Windows.

 -- C の関数: *note PyObject: 5df. *PyErr_SetImportError (PyObject *msg,
          PyObject *name, PyObject *path)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'  *note ImportError: 65b. を簡単に送出するための
     関数です。 'msg' は例外のメッセージ文字列としてセットされます。
     'name' と 'path' はどちらも ‘NULL’ にしてよく、それぞれ *note
     ImportError: 65b. の ‘name’ 属性と ‘path’ 属性としてセットされます
     。

     Added in version 3.3.

 -- C の関数: *note PyObject: 5df. *PyErr_SetImportErrorSubclass
          (PyObject *exception, PyObject *msg, PyObject *name, PyObject
          *path)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.6 より).'  *note PyErr_SetImportError(): f39. とよく似てい
     ますが、この関数は送出する例外として、 *note ImportError: 65b. のサ
     ブクラスを指定できます。

     Added in version 3.6.

 -- C の関数: void PyErr_SyntaxLocationObject (PyObject *filename, int
          lineno, int col_offset)

     現在の例外のファイル、行、オフセットの情報をセットします。 現在の例
     外が *note SyntaxError: 18e. でない場合は、例外を表示するサブシステ
     ムが、例外が *note SyntaxError: 18e. であると思えるように属性を追加
     します。

     Added in version 3.4.

 -- C の関数: void PyErr_RangedSyntaxLocationObject (PyObject *filename,
          int lineno, int col_offset, int end_lineno, int
          end_col_offset)

     Similar to *note PyErr_SyntaxLocationObject(): 51ef, but also sets
     the 'end_lineno' and 'end_col_offset' information for the current
     exception.

     Added in version 3.10.

 -- C の関数: void PyErr_SyntaxLocationEx (const char *filename, int
          lineno, int col_offset)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     *note PyErr_SyntaxLocationObject(): 51ef. と似ていますが、
     'filename' は *note
     ファイルシステムのエンコーディングとエラーハンドラ: 75d. でデコード
     されたバイト文字列です。

     Added in version 3.2.

 -- C の関数: void PyErr_SyntaxLocation (const char *filename, int
          lineno)
     ' 次に属します: *note Stable ABI: 775.'  *note
     PyErr_SyntaxLocationEx(): 4fd9. と似ていますが、 'col_offset' 引数
     が除去されています。

 -- C の関数: void PyErr_BadInternalCall ()
     ' 次に属します: *note Stable ABI: 775.'
     ‘PyErr_SetString(PyExc_SystemError, message)’ を省略したものです。
     ここで 'message' は内部操作(例えば、Python/C API関数)が不正な引数と
     ともに呼び出されたということを示しています。主に内部で使用するため
     のものです。

 -- C の関数: *note PyObject: 5df. *PyErr_ProgramTextObject (PyObject
          *filename, int lineno)

     Get the source line in 'filename' at line 'lineno'.  'filename'
     should be a Python *note str: 169. object.

     On success, this function returns a Python string object with the
     found line.  On failure, this function returns ‘NULL’ without an
     exception set.

 -- C の関数: *note PyObject: 5df. *PyErr_ProgramText (const char
          *filename, int lineno)
     ' 次に属します: *note Stable ABI: 775.'  Similar to *note
     PyErr_ProgramTextObject(): 51f1, but 'filename' is a const char*,
     which is decoded with the *note filesystem encoding and error
     handler: 75d, instead of a Python object reference.


File: python.info,  Node: 警告<3>,  Next: エラーインジケータの問い合わせ,  Prev: 例外の送出,  Up: 例外処理

7.5.3 警告
----------

以下の関数を使い、 C コードで起きた警告を報告します。 Python の *note
warnings: 118. モジュールで公開されている同様の関数とよく似てます。 これ
らの関数は通常警告メッセージを 'sys.stderr' へ出力しますが、ユーザが警告
をエラーへ変更するように指定することもでき、その場合は、関数は例外を送出
します。 警告機構がもつ問題のためにその関数が例外を送出するということも
有り得ます。 例外が送出されない場合は戻り値は ‘0’ で、例外が送出された場
合は ‘-1’ です。 (警告メッセージが実際に出力されるか、およびその例外の原
因が何かについては判断できません; これは意図的なものです。) 例外が送出さ
れた場合、呼び出し元は通常の例外処理を行います (例えば、保持していた参照
に対し *note Py_DECREF(): 790. を行い、エラー値を返します)。

 -- C の関数: int PyErr_WarnEx (PyObject *category, const char *message,
          Py_ssize_t stack_level)
     ' 次に属します: *note Stable ABI: 775.'  警告メッセージを発行します
     。 'category' 引数は警告カテゴリ(以下を参照) かまたは ‘NULL’ で、
     'message' 引数は UTF-8 エンコードされた文字列です。 'stacklevel' は
     スタックフレームの数を示す正の整数です; 警告はそのスタックフレーム
     の中の実行している行から発行されます。 'stacklevel' が 1 だと *note
     PyErr_WarnEx(): 1665. を呼び出している関数が、2 だとその上の関数が
     Warning の発行元になります。

     警告カテゴリは *note PyExc_Warning: 501d. のサブクラスでなければな
     りません。 *note PyExc_Warning: 501d. は *note PyExc_Exception:
     4ff1. のサブクラスです。 デフォルトの警告カテゴリは *note
     PyExc_RuntimeWarning: 500d. です。 標準の Python 警告カテゴリは、
     *note Warning types: 51f3. で名前が列挙されているグローバル変数とし
     て利用可能です。

     警告をコントロールするための情報については、 *note warnings: 118. モ
     ジュールのドキュメンテーションとコマンドライン・ドキュメンテーショ
     ンの *note -W: ac6. オプションを参照してください。警告コントロール
     のためのC APIはありません。

 -- C の関数: int PyErr_WarnExplicitObject (PyObject *category, PyObject
          *message, PyObject *filename, int lineno, PyObject *module,
          PyObject *registry)

     すべての警告の属性を明示的に制御した警告メッセージを出します。これ
     は Python 関数 *note warnings.warn_explicit(): efd. の直接的なラッ
     パーで、さらに情報を得るにはそちらを参照してください。そこに説明さ
     れているデフォルトの効果を得るために、 'module' と 'registry' 引数
     は ‘NULL’ に設定することができます。

     Added in version 3.4.

 -- C の関数: int PyErr_WarnExplicit (PyObject *category, const char
          *message, const char *filename, int lineno, const char
          *module, PyObject *registry)
     ' 次に属します: *note Stable ABI: 775.'  *note
     PyErr_WarnExplicitObject(): 51f4. に似ていますが、 'message' と
     'module' が UTF-8 エンコードされた文字列であるところが異なり、
     'filename' は *note
     ファイルシステムのエンコーディングとエラーハンドラ: 75d. でデコード
     されます。

 -- C の関数: int PyErr_WarnFormat (PyObject *category, Py_ssize_t
          stack_level, const char *format, ...)
     ' 次に属します: *note Stable ABI: 775.'  *note PyErr_WarnEx():
     1665. に似たような関数ですが、警告メッセージをフォーマットするのに
     *note PyUnicode_FromFormat(): 62b. を使用します。 'format' は ASCII
     にエンコードされた文字列です。

     Added in version 3.2.

 -- C の関数: int PyErr_WarnExplicitFormat (PyObject *category, const
          char *filename, int lineno, const char *module, PyObject
          *registry, const char *format, ...)

     Similar to *note PyErr_WarnExplicit(): 1a8d, but uses *note
     PyUnicode_FromFormat(): 62b. to format the warning message.
     'format' is an ASCII-encoded string.

     Added in version 3.2.

 -- C の関数: int PyErr_ResourceWarning (PyObject *source, Py_ssize_t
          stack_level, const char *format, ...)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.6 より).'
     Function similar to *note PyErr_WarnFormat(): 4fda, but 'category'
     is *note ResourceWarning: 54c. and it passes 'source' to
     ‘warnings.WarningMessage’.

     Added in version 3.6.


File: python.info,  Node: エラーインジケータの問い合わせ,  Next: シグナルハンドリング<2>,  Prev: 警告<3>,  Up: 例外処理

7.5.4 エラーインジケータの問い合わせ
------------------------------------

 -- C の関数: *note PyObject: 5df. *PyErr_Occurred ()
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  エラー
     インジケータが設定されているかテストします。設定されている場合は、
     例外の '型' (‘PyErr_Set*’ 関数の一つあるいは *note PyErr_Restore():
     42b. への最も新しい呼び出しに対する第一引数)を返します。設定されて
     いない場合は ‘NULL’ を返します。あなたは戻り値への参照を持っていま
     せんので、それに *note Py_DECREF(): 790. する必要はありません。

     The caller must have an *note attached thread state: 4ed1.

          注釈: 戻り値を特定の例外と比較しないでください。その代わりに、
          下に示す *note PyErr_ExceptionMatches(): 4f4e. を使ってくださ
          い。(比較は簡単に失敗するでしょう。なぜなら、例外はクラスでは
          なくインスタンスかもしれないし、あるいは、クラス例外の場合は期
          待される例外のサブクラスかもしれないからです。)

 -- C の関数: int PyErr_ExceptionMatches (PyObject *exc)
     ' 次に属します: *note Stable ABI: 775.'
     ‘PyErr_GivenExceptionMatches(PyErr_Occurred(), exc)’ と同じ。例外が
     実際に設定されたときにだけ、これを呼び出だすべきです。例外が発生し
     ていないならば、メモリアクセス違反が起きるでしょう。

 -- C の関数: int PyErr_GivenExceptionMatches (PyObject *given, PyObject
          *exc)
     ' 次に属します: *note Stable ABI: 775.'  例外 'given' が 'exc' の例
     外型と適合する場合に真を返します。 'exc' がクラスオブジェクトである
     場合も、 'given' がサブクラスのインスタンスであるときに真を返します
     。 'exc' がタプルの場合は、タプルにある (およびそのサブタプルに再帰
     的にある) すべての例外型が適合するか調べられます。

 -- C の関数: *note PyObject: 5df. *PyErr_GetRaisedException (void)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.12 より).'  現在発生している例外を返し、同時にエラーインジ
     ケータを消去します。エラーインジケータが設定されていない場合は
     ‘NULL’ を返します。

     この関数は、例外をキャッチする必要があるコード、または一時的にエラ
     ーインジケータを保存・復元する必要があるコードに使用されます。

     例えば:

          {
             PyObject *exc = PyErr_GetRaisedException();

             /* ... 他のエラーを発生させる可能性があるコード ... */

             PyErr_SetRaisedException(exc);
          }

     参考
     ....

     *note PyErr_GetHandledException(): 973, to save the exception
     currently being handled.

     Added in version 3.12.

 -- C の関数: void PyErr_SetRaisedException (PyObject *exc)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'
     Set 'exc' as the exception currently being raised, clearing the
     existing exception if one is set.

          警告: This call steals a reference to 'exc', which must be a
          valid exception.

     Added in version 3.12.

 -- C の関数: void PyErr_Fetch (PyObject **ptype, PyObject **pvalue,
          PyObject **ptraceback)
     ' 次に属します: *note Stable ABI: 775.'

     バージョン 3.12 で非推奨: Use *note PyErr_GetRaisedException():
     429. instead.

     エラーインジケータをアドレスを渡す三つの変数の中へ取り出します。エ
     ラーインジケータが設定されていない場合は、三つすべての変数を ‘NULL’
     に設定します。エラーインジケータが設定されている場合はクリアされ、
     あなたは取り出されたそれぞれのオブジェクトへの参照を持つことになり
     ます。型オブジェクトが ‘NULL’ でないときでさえ、その値とトレースバ
     ックオブジェクトは ‘NULL’ かもしれません。

          注釈: This function is normally only used by legacy code that
          needs to catch exceptions or save and restore the error
          indicator temporarily.

          例えば:

               {
                  PyObject *type, *value, *traceback;
                  PyErr_Fetch(&type, &value, &traceback);

                  /* ... code that might produce other errors ... */

                  PyErr_Restore(type, value, traceback);
               }

 -- C の関数: void PyErr_Restore (PyObject *type, PyObject *value,
          PyObject *traceback)
     ' 次に属します: *note Stable ABI: 775.'

     バージョン 3.12 で非推奨: Use *note PyErr_SetRaisedException():
     42c. instead.

     Set the error indicator from the three objects, 'type', 'value',
     and 'traceback', clearing the existing exception if one is set.  If
     the objects are ‘NULL’, the error indicator is cleared.  Do not
     pass a ‘NULL’ type and non-‘NULL’ value or traceback.  The
     exception type should be a class.  Do not pass an invalid exception
     type or value.  (Violating these rules will cause subtle problems
     later.)  This call takes away a reference to each object: you must
     own a reference to each object before the call and after the call
     you no longer own these references.  (If you don't understand this,
     don't use this function.  I warned you.)

          注釈: This function is normally only used by legacy code that
          needs to save and restore the error indicator temporarily.
          Use *note PyErr_Fetch(): 428. to save the current error
          indicator.

 -- C の関数: void PyErr_NormalizeException (PyObject **exc, PyObject
          **val, PyObject **tb)
     ' 次に属します: *note Stable ABI: 775.'

     バージョン 3.12 で非推奨: Use *note PyErr_GetRaisedException():
     429. instead, to avoid any possible de-normalization.

     ある状況では、以下の *note PyErr_Fetch(): 428. が返す値は "正規化さ
     れていない" 可能性があります。つまり、 ‘*exc’ はクラスオブジェクト
     だが ‘*val’ は同じクラスのインスタンスではないという意味です。この
     関数はそのような場合にそのクラスをインスタンス化するために使われま
     す。その値がすでに正規化されている場合は何も起きません。遅延正規化
     はパフォーマンスを改善するために実装されています。

          注釈: This function 'does not' implicitly set the *note
          __traceback__: 14de. attribute on the exception value.  If
          setting the traceback appropriately is desired, the following
          additional snippet is needed:

               if (tb != NULL) {
                 PyException_SetTraceback(val, tb);
               }

 -- C の関数: *note PyObject: 5df. *PyErr_GetHandledException (void)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'
     Retrieve the active exception instance, as would be returned by
     *note sys.exception(): 89b.  This refers to an exception that was
     'already caught', not to an exception that was freshly raised.
     Returns a new reference to the exception or ‘NULL’.  Does not
     modify the interpreter's exception state.

          注釈: この関数は、通常は例外を扱うコードでは使用されません。正
          確に言うと、これは例外の状態を一時的に保存し、元に戻す必要があ
          るコードで使用することができます。例外の状態を元に戻す、もしく
          はクリアするには *note PyErr_SetHandledException(): 974. を使
          ってください。

     Added in version 3.11.

 -- C の関数: void PyErr_SetHandledException (PyObject *exc)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'
     Set the active exception, as known from ‘sys.exception()’.  This
     refers to an exception that was 'already caught', not to an
     exception that was freshly raised.  To clear the exception state,
     pass ‘NULL’.

          注釈: この関数は、通常は例外を扱うコードでは使用されません。正
          確に言うと、これは例外の状態を一時的に保存し、元に戻す必要があ
          るコードで使用することができます。例外の状態を取得するには
          *note PyErr_GetHandledException(): 973. を使ってください。

     Added in version 3.11.

 -- C の関数: void PyErr_GetExcInfo (PyObject **ptype, PyObject
          **pvalue, PyObject **ptraceback)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     Retrieve the old-style representation of the exception info, as
     known from *note sys.exc_info(): 89a.  This refers to an exception
     that was 'already caught', not to an exception that was freshly
     raised.  Returns new references for the three objects, any of which
     may be ‘NULL’.  Does not modify the exception info state.  This
     function is kept for backwards compatibility.  Prefer using *note
     PyErr_GetHandledException(): 973.

          注釈: この関数は、通常は例外を扱うコードでは使用されません。正
          確に言うと、これは例外の状態を一時的に保存し、元に戻す必要があ
          るコードで使用することができます。例外の状態を元に戻す、もしく
          はクリアするには *note PyErr_SetExcInfo(): 975. を使ってくださ
          い。

     Added in version 3.3.

 -- C の関数: void PyErr_SetExcInfo (PyObject *type, PyObject *value,
          PyObject *traceback)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'  Set
     the exception info, as known from ‘sys.exc_info()’.  This refers to
     an exception that was 'already caught', not to an exception that
     was freshly raised.  This function steals the references of the
     arguments.  To clear the exception state, pass ‘NULL’ for all three
     arguments.  This function is kept for backwards compatibility.
     Prefer using *note PyErr_SetHandledException(): 974.

          注釈: この関数は、通常は例外を扱うコードでは使用されません。正
          確に言うと、これは例外の状態を一時的に保存し、元に戻す必要があ
          るコードで使用することができます。例外の状態を取得するには
          *note PyErr_GetExcInfo(): 976. を使ってください。

     Added in version 3.3.

     バージョン 3.11 で変更: The ‘type’ and ‘traceback’ arguments are no
     longer used and can be NULL. The interpreter now derives them from
     the exception instance (the ‘value’ argument).  The function still
     steals references of all three arguments.


File: python.info,  Node: シグナルハンドリング<2>,  Next: 例外クラス<2>,  Prev: エラーインジケータの問い合わせ,  Up: 例外処理

7.5.5 シグナルハンドリング
--------------------------

 -- C の関数: int PyErr_CheckSignals ()
     ' 次に属します: *note Stable ABI: 775.'

     This function interacts with Python's signal handling.

     If the function is called from the main thread and under the main
     Python interpreter, it checks whether a signal has been sent to the
     processes and if so, invokes the corresponding signal handler.  If
     the *note signal: cb. module is supported, this can invoke a signal
     handler written in Python.

     The function attempts to handle all pending signals, and then
     returns ‘0’.  However, if a Python signal handler raises an
     exception, the error indicator is set and the function returns ‘-1’
     immediately (such that other pending signals may not have been
     handled yet: they will be on the next *note PyErr_CheckSignals():
     693. invocation).

     If the function is called from a non-main thread, or under a
     non-main Python interpreter, it does nothing and returns ‘0’.

     This function can be called by long-running C code that wants to be
     interruptible by user requests (such as by pressing Ctrl-C).

          注釈: The default Python signal handler for ‘SIGINT’ raises
          the *note KeyboardInterrupt: bc5. exception.

 -- C の関数: void PyErr_SetInterrupt ()
     ' 次に属します: *note Stable ABI: 775.'

     Simulate the effect of a ‘SIGINT’ signal arriving.  This is
     equivalent to ‘PyErr_SetInterruptEx(SIGINT)’.

          注釈: This function is async-signal-safe.  It can be called
          without an *note attached thread state: 4ed1. and from a C
          signal handler.

 -- C の関数: int PyErr_SetInterruptEx (int signum)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'

     シグナルが到達した効果をシミュレートします。 次に *note
     PyErr_CheckSignals(): 693. が呼ばれたとき、与えられたシグナル番号用
     の Python のシグナルハンドラが呼び出されます。

     This function can be called by C code that sets up its own signal
     handling and wants Python signal handlers to be invoked as expected
     when an interruption is requested (for example when the user
     presses Ctrl-C to interrupt an operation).

     If the given signal isn't handled by Python (it was set to *note
     signal.SIG_DFL: 1bb2. or *note signal.SIG_IGN: 1bb1.), it will be
     ignored.

     If 'signum' is outside of the allowed range of signal numbers, ‘-1’
     is returned.  Otherwise, ‘0’ is returned.  The error indicator is
     never changed by this function.

          注釈: This function is async-signal-safe.  It can be called
          without an *note attached thread state: 4ed1. and from a C
          signal handler.

     Added in version 3.10.

 -- C の関数: int PySignal_SetWakeupFd (int fd)

     このユーティリティ関数は、シグナルを受け取ったときにシグナル番号を
     バイトとして書き込むファイル記述子を指定します。 'fd' はノンブロッ
     キングでなければなりません。 この関数は、1つ前のファイル記述子を返
     します。

     値 ‘-1’ を渡すと、この機能を無効にします; これが初期状態です。 この
     関数は Python の *note signal.set_wakeup_fd(): d67. と同等ですが、
     どんなエラーチェックも行いません。 'fd' は有効なファイル記述子であ
     るべきです。 この関数はメインスレッドからのみ呼び出されるべきです。

     バージョン 3.5 で変更: Windowsで、この関数はソケットハンドルをサポ
     ートするようになりました。


File: python.info,  Node: 例外クラス<2>,  Next: 例外オブジェクト,  Prev: シグナルハンドリング<2>,  Up: 例外処理

7.5.6 例外クラス
----------------

 -- C の関数: *note PyObject: 5df. *PyErr_NewException (const char
          *name, PyObject *base, PyObject *dict)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  この
     ユーティリティ関数は新しい例外クラスを作成して返します。 'name' 引
     数は新しい例外の名前、 ‘module.classname’ 形式の C文字列でなければ
     ならない。 'base' と 'dict' 引数は通常 ‘NULL’ です。これはすべての
     例外のためのルート、組み込み名 *note Exception: bcd. (Cでは *note
     PyExc_Exception: 4ff1. としてアクセス可能)をルートとして派生したク
     ラスオブジェクトを作成します。

     The *note __module__: 617. attribute of the new class is set to the
     first part (up to the last dot) of the 'name' argument, and the
     class name is set to the last part (after the last dot).  The
     'base' argument can be used to specify alternate base classes; it
     can either be only one class or a tuple of classes.  The 'dict'
     argument can be used to specify a dictionary of class variables and
     methods.

 -- C の関数: *note PyObject: 5df. *PyErr_NewExceptionWithDoc (const
          char *name, const char *doc, PyObject *base, PyObject *dict)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     *note PyErr_NewException(): 1481. とほぼ同じですが、新しい例外クラ
     スに簡単に docstring を設定できます。 'doc' が ‘NULL’ で無い場合、
     それが例外クラスの docstring になります。

     Added in version 3.2.

 -- C の関数: int PyExceptionClass_Check (PyObject *ob)

     Return non-zero if 'ob' is an exception class, zero otherwise.
     This function always succeeds.

 -- C の関数: const char *PyExceptionClass_Name (PyObject *ob)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.8 より).'
     Return *note tp_name: 1cb0. of the exception class 'ob'.


File: python.info,  Node: 例外オブジェクト,  Next: Unicode 例外オブジェクト,  Prev: 例外クラス<2>,  Up: 例外処理

7.5.7 例外オブジェクト
----------------------

 -- C の関数: int PyExceptionInstance_Check (PyObject *op)

     Return true if 'op' is an instance of *note BaseException: 7d6,
     false otherwise.  This function always succeeds.

 -- C のマクロ: PyExceptionInstance_Class (op)

     Equivalent to *note Py_TYPE(op): 3c9.

 -- C の関数: *note PyObject: 5df. *PyException_GetTraceback (PyObject
          *ex)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Python で *note __traceback__: 14de. 属性からアクセスできるものと同
     じ、例外に関する traceback の新しい参照を返します。関係する
     traceback が無い場合は、 ‘NULL’ を返します。

 -- C の関数: int PyException_SetTraceback (PyObject *ex, PyObject *tb)
     ' 次に属します: *note Stable ABI: 775.'  その例外に関する traceback
     に 'tb' をセットします。クリアするには ‘Py_None’ を使用してください
     。

 -- C の関数: *note PyObject: 5df. *PyException_GetContext (PyObject
          *ex)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return the context (another exception instance during whose
     handling 'ex' was raised) associated with the exception as a new
     reference, as accessible from Python through the *note __context__:
     14df. attribute.  If there is no context associated, this returns
     ‘NULL’.

 -- C の関数: void PyException_SetContext (PyObject *ex, PyObject *ctx)
     ' 次に属します: *note Stable ABI: 775.'  例外に関するコンテキストに
     'ctx' をセットします。クリアするには ‘NULL’ を使用してください。
     'ctx' が例外インスタンスかどうかを確かめる型チェックは行われません
     。これは 'ctx' への参照を盗みます。

 -- C の関数: *note PyObject: 5df. *PyException_GetCause (PyObject *ex)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return the cause (either an exception instance, or ‘None’, set by
     ‘raise ... from ...’) associated with the exception as a new
     reference, as accessible from Python through the *note __cause__:
     14e0. attribute.

 -- C の関数: void PyException_SetCause (PyObject *ex, PyObject *cause)
     ' 次に属します: *note Stable ABI: 775.'  Set the cause associated
     with the exception to 'cause'.  Use ‘NULL’ to clear it.  There is
     no type check to make sure that 'cause' is either an exception
     instance or ‘None’.  This steals a reference to 'cause'.

     The *note __suppress_context__: 2514. attribute is implicitly set
     to ‘True’ by this function.

 -- C の関数: *note PyObject: 5df. *PyException_GetArgs (PyObject *ex)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.12 より).'  Return *note args: 78d. of exception 'ex'.

 -- C の関数: void PyException_SetArgs (PyObject *ex, PyObject *args)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'
     Set *note args: 78d. of exception 'ex' to 'args'.

 -- C の関数: *note PyObject: 5df. *PyUnstable_Exc_PrepReraiseStar
          (PyObject *orig, PyObject *excs)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Implement part of the interpreter's implementation of ‘except*’.
     'orig' is the original exception that was caught, and 'excs' is the
     list of the exceptions that need to be raised.  This list contains
     the unhandled part of 'orig', if any, as well as the exceptions
     that were raised from the ‘except*’ clauses (so they have a
     different traceback from 'orig') and those that were reraised (and
     have the same traceback as 'orig').  Return the *note
     ExceptionGroup: 4d2. that needs to be reraised in the end, or
     ‘None’ if there is nothing to reraise.

     Added in version 3.12.


File: python.info,  Node: Unicode 例外オブジェクト,  Next: 再帰の管理,  Prev: 例外オブジェクト,  Up: 例外処理

7.5.8 Unicode 例外オブジェクト
------------------------------

以下の関数は C言語から Unicode 例外を作ったり修正したりするために利用し
ます。

 -- C の関数: *note PyObject: 5df. *PyUnicodeDecodeError_Create (const
          char *encoding, const char *object, Py_ssize_t length,
          Py_ssize_t start, Py_ssize_t end, const char *reason)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'encoding', 'object', 'length', 'start', 'end', 'reason' 属性をもっ
     た *note UnicodeDecodeError: c08. オブジェクトを作成します。
     'encoding' および 'reason' は UTF-8 エンコードされた文字列です。

 -- C の関数: *note PyObject: 5df. *PyUnicodeDecodeError_GetEncoding
          (PyObject *exc)
 -- C の関数: *note PyObject: 5df. *PyUnicodeEncodeError_GetEncoding
          (PyObject *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  与え
     られた例外オブジェクトの 'encoding' 属性を返します。

 -- C の関数: *note PyObject: 5df. *PyUnicodeDecodeError_GetObject
          (PyObject *exc)
 -- C の関数: *note PyObject: 5df. *PyUnicodeEncodeError_GetObject
          (PyObject *exc)
 -- C の関数: *note PyObject: 5df. *PyUnicodeTranslateError_GetObject
          (PyObject *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  与え
     られた例外オブジェクトの 'object' 属性を返します。

 -- C の関数: int PyUnicodeDecodeError_GetStart (PyObject *exc,
          Py_ssize_t *start)
 -- C の関数: int PyUnicodeEncodeError_GetStart (PyObject *exc,
          Py_ssize_t *start)
 -- C の関数: int PyUnicodeTranslateError_GetStart (PyObject *exc,
          Py_ssize_t *start)
     ' 次に属します: *note Stable ABI: 775.'  渡された例外オブジェクトか
     ら 'start' 属性を取得して '*start' に格納します。'start' は ‘NULL’
     であってはなりません。成功したら ‘0’ を、失敗したら ‘-1’ を返します
     。

     If the *note UnicodeError.object: 18fc. is an empty sequence, the
     resulting 'start' is ‘0’.  Otherwise, it is clipped to ‘[0,
     len(object) - 1]’.

     参考
     ....

     *note UnicodeError.start: 18c0.

 -- C の関数: int PyUnicodeDecodeError_SetStart (PyObject *exc,
          Py_ssize_t start)
 -- C の関数: int PyUnicodeEncodeError_SetStart (PyObject *exc,
          Py_ssize_t start)
 -- C の関数: int PyUnicodeTranslateError_SetStart (PyObject *exc,
          Py_ssize_t start)
     ' 次に属します: *note Stable ABI: 775.'  Set the 'start' attribute
     of the given exception object to 'start'.  Return ‘0’ on success,
     ‘-1’ on failure.

          注釈: While passing a negative 'start' does not raise an
          exception, the corresponding getters will not consider it as a
          relative offset.

 -- C の関数: int PyUnicodeDecodeError_GetEnd (PyObject *exc, Py_ssize_t
          *end)
 -- C の関数: int PyUnicodeEncodeError_GetEnd (PyObject *exc, Py_ssize_t
          *end)
 -- C の関数: int PyUnicodeTranslateError_GetEnd (PyObject *exc,
          Py_ssize_t *end)
     ' 次に属します: *note Stable ABI: 775.'  渡された例外オブジェクトか
     ら 'end' 属性を取得して '*end' に格納します。'end' は ‘NULL’ であっ
     てはなりません。成功したら ‘0’ を、失敗したら ‘-1’ を返します。

     If the *note UnicodeError.object: 18fc. is an empty sequence, the
     resulting 'end' is ‘0’.  Otherwise, it is clipped to ‘[1,
     len(object)]’.

 -- C の関数: int PyUnicodeDecodeError_SetEnd (PyObject *exc, Py_ssize_t
          end)
 -- C の関数: int PyUnicodeEncodeError_SetEnd (PyObject *exc, Py_ssize_t
          end)
 -- C の関数: int PyUnicodeTranslateError_SetEnd (PyObject *exc,
          Py_ssize_t end)
     ' 次に属します: *note Stable ABI: 775.'  渡された例外オブジェクトの
     'end' 属性を 'end' に設定します。成功したら ‘0’ を、失敗したら ‘-1’
     を返します。

     参考
     ....

     *note UnicodeError.end: 18c1.

 -- C の関数: *note PyObject: 5df. *PyUnicodeDecodeError_GetReason
          (PyObject *exc)
 -- C の関数: *note PyObject: 5df. *PyUnicodeEncodeError_GetReason
          (PyObject *exc)
 -- C の関数: *note PyObject: 5df. *PyUnicodeTranslateError_GetReason
          (PyObject *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  渡さ
     れた例外オブジェクトの 'reason' 属性を返します。

 -- C の関数: int PyUnicodeDecodeError_SetReason (PyObject *exc, const
          char *reason)
 -- C の関数: int PyUnicodeEncodeError_SetReason (PyObject *exc, const
          char *reason)
 -- C の関数: int PyUnicodeTranslateError_SetReason (PyObject *exc,
          const char *reason)
     ' 次に属します: *note Stable ABI: 775.'  渡された例外オブジェクトの
     'reason' 属性を 'reason' に設定します。成功したら ‘0’ を、失敗した
     ら ‘-1’ を返します。


File: python.info,  Node: 再帰の管理,  Next: Exception and warning types,  Prev: Unicode 例外オブジェクト,  Up: 例外処理

7.5.9 再帰の管理
----------------

These two functions provide a way to perform safe recursive calls at the
C level, both in the core and in extension modules.  They are needed if
the recursive code does not necessarily invoke Python code (which tracks
its recursion depth automatically).  They are also not needed for
'tp_call' implementations because the *note call protocol: 7a3. takes
care of recursion handling.

 -- C の関数: int Py_EnterRecursiveCall (const char *where)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.9 より).'  C レ
     ベルの再帰呼び出しをしようとしているところに印を付けます。

     The function then checks if the stack limit is reached.  If this is
     the case, a *note RecursionError: f68. is set and a nonzero value
     is returned.  Otherwise, zero is returned.

     'where' は ‘" in instance check"’ のような UTF-8 エンコードされた文
     字列にして、再帰の深さの限界に達したことで送出される *note
     RecursionError: f68. のメッセージに連結できるようにすべきです。

     参考
     ....

     The *note PyUnstable_ThreadState_SetStackProtection(): 466.
     function.

     バージョン 3.9 で変更: This function is now also available in the
     *note limited API: 637.

 -- C の関数: void Py_LeaveRecursiveCall (void)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.9 より).'
     *note Py_EnterRecursiveCall(): 3d2. を終了させます。 *note
     Py_EnterRecursiveCall(): 3d2. の '成功した' 呼び出しに対し 1 回呼ば
     なければなりません。

     バージョン 3.9 で変更: This function is now also available in the
     *note limited API: 637.

コンテナ型に対し *note tp_repr: 4ee4. を適切に実装するには、特殊な再帰の
処理が求められます。スタックの防護に加え、 *note tp_repr: 4ee4. は循環処
理を避けるためにオブジェクトを辿っていく必要があります。次の 2 つの関数
はその機能を容易にします。実質的には、これらは *note
reprlib.recursive_repr(): 140c. と同等な C の実装です。

 -- C の関数: int Py_ReprEnter (PyObject *object)
     ' 次に属します: *note Stable ABI: 775.'  循環処理を検知するために、
     *note tp_repr: 4ee4. の実装の先頭で呼び出します。

     そのオブジェクトが既に処理されたものだった場合、この関数は正の整数
     を返します。その場合、 *note tp_repr: 4ee4. の実装は、循環を示す文
     字列オブジェクトを返すべきです。例えば、 *note dict: 183. オブジェ
     クトは ‘{...}’ を返しますし、 *note list: 24d. オブジェクトは
     ‘[...]’ を返します。

     再帰回数の上限に達した場合は、この関数は負の整数を返します。この場
     合、 *note tp_repr: 4ee4. の実装は一般的には ‘NULL’ を返すべきです
     。

     それ以外の場合は、関数はゼロを返し、 *note tp_repr: 4ee4. の実装は
     通常どおり処理を続けてかまいません。

 -- C の関数: void Py_ReprLeave (PyObject *object)
     ' 次に属します: *note Stable ABI: 775.'  *note Py_ReprEnter():
     5135. を終了させます。 0 を返した *note Py_ReprEnter(): 5135. の呼
     び出しに対し 1 回呼ばなければなりません。

 -- C の関数: int Py_GetRecursionLimit (void)
     ' 次に属します: *note Stable ABI: 775.'  Get the recursion limit
     for the current interpreter.  It can be set with *note
     Py_SetRecursionLimit(): 5137.  The recursion limit prevents the
     Python interpreter stack from growing infinitely.

     This function cannot fail, and the caller must hold an *note
     attached thread state: 4ed1.

     参考
     ....

     *note sys.getrecursionlimit(): 6eb.

 -- C の関数: void Py_SetRecursionLimit (int new_limit)
     ' 次に属します: *note Stable ABI: 775.'  Set the recursion limit
     for the current interpreter.

     This function cannot fail, and the caller must hold an *note
     attached thread state: 4ed1.

     参考
     ....

     *note sys.setrecursionlimit(): 6ea.


File: python.info,  Node: Exception and warning types,  Next: Tracebacks,  Prev: 再帰の管理,  Up: 例外処理

7.5.10 Exception and warning types
----------------------------------

All standard Python exceptions and warning categories are available as
global variables whose names are ‘PyExc_’ followed by the Python
exception name.  These have the type *note PyObject: 5df.*; they are all
class objects.

For completeness, here are all the variables:

* Menu:

* Exception types::
* OSError aliases::
* Warning types::


File: python.info,  Node: Exception types,  Next: OSError aliases,  Up: Exception and warning types

7.5.10.1 Exception types
........................

C name                                                 Python name
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
 -- C 変数: *note PyObject: 5df.                       *note BaseException: 7d6.
          *PyExc_BaseException                         
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note BaseExceptionGroup: 566.
          *PyExc_BaseExceptionGroup                    
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.11 より).'

 -- C 変数: *note PyObject: 5df. *PyExc_Exception      *note Exception: bcd.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note ArithmeticError: 26e5.
          *PyExc_ArithmeticError                       
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note AssertionError: 8b8.
          *PyExc_AssertionError                        
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note AttributeError: 5f0.
          *PyExc_AttributeError                        
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note BlockingIOError: 235.
          *PyExc_BlockingIOError                       
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note BrokenPipeError: 1267.
          *PyExc_BrokenPipeError                       
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df. *PyExc_BufferError    *note BufferError: 1797.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note ChildProcessError: 1263.
          *PyExc_ChildProcessError                     
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note ConnectionAbortedError: 1268.
          *PyExc_ConnectionAbortedError                
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note ConnectionError: 100b.
          *PyExc_ConnectionError                       
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note ConnectionRefusedError: 1269.
          *PyExc_ConnectionRefusedError                
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note ConnectionResetError: 126a.
          *PyExc_ConnectionResetError                  
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df. *PyExc_EOFError       *note EOFError: 14f1.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note FileExistsError: 1221.
          *PyExc_FileExistsError                       
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note FileNotFoundError: 264.
          *PyExc_FileNotFoundError                     
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note FloatingPointError: 26e6.
          *PyExc_FloatingPointError                    
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note GeneratorExit: 15e1.
          *PyExc_GeneratorExit                         
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_ImportError    *note ImportError: 65b.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note IndentationError: 1750.
          *PyExc_IndentationError                      
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_IndexError     *note IndexError: 174e.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note InterruptedError: f88.
          *PyExc_InterruptedError                      
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note IsADirectoryError: 1264.
          *PyExc_IsADirectoryError                     
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df. *PyExc_KeyError       *note KeyError: 5e7.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note KeyboardInterrupt: bc5.
          *PyExc_KeyboardInterrupt                     
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_LookupError    *note LookupError: 23e5.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df. *PyExc_MemoryError    *note MemoryError: 179e.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note ModuleNotFoundError: d3d.
          *PyExc_ModuleNotFoundError                   
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.6 より).'

 -- C 変数: *note PyObject: 5df. *PyExc_NameError      *note NameError: 452.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note NotADirectoryError: 1265.
          *PyExc_NotADirectoryError                    
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note NotImplementedError: 36b.
          *PyExc_NotImplementedError                   
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_OSError        *note OSError: 2c0.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note OverflowError: a81.
          *PyExc_OverflowError                         
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note PermissionError: f3e.
          *PyExc_PermissionError                       
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note ProcessLookupError: 1266.
          *PyExc_ProcessLookupError                    
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note PythonFinalizationError: 47a.
          *PyExc_PythonFinalizationError               

 -- C 変数: *note PyObject: 5df.                       *note RecursionError: f68.
          *PyExc_RecursionError                        
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note ReferenceError: 1726.
          *PyExc_ReferenceError                        
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_RuntimeError   *note RuntimeError: 244.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note StopAsyncIteration: 1e0f.
          *PyExc_StopAsyncIteration                    
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note StopIteration: df5.
          *PyExc_StopIteration                         
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_SyntaxError    *note SyntaxError: 18e.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df. *PyExc_SystemError    *note SystemError: 795.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df. *PyExc_SystemExit     *note SystemExit: f3c.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df. *PyExc_TabError       *note TabError: 765.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df. *PyExc_TimeoutError   *note TimeoutError: a36.
     ' 次に属します: *note Stable ABI: 775. (バージ    
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df. *PyExc_TypeError      *note TypeError: 198.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note UnboundLocalError: 174f.
          *PyExc_UnboundLocalError                     
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note UnicodeDecodeError: c08.
          *PyExc_UnicodeDecodeError                    
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note UnicodeEncodeError: 887.
          *PyExc_UnicodeEncodeError                    
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_UnicodeError   *note UnicodeError: 462.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note UnicodeTranslateError: 18fd.
          *PyExc_UnicodeTranslateError                 
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_ValueError     *note ValueError: 2ec.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note ZeroDivisionError: b3f.
          *PyExc_ZeroDivisionError                     
     ' 次に属します: *note Stable ABI: 775.'

Added in version 3.3: *note PyExc_BlockingIOError: 4fe4. 、 *note
PyExc_BrokenPipeError: 4fe5. 、 *note PyExc_ChildProcessError: 4fe8. 、
*note PyExc_ConnectionError: 4fea. 、 *note
PyExc_ConnectionAbortedError: 4fe9. 、 *note
PyExc_ConnectionRefusedError: 4feb. 、 *note PyExc_ConnectionResetError:
4fec. 、 *note PyExc_FileExistsError: 4ff2. 、 *note
PyExc_FileNotFoundError: 4ff3. 、 *note PyExc_InterruptedError: 4ffc. 、
*note PyExc_IsADirectoryError: 4ffd. 、 *note PyExc_NotADirectoryError:
5004. 、 *note PyExc_PermissionError: 5008. 、 *note
PyExc_ProcessLookupError: 5009. 、 *note PyExc_TimeoutError: 5015. は
PEP 3151(1) により導入されました。

Added in version 3.5: *note PyExc_StopAsyncIteration: 500e. および *note
PyExc_RecursionError: 10b2. 。

Added in version 3.6: *note PyExc_ModuleNotFoundError: 5002.

Added in version 3.11: *note PyExc_BaseExceptionGroup: 4fe3.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3151/


File: python.info,  Node: OSError aliases,  Next: Warning types,  Prev: Exception types,  Up: Exception and warning types

7.5.10.2 OSError aliases
........................

The following are a compatibility aliases to *note PyExc_OSError: 4e9b.

バージョン 3.3 で変更: これらのエイリアスは例外の種類を分けるために使わ
れます。

C name                                Python name                           注釈
                                                                            
------------------------------------------------------------------------------------------------------------------
                                                                            
 -- C 変数: *note PyObject: 5df.      *note OSError: 2c0.
          *PyExc_EnvironmentError     
     ' 次に属します:
     *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.      *note OSError: 2c0.
          *PyExc_IOError              
     ' 次に属します:
     *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.      *note OSError: 2c0.                   *note [win]: 5206.
          *PyExc_WindowsError                                               
     ' 次に属します:
     *note Stable ABI: 775. on
     Windows (バージョン 3.7 より
     ).'

注釈:

(win) ‘PyExc_WindowsError’ is only defined on Windows; protect code that
uses this by testing that the preprocessor macro ‘MS_WINDOWS’ is
defined.


File: python.info,  Node: Warning types,  Prev: OSError aliases,  Up: Exception and warning types

7.5.10.3 Warning types
......................

C name                                                 Python name
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
 -- C 変数: *note PyObject: 5df. *PyExc_Warning        *note Warning: 2712.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df. *PyExc_BytesWarning   *note BytesWarning: e1c.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyObject: 5df.                       *note DeprecationWarning: 1a3.
          *PyExc_DeprecationWarning                    
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note EncodingWarning: 212e.
          *PyExc_EncodingWarning                       
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.10 より).'

 -- C 変数: *note PyObject: 5df.                       *note FutureWarning: 659.
          *PyExc_FutureWarning                         
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note ImportWarning: 71e.
          *PyExc_ImportWarning                         
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note PendingDeprecationWarning: ac5.
          *PyExc_PendingDeprecationWarning             
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note ResourceWarning: 54c.
          *PyExc_ResourceWarning                       
     ' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'

 -- C 変数: *note PyObject: 5df.                       *note RuntimeWarning: 4d7.
          *PyExc_RuntimeWarning                        
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note SyntaxWarning: 1ae.
          *PyExc_SyntaxWarning                         
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df.                       *note UnicodeWarning: 163d.
          *PyExc_UnicodeWarning                        
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyObject: 5df. *PyExc_UserWarning    *note UserWarning: 2713.
     ' 次に属します: *note Stable ABI: 775.'           

Added in version 3.2: *note PyExc_ResourceWarning: 500b.

Added in version 3.10: *note PyExc_EncodingWarning: 4fef.


File: python.info,  Node: Tracebacks,  Prev: Exception and warning types,  Up: 例外処理

7.5.11 Tracebacks
-----------------

 -- C 変数: *note PyTypeObject: c9c. PyTraceBack_Type
     ' 次に属します: *note Stable ABI: 775.'  Type object for traceback
     objects.  This is available as *note types.TracebackType: cea. in
     the Python layer.

 -- C の関数: int PyTraceBack_Check (PyObject *op)

     Return true if 'op' is a traceback object, false otherwise.  This
     function does not account for subtypes.

 -- C の関数: int PyTraceBack_Here (PyFrameObject *f)
     ' 次に属します: *note Stable ABI: 775.'  Replace the *note
     __traceback__: 14de. attribute on the current exception with a new
     traceback prepending 'f' to the existing chain.

     Calling this function without an exception set is undefined
     behavior.

     This function returns ‘0’ on success, and returns ‘-1’ with an
     exception set on failure.

 -- C の関数: int PyTraceBack_Print (PyObject *tb, PyObject *f)
     ' 次に属します: *note Stable ABI: 775.'  Write the traceback 'tb'
     into the file 'f'.

     This function returns ‘0’ on success, and returns ‘-1’ with an
     exception set on failure.


File: python.info,  Node: 拡張モジュールの定義,  Next: ユーティリティ<2>,  Prev: 例外処理,  Up: Python/C API リファレンスマニュアル

7.6 拡張モジュールの定義
========================

CPython の C 拡張は、共有ライブラリ (例えば、 Linux では ‘.so’ ファイル
、 Windows では ‘.pyd’ DLL) であり、 Python プロセスで読み込み可能 (例え
ば、互換性のあるコンパイラ設定でコンパイルされている) で、 *note
初期化関数: 520d. をエクスポートするものです。

デフォルトで (つまり、 *note importlib.machinery.ExtensionFileLoader:
eae. によって) インポート可能であるためには、共有ライブラリは *note
sys.path: 3e4. 上で利用可能である必要があり、モジュール名と *note
importlib.machinery.EXTENSION_SUFFIXES: 739.  に含まれる拡張子で命名する
必要があります。

     注釈: 拡張モジュールのビルド、パッケージ化および配布には、サードパ
     ーティのツールが最適であり、このドキュメントの範囲外です。適切なツ
     ールの一つは Setuptools であり、ドキュメントは
     ‘https://setuptools.pypa.io/en/latest/setuptools.html’ にあります。

通常、初期化関数は *note PyModuleDef_Init(): 4ea3. を用いて初期化された
モジュール定義を返します。これにより、作成プロセスをいくつかの段階に分割
することができます:

   - Before any substantial code is executed, Python can determine which
     capabilities the module supports, and it can adjust the environment
     or refuse loading an incompatible extension.

   - By default, Python itself creates the module object - that is, it
     does the equivalent of *note object.__new__(): 7a0. for classes.
     It also sets initial attributes like *note __package__: 323. and
     *note __loader__: 33b.

   - Afterwards, the module object is initialized using
     extension-specific code - the equivalent of *note __init__(): 8bf.
     on classes.

This is called 'multi-phase initialization' to distinguish it from the
legacy (but still supported) 'single-phase initialization' scheme, where
the initialization function returns a fully constructed module.  See the
*note single-phase-initialization section below: 520e. for details.

バージョン 3.5 で変更: 多段階初期化 ( PEP 489(1)) のサポートを追加しまし
た。

* Menu:

* 複数のモジュールインスタンス::
* 初期化関数::
* 多段階初期化::
* 従来の一段階初期化::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0489/


File: python.info,  Node: 複数のモジュールインスタンス,  Next: 初期化関数,  Up: 拡張モジュールの定義

7.6.1 複数のモジュールインスタンス
----------------------------------

By default, extension modules are not singletons.  For example, if the
*note sys.modules: 17e6. entry is removed and the module is re-imported,
a new module object is created, and typically populated with fresh
method and type objects.  The old module is subject to normal garbage
collection.  This mirrors the behavior of pure-Python modules.

Additional module instances may be created in *note sub-interpreters:
163. or after Python runtime reinitialization (*note Py_Finalize(): 45f.
and *note Py_Initialize(): 460.).  In these cases, sharing Python
objects between module instances would likely cause crashes or undefined
behavior.

To avoid such issues, each instance of an extension module should be
'isolated': changes to one instance should not implicitly affect the
others, and all state owned by the module, including references to
Python objects, should be specific to a particular module instance.  See
*note 拡張モジュールを分離する: 166. for more details and a practical
guide.

A simpler way to avoid these issues is *note raising an error on
repeated initialization: 5210.

All modules are expected to support *note sub-interpreters: 163, or
otherwise explicitly signal a lack of support.  This is usually achieved
by isolation or blocking repeated initialization, as above.  A module
may also be limited to the main interpreter using the *note
Py_mod_multiple_interpreters: 5152. slot.


File: python.info,  Node: 初期化関数,  Next: 多段階初期化,  Prev: 複数のモジュールインスタンス,  Up: 拡張モジュールの定義

7.6.2 初期化関数
----------------

拡張モジュールによって定義された初期化関数は、次のシグネチャを持ちます:

 -- C の関数: *note PyObject: 5df. *PyInit_modulename (void)

名前が ‘PyInit_<NAME>’ であり、 ‘<name>’ はモジュール名です。

For modules with ASCII-only names, the function must instead be named
‘PyInit_<NAME>’, with ‘<name>’ replaced by the name of the module.  When
using *note 多段階初期化: 5213, non-ASCII module names are allowed.  In
this case, the initialization function name is ‘PyInitU_<NAME>’, with
‘<name>’ encoded using Python's 'punycode' encoding with hyphens
replaced by underscores.  In Python:

     def initfunc_name(name):
         try:
             suffix = b'_' + name.encode('ascii')
         except UnicodeEncodeError:
             suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')
         return b'PyInit' + suffix

初期化関数は、ヘルパーマクロを使用して定義することが推奨されます:

 -- C のマクロ: PyMODINIT_FUNC

     Declare an extension module initialization function.  This macro:

        * specifies the *note PyObject: 5df.* return type,

        * adds any special linkage declarations required by the
          platform, and

        * for C++, declares the function as ‘extern "C"’.

For example, a module called ‘spam’ would be defined like this:

     static struct PyModuleDef spam_module = {
         .m_base = PyModuleDef_HEAD_INIT,
         .m_name = "spam",
         ...
     };

     PyMODINIT_FUNC
     PyInit_spam(void)
     {
         return PyModuleDef_Init(&spam_module);
     }

It is possible to export multiple modules from a single shared library
by defining multiple initialization functions.  However, importing them
requires using symbolic links or a custom importer, because by default
only the function corresponding to the filename is found.  See the
Multiple modules in one library(1) section in PEP 489(2) for details.

The initialization function is typically the only non-‘static’ item
defined in the module's C source.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0489/#multiple-modules-in-one-library

   (2) https://peps.python.org/pep-0489/


File: python.info,  Node: 多段階初期化,  Next: 従来の一段階初期化,  Prev: 初期化関数,  Up: 拡張モジュールの定義

7.6.3 多段階初期化
------------------

Normally, the *note initialization function: 520d. (‘PyInit_modulename’)
returns a *note PyModuleDef: b74. instance with non-‘NULL’ *note
m_slots: 5215.  Before it is returned, the ‘PyModuleDef’ instance must
be initialized using the following function:

 -- C の関数: *note PyObject: 5df. *PyModuleDef_Init (PyModuleDef *def)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.5 より).'
     Ensure a module definition is a properly initialized Python object
     that correctly reports its type and a reference count.

     Return 'def' cast to ‘PyObject*’, or ‘NULL’ if an error occurred.

     Calling this function is required for *note 多段階初期化: 5213.  It
     should not be used in other contexts.

     Note that Python assumes that ‘PyModuleDef’ structures are
     statically allocated.  This function may return either a new
     reference or a borrowed one; this reference must not be released.

     Added in version 3.5.


File: python.info,  Node: 従来の一段階初期化,  Prev: 多段階初期化,  Up: 拡張モジュールの定義

7.6.4 従来の一段階初期化
------------------------

     注意: Single-phase initialization is a legacy mechanism to
     initialize extension modules, with known drawbacks and design
     flaws.  Extension module authors are encouraged to use multi-phase
     initialization instead.

In single-phase initialization, the *note initialization function: 520d.
(‘PyInit_modulename’) should create, populate and return a module
object.  This is typically done using *note PyModule_Create(): 5217. and
functions like *note PyModule_AddObjectRef(): 60a.

Single-phase initialization differs from the *note default: 5213. in the
following ways:

   * Single-phase modules are, or rather 'contain', “singletons”.

     When the module is first initialized, Python saves the contents of
     the module's ‘__dict__’ (that is, typically, the module's functions
     and types).

     For subsequent imports, Python does not call the initialization
     function again.  Instead, it creates a new module object with a new
     ‘__dict__’, and copies the saved contents to it.  For example,
     given a single-phase module ‘_testsinglephase’ (1) that defines a
     function ‘sum’ and an exception class ‘error’:

          >>> import sys
          >>> import _testsinglephase as one
          >>> del sys.modules['_testsinglephase']
          >>> import _testsinglephase as two
          >>> one is two
          False
          >>> one.__dict__ is two.__dict__
          False
          >>> one.sum is two.sum
          True
          >>> one.error is two.error
          True

     The exact behavior should be considered a CPython implementation
     detail.

   * To work around the fact that ‘PyInit_modulename’ does not take a
     'spec' argument, some state of the import machinery is saved and
     applied to the first suitable module created during the
     ‘PyInit_modulename’ call.  Specifically, when a sub-module is
     imported, this mechanism prepends the parent package name to the
     name of the module.

     A single-phase ‘PyInit_modulename’ function should create “its”
     module object as soon as possible, before any other module objects
     can be created.

   * Non-ASCII module names (‘PyInitU_modulename’) are not supported.

   * Single-phase modules support module lookup functions like *note
     PyState_FindModule(): 50b5.

   ---------- Footnotes ----------

   (1) ‘_testsinglephase’ is an internal module used in CPython's
self-test suite; your installation may or may not include it.


File: python.info,  Node: ユーティリティ<2>,  Next: 抽象オブジェクトレイヤ Abstract Objects Layer,  Prev: 拡張モジュールの定義,  Up: Python/C API リファレンスマニュアル

7.7 ユーティリティ
==================

この章の関数は、C で書かれたコードをプラットフォーム間で可搬性のあるもの
にする上で役立つものから、C から Python モジュールを使うもの、そして関数
の引数を解釈したり、C の値から Python の値を構築するものまで、様々なユー
ティリティ的タスクを行います。

* Menu:

* オペレーティングシステム関連のユーティリティ::
* システム関数::
* プロセス制御::
* モジュールのインポート: モジュールのインポート<2>.
* データ整列化 (data marshalling) のサポート: データ整列化 data marshalling のサポート.
* 引数の解釈と値の構築::
* 文字列の変換と書式化::
* Character classification and conversion::
* PyHash API::
* リフレクション::
* codec レジストリとサポート関数::
* PyTime C API::
* Support for Perf Maps::


File: python.info,  Node: オペレーティングシステム関連のユーティリティ,  Next: システム関数,  Up: ユーティリティ<2>

7.7.1 オペレーティングシステム関連のユーティリティ
--------------------------------------------------

 -- C の関数: *note PyObject: 5df. *PyOS_FSPath (PyObject *path)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.6 より).'  Return the file system representation for
     'path'.  If the object is a *note str: 169. or *note bytes: 192.
     object, then a new *note strong reference: 5e2. is returned.  If
     the object implements the *note os.PathLike: e4b. interface, then
     *note __fspath__(): e4c. is returned as long as it is a *note str:
     169. or *note bytes: 192. object.  Otherwise *note TypeError: 198.
     is raised and ‘NULL’ is returned.

     Added in version 3.6.

 -- C の関数: int Py_FdIsInteractive (FILE *fp, const char *filename)

     Return true (nonzero) if the standard I/O file 'fp' with name
     'filename' is deemed interactive.  This is the case for files for
     which ‘isatty(fileno(fp))’ is true.  If the *note
     PyConfig.interactive: 3ff. is non-zero, this function also returns
     true if the 'filename' pointer is ‘NULL’ or if the name is equal to
     one of the strings ‘'<stdin>'’ or ‘'???'’.

     This function must not be called before Python is initialized.

 -- C の関数: void PyOS_BeforeFork ()
     ' 次に属します: *note Stable ABI: 775. on platforms with fork() (バ
     ージョン 3.7 より).'  プロセスがフォークする前に、いくつかの内部状
     態を準備するための関数です。‘fork()’ や現在のプロセスを複製するその
     他の類似の関数を呼び出す前にこの関数を呼びださなければなりません。
     ‘fork()’ が定義されているシステムでのみ利用できます。

          警告: The C ‘fork()’ call should only be made from the *note
          "main" thread: 5220. (of the *note "main" interpreter: 163.).
          The same is true for ‘PyOS_BeforeFork()’.

     Added in version 3.7.

 -- C の関数: void PyOS_AfterFork_Parent ()
     ' 次に属します: *note Stable ABI: 775. on platforms with fork() (バ
     ージョン 3.7 より).'  プロセスがフォークした後に内部状態を更新する
     ための関数です。 ‘fork()’ や、現在のプロセスを複製するその他の類似
     の関数を呼び出した後に、プロセスの複製が成功したかどうかにかかわら
     ず、親プロセスからこの関数を呼び出さなければなりません。‘fork()’ が
     定義されているシステムでのみ利用できます。

          警告: The C ‘fork()’ call should only be made from the *note
          "main" thread: 5220. (of the *note "main" interpreter: 163.).
          The same is true for ‘PyOS_AfterFork_Parent()’.

     Added in version 3.7.

 -- C の関数: void PyOS_AfterFork_Child ()
     ' 次に属します: *note Stable ABI: 775. on platforms with fork() (バ
     ージョン 3.7 より).'  Function to update internal interpreter state
     after a process fork.  This must be called from the child process
     after calling ‘fork()’, or any similar function that clones the
     current process, if there is any chance the process will call back
     into the Python interpreter.  Only available on systems where
     ‘fork()’ is defined.

          警告: The C ‘fork()’ call should only be made from the *note
          "main" thread: 5220. (of the *note "main" interpreter: 163.).
          The same is true for ‘PyOS_AfterFork_Child()’.

     Added in version 3.7.

     参考
     ....

     *note os.register_at_fork(): 355. を利用すると *note
     PyOS_BeforeFork(): db8.、*note PyOS_AfterFork_Parent(): db9. *note
     PyOS_AfterFork_Child(): 430. によって呼び出されるカスタムのPython関
     数を登録できます。

 -- C の関数: void PyOS_AfterFork ()
     ' 次に属します: *note Stable ABI: 775. on platforms with fork().'  プ
     ロセスが fork した後の内部状態を更新するための関数です; fork 後
     Python インタプリタを使い続ける場合、新たなプロセス内でこの関数を呼
     び出さねばなりません。新たなプロセスに新たな実行可能物をロードする
     場合、この関数を呼び出す必要はありません。

     バージョン 3.7 で非推奨: この関数は *note PyOS_AfterFork_Child():
     430. によって置き換えられました。

 -- C の関数: int PyOS_CheckStack ()
     ' 次に属します: *note Stable ABI: 775. on platforms with
     USE_STACKCHECK (バージョン 3.7 より).'

     Return true when the interpreter runs out of stack space.  This is
     a reliable check, but is only available when ‘USE_STACKCHECK’ is
     defined (currently on certain versions of Windows using the
     Microsoft Visual C++ compiler).  ‘USE_STACKCHECK’ will be defined
     automatically; you should never change the definition in your own
     code.

 -- C のデータ型: typedef void (*PyOS_sighandler_t)(int)
     ' 次に属します: *note Stable ABI: 775.'

 -- C の関数: *note PyOS_sighandler_t: 5083. PyOS_getsig (int i)
     ' 次に属します: *note Stable ABI: 775.'  Return the current signal
     handler for signal 'i'.  This is a thin wrapper around either
     ‘sigaction()’ or ‘signal()’.  Do not call those functions directly!

 -- C の関数: *note PyOS_sighandler_t: 5083. PyOS_setsig (int i,
          PyOS_sighandler_t h)
     ' 次に属します: *note Stable ABI: 775.'  Set the signal handler for
     signal 'i' to be 'h'; return the old signal handler.  This is a
     thin wrapper around either ‘sigaction()’ or ‘signal()’.  Do not
     call those functions directly!

 -- C の関数: int PyOS_InterruptOccurred (void)
     ' 次に属します: *note Stable ABI: 775.'  Check if a ‘SIGINT’ signal
     has been received.

     Returns ‘1’ if a ‘SIGINT’ has occurred and clears the signal flag,
     or ‘0’ otherwise.

     In most cases, you should prefer *note PyErr_CheckSignals(): 693.
     over this function.  ‘PyErr_CheckSignals()’ invokes the appropriate
     signal handlers for all pending signals, allowing Python code to
     handle the signal properly.  This function only detects ‘SIGINT’
     and does not invoke any Python signal handlers.

     This function is async-signal-safe and this function cannot fail.
     The caller must hold an *note attached thread state: 4ed1.

 -- C の関数: wchar_t *Py_DecodeLocale (const char *arg, size_t *size)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
          警告: This function should not be called directly: use the
          *note PyConfig: 3f7. API with the *note
          PyConfig_SetBytesString(): bab. function which ensures that
          *note Python is preinitialized: 42c8.

          This function must not be called before *note Python is
          preinitialized: 42c8. and so that the LC_CTYPE locale is
          properly configured: see the *note Py_PreInitialize(): 41e.
          function.

     *note ファイルシステムのエンコーディングとエラーハンドラ: 75d. から
     バイト文字列をデコードします。エラーハンドラが *note
     surrogateescape エラーハンドラ: 2853. なら、 デコードできないバイト
     は U+DC80 から U+DCFF までの範囲の文字としてデコードされ、バイト列
     がサロゲート文字としてデコードできる場合は、デコードするのではなく
     surrogateescape エラーハンドラを使ってバイト列がエスケープされます
     。

     新しくメモリ確保されたワイドキャラクター文字列へのポインタを返しま
     す。 このメモリを解放するのには *note PyMem_RawFree(): 634. を使っ
     てください。 引数 size が ‘NULL’ でない場合は、 null 文字以外のワイ
     ドキャラクターの数を ‘*size’ へ書き込みます。

     デコードもしくはメモリ確保でエラーが起きると ‘NULL’ を返します。
     'size' が ‘NULL’ でない場合は、メモリエラーのときは ‘(size_t)-1’ を
     、デコードでのエラーのときは ‘(size_t)-2’ を ‘*size’ に設定します。

     The *note filesystem encoding and error handler: 75d. are selected
     by *note PyConfig_Read(): 993.: see *note filesystem_encoding: 41b.
     and *note filesystem_errors: 41c. members of *note PyConfig: 3f7.

     C ライブラリーにバグがない限り、デコードでのエラーは起こりえません
     。

     キャラクター文字列をバイト文字列に戻すには *note Py_EncodeLocale():
     dc1. 関数を使ってください。

     参考
     ....

     *note PyUnicode_DecodeFSDefaultAndSize(): 50ff. および *note
     PyUnicode_DecodeLocaleAndSize(): dc2. 関数。

     Added in version 3.5.

     バージョン 3.7 で変更: この関数は、*note Python UTF-8 Mode: 866. で
     はUTF-8エンコーディングを利用するようになりました。

     バージョン 3.8 で変更: The function now uses the UTF-8 encoding on
     Windows if *note PyPreConfig.legacy_windows_fs_encoding: 418. is
     zero;

 -- C の関数: char *Py_EncodeLocale (const wchar_t *text, size_t
          *error_pos)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'  ワ
     イドキャラクター文字列を *note
     ファイルシステムのエンコーディングとエラーハンドラ: 75d. にエンコー
     ドします。エラーハンドラが *note surrogateescape エラーハンドラ:
     2853. なら、 U+DC80 から U+DCFF までの範囲のサロゲート文字は 0x80 か
     ら 0xFF までのバイトに変換されます。

     新しくメモリ確保されたバイト文字列へのポインタを返します。 このメモ
     リを解放するのには *note PyMem_Free(): 165b. を使ってください。 エ
     ンコードエラーかメモリ確保エラーのときは ‘NULL’ を返します。

     If error_pos is not ‘NULL’, ‘*error_pos’ is set to ‘(size_t)-1’ on
     success, or set to the index of the invalid character on encoding
     error.

     The *note filesystem encoding and error handler: 75d. are selected
     by *note PyConfig_Read(): 993.: see *note filesystem_encoding: 41b.
     and *note filesystem_errors: 41c. members of *note PyConfig: 3f7.

     バイト文字列をワイドキャラクター文字列に戻すには *note
     Py_DecodeLocale(): dc0. 関数を使ってください。

          警告: This function must not be called before *note Python is
          preinitialized: 42c8. and so that the LC_CTYPE locale is
          properly configured: see the *note Py_PreInitialize(): 41e.
          function.

     参考
     ....

     *note PyUnicode_EncodeFSDefault(): 1e31. および *note
     PyUnicode_EncodeLocale(): dc3. 関数。

     Added in version 3.5.

     バージョン 3.7 で変更: この関数は、*note Python UTF-8 Mode: 866. で
     はUTF-8エンコーディングを利用するようになりました。

     バージョン 3.8 で変更: The function now uses the UTF-8 encoding on
     Windows if *note PyPreConfig.legacy_windows_fs_encoding: 418. is
     zero.

 -- C の関数: FILE *Py_fopen (PyObject *path, const char *mode)

     Similar to ‘fopen()’, but 'path' is a Python object and an
     exception is set on error.

     'path' must be a *note str: 169. object, a *note bytes: 192.
     object, or a *note path-like object: 5a1.

     On success, return the new file pointer.  On error, set an
     exception and return ‘NULL’.

     The file must be closed by *note Py_fclose(): 394. rather than
     calling directly ‘fclose()’.

     The file descriptor is created non-inheritable ( PEP 446(1)).

     The caller must have an *note attached thread state: 4ed1.

     Added in version 3.14.

 -- C の関数: int Py_fclose (FILE *file)

     Close a file that was opened by *note Py_fopen(): 393.

     On success, return ‘0’.  On error, return ‘EOF’ and ‘errno’ is set
     to indicate the error.  In either case, any further access
     (including another call to *note Py_fclose(): 394.) to the stream
     results in undefined behavior.

     Added in version 3.14.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0446/


File: python.info,  Node: システム関数,  Next: プロセス制御,  Prev: オペレーティングシステム関連のユーティリティ,  Up: ユーティリティ<2>

7.7.2 システム関数
------------------

*note sys: df. モジュールが提供している機能にCのコードからアクセスする関
数です。すべての関数は現在のインタプリタスレッドの *note sys: df. モジュ
ールの辞書に対して動作します。この辞書は内部のスレッド状態構造体に格納さ
れています。

 -- C の関数: *note PyObject: 5df. *PySys_GetObject (const char *name)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  *note
     sys: df. モジュールの 'name' オブジェクトを返すか、存在しなければ例
     外を設定せずに ‘NULL’ を返します。

 -- C の関数: int PySys_SetObject (const char *name, PyObject *v)
     ' 次に属します: *note Stable ABI: 775.'  'v' が ‘NULL’ で無い場合、
     *note sys: df. モジュールの 'name' に 'v' を設定します。 'v' が
     ‘NULL’ なら、 sys モジュールから 'name' を削除します。成功したら
     ‘0’ を、エラー時は ‘-1’ を返します。

 -- C の関数: void PySys_ResetWarnOptions ()
     ' 次に属します: *note Stable ABI: 775.'  Reset *note
     sys.warnoptions: 3f5. to an empty list.  This function may be
     called prior to *note Py_Initialize(): 460.

     Deprecated since version 3.13, will be removed in version 3.15:
     Clear *note sys.warnoptions: 3f5. and ‘warnings.filters’ instead.

 -- C の関数: void PySys_WriteStdout (const char *format, ...)
     ' 次に属します: *note Stable ABI: 775.'  'format' で指定された出力
     文字列を *note sys.stdout: ccd. に出力します。切り詰めが起こった場
     合を含め、例外は一切発生しません (後述)。

     'format' は、フォーマット後の出力文字列のトータルの大きさを1000バイ
     ト以下に抑えるべきです。- 1000 バイト以降の出力文字列は切り詰められ
     ます。特に、制限のない "%s" フォーマットを使うべきではありません。
     "%.<N>s" のようにして N に10進数の値を指定し、<N> + その他のフォー
     マット後の最大サイズが1000を超えないように設定するべきです。同じよ
     うに "%f" にも気を付ける必要があります。非常に大きい数値に対して、
     数百の数字を出力する可能性があります。

     問題が発生したり、 *note sys.stdout: ccd. が設定されていなかった場
     合、フォーマット後のメッセージは本物の(Cレベルの) 'stdout' に出力さ
     れます。

 -- C の関数: void PySys_WriteStderr (const char *format, ...)
     ' 次に属します: *note Stable ABI: 775.'  *note PySys_WriteStdout():
     50c1. と同じですが、 *note sys.stderr: b33. もしくは 'stderr' に出
     力します。

 -- C の関数: void PySys_FormatStdout (const char *format, ...)
     ' 次に属します: *note Stable ABI: 775.'  PySys_WriteStdout() に似た
     関数ですが、 *note PyUnicode_FromFormatV(): 794. を使ってメッセージ
     をフォーマットし、メッセージを任意の長さに切り詰めたりはしません。

     Added in version 3.2.

 -- C の関数: void PySys_FormatStderr (const char *format, ...)
     ' 次に属します: *note Stable ABI: 775.'  *note
     PySys_FormatStdout(): 50bd. と同じですが、 *note sys.stderr: b33. も
     しくは 'stderr' に出力します。

     Added in version 3.2.

 -- C の関数: *note PyObject: 5df. *PySys_GetXOptions ()
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'  *note sys._xoptions: 2131. と同様、 *note -X:
     16f. オプションの現在の辞書を返します。エラーが起きると、 ‘NULL’ が
     返され、例外がセットされます。

     Added in version 3.2.

 -- C の関数: int PySys_Audit (const char *event, const char *format,
          ...)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Raise an auditing event with any active hooks.  Return zero for
     success and non-zero with an exception set on failure.

     The 'event' string argument must not be 'NULL'.

     If any hooks have been added, 'format' and other arguments will be
     used to construct a tuple to pass.  Apart from ‘N’, the same format
     characters as used in *note Py_BuildValue(): 3c2. are available.
     If the built value is not a tuple, it will be added into a
     single-element tuple.

     The ‘N’ format option must not be used.  It consumes a reference,
     but since there is no way to know whether arguments to this
     function will be consumed, using it may cause reference leaks.

     Note that ‘#’ format characters should always be treated as *note
     Py_ssize_t: c55, regardless of whether ‘PY_SSIZE_T_CLEAN’ was
     defined.

     *note sys.audit(): 191b. performs the same function from Python
     code.

     See also *note PySys_AuditTuple(): 612.

     Added in version 3.8.

     バージョン 3.8.2 で変更: Require *note Py_ssize_t: c55. for ‘#’
     format characters.  Previously, an unavoidable deprecation warning
     was raised.

 -- C の関数: int PySys_AuditTuple (const char *event, PyObject *args)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Similar to *note PySys_Audit(): 613, but pass arguments as a Python
     object.  'args' must be a *note tuple: 614.  To pass no arguments,
     'args' can be 'NULL'.

     Added in version 3.13.

 -- C の関数: int PySys_AddAuditHook (Py_AuditHookFunction hook, void
          *userData)

     Append the callable 'hook' to the list of active auditing hooks.
     Return zero on success and non-zero on failure.  If the runtime has
     been initialized, also set an error on failure.  Hooks added
     through this API are called for all interpreters created by the
     runtime.

     'userData' ポインタはフック関数に渡されます。 フック関数は別なラン
     タイムから呼び出されるかもしれないので、このポインタは直接 Python の
     状態を参照すべきではありません。

     This function is safe to call before *note Py_Initialize(): 460.
     When called after runtime initialization, existing audit hooks are
     notified and may silently abort the operation by raising an error
     subclassed from *note Exception: bcd. (other errors will not be
     silenced).

     The hook function is always called with an *note attached thread
     state: 4ed1. by the Python interpreter that raised the event.

     See PEP 578(1) for a detailed description of auditing.  Functions
     in the runtime and standard library that raise events are listed in
     the *note audit events table: 1c13.  Details are in each function's
     documentation.

     If the interpreter is initialized, this function raises an auditing
     event ‘sys.addaudithook’ with no arguments.  If any existing hooks
     raise an exception derived from *note Exception: bcd, the new hook
     will not be added and the exception is cleared.  As a result,
     callers cannot assume that their hook has been added unless they
     control all existing hooks.

      -- C のデータ型: typedef int (*Py_AuditHookFunction)(const char
               *event, *note PyObject: 5df. *args, void *userData)

          The type of the hook function.  'event' is the C string event
          argument passed to *note PySys_Audit(): 613. or *note
          PySys_AuditTuple(): 612.  'args' is guaranteed to be a *note
          PyTupleObject: 5224.  'userData' is the argument passed to
          PySys_AddAuditHook().

     Added in version 3.8.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0578/


File: python.info,  Node: プロセス制御,  Next: モジュールのインポート<2>,  Prev: システム関数,  Up: ユーティリティ<2>

7.7.3 プロセス制御
------------------

 -- C の関数: void Py_FatalError (const char *message)
     ' 次に属します: *note Stable ABI: 775.'

     Print a fatal error message and kill the process.  No cleanup is
     performed.  This function should only be invoked when a condition
     is detected that would make it dangerous to continue using the
     Python interpreter; e.g., when the object administration appears to
     be corrupted.  On Unix, the standard C library function ‘abort()’
     is called which will attempt to produce a ‘core’ file.

     The ‘Py_FatalError()’ function is replaced with a macro which logs
     automatically the name of the current function, unless the
     ‘Py_LIMITED_API’ macro is defined.

     バージョン 3.9 で変更: Log the function name automatically.

 -- C の関数: void Py_Exit (int status)
     ' 次に属します: *note Stable ABI: 775.'

     現在のプロセスを終了します。*note Py_FinalizeEx(): f11. を呼び出し
     た後、標準Cライブラリ関数の ‘exit(status)’ を呼び出します。*note
     Py_FinalizeEx(): f11. がエラーになった場合、終了ステータスは 120に
     設定されます。

     バージョン 3.6 で変更: 終了処理のエラーは無視されなくなりました。

 -- C の関数: int Py_AtExit (void (*func)())
     ' 次に属します: *note Stable ABI: 775.'

     *note Py_FinalizeEx(): f11. から呼び出される後始末処理を行う関数
     (cleanup function) を登録します。後始末関数は引数無しで呼び出され、
     値を返しません。最大で 32 の後始末処理関数を登録できます。登録に成
     功すると、 *note Py_AtExit(): 5128. は ‘0’ を返します; 失敗すると
     ‘-1’ を返します。最後に登録した後始末処理関数から先に呼び出されます
     。各関数は高々一度しか呼び出されません。 Python の内部的な終了処理
     は後始末処理関数より以前に完了しているので、 'func' からはいかなる
     Python API も呼び出してはなりません。

     参考
     ....

     *note PyUnstable_AtExit(): 18fa. for passing a ‘void *data’
     argument.


File: python.info,  Node: モジュールのインポート<2>,  Next: データ整列化 data marshalling のサポート,  Prev: プロセス制御,  Up: ユーティリティ<2>

7.7.4 モジュールのインポート
----------------------------

 -- C の関数: *note PyObject: 5df. *PyImport_ImportModule (const char
          *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     This is a wrapper around *note PyImport_Import(): 1615. which takes
     a const char* as an argument instead of a *note PyObject: 5df.*.

 -- C の関数: *note PyObject: 5df. *PyImport_ImportModuleNoBlock (const
          char *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  この
     関数は、 *note PyImport_ImportModule(): 3dc. の廃止予定のエイリアス
     です。

     バージョン 3.3 で変更: この関数は、従来は別のスレッドによってインポ
     ートロックが行われていた場合は即座に失敗していました。しかし Python
     3.3 では、大部分の目的でロックスキームがモジュールごとのロックに移
     行したので、この関数の特別な振る舞いはもはや必要ではありません。

     Deprecated since version 3.13, will be removed in version 3.15: Use
     *note PyImport_ImportModule(): 3dc. instead.

 -- C の関数: *note PyObject: 5df. *PyImport_ImportModuleEx (const char
          *name, PyObject *globals, PyObject *locals, PyObject
          *fromlist)
     '戻り値: 新しい参照。'

     モジュールをインポートします。モジュールのインポートについては組み
     込みの Python 関数 *note __import__(): ad1. を読むとよくわかります
     。

     戻り値は、インポートされたモジュールかトップレベルパッケージへの新
     しい参照か、失敗した場合は例外を設定して ‘NULL’ を返します。 *note
     __import__(): ad1. と同じように、パッケージのサブモジュールが要求さ
     れたときは、空でない 'fromlist' を渡された時以外は、トップレベルの
     パッケージを返します。

     インポートが失敗した場合は、*note PyImport_ImportModule(): 3dc. と
     同様に不完全なモジュールのオブジェクトを削除します。

 -- C の関数: *note PyObject: 5df. *PyImport_ImportModuleLevelObject
          (PyObject *name, PyObject *globals, PyObject *locals, PyObject
          *fromlist, int level)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'  モジュールをインポートします。モジュールのイン
     ポートについては組み込みの Python 関数 *note __import__(): ad1. を
     読むとよく分かります。というのも、標準の *note __import__(): ad1. は
     この関数を直接呼び出しているからです。

     戻り値は、インポートされたモジュールかトップレベルパッケージへの新
     しい参照か、失敗した場合は例外を設定して ‘NULL’ を返します。 *note
     __import__(): ad1. と同じように、パッケージのサブモジュールが要求さ
     れたときは、空でない 'fromlist' を渡された時以外は、トップレベルの
     パッケージを返します。

     Added in version 3.3.

 -- C の関数: *note PyObject: 5df. *PyImport_ImportModuleLevel (const
          char *name, PyObject *globals, PyObject *locals, PyObject
          *fromlist, int level)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     *note PyImport_ImportModuleLevelObject(): 5039. と似ていますが、
     name が Unicode オブジェクトではなく UTF-8 でエンコードされた文字列
     である点で異なります。

     バージョン 3.3 で変更: 'level' にはもはや負の値は使用できません。

 -- C の関数: *note PyObject: 5df. *PyImport_Import (PyObject *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  現在
     の "インポートフック関数" を呼び出すための高水準のインターフェース
     です ('level' に 0 を明示すると、絶対インポートを意味します)。 この
     関数は現在のグローバル変数辞書内の ‘__builtins__’ から *note
     __import__(): ad1. 関数を呼び出します。すなわち、現在の環境にインス
     トールされているインポートフック使ってインポートを行います。

     この関数は常に絶対インポートを使用します。

 -- C の関数: *note PyObject: 5df. *PyImport_ReloadModule (PyObject *m)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  モジ
     ュールを再ロード (reload) します。戻り値は再ロードしたモジュールか
     トップレベルパッケージへの新たな参照になります。 失敗した場合には例
     外をセットし、‘NULL’ を返します (その場合でも、モジュールは生成され
     ている場合があります)。

 -- C の関数: *note PyObject: 5df. *PyImport_AddModuleRef (const char
          *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.13 より).'  Return the module object corresponding to a
     module name.

     The 'name' argument may be of the form ‘package.module’.  First
     check the modules dictionary if there's one there, and if not,
     create a new one and insert it in the modules dictionary.

     Return a *note strong reference: 5e2. to the module on success.
     Return ‘NULL’ with an exception set on failure.

     The module name 'name' is decoded from UTF-8.

     This function does not load or import the module; if the module
     wasn't already loaded, you will get an empty module object.  Use
     *note PyImport_ImportModule(): 3dc. or one of its variants to
     import a module.  Package structures implied by a dotted name for
     'name' are not created if not already present.

     Added in version 3.13.

 -- C の関数: *note PyObject: 5df. *PyImport_AddModuleObject (PyObject
          *name)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.7 より).'  Similar to *note PyImport_AddModuleRef(): 5fb,
     but return a *note borrowed reference: 3d7. and 'name' is a Python
     *note str: 169. object.

     Added in version 3.3.

 -- C の関数: *note PyObject: 5df. *PyImport_AddModule (const char
          *name)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'
     Similar to *note PyImport_AddModuleRef(): 5fb, but return a *note
     borrowed reference: 3d7.

 -- C の関数: *note PyObject: 5df. *PyImport_ExecCodeModule (const char
          *name, PyObject *co)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     Given a module name (possibly of the form ‘package.module’) and a
     code object read from a Python bytecode file or obtained from the
     built-in function *note compile(): 4b1, load the module.  Return a
     new reference to the module object, or ‘NULL’ with an exception set
     if an error occurred.  'name' is removed from *note sys.modules:
     17e6. in error cases, even if 'name' was already in *note
     sys.modules: 17e6. on entry to *note PyImport_ExecCodeModule():
     5031.  Leaving incompletely initialized modules in *note
     sys.modules: 17e6. is dangerous, as imports of such modules have no
     way to know that the module object is an unknown (and probably
     damaged with respect to the module author's intents) state.

     The module's *note __spec__: 2364. and *note __loader__: 33b. will
     be set, if not set already, with the appropriate values.  The
     spec's loader will be set to the module's ‘__loader__’ (if set) and
     to an instance of *note SourceFileLoader: 1280. otherwise.

     The module's *note __file__: 2369. attribute will be set to the
     code object's *note co_filename: 1585.  If applicable, *note
     __cached__: 321. will also be set.

     この関数は、すでにインポートされているモジュールの場合には再ロード
     を行います。意図的にモジュールの再ロードを行う方法は *note
     PyImport_ReloadModule(): 503a. を参照してください。

     'name' が ‘package.module’ 形式のドット名表記であった場合、まだ作成
     されていないパッケージ構造はその作成されないままになります。

     *note PyImport_ExecCodeModuleEx(): 5032. と *note
     PyImport_ExecCodeModuleWithPathnames(): 5034. も参照してください。

     バージョン 3.12 で変更: The setting of *note __cached__: 321. and
     *note __loader__: 33b. is deprecated.  See *note ModuleSpec: 226c.
     for alternatives.

 -- C の関数: *note PyObject: 5df. *PyImport_ExecCodeModuleEx (const
          char *name, PyObject *co, const char *pathname)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  Like
     *note PyImport_ExecCodeModule(): 5031, but the *note __file__:
     2369. attribute of the module object is set to 'pathname' if it is
     non-‘NULL’.

     *note PyImport_ExecCodeModuleWithPathnames(): 5034. も参照してくだ
     さい。

 -- C の関数: *note PyObject: 5df. *PyImport_ExecCodeModuleObject
          (PyObject *name, PyObject *co, PyObject *pathname, PyObject
          *cpathname)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'  Like *note PyImport_ExecCodeModuleEx(): 5032,
     but the *note __cached__: 321. attribute of the module object is
     set to 'cpathname' if it is non-‘NULL’.  Of the three functions,
     this is the preferred one to use.

     Added in version 3.3.

     バージョン 3.12 で変更: Setting *note __cached__: 321. is
     deprecated.  See *note ModuleSpec: 226c. for alternatives.

 -- C の関数: *note PyObject: 5df. *PyImport_ExecCodeModuleWithPathnames
          (const char *name, PyObject *co, const char *pathname, const
          char *cpathname)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     *note PyImport_ExecCodeModuleObject(): 5033. と似ていますが、
     'name' と 'pathname'、 'cpathname' が UTF-8 でエンコードされた文字
     列である点が異なります。もし 'pathname' が ‘NULL’ の場合、
     'cpathname' から、'pathname' どのような値になるべきかを知る試みもな
     されます。

     Added in version 3.2.

     バージョン 3.3 で変更: Uses ‘imp.source_from_cache()’ in
     calculating the source path if only the bytecode path is provided.

     バージョン 3.12 で変更: No longer uses the removed ‘imp’ module.

 -- C の関数: long PyImport_GetMagicNumber ()
     ' 次に属します: *note Stable ABI: 775.'  Python バイトコードファイ
     ル (別名 ‘.pyc’ ファイル) のマジックナンバーを返します。マジックナ
     ンバーはバイトコードファイルの最初の4バイトに、リトルエンディアンバ
     イトオーダーで現れるべきです。エラーの場合は ‘-1’ を返します。

     バージョン 3.3 で変更: 失敗した場合は ‘-1’ の値を返します。

 -- C の関数: const char *PyImport_GetMagicTag ()
     ' 次に属します: *note Stable ABI: 775.'  マジックタグ文字列を
     Python バイトコードファイル名の PEP 3147(1) フォーマットで返します
     。‘sys.implementation.cache_tag’ の値が信頼でき、かつこの関数の代わ
     りに使用すべきであることを肝に命じましょう。

     Added in version 3.2.

 -- C の関数: *note PyObject: 5df. *PyImport_GetModuleDict ()
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  モジュ
     ール管理のための辞書 (いわゆる ‘sys.modules’)を返します。この辞書は
     インタプリタごとに一つだけある変数なので注意してください。

 -- C の関数: *note PyObject: 5df. *PyImport_GetModule (PyObject *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.8 より).'  与えられた名前の既にインポート済みのモジュール
     を返します。 モジュールがインポートされていなかった場合は、 ‘NULL’
     を返しますが、エラーはセットしません。 モジュールの検索に失敗した場
     合は、 ‘NULL’ を返し、エラーをセットします。

     Added in version 3.7.

 -- C の関数: *note PyObject: 5df. *PyImport_GetImporter (PyObject
          *path)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return a finder object for a *note sys.path: 3e4./‘pkg.__path__’
     item 'path', possibly by fetching it from the *note
     sys.path_importer_cache: 7fa. dict.  If it wasn't yet cached,
     traverse *note sys.path_hooks: 1225. until a hook is found that can
     handle the path item.  Return ‘None’ if no hook could; this tells
     our caller that the *note path based finder: 244d. could not find a
     finder for this path item.  Cache the result in *note
     sys.path_importer_cache: 7fa.  Return a new reference to the finder
     object.

 -- C の関数: int PyImport_ImportFrozenModuleObject (PyObject *name)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     'name' という名前のフリーズ (freeze) されたモジュールをロードします
     。成功すると ‘1’ を、モジュールが見つからなかった場合には ‘0’ を、
     初期化が失敗した場合には例外をセットして ‘-1’ を返します。ロードに
     成功したモジュールにアクセスするには *note PyImport_ImportModule():
     3dc. を使ってください。 (Note この関数はいささか誤解を招く名前です
     -- この関数はモジュールがすでにインポートされていたらリロードしてし
     まいます。)

     Added in version 3.3.

     バージョン 3.4 で変更: ‘__file__’ 属性はもうモジュールにセットされ
     ません。

 -- C の関数: int PyImport_ImportFrozenModule (const char *name)
     ' 次に属します: *note Stable ABI: 775.'  *note
     PyImport_ImportFrozenModuleObject(): 5038. と似ていますが、name は
     UTF-8 でエンコードされた文字列の代わりに、 Unicode オブジェクトを使
     用する点が異なります。

 -- C Struct: struct _frozen

     ‘freeze’ ユーティリティが生成するようなフリーズ化モジュールデスクリ
     プタの構造体型定義です。 (Python ソース配布物の ‘Tools/freeze/’ を
     参照してください) この構造体の定義は ‘Include/import.h’ にあり、以
     下のようになっています:

          struct _frozen {
              const char *name;
              const unsigned char *code;
              int size;
              bool is_package;
          };

     バージョン 3.11 で変更: The new ‘is_package’ field indicates
     whether the module is a package or not.  This replaces setting the
     ‘size’ field to a negative value.

 -- C 変数: const struct *note _frozen: 979. *PyImport_FrozenModules

     このポインタは *note _frozen: 979. のレコードからなり、終端の要素の
     メンバが ‘NULL’ かゼロになっているような配列を指すよう初期化されま
     す。 フリーズされたモジュールをインポートするとき、このテーブルを検
     索します。 サードパーティ製のコードからこのポインタに仕掛けを講じて
     、動的に生成されたフリーズ化モジュールの集合を提供するようにできま
     す。

 -- C の関数: int PyImport_AppendInittab (const char *name, PyObject
          *(*initfunc)(void))
     ' 次に属します: *note Stable ABI: 775.'  既存の組み込みモジュールテ
     ーブルに単一のモジュールを追加します。この関数は利便性を目的とした
     *note PyImport_ExtendInittab(): 1b1d. のラッパー関数で、テーブルが
     拡張できないときには ‘-1’ を返します。新たなモジュールは 'name' で
     インポートでき、最初にインポートを試みた際に呼び出される関数として
     'initfunc' を使います。 *note Py_Initialize(): 460. よりも前に呼び
     出さなければなりません。

 -- C Struct: struct _inittab

     Structure describing a single entry in the list of built-in
     modules.  Programs which embed Python may use an array of these
     structures in conjunction with *note PyImport_ExtendInittab():
     1b1d. to provide additional built-in modules.  The structure
     consists of two members:

      -- C のメンバ変数: const char *name

          The module name, as an ASCII encoded string.

      -- C のメンバ変数: *note PyObject: 5df. *(*initfunc)(void)

          Initialization function for a module built into the
          interpreter.

 -- C の関数: int PyImport_ExtendInittab (struct _inittab *newtab)

     Add a collection of modules to the table of built-in modules.  The
     'newtab' array must end with a sentinel entry which contains ‘NULL’
     for the *note name: 522c. field; failure to provide the sentinel
     value can result in a memory fault.  Returns ‘0’ on success or ‘-1’
     if insufficient memory could be allocated to extend the internal
     table.  In the event of failure, no modules are added to the
     internal table.  This must be called before *note Py_Initialize():
     460.

     Python が複数回初期化される場合、*note PyImport_AppendInittab():
     1b1c. または *note PyImport_ExtendInittab(): 1b1d. は、それぞれの初
     期化の前に呼び出される必要があります。

 -- C 変数: struct *note _inittab: 522b. *PyImport_Inittab

     The table of built-in modules used by Python initialization.  Do
     not use this directly; use *note PyImport_AppendInittab(): 1b1c.
     and *note PyImport_ExtendInittab(): 1b1d. instead.

 -- C の関数: *note PyObject: 5df. *PyImport_ImportModuleAttr (PyObject
          *mod_name, PyObject *attr_name)
     '戻り値: 新しい参照。' Import the module 'mod_name' and get its
     attribute 'attr_name'.

     Names must be Python *note str: 169. objects.

     Helper function combining *note PyImport_Import(): 1615. and *note
     PyObject_GetAttr(): 5ee.  For example, it can raise *note
     ImportError: 65b. if the module is not found, and *note
     AttributeError: 5f0. if the attribute doesn't exist.

     Added in version 3.14.

 -- C の関数: *note PyObject: 5df. *PyImport_ImportModuleAttrString
          (const char *mod_name, const char *attr_name)
     '戻り値: 新しい参照。' Similar to *note
     PyImport_ImportModuleAttr(): 396, but names are UTF-8 encoded
     strings instead of Python *note str: 169. objects.

     Added in version 3.14.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3147/


File: python.info,  Node: データ整列化 data marshalling のサポート,  Next: 引数の解釈と値の構築,  Prev: モジュールのインポート<2>,  Up: ユーティリティ<2>

7.7.5 データ整列化 (data marshalling) のサポート
------------------------------------------------

以下のルーチン群は、 *note marshal: 91. モジュールと同じ形式を使った整列
化オブジェクトを C コードから使えるようにします。整列化形式でデータを書
き出す関数に加えて、データを読み戻す関数もあります。整列化されたデータを
記録するファイルはバイナリモードで開かれていなければなりません。

数値は最小桁が先にくるように記録されます。

The module supports several versions of the data format; see the *note
Python module documentation: 91. for details.

 -- C のマクロ: Py_MARSHAL_VERSION

     The current format version.  See *note marshal.version: 2d42.

 -- C の関数: void PyMarshal_WriteLongToFile (long value, FILE *file,
          int version)

     long 型の整数値 'value' を 'file' へ整列化します。この関数は
     'value' の下桁 32 ビットを書き込むだけです; ネイティブの long 型サ
     イズには関知しません。 'version' はファイルフォーマットを示します。

     この関数は失敗することがあり、その場合はエラー指示子を設定します。
     それを確認するために *note PyErr_Occurred(): 1caf. を使います。

 -- C の関数: void PyMarshal_WriteObjectToFile (PyObject *value, FILE
          *file, int version)

     Python オブジェクト 'value' を 'file' へ整列化します。'version' は
     ファイルフォーマットを示します。

     この関数は失敗することがあり、その場合はエラー指示子を設定します。
     それを確認するために *note PyErr_Occurred(): 1caf. を使います。

 -- C の関数: *note PyObject: 5df. *PyMarshal_WriteObjectToString
          (PyObject *value, int version)
     '戻り値: 新しい参照。' 'value' の整列化表現が入ったバイト列オブジェ
     クトを返します。'version' はファイルフォーマットを示します。

以下の関数を使うと、整列化された値を読み戻せます。

 -- C の関数: long PyMarshal_ReadLongFromFile (FILE *file)

     読み出し用に開かれた FILE* 内のデータストリームから、 C の long 型
     データを読み出して返します。この関数は、ネイティブの long のサイズ
     に関係なく、 32 ビットの値だけを読み出せます。

     エラーの場合、適切な例外 (*note EOFError: 14f1.) を設定し ‘-1’ を返
     します。

 -- C の関数: int PyMarshal_ReadShortFromFile (FILE *file)

     読み出し用に開かれた FILE* 内のデータストリームから、 C の short 型
     データを読み出して返します。この関数は、ネイティブの short のサイズ
     に関係なく、 16 ビットの値だけを読み出せます。

     エラーの場合、適切な例外 (*note EOFError: 14f1.) を設定し ‘-1’ を返
     します。

 -- C の関数: *note PyObject: 5df. *PyMarshal_ReadObjectFromFile (FILE
          *file)
     '戻り値: 新しい参照。' 読み出し用に開かれた FILE* 内のデータストリ
     ームから Python オブジェクトを返します。

     エラーの場合、適切な例外 (*note EOFError: 14f1, *note ValueError:
     2ec, *note TypeError: 198.) を設定し ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyMarshal_ReadLastObjectFromFile
          (FILE *file)
     '戻り値: 新しい参照。' Return a Python object from the data stream
     in a FILE* opened for reading.  Unlike *note
     PyMarshal_ReadObjectFromFile(): 5235, this function assumes that no
     further objects will be read from the file, allowing it to
     aggressively load file data into memory so that the
     de-serialization can operate from data in memory rather than
     reading a byte at a time from the file.  Only use this variant if
     you are certain that you won't be reading anything else from the
     file.

     エラーの場合、適切な例外 (*note EOFError: 14f1, *note ValueError:
     2ec, *note TypeError: 198.) を設定し ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyMarshal_ReadObjectFromString
          (const char *data, Py_ssize_t len)
     '戻り値: 新しい参照。' 'data' が指す 'len' バイトのバイト列バッファ
     内のデータストリームから Python オブジェクトを返します。

     エラーの場合、適切な例外 (*note EOFError: 14f1, *note ValueError:
     2ec, *note TypeError: 198.) を設定し ‘NULL’ を返します。


File: python.info,  Node: 引数の解釈と値の構築,  Next: 文字列の変換と書式化,  Prev: データ整列化 data marshalling のサポート,  Up: ユーティリティ<2>

7.7.6 引数の解釈と値の構築
--------------------------

These functions are useful when creating your own extension functions
and methods.  Additional information and examples are available in *note
Python インタプリタの拡張と埋め込み: 1fbd.

最初に説明する 3 つの関数、 *note PyArg_ParseTuple(): 3c1, *note
PyArg_ParseTupleAndKeywords(): 624,および *note PyArg_Parse(): 180e. は
いずれも '書式文字列 (format string)' を使います。書式文字列は、関数が受
け取るはずの引数に関する情報を伝えるのに用いられます。いずれの関数におけ
る書式文字列も、同じ書式を使っています。

* Menu:

* 引数を解析する: 引数を解析する<2>.
* 値の構築::


File: python.info,  Node: 引数を解析する<2>,  Next: 値の構築,  Up: 引数の解釈と値の構築

7.7.6.1 引数を解析する
......................

書式文字列は、ゼロ個またはそれ以上の "書式単位 (format unit)" から成り立
ちます。 1つの書式単位は1つの Python オブジェクトを表します; 通常は単一
の文字か、書式単位からなる文字列を括弧で囲ったものになります。例外として
、括弧で囲われていない書式単位文字列が単一のアドレス引数に対応する場合が
いくつかあります。以下の説明では、引用符のついた形式は書式単位です; (丸
)括弧で囲った部分は書式単位に対応する Python のオブジェクト型です; [角]
括弧は値をアドレス渡しする際に使う C の変数型です。

* Menu:

* 文字列とバッファ::
* 数: 数<2>.
* その他のオブジェクト::
* API 関数::


File: python.info,  Node: 文字列とバッファ,  Next: 数<2>,  Up: 引数を解析する<2>

7.7.6.2 文字列とバッファ
........................

     注釈: Python 3.12 以前では、以下で説明された全ての ‘#’ の種類
     (‘s#’, ‘y#’ など) を使用するために ‘PY_SSIZE_T_CLEAN’ マクロを
     ‘Python.h’ のインクルードの前に定義しなければなりません。これは
     Python 3.13 以降では不要です。

以下のフォーマットはオブジェクトに連続したメモリチャンクとしてアクセスす
るためのものです。返される unicode や bytes のために生のストレージを用意
する必要はありません。

特に言及されていない場合、バッファーは NUL 終端されていません。

文字列とバッファをCに変換する方法は3つあります：

   * 形式としては ‘y*’ そして ‘s*’ 埋める *note Py_buffer: 95c. 構造体。
     これはロックします 根底 バッファ これにより、呼び出し元はその後、バ
     ッファを内部でも使用できるようになります
     :c:type:‘Py_BEGIN_ALLOW_THREADS’ ブロック リスクなしに 可変 データ
     が再サイズ化または破壊される。その結果、'電話をかけなければならない
     ' *note PyBuffer_Release(): 63b. データ処理が完了した後（または早期
     終了の場合）。

   * その ‘es’, ‘es#’, ‘et’ そして ‘et#’ フォーマットは結果を割り当てま
     す バッファ.  '必ず電話をかけてください' *note PyMem_Free(): 165b.
     データ処理が完了した後（または早期終了の場合）。

   * 他の形式では *note str: 169. または 読み出し専用 bytes-like オブジ
     ェクト、例えば *note bytes: 192, および提供する ‘const char *’ ポイ
     ンタ その バッファ.  この場合 バッファ「借用」されています：これは
     対応するPythonオブジェクトによって管理され、このオブジェクトのライ
     フサイクルを共有します。メモリを自分で解放する必要はありません。

     以下のことを確実にするため 根底 バッファ 安全に借りることができます
     , 対象の *note PyBufferProcs.bf_releasebuffer: 967. フィールドは必
     須です。 ‘NULL’.  これは一般的な 可変 次のようなオブジェクト *note
     bytearray: 344, また、いくつかの 読み出し専用 次のようなオブジェク
     ト *note memoryview: 165. の *note bytes: 192.

     これに加えて ‘bf_releasebuffer’ 要件として、入力が有効かどうかを確
     認するチェックはありません 対象は 不変 （例：請求に応じるかどうか 書
     き込み可能 バッファ, または、別のスレッドがデータを変更できるかどう
     か)。

‘s’ (*note str: 169.) [const char *]

     Unicode オブジェクトを、キャラクタ文字列を指す C のポインタに変換し
     ます。キャラクタ型ポインタ変数のアドレスを渡すと、すでに存在してい
     る文字列へのポインタをその変数に記録します。C 文字列は NUL で終端さ
     れています。Python の文字列型は、 null コードポイントが途中に埋め込
     まれていてはなりません; もし埋め込まれていれば *note ValueError:
     2ec. 例外を送出します。Unicode オブジェクトは ‘'utf-8'’ を使って C
     文字列に変換されます。変換に失敗すると *note UnicodeError: 462. を
     送出します。

          注釈: このフォーマットは *note bytes-like objects: 193. をサポ
          ートしません。 ファイルシステムパスを受け取って C 言語の文字列
          に変換したい場合は、 ‘O&’ フォーマットを、 'converter' に
          *note PyUnicode_FSConverter(): f15. を指定して利用すると良いで
          す。

     バージョン 3.5 で変更: 以前は Python 文字列に null コードポイントが
     埋め込まれていたときに *note TypeError: 198. を送出していました。

‘s*’ (*note str: 169. または *note bytes-like object: 193.) [Py_buffer]

     このフォーマットは Unicode オブジェクトと bytes-like object を受け
     付けて、呼び出し元から渡された *note Py_buffer: 95c. 構造体に値を格
     納します。 結果の C 文字列は NUL バイトを含むかもしれません。
     Unicode オブジェクトは ‘'utf-8'’ エンコーディングで C 文字列に変換
     されます。

‘s#’ (*note str: 169, 読み取り専用の *note bytes-like object: 193.) [const char *, *note Py_ssize_t: c55.]

     のように ‘s*’, ただし、それは *note 借用された バッファ: 3d6.  結果
     は2つのC変数に格納されます。最初の変数はC文字列へのポインター、2つ
     目の変数はその長さです。文字列には埋め込まれたヌルバイトが含まれる
     可能性があります。Unicodeオブジェクトは、C文字列に変換されます
     ‘'utf-8'’ エンコード。

‘z’ (*note str: 169. または ‘None’) [const char *]

     ‘s’ に似ていますが、Python オブジェクトは ‘None’ でもよく、その場合
     には C のポインタは ‘NULL’ にセットされます。

‘z*’ (*note str: 169, *note bytes-like object: 193. または ‘None’) [Py_buffer]

     ‘s*’ と同じですが、 Python の ‘None’ オブジェクトを受け取ることがで
     きます。その場合、 *note Py_buffer: 95c. 構造体の ‘buf’ メンバーは
     ‘NULL’ になります。

‘z#’ (*note str: 169, 読み出し専用の *note bytes-like object: 193. または ‘None’) [const char *, *note Py_ssize_t: c55.]

     ‘s#’ に似ていますが、Python オブジェクトは ‘None’ でもよく、その場
     合には C のポインタは ‘NULL’ にセットされます。

‘y’ (読み出し専用の *note bytes-like object: 193.) [const char *]

     この形式は bytes-like Cポインタへのオブジェクトへの参照を拒否する
     *note borrowed: 3d6. 文字列; Unicode オブジェクトは受け付けません。
     バイトバッファには埋め込みのヌルバイトを含んではいけません。もし含
     まれている場合 *note ValueError: 2ec. 例外が発生します。

     バージョン 3.5 で変更: 以前は bytes バッファにヌルバイトが埋め込ま
     れていたときに *note TypeError: 198. を送出していました。

‘y*’ (*note bytes-like object: 193.) [Py_buffer]

     ‘s*’ の変形で、 Unicode オブジェクトを受け付けず、 bytes-like
     object のみを受け付けます。 'バイナリデータを受け付ける目的には、こ
     のフォーマットを使うことを推奨します。'

‘y#’ (読み出し専用の *note bytes-like object: 193.) [const char *, *note Py_ssize_t: c55.]

     ‘s#’ の変形で、 Unicode オブジェクトを受け付けず、bytes-like object
     だけを受け付けます。

‘S’ (*note bytes: 192.) [PyBytesObject *]

     Pythonオブジェクトとして、 *note bytes: 192. オブジェクトを要求し、
     いかなる変換も行いません。オブジェクトが bytes オブジェクトでなけれ
     ば、 *note TypeError: 198. を送出します。C 変数は *note PyObject:
     5df.* と宣言しても構いません。

‘Y’ (*note bytearray: 344.) [PyByteArrayObject *]

     Python オブジェクトとして *note bytearray: 344. オブジェクトを要求
     し、いかなる変換もおこないません。 もしオブジェクトが *note
     bytearray: 344. でなければ、 *note TypeError: 198. を送出します。C
     変数は *note PyObject: 5df.* として宣言しても構いません。

‘U’ (*note str: 169.) [PyObject *]

     Python オブジェクトとして Unicode オブジェクトを要求し、いかなる変
     換も行いません。オブジェクトが Unicode オブジェクトではない場合、
     *note TypeError: 198. が送出されます。C変数は *note PyObject: 5df.*
     として宣言しても構いません。

‘w*’ (読み書き可能な *note bytes-like object: 193.) [Py_buffer]

     This format accepts any object which implements the read-write
     buffer interface.  It fills a *note Py_buffer: 95c. structure
     provided by the caller.  The buffer may contain embedded null
     bytes.  The caller has to call *note PyBuffer_Release(): 63b. when
     it is done with the buffer.

‘es’ (*note str: 169.) [const char *encoding, char **buffer]

     これは ‘s’ の変化形で、Unicodeをキャラクタ型バッファにエンコードす
     るために用いられます。NULバイトが埋め込まれていないデータでのみ動作
     します。

     この書式には二つの引数が必要です。一つ目は入力にのみ用いられ、 NUL
     で終端されたエンコード名文字列を指す const char* 型または、
     ‘'utf-8'’ が使われることを表す ‘NULL’ でなければなりません。指定し
     たエンコード名を Python が理解できない場合には例外を送出します。第
     二の引数は char** でなければなりません; この引数が参照しているポイ
     ンタの値は、引数に指定したテキストの内容が入ったバッファへのポイン
     タになります。テキストは最初の引数に指定したエンコード方式でエンコ
     ードされます。

     *note PyArg_ParseTuple(): 3c1. を使うと、必要なサイズのバッファを確
     保し、そのバッファにエンコード後のデータをコピーして、 '*buffer' が
     この新たに確保された記憶領域を指すように変更します。呼び出し側には
     、確保されたバッファを使い終わった後に *note PyMem_Free(): 165b. で
     解放する責任があります。

‘et’ (*note str: 169, *note bytes: 192. または *note bytearray: 344.) [const char *encoding, char **buffer]

     ‘es’ と同じです。ただし、バイト文字列オブジェクトをエンコードし直さ
     ずに渡します。その代わり、実装ではバイト文字列オブジェクトがパラメ
     タに渡したエンコードを使っているものと仮定します。

‘es#’ (*note str: 169.) [const char *encoding, char **buffer, *note Py_ssize_t: c55. *buffer_length]

     ‘s#’ の変化形で、Unicode をキャラクタ型バッファにエンコードするため
     に用いられます。‘es’ 書式違って、この変化形はバイトが埋め込まれてい
     てもかまいません。

     この書式には三つの引数が必要です。一つ目は入力にのみ用いられ、 NUL
     で終端されたエンコード名文字列を指す const char* 型か ‘NULL’ でなけ
     ればなりません。 ‘NULL’ の場合には ‘'utf-8'’ を使います。指定したエ
     ンコード名を Python が理解できない場合には例外を送出します。第二の
     引数は char** でなければなりません; この引数が参照しているポインタ
     の値は、引数に指定したテキストの内容が入ったバッファへのポインタに
     なります。テキストは最初の引数に指定したエンコード方式でエンコード
     されます。第三の引数は整数へのポインタでなければなりません; ポイン
     タが参照している整数の値は出力バッファ内のバイト数にセットされます
     。

     この書式の処理には二つのモードがあります:

     '*buffer' が ‘NULL’ ポインタを指している場合、関数は必要なサイズの
     バッファを確保し、そのバッファにエンコード後のデータをコピーして、
     '*buffer' がこの新たに確保された記憶領域を指すように変更します。呼
     び出し側には、確保されたバッファを使い終わった後に *note
     PyMem_Free(): 165b. で解放する責任があります。

     '*buffer' が非 ‘NULL’ のポインタ (すでにメモリ確保済みのバッファ) を
     指している場合、 *note PyArg_ParseTuple(): 3c1. はこのメモリ位置を
     バッファとして用い、 '*buffer_length' の初期値をバッファサイズとし
     て用います。 PyArg_ParseTuple は次にエンコード済みのデータをバッフ
     ァにコピーして、NUL で終端します。バッファの大きさが足りなければ
     *note ValueError: 2ec. がセットされます。

     どちらの場合も、 '*buffer_length' は終端の NUL バイトを含まないエン
     コード済みデータの長さにセットされます。

‘et#’ (*note str: 169, *note bytes: 192. または *note bytearray: 344.) [const char *encoding, char **buffer, *note Py_ssize_t: c55. *buffer_length]

     ‘es#’ と同じです。ただし、バイト文字列オブジェクトをエンコードし直
     さずに渡します。その代わり、実装ではバイト文字列オブジェクトがパラ
     メタに渡したエンコードを使っているものと仮定します。

バージョン 3.12 で変更: ‘u’, ‘u#’, ‘Z’, and ‘Z#’ are removed because
they used a legacy ‘Py_UNICODE*’ representation.


File: python.info,  Node: 数<2>,  Next: その他のオブジェクト,  Prev: 文字列とバッファ,  Up: 引数を解析する<2>

7.7.6.3 数
..........

These formats allow representing Python numbers or single characters as
C numbers.  Formats that require *note int: 19b, *note float: 196. or
*note complex: 197. can also use the corresponding special methods *note
__index__(): 19e, *note __float__(): bc1. or *note __complex__(): 7fd.
to convert the Python object to the required type.

For signed integer formats, *note OverflowError: a81. is raised if the
value is out of range for the C type.  For unsigned integer formats, no
range checking is done -- the most significant bits are silently
truncated when the receiving field is too small to receive the value.

‘b’ (*note int: 19b.) [unsigned char]

     Convert a nonnegative Python integer to an unsigned tiny integer,
     stored in a C unsigned char.

‘B’ (*note int: 19b.) [unsigned char]

     Convert a Python integer to a tiny integer without overflow
     checking, stored in a C unsigned char.

‘h’ (*note int: 19b.) [short int]

     Python の整数を、 C の short int 型に変換します。

‘H’ (*note int: 19b.) [unsigned short int]

     Python の整数を、オーバフローチェックを行わずに、 C の unsigned
     short int 型に変換します。

‘i’ (*note int: 19b.) [int]

     Python の整数を、 C の int 型に変換します。

‘I’ (*note int: 19b.) [unsigned int]

     Python の整数を、オーバフローチェックを行わずに、 C の unsigned int
     型に変換します。

‘l’ (*note int: 19b.) [long int]

     Python の整数を、 C の long int 型に変換します。

‘k’ (*note int: 19b.) [unsigned long]

     Python の整数を、オーバフローチェックを行わずに、 C の unsigned
     long 型に変換します。

     バージョン 3.14 で変更: 可能であれば *note __index__(): 19e. を使う
     ようになりました。

‘L’ (*note int: 19b.) [long long]

     Python の整数を、 C の long long 型に変換します。

‘K’ (*note int: 19b.) [unsigned long long]

     PythonのintをC unsigned long long へオーバーフローの確認をせず変換
     する

     バージョン 3.14 で変更: 可能であれば *note __index__(): 19e. を使う
     ようになりました。

‘n’ (*note int: 19b.) [*note Py_ssize_t: c55.]

     Python の整数をCの *note Py_ssize_t: c55. 型に変換します。

‘c’ (長さ 1 の、 *note bytes: 192. または *note bytearray: 344.) [char]

     長さ 1 の *note bytes: 192. または *note bytearray: 344. オブジェク
     トとして表現されている Python バイトを C の char 型に変換します。

     バージョン 3.3 で変更: *note bytearray: 344. を受け付けるようになり
     ました。

‘C’ (長さ 1 の *note str: 169.) [int]

     長さ 1 の *note str: 169. オブジェクトとして表現されている Python キ
     ャラクタを C の int 型に変換します。

‘f’ (*note float: 196.) [float]

     Convert a Python floating-point number to a C float.

‘d’ (*note float: 196.) [double]

     Convert a Python floating-point number to a C double.

‘D’ (*note complex: 197.) [Py_complex]

     Python の複素数型を、 C の *note Py_complex: 523d. 構造体に変換しま
     す。


File: python.info,  Node: その他のオブジェクト,  Next: API 関数,  Prev: 数<2>,  Up: 引数を解析する<2>

7.7.6.4 その他のオブジェクト
............................

‘O’ (object) [PyObject *]

     Python オブジェクトを（変換なしで）C オブジェクトのポインターに格納
     します。 これにより、C プログラムは渡された実際のオブジェクトを受け
     取ります。新しい :term: 強参照 オブジェクトが作成されていません （
     すなわち、その参照カウント 増加しません)。その ポインタ 保存されて
     いない ‘NULL’.

‘O!’ (object) ['typeobject', PyObject *]

     Python オブジェクトを C の Python オブジェクト型ポインタに保存しま
     す。 ‘O’ に似ていますが、二つの C の引数をとります: 一つ目の引数は
     Python の型オブジェクトへのアドレスで、二つ目の引数はオブジェクトへ
     のポインタが保存されている (*note PyObject: 5df.* の) C の変数への
     アドレスです。Python オブジェクトが指定した型ではない場合、 *note
     TypeError: 198. を送出します。

‘O&’ (object) ['converter', 'address']

     Python オブジェクトを 'converter' 関数を介して C の変数に変換します
     。二つの引数をとります: 一つ目は関数で、二つ目は (任意の型の) C 変
     数へのアドレスを void* 型に変換したものです。 'converter' は以下の
     ようにして呼び出されます:

          status = converter(object, address);

     ここで 'object' は変換対象の Python オブジェクトで、 'address' は
     ‘PyArg_Parse*’ に渡した void* 型の引数です。戻り値 'status' は変換
     に成功した際に ‘1’,失敗した場合には ‘0’ になります。変換に失敗した
     場合、 'converter' 関数は 'address' の内容を変更せずに例外を送出し
     なくてはなりません。

     If the 'converter' returns ‘Py_CLEANUP_SUPPORTED’, it may get
     called a second time if the argument parsing eventually fails,
     giving the converter a chance to release any memory that it had
     already allocated.  In this second call, the 'object' parameter
     will be ‘NULL’; 'address' will have the same value as in the
     original call.

     Examples of converters: *note PyUnicode_FSConverter(): f15. and
     *note PyUnicode_FSDecoder(): 797.

     バージョン 3.1 で変更: ‘Py_CLEANUP_SUPPORTED’ was added.

‘p’ (*note bool: 3c3.) [int]

     真偽値が求められる箇所 (a boolean 'p'redicate) に渡された値を判定し
     、その結果を等価な C の true/false 整数値に変換します。 もし式が真
     なら int には ‘1’ が、偽なら ‘0’ が設定されます。この関数は任意の有
     効なPython値を受け付けます。 Pythonが値の真偽をどのように判定するか
     を知りたければ、 *note 真理値判定: 1858. を参照してください。

     Added in version 3.3.

‘(items)’ (sequence) ['matching-items']

     The object must be a Python sequence (except *note str: 169, *note
     bytes: 192. or *note bytearray: 344.) whose length is the number of
     format units in 'items'.  The C arguments must correspond to the
     individual format units in 'items'.  Format units for sequences may
     be nested.

     If 'items' contains format units which store a *note borrowed
     buffer: 3d6. (‘s’, ‘s#’, ‘z’, ‘z#’, ‘y’, or ‘y#’) or a *note
     borrowed reference: 3d7. (‘S’, ‘Y’, ‘U’, ‘O’, or ‘O!’), the object
     must be a Python tuple.  The 'converter' for the ‘O&’ format unit
     in 'items' must not store a borrowed buffer or a borrowed
     reference.

     バージョン 3.14 で変更: *note str: 169. and *note bytearray: 344.
     objects no longer accepted as a sequence.

     バージョン 3.14 で非推奨: Non-tuple sequences are deprecated if
     'items' contains format units which store a borrowed buffer or a
     borrowed reference.

その他、書式文字列において意味を持つ文字がいくつかあります。それらの文字
は括弧による入れ子内には使えません。以下に文字を示します:

‘|’

     Python 引数リスト中で、この文字以降の引数がオプションであることを示
     します。オプションの引数に対応する C の変数はデフォルトの値で初期化
     しておかなければなりません -- オプションの引数が省略された場合、
     *note PyArg_ParseTuple(): 3c1. は対応する C 変数の内容に手を加えま
     せん。

‘$’

     *note PyArg_ParseTupleAndKeywords(): 624. でのみ使用可能: 後続の
     Python引数がキーワード専用であることを示します。 現在、すべてのキー
     ワード専用引数は任意の引数でなければならず、そのため フォーマット文
     字列中の ‘|’ は常に ‘$’ より前に指定されなければなりません。

     Added in version 3.3.

‘:’

     この文字があると、書式単位の記述はそこで終わります; コロン以降の文
     字列は、エラーメッセージにおける関数名 (*note PyArg_ParseTuple():
     3c1. が送出する例外の "付属値 (associated value)") として使われます
     。

‘;’

     この文字があると、書式単位の記述はそこで終わります; セミコロン以降
     の文字列は、デフォルトエラーメッセージを '置き換える' エラーメッセ
     ージとして使われます。 ‘:’ と ‘;’ は相互に排他の文字です。

注意：呼び出し元に渡されるPythonオブジェクトの参照はすべて*借用*された参
照です。これらを解放しないでください（つまり、参照カウントを減らさないで
ください）！

以下の関数に渡す補助引数 (additional argument) は、書式文字列から決定さ
れる型へのアドレスでなければなりません; 補助引数に指定したアドレスは、タ
プルから入力された値を保存するために使います。上の書式単位のリストで説明
したように、補助引数を入力値として使う場合がいくつかあります; その場合、
対応する書式単位の指定する形式に従うようにしなければなりません。

変換を正しく行うためには、 'arg' オブジェクトは書式文字に一致しなければ
ならず、かつ書式文字列内の書式単位に全て値が入るようにしなければなりませ
ん。成功すると、 ‘PyArg_Parse*’ 関数は真を返します。それ以外の場合には偽
を返し、適切な例外を送出します。書式単位のどれかの変換失敗により
‘PyArg_Parse*’ が失敗した場合、失敗した書式単位に対応するアドレスとそれ
以降のアドレスの内容は変更されません。


File: python.info,  Node: API 関数,  Prev: その他のオブジェクト,  Up: 引数を解析する<2>

7.7.6.5 API 関数
................

 -- C の関数: int PyArg_ParseTuple (PyObject *args, const char *format,
          ...)
     ' 次に属します: *note Stable ABI: 775.'  位置引数のみを引数にとる関
     数のパラメタを解釈して、ローカルな変数に変換します。成功すると真を
     返します;失敗すると偽を返し、適切な例外を送出します。

 -- C の関数: int PyArg_VaParse (PyObject *args, const char *format,
          va_list vargs)
     ' 次に属します: *note Stable ABI: 775.'  *note PyArg_ParseTuple():
     3c1. と同じですが、可変長の引数ではなく 'va_list' を引数にとります
     。

 -- C の関数: int PyArg_ParseTupleAndKeywords (PyObject *args, PyObject
          *kw, const char *format, char *const *keywords, ...)
     ' 次に属します: *note Stable ABI: 775.'  Parse the parameters of a
     function that takes both positional and keyword parameters into
     local variables.  The 'keywords' argument is a ‘NULL’-terminated
     array of keyword parameter names specified as null-terminated ASCII
     or UTF-8 encoded C strings.  Empty names denote *note
     positional-only parameters: c78.  Returns true on success; on
     failure, it returns false and raises the appropriate exception.

          注釈: The 'keywords' parameter declaration is char *const* in
          C and const char *const* in C++.  This can be overridden with
          the *note PY_CXX_CONST: 626. macro.

     バージョン 3.6 で変更: *note 位置専用引数: c78. を追加した。

     バージョン 3.13 で変更: The 'keywords' parameter has now type char
     *const* in C and const char *const* in C++, instead of char**.
     Added support for non-ASCII keyword parameter names.

 -- C の関数: int PyArg_VaParseTupleAndKeywords (PyObject *args,
          PyObject *kw, const char *format, char *const *keywords,
          va_list vargs)
     ' 次に属します: *note Stable ABI: 775.'  *note
     PyArg_ParseTupleAndKeywords(): 624. と同じですが、可変長の引数では
     なく 'va_list' を引数にとります。

 -- C の関数: int PyArg_ValidateKeywordArguments (PyObject*)
     ' 次に属します: *note Stable ABI: 775.'  キーワード引数を格納した辞
     書のキーが文字列であることを確認します。この関数は *note
     PyArg_ParseTupleAndKeywords(): 624. を使用しないときにのみ必要で、
     その理由は後者の関数は同様のチェックを実施するためです。

     Added in version 3.2.

 -- C の関数: int PyArg_Parse (PyObject *args, const char *format, ...)
     ' 次に属します: *note Stable ABI: 775.'  Parse the parameter of a
     function that takes a single positional parameter into a local
     variable.  Returns true on success; on failure, it returns false
     and raises the appropriate exception.

     以下はプログラム例です:

          // Function using METH_O calling convention
          static PyObject*
          my_function(PyObject *module, PyObject *arg)
          {
              int value;
              if (!PyArg_Parse(arg, "i:my_function", &value)) {
                  return NULL;
              }
              // ... use value ...
          }

 -- C の関数: int PyArg_UnpackTuple (PyObject *args, const char *name,
          Py_ssize_t min, Py_ssize_t max, ...)
     ' 次に属します: *note Stable ABI: 775.'  パラメーターの取得方法のよ
     りシンプルな形式で、使用しないもの a 書式文字列 引数の型を指定する
     。関数 これを使用する メソッド 彼らの パラメータ 次のように宣言する
     必要があります *note METH_VARARGS: 1721. に 関数 にメソッド テーブ
     ル。実際のパラメーターを含むタプルは 'args' として渡す必要がありま
     す。必ずタプルでなければなりません。タプルの長さは、'min*以上で
     *max*以下でなければなりません。*min*と*max*は等しい場合もあります。
     関数には追加の引数を渡す必要があり、各引数はポインターでなければな
     らない ～へ:c:expr:'PyObject*' 変数；これらは*args*の値で埋められる
     ；これらは:term:を含む :term:'借用参照 <borrowed reference>'。
     *args' で指定されていないオプションパラメーターに対応する変数は初期
     化されません。これらの変数は呼び出し元で初期化する必要があります。
     これ 関数 成功した場合にtrueを返し、>>*<<args*がタプルでない場合ま
     たは要素の数が間違っている場合にfalseを返します。失敗した場合、例外
     が設定されます。

     これは、この関数の使用例で、ソースコードから抜粋したものです
     :mod:>>'<<!_weakref'弱参照用のヘルパーモジュール:

          static PyObject *
          weakref_ref(PyObject *self, PyObject *args)
          {
              PyObject *object;
              PyObject *callback = NULL;
              PyObject *result = NULL;

              if (PyArg_UnpackTuple(args, "ref", 1, 2, &object, &callback)) {
                  result = PyWeakref_NewRef(object, callback);
              }
              return result;
          }

     この例における *note PyArg_UnpackTuple(): 171f. 呼び出しは、 *note
     PyArg_ParseTuple(): 3c1. を使った以下の呼び出しと全く等価です:

          PyArg_ParseTuple(args, "O|O:ref", &object, &callback)

 -- C のマクロ: PY_CXX_CONST

     The value to be inserted, if any, before char *const* in the
     'keywords' parameter declaration of *note
     PyArg_ParseTupleAndKeywords(): 624. and *note
     PyArg_VaParseTupleAndKeywords(): 625.  Default empty for C and
     ‘const’ for C++ (const char *const*).  To override, define it to
     the desired value before including ‘Python.h’.

     Added in version 3.13.


File: python.info,  Node: 値の構築,  Prev: 引数を解析する<2>,  Up: 引数の解釈と値の構築

7.7.6.6 値の構築
................

 -- C の関数: *note PyObject: 5df. *Py_BuildValue (const char *format,
          ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     ‘PyArg_Parse*’ ファミリの関数が受け取るのと似た形式の書式文字列およ
     び値列に基づいて、新たな値を生成します。生成した値を返します。エラ
     ーの場合には ‘NULL’ を返します; ‘NULL’ を返す場合、例外を送出するで
     しょう。

     *note Py_BuildValue(): 3c2. は常にタプルを生成するとは限りません。
     この関数がタプルを生成するのは、書式文字列に二つ以上の書式単位が入
     っているときだけです。書式文字列が空の場合 ‘None’ を返します; 書式
     単位が厳密に一つだけ入っている場合、書式単位で指定されている何らか
     のオブジェクト単体を返します。サイズがゼロや 1 のタプルを返すように
     強制するには、丸括弧で囲われた書式文字列を使います。

     書式単位 ‘s’ や ‘s#’ の場合のように、オブジェクトを構築する際にデー
     タを供給するためにメモリバッファをパラメタとして渡す場合には、指定
     したデータはコピーされます。 *note Py_BuildValue(): 3c2. が生成した
     オブジェクトは、呼び出し側が提供したバッファを決して参照しません。
     別の言い方をすれば、 ‘malloc()’ を呼び出してメモリを確保し、それを
     *note Py_BuildValue(): 3c2. に渡した場合、コード内で *note
     Py_BuildValue(): 3c2. が返った後で ‘free()’ を呼び出す責任があると
     いうことです。

     以下の説明では、引用符のついた形式は書式単位です; (丸)括弧で囲った
     部分は書式単位が返す Python のオブジェクト型です; [角] 括弧は関数に
     渡す値の C 変数型です。

     書式文字列内では、(‘s#’ のような書式単位を除いて) スペース、タブ、
     コロンおよびコンマは無視されます。これらの文字を使うと、長い書式文
     字列をちょっとだけ読みやすくできます。

     ‘s’ (*note str: 169. または ‘None’) [const char *]

          null終端された C 文字列を、 ‘'utf-8'’ エンコーディングを用いて
          、 Python *note str: 169. オブジェクトに変換します。もし C 文
          字列ポインタが ‘NULL’ の場合、 ‘None’ になります。

     ‘s#’ (*note str: 169. or ‘None’) [const char *, *note Py_ssize_t: c55.]

          C 文字列とその長さを ‘'utf-8'’ エンコーディングを使って Python
          *note str: 169. オブジェクトに変換します。C 文字列ポインタが
          ‘NULL’ の場合、長さは無視され、 ‘None’ になります。

     ‘y’ (*note bytes: 192.) [const char *]

          C 文字列をPython *note bytes: 192. オブジェクトに変換します。
          もしC 文字列ポインタが ‘NULL’ だった場合、‘None’ を返します。

     ‘y#’ (*note bytes: 192.) [const char *, *note Py_ssize_t: c55.]

          これは C 文字列とその長さから Python オブジェクトに変換します
          。C 文字列ポインタが ‘NULL’ の場合、長さは無視され ‘None’ にな
          ります。

     ‘z’ (*note str: 169. または ‘None’) [const char *]

          ‘s’ と同じです。

     ‘z#’ (*note str: 169. または ‘None’) [const char *, *note Py_ssize_t: c55.]

          ‘s#’ と同じです。

     ‘u’ (*note str: 169.) [const wchar_t *]

          null 終端された Unicode (UTF-16 または UCS-4) データの
          ‘wchar_t’ バッファから Python Unicode オブジェクトに変換します
          。 Unicode バッファポインタが ‘NULL’ の場合、 ‘None’ になりま
          す。

     ‘u#’ (*note str: 169.) [const wchar_t *, *note Py_ssize_t: c55.]

          Unicode (UTF-16 または UCS-4) データのバッファとその長さから
          Python Unicode オブジェクトに変換します。 Unicode バッファポイ
          ンタが ‘NULL’ の場合、長さは無視され ‘None’ になります。

     ‘U’ (*note str: 169. または ‘None’) [const char *]

          ‘s’ と同じです。

     ‘U#’ (*note str: 169. または ‘None’) [const char *, *note Py_ssize_t: c55.]

          ‘s#’ と同じです。

     ‘i’ (*note int: 19b.) [int]

          通常の C の int を Python の整数オブジェクトに変換します。

     ‘b’ (*note int: 19b.) [char]

          通常のC の char を Python の整数オブジェクトに変換します。

     ‘h’ (*note int: 19b.) [short int]

          通常のC の short int を Python の整数オブジェクトに変換します
          。

     ‘l’ (*note int: 19b.) [long int]

          C の long int を Python の整数オブジェクトに変換します。

     ‘B’ (*note int: 19b.) [unsigned char]

          C の unsigned char を Python の整数オブジェクトに変換します。

     ‘H’ (*note int: 19b.) [unsigned short int]

          C の unsigned short int を Python の整数オブジェクトに変換しま
          す。

     ‘I’ (*note int: 19b.) [unsigned int]

          C の unsigned int を Python の整数オブジェクトに変換します。

     ‘k’ (*note int: 19b.) [unsigned long]

          C の unsigned long を Python の整数オブジェクトに変換します。

     ‘L’ (*note int: 19b.) [long long]

          C の long long を Python の整数オブジェクトに変換します。

     ‘K’ (*note int: 19b.) [unsigned long long]

          C unsigned long long をPythonのintオブジェクトへ変換する。

     ‘n’ (*note int: 19b.) [*note Py_ssize_t: c55.]

          C の *note Py_ssize_t: c55. を Python の整数オブジェクトに変換
          します。

     ‘p’ (*note bool: 3c3.) [int]

          Convert a C int to a Python *note bool: 3c3. object.

          Be aware that this format requires an ‘int’ argument.  Unlike
          most other contexts in C, variadic arguments are not coerced
          to a suitable type automatically.  You can convert another
          type (for example, a pointer or a float) to a suitable ‘int’
          value using ‘(x) ? 1 : 0’ or ‘!!x’.

          Added in version 3.14.

     ‘c’ (長さが 1 の *note bytes: 192.) [char]

          バイトを表す通常の C の int を、長さ 1 の Python の *note
          bytes: 192. オブジェクトに変換します。

     ‘C’ (長さ 1 の *note str: 169.) [int]

          文字を表す通常の C の int を、長さ 1 の Python の *note str:
          169. オブジェクトに変換します。

     ‘d’ (*note float: 196.) [double]

          Convert a C double to a Python floating-point number.

     ‘f’ (*note float: 196.) [float]

          Convert a C float to a Python floating-point number.

     ‘D’ (*note complex: 197.) [Py_complex *]

          C の *note Py_complex: 523d. 構造体を Python の複素数型に変換
          します。

     ‘O’ (object) [PyObject *]

          Python オブジェクトをそのまま渡すものの、それに対する新しい 強
          参照 を作成する（つまり、その参照カウントが1増加します）。渡さ
          れたオブジェクトが ‘NULL’ ポインタ, この問題は、引数を生成する
          呼び出しがエラーを検出し、例外を設定したため発生したものと推測
          されます。したがって、*note Py_BuildValue(): 3c2. 戻ってきます
          ‘NULL’ しかし、そうはならない 送出 例外。 例外がまだ発生してい
          ない場合、*note SystemError: 795. 設定されています。

     ‘S’ (object) [PyObject *]

          ‘O’ と同じです。

     ‘N’ (object) [PyObject *]

          同じです ‘O’, ただし、新しい 強参照 を作成しません。オブジェク
          トが引数リスト内のオブジェクトコンストラクターの呼び出しによっ
          て作成される場合に便利です。

     ‘O&’ (object) ['converter', 'anything']

          'anything' を 'converter' 関数を介して Python オブジェクトに変
          換します。この関数は 'anything' (void* と互換の型でなければな
          りません) を引数にして呼び出され、"新たな" オブジェクトを返す
          か、失敗した場合には ‘NULL’ を返すようにしなければなりません。

     ‘(items)’ (*note tuple: 614.) ['matching-items']

          C の値からなる配列を、同じ要素数を持つ Python のタプルに変換し
          ます。

     ‘[items]’ (*note list: 24d.) ['matching-items']

          C の値からなる配列を、同じ要素数を持つ Python のリストに変換し
          ます。

     ‘{items}’ (*note dict: 183.) ['matching-items']

          C の値からなる配列を Python の辞書に変換します。一連のペアから
          なる C の値が、それぞれキーおよび値となって辞書に追加されます
          。

     書式文字列に関するエラーが生じると、 *note SystemError: 795. 例外を
     セットして ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *Py_VaBuildValue (const char *format,
          va_list vargs)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     *note Py_BuildValue(): 3c2. と同じですが、可変長引数の代わりに
     va_list を受け取ります。


File: python.info,  Node: 文字列の変換と書式化,  Next: Character classification and conversion,  Prev: 引数の解釈と値の構築,  Up: ユーティリティ<2>

7.7.7 文字列の変換と書式化
--------------------------

数値変換と、書式化文字列出力のための関数群。

 -- C の関数: int PyOS_snprintf (char *str, size_t size, const char
          *format, ...)
     ' 次に属します: *note Stable ABI: 775.'  書式文字列 'format' と追加
     の引数から、 'size' バイトを超えない文字列を 'str' に出力します。
     Unix man page の ‘snprintf(3)(1)’ を参照してください。

 -- C の関数: int PyOS_vsnprintf (char *str, size_t size, const char
          *format, va_list va)
     ' 次に属します: *note Stable ABI: 775.'  書式文字列 'format' と可変
     長引数リスト 'va' から、 'size' バイトを超えない文字列を 'str' に出
     力します。 Unix man page の ‘vsnprintf(3)(2)’ を参照してください。

*note PyOS_snprintf(): 1722. と *note PyOS_vsnprintf(): 1723. は標準Cラ
イブラリの ‘snprintf()’ と ‘vsnprintf()’ 関数をラップします。これらの関
数の目的は、C標準ライブラリが保証していないコーナーケースでの動作を保証
することです。

The wrappers ensure that ‘str[size-1]’ is always ‘'\0'’ upon return.
They never write more than 'size' bytes (including the trailing ‘'\0'’)
into str.  Both functions require that ‘str != NULL’, ‘size > 0’,
‘format != NULL’ and ‘size < INT_MAX’.  Note that this means there is no
equivalent to the C99 ‘n = snprintf(NULL, 0, ...)’ which would determine
the necessary buffer size.

これらの関数の戻り値 (以下では 'rv' とします) は以下の意味を持ちます:

   * ‘0 <= rv < size’ のとき、変換出力は成功して、(最後の ‘str[rv]’ にあ
     る ‘'\0'’ を除いて) 'rv' 文字が 'str' に出力された。

   * ‘rv >= size’ のとき、変換出力は切り詰められており、成功するためには
     ‘rv + 1’ バイトが必要だったことを示します。‘str[size-1]’ は ‘'\0'’
     です。

   * When ‘rv < 0’, the output conversion failed and ‘str[size-1]’ is
     ‘'\0'’ in this case too, but the rest of 'str' is undefined.  The
     exact cause of the error depends on the underlying platform.

以下の関数は locale 非依存な文字列から数値への変換を行ないます。

 -- C の関数: unsigned long PyOS_strtoul (const char *str, char **ptr,
          int base)
     ' 次に属します: *note Stable ABI: 775.'  Convert the initial part
     of the string in ‘str’ to an unsigned long value according to the
     given ‘base’, which must be between ‘2’ and ‘36’ inclusive, or be
     the special value ‘0’.

     Leading white space and case of characters are ignored.  If ‘base’
     is zero it looks for a leading ‘0b’, ‘0o’ or ‘0x’ to tell which
     base.  If these are absent it defaults to ‘10’.  Base must be 0 or
     between 2 and 36 (inclusive).  If ‘ptr’ is non-‘NULL’ it will
     contain a pointer to the end of the scan.

     If the converted value falls out of range of corresponding return
     type, range error occurs (‘errno’ is set to ‘ERANGE’) and
     ‘ULONG_MAX’ is returned.  If no conversion can be performed, ‘0’ is
     returned.

     See also the Unix man page ‘strtoul(3)(3)’.

     Added in version 3.2.

 -- C の関数: long PyOS_strtol (const char *str, char **ptr, int base)
     ' 次に属します: *note Stable ABI: 775.'  Convert the initial part
     of the string in ‘str’ to an long value according to the given
     ‘base’, which must be between ‘2’ and ‘36’ inclusive, or be the
     special value ‘0’.

     Same as *note PyOS_strtoul(): 5085, but return a long value instead
     and ‘LONG_MAX’ on overflows.

     See also the Unix man page ‘strtol(3)(4)’.

     Added in version 3.2.

 -- C の関数: double PyOS_string_to_double (const char *s, char
          **endptr, PyObject *overflow_exception)
     ' 次に属します: *note Stable ABI: 775.'  文字列 ‘s’ を double に変
     換します。失敗したときは Python の例外を発生させます。受け入れられ
     る文字列は、 Python の *note float(): 196. コンストラクタが受け付け
     る文字列に準拠しますが、 ‘s’ の先頭と末尾に空白文字があってはならな
     いという部分が異なります。この変換は現在のロケールに依存しません。

     ‘endptr’ が ‘NULL’ の場合、変換は文字列全体に対して行われます。文字
     列が正しい浮動小数点数の表現になっていない場合は ‘-1.0’ を返して
     *note ValueError: 2ec. を発生させます。

     endptr が ‘NULL’ で無い場合、文字列を可能な範囲で変換して、
     ‘*endptr’ に最初の変換されなかった文字へのポインタを格納します。文
     字列の先頭に正しい浮動小数点数の表現が無かった場合、‘*endptr’ を文
     字列の先頭に設定して、ValueError を発生させ、‘-1.0’ を返します。

     If ‘s’ represents a value that is too large to store in a float
     (for example, ‘"1e500"’ is such a string on many platforms) then if
     ‘overflow_exception’ is ‘NULL’ return ‘Py_INFINITY’ (with an
     appropriate sign) and don't set any exception.  Otherwise,
     ‘overflow_exception’ must point to a Python exception object; raise
     that exception and return ‘-1.0’.  In both cases, set ‘*endptr’ to
     point to the first character after the converted value.

     それ以外のエラーが変換中に発生した場合(例えば out-of-memory エラー
     )、適切な Python の例外を設定して ‘-1.0’ を返します。

     Added in version 3.1.

 -- C の関数: char *PyOS_double_to_string (double val, char format_code,
          int precision, int flags, int *ptype)
     ' 次に属します: *note Stable ABI: 775.'  double 'val' を指定された
     'format_code', 'precision', 'flags' に基づいて文字列に変換します。

     'format_code' は ‘'e'’, ‘'E'’, ‘'f'’, ‘'F'’, ‘'g'’, ‘'G'’, ‘'r'’ の
     どれかでなければなりません。 ‘'r'’ の場合、 'precision' は 0 でなけ
     ればならず、無視されます。 ‘'r'’ フォーマットコードは標準の *note
     repr(): 1c1. フォーマットを指定しています。

     'flags' can be zero or more of the following values or-ed together:

      -- C のマクロ: Py_DTSF_SIGN

          Always precede the returned string with a sign character, even
          if 'val' is non-negative.

      -- C のマクロ: Py_DTSF_ADD_DOT_0

          Ensure that the returned string will not look like an integer.

      -- C のマクロ: Py_DTSF_ALT

          Apply "alternate" formatting rules.  See the documentation for
          the *note PyOS_snprintf(): 1722. ‘'#'’ specifier for details.

      -- C のマクロ: Py_DTSF_NO_NEG_0

          Negative zero is converted to positive zero.

          Added in version 3.11.

     If 'ptype' is non-‘NULL’, then the value it points to will be set
     to one of the following constants depending on the type of 'val':

     '*ptype'                                               type of 'val'
                                                            
     --------------------------------------------------------------------------------------------------------------
                                                            
      -- C のマクロ: Py_DTST_FINITE                         finite number
                                                            
                                                            
      -- C のマクロ: Py_DTST_INFINITE                       infinite number
                                                            
                                                            
      -- C のマクロ: Py_DTST_NAN                            not a number
                                                            

     戻り値は変換後の文字列が格納された 'buffer' へのポインタか、変換が
     失敗した場合は ‘NULL’ です。 呼び出し側は、返された文字列を *note
     PyMem_Free(): 165b. を使って解放する責任があります。

     Added in version 3.1.

 -- C の関数: int PyOS_mystricmp (const char *str1, const char *str2)
 -- C の関数: int PyOS_mystrnicmp (const char *str1, const char *str2,
          Py_ssize_t size)
     ' 次に属します: *note Stable ABI: 775.'  Case insensitive
     comparison of strings.  These functions work almost identically to
     ‘strcmp()’ and ‘strncmp()’ (respectively), except that they ignore
     the case of ASCII characters.

     Return ‘0’ if the strings are equal, a negative value if 'str1'
     sorts lexicographically before 'str2', or a positive value if it
     sorts after.

     In the 'str1' or 'str2' arguments, a NUL byte marks the end of the
     string.  For ‘PyOS_mystrnicmp()’, the 'size' argument gives the
     maximum size of the string, as if NUL was present at the index
     given by 'size'.

     These functions do not use the locale.

 -- C の関数: int PyOS_stricmp (const char *str1, const char *str2)
 -- C の関数: int PyOS_strnicmp (const char *str1, const char *str2,
          Py_ssize_t size)

     Case insensitive comparison of strings.

     On Windows, these are aliases of ‘stricmp()’ and ‘strnicmp()’,
     respectively.

     On other platforms, they are aliases of *note PyOS_mystricmp():
     1d3b. and *note PyOS_mystrnicmp(): 1d3a, respectively.

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/snprintf(3)

   (2) https://manpages.debian.org/vsnprintf(3)

   (3) https://manpages.debian.org/strtoul(3)

   (4) https://manpages.debian.org/strtol(3)


File: python.info,  Node: Character classification and conversion,  Next: PyHash API,  Prev: 文字列の変換と書式化,  Up: ユーティリティ<2>

7.7.8 Character classification and conversion
---------------------------------------------

The following macros provide locale-independent (unlike the C standard
library ‘ctype.h’) character classification and conversion.  The
argument must be a signed or unsigned char.

 -- C のマクロ: Py_ISALNUM (c)

     Return true if the character 'c' is an alphanumeric character.

 -- C のマクロ: Py_ISALPHA (c)

     Return true if the character 'c' is an alphabetic character (‘a-z’
     and ‘A-Z’).

 -- C のマクロ: Py_ISDIGIT (c)

     Return true if the character 'c' is a decimal digit (‘0-9’).

 -- C のマクロ: Py_ISLOWER (c)

     Return true if the character 'c' is a lowercase ASCII letter
     (‘a-z’).

 -- C のマクロ: Py_ISUPPER (c)

     Return true if the character 'c' is an uppercase ASCII letter
     (‘A-Z’).

 -- C のマクロ: Py_ISSPACE (c)

     Return true if the character 'c' is a whitespace character (space,
     tab, carriage return, newline, vertical tab, or form feed).

 -- C のマクロ: Py_ISXDIGIT (c)

     Return true if the character 'c' is a hexadecimal digit (‘0-9’,
     ‘a-f’, and ‘A-F’).

 -- C のマクロ: Py_TOLOWER (c)

     Return the lowercase equivalent of the character 'c'.

 -- C のマクロ: Py_TOUPPER (c)

     Return the uppercase equivalent of the character 'c'.


File: python.info,  Node: PyHash API,  Next: リフレクション,  Prev: Character classification and conversion,  Up: ユーティリティ<2>

7.7.9 PyHash API
----------------

*note PyTypeObject.tp_hash: 4ef6. メンバや *note 数値型のハッシュ化:
25fe. も参照してください。

 -- C のデータ型: type Py_hash_t

     ハッシュ値型: 符号付き整数。

     Added in version 3.2.

 -- C のデータ型: type Py_uhash_t

     ハッシュ値型: 符号なし整数。

     Added in version 3.2.

 -- C のマクロ: Py_HASH_ALGORITHM

     *note str: 169. 、 *note bytes: 192. や *note memoryview: 165. のハ
     ッシュ用アルゴリズムを示す数値型。

     アルゴリズム名は *note sys.hash_info.algorithm: 491d. により公開さ
     れます。

     Added in version 3.4.

 -- C のマクロ: Py_HASH_FNV
 -- C のマクロ: Py_HASH_SIPHASH24
 -- C のマクロ: Py_HASH_SIPHASH13

     Numerical values to compare to *note Py_HASH_ALGORITHM: 5255. to
     determine which algorithm is used for hashing.  The hash algorithm
     can be configured via the configure *note -with-hash-algorithm:
     21b6. option.

     Added in version 3.4: Add ‘Py_HASH_FNV’ and ‘Py_HASH_SIPHASH24’.

     Added in version 3.11: Add ‘Py_HASH_SIPHASH13’.

 -- C のマクロ: Py_HASH_CUTOFF

     Buffers of length in range ‘[1, Py_HASH_CUTOFF)’ are hashed using
     DJBX33A instead of the algorithm described by *note
     Py_HASH_ALGORITHM: 5255.

        - A ‘Py_HASH_CUTOFF’ of 0 disables the optimization.

        - ‘Py_HASH_CUTOFF’ must be non-negative and less or equal than
          7.

     32-bit platforms should use a cutoff smaller than 64-bit platforms
     because it is easier to create colliding strings.  A cutoff of 7 on
     64-bit platforms and 5 on 32-bit platforms should provide a decent
     safety margin.

     This corresponds to the *note sys.hash_info.cutoff: 4920. constant.

     Added in version 3.4.

 -- C のマクロ: PyHASH_MODULUS

     The Mersenne prime(1) ‘P = 2**n -1’, used for numeric hash scheme.

     This corresponds to the *note sys.hash_info.modulus: 25ff.
     constant.

     Added in version 3.13.

 -- C のマクロ: PyHASH_BITS

     The exponent ‘n’ of ‘P’ in *note PyHASH_MODULUS: 19e8.

     Added in version 3.13.

 -- C のマクロ: PyHASH_MULTIPLIER

     Prime multiplier used in string and various other hashes.

     Added in version 3.13.

 -- C のマクロ: PyHASH_INF

     The hash value returned for a positive infinity.

     This corresponds to the *note sys.hash_info.inf: 491a. constant.

     Added in version 3.13.

 -- C のマクロ: PyHASH_IMAG

     The multiplier used for the imaginary part of a complex number.

     This corresponds to the *note sys.hash_info.imag: 491c. constant.

     Added in version 3.13.

 -- C のデータ型: type PyHash_FuncDef

     Hash function definition used by *note PyHash_GetFuncDef(): 525b.

      -- C のメンバ変数: *note Py_hash_t: 147b. (*const hash)(const
               void*, *note Py_ssize_t: c55.)

          Hash function.

      -- C のメンバ変数: const char *name

          Hash function name (UTF-8 encoded string).

          This corresponds to the *note sys.hash_info.algorithm: 491d.
          constant.

      -- C のメンバ変数: const int hash_bits

          Internal size of the hash value in bits.

          This corresponds to the *note sys.hash_info.hash_bits: 491e.
          constant.

      -- C のメンバ変数: const int seed_bits

          Size of seed input in bits.

          This corresponds to the *note sys.hash_info.seed_bits: 491f.
          constant.

     Added in version 3.4.

 -- C の関数: *note PyHash_FuncDef: 525a. *PyHash_GetFuncDef (void)

     Get the hash function definition.

     参考
     ....

     PEP 456(2) "Secure and interchangeable hash algorithm".

     Added in version 3.4.

 -- C の関数: *note Py_hash_t: 147b. Py_HashPointer (const void *ptr)

     Hash a pointer value: process the pointer value as an integer (cast
     it to ‘uintptr_t’ internally).  The pointer is not dereferenced.

     The function cannot fail: it cannot return ‘-1’.

     Added in version 3.13.

 -- C の関数: *note Py_hash_t: 147b. Py_HashBuffer (const void *ptr,
          Py_ssize_t len)

     Compute and return the hash value of a buffer of 'len' bytes
     starting at address 'ptr'.  The hash is guaranteed to match that of
     *note bytes: 192, *note memoryview: 165, and other built-in objects
     that implement the *note buffer protocol: 260.

     Use this function to implement hashing for immutable objects whose
     *note tp_richcompare: 4ef0. function compares to another object's
     buffer.

     'len' must be greater than or equal to ‘0’.

     This function always succeeds.

     Added in version 3.14.

 -- C の関数: *note Py_hash_t: 147b. PyObject_GenericHash (PyObject
          *obj)

     Generic hashing function that is meant to be put into a type
     object's ‘tp_hash’ slot.  Its result only depends on the object's
     identity.

     'CPython 実装の詳細:' In CPython, it is equivalent to *note
     Py_HashPointer(): 425.

     Added in version 3.13.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Mersenne_prime

   (2) https://peps.python.org/pep-0456/


File: python.info,  Node: リフレクション,  Next: codec レジストリとサポート関数,  Prev: PyHash API,  Up: ユーティリティ<2>

7.7.10 リフレクション
---------------------

 -- C の関数: *note PyObject: 5df. *PyEval_GetBuiltins (void)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'

     バージョン 3.13 で非推奨: Use *note PyEval_GetFrameBuiltins(): 5f3.
     instead.

     現在の実行フレーム内のビルトインの辞書か、もし実行中のフレームがな
     ければスレッド状態のインタプリタのビルトイン辞書を返します。

 -- C の関数: *note PyObject: 5df. *PyEval_GetLocals (void)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'

     バージョン 3.13 で非推奨: Use either *note PyEval_GetFrameLocals():
     5f7. to obtain the same behaviour as calling *note locals(): 46f.
     in Python code, or else call *note PyFrame_GetLocals(): 661. on the
     result of *note PyEval_GetFrame(): 1b39. to access the *note
     f_locals: 4a5. attribute of the currently executing frame.

     Return a mapping providing access to the local variables in the
     current execution frame, or ‘NULL’ if no frame is currently
     executing.

     Refer to *note locals(): 46f. for details of the mapping returned
     at different scopes.

     As this function returns a *note borrowed reference: 3d7, the
     dictionary returned for *note optimized scopes: 4a1. is cached on
     the frame object and will remain alive as long as the frame object
     does.  Unlike *note PyEval_GetFrameLocals(): 5f7. and *note
     locals(): 46f, subsequent calls to this function in the same frame
     will update the contents of the cached dictionary to reflect
     changes in the state of the local variables rather than returning a
     new snapshot.

     バージョン 3.13 で変更: As part of PEP 667(1), *note
     PyFrame_GetLocals(): 661, *note locals(): 46f, and *note
     FrameType.f_locals: 4a5. no longer make use of the shared cache
     dictionary.  Refer to the *note What's New entry: 470. for
     additional details.

 -- C の関数: *note PyObject: 5df. *PyEval_GetGlobals (void)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'

     バージョン 3.13 で非推奨: Use *note PyEval_GetFrameGlobals(): 5f5.
     instead.

     現在の実行フレーム内のグローバル変数の辞書か、実行中のフレームがな
     ければ ‘NULL’ を返します。

 -- C の関数: *note PyFrameObject: 98c. *PyEval_GetFrame (void)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  Return
     the *note attached thread state: 4ed1.'s frame, which is ‘NULL’ if
     no frame is currently executing.

     See also *note PyThreadState_GetFrame(): 991.

 -- C の関数: *note PyObject: 5df. *PyEval_GetFrameBuiltins (void)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.13 より).'  現在の実行フレーム内のビルトインの辞書か、もし
     実行中のフレームがなければスレッド状態のインタプリタのビルトイン辞
     書を返します。

     Added in version 3.13.

 -- C の関数: *note PyObject: 5df. *PyEval_GetFrameLocals (void)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.13 より).'  Return a dictionary of the local variables in
     the current execution frame, or ‘NULL’ if no frame is currently
     executing.  Equivalent to calling *note locals(): 46f. in Python
     code.

     To access *note f_locals: 4a5. on the current frame without making
     an independent snapshot in *note optimized scopes: 4a1, call *note
     PyFrame_GetLocals(): 661. on the result of *note PyEval_GetFrame():
     1b39.

     Added in version 3.13.

 -- C の関数: *note PyObject: 5df. *PyEval_GetFrameGlobals (void)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.13 より).'  Return a dictionary of the global variables in
     the current execution frame, or ‘NULL’ if no frame is currently
     executing.  Equivalent to calling *note globals(): 1c0a. in Python
     code.

     Added in version 3.13.

 -- C の関数: const char *PyEval_GetFuncName (PyObject *func)
     ' 次に属します: *note Stable ABI: 775.'  'func' が関数、クラス、イ
     ンスタンスオブジェクトであればその名前を、そうでなければ 'func' の
     型を返します。

 -- C の関数: const char *PyEval_GetFuncDesc (PyObject *func)
     ' 次に属します: *note Stable ABI: 775.'  'func' の型に依存する、解
     説文字列(description string)を返します。戻り値は、関数とメソッドに
     対しては "()", " constructor", " instance", " object" です。 *note
     PyEval_GetFuncName(): 4fdd. と連結された結果、 'func' の解説になり
     ます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0667/


File: python.info,  Node: codec レジストリとサポート関数,  Next: PyTime C API,  Prev: リフレクション,  Up: ユーティリティ<2>

7.7.11 codec レジストリとサポート関数
-------------------------------------

 -- C の関数: int PyCodec_Register (PyObject *search_function)
     ' 次に属します: *note Stable ABI: 775.'  新しい codec 検索関数を登
     録します。

     As a side effect, this tries to load the ‘encodings’ package, if
     not yet done, to make sure that it is always first in the list of
     search functions.

 -- C の関数: int PyCodec_Unregister (PyObject *search_function)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'  コ
     ーデック検索関数の登録を解除し、レジストリのキャッシュをクリアしま
     す。 検索関数が登録されていない場合は何もしません。 成功したら0を返
     します。 エラーの場合は例外を送出させ、-1を返します。

     Added in version 3.10.

 -- C の関数: int PyCodec_KnownEncoding (const char *encoding)
     ' 次に属します: *note Stable ABI: 775.'  'encoding' のための登録さ
     れた codec が存在するかどうかに応じて ‘1’ か ‘0’ を返します。 この
     関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyCodec_Encode (PyObject *object,
          const char *encoding, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  汎用
     の codec ベースの encode API.

     'encoding' に応じて見つかったエンコーダ関数に対して 'object' を渡し
     ます。 エラーハンドリングメソッドは 'errors' で指定します。
     'errors' は ‘NULL’ でもよく、その場合はその codec のデフォルトのメ
     ソッドが利用されます。 エンコーダが見つからなかった場合は *note
     LookupError: 23e5. を発生させます。

 -- C の関数: *note PyObject: 5df. *PyCodec_Decode (PyObject *object,
          const char *encoding, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  汎用
     の codec ベースのデコード API.

     'object' is passed through the decoder function found for the given
     'encoding' using the error handling method defined by 'errors'.
     'errors' may be ‘NULL’ to use the default method defined for the
     codec.  Raises a *note LookupError: 23e5. if no decoder can be
     found.

* Menu:

* コーデック検索API::
* Unicode エラーハンドラ用レジストリ API::
* Codec utility variables::


File: python.info,  Node: コーデック検索API,  Next: Unicode エラーハンドラ用レジストリ API,  Up: codec レジストリとサポート関数

7.7.11.1 コーデック検索API
..........................

次の関数では、文字列 'encoding' は全て小文字に変換することで、効率的に、
大文字小文字を無視した検索をします。 コーデックが見つからない場合、
*note KeyError: 5e7. を設定して ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyCodec_Encoder (const char
          *encoding)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  与え
     られた 'encoding' のエンコーダ関数を返します。

 -- C の関数: *note PyObject: 5df. *PyCodec_Decoder (const char
          *encoding)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  与え
     られた 'encoding' のデコーダ関数を返します。

 -- C の関数: *note PyObject: 5df. *PyCodec_IncrementalEncoder (const
          char *encoding, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  与え
     られた 'encoding' の *note IncrementalEncoder: 2836. オブジェクトを
     返します。

 -- C の関数: *note PyObject: 5df. *PyCodec_IncrementalDecoder (const
          char *encoding, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  与え
     られた 'encoding' の *note IncrementalDecoder: 2837. オブジェクトを
     返します。

 -- C の関数: *note PyObject: 5df. *PyCodec_StreamReader (const char
          *encoding, PyObject *stream, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  与え
     られた 'encoding' の *note StreamReader: 283b. ファクトリ関数を返し
     ます。

 -- C の関数: *note PyObject: 5df. *PyCodec_StreamWriter (const char
          *encoding, PyObject *stream, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  与え
     られた 'encoding' の *note StreamWriter: 283a. ファクトリ関数を返し
     ます。


File: python.info,  Node: Unicode エラーハンドラ用レジストリ API,  Next: Codec utility variables,  Prev: コーデック検索API,  Up: codec レジストリとサポート関数

7.7.11.2 Unicode エラーハンドラ用レジストリ API
...............................................

 -- C の関数: int PyCodec_RegisterError (const char *name, PyObject
          *error)
     ' 次に属します: *note Stable ABI: 775.'  エラーハンドルのためのコー
     ルバック関数 'error' を 'name' で登録します。このコールバック関数は
     、コーデックがエンコードできない文字/デコードできないバイトに遭遇し
     た時に、そのエンコード/デコード関数の呼び出しで 'name' が指定されて
     いたら呼び出されます。

     コールバックは1つの引数として、 *note UnicodeEncodeError: 887,
     *note UnicodeDecodeError: c08, *note UnicodeTranslateError: 18fd. の
     どれかのインスタンスを受け取ります。このインスタンスは問題のある文
     字列やバイト列に関する情報と、その元の文字列中のオフセットを持って
     います。(その情報を取得するための関数については *note Unicode
     例外オブジェクト: 461. を参照してください。) コールバックは渡された
     例外を発生させるか、2要素のタプルに問題のシーケンスの代替と、
     encode/decode を再開する元の文字列中のオフセットとなる整数を格納し
     て返します。

     成功したら ‘0’ を、エラー時は ‘-1’ を返します。

 -- C の関数: *note PyObject: 5df. *PyCodec_LookupError (const char
          *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'name' で登録されたエラーハンドリングコールバック関数を検索します。
     特別な場合として、‘NULL’ が渡された場合、"strict" のエラーハンドリ
     ングコールバック関数を返します。

 -- C の関数: *note PyObject: 5df. *PyCodec_StrictErrors (PyObject *exc)
     '戻り値: 常に NULL 。'' 次に属します: *note Stable ABI: 775.'
     'exc' を例外として発生させます。

 -- C の関数: *note PyObject: 5df. *PyCodec_IgnoreErrors (PyObject *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     unicode エラーを無視し、問題の入力をスキップします。

 -- C の関数: *note PyObject: 5df. *PyCodec_ReplaceErrors (PyObject
          *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     unicode エラーを ‘?’ か ‘U+FFFD’ で置き換えます。

 -- C の関数: *note PyObject: 5df. *PyCodec_XMLCharRefReplaceErrors
          (PyObject *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     unicode encode エラーを XML文字参照で置き換えます。

 -- C の関数: *note PyObject: 5df. *PyCodec_BackslashReplaceErrors
          (PyObject *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     unicode encode エラーをバックスラッシュエスケープ (‘\x’, ‘\u’,
     ‘\U’) で置き換えます。

 -- C の関数: *note PyObject: 5df. *PyCodec_NameReplaceErrors (PyObject
          *exc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'  unicode encode エラーを ‘\N{...}’ で置き換えま
     す。

     Added in version 3.5.


File: python.info,  Node: Codec utility variables,  Prev: Unicode エラーハンドラ用レジストリ API,  Up: codec レジストリとサポート関数

7.7.11.3 Codec utility variables
................................

 -- C 変数: const char *Py_hexdigits

     A string constant containing the lowercase hexadecimal digits:
     ‘"0123456789abcdef"’.

     Added in version 3.3.


File: python.info,  Node: PyTime C API,  Next: Support for Perf Maps,  Prev: codec レジストリとサポート関数,  Up: ユーティリティ<2>

7.7.12 PyTime C API
-------------------

Added in version 3.13.

クロック C API は、システムクロックへのアクセスを提供します。これは
Python の *note time: f4. モジュールに似ています。

*note datetime: 34. モジュールに関連する C API については、*note
DateTime オブジェクト: 526d. を参照してください。

* Menu:

* 型: 型<3>.
* Clock Functions::
* Raw Clock Functions::
* Conversion functions::


File: python.info,  Node: 型<3>,  Next: Clock Functions,  Up: PyTime C API

7.7.12.1 型
...........

 -- C のデータ型: type PyTime_t

     A timestamp or duration in nanoseconds, represented as a signed
     64-bit integer.

     The reference point for timestamps depends on the clock used.  For
     example, *note PyTime_Time(): 5db. returns timestamps relative to
     the UNIX epoch.

     The supported range is around [-292.3 years; +292.3 years].  Using
     the Unix epoch (January 1st, 1970) as reference, the supported date
     range is around [1677-09-21; 2262-04-11].  The exact limits are
     exposed as constants:

 -- C 変数: *note PyTime_t: 5d3. PyTime_MIN

     Minimum value of *note PyTime_t: 5d3.

 -- C 変数: *note PyTime_t: 5d3. PyTime_MAX

     Maximum value of *note PyTime_t: 5d3.


File: python.info,  Node: Clock Functions,  Next: Raw Clock Functions,  Prev: 型<3>,  Up: PyTime C API

7.7.12.2 Clock Functions
........................

The following functions take a pointer to a *note PyTime_t: 5d3. that
they set to the value of a particular clock.  Details of each clock are
given in the documentation of the corresponding Python function.

The functions return ‘0’ on success, or ‘-1’ (with an exception set) on
failure.

On integer overflow, they set the *note PyExc_OverflowError: 5006.
exception and set ‘*result’ to the value clamped to the ‘[PyTime_MIN;
PyTime_MAX]’ range.  (On current systems, integer overflows are likely
caused by misconfigured system time.)

As any other C API (unless otherwise specified), the functions must be
called with an *note attached thread state: 4ed1.

 -- C の関数: int PyTime_Monotonic (PyTime_t *result)

     Read the monotonic clock.  See *note time.monotonic(): 55c. for
     important details on this clock.

 -- C の関数: int PyTime_PerfCounter (PyTime_t *result)

     Read the performance counter.  See *note time.perf_counter(): c7a.
     for important details on this clock.

 -- C の関数: int PyTime_Time (PyTime_t *result)

     Read the “wall clock” time.  See *note time.time(): 55d. for
     details important on this clock.


File: python.info,  Node: Raw Clock Functions,  Next: Conversion functions,  Prev: Clock Functions,  Up: PyTime C API

7.7.12.3 Raw Clock Functions
............................

Similar to clock functions, but don't set an exception on error and
don't require the caller to have an *note attached thread state: 4ed1.

On success, the functions return ‘0’.

On failure, they set ‘*result’ to ‘0’ and return ‘-1’, 'without' setting
an exception.  To get the cause of the error, *note attach: 4ed1. a
*note thread state: 1846, and call the regular (non-‘Raw’) function.
Note that the regular function may succeed after the ‘Raw’ one failed.

 -- C の関数: int PyTime_MonotonicRaw (PyTime_t *result)

     Similar to *note PyTime_Monotonic(): 5d7, but don't set an
     exception on error and don't require an *note attached thread
     state: 4ed1.

 -- C の関数: int PyTime_PerfCounterRaw (PyTime_t *result)

     Similar to *note PyTime_PerfCounter(): 5d9, but don't set an
     exception on error and don't require an *note attached thread
     state: 4ed1.

 -- C の関数: int PyTime_TimeRaw (PyTime_t *result)

     Similar to *note PyTime_Time(): 5db, but don't set an exception on
     error and don't require an *note attached thread state: 4ed1.


File: python.info,  Node: Conversion functions,  Prev: Raw Clock Functions,  Up: PyTime C API

7.7.12.4 Conversion functions
.............................

 -- C の関数: double PyTime_AsSecondsDouble (PyTime_t t)

     Convert a timestamp to a number of seconds as a C double.

     The function cannot fail, but note that double has limited accuracy
     for large values.


File: python.info,  Node: Support for Perf Maps,  Prev: PyTime C API,  Up: ユーティリティ<2>

7.7.13 Support for Perf Maps
----------------------------

On supported platforms (as of this writing, only Linux), the runtime can
take advantage of 'perf map files' to make Python functions visible to
an external profiling tool (such as perf(1)).  A running process may
create a file in the ‘/tmp’ directory, which contains entries that can
map a section of executable code to a name.  This interface is described
in the documentation of the Linux Perf tool(2).

In Python, these helper APIs can be used by libraries and features that
rely on generating machine code on the fly.

Note that holding an *note attached thread state: 4ed1. is not required
for these APIs.

 -- C の関数: int PyUnstable_PerfMapState_Init (void)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Open the ‘/tmp/perf-$pid.map’ file, unless it's already opened, and
     create a lock to ensure thread-safe writes to the file (provided
     the writes are done through *note PyUnstable_WritePerfMapEntry():
     1aa9.).  Normally, there's no need to call this explicitly; just
     use *note PyUnstable_WritePerfMapEntry(): 1aa9. and it will
     initialize the state on first call.

     Returns ‘0’ on success, ‘-1’ on failure to create/open the perf map
     file, or ‘-2’ on failure to create a lock.  Check ‘errno’ for more
     information about the cause of a failure.

 -- C の関数: int PyUnstable_WritePerfMapEntry (const void *code_addr,
          unsigned int code_size, const char *entry_name)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Write one single entry to the ‘/tmp/perf-$pid.map’ file.  This
     function is thread safe.  Here is what an example entry looks like:

          # address      size  name
          7f3529fcf759 b     py::bar:/run/t.py

     Will call *note PyUnstable_PerfMapState_Init(): 1aaa. before
     writing the entry, if the perf map file is not already opened.
     Returns ‘0’ on success, or the same error codes as *note
     PyUnstable_PerfMapState_Init(): 1aaa. on failure.

 -- C の関数: void PyUnstable_PerfMapState_Fini (void)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Close the perf map file opened by *note
     PyUnstable_PerfMapState_Init(): 1aaa.  This is called by the
     runtime itself during interpreter shut-down.  In general, there
     shouldn't be a reason to explicitly call this, except to handle
     specific scenarios such as forking.

   ---------- Footnotes ----------

   (1) https://perf.wiki.kernel.org/index.php/Main_Page

   (2) 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/Documentation/jit-interface.txt


File: python.info,  Node: 抽象オブジェクトレイヤ Abstract Objects Layer,  Next: 具象オブジェクト concrete object レイヤ,  Prev: ユーティリティ<2>,  Up: Python/C API リファレンスマニュアル

7.8 抽象オブジェクトレイヤ (Abstract Objects Layer)
===================================================

この章で説明する関数は、オブジェクトの型に依存しないような Python オブジ
ェクトの操作や、(数値型全て、シーケンス型全てといった) 大まかな型のオブ
ジェクトに対する操作を行ないます。関数を適用対象でないオブジェクトに対し
て使った場合、Python の例外が送出されることになります。

これらの関数は、 *note PyList_New(): 4f49. で作成された後に ‘NULL’ 以外
の値を設定されていないリストのような、適切に初期化されていないオブジェク
トに対して使うことはできません。

* Menu:

* オブジェクトプロトコル (object protocol): オブジェクトプロトコル object protocol.
* Call プロトコル::
* 数値型プロトコル (number protocol): 数値型プロトコル number protocol.
* シーケンス型プロトコル (sequence protocol): シーケンス型プロトコル sequence protocol.
* マップ型プロトコル (mapping protocol): マップ型プロトコル mapping protocol.
* イテレータプロトコル (iterator protocol): イテレータプロトコル iterator protocol.
* バッファプロトコル (buffer Protocol): バッファプロトコル buffer Protocol.


File: python.info,  Node: オブジェクトプロトコル object protocol,  Next: Call プロトコル,  Up: 抽象オブジェクトレイヤ Abstract Objects Layer

7.8.1 オブジェクトプロトコル (object protocol)
----------------------------------------------

 -- C の関数: *note PyObject: 5df. *Py_GetConstant (unsigned int
          constant_id)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Get a *note strong reference: 5e2. to a constant.

     Set an exception and return ‘NULL’ if 'constant_id' is invalid.

     'constant_id' must be one of these constant identifiers:

     Constant Identifier                          値        Returned object
                                                            
     -------------------------------------------------------------------------------------
                                                            
      -- C のマクロ: Py_CONSTANT_NONE             ‘0’       *note None: 885.
                                                            
                                                            
      -- C のマクロ: Py_CONSTANT_FALSE            ‘1’       *note False: d2b.
                                                            
                                                            
      -- C のマクロ: Py_CONSTANT_TRUE             ‘2’       *note True: e07.
                                                            
                                                            
      -- C のマクロ: Py_CONSTANT_ELLIPSIS         ‘3’       *note Ellipsis: 2328.
                                                            
                                                            
      -- C のマクロ:                              ‘4’       *note NotImplemented: 1a2.
               Py_CONSTANT_NOT_IMPLEMENTED                  

      -- C のマクロ: Py_CONSTANT_ZERO             ‘5’       ‘0’
                                                            
                                                            
      -- C のマクロ: Py_CONSTANT_ONE              ‘6’       ‘1’
                                                            
                                                            
      -- C のマクロ: Py_CONSTANT_EMPTY_STR        ‘7’       ‘''’
                                                            
                                                            
      -- C のマクロ: Py_CONSTANT_EMPTY_BYTES      ‘8’       ‘b''’
                                                            
                                                            
      -- C のマクロ: Py_CONSTANT_EMPTY_TUPLE      ‘9’       ‘()’
                                                            

     Numeric values are only given for projects which cannot use the
     constant identifiers.

     Added in version 3.13.

     'CPython 実装の詳細:' In CPython, all of these constants are *note
     immortal: 290.

 -- C の関数: *note PyObject: 5df. *Py_GetConstantBorrowed (unsigned int
          constant_id)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Similar to *note Py_GetConstant(): 5f9, but return a *note borrowed
     reference: 3d7.

     This function is primarily intended for backwards compatibility:
     using *note Py_GetConstant(): 5f9. is recommended for new code.

     The reference is borrowed from the interpreter, and is valid until
     the interpreter finalization.

     Added in version 3.13.

 -- C 変数: *note PyObject: 5df. *Py_NotImplemented

     与えられたオブジェクトとメソッドの引数の型の組み合わせの処理が未実
     装である印として使われる、 ‘未実装 (NotImplemented)’ シングルトン。

 -- C のマクロ: Py_RETURN_NOTIMPLEMENTED

     Properly handle returning *note Py_NotImplemented: 5286. from
     within a C function (that is, create a new *note strong reference:
     5e2. to *note NotImplemented: 1a2. and return it).

 -- C のマクロ: Py_PRINT_RAW

     Flag to be used with multiple functions that print the object (like
     *note PyObject_Print(): 198b. and *note PyFile_WriteObject():
     5026.).  If passed, these functions use the *note str(): 169. of
     the object instead of the *note repr(): 1c1.

 -- C の関数: int PyObject_Print (PyObject *o, FILE *fp, int flags)

     Print an object 'o', on file 'fp'.  Returns ‘-1’ on error.  The
     flags argument is used to enable certain printing options.  The
     only option currently supported is *note Py_PRINT_RAW: 5287.; if
     given, the *note str(): 169. of the object is written instead of
     the *note repr(): 1c1.

 -- C の関数: int PyObject_HasAttrWithError (PyObject *o, PyObject
          *attr_name)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Returns ‘1’ if 'o' has the attribute 'attr_name', and ‘0’
     otherwise.  This is equivalent to the Python expression ‘hasattr(o,
     attr_name)’.  On failure, return ‘-1’.

     Added in version 3.13.

 -- C の関数: int PyObject_HasAttrStringWithError (PyObject *o, const
          char *attr_name)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     This is the same as *note PyObject_HasAttrWithError(): 61b, but
     'attr_name' is specified as a const char* UTF-8 encoded bytes
     string, rather than a *note PyObject: 5df.*.

     Added in version 3.13.

 -- C の関数: int PyObject_HasAttr (PyObject *o, PyObject *attr_name)
     ' 次に属します: *note Stable ABI: 775.'  Returns ‘1’ if 'o' has the
     attribute 'attr_name', and ‘0’ otherwise.  This function always
     succeeds.

          注釈: Exceptions that occur when this calls *note
          __getattr__(): 6fa. and *note __getattribute__(): dcb. methods
          aren't propagated, but instead given to *note
          sys.unraisablehook(): 507.  For proper error handling, use
          *note PyObject_HasAttrWithError(): 61b, *note
          PyObject_GetOptionalAttr(): 5ec. or *note PyObject_GetAttr():
          5ee. instead.

 -- C の関数: int PyObject_HasAttrString (PyObject *o, const char
          *attr_name)
     ' 次に属します: *note Stable ABI: 775.'  This is the same as *note
     PyObject_HasAttr(): 61c, but 'attr_name' is specified as a const
     char* UTF-8 encoded bytes string, rather than a *note PyObject:
     5df.*.

          注釈: Exceptions that occur when this calls *note
          __getattr__(): 6fa. and *note __getattribute__(): dcb. methods
          or while creating the temporary *note str: 169. object are
          silently ignored.  For proper error handling, use *note
          PyObject_HasAttrStringWithError(): 61d, *note
          PyObject_GetOptionalAttrString(): 5ed. or *note
          PyObject_GetAttrString(): 5ef. instead.

 -- C の関数: *note PyObject: 5df. *PyObject_GetAttr (PyObject *o,
          PyObject *attr_name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  オブ
     ジェクト 'o' から、名前 'attr_name' の属性を取得します。成功すると
     属性値を返し失敗すると ‘NULL’ を返します。この関数は Python の式
     ‘o.attr_name’ と同じです。

     If the missing attribute should not be treated as a failure, you
     can use *note PyObject_GetOptionalAttr(): 5ec. instead.

 -- C の関数: *note PyObject: 5df. *PyObject_GetAttrString (PyObject *o,
          const char *attr_name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  This
     is the same as *note PyObject_GetAttr(): 5ee, but 'attr_name' is
     specified as a const char* UTF-8 encoded bytes string, rather than
     a *note PyObject: 5df.*.

     If the missing attribute should not be treated as a failure, you
     can use *note PyObject_GetOptionalAttrString(): 5ed. instead.

 -- C の関数: int PyObject_GetOptionalAttr (PyObject *obj, PyObject
          *attr_name, PyObject **result);
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Variant of *note PyObject_GetAttr(): 5ee. which doesn't raise *note
     AttributeError: 5f0. if the attribute is not found.

     If the attribute is found, return ‘1’ and set '*result' to a new
     *note strong reference: 5e2. to the attribute.  If the attribute is
     not found, return ‘0’ and set '*result' to ‘NULL’; the *note
     AttributeError: 5f0. is silenced.  If an error other than *note
     AttributeError: 5f0. is raised, return ‘-1’ and set '*result' to
     ‘NULL’.

     Added in version 3.13.

 -- C の関数: int PyObject_GetOptionalAttrString (PyObject *obj, const
          char *attr_name, PyObject **result);
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     This is the same as *note PyObject_GetOptionalAttr(): 5ec, but
     'attr_name' is specified as a const char* UTF-8 encoded bytes
     string, rather than a *note PyObject: 5df.*.

     Added in version 3.13.

 -- C の関数: *note PyObject: 5df. *PyObject_GenericGetAttr (PyObject
          *o, PyObject *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  型オ
     ブジェクトの ‘tp_getattro’ スロットに置かれる、属性を取得する総称的
     な関数です。この関数は、 (もし存在すれば) オブジェクトの属性 *note
     __dict__: 77d. に加え、オブジェクトの MRO にあるクラスの辞書にある
     デスクリプタを探します。 *note デスクリプタ (descriptor) の実装:
     e49. で概要が述べられている通り、データのデスクリプタはインスタンス
     の属性より優先され、非データデスクリプタは後回しにされます。見付か
     らなかった場合は *note AttributeError: 5f0. を送出します。

 -- C の関数: int PyObject_SetAttr (PyObject *o, PyObject *attr_name,
          PyObject *v)
     ' 次に属します: *note Stable ABI: 775.'  オブジェクト 'o' の
     'attr_name' という名の属性に、値 'v' を設定します。 失敗すると例外
     を送出し ‘-1’ を返します; 成功すると ‘0’ を返します。 この関数は
     Python の式 ‘o.attr_name = v’ と同じです。

     'v' が ‘NULL’ のとき、アトリビュートは削除されます。この動作は
     *note PyObject_DelAttr(): 1831. のため、非推奨となっていますが、削
     除される予定はありません。

 -- C の関数: int PyObject_SetAttrString (PyObject *o, const char
          *attr_name, PyObject *v)
     ' 次に属します: *note Stable ABI: 775.'  This is the same as *note
     PyObject_SetAttr(): 5097, but 'attr_name' is specified as a const
     char* UTF-8 encoded bytes string, rather than a *note PyObject:
     5df.*.

     'v' が ‘NULL’ の場合は属性が削除されますが、この機能は非推奨であり
     *note PyObject_DelAttrString(): 1832. を使うのが望ましいです。

     The number of different attribute names passed to this function
     should be kept small, usually by using a statically allocated
     string as 'attr_name'.  For attribute names that aren't known at
     compile time, prefer calling *note PyUnicode_FromString(): 5112.
     and *note PyObject_SetAttr(): 5097. directly.  For more details,
     see *note PyUnicode_InternFromString(): 198c, which may be used
     internally to create a key object.

 -- C の関数: int PyObject_GenericSetAttr (PyObject *o, PyObject *name,
          PyObject *value)
     ' 次に属します: *note Stable ABI: 775.'  属性の設定と削除を行う汎用
     的な関数で、型オブジェクトの *note tp_setattro: 4ee8. スロットに置
     かれます。 オブジェクトの MRO にあるクラスの辞書からデータディスク
     リプタを探し、見付かった場合はインスタンスの辞書にある属性の設定や
     削除よりも優先されます。 そうでない場合は、(もし存在すれば) オブジ
     ェクトの *note __dict__: 77d. に属性を設定もしくは削除します。 成功
     すると ‘0’ が返され、そうでない場合は *note AttributeError: 5f0. が
     送出され ‘-1’ が返されます。

 -- C の関数: int PyObject_DelAttr (PyObject *o, PyObject *attr_name)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'  オ
     ブジェクト 'o' の 'attr_name' という名の属性を削除します。失敗する
     と ‘-1’ を返します。この関数は Python の文 ‘del o.attr_name’ と同じ
     です。

 -- C の関数: int PyObject_DelAttrString (PyObject *o, const char
          *attr_name)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     This is the same as *note PyObject_DelAttr(): 1831, but 'attr_name'
     is specified as a const char* UTF-8 encoded bytes string, rather
     than a *note PyObject: 5df.*.

     The number of different attribute names passed to this function
     should be kept small, usually by using a statically allocated
     string as 'attr_name'.  For attribute names that aren't known at
     compile time, prefer calling *note PyUnicode_FromString(): 5112.
     and *note PyObject_DelAttr(): 1831. directly.  For more details,
     see *note PyUnicode_InternFromString(): 198c, which may be used
     internally to create a key object for lookup.

 -- C の関数: *note PyObject: 5df. *PyObject_GenericGetDict (PyObject
          *o, void *context)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.10 より).'  ‘__dict__’ デスクリプタの getter の総称的な実
     装です。必要な場合は、辞書を作成します。

     This function may also be called to get the *note __dict__: 77d. of
     the object 'o'.  Pass ‘NULL’ for 'context' when calling it.  Since
     this function may need to allocate memory for the dictionary, it
     may be more efficient to call *note PyObject_GetAttr(): 5ee. when
     accessing an attribute on the object.

     On failure, returns ‘NULL’ with an exception set.

     Added in version 3.3.

 -- C の関数: int PyObject_GenericSetDict (PyObject *o, PyObject *value,
          void *context)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     ‘__dict__’ デスクリプタの setter の総称的な実装です。この実装では辞
     書を削除することは許されていません。

     Added in version 3.3.

 -- C の関数: *note PyObject: 5df. **_PyObject_GetDictPtr (PyObject
          *obj)

     Return a pointer to *note __dict__: 77d. of the object 'obj'.  If
     there is no ‘__dict__’, return ‘NULL’ without setting an exception.

     This function may need to allocate memory for the dictionary, so it
     may be more efficient to call *note PyObject_GetAttr(): 5ee. when
     accessing an attribute on the object.

 -- C の関数: *note PyObject: 5df. *PyObject_RichCompare (PyObject *o1,
          PyObject *o2, int opid)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Compare the values of 'o1' and 'o2' using the operation specified
     by 'opid', which must be one of *note Py_LT: 5289, *note Py_LE:
     528a, *note Py_EQ: 528b, *note Py_NE: 528c, *note Py_GT: 528d, or
     *note Py_GE: 528e, corresponding to ‘<’, ‘<=’, ‘==’, ‘!=’, ‘>’, or
     ‘>=’ respectively.  This is the equivalent of the Python expression
     ‘o1 op o2’, where ‘op’ is the operator corresponding to 'opid'.
     Returns the value of the comparison on success, or ‘NULL’ on
     failure.

 -- C の関数: int PyObject_RichCompareBool (PyObject *o1, PyObject *o2,
          int opid)
     ' 次に属します: *note Stable ABI: 775.'  Compare the values of 'o1'
     and 'o2' using the operation specified by 'opid', like *note
     PyObject_RichCompare(): 4ef1, but returns ‘-1’ on error, ‘0’ if the
     result is false, ‘1’ otherwise.

     注釈: If 'o1' and 'o2' are the same object, *note
     PyObject_RichCompareBool(): 1d8c. will always return ‘1’ for *note
     Py_EQ: 528b. and ‘0’ for *note Py_NE: 528c.

 -- C の関数: *note PyObject: 5df. *PyObject_Format (PyObject *obj,
          PyObject *format_spec)
     ' 次に属します: *note Stable ABI: 775.'  Format 'obj' using
     'format_spec'.  This is equivalent to the Python expression
     ‘format(obj, format_spec)’.

     'format_spec' may be ‘NULL’.  In this case the call is equivalent
     to ‘format(obj)’.  Returns the formatted string on success, ‘NULL’
     on failure.

 -- C の関数: *note PyObject: 5df. *PyObject_Repr (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     オブジェクト 'o' の文字列表現を計算します。成功すると文字列表現を返
     し、失敗すると ‘NULL’ を返します。 Python 式 ‘repr(o)’ と同じです。
     この関数は組み込み関数 *note repr(): 1c1. の処理で呼び出されます。

     バージョン 3.4 で変更: アクティブな例外を黙って捨てないことを保証す
     るのに便利なように、この関数はデバッグアサーションを含むようになり
     ました。

 -- C の関数: *note PyObject: 5df. *PyObject_ASCII (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     *note PyObject_Repr(): 1230. と同様、オブジェクト 'o' の文字列表現
     を計算しますが、 *note PyObject_Repr(): 1230. によって返された文字
     列に含まれる非 ASCII 文字を、エスケープ文字 ‘\x’ 、 ‘\u’ 、 ‘\U’ で
     エスケープします。この関数は Pythoh 2 の *note PyObject_Repr():
     1230. が返す文字列と同じ文字列を生成します。 *note ascii(): 15ff. に
     よって呼び出されます。

 -- C の関数: *note PyObject: 5df. *PyObject_Str (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  オブ
     ジェクト 'o' の文字列表現を計算します。成功すると文字列表現を返し、
     失敗すると ‘NULL’ を返します。 Python 式 ‘str(o)’ と同じです。この
     関数は組み込み関数 *note str(): 169. や、 *note print(): 1177. 関数
     の処理で呼び出されます。

     バージョン 3.4 で変更: アクティブな例外を黙って捨てないことを保証す
     るのに便利なように、この関数はデバッグアサーションを含むようになり
     ました。

 -- C の関数: *note PyObject: 5df. *PyObject_Bytes (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     オブジェクト 'o' のバイト列表現を計算します。失敗すると ‘NULL’ を返
     し、成功すると bytes オブジェクトを返します。 'o' が整数でないとき
     の、 Python 式 ‘bytes(o)’ と同じです。 ‘bytes(o)’ と違って、 'o' が
     整数のときには、ゼロで初期化された bytes オブジェクトを返すのではな
     く TypeError が送出されます。

 -- C の関数: int PyObject_IsSubclass (PyObject *derived, PyObject *cls)
     ' 次に属します: *note Stable ABI: 775.'  クラス 'derived' がクラス
     'cls' と同一であるか、そこから派生したクラスである場合は ‘1’ を返し
     、そうでない場合は ‘0’ を返します。 エラーが起きた場合は ‘-1’ を返
     します。

     'cls' がタプルの場合、 'cls' の全ての要素に対してチェックします。 少
     なくとも1つのチェックで ‘1’ が返ったとき、結果は ‘1’ となり、それ以
     外のとき ‘0’ になります。

     If 'cls' has a *note __subclasscheck__(): 23c7. method, it will be
     called to determine the subclass status as described in PEP
     3119(1).  Otherwise, 'derived' is a subclass of 'cls' if it is a
     direct or indirect subclass, i.e.  contained in *note cls.__mro__:
     2378.

     Normally only class objects, i.e.  instances of *note type: f44. or
     a derived class, are considered classes.  However, objects can
     override this by having a *note __bases__: 16c5. attribute (which
     must be a tuple of base classes).

 -- C の関数: int PyObject_IsInstance (PyObject *inst, PyObject *cls)
     ' 次に属します: *note Stable ABI: 775.'  'inst' がクラス 'cls' もし
     くは 'cls' の子クラスのインスタンスである場合に ‘1’ を返し、そうで
     ない場合に ‘0’ を返します。 エラーが起きると ‘-1’ を返し例外を設定
     します。

     'cls' がタプルの場合、 'cls' の全ての要素に対してチェックします。 少
     なくとも1つのチェックで ‘1’ が返ったとき、結果は ‘1’ となり、それ以
     外のとき ‘0’ になります。

     If 'cls' has a *note __instancecheck__(): 23c6. method, it will be
     called to determine the subclass status as described in PEP
     3119(2).  Otherwise, 'inst' is an instance of 'cls' if its class is
     a subclass of 'cls'.

     An instance 'inst' can override what is considered its class by
     having a *note __class__: 16c6. attribute.

     An object 'cls' can override if it is considered a class, and what
     its base classes are, by having a *note __bases__: 16c5. attribute
     (which must be a tuple of base classes).

 -- C の関数: *note Py_hash_t: 147b. PyObject_Hash (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'

     オブジェクト 'o' のハッシュ値を計算して返します。失敗すると ‘-1’ を
     返します。 Python の式 ‘hash(o)’ と同じです。

     バージョン 3.2 で変更: 返り値の型が Py_hash_t になりました。この型
     は、 *note Py_ssize_t: c55. と同じサイズをもつ符号付き整数です。

 -- C の関数: *note Py_hash_t: 147b. PyObject_HashNotImplemented
          (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'  Set a *note TypeError:
     198. indicating that ‘type(o)’ is not *note hashable: 824. and
     return ‘-1’.  This function receives special treatment when stored
     in a ‘tp_hash’ slot, allowing a type to explicitly indicate to the
     interpreter that it is not hashable.

 -- C の関数: int PyObject_IsTrue (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'  'o' が真を表すとみなせる場
     合には ‘1’ を、そうでないときには ‘0’ を返します。 Python の式 ‘not
     not o’ と同じです。失敗すると ‘-1’ を返します。

 -- C の関数: int PyObject_Not (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'  'o' が真を表すとみなせる場
     合には ‘0’ を、そうでないときには ‘1’ を返します。 Python の式 ‘not
     o’ と同じです。失敗すると ‘-1’ を返します。

 -- C の関数: *note PyObject: 5df. *PyObject_Type (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     When 'o' is non-‘NULL’, returns a type object corresponding to the
     object type of object 'o'.  On failure, raises *note SystemError:
     795. and returns ‘NULL’.  This is equivalent to the Python
     expression ‘type(o)’.  This function creates a new *note strong
     reference: 5e2. to the return value.  There's really no reason to
     use this function instead of the *note Py_TYPE(): 3c9. function,
     which returns a pointer of type *note PyTypeObject: c9c.*, except
     when a new *note strong reference: 5e2. is needed.

 -- C の関数: int PyObject_TypeCheck (PyObject *o, PyTypeObject *type)

     Return non-zero if the object 'o' is of type 'type' or a subtype of
     'type', and ‘0’ otherwise.  Both parameters must be non-‘NULL’.

 -- C の関数: *note Py_ssize_t: c55. PyObject_Size (PyObject *o)
 -- C の関数: *note Py_ssize_t: c55. PyObject_Length (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'

     'o' の長さを返します。ただしオブジェクト 'o' がシーケンス型プロトコ
     ルとマップ型プロトコルの両方を提供している場合、シーケンスとしての
     長さを返します。エラーが生じると ‘-1’ を返します。 Python の式
     ‘len(o)’ と同じです。

 -- C の関数: *note Py_ssize_t: c55. PyObject_LengthHint (PyObject *o,
          Py_ssize_t defaultvalue)

     オブジェクト 'o' の概算の長さを返します。 最初に実際の長さを、次に
     *note __length_hint__(): 110f. を使って概算の長さを、そして最後にデ
     フォルトの値を返そうとします。 この関数は Python の式
     ‘operator.length_hint(o, defaultvalue)’ と同じです。

     Added in version 3.4.

 -- C の関数: *note PyObject: 5df. *PyObject_GetItem (PyObject *o,
          PyObject *key)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  オブ
     ジェクト 'key' に対応する 'o' の要素を返します。失敗すると ‘NULL’ を
     返します。Python の式 ‘o[key]’ と同じです。

 -- C の関数: int PyObject_SetItem (PyObject *o, PyObject *key, PyObject
          *v)
     ' 次に属します: *note Stable ABI: 775.'  オブジェクト 'key' を値
     'v' に対応付けます。 失敗すると、例外を送出し ‘-1’ を返します。成功
     すると ‘0’ を返します。 これは Python の文 ‘o[key] = v’ と同等です
     。 この関数は 'v' への参照を '盗み取りません' 。

 -- C の関数: int PyObject_DelItem (PyObject *o, PyObject *key)
     ' 次に属します: *note Stable ABI: 775.'  オブジェクト 'o' から
     'key' に関する対応付けを削除します。失敗すると ‘-1’ を返します。
     Python の文 ‘del o[key]’ と同じです。

 -- C の関数: int PyObject_DelItemString (PyObject *o, const char *key)
     ' 次に属します: *note Stable ABI: 775.'  This is the same as *note
     PyObject_DelItem(): 508a, but 'key' is specified as a const char*
     UTF-8 encoded bytes string, rather than a *note PyObject: 5df.*.

 -- C の関数: *note PyObject: 5df. *PyObject_Dir (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  この
     関数は Python の式 ‘dir(o)’ と同じで、オブジェクトの変数名に割り当
     てている文字列からなるリスト (空の場合もあります) を返します。エラ
     ーの場合には ‘NULL’ を返します。引数を ‘NULL’ にすると、Python にお
     ける ‘dir()’ と同様に、現在のローカルな名前を返します; この場合、ア
     クティブな実行フレームがなければ ‘NULL’ を返しますが、 *note
     PyErr_Occurred(): 1caf. は偽を返します。

 -- C の関数: *note PyObject: 5df. *PyObject_GetIter (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Python の式 ‘iter(o)’ と同じです。引数にとったオブジェクトに対する
     新たなイテレータか、オブジェクトがすでにイテレータの場合にはオブジ
     ェクト自身を返します。オブジェクトが反復処理不可能であった場合には
     *note TypeError: 198. を送出して ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyObject_SelfIter (PyObject *obj)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  This
     is equivalent to the Python ‘__iter__(self): return self’ method.
     It is intended for *note iterator: 4c8. types, to be used in the
     *note PyTypeObject.tp_iter: 1708. slot.

 -- C の関数: *note PyObject: 5df. *PyObject_GetAIter (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.10 より).'  This is the equivalent to the Python
     expression ‘aiter(o)’.  Takes an ‘AsyncIterable’ object and returns
     an ‘AsyncIterator’ for it.  This is typically a new iterator but if
     the argument is an ‘AsyncIterator’, this returns itself.  Raises
     *note TypeError: 198. and returns ‘NULL’ if the object cannot be
     iterated.

     Added in version 3.10.

 -- C の関数: void *PyObject_GetTypeData (PyObject *o, PyTypeObject
          *cls)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'
     Get a pointer to subclass-specific data reserved for 'cls'.

     The object 'o' must be an instance of 'cls', and 'cls' must have
     been created using negative *note PyType_Spec.basicsize: 76a.
     Python does not check this.

     On error, set an exception and return ‘NULL’.

     Added in version 3.12.

 -- C の関数: *note Py_ssize_t: c55. PyType_GetTypeDataSize
          (PyTypeObject *cls)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'
     Return the size of the instance memory space reserved for 'cls',
     i.e.  the size of the memory *note PyObject_GetTypeData(): 76b.
     returns.

     This may be larger than requested using *note
     -PyType_Spec.basicsize: 76a.; it is safe to use this larger size
     (e.g.  with ‘memset()’).

     The type 'cls' 'must' have been created using negative *note
     PyType_Spec.basicsize: 76a.  Python does not check this.

     On error, set an exception and return a negative value.

     Added in version 3.12.

 -- C の関数: void *PyObject_GetItemData (PyObject *o)

     Get a pointer to per-item data for a class with *note
     Py_TPFLAGS_ITEMS_AT_END: 76d.

     On error, set an exception and return ‘NULL’.  *note TypeError:
     198. is raised if 'o' does not have *note Py_TPFLAGS_ITEMS_AT_END:
     76d. set.

     Added in version 3.12.

 -- C の関数: int PyObject_VisitManagedDict (PyObject *obj, visitproc
          visit, void *arg)

     Visit the managed dictionary of 'obj'.

     This function must only be called in a traverse function of the
     type which has the *note Py_TPFLAGS_MANAGED_DICT: 60f. flag set.

     Added in version 3.13.

 -- C の関数: void PyObject_ClearManagedDict (PyObject *obj)

     Clear the managed dictionary of 'obj'.

     This function must only be called in a clear function of the type
     which has the *note Py_TPFLAGS_MANAGED_DICT: 60f. flag set.

     Added in version 3.13.

 -- C の関数: int PyUnstable_Object_EnableDeferredRefcount (PyObject
          *obj)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Enable deferred reference counting(3) on 'obj', if supported by the
     runtime.  In the *note free-threaded: 1f4. build, this allows the
     interpreter to avoid reference count adjustments to 'obj', which
     may improve multi-threaded performance.  The tradeoff is that 'obj'
     will only be deallocated by the tracing garbage collector, and not
     when the interpreter no longer has any references to it.

     This function returns ‘1’ if deferred reference counting is enabled
     on 'obj', and ‘0’ if deferred reference counting is not supported
     or if the hint was ignored by the interpreter, such as when
     deferred reference counting is already enabled on 'obj'.  This
     function is thread-safe, and cannot fail.

     This function does nothing on builds with the *note GIL: 164.
     enabled, which do not support deferred reference counting.  This
     also does nothing if 'obj' is not an object tracked by the garbage
     collector (see *note gc.is_tracked(): 1525. and *note
     PyObject_GC_IsTracked(): b6d.).

     This function is intended to be used soon after 'obj' is created,
     by the code that creates it, such as in the object's *note tp_new:
     79f. slot.

     Added in version 3.14.

 -- C の関数: int PyUnstable_Object_IsUniqueReferencedTemporary
          (PyObject *obj)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Check if 'obj' is a unique temporary object.  Returns ‘1’ if 'obj'
     is known to be a unique temporary object, and ‘0’ otherwise.  This
     function cannot fail, but the check is conservative, and may return
     ‘0’ in some cases even if 'obj' is a unique temporary object.

     If an object is a unique temporary, it is guaranteed that the
     current code has the only reference to the object.  For arguments
     to C functions, this should be used instead of checking if the
     reference count is ‘1’.  Starting with Python 3.14, the interpreter
     internally avoids some reference count modifications when loading
     objects onto the operands stack by *note borrowing: 3d7. references
     when possible, which means that a reference count of ‘1’ by itself
     does not guarantee that a function argument uniquely referenced.

     In the example below, ‘my_func’ is called with a unique temporary
     object as its argument:

          my_func([1, 2, 3])

     In the example below, ‘my_func’ is 'not' called with a unique
     temporary object as its argument, even if its refcount is ‘1’:

          my_list = [1, 2, 3]
          my_func(my_list)

     See also the function *note Py_REFCNT(): 2cf.

     Added in version 3.14.

 -- C の関数: int PyUnstable_IsImmortal (PyObject *obj)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     This function returns non-zero if 'obj' is *note immortal: 290, and
     zero otherwise.  This function cannot fail.

          注釈: Objects that are immortal in one CPython version are not
          guaranteed to be immortal in another.

     Added in version 3.14.

 -- C の関数: int PyUnstable_TryIncRef (PyObject *obj)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Increments the reference count of 'obj' if it is not zero.  Returns
     ‘1’ if the object's reference count was successfully incremented.
     Otherwise, this function returns ‘0’.

     *note PyUnstable_EnableTryIncRef(): 18ca. must have been called
     earlier on 'obj' or this function may spuriously return ‘0’ in the
     *note free-threaded build: 176d.

     This function is logically equivalent to the following C code,
     except that it behaves atomically in the *note free-threaded build:
     176d.:

          if (Py_REFCNT(op) > 0) {
             Py_INCREF(op);
             return 1;
          }
          return 0;

     This is intended as a building block for managing weak references
     without the overhead of a Python *note weak reference object: 528f.

     Typically, correct use of this function requires support from
     'obj"s deallocator (*note tp_dealloc: 4ebc.).  For example, the
     following sketch could be adapted to implement a "weakmap" that
     works like a *note WeakValueDictionary: 192a. for a specific type:

          PyMutex mutex;

          PyObject *
          add_entry(weakmap_key_type *key, PyObject *value)
          {
              PyUnstable_EnableTryIncRef(value);
              weakmap_type weakmap = ...;
              PyMutex_Lock(&mutex);
              weakmap_add_entry(weakmap, key, value);
              PyMutex_Unlock(&mutex);
              Py_RETURN_NONE;
          }

          PyObject *
          get_value(weakmap_key_type *key)
          {
              weakmap_type weakmap = ...;
              PyMutex_Lock(&mutex);
              PyObject *result = weakmap_find(weakmap, key);
              if (PyUnstable_TryIncRef(result)) {
                  // `result` is safe to use
                  PyMutex_Unlock(&mutex);
                  return result;
              }
              // if we get here, `result` is starting to be garbage-collected,
              // but has not been removed from the weakmap yet
              PyMutex_Unlock(&mutex);
              return NULL;
          }

          // tp_dealloc function for weakmap values
          void
          value_dealloc(PyObject *value)
          {
              weakmap_type weakmap = ...;
              PyMutex_Lock(&mutex);
              weakmap_remove_value(weakmap, value);

              ...
              PyMutex_Unlock(&mutex);
          }

     Added in version 3.14.

 -- C の関数: void PyUnstable_EnableTryIncRef (PyObject *obj)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Enables subsequent uses of *note PyUnstable_TryIncRef(): 18c9. on
     'obj'.  The caller must hold a *note strong reference: 5e2. to
     'obj' when calling this.

     Added in version 3.14.

 -- C の関数: int PyUnstable_Object_IsUniquelyReferenced (PyObject *op)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Determine if 'op' only has one reference.

     On GIL-enabled builds, this function is equivalent to *note
     Py_REFCNT: 2cf.(*note op: 3c6.) == 1.

     On a *note free-threaded build: 176d, this checks if 'op"s *note
     reference count: 4ec9. is equal to one and additionally checks if
     'op' is only used by this thread.  *note Py_REFCNT: 2cf.(*note op:
     3c6.) == 1 is 'not' thread-safe on free-threaded builds; prefer
     this function.

     The caller must hold an *note attached thread state: 4ed1, despite
     the fact that this function doesn't call into the Python
     interpreter.  This function cannot fail.

     Added in version 3.14.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3119/

   (2) https://peps.python.org/pep-3119/

   (3) https://peps.python.org/pep-0703/#deferred-reference-counting


File: python.info,  Node: Call プロトコル,  Next: 数値型プロトコル number protocol,  Prev: オブジェクトプロトコル object protocol,  Up: 抽象オブジェクトレイヤ Abstract Objects Layer

7.8.2 Call プロトコル
---------------------

CPython supports two different calling protocols: 'tp_call' and
vectorcall.

* Menu:

* The tp_call Protocol::
* The Vectorcall Protocol::
* Object Calling API::
* Call Support API::


File: python.info,  Node: The tp_call Protocol,  Next: The Vectorcall Protocol,  Up: Call プロトコル

7.8.2.1 The 'tp_call' Protocol
..............................

Instances of classes that set *note tp_call: 77b. are callable.  The
signature of the slot is:

     PyObject *tp_call(PyObject *callable, PyObject *args, PyObject *kwargs);

A call is made using a tuple for the positional arguments and a dict for
the keyword arguments, similarly to ‘callable(*args, **kwargs)’ in
Python code.  'args' must be non-NULL (use an empty tuple if there are
no arguments) but 'kwargs' may be 'NULL' if there are no keyword
arguments.

This convention is not only used by 'tp_call': *note tp_new: 79f. and
*note tp_init: 7a1. also pass arguments this way.

To call an object, use *note PyObject_Call(): 63d. or another *note call
API: 5294.


File: python.info,  Node: The Vectorcall Protocol,  Next: Object Calling API,  Prev: The tp_call Protocol,  Up: Call プロトコル

7.8.2.2 The Vectorcall Protocol
...............................

Added in version 3.9.

The vectorcall protocol was introduced in PEP 590(1) as an additional
protocol for making calls more efficient.

As rule of thumb, CPython will prefer the vectorcall for internal calls
if the callable supports it.  However, this is not a hard rule.
Additionally, some third-party extensions use 'tp_call' directly (rather
than using *note PyObject_Call(): 63d.).  Therefore, a class supporting
vectorcall must also implement *note tp_call: 77b.  Moreover, the
callable must behave the same regardless of which protocol is used.  The
recommended way to achieve this is by setting *note tp_call: 77b. to
*note PyVectorcall_Call(): 778.  This bears repeating:

     警告: A class supporting vectorcall 'must' also implement *note
     tp_call: 77b. with the same semantics.

バージョン 3.12 で変更: The *note Py_TPFLAGS_HAVE_VECTORCALL: 776. flag
is now removed from a class when the class's *note __call__(): 77a.
method is reassigned.  (This internally sets *note tp_call: 77b. only,
and thus may make it behave differently than the vectorcall function.)
In earlier Python versions, vectorcall should only be used with *note
immutable: 3cf. or static types.

A class should not implement vectorcall if that would be slower than
'tp_call'.  For example, if the callee needs to convert the arguments to
an args tuple and kwargs dict anyway, then there is no point in
implementing vectorcall.

Classes can implement the vectorcall protocol by enabling the *note
Py_TPFLAGS_HAVE_VECTORCALL: 776. flag and setting *note
tp_vectorcall_offset: 5296. to the offset inside the object structure
where a 'vectorcallfunc' appears.  This is a pointer to a function with
the following signature:

 -- C のデータ型: typedef *note PyObject: 5df. *(*vectorcallfunc)(*note
          PyObject: 5df. *callable, *note PyObject: 5df. *const *args,
          size_t nargsf, *note PyObject: 5df. *kwnames)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'

   - 'callable' is the object being called.

   - 
     'args' is a C array consisting of the positional arguments followed by the

          values of the keyword arguments.  This can be 'NULL' if there
          are no arguments.

   - 
     'nargsf' is the number of positional arguments plus possibly the

          *note PY_VECTORCALL_ARGUMENTS_OFFSET: 780. flag.  To get the
          actual number of positional arguments from 'nargsf', use *note
          PyVectorcall_NARGS(): 777.

   - 
     'kwnames' is a tuple containing the names of the keyword arguments;

          in other words, the keys of the kwargs dict.  These names must
          be strings (instances of ‘str’ or a subclass) and they must be
          unique.  If there are no keyword arguments, then 'kwnames' can
          instead be 'NULL'.

 -- C のマクロ: PY_VECTORCALL_ARGUMENTS_OFFSET
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'  If
     this flag is set in a vectorcall 'nargsf' argument, the callee is
     allowed to temporarily change ‘args[-1]’.  In other words, 'args'
     points to argument 1 (not 0) in the allocated vector.  The callee
     must restore the value of ‘args[-1]’ before returning.

     For *note PyObject_VectorcallMethod(): 77f, this flag means instead
     that ‘args[0]’ may be changed.

     Whenever they can do so cheaply (without additional allocation),
     callers are encouraged to use *note PY_VECTORCALL_ARGUMENTS_OFFSET:
     780.  Doing so will allow callables such as bound methods to make
     their onward calls (which include a prepended 'self' argument) very
     efficiently.

     Added in version 3.8.

To call an object that implements vectorcall, use a *note call API:
5294. function as with any other callable.  *note PyObject_Vectorcall():
77e. will usually be most efficient.

* Menu:

* 再帰の管理: 再帰の管理<2>.
* Vectorcall Support API::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0590/


File: python.info,  Node: 再帰の管理<2>,  Next: Vectorcall Support API,  Up: The Vectorcall Protocol

7.8.2.3 再帰の管理
..................

When using 'tp_call', callees do not need to worry about *note
recursion: 51ff.: CPython uses *note Py_EnterRecursiveCall(): 3d2. and
*note Py_LeaveRecursiveCall(): b6b. for calls made using 'tp_call'.

For efficiency, this is not the case for calls done using vectorcall:
the callee should use 'Py_EnterRecursiveCall' and
'Py_LeaveRecursiveCall' if needed.


File: python.info,  Node: Vectorcall Support API,  Prev: 再帰の管理<2>,  Up: The Vectorcall Protocol

7.8.2.4 Vectorcall Support API
..............................

 -- C の関数: *note Py_ssize_t: c55. PyVectorcall_NARGS (size_t nargsf)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'
     Given a vectorcall 'nargsf' argument, return the actual number of
     arguments.  Currently equivalent to:

          (Py_ssize_t)(nargsf & ~PY_VECTORCALL_ARGUMENTS_OFFSET)

     However, the function ‘PyVectorcall_NARGS’ should be used to allow
     for future extensions.

     Added in version 3.8.

 -- C の関数: *note vectorcallfunc: 779. PyVectorcall_Function (PyObject
          *op)

     If 'op' does not support the vectorcall protocol (either because
     the type does not or because the specific instance does not),
     return 'NULL'. Otherwise, return the vectorcall function pointer
     stored in 'op'.  This function never raises an exception.

     This is mostly useful to check whether or not 'op' supports
     vectorcall, which can be done by checking
     ‘PyVectorcall_Function(op) != NULL’.

     Added in version 3.9.

 -- C の関数: *note PyObject: 5df. *PyVectorcall_Call (PyObject
          *callable, PyObject *tuple, PyObject *dict)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'
     Call 'callable"s *note vectorcallfunc: 779. with positional and
     keyword arguments given in a tuple and dict, respectively.

     This is a specialized function, intended to be put in the *note
     tp_call: 77b. slot or be used in an implementation of ‘tp_call’.
     It does not check the *note Py_TPFLAGS_HAVE_VECTORCALL: 776. flag
     and it does not fall back to ‘tp_call’.

     Added in version 3.8.


File: python.info,  Node: Object Calling API,  Next: Call Support API,  Prev: The Vectorcall Protocol,  Up: Call プロトコル

7.8.2.5 Object Calling API
..........................

Various functions are available for calling a Python object.  Each
converts its arguments to a convention supported by the called object –
either 'tp_call' or vectorcall.  In order to do as little conversion as
possible, pick one that best fits the format of data you have available.

The following table summarizes the available functions; please see
individual documentation for details.

関数                                           callable               ‘args’                   ‘kwargs’
                                                                                               
-------------------------------------------------------------------------------------------------------------------
                                                                                               
*note PyObject_Call(): 63d.                    ‘PyObject *’           tuple                    dict/‘NULL’
                                                                                               
                                                                                               
*note PyObject_CallNoArgs(): 63c.              ‘PyObject *’           --                       --
                                                                                               
                                                                                               
*note PyObject_CallOneArg(): b6f.              ‘PyObject *’           1 object                 --
                                                                                               
                                                                                               
*note PyObject_CallObject(): 4eac.             ‘PyObject *’           tuple/‘NULL’             --
                                                                                               
                                                                                               
*note PyObject_CallFunction(): 63f.            ‘PyObject *’           format                   --
                                                                                               
                                                                                               
*note PyObject_CallMethod(): 640.              obj + ‘char*’          format                   --
                                                                                               
                                                                                               
*note PyObject_CallFunctionObjArgs(): 5089.    ‘PyObject *’           variadic                 --
                                                                                               
                                                                                               
*note PyObject_CallMethodObjArgs(): 1ddf.      obj + name             variadic                 --
                                                                                               
                                                                                               
*note PyObject_CallMethodNoArgs(): 529b.       obj + name             --                       --
                                                                                               
                                                                                               
*note PyObject_CallMethodOneArg(): 529c.       obj + name             1 object                 --
                                                                                               
                                                                                               
*note PyObject_Vectorcall(): 77e.              ‘PyObject *’           vectorcall               vectorcall
                                                                                               
                                                                                               
*note PyObject_VectorcallDict(): 529d.         ‘PyObject *’           vectorcall               dict/‘NULL’
                                                                                               
                                                                                               
*note PyObject_VectorcallMethod(): 77f.        arg + name             vectorcall               vectorcall
                                                                                               

 -- C の関数: *note PyObject: 5df. *PyObject_Call (PyObject *callable,
          PyObject *args, PyObject *kwargs)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  呼び
     出し可能な Python のオブジェクト 'callable' を、タプル 'args' とし
     て与えられる引数と辞書 'kwargs' として与えられる名前付き引数ととも
     に呼び出します。

     'args' は 'NULL' であってはならず、引数を必要としない場合は空のタプ
     ルを使ってください。 'kwargs' は 'NULL' でも構いません。

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     これは次の Python の式と同等です: ‘callable(*args, **kwargs)’ 。

 -- C の関数: *note PyObject: 5df. *PyObject_CallNoArgs (PyObject
          *callable)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.10 より).'  Call a callable Python object 'callable'
     without any arguments.  It is the most efficient way to call a
     callable Python object without any argument.

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     Added in version 3.9.

 -- C の関数: *note PyObject: 5df. *PyObject_CallOneArg (PyObject
          *callable, PyObject *arg)
     '戻り値: 新しい参照。' Call a callable Python object 'callable'
     with exactly 1 positional argument 'arg' and no keyword arguments.

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     Added in version 3.9.

 -- C の関数: *note PyObject: 5df. *PyObject_CallObject (PyObject
          *callable, PyObject *args)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  呼び
     出し可能な Python のオブジェクト 'callable' を、タプル 'args' とし
     て与えられる引数とともに呼び出します。 引数が必要な場合は、 'args'
     は 'NULL' で構いません。

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     これは次の Python の式と同等です: ‘callable(*args)’ 。

 -- C の関数: *note PyObject: 5df. *PyObject_CallFunction (PyObject
          *callable, const char *format, ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  呼び
     出し可能な Python オブジェクト 'callable' を可変数個の C 引数ととも
     に呼び出します。 C 引数は *note Py_BuildValue(): 3c2. 形式のフォー
     マット文字列を使って記述します。 'format' は 'NULL' かもしれず、与
     える引数がないことを表します。

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     これは次の Python の式と同等です: ‘callable(*args)’ 。

     *note PyObject: 5df.* args だけを引数に渡す場合は、 *note
     PyObject_CallFunctionObjArgs(): 5089. がより速い方法であることを覚
     えておいてください。

     バージョン 3.4 で変更: 'format' の型が ‘char *’ から変更されました
     。

 -- C の関数: *note PyObject: 5df. *PyObject_CallMethod (PyObject *obj,
          const char *name, const char *format, ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  オブ
     ジェクト 'obj' の 'name' という名前のメソッドを、いくつかの C 引数
     とともに呼び出します。 C 引数はタプルを生成する *note
     Py_BuildValue(): 3c2. 形式のフォーマット文字列で記述されています。

     'format' は 'NULL' でもよく、引数が与えられないことを表します。

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     これは次の Python の式と同等です: ‘obj.name(arg1, arg2, ...)’ 。

     *note PyObject: 5df.* args だけを引数に渡す場合は、 *note
     PyObject_CallMethodObjArgs(): 1ddf. がより速い方法であることを覚え
     ておいてください。

     バージョン 3.4 で変更: 'name' と 'format' の型が ‘char *’ から変更
     されました。

 -- C の関数: *note PyObject: 5df. *PyObject_CallFunctionObjArgs
          (PyObject *callable, ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  呼び
     出し可能な Python オブジェクト 'callable' を可変数個の *note
     PyObject: 5df.* 引数とともに呼び出します。引数列は末尾に 'NULL' が
     ついた可変数個のパラメタとして与えます。

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     これは次の Python の式と同等です: ‘callable(arg1, arg2, ...)’ 。

 -- C の関数: *note PyObject: 5df. *PyObject_CallMethodObjArgs (PyObject
          *obj, PyObject *name, ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Python オブジェクト 'obj' のメソッドを呼び出します、メソッド名は
     Python 文字列オブジェクト 'name' で与えます。可変数個の *note
     PyObject: 5df.* 引数と共に呼び出されます.  引数列は末尾に 'NULL' が
     ついた可変数個のパラメタとして与えます。

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

 -- C の関数: *note PyObject: 5df. *PyObject_CallMethodNoArgs (PyObject
          *obj, PyObject *name)

     Call a method of the Python object 'obj' without arguments, where
     the name of the method is given as a Python string object in
     'name'.

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     Added in version 3.9.

 -- C の関数: *note PyObject: 5df. *PyObject_CallMethodOneArg (PyObject
          *obj, PyObject *name, PyObject *arg)

     Call a method of the Python object 'obj' with a single positional
     argument 'arg', where the name of the method is given as a Python
     string object in 'name'.

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     Added in version 3.9.

 -- C の関数: *note PyObject: 5df. *PyObject_Vectorcall (PyObject
          *callable, PyObject *const *args, size_t nargsf, PyObject
          *kwnames)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'
     Call a callable Python object 'callable'.  The arguments are the
     same as for *note vectorcallfunc: 779.  If 'callable' supports
     *note vectorcall: 774, this directly calls the vectorcall function
     stored in 'callable'.

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     Added in version 3.8: as ‘_PyObject_Vectorcall’

     バージョン 3.9 で変更: Renamed to the current name, without the
     leading underscore.  The old provisional name is *note soft
     deprecated: 23d.

 -- C の関数: *note PyObject: 5df. *PyObject_VectorcallDict (PyObject
          *callable, PyObject *const *args, size_t nargsf, PyObject
          *kwdict)

     Call 'callable' with positional arguments passed exactly as in the
     *note vectorcall: 774. protocol, but with keyword arguments passed
     as a dictionary 'kwdict'.  The 'args' array contains only the
     positional arguments.

     Regardless of which protocol is used internally, a conversion of
     arguments needs to be done.  Therefore, this function should only
     be used if the caller already has a dictionary ready to use for the
     keyword arguments, but not a tuple for the positional arguments.

     Added in version 3.9.

 -- C の関数: *note PyObject: 5df. *PyObject_VectorcallMethod (PyObject
          *name, PyObject *const *args, size_t nargsf, PyObject
          *kwnames)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'
     Call a method using the vectorcall calling convention.  The name of
     the method is given as a Python string 'name'.  The object whose
     method is called is 'args[0]', and the 'args' array starting at
     'args[1]' represents the arguments of the call.  There must be at
     least one positional argument.  'nargsf' is the number of
     positional arguments including 'args[0]', plus *note
     PY_VECTORCALL_ARGUMENTS_OFFSET: 780. if the value of ‘args[0]’ may
     temporarily be changed.  Keyword arguments can be passed just like
     in *note PyObject_Vectorcall(): 77e.

     If the object has the *note Py_TPFLAGS_METHOD_DESCRIPTOR: 5138.
     feature, this will call the unbound method object with the full
     'args' vector as arguments.

     成功したら呼び出しの結果を返し、失敗したら例外を送出し 'NULL' を返
     します。

     Added in version 3.9.


File: python.info,  Node: Call Support API,  Prev: Object Calling API,  Up: Call プロトコル

7.8.2.6 Call Support API
........................

 -- C の関数: int PyCallable_Check (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'  オブジェクト 'o' が呼び出
     し可能オブジェクトかどうか調べます。オブジェクトが呼び出し可能であ
     るときに ‘1’ を返し、そうでないときには ‘0’ を返します。この関数呼
     び出しは常に成功します。


File: python.info,  Node: 数値型プロトコル number protocol,  Next: シーケンス型プロトコル sequence protocol,  Prev: Call プロトコル,  Up: 抽象オブジェクトレイヤ Abstract Objects Layer

7.8.3 数値型プロトコル (number protocol)
----------------------------------------

 -- C の関数: int PyNumber_Check (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'  オブジェクト 'o' が数値型
     プロトコルを提供している場合に ‘1’ を返し、そうでないときには偽を返
     します。この関数呼び出しは常に成功します。

     バージョン 3.8 で変更: 'o' がインデックス整数だった場合、 ‘1’ を返
     します。

 -- C の関数: *note PyObject: 5df. *PyNumber_Add (PyObject *o1, PyObject
          *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' と 'o2' を加算した結果を返し、失敗すると ‘NULL’ を返し
     ます。Python の式 ‘o1 + o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_Subtract (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' から 'o2' を減算した結果を返し、失敗すると ‘NULL’ を返
     します。Python の式 ‘o1 - o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_Multiply (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' と 'o2' を乗算した結果を返し、失敗すると ‘NULL’ を返し
     ます。Python の式 ‘o1 * o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_MatrixMultiply (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'  成功すると 'o1' と 'o2' を行列乗算した結果を返
     し、失敗すると ‘NULL’ を返します。 Python の式 ‘o1 @ o2’ と同じです
     。

     Added in version 3.5.

 -- C の関数: *note PyObject: 5df. *PyNumber_FloorDivide (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return the floor of 'o1' divided by 'o2', or ‘NULL’ on failure.
     This is the equivalent of the Python expression ‘o1 // o2’.

 -- C の関数: *note PyObject: 5df. *PyNumber_TrueDivide (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return a reasonable approximation for the mathematical value of
     'o1' divided by 'o2', or ‘NULL’ on failure.  The return value is
     "approximate" because binary floating-point numbers are
     approximate; it is not possible to represent all real numbers in
     base two.  This function can return a floating-point value when
     passed two integers.  This is the equivalent of the Python
     expression ‘o1 / o2’.

 -- C の関数: *note PyObject: 5df. *PyNumber_Remainder (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' を 'o2' で除算した剰余を返し、失敗すると ‘NULL’ を返し
     ます。Python の式 ‘o1 % o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_Divmod (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     組み込み関数 *note divmod(): b99. を参照してください。失敗すると
     ‘NULL’ を返します。 Python の式 ‘divmod(o1, o2)’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_Power (PyObject *o1,
          PyObject *o2, PyObject *o3)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     組み込み関数 *note pow(): 1a4. を参照してください。失敗すると
     ‘NULL’ を返します。 Python の式 ‘pow(o1, o2, o3)’ と同じです。 'o3'
     はオプションです。 'o3' を無視させたいなら、 *note Py_None: 4e9f. を
     入れてください ('o3' に ‘NULL’ を渡すと、不正なメモリアクセスを引き
     起こすことがあります)。

 -- C の関数: *note PyObject: 5df. *PyNumber_Negative (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o' の符号反転を返し、失敗すると ‘NULL’ を返します。Python の
     式 ‘-o’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_Positive (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o' を返し、失敗すると ‘NULL’ を返します。Python の式 ‘+o’ と
     同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_Absolute (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     成功すると 'o' の絶対値を返し、失敗すると ‘NULL’ を返します。Python
     の式 ‘abs(o)’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_Invert (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o' のビット単位反転 (bitwise negation) を返し、失敗すると
     ‘NULL’ を返します。Python の式 ‘~o’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_Lshift (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' を 'o2' だけ左シフトした結果を返し、失敗すると ‘NULL’ を
     返します。Python の式 ‘o1 << o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_Rshift (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' を 'o2' だけ右シフトした結果を返し、失敗すると ‘NULL’ を
     返します。Python の式 ‘o1 >> o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_And (PyObject *o1, PyObject
          *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' と 'o2' の "ビット単位論理積 (bitwise and)" を返し、失
     敗すると ‘NULL’ を返します。Python の式 ‘o1 & o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_Xor (PyObject *o1, PyObject
          *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' と 'o2' の "ビット単位排他的論理和 (bitwise exclusive
     or)" を返し、失敗すると ‘NULL’ を返します。Python の式 ‘o1 ^ o2’ と
     同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_Or (PyObject *o1, PyObject
          *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' と 'o2' の "ビット単位論理和 (bitwise or)" を返し失敗す
     ると ‘NULL’ を返します。Python の式 ‘o1 | o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_InPlaceAdd (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' と 'o2' を加算した結果を返し、失敗すると ‘NULL’ を返し
     ます。'o1' が 'in-place' 演算をサポートする場合、in-place 演算を行
     います。Python の文 ‘o1 += o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_InPlaceSubtract (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' から 'o2' を減算した結果を返し、失敗すると ‘NULL’ を返
     します。'o1' が 'in-place' 演算をサポートする場合、in-place 演算を
     行います。Python の文 ‘o1 -= o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_InPlaceMultiply (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' と 'o2' を乗算した結果を返し、失敗すると ‘NULL’ を返し
     ます。'o1' が 'in-place' 演算をサポートする場合、in-place 演算を行
     います。Python の文 ‘o1 *= o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_InPlaceMatrixMultiply
          (PyObject *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'  成功すると 'o1' と 'o2' を行列乗算した結果を返
     し、失敗すると ‘NULL’ を返します。 'o1' が 'in-place' 演算をサポー
     トする場合、 in-place 演算を行います。 Python の文 ‘o1 @= o2’ と同
     じです。

     Added in version 3.5.

 -- C の関数: *note PyObject: 5df. *PyNumber_InPlaceFloorDivide
          (PyObject *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' を 'o2' で除算した切捨て値を返し、失敗すると ‘NULL’ を
     返します。'o1' が 'in-place' 演算をサポートする場合、in-place 演算
     を行います。Python の文 ‘o1 //= o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_InPlaceTrueDivide (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return a reasonable approximation for the mathematical value of
     'o1' divided by 'o2', or ‘NULL’ on failure.  The return value is
     "approximate" because binary floating-point numbers are
     approximate; it is not possible to represent all real numbers in
     base two.  This function can return a floating-point value when
     passed two integers.  The operation is done 'in-place' when 'o1'
     supports it.  This is the equivalent of the Python statement ‘o1 /=
     o2’.

 -- C の関数: *note PyObject: 5df. *PyNumber_InPlaceRemainder (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' を 'o2' で除算した剰余を返し、, 失敗すると ‘NULL’ を返
     します。'o1' が 'in-place' 演算をサポートする場合、in-place 演算を
     行います。Python の文 ‘o1 %= o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_InPlacePower (PyObject *o1,
          PyObject *o2, PyObject *o3)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     組み込み関数 *note pow(): 1a4. を参照してください。失敗すると
     ‘NULL’ を返します。 'o1' が 'in-place' 演算をサポートする場合、
     in-place 演算を行います。この関数は 'o3' が *note Py_None: 4e9f. の
     場合は Python 文 ‘o1 **= o2’ と同じで、それ以外の場合は ‘pow(o1,
     o2, o3)’ の in-place 版です。 'o3' を無視させたいなら、 *note
     Py_None: 4e9f. を入れてください ('o3' に ‘NULL’ を渡すと、不正なメ
     モリアクセスを引き起こすことがあります)。

 -- C の関数: *note PyObject: 5df. *PyNumber_InPlaceLshift (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' を 'o2' だけ左シフトした結果を返し、失敗すると ‘NULL’ を
     返します。'o1' が 'in-place' 演算をサポートする場合、in-place 演算
     を行います。Python の文 ‘o1 <<= o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_InPlaceRshift (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' を 'o2' だけ右シフトした結果を返し、失敗すると ‘NULL’ を
     返します。'o1' が 'in-place' 演算をサポートする場合、in-place 演算
     を行います。Python の文 ‘o1 >>= o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_InPlaceAnd (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' と 'o2' の "ビット単位論理積 (bitwise and)" を返し、失
     敗すると ‘NULL’ を返します。'o1' が 'in-place' 演算をサポートする場
     合、in-place 演算を行います。Python の文 ‘o1 &= o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_InPlaceXor (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' と 'o2' の "ビット単位排他的論理和 (bitwise exclusive
     or)" を返し、失敗すると ‘NULL’ を返します。'o1' が 'in-place' 演算
     をサポートする場合、in-place 演算を行います。Python の文 ‘o1 ^= o2’
     と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_InPlaceOr (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' と 'o2' の "ビット単位論理和 (bitwise or)" を返し失敗す
     ると ‘NULL’ を返します。'o1' が 'in-place' 演算をサポートする場合、
     in-place 演算を行います。Python の文 ‘o1 |= o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_Long (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     成功すると 'o' を整数に変換したものを返し、失敗すると ‘NULL’ を返し
     ます。Python の式 ‘int(o)’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_Float (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     成功すると 'o' を浮動小数点数に変換したものを返し、失敗すると
     ‘NULL’ を返します。Python の式 ‘float(o)’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyNumber_Index (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  'o'
     をPythonのint型に変換し、成功したらその値を返します。失敗したら
     ‘NULL’ が返され、 *note TypeError: 198. 例外が送出されます。

     バージョン 3.10 で変更: 結果は常に厳密な *note int: 19b. 型です。 以
     前は、結果は ‘int’ のサブクラスのインスタンスのこともありました。

 -- C の関数: *note PyObject: 5df. *PyNumber_ToBase (PyObject *n, int
          base)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'base' 進数に変換された整数 'n' を文字列として返します。 'base' 引
     数は2, 8, 10または16のいずれかでなければなりません。 基数2、8、16に
     ついて、返される文字列の先頭には基数マーカー ‘'0b'’ 、 ‘'0o'’ また
     は ‘'0x'’ が、それぞれ付与されます。 もし 'n' が Python のint型でな
     ければ、まず *note PyNumber_Index(): a93. で変換されます。

 -- C の関数: *note Py_ssize_t: c55. PyNumber_AsSsize_t (PyObject *o,
          PyObject *exc)
     ' 次に属します: *note Stable ABI: 775.'  'o' を整数として解釈可能だ
     った場合、*note Py_ssize_t: c55. 型の値に変換して返します。呼び出し
     が失敗したら、例外が送出され、 ‘-1’ が返されます。

     もし 'o' がPythonのintに変換できたのに、*note Py_ssize_t: c55. への
     変換が *note OverflowError: a81. になる場合は、 'exc' 引数で渡され
     た型 (普通は *note IndexError: 174e. か *note OverflowError: a81.)
     の例外を送出します。もし、 'exc' が ‘NULL’ なら、例外はクリアされて
     、値が負の場合は ‘PY_SSIZE_T_MIN’ へ、正の場合は ‘PY_SSIZE_T_MAX’ へ
     と制限されます。

 -- C の関数: int PyIndex_Check (PyObject *o)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.8 より).'  'o'
     がインデックス整数である場合 (‘tp_as_number’ 構造体の ‘nb_index’ ス
     ロットが埋まっている場合) に ‘1’ を返し、そうでない場合に ‘0’ を返
     します。 この関数は常に成功します。


File: python.info,  Node: シーケンス型プロトコル sequence protocol,  Next: マップ型プロトコル mapping protocol,  Prev: 数値型プロトコル number protocol,  Up: 抽象オブジェクトレイヤ Abstract Objects Layer

7.8.4 シーケンス型プロトコル (sequence protocol)
------------------------------------------------

 -- C の関数: int PySequence_Check (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'  Return ‘1’ if the object
     provides the sequence protocol, and ‘0’ otherwise.  Note that it
     returns ‘1’ for Python classes with a *note __getitem__(): 588.
     method, unless they are *note dict: 183. subclasses, since in
     general it is impossible to determine what type of keys the class
     supports.  This function always succeeds.

 -- C の関数: *note Py_ssize_t: c55. PySequence_Size (PyObject *o)
 -- C の関数: *note Py_ssize_t: c55. PySequence_Length (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'

     成功するとシーケンス 'o' 中のオブジェクトの数を返し、失敗すると
     ‘-1’ を返します。これは、Python の式 ‘len(o)’ と同じになります。

 -- C の関数: *note PyObject: 5df. *PySequence_Concat (PyObject *o1,
          PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' と 'o2' の連結 (concatenation) を返し、失敗すると
     ‘NULL’ を返します。Python の式 ‘o1 + o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PySequence_Repeat (PyObject *o,
          Py_ssize_t count)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     するとオブジェクト 'o' の 'count' 回繰り返しを返し、失敗すると
     ‘NULL’ を返します。Python の式 ‘o * count’ と同じです。

 -- C の関数: *note PyObject: 5df. *PySequence_InPlaceConcat (PyObject
          *o1, PyObject *o2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o1' と 'o2' の連結 (concatenation) を返し、失敗すると
     ‘NULL’ を返します。'o1' が 'in-place' 演算をサポートする場合、
     in-place 演算を行います。Python の式 ‘o1 += o2’ と同じです。

 -- C の関数: *note PyObject: 5df. *PySequence_InPlaceRepeat (PyObject
          *o, Py_ssize_t count)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     するとオブジェクト 'o' の 'count' 回繰り返しを返し、失敗すると
     ‘NULL’ を返します。'o' が 'in-place' 演算をサポートする場合、
     in-place 演算を行います。Python の式 ‘o *= count’ と同じです。

 -- C の関数: *note PyObject: 5df. *PySequence_GetItem (PyObject *o,
          Py_ssize_t i)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o' の 'i' 番目の要素を返し、失敗すると ‘NULL’ を返します。
     Python の式 ‘o[i]’ と同じです。

 -- C の関数: *note PyObject: 5df. *PySequence_GetSlice (PyObject *o,
          Py_ssize_t i1, Py_ssize_t i2)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     すると 'o' の 'i1' から 'i2' までの間のスライスを返し、失敗すると
     ‘NULL’ を返します。Python の式 ‘o[i1:i2]’ と同じです。

 -- C の関数: int PySequence_SetItem (PyObject *o, Py_ssize_t i,
          PyObject *v)
     ' 次に属します: *note Stable ABI: 775.'  'o' の 'i' 番目の要素に
     'v' を代入します。 失敗すると、例外を送出し ‘-1’ を返します; 成功す
     ると ‘0’ を返します。 これは Python の文 ‘o[i] = v’ と同じです。 こ
     の関数は 'v' への参照を '盗み取りません' 。

     'v' が ‘NULL’ の場合はその要素が削除されますが、この機能は非推奨で
     あり、 *note PyObject_DelAttr(): 1831. を使うのが望ましいです。

 -- C の関数: int PySequence_DelItem (PyObject *o, Py_ssize_t i)
     ' 次に属します: *note Stable ABI: 775.'  'o' の 'i' 番目の要素を削
     除します。失敗すると ‘-1’ を返します。Python の文 ‘del o[i]’ と同じ
     です。

 -- C の関数: int PySequence_SetSlice (PyObject *o, Py_ssize_t i1,
          Py_ssize_t i2, PyObject *v)
     ' 次に属します: *note Stable ABI: 775.'  'o' の 'i1' から 'i2' まで
     の間のスライスに 'v' を代入します。Python の文 ‘o[i1:i2] = v’ と同
     じです。

 -- C の関数: int PySequence_DelSlice (PyObject *o, Py_ssize_t i1,
          Py_ssize_t i2)
     ' 次に属します: *note Stable ABI: 775.'  シーケンスオブジェクト 'o'
     の 'i1' から 'i2' までの間のスライスを削除します。失敗すると ‘-1’ を
     返します。Python の文 ‘del o[i1:i2]’ と同じです。

 -- C の関数: *note Py_ssize_t: c55. PySequence_Count (PyObject *o,
          PyObject *value)
     ' 次に属します: *note Stable ABI: 775.'  'o' における 'value' の出
     現回数、すなわち ‘o[key] == value’ となる 'key' の個数を返します。
     失敗すると ‘-1’ を返します。Python の式 ‘o.count(value)’ と同じです
     。

 -- C の関数: int PySequence_Contains (PyObject *o, PyObject *value)
     ' 次に属します: *note Stable ABI: 775.'  'o' に 'value' が入ってい
     るか判定します。'o' のある要素が 'value' と等価 (equal) ならば ‘1’
     を返し、それ以外の場合には ‘0’ を返します。エラーが発生すると ‘-1’
     を返します。Python の式 ‘value in o’ と同じです。

 -- C の関数: int PySequence_In (PyObject *o, PyObject *value)
     ' 次に属します: *note Stable ABI: 775.'  Alias for *note
     PySequence_Contains(): 3d9.

     バージョン 3.14 で非推奨: The function is *note soft deprecated:
     23d. and should no longer be used to write new code.

 -- C の関数: *note Py_ssize_t: c55. PySequence_Index (PyObject *o,
          PyObject *value)
     ' 次に属します: *note Stable ABI: 775.'  ‘o[i] == value’ となる最初
     に見つかったインデクス 'i' を返します。エラーが発生すると ‘-1’ を返
     します。Python の式 ‘o.index(value)’ と同じです。

 -- C の関数: *note PyObject: 5df. *PySequence_List (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  シー
     ケンスもしくはイテラブル 'o' と同じ内容を持つリストオブジェクトを返
     します。 失敗したら ‘NULL’ を返します。 返されるリストは新しく作ら
     れたことが保証されています。 これは Python の式 ‘list(o)’ と同等で
     す。

 -- C の関数: *note PyObject: 5df. *PySequence_Tuple (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     シーケンスあるいはイテラブルである 'o' と同じ内容を持つタプルオブジ
     ェクトを返します。 失敗したら ‘NULL’ を返します。'o' がタプルの場合
     、新たな参照を返します。 それ以外の場合、適切な内容が入ったタプルを
     構築して返します。 Pythonの式 ‘tuple(o)’ と同等です。

 -- C の関数: *note PyObject: 5df. *PySequence_Fast (PyObject *o, const
          char *m)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  シー
     ケンスまたはイテラブルの 'o' を ‘PySequence_Fast*’ ファミリの関数で
     利用できるオブジェクトとして返します。オブジェクトがシーケンスでも
     イテラブルでもない場合は、メッセージ 'm' を持つ、 *note TypeError:
     198. を送出します。失敗したら ‘NULL’ を返します。

     ‘PySequence_Fast*’ ファミリの関数は、'o' が *note PyTupleObject:
     5224. または *note PyListObject: 52a8. と仮定し、'o' のデータフィー
     ルドに直接アクセスするため、そのように名付けられています。

     CPythonの実装では、もし 'o' が 既にシーケンスかタプルであれば、'o'
     そのものを返します。

 -- C の関数: *note Py_ssize_t: c55. PySequence_Fast_GET_SIZE (PyObject
          *o)

     'o' が ‘NULL’ でなく、 *note PySequence_Fast(): 18a2. が返したオブ
     ジェクトであると仮定して、 'o' の長さを返します。 'o' のサイズは
     *note PySequence_Size(): 1e33. を呼び出しても得られますが、 *note
     PySequence_Fast_GET_SIZE(): 3ca. の方が 'o' をリストかタプルである
     と仮定して処理するため、より高速です。

 -- C の関数: *note PyObject: 5df. *PySequence_Fast_GET_ITEM (PyObject
          *o, Py_ssize_t i)
     '戻り値: 借用参照。' 'o' が ‘NULL’ でなく、 *note
     PySequence_Fast(): 18a2. が返したオブジェクトであり、かつ 'i' がイ
     ンデクスの範囲内にあると仮定して、 'o' の 'i' 番目の要素を返します
     。

 -- C の関数: *note PyObject: 5df. **PySequence_Fast_ITEMS (PyObject *o)

     PyObject ポインタの背後にあるアレイを返します。この関数では、 'o' は
     *note PySequence_Fast(): 18a2. の返したオブジェクトであり、 ‘NULL’
     でないものと仮定しています。

     リストのサイズが変更されるとき、メモリ再確保が要素の配列を再配置す
     るかもしれないことに注意してください。そのため、シーケンスの変更が
     発生しないコンテキストでのみ背後にあるポインタを使ってください。

 -- C の関数: *note PyObject: 5df. *PySequence_ITEM (PyObject *o,
          Py_ssize_t i)
     '戻り値: 新しい参照。' 'o' の 'i' 番目の要素を返し、失敗すると
     ‘NULL’ を返します。 *note PySequence_GetItem(): 1e34. の高速版であ
     り、*note PySequence_Check(): 50a0. で 'o' が真を返すかどうかの検証
     や、負の添え字の調整を行いません。


File: python.info,  Node: マップ型プロトコル mapping protocol,  Next: イテレータプロトコル iterator protocol,  Prev: シーケンス型プロトコル sequence protocol,  Up: 抽象オブジェクトレイヤ Abstract Objects Layer

7.8.5 マップ型プロトコル (mapping protocol)
-------------------------------------------

*note PyObject_GetItem(): 5ea, *note PyObject_SetItem(): 4f48, *note
PyObject_DelItem(): 508a. も参照してください。

 -- C の関数: int PyMapping_Check (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'  Return ‘1’ if the object
     provides the mapping protocol or supports slicing, and ‘0’
     otherwise.  Note that it returns ‘1’ for Python classes with a
     *note __getitem__(): 588. method, since in general it is impossible
     to determine what type of keys the class supports.  This function
     always succeeds.

 -- C の関数: *note Py_ssize_t: c55. PyMapping_Size (PyObject *o)
 -- C の関数: *note Py_ssize_t: c55. PyMapping_Length (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'

     成功するとオブジェクト 'o' 中のキーの数を返し、失敗すると ‘-1’ を返
     します。これは、Python の式 ‘len(o)’ と同じになります。

 -- C の関数: *note PyObject: 5df. *PyMapping_GetItemString (PyObject
          *o, const char *key)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  This
     is the same as *note PyObject_GetItem(): 5ea, but 'key' is
     specified as a const char* UTF-8 encoded bytes string, rather than
     a *note PyObject: 5df.*.

 -- C の関数: int PyMapping_GetOptionalItem (PyObject *obj, PyObject
          *key, PyObject **result)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Variant of *note PyObject_GetItem(): 5ea. which doesn't raise *note
     KeyError: 5e7. if the key is not found.

     If the key is found, return ‘1’ and set '*result' to a new *note
     strong reference: 5e2. to the corresponding value.  If the key is
     not found, return ‘0’ and set '*result' to ‘NULL’; the *note
     KeyError: 5e7. is silenced.  If an error other than *note KeyError:
     5e7. is raised, return ‘-1’ and set '*result' to ‘NULL’.

     Added in version 3.13.

 -- C の関数: int PyMapping_GetOptionalItemString (PyObject *obj, const
          char *key, PyObject **result)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     This is the same as *note PyMapping_GetOptionalItem(): 5e8, but
     'key' is specified as a const char* UTF-8 encoded bytes string,
     rather than a *note PyObject: 5df.*.

     Added in version 3.13.

 -- C の関数: int PyMapping_SetItemString (PyObject *o, const char *key,
          PyObject *v)
     ' 次に属します: *note Stable ABI: 775.'  This is the same as *note
     PyObject_SetItem(): 4f48, but 'key' is specified as a const char*
     UTF-8 encoded bytes string, rather than a *note PyObject: 5df.*.

 -- C の関数: int PyMapping_DelItem (PyObject *o, PyObject *key)

     This is an alias of *note PyObject_DelItem(): 508a.

 -- C の関数: int PyMapping_DelItemString (PyObject *o, const char *key)

     This is the same as *note PyObject_DelItem(): 508a, but 'key' is
     specified as a const char* UTF-8 encoded bytes string, rather than
     a *note PyObject: 5df.*.

 -- C の関数: int PyMapping_HasKeyWithError (PyObject *o, PyObject *key)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Return ‘1’ if the mapping object has the key 'key' and ‘0’
     otherwise.  This is equivalent to the Python expression ‘key in o’.
     On failure, return ‘-1’.

     Added in version 3.13.

 -- C の関数: int PyMapping_HasKeyStringWithError (PyObject *o, const
          char *key)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     This is the same as *note PyMapping_HasKeyWithError(): 61f, but
     'key' is specified as a const char* UTF-8 encoded bytes string,
     rather than a *note PyObject: 5df.*.

     Added in version 3.13.

 -- C の関数: int PyMapping_HasKey (PyObject *o, PyObject *key)
     ' 次に属します: *note Stable ABI: 775.'  マップ型オブジェクトがキー
     'key' を持つ場合に ‘1’ を返し、そうでないときには ‘0’ を返します。
     これは、Python の式 ‘key in o’ と等価です。この関数呼び出しは常に成
     功します。

          注釈: Exceptions which occur when this calls the *note
          __getitem__(): 588. method are silently ignored.  For proper
          error handling, use *note PyMapping_HasKeyWithError(): 61f,
          *note PyMapping_GetOptionalItem(): 5e8. or *note
          PyObject_GetItem(): 5ea. instead.

 -- C の関数: int PyMapping_HasKeyString (PyObject *o, const char *key)
     ' 次に属します: *note Stable ABI: 775.'  This is the same as *note
     PyMapping_HasKey(): 620, but 'key' is specified as a const char*
     UTF-8 encoded bytes string, rather than a *note PyObject: 5df.*.

          注釈: Exceptions that occur when this calls the *note
          __getitem__(): 588. method or while creating the temporary
          *note str: 169. object are silently ignored.  For proper error
          handling, use *note PyMapping_HasKeyStringWithError(): 621,
          *note PyMapping_GetOptionalItemString(): 5e9. or *note
          PyMapping_GetItemString(): 5eb. instead.

 -- C の関数: *note PyObject: 5df. *PyMapping_Keys (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     するとオブジェクト 'o' のキーからなるリストを返します。 失敗すると
     ‘NULL’ を返します。

     バージョン 3.7 で変更: 以前は、関数はリストもしくはタプルを返してい
     ました。

 -- C の関数: *note PyObject: 5df. *PyMapping_Values (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     するとオブジェクト 'o' の値からなるリストを返します。 失敗すると
     ‘NULL’ を返します。

     バージョン 3.7 で変更: 以前は、関数はリストもしくはタプルを返してい
     ました。

 -- C の関数: *note PyObject: 5df. *PyMapping_Items (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     するとオブジェクト 'o' の要素からなるリストを返し、各要素はキーと値
     のペアが入ったタプルになっています。 失敗すると ‘NULL’ を返します。

     バージョン 3.7 で変更: 以前は、関数はリストもしくはタプルを返してい
     ました。


File: python.info,  Node: イテレータプロトコル iterator protocol,  Next: バッファプロトコル buffer Protocol,  Prev: マップ型プロトコル mapping protocol,  Up: 抽象オブジェクトレイヤ Abstract Objects Layer

7.8.6 イテレータプロトコル (iterator protocol)
----------------------------------------------

イテレータを扱うための固有の関数は二つあります。

 -- C の関数: int PyIter_Check (PyObject *o)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.8 より).'
     Return non-zero if the object 'o' can be safely passed to *note
     PyIter_NextItem(): 398. and ‘0’ otherwise.  This function always
     succeeds.

 -- C の関数: int PyAIter_Check (PyObject *o)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Return non-zero if the object 'o' provides the ‘AsyncIterator’
     protocol, and ‘0’ otherwise.  This function always succeeds.

     Added in version 3.10.

 -- C の関数: int PyIter_NextItem (PyObject *iter, PyObject **item)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Return ‘1’ and set 'item' to a *note strong reference: 5e2. of the
     next value of the iterator 'iter' on success.  Return ‘0’ and set
     'item' to ‘NULL’ if there are no remaining values.  Return ‘-1’,
     set 'item' to ‘NULL’ and set an exception on error.

     Added in version 3.14.

 -- C の関数: *note PyObject: 5df. *PyIter_Next (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  This
     is an older version of ‘PyIter_NextItem()’, which is retained for
     backwards compatibility.  Prefer *note PyIter_NextItem(): 398.

     Return the next value from the iterator 'o'.  The object must be an
     iterator according to *note PyIter_Check(): 1cb2. (it is up to the
     caller to check this).  If there are no remaining values, returns
     ‘NULL’ with no exception set.  If an error occurs while retrieving
     the item, returns ‘NULL’ and passes along the exception.

 -- C のデータ型: type PySendResult

     The enum value used to represent different results of *note
     PyIter_Send(): a98.

     Added in version 3.10.

 -- C の関数: *note PySendResult: 52b4. PyIter_Send (PyObject *iter,
          PyObject *arg, PyObject **presult)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Sends the 'arg' value into the iterator 'iter'.  Returns:

        - ‘PYGEN_RETURN’ if iterator returns.  Return value is returned
          via 'presult'.

        - ‘PYGEN_NEXT’ if iterator yields.  Yielded value is returned
          via 'presult'.

        - ‘PYGEN_ERROR’ if iterator has raised and exception.  'presult'
          is set to ‘NULL’.

     Added in version 3.10.


File: python.info,  Node: バッファプロトコル buffer Protocol,  Prev: イテレータプロトコル iterator protocol,  Up: 抽象オブジェクトレイヤ Abstract Objects Layer

7.8.7 バッファプロトコル (buffer Protocol)
------------------------------------------

Pythonで利用可能ないくつかのオブジェクトは、下層にあるメモリ配列または
'buffer' へのアクセスを提供します。このようなオブジェクトとして、組み込
みの *note bytes: 192. や *note bytearray: 344. 、 *note array.array:
4be. のようないくつかの拡張型が挙げられます。サードバーティのライブラリ
は画像処理や数値解析のような特別な目的のために、それら自身の型を定義する
ことができます。

それぞれの型はそれ自身のセマンティクスを持ちますが、おそらく大きなメモリ
バッファからなるという共通の特徴を共有します。いくつかの状況では仲介する
コピーを行うことなく直接バッファにアクセスすることが望まれます。

Python provides such a facility at the C and Python level in the form of
the *note buffer protocol: 260.  This protocol has two sides:

   - on the producer side, a type can export a "buffer interface" which
     allows objects of that type to expose information about their
     underlying buffer.  This interface is described in the section
     *note バッファオブジェクト構造体 (buffer object structure): 1248.;
     for Python see *note Emulating buffer types: 2411.

   - on the consumer side, several means are available to obtain a
     pointer to the raw underlying data of an object (for example a
     method parameter).  For Python see *note memoryview: 165.

*note bytes: 192. や *note bytearray: 344. などのシンプルなオブジェクト
は、内部のバッファーをバイト列の形式で公開します。 バイト列以外の形式も
利用可能です。例えば、 *note array.array: 4be. が公開する要素はマルチバ
イト値になることがあります。

bufferインターフェースの利用者の一例は、ファイルオブジェクトの *note
write(): ed7. メソッドです: bufferインターフェースを通して一連のバイト列
を提供できるどんなオブジェクトでもファイルに書き込むことができます。
‘write()’ は、その引数として渡されたオブジェクトの内部要素に対する読み出
し専用アクセスのみを必要としますが、 *note readinto(): 1895. のような他
のメソッドでは、その引数の内容に対する書き込みアクセスが必要です。
bufferインターフェースにより、オブジェクトは読み書き両方、読み出し専用バ
ッファへのアクセスを許可するかそれとも拒否するか選択することができます。

bufferインターフェースの利用者には、対象となるオブジェクトのバッファを得
る二つの方法があります:

   * 正しい引数で *note PyObject_GetBuffer(): 63a. を呼び出す;

   * *note PyArg_ParseTuple(): 3c1. (またはその同族のひとつ) を ‘y*’ 、
     ‘w*’ または ‘s*’ *note format codes: 3d5. のいずれかとともに呼び出
     す。

どちらのケースでも、bufferが必要なくなった時に *note PyBuffer_Release():
63b. を呼び出さなければなりません。これを怠ると、リソースリークのような
様々な問題につながる恐れがあります。

Added in version 3.12: The buffer protocol is now accessible in Python,
see *note Emulating buffer types: 2411. and *note memoryview: 165.

* Menu:

* buffer 構造体::
* バッファリクエストのタイプ::
* 複雑な配列::
* バッファ関連の関数::


File: python.info,  Node: buffer 構造体,  Next: バッファリクエストのタイプ,  Up: バッファプロトコル buffer Protocol

7.8.7.1 buffer 構造体
.....................

バッファ構造体（または単純に "buffers"）は別のオブジェクトのバイナリデー
タをPythonプログラマに提供するのに便利です。これはまた、ゼロコピースライ
シング機構としても使用できます。このメモリブロックを参照する機能を使うこ
とで、どんなデータでもとても簡単にPythonプログラマに提供することができま
す。メモリは、C 拡張の大きな配列定数かもしれませんし、オペレーティングシ
ステムライブラリに渡す前のメモリブロックかもしれませんし、構造化データを
ネイティブのインメモリ形式受け渡すのに使用されるかもしれません。

Pythonインタプリタによって提供される多くのデータ型とは異なり、バッファは
*note PyObject: 5df. ポインタではなく、シンプルなC 構造体です。そのため
、作成とコピーが非常に簡単に行えます。バッファの一般的なラッパーが必要な
ときは、 *note memoryview: 52ba. オブジェクトが作成されます。

エクスポートされるオブジェクトを書く方法の短い説明には、 *note Buffer
Object Structures: 1248. を参照してください。バッファを取得するには、
*note PyObject_GetBuffer(): 63a. を参照してください。

 -- C のデータ型: type Py_buffer
     ' 次に属します: *note Stable ABI: 775. (すべてのメンバーを含む) (バ
     ージョン 3.11 より).'
      -- C のメンバ変数: void *buf

          バッファフィールドが表している論理構造の先頭を指すポインタ。 バ
          ッファを提供するオブジェクトの下層物理メモリブロック中のどの位
          置にもなりえます。 例えば *note strides: 52bc. が負だと、この
          値はメモリブロックの末尾かもしれません。

          *note 連続: 124e. 配列の場合この値はメモリブロックの先頭を指し
          ます。

      -- C のメンバ変数: *note PyObject: 5df. *obj

          エクスポート対象オブジェクトへの新しい参照。この参照は消費者に
          よって所有され、自動的に解放されます（つまり、参照カウントが減
          少します）し、設定されます ‘NULL’ by *note PyBuffer_Release():
          63b.  このフィールドは、標準のC-API関数の戻り値に相当します。

          *note PyMemoryView_FromBuffer(): 965. または *note
          PyBuffer_FillInfo(): 964. によってラップされた '一時的な' バッ
          ファである特別なケースでは、このフィールドは ‘NULL’ です。一般
          的に、エクスポートオブジェクトはこの方式を使用してはなりません
          。

      -- C のメンバ変数: *note Py_ssize_t: c55. len

          ‘product(shape) * itemsize’。contiguous配列では、下層のメモリ
          ブロックの長さになります。非contiguous 配列では、contiguous表
          現にコピーされた場合に論理構造がもつ長さです。

          ‘((char *)buf)[0]’ から ‘((char *)buf)[len-1]’ の範囲へのアク
          セスは、連続性 (contiguity) を保証するリクエストによって取得さ
          れたバッファに対してのみ許されます。 多くの場合に、そのような
          リクエストは *note PyBUF_SIMPLE: 4f71. または *note
          PyBUF_WRITABLE: 15cf. です。

      -- C のメンバ変数: int readonly

          バッファが読み出し専用であるか示します。このフィールドは *note
          PyBUF_WRITABLE: 15cf. フラグで制御できます。

      -- C のメンバ変数: *note Py_ssize_t: c55. itemsize

          要素一つ分のbyte単位のサイズ。 *note struct.calcsize(): 1da9.
          を非 ‘NULL’ の *note format: 52c1. 値に対して呼び出した結果と
          同じです。

          重要な例外: 消費者が *note PyBUF_FORMAT: 4f69. フラグを設定す
          ることなくバッファを要求した場合、 ‘format’ は ‘NULL’ に設定さ
          れます。 しかし *note itemsize: 52c0. は元のフォーマットに従っ
          た値を保持します。

          *note shape: 52c2. が存在する場合、 ‘product(shape) * itemsize
          == len’ の等式が守られ、利用者は *note itemsize: 52c0. を
          buffer を読むために利用できます。

          *note PyBUF_SIMPLE: 4f71. または *note PyBUF_WRITABLE: 15cf. で
          要求した結果、 *note shape: 52c2. が ‘NULL’ であれば、消費者は
          *note itemsize: 52c0. を無視して ‘itemsize == 1’ と見なさなけ
          ればなりません。

      -- C のメンバ変数: char *format

          A 'NULL' terminated string in *note struct: db. module style
          syntax describing the contents of a single item.  If this is
          ‘NULL’, ‘"B"’ (unsigned bytes) is assumed.

          このフィールドは *note PyBUF_FORMAT: 4f69. フラグによって制御
          されます。

      -- C のメンバ変数: int ndim

          The number of dimensions the memory represents as an
          n-dimensional array.  If it is ‘0’, *note buf: 52bb. points to
          a single item representing a scalar.  In this case, *note
          shape: 52c2, *note strides: 52bc. and *note suboffsets: 52c4.
          MUST be ‘NULL’.  The maximum number of dimensions is given by
          *note PyBUF_MAX_NDIM: 4f6d.

      -- C のメンバ変数: *note Py_ssize_t: c55. *shape

          メモリ上のN次元配列の形を示す、長さが *note ndim: 52c3. である
          *note Py_ssize_t: c55. の配列です。 ‘shape[0] * ... *
          shape[ndim-1] * itemsize’ は *note len: 52be. と等しくなければ
          なりません。

          shape の値は ‘shape[n] >= 0’ に制限されます。 ‘shape[n] == 0’
          の場合に特に注意が必要です。 詳細は *note complex arrays:
          52c5. を参照してください。

          shepe (形状) 配列は利用者からは読み出し専用です。

      -- C のメンバ変数: *note Py_ssize_t: c55. *strides

          各次元において新しい値を得るためにスキップするバイト数を示す、
          長さ *note ndim: 52c3. の *note Py_ssize_t: c55. の配列。

          ストライド値は、任意の整数を指定できます。規定の配列では、スト
          ライドは通常でいけば有効です。しかし利用者は、‘strides[n] <=
          0’ のケースを処理することができる必要があります。詳細について
          は *note complex arrays: 52c5. を参照してください。

          消費者にとって、この strides 配列は読み出し専用です。

      -- C のメンバ変数: *note Py_ssize_t: c55. *suboffsets

          *note Py_ssize_t: c55. 型の要素を持つ長さ *note ndim: 52c3. の
          配列。 ‘suboffsets[n] >= 0’ の場合は、 n 番目の次元に沿って保
          存されている値はポインタで、 suboffset 値は各ポインタの参照を
          解決した後に何バイト加えればいいかを示しています。 suboffset の
          値が負の数の場合は、ポインタの参照解決は不要 (連続したメモリブ
          ロック内に直接配置されいる) ということになります。

          全ての suboffset が負数の場合 (つまり参照解決が不要) な場合、
          このフィールドは ‘NULL’ (デフォルト値) でなければなりません。

          この種の配列表現は Python Imaging Library (PIL) で使われていま
          す。 このような配列で要素にアクセスする方法についてさらに詳し
          ことは *note complex arrays: 52c5. を参照してください。

          消費者にとって、suboffsets 配列は読み出し専用です。

      -- C のメンバ変数: void *internal

          バッファを提供する側のオブジェクトが内部的に利用するための変数
          です。例えば、提供側はこの変数に整数型をキャストして、shape,
          strides, suboffsets といった配列をバッファを開放するときに同時
          に解放するべきかどうかを管理するフラグに使うことができるでしょ
          う。バッファを受け取る側は、この値を決して変更してはなりません
          。

Constants:

 -- C のマクロ: PyBUF_MAX_NDIM
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'
     The maximum number of dimensions the memory represents.  Exporters
     MUST respect this limit, consumers of multi-dimensional buffers
     SHOULD be able to handle up to ‘PyBUF_MAX_NDIM’ dimensions.
     Currently set to 64.


File: python.info,  Node: バッファリクエストのタイプ,  Next: 複雑な配列,  Prev: buffer 構造体,  Up: バッファプロトコル buffer Protocol

7.8.7.2 バッファリクエストのタイプ
..................................

バッファは通常、 *note PyObject_GetBuffer(): 63a. を使うことで、エクスポ
ートするオブジェクトにバッファリクエストを送ることで得られます。メモリの
論理的な構造の複雑性は多岐にわたるため、消費者は 'flags' 引数を使って、
自身が扱えるバッファの種類を指定します。

*note Py_buffer: 95c. の全フィールドは、リクエストの種類によって曖昧さを
残さずに定義されます。

* Menu:

* リクエストに依存しないフィールド::
* readonly, format: readonly format.
* shape, strides, suboffsets: shape strides suboffsets.
* 隣接性のリクエスト::
* 複合リクエスト::


File: python.info,  Node: リクエストに依存しないフィールド,  Next: readonly format,  Up: バッファリクエストのタイプ

7.8.7.3 リクエストに依存しないフィールド
........................................

下記のフィールドは 'flags' の影響を受けずに、常に正しい値で設定されます
。: *note obj: 52bd, *note buf: 52bb, *note len: 52be, *note itemsize:
52c0, *note ndim: 52c3.


File: python.info,  Node: readonly format,  Next: shape strides suboffsets,  Prev: リクエストに依存しないフィールド,  Up: バッファリクエストのタイプ

7.8.7.4 readonly, format
........................

      -- C のマクロ: PyBUF_WRITABLE
          ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より
          ).'  Controls the *note readonly: 52bf. field.  If set, the
          exporter MUST provide a writable buffer or else report
          failure.  Otherwise, the exporter MAY provide either a
          read-only or writable buffer, but the choice MUST be
          consistent for all consumers.  For example, *note
          PyBUF_SIMPLE: 4f71. | *note PyBUF_WRITABLE: 15cf. can be used
          to request a simple writable buffer.

      -- C のマクロ: PyBUF_WRITEABLE

          This is a *note soft deprecated: 23d. alias to *note
          PyBUF_WRITABLE: 15cf.

      -- C のマクロ: PyBUF_FORMAT
          ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より
          ).'  *note format: 52c1. フィールドを制御します。もしフラグが
          設定されていれば、このフィールドを正しく埋めなければなりません
          。フラグが設定されていなければ、このフィールドを ‘NULL’ に設定
          しなければなりません。

*note PyBUF_WRITABLE: 15cf. は、次の節に出てくるどのフラグとも | を取っ
てかまいません。 *note PyBUF_SIMPLE: 4f71. は 0 と定義されているので、
*note PyBUF_WRITABLE: 15cf. は単純な書き込み可能なバッファを要求する単独
のフラグとして使えます。

*note PyBUF_FORMAT: 4f69. must be |'d to any of the flags except *note
PyBUF_SIMPLE: 4f71, because the latter already implies format ‘B’
(unsigned bytes).  ‘PyBUF_FORMAT’ cannot be used on its own.


File: python.info,  Node: shape strides suboffsets,  Next: 隣接性のリクエスト,  Prev: readonly format,  Up: バッファリクエストのタイプ

7.8.7.5 shape, strides, suboffsets
..................................

このフラグは、以下で複雑性が大きい順に並べたメモリの論理的な構造を制御し
ます。個々のフラグは、それより下に記載されたフラグのすべてのビットを含む
ことに注意してください。

リクエスト                        shape       strides       suboffsets
                                                            
-----------------------------------------------------------------------------
                                                            
 -- C のマクロ: PyBUF_INDIRECT    yes         yes           必要な場合
     ' 次に属します:                                        
     *note Stable ABI: 775. (バ
     ージョン 3.11 より).'

 -- C のマクロ: PyBUF_STRIDES     yes         yes           NULL
     ' 次に属します:                                        
     *note Stable ABI: 775. (バ
     ージョン 3.11 より).'

 -- C のマクロ: PyBUF_ND          yes         NULL          NULL
     ' 次に属します:                                        
     *note Stable ABI: 775. (バ
     ージョン 3.11 より).'

 -- C のマクロ: PyBUF_SIMPLE      NULL        NULL          NULL
     ' 次に属します:                                        
     *note Stable ABI: 775. (バ
     ージョン 3.11 より).'


File: python.info,  Node: 隣接性のリクエスト,  Next: 複合リクエスト,  Prev: shape strides suboffsets,  Up: バッファリクエストのタイプ

7.8.7.6 隣接性のリクエスト
..........................

ストライドの情報があってもなくても、C または Fortran の *note 連続性:
124e. が明確に要求される可能性があります。 ストライド情報なしに、バッフ
ァーは C と隣接している必要があります。

リクエスト                              shape       strides       suboffsets       contig
                                                                                   
------------------------------------------------------------------------------------------------
                                                                                   
 -- C のマクロ: PyBUF_C_CONTIGUOUS      yes         yes           NULL             C
     ' 次に属します:                                                               
     *note Stable ABI: 775. (バージョ
     ン 3.11 より).'

 -- C のマクロ: PyBUF_F_CONTIGUOUS      yes         yes           NULL             F
     ' 次に属します:                                                               
     *note Stable ABI: 775. (バージョ
     ン 3.11 より).'

 -- C のマクロ: PyBUF_ANY_CONTIGUOUS    yes         yes           NULL             C か F
     ' 次に属します:                                                               
     *note Stable ABI: 775. (バージョ
     ン 3.11 より).'

*note PyBUF_ND: 4f6e.                   yes         NULL          NULL             C
                                                                                   


File: python.info,  Node: 複合リクエスト,  Prev: 隣接性のリクエスト,  Up: バッファリクエストのタイプ

7.8.7.7 複合リクエスト
......................

有り得る全てのリクエストの値は、前の節でのフラグの組み合わせで網羅的に定
義されています。 便利なように、バッファープロトコルでは頻繁に使用される
組み合わせを単一のフラグとして提供してます。

次のテーブルの 'U' は連続性が未定義であることを表します。 利用者は *note
PyBuffer_IsContiguous(): 962. を呼び出して連続性を判定する必要があるでし
ょう。

リクエスト                          shape       strides       suboffsets       contig       readonly       format
                                                                                                           
------------------------------------------------------------------------------------------------------------------------
                                                                                                           
 -- C のマクロ: PyBUF_FULL          yes         yes           必要な場合       U            0              yes
     ' 次に属します:                                                                                       
     *note Stable ABI: 775. (バー
     ジョン 3.11 より).'

 -- C のマクロ: PyBUF_FULL_RO       yes         yes           必要な場合       U            1 か 0         yes
     ' 次に属します:                                                                                       
     *note Stable ABI: 775. (バー
     ジョン 3.11 より).'

 -- C のマクロ: PyBUF_RECORDS       yes         yes           NULL             U            0              yes
     ' 次に属します:                                                                                       
     *note Stable ABI: 775. (バー
     ジョン 3.11 より).'

 -- C のマクロ: PyBUF_RECORDS_RO    yes         yes           NULL             U            1 か 0         yes
     ' 次に属します:                                                                                       
     *note Stable ABI: 775. (バー
     ジョン 3.11 より).'

 -- C のマクロ: PyBUF_STRIDED       yes         yes           NULL             U            0              NULL
     ' 次に属します:                                                                                       
     *note Stable ABI: 775. (バー
     ジョン 3.11 より).'

 -- C のマクロ: PyBUF_STRIDED_RO    yes         yes           NULL             U            1 か 0         NULL
     ' 次に属します:                                                                                       
     *note Stable ABI: 775. (バー
     ジョン 3.11 より).'

 -- C のマクロ: PyBUF_CONTIG        yes         NULL          NULL             C            0              NULL
     ' 次に属します:                                                                                       
     *note Stable ABI: 775. (バー
     ジョン 3.11 より).'

 -- C のマクロ: PyBUF_CONTIG_RO     yes         NULL          NULL             C            1 か 0         NULL
     ' 次に属します:                                                                                       
     *note Stable ABI: 775. (バー
     ジョン 3.11 より).'


File: python.info,  Node: 複雑な配列,  Next: バッファ関連の関数,  Prev: バッファリクエストのタイプ,  Up: バッファプロトコル buffer Protocol

7.8.7.8 複雑な配列
..................

* Menu:

* NumPy スタイル; shape, strides: NumPy スタイル shape strides.
* PIL スタイル; shape, strides, suboffsets: PIL スタイル shape strides suboffsets.


File: python.info,  Node: NumPy スタイル shape strides,  Next: PIL スタイル shape strides suboffsets,  Up: 複雑な配列

7.8.7.9 NumPy スタイル: shape, strides
......................................

NumPy スタイルの配列の論理的構造は *note itemsize: 52c0, *note ndim:
52c3, *note shape: 52c2, *note strides: 52bc. で定義されます。

‘ndim == 0’ の場合は、 *note buf: 52bb. が指すメモリの場所は、サイズが
*note itemsize: 52c0. のスカラ値として解釈されます。 この場合、 *note
shape: 52c2. と *note strides: 52bc. の両方とも ‘NULL’ です。

*note strides: 52bc. が ‘NULL’ の場合は、配列は標準の n 次元 C 配列とし
て解釈されます。 そうでない場合は、利用者は次のように n 次元配列にアクセ
スしなければなりません:

     ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * strides[n-1];
     item = *((typeof(item) *)ptr);

上記のように、 *note buf: 52bb. はメモリブロック内のどの場所でも指すこと
が可能です。エクスポーターはこの関数を使用することによってバッファの妥当
性を確認出来ます。

     def verify_structure(memlen, itemsize, ndim, shape, strides, offset):
         """Verify that the parameters represent a valid array within
            the bounds of the allocated memory:
                char *mem: start of the physical memory block
                memlen: length of the physical memory block
                offset: (char *)buf - mem
         """
         if offset % itemsize:
             return False
         if offset < 0 or offset+itemsize > memlen:
             return False
         if any(v % itemsize for v in strides):
             return False

         if ndim <= 0:
             return ndim == 0 and not shape and not strides
         if 0 in shape:
             return True

         imin = sum(strides[j]*(shape[j]-1) for j in range(ndim)
                    if strides[j] <= 0)
         imax = sum(strides[j]*(shape[j]-1) for j in range(ndim)
                    if strides[j] > 0)

         return 0 <= offset+imin and offset+imax+itemsize <= memlen


File: python.info,  Node: PIL スタイル shape strides suboffsets,  Prev: NumPy スタイル shape strides,  Up: 複雑な配列

7.8.7.10 PIL スタイル: shape, strides, suboffsets
.................................................

PIL スタイルの配列では通常の要素の他に、ある次元の上で次の要素を取得する
ために辿るポインタを持てます。 例えば、通常の3次元 C 配列 ‘char
v[2][2][3]’ は、2次元配列への 2 つのポインタからなる配列 ‘char
(*v[2])[2][3]’ と見ることもできます。 suboffset 表現では、これらの 2 つ
のポインタは *note buf: 52bb. の先頭に埋め込め、メモリのどこにでも配置で
きる 2 つの ‘char x[2][3]’ 配列を指します。

次の例は、 strides も suboffsets も ‘NULL’ でない場合の、N 次元インデッ
クスによって指されている N 次元配列内の要素へのポインタを返す関数です:

     void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,
                            Py_ssize_t *suboffsets, Py_ssize_t *indices) {
         char *pointer = (char*)buf;
         int i;
         for (i = 0; i < ndim; i++) {
             pointer += strides[i] * indices[i];
             if (suboffsets[i] >=0 ) {
                 pointer = *((char**)pointer) + suboffsets[i];
             }
         }
         return (void*)pointer;
     }


File: python.info,  Node: バッファ関連の関数,  Prev: 複雑な配列,  Up: バッファプロトコル buffer Protocol

7.8.7.11 バッファ関連の関数
...........................

 -- C の関数: int PyObject_CheckBuffer (PyObject *obj)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'
     'obj' がbuffer インターフェースをサポートしている場合は ‘1’ を返し
     、そうでない場合は ‘0’ を返します。 ‘1’ を返したとしても、 *note
     PyObject_GetBuffer(): 63a. が成功することは保証されません。 この関
     数は常に成功します。

 -- C の関数: int PyObject_GetBuffer (PyObject *exporter, Py_buffer
          *view, int flags)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'
     'exporter' に 'flags' で指定された方法で 'view' を埋めるように要求
     します。もし exporter が指定されたとおりにバッファを提供できない場
     合、 *note BufferError: 1797. を送出し、 ‘view->obj’ を ‘NULL’ に設
     定した上で、 ‘-1’ を返さなければなりません。

     成功したときは、 'view' を埋め、 ‘view->obj’ に 'exporter' への新し
     い参照を設定し、0を返します。チェイン状のバッファプロバイダがリクエ
     ストを単一のオブジェクトにリダイレクトするケースでは、 ‘view->obj’
     は 'exporter' の代わりにこのオブジェクトを参照します (*note
     バッファオブジェクト構造体: 1248. を参照してください)。

     ‘malloc()’ と ‘free()’ のように、呼び出しに成功した *note
     PyObject_GetBuffer(): 63a. と対になる *note PyBuffer_Release():
     63b. の呼び出しがなけれなればなりません。 従って、バッファの利用が
     済んだら *note PyBuffer_Release(): 63b. が厳密に1回だけ呼び出されな
     ければなりません。

 -- C の関数: void PyBuffer_Release (Py_buffer *view)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'
     Release the buffer 'view' and release the *note strong reference:
     5e2. (i.e.  decrement the reference count) to the view's supporting
     object, ‘view->obj’.  This function MUST be called when the buffer
     is no longer being used, otherwise reference leaks may occur.

     *note PyObject_GetBuffer(): 63a. を通して取得していないバッファに対
     してこの関数を呼び出すのは間違いです。

 -- C の関数: *note Py_ssize_t: c55. PyBuffer_SizeFromFormat (const char
          *format)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'
     Return the implied *note itemsize: 52c0. from *note format: 52c1.
     On error, raise an exception and return -1.

     Added in version 3.9.

 -- C の関数: int PyBuffer_IsContiguous (const Py_buffer *view, char
          order)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'
     'view' で定義されているメモリが、 C スタイル ('order' == ‘'C'’) の
     ときか、 Fortran スタイル ('order' == ‘'F'’) *note 連続: 124e. のと
     きか、そのいずれか ('order' == ‘'A'’) であれば ‘1’ を返します。 そ
     れ以外の場合は ‘0’ を返します。 この関数は常に成功します。

 -- C の関数: void *PyBuffer_GetPointer (const Py_buffer *view, const
          Py_ssize_t *indices)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'  与
     えられた 'view' 内にある 'indices' が指すメモリ領域を取得します。
     'indices' は ‘view->ndim’ 個のインデックスからなる配列を指していな
     ければなりません。

 -- C の関数: int PyBuffer_FromContiguous (const Py_buffer *view, const
          void *buf, Py_ssize_t len, char fort)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'  連
     続する 'len' バイトを 'buf' から 'view' にコピーします。'fort' には
     ‘'C'’ か ‘'F'’ を指定できます（それぞれC言語スタイルとFortranスタイ
     ルの順序を表します)。成功時には ‘0’、エラー時には ‘-1’ を返します。

 -- C の関数: int PyBuffer_ToContiguous (void *buf, const Py_buffer
          *src, Py_ssize_t len, char order)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'
     'src' から 'len' バイトを連続表現で 'buf' 上にコピーします。
     'order' は ‘'C'’ または ‘'F'’ または ‘'A'’ (C スタイル順序または
     Fortran スタイル順序またはそれ以外) が指定できます。 成功したら ‘0’
     が返り、エラーなら ‘-1’ が返ります。

     'len' != 'src->len' の場合、この関数は失敗します。

 -- C の関数: int PyObject_CopyData (PyObject *dest, PyObject *src)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'
     Copy data from 'src' to 'dest' buffer.  Can convert between C-style
     and or Fortran-style buffers.

     成功したら ‘0’ が、エラー時には ‘-1’ が返されます。

 -- C の関数: void PyBuffer_FillContiguousStrides (int ndims, Py_ssize_t
          *shape, Py_ssize_t *strides, int itemsize, char order)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'
     'strides' 配列を、 'itemsize' の大きさの要素がバイト単位の、
     'shape' の形をした *note 連続な: 124e. ('order' が ‘'C'’ なら
     C-style 、 ‘'F'’ なら Fortran-style の) 多次元配列として埋める。

 -- C の関数: int PyBuffer_FillInfo (Py_buffer *view, PyObject
          *exporter, void *buf, Py_ssize_t len, int readonly, int flags)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'  サ
     イズが 'len' の 'buf' を 'readonly' に従った書き込み可/不可の設定で
     公開するバッファリクエストを処理します。 'buf' は符号無しバイトの列
     として解釈されます。

     'flags' 引数はリクエストのタイプを示します。 この関数は、 'buf' が
     読み出し専用と指定されていて、 'flags' に *note PyBUF_WRITABLE:
     15cf. が設定されていない限り、常にフラグに指定された通りに 'view' を
     埋めます。

     On success, set ‘view->obj’ to a new reference to 'exporter' and
     return 0.  Otherwise, raise *note BufferError: 1797, set
     ‘view->obj’ to ‘NULL’ and return ‘-1’;

     この関数を *note getbufferproc: 1248. の一部として使う場合には、
     'exporter' はエクスポートするオブジェクトに設定しなければならず、さ
     らに 'flags' は変更せずに渡さなければなりません。 そうでない場合は
     、 'exporter' は ‘NULL’ でなければなりません。


File: python.info,  Node: 具象オブジェクト concrete object レイヤ,  Next: 初期化 initialization 、終了処理 finalization 、スレッド,  Prev: 抽象オブジェクトレイヤ Abstract Objects Layer,  Up: Python/C API リファレンスマニュアル

7.9 具象オブジェクト (concrete object) レイヤ
=============================================

この章では、特定の Python オブジェクト型固有の関数について述べています。
これらの関数に間違った型のオブジェクトを渡すのは良い考えではありません;
Python プログラムから何らかのオブジェクトを受け取ったとき、そのオブジェ
クトが正しい型になっているか確信をもてないのなら、まず型チェックを行わな
ければなりません; 例えば、あるオブジェクトが辞書型か調べるには、 *note
PyDict_Check(): 52d5. を使います。この章は Python のオブジェクト型におけ
る "家計図" に従って構成されています。

     警告: この章で述べている関数は、渡されたオブジェクトの型を注意深く
     チェックしはするものの、多くの関数は渡されたオブジェクトが有効な
     ‘NULL’ なのか有効なオブジェクトなのかをチェックしません。これらの関
     数に ‘NULL’ を渡させてしまうと、関数はメモリアクセス違反を起こして
     、インタプリタを即座に終了させてしまうはずです。

* Menu:

* 基本オブジェクト (fundamental object): 基本オブジェクト fundamental object.
* 数値型オブジェクト (numeric object): 数値型オブジェクト numeric object.
* シーケンスオブジェクト (sequence object): シーケンスオブジェクト sequence object.
* Container オブジェクト::
* Function オブジェクト: Function オブジェクト<2>.
* その他のオブジェクト: その他のオブジェクト<2>.
* C API for extension modules::


File: python.info,  Node: 基本オブジェクト fundamental object,  Next: 数値型オブジェクト numeric object,  Up: 具象オブジェクト concrete object レイヤ

7.9.1 基本オブジェクト (fundamental object)
-------------------------------------------

この節では、Python の型オブジェクトとシングルトン(singleton)オブジェクト
‘None’ について述べます。

* Menu:

* 型オブジェクト: 型オブジェクト<2>.
* None オブジェクト::


File: python.info,  Node: 型オブジェクト<2>,  Next: None オブジェクト,  Up: 基本オブジェクト fundamental object

7.9.1.1 型オブジェクト
......................

 -- C のデータ型: type PyTypeObject
     ' 次に属します: *note Limited API: 775. (不透明な構造体として).'  組
     み込み型を記述する際に用いられる、オブジェクトを表す C 構造体です。

 -- C 変数: *note PyTypeObject: c9c. PyType_Type
     ' 次に属します: *note Stable ABI: 775.'  型オブジェクト自身の型オブ
     ジェクトです。Python レイヤにおける *note type: f44. と同じオブジェ
     クトです。

 -- C の関数: int PyType_Check (PyObject *o)

     Return non-zero if the object 'o' is a type object, including
     instances of types derived from the standard type object.  Return 0
     in all other cases.  This function always succeeds.

 -- C の関数: int PyType_CheckExact (PyObject *o)

     Return non-zero if the object 'o' is a type object, but not a
     subtype of the standard type object.  Return 0 in all other cases.
     This function always succeeds.

 -- C の関数: unsigned int PyType_ClearCache ()
     ' 次に属します: *note Stable ABI: 775.'  内部の検索キャッシュをクリ
     アします。現在のバージョンタグを返します。

 -- C の関数: unsigned long PyType_GetFlags (PyTypeObject *type)
     ' 次に属します: *note Stable ABI: 775.'  Return the *note tp_flags:
     1c71. member of 'type'.  This function is primarily meant for use
     with ‘Py_LIMITED_API’; the individual flag bits are guaranteed to
     be stable across Python releases, but access to *note tp_flags:
     1c71. itself is not part of the *note limited API: 637.

     Added in version 3.2.

     バージョン 3.4 で変更: 返り値の型が ‘long’ ではなく ‘unsigned long’
     になりました。

 -- C の関数: *note PyObject: 5df. *PyType_GetDict (PyTypeObject *type)

     Return the type object's internal namespace, which is otherwise
     only exposed via a read-only proxy (*note cls.__dict__: e57.).
     This is a replacement for accessing *note tp_dict: 1a8c. directly.
     The returned dictionary must be treated as read-only.

     This function is meant for specific embedding and language-binding
     cases, where direct access to the dict is necessary and indirect
     access (e.g.  via the proxy or *note PyObject_GetAttr(): 5ee.)
     isn't adequate.

     Extension modules should continue to use ‘tp_dict’, directly or
     indirectly, when setting up their own types.

     Added in version 3.12.

 -- C の関数: void PyType_Modified (PyTypeObject *type)
     ' 次に属します: *note Stable ABI: 775.'  内部の検索キャッシュを、そ
     の type とすべてのサブタイプに対して無効にします。この関数は type の
     属性や基底クラス列を変更したあとに手動で呼び出さなければなりません
     。

 -- C の関数: int PyType_AddWatcher (PyType_WatchCallback callback)

     Register 'callback' as a type watcher.  Return a non-negative
     integer ID which must be passed to future calls to *note
     PyType_Watch(): 786.  In case of error (e.g.  no more watcher IDs
     available), return ‘-1’ and set an exception.

     In free-threaded builds, *note PyType_AddWatcher(): 785. is not
     thread-safe, so it must be called at start up (before spawning the
     first thread).

     Added in version 3.12.

 -- C の関数: int PyType_ClearWatcher (int watcher_id)

     Clear watcher identified by 'watcher_id' (previously returned from
     *note PyType_AddWatcher(): 785.).  Return ‘0’ on success, ‘-1’ on
     error (e.g.  if 'watcher_id' was never registered.)

     An extension should never call ‘PyType_ClearWatcher’ with a
     'watcher_id' that was not returned to it by a previous call to
     *note PyType_AddWatcher(): 785.

     Added in version 3.12.

 -- C の関数: int PyType_Watch (int watcher_id, PyObject *type)

     Mark 'type' as watched.  The callback granted 'watcher_id' by *note
     PyType_AddWatcher(): 785. will be called whenever *note
     PyType_Modified(): 1b7b. reports a change to 'type'.  (The callback
     may be called only once for a series of consecutive modifications
     to 'type', if ‘_PyType_Lookup()’ is not called on 'type' between
     the modifications; this is an implementation detail and subject to
     change.)

     An extension should never call ‘PyType_Watch’ with a 'watcher_id'
     that was not returned to it by a previous call to *note
     PyType_AddWatcher(): 785.

     Added in version 3.12.

 -- C の関数: int PyType_Unwatch (int watcher_id, PyObject *type)

     Mark 'type' as not watched.  This undoes a previous call to *note
     PyType_Watch(): 786.  'type' must not be ‘NULL’.

     An extension should never call this function with a 'watcher_id'
     that was not returned to it by a previous call to *note
     PyType_AddWatcher(): 785.

     On success, this function returns ‘0’.  On failure, this function
     returns ‘-1’ with an exception set.

     Added in version 3.12.

 -- C のデータ型: typedef int (*PyType_WatchCallback)(*note PyObject:
          5df. *type)

     Type of a type-watcher callback function.

     The callback must not modify 'type' or cause *note
     PyType_Modified(): 1b7b. to be called on 'type' or any type in its
     MRO; violating this rule could cause infinite recursion.

     Added in version 3.12.

 -- C の関数: int PyType_HasFeature (PyTypeObject *o, int feature)

     Return non-zero if the type object 'o' sets the feature 'feature'.
     Type features are denoted by single bit flags.

 -- C の関数: int PyType_FastSubclass (PyTypeObject *type, int flag)

     Return non-zero if the type object 'type' sets the subclass flag
     'flag'.  Subclass flags are denoted by *note Py_TPFLAGS_*_SUBCLASS:
     52df.  This function is used by many ‘_Check’ functions for common
     types.

     参考
     ....

     *note PyObject_TypeCheck(): 1cb5, which is used as a slower
     alternative in ‘_Check’ functions for types that don't come with
     subclass flags.

 -- C の関数: int PyType_IS_GC (PyTypeObject *o)

     Return true if the type object includes support for the cycle
     detector; this tests the type flag *note Py_TPFLAGS_HAVE_GC: 981.

 -- C の関数: int PyType_IsSubtype (PyTypeObject *a, PyTypeObject *b)
     ' 次に属します: *note Stable ABI: 775.'  'a' が 'b' のサブタイプの
     場合に真を返します。

     This function only checks for actual subtypes, which means that
     *note __subclasscheck__(): 23c7. is not called on 'b'.  Call *note
     PyObject_IsSubclass(): 10a7. to do the same check that *note
     issubclass(): 9c4. would do.

 -- C の関数: *note PyObject: 5df. *PyType_GenericAlloc (PyTypeObject
          *type, Py_ssize_t nitems)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Generic handler for the *note tp_alloc: 4ed0. slot of a type
     object.  Uses Python's default memory allocation mechanism to
     allocate memory for a new instance, zeros the memory, then
     initializes the memory as if by calling *note PyObject_Init(): c60.
     or *note PyObject_InitVar(): 1d40.

     Do not call this directly to allocate memory for an object; call
     the type's *note tp_alloc: 4ed0. slot instead.

     For types that support garbage collection (i.e., the *note
     Py_TPFLAGS_HAVE_GC: 981. flag is set), this function behaves like
     *note PyObject_GC_New: c99. or *note PyObject_GC_NewVar: c9a.
     (except the memory is guaranteed to be zeroed before
     initialization), and should be paired with *note PyObject_GC_Del():
     171c. in *note tp_free: 4ecf.  Otherwise, it behaves like *note
     PyObject_New: b7c. or *note PyObject_NewVar: b7d. (except the
     memory is guaranteed to be zeroed before initialization) and should
     be paired with *note PyObject_Free(): e60. in *note tp_free: 4ecf.

 -- C の関数: *note PyObject: 5df. *PyType_GenericNew (PyTypeObject
          *type, PyObject *args, PyObject *kwds)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Generic handler for the *note tp_new: 79f. slot of a type object.
     Creates a new instance using the type's *note tp_alloc: 4ed0. slot
     and returns the resulting object.

 -- C の関数: int PyType_Ready (PyTypeObject *type)
     ' 次に属します: *note Stable ABI: 775.'  型オブジェクトのファイナラ
     イズを行います。この関数は全てのオブジェクトで初期化を完了するため
     に呼び出されなくてはなりません。この関数は、基底クラス型から継承し
     たスロットを型オブジェクトに追加する役割があります。成功した場合に
     は ‘0’ を返し、エラーの場合には ‘-1’ を返して例外情報を設定します。

          注釈: If some of the base classes implements the GC protocol
          and the provided type does not include the *note
          Py_TPFLAGS_HAVE_GC: 981. in its flags, then the GC protocol
          will be automatically implemented from its parents.  On the
          contrary, if the type being created does include *note
          Py_TPFLAGS_HAVE_GC: 981. in its flags then it 'must' implement
          the GC protocol itself by at least implementing the *note
          tp_traverse: 982. handle.

 -- C の関数: *note PyObject: 5df. *PyType_GetName (PyTypeObject *type)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.11 より).'  Return the type's name.  Equivalent to getting
     the type's *note __name__: 16c4. attribute.

     Added in version 3.11.

 -- C の関数: *note PyObject: 5df. *PyType_GetQualName (PyTypeObject
          *type)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.11 より).'  Return the type's qualified name.  Equivalent
     to getting the type's *note __qualname__: 2373. attribute.

     Added in version 3.11.

 -- C の関数: *note PyObject: 5df. *PyType_GetFullyQualifiedName
          (PyTypeObject *type)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Return the type's fully qualified name.  Equivalent to
     ‘f"{type.__module__}.{type.__qualname__}"’, or *note
     type.__qualname__: 2373. if *note type.__module__: 617. is not a
     string or is equal to ‘"builtins"’.

     Added in version 3.13.

 -- C の関数: *note PyObject: 5df. *PyType_GetModuleName (PyTypeObject
          *type)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Return the type's module name.  Equivalent to getting the *note
     type.__module__: 617. attribute.

     Added in version 3.13.

 -- C の関数: void *PyType_GetSlot (PyTypeObject *type, int slot)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.4 より).'  与
     えられたスロットに格納されている関数ポインタを返します。返り値が
     ‘NULL’ の場合は、スロットが ‘NULL’ か、関数が不正な引数で呼ばれたこ
     とを示します。通常、呼び出し側は返り値のポインタを適切な関数型にキ
     ャストします。

     See *note PyType_Slot.slot: 52e1. for possible values of the 'slot'
     argument.

     Added in version 3.4.

     バージョン 3.10 で変更: *note PyType_GetSlot(): a9c. can now accept
     all types.  Previously, it was limited to *note heap types: b5e.

 -- C の関数: *note PyObject: 5df. *PyType_GetModule (PyTypeObject
          *type)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Return the module object associated with the given type when the
     type was created using *note PyType_FromModuleAndSpec(): 773.

     If no module is associated with the given type, sets *note
     TypeError: 198. and returns ‘NULL’.

     This function is usually used to get the module in which a method
     is defined.  Note that in such a method,
     ‘PyType_GetModule(Py_TYPE(self))’ may not return the intended
     result.  ‘Py_TYPE(self)’ may be a 'subclass' of the intended class,
     and subclasses are not necessarily defined in the same module as
     their superclass.  See *note PyCMethod: 968. to get the class that
     defines the method.  See *note PyType_GetModuleByDef(): 635. for
     cases when ‘PyCMethod’ cannot be used.

     Added in version 3.9.

 -- C の関数: void *PyType_GetModuleState (PyTypeObject *type)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Return the state of the module object associated with the given
     type.  This is a shortcut for calling *note PyModule_GetState():
     b77. on the result of *note PyType_GetModule(): b66.

     If no module is associated with the given type, sets *note
     TypeError: 198. and returns ‘NULL’.

     If the 'type' has an associated module but its state is ‘NULL’,
     returns ‘NULL’ without setting an exception.

     Added in version 3.9.

 -- C の関数: *note PyObject: 5df. *PyType_GetModuleByDef (PyTypeObject
          *type, struct PyModuleDef *def)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.13 より).'  Find the first superclass whose module was
     created from the given *note PyModuleDef: b74. 'def', and return
     that module.

     If no module is found, raises a *note TypeError: 198. and returns
     ‘NULL’.

     This function is intended to be used together with *note
     PyModule_GetState(): b77. to get module state from slot methods
     (such as *note tp_init: 7a1. or *note nb_add: 52e2.) and other
     places where a method's defining class cannot be passed using the
     *note PyCMethod: 968. calling convention.

     The returned reference is *note borrowed: 3d7. from 'type', and
     will be valid as long as you hold a reference to 'type'.  Do not
     release it with *note Py_DECREF(): 790. or similar.

     Added in version 3.11.

 -- C の関数: int PyType_GetBaseByToken (PyTypeObject *type, void
          *token, PyTypeObject **result)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Find the first superclass in 'type"s *note method resolution order:
     25df. whose *note Py_tp_token: 3b1. token is equal to the given
     one.

        * If found, set '*result' to a new *note strong reference: 5e2.
          to it and return ‘1’.

        * If not found, set '*result' to ‘NULL’ and return ‘0’.

        * On error, set '*result' to ‘NULL’ and return ‘-1’ with an
          exception set.

     The 'result' argument may be ‘NULL’, in which case '*result' is not
     set.  Use this if you need only the return value.

     The 'token' argument may not be ‘NULL’.

     Added in version 3.14.

 -- C の関数: int PyUnstable_Type_AssignVersionTag (PyTypeObject *type)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Attempt to assign a version tag to the given type.

     Returns 1 if the type already had a valid version tag or a new one
     was assigned, or 0 if a new tag could not be assigned.

     Added in version 3.12.

 -- C の関数: int PyType_SUPPORTS_WEAKREFS (PyTypeObject *type)

     Return true if instances of 'type' support creating weak
     references, false otherwise.  This function always succeeds.
     'type' must not be ‘NULL’.

     参考
     ....

        * *note 弱参照オブジェクト: 528f.

        * *note weakref: 11a.

* Menu:

* Creating Heap-Allocated Types::


File: python.info,  Node: Creating Heap-Allocated Types,  Up: 型オブジェクト<2>

7.9.1.2 Creating Heap-Allocated Types
.....................................

The following functions and structs are used to create *note heap types:
b5e.

 -- C の関数: *note PyObject: 5df. *PyType_FromMetaclass (PyTypeObject
          *metaclass, PyObject *module, PyType_Spec *spec, PyObject
          *bases)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'
     Create and return a *note heap type: b5e. from the 'spec' (see
     *note Py_TPFLAGS_HEAPTYPE: aac.).

     The metaclass 'metaclass' is used to construct the resulting type
     object.  When 'metaclass' is ‘NULL’, the metaclass is derived from
     'bases' (or 'Py_tp_base[s]' slots if 'bases' is ‘NULL’, see below).

     Metaclasses that override *note tp_new: 79f. are not supported,
     except if ‘tp_new’ is ‘NULL’.

     The 'bases' argument can be used to specify base classes; it can
     either be only one class or a tuple of classes.  If 'bases' is
     ‘NULL’, the *note Py_tp_bases: 5183. slot is used instead.  If that
     also is ‘NULL’, the *note Py_tp_base: 5182. slot is used instead.
     If that also is ‘NULL’, the new type derives from *note object:
     c7e.

     The 'module' argument can be used to record the module in which the
     new class is defined.  It must be a module object or ‘NULL’.  If
     not ‘NULL’, the module is associated with the new type and can
     later be retrieved with *note PyType_GetModule(): b66.  The
     associated module is not inherited by subclasses; it must be
     specified for each class individually.

     This function calls *note PyType_Ready(): 980. on the new type.

     Note that this function does 'not' fully match the behavior of
     calling *note type(): f44. or using the *note class: 14ef.
     statement.  With user-provided base types or metaclasses, prefer
     *note calling: 5294. *note type: f44. (or the metaclass) over
     ‘PyType_From*’ functions.  Specifically:

        * *note __new__(): 7a0. is not called on the new class (and it
          must be set to ‘type.__new__’).

        * *note __init__(): 8bf. is not called on the new class.

        * *note __init_subclass__(): 843. is not called on any bases.

        * *note __set_name__(): e48. is not called on new descriptors.

     Added in version 3.12.

 -- C の関数: *note PyObject: 5df. *PyType_FromModuleAndSpec (PyObject
          *module, PyType_Spec *spec, PyObject *bases)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.10 より).'  Equivalent to ‘PyType_FromMetaclass(NULL,
     module, spec, bases)’.

     Added in version 3.9.

     バージョン 3.10 で変更: The function now accepts a single class as
     the 'bases' argument and ‘NULL’ as the ‘tp_doc’ slot.

     バージョン 3.12 で変更: The function now finds and uses a metaclass
     corresponding to the provided base classes.  Previously, only *note
     type: f44. instances were returned.

     The *note tp_new: 79f. of the metaclass is 'ignored'.  which may
     result in incomplete initialization.  Creating classes whose
     metaclass overrides *note tp_new: 79f. is deprecated.

     バージョン 3.14 で変更: Creating classes whose metaclass overrides
     *note tp_new: 79f. is no longer allowed.

 -- C の関数: *note PyObject: 5df. *PyType_FromSpecWithBases
          (PyType_Spec *spec, PyObject *bases)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.3 より).'  Equivalent to ‘PyType_FromMetaclass(NULL, NULL,
     spec, bases)’.

     Added in version 3.3.

     バージョン 3.12 で変更: The function now finds and uses a metaclass
     corresponding to the provided base classes.  Previously, only *note
     type: f44. instances were returned.

     The *note tp_new: 79f. of the metaclass is 'ignored'.  which may
     result in incomplete initialization.  Creating classes whose
     metaclass overrides *note tp_new: 79f. is deprecated.

     バージョン 3.14 で変更: Creating classes whose metaclass overrides
     *note tp_new: 79f. is no longer allowed.

 -- C の関数: *note PyObject: 5df. *PyType_FromSpec (PyType_Spec *spec)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Equivalent to ‘PyType_FromMetaclass(NULL, NULL, spec, NULL)’.

     バージョン 3.12 で変更: The function now finds and uses a metaclass
     corresponding to the base classes provided in 'Py_tp_base[s]'
     slots.  Previously, only *note type: f44. instances were returned.

     The *note tp_new: 79f. of the metaclass is 'ignored'.  which may
     result in incomplete initialization.  Creating classes whose
     metaclass overrides *note tp_new: 79f. is deprecated.

     バージョン 3.14 で変更: Creating classes whose metaclass overrides
     *note tp_new: 79f. is no longer allowed.

 -- C の関数: int PyType_Freeze (PyTypeObject *type)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Make a type immutable: set the *note Py_TPFLAGS_IMMUTABLETYPE: 3cf.
     flag.

     All base classes of 'type' must be immutable.

     On success, return ‘0’.  On error, set an exception and return
     ‘-1’.

     The type must not be used before it's made immutable.  For example,
     type instances must not be created before the type is made
     immutable.

     Added in version 3.14.

 -- C のデータ型: type PyType_Spec
     ' 次に属します: *note Stable ABI: 775. (すべてのメンバーを含む).'
     Structure defining a type's behavior.

      -- C のメンバ変数: const char *name

          Name of the type, used to set *note PyTypeObject.tp_name:
          1cb0.

      -- C のメンバ変数: int basicsize

          If positive, specifies the size of the instance in bytes.  It
          is used to set *note PyTypeObject.tp_basicsize: b7e.

          If zero, specifies that *note tp_basicsize: b7e. should be
          inherited.

          If negative, the absolute value specifies how much space
          instances of the class need 'in addition' to the superclass.
          Use *note PyObject_GetTypeData(): 76b. to get a pointer to
          subclass-specific memory reserved this way.  For negative
          ‘basicsize’, Python will insert padding when needed to meet
          *note tp_basicsize: b7e.'s alignment requirements.

          バージョン 3.12 で変更: Previously, this field could not be
          negative.

      -- C のメンバ変数: int itemsize

          Size of one element of a variable-size type, in bytes.  Used
          to set *note PyTypeObject.tp_itemsize: 23bb.  See
          ‘tp_itemsize’ documentation for caveats.

          If zero, *note tp_itemsize: 23bb. is inherited.  Extending
          arbitrary variable-sized classes is dangerous, since some
          types use a fixed offset for variable-sized memory, which can
          then overlap fixed-sized memory used by a subclass.  To help
          prevent mistakes, inheriting ‘itemsize’ is only possible in
          the following situations:

             - The base is not variable-sized (its *note tp_itemsize:
               23bb.).

             - The requested *note PyType_Spec.basicsize: 76a. is
               positive, suggesting that the memory layout of the base
               class is known.

             - The requested *note PyType_Spec.basicsize: 76a. is zero,
               suggesting that the subclass does not access the
               instance's memory directly.

             - With the *note Py_TPFLAGS_ITEMS_AT_END: 76d. flag.

      -- C のメンバ変数: unsigned int flags

          Type flags, used to set *note PyTypeObject.tp_flags: 1c71.

          If the ‘Py_TPFLAGS_HEAPTYPE’ flag is not set, *note
          PyType_FromSpecWithBases(): 79e. sets it automatically.

      -- C のメンバ変数: *note PyType_Slot: 50dc. *slots

          Array of *note PyType_Slot: 50dc. structures.  Terminated by
          the special slot value ‘{0, NULL}’.

          Each slot ID should be specified at most once.

 -- C のデータ型: type PyType_Slot
     ' 次に属します: *note Stable ABI: 775. (すべてのメンバーを含む).'
     Structure defining optional functionality of a type, containing a
     slot ID and a value pointer.

      -- C のメンバ変数: int slot

          A slot ID.

          Slot IDs are named like the field names of the structures
          *note PyTypeObject: c9c, *note PyNumberMethods: 1637, *note
          PySequenceMethods: 4ef4, *note PyMappingMethods: 4ef5. and
          *note PyAsyncMethods: 52ea. with an added ‘Py_’ prefix.  For
          example, use:

             * *note Py_tp_dealloc: 5186. to set *note
               PyTypeObject.tp_dealloc: 4ebc.

             * *note Py_nb_add: 5157. to set *note
               PyNumberMethods.nb_add: 52e2.

             * *note Py_sq_length: 517f. to set *note
               PySequenceMethods.sq_length: 52eb.

          An additional slot is supported that does not correspond to a
          ‘PyTypeObject’ struct field:

             * *note Py_tp_token: 3b1.

          The following “offset” fields cannot be set using *note
          PyType_Slot: 50dc.:

             * *note tp_weaklistoffset: b7f. (use *note
               Py_TPFLAGS_MANAGED_WEAKREF: 77c. instead if possible)

             * *note tp_dictoffset: 52ec. (use *note
               Py_TPFLAGS_MANAGED_DICT: 60f. instead if possible)

             * *note tp_vectorcall_offset: 5296. (use
               ‘"__vectorcalloffset__"’ in *note PyMemberDef: 52ed.)

          If it is not possible to switch to a ‘MANAGED’ flag (for
          example, for vectorcall or to support Python older than 3.12),
          specify the offset in *note Py_tp_members: 5195.  See *note
          PyMemberDef documentation: 52ed. for details.

          The following internal fields cannot be set at all when
          creating a heap type:

             * *note tp_dict: 1a8c, *note tp_mro: 52ee, *note tp_cache:
               52ef, *note tp_subclasses: 792, and *note tp_weaklist:
               52f0.

          Setting *note Py_tp_bases: 5183. or *note Py_tp_base: 5182.
          may be problematic on some platforms.  To avoid issues, use
          the 'bases' argument of *note PyType_FromSpecWithBases(): 79e.
          instead.

          バージョン 3.9 で変更: Slots in *note PyBufferProcs: 52f1. may
          be set in the unlimited API.

          バージョン 3.11 で変更: *note bf_getbuffer: 966. and *note
          bf_releasebuffer: 967. are now available under the *note
          limited API: 637.

          バージョン 3.14 で変更: The field *note tp_vectorcall: 198a.
          can now be set using *note Py_tp_vectorcall: 519e.  See the
          field's documentation for details.

      -- C のメンバ変数: void *pfunc

          The desired value of the slot.  In most cases, this is a
          pointer to a function.

          'pfunc' values may not be ‘NULL’, except for the following
          slots:

             * *note Py_tp_doc: 518a.

             * *note Py_tp_token: 3b1. (for clarity, prefer *note
               Py_TP_USE_SPEC: 5139. rather than ‘NULL’)

 -- C のマクロ: Py_tp_token
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'  A
     *note slot: 52e1. that records a static memory layout ID for a
     class.

     If the *note PyType_Spec: 1a89. of the class is statically
     allocated, the token can be set to the spec using the special value
     *note Py_TP_USE_SPEC: 5139.:

          static PyType_Slot foo_slots[] = {
             {Py_tp_token, Py_TP_USE_SPEC},

     It can also be set to an arbitrary pointer, but you must ensure
     that:

        * The pointer outlives the class, so it's not reused for
          something else while the class exists.

        * It "belongs" to the extension module where the class lives, so
          it will not clash with other extensions.

     Use *note PyType_GetBaseByToken(): 3b0. to check if a class's
     superclass has a given token - that is, check whether the memory
     layout is compatible.

     To get the token for a given class (without considering
     superclasses), use *note PyType_GetSlot(): a9c. with ‘Py_tp_token’.

     Added in version 3.14.

      -- C のマクロ: Py_TP_USE_SPEC
          ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より
          ).'  Used as a value with *note Py_tp_token: 3b1. to set the
          token to the class's *note PyType_Spec: 1a89.  Expands to
          ‘NULL’.

          Added in version 3.14.


File: python.info,  Node: None オブジェクト,  Prev: 型オブジェクト<2>,  Up: 基本オブジェクト fundamental object

7.9.1.3 ‘None’ オブジェクト
...........................

‘None’ に対する *note PyTypeObject: c9c. は、 Python/C API では直接公開
されていないので注意してください。 ‘None’ は単量子 (singleton) なので、
オブジェクトの同一性テスト (C では ‘==’) を使うだけで十分だからです。同
じ理由から、 ‘PyNone_Check()’ 関数はありません。

 -- C 変数: *note PyObject: 5df. *Py_None

     値の欠如を示す、 Python の ‘None’ オブジェクト。このオブジェクトは
     メソッドを持たず、 *note immortal: 290. です。

     バージョン 3.12 で変更: *note Py_None: 4e9f. は *note immortal:
     290. です。

 -- C のマクロ: Py_RETURN_NONE

     関数から *note Py_None: 4e9f. を返します。


File: python.info,  Node: 数値型オブジェクト numeric object,  Next: シーケンスオブジェクト sequence object,  Prev: 基本オブジェクト fundamental object,  Up: 具象オブジェクト concrete object レイヤ

7.9.2 数値型オブジェクト (numeric object)
-----------------------------------------

* Menu:

* 整数型オブジェクト (integer object): 整数型オブジェクト integer object.
* Boolean オブジェクト::
* Floating-Point Objects::
* 複素数オブジェクト::


File: python.info,  Node: 整数型オブジェクト integer object,  Next: Boolean オブジェクト,  Up: 数値型オブジェクト numeric object

7.9.2.1 整数型オブジェクト (integer object)
...........................................

すべての整数は任意の長さをもつ "long" 整数として実装されます。

エラーが起きると、ほとんどの ‘PyLong_As*’ API は ‘(return type)-1’ を返
しますが、これは数値と見分けが付きません。 見分けを付けるためには *note
PyErr_Occurred(): 1caf. を使ってください。

 -- C のデータ型: type PyLongObject
     ' 次に属します: *note Limited API: 775. (不透明な構造体として).'  こ
     の *note PyObject: 5df. のサブタイプは整数型を表現します。

 -- C 変数: *note PyTypeObject: c9c. PyLong_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     c9c. のインスタンスは Python 整数型を表現します。これは Python レイ
     ヤにおける *note int: 19b. と同じオブジェクトです。

 -- C の関数: int PyLong_Check (PyObject *p)

     引数が *note PyLongObject: 39e. か *note PyLongObject: 39e. のサブ
     タイプであるときに真を返します。この関数は常に成功します。

 -- C の関数: int PyLong_CheckExact (PyObject *p)

     引数が *note PyLongObject: 39e. であるが *note PyLongObject: 39e. の
     サブタイプでないときに真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyLong_FromLong (long v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  'v'
     から新たな *note PyLongObject: 39e. オブジェクトを生成して返します
     。失敗のときには ‘NULL’ を返します。

     'CPython 実装の詳細:' CPython keeps an array of integer objects for
     all integers between ‘-5’ and ‘256’.  When you create an int in
     that range you actually just get back a reference to the existing
     object.

 -- C の関数: *note PyObject: 5df. *PyLong_FromUnsignedLong (unsigned
          long v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  Cの
     unsigned long から新たな *note PyLongObject: 39e. オブジェクトを生
     成して返します。失敗した際には ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyLong_FromSsize_t (Py_ssize_t v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  C の
     *note Py_ssize_t: c55. 型から新たな *note PyLongObject: 39e. オブジ
     ェクトを生成して返します。 失敗のときには ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyLong_FromSize_t (size_t v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  C の
     ‘size_t’ 型から新たな *note PyLongObject: 39e. オブジェクトを生成し
     て返します。 失敗のときには ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyLong_FromLongLong (long long v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  C の
     long long 型から新たな *note PyLongObject: 39e. オブジェクトを生成
     して返します。失敗のときには ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyLong_FromInt32 (int32_t value)
 -- C の関数: *note PyObject: 5df. *PyLong_FromInt64 (int64_t value)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Return a new *note PyLongObject: 39e. object from a signed C
     int32_t or int64_t, or ‘NULL’ with an exception set on failure.

     Added in version 3.14.

 -- C の関数: *note PyObject: 5df. *PyLong_FromUnsignedLongLong
          (unsigned long long v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  C の
     unsigned long long 型から新たな *note PyLongObject: 39e. オブジェク
     トを生成して返します。失敗のときには ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyLong_FromUInt32 (uint32_t value)
 -- C の関数: *note PyObject: 5df. *PyLong_FromUInt64 (uint64_t value)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Return a new *note PyLongObject: 39e. object from an unsigned C
     uint32_t or uint64_t, or ‘NULL’ with an exception set on failure.

     Added in version 3.14.

 -- C の関数: *note PyObject: 5df. *PyLong_FromDouble (double v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  'v'
     の整数部から新たな *note PyLongObject: 39e. オブジェクトを生成して
     返します。失敗のときには ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyLong_FromString (const char *str,
          char **pend, int base)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return a new *note PyLongObject: 39e. based on the string value in
     'str', which is interpreted according to the radix in 'base', or
     ‘NULL’ on failure.  If 'pend' is non-‘NULL’, '*pend' will point to
     the end of 'str' on success or to the first character that could
     not be processed on error.  If 'base' is ‘0’, 'str' is interpreted
     using the *note 整数リテラル: 230b. definition; in this case,
     leading zeros in a non-zero decimal number raises a *note
     ValueError: 2ec.  If 'base' is not ‘0’, it must be between ‘2’ and
     ‘36’, inclusive.  Leading and trailing whitespace and single
     underscores after a base specifier and between digits are ignored.
     If there are no digits or 'str' is not NULL-terminated following
     the digits and trailing whitespace, *note ValueError: 2ec. will be
     raised.

     参考
     ....

     *note PyLong_AsNativeBytes(): 606. and *note
     PyLong_FromNativeBytes(): 607. functions can be used to convert a
     *note PyLongObject: 39e. to/from an array of bytes in base ‘256’.

 -- C の関数: *note PyObject: 5df. *PyLong_FromUnicodeObject (PyObject
          *u, int base)
     '戻り値: 新しい参照。' Convert a sequence of Unicode digits in the
     string 'u' to a Python integer value.

     Added in version 3.3.

 -- C の関数: *note PyObject: 5df. *PyLong_FromVoidPtr (void *p)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  ポイ
     ンタ 'p' から Python 整数値を生成します。ポインタの値は *note
     PyLong_AsVoidPtr(): 504b. を適用した結果から取得されます。

 -- C の関数: *note PyObject: 5df. *PyLong_FromNativeBytes (const void
          *buffer, size_t n_bytes, int flags)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Create a Python integer from the value contained in the first
     'n_bytes' of 'buffer', interpreted as a two's-complement signed
     number.

     'flags' are as for *note PyLong_AsNativeBytes(): 606.  Passing ‘-1’
     will select the native endian that CPython was compiled with and
     assume that the most-significant bit is a sign bit.  Passing
     ‘Py_ASNATIVEBYTES_UNSIGNED_BUFFER’ will produce the same result as
     calling *note PyLong_FromUnsignedNativeBytes(): 608.  Other flags
     are ignored.

     Added in version 3.13.

 -- C の関数: *note PyObject: 5df. *PyLong_FromUnsignedNativeBytes
          (const void *buffer, size_t n_bytes, int flags)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Create a Python integer from the value contained in the first
     'n_bytes' of 'buffer', interpreted as an unsigned number.

     'flags' are as for *note PyLong_AsNativeBytes(): 606.  Passing ‘-1’
     will select the native endian that CPython was compiled with and
     assume that the most-significant bit is not a sign bit.  Flags
     other than endian are ignored.

     Added in version 3.13.

 -- C のマクロ: PyLong_FromPid (pid)

     Macro for creating a Python integer from a process identifier.

     This can be defined as an alias to *note PyLong_FromLong(): 1bd0.
     or *note PyLong_FromLongLong(): 1bd1, depending on the size of the
     system's PID type.

     Added in version 3.2.

 -- C の関数: long PyLong_AsLong (PyObject *obj)
     ' 次に属します: *note Stable ABI: 775.'

     Return a C long representation of 'obj'.  If 'obj' is not an
     instance of *note PyLongObject: 39e, first call its *note
     __index__(): 19e. method (if present) to convert it to a *note
     PyLongObject: 39e.

     もし 'obj' の値が long の範囲外であれば、 *note OverflowError: a81.
     を送出します。

     エラーが起きたときに ‘-1’ を返します。 見分けを付けるためには *note
     PyErr_Occurred(): 1caf. を使ってください。

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19e. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 19d.

      -- C の関数: long PyLong_AS_LONG (PyObject *obj)

          A *note soft deprecated: 23d. alias.  Exactly equivalent to
          the preferred ‘PyLong_AsLong’.  In particular, it can fail
          with *note OverflowError: a81. or another exception.

          バージョン 3.14 で非推奨: The function is soft deprecated.

 -- C の関数: int PyLong_AsInt (PyObject *obj)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Similar to *note PyLong_AsLong(): 605, but store the result in a C
     int instead of a C long.

     Added in version 3.13.

 -- C の関数: long PyLong_AsLongAndOverflow (PyObject *obj, int
          *overflow)
     ' 次に属します: *note Stable ABI: 775.'  Return a C long
     representation of 'obj'.  If 'obj' is not an instance of *note
     PyLongObject: 39e, first call its *note __index__(): 19e. method
     (if present) to convert it to a *note PyLongObject: 39e.

     If the value of 'obj' is greater than ‘LONG_MAX’ or less than
     ‘LONG_MIN’, set '*overflow' to ‘1’ or ‘-1’, respectively, and
     return ‘-1’; otherwise, set '*overflow' to ‘0’.  If any other
     exception occurs set '*overflow' to ‘0’ and return ‘-1’ as usual.

     エラーが起きたときに ‘-1’ を返します。 見分けを付けるためには *note
     PyErr_Occurred(): 1caf. を使ってください。

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19e. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 19d.

 -- C の関数: long long PyLong_AsLongLong (PyObject *obj)
     ' 次に属します: *note Stable ABI: 775.'

     Return a C long long representation of 'obj'.  If 'obj' is not an
     instance of *note PyLongObject: 39e, first call its *note
     __index__(): 19e. method (if present) to convert it to a *note
     PyLongObject: 39e.

     もし 'obj' の値が long long の範囲外であれば、 *note OverflowError:
     a81. を送出します。

     エラーが起きたときに ‘-1’ を返します。 見分けを付けるためには *note
     PyErr_Occurred(): 1caf. を使ってください。

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19e. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 19d.

 -- C の関数: long long PyLong_AsLongLongAndOverflow (PyObject *obj, int
          *overflow)
     ' 次に属します: *note Stable ABI: 775.'  Return a C long long
     representation of 'obj'.  If 'obj' is not an instance of *note
     PyLongObject: 39e, first call its *note __index__(): 19e. method
     (if present) to convert it to a *note PyLongObject: 39e.

     If the value of 'obj' is greater than ‘LLONG_MAX’ or less than
     ‘LLONG_MIN’, set '*overflow' to ‘1’ or ‘-1’, respectively, and
     return ‘-1’; otherwise, set '*overflow' to ‘0’.  If any other
     exception occurs set '*overflow' to ‘0’ and return ‘-1’ as usual.

     エラーが起きたときに ‘-1’ を返します。 見分けを付けるためには *note
     PyErr_Occurred(): 1caf. を使ってください。

     Added in version 3.2.

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19e. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 19d.

 -- C の関数: *note Py_ssize_t: c55. PyLong_AsSsize_t (PyObject *pylong)
     ' 次に属します: *note Stable ABI: 775.'

     'pylong' を表す C の *note Py_ssize_t: c55. を返します。 'pylong' は
     *note PyLongObject: 39e. のインスタンスでなければなりません。

     もし 'pylong' の値が *note Py_ssize_t: c55. の範囲外であれば、
     *note OverflowError: a81. を送出します。

     エラーが起きたときに ‘-1’ を返します。 見分けを付けるためには *note
     PyErr_Occurred(): 1caf. を使ってください。

 -- C の関数: unsigned long PyLong_AsUnsignedLong (PyObject *pylong)
     ' 次に属します: *note Stable ABI: 775.'

     'pylong' を表す C の unsigned long を返します。 'pylong' は *note
     PyLongObject: 39e. のインスタンスでなければなりません。

     もし 'pylong' の値が unsigned long の範囲外であれば、 *note
     OverflowError: a81. を送出します。

     エラーが起きたときに ‘(unsigned long)-1’ を返します。 見分けを付け
     るためには *note PyErr_Occurred(): 1caf. を使ってください。

 -- C の関数: size_t PyLong_AsSize_t (PyObject *pylong)
     ' 次に属します: *note Stable ABI: 775.'

     'pylong' を表す C の ‘size_t’ を返します。 'pylong' は *note
     PyLongObject: 39e. のインスタンスでなければなりません。

     もし 'pylong' の値が ‘size_t’ の範囲外であれば、 *note
     OverflowError: a81. を送出します。

     エラーが起きたときに ‘(size_t)-1’ を返します。 見分けを付けるために
     は *note PyErr_Occurred(): 1caf. を使ってください。

 -- C の関数: unsigned long long PyLong_AsUnsignedLongLong (PyObject
          *pylong)
     ' 次に属します: *note Stable ABI: 775.'

     'pylong' を表す C の unsigned long long を返します。 'pylong' は
     *note PyLongObject: 39e. のインスタンスでなければなりません。

     もし 'pylong' の値が unsigned long long の範囲外であれば、 *note
     OverflowError: a81. を送出します。

     エラーが起きたときに ‘(unsigned long long)-1’ を返します。 見分けを
     付けるためには *note PyErr_Occurred(): 1caf. を使ってください。

     バージョン 3.1 で変更: 負 'pylong' を指定した際に *note TypeError:
     198. ではなく、 *note OverflowError: a81. を送出するようになりまし
     た。

 -- C の関数: unsigned long PyLong_AsUnsignedLongMask (PyObject *obj)
     ' 次に属します: *note Stable ABI: 775.'  Return a C unsigned long
     representation of 'obj'.  If 'obj' is not an instance of *note
     PyLongObject: 39e, first call its *note __index__(): 19e. method
     (if present) to convert it to a *note PyLongObject: 39e.

     'obj' の値が unsigned long の範囲から外れていた場合は、 ‘ULONG_MAX
     + 1’ を法とした剰余を返します。

     エラーが起きたときに ‘(unsigned long)-1’ を返します。 見分けを付け
     るためには *note PyErr_Occurred(): 1caf. を使ってください。

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19e. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 19d.

 -- C の関数: unsigned long long PyLong_AsUnsignedLongLongMask (PyObject
          *obj)
     ' 次に属します: *note Stable ABI: 775.'  Return a C unsigned long
     long representation of 'obj'.  If 'obj' is not an instance of *note
     PyLongObject: 39e, first call its *note __index__(): 19e. method
     (if present) to convert it to a *note PyLongObject: 39e.

     'obj' の値が unsigned long long の範囲から外れていた場合は、
     ‘ULLONG_MAX + 1’ を法とした剰余を返します。

     エラーが起きたときに ‘(unsigned long long)-1’ を返します。 見分けを
     付けるためには *note PyErr_Occurred(): 1caf. を使ってください。

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19e. を使う
     ようになりました。

     バージョン 3.10 で変更: This function will no longer use *note
     __int__(): 19d.

 -- C の関数: int PyLong_AsInt32 (PyObject *obj, int32_t *value)
 -- C の関数: int PyLong_AsInt64 (PyObject *obj, int64_t *value)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Set '*value' to a signed C int32_t or int64_t representation of
     'obj'.

     If 'obj' is not an instance of *note PyLongObject: 39e, first call
     its *note __index__(): 19e. method (if present) to convert it to a
     *note PyLongObject: 39e.

     If the 'obj' value is out of range, raise an *note OverflowError:
     a81.

     Set '*value' and return ‘0’ on success.  Set an exception and
     return ‘-1’ on error.

     'value' must not be ‘NULL’.

     Added in version 3.14.

 -- C の関数: int PyLong_AsUInt32 (PyObject *obj, uint32_t *value)
 -- C の関数: int PyLong_AsUInt64 (PyObject *obj, uint64_t *value)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Set '*value' to an unsigned C uint32_t or uint64_t representation
     of 'obj'.

     If 'obj' is not an instance of *note PyLongObject: 39e, first call
     its *note __index__(): 19e. method (if present) to convert it to a
     *note PyLongObject: 39e.

        * If 'obj' is negative, raise a *note ValueError: 2ec.

        * If the 'obj' value is out of range, raise an *note
          OverflowError: a81.

     Set '*value' and return ‘0’ on success.  Set an exception and
     return ‘-1’ on error.

     'value' must not be ‘NULL’.

     Added in version 3.14.

 -- C の関数: double PyLong_AsDouble (PyObject *pylong)
     ' 次に属します: *note Stable ABI: 775.'  'pylong' を表す C の
     double を返します。 'pylong' は *note PyLongObject: 39e. のインスタ
     ンスでなければなりません。

     もし 'pylong' の値が double の範囲外であれば、 *note OverflowError:
     a81. を送出します。

     エラーが起きたときに ‘-1.0’ を返します。 見分けを付けるためには
     *note PyErr_Occurred(): 1caf. を使ってください。

 -- C の関数: void *PyLong_AsVoidPtr (PyObject *pylong)
     ' 次に属します: *note Stable ABI: 775.'  Python の整数型を指す
     'pylong' を、 C の void ポインタに変換します。 'pylong' を変換でき
     なければ、 *note OverflowError: a81. を送出します。この関数は *note
     PyLong_FromVoidPtr(): 504d. で値を生成するときに使うような void ポ
     インタ型を生成できるだけです。

     エラーが起きたときに ‘NULL’ を返します。 見分けを付けるためには
     *note PyErr_Occurred(): 1caf. を使ってください。

 -- C の関数: *note Py_ssize_t: c55. PyLong_AsNativeBytes (PyObject
          *pylong, void *buffer, Py_ssize_t n_bytes, int flags)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Copy the Python integer value 'pylong' to a native 'buffer' of size
     'n_bytes'.  The 'flags' can be set to ‘-1’ to behave similarly to a
     C cast, or to values documented below to control the behavior.

     Returns ‘-1’ with an exception raised on error.  This may happen if
     'pylong' cannot be interpreted as an integer, or if 'pylong' was
     negative and the ‘Py_ASNATIVEBYTES_REJECT_NEGATIVE’ flag was set.

     Otherwise, returns the number of bytes required to store the value.
     If this is equal to or less than 'n_bytes', the entire value was
     copied.  All 'n_bytes' of the buffer are written: remaining bytes
     filled by copies of the sign bit.

     If the returned value is greater than 'n_bytes', the value was
     truncated: as many of the lowest bits of the value as could fit are
     written, and the higher bits are ignored.  This matches the typical
     behavior of a C-style downcast.

          注釈: Overflow is not considered an error.  If the returned
          value is larger than 'n_bytes', most significant bits were
          discarded.

     ‘0’ will never be returned.

     Values are always copied as two's-complement.

     Usage example:

          int32_t value;
          Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, &value, sizeof(value), -1);
          if (bytes < 0) {
              // Failed. A Python exception was set with the reason.
              return NULL;
          }
          else if (bytes <= (Py_ssize_t)sizeof(value)) {
              // Success!
          }
          else {
              // Overflow occurred, but 'value' contains the truncated
              // lowest bits of pylong.
          }

     Passing zero to 'n_bytes' will return the size of a buffer that
     would be large enough to hold the value.  This may be larger than
     technically necessary, but not unreasonably so.  If 'n_bytes=0',
     'buffer' may be ‘NULL’.

          注釈: Passing 'n_bytes=0' to this function is not an accurate
          way to determine the bit length of the value.

     To get at the entire Python value of an unknown size, the function
     can be called twice: first to determine the buffer size, then to
     fill it:

          // Ask how much space we need.
          Py_ssize_t expected = PyLong_AsNativeBytes(pylong, NULL, 0, -1);
          if (expected < 0) {
              // Failed. A Python exception was set with the reason.
              return NULL;
          }
          assert(expected != 0);  // Impossible per the API definition.
          uint8_t *bignum = malloc(expected);
          if (!bignum) {
              PyErr_SetString(PyExc_MemoryError, "bignum malloc failed.");
              return NULL;
          }
          // Safely get the entire value.
          Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, bignum, expected, -1);
          if (bytes < 0) {  // Exception has been set.
              free(bignum);
              return NULL;
          }
          else if (bytes > expected) {  // This should not be possible.
              PyErr_SetString(PyExc_RuntimeError,
                  "Unexpected bignum truncation after a size check.");
              free(bignum);
              return NULL;
          }
          // The expected success given the above pre-check.
          // ... use bignum ...
          free(bignum);

     'flags' is either ‘-1’ (‘Py_ASNATIVEBYTES_DEFAULTS’) to select
     defaults that behave most like a C cast, or a combination of the
     other flags in the table below.  Note that ‘-1’ cannot be combined
     with other flags.

     Currently, ‘-1’ corresponds to ‘Py_ASNATIVEBYTES_NATIVE_ENDIAN |
     Py_ASNATIVEBYTES_UNSIGNED_BUFFER’.

     Flag                                              値
                                                       
     -------------------------------------------------------------
                                                       
      -- C のマクロ: Py_ASNATIVEBYTES_DEFAULTS         ‘-1’
          ' 次に属します: *note Stable ABI: 775. (バ   
          ージョン 3.14 より).'

      -- C のマクロ: Py_ASNATIVEBYTES_BIG_ENDIAN       ‘0’
          ' 次に属します: *note Stable ABI: 775. (バ   
          ージョン 3.14 より).'

      -- C のマクロ: Py_ASNATIVEBYTES_LITTLE_ENDIAN    ‘1’
          ' 次に属します: *note Stable ABI: 775. (バ   
          ージョン 3.14 より).'

      -- C のマクロ: Py_ASNATIVEBYTES_NATIVE_ENDIAN    ‘3’
          ' 次に属します: *note Stable ABI: 775. (バ   
          ージョン 3.14 より).'

      -- C のマクロ:                                   ‘4’
               Py_ASNATIVEBYTES_UNSIGNED_BUFFER        
          ' 次に属します: *note Stable ABI: 775. (バ
          ージョン 3.14 より).'

      -- C のマクロ:                                   ‘8’
               Py_ASNATIVEBYTES_REJECT_NEGATIVE        
          ' 次に属します: *note Stable ABI: 775. (バ
          ージョン 3.14 より).'

      -- C のマクロ: Py_ASNATIVEBYTES_ALLOW_INDEX      ‘16’
          ' 次に属します: *note Stable ABI: 775. (バ   
          ージョン 3.14 より).'

     Specifying ‘Py_ASNATIVEBYTES_NATIVE_ENDIAN’ will override any other
     endian flags.  Passing ‘2’ is reserved.

     By default, sufficient buffer will be requested to include a sign
     bit.  For example, when converting 128 with 'n_bytes=1', the
     function will return 2 (or more) in order to store a zero sign bit.

     If ‘Py_ASNATIVEBYTES_UNSIGNED_BUFFER’ is specified, a zero sign bit
     will be omitted from size calculations.  This allows, for example,
     128 to fit in a single-byte buffer.  If the destination buffer is
     later treated as signed, a positive input value may become
     negative.  Note that the flag does not affect handling of negative
     values: for those, space for a sign bit is always requested.

     Specifying ‘Py_ASNATIVEBYTES_REJECT_NEGATIVE’ causes an exception
     to be set if 'pylong' is negative.  Without this flag, negative
     values will be copied provided there is enough space for at least
     one sign bit, regardless of whether
     ‘Py_ASNATIVEBYTES_UNSIGNED_BUFFER’ was specified.

     If ‘Py_ASNATIVEBYTES_ALLOW_INDEX’ is specified and a non-integer
     value is passed, its *note __index__(): 19e. method will be called
     first.  This may result in Python code executing and other threads
     being allowed to run, which could cause changes to other objects or
     values in use.  When 'flags' is ‘-1’, this option is not set, and
     non-integer values will raise *note TypeError: 198.

          注釈: With the default 'flags' (‘-1’, or 'UNSIGNED_BUFFER'
          without 'REJECT_NEGATIVE'), multiple Python integers can map
          to a single value without overflow.  For example, both ‘255’
          and ‘-1’ fit a single-byte buffer and set all its bits.  This
          matches typical C cast behavior.

     Added in version 3.13.

 -- C のマクロ: PyLong_AsPid (pid)

     Macro for converting a Python integer into a process identifier.

     This can be defined as an alias to *note PyLong_AsLong(): 605,
     *note PyLong_FromLongLong(): 1bd1, or *note PyLong_AsInt(): 604,
     depending on the size of the system's PID type.

     Added in version 3.2.

 -- C の関数: int PyLong_GetSign (PyObject *obj, int *sign)

     Get the sign of the integer object 'obj'.

     On success, set '*sign' to the integer sign (0, -1 or +1 for zero,
     negative or positive integer, respectively) and return 0.

     On failure, return -1 with an exception set.  This function always
     succeeds if 'obj' is a *note PyLongObject: 39e. or its subtype.

     Added in version 3.14.

 -- C の関数: int PyLong_IsPositive (PyObject *obj)

     Check if the integer object 'obj' is positive (‘obj > 0’).

     If 'obj' is an instance of *note PyLongObject: 39e. or its subtype,
     return ‘1’ when it's positive and ‘0’ otherwise.  Else set an
     exception and return ‘-1’.

     Added in version 3.14.

 -- C の関数: int PyLong_IsNegative (PyObject *obj)

     Check if the integer object 'obj' is negative (‘obj < 0’).

     If 'obj' is an instance of *note PyLongObject: 39e. or its subtype,
     return ‘1’ when it's negative and ‘0’ otherwise.  Else set an
     exception and return ‘-1’.

     Added in version 3.14.

 -- C の関数: int PyLong_IsZero (PyObject *obj)

     Check if the integer object 'obj' is zero.

     If 'obj' is an instance of *note PyLongObject: 39e. or its subtype,
     return ‘1’ when it's zero and ‘0’ otherwise.  Else set an exception
     and return ‘-1’.

     Added in version 3.14.

 -- C の関数: *note PyObject: 5df. *PyLong_GetInfo (void)
     ' 次に属します: *note Stable ABI: 775.'  On success, return a read
     only *note named tuple: 85e, that holds information about Python's
     internal representation of integers.  See *note sys.int_info: 14ab.
     for description of individual fields.

     On failure, return ‘NULL’ with an exception set.

     Added in version 3.1.

 -- C の関数: int PyUnstable_Long_IsCompact (const PyLongObject *op)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Return 1 if 'op' is compact, 0 otherwise.

     This function makes it possible for performance-critical code to
     implement a “fast path” for small integers.  For compact values use
     *note PyUnstable_Long_CompactValue(): 7a7.; for others fall back to
     a *note PyLong_As*: 5047. function or *note PyLong_AsNativeBytes():
     606.

     The speedup is expected to be negligible for most users.

     Exactly what values are considered compact is an implementation
     detail and is subject to change.

     Added in version 3.12.

 -- C の関数: *note Py_ssize_t: c55. PyUnstable_Long_CompactValue (const
          PyLongObject *op)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     If 'op' is compact, as determined by *note
     PyUnstable_Long_IsCompact(): 7a6, return its value.

     Otherwise, the return value is undefined.

     Added in version 3.12.

* Menu:

* Export API::
* PyLongWriter API::
* Deprecated API::


File: python.info,  Node: Export API,  Next: PyLongWriter API,  Up: 整数型オブジェクト integer object

7.9.2.2 Export API
..................

Added in version 3.14.

 -- C Struct: struct PyLongLayout

     Layout of an array of "digits" ("limbs" in the GMP terminology),
     used to represent absolute value for arbitrary precision integers.

     Use *note PyLong_GetNativeLayout(): 3a7. to get the native layout
     of Python *note int: 19b. objects, used internally for integers
     with "big enough" absolute value.

     See also *note sys.int_info: 14ab. which exposes similar
     information in Python.

      -- C のメンバ変数: uint8_t bits_per_digit

          Bits per digit.  For example, a 15 bit digit means that bits
          0-14 contain meaningful information.

      -- C のメンバ変数: uint8_t digit_size

          Digit size in bytes.  For example, a 15 bit digit will require
          at least 2 bytes.

      -- C のメンバ変数: int8_t digits_order

          Digits order:

             - ‘1’ for most significant digit first

             - ‘-1’ for least significant digit first

      -- C のメンバ変数: int8_t digit_endianness

          Digit endianness:

             - ‘1’ for most significant byte first (big endian)

             - ‘-1’ for least significant byte first (little endian)

 -- C の関数: const *note PyLongLayout: 5301. *PyLong_GetNativeLayout
          (void)

     Get the native layout of Python *note int: 19b. objects.

     See the *note PyLongLayout: 5301. structure.

     The function must not be called before Python initialization nor
     after Python finalization.  The returned layout is valid until
     Python is finalized.  The layout is the same for all Python
     sub-interpreters in a process, and so it can be cached.

 -- C Struct: struct PyLongExport

     Export of a Python *note int: 19b. object.

     There are two cases:

        * If *note digits: 5307. is ‘NULL’, only use the *note value:
          5308. member.

        * If *note digits: 5307. is not ‘NULL’, use *note negative:
          5309, *note ndigits: 530a. and *note digits: 5307. members.

      -- C のメンバ変数: int64_t value

          The native integer value of the exported *note int: 19b.
          object.  Only valid if *note digits: 5307. is ‘NULL’.

      -- C のメンバ変数: uint8_t negative

          ‘1’ if the number is negative, ‘0’ otherwise.  Only valid if
          *note digits: 5307. is not ‘NULL’.

      -- C のメンバ変数: *note Py_ssize_t: c55. ndigits

          Number of digits in *note digits: 5307. array.  Only valid if
          *note digits: 5307. is not ‘NULL’.

      -- C のメンバ変数: const void *digits

          Read-only array of unsigned digits.  Can be ‘NULL’.

 -- C の関数: int PyLong_Export (PyObject *obj, PyLongExport
          *export_long)

     Export a Python *note int: 19b. object.

     'export_long' must point to a *note PyLongExport: 5306. structure
     allocated by the caller.  It must not be ‘NULL’.

     On success, fill in '*export_long' and return ‘0’.  On error, set
     an exception and return ‘-1’.

     *note PyLong_FreeExport(): 3a9. must be called when the export is
     no longer needed.

          'CPython 実装の詳細:' This function always succeeds if 'obj'
          is a Python *note int: 19b. object or a subclass.

 -- C の関数: void PyLong_FreeExport (PyLongExport *export_long)

     Release the export 'export_long' created by *note PyLong_Export():
     3a8.

     'CPython 実装の詳細:' Calling *note PyLong_FreeExport(): 3a9. is
     optional if 'export_long->digits' is ‘NULL’.


File: python.info,  Node: PyLongWriter API,  Next: Deprecated API,  Prev: Export API,  Up: 整数型オブジェクト integer object

7.9.2.3 PyLongWriter API
........................

The *note PyLongWriter: 530c. API can be used to import an integer.

Added in version 3.14.

 -- C Struct: struct PyLongWriter

     A Python *note int: 19b. writer instance.

     The instance must be destroyed by *note PyLongWriter_Finish(): 3ab.
     or *note PyLongWriter_Discard(): 3ac.

 -- C の関数: *note PyLongWriter: 530c. *PyLongWriter_Create (int
          negative, Py_ssize_t ndigits, void **digits)

     Create a *note PyLongWriter: 530c.

     On success, allocate '*digits' and return a writer.  On error, set
     an exception and return ‘NULL’.

     'negative' is ‘1’ if the number is negative, or ‘0’ otherwise.

     'ndigits' is the number of digits in the 'digits' array.  It must
     be greater than 0.

     'digits' must not be NULL.

     After a successful call to this function, the caller should fill in
     the array of digits 'digits' and then call *note
     PyLongWriter_Finish(): 3ab. to get a Python *note int: 19b.  The
     layout of 'digits' is described by *note PyLong_GetNativeLayout():
     3a7.

     Digits must be in the range [‘0’; ‘(1 << bits_per_digit) - 1’]
     (where the *note bits_per_digit: 5302. is the number of bits per
     digit).  Any unused most significant digits must be set to ‘0’.

     Alternately, call *note PyLongWriter_Discard(): 3ac. to destroy the
     writer instance without creating an *note int: 19b. object.

 -- C の関数: *note PyObject: 5df. *PyLongWriter_Finish (PyLongWriter
          *writer)
     '戻り値: 新しい参照。' Finish a *note PyLongWriter: 530c. created
     by *note PyLongWriter_Create(): 3aa.

     On success, return a Python *note int: 19b. object.  On error, set
     an exception and return ‘NULL’.

     The function takes care of normalizing the digits and converts the
     object to a compact integer if needed.

     The writer instance and the 'digits' array are invalid after the
     call.

 -- C の関数: void PyLongWriter_Discard (PyLongWriter *writer)

     Discard a *note PyLongWriter: 530c. created by *note
     PyLongWriter_Create(): 3aa.

     If 'writer' is ‘NULL’, no operation is performed.

     The writer instance and the 'digits' array are invalid after the
     call.


File: python.info,  Node: Deprecated API,  Prev: PyLongWriter API,  Up: 整数型オブジェクト integer object

7.9.2.4 Deprecated API
......................

These macros are *note soft deprecated: 23d.  They describe parameters
of the internal representation of *note PyLongObject: 39e. instances.

Use *note PyLong_GetNativeLayout(): 3a7. instead, along with *note
PyLong_Export(): 3a8. to read integer data or *note PyLongWriter: 530c.
to write it.  These currently use the same layout, but are designed to
continue working correctly even if CPython's internal integer
representation changes.

 -- C のマクロ: PyLong_SHIFT

     This is equivalent to *note bits_per_digit: 5302. in the output of
     *note PyLong_GetNativeLayout(): 3a7.

 -- C のマクロ: PyLong_BASE

     This is currently equivalent to 1 << *note PyLong_SHIFT: 530e.

 -- C のマクロ: PyLong_MASK

     This is currently equivalent to (1 << *note PyLong_SHIFT: 530e.) -
     1


File: python.info,  Node: Boolean オブジェクト,  Next: Floating-Point Objects,  Prev: 整数型オブジェクト integer object,  Up: 数値型オブジェクト numeric object

7.9.2.5 Boolean オブジェクト
............................

Python の Bool 型は整数のサブクラスとして実装されています。ブール型の値
は、 *note Py_False: 5314. と *note Py_True: 5315. の 2 つしかありません
。従って、通常の生成／削除関数はブール型にはあてはまりません。とはいえ、
以下のマクロが利用できます。

 -- C 変数: *note PyTypeObject: c9c. PyBool_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     c9c. のインスタンスは Python の boolean 型を表現します; Python レイ
     ヤにおける *note bool: 3c3. と同じオブジェクトです。

 -- C の関数: int PyBool_Check (PyObject *o)

     'o' が *note PyBool_Type: 4f77. 型の場合に真を返します。この関数は
     常に成功します。

 -- C 変数: *note PyObject: 5df. *Py_False

     Python の ‘False’ オブジェクト。このオブジェクトはメソッドを持たず
     、 *note immortal: 290. です。

     バージョン 3.12 で変更: *note Py_False: 5314. は *note immortal:
     290. です。

 -- C 変数: *note PyObject: 5df. *Py_True

     Python の ‘True’ オブジェクト。このオブジェクトはメソッドを持たず、
     *note immortal: 290. です。

     バージョン 3.12 で変更: *note Py_True: 5315. は *note immortal:
     290. です。

 -- C のマクロ: Py_RETURN_FALSE

     関数から *note Py_False: 5314. を返します。

 -- C のマクロ: Py_RETURN_TRUE

     関数から *note Py_True: 5315. を返します。

 -- C の関数: *note PyObject: 5df. *PyBool_FromLong (long v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  'v'
     の真理値に応じて *note Py_True: 5315. または *note Py_False: 5314.
     を返します。


File: python.info,  Node: Floating-Point Objects,  Next: 複素数オブジェクト,  Prev: Boolean オブジェクト,  Up: 数値型オブジェクト numeric object

7.9.2.6 Floating-Point Objects
..............................

 -- C のデータ型: type PyFloatObject

     This subtype of *note PyObject: 5df. represents a Python
     floating-point object.

 -- C 変数: *note PyTypeObject: c9c. PyFloat_Type
     ' 次に属します: *note Stable ABI: 775.'  This instance of *note
     PyTypeObject: c9c. represents the Python floating-point type.  This
     is the same object as *note float: 196. in the Python layer.

 -- C の関数: int PyFloat_Check (PyObject *p)

     引数が *note PyFloatObject: 531b. か *note PyFloatObject: 531b. の
     サブタイプであるときに真を返します。この関数は常に成功します。

 -- C の関数: int PyFloat_CheckExact (PyObject *p)

     引数が *note PyFloatObject: 531b. であるが *note PyFloatObject:
     531b. のサブタイプでないときに真を返します。この関数は常に成功しま
     す。

 -- C の関数: *note PyObject: 5df. *PyFloat_FromString (PyObject *str)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'str' の文字列値をもとに *note PyFloatObject: 531b. オブジェクトを
     生成します。失敗すると ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyFloat_FromDouble (double v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  'v'
     から *note PyFloatObject: 531b. オブジェクトを生成して返します。 失
     敗すると ‘NULL’ を返します。

 -- C の関数: double PyFloat_AsDouble (PyObject *pyfloat)
     ' 次に属します: *note Stable ABI: 775.'  Return a C double
     representation of the contents of 'pyfloat'.  If 'pyfloat' is not a
     Python floating-point object but has a *note __float__(): bc1.
     method, this method will first be called to convert 'pyfloat' into
     a float.  If ‘__float__()’ is not defined then it falls back to
     *note __index__(): 19e.  This method returns ‘-1.0’ upon failure,
     so one should call *note PyErr_Occurred(): 1caf. to check for
     errors.

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19e. を使う
     ようになりました。

 -- C の関数: double PyFloat_AS_DOUBLE (PyObject *pyfloat)

     'pyfloat' の指す値を、 C の double 型表現で返しますが、エラーチェッ
     クを行いません。

 -- C の関数: *note PyObject: 5df. *PyFloat_GetInfo (void)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     float の精度、最小値、最大値に関する情報を含む structseq インスタン
     スを返します。これは、 ‘float.h’ ファイルの薄いラッパーです。

 -- C の関数: double PyFloat_GetMax ()
     ' 次に属します: *note Stable ABI: 775.'  float の表現できる最大限解
     値 'DBL_MAX' を C の double 型で返します。

 -- C の関数: double PyFloat_GetMin ()
     ' 次に属します: *note Stable ABI: 775.'  float の正規化された最小の
     正の値 'DBL_MIN' を C の double 型で返します。

 -- C のマクロ: Py_INFINITY

     This macro expands to a constant expression of type double, that
     represents the positive infinity.

     On most platforms, this is equivalent to the ‘INFINITY’ macro from
     the C11 standard ‘<math.h>’ header.

 -- C のマクロ: Py_NAN

     This macro expands to a constant expression of type double, that
     represents a quiet not-a-number (qNaN) value.

     On most platforms, this is equivalent to the ‘NAN’ macro from the
     C11 standard ‘<math.h>’ header.

 -- C のマクロ: Py_HUGE_VAL

     Equivalent to ‘INFINITY’.

     バージョン 3.14 で非推奨: The macro is *note soft deprecated: 23d.

 -- C のマクロ: Py_MATH_E

     The definition (accurate for a double type) of the *note math.e:
     2a82. constant.

 -- C のマクロ: Py_MATH_El

     High precision (long double) definition of *note e: 2a82. constant.

 -- C のマクロ: Py_MATH_PI

     The definition (accurate for a double type) of the *note math.pi:
     2a81. constant.

 -- C のマクロ: Py_MATH_PIl

     High precision (long double) definition of *note pi: 2a81.
     constant.

 -- C のマクロ: Py_MATH_TAU

     The definition (accurate for a double type) of the *note math.tau:
     2a83. constant.

     Added in version 3.6.

 -- C のマクロ: Py_RETURN_NAN

     Return *note math.nan: 873. from a function.

     On most platforms, this is equivalent to ‘return
     PyFloat_FromDouble(NAN)’.

 -- C のマクロ: Py_RETURN_INF (sign)

     Return *note math.inf: e7e. or *note -math.inf: e7e. from a
     function, depending on the sign of 'sign'.

     On most platforms, this is equivalent to the following:

          return PyFloat_FromDouble(copysign(INFINITY, sign));

 -- C のマクロ: Py_IS_FINITE (X)

     Return ‘1’ if the given floating-point number 'X' is finite, that
     is, it is normal, subnormal or zero, but not infinite or NaN.
     Return ‘0’ otherwise.

     バージョン 3.14 で非推奨: The macro is *note soft deprecated: 23d.
     Use ‘isfinite’ instead.

 -- C のマクロ: Py_IS_INFINITY (X)

     Return ‘1’ if the given floating-point number 'X' is positive or
     negative infinity.  Return ‘0’ otherwise.

     バージョン 3.14 で非推奨: The macro is *note soft deprecated: 23d.
     Use ‘isinf’ instead.

 -- C のマクロ: Py_IS_NAN (X)

     Return ‘1’ if the given floating-point number 'X' is a not-a-number
     (NaN) value.  Return ‘0’ otherwise.

     バージョン 3.14 で非推奨: The macro is *note soft deprecated: 23d.
     Use ‘isnan’ instead.

* Menu:

* Pack and Unpack functions::


File: python.info,  Node: Pack and Unpack functions,  Up: Floating-Point Objects

7.9.2.7 Pack and Unpack functions
.................................

The pack and unpack functions provide an efficient platform-independent
way to store floating-point values as byte strings.  The Pack routines
produce a bytes string from a C double, and the Unpack routines produce
a C double from such a bytes string.  The suffix (2, 4 or 8) specifies
the number of bytes in the bytes string.

On platforms that appear to use IEEE 754 formats these functions work by
copying bits.  On other platforms, the 2-byte format is identical to the
IEEE 754 binary16 half-precision format, the 4-byte format (32-bit) is
identical to the IEEE 754 binary32 single precision format, and the
8-byte format to the IEEE 754 binary64 double precision format, although
the packing of INFs and NaNs (if such things exist on the platform)
isn't handled correctly, and attempting to unpack a bytes string
containing an IEEE INF or NaN will raise an exception.

Note that NaNs type may not be preserved on IEEE platforms (signaling
NaN become quiet NaN), for example on x86 systems in 32-bit mode.

On non-IEEE platforms with more precision, or larger dynamic range, than
IEEE 754 supports, not all values can be packed; on non-IEEE platforms
with less precision, or smaller dynamic range, not all values can be
unpacked.  What happens in such cases is partly accidental (alas).

Added in version 3.11.

* Menu:

* Pack functions::
* Unpack functions::


File: python.info,  Node: Pack functions,  Next: Unpack functions,  Up: Pack and Unpack functions

7.9.2.8 Pack functions
......................

The pack routines write 2, 4 or 8 bytes, starting at 'p'.  'le' is an
int argument, non-zero if you want the bytes string in little-endian
format (exponent last, at ‘p+1’, ‘p+3’, or ‘p+6’ ‘p+7’), zero if you
want big-endian format (exponent first, at 'p').  The ‘PY_BIG_ENDIAN’
constant can be used to use the native endian: it is equal to ‘1’ on big
endian processor, or ‘0’ on little endian processor.

Return value: ‘0’ if all is OK, ‘-1’ if error (and an exception is set,
most likely *note OverflowError: a81.).

There are two problems on non-IEEE platforms:

   * What this does is undefined if 'x' is a NaN or infinity.

   * ‘-0.0’ and ‘+0.0’ produce the same bytes string.

 -- C の関数: int PyFloat_Pack2 (double x, char *p, int le)

     Pack a C double as the IEEE 754 binary16 half-precision format.

 -- C の関数: int PyFloat_Pack4 (double x, char *p, int le)

     Pack a C double as the IEEE 754 binary32 single precision format.

 -- C の関数: int PyFloat_Pack8 (double x, char *p, int le)

     Pack a C double as the IEEE 754 binary64 double precision format.


File: python.info,  Node: Unpack functions,  Prev: Pack functions,  Up: Pack and Unpack functions

7.9.2.9 Unpack functions
........................

The unpack routines read 2, 4 or 8 bytes, starting at 'p'.  'le' is an
int argument, non-zero if the bytes string is in little-endian format
(exponent last, at ‘p+1’, ‘p+3’ or ‘p+6’ and ‘p+7’), zero if big-endian
(exponent first, at 'p').  The ‘PY_BIG_ENDIAN’ constant can be used to
use the native endian: it is equal to ‘1’ on big endian processor, or
‘0’ on little endian processor.

Return value: The unpacked double.  On error, this is ‘-1.0’ and *note
PyErr_Occurred(): 1caf. is true (and an exception is set, most likely
*note OverflowError: a81.).

Note that on a non-IEEE platform this will refuse to unpack a bytes
string that represents a NaN or infinity.

 -- C の関数: double PyFloat_Unpack2 (const char *p, int le)

     Unpack the IEEE 754 binary16 half-precision format as a C double.

 -- C の関数: double PyFloat_Unpack4 (const char *p, int le)

     Unpack the IEEE 754 binary32 single precision format as a C double.

 -- C の関数: double PyFloat_Unpack8 (const char *p, int le)

     Unpack the IEEE 754 binary64 double precision format as a C double.


File: python.info,  Node: 複素数オブジェクト,  Prev: Floating-Point Objects,  Up: 数値型オブジェクト numeric object

7.9.2.10 複素数オブジェクト
...........................

Python の複素数オブジェクトは、C API 側から見ると二つの別個の型として実
装されています: 一方は Python プログラムに対して公開されている Python の
オブジェクトで、他方は実際の複素数値を表現する C の構造体です。API では
、これら双方を扱う関数を提供しています。

* Menu:

* C 構造体としての複素数::
* Python オブジェクトとしての複素数型::


File: python.info,  Node: C 構造体としての複素数,  Next: Python オブジェクトとしての複素数型,  Up: 複素数オブジェクト

7.9.2.11 C 構造体としての複素数
...............................

複素数の C 構造体を引数として受理したり、戻り値として返したりする関数は
、ポインタ渡しを行うのではなく '値渡し' を行うので注意してください。これ
は API 全体を通して一貫しています。

 -- C のデータ型: type Py_complex

     The C structure which corresponds to the value portion of a Python
     complex number object.  Most of the functions for dealing with
     complex number objects use structures of this type as input or
     output values, as appropriate.

      -- C のメンバ変数: double real
      -- C のメンバ変数: double imag

     The structure is defined as:

          typedef struct {
              double real;
              double imag;
          } Py_complex;

 -- C の関数: *note Py_complex: 523d. _Py_c_sum (Py_complex left,
          Py_complex right)

     二つの複素数の和を C の *note Py_complex: 523d. 型で返します。

 -- C の関数: *note Py_complex: 523d. _Py_c_diff (Py_complex left,
          Py_complex right)

     二つの複素数の差を C の *note Py_complex: 523d. 型で返します。

 -- C の関数: *note Py_complex: 523d. _Py_c_neg (Py_complex num)

     複素数 'num' の符号反転 C の *note Py_complex: 523d. 型で返します。

 -- C の関数: *note Py_complex: 523d. _Py_c_prod (Py_complex left,
          Py_complex right)

     二つの複素数の積を C の *note Py_complex: 523d. 型で返します。

 -- C の関数: *note Py_complex: 523d. _Py_c_quot (Py_complex dividend,
          Py_complex divisor)

     二つの複素数の商を C の *note Py_complex: 523d. 型で返します。

     'divisor' が null の場合は、このメソッドはゼロを返し、 ‘errno’ に
     ‘EDOM’ をセットします。

 -- C の関数: *note Py_complex: 523d. _Py_c_pow (Py_complex num,
          Py_complex exp)

     指数 'exp' の 'num' 乗を C の *note Py_complex: 523d. 型で返します
     。

     'num' が null で 'exp' が正の実数でない場合は、このメソッドはゼロを
     返し、 ‘errno’ に ‘EDOM’ をセットします。

     Set ‘errno’ to ‘ERANGE’ on overflows.


File: python.info,  Node: Python オブジェクトとしての複素数型,  Prev: C 構造体としての複素数,  Up: 複素数オブジェクト

7.9.2.12 Python オブジェクトとしての複素数型
............................................

 -- C のデータ型: type PyComplexObject

     この *note PyObject: 5df. のサブタイプは Python の複素数型を表現し
     ます。

 -- C 変数: *note PyTypeObject: c9c. PyComplex_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     c9c. のインスタンスは Python の複素数型を表現します。 Pythonレイヤ
     の *note complex: 197. と同じオブジェクトです。

 -- C の関数: int PyComplex_Check (PyObject *p)

     引数が *note PyComplexObject: 533b. か *note PyComplexObject: 533b.
     のサブタイプであるときに真を返します。この関数は常に成功します。

 -- C の関数: int PyComplex_CheckExact (PyObject *p)

     引数が *note PyComplexObject: 533b. であるが *note PyComplexObject:
     533b. のサブタイプでないときに真を返します。この関数は常に成功しま
     す。

 -- C の関数: *note PyObject: 5df. *PyComplex_FromCComplex (Py_complex
          v)
     '戻り値: 新しい参照。' Create a new Python complex number object
     from a C *note Py_complex: 523d. value.  Return ‘NULL’ with an
     exception set on error.

 -- C の関数: *note PyObject: 5df. *PyComplex_FromDoubles (double real,
          double imag)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return a new *note PyComplexObject: 533b. object from 'real' and
     'imag'.  Return ‘NULL’ with an exception set on error.

 -- C の関数: double PyComplex_RealAsDouble (PyObject *op)
     ' 次に属します: *note Stable ABI: 775.'  'op' の実数部分を C の
     double 型で返します。

     If 'op' is not a Python complex number object but has a *note
     __complex__(): 7fd. method, this method will first be called to
     convert 'op' to a Python complex number object.  If ‘__complex__()’
     is not defined then it falls back to call *note PyFloat_AsDouble():
     c5f. and returns its result.

     Upon failure, this method returns ‘-1.0’ with an exception set, so
     one should call *note PyErr_Occurred(): 1caf. to check for errors.

     バージョン 3.13 で変更: Use *note __complex__(): 7fd. if available.

 -- C の関数: double PyComplex_ImagAsDouble (PyObject *op)
     ' 次に属します: *note Stable ABI: 775.'  'op' の虚数部分を C の
     double 型で返します。

     If 'op' is not a Python complex number object but has a *note
     __complex__(): 7fd. method, this method will first be called to
     convert 'op' to a Python complex number object.  If ‘__complex__()’
     is not defined then it falls back to call *note PyFloat_AsDouble():
     c5f. and returns ‘0.0’ on success.

     Upon failure, this method returns ‘-1.0’ with an exception set, so
     one should call *note PyErr_Occurred(): 1caf. to check for errors.

     バージョン 3.13 で変更: Use *note __complex__(): 7fd. if available.

 -- C の関数: *note Py_complex: 523d. PyComplex_AsCComplex (PyObject
          *op)

     複素数値 'op' から *note Py_complex: 523d. 型を生成します。

     If 'op' is not a Python complex number object but has a *note
     __complex__(): 7fd. method, this method will first be called to
     convert 'op' to a Python complex number object.  If ‘__complex__()’
     is not defined then it falls back to *note __float__(): bc1.  If
     ‘__float__()’ is not defined then it falls back to *note
     __index__(): 19e.

     Upon failure, this method returns *note Py_complex: 523d. with
     *note real: 5333. set to ‘-1.0’ and with an exception set, so one
     should call *note PyErr_Occurred(): 1caf. to check for errors.

     バージョン 3.8 で変更: 可能であれば *note __index__(): 19e. を使う
     ようになりました。


File: python.info,  Node: シーケンスオブジェクト sequence object,  Next: Container オブジェクト,  Prev: 数値型オブジェクト numeric object,  Up: 具象オブジェクト concrete object レイヤ

7.9.3 シーケンスオブジェクト (sequence object)
----------------------------------------------

シーケンスオブジェクトに対する一般的な操作については前の章ですでに述べま
した; この節では、Python 言語にもともと備わっている特定のシーケンスオブ
ジェクトについて扱います。

* Menu:

* バイトオブジェクト: バイトオブジェクト<2>.
* bytearray オブジェクト: bytearray オブジェクト<2>.
* Unicode オブジェクトと codec::
* タプルオブジェクト (tuple object): タプルオブジェクト tuple object.
* Struct Sequence オブジェクト::
* リストオブジェクト::


File: python.info,  Node: バイトオブジェクト<2>,  Next: bytearray オブジェクト<2>,  Up: シーケンスオブジェクト sequence object

7.9.3.1 バイトオブジェクト
..........................

下記の関数は、バイトオブジェクトを期待している引数にバイトオブジェクトで
ないパラメタを指定して呼び出されると、 *note TypeError: 198. を送出しま
す。

 -- C のデータ型: type PyBytesObject

     この *note PyObject: 5df. のサブタイプは、Python バイトオブジェクト
     を表します。

 -- C 変数: *note PyTypeObject: c9c. PyBytes_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     c9c. のインスタンスは、Python バイト型を表します; Pythonレイヤの
     *note bytes: 192. と同じオブジェクトです。

 -- C の関数: int PyBytes_Check (PyObject *o)

     オブジェクト 'o' が bytes オブジェクトか bytes 型のサブタイプのイン
     スタンスである場合に真を返します。この関数は常に成功します。

 -- C の関数: int PyBytes_CheckExact (PyObject *o)

     オブジェクト 'o' が bytes オブジェクトだが bytes 型のサブタイプのイ
     ンスタンスでない場合に真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyBytes_FromString (const char *v)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     時に、文字列 'v' のコピーを値とする新しいバイトオブジェクトを返し、
     失敗時に ‘NULL’ を返します。 引数 'v' は ‘NULL’ であってはなりませ
     ん; そのチェックは行われません。

 -- C の関数: *note PyObject: 5df. *PyBytes_FromStringAndSize (const
          char *v, Py_ssize_t len)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  成功
     時に、文字列 'v' のコピーを値とする長さ 'len' の新しいバイトオブジ
     ェクトを返し、失敗時に ‘NULL’ を返します。 引数 'v' が ‘NULL’ の場
     合、バイトオブジェクトの中身は初期化されていません。

 -- C の関数: *note PyObject: 5df. *PyBytes_FromFormat (const char
          *format, ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  C 関
     数の ‘printf()’ スタイルの 'format' 文字列と可変長の引数を取り、結
     果のPython バイトオブジェクトのサイズを計算し、値を指定した書式にし
     たがって変換したバイトオブジェクトを返します。可変長の引数は C のデ
     ータ型でなければならず、 'format' 文字列中のフォーマット文字と厳密
     に関連付けられていなければなりません。下記のフォーマット文字が使用
     できます:

     書式指定文字            型                  備考
                                                 
     ---------------------------------------------------------------------------------
                                                 
     ‘%%’                    'n/a'               リテラルの % 文字
                                                 
                                                 
     ‘%c’                    int                 C の整数型で表現される単一のバイト
                                                 。
                                                 
                                                 
     ‘%d’                    int                 ‘printf("%d")’ と同等。 (1)
                                                 
                                                 
     ‘%u’                    unsigned int        ‘printf("%u")’ と同等。 (2)
                                                 
                                                 
     ‘%ld’                   long                ‘printf("%ld")’ と同等。 (3)
                                                 
                                                 
     ‘%lu’                   unsigned long       ‘printf("%lu")’ と同等。 (4)
                                                 
                                                 
     ‘%zd’                   *note Py_ssize_t: c55.‘printf("%zd")’ と同等。 (5)
                                                 
                                                 
     ‘%zu’                   size_t              ‘printf("%zu")’ と同等。 (6)
                                                 
                                                 
     ‘%i’                    int                 ‘printf("%i")’ と同等。 (7)
                                                 
                                                 
     ‘%x’                    int                 ‘printf("%x")’ と同等。 (8)
                                                 
                                                 
     ‘%s’                    const char*         null で終端された C の文字列。
                                                 
                                                 
     ‘%p’                    const void*         C ポインタの 16 進表記。
                                                 ‘printf("%p")’ とほとんど同じです
                                                 が、プラットフォームにおける
                                                 ‘printf’ の定義に関わりなく先頭に
                                                 リテラル ‘0x’ が付きます。
                                                 

     識別できない書式指定文字があった場合、残りの書式文字列はそのまま結
     果のオブジェクトにコピーされ、残りの引数は無視されます。

 -- C の関数: *note PyObject: 5df. *PyBytes_FromFormatV (const char
          *format, va_list vargs)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  ちょ
     うど２つの引数を取ることを除いて、 *note PyBytes_FromFormat():
     1e0b. と同じです。

 -- C の関数: *note PyObject: 5df. *PyBytes_FromObject (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  バッ
     ファプロトコルを実装するオブジェクト 'o' のバイト表現を返します。

 -- C の関数: *note Py_ssize_t: c55. PyBytes_Size (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'  バイトオブジェクト 'o' の
     バイト単位の長さを返します。

 -- C の関数: *note Py_ssize_t: c55. PyBytes_GET_SIZE (PyObject *o)

     *note PyBytes_Size(): 4f87. に似ていますが、エラーチェックを行いま
     せん。

 -- C の関数: char *PyBytes_AsString (PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'  'o' の中身へのポインタを返
     します。 ポインタは、 ‘len(o) + 1’ バイトからなる 'o' の内部バッフ
     ァを参照します。 他に null のバイトがあるかどうかにかかわらず、バッ
     ファの最後のバイトは必ず null になります。
     ‘PyBytes_FromStringAndSize(NULL, size)’ で生成された場合を除いて、
     データを修正してはなりません。 またポインタを解放（deallocated）し
     てはなりません。 もし、 'o' が bytes オブジェクトでなければ、 *note
     PyBytes_AsString(): a87. は ‘NULL’ を返し *note TypeError: 198. を
     送出します。

 -- C の関数: char *PyBytes_AS_STRING (PyObject *string)

     *note PyBytes_AsString(): a87. に似ていますが、エラーチェックを行い
     ません。

 -- C の関数: int PyBytes_AsStringAndSize (PyObject *obj, char **buffer,
          Py_ssize_t *length)
     ' 次に属します: *note Stable ABI: 775.'  Return the null-terminated
     contents of the object 'obj' through the output variables 'buffer'
     and 'length'.  Returns ‘0’ on success.

     'length' の値が ‘NULL’ の場合、バイトオブジェクトが null バイトを含
     まない可能性があります。その場合、関数は ‘-1’ を返し、 *note
     ValueError: 2ec. を送出します。

     buffer は 'obj' の内部バッファを参照していて、これには末尾の null バ
     イトも含んでいます (これは 'length' には数えられません)。 オブジェ
     クトが ‘PyBytes_FromStringAndSize(NULL, size)’ で生成された場合を除
     いて、何があってもデータを改変してはいけません。 オブジェクトを解放
     (deallocate) してもいけません。 'obj' が bytes オブジェクトでなかっ
     た場合は、 *note PyBytes_AsStringAndSize(): 4f7f. は ‘-1’ を返し
     *note TypeError: 198. を送出します。

     バージョン 3.5 で変更: 以前は bytes オブジェクトにヌルバイトが埋め
     込まれていたときに *note TypeError: 198. を送出していました。

 -- C の関数: void PyBytes_Concat (PyObject **bytes, PyObject *newpart)
     ' 次に属します: *note Stable ABI: 775.'  'newpart' の内容を 'bytes'
     の後ろに連結した新しいバイトオブジェクトを '*bytes' に生成します。
     呼び出し側は新しい参照を所有します。 'bytes' の古い値の参照は盗まれ
     ます。 もし新しいオブジェクトが生成できない場合、古い 'bytes' の参
     照は放棄され、 '*bytes' の値は ‘NULL’ に設定されます; 適切な例外が
     設定されます。

 -- C の関数: void PyBytes_ConcatAndDel (PyObject **bytes, PyObject
          *newpart)
     ' 次に属します: *note Stable ABI: 775.'  Create a new bytes object
     in '*bytes' containing the contents of 'newpart' appended to
     'bytes'.  This version releases the *note strong reference: 5e2. to
     'newpart' (i.e.  decrements its reference count).

 -- C の関数: *note PyObject: 5df. *PyBytes_Join (PyObject *sep,
          PyObject *iterable)

     Similar to ‘sep.join(iterable)’ in Python.

     'sep' must be Python *note bytes: 192. object.  (Note that *note
     PyUnicode_Join(): 13ba. accepts ‘NULL’ separator and treats it as a
     space, whereas *note PyBytes_Join(): 383. doesn't accept ‘NULL’
     separator.)

     'iterable' must be an iterable object yielding objects that
     implement the *note buffer protocol: 260.

     On success, return a new *note bytes: 192. object.  On error, set
     an exception and return ‘NULL’.

     Added in version 3.14.

 -- C の関数: int _PyBytes_Resize (PyObject **bytes, Py_ssize_t newsize)

     Resize a bytes object.  'newsize' will be the new length of the
     bytes object.  You can think of it as creating a new bytes object
     and destroying the old one, only more efficiently.  Pass the
     address of an existing bytes object as an lvalue (it may be written
     into), and the new size desired.  On success, '*bytes' holds the
     resized bytes object and ‘0’ is returned; the address in '*bytes'
     may differ from its input value.  If the reallocation fails, the
     original bytes object at '*bytes' is deallocated, '*bytes' is set
     to ‘NULL’, *note MemoryError: 179e. is set, and ‘-1’ is returned.

 -- C の関数: *note PyObject: 5df. *PyBytes_Repr (PyObject *bytes, int
          smartquotes)
     ' 次に属します: *note Stable ABI: 775.'  Get the string
     representation of 'bytes'.  This function is currently used to
     implement ‘bytes.__repr__()’ in Python.

     This function does not do type checking; it is undefined behavior
     to pass 'bytes' as a non-bytes object or ‘NULL’.

     If 'smartquotes' is true, the representation will use a
     double-quoted string instead of single-quoted string when
     single-quotes are present in 'bytes'.  For example, the byte string
     ‘'Python'’ would be represented as ‘b"'Python'"’ when 'smartquotes'
     is true, or ‘b'\'Python\''’ when it is false.

     On success, this function returns a *note strong reference: 5e2. to
     a *note str: 169. object containing the representation.  On
     failure, this returns ‘NULL’ with an exception set.

 -- C の関数: *note PyObject: 5df. *PyBytes_DecodeEscape (const char *s,
          Py_ssize_t len, const char *errors, Py_ssize_t unicode, const
          char *recode_encoding)
     ' 次に属します: *note Stable ABI: 775.'  Unescape a
     backslash-escaped string 's'.  's' must not be ‘NULL’.  'len' must
     be the size of 's'.

     'errors' must be one of ‘"strict"’, ‘"replace"’, or ‘"ignore"’.  If
     'errors' is ‘NULL’, then ‘"strict"’ is used by default.

     On success, this function returns a *note strong reference: 5e2. to
     a Python *note bytes: 192. object containing the unescaped string.
     On failure, this function returns ‘NULL’ with an exception set.

     バージョン 3.9 で変更: 'unicode' and 'recode_encoding' are now
     unused.

   ---------- Footnotes ----------

   (1) 整数指定子 (d, u, ld, lu, zd, zu, i, x): 精度が与えられていても、
0指定子は有効です。

   (2) 整数指定子 (d, u, ld, lu, zd, zu, i, x): 精度が与えられていても、
0指定子は有効です。

   (3) 整数指定子 (d, u, ld, lu, zd, zu, i, x): 精度が与えられていても、
0指定子は有効です。

   (4) 整数指定子 (d, u, ld, lu, zd, zu, i, x): 精度が与えられていても、
0指定子は有効です。

   (5) 整数指定子 (d, u, ld, lu, zd, zu, i, x): 精度が与えられていても、
0指定子は有効です。

   (6) 整数指定子 (d, u, ld, lu, zd, zu, i, x): 精度が与えられていても、
0指定子は有効です。

   (7) 整数指定子 (d, u, ld, lu, zd, zu, i, x): 精度が与えられていても、
0指定子は有効です。

   (8) 整数指定子 (d, u, ld, lu, zd, zu, i, x): 精度が与えられていても、
0指定子は有効です。


File: python.info,  Node: bytearray オブジェクト<2>,  Next: Unicode オブジェクトと codec,  Prev: バイトオブジェクト<2>,  Up: シーケンスオブジェクト sequence object

7.9.3.2 bytearray オブジェクト
..............................

 -- C のデータ型: type PyByteArrayObject

     この *note PyObject: 5df. のサブタイプは Python の bytearray オブジ
     ェクトを表します。

 -- C 変数: *note PyTypeObject: c9c. PyByteArray_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     c9c. のインスタンスは、 Python bytearray 型を示します。 Python レイ
     ヤでの *note bytearray: 344. と同じオブジェクトです。

* Menu:

* 型チェックマクロ::
* ダイレクト API 関数::
* マクロ::


File: python.info,  Node: 型チェックマクロ,  Next: ダイレクト API 関数,  Up: bytearray オブジェクト<2>

7.9.3.3 型チェックマクロ
........................

 -- C の関数: int PyByteArray_Check (PyObject *o)

     オブジェクト 'o' が bytearray オブジェクトか bytearray 型のサブタイ
     プのインスタンスである場合に真を返します。この関数は常に成功します
     。

 -- C の関数: int PyByteArray_CheckExact (PyObject *o)

     オブジェクト 'o' が bytearray オブジェクトだが bytearray 型のサブタ
     イプのインスタンスでない場合に真を返します。この関数は常に成功しま
     す。


File: python.info,  Node: ダイレクト API 関数,  Next: マクロ,  Prev: 型チェックマクロ,  Up: bytearray オブジェクト<2>

7.9.3.4 ダイレクト API 関数
...........................

 -- C の関数: *note PyObject: 5df. *PyByteArray_FromObject (PyObject *o)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     *note buffer protocol: 260. を実装した任意のオブジェクト 'o' から、
     新しいbytearrayオブジェクトを作成し、返します。

     On failure, return ‘NULL’ with an exception set.

 -- C の関数: *note PyObject: 5df. *PyByteArray_FromStringAndSize (const
          char *string, Py_ssize_t len)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Create a new bytearray object from 'string' and its length, 'len'.

     On failure, return ‘NULL’ with an exception set.

 -- C の関数: *note PyObject: 5df. *PyByteArray_Concat (PyObject *a,
          PyObject *b)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     bytearray 'a' と 'b' を連結した結果を新しい bytearray として返しま
     す。

     On failure, return ‘NULL’ with an exception set.

 -- C の関数: *note Py_ssize_t: c55. PyByteArray_Size (PyObject
          *bytearray)
     ' 次に属します: *note Stable ABI: 775.'  ‘NULL’ ポインタチェックの
     後に 'bytearray' のサイズを返します。

 -- C の関数: char *PyByteArray_AsString (PyObject *bytearray)
     ' 次に属します: *note Stable ABI: 775.'  ‘NULL’ ポインタチェックの
     後に 'bytearray' の内容を char 配列として返します。 返される配列に
     は、常に余分な null バイトが追加されます。

 -- C の関数: int PyByteArray_Resize (PyObject *bytearray, Py_ssize_t
          len)
     ' 次に属します: *note Stable ABI: 775.'  Resize the internal buffer
     of 'bytearray' to 'len'.  Failure is a ‘-1’ return with an
     exception set.

     バージョン 3.14 で変更: A negative 'len' will now result in an
     exception being set and -1 returned.


File: python.info,  Node: マクロ,  Prev: ダイレクト API 関数,  Up: bytearray オブジェクト<2>

7.9.3.5 マクロ
..............

以下のマクロは、ポインタのチェックをしないことにより安全性を犠牲にしてス
ピードを優先しています。

 -- C の関数: char *PyByteArray_AS_STRING (PyObject *bytearray)

     *note PyByteArray_AsString(): 4f79. に似ていますが、エラーチェック
     を行いません。

 -- C の関数: *note Py_ssize_t: c55. PyByteArray_GET_SIZE (PyObject
          *bytearray)

     *note PyByteArray_Size(): 4f7c. に似ていますが、エラーチェックを行
     いません。


File: python.info,  Node: Unicode オブジェクトと codec,  Next: タプルオブジェクト tuple object,  Prev: bytearray オブジェクト<2>,  Up: シーケンスオブジェクト sequence object

7.9.3.6 Unicode オブジェクトと codec
....................................

* Menu:

* Unicode オブジェクト::
* 組み込み codec (built-in codec): 組み込み codec built-in codec.
* メソッドおよびスロット関数 (slot function): メソッドおよびスロット関数 slot function.
* PyUnicodeWriter::
* Deprecated API: Deprecated API<2>.


File: python.info,  Node: Unicode オブジェクト,  Next: 組み込み codec built-in codec,  Up: Unicode オブジェクトと codec

7.9.3.7 Unicode オブジェクト
............................

Python3.3 の PEP 393(1) 実装から、メモリ効率を維持しながらUnicode文字の
完全な範囲を扱えるように、Unicodeオブジェクトは内部的に多様な表現形式を
用いています。すべてのコードポイントが128、256または65536以下の文字列に
対して特別なケースが存在しますが、それ以外ではコードポイントは1114112以
下 (これはすべてのUnicode範囲です) でなければなりません。

UTF-8 representation is created on demand and cached in the Unicode
object.

     注釈: The *note Py_UNICODE: 3e0. representation has been removed
     since Python 3.12 with deprecated APIs.  See PEP 623(2) for more
     information.

* Menu:

* Unicode 型::
* Unicode 文字プロパティ::
* Unicode 文字列の生成とアクセス::
* ロケールエンコーディング::
* ファイルシステムエンコーディング::
* wchar_t サポート::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0393/

   (2) https://peps.python.org/pep-0623/


File: python.info,  Node: Unicode 型,  Next: Unicode 文字プロパティ,  Up: Unicode オブジェクト

7.9.3.8 Unicode 型
..................

以下は Python の Unicode 実装に用いられている基本 Unicode オブジェクト型
です:

 -- C 変数: *note PyTypeObject: c9c. PyUnicode_Type
     ' 次に属します: *note Stable ABI: 775.'  This instance of *note
     PyTypeObject: c9c. represents the Python Unicode type.  It is
     exposed to Python code as *note str: 169.

 -- C 変数: *note PyTypeObject: c9c. PyUnicodeIter_Type
     ' 次に属します: *note Stable ABI: 775.'  This instance of *note
     PyTypeObject: c9c. represents the Python Unicode iterator type.  It
     is used to iterate over Unicode string objects.

 -- C のデータ型: type Py_UCS4
 -- C のデータ型: type Py_UCS2
 -- C のデータ型: type Py_UCS1
     ' 次に属します: *note Stable ABI: 775.'  これらの型は、それぞれ、
     32ビット、16ビット、そして8ビットの文字を保持するのに充分な幅を持つ
     符号なしの整数型のtypedefです。単一のUnicode文字を扱う場合は、
     *note Py_UCS4: 33d. を用いてください。

     Added in version 3.3.

 -- C のデータ型: type PyASCIIObject
 -- C のデータ型: type PyCompactUnicodeObject
 -- C のデータ型: type PyUnicodeObject

     これらの *note PyObject: 5df. のサブタイプは Python Unicode オブジ
     ェクトを表現します。 Unicode オブジェクトを扱う全ての API 関数は
     *note PyObject: 5df. へのポインタを受け取って PyObject へのポインタ
     を返すので、ほとんどの場合、これらの型を直接使うべきではありません
     。

     Added in version 3.3.

     The structure of a particular object can be determined using the
     following macros.  The macros cannot fail; their behavior is
     undefined if their argument is not a Python Unicode object.

      -- C のマクロ: PyUnicode_IS_COMPACT (o)

          True if 'o' uses the *note PyCompactUnicodeObject: 138e.
          structure.

          Added in version 3.3.

      -- C のマクロ: PyUnicode_IS_COMPACT_ASCII (o)

          True if 'o' uses the *note PyASCIIObject: 138d. structure.

          Added in version 3.3.

The following APIs are C macros and static inlined functions for fast
checks and access to internal read-only data of Unicode objects:

 -- C の関数: int PyUnicode_Check (PyObject *obj)

     オブジェクト 'obj' が Unicode オブジェクトか Unicode 型のサブタイプ
     のインスタンスである場合に真を返します。この関数は常に成功します。

 -- C の関数: int PyUnicode_CheckExact (PyObject *obj)

     オブジェクト 'obj' が Unicode オブジェクトだがサブタイプのインスタ
     ンスでない場合に真を返します。この関数は常に成功します。

 -- C の関数: *note Py_ssize_t: c55. PyUnicode_GET_LENGTH (PyObject
          *unicode)

     Unicode 文字列のコードポイントでの長さを返します。 'unicode' は "正
     統な" 表現形式の Unicode オブジェクトでなければなりません (ただしチ
     ェックはしません)。

     Added in version 3.3.

 -- C の関数: *note Py_UCS1: 138b. *PyUnicode_1BYTE_DATA (PyObject
          *unicode)
 -- C の関数: *note Py_UCS2: 138c. *PyUnicode_2BYTE_DATA (PyObject
          *unicode)
 -- C の関数: *note Py_UCS4: 33d. *PyUnicode_4BYTE_DATA (PyObject
          *unicode)

     文字に直接アクセスするために、 UCS1, UCS2, UCS4 のいずれかの整数型
     にキャストされた正統な表現形式へのポインタを返します。 正統な表現が
     適正な文字サイズになっているかどうかのチェックはしません; *note
     PyUnicode_KIND(): 1395. を使って正しい関数を選んでください。

     Added in version 3.3.

 -- C のマクロ: PyUnicode_1BYTE_KIND
 -- C のマクロ: PyUnicode_2BYTE_KIND
 -- C のマクロ: PyUnicode_4BYTE_KIND

     *note PyUnicode_KIND(): 1395. マクロの返り値です。

     Added in version 3.3.

     バージョン 3.12 で変更: ‘PyUnicode_WCHAR_KIND’ は削除されました。

 -- C の関数: int PyUnicode_KIND (PyObject *unicode)

     この Unicode がデータを保存するのに1文字あたり何バイト使っているか
     を示す PyUnicode 種別の定数 (上を読んでください) のうち1つを返しま
     す。 'unicode' は "正統な" 表現形式の Unicode オブジェクトでなけれ
     ばなりません (ただしチェックはしません)。

     Added in version 3.3.

 -- C の関数: void *PyUnicode_DATA (PyObject *unicode)

     生の Unicode バッファへの void ポインタを返します。 'unicode' は "正
     統な" 表現形式の Unicode オブジェクトでなければなりません (ただしチ
     ェックはしません)。

     Added in version 3.3.

 -- C の関数: void PyUnicode_WRITE (int kind, void *data, Py_ssize_t
          index, Py_UCS4 value)

     Write the code point 'value' to the given zero-based 'index' in a
     string.

     The 'kind' value and 'data' pointer must have been obtained from a
     string using *note PyUnicode_KIND(): 1395. and *note
     PyUnicode_DATA(): 1391. respectively.  You must hold a reference to
     that string while calling ‘PyUnicode_WRITE()’.  All requirements of
     *note PyUnicode_WriteChar(): 138a. also apply.

     The function performs no checks for any of its requirements, and is
     intended for usage in loops.

     Added in version 3.3.

 -- C の関数: *note Py_UCS4: 33d. PyUnicode_READ (int kind, void *data,
          Py_ssize_t index)

     正統な表現形式となっている (*note PyUnicode_DATA(): 1391. で取得し
     た) 'data' からコードポイントを読み取ります。 チェックや事前確認の
     マクロ呼び出しは一切行われません。

     Added in version 3.3.

 -- C の関数: *note Py_UCS4: 33d. PyUnicode_READ_CHAR (PyObject
          *unicode, Py_ssize_t index)

     Unicode オブジェクト 'unicode' から文字を読み取ります。 この
     Unicode オブジェクトは "正統な" 表現形式でなければなりません。 何度
     も連続して読み取る場合には、このマクロは *note PyUnicode_READ():
     1399. よりも非効率的です。

     Added in version 3.3.

 -- C の関数: *note Py_UCS4: 33d. PyUnicode_MAX_CHAR_VALUE (PyObject
          *unicode)

     'unicode' に基づいて他の文字列を作るのに適した最大のコードポイント
     を返します。 この Unicode オブジェクトは "正統な" 表現形式でなけれ
     ばなりません。 この値は常に概算値ですが、文字列全体を調べるよりも効
     率的です。

     Added in version 3.3.

 -- C の関数: int PyUnicode_IsIdentifier (PyObject *unicode)
     ' 次に属します: *note Stable ABI: 775.'  文字列が、 *note Names
     (identifiers and keywords): 22a0. 節の言語定義における有効な識別子
     であれば ‘1’ を返します。それ以外の場合は ‘0’ を返します。

     バージョン 3.9 で変更: The function does not call *note
     Py_FatalError(): b7a. anymore if the string is not ready.

 -- C の関数: unsigned int PyUnicode_IS_ASCII (PyObject *unicode)

     Return true if the string only contains ASCII characters.
     Equivalent to *note str.isascii(): ce9.

     Added in version 3.2.


File: python.info,  Node: Unicode 文字プロパティ,  Next: Unicode 文字列の生成とアクセス,  Prev: Unicode 型,  Up: Unicode オブジェクト

7.9.3.9 Unicode 文字プロパティ
..............................

Unicode は数多くの異なる文字プロパティ (character property) を提供してい
ます。よく使われる文字プロパティは、以下のマクロで利用できます。これらの
マクロは Python の設定に応じて、各々 C の関数に対応付けられています。

 -- C の関数: int Py_UNICODE_ISSPACE (Py_UCS4 ch)

     'ch' が空白文字かどうかに応じて ‘1’ または ‘0’ を返します。

 -- C の関数: int Py_UNICODE_ISLOWER (Py_UCS4 ch)

     'ch' が小文字かどうかに応じて ‘1’ または ‘0’ を返します。

 -- C の関数: int Py_UNICODE_ISUPPER (Py_UCS4 ch)

     'ch' が大文字かどうかに応じて ‘1’ または ‘0’ を返します。

 -- C の関数: int Py_UNICODE_ISTITLE (Py_UCS4 ch)

     'ch' がタイトルケース文字 (titlecase character) かどうかに応じて
     ‘1’ または ‘0’ を返します。

 -- C の関数: int Py_UNICODE_ISLINEBREAK (Py_UCS4 ch)

     'ch' が改行文字かどうかに応じて ‘1’ または ‘0’ を返します。

 -- C の関数: int Py_UNICODE_ISDECIMAL (Py_UCS4 ch)

     'ch' が decimal 文字かどうかに応じて ‘1’ または ‘0’ を返します。

 -- C の関数: int Py_UNICODE_ISDIGIT (Py_UCS4 ch)

     'ch' が digit 文字かどうかに応じて ‘1’ または ‘0’ を返します。

 -- C の関数: int Py_UNICODE_ISNUMERIC (Py_UCS4 ch)

     'ch' が数字 (numeric) 文字かどうかに応じて ‘1’ または ‘0’ を返しま
     す。

 -- C の関数: int Py_UNICODE_ISALPHA (Py_UCS4 ch)

     'ch' がアルファベット文字かどうかに応じて ‘1’ または ‘0’ を返します
     。

 -- C の関数: int Py_UNICODE_ISALNUM (Py_UCS4 ch)

     'ch' が英数文字かどうかに応じて ‘1’ または ‘0’ を返します。

 -- C の関数: int Py_UNICODE_ISPRINTABLE (Py_UCS4 ch)

     Return ‘1’ or ‘0’ depending on whether 'ch' is a printable
     character, in the sense of *note str.isprintable(): fd8.

以下の API は、高速に直接文字変換を行うために使われます:

 -- C の関数: *note Py_UCS4: 33d. Py_UNICODE_TOLOWER (Py_UCS4 ch)

     'ch' を小文字に変換したものを返します。

 -- C の関数: *note Py_UCS4: 33d. Py_UNICODE_TOUPPER (Py_UCS4 ch)

     'ch' を大文字に変換したものを返します。

 -- C の関数: *note Py_UCS4: 33d. Py_UNICODE_TOTITLE (Py_UCS4 ch)

     'ch' をタイトルケース文字に変換したものを返します。

 -- C の関数: int Py_UNICODE_TODECIMAL (Py_UCS4 ch)

     Return the character 'ch' converted to a decimal positive integer.
     Return ‘-1’ if this is not possible.  This function does not raise
     exceptions.

 -- C の関数: int Py_UNICODE_TODIGIT (Py_UCS4 ch)

     Return the character 'ch' converted to a single digit integer.
     Return ‘-1’ if this is not possible.  This function does not raise
     exceptions.

 -- C の関数: double Py_UNICODE_TONUMERIC (Py_UCS4 ch)

     'ch' を double に変換したものを返します。不可能ならば ‘-1.0’ を返し
     ます。この関数は例外を送出しません。

これらの API はサロゲートにも使えます:

 -- C の関数: int Py_UNICODE_IS_SURROGATE (Py_UCS4 ch)

     'ch' がサロゲートかどうか (‘0xD800 <= ch <= 0xDFFF’) をチェックしま
     す。

 -- C の関数: int Py_UNICODE_IS_HIGH_SURROGATE (Py_UCS4 ch)

     'ch' が上位サロゲートかどうか (‘0xD800 <= ch <= 0xDBFF’) をチェック
     します。

 -- C の関数: int Py_UNICODE_IS_LOW_SURROGATE (Py_UCS4 ch)

     'ch' が下位サロゲートかどうか (‘0xDC00 <= ch <= 0xDFFF’) をチェック
     します。

 -- C の関数: *note Py_UCS4: 33d. Py_UNICODE_HIGH_SURROGATE (Py_UCS4 ch)

     Return the high UTF-16 surrogate (‘0xD800’ to ‘0xDBFF’) for a
     Unicode code point in the range ‘[0x10000; 0x10FFFF]’.

 -- C の関数: *note Py_UCS4: 33d. Py_UNICODE_LOW_SURROGATE (Py_UCS4 ch)

     Return the low UTF-16 surrogate (‘0xDC00’ to ‘0xDFFF’) for a
     Unicode code point in the range ‘[0x10000; 0x10FFFF]’.

 -- C の関数: *note Py_UCS4: 33d. Py_UNICODE_JOIN_SURROGATES (Py_UCS4
          high, Py_UCS4 low)

     Join two surrogate code points and return a single *note Py_UCS4:
     33d. value.  'high' and 'low' are respectively the leading and
     trailing surrogates in a surrogate pair.  'high' must be in the
     range ‘[0xD800; 0xDBFF]’ and 'low' must be in the range ‘[0xDC00;
     0xDFFF]’.


File: python.info,  Node: Unicode 文字列の生成とアクセス,  Next: ロケールエンコーディング,  Prev: Unicode 文字プロパティ,  Up: Unicode オブジェクト

7.9.3.10 Unicode 文字列の生成とアクセス
.......................................

Unicode オブジェクトを生成したり、Unicode のシーケンスとしての基本的なプ
ロパティにアクセスしたりするには、以下の API を使ってください:

 -- C の関数: *note PyObject: 5df. *PyUnicode_New (Py_ssize_t size,
          Py_UCS4 maxchar)
     '戻り値: 新しい参照。' 新しい Unicode オブジェクトを生成します。
     'maxchar' は文字列に並べるコードポイントの正しい最大値にすべきです
     。 その値は概算値として 127, 255, 65535, 1114111 の一番近い値に切り
     上げられます。

     On error, set an exception and return ‘NULL’.

     After creation, the string can be filled by *note
     PyUnicode_WriteChar(): 138a, *note PyUnicode_CopyCharacters(): ab2,
     *note PyUnicode_Fill(): 13a5, *note PyUnicode_WRITE(): 139b. or
     similar.  Since strings are supposed to be immutable, take care to
     not “use” the result while it is being modified.  In particular,
     before it's filled with its final contents, a string:

        - must not be hashed,

        - must not be *note converted to UTF-8: a99, or another
          non-"canonical" representation,

        - must not have its reference count changed,

        - must not be shared with code that might do one of the above.

     This list is not exhaustive.  Avoiding these uses is your
     responsibility; Python does not always check these requirements.

     To avoid accidentally exposing a partially-written string object,
     prefer using the *note PyUnicodeWriter: 3b3. API, or one of the
     ‘PyUnicode_From*’ functions below.

     Added in version 3.3.

 -- C の関数: *note PyObject: 5df. *PyUnicode_FromKindAndData (int kind,
          const void *buffer, Py_ssize_t size)
     '戻り値: 新しい参照。' 与えられた 'kind' (取り得る値は *note
     PyUnicode_1BYTE_KIND: 1396. などの *note PyUnicode_KIND(): 1395. が
     返す値です) の Unicode オブジェクトを生成します。 'buffer' は、与え
     られた kind に従って1文字あたり 1, 2, 4 バイトのいずれかを単位とし
     て、長さ 'size' の配列へのポインタでなければなりません。

     If necessary, the input 'buffer' is copied and transformed into the
     canonical representation.  For example, if the 'buffer' is a UCS4
     string (*note PyUnicode_4BYTE_KIND: 1398.) and it consists only of
     codepoints in the UCS1 range, it will be transformed into UCS1
     (*note PyUnicode_1BYTE_KIND: 1396.).

     Added in version 3.3.

 -- C の関数: *note PyObject: 5df. *PyUnicode_FromStringAndSize (const
          char *str, Py_ssize_t size)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Create a Unicode object from the char buffer 'str'.  The bytes will
     be interpreted as being UTF-8 encoded.  The buffer is copied into
     the new object.  The return value might be a shared object, i.e.
     modification of the data is not allowed.

     This function raises *note SystemError: 795. when:

        * 'size' < 0,

        * 'str' is ‘NULL’ and 'size' > 0

     バージョン 3.12 で変更: 'str' == ‘NULL’ with 'size' > 0 is not
     allowed anymore.

 -- C の関数: *note PyObject: 5df. *PyUnicode_FromString (const char
          *str)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     UTF-8 エンコードされたnull終端のchar 型バッファ 'str' から Unicode
     オブジェクトを生成します。

 -- C の関数: *note PyObject: 5df. *PyUnicode_FromFormat (const char
          *format, ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  Take
     a C ‘printf()’-style 'format' string and a variable number of
     arguments, calculate the size of the resulting Python Unicode
     string and return a string with the values formatted into it.  The
     variable arguments must be C types and must correspond exactly to
     the format characters in the 'format' ASCII-encoded string.

     一つの変換指定子は 2 またはそれ以上の文字を含み、その構成要素は以下
     からなりますが、示した順に出現しなければなりません:

       1. 指定子の開始を示す文字 ‘'%'’ 。

       2. 変換フラグ (オプション)。一部の変換型の結果に影響します。

       3. Minimum field width (optional).  If specified as an ‘'*'’
          (asterisk), the actual width is given in the next argument,
          which must be of type int, and the object to convert comes
          after the minimum field width and optional precision.

       4. Precision (optional), given as a ‘'.'’ (dot) followed by the
          precision.  If specified as ‘'*'’ (an asterisk), the actual
          precision is given in the next argument, which must be of type
          int, and the value to convert comes after the precision.

       5. 精度長変換子 (オプション)。

       6. 変換型。

     変換フラグ文字を以下に示します:

     Flag        意味
                 
     ------------------------------------------------------------------------------
                 
     ‘0’         数値型に対してゼロによるパディングを行います。
                 
                 
     ‘-’         The converted value is left adjusted (overrides the ‘0’ flag if
                 both are given).
                 

     The length modifiers for following integer conversions (‘d’, ‘i’,
     ‘o’, ‘u’, ‘x’, or ‘X’) specify the type of the argument (int by
     default):

     修飾子         型
                    
     -------------------------------------------------------------------------
                    
     ‘l’            long または unsigned long
                    
                    
     ‘ll’           long long または unsigned long long
                    
                    
     ‘j’            ‘intmax_t’ or ‘uintmax_t’
                    
                    
     ‘z’            ‘size_t’ or ‘ssize_t’
                    
                    
     ‘t’            ‘ptrdiff_t’
                    

     The length modifier ‘l’ for following conversions ‘s’ or ‘V’
     specify that the type of the argument is const wchar_t*.

     The conversion specifiers are:

     Conversion Specifier                  型                                    備考
                                                                                 
     ------------------------------------------------------------------------------------------------------------------
                                                                                 
     ‘%’                                   'n/a'                                 The literal ‘%’ character.
                                                                                 
                                                                                 
     ‘d’, ‘i’                              Specified by the length modifier      The decimal representation of a
                                                                                 signed C integer.
                                                                                 
                                                                                 
     ‘u’                                   Specified by the length modifier      The decimal representation of an
                                                                                 unsigned C integer.
                                                                                 
                                                                                 
     ‘o’                                   Specified by the length modifier      The octal representation of an
                                                                                 unsigned C integer.
                                                                                 
                                                                                 
     ‘x’                                   Specified by the length modifier      The hexadecimal representation of
                                                                                 an unsigned C integer (lowercase).
                                                                                 
                                                                                 
     ‘X’                                   Specified by the length modifier      The hexadecimal representation of
                                                                                 an unsigned C integer (uppercase).
                                                                                 
                                                                                 
     ‘c’                                   int                                   A single character.
                                                                                 
                                                                                 
     ‘s’                                   const char* または const wchar_t*     null で終端された C の文字列。
                                                                                 
                                                                                 
     ‘p’                                   const void*                           C ポインタの 16 進表記。
                                                                                 ‘printf("%p")’ とほとんど同じですが
                                                                                 、プラットフォームにおける ‘printf’
                                                                                 の定義に関わりなく先頭にリテラル
                                                                                 ‘0x’ が付きます。
                                                                                 
                                                                                 
     ‘A’                                   *note PyObject: 5df.*                 *note ascii(): 15ff. の戻り値。
                                                                                 
                                                                                 
     ‘U’                                   *note PyObject: 5df.*                 Unicode オブジェクト。
                                                                                 
                                                                                 
     ‘V’                                   *note PyObject: 5df.*, const char*    A Unicode object (which may be
                                           or const wchar_t*                     ‘NULL’) and a null-terminated C
                                                                                 character array as a second
                                                                                 parameter (which will be used, if
                                                                                 the first parameter is ‘NULL’).
                                                                                 
                                                                                 
     ‘S’                                   *note PyObject: 5df.*                 *note PyObject_Str(): 1231. の戻り
                                                                                 値。
                                                                                 
                                                                                 
     ‘R’                                   *note PyObject: 5df.*                 *note PyObject_Repr(): 1230. の戻り
                                                                                 値。
                                                                                 
                                                                                 
     ‘T’                                   *note PyObject: 5df.*                 Get the fully qualified name of an
                                                                                 object type; call
                                                                                 *note PyType_GetFullyQualifiedName(): 616.
                                                                                 
                                                                                 
     ‘#T’                                  *note PyObject: 5df.*                 Similar to ‘T’ format, but use a
                                                                                 colon (‘:’) as separator between
                                                                                 the module name and the qualified
                                                                                 name.
                                                                                 
                                                                                 
     ‘N’                                   *note PyTypeObject: c9c.*             Get the fully qualified name of a
                                                                                 type; call
                                                                                 *note PyType_GetFullyQualifiedName(): 616.
                                                                                 
                                                                                 
     ‘#N’                                  *note PyTypeObject: c9c.*             Similar to ‘N’ format, but use a
                                                                                 colon (‘:’) as separator between
                                                                                 the module name and the qualified
                                                                                 name.
                                                                                 

          注釈: The width formatter unit is number of characters rather
          than bytes.  The precision formatter unit is number of bytes
          or ‘wchar_t’ items (if the length modifier ‘l’ is used) for
          ‘"%s"’ and ‘"%V"’ (if the ‘PyObject*’ argument is ‘NULL’), and
          a number of characters for ‘"%A"’, ‘"%U"’, ‘"%S"’, ‘"%R"’ and
          ‘"%V"’ (if the ‘PyObject*’ argument is not ‘NULL’).

          注釈: Unlike to C ‘printf()’ the ‘0’ flag has effect even when
          a precision is given for integer conversions (‘d’, ‘i’, ‘u’,
          ‘o’, ‘x’, or ‘X’).

     バージョン 3.2 で変更: ‘"%lld"’, ‘"%llu"’ のサポートが追加されまし
     た。

     バージョン 3.3 で変更: ‘"%li"’, ‘"%lli"’, ‘"%zi"’ のサポートが追加
     されました。

     バージョン 3.4 で変更: ‘"%s"’, ‘"%A"’, ‘"%U"’, ‘"%V"’, ‘"%S"’,
     ‘"%R"’ での幅フォーマッタおよび精度フォーマッタのサポートが追加され
     ました。

     バージョン 3.12 で変更: Support for conversion specifiers ‘o’ and
     ‘X’.  Support for length modifiers ‘j’ and ‘t’.  Length modifiers
     are now applied to all integer conversions.  Length modifier ‘l’ is
     now applied to conversion specifiers ‘s’ and ‘V’.  Support for
     variable width and precision ‘*’.  Support for flag ‘-’.

     An unrecognized format character now sets a *note SystemError: 795.
     In previous versions it caused all the rest of the format string to
     be copied as-is to the result string, and any extra arguments
     discarded.

     バージョン 3.13 で変更: Support for ‘%T’, ‘%#T’, ‘%N’ and ‘%#N’
     formats added.

 -- C の関数: *note PyObject: 5df. *PyUnicode_FromFormatV (const char
          *format, va_list vargs)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  ちょ
     うど２つの引数を取ることを除いて、 *note PyUnicode_FromFormat():
     62b. と同じです。

 -- C の関数: *note PyObject: 5df. *PyUnicode_FromObject (PyObject *obj)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  Copy
     an instance of a Unicode subtype to a new true Unicode object if
     necessary.  If 'obj' is already a true Unicode object (not a
     subtype), return a new *note strong reference: 5e2. to the object.

     Unicode やそのサブタイプ以外のオブジェクトでは *note TypeError:
     198. が引き起こされます。

 -- C の関数: *note PyObject: 5df. *PyUnicode_FromOrdinal (int ordinal)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Create a Unicode Object from the given Unicode code point
     'ordinal'.

     The ordinal must be in ‘range(0x110000)’.  A *note ValueError: 2ec.
     is raised in the case it is not.

 -- C の関数: *note PyObject: 5df. *PyUnicode_FromEncodedObject
          (PyObject *obj, const char *encoding, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  エン
     コードされている 'obj' を Unicode オブジェクトにデコードします。

     *note bytes: 192. や *note bytearray: 344. や他の *note bytes-like
     objects: 193. は、与えられた 'encoding' に従ってデコードされ、
     'errors' で定義されたエラーハンドリングが使われます。 これらの引数
     は両方とも ‘NULL’ にでき、その場合この API はデフォルト値を使います
     (詳しことは *note 組み込み codec (built-in codec): 5375. を参照して
     ください)。

     その他のUnicodeオブジェクトを含むオブジェクトは *note TypeError:
     198. 例外を引き起こします。

     この API は、エラーが生じたときには ‘NULL’ を返します。呼び出し側は
     返されたオブジェクトに対し参照カウンタを 1 つ減らす (decref) する責
     任があります。

 -- C の関数: void PyUnicode_Append (PyObject **p_left, PyObject *right)
     ' 次に属します: *note Stable ABI: 775.'  Append the string 'right'
     to the end of 'p_left'.  'p_left' must point to a *note strong
     reference: 5e2. to a Unicode object; ‘PyUnicode_Append()’ releases
     ("steals") this reference.

     On error, set '*p_left' to ‘NULL’ and set an exception.

     On success, set '*p_left' to a new strong reference to the result.

 -- C の関数: void PyUnicode_AppendAndDel (PyObject **p_left, PyObject
          *right)
     ' 次に属します: *note Stable ABI: 775.'  The function is similar to
     *note PyUnicode_Append(): 50f4, with the only difference being that
     it decrements the reference count of 'right' by one.

 -- C の関数: *note PyObject: 5df. *PyUnicode_BuildEncodingMap (PyObject
          *string)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return a mapping suitable for decoding a custom single-byte
     encoding.  Given a Unicode string 'string' of up to 256 characters
     representing an encoding table, returns either a compact internal
     mapping object or a dictionary mapping character ordinals to byte
     values.  Raises a *note TypeError: 198. and return ‘NULL’ on
     invalid input.

     Added in version 3.2.

 -- C の関数: const char *PyUnicode_GetDefaultEncoding (void)
     ' 次に属します: *note Stable ABI: 775.'  Return the name of the
     default string encoding, ‘"utf-8"’.  See *note
     sys.getdefaultencoding(): 4916.

     The returned string does not need to be freed, and is valid until
     interpreter shutdown.

 -- C の関数: *note Py_ssize_t: c55. PyUnicode_GetLength (PyObject
          *unicode)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     Unicode オブジェクトの長さをコードポイントで返します。

     On error, set an exception and return ‘-1’.

     Added in version 3.3.

 -- C の関数: *note Py_ssize_t: c55. PyUnicode_CopyCharacters (PyObject
          *to, Py_ssize_t to_start, PyObject *from, Py_ssize_t
          from_start, Py_ssize_t how_many)

     ある Unicode オブジェクトから他へ文字をコピーします。 この関数は必
     要なときに文字変換を行い、可能な場合は ‘memcpy()’ へ差し戻します。
     失敗のときには ‘-1’ を返し、例外を設定します。そうでない場合は、コ
     ピーした文字数を返します。

     The string must not have been “used” yet.  See *note
     PyUnicode_New(): aa9. for details.

     Added in version 3.3.

 -- C の関数: int PyUnicode_Resize (PyObject **unicode, Py_ssize_t
          length);
     ' 次に属します: *note Stable ABI: 775.'  Resize a Unicode object
     '*unicode' to the new 'length' in code points.

     Try to resize the string in place (which is usually faster than
     allocating a new string and copying characters), or create a new
     string.

     '*unicode' is modified to point to the new (resized) object and ‘0’
     is returned on success.  Otherwise, ‘-1’ is returned and an
     exception is set, and '*unicode' is left untouched.

     The function doesn't check string content, the result may not be a
     string in canonical representation.

 -- C の関数: *note Py_ssize_t: c55. PyUnicode_Fill (PyObject *unicode,
          Py_ssize_t start, Py_ssize_t length, Py_UCS4 fill_char)

     文字列を文字で埋めます: ‘unicode[start:start+length]’ で
     'fill_char' を埋めることになります。

     'fill_char' が文字列の最大文字よりも大きい場合や、文字列2つ以上の参
     照を持ってた場合は失敗します。

     The string must not have been “used” yet.  See *note
     PyUnicode_New(): aa9. for details.

     書き込んだ文字数を返すか、失敗のときには ‘-1’ を返し例外を送出しま
     す。

     Added in version 3.3.

 -- C の関数: int PyUnicode_WriteChar (PyObject *unicode, Py_ssize_t
          index, Py_UCS4 character)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     Write a 'character' to the string 'unicode' at the zero-based
     'index'.  Return ‘0’ on success, ‘-1’ on error with an exception
     set.

     This function checks that 'unicode' is a Unicode object, that the
     index is not out of bounds, and that the object's reference count
     is one.  See *note PyUnicode_WRITE(): 139b. for a version that
     skips these checks, making them your responsibility.

     The string must not have been “used” yet.  See *note
     PyUnicode_New(): aa9. for details.

     Added in version 3.3.

 -- C の関数: *note Py_UCS4: 33d. PyUnicode_ReadChar (PyObject *unicode,
          Py_ssize_t index)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'  文
     字列から文字を読み取ります。 エラーチェックを行わない *note
     PyUnicode_READ_CHAR(): 139a. とは対照的に、この関数は 'unicode' が
     Unicode オブジェクトであること、インデックスが範囲内であることをチ
     ェックします。

     Return character on success, ‘-1’ on error with an exception set.

     Added in version 3.3.

 -- C の関数: *note PyObject: 5df. *PyUnicode_Substring (PyObject
          *unicode, Py_ssize_t start, Py_ssize_t end)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'  Return a substring of 'unicode', from character
     index 'start' (included) to character index 'end' (excluded).
     Negative indices are not supported.  On error, set an exception and
     return ‘NULL’.

     Added in version 3.3.

 -- C の関数: *note Py_UCS4: 33d. *PyUnicode_AsUCS4 (PyObject *unicode,
          Py_UCS4 *buffer, Py_ssize_t buflen, int copy_null)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     Copy the string 'unicode' into a UCS4 buffer, including a null
     character, if 'copy_null' is set.  Returns ‘NULL’ and sets an
     exception on error (in particular, a *note SystemError: 795. if
     'buflen' is smaller than the length of 'unicode').  'buffer' is
     returned on success.

     Added in version 3.3.

 -- C の関数: *note Py_UCS4: 33d. *PyUnicode_AsUCS4Copy (PyObject
          *unicode)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'  文
     字列 'unicode' を *note PyMem_Malloc(): e5f. でメモリ確保された新し
     い UCS4 型のバッファにコピーします。 これが失敗した場合は、 ‘NULL’
     を返し *note MemoryError: 179e. をセットします。 返されたバッファは
     必ず null コードポイントが追加されています。

     Added in version 3.3.


File: python.info,  Node: ロケールエンコーディング,  Next: ファイルシステムエンコーディング,  Prev: Unicode 文字列の生成とアクセス,  Up: Unicode オブジェクト

7.9.3.11 ロケールエンコーディング
.................................

現在のロケールエンコーディングはオペレーティングシステムのテキストをデコ
ードするのに使えます。

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeLocaleAndSize (const
          char *str, Py_ssize_t length, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'  Decode a string from UTF-8 on Android and
     VxWorks, or from the current locale encoding on other platforms.
     The supported error handlers are ‘"strict"’ and ‘"surrogateescape"’
     ( PEP 383(1)).  The decoder uses ‘"strict"’ error handler if
     'errors' is ‘NULL’.  'str' must end with a null character but
     cannot contain embedded null characters.

     Use *note PyUnicode_DecodeFSDefaultAndSize(): 50ff. to decode a
     string from the *note filesystem encoding and error handler: 75d.

     This function ignores the *note Python UTF-8 Mode: 866.

     参考
     ....

     *note Py_DecodeLocale(): dc0. 関数。

     Added in version 3.3.

     バージョン 3.7 で変更: この関数は、 Android 以外では現在のロケール
     エンコーディングを ‘surrogateescape’ エラーハンドラで使うようになり
     ました。 以前は、 *note Py_DecodeLocale(): dc0. が
     ‘surrogateescape’ で使われ、現在のロケールエンコーディングは
     ‘strict’ で使われていました。

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeLocale (const char
          *str, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'  Similar to *note
     PyUnicode_DecodeLocaleAndSize(): dc2, but compute the string length
     using ‘strlen()’.

     Added in version 3.3.

 -- C の関数: *note PyObject: 5df. *PyUnicode_EncodeLocale (PyObject
          *unicode, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'  Encode a Unicode object to UTF-8 on Android and
     VxWorks, or to the current locale encoding on other platforms.  The
     supported error handlers are ‘"strict"’ and ‘"surrogateescape"’ (
     PEP 383(2)).  The encoder uses ‘"strict"’ error handler if 'errors'
     is ‘NULL’.  Return a *note bytes: 192. object.  'unicode' cannot
     contain embedded null characters.

     Use *note PyUnicode_EncodeFSDefault(): 1e31. to encode a string to
     the *note filesystem encoding and error handler: 75d.

     This function ignores the *note Python UTF-8 Mode: 866.

     参考
     ....

     *note Py_EncodeLocale(): dc1. 関数。

     Added in version 3.3.

     バージョン 3.7 で変更: この関数は、 Android 以外では現在のロケール
     エンコーディングを ‘surrogateescape’ エラーハンドラで使うようになり
     ました。 以前は、 *note Py_EncodeLocale(): dc1. が
     ‘surrogateescape’ で使われ、現在のロケールエンコーディングは
     ‘strict’ で使われていました。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0383/

   (2) https://peps.python.org/pep-0383/


File: python.info,  Node: ファイルシステムエンコーディング,  Next: wchar_t サポート,  Prev: ロケールエンコーディング,  Up: Unicode オブジェクト

7.9.3.12 ファイルシステムエンコーディング
.........................................

Functions encoding to and decoding from the *note filesystem encoding
and error handler: 75d. ( PEP 383(1) and PEP 529(2)).

To encode file names to *note bytes: 192. during argument parsing, the
‘"O&"’ converter should be used, passing ‘PyUnicode_FSConverter()’ as
the conversion function:

 -- C の関数: int PyUnicode_FSConverter (PyObject *obj, void *result)
     ' 次に属します: *note Stable ABI: 775.'  *note PyArg_Parse*
     converter: 3d5.: encode *note str: 169. objects - obtained directly
     or through the *note os.PathLike: e4b. interface - to *note bytes:
     192. using *note PyUnicode_EncodeFSDefault(): 1e31.; *note bytes:
     192. objects are output as-is.  'result' must be an address of a C
     variable of type *note PyObject: 5df.* (or *note PyBytesObject:
     995.*).  On success, set the variable to a new *note strong
     reference: 5e2. to a *note bytes object: 5343. which must be
     released when it is no longer used and return a non-zero value
     (*note Py_CLEANUP_SUPPORTED: 5240.).  Embedded null bytes are not
     allowed in the result.  On failure, return ‘0’ with an exception
     set.

     If 'obj' is ‘NULL’, the function releases a strong reference stored
     in the variable referred by 'result' and returns ‘1’.

     Added in version 3.1.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

To decode file names to *note str: 169. during argument parsing, the
‘"O&"’ converter should be used, passing ‘PyUnicode_FSDecoder()’ as the
conversion function:

 -- C の関数: int PyUnicode_FSDecoder (PyObject *obj, void *result)
     ' 次に属します: *note Stable ABI: 775.'  *note PyArg_Parse*
     converter: 3d5.: decode *note bytes: 192. objects - obtained either
     directly or indirectly through the *note os.PathLike: e4b.
     interface - to *note str: 169. using *note
     PyUnicode_DecodeFSDefaultAndSize(): 50ff.; *note str: 169. objects
     are output as-is.  'result' must be an address of a C variable of
     type *note PyObject: 5df.* (or *note PyUnicodeObject: 997.*).  On
     success, set the variable to a new *note strong reference: 5e2. to
     a *note Unicode object: 5355. which must be released when it is no
     longer used and return a non-zero value (*note
     Py_CLEANUP_SUPPORTED: 5240.).  Embedded null characters are not
     allowed in the result.  On failure, return ‘0’ with an exception
     set.

     If 'obj' is ‘NULL’, release the strong reference to the object
     referred to by 'result' and return ‘1’.

     Added in version 3.2.

     バージョン 3.6 で変更: *note path-like object: 5a1. を受け入れるよ
     うになりました。

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeFSDefaultAndSize
          (const char *str, Py_ssize_t size)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Decode a string from the *note filesystem encoding and error
     handler: 75d.

     If you need to decode a string from the current locale encoding,
     use *note PyUnicode_DecodeLocaleAndSize(): dc2.

     参考
     ....

     *note Py_DecodeLocale(): dc0. 関数。

     バージョン 3.6 で変更: The *note filesystem error handler: 75d. is
     now used.

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeFSDefault (const
          char *str)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Decode a null-terminated string from the *note filesystem encoding
     and error handler: 75d.

     If the string length is known, use *note
     PyUnicode_DecodeFSDefaultAndSize(): 50ff.

     バージョン 3.6 で変更: The *note filesystem error handler: 75d. is
     now used.

 -- C の関数: *note PyObject: 5df. *PyUnicode_EncodeFSDefault (PyObject
          *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Encode a Unicode object to the *note filesystem encoding and error
     handler: 75d, and return *note bytes: 192.  Note that the resulting
     *note bytes: 192. object can contain null bytes.

     If you need to encode a string to the current locale encoding, use
     *note PyUnicode_EncodeLocale(): dc3.

     参考
     ....

     *note Py_EncodeLocale(): dc1. 関数。

     Added in version 3.2.

     バージョン 3.6 で変更: The *note filesystem error handler: 75d. is
     now used.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0383/

   (2) https://peps.python.org/pep-0529/


File: python.info,  Node: wchar_t サポート,  Prev: ファイルシステムエンコーディング,  Up: Unicode オブジェクト

7.9.3.13 wchar_t サポート
.........................

‘wchar_t’ をサポートするプラットフォームでの wchar_t サポート:

 -- C の関数: *note PyObject: 5df. *PyUnicode_FromWideChar (const
          wchar_t *wstr, Py_ssize_t size)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Create a Unicode object from the ‘wchar_t’ buffer 'wstr' of the
     given 'size'.  Passing ‘-1’ as the 'size' indicates that the
     function must itself compute the length, using ‘wcslen()’.  Return
     ‘NULL’ on failure.

 -- C の関数: *note Py_ssize_t: c55. PyUnicode_AsWideChar (PyObject
          *unicode, wchar_t *wstr, Py_ssize_t size)
     ' 次に属します: *note Stable ABI: 775.'  Copy the Unicode object
     contents into the ‘wchar_t’ buffer 'wstr'.  At most 'size'
     ‘wchar_t’ characters are copied (excluding a possibly trailing null
     termination character).  Return the number of ‘wchar_t’ characters
     copied or ‘-1’ in case of an error.

     When 'wstr' is ‘NULL’, instead return the 'size' that would be
     required to store all of 'unicode' including a terminating null.

     Note that the resulting wchar_t* string may or may not be
     null-terminated.  It is the responsibility of the caller to make
     sure that the wchar_t* string is null-terminated in case this is
     required by the application.  Also, note that the wchar_t* string
     might contain null characters, which would cause the string to be
     truncated when used with most C functions.

 -- C の関数: wchar_t *PyUnicode_AsWideCharString (PyObject *unicode,
          Py_ssize_t *size)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     Convert the Unicode object to a wide character string.  The output
     string always ends with a null character.  If 'size' is not ‘NULL’,
     write the number of wide characters (excluding the trailing null
     termination character) into '*size'.  Note that the resulting
     ‘wchar_t’ string might contain null characters, which would cause
     the string to be truncated when used with most C functions.  If
     'size' is ‘NULL’ and the wchar_t* string contains null characters a
     *note ValueError: 2ec. is raised.

     Returns a buffer allocated by *note PyMem_New: 173d. (use *note
     PyMem_Free(): 165b. to free it) on success.  On error, returns
     ‘NULL’ and '*size' is undefined.  Raises a *note MemoryError: 179e.
     if memory allocation is failed.

     Added in version 3.2.

     バージョン 3.7 で変更: Raises a *note ValueError: 2ec. if 'size' is
     ‘NULL’ and the wchar_t* string contains null characters.


File: python.info,  Node: 組み込み codec built-in codec,  Next: メソッドおよびスロット関数 slot function,  Prev: Unicode オブジェクト,  Up: Unicode オブジェクトと codec

7.9.3.14 組み込み codec (built-in codec)
........................................

Python には、処理速度を高めるために C で書かれた codec が揃えてあります
。これら全ての codec は以下の関数を介して直接利用できます。

以下の API の多くが、 'encoding' と 'errors' という二つの引数をとります
。これらのパラメータは、組み込みの文字列コンストラクタである *note
str(): 169. における同名のパラメータと同じ意味を持ちます。

Setting encoding to ‘NULL’ causes the default encoding to be used which
is UTF-8.  The file system calls should use *note
PyUnicode_FSConverter(): f15. for encoding file names.  This uses the
*note filesystem encoding and error handler: 75d. internally.

'errors' で指定するエラー処理もまた、 ‘NULL’ を指定できます。 ‘NULL’ を
指定すると、codec で定義されているデフォルト処理の使用を意味します。全て
の組み込み codec で、デフォルトのエラー処理は "strict" (*note
ValueError: 2ec. を送出する) になっています。

個々の codec は全て同様のインターフェースを使っています。個別の codec の
説明では、説明を簡単にするために以下の汎用のインターフェースとの違いだけ
を説明しています。

* Menu:

* 汎用 codec::
* UTF-8 Codecs::
* UTF-32 Codecs::
* UTF-16 Codecs::
* UTF-7 Codecs::
* Unicode-Escape Codecs::
* Raw-Unicode-Escape Codecs::
* Latin-1 Codecs::
* ASCII Codecs::
* Character Map Codecs::
* Windows 用の MBCS codec::


File: python.info,  Node: 汎用 codec,  Next: UTF-8 Codecs,  Up: 組み込み codec built-in codec

7.9.3.15 汎用 codec
...................

The following macro is provided:

 -- C のマクロ: Py_UNICODE_REPLACEMENT_CHARACTER

     The Unicode code point ‘U+FFFD’ (replacement character).

     This Unicode character is used as the replacement character during
     decoding if the 'errors' argument is set to "replace".

以下は汎用 codec の API です:

 -- C の関数: *note PyObject: 5df. *PyUnicode_Decode (const char *str,
          Py_ssize_t size, const char *encoding, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Create a Unicode object by decoding 'size' bytes of the encoded
     string 'str'.  'encoding' and 'errors' have the same meaning as the
     parameters of the same name in the *note str(): 169. built-in
     function.  The codec to be used is looked up using the Python codec
     registry.  Return ‘NULL’ if an exception was raised by the codec.

 -- C の関数: *note PyObject: 5df. *PyUnicode_AsEncodedString (PyObject
          *unicode, const char *encoding, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Unicode オブジェクトをエンコードし、その結果を Python の bytes オブ
     ジェクトとして返します。 'encoding' および 'errors' は Unicode 型の
     *note encode(): ad2. メソッドに与える同名のパラメータと同じ意味を持
     ちます。 使用する codec の検索は、 Python の codec レジストリを使っ
     て行います。 codec が例外を送出した場合には ‘NULL’ を返します。


File: python.info,  Node: UTF-8 Codecs,  Next: UTF-32 Codecs,  Prev: 汎用 codec,  Up: 組み込み codec built-in codec

7.9.3.16 UTF-8 Codecs
.....................

以下は UTF-8 codec の APIです:

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeUTF8 (const char
          *str, Py_ssize_t size, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     UTF-8 でエンコードされた 'size' バイトの文字列 'str' から Unicode オ
     ブジェクトを生成します。codec が例外を送出した場合には ‘NULL’ を返
     します。

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeUTF8Stateful (const
          char *str, Py_ssize_t size, const char *errors, Py_ssize_t
          *consumed)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'consumed' が ‘NULL’ の場合、 *note PyUnicode_DecodeUTF8(): 510b. と
     同じように動作します。 'consumed' が ‘NULL’ でない場合、末尾の不完
     全な UTF-8 バイト列はエラーとみなされません。これらのバイト列はデコ
     ードされず、デコードされたバイト数は 'consumed' に格納されます。

 -- C の関数: *note PyObject: 5df. *PyUnicode_AsUTF8String (PyObject
          *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     UTF-8 で Unicode オブジェクトをエンコードし、結果を Python バイト列
     オブジェクトとして返します。エラー処理は "strict" です。 codec が例
     外を送出した場合には ‘NULL’ を返します。

     The function fails if the string contains surrogate code points
     (‘U+D800’ - ‘U+DFFF’).

 -- C の関数: const char *PyUnicode_AsUTF8AndSize (PyObject *unicode,
          Py_ssize_t *size)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Unicode オブジェクトを UTF-8 でエンコードしたものへのポインタを返し
     、エンコードされた表現形式でのサイズ (バイト単位) を 'size' に格納
     します。 'size' 引数は ‘NULL’ でも構いません; その場合はサイズは格
     納されません。 返されるバッファには、 null コードポイントがあるかど
     うかに関わらず、常に null バイトが終端に付加されています (これは
     'size' には勘定されません)。

     On error, set an exception, set 'size' to ‘-1’ (if it's not NULL)
     and return ‘NULL’.

     The function fails if the string contains surrogate code points
     (‘U+D800’ - ‘U+DFFF’).

     This caches the UTF-8 representation of the string in the Unicode
     object, and subsequent calls will return a pointer to the same
     buffer.  The caller is not responsible for deallocating the buffer.
     The buffer is deallocated and pointers to it become invalid when
     the Unicode object is garbage collected.

     Added in version 3.3.

     バージョン 3.7 で変更: 返り値の型が ‘char *’ ではなく ‘const char
     *’ になりました。

     バージョン 3.10 で変更: This function is a part of the *note
     limited API: 637.

 -- C の関数: const char *PyUnicode_AsUTF8 (PyObject *unicode)

     *note PyUnicode_AsUTF8AndSize(): a99. とほぼ同じですが、サイズを格
     納しません。

          警告: This function does not have any special behavior for
          null characters(1) embedded within 'unicode'.  As a result,
          strings containing null characters will remain in the returned
          string, which some C functions might interpret as the end of
          the string, leading to truncation.  If truncation is an issue,
          it is recommended to use *note PyUnicode_AsUTF8AndSize(): a99.
          instead.

     Added in version 3.3.

     バージョン 3.7 で変更: 返り値の型が ‘char *’ ではなく ‘const char
     *’ になりました。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Null_character


File: python.info,  Node: UTF-32 Codecs,  Next: UTF-16 Codecs,  Prev: UTF-8 Codecs,  Up: 組み込み codec built-in codec

7.9.3.17 UTF-32 Codecs
......................

以下は UTF-32 codec API です:

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeUTF32 (const char
          *str, Py_ssize_t size, const char *errors, int *byteorder)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     UTF-32 でエンコードされたバッファ文字列から 'size' バイトをデコード
     し、 Unicodeオブジェクトとして返します。 'errors' は (‘NULL’ でない
     なら) エラーハンドラを指定します。デフォルトは "strict" です。

     'byteorder' が ‘NULL’ でない時、デコーダは与えられたバイトオーダー
     でデコードを開始します。

          *byteorder == -1: little endian
          *byteorder == 0:  native order
          *byteorder == 1:  big endian

     ‘*byteorder’ が 0 で、入力データの最初の 4 バイトが byte order mark
     (BOM) ならば、デコーダはこのバイトオーダーに切り替え、BOM は結果の
     Unicode 文字列にコピーされません。 ‘*byteorder’ が ‘-1’ または ‘1’
     ならば、全ての byte order mark は出力にコピーされます。

     デコードが完了した後、入力データの終端に来た時点でのバイトオーダー
     を '*byteorder' にセットします。

     'byteorder' が ‘NULL’ のとき、 codec は native order モードで開始し
     ます。

     codec が例外を発生させたときは ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeUTF32Stateful (const
          char *str, Py_ssize_t size, const char *errors, int
          *byteorder, Py_ssize_t *consumed)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'consumed' が ‘NULL’ のとき、 *note PyUnicode_DecodeUTF32(): 5107.
     と同じように振る舞います。 'consumed' が ‘NULL’ でないとき、 *note
     PyUnicode_DecodeUTF32Stateful(): 5108. は末尾の不完全な (4 で割り切
     れない長さのバイト列などの) UTF-32 バイト列をエラーとして扱いません
     。末尾の不完全なバイト列はデコードされず、デコードされたバイト数が
     'consumed' に格納されます。

 -- C の関数: *note PyObject: 5df. *PyUnicode_AsUTF32String (PyObject
          *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  ネイ
     ティブバイトオーダーで UTF-32 エンコーディングされた Python バイト
     文字列を返します。 文字列は常に BOM マークで始まります。 エラーハン
     ドラは "strict" です。 codec が例外を発生させたときは ‘NULL’ を返し
     ます。


File: python.info,  Node: UTF-16 Codecs,  Next: UTF-7 Codecs,  Prev: UTF-32 Codecs,  Up: 組み込み codec built-in codec

7.9.3.18 UTF-16 Codecs
......................

以下は UTF-16 codec の APIです:

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeUTF16 (const char
          *str, Py_ssize_t size, const char *errors, int *byteorder)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     UTF-16 でエンコードされたバッファ 's' から 'size' バイトだけデコー
     ドして、結果を Unicode オブジェクトで返します。 'errors' は (‘NULL’
     でない場合) エラー処理方法を定義します。デフォルト値は "strict" で
     す。

     'byteorder' が ‘NULL’ でない時、デコーダは与えられたバイトオーダー
     でデコードを開始します。

          *byteorder == -1: little endian
          *byteorder == 0:  native order
          *byteorder == 1:  big endian

     ‘*byteorder’ が 0 で、入力データの先頭2バイトがバイトオーダーマーク
     (BOM) だった場合、デコーダは BOM が示すバイトオーダーに切り替え、そ
     のBOMを結果の Unicode 文字列にコピーしません。 ‘*byteorder’ が ‘-1’
     か ‘1’ だった場合、すべてのBOMは出力へコピーされます (出力では
     ‘\ufeff’ か ‘\ufffe’ のどちらかになるでしょう)。

     デコードが完了した後、入力データの終端に来た時点でのバイトオーダー
     を ‘*byteorder’ にセットします。

     'byteorder' が ‘NULL’ のとき、 codec は native order モードで開始し
     ます。

     codec が例外を発生させたときは ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeUTF16Stateful (const
          char *str, Py_ssize_t size, const char *errors, int
          *byteorder, Py_ssize_t *consumed)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'consumed' が ‘NULL’ の場合、 *note PyUnicode_DecodeUTF16(): 5105.
     と同じように動作します。 'consumed' が ‘NULL’ でない場合、 *note
     PyUnicode_DecodeUTF16Stateful(): 5106. は末尾の不完全な UTF-16 バイ
     ト列 (奇数長のバイト列や分割されたサロゲートペア) をエラーとみなし
     ません。これらのバイト列はデコードされず、デコードされたバイト数を
     'consumed' に返します。

 -- C の関数: *note PyObject: 5df. *PyUnicode_AsUTF16String (PyObject
          *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  ネイ
     ティブバイトオーダーで UTF-16 エンコーディングされた Python バイト
     文字列を返します。 文字列は常に BOM マークで始まります。 エラーハン
     ドラは "strict" です。 codec が例外を発生させたときは ‘NULL’ を返し
     ます。


File: python.info,  Node: UTF-7 Codecs,  Next: Unicode-Escape Codecs,  Prev: UTF-16 Codecs,  Up: 組み込み codec built-in codec

7.9.3.19 UTF-7 Codecs
.....................

以下は UTF-7 codec の API です:

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeUTF7 (const char
          *str, Py_ssize_t size, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Create a Unicode object by decoding 'size' bytes of the UTF-7
     encoded string 'str'.  Return ‘NULL’ if an exception was raised by
     the codec.

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeUTF7Stateful (const
          char *str, Py_ssize_t size, const char *errors, Py_ssize_t
          *consumed)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'consumed' が ‘NULL’ のとき、 *note PyUnicode_DecodeUTF7(): 5109. と
     同じように動作します。 'consumed' が ‘NULL’ でないとき、末尾の不完
     全な UTF-7 base-64 部分をエラーとしません。不完全な部分のバイト列は
     デコードせずに、デコードしたバイト数を 'consumed' に格納します。


File: python.info,  Node: Unicode-Escape Codecs,  Next: Raw-Unicode-Escape Codecs,  Prev: UTF-7 Codecs,  Up: 組み込み codec built-in codec

7.9.3.20 Unicode-Escape Codecs
..............................

以下は "Unicode Escape" codec の API です:

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeUnicodeEscape (const
          char *str, Py_ssize_t size, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Create a Unicode object by decoding 'size' bytes of the
     Unicode-Escape encoded string 'str'.  Return ‘NULL’ if an exception
     was raised by the codec.

 -- C の関数: *note PyObject: 5df. *PyUnicode_AsUnicodeEscapeString
          (PyObject *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Unicode-Escape を使い Unicode オブジェクトをエンコードし、結果を
     bytes オブジェクトとして返します。 エラー処理は "strict" です。
     codec が例外を送出した場合には ‘NULL’ を返します。


File: python.info,  Node: Raw-Unicode-Escape Codecs,  Next: Latin-1 Codecs,  Prev: Unicode-Escape Codecs,  Up: 組み込み codec built-in codec

7.9.3.21 Raw-Unicode-Escape Codecs
..................................

以下は "Raw Unicode Escape" codec の APIです:

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeRawUnicodeEscape
          (const char *str, Py_ssize_t size, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Create a Unicode object by decoding 'size' bytes of the
     Raw-Unicode-Escape encoded string 'str'.  Return ‘NULL’ if an
     exception was raised by the codec.

 -- C の関数: *note PyObject: 5df. *PyUnicode_AsRawUnicodeEscapeString
          (PyObject *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Raw-Unicode-Escape を使い Unicode オブジェクトをエンコードし、結果
     を bytes オブジェクトとして返します。 エラー処理は "strict" です。
     codec が例外を送出した場合には ‘NULL’ を返します。


File: python.info,  Node: Latin-1 Codecs,  Next: ASCII Codecs,  Prev: Raw-Unicode-Escape Codecs,  Up: 組み込み codec built-in codec

7.9.3.22 Latin-1 Codecs
.......................

以下は Latin-1 codec の APIです: Latin-1 は、 Unicode 序数の最初の 256 個
に対応し、エンコード時にはこの 256 個だけを受理します。

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeLatin1 (const char
          *str, Py_ssize_t size, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Latin-1 でエンコードされた 'size' バイトの文字列 'str' から Unicode
     オブジェクトを生成します。codec が例外を送出した場合には ‘NULL’ を
     返します。

 -- C の関数: *note PyObject: 5df. *PyUnicode_AsLatin1String (PyObject
          *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Latin-1 で Unicode オブジェクトをエンコードし、結果を Python bytes
     オブジェクトとして返します。 エラー処理は "strict" です。 codec が
     例外を送出した場合には ‘NULL’ を返します。


File: python.info,  Node: ASCII Codecs,  Next: Character Map Codecs,  Prev: Latin-1 Codecs,  Up: 組み込み codec built-in codec

7.9.3.23 ASCII Codecs
.....................

以下は ASCII codec の APIです。 7 ビットの ASCII データだけを受理します
。その他のコードはエラーになります。

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeASCII (const char
          *str, Py_ssize_t size, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Create a Unicode object by decoding 'size' bytes of the ASCII
     encoded string 'str'.  Return ‘NULL’ if an exception was raised by
     the codec.

 -- C の関数: *note PyObject: 5df. *PyUnicode_AsASCIIString (PyObject
          *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     ASCII で Unicode オブジェクトをエンコードし、結果を Python bytes オ
     ブジェクトとして返します。 エラー処理は "strict" です。 codec が例
     外を送出した場合には ‘NULL’ を返します。


File: python.info,  Node: Character Map Codecs,  Next: Windows 用の MBCS codec,  Prev: ASCII Codecs,  Up: 組み込み codec built-in codec

7.9.3.24 Character Map Codecs
.............................

この codec は、多くの様々な codec を実装する際に使われるという点で特殊な
codec です (実際、 ‘encodings’ パッケージに入っている標準 codecs のほと
んどは、この codec を使っています)。 この codec は、文字のエンコードやデ
コードに対応表を使います。 提供される対応表のオブジェクトは *note
__getitem__(): 588. マッピングインターフェースをサポートしていなければな
りません; 辞書やシーケンスがそれに適しています。

以下は mapping codec の APIです:

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeCharmap (const char
          *str, Py_ssize_t length, PyObject *mapping, const char
          *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  与え
     られた 'mapping' オブジェクトを使って、 'size' バイトのエンコードさ
     れた文字列 'str' をデコードして Unicode オブジェクトを作成します。
     codec が例外を発生させたときは ‘NULL’ を返します。

     If 'mapping' is ‘NULL’, Latin-1 decoding will be applied.  Else
     'mapping' must map bytes ordinals (integers in the range from 0 to
     255) to Unicode strings, integers (which are then interpreted as
     Unicode ordinals) or ‘None’.  Unmapped data bytes - ones which
     cause a *note LookupError: 23e5, as well as ones which get mapped
     to ‘None’, ‘0xFFFE’ or ‘'\ufffe'’, are treated as undefined
     mappings and cause an error.

 -- C の関数: *note PyObject: 5df. *PyUnicode_AsCharmapString (PyObject
          *unicode, PyObject *mapping)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Unicode オブジェクトを 'mapping' に指定されたオブジェクトを使ってエ
     ンコードし、結果を bytes オブジェクトとして返します。エラー処理は
     "strict" です。 codec が例外を送出した場合には ‘NULL’ を返します。

     The 'mapping' object must map Unicode ordinal integers to bytes
     objects, integers in the range from 0 to 255 or ‘None’.  Unmapped
     character ordinals (ones which cause a *note LookupError: 23e5.) as
     well as mapped to ‘None’ are treated as "undefined mapping" and
     cause an error.

以下の codec API は Unicode から Unicode への対応付けを行う特殊なもので
す。

 -- C の関数: *note PyObject: 5df. *PyUnicode_Translate (PyObject
          *unicode, PyObject *table, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  文字
     列に文字対応表 'table' を適用して変換し、変換結果を Unicode オブジ
     ェクトで返します。codec が例外を発行した場合には ‘NULL’ を返します
     。

     対応表は、Unicode 序数を表す整数を Unicode 序数を表す整数または
     ‘None’ (その文字を削除する) に対応付けなければなりません。

     Mapping tables need only provide the *note __getitem__(): 588.
     interface; dictionaries and sequences work well.  Unmapped
     character ordinals (ones which cause a *note LookupError: 23e5.)
     are left untouched and are copied as-is.

     'errors' は codecs で通常使われるのと同じ意味を持ちます。 'errors'
     は ‘NULL’ にしてもよく、デフォルトエラー処理の使用を意味します。


File: python.info,  Node: Windows 用の MBCS codec,  Prev: Character Map Codecs,  Up: 組み込み codec built-in codec

7.9.3.25 Windows 用の MBCS codec
................................

以下は MBCS codec の API です。この codec は現在のところ、 Windows 上だ
けで利用でき、変換の実装には Win32 MBCS 変換機構 (Win32 MBCS converter)
を使っています。 MBCS (または DBCS) はエンコード方式の種類 (class) を表
す言葉で、単一のエンコード方式を表すわけでなないので注意してください。利
用されるエンコード方式 (target encoding) は、 codec を動作させているマシ
ン上のユーザ設定で定義されています。

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeMBCS (const char
          *str, Py_ssize_t size, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. on
     Windows (バージョン 3.7 より).'  Create a Unicode object by
     decoding 'size' bytes of the MBCS encoded string 'str'.  Return
     ‘NULL’ if an exception was raised by the codec.

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeMBCSStateful (const
          char *str, Py_ssize_t size, const char *errors, Py_ssize_t
          *consumed)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. on
     Windows (バージョン 3.7 より).'  'consumed' が ‘NULL’ のとき、
     *note PyUnicode_DecodeMBCS(): 5102. と同じ動作をします。 'consumed'
     が ‘NULL’ でないとき、 *note PyUnicode_DecodeMBCSStateful(): 5103.
     は文字列の最後にあるマルチバイト文字の前半バイトをデコードせず、
     'consumed' にデコードしたバイト数を格納します。

 -- C の関数: *note PyObject: 5df. *PyUnicode_DecodeCodePageStateful
          (int code_page, const char *str, Py_ssize_t size, const char
          *errors, Py_ssize_t *consumed)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. on
     Windows (バージョン 3.7 より).'  Similar to *note
     PyUnicode_DecodeMBCSStateful(): 5103, except uses the code page
     specified by 'code_page'.

 -- C の関数: *note PyObject: 5df. *PyUnicode_AsMBCSString (PyObject
          *unicode)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. on
     Windows (バージョン 3.7 より).'  MBCS で Unicode オブジェクトをエン
     コードし、結果を Python バイト列オブジェクトとして返します。エラー
     処理は "strict" です。 codec が例外を送出した場合には ‘NULL’ を返し
     ます。

 -- C の関数: *note PyObject: 5df. *PyUnicode_EncodeCodePage (int
          code_page, PyObject *unicode, const char *errors)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. on
     Windows (バージョン 3.7 より).'  Encode the Unicode object using
     the specified code page and return a Python bytes object.  Return
     ‘NULL’ if an exception was raised by the codec.  Use ‘CP_ACP’ code
     page to get the MBCS encoder.

     Added in version 3.3.


File: python.info,  Node: メソッドおよびスロット関数 slot function,  Next: PyUnicodeWriter,  Prev: 組み込み codec built-in codec,  Up: Unicode オブジェクトと codec

7.9.3.26 メソッドおよびスロット関数 (slot function)
...................................................

以下の API は Unicode オブジェクトおよび文字列を入力に取り (説明では、ど
ちらも文字列と表記しています)、場合に応じて Unicode オブジェクトか整数を
返す機能を持っています。

これらの関数は全て、例外が発生した場合には ‘NULL’ または ‘-1’ を返します
。

 -- C の関数: *note PyObject: 5df. *PyUnicode_Concat (PyObject *left,
          PyObject *right)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  二つ
     の文字列を結合して、新たな Unicode 文字列を生成します。

 -- C の関数: *note PyObject: 5df. *PyUnicode_Split (PyObject *unicode,
          PyObject *sep, Py_ssize_t maxsplit)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Unicode 文字列のリストを分割して、 Unicode 文字列からなるリストを返
     します。 'sep' が ‘NULL’ の場合、全ての空白文字を使って分割を行いま
     す。それ以外の場合、指定された文字を使って分割を行います。最大で
     'maxsplit' 個までの分割を行います。 'maxsplit' が負ならば分割数に制
     限を設けません。分割結果のリスト内には分割文字は含みません。

     On error, return ‘NULL’ with an exception set.

     Equivalent to *note str.split(): 10aa.

 -- C の関数: *note PyObject: 5df. *PyUnicode_RSplit (PyObject *unicode,
          PyObject *sep, Py_ssize_t maxsplit)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Similar to *note PyUnicode_Split(): 5118, but splitting will be
     done beginning at the end of the string.

     On error, return ‘NULL’ with an exception set.

     Equivalent to *note str.rsplit(): 146d.

 -- C の関数: *note PyObject: 5df. *PyUnicode_Splitlines (PyObject
          *unicode, int keepends)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Split a Unicode string at line breaks, returning a list of Unicode
     strings.  CRLF is considered to be one line break.  If 'keepends'
     is ‘0’, the Line break characters are not included in the resulting
     strings.

 -- C の関数: *note PyObject: 5df. *PyUnicode_Partition (PyObject
          *unicode, PyObject *sep)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Split a Unicode string at the first occurrence of 'sep', and return
     a 3-tuple containing the part before the separator, the separator
     itself, and the part after the separator.  If the separator is not
     found, return a 3-tuple containing the string itself, followed by
     two empty strings.

     'sep' must not be empty.

     On error, return ‘NULL’ with an exception set.

     Equivalent to *note str.partition(): 10ab.

 -- C の関数: *note PyObject: 5df. *PyUnicode_RPartition (PyObject
          *unicode, PyObject *sep)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Similar to *note PyUnicode_Partition(): 1898, but split a Unicode
     string at the last occurrence of 'sep'.  If the separator is not
     found, return a 3-tuple containing two empty strings, followed by
     the string itself.

     'sep' must not be empty.

     On error, return ‘NULL’ with an exception set.

     Equivalent to *note str.rpartition(): 1470.

 -- C の関数: *note PyObject: 5df. *PyUnicode_Join (PyObject *separator,
          PyObject *seq)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  指定
     した 'separator' で文字列からなるシーケンスを連結 (join) し、連結結
     果を Unicode 文字列で返します。

 -- C の関数: *note Py_ssize_t: c55. PyUnicode_Tailmatch (PyObject
          *unicode, PyObject *substr, Py_ssize_t start, Py_ssize_t end,
          int direction)
     ' 次に属します: *note Stable ABI: 775.'  Return ‘1’ if 'substr'
     matches ‘unicode[start:end]’ at the given tail end ('direction' ==
     ‘-1’ means to do a prefix match, 'direction' == ‘1’ a suffix
     match), ‘0’ otherwise.  Return ‘-1’ if an error occurred.

 -- C の関数: *note Py_ssize_t: c55. PyUnicode_Find (PyObject *unicode,
          PyObject *substr, Py_ssize_t start, Py_ssize_t end, int
          direction)
     ' 次に属します: *note Stable ABI: 775.'  ‘unicode[start:end]’ 中に
     'substr' が最初に出現する場所を返します。 このとき指定された検索方
     向 'direction' ('direction' == ‘1’ は順方向検索、 'direction' ==
     ‘-1’ は逆方向検索) で検索します。 戻り値は最初にマッチが見つかった
     場所のインデックスです; 戻り値 ‘-1’ はマッチが見つからなかったこと
     を表し、 ‘-2’ はエラーが発生して例外情報が設定されていることを表し
     ます。

 -- C の関数: *note Py_ssize_t: c55. PyUnicode_FindChar (PyObject
          *unicode, Py_UCS4 ch, Py_ssize_t start, Py_ssize_t end, int
          direction)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     ‘unicode[start:end]’ 中に文字 'ch' が最初に出現する場所を返します。
     このとき指定された検索方向 'direction' ('direction' == ‘1’ は順方向
     検索、 'direction' == ‘-1’ は逆方向検索) で検索します。 戻り値は最
     初にマッチが見つかった場所のインデックスです; 戻り値 ‘-1’ はマッチ
     が見つからなかったことを表し、 ‘-2’ はエラーが発生して例外情報が設
     定されていることを表します。

     Added in version 3.3.

     バージョン 3.7 で変更: 'start' and 'end' are now adjusted to behave
     like ‘unicode[start:end]’.

 -- C の関数: *note Py_ssize_t: c55. PyUnicode_Count (PyObject *unicode,
          PyObject *substr, Py_ssize_t start, Py_ssize_t end)
     ' 次に属します: *note Stable ABI: 775.'  ‘unicode[start:end]’ に
     'substr' が重複することなく出現する回数を返します。エラーが発生した
     場合には ‘-1’ を返します。

 -- C の関数: *note PyObject: 5df. *PyUnicode_Replace (PyObject
          *unicode, PyObject *substr, PyObject *replstr, Py_ssize_t
          maxcount)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'unicode' 中に出現する 'substr' を最大で 'maxcount' 個 'replstr' に
     置換し、置換結果である Unicode オブジェクトを返します。 'maxcount'
     == ‘-1’ にすると、文字列中に現れる全ての 'substr' を置換します。

 -- C の関数: int PyUnicode_Compare (PyObject *left, PyObject *right)
     ' 次に属します: *note Stable ABI: 775.'  二つの文字列を比較して、左
     引数が右引数より小さい場合、左右引数が等価の場合、左引数が右引数よ
     り大きい場合に対して、それぞれ ‘-1’, ‘0’, ‘1’ を返します。

     この関数は、失敗したときに ‘-1’ を返すので、 *note
     PyErr_Occurred(): 1caf. を呼び出して、エラーをチェックすべきです。

     参考
     ....

     The *note PyUnicode_Equal(): 3b2. function.

 -- C の関数: int PyUnicode_Equal (PyObject *a, PyObject *b)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Test if two strings are equal:

        * Return ‘1’ if 'a' is equal to 'b'.

        * Return ‘0’ if 'a' is not equal to 'b'.

        * Set a *note TypeError: 198. exception and return ‘-1’ if 'a'
          or 'b' is not a *note str: 169. object.

     The function always succeeds if 'a' and 'b' are *note str: 169.
     objects.

     The function works for *note str: 169. subclasses, but does not
     honor custom ‘__eq__()’ method.

     参考
     ....

     The *note PyUnicode_Compare(): ab4. function.

     Added in version 3.14.

 -- C の関数: int PyUnicode_EqualToUTF8AndSize (PyObject *unicode, const
          char *string, Py_ssize_t size)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Compare a Unicode object with a char buffer which is interpreted as
     being UTF-8 or ASCII encoded and return true (‘1’) if they are
     equal, or false (‘0’) otherwise.  If the Unicode object contains
     surrogate code points (‘U+D800’ - ‘U+DFFF’) or the C string is not
     valid UTF-8, false (‘0’) is returned.

     この関数は例外を送出しません。

     Added in version 3.13.

 -- C の関数: int PyUnicode_EqualToUTF8 (PyObject *unicode, const char
          *string)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Similar to *note PyUnicode_EqualToUTF8AndSize(): 619, but compute
     'string' length using ‘strlen()’.  If the Unicode object contains
     null characters, false (‘0’) is returned.

     Added in version 3.13.

 -- C の関数: int PyUnicode_CompareWithASCIIString (PyObject *unicode,
          const char *string)
     ' 次に属します: *note Stable ABI: 775.'  Unicode オブジェクト
     'unicode' と 'string' を比較して、左引数が右引数より小さい場合、左
     右引数が等価の場合、左引数が右引数より大きい場合に対して、それぞれ
     ‘-1’, ‘0’, ‘1’ を返します。 ASCII エンコードされた文字列だけを渡す
     のが最も良いですが、入力文字列に非 ASCII 文字が含まれている場合は
     ISO-8859-1 として解釈します。

     この関数は例外を送出しません。

 -- C の関数: *note PyObject: 5df. *PyUnicode_RichCompare (PyObject
          *left, PyObject *right, int op)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  二つ
     のUnicode文字列を比較して、下のうちの一つを返します:

        * ‘NULL’ を、例外が発生したときに返します。

        * *note Py_True: 5315. もしくは *note Py_False: 5314. を、正しく
          比較できた時に返します。

        * *note Py_NotImplemented: 5286. in case the type combination is
          unknown

     Possible values for 'op' are *note Py_GT: 528d, *note Py_GE: 528e,
     *note Py_EQ: 528b, *note Py_NE: 528c, *note Py_LT: 5289, and *note
     Py_LE: 528a.

 -- C の関数: *note PyObject: 5df. *PyUnicode_Format (PyObject *format,
          PyObject *args)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  新た
     な文字列オブジェクトを 'format' および 'args' から生成して返します;
     このメソッドは ‘format % args’ のようなものです。

 -- C の関数: int PyUnicode_Contains (PyObject *unicode, PyObject
          *substr)
     ' 次に属します: *note Stable ABI: 775.'  'substr' が 'unicode' 内に
     あるか調べ、その結果に応じて真または偽を返します。

     'substr' は単要素の Unicode 文字に型強制できなければなりません。エ
     ラーが生じた場合には ‘-1’ を返します。

 -- C の関数: void PyUnicode_InternInPlace (PyObject **p_unicode)
     ' 次に属します: *note Stable ABI: 775.'  Intern the argument **note
     p_unicode: aae. in place.  The argument must be the address of a
     pointer variable pointing to a Python Unicode string object.  If
     there is an existing interned string that is the same as **note
     p_unicode: aae, it sets **note p_unicode: aae. to it (releasing the
     reference to the old string object and creating a new *note strong
     reference: 5e2. to the interned string object), otherwise it leaves
     **note p_unicode: aae. alone and interns it.

     (Clarification: even though there is a lot of talk about
     references, think of this function as reference-neutral.  You must
     own the object you pass in; after the call you no longer own the
     passed-in reference, but you newly own the result.)

     This function never raises an exception.  On error, it leaves its
     argument unchanged without interning it.

     Instances of subclasses of *note str: 169. may not be interned,
     that is, *note PyUnicode_CheckExact: 535b.(**note p_unicode: aae.)
     must be true.  If it is not, then - as with any other error - the
     argument is left unchanged.

     Note that interned strings are not “immortal”.  You must keep a
     reference to the result to benefit from interning.

 -- C の関数: *note PyObject: 5df. *PyUnicode_InternFromString (const
          char *str)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  A
     combination of *note PyUnicode_FromString(): 5112. and *note
     PyUnicode_InternInPlace(): aae, meant for statically allocated
     strings.

     Return a new ("owned") reference to either a new Unicode string
     object that has been interned, or an earlier interned string object
     with the same value.

     Python may keep a reference to the result, or make it *note
     immortal: 290, preventing it from being garbage-collected promptly.
     For interning an unbounded number of different strings, such as
     ones coming from user input, prefer calling *note
     PyUnicode_FromString(): 5112. and *note PyUnicode_InternInPlace():
     aae. directly.

 -- C の関数: unsigned int PyUnicode_CHECK_INTERNED (PyObject *str)

     Return a non-zero value if 'str' is interned, zero if not.  The
     'str' argument must be a string; this is not checked.  This
     function always succeeds.

     'CPython 実装の詳細:' A non-zero return value may carry additional
     information about 'how' the string is interned.  The meaning of
     such non-zero values, as well as each specific string's
     intern-related details, may change between CPython versions.


File: python.info,  Node: PyUnicodeWriter,  Next: Deprecated API<2>,  Prev: メソッドおよびスロット関数 slot function,  Up: Unicode オブジェクトと codec

7.9.3.27 PyUnicodeWriter
........................

The *note PyUnicodeWriter: 3b3. API can be used to create a Python *note
str: 169. object.

Added in version 3.14.

 -- C のデータ型: type PyUnicodeWriter

     A Unicode writer instance.

     The instance must be destroyed by *note PyUnicodeWriter_Finish():
     3b7. on success, or *note PyUnicodeWriter_Discard(): 3b6. on error.

 -- C の関数: *note PyUnicodeWriter: 3b3. *PyUnicodeWriter_Create
          (Py_ssize_t length)

     Create a Unicode writer instance.

     'length' must be greater than or equal to ‘0’.

     If 'length' is greater than ‘0’, preallocate an internal buffer of
     'length' characters.

     Set an exception and return ‘NULL’ on error.

 -- C の関数: *note PyObject: 5df. *PyUnicodeWriter_Finish
          (PyUnicodeWriter *writer)

     Return the final Python *note str: 169. object and destroy the
     writer instance.

     Set an exception and return ‘NULL’ on error.

     The writer instance is invalid after this call.

 -- C の関数: void PyUnicodeWriter_Discard (PyUnicodeWriter *writer)

     Discard the internal Unicode buffer and destroy the writer
     instance.

     If 'writer' is ‘NULL’, no operation is performed.

     The writer instance is invalid after this call.

 -- C の関数: int PyUnicodeWriter_WriteChar (PyUnicodeWriter *writer,
          Py_UCS4 ch)

     Write the single Unicode character 'ch' into 'writer'.

     On success, return ‘0’.  On error, set an exception, leave the
     writer unchanged, and return ‘-1’.

 -- C の関数: int PyUnicodeWriter_WriteUTF8 (PyUnicodeWriter *writer,
          const char *str, Py_ssize_t size)

     Decode the string 'str' from UTF-8 in strict mode and write the
     output into 'writer'.

     'size' is the string length in bytes.  If 'size' is equal to ‘-1’,
     call ‘strlen(str)’ to get the string length.

     On success, return ‘0’.  On error, set an exception, leave the
     writer unchanged, and return ‘-1’.

     See also *note PyUnicodeWriter_DecodeUTF8Stateful(): 3b5.

 -- C の関数: int PyUnicodeWriter_WriteASCII (PyUnicodeWriter *writer,
          const char *str, Py_ssize_t size)

     Write the ASCII string 'str' into 'writer'.

     'size' is the string length in bytes.  If 'size' is equal to ‘-1’,
     call ‘strlen(str)’ to get the string length.

     'str' must only contain ASCII characters.  The behavior is
     undefined if 'str' contains non-ASCII characters.

     On success, return ‘0’.  On error, set an exception, leave the
     writer unchanged, and return ‘-1’.

     Added in version 3.14.

 -- C の関数: int PyUnicodeWriter_WriteWideChar (PyUnicodeWriter
          *writer, const wchar_t *str, Py_ssize_t size)

     Write the wide string 'str' into 'writer'.

     'size' is a number of wide characters.  If 'size' is equal to ‘-1’,
     call ‘wcslen(str)’ to get the string length.

     On success, return ‘0’.  On error, set an exception, leave the
     writer unchanged, and return ‘-1’.

 -- C の関数: int PyUnicodeWriter_WriteUCS4 (PyUnicodeWriter *writer,
          Py_UCS4 *str, Py_ssize_t size)

     Writer the UCS4 string 'str' into 'writer'.

     'size' is a number of UCS4 characters.

     On success, return ‘0’.  On error, set an exception, leave the
     writer unchanged, and return ‘-1’.

 -- C の関数: int PyUnicodeWriter_WriteStr (PyUnicodeWriter *writer,
          PyObject *obj)

     Call *note PyObject_Str(): 1231. on 'obj' and write the output into
     'writer'.

     On success, return ‘0’.  On error, set an exception, leave the
     writer unchanged, and return ‘-1’.

 -- C の関数: int PyUnicodeWriter_WriteRepr (PyUnicodeWriter *writer,
          PyObject *obj)

     Call *note PyObject_Repr(): 1230. on 'obj' and write the output
     into 'writer'.

     On success, return ‘0’.  On error, set an exception, leave the
     writer unchanged, and return ‘-1’.

 -- C の関数: int PyUnicodeWriter_WriteSubstring (PyUnicodeWriter
          *writer, PyObject *str, Py_ssize_t start, Py_ssize_t end)

     Write the substring ‘str[start:end]’ into 'writer'.

     'str' must be Python *note str: 169. object.  'start' must be
     greater than or equal to 0, and less than or equal to 'end'.  'end'
     must be less than or equal to 'str' length.

     On success, return ‘0’.  On error, set an exception, leave the
     writer unchanged, and return ‘-1’.

 -- C の関数: int PyUnicodeWriter_Format (PyUnicodeWriter *writer, const
          char *format, ...)

     Similar to *note PyUnicode_FromFormat(): 62b, but write the output
     directly into 'writer'.

     On success, return ‘0’.  On error, set an exception, leave the
     writer unchanged, and return ‘-1’.

 -- C の関数: int PyUnicodeWriter_DecodeUTF8Stateful (PyUnicodeWriter
          *writer, const char *string, Py_ssize_t length, const char
          *errors, Py_ssize_t *consumed)

     Decode the string 'str' from UTF-8 with 'errors' error handler and
     write the output into 'writer'.

     'size' is the string length in bytes.  If 'size' is equal to ‘-1’,
     call ‘strlen(str)’ to get the string length.

     'errors' is an *note error handler: 1b6f. name, such as
     ‘"replace"’.  If 'errors' is ‘NULL’, use the strict error handler.

     If 'consumed' is not ‘NULL’, set '*consumed' to the number of
     decoded bytes on success.  If 'consumed' is ‘NULL’, treat trailing
     incomplete UTF-8 byte sequences as an error.

     On success, return ‘0’.  On error, set an exception, leave the
     writer unchanged, and return ‘-1’.

     See also *note PyUnicodeWriter_WriteUTF8(): 3bf.


File: python.info,  Node: Deprecated API<2>,  Prev: PyUnicodeWriter,  Up: Unicode オブジェクトと codec

7.9.3.28 Deprecated API
.......................

The following API is deprecated.

 -- C のデータ型: type Py_UNICODE

     This is a typedef of ‘wchar_t’, which is a 16-bit type or 32-bit
     type depending on the platform.  Please use ‘wchar_t’ directly
     instead.

     バージョン 3.3 で変更: 以前のバージョンでは、Pythonをビルドした際に
     "narrow" または "wide" Unicode バージョンのどちらを選択したかによっ
     て、 16ビットか32ビットのどちらかの型になっていました。

     Deprecated since version 3.13, will be removed in version 3.15.

 -- C の関数: int PyUnicode_READY (PyObject *unicode)

     Do nothing and return ‘0’.  This API is kept only for backward
     compatibility, but there are no plans to remove it.

     Added in version 3.3.

     バージョン 3.10 で非推奨: This API does nothing since Python 3.12.
     Previously, this needed to be called for each string created using
     the old API (‘PyUnicode_FromUnicode()’ or similar).

 -- C の関数: unsigned int PyUnicode_IS_READY (PyObject *unicode)

     Do nothing and return ‘1’.  This API is kept only for backward
     compatibility, but there are no plans to remove it.

     Added in version 3.3.

     バージョン 3.14 で非推奨: This API does nothing since Python 3.12.
     Previously, this could be called to check if *note
     PyUnicode_READY(): 434. is necessary.


File: python.info,  Node: タプルオブジェクト tuple object,  Next: Struct Sequence オブジェクト,  Prev: Unicode オブジェクトと codec,  Up: シーケンスオブジェクト sequence object

7.9.3.29 タプルオブジェクト (tuple object)
..........................................

 -- C のデータ型: type PyTupleObject

     この *note PyObject: 5df. のサブタイプは Python のタプルオブジェク
     トを表現します。

 -- C 変数: *note PyTypeObject: c9c. PyTuple_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     c9c. のインスタンスは Python のタプル型を表現します; Python レイヤ
     における *note tuple: 614. と同じオブジェクトです。

 -- C の関数: int PyTuple_Check (PyObject *p)

     'p' がタプルオブジェクトかタプル型のサブタイプのインスタンスである
     場合に真を返します。この関数は常に成功します。

 -- C の関数: int PyTuple_CheckExact (PyObject *p)

     'p' がタプルオブジェクトだがタプル型のサブタイプのインスタンスでな
     い場合に真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyTuple_New (Py_ssize_t len)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return a new tuple object of size 'len', or ‘NULL’ with an
     exception set on failure.

 -- C の関数: *note PyObject: 5df. *PyTuple_Pack (Py_ssize_t n, ...)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return a new tuple object of size 'n', or ‘NULL’ with an exception
     set on failure.  The tuple values are initialized to the subsequent
     'n' C arguments pointing to Python objects.  ‘PyTuple_Pack(2, a,
     b)’ is equivalent to ‘Py_BuildValue("(OO)", a, b)’.

 -- C の関数: *note Py_ssize_t: c55. PyTuple_Size (PyObject *p)
     ' 次に属します: *note Stable ABI: 775.'  Take a pointer to a tuple
     object, and return the size of that tuple.  On error, return ‘-1’
     with an exception set.

 -- C の関数: *note Py_ssize_t: c55. PyTuple_GET_SIZE (PyObject *p)

     Like *note PyTuple_Size(): 50d8, but without error checking.

 -- C の関数: *note PyObject: 5df. *PyTuple_GetItem (PyObject *p,
          Py_ssize_t pos)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  'p' の
     指すタプルオブジェクト内の、位置 'pos' にあるオブジェクトを返します
     。 'pos' が負であるか範囲を超えている場合、 ‘NULL’ を返して *note
     IndexError: 174e. 例外をセットします。

     The returned reference is borrowed from the tuple 'p' (that is: it
     is only valid as long as you hold a reference to 'p').  To get a
     *note strong reference: 5e2, use *note
     Py_NewRef(PyTuple_GetItem(...)): a9a. or *note
     PySequence_GetItem(): 1e34.

 -- C の関数: *note PyObject: 5df. *PyTuple_GET_ITEM (PyObject *p,
          Py_ssize_t pos)
     '戻り値: 借用参照。' *note PyTuple_GetItem(): 4eb7. に似ていますが
     、引数に対するエラーチェックを行いません。

 -- C の関数: *note PyObject: 5df. *PyTuple_GetSlice (PyObject *p,
          Py_ssize_t low, Py_ssize_t high)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return the slice of the tuple pointed to by 'p' between 'low' and
     'high', or ‘NULL’ with an exception set on failure.

     This is the equivalent of the Python expression ‘p[low:high]’.
     Indexing from the end of the tuple is not supported.

 -- C の関数: int PyTuple_SetItem (PyObject *p, Py_ssize_t pos, PyObject
          *o)
     ' 次に属します: *note Stable ABI: 775.'  'p' の指すタプルオブジェク
     ト内の、位置 'pos' にあるオブジェクトへの参照を入れます。成功すれば
     ‘0’ を返します。 'pos' が範囲を超えている場合、 ‘-1’ を返して *note
     IndexError: 174e. 例外をセットします。

          注釈: この関数は 'o' への参照を "盗み取り" ます。また、変更先
          のインデクスにすでに別の要素が入っている場合、その要素に対する
          参照を放棄します。

 -- C の関数: void PyTuple_SET_ITEM (PyObject *p, Py_ssize_t pos,
          PyObject *o)

     *note PyTuple_SetItem(): 4eb8. に似ていますが、エラーチェックを行わ
     ず、新たなタプルに値を入れるとき '以外には使ってはなりません' 。

     Bounds checking is performed as an assertion if Python is built in
     *note debug mode: 509. or *note with assertions: 62d.

          注釈: この関数は 'o' への参照を "盗み取り" ます。また、 *note
          PyTuple_SetItem(): 4eb8. と違って、要素の置き換えが生じても置
          き換えられるオブジェクトへの参照を放棄 'しません' ; その結果、
          タプル中の位置 'pos' で参照されていたオブジェクトがメモリリー
          クを引き起こします。

          警告: This macro should 'only' be used on tuples that are
          newly created.  Using this macro on a tuple that is already in
          use (or in other words, has a refcount > 1) could lead to
          undefined behavior.

 -- C の関数: int _PyTuple_Resize (PyObject **p, Py_ssize_t newsize)

     タプルをリサイズする際に使えます。 'newsize' はタプルの新たな長さで
     す。タプルは変更不能なオブジェクト 'ということになっている' ので、
     この関数はこのオブジェクトに対してただ一つしか参照がない時以外には
     使ってはなりません。タプルがコード中の他の部分ですでに参照されてい
     る場合には、この関数を '使ってはなりません' 。タプルは常に指定サイ
     ズの末尾まで伸縮します。成功した場合には ‘0’ を返します。クライアン
     トコードは、 ‘*p’ の値が呼び出し前と同じになると期待してはなりませ
     ん。 ‘*p’ が置き換えられた場合、オリジナルの ‘*p’ は破壊されます。
     失敗すると ‘-1’ を返し、 ‘*p’ を ‘NULL’ に設定して、 *note
     MemoryError: 179e. または *note SystemError: 795. を送出します。


File: python.info,  Node: Struct Sequence オブジェクト,  Next: リストオブジェクト,  Prev: タプルオブジェクト tuple object,  Up: シーケンスオブジェクト sequence object

7.9.3.30 Struct Sequence オブジェクト
.....................................

struct sequence オブジェクトは *note namedtuple(): 4e0. オブジェクトと等
価なC オブジェクトです。 つまり、その要素に属性を通してアクセスすること
ができるシーケンスです。 struct sequence を生成するには、まず特定の
struct sequence 型を生成しなければなりません。

 -- C の関数: *note PyTypeObject: c9c. *PyStructSequence_NewType
          (PyStructSequence_Desc *desc)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  後述
     の 'desc' 中のデータから新しい struct sequence 型を生成します。返さ
     れる型のインスタンスは *note PyStructSequence_New(): 50b8. で生成で
     きます。

     Return ‘NULL’ with an exception set on failure.

 -- C の関数: void PyStructSequence_InitType (PyTypeObject *type,
          PyStructSequence_Desc *desc)

     struct sequence 型である 'type' を 'desc' をもとにその場で初期化し
     ます。

 -- C の関数: int PyStructSequence_InitType2 (PyTypeObject *type,
          PyStructSequence_Desc *desc)

     Like *note PyStructSequence_InitType(): 1204, but returns ‘0’ on
     success and ‘-1’ with an exception set on failure.

     Added in version 3.4.

 -- C のデータ型: type PyStructSequence_Desc
     ' 次に属します: *note Stable ABI: 775. (すべてのメンバーを含む).'  生
     成するstruct sequence 型のメタデータを保持します。

      -- C のメンバ変数: const char *name

          Fully qualified name of the type; null-terminated UTF-8
          encoded.  The name must contain the module name.

      -- C のメンバ変数: const char *doc

          Pointer to docstring for the type or ‘NULL’ to omit.

      -- C のメンバ変数: *note PyStructSequence_Field: db3. *fields

          Pointer to ‘NULL’-terminated array with field names of the new
          type.

      -- C のメンバ変数: int n_in_sequence

          Number of fields visible to the Python side (if used as
          tuple).

 -- C のデータ型: type PyStructSequence_Field
     ' 次に属します: *note Stable ABI: 775. (すべてのメンバーを含む).'
     Describes a field of a struct sequence.  As a struct sequence is
     modeled as a tuple, all fields are typed as *note PyObject: 5df.*.
     The index in the *note fields: 5397. array of the *note
     PyStructSequence_Desc: db4. determines which field of the struct
     sequence is described.

      -- C のメンバ変数: const char *name

          Name for the field or ‘NULL’ to end the list of named fields,
          set to *note PyStructSequence_UnnamedField: b79. to leave
          unnamed.

      -- C のメンバ変数: const char *doc

          Field docstring or ‘NULL’ to omit.

 -- C 変数: const char *const PyStructSequence_UnnamedField
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'  フ
     ィールド名を名前がないままするための特殊な値。

     バージョン 3.9 で変更: 型が ‘char *’ から変更されました。

 -- C の関数: *note PyObject: 5df. *PyStructSequence_New (PyTypeObject
          *type)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'type' のインスタンスを生成します。 'type' は *note
     PyStructSequence_NewType(): 50b9. によって事前に生成していなければ
     なりません。

     Return ‘NULL’ with an exception set on failure.

 -- C の関数: *note PyObject: 5df. *PyStructSequence_GetItem (PyObject
          *p, Py_ssize_t pos)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  Return
     the object at position 'pos' in the struct sequence pointed to by
     'p'.

     Bounds checking is performed as an assertion if Python is built in
     *note debug mode: 509. or *note with assertions: 62d.

 -- C の関数: *note PyObject: 5df. *PyStructSequence_GET_ITEM (PyObject
          *p, Py_ssize_t pos)
     '戻り値: 借用参照。' Alias to *note PyStructSequence_GetItem():
     50b7.

     バージョン 3.13 で変更: Now implemented as an alias to *note
     PyStructSequence_GetItem(): 50b7.

 -- C の関数: void PyStructSequence_SetItem (PyObject *p, Py_ssize_t
          pos, PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'  struct sequence 'p' の
     'pos' の位置にあるフィールドに値 'o' を設定します。*note
     PyTuple_SET_ITEM(): 62e. のように、生成したてのインスタンスに対して
     のみ使用すべきです。

     Bounds checking is performed as an assertion if Python is built in
     *note debug mode: 509. or *note with assertions: 62d.

          注釈: この関数は 'o' への参照を "盗み取り" ます。

 -- C の関数: void PyStructSequence_SET_ITEM (PyObject *p, Py_ssize_t
          *pos, PyObject *o)

     Alias to *note PyStructSequence_SetItem(): 50ba.

     バージョン 3.13 で変更: Now implemented as an alias to *note
     PyStructSequence_SetItem(): 50ba.


File: python.info,  Node: リストオブジェクト,  Prev: Struct Sequence オブジェクト,  Up: シーケンスオブジェクト sequence object

7.9.3.31 リストオブジェクト
...........................

 -- C のデータ型: type PyListObject

     この *note PyObject: 5df. のサブタイプは Python のリストオブジェク
     トを表現します。

 -- C 変数: *note PyTypeObject: c9c. PyList_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     c9c. のインスタンスは Python のリスト型を表現します。これは Python
     レイヤにおける *note list: 24d. と同じオブジェクトです。

 -- C の関数: int PyList_Check (PyObject *p)

     'p' がリストオブジェクトかリスト型のサブタイプのインスタンスである
     場合に真を返します。この関数は常に成功します。

 -- C の関数: int PyList_CheckExact (PyObject *p)

     'p' がリストオブジェクトだがリスト型のサブタイプのインスタンスでな
     い場合に真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyList_New (Py_ssize_t len)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  サイ
     ズが 'len' 新たなリストオブジェクトを返します。 失敗すると ‘NULL’ を
     返します。

          注釈: If 'len' is greater than zero, the returned list
          object's items are set to ‘NULL’.  Thus you cannot use
          abstract API functions such as *note PySequence_SetItem():
          1e35. or expose the object to Python code before setting all
          items to a real object with *note PyList_SetItem(): 18ba. or
          *note PyList_SET_ITEM(): 62f.  The following APIs are safe
          APIs before the list is fully initialized: *note
          PyList_SetItem(): 18ba. and *note PyList_SET_ITEM(): 62f.

 -- C の関数: *note Py_ssize_t: c55. PyList_Size (PyObject *list)
     ' 次に属します: *note Stable ABI: 775.'

     リストオブジェクト 'list' の長さを返します; リストオブジェクトにお
     ける ‘len(list)’ と同じです。

 -- C の関数: *note Py_ssize_t: c55. PyList_GET_SIZE (PyObject *list)

     *note PyList_Size(): 1633. に似ていますが、エラーチェックを行いませ
     ん。

 -- C の関数: *note PyObject: 5df. *PyList_GetItemRef (PyObject *list,
          Py_ssize_t index)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.13 より).'  Return the object at position 'index' in the
     list pointed to by 'list'.  The position must be non-negative;
     indexing from the end of the list is not supported.  If 'index' is
     out of bounds (‘<0 or >=len(list)’), return ‘NULL’ and set an *note
     IndexError: 174e. exception.

     Added in version 3.13.

 -- C の関数: *note PyObject: 5df. *PyList_GetItem (PyObject *list,
          Py_ssize_t index)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  Like
     *note PyList_GetItemRef(): 5fe, but returns a *note borrowed
     reference: 3d7. instead of a *note strong reference: 5e2.

 -- C の関数: *note PyObject: 5df. *PyList_GET_ITEM (PyObject *list,
          Py_ssize_t i)
     '戻り値: 借用参照。' *note PyList_GetItem(): 5ff. に似ていますが、
     エラーチェックを行いません。

 -- C の関数: int PyList_SetItem (PyObject *list, Py_ssize_t index,
          PyObject *item)
     ' 次に属します: *note Stable ABI: 775.'  リストオブジェクト内の位置
     'index' に、オブジェクト 'item' を挿入します。 成功した場合には ‘0’
     を返します。 'index' が範囲を越えている場合、 ‘-1’ を返して *note
     IndexError: 174e. をセットします。

          注釈: この関数は 'item' への参照を "盗み取り" ます。また、変更
          先のインデクスにすでに別の要素が入っている場合、その要素に対す
          る参照を放棄します。

 -- C の関数: void PyList_SET_ITEM (PyObject *list, Py_ssize_t i,
          PyObject *o)

     *note PyList_SetItem(): 18ba. をマクロによる実装で、エラーチェック
     を行いません。このマクロは、新たなリストのまだ要素を入れたことのな
     い位置に要素を入れるときにのみ使います。

     Bounds checking is performed as an assertion if Python is built in
     *note debug mode: 509. or *note with assertions: 62d.

          注釈: このマクロは 'item' への参照を "盗み取り" ます。また、
          *note PyList_SetItem(): 18ba. と違って、要素の置き換えが生じて
          も置き換えられるオブジェクトへの参照を放棄 'しません' ; その結
          果、 'list' 中の位置 'i' で参照されていたオブジェクトがメモリ
          リークを引き起こします。

 -- C の関数: int PyList_Insert (PyObject *list, Py_ssize_t index,
          PyObject *item)
     ' 次に属します: *note Stable ABI: 775.'  要素 'item' をリスト
     'list' のインデックス 'index' の前に挿入します。成功すると ‘0’ を返
     します。失敗すると ‘-1’ を返し、例外をセットします。
     ‘list.insert(index, item)’ に類似した機能です。

 -- C の関数: int PyList_Append (PyObject *list, PyObject *item)
     ' 次に属します: *note Stable ABI: 775.'  オブジェクト 'item' を
     'list' の末尾に追加します。成功すると ‘0’ を返します; 失敗すると
     ‘-1’ を返し、例外をセットします。‘list.append(item)’ に類似した機能
     です。

 -- C の関数: *note PyObject: 5df. *PyList_GetSlice (PyObject *list,
          Py_ssize_t low, Py_ssize_t high)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'list' 内の、'low' から 'high' 'までの' オブジェクトからなるリスト
     を返します。 失敗すると ‘NULL’ を返し、例外をセットします。
     ‘list[low:high]’ に類似した機能です。 ただし、リストの末尾からのイ
     ンデックスはサポートされていません。

 -- C の関数: int PyList_SetSlice (PyObject *list, Py_ssize_t low,
          Py_ssize_t high, PyObject *itemlist)
     ' 次に属します: *note Stable ABI: 775.'  'low' から 'high' までの
     'list' のスライスを、 'itemlist' の内容にします。 ‘list[low:high] =
     itemlist’ と類似の機能です。 'itemlist' は ‘NULL’ でもよく、空リス
     トの代入 (指定スライスの削除) になります。 成功した場合には ‘0’ を
     、失敗した場合には ‘-1’ を返します。 ただし、リストの末尾からのイン
     デックスはサポートされていません。

 -- C の関数: int PyList_Extend (PyObject *list, PyObject *iterable)

     Extend 'list' with the contents of 'iterable'.  This is the same as
     ‘PyList_SetSlice(list, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable)’
     and analogous to ‘list.extend(iterable)’ or ‘list += iterable’.

     Raise an exception and return ‘-1’ if 'list' is not a *note list:
     24d. object.  Return 0 on success.

     Added in version 3.13.

 -- C の関数: int PyList_Clear (PyObject *list)

     Remove all items from 'list'.  This is the same as
     ‘PyList_SetSlice(list, 0, PY_SSIZE_T_MAX, NULL)’ and analogous to
     ‘list.clear()’ or ‘del list[:]’.

     Raise an exception and return ‘-1’ if 'list' is not a *note list:
     24d. object.  Return 0 on success.

     Added in version 3.13.

 -- C の関数: int PyList_Sort (PyObject *list)
     ' 次に属します: *note Stable ABI: 775.'  'list' の内容をインプレー
     スでソートします。成功した場合には ‘0’ を、失敗した場合には ‘-1’ を
     返します。‘list.sort()’ と同じです。

 -- C の関数: int PyList_Reverse (PyObject *list)
     ' 次に属します: *note Stable ABI: 775.'  'list' の要素をインプレー
     スで反転します。成功した場合には ‘0’ を、失敗した場合には ‘-1’ を返
     します。‘list.reverse()’ と同じです。

 -- C の関数: *note PyObject: 5df. *PyList_AsTuple (PyObject *list)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     'list' の内容が入った新たなタプルオブジェクトを返します;
     ‘tuple(list)’ と同じです。


File: python.info,  Node: Container オブジェクト,  Next: Function オブジェクト<2>,  Prev: シーケンスオブジェクト sequence object,  Up: 具象オブジェクト concrete object レイヤ

7.9.4 Container オブジェクト
----------------------------

* Menu:

* 辞書オブジェクト (dictionary object): 辞書オブジェクト dictionary object.
* Set オブジェクト::


File: python.info,  Node: 辞書オブジェクト dictionary object,  Next: Set オブジェクト,  Up: Container オブジェクト

7.9.4.1 辞書オブジェクト (dictionary object)
............................................

 -- C のデータ型: type PyDictObject

     この *note PyObject: 5df. のサブタイプは Python の辞書オブジェクト
     を表現します。

 -- C 変数: *note PyTypeObject: c9c. PyDict_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     c9c. のインスタンスは Python の辞書を表現します。このオブジェクトは
     、Python レイヤにおける *note dict: 183. と同じオブジェクトです。

 -- C の関数: int PyDict_Check (PyObject *p)

     'p' が辞書オブジェクトか辞書型のサブタイプのインスタンスである場合
     に真を返します。この関数は常に成功します。

 -- C の関数: int PyDict_CheckExact (PyObject *p)

     'p' が辞書オブジェクトだが辞書型のサブタイプのインスタンスでない場
     合に真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyDict_New ()
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  空の
     新たな辞書を返します。 失敗すると ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyDictProxy_New (PyObject *mapping)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  ある
     マップ型オブジェクトに対して、読み出し専用に制限された *note
     types.MappingProxyType: 698. オブジェクトを返します。通常、この関数
     は動的でないクラス型 (non-dynamic class type) のクラス辞書が変更さ
     れないようにビューを作成するために使われます。

 -- C 変数: *note PyTypeObject: c9c. PyDictProxy_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object for
     mapping proxy objects created by *note PyDictProxy_New(): 4fb7. and
     for the read-only ‘__dict__’ attribute of many built-in types.  A
     *note PyDictProxy_Type: 4fb8. instance provides a dynamic,
     read-only view of an underlying dictionary: changes to the
     underlying dictionary are reflected in the proxy, but the proxy
     itself does not support mutation operations.  This corresponds to
     *note types.MappingProxyType: 698. in Python.

 -- C の関数: void PyDict_Clear (PyObject *p)
     ' 次に属します: *note Stable ABI: 775.'  現在辞書に入っている全ての
     キーと値のペアを除去して空にします。

 -- C の関数: int PyDict_Contains (PyObject *p, PyObject *key)
     ' 次に属します: *note Stable ABI: 775.'  Determine if dictionary
     'p' contains 'key'.  If an item in 'p' matches 'key', return ‘1’,
     otherwise return ‘0’.  On error, return ‘-1’.  This is equivalent
     to the Python expression ‘key in p’.

 -- C の関数: int PyDict_ContainsString (PyObject *p, const char *key)

     This is the same as *note PyDict_Contains(): 5de, but 'key' is
     specified as a const char* UTF-8 encoded bytes string, rather than
     a *note PyObject: 5df.*.

     Added in version 3.13.

 -- C の関数: *note PyObject: 5df. *PyDict_Copy (PyObject *p)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  'p'
     と同じキーと値のペアが入った新たな辞書を返します。

 -- C の関数: int PyDict_SetItem (PyObject *p, PyObject *key, PyObject
          *val)
     ' 次に属します: *note Stable ABI: 775.'  辞書 'p' に、 'key' をキー
     として値 'val' を挿入します。 'key' はハッシュ可能(*note hashable:
     824.)でなければなりません。ハッシュ可能でない場合、 *note
     TypeError: 198. を送出します。 成功した場合には ‘0’ を、失敗した場
     合には ‘-1’ を返します。 この関数は 'val' への参照を盗み取り 'ませ
     ん'。

 -- C の関数: int PyDict_SetItemString (PyObject *p, const char *key,
          PyObject *val)
     ' 次に属します: *note Stable ABI: 775.'  This is the same as *note
     PyDict_SetItem(): 4eb9, but 'key' is specified as a const char*
     UTF-8 encoded bytes string, rather than a *note PyObject: 5df.*.

 -- C の関数: int PyDict_DelItem (PyObject *p, PyObject *key)
     ' 次に属します: *note Stable ABI: 775.'  辞書 'p' から 'key' をキー
     とするエントリを除去します。 'key' は *note ハッシュ可能: 824. でな
     ければなりません; ハッシュ可能でない場合、 *note TypeError: 198. を
     送出します。'key' が辞書になければ、*note KeyError: 5e7. を送出しま
     す。成功した場合には ‘0’ を、失敗した場合には ‘-1’ を返します。

 -- C の関数: int PyDict_DelItemString (PyObject *p, const char *key)
     ' 次に属します: *note Stable ABI: 775.'  This is the same as *note
     PyDict_DelItem(): 4fbe, but 'key' is specified as a const char*
     UTF-8 encoded bytes string, rather than a *note PyObject: 5df.*.

 -- C の関数: int PyDict_GetItemRef (PyObject *p, PyObject *key,
          PyObject **result)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Return a new *note strong reference: 5e2. to the object from
     dictionary 'p' which has a key 'key':

        * If the key is present, set '*result' to a new *note strong
          reference: 5e2. to the value and return ‘1’.

        * If the key is missing, set '*result' to ‘NULL’ and return ‘0’.

        * エラーの場合例外を送出し ‘-1’ を返します。

     Added in version 3.13.

     See also the *note PyObject_GetItem(): 5ea. function.

 -- C の関数: *note PyObject: 5df. *PyDict_GetItem (PyObject *p,
          PyObject *key)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  Return
     a *note borrowed reference: 3d7. to the object from dictionary 'p'
     which has a key 'key'.  Return ‘NULL’ if the key 'key' is missing
     'without' setting an exception.

          注釈: Exceptions that occur while this calls *note __hash__():
          cf3. and *note __eq__(): cf2. methods are silently ignored.
          Prefer the *note PyDict_GetItemWithError(): 5e1. function
          instead.

     バージョン 3.10 で変更: Calling this API without an *note attached
     thread state: 4ed1. had been allowed for historical reason.  It is
     no longer allowed.

 -- C の関数: *note PyObject: 5df. *PyDict_GetItemWithError (PyObject
          *p, PyObject *key)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  *note
     PyDict_GetItem(): 628. の変種で例外を隠しません。 例外が発生した場
     合は、例外をセット 'した上で' ‘NULL’ を返します。 キーが存在しなか
     った場合は、例外をセット 'せずに' ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyDict_GetItemString (PyObject *p,
          const char *key)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  This
     is the same as *note PyDict_GetItem(): 628, but 'key' is specified
     as a const char* UTF-8 encoded bytes string, rather than a *note
     PyObject: 5df.*.

          注釈: Exceptions that occur while this calls *note __hash__():
          cf3. and *note __eq__(): cf2. methods or while creating the
          temporary *note str: 169. object are silently ignored.  Prefer
          using the *note PyDict_GetItemWithError(): 5e1. function with
          your own *note PyUnicode_FromString(): 5112. 'key' instead.

 -- C の関数: int PyDict_GetItemStringRef (PyObject *p, const char *key,
          PyObject **result)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Similar to *note PyDict_GetItemRef(): 5e0, but 'key' is specified
     as a const char* UTF-8 encoded bytes string, rather than a *note
     PyObject: 5df.*.

     Added in version 3.13.

 -- C の関数: *note PyObject: 5df. *PyDict_SetDefault (PyObject *p,
          PyObject *key, PyObject *defaultobj)
     '戻り値: 借用参照。' これは Python レベルの *note
     dict.setdefault(): 1285. と同じです。 もしあれば、辞書 'p' から
     'key' に対応する値を返します。 キーが辞書になければ、値
     'defaultobj' を挿入し 'defaultobj' を返します。 この関数は、 'key'
     のハッシュ値を検索と挿入ごとに別々に評価するのではなく、一度だけし
     か評価しません。

     Added in version 3.4.

 -- C の関数: int PyDict_SetDefaultRef (PyObject *p, PyObject *key,
          PyObject *default_value, PyObject **result)

     Inserts 'default_value' into the dictionary 'p' with a key of 'key'
     if the key is not already present in the dictionary.  If 'result'
     is not ‘NULL’, then '*result' is set to a *note strong reference:
     5e2. to either 'default_value', if the key was not present, or the
     existing value, if 'key' was already present in the dictionary.
     Returns ‘1’ if the key was present and 'default_value' was not
     inserted, or ‘0’ if the key was not present and 'default_value' was
     inserted.  On failure, returns ‘-1’, sets an exception, and sets
     ‘*result’ to ‘NULL’.

     For clarity: if you have a strong reference to 'default_value'
     before calling this function, then after it returns, you hold a
     strong reference to both 'default_value' and '*result' (if it's not
     ‘NULL’).  These may refer to the same object: in that case you hold
     two separate references to it.

     Added in version 3.13.

 -- C の関数: int PyDict_Pop (PyObject *p, PyObject *key, PyObject
          **result)

     Remove 'key' from dictionary 'p' and optionally return the removed
     value.  Do not raise *note KeyError: 5e7. if the key is missing.

        - If the key is present, set '*result' to a new reference to the
          removed value if 'result' is not ‘NULL’, and return ‘1’.

        - If the key is missing, set '*result' to ‘NULL’ if 'result' is
          not ‘NULL’, and return ‘0’.

        - エラーの場合例外を送出し ‘-1’ を返します。

     Similar to *note dict.pop(): 5e6, but without the default value and
     not raising *note KeyError: 5e7. if the key is missing.

     Added in version 3.13.

 -- C の関数: int PyDict_PopString (PyObject *p, const char *key,
          PyObject **result)

     Similar to *note PyDict_Pop(): 422, but 'key' is specified as a
     const char* UTF-8 encoded bytes string, rather than a *note
     PyObject: 5df.*.

     Added in version 3.13.

 -- C の関数: *note PyObject: 5df. *PyDict_Items (PyObject *p)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  辞書
     内の全ての要素対が入った *note PyListObject: 52a8. を返します。

 -- C の関数: *note PyObject: 5df. *PyDict_Keys (PyObject *p)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  辞書
     内の全てのキーが入った *note PyListObject: 52a8. を返します。

 -- C の関数: *note PyObject: 5df. *PyDict_Values (PyObject *p)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  辞書
     'p' 内の全ての値が入った *note PyListObject: 52a8. を返します。

 -- C の関数: *note Py_ssize_t: c55. PyDict_Size (PyObject *p)
     ' 次に属します: *note Stable ABI: 775.'

     辞書内の要素の数を返します。辞書に対して ‘len(p)’ を実行するのと同
     じです。

 -- C の関数: *note Py_ssize_t: c55. PyDict_GET_SIZE (PyObject *p)

     Similar to *note PyDict_Size(): 4fc5, but without error checking.

 -- C の関数: int PyDict_Next (PyObject *p, Py_ssize_t *ppos, PyObject
          **pkey, PyObject **pvalue)
     ' 次に属します: *note Stable ABI: 775.'  辞書 'p' 内の全てのキー/値
     のペアにわたる反復処理を行います。 'ppos' が参照している *note
     Py_ssize_t: c55. 型は、この関数で反復処理を開始する際に、最初に関数
     を呼び出すよりも前に ‘0’ に初期化しておかなければなりません。この関
     数は辞書内の各ペアを取り上げるごとに真を返し、全てのペアを取り上げ
     たことが分かると偽を返します。 パラメーター 'pkey' および 'pvalue'
     には、それぞれ辞書の各々のキーと値が埋められた *note PyObject:
     5df.* 変数を指すポインタか、または ‘NULL’ が入ります。 この関数から
     返される参照はすべて借用参照になります。 反復処理中に 'ppos' を変更
     してはなりません。 この値は内部的な辞書構造体のオフセットを表現して
     おり、構造体はスパースなので、オフセットの値に一貫性がないためです
     。

     例えば:

          PyObject *key, *value;
          Py_ssize_t pos = 0;

          while (PyDict_Next(self->dict, &pos, &key, &value)) {
              /* do something interesting with the values... */
              ...
          }

     反復処理中に辞書 'p' を変更してはなりません。辞書を反復処理する際に
     、キーに対応する値を変更しても大丈夫になりましたが、キーの集合を変
     更しないことが前提です。以下に例を示します:

          PyObject *key, *value;
          Py_ssize_t pos = 0;

          while (PyDict_Next(self->dict, &pos, &key, &value)) {
              long i = PyLong_AsLong(value);
              if (i == -1 && PyErr_Occurred()) {
                  return -1;
              }
              PyObject *o = PyLong_FromLong(i + 1);
              if (o == NULL)
                  return -1;
              if (PyDict_SetItem(self->dict, key, o) < 0) {
                  Py_DECREF(o);
                  return -1;
              }
              Py_DECREF(o);
          }

     The function is not thread-safe in the *note free-threaded: 1f4.
     build without external synchronization.  You can use *note
     Py_BEGIN_CRITICAL_SECTION: 53ab. to lock the dictionary while
     iterating over it:

          Py_BEGIN_CRITICAL_SECTION(self->dict);
          while (PyDict_Next(self->dict, &pos, &key, &value)) {
              ...
          }
          Py_END_CRITICAL_SECTION();

          注釈: On the free-threaded build, this function can be used
          safely inside a critical section.  However, the references
          returned for 'pkey' and 'pvalue' are *note borrowed: 3d7. and
          are only valid while the critical section is held.  If you
          need to use these objects outside the critical section or when
          the critical section can be suspended, create a *note strong
          reference: 5e2. (for example, using *note Py_NewRef(): a9a.).

 -- C の関数: int PyDict_Merge (PyObject *a, PyObject *b, int override)
     ' 次に属します: *note Stable ABI: 775.'  マップ型オブジェクト 'b' の
     全ての要素にわたって、反復的にキー/値のペアを辞書 'a' に追加します
     。 'b' は辞書か、 *note PyMapping_Keys(): db5. または *note
     PyObject_GetItem(): 5ea. をサポートする何らかのオブジェクトにできま
     す。 'override' が真ならば、 'a' のキーと一致するキーが 'b' にある
     際に、既存のペアを置き換えます。それ以外の場合は、 'b' のキーに一致
     するキーが 'a' にないときのみ追加を行います。成功した場合には ‘0’ を
     返し、例外が送出された場合には ‘-1’ を返します。

 -- C の関数: int PyDict_Update (PyObject *a, PyObject *b)
     ' 次に属します: *note Stable ABI: 775.'  C で表せば
     ‘PyDict_Merge(a, b, 1)’ と同じで、また Python の ‘a.update(b)’ と似
     ていますが、 *note PyDict_Update(): 4fc7. は第二引数が "keys" 属性
     を持たない場合にキー/値ペアのシーケンスを反復することはありません。
     成功した場合には ‘0’ を返し、例外が送出された場合には ‘-1’ を返しま
     す。

 -- C の関数: int PyDict_MergeFromSeq2 (PyObject *a, PyObject *seq2, int
          override)
     ' 次に属します: *note Stable ABI: 775.'  'seq2' 内のキー/値ペアを使
     って、辞書 'a' の内容を更新したり統合したりします。'seq2' は、キー
     /値のペアとみなせる長さ 2 の反復可能オブジェクト(iterable object) を
     生成する反復可能オブジェクトでなければなりません。重複するキーが存
     在する場合、'override' が真ならば先に出現したキーを使い、そうでない
     場合は後に出現したキーを使います。成功した場合には ‘0’ を返し、例外
     が送出された場合には ‘-1’ を返します。(戻り値以外は) 等価な Python
     コードを書くと、以下のようになります:

          def PyDict_MergeFromSeq2(a, seq2, override):
              for key, value in seq2:
                  if override or key not in a:
                      a[key] = value

 -- C の関数: int PyDict_AddWatcher (PyDict_WatchCallback callback)

     Register 'callback' as a dictionary watcher.  Return a non-negative
     integer id which must be passed to future calls to *note
     PyDict_Watch(): 784.  In case of error (e.g.  no more watcher IDs
     available), return ‘-1’ and set an exception.

     Added in version 3.12.

 -- C の関数: int PyDict_ClearWatcher (int watcher_id)

     Clear watcher identified by 'watcher_id' previously returned from
     *note PyDict_AddWatcher(): 3d0.  Return ‘0’ on success, ‘-1’ on
     error (e.g.  if the given 'watcher_id' was never registered.)

     Added in version 3.12.

 -- C の関数: int PyDict_Watch (int watcher_id, PyObject *dict)

     Mark dictionary 'dict' as watched.  The callback granted
     'watcher_id' by *note PyDict_AddWatcher(): 3d0. will be called when
     'dict' is modified or deallocated.  Return ‘0’ on success or ‘-1’
     on error.

     Added in version 3.12.

 -- C の関数: int PyDict_Unwatch (int watcher_id, PyObject *dict)

     Mark dictionary 'dict' as no longer watched.  The callback granted
     'watcher_id' by *note PyDict_AddWatcher(): 3d0. will no longer be
     called when 'dict' is modified or deallocated.  The dict must
     previously have been watched by this watcher.  Return ‘0’ on
     success or ‘-1’ on error.

     Added in version 3.12.

 -- C のデータ型: type PyDict_WatchEvent

     Enumeration of possible dictionary watcher events:
     ‘PyDict_EVENT_ADDED’, ‘PyDict_EVENT_MODIFIED’,
     ‘PyDict_EVENT_DELETED’, ‘PyDict_EVENT_CLONED’,
     ‘PyDict_EVENT_CLEARED’, or ‘PyDict_EVENT_DEALLOCATED’.

     Added in version 3.12.

 -- C のデータ型: typedef int (*PyDict_WatchCallback)(*note
          PyDict_WatchEvent: 53ae. event, *note PyObject: 5df. *dict,
          *note PyObject: 5df. *key, *note PyObject: 5df. *new_value)

     Type of a dict watcher callback function.

     If 'event' is ‘PyDict_EVENT_CLEARED’ or ‘PyDict_EVENT_DEALLOCATED’,
     both 'key' and 'new_value' will be ‘NULL’.  If 'event' is
     ‘PyDict_EVENT_ADDED’ or ‘PyDict_EVENT_MODIFIED’, 'new_value' will
     be the new value for 'key'.  If 'event' is ‘PyDict_EVENT_DELETED’,
     'key' is being deleted from the dictionary and 'new_value' will be
     ‘NULL’.

     ‘PyDict_EVENT_CLONED’ occurs when 'dict' was previously empty and
     another dict is merged into it.  To maintain efficiency of this
     operation, per-key ‘PyDict_EVENT_ADDED’ events are not issued in
     this case; instead a single ‘PyDict_EVENT_CLONED’ is issued, and
     'key' will be the source dictionary.

     The callback may inspect but must not modify 'dict'; doing so could
     have unpredictable effects, including infinite recursion.  Do not
     trigger Python code execution in the callback, as it could modify
     the dict as a side effect.

     If 'event' is ‘PyDict_EVENT_DEALLOCATED’, taking a new reference in
     the callback to the about-to-be-destroyed dictionary will resurrect
     it and prevent it from being freed at this time.  When the
     resurrected object is destroyed later, any watcher callbacks active
     at that time will be called again.

     Callbacks occur before the notified modification to 'dict' takes
     place, so the prior state of 'dict' can be inspected.

     If the callback sets an exception, it must return ‘-1’; this
     exception will be printed as an unraisable exception using *note
     PyErr_WriteUnraisable(): 5f2.  Otherwise it should return ‘0’.

     There may already be a pending exception set on entry to the
     callback.  In this case, the callback should return ‘0’ with the
     same exception still set.  This means the callback may not call any
     other API that can set an exception unless it saves and clears the
     exception state first, and restores it before returning.

     Added in version 3.12.

* Menu:

* Dictionary View Objects::
* Ordered Dictionaries::


File: python.info,  Node: Dictionary View Objects,  Next: Ordered Dictionaries,  Up: 辞書オブジェクト dictionary object

7.9.4.2 Dictionary View Objects
...............................

 -- C の関数: int PyDictViewSet_Check (PyObject *op)

     Return true if 'op' is a view of a set inside a dictionary.  This
     is currently equivalent to *note PyDictKeys_Check: 53b2.(*note op:
     53b1.) || *note PyDictItems_Check: 53b3.(*note op: 53b1.).  This
     function always succeeds.

 -- C 変数: *note PyTypeObject: c9c. PyDictKeys_Type
     ' 次に属します: *note Stable ABI: 775.'  Type object for a view of
     dictionary keys.  In Python, this is the type of the object
     returned by *note dict.keys(): 9d0.

 -- C の関数: int PyDictKeys_Check (PyObject *op)

     Return true if 'op' is an instance of a dictionary keys view.  This
     function always succeeds.

 -- C 変数: *note PyTypeObject: c9c. PyDictValues_Type
     ' 次に属します: *note Stable ABI: 775.'  Type object for a view of
     dictionary values.  In Python, this is the type of the object
     returned by *note dict.values(): 9d1.

 -- C の関数: int PyDictValues_Check (PyObject *op)

     Return true if 'op' is an instance of a dictionary values view.
     This function always succeeds.

 -- C 変数: *note PyTypeObject: c9c. PyDictItems_Type
     ' 次に属します: *note Stable ABI: 775.'  Type object for a view of
     dictionary items.  In Python, this is the type of the object
     returned by *note dict.items(): 9d2.

 -- C の関数: int PyDictItems_Check (PyObject *op)

     Return true if 'op' is an instance of a dictionary items view.
     This function always succeeds.


File: python.info,  Node: Ordered Dictionaries,  Prev: Dictionary View Objects,  Up: 辞書オブジェクト dictionary object

7.9.4.3 Ordered Dictionaries
............................

Python's C API provides interface for *note collections.OrderedDict:
7f3. from C. Since Python 3.7, dictionaries are ordered by default, so
there is usually little need for these functions; prefer ‘PyDict*’ where
possible.

 -- C 変数: *note PyTypeObject: c9c. PyODict_Type

     Type object for ordered dictionaries.  This is the same object as
     *note collections.OrderedDict: 7f3. in the Python layer.

 -- C の関数: int PyODict_Check (PyObject *od)

     Return true if 'od' is an ordered dictionary object or an instance
     of a subtype of the *note OrderedDict: 7f3. type.  This function
     always succeeds.

 -- C の関数: int PyODict_CheckExact (PyObject *od)

     Return true if 'od' is an ordered dictionary object, but not an
     instance of a subtype of the *note OrderedDict: 7f3. type.  This
     function always succeeds.

 -- C 変数: *note PyTypeObject: c9c. PyODictKeys_Type

     Analogous to *note PyDictKeys_Type: 4fb6. for ordered dictionaries.

 -- C 変数: *note PyTypeObject: c9c. PyODictValues_Type

     Analogous to *note PyDictValues_Type: 4fbc. for ordered
     dictionaries.

 -- C 変数: *note PyTypeObject: c9c. PyODictItems_Type

     Analogous to *note PyDictItems_Type: 4fb2. for ordered
     dictionaries.

 -- C の関数: *note PyObject: 5df. *PyODict_New (void)

     Return a new empty ordered dictionary, or ‘NULL’ on failure.

     This is analogous to *note PyDict_New(): 4fc4.

 -- C の関数: int PyODict_SetItem (PyObject *od, PyObject *key, PyObject
          *value)

     Insert 'value' into the ordered dictionary 'od' with a key of
     'key'.  Return ‘0’ on success or ‘-1’ with an exception set on
     failure.

     This is analogous to *note PyDict_SetItem(): 4eb9.

 -- C の関数: int PyODict_DelItem (PyObject *od, PyObject *key)

     Remove the entry in the ordered dictionary 'od' with key 'key'.
     Return ‘0’ on success or ‘-1’ with an exception set on failure.

     This is analogous to *note PyDict_DelItem(): 4fbe.

These are *note soft deprecated: 23d. aliases to ‘PyDict’ APIs:

‘PyODict’                                              ‘PyDict’
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
 -- C のマクロ: PyODict_GetItem (od, key)              *note PyDict_GetItem(): 628.
                                                       
                                                       
 -- C のマクロ: PyODict_GetItemWithError (od, key)     *note PyDict_GetItemWithError(): 5e1.
                                                       
                                                       
 -- C のマクロ: PyODict_GetItemString (od, key)        *note PyDict_GetItemString(): 629.
                                                       
                                                       
 -- C のマクロ: PyODict_Contains (od, key)             *note PyDict_Contains(): 5de.
                                                       
                                                       
 -- C のマクロ: PyODict_Size (od)                      *note PyDict_Size(): 4fc5.
                                                       
                                                       
 -- C のマクロ: PyODict_SIZE (od)                      *note PyDict_GET_SIZE(): 53aa.
                                                       


File: python.info,  Node: Set オブジェクト,  Prev: 辞書オブジェクト dictionary object,  Up: Container オブジェクト

7.9.4.4 Set オブジェクト
........................

このセクションでは *note set: 184. と *note frozenset: 7f2. の公開 API に
ついて詳しく述べます。以降で説明していない機能は、抽象オブジェクトプロト
コル (*note PyObject_CallMethod(): 640, *note
PyObject_RichCompareBool(): 1d8c, *note PyObject_Hash(): 436, *note
PyObject_Repr(): 1230, *note PyObject_IsTrue(): 5093, *note
PyObject_Print(): 198b, *note PyObject_GetIter(): 5092. を含む) か抽象数
値プロトコル (*note PyNumber_And(): 5066, *note PyNumber_Subtract():
507f, *note PyNumber_Or(): 507a, *note PyNumber_Xor(): 5081, *note
PyNumber_InPlaceAnd(): 506b, *note PyNumber_InPlaceSubtract(): 5073,
*note PyNumber_InPlaceOr(): 506f, *note PyNumber_InPlaceXor(): 5075. を
含む) を使って利用できます。

 -- C のデータ型: type PySetObject

     この *note PyObject: 5df. を継承した型は、 *note set: 184. と *note
     frozenset: 7f2. 両方の内部データを保存するのに用いられます。 *note
     PyDictObject: 64f. と同じように、小さい集合(set)に対しては(タプルの
     ように)固定サイズであり、そうでない集合に対しては(リストと同じよう
     に)可変長のメモリブロックを用います。この構造体のどのフィールドも、
     公開されていると考えるべきではなく、変更される可能性があります。す
     べてのアクセスは、構造体の中の値を直接操作するのではなく、ドキュメ
     ントされた API を用いて行うべきです。

 -- C 変数: *note PyTypeObject: c9c. PySet_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     c9c. のインスタンスは、Python の *note set: 184. 型を表します。

 -- C 変数: *note PyTypeObject: c9c. PyFrozenSet_Type
     ' 次に属します: *note Stable ABI: 775.'  この *note PyTypeObject:
     c9c. のインスタンスは、Python の *note frozenset: 7f2. 型を表します
     。

以降の型チェックマクロはすべての Python オブジェクトに対するポインタに対
して動作します。同様に、コンストラクタはすべてのイテレート可能な Python
オブジェクトに対して動作します。

 -- C の関数: int PySet_Check (PyObject *p)

     'p' が *note set: 184. かそのサブタイプのオブジェクトであるときに
     true を返します。この関数は常に成功します。

 -- C の関数: int PyFrozenSet_Check (PyObject *p)

     'p' が *note frozenset: 7f2. かそのサブタイプのオブジェクトであると
     きに true を返します。この関数は常に成功します。

 -- C の関数: int PyAnySet_Check (PyObject *p)

     'p' が *note set: 184. か *note frozenset: 7f2. 、あるいはそのサブ
     タイプのオブジェクトであれば、true を返します。この関数は常に成功し
     ます。

 -- C の関数: int PySet_CheckExact (PyObject *p)

     'p' が *note set: 184. オブジェクトだがサブタイプのインスタンスでな
     い場合に真を返します。この関数は常に成功します。

     Added in version 3.10.

 -- C の関数: int PyAnySet_CheckExact (PyObject *p)

     'p' が *note set: 184. か *note frozenset: 7f2. のどちらかのオブジ
     ェクトであるときに true を返します。サブタイプのオブジェクトは含み
     ません。この関数は常に成功します。

 -- C の関数: int PyFrozenSet_CheckExact (PyObject *p)

     'p' が *note frozenset: 7f2. オブジェクトだがサブタイプのインスタン
     スでない場合に真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PySet_New (PyObject *iterable)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'iterable' が返すオブジェクトを含む新しい *note set: 184. を返しま
     す。 'iterable' が ‘NULL’ のときは、空の set を返します。 成功した
     ら新しい set を、失敗したら ‘NULL’ を返します。 'iterable' がイテレ
     ート可能でない場合は、 *note TypeError: 198. を送出します。 このコ
     ンストラクタは set をコピーするときにも使えます (‘c=set(s)’)。

 -- C の関数: *note PyObject: 5df. *PyFrozenSet_New (PyObject *iterable)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'iterable' が返すオブジェクトを含む新しい *note frozenset: 7f2. を
     返します。 'iterable' が ‘NULL’ のときは、空の frozenset を返します
     。 成功時には新しい set を、失敗時には ‘NULL’ を返します。
     'iterable' がイテレート可能でない場合は、 *note TypeError: 198. を
     送出します。

以降の関数やマクロは、 *note set: 184. と *note frozenset: 7f2. とそのサ
ブタイプのインスタンスに対して利用できます。

 -- C の関数: *note Py_ssize_t: c55. PySet_Size (PyObject *anyset)
     ' 次に属します: *note Stable ABI: 775.'

     Return the length of a *note set: 184. or *note frozenset: 7f2.
     object.  Equivalent to ‘len(anyset)’.  Raises a *note SystemError:
     795. if 'anyset' is not a *note set: 184, *note frozenset: 7f2, or
     an instance of a subtype.

 -- C の関数: *note Py_ssize_t: c55. PySet_GET_SIZE (PyObject *anyset)

     エラーチェックを行わない、 *note PySet_Size(): 1662. のマクロ形式。

 -- C の関数: int PySet_Contains (PyObject *anyset, PyObject *key)
     ' 次に属します: *note Stable ABI: 775.'  Return ‘1’ if found, ‘0’
     if not found, and ‘-1’ if an error is encountered.  Unlike the
     Python *note __contains__(): 15d3. method, this function does not
     automatically convert unhashable sets into temporary frozensets.
     Raise a *note TypeError: 198. if the 'key' is unhashable.  Raise
     *note SystemError: 795. if 'anyset' is not a *note set: 184, *note
     frozenset: 7f2, or an instance of a subtype.

 -- C の関数: int PySet_Add (PyObject *set, PyObject *key)
     ' 次に属します: *note Stable ABI: 775.'  *note set: 184. のインスタ
     ンスに 'key' を追加します。 *note frozenset: 7f2. に対しても動作し
     ます (*note PyTuple_SetItem(): 4eb8. のように、他のコードに見える前
     の新しい frozenset の値を埋めるために使用できます)。 成功したら ‘0’
     を、失敗したら ‘-1’ を返します。 'key' がハッシュ可能でない場合は、
     *note TypeError: 198. を送出します。 'set' を大きくする余裕がない場
     合は、 *note MemoryError: 179e. を送出します。 'set' が *note set:
     184. かそのサブタイプのインスタンスでない場合は、 *note
     SystemError: 795. を送出します。

以降の関数は、 *note set: 184. とそのサブタイプに対して利用可能です。
*note frozenset: 7f2. とそのサブタイプには利用できません。

 -- C の関数: int PySet_Discard (PyObject *set, PyObject *key)
     ' 次に属します: *note Stable ABI: 775.'  Return ‘1’ if found and
     removed, ‘0’ if not found (no action taken), and ‘-1’ if an error
     is encountered.  Does not raise *note KeyError: 5e7. for missing
     keys.  Raise a *note TypeError: 198. if the 'key' is unhashable.
     Unlike the Python *note discard(): 26a0. method, this function does
     not automatically convert unhashable sets into temporary
     frozensets.  Raise *note SystemError: 795. if 'set' is not an
     instance of *note set: 184. or its subtype.

 -- C の関数: *note PyObject: 5df. *PySet_Pop (PyObject *set)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'set' の中の要素のどれかに対する新しい参照を返し、そのオブジェクト
     を 'set' から削除します。 失敗したら ‘NULL’ を返します。 set が空の
     場合には *note KeyError: 5e7. を送出します。 'set' が *note set:
     184. とそのサブタイプのインスタンスでない場合は、 *note
     SystemError: 795. を送出します。

 -- C の関数: int PySet_Clear (PyObject *set)
     ' 次に属します: *note Stable ABI: 775.'  Empty an existing set of
     all elements.  Return ‘0’ on success.  Return ‘-1’ and raise *note
     SystemError: 795. if 'set' is not an instance of *note set: 184. or
     its subtype.

* Menu:

* Deprecated API: Deprecated API<3>.


File: python.info,  Node: Deprecated API<3>,  Up: Set オブジェクト

7.9.4.5 Deprecated API
......................

 -- C のマクロ: PySet_MINSIZE

     A *note soft deprecated: 23d. constant representing the size of an
     internal preallocated table inside *note PySetObject: 53c9.
     instances.

     This is documented solely for completeness, as there are no
     guarantees that a given version of CPython uses preallocated tables
     with a fixed size.  In code that does not deal with unstable set
     internals, ‘PySet_MINSIZE’ can be replaced with a small constant
     like ‘8’.

     If looking for the size of a set, use *note PySet_Size(): 1662.
     instead.


File: python.info,  Node: Function オブジェクト<2>,  Next: その他のオブジェクト<2>,  Prev: Container オブジェクト,  Up: 具象オブジェクト concrete object レイヤ

7.9.5 Function オブジェクト
---------------------------

* Menu:

* Function オブジェクト: Function オブジェクト<3>.
* インスタンスメソッドオブジェクト(Instance Method Objects): インスタンスメソッドオブジェクト Instance Method Objects.
* メソッドオブジェクト: メソッドオブジェクト<2>.
* セルオブジェクト (cell object): セルオブジェクト cell object.
* コードオブジェクト: コードオブジェクト<3>.
* Code Object Flags::
* Extra information::


File: python.info,  Node: Function オブジェクト<3>,  Next: インスタンスメソッドオブジェクト Instance Method Objects,  Up: Function オブジェクト<2>

7.9.5.1 Function オブジェクト
.............................

Functionオブジェクト固有の関数はわずかです。

 -- C のデータ型: type PyFunctionObject

     関数に使われるCの構造体。

 -- C 変数: *note PyTypeObject: c9c. PyFunction_Type

     *note PyTypeObject: c9c. 型のインスタンスで、 Python の関数型を表し
     ます。これは Python プログラムに ‘types.FunctionType’ として公開さ
     れています。

 -- C の関数: int PyFunction_Check (PyObject *o)

     'o' が関数オブジェクト (*note PyFunction_Type: 53d7. 型である) 場合
     に真を返します。パラメータは ‘NULL’ にできません。この関数は常に成
     功します。

 -- C の関数: *note PyObject: 5df. *PyFunction_New (PyObject *code,
          PyObject *globals)
     '戻り値: 新しい参照。' コードオブジェクト 'code' に関連付けられた新
     しい関数オブジェクトを返します。'globals' はこの関数からアクセスで
     きるグローバル変数の辞書でなければなりません。

     関数のドキュメント文字列と名前はコードオブジェクトから取得されます
     。 *note __module__: 234a. は 'globals' から取得されます。 引数のデ
     フォルト値やアノテーション、クロージャは ‘NULL’ に設定されます。
     *note __qualname__: 2349. はコードオブジェクトの *note co_qualname:
     2386. フィールドと同じ値に設定されます。

 -- C の関数: *note PyObject: 5df. *PyFunction_NewWithQualName (PyObject
          *code, PyObject *globals, PyObject *qualname)
     '戻り値: 新しい参照。' *note PyFunction_New(): 53d9. に似ていますが
     、関数オブジェクトの *note __qualname__: 2349. 属性に値をセットでき
     ます。 'qualname' はユニコードオブジェクトか ‘NULL’ でなくてはなり
     ません。‘NULL’ だった場合、 ‘__qualname__’ 属性にはコードオブジェク
     トの *note co_qualname: 2386. フィールドと同じ値がセットされます。

     Added in version 3.3.

 -- C の関数: *note PyObject: 5df. *PyFunction_GetCode (PyObject *op)
     '戻り値: 借用参照。' 関数オブジェクト 'op' に関連付けられたコードオ
     ブジェクトを返します。

 -- C の関数: *note PyObject: 5df. *PyFunction_GetGlobals (PyObject *op)
     '戻り値: 借用参照。' 関数オブジェクト 'op' に関連付けられた
     globals辞書を返します。

 -- C の関数: *note PyObject: 5df. *PyFunction_GetModule (PyObject *op)
     '戻り値: 借用参照。' Return a *note borrowed reference: 3d7. to the
     *note __module__: 234a. attribute of the *note function object:
     59c. 'op'.  It can be 'NULL'.

     This is normally a *note string: 169. containing the module name,
     but can be set to any other object by Python code.

 -- C の関数: *note PyObject: 5df. *PyFunction_GetDefaults (PyObject
          *op)
     '戻り値: 借用参照。' 関数オブジェクト 'op' の引数のデフォルト値を返
     します。 引数のタプルか ‘NULL’ になります。

 -- C の関数: int PyFunction_SetDefaults (PyObject *op, PyObject
          *defaults)

     関数オブジェクト 'op' の引数のデフォルト値を設定します。 'defaults'
     は ‘Py_None’ かタプルでなければいけません。

     失敗した時は、 *note SystemError: 795. を発生させ、 ‘-1’ を返します
     。

 -- C の関数: void PyFunction_SetVectorcall (PyFunctionObject *func,
          vectorcallfunc vectorcall)

     Set the vectorcall field of a given function object 'func'.

     Warning: extensions using this API must preserve the behavior of
     the unaltered (default) vectorcall function!

     Added in version 3.12.

 -- C の関数: *note PyObject: 5df. *PyFunction_GetKwDefaults (PyObject
          *op)
     '戻り値: 借用参照。' Return the keyword-only argument default
     values of the function object 'op'.  This can be a dictionary of
     arguments or ‘NULL’.

 -- C の関数: int PyFunction_SetKwDefaults (PyObject *op, PyObject
          *defaults)

     Set the keyword-only argument default values of the function object
     'op'.  'defaults' must be a dictionary of keyword-only arguments or
     ‘Py_None’.

     This function returns ‘0’ on success, and returns ‘-1’ with an
     exception set on failure.

 -- C の関数: *note PyObject: 5df. *PyFunction_GetClosure (PyObject *op)
     '戻り値: 借用参照。' 関数オブジェクト 'op' に設定されたクロージャを
     返します。 ‘NULL’ か cell オブジェクトのタプルです。

 -- C の関数: int PyFunction_SetClosure (PyObject *op, PyObject
          *closure)

     関数オブジェクト 'op' にクロージャを設定します。 'closure' は、
     ‘Py_None’ もしくは cell オブジェクトのタプルでなければなりません。

     失敗した時は、 *note SystemError: 795. を発生させ、 ‘-1’ を返します
     。

 -- C の関数: *note PyObject: 5df. *PyFunction_GetAnnotations (PyObject
          *op)
     '戻り値: 借用参照。' 関数オブジェクト 'op' のアノテーションを返しま
     す。 返り値は修正可能な辞書か ‘NULL’ になります。

 -- C の関数: int PyFunction_SetAnnotations (PyObject *op, PyObject
          *annotations)

     関数オブジェクト 'op' のアノテーションを設定します。 'annotations'
     は辞書か、‘Py_None’ でなければなりません。

     失敗した時は、 *note SystemError: 795. を発生させ、 ‘-1’ を返します
     。

 -- C の関数: *note PyObject: 5df. *PyFunction_GET_CODE (PyObject *op)
 -- C の関数: *note PyObject: 5df. *PyFunction_GET_GLOBALS (PyObject
          *op)
 -- C の関数: *note PyObject: 5df. *PyFunction_GET_MODULE (PyObject *op)
 -- C の関数: *note PyObject: 5df. *PyFunction_GET_DEFAULTS (PyObject
          *op)
 -- C の関数: *note PyObject: 5df. *PyFunction_GET_KW_DEFAULTS (PyObject
          *op)
 -- C の関数: *note PyObject: 5df. *PyFunction_GET_CLOSURE (PyObject
          *op)
 -- C の関数: *note PyObject: 5df. *PyFunction_GET_ANNOTATIONS (PyObject
          *op)
     '戻り値: 借用参照。' These functions are similar to their
     ‘PyFunction_Get*’ counterparts, but do not do type checking.
     Passing anything other than an instance of *note PyFunction_Type:
     53d7. is undefined behavior.

 -- C の関数: int PyFunction_AddWatcher (PyFunction_WatchCallback
          callback)

     Register 'callback' as a function watcher for the current
     interpreter.  Return an ID which may be passed to *note
     PyFunction_ClearWatcher(): 53ed.  In case of error (e.g.  no more
     watcher IDs available), return ‘-1’ and set an exception.

     Added in version 3.12.

 -- C の関数: int PyFunction_ClearWatcher (int watcher_id)

     Clear watcher identified by 'watcher_id' previously returned from
     *note PyFunction_AddWatcher(): 53ec. for the current interpreter.
     Return ‘0’ on success, or ‘-1’ and set an exception on error (e.g.
     if the given 'watcher_id' was never registered.)

     Added in version 3.12.

 -- C のデータ型: type PyFunction_WatchEvent

          Enumeration of possible function watcher events:

             - ‘PyFunction_EVENT_CREATE’

             - ‘PyFunction_EVENT_DESTROY’

             - ‘PyFunction_EVENT_MODIFY_CODE’

             - ‘PyFunction_EVENT_MODIFY_DEFAULTS’

             - ‘PyFunction_EVENT_MODIFY_KWDEFAULTS’

     Added in version 3.12.

 -- C のデータ型: typedef int (*PyFunction_WatchCallback)(*note
          PyFunction_WatchEvent: 53ee. event, *note PyFunctionObject:
          783. *func, *note PyObject: 5df. *new_value)

     Type of a function watcher callback function.

     If 'event' is ‘PyFunction_EVENT_CREATE’ or
     ‘PyFunction_EVENT_DESTROY’ then 'new_value' will be ‘NULL’.
     Otherwise, 'new_value' will hold a *note borrowed reference: 3d7.
     to the new value that is about to be stored in 'func' for the
     attribute that is being modified.

     The callback may inspect but must not modify 'func'; doing so could
     have unpredictable effects, including infinite recursion.

     If 'event' is ‘PyFunction_EVENT_CREATE’, then the callback is
     invoked after 'func' has been fully initialized.  Otherwise, the
     callback is invoked before the modification to 'func' takes place,
     so the prior state of 'func' can be inspected.  The runtime is
     permitted to optimize away the creation of function objects when
     possible.  In such cases no event will be emitted.  Although this
     creates the possibility of an observable difference of runtime
     behavior depending on optimization decisions, it does not change
     the semantics of the Python code being executed.

     If 'event' is ‘PyFunction_EVENT_DESTROY’, Taking a reference in the
     callback to the about-to-be-destroyed function will resurrect it,
     preventing it from being freed at this time.  When the resurrected
     object is destroyed later, any watcher callbacks active at that
     time will be called again.

     If the callback sets an exception, it must return ‘-1’; this
     exception will be printed as an unraisable exception using *note
     PyErr_WriteUnraisable(): 5f2.  Otherwise it should return ‘0’.

     There may already be a pending exception set on entry to the
     callback.  In this case, the callback should return ‘0’ with the
     same exception still set.  This means the callback may not call any
     other API that can set an exception unless it saves and clears the
     exception state first, and restores it before returning.

     Added in version 3.12.


File: python.info,  Node: インスタンスメソッドオブジェクト Instance Method Objects,  Next: メソッドオブジェクト<2>,  Prev: Function オブジェクト<3>,  Up: Function オブジェクト<2>

7.9.5.2 インスタンスメソッドオブジェクト(Instance Method Objects)
.................................................................

An instance method is a wrapper for a *note PyCFunction: 1691. and the
new way to bind a *note PyCFunction: 1691. to a class object.  It
replaces the former call ‘PyMethod_New(func, NULL, class)’.

 -- C 変数: *note PyTypeObject: c9c. PyInstanceMethod_Type

     *note PyTypeObject: c9c. のインスタンスは Python のインスタンスメソ
     ッドの型を表現します。これは Python のプログラムには公開されません
     。

 -- C の関数: int PyInstanceMethod_Check (PyObject *o)

     'o' がインスタンスメソッドオブジェクト (*note
     PyInstanceMethod_Type: 53f4. 型である) 場合に真を返します。パラメー
     タは ‘NULL’ にできません。この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyInstanceMethod_New (PyObject
          *func)
     '戻り値: 新しい参照。' 任意の呼び出し可能オブジェクト 'func' を使っ
     た新たなインスタンスメソッドオブジェクトを返します。'func' はインス
     タンスメソッドが呼び出されたときに呼び出される関数です。

 -- C の関数: *note PyObject: 5df. *PyInstanceMethod_Function (PyObject
          *im)
     '戻り値: 借用参照。' インスタンスメソッド 'im' に関連付けられた関数
     オブジェクトを返します。

 -- C の関数: *note PyObject: 5df. *PyInstanceMethod_GET_FUNCTION
          (PyObject *im)
     '戻り値: 借用参照。' *note PyInstanceMethod_Function(): 53f7. のマ
     クロ版で、エラーチェックを行いません。


File: python.info,  Node: メソッドオブジェクト<2>,  Next: セルオブジェクト cell object,  Prev: インスタンスメソッドオブジェクト Instance Method Objects,  Up: Function オブジェクト<2>

7.9.5.3 メソッドオブジェクト
............................

メソッドは関数オブジェクトに束縛されています。メソッドは常にあるユーザー
定義のクラスに束縛されているのです。束縛されていないメソッド(クラスオブ
ジェクトに束縛されたメソッド)は利用することができません。

 -- C 変数: *note PyTypeObject: c9c. PyMethod_Type

     この *note PyTypeObject: c9c. のインスタンスは Python のメソッド型
     を表現します。このオブジェクトは、 ‘types.MethodType’ として Python
     プログラムに公開されています。

 -- C の関数: int PyMethod_Check (PyObject *o)

     'o' がメソッドオブジェクト (*note PyMethod_Type: 53fb. 型である) 場
     合に真を返します。パラメータは ‘NULL’ にできません。この関数は常に
     成功します。

 -- C の関数: *note PyObject: 5df. *PyMethod_New (PyObject *func,
          PyObject *self)
     '戻り値: 新しい参照。' 任意の呼び出し可能オブジェクト 'func' とメソ
     ッドが束縛されるべきインスタンス 'self' を使った新たなメソッドオブ
     ジェクトを返します。 関数 'func' は、メソッドが呼び出された時に呼び
     出されるオブジェクトです。 'self' は ‘NULL’ にできません。

 -- C の関数: *note PyObject: 5df. *PyMethod_Function (PyObject *meth)
     '戻り値: 借用参照。' メソッド 'meth' に関連付けられている関数オブジ
     ェクトを返します。

 -- C の関数: *note PyObject: 5df. *PyMethod_GET_FUNCTION (PyObject
          *meth)
     '戻り値: 借用参照。' *note PyMethod_Function(): 53fe. のマクロ版で
     、エラーチェックを行いません。

 -- C の関数: *note PyObject: 5df. *PyMethod_Self (PyObject *meth)
     '戻り値: 借用参照。' メソッド 'meth' に関連付けられたインスタンスを
     返します。

 -- C の関数: *note PyObject: 5df. *PyMethod_GET_SELF (PyObject *meth)
     '戻り値: 借用参照。' *note PyMethod_Self(): 5400. のマクロ版で、エ
     ラーチェックを行いません。


File: python.info,  Node: セルオブジェクト cell object,  Next: コードオブジェクト<3>,  Prev: メソッドオブジェクト<2>,  Up: Function オブジェクト<2>

7.9.5.4 セルオブジェクト (cell object)
......................................

"Cell" objects are used to implement variables referenced by multiple
scopes.  For each such variable, a cell object is created to store the
value; the local variables of each stack frame that references the value
contain a reference to the cells from outer scopes which also use that
variable.  When the value is accessed, the value contained in the cell
is used instead of the cell object itself.  This de-referencing of the
cell object requires support from the generated byte-code; these are not
automatically de-referenced when accessed.  Cell objects are not likely
to be useful elsewhere.

 -- C のデータ型: type PyCellObject

     セルオブジェクトに使われる C 構造体です。

 -- C 変数: *note PyTypeObject: c9c. PyCell_Type

     セルオブジェクトに対応する型オブジェクトです。

 -- C の関数: int PyCell_Check (PyObject *ob)

     'ob' がセルオブジェクトの場合に真を返します; 'ob' は ‘NULL’ であっ
     てはなりません。この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyCell_New (PyObject *ob)
     '戻り値: 新しい参照。' 値 'ob' の入った新たなセルオブジェクトを生成
     して返します。 引数を ‘NULL’ にしてもかまいません。

 -- C の関数: *note PyObject: 5df. *PyCell_Get (PyObject *cell)
     '戻り値: 新しい参照。' Return the contents of the cell 'cell',
     which can be ‘NULL’.  If 'cell' is not a cell object, returns
     ‘NULL’ with an exception set.

 -- C の関数: *note PyObject: 5df. *PyCell_GET (PyObject *cell)
     '戻り値: 借用参照。' 'cell' の内容を返しますが、'cell' が非 ‘NULL’
     かつセルオブジェクトであるかどうかはチェックしません。

 -- C の関数: int PyCell_Set (PyObject *cell, PyObject *value)

     Set the contents of the cell object 'cell' to 'value'.  This
     releases the reference to any current content of the cell.  'value'
     may be ‘NULL’.  'cell' must be non-‘NULL’.

     On success, return ‘0’.  If 'cell' is not a cell object, set an
     exception and return ‘-1’.

 -- C の関数: void PyCell_SET (PyObject *cell, PyObject *value)

     セルオブジェクト 'cell' の値を 'value' に設定します。 参照カウント
     に対する変更はなく、安全のためのチェックは何も行いません。'cell' は
     非 ‘NULL’ でなければならず、かつセルオブジェクトでなければなりませ
     ん。


File: python.info,  Node: コードオブジェクト<3>,  Next: Code Object Flags,  Prev: セルオブジェクト cell object,  Up: Function オブジェクト<2>

7.9.5.5 コードオブジェクト
..........................

コードオブジェクト(Code objects)は CPython 実装の低レベルな詳細部分です
。各オブジェクトは関数に束縛されていない実行可能コードの塊を表現していま
す。

 -- C のデータ型: type PyCodeObject

     コードオブジェクトを表現するために利用されるC構造体。この型のフィー
     ルドは何時でも変更され得ます。

 -- C 変数: *note PyTypeObject: c9c. PyCode_Type

     This is an instance of *note PyTypeObject: c9c. representing the
     Python *note code object: 4e6.

 -- C の関数: int PyCode_Check (PyObject *co)

     Return true if 'co' is a *note code object: 4e6.  This function
     always succeeds.

 -- C の関数: *note Py_ssize_t: c55. PyCode_GetNumFree (PyCodeObject
          *co)

     Return the number of *note free (closure) variables: 1893. in a
     code object.

 -- C の関数: int PyUnstable_Code_GetFirstFree (PyCodeObject *co)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Return the position of the first *note free (closure) variable:
     1893. in a code object.

     バージョン 3.13 で変更: Renamed from ‘PyCode_GetFirstFree’ as part
     of *note Unstable C API: 769.  The old name is deprecated, but will
     remain available until the signature changes again.

 -- C の関数: *note PyCodeObject: 97b. *PyUnstable_Code_New (int
          argcount, int kwonlyargcount, int nlocals, int stacksize, int
          flags, PyObject *code, PyObject *consts, PyObject *names,
          PyObject *varnames, PyObject *freevars, PyObject *cellvars,
          PyObject *filename, PyObject *name, PyObject *qualname, int
          firstlineno, PyObject *linetable, PyObject *exceptiontable)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Return a new code object.  If you need a dummy code object to
     create a frame, use *note PyCode_NewEmpty(): 1568. instead.

     Since the definition of the bytecode changes often, calling *note
     PyUnstable_Code_New(): 5412. directly can bind you to a precise
     Python version.

     The many arguments of this function are inter-dependent in complex
     ways, meaning that subtle changes to values are likely to result in
     incorrect execution or VM crashes.  Use this function only with
     extreme care.

     バージョン 3.11 で変更: Added ‘qualname’ and ‘exceptiontable’
     parameters.

     バージョン 3.12 で変更: Renamed from ‘PyCode_New’ as part of *note
     Unstable C API: 769.  The old name is deprecated, but will remain
     available until the signature changes again.

 -- C の関数: *note PyCodeObject: 97b.
          *PyUnstable_Code_NewWithPosOnlyArgs (int argcount, int
          posonlyargcount, int kwonlyargcount, int nlocals, int
          stacksize, int flags, PyObject *code, PyObject *consts,
          PyObject *names, PyObject *varnames, PyObject *freevars,
          PyObject *cellvars, PyObject *filename, PyObject *name,
          PyObject *qualname, int firstlineno, PyObject *linetable,
          PyObject *exceptiontable)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Similar to *note PyUnstable_Code_New(): 5412, but with an extra
     "posonlyargcount" for positional-only arguments.  The same caveats
     that apply to ‘PyUnstable_Code_New’ also apply to this function.

     Added in version 3.8: as ‘PyCode_NewWithPosOnlyArgs’

     バージョン 3.11 で変更: Added ‘qualname’ and ‘exceptiontable’
     parameters.

     バージョン 3.12 で変更: Renamed to
     ‘PyUnstable_Code_NewWithPosOnlyArgs’.  The old name is deprecated,
     but will remain available until the signature changes again.

 -- C の関数: *note PyCodeObject: 97b. *PyCode_NewEmpty (const char
          *filename, const char *funcname, int firstlineno)
     '戻り値: 新しい参照。' Return a new empty code object with the
     specified filename, function name, and first line number.  The
     resulting code object will raise an ‘Exception’ if executed.

 -- C の関数: int PyCode_Addr2Line (PyCodeObject *co, int byte_offset)

     Return the line number of the instruction that occurs on or before
     ‘byte_offset’ and ends after it.  If you just need the line number
     of a frame, use *note PyFrame_GetLineNumber(): 98e. instead.

     For efficiently iterating over the line numbers in a code object,
     use the API described in PEP 626(1).

 -- C の関数: int PyCode_Addr2Location (PyObject *co, int byte_offset,
          int *start_line, int *start_column, int *end_line, int
          *end_column)

     Sets the passed ‘int’ pointers to the source code line and column
     numbers for the instruction at ‘byte_offset’.  Sets the value to
     ‘0’ when information is not available for any particular element.

     Returns ‘1’ if the function succeeds and 0 otherwise.

     Added in version 3.11.

 -- C の関数: *note PyObject: 5df. *PyCode_GetCode (PyCodeObject *co)

     Equivalent to the Python code ‘getattr(co, 'co_code')’.  Returns a
     strong reference to a *note PyBytesObject: 995. representing the
     bytecode in a code object.  On error, ‘NULL’ is returned and an
     exception is raised.

     This ‘PyBytesObject’ may be created on-demand by the interpreter
     and does not necessarily represent the bytecode actually executed
     by CPython.  The primary use case for this function is debuggers
     and profilers.

     Added in version 3.11.

 -- C の関数: *note PyObject: 5df. *PyCode_GetVarnames (PyCodeObject
          *co)

     Equivalent to the Python code ‘getattr(co, 'co_varnames')’.
     Returns a new reference to a *note PyTupleObject: 5224. containing
     the names of the local variables.  On error, ‘NULL’ is returned and
     an exception is raised.

     Added in version 3.11.

 -- C の関数: *note PyObject: 5df. *PyCode_GetCellvars (PyCodeObject
          *co)

     Equivalent to the Python code ‘getattr(co, 'co_cellvars')’.
     Returns a new reference to a *note PyTupleObject: 5224. containing
     the names of the local variables that are referenced by nested
     functions.  On error, ‘NULL’ is returned and an exception is
     raised.

     Added in version 3.11.

 -- C の関数: *note PyObject: 5df. *PyCode_GetFreevars (PyCodeObject
          *co)

     Equivalent to the Python code ‘getattr(co, 'co_freevars')’.
     Returns a new reference to a *note PyTupleObject: 5224. containing
     the names of the *note free (closure) variables: 1893.  On error,
     ‘NULL’ is returned and an exception is raised.

     Added in version 3.11.

 -- C の関数: int PyCode_AddWatcher (PyCode_WatchCallback callback)

     Register 'callback' as a code object watcher for the current
     interpreter.  Return an ID which may be passed to *note
     PyCode_ClearWatcher(): 788.  In case of error (e.g.  no more
     watcher IDs available), return ‘-1’ and set an exception.

     Added in version 3.12.

 -- C の関数: int PyCode_ClearWatcher (int watcher_id)

     Clear watcher identified by 'watcher_id' previously returned from
     *note PyCode_AddWatcher(): 787. for the current interpreter.
     Return ‘0’ on success, or ‘-1’ and set an exception on error (e.g.
     if the given 'watcher_id' was never registered.)

     Added in version 3.12.

 -- C のデータ型: type PyCodeEvent

     Enumeration of possible code object watcher events: -
     ‘PY_CODE_EVENT_CREATE’ - ‘PY_CODE_EVENT_DESTROY’

     Added in version 3.12.

 -- C のデータ型: typedef int (*PyCode_WatchCallback)(*note PyCodeEvent:
          5415. event, *note PyCodeObject: 97b. *co)

     Type of a code object watcher callback function.

     If 'event' is ‘PY_CODE_EVENT_CREATE’, then the callback is invoked
     after 'co' has been fully initialized.  Otherwise, the callback is
     invoked before the destruction of 'co' takes place, so the prior
     state of 'co' can be inspected.

     If 'event' is ‘PY_CODE_EVENT_DESTROY’, taking a reference in the
     callback to the about-to-be-destroyed code object will resurrect it
     and prevent it from being freed at this time.  When the resurrected
     object is destroyed later, any watcher callbacks active at that
     time will be called again.

     Users of this API should not rely on internal runtime
     implementation details.  Such details may include, but are not
     limited to, the exact order and timing of creation and destruction
     of code objects.  While changes in these details may result in
     differences observable by watchers (including whether a callback is
     invoked or not), it does not change the semantics of the Python
     code being executed.

     If the callback sets an exception, it must return ‘-1’; this
     exception will be printed as an unraisable exception using *note
     PyErr_WriteUnraisable(): 5f2.  Otherwise it should return ‘0’.

     There may already be a pending exception set on entry to the
     callback.  In this case, the callback should return ‘0’ with the
     same exception still set.  This means the callback may not call any
     other API that can set an exception unless it saves and clears the
     exception state first, and restores it before returning.

     Added in version 3.12.

 -- C の関数: *note PyObject: 5df. *PyCode_Optimize (PyObject *code,
          PyObject *consts, PyObject *names, PyObject *lnotab_obj)

     This is a *note soft deprecated: 23d. function that does nothing.

     Prior to Python 3.10, this function would perform basic
     optimizations to a code object.

     バージョン 3.10 で変更: This function now does nothing.

   ---------- Footnotes ----------

   (1) 
https://peps.python.org/pep-0626/#out-of-process-debuggers-and-profilers


File: python.info,  Node: Code Object Flags,  Next: Extra information,  Prev: コードオブジェクト<3>,  Up: Function オブジェクト<2>

7.9.5.6 Code Object Flags
.........................

Code objects contain a bit-field of flags, which can be retrieved as the
*note co_flags: 18db. Python attribute (for example using *note
PyObject_GetAttrString(): 5ef.), and set using a 'flags' argument to
*note PyUnstable_Code_New(): 5412. and similar functions.

Flags whose names start with ‘CO_FUTURE_’ correspond to features
normally selectable by *note future statements: 45d.  These flags can be
used in *note PyCompilerFlags.cf_flags: 51da.  Note that many
‘CO_FUTURE_’ flags are mandatory in current versions of Python, and
setting them has no effect.

The following flags are available.  For their meaning, see the linked
documentation of their Python equivalents.

Flag                                                   意味
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
 -- C のマクロ: CO_OPTIMIZED                           *note inspect.CO_OPTIMIZED: 4a53.
                                                       
                                                       
 -- C のマクロ: CO_NEWLOCALS                           *note inspect.CO_NEWLOCALS: 4a54.
                                                       
                                                       
 -- C のマクロ: CO_VARARGS                             *note inspect.CO_VARARGS: 4a55.
                                                       
                                                       
 -- C のマクロ: CO_VARKEYWORDS                         *note inspect.CO_VARKEYWORDS: 4a56.
                                                       
                                                       
 -- C のマクロ: CO_NESTED                              *note inspect.CO_NESTED: 4a57.
                                                       
                                                       
 -- C のマクロ: CO_GENERATOR                           *note inspect.CO_GENERATOR: 4a58.
                                                       
                                                       
 -- C のマクロ: CO_COROUTINE                           *note inspect.CO_COROUTINE: 4a59.
                                                       
                                                       
 -- C のマクロ: CO_ITERABLE_COROUTINE                  *note inspect.CO_ITERABLE_COROUTINE: 4a5a.
                                                       
                                                       
 -- C のマクロ: CO_ASYNC_GENERATOR                     *note inspect.CO_ASYNC_GENERATOR: 4a5b.
                                                       
                                                       
 -- C のマクロ: CO_HAS_DOCSTRING                       *note inspect.CO_HAS_DOCSTRING: 2394.
                                                       
                                                       
 -- C のマクロ: CO_METHOD                              *note inspect.CO_METHOD: 4a5c.
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_DIVISION                     no effect (*note __future__.division: 4a01.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_ABSOLUTE_IMPORT              no effect (*note __future__.absolute_import: 4a02.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_WITH_STATEMENT               no effect (*note __future__.with_statement: 4a03.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_PRINT_FUNCTION               no effect (*note __future__.print_function: 4a04.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_UNICODE_LITERALS             no effect (*note __future__.unicode_literals: 4a05.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_GENERATOR_STOP               no effect (*note __future__.generator_stop: 4a06.)
                                                       
                                                       
 -- C のマクロ: CO_FUTURE_ANNOTATIONS                  *note __future__.annotations: 4a07.
                                                       


File: python.info,  Node: Extra information,  Prev: Code Object Flags,  Up: Function オブジェクト<2>

7.9.5.7 Extra information
.........................

To support low-level extensions to frame evaluation, such as external
just-in-time compilers, it is possible to attach arbitrary extra data to
code objects.

These functions are part of the unstable C API tier: this functionality
is a CPython implementation detail, and the API may change without
deprecation warnings.

 -- C の関数: *note Py_ssize_t: c55.
          PyUnstable_Eval_RequestCodeExtraIndex (freefunc free)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Return a new opaque index value used to adding data to code
     objects.

     You generally call this function once (per interpreter) and use the
     result with ‘PyCode_GetExtra’ and ‘PyCode_SetExtra’ to manipulate
     data on individual code objects.

     If 'free' is not ‘NULL’: when a code object is deallocated, 'free'
     will be called on non-‘NULL’ data stored under the new index.  Use
     *note Py_DecRef(): 512a. when storing *note PyObject: 5df.

     Added in version 3.6: as ‘_PyEval_RequestCodeExtraIndex’

     バージョン 3.12 で変更: Renamed to
     ‘PyUnstable_Eval_RequestCodeExtraIndex’.  The old private name is
     deprecated, but will be available until the API changes.

 -- C の関数: int PyUnstable_Code_GetExtra (PyObject *code, Py_ssize_t
          index, void **extra)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Set 'extra' to the extra data stored under the given index.  Return
     0 on success.  Set an exception and return -1 on failure.

     If no data was set under the index, set 'extra' to ‘NULL’ and
     return 0 without setting an exception.

     Added in version 3.6: as ‘_PyCode_GetExtra’

     バージョン 3.12 で変更: Renamed to ‘PyUnstable_Code_GetExtra’.  The
     old private name is deprecated, but will be available until the API
     changes.

 -- C の関数: int PyUnstable_Code_SetExtra (PyObject *code, Py_ssize_t
          index, void *extra)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Set the extra data stored under the given index to 'extra'.  Return
     0 on success.  Set an exception and return -1 on failure.

     Added in version 3.6: as ‘_PyCode_SetExtra’

     バージョン 3.12 で変更: Renamed to ‘PyUnstable_Code_SetExtra’.  The
     old private name is deprecated, but will be available until the API
     changes.


File: python.info,  Node: その他のオブジェクト<2>,  Next: C API for extension modules,  Prev: Function オブジェクト<2>,  Up: 具象オブジェクト concrete object レイヤ

7.9.6 その他のオブジェクト
--------------------------

* Menu:

* ファイルオブジェクト::
* モジュールオブジェクト (module object): モジュールオブジェクト module object.
* Module definitions::
* Creating extension modules dynamically::
* サポート関数::
* イテレータオブジェクト (iterator object): イテレータオブジェクト iterator object.
* デスクリプタオブジェクト (descriptor object): デスクリプタオブジェクト descriptor object.
* スライスオブジェクト (slice object): スライスオブジェクト slice object.
* memoryview オブジェクト::
* Pickle buffer objects::
* 弱参照オブジェクト: 弱参照オブジェクト<2>.
* カプセル: カプセル<2>.
* フレーム (frame) オブジェクト: フレーム frame オブジェクト<2>.
* ジェネレータオブジェクト::
* コルーチンオブジェクト: コルーチンオブジェクト<2>.
* コンテキスト変数オブジェクト::
* 型ヒントのためのオブジェクト::


File: python.info,  Node: ファイルオブジェクト,  Next: モジュールオブジェクト module object,  Up: その他のオブジェクト<2>

7.9.6.1 ファイルオブジェクト
............................

これらの API は、 Python 2 の組み込みのファイルオブジェクトの C API を最
低限エミュレートするためのものです。それらは、標準 C ライブラリでサポー
トされているバッファ付き I/O (FILE*) に頼るために使われます。 Python 3 で
は、ファイルとストリームは新しい *note io: 83. モジュールを使用され、そ
こに OS の低レベルなバッファ付き I/O の上にいくつかの層が定義されていま
す。下で解説されている関数は、それらの新しい API の便利な C ラッパーであ
り、インタプリタでの内部的なエラー通知に向いています; サードパーティーの
コードは代わりに *note io: 83. の API を使うことが推奨されます。

 -- C の関数: *note PyObject: 5df. *PyFile_FromFd (int fd, const char
          *name, const char *mode, int buffering, const char *encoding,
          const char *errors, const char *newline, int closefd)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  既に
     開かれているファイル 'fd' のファイルディスクリプタから Python のフ
     ァイルオブジェクトを作成します。 引数 'name' 、 'encoding' 、
     'errors' 、 'newline' には、デフォルトの値として ‘NULL’ が使えます
     。 'buffering' には '-1' を指定してデフォルトの値を使うことができま
     す。 'name' は無視されるのですが、後方互換性のために残されています
     。 失敗すると ‘NULL’ を返します。 より包括的な引数の解説は、 *note
     io.open(): 740. 関数のドキュメントを参照してください。

          警告: Python ストリームは自身のバッファリング層を持つため、フ
          ァイル記述子のOSレベルのバッファリングと併用すると、様々な問題
          (予期せぬデータ順) などを引き起こします。

     バージョン 3.2 で変更: 'name' 属性の無視。

 -- C の関数: int PyObject_AsFileDescriptor (PyObject *p)
     ' 次に属します: *note Stable ABI: 775.'  'p' に関連づけられる ファ
     イルディスクリプタを int として返します。オブジェクトが整数なら、そ
     の値を返します。 整数でない場合、オブジェクトに *note fileno():
     17ad. メソッドがあれば呼び出します; このメソッドの返り値は、ファイ
     ル記述子の値として返される整数でなければなりません。失敗すると例外
     を設定して ‘-1’ を返します。

 -- C の関数: *note PyObject: 5df. *PyFile_GetLine (PyObject *p, int n)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     ‘p.readline([n])’ と同じで、この関数はオブジェクト 'p' の各行を読み
     出します。 'p' はファイルオブジェクトか、 *note readline(): 1541. メ
     ソッドを持つ何らかのオブジェクトでかまいません。 'n' が ‘0’ の場合
     、行の長さに関係なく正確に 1 行だけ読み出します。 'n' が ‘0’ より大
     きければ、 'n' バイト以上のデータは読み出しません; 従って、行の一部
     だけが返される場合があります。 どちらの場合でも、読み出し後すぐにフ
     ァイルの終端に到達した場合には空文字列を 返します。 'n' が ‘0’ より
     小さければ、長さに関わらず 1 行だけを 読み出しますが、すぐにファイ
     ルの終端に到達した場合には *note EOFError: 14f1. を送出します。

 -- C の関数: int PyFile_SetOpenCodeHook (Py_OpenCodeHookFunction
          handler)

     *note io.open_code(): 1a98. の通常の振る舞いを上書きして、そのパラ
     メーターを提供されたハンドラで渡します。

     ハンドラーは次の型の関数です。

      -- C のデータ型: typedef *note PyObject: 5df.
               *(*Py_OpenCodeHookFunction)(*note PyObject: 5df.*, void*)

          *note PyObject: 5df. *(*)(*note PyObject: 5df. *path, void
          *userData) と等価で、 'path' は *note PyUnicodeObject: 997. で
          あることが保証されています。

     'userData' ポインタはフック関数に渡されます。 フック関数は別なラン
     タイムから呼び出されるかもしれないので、このポインタは直接 Python の
     状態を参照すべきではありません。

     このフック関数はインポート中に使われることを意図しているため、モジ
     ュールが frozen なモジュールであるか ‘sys.modules’ にある利用可能な
     モジュールであることが分かっている場合を除いては、フック関数の実行
     中に新しいモジュールをインポートするのは避けてください。

     いったんフック関数が設定されたら、削除や置き換えもできず、後からの
     *note PyFile_SetOpenCodeHook(): 1a9a. の呼び出しは失敗します。 この
     関数が失敗したときは、インタープリタが初期化されていた場合、 -1 を
     返して例外をセットします。

     この関数は *note Py_Initialize(): 460. より前に呼び出しても安全です
     。

     引数無しで *note 監査イベント: 1c6e. ‘setopencodehook’ を送出します
     。

     Added in version 3.8.

 -- C の関数: *note PyObject: 5df. *PyFile_OpenCodeObject (PyObject
          *path)

     Open 'path' with the mode ‘'rb'’.  'path' must be a Python *note
     str: 169. object.  The behavior of this function may be overridden
     by *note PyFile_SetOpenCodeHook(): 1a9a. to allow for some
     preprocessing of the text.

     This is analogous to *note io.open_code(): 1a98. in Python.

     On success, this function returns a *note strong reference: 5e2. to
     a Python file object.  On failure, this function returns ‘NULL’
     with an exception set.

     Added in version 3.8.

 -- C の関数: *note PyObject: 5df. *PyFile_OpenCode (const char *path)

     Similar to *note PyFile_OpenCodeObject(): 5436, but 'path' is a
     UTF-8 encoded const char*.

     Added in version 3.8.

 -- C の関数: int PyFile_WriteObject (PyObject *obj, PyObject *p, int
          flags)
     ' 次に属します: *note Stable ABI: 775.'

     オブジェクト 'obj' をファイルオブジェクト 'p' に書き込みます。
     'flags' がサポートするフラグは *note Py_PRINT_RAW: 5287. だけです;
     このフラグを指定すると、オブジェクトに *note repr(): 1c1. ではなく
     *note str(): 169. を適用した結果をファイルに書き出します。成功した
     場合には ‘0’ を返し、失敗すると ‘-1’ を返して適切な例外をセットしま
     す。

 -- C の関数: int PyFile_WriteString (const char *s, PyObject *p)
     ' 次に属します: *note Stable ABI: 775.'  文字列 's' をファイルオブ
     ジェクト 'p' に書き出します。成功した場合には ‘0’ を返し、失敗する
     と ‘-1’ を返して適切な例外をセットします。

* Menu:

* Deprecated API: Deprecated API<4>.


File: python.info,  Node: Deprecated API<4>,  Up: ファイルオブジェクト

7.9.6.2 Deprecated API
......................

These are *note soft deprecated: 23d. APIs that were included in
Python's C API by mistake.  They are documented solely for completeness;
use other ‘PyFile*’ APIs instead.

 -- C の関数: *note PyObject: 5df. *PyFile_NewStdPrinter (int fd)

     Use *note PyFile_FromFd(): 5024. with defaults (‘fd, NULL, "w", -1,
     NULL, NULL, NULL, 0’) instead.

 -- C 変数: *note PyTypeObject: c9c. PyStdPrinter_Type

     Type of file-like objects used internally at Python startup when
     *note io: 83. is not yet available.  Use Python *note open(): 316.
     or *note PyFile_FromFd(): 5024. to create file objects instead.


File: python.info,  Node: モジュールオブジェクト module object,  Next: Module definitions,  Prev: ファイルオブジェクト,  Up: その他のオブジェクト<2>

7.9.6.3 モジュールオブジェクト (module object)
..............................................

 -- C 変数: *note PyTypeObject: c9c. PyModule_Type
     ' 次に属します: *note Stable ABI: 775.'

     This instance of *note PyTypeObject: c9c. represents the Python
     module type.  This is exposed to Python programs as *note
     types.ModuleType: 1014.

 -- C の関数: int PyModule_Check (PyObject *p)

     'p' がモジュールオブジェクトかモジュールオブジェクトのサブタイプで
     あるときに真を返します。この関数は常に成功します。

 -- C の関数: int PyModule_CheckExact (PyObject *p)

     'p' がモジュールオブジェクトで、かつ *note PyModule_Type: 5063. の
     サブタイプでないときに真を返します。この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyModule_NewObject (PyObject *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'

     Return a new module object with *note module.__name__: 15a3. set to
     'name'.  The module's ‘__name__’, *note __doc__: 1bef, *note
     __package__: 323. and *note __loader__: 33b. attributes are filled
     in (all but ‘__name__’ are set to ‘None’).  The caller is
     responsible for setting a *note __file__: 2369. attribute.

     Return ‘NULL’ with an exception set on error.

     Added in version 3.3.

     バージョン 3.4 で変更: *note __package__: 323. and *note
     __loader__: 33b. are now set to ‘None’.

 -- C の関数: *note PyObject: 5df. *PyModule_New (const char *name)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     *note PyModule_NewObject(): 5061. に似ていますが、 name は Unicode
     オブジェクトではなく UTF-8 でエンコードされた文字列です。

 -- C の関数: *note PyObject: 5df. *PyModule_GetDict (PyObject *module)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'

     'module' の名前空間を実装する辞書オブジェクトを返します; このオブジ
     ェクトは、モジュールオブジェクトの *note __dict__: 77d. 属性と同じ
     ものです。 'module' がモジュールオブジェクト (もしくはモジュールオ
     ブジェクトのサブタイプ) でない場合は、 *note SystemError: 795. が送
     出され ‘NULL’ が返されます。

     拡張モジュールでは、モジュールの *note __dict__: 77d. を直接操作す
     るよりも、 ‘PyModule_*’ および ‘PyObject_*’ 関数を使う方が推奨され
     ます。

     The returned reference is borrowed from the module; it is valid
     until the module is destroyed.

 -- C の関数: *note PyObject: 5df. *PyModule_GetNameObject (PyObject
          *module)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'

     Return 'module"s *note __name__: 15a3. value.  If the module does
     not provide one, or if it is not a string, *note SystemError: 795.
     is raised and ‘NULL’ is returned.

     Added in version 3.3.

 -- C の関数: const char *PyModule_GetName (PyObject *module)
     ' 次に属します: *note Stable ABI: 775.'  *note
     PyModule_GetNameObject(): 505f. に似ていますが、 ‘'utf-8'’ でエンコ
     ードされた name を返します。

     The returned buffer is only valid until the module is renamed or
     destroyed.  Note that Python code may rename a module by setting
     its *note __name__: 15a3. attribute.

 -- C の関数: void *PyModule_GetState (PyObject *module)
     ' 次に属します: *note Stable ABI: 775.'  モジュールの "state"(モジ
     ュールを生成したタイミングで確保されるメモリブロックへのポインター)
     か、なければ ‘NULL’ を返します。 *note PyModuleDef.m_size: b76. を
     参照してください。

 -- C の関数: *note PyModuleDef: b74. *PyModule_GetDef (PyObject
          *module)
     ' 次に属します: *note Stable ABI: 775.'  モジュールが作られる元とな
     った *note PyModuleDef: b74. 構造体へのポインタを返します。 モジュ
     ールが定義によって作られていなかった場合は ‘NULL’ を返します。

     On error, return ‘NULL’ with an exception set.  Use *note
     PyErr_Occurred(): 1caf. to tell this case apart from a missing
     ‘PyModuleDef’.

 -- C の関数: *note PyObject: 5df. *PyModule_GetFilenameObject (PyObject
          *module)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

     Return the name of the file from which 'module' was loaded using
     'module"s *note __file__: 2369. attribute.  If this is not defined,
     or if it is not a string, raise *note SystemError: 795. and return
     ‘NULL’; otherwise return a reference to a Unicode object.

     Added in version 3.2.

 -- C の関数: const char *PyModule_GetFilename (PyObject *module)
     ' 次に属します: *note Stable ABI: 775.'  *note
     PyModule_GetFilenameObject(): 42e. と似ていますが、 'utf-8' でエン
     コードされたファイル名を返します。

     The returned buffer is only valid until the module's *note
     __file__: 2369. attribute is reassigned or the module is destroyed.

     バージョン 3.2 で非推奨: *note PyModule_GetFilename(): 42d. はエン
     コードできないファイル名に対しては *note UnicodeEncodeError: 887. を
     送出します。これの代わりに *note PyModule_GetFilenameObject(): 42e.
     を使用してください。


File: python.info,  Node: Module definitions,  Next: Creating extension modules dynamically,  Prev: モジュールオブジェクト module object,  Up: その他のオブジェクト<2>

7.9.6.4 Module definitions
..........................

The functions in the previous section work on any module object,
including modules imported from Python code.

Modules defined using the C API typically use a 'module definition',
*note PyModuleDef: b74. - a statically allocated, constant “description"
of how a module should be created.

The definition is usually used to define an extension's “main” module
object (see *note 拡張モジュールの定義: 4efc. for details).  It is also
used to *note create extension modules dynamically: 5443.

Unlike *note PyModule_New(): 5060, the definition allows management of
'module state' - a piece of memory that is allocated and cleared
together with the module object.  Unlike the module's Python attributes,
Python code cannot replace or delete data stored in module state.

 -- C のデータ型: type PyModuleDef
     ' 次に属します: *note Stable ABI: 775. (すべてのメンバーを含む).'
     The module definition struct, which holds all information needed to
     create a module object.  This structure must be statically
     allocated (or be otherwise guaranteed to be valid while any modules
     created from it exist).  Usually, there is only one variable of
     this type for each extension module.

      -- C のメンバ変数: PyModuleDef_Base m_base

          このメンバーは常に ‘PyModuleDef_HEAD_INIT’ で初期化してくださ
          い。

      -- C のメンバ変数: const char *m_name

          新しいモジュールの名前。

      -- C のメンバ変数: const char *m_doc

          モジュールの docstring。たいてい docstring は *note
          PyDoc_STRVAR: 1d5b. を利用して生成されます。

      -- C のメンバ変数: *note Py_ssize_t: c55. m_size

          モジュールの状態は、静的なグローバルな領域ではなく *note
          PyModule_GetState(): b77. で取得できるモジュールごとのメモリ領
          域に保持されていることがあります。 これによってモジュールは複
          数のサブ・インタプリターで安全に使えます。

          このメモリ領域は 'm_size' に基づいてモジュール作成時に確保され
          、モジュールオブジェクトが破棄されるときに、 *note m_free:
          b73. 関数があればそれが呼ばれた後で解放されます。

          Setting it to a non-negative value means that the module can
          be re-initialized and specifies the additional amount of
          memory it requires for its state.

          Setting ‘m_size’ to ‘-1’ means that the module does not
          support sub-interpreters, because it has global state.
          Negative ‘m_size’ is only allowed when using *note legacy
          single-phase initialization: 520e. or when *note creating
          modules dynamically: 5443.

          詳細は PEP 3121(1) を参照。

      -- C のメンバ変数: *note PyMethodDef: 16f0. *m_methods

          *note PyMethodDef: 16f0. で定義される、モジュールレベル関数の
          テーブルへのポインター。関数が存在しない場合は ‘NULL’ を設定す
          ることが可能。

      -- C のメンバ変数: *note PyModuleDef_Slot: 5059. *m_slots

          An array of slot definitions for multi-phase initialization,
          terminated by a ‘{0, NULL}’ entry.  When using legacy
          single-phase initialization, 'm_slots' must be ‘NULL’.

          バージョン 3.5 で変更: バージョン 3.5 より前は、このメンバは常
          に ‘NULL’ に設定されていて、次のものとして定義されていました:

                -- C のメンバ変数: *note inquiry: 51ab. m_reload

      -- C のメンバ変数: *note traverseproc: 51ba. m_traverse

          GC走査がモジュールオブジェクトを走査する際に呼び出される走査関
          数。必要ない場合は ‘NULL’.

          This function is not called if the module state was requested
          but is not allocated yet.  This is the case immediately after
          the module is created and before the module is executed (*note
          Py_mod_exec: b75. function).  More precisely, this function is
          not called if *note m_size: b76. is greater than 0 and the
          module state (as returned by *note PyModule_GetState(): b77.)
          is ‘NULL’.

          バージョン 3.9 で変更: No longer called before the module
          state is allocated.

      -- C のメンバ変数: *note inquiry: 51ab. m_clear

          GCがこのモジュールオブジェクトをクリアーする時に呼び出されるク
          リアー関数。必要ない場合は、‘NULL’.

          This function is not called if the module state was requested
          but is not allocated yet.  This is the case immediately after
          the module is created and before the module is executed (*note
          Py_mod_exec: b75. function).  More precisely, this function is
          not called if *note m_size: b76. is greater than 0 and the
          module state (as returned by *note PyModule_GetState(): b77.)
          is ‘NULL’.

          Like *note PyTypeObject.tp_clear: 4ee2, this function is not
          'always' called before a module is deallocated.  For example,
          when reference counting is enough to determine that an object
          is no longer used, the cyclic garbage collector is not
          involved and *note m_free: b73. is called directly.

          バージョン 3.9 で変更: No longer called before the module
          state is allocated.

      -- C のメンバ変数: *note freefunc: 5449. m_free

          GCがこのモジュールオブジェクトを解放するときに呼び出される関数
          。必要ない場合は ‘NULL’.

          This function is not called if the module state was requested
          but is not allocated yet.  This is the case immediately after
          the module is created and before the module is executed (*note
          Py_mod_exec: b75. function).  More precisely, this function is
          not called if *note m_size: b76. is greater than 0 and the
          module state (as returned by *note PyModule_GetState(): b77.)
          is ‘NULL’.

          バージョン 3.9 で変更: No longer called before the module
          state is allocated.

* Menu:

* Module slots::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3121/


File: python.info,  Node: Module slots,  Up: Module definitions

7.9.6.5 Module slots
....................

 -- C のデータ型: type PyModuleDef_Slot
     ' 次に属します: *note Stable ABI: 775. (すべてのメンバーを含む) (バ
     ージョン 3.5 より).'
      -- C のメンバ変数: int slot

          スロット ID で、以下で説明されている利用可能な値から選ばれます
          。

      -- C のメンバ変数: void *value

          スロットの値で、意味はスロット ID に依存します。

     Added in version 3.5.

利用可能なスロットの型は以下です:

 -- C のマクロ: Py_mod_create
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.5 より).'  モ
     ジュールオブジェクト自身を生成するために呼ばれる関数を指定します。
     このスロットの 'value' ポインタは次のシグネチャを持つ関数を指してい
     なくてはいけません:

      -- C の関数: *note PyObject: 5df. *create_module (PyObject *spec,
               PyModuleDef *def)

     PEP 451(1) で定義された *note ModuleSpec: 226c. インスタンスと、モ
     ジュール定義を受け取る関数です。 これは新しいモジュールオブジェクト
     を返すか、エラーを設定して ‘NULL’ を返すべきです。

     この関数は最小限に留めておくべきです。 特に任意のPythonコードを呼び
     出すべきではなく、同じモジュールをインポートしようとすると無限ルー
     プに陥るでしょう。

     複数の ‘Py_mod_create’ スロットを1つのモジュール定義に設定しない方
     がよいです。

     ‘Py_mod_create’ が設定されていない場合は、インポート機構は *note
     PyModule_New(): 5060. を使って通常のモジュールオブジェクトを生成し
     ます。 モジュールの名前は定義ではなく 'spec' から取得され、これによ
     って拡張モジュールが動的にモジュール階層における位置を調整できたり
     、シンボリックリンクを通して同一のモジュール定義を共有しつつ別の名
     前でインポートできたりします。

     返されるオブジェクトが *note PyModule_Type: 5063. のインスタンスで
     ある必要はありません。 インポートに関連する属性の設定と取得ができる
     限りは、どんな型でも使えます。 しかし、 ‘PyModuleDef’ が ‘NULL’ で
     ない ‘m_traverse’, ‘m_clear’, ‘m_free’ 、もしくはゼロでない
     ‘m_size’ 、もしくは ‘Py_mod_create’ 以外のスロットを持つ場合は、
     ‘PyModule_Type’ インスタンスのみが返されるでしょう。

     Added in version 3.5.

 -- C のマクロ: Py_mod_exec
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.5 より).'  モ
     ジュールを '実行する' ときに呼ばれる関数を指定します。 これは
     Pythonモジュールのコードを実行するのと同等です: この関数はたいてい
     はクラスと定数をモジュールにします。 この関数のシグネチャは以下です
     :

      -- C の関数: int exec_module (PyObject *module)

     複数の ‘Py_mod_exec’ スロットが設定されていた場合は、 'm_slots' 配
     列に現れた順に処理されていきます。

     Added in version 3.5.

 -- C のマクロ: Py_mod_multiple_interpreters
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'
     Specifies one of the following values:

      -- C のマクロ: Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED

          The module does not support being imported in subinterpreters.

      -- C のマクロ: Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED

          The module supports being imported in subinterpreters, but
          only when they share the main interpreter's GIL. (See *note
          拡張モジュールを分離する: 166.)

      -- C のマクロ: Py_MOD_PER_INTERPRETER_GIL_SUPPORTED

          The module supports being imported in subinterpreters, even
          when they have their own GIL. (See *note
          拡張モジュールを分離する: 166.)

     This slot determines whether or not importing this module in a
     subinterpreter will fail.

     Multiple ‘Py_mod_multiple_interpreters’ slots may not be specified
     in one module definition.

     If ‘Py_mod_multiple_interpreters’ is not specified, the import
     machinery defaults to ‘Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED’.

     Added in version 3.12.

 -- C のマクロ: Py_mod_gil
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Specifies one of the following values:

      -- C のマクロ: Py_MOD_GIL_USED

          The module depends on the presence of the global interpreter
          lock (GIL), and may access global state without
          synchronization.

      -- C のマクロ: Py_MOD_GIL_NOT_USED

          The module is safe to run without an active GIL.

     This slot is ignored by Python builds not configured with *note
     -disable-gil: 499.  Otherwise, it determines whether or not
     importing this module will cause the GIL to be automatically
     enabled.  See *note フリースレッドの CPython: 46d. for more detail.

     Multiple ‘Py_mod_gil’ slots may not be specified in one module
     definition.

     If ‘Py_mod_gil’ is not specified, the import machinery defaults to
     ‘Py_MOD_GIL_USED’.

     Added in version 3.13.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0451/


File: python.info,  Node: Creating extension modules dynamically,  Next: サポート関数,  Prev: Module definitions,  Up: その他のオブジェクト<2>

7.9.6.6 Creating extension modules dynamically
..............................................

The following functions may be used to create a module outside of an
extension's *note initialization function: 520d.  They are also used in
*note single-phase initialization: 520e.

 -- C の関数: *note PyObject: 5df. *PyModule_Create (PyModuleDef *def)
     '戻り値: 新しい参照。' Create a new module object, given the
     definition in 'def'.  This is a macro that calls *note
     PyModule_Create2(): 505b. with 'module_api_version' set to *note
     PYTHON_API_VERSION: 492e, or to *note PYTHON_ABI_VERSION: 5454. if
     using the *note limited API: 637.

 -- C の関数: *note PyObject: 5df. *PyModule_Create2 (PyModuleDef *def,
          int module_api_version)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  APIバ
     ージョンを 'module_api_version' として 'def' での定義に従って新しい
     モジュールオブジェクトを生成します。 もし指定されたバージョンが実行
     しているインタープリターのバージョンと異なる場合は、 *note
     RuntimeWarning: 4d7. を発生させます。

     Return ‘NULL’ with an exception set on error.

     This function does not support slots.  The *note m_slots: 5215.
     member of 'def' must be ‘NULL’.

          注釈: ほとんどの場合、この関数ではなく *note
          PyModule_Create(): 5217. を利用するべきです。この関数は、この
          関数の必要性を理解しているときにだけ利用してください。

 -- C の関数: *note PyObject: 5df. *PyModule_FromDefAndSpec (PyModuleDef
          *def, PyObject *spec)
     '戻り値: 新しい参照。' This macro calls *note
     PyModule_FromDefAndSpec2(): 10b4. with 'module_api_version' set to
     *note PYTHON_API_VERSION: 492e, or to *note PYTHON_ABI_VERSION:
     5454. if using the *note limited API: 637.

     Added in version 3.5.

 -- C の関数: *note PyObject: 5df. *PyModule_FromDefAndSpec2
          (PyModuleDef *def, PyObject *spec, int module_api_version)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'  APIバージョンを 'module_api_version' として、
     'def' と ModuleSpec オブジェクトの 'spec' で定義されたとおりに新し
     いモジュールオブジェクトを生成します。 もし指定されたバージョンが実
     行しているインタープリターのバージョンと異なる場合は、 *note
     RuntimeWarning: 4d7. を発生させます。

     Return ‘NULL’ with an exception set on error.

     Note that this does not process execution slots (*note Py_mod_exec:
     b75.).  Both ‘PyModule_FromDefAndSpec’ and ‘PyModule_ExecDef’ must
     be called to fully initialize a module.

          注釈: ほとんどの場合、この関数ではなく *note
          PyModule_FromDefAndSpec(): 10b3. を利用するべきです。 この関数
          は、この関数の必要性を理解しているときにだけ利用してください。

     Added in version 3.5.

 -- C の関数: int PyModule_ExecDef (PyObject *module, PyModuleDef *def)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     'def' で与えられた任意の実行スロット (*note Py_mod_exec: b75.) を実
     行します。

     Added in version 3.5.

 -- C のマクロ: PYTHON_API_VERSION

     The C API version.  Defined for backwards compatibility.

     Currently, this constant is not updated in new Python versions, and
     is not useful for versioning.  This may change in the future.

 -- C のマクロ: PYTHON_ABI_VERSION

     Defined as ‘3’ for backwards compatibility.

     Currently, this constant is not updated in new Python versions, and
     is not useful for versioning.  This may change in the future.


File: python.info,  Node: サポート関数,  Next: イテレータオブジェクト iterator object,  Prev: Creating extension modules dynamically,  Up: その他のオブジェクト<2>

7.9.6.7 サポート関数
....................

The following functions are provided to help initialize a module state.
They are intended for a module's execution slots (*note Py_mod_exec:
b75.), the initialization function for legacy *note single-phase
initialization: 520e, or code that creates modules dynamically.

 -- C の関数: int PyModule_AddObjectRef (PyObject *module, const char
          *name, PyObject *value)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     'module' にオブジェクトを 'name' として追加します。 この関数はモジ
     ュールの初期化関数から利用される便利関数です。

     成功すると ‘0’ を返し、エラーになると例外を送出して ‘-1’ を返します
     。

     使用例:

          static int
          add_spam(PyObject *module, int value)
          {
              PyObject *obj = PyLong_FromLong(value);
              if (obj == NULL) {
                  return -1;
              }
              int res = PyModule_AddObjectRef(module, "spam", obj);
              Py_DECREF(obj);
              return res;
           }

     To be convenient, the function accepts ‘NULL’ 'value' with an
     exception set.  In this case, return ‘-1’ and just leave the raised
     exception unchanged.

     この例は、明示的に 'obj' が ‘NULL’ であることを確認せずに書くことも
     できます:

          static int
          add_spam(PyObject *module, int value)
          {
              PyObject *obj = PyLong_FromLong(value);
              int res = PyModule_AddObjectRef(module, "spam", obj);
              Py_XDECREF(obj);
              return res;
           }

     この場合は、 'obj' が ‘NULL’ でありうるため、 ‘Py_DECREF()’ の代わ
     りに ‘Py_XDECREF()’ を呼び出す必要があることに注意してください。

     The number of different 'name' strings passed to this function
     should be kept small, usually by only using statically allocated
     strings as 'name'.  For names that aren't known at compile time,
     prefer calling *note PyUnicode_FromString(): 5112. and *note
     PyObject_SetAttr(): 5097. directly.  For more details, see *note
     PyUnicode_InternFromString(): 198c, which may be used internally to
     create a key object.

     Added in version 3.10.

 -- C の関数: int PyModule_Add (PyObject *module, const char *name,
          PyObject *value)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Similar to *note PyModule_AddObjectRef(): 60a, but "steals" a
     reference to 'value'.  It can be called with a result of function
     that returns a new reference without bothering to check its result
     or even saving it to a variable.

     使用例:

          if (PyModule_Add(module, "spam", PyBytes_FromString(value)) < 0) {
              goto error;
          }

     Added in version 3.13.

 -- C の関数: int PyModule_AddObject (PyObject *module, const char
          *name, PyObject *value)
     ' 次に属します: *note Stable ABI: 775.'  Similar to *note
     PyModule_AddObjectRef(): 60a, but steals a reference to 'value' on
     success (if it returns ‘0’).

     The new *note PyModule_Add(): 609. or *note
     PyModule_AddObjectRef(): 60a. functions are recommended, since it
     is easy to introduce reference leaks by misusing the *note
     PyModule_AddObject(): 60b. function.

          注釈: Unlike other functions that steal references,
          ‘PyModule_AddObject()’ only releases the reference to 'value'
          'on success'.

          This means that its return value must be checked, and calling
          code must *note Py_XDECREF(): 992. 'value' manually on error.

     使用例:

          PyObject *obj = PyBytes_FromString(value);
          if (PyModule_AddObject(module, "spam", obj) < 0) {
              // If 'obj' is not NULL and PyModule_AddObject() failed,
              // 'obj' strong reference must be deleted with Py_XDECREF().
              // If 'obj' is NULL, Py_XDECREF() does nothing.
              Py_XDECREF(obj);
              goto error;
          }
          // PyModule_AddObject() stole a reference to obj:
          // Py_XDECREF(obj) is not needed here.

     バージョン 3.13 で非推奨: *note PyModule_AddObject(): 60b. is *note
     soft deprecated: 23d.

 -- C の関数: int PyModule_AddIntConstant (PyObject *module, const char
          *name, long value)
     ' 次に属します: *note Stable ABI: 775.'  Add an integer constant to
     'module' as 'name'.  This convenience function can be used from the
     module's initialization function.  Return ‘-1’ with an exception
     set on error, ‘0’ on success.

     This is a convenience function that calls *note PyLong_FromLong():
     1bd0. and *note PyModule_AddObjectRef(): 60a.; see their
     documentation for details.

 -- C の関数: int PyModule_AddStringConstant (PyObject *module, const
          char *name, const char *value)
     ' 次に属します: *note Stable ABI: 775.'  Add a string constant to
     'module' as 'name'.  This convenience function can be used from the
     module's initialization function.  The string 'value' must be
     ‘NULL’-terminated.  Return ‘-1’ with an exception set on error, ‘0’
     on success.

     This is a convenience function that calls *note
     PyUnicode_InternFromString(): 198c. and *note
     PyModule_AddObjectRef(): 60a.; see their documentation for details.

 -- C のマクロ: PyModule_AddIntMacro (module, macro)

     Add an int constant to 'module'.  The name and the value are taken
     from 'macro'.  For example ‘PyModule_AddIntMacro(module, AF_INET)’
     adds the int constant 'AF_INET' with the value of 'AF_INET' to
     'module'.  Return ‘-1’ with an exception set on error, ‘0’ on
     success.

 -- C のマクロ: PyModule_AddStringMacro (module, macro)

     文字列定数を 'module' に追加します。

 -- C の関数: int PyModule_AddType (PyObject *module, PyTypeObject
          *type)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Add a type object to 'module'.  The type object is finalized by
     calling internally *note PyType_Ready(): 980.  The name of the type
     object is taken from the last component of *note tp_name: 1cb0.
     after dot.  Return ‘-1’ with an exception set on error, ‘0’ on
     success.

     Added in version 3.9.

 -- C の関数: int PyModule_AddFunctions (PyObject *module, PyMethodDef
          *functions)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'  Add
     the functions from the ‘NULL’ terminated 'functions' array to
     'module'.  Refer to the *note PyMethodDef: 16f0. documentation for
     details on individual entries (due to the lack of a shared module
     namespace, module level "functions" implemented in C typically
     receive the module as their first parameter, making them similar to
     instance methods on Python classes).

     This function is called automatically when creating a module from
     ‘PyModuleDef’ (such as when using *note 多段階初期化: 5213,
     ‘PyModule_Create’, or ‘PyModule_FromDefAndSpec’).  Some module
     authors may prefer defining functions in multiple *note
     PyMethodDef: 16f0. arrays; in that case they should call this
     function directly.

     The 'functions' array must be statically allocated (or otherwise
     guaranteed to outlive the module object).

     Added in version 3.5.

 -- C の関数: int PyModule_SetDocString (PyObject *module, const char
          *docstring)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'  Set
     the docstring for 'module' to 'docstring'.  This function is called
     automatically when creating a module from ‘PyModuleDef’ (such as
     when using *note 多段階初期化: 5213, ‘PyModule_Create’, or
     ‘PyModule_FromDefAndSpec’).

     Return ‘0’ on success.  Return ‘-1’ with an exception set on error.

     Added in version 3.5.

 -- C の関数: int PyUnstable_Module_SetGIL (PyObject *module, void *gil)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Indicate that 'module' does or does not support running without the
     global interpreter lock (GIL), using one of the values from *note
     Py_mod_gil: 482.  It must be called during 'module"s initialization
     function when using *note 従来の一段階初期化: 520e.  If this
     function is not called during module initialization, the import
     machinery assumes the module does not support running without the
     GIL. This function is only available in Python builds configured
     with *note -disable-gil: 499.  Return ‘-1’ with an exception set on
     error, ‘0’ on success.

     Added in version 3.13.

* Menu:

* Module lookup (single-phase initialization): Module lookup single-phase initialization.


File: python.info,  Node: Module lookup single-phase initialization,  Up: サポート関数

7.9.6.8 Module lookup (single-phase initialization)
...................................................

The legacy *note single-phase initialization: 520e. initialization
scheme creates singleton modules that can be looked up in the context of
the current interpreter.  This allows the module object to be retrieved
later with only a reference to the module definition.

多段階初期化を使うと単一の定義から複数のモジュールが作成できるので、これ
らの関数は多段階初期化を使って作成されたモジュールには使えません。

 -- C の関数: *note PyObject: 5df. *PyState_FindModule (PyModuleDef
          *def)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  現在の
     インタプリタの 'def' から作られたモジュールオブジェクトを返します。
     このメソッドの前提条件として、前もって *note PyState_AddModule():
     50b4. でインタプリタの state にモジュールオブジェクトを連結しておく
     ことを要求します。対応するモジュールオブジェクトが見付からない、も
     しくは事前にインタプリタの state に連結されていない場合は、 ‘NULL’
     を返します。

 -- C の関数: int PyState_AddModule (PyObject *module, PyModuleDef *def)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.3 より).'  関
     数に渡されたモジュールオブジェクトを、インタプリタの state に連結し
     ます。この関数を使うことで *note PyState_FindModule(): 50b5. からモ
     ジュールオブジェクトにアクセスできるようになります。

     一段階初期化を使って作成されたモジュールにのみ有効です。

     Python calls ‘PyState_AddModule’ automatically after importing a
     module that uses *note single-phase initialization: 520e, so it is
     unnecessary (but harmless) to call it from module initialization
     code.  An explicit call is needed only if the module's own init
     code subsequently calls ‘PyState_FindModule’.  The function is
     mainly intended for implementing alternative import mechanisms
     (either by calling it directly, or by referring to its
     implementation for details of the required state updates).

     If a module was attached previously using the same 'def', it is
     replaced by the new 'module'.

     The caller must have an *note attached thread state: 4ed1.

     Return ‘-1’ with an exception set on error, ‘0’ on success.

     Added in version 3.3.

 -- C の関数: int PyState_RemoveModule (PyModuleDef *def)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.3 より).'
     Removes the module object created from 'def' from the interpreter
     state.  Return ‘-1’ with an exception set on error, ‘0’ on success.

     The caller must have an *note attached thread state: 4ed1.

     Added in version 3.3.


File: python.info,  Node: イテレータオブジェクト iterator object,  Next: デスクリプタオブジェクト descriptor object,  Prev: サポート関数,  Up: その他のオブジェクト<2>

7.9.6.9 イテレータオブジェクト (iterator object)
................................................

Python では二種類のイテレータオブジェクトを提供しています。一つ目はシー
ケンスイテレータで、 *note __getitem__(): 588. メソッドをサポートする任
意のシーケンスを取り扱います。二つ目は呼び出し可能オブジェクトと番兵
(sentinel value) を扱い、シーケンス内の要素ごとに呼び出し可能オブジェク
トを呼び出して、センチネル値が返されたときに反復処理を終了します。

 -- C 変数: *note PyTypeObject: c9c. PySeqIter_Type
     ' 次に属します: *note Stable ABI: 775.'  *note PySeqIter_New():
     509e. や、組み込みシーケンス型に対して 1 引数形式の組み込み関数
     *note iter(): 9d7. を呼び出したときに返される、イテレータオブジェク
     トの型オブジェクトです。

 -- C の関数: int PySeqIter_Check (PyObject *op)

     'op' の型が ‘PySeqlter_Type’ 型の場合に真を返します。この関数は常に
     成功します。

 -- C の関数: *note PyObject: 5df. *PySeqIter_New (PyObject *seq)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  一般
     的なシーケンスオブジェクト 'seq' を扱うイテレータを返します。反復処
     理は、シーケンスが添字指定操作の際に *note IndexError: 174e. を返し
     たときに終了します。

 -- C 変数: *note PyTypeObject: c9c. PyCallIter_Type
     ' 次に属します: *note Stable ABI: 775.'  *note PyCallIter_New():
     4f90. や、組み込み関数 *note iter(): 9d7. の 2 引数形式が返すイテレ
     ータオブジェクトの型オブジェクトです。

 -- C の関数: int PyCallIter_Check (PyObject *op)

     'op' の型が *note PyCallIter_Type: 4f91. 型の場合に真を返します。こ
     の関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyCallIter_New (PyObject *callable,
          PyObject *sentinel)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  新た
     なイテレータを返します。最初のパラメタ 'callable' は引数なしで呼び
     出せる Python の呼び出し可能オブジェクトならなんでもかまいません;
     'callable' は、呼び出されるたびに次の反復処理対象オブジェクトを返さ
     なければなりません。生成されたイテレータは、'callable' が
     'sentinel' に等しい値を返すと反復処理を終了します。

* Menu:

* Range Objects::
* Builtin Iterator Types::
* Other Iterator Objects::


File: python.info,  Node: Range Objects,  Next: Builtin Iterator Types,  Up: イテレータオブジェクト iterator object

7.9.6.10 Range Objects
......................

 -- C 変数: *note PyTypeObject: c9c. PyRange_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object for *note
     range: b3d. objects.

 -- C の関数: int PyRange_Check (PyObject *o)

     Return true if the object 'o' is an instance of a *note range: b3d.
     object.  This function always succeeds.


File: python.info,  Node: Builtin Iterator Types,  Next: Other Iterator Objects,  Prev: Range Objects,  Up: イテレータオブジェクト iterator object

7.9.6.11 Builtin Iterator Types
...............................

These are built-in iteration types that are included in Python's C API,
but provide no additional functions.  They are here for completeness.

C の型                                                 Python の型
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
 -- C 変数: *note PyTypeObject: c9c. PyEnum_Type       *note enumerate: 169a.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyTypeObject: c9c. PyFilter_Type     *note filter: a64.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyTypeObject: c9c. PyMap_Type        *note map: 19f.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyTypeObject: c9c. PyReversed_Type   *note reversed: a65.
     ' 次に属します: *note Stable ABI: 775.'           

 -- C 変数: *note PyTypeObject: c9c. PyZip_Type        *note zip: 1a0.
     ' 次に属します: *note Stable ABI: 775.'           


File: python.info,  Node: Other Iterator Objects,  Prev: Builtin Iterator Types,  Up: イテレータオブジェクト iterator object

7.9.6.12 Other Iterator Objects
...............................

 -- C 変数: *note PyTypeObject: c9c. PyByteArrayIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: c9c. PyBytesIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: c9c. PyListIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: c9c. PyListRevIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: c9c. PySetIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: c9c. PyTupleIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: c9c. PyRangeIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: c9c. PyLongRangeIter_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: c9c. PyDictIterKey_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: c9c. PyDictRevIterKey_Type
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.8 より).'

 -- C 変数: *note PyTypeObject: c9c. PyDictIterValue_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: c9c. PyDictRevIterValue_Type
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.8 より).'

 -- C 変数: *note PyTypeObject: c9c. PyDictIterItem_Type
     ' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: c9c. PyDictRevIterItem_Type
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.8 より).'

 -- C 変数: *note PyTypeObject: c9c. PyODictIter_Type

     Type objects for iterators of various built-in objects.

     Do not create instances of these directly; prefer calling *note
     PyObject_GetIter(): 5092. instead.

     Note that there is no guarantee that a given built-in type uses a
     given iterator type.  For example, iterating over *note range: b3d.
     will use one of two iterator types depending on the size of the
     range.  Other types may start using a similar scheme in the future,
     without warning.


File: python.info,  Node: デスクリプタオブジェクト descriptor object,  Next: スライスオブジェクト slice object,  Prev: イテレータオブジェクト iterator object,  Up: その他のオブジェクト<2>

7.9.6.13 デスクリプタオブジェクト (descriptor object)
.....................................................

"デスクリプタ (descriptor)" は、あるオブジェクトのいくつかの属性について
記述したオブジェクトです。デスクリプタオブジェクトは型オブジェクトの辞書
内にあります。

 -- C 変数: *note PyTypeObject: c9c. PyProperty_Type
     ' 次に属します: *note Stable ABI: 775.'  組み込みデスクリプタ型の型
     オブジェクトです。

 -- C の関数: *note PyObject: 5df. *PyDescr_NewGetSet (PyTypeObject
          *type, struct PyGetSetDef *getset)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

 -- C の関数: *note PyObject: 5df. *PyDescr_NewMember (PyTypeObject
          *type, struct PyMemberDef *meth)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: c9c. PyMemberDescr_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object for member
     descriptor objects created from *note PyMemberDef: 771. structures.
     These descriptors expose fields of a C struct as attributes on a
     type, and correspond to *note types.MemberDescriptorType: 29ec.
     objects in Python.

 -- C 変数: *note PyTypeObject: c9c. PyGetSetDescr_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object for
     get/set descriptor objects created from *note PyGetSetDef: db2.
     structures.  These descriptors implement attributes whose value is
     computed by C getter and setter functions, and are used for many
     built-in type attributes.

 -- C の関数: *note PyObject: 5df. *PyDescr_NewMethod (PyTypeObject
          *type, struct PyMethodDef *meth)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

 -- C 変数: *note PyTypeObject: c9c. PyMethodDescr_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object for method
     descriptor objects created from *note PyMethodDef: 16f0.
     structures.  These descriptors expose C functions as methods on a
     type, and correspond to *note types.MemberDescriptorType: 29ec.
     objects in Python.

 -- C の関数: *note PyObject: 5df. *PyDescr_NewWrapper (PyTypeObject
          *type, struct wrapperbase *wrapper, void *wrapped)
     '戻り値: 新しい参照。'

 -- C 変数: *note PyTypeObject: c9c. PyWrapperDescr_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object for
     wrapper descriptor objects created by *note PyDescr_NewWrapper():
     5466. and *note PyWrapper_New(): 511f.  Wrapper descriptors are
     used internally to expose special methods implemented via wrapper
     structures, and appear in Python as *note
     types.WrapperDescriptorType: d92. objects.

 -- C の関数: *note PyObject: 5df. *PyDescr_NewClassMethod (PyTypeObject
          *type, PyMethodDef *method)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

 -- C の関数: int PyDescr_IsData (PyObject *descr)

     Return non-zero if the descriptor object 'descr' describes a data
     attribute, or ‘0’ if it describes a method.  'descr' must be a
     descriptor object; there is no error checking.

 -- C の関数: *note PyObject: 5df. *PyWrapper_New (PyObject*, PyObject*)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'

* Menu:

* Built-in descriptors::


File: python.info,  Node: Built-in descriptors,  Up: デスクリプタオブジェクト descriptor object

7.9.6.14 Built-in descriptors
.............................

 -- C 変数: *note PyTypeObject: c9c. PySuper_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object for super
     objects.  This is the same object as *note super: 1a6. in the
     Python layer.

 -- C 変数: *note PyTypeObject: c9c. PyClassMethod_Type

     The type of class method objects.  This is the same object as *note
     classmethod: 48e. in the Python layer.

 -- C 変数: *note PyTypeObject: c9c. PyClassMethodDescr_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object for
     C-level class method descriptor objects.  This is the type of the
     descriptors created for *note classmethod(): 48e. defined in C
     extension types, and is the same object as *note classmethod: 48e.
     in Python.

 -- C の関数: *note PyObject: 5df. *PyClassMethod_New (PyObject
          *callable)

     Create a new *note classmethod: 48e. object wrapping 'callable'.
     'callable' must be a callable object and must not be ‘NULL’.

     On success, this function returns a *note strong reference: 5e2. to
     a new class method descriptor.  On failure, this function returns
     ‘NULL’ with an exception set.

 -- C 変数: *note PyTypeObject: c9c. PyStaticMethod_Type

     The type of static method objects.  This is the same object as
     *note staticmethod: 453. in the Python layer.

 -- C の関数: *note PyObject: 5df. *PyStaticMethod_New (PyObject
          *callable)

     Create a new *note staticmethod: 453. object wrapping 'callable'.
     'callable' must be a callable object and must not be ‘NULL’.

     On success, this function returns a *note strong reference: 5e2. to
     a new static method descriptor.  On failure, this function returns
     ‘NULL’ with an exception set.


File: python.info,  Node: スライスオブジェクト slice object,  Next: memoryview オブジェクト,  Prev: デスクリプタオブジェクト descriptor object,  Up: その他のオブジェクト<2>

7.9.6.15 スライスオブジェクト (slice object)
............................................

 -- C 変数: *note PyTypeObject: c9c. PySlice_Type
     ' 次に属します: *note Stable ABI: 775.'  スライスオブジェクトの型オ
     ブジェクトです。これは、Pythonレイヤにおける *note slice: 694. と同
     じオブジェクトです。

 -- C の関数: int PySlice_Check (PyObject *ob)

     'ob' がスライスオブジェクトの場合に真を返します; 'ob' は ‘NULL’ で
     あってはなりません。この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PySlice_New (PyObject *start,
          PyObject *stop, PyObject *step)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return a new slice object with the given values.  The 'start',
     'stop', and 'step' parameters are used as the values of the slice
     object attributes of the same names.  Any of the values may be
     ‘NULL’, in which case the ‘None’ will be used for the corresponding
     attribute.

     Return ‘NULL’ with an exception set if the new object could not be
     allocated.

 -- C の関数: int PySlice_GetIndices (PyObject *slice, Py_ssize_t
          length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step)
     ' 次に属します: *note Stable ABI: 775.'  スライスオブジェクト
     'slice' における 'start', 'stop', および 'step' のインデクス値を取
     得します。このときシーケンスの長さを 'length' と仮定します。
     'length' よりも大きなインデクスになるとエラーとして扱います。

     Returns ‘0’ on success and ‘-1’ on error with no exception set
     (unless one of the indices was not ‘None’ and failed to be
     converted to an integer, in which case ‘-1’ is returned with an
     exception set).

     おそらく、あなたはこの関数を使いたくないでしょう。

     バージョン 3.2 で変更: 以前は、'slice' 引数の型は ‘PySliceObject*’
     でした。

 -- C の関数: int PySlice_GetIndicesEx (PyObject *slice, Py_ssize_t
          length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step,
          Py_ssize_t *slicelength)
     ' 次に属します: *note Stable ABI: 775.'  *note
     PySlice_GetIndices(): 50b1. の便利な代替です。 'slice' における、
     'start', 'stop' および 'step' のインデクス値を取得をします。シーケ
     ンスの長さを 'length' 、スライスの長さを 'slicelength' に格納します
     。境界外のインデクスは通常のスライスと一貫した方法でクリップされま
     す。

     Return ‘0’ on success and ‘-1’ on error with an exception set.

          注釈: This function is considered not safe for resizable
          sequences.  Its invocation should be replaced by a combination
          of *note PySlice_Unpack(): 432. and *note
          PySlice_AdjustIndices(): 433. where

               if (PySlice_GetIndicesEx(slice, length, &start, &stop, &step, &slicelength) < 0) {
                   // return error
               }

          is replaced by

               if (PySlice_Unpack(slice, &start, &stop, &step) < 0) {
                   // return error
               }
               slicelength = PySlice_AdjustIndices(length, &start, &stop, step);

     バージョン 3.2 で変更: 以前は、'slice' 引数の型は ‘PySliceObject*’
     でした。

     バージョン 3.6.1 で変更: If ‘Py_LIMITED_API’ is not set or set to
     the value between ‘0x03050400’ and ‘0x03060000’ (not including) or
     ‘0x03060100’ or higher ‘PySlice_GetIndicesEx()’ is implemented as a
     macro using ‘PySlice_Unpack()’ and ‘PySlice_AdjustIndices()’.
     Arguments 'start', 'stop' and 'step' are evaluated more than once.

     バージョン 3.6.1 で非推奨: If ‘Py_LIMITED_API’ is set to the value
     less than ‘0x03050400’ or between ‘0x03060000’ and ‘0x03060100’
     (not including) ‘PySlice_GetIndicesEx()’ is a deprecated function.

 -- C の関数: int PySlice_Unpack (PyObject *slice, Py_ssize_t *start,
          Py_ssize_t *stop, Py_ssize_t *step)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     Extract the start, stop and step data members from a slice object
     as C integers.  Silently reduce values larger than ‘PY_SSIZE_T_MAX’
     to ‘PY_SSIZE_T_MAX’, silently boost the start and stop values less
     than ‘PY_SSIZE_T_MIN’ to ‘PY_SSIZE_T_MIN’, and silently boost the
     step values less than ‘-PY_SSIZE_T_MAX’ to ‘-PY_SSIZE_T_MAX’.

     Return ‘-1’ with an exception set on error, ‘0’ on success.

     Added in version 3.6.1.

 -- C の関数: *note Py_ssize_t: c55. PySlice_AdjustIndices (Py_ssize_t
          length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     Adjust start/end slice indices assuming a sequence of the specified
     length.  Out of bounds indices are clipped in a manner consistent
     with the handling of normal slices.

     Return the length of the slice.  Always successful.  Doesn't call
     Python code.

     Added in version 3.6.1.

* Menu:

* Ellipsis オブジェクト: Ellipsis オブジェクト<2>.


File: python.info,  Node: Ellipsis オブジェクト<2>,  Up: スライスオブジェクト slice object

7.9.6.16 Ellipsis オブジェクト
..............................

 -- C 変数: *note PyTypeObject: c9c. PyEllipsis_Type
     ' 次に属します: *note Stable ABI: 775.'  The type of Python *note
     Ellipsis: 2328. object.  Same as *note types.EllipsisType: a51. in
     the Python layer.

 -- C 変数: *note PyObject: 5df. *Py_Ellipsis

     Python の ‘Ellipsis’ オブジェクト。このオブジェクトにはメソッドがあ
     りません。 *note Py_None: 4e9f. と同様、これは *note immortal: 290.
     でシングルトンなオブジェクトです。

     バージョン 3.12 で変更: *note Py_Ellipsis: 5472. は immortal です。


File: python.info,  Node: memoryview オブジェクト,  Next: Pickle buffer objects,  Prev: スライスオブジェクト slice object,  Up: その他のオブジェクト<2>

7.9.6.17 memoryview オブジェクト
................................

*note memoryview: 165. オブジェクトは、他のオブジェクトと同じように扱え
る Python オブジェクトの形をした C 言語レベルの *note
バッファのインターフェース: 260. です。

 -- C 変数: *note PyTypeObject: c9c. PyMemoryView_Type
     ' 次に属します: *note Stable ABI: 775.'  This instance of *note
     PyTypeObject: c9c. represents the Python memoryview type.  This is
     the same object as *note memoryview: 165. in the Python layer.

 -- C の関数: *note PyObject: 5df. *PyMemoryView_FromObject (PyObject
          *obj)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'  バッ
     ファインターフェースを提供するオブジェクトからmemoryview オブジェク
     トを生成します。もし 'obj' が書き込み可能なバッファのエクスポートを
     サポートするなら、その memoryview オブジェクトは読み書き可能です。
     そうでなければ読出しのみになるか、エクスポーターの分別にもとづいて
     読み書きが可能となります。

 -- C のマクロ: PyBUF_READ
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'
     Flag to request a readonly buffer.

 -- C のマクロ: PyBUF_WRITE
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'
     Flag to request a writable buffer.

 -- C の関数: *note PyObject: 5df. *PyMemoryView_FromMemory (char *mem,
          Py_ssize_t size, int flags)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.7 より).'  'mem' を配下のバッファとしてmemoryview オブジェ
     クトを作成します。 'flags' は *note PyBUF_READ: 1a0b. か *note
     PyBUF_WRITE: 1a0c. のどちらかになります。

     Added in version 3.3.

 -- C の関数: *note PyObject: 5df. *PyMemoryView_FromBuffer (const
          Py_buffer *view)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.11 より).'  'view' として与えられたバッファ構造をラップす
     る memoryview オブジェクトを作成します。単なるバイトバッファ向けに
     は、 *note PyMemoryView_FromMemory(): 1388. のほうが望ましいです。

 -- C の関数: *note PyObject: 5df. *PyMemoryView_GetContiguous (PyObject
          *obj, int buffertype, char order)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     buffer インターフェースを定義しているオブジェクトから ('C' か
     'F'ortran の 'order' で) *note 連続した: 124e. メモリチャンクへの
     memoryview オブジェクトを作ります。メモリが連続している場合、
     memoryview オブジェクトは元のメモリを参照します。それ以外の場合、メ
     モリはコピーされて、 memoryview オブジェクトは新しい bytes オブジェ
     クトを参照します。

     'buffertype' can be one of *note PyBUF_READ: 1a0b. or *note
     PyBUF_WRITE: 1a0c.

 -- C の関数: int PyMemoryView_Check (PyObject *obj)

     'obj' が memoryview オブジェクトの場合に真を返します。現在のところ
     、 *note memoryview: 165. のサブクラスの作成は許可されていません。
     この関数は常に成功します。

 -- C の関数: *note Py_buffer: 95c. *PyMemoryView_GET_BUFFER (PyObject
          *mview)

     書きだされたバッファーの memoryview のプライベート コピーに、ポイン
     ターを返します。 'mview' は memoryview インスタンスでなければなりま
     せん; このマクロは型をチェックしないので自前で型チェックしなければ
     ならず、それを怠るとクラッシュする恐れがあります。

 -- C の関数: *note PyObject: 5df. *PyMemoryView_GET_BASE (PyObject
          *mview)

     memoryview をエクスポートしているオブジェクトへのポインタを返します
     。 memoryview が *note PyMemoryView_FromMemory(): 1388. か *note
     PyMemoryView_FromBuffer(): 965. のどちらかで作成されていた場合、
     ‘NULL’ を返します。


File: python.info,  Node: Pickle buffer objects,  Next: 弱参照オブジェクト<2>,  Prev: memoryview オブジェクト,  Up: その他のオブジェクト<2>

7.9.6.18 Pickle buffer objects
..............................

Added in version 3.8.

A *note pickle.PickleBuffer: 177b. object wraps a *note buffer-providing
object: 260. for out-of-band data transfer with the *note pickle: ab.
module.

 -- C 変数: *note PyTypeObject: c9c. PyPickleBuffer_Type

     This instance of *note PyTypeObject: c9c. represents the Python
     pickle buffer type.  This is the same object as *note
     pickle.PickleBuffer: 177b. in the Python layer.

 -- C の関数: int PyPickleBuffer_Check (PyObject *op)

     Return true if 'op' is a pickle buffer instance.  This function
     always succeeds.

 -- C の関数: *note PyObject: 5df. *PyPickleBuffer_FromObject (PyObject
          *obj)

     Create a pickle buffer from the object 'obj'.

     This function will fail if 'obj' doesn't support the *note buffer
     protocol: 260.

     On success, return a new pickle buffer instance.  On failure, set
     an exception and return ‘NULL’.

     Analogous to calling *note pickle.PickleBuffer: 177b. with 'obj' in
     Python.

 -- C の関数: const *note Py_buffer: 95c. *PyPickleBuffer_GetBuffer
          (PyObject *picklebuf)

     Get a pointer to the underlying *note Py_buffer: 95c. that the
     pickle buffer wraps.

     The returned pointer is valid as long as 'picklebuf' is alive and
     has not been released.  The caller must not modify or free the
     returned *note Py_buffer: 95c.  If the pickle buffer has been
     released, raise *note ValueError: 2ec.

     On success, return a pointer to the buffer view.  On failure, set
     an exception and return ‘NULL’.

 -- C の関数: int PyPickleBuffer_Release (PyObject *picklebuf)

     Release the underlying buffer held by the pickle buffer.

     Return ‘0’ on success.  On failure, set an exception and return
     ‘-1’.

     Analogous to calling *note pickle.PickleBuffer.release(): 2d1c. in
     Python.


File: python.info,  Node: 弱参照オブジェクト<2>,  Next: カプセル<2>,  Prev: Pickle buffer objects,  Up: その他のオブジェクト<2>

7.9.6.19 弱参照オブジェクト
...........................

Python は '弱参照' を第一級オブジェクト (first-class object) としてサポ
ートします。弱参照を直接実装する二種類の固有のオブジェクト型があります。
第一は単純な参照オブジェクトで、第二はオリジナルのオブジェクトに対して可
能な限りプロキシとして振舞うオブジェクトです。

 -- C の関数: int PyWeakref_Check (PyObject *ob)

     Return non-zero if 'ob' is either a reference or proxy object.
     This function always succeeds.

 -- C の関数: int PyWeakref_CheckRef (PyObject *ob)

     Return non-zero if 'ob' is a reference object or a subclass of the
     reference type.  This function always succeeds.

 -- C の関数: int PyWeakref_CheckRefExact (PyObject *ob)

     Return non-zero if 'ob' is a reference object, but not a subclass
     of the reference type.  This function always succeeds.

 -- C の関数: int PyWeakref_CheckProxy (PyObject *ob)

     Return non-zero if 'ob' is a proxy object.  This function always
     succeeds.

 -- C の関数: *note PyObject: 5df. *PyWeakref_NewRef (PyObject *ob,
          PyObject *callback)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return a weak reference object for the object 'ob'.  This will
     always return a new reference, but is not guaranteed to create a
     new object; an existing reference object may be returned.  The
     second parameter, 'callback', can be a callable object that
     receives notification when 'ob' is garbage collected; it should
     accept a single parameter, which will be the weak reference object
     itself.  'callback' may also be ‘None’ or ‘NULL’.  If 'ob' is not a
     weakly referenceable object, or if 'callback' is not callable,
     ‘None’, or ‘NULL’, this will return ‘NULL’ and raise *note
     TypeError: 198.

     参考
     ....

     *note PyType_SUPPORTS_WEAKREFS(): 52e4. for checking if 'ob' is
     weakly referenceable.

 -- C の関数: *note PyObject: 5df. *PyWeakref_NewProxy (PyObject *ob,
          PyObject *callback)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Return a weak reference proxy object for the object 'ob'.  This
     will always return a new reference, but is not guaranteed to create
     a new object; an existing proxy object may be returned.  The second
     parameter, 'callback', can be a callable object that receives
     notification when 'ob' is garbage collected; it should accept a
     single parameter, which will be the weak reference object itself.
     'callback' may also be ‘None’ or ‘NULL’.  If 'ob' is not a weakly
     referenceable object, or if 'callback' is not callable, ‘None’, or
     ‘NULL’, this will return ‘NULL’ and raise *note TypeError: 198.

     参考
     ....

     *note PyType_SUPPORTS_WEAKREFS(): 52e4. for checking if 'ob' is
     weakly referenceable.

 -- C の関数: int PyWeakref_GetRef (PyObject *ref, PyObject **pobj)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Get a *note strong reference: 5e2. to the referenced object from a
     weak reference, 'ref', into '*pobj'.

        * On success, set '*pobj' to a new *note strong reference: 5e2.
          to the referenced object and return 1.

        * If the reference is dead, set '*pobj' to ‘NULL’ and return 0.

        * On error, raise an exception and return -1.

     Added in version 3.13.

 -- C の関数: *note PyObject: 5df. *PyWeakref_GetObject (PyObject *ref)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  Return
     a *note borrowed reference: 3d7. to the referenced object from a
     weak reference, 'ref'.  If the referent is no longer live, returns
     ‘Py_None’.

          注釈: This function returns a *note borrowed reference: 3d7.
          to the referenced object.  This means that you should always
          call *note Py_INCREF(): 78f. on the object except when it
          cannot be destroyed before the last usage of the borrowed
          reference.

     Deprecated since version 3.13, will be removed in version 3.15: Use
     *note PyWeakref_GetRef(): 3df. instead.

 -- C の関数: *note PyObject: 5df. *PyWeakref_GET_OBJECT (PyObject *ref)
     '戻り値: 借用参照。' Similar to *note PyWeakref_GetObject(): 3dd,
     but does no error checking.

     Deprecated since version 3.13, will be removed in version 3.15: Use
     *note PyWeakref_GetRef(): 3df. instead.

 -- C の関数: int PyWeakref_IsDead (PyObject *ref)

     Test if the weak reference 'ref' is dead.  Returns 1 if the
     reference is dead, 0 if it is alive, and -1 with an error set if
     'ref' is not a weak reference object.

     Added in version 3.14.

 -- C の関数: void PyObject_ClearWeakRefs (PyObject *object)
     ' 次に属します: *note Stable ABI: 775.'  This function is called by
     the *note tp_dealloc: 4ebc. handler to clear weak references.

     This iterates through the weak references for 'object' and calls
     callbacks for those references which have one.  It returns when all
     callbacks have been attempted.

 -- C の関数: void PyUnstable_Object_ClearWeakRefsNoCallbacks (PyObject
          *object)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Clears the weakrefs for 'object' without calling the callbacks.

     This function is called by the *note tp_dealloc: 4ebc. handler for
     types with finalizers (i.e., *note __del__(): 11ff.).  The handler
     for those objects first calls *note PyObject_ClearWeakRefs(): 796.
     to clear weakrefs and call their callbacks, then the finalizer, and
     finally this function to clear any weakrefs that may have been
     created by the finalizer.

     In most circumstances, it's more appropriate to use *note
     PyObject_ClearWeakRefs(): 796. to clear weakrefs instead of this
     function.

     Added in version 3.13.


File: python.info,  Node: カプセル<2>,  Next: フレーム frame オブジェクト<2>,  Prev: 弱参照オブジェクト<2>,  Up: その他のオブジェクト<2>

7.9.6.20 カプセル
.................

‘using-capsules’ 以下のオブジェクトを使う方法については *note
拡張モジュールに C API を提供する: 1575. を参照してください。

Added in version 3.1.

 -- C のデータ型: type PyCapsule

     This subtype of *note PyObject: 5df. represents an opaque value,
     useful for C extension modules which need to pass an opaque value
     (as a void* pointer) through Python code to other C code.  It is
     often used to make a C function pointer defined in one module
     available to other modules, so the regular import mechanism can be
     used to access C APIs defined in dynamically loaded modules.

 -- C 変数: *note PyTypeObject: c9c. PyCapsule_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object
     corresponding to capsule objects.  This is the same object as *note
     types.CapsuleType: 29f2. in the Python layer.

 -- C のデータ型: type PyCapsule_Destructor
     ' 次に属します: *note Stable ABI: 775.'  カプセルに対するデストラク
     タコールバック型.  次のように定義されます:

          typedef void (*PyCapsule_Destructor)(PyObject *);

     PyCapsule_Destructor コールバックの動作については *note
     PyCapsule_New(): 4ec3. を参照してください。

 -- C の関数: int PyCapsule_CheckExact (PyObject *p)

     引数が *note PyCapsule: 148a. の場合に真を返します。この関数は常に
     成功します。

 -- C の関数: *note PyObject: 5df. *PyCapsule_New (void *pointer, const
          char *name, PyCapsule_Destructor destructor)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     'pointer' を格納する *note PyCapsule: 148a. を作成します。
     'pointer' 引数は ‘NULL’ であってはなりません。

     失敗した場合、例外を設定して ‘NULL’ を返します。

     'name' 文字列は ‘NULL’ か、有効なC文字列へのポインタです。‘NULL’ で
     無い場合、この文字列は少なくともカプセルより長く生存する必要があり
     ます。('destructor' の中で解放することは許可されています)

     'destructor' が ‘NULL’ で無い場合、カプセルが削除されるときにそのカ
     プセルを引数として呼び出されます。

     このカプセルがモジュールの属性として保存される場合、 'name' は
     ‘modulename.attributename’ と指定されるべきです。こうすると、他のモ
     ジュールがそのカプセルを *note PyCapsule_Import(): 1c10. でインポー
     トすることができます。

 -- C の関数: void *PyCapsule_GetPointer (PyObject *capsule, const char
          *name)
     ' 次に属します: *note Stable ABI: 775.'  カプセルに保存されている
     'pointer' を取り出します。失敗した場合は例外を設定して ‘NULL’ を返
     します。

     The 'name' parameter must compare exactly to the name stored in the
     capsule.  If the name stored in the capsule is ‘NULL’, the 'name'
     passed in must also be ‘NULL’.  Python uses the C function
     ‘strcmp()’ to compare capsule names.

 -- C の関数: *note PyCapsule_Destructor: 4f93. PyCapsule_GetDestructor
          (PyObject *capsule)
     ' 次に属します: *note Stable ABI: 775.'  カプセルに保存されている現
     在のデストラクタを返します。失敗した場合、例外を設定して ‘NULL’ を
     返します。

     カプセルは ‘NULL’ をデストラクタとして持つことができます。従って、
     戻り値の ‘NULL’ がエラーを指してない可能性があります。 *note
     PyCapsule_IsValid(): 1574. か *note PyErr_Occurred(): 1caf. を利用
     して確認してください。

 -- C の関数: void *PyCapsule_GetContext (PyObject *capsule)
     ' 次に属します: *note Stable ABI: 775.'  カプセルに保存されている現
     在のコンテキスト(context)を返します。失敗した場合、例外を設定して
     ‘NULL’ を返します。

     カプセルは ‘NULL’ をコンテキストとして持つことができます。従って、
     戻り値の ‘NULL’ がエラーを指してない可能性があります。 *note
     PyCapsule_IsValid(): 1574. か *note PyErr_Occurred(): 1caf. を利用
     して確認してください。

 -- C の関数: const char *PyCapsule_GetName (PyObject *capsule)
     ' 次に属します: *note Stable ABI: 775.'  カプセルに保存されている現
     在の name を返します。失敗した場合、例外を設定して ‘NULL’ を返しま
     す。

     カプセルは ‘NULL’ を name として持つことができます。従って、戻り値
     の ‘NULL’ がエラーを指してない可能性があります。 *note
     PyCapsule_IsValid(): 1574. か *note PyErr_Occurred(): 1caf. を利用
     して確認してください。

 -- C の関数: void *PyCapsule_Import (const char *name, int no_block)
     ' 次に属します: *note Stable ABI: 775.'  Import a pointer to a C
     object from a capsule attribute in a module.  The 'name' parameter
     should specify the full name to the attribute, as in
     ‘module.attribute’.  The 'name' stored in the capsule must match
     this string exactly.

     This function splits 'name' on the ‘.’ character, and imports the
     first element.  It then processes further elements using attribute
     lookups.

     成功した場合、カプセルの内部 'ポインタ' を返します。失敗した場合、
     例外を設定して ‘NULL’ を返します。

          注釈: If 'name' points to an attribute of some submodule or
          subpackage, this submodule or subpackage must be previously
          imported using other means (for example, by using *note
          PyImport_ImportModule(): 3dc.) for the attribute lookups to
          succeed.

     バージョン 3.3 で変更: 'no_block' has no effect anymore.

 -- C の関数: int PyCapsule_IsValid (PyObject *capsule, const char
          *name)
     ' 次に属します: *note Stable ABI: 775.'  'capsule' が有効なカプセル
     であるかどうかをチェックします。有効な 'capsule' は、非 ‘NULL’ で、
     *note PyCapsule_CheckExact(): 548c. をパスし、非 ‘NULL’ なポインタ
     を格納していて、内部の name が引数 'name' とマッチします。 (name の
     比較方法については *note PyCapsule_GetPointer(): 4f97. を参照)

     In other words, if *note PyCapsule_IsValid(): 1574. returns a true
     value, calls to any of the accessors (any function starting with
     ‘PyCapsule_Get’) are guaranteed to succeed.

     オブジェクトが有効で name がマッチした場合に非 ‘0’ を、それ以外の場
     合に ‘0’ を返します。この関数は絶対に失敗しません。

 -- C の関数: int PyCapsule_SetContext (PyObject *capsule, void
          *context)
     ' 次に属します: *note Stable ABI: 775.'  'capsule' 内部のコンテキス
     トポインタを 'context' に設定します。

     成功したら ‘0’ を、失敗したら例外を設定して非 ‘0’ を返します。

 -- C の関数: int PyCapsule_SetDestructor (PyObject *capsule,
          PyCapsule_Destructor destructor)
     ' 次に属します: *note Stable ABI: 775.'  'capsule' 内部のデストラク
     タを 'destructor' に設定します。

     成功したら ‘0’ を、失敗したら例外を設定して非 ‘0’ を返します。

 -- C の関数: int PyCapsule_SetName (PyObject *capsule, const char
          *name)
     ' 次に属します: *note Stable ABI: 775.'  'capsule' 内部の name を
     'name' に設定します。'name' が非 ‘NULL’ のとき、それは 'capsule' よ
     りも長い寿命を持つ必要があります。もしすでに 'capsule' に非 ‘NULL’
     の 'name' が保存されていた場合、それに対する解放は行われません。

     成功したら ‘0’ を、失敗したら例外を設定して非 ‘0’ を返します。

 -- C の関数: int PyCapsule_SetPointer (PyObject *capsule, void
          *pointer)
     ' 次に属します: *note Stable ABI: 775.'  'capsule' 内部のポインタを
     'pointer' に設定します。'pointer' は ‘NULL’ であってはなりません。

     成功したら ‘0’ を、失敗したら例外を設定して非 ‘0’ を返します。


File: python.info,  Node: フレーム frame オブジェクト<2>,  Next: ジェネレータオブジェクト,  Prev: カプセル<2>,  Up: その他のオブジェクト<2>

7.9.6.21 フレーム (frame) オブジェクト
......................................

 -- C のデータ型: type PyFrameObject
     ' 次に属します: *note Limited API: 775. (不透明な構造体として).'  フ
     レームオブジェクトを記述する際に用いられる、オブジェクトを表す C 構
     造体です。

     There are no public members in this structure.

     バージョン 3.11 で変更: The members of this structure were removed
     from the public C API. Refer to the *note What's New entry: 98b.
     for details.

The *note PyEval_GetFrame(): 1b39. and *note PyThreadState_GetFrame():
991. functions can be used to get a frame object.

See also *note Reflection: 5262.

 -- C 変数: *note PyTypeObject: c9c. PyFrame_Type

     The type of frame objects.  It is the same object as *note
     types.FrameType: 1bee. in the Python layer.

     バージョン 3.11 で変更: Previously, this type was only available
     after including ‘<frameobject.h>’.

 -- C の関数: *note PyFrameObject: 98c. *PyFrame_New (PyThreadState
          *tstate, PyCodeObject *code, PyObject *globals, PyObject
          *locals)

     Create a new frame object.  This function returns a *note strong
     reference: 5e2. to the new frame object on success, and returns
     ‘NULL’ with an exception set on failure.

 -- C の関数: int PyFrame_Check (PyObject *obj)

     Return non-zero if 'obj' is a frame object.

     バージョン 3.11 で変更: Previously, this function was only
     available after including ‘<frameobject.h>’.

 -- C の関数: *note PyFrameObject: 98c. *PyFrame_GetBack (PyFrameObject
          *frame)
     '戻り値: 新しい参照。' Get the 'frame' next outer frame.

     Return a *note strong reference: 5e2, or ‘NULL’ if 'frame' has no
     outer frame.

     Added in version 3.9.

 -- C の関数: *note PyObject: 5df. *PyFrame_GetBuiltins (PyFrameObject
          *frame)
     '戻り値: 新しい参照。' Get the 'frame"s *note f_builtins: 239b.
     attribute.

     Return a *note strong reference: 5e2.  The result cannot be ‘NULL’.

     Added in version 3.11.

 -- C の関数: *note PyCodeObject: 97b. *PyFrame_GetCode (PyFrameObject
          *frame)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.10 より).'  Get the 'frame' code.

     Return a *note strong reference: 5e2.

     The result (frame code) cannot be ‘NULL’.

     Added in version 3.9.

 -- C の関数: *note PyObject: 5df. *PyFrame_GetGenerator (PyFrameObject
          *frame)
     '戻り値: 新しい参照。' Get the generator, coroutine, or async
     generator that owns this frame, or ‘NULL’ if this frame is not
     owned by a generator.  Does not raise an exception, even if the
     return value is ‘NULL’.

     Return a *note strong reference: 5e2, or ‘NULL’.

     Added in version 3.11.

 -- C の関数: *note PyObject: 5df. *PyFrame_GetGlobals (PyFrameObject
          *frame)
     '戻り値: 新しい参照。' Get the 'frame"s *note f_globals: 239a.
     attribute.

     Return a *note strong reference: 5e2.  The result cannot be ‘NULL’.

     Added in version 3.11.

 -- C の関数: int PyFrame_GetLasti (PyFrameObject *frame)

     Get the 'frame"s *note f_lasti: a88. attribute.

     Returns -1 if ‘frame.f_lasti’ is ‘None’.

     Added in version 3.11.

 -- C の関数: *note PyObject: 5df. *PyFrame_GetVar (PyFrameObject
          *frame, PyObject *name)
     '戻り値: 新しい参照。' Get the variable 'name' of 'frame'.

        * Return a *note strong reference: 5e2. to the variable value on
          success.

        * Raise *note NameError: 452. and return ‘NULL’ if the variable
          does not exist.

        * Raise an exception and return ‘NULL’ on error.

     'name' type must be a *note str: 169.

     Added in version 3.12.

 -- C の関数: *note PyObject: 5df. *PyFrame_GetVarString (PyFrameObject
          *frame, const char *name)
     '戻り値: 新しい参照。' Similar to *note PyFrame_GetVar(): 789, but
     the variable name is a C string encoded in UTF-8.

     Added in version 3.12.

 -- C の関数: *note PyObject: 5df. *PyFrame_GetLocals (PyFrameObject
          *frame)
     '戻り値: 新しい参照。' Get the 'frame"s *note f_locals: 4a5.
     attribute.  If the frame refers to an *note optimized scope: 4a1,
     this returns a write-through proxy object that allows modifying the
     locals.  In all other cases (classes, modules, *note exec(): 4a2,
     *note eval(): 4a3.) it returns the mapping representing the frame
     locals directly (as described for *note locals(): 46f.).

     Return a *note strong reference: 5e2.

     Added in version 3.11.

     バージョン 3.13 で変更: As part of PEP 667(1), return an instance
     of *note PyFrameLocalsProxy_Type: 5490.

 -- C の関数: int PyFrame_GetLineNumber (PyFrameObject *frame)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     'frame' が現在実行している行番号を返します。

* Menu:

* Frame Locals Proxies::
* Legacy Local Variable APIs::
* Internal Frames::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0667/


File: python.info,  Node: Frame Locals Proxies,  Next: Legacy Local Variable APIs,  Up: フレーム frame オブジェクト<2>

7.9.6.22 Frame Locals Proxies
.............................

Added in version 3.13.

The *note f_locals: 4a5. attribute on a *note frame object: 8ef. is an
instance of a "frame-locals proxy".  The proxy object exposes a
write-through view of the underlying locals dictionary for the frame.
This ensures that the variables exposed by ‘f_locals’ are always up to
date with the live local variables in the frame itself.

See PEP 667(1) for more information.

 -- C 変数: *note PyTypeObject: c9c. PyFrameLocalsProxy_Type

     The type of frame *note locals(): 46f. proxy objects.

 -- C の関数: int PyFrameLocalsProxy_Check (PyObject *obj)

     Return non-zero if 'obj' is a frame *note locals(): 46f. proxy.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0667/


File: python.info,  Node: Legacy Local Variable APIs,  Next: Internal Frames,  Prev: Frame Locals Proxies,  Up: フレーム frame オブジェクト<2>

7.9.6.23 Legacy Local Variable APIs
...................................

These APIs are *note soft deprecated: 23d.  As of Python 3.13, they do
nothing.  They exist solely for backwards compatibility.

 -- C の関数: void PyFrame_LocalsToFast (PyFrameObject *f, int clear)

     This function is *note soft deprecated: 23d. and does nothing.

     Prior to Python 3.13, this function would copy the *note f_locals:
     4a5. attribute of 'f' to the internal "fast" array of local
     variables, allowing changes in frame objects to be visible to the
     interpreter.  If 'clear' was true, this function would process
     variables that were unset in the locals dictionary.

     バージョン 3.13 で変更: This function now does nothing.

 -- C の関数: void PyFrame_FastToLocals (PyFrameObject *f)

     This function is *note soft deprecated: 23d. and does nothing.

     Prior to Python 3.13, this function would copy the internal "fast"
     array of local variables (which is used by the interpreter) to the
     *note f_locals: 4a5. attribute of 'f', allowing changes in local
     variables to be visible to frame objects.

     バージョン 3.13 で変更: This function now does nothing.

 -- C の関数: int PyFrame_FastToLocalsWithError (PyFrameObject *f)

     This function is *note soft deprecated: 23d. and does nothing.

     Prior to Python 3.13, this function was similar to *note
     PyFrame_FastToLocals(): 5495, but would return ‘0’ on success, and
     ‘-1’ with an exception set on failure.

     バージョン 3.13 で変更: This function now does nothing.

参考
....

PEP 667(1)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0667/


File: python.info,  Node: Internal Frames,  Prev: Legacy Local Variable APIs,  Up: フレーム frame オブジェクト<2>

7.9.6.24 Internal Frames
........................

Unless using PEP 523(1), you will not need this.

 -- C Struct: struct _PyInterpreterFrame

     The interpreter's internal frame representation.

     Added in version 3.11.

 -- C の関数: *note PyObject: 5df. *PyUnstable_InterpreterFrame_GetCode
          (struct _PyInterpreterFrame *frame);

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
          Return a *note strong reference: 5e2. to the code object for
          the frame.

     Added in version 3.12.

 -- C の関数: int PyUnstable_InterpreterFrame_GetLasti (struct
          _PyInterpreterFrame *frame);

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Return the byte offset into the last executed instruction.

     Added in version 3.12.

 -- C の関数: int PyUnstable_InterpreterFrame_GetLine (struct
          _PyInterpreterFrame *frame);

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Return the currently executing line number, or -1 if there is no
     line number.

     Added in version 3.12.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0523/


File: python.info,  Node: ジェネレータオブジェクト,  Next: コルーチンオブジェクト<2>,  Prev: フレーム frame オブジェクト<2>,  Up: その他のオブジェクト<2>

7.9.6.25 ジェネレータオブジェクト
.................................

ジェネレータオブジェクトは、 Python がジェネレータイテレータを実装するの
に使っているオブジェクトです。ジェネレータオブジェクトは通常、 *note
PyGen_New(): 549f. や *note PyGen_NewWithQualName(): 54a0. の明示的な呼
び出しではなく、値を yield する関数のイテレーションにより生成されます。

 -- C のデータ型: type PyGenObject

     ジェネレータオブジェクトに使われている C 構造体です。

 -- C 変数: *note PyTypeObject: c9c. PyGen_Type

     ジェネレータオブジェクトに対応する型オブジェクトです。

 -- C の関数: int PyGen_Check (PyObject *ob)

     'ob' がジェネレータオブジェクトの場合に真を返ます、 'ob' は ‘NULL’
     であってはなりません。この関数は常に成功します。

 -- C の関数: int PyGen_CheckExact (PyObject *ob)

     'ob' が *note PyGen_Type: 54a2. の場合に真を返します。 'o' は
     ‘NULL’ であってはなりません。 この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyGen_New (PyFrameObject *frame)
     '戻り値: 新しい参照。' 'frame' オブジェクトに基づいて新たなジェネレ
     ータオブジェクトを生成して返します。 この関数は 'frame' への参照を
     盗みます。 引数が ‘NULL’ であってはなりません。

 -- C の関数: *note PyObject: 5df. *PyGen_NewWithQualName (PyFrameObject
          *frame, PyObject *name, PyObject *qualname)
     '戻り値: 新しい参照。' 'frame' オブジェクトから新たなジェネレータオ
     ブジェクトを生成し、 ‘__name__’ と ‘__qualname__’ を 'name' と
     'qualname' に設定して返します。 この関数は 'frame' への参照を盗みま
     す。 'frame' 引数は ‘NULL’ であってはなりません。

 -- C の関数: *note PyCodeObject: 97b. *PyGen_GetCode (PyGenObject *gen)

     Return a new *note strong reference: 5e2. to the code object
     wrapped by 'gen'.  This function always succeeds.

* Menu:

* Asynchronous Generator Objects::
* Deprecated API: Deprecated API<5>.


File: python.info,  Node: Asynchronous Generator Objects,  Next: Deprecated API<5>,  Up: ジェネレータオブジェクト

7.9.6.26 Asynchronous Generator Objects
.......................................

参考
....

PEP 525(1)

 -- C 変数: *note PyTypeObject: c9c. PyAsyncGen_Type

     The type object corresponding to asynchronous generator objects.
     This is available as *note types.AsyncGeneratorType: 29e7. in the
     Python layer.

     Added in version 3.6.

 -- C の関数: *note PyObject: 5df. *PyAsyncGen_New (PyFrameObject
          *frame, PyObject *name, PyObject *qualname)

     Create a new asynchronous generator wrapping 'frame', with
     ‘__name__’ and ‘__qualname__’ set to 'name' and 'qualname'.
     'frame' is stolen by this function and must not be ‘NULL’.

     On success, this function returns a *note strong reference: 5e2. to
     the new asynchronous generator.  On failure, this function returns
     ‘NULL’ with an exception set.

     Added in version 3.6.

 -- C の関数: int PyAsyncGen_CheckExact (PyObject *op)

     Return true if 'op' is an asynchronous generator object, false
     otherwise.  This function always succeeds.

     Added in version 3.6.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0525/


File: python.info,  Node: Deprecated API<5>,  Prev: Asynchronous Generator Objects,  Up: ジェネレータオブジェクト

7.9.6.27 Deprecated API
.......................

 -- C のマクロ: PyAsyncGenASend_CheckExact (op)

     This is a *note soft deprecated: 23d. API that was included in
     Python's C API by mistake.

     It is solely here for completeness; do not use this API.


File: python.info,  Node: コルーチンオブジェクト<2>,  Next: コンテキスト変数オブジェクト,  Prev: ジェネレータオブジェクト,  Up: その他のオブジェクト<2>

7.9.6.28 コルーチンオブジェクト
...............................

Added in version 3.5.

コルーチンオブジェクトは ‘async’ キーワードを使って定義した関数が返すオ
ブジェクトです。

 -- C のデータ型: type PyCoroObject

     コルーチンオブジェクトのための C 構造体。

 -- C 変数: *note PyTypeObject: c9c. PyCoro_Type

     コルーチンオブジェクトに対応する型オブジェクト。

 -- C の関数: int PyCoro_CheckExact (PyObject *ob)

     'ob' が *note PyCoro_Type: 54b0. の場合に真を返します。 'ob' は
     ‘NULL’ であってはなりません。 この関数は常に成功します。

 -- C の関数: *note PyObject: 5df. *PyCoro_New (PyFrameObject *frame,
          PyObject *name, PyObject *qualname)
     '戻り値: 新しい参照。' 'frame' オブジェクトから新しいコルーチンオブ
     ジェクトを生成して、 ‘__name__’ と ‘__qualname__’ を 'name' と
     'qualname' に設定して返します。 この関数は 'frame' への参照を奪いま
     す。 'frame' 引数は ‘NULL’ であってはなりません。


File: python.info,  Node: コンテキスト変数オブジェクト,  Next: 型ヒントのためのオブジェクト,  Prev: コルーチンオブジェクト<2>,  Up: その他のオブジェクト<2>

7.9.6.29 コンテキスト変数オブジェクト
.....................................

Added in version 3.7.

バージョン 3.7.1 で変更:

     注釈: Python 3.7.1 で全てのコンテキスト変数の C API のシグネチャは
     、 *note PyContext: 54b6, *note PyContextVar: 54b7, *note
     PyContextToken: 54b8. の代わりに *note PyObject: 5df. ポインタを使
     うように '変更' されました。例えば:

          // in 3.7.0:
          PyContext *PyContext_New(void);

          // in 3.7.1+:
          PyObject *PyContext_New(void);

     詳細は bpo-34762(1) を参照してください。

この節では、 *note contextvars: 28. モジュールの公開 C API の詳細につい
て説明します。

 -- C のデータ型: type PyContext

     *note contextvars.Context: 177. オブジェクトを表現するための C 構造
     体。

 -- C のデータ型: type PyContextVar

     *note contextvars.ContextVar: 1875. オブジェクトを表現するための C
     構造体。

 -- C のデータ型: type PyContextToken

     *note contextvars.Token: 1e2. オブジェクトを表現するための C 構造体
     。

 -- C 変数: *note PyTypeObject: c9c. PyContext_Type

     'コンテキスト' 型を表現する型オブジェクト。

 -- C 変数: *note PyTypeObject: c9c. PyContextVar_Type

     'コンテキスト変数' 型を表現する型オブジェクト。

 -- C 変数: *note PyTypeObject: c9c. PyContextToken_Type

     'コンテキスト変数トークン' 型を表現する型オブジェクト。

型チェックマクロ:

 -- C の関数: int PyContext_CheckExact (PyObject *o)

     'o' が *note PyContext_Type: 54b9. の場合に真を返します。 'o' は
     ‘NULL’ であってはなりません。 この関数は常に成功します。

 -- C の関数: int PyContextVar_CheckExact (PyObject *o)

     'o' が *note PyContextVar_Type: 54ba. の場合に真を返します。 'o' は
     ‘NULL’ であってはなりません。 この関数は常に成功します。

 -- C の関数: int PyContextToken_CheckExact (PyObject *o)

     'o' が *note PyContextToken_Type: 54bb. の場合に真を返します。 'o'
     は ‘NULL’ であってはなりません。 この関数は常に成功します。

コンテキストオブジェクトを取り扱う関数:

 -- C の関数: *note PyObject: 5df. *PyContext_New (void)
     '戻り値: 新しい参照。' 新しい空のコンテキストオブジェクトを作成しま
     す。 エラーが起きた場合は ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyContext_Copy (PyObject *ctx)
     '戻り値: 新しい参照。' 渡された 'ctx' コンテキストオブジェクトの浅
     いコピーを作成します。 エラーが起きた場合は ‘NULL’ を返します。

 -- C の関数: *note PyObject: 5df. *PyContext_CopyCurrent (void)
     '戻り値: 新しい参照。' 現在のコンテキストオブジェクトの浅いコピーを
     作成します。 エラーが起きた場合は ‘NULL’ を返します。

 -- C の関数: int PyContext_Enter (PyObject *ctx)

     'ctx' を現在のスレッドの現在のコンテキストに設定します。 成功したら
     ‘0’ を、失敗したら ‘-1’ を返します。

 -- C の関数: int PyContext_Exit (PyObject *ctx)

     'ctx' コンテキストを無効にし、1 つ前のコンテキストを現在のスレッド
     の現在のコンテキストに復元します。 成功したら ‘0’ を、失敗したら
     ‘-1’ を返します。

 -- C の関数: int PyContext_AddWatcher (PyContext_WatchCallback
          callback)

     Register 'callback' as a context object watcher for the current
     interpreter.  Return an ID which may be passed to *note
     PyContext_ClearWatcher(): 1993.  In case of error (e.g.  no more
     watcher IDs available), return ‘-1’ and set an exception.

     Added in version 3.14.

 -- C の関数: int PyContext_ClearWatcher (int watcher_id)

     Clear watcher identified by 'watcher_id' previously returned from
     *note PyContext_AddWatcher(): 1992. for the current interpreter.
     Return ‘0’ on success, or ‘-1’ and set an exception on error (e.g.
     if the given 'watcher_id' was never registered.)

     Added in version 3.14.

 -- C のデータ型: type PyContextEvent

     Enumeration of possible context object watcher events:

        - ‘Py_CONTEXT_SWITCHED’: The *note current context: 1964. has
          switched to a different context.  The object passed to the
          watch callback is the now-current *note contextvars.Context:
          177. object, or None if no context is current.

     Added in version 3.14.

 -- C のデータ型: typedef int (*PyContext_WatchCallback)(*note
          PyContextEvent: 54c4. event, *note PyObject: 5df. *obj)

     Context object watcher callback function.  The object passed to the
     callback is event-specific; see *note PyContextEvent: 54c4. for
     details.

     If the callback returns with an exception set, it must return ‘-1’;
     this exception will be printed as an unraisable exception using
     *note PyErr_FormatUnraisable(): 5f1.  Otherwise it should return
     ‘0’.

     There may already be a pending exception set on entry to the
     callback.  In this case, the callback should return ‘0’ with the
     same exception still set.  This means the callback may not call any
     other API that can set an exception unless it saves and clears the
     exception state first, and restores it before returning.

     Added in version 3.14.

コンテキスト変数の関数:

 -- C の関数: *note PyObject: 5df. *PyContextVar_New (const char *name,
          PyObject *def)
     '戻り値: 新しい参照。' 新しい ‘ContextVar’ オブジェクトを作成します
     。'name' 引数は内部走査とデバッグの目的で使われます。'def' 引数はコ
     ンテキスト変数のデフォルト値を指定するか、デフォルトがない場合は
     ‘NULL’ です。エラーが起きた場合は、関数は ‘NULL’ を返します。

 -- C の関数: int PyContextVar_Get (PyObject *var, PyObject
          *default_value, PyObject **value)

     コンテキスト変数の値を取得します。 取得中にエラーが起きた場合は
     ‘-1’ を、値が見付かっても見付からなくてもエラーが起きなかった場合は
     ‘0’ を返します。

     コンテキスト変数が見付かった場合、 'value' はそれを指すポインタにな
     っています。 コンテキスト変数が見付から 'なかった' 場合は、 'value'
     が指すものは次のようになっています:

        - (‘NULL’ でなければ) 'default_value'

        - (‘NULL’ でなければ) 'var' のデフォルト値

        - ‘NULL’

     ‘NULL’ を除けば、この関数は新しい参照を返します。

 -- C の関数: *note PyObject: 5df. *PyContextVar_Set (PyObject *var,
          PyObject *value)
     '戻り値: 新しい参照。' 現在のコンテキストにおいて 'var' の値を
     'value' にセットします。この変更による新しいトークンオブジェクトか
     、エラーが起こった場合は''NULL''を返します。

 -- C の関数: int PyContextVar_Reset (PyObject *var, PyObject *token)

     'var' コンテキスト変数の状態をリセットし、 'token' を返した *note
     PyContextVar_Set(): 54c8. が呼ばれる前の状態に戻します。 この関数は
     成功したら ‘0’ 、失敗したら ‘-1’ を返します。

   ---------- Footnotes ----------

   (1) https://bugs.python.org/issue?@action=redirect&bpo=34762


File: python.info,  Node: 型ヒントのためのオブジェクト,  Prev: コンテキスト変数オブジェクト,  Up: その他のオブジェクト<2>

7.9.6.30 型ヒントのためのオブジェクト
.....................................

Various built-in types for type hinting are provided.  Currently, two
types exist - *note GenericAlias: 8c1. and *note Union: 9c5.  Only
‘GenericAlias’ is exposed to C.

 -- C の関数: *note PyObject: 5df. *Py_GenericAlias (PyObject *origin,
          PyObject *args)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.9 より).'
     *note GenericAlias: 8c1. オブジェクトを生成します。Pythonクラス
     *note types.GenericAlias: 9ec. を呼び出すことと同等です。引数
     'origin' と 'args' は ‘GenericAlias’ の ‘__origin__’ および
     ‘__args__’ 属性をそれぞれ設定します。 'origin' は *note
     PyTypeObject: c9c.* でなければならず、 'args' は *note
     PyTupleObject: 5224.* または任意の ‘PyObject*’ です。 'args' がタプ
     ルでない場合には1タプルが自動的に生成され、‘__args__’ には
     ‘(args,)’ が設定されます。引数チェックは最小限なため、たとえ
     'origin' が型を示すオブジェクトでなくても関数呼び出しは成功します。
     ‘GenericAlias’ の ‘__parameters__’ 属性は ‘__args__’ から必要に応じ
     て遅延生成されます。失敗した場合、例外が送出されて ‘NULL’ を返しま
     す。

     以下は拡張の型をジェネリックにする例です。

          ...
          static PyMethodDef my_obj_methods[] = {
              // Other methods.
              ...
              {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, "See PEP 585"}
              ...
          }

     参考
     ....

     The data model method *note __class_getitem__(): 943.

     Added in version 3.9.

 -- C 変数: *note PyTypeObject: c9c. Py_GenericAliasType
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.9 より).'
     *note Py_GenericAlias(): 512b. により返されるCの型オブジェクトです
     。Pythonの *note types.GenericAlias: 9ec. と同等です。

     Added in version 3.9.


File: python.info,  Node: C API for extension modules,  Prev: その他のオブジェクト<2>,  Up: 具象オブジェクト concrete object レイヤ

7.9.7 C API for extension modules
---------------------------------

* Menu:

* Curses C API::
* Internal data::
* DateTime オブジェクト: DateTime オブジェクト<2>.
* Internal data: Internal data<2>.


File: python.info,  Node: Curses C API,  Next: Internal data,  Up: C API for extension modules

7.9.7.1 Curses C API
....................

*note curses: 2f. exposes a small C interface for extension modules.
Consumers must include the header file ‘py_curses.h’ (which is not
included by default by ‘Python.h’) and *note import_curses(): 54d1. must
be invoked, usually as part of the module initialisation function, to
populate *note PyCurses_API: 54d2.

     警告: Neither the C API nor the pure Python *note curses: 2f.
     module are compatible with subinterpreters.

 -- C のマクロ: import_curses ()

     Import the curses C API. The macro does not need a semi-colon to be
     called.

     On success, populate the *note PyCurses_API: 54d2. pointer.

     On failure, set *note PyCurses_API: 54d2. to NULL and set an
     exception.  The caller must check if an error occurred via *note
     PyErr_Occurred(): 1caf.:

          import_curses();  // semi-colon is optional but recommended
          if (PyErr_Occurred()) { /* cleanup */ }

 -- C 変数: void **PyCurses_API

     Dynamically allocated object containing the curses C API. This
     variable is only available once *note import_curses: 54d1.
     succeeds.

     ‘PyCurses_API[0]’ corresponds to *note PyCursesWindow_Type: 54d3.

     ‘PyCurses_API[1]’, ‘PyCurses_API[2]’, and ‘PyCurses_API[3]’ are
     pointers to predicate functions of type ‘int (*)(void)’.

     When called, these predicates return whether *note
     curses.setupterm(): 34a4, *note curses.initscr(): 190f, and *note
     curses.start_color(): 34a5. have been called respectively.

     See also the convenience macros *note PyCursesSetupTermCalled:
     54d4, *note PyCursesInitialised: 54d5, and *note
     PyCursesInitialisedColor: 54d6.

          注釈: The number of entries in this structure is subject to
          changes.  Consider using *note PyCurses_API_pointers: 54d7. to
          check if new fields are available or not.

 -- C のマクロ: PyCurses_API_pointers

     The number of accessible fields (‘4’) in *note PyCurses_API: 54d2.
     This number is incremented whenever new fields are added.

 -- C 変数: *note PyTypeObject: c9c. PyCursesWindow_Type

     The *note heap type: b5e. corresponding to *note curses.window:
     12a7.

 -- C の関数: int PyCursesWindow_Check (PyObject *op)

     Return true if 'op' is a *note curses.window: 12a7. instance, false
     otherwise.

The following macros are convenience macros expanding into C statements.
In particular, they can only be used as ‘macro;’ or ‘macro’, but not
‘macro()’ or ‘macro();’.

 -- C のマクロ: PyCursesSetupTermCalled

     Macro checking if *note curses.setupterm(): 34a4. has been called.

     The macro expansion is roughly equivalent to:

          {
              typedef int (*predicate_t)(void);
              predicate_t was_setupterm_called = (predicate_t)PyCurses_API[1];
              if (!was_setupterm_called()) {
                  return NULL;
              }
          }

 -- C のマクロ: PyCursesInitialised

     Macro checking if *note curses.initscr(): 190f. has been called.

     The macro expansion is roughly equivalent to:

          {
              typedef int (*predicate_t)(void);
              predicate_t was_initscr_called = (predicate_t)PyCurses_API[2];
              if (!was_initscr_called()) {
                  return NULL;
              }
          }

 -- C のマクロ: PyCursesInitialisedColor

     Macro checking if *note curses.start_color(): 34a5. has been
     called.

     The macro expansion is roughly equivalent to:

          {
              typedef int (*predicate_t)(void);
              predicate_t was_start_color_called = (predicate_t)PyCurses_API[3];
              if (!was_start_color_called()) {
                  return NULL;
              }
          }


File: python.info,  Node: Internal data,  Next: DateTime オブジェクト<2>,  Prev: Curses C API,  Up: C API for extension modules

7.9.7.2 Internal data
.....................

The following objects are exposed by the C API but should be considered
internal-only.

 -- C のマクロ: PyCurses_CAPSULE_NAME

     Name of the curses capsule to pass to *note PyCapsule_Import():
     1c10.

     Internal usage only.  Use *note import_curses: 54d1. instead.


File: python.info,  Node: DateTime オブジェクト<2>,  Next: Internal data<2>,  Prev: Internal data,  Up: C API for extension modules

7.9.7.3 DateTime オブジェクト
.............................

*note datetime: 34. モジュールでは、様々な日付オブジェクトや時刻オブジェ
クトを提供しています。以下に示す関数を使う場合には、あらかじめヘッダファ
イル ‘datetime.h’ をソースに include し (‘Python.h’ はこのファイルを
include しません)、 *note PyDateTime_IMPORT: 54de. マクロを、通常はモジ
ュール初期化関数から、起動しておく必要があります。このマクロは以下のマク
ロで使われる静的変数 *note PyDateTimeAPI: 54df. に C 構造体へのポインタ
を入れます。

 -- C のマクロ: PyDateTime_IMPORT ()

     Import the datetime C API.

     On success, populate the *note PyDateTimeAPI: 54df. pointer.  On
     failure, set *note PyDateTimeAPI: 54df. to ‘NULL’ and set an
     exception.  The caller must check if an error occurred via *note
     PyErr_Occurred(): 1caf.:

          PyDateTime_IMPORT;
          if (PyErr_Occurred()) { /* cleanup */ }

          警告: This is not compatible with subinterpreters.

 -- C のデータ型: type PyDateTime_CAPI

     Structure containing the fields for the datetime C API.

     The fields of this structure are private and subject to change.

     Do not use this directly; prefer ‘PyDateTime_*’ APIs instead.

 -- C 変数: *note PyDateTime_CAPI: 54e0. *PyDateTimeAPI

     Dynamically allocated object containing the datetime C API.

     This variable is only available once *note PyDateTime_IMPORT: 54de.
     succeeds.

 -- C のデータ型: type PyDateTime_Date

     この *note PyObject: 5df. のサブタイプは、Pythonの日付オブジェクト
     を表します。

 -- C のデータ型: type PyDateTime_DateTime

     この *note PyObject: 5df. のサブタイプは Python の datetime オブジ
     ェクトを表します。

 -- C のデータ型: type PyDateTime_Time

     この *note PyObject: 5df. のサブタイプは Python の time オブジェク
     トを表現します。

 -- C のデータ型: type PyDateTime_Delta

     この *note PyObject: 5df. のサブタイプは二つの datetime の値の差分
     を表します。

 -- C 変数: *note PyTypeObject: c9c. PyDateTime_DateType

     この *note PyTypeObject: c9c. のインスタンスは Python の date 型を
     表します; Python レイヤにおける *note datetime.date: 1fa. と同じオ
     ブジェクトです。

 -- C 変数: *note PyTypeObject: c9c. PyDateTime_DateTimeType

     この *note PyTypeObject: c9c. のインスタンスは Python の datetime 型
     を表現します; Python レイヤにおける *note datetime.datetime: 4e2. と
     同じオブジェクトです。

 -- C 変数: *note PyTypeObject: c9c. PyDateTime_TimeType

     この *note PyTypeObject: c9c. のインスタンスは Python の time 型を
     表します; Python レイヤにおける *note datetime.time: 1fb. と同じオ
     ブジェクトです。

 -- C 変数: *note PyTypeObject: c9c. PyDateTime_DeltaType

     This instance of *note PyTypeObject: c9c. represents the Python
     type for the difference between two datetime values; it is the same
     object as *note datetime.timedelta: bc3. in the Python layer.

 -- C 変数: *note PyTypeObject: c9c. PyDateTime_TZInfoType

     この *note PyTypeObject: c9c. のインスタンスは Python の タイムゾー
     ン情報型を表します; Python レイヤにおける *note datetime.tzinfo:
     7f6. と同じオブジェクトです。

UTCシングルトンにアクセスするためのマクロ:

 -- C 変数: *note PyObject: 5df. *PyDateTime_TimeZone_UTC

     UTCタイムゾーンに相当するシングルトンを返します。これは *note
     datetime.timezone.utc: 827. と同じオブジェクトです。

     Added in version 3.7.

型チェックマクロ:

 -- C の関数: int PyDate_Check (PyObject *ob)

     'ob' が *note PyDateTime_DateType: 54e5. 型か ‘PyDateTime_DateType’
     型のサブタイプのオブジェクトの場合に真を返します; 'ob' は ‘NULL’ で
     あってはなりません。この関数は常に成功します。

 -- C の関数: int PyDate_CheckExact (PyObject *ob)

     'ob' が *note PyDateTime_DateType: 54e5. の場合に真を返します。
     'ob' は ‘NULL’ であってはなりません。この関数は常に成功します。

 -- C の関数: int PyDateTime_Check (PyObject *ob)

     'ob' が *note PyDateTime_DateTimeType: 54e6. 型か
     ‘PyDateTime_DateTimeType’ 型のサブタイプのオブジェクトの場合に真を
     返します; 'ob' は ‘NULL’ であってはなりません。この関数は常に成功し
     ます。

 -- C の関数: int PyDateTime_CheckExact (PyObject *ob)

     'ob' が *note PyDateTime_DateTimeType: 54e6. の場合に真を返します。
     'ob' は ‘NULL’ であってはなりません。この関数は常に成功します。

 -- C の関数: int PyTime_Check (PyObject *ob)

     'ob' が *note PyDateTime_TimeType: 54e7. 型か ‘PyDateTime_TimeType’
     型のサブタイプのオブジェクトの場合に真を返します; 'ob' は ‘NULL’ で
     あってはなりません。この関数は常に成功します。

 -- C の関数: int PyTime_CheckExact (PyObject *ob)

     'ob' が *note PyDateTime_TimeType: 54e7. の場合に真を返します。
     'ob' は ‘NULL’ であってはなりません。この関数は常に成功します。

 -- C の関数: int PyDelta_Check (PyObject *ob)

     'ob' が *note PyDateTime_DeltaType: 54e8. 型か
     ‘PyDateTime_DeltaType’ 型のサブタイプのオブジェクトの場合に真を返し
     ます; 'ob' は ‘NULL’ であってはなりません。この関数は常に成功します
     。

 -- C の関数: int PyDelta_CheckExact (PyObject *ob)

     'ob' が *note PyDateTime_DeltaType: 54e8. の場合に真を返します。
     'ob' は ‘NULL’ であってはなりません。この関数は常に成功します。

 -- C の関数: int PyTZInfo_Check (PyObject *ob)

     'ob' が *note PyDateTime_TZInfoType: 54e9. 型か
     ‘PyDateTime_TZInfoType’ 型のサブタイプのオブジェクトの場合に真を返
     します; 'ob' は ‘NULL’ であってはなりません。この関数は常に成功しま
     す。

 -- C の関数: int PyTZInfo_CheckExact (PyObject *ob)

     'ob' が *note PyDateTime_TZInfoType: 54e9. の場合に真を返します。
     'ob' は ‘NULL’ であってはなりません。この関数は常に成功します。

以下はオブジェクトを作成するためのマクロです:

 -- C の関数: *note PyObject: 5df. *PyDate_FromDate (int year, int
          month, int day)
     '戻り値: 新しい参照。' 指定した年、月、日の *note datetime.date:
     1fa. オブジェクトを返します。

 -- C の関数: *note PyObject: 5df. *PyDateTime_FromDateAndTime (int
          year, int month, int day, int hour, int minute, int second,
          int usecond)
     '戻り値: 新しい参照。' 指定した年、月、日、時、分、秒、マイクロ秒の
     *note datetime.datetime: 4e2. オブジェクトを返します。

 -- C の関数: *note PyObject: 5df. *PyDateTime_FromDateAndTimeAndFold
          (int year, int month, int day, int hour, int minute, int
          second, int usecond, int fold)
     '戻り値: 新しい参照。' 指定された年、月、日、時、分、秒、マイクロ秒
     、fold の *note datetime.datetime: 4e2. オブジェクトを返します。

     Added in version 3.6.

 -- C の関数: *note PyObject: 5df. *PyTime_FromTime (int hour, int
          minute, int second, int usecond)
     '戻り値: 新しい参照。' 指定された時、分、秒、マイクロ秒の *note
     datetime.time: 1fb. オブジェクトを返します。

 -- C の関数: *note PyObject: 5df. *PyTime_FromTimeAndFold (int hour,
          int minute, int second, int usecond, int fold)
     '戻り値: 新しい参照。' 指定された時、分、秒、マイクロ秒、fold の
     *note datetime.time: 1fb. オブジェクトを返します。

     Added in version 3.6.

 -- C の関数: *note PyObject: 5df. *PyDelta_FromDSU (int days, int
          seconds, int useconds)
     '戻り値: 新しい参照。' 指定された日、秒、マイクロ秒の *note
     datetime.timedelta: bc3. オブジェクトを返します。マイクロ秒と秒が
     *note datetime.timedelta: bc3. オブジェクトで定義されている範囲に入
     るように正規化を行います。

 -- C の関数: *note PyObject: 5df. *PyTimeZone_FromOffset (PyObject
          *offset)
     '戻り値: 新しい参照。' 'offset' 引数で指定した固定オフセットを持つ
     、名前のない *note datetime.timezone: 12d5. オブジェクトを返します
     。

     Added in version 3.7.

 -- C の関数: *note PyObject: 5df. *PyTimeZone_FromOffsetAndName
          (PyObject *offset, PyObject *name)
     '戻り値: 新しい参照。' 'offset*引数で指定した固定のオフセットと、
     *name' のタイムゾーン名を持つ *note datetime.timezone: 12d5. オブジ
     ェクトを返します。

     Added in version 3.7.

以下のマクロは date オブジェクトからフィールド値を取り出すためのものです
。引数は *note PyDateTime_Date: 54e1. またはそのサブクラス (例えば *note
PyDateTime_DateTime: 54e2.)の インスタンスでなければなりません。引数を
‘NULL’ にしてはならず、型チェックは行いません:

 -- C の関数: int PyDateTime_GET_YEAR (PyDateTime_Date *o)

     年を正の整数で返します。

 -- C の関数: int PyDateTime_GET_MONTH (PyDateTime_Date *o)

     月を 1 から 12 の間の整数で返します。

 -- C の関数: int PyDateTime_GET_DAY (PyDateTime_Date *o)

     日を 1 から 31 の間の整数で返します。

以下のマクロは datetime オブジェクトからフィールド値を取り出すためのもの
です。引数は *note PyDateTime_DateTime: 54e2. またはそのサブクラスのイン
スタンスでなければなりません。引数を ‘NULL’ にしてはならず、型チェックは
行いません:

 -- C の関数: int PyDateTime_DATE_GET_HOUR (PyDateTime_DateTime *o)

     時を 0 から 23 の間の整数で返します。

 -- C の関数: int PyDateTime_DATE_GET_MINUTE (PyDateTime_DateTime *o)

     分を 0 から 59 の間の整数で返します。

 -- C の関数: int PyDateTime_DATE_GET_SECOND (PyDateTime_DateTime *o)

     秒を 0 から 59 の間の整数で返します。

 -- C の関数: int PyDateTime_DATE_GET_MICROSECOND (PyDateTime_DateTime
          *o)

     マイクロ秒を 0 から 999999 の間の整数で返します。

 -- C の関数: int PyDateTime_DATE_GET_FOLD (PyDateTime_DateTime *o)

     フォールド(訳注: サマータイムによる時間のずれのこと)を 0 から 1 ま
     での整数で返します。

     Added in version 3.6.

 -- C の関数: *note PyObject: 5df. *PyDateTime_DATE_GET_TZINFO
          (PyDateTime_DateTime *o)

     Return the tzinfo (which may be ‘None’).

     Added in version 3.10.

以下のマクロは time オブジェクトからフィールド値を取り出すためのものです
。引数は *note PyDateTime_Time: 54e3. またはそのサブクラスのインスタンス
でなければなりません。引数を ‘NULL’ にしてはならず、型チェックは行いませ
ん:

 -- C の関数: int PyDateTime_TIME_GET_HOUR (PyDateTime_Time *o)

     時を 0 から 23 の間の整数で返します。

 -- C の関数: int PyDateTime_TIME_GET_MINUTE (PyDateTime_Time *o)

     分を 0 から 59 の間の整数で返します。

 -- C の関数: int PyDateTime_TIME_GET_SECOND (PyDateTime_Time *o)

     秒を 0 から 59 の間の整数で返します。

 -- C の関数: int PyDateTime_TIME_GET_MICROSECOND (PyDateTime_Time *o)

     マイクロ秒を 0 から 999999 の間の整数で返します。

 -- C の関数: int PyDateTime_TIME_GET_FOLD (PyDateTime_Time *o)

     フォールド(訳注: サマータイムによる時間のずれのこと)を 0 から 1 ま
     での整数で返します。

     Added in version 3.6.

 -- C の関数: *note PyObject: 5df. *PyDateTime_TIME_GET_TZINFO
          (PyDateTime_Time *o)

     Return the tzinfo (which may be ‘None’).

     Added in version 3.10.

以下のマクロは time delta オブジェクトからフィールド値をとりだすためのも
のです。引数は *note PyDateTime_Delta: 54e4. かそのサブクラスのインスタ
ンスでなければなりません。引数を ‘NULL’ にしてはならず、型チェックは行い
ません:

 -- C の関数: int PyDateTime_DELTA_GET_DAYS (PyDateTime_Delta *o)

     日数を -999999999 から 999999999 の間の整数で返します。

     Added in version 3.3.

 -- C の関数: int PyDateTime_DELTA_GET_SECONDS (PyDateTime_Delta *o)

     秒数を 0 から 86399 の間の整数で返します。

     Added in version 3.3.

 -- C の関数: int PyDateTime_DELTA_GET_MICROSECONDS (PyDateTime_Delta
          *o)

     マイクロ秒を 0 から 999999 の間の整数で返します。

     Added in version 3.3.

以下のマクロは DB API を実装する上での便宜用です:

 -- C の関数: *note PyObject: 5df. *PyDateTime_FromTimestamp (PyObject
          *args)
     '戻り値: 新しい参照。' Create and return a new *note
     datetime.datetime: 4e2. object given an argument tuple suitable for
     passing to *note datetime.datetime.fromtimestamp(): 712.

 -- C の関数: *note PyObject: 5df. *PyDate_FromTimestamp (PyObject
          *args)
     '戻り値: 新しい参照。' Create and return a new *note datetime.date:
     1fa. object given an argument tuple suitable for passing to *note
     datetime.date.fromtimestamp(): dcd.


File: python.info,  Node: Internal data<2>,  Prev: DateTime オブジェクト<2>,  Up: C API for extension modules

7.9.7.4 Internal data
.....................

The following symbols are exposed by the C API but should be considered
internal-only.

 -- C のマクロ: PyDateTime_CAPSULE_NAME

     Name of the datetime capsule to pass to *note PyCapsule_Import():
     1c10.

     Internal usage only.  Use *note PyDateTime_IMPORT: 54de. instead.


File: python.info,  Node: 初期化 initialization 、終了処理 finalization 、スレッド,  Next: Python 初期化設定,  Prev: 具象オブジェクト concrete object レイヤ,  Up: Python/C API リファレンスマニュアル

7.10 初期化 (initialization)、終了処理 (finalization)、スレッド
===============================================================

See *note Python Initialization Configuration: 646. for details on how
to configure the interpreter prior to initialization.

* Menu:

* Python 初期化以前::
* グローバルな設定変数::
* インタープリタの初期化と終了処理::
* プロセスワイドのパラメータ::
* スレッド状態 (thread state) とグローバルインタプリタロック (global interpreter lock): スレッド状態 thread state とグローバルインタプリタロック global interpreter lock.
* サブインタプリタサポート::
* 非同期通知::
* プロファイルとトレース (profiling and tracing): プロファイルとトレース profiling and tracing.
* Reference tracing::
* 高度なデバッガサポート (advanced debugger support): 高度なデバッガサポート advanced debugger support.
* スレッドローカルストレージのサポート::
* 同期プリミティブ: 同期プリミティブ<3>.
* Operating System Thread APIs::


File: python.info,  Node: Python 初期化以前,  Next: グローバルな設定変数,  Up: 初期化 initialization 、終了処理 finalization 、スレッド

7.10.1 Python 初期化以前
------------------------

Python が埋め込まれているアプリケーションでは、他の Python/C API 関数を
使う前に *note Py_Initialize(): 460. 関数を呼ばなければなりません。これ
には例外として、いくつかの関数と *note グローバルな設定変数: 5512. があ
ります。

次の関数は Python の初期化の前でも安全に呼び出せます:

   * Functions that initialize the interpreter:

        * *note Py_Initialize(): 460.

        * *note Py_InitializeEx(): 5133.

        * *note Py_InitializeFromConfig(): 3f6.

        * *note Py_BytesMain(): bb8.

        * *note Py_Main(): e1e.

        * the runtime pre-initialization functions covered in *note
          Python 初期化設定: 646.

   * 設定関数:

        * *note PyImport_AppendInittab(): 1b1c.

        * *note PyImport_ExtendInittab(): 1b1d.

        * ‘PyInitFrozenExtensions()’

        * *note PyMem_SetAllocator(): 7a8.

        * *note PyMem_SetupDebugHooks(): e64.

        * *note PyObject_SetArenaAllocator(): 5513.

        * *note Py_SetProgramName(): 19b6.

        * *note Py_SetPythonHome(): 19b5.

        * *note PySys_ResetWarnOptions(): 3f4.

        * the configuration functions covered in *note Python
          初期化設定: 646.

   * 情報取得の関数:

        * *note Py_IsInitialized(): 4f51.

        * *note PyMem_GetAllocator(): 5514.

        * *note PyObject_GetArenaAllocator(): 5515.

        * *note Py_GetBuildInfo(): 164b.

        * *note Py_GetCompiler(): 512d.

        * *note Py_GetCopyright(): 512e.

        * *note Py_GetPlatform(): 512f.

        * *note Py_GetVersion(): 5131.

        * *note Py_IsInitialized(): 4f51.

   * ユーティリティ:

        * *note Py_DecodeLocale(): dc0.

        * the status reporting and utility functions covered in *note
          Python 初期化設定: 646.

   * メモリアロケータ:

        * *note PyMem_RawMalloc(): 631.

        * *note PyMem_RawRealloc(): 633.

        * *note PyMem_RawCalloc(): 632.

        * *note PyMem_RawFree(): 634.

   * Synchronization:

        * *note PyMutex_Lock(): 5d0.

        * *note PyMutex_Unlock(): 5d1.

     注釈: Despite their apparent similarity to some of the functions
     listed above, the following functions 'should not be called' before
     the interpreter has been initialized: *note Py_EncodeLocale(): dc1,
     *note Py_GetPath(): 3e3, *note Py_GetPrefix(): 3e5, *note
     Py_GetExecPrefix(): 3e9, *note Py_GetProgramFullPath(): 3ec, *note
     Py_GetPythonHome(): 3ef, *note Py_GetProgramName(): 3ee, *note
     PyEval_InitThreads(): 19b9, and *note Py_RunMain(): bbc.


File: python.info,  Node: グローバルな設定変数,  Next: インタープリタの初期化と終了処理,  Prev: Python 初期化以前,  Up: 初期化 initialization 、終了処理 finalization 、スレッド

7.10.2 グローバルな設定変数
---------------------------

Python には、様々な機能やオプションを制御するグローバルな設定のための変
数があります。 デフォルトでは、これらのフラグは *note
コマンドラインオプション: 211b. で制御されます。

オプションでフラグがセットされると、フラグの値はそのオプションがセットさ
れた回数になります。 例えば、 ‘-b’ では *note Py_BytesWarningFlag: 406.
が 1 に設定され、 ‘-bb’ では *note Py_BytesWarningFlag: 406. が 2 に設定
されます。

 -- C 変数: int Py_BytesWarningFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.bytes_warning: 407. should be used instead, see *note
     Python Initialization Configuration: 646.

     *note bytes: 192. または *note bytearray: 344. を *note str: 169. と
     比較した場合、または、 *note bytes: 192. を *note int: 19b. と比較
     した場合に警告を発生させます。 ‘2’ 以上の値を設定している場合は、エ
     ラーを発生させます。

     *note -b: 7f9. オプションで設定します。

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_DebugFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.parser_debug: 3f9. should be used instead, see *note
     Python Initialization Configuration: 646.

     パーサーのデバッグ出力を有効にします。(専門家専用です。コンパイルオ
     プションに依存します)。

     *note -d: 2123. オプションと *note PYTHONDEBUG: 2124. 環境変数で設
     定します。

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_DontWriteBytecodeFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.write_bytecode: 40d. should be used instead, see *note
     Python Initialization Configuration: 646.

     非ゼロに設定した場合、Python はソースモジュールのインポート時に
     ‘.pyc’ ファイルの作成を試みません。

     *note -B: 15e6. オプションと *note PYTHONDONTWRITEBYTECODE: 15e7. 環
     境変数で設定します。

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_FrozenFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.pathconfig_warnings: 409. should be used instead, see
     *note Python Initialization Configuration: 646.

     *note Py_GetPath(): 3e3. の中でモジュール検索パスを割り出していると
     きのエラーメッセージを抑制します。

     ‘_freeze_module’ プログラムと ‘frozenmain’ プログラムが使用する非公
     開フラグです。

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_HashRandomizationFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.hash_seed: 414. and *note PyConfig.use_hash_seed: 413.
     should be used instead, see *note Python Initialization
     Configuration: 646.

     *note PYTHONHASHSEED: 1289. 環境変数が空でない文字列に設定された場
     合に、 ‘1’ が設定されます。

     フラグがゼロでない場合、 *note PYTHONHASHSEED: 1289. 環境変数を読み
     シークレットハッシュシードを初期化します。

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_IgnoreEnvironmentFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.use_environment: 40b. should be used instead, see *note
     Python Initialization Configuration: 646.

     Ignore all ‘PYTHON*’ environment variables, e.g.  *note PYTHONPATH:
     121f. and *note PYTHONHOME: 3f0, that might be set.

     *note -E: b56. オプションと *note -I: b57. オプションで設定します。

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_InspectFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.inspect: 401. should be used instead, see *note Python
     Initialization Configuration: 646.

     最初の引数にスクリプトが指定されたときや *note -c: 1a8. オプション
     が利用された際に、 *note sys.stdin: 75f. がターミナルに出力されない
     ときであっても、スクリプトかコマンドを実行した後にインタラクティブ
     モードに入ります。

     *note -i: 16f4. オプションと *note PYTHONINSPECT: 16f3. 環境変数で
     設定します。

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_InteractiveFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.interactive: 3ff. should be used instead, see *note Python
     Initialization Configuration: 646.

     *note -i: 16f4. オプションで設定します。

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_IsolatedFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.isolated: 416. should be used instead, see *note Python
     Initialization Configuration: 646.

     Python を隔離モードで実行します。 隔離モードでは *note sys.path:
     3e4. はスクリプトのディレクトリやユーザのサイトパッケージのディレク
     トリを含みません。

     *note -I: b57. オプションで設定します。

     Added in version 3.4.

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_LegacyWindowsFSEncodingFlag

     This API is kept for backward compatibility: setting *note
     PyPreConfig.legacy_windows_fs_encoding: 418. should be used
     instead, see *note Python Initialization Configuration: 646.

     If the flag is non-zero, use the ‘mbcs’ encoding with ‘replace’
     error handler, instead of the UTF-8 encoding with ‘surrogatepass’
     error handler, for the *note filesystem encoding and error handler:
     75d.

     *note PYTHONLEGACYWINDOWSFSENCODING: 33f. 環境変数が空でない文字列
     に設定された場合に、 ‘1’ に設定されます。

     より詳しくは PEP 529(1) を参照してください。

     *note Availability: 213f.: Windows.

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_LegacyWindowsStdioFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.legacy_windows_stdio: 41a. should be used instead, see
     *note Python Initialization Configuration: 646.

     If the flag is non-zero, use *note io.FileIO: 1527. instead of
     ‘io._WindowsConsoleIO’ for *note sys: df. standard streams.

     *note PYTHONLEGACYWINDOWSSTDIO: e55. 環境変数が空でない文字列に設定
     された場合に、 ‘1’ に設定されます。

     より詳しくは PEP 528(2) を参照してください。

     *note Availability: 213f.: Windows.

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_NoSiteFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.site_import: 405. should be used instead, see *note Python
     Initialization Configuration: 646.

     *note site: cc. モジュールの import と、そのモジュールが行なってい
     た site ごとの *note sys.path: 3e4. への操作を無効にします。後で
     *note site: cc. を明示的に import しても、これらの操作は実行されま
     せん (実行したい場合は、 *note site.main(): 2127. を呼び出してくだ
     さい)。

     *note -S: 13c0. オプションで設定します。

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_NoUserSiteDirectory

     This API is kept for backward compatibility: setting *note
     PyConfig.user_site_directory: 40f. should be used instead, see
     *note Python Initialization Configuration: 646.

     *note ユーザのサイトパッケージのディレクトリ: 2126. を *note
     sys.path: 3e4. に追加しません。

     *note -s: 15a6. オプション、 *note -I: b57. 、 *note
     PYTHONNOUSERSITE: 15a7. 環境変数で設定します。

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_OptimizeFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.optimization_level: 403. should be used instead, see *note
     Python Initialization Configuration: 646.

     *note -O: 18c. オプションと *note PYTHONOPTIMIZE: 2125. 環境変数で
     設定します。

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_QuietFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.quiet: 3fd. should be used instead, see *note Python
     Initialization Configuration: 646.

     インタラクティブモードでも copyright とバージョンのメッセージを表示
     しません。

     *note -q: 177e. オプションで設定します。

     Added in version 3.2.

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_UnbufferedStdioFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.buffered_stdio: 411. should be used instead, see *note
     Python Initialization Configuration: 646.

     標準出力と標準エラーをバッファリングしないように強制します。

     *note -u: 1d8d. オプションと *note PYTHONUNBUFFERED: 1d8e. 環境変数
     で設定します。

     Deprecated since version 3.12, will be removed in version 3.15.

 -- C 変数: int Py_VerboseFlag

     This API is kept for backward compatibility: setting *note
     PyConfig.verbose: 3fb. should be used instead, see *note Python
     Initialization Configuration: 646.

     モジュールが初期化されるたびにメッセージを出力し、それがどこ (ファ
     イル名やビルトインモジュール) からロードされたのかを表示します。 値
     が 2 以上の場合は、モジュールを検索するときにチェックしたファイルご
     とにメッセージを出力します。また、終了時のモジュールクリーンアップ
     に関する情報も提供します。

     *note -v: 163e. オプションと *note PYTHONVERBOSE: 2128. 環境変数で
     設定します。

     Deprecated since version 3.12, will be removed in version 3.15.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0529/

   (2) https://peps.python.org/pep-0528/


File: python.info,  Node: インタープリタの初期化と終了処理,  Next: プロセスワイドのパラメータ,  Prev: グローバルな設定変数,  Up: 初期化 initialization 、終了処理 finalization 、スレッド

7.10.3 インタープリタの初期化と終了処理
---------------------------------------

 -- C の関数: void Py_Initialize ()
     ' 次に属します: *note Stable ABI: 775.'

     Python インタープリタを初期化します。 Python の埋め込みを行うアプリ
     ケーションでは、他のあらゆる Python/C API を使用するよりも前にこの
     関数を呼び出さなければなりません。いくつかの例外については *note
     Python 初期化以前: dbe. を参照してください。

     This initializes the table of loaded modules (‘sys.modules’), and
     creates the fundamental modules *note builtins: 13, *note __main__:
     1. and *note sys: df.  It also initializes the module search path
     (‘sys.path’).  It does not set ‘sys.argv’; use the *note Python
     Initialization Configuration: 646. API for that.  This is a no-op
     when called for a second time (without calling *note
     Py_FinalizeEx(): f11. first).  There is no return value; it is a
     fatal error if the initialization fails.

     Use *note Py_InitializeFromConfig(): 3f6. to customize the *note
     Python Initialization Configuration: 646.

          注釈: Windows では ‘O_TEXT’ から ‘O_BINARY’ へコンソールモード
          が変更されますが、これはその C ランタイムを使っているコンソー
          ルでの Python 以外の使い勝手にも影響を及ぼします。

 -- C の関数: void Py_InitializeEx (int initsigs)
     ' 次に属します: *note Stable ABI: 775.'  This function works like
     *note Py_Initialize(): 460. if 'initsigs' is ‘1’.  If 'initsigs' is
     ‘0’, it skips initialization registration of signal handlers, which
     may be useful when CPython is embedded as part of a larger
     application.

     Use *note Py_InitializeFromConfig(): 3f6. to customize the *note
     Python Initialization Configuration: 646.

 -- C の関数: *note PyStatus: ba4. Py_InitializeFromConfig (const
          PyConfig *config)

     Initialize Python from 'config' configuration, as described in
     *note Initialization with PyConfig: 5518.

     See the *note Python 初期化設定: 646. section for details on
     pre-initializing the interpreter, populating the runtime
     configuration structure, and querying the returned status
     structure.

 -- C の関数: int Py_IsInitialized ()
     ' 次に属します: *note Stable ABI: 775.'  Python インタプリタが初期
     化済みであれば真(非ゼロ)を、さもなければ偽(ゼロ)を返します。*note
     Py_FinalizeEx(): f11. を呼び出した後は、*note Py_Initialize(): 460.
     を再び呼び出すまで、この関数は偽を返します。

 -- C の関数: int Py_IsFinalizing ()
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Return true (non-zero) if the main Python interpreter is *note
     shutting down: 479.  Return false (zero) otherwise.

     Added in version 3.13.

 -- C の関数: int Py_FinalizeEx ()
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.6 より).'
     Undo all initializations made by *note Py_Initialize(): 460. and
     subsequent use of Python/C API functions, and destroy all
     sub-interpreters (see *note Py_NewInterpreter(): 1b31. below) that
     were created and not yet destroyed since the last call to *note
     Py_Initialize(): 460.  This is a no-op when called for a second
     time (without calling *note Py_Initialize(): 460. again first).

     Since this is the reverse of *note Py_Initialize(): 460, it should
     be called in the same thread with the same interpreter active.
     That means the main thread and the main interpreter.  This should
     never be called while *note Py_RunMain(): bbc. is running.

     Normally the return value is ‘0’.  If there were errors during
     finalization (flushing buffered data), ‘-1’ is returned.

     Note that Python will do a best effort at freeing all memory
     allocated by the Python interpreter.  Therefore, any C-Extension
     should make sure to correctly clean up all of the previously
     allocated PyObjects before using them in subsequent calls to *note
     Py_Initialize(): 460.  Otherwise it could introduce vulnerabilities
     and incorrect behavior.

     この関数が提供されている理由はいくつかあります。Python の埋め込みを
     行っているアプリケーションでは、アプリケーションを再起動することな
     く Python を再起動したいことがあります。また、動的ロード可能イブラ
     リ (あるいは DLL) から Python インタプリタをロードするアプリケーシ
     ョンでは、DLL をアンロードする前に Python が確保したメモリを全て解
     放したいと考えるかもしれません。アプリケーション内で起きているメモ
     リリークを追跡する際に、開発者は Python が確保したメモリをアプリケ
     ーションの終了前に解放させたいと思う場合もあります。

     'Bugs and caveats:' The destruction of modules and objects in
     modules is done in random order; this may cause destructors (*note
     __del__(): 11ff. methods) to fail when they depend on other objects
     (even functions) or modules.  Dynamically loaded extension modules
     loaded by Python are not unloaded.  Small amounts of memory
     allocated by the Python interpreter may not be freed (if you find a
     leak, please report it).  Memory tied up in circular references
     between objects is not freed.  Interned strings will all be
     deallocated regardless of their reference count.  Some memory
     allocated by extension modules may not be freed.  Some extensions
     may not work properly if their initialization routine is called
     more than once; this can happen if an application calls *note
     Py_Initialize(): 460. and *note Py_FinalizeEx(): f11. more than
     once.  *note Py_FinalizeEx(): f11. must not be called recursively
     from within itself.  Therefore, it must not be called by any code
     that may be run as part of the interpreter shutdown process, such
     as *note atexit: d. handlers, object finalizers, or any code that
     may be run while flushing the stdout and stderr files.

     引数無しで *note 監査イベント: 1c6e.
     ‘cpython._PySys_ClearAuditHooks’ を送出します。

     Added in version 3.6.

 -- C の関数: void Py_Finalize ()
     ' 次に属します: *note Stable ABI: 775.'  この関数は *note
     Py_FinalizeEx(): f11. の後方互換性バージョンで、戻り値がありません
     。

 -- C の関数: int Py_BytesMain (int argc, char **argv)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.8 より).'
     Similar to *note Py_Main(): e1e. but 'argv' is an array of bytes
     strings, allowing the calling application to delegate the text
     decoding step to the CPython runtime.

     Added in version 3.8.

 -- C の関数: int Py_Main (int argc, wchar_t **argv)
     ' 次に属します: *note Stable ABI: 775.'  The main program for the
     standard interpreter, encapsulating a full
     initialization/finalization cycle, as well as additional behaviour
     to implement reading configurations settings from the environment
     and command line, and then executing ‘__main__’ in accordance with
     *note コマンドライン: 1209.

     This is made available for programs which wish to support the full
     CPython command line interface, rather than just embedding a Python
     runtime in a larger application.

     The 'argc' and 'argv' parameters are similar to those which are
     passed to a C program's ‘main()’ function, except that the 'argv'
     entries are first converted to ‘wchar_t’ using *note
     Py_DecodeLocale(): dc0.  It is also important to note that the
     argument list entries may be modified to point to strings other
     than those passed in (however, the contents of the strings pointed
     to by the argument list are not modified).

     The return value is ‘2’ if the argument list does not represent a
     valid Python command line, and otherwise the same as *note
     Py_RunMain(): bbc.

     In terms of the CPython runtime configuration APIs documented in
     the *note runtime configuration: 646. section (and without
     accounting for error handling), ‘Py_Main’ is approximately
     equivalent to:

          PyConfig config;
          PyConfig_InitPythonConfig(&config);
          PyConfig_SetArgv(&config, argc, argv);
          Py_InitializeFromConfig(&config);
          PyConfig_Clear(&config);

          Py_RunMain();

     In normal usage, an embedding application will call this function
     'instead' of calling *note Py_Initialize(): 460, *note
     Py_InitializeEx(): 5133. or *note Py_InitializeFromConfig(): 3f6.
     directly, and all settings will be applied as described elsewhere
     in this documentation.  If this function is instead called 'after'
     a preceding runtime initialization API call, then exactly which
     environmental and command line configuration settings will be
     updated is version dependent (as it depends on which settings
     correctly support being modified after they have already been set
     once when the runtime was first initialized).

 -- C の関数: int Py_RunMain (void)

     Executes the main module in a fully configured CPython runtime.

     Executes the command (*note PyConfig.run_command: 5519.), the
     script (*note PyConfig.run_filename: 551a.) or the module (*note
     PyConfig.run_module: 551b.) specified on the command line or in the
     configuration.  If none of these values are set, runs the
     interactive Python prompt (REPL) using the ‘__main__’ module's
     global namespace.

     If *note PyConfig.inspect: 401. is not set (the default), the
     return value will be ‘0’ if the interpreter exits normally (that
     is, without raising an exception), the exit status of an unhandled
     *note SystemExit: f3c, or ‘1’ for any other unhandled exception.

     If *note PyConfig.inspect: 401. is set (such as when the *note -i:
     16f4. option is used), rather than returning when the interpreter
     exits, execution will instead resume in an interactive Python
     prompt (REPL) using the ‘__main__’ module's global namespace.  If
     the interpreter exited with an exception, it is immediately raised
     in the REPL session.  The function return value is then determined
     by the way the 'REPL session' terminates: ‘0’, ‘1’, or the status
     of a *note SystemExit: f3c, as specified above.

     This function always finalizes the Python interpreter before it
     returns.

     See *note Python Configuration: 551c. for an example of a
     customized Python that always runs in isolated mode using *note
     Py_RunMain(): bbc.

 -- C の関数: int PyUnstable_AtExit (PyInterpreterState *interp, void
          (*func)(void*), void *data)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Register an *note atexit: d. callback for the target interpreter
     'interp'.  This is similar to *note Py_AtExit(): 5128, but takes an
     explicit interpreter and data pointer for the callback.

     There must be an *note attached thread state: 4ed1. for 'interp'.

     Added in version 3.13.


File: python.info,  Node: プロセスワイドのパラメータ,  Next: スレッド状態 thread state とグローバルインタプリタロック global interpreter lock,  Prev: インタープリタの初期化と終了処理,  Up: 初期化 initialization 、終了処理 finalization 、スレッド

7.10.4 プロセスワイドのパラメータ
---------------------------------

 -- C の関数: void Py_SetProgramName (const wchar_t *name)
     ' 次に属します: *note Stable ABI: 775.'

     This API is kept for backward compatibility: setting *note
     PyConfig.program_name: 3f2. should be used instead, see *note
     Python Initialization Configuration: 646.

     この関数を呼び出すなら、最初に *note Py_Initialize(): 460. を呼び出
     すよりも前に呼び出さなければなりません。この関数はインタプリタにプ
     ログラムの ‘main()’ 関数に指定した ‘argv[0]’ 引数の値を教えます (ワ
     イドキャラクタに変換されます)。この引数値は、 *note Py_GetPath():
     3e3. や、以下に示すその他の関数が、インタプリタの実行可能形式から
     Python ランタイムライブラリへの相対パスを取得するために使われます。
     デフォルトの値は ‘'python'’ です。引数はゼロ終端されたワイドキャラ
     クタ文字列で、静的な記憶領域に入っていなければならず、その内容はプ
     ログラムの実行中に変更してはなりません。 Python インタプリタ内のコ
     ードで、この記憶領域の内容を変更するものは一切ありません。

     Use *note Py_DecodeLocale(): dc0. to decode a bytes string to get a
     wchar_t* string.

     Deprecated since version 3.11, will be removed in version 3.15.

 -- C の関数: wchar_t *Py_GetProgramName ()
     ' 次に属します: *note Stable ABI: 775.'  Return the program name
     set with *note PyConfig.program_name: 3f2, or the default.  The
     returned string points into static storage; the caller should not
     modify its value.

     This function should not be called before *note Py_Initialize():
     460, otherwise it returns ‘NULL’.

     バージョン 3.10 で変更: It now returns ‘NULL’ if called before
     *note Py_Initialize(): 460.

     Deprecated since version 3.13, will be removed in version 3.15: Use
     *note PyConfig_Get("executable"): 37c. (*note sys.executable: 3ed.)
     instead.

 -- C の関数: wchar_t *Py_GetPrefix ()
     ' 次に属します: *note Stable ABI: 775.'  Return the 'prefix' for
     installed platform-independent files.  This is derived through a
     number of complicated rules from the program name set with *note
     PyConfig.program_name: 3f2. and some environment variables; for
     example, if the program name is ‘'/usr/local/bin/python'’, the
     prefix is ‘'/usr/local'’.  The returned string points into static
     storage; the caller should not modify its value.  This corresponds
     to the ‘prefix’ variable in the top-level ‘Makefile’ and the *note
     -prefix: 214f. argument to the ‘configure’ script at build time.
     The value is available to Python code as ‘sys.base_prefix’.  It is
     only useful on Unix.  See also the next function.

     This function should not be called before *note Py_Initialize():
     460, otherwise it returns ‘NULL’.

     バージョン 3.10 で変更: It now returns ‘NULL’ if called before
     *note Py_Initialize(): 460.

     Deprecated since version 3.13, will be removed in version 3.15: Use
     *note PyConfig_Get("base_prefix"): 37c. (*note sys.base_prefix:
     3e6.) instead.  Use *note PyConfig_Get("prefix"): 37c. (*note
     sys.prefix: 3e7.) if *note virtual environments: 3e8. need to be
     handled.

 -- C の関数: wchar_t *Py_GetExecPrefix ()
     ' 次に属します: *note Stable ABI: 775.'  Return the 'exec-prefix'
     for installed platform-'dependent' files.  This is derived through
     a number of complicated rules from the program name set with *note
     PyConfig.program_name: 3f2. and some environment variables; for
     example, if the program name is ‘'/usr/local/bin/python'’, the
     exec-prefix is ‘'/usr/local'’.  The returned string points into
     static storage; the caller should not modify its value.  This
     corresponds to the ‘exec_prefix’ variable in the top-level
     ‘Makefile’ and the ‘--exec-prefix’ argument to the ‘configure’
     script at build time.  The value is available to Python code as
     ‘sys.base_exec_prefix’.  It is only useful on Unix.

     背景: プラットフォーム依存のファイル (実行形式や共有ライブラリ) が
     別のディレクトリツリー内にインストールされている場合、 exec-prefix
     は prefix と異なります。典型的なインストール形態では、プラットフォ
     ーム非依存のファイルが ‘/usr/local’ に収められる一方、プラットフォ
     ーム依存のファイルは ‘/usr/local/plat’ サブツリーに収められます。

     一般的に、プラットフォームとは、ハードウェアとソフトウェアファミリ
     の組み合わせを指します。例えば、Solaris 2.x を動作させている Sparc
     マシンは全て同じプラットフォームであるとみなしますが、Solaris 2.x を
     動作させている Intel マシンは違うプラットフォームになりますし、同じ
     Intel マシンでも Linux を動作させているならまた別のプラットフォーム
     です。一般的には、同じオペレーティングシステムでも、メジャーリビジ
     ョンの違うものは異なるプラットフォームです。非 Unix のオペレーティ
     ングシステムの場合は話はまた別です; 非 Unix のシステムでは、インス
     トール方法はとても異なっていて、prefix や exec-prefix には意味がな
     く、空文字列が設定されています。コンパイル済みの Python バイトコー
     ドはプラットフォームに依存しないので注意してください (ただし、どの
     バージョンの Python でコンパイルされたかには依存します!)。

     システム管理者は、 ‘mount’ や ‘automount’ プログラムを使って、各プ
     ラットフォーム用の ‘/usr/local/plat’ を異なったファイルシステムに置
     き、プラットフォーム間で ‘/usr/local’ を共有するための設定方法を知
     っているでしょう。

     This function should not be called before *note Py_Initialize():
     460, otherwise it returns ‘NULL’.

     バージョン 3.10 で変更: It now returns ‘NULL’ if called before
     *note Py_Initialize(): 460.

     Deprecated since version 3.13, will be removed in version 3.15: Use
     *note PyConfig_Get("base_exec_prefix"): 37c. (*note
     sys.base_exec_prefix: 3ea.) instead.  Use *note
     PyConfig_Get("exec_prefix"): 37c. (*note sys.exec_prefix: 3eb.) if
     *note virtual environments: 3e8. need to be handled.

 -- C の関数: wchar_t *Py_GetProgramFullPath ()
     ' 次に属します: *note Stable ABI: 775.'

     Return the full program name of the Python executable; this is
     computed as a side-effect of deriving the default module search
     path from the program name (set by *note PyConfig.program_name:
     3f2.).  The returned string points into static storage; the caller
     should not modify its value.  The value is available to Python code
     as ‘sys.executable’.

     This function should not be called before *note Py_Initialize():
     460, otherwise it returns ‘NULL’.

     バージョン 3.10 で変更: It now returns ‘NULL’ if called before
     *note Py_Initialize(): 460.

     Deprecated since version 3.13, will be removed in version 3.15: Use
     *note PyConfig_Get("executable"): 37c. (*note sys.executable: 3ed.)
     instead.

 -- C の関数: wchar_t *Py_GetPath ()
     ' 次に属します: *note Stable ABI: 775.'

     Return the default module search path; this is computed from the
     program name (set by *note PyConfig.program_name: 3f2.) and some
     environment variables.  The returned string consists of a series of
     directory names separated by a platform dependent delimiter
     character.  The delimiter character is ‘':'’ on Unix and macOS,
     ‘';'’ on Windows.  The returned string points into static storage;
     the caller should not modify its value.  The list *note sys.path:
     3e4. is initialized with this value on interpreter startup; it can
     be (and usually is) modified later to change the search path for
     loading modules.

     This function should not be called before *note Py_Initialize():
     460, otherwise it returns ‘NULL’.

     バージョン 3.10 で変更: It now returns ‘NULL’ if called before
     *note Py_Initialize(): 460.

     Deprecated since version 3.13, will be removed in version 3.15: Use
     *note PyConfig_Get("module_search_paths"): 37c. (*note sys.path:
     3e4.) instead.

 -- C の関数: const char *Py_GetVersion ()
     ' 次に属します: *note Stable ABI: 775.'  Python インタプリタのバー
     ジョンを返します。バージョンは、次のような形式の文字列です

          "3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \n[GCC 4.2.3]"

     第一ワード (最初のスペース文字まで) は、現在の Python のバージョン
     です; 最初の文字は、ピリオドで区切られたメジャーバージョンとマイナ
     ーバージョンです。関数が返す文字列ポインタは静的な記憶領域を返しま
     す; 関数の呼び出し側はこの値を変更できません。この値は Python コー
     ドからは *note sys.version: 49c. として利用できます。

     See also the *note Py_Version: 381. constant.

 -- C の関数: const char *Py_GetPlatform ()
     ' 次に属します: *note Stable ABI: 775.'

     現在のプラットフォームのプラットフォーム識別文字列を返します。
     Unixでは、オペレーティングシステムの "公式の" 名前を小文字に変換し
     、後ろにメジャーリビジョン番号を付けた構成になっています。例えば
     Solaris 2.x は、SunOS 5.x, としても知られていますが、‘'sunos5'’ に
     なります。macOS では ‘'darwin'’ です。Windows では ‘'win'’ です。関
     数が返す文字列ポインタは静的な記憶領域を返します; 関数の呼び出し側
     はこの値を変更できません。この値は Python コードからは
     ‘sys.platform’ として利用できます。

 -- C の関数: const char *Py_GetCopyright ()
     ' 次に属します: *note Stable ABI: 775.'  現在の Python バージョンに
     対する公式の著作権表示文字列を返します。例えば

     ‘'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'’

     関数が返す文字列ポインタは静的な記憶領域を返します; 関数の呼び出し
     側はこの値を変更できません。この値は Python コードからは
     ‘sys.copyright’ として利用できます。

 -- C の関数: const char *Py_GetCompiler ()
     ' 次に属します: *note Stable ABI: 775.'  現在使っているバージョンの
     Python をビルドする際に用いたコンパイラを示す文字列を、角括弧で囲っ
     た文字列を返します。例えば:

          "[GCC 2.7.2.2]"

     関数が返す文字列ポインタは静的な記憶領域を返します; 関数の呼び出し
     側はこの値を変更できません。この値は Python コードからは
     ‘sys.version’ の一部として取り出せます。

 -- C の関数: const char *Py_GetBuildInfo ()
     ' 次に属します: *note Stable ABI: 775.'  現在使っている Python イン
     タプリタインスタンスの、シーケンス番号とビルド日時に関する情報を返
     します。例えば

          "#67, Aug  1 1997, 22:34:28"

     関数が返す文字列ポインタは静的な記憶領域を返します; 関数の呼び出し
     側はこの値を変更できません。この値は Python コードからは
     ‘sys.version’ の一部として取り出せます。

 -- C の関数: void PySys_SetArgvEx (int argc, wchar_t **argv, int
          updatepath)
     ' 次に属します: *note Stable ABI: 775.'

     This API is kept for backward compatibility: setting *note
     PyConfig.argv: 3f1, *note PyConfig.parse_argv: 1cf1. and *note
     PyConfig.safe_path: 977. should be used instead, see *note Python
     Initialization Configuration: 646.

     'argc' および 'argv' に基づいて *note sys.argv: 147c. を設定します
     。これらの引数はプログラムの ‘main()’ に渡した引数に似ていますが、
     最初の要素が Python インタプリタの宿主となっている実行形式の名前で
     はなく、実行されるスクリプト名を参照しなければならない点が違います
     。実行するスクリプトがない場合、 'argv' の最初の要素は空文字列にし
     てもかまいません。この関数が *note sys.argv: 147c. の初期化に失敗し
     た場合、致命的エラーを *note Py_FatalError(): b7a. で知らせます。

     'updatepath' が 0 の場合、ここまでの動作がこの関数がすることの全て
     です。 'updatepath' が 0 でない場合、この関数は *note sys.path:
     3e4. を以下のアルゴリズムに基づいて修正します:

        - 存在するスクリプトの名前が ‘argv[0]’ に渡された場合、そのスク
          リプトがある場所の絶対パスを *note sys.path: 3e4. の先頭に追加
          します。

        - それ以外の場合 ('argc' が ‘0’ だったり、 ‘argv[0]’ が存在する
          ファイル名を指していない場合)、 *note sys.path: 3e4. の先頭に
          空の文字列を追加します。 これは現在の作業ディレクトリ (‘"."’)
          を先頭に追加するのと同じです。

     Use *note Py_DecodeLocale(): dc0. to decode a bytes string to get a
     wchar_t* string.

     See also *note PyConfig.orig_argv: a94. and *note PyConfig.argv:
     3f1. members of the *note Python Initialization Configuration: 646.

          注釈: It is recommended that applications embedding the Python
          interpreter for purposes other than executing a single script
          pass ‘0’ as 'updatepath', and update *note sys.path: 3e4.
          themselves if desired.  See CVE 2008-5983(1).

          3.1.3 より前のバージョンでは、 *note PySys_SetArgv(): 19b8. の
          呼び出しが完了した後に *note sys.path: 3e4. の先頭の要素を取り
          出すことで、同じ効果が得られます。例えばこのように使います:

               PyRun_SimpleString("import sys; sys.path.pop(0)\n");

     Added in version 3.1.3.

     Deprecated since version 3.11, will be removed in version 3.15.

 -- C の関数: void PySys_SetArgv (int argc, wchar_t **argv)
     ' 次に属します: *note Stable ABI: 775.'  This API is kept for
     backward compatibility: setting *note PyConfig.argv: 3f1. and *note
     PyConfig.parse_argv: 1cf1. should be used instead, see *note Python
     Initialization Configuration: 646.

     この関数は、 ‘python’ インタプリタが *note -I: b57. オプション付き
     で実行されている場合を除き *note PySys_SetArgvEx(): 19b7. の
     'updatepath' に ‘1’ を設定したのと同じように動作します。

     Use *note Py_DecodeLocale(): dc0. to decode a bytes string to get a
     wchar_t* string.

     See also *note PyConfig.orig_argv: a94. and *note PyConfig.argv:
     3f1. members of the *note Python Initialization Configuration: 646.

     バージョン 3.4 で変更: 'updatepath' の値は *note -I: b57. オプショ
     ンに依存します。

     Deprecated since version 3.11, will be removed in version 3.15.

 -- C の関数: void Py_SetPythonHome (const wchar_t *home)
     ' 次に属します: *note Stable ABI: 775.'  This API is kept for
     backward compatibility: setting *note PyConfig.home: 3f3. should be
     used instead, see *note Python Initialization Configuration: 646.

     Python の標準ライブラリがある、デフォルトの "home" ディレクトリを設
     定します。引数の文字列の意味については *note PYTHONHOME: 3f0. を参
     照してください。

     引数は静的なストレージに置かれてプログラム実行中に書き換えられない
     ようなゼロ終端の文字列であるべきです。Python インタプリタはこのスト
     レージの内容を変更しません。

     Use *note Py_DecodeLocale(): dc0. to decode a bytes string to get a
     wchar_t* string.

     Deprecated since version 3.11, will be removed in version 3.15.

 -- C の関数: wchar_t *Py_GetPythonHome ()
     ' 次に属します: *note Stable ABI: 775.'  Return the default "home",
     that is, the value set by *note PyConfig.home: 3f3, or the value of
     the *note PYTHONHOME: 3f0. environment variable if it is set.

     This function should not be called before *note Py_Initialize():
     460, otherwise it returns ‘NULL’.

     バージョン 3.10 で変更: It now returns ‘NULL’ if called before
     *note Py_Initialize(): 460.

     Deprecated since version 3.13, will be removed in version 3.15: Use
     *note PyConfig_Get("home"): 37c. or the *note PYTHONHOME: 3f0.
     environment variable instead.

   ---------- Footnotes ----------

   (1) https://www.cve.org/CVERecord?id=CVE-2008-5983


File: python.info,  Node: スレッド状態 thread state とグローバルインタプリタロック global interpreter lock,  Next: サブインタプリタサポート,  Prev: プロセスワイドのパラメータ,  Up: 初期化 initialization 、終了処理 finalization 、スレッド

7.10.5 スレッド状態 (thread state) とグローバルインタプリタロック (global interpreter lock)
-------------------------------------------------------------------------------------------

Unless on a *note free-threaded: 1f4. build of *note CPython: 905, the
Python interpreter is not fully thread-safe.  In order to support
multi-threaded Python programs, there's a global lock, called the *note
global interpreter lock: 474. or *note GIL: 164, that must be held by
the current thread before it can safely access Python objects.  Without
the lock, even the simplest operations could cause problems in a
multi-threaded program: for example, when two threads simultaneously
increment the reference count of the same object, the reference count
could end up being incremented only once instead of twice.

このため、 *note GIL: 164. を獲得したスレッドだけが Python オブジェクト
を操作したり、 Python/C API 関数を呼び出したりできるというルールがありま
す。並行処理をエミュレートするために、インタプリタは定期的にロックを解放
したり獲得したりします。 (*note sys.setswitchinterval(): b44. を参照) こ
のロックはブロックが起こりうる I/O 操作の付近でも解放・獲得され、 I/O を
要求するスレッドが I/O 操作の完了を待つ間、他のスレッドが動作できるよう
にしています。

The Python interpreter keeps some thread-specific bookkeeping
information inside a data structure called *note PyThreadState: 990,
known as a *note thread state: 1846.  Each OS thread has a thread-local
pointer to a *note PyThreadState: 990.; a thread state referenced by
this pointer is considered to be *note attached: 4ed1.

A thread can only have one *note attached thread state: 4ed1. at a time.
An attached thread state is typically analogous with holding the *note
GIL: 164, except on *note free-threaded: 1f4. builds.  On builds with
the *note GIL: 164. enabled, *note attaching: 4ed1. a thread state will
block until the *note GIL: 164. can be acquired.  However, even on
builds with the *note GIL: 164. disabled, it is still required to have
an attached thread state to call most of the C API.

In general, there will always be an *note attached thread state: 4ed1.
when using Python's C API. Only in some specific cases (such as in a
*note Py_BEGIN_ALLOW_THREADS: 4ebd. block) will the thread not have an
attached thread state.  If uncertain, check if *note
PyThreadState_GetUnchecked(): 423. returns ‘NULL’.

* Menu:

* Detaching the thread state from extension code::
* Python 以外で作られたスレッド::
* Supporting subinterpreters in non-Python threads::
* Cautions about fork(): Cautions about fork.
* Cautions regarding runtime finalization::
* 高レベルAPI::
* 低レベルAPI::


File: python.info,  Node: Detaching the thread state from extension code,  Next: Python 以外で作られたスレッド,  Up: スレッド状態 thread state とグローバルインタプリタロック global interpreter lock

7.10.5.1 Detaching the thread state from extension code
.......................................................

Most extension code manipulating the *note thread state: 1846. has the
following simple structure:

     Save the thread state in a local variable.
     ... Do some blocking I/O operation ...
     Restore the thread state from the local variable.

この構造は非常に一般的なので、作業を単純にするために2つのマクロが用意さ
れています:

     Py_BEGIN_ALLOW_THREADS
     ... Do some blocking I/O operation ...
     Py_END_ALLOW_THREADS

*note Py_BEGIN_ALLOW_THREADS: 4ebd. マクロは新たなブロックを開始し、隠し
ローカル変数を宣言します; *note Py_END_ALLOW_THREADS: c7f. はブロックを
閉じます。

上のブロックは次のコードに展開されます:

     PyThreadState *_save;

     _save = PyEval_SaveThread();
     ... Do some blocking I/O operation ...
     PyEval_RestoreThread(_save);

Here is how these functions work:

The *note attached thread state: 4ed1. holds the *note GIL: 164. for the
entire interpreter.  When detaching the *note attached thread state:
4ed1, the *note GIL: 164. is released, allowing other threads to attach
a thread state to their own thread, thus getting the *note GIL: 164. and
can start executing.  The pointer to the prior *note attached thread
state: 4ed1. is stored as a local variable.  Upon reaching *note
Py_END_ALLOW_THREADS: c7f, the thread state that was previously *note
attached: 4ed1. is passed to *note PyEval_RestoreThread(): 648.  This
function will block until another releases its *note thread state: 4ed1,
thus allowing the old *note thread state: 4ed1. to get re-attached and
the C API can be called again.

For *note free-threaded: 1f4. builds, the *note GIL: 164. is normally
out of the question, but detaching the *note thread state: 4ed1. is
still required for blocking I/O and long operations.  The difference is
that threads don't have to wait for the *note GIL: 164. to be released
to attach their thread state, allowing true multi-core parallelism.

     注釈: Calling system I/O functions is the most common use case for
     detaching the *note thread state: 4ed1, but it can also be useful
     before calling long-running computations which don't need access to
     Python objects, such as compression or cryptographic functions
     operating over memory buffers.  For example, the standard *note
     zlib: 139. and *note hashlib: 6c. modules detach the *note thread
     state: 4ed1. when compressing or hashing data.


File: python.info,  Node: Python 以外で作られたスレッド,  Next: Supporting subinterpreters in non-Python threads,  Prev: Detaching the thread state from extension code,  Up: スレッド状態 thread state とグローバルインタプリタロック global interpreter lock

7.10.5.2 Python 以外で作られたスレッド
......................................

When threads are created using the dedicated Python APIs (such as the
*note threading: f3. module), a thread state is automatically associated
to them and the code showed above is therefore correct.  However, when
threads are created from C (for example by a third-party library with
its own thread management), they don't hold the *note GIL: 164, because
they don't have an *note attached thread state: 4ed1.

If you need to call Python code from these threads (often this will be
part of a callback API provided by the aforementioned third-party
library), you must first register these threads with the interpreter by
creating an *note attached thread state: 4ed1. before you can start
using the Python/C API. When you are done, you should detach the *note
thread state: 4ed1, and finally free it.

*note PyGILState_Ensure(): 64a. と *note PyGILState_Release(): 64b. はこ
の処理を自動的に行います。 Cのスレッドから Python を呼び出す典型的な方法
は以下のとおりです:

     PyGILState_STATE gstate;
     gstate = PyGILState_Ensure();

     /* Perform Python actions here. */
     result = CallSomeFunction();
     /* evaluate result or handle exception */

     /* Release the thread. No Python API allowed beyond this point. */
     PyGILState_Release(gstate);

Note that the ‘PyGILState_*’ functions assume there is only one global
interpreter (created automatically by *note Py_Initialize(): 460.).
Python supports the creation of additional interpreters (using *note
Py_NewInterpreter(): 1b31.), but mixing multiple interpreters and the
‘PyGILState_*’ API is unsupported.  This is because *note
PyGILState_Ensure(): 64a. and similar functions default to *note
attaching: 4ed1. a *note thread state: 1846. for the main interpreter,
meaning that the thread can't safely interact with the calling
subinterpreter.


File: python.info,  Node: Supporting subinterpreters in non-Python threads,  Next: Cautions about fork,  Prev: Python 以外で作られたスレッド,  Up: スレッド状態 thread state とグローバルインタプリタロック global interpreter lock

7.10.5.3 Supporting subinterpreters in non-Python threads
.........................................................

If you would like to support subinterpreters with non-Python created
threads, you must use the ‘PyThreadState_*’ API instead of the
traditional ‘PyGILState_*’ API.

In particular, you must store the interpreter state from the calling
function and pass it to *note PyThreadState_New(): 50c3, which will
ensure that the *note thread state: 1846. is targeting the correct
interpreter:

     /* The return value of PyInterpreterState_Get() from the
        function that created this thread. */
     PyInterpreterState *interp = ThreadData->interp;
     PyThreadState *tstate = PyThreadState_New(interp);
     PyThreadState_Swap(tstate);

     /* GIL of the subinterpreter is now held.
        Perform Python actions here. */
     result = CallSomeFunction();
     /* evaluate result or handle exception */

     /* Destroy the thread state. No Python API allowed beyond this point. */
     PyThreadState_Clear(tstate);
     PyThreadState_DeleteCurrent();


File: python.info,  Node: Cautions about fork,  Next: Cautions regarding runtime finalization,  Prev: Supporting subinterpreters in non-Python threads,  Up: スレッド状態 thread state とグローバルインタプリタロック global interpreter lock

7.10.5.4 Cautions about fork()
..............................

Another important thing to note about threads is their behaviour in the
face of the C ‘fork()’ call.  On most systems with ‘fork()’, after a
process forks only the thread that issued the fork will exist.  This has
a concrete impact both on how locks must be handled and on all stored
state in CPython's runtime.

The fact that only the "current" thread remains means any locks held by
other threads will never be released.  Python solves this for *note
os.fork(): 4b5. by acquiring the locks it uses internally before the
fork, and releasing them afterwards.  In addition, it resets any *note
Lock objects: 3623. in the child.  When extending or embedding Python,
there is no way to inform Python of additional (non-Python) locks that
need to be acquired before or reset after a fork.  OS facilities such as
‘pthread_atfork()’ would need to be used to accomplish the same thing.
Additionally, when extending or embedding Python, calling ‘fork()’
directly rather than through *note os.fork(): 4b5. (and returning to or
calling into Python) may result in a deadlock by one of Python's
internal locks being held by a thread that is defunct after the fork.
*note PyOS_AfterFork_Child(): 430. tries to reset the necessary locks,
but is not always able to.

The fact that all other threads go away also means that CPython's
runtime state there must be cleaned up properly, which *note os.fork():
4b5. does.  This means finalizing all other *note PyThreadState: 990.
objects belonging to the current interpreter and all other *note
PyInterpreterState: aba. objects.  Due to this and the special nature of
the *note "main" interpreter: 163, ‘fork()’ should only be called in
that interpreter's "main" thread, where the CPython global runtime was
originally initialized.  The only exception is if ‘exec()’ will be
called immediately after.


File: python.info,  Node: Cautions regarding runtime finalization,  Next: 高レベルAPI,  Prev: Cautions about fork,  Up: スレッド状態 thread state とグローバルインタプリタロック global interpreter lock

7.10.5.5 Cautions regarding runtime finalization
................................................

In the late stage of *note interpreter shutdown: 479, after attempting
to wait for non-daemon threads to exit (though this can be interrupted
by *note KeyboardInterrupt: bc5.) and running the *note atexit: d.
functions, the runtime is marked as 'finalizing': *note
Py_IsFinalizing(): 5fd. and *note sys.is_finalizing(): c80. return true.
At this point, only the 'finalization thread' that initiated
finalization (typically the main thread) is allowed to acquire the *note
GIL: 164.

If any thread, other than the finalization thread, attempts to attach a
*note thread state: 1846. during finalization, either explicitly or
implicitly, the thread enters 'a permanently blocked state' where it
remains until the program exits.  In most cases this is harmless, but
this can result in deadlock if a later stage of finalization attempts to
acquire a lock owned by the blocked thread, or otherwise waits on the
blocked thread.

Gross?  Yes.  This prevents random crashes and/or unexpectedly skipped
C++ finalizations further up the call stack when such threads were
forcibly exited here in CPython 3.13 and earlier.  The CPython runtime
*note thread state: 1846. C APIs have never had any error reporting or
handling expectations at *note thread state: 1846. attachment time that
would've allowed for graceful exit from this situation.  Changing that
would require new stable C APIs and rewriting the majority of C code in
the CPython ecosystem to use those with error handling.


File: python.info,  Node: 高レベルAPI,  Next: 低レベルAPI,  Prev: Cautions regarding runtime finalization,  Up: スレッド状態 thread state とグローバルインタプリタロック global interpreter lock

7.10.5.6 高レベルAPI
....................

C拡張を書いたりPythonインタプリタを埋め込むときに最も一般的に使われる型
や関数は次のとおりです:

 -- C のデータ型: type PyInterpreterState
     ' 次に属します: *note Limited API: 775. (不透明な構造体として).'  こ
     のデータ構造体は、協調動作する多数のスレッド間で共有されている状態
     を表現します。同じインタプリタに属するスレッドはモジュール管理情報
     やその他いくつかの内部的な情報を共有しています。この構造体には公開
     (public) のメンバはありません。

     異なるインタプリタに属するスレッド間では、利用可能なメモリ、開かれ
     ているファイルデスクリプタなどといったプロセス状態を除いて、初期状
     態では何も共有されていません。GILもまた、スレッドがどのインタプリタ
     に属しているかに関わらずすべてのスレッドで共有されています。

     バージョン 3.12 で変更: PEP 684(1) introduced the possibility of a
     *note per-interpreter GIL: 5528.  See *note
     Py_NewInterpreterFromConfig(): 689.

 -- C のデータ型: type PyThreadState
     ' 次に属します: *note Limited API: 775. (不透明な構造体として).'
     This data structure represents the state of a single thread.  The
     only public data member is:

      -- C のメンバ変数: *note PyInterpreterState: aba. *interp

          This thread's interpreter state.

 -- C の関数: void PyEval_InitThreads ()
     ' 次に属します: *note Stable ABI: 775.'

     Deprecated function which does nothing.

     In Python 3.6 and older, this function created the GIL if it didn't
     exist.

     バージョン 3.9 で変更: The function now does nothing.

     バージョン 3.7 で変更: この関数は *note Py_Initialize(): 460. から
     呼び出されるようになり、わざわざ呼び出す必要はもう無くなりました。

     バージョン 3.2 で変更: この関数は *note Py_Initialize(): 460. より
     前に呼び出すことができなくなりました。

     バージョン 3.9 で非推奨.

 -- C の関数: *note PyThreadState: 990. *PyEval_SaveThread ()
     ' 次に属します: *note Stable ABI: 775.'  Detach the *note attached
     thread state: 4ed1. and return it.  The thread will have no *note
     thread state: 1846. upon returning.

 -- C の関数: void PyEval_RestoreThread (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775.'  Set the *note attached
     thread state: 4ed1. to 'tstate'.  The passed *note thread state:
     1846. 'should not' be *note attached: 4ed1, otherwise deadlock
     ensues.  'tstate' will be attached upon returning.

          注釈: Calling this function from a thread when the runtime is
          finalizing will hang the thread until the program exits, even
          if the thread was not created by Python.  Refer to *note
          Cautions regarding runtime finalization: 5525. for more
          details.

     バージョン 3.14 で変更: Hangs the current thread, rather than
     terminating it, if called while the interpreter is finalizing.

 -- C の関数: *note PyThreadState: 990. *PyThreadState_Get ()
     ' 次に属します: *note Stable ABI: 775.'  Return the *note attached
     thread state: 4ed1.  If the thread has no attached thread state,
     (such as when inside of *note Py_BEGIN_ALLOW_THREADS: 4ebd. block),
     then this issues a fatal error (so that the caller needn't check
     for ‘NULL’).

     See also *note PyThreadState_GetUnchecked(): 423.

 -- C の関数: *note PyThreadState: 990. *PyThreadState_GetUnchecked ()

     Similar to *note PyThreadState_Get(): 615, but don't kill the
     process with a fatal error if it is NULL. The caller is responsible
     to check if the result is NULL.

     Added in version 3.13: In Python 3.5 to 3.12, the function was
     private and known as ‘_PyThreadState_UncheckedGet()’.

 -- C の関数: *note PyThreadState: 990. *PyThreadState_Swap
          (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775.'  Set the *note attached
     thread state: 4ed1. to 'tstate', and return the *note thread state:
     1846. that was attached prior to calling.

     This function is safe to call without an *note attached thread
     state: 4ed1.; it will simply return ‘NULL’ indicating that there
     was no prior thread state.

     参考
     ....

     *note PyEval_ReleaseThread(): 4fde.

          注釈: Similar to *note PyGILState_Ensure(): 64a, this function
          will hang the thread if the runtime is finalizing.

以下の関数はスレッドローカルストレージを利用していて、サブインタプリタと
の互換性がありません:

 -- C のデータ型: type PyGILState_STATE
     ' 次に属します: *note Stable ABI: 775.'  The type of the value
     returned by *note PyGILState_Ensure(): 64a. and passed to *note
     PyGILState_Release(): 64b.

      -- C Enumerator: enumerator PyGILState_LOCKED

          The GIL was already held when *note PyGILState_Ensure(): 64a.
          was called.

      -- C Enumerator: enumerator PyGILState_UNLOCKED

          The GIL was not held when *note PyGILState_Ensure(): 64a. was
          called.

 -- C の関数: *note PyGILState_STATE: 502e. PyGILState_Ensure ()
     ' 次に属します: *note Stable ABI: 775.'  Ensure that the current
     thread is ready to call the Python C API regardless of the current
     state of Python, or of the *note attached thread state: 4ed1.  This
     may be called as many times as desired by a thread as long as each
     call is matched with a call to *note PyGILState_Release(): 64b.  In
     general, other thread-related APIs may be used between *note
     PyGILState_Ensure(): 64a. and *note PyGILState_Release(): 64b.
     calls as long as the thread state is restored to its previous state
     before the Release().  For example, normal usage of the *note
     Py_BEGIN_ALLOW_THREADS: 4ebd. and *note Py_END_ALLOW_THREADS: c7f.
     macros is acceptable.

     The return value is an opaque "handle" to the *note attached thread
     state: 4ed1. when *note PyGILState_Ensure(): 64a. was called, and
     must be passed to *note PyGILState_Release(): 64b. to ensure Python
     is left in the same state.  Even though recursive calls are
     allowed, these handles 'cannot' be shared - each unique call to
     *note PyGILState_Ensure(): 64a. must save the handle for its call
     to *note PyGILState_Release(): 64b.

     When the function returns, there will be an *note attached thread
     state: 4ed1. and the thread will be able to call arbitrary Python
     code.  Failure is a fatal error.

          警告: Calling this function when the runtime is finalizing is
          unsafe.  Doing so will either hang the thread until the
          program ends, or fully crash the interpreter in rare cases.
          Refer to *note Cautions regarding runtime finalization: 5525.
          for more details.

     バージョン 3.14 で変更: Hangs the current thread, rather than
     terminating it, if called while the interpreter is finalizing.

 -- C の関数: void PyGILState_Release (PyGILState_STATE)
     ' 次に属します: *note Stable ABI: 775.'  獲得したすべてのリソースを
     解放します。この関数を呼び出すと、Pythonの状態は対応する *note
     PyGILState_Ensure(): 64a. を呼び出す前と同じとなります (通常、この
     状態は呼び出し元でははわかりませんので、GILState APIを利用するよう
     にしてください)。

     *note PyGILState_Ensure(): 64a. を呼び出す場合は、必ず同一スレッド
     内で対応する *note PyGILState_Release(): 64b. を呼び出してください
     。

 -- C の関数: *note PyThreadState: 990. *PyGILState_GetThisThreadState
          ()
     ' 次に属します: *note Stable ABI: 775.'  Get the *note attached
     thread state: 4ed1. for this thread.  May return ‘NULL’ if no
     GILState API has been used on the current thread.  Note that the
     main thread always has such a thread-state, even if no
     auto-thread-state call has been made on the main thread.  This is
     mainly a helper/diagnostic function.

          注釈: This function may return non-‘NULL’ even when the *note
          thread state: 1846. is detached.  Prefer *note
          PyThreadState_Get(): 615. or *note
          PyThreadState_GetUnchecked(): 423. for most cases.

     参考
     ....

     *note PyThreadState_Get(): 615.

 -- C の関数: int PyGILState_Check ()

     Return ‘1’ if the current thread is holding the *note GIL: 164. and
     ‘0’ otherwise.  This function can be called from any thread at any
     time.  Only if it has had its *note thread state: 4ed1. initialized
     via *note PyGILState_Ensure(): 64a. will it return ‘1’.  This is
     mainly a helper/diagnostic function.  It can be useful for example
     in callback contexts or memory allocation functions when knowing
     that the *note GIL: 164. is locked can allow the caller to perform
     sensitive actions or otherwise behave differently.

          注釈: If the current Python process has ever created a
          subinterpreter, this function will 'always' return ‘1’.
          Prefer *note PyThreadState_GetUnchecked(): 423. for most
          cases.

     Added in version 3.4.

以下のマクロは、通常末尾にセミコロンを付けずに使います; Python ソース配
布物内の使用例を見てください。

 -- C のマクロ: Py_BEGIN_ALLOW_THREADS
     ' 次に属します: *note Stable ABI: 775.'  このマクロを展開すると ‘{
     PyThreadState *_save; _save = PyEval_SaveThread();’ になります。マ
     クロに開き波括弧が入っていることに注意してください; この波括弧は後
     で *note Py_END_ALLOW_THREADS: c7f. マクロと対応させなければなりま
     せん。マクロについての詳しい議論は上記を参照してください。

 -- C のマクロ: Py_END_ALLOW_THREADS
     ' 次に属します: *note Stable ABI: 775.'  このマクロを展開すると
     ‘PyEval_RestoreThread(_save); }’ になります。マクロに開き波括弧が入
     っていることに注意してください; この波括弧は事前の *note
     Py_BEGIN_ALLOW_THREADS: 4ebd. マクロと対応していなければなりません
     。マクロについての詳しい議論は上記を参照してください。

 -- C のマクロ: Py_BLOCK_THREADS
     ' 次に属します: *note Stable ABI: 775.'  このマクロを展開すると
     ‘PyEval_RestoreThread(_save);’ になります: 閉じ波括弧のない *note
     Py_END_ALLOW_THREADS: c7f. と同じです。

 -- C のマクロ: Py_UNBLOCK_THREADS
     ' 次に属します: *note Stable ABI: 775.'  このマクロを展開すると
     ‘_save = PyEval_SaveThread();’ になります: 開き波括弧のない *note
     Py_BEGIN_ALLOW_THREADS: 4ebd. と同じです。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0684/


File: python.info,  Node: 低レベルAPI,  Prev: 高レベルAPI,  Up: スレッド状態 thread state とグローバルインタプリタロック global interpreter lock

7.10.5.7 低レベルAPI
....................

次の全ての関数は *note Py_Initialize(): 460. の後に呼び出さなければなり
ません。

バージョン 3.7 で変更: *note Py_Initialize(): 460. now initializes the
*note GIL: 164. and sets an *note attached thread state: 4ed1.

 -- C の関数: *note PyInterpreterState: aba. *PyInterpreterState_New ()
     ' 次に属します: *note Stable ABI: 775.'  Create a new interpreter
     state object.  An *note attached thread state: 4ed1. is not needed,
     but may optionally exist if it is necessary to serialize calls to
     this function.

     引数無しで *note 監査イベント: 1c6e.
     ‘cpython.PyInterpreterState_New’ を送出します。

 -- C の関数: void PyInterpreterState_Clear (PyInterpreterState *interp)
     ' 次に属します: *note Stable ABI: 775.'  Reset all information in
     an interpreter state object.  There must be an *note attached
     thread state: 4ed1. for the interpreter.

     引数無しで *note 監査イベント: 1c6e.
     ‘cpython.PyInterpreterState_Clear’ を送出します。

 -- C の関数: void PyInterpreterState_Delete (PyInterpreterState
          *interp)
     ' 次に属します: *note Stable ABI: 775.'  Destroy an interpreter
     state object.  There 'should not' be an *note attached thread
     state: 4ed1. for the target interpreter.  The interpreter state
     must have been reset with a previous call to *note
     PyInterpreterState_Clear(): 4753.

 -- C の関数: *note PyThreadState: 990. *PyThreadState_New
          (PyInterpreterState *interp)
     ' 次に属します: *note Stable ABI: 775.'  Create a new thread state
     object belonging to the given interpreter object.  An *note
     attached thread state: 4ed1. is not needed.

 -- C の関数: void PyThreadState_Clear (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775.'  Reset all information in a
     *note thread state: 1846. object.  'tstate' must be *note attached:
     4ed1.

     バージョン 3.9 で変更: This function now calls the
     ‘PyThreadState.on_delete’ callback.  Previously, that happened in
     *note PyThreadState_Delete(): 1d89.

     バージョン 3.13 で変更: The ‘PyThreadState.on_delete’ callback was
     removed.

 -- C の関数: void PyThreadState_Delete (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775.'  Destroy a *note thread
     state: 1846. object.  'tstate' should not be *note attached: 4ed1.
     to any thread.  'tstate' must have been reset with a previous call
     to *note PyThreadState_Clear(): 1991.

 -- C の関数: void PyThreadState_DeleteCurrent (void)

     Detach the *note attached thread state: 4ed1. (which must have been
     reset with a previous call to *note PyThreadState_Clear(): 1991.)
     and then destroy it.

     No *note thread state: 1846. will be *note attached: 4ed1. upon
     returning.

 -- C の関数: *note PyFrameObject: 98c. *PyThreadState_GetFrame
          (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Get the current frame of the Python thread state 'tstate'.

     Return a *note strong reference: 5e2.  Return ‘NULL’ if no frame is
     currently executing.

     See also *note PyEval_GetFrame(): 1b39.

     'tstate' must not be ‘NULL’, and must be *note attached: 4ed1.

     Added in version 3.9.

 -- C の関数: uint64_t PyThreadState_GetID (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Get the unique *note thread state: 1846. identifier of the Python
     thread state 'tstate'.

     'tstate' must not be ‘NULL’, and must be *note attached: 4ed1.

     Added in version 3.9.

 -- C の関数: *note PyInterpreterState: aba.
          *PyThreadState_GetInterpreter (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Get the interpreter of the Python thread state 'tstate'.

     'tstate' must not be ‘NULL’, and must be *note attached: 4ed1.

     Added in version 3.9.

 -- C の関数: void PyThreadState_EnterTracing (PyThreadState *tstate)

     Suspend tracing and profiling in the Python thread state 'tstate'.

     Resume them using the *note PyThreadState_LeaveTracing(): 95b.
     function.

     Added in version 3.11.

 -- C の関数: void PyThreadState_LeaveTracing (PyThreadState *tstate)

     Resume tracing and profiling in the Python thread state 'tstate'
     suspended by the *note PyThreadState_EnterTracing(): 95a. function.

     See also *note PyEval_SetTrace(): 663. and *note
     PyEval_SetProfile(): 1716. functions.

     Added in version 3.11.

 -- C の関数: int PyUnstable_ThreadState_SetStackProtection
          (PyThreadState *tstate, void *stack_start_addr, size_t
          stack_size)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Set the stack protection start address and stack protection size of
     a Python thread state.

     On success, return ‘0’.  On failure, set an exception and return
     ‘-1’.

     CPython implements *note recursion control: 51ff. for C code by
     raising *note RecursionError: f68. when it notices that the machine
     execution stack is close to overflow.  See for example the *note
     Py_EnterRecursiveCall(): 3d2. function.  For this, it needs to know
     the location of the current thread's stack, which it normally gets
     from the operating system.  When the stack is changed, for example
     using context switching techniques like the Boost library's
     ‘boost::context’, you must call *note
     PyUnstable_ThreadState_SetStackProtection(): 466. to inform CPython
     of the change.

     Call *note PyUnstable_ThreadState_SetStackProtection(): 466. either
     before or after changing the stack.  Do not call any other Python C
     API between the call and the stack change.

     See *note PyUnstable_ThreadState_ResetStackProtection(): 467. for
     undoing this operation.

     Added in version 3.14.1:

          警告: This function was added in a bugfix release, and
          extensions that use it will be incompatible with Python
          3.14.0.  Most packaging tools for Python are not able to
          handle this incompatibility automatically, and will need
          explicit configuration.  When using PyPA standards (wheels and
          source distributions), specify ‘Requires-Python: != 3.14.0.*’
          in core metadata(1).

 -- C の関数: void PyUnstable_ThreadState_ResetStackProtection
          (PyThreadState *tstate)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Reset the stack protection start address and stack protection size
     of a Python thread state to the operating system defaults.

     See *note PyUnstable_ThreadState_SetStackProtection(): 466. for an
     explanation.

     Added in version 3.14.1:

          警告: This function was added in a bugfix release, and
          extensions that use it will be incompatible with Python
          3.14.0.  Most packaging tools for Python are not able to
          handle this incompatibility automatically, and will need
          explicit configuration.  When using PyPA standards (wheels and
          source distributions), specify ‘Requires-Python: != 3.14.0.*’
          in core metadata(2).

 -- C の関数: *note PyInterpreterState: aba. *PyInterpreterState_Get
          (void)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.9 より).'  Get
     the current interpreter.

     Issue a fatal error if there is no *note attached thread state:
     4ed1.  It cannot return NULL.

     Added in version 3.9.

 -- C の関数: int64_t PyInterpreterState_GetID (PyInterpreterState
          *interp)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'  イ
     ンタプリタの一意な ID を返します。 処理中に何かエラーが起きたら、
     ‘-1’ が返され、エラーがセットされます。

     The caller must have an *note attached thread state: 4ed1.

     Added in version 3.7.

 -- C の関数: *note PyObject: 5df. *PyInterpreterState_GetDict
          (PyInterpreterState *interp)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.8 より).'  インタプリタ固有のデータを保持している辞書を返し
     ます。 この関数が ‘NULL’ を返した場合は、ここまでで例外は送出されて
     おらず、呼び出し側はインタプリタ固有の辞書は利用できないと考えなけ
     ればなりません。

     この関数は *note PyModule_GetState(): b77. を置き換えるものではなく
     、拡張モジュールがインタプリタ固有の状態情報を格納するのに使うべき
     ものです。

     The returned dictionary is borrowed from the interpreter and is
     valid until interpreter shutdown.

     Added in version 3.8.

 -- C のデータ型: typedef *note PyObject: 5df.
          *(*_PyFrameEvalFunction)(*note PyThreadState: 990. *tstate,
          *note _PyInterpreterFrame: 196e. *frame, int throwflag)

     Type of a frame evaluation function.

     The 'throwflag' parameter is used by the ‘throw()’ method of
     generators: if non-zero, handle the current exception.

     バージョン 3.9 で変更: The function now takes a 'tstate' parameter.

     バージョン 3.11 で変更: The 'frame' parameter changed from
     ‘PyFrameObject*’ to ‘_PyInterpreterFrame*’.

 -- C の関数: *note _PyFrameEvalFunction: 97a.
          _PyInterpreterState_GetEvalFrameFunc (PyInterpreterState
          *interp)

     Get the frame evaluation function.

     See the PEP 523(3) "Adding a frame evaluation API to CPython".

     Added in version 3.9.

 -- C の関数: void _PyInterpreterState_SetEvalFrameFunc
          (PyInterpreterState *interp, _PyFrameEvalFunction eval_frame)

     Set the frame evaluation function.

     See the PEP 523(4) "Adding a frame evaluation API to CPython".

     Added in version 3.9.

 -- C の関数: *note PyObject: 5df. *PyThreadState_GetDict ()
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  Return
     a dictionary in which extensions can store thread-specific state
     information.  Each extension should use a unique key to use to
     store state in the dictionary.  It is okay to call this function
     when no *note thread state: 1846. is *note attached: 4ed1.  If this
     function returns ‘NULL’, no exception has been raised and the
     caller should assume no thread state is attached.

 -- C の関数: int PyThreadState_SetAsyncExc (unsigned long id, PyObject
          *exc)
     ' 次に属します: *note Stable ABI: 775.'  Asynchronously raise an
     exception in a thread.  The 'id' argument is the thread id of the
     target thread; 'exc' is the exception object to be raised.  This
     function does not steal any references to 'exc'.  To prevent naive
     misuse, you must write your own C extension to call this.  Must be
     called with an *note attached thread state: 4ed1.  Returns the
     number of thread states modified; this is normally one, but will be
     zero if the thread id isn't found.  If 'exc' is ‘NULL’, the pending
     exception (if any) for the thread is cleared.  This raises no
     exceptions.

     バージョン 3.7 で変更: 'id' 引数の型が long から unsigned long へ変
     更されました。

 -- C の関数: void PyEval_AcquireThread (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775.'  *note Attach: 4ed1.
     'tstate' to the current thread, which must not be ‘NULL’ or already
     *note attached: 4ed1.

     The calling thread must not already have an *note attached thread
     state: 4ed1.

          注釈: Calling this function from a thread when the runtime is
          finalizing will hang the thread until the program exits, even
          if the thread was not created by Python.  Refer to *note
          Cautions regarding runtime finalization: 5525. for more
          details.

     バージョン 3.8 で変更: Updated to be consistent with *note
     PyEval_RestoreThread(): 648, *note Py_END_ALLOW_THREADS(): c7f, and
     *note PyGILState_Ensure(): 64a, and terminate the current thread if
     called while the interpreter is finalizing.

     バージョン 3.14 で変更: Hangs the current thread, rather than
     terminating it, if called while the interpreter is finalizing.

     *note PyEval_RestoreThread(): 648. はいつでも (スレッドが初期化され
     たいないときでも) 利用可能な高レベル関数です。

 -- C の関数: void PyEval_ReleaseThread (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775.'  Detach the *note attached
     thread state: 4ed1.  The 'tstate' argument, which must not be
     ‘NULL’, is only used to check that it represents the *note attached
     thread state: 4ed1. -- if it isn't, a fatal error is reported.

     *note PyEval_SaveThread(): 647. はより高レベルな関数で常に (スレッ
     ドが初期化されていないときでも) 利用できます。

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/en/latest/specifications/core-metadata/#requires-python

   (2) 
https://packaging.python.org/en/latest/specifications/core-metadata/#requires-python

   (3) https://peps.python.org/pep-0523/

   (4) https://peps.python.org/pep-0523/


File: python.info,  Node: サブインタプリタサポート,  Next: 非同期通知,  Prev: スレッド状態 thread state とグローバルインタプリタロック global interpreter lock,  Up: 初期化 initialization 、終了処理 finalization 、スレッド

7.10.6 サブインタプリタサポート
-------------------------------

ほとんどの場合は埋め込む Python インタプリタは1つだけですが、いくつかの
場合に同一プロセス内、あるいは同一スレッド内で、複数の独立したインタプリ
タを作成する必要があります。 これを可能にするのがサブインタプリタです。

"メイン" インタプリタとは、ランタイムが初期化を行ったときに最初に作成さ
れたインタプリタのことです。 サブインタプリタと違い、メインインタプリタ
にはシグナルハンドリングのような、プロセス全域で唯一な責務があります。 メ
インインタプリタにはランタイムの初期化中の処理実行という責務もあり、通常
はランタイムの終了処理中に動いているランタイムでもあります。 *note
PyInterpreterState_Main(): 552f. 関数は、メインインタプリタの状態へのポ
インタを返します。

サブインタプリタを切り替えが *note PyThreadState_Swap(): 50c4. 関数でで
きます。 次の関数を使ってサブインタプリタの作成と削除が行えます:

 -- C のデータ型: type PyInterpreterConfig

     Structure containing most parameters to configure a
     sub-interpreter.  Its values are used only in *note
     Py_NewInterpreterFromConfig(): 689. and never modified by the
     runtime.

     Added in version 3.12.

     構造体フィールド:

      -- C のメンバ変数: int use_main_obmalloc

          If this is ‘0’ then the sub-interpreter will use its own
          "object" allocator state.  Otherwise it will use (share) the
          main interpreter's.

          If this is ‘0’ then *note check_multi_interp_extensions: 5530.
          must be ‘1’ (non-zero).  If this is ‘1’ then *note gil: 5531.
          must not be *note PyInterpreterConfig_OWN_GIL: 5532.

      -- C のメンバ変数: int allow_fork

          If this is ‘0’ then the runtime will not support forking the
          process in any thread where the sub-interpreter is currently
          active.  Otherwise fork is unrestricted.

          Note that the *note subprocess: dc. module still works when
          fork is disallowed.

      -- C のメンバ変数: int allow_exec

          If this is ‘0’ then the runtime will not support replacing the
          current process via exec (e.g.  *note os.execv(): 3019.) in
          any thread where the sub-interpreter is currently active.
          Otherwise exec is unrestricted.

          Note that the *note subprocess: dc. module still works when
          exec is disallowed.

      -- C のメンバ変数: int allow_threads

          If this is ‘0’ then the sub-interpreter's *note threading: f3.
          module won't create threads.  Otherwise threads are allowed.

      -- C のメンバ変数: int allow_daemon_threads

          If this is ‘0’ then the sub-interpreter's *note threading: f3.
          module won't create daemon threads.  Otherwise daemon threads
          are allowed (as long as *note allow_threads: 5535. is
          non-zero).

      -- C のメンバ変数: int check_multi_interp_extensions

          If this is ‘0’ then all extension modules may be imported,
          including legacy (single-phase init) modules, in any thread
          where the sub-interpreter is currently active.  Otherwise only
          multi-phase init extension modules (see PEP 489(1)) may be
          imported.  (Also see *note Py_mod_multiple_interpreters:
          5152.)

          This must be ‘1’ (non-zero) if *note use_main_obmalloc: 4917.
          is ‘0’.

      -- C のメンバ変数: int gil

          This determines the operation of the GIL for the
          sub-interpreter.  It may be one of the following:

           -- C のマクロ: PyInterpreterConfig_DEFAULT_GIL

               Use the default selection (*note
               PyInterpreterConfig_SHARED_GIL: 5538.).

           -- C のマクロ: PyInterpreterConfig_SHARED_GIL

               Use (share) the main interpreter's GIL.

           -- C のマクロ: PyInterpreterConfig_OWN_GIL

               Use the sub-interpreter's own GIL.

          If this is *note PyInterpreterConfig_OWN_GIL: 5532. then *note
          PyInterpreterConfig.use_main_obmalloc: 4917. must be ‘0’.

 -- C の関数: *note PyStatus: ba4. Py_NewInterpreterFromConfig
          (PyThreadState **tstate_p, const PyInterpreterConfig *config)

     新しいサブインタプリタ (sub-interpreter) を生成します。サブインタプ
     リタとは、(ほぼ完全に) 個別に分割された Python コードの実行環境です
     。特に、新しいサブインタプリタは、 import されるモジュール全てにつ
     いて個別のバージョンを持ち、これには基盤となるモジュール *note
     builtins: 13, *note __main__: 1. および *note sys: df. も含まれます
     。ロード済みのモジュールからなるテーブル (‘sys.modules’) およびモジ
     ュール検索パス (‘sys.path’) もサブインタプリタ毎に別個のものになり
     ます。新たなサブインタプリタ環境には ‘sys.argv’ 変数がありません。
     また、サブインタプリタは新たな標準 I/O ストリーム ‘sys.stdin’,
     ‘sys.stdout’, ‘sys.stderr’ を持ちます (とはいえ、これらのストリーム
     は根底にある同じファイル記述子を参照しています)。

     The given 'config' controls the options with which the interpreter
     is initialized.

     Upon success, 'tstate_p' will be set to the first *note thread
     state: 1846. created in the new sub-interpreter.  This thread state
     is *note attached: 4ed1.  Note that no actual thread is created;
     see the discussion of thread states below.  If creation of the new
     interpreter is unsuccessful, 'tstate_p' is set to ‘NULL’; no
     exception is set since the exception state is stored in the *note
     attached thread state: 4ed1, which might not exist.

     Like all other Python/C API functions, an *note attached thread
     state: 4ed1. must be present before calling this function, but it
     might be detached upon returning.  On success, the returned thread
     state will be *note attached: 4ed1.  If the sub-interpreter is
     created with its own *note GIL: 164. then the *note attached thread
     state: 4ed1. of the calling interpreter will be detached.  When the
     function returns, the new interpreter's *note thread state: 1846.
     will be *note attached: 4ed1. to the current thread and the
     previous interpreter's *note attached thread state: 4ed1. will
     remain detached.

     Added in version 3.12.

     Sub-interpreters are most effective when isolated from each other,
     with certain functionality restricted:

          PyInterpreterConfig config = {
              .use_main_obmalloc = 0,
              .allow_fork = 0,
              .allow_exec = 0,
              .allow_threads = 1,
              .allow_daemon_threads = 0,
              .check_multi_interp_extensions = 1,
              .gil = PyInterpreterConfig_OWN_GIL,
          };
          PyThreadState *tstate = NULL;
          PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);
          if (PyStatus_Exception(status)) {
              Py_ExitStatusException(status);
          }

     Note that the config is used only briefly and does not get
     modified.  During initialization the config's values are converted
     into various *note PyInterpreterState: aba. values.  A read-only
     copy of the config may be stored internally on the *note
     PyInterpreterState: aba.

     Extension modules are shared between (sub-)interpreters as follows:

        * For modules using multi-phase initialization, e.g.  *note
          PyModule_FromDefAndSpec(): 10b3, a separate module object is
          created and initialized for each interpreter.  Only C-level
          static and global variables are shared between these module
          objects.

        * For modules using single-phase initialization, e.g.  *note
          PyModule_Create(): 5217, the first time a particular extension
          is imported, it is initialized normally, and a (shallow) copy
          of its module's dictionary is squirreled away.  When the same
          extension is imported by another (sub-)interpreter, a new
          module is initialized and filled with the contents of this
          copy; the extension's ‘init’ function is not called.  Objects
          in the module's dictionary thus end up shared across
          (sub-)interpreters, which might cause unwanted behavior (see
          *note Bugs and caveats: 5539. below).

          Note that this is different from what happens when an
          extension is imported after the interpreter has been
          completely re-initialized by calling *note Py_FinalizeEx():
          f11. and *note Py_Initialize(): 460.; in that case, the
          extension's ‘initmodule’ function 'is' called again.  As with
          multi-phase initialization, this means that only C-level
          static and global variables are shared between these modules.

 -- C の関数: *note PyThreadState: 990. *Py_NewInterpreter (void)
     ' 次に属します: *note Stable ABI: 775.'

     Create a new sub-interpreter.  This is essentially just a wrapper
     around *note Py_NewInterpreterFromConfig(): 689. with a config that
     preserves the existing behavior.  The result is an unisolated
     sub-interpreter that shares the main interpreter's GIL, allows
     fork/exec, allows daemon threads, and allows single-phase init
     modules.

 -- C の関数: void Py_EndInterpreter (PyThreadState *tstate)
     ' 次に属します: *note Stable ABI: 775.'

     Destroy the (sub-)interpreter represented by the given *note thread
     state: 1846.  The given thread state must be *note attached: 4ed1.
     When the call returns, there will be no *note attached thread
     state: 4ed1.  All thread states associated with this interpreter
     are destroyed.

     *note Py_FinalizeEx(): f11. will destroy all sub-interpreters that
     haven't been explicitly destroyed at that point.

* Menu:

* A Per-Interpreter GIL::
* バグと注意事項::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0489/


File: python.info,  Node: A Per-Interpreter GIL,  Next: バグと注意事項,  Up: サブインタプリタサポート

7.10.6.1 A Per-Interpreter GIL
..............................

Using *note Py_NewInterpreterFromConfig(): 689. you can create a
sub-interpreter that is completely isolated from other interpreters,
including having its own GIL. The most important benefit of this
isolation is that such an interpreter can execute Python code without
being blocked by other interpreters or blocking any others.  Thus a
single Python process can truly take advantage of multiple CPU cores
when running Python code.  The isolation also encourages a different
approach to concurrency than that of just using threads.  (See PEP
554(1) and PEP 684(2).)

Using an isolated interpreter requires vigilance in preserving that
isolation.  That especially means not sharing any objects or mutable
state without guarantees about thread-safety.  Even objects that are
otherwise immutable (e.g.  ‘None’, ‘(1, 5)’) can't normally be shared
because of the refcount.  One simple but less-efficient approach around
this is to use a global lock around all use of some state (or object).
Alternately, effectively immutable objects (like integers or strings)
can be made safe in spite of their refcounts by making them *note
immortal: 290.  In fact, this has been done for the builtin singletons,
small integers, and a number of other builtin objects.

If you preserve isolation then you will have access to proper multi-core
computing without the complications that come with free-threading.
Failure to preserve isolation will expose you to the full consequences
of free-threading, including races and hard-to-debug crashes.

Aside from that, one of the main challenges of using multiple isolated
interpreters is how to communicate between them safely (not break
isolation) and efficiently.  The runtime and stdlib do not provide any
standard approach to this yet.  A future stdlib module would help
mitigate the effort of preserving isolation and expose effective tools
for communicating (and sharing) data between interpreters.

Added in version 3.12.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0554/

   (2) https://peps.python.org/pep-0684/


File: python.info,  Node: バグと注意事項,  Prev: A Per-Interpreter GIL,  Up: サブインタプリタサポート

7.10.6.2 バグと注意事項
.......................

Because sub-interpreters (and the main interpreter) are part of the same
process, the insulation between them isn't perfect -- for example, using
low-level file operations like *note os.close(): d6b. they can
(accidentally or maliciously) affect each other's open files.  Because
of the way extensions are shared between (sub-)interpreters, some
extensions may not work properly; this is especially likely when using
single-phase initialization or (static) global variables.  It is
possible to insert objects created in one sub-interpreter into a
namespace of another (sub-)interpreter; this should be avoided if
possible.

Special care should be taken to avoid sharing user-defined functions,
methods, instances or classes between sub-interpreters, since import
operations executed by such objects may affect the wrong
(sub-)interpreter's dictionary of loaded modules.  It is equally
important to avoid sharing objects from which the above are reachable.

サブインタプリタを ‘PyGILState_*’ API と組み合わせるのが難しいことにも注
意してください。これらのAPIはPythonのスレッド状態とOSレベルスレッドが1対
1で対応していることを前提にしていて、サブインタプリタが存在するとその前
提が崩れるからです。対応する *note PyGILState_Ensure(): 64a. と *note
PyGILState_Release(): 64b. の呼び出しのペアの間では、サブインタプリタの
切り替えを行わないことを強く推奨します。さらに、(*note ctypes: 2e. のよ
うな)これらのAPIを使ってPythonの外で作られたスレッドから Pythonコードを
実行している拡張モジュールはサブインタプリタを使うと壊れる可能性がありま
す。


File: python.info,  Node: 非同期通知,  Next: プロファイルとトレース profiling and tracing,  Prev: サブインタプリタサポート,  Up: 初期化 initialization 、終了処理 finalization 、スレッド

7.10.7 非同期通知
-----------------

インタプリタのメインスレッドに非同期な通知を行うために提供されている仕組
みです。これらの通知は関数ポインタと void ポインタ引数という形態を取りま
す。

 -- C の関数: int Py_AddPendingCall (int (*func)(void*), void *arg)
     ' 次に属します: *note Stable ABI: 775.'  インタプリタのメインスレッ
     ドから関数が呼び出される予定を組みます。成功すると ‘0’ が返り、
     'func' はメインスレッドの呼び出しキューに詰められます。失敗すると、
     例外をセットせずに ‘-1’ が返ります。

     無事にキューに詰められると、'func' は 'いつかは必ず' インタプリタの
     メインスレッドから、'arg' を引数として呼び出されます。この関数は、
     通常の実行中の Python コードに対して非同期に呼び出されますが、次の
     両方の条件に合致したときに呼び出されます:

        * *note bytecode: 4aa. 境界上にいるとき、

        * with the main thread holding an *note attached thread state:
          4ed1. ('func' can therefore use the full C API).

     'func' must return ‘0’ on success, or ‘-1’ on failure with an
     exception set.  'func' won't be interrupted to perform another
     asynchronous notification recursively, but it can still be
     interrupted to switch threads if the *note thread state: 4ed1. is
     detached.

     This function doesn't need an *note attached thread state: 4ed1.
     However, to call this function in a subinterpreter, the caller must
     have an *note attached thread state: 4ed1.  Otherwise, the function
     'func' can be scheduled to be called from the wrong interpreter.

          警告: これは、非常に特別な場合にのみ役立つ、低レベルな関数です
          。 'func' が可能な限り早く呼び出される保証はありません。メイン
          スレッドがシステムコールを実行するのに忙しい場合は、 'func' は
          システムコールが返ってくるまで呼び出されないでしょう。この関数
          は一般的には、任意の C スレッドから Python コードを呼び出すの
          には '向きません' 。これの代わりに、 *note PyGILState API:
          5521. を使用してください。

     Added in version 3.1.

     バージョン 3.9 で変更: If this function is called in a
     subinterpreter, the function 'func' is now scheduled to be called
     from the subinterpreter, rather than being called from the main
     interpreter.  Each subinterpreter now has its own list of scheduled
     calls.

     バージョン 3.12 で変更: This function now always schedules 'func'
     to be run in the main interpreter.

 -- C の関数: int Py_MakePendingCalls (void)
     ' 次に属します: *note Stable ABI: 775.'  Execute all pending calls.
     This is usually executed automatically by the interpreter.

     This function returns ‘0’ on success, and returns ‘-1’ with an
     exception set on failure.

     If this is not called in the main thread of the main interpreter,
     this function does nothing and returns ‘0’.  The caller must hold
     an *note attached thread state: 4ed1.

     Added in version 3.1.

     バージョン 3.12 で変更: This function only runs pending calls in
     the main interpreter.


File: python.info,  Node: プロファイルとトレース profiling and tracing,  Next: Reference tracing,  Prev: 非同期通知,  Up: 初期化 initialization 、終了処理 finalization 、スレッド

7.10.8 プロファイルとトレース (profiling and tracing)
-----------------------------------------------------

Python インタプリタは、プロファイル: 分析 (profile) や実行のトレース: 追
跡 (trace) といった機能を組み込むために低水準のサポートを提供しています
。このサポートは、プロファイルやデバッグ、適用範囲分析 (coverage
analysis) ツールなどに使われます。

この C インターフェースは、プロファイルやトレース作業時に、Python レベル
の呼び出し可能オブジェクトが呼び出されることによるオーバヘッドを避け、直
接 C 関数呼び出しが行えるようにしています。プロファイルやトレース機能の
本質的な特性は変わっていません; インターフェースではトレース関数をスレッ
ドごとにインストールでき、トレース関数に報告される基本イベント (basic
event) は以前のバージョンにおいて Python レベルのトレース関数で報告され
ていたものと同じです。

 -- C のデータ型: typedef int (*Py_tracefunc)(*note PyObject: 5df. *obj,
          *note PyFrameObject: 98c. *frame, int what, *note PyObject:
          5df. *arg)

     The type of the trace function registered using *note
     PyEval_SetProfile(): 1716. and *note PyEval_SetTrace(): 663.  The
     first parameter is the object passed to the registration function
     as 'obj', 'frame' is the frame object to which the event pertains,
     'what' is one of the constants *note PyTrace_CALL: 553f, *note
     PyTrace_EXCEPTION: 5540, *note PyTrace_LINE: 5541, *note
     PyTrace_RETURN: 5542, *note PyTrace_C_CALL: 5543, *note
     PyTrace_C_EXCEPTION: 5544, *note PyTrace_C_RETURN: 5545, or *note
     PyTrace_OPCODE: 5546, and 'arg' depends on the value of 'what':

     'what' の値                         'arg' の意味
                                         
     ---------------------------------------------------------------------------------
                                         
     *note PyTrace_CALL: 553f.           常に *note Py_None: 4e9f. 。
                                         
                                         
     *note PyTrace_EXCEPTION: 5540.      *note sys.exc_info(): 89a. の返す例外情報
                                         です。
                                         
                                         
     *note PyTrace_LINE: 5541.           常に *note Py_None: 4e9f. 。
                                         
                                         
     *note PyTrace_RETURN: 5542.         呼び出し側に返される予定の値か、例外によっ
                                         て関数を抜ける場合は ‘NULL’ です。
                                         
                                         
     *note PyTrace_C_CALL: 5543.         呼び出される関数オブジェクト。
                                         
                                         
     *note PyTrace_C_EXCEPTION: 5544.    呼び出される関数オブジェクト。
                                         
                                         
     *note PyTrace_C_RETURN: 5545.       呼び出される関数オブジェクト。
                                         
                                         
     *note PyTrace_OPCODE: 5546.         常に *note Py_None: 4e9f. 。
                                         

 -- C 変数: int PyTrace_CALL

     関数やメソッドが新たに呼び出されたり、ジェネレータが新たなエントリ
     の処理に入ったことを報告する際の、 *note Py_tracefunc: 553e. の
     'what' の値です。イテレータやジェネレータ関数の生成は、対応するフレ
     ーム内の Python バイトコードに制御の委譲 (control transfer) が起こ
     らないため報告されないので注意してください。

 -- C 変数: int PyTrace_EXCEPTION

     The value of the 'what' parameter to a *note Py_tracefunc: 553e.
     function when an exception has been raised.  The callback function
     is called with this value for 'what' when after any bytecode is
     processed after which the exception becomes set within the frame
     being executed.  The effect of this is that as exception
     propagation causes the Python stack to unwind, the callback is
     called upon return to each frame as the exception propagates.  Only
     trace functions receive these events; they are not needed by the
     profiler.

 -- C 変数: int PyTrace_LINE

     The value passed as the 'what' parameter to a *note Py_tracefunc:
     553e. function (but not a profiling function) when a line-number
     event is being reported.  It may be disabled for a frame by setting
     *note f_trace_lines: dd6. to '0' on that frame.

 -- C 変数: int PyTrace_RETURN

     呼び出しが返るときに *note Py_tracefunc: 553e. 関数に 'what' 引数と
     して渡す値です。

 -- C 変数: int PyTrace_C_CALL

     C関数を呼び出す直前に *note Py_tracefunc: 553e. 関数の 'what' 引数
     として渡す値です。

 -- C 変数: int PyTrace_C_EXCEPTION

     C関数が例外を送出したときに *note Py_tracefunc: 553e. 関数の 'what'
     引数として渡す値です。

 -- C 変数: int PyTrace_C_RETURN

     C関数から戻るときに *note Py_tracefunc: 553e. 関数の 'what' 引数と
     して渡す値です。

 -- C 変数: int PyTrace_OPCODE

     The value for the 'what' parameter to *note Py_tracefunc: 553e.
     functions (but not profiling functions) when a new opcode is about
     to be executed.  This event is not emitted by default: it must be
     explicitly requested by setting *note f_trace_opcodes: dd7. to '1'
     on the frame.

 -- C の関数: void PyEval_SetProfile (Py_tracefunc func, PyObject *obj)

     Set the profiler function to 'func'.  The 'obj' parameter is passed
     to the function as its first parameter, and may be any Python
     object, or ‘NULL’.  If the profile function needs to maintain
     state, using a different value for 'obj' for each thread provides a
     convenient and thread-safe place to store it.  The profile function
     is called for all monitored events except *note PyTrace_LINE: 5541.
     *note PyTrace_OPCODE: 5546. and *note PyTrace_EXCEPTION: 5540.

     *note sys.setprofile(): 1717. 関数も参照してください。

     The caller must have an *note attached thread state: 4ed1.

 -- C の関数: void PyEval_SetProfileAllThreads (Py_tracefunc func,
          PyObject *obj)

     Like *note PyEval_SetProfile(): 1716. but sets the profile function
     in all running threads belonging to the current interpreter instead
     of the setting it only on the current thread.

     The caller must have an *note attached thread state: 4ed1.

     As *note PyEval_SetProfile(): 1716, this function ignores any
     exceptions raised while setting the profile functions in all
     threads.

Added in version 3.12.

 -- C の関数: void PyEval_SetTrace (Py_tracefunc func, PyObject *obj)

     Set the tracing function to 'func'.  This is similar to *note
     PyEval_SetProfile(): 1716, except the tracing function does receive
     line-number events and per-opcode events, but does not receive any
     event related to C function objects being called.  Any trace
     function registered using *note PyEval_SetTrace(): 663. will not
     receive *note PyTrace_C_CALL: 5543, *note PyTrace_C_EXCEPTION:
     5544. or *note PyTrace_C_RETURN: 5545. as a value for the 'what'
     parameter.

     *note sys.settrace(): 2e1. 関数も参照してください。

     The caller must have an *note attached thread state: 4ed1.

 -- C の関数: void PyEval_SetTraceAllThreads (Py_tracefunc func,
          PyObject *obj)

     Like *note PyEval_SetTrace(): 663. but sets the tracing function in
     all running threads belonging to the current interpreter instead of
     the setting it only on the current thread.

     The caller must have an *note attached thread state: 4ed1.

     As *note PyEval_SetTrace(): 663, this function ignores any
     exceptions raised while setting the trace functions in all threads.

Added in version 3.12.


File: python.info,  Node: Reference tracing,  Next: 高度なデバッガサポート advanced debugger support,  Prev: プロファイルとトレース profiling and tracing,  Up: 初期化 initialization 、終了処理 finalization 、スレッド

7.10.9 Reference tracing
------------------------

Added in version 3.13.

 -- C のデータ型: typedef int (*PyRefTracer)(*note PyObject: 5df.*, int
          event, void *data)

     The type of the trace function registered using *note
     PyRefTracer_SetTracer(): 610.  The first parameter is a Python
     object that has been just created (when 'event' is set to *note
     PyRefTracer_CREATE: 5549.) or about to be destroyed (when 'event'
     is set to *note PyRefTracer_DESTROY: 554a.).  The 'data' argument
     is the opaque pointer that was provided when *note
     PyRefTracer_SetTracer(): 610. was called.

Added in version 3.13.

 -- C 変数: int PyRefTracer_CREATE

     The value for the 'event' parameter to *note PyRefTracer: 5548.
     functions when a Python object has been created.

 -- C 変数: int PyRefTracer_DESTROY

     The value for the 'event' parameter to *note PyRefTracer: 5548.
     functions when a Python object has been destroyed.

 -- C の関数: int PyRefTracer_SetTracer (PyRefTracer tracer, void *data)

     Register a reference tracer function.  The function will be called
     when a new Python has been created or when an object is going to be
     destroyed.  If 'data' is provided it must be an opaque pointer that
     will be provided when the tracer function is called.  Return ‘0’ on
     success.  Set an exception and return ‘-1’ on error.

     Note that tracer functions 'must not' create Python objects inside
     or otherwise the call will be re-entrant.  The tracer also 'must
     not' clear any existing exception or set an exception.  A *note
     thread state: 1846. will be active every time the tracer function
     is called.

     There must be an *note attached thread state: 4ed1. when calling
     this function.

Added in version 3.13.

 -- C の関数: *note PyRefTracer: 5548. PyRefTracer_GetTracer (void
          **data)

     Get the registered reference tracer function and the value of the
     opaque data pointer that was registered when *note
     PyRefTracer_SetTracer(): 610. was called.  If no tracer was
     registered this function will return NULL and will set the 'data'
     pointer to NULL.

     There must be an *note attached thread state: 4ed1. when calling
     this function.

Added in version 3.13.


File: python.info,  Node: 高度なデバッガサポート advanced debugger support,  Next: スレッドローカルストレージのサポート,  Prev: Reference tracing,  Up: 初期化 initialization 、終了処理 finalization 、スレッド

7.10.10 高度なデバッガサポート (advanced debugger support)
----------------------------------------------------------

以下の関数は高度なデバッグツールでの使用のためだけのものです。

 -- C の関数: *note PyInterpreterState: aba. *PyInterpreterState_Head ()

     インタプリタ状態オブジェクトからなるリストのうち、先頭にあるものを
     返します。

 -- C の関数: *note PyInterpreterState: aba. *PyInterpreterState_Main ()

     メインインタプリタの状態オブジェクトを返します。

 -- C の関数: *note PyInterpreterState: aba. *PyInterpreterState_Next
          (PyInterpreterState *interp)

     インタプリタ状態オブジェクトからなるリストのうち、'interp' の次にあ
     るものを返します。

 -- C の関数: *note PyThreadState: 990. *PyInterpreterState_ThreadHead
          (PyInterpreterState *interp)

     インタプリタ 'interp' に関連付けられているスレッドからなるリストの
     うち、先頭にある *note PyThreadState: 990. オブジェクトを返します。

 -- C の関数: *note PyThreadState: 990. *PyThreadState_Next
          (PyThreadState *tstate)

     'tstate' と同じ *note PyInterpreterState: aba. オブジェクトに属して
     いるスレッド状態オブジェクトのうち、 'tstate' の次にあるものを返し
     ます。


File: python.info,  Node: スレッドローカルストレージのサポート,  Next: 同期プリミティブ<3>,  Prev: 高度なデバッガサポート advanced debugger support,  Up: 初期化 initialization 、終了処理 finalization 、スレッド

7.10.11 スレッドローカルストレージのサポート
--------------------------------------------

Python インタプリタは、スレッドローカルストレージ (thread-local storage,
TLS) の低レベルサポートを提供していて、ネイティブの TLS 実装を内部にラッ
プして Python レベルのスレッドローカルストレージ API (*note
threading.local: 185f.) をサポートしています。 CPython の C レベル API は
pthreads や Windows で与えられる TLS と同様です: スレッドキーとスレッド
ごとに void* 値を関係付ける関数を使います。

A *note thread state: 1846. does 'not' need to be *note attached: 4ed1.
when calling these functions; they suppl their own locking.

‘Python.h’ は TLS API の宣言を include せず、スレッドローカルストレージ
を使うには ‘pythread.h’ を include する必要があることに注意してください
。

     注釈: この API 関数はどれも void* 値の代わりにメモリ管理を行うこと
     はしません。 メモリの確保と解放は自前で行う必要があります。 void* 値
     がたまたま *note PyObject: 5df.* だった場合は、 API 関数はそれぞれ
     の値の参照カウントの操作は行いません。

* Menu:

* スレッド固有ストレージ (Thread Specific Storage, TSS) API: スレッド固有ストレージ Thread Specific Storage TSS API.
* スレッドローカルストレージ (TLS) API: スレッドローカルストレージ TLS API.


File: python.info,  Node: スレッド固有ストレージ Thread Specific Storage TSS API,  Next: スレッドローカルストレージ TLS API,  Up: スレッドローカルストレージのサポート

7.10.11.1 スレッド固有ストレージ (Thread Specific Storage, TSS) API
...................................................................

TSS API は、 CPython インタプリタに含まれている既存の TLS API を置き換え
るために導入されました。 この API は、スレッドキーの表現に int の代わり
に新しい型 *note Py_tss_t: cd6. を使います。

Added in version 3.7.

参考
....

"CPython のスレッドローカルストレージのための新しい C API" ( PEP 539(1))

 -- C のデータ型: type Py_tss_t

     このデータ構造体はスレッドキーの状態を表現しています。この構造体の
     定義は、根底の TLS 実装に依存し、キーの初期化状態を表現する内部フィ
     ールドを持ちます。 この構造体には公開 (public) のメンバはありません
     。

     *note Py_LIMITED_API: 775. が定義されていないときは、この型の *note
     Py_tss_NEEDS_INIT: 5550. による静的メモリ確保ができます。

 -- C のマクロ: Py_tss_NEEDS_INIT

     このマクロは *note Py_tss_t: cd6. 変数の初期化子に展開されます。 こ
     のマクロは *note Py_LIMITED_API: 775. があるときは定義されません。

* Menu:

* 動的メモリ確保::
* メソッド: メソッド<2>.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0539/


File: python.info,  Node: 動的メモリ確保,  Next: メソッド<2>,  Up: スレッド固有ストレージ Thread Specific Storage TSS API

7.10.11.2 動的メモリ確保
........................

動的な *note Py_tss_t: cd6. のメモリ確保は *note Py_LIMITED_API: 775. で
ビルドされた拡張モジュールで必要になりますが、その実装がビルド時に不透明
なために、この型の静的なメモリ確保は不可能です。

 -- C の関数: *note Py_tss_t: cd6. *PyThread_tss_alloc ()
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     Return a value which is the same state as a value initialized with
     *note Py_tss_NEEDS_INIT: 5550, or ‘NULL’ in the case of dynamic
     allocation failure.

 -- C の関数: void PyThread_tss_free (Py_tss_t *key)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     Free the given 'key' allocated by *note PyThread_tss_alloc(): 438,
     after first calling *note PyThread_tss_delete(): 440. to ensure any
     associated thread locals have been unassigned.  This is a no-op if
     the 'key' argument is ‘NULL’.

          注釈: A freed key becomes a dangling pointer.  You should
          reset the key to ‘NULL’.


File: python.info,  Node: メソッド<2>,  Prev: 動的メモリ確保,  Up: スレッド固有ストレージ Thread Specific Storage TSS API

7.10.11.3 メソッド
..................

The parameter 'key' of these functions must not be ‘NULL’.  Moreover,
the behaviors of *note PyThread_tss_set(): 43c. and *note
PyThread_tss_get(): 43e. are undefined if the given *note Py_tss_t: cd6.
has not been initialized by *note PyThread_tss_create(): 50d0.

 -- C の関数: int PyThread_tss_is_created (Py_tss_t *key)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     Return a non-zero value if the given *note Py_tss_t: cd6. has been
     initialized by *note PyThread_tss_create(): 50d0.

 -- C の関数: int PyThread_tss_create (Py_tss_t *key)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     Return a zero value on successful initialization of a TSS key.  The
     behavior is undefined if the value pointed to by the 'key' argument
     is not initialized by *note Py_tss_NEEDS_INIT: 5550.  This function
     can be called repeatedly on the same key - calling it on an already
     initialized key is a no-op and immediately returns success.

 -- C の関数: void PyThread_tss_delete (Py_tss_t *key)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     Destroy a TSS key to forget the values associated with the key
     across all threads, and change the key's initialization state to
     uninitialized.  A destroyed key is able to be initialized again by
     *note PyThread_tss_create(): 50d0.  This function can be called
     repeatedly on the same key - calling it on an already destroyed key
     is a no-op.

 -- C の関数: int PyThread_tss_set (Py_tss_t *key, void *value)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     Return a zero value to indicate successfully associating a void*
     value with a TSS key in the current thread.  Each thread has a
     distinct mapping of the key to a void* value.

 -- C の関数: void *PyThread_tss_get (Py_tss_t *key)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     Return the void* value associated with a TSS key in the current
     thread.  This returns ‘NULL’ if no value is associated with the key
     in the current thread.


File: python.info,  Node: スレッドローカルストレージ TLS API,  Prev: スレッド固有ストレージ Thread Specific Storage TSS API,  Up: スレッドローカルストレージのサポート

7.10.11.4 スレッドローカルストレージ (TLS) API
..............................................

バージョン 3.7 で非推奨: This API is superseded by *note Thread Specific
Storage (TSS) API: cd5.

     注釈: This version of the API does not support platforms where the
     native TLS key is defined in a way that cannot be safely cast to
     ‘int’.  On such platforms, *note PyThread_create_key(): 437. will
     return immediately with a failure status, and the other TLS
     functions will all be no-ops on such platforms.

前述の互換性の問題により、このバージョンのAPIは新規のコードで利用すべき
ではありません。

 -- C の関数: int PyThread_create_key ()
     ' 次に属します: *note Stable ABI: 775.'

 -- C の関数: void PyThread_delete_key (int key)
     ' 次に属します: *note Stable ABI: 775.'

 -- C の関数: int PyThread_set_key_value (int key, void *value)
     ' 次に属します: *note Stable ABI: 775.'

 -- C の関数: void *PyThread_get_key_value (int key)
     ' 次に属します: *note Stable ABI: 775.'

 -- C の関数: void PyThread_delete_key_value (int key)
     ' 次に属します: *note Stable ABI: 775.'

 -- C の関数: void PyThread_ReInitTLS ()
     ' 次に属します: *note Stable ABI: 775.'


File: python.info,  Node: 同期プリミティブ<3>,  Next: Operating System Thread APIs,  Prev: スレッドローカルストレージのサポート,  Up: 初期化 initialization 、終了処理 finalization 、スレッド

7.10.12 同期プリミティブ
------------------------

The C-API provides a basic mutual exclusion lock.

 -- C のデータ型: type PyMutex

     A mutual exclusion lock.  The ‘PyMutex’ should be initialized to
     zero to represent the unlocked state.  For example:

          PyMutex mutex = {0};

     Instances of ‘PyMutex’ should not be copied or moved.  Both the
     contents and address of a ‘PyMutex’ are meaningful, and it must
     remain at a fixed, writable location in memory.

          注釈: A ‘PyMutex’ currently occupies one byte, but the size
          should be considered unstable.  The size may change in future
          Python releases without a deprecation period.

     Added in version 3.13.

 -- C の関数: void PyMutex_Lock (PyMutex *m)

     Lock mutex 'm'.  If another thread has already locked it, the
     calling thread will block until the mutex is unlocked.  While
     blocked, the thread will temporarily detach the *note thread state:
     4ed1. if one exists.

     Added in version 3.13.

 -- C の関数: void PyMutex_Unlock (PyMutex *m)

     Unlock mutex 'm'.  The mutex must be locked -- otherwise, the
     function will issue a fatal error.

     Added in version 3.13.

 -- C の関数: int PyMutex_IsLocked (PyMutex *m)

     Returns non-zero if the mutex 'm' is currently locked, zero
     otherwise.

          注釈: This function is intended for use in assertions and
          debugging only and should not be used to make concurrency
          control decisions, as the lock state may change immediately
          after the check.

     Added in version 3.14.

* Menu:

* Python Critical Section API::
* Legacy Locking APIs::


File: python.info,  Node: Python Critical Section API,  Next: Legacy Locking APIs,  Up: 同期プリミティブ<3>

7.10.12.1 Python Critical Section API
.....................................

The critical section API provides a deadlock avoidance layer on top of
per-object locks for *note free-threaded: 1f4. CPython.  They are
intended to replace reliance on the *note global interpreter lock: 474,
and are no-ops in versions of Python with the global interpreter lock.

Critical sections are intended to be used for custom types implemented
in C-API extensions.  They should generally not be used with built-in
types like *note list: 24d. and *note dict: 183. because their public
C-APIs already use critical sections internally, with the notable
exception of *note PyDict_Next(): 198f, which requires critical section
to be acquired externally.

Critical sections avoid deadlocks by implicitly suspending active
critical sections, hence, they do not provide exclusive access such as
provided by traditional locks like *note PyMutex: 484.  When a critical
section is started, the per-object lock for the object is acquired.  If
the code executed inside the critical section calls C-API functions then
it can suspend the critical section thereby releasing the per-object
lock, so other threads can acquire the per-object lock for the same
object.

Variants that accept *note PyMutex: 484. pointers rather than Python
objects are also available.  Use these variants to start a critical
section in a situation where there is no *note PyObject: 5df. - for
example, when working with a C type that does not extend or wrap *note
PyObject: 5df. but still needs to call into the C API in a manner that
might lead to deadlocks.

The functions and structs used by the macros are exposed for cases where
C macros are not available.  They should only be used as in the given
macro expansions.  Note that the sizes and contents of the structures
may change in future Python versions.

     注釈: Operations that need to lock two objects at once must use
     *note Py_BEGIN_CRITICAL_SECTION2: 5557.  You 'cannot' use nested
     critical sections to lock more than one object at once, because the
     inner critical section may suspend the outer critical sections.
     This API does not provide a way to lock more than two objects at
     once.

使用例:

     static PyObject *
     set_field(MyObject *self, PyObject *value)
     {
        Py_BEGIN_CRITICAL_SECTION(self);
        Py_SETREF(self->field, Py_XNewRef(value));
        Py_END_CRITICAL_SECTION();
        Py_RETURN_NONE;
     }

In the above example, *note Py_SETREF: 799. calls *note Py_DECREF: 790,
which can call arbitrary code through an object's deallocation function.
The critical section API avoids potential deadlocks due to reentrancy
and lock ordering by allowing the runtime to temporarily suspend the
critical section if the code triggered by the finalizer blocks and calls
*note PyEval_SaveThread(): 647.

 -- C のマクロ: Py_BEGIN_CRITICAL_SECTION (op)

     Acquires the per-object lock for the object 'op' and begins a
     critical section.

     In the free-threaded build, this macro expands to:

          {
              PyCriticalSection _py_cs;
              PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))

     In the default build, this macro expands to ‘{’.

     Added in version 3.13.

 -- C のマクロ: Py_BEGIN_CRITICAL_SECTION_MUTEX (m)

     Locks the mutex 'm' and begins a critical section.

     In the free-threaded build, this macro expands to:

          {
               PyCriticalSection _py_cs;
               PyCriticalSection_BeginMutex(&_py_cs, m)

     Note that unlike *note Py_BEGIN_CRITICAL_SECTION: 53ab, there is no
     cast for the argument of the macro - it must be a *note PyMutex:
     484. pointer.

     On the default build, this macro expands to ‘{’.

     Added in version 3.14.

 -- C のマクロ: Py_END_CRITICAL_SECTION ()

     Ends the critical section and releases the per-object lock.

     In the free-threaded build, this macro expands to:

              PyCriticalSection_End(&_py_cs);
          }

     In the default build, this macro expands to ‘}’.

     Added in version 3.13.

 -- C のマクロ: Py_BEGIN_CRITICAL_SECTION2 (a, b)

     Acquires the per-objects locks for the objects 'a' and 'b' and
     begins a critical section.  The locks are acquired in a consistent
     order (lowest address first) to avoid lock ordering deadlocks.

     In the free-threaded build, this macro expands to:

          {
              PyCriticalSection2 _py_cs2;
              PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))

     In the default build, this macro expands to ‘{’.

     Added in version 3.13.

 -- C のマクロ: Py_BEGIN_CRITICAL_SECTION2_MUTEX (m1, m2)

     Locks the mutexes 'm1' and 'm2' and begins a critical section.

     In the free-threaded build, this macro expands to:

          {
               PyCriticalSection2 _py_cs2;
               PyCriticalSection2_BeginMutex(&_py_cs2, m1, m2)

     Note that unlike *note Py_BEGIN_CRITICAL_SECTION2: 5557, there is
     no cast for the arguments of the macro - they must be *note
     PyMutex: 484. pointers.

     On the default build, this macro expands to ‘{’.

     Added in version 3.14.

 -- C のマクロ: Py_END_CRITICAL_SECTION2 ()

     Ends the critical section and releases the per-object locks.

     In the free-threaded build, this macro expands to:

              PyCriticalSection2_End(&_py_cs2);
          }

     In the default build, this macro expands to ‘}’.

     Added in version 3.13.


File: python.info,  Node: Legacy Locking APIs,  Prev: Python Critical Section API,  Up: 同期プリミティブ<3>

7.10.12.2 Legacy Locking APIs
.............................

These APIs are obsolete since Python 3.13 with the introduction of *note
PyMutex: 484.

バージョン 3.15 で変更: These APIs are now a simple wrapper around
‘PyMutex’.

 -- C のデータ型: type PyThread_type_lock

     A pointer to a mutual exclusion lock.

 -- C のデータ型: type PyLockStatus

     The result of acquiring a lock with a timeout.

      -- C Enumerator: enumerator PY_LOCK_FAILURE

          Failed to acquire the lock.

      -- C Enumerator: enumerator PY_LOCK_ACQUIRED

          The lock was successfully acquired.

      -- C Enumerator: enumerator PY_LOCK_INTR

          The lock was interrupted by a signal.

 -- C の関数: *note PyThread_type_lock: 555d. PyThread_allocate_lock
          (void)
     ' 次に属します: *note Stable ABI: 775.'  Allocate a new lock.

     On success, this function returns a lock; on failure, this function
     returns ‘0’ without an exception set.

     The caller does not need to hold an *note attached thread state:
     4ed1.

     バージョン 3.15 で変更: This function now always uses *note
     PyMutex: 484.  In prior versions, this would use a lock provided by
     the operating system.

 -- C の関数: void PyThread_free_lock (PyThread_type_lock lock)
     ' 次に属します: *note Stable ABI: 775.'  Destroy 'lock'.  The lock
     should not be held by any thread when calling this.

     The caller does not need to hold an *note attached thread state:
     4ed1.

 -- C の関数: *note PyLockStatus: 555e. PyThread_acquire_lock_timed
          (PyThread_type_lock lock, long long microseconds, int
          intr_flag)
     ' 次に属します: *note Stable ABI: 775.'  Acquire 'lock' with a
     timeout.

     This will wait for 'microseconds' microseconds to acquire the lock.
     If the timeout expires, this function returns *note
     PY_LOCK_FAILURE: 555f.  If 'microseconds' is ‘-1’, this will wait
     indefinitely until the lock has been released.

     If 'intr_flag' is ‘1’, acquiring the lock may be interrupted by a
     signal, in which case this function returns *note PY_LOCK_INTR:
     5561.  Upon interruption, it's generally expected that the caller
     makes a call to *note Py_MakePendingCalls(): 5134. to propagate an
     exception to Python code.

     If the lock is successfully acquired, this function returns *note
     PY_LOCK_ACQUIRED: 5560.

     The caller does not need to hold an *note attached thread state:
     4ed1.

 -- C の関数: int PyThread_acquire_lock (PyThread_type_lock lock, int
          waitflag)
     ' 次に属します: *note Stable ABI: 775.'  Acquire 'lock'.

     If 'waitflag' is ‘1’ and another thread currently holds the lock,
     this function will wait until the lock can be acquired and will
     always return ‘1’.

     If 'waitflag' is ‘0’ and another thread holds the lock, this
     function will not wait and instead return ‘0’.  If the lock is not
     held by any other thread, then this function will acquire it and
     return ‘1’.

     Unlike *note PyThread_acquire_lock_timed(): 50c7, acquiring the
     lock cannot be interrupted by a signal.

     The caller does not need to hold an *note attached thread state:
     4ed1.

 -- C の関数: int PyThread_release_lock (PyThread_type_lock lock)
     ' 次に属します: *note Stable ABI: 775.'  Release 'lock'.  If 'lock'
     is not held, then this function issues a fatal error.

     The caller does not need to hold an *note attached thread state:
     4ed1.


File: python.info,  Node: Operating System Thread APIs,  Prev: 同期プリミティブ<3>,  Up: 初期化 initialization 、終了処理 finalization 、スレッド

7.10.13 Operating System Thread APIs
------------------------------------

 -- C のマクロ: PYTHREAD_INVALID_THREAD_ID

     Sentinel value for an invalid thread ID.

     This is currently equivalent to ‘(unsigned long)-1’.

 -- C の関数: unsigned long PyThread_start_new_thread (void
          (*func)(void*), void *arg)
     ' 次に属します: *note Stable ABI: 775.'  Start function 'func' in a
     new thread with argument 'arg'.  The resulting thread is not
     intended to be joined.

     'func' must not be ‘NULL’, but 'arg' may be ‘NULL’.

     On success, this function returns the identifier of the new thread;
     on failure, this returns *note PYTHREAD_INVALID_THREAD_ID: 5563.

     The caller does not need to hold an *note attached thread state:
     4ed1.

 -- C の関数: unsigned long PyThread_get_thread_ident (void)
     ' 次に属します: *note Stable ABI: 775.'  Return the identifier of
     the current thread, which will never be zero.

     This function cannot fail, and the caller does not need to hold an
     *note attached thread state: 4ed1.

     参考
     ....

     *note threading.get_ident(): 1372.

 -- C の関数: *note PyObject: 5df. *PyThread_GetInfo (void)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.3 より).'  Get
     general information about the current thread in the form of a *note
     struct sequence: 13d7. object.  This information is accessible as
     *note sys.thread_info: 1368. in Python.

     On success, this returns a new *note strong reference: 5e2. to the
     thread information; on failure, this returns ‘NULL’ with an
     exception set.

     The caller must hold an *note attached thread state: 4ed1.

 -- C のマクロ: PY_HAVE_THREAD_NATIVE_ID

     This macro is defined when the system supports native thread IDs.

 -- C の関数: unsigned long PyThread_get_thread_native_id (void)
     ' 次に属します: *note Stable ABI: 775. on platforms with native
     thread IDs.'  Get the native identifier of the current thread as it
     was assigned by the operating system's kernel, which will never be
     less than zero.

     This function is only available when *note
     PY_HAVE_THREAD_NATIVE_ID: 5564. is defined.

     This function cannot fail, and the caller does not need to hold an
     *note attached thread state: 4ed1.

     参考
     ....

     *note threading.get_native_id(): c32.

 -- C の関数: void PyThread_exit_thread (void)
     ' 次に属します: *note Stable ABI: 775.'  Terminate the current
     thread.  This function is generally considered unsafe and should be
     avoided.  It is kept solely for backwards compatibility.

     This function is only safe to call if all functions in the full
     call stack are written to safely allow it.

          警告: If the current system uses POSIX threads (also known as
          "pthreads"), this calls ‘pthread_exit(3)(1)’, which attempts
          to unwind the stack and call C++ destructors on some libc
          implementations.  However, if a ‘noexcept’ function is
          reached, it may terminate the process.  Other systems, such as
          macOS, do unwinding.

          On Windows, this function calls ‘_endthreadex()’, which kills
          the thread without calling C++ destructors.

          In any case, there is a risk of corruption on the thread's
          stack.

     バージョン 3.14 で非推奨.

 -- C の関数: void PyThread_init_thread (void)
     ' 次に属します: *note Stable ABI: 775.'  Initialize ‘PyThread*’
     APIs.  Python executes this function automatically, so there's
     little need to call it from an extension module.

 -- C の関数: int PyThread_set_stacksize (size_t size)
     ' 次に属します: *note Stable ABI: 775.'  Set the stack size of the
     current thread to 'size' bytes.

     This function returns ‘0’ on success, ‘-1’ if 'size' is invalid, or
     ‘-2’ if the system does not support changing the stack size.  This
     function does not set exceptions.

     The caller does not need to hold an *note attached thread state:
     4ed1.

 -- C の関数: size_t PyThread_get_stacksize (void)
     ' 次に属します: *note Stable ABI: 775.'  Return the stack size of
     the current thread in bytes, or ‘0’ if the system's default stack
     size is in use.

     The caller does not need to hold an *note attached thread state:
     4ed1.

   ---------- Footnotes ----------

   (1) https://manpages.debian.org/pthread_exit(3)


File: python.info,  Node: Python 初期化設定,  Next: メモリ管理,  Prev: 初期化 initialization 、終了処理 finalization 、スレッド,  Up: Python/C API リファレンスマニュアル

7.11 Python 初期化設定
======================

* Menu:

* PyInitConfig C API::
* Configuration Options::
* Runtime Python configuration API::
* PyConfig C API::
* Py_GetArgcArgv(): Py_GetArgcArgv.
* Delaying main module execution::


File: python.info,  Node: PyInitConfig C API,  Next: Configuration Options,  Up: Python 初期化設定

7.11.1 PyInitConfig C API
-------------------------

Added in version 3.14.

Python は *note Py_InitializeFromInitConfig(): 386. で初期化できます。

*note Py_RunMain(): bbc. 関数は、カスタマイズされた Python プログラムを
書くために使用できます。

*note Initialization, Finalization, and Threads: 550e. も参照してくださ
い。

参考
....

PEP 741(1) "Python Configuration C API".

* Menu:

* 使用例: 使用例<54>.
* 設定の作成::
* エラー処理: エラー処理<2>.
* Get Options::
* Set Options::
* Module::
* Initialize Python::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0741/


File: python.info,  Node: 使用例<54>,  Next: 設定の作成,  Up: PyInitConfig C API

7.11.1.1 使用例
...............

常に *note Python 開発モード: 508. が有効化された状態で実行されるカスタ
マイズされた Python の例。エラー時は ‘-1’ を返します:

     int init_python(void)
     {
         PyInitConfig *config = PyInitConfig_Create();
         if (config == NULL) {
             printf("PYTHON INIT ERROR: memory allocation failed\n");
             return -1;
         }

         // Python 開発モードを有効化
         if (PyInitConfig_SetInt(config, "dev_mode", 1) < 0) {
             goto error;
         }

         // Python を設定付きで初期化
         if (Py_InitializeFromInitConfig(config) < 0) {
             goto error;
         }
         PyInitConfig_Free(config);
         return 0;

     error:
         {
             // エラーメッセージを表示する。
             //
             // この稀な括弧スタイルは、変数宣言を指す goto ターゲットを
             // 作ることができないために使用されています。

             const char *err_msg;
             (void)PyInitConfig_GetError(config, &err_msg);
             printf("PYTHON INIT ERROR: %s\n", err_msg);
             PyInitConfig_Free(config);
             return -1;
         }
     }


File: python.info,  Node: 設定の作成,  Next: エラー処理<2>,  Prev: 使用例<54>,  Up: PyInitConfig C API

7.11.1.2 設定の作成
...................

 -- C Struct: struct PyInitConfig

     Python の初期化を構成するための不透明な構造体です。

 -- C の関数: *note PyInitConfig: 556b. *PyInitConfig_Create (void)

     Create a new initialization configuration using *note Isolated
     Configuration: 556c. default values.

     It must be freed by *note PyInitConfig_Free(): 388.

     Return ‘NULL’ on memory allocation failure.

 -- C の関数: void PyInitConfig_Free (PyInitConfig *config)

     Free memory of the initialization configuration 'config'.

     If 'config' is ‘NULL’, no operation is performed.


File: python.info,  Node: エラー処理<2>,  Next: Get Options,  Prev: 設定の作成,  Up: PyInitConfig C API

7.11.1.3 エラー処理
...................

 -- C の関数: int PyInitConfig_GetError (PyInitConfig *config, const
          char **err_msg)

     Get the 'config' error message.

        * Set '*err_msg' and return ‘1’ if an error is set.

        * Set '*err_msg' to ‘NULL’ and return ‘0’ otherwise.

     An error message is a UTF-8 encoded string.

     If 'config' has an exit code, format the exit code as an error
     message.

     The error message remains valid until another ‘PyInitConfig’
     function is called with 'config'.  The caller doesn't have to free
     the error message.

 -- C の関数: int PyInitConfig_GetExitCode (PyInitConfig *config, int
          *exitcode)

     Get the 'config' exit code.

        * Set '*exitcode' and return ‘1’ if 'config' has an exit code
          set.

        * Return ‘0’ if 'config' has no exit code set.

     Only the ‘Py_InitializeFromInitConfig()’ function can set an exit
     code if the ‘parse_argv’ option is non-zero.

     An exit code can be set when parsing the command line failed (exit
     code ‘2’) or when a command line option asks to display the command
     line help (exit code ‘0’).


File: python.info,  Node: Get Options,  Next: Set Options,  Prev: エラー処理<2>,  Up: PyInitConfig C API

7.11.1.4 Get Options
....................

The configuration option 'name' parameter must be a non-NULL
null-terminated UTF-8 encoded string.  See *note Configuration Options:
556f.

 -- C の関数: int PyInitConfig_HasOption (PyInitConfig *config, const
          char *name)

     Test if the configuration has an option called 'name'.

     Return ‘1’ if the option exists, or return ‘0’ otherwise.

 -- C の関数: int PyInitConfig_GetInt (PyInitConfig *config, const char
          *name, int64_t *value)

     Get an integer configuration option.

        * Set '*value', and return ‘0’ on success.

        * Set an error in 'config' and return ‘-1’ on error.

 -- C の関数: int PyInitConfig_GetStr (PyInitConfig *config, const char
          *name, char **value)

     Get a string configuration option as a null-terminated UTF-8
     encoded string.

        * Set '*value', and return ‘0’ on success.

        * Set an error in 'config' and return ‘-1’ on error.

     '*value' can be set to ‘NULL’ if the option is an optional string
     and the option is unset.

     On success, the string must be released with ‘free(value)’ if it's
     not ‘NULL’.

 -- C の関数: int PyInitConfig_GetStrList (PyInitConfig *config, const
          char *name, size_t *length, char ***items)

     Get a string list configuration option as an array of
     null-terminated UTF-8 encoded strings.

        * Set '*length' and '*value', and return ‘0’ on success.

        * Set an error in 'config' and return ‘-1’ on error.

     On success, the string list must be released with
     ‘PyInitConfig_FreeStrList(length, items)’.

 -- C の関数: void PyInitConfig_FreeStrList (size_t length, char
          **items)

     Free memory of a string list created by
     ‘PyInitConfig_GetStrList()’.


File: python.info,  Node: Set Options,  Next: Module,  Prev: Get Options,  Up: PyInitConfig C API

7.11.1.5 Set Options
....................

The configuration option 'name' parameter must be a non-NULL
null-terminated UTF-8 encoded string.  See *note Configuration Options:
556f.

Some configuration options have side effects on other options.  This
logic is only implemented when ‘Py_InitializeFromInitConfig()’ is
called, not by the "Set" functions below.  For example, setting
‘dev_mode’ to ‘1’ does not set ‘faulthandler’ to ‘1’.

 -- C の関数: int PyInitConfig_SetInt (PyInitConfig *config, const char
          *name, int64_t value)

     Set an integer configuration option.

        * Return ‘0’ on success.

        * Set an error in 'config' and return ‘-1’ on error.

 -- C の関数: int PyInitConfig_SetStr (PyInitConfig *config, const char
          *name, const char *value)

     Set a string configuration option from a null-terminated UTF-8
     encoded string.  The string is copied.

        * Return ‘0’ on success.

        * Set an error in 'config' and return ‘-1’ on error.

 -- C の関数: int PyInitConfig_SetStrList (PyInitConfig *config, const
          char *name, size_t length, char *const *items)

     Set a string list configuration option from an array of
     null-terminated UTF-8 encoded strings.  The string list is copied.

        * Return ‘0’ on success.

        * Set an error in 'config' and return ‘-1’ on error.


File: python.info,  Node: Module,  Next: Initialize Python,  Prev: Set Options,  Up: PyInitConfig C API

7.11.1.6 Module
...............

 -- C の関数: int PyInitConfig_AddModule (PyInitConfig *config, const
          char *name, PyObject *(*initfunc)(void))

     Add a built-in extension module to the table of built-in modules.

     The new module can be imported by the name 'name', and uses the
     function 'initfunc' as the initialization function called on the
     first attempted import.

        * Return ‘0’ on success.

        * Set an error in 'config' and return ‘-1’ on error.

     If Python is initialized multiple times, ‘PyInitConfig_AddModule()’
     must be called at each Python initialization.

     Similar to the *note PyImport_AppendInittab(): 1b1c. function.


File: python.info,  Node: Initialize Python,  Prev: Module,  Up: PyInitConfig C API

7.11.1.7 Initialize Python
..........................

 -- C の関数: int Py_InitializeFromInitConfig (PyInitConfig *config)

     Initialize Python from the initialization configuration.

        * Return ‘0’ on success.

        * Set an error in 'config' and return ‘-1’ on error.

        * Set an exit code in 'config' and return ‘-1’ if Python wants
          to exit.

     See ‘PyInitConfig_GetExitcode()’ for the exit code case.


File: python.info,  Node: Configuration Options,  Next: Runtime Python configuration API,  Prev: PyInitConfig C API,  Up: Python 初期化設定

7.11.2 Configuration Options
----------------------------

オプション                    PyConfig/PyPreConfig member   型                            可視性
                                                                                          
------------------------------------------------------------------------------------------------------------------------
                                                                                          
‘"allocator"’                 *note allocator: 5574.        ‘int’                         読み出し専用
                                                                                          
                                                                                          
‘"argv"’                      *note argv: 3f1.              ‘list[str]’                   Public
                                                                                          
                                                                                          
‘"base_exec_prefix"’          *note base_exec_prefix: 5575. ‘str’                         Public
                                                                                          
                                                                                          
‘"base_executable"’           *note base_executable: 5576.  ‘str’                         Public
                                                                                          
                                                                                          
‘"base_prefix"’               *note base_prefix: 5577.      ‘str’                         Public
                                                                                          
                                                                                          
‘"buffered_stdio"’            *note buffered_stdio: 411.    ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"bytes_warning"’             *note bytes_warning: 407.     ‘int’                         Public
                                                                                          
                                                                                          
‘"check_hash_pycs_mode"’      *note check_hash_pycs_mode: 5578.‘str’                      読み出し専用
                                                                                          
                                                                                          
‘"code_debug_ranges"’         *note code_debug_ranges: 5579.‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"coerce_c_locale"’           *note coerce_c_locale: 557a.  ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"coerce_c_locale_warn"’      *note coerce_c_locale_warn: 557b.‘bool’                     読み出し専用
                                                                                          
                                                                                          
‘"configure_c_stdio"’         *note configure_c_stdio: 557c.‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"configure_locale"’          *note configure_locale: 557d. ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"cpu_count"’                 *note cpu_count: 557e.        ‘int’                         Public
                                                                                          
                                                                                          
‘"dev_mode"’                  *note dev_mode: 557f.         ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"dump_refs"’                 *note dump_refs: 5580.        ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"dump_refs_file"’            *note dump_refs_file: 5581.   ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"exec_prefix"’               *note exec_prefix: 5582.      ‘str’                         Public
                                                                                          
                                                                                          
‘"executable"’                *note executable: 645.        ‘str’                         Public
                                                                                          
                                                                                          
‘"faulthandler"’              *note faulthandler: 5583.     ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"filesystem_encoding"’       *note filesystem_encoding: 41b.‘str’                        読み出し専用
                                                                                          
                                                                                          
‘"filesystem_errors"’         *note filesystem_errors: 41c. ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"hash_seed"’                 *note hash_seed: 414.         ‘int’                         読み出し専用
                                                                                          
                                                                                          
‘"home"’                      *note home: 3f3.              ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"import_time"’               *note import_time: 5584.      ‘int’                         読み出し専用
                                                                                          
                                                                                          
‘"inspect"’                   *note inspect: 401.           ‘bool’                        Public
                                                                                          
                                                                                          
‘"install_signal_handlers"’   *note install_signal_handlers: abb.‘bool’                   読み出し専用
                                                                                          
                                                                                          
‘"int_max_str_digits"’        *note int_max_str_digits: 5585.‘int’                        Public
                                                                                          
                                                                                          
‘"interactive"’               *note interactive: 3ff.       ‘bool’                        Public
                                                                                          
                                                                                          
‘"isolated"’                  *note isolated: 416.          ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"legacy_windows_fs_encoding"’*note legacy_windows_fs_encoding: 418.‘bool’                読み出し専用
                                                                                          
                                                                                          
‘"legacy_windows_stdio"’      *note legacy_windows_stdio: 41a.‘bool’                      読み出し専用
                                                                                          
                                                                                          
‘"malloc_stats"’              *note malloc_stats: 5586.     ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"module_search_paths"’       *note module_search_paths: 643.‘list[str]’                  Public
                                                                                          
                                                                                          
‘"optimization_level"’        *note optimization_level: 403.‘int’                         Public
                                                                                          
                                                                                          
‘"orig_argv"’                 *note orig_argv: a94.         ‘list[str]’                   読み出し専用
                                                                                          
                                                                                          
‘"parse_argv"’                *note parse_argv: 1cf1.       ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"parser_debug"’              *note parser_debug: 3f9.      ‘bool’                        Public
                                                                                          
                                                                                          
‘"pathconfig_warnings"’       *note pathconfig_warnings: 409.‘bool’                       読み出し専用
                                                                                          
                                                                                          
‘"perf_profiling"’            *note perf_profiling: 5587.   ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"platlibdir"’                *note platlibdir: 1d21.       ‘str’                         Public
                                                                                          
                                                                                          
‘"prefix"’                    *note prefix: 5588.           ‘str’                         Public
                                                                                          
                                                                                          
‘"program_name"’              *note program_name: 3f2.      ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"pycache_prefix"’            *note pycache_prefix: 5589.   ‘str’                         Public
                                                                                          
                                                                                          
‘"quiet"’                     *note quiet: 3fd.             ‘bool’                        Public
                                                                                          
                                                                                          
‘"run_command"’               *note run_command: 5519.      ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"run_filename"’              *note run_filename: 551a.     ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"run_module"’                *note run_module: 551b.       ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"run_presite"’               *note run_presite: 558a.      ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"safe_path"’                 *note safe_path: 977.         ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"show_ref_count"’            *note show_ref_count: 558b.   ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"site_import"’               *note site_import: 405.       ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"skip_source_first_line"’    *note skip_source_first_line: 558c.‘bool’                   読み出し専用
                                                                                          
                                                                                          
‘"stdio_encoding"’            *note stdio_encoding: 644.    ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"stdio_errors"’              *note stdio_errors: 4928.     ‘str’                         読み出し専用
                                                                                          
                                                                                          
‘"stdlib_dir"’                *note stdlib_dir: 558d.       ‘str’                         Public
                                                                                          
                                                                                          
‘"tracemalloc"’               *note tracemalloc: 558e.      ‘int’                         読み出し専用
                                                                                          
                                                                                          
‘"use_environment"’           *note use_environment: 40b.   ‘bool’                        Public
                                                                                          
                                                                                          
‘"use_frozen_modules"’        *note use_frozen_modules: 558f.‘bool’                       読み出し専用
                                                                                          
                                                                                          
‘"use_hash_seed"’             *note use_hash_seed: 413.     ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"use_system_logger"’         *note use_system_logger: 2271.‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"user_site_directory"’       *note user_site_directory: 40f.‘bool’                       読み出し専用
                                                                                          
                                                                                          
‘"utf8_mode"’                 *note utf8_mode: 41d.         ‘bool’                        読み出し専用
                                                                                          
                                                                                          
‘"verbose"’                   *note verbose: 3fb.           ‘int’                         Public
                                                                                          
                                                                                          
‘"warn_default_encoding"’     *note warn_default_encoding: 5590.‘bool’                    読み出し専用
                                                                                          
                                                                                          
‘"warnoptions"’               *note warnoptions: 641.       ‘list[str]’                   Public
                                                                                          
                                                                                          
‘"write_bytecode"’            *note write_bytecode: 40d.    ‘bool’                        Public
                                                                                          
                                                                                          
‘"xoptions"’                  *note xoptions: 642.          ‘dict[str, str]’              Public
                                                                                          
                                                                                          
‘"_pystats"’                  *note _pystats: 5591.         ‘bool’                        読み出し専用
                                                                                          

Visibility:

   * Public: Can be retrieved by *note PyConfig_Get(): 37c. and set by
     *note PyConfig_Set(): 37d.

   * Read-only: Can be retrieved by *note PyConfig_Get(): 37c, but
     cannot be set by *note PyConfig_Set(): 37d.


File: python.info,  Node: Runtime Python configuration API,  Next: PyConfig C API,  Prev: Configuration Options,  Up: Python 初期化設定

7.11.3 Runtime Python configuration API
---------------------------------------

At runtime, it's possible to get and set configuration options using
*note PyConfig_Get(): 37c. and *note PyConfig_Set(): 37d. functions.

The configuration option 'name' parameter must be a non-NULL
null-terminated UTF-8 encoded string.  See *note Configuration Options:
556f.

Some options are read from the *note sys: df. attributes.  For example,
the option ‘"argv"’ is read from *note sys.argv: 147c.

 -- C の関数: *note PyObject: 5df. *PyConfig_Get (const char *name)

     Get the current runtime value of a configuration option as a Python
     object.

        * Return a new reference on success.

        * Set an exception and return ‘NULL’ on error.

     The object type depends on the configuration option.  It can be:

        * ‘bool’

        * ‘int’

        * ‘str’

        * ‘list[str]’

        * ‘dict[str, str]’

     The caller must have an *note attached thread state: 4ed1.  The
     function cannot be called before Python initialization nor after
     Python finalization.

     Added in version 3.14.

 -- C の関数: int PyConfig_GetInt (const char *name, int *value)

     Similar to *note PyConfig_Get(): 37c, but get the value as a C int.

        * Return ‘0’ on success.

        * Set an exception and return ‘-1’ on error.

     Added in version 3.14.

 -- C の関数: *note PyObject: 5df. *PyConfig_Names (void)

     Get all configuration option names as a ‘frozenset’.

        * Return a new reference on success.

        * Set an exception and return ‘NULL’ on error.

     The caller must have an *note attached thread state: 4ed1.  The
     function cannot be called before Python initialization nor after
     Python finalization.

     Added in version 3.14.

 -- C の関数: int PyConfig_Set (const char *name, PyObject *value)

     Set the current runtime value of a configuration option.

        * Raise a *note ValueError: 2ec. if there is no option 'name'.

        * Raise a *note ValueError: 2ec. if 'value' is an invalid value.

        * Raise a *note ValueError: 2ec. if the option is read-only
          (cannot be set).

        * Raise a *note TypeError: 198. if 'value' has not the proper
          type.

     The caller must have an *note attached thread state: 4ed1.  The
     function cannot be called before Python initialization nor after
     Python finalization.

     Raises an *note auditing event: 1c6e. ‘cpython.PyConfig_Set’ with
     arguments ‘name’, ‘value’.

     Added in version 3.14.


File: python.info,  Node: PyConfig C API,  Next: Py_GetArgcArgv,  Prev: Runtime Python configuration API,  Up: Python 初期化設定

7.11.4 PyConfig C API
---------------------

Added in version 3.8.

Pythonは *note Py_InitializeFromConfig(): 3f6. と *note PyConfig: 3f7. 構
造体を使って初期化できます。*note Py_PreInitialize(): 41e. と *note
PyPreConfig: ba3. 構造体によって事前に初期化できます。

設定には二つの種類があります:

   * *note Python Configuration: 551c. は、通常の Python と同じ振る舞い
     をするカスタマイズされた Python を構築するために使用されます。例え
     ば、環境変数やコマンドライン引数がPythonを設定するために使用されま
     す。

   * The *note Isolated Configuration: 556c. can be used to embed Python
     into an application.  It isolates Python from the system.  For
     example, environment variables are ignored, the LC_CTYPE locale is
     left unchanged and no signal handler is registered.

*note Py_RunMain(): bbc. 関数は、カスタマイズされた Python プログラムを
書くために使用できます。

*note Initialization, Finalization, and Threads: 550e. も参照してくださ
い。

参考
....

PEP 587(1) "Python 初期化設定"

* Menu:

* 使用例: 使用例<55>.
* PyWideStringList::
* PyStatus::
* PyPreConfig::
* Preinitialize Python with PyPreConfig::
* PyConfig::
* Initialization with PyConfig::
* Isolated Configuration::
* Python Configuration::
* Python Path Configuration::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0587/


File: python.info,  Node: 使用例<55>,  Next: PyWideStringList,  Up: PyConfig C API

7.11.4.1 使用例
...............

Example of customized Python always running in isolated mode:

     int main(int argc, char **argv)
     {
         PyStatus status;

         PyConfig config;
         PyConfig_InitPythonConfig(&config);
         config.isolated = 1;

         /* Decode command line arguments.
            Implicitly preinitialize Python (in isolated mode). */
         status = PyConfig_SetBytesArgv(&config, argc, argv);
         if (PyStatus_Exception(status)) {
             goto exception;
         }

         status = Py_InitializeFromConfig(&config);
         if (PyStatus_Exception(status)) {
             goto exception;
         }
         PyConfig_Clear(&config);

         return Py_RunMain();

     exception:
         PyConfig_Clear(&config);
         if (PyStatus_IsExit(status)) {
             return status.exitcode;
         }
         /* Display the error message and exit the process with
            non-zero exit code */
         Py_ExitStatusException(status);
     }


File: python.info,  Node: PyWideStringList,  Next: PyStatus,  Prev: 使用例<55>,  Up: PyConfig C API

7.11.4.2 PyWideStringList
.........................

 -- C のデータ型: type PyWideStringList

     ‘wchar_t*’ 文字列のリスト。

     'length' が非ゼロの場合は、'items' は非 ‘NULL’ かつすべての文字列は
     非 ‘NULL’ でなければなりません。

     メソッド:

      -- C の関数: *note PyStatus: ba4. PyWideStringList_Append
               (PyWideStringList *list, const wchar_t *item)

          'item' を 'list' に追加します。

          Python must be preinitialized to call this function.

      -- C の関数: *note PyStatus: ba4. PyWideStringList_Insert
               (PyWideStringList *list, Py_ssize_t index, const wchar_t
               *item)

          'item' を 'list' の 'index' の位置に挿入します。

          'index' が 'list' の長さ以上の場合、'item' を 'list' の末尾に
          追加します。

          'index' must be greater than or equal to ‘0’.

          Python must be preinitialized to call this function.

     構造体フィールド:

      -- C のメンバ変数: *note Py_ssize_t: c55. length

          リストの長さ。

      -- C のメンバ変数: wchar_t **items

          リストの要素。


File: python.info,  Node: PyStatus,  Next: PyPreConfig,  Prev: PyWideStringList,  Up: PyConfig C API

7.11.4.3 PyStatus
.................

 -- C のデータ型: type PyStatus

     初期化関数のステータス(成功、エラー、終了)を格納する構造体です。

     エラー時には、エラーを生成したC関数の名前を格納できます。

     構造体フィールド:

      -- C のメンバ変数: int exitcode

          終了コード。‘exit()’ の引数として渡されます。

      -- C のメンバ変数: const char *err_msg

          エラーメッセージ。

      -- C のメンバ変数: const char *func

          エラーを生成した関数の名前で、‘NULL’ になりえます。

     ステータスを生成する関数:

      -- C の関数: *note PyStatus: ba4. PyStatus_Ok (void)

          成功。

      -- C の関数: *note PyStatus: ba4. PyStatus_Error (const char
               *err_msg)

          メッセージとともにエラーを初期化します。

          'err_msg' must not be ‘NULL’.

      -- C の関数: *note PyStatus: ba4. PyStatus_NoMemory (void)

          メモリ割り当ての失敗(メモリ不足)。

      -- C の関数: *note PyStatus: ba4. PyStatus_Exit (int exitcode)

          指定した終了コードでPythonを終了します。

     ステータスを扱う関数:

      -- C の関数: int PyStatus_Exception (PyStatus status)

          Is the status an error or an exit?  If true, the exception
          must be handled; by calling *note Py_ExitStatusException():
          bb9. for example.

      -- C の関数: int PyStatus_IsError (PyStatus status)

          Is the result an error?

      -- C の関数: int PyStatus_IsExit (PyStatus status)

          Is the result an exit?

      -- C の関数: void Py_ExitStatusException (PyStatus status)

          Call ‘exit(exitcode)’ if 'status' is an exit.  Print the error
          message and exit with a non-zero exit code if 'status' is an
          error.  Must only be called if ‘PyStatus_Exception(status)’ is
          non-zero.

     注釈: Internally, Python uses macros which set ‘PyStatus.func’,
     whereas functions to create a status set ‘func’ to ‘NULL’.

以下はプログラム例です:

     PyStatus alloc(void **ptr, size_t size)
     {
         *ptr = PyMem_RawMalloc(size);
         if (*ptr == NULL) {
             return PyStatus_NoMemory();
         }
         return PyStatus_Ok();
     }

     int main(int argc, char **argv)
     {
         void *ptr;
         PyStatus status = alloc(&ptr, 16);
         if (PyStatus_Exception(status)) {
             Py_ExitStatusException(status);
         }
         PyMem_Free(ptr);
         return 0;
     }


File: python.info,  Node: PyPreConfig,  Next: Preinitialize Python with PyPreConfig,  Prev: PyStatus,  Up: PyConfig C API

7.11.4.4 PyPreConfig
....................

 -- C のデータ型: type PyPreConfig

     Structure used to preinitialize Python.

     Function to initialize a preconfiguration:

      -- C の関数: void PyPreConfig_InitPythonConfig (PyPreConfig
               *preconfig)

          Initialize the preconfiguration with *note Python
          Configuration: 551c.

      -- C の関数: void PyPreConfig_InitIsolatedConfig (PyPreConfig
               *preconfig)

          Initialize the preconfiguration with *note Isolated
          Configuration: 556c.

     構造体フィールド:

      -- C のメンバ変数: int allocator

          Name of the Python memory allocators:

             * ‘PYMEM_ALLOCATOR_NOT_SET’ (‘0’): don't change memory
               allocators (use defaults).

             * ‘PYMEM_ALLOCATOR_DEFAULT’ (‘1’): *note default memory
               allocators: 213b.

             * ‘PYMEM_ALLOCATOR_DEBUG’ (‘2’): *note default memory
               allocators: 213b. with *note debug hooks: 213e.

             * ‘PYMEM_ALLOCATOR_MALLOC’ (‘3’): use ‘malloc()’ of the C
               library.

             * ‘PYMEM_ALLOCATOR_MALLOC_DEBUG’ (‘4’): force usage of
               ‘malloc()’ with *note debug hooks: 213e.

             * ‘PYMEM_ALLOCATOR_PYMALLOC’ (‘5’): *note Python pymalloc
               memory allocator: f0b.

             * ‘PYMEM_ALLOCATOR_PYMALLOC_DEBUG’ (‘6’): *note Python
               pymalloc memory allocator: f0b. with *note debug hooks:
               213e.

             * ‘PYMEM_ALLOCATOR_MIMALLOC’ (‘6’): use ‘mimalloc’, a fast
               malloc replacement.

             * ‘PYMEM_ALLOCATOR_MIMALLOC_DEBUG’ (‘7’): use ‘mimalloc’, a
               fast malloc replacement with *note debug hooks: 213e.

          ‘PYMEM_ALLOCATOR_PYMALLOC’ and
          ‘PYMEM_ALLOCATOR_PYMALLOC_DEBUG’ are not supported if Python
          is *note configured using -without-pymalloc: 21a1.

          ‘PYMEM_ALLOCATOR_MIMALLOC’ and
          ‘PYMEM_ALLOCATOR_MIMALLOC_DEBUG’ are not supported if Python
          is *note configured using -without-mimalloc: 21a0. or if the
          underlying atomic support isn't available.

          See *note Memory Management: 559d.

          Default: ‘PYMEM_ALLOCATOR_NOT_SET’.

      -- C のメンバ変数: int configure_locale

          Set the LC_CTYPE locale to the user preferred locale.

          If equals to ‘0’, set *note coerce_c_locale: 557a. and *note
          coerce_c_locale_warn: 557b. members to ‘0’.

          See the *note locale encoding: 54a.

          Default: ‘1’ in Python config, ‘0’ in isolated config.

      -- C のメンバ変数: int coerce_c_locale

          If equals to ‘2’, coerce the C locale.

          If equals to ‘1’, read the LC_CTYPE locale to decide if it
          should be coerced.

          See the *note locale encoding: 54a.

          Default: ‘-1’ in Python config, ‘0’ in isolated config.

      -- C のメンバ変数: int coerce_c_locale_warn

          If non-zero, emit a warning if the C locale is coerced.

          Default: ‘-1’ in Python config, ‘0’ in isolated config.

      -- C のメンバ変数: int dev_mode

          *note Python Development Mode: 508.: see *note
          PyConfig.dev_mode: 557f.

          Default: ‘-1’ in Python mode, ‘0’ in isolated mode.

      -- C のメンバ変数: int isolated

          Isolated mode: see *note PyConfig.isolated: 416.

          Default: ‘0’ in Python mode, ‘1’ in isolated mode.

      -- C のメンバ変数: int legacy_windows_fs_encoding

          If non-zero:

             * Set *note PyPreConfig.utf8_mode: 41d. to ‘0’,

             * Set *note PyConfig.filesystem_encoding: 41b. to ‘"mbcs"’,

             * Set *note PyConfig.filesystem_errors: 41c. to
               ‘"replace"’.

          Initialized from the *note PYTHONLEGACYWINDOWSFSENCODING: 33f.
          environment variable value.

          Only available on Windows.  ‘#ifdef MS_WINDOWS’ macro can be
          used for Windows specific code.

          Default: ‘0’.

      -- C のメンバ変数: int parse_argv

          If non-zero, *note Py_PreInitializeFromArgs(): bba. and *note
          Py_PreInitializeFromBytesArgs(): bbb. parse their ‘argv’
          argument the same way the regular Python parses command line
          arguments: see *note Command Line Arguments: 1209.

          Default: ‘1’ in Python config, ‘0’ in isolated config.

      -- C のメンバ変数: int use_environment

          Use *note environment variables: 807.?  See *note
          PyConfig.use_environment: 40b.

          Default: ‘1’ in Python config and ‘0’ in isolated config.

      -- C のメンバ変数: int utf8_mode

          If non-zero, enable the *note Python UTF-8 Mode: 866.

          Set to ‘0’ or ‘1’ by the *note -X utf8: 16f. command line
          option and the *note PYTHONUTF8: ccf. environment variable.

          Also set to ‘1’ if the ‘LC_CTYPE’ locale is ‘C’ or ‘POSIX’.

          Default: ‘-1’ in Python config and ‘0’ in isolated config.


File: python.info,  Node: Preinitialize Python with PyPreConfig,  Next: PyConfig,  Prev: PyPreConfig,  Up: PyConfig C API

7.11.4.5 Preinitialize Python with PyPreConfig
..............................................

The preinitialization of Python:

   * Set the Python memory allocators (*note PyPreConfig.allocator:
     5574.)

   * Configure the LC_CTYPE locale (*note locale encoding: 54a.)

   * Set the *note Python UTF-8 Mode: 866. (*note PyPreConfig.utf8_mode:
     41d.)

The current preconfiguration (‘PyPreConfig’ type) is stored in
‘_PyRuntime.preconfig’.

Functions to preinitialize Python:

 -- C の関数: *note PyStatus: ba4. Py_PreInitialize (const PyPreConfig
          *preconfig)

     Preinitialize Python from 'preconfig' preconfiguration.

     'preconfig' must not be ‘NULL’.

 -- C の関数: *note PyStatus: ba4. Py_PreInitializeFromBytesArgs (const
          PyPreConfig *preconfig, int argc, char *const *argv)

     Preinitialize Python from 'preconfig' preconfiguration.

     Parse 'argv' command line arguments (bytes strings) if *note
     parse_argv: 55a0. of 'preconfig' is non-zero.

     'preconfig' must not be ‘NULL’.

 -- C の関数: *note PyStatus: ba4. Py_PreInitializeFromArgs (const
          PyPreConfig *preconfig, int argc, wchar_t *const *argv)

     Preinitialize Python from 'preconfig' preconfiguration.

     Parse 'argv' command line arguments (wide strings) if *note
     parse_argv: 55a0. of 'preconfig' is non-zero.

     'preconfig' must not be ‘NULL’.

The caller is responsible to handle exceptions (error or exit) using
*note PyStatus_Exception(): bb0. and *note Py_ExitStatusException():
bb9.

For *note Python Configuration: 551c. (*note
PyPreConfig_InitPythonConfig(): bae.), if Python is initialized with
command line arguments, the command line arguments must also be passed
to preinitialize Python, since they have an effect on the
pre-configuration like encodings.  For example, the *note -X utf8: 16f.
command line option enables the *note Python UTF-8 Mode: 866.

‘PyMem_SetAllocator()’ can be called after *note Py_PreInitialize():
41e. and before *note Py_InitializeFromConfig(): 3f6. to install a
custom memory allocator.  It can be called before *note
Py_PreInitialize(): 41e. if *note PyPreConfig.allocator: 5574. is set to
‘PYMEM_ALLOCATOR_NOT_SET’.

Python memory allocation functions like *note PyMem_RawMalloc(): 631.
must not be used before the Python preinitialization, whereas calling
directly ‘malloc()’ and ‘free()’ is always safe.  *note
Py_DecodeLocale(): dc0. must not be called before the Python
preinitialization.

Example using the preinitialization to enable the *note Python UTF-8
Mode: 866.:

     PyStatus status;
     PyPreConfig preconfig;
     PyPreConfig_InitPythonConfig(&preconfig);

     preconfig.utf8_mode = 1;

     status = Py_PreInitialize(&preconfig);
     if (PyStatus_Exception(status)) {
         Py_ExitStatusException(status);
     }

     /* at this point, Python speaks UTF-8 */

     Py_Initialize();
     /* ... use Python API here ... */
     Py_Finalize();


File: python.info,  Node: PyConfig,  Next: Initialization with PyConfig,  Prev: Preinitialize Python with PyPreConfig,  Up: PyConfig C API

7.11.4.6 PyConfig
.................

 -- C のデータ型: type PyConfig

     Structure containing most parameters to configure Python.

     When done, the *note PyConfig_Clear(): ba6. function must be used
     to release the configuration memory.

     Structure methods:

      -- C の関数: void PyConfig_InitPythonConfig (PyConfig *config)

          Initialize configuration with the *note Python Configuration:
          551c.

      -- C の関数: void PyConfig_InitIsolatedConfig (PyConfig *config)

          Initialize configuration with the *note Isolated
          Configuration: 556c.

      -- C の関数: *note PyStatus: ba4. PyConfig_SetString (PyConfig
               *config, wchar_t *const *config_str, const wchar_t *str)

          Copy the wide character string 'str' into ‘*config_str’.

          *note Preinitialize Python: 42c8. if needed.

      -- C の関数: *note PyStatus: ba4. PyConfig_SetBytesString
               (PyConfig *config, wchar_t *const *config_str, const char
               *str)

          Decode 'str' using *note Py_DecodeLocale(): dc0. and set the
          result into ‘*config_str’.

          *note Preinitialize Python: 42c8. if needed.

      -- C の関数: *note PyStatus: ba4. PyConfig_SetArgv (PyConfig
               *config, int argc, wchar_t *const *argv)

          Set command line arguments (*note argv: 3f1. member of
          'config') from the 'argv' list of wide character strings.

          *note Preinitialize Python: 42c8. if needed.

      -- C の関数: *note PyStatus: ba4. PyConfig_SetBytesArgv (PyConfig
               *config, int argc, char *const *argv)

          Set command line arguments (*note argv: 3f1. member of
          'config') from the 'argv' list of bytes strings.  Decode bytes
          using *note Py_DecodeLocale(): dc0.

          *note Preinitialize Python: 42c8. if needed.

      -- C の関数: *note PyStatus: ba4. PyConfig_SetWideStringList
               (PyConfig *config, PyWideStringList *list, Py_ssize_t
               length, wchar_t **items)

          Set the list of wide strings 'list' to 'length' and 'items'.

          *note Preinitialize Python: 42c8. if needed.

      -- C の関数: *note PyStatus: ba4. PyConfig_Read (PyConfig *config)

          Read all Python configuration.

          Fields which are already initialized are left unchanged.

          Fields for *note path configuration: aaa. are no longer
          calculated or modified when calling this function, as of
          Python 3.11.

          The *note PyConfig_Read(): 993. function only parses *note
          PyConfig.argv: 3f1. arguments once: *note PyConfig.parse_argv:
          1cf1. is set to ‘2’ after arguments are parsed.  Since Python
          arguments are stripped from *note PyConfig.argv: 3f1, parsing
          arguments twice would parse the application options as Python
          options.

          *note Preinitialize Python: 42c8. if needed.

          バージョン 3.10 で変更: The *note PyConfig.argv: 3f1.
          arguments are now only parsed once, *note PyConfig.parse_argv:
          1cf1. is set to ‘2’ after arguments are parsed, and arguments
          are only parsed if *note PyConfig.parse_argv: 1cf1. equals
          ‘1’.

          バージョン 3.11 で変更: *note PyConfig_Read(): 993. no longer
          calculates all paths, and so fields listed under *note Python
          Path Configuration: aaa. may no longer be updated until *note
          Py_InitializeFromConfig(): 3f6. is called.

      -- C の関数: void PyConfig_Clear (PyConfig *config)

          Release configuration memory.

     Most ‘PyConfig’ methods *note preinitialize Python: 42c8. if
     needed.  In that case, the Python preinitialization configuration
     (*note PyPreConfig: ba3.) is based on the *note PyConfig: 3f7.  If
     configuration fields which are in common with *note PyPreConfig:
     ba3. are tuned, they must be set before calling a *note PyConfig:
     3f7. method:

        * *note PyConfig.dev_mode: 557f.

        * *note PyConfig.isolated: 416.

        * *note PyConfig.parse_argv: 1cf1.

        * *note PyConfig.use_environment: 40b.

     Moreover, if *note PyConfig_SetArgv(): ba9. or *note
     PyConfig_SetBytesArgv(): baa. is used, this method must be called
     before other methods, since the preinitialization configuration
     depends on command line arguments (if *note parse_argv: 1cf1. is
     non-zero).

     The caller of these methods is responsible to handle exceptions
     (error or exit) using ‘PyStatus_Exception()’ and
     ‘Py_ExitStatusException()’.

     構造体フィールド:

      -- C のメンバ変数: *note PyWideStringList: ba5. argv

          Set *note sys.argv: 147c. command line arguments based on
          *note argv: 3f1.  These parameters are similar to those passed
          to the program's ‘main()’ function with the difference that
          the first entry should refer to the script file to be executed
          rather than the executable hosting the Python interpreter.  If
          there isn't a script that will be run, the first entry in
          *note argv: 3f1. can be an empty string.

          Set *note parse_argv: 1cf1. to ‘1’ to parse *note argv: 3f1.
          the same way the regular Python parses Python command line
          arguments and then to strip Python arguments from *note argv:
          3f1.

          If *note argv: 3f1. is empty, an empty string is added to
          ensure that *note sys.argv: 147c. always exists and is never
          empty.

          Default: ‘NULL’.

          See also the *note orig_argv: a94. member.

      -- C のメンバ変数: int safe_path

          If equals to zero, ‘Py_RunMain()’ prepends a potentially
          unsafe path to *note sys.path: 3e4. at startup:

             * If *note argv[0]: 3f1. is equal to ‘L"-m"’ (‘python -m
               module’), prepend the current working directory.

             * If running a script (‘python script.py’), prepend the
               script's directory.  If it's a symbolic link, resolve
               symbolic links.

             * Otherwise (‘python -c code’ and ‘python’), prepend an
               empty string, which means the current working directory.

          Set to ‘1’ by the *note -P: 7c1. command line option and the
          *note PYTHONSAFEPATH: 7c2. environment variable.

          Default: ‘0’ in Python config, ‘1’ in isolated config.

          Added in version 3.11.

      -- C のメンバ変数: wchar_t *base_exec_prefix

          *note sys.base_exec_prefix: 3ea.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aaa. output.

          See also *note PyConfig.exec_prefix: 5582.

      -- C のメンバ変数: wchar_t *base_executable

          Python base executable: ‘sys._base_executable’.

          Set by the ‘__PYVENV_LAUNCHER__’ environment variable.

          Set from *note PyConfig.executable: 645. if ‘NULL’.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aaa. output.

          See also *note PyConfig.executable: 645.

      -- C のメンバ変数: wchar_t *base_prefix

          *note sys.base_prefix: 3e6.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aaa. output.

          See also *note PyConfig.prefix: 5588.

      -- C のメンバ変数: int buffered_stdio

          If equals to ‘0’ and *note configure_c_stdio: 557c. is
          non-zero, disable buffering on the C streams stdout and
          stderr.

          Set to ‘0’ by the *note -u: 1d8d. command line option and the
          *note PYTHONUNBUFFERED: 1d8e. environment variable.

          stdin is always opened in buffered mode.

          Default: ‘1’.

      -- C のメンバ変数: int bytes_warning

          If equals to ‘1’, issue a warning when comparing *note bytes:
          192. or *note bytearray: 344. with *note str: 169, or
          comparing *note bytes: 192. with *note int: 19b.

          If equal or greater to ‘2’, raise a *note BytesWarning: e1c.
          exception in these cases.

          Incremented by the *note -b: 7f9. command line option.

          Default: ‘0’.

      -- C のメンバ変数: int warn_default_encoding

          If non-zero, emit a *note EncodingWarning: 212e. warning when
          *note io.TextIOWrapper: 9be. uses its default encoding.  See
          *note Opt-in EncodingWarning: 2140. for details.

          Default: ‘0’.

          Added in version 3.10.

      -- C のメンバ変数: int code_debug_ranges

          If equals to ‘0’, disables the inclusion of the end line and
          column mappings in code objects.  Also disables traceback
          printing carets to specific error locations.

          Set to ‘0’ by the *note PYTHONNODEBUGRANGES: 7d3. environment
          variable and by the *note -X no_debug_ranges: 16f. command
          line option.

          Default: ‘1’.

          Added in version 3.11.

      -- C のメンバ変数: wchar_t *check_hash_pycs_mode

          Control the validation behavior of hash-based ‘.pyc’ files:
          value of the *note -check-hash-based-pycs: 2122. command line
          option.

          Valid values:

             - ‘L"always"’: Hash the source file for invalidation
               regardless of value of the 'check_source' flag.

             - ‘L"never"’: Assume that hash-based pycs always are valid.

             - ‘L"default"’: The 'check_source' flag in hash-based pycs
               determines invalidation.

          Default: ‘L"default"’.

          See also PEP 552(1) "Deterministic pycs".

      -- C のメンバ変数: int configure_c_stdio

          If non-zero, configure C standard streams:

             * On Windows, set the binary mode (‘O_BINARY’) on stdin,
               stdout and stderr.

             * If *note buffered_stdio: 411. equals zero, disable
               buffering of stdin, stdout and stderr streams.

             * If *note interactive: 3ff. is non-zero, enable stream
               buffering on stdin and stdout (only stdout on Windows).

          Default: ‘1’ in Python config, ‘0’ in isolated config.

      -- C のメンバ変数: int dev_mode

          If non-zero, enable the *note Python Development Mode: 508.

          Set to ‘1’ by the *note -X dev: 16f. option and the *note
          PYTHONDEVMODE: ce7. environment variable.

          Default: ‘-1’ in Python mode, ‘0’ in isolated mode.

      -- C のメンバ変数: int dump_refs

          Dump Python references?

          If non-zero, dump all objects which are still alive at exit.

          Set to ‘1’ by the *note PYTHONDUMPREFS: b9e. environment
          variable.

          Needs a special build of Python with the ‘Py_TRACE_REFS’ macro
          defined: see the *note configure -with-trace-refs option: 636.

          Default: ‘0’.

      -- C のメンバ変数: wchar_t *dump_refs_file

          Filename where to dump Python references.

          Set by the *note PYTHONDUMPREFSFILE: 1c3f. environment
          variable.

          Default: ‘NULL’.

          Added in version 3.11.

      -- C のメンバ変数: wchar_t *exec_prefix

          The site-specific directory prefix where the
          platform-dependent Python files are installed: *note
          sys.exec_prefix: 3eb.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aaa. output.

          See also *note PyConfig.base_exec_prefix: 5575.

      -- C のメンバ変数: wchar_t *executable

          The absolute path of the executable binary for the Python
          interpreter: *note sys.executable: 3ed.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aaa. output.

          See also *note PyConfig.base_executable: 5576.

      -- C のメンバ変数: int faulthandler

          Enable faulthandler?

          If non-zero, call *note faulthandler.enable(): 20f. at
          startup.

          Set to ‘1’ by *note -X faulthandler: 16f. and the *note
          PYTHONFAULTHANDLER: 1291. environment variable.

          Default: ‘-1’ in Python mode, ‘0’ in isolated mode.

      -- C のメンバ変数: wchar_t *filesystem_encoding

          *note Filesystem encoding: 75d.: *note
          sys.getfilesystemencoding(): e53.

          On macOS, Android and VxWorks: use ‘"utf-8"’ by default.

          On Windows: use ‘"utf-8"’ by default, or ‘"mbcs"’ if *note
          legacy_windows_fs_encoding: 418. of *note PyPreConfig: ba3. is
          non-zero.

          Default encoding on other platforms:

             * ‘"utf-8"’ if *note PyPreConfig.utf8_mode: 41d. is
               non-zero.

             * ‘"ascii"’ if Python detects that ‘nl_langinfo(CODESET)’
               announces the ASCII encoding, whereas the ‘mbstowcs()’
               function decodes from a different encoding (usually
               Latin1).

             * ‘"utf-8"’ if ‘nl_langinfo(CODESET)’ returns an empty
               string.

             * Otherwise, use the *note locale encoding: 54a.:
               ‘nl_langinfo(CODESET)’ result.

          At Python startup, the encoding name is normalized to the
          Python codec name.  For example, ‘"ANSI_X3.4-1968"’ is
          replaced with ‘"ascii"’.

          See also the *note filesystem_errors: 41c. member.

      -- C のメンバ変数: wchar_t *filesystem_errors

          *note Filesystem error handler: 75d.: *note
          sys.getfilesystemencodeerrors(): ee2.

          On Windows: use ‘"surrogatepass"’ by default, or ‘"replace"’
          if *note legacy_windows_fs_encoding: 418. of *note
          PyPreConfig: ba3. is non-zero.

          On other platforms: use ‘"surrogateescape"’ by default.

          Supported error handlers:

             * ‘"strict"’

             * ‘"surrogateescape"’

             * ‘"surrogatepass"’ (only supported with the UTF-8
               encoding)

          See also the *note filesystem_encoding: 41b. member.

      -- C のメンバ変数: int use_frozen_modules

          If non-zero, use frozen modules.

          Set by the *note PYTHON_FROZEN_MODULES: 4ad. environment
          variable.

          Default: ‘1’ in a release build, or ‘0’ in a *note debug
          build: 509.

      -- C のメンバ変数: unsigned long hash_seed

      -- C のメンバ変数: int use_hash_seed

          Randomized hash function seed.

          If *note use_hash_seed: 413. is zero, a seed is chosen
          randomly at Python startup, and *note hash_seed: 414. is
          ignored.

          Set by the *note PYTHONHASHSEED: 1289. environment variable.

          Default 'use_hash_seed' value: ‘-1’ in Python mode, ‘0’ in
          isolated mode.

      -- C のメンバ変数: wchar_t *home

          Set the default Python "home" directory, that is, the location
          of the standard Python libraries (see *note PYTHONHOME: 3f0.).

          Set by the *note PYTHONHOME: 3f0. environment variable.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aaa. input.

      -- C のメンバ変数: int import_time

               If ‘1’, profile import time.  If ‘2’, include additional
               output that indicates when an imported module has already
               been loaded.

               Set by the *note -X importtime: 16f. option and the *note
               PYTHONPROFILEIMPORTTIME: ced. environment variable.

               Default: ‘0’.

          バージョン 3.14 で変更: Added support for ‘import_time = 2’

      -- C のメンバ変数: int inspect

          Enter interactive mode after executing a script or a command.

          If greater than ‘0’, enable inspect: when a script is passed
          as first argument or the -c option is used, enter interactive
          mode after executing the script or the command, even when
          *note sys.stdin: 75f. does not appear to be a terminal.

          Incremented by the *note -i: 16f4. command line option.  Set
          to ‘1’ if the *note PYTHONINSPECT: 16f3. environment variable
          is non-empty.

          Default: ‘0’.

      -- C のメンバ変数: int install_signal_handlers

          Install Python signal handlers?

          Default: ‘1’ in Python mode, ‘0’ in isolated mode.

      -- C のメンバ変数: int interactive

          If greater than ‘0’, enable the interactive mode (REPL).

          Incremented by the *note -i: 16f4. command line option.

          Default: ‘0’.

      -- C のメンバ変数: int int_max_str_digits

          Configures the *note integer string conversion length
          limitation: 80b.  An initial value of ‘-1’ means the value
          will be taken from the command line or environment or
          otherwise default to 4300 (*note
          sys.int_info.default_max_str_digits: 26dc.).  A value of ‘0’
          disables the limitation.  Values greater than zero but less
          than 640 (*note sys.int_info.str_digits_check_threshold:
          4925.) are unsupported and will produce an error.

          Configured by the *note -X int_max_str_digits: 16f. command
          line flag or the *note PYTHONINTMAXSTRDIGITS: 1b3a.
          environment variable.

          Default: ‘-1’ in Python mode.  4300 (*note
          sys.int_info.default_max_str_digits: 26dc.) in isolated mode.

          Added in version 3.12.

      -- C のメンバ変数: int cpu_count

          If the value of *note cpu_count: 557e. is not ‘-1’ then it
          will override the return values of *note os.cpu_count(): 4db,
          *note os.process_cpu_count(): 4da, and *note
          multiprocessing.cpu_count(): 1171.

          Configured by the ‘-X cpu_count=N|DEFAULT’ command line flag
          or the *note PYTHON_CPU_COUNT: 51e. environment variable.

          Default: ‘-1’.

          Added in version 3.13.

      -- C のメンバ変数: int isolated

          If greater than ‘0’, enable isolated mode:

             * Set *note safe_path: 977. to ‘1’: don't prepend a
               potentially unsafe path to *note sys.path: 3e4. at Python
               startup, such as the current directory, the script's
               directory or an empty string.

             * Set *note use_environment: 40b. to ‘0’: ignore ‘PYTHON’
               environment variables.

             * Set *note user_site_directory: 40f. to ‘0’: don't add the
               user site directory to *note sys.path: 3e4.

             * Python REPL doesn't import *note readline: bf. nor enable
               default readline configuration on interactive prompts.

          Set to ‘1’ by the *note -I: b57. command line option.

          Default: ‘0’ in Python mode, ‘1’ in isolated mode.

          See also the *note Isolated Configuration: 556c. and *note
          PyPreConfig.isolated: 559f.

      -- C のメンバ変数: int legacy_windows_stdio

          If non-zero, use *note io.FileIO: 1527. instead of
          ‘io._WindowsConsoleIO’ for *note sys.stdin: 75f, *note
          sys.stdout: ccd. and *note sys.stderr: b33.

          *note PYTHONLEGACYWINDOWSSTDIO: e55. 環境変数が空でない文字列
          に設定された場合に、 ‘1’ に設定されます。

          Only available on Windows.  ‘#ifdef MS_WINDOWS’ macro can be
          used for Windows specific code.

          Default: ‘0’.

          See also the PEP 528(2) (Change Windows console encoding to
          UTF-8).

      -- C のメンバ変数: int malloc_stats

          If non-zero, dump statistics on *note Python pymalloc memory
          allocator: f0b. at exit.

          Set to ‘1’ by the *note PYTHONMALLOCSTATS: 1f37. environment
          variable.

          The option is ignored if Python is *note configured using the
          -without-pymalloc option: 21a1.

          Default: ‘0’.

      -- C のメンバ変数: wchar_t *platlibdir

          Platform library directory name: *note sys.platlibdir: b32.

          Set by the *note PYTHONPLATLIBDIR: 1d23. environment variable.

          Default: value of the ‘PLATLIBDIR’ macro which is set by the
          *note configure -with-platlibdir option: 216c. (default:
          ‘"lib"’, or ‘"DLLs"’ on Windows).

          Part of the *note Python Path Configuration: aaa. input.

          Added in version 3.9.

          バージョン 3.11 で変更: This macro is now used on Windows to
          locate the standard library extension modules, typically under
          ‘DLLs’.  However, for compatibility, note that this value is
          ignored for any non-standard layouts, including in-tree builds
          and virtual environments.

      -- C のメンバ変数: wchar_t *pythonpath_env

          Module search paths (*note sys.path: 3e4.) as a string
          separated by ‘DELIM’ (*note os.pathsep: 2134.).

          Set by the *note PYTHONPATH: 121f. environment variable.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aaa. input.

      -- C のメンバ変数: *note PyWideStringList: ba5.
               module_search_paths

      -- C のメンバ変数: int module_search_paths_set

          Module search paths: *note sys.path: 3e4.

          If *note module_search_paths_set: 805. is equal to ‘0’, *note
          Py_InitializeFromConfig(): 3f6. will replace *note
          module_search_paths: 643. and sets *note
          module_search_paths_set: 805. to ‘1’.

          Default: empty list (‘module_search_paths’) and ‘0’
          (‘module_search_paths_set’).

          Part of the *note Python Path Configuration: aaa. output.

      -- C のメンバ変数: int optimization_level

          Compilation optimization level:

             * ‘0’: Peephole optimizer, set ‘__debug__’ to ‘True’.

             * ‘1’: Level 0, remove assertions, set ‘__debug__’ to
               ‘False’.

             * ‘2’: Level 1, strip docstrings.

          Incremented by the *note -O: 18c. command line option.  Set to
          the *note PYTHONOPTIMIZE: 2125. environment variable value.

          Default: ‘0’.

      -- C のメンバ変数: *note PyWideStringList: ba5. orig_argv

          The list of the original command line arguments passed to the
          Python executable: *note sys.orig_argv: a41.

          If *note orig_argv: a94. list is empty and *note argv: 3f1. is
          not a list only containing an empty string, *note
          PyConfig_Read(): 993. copies *note argv: 3f1. into *note
          orig_argv: a94. before modifying *note argv: 3f1. (if *note
          parse_argv: 1cf1. is non-zero).

          See also the *note argv: 3f1. member and the *note
          Py_GetArgcArgv(): 1d41. function.

          Default: empty list.

          Added in version 3.10.

      -- C のメンバ変数: int parse_argv

          Parse command line arguments?

          If equals to ‘1’, parse *note argv: 3f1. the same way the
          regular Python parses *note command line arguments: 1209, and
          strip Python arguments from *note argv: 3f1.

          The *note PyConfig_Read(): 993. function only parses *note
          PyConfig.argv: 3f1. arguments once: *note PyConfig.parse_argv:
          1cf1. is set to ‘2’ after arguments are parsed.  Since Python
          arguments are stripped from *note PyConfig.argv: 3f1, parsing
          arguments twice would parse the application options as Python
          options.

          Default: ‘1’ in Python mode, ‘0’ in isolated mode.

          バージョン 3.10 で変更: The *note PyConfig.argv: 3f1.
          arguments are now only parsed if *note PyConfig.parse_argv:
          1cf1. equals to ‘1’.

      -- C のメンバ変数: int parser_debug

          Parser debug mode.  If greater than ‘0’, turn on parser
          debugging output (for expert only, depending on compilation
          options).

          Incremented by the *note -d: 2123. command line option.  Set
          to the *note PYTHONDEBUG: 2124. environment variable value.

          Needs a *note debug build of Python: 509. (the ‘Py_DEBUG’
          macro must be defined).

          Default: ‘0’.

      -- C のメンバ変数: int pathconfig_warnings

          If non-zero, calculation of path configuration is allowed to
          log warnings into ‘stderr’.  If equals to ‘0’, suppress these
          warnings.

          Default: ‘1’ in Python mode, ‘0’ in isolated mode.

          Part of the *note Python Path Configuration: aaa. input.

          バージョン 3.11 で変更: Now also applies on Windows.

      -- C のメンバ変数: wchar_t *prefix

          The site-specific directory prefix where the platform
          independent Python files are installed: *note sys.prefix: 3e7.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aaa. output.

          See also *note PyConfig.base_prefix: 5577.

      -- C のメンバ変数: wchar_t *program_name

          Program name used to initialize *note executable: 645. and in
          early error messages during Python initialization.

             * On macOS, use *note PYTHONEXECUTABLE: 2138. environment
               variable if set.

             * If the ‘WITH_NEXT_FRAMEWORK’ macro is defined, use
               ‘__PYVENV_LAUNCHER__’ environment variable if set.

             * Use ‘argv[0]’ of *note argv: 3f1. if available and
               non-empty.

             * Otherwise, use ‘L"python"’ on Windows, or ‘L"python3"’ on
               other platforms.

          Default: ‘NULL’.

          Part of the *note Python Path Configuration: aaa. input.

      -- C のメンバ変数: wchar_t *pycache_prefix

          Directory where cached ‘.pyc’ files are written: *note
          sys.pycache_prefix: b9c.

          Set by the *note -X pycache_prefix=PATH: 16f. command line
          option and the *note PYTHONPYCACHEPREFIX: b9b. environment
          variable.  The command-line option takes precedence.

          If ‘NULL’, *note sys.pycache_prefix: b9c. is set to ‘None’.

          Default: ‘NULL’.

      -- C のメンバ変数: int quiet

          Quiet mode.  If greater than ‘0’, don't display the copyright
          and version at Python startup in interactive mode.

          Incremented by the *note -q: 177e. command line option.

          Default: ‘0’.

      -- C のメンバ変数: wchar_t *run_command

          Value of the *note -c: 1a8. command line option.

          Used by *note Py_RunMain(): bbc.

          Default: ‘NULL’.

      -- C のメンバ変数: wchar_t *run_filename

          Filename passed on the command line: trailing command line
          argument without *note -c: 1a8. or *note -m: 23c.  It is used
          by the *note Py_RunMain(): bbc. function.

          For example, it is set to ‘script.py’ by the ‘python3
          script.py arg’ command line.

          See also the *note PyConfig.skip_source_first_line: 558c.
          option.

          Default: ‘NULL’.

      -- C のメンバ変数: wchar_t *run_module

          Value of the *note -m: 23c. command line option.

          Used by *note Py_RunMain(): bbc.

          Default: ‘NULL’.

      -- C のメンバ変数: wchar_t *run_presite

          ‘package.module’ path to module that should be imported before
          ‘site.py’ is run.

          Set by the *note -X presite=package.module: 16f. command-line
          option and the *note PYTHON_PRESITE: 212f. environment
          variable.  The command-line option takes precedence.

          Needs a *note debug build of Python: 509. (the ‘Py_DEBUG’
          macro must be defined).

          Default: ‘NULL’.

      -- C のメンバ変数: int show_ref_count

          Show total reference count at exit (excluding *note immortal:
          290. objects)?

          Set to ‘1’ by *note -X showrefcount: 16f. command line option.

          Needs a *note debug build of Python: 509. (the ‘Py_REF_DEBUG’
          macro must be defined).

          Default: ‘0’.

      -- C のメンバ変数: int site_import

          Import the *note site: cc. module at startup?

          If equal to zero, disable the import of the module site and
          the site-dependent manipulations of *note sys.path: 3e4. that
          it entails.

          Also disable these manipulations if the *note site: cc. module
          is explicitly imported later (call *note site.main(): 2127. if
          you want them to be triggered).

          Set to ‘0’ by the *note -S: 13c0. command line option.

          *note sys.flags.no_site: 89c. is set to the inverted value of
          *note site_import: 405.

          Default: ‘1’.

      -- C のメンバ変数: int skip_source_first_line

          If non-zero, skip the first line of the *note
          PyConfig.run_filename: 551a. source.

          It allows the usage of non-Unix forms of ‘#!cmd’.  This is
          intended for a DOS specific hack only.

          Set to ‘1’ by the *note -x: 212b. command line option.

          Default: ‘0’.

      -- C のメンバ変数: wchar_t *stdio_encoding

      -- C のメンバ変数: wchar_t *stdio_errors

          Encoding and encoding errors of *note sys.stdin: 75f, *note
          sys.stdout: ccd. and *note sys.stderr: b33. (but *note
          sys.stderr: b33. always uses ‘"backslashreplace"’ error
          handler).

          Use the *note PYTHONIOENCODING: 120c. environment variable if
          it is non-empty.

          Default encoding:

             * ‘"UTF-8"’ if *note PyPreConfig.utf8_mode: 41d. is
               non-zero.

             * Otherwise, use the *note locale encoding: 54a.

          Default error handler:

             * On Windows: use ‘"surrogateescape"’.

             * ‘"surrogateescape"’ if *note PyPreConfig.utf8_mode: 41d.
               is non-zero, or if the LC_CTYPE locale is "C" or "POSIX".

             * ‘"strict"’ otherwise.

          See also *note PyConfig.legacy_windows_stdio: 41a.

      -- C のメンバ変数: int tracemalloc

          Enable tracemalloc?

          If non-zero, call *note tracemalloc.start(): 212c. at startup.

          Set by *note -X tracemalloc=N: 16f. command line option and by
          the *note PYTHONTRACEMALLOC: 212d. environment variable.

          Default: ‘-1’ in Python mode, ‘0’ in isolated mode.

      -- C のメンバ変数: int perf_profiling

          Enable the Linux ‘perf’ profiler support?

          If equals to ‘1’, enable support for the Linux ‘perf’
          profiler.

          If equals to ‘2’, enable support for the Linux ‘perf’ profiler
          with DWARF JIT support.

          Set to ‘1’ by *note -X perf: 16f. command-line option and the
          *note PYTHONPERFSUPPORT: 699. environment variable.

          Set to ‘2’ by the *note -X perf_jit: 16f. command-line option
          and the *note PYTHON_PERF_JIT_SUPPORT: 4af. environment
          variable.

          Default: ‘-1’.

          参考
          ....

          See *note Python support for the Linux perf profiler: 4ae. for
          more information.

          Added in version 3.12.

      -- C のメンバ変数: wchar_t *stdlib_dir

          Directory of the Python standard library.

          Default: ‘NULL’.

          Added in version 3.11.

      -- C のメンバ変数: int use_environment

          Use *note environment variables: 807.?

          If equals to zero, ignore the *note environment variables:
          807.

          Set to ‘0’ by the *note -E: b56. environment variable.

          Default: ‘1’ in Python config and ‘0’ in isolated config.

      -- C のメンバ変数: int use_system_logger

          If non-zero, ‘stdout’ and ‘stderr’ will be redirected to the
          system log.

          Only available on macOS 10.12 and later, and on iOS.

          Default: ‘0’ (don't use the system log) on macOS; ‘1’ on iOS
          (use the system log).

          Added in version 3.14.

      -- C のメンバ変数: int user_site_directory

          If non-zero, add the user site directory to *note sys.path:
          3e4.

          Set to ‘0’ by the *note -s: 15a6. and *note -I: b57. command
          line options.

          Set to ‘0’ by the *note PYTHONNOUSERSITE: 15a7. environment
          variable.

          Default: ‘1’ in Python mode, ‘0’ in isolated mode.

      -- C のメンバ変数: int verbose

          Verbose mode.  If greater than ‘0’, print a message each time
          a module is imported, showing the place (filename or built-in
          module) from which it is loaded.

          If greater than or equal to ‘2’, print a message for each file
          that is checked for when searching for a module.  Also
          provides information on module cleanup at exit.

          Incremented by the *note -v: 163e. command line option.

          Set by the *note PYTHONVERBOSE: 2128. environment variable
          value.

          Default: ‘0’.

      -- C のメンバ変数: *note PyWideStringList: ba5. warnoptions

          Options of the *note warnings: 118. module to build warnings
          filters, lowest to highest priority: *note sys.warnoptions:
          3f5.

          The *note warnings: 118. module adds *note sys.warnoptions:
          3f5. in the reverse order: the last *note
          PyConfig.warnoptions: 641. item becomes the first item of
          ‘warnings.filters’ which is checked first (highest priority).

          The *note -W: ac6. command line options adds its value to
          *note warnoptions: 641, it can be used multiple times.

          The *note PYTHONWARNINGS: da3. environment variable can also
          be used to add warning options.  Multiple options can be
          specified, separated by commas (‘,’).

          Default: empty list.

      -- C のメンバ変数: int write_bytecode

          If equal to ‘0’, Python won't try to write ‘.pyc’ files on the
          import of source modules.

          Set to ‘0’ by the *note -B: 15e6. command line option and the
          *note PYTHONDONTWRITEBYTECODE: 15e7. environment variable.

          *note sys.dont_write_bytecode: 48f1. is initialized to the
          inverted value of *note write_bytecode: 40d.

          Default: ‘1’.

      -- C のメンバ変数: *note PyWideStringList: ba5. xoptions

          Values of the *note -X: 16f. command line options: *note
          sys._xoptions: 2131.

          Default: empty list.

      -- C のメンバ変数: int _pystats

          If non-zero, write performance statistics at Python exit.

          Need a special build with the ‘Py_STATS’ macro: see *note
          -enable-pystats: 1b38.

          Default: ‘0’.

If *note parse_argv: 1cf1. is non-zero, *note argv: 3f1. arguments are
parsed the same way the regular Python parses *note command line
arguments: 1209, and Python arguments are stripped from *note argv: 3f1.

The *note xoptions: 642. options are parsed to set other options: see
the *note -X: 16f. command line option.

バージョン 3.9 で変更: The ‘show_alloc_count’ field has been removed.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0552/

   (2) https://peps.python.org/pep-0528/


File: python.info,  Node: Initialization with PyConfig,  Next: Isolated Configuration,  Prev: PyConfig,  Up: PyConfig C API

7.11.4.7 Initialization with PyConfig
.....................................

Initializing the interpreter from a populated configuration struct is
handled by calling *note Py_InitializeFromConfig(): 3f6.

The caller is responsible to handle exceptions (error or exit) using
*note PyStatus_Exception(): bb0. and *note Py_ExitStatusException():
bb9.

If *note PyImport_FrozenModules(): 3318, *note PyImport_AppendInittab():
1b1c. or *note PyImport_ExtendInittab(): 1b1d. are used, they must be
set or called after Python preinitialization and before the Python
initialization.  If Python is initialized multiple times, *note
PyImport_AppendInittab(): 1b1c. or *note PyImport_ExtendInittab(): 1b1d.
must be called before each Python initialization.

The current configuration (‘PyConfig’ type) is stored in
‘PyInterpreterState.config’.

Example setting the program name:

     void init_python(void)
     {
         PyStatus status;

         PyConfig config;
         PyConfig_InitPythonConfig(&config);

         /* Set the program name. Implicitly preinitialize Python. */
         status = PyConfig_SetString(&config, &config.program_name,
                                     L"/path/to/my_program");
         if (PyStatus_Exception(status)) {
             goto exception;
         }

         status = Py_InitializeFromConfig(&config);
         if (PyStatus_Exception(status)) {
             goto exception;
         }
         PyConfig_Clear(&config);
         return;

     exception:
         PyConfig_Clear(&config);
         Py_ExitStatusException(status);
     }

More complete example modifying the default configuration, read the
configuration, and then override some parameters.  Note that since 3.11,
many parameters are not calculated until initialization, and so values
cannot be read from the configuration structure.  Any values set before
initialize is called will be left unchanged by initialization:

     PyStatus init_python(const char *program_name)
     {
         PyStatus status;

         PyConfig config;
         PyConfig_InitPythonConfig(&config);

         /* Set the program name before reading the configuration
            (decode byte string from the locale encoding).

            Implicitly preinitialize Python. */
         status = PyConfig_SetBytesString(&config, &config.program_name,
                                          program_name);
         if (PyStatus_Exception(status)) {
             goto done;
         }

         /* Read all configuration at once */
         status = PyConfig_Read(&config);
         if (PyStatus_Exception(status)) {
             goto done;
         }

         /* Specify sys.path explicitly */
         /* If you want to modify the default set of paths, finish
            initialization first and then use PySys_GetObject("path") */
         config.module_search_paths_set = 1;
         status = PyWideStringList_Append(&config.module_search_paths,
                                          L"/path/to/stdlib");
         if (PyStatus_Exception(status)) {
             goto done;
         }
         status = PyWideStringList_Append(&config.module_search_paths,
                                          L"/path/to/more/modules");
         if (PyStatus_Exception(status)) {
             goto done;
         }

         /* Override executable computed by PyConfig_Read() */
         status = PyConfig_SetString(&config, &config.executable,
                                     L"/path/to/my_executable");
         if (PyStatus_Exception(status)) {
             goto done;
         }

         status = Py_InitializeFromConfig(&config);

     done:
         PyConfig_Clear(&config);
         return status;
     }


File: python.info,  Node: Isolated Configuration,  Next: Python Configuration,  Prev: Initialization with PyConfig,  Up: PyConfig C API

7.11.4.8 Isolated Configuration
...............................

*note PyPreConfig_InitIsolatedConfig(): bad. and *note
PyConfig_InitIsolatedConfig(): ba7. functions create a configuration to
isolate Python from the system.  For example, to embed Python into an
application.

This configuration ignores global configuration variables, environment
variables, command line arguments (*note PyConfig.argv: 3f1. is not
parsed) and user site directory.  The C standard streams (ex: ‘stdout’)
and the LC_CTYPE locale are left unchanged.  Signal handlers are not
installed.

Configuration files are still used with this configuration to determine
paths that are unspecified.  Ensure *note PyConfig.home: 3f3. is
specified to avoid computing the default path configuration.


File: python.info,  Node: Python Configuration,  Next: Python Path Configuration,  Prev: Isolated Configuration,  Up: PyConfig C API

7.11.4.9 Python Configuration
.............................

*note PyPreConfig_InitPythonConfig(): bae. and *note
PyConfig_InitPythonConfig(): ba8. functions create a configuration to
build a customized Python which behaves as the regular Python.

Environments variables and command line arguments are used to configure
Python, whereas global configuration variables are ignored.

This function enables C locale coercion ( PEP 538(1)) and *note Python
UTF-8 Mode: 866. ( PEP 540(2)) depending on the LC_CTYPE locale, *note
PYTHONUTF8: ccf. and *note PYTHONCOERCECLOCALE: ccc. environment
variables.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0538/

   (2) https://peps.python.org/pep-0540/


File: python.info,  Node: Python Path Configuration,  Prev: Python Configuration,  Up: PyConfig C API

7.11.4.10 Python Path Configuration
...................................

*note PyConfig: 3f7. contains multiple fields for the path
configuration:

   * Path configuration inputs:

        * *note PyConfig.home: 3f3.

        * *note PyConfig.platlibdir: 1d21.

        * *note PyConfig.pathconfig_warnings: 409.

        * *note PyConfig.program_name: 3f2.

        * *note PyConfig.pythonpath_env: 55a4.

        * current working directory: to get absolute paths

        * ‘PATH’ environment variable to get the program full path (from
          *note PyConfig.program_name: 3f2.)

        * ‘__PYVENV_LAUNCHER__’ environment variable

        * (Windows only) Application paths in the registry under
          "SoftwarePythonPythonCoreX.YPythonPath" of HKEY_CURRENT_USER
          and HKEY_LOCAL_MACHINE (where X.Y is the Python version).

   * Path configuration output fields:

        * *note PyConfig.base_exec_prefix: 5575.

        * *note PyConfig.base_executable: 5576.

        * *note PyConfig.base_prefix: 5577.

        * *note PyConfig.exec_prefix: 5582.

        * *note PyConfig.executable: 645.

        * *note PyConfig.module_search_paths_set: 805, *note
          PyConfig.module_search_paths: 643.

        * *note PyConfig.prefix: 5588.

If at least one "output field" is not set, Python calculates the path
configuration to fill unset fields.  If *note module_search_paths_set:
805. is equal to ‘0’, *note module_search_paths: 643. is overridden and
*note module_search_paths_set: 805. is set to ‘1’.

It is possible to completely ignore the function calculating the default
path configuration by setting explicitly all path configuration output
fields listed above.  A string is considered as set even if it is
non-empty.  ‘module_search_paths’ is considered as set if
‘module_search_paths_set’ is set to ‘1’.  In this case,
‘module_search_paths’ will be used without modification.

Set *note pathconfig_warnings: 409. to ‘0’ to suppress warnings when
calculating the path configuration (Unix only, Windows does not log any
warning).

If *note base_prefix: 5577. or *note base_exec_prefix: 5575. fields are
not set, they inherit their value from *note prefix: 5588. and *note
exec_prefix: 5582. respectively.

*note Py_RunMain(): bbc. and *note Py_Main(): e1e. modify *note
sys.path: 3e4.:

   * If *note run_filename: 551a. is set and is a directory which
     contains a ‘__main__.py’ script, prepend *note run_filename: 551a.
     to *note sys.path: 3e4.

   * If *note isolated: 416. is zero:

        * If *note run_module: 551b. is set, prepend the current
          directory to *note sys.path: 3e4.  Do nothing if the current
          directory cannot be read.

        * If *note run_filename: 551a. is set, prepend the directory of
          the filename to *note sys.path: 3e4.

        * Otherwise, prepend an empty string to *note sys.path: 3e4.

If *note site_import: 405. is non-zero, *note sys.path: 3e4. can be
modified by the *note site: cc. module.  If *note user_site_directory:
40f. is non-zero and the user's site-package directory exists, the *note
site: cc. module appends the user's site-package directory to *note
sys.path: 3e4.

The following configuration files are used by the path configuration:

   * ‘pyvenv.cfg’

   * ‘._pth’ file (ex: ‘python._pth’)

   * ‘pybuilddir.txt’ (Unix only)

If a ‘._pth’ file is present:

   * Set *note isolated: 416. to ‘1’.

   * Set *note use_environment: 40b. to ‘0’.

   * Set *note site_import: 405. to ‘0’.

   * Set *note safe_path: 977. to ‘1’.

If *note home: 3f3. is not set and a ‘pyvenv.cfg’ file is present in the
same directory as *note executable: 645, or its parent, *note prefix:
5588. and *note exec_prefix: 5582. are set that location.  When this
happens, *note base_prefix: 5577. and *note base_exec_prefix: 5575.
still keep their value, pointing to the base installation.  See *note
Virtual Environments: 48b3. for more information.

The ‘__PYVENV_LAUNCHER__’ environment variable is used to set *note
PyConfig.base_executable: 5576.

バージョン 3.14 で変更: *note prefix: 5588, and *note exec_prefix: 5582,
are now set to the ‘pyvenv.cfg’ directory.  This was previously done by
*note site: cc, therefore affected by *note -S: 13c0.


File: python.info,  Node: Py_GetArgcArgv,  Next: Delaying main module execution,  Prev: PyConfig C API,  Up: Python 初期化設定

7.11.5 Py_GetArgcArgv()
-----------------------

 -- C の関数: void Py_GetArgcArgv (int *argc, wchar_t ***argv)

     Get the original command line arguments, before Python modified
     them.

     See also *note PyConfig.orig_argv: a94. member.


File: python.info,  Node: Delaying main module execution,  Prev: Py_GetArgcArgv,  Up: Python 初期化設定

7.11.6 Delaying main module execution
-------------------------------------

In some embedding use cases, it may be desirable to separate interpreter
initialization from the execution of the main module.

This separation can be achieved by setting ‘PyConfig.run_command’ to the
empty string during initialization (to prevent the interpreter from
dropping into the interactive prompt), and then subsequently executing
the desired main module code using ‘__main__.__dict__’ as the global
namespace.


File: python.info,  Node: メモリ管理,  Next: オブジェクト実装サポート object implementation support,  Prev: Python 初期化設定,  Up: Python/C API リファレンスマニュアル

7.12 メモリ管理
===============

* Menu:

* 概要: 概要<4>.
* Allocator Domains::
* 生メモリインターフェース::
* メモリインターフェース::
* オブジェクトアロケータ::
* Default Memory Allocators::
* メモリアロケータをカスタマイズする::
* Debug hooks on the Python memory allocators::
* pymalloc アロケータ::
* The mimalloc allocator::
* tracemalloc C API::
* 使用例: 使用例<56>.


File: python.info,  Node: 概要<4>,  Next: Allocator Domains,  Up: メモリ管理

7.12.1 概要
-----------

Python におけるメモリ管理には、全ての Python オブジェクトとデータ構造が
入ったプライベートヒープ (private heap) が必須です。プライベートヒープの
管理は、内部的には 'Python メモリマネージャ (Python memory manager)' が
確実に行います。Python メモリマネージャには、共有 (sharing)、セグメント
分割 (segmentation)、事前割り当て (preallocation)、キャッシュ化
(caching) といった、様々な動的記憶管理の側面を扱うために、個別のコンポー
ネントがあります。

最低水準層では、素のメモリ操作関数 (raw memory allocator) がオペレーティ
ングシステムのメモリ管理機構とやりとりして、プライベートヒープ内にPython
関連の全てのデータを記憶するのに十分な空きがあるかどうか確認します。素の
メモリ操作関数の上には、いくつかのオブジェクト固有のメモリ操作関数があり
ます。これらは同じヒープを操作し、各オブジェクト型固有の事情に合ったメモ
リ管理ポリシを実装しています。例えば、整数オブジェクトは文字列やタプル、
辞書とは違ったやり方でヒープ内で管理されます。というのも、整数には値を記
憶する上で特別な要件があり、速度/容量のトレードオフが存在するからです。
このように、Python メモリマネジャは作業のいくつかをオブジェクト固有のメ
モリ操作関数に委譲しますが、これらの関数がプライベートヒープからはみ出し
てメモリ管理を行わないようにしています。

重要なのは、たとえユーザがいつもヒープ内のメモリブロックを指すようなオブ
ジェクトポインタを操作しているとしても、Python 用ヒープの管理はインタプ
リタ自体が行うもので、ユーザがそれを制御する余地はないと理解することです
。Python オブジェクトや内部使用されるバッファを入れるためのヒープ空間の
メモリ確保は、必要に応じて、Python メモリマネージャがこのドキュメント内
で列挙しているPython/C API 関数群を介して行います。

メモリ管理の崩壊を避けるため、拡張モジュールの作者は決して Python オブジ
ェクトを C ライブラリが公開している関数: ‘malloc()’ 、 ‘calloc()’ 、
‘realloc()’ および ‘free()’ で操作しようとしてはなりません。こうした関数
を使うと、C のメモリ操作関数と Python メモリマネージャとの間で関数呼び出
しが交錯します。 C のメモリ操作関数とPython メモリマネージャは異なるアル
ゴリズムで実装されていて、異なるヒープを操作するため、呼び出しの交錯は致
命的な結果を招きます。とはいえ、個別の目的のためなら、 C ライブラリのメ
モリ操作関数を使って安全にメモリを確保したり解放したりできます。例えば、
以下がそのような例です:

     PyObject *res;
     char *buf = (char *) malloc(BUFSIZ); /* for I/O */

     if (buf == NULL)
         return PyErr_NoMemory();
     ...Do some I/O operation involving buf...
     res = PyBytes_FromString(buf);
     free(buf); /* malloc'ed */
     return res;

この例では、I/O バッファに対するメモリ要求は C ライブラリのメモリ操作関
数を使っています。Python メモリマネージャーは戻り値として返される bytes
オブジェクトを確保する時にだけ必要です。

とはいえ、ほとんどの状況では、メモリの操作は Python ヒープに固定して行う
よう勧めます。なぜなら、Python ヒープは Python メモリマネジャの管理下に
あるからです。例えば、インタプリタを C で書かれた新たなオブジェクト型で
拡張する際には、ヒープでのメモリ管理が必要です。Python ヒープを使った方
がよいもう一つの理由として、拡張モジュールが必要としているメモリについて
Python メモリマネージャに '情報を提供' してほしいということがあります。
たとえ必要なメモリが内部的かつ非常に特化した用途に対して排他的に用いられ
るものだとしても、全てのメモリ操作要求を Python メモリマネージャに委譲す
れば、インタプリタはより正確なメモリフットプリントの全体像を把握できます
。その結果、特定の状況では、Python メモリマネージャがガベージコレクショ
ンやメモリのコンパクト化、その他何らかの予防措置といった、適切な動作をト
リガできることがあります。上の例で示したように C ライブラリのメモリ操作
関数を使うと、I/O バッファ用に確保したメモリは Python メモリマネージャの
管理から完全に外れることに注意してください。

参考
....

環境変数 *note PYTHONMALLOC: e5e. を使用して Python が利用するメモリアロ
ケータを制御することができます。

環境変数 *note PYTHONMALLOCSTATS: 1f37. を使用して、新たなオブジェクトア
リーナが生成される時と、シャットダウン時に *note pymalloc
メモリアロケータ: f0b. の統計情報を表示できます。


File: python.info,  Node: Allocator Domains,  Next: 生メモリインターフェース,  Prev: 概要<4>,  Up: メモリ管理

7.12.2 Allocator Domains
------------------------

All allocating functions belong to one of three different "domains" (see
also *note PyMemAllocatorDomain: 55b2.).  These domains represent
different allocation strategies and are optimized for different
purposes.  The specific details on how every domain allocates memory or
what internal functions each domain calls is considered an
implementation detail, but for debugging purposes a simplified table can
be found at *note Default Memory Allocators: 213b.  The APIs used to
allocate and free a block of memory must be from the same domain.  For
example, *note PyMem_Free(): 165b. must be used to free memory allocated
using *note PyMem_Malloc(): e5f.

The three allocation domains are:

   * Raw domain: intended for allocating memory for general-purpose
     memory buffers where the allocation 'must' go to the system
     allocator or where the allocator can operate without an *note
     attached thread state: 4ed1.  The memory is requested directly from
     the system.  See *note Raw Memory Interface: 55b3.

   * "Mem" domain: intended for allocating memory for Python buffers and
     general-purpose memory buffers where the allocation must be
     performed with an *note attached thread state: 4ed1.  The memory is
     taken from the Python private heap.  See *note Memory Interface:
     55b4.

   * Object domain: intended for allocating memory for Python objects.
     The memory is taken from the Python private heap.  See *note Object
     allocators: 55b5.

     注釈: The *note free-threaded: 1f4. build requires that only Python
     objects are allocated using the "object" domain and that all Python
     objects are allocated using that domain.  This differs from the
     prior Python versions, where this was only a best practice and not
     a hard requirement.

     For example, buffers (non-Python objects) should be allocated using
     *note PyMem_Malloc(): e5f, *note PyMem_RawMalloc(): 631, or
     ‘malloc()’, but not *note PyObject_Malloc(): e62.

     See *note Memory Allocation APIs: 55b6.


File: python.info,  Node: 生メモリインターフェース,  Next: メモリインターフェース,  Prev: Allocator Domains,  Up: メモリ管理

7.12.3 生メモリインターフェース
-------------------------------

The following function sets are wrappers to the system allocator.  These
functions are thread-safe, so a *note thread state: 1846. does not need
to be *note attached: 4ed1.

The *note default raw memory allocator: 213b. uses the following
functions: ‘malloc()’, ‘calloc()’, ‘realloc()’ and ‘free()’; call
‘malloc(1)’ (or ‘calloc(1, 1)’) when requesting zero bytes.

Added in version 3.4.

 -- C の関数: void *PyMem_RawMalloc (size_t n)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     'n' バイトを割り当て、そのメモリを指す void* 型のポインタを返します
     。要求が失敗した場合 ‘NULL’ を返します。

     0バイトを要求すると、 ‘PyMem_RawMalloc(1)’ が呼ばれたときと同じよう
     に、可能なら ‘NULL’ でないユニークなポインタを返します。確保された
     メモリーにはいかなる初期化も行われません。

 -- C の関数: void *PyMem_RawCalloc (size_t nelem, size_t elsize)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'  各
     要素が 'elsize' バイトの要素 'nelem' 個分のメモリーを確保し、そのメ
     モリーを指す void* 型のポインタを返します。アロケートに失敗した場合
     は ‘NULL’ を返します。確保されたメモリー領域はゼロで初期化されます
     。

     要素数か要素のサイズが0バイトの要求に対しては、可能なら
     ‘PyMem_RawCalloc(1, 1)’ が呼ばれたのと同じように、ユニークな ‘NULL’
     でないポインタを返します。

     Added in version 3.5.

 -- C の関数: void *PyMem_RawRealloc (void *p, size_t n)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     'p' が指すメモリブロックを 'n' バイトにリサイズします。古いサイズと
     新しいサイズの小さい方までの内容は変更されません。

     'p' が ‘NULL’ の場合呼び出しは ‘PyMem_RawMalloc(n)’ と等価です。そ
     うでなく、 'n' がゼロに等しい場合、メモリブロックはリサイズされます
     が解放されません。返されたポインタは非 ‘NULL’ です。

     'p' が ‘NULL’ でない限り、'p' はそれより前の *note
     PyMem_RawMalloc(): 631, *note PyMem_RawRealloc(): 633, *note
     PyMem_RawCalloc(): 632. の呼び出しにより返されなければなりません。

     要求が失敗した場合 *note PyMem_RawRealloc(): 633. は ‘NULL’ を返し
     、 'p' は前のメモリエリアをさす有効なポインタのままです。

 -- C の関数: void PyMem_RawFree (void *p)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     'p' が指すメモリブロックを解放します。 'p' は以前呼び出した *note
     PyMem_RawMalloc(): 631, *note PyMem_RawRealloc(): 633, *note
     PyMem_RawCalloc(): 632. の返した値でなければなりません。それ以外の
     場合や ‘PyMem_RawFree(p)’ を呼び出した後だった場合、未定義の動作に
     なります。

     'p' が ‘NULL’ の場合何もしません。


File: python.info,  Node: メモリインターフェース,  Next: オブジェクトアロケータ,  Prev: 生メモリインターフェース,  Up: メモリ管理

7.12.4 メモリインターフェース
-----------------------------

以下の関数群が利用して Python ヒープに対してメモリを確保したり解放したり
出来ます。これらの関数は ANSI C 標準に従ってモデル化されていますが、0 バ
イトを要求した際の動作についても定義しています:

The *note default memory allocator: 213b. uses the *note pymalloc memory
allocator: f0b.

     警告: There must be an *note attached thread state: 4ed1. when
     using these functions.

バージョン 3.6 で変更: デフォルトのアロケータがシステムの ‘malloc()’ か
ら pymalloc になりました。

 -- C の関数: void *PyMem_Malloc (size_t n)
     ' 次に属します: *note Stable ABI: 775.'  'n' バイトを割り当て、その
     メモリを指す void* 型のポインタを返します。要求が失敗した場合
     ‘NULL’ を返します。

     0バイトを要求すると、 ‘PyMem_Malloc(1)’ が呼ばれたときと同じように
     、可能なら ‘NULL’ でないユニークなポインタを返します。 確保されたメ
     モリーにはいかなる初期化も行われません。

 -- C の関数: void *PyMem_Calloc (size_t nelem, size_t elsize)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'  各
     要素が 'elsize' バイトの要素 'nelem' 個分のメモリーを確保し、そのメ
     モリーを指す void* 型のポインタを返します。アロケートに失敗した場合
     は ‘NULL’ を返します。確保されたメモリー領域はゼロで初期化されます
     。

     要素数か要素のサイズが0バイトの要求に対しては、可能なら
     ‘PyMem_Calloc(1, 1)’ が呼ばれたのと同じように、ユニークな ‘NULL’ で
     ないポインタを返します。

     Added in version 3.5.

 -- C の関数: void *PyMem_Realloc (void *p, size_t n)
     ' 次に属します: *note Stable ABI: 775.'  'p' が指すメモリブロックを
     'n' バイトにリサイズします。古いサイズと新しいサイズの小さい方まで
     の内容は変更されません。

     'p' が ‘NULL’ の場合呼び出しは ‘PyMem_Malloc(n)’ と等価です。そうで
     なく、 'n' がゼロに等しい場合、メモリブロックはリサイズされますが解
     放されません。返されたポインタは非 ‘NULL’ です。

     'p' が ‘NULL’ でない限り、'p' はそれより前の *note PyMem_Malloc():
     e5f, *note PyMem_Realloc(): 1233. または *note PyMem_Calloc():
     10ad. の呼び出しにより返されなければなりません。

     要求が失敗した場合 *note PyMem_Realloc(): 1233. は ‘NULL’ を返し、
     'p' は前のメモリエリアをさす有効なポインタのままです。

 -- C の関数: void PyMem_Free (void *p)
     ' 次に属します: *note Stable ABI: 775.'  'p' が指すメモリブロックを
     解放します。 'p' は以前呼び出した *note PyMem_Malloc(): e5f.、
     *note PyMem_Realloc(): 1233.、または *note PyMem_Calloc(): 10ad. の
     返した値でなければなりません。それ以外の場合や ‘PyMem_Free(p)’ を呼
     び出した後だった場合、未定義の動作になります。

     'p' が ‘NULL’ の場合何もしません。

以下に挙げる型対象のマクロは利便性のために提供されているものです。'TYPE'
は任意の C の型を表します。

 -- C のマクロ: PyMem_New (TYPE, n)

     Same as *note PyMem_Malloc(): e5f, but allocates ‘(n *
     sizeof(TYPE))’ bytes of memory.  Returns a pointer cast to ‘TYPE*’.
     The memory will not have been initialized in any way.

 -- C のマクロ: PyMem_Resize (p, TYPE, n)

     Same as *note PyMem_Realloc(): 1233, but the memory block is
     resized to ‘(n * sizeof(TYPE))’ bytes.  Returns a pointer cast to
     ‘TYPE*’.  On return, 'p' will be a pointer to the new memory area,
     or ‘NULL’ in the event of failure.

     これは C プリプロセッサマクロです。'p' は常に再代入されます。エラー
     処理時にメモリを失うのを避けるには 'p' の元の値を保存してください。

 -- C の関数: void PyMem_Del (void *p)

     *note PyMem_Free(): 165b. と同じです。

* Menu:

* 非推奨のエイリアス: 非推奨のエイリアス<2>.


File: python.info,  Node: 非推奨のエイリアス<2>,  Up: メモリインターフェース

7.12.4.1 非推奨のエイリアス
...........................

These are *note soft deprecated: 23d. aliases to existing functions and
macros.  They exist solely for backwards compatibility.

非推奨のエイリアス                                     Corresponding function or macro
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
 -- C のマクロ: PyMem_MALLOC (size)                    *note PyMem_Malloc(): e5f.
                                                       
                                                       
 -- C のマクロ: PyMem_NEW (type, size)                 *note PyMem_New: 173d.
                                                       
                                                       
 -- C のマクロ: PyMem_REALLOC (ptr, size)              *note PyMem_Realloc(): 1233.
                                                       
                                                       
 -- C のマクロ: PyMem_RESIZE (ptr, type, size)         *note PyMem_Resize: 55b9.
                                                       
                                                       
 -- C のマクロ: PyMem_FREE (ptr)                       *note PyMem_Free(): 165b.
                                                       
                                                       
 -- C のマクロ: PyMem_DEL (ptr)                        *note PyMem_Free(): 165b.
                                                       

バージョン 3.4 で変更: The macros are now aliases of the corresponding
functions and macros.  Previously, their behavior was the same, but
their use did not necessarily preserve binary compatibility across
Python versions.

バージョン 2.0 で非推奨.


File: python.info,  Node: オブジェクトアロケータ,  Next: Default Memory Allocators,  Prev: メモリインターフェース,  Up: メモリ管理

7.12.5 オブジェクトアロケータ
-----------------------------

以下の関数群が利用して Python ヒープに対してメモリを確保したり解放したり
出来ます。これらの関数は ANSI C 標準に従ってモデル化されていますが、0 バ
イトを要求した際の動作についても定義しています:

     注釈: There is no guarantee that the memory returned by these
     allocators can be successfully cast to a Python object when
     intercepting the allocating functions in this domain by the methods
     described in the *note Customize Memory Allocators: 55c2. section.

The *note default object allocator: 213b. uses the *note pymalloc memory
allocator: f0b.

     警告: There must be an *note attached thread state: 4ed1. when
     using these functions.

 -- C の関数: void *PyObject_Malloc (size_t n)
     ' 次に属します: *note Stable ABI: 775.'  'n' バイトを割り当て、その
     メモリを指す void* 型のポインタを返します。要求が失敗した場合
     ‘NULL’ を返します。

     0バイトを要求すると、 ‘PyObject_Malloc(1)’ が呼ばれたときと同じよう
     に、可能なら ‘NULL’ でないユニークなポインタを返します。 確保された
     メモリーにはいかなる初期化も行われません。

 -- C の関数: void *PyObject_Calloc (size_t nelem, size_t elsize)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'  各
     要素が 'elsize' バイトの要素 'nelem' 個分のメモリーを確保し、そのメ
     モリーを指す void* 型のポインタを返します。アロケートに失敗した場合
     は ‘NULL’ を返します。確保されたメモリー領域はゼロで初期化されます
     。

     要素数か要素のサイズが0バイトの要求に対しては、可能なら
     ‘PyObject_Calloc(1, 1)’ が呼ばれたのと同じように、ユニークな ‘NULL’
     でないポインタを返します。

     Added in version 3.5.

 -- C の関数: void *PyObject_Realloc (void *p, size_t n)
     ' 次に属します: *note Stable ABI: 775.'  'p' が指すメモリブロックを
     'n' バイトにリサイズします。古いサイズと新しいサイズの小さい方まで
     の内容は変更されません。

     'p' が ‘NULL’ の場合呼び出しは ‘PyObject_Malloc(n)’ と等価です。そ
     うでなく、 'n' がゼロに等しい場合、メモリブロックはリサイズされます
     が解放されません。返されたポインタは非 ‘NULL’ です。

     'p' が ‘NULL’ でない限り、'p' はそれより前の *note
     PyObject_Malloc(): e62, *note PyObject_Realloc(): 165c. または
     *note PyObject_Calloc(): 10ae. の呼び出しにより返されなければなりま
     せん。

     要求が失敗した場合 *note PyObject_Realloc(): 165c. は ‘NULL’ を返し
     、 'p' は前のメモリエリアをさす有効なポインタのままです。

 -- C の関数: void PyObject_Free (void *p)
     ' 次に属します: *note Stable ABI: 775.'  'p' が指すメモリブロックを
     解放します。 'p' は以前呼び出した *note PyObject_Malloc(): e62.、
     *note PyObject_Realloc(): 165c.、または *note PyObject_Calloc():
     10ae. の返した値でなければなりません。それ以外の場合や
     ‘PyObject_Free(p)’ を呼び出した後だった場合、未定義の動作になります
     。

     'p' が ‘NULL’ の場合何もしません。

     Do not call this directly to free an object's memory; call the
     type's *note tp_free: 4ecf. slot instead.

     Do not use this for memory allocated by *note PyObject_GC_New: c99.
     or *note PyObject_GC_NewVar: c9a.; use *note PyObject_GC_Del():
     171c. instead.

     参考
     ....

        * *note PyObject_GC_Del(): 171c. is the equivalent of this
          function for memory allocated by types that support garbage
          collection.

        * *note PyObject_Malloc(): e62.

        * *note PyObject_Realloc(): 165c.

        * *note PyObject_Calloc(): 10ae.

        * *note PyObject_New: b7c.

        * *note PyObject_NewVar: b7d.

        * *note PyType_GenericAlloc(): c61.

        * *note tp_free: 4ecf.


File: python.info,  Node: Default Memory Allocators,  Next: メモリアロケータをカスタマイズする,  Prev: オブジェクトアロケータ,  Up: メモリ管理

7.12.6 Default Memory Allocators
--------------------------------

Default memory allocators:

Configuration                       名前                     PyMem_RawMalloc        PyMem_Malloc              PyObject_Malloc
                                                                                                              
---------------------------------------------------------------------------------------------------------------------------------------
                                                                                                              
リリースビルド                      ‘"pymalloc"’             ‘malloc’               ‘pymalloc’                ‘pymalloc’
                                                                                                              
                                                                                                              
デバッグビルド                      ‘"pymalloc_debug"’       ‘malloc’ + debug       ‘pymalloc’ + debug        ‘pymalloc’ + debug
                                                                                                              
                                                                                                              
pymalloc 無しのリリースビルド       ‘"malloc"’               ‘malloc’               ‘malloc’                  ‘malloc’
                                                                                                              
                                                                                                              
pymalloc 無しのデバッグビルド       ‘"malloc_debug"’         ‘malloc’ + debug       ‘malloc’ + debug          ‘malloc’ + debug
                                                                                                              

説明:

   * Name: value for *note PYTHONMALLOC: e5e. environment variable.

   * ‘malloc’: system allocators from the standard C library, C
     functions: ‘malloc()’, ‘calloc()’, ‘realloc()’ and ‘free()’.

   * ‘pymalloc’: *note pymalloc memory allocator: f0b.

   * ‘mimalloc’: *note mimalloc memory allocator: 213d.  The pymalloc
     allocator will be used if mimalloc support isn't available.

   * "+ debug": with *note debug hooks on the Python memory allocators:
     213e.

   * "Debug build": *note Python build in debug mode: 509.


File: python.info,  Node: メモリアロケータをカスタマイズする,  Next: Debug hooks on the Python memory allocators,  Prev: Default Memory Allocators,  Up: メモリ管理

7.12.7 メモリアロケータをカスタマイズする
-----------------------------------------

Added in version 3.4.

 -- C のデータ型: type PyMemAllocatorEx

     Structure used to describe a memory block allocator.  The structure
     has the following fields:

     フィールド                                                     意味
                                                                    
     -----------------------------------------------------------------------------------------------------------
                                                                    
     ‘void *ctx’                                                    第一引数として渡されるユーザコンテキスト
                                                                    
                                                                    
     ‘void* malloc(void *ctx, size_t size)’                         メモリブロックを割り当てます
                                                                    
                                                                    
     ‘void* calloc(void *ctx, size_t nelem, size_t elsize)’         0で初期化されたメモリブロックを割り当てま
                                                                    す
                                                                    
                                                                    
     ‘void* realloc(void *ctx, void *ptr, size_t new_size)’         メモリブロックを割り当てるかリサイズしま
                                                                    す
                                                                    
                                                                    
     ‘void free(void *ctx, void *ptr)’                              メモリブロックを解放する
                                                                    

     バージョン 3.5 で変更: The ‘PyMemAllocator’ structure was renamed
     to *note PyMemAllocatorEx: 10ce. and a new ‘calloc’ field was
     added.

 -- C のデータ型: type PyMemAllocatorDomain

     アロケータドメインを同定するための列挙型です。ドメインは:

      -- C のマクロ: PYMEM_DOMAIN_RAW

          関数:

             * *note PyMem_RawMalloc(): 631.

             * *note PyMem_RawRealloc(): 633.

             * *note PyMem_RawCalloc(): 632.

             * *note PyMem_RawFree(): 634.

      -- C のマクロ: PYMEM_DOMAIN_MEM

          関数:

             * *note PyMem_Malloc(): e5f,

             * *note PyMem_Realloc(): 1233.

             * *note PyMem_Calloc(): 10ad.

             * *note PyMem_Free(): 165b.

      -- C のマクロ: PYMEM_DOMAIN_OBJ

          関数:

             * *note PyObject_Malloc(): e62.

             * *note PyObject_Realloc(): 165c.

             * *note PyObject_Calloc(): 10ae.

             * *note PyObject_Free(): e60.

 -- C の関数: void PyMem_GetAllocator (PyMemAllocatorDomain domain,
          PyMemAllocatorEx *allocator)

     指定されたドメインのメモリブロックアロケータを取得します。

 -- C の関数: void PyMem_SetAllocator (PyMemAllocatorDomain domain,
          PyMemAllocatorEx *allocator)

     指定されたドメインのメモリブロックアロケータを設定します。

     新しいアロケータは、0バイトを要求されたときユニークな ‘NULL’ でない
     ポインタを返さなければなりません。

     For the *note PYMEM_DOMAIN_RAW: 213c. domain, the allocator must be
     thread-safe: a *note thread state: 1846. is not *note attached:
     4ed1. when the allocator is called.

     For the remaining domains, the allocator must also be thread-safe:
     the allocator may be called in different interpreters that do not
     share a *note GIL: 164.

     新しいアロケータがフックでない (1つ前のアロケータを呼び出さない) 場
     合、 *note PyMem_SetupDebugHooks(): e64. 関数を呼び出して、新しいア
     ロケータの上にデバッグフックを再度設置しなければなりません。

     See also *note PyPreConfig.allocator: 5574. and *note Preinitialize
     Python with PyPreConfig: 42c8.

          警告: *note PyMem_SetAllocator(): 7a8. does have the following
          contract:

             * It can be called after *note Py_PreInitialize(): 41e. and
               before *note Py_InitializeFromConfig(): 3f6. to install a
               custom memory allocator.  There are no restrictions over
               the installed allocator other than the ones imposed by
               the domain (for instance, the Raw Domain allows the
               allocator to be called without an *note attached thread
               state: 4ed1.).  See *note the section on allocator
               domains: 55b1. for more information.

             * If called after Python has finish initializing (after
               *note Py_InitializeFromConfig(): 3f6. has been called)
               the allocator 'must' wrap the existing allocator.
               Substituting the current allocator for some other
               arbitrary one is 'not supported'.

     バージョン 3.12 で変更: All allocators must be thread-safe.

 -- C の関数: void PyMem_SetupDebugHooks (void)

     Setup *note debug hooks in the Python memory allocators: 213e. to
     detect memory errors.


File: python.info,  Node: Debug hooks on the Python memory allocators,  Next: pymalloc アロケータ,  Prev: メモリアロケータをカスタマイズする,  Up: メモリ管理

7.12.8 Debug hooks on the Python memory allocators
--------------------------------------------------

When *note Python is built in debug mode: 509, the *note
PyMem_SetupDebugHooks(): e64. function is called at the *note Python
preinitialization: 42c8. to setup debug hooks on Python memory
allocators to detect memory errors.

The *note PYTHONMALLOC: e5e. environment variable can be used to install
debug hooks on a Python compiled in release mode (ex:
‘PYTHONMALLOC=debug’).

The *note PyMem_SetupDebugHooks(): e64. function can be used to set
debug hooks after calling *note PyMem_SetAllocator(): 7a8.

These debug hooks fill dynamically allocated memory blocks with special,
recognizable bit patterns.  Newly allocated memory is filled with the
byte ‘0xCD’ (‘PYMEM_CLEANBYTE’), freed memory is filled with the byte
‘0xDD’ (‘PYMEM_DEADBYTE’).  Memory blocks are surrounded by "forbidden
bytes" filled with the byte ‘0xFD’ (‘PYMEM_FORBIDDENBYTE’).  Strings of
these bytes are unlikely to be valid addresses, floats, or ASCII
strings.

実行時チェック:

   - Detect API violations.  For example, detect if *note
     PyObject_Free(): e60. is called on a memory block allocated by
     *note PyMem_Malloc(): e5f.

   - Detect write before the start of the buffer (buffer underflow).

   - Detect write after the end of the buffer (buffer overflow).

   - Check that there is an *note attached thread state: 4ed1. when
     allocator functions of *note PYMEM_DOMAIN_OBJ: e61. (ex: *note
     PyObject_Malloc(): e62.) and *note PYMEM_DOMAIN_MEM: e63. (ex:
     *note PyMem_Malloc(): e5f.) domains are called.

On error, the debug hooks use the *note tracemalloc: 105. module to get
the traceback where a memory block was allocated.  The traceback is only
displayed if *note tracemalloc: 105. is tracing Python memory
allocations and the memory block was traced.

Let 'S' = ‘sizeof(size_t)’.  ‘2*S’ bytes are added at each end of each
block of 'N' bytes requested.  The memory layout is like so, where p
represents the address returned by a malloc-like or realloc-like
function (‘p[i:j]’ means the slice of bytes from ‘*(p+i)’ inclusive up
to ‘*(p+j)’ exclusive; note that the treatment of negative indices
differs from a Python slice):

‘p[-2*S:-S]’

     Number of bytes originally asked for.  This is a size_t, big-endian
     (easier to read in a memory dump).

‘p[-S]’

     API identifier (ASCII character):

        * ‘'r'’ for *note PYMEM_DOMAIN_RAW: 213c.

        * ‘'m'’ for *note PYMEM_DOMAIN_MEM: e63.

        * ‘'o'’ for *note PYMEM_DOMAIN_OBJ: e61.

‘p[-S+1:0]’

     Copies of PYMEM_FORBIDDENBYTE. Used to catch under- writes and
     reads.

‘p[0:N]’

     The requested memory, filled with copies of PYMEM_CLEANBYTE, used
     to catch reference to uninitialized memory.  When a realloc-like
     function is called requesting a larger memory block, the new excess
     bytes are also filled with PYMEM_CLEANBYTE. When a free-like
     function is called, these are overwritten with PYMEM_DEADBYTE, to
     catch reference to freed memory.  When a realloc- like function is
     called requesting a smaller memory block, the excess old bytes are
     also filled with PYMEM_DEADBYTE.

‘p[N:N+S]’

     Copies of PYMEM_FORBIDDENBYTE. Used to catch over- writes and
     reads.

‘p[N+S:N+2*S]’

     Only used if the ‘PYMEM_DEBUG_SERIALNO’ macro is defined (not
     defined by default).

     A serial number, incremented by 1 on each call to a malloc-like or
     realloc-like function.  Big-endian ‘size_t’.  If "bad memory" is
     detected later, the serial number gives an excellent way to set a
     breakpoint on the next run, to capture the instant at which this
     block was passed out.  The static function bumpserialno() in
     obmalloc.c is the only place the serial number is incremented, and
     exists so you can set such a breakpoint easily.

A realloc-like or free-like function first checks that the
PYMEM_FORBIDDENBYTE bytes at each end are intact.  If they've been
altered, diagnostic output is written to stderr, and the program is
aborted via Py_FatalError().  The other main failure mode is provoking a
memory error when a program reads up one of the special bit patterns and
tries to use it as an address.  If you get in a debugger then and look
at the object, you're likely to see that it's entirely filled with
PYMEM_DEADBYTE (meaning freed memory is getting used) or PYMEM_CLEANBYTE
(meaning uninitialized memory is getting used).

バージョン 3.6 で変更: The *note PyMem_SetupDebugHooks(): e64. function
now also works on Python compiled in release mode.  On error, the debug
hooks now use *note tracemalloc: 105. to get the traceback where a
memory block was allocated.  The debug hooks now also check if there is
an *note attached thread state: 4ed1. when functions of *note
PYMEM_DOMAIN_OBJ: e61. and *note PYMEM_DOMAIN_MEM: e63. domains are
called.

バージョン 3.8 で変更: Byte patterns ‘0xCB’ (‘PYMEM_CLEANBYTE’), ‘0xDB’
(‘PYMEM_DEADBYTE’) and ‘0xFB’ (‘PYMEM_FORBIDDENBYTE’) have been replaced
with ‘0xCD’, ‘0xDD’ and ‘0xFD’ to use the same values than Windows CRT
debug ‘malloc()’ and ‘free()’.


File: python.info,  Node: pymalloc アロケータ,  Next: The mimalloc allocator,  Prev: Debug hooks on the Python memory allocators,  Up: メモリ管理

7.12.9 pymalloc アロケータ
--------------------------

Python has a 'pymalloc' allocator optimized for small objects (smaller
or equal to 512 bytes) with a short lifetime.  It uses memory mappings
called "arenas" with a fixed size of either 256 KiB on 32-bit platforms
or 1 MiB on 64-bit platforms.  It falls back to *note PyMem_RawMalloc():
631. and *note PyMem_RawRealloc(): 633. for allocations larger than 512
bytes.

'pymalloc' is the *note default allocator: 213b. of the *note
PYMEM_DOMAIN_MEM: e63. (ex: *note PyMem_Malloc(): e5f.) and *note
PYMEM_DOMAIN_OBJ: e61. (ex: *note PyObject_Malloc(): e62.) domains.

アリーナアロケータは、次の関数を使います:

   * ‘VirtualAlloc()’ and ‘VirtualFree()’ on Windows,

   * ‘mmap()’ and ‘munmap()’ if available,

   * それ以外の場合は ‘malloc()’ と ‘free()’。

This allocator is disabled if Python is configured with the *note
-without-pymalloc: 21a1. option.  It can also be disabled at runtime
using the *note PYTHONMALLOC: e5e. environment variable (ex:
‘PYTHONMALLOC=malloc’).

Typically, it makes sense to disable the pymalloc allocator when
building Python with AddressSanitizer (*note -with-address-sanitizer:
21aa.) which helps uncover low level bugs within the C code.

* Menu:

* pymalloc アリーナアロケータのカスタマイズ::


File: python.info,  Node: pymalloc アリーナアロケータのカスタマイズ,  Up: pymalloc アロケータ

7.12.9.1 pymalloc アリーナアロケータのカスタマイズ
..................................................

Added in version 3.4.

 -- C のデータ型: type PyObjectArenaAllocator

     アリーナアロケータを記述するための構造体です。3つのフィールドを持ち
     ます:

     フィールド                                             意味
                                                            
     ---------------------------------------------------------------------------------------------------
                                                            
     ‘void *ctx’                                            第一引数として渡されるユーザコンテキスト
                                                            
                                                            
     ‘void* alloc(void *ctx, size_t size)’                  size バイトのアリーナを割り当てます
                                                            
                                                            
     ‘void free(void *ctx, void *ptr, size_t size)’         アリーナを解放します
                                                            

 -- C の関数: void PyObject_GetArenaAllocator (PyObjectArenaAllocator
          *allocator)

     アリーナアロケータを取得します。

 -- C の関数: void PyObject_SetArenaAllocator (PyObjectArenaAllocator
          *allocator)

     アリーナアロケータを設定します。


File: python.info,  Node: The mimalloc allocator,  Next: tracemalloc C API,  Prev: pymalloc アロケータ,  Up: メモリ管理

7.12.10 The mimalloc allocator
------------------------------

Added in version 3.13.

Python supports the mimalloc allocator when the underlying platform
support is available.  mimalloc "is a general purpose allocator with
excellent performance characteristics.  Initially developed by Daan
Leijen for the runtime systems of the Koka and Lean languages."


File: python.info,  Node: tracemalloc C API,  Next: 使用例<56>,  Prev: The mimalloc allocator,  Up: メモリ管理

7.12.11 tracemalloc C API
-------------------------

Added in version 3.7.

 -- C の関数: int PyTraceMalloc_Track (unsigned int domain, uintptr_t
          ptr, size_t size)

     Track an allocated memory block in the *note tracemalloc: 105.
     module.

     Return ‘0’ on success, return ‘-1’ on error (failed to allocate
     memory to store the trace).  Return ‘-2’ if tracemalloc is
     disabled.

     If memory block is already tracked, update the existing trace.

 -- C の関数: int PyTraceMalloc_Untrack (unsigned int domain, uintptr_t
          ptr)

     Untrack an allocated memory block in the *note tracemalloc: 105.
     module.  Do nothing if the block was not tracked.

     Return ‘-2’ if tracemalloc is disabled, otherwise return ‘0’.


File: python.info,  Node: 使用例<56>,  Prev: tracemalloc C API,  Up: メモリ管理

7.12.12 使用例
--------------

最初に述べた関数セットを使って、 *note 概要: 55ae. 節の例を Python ヒー
プに I/O バッファをメモリ確保するように書き換えたものを以下に示します:

     PyObject *res;
     char *buf = (char *) PyMem_Malloc(BUFSIZ); /* for I/O */

     if (buf == NULL)
         return PyErr_NoMemory();
     /* ...Do some I/O operation involving buf... */
     res = PyBytes_FromString(buf);
     PyMem_Free(buf); /* allocated with PyMem_Malloc */
     return res;

同じコードを型対象の関数セットで書いたものを以下に示します:

     PyObject *res;
     char *buf = PyMem_New(char, BUFSIZ); /* for I/O */

     if (buf == NULL)
         return PyErr_NoMemory();
     /* ...Do some I/O operation involving buf... */
     res = PyBytes_FromString(buf);
     PyMem_Free(buf); /* allocated with PyMem_New */
     return res;

上の二つの例では、バッファを常に同じ関数セットに属する関数で操作している
ことに注意してください。実際、あるメモリブロックに対する操作は、異なるメ
モリ操作機構を混用する危険を減らすために、同じメモリ API ファミリを使っ
て行うことが必要です。以下のコードには二つのエラーがあり、そのうちの一つ
には異なるヒープを操作する別のメモリ操作関数を混用しているので '致命的
(Fatal)' とラベルづけをしています。

     char *buf1 = PyMem_New(char, BUFSIZ);
     char *buf2 = (char *) malloc(BUFSIZ);
     char *buf3 = (char *) PyMem_Malloc(BUFSIZ);
     ...
     PyMem_Del(buf3);  /* Wrong -- should be PyMem_Free() */
     free(buf2);       /* Right -- allocated via malloc() */
     free(buf1);       /* Fatal -- should be PyMem_Free()  */

In addition to the functions aimed at handling raw memory blocks from
the Python heap, objects in Python are allocated and released with *note
PyObject_New: b7c, *note PyObject_NewVar: b7d. and *note
PyObject_Free(): e60.

これらの関数については、次章の C による新しいオブジェクト型の定義や実装
に関する記述の中で説明します。


File: python.info,  Node: オブジェクト実装サポート object implementation support,  Next: API と ABI のバージョニング,  Prev: メモリ管理,  Up: Python/C API リファレンスマニュアル

7.13 オブジェクト実装サポート (object implementation support)
=============================================================

この章では、新しいオブジェクトの型を定義する際に使われる関数、型、および
マクロについて説明します。

* Menu:

* オブジェクトをヒープ上にメモリ確保する::
* Object Life Cycle::
* 共通のオブジェクト構造体 (common object structure): 共通のオブジェクト構造体 common object structure.
* Type Object Structures::
* 循環参照ガベージコレクションをサポートする::


File: python.info,  Node: オブジェクトをヒープ上にメモリ確保する,  Next: Object Life Cycle,  Up: オブジェクト実装サポート object implementation support

7.13.1 オブジェクトをヒープ上にメモリ確保する
---------------------------------------------

 -- C の関数: *note PyObject: 5df. *_PyObject_New (PyTypeObject *type)
     '戻り値: 新しい参照。'

 -- C の関数: *note PyVarObject: 46d6. *_PyObject_NewVar (PyTypeObject
          *type, Py_ssize_t size)
     '戻り値: 新しい参照。'

 -- C の関数: *note PyObject: 5df. *PyObject_Init (PyObject *op,
          PyTypeObject *type)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'
     Initialize a newly allocated object 'op' with its type and initial
     reference.  Returns the initialized object.  Other fields of the
     object are not initialized.  Despite its name, this function is
     unrelated to the object's *note __init__(): 8bf. method (*note
     tp_init: 7a1. slot).  Specifically, this function does 'not' call
     the object's ‘__init__()’ method.

     In general, consider this function to be a low-level routine.  Use
     *note tp_alloc: 4ed0. where possible.  For implementing ‘tp_alloc’
     for your type, prefer *note PyType_GenericAlloc(): c61. or *note
     PyObject_New(): b7c.

          注釈: This function only initializes the object's memory
          corresponding to the initial *note PyObject: 5df. structure.
          It does not zero the rest.

 -- C の関数: *note PyVarObject: 46d6. *PyObject_InitVar (PyVarObject
          *op, PyTypeObject *type, Py_ssize_t size)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775.'  *note
     PyObject_Init(): c60. の全ての処理を行い、可変サイズオブジェクトの
     場合には長さ情報も初期化します。

          注釈: This function only initializes some of the object's
          memory.  It does not zero the rest.

 -- C のマクロ: PyObject_New (TYPE, typeobj)

     Allocates a new Python object using the C structure type 'TYPE' and
     the Python type object 'typeobj' (‘PyTypeObject*’) by calling *note
     PyObject_Malloc(): e62. to allocate memory and initializing it like
     *note PyObject_Init(): c60.  The caller will own the only reference
     to the object (i.e.  its reference count will be one).

     Avoid calling this directly to allocate memory for an object; call
     the type's *note tp_alloc: 4ed0. slot instead.

     When populating a type's *note tp_alloc: 4ed0. slot, *note
     PyType_GenericAlloc(): c61. is preferred over a custom function
     that simply calls this macro.

     This macro does not call *note tp_alloc: 4ed0, *note tp_new: 79f.
     (*note __new__(): 7a0.), or *note tp_init: 7a1. (*note __init__():
     8bf.).

     This cannot be used for objects with *note Py_TPFLAGS_HAVE_GC: 981.
     set in *note tp_flags: 1c71.; use *note PyObject_GC_New: c99.
     instead.

     Memory allocated by this macro must be freed with *note
     PyObject_Free(): e60. (usually called via the object's *note
     tp_free: 4ecf. slot).

          注釈: The returned memory is not guaranteed to have been
          completely zeroed before it was initialized.

          注釈: This macro does not construct a fully initialized object
          of the given type; it merely allocates memory and prepares it
          for further initialization by *note tp_init: 7a1.  To
          construct a fully initialized object, call 'typeobj' instead.
          For example:

               PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);

     参考
     ....

        * *note PyObject_Free(): e60.

        * *note PyObject_GC_New: c99.

        * *note PyType_GenericAlloc(): c61.

        * *note tp_alloc: 4ed0.

 -- C のマクロ: PyObject_NewVar (TYPE, typeobj, size)

     Like *note PyObject_New: b7c. except:

        * It allocates enough memory for the 'TYPE' structure plus
          'size' (‘Py_ssize_t’) fields of the size given by the *note
          tp_itemsize: 23bb. field of 'typeobj'.

        * The memory is initialized like *note PyObject_InitVar(): 1d40.

     This is useful for implementing objects like tuples, which are able
     to determine their size at construction time.  Embedding the array
     of fields into the same allocation decreases the number of
     allocations, improving the memory management efficiency.

     Avoid calling this directly to allocate memory for an object; call
     the type's *note tp_alloc: 4ed0. slot instead.

     When populating a type's *note tp_alloc: 4ed0. slot, *note
     PyType_GenericAlloc(): c61. is preferred over a custom function
     that simply calls this macro.

     This cannot be used for objects with *note Py_TPFLAGS_HAVE_GC: 981.
     set in *note tp_flags: 1c71.; use *note PyObject_GC_NewVar: c9a.
     instead.

     Memory allocated by this function must be freed with *note
     PyObject_Free(): e60. (usually called via the object's *note
     tp_free: 4ecf. slot).

          注釈: The returned memory is not guaranteed to have been
          completely zeroed before it was initialized.

          注釈: This macro does not construct a fully initialized object
          of the given type; it merely allocates memory and prepares it
          for further initialization by *note tp_init: 7a1.  To
          construct a fully initialized object, call 'typeobj' instead.
          For example:

               PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);

     参考
     ....

        * *note PyObject_Free(): e60.

        * *note PyObject_GC_NewVar: c9a.

        * *note PyType_GenericAlloc(): c61.

        * *note tp_alloc: 4ed0.

 -- C 変数: *note PyObject: 5df. _Py_NoneStruct

     Python からは ‘None’ に見えるオブジェクトです。この値へのアクセスは
     、このオブジェクトへのポインタを評価する *note Py_None: 4e9f. マク
     ロを使わなければなりません。

参考
....

*note モジュールオブジェクト (module object): 543d.

     拡張モジュールのアロケートと生成。

* Menu:

* 非推奨のエイリアス: 非推奨のエイリアス<3>.


File: python.info,  Node: 非推奨のエイリアス<3>,  Up: オブジェクトをヒープ上にメモリ確保する

7.13.1.1 非推奨のエイリアス
...........................

These are *note soft deprecated: 23d. aliases to existing functions and
macros.  They exist solely for backwards compatibility.

非推奨のエイリアス                                     関数
                                                       
--------------------------------------------------------------------------------------------------------------
                                                       
 -- C のマクロ: PyObject_NEW (type, typeobj)           *note PyObject_New: b7c.
                                                       
                                                       
 -- C のマクロ: PyObject_NEW_VAR (type, typeobj, n)    *note PyObject_NewVar: b7d.
                                                       
                                                       
 -- C のマクロ: PyObject_INIT (op, typeobj)            *note PyObject_Init(): c60.
                                                       
                                                       
 -- C のマクロ: PyObject_INIT_VAR (op, typeobj, n)     *note PyObject_InitVar(): 1d40.
                                                       
                                                       
 -- C のマクロ: PyObject_MALLOC (n)                    *note PyObject_Malloc(): e62.
                                                       
                                                       
 -- C のマクロ: PyObject_REALLOC (p, n)                *note PyObject_Realloc(): 165c.
                                                       
                                                       
 -- C のマクロ: PyObject_FREE (p)                      *note PyObject_Free(): e60.
                                                       
                                                       
 -- C のマクロ: PyObject_DEL (p)                       *note PyObject_Free(): e60.
                                                       
                                                       
 -- C のマクロ: PyObject_Del (p)                       *note PyObject_Free(): e60.
                                                       


File: python.info,  Node: Object Life Cycle,  Next: 共通のオブジェクト構造体 common object structure,  Prev: オブジェクトをヒープ上にメモリ確保する,  Up: オブジェクト実装サポート object implementation support

7.13.2 Object Life Cycle
------------------------

This section explains how a type's slots relate to each other throughout
the life of an object.  It is not intended to be a complete canonical
reference for the slots; instead, refer to the slot-specific
documentation in *note Type Object Structures: b84. for details about a
particular slot.

* Menu:

* Life Events::
* Cyclic Isolate Destruction::
* 関数: 関数<15>.


File: python.info,  Node: Life Events,  Next: Cyclic Isolate Destruction,  Up: Object Life Cycle

7.13.2.1 Life Events
....................

The figure below illustrates the order of events that can occur
throughout an object's life.  An arrow from 'A' to 'B' indicates that
event 'B' can occur after event 'A' has occurred, with the arrow's label
indicating the condition that must be true for 'B' to occur after 'A'.

[image src="python-figures/lifecycle.dot.svg" alt="Diagram showing events in an object's life. Explained in detail below."]


Explanation:

   * When a new object is constructed by calling its type:

       1. *note tp_new: 79f. is called to create a new object.

       2. *note tp_alloc: 4ed0. is directly called by *note tp_new: 79f.
          to allocate the memory for the new object.

       3. *note tp_init: 7a1. initializes the newly created object.
          ‘tp_init’ can be called again to re-initialize an object, if
          desired.  The ‘tp_init’ call can also be skipped entirely, for
          example by Python code calling *note __new__(): 7a0.

   * After ‘tp_init’ completes, the object is ready to use.

   * Some time after the last reference to an object is removed:

       1. If an object is not marked as 'finalized', it might be
          finalized by marking it as 'finalized' and calling its *note
          tp_finalize: c9d. function.  Python does 'not' finalize an
          object when the last reference to it is deleted; use *note
          PyObject_CallFinalizerFromDealloc(): 55e3. to ensure that
          *note tp_finalize: c9d. is always called.

       2. If the object is marked as finalized, *note tp_clear: 4ee2.
          might be called by the garbage collector to clear references
          held by the object.  It is 'not' called when the object's
          reference count reaches zero.

       3. *note tp_dealloc: 4ebc. is called to destroy the object.  To
          avoid code duplication, *note tp_dealloc: 4ebc. typically
          calls into *note tp_clear: 4ee2. to free up the object's
          references.

       4. When *note tp_dealloc: 4ebc. finishes object destruction, it
          directly calls *note tp_free: 4ecf. (usually set to *note
          PyObject_Free(): e60. or *note PyObject_GC_Del(): 171c.
          automatically as appropriate for the type) to deallocate the
          memory.

   * The *note tp_finalize: c9d. function is permitted to add a
     reference to the object if desired.  If it does, the object is
     'resurrected', preventing its pending destruction.  (Only
     ‘tp_finalize’ is allowed to resurrect an object; *note tp_clear:
     4ee2. and *note tp_dealloc: 4ebc. cannot without calling into
     ‘tp_finalize’.)  Resurrecting an object may or may not cause the
     object's 'finalized' mark to be removed.  Currently, Python does
     not remove the 'finalized' mark from a resurrected object if it
     supports garbage collection (i.e., the *note Py_TPFLAGS_HAVE_GC:
     981. flag is set) but does remove the mark if the object does not
     support garbage collection; either or both of these behaviors may
     change in the future.

   * *note tp_dealloc: 4ebc. can optionally call *note tp_finalize: c9d.
     via *note PyObject_CallFinalizerFromDealloc(): 55e3. if it wishes
     to reuse that code to help with object destruction.  This is
     recommended because it guarantees that ‘tp_finalize’ is always
     called before destruction.  See the *note tp_dealloc: 4ebc.
     documentation for example code.

   * If the object is a member of a *note cyclic isolate: 55e4. and
     either *note tp_clear: 4ee2. fails to break the reference cycle or
     the cyclic isolate is not detected (perhaps *note gc.disable():
     4a0f. was called, or the *note Py_TPFLAGS_HAVE_GC: 981. flag was
     erroneously omitted in one of the involved types), the objects
     remain indefinitely uncollectable (they "leak").  See *note
     gc.garbage: 13d9.

If the object is marked as supporting garbage collection (the *note
Py_TPFLAGS_HAVE_GC: 981. flag is set in *note tp_flags: 1c71.), the
following events are also possible:

   * The garbage collector occasionally calls *note tp_traverse: 982. to
     identify *note cyclic isolates: 55e4.

   * When the garbage collector discovers a *note cyclic isolate: 55e4,
     it finalizes one of the objects in the group by marking it as
     'finalized' and calling its *note tp_finalize: c9d. function, if it
     has one.  This repeats until the cyclic isolate doesn't exist or
     all of the objects have been finalized.

   * *note tp_finalize: c9d. is permitted to resurrect the object by
     adding a reference from outside the *note cyclic isolate: 55e4.
     The new reference causes the group of objects to no longer form a
     cyclic isolate (the reference cycle may still exist, but if it does
     the objects are no longer isolated).

   * When the garbage collector discovers a *note cyclic isolate: 55e4.
     and all of the objects in the group have already been marked as
     'finalized', the garbage collector clears one or more of the
     uncleared objects in the group (possibly concurrently) by calling
     each's *note tp_clear: 4ee2. function.  This repeats as long as the
     cyclic isolate still exists and not all of the objects have been
     cleared.


File: python.info,  Node: Cyclic Isolate Destruction,  Next: 関数<15>,  Prev: Life Events,  Up: Object Life Cycle

7.13.2.2 Cyclic Isolate Destruction
...................................

Listed below are the stages of life of a hypothetical *note cyclic
isolate: 55e4. that continues to exist after each member object is
finalized or cleared.  It is a memory leak if a cyclic isolate
progresses through all of these stages; it should vanish once all
objects are cleared, if not sooner.  A cyclic isolate can vanish either
because the reference cycle is broken or because the objects are no
longer isolated due to finalizer resurrection (see *note tp_finalize:
c9d.).

  0. 'Reachable' (not yet a cyclic isolate): All objects are in their
     normal, reachable state.  A reference cycle could exist, but an
     external reference means the objects are not yet isolated.

  1. 'Unreachable but consistent:' The final reference from outside the
     cyclic group of objects has been removed, causing the objects to
     become isolated (thus a cyclic isolate is born).  None of the
     group's objects have been finalized or cleared yet.  The cyclic
     isolate remains at this stage until some future run of the garbage
     collector (not necessarily the next run because the next run might
     not scan every object).

  2. 'Mix of finalized and not finalized:' Objects in a cyclic isolate
     are finalized one at a time, which means that there is a period of
     time when the cyclic isolate is composed of a mix of finalized and
     non-finalized objects.  Finalization order is unspecified, so it
     can appear random.  A finalized object must behave in a sane manner
     when non-finalized objects interact with it, and a non-finalized
     object must be able to tolerate the finalization of an arbitrary
     subset of its referents.

  3. 'All finalized:' All objects in a cyclic isolate are finalized
     before any of them are cleared.

  4. 'Mix of finalized and cleared:' The objects can be cleared serially
     or concurrently (but with the *note GIL: 164. held); either way,
     some will finish before others.  A finalized object must be able to
     tolerate the clearing of a subset of its referents.  PEP 442(1)
     calls this stage "cyclic trash".

  5. 'Leaked:' If a cyclic isolate still exists after all objects in the
     group have been finalized and cleared, then the objects remain
     indefinitely uncollectable (see *note gc.garbage: 13d9.).  It is a
     bug if a cyclic isolate reaches this stage--it means the *note
     tp_clear: 4ee2. methods of the participating objects have failed to
     break the reference cycle as required.

If *note tp_clear: 4ee2. did not exist, then Python would have no way to
safely break a reference cycle.  Simply destroying an object in a cyclic
isolate would result in a dangling pointer, triggering undefined
behavior when an object referencing the destroyed object is itself
destroyed.  The clearing step makes object destruction a two-phase
process: first *note tp_clear: 4ee2. is called to partially destroy the
objects enough to detangle them from each other, then *note tp_dealloc:
4ebc. is called to complete the destruction.

Unlike clearing, finalization is not a phase of destruction.  A
finalized object must still behave properly by continuing to fulfill its
design contracts.  An object's finalizer is allowed to execute arbitrary
Python code, and is even allowed to prevent the impending destruction by
adding a reference.  The finalizer is only related to destruction by
call order--if it runs, it runs before destruction, which starts with
*note tp_clear: 4ee2. (if called) and concludes with *note tp_dealloc:
4ebc.

The finalization step is not necessary to safely reclaim the objects in
a cyclic isolate, but its existence makes it easier to design types that
behave in a sane manner when objects are cleared.  Clearing an object
might necessarily leave it in a broken, partially destroyed state--it
might be unsafe to call any of the cleared object's methods or access
any of its attributes.  With finalization, only finalized objects can
possibly interact with cleared objects; non-finalized objects are
guaranteed to interact with only non-cleared (but potentially finalized)
objects.

To summarize the possible interactions:

   * A non-finalized object might have references to or from
     non-finalized and finalized objects, but not to or from cleared
     objects.

   * A finalized object might have references to or from non-finalized,
     finalized, and cleared objects.

   * A cleared object might have references to or from finalized and
     cleared objects, but not to or from non-finalized objects.

Without any reference cycles, an object can be simply destroyed once its
last reference is deleted; the finalization and clearing steps are not
necessary to safely reclaim unused objects.  However, it can be useful
to automatically call *note tp_finalize: c9d. and *note tp_clear: 4ee2.
before destruction anyway because type design is simplified when all
objects always experience the same series of events regardless of
whether they participated in a cyclic isolate.  Python currently only
calls *note tp_finalize: c9d. and *note tp_clear: 4ee2. as needed to
destroy a cyclic isolate; this may change in a future version.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0442/


File: python.info,  Node: 関数<15>,  Prev: Cyclic Isolate Destruction,  Up: Object Life Cycle

7.13.2.3 関数
.............

To allocate and free memory, see *note
オブジェクトをヒープ上にメモリ確保する: 55d2.

 -- C の関数: void PyObject_CallFinalizer (PyObject *op)

     Finalizes the object as described in *note tp_finalize: c9d.  Call
     this function (or *note PyObject_CallFinalizerFromDealloc(): 55e3.)
     instead of calling *note tp_finalize: c9d. directly because this
     function may deduplicate multiple calls to ‘tp_finalize’.
     Currently, calls are only deduplicated if the type supports garbage
     collection (i.e., the *note Py_TPFLAGS_HAVE_GC: 981. flag is set);
     this may change in the future.

     Added in version 3.4.

 -- C の関数: int PyObject_CallFinalizerFromDealloc (PyObject *op)

     Same as *note PyObject_CallFinalizer(): 55e7. but meant to be
     called at the beginning of the object's destructor (*note
     tp_dealloc: 4ebc.).  There must not be any references to the
     object.  If the object's finalizer resurrects the object, this
     function returns -1; no further destruction should happen.
     Otherwise, this function returns 0 and destruction can continue
     normally.

     Added in version 3.4.

     参考
     ....

     *note tp_dealloc: 4ebc. for example code.


File: python.info,  Node: 共通のオブジェクト構造体 common object structure,  Next: Type Object Structures,  Prev: Object Life Cycle,  Up: オブジェクト実装サポート object implementation support

7.13.3 共通のオブジェクト構造体 (common object structure)
---------------------------------------------------------

Python では、オブジェクト型を定義する上で数多くの構造体が使われます。こ
の節では三つの構造体とその利用方法について説明します。

* Menu:

* Base object types and macros::
* Implementing functions and methods::
* Accessing attributes of extension types::


File: python.info,  Node: Base object types and macros,  Next: Implementing functions and methods,  Up: 共通のオブジェクト構造体 common object structure

7.13.3.1 Base object types and macros
.....................................

All Python objects ultimately share a small number of fields at the
beginning of the object's representation in memory.  These are
represented by the *note PyObject: 5df. and *note PyVarObject: 46d6.
types, which are defined, in turn, by the expansions of some macros also
used, whether directly or indirectly, in the definition of all other
Python objects.  Additional macros can be found under *note reference
counting: 51e7.

 -- C のデータ型: type PyObject
     ' 次に属します: *note Limited API: 775.  (いくつかのメンバーのみが
     安定 ABI です。)' All object types are extensions of this type.
     This is a type which contains the information Python needs to treat
     a pointer to an object as an object.  In a normal "release" build,
     it contains only the object's reference count and a pointer to the
     corresponding type object.  Nothing is actually declared to be a
     *note PyObject: 5df, but every pointer to a Python object can be
     cast to a *note PyObject: 5df.*.

     The members must not be accessed directly; instead use macros such
     as *note Py_REFCNT: 2cf. and *note Py_TYPE: 3c9.

      -- C のメンバ変数: *note Py_ssize_t: c55. ob_refcnt
          ' 次に属します: *note Stable ABI: 775.'  The object's
          reference count, as returned by *note Py_REFCNT: 2cf.  Do not
          use this field directly; instead use functions and macros such
          as ‘Py_REFCNT’, *note Py_INCREF(): 78f. and *note Py_DecRef():
          512a.

          The field type may be different from ‘Py_ssize_t’, depending
          on build configuration and platform.

      -- C のメンバ変数: *note PyTypeObject: c9c. *ob_type
          ' 次に属します: *note Stable ABI: 775.'  The object's type.
          Do not use this field directly; use *note Py_TYPE: 3c9. and
          *note Py_SET_TYPE(): 984. instead.

 -- C のデータ型: type PyVarObject
     ' 次に属します: *note Limited API: 775.  (いくつかのメンバーのみが
     安定 ABI です。)' An extension of *note PyObject: 5df. that adds
     the *note ob_size: 511c. field.  This is intended for objects that
     have some notion of 'length'.

     As with ‘PyObject’, the members must not be accessed directly;
     instead use macros such as *note Py_SIZE: 985, *note Py_REFCNT:
     2cf. and *note Py_TYPE: 3c9.

      -- C のメンバ変数: *note Py_ssize_t: c55. ob_size
          ' 次に属します: *note Stable ABI: 775.'  A size field, whose
          contents should be considered an object's internal
          implementation detail.

          Do not use this field directly; use *note Py_SIZE: 985.
          instead.

          Object creation functions such as *note PyObject_NewVar():
          b7d. will generally set this field to the requested size
          (number of items).  After creation, arbitrary values can be
          stored in ‘ob_size’ using *note Py_SET_SIZE: 986.

          To get an object's publicly exposed length, as returned by the
          Python function *note len(): 840, use *note PyObject_Length():
          5094. instead.

 -- C のマクロ: PyObject_HEAD

     可変な長さを持たないオブジェクトを表現する新しい型を宣言するときに
     使うマクロです。 PyObject_HEAD マクロは次のように展開されます:

          PyObject ob_base;

     上にある *note PyObject: 5df. のドキュメントを参照してください。

 -- C のマクロ: PyObject_VAR_HEAD

     インスタンスごとに異なる長さを持つオブジェクトを表現する新しい型を
     宣言するときに使うマクロです。 PyObject_VAR_HEAD マクロは次のように
     展開されます:

          PyVarObject ob_base;

     上にある *note PyVarObject: 46d6. のドキュメントを参照してください
     。

 -- C 変数: *note PyTypeObject: c9c. PyBaseObject_Type
     ' 次に属します: *note Stable ABI: 775.'  The base class of all
     other objects, the same as *note object: c7e. in Python.

 -- C の関数: int Py_Is (PyObject *x, PyObject *y)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Test if the 'x' object is the 'y' object, the same as ‘x is y’ in
     Python.

     Added in version 3.10.

 -- C の関数: int Py_IsNone (PyObject *x)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Test if an object is the ‘None’ singleton, the same as ‘x is None’
     in Python.

     Added in version 3.10.

 -- C の関数: int Py_IsTrue (PyObject *x)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Test if an object is the ‘True’ singleton, the same as ‘x is True’
     in Python.

     Added in version 3.10.

 -- C の関数: int Py_IsFalse (PyObject *x)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Test if an object is the ‘False’ singleton, the same as ‘x is
     False’ in Python.

     Added in version 3.10.

 -- C の関数: *note PyTypeObject: c9c. *Py_TYPE (PyObject *o)
     '戻り値: 借用参照。'' 次に属します: *note Stable ABI: 775. (バージ
     ョン 3.14 より).'  Get the type of the Python object 'o'.

     The returned reference is *note borrowed: 3d7. from 'o'.  Do not
     release it with *note Py_DECREF(): 790. or similar.

     バージョン 3.11 で変更: *note Py_TYPE(): 3c9. is changed to an
     inline static function.  The parameter type is no longer const
     *note PyObject: 5df.*.

 -- C の関数: int Py_IS_TYPE (PyObject *o, PyTypeObject *type)

     Return non-zero if the object 'o' type is 'type'.  Return zero
     otherwise.  Equivalent to: ‘Py_TYPE(o) == type’.

     Added in version 3.9.

 -- C の関数: void Py_SET_TYPE (PyObject *o, PyTypeObject *type)

     Set the type of object 'o' to 'type', without any checking or
     reference counting.

     This is a very low-level operation.  Consider instead setting the
     Python attribute *note __class__: 16c6. using *note
     PyObject_SetAttrString(): 198e. or similar.

     Note that assigning an incompatible type can lead to undefined
     behavior.

     If 'type' is a *note heap type: b5e, the caller must create a new
     reference to it.  Similarly, if the old type of 'o' is a heap type,
     the caller must release a reference to that type.

     Added in version 3.9.

 -- C の関数: *note Py_ssize_t: c55. Py_SIZE (PyVarObject *o)

     Get the *note ob_size: 511c. field of 'o'.

     バージョン 3.11 で変更: *note Py_SIZE(): 985. is changed to an
     inline static function.  The parameter type is no longer const
     *note PyVarObject: 46d6.*.

 -- C の関数: void Py_SET_SIZE (PyVarObject *o, Py_ssize_t size)

     Set the *note ob_size: 511c. field of 'o' to 'size'.

     Added in version 3.9.

 -- C のマクロ: PyObject_HEAD_INIT (type)

     新しい *note PyObject: 5df. 型のための初期値に展開するマクロです。
     このマクロは次のように展開されます。

          _PyObject_EXTRA_INIT
          1, type,

 -- C のマクロ: PyVarObject_HEAD_INIT (type, size)

     This is a macro which expands to initialization values for a new
     *note PyVarObject: 46d6. type, including the *note ob_size: 511c.
     field.  This macro expands to:

          _PyObject_EXTRA_INIT
          1, type, size,


File: python.info,  Node: Implementing functions and methods,  Next: Accessing attributes of extension types,  Prev: Base object types and macros,  Up: 共通のオブジェクト構造体 common object structure

7.13.3.2 Implementing functions and methods
...........................................

 -- C のデータ型: type PyCFunction
     ' 次に属します: *note Stable ABI: 775.'  Type of the functions used
     to implement most Python callables in C. Functions of this type
     take two *note PyObject: 5df.* parameters and return one such
     value.  If the return value is ‘NULL’, an exception shall have been
     set.  If not ‘NULL’, the return value is interpreted as the return
     value of the function as exposed in Python.  The function must
     return a new reference.

     関数のシグネチャは次のとおりです

          PyObject *PyCFunction(PyObject *self,
                                PyObject *args);

 -- C のデータ型: type PyCFunctionWithKeywords
     ' 次に属します: *note Stable ABI: 775.'  Type of the functions used
     to implement Python callables in C with signature *note
     METH_VARARGS | METH_KEYWORDS: 55f1.  The function signature is:

          PyObject *PyCFunctionWithKeywords(PyObject *self,
                                            PyObject *args,
                                            PyObject *kwargs);

 -- C のデータ型: type PyCFunctionFast
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Type of the functions used to implement Python callables in C with
     signature *note METH_FASTCALL: 199e.  The function signature is:

          PyObject *PyCFunctionFast(PyObject *self,
                                    PyObject *const *args,
                                    Py_ssize_t nargs);

 -- C のデータ型: type PyCFunctionFastWithKeywords
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.13 より).'
     Type of the functions used to implement Python callables in C with
     signature *note METH_FASTCALL | METH_KEYWORDS: 55f2.  The function
     signature is:

          PyObject *PyCFunctionFastWithKeywords(PyObject *self,
                                                PyObject *const *args,
                                                Py_ssize_t nargs,
                                                PyObject *kwnames);

 -- C のデータ型: type PyCMethod

     Type of the functions used to implement Python callables in C with
     signature *note METH_METHOD | METH_FASTCALL | METH_KEYWORDS: 1a09.
     The function signature is:

          PyObject *PyCMethod(PyObject *self,
                              PyTypeObject *defining_class,
                              PyObject *const *args,
                              Py_ssize_t nargs,
                              PyObject *kwnames)

     Added in version 3.9.

 -- C のデータ型: type PyMethodDef
     ' 次に属します: *note Stable ABI: 775. (すべてのメンバーを含む).'  拡
     張型のメソッドを記述する際に用いる構造体です。この構造体には 4 つの
     フィールドがあります:

      -- C のメンバ変数: const char *ml_name

          Name of the method.

      -- C のメンバ変数: *note PyCFunction: 1691. ml_meth

          Pointer to the C implementation.

      -- C のメンバ変数: int ml_flags

          Flags bits indicating how the call should be constructed.

      -- C のメンバ変数: const char *ml_doc

          Points to the contents of the docstring.

The *note ml_meth: 55f3. is a C function pointer.  The functions may be
of different types, but they always return *note PyObject: 5df.*.  If
the function is not of the *note PyCFunction: 1691, the compiler will
require a cast in the method table.  Even though *note PyCFunction:
1691. defines the first parameter as *note PyObject: 5df.*, it is common
that the method implementation uses the specific C type of the 'self'
object.

The *note ml_flags: 55f4. field is a bitfield which can include the
following flags.  The individual flags indicate either a calling
convention or a binding convention.

There are these calling conventions:

 -- C のマクロ: METH_VARARGS
     ' 次に属します: *note Stable ABI: 775.'  *note PyCFunction: 1691. 型
     のメソッドで典型的に使われる呼び出し規約です。関数は *note
     PyObject: 5df.* 型の引数値を二つ要求します。最初の引数はメソッドの
     'self' オブジェクトです; モジュール関数の場合、これはモジュールオブ
     ジェクトです。第二のパラメタ (よく 'args' と呼ばれます) は、全ての
     引数を表現するタプルオブジェクトです。パラメタは通常、 *note
     PyArg_ParseTuple(): 3c1. や *note PyArg_UnpackTuple(): 171f. で処理
     されます。

 -- C のマクロ: METH_KEYWORDS

     Can only be used in certain combinations with other flags: *note
     METH_VARARGS | METH_KEYWORDS: 55f1, *note METH_FASTCALL |
     METH_KEYWORDS: 55f2. and *note METH_METHOD | METH_FASTCALL |
     METH_KEYWORDS: 1a09.

*note METH_VARARGS: 1721. | *note METH_KEYWORDS: 4ea2.

     Methods with these flags must be of type *note
     PyCFunctionWithKeywords: 4f8b.  The function expects three
     parameters: 'self', 'args', 'kwargs' where 'kwargs' is a dictionary
     of all the keyword arguments or possibly ‘NULL’ if there are no
     keyword arguments.  The parameters are typically processed using
     *note PyArg_ParseTupleAndKeywords(): 624.

 -- C のマクロ: METH_FASTCALL
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'
     Fast calling convention supporting only positional arguments.  The
     methods have the type *note PyCFunctionFast: 4f89.  The first
     parameter is 'self', the second parameter is a C array of *note
     PyObject: 5df.* values indicating the arguments and the third
     parameter is the number of arguments (the length of the array).

     Added in version 3.7.

     バージョン 3.10 で変更: ‘METH_FASTCALL’ is now part of the *note
     stable ABI: 4f5d.

*note METH_FASTCALL: 199e. | *note METH_KEYWORDS: 4ea2.

     Extension of *note METH_FASTCALL: 199e. supporting also keyword
     arguments, with methods of type *note PyCFunctionFastWithKeywords:
     4f8a.  Keyword arguments are passed the same way as in the *note
     vectorcall protocol: 774.: there is an additional fourth *note
     PyObject: 5df.* parameter which is a tuple representing the names
     of the keyword arguments (which are guaranteed to be strings) or
     possibly ‘NULL’ if there are no keywords.  The values of the
     keyword arguments are stored in the 'args' array, after the
     positional arguments.

     Added in version 3.7.

 -- C のマクロ: METH_METHOD
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.7 より).'  Can
     only be used in the combination with other flags: *note METH_METHOD
     | METH_FASTCALL | METH_KEYWORDS: 1a09.

*note METH_METHOD: b68. | *note METH_FASTCALL: 199e. | *note METH_KEYWORDS: 4ea2.

     Extension of *note METH_FASTCALL | METH_KEYWORDS: 55f2. supporting
     the 'defining class', that is, the class that contains the method
     in question.  The defining class might be a superclass of
     ‘Py_TYPE(self)’.

     The method needs to be of type *note PyCMethod: 968, the same as
     for ‘METH_FASTCALL | METH_KEYWORDS’ with ‘defining_class’ argument
     added after ‘self’.

     Added in version 3.9.

 -- C のマクロ: METH_NOARGS
     ' 次に属します: *note Stable ABI: 775.'  Methods without parameters
     don't need to check whether arguments are given if they are listed
     with the *note METH_NOARGS: 16ed. flag.  They need to be of type
     *note PyCFunction: 1691.  The first parameter is typically named
     'self' and will hold a reference to the module or object instance.
     In all cases the second parameter will be ‘NULL’.

     The function must have 2 parameters.  Since the second parameter is
     unused, *note Py_UNUSED: 1a8a. can be used to prevent a compiler
     warning.

 -- C のマクロ: METH_O
     ' 次に属します: *note Stable ABI: 775.'  Methods with a single
     object argument can be listed with the *note METH_O: 1720. flag,
     instead of invoking *note PyArg_ParseTuple(): 3c1. with a ‘"O"’
     argument.  They have the type *note PyCFunction: 1691, with the
     'self' parameter, and a *note PyObject: 5df.* parameter
     representing the single argument.

These two constants are not used to indicate the calling convention but
the binding when used with methods of classes.  These may not be used
for functions defined for modules.  At most one of these flags may be
set for any given method.

 -- C のマクロ: METH_CLASS
     ' 次に属します: *note Stable ABI: 775.'

     メソッドの最初の引数には、型のインスタンスではなく型オブジェクトが
     渡されます。このフラグは組み込み関数 *note classmethod(): 48e. を使
     って生成するのと同じ 'クラスメソッド (class method)' を生成するため
     に使われます。

 -- C のマクロ: METH_STATIC
     ' 次に属します: *note Stable ABI: 775.'

     メソッドの最初の引数には、型のインスタンスではなく ‘NULL’ が渡され
     ます。このフラグは、 *note staticmethod(): 453. を使って生成するの
     と同じ '静的メソッド (static method)' を生成するために使われます。

もう一つの定数は、あるメソッドを同名の別のメソッド定義と置き換えるかどう
かを制御します。

 -- C のマクロ: METH_COEXIST
     ' 次に属します: *note Stable ABI: 775.'  The method will be loaded
     in place of existing definitions.  Without 'METH_COEXIST', the
     default is to skip repeated definitions.  Since slot wrappers are
     loaded before the method table, the existence of a 'sq_contains'
     slot, for example, would generate a wrapped method named *note
     __contains__(): 15d3. and preclude the loading of a corresponding
     PyCFunction with the same name.  With the flag defined, the
     PyCFunction will be loaded in place of the wrapper object and will
     co-exist with the slot.  This is helpful because calls to
     PyCFunctions are optimized more than wrapper object calls.

 -- C 変数: *note PyTypeObject: c9c. PyCMethod_Type

     The type object corresponding to Python C method objects.  This is
     available as *note types.BuiltinMethodType: 29ea. in the Python
     layer.

 -- C の関数: int PyCMethod_Check (PyObject *op)

     Return true if 'op' is an instance of the *note PyCMethod_Type:
     55f6. type or a subtype of it.  This function always succeeds.

 -- C の関数: int PyCMethod_CheckExact (PyObject *op)

     This is the same as *note PyCMethod_Check(): 55f7, but does not
     account for subtypes.

 -- C の関数: *note PyObject: 5df. *PyCMethod_New (PyMethodDef *ml,
          PyObject *self, PyObject *module, PyTypeObject *cls)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.9 より).'  Turn 'ml' into a Python *note callable: 2d7b.
     object.  The caller must ensure that 'ml' outlives the *note
     callable: 2d7b.  Typically, 'ml' is defined as a static variable.

     The 'self' parameter will be passed as the 'self' argument to the C
     function in ‘ml->ml_meth’ when invoked.  'self' can be ‘NULL’.

     The *note callable: 2d7b. object's ‘__module__’ attribute can be
     set from the given 'module' argument.  'module' should be a Python
     string, which will be used as name of the module the function is
     defined in.  If unavailable, it can be set to *note None: 885. or
     ‘NULL’.

     参考
     ....

     *note function.__module__: 234a.

     The 'cls' parameter will be passed as the 'defining_class' argument
     to the C function.  Must be set if *note METH_METHOD: b68. is set
     on ‘ml->ml_flags’.

     Added in version 3.9.

 -- C 変数: *note PyTypeObject: c9c. PyCFunction_Type
     ' 次に属します: *note Stable ABI: 775.'  The type object
     corresponding to Python C function objects.  This is available as
     *note types.BuiltinFunctionType: 29e9. in the Python layer.

 -- C の関数: int PyCFunction_Check (PyObject *op)

     Return true if 'op' is an instance of the *note PyCFunction_Type:
     4f8f. type or a subtype of it.  This function always succeeds.

 -- C の関数: int PyCFunction_CheckExact (PyObject *op)

     This is the same as *note PyCFunction_Check(): 55f9, but does not
     account for subtypes.

 -- C の関数: *note PyObject: 5df. *PyCFunction_NewEx (PyMethodDef *ml,
          PyObject *self, PyObject *module)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775.'
     Equivalent to ‘PyCMethod_New(ml, self, module, NULL)’.

 -- C の関数: *note PyObject: 5df. *PyCFunction_New (PyMethodDef *ml,
          PyObject *self)
     '戻り値: 新しい参照。'' 次に属します: *note Stable ABI: 775. (バー
     ジョン 3.4 より).'  Equivalent to ‘PyCMethod_New(ml, self, NULL,
     NULL)’.

 -- C の関数: int PyCFunction_GetFlags (PyObject *func)
     ' 次に属します: *note Stable ABI: 775.'  Get the function's flags
     on 'func' as they were passed to *note ml_flags: 55f4.

     If 'func' is not a C function object, this fails with an exception.
     'func' must not be ‘NULL’.

     This function returns the function's flags on success, and ‘-1’
     with an exception set on failure.

 -- C の関数: int PyCFunction_GET_FLAGS (PyObject *func)

     This is the same as *note PyCFunction_GetFlags(): 4f8c, but without
     error or type checking.

 -- C の関数: *note PyCFunction: 1691. PyCFunction_GetFunction (PyObject
          *func)
     ' 次に属します: *note Stable ABI: 775.'  Get the function pointer
     on 'func' as it was passed to *note ml_meth: 55f3.

     If 'func' is not a C function object, this fails with an exception.
     'func' must not be ‘NULL’.

     This function returns the function pointer on success, and ‘NULL’
     with an exception set on failure.

 -- C の関数: int PyCFunction_GET_FUNCTION (PyObject *func)

     This is the same as *note PyCFunction_GetFunction(): 4f8d, but
     without error or type checking.

 -- C の関数: *note PyObject: 5df. *PyCFunction_GetSelf (PyObject *func)
     ' 次に属します: *note Stable ABI: 775.'  Get the "self" object on
     'func'.  This is the object that would be passed to the first
     argument of a *note PyCFunction: 1691.  For C function objects
     created through a *note PyMethodDef: 16f0. on a *note PyModuleDef:
     b74, this is the resulting module object.

     If 'func' is not a C function object, this fails with an exception.
     'func' must not be ‘NULL’.

     This function returns a *note borrowed reference: 3d7. to the
     "self" object on success, and ‘NULL’ with an exception set on
     failure.

 -- C の関数: *note PyObject: 5df. *PyCFunction_GET_SELF (PyObject
          *func)

     This is the same as *note PyCFunction_GetSelf(): 4f8e, but without
     error or type checking.


File: python.info,  Node: Accessing attributes of extension types,  Prev: Implementing functions and methods,  Up: 共通のオブジェクト構造体 common object structure

7.13.3.3 Accessing attributes of extension types
................................................

 -- C のデータ型: type PyMemberDef
     ' 次に属します: *note Stable ABI: 775. (すべてのメンバーを含む).'
     Structure which describes an attribute of a type which corresponds
     to a C struct member.  When defining a class, put a NULL-terminated
     array of these structures in the *note tp_members: 4ed2. slot.

     Its fields are, in order:

      -- C のメンバ変数: const char *name

          Name of the member.  A NULL value marks the end of a
          ‘PyMemberDef[]’ array.

          The string should be static, no copy is made of it.

      -- C のメンバ変数: int type

          The type of the member in the C struct.  See *note Member
          types: 19f0. for the possible values.

      -- C のメンバ変数: *note Py_ssize_t: c55. offset

          The offset in bytes that the member is located on the type’s
          object struct.

      -- C のメンバ変数: int flags

          Zero or more of the *note Member flags: 5601, combined using
          bitwise OR.

      -- C のメンバ変数: const char *doc

          The docstring, or NULL. The string should be static, no copy
          is made of it.  Typically, it is defined using *note
          PyDoc_STR: 1b96.

     By default (when *note flags: 4eeb. is ‘0’), members allow both
     read and write access.  Use the *note Py_READONLY: 7ae. flag for
     read-only access.  Certain types, like *note Py_T_STRING: 5142,
     imply *note Py_READONLY: 7ae.  Only *note Py_T_OBJECT_EX: 7b1. (and
     legacy *note T_OBJECT: 7b0.) members can be deleted.  For
     heap-allocated types (created using *note PyType_FromSpec(): 79d.
     or similar), ‘PyMemberDef’ may contain a definition for the special
     member ‘"__vectorcalloffset__"’, corresponding to *note
     tp_vectorcall_offset: 5296. in type objects.  This member must be
     defined with ‘Py_T_PYSSIZET’, and either ‘Py_READONLY’ or
     ‘Py_READONLY | Py_RELATIVE_OFFSET’.  For example:

          static PyMemberDef spam_type_members[] = {
              {"__vectorcalloffset__", Py_T_PYSSIZET,
               offsetof(Spam_object, vectorcall), Py_READONLY},
              {NULL}  /* Sentinel */
          };

     (You may need to ‘#include <stddef.h>’ for ‘offsetof()’.)

     The legacy offsets *note tp_dictoffset: 52ec. and *note
     tp_weaklistoffset: b7f. can be defined similarly using
     ‘"__dictoffset__"’ and ‘"__weaklistoffset__"’ members, but
     extensions are strongly encouraged to use *note
     Py_TPFLAGS_MANAGED_DICT: 60f. and *note Py_TPFLAGS_MANAGED_WEAKREF:
     77c. instead.

     バージョン 3.12 で変更: ‘PyMemberDef’ is always available.
     Previously, it required including ‘"structmember.h"’.

     バージョン 3.14 で変更: *note Py_RELATIVE_OFFSET: 770. is now
     allowed for ‘"__vectorcalloffset__"’, ‘"__dictoffset__"’ and
     ‘"__weaklistoffset__"’.

 -- C の関数: *note PyObject: 5df. *PyMember_GetOne (const char
          *obj_addr, struct PyMemberDef *m)
     ' 次に属します: *note Stable ABI: 775.'  Get an attribute belonging
     to the object at address 'obj_addr'.  The attribute is described by
     ‘PyMemberDef’ 'm'.  Returns ‘NULL’ on error.

     バージョン 3.12 で変更: ‘PyMember_GetOne’ is always available.
     Previously, it required including ‘"structmember.h"’.

 -- C の関数: int PyMember_SetOne (char *obj_addr, struct PyMemberDef
          *m, PyObject *o)
     ' 次に属します: *note Stable ABI: 775.'  Set an attribute belonging
     to the object at address 'obj_addr' to object 'o'.  The attribute
     to set is described by ‘PyMemberDef’ 'm'.  Returns ‘0’ if
     successful and a negative value on failure.

     バージョン 3.12 で変更: ‘PyMember_SetOne’ is always available.
     Previously, it required including ‘"structmember.h"’.

* Menu:

* Member flags::
* Member types::
* Defining Getters and Setters::


File: python.info,  Node: Member flags,  Next: Member types,  Up: Accessing attributes of extension types

7.13.3.4 Member flags
.....................

The following flags can be used with *note PyMemberDef.flags: 4eeb.:

 -- C のマクロ: Py_READONLY
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'
     Not writable.

 -- C のマクロ: Py_AUDIT_READ
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'
     Emit an ‘object.__getattr__’ *note audit event: 1c13. before
     reading.

 -- C のマクロ: Py_RELATIVE_OFFSET
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'
     Indicates that the *note offset: 5600. of this ‘PyMemberDef’ entry
     indicates an offset from the subclass-specific data, rather than
     from ‘PyObject’.

     Can only be used as part of the *note Py_tp_members: 5195. *note
     slot: 50dc. when creating a class using negative *note basicsize:
     76a.  It is mandatory in that case.  When setting *note tp_members:
     4ed2. from the slot during class creation, Python clears the flag
     and sets *note PyMemberDef.offset: 5600. to the offset from the
     ‘PyObject’ struct.

バージョン 3.10 で変更: The ‘RESTRICTED’, ‘READ_RESTRICTED’ and
‘WRITE_RESTRICTED’ macros available with ‘#include "structmember.h"’ are
deprecated.  ‘READ_RESTRICTED’ and ‘RESTRICTED’ are equivalent to *note
Py_AUDIT_READ: 7af.; ‘WRITE_RESTRICTED’ does nothing.

バージョン 3.12 で変更: The ‘READONLY’ macro was renamed to *note
Py_READONLY: 7ae.  The ‘PY_AUDIT_READ’ macro was renamed with the ‘Py_’
prefix.  The new names are now always available.  Previously, these
required ‘#include "structmember.h"’.  The header is still available and
it provides the old names.


File: python.info,  Node: Member types,  Next: Defining Getters and Setters,  Prev: Member flags,  Up: Accessing attributes of extension types

7.13.3.5 Member types
.....................

*note PyMemberDef.type: 4eea. can be one of the following macros
corresponding to various C types.  When the member is accessed in
Python, it will be converted to the equivalent Python type.  When it is
set from Python, it will be converted back to the C type.  If that is
not possible, an exception such as *note TypeError: 198. or *note
ValueError: 2ec. is raised.

Unless marked (D), attributes defined this way cannot be deleted using
e.g.  *note del: 1b1f. or *note delattr(): 25b7.

マクロ名                             C の型                            Python の型
                                                                       
--------------------------------------------------------------------------------------------------
                                                                       
 -- C のマクロ: Py_T_BYTE            char                              *note int: 19b.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_SHORT           short                             *note int: 19b.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_INT             int                               *note int: 19b.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_LONG            long                              *note int: 19b.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_LONGLONG        long long                         *note int: 19b.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_UBYTE           unsigned char                     *note int: 19b.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_UINT            unsigned int                      *note int: 19b.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_USHORT          unsigned short                    *note int: 19b.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_ULONG           unsigned long                     *note int: 19b.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_ULONGLONG       unsigned long long                *note int: 19b.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_PYSSIZET        *note Py_ssize_t: c55.            *note int: 19b.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_FLOAT           float                             *note float: 196.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_DOUBLE          double                            *note float: 196.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_BOOL            char (written as 0 or 1)          *note bool: 3c3.
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_STRING          const char* (*)                   *note str: 169. (RO)
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ:                      const char[] (*)                  *note str: 169. (RO)
          Py_T_STRING_INPLACE                                          
     ' 次に属します:
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_CHAR            char (0-127)                      *note str: 169. (**)
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

 -- C のマクロ: Py_T_OBJECT_EX       *note PyObject: 5df.*             *note object: c7e. (D)
     ' 次に属します:                                                   
     *note Stable ABI: 775. (バー
     ジョン 3.12 より).'

     (*): Zero-terminated, UTF8-encoded C string.  With ‘Py_T_STRING’
     the C representation is a pointer; with ‘Py_T_STRING_INPLACE’ the
     string is stored directly in the structure.

     (**): String of length 1.  Only ASCII is accepted.

     (RO): Implies *note Py_READONLY: 7ae.

     (D): Can be deleted, in which case the pointer is set to ‘NULL’.
     Reading a ‘NULL’ pointer raises *note AttributeError: 5f0.

Added in version 3.12: In previous versions, the macros were only
available with ‘#include "structmember.h"’ and were named without the
‘Py_’ prefix (e.g.  as ‘T_INT’).  The header is still available and
contains the old names, along with the following deprecated types:

 -- C のマクロ: T_OBJECT

     Like ‘Py_T_OBJECT_EX’, but ‘NULL’ is converted to ‘None’.  This
     results in surprising behavior in Python: deleting the attribute
     effectively sets it to ‘None’.

 -- C のマクロ: T_NONE

     Always ‘None’.  Must be used with *note Py_READONLY: 7ae.


File: python.info,  Node: Defining Getters and Setters,  Prev: Member types,  Up: Accessing attributes of extension types

7.13.3.6 Defining Getters and Setters
.....................................

 -- C のデータ型: type PyGetSetDef
     ' 次に属します: *note Stable ABI: 775. (すべてのメンバーを含む).'  型
     のプロパティのようなアクセスを定義するための構造体です。 *note
     PyTypeObject.tp_getset: 4ed7. スロットの説明も参照してください。

      -- C のメンバ変数: const char *name

          属性名

      -- C のメンバ変数: *note getter: 51a8. get

          C function to get the attribute.

      -- C のメンバ変数: *note setter: 51b6. set

          Optional C function to set or delete the attribute.  If
          ‘NULL’, the attribute is read-only.

      -- C のメンバ変数: const char *doc

          任意のドキュメンテーション文字列

      -- C のメンバ変数: void *closure

          Optional user data pointer, providing additional data for
          getter and setter.

 -- C のデータ型: typedef *note PyObject: 5df. *(*getter)(*note
          PyObject: 5df.*, void*)
     ' 次に属します: *note Stable ABI: 775.'  The ‘get’ function takes
     one *note PyObject: 5df.* parameter (the instance) and a user data
     pointer (the associated ‘closure’):

     成功または失敗時に ‘NULL’ と例外の集合にされたときは新しい参照を返
     します。

 -- C のデータ型: typedef int (*setter)(*note PyObject: 5df.*, *note
          PyObject: 5df.*, void*)
     ' 次に属します: *note Stable ABI: 775.'  ‘set’ functions take two
     *note PyObject: 5df.* parameters (the instance and the value to be
     set) and a user data pointer (the associated ‘closure’):

     属性を削除する場合は、2 番目のパラメータに ‘NULL’ を指定します。成
     功した場合は ‘0’ を、失敗した場合は ‘-1’ を例外として返します。


File: python.info,  Node: Type Object Structures,  Next: 循環参照ガベージコレクションをサポートする,  Prev: 共通のオブジェクト構造体 common object structure,  Up: オブジェクト実装サポート object implementation support

7.13.4 Type Object Structures
-----------------------------

新スタイルの型を定義する構造体: *note PyTypeObject: c9c. 構造体は、おそ
らく Python オブジェクトシステムの中で最も重要な構造体の1つでしょう。型
オブジェクトは ‘PyObject_*’ 系や ‘PyType_*’ 系の関数で扱えますが、ほとん
どの Python アプリケーションにとって、さして面白みのある機能を提供しませ
ん。型オブジェクトはオブジェクトがどのように振舞うかを決める基盤ですから
、インタプリタ自体や新たな型を定義する拡張モジュールでは非常に重要な存在
です。

型オブジェクトは標準の型 (standard type) に比べるとかなり大きな構造体で
す。各型オブジェクトは多くの値を保持しており、そのほとんどは C 関数への
ポインタで、それぞれの関数はその型の機能の小さい部分を実装しています。こ
の節では、型オブジェクトの各フィールドについて詳細を説明します。各フィー
ルドは、構造体内で出現する順番に説明されています。

以下のクイックリファレンスに加えて、 *note 使用例: 560e. 節では *note
PyTypeObject: c9c. の意味と使い方を一目で理解できる例を載せています。

* Menu:

* クイックリファレンス::
* PyTypeObject 定義::
* PyObject スロット::
* PyVarObject スロット::
* PyTypeObject スロット::
* Static Types::
* Heap Types::
* 数値オブジェクト構造体::
* マップオブジェクト構造体::
* シーケンスオブジェクト構造体::
* バッファオブジェクト構造体 (buffer object structure): バッファオブジェクト構造体 buffer object structure.
* async オブジェクト構造体::
* Slot Type typedefs::
* 使用例: 使用例<57>.


File: python.info,  Node: クイックリファレンス,  Next: PyTypeObject 定義,  Up: Type Object Structures

7.13.4.1 クイックリファレンス
.............................

* Menu:

* tp スロット::
* sub-slots::
* スロットの定義型 (typedef): スロットの定義型 typedef.


File: python.info,  Node: tp スロット,  Next: sub-slots,  Up: クイックリファレンス

7.13.4.2 tp スロット
....................

PyTypeObject スロッ    *note 型: 5612.        特殊メソッド/特殊属    Info
ト (1)                                        性                     (2)
                                                                     
---------------------------------------------------------------------------------------------
                                                                     
O                      T                      D                      I
                                                                     
                                                                                       
<R>                    const char *           __name__               X     X
*note tp_name: 1cb0.                                                       

*note tp_basicsize: b7e.*note Py_ssize_t: c55.                       X     X           X
                                                                                       
                                                                                       
*note tp_itemsize: 23bb.*note Py_ssize_t: c55.                             X           X
                                                                                       
                                                                                       
*note tp_dealloc: 4ebc.*note destructor: 51a3.                       X     X           X
                                                                                       
                                                                                       
*note tp_vectorcall_offset: 5296.*note Py_ssize_t: c55.                    X           X
                                                                                       
                                                                                       
(*note tp_getattr: 4eed.)*note getattrfunc: 51a4.__getattribute__,                     G
                                              __getattr__                              
                                              
                                                                                       
(*note tp_setattr: 4eee.)*note setattrfunc: 51b4.__setattr__,                          G
                                              __delattr__                              
                                              
                                                                                       
*note tp_as_async: 10cf.*note PyAsyncMethods: 52ea.*note sub-slots: 5613.              %
                       *                                                               
                       
                                                                                       
*note tp_repr: 4ee4.   *note reprfunc: 51b2.  __repr__               X     X           X
                                                                                       
                                                                                       
*note tp_as_number: b82.*note PyNumberMethods: 1637.*note sub-slots: 5613.             %
                       *                                                               
                       
                                                                                       
*note tp_as_sequence: 5614.*note PySequenceMethods: 4ef4.*note sub-slots: 5613.        %
                       *                                                               
                       
                                                                                       
*note tp_as_mapping: 5615.*note PyMappingMethods: 4ef5.*note sub-slots: 5613.          %
                       *                                                               
                       
                                                                                       
*note tp_hash: 4ef6.   *note hashfunc: 51a9.  __hash__               X                 G
                                                                                       
                                                                                       
*note tp_call: 77b.    *note ternaryfunc: 51b9.__call__                    X           X
                                                                                       
                                                                                       
*note tp_str: 4ee5.    *note reprfunc: 51b2.  __str__                X                 X
                                                                                       
                                                                                       
*note tp_getattro: 1a64.*note getattrofunc: 51a5.__getattribute__,   X     X           G
                                              __getattr__                              
                                              
                                                                                       
*note tp_setattro: 4ee8.*note setattrofunc: 51b5.__setattr__,        X     X           G
                                              __delattr__                              
                                              
                                                                                       
*note tp_as_buffer: b80.*note PyBufferProcs: 52f1.*note sub-slots: 5613.               %
                       *                                                               
                       
                                                                                       
*note tp_flags: 1c71.  unsigned long                                 X     X           ?
                                                                                       
                                                                                       
*note tp_doc: 4ecb.    const char *           __doc__                X     X
                                                                           
                                                                                       
*note tp_traverse: 982.*note traverseproc: 51ba.                           X           G
                                                                                       
                                                                                       
*note tp_clear: 4ee2.  *note inquiry: 51ab.                                X           G
                                                                                       
                                                                                       
*note tp_richcompare: 4ef0.*note richcmpfunc: 51b3.__lt__, __le__,   X                 G
                                              __eq__, __ne__,                          
                                              __gt__, __ge__
                                              
                                                                                       
(*note tp_weaklistoffset: b7f.)*note Py_ssize_t: c55.                      X           ?
                                                                                       
                                                                                       
*note tp_iter: 1708.   *note getiterfunc: 51a7.__iter__                                X
                                                                                       
                                                                                       
*note tp_iternext: 1709.*note iternextfunc: 51ac.__next__                              X
                                                                                       
                                                                                       
*note tp_methods: 4ed4.*note PyMethodDef: 16f0.                      X     X
                       []                                                  
                       
                                                                                       
*note tp_members: 4ed2.*note PyMemberDef: 771.                             X
                       []                                                  
                       
                                                                                       
*note tp_getset: 4ed7. *note PyGetSetDef: db2.                       X     X
                       []                                                  
                       
                                                                                       
*note tp_base: 2375.   *note PyTypeObject: c9c.__base__                          X
                       *                                                         
                       
                                                                                       
*note tp_dict: 1a8c.   *note PyObject: 5df.   __dict__                           ?
                       *                                                         
                       
                                                                                       
*note tp_descr_get: 5616.*note descrgetfunc: 51a1.__get__                              X
                                                                                       
                                                                                       
*note tp_descr_set: 1cb4.*note descrsetfunc: 51a2.__set__, __delete__                  X
                                                                                       
                                                                                       
(*note tp_dictoffset: 52ec.)*note Py_ssize_t: c55.                         X           ?
                                                                                       
                                                                                       
*note tp_init: 7a1.    *note initproc: 51aa.  __init__               X     X           X
                                                                                       
                                                                                       
*note tp_alloc: 4ed0.  *note allocfunc: 519f.                        X           ?     ?
                                                                                       
                                                                                       
*note tp_new: 79f.     *note newfunc: 51ae.   __new__                X     X     ?     ?
                                                                                       
                                                                                       
*note tp_free: 4ecf.   *note freefunc: 5449.                         X     X     ?     ?
                                                                                       
                                                                                       
*note tp_is_gc: 5617.  *note inquiry: 51ab.                                X           X
                                                                                       
                                                                                       
<*note tp_bases: 5618.>*note PyObject: 5df.   __bases__                          ~
                       *                                                         
                       
                                                                                       
<*note tp_mro: 52ee.>  *note PyObject: 5df.   __mro__                            ~
                       *                                                         
                       
                                                                                       
[*note tp_cache: 52ef.]*note PyObject: 5df.
                       *
                       
                                                                                       
[*note tp_subclasses: 792.]void *             __subclasses__
                                              
                                                                                       
[*note tp_weaklist: 52f0.]*note PyObject: 5df.
                       *
                       
                                                                                       
(*note tp_del: 5619.)  *note destructor: 51a3.
                       
                                                                                       
[*note tp_version_tag: 561a.]unsigned int
                       
                                                                                       
*note tp_finalize: c9d.*note destructor: 51a3.__del__                                  X
                                                                                       
                                                                                       
*note tp_vectorcall: 198a.*note vectorcallfunc: 779.
                       
                                                                                       
[*note tp_watched: 561b.]unsigned char
                       

   ---------- Footnotes ----------

   (1) '()': A slot name in parentheses indicates it is (effectively)
deprecated.

'<>': Names in angle brackets should be initially set to ‘NULL’ and
treated as read-only.

'[]': Names in square brackets are for internal use only.

'<R>' (as a prefix) means the field is required (must be non-‘NULL’).

   (2) 列:

'"O"': set on *note PyBaseObject_Type: 4f75.

'"T"': set on *note PyType_Type: 76f.

'"D"': default (if slot is set to ‘NULL’)

     X - PyType_Ready sets this value if it is NULL
     ~ - PyType_Ready always sets this value (it should be NULL)
     ? - PyType_Ready may set this value depending on other slots

     Also see the inheritance column ("I").

'"I"': inheritance

     X - type slot is inherited via *PyType_Ready* if defined with a *NULL* value
     % - the slots of the sub-struct are inherited individually
     G - inherited, but only in combination with other slots; see the slot's description
     ? - it's complicated; see the slot's description

Note that some slots are effectively inherited through the normal
attribute lookup chain.


File: python.info,  Node: sub-slots,  Next: スロットの定義型 typedef,  Prev: tp スロット,  Up: クイックリファレンス

7.13.4.3 sub-slots
..................

Slot                           *note 型: 5612.       特殊メソッド
                                                     
----------------------------------------------------------------------
                                                     
*note am_await: 561d.          *note unaryfunc: 51bb.__await__
                                                     
                                                     
*note am_aiter: 561e.          *note unaryfunc: 51bb.__aiter__
                                                     
                                                     
*note am_anext: 561f.          *note unaryfunc: 51bb.__anext__
                                                     
                                                     
*note am_send: 5620.           *note sendfunc: 5621.
                               
                                                     
                                                     
*note nb_add: 52e2.            *note binaryfunc: 51a0.__add__
                                                     __radd__
                                                     
                                                     
*note nb_inplace_add: 5622.    *note binaryfunc: 51a0.__iadd__
                                                     
                                                     
*note nb_subtract: 5623.       *note binaryfunc: 51a0.__sub__
                                                     __rsub__
                                                     
                                                     
*note nb_inplace_subtract: 5624.*note binaryfunc: 51a0.__isub__
                                                     
                                                     
*note nb_multiply: 5625.       *note binaryfunc: 51a0.__mul__
                                                     __rmul__
                                                     
                                                     
*note nb_inplace_multiply: 5626.*note binaryfunc: 51a0.__imul__
                                                     
                                                     
*note nb_remainder: 5627.      *note binaryfunc: 51a0.__mod__
                                                     __rmod__
                                                     
                                                     
*note nb_inplace_remainder: 5628.*note binaryfunc: 51a0.__imod__
                                                     
                                                     
*note nb_divmod: 5629.         *note binaryfunc: 51a0.__divmod__
                                                     __rdivmod__
                                                     
                                                     
*note nb_power: 562a.          *note ternaryfunc: 51b9.__pow__
                                                     __rpow__
                                                     
                                                     
*note nb_inplace_power: 562b.  *note ternaryfunc: 51b9.__ipow__
                                                     
                                                     
*note nb_negative: 562c.       *note unaryfunc: 51bb.__neg__
                                                     
                                                     
*note nb_positive: 562d.       *note unaryfunc: 51bb.__pos__
                                                     
                                                     
*note nb_absolute: 562e.       *note unaryfunc: 51bb.__abs__
                                                     
                                                     
*note nb_bool: 562f.           *note inquiry: 51ab.  __bool__
                                                     
                                                     
*note nb_invert: 5630.         *note unaryfunc: 51bb.__invert__
                                                     
                                                     
*note nb_lshift: 5631.         *note binaryfunc: 51a0.__lshift__
                                                     __rlshift__
                                                     
                                                     
*note nb_inplace_lshift: 5632. *note binaryfunc: 51a0.__ilshift__
                                                     
                                                     
*note nb_rshift: 5633.         *note binaryfunc: 51a0.__rshift__
                                                     __rrshift__
                                                     
                                                     
*note nb_inplace_rshift: 5634. *note binaryfunc: 51a0.__irshift__
                                                     
                                                     
*note nb_and: 5635.            *note binaryfunc: 51a0.__and__
                                                     __rand__
                                                     
                                                     
*note nb_inplace_and: 5636.    *note binaryfunc: 51a0.__iand__
                                                     
                                                     
*note nb_xor: 5637.            *note binaryfunc: 51a0.__xor__
                                                     __rxor__
                                                     
                                                     
*note nb_inplace_xor: 5638.    *note binaryfunc: 51a0.__ixor__
                                                     
                                                     
*note nb_or: 5639.             *note binaryfunc: 51a0.__or__ __ror__
                                                     
                                                     
*note nb_inplace_or: 563a.     *note binaryfunc: 51a0.__ior__
                                                     
                                                     
*note nb_int: 563b.            *note unaryfunc: 51bb.__int__
                                                     
                                                     
*note nb_reserved: 563c.       void *
                               
                                                     
*note nb_float: 563d.          *note unaryfunc: 51bb.__float__
                                                     
                                                     
*note nb_floor_divide: 563e.   *note binaryfunc: 51a0.__floordiv__
                                                     
                                                     
*note nb_inplace_floor_divide: 563f.*note binaryfunc: 51a0.__ifloordiv__
                                                     
                                                     
*note nb_true_divide: 5640.    *note binaryfunc: 51a0.__truediv__
                                                     
                                                     
*note nb_inplace_true_divide: 5641.*note binaryfunc: 51a0.__itruediv__
                                                     
                                                     
*note nb_index: 1636.          *note unaryfunc: 51bb.__index__
                                                     
                                                     
*note nb_matrix_multiply: 5642.*note binaryfunc: 51a0.__matmul__
                                                     __rmatmul__
                                                     
                                                     
*note nb_inplace_matrix_multiply: 5643.*note binaryfunc: 51a0.__imatmul__
                                                     
                                                     
                                                     
*note mp_length: 5644.         *note lenfunc: 51ad.  __len__
                                                     
                                                     
*note mp_subscript: 1cf6.      *note binaryfunc: 51a0.__getitem__
                                                     
                                                     
*note mp_ass_subscript: 5645.  *note objobjargproc: 51af.__setitem__,
                                                     __delitem__
                                                     
                                                     
                                                     
*note sq_length: 52eb.         *note lenfunc: 51ad.  __len__
                                                     
                                                     
*note sq_concat: 5646.         *note binaryfunc: 51a0.__add__
                                                     
                                                     
*note sq_repeat: 5647.         *note ssizeargfunc: 51b7.__mul__
                                                     
                                                     
*note sq_item: 1cf5.           *note ssizeargfunc: 51b7.__getitem__
                                                     
                                                     
*note sq_ass_item: 5648.       *note ssizeobjargproc: 51b8.__setitem__
                                                     __delitem__
                                                     
                                                     
*note sq_contains: 5649.       *note objobjproc: 51b0.__contains__
                                                     
                                                     
*note sq_inplace_concat: 564a. *note binaryfunc: 51a0.__iadd__
                                                     
                                                     
*note sq_inplace_repeat: 564b. *note ssizeargfunc: 51b7.__imul__
                                                     
                                                     
                                                     
*note bf_getbuffer: 966.       *note getbufferproc(): 51a6.__buffer__
                                                     
                                                     
*note bf_releasebuffer: 967.   *note releasebufferproc(): 51b1.__release_buffer__
                                                     


File: python.info,  Node: スロットの定義型 typedef,  Prev: sub-slots,  Up: クイックリファレンス

7.13.4.4 スロットの定義型 (typedef)
...................................

定義型 (typedef)                  引数型                            返り値型
                                                                    
-----------------------------------------------------------------------------------------------
                                                                    
*note allocfunc: 519f.                 *note PyTypeObject: c9c. *   *note PyObject: 5df. *
                                       *note Py_ssize_t: c55.       
                                  
                                                                    
*note destructor: 51a3.           *note PyObject: 5df. *            void
                                                                    
                                                                    
*note freefunc: 5449.             void *                            void
                                                                    
                                                                    
*note traverseproc: 51ba.              *note PyObject: 5df. *       int
                                       *note visitproc: 51bc.       
                                       void *
                                  
                                                                    
*note newfunc: 51ae.                   *note PyTypeObject: c9c. *   *note PyObject: 5df. *
                                       *note PyObject: 5df. *       
                                       *note PyObject: 5df. *
                                  
                                                                    
*note initproc: 51aa.                  *note PyObject: 5df. *       int
                                       *note PyObject: 5df. *       
                                       *note PyObject: 5df. *
                                  
                                                                    
*note reprfunc: 51b2.             *note PyObject: 5df. *            *note PyObject: 5df. *
                                                                    
                                                                    
*note getattrfunc: 51a4.               *note PyObject: 5df. *       *note PyObject: 5df. *
                                       const char *                 
                                  
                                                                    
*note setattrfunc: 51b4.               *note PyObject: 5df. *       int
                                       const char *                 
                                       *note PyObject: 5df. *
                                  
                                                                    
*note getattrofunc: 51a5.              *note PyObject: 5df. *       *note PyObject: 5df. *
                                       *note PyObject: 5df. *       
                                  
                                                                    
*note setattrofunc: 51b5.              *note PyObject: 5df. *       int
                                       *note PyObject: 5df. *       
                                       *note PyObject: 5df. *
                                  
                                                                    
*note descrgetfunc: 51a1.              *note PyObject: 5df. *       *note PyObject: 5df. *
                                       *note PyObject: 5df. *       
                                       *note PyObject: 5df. *
                                  
                                                                    
*note descrsetfunc: 51a2.              *note PyObject: 5df. *       int
                                       *note PyObject: 5df. *       
                                       *note PyObject: 5df. *
                                  
                                                                    
*note hashfunc: 51a9.             *note PyObject: 5df. *            Py_hash_t
                                                                    
                                                                    
*note richcmpfunc: 51b3.               *note PyObject: 5df. *       *note PyObject: 5df. *
                                       *note PyObject: 5df. *       
                                       int
                                  
                                                                    
*note getiterfunc: 51a7.          *note PyObject: 5df. *            *note PyObject: 5df. *
                                                                    
                                                                    
*note iternextfunc: 51ac.         *note PyObject: 5df. *            *note PyObject: 5df. *
                                                                    
                                                                    
*note lenfunc: 51ad.              *note PyObject: 5df. *            *note Py_ssize_t: c55.
                                                                    
                                                                    
*note getbufferproc: 51a6.             *note PyObject: 5df. *       int
                                       *note Py_buffer: 95c. *      
                                       int
                                  
                                                                    
*note releasebufferproc: 51b1.         *note PyObject: 5df. *       void
                                       *note Py_buffer: 95c. *      
                                  
                                                                    
*note inquiry: 51ab.              *note PyObject: 5df. *            int
                                                                    
                                                                    
*note unaryfunc: 51bb.                 *note PyObject: 5df. *       *note PyObject: 5df. *
                                                                    
                                                                    
*note binaryfunc: 51a0.                *note PyObject: 5df. *       *note PyObject: 5df. *
                                       *note PyObject: 5df. *       
                                  
                                                                    
*note ternaryfunc: 51b9.               *note PyObject: 5df. *       *note PyObject: 5df. *
                                       *note PyObject: 5df. *       
                                       *note PyObject: 5df. *
                                  
                                                                    
*note ssizeargfunc: 51b7.              *note PyObject: 5df. *       *note PyObject: 5df. *
                                       *note Py_ssize_t: c55.       
                                  
                                                                    
*note ssizeobjargproc: 51b8.           *note PyObject: 5df. *       int
                                       *note Py_ssize_t: c55.       
                                       *note PyObject: 5df. *
                                  
                                                                    
*note objobjproc: 51b0.                *note PyObject: 5df. *       int
                                       *note PyObject: 5df. *       
                                  
                                                                    
*note objobjargproc: 51af.             *note PyObject: 5df. *       int
                                       *note PyObject: 5df. *       
                                       *note PyObject: 5df. *
                                  

See *note Slot Type typedefs: 564d. below for more detail.


File: python.info,  Node: PyTypeObject 定義,  Next: PyObject スロット,  Prev: クイックリファレンス,  Up: Type Object Structures

7.13.4.5 PyTypeObject 定義
..........................

The structure definition for *note PyTypeObject: c9c. can be found in
‘Include/cpython/object.h’.  For convenience of reference, this repeats
the definition found there:

     typedef struct _typeobject {
         PyObject_VAR_HEAD
         const char *tp_name; /* For printing, in format "<module>.<name>" */
         Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */

         /* Methods to implement standard operations */

         destructor tp_dealloc;
         Py_ssize_t tp_vectorcall_offset;
         getattrfunc tp_getattr;
         setattrfunc tp_setattr;
         PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2)
                                         or tp_reserved (Python 3) */
         reprfunc tp_repr;

         /* Method suites for standard classes */

         PyNumberMethods *tp_as_number;
         PySequenceMethods *tp_as_sequence;
         PyMappingMethods *tp_as_mapping;

         /* More standard operations (here for binary compatibility) */

         hashfunc tp_hash;
         ternaryfunc tp_call;
         reprfunc tp_str;
         getattrofunc tp_getattro;
         setattrofunc tp_setattro;

         /* Functions to access object as input/output buffer */
         PyBufferProcs *tp_as_buffer;

         /* Flags to define presence of optional/expanded features */
         unsigned long tp_flags;

         const char *tp_doc; /* Documentation string */

         /* Assigned meaning in release 2.0 */
         /* call function for all accessible objects */
         traverseproc tp_traverse;

         /* delete references to contained objects */
         inquiry tp_clear;

         /* Assigned meaning in release 2.1 */
         /* rich comparisons */
         richcmpfunc tp_richcompare;

         /* weak reference enabler */
         Py_ssize_t tp_weaklistoffset;

         /* Iterators */
         getiterfunc tp_iter;
         iternextfunc tp_iternext;

         /* Attribute descriptor and subclassing stuff */
         PyMethodDef *tp_methods;
         PyMemberDef *tp_members;
         PyGetSetDef *tp_getset;
         // Strong reference on a heap type, borrowed reference on a static type
         PyTypeObject *tp_base;
         PyObject *tp_dict;
         descrgetfunc tp_descr_get;
         descrsetfunc tp_descr_set;
         Py_ssize_t tp_dictoffset;
         initproc tp_init;
         allocfunc tp_alloc;
         newfunc tp_new;
         freefunc tp_free; /* Low-level free-memory routine */
         inquiry tp_is_gc; /* For PyObject_IS_GC */
         PyObject *tp_bases;
         PyObject *tp_mro; /* method resolution order */
         PyObject *tp_cache; /* no longer used */
         void *tp_subclasses;  /* for static builtin types this is an index */
         PyObject *tp_weaklist; /* not used for static builtin types */
         destructor tp_del;

         /* Type attribute cache version tag. Added in version 2.6.
          * If zero, the cache is invalid and must be initialized.
          */
         unsigned int tp_version_tag;

         destructor tp_finalize;
         vectorcallfunc tp_vectorcall;

         /* bitset of which type-watchers care about this type */
         unsigned char tp_watched;

         /* Number of tp_version_tag values used.
          * Set to _Py_ATTR_CACHE_UNUSED if the attribute cache is
          * disabled for this type (e.g. due to custom MRO entries).
          * Otherwise, limited to MAX_VERSIONS_PER_CLASS (defined elsewhere).
          */
         uint16_t tp_versions_used;
     } PyTypeObject;


File: python.info,  Node: PyObject スロット,  Next: PyVarObject スロット,  Prev: PyTypeObject 定義,  Up: Type Object Structures

7.13.4.6 PyObject スロット
..........................

The type object structure extends the *note PyVarObject: 46d6.
structure.  The *note ob_size: 511c. field is used for dynamic types
(created by ‘type_new()’, usually called from a class statement).  Note
that *note PyType_Type: 76f. (the metatype) initializes *note
tp_itemsize: 23bb, which means that its instances (i.e.  type objects)
'must' have the *note ob_size: 511c. field.

*note PyObject.ob_refcnt: a9f.

     The type object's reference count is initialized to ‘1’ by the
     ‘PyObject_HEAD_INIT’ macro.  Note that for *note statically
     allocated type objects: 983, the type's instances (objects whose
     *note ob_type: 4ecd. points back to the type) do 'not' count as
     references.  But for *note dynamically allocated type objects: b5e,
     the instances 'do' count as references.

     '継承:'

     サブタイプはこのフィールドを継承しません。

*note PyObject.ob_type: 4ecd.

     型自体の型、別の言い方をするとメタタイプです。 ‘PyObject_HEAD_INIT’
     マクロで初期化され、通常は ‘&PyType_Type’ になります。しかし、(少な
     くとも) Windows で利用できる動的ロード可能な拡張モジュールでは、コ
     ンパイラは有効な初期化ではないと文句をつけます。そこで、ならわしと
     して、 ‘PyObject_HEAD_INIT’ には ‘NULL’ を渡して初期化しておき、他
     の操作を行う前にモジュールの初期化関数で明示的にこのフィールドを初
     期化することになっています。この操作は以下のように行います:

          Foo_Type.ob_type = &PyType_Type;

     This should be done before any instances of the type are created.
     *note PyType_Ready(): 980. checks if *note ob_type: 4ecd. is
     ‘NULL’, and if so, initializes it to the *note ob_type: 4ecd. field
     of the base class.  *note PyType_Ready(): 980. will not change this
     field if it is non-zero.

     '継承:'

     サブタイプはこのフィールドを継承します。


File: python.info,  Node: PyVarObject スロット,  Next: PyTypeObject スロット,  Prev: PyObject スロット,  Up: Type Object Structures

7.13.4.7 PyVarObject スロット
.............................

*note PyVarObject.ob_size: 511c.

     *note 静的にメモリ確保されている型オブジェクト: 983. の場合、このフ
     ィールドはゼロに初期化されます。*note
     動的にメモリ確保されている型オブジェクト: b5e. の場合、このフィール
     ドは内部使用される特殊な意味を持ちます。

     This field should be accessed using the *note Py_SIZE(): 985.
     macro.

     '継承:'

     サブタイプはこのフィールドを継承しません。


File: python.info,  Node: PyTypeObject スロット,  Next: Static Types,  Prev: PyVarObject スロット,  Up: Type Object Structures

7.13.4.8 PyTypeObject スロット
..............................

Each slot has a section describing inheritance.  If *note
PyType_Ready(): 980. may set a value when the field is set to ‘NULL’
then there will also be a "Default" section.  (Note that many fields set
on *note PyBaseObject_Type: 4f75. and *note PyType_Type: 76f.
effectively act as defaults.)

 -- C のメンバ変数: const char **note PyTypeObject: c9c.tp_name

     Pointer to a NUL-terminated string containing the name of the type.
     For types that are accessible as module globals, the string should
     be the full module name, followed by a dot, followed by the type
     name; for built-in types, it should be just the type name.  If the
     module is a submodule of a package, the full package name is part
     of the full module name.  For example, a type named ‘T’ defined in
     module ‘M’ in subpackage ‘Q’ in package ‘P’ should have the *note
     tp_name: 1cb0. initializer ‘"P.Q.M.T"’.

     *note 動的にメモリ確保される型オブジェクト: b5e. の場合、このフィー
     ルドは単に型の名前になり、モジュール名は型の辞書内でキー
     ‘'__module__'’ に対する値として明示的に保存されます。

     For *note statically allocated type objects: 983, the 'tp_name'
     field should contain a dot.  Everything before the last dot is made
     accessible as the *note __module__: 617. attribute, and everything
     after the last dot is made accessible as the *note __name__: 16c4.
     attribute.

     If no dot is present, the entire *note tp_name: 1cb0. field is made
     accessible as the *note __name__: 16c4. attribute, and the *note
     __module__: 617. attribute is undefined (unless explicitly set in
     the dictionary, as explained above).  This means your type will be
     impossible to pickle.  Additionally, it will not be listed in
     module documentations created with pydoc.

     This field must not be ‘NULL’.  It is the only required field in
     *note PyTypeObject(): c9c. (other than potentially *note
     tp_itemsize: 23bb.).

     '継承:'

     サブタイプはこのフィールドを継承しません。

 -- C のメンバ変数: *note Py_ssize_t: c55. *note PyTypeObject:
          c9c.tp_basicsize
 -- C のメンバ変数: *note Py_ssize_t: c55. *note PyTypeObject:
          c9c.tp_itemsize

     これらのフィールドは、型インスタンスのバイトサイズを計算できるよう
     にします。

     There are two kinds of types: types with fixed-length instances
     have a zero ‘tp_itemsize’ field, types with variable-length
     instances have a non-zero ‘tp_itemsize’ field.  For a type with
     fixed-length instances, all instances have the same size, given in
     ‘tp_basicsize’.  (Exceptions to this rule can be made using *note
     PyUnstable_Object_GC_NewWithExtraData(): 1aa8.)

     For a type with variable-length instances, the instances must have
     an *note ob_size: 511c. field, and the instance size is
     ‘tp_basicsize’ plus N times ‘tp_itemsize’, where N is the "length"
     of the object.

     Functions like *note PyObject_NewVar(): b7d. will take the value of
     N as an argument, and store in the instance's *note ob_size: 511c.
     field.  Note that the *note ob_size: 511c. field may later be used
     for other purposes.  For example, *note int: 19b. instances use the
     bits of *note ob_size: 511c. in an implementation-defined way; the
     underlying storage and its size should be accessed using *note
     PyLong_Export(): 3a8.

          注釈: The *note ob_size: 511c. field should be accessed using
          the *note Py_SIZE(): 985. and *note Py_SET_SIZE(): 986.
          macros.

     Also, the presence of an *note ob_size: 511c. field in the instance
     layout doesn't mean that the instance structure is variable-length.
     For example, the *note list: 24d. type has fixed-length instances,
     yet those instances have a *note ob_size: 511c. field.  (As with
     *note int: 19b, avoid reading lists' ‘ob_size’ directly.  Call
     *note PyList_Size(): 1633. instead.)

     The ‘tp_basicsize’ includes size needed for data of the type's
     *note tp_base: 2375, plus any extra data needed by each instance.

     The correct way to set ‘tp_basicsize’ is to use the ‘sizeof’
     operator on the struct used to declare the instance layout.  This
     struct must include the struct used to declare the base type.  In
     other words, ‘tp_basicsize’ must be greater than or equal to the
     base's ‘tp_basicsize’.

     Since every type is a subtype of *note object: c7e, this struct
     must include *note PyObject: 5df. or *note PyVarObject: 46d6.
     (depending on whether *note ob_size: 511c. should be included).
     These are usually defined by the macro *note PyObject_HEAD: 14f5.
     or *note PyObject_VAR_HEAD: 55ed, respectively.

     The basic size does not include the GC header size, as that header
     is not part of *note PyObject_HEAD: 14f5.

     For cases where struct used to declare the base type is unknown,
     see *note PyType_Spec.basicsize: 76a. and *note
     PyType_FromMetaclass(): 772.

     Notes about alignment:

        - ‘tp_basicsize’ must be a multiple of ‘_Alignof(PyObject)’.
          When using ‘sizeof’ on a ‘struct’ that includes *note
          PyObject_HEAD: 14f5, as recommended, the compiler ensures
          this.  When not using a C ‘struct’, or when using compiler
          extensions like ‘__attribute__((packed))’, it is up to you.

        - If the variable items require a particular alignment,
          ‘tp_basicsize’ and ‘tp_itemsize’ must each be a multiple of
          that alignment.  For example, if a type's variable part stores
          a ‘double’, it is your responsibility that both fields are a
          multiple of ‘_Alignof(double)’.

     '継承:'

     These fields are inherited separately by subtypes.  (That is, if
     the field is set to zero, *note PyType_Ready(): 980. will copy the
     value from the base type, indicating that the instances do not need
     additional storage.)

     If the base type has a non-zero *note tp_itemsize: 23bb, it is
     generally not safe to set *note tp_itemsize: 23bb. to a different
     non-zero value in a subtype (though this depends on the
     implementation of the base type).

 -- C のメンバ変数: *note destructor: 51a3. *note PyTypeObject:
          c9c.tp_dealloc

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_dealloc’ is part of
     the *note Stable ABI: 775.'

     A pointer to the instance destructor function.  The function
     signature is:

          void tp_dealloc(PyObject *self);

     The destructor function should remove all references which the
     instance owns (e.g., call *note Py_CLEAR(): 798.), free all memory
     buffers owned by the instance, and call the type's *note tp_free:
     4ecf. function to free the object itself.

     If you may call functions that may set the error indicator, you
     must use *note PyErr_GetRaisedException(): 429. and *note
     PyErr_SetRaisedException(): 42c. to ensure you don't clobber a
     preexisting error indicator (the deallocation could have occurred
     while processing a different error):

          static void
          foo_dealloc(foo_object *self)
          {
              PyObject *et, *ev, *etb;
              PyObject *exc = PyErr_GetRaisedException();
              ...
              PyErr_SetRaisedException(exc);
          }

     The dealloc handler itself must not raise an exception; if it hits
     an error case it should call *note PyErr_FormatUnraisable(): 5f1.
     to log (and clear) an unraisable exception.

     No guarantees are made about when an object is destroyed, except:

        * Python will destroy an object immediately or some time after
          the final reference to the object is deleted, unless its
          finalizer (*note tp_finalize: c9d.) subsequently resurrects
          the object.

        * An object will not be destroyed while it is being
          automatically finalized (*note tp_finalize: c9d.) or
          automatically cleared (*note tp_clear: 4ee2.).

     CPython currently destroys an object immediately from *note
     Py_DECREF(): 790. when the new reference count is zero, but this
     may change in a future version.

     It is recommended to call *note
     PyObject_CallFinalizerFromDealloc(): 55e3. at the beginning of
     ‘tp_dealloc’ to guarantee that the object is always finalized
     before destruction.

     If the type supports garbage collection (the *note
     Py_TPFLAGS_HAVE_GC: 981. flag is set), the destructor should call
     *note PyObject_GC_UnTrack(): 171e. before clearing any member
     fields.

     It is permissible to call *note tp_clear: 4ee2. from ‘tp_dealloc’
     to reduce code duplication and to guarantee that the object is
     always cleared before destruction.  Beware that ‘tp_clear’ might
     have already been called.

     If the type is heap allocated (*note Py_TPFLAGS_HEAPTYPE: aac.),
     the deallocator should release the owned reference to its type
     object (via *note Py_DECREF(): 790.) after calling the type
     deallocator.  See the example code below.:

          static void
          foo_dealloc(PyObject *op)
          {
             foo_object *self = (foo_object *) op;
             PyObject_GC_UnTrack(self);
             Py_CLEAR(self->ref);
             Py_TYPE(self)->tp_free(self);
          }

     ‘tp_dealloc’ must leave the exception status unchanged.  If it
     needs to call something that might raise an exception, the
     exception state must be backed up first and restored later (after
     logging any exceptions with *note PyErr_WriteUnraisable(): 5f2.).

     以下はプログラム例です:

          static void
          foo_dealloc(PyObject *self)
          {
              PyObject *exc = PyErr_GetRaisedException();

              if (PyObject_CallFinalizerFromDealloc(self) < 0) {
                  // self was resurrected.
                  goto done;
              }

              PyTypeObject *tp = Py_TYPE(self);

              if (tp->tp_flags & Py_TPFLAGS_HAVE_GC) {
                  PyObject_GC_UnTrack(self);
              }

              // Optional, but convenient to avoid code duplication.
              if (tp->tp_clear && tp->tp_clear(self) < 0) {
                  PyErr_WriteUnraisable(self);
              }

              // Any additional destruction goes here.

              tp->tp_free(self);
              self = NULL;  // In case PyErr_WriteUnraisable() is called below.

              if (tp->tp_flags & Py_TPFLAGS_HEAPTYPE) {
                  Py_CLEAR(tp);
              }

          done:
              // Optional, if something was called that might have raised an
              // exception.
              if (PyErr_Occurred()) {
                  PyErr_WriteUnraisable(self);
              }
              PyErr_SetRaisedException(exc);
          }

     ‘tp_dealloc’ may be called from any Python thread, not just the
     thread which created the object (if the object becomes part of a
     refcount cycle, that cycle might be collected by a garbage
     collection on any thread).  This is not a problem for Python API
     calls, since the thread on which ‘tp_dealloc’ is called with an
     *note attached thread state: 4ed1.  However, if the object being
     destroyed in turn destroys objects from some other C library, care
     should be taken to ensure that destroying those objects on the
     thread which called ‘tp_dealloc’ will not violate any assumptions
     of the library.

     '継承:'

     サブタイプはこのフィールドを継承します。

     参考
     ....

     *note Object Life Cycle: 55df. for details about how this slot
     relates to other slots.

 -- C のメンバ変数: *note Py_ssize_t: c55. *note PyTypeObject:
          c9c.tp_vectorcall_offset

     An optional offset to a per-instance function that implements
     calling the object using the *note vectorcall protocol: 774, a more
     efficient alternative of the simpler *note tp_call: 77b.

     This field is only used if the flag *note
     Py_TPFLAGS_HAVE_VECTORCALL: 776. is set.  If so, this must be a
     positive integer containing the offset in the instance of a *note
     vectorcallfunc: 779. pointer.

     The 'vectorcallfunc' pointer may be ‘NULL’, in which case the
     instance behaves as if *note Py_TPFLAGS_HAVE_VECTORCALL: 776. was
     not set: calling the instance falls back to *note tp_call: 77b.

     Any class that sets ‘Py_TPFLAGS_HAVE_VECTORCALL’ must also set
     *note tp_call: 77b. and make sure its behaviour is consistent with
     the 'vectorcallfunc' function.  This can be done by setting
     'tp_call' to *note PyVectorcall_Call(): 778.

     バージョン 3.8 で変更: Before version 3.8, this slot was named
     ‘tp_print’.  In Python 2.x, it was used for printing to a file.  In
     Python 3.0 to 3.7, it was unused.

     バージョン 3.12 で変更: Before version 3.12, it was not recommended
     for *note mutable heap types: b5e. to implement the vectorcall
     protocol.  When a user sets *note __call__: 77a. in Python code,
     only 'tp_call' is updated, likely making it inconsistent with the
     vectorcall function.  Since 3.12, setting ‘__call__’ will disable
     vectorcall optimization by clearing the *note
     Py_TPFLAGS_HAVE_VECTORCALL: 776. flag.

     '継承:'

     This field is always inherited.  However, the *note
     Py_TPFLAGS_HAVE_VECTORCALL: 776. flag is not always inherited.  If
     it's not set, then the subclass won't use *note vectorcall: 774,
     except when *note PyVectorcall_Call(): 778. is explicitly called.

 -- C のメンバ変数: *note getattrfunc: 51a4. *note PyTypeObject:
          c9c.tp_getattr

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_getattr’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、get-attribute-string を行う関数を指します。

     このフィールドは非推奨です。 このフィールドを定義するときは、 *note
     tp_getattro: 1a64. 関数と同じように動作し、属性名は Python 文字列 オ
     ブジェクトではなく C 文字列で指定するような関数を指すようにしなけれ
     ばなりません。

     '継承:'

     Group: *note tp_getattr: 4eed, *note tp_getattro: 1a64.

     このフィールドは *note tp_getattro: 1a64. と共にサブタイプに継承さ
     れます: すなわち、サブタイプの *note tp_getattr: 4eed. および *note
     tp_getattro: 1a64. が共に ‘NULL’ の場合、サブタイプは基底タイプから
     *note tp_getattr: 4eed. と *note tp_getattro: 1a64. を両方とも継承
     します。

 -- C のメンバ変数: *note setattrfunc: 51b4. *note PyTypeObject:
          c9c.tp_setattr

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_setattr’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、属性の設定と削除を行う関数を指します。

     このフィールドは非推奨です。 このフィールドを定義するときは、 *note
     tp_setattro: 4ee8. 関数と同じように動作し、属性名は Python 文字列 オ
     ブジェクトではなく C 文字列で指定するような関数を指すようにしなけれ
     ばなりません。

     '継承:'

     Group: *note tp_setattr: 4eee, *note tp_setattro: 4ee8.

     このフィールドは *note tp_setattro: 4ee8. と共にサブタイプに継承さ
     れます: すなわち、サブタイプの *note tp_setattr: 4eee. および *note
     tp_setattro: 4ee8. が共に ‘NULL’ の場合、サブタイプは基底タイプから
     *note tp_setattr: 4eee. と *note tp_setattro: 4ee8. を両方とも継承
     します。

 -- C のメンバ変数: *note PyAsyncMethods: 52ea. **note PyTypeObject:
          c9c.tp_as_async

     追加の構造体を指すポインタです。 この構造体は、 C レベルで *note
     awaitable: 4c9. プロトコルと *note asynchronous iterator: 4c7. プロ
     トコルを実装するオブジェクトだけに関係するフィールドを持ちます。 詳
     しいことは *note async オブジェクト構造体: 5652. を参照してください
     。

     Added in version 3.5: 以前は ‘tp_compare’ や ‘tp_reserved’ として知
     られていました。

     '継承:'

     *note tp_as_async: 10cf. フィールドは継承されませんが、これに含まれ
     るフィールドが個別に継承されます。

 -- C のメンバ変数: *note reprfunc: 51b2. *note PyTypeObject:
          c9c.tp_repr

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_repr’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、組み込み関数 *note repr(): 1c1. を実装して
     いる関数を指します。

     The signature is the same as for *note PyObject_Repr(): 1230.:

          PyObject *tp_repr(PyObject *self);

     この関数は文字列オブジェクトか Unicode オブジェクトを返さなければな
     りません。理想的には、この関数が返す文字列は、適切な環境で *note
     eval(): 4a3. に渡した場合、同じ値を持つオブジェクトになるような文字
     列でなければなりません。不可能な場合には、オブジェクトの型と値から
     導出した内容の入った ‘'<'’ から始まって ‘'>'’ で終わる文字列を返さ
     なければなりません。

     '継承:'

     サブタイプはこのフィールドを継承します。

     'デフォルト'

     このフィールドが設定されていない場合、 ‘<%s object at %p>’ の形式を
     とる文字列が返されます。 ‘%s’ は型の名前に、 ‘%p’ はオブジェクトの
     メモリアドレスに置き換えられます。

 -- C のメンバ変数: *note PyNumberMethods: 1637. **note PyTypeObject:
          c9c.tp_as_number

     数値プロトコルを実装した追加の構造体を指すポインタです。これらのフ
     ィールドについては *note 数値オブジェクト構造体: 5653. で説明されて
     います。

     '継承:'

     *note tp_as_number: b82. フィールドは継承されませんが、そこの含まれ
     るフィールドが個別に継承されます。

 -- C のメンバ変数: *note PySequenceMethods: 4ef4. **note PyTypeObject:
          c9c.tp_as_sequence

     シーケンスプロトコルを実装した追加の構造体を指すポインタです。これ
     らのフィールドについては *note シーケンスオブジェクト構造体: 5654.
     で説明されています。

     '継承:'

     *note tp_as_sequence: 5614. フィールドは継承されませんが、これに含
     まれるフィールドが個別に継承されます。

 -- C のメンバ変数: *note PyMappingMethods: 4ef5. **note PyTypeObject:
          c9c.tp_as_mapping

     マッピングプロトコルを実装した追加の構造体を指すポインタです。これ
     らのフィールドについては *note マップオブジェクト構造体: 5655. で説
     明されています。

     '継承:'

     *note tp_as_mapping: 5615. フィールドは継承されませんが、これに含ま
     れるフィールドが個別に継承されます。

 -- C のメンバ変数: *note hashfunc: 51a9. *note PyTypeObject:
          c9c.tp_hash

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_hash’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、組み込み関数 *note hash(): 801. を実装して
     いる関数を指します。

     The signature is the same as for *note PyObject_Hash(): 436.:

          Py_hash_t tp_hash(PyObject *);

     通常時には ‘-1’ を戻り値にしてはなりません; ハッシュ値の計算中にエ
     ラーが生じた場合、関数は例外をセットして ‘-1’ を返さねばなりません
     。

     When this field is not set ('and' *note tp_richcompare: 4ef0. is
     not set), an attempt to take the hash of the object raises *note
     TypeError: 198.  This is the same as setting it to *note
     PyObject_HashNotImplemented(): 15e0.

     このフィールドは明示的に *note PyObject_HashNotImplemented(): 15e0.
     に設定することで、親 type からのハッシュメソッドの継承をブロックす
     ることができます。これは Python レベルでの ‘__hash__ = None’ と同等
     に解釈され、 ‘isinstance(o, collections.Hashable)’ が正しく ‘False’
     を返すようになります。逆もまた可能であることに注意してください -
     Python レベルで ‘__hash__ = None’ を設定することで ‘tp_hash’ スロッ
     トは *note PyObject_HashNotImplemented(): 15e0. に設定されます。

     '継承:'

     Group: *note tp_hash: 4ef6, *note tp_richcompare: 4ef0.

     このフィールドは *note tp_richcompare: 4ef0. と共にサブタイプに継承
     されます: すなわち、サブタイプの *note tp_richcompare: 4ef0. および
     *note tp_hash: 4ef6. が両方とも ‘NULL’ のとき、サブタイプは基底タイ
     プから *note tp_richcompare: 4ef0. と *note tp_hash: 4ef6. を両方と
     も継承します。

     'デフォルト'

     *note PyBaseObject_Type: 4f75. uses *note PyObject_GenericHash():
     60c.

 -- C のメンバ変数: *note ternaryfunc: 51b9. *note PyTypeObject:
          c9c.tp_call

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_call’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、オブジェクトの呼び出しを実装している関数を
     指します。オブジェクトが呼び出し可能でない場合には ‘NULL’ にしなけ
     ればなりません。シグネチャは *note PyObject_Call(): 63d. と同じです
     。

          PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);

     '継承:'

     サブタイプはこのフィールドを継承します。

 -- C のメンバ変数: *note reprfunc: 51b2. *note PyTypeObject: c9c.tp_str

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_str’ is part of the
     *note Stable ABI: 775.'

     オプションのポインタで、組み込みの演算 *note str(): 169. を実装して
     いる関数を指します。(*note str: 169. が型の一つになったため、 *note
     str(): 169. は *note str: 169. のコンストラクタを呼び出すことに注意
     してください。このコンストラクタは実際の処理を行う上で *note
     PyObject_Str(): 1231. を呼び出し、さらに *note PyObject_Str():
     1231. がこのハンドラを呼び出すことになります。)

     The signature is the same as for *note PyObject_Str(): 1231.:

          PyObject *tp_str(PyObject *self);

     この関数は文字列オブジェクトか Unicode オブジェクトを返さなければな
     りません。それはオブジェクトを "分かりやすく (friendly)" 表現した文
     字列でなければなりません。というのは、この文字列はとりわけ *note
     print(): 1177. 関数で使われることになる表記だからです。

     '継承:'

     サブタイプはこのフィールドを継承します。

     'デフォルト'

     このフィールドが設定されていない場合、文字列表現を返すためには
     *note PyObject_Repr(): 1230. が呼び出されます。

 -- C のメンバ変数: *note getattrofunc: 51a5. *note PyTypeObject:
          c9c.tp_getattro

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_getattro’ is part
     of the *note Stable ABI: 775.'

     オプションのポインタで、get-attribute を実装している関数を指します
     。

     The signature is the same as for *note PyObject_GetAttr(): 5ee.:

          PyObject *tp_getattro(PyObject *self, PyObject *attr);

     通常の属性検索を実装している *note PyObject_GenericGetAttr(): 508e.
     をこのフィールドに設定しておくとたいていの場合は便利です。

     '継承:'

     Group: *note tp_getattr: 4eed, *note tp_getattro: 1a64.

     このフィールドは *note tp_getattr: 4eed. と共にサブタイプに継承され
     ます: すなわち、サブタイプの *note tp_getattr: 4eed. および *note
     tp_getattro: 1a64. が共に ‘NULL’ の場合、サブタイプは基底タイプから
     *note tp_getattr: 4eed. と *note tp_getattro: 1a64. を両方とも継承
     します。

     'デフォルト'

     *note PyBaseObject_Type: 4f75. uses *note
     PyObject_GenericGetAttr(): 508e.

 -- C のメンバ変数: *note setattrofunc: 51b5. *note PyTypeObject:
          c9c.tp_setattro

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_setattro’ is part
     of the *note Stable ABI: 775.'

     オプションのポインタで、属性の設定と削除を行う関数を指します。

     The signature is the same as for *note PyObject_SetAttr(): 5097.:

          int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);

     さらに、'value' に ‘NULL’ を指定して属性を削除できるようにしなけれ
     ばなりません。 通常のオブジェクト属性設定を実装している *note
     PyObject_GenericSetAttr(): 508f. をこのフィールドに設定しておくとた
     いていの場合は便利です。

     '継承:'

     Group: *note tp_setattr: 4eee, *note tp_setattro: 4ee8.

     このフィールドは *note tp_setattr: 4eee. と共にサブタイプに継承され
     ます: すなわち、サブタイプの *note tp_setattr: 4eee. および *note
     tp_setattro: 4ee8. が共に ‘NULL’ の場合、サブタイプは基底タイプから
     *note tp_setattr: 4eee. と *note tp_setattro: 4ee8. を両方とも継承
     します。

     'デフォルト'

     *note PyBaseObject_Type: 4f75. uses *note
     PyObject_GenericSetAttr(): 508f.

 -- C のメンバ変数: *note PyBufferProcs: 52f1. **note PyTypeObject:
          c9c.tp_as_buffer

     バッファインターフェースを実装しているオブジェクトにのみ関連する、
     一連のフィールド群が入った別の構造体を指すポインタです。構造体内の
     各フィールドは *note バッファオブジェクト構造体 (buffer object
     structure): 1248. で説明します。

     '継承:'

     *note tp_as_buffer: b80. フィールド自体は継承されませんが、これに含
     まれるフィールドは個別に継承されます。

 -- C のメンバ変数: unsigned long *note PyTypeObject: c9c.tp_flags

     このフィールドは様々なフラグからなるビットマスクです。いくつかのフ
     ラグは、特定の状況において変則的なセマンティクスが適用されることを
     示します; その他のフラグは、型オブジェクト (あるいは *note
     tp_as_number: b82. 、 *note tp_as_sequence: 5614. 、 *note
     tp_as_mapping: 5615. 、 および *note tp_as_buffer: b80. が参照して
     いる拡張機能構造体) の特定のフィールドのうち、過去から現在までずっ
     と存在していたわけではないものが有効になっていることを示すために使
     われます; フラグビットがクリアされていれば、フラグが保護しているフ
     ィールドにはアクセスしない代わりに、その値はゼロか ‘NULL’ になって
     いるとみなさなければなりません。

     '継承:'

     Inheritance of this field is complicated.  Most flag bits are
     inherited individually, i.e.  if the base type has a flag bit set,
     the subtype inherits this flag bit.  The flag bits that pertain to
     extension structures are strictly inherited if the extension
     structure is inherited, i.e.  the base type's value of the flag bit
     is copied into the subtype together with a pointer to the extension
     structure.  The *note Py_TPFLAGS_HAVE_GC: 981. flag bit is
     inherited together with the *note tp_traverse: 982. and *note
     tp_clear: 4ee2. fields, i.e.  if the *note Py_TPFLAGS_HAVE_GC: 981.
     flag bit is clear in the subtype and the *note tp_traverse: 982.
     and *note tp_clear: 4ee2. fields in the subtype exist and have
     ‘NULL’ values.

     'デフォルト'

     *note PyBaseObject_Type: 4f75. uses ‘Py_TPFLAGS_DEFAULT |
     Py_TPFLAGS_BASETYPE’.

     'Bit Masks:'

     以下に挙げるビットマスクは現在定義されているものです; フラグは ‘|’
     演算子で論理和を取って *note tp_flags: 1c71. フィールドの値を作成で
     きます。 *note PyType_HasFeature(): 1d3c. マクロは型とフラグ値、
     'tp' および 'f' をとり、 ‘tp->tp_flags & f’ が非ゼロかどうか調べま
     す。

      -- C のマクロ: Py_TPFLAGS_HEAPTYPE

          This bit is set when the type object itself is allocated on
          the heap, for example, types created dynamically using *note
          PyType_FromSpec(): 79d.  In this case, the *note ob_type:
          4ecd. field of its instances is considered a reference to the
          type, and the type object is INCREF'ed when a new instance is
          created, and DECREF'ed when an instance is destroyed (this
          does not apply to instances of subtypes; only the type
          referenced by the instance's ob_type gets INCREF'ed or
          DECREF'ed).  Heap types should also *note support garbage
          collection: 5656. as they can form a reference cycle with
          their own module object.

          '継承:'

          ???

      -- C のマクロ: Py_TPFLAGS_BASETYPE
          ' 次に属します: *note Stable ABI: 775.'  型を別の型の基底タイ
          プとして使える場合にセットされるビットです。このビットがクリア
          ならば、この型のサブタイプは生成できません (Java における
          "final" クラスに似たクラスになります)。

          '継承:'

          ???

      -- C のマクロ: Py_TPFLAGS_READY

          型オブジェクトが *note PyType_Ready(): 980. で完全に初期化され
          るとセットされるビットです。

          '継承:'

          ???

      -- C のマクロ: Py_TPFLAGS_READYING

          *note PyType_Ready(): 980. による型オブジェクトの初期化処理中
          にセットされるビットです。

          '継承:'

          ???

      -- C のマクロ: Py_TPFLAGS_HAVE_GC
          ' 次に属します: *note Stable ABI: 775.'  This bit is set when
          the object supports garbage collection.  If this bit is set,
          memory for new instances (see *note tp_alloc: 4ed0.) must be
          allocated using *note PyObject_GC_New: c99. or *note
          PyType_GenericAlloc(): c61. and deallocated (see *note
          tp_free: 4ecf.) using *note PyObject_GC_Del(): 171c.  More
          information in section *note
          循環参照ガベージコレクションをサポートする: 5656.

          '継承:'

          Group: *note Py_TPFLAGS_HAVE_GC: 981, *note tp_traverse: 982,
          *note tp_clear: 4ee2.

          The *note Py_TPFLAGS_HAVE_GC: 981. flag bit is inherited
          together with the *note tp_traverse: 982. and *note tp_clear:
          4ee2. fields, i.e.  if the *note Py_TPFLAGS_HAVE_GC: 981. flag
          bit is clear in the subtype and the *note tp_traverse: 982.
          and *note tp_clear: 4ee2. fields in the subtype exist and have
          ‘NULL’ values.

      -- C のマクロ: Py_TPFLAGS_DEFAULT
          ' 次に属します: *note Stable ABI: 775.'  This is a bitmask of
          all the bits that pertain to the existence of certain fields
          in the type object and its extension structures.  Currently,
          it includes the following bits:
          ‘Py_TPFLAGS_HAVE_STACKLESS_EXTENSION’.

          '継承:'

          ???

      -- C のマクロ: Py_TPFLAGS_METHOD_DESCRIPTOR
          ' 次に属します: *note Stable ABI: 775. (バージョン 3.8 より).'
          This bit indicates that objects behave like unbound methods.

          If this flag is set for ‘type(meth)’, then:

             - ‘meth.__get__(obj, cls)(*args, **kwds)’ (with ‘obj’ not
               None) must be equivalent to ‘meth(obj, *args, **kwds)’.

             - ‘meth.__get__(None, cls)(*args, **kwds)’ must be
               equivalent to ‘meth(*args, **kwds)’.

          This flag enables an optimization for typical method calls
          like ‘obj.meth()’: it avoids creating a temporary "bound
          method" object for ‘obj.meth’.

          Added in version 3.8.

          '継承:'

          This flag is never inherited by types without the *note
          Py_TPFLAGS_IMMUTABLETYPE: 3cf. flag set.  For extension types,
          it is inherited whenever *note tp_descr_get: 5616. is
          inherited.

      -- C のマクロ: Py_TPFLAGS_MANAGED_DICT

          This bit indicates that instances of the class have a *note
          __dict__: 77d. attribute, and that the space for the
          dictionary is managed by the VM.

          If this flag is set, *note Py_TPFLAGS_HAVE_GC: 981. should
          also be set.

          The type traverse function must call *note
          PyObject_VisitManagedDict(): 60d. and its clear function must
          call *note PyObject_ClearManagedDict(): 60e.

          Added in version 3.12.

          '継承:'

          This flag is inherited unless the *note tp_dictoffset: 52ec.
          field is set in a superclass.

      -- C のマクロ: Py_TPFLAGS_MANAGED_WEAKREF

          This bit indicates that instances of the class should be
          weakly referenceable.

          Added in version 3.12.

          '継承:'

          This flag is inherited unless the *note tp_weaklistoffset:
          b7f. field is set in a superclass.

      -- C のマクロ: Py_TPFLAGS_ITEMS_AT_END
          ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より
          ).'  Only usable with variable-size types, i.e.  ones with
          non-zero *note tp_itemsize: 23bb.

          Indicates that the variable-sized portion of an instance of
          this type is at the end of the instance's memory area, at an
          offset of ‘Py_TYPE(obj)->tp_basicsize’ (which may be different
          in each subclass).

          When setting this flag, be sure that all superclasses either
          use this memory layout, or are not variable-sized.  Python
          does not check this.

          Added in version 3.12.

          '継承:'

          This flag is inherited.

      -- C のマクロ: Py_TPFLAGS_LONG_SUBCLASS

      -- C のマクロ: Py_TPFLAGS_LIST_SUBCLASS

      -- C のマクロ: Py_TPFLAGS_TUPLE_SUBCLASS

      -- C のマクロ: Py_TPFLAGS_BYTES_SUBCLASS

      -- C のマクロ: Py_TPFLAGS_UNICODE_SUBCLASS

      -- C のマクロ: Py_TPFLAGS_DICT_SUBCLASS

      -- C のマクロ: Py_TPFLAGS_BASE_EXC_SUBCLASS

      -- C のマクロ: Py_TPFLAGS_TYPE_SUBCLASS

          Functions such as *note PyLong_Check(): 52fc. will call *note
          PyType_FastSubclass(): 52de. with one of these flags to
          quickly determine if a type is a subclass of a built-in type;
          such specific checks are faster than a generic check, like
          *note PyObject_IsInstance(): 10a6.  Custom types that inherit
          from built-ins should have their *note tp_flags: 1c71. set
          appropriately, or the code that interacts with such types will
          behave differently depending on what kind of check is used.

      -- C のマクロ: Py_TPFLAGS_HAVE_FINALIZE

          型構造体に *note tp_finalize: c9d. スロットが存在しているとき
          にセットされるビットです。

          Added in version 3.4.

          バージョン 3.8 で非推奨: This flag isn't necessary anymore, as
          the interpreter assumes the *note tp_finalize: c9d. slot is
          always present in the type structure.

      -- C のマクロ: Py_TPFLAGS_HAVE_VECTORCALL
          ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より
          ).'  This bit is set when the class implements the *note
          vectorcall protocol: 774.  See *note tp_vectorcall_offset:
          5296. for details.

          '継承:'

          This bit is inherited if *note tp_call: 77b. is also
          inherited.

          Added in version 3.8: as ‘_Py_TPFLAGS_HAVE_VECTORCALL’

          バージョン 3.9 で変更.

          Renamed to the current name, without the leading underscore.
          The old provisional name is *note soft deprecated: 23d.

          バージョン 3.12 で変更: This flag is now removed from a class
          when the class's *note __call__(): 77a. method is reassigned.

          This flag can now be inherited by mutable classes.

      -- C のマクロ: Py_TPFLAGS_IMMUTABLETYPE

          This bit is set for type objects that are immutable: type
          attributes cannot be set nor deleted.

          *note PyType_Ready(): 980. automatically applies this flag to
          *note static types: 983.

          '継承:'

          This flag is not inherited.

          Added in version 3.10.

      -- C のマクロ: Py_TPFLAGS_DISALLOW_INSTANTIATION

          Disallow creating instances of the type: set *note tp_new:
          79f. to NULL and don't create the ‘__new__’ key in the type
          dictionary.

          The flag must be set before creating the type, not after.  For
          example, it must be set before *note PyType_Ready(): 980. is
          called on the type.

          The flag is set automatically on *note static types: 983. if
          *note tp_base: 2375. is NULL or ‘&PyBaseObject_Type’ and *note
          tp_new: 79f. is NULL.

          '継承:'

          This flag is not inherited.  However, subclasses will not be
          instantiable unless they provide a non-NULL *note tp_new: 79f.
          (which is only possible via the C API).

               注釈: To disallow instantiating a class directly but
               allow instantiating its subclasses (e.g.  for an *note
               abstract base class: 13ce.), do not use this flag.
               Instead, make *note tp_new: 79f. only succeed for
               subclasses.

          Added in version 3.10.

      -- C のマクロ: Py_TPFLAGS_MAPPING

          This bit indicates that instances of the class may match
          mapping patterns when used as the subject of a *note match:
          a0e. block.  It is automatically set when registering or
          subclassing *note collections.abc.Mapping: ac7, and unset when
          registering *note collections.abc.Sequence: 13dc.

               注釈: *note Py_TPFLAGS_MAPPING: 1c58. and *note
               Py_TPFLAGS_SEQUENCE: 1c59. are mutually exclusive; it is
               an error to enable both flags simultaneously.

          '継承:'

          This flag is inherited by types that do not already set *note
          Py_TPFLAGS_SEQUENCE: 1c59.

          参考
          ....

          PEP 634(1) - 構造的パターンマッチ: 仕様

          Added in version 3.10.

      -- C のマクロ: Py_TPFLAGS_SEQUENCE

          This bit indicates that instances of the class may match
          sequence patterns when used as the subject of a *note match:
          a0e. block.  It is automatically set when registering or
          subclassing *note collections.abc.Sequence: 13dc, and unset
          when registering *note collections.abc.Mapping: ac7.

               注釈: *note Py_TPFLAGS_MAPPING: 1c58. and *note
               Py_TPFLAGS_SEQUENCE: 1c59. are mutually exclusive; it is
               an error to enable both flags simultaneously.

          '継承:'

          This flag is inherited by types that do not already set *note
          Py_TPFLAGS_MAPPING: 1c58.

          参考
          ....

          PEP 634(2) - 構造的パターンマッチ: 仕様

          Added in version 3.10.

      -- C のマクロ: Py_TPFLAGS_VALID_VERSION_TAG

          Internal.  Do not set or unset this flag.  To indicate that a
          class has changed call *note PyType_Modified(): 1b7b.

               警告: This flag is present in header files, but is not be
               used.  It will be removed in a future version of CPython

 -- C のメンバ変数: const char **note PyTypeObject: c9c.tp_doc

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_doc’ is part of the
     *note Stable ABI: 775.'

     An optional pointer to a NUL-terminated C string giving the
     docstring for this type object.  This is exposed as the *note
     __doc__: 2095. attribute on the type and instances of the type.

     '継承:'

     サブタイプはこのフィールドを継承 'しません' 。

 -- C のメンバ変数: *note traverseproc: 51ba. *note PyTypeObject:
          c9c.tp_traverse

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_traverse’ is part
     of the *note Stable ABI: 775.'

     An optional pointer to a traversal function for the garbage
     collector.  This is only used if the *note Py_TPFLAGS_HAVE_GC: 981.
     flag bit is set.  The signature is:

          int tp_traverse(PyObject *self, visitproc visit, void *arg);

     Pythonのガベージコレクションの仕組みについての詳細は、 *note
     循環参照ガベージコレクションをサポートする: 5656. にあります。

     The *note tp_traverse: 982. pointer is used by the garbage
     collector to detect reference cycles.  A typical implementation of
     a *note tp_traverse: 982. function simply calls *note Py_VISIT():
     4ed9. on each of the instance's members that are Python objects
     that the instance owns.  For example, this is function
     ‘local_traverse()’ from the ‘_thread’ extension module:

          static int
          local_traverse(PyObject *op, visitproc visit, void *arg)
          {
              localobject *self = (localobject *) op;
              Py_VISIT(self->args);
              Py_VISIT(self->kw);
              Py_VISIT(self->dict);
              return 0;
          }

     *note Py_VISIT(): 4ed9. が循環参照になる恐れのあるメンバにだけ呼び
     出されていることに注目してください。 ‘self->key’ メンバもありますが
     、それは ‘NULL’ か Python文字列なので、循環参照の一部になることはあ
     りません。

     一方、メンバが循環参照の一部になり得ないと判っていても、デバッグ目
     的で巡回したい場合があるかもしれないので、 *note gc: 64. モジュール
     の *note get_referents(): a06. 関数は循環参照になり得ないメンバも返
     します。

     Heap types (*note Py_TPFLAGS_HEAPTYPE: aac.) must visit their type
     with:

          Py_VISIT(Py_TYPE(self));

     It is only needed since Python 3.9.  To support Python 3.8 and
     older, this line must be conditional:

          #if PY_VERSION_HEX >= 0x03090000
              Py_VISIT(Py_TYPE(self));
          #endif

     If the *note Py_TPFLAGS_MANAGED_DICT: 60f. bit is set in the *note
     tp_flags: 1c71. field, the traverse function must call *note
     PyObject_VisitManagedDict(): 60d. like this:

          PyObject_VisitManagedDict((PyObject*)self, visit, arg);

          警告: When implementing *note tp_traverse: 982, only the
          members that the instance 'owns' (by having *note strong
          references: 5e2. to them) must be visited.  For instance, if
          an object supports weak references via the *note tp_weaklist:
          52f0. slot, the pointer supporting the linked list (what
          'tp_weaklist' points to) must 'not' be visited as the instance
          does not directly own the weak references to itself (the
          weakreference list is there to support the weak reference
          machinery, but the instance has no strong reference to the
          elements inside it, as they are allowed to be removed even if
          the instance is still alive).

          警告: The traversal function must not have any side effects.
          It must not modify the reference counts of any Python objects
          nor create or destroy any Python objects.

     Note that *note Py_VISIT(): 4ed9. requires the 'visit' and 'arg'
     parameters to ‘local_traverse()’ to have these specific names;
     don't name them just anything.

     Instances of *note heap-allocated types: b5e. hold a reference to
     their type.  Their traversal function must therefore either visit
     *note Py_TYPE(self): 3c9, or delegate this responsibility by
     calling ‘tp_traverse’ of another heap-allocated type (such as a
     heap-allocated superclass).  If they do not, the type object may
     not be garbage-collected.

          注釈: The *note tp_traverse: 982. function can be called from
          any thread.

     バージョン 3.9 で変更: Heap-allocated types are expected to visit
     ‘Py_TYPE(self)’ in ‘tp_traverse’.  In earlier versions of Python,
     due to bug 40217(3), doing this may lead to crashes in subclasses.

     '継承:'

     Group: *note Py_TPFLAGS_HAVE_GC: 981, *note tp_traverse: 982, *note
     tp_clear: 4ee2.

     This field is inherited by subtypes together with *note tp_clear:
     4ee2. and the *note Py_TPFLAGS_HAVE_GC: 981. flag bit: the flag
     bit, *note tp_traverse: 982, and *note tp_clear: 4ee2. are all
     inherited from the base type if they are all zero in the subtype.

 -- C のメンバ変数: *note inquiry: 51ab. *note PyTypeObject:
          c9c.tp_clear

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_clear’ is part of
     the *note Stable ABI: 775.'

     An optional pointer to a clear function.  The signature is:

          int tp_clear(PyObject *);

     The purpose of this function is to break reference cycles that are
     causing a *note cyclic isolate: 55e4. so that the objects can be
     safely destroyed.  A cleared object is a partially destroyed
     object; the object is not obligated to satisfy design invariants
     held during normal use.

     ‘tp_clear’ does not need to delete references to objects that can't
     participate in reference cycles, such as Python strings or Python
     integers.  However, it may be convenient to clear all references,
     and write the type's *note tp_dealloc: 4ebc. function to invoke
     ‘tp_clear’ to avoid code duplication.  (Beware that ‘tp_clear’
     might have already been called.  Prefer calling idempotent
     functions like *note Py_CLEAR(): 798.)

     Any non-trivial cleanup should be performed in *note tp_finalize:
     c9d. instead of ‘tp_clear’.

          注釈: If ‘tp_clear’ fails to break a reference cycle then the
          objects in the *note cyclic isolate: 55e4. may remain
          indefinitely uncollectable ("leak").  See *note gc.garbage:
          13d9.

          注釈: Referents (direct and indirect) might have already been
          cleared; they are not guaranteed to be in a consistent state.

          注釈: The *note tp_clear: 4ee2. function can be called from
          any thread.

          注釈: An object is not guaranteed to be automatically cleared
          before its destructor (*note tp_dealloc: 4ebc.) is called.

     This function differs from the destructor (*note tp_dealloc: 4ebc.)
     in the following ways:

        * The purpose of clearing an object is to remove references to
          other objects that might participate in a reference cycle.
          The purpose of the destructor, on the other hand, is a
          superset: it must release 'all' resources it owns, including
          references to objects that cannot participate in a reference
          cycle (e.g., integers) as well as the object's own memory (by
          calling *note tp_free: 4ecf.).

        * When ‘tp_clear’ is called, other objects might still hold
          references to the object being cleared.  Because of this,
          ‘tp_clear’ must not deallocate the object's own memory (*note
          tp_free: 4ecf.).  The destructor, on the other hand, is only
          called when no (strong) references exist, and as such, must
          safely destroy the object itself by deallocating it.

        * ‘tp_clear’ might never be automatically called.  An object's
          destructor, on the other hand, will be automatically called
          some time after the object becomes unreachable (i.e., either
          there are no references to the object or the object is a
          member of a *note cyclic isolate: 55e4.).

     No guarantees are made about when, if, or how often Python
     automatically clears an object, except:

        * Python will not automatically clear an object if it is
          reachable, i.e., there is a reference to it and it is not a
          member of a *note cyclic isolate: 55e4.

        * Python will not automatically clear an object if it has not
          been automatically finalized (see *note tp_finalize: c9d.).
          (If the finalizer resurrected the object, the object may or
          may not be automatically finalized again before it is
          cleared.)

        * If an object is a member of a *note cyclic isolate: 55e4,
          Python will not automatically clear it if any member of the
          cyclic isolate has not yet been automatically finalized (*note
          tp_finalize: c9d.).

        * Python will not destroy an object until after any automatic
          calls to its ‘tp_clear’ function have returned.  This ensures
          that the act of breaking a reference cycle does not invalidate
          the ‘self’ pointer while ‘tp_clear’ is still executing.

        * Python will not automatically call ‘tp_clear’ multiple times
          concurrently.

     CPython currently only automatically clears objects as needed to
     break reference cycles in a *note cyclic isolate: 55e4, but future
     versions might clear objects regularly before their destruction.

     Taken together, all *note tp_clear: 4ee2. functions in the system
     must combine to break all reference cycles.  This is subtle, and if
     in any doubt supply a *note tp_clear: 4ee2. function.  For example,
     the tuple type does not implement a *note tp_clear: 4ee2. function,
     because it's possible to prove that no reference cycle can be
     composed entirely of tuples.  Therefore the *note tp_clear: 4ee2.
     functions of other types are responsible for breaking any cycle
     containing a tuple.  This isn't immediately obvious, and there's
     rarely a good reason to avoid implementing *note tp_clear: 4ee2.

     次の例にあるように、 *note tp_clear: 4ee2. の実装は、インスタンスか
     ら Python オブジェクトだと思われるメンバへの参照を外し、それらのメ
     ンバへのポインタに ‘NULL’ をセットすべきです:

          static int
          local_clear(PyObject *op)
          {
              localobject *self = (localobject *) op;
              Py_CLEAR(self->key);
              Py_CLEAR(self->args);
              Py_CLEAR(self->kw);
              Py_CLEAR(self->dict);
              return 0;
          }

     The *note Py_CLEAR(): 798. macro should be used, because clearing
     references is delicate: the reference to the contained object must
     not be released (via *note Py_DECREF(): 790.) until after the
     pointer to the contained object is set to ‘NULL’.  This is because
     releasing the reference may cause the contained object to become
     trash, triggering a chain of reclamation activity that may include
     invoking arbitrary Python code (due to finalizers, or weakref
     callbacks, associated with the contained object).  If it's possible
     for such code to reference 'self' again, it's important that the
     pointer to the contained object be ‘NULL’ at that time, so that
     'self' knows the contained object can no longer be used.  The *note
     Py_CLEAR(): 798. macro performs the operations in a safe order.

     If the *note Py_TPFLAGS_MANAGED_DICT: 60f. bit is set in the *note
     tp_flags: 1c71. field, the clear function must call *note
     PyObject_ClearManagedDict(): 60e. like this:

          PyObject_ClearManagedDict((PyObject*)self);

     Pythonのガベージコレクションの仕組みについての詳細は、 *note
     循環参照ガベージコレクションをサポートする: 5656. にあります。

     '継承:'

     Group: *note Py_TPFLAGS_HAVE_GC: 981, *note tp_traverse: 982, *note
     tp_clear: 4ee2.

     This field is inherited by subtypes together with *note
     tp_traverse: 982. and the *note Py_TPFLAGS_HAVE_GC: 981. flag bit:
     the flag bit, *note tp_traverse: 982, and *note tp_clear: 4ee2. are
     all inherited from the base type if they are all zero in the
     subtype.

     参考
     ....

     *note Object Life Cycle: 55df. for details about how this slot
     relates to other slots.

 -- C のメンバ変数: *note richcmpfunc: 51b3. *note PyTypeObject:
          c9c.tp_richcompare

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_richcompare’ is
     part of the *note Stable ABI: 775.'

     オプションのポインタで、拡張比較関数を指します。シグネチャは次の通
     りです:

          PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);

     The first parameter is guaranteed to be an instance of the type
     that is defined by *note PyTypeObject: c9c.

     この関数は、比較結果を返すべきです。(普通は ‘Py_True’ か ‘Py_False’
     です。) 比較が未定義の場合は、‘Py_NotImplemented’ を、それ以外のエ
     ラーが発生した場合には例外状態をセットして ‘NULL’ を返さなければな
     りません。

     *note tp_richcompare: 4ef0. および *note PyObject_RichCompare():
     4ef1. 関数の第三引数に使うための定数としては以下が定義されています:

     定数                     比較
                              
     ------------------------------------------
                              
      -- C のマクロ: Py_LT    ‘<’
                              
                              
      -- C のマクロ: Py_LE    ‘<=’
                              
                              
      -- C のマクロ: Py_EQ    ‘==’
                              
                              
      -- C のマクロ: Py_NE    ‘!=’
                              
                              
      -- C のマクロ: Py_GT    ‘>’
                              
                              
      -- C のマクロ: Py_GE    ‘>=’
                              

     拡張比較関数(rich comparison functions)を簡単に記述するためのマクロ
     が定義されています:

      -- C のマクロ: Py_RETURN_RICHCOMPARE (VAL_A, VAL_B, op)

          比較した結果に応じて ‘Py_True’ か ‘Py_False’ を返します。
          VAL_A と VAL_B は C の比較演算によって順序付け可能でなければな
          りません（例えばこれらは C言語の整数か浮動小数点数になるでしょ
          う）。三番目の引数には *note PyObject_RichCompare(): 4ef1. と
          同様に要求された演算を指定します。

          The returned value is a new *note strong reference: 5e2.

          エラー時には例外を設定して、関数から ‘NULL’ でリターンします。

          Added in version 3.7.

     '継承:'

     Group: *note tp_hash: 4ef6, *note tp_richcompare: 4ef0.

     このフィールドは *note tp_hash: 4ef6. と共にサブタイプに継承されま
     す: すなわち、サブタイプの *note tp_richcompare: 4ef0. および *note
     tp_hash: 4ef6. が両方とも ‘NULL’ のとき、サブタイプは基底タイプから
     *note tp_richcompare: 4ef0. と *note tp_hash: 4ef6. を両方とも継承
     します。

     'デフォルト'

     *note PyBaseObject_Type: 4f75. provides a *note tp_richcompare:
     4ef0. implementation, which may be inherited.  However, if only
     *note tp_hash: 4ef6. is defined, not even the inherited function is
     used and instances of the type will not be able to participate in
     any comparisons.

 -- C のメンバ変数: *note Py_ssize_t: c55. *note PyTypeObject:
          c9c.tp_weaklistoffset

     While this field is still supported, *note
     Py_TPFLAGS_MANAGED_WEAKREF: 77c. should be used instead, if at all
     possible.

     型のインスタンスが弱参照可能な場合、このフィールドはゼロよりも大き
     な数になり、インスタンス構造体における弱参照リストの先頭を示すオフ
     セットが入ります (GC ヘッダがある場合には無視します); このオフセッ
     ト値は *note PyObject_ClearWeakRefs(): 796. および ‘PyWeakref_*’ 関
     数が利用します。インスタンス構造体には、 ‘NULL’ に初期化された
     *note PyObject: 5df.* 型のフィールドが入っていなければなりません。

     このフィールドを *note tp_weaklist: 52f0. と混同しないようにしてく
     ださい; これは型オブジェクト自身への弱参照からなるリストの先頭です
     。

     It is an error to set both the *note Py_TPFLAGS_MANAGED_WEAKREF:
     77c. bit and *note tp_weaklistoffset: b7f.

     '継承:'

     このフィールドはサブタイプに継承されますが、以下の規則を読んでくだ
     さい。サブタイプはこのオフセット値をオーバライドすることがあります;
     従って、サブタイプでは弱参照リストの先頭が基底タイプとは異なる場合
     があります。リストの先頭は常に *note tp_weaklistoffset: b7f. で分か
     るはずなので、このことは問題にはならないはずです。

     'デフォルト'

     If the *note Py_TPFLAGS_MANAGED_WEAKREF: 77c. bit is set in the
     *note tp_flags: 1c71. field, then *note tp_weaklistoffset: b7f.
     will be set to a negative value, to indicate that it is unsafe to
     use this field.

 -- C のメンバ変数: *note getiterfunc: 51a7. *note PyTypeObject:
          c9c.tp_iter

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_iter’ is part of
     the *note Stable ABI: 775.'

     オプションの変数で、そのオブジェクトの *note イテレータ: 4c8. を返
     す関数へのポインタです。この値が存在することは、通常この型のインス
     タンスが *note イテレート可能: 12f1. であることを示しています (しか
     し、シーケンスはこの関数がなくてもイテレート可能です)。

     この関数は *note PyObject_GetIter(): 5092. と同じシグネチャを持って
     います:

          PyObject *tp_iter(PyObject *self);

     '継承:'

     サブタイプはこのフィールドを継承します。

 -- C のメンバ変数: *note iternextfunc: 51ac. *note PyTypeObject:
          c9c.tp_iternext

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_iternext’ is part
     of the *note Stable ABI: 775.'

     オプションのポインタで、*note イテレーター: 4c8. の次の要素を返す関
     数を指します。シグネチャは次の通りです:

          PyObject *tp_iternext(PyObject *self);

     イテレータの要素がなくなると、この関数は ‘NULL’ を返さなければなり
     ません。 *note StopIteration: df5. 例外は設定してもしなくても良いで
     す。その他のエラーが発生したときも、 ‘NULL’ を返さなければなりませ
     ん。このフィールドがあると、この型のインスタンスがイテレータである
     ことを示します。

     イテレータ型では、 *note tp_iter: 1708. 関数も定義されていなければ
     ならず、その関数は (新たなイテレータインスタンスではなく) イテレー
     タインスタンス自体を返さねばなりません。

     この関数のシグネチャは *note PyIter_Next(): 399. と同じです。

     '継承:'

     サブタイプはこのフィールドを継承します。

 -- C のメンバ変数: struct *note PyMethodDef: 16f0. **note PyTypeObject:
          c9c.tp_methods

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_methods’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、この型の正規 (regular) のメソッドを宣言して
     いる *note PyMethodDef: 16f0. 構造体からなる、 ‘NULL’ で終端された
     静的な配列を指します。

     配列の各要素ごとに、メソッドデスクリプタの入った、要素が型の辞書 (下
     記の *note tp_dict: 1a8c. 参照) に追加されます。

     '継承:'

     サブタイプはこのフィールドを継承しません (メソッドは別個のメカニズ
     ムで継承されています)。

 -- C のメンバ変数: struct *note PyMemberDef: 771. **note PyTypeObject:
          c9c.tp_members

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_members’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、型の正規 (regular) のデータメンバ (フィール
     ドおよびスロット) を宣言している *note PyMemberDef: 771. 構造体から
     なる、 ‘NULL’ で終端された静的な配列を指します。

     配列の各要素ごとに、メンバデスクリプタの入った要素が型の辞書 (下記
     の *note tp_dict: 1a8c. 参照) に追加されます。

     '継承:'

     サブタイプはこのフィールドを継承しません (メンバは別個のメカニズム
     で継承されています)。

 -- C のメンバ変数: struct *note PyGetSetDef: db2. **note PyTypeObject:
          c9c.tp_getset

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_getset’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、インスタンスの算出属性 (computed attribute)
     を宣言している *note PyGetSetDef: db2. 構造体からなる、 ‘NULL’ で終
     端された静的な配列を指します。

     配列の各要素ごとに、 getter/setter デスクリプタの入った、要素が型の
     辞書 (下記の *note tp_dict: 1a8c. 参照) に追加されます。

     '継承:'

     サブタイプはこのフィールドを継承しません (算出属性は別個のメカニズ
     ムで継承されています)。

 -- C のメンバ変数: *note PyTypeObject: c9c. **note PyTypeObject:
          c9c.tp_base

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_base’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、型に関するプロパティを継承する基底タイプを
     指します。このフィールドのレベルでは、単継承 (single inheritance) だ
     けがサポートされています; 多重継承はメタタイプの呼び出しによる動的
     な型オブジェクトの生成を必要とします。

          注釈: 
          Slot initialization is subject to the rules of initializing
          globals.  C99 requires the initializers to be "address
          constants".  Function designators like *note
          PyType_GenericNew(): 4ecc, with implicit conversion to a
          pointer, are valid C99 address constants.

          However, the unary '&' operator applied to a non-static
          variable like *note PyBaseObject_Type: 4f75. is not required
          to produce an address constant.  Compilers may support this
          (gcc does), MSVC does not.  Both compilers are strictly
          standard conforming in this particular behavior.

          Consequently, *note tp_base: 2375. should be set in the
          extension module's init function.

     '継承:'

     (当たり前ですが) サブタイプはこのフィールドを継承しません。

     'デフォルト'

     このフィールドのデフォルト値は (Python プログラマは *note object:
     c7e. 型として知っている) ‘&PyBaseObject_Type’ になります。

 -- C のメンバ変数: *note PyObject: 5df. **note PyTypeObject:
          c9c.tp_dict

     型の辞書は *note PyType_Ready(): 980. によってこのフィールドに収め
     られます。

     This field should normally be initialized to ‘NULL’ before
     PyType_Ready is called; it may also be initialized to a dictionary
     containing initial attributes for the type.  Once *note
     PyType_Ready(): 980. has initialized the type, extra attributes for
     the type may be added to this dictionary only if they don't
     correspond to overloaded operations (like *note __add__(): 23dd.).
     Once initialization for the type has finished, this field should be
     treated as read-only.

     Some types may not store their dictionary in this slot.  Use *note
     PyType_GetDict(): 1a8b. to retrieve the dictionary for an arbitrary
     type.

     バージョン 3.12 で変更: Internals detail: For static builtin types,
     this is always ‘NULL’.  Instead, the dict for such types is stored
     on ‘PyInterpreterState’.  Use *note PyType_GetDict(): 1a8b. to get
     the dict for an arbitrary type.

     '継承:'

     サブタイプはこのフィールドを継承しません (が、この辞書内で定義され
     ている属性は異なるメカニズムで継承されます)。

     'デフォルト'

     If this field is ‘NULL’, *note PyType_Ready(): 980. will assign a
     new dictionary to it.

          警告: *note tp_dict: 1a8c. に *note PyDict_SetItem(): 4eb9. を
          使ったり、辞書 C-API で編集するのは安全ではありません。

 -- C のメンバ変数: *note descrgetfunc: 51a1. *note PyTypeObject:
          c9c.tp_descr_get

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_descr_get’ is part
     of the *note Stable ABI: 775.'

     オプションのポインタで、デスクリプタの get 関数を指します。

     関数のシグネチャは次のとおりです

          PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);

     '継承:'

     サブタイプはこのフィールドを継承します。

 -- C のメンバ変数: *note descrsetfunc: 51a2. *note PyTypeObject:
          c9c.tp_descr_set

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_descr_set’ is part
     of the *note Stable ABI: 775.'

     オプションのポインタで、デスクリプタの値の設定と削除を行う関数を指
     します。

     関数のシグネチャは次のとおりです

          int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);

     値を削除するには、'value' 引数に ‘NULL’ を設定します。

     '継承:'

     サブタイプはこのフィールドを継承します。

 -- C のメンバ変数: *note Py_ssize_t: c55. *note PyTypeObject:
          c9c.tp_dictoffset

     While this field is still supported, *note Py_TPFLAGS_MANAGED_DICT:
     60f. should be used instead, if at all possible.

     型のインスタンスにインスタンス変数の入った辞書がある場合、このフィ
     ールドは非ゼロの値になり、型のインスタンスデータ構造体におけるイン
     スタンス変数辞書へのオフセットが入ります; このオフセット値は *note
     PyObject_GenericGetAttr(): 508e. が使います。

     このフィールドを *note tp_dict: 1a8c. と混同しないようにしてくださ
     い; これは型オブジェクト自身の属性の辞書です。

     The value specifies the offset of the dictionary from the start of
     the instance structure.

     The *note tp_dictoffset: 52ec. should be regarded as write-only.
     To get the pointer to the dictionary call *note
     PyObject_GenericGetDict(): 1d05.  Calling *note
     PyObject_GenericGetDict(): 1d05. may need to allocate memory for
     the dictionary, so it is may be more efficient to call *note
     PyObject_GetAttr(): 5ee. when accessing an attribute on the object.

     It is an error to set both the *note Py_TPFLAGS_MANAGED_DICT: 60f.
     bit and *note tp_dictoffset: 52ec.

     '継承:'

     This field is inherited by subtypes.  A subtype should not override
     this offset; doing so could be unsafe, if C code tries to access
     the dictionary at the previous offset.  To properly support
     inheritance, use *note Py_TPFLAGS_MANAGED_DICT: 60f.

     'デフォルト'

     This slot has no default.  For *note static types: 983, if the
     field is ‘NULL’ then no *note __dict__: 77d. gets created for
     instances.

     If the *note Py_TPFLAGS_MANAGED_DICT: 60f. bit is set in the *note
     tp_flags: 1c71. field, then *note tp_dictoffset: 52ec. will be set
     to ‘-1’, to indicate that it is unsafe to use this field.

 -- C のメンバ変数: *note initproc: 51aa. *note PyTypeObject:
          c9c.tp_init

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_init’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、インスタンス初期化関数を指します。

     This function corresponds to the *note __init__(): 8bf. method of
     classes.  Like ‘__init__()’, it is possible to create an instance
     without calling ‘__init__()’, and it is possible to reinitialize an
     instance by calling its ‘__init__()’ method again.

     関数のシグネチャは次のとおりです

          int tp_init(PyObject *self, PyObject *args, PyObject *kwds);

     The self argument is the instance to be initialized; the 'args' and
     'kwds' arguments represent positional and keyword arguments of the
     call to *note __init__(): 8bf.

     *note tp_init: 7a1. 関数のフィールドが ‘NULL’ でない場合、通常の型
     を呼び出す方法のインスタンス生成において、型の *note tp_new: 79f. 関
     数がインスタンスを返した後に呼び出されます。 *note tp_new: 79f. が
     元の型のサブタイプでない別の型を返す場合、 *note tp_init: 7a1. は全
     く呼び出されません; *note tp_new: 79f. が元の型のサブタイプのインス
     タンスを返す場合、サブタイプの *note tp_init: 7a1. が呼び出されます
     。

     成功のときには ‘0’ を、エラー時には例外をセットして ‘-1’ を返します
     。

     '継承:'

     サブタイプはこのフィールドを継承します。

     'デフォルト'

     For *note static types: 983. this field does not have a default.

 -- C のメンバ変数: *note allocfunc: 519f. *note PyTypeObject:
          c9c.tp_alloc

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_alloc’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、インスタンスのメモリ確保関数を指します。

     関数のシグネチャは次のとおりです

          PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);

     '継承:'

     Static subtypes inherit this slot, which will be *note
     PyType_GenericAlloc(): c61. if inherited from *note object: c7e.

     *note Heap subtypes: b5e. do not inherit this slot.

     'デフォルト'

     For heap subtypes, this field is always set to *note
     PyType_GenericAlloc(): c61.

     For static subtypes, this slot is inherited (see above).

 -- C のメンバ変数: *note newfunc: 51ae. *note PyTypeObject: c9c.tp_new

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_new’ is part of the
     *note Stable ABI: 775.'

     オプションのポインタで、インスタンス生成関数を指します。

     関数のシグネチャは次のとおりです

          PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);

     'subtype' 引数は生成するオブジェクトの型です; 'args' および 'kwds'
     引数は、型を呼び出すときの位置引数およびキーワード引数です。
     'subtype' は *note tp_new: 79f. 関数を呼び出すときに使う型と同じで
     ある必要はないことに注意してください; その型の (無関係ではない) サ
     ブタイプのこともあります。

     *note tp_new: 79f. 関数は ‘subtype->tp_alloc(subtype, nitems)’ を呼
     び出してオブジェクトのメモリ領域を確保し、初期化で絶対に必要とされ
     る処理だけを行います。省略したり繰り返したりしても問題のない初期化
     処理は *note tp_init: 7a1. ハンドラ内に配置しなければなりません。だ
     いたいの目安としては、変更不能な型では初期化は全て *note tp_new:
     79f. で行い、一方、変更可能な型ではほとんどの初期化を *note
     tp_init: 7a1. に回すべきです。

     Set the *note Py_TPFLAGS_DISALLOW_INSTANTIATION: 7a2. flag to
     disallow creating instances of the type in Python.

     '継承:'

     サブタイプはこのフィールドを継承します。例外として、 *note tp_base:
     2375. が ‘NULL’ か ‘&PyBaseObject_Type’ になっている *note
     静的な型: 983. では継承しません。

     'デフォルト'

     For *note static types: 983. this field has no default.  This means
     if the slot is defined as ‘NULL’, the type cannot be called to
     create new instances; presumably there is some other way to create
     instances, like a factory function.

 -- C のメンバ変数: *note freefunc: 5449. *note PyTypeObject:
          c9c.tp_free

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_free’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、インスタンスのメモリ解放関数を指します。シ
     グネチャは以下の通りです:

          void tp_free(void *self);

     This function must free the memory allocated by *note tp_alloc:
     4ed0.

     '継承:'

     Static subtypes inherit this slot, which will be *note
     PyObject_Free(): e60. if inherited from *note object: c7e.
     Exception: If the type supports garbage collection (i.e., the *note
     Py_TPFLAGS_HAVE_GC: 981. flag is set in *note tp_flags: 1c71.) and
     it would inherit *note PyObject_Free(): e60, then this slot is not
     inherited but instead defaults to *note PyObject_GC_Del(): 171c.

     *note Heap subtypes: b5e. do not inherit this slot.

     'デフォルト'

     For *note heap subtypes: b5e, this slot defaults to a deallocator
     suitable to match *note PyType_GenericAlloc(): c61. and the value
     of the *note Py_TPFLAGS_HAVE_GC: 981. flag.

     For static subtypes, this slot is inherited (see above).

 -- C のメンバ変数: *note inquiry: 51ab. *note PyTypeObject:
          c9c.tp_is_gc

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_is_gc’ is part of
     the *note Stable ABI: 775.'

     オプションのポインタで、ガベージコレクタから呼び出される関数を指し
     ます。

     The garbage collector needs to know whether a particular object is
     collectible or not.  Normally, it is sufficient to look at the
     object's type's *note tp_flags: 1c71. field, and check the *note
     Py_TPFLAGS_HAVE_GC: 981. flag bit.  But some types have a mixture
     of statically and dynamically allocated instances, and the
     statically allocated instances are not collectible.  Such types
     should define this function; it should return ‘1’ for a collectible
     instance, and ‘0’ for a non-collectible instance.  The signature
     is:

          int tp_is_gc(PyObject *self);

     (上記のような型の例は、型オブジェクト自体です。メタタイプ *note
     PyType_Type: 76f. は、型のメモリ確保が静的か *note 動的: b5e. かを
     区別するためにこの関数を定義しています。)

     '継承:'

     サブタイプはこのフィールドを継承します。

     'デフォルト'

     This slot has no default.  If this field is ‘NULL’, *note
     Py_TPFLAGS_HAVE_GC: 981. is used as the functional equivalent.

 -- C のメンバ変数: *note PyObject: 5df. **note PyTypeObject:
          c9c.tp_bases

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_bases’ is part of
     the *note Stable ABI: 775.'

     基底型からなるタプルです。

     This field should be set to ‘NULL’ and treated as read-only.
     Python will fill it in when the type is *note initialized: 980.

     For dynamically created classes, the *note Py_tp_bases: 5183. *note
     slot: 50dc. can be used instead of the 'bases' argument of *note
     PyType_FromSpecWithBases(): 79e.  The argument form is preferred.

          警告: Multiple inheritance does not work well for statically
          defined types.  If you set ‘tp_bases’ to a tuple, Python will
          not raise an error, but some slots will only be inherited from
          the first base.

     '継承:'

     このフィールドは継承されません。

 -- C のメンバ変数: *note PyObject: 5df. **note PyTypeObject: c9c.tp_mro

     基底タイプ群を展開した集合が入っているタプルです。集合は該当する型
     自体からはじまり、 *note object: c7e. で終わります。メソッド解決順
     序 (Method Resolution Order) に従って並んでいます。

     This field should be set to ‘NULL’ and treated as read-only.
     Python will fill it in when the type is *note initialized: 980.

     '継承:'

     このフィールドは継承されません; フィールドの値は *note
     PyType_Ready(): 980. で毎回計算されます。

 -- C のメンバ変数: *note PyObject: 5df. **note PyTypeObject:
          c9c.tp_cache

     未使用のフィールドです。内部でのみ利用されます。

     '継承:'

     このフィールドは継承されません。

 -- C のメンバ変数: void **note PyTypeObject: c9c.tp_subclasses

     A collection of subclasses.  Internal use only.  May be an invalid
     pointer.

     To get a list of subclasses, call the Python method *note
     __subclasses__(): 793.

     バージョン 3.12 で変更: For some types, this field does not hold a
     valid *note PyObject: 5df.*.  The type was changed to void* to
     indicate this.

     '継承:'

     このフィールドは継承されません。

 -- C のメンバ変数: *note PyObject: 5df. **note PyTypeObject:
          c9c.tp_weaklist

     この型オブジェクトに対する弱参照からなるリストの先頭です。

     バージョン 3.12 で変更: Internals detail: For the static builtin
     types this is always ‘NULL’, even if weakrefs are added.  Instead,
     the weakrefs for each are stored on ‘PyInterpreterState’.  Use the
     public C-API or the internal ‘_PyObject_GET_WEAKREFS_LISTPTR()’
     macro to avoid the distinction.

     '継承:'

     このフィールドは継承されません。

 -- C のメンバ変数: *note destructor: 51a3. *note PyTypeObject:
          c9c.tp_del

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_del’ is part of the
     *note Stable ABI: 775.'

     このフィールドは廃止されました。*note tp_finalize: c9d. を代わりに
     利用してください。

 -- C のメンバ変数: unsigned int *note PyTypeObject: c9c.tp_version_tag

     メソッドキャッシュへのインデックスとして使われます。内部使用だけの
     ための関数です。

     '継承:'

     このフィールドは継承されません。

 -- C のメンバ変数: *note destructor: 51a3. *note PyTypeObject:
          c9c.tp_finalize

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_finalize’ is part
     of the *note Stable ABI: 775. (バージョン 3.5 より).'

     An optional pointer to an instance finalization function.  This is
     the C implementation of the *note __del__(): 11ff. special method.
     Its signature is:

          void tp_finalize(PyObject *self);

     The primary purpose of finalization is to perform any non-trivial
     cleanup that must be performed before the object is destroyed,
     while the object and any other objects it directly or indirectly
     references are still in a consistent state.  The finalizer is
     allowed to execute arbitrary Python code.

     Before Python automatically finalizes an object, some of the
     object's direct or indirect referents might have themselves been
     automatically finalized.  However, none of the referents will have
     been automatically cleared (*note tp_clear: 4ee2.) yet.

     Other non-finalized objects might still be using a finalized
     object, so the finalizer must leave the object in a sane state
     (e.g., invariants are still met).

          注釈: After Python automatically finalizes an object, Python
          might start automatically clearing (*note tp_clear: 4ee2.) the
          object and its referents (direct and indirect).  Cleared
          objects are not guaranteed to be in a consistent state; a
          finalized object must be able to tolerate cleared referents.

          注釈: An object is not guaranteed to be automatically
          finalized before its destructor (*note tp_dealloc: 4ebc.) is
          called.  It is recommended to call *note
          PyObject_CallFinalizerFromDealloc(): 55e3. at the beginning of
          ‘tp_dealloc’ to guarantee that the object is always finalized
          before destruction.

          注釈: The *note tp_finalize: c9d. function can be called from
          any thread, although the *note GIL: 164. will be held.

          注釈: The ‘tp_finalize’ function can be called during
          shutdown, after some global variables have been deleted.  See
          the documentation of the *note __del__(): 11ff. method for
          details.

     When Python finalizes an object, it behaves like the following
     algorithm:

       1. Python might mark the object as 'finalized'.  Currently,
          Python always marks objects whose type supports garbage
          collection (i.e., the *note Py_TPFLAGS_HAVE_GC: 981. flag is
          set in *note tp_flags: 1c71.) and never marks other types of
          objects; this might change in a future version.

       2. If the object is not marked as 'finalized' and its
          ‘tp_finalize’ finalizer function is non-‘NULL’, the finalizer
          function is called.

       3. If the finalizer function was called and the finalizer made
          the object reachable (i.e., there is a reference to the object
          and it is not a member of a *note cyclic isolate: 55e4.), then
          the finalizer is said to have 'resurrected' the object.  It is
          unspecified whether the finalizer can also resurrect the
          object by adding a new reference to the object that does not
          make it reachable, i.e., the object is (still) a member of a
          cyclic isolate.

       4. If the finalizer resurrected the object, the object's pending
          destruction is canceled and the object's 'finalized' mark
          might be removed if present.  Currently, Python never removes
          the 'finalized' mark; this might change in a future version.

     'Automatic finalization' refers to any finalization performed by
     Python except via calls to *note PyObject_CallFinalizer(): 55e7. or
     *note PyObject_CallFinalizerFromDealloc(): 55e3.  No guarantees are
     made about when, if, or how often an object is automatically
     finalized, except:

        * Python will not automatically finalize an object if it is
          reachable, i.e., there is a reference to it and it is not a
          member of a *note cyclic isolate: 55e4.

        * Python will not automatically finalize an object if finalizing
          it would not mark the object as 'finalized'.  Currently, this
          applies to objects whose type does not support garbage
          collection, i.e., the *note Py_TPFLAGS_HAVE_GC: 981. flag is
          not set.  Such objects can still be manually finalized by
          calling *note PyObject_CallFinalizer(): 55e7. or *note
          PyObject_CallFinalizerFromDealloc(): 55e3.

        * Python will not automatically finalize any two members of a
          *note cyclic isolate: 55e4. concurrently.

        * Python will not automatically finalize an object after it has
          automatically cleared (*note tp_clear: 4ee2.) the object.

        * If an object is a member of a *note cyclic isolate: 55e4,
          Python will not automatically finalize it after automatically
          clearing (see *note tp_clear: 4ee2.) any other member.

        * Python will automatically finalize every member of a *note
          cyclic isolate: 55e4. before it automatically clears (see
          *note tp_clear: 4ee2.) any of them.

        * If Python is going to automatically clear an object (*note
          tp_clear: 4ee2.), it will automatically finalize the object
          first.

     Python currently only automatically finalizes objects that are
     members of a *note cyclic isolate: 55e4, but future versions might
     finalize objects regularly before their destruction.

     To manually finalize an object, do not call this function directly;
     call *note PyObject_CallFinalizer(): 55e7. or *note
     PyObject_CallFinalizerFromDealloc(): 55e3. instead.

     *note tp_finalize: c9d. should leave the current exception status
     unchanged.  The recommended way to write a non-trivial finalizer is
     to back up the exception at the beginning by calling *note
     PyErr_GetRaisedException(): 429. and restore the exception at the
     end by calling *note PyErr_SetRaisedException(): 42c.  If an
     exception is encountered in the middle of the finalizer, log and
     clear it with *note PyErr_WriteUnraisable(): 5f2. or *note
     PyErr_FormatUnraisable(): 5f1.  For example:

          static void
          foo_finalize(PyObject *self)
          {
              // Save the current exception, if any.
              PyObject *exc = PyErr_GetRaisedException();

              // ...

              if (do_something_that_might_raise() != success_indicator) {
                  PyErr_WriteUnraisable(self);
                  goto done;
              }

          done:
              // Restore the saved exception.  This silently discards any exception
              // raised above, so be sure to call PyErr_WriteUnraisable first if
              // necessary.
              PyErr_SetRaisedException(exc);
          }

     '継承:'

     サブタイプはこのフィールドを継承します。

     Added in version 3.4.

     バージョン 3.8 で変更: Before version 3.8 it was necessary to set
     the *note Py_TPFLAGS_HAVE_FINALIZE: 427. flags bit in order for
     this field to be used.  This is no longer required.

     参考
     ....

        * PEP 442(4): "Safe object finalization"

        * *note Object Life Cycle: 55df. for details about how this slot
          relates to other slots.

        * *note PyObject_CallFinalizer(): 55e7.

        * *note PyObject_CallFinalizerFromDealloc(): 55e3.

 -- C のメンバ変数: *note vectorcallfunc: 779. *note PyTypeObject:
          c9c.tp_vectorcall

     ' The corresponding *note slot ID: 50dc. ‘Py_tp_vectorcall’ is part
     of the *note Stable ABI: 775. (バージョン 3.14 より).'

     A *note vectorcall function: 774. to use for calls of this type
     object (rather than instances).  In other words, ‘tp_vectorcall’
     can be used to optimize ‘type.__call__’, which typically returns a
     new instance of 'type'.

     As with any vectorcall function, if ‘tp_vectorcall’ is ‘NULL’, the
     'tp_call' protocol (‘Py_TYPE(type)->tp_call’) is used instead.

          注釈: The *note vectorcall protocol: 774. requires that the
          vectorcall function has the same behavior as the corresponding
          ‘tp_call’.  This means that ‘type->tp_vectorcall’ must match
          the behavior of ‘Py_TYPE(type)->tp_call’.

          Specifically, if 'type' uses the default metaclass,
          ‘type->tp_vectorcall’ must behave the same as *note
          PyType_Type: 76f.->tp_call, which:

             - calls ‘type->tp_new’,

             - if the result is a subclass of 'type', calls
               ‘type->tp_init’ on the result of ‘tp_new’, and

             - returns the result of ‘tp_new’.

          Typically, ‘tp_vectorcall’ is overridden to optimize this
          process for specific *note tp_new: 79f. and *note tp_init:
          7a1.  When doing this for user-subclassable types, note that
          both can be overridden (using *note __new__(): 7a0. and *note
          __init__(): 8bf, respectively).

     '継承:'

     このフィールドは決して継承されません。

     Added in version 3.9: （このフィールドは3.8から存在していますが、
     3.9以降でしか利用できません）

 -- C のメンバ変数: unsigned char *note PyTypeObject: c9c.tp_watched

     Internal.  Do not use.

     Added in version 3.12.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0634/

   (2) https://peps.python.org/pep-0634/

   (3) https://bugs.python.org/issue40217

   (4) https://peps.python.org/pep-0442/


File: python.info,  Node: Static Types,  Next: Heap Types,  Prev: PyTypeObject スロット,  Up: Type Object Structures

7.13.4.9 Static Types
.....................

Traditionally, types defined in C code are 'static', that is, a static
*note PyTypeObject: c9c. structure is defined directly in code and
initialized using *note PyType_Ready(): 980.

This results in types that are limited relative to types defined in
Python:

   * Static types are limited to one base, i.e.  they cannot use
     multiple inheritance.

   * Static type objects (but not necessarily their instances) are
     immutable.  It is not possible to add or modify the type object's
     attributes from Python.

   * Static type objects are shared across *note sub-interpreters: 163,
     so they should not include any subinterpreter-specific state.

Also, since *note PyTypeObject: c9c. is only part of the *note Limited
API: 637. as an opaque struct, any extension modules using static types
must be compiled for a specific Python minor version.


File: python.info,  Node: Heap Types,  Next: 数値オブジェクト構造体,  Prev: Static Types,  Up: Type Object Structures

7.13.4.10 Heap Types
....................

An alternative to *note static types: 983. is 'heap-allocated types', or
'heap types' for short, which correspond closely to classes created by
Python's ‘class’ statement.  Heap types have the *note
Py_TPFLAGS_HEAPTYPE: aac. flag set.

This is done by filling a *note PyType_Spec: 1a89. structure and calling
*note PyType_FromSpec(): 79d, *note PyType_FromSpecWithBases(): 79e,
*note PyType_FromModuleAndSpec(): 773, or *note PyType_FromMetaclass():
772.


File: python.info,  Node: 数値オブジェクト構造体,  Next: マップオブジェクト構造体,  Prev: Heap Types,  Up: Type Object Structures

7.13.4.11 数値オブジェクト構造体
................................

 -- C のデータ型: type PyNumberMethods

     この構造体は数値型プロトコルを実装するために使われる関数群へのポイ
     ンタを保持しています。 以下のそれぞれの関数は *note 数値型プロトコル
     (number protocol): 52a1. で解説されている似た名前の関数から利用され
     ます。

     以下は構造体の定義です:

          typedef struct {
               binaryfunc nb_add;
               binaryfunc nb_subtract;
               binaryfunc nb_multiply;
               binaryfunc nb_remainder;
               binaryfunc nb_divmod;
               ternaryfunc nb_power;
               unaryfunc nb_negative;
               unaryfunc nb_positive;
               unaryfunc nb_absolute;
               inquiry nb_bool;
               unaryfunc nb_invert;
               binaryfunc nb_lshift;
               binaryfunc nb_rshift;
               binaryfunc nb_and;
               binaryfunc nb_xor;
               binaryfunc nb_or;
               unaryfunc nb_int;
               void *nb_reserved;
               unaryfunc nb_float;

               binaryfunc nb_inplace_add;
               binaryfunc nb_inplace_subtract;
               binaryfunc nb_inplace_multiply;
               binaryfunc nb_inplace_remainder;
               ternaryfunc nb_inplace_power;
               binaryfunc nb_inplace_lshift;
               binaryfunc nb_inplace_rshift;
               binaryfunc nb_inplace_and;
               binaryfunc nb_inplace_xor;
               binaryfunc nb_inplace_or;

               binaryfunc nb_floor_divide;
               binaryfunc nb_true_divide;
               binaryfunc nb_inplace_floor_divide;
               binaryfunc nb_inplace_true_divide;

               unaryfunc nb_index;

               binaryfunc nb_matrix_multiply;
               binaryfunc nb_inplace_matrix_multiply;
          } PyNumberMethods;

          注釈: 二項関数と三項関数は、すべてのオペランドの型をチェックし
          なければならず、必要な変換を実装しなければなりません (すくなく
          ともオペランドの一つは定義している型のインスタンスです).  もし
          与えられたオペランドに対して操作が定義されなければ、二項関数と
          三項関数は ‘Py_NotImplemented’ を返さなければならず、他のエラ
          ーが起こった場合は、‘NULL’ を返して例外を設定しなければなりま
          せん。

          注釈: The *note nb_reserved: 563c. field should always be
          ‘NULL’.  It was previously called ‘nb_long’, and was renamed
          in Python 3.0.1.

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_add

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_add’ is part of the
     *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_subtract

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_subtract’ is part
     of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_multiply

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_multiply’ is part
     of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_remainder

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_remainder’ is part
     of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_divmod

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_divmod’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note ternaryfunc: 51b9. *note PyNumberMethods:
          1637.nb_power

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_power’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note unaryfunc: 51bb. *note PyNumberMethods:
          1637.nb_negative

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_negative’ is part
     of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note unaryfunc: 51bb. *note PyNumberMethods:
          1637.nb_positive

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_positive’ is part
     of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note unaryfunc: 51bb. *note PyNumberMethods:
          1637.nb_absolute

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_absolute’ is part
     of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note inquiry: 51ab. *note PyNumberMethods:
          1637.nb_bool

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_bool’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note unaryfunc: 51bb. *note PyNumberMethods:
          1637.nb_invert

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_invert’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_lshift

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_lshift’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_rshift

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_rshift’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_and

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_and’ is part of the
     *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_xor

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_xor’ is part of the
     *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_or

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_or’ is part of the
     *note Stable ABI: 775.'

 -- C のメンバ変数: *note unaryfunc: 51bb. *note PyNumberMethods:
          1637.nb_int

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_int’ is part of the
     *note Stable ABI: 775.'

 -- C のメンバ変数: void **note PyNumberMethods: 1637.nb_reserved

 -- C のメンバ変数: *note unaryfunc: 51bb. *note PyNumberMethods:
          1637.nb_float

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_float’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_inplace_add

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_inplace_add’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_inplace_subtract

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_inplace_subtract’
     is part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_inplace_multiply

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_inplace_multiply’
     is part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_inplace_remainder

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_inplace_remainder’
     is part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note ternaryfunc: 51b9. *note PyNumberMethods:
          1637.nb_inplace_power

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_inplace_power’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_inplace_lshift

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_inplace_lshift’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_inplace_rshift

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_inplace_rshift’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_inplace_and

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_inplace_and’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_inplace_xor

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_inplace_xor’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_inplace_or

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_inplace_or’ is part
     of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_floor_divide

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_floor_divide’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_true_divide

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_true_divide’ is
     part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_inplace_floor_divide

     ' The corresponding *note slot ID: 50dc.
     ‘Py_nb_inplace_floor_divide’ is part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_inplace_true_divide

     ' The corresponding *note slot ID: 50dc.
     ‘Py_nb_inplace_true_divide’ is part of the *note Stable ABI: 775.'

 -- C のメンバ変数: *note unaryfunc: 51bb. *note PyNumberMethods:
          1637.nb_index

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_index’ is part of
     the *note Stable ABI: 775.'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_matrix_multiply

     ' The corresponding *note slot ID: 50dc. ‘Py_nb_matrix_multiply’ is
     part of the *note Stable ABI: 775. (バージョン 3.5 より).'

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyNumberMethods:
          1637.nb_inplace_matrix_multiply

     ' The corresponding *note slot ID: 50dc.
     ‘Py_nb_inplace_matrix_multiply’ is part of the *note Stable ABI:
     775. (バージョン 3.5 より).'


File: python.info,  Node: マップオブジェクト構造体,  Next: シーケンスオブジェクト構造体,  Prev: 数値オブジェクト構造体,  Up: Type Object Structures

7.13.4.12 マップオブジェクト構造体
..................................

 -- C のデータ型: type PyMappingMethods

     この構造体はマップ型プロトコルを実装するために使われる関数群へのポ
     インタを保持しています。 以下の3つのメンバを持っています:

 -- C のメンバ変数: *note lenfunc: 51ad. *note PyMappingMethods:
          4ef5.mp_length

     ' The corresponding *note slot ID: 50dc. ‘Py_mp_length’ is part of
     the *note Stable ABI: 775.'

     この関数は *note PyMapping_Size(): 1e37. や *note PyObject_Size():
     5098. から利用され、それらと同じシグネチャを持っています。オブジェ
     クトが定義された長さを持たない場合は、このスロットは ‘NULL’ に設定
     されることがあります。

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PyMappingMethods:
          4ef5.mp_subscript

     ' The corresponding *note slot ID: 50dc. ‘Py_mp_subscript’ is part
     of the *note Stable ABI: 775.'

     この関数は *note PyObject_GetItem(): 5ea. および *note
     PySequence_GetSlice(): 50a4. から利用され、‘PyObject_GetItem()’ と
     同じシグネチャを持っています。このスロットは *note
     PyMapping_Check(): 5051. が ‘1’ を返すためには必要で、そうでなけれ
     ば ‘NULL’ の場合があります。

 -- C のメンバ変数: *note objobjargproc: 51af. *note PyMappingMethods:
          4ef5.mp_ass_subscript

     ' The corresponding *note slot ID: 50dc. ‘Py_mp_ass_subscript’ is
     part of the *note Stable ABI: 775.'

     This function is used by *note PyObject_SetItem(): 4f48, *note
     PyObject_DelItem(): 508a, *note PySequence_SetSlice(): 50ab. and
     *note PySequence_DelSlice(): 50a3.  It has the same signature as
     ‘PyObject_SetItem()’, but 'v' can also be set to ‘NULL’ to delete
     an item.  If this slot is ‘NULL’, the object does not support item
     assignment and deletion.


File: python.info,  Node: シーケンスオブジェクト構造体,  Next: バッファオブジェクト構造体 buffer object structure,  Prev: マップオブジェクト構造体,  Up: Type Object Structures

7.13.4.13 シーケンスオブジェクト構造体
......................................

 -- C のデータ型: type PySequenceMethods

     この構造体はシーケンス型プロトコルを実装するために使われる関数群へ
     のポインタを保持しています。

 -- C のメンバ変数: *note lenfunc: 51ad. *note PySequenceMethods:
          4ef4.sq_length

     ' The corresponding *note slot ID: 50dc. ‘Py_sq_length’ is part of
     the *note Stable ABI: 775.'

     This function is used by *note PySequence_Size(): 1e33. and *note
     PyObject_Size(): 5098, and has the same signature.  It is also used
     for handling negative indices via the *note sq_item: 1cf5. and the
     *note sq_ass_item: 5648. slots.

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PySequenceMethods:
          4ef4.sq_concat

     ' The corresponding *note slot ID: 50dc. ‘Py_sq_concat’ is part of
     the *note Stable ABI: 775.'

     この関数は *note PySequence_Concat(): 50a1. で利用され、同じシグネ
     チャを持っています。また、 ‘+’ 演算子でも、 *note nb_add: 52e2. ス
     ロットによる数値加算を試した後に利用されます。

 -- C のメンバ変数: *note ssizeargfunc: 51b7. *note PySequenceMethods:
          4ef4.sq_repeat

     ' The corresponding *note slot ID: 50dc. ‘Py_sq_repeat’ is part of
     the *note Stable ABI: 775.'

     この関数は *note PySequence_Repeat(): 50aa. で利用され、同じシグネ
     チャを持っています。また、 ‘*’ 演算でも、 *note nb_multiply: 5625.
     スロットによる数値乗算を試したあとに利用されます。

 -- C のメンバ変数: *note ssizeargfunc: 51b7. *note PySequenceMethods:
          4ef4.sq_item

     ' The corresponding *note slot ID: 50dc. ‘Py_sq_item’ is part of
     the *note Stable ABI: 775.'

     This function is used by *note PySequence_GetItem(): 1e34. and has
     the same signature.  It is also used by *note PyObject_GetItem():
     5ea, after trying the subscription via the *note mp_subscript:
     1cf6. slot.  This slot must be filled for the *note
     PySequence_Check(): 50a0. function to return ‘1’, it can be ‘NULL’
     otherwise.

     Negative indexes are handled as follows: if the *note sq_length:
     52eb. slot is filled, it is called and the sequence length is used
     to compute a positive index which is passed to *note sq_item: 1cf5.
     If ‘sq_length’ is ‘NULL’, the index is passed as is to the
     function.

 -- C のメンバ変数: *note ssizeobjargproc: 51b8. *note
          PySequenceMethods: 4ef4.sq_ass_item

     ' The corresponding *note slot ID: 50dc. ‘Py_sq_ass_item’ is part
     of the *note Stable ABI: 775.'

     This function is used by *note PySequence_SetItem(): 1e35. and has
     the same signature.  It is also used by *note PyObject_SetItem():
     4f48. and *note PyObject_DelItem(): 508a, after trying the item
     assignment and deletion via the *note mp_ass_subscript: 5645. slot.
     This slot may be left to ‘NULL’ if the object does not support item
     assignment and deletion.

 -- C のメンバ変数: *note objobjproc: 51b0. *note PySequenceMethods:
          4ef4.sq_contains

     ' The corresponding *note slot ID: 50dc. ‘Py_sq_contains’ is part
     of the *note Stable ABI: 775.'

     この関数は *note PySequence_Contains(): 3d9. から利用され、同じシグ
     ネチャを持っています。このスロットは ‘NULL’ の場合があり、その時
     ‘PySequence_Contains()’ はシンプルにマッチするオブジェクトを見つけ
     るまでシーケンスを巡回します。

 -- C のメンバ変数: *note binaryfunc: 51a0. *note PySequenceMethods:
          4ef4.sq_inplace_concat

     ' The corresponding *note slot ID: 50dc. ‘Py_sq_inplace_concat’ is
     part of the *note Stable ABI: 775.'

     This function is used by *note PySequence_InPlaceConcat(): 50a5.
     and has the same signature.  It should modify its first operand,
     and return it.  This slot may be left to ‘NULL’, in this case
     ‘PySequence_InPlaceConcat()’ will fall back to *note
     PySequence_Concat(): 50a1.  It is also used by the augmented
     assignment ‘+=’, after trying numeric in-place addition via the
     *note nb_inplace_add: 5622. slot.

 -- C のメンバ変数: *note ssizeargfunc: 51b7. *note PySequenceMethods:
          4ef4.sq_inplace_repeat

     ' The corresponding *note slot ID: 50dc. ‘Py_sq_inplace_repeat’ is
     part of the *note Stable ABI: 775.'

     This function is used by *note PySequence_InPlaceRepeat(): 50a6.
     and has the same signature.  It should modify its first operand,
     and return it.  This slot may be left to ‘NULL’, in this case
     ‘PySequence_InPlaceRepeat()’ will fall back to *note
     PySequence_Repeat(): 50aa.  It is also used by the augmented
     assignment ‘*=’, after trying numeric in-place multiplication via
     the *note nb_inplace_multiply: 5626. slot.


File: python.info,  Node: バッファオブジェクト構造体 buffer object structure,  Next: async オブジェクト構造体,  Prev: シーケンスオブジェクト構造体,  Up: Type Object Structures

7.13.4.14 バッファオブジェクト構造体 (buffer object structure)
..............................................................

 -- C のデータ型: type PyBufferProcs

     この構造体は *note buffer プロトコル: 260. が要求する関数群へのポイ
     ンタを保持しています。 そのプロトコルは、エクスポーターオブジェクト
     が如何にして、その内部データをコンシューマオブジェクトに渡すかを定
     義します。

 -- C のメンバ変数: *note getbufferproc: 51a6. *note PyBufferProcs:
          52f1.bf_getbuffer

     ' The corresponding *note slot ID: 50dc. ‘Py_bf_getbuffer’ is part
     of the *note Stable ABI: 775. (バージョン 3.11 より).'

     この関数のシグネチャは以下の通りです:

          int (PyObject *exporter, Py_buffer *view, int flags);

     'flags' で指定された方法で 'view' を埋めてほしいという 'exporter' に
     対する要求を処理します。ステップ(3) を除いて、この関数の実装では以
     下のステップを行わなければなりません:

       1. Check if the request can be met.  If not, raise *note
          BufferError: 1797, set view->obj to ‘NULL’ and return ‘-1’.

       2. 要求されたフィールドを埋めます。

       3. エクスポートした回数を保持する内部カウンタをインクリメントしま
          す。

       4. view->obj に 'exporter' を設定し、 view->obj をインクリメント
          します。

       5. ‘0’ を返します。

     'exporter' がバッファプロバイダのチェインかツリーの一部であれば、２
     つの主要な方式が使用できます:

        * 再エクスポート: ツリーの各要素がエクスポートされるオブジェクト
          として振る舞い、自身への新しい参照を view->obj へセットします
          。

        * リダイレクト: バッファ要求がツリーのルートオブジェクトにリダイ
          レクトされます。ここでは、 view->obj はルートオブジェクトへの
          新しい参照になります。

     'view' の個別のフィールドは *note バッファ構造体: 52b8. の節で説明
     されており、エクスポートが特定の要求に対しどう対応しなければならな
     いかの規則は、 *note バッファ要求のタイプ: 1249. の節にあります。

     *note Py_buffer: 95c. 構造体の中から参照している全てのメモリはエク
     スポータに属し、コンシューマがいなくなるまで有効でなくてはなりませ
     ん。 *note format: 52c1. 、 *note shape: 52c2. 、 *note strides:
     52bc. 、 *note suboffsets: 52c4. 、 *note internal: 52c6. はコンシ
     ューマからは読み出し専用です。

     *note PyBuffer_FillInfo(): 964. は、全てのリクエストタイプを正しく
     扱う際に、単純なバイトバッファを公開する簡単な方法を提供します。

     *note PyObject_GetBuffer(): 63a. は、この関数をラップするコンシュー
     マ向けのインターフェースです。

 -- C のメンバ変数: *note releasebufferproc: 51b1. *note PyBufferProcs:
          52f1.bf_releasebuffer

     ' The corresponding *note slot ID: 50dc. ‘Py_bf_releasebuffer’ is
     part of the *note Stable ABI: 775. (バージョン 3.11 より).'

     この関数のシグネチャは以下の通りです:

          void (PyObject *exporter, Py_buffer *view);

     バッファのリソースを開放する要求を処理します。もし開放する必要のあ
     るリソースがない場合、 *note PyBufferProcs.bf_releasebuffer: 967. は
     ‘NULL’ にしても構いません。そうでない場合は、この関数の標準的な実装
     は、以下の任意の処理手順 (optional step) を行います:

       1. エクスポートした回数を保持する内部カウンタをデクリメントします
          。

       2. カウンタが ‘0’ の場合は、'view' に関連付けられた全てのメモリを
          解放します。

     エクスポータは、バッファ固有のリソースを監視し続けるために *note
     internal: 52c6. フィールドを使わなければなりません。このフィールド
     は、コンシューマが 'view' 引数としてオリジナルのバッファのコピーを
     渡しているであろう間、変わらないことが保証されています。

     この関数は、view->obj をデクリメントしてはいけません、なぜならそれ
     は *note PyBuffer_Release(): 63b. で自動的に行われるからです(この方
     式は参照の循環を防ぐのに有用です)。

     *note PyBuffer_Release(): 63b. は、この関数をラップするコンシューマ
     向けのインターフェースです。


File: python.info,  Node: async オブジェクト構造体,  Next: Slot Type typedefs,  Prev: バッファオブジェクト構造体 buffer object structure,  Up: Type Object Structures

7.13.4.15 async オブジェクト構造体
..................................

Added in version 3.5.

 -- C のデータ型: type PyAsyncMethods

     この構造体は *note awaitable: 4c9. オブジェクトと *note
     asynchronous iterator: 4c7. オブジェクトを実装するのに必要な関数へ
     のポインタを保持しています。

     以下は構造体の定義です:

          typedef struct {
              unaryfunc am_await;
              unaryfunc am_aiter;
              unaryfunc am_anext;
              sendfunc am_send;
          } PyAsyncMethods;

 -- C のメンバ変数: *note unaryfunc: 51bb. *note PyAsyncMethods:
          52ea.am_await

     ' The corresponding *note slot ID: 50dc. ‘Py_am_await’ is part of
     the *note Stable ABI: 775. (バージョン 3.5 より).'

     この関数のシグネチャは以下の通りです:

          PyObject *am_await(PyObject *self);

     返されるオブジェクトは *note イテレータ: 4c8. でなければなりません
     。 つまりこのオブジェクトに対して *note PyIter_Check(): 1cb2. が
     ‘1’ を返さなければなりません。

     オブジェクトが *note awaitable: 4c9. でない場合、このスロットを
     ‘NULL’ に設定します。

 -- C のメンバ変数: *note unaryfunc: 51bb. *note PyAsyncMethods:
          52ea.am_aiter

     ' The corresponding *note slot ID: 50dc. ‘Py_am_aiter’ is part of
     the *note Stable ABI: 775. (バージョン 3.5 より).'

     この関数のシグネチャは以下の通りです:

          PyObject *am_aiter(PyObject *self);

     Must return an *note asynchronous iterator: 4c7. object.  See *note
     __anext__(): 1882. for details.

     オブジェクトが非同期反復処理のプロトコルを実装していない場合、この
     スロットを ‘NULL’ に設定します。

 -- C のメンバ変数: *note unaryfunc: 51bb. *note PyAsyncMethods:
          52ea.am_anext

     ' The corresponding *note slot ID: 50dc. ‘Py_am_anext’ is part of
     the *note Stable ABI: 775. (バージョン 3.5 より).'

     この関数のシグネチャは以下の通りです:

          PyObject *am_anext(PyObject *self);

     Must return an *note awaitable: 4c9. object.  See *note
     __anext__(): 1882. for details.  This slot may be set to ‘NULL’.

 -- C のメンバ変数: *note sendfunc: 5621. *note PyAsyncMethods:
          52ea.am_send

     ' The corresponding *note slot ID: 50dc. ‘Py_am_send’ is part of
     the *note Stable ABI: 775. (バージョン 3.10 より).'

     この関数のシグネチャは以下の通りです:

          PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);

     See *note PyIter_Send(): a98. for details.  This slot may be set to
     ‘NULL’.

     Added in version 3.10.


File: python.info,  Node: Slot Type typedefs,  Next: 使用例<57>,  Prev: async オブジェクト構造体,  Up: Type Object Structures

7.13.4.16 Slot Type typedefs
............................

 -- C のデータ型: typedef *note PyObject: 5df. *(*allocfunc)(*note
          PyTypeObject: c9c. *cls, *note Py_ssize_t: c55. nitems)
     ' 次に属します: *note Stable ABI: 775.'  The purpose of this
     function is to separate memory allocation from memory
     initialization.  It should return a pointer to a block of memory of
     adequate length for the instance, suitably aligned, and initialized
     to zeros, but with *note ob_refcnt: a9f. set to ‘1’ and *note
     ob_type: 4ecd. set to the type argument.  If the type's *note
     tp_itemsize: 23bb. is non-zero, the object's *note ob_size: 511c.
     field should be initialized to 'nitems' and the length of the
     allocated memory block should be ‘tp_basicsize +
     nitems*tp_itemsize’, rounded up to a multiple of ‘sizeof(void*)’;
     otherwise, 'nitems' is not used and the length of the block should
     be *note tp_basicsize: b7e.

     この関数では他のいかなるインスタンス初期化も行ってはなりません。追
     加のメモリ割り当てすらも行ってはなりません。そのような処理は *note
     tp_new: 79f. で行われるべきです。

 -- C のデータ型: typedef void (*destructor)(*note PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'

 -- C のデータ型: typedef void (*freefunc)(void*)

     *note tp_free: 4ecf. を参照してください。

 -- C のデータ型: typedef *note PyObject: 5df. *(*newfunc)(*note
          PyTypeObject: c9c.*, *note PyObject: 5df.*, *note PyObject:
          5df.*)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_new: 79f. を参照
     してください。

 -- C のデータ型: typedef int (*initproc)(*note PyObject: 5df.*, *note
          PyObject: 5df.*, *note PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_init: 7a1. を参照
     してください。

 -- C のデータ型: typedef *note PyObject: 5df. *(*reprfunc)(*note
          PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_repr: 4ee4. を参
     照してください。

 -- C のデータ型: typedef *note PyObject: 5df. *(*getattrfunc)(*note
          PyObject: 5df. *self, char *attr)
     ' 次に属します: *note Stable ABI: 775.'  オブジェクトの属性の値を返
     します。

 -- C のデータ型: typedef int (*setattrfunc)(*note PyObject: 5df. *self,
          char *attr, *note PyObject: 5df. *value)
     ' 次に属します: *note Stable ABI: 775.'  オブジェクトの属性に値を設
     定します。属性を削除するには、 value (実) 引数に ‘NULL’ を設定しま
     す。

 -- C のデータ型: typedef *note PyObject: 5df. *(*getattrofunc)(*note
          PyObject: 5df. *self, *note PyObject: 5df. *attr)
     ' 次に属します: *note Stable ABI: 775.'  オブジェクトの属性の値を返
     します。

     *note tp_getattro: 1a64. を参照してください。

 -- C のデータ型: typedef int (*setattrofunc)(*note PyObject: 5df.
          *self, *note PyObject: 5df. *attr, *note PyObject: 5df.
          *value)
     ' 次に属します: *note Stable ABI: 775.'  オブジェクトの属性に値を設
     定します。属性を削除するには、 value (実) 引数に ‘NULL’ を設定しま
     す。

     *note tp_setattro: 4ee8. を参照してください。

 -- C のデータ型: typedef *note PyObject: 5df. *(*descrgetfunc)(*note
          PyObject: 5df.*, *note PyObject: 5df.*, *note PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_descr_get: 5616.
     を参照してください。

 -- C のデータ型: typedef int (*descrsetfunc)(*note PyObject: 5df.*,
          *note PyObject: 5df.*, *note PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_descr_set: 1cb4.
     を参照してください。

 -- C のデータ型: typedef *note Py_hash_t: 147b. (*hashfunc)(*note
          PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_hash: 4ef6. を参
     照してください。

 -- C のデータ型: typedef *note PyObject: 5df. *(*richcmpfunc)(*note
          PyObject: 5df.*, *note PyObject: 5df.*, int)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_richcompare:
     4ef0. を参照してください。

 -- C のデータ型: typedef *note PyObject: 5df. *(*getiterfunc)(*note
          PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_iter: 1708. を参
     照してください。

 -- C のデータ型: typedef *note PyObject: 5df. *(*iternextfunc)(*note
          PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_iternext: 1709. を
     参照してください。

 -- C のデータ型: typedef *note Py_ssize_t: c55. (*lenfunc)(*note
          PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'

 -- C のデータ型: typedef int (*getbufferproc)(*note PyObject: 5df.*,
          *note Py_buffer: 95c.*, int)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'

 -- C のデータ型: typedef void (*releasebufferproc)(*note PyObject:
          5df.*, *note Py_buffer: 95c.*)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.12 より).'

 -- C のデータ型: typedef *note PyObject: 5df. *(*unaryfunc)(*note
          PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'

 -- C のデータ型: typedef *note PyObject: 5df. *(*binaryfunc)(*note
          PyObject: 5df.*, *note PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'

 -- C のデータ型: typedef *note PySendResult: 52b4. (*sendfunc)(*note
          PyObject: 5df.*, *note PyObject: 5df.*, *note PyObject:
          5df.**)

     *note am_send: 5620. を参照してください。

 -- C のデータ型: typedef *note PyObject: 5df. *(*ternaryfunc)(*note
          PyObject: 5df.*, *note PyObject: 5df.*, *note PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'

 -- C のデータ型: typedef *note PyObject: 5df. *(*ssizeargfunc)(*note
          PyObject: 5df.*, *note Py_ssize_t: c55.)
     ' 次に属します: *note Stable ABI: 775.'

 -- C のデータ型: typedef int (*ssizeobjargproc)(*note PyObject: 5df.*,
          *note Py_ssize_t: c55, *note PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'

 -- C のデータ型: typedef int (*objobjproc)(*note PyObject: 5df.*, *note
          PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'

 -- C のデータ型: typedef int (*objobjargproc)(*note PyObject: 5df.*,
          *note PyObject: 5df.*, *note PyObject: 5df.*)
     ' 次に属します: *note Stable ABI: 775.'


File: python.info,  Node: 使用例<57>,  Prev: Slot Type typedefs,  Up: Type Object Structures

7.13.4.17 使用例
................

ここでは Python の型定義の簡単な例をいくつか挙げます。これらの例にはあな
たが遭遇する共通的な利用例を含んでいます。いくつかの例ではトリッキーなコ
ーナーケースを実演しています。より多くの例や実践的な情報、チュートリアル
が必要なら、*note 拡張の型の定義; チュートリアル: 4ec5. や *note
拡張の型の定義; 雑多なトピック: 4ede. を参照してください。

A basic *note static type: 983.:

     typedef struct {
         PyObject_HEAD
         const char *data;
     } MyObject;

     static PyTypeObject MyObject_Type = {
         PyVarObject_HEAD_INIT(NULL, 0)
         .tp_name = "mymod.MyObject",
         .tp_basicsize = sizeof(MyObject),
         .tp_doc = PyDoc_STR("My objects"),
         .tp_new = myobj_new,
         .tp_dealloc = (destructor)myobj_dealloc,
         .tp_repr = (reprfunc)myobj_repr,
     };

より冗長な初期化子を用いた古いコードを（特にCPythonのコードベース中で）
見かけることがあるかもしれません:

     static PyTypeObject MyObject_Type = {
         PyVarObject_HEAD_INIT(NULL, 0)
         "mymod.MyObject",               /* tp_name */
         sizeof(MyObject),               /* tp_basicsize */
         0,                              /* tp_itemsize */
         (destructor)myobj_dealloc,      /* tp_dealloc */
         0,                              /* tp_vectorcall_offset */
         0,                              /* tp_getattr */
         0,                              /* tp_setattr */
         0,                              /* tp_as_async */
         (reprfunc)myobj_repr,           /* tp_repr */
         0,                              /* tp_as_number */
         0,                              /* tp_as_sequence */
         0,                              /* tp_as_mapping */
         0,                              /* tp_hash */
         0,                              /* tp_call */
         0,                              /* tp_str */
         0,                              /* tp_getattro */
         0,                              /* tp_setattro */
         0,                              /* tp_as_buffer */
         0,                              /* tp_flags */
         PyDoc_STR("My objects"),        /* tp_doc */
         0,                              /* tp_traverse */
         0,                              /* tp_clear */
         0,                              /* tp_richcompare */
         0,                              /* tp_weaklistoffset */
         0,                              /* tp_iter */
         0,                              /* tp_iternext */
         0,                              /* tp_methods */
         0,                              /* tp_members */
         0,                              /* tp_getset */
         0,                              /* tp_base */
         0,                              /* tp_dict */
         0,                              /* tp_descr_get */
         0,                              /* tp_descr_set */
         0,                              /* tp_dictoffset */
         0,                              /* tp_init */
         0,                              /* tp_alloc */
         myobj_new,                      /* tp_new */
     };

弱参照やインスタンス辞書、ハッシュをサポートする型:

     typedef struct {
         PyObject_HEAD
         const char *data;
     } MyObject;

     static PyTypeObject MyObject_Type = {
         PyVarObject_HEAD_INIT(NULL, 0)
         .tp_name = "mymod.MyObject",
         .tp_basicsize = sizeof(MyObject),
         .tp_doc = PyDoc_STR("My objects"),
         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
              Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_MANAGED_DICT |
              Py_TPFLAGS_MANAGED_WEAKREF,
         .tp_new = myobj_new,
         .tp_traverse = (traverseproc)myobj_traverse,
         .tp_clear = (inquiry)myobj_clear,
         .tp_alloc = PyType_GenericNew,
         .tp_dealloc = (destructor)myobj_dealloc,
         .tp_repr = (reprfunc)myobj_repr,
         .tp_hash = (hashfunc)myobj_hash,
         .tp_richcompare = PyBaseObject_Type.tp_richcompare,
     };

A str subclass that cannot be subclassed and cannot be called to create
instances (e.g.  uses a separate factory func) using *note
Py_TPFLAGS_DISALLOW_INSTANTIATION: 7a2. flag:

     typedef struct {
         PyUnicodeObject raw;
         char *extra;
     } MyStr;

     static PyTypeObject MyStr_Type = {
         PyVarObject_HEAD_INIT(NULL, 0)
         .tp_name = "mymod.MyStr",
         .tp_basicsize = sizeof(MyStr),
         .tp_base = NULL,  // set to &PyUnicode_Type in module init
         .tp_doc = PyDoc_STR("my custom str"),
         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
         .tp_repr = (reprfunc)myobj_repr,
     };

The simplest *note static type: 983. with fixed-length instances:

     typedef struct {
         PyObject_HEAD
     } MyObject;

     static PyTypeObject MyObject_Type = {
         PyVarObject_HEAD_INIT(NULL, 0)
         .tp_name = "mymod.MyObject",
     };

The simplest *note static type: 983. with variable-length instances:

     typedef struct {
         PyObject_VAR_HEAD
         const char *data[1];
     } MyObject;

     static PyTypeObject MyObject_Type = {
         PyVarObject_HEAD_INIT(NULL, 0)
         .tp_name = "mymod.MyObject",
         .tp_basicsize = sizeof(MyObject) - sizeof(char *),
         .tp_itemsize = sizeof(char *),
     };


File: python.info,  Node: 循環参照ガベージコレクションをサポートする,  Prev: Type Object Structures,  Up: オブジェクト実装サポート object implementation support

7.13.5 循環参照ガベージコレクションをサポートする
-------------------------------------------------

Python が循環参照を含むガベージの検出とコレクションをサポートするには、
他のオブジェクトに対する "コンテナ" (他のオブジェクトには他のコンテナも
含みます) となるオブジェクト型によるサポートが必要です。他のオブジェクト
に対する参照を記憶しないオブジェクトや、(数値や文字列のような) アトム型
(atomic type) への参照だけを記憶するような型では、ガベージコレクションに
際して特別これといったサポートを提供する必要はありません。

To create a container type, the *note tp_flags: 1c71. field of the type
object must include the *note Py_TPFLAGS_HAVE_GC: 981. and provide an
implementation of the *note tp_traverse: 982. handler.  If instances of
the type are mutable, a *note tp_clear: 4ee2. implementation must also
be provided.

*note Py_TPFLAGS_HAVE_GC: 981.

     このフラグをセットした型のオブジェクトは、この節に述べた規則に適合
     しなければなりません。簡単のため、このフラグをセットした型のオブジ
     ェクトをコンテナオブジェクトと呼びます。

コンテナ型のコンストラクタは以下の二つの規則に適合しなければなりません:

  1. The memory for the object must be allocated using *note
     PyObject_GC_New: c99. or *note PyObject_GC_NewVar: c9a.

  2. 他のコンテナへの参照が入るかもしれないフィールドが全て初期化された
     ら、すぐに *note PyObject_GC_Track(): 171d. を呼び出さなければなり
     ません。

同様に、オブジェクトのメモリ解放関数も以下の二つの規則に適合しなければな
りません:

  1. 他のコンテナを参照しているフィールドを無効化する前に、 *note
     PyObject_GC_UnTrack(): 171e. を呼び出さなければなりません。

  2. オブジェクトのメモリは *note PyObject_GC_Del(): 171c. で解放しなけ
     ればなりません。

          警告: If a type adds the Py_TPFLAGS_HAVE_GC, then it 'must'
          implement at least a *note tp_traverse: 982. handler or
          explicitly use one from its subclass or subclasses.

          When calling *note PyType_Ready(): 980. or some of the APIs
          that indirectly call it like *note PyType_FromSpecWithBases():
          79e. or *note PyType_FromSpec(): 79d. the interpreter will
          automatically populate the *note tp_flags: 1c71, *note
          tp_traverse: 982. and *note tp_clear: 4ee2. fields if the type
          inherits from a class that implements the garbage collector
          protocol and the child class does 'not' include the *note
          Py_TPFLAGS_HAVE_GC: 981. flag.

 -- C のマクロ: PyObject_GC_New (TYPE, typeobj)

     Analogous to *note PyObject_New: b7c. but for container objects
     with the *note Py_TPFLAGS_HAVE_GC: 981. flag set.

     Do not call this directly to allocate memory for an object; call
     the type's *note tp_alloc: 4ed0. slot instead.

     When populating a type's *note tp_alloc: 4ed0. slot, *note
     PyType_GenericAlloc(): c61. is preferred over a custom function
     that simply calls this macro.

     Memory allocated by this macro must be freed with *note
     PyObject_GC_Del(): 171c. (usually called via the object's *note
     tp_free: 4ecf. slot).

     参考
     ....

        * *note PyObject_GC_Del(): 171c.

        * *note PyObject_New: b7c.

        * *note PyType_GenericAlloc(): c61.

        * *note tp_alloc: 4ed0.

 -- C のマクロ: PyObject_GC_NewVar (TYPE, typeobj, size)

     Analogous to *note PyObject_NewVar: b7d. but for container objects
     with the *note Py_TPFLAGS_HAVE_GC: 981. flag set.

     Do not call this directly to allocate memory for an object; call
     the type's *note tp_alloc: 4ed0. slot instead.

     When populating a type's *note tp_alloc: 4ed0. slot, *note
     PyType_GenericAlloc(): c61. is preferred over a custom function
     that simply calls this macro.

     Memory allocated by this macro must be freed with *note
     PyObject_GC_Del(): 171c. (usually called via the object's *note
     tp_free: 4ecf. slot).

     参考
     ....

        * *note PyObject_GC_Del(): 171c.

        * *note PyObject_NewVar: b7d.

        * *note PyType_GenericAlloc(): c61.

        * *note tp_alloc: 4ed0.

 -- C の関数: *note PyObject: 5df.
          *PyUnstable_Object_GC_NewWithExtraData (PyTypeObject *type,
          size_t extra_size)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Analogous to *note PyObject_GC_New: c99. but allocates 'extra_size'
     bytes at the end of the object (at offset *note tp_basicsize:
     b7e.).  The allocated memory is initialized to zeros, except for
     the *note Python object header: 5df.

     The extra data will be deallocated with the object, but otherwise
     it is not managed by Python.

     Memory allocated by this function must be freed with *note
     PyObject_GC_Del(): 171c. (usually called via the object's *note
     tp_free: 4ecf. slot).

          警告: The function is marked as unstable because the final
          mechanism for reserving extra data after an instance is not
          yet decided.  For allocating a variable number of fields,
          prefer using *note PyVarObject: 46d6. and *note tp_itemsize:
          23bb. instead.

     Added in version 3.12.

 -- C のマクロ: PyObject_GC_Resize (TYPE, op, newsize)

     Resize an object allocated by *note PyObject_NewVar: b7d.  Returns
     the resized object of type ‘TYPE*’ (refers to any C type) or ‘NULL’
     on failure.

     'op' must be of type *note PyVarObject: 46d6.* and must not be
     tracked by the collector yet.  'newsize' must be of type *note
     Py_ssize_t: c55.

 -- C の関数: void PyObject_GC_Track (PyObject *op)
     ' 次に属します: *note Stable ABI: 775.'  オブジェクト 'op' を、コレ
     クタによって追跡されるオブジェクトの集合に追加します。コレクタは何
     回動くのかは予想できないので、追跡されている間はオブジェクトは正し
     い状態でいなければなりません。 *note tp_traverse: 982. の対象となる
     全てのフィールドが正しい状態になってすぐに、たいていはコンストラク
     タの末尾付近で、呼び出すべきです。

 -- C の関数: int PyObject_IS_GC (PyObject *obj)

     Returns non-zero if the object implements the garbage collector
     protocol, otherwise returns 0.

     The object cannot be tracked by the garbage collector if this
     function returns 0.

 -- C の関数: int PyObject_GC_IsTracked (PyObject *op)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.9 より).'
     Returns 1 if the object type of 'op' implements the GC protocol and
     'op' is being currently tracked by the garbage collector and 0
     otherwise.

     This is analogous to the Python function *note gc.is_tracked():
     1525.

     Added in version 3.9.

 -- C の関数: int PyObject_GC_IsFinalized (PyObject *op)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.9 より).'
     Returns 1 if the object type of 'op' implements the GC protocol and
     'op' has been already finalized by the garbage collector and 0
     otherwise.

     This is analogous to the Python function *note gc.is_finalized():
     af9.

     Added in version 3.9.

 -- C の関数: void PyObject_GC_Del (void *op)
     ' 次に属します: *note Stable ABI: 775.'  Releases memory allocated
     to an object using *note PyObject_GC_New: c99. or *note
     PyObject_GC_NewVar: c9a.

     Do not call this directly to free an object's memory; call the
     type's *note tp_free: 4ecf. slot instead.

     Do not use this for memory allocated by *note PyObject_New: b7c,
     *note PyObject_NewVar: b7d, or related allocation functions; use
     *note PyObject_Free(): e60. instead.

     参考
     ....

        * *note PyObject_Free(): e60. is the non-GC equivalent of this
          function.

        * *note PyObject_GC_New: c99.

        * *note PyObject_GC_NewVar: c9a.

        * *note PyType_GenericAlloc(): c61.

        * *note tp_free: 4ecf.

 -- C の関数: void PyObject_GC_UnTrack (void *op)
     ' 次に属します: *note Stable ABI: 775.'  オブジェクト 'op' を、コレ
     クタによって追跡されるオブジェクトの集合から除去します。このオブジ
     ェクトに対して *note PyObject_GC_Track(): 171d. を再度呼び出して、
     追跡されるオブジェクトの集合に戻すことも可能です。 *note
     tp_traverse: 982. ハンドラの対象となるフィールドが正しくない状態に
     なる前に、デアロケータ (*note tp_dealloc: 4ebc. ハンドラ) はオブジ
     ェクトに対して、この関数を呼び出すべきです。

バージョン 3.8 で変更: The ‘_PyObject_GC_TRACK()’ and
‘_PyObject_GC_UNTRACK()’ macros have been removed from the public C API.

*note tp_traverse: 982. ハンドラはこの型の関数パラメータを受け取ります:

 -- C のデータ型: typedef int (*visitproc)(*note PyObject: 5df. *object,
          void *arg)
     ' 次に属します: *note Stable ABI: 775.'  *note tp_traverse: 982. ハ
     ンドラに渡されるビジター関数 (visitor function) の型です。この関数
     は、探索するオブジェクトを 'object' として、 *note tp_traverse:
     982. ハンドラの第 3 引数を 'arg' として呼び出します。 Python のコア
     はいくつかのビジター関数を使って、ゴミとなった循環参照を検出する仕
     組みを実装します; ユーザが自身のためにビジター関数を書く必要が出て
     くることはないでしょう。

*note tp_traverse: 982. ハンドラは次の型を持っていなければなりません:

 -- C のデータ型: typedef int (*traverseproc)(*note PyObject: 5df.
          *self, *note visitproc: 51bc. visit, void *arg)
     ' 次に属します: *note Stable ABI: 775.'  コンテナオブジェクトのため
     のトラバーサル関数 (traversal function) です。 実装では、'self' に
     直接入っている各オブジェクトに対して 'visit' 関数を呼び出さなければ
     なりません。 このとき、'visit' へのパラメタはコンテナに入っている各
     オブジェクトと、このハンドラに渡された 'arg' の値です。 'visit' 関
     数は ‘NULL’ オブジェクトを引数に渡して呼び出してはなりません。
     'visit' が非ゼロの値を返す場合、エラーが発生し、戻り値をそのまま返
     すようにしなければなりません。

     The traversal function must not have any side effects.
     Implementations may not modify the reference counts of any Python
     objects nor create or destroy any Python objects.

*note tp_traverse: 982. ハンドラを簡潔に書くために、 *note Py_VISIT():
4ed9. マクロが提供されています。このマクロを使うためには、 *note
tp_traverse: 982. の実装関数の引数は、一文字も違わず 'visit' と 'arg' で
なければなりません:

 -- C のマクロ: Py_VISIT (o)

     If the *note PyObject: 5df.* 'o' is not ‘NULL’, call the 'visit'
     callback, with arguments 'o' and 'arg'.  If 'visit' returns a
     non-zero value, then return it.  Using this macro, *note
     tp_traverse: 982. handlers look like:

          static int
          my_traverse(Noddy *self, visitproc visit, void *arg)
          {
              Py_VISIT(self->foo);
              Py_VISIT(self->bar);
              return 0;
          }

*note tp_clear: 4ee2. ハンドラは *note inquiry: 51ab. 型であるか、オブジ
ェクトが不変 (immutable) な場合は ‘NULL’ でなければなりません。

 -- C のデータ型: typedef int (*inquiry)(*note PyObject: 5df. *self)
     ' 次に属します: *note Stable ABI: 775.'  循環参照を形成しているとお
     ぼしき参照群を放棄します。変更不可能なオブジェクトは循環参照を直接
     形成することが決してないので、この関数を定義する必要はありません。
     このメソッドを呼び出した後でもオブジェクトは有効なままでなければな
     らないので注意してください (参照に対して *note Py_DECREF(): 790. を
     呼ぶだけにしないでください)。ガベージコレクタは、オブジェクトが循環
     参照を形成していることを検出した際にこのメソッドを呼び出します。

* Menu:

* Controlling the Garbage Collector State::
* Querying Garbage Collector State::


File: python.info,  Node: Controlling the Garbage Collector State,  Next: Querying Garbage Collector State,  Up: 循環参照ガベージコレクションをサポートする

7.13.5.1 Controlling the Garbage Collector State
................................................

The C-API provides the following functions for controlling garbage
collection runs.

 -- C の関数: *note Py_ssize_t: c55. PyGC_Collect (void)
     ' 次に属します: *note Stable ABI: 775.'  Perform a full garbage
     collection, if the garbage collector is enabled.  (Note that *note
     gc.collect(): 1b3. runs it unconditionally.)

     Returns the number of collected + unreachable objects which cannot
     be collected.  If the garbage collector is disabled or already
     collecting, returns ‘0’ immediately.  Errors during garbage
     collection are passed to *note sys.unraisablehook: 507.  This
     function does not raise exceptions.

 -- C の関数: int PyGC_Enable (void)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Enable the garbage collector: similar to *note gc.enable(): 4a0e.
     Returns the previous state, 0 for disabled and 1 for enabled.

     Added in version 3.10.

 -- C の関数: int PyGC_Disable (void)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Disable the garbage collector: similar to *note gc.disable(): 4a0f.
     Returns the previous state, 0 for disabled and 1 for enabled.

     Added in version 3.10.

 -- C の関数: int PyGC_IsEnabled (void)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.10 より).'
     Query the state of the garbage collector: similar to *note
     gc.isenabled(): 4a10.  Returns the current state, 0 for disabled
     and 1 for enabled.

     Added in version 3.10.


File: python.info,  Node: Querying Garbage Collector State,  Prev: Controlling the Garbage Collector State,  Up: 循環参照ガベージコレクションをサポートする

7.13.5.2 Querying Garbage Collector State
.........................................

The C-API provides the following interface for querying information
about the garbage collector.

 -- C の関数: void PyUnstable_GC_VisitObjects (gcvisitobjects_t
          callback, void *arg)

          これは Unstable APIです。マイナーリリースで予告なく変更されることがあります。 'これは *note Unstable API: 769.です。マイナーリリースで予告なく変更されることがあります。': 
     Run supplied 'callback' on all live GC-capable objects.  'arg' is
     passed through to all invocations of 'callback'.

          警告: If new objects are (de)allocated by the callback it is
          undefined if they will be visited.

          Garbage collection is disabled during operation.  Explicitly
          running a collection in the callback may lead to undefined
          behaviour e.g.  visiting the same objects multiple times or
          not at all.

     Added in version 3.12.

 -- C のデータ型: typedef int (*gcvisitobjects_t)(*note PyObject: 5df.
          *object, void *arg)

     Type of the visitor function to be passed to *note
     PyUnstable_GC_VisitObjects(): 5670.  'arg' is the same as the 'arg'
     passed to ‘PyUnstable_GC_VisitObjects’.  Return ‘1’ to continue
     iteration, return ‘0’ to stop iteration.  Other return values are
     reserved for now so behavior on returning anything else is
     undefined.

     Added in version 3.12.


File: python.info,  Node: API と ABI のバージョニング,  Next: Monitoring C API,  Prev: オブジェクト実装サポート object implementation support,  Up: Python/C API リファレンスマニュアル

7.14 API と ABI のバージョニング
================================

* Menu:

* Build-time version constants::
* Run-time version::
* Bit-packing macros::


File: python.info,  Node: Build-time version constants,  Next: Run-time version,  Up: API と ABI のバージョニング

7.14.1 Build-time version constants
-----------------------------------

CPython exposes its version number in the following macros.  Note that
these correspond to the version code is 'built' with.  See *note
Py_Version: 381. for the version used at 'run time'.

バージョン間の API と ABI の安定性については *note C API の安定性: 775.
を参照してください。

 -- C のマクロ: PY_MAJOR_VERSION

     ‘3.4.1a2’ の ‘3’ 。

 -- C のマクロ: PY_MINOR_VERSION

     ‘3.4.1a2’ の ‘4’ 。

 -- C のマクロ: PY_MICRO_VERSION

     ‘3.4.1a2’ の ‘1’ 。

 -- C のマクロ: PY_RELEASE_LEVEL

     ‘3.4.1a2’ の ‘a’ 。アルファでは ‘0xA’ 、ベータでは ‘0xB’ 、リリース
     候補では ‘0xC’ 、最終版では ‘0xF’ となります。

 -- C のマクロ: PY_RELEASE_SERIAL

     ‘3.4.1a2’ の ‘2’ 。最終リリースでは 0 になります。

 -- C のマクロ: PY_VERSION_HEX

     The Python version number encoded in a single integer.  See *note
     Py_PACK_FULL_VERSION(): 380. for the encoding details.

     Use this for numeric comparisons, for example, ‘#if PY_VERSION_HEX
     >= ...’.

These macros are defined in Include/patchlevel.h(1).

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Include/patchlevel.h


File: python.info,  Node: Run-time version,  Next: Bit-packing macros,  Prev: Build-time version constants,  Up: API と ABI のバージョニング

7.14.2 Run-time version
-----------------------

 -- C 変数: const unsigned long Py_Version
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.11 より).'
     The Python runtime version number encoded in a single constant
     integer.  See *note Py_PACK_FULL_VERSION(): 380. for the encoding
     details.  This contains the Python version used at run time.

     Use this for numeric comparisons, for example, ‘if (Py_Version >=
     ...)’.

     Added in version 3.11.


File: python.info,  Node: Bit-packing macros,  Prev: Run-time version,  Up: API と ABI のバージョニング

7.14.3 Bit-packing macros
-------------------------

 -- C の関数: uint32_t Py_PACK_FULL_VERSION (int major, int minor, int
          micro, int release_level, int release_serial)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Return the given version, encoded as a single 32-bit integer with
     the following structure:

     Argument               No.  of     Bit mask             Bit shift       Example values
                            bits                                             
                            
     -----------------------------------------------------------------------------------------------------------
                            
     ‘3.4.1a2’              ‘3.10.0’
                            
                                                                                               
     'major'                8           ‘0xFF000000’         24              ‘0x03’            ‘0x03’
                                                                                               
                                                                                               
     'minor'                8           ‘0x00FF0000’         16              ‘0x04’            ‘0x0A’
                                                                                               
                                                                                               
     'micro'                8           ‘0x0000FF00’         8               ‘0x01’            ‘0x00’
                                                                                               
                                                                                               
     'release_level'        4           ‘0x000000F0’         4               ‘0xA’             ‘0xF’
                                                                                               
                                                                                               
     'release_serial'       4           ‘0x0000000F’         0               ‘0x2’             ‘0x0’
                                                                                               

     例えば:

     Version           ‘Py_PACK_FULL_VERSION’ arguments         Encoded version
                                                                
     ---------------------------------------------------------------------------------
                                                                
     ‘3.4.1a2’         ‘(3, 4, 1, 0xA, 2)’                      ‘0x030401a2’
                                                                
                                                                
     ‘3.10.0’          ‘(3, 10, 0, 0xF, 0)’                     ‘0x030a00f0’
                                                                

     Out-of range bits in the arguments are ignored.  That is, the macro
     can be defined as:

          #ifndef Py_PACK_FULL_VERSION
          #define Py_PACK_FULL_VERSION(X, Y, Z, LEVEL, SERIAL) ( \
             (((X) & 0xff) << 24) |                              \
             (((Y) & 0xff) << 16) |                              \
             (((Z) & 0xff) << 8) |                               \
             (((LEVEL) & 0xf) << 4) |                            \
             (((SERIAL) & 0xf) << 0))
          #endif

     ‘Py_PACK_FULL_VERSION’ is primarily a macro, intended for use in
     ‘#if’ directives, but it is also available as an exported function.

     Added in version 3.14.

 -- C の関数: uint32_t Py_PACK_VERSION (int major, int minor)
     ' 次に属します: *note Stable ABI: 775. (バージョン 3.14 より).'
     Equivalent to ‘Py_PACK_FULL_VERSION(major, minor, 0, 0, 0)’.  The
     result does not correspond to any Python release, but is useful in
     numeric comparisons.

     Added in version 3.14.


File: python.info,  Node: Monitoring C API,  Next: Generating Execution Events,  Prev: API と ABI のバージョニング,  Up: Python/C API リファレンスマニュアル

7.15 Monitoring C API
=====================

Added in version 3.13.

An extension may need to interact with the event monitoring system.
Subscribing to events and registering callbacks can be done via the
Python API exposed in *note sys.monitoring: e0.


File: python.info,  Node: Generating Execution Events,  Prev: Monitoring C API,  Up: Python/C API リファレンスマニュアル

7.16 Generating Execution Events
================================

The functions below make it possible for an extension to fire monitoring
events as it emulates the execution of Python code.  Each of these
functions accepts a ‘PyMonitoringState’ struct which contains concise
information about the activation state of events, as well as the event
arguments, which include a ‘PyObject*’ representing the code object, the
instruction offset and sometimes additional, event-specific arguments
(see *note sys.monitoring: e0. for details about the signatures of the
different event callbacks).  The ‘codelike’ argument should be an
instance of *note types.CodeType: 32f. or of a type that emulates it.

The VM disables tracing when firing an event, so there is no need for
user code to do that.

Monitoring functions should not be called with an exception set, except
those listed below as working with the current exception.

 -- C のデータ型: type PyMonitoringState

     Representation of the state of an event type.  It is allocated by
     the user while its contents are maintained by the monitoring API
     functions described below.

All of the functions below return 0 on success and -1 (with an exception
set) on error.

See *note sys.monitoring: e0. for descriptions of the events.

 -- C の関数: int PyMonitoring_FirePyStartEvent (PyMonitoringState
          *state, PyObject *codelike, int32_t offset)

     Fire a ‘PY_START’ event.

 -- C の関数: int PyMonitoring_FirePyResumeEvent (PyMonitoringState
          *state, PyObject *codelike, int32_t offset)

     Fire a ‘PY_RESUME’ event.

 -- C の関数: int PyMonitoring_FirePyReturnEvent (PyMonitoringState
          *state, PyObject *codelike, int32_t offset, PyObject *retval)

     Fire a ‘PY_RETURN’ event.

 -- C の関数: int PyMonitoring_FirePyYieldEvent (PyMonitoringState
          *state, PyObject *codelike, int32_t offset, PyObject *retval)

     Fire a ‘PY_YIELD’ event.

 -- C の関数: int PyMonitoring_FireCallEvent (PyMonitoringState *state,
          PyObject *codelike, int32_t offset, PyObject *callable,
          PyObject *arg0)

     Fire a ‘CALL’ event.

 -- C の関数: int PyMonitoring_FireLineEvent (PyMonitoringState *state,
          PyObject *codelike, int32_t offset, int lineno)

     Fire a ‘LINE’ event.

 -- C の関数: int PyMonitoring_FireJumpEvent (PyMonitoringState *state,
          PyObject *codelike, int32_t offset, PyObject *target_offset)

     Fire a ‘JUMP’ event.

 -- C の関数: int PyMonitoring_FireBranchLeftEvent (PyMonitoringState
          *state, PyObject *codelike, int32_t offset, PyObject
          *target_offset)

     Fire a ‘BRANCH_LEFT’ event.

 -- C の関数: int PyMonitoring_FireBranchRightEvent (PyMonitoringState
          *state, PyObject *codelike, int32_t offset, PyObject
          *target_offset)

     Fire a ‘BRANCH_RIGHT’ event.

 -- C の関数: int PyMonitoring_FireCReturnEvent (PyMonitoringState
          *state, PyObject *codelike, int32_t offset, PyObject *retval)

     Fire a ‘C_RETURN’ event.

 -- C の関数: int PyMonitoring_FirePyThrowEvent (PyMonitoringState
          *state, PyObject *codelike, int32_t offset)

     Fire a ‘PY_THROW’ event with the current exception (as returned by
     *note PyErr_GetRaisedException(): 429.).

 -- C の関数: int PyMonitoring_FireRaiseEvent (PyMonitoringState *state,
          PyObject *codelike, int32_t offset)

     Fire a ‘RAISE’ event with the current exception (as returned by
     *note PyErr_GetRaisedException(): 429.).

 -- C の関数: int PyMonitoring_FireCRaiseEvent (PyMonitoringState
          *state, PyObject *codelike, int32_t offset)

     Fire a ‘C_RAISE’ event with the current exception (as returned by
     *note PyErr_GetRaisedException(): 429.).

 -- C の関数: int PyMonitoring_FireReraiseEvent (PyMonitoringState
          *state, PyObject *codelike, int32_t offset)

     Fire a ‘RERAISE’ event with the current exception (as returned by
     *note PyErr_GetRaisedException(): 429.).

 -- C の関数: int PyMonitoring_FireExceptionHandledEvent
          (PyMonitoringState *state, PyObject *codelike, int32_t offset)

     Fire an ‘EXCEPTION_HANDLED’ event with the current exception (as
     returned by *note PyErr_GetRaisedException(): 429.).

 -- C の関数: int PyMonitoring_FirePyUnwindEvent (PyMonitoringState
          *state, PyObject *codelike, int32_t offset)

     Fire a ‘PY_UNWIND’ event with the current exception (as returned by
     *note PyErr_GetRaisedException(): 429.).

 -- C の関数: int PyMonitoring_FireStopIterationEvent (PyMonitoringState
          *state, PyObject *codelike, int32_t offset, PyObject *value)

     Fire a ‘STOP_ITERATION’ event.  If ‘value’ is an instance of *note
     StopIteration: df5, it is used.  Otherwise, a new *note
     StopIteration: df5. instance is created with ‘value’ as its
     argument.

* Menu:

* Managing the Monitoring State::


File: python.info,  Node: Managing the Monitoring State,  Up: Generating Execution Events

7.16.1 Managing the Monitoring State
------------------------------------

Monitoring states can be managed with the help of monitoring scopes.  A
scope would typically correspond to a Python function.

 -- C の関数: int PyMonitoring_EnterScope (PyMonitoringState
          *state_array, uint64_t *version, const uint8_t *event_types,
          Py_ssize_t length)

     Enter a monitored scope.  ‘event_types’ is an array of the event
     IDs for events that may be fired from the scope.  For example, the
     ID of a ‘PY_START’ event is the value
     ‘PY_MONITORING_EVENT_PY_START’, which is numerically equal to the
     base-2 logarithm of ‘sys.monitoring.events.PY_START’.
     ‘state_array’ is an array with a monitoring state entry for each
     event in ‘event_types’, it is allocated by the user but populated
     by ‘PyMonitoring_EnterScope()’ with information about the
     activation state of the event.  The size of ‘event_types’ (and
     hence also of ‘state_array’) is given in ‘length’.

     The ‘version’ argument is a pointer to a value which should be
     allocated by the user together with ‘state_array’ and initialized
     to 0, and then set only by ‘PyMonitoring_EnterScope()’ itself.  It
     allows this function to determine whether event states have changed
     since the previous call, and to return quickly if they have not.

     The scopes referred to here are lexical scopes: a function, class
     or method.  ‘PyMonitoring_EnterScope()’ should be called whenever
     the lexical scope is entered.  Scopes can be reentered, reusing the
     same 'state_array' and 'version', in situations like when emulating
     a recursive Python function.  When a code-like's execution is
     paused, such as when emulating a generator, the scope needs to be
     exited and re-entered.

     The macros for 'event_types' are:

     Macro                                                  Event
                                                            
     -------------------------------------------------------------------------------------------------
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_BRANCH_LEFT        *note BRANCH_LEFT: 295.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_BRANCH_RIGHT       *note BRANCH_RIGHT: 296.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_CALL               *note CALL: 19bd.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_C_RAISE            *note C_RAISE: 493a.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_C_RETURN           *note C_RETURN: 493b.
                                                            
                                                            
      -- C のマクロ:                                        *note EXCEPTION_HANDLED: 493c.
               PY_MONITORING_EVENT_EXCEPTION_HANDLED        

      -- C のマクロ: PY_MONITORING_EVENT_INSTRUCTION        *note INSTRUCTION: 493d.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_JUMP               *note JUMP: 493e.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_LINE               *note LINE: 493f.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_RESUME          *note PY_RESUME: 4940.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_RETURN          *note PY_RETURN: 4941.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_START           *note PY_START: 4942.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_THROW           *note PY_THROW: 1855.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_UNWIND          *note PY_UNWIND: 4943.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_PY_YIELD           *note PY_YIELD: 4944.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_RAISE              *note RAISE: 1974.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_RERAISE            *note RERAISE: 4946.
                                                            
                                                            
      -- C のマクロ: PY_MONITORING_EVENT_STOP_ITERATION     *note STOP_ITERATION: 4945.
                                                            

 -- C の関数: int PyMonitoring_ExitScope (void)

     Exit the last scope that was entered with
     ‘PyMonitoring_EnterScope()’.

 -- C の関数: int PY_MONITORING_IS_INSTRUMENTED_EVENT (uint8_t ev)

     Return true if the event corresponding to the event ID 'ev' is a
     *note local event: 494a.

     Added in version 3.13.

     バージョン 3.14 で非推奨: This function is *note soft deprecated:
     23d.


File: python.info,  Node: Python モジュールのインストール,  Next: Python HOWTO,  Prev: Python/C API リファレンスマニュアル,  Up: Top

8 Python モジュールのインストール
*********************************


Email: <distutils-sig@python.org>

人気のあるオープンソース開発プロジェクトがそうであるように、Python には
貢献者たちとユーザたちの活発なサポートコミュニティがあり、またこれらはほ
かの Python 開発者たちに、彼らのソフトウェアのオープンソースライセンスの
もとでの利用も可能にしてくれています。

これはほかの人が既に挙げた共通の(あるいは時折極めて稀有な!)問題や、彼ら
自身の解法による潜在的な貢献が共通の場所に蓄えられることによる恩恵によっ
て、Python ユーザに共有と協調を効果的に行なうことの助けとなっています。

このガイドはこれらプロセスのうち、インストールについてをカバーします。あ
なた自身の Python プロジェクトを作成し、共有するためのガイドについては
Python packaging user guide(1) を参照してください。

     注釈: あなたが企業や組織のユーザであれば、多くの組織がオープンソー
     スソフトウェアの利用と貢献に関する彼ら独自のポリシーを持っているこ
     とに気をつけてください。Python によって提供される配布とインストール
     のツールを利用する際には、そのようなポリシーを考慮に入れてください
     。

* Menu:

* 重要用語集::
* 基本的な使い方: 基本的な使い方<5>.
* どうすればいいの...？: どうすればいいの ？.
* よくあるインストールに関する問題::

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/en/latest/tutorials/packaging-projects/


File: python.info,  Node: 重要用語集,  Next: 基本的な使い方<5>,  Up: Python モジュールのインストール

8.1 重要用語集
==============

   * ‘pip’ は推奨されるインストーラ・プログラムです。 Python 3.4 からは
     、 Python バイナリ・インストーラに最初から付属するようになりました
     。

   * '仮想環境' は、システム全体にインストールするのではなく、特定のアプ
     リケーションで使用するためにパッケージをインストールできるようにす
     る半独立型のPython環境です。

   * ‘venv’ は仮想環境をつくるための標準ツールです。 Python 3.3 から
     Python の一部になりました。 Python 3.4 以降では、仮想環境をつくる際
     はそのすべてで ‘pip’ をインストールするように、あらかじめ設定されて
     います。

   * ‘virtualenv’ は ‘venv’ のサードパーティの代替案 (で前身) です。
     ‘virtualenv’ により仮想環境を Python 3.4 より前のバージョンで使うこ
     とが出来ます。 以前のバージョンは ‘venv’ を提供していませんし、作成
     された環境に ‘pip’ を自動的にインストールすることも出来ません。

   * Python Package Index(1) は Python パッケージのパブリック・リポジト
     リです。このリポジトリのパッケージは、他の Python ユーザが利用でき
     るように、オープンソースでライセンスされています。

   * Python Packaging Authority(2) は、標準のパッケージングツール、関連
     するメタデータとファイルフォーマット標準の保守と発展を担っている、
     開発者・ドキュメントの著者のグループです。彼らは様々なツールやドキ
     ュメント、issue tracker を GitHub(3) で管理しています。

   * ‘distutils’ はオリジナルのビルド・配布システムで、 Python 標準ライ
     ブラリに 1998 年に最初に追加されました。 ‘distutils’ の直接的な利用
     は段階的に取り払われていきますが、それは今でも現時点でのパッケージ
     ングと配布のインフラストラクチャの基礎として鎮座していて、標準ライ
     ブラリの一部として残っているだけでなく、その名前はほかの文脈でも生
     き続けています(Python のパッケージング標準の開発をまとめるのに使わ
     れているメーリングリストの名前のように)。

バージョン 3.5 で変更: 仮想環境の作成には、 ‘venv’ の使用をお勧めします
。

参考
....

Python Packaging User Guide: Creating and using virtual environments(4)

   ---------- Footnotes ----------

   (1) https://pypi.org

   (2) https://www.pypa.io/

   (3) https://github.com/pypa

   (4) 
https://packaging.python.org/installing/#creating-virtual-environments


File: python.info,  Node: 基本的な使い方<5>,  Next: どうすればいいの ？,  Prev: 重要用語集,  Up: Python モジュールのインストール

8.2 基本的な使い方
==================

パッケージングのための標準ツールはすべてコマンドラインから使われることを
想定しています。

以下のコマンドは、モジュールの最新バージョンとそれが依存するモジュールを
、 Python Package Index からインストールします。

     python -m pip install SomePackage

     注釈: POSIX ユーザ(macOS と Linux ユーザを含みます)向けには、このガ
     イド内の例は、 *note virtual environment: 20ee. の利用を前提にして
     います。

     Windows ユーザ向けには、このガイド内の例は、Python インストール時に
     システムの PATH 環境変数が調整されていることを前提にしています。

正確なバージョンや最小のバージョンをコマンドライン上で直接指定することも
できます。‘>’ や ‘<’ などの比較演算子など、シェルが解釈する特殊文字を使
う場合、パッケージ名とバージョンを二重引用符で囲んでください:

     python -m pip install SomePackage==1.0.4    # specific version
     python -m pip install "SomePackage>=1.0.4"  # minimum version

通常、適合するモジュールがインストール済である場合にそれを再度 install 実
行を試みても効果はありません。既に存在しているモジュールのアップグレード
には、明示的にそれを要求しなければなりません:

     python -m pip install --upgrade SomePackage

‘pip’ とその機能についての詳しい情報とリソースは Python Packaging User
Guide(1) にあります。

仮想環境の作成は *note venv: 117. モジュールを通して行われます。 有効な
仮想環境にインストールするには 上記のコマンドを使います。

参考
....

Python Packaging User Guide: Installing Python Distribution Packages(2)

   ---------- Footnotes ----------

   (1) https://packaging.python.org

   (2) https://packaging.python.org/installing/


File: python.info,  Node: どうすればいいの ？,  Next: よくあるインストールに関する問題,  Prev: 基本的な使い方<5>,  Up: Python モジュールのインストール

8.3 どうすればいいの...？
=========================

以下はよくある課題への簡単な回答もしくは回答へのリンクです。

* Menu:

* ... pip を 3.4 より前のバージョンの Python でインストールするには？: pip を 3 4 より前のバージョンの Python でインストールするには？.
* ... パッケージを現在のユーザ用のみにインストールするには？: パッケージを現在のユーザ用のみにインストールするには？.
* ... 科学技術計算用の Python パッケージをインストールするには？: 科学技術計算用の Python パッケージをインストールするには？.
* ... インストールされた複数のバージョンの Python を並行して使うには？: インストールされた複数のバージョンの Python を並行して使うには？.


File: python.info,  Node: pip を 3 4 より前のバージョンの Python でインストールするには？,  Next: パッケージを現在のユーザ用のみにインストールするには？,  Up: どうすればいいの ？

8.3.1 ... pip を 3.4 より前のバージョンの Python でインストールするには？
-------------------------------------------------------------------------

‘pip’ が Python に付属するのは 3.4 以降です。それ以前のバージョンでは、
"Python Packaging User Guide" の記載にしたがって ‘pip’ 自体をインストー
ルする必要があります。

参考
....

Python Packaging User Guide: Requirements for Installing Packages(1)

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/installing/#requirements-for-installing-packages


File: python.info,  Node: パッケージを現在のユーザ用のみにインストールするには？,  Next: 科学技術計算用の Python パッケージをインストールするには？,  Prev: pip を 3 4 より前のバージョンの Python でインストールするには？,  Up: どうすればいいの ？

8.3.2 ... パッケージを現在のユーザ用のみにインストールするには？
----------------------------------------------------------------

‘python -m pip install’ に ‘--user’ オプションを付けてください。パッケー
ジはシステムのすべてのユーザ用にではなく、現在のユーザ用のみにインストー
ルされます。


File: python.info,  Node: 科学技術計算用の Python パッケージをインストールするには？,  Next: インストールされた複数のバージョンの Python を並行して使うには？,  Prev: パッケージを現在のユーザ用のみにインストールするには？,  Up: どうすればいいの ？

8.3.3 ... 科学技術計算用の Python パッケージをインストールするには？
--------------------------------------------------------------------

科学技術計算用の Python パッケージの多くがバイナリモジュールに複雑に依存
しており、現在のところ ‘pip’ を直接使ってインストールすることは容易では
ありません。現時点では ‘pip’ を使ってインストールしようとするよりも、 別
の手段(1) を用いてインストールするほうが、多くの場合簡単でしょう。

参考
....

Python Packaging User Guide: Installing Scientific Packages(2)

   ---------- Footnotes ----------

   (1) https://packaging.python.org/science/

   (2) https://packaging.python.org/science/


File: python.info,  Node: インストールされた複数のバージョンの Python を並行して使うには？,  Prev: 科学技術計算用の Python パッケージをインストールするには？,  Up: どうすればいいの ？

8.3.4 ... インストールされた複数のバージョンの Python を並行して使うには？
--------------------------------------------------------------------------

Linux や macOS、その他の POSIX システムでは、バージョン番号付きの Python
コマンドと ‘-m’ スイッチを組み合わせて用いて、適切なバージョンの ‘pip’ を
実行してください。

     python2   -m pip install SomePackage  # default Python 2
     python2.7 -m pip install SomePackage  # specifically Python 2.7
     python3   -m pip install SomePackage  # default Python 3
     python3.4 -m pip install SomePackage  # specifically Python 3.4

適切にバージョン番号が付された ‘pip’ コマンドが使えることもあります。

Windows では、 Python ランチャーの ‘py’ を ‘-m’ スイッチとの組み合わせで
使ってください。

     py -2   -m pip install SomePackage  # default Python 2
     py -2.7 -m pip install SomePackage  # specifically Python 2.7
     py -3   -m pip install SomePackage  # default Python 3
     py -3.4 -m pip install SomePackage  # specifically Python 3.4


File: python.info,  Node: よくあるインストールに関する問題,  Prev: どうすればいいの ？,  Up: Python モジュールのインストール

8.4 よくあるインストールに関する問題
====================================

* Menu:

* Linux で、システムの Python 内にインストールする::
* pip がインストールされていない::
* バイナリの拡張のインストール::


File: python.info,  Node: Linux で、システムの Python 内にインストールする,  Next: pip がインストールされていない,  Up: よくあるインストールに関する問題

8.4.1 Linux で、システムの Python 内にインストールする
------------------------------------------------------

Linux システムでは、 Python のインストールは典型的には linux ディストリ
ビューションの一部に含まれています。この Python インストールへのインスト
ールには、システムに対する root 権限が必要で、また、 ‘pip’ によって期待
されているものとは異なるコンポーネントにアップグレードすることで、システ
ムのパッケージマネージャのオペレーションやシステムのほかのコンポーネント
の邪魔をするかもしれません。

そのようなシステムでは、 ‘pip’ でパッケージをインストールする際には仮想
環境を使うか、ユーザごとのインストールを行うのが、大抵良い方法です。


File: python.info,  Node: pip がインストールされていない,  Next: バイナリの拡張のインストール,  Prev: Linux で、システムの Python 内にインストールする,  Up: よくあるインストールに関する問題

8.4.2 pip がインストールされていない
------------------------------------

‘pip’ がデフォルトでインストールされていないことがあります。 次のコマン
ドで問題の解決が見込めます:

     python -m ensurepip --default-pip

他にも pip のインストール(1) についての資料があります。

   ---------- Footnotes ----------

   (1) 
https://packaging.python.org/en/latest/tutorials/installing-packages/#ensure-pip-setuptools-and-wheel-are-up-to-date


File: python.info,  Node: バイナリの拡張のインストール,  Prev: pip がインストールされていない,  Up: よくあるインストールに関する問題

8.4.3 バイナリの拡張のインストール
----------------------------------

Python プロジェクトの多くはソースに基いた配布に強く依存しており、インス
トールプロセスの一環として、エンドユーザ環境でソースから拡張モジュールを
コンパイルすることを期待します。

バイナリ ‘wheel’ フォーマットのサポートが導入されたことで、また、少なく
とも Windows と macOS についての wheels の公開が Python Package Index を
通して出来るようになったことで、この問題についての開発者の時間の節約と、
ユーザにとっては自身でビルドせずにビルド済み拡張をインストールするさらな
る標準化に繋がるかもしれません。

ビルド済み ‘wheel’ ファイルが未だ入手出来ない scientific software(1) イ
ンストールにおけるいくつかの解法が、ローカルにビルドすることなく他のバイ
ナリ拡張を得る助けになるかもしれません。

参考
....

Python Packaging User Guide: Binary Extensions(2)

   ---------- Footnotes ----------

   (1) https://packaging.python.org/science/

   (2) https://packaging.python.org/extensions/


File: python.info,  Node: Python HOWTO,  Next: Python よくある質問,  Prev: Python モジュールのインストール,  Up: Top

9 Python HOWTO
**************

Python HOWTOs are documents that cover a specific topic in-depth.
Modeled on the Linux Documentation Project's HOWTO collection, this
collection is an effort to foster documentation that's more detailed
than the Python Library Reference.

* Menu:

* A Conceptual Overview of asyncio::
* Python 3 への拡張モジュール移植::
* Python で Curses プログラミング::
* デスクリプタ ガイド::
* Debugging C API extensions and CPython Internals with GDB::
* 列挙型 HOWTO::
* 関数型プログラミング HOWTO::
* Logging HOWTO::
* Logging クックブック::
* 正規表現 HOWTO::
* ソケットプログラミング HOWTO::
* ソートのテクニック::
* Unicode HOWTO::
* urllib パッケージを使ってインターネット上のリソースを取得するには::
* ipaddressモジュールの紹介::
* DTrace と SystemTap で CPython を測定する::
* Python support for the Linux perf profiler::
* Annotations Best Practices::
* 拡張モジュールを分離する::
* timer file descriptor HOWTO::
* The Python 2.3 Method Resolution Order: The Python 2 3 Method Resolution Order.
* Python support for free threading::
* C API Extension Support for Free Threading::
* Remote debugging attachment protocol::
* Permission requirements::
* Locating the PyRuntime structure::
* Reading _Py_DebugOffsets::
* Locating the interpreter and thread state::
* Writing control information::
* Summary::


File: python.info,  Node: A Conceptual Overview of asyncio,  Next: Python 3 への拡張モジュール移植,  Up: Python HOWTO

9.1 A Conceptual Overview of ‘asyncio’
======================================

This *note HOWTO: 56a4. article seeks to help you build a sturdy mental
model of how *note asyncio: b. fundamentally works, helping you
understand the how and why behind the recommended patterns.

You might be curious about some key ‘asyncio’ concepts.  By the end of
this article, you'll be able to comfortably answer these questions:

   - What's happening behind the scenes when an object is awaited?

   - How does ‘asyncio’ differentiate between a task which doesn't need
     CPU time (such as a network request or file read) as opposed to a
     task that does (such as computing n-factorial)?

   - How to write an asynchronous variant of an operation, such as an
     async sleep or database request.

参考
....

   * The guide(1) that inspired this HOWTO article, by Alexander Nordin.

   * This in-depth YouTube tutorial series(2) on ‘asyncio’ created by
     Python core team member, Łukasz Langa.

   * 500 Lines or Less: A Web Crawler With asyncio Coroutines(3) by A.
     Jesse Jiryu Davis and Guido van Rossum.

* Menu:

* A conceptual overview part 1; the high-level: A conceptual overview part 1 the high-level.
* A conceptual overview part 2; the nuts and bolts: A conceptual overview part 2 the nuts and bolts.

   ---------- Footnotes ----------

   (1) 
https://github.com/anordin95/a-conceptual-overview-of-asyncio/tree/main

   (2) 
https://www.youtube.com/watch?v=Xbl7XjFYsN4&list=PLhNSoGM2ik6SIkVGXWBwerucXjgP1rHmB

   (3) 
https://aosabook.org/en/500L/a-web-crawler-with-asyncio-coroutines.html


File: python.info,  Node: A conceptual overview part 1 the high-level,  Next: A conceptual overview part 2 the nuts and bolts,  Up: A Conceptual Overview of asyncio

9.1.1 A conceptual overview part 1: the high-level
--------------------------------------------------

In part 1, we'll cover the main, high-level building blocks of
‘asyncio’: the event loop, coroutine functions, coroutine objects,
tasks, and ‘await’.

* Menu:

* イベントループ: イベントループ<2>.
* Asynchronous functions and coroutines::
* Task: Task<2>.
* await::


File: python.info,  Node: イベントループ<2>,  Next: Asynchronous functions and coroutines,  Up: A conceptual overview part 1 the high-level

9.1.1.1 イベントループ
......................

Everything in ‘asyncio’ happens relative to the event loop.  It's the
star of the show.  It's like an orchestra conductor.  It's behind the
scenes managing resources.  Some power is explicitly granted to it, but
a lot of its ability to get things done comes from the respect and
cooperation of its worker bees.

In more technical terms, the event loop contains a collection of jobs to
be run.  Some jobs are added directly by you, and some indirectly by
‘asyncio’.  The event loop takes a job from its backlog of work and
invokes it (or "gives it control"), similar to calling a function, and
then that job runs.  Once it pauses or completes, it returns control to
the event loop.  The event loop will then select another job from its
pool and invoke it.  You can 'roughly' think of the collection of jobs
as a queue: jobs are added and then processed one at a time, generally
(but not always) in order.  This process repeats indefinitely, with the
event loop cycling endlessly onwards.  If there are no more jobs pending
execution, the event loop is smart enough to rest and avoid needlessly
wasting CPU cycles, and will come back when there's more work to be
done.

Effective execution relies on jobs sharing well and cooperating; a
greedy job could hog control and leave the other jobs to starve,
rendering the overall event loop approach rather useless.

     import asyncio

     # This creates an event loop and indefinitely cycles through
     # its collection of jobs.
     event_loop = asyncio.new_event_loop()
     event_loop.run_forever()


File: python.info,  Node: Asynchronous functions and coroutines,  Next: Task<2>,  Prev: イベントループ<2>,  Up: A conceptual overview part 1 the high-level

9.1.1.2 Asynchronous functions and coroutines
.............................................

This is a basic, boring Python function:

     def hello_printer():
         print(
             "Hi, I am a lowly, simple printer, though I have all I "
             "need in life -- \nfresh paper and my dearly beloved octopus "
             "partner in crime."
         )

Calling a regular function invokes its logic or body:

     >>> hello_printer()
     Hi, I am a lowly, simple printer, though I have all I need in life --
     fresh paper and my dearly beloved octopus partner in crime.

The *note async def: 7ed, as opposed to just a plain ‘def’, makes this
an asynchronous function (or "coroutine function").  Calling it creates
and returns a *note coroutine: 37b8. object.

     async def loudmouth_penguin(magic_number: int):
         print(
          "I am a super special talking penguin. Far cooler than that printer. "
          f"By the way, my lucky number is: {magic_number}."
         )

Calling the async function, ‘loudmouth_penguin’, does not execute the
print statement; instead, it creates a coroutine object:

     >>> loudmouth_penguin(magic_number=3)
     <coroutine object loudmouth_penguin at 0x104ed2740>

The terms "coroutine function" and "coroutine object" are often
conflated as coroutine.  That can be confusing!  In this article,
coroutine specifically refers to a coroutine object, or more precisely,
an instance of *note types.CoroutineType: 1089. (native coroutine).
Note that coroutines can also exist as instances of *note
collections.abc.Coroutine: fdd. - a distinction that matters for type
checking.

A coroutine represents the function's body or logic.  A coroutine has to
be explicitly started; again, merely creating the coroutine does not
start it.  Notably, the coroutine can be paused and resumed at various
points within the function's body.  That pausing and resuming ability is
what allows for asynchronous behavior!

Coroutines and coroutine functions were built by leveraging the
functionality of *note generators: dd9. and *note generator functions:
126c.  Recall, a generator function is a function that *note yield:
bc2.s, like this one:

     def get_random_number():
         # This would be a bad random number generator!
         print("Hi")
         yield 1
         print("Hello")
         yield 7
         print("Howdy")
         yield 4
         ...

Similar to a coroutine function, calling a generator function does not
run it.  Instead, it creates a generator object:

     >>> get_random_number()
     <generator object get_random_number at 0x1048671c0>

You can proceed to the next ‘yield’ of a generator by using the built-in
function *note next(): 9d8.  In other words, the generator runs, then
pauses.  For example:

     >>> generator = get_random_number()
     >>> next(generator)
     Hi
     1
     >>> next(generator)
     Hello
     7


File: python.info,  Node: Task<2>,  Next: await,  Prev: Asynchronous functions and coroutines,  Up: A conceptual overview part 1 the high-level

9.1.1.3 Task
............

Roughly speaking, *note tasks: 37ea. are coroutines (not coroutine
functions) tied to an event loop.  A task also maintains a list of
callback functions whose importance will become clear in a moment when
we discuss *note await: 18d.  The recommended way to create tasks is via
*note asyncio.create_task(): 1c9.

Creating a task automatically schedules it for execution (by adding a
callback to run it in the event loop's to-do list, that is, collection
of jobs).

‘asyncio’ automatically associates tasks with the event loop for you.
This automatic association was purposely designed into ‘asyncio’ for the
sake of simplicity.  Without it, you'd have to keep track of the event
loop object and pass it to any coroutine function that wants to create
tasks, adding redundant clutter to your code.

     coroutine = loudmouth_penguin(magic_number=5)
     # This creates a Task object and schedules its execution via the event loop.
     task = asyncio.create_task(coroutine)

Earlier, we manually created the event loop and set it to run forever.
In practice, it's recommended to use (and common to see) *note
asyncio.run(): 2f3, which takes care of managing the event loop and
ensuring the provided coroutine finishes before advancing.  For example,
many async programs follow this setup:

     import asyncio

     async def main():
         # Perform all sorts of wacky, wild asynchronous things...
         ...

     if __name__ == "__main__":
         asyncio.run(main())
         # The program will not reach the following print statement until the
         # coroutine main() finishes.
         print("coroutine main() is done!")

It's important to be aware that the task itself is not added to the
event loop, only a callback to the task is.  This matters if the task
object you created is garbage collected before it's called by the event
loop.  For example, consider this program:

     async def hello():
         print("hello!")

     async def main():
         asyncio.create_task(hello())
         # Other asynchronous instructions which run for a while
         # and cede control to the event loop...
         ...

     asyncio.run(main())

Because there's no reference to the task object created on line 5, it
'might' be garbage collected before the event loop invokes it.  Later
instructions in the coroutine ‘main()’ hand control back to the event
loop so it can invoke other jobs.  When the event loop eventually tries
to run the task, it might fail and discover the task object does not
exist!  This can also happen even if a coroutine keeps a reference to a
task but completes before that task finishes.  When the coroutine exits,
local variables go out of scope and may be subject to garbage
collection.  In practice, ‘asyncio’ and Python's garbage collector work
pretty hard to ensure this sort of thing doesn't happen.  But that's no
reason to be reckless!


File: python.info,  Node: await,  Prev: Task<2>,  Up: A conceptual overview part 1 the high-level

9.1.1.4 await
.............

*note await: 18d. is a Python keyword that's commonly used in one of two
different ways:

     await task
     await coroutine

In a crucial way, the behavior of ‘await’ depends on the type of object
being awaited.

Awaiting a task will cede control from the current task or coroutine to
the event loop.  In the process of relinquishing control, a few
important things happen.  We'll use the following code example to
illustrate:

     async def plant_a_tree():
         dig_the_hole_task = asyncio.create_task(dig_the_hole())
         await dig_the_hole_task

         # Other instructions associated with planting a tree.
         ...

In this example, imagine the event loop has passed control to the start
of the coroutine ‘plant_a_tree()’.  As seen above, the coroutine creates
a task and then awaits it.  The ‘await dig_the_hole_task’ instruction
adds a callback (which will resume ‘plant_a_tree()’) to the
‘dig_the_hole_task’ object's list of callbacks.  And then, the
instruction cedes control to the event loop.  Some time later, the event
loop will pass control to ‘dig_the_hole_task’ and the task will finish
whatever it needs to do.  Once the task finishes, it will add its
various callbacks to the event loop, in this case, a call to resume
‘plant_a_tree()’.

Generally speaking, when the awaited task finishes
(‘dig_the_hole_task’), the original task or coroutine (‘plant_a_tree()’)
is added back to the event loop's to-do list to be resumed.

This is a basic, yet reliable mental model.  In practice, the control
handoffs are slightly more complex, but not by much.  In part 2, we'll
walk through the details that make this possible.

'Unlike tasks, awaiting a coroutine does not hand control back to the
event loop!'  Wrapping a coroutine in a task first, then awaiting that
would cede control.  The behavior of ‘await coroutine’ is effectively
the same as invoking a regular, synchronous Python function.  Consider
this program:

     import asyncio

     async def coro_a():
        print("I am coro_a(). Hi!")

     async def coro_b():
        print("I am coro_b(). I sure hope no one hogs the event loop...")

     async def main():
        task_b = asyncio.create_task(coro_b())
        num_repeats = 3
        for _ in range(num_repeats):
           await coro_a()
        await task_b

     asyncio.run(main())

The first statement in the coroutine ‘main()’ creates ‘task_b’ and
schedules it for execution via the event loop.  Then, ‘coro_a()’ is
repeatedly awaited.  Control never cedes to the event loop, which is why
we see the output of all three ‘coro_a()’ invocations before
‘coro_b()’'s output:

     I am coro_a(). Hi!
     I am coro_a(). Hi!
     I am coro_a(). Hi!
     I am coro_b(). I sure hope no one hogs the event loop...

If we change ‘await coro_a()’ to ‘await asyncio.create_task(coro_a())’,
the behavior changes.  The coroutine ‘main()’ cedes control to the event
loop with that statement.  The event loop then proceeds through its
backlog of work, calling ‘task_b’ and then the task which wraps
‘coro_a()’ before resuming the coroutine ‘main()’.

     I am coro_b(). I sure hope no one hogs the event loop...
     I am coro_a(). Hi!
     I am coro_a(). Hi!
     I am coro_a(). Hi!

This behavior of ‘await coroutine’ can trip a lot of people up!  That
example highlights how using only ‘await coroutine’ could
unintentionally hog control from other tasks and effectively stall the
event loop.  *note asyncio.run(): 2f3. can help you detect such
occurrences via the ‘debug=True’ flag, which enables *note debug mode:
213a.  Among other things, it will log any coroutines that monopolize
execution for 100ms or longer.

The design intentionally trades off some conceptual clarity around usage
of ‘await’ for improved performance.  Each time a task is awaited,
control needs to be passed all the way up the call stack to the event
loop.  That might sound minor, but in a large program with many ‘await’
statements and a deep call stack, that overhead can add up to a
meaningful performance drag.


File: python.info,  Node: A conceptual overview part 2 the nuts and bolts,  Prev: A conceptual overview part 1 the high-level,  Up: A Conceptual Overview of asyncio

9.1.2 A conceptual overview part 2: the nuts and bolts
------------------------------------------------------

Part 2 goes into detail on the mechanisms ‘asyncio’ uses to manage
control flow.  This is where the magic happens.  You'll come away from
this section knowing what ‘await’ does behind the scenes and how to make
your own asynchronous operators.

* Menu:

* The inner workings of coroutines::
* Future: Future<2>.
* A homemade asyncio.sleep: A homemade asyncio sleep.


File: python.info,  Node: The inner workings of coroutines,  Next: Future<2>,  Up: A conceptual overview part 2 the nuts and bolts

9.1.2.1 The inner workings of coroutines
........................................

‘asyncio’ leverages four components to pass around control.

*note coroutine.send(arg): 126d. is the method used to start or resume a
coroutine.  If the coroutine was paused and is now being resumed, the
argument ‘arg’ will be sent in as the return value of the ‘yield’
statement which originally paused it.  If the coroutine is being used
for the first time (as opposed to being resumed), ‘arg’ must be ‘None’.

     class Rock:
         def __await__(self):
             value_sent_in = yield 7
             print(f"Rock.__await__ resuming with value: {value_sent_in}.")
             return value_sent_in

     async def main():
         print("Beginning coroutine main().")
         rock = Rock()
         print("Awaiting rock...")
         value_from_rock = await rock
         print(f"Coroutine received value: {value_from_rock} from rock.")
         return 23

     coroutine = main()
     intermediate_result = coroutine.send(None)
     print(f"Coroutine paused and returned intermediate value: {intermediate_result}.")

     print(f"Resuming coroutine and sending in value: 42.")
     try:
         coroutine.send(42)
     except StopIteration as e:
         returned_value = e.value
     print(f"Coroutine main() finished and provided value: {returned_value}.")

*note yield: 2498, as usual, pauses execution and returns control to the
caller.  In the example above, the ‘yield’, on line 3, is called by ‘...
= await rock’ on line 11.  More broadly speaking, ‘await’ calls the
*note __await__(): f75. method of the given object.  ‘await’ also does
one more very special thing: it propagates (or "passes along") any
‘yield’s it receives up the call chain.  In this case, that's back to
‘... = coroutine.send(None)’ on line 16.

The coroutine is resumed via the ‘coroutine.send(42)’ call on line 21.
The coroutine picks back up from where it ‘yield’ed (or paused) on line
3 and executes the remaining statements in its body.  When a coroutine
finishes, it raises a *note StopIteration: df5. exception with the
return value attached in the *note value: 2417. attribute.

That snippet produces this output:

     Beginning coroutine main().
     Awaiting rock...
     Coroutine paused and returned intermediate value: 7.
     Resuming coroutine and sending in value: 42.
     Rock.__await__ resuming with value: 42.
     Coroutine received value: 42 from rock.
     Coroutine main() finished and provided value: 23.

It's worth pausing for a moment here and making sure you followed the
various ways that control flow and values were passed.  A lot of
important ideas were covered and it's worth ensuring your understanding
is firm.

The only way to yield (or effectively cede control) from a coroutine is
to ‘await’ an object that ‘yield’s in its ‘__await__’ method.  That
might sound odd to you.  You might be thinking:

     1.  What about a ‘yield’ directly within the coroutine function?
     The coroutine function becomes an *note async generator function:
     249c, a different beast entirely.

     2.  What about a *note yield from: 2498. within the coroutine
     function to a (plain) generator?  That causes the error:
     ‘SyntaxError: yield from not allowed in a coroutine.’ This was
     intentionally designed for the sake of simplicity - mandating only
     one way of using coroutines.  Initially ‘yield’ was barred as well,
     but was re-accepted to allow for async generators.  Despite that,
     ‘yield from’ and ‘await’ effectively do the same thing.


File: python.info,  Node: Future<2>,  Next: A homemade asyncio sleep,  Prev: The inner workings of coroutines,  Up: A conceptual overview part 2 the nuts and bolts

9.1.2.2 Future
..............

A *note future: 38c5. is an object meant to represent a computation's
status and result.  The term is a nod to the idea of something still to
come or not yet happened, and the object is a way to keep an eye on that
something.

A future has a few important attributes.  One is its state, which can be
either "pending", "cancelled", or "done".  Another is its result, which
is set when the state transitions to done.  Unlike a coroutine, a future
does not represent the actual computation to be done; instead, it
represents the status and result of that computation, kind of like a
status light (red, yellow, or green) or indicator.

*note asyncio.Task: 1c7. subclasses *note asyncio.Future: dc6. in order
to gain these various capabilities.  The prior section said tasks store
a list of callbacks, which wasn't entirely accurate.  It's actually the
‘Future’ class that implements this logic, which ‘Task’ inherits.

Futures may also be used directly (not via tasks).  Tasks mark
themselves as done when their coroutine is complete.  Futures are much
more versatile and will be marked as done when you say so.  In this way,
they're the flexible interface for you to make your own conditions for
waiting and resuming.


File: python.info,  Node: A homemade asyncio sleep,  Prev: Future<2>,  Up: A conceptual overview part 2 the nuts and bolts

9.1.2.3 A homemade asyncio.sleep
................................

We'll go through an example of how you could leverage a future to create
your own variant of asynchronous sleep (‘async_sleep’) which mimics
*note asyncio.sleep(): c64.

This snippet registers a few tasks with the event loop and then awaits
the task created by ‘asyncio.create_task’, which wraps the
‘async_sleep(3)’ coroutine.  We want that task to finish only after
three seconds have elapsed, but without preventing other tasks from
running.

     async def other_work():
         print("I like work. Work work.")

     async def main():
         # Add a few other tasks to the event loop, so there's something
         # to do while asynchronously sleeping.
         work_tasks = [
             asyncio.create_task(other_work()),
             asyncio.create_task(other_work()),
             asyncio.create_task(other_work())
         ]
         print(
             "Beginning asynchronous sleep at time: "
             f"{datetime.datetime.now().strftime("%H:%M:%S")}."
         )
         await asyncio.create_task(async_sleep(3))
         print(
             "Done asynchronous sleep at time: "
             f"{datetime.datetime.now().strftime("%H:%M:%S")}."
         )
         # asyncio.gather effectively awaits each task in the collection.
         await asyncio.gather(*work_tasks)

Below, we use a future to enable custom control over when that task will
be marked as done.  If *note future.set_result(): 37ed. (the method
responsible for marking that future as done) is never called, then this
task will never finish.  We've also enlisted the help of another task,
which we'll see in a moment, that will monitor how much time has elapsed
and, accordingly, call ‘future.set_result()’.

     async def async_sleep(seconds: float):
         future = asyncio.Future()
         time_to_wake = time.time() + seconds
         # Add the watcher-task to the event loop.
         watcher_task = asyncio.create_task(_sleep_watcher(future, time_to_wake))
         # Block until the future is marked as done.
         await future

Below, we use a rather bare ‘YieldToEventLoop()’ object to ‘yield’ from
its ‘__await__’ method, ceding control to the event loop.  This is
effectively the same as calling ‘asyncio.sleep(0)’, but this approach
offers more clarity, not to mention it's somewhat cheating to use
‘asyncio.sleep’ when showcasing how to implement it!

As usual, the event loop cycles through its tasks, giving them control
and receiving control back when they pause or finish.  The
‘watcher_task’, which runs the coroutine ‘_sleep_watcher(...)’, will be
invoked once per full cycle of the event loop.  On each resumption,
it'll check the time and if not enough has elapsed, then it'll pause
once again and hand control back to the event loop.  Once enough time
has elapsed, ‘_sleep_watcher(...)’ marks the future as done and
completes by exiting its infinite ‘while’ loop.  Given this helper task
is only invoked once per cycle of the event loop, you'd be correct to
note that this asynchronous sleep will sleep 'at least' three seconds,
rather than exactly three seconds.  Note this is also true of
‘asyncio.sleep’.

     class YieldToEventLoop:
         def __await__(self):
             yield

     async def _sleep_watcher(future, time_to_wake):
         while True:
             if time.time() >= time_to_wake:
                 # This marks the future as done.
                 future.set_result(None)
                 break
             else:
                 await YieldToEventLoop()

Here is the full program's output:

     $ python custom-async-sleep.py
     Beginning asynchronous sleep at time: 14:52:22.
     I like work. Work work.
     I like work. Work work.
     I like work. Work work.
     Done asynchronous sleep at time: 14:52:25.

You might feel this implementation of asynchronous sleep was
unnecessarily convoluted.  And, well, it was.  The example was meant to
showcase the versatility of futures with a simple example that could be
mimicked for more complex needs.  For reference, you could implement it
without futures, like so:

     async def simpler_async_sleep(seconds):
         time_to_wake = time.time() + seconds
         while True:
             if time.time() >= time_to_wake:
                 return
             else:
                 await YieldToEventLoop()

But that's all for now.  Hopefully you're ready to more confidently dive
into some async programming or check out advanced topics in the *note
rest of the documentation: b.


File: python.info,  Node: Python 3 への拡張モジュール移植,  Next: Python で Curses プログラミング,  Prev: A Conceptual Overview of asyncio,  Up: Python HOWTO

9.2 Python 3 への拡張モジュール移植
===================================

Python 3 への拡張モジュール移植には、以下のリソースを推奨します:

   * 'Supporting Python 3: An in-depth guide' の Migrating C
     extensions(1) 章。本は Python 2 から Python 3 への移行全般を扱い、
     拡張モジュールの移植を読者にガイドします。

   * Porting guide(2) は 'py3c' プロジェクトにより提供される、補助コード
     付きの見解提案です。

   * *note Recommended third party tools: 4e8e. offer abstractions over
     the Python's C API. Extensions generally need to be re-written to
     use one of them, but the library then handles differences between
     various Python versions and implementations.

   ---------- Footnotes ----------

   (1) http://python3porting.com/cextensions.html

   (2) https://py3c.readthedocs.io/en/latest/guide.html


File: python.info,  Node: Python で Curses プログラミング,  Next: デスクリプタ ガイド,  Prev: Python 3 への拡張モジュール移植,  Up: Python HOWTO

9.3 Python で Curses プログラミング
===================================


著者: A.M. Kuchling, Eric S. Raymond


リリース: 2.04

概要
....

このドキュメントでは *note curses: 2f. 拡張モジュールでテキストモードデ
ィスプレイを制御する方法について記述します。

* Menu:

* curses ってなに?::
* curses アプリケーションの起動と終了::
* ウィンドウとパッド::
* テキストの表示::
* ユーザ入力::
* より多くの情報::


File: python.info,  Node: curses ってなに?,  Next: curses アプリケーションの起動と終了,  Up: Python で Curses プログラミング

9.3.1 curses ってなに?
----------------------

curses ライブラリは、VT100s や Linux コンソール、さまざまなプログラムが
提供するエミュレーション端末といったテキストベースの端末（ターミナル）の
ために、端末に依存しないスクリーン描画や、キーボードの処理を提供します。
端末はカーソルの移動や、画面のスクロール、領域の消去といった共通の操作を
行うための様々な制御コードをサポートします。端末の種類によって大きく異な
る制御コードを使うことがあり、しばしば独特の癖があります。

グラフィカルなディスプレイが当たり前の今となっては、「なんでわざわざ？」
と疑問に思うかもしれません。確かに文字表示端末は時代遅れな技術ではありま
すが、ニッチな領域が存在していて、意匠を凝らすことができるため、いまだに
価値のあるものとなっています。そのような領域の一つは、例えば X サーバー
を持たない組み込みのUnixです。ほかにも、OSのインストーラや、カーネル設定
などのツールで、これらはグラフィカルサポートが利用可能になる前に動作する
必要があります。

The curses library provides fairly basic functionality, providing the
programmer with an abstraction of a display containing multiple
non-overlapping windows of text.  The contents of a window can be
changed in various ways--adding text, erasing it, changing its
appearance--and the curses library will figure out what control codes
need to be sent to the terminal to produce the right output.  curses
doesn't provide many user-interface concepts such as buttons,
checkboxes, or dialogs; if you need such features, consider a user
interface library such as Urwid(1).

curses ライブラリは元々 BSD UNIX 向けに書かれました; 後の AT&T から出た
Unix System V バージョンで多くの機能と新機能が追加されました。BSD curses
はいまやメンテナンスされておらず、これは AT&T インターフェースのオープン
ソース実装である ncurses にとって置き換えられました。Linux や FreeBSD の
ようなオープンソース Unix を利用している場合は、おそらくシステムは
ncurses を利用しています。現在のほとんどの商用 Unix は System V のコード
を基にしているため、ここで述べる全ての関数が利用できるはずです。しかし、
古いバージョンの curses を持ついくつかのプロプライエタリ Unix は全てには
対応していないでしょう。

The Windows version of Python doesn't include the *note curses: 2f.
module.  A ported version called UniCurses(2) is available.

* Menu:

* Python の curses module::

   ---------- Footnotes ----------

   (1) https://pypi.org/project/Urwid/

   (2) https://pypi.org/project/UniCurses/


File: python.info,  Node: Python の curses module,  Up: curses ってなに?

9.3.1.1 Python の curses module
...............................

The Python module is a fairly simple wrapper over the C functions
provided by curses; if you're already familiar with curses programming
in C, it's really easy to transfer that knowledge to Python.  The
biggest difference is that the Python interface makes things simpler by
merging different C functions such as ‘addstr()’, ‘mvaddstr()’, and
‘mvwaddstr()’ into a single *note addstr(): 3474. method.  You'll see
this covered in more detail later.

この HOWTO は curses と Python を使ってテキストプログラムを書くための入
門記事です。 curses API に対する完全な解説をすることは意図していません;
その目的のためには Python ライブラリガイドの ncurses 節と C 言語マニュア
ルのncurses のページを参照してください。とはいえ、この文章は基本的な考え
を提供してくれるでしょう。


File: python.info,  Node: curses アプリケーションの起動と終了,  Next: ウィンドウとパッド,  Prev: curses ってなに?,  Up: Python で Curses プログラミング

9.3.2 curses アプリケーションの起動と終了
-----------------------------------------

Before doing anything, curses must be initialized.  This is done by
calling the *note initscr(): 190f. function, which will determine the
terminal type, send any required setup codes to the terminal, and create
various internal data structures.  If successful, ‘initscr()’ returns a
window object representing the entire screen; this is usually called
‘stdscr’ after the name of the corresponding C variable.

     import curses
     stdscr = curses.initscr()

Usually curses applications turn off automatic echoing of keys to the
screen, in order to be able to read keys and only display them under
certain circumstances.  This requires calling the *note noecho(): 349b.
function.

     curses.noecho()

通常アプリケーションはまた、Enter キーを押すことなく、キーに対してすぐに
反応する必要があります; これは cbreak モードと呼ばれ、通常の入力がバッフ
ァされるモードと逆に動作します。

     curses.cbreak()

端末は通常、カーソルキーや Page Up や Home といった操作キーなどの特別な
キーをマルチバイトエスケープシーケンスとして返します。それらのシーケンス
を想定して対応する処理を行うアプリケーションを書けるように、 curses はそ
れを *note curses.KEY_LEFT: 3513. のような特別な値を返して行ってくれます
。 curses にその仕事をさせるには、キーパッドモードを有効にする必要があり
ます。

     stdscr.keypad(True)

curses アプリケーションを終了させるのは起動よりも簡単です。 以下を呼び出
す必要があります:

     curses.nocbreak()
     stdscr.keypad(False)
     curses.echo()

cursesに親和性の高い設定をもとに戻します。そして、*note endwin(): 3477.
関数を呼び出し、端末を通常の操作モードに復旧します。

     curses.endwin()

curses アプリケーションをデバッグするときの一般的な問題は、アプリケーシ
ョンが端末を以前の状態に復旧することなく異常終了したときに端末がめちゃめ
ちゃになることです。Python ではこの問題はコードにバグがあって、捕捉でき
ない例外が発生したときによく起きます。タイプしたキーはもはやエコーされま
せん、例えば、シェルを使うのが難しくなります。

Pythonでは、これらの複雑さを避けデバッグをより容易にするために、 *note
curses.wrapper(): c73. 関数をインポートして、このように使います:

     from curses import wrapper

     def main(stdscr):
         # Clear screen
         stdscr.clear()

         # This raises ZeroDivisionError when i == 10.
         for i in range(0, 11):
             v = i-10
             stdscr.addstr(i, 0, '10 divided by {} is {}'.format(v, 10/v))

             stdscr.refresh()
             stdscr.getkey()

     wrapper(main)

The *note wrapper(): c73. function takes a callable object and does the
initializations described above, also initializing colors if color
support is present.  ‘wrapper()’ then runs your provided callable.  Once
the callable returns, ‘wrapper()’ will restore the original state of the
terminal.  The callable is called inside a *note try: 8f8...*note
except: 1ab. that catches exceptions, restores the state of the
terminal, and then re-raises the exception.  Therefore your terminal
won't be left in a funny state on exception and you'll be able to read
the exception's message and traceback.


File: python.info,  Node: ウィンドウとパッド,  Next: テキストの表示,  Prev: curses アプリケーションの起動と終了,  Up: Python で Curses プログラミング

9.3.3 ウィンドウとパッド
------------------------

Windows are the basic abstraction in curses.  A window object represents
a rectangular area of the screen, and supports methods to display text,
erase it, allow the user to input strings, and so forth.

The ‘stdscr’ object returned by the *note initscr(): 190f. function is a
window object that covers the entire screen.  Many programs may need
only this single window, but you might wish to divide the screen into
smaller windows, in order to redraw or clear them separately.  The *note
newwin(): 3499. function creates a new window of a given size, returning
the new window object.

     begin_x = 20; begin_y = 7
     height = 5; width = 40
     win = curses.newwin(height, width, begin_y, begin_x)

Note that the coordinate system used in curses is unusual.  Coordinates
are always passed in the order 'y,x', and the top-left corner of a
window is coordinate (0,0).  This breaks the normal convention for
handling coordinates where the 'x' coordinate comes first.  This is an
unfortunate difference from most other computer applications, but it's
been part of curses since it was first written, and it's too late to
change things now.

Your application can determine the size of the screen by using the *note
curses.LINES: fec. and *note curses.COLS: fed. variables to obtain the
'y' and 'x' sizes.  Legal coordinates will then extend from ‘(0,0)’ to
‘(curses.LINES - 1, curses.COLS - 1)’.

When you call a method to display or erase text, the effect doesn't
immediately show up on the display.  Instead you must call the *note
refresh(): 3498. method of window objects to update the screen.

This is because curses was originally written with slow 300-baud
terminal connections in mind; with these terminals, minimizing the time
required to redraw the screen was very important.  Instead curses
accumulates changes to the screen and displays them in the most
efficient manner when you call ‘refresh()’.  For example, if your
program displays some text in a window and then clears the window,
there's no need to send the original text because they're never visible.

In practice, explicitly telling curses to redraw a window doesn't really
complicate programming with curses much.  Most programs go into a flurry
of activity, and then pause waiting for a keypress or some other action
on the part of the user.  All you have to do is to be sure that the
screen has been redrawn before pausing to wait for user input, by first
calling ‘stdscr.refresh()’ or the ‘refresh()’ method of some other
relevant window.

A pad is a special case of a window; it can be larger than the actual
display screen, and only a portion of the pad displayed at a time.
Creating a pad requires the pad's height and width, while refreshing a
pad requires giving the coordinates of the on-screen area where a
subsection of the pad will be displayed.

     pad = curses.newpad(100, 100)
     # These loops fill the pad with letters; addch() is
     # explained in the next section
     for y in range(0, 99):
         for x in range(0, 99):
             pad.addch(y,x, ord('a') + (x*x+y*y) % 26)

     # Displays a section of the pad in the middle of the screen.
     # (0,0) : coordinate of upper-left corner of pad area to display.
     # (5,5) : coordinate of upper-left corner of window area to be filled
     #         with pad content.
     # (20, 75) : coordinate of lower-right corner of window area to be
     #          : filled with pad content.
     pad.refresh( 0,0, 5,5, 20,75)

The ‘refresh()’ call displays a section of the pad in the rectangle
extending from coordinate (5,5) to coordinate (20,75) on the screen; the
upper left corner of the displayed section is coordinate (0,0) on the
pad.  Beyond that difference, pads are exactly like ordinary windows and
support the same methods.

If you have multiple windows and pads on screen there is a more
efficient way to update the screen and prevent annoying screen flicker
as each part of the screen gets updated.  ‘refresh()’ actually does two
things:

  1. それぞれのウィンドウの *note noutrefresh(): 3475. メソッドを呼び出
     して、配下にある、スクリーンの望ましい状態を表すデータ構造を更新し
     ます。

  2. *note doupdate(): 3473. 関数を呼び出して、データ構造に記録された望
     ましい状態に合致するように、物理スクリーンを更新します。

Instead you can call ‘noutrefresh()’ on a number of windows to update
the data structure, and then call ‘doupdate()’ to update the screen.


File: python.info,  Node: テキストの表示,  Next: ユーザ入力,  Prev: ウィンドウとパッド,  Up: Python で Curses プログラミング

9.3.4 テキストの表示
--------------------

From a C programmer's point of view, curses may sometimes look like a
twisty maze of functions, all subtly different.  For example, ‘addstr()’
displays a string at the current cursor location in the ‘stdscr’ window,
while ‘mvaddstr()’ moves to a given y,x coordinate first before
displaying the string.  ‘waddstr()’ is just like ‘addstr()’, but allows
specifying a window to use instead of using ‘stdscr’ by default.
‘mvwaddstr()’ allows specifying both a window and a coordinate.

幸運にも、Python インターフェースはこれらの詳細を全て隠蔽してくれます。
‘stdscr’ は他のものと同様のウィンドウオブジェクトであり、 *note
addstr(): 3474. のようなメソッドは複数の引数形式を許容してくれます。通常
それらは4つの形式です。

形式                                  説明
                                      
------------------------------------------------------------------------------------------
                                      
'str' または 'ch'                     文字列 'str' または文字 'ch' を現在位置に表示しま
                                      す
                                      
                                      
'str' または 'ch', 'attr'             文字列 'str' または文字 'ch' を属性 'attr' を利用
                                      して現在位置に表示します
                                      
                                      
'y', 'x', 'str' または 'ch'           ウィンドウ内の位置 'y,x' に移動し 'str' または
                                      'ch' を表示します
                                      
                                      
'y', 'x', 'str' または 'ch', 'attr'   ウィンドウ内の位置 'y,x' に移動し属性 'attr' を利
                                      用して 'str' または 'ch' を表示します
                                      

属性によって表示するテキストをハイライトすることができます、ボールド体、
アンダーライン、反転、カラーなど。より詳しくは次の小節で説明します。

The *note addstr(): 3474. method takes a Python string or bytestring as
the value to be displayed.  The contents of bytestrings are sent to the
terminal as-is.  Strings are encoded to bytes using the value of the
window's *note encoding: 12a8. attribute; this defaults to the default
system encoding as returned by *note locale.getencoding(): 329.

The *note addch(): 34b4. methods take a character, which can be either a
string of length 1, a bytestring of length 1, or an integer.

Constants are provided for extension characters; these constants are
integers greater than 255.  For example, *note ACS_PLMINUS: 3580. is a
+/- symbol, and *note ACS_ULCORNER: 34be. is the upper left corner of a
box (handy for drawing borders).  You can also use the appropriate
Unicode character.

ウィンドウは最後の操作の後のカーソル位置を覚えているため、 'y,x' 座標を
うっかり忘れてしまっても、文字列や文字は最後の操作位置に表示されます。
‘move(y,x)’ メソッドでカーソルを移動させることもできます。常に点滅するカ
ーソルを表示する端末もあるため、カーソルが特定の位置にいることを保証して
注意が反れないようにしたいと思うかもしれません; ランダムに見える位置でカ
ーソルが点滅すると面を食らってしまいます。

If your application doesn't need a blinking cursor at all, you can call
‘curs_set(False)’ to make it invisible.  For compatibility with older
curses versions, there's a ‘leaveok(bool)’ function that's a synonym for
*note curs_set(): 346d.  When 'bool' is true, the curses library will
attempt to suppress the flashing cursor, and you won't need to worry
about leaving it in odd locations.

* Menu:

* 属性とカラー::


File: python.info,  Node: 属性とカラー,  Up: テキストの表示

9.3.4.1 属性とカラー
....................

Characters can be displayed in different ways.  Status lines in a
text-based application are commonly shown in reverse video, or a text
viewer may need to highlight certain words.  curses supports this by
allowing you to specify an attribute for each cell on the screen.

属性は整数値で、それぞれのビットが異なる属性を表わします。複数の属性ビッ
トをセットしてテキストの表示を試みることができますが、curses は全ての組
み合わせが利用可能であるかや視覚的に区別できるかどうかは保証してくれませ
ん、それらは利用している端末の能力に依存しているため、最も安全なのは、最
も一般的に利用可能な属性を設定する方法です、ここに列挙します。

属性                       説明
                           
----------------------------------------------------------------------
                           
*note A_BLINK: 34ff.       テキストを点滅
                           
                           
*note A_BOLD: 3500.        高輝度またはボールドテキスト
                           
                           
*note A_DIM: 3501.         低輝度テキスト
                           
                           
*note A_REVERSE: 346b.     反転テキスト
                           
                           
*note A_STANDOUT: 346a.    利用できる最良のハイライトモード
                           
                           
*note A_UNDERLINE: 3505.   下線付きテキスト
                           

つまり、反転するステータスラインを画面の最上部に表示するには、コードをこ
うします:

     stdscr.addstr(0, 0, "Current mode: Typing mode",
                   curses.A_REVERSE)
     stdscr.refresh()

curses ライブラリはカラー機能を提供している端末でのカラーもサポートして
います。そんな端末の中で最も一般的なものは Linux コンソールで、color
xterm もそれに続きます。

To use color, you must call the *note start_color(): 34a5. function soon
after calling *note initscr(): 190f, to initialize the default color set
(the *note curses.wrapper(): c73. function does this automatically).
Once that's done, the *note has_colors(): 3489. function returns TRUE if
the terminal in use can actually display color.  (Note: curses uses the
American spelling 'color', instead of the Canadian/British spelling
'colour'.  If you're used to the British spelling, you'll have to resign
yourself to misspelling it for the sake of these functions.)

The curses library maintains a finite number of color pairs, containing
a foreground (or text) color and a background color.  You can get the
attribute value corresponding to a color pair with the *note
color_pair(): 3469. function; this can be bitwise-OR'ed with other
attributes such as *note A_REVERSE: 346b, but again, such combinations
are not guaranteed to work on all terminals.

例として、テキスト行をカラーペア 1 を使って表示します:

     stdscr.addstr("Pretty text", curses.color_pair(1))
     stdscr.refresh()

As I said before, a color pair consists of a foreground and background
color.  The ‘init_pair(n, f, b)’ function changes the definition of
color pair 'n', to foreground color f and background color b.  Color
pair 0 is hard-wired to white on black, and cannot be changed.

Colors are numbered, and *note start_color(): 34a5. initializes 8 basic
colors when it activates color mode.  They are: 0:black, 1:red, 2:green,
3:yellow, 4:blue, 5:magenta, 6:cyan, and 7:white.  The *note curses: 2f.
module defines named constants for each of these colors: *note
curses.COLOR_BLACK: 3592, *note curses.COLOR_RED: 3597, and so forth.

やってみましょう。カラー 1 を白背景に赤に変更してみましょう、こうして呼
び出します:

     curses.init_pair(1, curses.COLOR_RED, curses.COLOR_WHITE)

カラーペアを変更するときには、既に表示された任意のテキストが利用するカラ
ーペアを新しい色に変更します。新しいテキストをこの色で使うこともできます
:

     stdscr.addstr(0,0, "RED ALERT!", curses.color_pair(1))

Very fancy terminals can change the definitions of the actual colors to
a given RGB value.  This lets you change color 1, which is usually red,
to purple or blue or any other color you like.  Unfortunately, the Linux
console doesn't support this, so I'm unable to try it out, and can't
provide any examples.  You can check if your terminal can do this by
calling *note can_change_color(): 3466, which returns ‘True’ if the
capability is there.  If you're lucky enough to have such a talented
terminal, consult your system's man pages for more information.


File: python.info,  Node: ユーザ入力,  Next: より多くの情報,  Prev: テキストの表示,  Up: Python で Curses プログラミング

9.3.5 ユーザ入力
----------------

The C curses library offers only very simple input mechanisms.  Python's
*note curses: 2f. module adds a basic text-input widget.  (Other
libraries such as Urwid(1) have more extensive collections of widgets.)

ウィンドウから入力を得るための2つのメソッドがあります。

   * *note getch(): 1825. refreshes the screen and then waits for the
     user to hit a key, displaying the key if *note echo(): 3476. has
     been called earlier.  You can optionally specify a coordinate to
     which the cursor should be moved before pausing.

   * *note getkey(): 34d2. does the same thing but converts the integer
     to a string.  Individual characters are returned as 1-character
     strings, and special keys such as function keys return longer
     strings containing a key name such as ‘KEY_UP’ or ‘^G’.

It's possible to not wait for the user using the *note nodelay(): 34e7.
window method.  After ‘nodelay(True)’, ‘getch()’ and ‘getkey()’ for the
window become non-blocking.  To signal that no input is ready, ‘getch()’
returns ‘curses.ERR’ (a value of -1) and ‘getkey()’ raises an exception.
There's also a *note halfdelay(): 348d. function, which can be used to
(in effect) set a timer on each ‘getch()’; if no input becomes available
within a specified delay (measured in tenths of a second), curses raises
an exception.

The ‘getch()’ method returns an integer; if it's between 0 and 255, it
represents the ASCII code of the key pressed.  Values greater than 255
are special keys such as Page Up, Home, or the cursor keys.  You can
compare the value returned to constants such as *note curses.KEY_PPAGE:
3524, *note curses.KEY_HOME: 3515, or *note curses.KEY_LEFT: 3513.  The
main loop of your program may look something like this:

     while True:
         c = stdscr.getch()
         if c == ord('p'):
             PrintDocument()
         elif c == ord('q'):
             break  # Exit the while loop
         elif c == curses.KEY_HOME:
             x = y = 0

The *note curses.ascii: 30. module supplies ASCII class membership
functions that take either integer or 1-character string arguments;
these may be useful in writing more readable tests for such loops.  It
also supplies conversion functions that take either integer or
1-character-string arguments and return the same type.  For example,
*note curses.ascii.ctrl(): 35da. returns the control character
corresponding to its argument.

There's also a method to retrieve an entire string, *note getstr():
183e.  It isn't used very often, because its functionality is quite
limited; the only editing keys available are the backspace key and the
Enter key, which terminates the string.  It can optionally be limited to
a fixed number of characters.

     curses.echo()            # Enable echoing of characters

     # Get a 15-character string, with the cursor on the top line
     s = stdscr.getstr(0,0, 15)

The *note curses.textpad: 32. module supplies a text box that supports
an Emacs-like set of keybindings.  Various methods of the *note Textbox:
359b. class support editing with input validation and gathering the edit
results either with or without trailing spaces.  Here's an example:

     import curses
     from curses.textpad import Textbox, rectangle

     def main(stdscr):
         stdscr.addstr(0, 0, "Enter IM message: (hit Ctrl-G to send)")

         editwin = curses.newwin(5,30, 2,1)
         rectangle(stdscr, 1,0, 1+5+1, 1+30+1)
         stdscr.refresh()

         box = Textbox(editwin)

         # Let the user edit until Ctrl-G is struck.
         box.edit()

         # Get resulting contents
         message = box.gather()

さらなる詳細についてはライブラリのドキュメント *note curses.textpad: 32.
を参照してください。

   ---------- Footnotes ----------

   (1) https://pypi.org/project/Urwid/


File: python.info,  Node: より多くの情報,  Prev: ユーザ入力,  Up: Python で Curses プログラミング

9.3.6 より多くの情報
--------------------

この HOWTO ではいくつかの進んだ話題、スクリーンスクレイピングや xterm イ
ンスタンスからマウスイベントを捉えるなど、については扱っていません。しか
し、Python の *note curses: 2f. モジュールのライブラリページはいまやかな
り充実しています。次はこれを見るべきです。

If you're in doubt about the detailed behavior of the curses functions,
consult the manual pages for your curses implementation, whether it's
ncurses or a proprietary Unix vendor's.  The manual pages will document
any quirks, and provide complete lists of all the functions, attributes,
and *note ACS_*: 356c. characters available to you.

Because the curses API is so large, some functions aren't supported in
the Python interface.  Often this isn't because they're difficult to
implement, but because no one has needed them yet.  Also, Python doesn't
yet support the menu library associated with ncurses.  Patches adding
support for these would be welcome; see the Python Developer's Guide(1)
to learn more about submitting patches to Python.

   * Writing Programs with NCURSES(2): a lengthy tutorial for C
     programmers.

   * The ncurses man page(3)

   * The ncurses FAQ(4)

   * "Use curses...  don't swear"(5): curses または Urwid を使って端末を
     制御する PyCon 2013 講演ビデオです。

   * "Console Applications with Urwid"(6): video of a PyCon CA 2012 talk
     demonstrating some applications written using Urwid.

   ---------- Footnotes ----------

   (1) https://devguide.python.org/

   (2) https://invisible-island.net/ncurses/ncurses-intro.html

   (3) https://linux.die.net/man/3/ncurses

   (4) https://invisible-island.net/ncurses/ncurses.faq.html

   (5) https://www.youtube.com/watch?v=eN1eZtjLEnU

   (6) https://pyvideo.org/video/1568/console-applications-with-urwid


File: python.info,  Node: デスクリプタ ガイド,  Next: Debugging C API extensions and CPython Internals with GDB,  Prev: Python で Curses プログラミング,  Up: Python HOWTO

9.4 デスクリプタ ガイド
=======================


著者: Raymond Hettinger


問い合わせ先: <python at rcn dot com>

*note デスクリプタ: 1881. を使うと、オブジェクトの属性検索、保存、削除を
カスタマイズできます。

本ガイドは4つの大項目から構成されています。

  1. 最初の「入門」では基本の紹介をして、シンプルな例から少しずつ概念を
     説明していきます。もしデスクリプタに触れるのが初めての場合はここか
     ら学んでいきましょう。

  2. 2つ目のセクションでは完全で実践的なデスクリプタのサンプルを紹介しま
     す。もしデスクリプタの基本を理解しているのであれば、ここから読み始
     めても良いでしょう。

  3. 3番目のセクションはより技巧的なチュートリアルを通じて、デスクリプタ
     がどのようなメカニズムで動作しているのかを紹介します。多くの人はこ
     のレベルの理解は不要でしょう。

  4. 最後のセクションは、Cで書かれた組み込みのデスクリプタをピュア
     Pythonで実現する方法を紹介します。このセクションがどのように関数が
     束縛メソッドになるのか、 *note classmethod(): 48e. や *note
     staticmethod(): 453, *note property(): 4b3, *note __slots__: 7f7. と
     いった一般的なツールの実装がどのようになっているのか興味を持ったら
     読んでください。

* Menu:

* 入門::
* 実践的なサンプル::
* 技術的なチュートリアル::
* ピュアPythonの等価実装::


File: python.info,  Node: 入門,  Next: 実践的なサンプル,  Up: デスクリプタ ガイド

9.4.1 入門
----------

この入門では、なるべく基礎的なところから開始し、新しい要素を一つずつ紹介
していきます。

* Menu:

* シンプルな例; 定数を返すデスクリプタ: シンプルな例 定数を返すデスクリプタ.
* 動的なルックアップ::
* 管理された属性::
* 名前のカスタマイズ::
* まとめ::


File: python.info,  Node: シンプルな例 定数を返すデスクリプタ,  Next: 動的なルックアップ,  Up: 入門

9.4.1.1 シンプルな例: 定数を返すデスクリプタ
............................................

The ‘Ten’ class is a descriptor whose *note __get__(): 1701. method
always returns the constant ‘10’:

     class Ten:
         def __get__(self, obj, objtype=None):
             return 10

このデスクリプタを使うには他のクラスのクラス変数として保存します:

     class A:
         x = 5                       # Regular class attribute
         y = Ten()                   # Descriptor instance

インタラクティブセッションを使って、通常の属性ルックアップと、デスクリプ
タのルックアップの違いを見てみましょう。

     >>> a = A()                     # Make an instance of class A
     >>> a.x                         # Normal attribute lookup
     5
     >>> a.y                         # Descriptor lookup
     10

‘a.x’ 属性ルックアップではドット演算子がクラス辞書の中から ‘'x': 5’ を見
つけます。 ‘a.y’ ルックアップではドット演算子は ‘__get__’ メソッドを持つ
デスクリプタインスタンスを取得します。そのメソッドを呼び出すと、 ‘10’ を
返します。

‘10’ はクラスの辞書にも、インスタンスの辞書にも格納されていません。その
代わり、 ‘10’ はオンデマンドに計算されます。

このサンプルは、シンプルなデスクリプタがどのように動作するかを説明するた
めのものですが、実用的ではありません。定数を返す場合、通常の属性アクセス
の方が良いでしょう。

次のセクションでは、より実践的な動的なルックアップを作成します。


File: python.info,  Node: 動的なルックアップ,  Next: 管理された属性,  Prev: シンプルな例 定数を返すデスクリプタ,  Up: 入門

9.4.1.2 動的なルックアップ
..........................

単に定数を返すよりも、なにか処理を実行するデスクリプタの方が面白いでしょ
う。

     import os

     class DirectorySize:

         def __get__(self, obj, objtype=None):
             return len(os.listdir(obj.dirname))

     class Directory:

         size = DirectorySize()              # Descriptor instance

         def __init__(self, dirname):
             self.dirname = dirname          # Regular instance attribute

インタラクティブセッションで見たように、この探索は動的です。実行ごとに異
なる計算を行い、毎回答えが更新されます。

     >>> s = Directory('songs')
     >>> g = Directory('games')
     >>> s.size                              # The songs directory has twenty files
     20
     >>> g.size                              # The games directory has three files
     3
     >>> os.remove('games/chess')            # Delete a game
     >>> g.size                              # File count is automatically updated
     2

Besides showing how descriptors can run computations, this example also
reveals the purpose of the parameters to *note __get__(): 1701.  The
'self' parameter is 'size', an instance of 'DirectorySize'.  The 'obj'
parameter is either 'g' or 's', an instance of 'Directory'.  It is the
'obj' parameter that lets the *note __get__(): 1701. method learn the
target directory.  The 'objtype' parameter is the class 'Directory'.


File: python.info,  Node: 管理された属性,  Next: 名前のカスタマイズ,  Prev: 動的なルックアップ,  Up: 入門

9.4.1.3 管理された属性
......................

A popular use for descriptors is managing access to instance data.  The
descriptor is assigned to a public attribute in the class dictionary
while the actual data is stored as a private attribute in the instance
dictionary.  The descriptor's *note __get__(): 1701. and *note
__set__(): 23b5. methods are triggered when the public attribute is
accessed.

このサンプルでは 'age' はパブリックな属性で、 '_age' はプライベートな属
性です。パブリックな属性がアクセスされると、デスクリプタはルックアップや
更新のログ出力をします。

     import logging

     logging.basicConfig(level=logging.INFO)

     class LoggedAgeAccess:

         def __get__(self, obj, objtype=None):
             value = obj._age
             logging.info('Accessing %r giving %r', 'age', value)
             return value

         def __set__(self, obj, value):
             logging.info('Updating %r to %r', 'age', value)
             obj._age = value

     class Person:

         age = LoggedAgeAccess()             # Descriptor instance

         def __init__(self, name, age):
             self.name = name                # Regular instance attribute
             self.age = age                  # Calls __set__()

         def birthday(self):
             self.age += 1                   # Calls both __get__() and __set__()

インタラクティブセッションの結果で見てわかるように、管理された属性の
'age' のログ出力が行われますが、通常の属性の 'name' はログ出力されません
。

     >>> mary = Person('Mary M', 30)         # The initial age update is logged
     INFO:root:Updating 'age' to 30
     >>> dave = Person('David D', 40)
     INFO:root:Updating 'age' to 40

     >>> vars(mary)                          # The actual data is in a private attribute
     {'name': 'Mary M', '_age': 30}
     >>> vars(dave)
     {'name': 'David D', '_age': 40}

     >>> mary.age                            # Access the data and log the lookup
     INFO:root:Accessing 'age' giving 30
     30
     >>> mary.birthday()                     # Updates are logged as well
     INFO:root:Accessing 'age' giving 30
     INFO:root:Updating 'age' to 31

     >>> dave.name                           # Regular attribute lookup isn't logged
     'David D'
     >>> dave.age                            # Only the managed attribute is logged
     INFO:root:Accessing 'age' giving 40
     40

このサンプル実装には大きな問題があります。プライベートな名前の '_age' が
'LoggedAgeAccess' クラスの中でハードコードされています。そのため、どのイ
ンスタンスも1つしかこのログ出力される属性が作れず、名前を変更できません
。次のサンプルでこの問題を解決していきます。


File: python.info,  Node: 名前のカスタマイズ,  Next: まとめ,  Prev: 管理された属性,  Up: 入門

9.4.1.4 名前のカスタマイズ
..........................

クラスがデスクリプタを使うときに、クラスはそれぞれのデスクリプタにどのよ
うな変数名を使うかを通知します。

In this example, the ‘Person’ class has two descriptor instances, 'name'
and 'age'.  When the ‘Person’ class is defined, it makes a callback to
*note __set_name__(): e48. in 'LoggedAccess' so that the field names can
be recorded, giving each descriptor its own 'public_name' and
'private_name':

     import logging

     logging.basicConfig(level=logging.INFO)

     class LoggedAccess:

         def __set_name__(self, owner, name):
             self.public_name = name
             self.private_name = '_' + name

         def __get__(self, obj, objtype=None):
             value = getattr(obj, self.private_name)
             logging.info('Accessing %r giving %r', self.public_name, value)
             return value

         def __set__(self, obj, value):
             logging.info('Updating %r to %r', self.public_name, value)
             setattr(obj, self.private_name, value)

     class Person:

         name = LoggedAccess()                # First descriptor instance
         age = LoggedAccess()                 # Second descriptor instance

         def __init__(self, name, age):
             self.name = name                 # Calls the first descriptor
             self.age = age                   # Calls the second descriptor

         def birthday(self):
             self.age += 1

An interactive session shows that the ‘Person’ class has called *note
__set_name__(): e48. so that the field names would be recorded.  Here we
call *note vars(): 1e23. to look up the descriptor without triggering
it:

     >>> vars(vars(Person)['name'])
     {'public_name': 'name', 'private_name': '_name'}
     >>> vars(vars(Person)['age'])
     {'public_name': 'age', 'private_name': '_age'}

新しいクラスは 'name' と 'age' の両方でログを出力します。

     >>> pete = Person('Peter P', 10)
     INFO:root:Updating 'name' to 'Peter P'
     INFO:root:Updating 'age' to 10
     >>> kate = Person('Catherine C', 20)
     INFO:root:Updating 'name' to 'Catherine C'
     INFO:root:Updating 'age' to 20

2つの 'Person' のインスタンスは、プライベート名しか保持していません。

     >>> vars(pete)
     {'_name': 'Peter P', '_age': 10}
     >>> vars(kate)
     {'_name': 'Catherine C', '_age': 20}


File: python.info,  Node: まとめ,  Prev: 名前のカスタマイズ,  Up: 入門

9.4.1.5 まとめ
..............

A *note descriptor: 1881. is what we call any object that defines *note
__get__(): 1701, *note __set__(): 23b5, or *note __delete__(): 194f.

Optionally, descriptors can have a *note __set_name__(): e48. method.
This is only used in cases where a descriptor needs to know either the
class where it was created or the name of class variable it was assigned
to.  (This method, if present, is called even if the class is not a
descriptor.)

デスクリプタは属性のルックアップ中に、ドット演算子によって呼び出されます
。 ‘vars(some_class)[descriptor_name]’ という書き方によって間接的にデス
クリプタがアクセスされると、デスクリプタを実行することなく、デスクリプタ
のインスタンスが返されます。

デスクリプタはクラス変数として利用したときにだけ動作します。インスタンス
に設定しても効果はありません。

デスクリプタは、クラス変数として格納されているオブジェクトが属性ルックア
ップ中に発生することを制御できるように、フックを提供することが主なモチベ
ーションとなっています。

伝統的には、呼び出し側のクラスが、ルックアップ中に発生することを制御して
きましたが、デスクリプタはその関係を逆転させ、検索されているデータが問題
に介入できるようにします。

デスクリプタは、Pythonのさまざまなところで利用されています。これにより、
単なる関数は、インスタンスに束縛されたメソッドになります。 *note
classmethod(): 48e, *note staticmethod(): 453, *note property(): 4b3,
*note functools.cached_property(): 763. といったツールもすべて、デスクリ
プタとして実装されています。


File: python.info,  Node: 実践的なサンプル,  Next: 技術的なチュートリアル,  Prev: 入門,  Up: デスクリプタ ガイド

9.4.2 実践的なサンプル
----------------------

このサンプルでは、発見が極めて難しいデータ破損バグを特定するのに利用可能
な、実践的でパワフルなツールを紹介します。

* Menu:

* バリデータクラス::
* カスタムバリデータ::
* 実践的なアプリケーション::


File: python.info,  Node: バリデータクラス,  Next: カスタムバリデータ,  Up: 実践的なサンプル

9.4.2.1 バリデータクラス
........................

バリデータは管理された属性アクセスのためのデスクリプタです。データを格納
する前に、新しい値が型が適合しているか、値の範囲制限に適合しているかを検
証します。もし制限に合わなければ、例外を送出し、データが不正な状態になる
のを防ぎます。

This ‘Validator’ class is both an *note abstract base class: 13ce. and a
managed attribute descriptor:

     from abc import ABC, abstractmethod

     class Validator(ABC):

         def __set_name__(self, owner, name):
             self.private_name = '_' + name

         def __get__(self, obj, objtype=None):
             return getattr(obj, self.private_name)

         def __set__(self, obj, value):
             self.validate(value)
             setattr(obj, self.private_name, value)

         @abstractmethod
         def validate(self, value):
             pass

Custom validators need to inherit from ‘Validator’ and must supply a
‘validate()’ method to test various restrictions as needed.


File: python.info,  Node: カスタムバリデータ,  Next: 実践的なアプリケーション,  Prev: バリデータクラス,  Up: 実践的なサンプル

9.4.2.2 カスタムバリデータ
..........................

ここでは3つの実践的なバリデーションのユーティリティのサンプルを紹介しま
す。

  1. ‘OneOf’ verifies that a value is one of a restricted set of
     options.

  2. ‘Number’ verifies that a value is either an *note int: 19b. or
     *note float: 196.  Optionally, it verifies that a value is between
     a given minimum or maximum.

  3. ‘String’ verifies that a value is a *note str: 169.  Optionally, it
     validates a given minimum or maximum length.  It can validate a
     user-defined predicate(1) as well.

     class OneOf(Validator):

         def __init__(self, *options):
             self.options = set(options)

         def validate(self, value):
             if value not in self.options:
                 raise ValueError(
                     f'Expected {value!r} to be one of {self.options!r}'
                 )

     class Number(Validator):

         def __init__(self, minvalue=None, maxvalue=None):
             self.minvalue = minvalue
             self.maxvalue = maxvalue

         def validate(self, value):
             if not isinstance(value, (int, float)):
                 raise TypeError(f'Expected {value!r} to be an int or float')
             if self.minvalue is not None and value < self.minvalue:
                 raise ValueError(
                     f'Expected {value!r} to be at least {self.minvalue!r}'
                 )
             if self.maxvalue is not None and value > self.maxvalue:
                 raise ValueError(
                     f'Expected {value!r} to be no more than {self.maxvalue!r}'
                 )

     class String(Validator):

         def __init__(self, minsize=None, maxsize=None, predicate=None):
             self.minsize = minsize
             self.maxsize = maxsize
             self.predicate = predicate

         def validate(self, value):
             if not isinstance(value, str):
                 raise TypeError(f'Expected {value!r} to be a str')
             if self.minsize is not None and len(value) < self.minsize:
                 raise ValueError(
                     f'Expected {value!r} to be no smaller than {self.minsize!r}'
                 )
             if self.maxsize is not None and len(value) > self.maxsize:
                 raise ValueError(
                     f'Expected {value!r} to be no bigger than {self.maxsize!r}'
                 )
             if self.predicate is not None and not self.predicate(value):
                 raise ValueError(
                     f'Expected {self.predicate} to be true for {value!r}'
                 )

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Predicate_(mathematical_logic)


File: python.info,  Node: 実践的なアプリケーション,  Prev: カスタムバリデータ,  Up: 実践的なサンプル

9.4.2.3 実践的なアプリケーション
................................

次のコードは実際のクラスでデータバリデータを使う方法のサンプルです。

     class Component:

         name = String(minsize=3, maxsize=10, predicate=str.isupper)
         kind = OneOf('wood', 'metal', 'plastic')
         quantity = Number(minvalue=0)

         def __init__(self, name, kind, quantity):
             self.name = name
             self.kind = kind
             self.quantity = quantity

これらのデスクリプタは、不正インスタンスが作成されるのを防ぎます。

     >>> Component('Widget', 'metal', 5)      # Blocked: 'Widget' is not all uppercase
     Traceback (most recent call last):
         ...
     ValueError: Expected <method 'isupper' of 'str' objects> to be true for 'Widget'

     >>> Component('WIDGET', 'metle', 5)      # Blocked: 'metle' is misspelled
     Traceback (most recent call last):
         ...
     ValueError: Expected 'metle' to be one of {'metal', 'plastic', 'wood'}

     >>> Component('WIDGET', 'metal', -5)     # Blocked: -5 is negative
     Traceback (most recent call last):
         ...
     ValueError: Expected -5 to be at least 0

     >>> Component('WIDGET', 'metal', 'V')    # Blocked: 'V' isn't a number
     Traceback (most recent call last):
         ...
     TypeError: Expected 'V' to be an int or float

     >>> c = Component('WIDGET', 'metal', 5)  # Allowed:  The inputs are valid


File: python.info,  Node: 技術的なチュートリアル,  Next: ピュアPythonの等価実装,  Prev: 実践的なサンプル,  Up: デスクリプタ ガイド

9.4.3 技術的なチュートリアル
----------------------------

これから先はデスクリプタのメカニズムや動作の詳細について、よりテクニカル
なチュートリアルになります。

* Menu:

* 概要: 概要<5>.
* 定義と導入::
* デスクリプタプロトコル::
* デスクリプタ呼び出しの概要::
* インスタンスからの呼び出し::
* クラスからの呼び出し::
* superからの呼び出し::
* 呼び出しロジックのまとめ::
* 自動的の名前の伝達::
* ORMのサンプル::


File: python.info,  Node: 概要<5>,  Next: 定義と導入,  Up: 技術的なチュートリアル

9.4.3.1 概要
............

デスクリプタの定義、プロトコルのサマリー、デスクリプタがどのように呼び出
されるかの説明、ORマッパーがどのように動作するかのサンプルを提示します。

デスクリプタについて学ぶことにより、新しいツールセットが使えるようになる
だけでなく、Python の仕組みについてのより深い理解が得られます。


File: python.info,  Node: 定義と導入,  Next: デスクリプタプロトコル,  Prev: 概要<5>,  Up: 技術的なチュートリアル

9.4.3.2 定義と導入
..................

In general, a descriptor is an attribute value that has one of the
methods in the descriptor protocol.  Those methods are *note __get__():
1701, *note __set__(): 23b5, and *note __delete__(): 194f.  If any of
those methods are defined for an attribute, it is said to be a *note
descriptor: 1881.

属性アクセスのデフォルトの振る舞いは、オブジェクトの辞書の属性の取得、設
定、削除です。例えば ‘a.x’ は、まず ‘a.__dict__['x']’、それから
‘type(a).__dict__['x']’、さらに ‘type(a)’ のメソッド探索順序に従ったさら
なる探索へと連鎖します。見つかった値が、デスクリプタメソッドのいずれかを
定義しているオブジェクトなら、Python はそのデフォルトの振る舞いをオーバ
ーライドし、代わりにデスクリプタメソッドを呼び出します。これがどの連鎖順
位で行われるかは、どのデスクリプタメソッドが定義されているかに依ります。

Descriptors are a powerful, general purpose protocol.  They are the
mechanism behind properties, methods, static methods, class methods, and
*note super(): 1a6.  They are used throughout Python itself.
Descriptors simplify the underlying C code and offer a flexible set of
new tools for everyday Python programs.


File: python.info,  Node: デスクリプタプロトコル,  Next: デスクリプタ呼び出しの概要,  Prev: 定義と導入,  Up: 技術的なチュートリアル

9.4.3.3 デスクリプタプロトコル
..............................

‘descr.__get__(self, obj, type=None)’

‘descr.__set__(self, obj, value)’

‘descr.__delete__(self, obj)’

これで全てです。これらのメソッドのいずれかを定義すれば、オブジェクトはデ
スクリプタとみなされ、探索された際のデフォルトの振る舞いをオーバーライド
できます。

If an object defines *note __set__(): 23b5. or *note __delete__(): 194f,
it is considered a data descriptor.  Descriptors that only define *note
__get__(): 1701. are called non-data descriptors (they are often used
for methods but other uses are possible).

データデスクリプタと非データデスクリプタでは、オーバーライドがインスタン
スの辞書のエントリに関してどのように計算されるかが異なります。インスタン
スの辞書に、データデスクリプタと同名の項目があれば、データデスクリプタの
方が優先されます。インスタンスの辞書に、非データデスクリプタと同名の項目
があれば、辞書の項目の方が優先されます。

To make a read-only data descriptor, define both *note __get__(): 1701.
and *note __set__(): 23b5. with the *note __set__(): 23b5. raising an
*note AttributeError: 5f0. when called.  Defining the *note __set__():
23b5. method with an exception raising placeholder is enough to make it
a data descriptor.


File: python.info,  Node: デスクリプタ呼び出しの概要,  Next: インスタンスからの呼び出し,  Prev: デスクリプタプロトコル,  Up: 技術的なチュートリアル

9.4.3.4 デスクリプタ呼び出しの概要
..................................

‘desc.__get__(obj)’ や ‘desc.__get__(None, cls)’ を使うとデスクリプタを
直接呼び出すことができます。

しかし、属性アクセスの際に自動的に呼び出されるのが、一般的なデスクリプタ
の呼び出し方法です。

The expression ‘obj.x’ looks up the attribute ‘x’ in the chain of
namespaces for ‘obj’.  If the search finds a descriptor outside of the
instance *note __dict__: 77d, its *note __get__(): 1701. method is
invoked according to the precedence rules listed below.

呼び出しの詳細は、‘obj’ がオブジェクトかクラスか、superのインスタンスか
に依ります。


File: python.info,  Node: インスタンスからの呼び出し,  Next: クラスからの呼び出し,  Prev: デスクリプタ呼び出しの概要,  Up: 技術的なチュートリアル

9.4.3.5 インスタンスからの呼び出し
..................................

Instance lookup scans through a chain of namespaces giving data
descriptors the highest priority, followed by instance variables, then
non-data descriptors, then class variables, and lastly *note
__getattr__(): 6fa. if it is provided.

‘a.x’ に対するデスクリプタが見つかった場合、 ‘desc.__get__(a, type(a))’
という形式で呼び出されます。

ドットによるルックアップのロジックは*note object.__getattribute__():
dcb. の中で行われます。ピュアPythonで表した等価なロジックは次の通りです
。

     def find_name_in_mro(cls, name, default):
         "Emulate _PyType_Lookup() in Objects/typeobject.c"
         for base in cls.__mro__:
             if name in vars(base):
                 return vars(base)[name]
         return default

     def object_getattribute(obj, name):
         "Emulate PyObject_GenericGetAttr() in Objects/object.c"
         null = object()
         objtype = type(obj)
         cls_var = find_name_in_mro(objtype, name, null)
         descr_get = getattr(type(cls_var), '__get__', null)
         if descr_get is not null:
             if (hasattr(type(cls_var), '__set__')
                 or hasattr(type(cls_var), '__delete__')):
                 return descr_get(cls_var, obj, objtype)     # data descriptor
         if hasattr(obj, '__dict__') and name in vars(obj):
             return vars(obj)[name]                          # instance variable
         if descr_get is not null:
             return descr_get(cls_var, obj, objtype)         # non-data descriptor
         if cls_var is not null:
             return cls_var                                  # class variable
         raise AttributeError(name)

Note, there is no *note __getattr__(): 6fa. hook in the *note
__getattribute__(): dcb. code.  That is why calling *note
__getattribute__(): dcb. directly or with ‘super().__getattribute__’
will bypass *note __getattr__(): 6fa. entirely.

Instead, it is the dot operator and the *note getattr(): dca. function
that are responsible for invoking *note __getattr__(): 6fa. whenever
*note __getattribute__(): dcb. raises an *note AttributeError: 5f0.
Their logic is encapsulated in a helper function:

     def getattr_hook(obj, name):
         "Emulate slot_tp_getattr_hook() in Objects/typeobject.c"
         try:
             return obj.__getattribute__(name)
         except AttributeError:
             if not hasattr(type(obj), '__getattr__'):
                 raise
         return type(obj).__getattr__(obj, name)             # __getattr__


File: python.info,  Node: クラスからの呼び出し,  Next: superからの呼び出し,  Prev: インスタンスからの呼び出し,  Up: 技術的なチュートリアル

9.4.3.6 クラスからの呼び出し
............................

The logic for a dotted lookup such as ‘A.x’ is in
‘type.__getattribute__()’.  The steps are similar to those for
‘object.__getattribute__()’ but the instance dictionary lookup is
replaced by a search through the class's *note method resolution order:
25df.

‘a.x’ に対するデスクリプタが見つかった場合、 ‘desc.__get__(None, A)’ と
いう形式で呼び出されます。

完全な C での実装は Objects/typeobject.c(1) の中の
:c:func:‘!type_getattro’ と ‘_PyType_Lookup()’ を参照してください。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Objects/typeobject.c


File: python.info,  Node: superからの呼び出し,  Next: 呼び出しロジックのまとめ,  Prev: クラスからの呼び出し,  Up: 技術的なチュートリアル

9.4.3.7 superからの呼び出し
...........................

The logic for super's dotted lookup is in the *note __getattribute__():
dcb. method for object returned by *note super(): 1a6.

‘super(A, obj).m’ のようなドットを使ったルックアップは
‘obj.__class__.__mro__’ を探索して、 ‘A’ の直前のクラス ‘B’ をまず探し、
‘B.__dict__['m'].__get__(obj, A)’ を返します。もしデスクリプタでなければ
‘m’ を変更せずに返します。

完全な C での実装は Objects/typeobject.c(1) の中の ‘super_getattro()’ を
参照してください。純粋な Python での同等なコードは Guido's Tutorial(2) を
参照してください。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Objects/typeobject.c

   (2) 
https://www.python.org/download/releases/2.2.3/descrintro/#cooperation


File: python.info,  Node: 呼び出しロジックのまとめ,  Next: 自動的の名前の伝達,  Prev: superからの呼び出し,  Up: 技術的なチュートリアル

9.4.3.8 呼び出しロジックのまとめ
................................

The mechanism for descriptors is embedded in the *note
__getattribute__(): dcb. methods for *note object: c7e, *note type: f44,
and *note super(): 1a6.

憶えておくべき重要な点は:

   * Descriptors are invoked by the *note __getattribute__(): dcb.
     method.

   * クラスはこの機構を *note object: c7e. 、 *note type: f44. 、 *note
     super(): 1a6. から継承する

   * Overriding *note __getattribute__(): dcb. prevents automatic
     descriptor calls because all the descriptor logic is in that
     method.

   * ‘object.__getattribute__()’ and ‘type.__getattribute__()’ make
     different calls to *note __get__(): 1701.  The first includes the
     instance and may include the class.  The second puts in ‘None’ for
     the instance and always includes the class.

   * データデスクリプタは、必ずインスタンス辞書をオーバーライドする

   * 非データデスクリプタは、インスタンス辞書にオーバーライドされること
     がある


File: python.info,  Node: 自動的の名前の伝達,  Next: ORMのサンプル,  Prev: 呼び出しロジックのまとめ,  Up: 技術的なチュートリアル

9.4.3.9 自動的の名前の伝達
..........................

Sometimes it is desirable for a descriptor to know what class variable
name it was assigned to.  When a new class is created, the *note type:
f44. metaclass scans the dictionary of the new class.  If any of the
entries are descriptors and if they define *note __set_name__(): e48,
that method is called with two arguments.  The 'owner' is the class
where the descriptor is used, and the 'name' is the class variable the
descriptor was assigned to.

実装の詳細は Objects/typeobject.c(1) の中の ‘type_new()’ と
‘set_names()’ を参照してください。

Since the update logic is in ‘type.__new__()’, notifications only take
place at the time of class creation.  If descriptors are added to the
class afterwards, *note __set_name__(): e48. will need to be called
manually.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Objects/typeobject.c


File: python.info,  Node: ORMのサンプル,  Prev: 自動的の名前の伝達,  Up: 技術的なチュートリアル

9.4.3.10 ORMのサンプル
......................

以下のコードは、 オブジェクト関係マッピング(1) を実装するのにデータディ
スクリプタを使う方法を示した、簡略化された骨格です。

基本的な考え方は、データが外部のデータベースに保存することです。 Pythonイ
ンスタンスは、データベースのテーブルへのキーのみを保持します。デスクリプ
タがルックアップや更新をします。

     class Field:

         def __set_name__(self, owner, name):
             self.fetch = f'SELECT {name} FROM {owner.table} WHERE {owner.key}=?;'
             self.store = f'UPDATE {owner.table} SET {name}=? WHERE {owner.key}=?;'

         def __get__(self, obj, objtype=None):
             return conn.execute(self.fetch, [obj.key]).fetchone()[0]

         def __set__(self, obj, value):
             conn.execute(self.store, [value, obj.key])
             conn.commit()

We can use the ‘Field’ class to define models(2) that describe the
schema for each table in a database:

     class Movie:
         table = 'Movies'                    # Table name
         key = 'title'                       # Primary key
         director = Field()
         year = Field()

         def __init__(self, key):
             self.key = key

     class Song:
         table = 'Music'
         key = 'title'
         artist = Field()
         year = Field()
         genre = Field()

         def __init__(self, key):
             self.key = key

モデルを使用するにはまずデータベースに接続します:

     >>> import sqlite3
     >>> conn = sqlite3.connect('entertainment.db')

次のインタラクティブセッションでは、データベースからのデータの取得と、更
新方法を示しています。

     >>> Movie('Star Wars').director
     'George Lucas'
     >>> jaws = Movie('Jaws')
     >>> f'Released in {jaws.year} by {jaws.director}'
     'Released in 1975 by Steven Spielberg'

     >>> Song('Country Roads').artist
     'John Denver'

     >>> Movie('Star Wars').director = 'J.J. Abrams'
     >>> Movie('Star Wars').director
     'J.J. Abrams'

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Object%E2%80%93relational_mapping

   (2) https://en.wikipedia.org/wiki/Database_model


File: python.info,  Node: ピュアPythonの等価実装,  Prev: 技術的なチュートリアル,  Up: デスクリプタ ガイド

9.4.4 ピュアPythonの等価実装
----------------------------

このプロトコルは単純ですが、ワクワクする可能性も秘めています。ユースケー
スの中には、あまりに一般的なので組み込みに追加されたものもあります。プロ
パティ、束縛のメソッド、静的メソッド、クラスメソッド、 __slots__ は、全
てデスクリプタプロトコルに基づいています。

* Menu:

* プロパティ::
* 関数とメソッド::
* メソッドの種類::
* 静的メソッド::
* クラスメソッド::
* メンバーオブジェクトと __slots__::


File: python.info,  Node: プロパティ,  Next: 関数とメソッド,  Up: ピュアPythonの等価実装

9.4.4.1 プロパティ
..................

*note property(): 4b3. を呼び出すことで、属性へアクセスすると関数の呼び
出しを引き起こす、データデスクリプタを簡潔に組み立てられます。シグネチャ
はこうです:

     property(fget=None, fset=None, fdel=None, doc=None) -> property

このドキュメントでは、管理された属性 ‘x’ を定義する典型的な使用法を示し
ます:

     class C:
         def getx(self): return self.__x
         def setx(self, value): self.__x = value
         def delx(self): del self.__x
         x = property(getx, setx, delx, "I'm the 'x' property.")

To see how *note property(): 4b3. is implemented in terms of the
descriptor protocol, here is a pure Python equivalent that implements
most of the core functionality:

     class Property:
         "Emulate PyProperty_Type() in Objects/descrobject.c"

         def __init__(self, fget=None, fset=None, fdel=None, doc=None):
             self.fget = fget
             self.fset = fset
             self.fdel = fdel
             if doc is None and fget is not None:
                 doc = fget.__doc__
             self.__doc__ = doc

         def __set_name__(self, owner, name):
             self.__name__ = name

         def __get__(self, obj, objtype=None):
             if obj is None:
                 return self
             if self.fget is None:
                 raise AttributeError
             return self.fget(obj)

         def __set__(self, obj, value):
             if self.fset is None:
                 raise AttributeError
             self.fset(obj, value)

         def __delete__(self, obj):
             if self.fdel is None:
                 raise AttributeError
             self.fdel(obj)

         def getter(self, fget):
             return type(self)(fget, self.fset, self.fdel, self.__doc__)

         def setter(self, fset):
             return type(self)(self.fget, fset, self.fdel, self.__doc__)

         def deleter(self, fdel):
             return type(self)(self.fget, self.fset, fdel, self.__doc__)

組み込みの *note property(): 4b3. 関数は、ユーザインターフェースへの属性
アクセスが与えられ、続く変更がメソッドの介入を要求するときに役立ちます。

例えば、スプレッドシートクラスが、‘Cell('b10').value’ でセルの値を取得で
きるとします。続く改良により、プログラムがアクセスの度にセルの再計算をす
ることを要求しました。しかしプログラマは、その属性に直接アクセスする既存
のクライアントコードに影響を与えたくありません。この解決策は、property デ
ータデスクリプタ内に値属性へのアクセスをラップすることです:

     class Cell:
         ...

         @property
         def value(self):
             "Recalculate the cell before returning value"
             self.recalc()
             return self._value

Either the built-in *note property(): 4b3. or our ‘Property()’
equivalent would work in this example.


File: python.info,  Node: 関数とメソッド,  Next: メソッドの種類,  Prev: プロパティ,  Up: ピュアPythonの等価実装

9.4.4.2 関数とメソッド
......................

Python のオブジェクト指向機能は、関数に基づく環境の上に構築されています
。非データデスクリプタを使って、この 2 つはシームレスに組み合わされてい
ます。

クラス辞書に格納された関数は、実行時にメソッドに変換されます。メソッドと
通常の関数はオブジェクトのインスタンスが他の引数よりも前に渡される点だけ
が異なります。監修ではインスタンスは 'self' という名前が使われますが、
'this' や他の変数名も使えます。

メソッドは、ほぼ次のコードと同等な *note types.MethodType: 1b83. を使え
ば手動で作れます。

     class MethodType:
         "Emulate PyMethod_Type in Objects/classobject.c"

         def __init__(self, func, obj):
             self.__func__ = func
             self.__self__ = obj

         def __call__(self, *args, **kwargs):
             func = self.__func__
             obj = self.__self__
             return func(obj, *args, **kwargs)

         def __getattribute__(self, name):
             "Emulate method_getset() in Objects/classobject.c"
             if name == '__doc__':
                 return self.__func__.__doc__
             return object.__getattribute__(self, name)

         def __getattr__(self, name):
             "Emulate method_getattro() in Objects/classobject.c"
             return getattr(self.__func__, name)

         def __get__(self, obj, objtype=None):
             "Emulate method_descr_get() in Objects/classobject.c"
             return self

To support automatic creation of methods, functions include the *note
__get__(): 1701. method for binding methods during attribute access.
This means that functions are non-data descriptors that return bound
methods during dotted lookup from an instance.  Here's how it works:

     class Function:
         ...

         def __get__(self, obj, objtype=None):
             "Simulate func_descr_get() in Objects/funcobject.c"
             if obj is None:
                 return self
             return MethodType(self, obj)

次のクラスをインタプリタを起動すると、この関数デスクリプタが実際にどう働
くかを見られます:

     class D:
         def f(self):
              return self

     class D2:
         pass

この関数はイントロスペクションをサポートするために *note qualified name:
1d24. も持っています。

     >>> D.f.__qualname__
     'D.f'

Accessing the function through the class dictionary does not invoke
*note __get__(): 1701.  Instead, it just returns the underlying function
object:

     >>> D.__dict__['f']
     <function D.f at 0x00C45070>

Dotted access from a class calls *note __get__(): 1701. which just
returns the underlying function unchanged:

     >>> D.f
     <function D.f at 0x00C45070>

The interesting behavior occurs during dotted access from an instance.
The dotted lookup calls *note __get__(): 1701. which returns a bound
method object:

     >>> d = D()
     >>> d.f
     <bound method D.f of <__main__.D object at 0x00B18C90>>

内部では、束縛メソッドはオリジナルの関数と束縛されたインスタンスを保持し
ています。

     >>> d.f.__func__
     <function D.f at 0x00C45070>

     >>> d.f.__self__
     <__main__.D object at 0x00B18C90>

もし、通常のメソッドの 'self' や、クラスメソッドの 'cls' がどこから来る
の疑問に思っている人がいるとしたら、これがその答えになります！


File: python.info,  Node: メソッドの種類,  Next: 静的メソッド,  Prev: 関数とメソッド,  Up: ピュアPythonの等価実装

9.4.4.3 メソッドの種類
......................

非データデスクリプタは、関数をメソッドに束縛する、各種の一般的なパターン
に、単純な機構を提供します。

To recap, functions have a *note __get__(): 1701. method so that they
can be converted to a method when accessed as attributes.  The non-data
descriptor transforms an ‘obj.f(*args)’ call into ‘f(obj, *args)’.
Calling ‘cls.f(*args)’ becomes ‘f(*args)’.

このチャートは、束縛と、その 2 つの異なる便利な形をまとめています:

     変換                  オブジェクトから呼び出さ   クラスから呼び出され
                           れる                       る
                                                      
     ------------------------------------------------------------------------
                                                      
     関数                  f(obj, *args)              f(*args)
                                                      
                                                      
     静的メソッド          f(*args)                   f(*args)
                                                      
                                                      
     クラスメソッド        f(type(obj), *args)        f(cls, *args)
                                                      


File: python.info,  Node: 静的メソッド,  Next: クラスメソッド,  Prev: メソッドの種類,  Up: ピュアPythonの等価実装

9.4.4.4 静的メソッド
....................

静的メソッドは、下にある関数をそのまま返します。 ‘c.f’ や ‘C.f’ は、
‘object.__getattribute__(c, "f")’ や ‘object.__getattribute__(C, "f")’ を
直接探索するのと同じです。結果として、関数はオブジェクトとクラスから同じ
ようにアクセスできます。

静的メソッドにすると良いのは、 ‘self’ 変数への参照を持たないメソッドです
。

For instance, a statistics package may include a container class for
experimental data.  The class provides normal methods for computing the
average, mean, median, and other descriptive statistics that depend on
the data.  However, there may be useful functions which are conceptually
related but do not depend on the data.  For instance, ‘erf(x)’ is handy
conversion routine that comes up in statistical work but does not
directly depend on a particular dataset.  It can be called either from
an object or the class: ‘s.erf(1.5) --> 0.9332’ or ‘Sample.erf(1.5) -->
0.9332’.

静的メソッドは下にある関数をそのまま返すので、呼び出しの例は面白くありま
せん:

     class E:
         @staticmethod
         def f(x):
             return x * 10

     >>> E.f(3)
     30
     >>> E().f(3)
     30

非データデスクリプタプロトコルを使うと、pure Python 版の *note
staticmethod(): 453. は以下のようになります:

     import functools

     class StaticMethod:
         "Emulate PyStaticMethod_Type() in Objects/funcobject.c"

         def __init__(self, f):
             self.f = f
             functools.update_wrapper(self, f)

         def __get__(self, obj, objtype=None):
             return self.f

         def __call__(self, *args, **kwds):
             return self.f(*args, **kwds)

         @property
         def __annotations__(self):
             return self.f.__annotations__

The *note functools.update_wrapper(): 1223. call adds a ‘__wrapped__’
attribute that refers to the underlying function.  Also it carries
forward the attributes necessary to make the wrapper look like the
wrapped function, including *note __name__: 14ec, *note __qualname__:
2349, and *note __doc__: 13f1.


File: python.info,  Node: クラスメソッド,  Next: メンバーオブジェクトと __slots__,  Prev: 静的メソッド,  Up: ピュアPythonの等価実装

9.4.4.5 クラスメソッド
......................

静的メソッドとは違って、クラスメソッドは関数を呼び出す前にクラス参照を引
数リストの先頭に加えます。このフォーマットは、呼び出し元がオブジェクトで
もクラスでも同じです:

     class F:
         @classmethod
         def f(cls, x):
             return cls.__name__, x

     >>> F.f(3)
     ('F', 3)
     >>> F().f(3)
     ('F', 3)

この振る舞いは、関数がクラス参照のみを必要とし、特定のインスタンスに保存
されたデータに依存しないときに便利です。クラスメソッドの使い方の一つは、
代わりのクラスコンストラクタを作ることです。例えば、クラスメソッド *note
dict.fromkeys(): 24e. は新しい辞書をキーのリストから生成します。等価な
pure Python 版は:

     class Dict(dict):
         @classmethod
         def fromkeys(cls, iterable, value=None):
             "Emulate dict_fromkeys() in Objects/dictobject.c"
             d = cls()
             for key in iterable:
                 d[key] = value
             return d

これで一意なキーを持つ新しい辞書が以下のように構成できます:

     >>> d = Dict.fromkeys('abracadabra')
     >>> type(d) is Dict
     True
     >>> d
     {'a': None, 'b': None, 'r': None, 'c': None, 'd': None}

非データデスクリプタプロトコルを使った、 *note classmethod(): 48e. の
pure Python 版はこのようになります:

     import functools

     class ClassMethod:
         "Emulate PyClassMethod_Type() in Objects/funcobject.c"

         def __init__(self, f):
             self.f = f
             functools.update_wrapper(self, f)

         def __get__(self, obj, cls=None):
             if cls is None:
                 cls = type(obj)
             return MethodType(self.f, cls)

‘ClassMethod’ 内の *note functools.update_wrapper(): 1223. の呼び出しは
、根底にある関数を参照する ‘__wrapped__’ 属性を追加します。また、ラッパ
ーがそのラップされた関数のように見えるよう、必要な属性を追加します:
*note __name__: 14ec. 、 *note __qualname__: 2349. 、 *note __doc__:
13f1. 、 *note __annotations__: 13f0. 。


File: python.info,  Node: メンバーオブジェクトと __slots__,  Prev: クラスメソッド,  Up: ピュアPythonの等価実装

9.4.4.6 メンバーオブジェクトと __slots__
........................................

クラスが ‘__slots__’ を定義すると、インスタンスの辞書が固定超のスロット
の値の配列と置き換えられます。ユーザーの目線からみると、いくつかの変化が
あります。

1.  Provides immediate detection of bugs due to misspelled attribute
assignments.  Only attribute names specified in ‘__slots__’ are allowed:

     class Vehicle:
         __slots__ = ('id_number', 'make', 'model')

     >>> auto = Vehicle()
     >>> auto.id_nubmer = 'VYE483814LQEX'
     Traceback (most recent call last):
         ...
     AttributeError: 'Vehicle' object has no attribute 'id_nubmer'

2.  Helps create immutable objects where descriptors manage access to
private attributes stored in ‘__slots__’:

     class Immutable:

         __slots__ = ('_dept', '_name')          # Replace the instance dictionary

         def __init__(self, dept, name):
             self._dept = dept                   # Store to private attribute
             self._name = name                   # Store to private attribute

         @property                               # Read-only descriptor
         def dept(self):
             return self._dept

         @property
         def name(self):                         # Read-only descriptor
             return self._name

     >>> mark = Immutable('Botany', 'Mark Watney')
     >>> mark.dept
     'Botany'
     >>> mark.dept = 'Space Pirate'
     Traceback (most recent call last):
         ...
     AttributeError: property 'dept' of 'Immutable' object has no setter
     >>> mark.location = 'Mars'
     Traceback (most recent call last):
         ...
     AttributeError: 'Immutable' object has no attribute 'location'

3.  Saves memory.  On a 64-bit Linux build, an instance with two
attributes takes 48 bytes with ‘__slots__’ and 152 bytes without.  This
flyweight design pattern(1) likely only matters when a large number of
instances are going to be created.

4.  Improves speed.  Reading instance variables is 35% faster with
‘__slots__’ (as measured with Python 3.10 on an Apple M1 processor).

5.  Blocks tools like *note functools.cached_property(): 763. which
require an instance dictionary to function correctly:

     from functools import cached_property

     class CP:
         __slots__ = ()                          # Eliminates the instance dict

         @cached_property                        # Requires an instance dict
         def pi(self):
             return 4 * sum((-1.0)**n / (2.0*n + 1.0)
                            for n in reversed(range(100_000)))

     >>> CP().pi
     Traceback (most recent call last):
       ...
     TypeError: No '__dict__' attribute on 'CP' instance to cache 'pi' property.

‘__slots__’ はC構造体に直接アクセスし、オブジェクトのメモリ確保を制御す
る必要があるため、ピュアPythonバージョンを作成することはできません。しか
し、プライベートの ‘__slotvalues’ リストを使ってC構造体のスロットをほぼ
忠実にエミュレートすることはできます。そのプライベートな構造体への読み書
きはメンバーのデスクリプタによって管理されます。

     null = object()

     class Member:

         def __init__(self, name, clsname, offset):
             'Emulate PyMemberDef in Include/structmember.h'
             # Also see descr_new() in Objects/descrobject.c
             self.name = name
             self.clsname = clsname
             self.offset = offset

         def __get__(self, obj, objtype=None):
             'Emulate member_get() in Objects/descrobject.c'
             # Also see PyMember_GetOne() in Python/structmember.c
             if obj is None:
                 return self
             value = obj._slotvalues[self.offset]
             if value is null:
                 raise AttributeError(self.name)
             return value

         def __set__(self, obj, value):
             'Emulate member_set() in Objects/descrobject.c'
             obj._slotvalues[self.offset] = value

         def __delete__(self, obj):
             'Emulate member_delete() in Objects/descrobject.c'
             value = obj._slotvalues[self.offset]
             if value is null:
                 raise AttributeError(self.name)
             obj._slotvalues[self.offset] = null

         def __repr__(self):
             'Emulate member_repr() in Objects/descrobject.c'
             return f'<Member {self.name!r} of {self.clsname!r}>'

The ‘type.__new__()’ method takes care of adding member objects to class
variables:

     class Type(type):
         'Simulate how the type metaclass adds member objects for slots'

         def __new__(mcls, clsname, bases, mapping, **kwargs):
             'Emulate type_new() in Objects/typeobject.c'
             # type_new() calls PyTypeReady() which calls add_methods()
             slot_names = mapping.get('slot_names', [])
             for offset, name in enumerate(slot_names):
                 mapping[name] = Member(name, clsname, offset)
             return type.__new__(mcls, clsname, bases, mapping, **kwargs)

*note object.__new__(): 7a0. メソッドはインスタンス辞書の代わりにスロッ
トを持つインスタンスの作成の処理をします。おおざっぱにピュアPythonでのシ
ミュレーションしたコードがこちらです。

     class Object:
         'Simulate how object.__new__() allocates memory for __slots__'

         def __new__(cls, *args, **kwargs):
             'Emulate object_new() in Objects/typeobject.c'
             inst = super().__new__(cls)
             if hasattr(cls, 'slot_names'):
                 empty_slots = [null] * len(cls.slot_names)
                 object.__setattr__(inst, '_slotvalues', empty_slots)
             return inst

         def __setattr__(self, name, value):
             'Emulate _PyObject_GenericSetAttrWithDict() Objects/object.c'
             cls = type(self)
             if hasattr(cls, 'slot_names') and name not in cls.slot_names:
                 raise AttributeError(
                     f'{cls.__name__!r} object has no attribute {name!r}'
                 )
             super().__setattr__(name, value)

         def __delattr__(self, name):
             'Emulate _PyObject_GenericSetAttrWithDict() Objects/object.c'
             cls = type(self)
             if hasattr(cls, 'slot_names') and name not in cls.slot_names:
                 raise AttributeError(
                     f'{cls.__name__!r} object has no attribute {name!r}'
                 )
             super().__delattr__(name)

To use the simulation in a real class, just inherit from ‘Object’ and
set the *note metaclass: 23d0. to ‘Type’:

     class H(Object, metaclass=Type):
         'Instance variables stored in slots'

         slot_names = ['x', 'y']

         def __init__(self, x, y):
             self.x = x
             self.y = y

この時点ではメタクラスは 'x' と 'y' のメンバーオブジェクトをロードします
。

     >>> from pprint import pp
     >>> pp(dict(vars(H)))
     {'__module__': '__main__',
      '__doc__': 'Instance variables stored in slots',
      'slot_names': ['x', 'y'],
      '__init__': <function H.__init__ at 0x7fb5d302f9d0>,
      'x': <Member 'x' of 'H'>,
      'y': <Member 'y' of 'H'>}

インスタンスが作成されると、属性が保持される ‘slot_values’ のリストをイ
ンスタンスが保持します:

     >>> h = H(10, 20)
     >>> vars(h)
     {'_slotvalues': [10, 20]}
     >>> h.x = 55
     >>> vars(h)
     {'_slotvalues': [55, 20]}

スペルミスや、未アサインの属性は例外を送出します。

     >>> h.xz
     Traceback (most recent call last):
         ...
     AttributeError: 'H' object has no attribute 'xz'

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Flyweight_pattern


File: python.info,  Node: Debugging C API extensions and CPython Internals with GDB,  Next: 列挙型 HOWTO,  Prev: デスクリプタ ガイド,  Up: Python HOWTO

9.5 Debugging C API extensions and CPython Internals with GDB
=============================================================

This document explains how the Python GDB extension, ‘python-gdb.py’,
can be used with the GDB debugger to debug CPython extensions and the
CPython interpreter itself.

When debugging low-level problems such as crashes or deadlocks, a
low-level debugger, such as GDB, is useful to diagnose and correct the
issue.  By default, GDB (or any of its front-ends) doesn't support
high-level information specific to the CPython interpreter.

The ‘python-gdb.py’ extension adds CPython interpreter information to
GDB. The extension helps introspect the stack of currently executing
Python functions.  Given a Python object represented by a *note
PyObject: 5df.* pointer, the extension surfaces the type and value of
the object.

Developers who are working on CPython extensions or tinkering with parts
of CPython that are written in C can use this document to learn how to
use the ‘python-gdb.py’ extension with GDB.

     注釈: This document assumes that you are familiar with the basics
     of GDB and the CPython C API. It consolidates guidance from the
     devguide(1) and the Python wiki(2).

* Menu:

* Prerequisites::
* Using the Debug build and Development mode::
* Using the python-gdb extension::
* Use with GDB commands::

   ---------- Footnotes ----------

   (1) https://devguide.python.org

   (2) https://wiki.python.org/moin/DebuggingWithGdb


File: python.info,  Node: Prerequisites,  Next: Using the Debug build and Development mode,  Up: Debugging C API extensions and CPython Internals with GDB

9.5.1 Prerequisites
-------------------

You need to have:

   - GDB 7 or later.  (For earlier versions of GDB, see ‘Misc/gdbinit’
     in the sources of Python 3.11 or earlier.)

   - GDB-compatible debugging information for Python and any extension
     you are debugging.

   - The ‘python-gdb.py’ extension.

The extension is built with Python, but might be distributed separately
or not at all.  Below, we include tips for a few common systems as
examples.  Note that even if the instructions match your system, they
might be outdated.

* Menu:

* Setup with Python built from source::
* Setup for Python from a Linux distro::


File: python.info,  Node: Setup with Python built from source,  Next: Setup for Python from a Linux distro,  Up: Prerequisites

9.5.1.1 Setup with Python built from source
...........................................

When you build CPython from source, debugging information should be
available, and the build should add a ‘python-gdb.py’ file to the root
directory of your repository.

To activate support, you must add the directory containing
‘python-gdb.py’ to GDB's "auto-load-safe-path".  If you haven't done
this, recent versions of GDB will print out a warning with instructions
on how to do this.

     注釈: If you do not see instructions for your version of GDB, put
     this in your configuration file (‘~/.gdbinit’ or
     ‘~/.config/gdb/gdbinit’):

          add-auto-load-safe-path /path/to/cpython

     You can also add multiple paths, separated by ‘:’.


File: python.info,  Node: Setup for Python from a Linux distro,  Prev: Setup with Python built from source,  Up: Prerequisites

9.5.1.2 Setup for Python from a Linux distro
............................................

Most Linux systems provide debug information for the system Python in a
package called ‘python-debuginfo’, ‘python-dbg’ or similar.  For
example:

   - Fedora:

               sudo dnf install gdb
               sudo dnf debuginfo-install python3

   - Ubuntu:

               sudo apt install gdb python3-dbg

On several recent Linux systems, GDB can download debugging symbols
automatically using 'debuginfod'.  However, this will not install the
‘python-gdb.py’ extension; you generally do need to install the debug
info package separately.


File: python.info,  Node: Using the Debug build and Development mode,  Next: Using the python-gdb extension,  Prev: Prerequisites,  Up: Debugging C API extensions and CPython Internals with GDB

9.5.2 Using the Debug build and Development mode
------------------------------------------------

For easier debugging, you might want to:

   - Use a *note debug build: 509. of Python.  (When building from
     source, use ‘configure --with-pydebug’.  On Linux distros, install
     and run a package like ‘python-debug’ or ‘python-dbg’, if
     available.)

   - Use the runtime *note development mode: 508. (‘-X dev’).

Both enable extra assertions and disable some optimizations.  Sometimes
this hides the bug you are trying to find, but in most cases they make
the process easier.


File: python.info,  Node: Using the python-gdb extension,  Next: Use with GDB commands,  Prev: Using the Debug build and Development mode,  Up: Debugging C API extensions and CPython Internals with GDB

9.5.3 Using the ‘python-gdb’ extension
--------------------------------------

When the extension is loaded, it provides two main features: pretty
printers for Python values, and additional commands.

* Menu:

* Pretty-printers::
* py-list::
* py-up and py-down::
* py-bt::
* py-print::
* py-locals::


File: python.info,  Node: Pretty-printers,  Next: py-list,  Up: Using the python-gdb extension

9.5.3.1 Pretty-printers
.......................

This is what a GDB backtrace looks like (truncated) when this extension
is enabled:

     #0  0x000000000041a6b1 in PyObject_Malloc (nbytes=Cannot access memory at address 0x7fffff7fefe8
     ) at Objects/obmalloc.c:748
     #1  0x000000000041b7c0 in _PyObject_DebugMallocApi (id=111 'o', nbytes=24) at Objects/obmalloc.c:1445
     #2  0x000000000041b717 in _PyObject_DebugMalloc (nbytes=24) at Objects/obmalloc.c:1412
     #3  0x000000000044060a in _PyUnicode_New (length=11) at Objects/unicodeobject.c:346
     #4  0x00000000004466aa in PyUnicodeUCS2_DecodeUTF8Stateful (s=0x5c2b8d "__lltrace__", size=11, errors=0x0, consumed=
         0x0) at Objects/unicodeobject.c:2531
     #5  0x0000000000446647 in PyUnicodeUCS2_DecodeUTF8 (s=0x5c2b8d "__lltrace__", size=11, errors=0x0)
         at Objects/unicodeobject.c:2495
     #6  0x0000000000440d1b in PyUnicodeUCS2_FromStringAndSize (u=0x5c2b8d "__lltrace__", size=11)
         at Objects/unicodeobject.c:551
     #7  0x0000000000440d94 in PyUnicodeUCS2_FromString (u=0x5c2b8d "__lltrace__") at Objects/unicodeobject.c:569
     #8  0x0000000000584abd in PyDict_GetItemString (v=
         {'Yuck': <type at remote 0xad4730>, '__builtins__': <module at remote 0x7ffff7fd5ee8>, '__file__': 'Lib/test/crashers/nasty_eq_vs_dict.py', '__package__': None, 'y': <Yuck(i=0) at remote 0xaacd80>, 'dict': {0: 0, 1: 1, 2: 2, 3: 3}, '__cached__': None, '__name__': '__main__', 'z': <Yuck(i=0) at remote 0xaace60>, '__doc__': None}, key=
         0x5c2b8d "__lltrace__") at Objects/dictobject.c:2171

Notice how the dictionary argument to ‘PyDict_GetItemString’ is
displayed as its ‘repr()’, rather than an opaque ‘PyObject *’ pointer.

The extension works by supplying a custom printing routine for values of
type ‘PyObject *’.  If you need to access lower-level details of an
object, then cast the value to a pointer of the appropriate type.  For
example:

     (gdb) p globals
     $1 = {'__builtins__': <module at remote 0x7ffff7fb1868>, '__name__':
     '__main__', 'ctypes': <module at remote 0x7ffff7f14360>, '__doc__': None,
     '__package__': None}

     (gdb) p *(PyDictObject*)globals
     $2 = {ob_refcnt = 3, ob_type = 0x3dbdf85820, ma_fill = 5, ma_used = 5,
     ma_mask = 7, ma_table = 0x63d0f8, ma_lookup = 0x3dbdc7ea70
     <lookdict_string>, ma_smalltable = {{me_hash = 7065186196740147912,
     me_key = '__builtins__', me_value = <module at remote 0x7ffff7fb1868>},
     {me_hash = -368181376027291943, me_key = '__name__',
     me_value ='__main__'}, {me_hash = 0, me_key = 0x0, me_value = 0x0},
     {me_hash = 0, me_key = 0x0, me_value = 0x0},
     {me_hash = -9177857982131165996, me_key = 'ctypes',
     me_value = <module at remote 0x7ffff7f14360>},
     {me_hash = -8518757509529533123, me_key = '__doc__', me_value = None},
     {me_hash = 0, me_key = 0x0, me_value = 0x0}, {
       me_hash = 6614918939584953775, me_key = '__package__', me_value = None}}}

Note that the pretty-printers do not actually call ‘repr()’.  For basic
types, they try to match its result closely.

An area that can be confusing is that the custom printer for some types
look a lot like GDB's built-in printer for standard types.  For example,
the pretty-printer for a Python ‘int’ (*note PyLongObject: 39e.*) gives
a representation that is not distinguishable from one of a regular
machine-level integer:

     (gdb) p some_machine_integer
     $3 = 42

     (gdb) p some_python_integer
     $4 = 42

The internal structure can be revealed with a cast to *note
PyLongObject: 39e.*:

     (gdb) p *(PyLongObject*)some_python_integer
     $5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1},
     ob_digit = {42}}

A similar confusion can arise with the ‘str’ type, where the output
looks a lot like gdb's built-in printer for ‘char *’:

     (gdb) p ptr_to_python_str
     $6 = '__builtins__'

The pretty-printer for ‘str’ instances defaults to using single-quotes
(as does Python's ‘repr’ for strings) whereas the standard printer for
‘char *’ values uses double-quotes and contains a hexadecimal address:

     (gdb) p ptr_to_char_star
     $7 = 0x6d72c0 "hello world"

Again, the implementation details can be revealed with a cast to *note
PyUnicodeObject: 997.*:

     (gdb) p *(PyUnicodeObject*)$6
     $8 = {ob_base = {ob_refcnt = 33, ob_type = 0x3dad3a95a0}, length = 12,
     str = 0x7ffff2128500, hash = 7065186196740147912, state = 1, defenc = 0x0}


File: python.info,  Node: py-list,  Next: py-up and py-down,  Prev: Pretty-printers,  Up: Using the python-gdb extension

9.5.3.2 ‘py-list’
.................

     The extension adds a ‘py-list’ command, which lists the Python
     source code (if any) for the current frame in the selected thread.
     The current line is marked with a ">":

          (gdb) py-list
           901        if options.profile:
           902            options.profile = False
           903            profile_me()
           904            return
           905
          >906        u = UI()
           907        if not u.quit:
           908            try:
           909                gtk.main()
           910            except KeyboardInterrupt:
           911                # properly quit on a keyboard interrupt...

     Use ‘py-list START’ to list at a different line number within the
     Python source, and ‘py-list START,END’ to list a specific range of
     lines within the Python source.


File: python.info,  Node: py-up and py-down,  Next: py-bt,  Prev: py-list,  Up: Using the python-gdb extension

9.5.3.3 ‘py-up’ and ‘py-down’
.............................

     The ‘py-up’ and ‘py-down’ commands are analogous to GDB's regular
     ‘up’ and ‘down’ commands, but try to move at the level of CPython
     frames, rather than C frames.

     GDB is not always able to read the relevant frame information,
     depending on the optimization level with which CPython was
     compiled.  Internally, the commands look for C frames that are
     executing the default frame evaluation function (that is, the core
     bytecode interpreter loop within CPython) and look up the value of
     the related ‘PyFrameObject *’.

     They emit the frame number (at the C level) within the thread.

     例えば:

          (gdb) py-up
          #37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/
          gnome_sudoku/main.py, line 906, in start_game ()
              u = UI()
          (gdb) py-up
          #40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/
          gnome_sudoku/gnome_sudoku.py, line 22, in start_game(main=<module at remote 0xb771b7f4>)
              main.start_game()
          (gdb) py-up
          Unable to find an older python frame

     so we're at the top of the Python stack.

     The frame numbers correspond to those displayed by GDB's standard
     ‘backtrace’ command.  The command skips C frames which are not
     executing Python code.

     Going back down:

          (gdb) py-down
          #37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/gnome_sudoku/main.py, line 906, in start_game ()
              u = UI()
          (gdb) py-down
          #34 (unable to read python frame information)
          (gdb) py-down
          #23 (unable to read python frame information)
          (gdb) py-down
          #19 (unable to read python frame information)
          (gdb) py-down
          #14 Frame 0x99262ac, for file /usr/lib/python2.6/site-packages/gnome_sudoku/game_selector.py, line 201, in run_swallowed_dialog (self=<NewOrSavedGameSelector(new_game_model=<gtk.ListStore at remote 0x98fab44>, puzzle=None, saved_games=[{'gsd.auto_fills': 0, 'tracking': {}, 'trackers': {}, 'notes': [], 'saved_at': 1270084485, 'game': '7 8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 0 0 0 4 7 9 2 0 0 0 9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5\n7 8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 1 8 3 4 7 9 2 0 0 0 9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5', 'gsd.impossible_hints': 0, 'timer.__absolute_start_time__': <float at remote 0x984b474>, 'gsd.hints': 0, 'timer.active_time': <float at remote 0x984b494>, 'timer.total_time': <float at remote 0x984b464>}], dialog=<gtk.Dialog at remote 0x98faaa4>, saved_game_model=<gtk.ListStore at remote 0x98fad24>, sudoku_maker=<SudokuMaker(terminated=False, played=[], batch_siz...(truncated)
                      swallower.run_dialog(self.dialog)
          (gdb) py-down
          #11 Frame 0x9aead74, for file /usr/lib/python2.6/site-packages/gnome_sudoku/dialog_swallower.py, line 48, in run_dialog (self=<SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>, main_page=0) at remote 0x98fa6e4>, d=<gtk.Dialog at remote 0x98faaa4>)
                      gtk.main()
          (gdb) py-down
          #8 (unable to read python frame information)
          (gdb) py-down
          Unable to find a newer python frame

     and we're at the bottom of the Python stack.

     Note that in Python 3.12 and newer, the same C stack frame can be
     used for multiple Python stack frames.  This means that ‘py-up’ and
     ‘py-down’ may move multiple Python frames at once.  For example:

          (gdb) py-up
          #6 Frame 0x7ffff7fb62b0, for file /tmp/rec.py, line 5, in recursive_function (n=0)
             time.sleep(5)
          #6 Frame 0x7ffff7fb6240, for file /tmp/rec.py, line 7, in recursive_function (n=1)
             recursive_function(n-1)
          #6 Frame 0x7ffff7fb61d0, for file /tmp/rec.py, line 7, in recursive_function (n=2)
             recursive_function(n-1)
          #6 Frame 0x7ffff7fb6160, for file /tmp/rec.py, line 7, in recursive_function (n=3)
             recursive_function(n-1)
          #6 Frame 0x7ffff7fb60f0, for file /tmp/rec.py, line 7, in recursive_function (n=4)
             recursive_function(n-1)
          #6 Frame 0x7ffff7fb6080, for file /tmp/rec.py, line 7, in recursive_function (n=5)
             recursive_function(n-1)
          #6 Frame 0x7ffff7fb6020, for file /tmp/rec.py, line 9, in <module> ()
             recursive_function(5)
          (gdb) py-up
          Unable to find an older python frame


File: python.info,  Node: py-bt,  Next: py-print,  Prev: py-up and py-down,  Up: Using the python-gdb extension

9.5.3.4 ‘py-bt’
...............

     The ‘py-bt’ command attempts to display a Python-level backtrace of
     the current thread.

     例えば:

          (gdb) py-bt
          #8 (unable to read python frame information)
          #11 Frame 0x9aead74, for file /usr/lib/python2.6/site-packages/gnome_sudoku/dialog_swallower.py, line 48, in run_dialog (self=<SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>, main_page=0) at remote 0x98fa6e4>, d=<gtk.Dialog at remote 0x98faaa4>)
                      gtk.main()
          #14 Frame 0x99262ac, for file /usr/lib/python2.6/site-packages/gnome_sudoku/game_selector.py, line 201, in run_swallowed_dialog (self=<NewOrSavedGameSelector(new_game_model=<gtk.ListStore at remote 0x98fab44>, puzzle=None, saved_games=[{'gsd.auto_fills': 0, 'tracking': {}, 'trackers': {}, 'notes': [], 'saved_at': 1270084485, 'game': '7 8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 0 0 0 4 7 9 2 0 0 0 9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5\n7 8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 1 8 3 4 7 9 2 0 0 0 9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5', 'gsd.impossible_hints': 0, 'timer.__absolute_start_time__': <float at remote 0x984b474>, 'gsd.hints': 0, 'timer.active_time': <float at remote 0x984b494>, 'timer.total_time': <float at remote 0x984b464>}], dialog=<gtk.Dialog at remote 0x98faaa4>, saved_game_model=<gtk.ListStore at remote 0x98fad24>, sudoku_maker=<SudokuMaker(terminated=False, played=[], batch_siz...(truncated)
                      swallower.run_dialog(self.dialog)
          #19 (unable to read python frame information)
          #23 (unable to read python frame information)
          #34 (unable to read python frame information)
          #37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/gnome_sudoku/main.py, line 906, in start_game ()
              u = UI()
          #40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/gnome_sudoku/gnome_sudoku.py, line 22, in start_game (main=<module at remote 0xb771b7f4>)
              main.start_game()

     The frame numbers correspond to those displayed by GDB's standard
     ‘backtrace’ command.


File: python.info,  Node: py-print,  Next: py-locals,  Prev: py-bt,  Up: Using the python-gdb extension

9.5.3.5 ‘py-print’
..................

     The ‘py-print’ command looks up a Python name and tries to print
     it.  It looks in locals within the current thread, then globals,
     then finally builtins:

          (gdb) py-print self
          local 'self' = <SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>,
          main_page=0) at remote 0x98fa6e4>
          (gdb) py-print __name__
          global '__name__' = 'gnome_sudoku.dialog_swallower'
          (gdb) py-print len
          builtin 'len' = <built-in function len>
          (gdb) py-print scarlet_pimpernel
          'scarlet_pimpernel' not found

     If the current C frame corresponds to multiple Python frames,
     ‘py-print’ only considers the first one.


File: python.info,  Node: py-locals,  Prev: py-print,  Up: Using the python-gdb extension

9.5.3.6 ‘py-locals’
...................

     The ‘py-locals’ command looks up all Python locals within the
     current Python frame in the selected thread, and prints their
     representations:

          (gdb) py-locals
          self = <SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>,
          main_page=0) at remote 0x98fa6e4>
          d = <gtk.Dialog at remote 0x98faaa4>

     If the current C frame corresponds to multiple Python frames,
     locals from all of them will be shown:

          (gdb) py-locals
          Locals for recursive_function
          n = 0
          Locals for recursive_function
          n = 1
          Locals for recursive_function
          n = 2
          Locals for recursive_function
          n = 3
          Locals for recursive_function
          n = 4
          Locals for recursive_function
          n = 5
          Locals for <module>


File: python.info,  Node: Use with GDB commands,  Prev: Using the python-gdb extension,  Up: Debugging C API extensions and CPython Internals with GDB

9.5.4 Use with GDB commands
---------------------------

The extension commands complement GDB's built-in commands.  For example,
you can use a frame numbers shown by ‘py-bt’ with the ‘frame’ command to
go a specific frame within the selected thread, like this:

     (gdb) py-bt
     (output snipped)
     #68 Frame 0xaa4560, for file Lib/test/regrtest.py, line 1548, in <module> ()
             main()
     (gdb) frame 68
     #68 0x00000000004cd1e6 in PyEval_EvalFrameEx (f=Frame 0xaa4560, for file Lib/test/regrtest.py, line 1548, in <module> (), throwflag=0) at Python/ceval.c:2665
     2665                            x = call_function(&sp, oparg);
     (gdb) py-list
     1543        # Run the tests in a context manager that temporary changes the CWD to a
     1544        # temporary and writable directory. If it's not possible to create or
     1545        # change the CWD, the original CWD will be used. The original CWD is
     1546        # available from test_support.SAVEDCWD.
     1547        with test_support.temp_cwd(TESTCWD, quiet=True):
     >1548            main()

The ‘info threads’ command will give you a list of the threads within
the process, and you can use the ‘thread’ command to select a different
one:

     (gdb) info threads
       105 Thread 0x7fffefa18710 (LWP 10260)  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
       104 Thread 0x7fffdf5fe710 (LWP 10259)  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
     * 1 Thread 0x7ffff7fe2700 (LWP 10145)  0x00000038e46d73e3 in select () at ../sysdeps/unix/syscall-template.S:82

You can use ‘thread apply all COMMAND’ or (‘t a a COMMAND’ for short) to
run a command on all threads.  With ‘py-bt’, this lets you see what
every thread is doing at the Python level:

     (gdb) t a a py-bt

     Thread 105 (Thread 0x7fffefa18710 (LWP 10260)):
     #5 Frame 0x7fffd00019d0, for file /home/david/coding/python-svn/Lib/threading.py, line 155, in _acquire_restore (self=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, _RLock__block=<thread.lock at remote 0x858770>, _RLock__count=1) at remote 0xd7ff40>, count_owner=(1, 140737213728528), count=1, owner=140737213728528)
             self.__block.acquire()
     #8 Frame 0x7fffac001640, for file /home/david/coding/python-svn/Lib/threading.py, line 269, in wait (self=<_Condition(_Condition__lock=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, _RLock__block=<thread.lock at remote 0x858770>, _RLock__count=1) at remote 0xd7ff40>, acquire=<instancemethod at remote 0xd80260>, _is_owned=<instancemethod at remote 0xd80160>, _release_save=<instancemethod at remote 0xd803e0>, release=<instancemethod at remote 0xd802e0>, _acquire_restore=<instancemethod at remote 0xd7ee60>, _Verbose__verbose=False, _Condition__waiters=[]) at remote 0xd7fd10>, timeout=None, waiter=<thread.lock at remote 0x858a90>, saved_state=(1, 140737213728528))
                 self._acquire_restore(saved_state)
     #12 Frame 0x7fffb8001a10, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 348, in f ()
                 cond.wait()
     #16 Frame 0x7fffb8001c40, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 37, in task (tid=140737213728528)
                     f()

     Thread 104 (Thread 0x7fffdf5fe710 (LWP 10259)):
     #5 Frame 0x7fffe4001580, for file /home/david/coding/python-svn/Lib/threading.py, line 155, in _acquire_restore (self=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, _RLock__block=<thread.lock at remote 0x858770>, _RLock__count=1) at remote 0xd7ff40>, count_owner=(1, 140736940992272), count=1, owner=140736940992272)
             self.__block.acquire()
     #8 Frame 0x7fffc8002090, for file /home/david/coding/python-svn/Lib/threading.py, line 269, in wait (self=<_Condition(_Condition__lock=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, _RLock__block=<thread.lock at remote 0x858770>, _RLock__count=1) at remote 0xd7ff40>, acquire=<instancemethod at remote 0xd80260>, _is_owned=<instancemethod at remote 0xd80160>, _release_save=<instancemethod at remote 0xd803e0>, release=<instancemethod at remote 0xd802e0>, _acquire_restore=<instancemethod at remote 0xd7ee60>, _Verbose__verbose=False, _Condition__waiters=[]) at remote 0xd7fd10>, timeout=None, waiter=<thread.lock at remote 0x858860>, saved_state=(1, 140736940992272))
                 self._acquire_restore(saved_state)
     #12 Frame 0x7fffac001c90, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 348, in f ()
                 cond.wait()
     #16 Frame 0x7fffac0011c0, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 37, in task (tid=140736940992272)
                     f()

     Thread 1 (Thread 0x7ffff7fe2700 (LWP 10145)):
     #5 Frame 0xcb5380, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 16, in _wait ()
         time.sleep(0.01)
     #8 Frame 0x7fffd00024a0, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 378, in _check_notify (self=<ConditionTests(_testMethodName='test_notify', _resultForDoCleanups=<TestResult(_original_stdout=<cStringIO.StringO at remote 0xc191e0>, skipped=[], _mirrorOutput=False, testsRun=39, buffer=False, _original_stderr=<file at remote 0x7ffff7fc6340>, _stdout_buffer=<cStringIO.StringO at remote 0xc9c7f8>, _stderr_buffer=<cStringIO.StringO at remote 0xc9c790>, _moduleSetUpFailed=False, expectedFailures=[], errors=[], _previousTestClass=<type at remote 0x928310>, unexpectedSuccesses=[], failures=[], shouldStop=False, failfast=False) at remote 0xc185a0>, _threads=(0,), _cleanups=[], _type_equality_funcs={<type at remote 0x7eba00>: <instancemethod at remote 0xd750e0>, <type at remote 0x7e7820>: <instancemethod at remote 0xd75160>, <type at remote 0x7e30e0>: <instancemethod at remote 0xd75060>, <type at remote 0x7e7d20>: <instancemethod at remote 0xd751e0>, <type at remote 0x7f19e0...(truncated)
             _wait()


File: python.info,  Node: 列挙型 HOWTO,  Next: 関数型プログラミング HOWTO,  Prev: Debugging C API extensions and CPython Internals with GDB,  Up: Python HOWTO

9.6 列挙型 HOWTO
================

*note Enum: 842. は、ユニークな値に束縛されたシンボル名の集合です。グロ
ーバル変数に似ていますが、 *note repr(): 1c1. がより便利だったり、グルー
ピングの機能、型安全などいくつかの機能があります。

これらは、限られた選択肢の値の一つを取る変数がある場合に便利です。例えば
、曜日情報があります:

     >>> from enum import Enum
     >>> class Weekday(Enum):
     ...     MONDAY = 1
     ...     TUESDAY = 2
     ...     WEDNESDAY = 3
     ...     THURSDAY = 4
     ...     FRIDAY = 5
     ...     SATURDAY = 6
     ...     SUNDAY = 7

あるいは、RGB三原色でも構いません:

     >>> from enum import Enum
     >>> class Color(Enum):
     ...     RED = 1
     ...     GREEN = 2
     ...     BLUE = 3

ご覧の通り、 *note Enum: 842. の作成は *note Enum: 842. 自体を継承するク
ラスを作成するのと同じくらい簡単です。

     注釈: Enumメンバーは大文字/小文字？

     列挙型は定数を表すために使われるため、また mixin クラスのメソッドや
     属性との名前の衝突の問題を回避するため、メンバには UPPER_CASE の名
     前を使うことが強く推奨されており、例でもこのスタイルを用います。

列挙型の性質によって、メンバの値は重要な場合とそうでない場合がありますが
、いずれの場合でも、その値は対応するメンバを取得するのに使えます:

     >>> Weekday(3)
     <Weekday.WEDNESDAY: 3>

ご覧の通り、メンバの ‘repr()’ は列挙型の名前、メンバの名前、そして値を表
示します。メンバの ‘str()’ は列挙型の名前とメンバの名前のみを表示します
。

     >>> print(Weekday.THURSDAY)
     Weekday.THURSDAY

列挙型のメンバの型はそのメンバの属する列挙型です:

     >>> type(Weekday.MONDAY)
     <enum 'Weekday'>
     >>> isinstance(Weekday.FRIDAY, Weekday)
     True

Enum members have an attribute that contains just their ‘name’:

     >>> print(Weekday.TUESDAY.name)
     TUESDAY

Likewise, they have an attribute for their ‘value’:

     >>> Weekday.WEDNESDAY.value
     3

Unlike many languages that treat enumerations solely as name/value
pairs, Python Enums can have behavior added.  For example, *note
datetime.date: 1fa. has two methods for returning the weekday: *note
weekday(): 28c0. and *note isoweekday(): 28c1.  The difference is that
one of them counts from 0-6 and the other from 1-7.  Rather than keep
track of that ourselves we can add a method to the ‘Weekday’ enum to
extract the day from the *note date: 1fa. instance and return the
matching enum member:

     @classmethod
     def from_date(cls, date):
         return cls(date.isoweekday())

The complete ‘Weekday’ enum now looks like this:

     >>> class Weekday(Enum):
     ...     MONDAY = 1
     ...     TUESDAY = 2
     ...     WEDNESDAY = 3
     ...     THURSDAY = 4
     ...     FRIDAY = 5
     ...     SATURDAY = 6
     ...     SUNDAY = 7
     ...     #
     ...     @classmethod
     ...     def from_date(cls, date):
     ...         return cls(date.isoweekday())

さて、これで今日が何曜日か調べることができます！ 見てみましょう:

     >>> from datetime import date
     >>> Weekday.from_date(date.today())
     <Weekday.TUESDAY: 2>

もちろん、あなたがこれを読んでいるのが他の曜日ならば、その曜日が代わりに
表示されます。

This ‘Weekday’ enum is great if our variable only needs one day, but
what if we need several?  Maybe we're writing a function to plot chores
during a week, and don't want to use a *note list: 24d. - we could use a
different type of *note Enum: 842.:

     >>> from enum import Flag
     >>> class Weekday(Flag):
     ...     MONDAY = 1
     ...     TUESDAY = 2
     ...     WEDNESDAY = 4
     ...     THURSDAY = 8
     ...     FRIDAY = 16
     ...     SATURDAY = 32
     ...     SUNDAY = 64

ここでは2つの変更が行われています。*note Flag: 835. を継承している点と、
値がすべて2の累乗である点です。

Just like the original ‘Weekday’ enum above, we can have a single
selection:

     >>> first_week_day = Weekday.MONDAY
     >>> first_week_day
     <Weekday.MONDAY: 1>

ただし、*note Flag: 835. は複数のメンバーをひとつの変数にまとめることも
できます:

     >>> weekend = Weekday.SATURDAY | Weekday.SUNDAY
     >>> weekend
     <Weekday.SATURDAY|SUNDAY: 96>

*note Flag: 835. 変数は反復することもできます:

     >>> for day in weekend:
     ...     print(day)
     Weekday.SATURDAY
     Weekday.SUNDAY

さて、いくつかの家事を設定してみましょう:

     >>> chores_for_ethan = {
     ...     'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday.FRIDAY,
     ...     'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,
     ...     'answer SO questions': Weekday.SATURDAY,
     ...     }

指定された日の家事を表示する関数も作成します:

     >>> def show_chores(chores, day):
     ...     for chore, days in chores.items():
     ...         if day in days:
     ...             print(chore)
     ...
     >>> show_chores(chores_for_ethan, Weekday.SATURDAY)
     answer SO questions

メンバーの実際の値が重要でない場合は、*note auto(): e9b. を使用すること
で手間を省くことができます:

     >>> from enum import auto
     >>> class Weekday(Flag):
     ...     MONDAY = auto()
     ...     TUESDAY = auto()
     ...     WEDNESDAY = auto()
     ...     THURSDAY = auto()
     ...     FRIDAY = auto()
     ...     SATURDAY = auto()
     ...     SUNDAY = auto()
     ...     WEEKEND = SATURDAY | SUNDAY

* Menu:

* 列挙型メンバーおよびそれらの属性へのプログラム的アクセス::
* 列挙型メンバーと値の重複::
* 番号付けの値が一意であることの確認::
* 値の自動設定を使う::
* イテレーション: イテレーション<2>.
* 比較: 比較<3>.
* 列挙型で許されるメンバーと属性::
* Enumのサブクラス化の制限::
* データクラスのサポート::
* Pickle 化::
* 関数 API: 関数 API<2>.
* 派生列挙型::
* When to use __new__() vs. __init__(): When to use __new__ vs __init__.
* EnumとFlagはどう違うのか？::
* Enum クックブック::
* EnumType のサブクラスを作る::


File: python.info,  Node: 列挙型メンバーおよびそれらの属性へのプログラム的アクセス,  Next: 列挙型メンバーと値の重複,  Up: 列挙型 HOWTO

9.6.1 列挙型メンバーおよびそれらの属性へのプログラム的アクセス
--------------------------------------------------------------

プログラム的にメンバーに番号でアクセスしたほうが便利な場合があります (す
なわち、プログラムを書いている時点で正確な色がまだわからなく、
‘Color.RED’ と書くのが無理な場合など)。 ‘Enum’ ではそのようなアクセスも
可能です:

     >>> Color(1)
     <Color.RED: 1>
     >>> Color(3)
     <Color.BLUE: 3>

列挙型メンバーに '名前' でアクセスしたい場合はアイテムとしてアクセスでき
ます:

     >>> Color['RED']
     <Color.RED: 1>
     >>> Color['GREEN']
     <Color.GREEN: 2>

If you have an enum member and need its ‘name’ or ‘value’:

     >>> member = Color.RED
     >>> member.name
     'RED'
     >>> member.value
     1


File: python.info,  Node: 列挙型メンバーと値の重複,  Next: 番号付けの値が一意であることの確認,  Prev: 列挙型メンバーおよびそれらの属性へのプログラム的アクセス,  Up: 列挙型 HOWTO

9.6.2 列挙型メンバーと値の重複
------------------------------

同じ名前の列挙型メンバーを複数持つことはできません:

     >>> class Shape(Enum):
     ...     SQUARE = 2
     ...     SQUARE = 3
     ...
     Traceback (most recent call last):
     ...
     TypeError: 'SQUARE' already defined as 2

しかし、列挙型メンバー は、別の名前を持つことができます。 同じ値を持つ
‘A’ と''B'' が与えられた場合（そして ‘A’ が先に定義されている場合）、
‘B’ はメンバー ‘A’ に対するエイリアスとなります。 ‘A’ の値での検索では、
メンバー ‘A’ が返されます。 ‘A’ の名前での検索ではメンバー ‘A’ を返しま
す。‘B’ の名前での検索も、メンバー ‘A’ を返します:

     >>> class Shape(Enum):
     ...     SQUARE = 2
     ...     DIAMOND = 1
     ...     CIRCLE = 3
     ...     ALIAS_FOR_SQUARE = 2
     ...
     >>> Shape.SQUARE
     <Shape.SQUARE: 2>
     >>> Shape.ALIAS_FOR_SQUARE
     <Shape.SQUARE: 2>
     >>> Shape(2)
     <Shape.SQUARE: 2>

     注釈: すでに定義されている属性と同じ名前のメンバー (一方がメンバー
     でもう一方がメソッド、など) の作成、あるいはメンバーと同じ名前の属
     性の作成はできません。


File: python.info,  Node: 番号付けの値が一意であることの確認,  Next: 値の自動設定を使う,  Prev: 列挙型メンバーと値の重複,  Up: 列挙型 HOWTO

9.6.3 番号付けの値が一意であることの確認
----------------------------------------

デフォルトでは、列挙型は同じ値のエイリアスとして複数の名前を許容します。
この振る舞いを望まない場合は、 *note unique(): 2a2c. デコレータを使用で
きます:

     >>> from enum import Enum, unique
     >>> @unique
     ... class Mistake(Enum):
     ...     ONE = 1
     ...     TWO = 2
     ...     THREE = 3
     ...     FOUR = 3
     ...
     Traceback (most recent call last):
     ...
     ValueError: duplicate values found in <enum 'Mistake'>: FOUR -> THREE


File: python.info,  Node: 値の自動設定を使う,  Next: イテレーション<2>,  Prev: 番号付けの値が一意であることの確認,  Up: 列挙型 HOWTO

9.6.4 値の自動設定を使う
------------------------

正確な値が重要でない場合、 *note auto: e9b. が使えます:

     >>> from enum import Enum, auto
     >>> class Color(Enum):
     ...     RED = auto()
     ...     BLUE = auto()
     ...     GREEN = auto()
     ...
     >>> [member.value for member in Color]
     [1, 2, 3]

The values are chosen by *note _generate_next_value_(): 2a40, which can
be overridden:

     >>> class AutoName(Enum):
     ...     @staticmethod
     ...     def _generate_next_value_(name, start, count, last_values):
     ...         return name
     ...
     >>> class Ordinal(AutoName):
     ...     NORTH = auto()
     ...     SOUTH = auto()
     ...     EAST = auto()
     ...     WEST = auto()
     ...
     >>> [member.value for member in Ordinal]
     ['NORTH', 'SOUTH', 'EAST', 'WEST']

     注釈: The *note _generate_next_value_(): 2a40. method must be
     defined before any members.


File: python.info,  Node: イテレーション<2>,  Next: 比較<3>,  Prev: 値の自動設定を使う,  Up: 列挙型 HOWTO

9.6.5 イテレーション
--------------------

列挙型のメンバーのイテレートは別名をサポートしていません:

     >>> list(Shape)
     [<Shape.SQUARE: 2>, <Shape.DIAMOND: 1>, <Shape.CIRCLE: 3>]
     >>> list(Weekday)
     [<Weekday.MONDAY: 1>, <Weekday.TUESDAY: 2>, <Weekday.WEDNESDAY: 4>, <Weekday.THURSDAY: 8>, <Weekday.FRIDAY: 16>, <Weekday.SATURDAY: 32>, <Weekday.SUNDAY: 64>]

エイリアスである ‘Shape.ALIAS_FOR_SQUARE’ と''Weekday.WEEKEND'' が表示さ
れていないことに注意してください。

特殊属性 ‘__members__’ は読み出し専用で、順序を保持した、対応する名前と
列挙型メンバーのマッピングです。これには別名も含め、列挙されたすべての名
前が入っています。

     >>> for name, member in Shape.__members__.items():
     ...     name, member
     ...
     ('SQUARE', <Shape.SQUARE: 2>)
     ('DIAMOND', <Shape.DIAMOND: 1>)
     ('CIRCLE', <Shape.CIRCLE: 3>)
     ('ALIAS_FOR_SQUARE', <Shape.SQUARE: 2>)

属性 ‘__members__’ は列挙型メンバーへの詳細なアクセスに使用できます。以
下はすべての別名を探す例です:

     >>> [name for name, member in Shape.__members__.items() if member.name != name]
     ['ALIAS_FOR_SQUARE']

     注釈: フラグのエイリアスには、 複数のフラグが設定された値（例えば
     ‘3’）や、 フラグが設定されていない値（例えば ‘0’）が含まれます。


File: python.info,  Node: 比較<3>,  Next: 列挙型で許されるメンバーと属性,  Prev: イテレーション<2>,  Up: 列挙型 HOWTO

9.6.6 比較
----------

列挙型メンバーは同一性を比較できます:

     >>> Color.RED is Color.RED
     True
     >>> Color.RED is Color.BLUE
     False
     >>> Color.RED is not Color.BLUE
     True

列挙型の値の順序の比較はサポートされて 'いません'。Enum メンバーは整数で
はありません (*note IntEnum: 56f9. を参照してください):

     >>> Color.RED < Color.BLUE
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: '<' not supported between instances of 'Color' and 'Color'

ただし等価の比較は定義されています:

     >>> Color.BLUE == Color.RED
     False
     >>> Color.BLUE != Color.RED
     True
     >>> Color.BLUE == Color.BLUE
     True

非列挙型の値との比較は常に不等となります (繰り返しになりますが、*note
IntEnum: edb. はこれと異なる挙動になるよう設計されています):

     >>> Color.BLUE == 2
     False

     警告: モジュールは再読み込みすることが可能です。再読み込みされたモ
     ジュールに列挙型が含まれている場合、それらは再作成され、新しいメン
     バーは元のメンバーと同一でない/等しくない可能性があります。


File: python.info,  Node: 列挙型で許されるメンバーと属性,  Next: Enumのサブクラス化の制限,  Prev: 比較<3>,  Up: 列挙型 HOWTO

9.6.7 列挙型で許されるメンバーと属性
------------------------------------

これまでのほとんどの例では、列挙型の値に整数を使用しています。 整数を使
うのは短くて便利（そして、 *note 関数 API: 56fb. ではデフォルトで設定さ
れる）ですが、これは強制されているわけではありません。大半の使用例では、
列挙値の実際の値が何であるかは意識しません。しかし、値が重要な場合、列挙
型は任意の値を持つことができます。

列挙型は Python のクラスであり、通常どおりメソッドや特殊メソッドを持つこ
とができます:

     >>> class Mood(Enum):
     ...     FUNKY = 1
     ...     HAPPY = 3
     ...
     ...     def describe(self):
     ...         # self is the member here
     ...         return self.name, self.value
     ...
     ...     def __str__(self):
     ...         return 'my custom str! {0}'.format(self.value)
     ...
     ...     @classmethod
     ...     def favorite_mood(cls):
     ...         # cls here is the enumeration
     ...         return cls.HAPPY
     ...

上記の結果が以下のようになります:

     >>> Mood.favorite_mood()
     <Mood.HAPPY: 3>
     >>> Mood.HAPPY.describe()
     ('HAPPY', 3)
     >>> str(Mood.FUNKY)
     'my custom str! 1'

The rules for what is allowed are as follows: names that start and end
with a single underscore are reserved by enum and cannot be used; all
other attributes defined within an enumeration will become members of
this enumeration, with the exception of special methods (*note
__str__(): 830, *note __add__(): 23dd, etc.), descriptors (methods are
also descriptors), and variable names listed in *note _ignore_: 2a3e.

Note: if your enumeration defines *note __new__(): 7a0. and/or *note
__init__(): 8bf, any value(s) given to the enum member will be passed
into those methods.  See *note Planet: 56fc. for an example.

     注釈: The *note __new__(): 7a0. method, if defined, is used during
     creation of the Enum members; it is then replaced by Enum's *note
     __new__(): 7a0. which is used after class creation for lookup of
     existing members.  See *note When to use __new__() vs.  __init__():
     56fd. for more details.


File: python.info,  Node: Enumのサブクラス化の制限,  Next: データクラスのサポート,  Prev: 列挙型で許されるメンバーと属性,  Up: 列挙型 HOWTO

9.6.8 Enumのサブクラス化の制限
------------------------------

新しい *note Enum: 842. クラスは、ベースの enum クラスを1つ、具象データ
型を1つ、複数の *note object: c7e. ベースのミックスインクラスが許容され
ます。これらのベースクラスの順序は次の通りです:

     class EnumName([mix-in, ...,] [data-type,] base-enum):
         pass

列挙型のサブクラスの作成はその列挙型にメンバーが一つも定義されていない場
合のみ行なえます。従って以下は許されません:

     >>> class MoreColor(Color):
     ...     PINK = 17
     ...
     Traceback (most recent call last):
     ...
     TypeError: <enum 'MoreColor'> cannot extend <enum 'Color'>

以下のような場合は許されます:

     >>> class Foo(Enum):
     ...     def some_behavior(self):
     ...         pass
     ...
     >>> class Bar(Foo):
     ...     HAPPY = 1
     ...     SAD = 2
     ...

メンバーが定義された列挙型のサブクラス化を許可すると、いくつかのデータ型
およびインスタンスの重要な不変条件の違反を引き起こします。とはいえ、それ
が許可されると、列挙型のグループ間での共通の挙動を共有するという利点もあ
ります。 (*note OrderedEnum: 56ff. の例を参照してください。)


File: python.info,  Node: データクラスのサポート,  Next: Pickle 化,  Prev: Enumのサブクラス化の制限,  Up: 列挙型 HOWTO

9.6.9 データクラスのサポート
----------------------------

*note dataclass: 4e1. を継承する場合、 *note __repr__(): 1afa. は継承す
るクラス名を省略します。 例えば:

     >>> from dataclasses import dataclass, field
     >>> @dataclass
     ... class CreatureDataMixin:
     ...     size: str
     ...     legs: int
     ...     tail: bool = field(repr=False, default=True)
     ...
     >>> class Creature(CreatureDataMixin, Enum):
     ...     BEETLE = 'small', 6
     ...     DOG = 'medium', 4
     ...
     >>> Creature.DOG
     <Creature.DOG: size='medium', legs=4>

標準の *note repr(): 1c1. を使うには、*note dataclass(): 4e1. の引数
‘repr=False’ を使用してください。

バージョン 3.12 で変更: dataclass のフィールドだけが値の領域に表示され、
dataclassの名前は表示されなくなりました

     注釈: *note Enum: 842. やそのサブクラスに *note dataclass(): 4e1. デ
     コレータを加えることはサポートされていません。そうしてもエラーは送
     出されませんが、実行時にそれぞれのメンバが互いに等しいなど、非常に
     奇妙な結果が起こります:

          >>> @dataclass               # don't do this: it does not make any sense
          ... class Color(Enum):
          ...    RED = 1
          ...    BLUE = 2
          ...
          >>> Color.RED is Color.BLUE
          False
          >>> Color.RED == Color.BLUE  # problem is here: they should not be equal
          True


File: python.info,  Node: Pickle 化,  Next: 関数 API<2>,  Prev: データクラスのサポート,  Up: 列挙型 HOWTO

9.6.10 Pickle 化
----------------

列挙型は pickle 化と unpickle 化が行えます:

     >>> from test.test_enum import Fruit
     >>> from pickle import dumps, loads
     >>> Fruit.TOMATO is loads(dumps(Fruit.TOMATO))
     True

通常の pickle 化の制限事項が適用されます: pickle 可能な列挙型はモジュー
ルのトップレベルで定義されていなくてはならず、unpickle 化はモジュールか
らインポート可能でなければなりません。

     注釈: pickle プロトコルバージョン 4 では他のクラスで入れ子になった
     列挙型の pickle 化も容易です。

It is possible to modify how enum members are pickled/unpickled by
defining *note __reduce_ex__(): 196b. in the enumeration class.  The
default method is by-value, but enums with complicated values may want
to use by-name:

     >>> import enum
     >>> class MyEnum(enum.Enum):
     ...     __reduce_ex__ = enum.pickle_by_enum_name

     注釈: フラグに名前による pickle 化を使うことは、名前の無いエイリア
     スが unpickle 化されないため推奨されません。


File: python.info,  Node: 関数 API<2>,  Next: 派生列挙型,  Prev: Pickle 化,  Up: 列挙型 HOWTO

9.6.11 関数 API
---------------

*note Enum: 842. クラスは呼び出し可能で、以下の関数 API を提供しています
:

     >>> Animal = Enum('Animal', 'ANT BEE CAT DOG')
     >>> Animal
     <enum 'Animal'>
     >>> Animal.ANT
     <Animal.ANT: 1>
     >>> list(Animal)
     [<Animal.ANT: 1>, <Animal.BEE: 2>, <Animal.CAT: 3>, <Animal.DOG: 4>]

この API の動作は *note namedtuple: 4e0. と似ています。*note Enum: 842.
呼び出しの第 1 引数は列挙型の名前です。

The second argument is the 'source' of enumeration member names.  It can
be a whitespace-separated string of names, a sequence of names, a
sequence of 2-tuples with key/value pairs, or a mapping (e.g.
dictionary) of names to values.  The last two options enable assigning
arbitrary values to enumerations; the others auto-assign increasing
integers starting with 1 (use the ‘start’ parameter to specify a
different starting value).  A new class derived from *note Enum: 842. is
returned.  In other words, the above assignment to ‘Animal’ is
equivalent to:

     >>> class Animal(Enum):
     ...     ANT = 1
     ...     BEE = 2
     ...     CAT = 3
     ...     DOG = 4
     ...

‘0’ ではなく''1'' をデフォルトの開始番号とする理由は、‘0’ が真偽値として
は ‘False’ であり、デフォルトの列挙メンバーはすべて ‘True’ 評価されるよ
うにするためである。

機能 API による Enum の pickle 化は、その列挙型がどのモジュールで作成さ
れたかを見つけ出すためにフレームスタックの実装の詳細が使われるので、トリ
ッキーになることがあります (例えば別のモジュールのユーティリティ関数を使
うと失敗しますし、IronPython や Jython ではうまくいきません)。解決策は、
以下のようにモジュール名を明示的に指定することです:

     >>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__)

     警告: ‘module’ が与えられない場合、Enum はそれがなにか決定できない
     ため、新しい Enum メンバーは unpickle 化できなくなります; エラーを
     ソースの近いところで発生させるため、pickle 化は無効になります。

The new pickle protocol 4 also, in some circumstances, relies on *note
__qualname__: 2373. being set to the location where pickle will be able
to find the class.  For example, if the class was made available in
class SomeData in the global scope:

     >>> Animal = Enum('Animal', 'ANT BEE CAT DOG', qualname='SomeData.Animal')

完全な構文は以下のようになります:

     Enum(
         value='NewEnumName',
         names=<...>,
         *,
         module='...',
         qualname='...',
         type=<mixed-in class>,
         start=1,
         )

   * 'value': What the new enum class will record as its name.

   * 'names': enumのメンバー。 空白またはカンマで区切られた文字列 (値は
     特に指定がない限り1から始まります):

          'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'

     または名前のイテレータで指定もできます:

          ['RED', 'GREEN', 'BLUE']

     または (名前, 値) のペアのイテレータでも指定できます:

          [('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]

     またはマッピングでも指定できます:

          {'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42}

   * 'module': 新しい enum クラスが属するモジュールの名前です。

   * 'qualname': 新しい enum クラスが属するモジュールの場所です。

   * 'type': 新しい列挙型クラスにミックスインする型。

   * 'start'：名前だけ渡された場合にカウントを開始する番号。

バージョン 3.5 で変更: 'start' 引数が追加されました。


File: python.info,  Node: 派生列挙型,  Next: When to use __new__ vs __init__,  Prev: 関数 API<2>,  Up: 列挙型 HOWTO

9.6.12 派生列挙型
-----------------

* Menu:

* IntEnum::
* StrEnum::
* IntFlag::
* Flag::
* その他: その他<6>.


File: python.info,  Node: IntEnum,  Next: StrEnum,  Up: 派生列挙型

9.6.12.1 IntEnum
................

提供されている 1 つ目の *note Enum: 842. の派生型であり、 *note int:
19b. のサブクラスでもあります。 *note IntEnum: edb. のメンバーは整数と比
較できます; さらに言うと、異なる整数列挙型どうしでも比較できます:

     >>> from enum import IntEnum
     >>> class Shape(IntEnum):
     ...     CIRCLE = 1
     ...     SQUARE = 2
     ...
     >>> class Request(IntEnum):
     ...     POST = 1
     ...     GET = 2
     ...
     >>> Shape == 1
     False
     >>> Shape.CIRCLE == 1
     True
     >>> Shape.CIRCLE == Request.POST
     True

ただし、これらも標準の *note Enum: 842. 列挙型とは比較できません:

     >>> class Shape(IntEnum):
     ...     CIRCLE = 1
     ...     SQUARE = 2
     ...
     >>> class Color(Enum):
     ...     RED = 1
     ...     GREEN = 2
     ...
     >>> Shape.CIRCLE == Color.RED
     False

*note IntEnum: edb. の値は他の用途では整数のように振る舞います:

     >>> int(Shape.CIRCLE)
     1
     >>> ['a', 'b', 'c'][Shape.CIRCLE]
     'b'
     >>> [i for i in range(Shape.SQUARE)]
     [0, 1]


File: python.info,  Node: StrEnum,  Next: IntFlag,  Prev: IntEnum,  Up: 派生列挙型

9.6.12.2 StrEnum
................

提供されている2つ目の *note Enum: 842. の派生型もまた、 *note str: 169.
のサブクラスでもあります。*note StrEnum: 82d. のメンバーは、文字列と比較
できます; さらに言うと、異なる文字列列挙型どうしでも比較できます。

Added in version 3.11.


File: python.info,  Node: IntFlag,  Next: Flag,  Prev: StrEnum,  Up: 派生列挙型

9.6.12.3 IntFlag
................

次の *note Enum: 842. の派生型 *note IntFlag: e9a. も、*note int: 19b. を
基底クラスとしています。 違いは、 *note IntFlag: e9a. のメンバーをビット
演算子 (&amp;, |, ^, ~) を使って組み合わせられ、その結果も *note
IntFlag: e9a. メンバーになることです。 *note IntEnum: edb. と同様、*note
IntFlag: e9a. のメンバーも整数であり、*note int: 19b. が使用されるところ
であればどこでも使えます。

     注釈: *note IntFlag: e9a. メンバーに対してビット演算以外のどんな演
     算をしても、その結果は *note IntFlag: e9a. メンバーではなくなります
     。

     ビット単位演算の結果が *note IntFlag: e9a. として不正な値な値の場合
     、値は *note IntFlag: e9a. メンバーではなくなります。 詳しくは
     *note FlagBoundary: 836. を参照してください。

Added in version 3.6.

バージョン 3.11 で変更.

*note IntFlag: e9a. クラスの例:

     >>> from enum import IntFlag
     >>> class Perm(IntFlag):
     ...     R = 4
     ...     W = 2
     ...     X = 1
     ...
     >>> Perm.R | Perm.W
     <Perm.R|W: 6>
     >>> Perm.R + Perm.W
     6
     >>> RW = Perm.R | Perm.W
     >>> Perm.R in RW
     True

組み合わせにも名前を付けられます:

     >>> class Perm(IntFlag):
     ...     R = 4
     ...     W = 2
     ...     X = 1
     ...     RWX = 7
     ...
     >>> Perm.RWX
     <Perm.RWX: 7>
     >>> ~Perm.RWX
     <Perm: 0>
     >>> Perm(7)
     <Perm.RWX: 7>

     注釈: 組み合わせに名前をつけたものはエイリアスとみなされます。エイ
     リアスはイテレーション中には表示されませんが、値による検索では返却
     されます。

バージョン 3.11 で変更.

*note IntFlag: e9a. と *note Enum: 842. のもう 1 つの重要な違いは、フラ
グが設定されていない (値が0である) 場合、その真偽値としての評価は *note
False: d2b. になることです:

     >>> Perm.R & Perm.X
     <Perm: 0>
     >>> bool(Perm.R & Perm.X)
     False

*note IntFlag: e9a. メンバーも *note int: 19b. のサブクラスであるため、
それらと組み合わせることができます（ただし、 *note IntFlag: e9a. 型では
なくなる可能性があります）:

     >>> Perm.X | 4
     <Perm.R|X: 5>

     >>> Perm.X + 8
     9

     注釈: 否定の演算子 ‘~’ は、常に正の値を持つ *note IntFlag: e9a. メ
     ンバー を返す:

          >>> (~Perm.X).value == (Perm.R|Perm.W).value == 6
          True

*note IntFlag: e9a. メンバーは反復処理することもできます:

     >>> list(RW)
     [<Perm.R: 4>, <Perm.W: 2>]

Added in version 3.11.


File: python.info,  Node: Flag,  Next: その他<6>,  Prev: IntFlag,  Up: 派生列挙型

9.6.12.4 Flag
.............

最後の派生型は *note Flag: 835. です。 *note IntFlag: e9a. と同様に、
*note Flag: 835. メンバーもビット演算子 (&, |, ^, ~) を使って組み合わせ
られます。 しかし *note IntFlag: e9a. とは違い、他のどの *note Flag:
835. 列挙型とも *note int: 19b. とも組み合わせたり、比較したりできません
。 値を直接指定することも可能ですが、値として *note auto: e9b. を使い、
*note Flag: 835. に適切な値を選ばせることが推奨されています。

Added in version 3.6.

*note IntFlag: e9a. と同様に、 *note Flag: 835. メンバーの組み合わせがど
のフラグも設定されていない状態になった場合、その真偽値としての評価は
*note False: d2b. となります:

     >>> from enum import Flag, auto
     >>> class Color(Flag):
     ...     RED = auto()
     ...     BLUE = auto()
     ...     GREEN = auto()
     ...
     >>> Color.RED & Color.GREEN
     <Color: 0>
     >>> bool(Color.RED & Color.GREEN)
     False

個別のフラグは 2 のべき乗 (1, 2, 4, 8, ...)  の値を持つべきですが、フラ
グの組み合わせはそうはなりません:

     >>> class Color(Flag):
     ...     RED = auto()
     ...     BLUE = auto()
     ...     GREEN = auto()
     ...     WHITE = RED | BLUE | GREEN
     ...
     >>> Color.WHITE
     <Color.WHITE: 7>

"フラグが設定されていない" 状態に名前を付けても、その真偽値は変わりませ
ん:

     >>> class Color(Flag):
     ...     BLACK = 0
     ...     RED = auto()
     ...     BLUE = auto()
     ...     GREEN = auto()
     ...
     >>> Color.BLACK
     <Color.BLACK: 0>
     >>> bool(Color.BLACK)
     False

*note Flag: 835. メンバーは反復処理することもできます:

     >>> purple = Color.RED | Color.BLUE
     >>> list(purple)
     [<Color.RED: 1>, <Color.BLUE: 2>]

Added in version 3.11.

     注釈: ほとんどの新しいコードでは、 *note Enum: 842. と *note Flag:
     835. が強く推奨されます。 というのは、 *note IntEnum: edb. と *note
     IntFlag: e9a. は (整数と比較でき、従って推移的に他の無関係な列挙型
     と比較できてしまうことにより) 列挙型の意味論的な約束に反するからで
     す。 *note IntEnum: edb. と *note IntFlag: e9a. は、 *note Enum:
     842. や *note Flag: 835. では上手くいかない場合のみに使うべきです;
     例えば、整数定数を列挙型で置き換えるときや、他のシステムとの相互運
     用性を持たせたいときです。


File: python.info,  Node: その他<6>,  Prev: Flag,  Up: 派生列挙型

9.6.12.5 その他
...............

*note IntEnum: edb. は *note enum: 5a. モジュールの一部ですが、単独での
実装もとても簡単に行なえます:

     class IntEnum(int, ReprEnum):   # or Enum instead of ReprEnum
         pass

This demonstrates how similar derived enumerations can be defined; for
example a ‘FloatEnum’ that mixes in *note float: 196. instead of *note
int: 19b.

いくつかのルール:

  1. *note Enum: 842. のサブクラスを作成するとき、複合させるデータ型は、
     基底クラスの並びで *note Enum: 842. クラス自身より先に記述しなけれ
     ばなりません (上記 *note IntEnum: edb. の例を参照)。

  2. 複合させる型はサブクラス化可能でなければいけません。例えば、 *note
     bool: 3c3. と *note range: b3d. はサブクラス化できないため、複合さ
     せるとEnum作成時にエラーが発生します。

  3. *note Enum: 842. のメンバーはどんなデータ型でも構いませんが、追加の
     データ型 (例えば、上の例の *note int: 19b.) と複合させてしまうと、
     すべてのメンバーの値はそのデータ型でなければならなくなります。この
     制限は、メソッドの追加するだけの、他のデータ型を指定しない複合には
     適用されません。

  4. When another data type is mixed in, the *note value: 2a39.
     attribute is 'not the same' as the enum member itself, although it
     is equivalent and will compare equal.

  5. A ‘data type’ is a mixin that defines *note __new__(): 7a0, or a
     *note dataclass: 4e1.

  6. %-style formatting: ‘%s’ and ‘%r’ call the *note Enum: 842. class's
     *note __str__(): 830. and *note __repr__(): 82f. respectively;
     other codes (such as ‘%i’ or ‘%h’ for IntEnum) treat the enum
     member as its mixed-in type.

  7. *note Formatted string literals: 19a, *note str.format(): 833, and
     *note format(): 199. will use the enum's *note __str__(): 830.
     method.

     注釈: Because *note IntEnum: edb, *note IntFlag: e9a, and *note
     StrEnum: 82d. are designed to be drop-in replacements for existing
     constants, their *note __str__(): 830. method has been reset to
     their data types' *note __str__(): 830. method.


File: python.info,  Node: When to use __new__ vs __init__,  Next: EnumとFlagはどう違うのか？,  Prev: 派生列挙型,  Up: 列挙型 HOWTO

9.6.13 When to use ‘__new__()’ vs. ‘__init__()’
-----------------------------------------------

*note __new__(): 7a0. must be used whenever you want to customize the
actual value of the *note Enum: 842. member.  Any other modifications
may go in either *note __new__(): 7a0. or *note __init__(): 8bf, with
*note __init__(): 8bf. being preferred.

例えば、複数の値をコンストラクタに渡すが、その中の1つだけを値として使い
たい場合は次のようにします:

     >>> class Coordinate(bytes, Enum):
     ...     """
     ...     Coordinate with binary codes that can be indexed by the int code.
     ...     """
     ...     def __new__(cls, value, label, unit):
     ...         obj = bytes.__new__(cls, [value])
     ...         obj._value_ = value
     ...         obj.label = label
     ...         obj.unit = unit
     ...         return obj
     ...     PX = (0, 'P.X', 'km')
     ...     PY = (1, 'P.Y', 'km')
     ...     VX = (2, 'V.X', 'km/s')
     ...     VY = (3, 'V.Y', 'km/s')
     ...

     >>> print(Coordinate['PY'])
     Coordinate.PY

     >>> print(Coordinate(3))
     Coordinate.VY

     警告: 'Do not' call ‘super().__new__()’, as the lookup-only
     ‘__new__’ is the one that is found; instead, use the data type
     directly.

* Menu:

* 細かい点::


File: python.info,  Node: 細かい点,  Up: When to use __new__ vs __init__

9.6.13.1 細かい点
.................

* Menu:

* __dunder__ 名のサポート: __dunder__ 名のサポート<2>.
* _sunder_ 名のサポート: _sunder_ 名のサポート<2>.
* _Private__names::
* Enum メンバー型::
* Creating members that are mixed with other data types::
* Enum クラスとメンバーの真偽値::
* メソッド付きの Enum クラス::
* Flag のメンバーの組み合わせ::
* Flag and IntFlag minutia::


File: python.info,  Node: __dunder__ 名のサポート<2>,  Next: _sunder_ 名のサポート<2>,  Up: 細かい点

9.6.13.2 ‘__dunder__’ 名のサポート
..................................

*note __members__: 2a36. is a read-only ordered mapping of
‘member_name’:‘member’ items.  It is only available on the class.

*note __new__(): 7a0, if specified, must create and return the enum
members; it is also a very good idea to set the member's *note _value_:
2a3c. appropriately.  Once all the members are created it is no longer
used.


File: python.info,  Node: _sunder_ 名のサポート<2>,  Next: _Private__names,  Prev: __dunder__ 名のサポート<2>,  Up: 細かい点

9.6.13.3 ‘_sunder_’ 名のサポート
................................

   - *note _name_: 2a3b. - メンバー名

   - *note _value_: 2a3c. - メンバーの値; ‘__new__’ で設定できます

   - *note _missing_(): 2a43. - 値が見付からなかったときに使われる検索関
     数; オーバーライドされていることがあります

   - *note _ignore_: 2a3e. - 名前のリストで、 *note list: 24d. もしくは
     *note str: 169. です。この名前の要素はメンバーへの変換が行われず、
     最終的なクラスから削除されます。

   - *note _generate_next_value_(): 2a40. - 列挙型のメンバーの適切な値を
     取得するのに使われます。オーバーライドされます。

   - *note _add_alias_(): 2a44. - adds a new name as an alias to an
     existing member.

   - *note _add_value_alias_(): 2a45. - adds a new value as an alias to
     an existing member.  See *note MultiValueEnum: 570b. for an
     example.

          注釈: 標準の *note Enum: 842. クラスの場合、次の値として選択さ
          れるのは、定義された最大の値に1を加えたものです。

          *note Flag: 835. クラスでは、次に選ばれる値は、次の最大の2のべ
          き乗となります。

     バージョン 3.13 で変更: 以前のバージョンでは最大の値ではなく最後に
     定義された値を使っていました。

Added in version 3.6: ‘_missing_’, ‘_order_’, ‘_generate_next_value_’

Added in version 3.7: ‘_ignore_’

Added in version 3.13: ‘_add_alias_’, ‘_add_value_alias_’

To help keep Python 2 / Python 3 code in sync an *note _order_: 2a3d.
attribute can be provided.  It will be checked against the actual order
of the enumeration and raise an error if the two do not match:

     >>> class Color(Enum):
     ...     _order_ = 'RED GREEN BLUE'
     ...     RED = 1
     ...     BLUE = 3
     ...     GREEN = 2
     ...
     Traceback (most recent call last):
     ...
     TypeError: member order does not match _order_:
       ['RED', 'BLUE', 'GREEN']
       ['RED', 'GREEN', 'BLUE']

     注釈: In Python 2 code the *note _order_: 2a3d. attribute is
     necessary as definition order is lost before it can be recorded.


File: python.info,  Node: _Private__names,  Next: Enum メンバー型,  Prev: _sunder_ 名のサポート<2>,  Up: 細かい点

9.6.13.4 _Private__names
........................

*note Private names: 20a3. は列挙型メンバーには変換されず、通常の属性と
なります。

バージョン 3.11 で変更.


File: python.info,  Node: Enum メンバー型,  Next: Creating members that are mixed with other data types,  Prev: _Private__names,  Up: 細かい点

9.6.13.5 ‘Enum’ メンバー型
..........................

列挙型メンバーはその列挙型クラスのインスタンスであり、通常は
‘EnumClass.member’ としてアクセスされます。 振る舞い メンバー しかし、メ
ンバー の名前と、属性/methodsが混在しているクラスとの名前の衝突を避ける
ために、大文字の名前を使うことを強く推奨します。

バージョン 3.5 で変更.


File: python.info,  Node: Creating members that are mixed with other data types,  Next: Enum クラスとメンバーの真偽値,  Prev: Enum メンバー型,  Up: 細かい点

9.6.13.6 Creating members that are mixed with other data types
..............................................................

When subclassing other data types, such as *note int: 19b. or *note str:
169, with an *note Enum: 842, all values after the ‘=’ are passed to
that data type's constructor.  For example:

     >>> class MyEnum(IntEnum):      # help(int) -> int(x, base=10) -> integer
     ...     example = '11', 16      # so x='11' and base=16
     ...
     >>> MyEnum.example.value        # and hex(11) is...
     17


File: python.info,  Node: Enum クラスとメンバーの真偽値,  Next: メソッド付きの Enum クラス,  Prev: Creating members that are mixed with other data types,  Up: 細かい点

9.6.13.7 ‘Enum’ クラスとメンバーの真偽値
........................................

(*note int: 19b, *note str: 169. などのような) 非 *note Enum: 842. 型と
複合させた enum クラスは、その複合された型の規則に従って評価されます; そ
うでない場合は、全てのメンバーは *note True: e07. と評価されます。 メン
バーの値に依存する独自の enum の真偽値評価を行うには、クラスに次のコード
を追加してください:

     def __bool__(self):
         return bool(self.value)

プレーンな *note Enum: 842. クラスは *note True: e07. として評価されます
。


File: python.info,  Node: メソッド付きの Enum クラス,  Next: Flag のメンバーの組み合わせ,  Prev: Enum クラスとメンバーの真偽値,  Up: 細かい点

9.6.13.8 メソッド付きの ‘Enum’ クラス
.....................................

enum サブクラスに追加のメソッドを与えた場合、後述の *note Planet: 56fc.
クラスのように、そのメソッドはメンバーの *note dir(): 844. に表示されま
すが、クラスの *note dir(): 844. には表示されません:

     >>> dir(Planet)
     ['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', 'VENUS', '__class__', '__doc__', '__members__', '__module__']
     >>> dir(Planet.EARTH)
     ['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', 'surface_gravity', 'value']


File: python.info,  Node: Flag のメンバーの組み合わせ,  Next: Flag and IntFlag minutia,  Prev: メソッド付きの Enum クラス,  Up: 細かい点

9.6.13.9 ‘Flag’ のメンバーの組み合わせ
......................................

Iterating over a combination of *note Flag: 835. members will only
return the members that are comprised of a single bit:

     >>> class Color(Flag):
     ...     RED = auto()
     ...     GREEN = auto()
     ...     BLUE = auto()
     ...     MAGENTA = RED | BLUE
     ...     YELLOW = RED | GREEN
     ...     CYAN = GREEN | BLUE
     ...
     >>> Color(3)  # named combination
     <Color.YELLOW: 3>
     >>> Color(7)      # not named combination
     <Color.RED|GREEN|BLUE: 7>


File: python.info,  Node: Flag and IntFlag minutia,  Prev: Flag のメンバーの組み合わせ,  Up: 細かい点

9.6.13.10 ‘Flag’ and ‘IntFlag’ minutia
......................................

例として以下のスニペットを使用します:

     >>> class Color(IntFlag):
     ...     BLACK = 0
     ...     RED = 1
     ...     GREEN = 2
     ...     BLUE = 4
     ...     PURPLE = RED | BLUE
     ...     WHITE = RED | GREEN | BLUE
     ...

the following are true:

   - 単一ビットのフラグは正規形です

   - 複数ビットや0ビットのフラグはエイリアスです

   - 反復処理では正規形のフラグのみ返却されます:

          >>> list(Color.WHITE)
          [<Color.RED: 1>, <Color.GREEN: 2>, <Color.BLUE: 4>]

   - negating a flag or flag set returns a new flag/flag set with the
     corresponding positive integer value:

          >>> Color.BLUE
          <Color.BLUE: 4>

          >>> ~Color.BLUE
          <Color.RED|GREEN: 3>

   - 名前のないフラグについては、そのメンバーの名前から名前が生成されま
     す:

          >>> (Color.RED | Color.GREEN).name
          'RED|GREEN'

          >>> class Perm(IntFlag):
          ...     R = 4
          ...     W = 2
          ...     X = 1
          ...
          >>> (Perm.R & Perm.W).name is None  # effectively Perm(0)
          True

   - multi-bit flags, aka aliases, can be returned from operations:

          >>> Color.RED | Color.BLUE
          <Color.PURPLE: 5>

          >>> Color(7)  # or Color(-1)
          <Color.WHITE: 7>

          >>> Color(0)
          <Color.BLACK: 0>

   - メンバーシップ/包含 のチェックでは、値が0のフラグは常に含まれるもの
     として扱われます:

          >>> Color.BLACK in Color.WHITE
          True

     それ以外では、一方のフラグの全ビットが他方のフラグに含まれる場合の
     み、Trueが返されます:

          >>> Color.PURPLE in Color.WHITE
          True

          >>> Color.GREEN in Color.PURPLE
          False

There is a new boundary mechanism that controls how out-of-range /
invalid bits are handled: ‘STRICT’, ‘CONFORM’, ‘EJECT’, and ‘KEEP’:

   * STRICT -> 無効な値が指定された場合に例外を発生させる

   * CONFORM -> 無効なビットを破棄する

   * EJECT -> フラグのステータスを失い、指定された値を持つ通常の int と
     なります。

   * KEEP -> keep the extra bits

        - keeps Flag status and extra bits

        - extra bits do not show up in iteration

        - extra bits do show up in repr() and str()

The default for Flag is ‘STRICT’, the default for ‘IntFlag’ is ‘EJECT’,
and the default for ‘_convert_’ is ‘KEEP’ (see ‘ssl.Options’ for an
example of when ‘KEEP’ is needed).


File: python.info,  Node: EnumとFlagはどう違うのか？,  Next: Enum クックブック,  Prev: When to use __new__ vs __init__,  Up: 列挙型 HOWTO

9.6.14 EnumとFlagはどう違うのか？
---------------------------------

Enum は *note Enum: 842. 派生クラスやそれらのインスタンス (メンバー) 双
方の多くの側面に影響を及ぼすカスタムメタクラスを持っています。

* Menu:

* Enum クラス::
* Flag クラス::
* Enum メンバー (インスタンス): Enum メンバー インスタンス.
* Flag メンバー::


File: python.info,  Node: Enum クラス,  Next: Flag クラス,  Up: EnumとFlagはどう違うのか？

9.6.14.1 Enum クラス
....................

The *note EnumType: 4f7. metaclass is responsible for providing the
*note __contains__(): 15d3, *note __dir__(): 17e2, *note __iter__():
e69. and other methods that allow one to do things with an *note Enum:
842. class that fail on a typical class, such as ‘list(Color)’ or
‘some_enum_var in Color’.  *note EnumType: 4f7. is responsible for
ensuring that various other methods on the final *note Enum: 842. class
are correct (such as *note __new__(): 7a0, *note __getnewargs__(): fd4,
*note __str__(): 830. and *note __repr__(): 82f.).


File: python.info,  Node: Flag クラス,  Next: Enum メンバー インスタンス,  Prev: Enum クラス,  Up: EnumとFlagはどう違うのか？

9.6.14.2 Flag クラス
....................

Flags have an expanded view of aliasing: to be canonical, the value of a
flag needs to be a power-of-two value, and not a duplicate name.  So, in
addition to the *note Enum: 842. definition of alias, a flag with no
value (a.k.a.  ‘0’) or with more than one power-of-two value (e.g.  ‘3’)
is considered an alias.


File: python.info,  Node: Enum メンバー インスタンス,  Next: Flag メンバー,  Prev: Flag クラス,  Up: EnumとFlagはどう違うのか？

9.6.14.3 Enum メンバー (インスタンス)
.....................................

The most interesting thing about enum members is that they are
singletons.  *note EnumType: 4f7. creates them all while it is creating
the enum class itself, and then puts a custom *note __new__(): 7a0. in
place to ensure that no new ones are ever instantiated by returning only
the existing member instances.


File: python.info,  Node: Flag メンバー,  Prev: Enum メンバー インスタンス,  Up: EnumとFlagはどう違うのか？

9.6.14.4 Flag メンバー
......................

フラグのメンバーは、*note Flag: 835. クラスと同様に反復処理することがで
き、正規のメンバーのみが返されます。 例えば:

     >>> list(Color)
     [<Color.RED: 1>, <Color.GREEN: 2>, <Color.BLUE: 4>]

（‘BLACK’ 、 ‘PURPLE’ 、 ‘WHITE’ は表示されないことに注意。）

フラグのメンバーを反転させると、負の値ではなく、対応する正の値が返されま
す:

     >>> ~Color.RED
     <Color.GREEN|BLUE: 6>

フラグのメンバーは、それが含む2のべき乗の値の数に対応するlengthを持ちま
す。 例えば:

     >>> len(Color.PURPLE)
     2


File: python.info,  Node: Enum クックブック,  Next: EnumType のサブクラスを作る,  Prev: EnumとFlagはどう違うのか？,  Up: 列挙型 HOWTO

9.6.15 Enum クックブック
------------------------

*note Enum: 842, *note IntEnum: edb, *note StrEnum: 82d, *note Flag:
835, *note IntFlag: e9a. は用途の大部分をカバーすると予想されますが、そ
のすべてをカバーできているわけではありません。ここでは、そのまま、あるい
は独自の列挙型を作る例として使える、様々なタイプの列挙型を紹介します。

* Menu:

* 値の省略::
* OrderedEnum::
* DuplicateFreeEnum::
* MultiValueEnum::
* Planet::
* TimePeriod::


File: python.info,  Node: 値の省略,  Next: OrderedEnum,  Up: Enum クックブック

9.6.15.1 値の省略
.................

多くの用途では、列挙型の実際の値が何かは気にされません。 このタイプの単
純な列挙型を定義する方法はいくつかあります:

   - 値に *note auto: e9b. インスタンスを使用する

   - 値として *note object: c7e. インスタンスを使用する

   - 値として解説文字列を使用する

   - use a tuple as the value and a custom *note __new__(): 7a0. to
     replace the tuple with an *note int: 19b. value

これらのどの方法を使ってもユーザーに対して、値は重要ではなく、他のメンバ
ーの番号の振り直しをする必要無しに、メンバーの追加、削除、並べ替えが行え
るということを示せます。

* Menu:

* auto を使う::
* object を使う::
* 解説文字列を使う::
* Using a custom __new__(): Using a custom __new__.


File: python.info,  Node: auto を使う,  Next: object を使う,  Up: 値の省略

9.6.15.2 ‘auto’ を使う
......................

*note auto: e9b. を使うと次のようになります:

     >>> class Color(Enum):
     ...     RED = auto()
     ...     BLUE = auto()
     ...     GREEN = auto()
     ...
     >>> Color.GREEN
     <Color.GREEN: 3>


File: python.info,  Node: object を使う,  Next: 解説文字列を使う,  Prev: auto を使う,  Up: 値の省略

9.6.15.3 ‘object’ を使う
........................

*note object: c7e. を使うと次のようになります:

     >>> class Color(Enum):
     ...     RED = object()
     ...     GREEN = object()
     ...     BLUE = object()
     ...
     >>> Color.GREEN
     <Color.GREEN: <object object at 0x...>>

This is also a good example of why you might want to write your own
*note __repr__(): 82f.:

     >>> class Color(Enum):
     ...     RED = object()
     ...     GREEN = object()
     ...     BLUE = object()
     ...     def __repr__(self):
     ...         return "<%s.%s>" % (self.__class__.__name__, self._name_)
     ...
     >>> Color.GREEN
     <Color.GREEN>


File: python.info,  Node: 解説文字列を使う,  Next: Using a custom __new__,  Prev: object を使う,  Up: 値の省略

9.6.15.4 解説文字列を使う
.........................

値として文字列を使うと次のようになります:

     >>> class Color(Enum):
     ...     RED = 'stop'
     ...     GREEN = 'go'
     ...     BLUE = 'too fast!'
     ...
     >>> Color.GREEN
     <Color.GREEN: 'go'>


File: python.info,  Node: Using a custom __new__,  Prev: 解説文字列を使う,  Up: 値の省略

9.6.15.5 Using a custom ‘__new__()’
...................................

Using an auto-numbering *note __new__(): 7a0. would look like:

     >>> class AutoNumber(Enum):
     ...     def __new__(cls):
     ...         value = len(cls.__members__) + 1
     ...         obj = object.__new__(cls)
     ...         obj._value_ = value
     ...         return obj
     ...
     >>> class Color(AutoNumber):
     ...     RED = ()
     ...     GREEN = ()
     ...     BLUE = ()
     ...
     >>> Color.GREEN
     <Color.GREEN: 2>

‘AutoNumber’ をより広い用途で使うには、シグニチャに ‘*args’ を追加します
:

     >>> class AutoNumber(Enum):
     ...     def __new__(cls, *args):      # this is the only change from above
     ...         value = len(cls.__members__) + 1
     ...         obj = object.__new__(cls)
     ...         obj._value_ = value
     ...         return obj
     ...

‘AutoNumber’ を継承すると、追加の引数を取り扱える独自の ‘__init__’ が書
けます。

     >>> class Swatch(AutoNumber):
     ...     def __init__(self, pantone='unknown'):
     ...         self.pantone = pantone
     ...     AUBURN = '3497'
     ...     SEA_GREEN = '1246'
     ...     BLEACHED_CORAL = () # New color, no Pantone code yet!
     ...
     >>> Swatch.SEA_GREEN
     <Swatch.SEA_GREEN: 2>
     >>> Swatch.SEA_GREEN.pantone
     '1246'
     >>> Swatch.BLEACHED_CORAL.pantone
     'unknown'

     注釈: The *note __new__(): 7a0. method, if defined, is used during
     creation of the Enum members; it is then replaced by Enum's *note
     __new__(): 7a0. which is used after class creation for lookup of
     existing members.

     警告: 'Do not' call ‘super().__new__()’, as the lookup-only
     ‘__new__’ is the one that is found; instead, use the data type
     directly - e.g.:

          obj = int.__new__(cls, value)


File: python.info,  Node: OrderedEnum,  Next: DuplicateFreeEnum,  Prev: 値の省略,  Up: Enum クックブック

9.6.15.6 OrderedEnum
....................

*note IntEnum: edb. をベースとしないため、通常の *note Enum: 842. の不変
条件 (他の列挙型と比較できないなど) のままで、メンバーを順序付けできる列
挙型です:

     >>> class OrderedEnum(Enum):
     ...     def __ge__(self, other):
     ...         if self.__class__ is other.__class__:
     ...             return self.value >= other.value
     ...         return NotImplemented
     ...     def __gt__(self, other):
     ...         if self.__class__ is other.__class__:
     ...             return self.value > other.value
     ...         return NotImplemented
     ...     def __le__(self, other):
     ...         if self.__class__ is other.__class__:
     ...             return self.value <= other.value
     ...         return NotImplemented
     ...     def __lt__(self, other):
     ...         if self.__class__ is other.__class__:
     ...             return self.value < other.value
     ...         return NotImplemented
     ...
     >>> class Grade(OrderedEnum):
     ...     A = 5
     ...     B = 4
     ...     C = 3
     ...     D = 2
     ...     F = 1
     ...
     >>> Grade.C < Grade.A
     True


File: python.info,  Node: DuplicateFreeEnum,  Next: MultiValueEnum,  Prev: OrderedEnum,  Up: Enum クックブック

9.6.15.7 DuplicateFreeEnum
..........................

値が重複するメンバーがある場合に、エイリアスを作成するのではなくエラーを
発生させます:

     >>> class DuplicateFreeEnum(Enum):
     ...     def __init__(self, *args):
     ...         cls = self.__class__
     ...         if any(self.value == e.value for e in cls):
     ...             a = self.name
     ...             e = cls(self.value).name
     ...             raise ValueError(
     ...                 "aliases not allowed in DuplicateFreeEnum:  %r --> %r"
     ...                 % (a, e))
     ...
     >>> class Color(DuplicateFreeEnum):
     ...     RED = 1
     ...     GREEN = 2
     ...     BLUE = 3
     ...     GRENE = 2
     ...
     Traceback (most recent call last):
       ...
     ValueError: aliases not allowed in DuplicateFreeEnum:  'GRENE' --> 'GREEN'

     注釈: これは Enum に別名を無効にするのと同様な振る舞いの追加や変更
     をおこなうためのサブクラス化に役立つ例です。単に別名を無効にしたい
     だけなら、 *note unique(): 2a2c. デコレーターを使用して行えます。


File: python.info,  Node: MultiValueEnum,  Next: Planet,  Prev: DuplicateFreeEnum,  Up: Enum クックブック

9.6.15.8 MultiValueEnum
.......................

Supports having more than one value per member:

     >>> class MultiValueEnum(Enum):
     ...     def __new__(cls, value, *values):
     ...         self = object.__new__(cls)
     ...         self._value_ = value
     ...         for v in values:
     ...             self._add_value_alias_(v)
     ...         return self
     ...
     >>> class DType(MultiValueEnum):
     ...     float32 = 'f', 8
     ...     double64 = 'd', 9
     ...
     >>> DType('f')
     <DType.float32: 'f'>
     >>> DType(9)
     <DType.double64: 'd'>


File: python.info,  Node: Planet,  Next: TimePeriod,  Prev: MultiValueEnum,  Up: Enum クックブック

9.6.15.9 Planet
...............

If *note __new__(): 7a0. or *note __init__(): 8bf. is defined, the value
of the enum member will be passed to those methods:

     >>> class Planet(Enum):
     ...     MERCURY = (3.303e+23, 2.4397e6)
     ...     VENUS   = (4.869e+24, 6.0518e6)
     ...     EARTH   = (5.976e+24, 6.37814e6)
     ...     MARS    = (6.421e+23, 3.3972e6)
     ...     JUPITER = (1.9e+27,   7.1492e7)
     ...     SATURN  = (5.688e+26, 6.0268e7)
     ...     URANUS  = (8.686e+25, 2.5559e7)
     ...     NEPTUNE = (1.024e+26, 2.4746e7)
     ...     def __init__(self, mass, radius):
     ...         self.mass = mass       # in kilograms
     ...         self.radius = radius   # in meters
     ...     @property
     ...     def surface_gravity(self):
     ...         # universal gravitational constant  (m3 kg-1 s-2)
     ...         G = 6.67300E-11
     ...         return G * self.mass / (self.radius * self.radius)
     ...
     >>> Planet.EARTH.value
     (5.976e+24, 6378140.0)
     >>> Planet.EARTH.surface_gravity
     9.802652743337129


File: python.info,  Node: TimePeriod,  Prev: Planet,  Up: Enum クックブック

9.6.15.10 TimePeriod
....................

An example to show the *note _ignore_: 2a3e. attribute in use:

     >>> from datetime import timedelta
     >>> class Period(timedelta, Enum):
     ...     "different lengths of time"
     ...     _ignore_ = 'Period i'
     ...     Period = vars()
     ...     for i in range(367):
     ...         Period['day_%d' % i] = i
     ...
     >>> list(Period)[:2]
     [<Period.day_0: datetime.timedelta(0)>, <Period.day_1: datetime.timedelta(days=1)>]
     >>> list(Period)[-2:]
     [<Period.day_365: datetime.timedelta(days=365)>, <Period.day_366: datetime.timedelta(days=366)>]


File: python.info,  Node: EnumType のサブクラスを作る,  Prev: Enum クックブック,  Up: 列挙型 HOWTO

9.6.16 EnumType のサブクラスを作る
----------------------------------

While most enum needs can be met by customizing *note Enum: 842.
subclasses, either with class decorators or custom functions, *note
EnumType: 4f7. can be subclassed to provide a different Enum experience.


File: python.info,  Node: 関数型プログラミング HOWTO,  Next: Logging HOWTO,  Prev: 列挙型 HOWTO,  Up: Python HOWTO

9.7 関数型プログラミング HOWTO
==============================


著者: A. M. Kuchling


リリース: 0.32

この文書では、関数型スタイルでプログラムを実装するのにピッタリな Python
の機能を見てまわることにしましょう。まず関数型プログラミングという概念を
紹介したあと、 *note iterator: 4c8. や *note generator: 126c. のような言
語機能、および *note itertools: 85. や *note functools: 63. といった関連
するライブラリモジュールを見ることにします。

* Menu:

* はじめに: はじめに<15>.
* イテレータ (iterator): イテレータ iterator<2>.
* ジェネレータ式とリスト内包表記::
* ジェネレータ (generator): ジェネレータ generator<2>.
* 組み込み関数 (built-in function): 組み込み関数 built-in function<2>.
* itertools モジュール::
* functools モジュール::
* 小さな関数とラムダ式::
* 更新履歴と謝辞::
* 参考資料: 参考資料<2>.


File: python.info,  Node: はじめに<15>,  Next: イテレータ iterator<2>,  Up: 関数型プログラミング HOWTO

9.7.1 はじめに
--------------

この章は関数型プログラミングの基本概念を説明します; Python の言語機能に
ついてだけ知りたい人は、次の章の *note イテレータ (iterator): 5726. まで
飛ばしてください。

プログラミング言語とは問題を分解するものですが、各言語がサポートする分解
方法にはいくつかの種類があります:

   * ほとんどのプログラミング言語は '手続き型' です: プログラムは、入力
     に対して行うべきことをコンピュータに教える指示リストとなります。 C,
     Pascal, さらには Unix シェルまでもが手続き型言語に入ります。

   * '宣言型' 言語で書くのは、解くべき問題を説明する仕様書であって、それ
     を効率的に計算処理する方法を見付けるのは言語実装の役目です。SQL は
     おそらく一番よく知られた宣言型言語です; SQL のクエリは取得したいデ
     ータセットを説明しているだけで、テーブルを走査するかインデックスを
     使うか、どのサブクローズから実行するか等々を決めるのは SQL エンジン
     なのです。

   * 'オブジェクト指向' プログラムはオブジェクトの集まりを操作します。オ
     ブジェクトには内部状態があり、その状態を調べたり色々と変更したりす
     るためのメソッドがあります。Smalltalk や Java はオブジェクト指向言
     語です。 C++ と Python はオブジェクト指向プログラミングをサポートし
     ていますが、関連する機能を使わなくても構わないようになっています。

   * '関数型' プログラミングは問題をいくつかの関数にわけて考えます。理想
     的に言うと、関数は入力を受けて出力を吐くだけで、同じ入力に対して異
     なる出力をするような内部状態を一切持ちません。有名な関数型言語には
     ML 一家 (Standard ML, OCaml 等々) と Haskell があります。

設計者が特定のアプローチを強調することにした言語もありますが、そうすると
大抵は、別のアプローチを使うプログラムを書きにくくなります。複数のアプロ
ーチに対応した言語もあり、Lisp, C++, Python はそうしたマルチパラダイム言
語です; この中のどれを使っても、基本的に手続き型な、または基本的にオブジ
ェクト指向な、とか、基本的に関数型なプログラムやライブラリを書くことがで
きます。大きなプログラムでは、各部で別々のアプローチを使って書くことがあ
るかもしれません; GUI はオブジェクト指向で、でも処理ロジックは手続き型や
関数型で、といったようにです。

関数型プログラムでは、入力は一連の関数を通って流れていきます。それぞれの
関数は入力に何らかの作業をして出力します。関数型スタイルにおいては、内部
状態を変えてしまったり、返り値に現れない変更をしたりといった副作用のある
関数はやめるように言われています。副作用のまったくない関数は '純粋関数型
' であるとされます。副作用をなくすということは、プログラムの実行中に順次
変化していくデータ構造を持たない、つまり各関数の出力はその入力にしか影響
を受けてはいけないということです。

ある言語では純粋さにとても厳しく ‘a=3’ や ‘c = a + b’ のような代入文すら
存在しないほどですが、画面への表示やディスクファイルへの書き込みなど、す
べての副作用を避けるのは難しいです。別の例として、 *note print(): 1177.
や *note time.sleep(): 8ac. 関数の呼び出しもありますが、どちらも有用な値
を返しません。画面にテキストを送ったり、実行を 1 秒間停めたりといった副
作用のためだけに呼ばれるのです。

関数型スタイルで書いた Python プログラムはふつう、I/O や代入を完全になく
すといった極端なところまでは行かずに、関数型っぽく見えるインターフェース
を提供しつつも内部では非関数型の機能を使います。たとえば、関数内でローカ
ル変数の代入は使いますが、グローバル変数は変更せず、他の副作用もないよう
に実装するのです。

関数型プログラミングはオブジェクト指向プログラミングの反対と考えることも
できます。オブジェクト指向において、オブジェクトは内部状態とそれを変更す
るメソッドコールの入ったカプセルであり、プログラムはその状態を適正に変化
させていく手順です。一方で、関数型プログラミングは可能なかぎり状態の変更
を避け、関数どうしの間を流れるデータだけを扱おうとします。Python ではこ
の二つのアプローチを結び合わせることができます。アプリケーション内のオブ
ジェクト (メール、トランザクション、等々) を表現したインスタンスを、関数
が受け渡しするようにするのです。

関数型デザインは、わけのわからない制約に見えるかもしれません。どうしてオ
ブジェクトも副作用もないほうが良いのでしょうか。実は、関数型スタイルには
理論と実践に基づく次の利点があるのです:

   * 形式的証明可能性。

   * モジュラー性。

   * 結合性。

   * デバッグやテストの簡単さ。

* Menu:

* 形式的証明可能性::
* モジュラー性::
* デバッグやテストの簡単さ::
* 結合性::


File: python.info,  Node: 形式的証明可能性,  Next: モジュラー性,  Up: はじめに<15>

9.7.1.1 形式的証明可能性
........................

理論面の利点としては、プログラムが正しいことの数学的証明を他より簡単に構
築できるという点があります。

研究者たちは長いあいだ、プログラムが正しいことを数学的に証明する方法の発
見に血道をあげてきました。これは、色々な入力でテストして出力が正しかった
からまあ正しいだろう、と結論するのとも違いますし、ソースコードを読んで「
間違いはなさそうだ」と言うのとも別の話です; 目指すのは、出現しうる入力す
べてに対してプログラムが正しい結果を出すことの厳密な証明なのです。

プログラムを証明するために使われているのは '不変式' を書き出していくとい
うテクニックで、不変式とは入力データやプログラム変数のうち常に真である性
質のことです。コードの一行一行で、 '実行前' の不変式 X と Y が真なら '実
行後に' ちょっと違う不変式 X' と Y' が真になることを示していき、これをプ
ログラムの終わりまで続けるわけです。すると最終的な不変式はプログラムの出
力に合った条件になっているはずです。

関数型プログラミングが代入を嫌うのは、この不変式テクニックでは代入を扱い
にくいからです; 代入は、それまで真だった不変式を壊しておいて、自分は次の
行に伝えてゆける不変式を生み出さないことがあるのです。

残念ながら、プログラムの証明はだいたい実際的でもありませんし、Python ソ
フトウェアにも関係ありません。本当に簡単なプログラムでも、証明には数ペー
ジにわたる論文が必要なのです; ある程度の複雑なプログラムではもう尋常でな
い長さになってしまうので、日常で使っているプログラム (Python インタプリ
タ、XML パーサ、ウェブブラウザ) はほとんど、あるいはすべて、正しさを証明
するのは不可能でしょう。仮に証明を書き出したり生成したりしても、その証明
を検証するための疑いが残ります; 証明に間違いがあるかもしれず、その場合は
証明したと自分で勝手に思い込んでいただけになるのです。


File: python.info,  Node: モジュラー性,  Next: デバッグやテストの簡単さ,  Prev: 形式的証明可能性,  Up: はじめに<15>

9.7.1.2 モジュラー性
....................

より実用的には、関数型プログラミングをすると問題を細かく切り分けることに
なるという利点があります。結果としてプログラムはモジュラー化されます。複
雑な変形を施す大きな関数を書くより、一つのことに絞ってそれだけをする小さ
な関数のほうが書きやすいものです。それに、小さいほうが読むのもエラーをチ
ェックするのも簡単です。


File: python.info,  Node: デバッグやテストの簡単さ,  Next: 結合性,  Prev: モジュラー性,  Up: はじめに<15>

9.7.1.3 デバッグやテストの簡単さ
................................

テストやデバッグも関数型プログラムなら簡単です。

関数が一般的に小さくて明確に意味付けされているので、デバッグ方法は単純で
す。プログラムが正しく動かないときには、関数ひとつひとつがデータの正しさ
をチェックするポイントになるので、それぞれの時点における入力と出力を見て
いけば、バグの原因となる関数を素早く切り出すことができるのです。

ひとつひとつの関数がユニットテストの対象になり得るわけですから、テストも
簡単です。関数はシステムの状態に依存しませんので、テストの実行前にそうし
た状態を再現する必要はありません; 単に適切な入力を合成して、出力が期待ど
おりかどうかチェックするだけで良いのです。


File: python.info,  Node: 結合性,  Prev: デバッグやテストの簡単さ,  Up: はじめに<15>

9.7.1.4 結合性
..............

関数型スタイルのプログラムを作っていると、色々な入力や出力のために色々な
関数を書くことになります。仕方なく特定のアプリケーションに特化した関数を
書くこともあるでしょうけれど、広範なプログラムに使える関数もあることでし
ょう。たとえば、ディレクトリ名を受け取ってその中の XML ファイル一覧を返
す関数や、ファイル名を受け取って内容を返す関数などは、多様な場面に適用で
きそうです。

時たつうちに自分の特製ライブラリやユーティリティが充実してくると、新しい
プログラムも、既存の関数を調整して少し今回に特化した関数を書くだけで組み
立てられるようになります。


File: python.info,  Node: イテレータ iterator<2>,  Next: ジェネレータ式とリスト内包表記,  Prev: はじめに<15>,  Up: 関数型プログラミング HOWTO

9.7.2 イテレータ (iterator)
---------------------------

まずは関数型スタイルのプログラムを書く際の基礎となる重要な Python 機能か
ら見ていきましょう: イテレータです。

イテレータは連続データを表現するオブジェクトです; このオブジェクトは一度
に一つの要素ずつデータを返します。 Python のイテレータは *note
__next__(): 14e5. という、引数を取らず次の要素を返すメソッドを必ずサポー
トしています。データストリームに要素が残っていない場合、 *note
__next__(): 14e5. は必ず *note StopIteration: df5. 例外を出します。ただ
し、イテレータの長さは有限である必要はありません; 無限のストリームを生成
するイテレータを書くというのもまったく理に適ったことです。

ビルトインの *note iter(): 9d7. 関数は任意のオブジェクトを受けて、 その
中身や要素を返すイテレータを返そうとします。引数のオブジェクトが イテレ
ータを作れないときは *note TypeError: 198. を投げます。Python の ビルト
インなデータ型にもいくつかイテレータ化のできるものがあり、 中でもよく使
われるのはリストと辞書です。イテレータを作れる オブジェクトは *note
iterable: 12f1. オブジェクトと呼ばれます。

手を動かしてイテレータ化の実験をしてみましょう:

     >>> L = [1, 2, 3]
     >>> it = iter(L)
     >>> it
     <...iterator object at ...>
     >>> it.__next__()  # same as next(it)
     1
     >>> next(it)
     2
     >>> next(it)
     3
     >>> next(it)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     StopIteration
     >>>

Python は色々な文脈でイテラブルなオブジェクトを期待しますが、 最も重要な
のは *note for: 34a. 文です。 ‘for X in Y’ という文の Y は、 イテレータ
か、あるいは *note iter(): 9d7. でイテレータを作れるオブジェクトである必
要があります。次の二つは同じ意味になります:

     for i in iter(obj):
         print(i)

     for i in obj:
         print(i)

イテレータは *note list(): 24d. や *note tuple(): 614. といったコンスト
ラクタ関数を使ってリストやタプルに具現化することができます:

     >>> L = [1, 2, 3]
     >>> iterator = iter(L)
     >>> t = tuple(iterator)
     >>> t
     (1, 2, 3)

シーケンスのアンパックもイテレータに対応しています: イテレータが N 個の
要素を返すということが事前にわかっていれば、N-タプルにアンパックすること
ができます:

     >>> L = [1, 2, 3]
     >>> iterator = iter(L)
     >>> a, b, c = iterator
     >>> a, b, c
     (1, 2, 3)

ビルトイン関数の *note max(): 110c. や *note min(): 110b. なども、イテレ
ータ一つだけを引数に取って最大・最小の要素を返すことができます。 ‘"in"’
や ‘"not in"’ 演算子もイテレータに対応しています: ‘X in iterator’ は、そ
のイテレータから返るストリームに X があれば真です。ですからイテレータが
無限長だと、当然ながら問題に直面します; *note max(): 110c, *note min():
110b. はいつまでも戻って来ませんし、 要素 X がストリームに出てこなければ
‘"in"’, ‘"not in"’ オペレータも戻りません。

イテレータは次に進むことしかできませんのでご注意ください; 前の要素を手に
入れたり、イテレータをリセットしたり、コピーを作ったりする方法はありませ
ん。イテレータがオブジェクトとしてそうした追加機能を 持つことはできます
が、プロトコルでは *note __next__(): 14e5. メソッドのことしか指定されて
いません。ですから関数はイテレータの出力を使い尽くして しまうかもしれま
せんし、同じストリームに何か別のことをする 必要があるなら新しいイテレー
タを作らなくてはいけません。

* Menu:

* イテレータ対応のデータ型::


File: python.info,  Node: イテレータ対応のデータ型,  Up: イテレータ iterator<2>

9.7.2.1 イテレータ対応のデータ型
................................

リストやタプルがイテレータに対応している方法については既に見ましたが、実
のところ Python のシーケンス型はどれでも、たとえば文字列なども、自動でイ
テレータ生成に対応しています。

辞書に対して *note iter(): 9d7. すると、辞書のキーでループを回すイテレー
タが返されます:

     >>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,
     ...      'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}
     >>> for key in m:
     ...     print(key, m[key])
     Jan 1
     Feb 2
     Mar 3
     Apr 4
     May 5
     Jun 6
     Jul 7
     Aug 8
     Sep 9
     Oct 10
     Nov 11
     Dec 12

Python 3.7 から、辞書の反復順序は挿入順序と同じであることが保証されてい
ることに注意してください。 以前のバージョンでは、その振る舞いは仕様が定
められておらず、実装ごとに異なることがありました。

辞書は *note iter(): 9d7. を適用するとキーでループを回しますが、辞書には
他のイテレータを返すメソッドもあります。明示的に値、あるいはキーと値のペ
アでイテレートしたければ、*note values(): 9d1, *note items(): 9d2. とい
うメソッドでイテレータを作ることができます。

逆に *note dict(): 183. コンストラクタは、有限な ‘(key, value)’ タプルの
ストリームを返すイテレータを受け入れることができます:

     >>> L = [('Italy', 'Rome'), ('France', 'Paris'), ('US', 'Washington DC')]
     >>> dict(iter(L))
     {'Italy': 'Rome', 'France': 'Paris', 'US': 'Washington DC'}

ファイルも、最後の行まで *note readline(): 20a6. メソッドを呼んでいくこ
とでイテレータ化に対応しています。つまりこうやってファイルの各行を読んで
いくことができるわけです:

     for line in file:
         # do something for each line
         ...

セットはイテラブルを受け取れますし、そのセットの要素でイテレートすること
もできます:

     >>> S = {2, 3, 5, 7, 11, 13}
     >>> for i in S:
     ...     print(i)
     2
     3
     5
     7
     11
     13


File: python.info,  Node: ジェネレータ式とリスト内包表記,  Next: ジェネレータ generator<2>,  Prev: イテレータ iterator<2>,  Up: 関数型プログラミング HOWTO

9.7.3 ジェネレータ式とリスト内包表記
------------------------------------

イテレータの出力に対してよく使う操作トップ 2 は、(1) ひとつずつ全要素に
操作を実行する、および (2) 条件に合う要素でサブセットを作る、です。たと
えば文字列のリストなら、各行のうしろに付いた邪魔なホワイトスペースを削り
たいとか、特定の文字列を含む部分をピックアップしたいなどと思うかもしれま
せん。

リスト内包表記とジェネレータ式 (略して「listcomp」と「genexp」) は、そう
した操作向けの簡潔な表記方法です。これは関数型プログラミング言語 Haskell
(‘https://www.haskell.org/’) にインスパイアされました。文字列のストリー
ムからホワイトスペースをすべて削るのは次のコードでできます:

     >>> line_list = ['  line 1\n', 'line 2  \n', ' \n', '']

     >>> # Generator expression -- returns iterator
     >>> stripped_iter = (line.strip() for line in line_list)

     >>> # List comprehension -- returns list
     >>> stripped_list = [line.strip() for line in line_list]

特定の要素だけを選び出すのは ‘"if"’ 条件式を付けることで可能です:

     >>> stripped_list = [line.strip() for line in line_list
     ...                  if line != ""]

リスト内包表記を使うと Python リストが返って来ます; ‘stripped_list’ は実
行結果の行が入ったリストであって、イテレータではありません。ジェネレータ
式はイテレータを返し、これだと必要に応じてだけ値を算出しますので、すべて
の値を一度に出す必要がありません。つまりリスト内包表記のほうは、無限長ス
トリームや膨大なデータを返すようなイテレータを扱う際には、あまり役に立た
ないということです。そういった状況ではジェネレータ式のほうが好ましいと言
えます。

ジェネレータ式は丸括弧 "()" で囲まれ、リスト内包表記は角括弧 "[]" で囲ま
れます。ジェネレータ式の形式は次のとおりです:

     ( expression for expr in sequence1
                  if condition1
                  for expr2 in sequence2
                  if condition2
                  for expr3 in sequence3
                  ...
                  if condition3
                  for exprN in sequenceN
                  if conditionN )

リスト内包表記も、外側の括弧が違うだけ (丸ではなく角括弧) で、あとは同じ
です。

生成される出力は ‘expression’ 部分の値を要素として並べたものになります。
‘if’ 節はすべて、なくても大丈夫です; あれば ‘condition’ が真のときだけ
‘expression’ が評価されて出力に追加されます。

ジェネレータ式は常に括弧の中に書かなければなりませんが、関数コールの目印
になっている括弧でも大丈夫です。関数にすぐ渡すイテレータを作りたければこ
う書けるのです:

     obj_total = sum(obj.count for obj in list_all_objects())

‘for...in’ 節は複数つなげられますが、どれにも、イテレートするためのシー
ケンスが含まれています。それらのシーケンスは並行して 'ではなく' 、左から
右へ順番にイテレートされるので、長さが同じである必要はありません。
‘sequence1’ の各要素ごとに毎回最初から ‘sequence2’ をループで回すのです
。その後 ‘sequence1’ と ‘sequence2’ から出た要素ペアごとに、 ‘sequence3’
でループします。

別の書き方をすると、リスト内包表記やジェネレータ式は次の Python コードと
同じ意味になります:

     for expr1 in sequence1:
         if not (condition1):
             continue   # Skip this element
         for expr2 in sequence2:
             if not (condition2):
                 continue   # Skip this element
             ...
             for exprN in sequenceN:
                 if not (conditionN):
                     continue   # Skip this element

                 # Output the value of
                 # the expression.

つまり、複数の ‘for...in’ 節があって ‘if’ がないときの最終出力は、長さが
各シーケンス長の積に等しくなるということです。長さ 3 のリスト二つなら、
出力リストの長さは 9 要素です:

     >>> seq1 = 'abc'
     >>> seq2 = (1, 2, 3)
     >>> [(x, y) for x in seq1 for y in seq2]
     [('a', 1), ('a', 2), ('a', 3),
      ('b', 1), ('b', 2), ('b', 3),
      ('c', 1), ('c', 2), ('c', 3)]

Python の文法に曖昧さを紛れ込ませないように、 ‘expression’ でタプルを作
るなら括弧で囲わなくてはなりません。下にあるリスト内包表記で、最初のは構
文エラーですが、二番目は有効です:

     # Syntax error
     [x, y for x in seq1 for y in seq2]
     # Correct
     [(x, y) for x in seq1 for y in seq2]


File: python.info,  Node: ジェネレータ generator<2>,  Next: 組み込み関数 built-in function<2>,  Prev: ジェネレータ式とリスト内包表記,  Up: 関数型プログラミング HOWTO

9.7.4 ジェネレータ (generator)
------------------------------

ジェネレータは、イテレータを書く作業を簡単にする、特殊な関数です。標準的
な関数は値を計算して返しますが、ジェネレータが返すのは、一連の値を返すイ
テレータです。

Python や C の標準的な関数コールについては、よくご存じに違いありません。
関数を呼ぶと、ローカル変数を作るプライベートな名前空間ができますね。その
関数が ‘return’ 文まで来ると、ローカル変数が破壊されてから、返り値が呼び
出し元に返ります。次に同じ関数をもう一度呼ぶと、新しいプライベート名前空
間に新規のローカル変数が作られるのです。しかし、関数を出るときにローカル
変数を捨てなければどうなるでしょうか。その出ていったところから関数を続行
できたとしたら、どうでしょう。これこそジェネレータが提供する機能です; す
なわち、ジェネレータは続行できる関数と考えることができます。

ごく単純なジェネレータ関数の例がこちらにあります:

     >>> def generate_ints(N):
     ...    for i in range(N):
     ...        yield i

*note yield: bc2. キーワードを含む関数はすべてジェネレータ関数です;
Python の *note bytecode: 4aa. コンパイラがこれを検出して、特別な方法で
コンパイルしてくれるのです。

ジェネレータ関数は、呼ばれたときに一回だけ値を返すのではなく、イテレータ
プロトコルに対応したオブジェクトを返します。上の例で ‘yield’ を実行した
とき、 ジェネレータは ‘return’ 文のようにして ‘i’ の値を出力します。
‘yield’ と ‘return’ 文の大きな違いは、 ‘yield’ に到達した段階でジェネレ
ータの実行状態が一時停止になって、ローカル変数が保存される点です。 次回
そのジェネレータの *note __next__(): 20ae. を呼ぶと、そこから関数が実行
を再開します。

上記 ‘generate_ints()’ ジェネレータの使用例はこちらです:

     >>> gen = generate_ints(3)
     >>> gen
     <generator object generate_ints at ...>
     >>> next(gen)
     0
     >>> next(gen)
     1
     >>> next(gen)
     2
     >>> next(gen)
     Traceback (most recent call last):
       File "stdin", line 1, in <module>
       File "stdin", line 2, in generate_ints
     StopIteration

同じく ‘for i in generate_ints(5)’ や ‘a, b, c = generate_ints(3)’ とい
った書き方もできます。

ジェネレータ関数の中では、‘return value’ は *note __next__(): 20ae. メソ
ッドから送出された ‘StopIteration(value)’ を引き起こします。これが発生し
た場合や、関数の終わりに到達した場合は、値の生成が終了してジェネレーター
がそれ以上の値を返さない。

自分でクラスを書いて、ジェネレータで言うところのローカル変数をインスタン
ス変数として全部保管しておけば、同じ効果を得ることは可能です。たとえば整
数のリストを返すのは、 ‘self.count’ を 0 にして、 *note __next__():
14e5. メソッドが ‘self.count’ をインクリメントして返すようにすればできま
す。しかしながら、ある程度複雑なジェネレータになってくると、同じことをす
るクラスを書くのは格段にややこしいことになります。

Python のライブラリに含まれているテストスイート
Lib/test/test_generators.py(1) には、ほかにも興味深い例が数多く入ってい
ます。これは二分木の通りがけ順 (in-order) 探索を再帰で実装したジェネレー
タです。

     # A recursive generator that generates Tree leaves in in-order.
     def inorder(t):
         if t:
             for x in inorder(t.left):
                 yield x

             yield t.label

             for x in inorder(t.right):
                 yield x

ほかにも ‘test_generators.py’ には、N-Queens 問題 (N×N コマのチェス盤に
、互いに攻撃できないような配置で N 個のクイーンを置く) やナイト・ツアー
(N×N 盤の全コマをナイトが一度ずつ通るような経路を探す) の解を出す例が入
っています。

* Menu:

* ジェネレータに値を渡す::

   ---------- Footnotes ----------

   (1) 
https://github.com/python/cpython/tree/3.14/Lib/test/test_generators.py


File: python.info,  Node: ジェネレータに値を渡す,  Up: ジェネレータ generator<2>

9.7.4.1 ジェネレータに値を渡す
..............................

Python 2.4 までのジェネレータは出力することしかできませんでした。ジェネ
レータのコードを実行してイテレータを作ってしまったあとで、その関数を再開
するときに新しい情報を渡す手段はなかったのです。ジェネレータがグローバル
変数を見るようにしたり、ミュータブルなオブジェクトを渡しておいて呼び出し
元であとからそれを変更したり、といったハックは可能でしたが、どれもゴチャ
ゴチャしていますね。

Python 2.5 で、ジェネレータに値を渡す簡単な手段ができました。 *note
yield: bc2. が、変数に代入したり演算したりできる値を返す式になったのです
:

     val = (yield i)

上のように、返り値で何かをするときは ‘yield’ 式の前後に '必ず' 括弧を付
けるようお勧めします。括弧は常に必要なわけではありませんが、どんなとき付
けなくて良いのかを覚えておくより、いつも付けておくほうが楽ですから。

( PEP 342(1) がその規則を正確に説明していますが、それによると ‘yield’-式
は、代入式で右辺のトップレベルにあるとき以外はいつも括弧を付ける必要があ
ります。つまり ‘val = yield i’ とは書けますが、 ‘val = (yield i) + 12’ の
ように演算子があるときは括弧を使わなくてはいけません。)

ジェネレータに値を送るには *note send(value): 126d. メソッドを呼びます。
するとジェネレータのコードが実行を再開し、 ‘yield’ 式がその値を返すので
す。ふつうの *note __next__(): 20ae. メソッドを呼ぶと、 ‘yield’ は
‘None’ を返します。

下にあるのは 1 ずつ増える単純なカウンタですが、内部カウンタの値を変更す
ることができるようになっています。

     def counter(maximum):
         i = 0
         while i < maximum:
             val = (yield i)
             # If value provided, change counter
             if val is not None:
                 i = val
             else:
                 i += 1

そしてカウンタ変更の例がこちらです:

     >>> it = counter(10)
     >>> next(it)
     0
     >>> next(it)
     1
     >>> it.send(8)
     8
     >>> next(it)
     9
     >>> next(it)
     Traceback (most recent call last):
       File "t.py", line 15, in <module>
         it.next()
     StopIteration

‘yield’ が ‘None’ を返すことはよくあるのですから、そうなっていないかどう
か必ずチェックしておくべきです。ジェネレータ関数を再開するために使うメソ
ッドが *note send(): 126d. しかないのだと確定してるのでない限り、式の値
をそのまま使ってはいけません。

ジェネレータには、 *note send(): 126d. のほかにもメソッドが二つあります:

   * *note throw(value): 71c. はジェネレータ内で例外を投げるために使いま
     す; その例外はジェネレータの実行が停止したところの ‘yield’ 式によっ
     て投げられます。

   * *note close(): 1793. sends a *note GeneratorExit: 15e1. exception
     to the generator to terminate the iteration.  On receiving this
     exception, the generator's code must either raise *note
     GeneratorExit: 15e1. or *note StopIteration: df5.; catching the
     exception and doing anything else is illegal and will trigger a
     *note RuntimeError: 244.  *note close(): 1793. will also be called
     by Python's garbage collector when the generator is
     garbage-collected.

     *note GeneratorExit: 15e1. が起こったときにクリーンアップ作業をする
     必要があるなら、 *note GeneratorExit: 15e1. を捕捉するのではなく
     ‘try: ... finaly:’ するようお勧めします。

これらの変更の合わせ技で、ジェネレータは情報の一方的な生産者から、生産者
かつ消費者という存在に変貌を遂げたのです。

ジェネレータは 'コルーチン' という、より一般化された形式のサブルーチンに
もなります。サブルーチンは一カ所 (関数の冒頭) から入って別の一カ所
(‘return’ 文) から出るだけですが、コルーチンはいろいろな場所 (‘yield’ 文
) から入ったり出たり再開したりできるのです。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0342/


File: python.info,  Node: 組み込み関数 built-in function<2>,  Next: itertools モジュール,  Prev: ジェネレータ generator<2>,  Up: 関数型プログラミング HOWTO

9.7.5 組み込み関数 (built-in function)
--------------------------------------

よくイテレータと一緒に使うビルトイン関数について、もっと詳しく見ていきま
しょう。

Python のビルトイン関数 *note map(): 19f. と *note filter(): a64. は、機
能がジェネレータ式と重複しています:

*note map(f, iterA, iterB, ...): 19f. は以下のシーケンスのイテレータを返します

     ‘f(iterA[0], iterB[0]), f(iterA[1], iterB[1]), f(iterA[2],
     iterB[2]), ...’.

          >>> def upper(s):
          ...     return s.upper()

          >>> list(map(upper, ['sentence', 'fragment']))
          ['SENTENCE', 'FRAGMENT']
          >>> [upper(s) for s in ['sentence', 'fragment']]
          ['SENTENCE', 'FRAGMENT']

もちろん、リスト内包表記でも同じ結果が得られます。

*note filter(predicate, iter): a64. はある条件を満たす要素に渡るイテレー
タを返すので、同様にリスト内包表記で再現できます。 'predicate' は、ある
条件に対する真偽値を返す関数です; *note filter(): a64. で使うには、その
関数の引数は一つでなければなりません。

     >>> def is_even(x):
     ...     return (x % 2) == 0

     >>> list(filter(is_even, range(10)))
     [0, 2, 4, 6, 8]

これはリスト内包表記でも書けます:

     >>> list(x for x in range(10) if is_even(x))
     [0, 2, 4, 6, 8]

*note enumerate(iter, start=0): 169a. はイテラブルの要素に順番に番号を振
っていき、('start' から数え始めたときの) 番号とそれぞれの要素を含む 2 タ
プルを返します。

     >>> for item in enumerate(['subject', 'verb', 'object']):
     ...     print(item)
     (0, 'subject')
     (1, 'verb')
     (2, 'object')

*note enumerate(): 169a. はよく、リストに対してループさせて、条件に合う
所に印を付けていくときに使われます:

     f = open('data.txt', 'r')
     for i, line in enumerate(f):
         if line.strip() == '':
             print('Blank line at line #%i' % i)

*note sorted(iterable, key=None, reverse=False): dc7. はイテラブルの要素
をすべて集めたリストを作り、ソートして返します。 引数 'key' および
'reverse' は、リストの *note sort(): dc8. メソッドにそのまま渡されます。

     >>> import random
     >>> # Generate 8 random numbers between [0, 10000)
     >>> rand_list = random.sample(range(10000), 8)
     >>> rand_list
     [769, 7953, 9828, 6431, 8442, 9878, 6213, 2207]
     >>> sorted(rand_list)
     [769, 2207, 6213, 6431, 7953, 8442, 9828, 9878]
     >>> sorted(rand_list, reverse=True)
     [9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]

(ソートに関する詳細な論議は *note ソートのテクニック: 13f3. を参照)

組み込みの *note any(iter): 163a. および *note all(iter): 163b. は
iterable の値の真偽を調べます。 *note any(): 163a. は要素のどれかが真値
なら ‘True’ を返し、 *note all(): 163b. は要素が全て真値なら ‘True’ を返
します:

     >>> any([0, 1, 0])
     True
     >>> any([0, 0, 0])
     False
     >>> any([1, 1, 1])
     True
     >>> all([0, 1, 0])
     False
     >>> all([0, 0, 0])
     False
     >>> all([1, 1, 1])
     True

*note zip(iterA, iterB, ...): 1a0. はそれぞれの iterable から1つの要素を
取り、それらをタプルに入れて返します:

     zip(['a', 'b', 'c'], (1, 2, 3)) =>
       ('a', 1), ('b', 2), ('c', 3)

*note zip(): 1a0. は結果を返す前に入力のイテレーターを全て消費してメモリ
上に list を作成しません。代わりに要求されるたびに tuple を生成して返し
ます。(この動作を技術的な用語で lazy evaluation(1) (訳: 遅延評価(2)) と
呼びます。)

このイテレータの用途には、すべて同じ長さのイテラブルを想定しています。長
さが違っていれば、出力されるストリームは一番短いイテラブルと同じ長さにな
ります。

     zip(['a', 'b'], (1, 2, 3)) =>
       ('a', 1), ('b', 2)

とは言え、これをやってしまうと長いイテレータから要素をひとつ無駄に多く取
って捨ててしまうかもしれませんので、やめておいたほうが良いです。その捨て
られた要素を抜かしてしまう危険があるので、もうそのイテレータはそれ以上使
えなくなってしまいます。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Lazy_evaluation

   (2) 
https://ja.wikipedia.org/wiki/%E9%81%85%E5%BB%B6%E8%A9%95%E4%BE%A1


File: python.info,  Node: itertools モジュール,  Next: functools モジュール,  Prev: 組み込み関数 built-in function<2>,  Up: 関数型プログラミング HOWTO

9.7.6 itertools モジュール
--------------------------

*note itertools: 85. モジュールには、よく使うイテレータや、イテレータ同
士の連結に使う関数がたくさん含まれています。この章では、そのモジュールの
内容を小さな例で紹介していきたいと思います。

このモジュールの関数を大まかに分けるとこうなります:

   * 既存のイテレータに基づいて新しいイテレータを作る関数。

   * イテレータの要素を引数として扱う関数。

   * イテレータの出力から一部を取り出す関数。

   * イテレータの出力をグループ分けする関数。

* Menu:

* 新しいイテレータを作る::
* 要素に対して関数を呼ぶ::
* 要素を選択する::
* 組合せ関数::
* 要素をグループ分けする::


File: python.info,  Node: 新しいイテレータを作る,  Next: 要素に対して関数を呼ぶ,  Up: itertools モジュール

9.7.6.1 新しいイテレータを作る
..............................

*note itertools.count(start, step): 149b. は値の間隔が一定の無限ストリー
ムを返します。 オプションで開始する数 (デフォルトは 0) や数どうしの間隔
(デフォルトは 1) を与えられます:

     itertools.count() =>
       0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...
     itertools.count(10) =>
       10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...
     itertools.count(10, 5) =>
       10, 15, 20, 25, 30, 35, 40, 45, 50, 55, ...

*note itertools.cycle(iter): 2ba2. は与えられたイテラブルの内容をコピー
して、 その要素を最初から最後まで無限に繰り返していくイテレータを返しま
す。

     itertools.cycle([1, 2, 3, 4, 5]) =>
       1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ...

*note itertools.repeat(elem, [n]): 1859. は、与えられた要素を 'n' 回返し
ますが、 'n' がなければ永遠に返し続けます。

     itertools.repeat('abc') =>
       abc, abc, abc, abc, abc, abc, abc, abc, abc, abc, ...
     itertools.repeat('abc', 5) =>
       abc, abc, abc, abc, abc

*note itertools.chain(iterA, iterB, ...): 25de. は任意の数のイテラブルを
受け取って、最初のイテレータから要素をすべて返し、次に二番目から 要素を
すべて返し、ということを要素がなくなるまで続けます。

     itertools.chain(['a', 'b', 'c'], (1, 2, 3)) =>
       a, b, c, 1, 2, 3

*note itertools.islice(iter, [start], stop, [step]): d43. は、イテレータ
の スライスをストリームで返します。 'stop' 引数だけだと、最初の 'stop' 個
の要素を返します。開始インデックスを渡すと 'stop-start' 個で、 'step' の
値も渡せばそれに応じて要素を抜かします。Python における文字列やリストの
スライスとは違って、マイナスの値は 'start', 'stop', 'step' に使えません
。

     itertools.islice(range(10), 8) =>
       0, 1, 2, 3, 4, 5, 6, 7
     itertools.islice(range(10), 2, 8) =>
       2, 3, 4, 5, 6, 7
     itertools.islice(range(10), 2, 8, 2) =>
       2, 4, 6

*note itertools.tee(iter, [n]): 2ba7. はイテレータを複製します; 元のイテ
レータの内容を同じように返す、独立した 'n' 個のイテレータを返すのです。
'n' の値は、指定しなければ既定が 2 になっています。複製するには元のイテ
レータの内容を一部保存しておく必要がありますから、大きなイテレータから複
製したうちの一つが他よりも進んでいってしまうと、大量のメモリを消費するこ
とがあります。

     itertools.tee( itertools.count() ) =>
        iterA, iterB

     where iterA ->
        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...

     and   iterB ->
        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...


File: python.info,  Node: 要素に対して関数を呼ぶ,  Next: 要素を選択する,  Prev: 新しいイテレータを作る,  Up: itertools モジュール

9.7.6.2 要素に対して関数を呼ぶ
..............................

いま使った *note operator: a3. モジュールには、Python の演算子に対応する
関数が入っています。いくつか例を挙げると、 *note operator.add(a, b):
2bce. (二つの値を加算)、 *note operator.ne(a, b): 2bbe. (‘a != b’ と同じ
)、 *note operator.attrgetter('id'): 1033. (‘.id’ 属性を取得するコーラブ
ルを返す) といった関数です。

*note itertools.starmap(func, iter): 12fa. は、イテラブルがタプルのスト
リームを返すとみなして、 そのタプルを引数に使って 'func' を呼びます:

     itertools.starmap(os.path.join,
                       [('/bin', 'python'), ('/usr', 'bin', 'java'),
                        ('/usr', 'bin', 'perl'), ('/usr', 'bin', 'ruby')])
     =>
       /bin/python, /usr/bin/java, /usr/bin/perl, /usr/bin/ruby


File: python.info,  Node: 要素を選択する,  Next: 組合せ関数,  Prev: 要素に対して関数を呼ぶ,  Up: itertools モジュール

9.7.6.3 要素を選択する
......................

さらに別のグループとして、述語 (predicate) に基づいてイテレータの要素か
らサブセットを選び出す関数があります。

*note itertools.filterfalse(predicate, iter): 25ce. は *note filter():
a64. とは反対に、 述語が偽を返す要素をすべて返します:

     itertools.filterfalse(is_even, itertools.count()) =>
       1, 3, 5, 7, 9, 11, 13, 15, ...

*note itertools.takewhile(predicate, iter): 2ba6. は述語が真を返している
間だけ要素を返します。一度でも述語が偽を返すと、イテレータは出力終了の合
図をします。

     def less_than_10(x):
         return x < 10

     itertools.takewhile(less_than_10, itertools.count()) =>
       0, 1, 2, 3, 4, 5, 6, 7, 8, 9

     itertools.takewhile(is_even, itertools.count()) =>
       0

*note itertools.dropwhile(predicate, iter): 2ba4. は、述語が真を返してい
るうちは要素を無視し、偽になってから残りの出力をすべて返します。

     itertools.dropwhile(less_than_10, itertools.count()) =>
       10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...

     itertools.dropwhile(is_even, itertools.count()) =>
       1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...

*note itertools.compress(data, selectors): 149a. は 2つのイテレータを取
り、 どちらかのイテレータを使い果たすまでの、 'selectors' が真となる要素
に対応する 'data' 要素だけを返します:

     itertools.compress([1, 2, 3, 4, 5], [True, True, False, False, True]) =>
        1, 2, 5


File: python.info,  Node: 組合せ関数,  Next: 要素をグループ分けする,  Prev: 要素を選択する,  Up: itertools モジュール

9.7.6.4 組合せ関数
..................

*note itertools.combinations(iterable, r): 1529. は、 'iterable' から
'r'-tuple 選択する全ての組み合わせを提供するイテレータを返します

     itertools.combinations([1, 2, 3, 4, 5], 2) =>
       (1, 2), (1, 3), (1, 4), (1, 5),
       (2, 3), (2, 4), (2, 5),
       (3, 4), (3, 5),
       (4, 5)

     itertools.combinations([1, 2, 3, 4, 5], 3) =>
       (1, 2, 3), (1, 2, 4), (1, 2, 5), (1, 3, 4), (1, 3, 5), (1, 4, 5),
       (2, 3, 4), (2, 3, 5), (2, 4, 5),
       (3, 4, 5)

それぞれのタプル内では、要素は 'iterable' がそれを返したのと同じ順序を保
ちます。例えば上の例であれば、 1 はいつでも 2, 3, 4, 5 の前に来ます。似
たような関数に *note itertools.permutations(iterable, r=None): 1cdd. が
あり、こちらはこの順序についての制約がなく、 'r' 個選択する全ての順列を
返します。

     itertools.permutations([1, 2, 3, 4, 5], 2) =>
       (1, 2), (1, 3), (1, 4), (1, 5),
       (2, 1), (2, 3), (2, 4), (2, 5),
       (3, 1), (3, 2), (3, 4), (3, 5),
       (4, 1), (4, 2), (4, 3), (4, 5),
       (5, 1), (5, 2), (5, 3), (5, 4)

     itertools.permutations([1, 2, 3, 4, 5]) =>
       (1, 2, 3, 4, 5), (1, 2, 3, 5, 4), (1, 2, 4, 3, 5),
       ...
       (5, 4, 3, 2, 1)

'r' を与えない場合は iterable の長さが使われます。つまり iterable の全て
の要素を選んだ順列を返します。

これらの関数が生成する組み合わせは、位置が基準ですので、 'iterable' の内
容が一意でなくとも良いことに注目してください:

     itertools.permutations('aba', 3) =>
       ('a', 'b', 'a'), ('a', 'a', 'b'), ('b', 'a', 'a'),
       ('b', 'a', 'a'), ('a', 'a', 'b'), ('a', 'b', 'a')

全く同じタプル ‘('a', 'a', 'b')’ が 2度現れていますが、これは 2つの 'a'
が別の位置からのものだからです。

*note itertools.combinations_with_replacement(iterable, r): 1499. 関数は
別の制約を取り払います: 一回の選択で同じ要素を繰り返し選んでも良い。概念
的には、それぞれのタプルの最初のものとして一つ要素が選ばれ、続いて 2つ目
の選択のかわりにそれで置き換わります

     itertools.combinations_with_replacement([1, 2, 3, 4, 5], 2) =>
       (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),
       (2, 2), (2, 3), (2, 4), (2, 5),
       (3, 3), (3, 4), (3, 5),
       (4, 4), (4, 5),
       (5, 5)


File: python.info,  Node: 要素をグループ分けする,  Prev: 組合せ関数,  Up: itertools モジュール

9.7.6.5 要素をグループ分けする
..............................

最後に議題に上げる関数 *note itertools.groupby(iter, key_func=None):
2ba5. は、 これまでで最も複雑です。 ‘key_func(elem)’ は、イテラブルから
返ってきた要素それぞれのキー値を計算する関数です。この関数が指定されてい
なければ、 キーは単に各要素そのものになります。

*note groupby(): 2ba5. は、元になるイテラブルから同じキー値を持つ連続す
る要素を集めて、キー値とそのキーに対応する要素のイテレータの 2-タプルの
ストリームを返します。

     city_list = [('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL'),
                  ('Anchorage', 'AK'), ('Nome', 'AK'),
                  ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ'),
                  ...
                 ]

     def get_state(city_state):
         return city_state[1]

     itertools.groupby(city_list, get_state) =>
       ('AL', iterator-1),
       ('AK', iterator-2),
       ('AZ', iterator-3), ...

     where
     iterator-1 =>
       ('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL')
     iterator-2 =>
       ('Anchorage', 'AK'), ('Nome', 'AK')
     iterator-3 =>
       ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ')

*note groupby(): 2ba5. は、元になるイテラブルの内容がキー値でソートされ
た状態で与えられることを想定しています。ここで、返されるイテレータ自体も
元のイテラブルを使うということに注意してください。そのため、 iterator-1
の結果を読み終わるまでは iterator-2 とそれに対応するキー値を要求すること
はできません。


File: python.info,  Node: functools モジュール,  Next: 小さな関数とラムダ式,  Prev: itertools モジュール,  Up: 関数型プログラミング HOWTO

9.7.7 functools モジュール
--------------------------

*note functools: 63. モジュールには、高階関数がいくつか入っています。 '高
階関数' とは、入力として関数を受け取って新たな関数を返す関数です。このモ
ジュールで一番便利なツールは *note functools.partial(): 217. 関数です。

関数型スタイルのプログラムでは時折、既存の関数から一部のパラメータを埋め
た変種を作りたくなることがあります。Python の関数 ‘f(a, b, c)’ というも
のがあるとしてください; ‘f(1, b, c)’ と同じ意味の ‘g(b, c)’ という関数を
作りたくなることがあります; つまり ‘f()’ のパラメータを一つ埋めるわけで
す。これは「関数の部分適用」と呼ばれています。

*note partial(): 217. のコンストラクタは ‘(function, arg1, arg2, ...,
kwarg1=value1, kwarg2=value2)’ という引数を取ります。できあがったオブジ
ェクトはコーラブルなので、それを呼べば、引数の埋まった状態で ‘function’
を実行したのと同じことになります。

以下にあるのは、小さいけれども現実的な一つの例です:

     import functools

     def log(message, subsystem):
         """Write the contents of 'message' to the specified subsystem."""
         print('%s: %s' % (subsystem, message))
         ...

     server_log = functools.partial(log, subsystem='server')
     server_log('Unable to open socket')

*note functools.reduce(func, iter, [initial_value]): 21a. はイテラブルの
要素に対して次々に演算を実行していった最終結果を出すもので、それゆえ無限
長イテラブルには適用できません。 'func' には、要素を二つ取って値を一つ返
す関数が入ります。 *note functools.reduce(): 21a. はイテレータが返す最初
の二要素 A と B を取って ‘func(A, B)’ を計算します。それから三番目の要素
C を要求して ‘func(func(A, B), C)’ を計算すると、その結果をさらに四番目
の要素と組み合わせて……ということをイテラブルが尽きるまで続けるのです。 も
しイテラブルが一つも値を返さなければ *note TypeError: 198. が発生します
。 初期値 ‘initial_value’ があるときには、最初の計算で
‘func(initial_value, A)’ が実行されます。

     >>> import operator, functools
     >>> functools.reduce(operator.concat, ['A', 'BB', 'C'])
     'ABBC'
     >>> functools.reduce(operator.concat, [])
     Traceback (most recent call last):
       ...
     TypeError: reduce() of empty sequence with no initial value
     >>> functools.reduce(operator.mul, [1, 2, 3], 1)
     6
     >>> functools.reduce(operator.mul, [], 1)
     1

*note operator.add(): 2bce. を *note functools.reduce(): 21a. で使うと、
iterable の全要素を合計することになります。これは使用頻度が高いので、そ
のための *note sum(): 695. というビルトイン関数があります:

     >>> import functools, operator
     >>> functools.reduce(operator.add, [1, 2, 3, 4], 0)
     10
     >>> sum([1, 2, 3, 4])
     10
     >>> sum([])
     0

とはいえ、多くの場合 *note functools.reduce(): 21a. を使うよりは、単に
*note for: 34a. ループを書いたほうがわかりやすくなります:

     import functools
     # Instead of:
     product = functools.reduce(operator.mul, [1, 2, 3], 1)

     # You can write:
     product = 1
     for i in [1, 2, 3]:
         product *= i

関連する関数は *note itertools.accumulate(iterable, func=operator.add):
bf0. です。この関数は同じ計算をしますが、最終結果を返すのではなく、
*note accumulate(): bf0. はそれぞれの中間結果を生成するイテレータが返り
値となります。

     itertools.accumulate([1, 2, 3, 4, 5]) =>
       1, 3, 6, 10, 15

     itertools.accumulate([1, 2, 3, 4, 5], operator.mul) =>
       1, 2, 6, 24, 120

* Menu:

* operator モジュール::


File: python.info,  Node: operator モジュール,  Up: functools モジュール

9.7.7.1 operator モジュール
...........................

*note operator: a3. モジュールは、既に取り上げましたが、Python の演算子
に対応する関数が入っているモジュールです。関数型スタイルのコードにおいて
、演算を一つ実行するだけのくだらない関数を書かずに済むので、よく世話にな
ります。

このモジュールの関数を一部だけ紹介しましょう:

   * 数学演算子: ‘add()’, ‘sub()’, ‘mul()’, ‘floordiv()’, ‘abs()’, ...

   * 論理演算子: ‘not_()’, ‘truth()’

   * ビット演算子: ‘and_()’, ‘or_()’, ‘invert()’

   * 比較: ‘eq()’, ‘ne()’, ‘lt()’, ‘le()’, ‘gt()’, ‘ge()’

   * オブジェクト識別: ‘is_()’, ‘is_not()’

ちゃんとした一覧は operator モジュールの文書でご覧ください。


File: python.info,  Node: 小さな関数とラムダ式,  Next: 更新履歴と謝辞,  Prev: functools モジュール,  Up: 関数型プログラミング HOWTO

9.7.8 小さな関数とラムダ式
--------------------------

関数型スタイルのプログラムを書いていると、述語として働いたり、何らかの形
で要素をつなぎ合わせたりするミニサイズの関数を必要とすることがよくありま
す。

ちょうど良い関数がビルトインやモジュールで存在していれば、新しい関数を定
義する必要はまったくありません:

     stripped_lines = [line.strip() for line in lines]
     existing_files = filter(os.path.exists, file_list)

しかし、欲しい関数がないなら書くしかありません。そうした小さな関数を書く
方法の 一つが *note lambda: 14b5. 式です。 ‘lambda’ は引数として複数のパ
ラメータと それをつなぐ式を取り、その式の値を返す無名の関数を作ります:

     adder = lambda x, y: x+y

     print_assign = lambda name, value: name + '=' + str(value)

もう一つの選択肢は、ふつうに ‘def’ 文で関数を定義するだけです:

     def adder(x, y):
         return x + y

     def print_assign(name, value):
         return name + '=' + str(value)

どちらのほうが良いのでしょうか。それは好みの問題です; 著者のスタイルとし
てはできるだけ ‘lambda’ を使わないようにしています。

そのようにしている理由の一つに、‘lambda’ は定義できる関数が非常に限られ
ているという点があります。一つの式として算出できる結果にしなければいけま
せんので、‘if... elif... else’ や ‘try... except’ のような分岐を持つこと
ができないのです。‘lambda’ 文の中でたくさんのことをやろうとしすぎると、
ごちゃごちゃして読みにくい式になってしまいます。さて、次のコードは何をし
ているでしょうか、素早くお答えください!

     import functools
     total = functools.reduce(lambda a, b: (0, a[1] + b[1]), items)[1]

わかるにはわかるでしょうが、何がどうなっているのか紐解いていくには時間が
かかるはずです。短い ‘def’ 文で入れ子にすると、少し見通しが良くなります
が:

     import functools
     def combine(a, b):
         return 0, a[1] + b[1]

     total = functools.reduce(combine, items)[1]

でも単純に ‘for’ ループにすれば良かったのです:

     total = 0
     for a, b in items:
         total += b

あるいは *note sum(): 695. ビルトインとジェネレータ式でも良いですね:

     total = sum(b for a, b in items)

多くの場合、 *note functools.reduce(): 21a. を使っているところは ‘for’ ル
ープに 書き直したほうが見やすいです。

Fredrik Lundh は以前 ‘lambda’ 利用のリファクタリングに関して以下の指針を
提案したことがあります:

  1. ラムダ関数を書く。

  2. そのラムダが一体ぜんたい何をしているのかコメントで説明する。

  3. そのコメントをしばらく研究して、本質をとらえた名前を考える。

  4. ラムダをその名前で def 文に書き換える。

  5. コメントを消す。

著者はこの指針を本当に気に入っていますが、こうしたラムダなしスタイルが他
より優れているかどうかについて、異論は認めます。


File: python.info,  Node: 更新履歴と謝辞,  Next: 参考資料<2>,  Prev: 小さな関数とラムダ式,  Up: 関数型プログラミング HOWTO

9.7.9 更新履歴と謝辞
--------------------

著者は提案の申し出や修正、様々なこの記事の草稿の助けをしてくれた以下の人
々に感謝します: Ian Bicking, Nick Coghlan, Nick Efford, Raymond
Hettinger, Jim Jewett, Mike Krell, Leandro Lameiro, Jussi Salmela,
Collin Winter, Blake Winton.

Version 0.1: posted June 30 2006.

Version 0.11: posted July 1 2006.  Typo fixes.

Version 0.2: posted July 10 2006.  Merged genexp and listcomp sections
into one.  Typo fixes.

Version 0.21: Added more references suggested on the tutor mailing list.

Version 0.30: Adds a section on the ‘functional’ module written by
Collin Winter; adds short section on the operator module; a few other
edits.


File: python.info,  Node: 参考資料<2>,  Prev: 更新履歴と謝辞,  Up: 関数型プログラミング HOWTO

9.7.10 参考資料
---------------

* Menu:

* 一般論::
* Python 特有の話::
* Python 文書::


File: python.info,  Node: 一般論,  Next: Python 特有の話,  Up: 参考資料<2>

9.7.10.1 一般論
...............

'計算機プログラムの構造と解釈'、Harold AbelsonとGerald Jay Sussman、
Julie Sussman著。この本は ‘https://mitpress.mit.edu/sicp’ で見れます。こ
の計算機科学の古典的な教科書では、2章と3章でシーケンスとストリームを使っ
てプログラム内のデータフローを整理する方法について説明しています。この本
では例に Scheme を使っていますが、これらの章で説明されている設計アプロー
チの多くは、関数型スタイルの Python コードにも適用できます。

‘https://defmacro.org/2006/06/19/fp.html’: A general introduction to
functional programming that uses Java examples and has a lengthy
historical introduction.

‘https://en.wikipedia.org/wiki/Functional_programming’: 関数プログラミン
グに関する一般的な内容の記事。

‘https://en.wikipedia.org/wiki/Coroutine’: コルーチンに関する記事。

‘https://en.wikipedia.org/wiki/Partial_application’: 関数の部分適用の概
念についての記事。

‘https://en.wikipedia.org/wiki/Currying’: カリー化の概念に関する記事。


File: python.info,  Node: Python 特有の話,  Next: Python 文書,  Prev: 一般論,  Up: 参考資料<2>

9.7.10.2 Python 特有の話
........................

‘https://gnosis.cx/TPiP/’: David Mertz's の本の最初の章 ‘Text Processing
in Python’ では文書処理のための関数プログラミングについて議論しています
、この議論の節には "Utilizing Higher-Order Functions in Text Processing"
というタイトルがついています。

Mertz は IBM の DeveloperWorks サイトにも関数型プログラミングに関する 3
部構成の記事を書いています; part 1(1), part 2(2), part 3(3),

   ---------- Footnotes ----------

   (1) https://developer.ibm.com/articles/l-prog/

   (2) https://developer.ibm.com/tutorials/l-prog2/

   (3) https://developer.ibm.com/tutorials/l-prog3/


File: python.info,  Node: Python 文書,  Prev: Python 特有の話,  Up: 参考資料<2>

9.7.10.3 Python 文書
....................

*note itertools: 85. モジュールの文書。

*note functools: 63. モジュールについてのドキュメント。

*note operator: a3. モジュールの文書。

PEP 289(1): "Generator Expressions"

PEP 342(2): "Coroutines via Enhanced Generators" describes the new
generator features in Python 2.5.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0289/

   (2) https://peps.python.org/pep-0342/


File: python.info,  Node: Logging HOWTO,  Next: Logging クックブック,  Prev: 関数型プログラミング HOWTO,  Up: Python HOWTO

9.8 Logging HOWTO
=================


著者: Vinay Sajip <vinay_sajip at red-dove dot com>

このページはチュートリアルです。レファレンスやロギングクックブックは、
*note その他のリソース: 5743. を参照してください。

* Menu:

* 基本 logging チュートリアル::
* 上級ロギングチュートリアル::
* ロギングレベル: ロギングレベル<2>.
* 便利なハンドラ::
* ログ記録中に発生する例外::
* 任意のオブジェクトをメッセージに使用する::
* 最適化: 最適化<19>.
* その他のリソース::


File: python.info,  Node: 基本 logging チュートリアル,  Next: 上級ロギングチュートリアル,  Up: Logging HOWTO

9.8.1 基本 logging チュートリアル
---------------------------------

logging は、あるソフトウェアが実行されているときに起こったイベントを追跡
するための手段です。ソフトウェアの開発者は、特定のイベントが発生したこと
を示す logging の呼び出しをコードに加えます。イベントは、メッセージで記
述され、これに変数データ (すなわち、イベントが起こる度に異なるかもしれな
いデータ) を加えることもできます。イベントには、開発者がそのイベントに定
めた重要性も含まれます。重要性は、'レベル (level)' や '重大度
(severity)' とも呼ばれます。

* Menu:

* logging を使うとき::
* 簡単な例: 簡単な例<2>.
* ファイルへの logging::
* 変数データのロギング::
* 表示されるメッセージのフォーマットの変更::
* メッセージ内での日付と時刻の表示::
* 次のステップ::


File: python.info,  Node: logging を使うとき,  Next: 簡単な例<2>,  Up: 基本 logging チュートリアル

9.8.1.1 logging を使うとき
..........................

You can access logging functionality by creating a logger via ‘logger =
getLogger(__name__)’, and then calling the logger's *note debug(): 102b,
*note info(): 20dd, *note warning(): 1a74, *note error(): 315e. and
*note critical(): 102a. methods.  To determine when to use logging, and
to see which logger methods to use when, see the table below.  It
states, for each of a set of common tasks, the best tool to use for that
task.

行いたいタスク                            そのタスクに最適なツール
                                          
-------------------------------------------------------------------------------------
                                          
コマンドラインスクリプトやプログラムで    *note print(): 1177.
普通に使う、コンソール出力の表示          

プログラムの通常の操作中に発生したイベ    A logger's *note info(): 20dd. (or
ントの報告 (例えば、状態の監視や障害の    *note debug(): 102b. method for very
分析)                                     detailed output for diagnostic purposes)
                                          
                                          
特定のランタイムイベントに関わる警告の    その発行が避けられるもので、クライアント
発行                                      アプリケーションを修正してその警告を排除
                                          するべきなら
                                          *note warnings.warn(): 1732.
                                          
                                          A logger's *note warning(): 1a74. method
                                          if there is nothing the client
                                          application can do about the situation,
                                          but the event should still be noted
                                          
                                          
特定のランタイムイベントに関わるエラー    例外の送出
の報告                                    

例外の送出をしないエラーの抑制 (例えば    A logger's *note error(): 315e,
、長期のサーバプロセス中のエラーハンド    *note exception(): 1029. or
ラ)                                       *note critical(): 102a. method as
                                          appropriate for the specific error and
                                          application domain
                                          

The logger methods are named after the level or severity of the events
they are used to track.  The standard levels and their applicability are
described below (in increasing order of severity):

レベル             いつ使うか
                   
---------------------------------------------------------------------
                   
‘DEBUG’            おもに問題を診断するときにのみ関心があるような
                   、詳細な情報。
                   
                   
‘INFO’             想定された通りのことが起こったことの確認。
                   
                   
‘WARNING’          想定外のことが起こった、または問題が近く起こり
                   そうである (例えば、'disk space low') ことの表
                   示。
                   
                   
‘ERROR’            より重大な問題により、ソフトウェアがある機能を
                   実行できないこと。
                   
                   
‘CRITICAL’         プログラム自体が実行を続けられないことを表す、
                   重大なエラー。
                   

The default level is ‘WARNING’, which means that only events of this
severity and higher will be tracked, unless the logging package is
configured to do otherwise.

追跡されるイベントは、異なる方法で処理されます。追跡されたイベントを処理
する最も単純な方法は、それをコンソールに表示することです。その他のよくあ
る方法は、それをディスクファイルに書き出すことです。


File: python.info,  Node: 簡単な例<2>,  Next: ファイルへの logging,  Prev: logging を使うとき,  Up: 基本 logging チュートリアル

9.8.1.2 簡単な例
................

ごく簡単な例は:

     import logging
     logging.warning('Watch out!')  # will print a message to the console
     logging.info('I told you so')  # will not print anything

これらの行をスクリプトにタイプして実行すると、次のようにコンソールに出力
されます:

     WARNING:root:Watch out!

printed out on the console.  The ‘INFO’ message doesn't appear because
the default level is ‘WARNING’.  The printed message includes the
indication of the level and the description of the event provided in the
logging call, i.e.  'Watch out!'.  The actual output can be formatted
quite flexibly if you need that; formatting options will also be
explained later.

Notice that in this example, we use functions directly on the ‘logging’
module, like ‘logging.debug’, rather than creating a logger and calling
functions on it.  These functions operate on the root logger, but can be
useful as they will call *note basicConfig(): bf3. for you if it has not
been called yet, like in this example.  In larger programs you'll
usually want to control the logging configuration explicitly however -
so for that reason as well as others, it's better to create loggers and
call their methods.


File: python.info,  Node: ファイルへの logging,  Next: 変数データのロギング,  Prev: 簡単な例<2>,  Up: 基本 logging チュートリアル

9.8.1.3 ファイルへの logging
............................

logging イベントをファイルに記録するのは非常によくあるパターンなので次は
これを見て行きましょう。以下のサンプルを試すときは Python インタプリタを
新しく起動して、上のセッションの続きにならないようにしてください:

     import logging
     logger = logging.getLogger(__name__)
     logging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG)
     logger.debug('This message should go to the log file')
     logger.info('So should this')
     logger.warning('And this, too')
     logger.error('And non-ASCII stuff, too, like Øresund and Malmö')

バージョン 3.9 で変更: 'encoding' 引数が追加されました。以前のバージョン
の Python では、あるいは指定されなかったら、エンコーディングには *note
open(): 316. が使うデフォルト値が使われます。上の例に出てきていませんが
、同じく渡せるようになった 'errors' 引数は、エンコーディングエラーの扱い
を決定します。利用可能な値およびデフォルト値については、 *note open():
316. のドキュメントを参照してください。

そして、ファイルの中身を確認すると、ログメッセージが確認できます:

     DEBUG:__main__:This message should go to the log file
     INFO:__main__:So should this
     WARNING:__main__:And this, too
     ERROR:__main__:And non-ASCII stuff, too, like Øresund and Malmö

この例はまた、追跡のしきい値となるロギングレベルを設定する方法も示してい
ます。この例では、しきい値を ‘DEBUG’ に設定しているので、全てのメッセー
ジが表示されています。

次のようなコマンドラインオプションでログレベルを設定したいと考え:

     --log=INFO

‘--log’ に渡されたパラメータの値を変数 'loglevel' に保存しているとしたら
、

     getattr(logging, loglevel.upper())

というコードを使い、 *note basicConfig(): bf3. の 'level' 引数に渡すべき
値が得られます。ユーザの入力値をすべてエラーチェックしたくなり、次の例の
ように実装することもあるでしょう:

     # assuming loglevel is bound to the string value obtained from the
     # command line argument. Convert to upper case to allow the user to
     # specify --log=DEBUG or --log=debug
     numeric_level = getattr(logging, loglevel.upper(), None)
     if not isinstance(numeric_level, int):
         raise ValueError('Invalid log level: %s' % loglevel)
     logging.basicConfig(level=numeric_level, ...)

The call to *note basicConfig(): bf3. should come 'before' any calls to
a logger's methods such as *note debug(): 102b, *note info(): 20dd, etc.
Otherwise, that logging event may not be handled in the desired manner.

上記のスクリプトを複数回実行すると、2 回目以降の実行によるメッセージは
'example.log' に加えられます。以前の実行によるメッセージを記憶せず、実行
ごとに新たに始めたいなら、上記の例での呼び出しを次のように変え、
'filemode' 引数を指定する方法がとれます:

     logging.basicConfig(filename='example.log', filemode='w', level=logging.DEBUG)

出力は先ほどと同じになりますが、ログファイルは追記されなくなり、以前の実
行によるメッセージは失われます。


File: python.info,  Node: 変数データのロギング,  Next: 表示されるメッセージのフォーマットの変更,  Prev: ファイルへの logging,  Up: 基本 logging チュートリアル

9.8.1.4 変数データのロギング
............................

変数データのログを取るには、イベント記述メッセージにフォーマット文字列を
使い、引数に変数データを加えてください。例えば:

     import logging
     logging.warning('%s before you %s', 'Look', 'leap!')

により、次のように表示されます:

     WARNING:root:Look before you leap!

ご覧の通り、イベント記述メッセージに変数データを統合するために、古い、%
スタイルの文字列フォーマットを使っています。これは後方互換性のためです。
logging パッケージは、 *note str.format(): 833. や *note
string.Template: 897. のような新しいフォーマットオプションよりも先に生ま
れました。新しいフォーマットオプションはサポートされて 'います' が、その
探求はこのチュートリアルでは対象としません。詳細は *note
固有の書式化スタイルをアプリケーション全体で使う: 317b. を参照してくださ
い。


File: python.info,  Node: 表示されるメッセージのフォーマットの変更,  Next: メッセージ内での日付と時刻の表示,  Prev: 変数データのロギング,  Up: 基本 logging チュートリアル

9.8.1.5 表示されるメッセージのフォーマットの変更
................................................

メッセージを表示するのに使われるフォーマットを変更するには、使いたいフォ
ーマットを指定する必要があります:

     import logging
     logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
     logging.debug('This message should appear on the console')
     logging.info('So should this')
     logging.warning('And this, too')

により、次のように表示されます:

     DEBUG:This message should appear on the console
     INFO:So should this
     WARNING:And this, too

ご覧の通り、先の例に現れた 'root' が消失しています。フォーマット文字列に
含めることができるものの一覧は、 *note LogRecord 属性: 315c. のドキュメ
ントから参照できますが、単純な用途では、必要なものは 'levelname' (重大度
)、 'message' (変数データを含むイベント記述)、それともしかしたら、イベン
トがいつ起こったかという表示だけです。これは次の節で解説します。


File: python.info,  Node: メッセージ内での日付と時刻の表示,  Next: 次のステップ,  Prev: 表示されるメッセージのフォーマットの変更,  Up: 基本 logging チュートリアル

9.8.1.6 メッセージ内での日付と時刻の表示
........................................

イベントの日付と時刻を表示するには、フォーマット文字列に '%(asctime)s' を
置いてください:

     import logging
     logging.basicConfig(format='%(asctime)s %(message)s')
     logging.warning('is when this event was logged.')

これは以下の様なフォーマットで表示されます:

     2010-12-12 11:41:42,612 is when this event was logged.

デフォルトの日付と時間の表示フォーマット （上記の結果） は、ISO8601 や
RFC 3339(1) に似ています。日付と時間のフォーマットをより詳細に制御する必
要があるなら、以下の例の様に、 ‘basicConfig’ に 'datefmt' 引数を指定して
ください:

     import logging
     logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
     logging.warning('is when this event was logged.')

これは次のように表示されます:

     12/12/2010 11:46:36 AM is when this event was logged.

'datefmt' 引数のフォーマットは、 *note time.strftime(): 1402. でサポート
されているものと同じです。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc3339.html


File: python.info,  Node: 次のステップ,  Prev: メッセージ内での日付と時刻の表示,  Up: 基本 logging チュートリアル

9.8.1.7 次のステップ
....................

基本チュートリアルはこれで終わりです。あなたがロギングを使っていくために
は、これで十分でしょう。logging パッケージが提供するものはもっとあります
が、それを使いこなすためには、もうちょっと時間をかけて、以下のセクション
を読む必要があります。その用意ができたら、好きな飲み物を持って、次に進み
ましょう。

If your logging needs are simple, then use the above examples to
incorporate logging into your own scripts, and if you run into problems
or don't understand something, please post a question in the Help
category of the Python discussion forum(1) and you should receive help
before too long.

まだいますか？もう少し上級の、踏み込んだチュートリアルを綴った、幾つかの
節を読み続けることができます。その後で、 *note Logging クックブック:
1410. もご覧ください。

   ---------- Footnotes ----------

   (1) https://discuss.python.org/c/help/7


File: python.info,  Node: 上級ロギングチュートリアル,  Next: ロギングレベル<2>,  Prev: 基本 logging チュートリアル,  Up: Logging HOWTO

9.8.2 上級ロギングチュートリアル
--------------------------------

logging ライブラリはモジュール方式のアプローチを取り、いくつかのカテゴリ
の部品を提供します。ロガー、ハンドラ、フィルタ、フォーマッタです。

   * ロガーは、アプリケーションコードが直接使うインターフェースを公開し
     ます。

   * ハンドラは、(ロガーによって生成された) ログ記録を適切な送信先に送り
     ます。

   * フィルタは、どのログ記録を出力するかを決定する、きめ細かい機能を提
     供します。

   * フォーマッタは、ログ記録が最終的に出力されるレイアウトを指定します
     。

ログイベント情報は *note LogRecord: 11e8. インスタンスの形で、 logger,
handler, filter, formatter の間でやりとりされます。

ロギングは、 *note Logger: d46. クラスのインスタンス (以下 'ロガー') に
メソッドを呼び出すことで実行されます。各インスタンスには名前があり、名前
空間階層構造に、ドット (ピリオド) をセパレータとして、概念的に並べられて
います。例えば、 'scan' という名前のロガーは、ロガー 'scan.text',
'scan.html' および 'scan.pdf'の親です。ロガー名は、何でも望むものにでき
、ロギングされたメッセージが発生した場所を指し示します。

ロガーに名前をつけるときの良い習慣は、ロギングを使う各モジュールに、以下
のように名付けられた、モジュールレベルロガーを使うことです:

     logger = logging.getLogger(__name__)

これにより、ロガー名はパッケージ/モジュール階層をなぞり、ロガー名だけで
、どこでイベントのログが取られたか、直感的に明らかになります。

ロガーの階層構造の根源は、ルートロガーと呼ばれます。それが、関数 *note
debug(): 315d, *note info(): 3186, *note warning(): 354, *note error():
319a. および *note critical(): 319b. によって使われるロガーとなります。
これらの関数は単に、ルートロガーの同名のメソッドを呼び出します。これらの
関数とメソッドは、同じ署名をもっています。ルートロガーの名前は、ログ出力
では 'root' と表示されます。

もちろん、メッセージを異なる送信先に記録することも出来ます。このパッケー
ジでは、ファイルへ、 HTTP GET/POST 先へ、 SMTP 経由で電子メールへ、汎用
のソケットへ、キューへ、または Windows NT イベントログのような OS 毎のロ
グ記録機構への、ログメッセージの書きこみがサポートされています。送信先は
、 'handler' クラスによって取り扱われます。組み込みのハンドラクラスでは
満たせないような、特殊な要件があるなら、独自のログ送信先を生成できます。

デフォルトでは、どのロギングメッセージに対しても、送信先は設定されていま
せん。チュートリアルの例のように、 *note basicConfig(): bf3. を使って、
送信先 (コンソールやファイルなど) を指定できます。関数 *note debug():
315d, *note info(): 3186, *note warning(): 354, *note error(): 319a. お
よび *note critical(): 319b. を呼び出すと、それらは送信先が設定されてい
ないかを調べます。そして設定されていなければ、ルートロガーに委譲して実際
にメッセージを出力する前に、コンソール (‘sys.stderr’) を送信先に、デフォ
ルトのフォーマットを表示されるメッセージに設定します。

*note basicConfig(): bf3. が設定するデフォルトのメッセージのフォーマット
は次のようになります:

     severity:logger name:message

*note basicConfig(): bf3. の 'format' キーワード引数にフォーマット文字列
を渡すことで、これを変更できます。フォーマット文字列を構成するためのすべ
てのオプションは、 *note フォーマッタオブジェクト: 3178. を参照してくだ
さい。

* Menu:

* Logging Flow::
* ロガー::
* ハンドラ::
* フォーマッタ::
* ロギングの環境設定::
* 環境設定が与えられないとどうなるか::
* ライブラリのためのロギングの設定::


File: python.info,  Node: Logging Flow,  Next: ロガー,  Up: 上級ロギングチュートリアル

9.8.2.1 Logging Flow
....................

次の図はログイベントが logger と handler をどう流れるかを示しています。

[image src="python-figures/logging_flow.png"]



File: python.info,  Node: ロガー,  Next: ハンドラ,  Prev: Logging Flow,  Up: 上級ロギングチュートリアル

9.8.2.2 ロガー
..............

*note Logger: d46. オブジェクトの仕事は大きく三つに分かれます。一つ目は
、アプリケーションが実行中にメッセージを記録できるように、いくつかのメソ
ッドをアプリケーションから呼べるようにしています。二つ目に、ロガーオブジ
ェクトはどのメッセージに対して作用するかを、深刻度 (デフォルトのフィルタ
機構) またはフィルタオブジェクトに基づいて決定します。三つ目に、ロガーオ
ブジェクトは関心を持っているすべてのログハンドラに関連するログメッセージ
を回送します。

とりわけ広く使われるロガーオブジェクトのメソッドは、二つのカテゴリーに分
類できます: 設定とメッセージ送信です。

これらが設定メソッドの中でよく使われます:

   * *note Logger.setLevel(): 16ac. はロガーが扱うログメッセージの最も低
     い深刻度を指定します。組み込みの深刻度の中では DEBUG が一番低く、
     CRITICAL が一番高くなります。たとえば、深刻度が INFO と設定されたロ
     ガーは INFO, WARNING, ERROR, CRITICAL のメッセージしか扱わず、
     DEBUG メッセージは無視します。

   * *note Logger.addHandler(): 3157. と *note Logger.removeHandler():
     3158. は、ハンドラオブジェクトをロガーオブジェクトから追加または削
     除します。ハンドラについては、 *note ハンドラ: 5750. で詳しく述べま
     す。

   * *note Logger.addFilter(): 315f. と *note Logger.removeFilter():
     3160. はロガーオブジェクトにフィルタオブジェクトを追加または削除し
     ます。フィルタについては、 *note フィルタオブジェクト: 3183. で詳し
     く述べます。

これらのメソッドを、生成したすべてのロガーに毎回呼び出さなければならない
わけではありません。この節の最後の 2 段落を参照してください。

ロガーオブジェクトが設定されれば、以下のメソッドがログメッセージを生成し
ます:

   * *note Logger.debug(): 102b, *note Logger.info(): 20dd, *note
     Logger.warning(): 1a74, *note Logger.error(): 315e, *note
     Logger.critical(): 102a. はすべて、メッセージとメソッド名に対応した
     レベルでログ記録を作り出します。メッセージは実際にはフォーマット文
     字列であり、通常の文字列代入に使う ‘%s’, ‘%d’, ‘%f’ などを含むこと
     ができます。残りの引数はメッセージの代入される位置に対応するオブジ
     ェクトのリストです。 ‘**kwargs’ については、ログ記録メソッドが気に
     するキーワードは ‘exc_info’ だけで、例外の情報をログに記録するかを
     決定するのに使います。

   * *note Logger.exception(): 1029. は *note Logger.error(): 315e. と似
     たログメッセージを作成します。違いは *note Logger.exception():
     1029. がスタックトレースを一緒にダンプすることです。このメソッドは
     例外ハンドラからだけ呼び出すようにしてください。

   * *note Logger.log(): 1028. はログレベルを明示的な引数として受け取り
     ます。これは上に挙げた便宜的なログレベル毎のメソッドを使うより少し
     コード量が多くなりますが、独自のログレベルを使うことができます。

*note getLogger(): b59. は、指定されればその特定の名前の、そうでなければ
‘root’ のロガーインスタンスへの参照を返します。ロガーの名前はピリオド区
切りの階層構造を表します。同じ名前で *note getLogger(): b59. を複数回呼
び出した場合、同一のロガーオブジェクトへの参照が返されます。階層リストを
下ったロガーはリスト上位のロガーの子です。たとえば、名前が ‘foo’ である
ロガーがあったとして、 ‘foo.bar’, ‘foo.bar.baz’, ‘foo.bam’ といった名前
のロガーはすべて ‘foo’ の子孫になります。

ロガーには、'有効レベル (effective level)' の概念があります。ロガーにレ
ベルが明示的に設定されていなければ、代わりに親のレベルがその有効レベルと
して使われます。親のレベルが設定されなければ、'その' 親のレベルが確かめ
られ、明示的に設定されたレベルが見つかるまで祖先が探されます。ルートロガ
ーは、必ず明示的なレベルが設定されています (デフォルトでは ‘WARNING’ で
す)。イベントを処理するかを決定するとき、ロガーの有効レベルを使って、イ
ベントがロガーのハンドラに渡されるかが決められます。

子ロガーはメッセージを親ロガーのハンドラに伝えます。このため、アプリケー
ションが使っているすべてのロガーのためのハンドラを定義して設定する必要は
ありません。トップレベルのロガーのためのハンドラだけ設定しておいて必要に
応じて子ロガーを作成すれば十分です。(しかし、ロガーの 'propagate' 属性を
‘False’ に設定することで、伝播を抑制できます。)


File: python.info,  Node: ハンドラ,  Next: フォーマッタ,  Prev: ロガー,  Up: 上級ロギングチュートリアル

9.8.2.3 ハンドラ
................

*note Handler: 16af. オブジェクトは適切なログメッセージを (ログメッセー
ジの深刻度に基づいて) ハンドラの指定された出力先に振り分けることに責任を
持ちます。 *note Logger: d46. オブジェクトには *note addHandler(): 3157.
メソッドで 0 個以上のハンドラを追加することができます。例として、あるア
プリケーションがすべてのログメッセージをログファイルに、 error 以上のす
べてのログメッセージを標準出力に、 critical のメッセージはすべてメールア
ドレスに、それぞれ送りたいとします。この場合、 3 つの個別のハンドラがそ
れぞれの深刻度と宛先に応じて必要になります。

このライブラリには多くのハンドラが用意されています (*note
便利なハンドラ: 5752. を参照してください) が、このチュートリアルでは
*note StreamHandler: 1411. と *note FileHandler: 1c53. だけを例に取り上
げます。

アプリケーション開発者にとってハンドラを扱う上で気にするべきメソッドは極
々限られています。組み込みのハンドラオブジェクトを使う (つまり自作ハンド
ラを作らない) 開発者に関係あるハンドラのメソッドは、次の設定用のメソッド
だけでしょう:

   * *note setLevel(): 316d. メソッドは、ロガーオブジェクトの場合と同様
     に、適切な出力先に振り分けられるべき最も低い深刻度を指定します。な
     ぜ 2 つも *note setLevel(): 316d. メソッドがあるのでしょうか?  ロガ
     ーで設定されるレベルは、付随するハンドラにどんな深刻度のメッセージ
     を渡すか決めます。それぞれのハンドラで設定されるレベルは、そのハン
     ドラがどのメッセージを転送するべきか決めます。

   * *note setFormatter(): 316e. でこのハンドラが使用する Formatter オブ
     ジェクトを選択します。

   * *note addFilter(): 316f. および *note removeFilter(): 3170. はそれ
     ぞれハンドラへのフィルタオブジェクトの設定と解除を行います。

アプリケーションのコード中では *note Handler: 16af. のインスタンスを直接
インスタンス化して使ってはなりません。代わりに、 *note Handler: 16af. ク
ラスはすべてのハンドラが持つべきインターフェイスを定義する基底クラスであ
り、子クラスが使える (もしくはオーバライドできる) いくつかのデフォルトの
振る舞いを規定します。


File: python.info,  Node: フォーマッタ,  Next: ロギングの環境設定,  Prev: ハンドラ,  Up: 上級ロギングチュートリアル

9.8.2.4 フォーマッタ
....................

フォーマッタオブジェクトは最終的なログメッセージの順序、構造および内容を
設定します。基底クラスである *note logging.Handler: 16af. とは違って、ア
プリケーションのコードはフォーマッタクラスをインスタンス化しても構いませ
ん。特別な振る舞いをさせたいアプリケーションではフォーマッタのサブクラス
を使う可能性もあります。コンストラクタは三つのオプション引数を取ります -
メッセージのフォーマット文字列、日付のフォーマット文字列、スタイル標識で
す。

 -- メソッド: logging.Formatter.__init__ (fmt=None, datefmt=None,
          style='%')

フォーマット文字列に何も渡さない場合は、デフォルトで行メッセージが利用さ
れます。また、日付フォーマットに何も渡さない場合は、デフォルトで以下のフ
ォーマットが利用されます:

     %Y-%m-%d %H:%M:%S

時刻の末尾にはミリ秒が付きます。 ‘style’ は ‘'%'’, ‘'{'’, または
‘'{TX-PL-LABEL}#x27;’ のいずれかです。特に指定がなければ ‘'%'’ が使われ
ます。

‘style’ が ‘'%'’ の場合、メッセージフォーマット文字列では ‘%(<dictionary
key>)s’ 形式の置換文字列が使われます; キーに指定できる属性名は *note
LogRecord 属性: 315c. に文書化されています。 style が ‘'{'’ の場合、メッ
セージフォーマット文字列は (キーワード引数を使う) *note str.format():
833. と互換となります。 style が ‘'$'’ の場合、メッセージフォーマット文
字列は *note string.Template.substitute(): 20d5. で期待されているものと
一致します。

バージョン 3.2 で変更: ‘style’ パラメータが追加されました。

次のメッセージフォーマット文字列は、人が読みやすい形式の時刻、メッセージ
の深刻度、およびメッセージの内容を、順番に出力します:

     '%(asctime)s - %(levelname)s - %(message)s'

フォーマッタは、ユーザが設定できる関数を使って、生成時刻をタプルに記録し
ます。デフォルトでは、 *note time.localtime(): 1712. が使われます。特定
のフォーマッタインスタンスに対してこれを変更するには、インスタンスの
‘converter’ 属性を *note time.localtime(): 1712. や *note time.gmtime():
13d8. と同じ署名をもつ関数に設定してください。すべてのフォーマッタインス
タンスに対してこれを変更するには、例えば全てのロギング時刻を GMT で表示
するには、フォーマッタクラスの ‘converter’ 属性を (GMT 表示の
‘time.gmtime’ に) 設定してください。


File: python.info,  Node: ロギングの環境設定,  Next: 環境設定が与えられないとどうなるか,  Prev: フォーマッタ,  Up: 上級ロギングチュートリアル

9.8.2.5 ロギングの環境設定
..........................

プログラマは、ロギングを 3 種類の方法で設定できます:

  1. 上述の設定メソッドを呼び出す Python コードを明示的に使って、ロガー
     、ハンドラ、そしてフォーマッタを生成する。

  2. ロギング設定ファイルを作り、それを *note fileConfig(): d48. 関数を
     使って読み込む。

  3. 設定情報の辞書を作り、それを *note dictConfig(): 13c8. 関数に渡す。

最後の2つの選択肢については、 *note 環境設定のための関数: 1509. で解説し
ています。以下の例では、Python コードを使って、とても簡単なロガー、コン
ソールハンドラ、そして簡単なフォーマッタを設定しています:

     import logging

     # create logger
     logger = logging.getLogger('simple_example')
     logger.setLevel(logging.DEBUG)

     # create console handler and set level to debug
     ch = logging.StreamHandler()
     ch.setLevel(logging.DEBUG)

     # create formatter
     formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

     # add formatter to ch
     ch.setFormatter(formatter)

     # add ch to logger
     logger.addHandler(ch)

     # 'application' code
     logger.debug('debug message')
     logger.info('info message')
     logger.warning('warn message')
     logger.error('error message')
     logger.critical('critical message')

このモジュールを実行すると、コマンドラインによって以下の出力がなされます
:

     $ python simple_logging_module.py
     2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message
     2005-03-19 15:10:26,620 - simple_example - INFO - info message
     2005-03-19 15:10:26,695 - simple_example - WARNING - warn message
     2005-03-19 15:10:26,697 - simple_example - ERROR - error message
     2005-03-19 15:10:26,773 - simple_example - CRITICAL - critical message

以下の Python モジュールは、ロガー、ハンドラ、フォーマッタをほとんど上述
の例と同じように生成していますが、オブジェクト名だけが異なります:

     import logging
     import logging.config

     logging.config.fileConfig('logging.conf')

     # create logger
     logger = logging.getLogger('simpleExample')

     # 'application' code
     logger.debug('debug message')
     logger.info('info message')
     logger.warning('warn message')
     logger.error('error message')
     logger.critical('critical message')

これが logging.conf ファイルです:

     [loggers]
     keys=root,simpleExample

     [handlers]
     keys=consoleHandler

     [formatters]
     keys=simpleFormatter

     [logger_root]
     level=DEBUG
     handlers=consoleHandler

     [logger_simpleExample]
     level=DEBUG
     handlers=consoleHandler
     qualname=simpleExample
     propagate=0

     [handler_consoleHandler]
     class=StreamHandler
     level=DEBUG
     formatter=simpleFormatter
     args=(sys.stdout,)

     [formatter_simpleFormatter]
     format=%(asctime)s - %(name)s - %(levelname)s - %(message)s

出力は、設定ファイルに基づく例とだいたい同じです:

     $ python simple_logging_config.py
     2005-03-19 15:38:55,977 - simpleExample - DEBUG - debug message
     2005-03-19 15:38:55,979 - simpleExample - INFO - info message
     2005-03-19 15:38:56,054 - simpleExample - WARNING - warn message
     2005-03-19 15:38:56,055 - simpleExample - ERROR - error message
     2005-03-19 15:38:56,130 - simpleExample - CRITICAL - critical message

この通り、設定ファイルの方法は、主に設定とコードが分かれ、非コーダがロギ
ングプロパティを変えやすくなるという点で、Python コードの方法より少し優
れています。

     警告: *note fileConfig(): d48. 関数はデフォルト引数
     ‘disable_existing_loggers’ を取り、後方互換性のためにデフォルト値は
     ‘True’ になっています。 これはあなたの望むものかもしれませんし、そ
     うでないかもしれません。というのは、設定で明示的に指定したクラス (も
     しくはその親クラス) を除いて、 *note fileConfig(): d48. が呼び出さ
     れる前に存在した非ルートロガーを無効化してしまうからです。 より詳細
     なことはリファレンスを参照し、望むならこの引数に ‘False’ を指定して
     ください。

     *note dictConfig(): 13c8. に渡される辞書でも、キー
     ‘disable_existing_loggers’ で真偽値を指定することができ、辞書の中で
     明示的に指定しなかった場合はデフォルトで ‘True’ と解釈されます。こ
     れは上で説明したロガー無効化につながりますが、それを望まないことも
     あるでしょう - その場合は、明示的にキーを与えて値を ‘False’ にして
     ください。

なお、設定ファイルで参照されるクラス名は、logging モジュールに対して相対
であるか、通常のインポート機構を使って解決される絶対である値でなければな
りません。従って、(logging モジュールに相対な) *note WatchedFileHandler:
31da. または (Python インポートパスとして ‘mypackage’ が使えるとき、パッ
ケージ ‘mypackage’ のモジュール ‘mymodule’ で定義されたクラスに)
‘mypackage.mymodule.MyHandler’ のどちらかが使えます。

Python 3.2 では、ロギングを設定するのに新しく、辞書に設定情報を持たせる
手段が導入されました。これは、上で概説した設定ファイルに基づく方法による
機能の上位版を提供し、新しいアプリケーションやデプロイにはこのメソッドが
推奨されます。Python の辞書を使って設定情報を保持し、辞書は他の用途にも
使えるので、設定の選択肢が広がります。例えば、JSON フォーマットの設定フ
ァイルや、YAML 処理機能が使えれば YAML フォーマットのファイルを使って、
設定辞書を構成できます。また、もちろん、Python コードで辞書を構成し、ソ
ケットを通して pickle 化された形式を受け取るなど、アプリケーションで意味
があるいかなるやり方でも使えます。

以下は、上記と同じ設定を辞書ベースの新しい手法で記載した YAML 形式の例で
す:

     version: 1
     formatters:
       simple:
         format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
     handlers:
       console:
         class: logging.StreamHandler
         level: DEBUG
         formatter: simple
         stream: ext://sys.stdout
     loggers:
       simpleExample:
         level: DEBUG
         handlers: [console]
         propagate: no
     root:
       level: DEBUG
       handlers: [console]

辞書を使ったロギングについて詳細は、 *note 環境設定のための関数: 1509. を
参照してください。


File: python.info,  Node: 環境設定が与えられないとどうなるか,  Next: ライブラリのためのロギングの設定,  Prev: ロギングの環境設定,  Up: 上級ロギングチュートリアル

9.8.2.6 環境設定が与えられないとどうなるか
..........................................

ロギング環境設定を与えられないと、ロギングイベントを出力しなければならな
いのに、イベントを出力するハンドラが見つからないことがあります。

イベントは、 *note lastResort: 1413. に格納された「最終手段ハンドラ」を
使用して出力されます。この内部的なハンドラはどんなロガーにも関係しておら
ず、イベント記述メッセージを現在の ‘sys.stderr’ に書く *note
StreamHandler: 1411. のように動作します (したがって、あらゆるリダイレク
トの効果が反映されます)。メッセージに対してフォーマットは行われません。
イベント記述メッセージだけがそのまま表示されます。ハンドラのレベルは
‘WARNING’ にセットされ、重大度がこれ以上のすべてのイベントが出力されます
。

バージョン 3.2 で変更: Python 3.2 より前のバージョンでは、振る舞いは以下
の通りです:

   * *note raiseExceptions: 1412. が ‘False’ (製品モード) なら、イベント
     は黙って捨てられます。

   * *note raiseExceptions: 1412. が ‘True’ (開発モード) なら、メッセー
     ジ 'No handlers could be found for logger X.Y.Z' が一度表示されます
     。

3.2 より前の動作にするために、*note lastResort: 1413. を ‘None’ に設定す
ることもできます。


File: python.info,  Node: ライブラリのためのロギングの設定,  Prev: 環境設定が与えられないとどうなるか,  Up: 上級ロギングチュートリアル

9.8.2.7 ライブラリのためのロギングの設定
........................................

ロギングを使うライブラリを開発するときは、ライブラリがどのようにロギング
を使うのか、例えば使われているロガーの名前などを、ドキュメントにしておく
べきです。ロギングの設定については、いくつか考えておくべきこともあります
。使っているアプリケーションがロギングを使っていなくて、ライブラリコード
がロギングを呼び出すと、(前の節で解説したように) 重大度 ‘WARNING’ 以上の
イベントが、‘sys.stderr’ に表示されます。これが最高のデフォルトの振る舞
いと見なされます。

何らかの理由でロギング設定がなされていないときにメッセージを表示 'させた
くない' のであれば、ライブラリのトップレベルのロガーに何もしないハンドラ
を取り付けられます。ライブラリの全てのイベントに対してそのハンドラが見つ
かるので、メッセージが表示されなくなります。ライブラリのユーザーがアプリ
ケーションのためにロギングを設定する場合、おそらくハンドラが追加され、そ
してレベルが適切に設定された場合に、ライブラリコード内でのロギングの呼び
出しは通常通りそのハンドラに出力を送るようになります。

何もしないハンドラ *note NullHandler: 149c. (Python 3.1 以降) は、
logging パッケージに含まれます。このハンドラのインスタンスを、 (ロギング
設定がなされていないときにライブラリのログイベントを ‘sys.stderr’ に出力
させたく 'ないなら') ライブラリの名前空間で使われるトップレベルロガーに
取り付けられます。ライブラリ 'foo' によるすべてのロギングが、 'foo.x',
'foo.x.y' その他に該当する名前のロガーによってなされるなら:

     import logging
     logging.getLogger('foo').addHandler(logging.NullHandler())

とすれば望んだ効果が得られるでしょう。組織が複数のライブラリを作り出すな
ら、指定されるロガー名は単に 'foo' ではなく、'orgname.foo' になります。

     注釈: あなたのライブラリから 'ルートロガーへ直接ログを記録しない' こ
     とを強く推奨します。代わりに、あなたのライブラリのトップレベルまた
     はモジュールレベルの ‘__name__’ を使うなど、固有で、簡単に識別でき
     る名前を持ったロガーを使ってください。ルートロガーに直接ログを記録
     することにより、あなたのライブラリを利用するアプリケーション開発者
     が、ロギングの詳細度 (verbosity) やハンドラを望みのとおりに設定する
     ことを困難にしたり、不可能にしてしまいます。

     注釈: 'ライブラリのロガーには、' *note NullHandler: 149c. '以外のハ
     ンドラを追加しない' ことを強く推奨します。これは、ハンドラの設定が
     、あなたのライブラリを使うアプリケーション開発者にも伝播するからで
     す。アプリケーション開発者は、対象となる聴衆と、そのアプリケーショ
     ンにどのハンドラが最も適しているかを知っています。ハンドラを 'ボン
     ネットの中で' 加えてしまうと、ユニットテストをして必要に応じたログ
     を送達する能力に干渉しかねません。


File: python.info,  Node: ロギングレベル<2>,  Next: 便利なハンドラ,  Prev: 上級ロギングチュートリアル,  Up: Logging HOWTO

9.8.3 ロギングレベル
--------------------

ログレベルの数値は以下の表のように与えられています。これらは基本的に自分
でレベルを定義したい人のためのもので、定義するレベルを既存のレベルの間に
位置づけるためには具体的な値が必要になります。もし数値が他のレベルと同じ
だったら、既存の値は上書きされその名前は失われます。

レベル             数値
                   
---------------------------------------
                   
‘CRITICAL’         50
                   
                   
‘ERROR’            40
                   
                   
‘WARNING’          30
                   
                   
‘INFO’             20
                   
                   
‘DEBUG’            10
                   
                   
‘NOTSET’           0
                   

レベルはロガーに関連付けることもでき、開発者が設定することも、保存された
ログ記録設定を読み込む際に設定することもできます。ロガーに対してログ記録
メソッドが呼び出されると、ロガーは自らのレベルとメソッド呼び出しに関連付
けられたレベルを比較します。ロガーのレベルがメソッド呼び出しのレベルより
も高い場合、実際のログメッセージは生成されません。これはログ出力の冗長性
を制御するための基本的なメカニズムです。

ログ記録されるメッセージは *note LogRecord: 11e8. クラスのインスタンスと
してエンコードされます。ロガーがあるイベントを実際にログ出力すると決定し
た場合、ログメッセージから *note LogRecord: 11e8. インスタンスが生成され
ます。

ログ記録されるメッセージは、ハンドラ ('handlers') を通してディスパッチ機
構にかけられます。ハンドラは *note Handler: 16af. クラスのサブクラスのイ
ンスタンスで、ログ記録された (*note LogRecord: 11e8. 形式の) メッセージ
が、そのメッセージの伝達対象となる相手 (エンドユーザ、サポートデスクのス
タッフ、システム管理者、開発者) に行き着くようにする役割を持ちます。ハン
ドラには特定の出力先を意図された *note LogRecord: 11e8. インスタンスが渡
されます。各ロガーは 0 個以上のハンドラを (*note Logger: d46. の *note
addHandler(): 3157. メソッド) で関連付けることができます。ロガーに直接関
連付けられたハンドラに加えて、'ロガーの上位にあるロガーすべてに関連付け
られたハンドラ' がメッセージを処理する際に呼び出されます (ただしロガーの
'propagate' フラグが false 値にセットされている場合を除きます。その場合
は、祖先ハンドラへの伝搬はそこで止まります)。

ロガーと同様に、ハンドラは関連付けられたレベルを持つことができます。ハン
ドラのレベルはロガーのレベルと同じ方法で、フィルタとして働きます。ハンド
ラがあるイベントを実際に処理すると決定した場合、 *note emit(): 3176. メ
ソッドが使われ、メッセージを出力先に送信します。ほとんどのユーザ定義の
*note Handler: 16af. のサブクラスで、この *note emit(): 3176. をオーバラ
イドする必要があるでしょう。

* Menu:

* カスタムレベル::


File: python.info,  Node: カスタムレベル,  Up: ロギングレベル<2>

9.8.3.1 カスタムレベル
......................

独自のレベルを定義することは可能ですが、必須ではなく、実経験上は既存のレ
ベルが選ばれます。しかし、カスタムレベルが必要だと確信するなら、レベルの
定義には多大な注意を払うべきで、'ライブラリの開発の際、カスタムレベルを
定義することはとても悪いアイデア' になり得ます。これは、複数のライブラリ
の作者がみな独自のカスタムレベルを定義すると、与えられた数値が異なるライ
ブラリで異なる意味になりえるため、開発者がこれを制御または解釈するのが難
しくなるからです。


File: python.info,  Node: 便利なハンドラ,  Next: ログ記録中に発生する例外,  Prev: ロギングレベル<2>,  Up: Logging HOWTO

9.8.4 便利なハンドラ
--------------------

基底の *note Handler: 16af. クラスに加え、多くの便利なサブクラスが提供さ
れています:

  1. *note StreamHandler: 1411. インスタンスは、メッセージをストリーム
     (ファイル風オブジェクト) に送ります。

  2. *note FileHandler: 1c53. インスタンスは、メッセージをディスクファイ
     ルに送ります。

  3. *note BaseRotatingHandler: 31de. は、ある地点でログファイルを循環さ
     せるハンドラの基底クラスです。これを直接インスタンス化することは意
     図されていません。代わりに、 *note RotatingFileHandler: 1941. や
     *note TimedRotatingFileHandler: 1163. を使用してください。

  4. *note RotatingFileHandler: 1941. インスタンスは、メッセージをディス
     クファイルに送り、最大ログファイル数とログファイル循環をサポートし
     ます。

  5. *note TimedRotatingFileHandler: 1163. インスタンスは、メッセージを
     ディスクファイルに送り、ログファイルを特定時間のインターバルで循環
     します。

  6. *note SocketHandler: 1164. インスタンスは、 TCP/IP ソケットにメッセ
     ージを送ります。バージョン3.4　から、 Unixドメインソケットもサポー
     トされます。

  7. *note DatagramHandler: 1165. インスタンスは UDP ソケットにメッセー
     ジを送ります。バージョン 3.4 から、Unix ドメインソケットもサポート
     されます。

  8. *note SMTPHandler: 18b2. インスタンスは、メッセージを指示された
     email アドレスに送ります。

  9. *note SysLogHandler: 86c. インスタンスは、メッセージを、必要ならば
     リモートマシンの、Unix syslog daemon に送ります。

  10. *note NTEventLogHandler: 3204. インスタンスは、メッセージを
     Windows NT/2000/XP イベントログに送ります。

  11. *note MemoryHandler: 31bd. インスタンスは、メッセージを、特定の基
     準が満たされる度に流される、メモリ中のバッファに送ります。

  12. *note HTTPHandler: 102c. インスタンスは、メッセージを、 ‘GET’ また
     は ‘POST’ セマンティクスを使って、HTTP サーバに送ります。

  13. *note WatchedFileHandler: 31da. インスタンスは、ロギングする先のフ
     ァイルを監視します。ファイルが変更されると、そのファイルは閉じられ
     、ファイル名を使って再び開かれます。このハンドラは Unix 系のシステ
     ムにのみ便利です。Windows は、使われている基の機構をサポートしてい
     ません。

  14. *note QueueHandler: 1b61. インスタンスは、 *note queue: bb. モジュ
     ールや *note multiprocessing: 98. モジュールなどで実装されているキ
     ューにメッセージを送ります。

  15. *note NullHandler: 149c. インスタンスは、エラーメッセージについて
     何もしません。このクラスはライブラリ開発者が、 logging は使いたいが
     、ライブラリのユーザーが logging の設定をしなかったときに表示されう
     る 'No handlers could be found for logger 'XXX" のようなメッセージ
     を回避したいときに使います。詳しくは、 *note
     ライブラリのためのロギングの設定: 31d7. を参照してください。

Added in version 3.1: *note NullHandler: 149c. クラス。

Added in version 3.2: *note QueueHandler: 1b61. クラス。

コア logging パッケージで、 *note NullHandler: 149c, *note
StreamHandler: 1411. および *note FileHandler: 1c53. クラスが定義されて
います。その他のハンドラは、サブモジュールの *note logging.handlers: 8d.
で定義されています。(環境設定機能のためのサブモジュール、 *note
logging.config: 8c. もあります。)

ログメッセージは、 *note Formatter: 16b0. クラスのインスタンスを通してフ
ォーマット化してから表示されます。このインスタンスは、 % 演算子と辞書で
使うのに適切なフォーマット文字列で初期化されます。

複数のメッセージを一括してフォーマット化するには、 *note
BufferingFormatter: 317f. が使えます。(一連の文字列のそれぞれに適用され
る) フォーマット文字列に加え、ヘッダとトレーラフォーマット文字列も提供さ
れています。

ロガーレベルおよび/またはハンドラレベルに基づくフィルタリングで十分でな
ければ、 *note Filter: 1414. のインスタンスを *note Logger: d46. と
*note Handler: 16af. インスタンスの両方に (*note addFilter(): 316f. を通
して) 加えることができます。メッセージの処理を続ける前に、ロガーもハンド
ラも、全てのフィルタに許可を求めます。フィルタのいずれかが偽値を返したら
、メッセージの処理は続けられません。

基本の *note Filter: 1414. 機能では、特定のロガー名でのフィルタリングを
できます。この機能が使われると、指名されたロガーに送られたメッセージとそ
の子だけがフィルタを通り、その他は落とされます。


File: python.info,  Node: ログ記録中に発生する例外,  Next: 任意のオブジェクトをメッセージに使用する,  Prev: 便利なハンドラ,  Up: Logging HOWTO

9.8.5 ログ記録中に発生する例外
------------------------------

logging パッケージは、ログを生成している間に起こる例外を飲み込むように設
計されています。これは、ログ記録イベントを扱っている間に発生するエラー
(ログ記録の設定ミス、ネットワークまたは他の同様のエラー) によってログ記
録を使用するアプリケーションが早期に終了しないようにするためです。

*note SystemExit: f3c. と *note KeyboardInterrupt: bc5. 例外は決して飲み
込まれません。 *note Handler: 16af. サブクラスの *note emit(): 3176. メ
ソッドの間に起こる他の例外は、 *note handleError(): 3175. メソッドに渡さ
れます。

*note Handler: 16af. の *note handleError(): 3175. のデフォルト実装は、
モジュールレベル変数 *note raiseExceptions: 1412. が設定されているかどう
かチェックします。設定されているなら、トレースバックが *note sys.stderr:
b33. に出力されます。設定されていないなら、例外は飲み込まれます。

     注釈: *note raiseExceptions: 1412. のデフォルト値は ‘True’ です。こ
     れは、開発の間に起こるどんな例外についても通常は通知してほしいから
     です。実運用環境では *note raiseExceptions: 1412. を ‘False’ に設定
     することをお勧めします。


File: python.info,  Node: 任意のオブジェクトをメッセージに使用する,  Next: 最適化<19>,  Prev: ログ記録中に発生する例外,  Up: Logging HOWTO

9.8.6 任意のオブジェクトをメッセージに使用する
----------------------------------------------

前の節とそこで挙げた例では、イベントを記録するときに渡されたメッセージが
文字列であると仮定していました。しかし、これは唯一の可能性ではありません
。メッセージとして任意のオブジェクトを渡すことができます。そして、ロギン
グシステムがそのオブジェクトを文字列表現に変換する必要があるとき、オブジ
ェクトの *note __str__(): 830. メソッドが呼び出されます。実際、そうした
ければ、文字列表現を計算することを完全に避けることができます - 例えば、
*note SocketHandler: 1164. は、イベントを pickle してネットワーク上で送
信することでログ出力します。


File: python.info,  Node: 最適化<19>,  Next: その他のリソース,  Prev: 任意のオブジェクトをメッセージに使用する,  Up: Logging HOWTO

9.8.7 最適化
------------

message 引数の整形は、必要になるまで延期されます。しかしながら、ログ記録
メソッドに渡す引数を計算するだけでもコストがかかる場合があります。ロガー
が単にイベントを捨てるなら、その計算を避けたいと考えるかもしれません。ど
うするかを決定するために *note isEnabledFor(): 150e. メソッドを呼ぶこと
ができます。このメソッドは引数にレベルを取って、そのレベルの呼び出しに対
して Logger がイベントを生成するなら true を返します。このようにコードを
書くことができます:

     if logger.isEnabledFor(logging.DEBUG):
         logger.debug('Message with %s, %s', expensive_func1(),
                                             expensive_func2())

このようにすると、ロガーの閾値が ‘DEBUG’ より上に設定されている場合、
‘expensive_func1’ と ‘expensive_func2’ の呼び出しは行われません。

     注釈: ある種のケースでは、 *note isEnabledFor(): 150e. それ自身があ
     なたが期待するよりも高価になる場合があります(たとえば明示的なレベル
     指定がロガー階層の上位のみに設定されていて、ロガーが深くネストされ
     ているような場合です)。そのようなケース(あるいはタイトなループ内で
     メソッド呼び出しを避けたい場合)は、 *note isEnabledFor(): 150e. 結
     果をローカルにもしくはインスタンス変数としてキャッシュし、メソッド
     を毎回呼び出すかわりに使えば良いです。そのようなキャッシュ値は、(ま
     ったく一般的ではありませんが)ロギング設定がアプリケーション実行中に
     動的に変更された場合にのみ再計算が必要でしょう。

これ以外にも、どんなログ情報が集められるかについてより正確なコントロール
を必要とする、特定のアプリケーションでできる最適化があります。これは、ロ
グ記録の間の不要な処理を避けるためにできることのリストです:

不要な情報                                                それを避ける方法
                                                          
------------------------------------------------------------------------------------------------------------------
                                                          
呼び出しがどこから行われたかに関する情報。                ‘logging._srcfile’ を ‘None’ にする。このことにより
                                                          *note sys._getframe(): 8f0. 呼び出しを避けることが出
                                                          来、PyPy のような環境(*note sys._getframe(): 8f0. の
                                                          高速化が出来ない)において高速化の役に立ちます。
                                                          
                                                          
スレッド情報。                                            ‘logging.logThreads’ を ‘False’ にする。
                                                          
                                                          
現在のプロセスID(*note os.getpid(): 3001.)                ‘logging.logProcesses’ を ‘False’ にする。
                                                          
                                                          
マルチプロセスの制御に ‘multiprocessing’ を使っていると   ‘logging.logMultiprocessing’ を ‘False’ にする。
きの、現在のプロセス名                                    

‘asyncio’ を使っているときの、現在の                      ‘logging.logAsyncioTasks’ を ‘False’ に設定する。
*note asyncio.Task: 1c7. の名前。                         

また、コア logging モジュールが基本的なハンドラだけを含んでいることに注
意してください。 *note logging.handlers: 8d. と *note logging.config:
8c. をインポートしなければ、余分なメモリを消費することはありません。


File: python.info,  Node: その他のリソース,  Prev: 最適化<19>,  Up: Logging HOWTO

9.8.8 その他のリソース
----------------------

参考
....

*note logging: 8b. モジュール

     logging モジュールの API リファレンス。

*note logging.config: 8c. モジュール

     logging モジュールの環境設定 API です。

*note logging.handlers: 8d. モジュール

     logging モジュールに含まれる、便利なハンドラです。

*note ロギングクックブック: 1410.


File: python.info,  Node: Logging クックブック,  Next: 正規表現 HOWTO,  Prev: Logging HOWTO,  Up: Python HOWTO

9.9 Logging クックブック
========================


著者: Vinay Sajip <vinay_sajip at red-dove dot com>

このページは、過去に有用であるとされていた、logging に関連するいくつもの
レシピを含んでいます。チュートリアルやリファレンス情報へのリンクについて
は *note その他のリソース: 5763. を参照してください。

* Menu:

* 複数のモジュールで logging を使う::
* 複数のスレッドからのロギング::
* 複数の handler と formatter::
* 複数の出力先にログを出力する::
* ログレベルのカスタム処理::
* 設定サーバの例::
* ブロックする handler を扱う::
* ネットワーク越しの logging イベントの送受信::
* コンテキスト情報をログ記録出力に付加する::
* contextvars の利用::
* ハンドラ内でのコンテキスト情報の付与::
* 複数のプロセスからの単一ファイルへのログ記録::
* ファイルをローテートする::
* 別の format スタイルを利用する::
* LogRecord のカスタマイズ::
* Subclassing QueueHandler and QueueListener- a ZeroMQ example::
* Subclassing QueueHandler and QueueListener- a pynng example::
* 辞書ベースで構成する例::
* rotator と namer を使ってログローテートをカスタマイズする::
* より手の込んだ multiprocessing の例::
* SysLogHandler に送るメッセージに BOM を挿入する::
* 構造化ログを実装する::
* handler を dictConfig() を使ってカスタマイズする: handler を dictConfig を使ってカスタマイズする.
* 固有の書式化スタイルをアプリケーション全体で使う::
* filter を dictConfig() を使ってカスタマイズする: filter を dictConfig を使ってカスタマイズする.
* 例外の書式化をカスタマイズする::
* ロギングメッセージを喋る::
* ロギングメッセージをバッファリングし、条件に従って出力する::
* バッファリングしながらロギングメッセージを email で送信する::
* 設定によって時刻を UTC(GMT) で書式化する: 設定によって時刻を UTC GMT で書式化する.
* ロギングの選択にコンテキストマネージャを使う::
* CLIアプリケーションスターターテンプレート::
* Qt GUIのログ出力::
* RFC5424 をサポートする syslog へのロギング::
* ロガーを出力ストリームのように取り扱う方法::
* How to uniformly handle newlines in logging output::
* 避けるべきパターン::
* その他のリソース: その他のリソース<2>.


File: python.info,  Node: 複数のモジュールで logging を使う,  Next: 複数のスレッドからのロギング,  Up: Logging クックブック

9.9.1 複数のモジュールで logging を使う
---------------------------------------

‘logging.getLogger('someLogger')’ の複数回の呼び出しは同じ logger への参
照を返します。これは同じ Python インタプリタプロセス上で動いている限り、
一つのモジュールの中からに限らず、モジュールをまたいでも当てはまります。
同じオブジェクトへの参照という点でも正しいです。さらに、一つのモジュール
の中で親 logger を定義して設定し、別のモジュールで子 logger を定義する
(ただし設定はしない) ことが可能で、すべての子 logger への呼び出しは親に
まで渡されます。まずはメインのモジュールです:

     import logging
     import auxiliary_module

     # create logger with 'spam_application'
     logger = logging.getLogger('spam_application')
     logger.setLevel(logging.DEBUG)
     # create file handler which logs even debug messages
     fh = logging.FileHandler('spam.log')
     fh.setLevel(logging.DEBUG)
     # create console handler with a higher log level
     ch = logging.StreamHandler()
     ch.setLevel(logging.ERROR)
     # create formatter and add it to the handlers
     formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
     fh.setFormatter(formatter)
     ch.setFormatter(formatter)
     # add the handlers to the logger
     logger.addHandler(fh)
     logger.addHandler(ch)

     logger.info('creating an instance of auxiliary_module.Auxiliary')
     a = auxiliary_module.Auxiliary()
     logger.info('created an instance of auxiliary_module.Auxiliary')
     logger.info('calling auxiliary_module.Auxiliary.do_something')
     a.do_something()
     logger.info('finished auxiliary_module.Auxiliary.do_something')
     logger.info('calling auxiliary_module.some_function()')
     auxiliary_module.some_function()
     logger.info('done with auxiliary_module.some_function()')

そして補助モジュール (auxiliary module) がこちらです:

     import logging

     # create logger
     module_logger = logging.getLogger('spam_application.auxiliary')

     class Auxiliary:
         def __init__(self):
             self.logger = logging.getLogger('spam_application.auxiliary.Auxiliary')
             self.logger.info('creating an instance of Auxiliary')

         def do_something(self):
             self.logger.info('doing something')
             a = 1 + 1
             self.logger.info('done doing something')

     def some_function():
         module_logger.info('received a call to "some_function"')

出力はこのようになります:

     2005-03-23 23:47:11,663 - spam_application - INFO -
        creating an instance of auxiliary_module.Auxiliary
     2005-03-23 23:47:11,665 - spam_application.auxiliary.Auxiliary - INFO -
        creating an instance of Auxiliary
     2005-03-23 23:47:11,665 - spam_application - INFO -
        created an instance of auxiliary_module.Auxiliary
     2005-03-23 23:47:11,668 - spam_application - INFO -
        calling auxiliary_module.Auxiliary.do_something
     2005-03-23 23:47:11,668 - spam_application.auxiliary.Auxiliary - INFO -
        doing something
     2005-03-23 23:47:11,669 - spam_application.auxiliary.Auxiliary - INFO -
        done doing something
     2005-03-23 23:47:11,670 - spam_application - INFO -
        finished auxiliary_module.Auxiliary.do_something
     2005-03-23 23:47:11,671 - spam_application - INFO -
        calling auxiliary_module.some_function()
     2005-03-23 23:47:11,672 - spam_application.auxiliary - INFO -
        received a call to 'some_function'
     2005-03-23 23:47:11,673 - spam_application - INFO -
        done with auxiliary_module.some_function()


File: python.info,  Node: 複数のスレッドからのロギング,  Next: 複数の handler と formatter,  Prev: 複数のモジュールで logging を使う,  Up: Logging クックブック

9.9.2 複数のスレッドからのロギング
----------------------------------

複数スレッドからのロギングでは特別に何かをする必要はありません。 次の例
はmain (初期) スレッドとそれ以外のスレッドからのロギングの例です:

     import logging
     import threading
     import time

     def worker(arg):
         while not arg['stop']:
             logging.debug('Hi from myfunc')
             time.sleep(0.5)

     def main():
         logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d %(threadName)s %(message)s')
         info = {'stop': False}
         thread = threading.Thread(target=worker, args=(info,))
         thread.start()
         while True:
             try:
                 logging.debug('Hello from main')
                 time.sleep(0.75)
             except KeyboardInterrupt:
                 info['stop'] = True
                 break
         thread.join()

     if __name__ == '__main__':
         main()

実行すると、出力は以下のようになるはずです:

        0 Thread-1 Hi from myfunc
        3 MainThread Hello from main
      505 Thread-1 Hi from myfunc
      755 MainThread Hello from main
     1007 Thread-1 Hi from myfunc
     1507 MainThread Hello from main
     1508 Thread-1 Hi from myfunc
     2010 Thread-1 Hi from myfunc
     2258 MainThread Hello from main
     2512 Thread-1 Hi from myfunc
     3009 MainThread Hello from main
     3013 Thread-1 Hi from myfunc
     3515 Thread-1 Hi from myfunc
     3761 MainThread Hello from main
     4017 Thread-1 Hi from myfunc
     4513 MainThread Hello from main
     4518 Thread-1 Hi from myfunc

予想した通りかもしれませんが、ログ出力が散らばっているのが分かります。 も
ちろん、この手法はより多くのスレッドでも上手くいきます。


File: python.info,  Node: 複数の handler と formatter,  Next: 複数の出力先にログを出力する,  Prev: 複数のスレッドからのロギング,  Up: Logging クックブック

9.9.3 複数の handler と formatter
---------------------------------

logger は通常の Python オブジェクトです。 *note addHandler(): 3157. メソ
ッドは追加されるハンドラの個数について最小値も最大値も定めていません。時
にアプリケーションがすべての深刻度のすべてのメッセージをテキストファイル
に記録しつつ、同時にエラーやそれ以上のものをコンソールに出力することが役
に立ちます。これを実現する方法は、単に適切なハンドラを設定するだけです。
アプリケーションコードの中のログ記録の呼び出しは変更されずに残ります。少
し前に取り上げた単純なモジュール式の例を少し変えるとこうなります:

     import logging

     logger = logging.getLogger('simple_example')
     logger.setLevel(logging.DEBUG)
     # create file handler which logs even debug messages
     fh = logging.FileHandler('spam.log')
     fh.setLevel(logging.DEBUG)
     # create console handler with a higher log level
     ch = logging.StreamHandler()
     ch.setLevel(logging.ERROR)
     # create formatter and add it to the handlers
     formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
     ch.setFormatter(formatter)
     fh.setFormatter(formatter)
     # add the handlers to logger
     logger.addHandler(ch)
     logger.addHandler(fh)

     # 'application' code
     logger.debug('debug message')
     logger.info('info message')
     logger.warning('warn message')
     logger.error('error message')
     logger.critical('critical message')

'application' 部分のコードは複数の handler について何も気にしていないこ
とに注目してください。変更した箇所は新しい 'fh' という名の handler を追
加して設定したところがすべてです。

新しい handler を、異なる深刻度に対する filter と共に生成できることは、
アプリケーションを書いてテストを行うときとても助けになります。デバッグ用
にたくさんの ‘print’ 文を使う代わりに ‘logger.debug’ を使いましょう。あ
とで消したりコメントアウトしたりしなければならない print 文と違って、
logger.debug 命令はソースコードの中にそのまま残しておいて再び必要になる
まで休眠させておけます。その時必要になるのはただ logger および/または
handler の深刻度の設定をいじることだけです。


File: python.info,  Node: 複数の出力先にログを出力する,  Next: ログレベルのカスタム処理,  Prev: 複数の handler と formatter,  Up: Logging クックブック

9.9.4 複数の出力先にログを出力する
----------------------------------

コンソールとファイルに、別々のメッセージ書式で、別々の状況に応じたログ出
力を行わせたいとしましょう。例えば DEBUG よりも高いレベルのメッセージは
ファイルに記録し、INFO 以上のレベルのメッセージはコンソールに出力したい
という場合です。また、ファイルにはタイムスタンプを記録し、コンソールには
出力しないとします。以下のようにすれば、こうした挙動を実現できます:

     import logging

     # set up logging to file - see previous section for more details
     logging.basicConfig(level=logging.DEBUG,
                         format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
                         datefmt='%m-%d %H:%M',
                         filename='/tmp/myapp.log',
                         filemode='w')
     # define a Handler which writes INFO messages or higher to the sys.stderr
     console = logging.StreamHandler()
     console.setLevel(logging.INFO)
     # set a format which is simpler for console use
     formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
     # tell the handler to use this format
     console.setFormatter(formatter)
     # add the handler to the root logger
     logging.getLogger().addHandler(console)

     # Now, we can log to the root logger, or any other logger. First the root...
     logging.info('Jackdaws love my big sphinx of quartz.')

     # Now, define a couple of other loggers which might represent areas in your
     # application:

     logger1 = logging.getLogger('myapp.area1')
     logger2 = logging.getLogger('myapp.area2')

     logger1.debug('Quick zephyrs blow, vexing daft Jim.')
     logger1.info('How quickly daft jumping zebras vex.')
     logger2.warning('Jail zesty vixen who grabbed pay from quack.')
     logger2.error('The five boxing wizards jump quickly.')

これを実行すると、コンソールには以下のように出力されます:

     root        : INFO     Jackdaws love my big sphinx of quartz.
     myapp.area1 : INFO     How quickly daft jumping zebras vex.
     myapp.area2 : WARNING  Jail zesty vixen who grabbed pay from quack.
     myapp.area2 : ERROR    The five boxing wizards jump quickly.

そして、ファイルには以下のように出力されるはずです:

     10-22 22:19 root         INFO     Jackdaws love my big sphinx of quartz.
     10-22 22:19 myapp.area1  DEBUG    Quick zephyrs blow, vexing daft Jim.
     10-22 22:19 myapp.area1  INFO     How quickly daft jumping zebras vex.
     10-22 22:19 myapp.area2  WARNING  Jail zesty vixen who grabbed pay from quack.
     10-22 22:19 myapp.area2  ERROR    The five boxing wizards jump quickly.

これを見て分かる通り、DEBUG メッセージはファイルだけに出力され、その他の
メッセージは両方に出力されます。

この例ではコンソールとファイルのハンドラだけを使っていますが、実際には任
意の数のハンドラや組み合わせを使えます。

ここでファイル名として ‘/tmp/myapp.log’ を選んだということは、一時ファイ
ルの標準的な場所として POSIX システムを想定していることに注意してくださ
い。 Windows の場合、ディレクトリが存在し、そのディレクトリに対してファ
イルを更新するための適切な権限を有することを保証するために、ログファイル
向けのディレクトリ名として異なる選択を取る必要があるでしょう。


File: python.info,  Node: ログレベルのカスタム処理,  Next: 設定サーバの例,  Prev: 複数の出力先にログを出力する,  Up: Logging クックブック

9.9.5 ログレベルのカスタム処理
------------------------------

しきい値以上のログレベル全てがハンドラによって処理される標準的な処理に対
して、ときにはわずかに異なる振る舞いを必要とすることもあるでしょう。その
ような場合はフィルタを使う必要があります。以下のような処理が必要なシナリ
オについて取り上げてみましょう:

   * 深刻度 ‘INFO’ と ‘WARNING’ のメッセージを ‘sys.stdout’ に送る

   * 深刻度 ‘ERROR’ 以上のメッセージを ‘sys.stderr’ に送る

   * 深刻度 ‘DEBUG’ 以上のメッセージをファイル ‘app.log’ に送る

logging モジュールを下記の JSON によって構成したとしましょう:

     {
         "version": 1,
         "disable_existing_loggers": false,
         "formatters": {
             "simple": {
                 "format": "%(levelname)-8s - %(message)s"
             }
         },
         "handlers": {
             "stdout": {
                 "class": "logging.StreamHandler",
                 "level": "INFO",
                 "formatter": "simple",
                 "stream": "ext://sys.stdout"
             },
             "stderr": {
                 "class": "logging.StreamHandler",
                 "level": "ERROR",
                 "formatter": "simple",
                 "stream": "ext://sys.stderr"
             },
             "file": {
                 "class": "logging.FileHandler",
                 "formatter": "simple",
                 "filename": "app.log",
                 "mode": "w"
             }
         },
         "root": {
             "level": "DEBUG",
             "handlers": [
                 "stderr",
                 "stdout",
                 "file"
             ]
         }
     }

This configuration does 'almost' what we want, except that ‘sys.stdout’
would show messages of severity ‘ERROR’ and only events of this severity
and higher will be tracked as well as ‘INFO’ and ‘WARNING’ messages.  To
prevent this, we can set up a filter which excludes those messages and
add it to the relevant handler.  This can be configured by adding a
‘filters’ section parallel to ‘formatters’ and ‘handlers’:

     {
         "filters": {
             "warnings_and_below": {
                 "()" : "__main__.filter_maker",
                 "level": "WARNING"
             }
         }
     }

そして ‘stdout’ のハンドラに関するセクションにフィルターを追加します:

     {
         "stdout": {
             "class": "logging.StreamHandler",
             "level": "INFO",
             "formatter": "simple",
             "stream": "ext://sys.stdout",
             "filters": ["warnings_and_below"]
         }
     }

フィルターは単なる関数なので、 ‘filter_maker’ (ファクトリ関数) は以下の
ように定義することができます:

     def filter_maker(level):
         level = getattr(logging, level)

         def filter(record):
             return record.levelno <= level

         return filter

この関数は引数として与えられた文字列をログレベルの数値に変換し、ログレコ
ード内のログレベルが指定されたレベル以下の場合に ‘True’ を返す関数を返し
ます。この例では ‘filter_maker’ をコマンドラインから実行するテストスクリ
プト ‘main.py’ で関数が定義されているため、フィルター設定上のモジュール
名は ‘__main__’ になります。そのためフィルター設定の中では
‘__main__.filter_maker’ となります。異なるモジュールで関数を定義した場合
、この部分を変更する必要があります。

フィルターを追加した ‘main.py’ の全体像は以下のようになり、これで実行で
きる状態になりました:

     import json
     import logging
     import logging.config

     CONFIG = '''
     {
         "version": 1,
         "disable_existing_loggers": false,
         "formatters": {
             "simple": {
                 "format": "%(levelname)-8s - %(message)s"
             }
         },
         "filters": {
             "warnings_and_below": {
                 "()" : "__main__.filter_maker",
                 "level": "WARNING"
             }
         },
         "handlers": {
             "stdout": {
                 "class": "logging.StreamHandler",
                 "level": "INFO",
                 "formatter": "simple",
                 "stream": "ext://sys.stdout",
                 "filters": ["warnings_and_below"]
             },
             "stderr": {
                 "class": "logging.StreamHandler",
                 "level": "ERROR",
                 "formatter": "simple",
                 "stream": "ext://sys.stderr"
             },
             "file": {
                 "class": "logging.FileHandler",
                 "formatter": "simple",
                 "filename": "app.log",
                 "mode": "w"
             }
         },
         "root": {
             "level": "DEBUG",
             "handlers": [
                 "stderr",
                 "stdout",
                 "file"
             ]
         }
     }
     '''

     def filter_maker(level):
         level = getattr(logging, level)

         def filter(record):
             return record.levelno <= level

         return filter

     logging.config.dictConfig(json.loads(CONFIG))
     logging.debug('A DEBUG message')
     logging.info('An INFO message')
     logging.warning('A WARNING message')
     logging.error('An ERROR message')
     logging.critical('A CRITICAL message')

これを以下のように実行します:

     python main.py 2>stderr.log >stdout.log

すると期待通りの結果を得ることができます:

     $ more *.log
     ::::::::::::::
     app.log
     ::::::::::::::
     DEBUG    - A DEBUG message
     INFO     - An INFO message
     WARNING  - A WARNING message
     ERROR    - An ERROR message
     CRITICAL - A CRITICAL message
     ::::::::::::::
     stderr.log
     ::::::::::::::
     ERROR    - An ERROR message
     CRITICAL - A CRITICAL message
     ::::::::::::::
     stdout.log
     ::::::::::::::
     INFO     - An INFO message
     WARNING  - A WARNING message


File: python.info,  Node: 設定サーバの例,  Next: ブロックする handler を扱う,  Prev: ログレベルのカスタム処理,  Up: Logging クックブック

9.9.6 設定サーバの例
--------------------

ログ記録設定サーバを使うモジュールの例です:

     import logging
     import logging.config
     import time
     import os

     # read initial config file
     logging.config.fileConfig('logging.conf')

     # create and start listener on port 9999
     t = logging.config.listen(9999)
     t.start()

     logger = logging.getLogger('simpleExample')

     try:
         # loop through logging calls to see the difference
         # new configurations make, until Ctrl+C is pressed
         while True:
             logger.debug('debug message')
             logger.info('info message')
             logger.warning('warn message')
             logger.error('error message')
             logger.critical('critical message')
             time.sleep(5)
     except KeyboardInterrupt:
         # cleanup
         logging.config.stopListening()
         t.join()

そしてファイル名を受け取ってそのファイルをサーバに送るスクリプトですが、
それに先だってバイナリエンコード長を新しいログ記録の設定として先に送って
おきます:

     #!/usr/bin/env python
     import socket, sys, struct

     with open(sys.argv[1], 'rb') as f:
         data_to_send = f.read()

     HOST = 'localhost'
     PORT = 9999
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     print('connecting...')
     s.connect((HOST, PORT))
     print('sending config...')
     s.send(struct.pack('>L', len(data_to_send)))
     s.send(data_to_send)
     s.close()
     print('complete')


File: python.info,  Node: ブロックする handler を扱う,  Next: ネットワーク越しの logging イベントの送受信,  Prev: 設定サーバの例,  Up: Logging クックブック

9.9.7 ブロックする handler を扱う
---------------------------------

ときどき、logging を行っているスレッドをブロックせずに、handler が動くよ
うにしないといけないときがあります。これは Web アプリケーションではよく
あることですし、もちろん他のシナリオでも起きる話です。

動作が鈍くなるときの元凶はたいてい、開発者のコントロール外にあるいくつも
の理由で (例えば、残念なパフォーマンスのメールやネットワークのインフラ)
、 *note SMTPHandler: 18b2.: が電子メールを送るのに時間がかかることです
。しかし、ほとんどのネットワークをまたぐ handler はブロックする可能性が
あります: *note SocketHandler: 1164. による処理でさえ、裏で DNS への問い
合わせというとても遅い処理を行うことがあります (そしてこの問い合わせ処理
は、 Python の層より下のあなたの手の届かない、ソケットライブラリの深いと
ころにある可能性もあります)。

解決策の1つは、2パートに分離したアプローチを用いることです。最初のパート
は、パフォーマンスが重要なスレッドからアクセスされる、 *note
QueueHandler: 1b61. だけをアタッチした logger です。この logger は単に、
十分大きい、あるいは無制限の容量を持ったキューに書き込むだけです。キュー
への書き込みは通常すぐに完了しますが、念の為に *note queue.Full: 366d. 例
外をキャッチする必要があるかもしれません。もしパフォーマンスクリティカル
なスレッドを持つライブラリの開発者であるなら、このことを (‘QueueHandler’
だけをアタッチした logger についての言及を添えて) ドキュメントに書いてお
きましょう。

2つ目のパートは *note QueueHandler: 1b61. の対向として作られた *note
QueueListener: 242. です。 *note QueueListener: 242. はとてもシンプルで
、キューと handler を渡され、内部で ‘QueueHandler’ (もしくは他の
‘LogRecord’ の出力元) から送られた LogRecord をキューから受け取るスレッ
ドを起動します。 ‘LogRecord’ をキューから取り出して、 handler に渡して処
理させます。

分離した *note QueueListener: 242. クラスを持つメリットは、複数の
‘QueueHandler’ に対して1つのインスタンスで logging できることです。既存
の handler のスレッド利用版を使って handler ごとにスレッドを持つよりはず
っとリソースにやさしくなります。

この2つのクラスを利用する例です (import は省略):

     que = queue.Queue(-1)  # no limit on size
     queue_handler = QueueHandler(que)
     handler = logging.StreamHandler()
     listener = QueueListener(que, handler)
     root = logging.getLogger()
     root.addHandler(queue_handler)
     formatter = logging.Formatter('%(threadName)s: %(message)s')
     handler.setFormatter(formatter)
     listener.start()
     # The log output will display the thread which generated
     # the event (the main thread) rather than the internal
     # thread which monitors the internal queue. This is what
     # you want to happen.
     root.warning('Look out!')
     listener.stop()

実行すると次のように出力します:

     MainThread: Look out!

     注釈: 上述の議論は特に同期コードにについてのものではなく、むしろ遅
     いロギングハンドラについてでしたが、非同期コードやネットワーク、あ
     るいはファイルハンドラからのロギングでさえも (イベントループをブロ
     ックしてしまう) 問題につながる可能性があることには注意すべきでしょ
     う。これはいくつかのロギングが *note asyncio: b. 内部で行われること
     が理由です。何らかの非同期コードがアプリケーションの中で使われてい
     る場合、ロギングには上記のアプローチを使っていかなるブロッキングコ
     ードも ‘QueueListener’ スレッド内だけで実行されるようにしておくこと
     が最も良いでしょう。

バージョン 3.5 で変更: Python 3.5 以前は、 *note QueueListener: 242. ク
ラスは常にキューから受け取ったメッセージを、初期化元となっているそれぞれ
のハンドラーに受け渡していました。 ( というのも、レベルフィルターリング
は別サイド、つまり、キューが満たされている場所で処理されるということが想
定されているからです) Python 3.5以降では、キーワードとなる引数
‘respect_handler_level=True’ をリスナーのコントラクターに受け渡すことで
、この挙動を変更することができるようになっています。これが行われると、各
メッセージのレベルをハンドラーのレベルと比較して、そうすることが適切な場
合のみ、メッセージをハンドラーに渡します。

バージョン 3.14 で変更: The *note QueueListener: 242. can be started
(and stopped) via the *note with: 186. statement.  For example:

     with QueueListener(que, handler) as listener:
         # The queue listener automatically starts
         # when the 'with' block is entered.
         pass
     # The queue listener automatically stops once
     # the 'with' block is exited.


File: python.info,  Node: ネットワーク越しの logging イベントの送受信,  Next: コンテキスト情報をログ記録出力に付加する,  Prev: ブロックする handler を扱う,  Up: Logging クックブック

9.9.8 ネットワーク越しの logging イベントの送受信
-------------------------------------------------

ログイベントをネットワーク越しに送信し、受信端でそれを処理したいとしまし
ょう。 *note SocketHandler: 1164. インスタンスを送信端の root logger に
アタッチすれば、簡単に実現できます:

     import logging, logging.handlers

     rootLogger = logging.getLogger()
     rootLogger.setLevel(logging.DEBUG)
     socketHandler = logging.handlers.SocketHandler('localhost',
                         logging.handlers.DEFAULT_TCP_LOGGING_PORT)
     # don't bother with a formatter, since a socket handler sends the event as
     # an unformatted pickle
     rootLogger.addHandler(socketHandler)

     # Now, we can log to the root logger, or any other logger. First the root...
     logging.info('Jackdaws love my big sphinx of quartz.')

     # Now, define a couple of other loggers which might represent areas in your
     # application:

     logger1 = logging.getLogger('myapp.area1')
     logger2 = logging.getLogger('myapp.area2')

     logger1.debug('Quick zephyrs blow, vexing daft Jim.')
     logger1.info('How quickly daft jumping zebras vex.')
     logger2.warning('Jail zesty vixen who grabbed pay from quack.')
     logger2.error('The five boxing wizards jump quickly.')

受信端では *note socketserver: d2. モジュールを使って受信プログラムを作
成しておきます。簡単な実用プログラムを以下に示します:

     import pickle
     import logging
     import logging.handlers
     import socketserver
     import struct


     class LogRecordStreamHandler(socketserver.StreamRequestHandler):
         """Handler for a streaming logging request.

         This basically logs the record using whatever logging policy is
         configured locally.
         """

         def handle(self):
             """
             Handle multiple requests - each expected to be a 4-byte length,
             followed by the LogRecord in pickle format. Logs the record
             according to whatever policy is configured locally.
             """
             while True:
                 chunk = self.connection.recv(4)
                 if len(chunk) < 4:
                     break
                 slen = struct.unpack('>L', chunk)[0]
                 chunk = self.connection.recv(slen)
                 while len(chunk) < slen:
                     chunk = chunk + self.connection.recv(slen - len(chunk))
                 obj = self.unPickle(chunk)
                 record = logging.makeLogRecord(obj)
                 self.handleLogRecord(record)

         def unPickle(self, data):
             return pickle.loads(data)

         def handleLogRecord(self, record):
             # if a name is specified, we use the named logger rather than the one
             # implied by the record.
             if self.server.logname is not None:
                 name = self.server.logname
             else:
                 name = record.name
             logger = logging.getLogger(name)
             # N.B. EVERY record gets logged. This is because Logger.handle
             # is normally called AFTER logger-level filtering. If you want
             # to do filtering, do it at the client end to save wasting
             # cycles and network bandwidth!
             logger.handle(record)

     class LogRecordSocketReceiver(socketserver.ThreadingTCPServer):
         """
         Simple TCP socket-based logging receiver suitable for testing.
         """

         allow_reuse_address = True

         def __init__(self, host='localhost',
                      port=logging.handlers.DEFAULT_TCP_LOGGING_PORT,
                      handler=LogRecordStreamHandler):
             socketserver.ThreadingTCPServer.__init__(self, (host, port), handler)
             self.abort = 0
             self.timeout = 1
             self.logname = None

         def serve_until_stopped(self):
             import select
             abort = 0
             while not abort:
                 rd, wr, ex = select.select([self.socket.fileno()],
                                            [], [],
                                            self.timeout)
                 if rd:
                     self.handle_request()
                 abort = self.abort

     def main():
         logging.basicConfig(
             format='%(relativeCreated)5d %(name)-15s %(levelname)-8s %(message)s')
         tcpserver = LogRecordSocketReceiver()
         print('About to start TCP server...')
         tcpserver.serve_until_stopped()

     if __name__ == '__main__':
         main()

先にサーバを起動しておき、次にクライアントを起動します。クライアント側で
は、コンソールには何も出力されません; サーバ側では以下のようなメッセージ
を目にするはずです:

     About to start TCP server...
        59 root            INFO     Jackdaws love my big sphinx of quartz.
        59 myapp.area1     DEBUG    Quick zephyrs blow, vexing daft Jim.
        69 myapp.area1     INFO     How quickly daft jumping zebras vex.
        69 myapp.area2     WARNING  Jail zesty vixen who grabbed pay from quack.
        69 myapp.area2     ERROR    The five boxing wizards jump quickly.

注意： pickle にはいくつかのシナリオでセキュリティ上の問題があります。こ
れらが影響する場合は、 *note makePickle(): 31f5. メソッドをオーバーライ
ドし代替シリアライズ手法を実装して、それを使うように上記のスクリプトを修
正することもできます。

* Menu:

* 作成中のロギングソケットのリスナーを実行する::


File: python.info,  Node: 作成中のロギングソケットのリスナーを実行する,  Up: ネットワーク越しの logging イベントの送受信

9.9.8.1 作成中のロギングソケットのリスナーを実行する
....................................................

作成中のロギングリスナーを実行するためには、 Supervisor(1) のようなプロ
セス管理ツールを使う必要があるかもしれません。 こちらの Gist(2) は
Supervisor を使って上記の機能を実行するための必要最低限のファイルを提供
しています。以下のファイルが必要になります:

ファイル                      目的
                              
---------------------------------------------------------------------------------------
                              
‘prepare.sh’                  試験用の環境を準備する Bash スクリプト
                              
                              
‘supervisor.conf’             リスナーとマルチプロセスの web アプリケーションのため
                              の設定を含む Supervisor の設定ファイル
                              
                              
‘ensure_app.sh’               Supervisor が上記の設定で実行されていることを保証する
                              ための Bash スクリプト
                              
                              
‘log_listener.py’             ログイベントを受信してファイルに記録するソケットリスナ
                              ープログラム
                              
                              
‘main.py’                     リスナーに接続されたソケットを通じてロギングを実行する
                              簡単な web アプリケーション
                              
                              
‘webapp.json’                 web アプリケーションのための JSON 設定ファイル
                              
                              
‘client.py’                   web アプリケーションを起動するための Python スクリプト
                              

この web アプリケーションは、リクエストを処理する複数のワーカープロセス
を起動する web アプリケーションサーバーである Gunicorn(3) を使っています
。ここに例として挙げた設定は、複数のワーカーがいかにして互いに衝突するこ
となく同じログファイルに書き込みを行うことができるかを示しています -- ワ
ーカーは全てソケットリスナーを通じてログを書き込むのです。

これらのファイルを試すためには、 POSIX 環境において以下を行なってくださ
い:

  1. Download ZIP ボタンを押して Gist(4) を ZIP アーカイブとしてダウンロ
     ードしてください。

  2. アーカイブファイルをスクラッチディレクトリに展開してください。

  3. 準備のために、スクラッチディレクトリにおいて ‘bash prepare.sh’ を実
     行してください。これにより Supervisor 関連のファイルおよびログファ
     イルのための ‘run’ サブディレクトリ、および ‘bottle’, ‘gunicorn’ そ
     して ‘supervisor’ がインストールされる仮想環境を含む ‘venv’ サブデ
     ィレクトリが生成されます。

  4. ‘bash ensure_app.sh’ を実行して Supervisor が上記の設定で実行されて
     いることを確認してください。

  5. ‘venv/bin/python client.py’ を実行して web アプリケーションを起動し
     てください。これによりログにレコードが書き込まれるはずです。

  6. ‘run’ サブディレクトリにあるログファイルを調べてください。最新のロ
     グは、パターン ‘app.log*’ に一致する名前のファイルにあるはずです。
     ログは異なるワーカープロセスによって非決定論的な形で並行に処理され
     るため、特定の決まった順番にはなりません。

  7. リスナーと web アプリケーションは ‘venv/bin/supervisorctl -c
     supervisor.conf shutdown’ を実行することでシャットダウンできます。

ありそうもないことですが、テスト環境で設定したポートが別の設定と衝突して
しまった場合、設定ファイルを修正する必要があるかもしれません。

The default configuration uses a TCP socket on port 9020.  You can use a
Unix Domain socket instead of a TCP socket by doing the following:

  1. In ‘listener.json’, add a ‘socket’ key with the path to the domain
     socket you want to use.  If this key is present, the listener
     listens on the corresponding domain socket and not on a TCP socket
     (the ‘port’ key is ignored).

  2. In ‘webapp.json’, change the socket handler configuration
     dictionary so that the ‘host’ value is the path to the domain
     socket, and set the ‘port’ value to ‘null’.

   ---------- Footnotes ----------

   (1) http://supervisord.org/

   (2) https://gist.github.com/vsajip/4b227eeec43817465ca835ca66f75e2b

   (3) https://gunicorn.org/

   (4) https://gist.github.com/vsajip/4b227eeec43817465ca835ca66f75e2b


File: python.info,  Node: コンテキスト情報をログ記録出力に付加する,  Next: contextvars の利用,  Prev: ネットワーク越しの logging イベントの送受信,  Up: Logging クックブック

9.9.9 コンテキスト情報をログ記録出力に付加する
----------------------------------------------

時にはログ記録出力にログ関数の呼び出し時に渡されたパラメータに加えてコン
テキスト情報を含めたいこともあるでしょう。たとえば、ネットワークアプリケ
ーションで、クライアント固有の情報 (例: リモートクライアントの名前、 IP
アドレス) もログ記録に残しておきたいと思ったとしましょう。 'extra' パラ
メータをこの目的に使うこともできますが、いつでもこの方法で情報を渡すのが
便利なやり方とも限りません。また接続ごとに *note Logger: d46. インスタン
スを生成する誘惑に駆られるかもしれませんが、生成した *note Logger: d46.
インスタンスはガーベジコレクションで回収されないので、これは良いアイデア
とは言えません。この例は現実的な問題ではないかもしれませんが、 *note
Logger: d46. インスタンスの個数がアプリケーションの中でログ記録が行われ
るレベルの粒度に依存する場合、 *note Logger: d46. インスタンスの個数が事
実上無制限にならないと、管理が難しくなります。

* Menu:

* LoggerAdapter を使ったコンテキスト情報の伝達::
* Filter を使ったコンテキスト情報の伝達::


File: python.info,  Node: LoggerAdapter を使ったコンテキスト情報の伝達,  Next: Filter を使ったコンテキスト情報の伝達,  Up: コンテキスト情報をログ記録出力に付加する

9.9.9.1 LoggerAdapter を使ったコンテキスト情報の伝達
....................................................

logging イベントの情報と一緒に出力されるコンテキスト情報を渡す簡単な方法
は、 *note LoggerAdapter: 150d. を使うことです。このクラスは *note
Logger: d46. のように見えるように設計されていて、 *note debug(): 315d,
*note info(): 3186, *note warning(): 354, *note error(): 319a, *note
exception(): 16ad, *note critical(): 319b, *note log(): 319c. の各メソッ
ドを呼び出せるようになっています。これらのメソッドは対応する *note
Logger: d46. のメソッドと同じ引数を取るので、二つの型を取り替えて使うこ
とができます。

*note LoggerAdapter: 150d. のインスタンスを生成する際には、 *note
Logger: d46. インスタンスとコンテキスト情報を収めた辞書風 (dict-like) の
オブジェクトを渡します。 *note LoggerAdapter: 150d. のログ記録メソッドを
呼び出すと、呼び出しをコンストラクタに渡された配下の *note Logger: d46.
インスタンスに委譲し、その際コンテキスト情報をその委譲された呼び出しに埋
め込みます。 *note LoggerAdapter: 150d. のコードから少し抜き出してみます
:

     def debug(self, msg, /, *args, **kwargs):
         """
         Delegate a debug call to the underlying logger, after adding
         contextual information from this adapter instance.
         """
         msg, kwargs = self.process(msg, kwargs)
         self.logger.debug(msg, *args, **kwargs)

*note LoggerAdapter: 150d. の *note process(): 3193. メソッドがコンテキ
スト情報をログ出力に加える場所です。そこではログ記録呼び出しのメッセージ
とキーワード引数が渡され、加工された (可能性のある) それらの情報を配下の
ロガーへの呼び出しに渡し直します。このメソッドのデフォルト実装ではメッセ
ージは元のままですが、キーワード引数にはコンストラクタに渡された辞書風オ
ブジェクトを値として "extra" キーが挿入されます。もちろん、呼び出し時に
"extra" キーワードを使った場合には何事もなかったかのように上書きされます
。

"extra" を用いる利点は辞書風オブジェクトの中の値が *note LogRecord:
11e8. インスタンスの __dict__ にマージされることで、辞書風オブジェクトの
キーを知っている *note Formatter: 16b0. を用意して文字列をカスタマイズす
るようにできることです。それ以外のメソッドが必要なとき、たとえばコンテキ
スト情報をメッセージの前や後ろにつなげたい場合には、 *note
LoggerAdapter: 150d. から *note process(): 3193. を望むようにオーバライ
ドしたサブクラスを作ることが必要なだけです。次に挙げるのはこのクラスを使
った例で、コンストラクタで使われる「辞書風」オブジェクトにどの振る舞いが
必要なのかも示しています:

     class CustomAdapter(logging.LoggerAdapter):
         """
         This example adapter expects the passed in dict-like object to have a
         'connid' key, whose value in brackets is prepended to the log message.
         """
         def process(self, msg, kwargs):
             return '[%s] %s' % (self.extra['connid'], msg), kwargs

これを次のように使うことができます:

     logger = logging.getLogger(__name__)
     adapter = CustomAdapter(logger, {'connid': some_conn_id})

これで、この adapter 経由でログした全てのイベントに対して、
‘some_conn_id’ の値がログメッセージの前に追加されます。

* Menu:

* コンテキスト情報を渡すために dict 以外のオブジェクトを使う::


File: python.info,  Node: コンテキスト情報を渡すために dict 以外のオブジェクトを使う,  Up: LoggerAdapter を使ったコンテキスト情報の伝達

9.9.9.2 コンテキスト情報を渡すために dict 以外のオブジェクトを使う
..................................................................

*note LoggerAdapter: 150d. に渡すのは本物の dict でなくても構いません。
‘__getitem__’ と ‘__iter__’ を実装していて logging が辞書のように扱える
クラスのインスタンスを利用することができます。これは (dict の値が固定さ
れるのに対して) 値を動的に生成できるので便利です。


File: python.info,  Node: Filter を使ったコンテキスト情報の伝達,  Prev: LoggerAdapter を使ったコンテキスト情報の伝達,  Up: コンテキスト情報をログ記録出力に付加する

9.9.9.3 Filter を使ったコンテキスト情報の伝達
.............................................

ユーザ定義の *note Filter: 1414. を使ってログ出力にコンテキスト情報を加
えることもできます。 ‘Filter’ インスタンスは、渡された ‘LogRecords’ を修
正することができます。これにより、適切なフォーマット文字列や必要なら
*note Formatter: 16b0. を使って、出力となる属性を新しく追加することも出
来ます。

例えば、web アプリケーションで、処理されるリクエスト (または、少なくとも
その重要な部分) は、スレッドローカル (*note threading.local: 185f.) な変
数に保存して、 ‘Filter’ からアクセスすることで、 ‘LogRecord’ にリクエス
トの情報を追加できます。例えば、リモート IP アドレスやリモートユーザのユ
ーザ名にアクセスしたいなら、上述の ‘LoggerAdapter’ の例のように属性名
'ip' や 'user' を使うといったようにです。その場合、同じフォーマット文字
列を使って以下に示すように似たような出力を得られます。これはスクリプトの
例です:

     import logging
     from random import choice

     class ContextFilter(logging.Filter):
         """
         This is a filter which injects contextual information into the log.

         Rather than use actual contextual information, we just use random
         data in this demo.
         """

         USERS = ['jim', 'fred', 'sheila']
         IPS = ['123.231.231.123', '127.0.0.1', '192.168.0.1']

         def filter(self, record):

             record.ip = choice(ContextFilter.IPS)
             record.user = choice(ContextFilter.USERS)
             return True

     if __name__ == '__main__':
         levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL)
         logging.basicConfig(level=logging.DEBUG,
                             format='%(asctime)-15s %(name)-5s %(levelname)-8s IP: %(ip)-15s User: %(user)-8s %(message)s')
         a1 = logging.getLogger('a.b.c')
         a2 = logging.getLogger('d.e.f')

         f = ContextFilter()
         a1.addFilter(f)
         a2.addFilter(f)
         a1.debug('A debug message')
         a1.info('An info message with %s', 'some parameters')
         for x in range(10):
             lvl = choice(levels)
             lvlname = logging.getLevelName(lvl)
             a2.log(lvl, 'A message at %s level with %d %s', lvlname, 2, 'parameters')

実行すると、以下のようになります:

     2010-09-06 22:38:15,292 a.b.c DEBUG    IP: 123.231.231.123 User: fred     A debug message
     2010-09-06 22:38:15,300 a.b.c INFO     IP: 192.168.0.1     User: sheila   An info message with some parameters
     2010-09-06 22:38:15,300 d.e.f CRITICAL IP: 127.0.0.1       User: sheila   A message at CRITICAL level with 2 parameters
     2010-09-06 22:38:15,300 d.e.f ERROR    IP: 127.0.0.1       User: jim      A message at ERROR level with 2 parameters
     2010-09-06 22:38:15,300 d.e.f DEBUG    IP: 127.0.0.1       User: sheila   A message at DEBUG level with 2 parameters
     2010-09-06 22:38:15,300 d.e.f ERROR    IP: 123.231.231.123 User: fred     A message at ERROR level with 2 parameters
     2010-09-06 22:38:15,300 d.e.f CRITICAL IP: 192.168.0.1     User: jim      A message at CRITICAL level with 2 parameters
     2010-09-06 22:38:15,300 d.e.f CRITICAL IP: 127.0.0.1       User: sheila   A message at CRITICAL level with 2 parameters
     2010-09-06 22:38:15,300 d.e.f DEBUG    IP: 192.168.0.1     User: jim      A message at DEBUG level with 2 parameters
     2010-09-06 22:38:15,301 d.e.f ERROR    IP: 127.0.0.1       User: sheila   A message at ERROR level with 2 parameters
     2010-09-06 22:38:15,301 d.e.f DEBUG    IP: 123.231.231.123 User: fred     A message at DEBUG level with 2 parameters
     2010-09-06 22:38:15,301 d.e.f INFO     IP: 123.231.231.123 User: fred     A message at INFO level with 2 parameters


File: python.info,  Node: contextvars の利用,  Next: ハンドラ内でのコンテキスト情報の付与,  Prev: コンテキスト情報をログ記録出力に付加する,  Up: Logging クックブック

9.9.10 ‘contextvars’ の利用
---------------------------

Python 3.7 以降、 *note contextvars: 28. モジュールは *note threading:
f3. と *note asyncio: b. の両方の処理上のニーズを満たすコンテキストロー
カルな変数を提供しています。このタイプの変数はスレッドローカルな変数に適
しています。以下の例は、マルチスレッド環境において、 いかにして web アプ
リケーションによって処理されるリクエスト属性のような処理の文脈上の情報と
ともにログを投入できるかを示します。

説明のため、同じ Python プロセス上で共通のライブラリを使っている独立した
複数の web アプリケーションがあるとします。これらのアプリケーションが、
クライアントの IP アドレスや HTTP リクエストメソッド、およびクライアント
のユーザー名のようなコンテキスト依存の情報を追加情報として含んだ自身のロ
グを、共通のライブラリ (と他のリクエスト処理のためのコード) から各アプリ
ケーションのログファイルへ適切に振り向けるためにはどのようにしたら良いで
しょうか？

ここで、ライブラリは以下のコードで模することができるとします:

     # webapplib.py
     import logging
     import time

     logger = logging.getLogger(__name__)

     def useful():
         # Just a representative event logged from the library
         logger.debug('Hello from webapplib!')
         # Just sleep for a bit so other threads get to run
         time.sleep(0.01)

複数の web アプリケーションは2つの簡単なクラス, ‘Request’ と ‘WebApp’, に
よって模倣することができます。これらは実際のスレッド化された web アプリ
ケーションがどのように動作するかを模擬的にあらわしています - すなわち各
リクエストはスレッドで処理される状況です:

     # main.py
     import argparse
     from contextvars import ContextVar
     import logging
     import os
     from random import choice
     import threading
     import webapplib

     logger = logging.getLogger(__name__)
     root = logging.getLogger()
     root.setLevel(logging.DEBUG)

     class Request:
         """
         A simple dummy request class which just holds dummy HTTP request method,
         client IP address and client username
         """
         def __init__(self, method, ip, user):
             self.method = method
             self.ip = ip
             self.user = user

     # A dummy set of requests which will be used in the simulation - we'll just pick
     # from this list randomly. Note that all GET requests are from 192.168.2.XXX
     # addresses, whereas POST requests are from 192.16.3.XXX addresses. Three users
     # are represented in the sample requests.

     REQUESTS = [
         Request('GET', '192.168.2.20', 'jim'),
         Request('POST', '192.168.3.20', 'fred'),
         Request('GET', '192.168.2.21', 'sheila'),
         Request('POST', '192.168.3.21', 'jim'),
         Request('GET', '192.168.2.22', 'fred'),
         Request('POST', '192.168.3.22', 'sheila'),
     ]

     # Note that the format string includes references to request context information
     # such as HTTP method, client IP and username

     formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s %(user)-6s %(ip)s %(method)-4s %(message)s')

     # Create our context variables. These will be filled at the start of request
     # processing, and used in the logging that happens during that processing

     ctx_request = ContextVar('request')
     ctx_appname = ContextVar('appname')

     class InjectingFilter(logging.Filter):
         """
         A filter which injects context-specific information into logs and ensures
         that only information for a specific webapp is included in its log
         """
         def __init__(self, app):
             self.app = app

         def filter(self, record):
             request = ctx_request.get()
             record.method = request.method
             record.ip = request.ip
             record.user = request.user
             record.appName = appName = ctx_appname.get()
             return appName == self.app.name

     class WebApp:
         """
         A dummy web application class which has its own handler and filter for a
         webapp-specific log.
         """
         def __init__(self, name):
             self.name = name
             handler = logging.FileHandler(name + '.log', 'w')
             f = InjectingFilter(self)
             handler.setFormatter(formatter)
             handler.addFilter(f)
             root.addHandler(handler)
             self.num_requests = 0

         def process_request(self, request):
             """
             This is the dummy method for processing a request. It's called on a
             different thread for every request. We store the context information into
             the context vars before doing anything else.
             """
             ctx_request.set(request)
             ctx_appname.set(self.name)
             self.num_requests += 1
             logger.debug('Request processing started')
             webapplib.useful()
             logger.debug('Request processing finished')

     def main():
         fn = os.path.splitext(os.path.basename(__file__))[0]
         adhf = argparse.ArgumentDefaultsHelpFormatter
         ap = argparse.ArgumentParser(formatter_class=adhf, prog=fn,
                                      description='Simulate a couple of web '
                                                  'applications handling some '
                                                  'requests, showing how request '
                                                  'context can be used to '
                                                  'populate logs')
         aa = ap.add_argument
         aa('--count', '-c', type=int, default=100, help='How many requests to simulate')
         options = ap.parse_args()

         # Create the dummy webapps and put them in a list which we can use to select
         # from randomly
         app1 = WebApp('app1')
         app2 = WebApp('app2')
         apps = [app1, app2]
         threads = []
         # Add a common handler which will capture all events
         handler = logging.FileHandler('app.log', 'w')
         handler.setFormatter(formatter)
         root.addHandler(handler)

         # Generate calls to process requests
         for i in range(options.count):
             try:
                 # Pick an app at random and a request for it to process
                 app = choice(apps)
                 request = choice(REQUESTS)
                 # Process the request in its own thread
                 t = threading.Thread(target=app.process_request, args=(request,))
                 threads.append(t)
                 t.start()
             except KeyboardInterrupt:
                 break

         # Wait for the threads to terminate
         for t in threads:
             t.join()

         for app in apps:
             print('%s processed %s requests' % (app.name, app.num_requests))

     if __name__ == '__main__':
         main()

上記のコードを実行すると、およそ半分のリクエストが ‘app1.log’ に、残り半
分が ‘app2.log’ にそれぞれ記録され、同時に全てのリクエストが ‘app.log’ に
記録されることがわかるでしょう。それぞれの web アプリケーション固有のロ
グはそれぞれのアプリケーションからのログエントリだけを含み、リクエスト情
報が矛盾なくログに表示されている (すなわち、各ダミーリクエストの情報は常
にログの行とともに現れる) はずです。このことは以下のシェルコマンドの出力
により例示されています:

     ~/logging-contextual-webapp$ python main.py
     app1 processed 51 requests
     app2 processed 49 requests
     ~/logging-contextual-webapp$ wc -l *.log
       153 app1.log
       147 app2.log
       300 app.log
       600 total
     ~/logging-contextual-webapp$ head -3 app1.log
     Thread-3 (process_request) app1 __main__  jim    192.168.3.21 POST Request processing started
     Thread-3 (process_request) app1 webapplib jim    192.168.3.21 POST Hello from webapplib!
     Thread-5 (process_request) app1 __main__  jim    192.168.3.21 POST Request processing started
     ~/logging-contextual-webapp$ head -3 app2.log
     Thread-1 (process_request) app2 __main__  sheila 192.168.2.21 GET  Request processing started
     Thread-1 (process_request) app2 webapplib sheila 192.168.2.21 GET  Hello from webapplib!
     Thread-2 (process_request) app2 __main__  jim    192.168.2.20 GET  Request processing started
     ~/logging-contextual-webapp$ head app.log
     Thread-1 (process_request) app2 __main__  sheila 192.168.2.21 GET  Request processing started
     Thread-1 (process_request) app2 webapplib sheila 192.168.2.21 GET  Hello from webapplib!
     Thread-2 (process_request) app2 __main__  jim    192.168.2.20 GET  Request processing started
     Thread-3 (process_request) app1 __main__  jim    192.168.3.21 POST Request processing started
     Thread-2 (process_request) app2 webapplib jim    192.168.2.20 GET  Hello from webapplib!
     Thread-3 (process_request) app1 webapplib jim    192.168.3.21 POST Hello from webapplib!
     Thread-4 (process_request) app2 __main__  fred   192.168.2.22 GET  Request processing started
     Thread-5 (process_request) app1 __main__  jim    192.168.3.21 POST Request processing started
     Thread-4 (process_request) app2 webapplib fred   192.168.2.22 GET  Hello from webapplib!
     Thread-6 (process_request) app1 __main__  jim    192.168.3.21 POST Request processing started
     ~/logging-contextual-webapp$ grep app1 app1.log | wc -l
     153
     ~/logging-contextual-webapp$ grep app2 app2.log | wc -l
     147
     ~/logging-contextual-webapp$ grep app1 app.log | wc -l
     153
     ~/logging-contextual-webapp$ grep app2 app.log | wc -l
     147


File: python.info,  Node: ハンドラ内でのコンテキスト情報の付与,  Next: 複数のプロセスからの単一ファイルへのログ記録,  Prev: contextvars の利用,  Up: Logging クックブック

9.9.11 ハンドラ内でのコンテキスト情報の付与
-------------------------------------------

*note Handler: 16af. はそれぞれ一連のフィルタを独自に持っています。コン
テキスト情報を、他のハンドラに漏らすことなく *note LogRecord: 11e8. に付
加したい場合、以下に示すスクリプトのように、直接レコードを編集する代わり
に新しい *note LogRecord: 11e8. を返すフィルタを使うことができます:

     import copy
     import logging

     def filter(record: logging.LogRecord):
         record = copy.copy(record)
         record.user = 'jim'
         return record

     if __name__ == '__main__':
         logger = logging.getLogger()
         logger.setLevel(logging.INFO)
         handler = logging.StreamHandler()
         formatter = logging.Formatter('%(message)s from %(user)-8s')
         handler.setFormatter(formatter)
         handler.addFilter(filter)
         logger.addHandler(handler)

         logger.info('A log message')


File: python.info,  Node: 複数のプロセスからの単一ファイルへのログ記録,  Next: ファイルをローテートする,  Prev: ハンドラ内でのコンテキスト情報の付与,  Up: Logging クックブック

9.9.12 複数のプロセスからの単一ファイルへのログ記録
---------------------------------------------------

ログ記録はスレッドセーフであり、単一プロセスの複数のスレッドからの単一フ
ァイルへのログ記録はサポート 'されています' が、 '複数プロセス' からの単
一ファイルへのログ記録はサポート 'されません' 。なぜなら、複数のプロセス
をまたいで単一のファイルへのアクセスを直列化する標準の方法が Python には
存在しないからです。複数のプロセスから単一ファイルへログ記録しなければな
らないなら、最も良い方法は、すべてのプロセスが *note SocketHandler:
1164. に対してログ記録を行い、独立したプロセスとしてソケットサーバを動か
すことです。ソケットサーバはソケットから読み取ってファイルにログを書き出
します。 (この機能を実行するために、既存のプロセスの 1 つのスレッドを割
り当てることもできます) *note この節: 576d. では、このアプローチをさらに
詳細に文書化しています。動作するソケット受信プログラムが含まれているので
、アプリケーションに組み込むための出発点として使用できるでしょう。

You could also write your own handler which uses the *note Lock: 1853.
class from the *note multiprocessing: 98. module to serialize access to
the file from your processes.  The stdlib *note FileHandler: 1c53. and
subclasses do not make use of *note multiprocessing: 98.

別の方法として、 ‘Queue’ と *note QueueHandler: 1b61. を使って、マルチプ
ロセスアプリケーションの1つのプロセスに全ての logging イベントを送る事が
できます。次の例はこれを行う方法を示します。この例では独立した listener
プロセスが他のプロセスから送られた event を受け取り、それを独自の
logging 設定にしたがって保存します。この例は実装の方法の1つを示している
だけ (例えば、 listener プロセスを分離する代わりに listener スレッドを使
うこともできます) ですが、これは listener とアプリケーション内の他のプロ
セスで完全に異なる設定を使う例になっているので、各自の要求に応じたコード
を書く叩き台になるでしょう:

     # You'll need these imports in your own code
     import logging
     import logging.handlers
     import multiprocessing

     # Next two import lines for this demo only
     from random import choice, random
     import time

     #
     # Because you'll want to define the logging configurations for listener and workers, the
     # listener and worker process functions take a configurer parameter which is a callable
     # for configuring logging for that process. These functions are also passed the queue,
     # which they use for communication.
     #
     # In practice, you can configure the listener however you want, but note that in this
     # simple example, the listener does not apply level or filter logic to received records.
     # In practice, you would probably want to do this logic in the worker processes, to avoid
     # sending events which would be filtered out between processes.
     #
     # The size of the rotated files is made small so you can see the results easily.
     def listener_configurer():
         root = logging.getLogger()
         h = logging.handlers.RotatingFileHandler('mptest.log', 'a', 300, 10)
         f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s %(levelname)-8s %(message)s')
         h.setFormatter(f)
         root.addHandler(h)

     # This is the listener process top-level loop: wait for logging events
     # (LogRecords)on the queue and handle them, quit when you get a None for a
     # LogRecord.
     def listener_process(queue, configurer):
         configurer()
         while True:
             try:
                 record = queue.get()
                 if record is None:  # We send this as a sentinel to tell the listener to quit.
                     break
                 logger = logging.getLogger(record.name)
                 logger.handle(record)  # No level or filter logic applied - just do it!
             except Exception:
                 import sys, traceback
                 print('Whoops! Problem:', file=sys.stderr)
                 traceback.print_exc(file=sys.stderr)

     # Arrays used for random selections in this demo

     LEVELS = [logging.DEBUG, logging.INFO, logging.WARNING,
               logging.ERROR, logging.CRITICAL]

     LOGGERS = ['a.b.c', 'd.e.f']

     MESSAGES = [
         'Random message #1',
         'Random message #2',
         'Random message #3',
     ]

     # The worker configuration is done at the start of the worker process run.
     # Note that on Windows you can't rely on fork semantics, so each process
     # will run the logging configuration code when it starts.
     def worker_configurer(queue):
         h = logging.handlers.QueueHandler(queue)  # Just the one handler needed
         root = logging.getLogger()
         root.addHandler(h)
         # send all messages, for demo; no other level or filter logic applied.
         root.setLevel(logging.DEBUG)

     # This is the worker process top-level loop, which just logs ten events with
     # random intervening delays before terminating.
     # The print messages are just so you know it's doing something!
     def worker_process(queue, configurer):
         configurer(queue)
         name = multiprocessing.current_process().name
         print('Worker started: %s' % name)
         for i in range(10):
             time.sleep(random())
             logger = logging.getLogger(choice(LOGGERS))
             level = choice(LEVELS)
             message = choice(MESSAGES)
             logger.log(level, message)
         print('Worker finished: %s' % name)

     # Here's where the demo gets orchestrated. Create the queue, create and start
     # the listener, create ten workers and start them, wait for them to finish,
     # then send a None to the queue to tell the listener to finish.
     def main():
         queue = multiprocessing.Queue(-1)
         listener = multiprocessing.Process(target=listener_process,
                                            args=(queue, listener_configurer))
         listener.start()
         workers = []
         for i in range(10):
             worker = multiprocessing.Process(target=worker_process,
                                              args=(queue, worker_configurer))
             workers.append(worker)
             worker.start()
         for w in workers:
             w.join()
         queue.put_nowait(None)
         listener.join()

     if __name__ == '__main__':
         main()

上のスクリプトの亜種で、logging をメインプロセスの別スレッドで行う例:

     import logging
     import logging.config
     import logging.handlers
     from multiprocessing import Process, Queue
     import random
     import threading
     import time

     def logger_thread(q):
         while True:
             record = q.get()
             if record is None:
                 break
             logger = logging.getLogger(record.name)
             logger.handle(record)


     def worker_process(q):
         qh = logging.handlers.QueueHandler(q)
         root = logging.getLogger()
         root.setLevel(logging.DEBUG)
         root.addHandler(qh)
         levels = [logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,
                   logging.CRITICAL]
         loggers = ['foo', 'foo.bar', 'foo.bar.baz',
                    'spam', 'spam.ham', 'spam.ham.eggs']
         for i in range(100):
             lvl = random.choice(levels)
             logger = logging.getLogger(random.choice(loggers))
             logger.log(lvl, 'Message no. %d', i)

     if __name__ == '__main__':
         q = Queue()
         d = {
             'version': 1,
             'formatters': {
                 'detailed': {
                     'class': 'logging.Formatter',
                     'format': '%(asctime)s %(name)-15s %(levelname)-8s %(processName)-10s %(message)s'
                 }
             },
             'handlers': {
                 'console': {
                     'class': 'logging.StreamHandler',
                     'level': 'INFO',
                 },
                 'file': {
                     'class': 'logging.FileHandler',
                     'filename': 'mplog.log',
                     'mode': 'w',
                     'formatter': 'detailed',
                 },
                 'foofile': {
                     'class': 'logging.FileHandler',
                     'filename': 'mplog-foo.log',
                     'mode': 'w',
                     'formatter': 'detailed',
                 },
                 'errors': {
                     'class': 'logging.FileHandler',
                     'filename': 'mplog-errors.log',
                     'mode': 'w',
                     'level': 'ERROR',
                     'formatter': 'detailed',
                 },
             },
             'loggers': {
                 'foo': {
                     'handlers': ['foofile']
                 }
             },
             'root': {
                 'level': 'DEBUG',
                 'handlers': ['console', 'file', 'errors']
             },
         }
         workers = []
         for i in range(5):
             wp = Process(target=worker_process, name='worker %d' % (i + 1), args=(q,))
             workers.append(wp)
             wp.start()
         logging.config.dictConfig(d)
         lp = threading.Thread(target=logger_thread, args=(q,))
         lp.start()
         # At this point, the main process could do some useful work of its own
         # Once it's done that, it can wait for the workers to terminate...
         for wp in workers:
             wp.join()
         # And now tell the logging thread to finish up, too
         q.put(None)
         lp.join()

こちらは特定の logger に設定を適用する例になっています。‘foo’ logger は
‘foo’ サブシステムの中の全てのイベントを ‘mplog-foo.log’ に保存する特別
な handler を持っています。これはメインプロセス側の log 処理で使われ、
(logging イベントは worker プロセス側で生成されますが) 各メッセージを適
切な出力先に出力します。

* Menu:

* concurrent.futures.ProcessPoolExecutorの利用: concurrent futures ProcessPoolExecutorの利用.
* Gunicorn と uWSGI を用いた Web アプリケーションのデプロイ::


File: python.info,  Node: concurrent futures ProcessPoolExecutorの利用,  Next: Gunicorn と uWSGI を用いた Web アプリケーションのデプロイ,  Up: 複数のプロセスからの単一ファイルへのログ記録

9.9.12.1 concurrent.futures.ProcessPoolExecutorの利用
.....................................................

もし、ワーカープロセスを起動するために *note
concurrent.futures.ProcessPoolExecutor: 1d6. を使いたいのであれば、少し
違う方法でキューを作る必要があります。次のような方法の代わりに

     queue = multiprocessing.Queue(-1)

次のコードを利用する必要があります

     queue = multiprocessing.Manager().Queue(-1)  # also works with the examples above

そして、次のようなワーカー作成コードがあったとすると:

     workers = []
     for i in range(10):
         worker = multiprocessing.Process(target=worker_process,
                                          args=(queue, worker_configurer))
         workers.append(worker)
         worker.start()
     for w in workers:
         w.join()

次のように変更します（最初に *note concurrent.futures: 24. をインポート
するのを忘れないようにしましょう）:

     with concurrent.futures.ProcessPoolExecutor(max_workers=10) as executor:
         for i in range(10):
             executor.submit(worker_process, queue, worker_configurer)


File: python.info,  Node: Gunicorn と uWSGI を用いた Web アプリケーションのデプロイ,  Prev: concurrent futures ProcessPoolExecutorの利用,  Up: 複数のプロセスからの単一ファイルへのログ記録

9.9.12.2 Gunicorn と uWSGI を用いた Web アプリケーションのデプロイ
..................................................................

Gunicorn(1) や uWSGI(2) (またはそれに類するもの) を使って Web アプリケー
ションをデプロイする場合、クライアントのリクエストを処理するために複数の
ワーカープロセスが作られます。そのような環境では、 web アプリケーション
に直接ファイルベースのハンドラを作ることは避けてください。 代わりに、
*note SocketHandler: 1164. を使って別のプロセスとして動作するリスナーに
web アプリケーションからログを送信するようにしてください。これは
Supervisor のようなプロセス管理ツールを使うことで設定できます - 詳しくは
*note 作成中のロギングソケットのリスナーを実行する: 576f. を参照してくだ
さい。

   ---------- Footnotes ----------

   (1) https://gunicorn.org/

   (2) https://uwsgi-docs.readthedocs.io/en/latest/


File: python.info,  Node: ファイルをローテートする,  Next: 別の format スタイルを利用する,  Prev: 複数のプロセスからの単一ファイルへのログ記録,  Up: Logging クックブック

9.9.13 ファイルをローテートする
-------------------------------

ログファイルがある大きさに達したら、新しいファイルを開いてそこにログを取
りたいことがあります。そのファイルをある数だけ残し、その数のファイルが生
成されたらファイルを循環し、ファイルの数も大きさも制限したいこともあるで
しょう。この利用パターンのために、 logging パッケージは *note
RotatingFileHandler: 1941. を提供しています:

     import glob
     import logging
     import logging.handlers

     LOG_FILENAME = 'logging_rotatingfile_example.out'

     # Set up a specific logger with our desired output level
     my_logger = logging.getLogger('MyLogger')
     my_logger.setLevel(logging.DEBUG)

     # Add the log message handler to the logger
     handler = logging.handlers.RotatingFileHandler(
                   LOG_FILENAME, maxBytes=20, backupCount=5)

     my_logger.addHandler(handler)

     # Log some messages
     for i in range(20):
         my_logger.debug('i = %d' % i)

     # See what files are created
     logfiles = glob.glob('%s*' % LOG_FILENAME)

     for filename in logfiles:
         print(filename)

この結果として、アプリケーションのログ履歴の一部である、6 つに別れたファ
イルが得られます:

     logging_rotatingfile_example.out
     logging_rotatingfile_example.out.1
     logging_rotatingfile_example.out.2
     logging_rotatingfile_example.out.3
     logging_rotatingfile_example.out.4
     logging_rotatingfile_example.out.5

最新のファイルはいつでも ‘logging_rotatingfile_example.out’ で、サイズの
上限に達するたびに拡張子 ‘.1’ を付けた名前に改名されます。既にあるバック
アップファイルはその拡張子がインクリメントされ (‘.1’ が ‘.2’ になるなど
)、 ‘.6’ ファイルは消去されます。

明らかに、ここでは極端な例示のためにファイルの大きさをかなり小さな値に設
定しています。実際に使うときは 'maxBytes' を適切な値に設定してください。


File: python.info,  Node: 別の format スタイルを利用する,  Next: LogRecord のカスタマイズ,  Prev: ファイルをローテートする,  Up: Logging クックブック

9.9.14 別の format スタイルを利用する
-------------------------------------

logging が Python 標準ライブラリに追加された時、メッセージを動的な内容で
フォーマットする唯一の方法は % を使ったフォーマットでした。その後、
Python には新しい文字列フォーマット機構として *note string.Template:
897. (Python 2.4 で追加) と *note str.format(): 833. (Python 2.6 で追加)
が加わりました。

logging は (3.2 から) この2つの追加されたフォーマット方法をサポートして
います。 *note Formatter: 16b0. クラスが ‘style’ という名前のオプション
のキーワード引数を受け取ります。このデフォルト値は ‘'%'’ ですが、他に
‘'{'’ と ‘'$'’ が指定可能で、それぞれのフォーマット方法に対応しています
。後方互換性はデフォルト値によって維持されていますが、明示的に style 引
数を指定することで、 *note str.format(): 833. か *note string.Template:
897. を使った format を指定する事ができます。次の例はこの機能を使ってみ
ています:

     >>> import logging
     >>> root = logging.getLogger()
     >>> root.setLevel(logging.DEBUG)
     >>> handler = logging.StreamHandler()
     >>> bf = logging.Formatter('{asctime} {name} {levelname:8s} {message}',
     ...                        style='{')
     >>> handler.setFormatter(bf)
     >>> root.addHandler(handler)
     >>> logger = logging.getLogger('foo.bar')
     >>> logger.debug('This is a DEBUG message')
     2010-10-28 15:11:55,341 foo.bar DEBUG    This is a DEBUG message
     >>> logger.critical('This is a CRITICAL message')
     2010-10-28 15:12:11,526 foo.bar CRITICAL This is a CRITICAL message
     >>> df = logging.Formatter('$asctime $name ${levelname} $message',
     ...                        style='$')
     >>> handler.setFormatter(df)
     >>> logger.debug('This is a DEBUG message')
     2010-10-28 15:13:06,924 foo.bar DEBUG This is a DEBUG message
     >>> logger.critical('This is a CRITICAL message')
     2010-10-28 15:13:11,494 foo.bar CRITICAL This is a CRITICAL message
     >>>

最終的に出力されるログメッセージの format と、各メッセージを生成する部分
は完全に独立していることに注意してください。次の例でわかるように、メッセ
ージを生成する部分では % を使い続けています:

     >>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message')
     2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message
     >>>

logging の呼び出し (‘logger.debug()’ や ‘logger.info()’ など) は、ログメ
ッセージのために位置引数しか受け取らず、キーワード引数はそれを処理すると
きのオプションを指定するためだけに使われます。 (例えば、 ‘exc_info’ キー
ワード引数を使ってログを取るトレースバック情報を指定したり、 ‘extra’ キ
ーワード引数を使ってログに付与する追加のコンテキスト情報を指定します。)
logging パッケージは内部で % を使って format 文字列と引数をマージしてい
るので、 *note str.format(): 833. や *note string.Template: 897. を使っ
て logging を呼び出す事はできません。既存の logging 呼び出しは %-format
を使っているので、後方互換性のためにこの部分を変更することはできません。

しかし、{} や $ を使ってログメッセージをフォーマットする方法はあります。
ログメッセージには任意のオブジェクトを format 文字列として渡すことができ
、logging パッケージはそのオブジェクトに対して ‘str()’ を使って実際の
format 文字列を生成します。次の2つのクラスを見てください:

     class BraceMessage:
         def __init__(self, fmt, /, *args, **kwargs):
             self.fmt = fmt
             self.args = args
             self.kwargs = kwargs

         def __str__(self):
             return self.fmt.format(*self.args, **self.kwargs)

     class DollarMessage:
         def __init__(self, fmt, /, **kwargs):
             self.fmt = fmt
             self.kwargs = kwargs

         def __str__(self):
             from string import Template
             return Template(self.fmt).substitute(**self.kwargs)

どちらのクラスも format 文字列の代わりに利用して、 {} や $ を使って実際
のログの "%(message)s", "{message}", "$message" で指定された "message" 部
分を生成することができます。これは何かログを取りたいときに常に使うには使
いにくいクラス名ですが、 __ (アンダースコア2つ -- *note
gettext.gettext(): 1682. やその仲間によくエイリアスとして使われるアンダ
ースコア1つと混同しないように) などの使いやすいエイリアスを使うことがで
きます。

上のクラスは Python には含まれませんが、自分のコードにコピペして使うのは
簡単です。これらは次の例のようにして利用できます。(上のクラスが
‘wherever’ というモジュールで定義されていると仮定します):

     >>> from wherever import BraceMessage as __
     >>> print(__('Message with {0} {name}', 2, name='placeholders'))
     Message with 2 placeholders
     >>> class Point: pass
     ...
     >>> p = Point()
     >>> p.x = 0.5
     >>> p.y = 0.5
     >>> print(__('Message with coordinates: ({point.x:.2f}, {point.y:.2f})',
     ...       point=p))
     Message with coordinates: (0.50, 0.50)
     >>> from wherever import DollarMessage as __
     >>> print(__('Message with $num $what', num=2, what='placeholders'))
     Message with 2 placeholders
     >>>

上の例ではフォーマットの動作を示すために ‘print()’ を使っていますが、も
ちろん実際にこの方法でログを出力するには ‘logger.debug()’ などを使います
。

注意点として、この方法には大きなパフォーマンスのペナルティはありません。
実際のフォーマット操作は logging の呼び出し時ではなくて、メッセージが実
際に handler によって出力されるときに起こります。(出力されないならフォー
マットもされません) そのため、この方法で注意しないといけないのは、追加の
括弧が書式文字列だけではなく引数も囲わないといけないことだけです。これは
__ が ‘XXXMessage’ クラスのコンストラクタ呼び出しのシンタックスシュガー
でしか無いからです。

次の例のように、 *note LoggerAdapter: 150d. を利用して上と似たような効果
を実現する方法もあります:

     import logging

     class Message:
         def __init__(self, fmt, args):
             self.fmt = fmt
             self.args = args

         def __str__(self):
             return self.fmt.format(*self.args)

     class StyleAdapter(logging.LoggerAdapter):
         def log(self, level, msg, /, *args, stacklevel=1, **kwargs):
             if self.isEnabledFor(level):
                 msg, kwargs = self.process(msg, kwargs)
                 self.logger.log(level, Message(msg, args), **kwargs,
                                 stacklevel=stacklevel+1)

     logger = StyleAdapter(logging.getLogger(__name__))

     def main():
         logger.debug('Hello, {}', 'world!')

     if __name__ == '__main__':
         logging.basicConfig(level=logging.DEBUG)
         main()

上のスクリプトは Python 3.8 以降では ‘Hello, world!’ というメッセージを
ログするはずです。


File: python.info,  Node: LogRecord のカスタマイズ,  Next: Subclassing QueueHandler and QueueListener- a ZeroMQ example,  Prev: 別の format スタイルを利用する,  Up: Logging クックブック

9.9.15 ‘LogRecord’ のカスタマイズ
---------------------------------

全ての logging イベントは *note LogRecord: 11e8. のインスタンスとして表
現されます。イベントのログが取られて logger のレベルでフィルタされなかっ
た場合、イベントの情報を含む *note LogRecord: 11e8. が生成され、その
logger (と、 propagate が無効になるまでの上位 logger) の handler に渡さ
れます。 Python 3.2 までは、この生成が行われているのは2箇所だけでした:

   * *note Logger.makeRecord(): 3164.: 通常のイベント logging プロセスで
     呼ばれます。これは *note LogRecord: 11e8. を直接読んでインスタンス
     を生成します。

   * *note makeLogRecord(): 318a.: LogRecord に追加される属性を含む辞書
     を渡して呼び出されます。これはネットワーク越しに (pickle 形式で
     *note SocketHandler: 1164. 経由で、あるいは JSON 形式で *note
     HTTPHandler: 102c. 経由で) 辞書を受け取った場合などに利用されます。

そのために *note LogRecord: 11e8. で何か特別なことをしたい場合は、次のど
ちらかをしなければなりません。

   * *note Logger.makeRecord(): 3164. をオーバーライドした独自の *note
     Logger: d46. のサブクラスを作り、利用したい logger のどれかがインス
     タンス化される前に、それを *note setLoggerClass(): 3199. を使って登
     録する。

   * *note filter(): 3185. メソッドで必要な特殊な処理を行う *note
     Filter: 1414. を logger か handler に追加する。

最初の方法は、複数の異なるライブラリが別々のことをしようとした場合にうま
く行きません。各ライブラリが独自の *note Logger: d46. のサブクラスを登録
しようとして、最後に登録されたライブラリが生き残ります。

2つ目の方法はほとんどのケースでうまくいきますが、たとえば *note
LogRecord: 11e8. を特殊化したサブクラスを使うことなどはできません。ライ
ブラリの開発者は利用している logger に適切な filter を設定できますが、新
しい logger を作るたびに忘れずに設定しないといけなくなります。 (新しいパ
ッケージやモジュールを追加し、モジュールレベルで次の式を実行することで、
新しい logger が作られます)

     logger = logging.getLogger(__name__)

これでは考えることが余計に1つ増えてしまうでしょう。開発者は、最も高いレ
ベルのロガーに取り付けられた *note NullHandler: 149c. に、フィルタを追加
することもできますが、アプリケーション開発者が、より低いレベルに対するラ
イブラリのロガーにハンドラを取り付けた場合、フィルタは呼び出されません
-- 従って、そのハンドラからの出力はライブラリ開発者の意図を反映したもの
にはなりません。

Python 3.2 以降では、 *note LogRecord: 11e8. の生成は、指定できるファク
トリ経由になります。ファクトリは callable で、 *note
setLogRecordFactory(): 318e. で登録でき、 *note getLogRecordFactory():
318d. で現在のファクトリを取得できます。ファクトリは *note LogRecord:
11e8. コンストラクタと同じシグネチャで呼び出され、 *note LogRecord:
11e8. がデフォルトのファクトリとして設定されています。

このアプローチはカスタムのファクトリが LogRecord の生成のすべての面を制
御できるようにしています。たとえば、サブクラスを返したり、次のようなパタ
ーンを使って単に属性を追加することができます:

     old_factory = logging.getLogRecordFactory()

     def record_factory(*args, **kwargs):
         record = old_factory(*args, **kwargs)
         record.custom_attribute = 0xdecafbad
         return record

     logging.setLogRecordFactory(record_factory)

このアプローチでは複数の異なるライブラリがファクトリをチェインさせて、お
互いに同じ属性を上書きしたり、標準で提供されている属性を意図せず上書きし
ない限りはうまくいきます。しかし、チェインのつながり全てが、全ての
logging の操作に対しての実行時のオーバーヘッドになることを念頭に置き、こ
のテクニックは *note Filter: 1414. を利用するだけでは望む結果が得られな
い場合にのみ使うべきです。


File: python.info,  Node: Subclassing QueueHandler and QueueListener- a ZeroMQ example,  Next: Subclassing QueueHandler and QueueListener- a pynng example,  Prev: LogRecord のカスタマイズ,  Up: Logging クックブック

9.9.16 Subclassing QueueHandler and QueueListener- a ZeroMQ example
-------------------------------------------------------------------

* Menu:

* Subclass QueueHandler::
* Subclass QueueListener::


File: python.info,  Node: Subclass QueueHandler,  Next: Subclass QueueListener,  Up: Subclassing QueueHandler and QueueListener- a ZeroMQ example

9.9.16.1 Subclass ‘QueueHandler’
................................

*note QueueHandler: 1b61. のサブクラスを作ってメッセージを他のキュー、例
えば ZeroMQ の 'publish' ソケットに送信することができます。下の例では、
ソケットを別に作ってそれを handler に ('queue' として) 渡します:

     import zmq   # using pyzmq, the Python binding for ZeroMQ
     import json  # for serializing records portably

     ctx = zmq.Context()
     sock = zmq.Socket(ctx, zmq.PUB)  # or zmq.PUSH, or other suitable value
     sock.bind('tcp://*:5556')        # or wherever

     class ZeroMQSocketHandler(QueueHandler):
         def enqueue(self, record):
             self.queue.send_json(record.__dict__)


     handler = ZeroMQSocketHandler(sock)

もちろん同じことを別の設計でもできます。socket を作るのに必要な情報を
handler に渡す例です:

     class ZeroMQSocketHandler(QueueHandler):
         def __init__(self, uri, socktype=zmq.PUB, ctx=None):
             self.ctx = ctx or zmq.Context()
             socket = zmq.Socket(self.ctx, socktype)
             socket.bind(uri)
             super().__init__(socket)

         def enqueue(self, record):
             self.queue.send_json(record.__dict__)

         def close(self):
             self.queue.close()


File: python.info,  Node: Subclass QueueListener,  Prev: Subclass QueueHandler,  Up: Subclassing QueueHandler and QueueListener- a ZeroMQ example

9.9.16.2 Subclass ‘QueueListener’
.................................

*note QueueListener: 242. のサブクラスを作って、メッセージを他のキュー、
例えば ZeroMQ の 'subscribe' ソケットから取得する事もできます。サンプル
です:

     class ZeroMQSocketListener(QueueListener):
         def __init__(self, uri, /, *handlers, **kwargs):
             self.ctx = kwargs.get('ctx') or zmq.Context()
             socket = zmq.Socket(self.ctx, zmq.SUB)
             socket.setsockopt_string(zmq.SUBSCRIBE, '')  # subscribe to everything
             socket.connect(uri)
             super().__init__(socket, *handlers, **kwargs)

         def dequeue(self):
             msg = self.queue.recv_json()
             return logging.makeLogRecord(msg)


File: python.info,  Node: Subclassing QueueHandler and QueueListener- a pynng example,  Next: 辞書ベースで構成する例,  Prev: Subclassing QueueHandler and QueueListener- a ZeroMQ example,  Up: Logging クックブック

9.9.17 Subclassing QueueHandler and QueueListener- a ‘pynng’ example
--------------------------------------------------------------------

In a similar way to the above section, we can implement a listener and
handler using pynng(1), which is a Python binding to NNG(2), billed as a
spiritual successor to ZeroMQ. The following snippets illustrate - you
can test them in an environment which has ‘pynng’ installed.  Just for
variety, we present the listener first.

* Menu:

* Subclass QueueListener: Subclass QueueListener<2>.
* Subclass QueueHandler: Subclass QueueHandler<2>.

   ---------- Footnotes ----------

   (1) https://pypi.org/project/pynng/

   (2) https://nng.nanomsg.org/


File: python.info,  Node: Subclass QueueListener<2>,  Next: Subclass QueueHandler<2>,  Up: Subclassing QueueHandler and QueueListener- a pynng example

9.9.17.1 Subclass ‘QueueListener’
.................................

     # listener.py
     import json
     import logging
     import logging.handlers

     import pynng

     DEFAULT_ADDR = "tcp://localhost:13232"

     interrupted = False

     class NNGSocketListener(logging.handlers.QueueListener):

         def __init__(self, uri, /, *handlers, **kwargs):
             # Have a timeout for interruptability, and open a
             # subscriber socket
             socket = pynng.Sub0(listen=uri, recv_timeout=500)
             # The b'' subscription matches all topics
             topics = kwargs.pop('topics', None) or b''
             socket.subscribe(topics)
             # We treat the socket as a queue
             super().__init__(socket, *handlers, **kwargs)

         def dequeue(self, block):
             data = None
             # Keep looping while not interrupted and no data received over the
             # socket
             while not interrupted:
                 try:
                     data = self.queue.recv(block=block)
                     break
                 except pynng.Timeout:
                     pass
                 except pynng.Closed:  # sometimes happens when you hit Ctrl-C
                     break
             if data is None:
                 return None
             # Get the logging event sent from a publisher
             event = json.loads(data.decode('utf-8'))
             return logging.makeLogRecord(event)

         def enqueue_sentinel(self):
             # Not used in this implementation, as the socket isn't really a
             # queue
             pass

     logging.getLogger('pynng').propagate = False
     listener = NNGSocketListener(DEFAULT_ADDR, logging.StreamHandler(), topics=b'')
     listener.start()
     print('Press Ctrl-C to stop.')
     try:
         while True:
             pass
     except KeyboardInterrupt:
         interrupted = True
     finally:
         listener.stop()


File: python.info,  Node: Subclass QueueHandler<2>,  Prev: Subclass QueueListener<2>,  Up: Subclassing QueueHandler and QueueListener- a pynng example

9.9.17.2 Subclass ‘QueueHandler’
................................

     # sender.py
     import json
     import logging
     import logging.handlers
     import time
     import random

     import pynng

     DEFAULT_ADDR = "tcp://localhost:13232"

     class NNGSocketHandler(logging.handlers.QueueHandler):

         def __init__(self, uri):
             socket = pynng.Pub0(dial=uri, send_timeout=500)
             super().__init__(socket)

         def enqueue(self, record):
             # Send the record as UTF-8 encoded JSON
             d = dict(record.__dict__)
             data = json.dumps(d)
             self.queue.send(data.encode('utf-8'))

         def close(self):
             self.queue.close()

     logging.getLogger('pynng').propagate = False
     handler = NNGSocketHandler(DEFAULT_ADDR)
     # Make sure the process ID is in the output
     logging.basicConfig(level=logging.DEBUG,
                         handlers=[logging.StreamHandler(), handler],
                         format='%(levelname)-8s %(name)10s %(process)6s %(message)s')
     levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,
               logging.CRITICAL)
     logger_names = ('myapp', 'myapp.lib1', 'myapp.lib2')
     msgno = 1
     while True:
         # Just randomly select some loggers and levels and log away
         level = random.choice(levels)
         logger = logging.getLogger(random.choice(logger_names))
         logger.log(level, 'Message no. %5d' % msgno)
         msgno += 1
         delay = random.random() * 2 + 0.5
         time.sleep(delay)

You can run the above two snippets in separate command shells.  If we
run the listener in one shell and run the sender in two separate shells,
we should see something like the following.  In the first sender shell:

     $ python sender.py
     DEBUG         myapp    613 Message no.     1
     WARNING  myapp.lib2    613 Message no.     2
     CRITICAL myapp.lib2    613 Message no.     3
     WARNING  myapp.lib2    613 Message no.     4
     CRITICAL myapp.lib1    613 Message no.     5
     DEBUG         myapp    613 Message no.     6
     CRITICAL myapp.lib1    613 Message no.     7
     INFO     myapp.lib1    613 Message no.     8
     (and so on)

In the second sender shell:

     $ python sender.py
     INFO     myapp.lib2    657 Message no.     1
     CRITICAL myapp.lib2    657 Message no.     2
     CRITICAL      myapp    657 Message no.     3
     CRITICAL myapp.lib1    657 Message no.     4
     INFO     myapp.lib1    657 Message no.     5
     WARNING  myapp.lib2    657 Message no.     6
     CRITICAL      myapp    657 Message no.     7
     DEBUG    myapp.lib1    657 Message no.     8
     (and so on)

In the listener shell:

     $ python listener.py
     Press Ctrl-C to stop.
     DEBUG         myapp    613 Message no.     1
     WARNING  myapp.lib2    613 Message no.     2
     INFO     myapp.lib2    657 Message no.     1
     CRITICAL myapp.lib2    613 Message no.     3
     CRITICAL myapp.lib2    657 Message no.     2
     CRITICAL      myapp    657 Message no.     3
     WARNING  myapp.lib2    613 Message no.     4
     CRITICAL myapp.lib1    613 Message no.     5
     CRITICAL myapp.lib1    657 Message no.     4
     INFO     myapp.lib1    657 Message no.     5
     DEBUG         myapp    613 Message no.     6
     WARNING  myapp.lib2    657 Message no.     6
     CRITICAL      myapp    657 Message no.     7
     CRITICAL myapp.lib1    613 Message no.     7
     INFO     myapp.lib1    613 Message no.     8
     DEBUG    myapp.lib1    657 Message no.     8
     (and so on)

As you can see, the logging from the two sender processes is interleaved
in the listener's output.


File: python.info,  Node: 辞書ベースで構成する例,  Next: rotator と namer を使ってログローテートをカスタマイズする,  Prev: Subclassing QueueHandler and QueueListener- a pynng example,  Up: Logging クックブック

9.9.18 辞書ベースで構成する例
-----------------------------

次の例は辞書を使った logging の構成です。この例は Django プロジェクトの
ドキュメント(1) から持ってきました。この辞書を *note dictConfig(): 13c8.
に渡して設定を有効にします:

     LOGGING = {
         'version': 1,
         'disable_existing_loggers': False,
         'formatters': {
             'verbose': {
                 'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}',
                 'style': '{',
             },
             'simple': {
                 'format': '{levelname} {message}',
                 'style': '{',
             },
         },
         'filters': {
             'special': {
                 '()': 'project.logging.SpecialFilter',
                 'foo': 'bar',
             },
         },
         'handlers': {
             'console': {
                 'level': 'INFO',
                 'class': 'logging.StreamHandler',
                 'formatter': 'simple',
             },
             'mail_admins': {
                 'level': 'ERROR',
                 'class': 'django.utils.log.AdminEmailHandler',
                 'filters': ['special']
             }
         },
         'loggers': {
             'django': {
                 'handlers': ['console'],
                 'propagate': True,
             },
             'django.request': {
                 'handlers': ['mail_admins'],
                 'level': 'ERROR',
                 'propagate': False,
             },
             'myproject.custom': {
                 'handlers': ['console', 'mail_admins'],
                 'level': 'INFO',
                 'filters': ['special']
             }
         }
     }

この構成方法についてのより詳しい情報は、 Django のドキュメントの 該当の
セクション(2) で見ることができます。

   ---------- Footnotes ----------

   (1) 
https://docs.djangoproject.com/en/stable/topics/logging/#configuring-logging

   (2) 
https://docs.djangoproject.com/en/stable/topics/logging/#configuring-logging


File: python.info,  Node: rotator と namer を使ってログローテートをカスタマイズする,  Next: より手の込んだ multiprocessing の例,  Prev: 辞書ベースで構成する例,  Up: Logging クックブック

9.9.19 rotator と namer を使ってログローテートをカスタマイズする
----------------------------------------------------------------

namer と rotator を定義する方法の例は以下の実行可能なスクリプトに示され
ています。ここではログファイルを gzip により圧縮する例を示しています:

     import gzip
     import logging
     import logging.handlers
     import os
     import shutil

     def namer(name):
         return name + ".gz"

     def rotator(source, dest):
         with open(source, 'rb') as f_in:
             with gzip.open(dest, 'wb') as f_out:
                 shutil.copyfileobj(f_in, f_out)
         os.remove(source)


     rh = logging.handlers.RotatingFileHandler('rotated.log', maxBytes=128, backupCount=5)
     rh.rotator = rotator
     rh.namer = namer

     root = logging.getLogger()
     root.setLevel(logging.INFO)
     root.addHandler(rh)
     f = logging.Formatter('%(asctime)s %(message)s')
     rh.setFormatter(f)
     for i in range(1000):
         root.info(f'Message no. {i + 1}')

このスクリプトを実行すると、6つの新しいファイルが生成され、そのうち5つは
圧縮されています:

     $ ls rotated.log*
     rotated.log       rotated.log.2.gz  rotated.log.4.gz
     rotated.log.1.gz  rotated.log.3.gz  rotated.log.5.gz
     $ zcat rotated.log.1.gz
     2023-01-20 02:28:17,767 Message no. 996
     2023-01-20 02:28:17,767 Message no. 997
     2023-01-20 02:28:17,767 Message no. 998


File: python.info,  Node: より手の込んだ multiprocessing の例,  Next: SysLogHandler に送るメッセージに BOM を挿入する,  Prev: rotator と namer を使ってログローテートをカスタマイズする,  Up: Logging クックブック

9.9.20 より手の込んだ multiprocessing の例
------------------------------------------

次の実際に動作する例は、logging を multiprocessing と設定ファイルを使っ
て利用する方法を示しています。設定内容はかなりシンプルですが、より複雑な
構成を実際の multiprocessing を利用するシナリオで実装する方法を示してい
ます。

この例では、メインプロセスは listener プロセスといくつかのワーカープロセ
スを起動します。メイン、listener、ワーカープロセスはそれぞれ分離した設定
を持っています (ワーカープロセス群は同じ設定を共有します)。この例から、
メインプロセスの logging, ワーカーが QueueHandler でログを送っているとこ
ろ、listener が利用する QueueListener の実装、複雑な設定、キューから受け
取ったイベントを設定された handler に分配する部分を見ることができます。
この設定は説明用のものですが、この例を自分のシナリオに適応させることがで
きるでしょう。

これがそのスクリプトです。docstring とコメントで動作を説明しています:

     import logging
     import logging.config
     import logging.handlers
     from multiprocessing import Process, Queue, Event, current_process
     import os
     import random
     import time

     class MyHandler:
         """
         A simple handler for logging events. It runs in the listener process and
         dispatches events to loggers based on the name in the received record,
         which then get dispatched, by the logging system, to the handlers
         configured for those loggers.
         """

         def handle(self, record):
             if record.name == "root":
                 logger = logging.getLogger()
             else:
                 logger = logging.getLogger(record.name)

             if logger.isEnabledFor(record.levelno):
                 # The process name is transformed just to show that it's the listener
                 # doing the logging to files and console
                 record.processName = '%s (for %s)' % (current_process().name, record.processName)
                 logger.handle(record)

     def listener_process(q, stop_event, config):
         """
         This could be done in the main process, but is just done in a separate
         process for illustrative purposes.

         This initialises logging according to the specified configuration,
         starts the listener and waits for the main process to signal completion
         via the event. The listener is then stopped, and the process exits.
         """
         logging.config.dictConfig(config)
         listener = logging.handlers.QueueListener(q, MyHandler())
         listener.start()
         if os.name == 'posix':
             # On POSIX, the setup logger will have been configured in the
             # parent process, but should have been disabled following the
             # dictConfig call.
             # On Windows, since fork isn't used, the setup logger won't
             # exist in the child, so it would be created and the message
             # would appear - hence the "if posix" clause.
             logger = logging.getLogger('setup')
             logger.critical('Should not appear, because of disabled logger ...')
         stop_event.wait()
         listener.stop()

     def worker_process(config):
         """
         A number of these are spawned for the purpose of illustration. In
         practice, they could be a heterogeneous bunch of processes rather than
         ones which are identical to each other.

         This initialises logging according to the specified configuration,
         and logs a hundred messages with random levels to randomly selected
         loggers.

         A small sleep is added to allow other processes a chance to run. This
         is not strictly needed, but it mixes the output from the different
         processes a bit more than if it's left out.
         """
         logging.config.dictConfig(config)
         levels = [logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,
                   logging.CRITICAL]
         loggers = ['foo', 'foo.bar', 'foo.bar.baz',
                    'spam', 'spam.ham', 'spam.ham.eggs']
         if os.name == 'posix':
             # On POSIX, the setup logger will have been configured in the
             # parent process, but should have been disabled following the
             # dictConfig call.
             # On Windows, since fork isn't used, the setup logger won't
             # exist in the child, so it would be created and the message
             # would appear - hence the "if posix" clause.
             logger = logging.getLogger('setup')
             logger.critical('Should not appear, because of disabled logger ...')
         for i in range(100):
             lvl = random.choice(levels)
             logger = logging.getLogger(random.choice(loggers))
             logger.log(lvl, 'Message no. %d', i)
             time.sleep(0.01)

     def main():
         q = Queue()
         # The main process gets a simple configuration which prints to the console.
         config_initial = {
             'version': 1,
             'handlers': {
                 'console': {
                     'class': 'logging.StreamHandler',
                     'level': 'INFO'
                 }
             },
             'root': {
                 'handlers': ['console'],
                 'level': 'DEBUG'
             }
         }
         # The worker process configuration is just a QueueHandler attached to the
         # root logger, which allows all messages to be sent to the queue.
         # We disable existing loggers to disable the "setup" logger used in the
         # parent process. This is needed on POSIX because the logger will
         # be there in the child following a fork().
         config_worker = {
             'version': 1,
             'disable_existing_loggers': True,
             'handlers': {
                 'queue': {
                     'class': 'logging.handlers.QueueHandler',
                     'queue': q
                 }
             },
             'root': {
                 'handlers': ['queue'],
                 'level': 'DEBUG'
             }
         }
         # The listener process configuration shows that the full flexibility of
         # logging configuration is available to dispatch events to handlers however
         # you want.
         # We disable existing loggers to disable the "setup" logger used in the
         # parent process. This is needed on POSIX because the logger will
         # be there in the child following a fork().
         config_listener = {
             'version': 1,
             'disable_existing_loggers': True,
             'formatters': {
                 'detailed': {
                     'class': 'logging.Formatter',
                     'format': '%(asctime)s %(name)-15s %(levelname)-8s %(processName)-10s %(message)s'
                 },
                 'simple': {
                     'class': 'logging.Formatter',
                     'format': '%(name)-15s %(levelname)-8s %(processName)-10s %(message)s'
                 }
             },
             'handlers': {
                 'console': {
                     'class': 'logging.StreamHandler',
                     'formatter': 'simple',
                     'level': 'INFO'
                 },
                 'file': {
                     'class': 'logging.FileHandler',
                     'filename': 'mplog.log',
                     'mode': 'w',
                     'formatter': 'detailed'
                 },
                 'foofile': {
                     'class': 'logging.FileHandler',
                     'filename': 'mplog-foo.log',
                     'mode': 'w',
                     'formatter': 'detailed'
                 },
                 'errors': {
                     'class': 'logging.FileHandler',
                     'filename': 'mplog-errors.log',
                     'mode': 'w',
                     'formatter': 'detailed',
                     'level': 'ERROR'
                 }
             },
             'loggers': {
                 'foo': {
                     'handlers': ['foofile']
                 }
             },
             'root': {
                 'handlers': ['console', 'file', 'errors'],
                 'level': 'DEBUG'
             }
         }
         # Log some initial events, just to show that logging in the parent works
         # normally.
         logging.config.dictConfig(config_initial)
         logger = logging.getLogger('setup')
         logger.info('About to create workers ...')
         workers = []
         for i in range(5):
             wp = Process(target=worker_process, name='worker %d' % (i + 1),
                          args=(config_worker,))
             workers.append(wp)
             wp.start()
             logger.info('Started worker: %s', wp.name)
         logger.info('About to create listener ...')
         stop_event = Event()
         lp = Process(target=listener_process, name='listener',
                      args=(q, stop_event, config_listener))
         lp.start()
         logger.info('Started listener')
         # We now hang around for the workers to finish their work.
         for wp in workers:
             wp.join()
         # Workers all done, listening can now stop.
         # Logging in the parent still works normally.
         logger.info('Telling listener to stop ...')
         stop_event.set()
         lp.join()
         logger.info('All done.')

     if __name__ == '__main__':
         main()


File: python.info,  Node: SysLogHandler に送るメッセージに BOM を挿入する,  Next: 構造化ログを実装する,  Prev: より手の込んだ multiprocessing の例,  Up: Logging クックブック

9.9.21 SysLogHandler に送るメッセージに BOM を挿入する
------------------------------------------------------

RFC 5424(1) は syslog デーモンに Unicode メッセージを送る時、次の構造を
要求しています: オプショナルなピュア ASCII部分、続けて UTF-8 の Byte
Order Mark (BOM)、続けて UTF-8 でエンコードされた Unicode.  ( 仕様の該当
セクション(2) を参照)

Python 3.1 で *note SysLogHandler: 86c. に、 message に BOM を挿入するコ
ードが追加されました。しかし、そのときの実装が悪くて、 message の先頭に
BOM をつけてしまうのでピュアASCII 部分をその前に書くことができませんでし
た。

この動作は壊れているので、Python 3.2.4 以降では BOM を挿入するコードが、
削除されました。書き直されるのではなく削除されたので、 RFC 5424(3) 準拠
の、BOM と、オプションのピュア ASCII部分をBOMの前に、任意の Unicode を
BOM の後ろに持つ UTF-8 でエンコードされた message を生成したい場合、次の
手順に従う必要があります:

  1. *note SysLogHandler: 86c. のインスタンスに、次のような format 文字
     列を持った *note Formatter: 16b0. インスタンスをアタッチする:

          'ASCII section\ufeffUnicode section'

     Unicode のコードポイント U+FEFF は、UTF-8 でエンコードすると BOM -
     ‘b'\xef\xbb\xbf'’ - になります。

  2. ASCII セクションを好きなプレースホルダに変更する。ただしその部分の
     置換結果が常に ASCII になるように注意する(UTF-8 でエンコードされて
     もその部分が変化しないようにする)。

  3. Unicode セクションを任意のプレースホルダに置き換える。この部分を置
     換したデータに ASCII 外の文字が含まれていても、それは単に UTF-8 で
     エンコードされるだけです。

フォーマットされた message は ‘SysLogHandler’ によって UTF-8 でエンコー
ドされます。上のルールに従えば、RFC 5424 準拠のメッセージを生成できます
。上のルールに従わない場合、logging は何もエラーを起こしませんが、
message は RFC 5424(4) に準拠しない形で送られるので、syslog デーモン側で
何かエラーが起こる可能性があります。

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc5424.html

   (2) https://datatracker.ietf.org/doc/html/rfc5424.html#section-6

   (3) https://datatracker.ietf.org/doc/html/rfc5424.html

   (4) https://datatracker.ietf.org/doc/html/rfc5424.html


File: python.info,  Node: 構造化ログを実装する,  Next: handler を dictConfig を使ってカスタマイズする,  Prev: SysLogHandler に送るメッセージに BOM を挿入する,  Up: Logging クックブック

9.9.22 構造化ログを実装する
---------------------------

多くのログメッセージは人間が読むために書かれるため、機械的に処理しにくく
なっていますが、場合によっては (複雑な正規表現を使ってログメッセージをパ
ースしなくても) プログラムがパース 'できる' 構造化されたフォーマットでメ
ッセージを出力したい場合があります。 logging パッケージを使うと、これを
簡単に実現できます。 実現する方法は幾つもありますが、次の例は JSON を使
ってイベントを、機械でパースできる形にシリアライズする単純な方法です:

     import json
     import logging

     class StructuredMessage:
         def __init__(self, message, /, **kwargs):
             self.message = message
             self.kwargs = kwargs

         def __str__(self):
             return '%s >>> %s' % (self.message, json.dumps(self.kwargs))

     _ = StructuredMessage   # optional, to improve readability

     logging.basicConfig(level=logging.INFO, format='%(message)s')
     logging.info(_('message 1', foo='bar', bar='baz', num=123, fnum=123.456))

上のスクリプトを実行すると次のように出力されます:

     message 1 >>> {"fnum": 123.456, "num": 123, "bar": "baz", "foo": "bar"}

要素の順序は Python のバージョンによって異なることに注意してください。

より特殊な処理が必要な場合、次の例のように、カスタムの JSON エンコーダを
作ることができます:

     import json
     import logging


     class Encoder(json.JSONEncoder):
         def default(self, o):
             if isinstance(o, set):
                 return tuple(o)
             elif isinstance(o, str):
                 return o.encode('unicode_escape').decode('ascii')
             return super().default(o)

     class StructuredMessage:
         def __init__(self, message, /, **kwargs):
             self.message = message
             self.kwargs = kwargs

         def __str__(self):
             s = Encoder().encode(self.kwargs)
             return '%s >>> %s' % (self.message, s)

     _ = StructuredMessage   # optional, to improve readability

     def main():
         logging.basicConfig(level=logging.INFO, format='%(message)s')
         logging.info(_('message 1', set_value={1, 2, 3}, snowman='\u2603'))

     if __name__ == '__main__':
         main()

上のスクリプトを実行すると次のように出力されます:

     message 1 >>> {"snowman": "\u2603", "set_value": [1, 2, 3]}

要素の順序は Python のバージョンによって異なることに注意してください。


File: python.info,  Node: handler を dictConfig を使ってカスタマイズする,  Next: 固有の書式化スタイルをアプリケーション全体で使う,  Prev: 構造化ログを実装する,  Up: Logging クックブック

9.9.23 handler を ‘dictConfig()’ を使ってカスタマイズする
---------------------------------------------------------

logging handler に特定のカスタマイズを何度もしたい場合で、 *note
dictConfig(): 13c8. を使っているなら、サブクラスを作らなくてもカスタマイ
ズが可能です。例えば、ログファイルの owner を設定したいとします。これは
POSIX 環境では *note shutil.chown(): 548. を使って簡単に実現できますが、
標準ライブラリの file handler はこの機能を組み込みでサポートしていません
。 handler の生成を通常の関数を使ってカスタマイズすることができます:

     def owned_file_handler(filename, mode='a', encoding=None, owner=None):
         if owner:
             if not os.path.exists(filename):
                 open(filename, 'a').close()
             shutil.chown(filename, *owner)
         return logging.FileHandler(filename, mode, encoding)

そして、 *note dictConfig(): 13c8. に渡される構成設定の中で、この関数を
使って logging handler を生成するように指定することができます:

     LOGGING = {
         'version': 1,
         'disable_existing_loggers': False,
         'formatters': {
             'default': {
                 'format': '%(asctime)s %(levelname)s %(name)s %(message)s'
             },
         },
         'handlers': {
             'file':{
                 # The values below are popped from this dictionary and
                 # used to create the handler, set the handler's level and
                 # its formatter.
                 '()': owned_file_handler,
                 'level':'DEBUG',
                 'formatter': 'default',
                 # The values below are passed to the handler creator callable
                 # as keyword arguments.
                 'owner': ['pulse', 'pulse'],
                 'filename': 'chowntest.log',
                 'mode': 'w',
                 'encoding': 'utf-8',
             },
         },
         'root': {
             'handlers': ['file'],
             'level': 'DEBUG',
         },
     }

この例は説明用のものですが、owner の user と group を ‘pulse’ に設定して
います。これを動くスクリプトに ‘chowntest.py’ に組み込んでみます:

     import logging, logging.config, os, shutil

     def owned_file_handler(filename, mode='a', encoding=None, owner=None):
         if owner:
             if not os.path.exists(filename):
                 open(filename, 'a').close()
             shutil.chown(filename, *owner)
         return logging.FileHandler(filename, mode, encoding)

     LOGGING = {
         'version': 1,
         'disable_existing_loggers': False,
         'formatters': {
             'default': {
                 'format': '%(asctime)s %(levelname)s %(name)s %(message)s'
             },
         },
         'handlers': {
             'file':{
                 # The values below are popped from this dictionary and
                 # used to create the handler, set the handler's level and
                 # its formatter.
                 '()': owned_file_handler,
                 'level':'DEBUG',
                 'formatter': 'default',
                 # The values below are passed to the handler creator callable
                 # as keyword arguments.
                 'owner': ['pulse', 'pulse'],
                 'filename': 'chowntest.log',
                 'mode': 'w',
                 'encoding': 'utf-8',
             },
         },
         'root': {
             'handlers': ['file'],
             'level': 'DEBUG',
         },
     }

     logging.config.dictConfig(LOGGING)
     logger = logging.getLogger('mylogger')
     logger.debug('A debug message')

これを実行するには、 ‘root’ 権限で実行する必要があるかもしれません:

     $ sudo python3.3 chowntest.py
     $ cat chowntest.log
     2013-11-05 09:34:51,128 DEBUG mylogger A debug message
     $ ls -l chowntest.log
     -rw-r--r-- 1 pulse pulse 55 2013-11-05 09:34 chowntest.log

*note shutil.chown(): 548. が追加されたのが Python 3.3 からなので、この
例は Python 3.3 を使っています。このアプローチ自体は *note dictConfig():
13c8. をサポートした全ての Python バージョン - Python 2.7, 3.2 以降 - で
利用できます。 3.3 以前のバージョンでは、オーナーを変更するのに *note
os.chown(): 1306. を利用する必要があるでしょう。

実際には、handler を生成する関数はプロジェクト内のどこかにあるユーティリ
ティモジュールに置くことになるでしょう。設定の中で直接関数を参照する代わ
りに:

     '()': owned_file_handler,

次のように書くこともできます:

     '()': 'ext://project.util.owned_file_handler',

‘project.util’ は関数がある実際の場所に置き換えてください。上のスクリプ
トでは ‘'ext://__main__.owned_file_handler'’ で動くはずです。 *note
dictConfig(): 13c8. は ‘ext://’ から実際の callable を見つけます。

この例は他のファイルに対する変更を実装する例にもなっています。例えば
*note os.chmod(): 529. を使って、同じ方法で POSIX パーミッションを設定で
きるでしょう。

もちろん、このアプローチは *note FileHandler: 1c53. 以外の handler 、ロ
ーテートする file handler のいずれかやその他の handler にも適用できます
。


File: python.info,  Node: 固有の書式化スタイルをアプリケーション全体で使う,  Next: filter を dictConfig を使ってカスタマイズする,  Prev: handler を dictConfig を使ってカスタマイズする,  Up: Logging クックブック

9.9.24 固有の書式化スタイルをアプリケーション全体で使う
-------------------------------------------------------

Python 3.2 では、*note Formatter: 16b0. クラスが ‘style’ という名前のオ
プションのキーワード引数を受け取ります。このデフォルト値は後方互換性を維
持するために ‘%’ となっていますが、 ‘{’ か ‘$’ を指定することで、*note
str.format(): 833. か *note string.Template: 897. でサポートされているの
と同じ書式化のアプローチを採れます。これは最終的に出力されるログメッセー
ジの書式化に影響を与えますが、個々のログメッセージが構築される方法とは完
全に直交していることに注意してください。

ロギングの呼び出し (*note debug(): 102b, *note info(): 20dd. など) はロ
グメッセージのためには位置引数しか取らず、ロギングの呼び出しを処理する方
法を決定するためだけにキーワード引数を指定できます (たとえば ‘exc_info’
キーワード引数はトレースバックの情報をログに含めるかどうかを指定し、
‘extra’ キーワード引数はログに付加する追加のコンテキスト情報を指定します
)。ロギングパッケージは内部で %-format を使って書式文字列に可変長引数を
埋め込んでいるため、 *note str.format(): 833. や *note string.Template:
897. の構文を使って直接ロギングの呼び出しを行うことはできません。既存の
コードにおける全てのロギングの呼び出しは %-format 文字列を使っているため
、後方互換性を維持する限りこの部分が変更されることはないでしょう。

特定のロガーに関連付ける書式スタイルへの提案がなされてきましたが、そのア
プローチは同時に後方互換性の問題にぶち当たります。あらゆる既存のコードは
ロガーの名前を使っているでしょうし、 % 形式書式化を使っているでしょう。

あらゆるサードパーティのライブラリ、あらゆるあなたのコードの間で相互運用
可能なようにロギングを行うには、書式化についての決定は、個々のログ呼び出
しのレベルで行う必要があります。これは受け容れ可能な代替書式化スタイルに
様々な手段の可能性を広げます。

* Menu:

* LogRecord ファクトリを使う::
* カスタムなメッセージオブジェクトを使う::


File: python.info,  Node: LogRecord ファクトリを使う,  Next: カスタムなメッセージオブジェクトを使う,  Up: 固有の書式化スタイルをアプリケーション全体で使う

9.9.24.1 LogRecord ファクトリを使う
...................................

Python 3.2 において、上述した *note Formatter: 16b0. の変更とともに、
*note setLogRecordFactory(): 318e. 関数を使って *note LogRecord: 11e8. の
サブクラスをユーザに指定することを可能にするロギングパッケージの機能拡張
がありました。これにより、 *note getMessage(): 318c. をオーバライドして
た　だ　し　い　ことをする、あなた自身の手による *note LogRecord: 11e8.
のサブクラスをセットすることが出来ます。このメソッドの実装は基底クラスで
は ‘msg % args’ 書式化をし、あなたの代替の書式化の置換が出来る場所ですが
、他のコードとの相互運用性を保障するために、全ての書式化スタイルをサポー
トするよう注意深く行うべきであり、また、%-書式化をデフォルトで認めるべき
です。基底クラスの実装がそうしているように、 ‘str(self.msg)’ 呼び出しも
してください。

さらに詳しい情報は、リファレンスの *note setLogRecordFactory(): 318e,
*note LogRecord: 11e8. を参照してください。


File: python.info,  Node: カスタムなメッセージオブジェクトを使う,  Prev: LogRecord ファクトリを使う,  Up: 固有の書式化スタイルをアプリケーション全体で使う

9.9.24.2 カスタムなメッセージオブジェクトを使う
...............................................

あなた独自のログメッセージを構築するのに {}- および $- 書式化を使えるよ
うにするための、もうひとつの、おそらくもっと簡単な方法があります。ロギン
グの際には、あなたはメッセージ書式文字列として、任意のオブジェクトを使え
ることを(*note 任意のオブジェクトをメッセージに使用する: 318b. より)思い
出してみましょう、そしてロギングパッケージはそのオブジェクトに対して実際
の書式文字列を得るために *note str(): 169. を呼び出すことも。以下 2 つの
クラスを検討してみましょう:

     class BraceMessage:
         def __init__(self, fmt, /, *args, **kwargs):
             self.fmt = fmt
             self.args = args
             self.kwargs = kwargs

         def __str__(self):
             return self.fmt.format(*self.args, **self.kwargs)

     class DollarMessage:
         def __init__(self, fmt, /, **kwargs):
             self.fmt = fmt
             self.kwargs = kwargs

         def __str__(self):
             from string import Template
             return Template(self.fmt).substitute(**self.kwargs)

どちらのクラスも format 文字列の代わりに利用して、 {} や $ を使って実際
のログの “%(message)s”, “{message}”, “$message” で指定された "message" 部
分を生成することができます。これは何かログを取りたいときに常に使うには使
いにくいクラス名ですが、使いやすいようにエイリアスを作れば良いでしょう、
‘M’ であるとか ‘_’ のような(あるいは地域化のために既に ‘_’ を使っている
のであれば ‘__’ が良いかもしれません)。

このアプローチによる例をお見せします。最初は *note str.format(): 833. を
使ってフォーマットする例です:

     >>> __ = BraceMessage
     >>> print(__('Message with {0} {1}', 2, 'placeholders'))
     Message with 2 placeholders
     >>> class Point: pass
     ...
     >>> p = Point()
     >>> p.x = 0.5
     >>> p.y = 0.5
     >>> print(__('Message with coordinates: ({point.x:.2f}, {point.y:.2f})', point=p))
     Message with coordinates: (0.50, 0.50)

2つめは *note string.Template: 897. でフォーマットする例です:

     >>> __ = DollarMessage
     >>> print(__('Message with $num $what', num=2, what='placeholders'))
     Message with 2 placeholders
     >>>

注意点として、この方法には大きなパフォーマンスのペナルティはありません。
実際のフォーマット操作は logging の呼び出し時ではなくて、メッセージが実
際に handler によって出力されるときに起こります。(出力されないならフォー
マットもされません) そのため、この方法で注意しないといけないのは、追加の
括弧が書式文字列だけではなく引数も囲わないといけないことだけです。これは
上記のとおり __ が ‘XXXMessage’ クラスのコンストラクタ呼び出しのシンタッ
クスシュガーでしか無いからです。


File: python.info,  Node: filter を dictConfig を使ってカスタマイズする,  Next: 例外の書式化をカスタマイズする,  Prev: 固有の書式化スタイルをアプリケーション全体で使う,  Up: Logging クックブック

9.9.25 filter を ‘dictConfig()’ を使ってカスタマイズする
--------------------------------------------------------

*note dictConfig(): 13c8. によってフィルタを設定 '出来ます' が、どうやっ
てそれを行うのかが初見では明快とは言えないでしょう(そのためのこのレシピ
です)。 *note Filter: 1414. のみが唯一標準ライブラリに含まれているだけで
すし、それは何の要求にも応えてはくれません(ただの基底クラスですから)ので
、典型的には *note filter(): 3185. メソッドをオーバライドした *note
Filter: 1414. のサブクラスをあなた自身で定義する必要があります。これをす
るには、設定辞書内のフィルタ指定部分に、 ‘()’ キーでそのフィルタを作るの
に使われる callable を指定してください(クラスを指定するのが最もわかりや
すいですが、 *note Filter: 1414. インスタンスを返却する callable を提供
することでも出来ます)。以下に完全な例を示します:

     import logging
     import logging.config
     import sys

     class MyFilter(logging.Filter):
         def __init__(self, param=None):
             self.param = param

         def filter(self, record):
             if self.param is None:
                 allow = True
             else:
                 allow = self.param not in record.msg
             if allow:
                 record.msg = 'changed: ' + record.msg
             return allow

     LOGGING = {
         'version': 1,
         'filters': {
             'myfilter': {
                 '()': MyFilter,
                 'param': 'noshow',
             }
         },
         'handlers': {
             'console': {
                 'class': 'logging.StreamHandler',
                 'filters': ['myfilter']
             }
         },
         'root': {
             'level': 'DEBUG',
             'handlers': ['console']
         },
     }

     if __name__ == '__main__':
         logging.config.dictConfig(LOGGING)
         logging.debug('hello')
         logging.debug('hello - noshow')

どのようにして設定データとして、そのインスタンスを構築する callable をキ
ーワードパラメータの形で渡すのか、をこの例は教えてくれます。上記スクリプ
トは実行すると、このような出力をします:

     changed: hello

設定した通りに動いていますね。

ほかにもいくつか特筆すべき点があります:

   * 設定内で直接その callable を参照出来ない場合(例えばそれが異なるモジ
     ュール内にあり、設定辞書のある場所からそれを直接インポート出来ない
     、など)には、 *note 外部オブジェクトへのアクセス: 31ba. に記述され
     ている ‘ext://...’ 形式を使えます。例えば、上記例のように
     ‘MyFilter’ と指定する代わりに、 ‘'ext://__main__.MyFilter'’ と記述
     することが出来ます。

   * フィルタについてとともに、このテクニックは、カスタムハンドラ、カス
     タムフォーマッタに対しても同様に使えます。ロギングが設定において、
     どのようにユーザ定義のオブジェクトをサポートするのかについてのさら
     なる詳細については、 *note ユーザ定義オブジェクト: 31ae. と、本クッ
     クブックの上の方のレシピ *note handler を dictConfig()
     を使ってカスタマイズする: 578c. を参照してください。


File: python.info,  Node: 例外の書式化をカスタマイズする,  Next: ロギングメッセージを喋る,  Prev: filter を dictConfig を使ってカスタマイズする,  Up: Logging クックブック

9.9.26 例外の書式化をカスタマイズする
-------------------------------------

例外の書式化をカスタマイズしたいことがあるでしょう - わかりやすさのため
に、例外情報がある場合でもログイベントごとに一行に収まることを死守したい
と望むとしましょう。フォーマッタのクラスをカスタマイズして、このように出
来ます:

     import logging

     class OneLineExceptionFormatter(logging.Formatter):
         def formatException(self, exc_info):
             """
             Format an exception so that it prints on a single line.
             """
             result = super().formatException(exc_info)
             return repr(result)  # or format into one line however you want to

         def format(self, record):
             s = super().format(record)
             if record.exc_text:
                 s = s.replace('\n', '') + '|'
             return s

     def configure_logging():
         fh = logging.FileHandler('output.txt', 'w')
         f = OneLineExceptionFormatter('%(asctime)s|%(levelname)s|%(message)s|',
                                       '%d/%m/%Y %H:%M:%S')
         fh.setFormatter(f)
         root = logging.getLogger()
         root.setLevel(logging.DEBUG)
         root.addHandler(fh)

     def main():
         configure_logging()
         logging.info('Sample message')
         try:
             x = 1 / 0
         except ZeroDivisionError as e:
             logging.exception('ZeroDivisionError: %s', e)

     if __name__ == '__main__':
         main()

実行してみましょう。このように正確に2行の出力を生成します:

     28/01/2015 07:21:23|INFO|Sample message|
     28/01/2015 07:21:23|ERROR|ZeroDivisionError: division by zero|'Traceback (most recent call last):\n  File "logtest7.py", line 30, in main\n    x = 1 / 0\nZeroDivisionError: division by zero'|

これは扱いとしては単純過ぎますが、例外情報をどのようにしてあなた好みの書
式化出来るかを示しています。さらに特殊なニーズが必要な場合には *note
traceback: 104. モジュールが有用です。


File: python.info,  Node: ロギングメッセージを喋る,  Next: ロギングメッセージをバッファリングし、条件に従って出力する,  Prev: 例外の書式化をカスタマイズする,  Up: Logging クックブック

9.9.27 ロギングメッセージを喋る
-------------------------------

ロギングメッセージを目で見る形式ではなく音で聴く形式として出力したい、と
いう状況があるかもしれません。これはあなたのシステムで text- to-speech
(TTS) 機能が利用可能であれば、容易です。それが Python バインディングを持
っていなくとも、です。ほとんどの TTS システムはあなたが実行出来るコマン
ドラインプログラムを持っていて、このことで、 *note subprocess: dc. を使
うことでハンドラが呼び出せます。ここでは、TTS コマンドラインプログラムは
ユーザとの対話を期待せず、完了には時間がかかり、そしてログメッセージの頻
度はユーザをメッセージで圧倒してしまうほどには高くはなく、そして並列で喋
るよりはメッセージ一つにつき一回喋ることが受け容れられる、としておきます
。ここでお見せする実装例では、次が処理される前に一つのメッセージを喋り終
わるまで待ち、結果としてほかのハンドラを待たせることになります。
‘espeak’ TTS パッケージが手許にあるとして、このアプローチによる短い例は
このようなものです:

     import logging
     import subprocess
     import sys

     class TTSHandler(logging.Handler):
         def emit(self, record):
             msg = self.format(record)
             # Speak slowly in a female English voice
             cmd = ['espeak', '-s150', '-ven+f3', msg]
             p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                                  stderr=subprocess.STDOUT)
             # wait for the program to finish
             p.communicate()

     def configure_logging():
         h = TTSHandler()
         root = logging.getLogger()
         root.addHandler(h)
         # the default formatter just returns the message
         root.setLevel(logging.DEBUG)

     def main():
         logging.info('Hello')
         logging.debug('Goodbye')

     if __name__ == '__main__':
         configure_logging()
         sys.exit(main())

実行すれば、女性の声で "Hello" に続き "Goodbye" と喋るはずです。

このアプローチは、もちろんほかの TTS システムにも採用出来ますし、メッセ
ージをコマンドライン経由で外部プログラムに渡せるようなものであれば、ほか
のシステムであっても全く同じです。


File: python.info,  Node: ロギングメッセージをバッファリングし、条件に従って出力する,  Next: バッファリングしながらロギングメッセージを email で送信する,  Prev: ロギングメッセージを喋る,  Up: Logging クックブック

9.9.28 ロギングメッセージをバッファリングし、条件に従って出力する
-----------------------------------------------------------------

メッセージを一次領域に記録し、ある種の特定の状況になった場合にだけ出力し
たい、ということがあるかもしれません。たとえばある関数内でのデバッグのた
めのログ出力をしたくても、エラーなしで終了する限りにおいては収集されたデ
バッグ情報による混雑は喰らいたくはなく、エラーがあった場合にだけエラー出
力とともにデバッグ情報を見たいのだ、のようなことがあるでしょう。

このような振る舞いをするロギングをしたい関数に対して、デコレータを用いて
これを行う例をお見せします。それには *note
logging.handlers.MemoryHandler: 31bd. を使います。これにより何か条件を満
たすまでロギングイベントを溜め込むことが出来、条件を満たせば溜め込まれた
イベントが ‘flushed’ として他のハンドラ (‘target’ のハンドラ)に渡されま
す。デフォルトでは、 ‘MemoryHandler’ はそのバッファが一杯になるか、指定
された閾値のレベル以上のイベントが起こるとフラッシュされます。何か特別な
フラッシュの振る舞いをしたければ、このレシピはさらに特殊化した
‘MemoryHandler’ とともに利用出来ます。

スクリプト例では、 ‘foo’ という、単に全てのログレベルについて、
‘sys.stderr’ にもどのレベルを出力したのかについて書き出しながら実際のロ
グ出力も行う、という単純な関数を使っています。 ‘foo’ に真を与えると
ERROR と CRITICAL の出力をし、そうでなければ DEBUG, INFO, WARNING だけを
出力します。

スクリプトが行うことは単に、 ‘foo’ を必要とされている特定の条件でのロギ
ングを行うようにするデコレータで修飾することだけです。このデコレータはパ
ラメータとしてロガーを取り、修飾された関数が呼ばれている間だけメモリハン
ドラをアタッチします。追加のパラメータとして、ターゲットのハンドラ、フラ
ッシュが発生すべきレベル、バッファの容量(バッファされたレコード数)も受け
取れます。これらのデフォルトは順に ‘sys.stderr’ へ書き出す *note
StreamHandler: 1411, ‘logging.ERROR’, ‘100’ です。

スクリプトはこれです:

     import logging
     from logging.handlers import MemoryHandler
     import sys

     logger = logging.getLogger(__name__)
     logger.addHandler(logging.NullHandler())

     def log_if_errors(logger, target_handler=None, flush_level=None, capacity=None):
         if target_handler is None:
             target_handler = logging.StreamHandler()
         if flush_level is None:
             flush_level = logging.ERROR
         if capacity is None:
             capacity = 100
         handler = MemoryHandler(capacity, flushLevel=flush_level, target=target_handler)

         def decorator(fn):
             def wrapper(*args, **kwargs):
                 logger.addHandler(handler)
                 try:
                     return fn(*args, **kwargs)
                 except Exception:
                     logger.exception('call failed')
                     raise
                 finally:
                     super(MemoryHandler, handler).flush()
                     logger.removeHandler(handler)
             return wrapper

         return decorator

     def write_line(s):
         sys.stderr.write('%s\n' % s)

     def foo(fail=False):
         write_line('about to log at DEBUG ...')
         logger.debug('Actually logged at DEBUG')
         write_line('about to log at INFO ...')
         logger.info('Actually logged at INFO')
         write_line('about to log at WARNING ...')
         logger.warning('Actually logged at WARNING')
         if fail:
             write_line('about to log at ERROR ...')
             logger.error('Actually logged at ERROR')
             write_line('about to log at CRITICAL ...')
             logger.critical('Actually logged at CRITICAL')
         return fail

     decorated_foo = log_if_errors(logger)(foo)

     if __name__ == '__main__':
         logger.setLevel(logging.DEBUG)
         write_line('Calling undecorated foo with False')
         assert not foo(False)
         write_line('Calling undecorated foo with True')
         assert foo(True)
         write_line('Calling decorated foo with False')
         assert not decorated_foo(False)
         write_line('Calling decorated foo with True')
         assert decorated_foo(True)

実行すればこのような出力になるはずです:

     Calling undecorated foo with False
     about to log at DEBUG ...
     about to log at INFO ...
     about to log at WARNING ...
     Calling undecorated foo with True
     about to log at DEBUG ...
     about to log at INFO ...
     about to log at WARNING ...
     about to log at ERROR ...
     about to log at CRITICAL ...
     Calling decorated foo with False
     about to log at DEBUG ...
     about to log at INFO ...
     about to log at WARNING ...
     Calling decorated foo with True
     about to log at DEBUG ...
     about to log at INFO ...
     about to log at WARNING ...
     about to log at ERROR ...
     Actually logged at DEBUG
     Actually logged at INFO
     Actually logged at WARNING
     Actually logged at ERROR
     about to log at CRITICAL ...
     Actually logged at CRITICAL

見ての通り、実際のログ出力は重要度 ERROR かそれより大きい場合にのみ行っ
ていますが、この場合はそれよりも重要度の低い ERROR よりも前に発生したイ
ベントも出力されます。

当然のことですが、デコレーションはいつものやり方でどうぞ:

     @log_if_errors(logger)
     def foo(fail=False):
         ...


File: python.info,  Node: バッファリングしながらロギングメッセージを email で送信する,  Next: 設定によって時刻を UTC GMT で書式化する,  Prev: ロギングメッセージをバッファリングし、条件に従って出力する,  Up: Logging クックブック

9.9.29 バッファリングしながらロギングメッセージを email で送信する
------------------------------------------------------------------

ログメッセージをメールで、特に1つのメールにつき複数のログメッセージを、
送信する方法を例示するため、 *note BufferingHandler: 3210. を継承します
。以下の例は、必要に応じて改変することもできますが、 SMTP 経由でログを送
信するのに必要な情報をコマンドライン引数で指定してスクリプトを実行できる
ように簡単なテストハーネスも提供しています (必須の引数およびオプション引
数の詳細を見るためには、ダウンロードしたスクリプトを ‘-h’ 引数をつけて実
行してください)。

     import logging
     import logging.handlers
     import smtplib

     class BufferingSMTPHandler(logging.handlers.BufferingHandler):
         def __init__(self, mailhost, port, username, password, fromaddr, toaddrs,
                      subject, capacity):
             logging.handlers.BufferingHandler.__init__(self, capacity)
             self.mailhost = mailhost
             self.mailport = port
             self.username = username
             self.password = password
             self.fromaddr = fromaddr
             if isinstance(toaddrs, str):
                 toaddrs = [toaddrs]
             self.toaddrs = toaddrs
             self.subject = subject
             self.setFormatter(logging.Formatter("%(asctime)s %(levelname)-5s %(message)s"))

         def flush(self):
             if len(self.buffer) > 0:
                 try:
                     smtp = smtplib.SMTP(self.mailhost, self.mailport)
                     smtp.starttls()
                     smtp.login(self.username, self.password)
                     msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (self.fromaddr, ','.join(self.toaddrs), self.subject)
                     for record in self.buffer:
                         s = self.format(record)
                         msg = msg + s + "\r\n"
                     smtp.sendmail(self.fromaddr, self.toaddrs, msg)
                     smtp.quit()
                 except Exception:
                     if logging.raiseExceptions:
                         raise
                 self.buffer = []

     if __name__ == '__main__':
         import argparse

         ap = argparse.ArgumentParser()
         aa = ap.add_argument
         aa('host', metavar='HOST', help='SMTP server')
         aa('--port', '-p', type=int, default=587, help='SMTP port')
         aa('user', metavar='USER', help='SMTP username')
         aa('password', metavar='PASSWORD', help='SMTP password')
         aa('to', metavar='TO', help='Addressee for emails')
         aa('sender', metavar='SENDER', help='Sender email address')
         aa('--subject', '-s',
            default='Test Logging email from Python logging module (buffering)',
            help='Subject of email')
         options = ap.parse_args()
         logger = logging.getLogger()
         logger.setLevel(logging.DEBUG)
         h = BufferingSMTPHandler(options.host, options.port, options.user,
                                  options.password, options.sender,
                                  options.to, options.subject, 10)
         logger.addHandler(h)
         for i in range(102):
             logger.info("Info index = %d", i)
         h.flush()
         h.close()

SMTP サーバーを正しく設定した上でスクリプトを実行すると、指定したアドレ
ス宛てに11通のメールを受け取るでしょう。最初の10通のメールはそれぞれ10個
のログメッセージを含み、11通目のメールは2つのログメッセージを含むはずで
す。これらのログメッセージはスクリプト内で指定された102個のログメッセー
ジから構成されています。


File: python.info,  Node: 設定によって時刻を UTC GMT で書式化する,  Next: ロギングの選択にコンテキストマネージャを使う,  Prev: バッファリングしながらロギングメッセージを email で送信する,  Up: Logging クックブック

9.9.30 設定によって時刻を UTC(GMT) で書式化する
-----------------------------------------------

時刻を UTC でフォーマットしたい場合もあるでしょう。以下に示すように、そ
のようなフォーマット処理は ‘UTCFormatter’ のようなクラスを使って行うこと
ができます:

     import logging
     import time

     class UTCFormatter(logging.Formatter):
         converter = time.gmtime

そしてコード中で ‘UTCFormatter’ を *note Formatter: 16b0. の代わりに使え
ます。これを設定を通して行いたい場合、 *note dictConfig(): 13c8. API を
以下の完全な例で示すようなアプローチで使うことが出来ます:

     import logging
     import logging.config
     import time

     class UTCFormatter(logging.Formatter):
         converter = time.gmtime

     LOGGING = {
         'version': 1,
         'disable_existing_loggers': False,
         'formatters': {
             'utc': {
                 '()': UTCFormatter,
                 'format': '%(asctime)s %(message)s',
             },
             'local': {
                 'format': '%(asctime)s %(message)s',
             }
         },
         'handlers': {
             'console1': {
                 'class': 'logging.StreamHandler',
                 'formatter': 'utc',
             },
             'console2': {
                 'class': 'logging.StreamHandler',
                 'formatter': 'local',
             },
         },
         'root': {
             'handlers': ['console1', 'console2'],
        }
     }

     if __name__ == '__main__':
         logging.config.dictConfig(LOGGING)
         logging.warning('The local time is %s', time.asctime())

実行すれば、このような出力になるはずです:

     2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015
     2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015

時刻をローカル時刻と UTC の両方に書式化するのに、それぞれのハンドラにそ
れぞれフォーマッタを与えています。


File: python.info,  Node: ロギングの選択にコンテキストマネージャを使う,  Next: CLIアプリケーションスターターテンプレート,  Prev: 設定によって時刻を UTC GMT で書式化する,  Up: Logging クックブック

9.9.31 ロギングの選択にコンテキストマネージャを使う
---------------------------------------------------

一時的にロギングの設定を変えて、作業をした後に設定を戻せると便利なときが
あります。 こういうときの、ロギングコンテキストの保存と復元をする方法で
はコンテキストマネージャを使うのが一番です。 以下にあるのがそのためのコ
ンテキストマネージャの簡単な例で、これを使うと、任意にロギングレベルを変
更し、コンテキストマネージャのスコープ内で他に影響を及ぼさずロギングハン
ドラを追加できるようになります:

     import logging
     import sys

     class LoggingContext:
         def __init__(self, logger, level=None, handler=None, close=True):
             self.logger = logger
             self.level = level
             self.handler = handler
             self.close = close

         def __enter__(self):
             if self.level is not None:
                 self.old_level = self.logger.level
                 self.logger.setLevel(self.level)
             if self.handler:
                 self.logger.addHandler(self.handler)

         def __exit__(self, et, ev, tb):
             if self.level is not None:
                 self.logger.setLevel(self.old_level)
             if self.handler:
                 self.logger.removeHandler(self.handler)
             if self.handler and self.close:
                 self.handler.close()
             # implicit return of None => don't swallow exceptions

レベル値を指定した場合、コンテキストマネージャがカバーする with ブロック
のスコープ内でロガーのレベルがその値に設定されます。 ハンドラーを指定し
た場合、ブロックに入るときにロガーに追加され、ブロックから抜けるときに取
り除かれます。 ブロックを抜けるときに、自分で追加したハンドラをクローズ
するようコンテキストマネージャに指示することもできます - そのハンドラが
それ以降必要無いのであればクローズしてしまって構いません。

どのように動作するのかを示すためには、次のコード群を上のコードに付け加え
るとよいです:

     if __name__ == '__main__':
         logger = logging.getLogger('foo')
         logger.addHandler(logging.StreamHandler())
         logger.setLevel(logging.INFO)
         logger.info('1. This should appear just once on stderr.')
         logger.debug('2. This should not appear.')
         with LoggingContext(logger, level=logging.DEBUG):
             logger.debug('3. This should appear once on stderr.')
         logger.debug('4. This should not appear.')
         h = logging.StreamHandler(sys.stdout)
         with LoggingContext(logger, level=logging.DEBUG, handler=h, close=True):
             logger.debug('5. This should appear twice - once on stderr and once on stdout.')
         logger.info('6. This should appear just once on stderr.')
         logger.debug('7. This should not appear.')

最初はロガーのレベルを ‘INFO’ に設定しているので、メッセージ #1 は現れ、
メッセージ #2 は現れません。 次に、その後の ‘with’ ブロック内で一時的に
レベルを ‘DEBUG’ に変更したため、メッセージ #3 が現れます。 そのブロック
を抜けた後、ロガーのレベルは ‘INFO’ に復元され、メッセージ #4 は現れませ
ん。 次の ‘with’ ブロック内では、再度レベルを ‘DEBUG’ に設定し、
‘sys.stdout’ に書き出すハンドラを追加します。 そのおかげでメッセージ #5
が 2 回 (1回は ‘stderr’ を通して、もう1回は ‘stdout’ を通して) コンソー
ルに出力されます。 ‘with’ 文が完了すると、前の状態になるので (メッセージ
#1 のように) メッセージ #6 が現れ、(まさにメッセージ #2 のように) メッセ
ージ #7 は現れません。

出来上がったスクリプトを実行すると、結果は次のようになります:

     $ python logctx.py
     1. This should appear just once on stderr.
     3. This should appear once on stderr.
     5. This should appear twice - once on stderr and once on stdout.
     5. This should appear twice - once on stderr and once on stdout.
     6. This should appear just once on stderr.

‘stderr’ を ‘/dev/null’ へパイプした状態でもう一度実行すると、次のように
なり、これは ‘stdout’ の方に書かれたメッセージだけが現れています:

     $ python logctx.py 2>/dev/null
     5. This should appear twice - once on stderr and once on stdout.

‘stdout’ を ‘/dev/null’ へパイプした状態でさらにもう一度実行すると、こう
なります:

     $ python logctx.py >/dev/null
     1. This should appear just once on stderr.
     3. This should appear once on stderr.
     5. This should appear twice - once on stderr and once on stdout.
     6. This should appear just once on stderr.

この場合では、 ‘stdout’ の方に出力されたメッセージ #5 は予想通り現れませ
ん。

もちろんここで説明した手法は、例えば一時的にロギングフィルターを取り付け
たりするのに一般化できます。 上のコードは Python 2 だけでなく Python 3 で
も動くことに注意してください。


File: python.info,  Node: CLIアプリケーションスターターテンプレート,  Next: Qt GUIのログ出力,  Prev: ロギングの選択にコンテキストマネージャを使う,  Up: Logging クックブック

9.9.32 CLIアプリケーションスターターテンプレート
------------------------------------------------

ここのサンプルでは次のことを説明します:

   * コマンドライン引数に応じてログレベルを使用する

   * 複数のファイルに分割されたサブコマンドにディスパッチする。すべて一
     貫して同じレベルでログ出力を行う

   * シンプルで最小限の設定で行えるようにする

サービスを停止したり、開始したり、再起動する役割を持ったコマンドラインア
プリケーションがあるとします。説明のために、アプリケーションのメインスク
リプトが ‘app.py’ 、個々のコマンドが ‘start.py’ 、 ‘stop.py’ 、
‘restart.py’ に実装されているものとします。デフォルトは ‘logging.INFO’ で
すが、コマンドライン引数を使ってアプリケーションのログの冗長性を制御した
いとします。 ‘app.py’ は次のコードのようになるでしょう:

     import argparse
     import importlib
     import logging
     import os
     import sys

     def main(args=None):
         scriptname = os.path.basename(__file__)
         parser = argparse.ArgumentParser(scriptname)
         levels = ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL')
         parser.add_argument('--log-level', default='INFO', choices=levels)
         subparsers = parser.add_subparsers(dest='command',
                                            help='Available commands:')
         start_cmd = subparsers.add_parser('start', help='Start a service')
         start_cmd.add_argument('name', metavar='NAME',
                                help='Name of service to start')
         stop_cmd = subparsers.add_parser('stop',
                                          help='Stop one or more services')
         stop_cmd.add_argument('names', metavar='NAME', nargs='+',
                               help='Name of service to stop')
         restart_cmd = subparsers.add_parser('restart',
                                             help='Restart one or more services')
         restart_cmd.add_argument('names', metavar='NAME', nargs='+',
                                  help='Name of service to restart')
         options = parser.parse_args()
         # the code to dispatch commands could all be in this file. For the purposes
         # of illustration only, we implement each command in a separate module.
         try:
             mod = importlib.import_module(options.command)
             cmd = getattr(mod, 'command')
         except (ImportError, AttributeError):
             print('Unable to find the code for command \'%s\'' % options.command)
             return 1
         # Could get fancy here and load configuration from file or dictionary
         logging.basicConfig(level=options.log_level,
                             format='%(levelname)s %(name)s %(message)s')
         cmd(options)

     if __name__ == '__main__':
         sys.exit(main())

‘start’ 、 ‘stop’ 、 ‘restart’ コマンドは個別のモジュールとして実装され
ます。次は起動コマンドのソースです:

     # start.py
     import logging

     logger = logging.getLogger(__name__)

     def command(options):
         logger.debug('About to start %s', options.name)
         # actually do the command processing here ...
         logger.info('Started the \'%s\' service.', options.name)

停止コマンドのソースは次の通りです:

     # stop.py
     import logging

     logger = logging.getLogger(__name__)

     def command(options):
         n = len(options.names)
         if n == 1:
             plural = ''
             services = '\'%s\'' % options.names[0]
         else:
             plural = 's'
             services = ', '.join('\'%s\'' % name for name in options.names)
             i = services.rfind(', ')
             services = services[:i] + ' and ' + services[i + 2:]
         logger.debug('About to stop %s', services)
         # actually do the command processing here ...
         logger.info('Stopped the %s service%s.', services, plural)

同様に、再起動のコマンドは次の通りです:

     # restart.py
     import logging

     logger = logging.getLogger(__name__)

     def command(options):
         n = len(options.names)
         if n == 1:
             plural = ''
             services = '\'%s\'' % options.names[0]
         else:
             plural = 's'
             services = ', '.join('\'%s\'' % name for name in options.names)
             i = services.rfind(', ')
             services = services[:i] + ' and ' + services[i + 2:]
         logger.debug('About to restart %s', services)
         # actually do the command processing here ...
         logger.info('Restarted the %s service%s.', services, plural)

このアプリケーションをデフォルトのログレベルで実行すると、次のような出力
が得られます:

     $ python app.py start foo
     INFO start Started the 'foo' service.

     $ python app.py stop foo bar
     INFO stop Stopped the 'foo' and 'bar' services.

     $ python app.py restart foo bar baz
     INFO restart Restarted the 'foo', 'bar' and 'baz' services.

最初のワードはログレベルで、次のワードはイベントのログ出力が行われたモジ
ュールまたはパッケージ名です。

ログレベルを変更し、ログに出力する情報を変更できるようにしましょう。もし
、より詳細な情報が必要だとしましょう:

     $ python app.py --log-level DEBUG start foo
     DEBUG start About to start foo
     INFO start Started the 'foo' service.

     $ python app.py --log-level DEBUG stop foo bar
     DEBUG stop About to stop 'foo' and 'bar'
     INFO stop Stopped the 'foo' and 'bar' services.

     $ python app.py --log-level DEBUG restart foo bar baz
     DEBUG restart About to restart 'foo', 'bar' and 'baz'
     INFO restart Restarted the 'foo', 'bar' and 'baz' services.

あるいは情報を減らしたい場合もあるでしょう:

     $ python app.py --log-level WARNING start foo
     $ python app.py --log-level WARNING stop foo bar
     $ python app.py --log-level WARNING restart foo bar baz

この場合、コマンドはコンソールに何も出力しなくなります。


File: python.info,  Node: Qt GUIのログ出力,  Next: RFC5424 をサポートする syslog へのロギング,  Prev: CLIアプリケーションスターターテンプレート,  Up: Logging クックブック

9.9.33 Qt GUIのログ出力
-----------------------

A question that comes up from time to time is about how to log to a GUI
application.  The Qt(1) framework is a popular cross-platform UI
framework with Python bindings using PySide2(2) or PyQt5(3) libraries.

次のサンプルはQt GUIでログ出力を行うサンプルです。ここではシンプルな
‘QtHandler’ クラスを作成しています。これは呼び出し可能オブジェクトを受け
取ります。これはGUI更新を行うメインスレッドの中で利用されるスロットです
。ワーカースレッドも作成し、UI自身からボタンを使ってログを出力したり、バ
ックグラウンドのタスクを行うワーカースレッドからログ出力を行います（ここ
ではランダムな期間にランダムなレベルでメッセージを出しています）。

ワーカースレッドは *note threading: f3. モジュールではなく、Qtの
‘QThread’ クラスを使っています。これは他の ‘Qt’ コンポーネントとうまく統
合できるように、 ‘QThread’ を使う必要があるからです。

The code should work with recent releases of any of ‘PySide6’, ‘PyQt6’,
‘PySide2’ or ‘PyQt5’.  You should be able to adapt the approach to
earlier versions of Qt.  Please refer to the comments in the code
snippet for more detailed information.

     import datetime
     import logging
     import random
     import sys
     import time

     # Deal with minor differences between different Qt packages
     try:
         from PySide6 import QtCore, QtGui, QtWidgets
         Signal = QtCore.Signal
         Slot = QtCore.Slot
     except ImportError:
         try:
             from PyQt6 import QtCore, QtGui, QtWidgets
             Signal = QtCore.pyqtSignal
             Slot = QtCore.pyqtSlot
         except ImportError:
             try:
                 from PySide2 import QtCore, QtGui, QtWidgets
                 Signal = QtCore.Signal
                 Slot = QtCore.Slot
             except ImportError:
                 from PyQt5 import QtCore, QtGui, QtWidgets
                 Signal = QtCore.pyqtSignal
                 Slot = QtCore.pyqtSlot

     logger = logging.getLogger(__name__)


     #
     # Signals need to be contained in a QObject or subclass in order to be correctly
     # initialized.
     #
     class Signaller(QtCore.QObject):
         signal = Signal(str, logging.LogRecord)

     #
     # Output to a Qt GUI is only supposed to happen on the main thread. So, this
     # handler is designed to take a slot function which is set up to run in the main
     # thread. In this example, the function takes a string argument which is a
     # formatted log message, and the log record which generated it. The formatted
     # string is just a convenience - you could format a string for output any way
     # you like in the slot function itself.
     #
     # You specify the slot function to do whatever GUI updates you want. The handler
     # doesn't know or care about specific UI elements.
     #
     class QtHandler(logging.Handler):
         def __init__(self, slotfunc, *args, **kwargs):
             super().__init__(*args, **kwargs)
             self.signaller = Signaller()
             self.signaller.signal.connect(slotfunc)

         def emit(self, record):
             s = self.format(record)
             self.signaller.signal.emit(s, record)

     #
     # This example uses QThreads, which means that the threads at the Python level
     # are named something like "Dummy-1". The function below gets the Qt name of the
     # current thread.
     #
     def ctname():
         return QtCore.QThread.currentThread().objectName()


     #
     # Used to generate random levels for logging.
     #
     LEVELS = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,
               logging.CRITICAL)

     #
     # This worker class represents work that is done in a thread separate to the
     # main thread. The way the thread is kicked off to do work is via a button press
     # that connects to a slot in the worker.
     #
     # Because the default threadName value in the LogRecord isn't much use, we add
     # a qThreadName which contains the QThread name as computed above, and pass that
     # value in an "extra" dictionary which is used to update the LogRecord with the
     # QThread name.
     #
     # This example worker just outputs messages sequentially, interspersed with
     # random delays of the order of a few seconds.
     #
     class Worker(QtCore.QObject):
         @Slot()
         def start(self):
             extra = {'qThreadName': ctname() }
             logger.debug('Started work', extra=extra)
             i = 1
             # Let the thread run until interrupted. This allows reasonably clean
             # thread termination.
             while not QtCore.QThread.currentThread().isInterruptionRequested():
                 delay = 0.5 + random.random() * 2
                 time.sleep(delay)
                 try:
                     if random.random() < 0.1:
                         raise ValueError('Exception raised: %d' % i)
                     else:
                         level = random.choice(LEVELS)
                         logger.log(level, 'Message after delay of %3.1f: %d', delay, i, extra=extra)
                 except ValueError as e:
                     logger.exception('Failed: %s', e, extra=extra)
                 i += 1

     #
     # Implement a simple UI for this cookbook example. This contains:
     #
     # * A read-only text edit window which holds formatted log messages
     # * A button to start work and log stuff in a separate thread
     # * A button to log something from the main thread
     # * A button to clear the log window
     #
     class Window(QtWidgets.QWidget):

         COLORS = {
             logging.DEBUG: 'black',
             logging.INFO: 'blue',
             logging.WARNING: 'orange',
             logging.ERROR: 'red',
             logging.CRITICAL: 'purple',
         }

         def __init__(self, app):
             super().__init__()
             self.app = app
             self.textedit = te = QtWidgets.QPlainTextEdit(self)
             # Set whatever the default monospace font is for the platform
             f = QtGui.QFont('nosuchfont')
             if hasattr(f, 'Monospace'):
                 f.setStyleHint(f.Monospace)
             else:
                 f.setStyleHint(f.StyleHint.Monospace)  # for Qt6
             te.setFont(f)
             te.setReadOnly(True)
             PB = QtWidgets.QPushButton
             self.work_button = PB('Start background work', self)
             self.log_button = PB('Log a message at a random level', self)
             self.clear_button = PB('Clear log window', self)
             self.handler = h = QtHandler(self.update_status)
             # Remember to use qThreadName rather than threadName in the format string.
             fs = '%(asctime)s %(qThreadName)-12s %(levelname)-8s %(message)s'
             formatter = logging.Formatter(fs)
             h.setFormatter(formatter)
             logger.addHandler(h)
             # Set up to terminate the QThread when we exit
             app.aboutToQuit.connect(self.force_quit)

             # Lay out all the widgets
             layout = QtWidgets.QVBoxLayout(self)
             layout.addWidget(te)
             layout.addWidget(self.work_button)
             layout.addWidget(self.log_button)
             layout.addWidget(self.clear_button)
             self.setFixedSize(900, 400)

             # Connect the non-worker slots and signals
             self.log_button.clicked.connect(self.manual_update)
             self.clear_button.clicked.connect(self.clear_display)

             # Start a new worker thread and connect the slots for the worker
             self.start_thread()
             self.work_button.clicked.connect(self.worker.start)
             # Once started, the button should be disabled
             self.work_button.clicked.connect(lambda : self.work_button.setEnabled(False))

         def start_thread(self):
             self.worker = Worker()
             self.worker_thread = QtCore.QThread()
             self.worker.setObjectName('Worker')
             self.worker_thread.setObjectName('WorkerThread')  # for qThreadName
             self.worker.moveToThread(self.worker_thread)
             # This will start an event loop in the worker thread
             self.worker_thread.start()

         def kill_thread(self):
             # Just tell the worker to stop, then tell it to quit and wait for that
             # to happen
             self.worker_thread.requestInterruption()
             if self.worker_thread.isRunning():
                 self.worker_thread.quit()
                 self.worker_thread.wait()
             else:
                 print('worker has already exited.')

         def force_quit(self):
             # For use when the window is closed
             if self.worker_thread.isRunning():
                 self.kill_thread()

         # The functions below update the UI and run in the main thread because
         # that's where the slots are set up

         @Slot(str, logging.LogRecord)
         def update_status(self, status, record):
             color = self.COLORS.get(record.levelno, 'black')
             s = '<pre><font color="%s">%s</font></pre>' % (color, status)
             self.textedit.appendHtml(s)

         @Slot()
         def manual_update(self):
             # This function uses the formatted message passed in, but also uses
             # information from the record to format the message in an appropriate
             # color according to its severity (level).
             level = random.choice(LEVELS)
             extra = {'qThreadName': ctname() }
             logger.log(level, 'Manually logged!', extra=extra)

         @Slot()
         def clear_display(self):
             self.textedit.clear()


     def main():
         QtCore.QThread.currentThread().setObjectName('MainThread')
         logging.getLogger().setLevel(logging.DEBUG)
         app = QtWidgets.QApplication(sys.argv)
         example = Window(app)
         example.show()
         if hasattr(app, 'exec'):
             rc = app.exec()
         else:
             rc = app.exec_()
         sys.exit(rc)

     if __name__=='__main__':
         main()

   ---------- Footnotes ----------

   (1) https://www.qt.io/

   (2) https://pypi.org/project/PySide2/

   (3) https://pypi.org/project/PyQt5/


File: python.info,  Node: RFC5424 をサポートする syslog へのロギング,  Next: ロガーを出力ストリームのように取り扱う方法,  Prev: Qt GUIのログ出力,  Up: Logging クックブック

9.9.34 RFC5424 をサポートする syslog へのロギング
-------------------------------------------------

RFC 5424(1) は 2009 年から始まっていますが、ほとんどの syslog サーバーは
デフォルトで、 2001 年から使われている古い RFC 3164(2) を使って構成され
ています。2003年に ‘logging’ モジュールが Python に追加されたとき、モジ
ュールは古い (そして当時唯一存在した) プロトコルをサポートしていました。
RFC5424 は、それが登場して以来、 syslog サーバーにおいて広く使われること
がなかったために、 *note SysLogHandler: 86c. の機能は更新されてきません
でした。

RFC 5424 は構造化データのサポートなど、いくつかの有用な機能を持っていま
す。その機能をサポートする syslog サーバーへのロギングを可能にする必要が
ある場合、以下のような派生ハンドラクラスを使うことで実現することができま
す:

     import datetime
     import logging.handlers
     import re
     import socket
     import time

     class SysLogHandler5424(logging.handlers.SysLogHandler):

         tz_offset = re.compile(r'([+-]\d{2})(\d{2})$')
         escaped = re.compile(r'([\]"\\])')

         def __init__(self, *args, **kwargs):
             self.msgid = kwargs.pop('msgid', None)
             self.appname = kwargs.pop('appname', None)
             super().__init__(*args, **kwargs)

         def format(self, record):
             version = 1
             asctime = datetime.datetime.fromtimestamp(record.created).isoformat()
             m = self.tz_offset.match(time.strftime('%z'))
             has_offset = False
             if m and time.timezone:
                 hrs, mins = m.groups()
                 if int(hrs) or int(mins):
                     has_offset = True
             if not has_offset:
                 asctime += 'Z'
             else:
                 asctime += f'{hrs}:{mins}'
             try:
                 hostname = socket.gethostname()
             except Exception:
                 hostname = '-'
             appname = self.appname or '-'
             procid = record.process
             msgid = '-'
             msg = super().format(record)
             sdata = '-'
             if hasattr(record, 'structured_data'):
                 sd = record.structured_data
                 # This should be a dict where the keys are SD-ID and the value is a
                 # dict mapping PARAM-NAME to PARAM-VALUE (refer to the RFC for what these
                 # mean)
                 # There's no error checking here - it's purely for illustration, and you
                 # can adapt this code for use in production environments
                 parts = []

                 def replacer(m):
                     g = m.groups()
                     return '\\' + g[0]

                 for sdid, dv in sd.items():
                     part = f'[{sdid}'
                     for k, v in dv.items():
                         s = str(v)
                         s = self.escaped.sub(replacer, s)
                         part += f' {k}="{s}"'
                     part += ']'
                     parts.append(part)
                 sdata = ''.join(parts)
             return f'{version} {asctime} {hostname} {appname} {procid} {msgid} {sdata} {msg}'

上記のコードを完全に理解するには RFC 5424 を熟知する必要があります。また
、上記の例とはやや異なる要求を持つこともあるでしょう (たとえば構造化デー
タをログに渡す方法について)。にもかかわらず、上記のコードは特有の要求に
対する順応性があります。上記のハンドラにより、構造化データは以下のように
渡すことができるでしょう:

     sd = {
         'foo@12345': {'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'},
         'foo@54321': {'rab': 'baz', 'zab': 'bozz', 'zzif': r'buzz'}
     }
     extra = {'structured_data': sd}
     i = 1
     logger.debug('Message %d', i, extra=extra)

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc5424.html

   (2) https://datatracker.ietf.org/doc/html/rfc3164.html


File: python.info,  Node: ロガーを出力ストリームのように取り扱う方法,  Next: How to uniformly handle newlines in logging output,  Prev: RFC5424 をサポートする syslog へのロギング,  Up: Logging クックブック

9.9.35 ロガーを出力ストリームのように取り扱う方法
-------------------------------------------------

書き込み先として file-like オブジェクトを期待するサードパーティの API に
接続する必要がある一方で、その API の出力を直接ロガーに送りたいというこ
とがときどきあります。これは file-like な API でロガーをラップするクラス
を使うことで実現できます。以下はそのようなクラスを例解する短いスクリプト
です:

     import logging

     class LoggerWriter:
         def __init__(self, logger, level):
             self.logger = logger
             self.level = level

         def write(self, message):
             if message != '\n':  # avoid printing bare newlines, if you like
                 self.logger.log(self.level, message)

         def flush(self):
             # doesn't actually do anything, but might be expected of a file-like
             # object - so optional depending on your situation
             pass

         def close(self):
             # doesn't actually do anything, but might be expected of a file-like
             # object - so optional depending on your situation. You might want
             # to set a flag so that later calls to write raise an exception
             pass

     def main():
         logging.basicConfig(level=logging.DEBUG)
         logger = logging.getLogger('demo')
         info_fp = LoggerWriter(logger, logging.INFO)
         debug_fp = LoggerWriter(logger, logging.DEBUG)
         print('An INFO message', file=info_fp)
         print('A DEBUG message', file=debug_fp)

     if __name__ == "__main__":
         main()

このスクリプトを実行すると、次のように出力されます。

     INFO:demo:An INFO message
     DEBUG:demo:A DEBUG message

また、 ‘sys.stdout’ や ‘sys.stderr’ をリダイレクトするには
‘LoggerWriter’ を使って以下のようにします:

     import sys

     sys.stdout = LoggerWriter(logger, logging.INFO)
     sys.stderr = LoggerWriter(logger, logging.WARNING)

上記の操作は、必要に応じてロギングを設定した '後に' 行うべきです。上記の
例では、 *note basicConfig(): bf3. の呼び出しが (‘LoggerWriter’ インスタ
ンスで上書きされる '前の' ‘sys.stderr’ を使って) 設定を行います。そして
、以下のような結果を得るでしょう:

     >>> print('Foo')
     INFO:demo:Foo
     >>> print('Bar', file=sys.stderr)
     WARNING:demo:Bar
     >>>

言うまでもなく上記の例は *note basicConfig(): bf3. で使われている書式に
もとづく出力を示していますが、ロギングの設定で異なるフォーマッタを使うこ
とができます。

上記の例では、バッファリングや奪取した書き込み呼び出しのシーケンスの扱い
についてはなすがままになっています。たとえば、上記の ‘LoggerWriter’ の定
義で、次のようなコードの断片があったとします。

     sys.stderr = LoggerWriter(logger, logging.WARNING)
     1 / 0

このスクリプトを実行すると以下のような結果が得られます。

     WARNING:demo:Traceback (most recent call last):

     WARNING:demo:  File "/home/runner/cookbook-loggerwriter/test.py", line 53, in <module>

     WARNING:demo:
     WARNING:demo:main()
     WARNING:demo:  File "/home/runner/cookbook-loggerwriter/test.py", line 49, in main

     WARNING:demo:
     WARNING:demo:1 / 0
     WARNING:demo:ZeroDivisionError
     WARNING:demo::
     WARNING:demo:division by zero

As you can see, this output isn't ideal.  That's because the underlying
code which writes to ‘sys.stderr’ makes multiple writes, each of which
results in a separate logged line (for example, the last three lines
above).  To get around this problem, you need to buffer things and only
output log lines when newlines are seen.  Let's use a slightly better
implementation of ‘LoggerWriter’:

     class BufferingLoggerWriter(LoggerWriter):
         def __init__(self, logger, level):
             super().__init__(logger, level)
             self.buffer = ''

         def write(self, message):
             if '\n' not in message:
                 self.buffer += message
             else:
                 parts = message.split('\n')
                 if self.buffer:
                     s = self.buffer + parts.pop(0)
                     self.logger.log(self.level, s)
                 self.buffer = parts.pop()
                 for part in parts:
                     self.logger.log(self.level, part)

この実装は改行があらわれるまでログをバッファリングし、行全体をログに出力
するだけです。このアプローチにより、より適切な出力が得られます:

     WARNING:demo:Traceback (most recent call last):
     WARNING:demo:  File "/home/runner/cookbook-loggerwriter/main.py", line 55, in <module>
     WARNING:demo:    main()
     WARNING:demo:  File "/home/runner/cookbook-loggerwriter/main.py", line 52, in main
     WARNING:demo:    1/0
     WARNING:demo:ZeroDivisionError: division by zero


File: python.info,  Node: How to uniformly handle newlines in logging output,  Next: 避けるべきパターン,  Prev: ロガーを出力ストリームのように取り扱う方法,  Up: Logging クックブック

9.9.36 How to uniformly handle newlines in logging output
---------------------------------------------------------

Usually, messages that are logged (say to console or file) consist of a
single line of text.  However, sometimes there is a need to handle
messages with multiple lines - whether because a logging format string
contains newlines, or logged data contains newlines.  If you want to
handle such messages uniformly, so that each line in the logged message
appears uniformly formatted as if it was logged separately, you can do
this using a handler mixin, as in the following snippet:

     # Assume this is in a module mymixins.py
     import copy

     class MultilineMixin:
         def emit(self, record):
             s = record.getMessage()
             if '\n' not in s:
                 super().emit(record)
             else:
                 lines = s.splitlines()
                 rec = copy.copy(record)
                 rec.args = None
                 for line in lines:
                     rec.msg = line
                     super().emit(rec)

You can use the mixin as in the following script:

     import logging

     from mymixins import MultilineMixin

     logger = logging.getLogger(__name__)

     class StreamHandler(MultilineMixin, logging.StreamHandler):
         pass

     if __name__ == '__main__':
         logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)-9s %(message)s',
                             handlers = [StreamHandler()])
         logger.debug('Single line')
         logger.debug('Multiple lines:\nfool me once ...')
         logger.debug('Another single line')
         logger.debug('Multiple lines:\n%s', 'fool me ...\ncan\'t get fooled again')

The script, when run, prints something like:

     2025-07-02 13:54:47,234 DEBUG     Single line
     2025-07-02 13:54:47,234 DEBUG     Multiple lines:
     2025-07-02 13:54:47,234 DEBUG     fool me once ...
     2025-07-02 13:54:47,234 DEBUG     Another single line
     2025-07-02 13:54:47,234 DEBUG     Multiple lines:
     2025-07-02 13:54:47,234 DEBUG     fool me ...
     2025-07-02 13:54:47,234 DEBUG     can't get fooled again

If, on the other hand, you are concerned about log injection(1), you can
use a formatter which escapes newlines, as per the following example:

     import logging

     logger = logging.getLogger(__name__)

     class EscapingFormatter(logging.Formatter):
         def format(self, record):
             s = super().format(record)
             return s.replace('\n', r'\n')

     if __name__ == '__main__':
         h = logging.StreamHandler()
         h.setFormatter(EscapingFormatter('%(asctime)s %(levelname)-9s %(message)s'))
         logging.basicConfig(level=logging.DEBUG, handlers = [h])
         logger.debug('Single line')
         logger.debug('Multiple lines:\nfool me once ...')
         logger.debug('Another single line')
         logger.debug('Multiple lines:\n%s', 'fool me ...\ncan\'t get fooled again')

You can, of course, use whatever escaping scheme makes the most sense
for you.  The script, when run, should produce output like this:

     2025-07-09 06:47:33,783 DEBUG     Single line
     2025-07-09 06:47:33,783 DEBUG     Multiple lines:\nfool me once ...
     2025-07-09 06:47:33,783 DEBUG     Another single line
     2025-07-09 06:47:33,783 DEBUG     Multiple lines:\nfool me ...\ncan't get fooled again

Escaping behaviour can't be the stdlib default , as it would break
backwards compatibility.

   ---------- Footnotes ----------

   (1) https://owasp.org/www-community/attacks/Log_Injection


File: python.info,  Node: 避けるべきパターン,  Next: その他のリソース<2>,  Prev: How to uniformly handle newlines in logging output,  Up: Logging クックブック

9.9.37 避けるべきパターン
-------------------------

これまでのセクションではログ出力を行うときに必要なこと、考慮すべきことな
どを説明してきました。このセクションでは、 '役に立たない' 利用パターンに
ついて触れます。これは多くの場合避けるべきことです。これらの説明はどこか
ら読んでも構いません。

* Menu:

* 同じログファイルを何度も開く::
* ロガーをクラスの属性にするか、パラメータで渡す::
* ライブラリ内でロガーに NullHandler 以外のハンドラーを追加する::
* 大量のロガーを作成する::


File: python.info,  Node: 同じログファイルを何度も開く,  Next: ロガーをクラスの属性にするか、パラメータで渡す,  Up: 避けるべきパターン

9.9.37.1 同じログファイルを何度も開く
.....................................

Windowsでは同じファイルを何度も開くことができず「このファイルは他のプロ
セスから利用されています」というエラーが表示されます。しかし、POSIXプラ
ットフォームではエラーがおきることなく、同じファイルを何度も開けます。こ
れは次のように間違って使われる可能性があります。

   * 同じファイルを指すファイルハンドラを1度以上追加する（例えばコピー＆
     ペーストして書き換え忘れによるエラー)。

   * 異なる名前を持つ、一見異なる2つのファイルを開くが、片方が他方へのシ
     ンボリックリンクとなっている。

   * プロセスをフォークするが、その後親プロセスと子プロセスが同じファイ
     ルへの参照を維持する。これは例えば、 *note multiprocessing: 98. モ
     ジュールなどを使うと発生する可能性があります。

ファイルを複数回開くことは、 '一見' 動作しているように見えますが、さまざ
まな問題を引き起こす可能性があります:

   * 複数のスレッドが同一ファイルに書き出そうとすると、ログ出力が文字化
     けする可能性があります。ログモジュールは同じハンドラーのインスタン
     スに対して並列で利用しても正しく動くようになっていますが、同じファ
     イルを参照する2つの異なるハンドラーのインスタンスに対し、2つのスレ
     ッドから同時に書き込みをした場合にはそのような保護は働きません。

   * (たとえばファイルのローテーションの間に) ファイルを削除しようとする
     と、そのファイルを指す別の参照が残っているために、何のエラーも発し
     ないまま失敗します。これは混乱や不要なデバッグの時間のもととなる可
     能性があります - ログが思いもしない場所に記録されたり、完全に失われ
     たりします。もしくは移動したと思われていたファイルが残っていたり、
     ファイルサイズにもとづくローテーションが行われているにもかかわらず
     ファイルサイズが予想外に増加したりすることもあります。

この問題を回避するには *note
複数のプロセスからの単一ファイルへのログ記録: 5777. で紹介したテクニック
を使用してください。


File: python.info,  Node: ロガーをクラスの属性にするか、パラメータで渡す,  Next: ライブラリ内でロガーに NullHandler 以外のハンドラーを追加する,  Prev: 同じログファイルを何度も開く,  Up: 避けるべきパターン

9.9.37.2 ロガーをクラスの属性にするか、パラメータで渡す
.......................................................

ロガーはシングルトンであるため、一般的には意味がなく、これを行う必要が出
てくることは滅多にありません。コードからは名前を使って
‘logging.getLogger(name)’ 経由でロガーインスタンスにアクセスできるため、
インスタンスを持って回って、インスタンス属性として保持することは意味があ
りません。JavaやC#といった他の言語ではよく静的クラス属性にしてます。しか
し、Pythonにおいてはこのパターンはクラスではなくモジュールがソフトウェア
分解の単位となっているため、無意味です。


File: python.info,  Node: ライブラリ内でロガーに NullHandler 以外のハンドラーを追加する,  Next: 大量のロガーを作成する,  Prev: ロガーをクラスの属性にするか、パラメータで渡す,  Up: 避けるべきパターン

9.9.37.3 ライブラリ内でロガーに ‘NullHandler’ 以外のハンドラーを追加する
........................................................................

ハンドラーやフォーマッター、フィルターを追加してログ出力をカスタマイズす
るのはライブラリ開発者ではなく、アプリケーション開発者の責務です。もしあ
なたがライブラリのメンテナンスをしているのであれば、 *note NullHandler:
149c. インスタンス以外のロガーを追加してはいけない、ということを意味しま
す。


File: python.info,  Node: 大量のロガーを作成する,  Prev: ライブラリ内でロガーに NullHandler 以外のハンドラーを追加する,  Up: 避けるべきパターン

9.9.37.4 大量のロガーを作成する
...............................

ロガーはシングルトンであり、スクリプトの実行中に解放されることがないため
、大量のロガーを作成すると、メモリが解放されることなく消費されます。ファ
イルの処理単位やネットワーク接続単位でロガーを作るのではなく、 *note
既存のメカニズム: 3192. を使ってコンテキスト依存の情報をログに渡し、ロガ
ーはアプリケーション内の説明の単位（通常はモジュールだが、場合によっては
それよりも小さい可能性もある）で作るように制限してください。


File: python.info,  Node: その他のリソース<2>,  Prev: 避けるべきパターン,  Up: Logging クックブック

9.9.38 その他のリソース
-----------------------

参考
....

*note logging: 8b. モジュール

     logging モジュールの API リファレンス。

*note logging.config: 8c. モジュール

     logging モジュールの環境設定 API です。

*note logging.handlers: 8d. モジュール

     logging モジュールに含まれる、便利なハンドラです。

*note 基本チュートリアル: 140e.

*note 上級チュートリアル: 140f.


File: python.info,  Node: 正規表現 HOWTO,  Next: ソケットプログラミング HOWTO,  Prev: Logging クックブック,  Up: Python HOWTO

9.10 正規表現 HOWTO
===================


著者: A.M. Kuchling <<amk@amk.ca>>

概要
....

このドキュメントは *note re: be. モジュールを使って Python で正規表現を
扱うための導入のチュートリアルです。ライブラリレファレンスの正規表現の節
よりもやさしい入門ドキュメントを用意しています。

* Menu:

* はじめに: はじめに<16>.
* 単純なパターン::
* 正規表現を使う::
* パターンの能力をさらに::
* 文字列を変更する::
* よくある問題::
* フィードバック::


File: python.info,  Node: はじめに<16>,  Next: 単純なパターン,  Up: 正規表現 HOWTO

9.10.1 はじめに
---------------

正規表現 regular expressions (REs や regexes または regex patterns と呼
ばれます) は本質的に小さく、Python 内部に埋め込まれた高度に特化したプロ
グラミング言語で *note re: be. モジュールから利用可能です。この小さな言
語を利用することで、マッチさせたい文字列に適合するような文字列の集合を指
定することができます; この集合は英文や e-mail アドレスや TeX コマンドな
ど、どんなものでも構いません。「この文字列は指定したパターンにマッチしま
すか?」「このパターンはこの文字列のどの部分にマッチするのですか?」といっ
たことを問い合わせることができます。正規表現を使って文字列を変更したりい
ろいろな方法で別々の部分に分割したりすることもできます。

正規表現パターンは一連のバイトコードとしてコンパイルされ、C で書かれたマ
ッチングエンジンによって実行されます。より進んだ利用法では、エンジンがど
う与えられた正規表現を実行するかに注意することが必要になり、高速に実行で
きるバイトコードを生成するように正規表現を書くことになります。このドキュ
メントでは最適化までは扱いません、それにはマッチングエンジンの内部に対す
る十分な理解が必要だからです。

正規表現言語は相対的に小さく、制限されています、そのため正規表現を使って
あらゆる文字列処理作業を行なえるわけではありません。正規表現を使って行う
ことのできる作業もあります、ただ表現はとても複雑なものになります。それら
の場合では、Python コードを書いた方がいいでしょう; Python コードは念入り
に作られた正規表現より遅くなりますが、おそらくより読み易いでしょう。


File: python.info,  Node: 単純なパターン,  Next: 正規表現を使う,  Prev: はじめに<16>,  Up: 正規表現 HOWTO

9.10.2 単純なパターン
---------------------

まずはできるだけ簡単な正規表現を学ぶことから始めてみましょう。正規表現は
文字列の操作に使われるので、ますは最も一般的な作業である文字のマッチング
をしてみます。

正規表現の基礎を成す計算機科学 (決定、非決定有限オートマトン) の詳細な説
明については, コンパイラ作成に関するテキストブックをどれでもいいので参照
して下さい。

* Menu:

* 文字のマッチング::
* 繰り返し::


File: python.info,  Node: 文字のマッチング,  Next: 繰り返し,  Up: 単純なパターン

9.10.2.1 文字のマッチング
.........................

多くの活字や文字は単純にそれ自身とマッチします。例えば、 ‘test’ という正
規表現は文字列 ‘test’ に厳密にマッチします。(大文字小文字を区別しないモ
ードでその正規表現が ‘Test’ や ‘TEST’ にも同様にマッチすることもできます
; 詳しくは後述します。)

この規則には例外が存在します; いくつかの文字は特別な '特殊文字
(metacharacters)' で、それら自身にマッチしません。代わりに通常のマッチす
るものとは違うという合図を出したり、正規表現の一部に対して繰り返したり、
意味を変えたりして影響を与えます。このドキュメントの中の多くは様々な特殊
文字とそれが何をするかについて論じることになります。

ここに特殊文字の完全な一覧があります; これらの意味はこの HOWTO の残りの
部分で説明します。

     . ^ $ * + ? { } [ ] \ | ( )

最初に扱う特殊文字は ‘[’ と ‘]’ です。これらは文字クラスを指定します、文
字クラスはマッチしたい文字の集合です。文字は個別にリストにしても構いませ
んし、二つの文字を ‘'-'’ でつなげて文字を範囲で与えてもかまいません。た
とえば ‘[abc]’ は ‘a’, ‘b’, または ‘c’ のどの文字列にもマッチします; こ
れは ‘[a-c]’ で同じ文字集合を範囲で表現しても全く同じです。小文字のアル
ファベットのみにマッチしたい場合、 ‘[a-z]’ の正規表現をつかうことになる
でしょう。

(‘\’ を除く) 特殊文字は文字クラスの内部では有効になりません。例えば、
‘[akm$]’ は ‘'a'’, ‘'k'’, ‘'m'’, または ‘'{TX-PL-LABEL}#x27;’ のいずれか
にマッチします; ‘'{TX-PL-LABEL}#x27;’ は通常は特殊文字ですが、文字クラス
内部ではその特別な性質は取り除かれます。

'補集合を取る' ことで、文字クラス内のリストにない文字に対してマッチさせ
られます。 補集合は、クラスの最初の文字として ‘'^'’ を含めることで表せま
す。 例えば、 ‘[^5]’ は ‘'5'’ 以外の文字にマッチします。 キャレットが文
字クラス以外の場所に現れた場合は、特別な意味は持ちません。 例えば、
‘[5^]’ は ‘'5'’ や ‘'^'’ にマッチします。

おそらく最も重要な特殊文字はバックスラッシュ ‘\’ でしょう。 Python の文
字列リテラルのようにバックスラッシュに続けていろいろな文字を入力すること
でいろいろな特殊シーケンスの合図を送ることができます。また、バックスラッ
シュはすべての特殊文字をエスケープするのにも利用されます、つまり、特殊文
字をマッチさせることができます; 例えば、 ‘[’ または ‘\’ にマッチさせたい
場合、それらをバックスラッシュに続けることで特殊な意味を除きます: ‘\[’ ま
たは ‘\\’ 。

‘'\'’ で始まるいくつかの特殊シーケンスは、数字、アルファベット、空白文字
以外など、よく使う文字集合を表しています。

一つ例をお見せしましょう: ‘\w’ は任意の英数字文字にマッチします。バイト
列パターンに対しては、これは文字クラス ‘[a-zA-Z0-9_]’ と等価です。ユニコ
ードパターンに対しては、 ‘\w’ は *note unicodedata: 10b. モジュールで提
供されている Unicode データベースで letters としてマークされている全ての
文字とマッチします。正規表現のコンパイル時に *note re.ASCII: 83e. フラグ
を与えることにより、 ‘\w’ を、より制限された定義で使うことが出来ます。

以下に続く特別な文字列のリストは完全ではありません。特殊シーケンスと拡張
クラスについてのユニコードパターンの定義についての完全なリストは、標準ラ
イブラリリファレンスの *note 正規表現の構文: 92e. の最後のパートを参照し
てください。一般的にユニコードバージョンは、ユニコードデータベース内で相
応しいカテゴリに属すればマッチします。

‘\d’

     任意の十進数とマッチします; これは集合 ‘[0-9]’ と同じ意味です。

‘\D’

     任意の非数字文字とマッチします; これは集合 ‘[^0-9]’ と同じ意味です
     。

‘\s’

     任意の空白文字とマッチします; これは集合 ‘[ \t\n\r\f\v]’ と同じ意味
     です。

‘\S’

     任意の非空白文字とマッチします; これは集合 ‘[^ \t\n\r\f\v]’ と同じ
     意味です。

‘\w’

     任意の英数文字および下線とマッチします; これは、集合 ‘[a-zA-Z0-9_]’
     と同じ意味です。

‘\W’

     任意の非英数文字とマッチします; これは集合 ‘[^a-zA-Z0-9_]’ と同じ意
     味です。

これらのシーケンスは文字クラス内に含めることができます。例えば、
‘[\s,.]’ は空白文字や ‘','’ または ‘'.'’ にマッチする文字クラスです。

この節での最後の特殊文字は ‘.’ です。 これは改行文字を除く任意の文字にマ
ッチし、さらに改行文字に対してもマッチさせる代替モード (*note re.DOTALL:
2763.) があります。 ‘.’ は「任意の文字」にマッチさせたい場合に利用されま
す。


File: python.info,  Node: 繰り返し,  Prev: 文字のマッチング,  Up: 単純なパターン

9.10.2.2 繰り返し
.................

さまざまな文字集合をマッチさせることは正規表現で最初にできるようになるこ
とで、これは文字列に対するメソッドですぐにできることではありません。しか
し、正規表現がより力を発揮する場面がこれだけだとすると、正規表現はあまり
先進的とはいえません。正規表現の力をもう一つの能力は、正規表現の一部が何
度も繰り返されるようものを指定できることです。

最初にとりあげる繰り返しのための最初の特殊文字は ‘*’ です。 ‘*’ は文字リ
テラル ‘'*'’ とはマッチしません; その代わりに、前の文字がぴったり1回では
なく0回以上繰り返されるパターンを指定します。

例えば、 ‘ca*t’ は ‘'ct'’ (文字 ‘'a'’ が 0 個)、 ‘'cat'’ (‘'a'’ が 1 個
)、 ‘'caaat'’ (‘'a'’ が 3 個)、などにマッチします。

‘*’ のような繰り返しは '貪欲 (greedy)' です; 正規表現を繰り返したいとき
、マッチングエンジンは可能な限り何度も繰り返そうと試みます。パターンの後
ろの部分にマッチしない場合、マッチングエンジンは戻ってより少ない繰り返し
を再び試みます。

一歩ずつ例を進めていくとより明確にわかります。 正規表現 ‘a[bcd]*b’ を考
えましょう。 この正規表現は文字 ‘'a'’ 、文字クラス ‘[bcd]’ の 0 個以上の
文字、最後に来る ‘'b'’ にマッチします。 この正規表現が文字列 ‘'abcbd'’ に
対してマッチする流れを想像してみましょう。

ステップ   マッチした文    説明
           字列            
           
-----------------------------------------------------------------
                           
1          ‘a’             正規表現の ‘a’ がマッチ。
                           
                           
2          ‘abcbd’         正規表現エンジンが、文字列の終わり
                           に向かってできるだけ遠くまで
                           ‘[bcd]*’ をマッチさせる。
                           
                           
3          '失敗'          正規表現エンジンが ‘b’ でマッチを試
                           みるが、現在の位置が文字列の最後な
                           ので失敗。
                           
                           
4          ‘abcb’          ‘[bcd]*’ が一文字少なくマッチするよ
                           うに戻る。
                           
                           
5          '失敗'          再び ‘b’ にマッチするか試みるが、現
                           在の位置は最後の文字 ‘'d'’ 。
                           
                           
6          ‘abc’           ‘[bcd]*’ は ‘bc’ のみにマッチするよ
                           うに再び戻る。
                           
                           
6          ‘abcb’          再び ‘b’ を試みる。今回の現在位置の
                           文字は ‘'b'’ なので成功。
                           

正規表現の終端に達して、 ‘'abcd'’ にマッチしました。 この説明は、マッチ
ングエンジンが最初に到達できるところまで進みマッチしなかった場合、逐次戻
って再度残りの正規表現とのマッチを次々と試みること様子を示しています。 正
規表現エンジンは ‘[bcd]*’ の 0 回マッチを試すところまで戻り、その後続の
正規表現とのマッチに失敗した場合には、エンジンは正規表現と文字列が完全に
マッチしないと結論づけることになります。

別の繰り返しのメタ文字には ‘+’ があり、この特殊文字は 1 回以上の繰り返し
にマッチします。 ‘*’ と ‘+’ に違いに対しては十分注意して下さい; ‘*’ は
'0 回' 以上の繰り返しにマッチするので、繰り返す部分が全くなくても問題あ
りません。一方で ‘+’ は少なくとも '1 回' は表われる必要があります。 同様
の例を使うと ‘ca+t’ は ‘'cat'’ (‘'a'’ 1 文字)、 ‘'caaat'’ (‘'a'’ 3 文字
)、とマッチし、‘'ct'’ とはマッチしません。

繰り返しをあらわす演算子または数量子がさらに2つ存在します。クエスチョン
マーク ‘?’ は1回または0回の繰り返しにマッチします; これは、何らかの文字
やパターンがオプションであることをあらわすと考えられます。例えば、
‘home-?brew’ は ‘'homebrew'’ と ‘'home-brew'’ のいずれかにマッチします。

最も複雑な数量子は ‘{m,n}’ でしょう。ここで 'm' と 'n' は10進数の整数で
す。この数量子は繰り返しの回数が最小で 'm' 回、最大で 'n' 回であることを
意味します。例えば、 ‘a/{1,3}b’ は ‘'a/b'’, ‘'a//b'’, および ‘'a///b'’ に
マッチします。一方でスラッシュのない ‘'ab'’ やスラッシュが4つある
‘'a////b'’ にはマッチしません。

'm' か 'n' のどちらかは省略することができます; その場合は、省略された値
は合理的な値が仮定されます。 'm' の省略は下限は 0 と解釈され、'n' の省略
は上限は無限として解釈されます。

The simplest case ‘{m}’ matches the preceding item exactly 'm' times.
For example, ‘a/{2}b’ will only match ‘'a//b'’.

還元主義的傾向のある読者は、他の3つの数量子が全てこの表記を使って表現で
きることに気づくでしょう。 ‘{0,}’ は ‘*’ と同じであり、 ‘{1,}’ は ‘+’ と
等価です。また ‘{0,1}’ は ‘?’ と同じです。とはいえ、簡潔さと読みやすさの
観点から、可能であれば ‘*’, ‘+’, ‘?’ を使う方が望ましいです。


File: python.info,  Node: 正規表現を使う,  Next: パターンの能力をさらに,  Prev: 単純なパターン,  Up: 正規表現 HOWTO

9.10.3 正規表現を使う
---------------------

これまででいくつかの単純な正規表現に触れてきました、実際に Python ではこ
れらをどう使えばいいのでしょう?  *note re: be. モジュールは正規表現エン
ジンに対するインターフェースを提供していて、それらを使うことで正規表現を
オブジェクトにコンパイルし、マッチを実行することができます。

* Menu:

* 正規表現をコンパイルする::
* バックスラッシュ感染症::
* マッチの実行::
* モジュールレベルの関数: モジュールレベルの関数<3>.
* コンパイルフラグ::


File: python.info,  Node: 正規表現をコンパイルする,  Next: バックスラッシュ感染症,  Up: 正規表現を使う

9.10.3.1 正規表現をコンパイルする
.................................

正規表現はパターンオブジェクトにコンパイルされます、パターンオブジェクト
は多くの操作、パターンマッチの検索や文字列の置換の実行などのメソッドを持
っています。

     >>> import re
     >>> p = re.compile('ab*')
     >>> p
     re.compile('ab*')

*note re.compile(): dce. はいくつかの 'flags' 引数を受け付けることができ
ます、この引数はさまざまな特別な機能を有効にしたり、構文を変化させたりし
ます。利用できる設定に何があるかは後に飛ばすことにして、簡単な例をやるこ
とにしましょう:

     >>> p = re.compile('ab*', re.IGNORECASE)

正規表現は文字列として *note re.compile(): dce. に渡されます。正規表現は
文字列として扱われますが、それは正規表現が Python 言語のコアシステムに含
まれないためです、そのため正規表現を表わす特殊な構文はありません。 (正規
表現を全く必要としないアプリケーションも存在します、そのためそれらを含め
て言語仕様を無駄に大きくする必要はありません) その代わり、 *note re: be.
モジュールは *note socket: d1. や *note zlib: 139. モジュールのような通
常の C 拡張モジュールとして Python に含まれています。

正規表現を文字列としておくことで Python 言語はより簡素に保たれていますが
、そのため1つの欠点があります、これについては次の節で話題とします。


File: python.info,  Node: バックスラッシュ感染症,  Next: マッチの実行,  Prev: 正規表現をコンパイルする,  Up: 正規表現を使う

9.10.3.2 バックスラッシュ感染症
...............................

先に述べたように、正規表現は特別な形式や特殊な文字の特別な意味を意味を除
くことを示すためにバックスラッシュ文字 (‘'\'’) を利用します。これは
Python が文字列リテラルに対して、同じ文字を同じ目的で使うことと衝突しま
す。

‘\section’ という文字列 (これは LaTeX ファイルでみかけます) にマッチする
正規表現を書きたいとします。どんなプログラムを書くか考え、マッチして欲し
い文字列をはじめに考えます。次に、バックスラッシュや他の特殊文字をバック
スラッシュに続けて書くことでエスケープしなければいけません、その結果
‘\\section’ のような文字列となります。こうしてできた *note re.compile():
dce. に渡す文字列は ‘\\section’ でなければいけません。しかし、これを
Python の文字列リテラルとして扱うにはこの二つのバックスラッシュを '再び'
エスケープする必要があります。

文字                    段階
                        
-----------------------------------------------------------------------
                        
‘\section’              マッチさせるテキスト
                        
                        
‘\\section’             *note re.compile(): dce. のためのバックスラ
                        ッシュエスケープ
                        
                        
‘"\\\\section"’         文字列リテラルのためのバックスラッシュエスケ
                        ープ
                        

要点だけをいえば、リテラルとしてのバックスラッシュにマッチさせるために、
正規表現文字列として ‘'\\\\'’ と書かなければいけません、なぜなら正規表現
は ‘\\’ であり、通常の Python の文字列リテラルとしてはそれぞれのバックス
ラッシュは ‘\\’ で表現しなければいけないからです。正規表現に関してこのバ
ックスラッシュの繰り返しの機能は、たくさんのバックスラッシュの繰り返しを
生むことになり、その結果として作られる文字列は理解することが難しくなりま
す。

この問題の解決策としては正規表現に対しては Python の raw string 記法を使
うことです; ‘'r'’ を文字列リテラルの先頭に書くことでバックスラッシュは特
別扱いされなくなります、つまり ‘"\n"’ は改行を含む1つの文字からなる文字
列であるのに対して、 ‘r"\n"’ は2つの文字 ‘'\'’ と ‘'n'’ を含む文字列とな
ります。多くの場合 Python コードの中の正規表現はこの raw string 記法を使
って書かれます。

それに加えて、正規表現では有効であるものの Python の文字列リテラルとして
は有効でない特殊文字のエスケープシーケンスは、現在では *note
DeprecationWarning: 1a3. を引き起こし、最終的には *note SyntaxError:
18e. となります。すなわち、そのようなシーケンスは raw string 記法を使う
か、バックスラッシュによるエスケープを使わないかぎり無効になることを意味
します。

通常の文字列            Raw string
                        
-----------------------------------------------
                        
‘"ab*"’                 ‘r"ab*"’
                        
                        
‘"\\\\section"’         ‘r"\\section"’
                        
                        
‘"\\w+\\s+\\1"’         ‘r"\w+\s+\1"’
                        


File: python.info,  Node: マッチの実行,  Next: モジュールレベルの関数<3>,  Prev: バックスラッシュ感染症,  Up: 正規表現を使う

9.10.3.3 マッチの実行
.....................

一旦コンパイルした正規表現を表現するオブジェクトを作成したら、次に何をし
ますか?  パターンオブジェクトはいくつかのメソッドや属性を持っています。
ここでは、その中でも最も重要なものについて扱います; 完全なリストは *note
re: be. ドキュメントを参照して下さい。

メソッド/属性          目的
                       
---------------------------------------------------------------------------
                       
‘match()’              文字列の先頭で正規表現とマッチするか判定します。
                       
                       
‘search()’             文字列を先頭から走査して、正規表現がどこにマッチ
                       するか調べます。
                       
                       
‘findall()’            正規表現にマッチする部分文字列を全て探しだしリス
                       トとして返します。
                       
                       
‘finditer()’           正規表現にマッチする部分文字列を全て探しだし
                       *note iterator: 4c8. として返します。
                       

*note match(): 2774. と *note search(): 2775. はマッチするものが見つから
なければ ‘None’ を返します。 成功すればそれらは *note Match
オブジェクト: 118a. のインスタンスを返します。このオブジェクトにはマッチ
した情報が含まれます: マッチの開始と終了位置、マッチした部分文字列、など
。

You can learn about this by interactively experimenting with the *note
re: be. module.

この HOWTO では例として標準の Python インタプリタを使います。最初に
Python インタプリタを起動して、 *note re: be. モジュールをインポートし、
正規表現をコンパイルします:

     >>> import re
     >>> p = re.compile('[a-z]+')
     >>> p
     re.compile('[a-z]+')

さて、いろいろな文字列を使って正規表現 ‘[a-z]+’ に対するマッチングを試し
てみましょう。空の文字列は全くマッチしません、なぜなら ‘+’ は「1 回以上
の繰り返し」を意味するからです。この場合では *note match(): 2774. は
‘None’ を返すべきで、インタプタは何も出力しません。明確にするために
‘match()’ の結果を明示的に出力することもできます:

     >>> p.match("")
     >>> print(p.match(""))
     None

では、今度はマッチするはずの文字列、例えば ‘tempo’ を試してみましょう。
このケースでは、 *note match(): 2774. は *note match object: 118a. を返
すので、後で使うために結果を変数に記憶しておくべきです。

     >>> m = p.match('tempo')
     >>> m
     <re.Match object; span=(0, 5), match='tempo'>

これでマッチした文字列についての情報を *note Match オブジェクト: 118a. に
問い合わせることが出来ます。 Match オブジェクトインスタンスはいくつかの
メソッドと属性も持っていて、最も重要なのは次のものです:

メソッド/属性          目的
                       
------------------------------------------------------------------------
                       
‘group()’              正規表現にマッチした文字列を返す
                       
                       
‘start()’              マッチの開始位置を返す
                       
                       
‘end()’                マッチの終了位置を返す
                       
                       
‘span()’               マッチの位置 (start, end) を含むタプルを返す
                       

これらのメソッドを試せば、その意味はすぐに理解できます:

     >>> m.group()
     'tempo'
     >>> m.start(), m.end()
     (0, 5)
     >>> m.span()
     (0, 5)

*note group(): 122c. は正規表現でマッチした部分文字列を返します。 *note
start(): 2787. と *note end(): 2788. はそれぞれ、マッチの開始インデクス
と終了インデクスを返します。 *note span(): 2789. は開始と終了のインデク
スを一つのタプルにして返します。 *note match(): 2774. メソッドは正規表現
が文字列の開始位置でマッチするかどうかだけをチェックするので、 ‘start()’
は必ずゼロを返します。 しかし、 *note search(): 2775. メソッドではパター
ンを文字列全体について走査するので、マッチの開始はゼロにならないかもしれ
ません。

     >>> print(p.match('::: message'))
     None
     >>> m = p.search('::: message'); print(m)
     <re.Match object; span=(4, 11), match='message'>
     >>> m.group()
     'message'
     >>> m.span()
     (4, 11)

実際のプログラムでは *note Match オブジェクト: 118a. を変数に記憶してお
き, その次に ‘None’ なのか調べるのが一般的なスタイルです。普通このように
します:

     p = re.compile( ... )
     m = p.match( 'string goes here' )
     if m:
         print('Match found: ', m.group())
     else:
         print('No match')

あるパターンにマッチするもの全てを返す Pattern インスタンスのメソッドが
2つあります。 *note findall(): 277b. はマッチした文字列のリストを返しま
す:

     >>> p = re.compile(r'\d+')
     >>> p.findall('12 drummers drumming, 11 pipers piping, 10 lords a-leaping')
     ['12', '11', '10']

この例では、文字列リテラルを raw string リテラルにするプレフィックス ‘r’
が必要です。これは、正規表現とは異なり、通常の "調理済み" 文字列リテラル
におけるエスケープシーケンスは Python では認識されないためであり、現在で
は *note DeprecationWarning: 1a3. を引き起こし、最終的には *note
SyntaxError: 18e. となります。詳しくは *note バックスラッシュ感染症:
57b6. を参照してください。

*note findall(): 277b. は結果を返す前に完全なリストを必ず生成してしまい
ます。いっぽう *note finditer(): 277c. メソッドは *note
マッチオブジェクト: 118a. インスタンスのシーケンスを *note iterator:
4c8. として返します:

     >>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')
     >>> iterator
     <callable_iterator object at 0x...>
     >>> for match in iterator:
     ...     print(match.span())
     ...
     (0, 2)
     (22, 24)
     (29, 31)


File: python.info,  Node: モジュールレベルの関数<3>,  Next: コンパイルフラグ,  Prev: マッチの実行,  Up: 正規表現を使う

9.10.3.4 モジュールレベルの関数
...............................

パターンオブジェクトを作ってそのメソッドを呼び出す、とする必要は必ずしも
ありません。 *note re: be. モジュールはトップレベルの関数として *note
match(): 1445, *note search(): 1444, *note findall(): 122b, *note sub():
5a3. などを用意しています。これら関数は、対応するメソッドの最初の引数に
RE が追加されただけで後は同じで、 ‘None’ か *note Match オブジェクト:
118a. インスタンスを返すのも同じです:

     >>> print(re.match(r'From\s+', 'Fromage amk'))
     None
     >>> re.match(r'From\s+', 'From amk Thu May 14 19:12:10 1998')
     <re.Match object; span=(0, 5), match='From '>

内部的には、これら関数は単にあなたのためにパターンオブジェクトを生成し、
対応するメソッドを呼び出すだけのことです。とともに、将来の呼び出しで同じ
RE のパースが何度も何度も必要とならないよう、コンパイル済みオブジェクト
はキャッシュされます。

これらモジュールレベル関数を使うのと、パターンを自身で作って自身で呼び出
すのとでどちらを使うべきでしょう?  正規表現をループの内側で使うならば、
プリコンパイルは関数呼び出しを減らします。ループの外側であれば、内部キャ
ッシュのおかげで、どちらでも大差ありません。


File: python.info,  Node: コンパイルフラグ,  Prev: モジュールレベルの関数<3>,  Up: 正規表現を使う

9.10.3.5 コンパイルフラグ
.........................

コンパイルフラグは正規表現の動作をいくつかの側面から変更します。フラグは
*note re: be. モジュール下で二つの名前で利用することができます、例えば長
い名前は *note IGNORECASE: 1a96. で短い名前は1文字で *note I: 2766. のよ
うになっています。 (1文字形式は Perl のパターン修飾子と同じ形式を使いま
す; 例えば *note re.VERBOSE: 2772. の短かい形式は *note re.X: 276b. です
。) 複数のフラグが OR ビット演算で指定することができます; 例えば ‘re.I |
re.M’ は *note I: 2766. と *note M: 2768. フラグの両方を設定します。

ここに利用可能なフラグの表があります、それぞれについてのより詳細な説明が
後に続きます。

Flag                                  意味
                                      
---------------------------------------------------------------------------------------
                                      
*note ASCII: 83e, *note A: 2765.      ‘\w’, ‘\b’, ‘\s’, そして ‘\d’ などをそれぞれの
                                      プロパティをもつ ASCII 文字だけにマッチさせま
                                      す。
                                      
                                      
*note DOTALL: 2763, *note S: 2769.    ‘.’ を改行を含む任意の文字にマッチするようにし
                                      ます。
                                      
                                      
*note IGNORECASE: 1a96,               大文字小文字を区別しないマッチを行います。
*note I: 2766.                        

*note LOCALE: d63, *note L: 2767.     ロケールに対応したマッチを行います。
                                      
                                      
*note MULTILINE: 2764,                ‘^’ や ‘$’ の意味を変更し、複数行文字列に対す
*note M: 2768.                        るマッチングを行います。
                                      
                                      
*note VERBOSE: 2772, *note X: 276b.   冗長な正規表現を利用できるようにして、よりきれ
('X' は 'extended' の 'X')            いで理解しやすくまとめることができます。
                                      

 -- データ: re.I

 -- データ: re.IGNORECASE

     大文字と小文字を区別しないマッチングを実行します; 文字クラスと文字
     列リテラルは大文字か小文字かに関係なくパターンにマッチします。例え
     ば、 ‘[A-Z]’ は小文字のアルファベットにもマッチします。 *note
     ASCII: 83e. フラグによって非 ASCII 文字のマッチングが無効化されてい
     なければ、完全なユニコードのマッチングも可能です。ユニコードで
     ‘[a-z]’ または ‘[A-Z]’ が *note IGNORECASE: 1a96. フラグとともに使
     われると、 52個の ASCII 文字に加えて 次の4つの 非 ASCII 文字にマッ
     チします: 'İ' (U+0130, ラテン語の大文字 I で、上部に点がついたもの
     ), 'ı' (U+0131, ラテン語の小文字 i で上部に点がない), 'ſ' (U+017F,
     ラテン語の小文字 s), 'K' (U+212A, ケルビン記号)。 ‘Spam’ は
     ‘'Spam'’, ‘'spam'’, ‘'spAM'’, そして ‘'ſpam'’ にマッチします (ただ
     し最後の文字列はユニコードモードの場合のみマッチします)。この「小文
     字化」は現在のロケールを考慮しません; ただし *note LOCALE: d63. フ
     ラグをセットした場合はロケールを考慮します。

 -- データ: re.L

 -- データ: re.LOCALE

     ‘\w’, ‘\W’, ‘\b’, ‘\B’ と小文字大文字の区別を無視したマッチングを、
     Unicode データベースではなく現在のロケールに従って行います。

     ロケールは言語の違いを考慮したプログラムを書くことを手助けすること
     を目的とした C ライブラリの機能です。例えば、エンコードされたフラン
     ス語のテキストを処理していて、‘\w+’ を使って単語のマッチを行いたい
     とします。ですがこの場合、 ‘\w’ はバイトパターンにおいて文字クラス
     ‘[A-Za-z]’ だけにマッチします; すなわち ‘é’ や ‘ç’ に対応するバイト
     列にはマッチしません。もしシステムが適切に設定されていて、ロケール
     がフランス語に設定されていれば、ある C 関数はプログラムに ‘é’ に対
     応するバイト列も文字として考慮するべきであると伝えます。正規表現を
     コンパイルするときに *note LOCALE: d63. フラグを設定すると、コンパ
     イルされたオブジェクトが ‘\w’ に対してロケールを考慮する C 関数を使
     うようになります; これにより処理は遅くなりますが、 ‘\w+’ を期待通り
     フランス語の単語にマッチさせることが可能になります。このフラグを
     Python 3 で利用することは推奨されません。なぜならロケールの仕組みは
     非常に信頼性が低く、同時にひとつの "文化" しか扱うことができず、ま
     た8ビットのロケールでしか正しく動作しないからです。Python 3 ではユ
     ニコード (文字列の) パターンに対してユニコードのマッチングがデフォ
     ルトで有効化されており、これにより異なるロケールまたは言語を同時に
     扱うことができます。

 -- データ: re.M

 -- データ: re.MULTILINE

     (‘^’ と ‘$’ についてはまだ説明していません; これらは *note
     さらなる特殊文字: 57ba. の節で説明します。)

     通常 ‘^’ は文字列の先頭にマッチし、 ‘$’ は文字列の末尾と文字列の末
     尾に改行(があれば)その直前にマッチします。このフラグが指定されると
     、 ‘^’ は文字列の先頭と文字列の中の改行に続く各行の先頭にマッチしま
     す。同様に ‘$’ 特殊文字は文字列の末尾と各行の末尾(各改行の直前)のど
     ちらにもマッチします。

 -- データ: re.S

 -- データ: re.DOTALL

     特別な文字 ‘'.'’ を改行を含む全ての任意の文字とマッチするようにしま
     す; このフラグが無しでは、 ‘'.'’ は改行 '以外' の全てにマッチします
     。

 -- データ: re.A

 -- データ: re.ASCII

     ‘\w’, ‘\W’, ‘\b’, ‘\B’, ‘\s’, ‘\S’ が、完全な Unicode マッチングで
     はなく、ASCII のみのマッチングをするようにします。これは Unicode パ
     ターンにのみ意味があり、byte パターンには無視されます。

 -- データ: re.X

 -- データ: re.VERBOSE

     このフラグはより柔軟な形式で正規表現を読み易く書けるようにします。
     このフラグを指定すると、正規表現の中の空白は無視されます、ただし、
     文字クラス内やエスケープされていないバックスラッシュに続く空白の場
     合は例外として無視されません; これによって正規表現をまとめたり、イ
     ンデントしてより明確にすることができます。このフラグはさらにエンジ
     ンが無視するコメントを追加することもできます; コメントは ‘'#'’ で示
     します、これは文字クラスやエスケープされていないバックスラッシュに
     続くものであってはいけません。

     例えば、ここに *note re.VERBOSE: 2772. を利用した正規表現があります
     ; 読み易いと思いませんか?

          charref = re.compile(r"""
           &[#]                # Start of a numeric entity reference
           (
               0[0-7]+         # Octal form
             | [0-9]+          # Decimal form
             | x[0-9a-fA-F]+   # Hexadecimal form
           )
           ;                   # Trailing semicolon
          """, re.VERBOSE)

     冗長な表現を利用しない設定の場合、正規表現はこうなります:

          charref = re.compile("&#(0[0-7]+"
                               "|[0-9]+"
                               "|x[0-9a-fA-F]+);")

     上の例では、Python の文字列リテラルの自動結合によって正規表現を小さ
     な部分に分割しています、それでも *note re.VERBOSE: 2772. を使った場
     合に比べるとまだ難しくなっています。


File: python.info,  Node: パターンの能力をさらに,  Next: 文字列を変更する,  Prev: 正規表現を使う,  Up: 正規表現 HOWTO

9.10.4 パターンの能力をさらに
-----------------------------

ここまでで、正規表現の機能のほんの一部を扱ってきました。この節では、新た
にいくつかの特殊文字とグループを使ってマッチしたテキストの一部をどう取得
するかについて扱います。

* Menu:

* さらなる特殊文字::
* グルーピング::
* 取り出さないグループと名前つきグループ::
* 先読みアサーション (Lookahead Assertions): 先読みアサーション Lookahead Assertions.


File: python.info,  Node: さらなる特殊文字,  Next: グルーピング,  Up: パターンの能力をさらに

9.10.4.1 さらなる特殊文字
.........................

これまでで、まだ扱っていない特殊文字がいくつかありました。そのほとんどを
この節で扱っていきます。

残りの特殊文字の内いくつかは 'ゼロ幅アサーション zero-width-assertions'
に関するものです。これらは文字列に対してエンジンを進めません; 文字列を全
く利用しない代わりに、単純に成功か失敗かを利用します。例えば、 ‘\b’ は現
在位置が単語の境界であることを示します; ‘\b’ によってエンジンの読んでい
る位置は全く変化しません。つまり、これはゼロ幅アサーションは繰り返し使う
ことがありません、一度ある位置でマッチしたら、明らかに無限回マッチできま
す。

‘|’

     代替 (alternation) または "or" 演算子です。 'A' と 'B' が正規表現の
     場合、 ‘A|B’ は 'A' と 'B' のどちらかにマッチするような文字列にマッ
     チします。複数の文字からなる文字列による代替処理が適切に動作するた
     めに、 ‘|’ の優先度は非常に低く設定されています。 ‘Crow|Servo’ は
     ‘'Crow'’ か ‘'Servo'’ のどちらかにマッチするパターンであり、 「
     ‘'Cro'’ に続いて ‘'w'’ または ‘'S'’ があり、さらに ‘'ervo'’ が続く
     」という意味ではありません。

     リテラル ‘'|'’ にマッチするには、 ‘\|’ を利用するか、 ‘[|]’ のよう
     に文字クラス内に収めて下さい。

‘^’

     行の先頭にマッチします。 *note MULTILINE: 2764. フラグが設定されな
     い場合には、文字列の先頭にのみマッチします。 *note MULTILINE: 2764.
     モードでは文字列内の各改行の直後にマッチします。

     例えば、行の先頭の ‘From’ にのみマッチさせたい場合には ‘^From’ 正規
     表現を利用します。

          >>> print(re.search('^From', 'From Here to Eternity'))
          <re.Match object; span=(0, 4), match='From'>
          >>> print(re.search('^From', 'Reciting From Memory'))
          None

     リテラル ‘'^'’ にマッチするには ‘\^’ を利用してください。

‘$’

     行の末尾にマッチします、行の末尾は文字列の末尾と改行文字の直前とし
     て定義されます。

          >>> print(re.search('}$', '{block}'))
          <re.Match object; span=(6, 7), match='}'>
          >>> print(re.search('}$', '{block} '))
          None
          >>> print(re.search('}$', '{block}\n'))
          <re.Match object; span=(6, 7), match='}'>

     リテラル ‘'$'’ にマッチするには、 ‘\$’ を利用するか、 ‘[$]’ のよう
     に文字クラス内に収めて下さい。

‘\A’

     文字列の先頭にのみマッチします。 *note MULTILINE: 2764. モードでな
     い場合には ‘\A’ と ‘^’ は実質的に同じです。 *note MULTILINE: 2764.
     モードでのこれらの違いは: ‘\A’ は依然として文字列の先頭にのみマッチ
     しますが、 ‘^’ は文字列内に改行文字に続く部分があればそこにマッチす
     ることです。

‘\z’

     文字列の末尾でのみマッチします。

‘\Z’

     The same as ‘\z’.  For compatibility with old Python versions.

‘\b’

     単語の境界。これはゼロ幅アサーションで、単語の始まりか終わりにのみ
     マッチします。単語は英数文字のシーケンスとして定義されます、つまり
     単語の終わりは空白か非英数文字として表われます。

     以下の例では ‘class’ がそのものの単語のときのみマッチします; 別の単
     語内に含まれている場合はマッチしません。

          >>> p = re.compile(r'\bclass\b')
          >>> print(p.search('no class at all'))
          <re.Match object; span=(3, 8), match='class'>
          >>> print(p.search('the declassified algorithm'))
          None
          >>> print(p.search('one subclass is'))
          None

     この特殊シーケンスを利用するときには二つの微妙な点を心にとめておく
     必要があります。まずひとつめは Python の文字列リテラルと表現の間の
     最悪の衝突を引き起すことです。Python の文字列リテラルでは ‘\b’ は
     ASCII 値8のバックスペース文字です。raw string を利用していない場合
     、Python は ‘\b’ をバックスペースに変換し、正規表現は期待するものと
     マッチしなくなります。以下の例はさきほどと同じ正規表現のように見え
     ますが、正規表現文字列の前の ‘'r'’ が省略されています。

          >>> p = re.compile('\bclass\b')
          >>> print(p.search('no class at all'))
          None
          >>> print(p.search('\b' + 'class' + '\b'))
          <re.Match object; span=(0, 7), match='\x08class\x08'>

     ふたつめはこのアサーションが利用できない文字列クラスの内部では
     Python の文字列リテラルとの互換性のために、 ‘\b’ はバックスペース文
     字を表わすことになるということです。

‘\B’

     別のゼロ幅アサーションで、 ‘\b’ と逆で、現在の位置が単語の境界でな
     いときにのみマッチします。


File: python.info,  Node: グルーピング,  Next: 取り出さないグループと名前つきグループ,  Prev: さらなる特殊文字,  Up: パターンの能力をさらに

9.10.4.2 グルーピング
.....................

正規表現にマッチするかどうかだけでなく、より多くの情報を得なければいけな
い場合は多々あります。正規表現はしばしば、正規表現をいくつかのサブグルー
プに分けて興味ある部分にマッチするようにして、文字列を分割するのに使われ
ます。例えば、RFC-822 ヘッダ行は ‘':'’ を挟んでこのようにヘッダ名と値に
分割されます:

     From: author@example.com
     User-Agent: Thunderbird 1.5.0.9 (X11/20061227)
     MIME-Version: 1.0
     To: editor@example.com

これはヘッダ全体にマッチし、そしてヘッダ名にマッチするグループとヘッダの
値にマッチする別のグループを持つように正規表現を書くことで扱うことができ
ます。

グループはメタ文字 ‘'('’ と ‘')'’ であらわされます。 ‘'('’ と ‘')'’ は数
式における意味とほぼ同じ意味を持っています; その中に含まれる表現をひとま
とまりにし、それらに対して ‘*’, ‘+’, ‘?’, または ‘{m,n}’ のような数量子
を使った繰り返しを表現することもできます。例えば、 ‘(ab)*’ は ‘ab’ の0回
以上の繰り返しにマッチします。

     >>> p = re.compile('(ab)*')
     >>> print(p.match('ababababab').span())
     (0, 10)

‘'('’, ‘')'’ で指示されたグループは、マッチしたテキスト開始と終了位置も
キャプチャします; *note group(): 122c, *note start(): 2787, *note end():
2788, *note span(): 2789. に引数を与えて取り出せます。グループはゼロ始ま
りの数値です。グループ 0 は常に使えます; それは RE でマッチした全体で、
*note Match オブジェクト: 118a. メソッドの全てはグループ 0 をデフォルト
引数にしています。マッチするテキストの範囲をキャプチャしないグループの書
き方はのちほど見ることにします。

     >>> p = re.compile('(a)b')
     >>> m = p.match('ab')
     >>> m.group()
     'ab'
     >>> m.group(0)
     'ab'

サブグループは左から右へ1づつ番号付けされます。グループはネストしてもか
まいません; 番号を決めるには、単に開き括弧を左から右へ数え上げます。

     >>> p = re.compile('(a(b)c)d')
     >>> m = p.match('abcd')
     >>> m.group(0)
     'abcd'
     >>> m.group(1)
     'abc'
     >>> m.group(2)
     'b'

*note group(): 122c. には一回に複数の引数を渡してもかまいません、その場
合にはそれらのグループに対応する値を含むタプルを返します。

     >>> m.group(2,1,2)
     ('b', 'abc', 'b')

*note groups(): 122d. メソッドは 1 から全てのサブグループの文字列を含む
タプルを返します。:

     >>> m.groups()
     ('abc', 'b')

パターン中で後方参照を利用することで、前に取り出されたグループが文字列の
中の現在位置で見つかるように指定できます。例えば、‘\1’ はグループ1の内容
が現在位置で見つかった場合成功し、それ以外の場合に失敗します。Python の
文字列リテラルでもバックスラッシュに続く数字は任意の文字を文字列に含める
ために使われるということを心に留めておいて下さい、そのため正規表現で後方
参照を含む場合には raw string を必ず利用して下さい。

例えば、以下の正規表現は二重になった単語を検出します。

     >>> p = re.compile(r'\b(\w+)\s+\1\b')
     >>> p.search('Paris in the the spring').group()
     'the the'

このような後方参照は文字列を検索するだけの用途では多くの場合役に立ちませ
ん。-- このように繰り返されるテキストフォーマットは少数です。-- しかし、
文字列の置換をする場合には 'とても' 有効であることに気づくでしょう。


File: python.info,  Node: 取り出さないグループと名前つきグループ,  Next: 先読みアサーション Lookahead Assertions,  Prev: グルーピング,  Up: パターンの能力をさらに

9.10.4.3 取り出さないグループと名前つきグループ
...............................................

念入りに作られた正規表現は多くのグループを利用します、その利用法には対象
となる部分文字列を取り出す、正規表現自身をグループ化したり構造化する、と
いう二つの方法があります。複雑な正規表現では、グループ番号を追っていくこ
とは困難になっていきます。この問題の解決を助ける二つの機能があります。そ
の両方が正規表現を拡張するための一般的な構文を利用します、まずはそれらを
みてみましょう。

Perl 5 は標準正規表現にパワフルな拡張を加えたことでよく知られています。
それらの新しい機能のために Perl 開発者たちは、Perl正規表現と標準正規表現
との混乱を招く違いなしには、新たな一文字メタキャラクタも ‘\’ ではじまる
新たな特殊シーケンスもどちらも選択出来ませんでした。たとえば彼らがもし
‘&’ を新たなメタキャラクタとして選んでいたら、 ‘&’ が通常文字とみなされ
ていた古い正規表現は ‘\&’ や ‘[&]’ のように書くことでエスケープされなけ
ればならなかったでしょう。

解決策として Perl 開発者が選んだものは ‘(?...)’ を正規表現構文として利用
することでした。括弧の直後の ‘?’ は構文エラーとなります、これは ‘?’ で繰
り返す対象がないためです、そのためこれは互換性の問題を持ち込みません。
‘?’ の直後の文字はどの拡張が利用されるかを示しています、つまり、
‘(?=foo)’ は一つの拡張を利用したもの (肯定先読みアサーション) となり、
‘(?:foo)’ は別の拡張を利用した表現(‘foo’ を含む取り込まないグループ)とな
ります。

Python は Perl の拡張のいくつかをサポートし、また、Perl の拡張に一つ拡張
を加えています。クエスチョンマークに続く最初の文字が ‘P’ のものは、そう
です、Python 固有の拡張です。

一般化された拡張構文についてはわかりましたので、いよいよ複雑な正規表現内
でのグループの扱いを単純化する機能に話を戻しましょう。

ときとしてあなたは、正規表現の一部として使いたいけれども、その内容を取り
出すことに興味がないようなグループを記述する必要に迫られます。このために
は、取り出さないグループ: ‘(?:...)’ を使います。 ‘...’ 部分は任意の正規
表現です。

     >>> m = re.match("([abc])+", "abc")
     >>> m.groups()
     ('c',)
     >>> m = re.match("(?:[abc])+", "abc")
     >>> m.groups()
     ()

マッチしたグループの内容を取得しないということを除けば、取り込まないグル
ープは厳密に取り込むグループと同様に振る舞います; この中に何を入れてもか
まいません、 ‘*’ のような繰り返しの特殊文字で繰り返したり、他のグループ
(取り込むまたは取り込まない) の入れ子にすることもでいます。 ‘(?:...)’ は
特に、既にあるパターンを変更する際に便利です、なぜなら他の番号づけ新しい
グループを変更することなく新しいグループを追加することができます。取り込
むグループと取り込まないグループで検索のパフォーマンスに差がないことにも
触れておくべきことです; どちらも同じ速度で動作します。

より重要な機能は名前つきグループです: 番号で参照する代わりに、グループに
対して名前で参照できます。

名前つきグループのための構文は、 Python 固有拡張の一つ: ‘(?P<name>...)’
を使います。 'name' は、もちろん、グループの名前です。名前つきグループは
取り込むグループと完全に同じに振る舞い、加えて名前が関連付けられます。
*note Match オブジェクト: 118a. の取りこむグループを扱うメソッドは全て、
番号によるグループ参照のための整数、名前によるグループ参照のための文字列
、ともに許容しています。名前つきグループにも番号が振られますので、グルー
プについての情報を、2つの方法で取り出せます:

     >>> p = re.compile(r'(?P<word>\b\w+\b)')
     >>> m = p.search( '(((( Lots of punctuation )))' )
     >>> m.group('word')
     'Lots'
     >>> m.group(1)
     'Lots'

さらに、名前付きのグループを *note groupdict(): 2786. を使って辞書として
取り出すこともできます:

     >>> m = re.match(r'(?P<first>\w+) (?P<last>\w+)', 'Jane Doe')
     >>> m.groupdict()
     {'first': 'Jane', 'last': 'Doe'}

名前つきグループは、番号を覚える代わりに簡単に覚えられる名前で管理できる
ため、便利です。以下は *note imaplib: 78. モジュールで使われている正規表
現の例です:

     InternalDate = re.compile(r'INTERNALDATE "'
             r'(?P<day>[ 123][0-9])-(?P<mon>[A-Z][a-z][a-z])-'
             r'(?P<year>[0-9][0-9][0-9][0-9])'
             r' (?P<hour>[0-9][0-9]):(?P<min>[0-9][0-9]):(?P<sec>[0-9][0-9])'
             r' (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])'
             r'"')

取得する番号9を覚えるよりも、 ‘m.group('zonem')’ で取得した方が明らかに
簡単にすみます。

後方参照のための構文 ‘(...)\1’ はグループ番号への参照となっています。 グ
ループ番号の代わりに、グループ名を利用する変種があるのは当然でしょう。 こ
れはもう一つの Python 拡張です: ‘(?P=name)’ は、 'name' という名前のグル
ープの内容が、現在の位置で再びマッチすることを示しています。 同じ単語が
2つ連なっているのを見つける正規表現 ‘\b(\w+)\s+\1\b’ は
‘\b(?P<word>\w+)\s+(?P=word)\b’ のように書けます:

     >>> p = re.compile(r'\b(?P<word>\w+)\s+(?P=word)\b')
     >>> p.search('Paris in the the spring').group()
     'the the'


File: python.info,  Node: 先読みアサーション Lookahead Assertions,  Prev: 取り出さないグループと名前つきグループ,  Up: パターンの能力をさらに

9.10.4.4 先読みアサーション (Lookahead Assertions)
..................................................

他のゼロ幅アサーションは先読みアサーションです。先読みアサーションは肯定
、否定の両方の形式が利用可能です、これを見てください:

‘(?=...)’

     肯定先読みアサーション。 ‘...’ で表わす正規表現が現在位置でマッチす
     れば成功し、それ以外の場合失敗します。しかし、表現が試行された場合
     でもエンジンは先に進みません; パターンの残りの部分はアサーションの
     開始時点から右に試行します。

‘(?!...)’

     否定先読みアサーション。これは肯定アサーションの逆で、正規表現が文
     字列の現在位置にマッチ 'しなかった' 場合に成功します。

より具体的にするため、先読みが便利な場合をみてみましょう。ファイル名にマ
ッチし、 ‘.’ で分けられた基本部分と拡張子に分離する単純なパターンを考え
ましょう。例えば、 ‘news.rc’ は ‘news’ が基本部分で ‘rc’ がファイル名の
拡張子です。

マッチするパターンはとても単純です:

‘.*[.].*$’

‘.’ はメタキャラクタですので特別に扱わなければなりませんから、文字クラス
内に入れて、そのものとだけマッチするようにしていることに注目です。末尾の
‘$’ にも注目してください; これは残り全ての文字列が拡張子に含まれるべきで
あることを保障するために追加しています。この正規表現は ‘foo.bar’,
‘autoexec.bat’, ‘sendmail.cf’, ‘printers.conf’ にマッチします。

さて、問題を少し複雑にしてみましょう; 拡張子が ‘bat’ でないファイル名に
マッチしたい場合はどうでしょう？間違った試み:

‘.*[.][^b].*$’

The first attempt above tries to exclude ‘bat’ by requiring that the
first character of the extension is not a ‘b’.  This is wrong, because
the pattern also doesn't match ‘foo.bar’.

‘.*[.]([^b]..|.[^a].|..[^t])$’

正規表現が混乱してきました。最初の解決策を取り繕って、以下の場合に合わせ
ることを要求しています: 拡張子の最初の文字は ‘b’ でなく; 二番目の文字は
‘a’ でなく; 三番目の文字は ‘t’ でない。これは ‘foo.bar’ を受け付けますが
、 ‘autoexec.bat’ は拒否します。しかし、三文字の拡張子を要求し、
‘sendmail.cf’ のような二文字の拡張子を受け付けません。これを修正するのに
パターンを再び複雑にすることになります。

‘.*[.]([^b].?.?|.[^a]?.?|..?[^t]?)$’

三番目の試みでは、 ‘sendmail.cf’ のように三文字より短い拡張子とマッチす
るために第二第三の文字を全てオプションにしています。

パターンはさらに複雑さを増し、読みにくく、理解が難しくなりました。より悪
いことに、問題が ‘bat’ と ‘exe’ 両方を拡張子から除きたい場合に変わった場
合、パターンはより複雑で混乱しやすいものになります。

否定先読みはこの混乱全てを取り除きます:

‘.*[.](?!bat$)[^.]*$’

The negative lookahead means: if the expression ‘bat’ doesn't match at
this point, try the rest of the pattern; if ‘bat$’ does match, the whole
pattern will fail.  The trailing ‘$’ is required to ensure that
something like ‘sample.batch’, where the extension only starts with
‘bat’, will be allowed.  The ‘[^.]*’ makes sure that the pattern works
when there are multiple dots in the filename.

他のファイル名の拡張子を除くことも簡単です; 単純にアサーション内に拡張子
を代替 (or) で加えます。以下のパターンは ‘bat’ や ‘exe’ のどちらかで終わ
るファイル名を除外します:

‘.*[.](?!bat$|exe$)[^.]*$’


File: python.info,  Node: 文字列を変更する,  Next: よくある問題,  Prev: パターンの能力をさらに,  Up: 正規表現 HOWTO

9.10.5 文字列を変更する
-----------------------

ここまででは単純に静的な文字列に対する検索を実行してきました。正規表現は
文字列を様々な方法で変更するのにもよく使われます。変更には以下のパターン
メソッドが利用されます:

メソッド/属性          目的
                       
---------------------------------------------------------------------------
                       
‘split()’              文字列をリストに分割する、正規表現がマッチした全
                       ての場所で分割を行う
                       
                       
‘sub()’                正規表現にマッチした全ての文字列を発見し、別の文
                       字列に置き換えます
                       
                       
‘subn()’               ‘sub()’ と同じことをしますが、新しい文字列と置き
                       換えの回数を返します
                       

* Menu:

* 文字列の分割::
* 検索と置換: 検索と置換<2>.


File: python.info,  Node: 文字列の分割,  Next: 検索と置換<2>,  Up: 文字列を変更する

9.10.5.1 文字列の分割
.....................

‘split()’ メソッドは文字列を正規表現にマッチした場所で分割し、リストで返
却します。文字列の *note split(): 10aa. メソッドに似てはいますが、もっと
ずっと一般化したデリミタで分割出来ます; 文字列の ‘split()’ メソッドは単
に空白文字か固定文字列で分割出来るだけです。ご想像通り、モジュールレベル
の *note re.split(): 5a2. 関数もあります。

 -- メソッド: .split (string[, maxsplit=0])

     'string' を正規表現のマッチで分割します。正規表現内に取り込むための
     括弧が利用されている場合、その内容も結果のリストの一部として返され
     ます。 'maxsplit' が非ゼロの場合、最大で 'maxsplit' の分割が実行さ
     れます。

'maxsplit' に値を渡すことで、分割される回数を制限することができます。
'maxsplit' が非ゼロの場合、最大で 'maxsplit' の分割が行なわれ、文字列の
残りがリストの最終要素として返されます。以下の例では、デリミタは任意の英
数文字のシーケンスです。

     >>> p = re.compile(r'\W+')
     >>> p.split('This is a test, short and sweet, of split().')
     ['This', 'is', 'a', 'test', 'short', 'and', 'sweet', 'of', 'split', '']
     >>> p.split('This is a test, short and sweet, of split().', 3)
     ['This', 'is', 'a', 'test, short and sweet, of split().']

興味の対象がデリミタの間のテキストだけでなく、デリミタが何なのかというこ
とを知りたい場合はよくあります。取りこみ用の括弧を正規表現に使った場合、
その値もリストの一部として返されます。以下の呼び出しを比較してみましょう
:

     >>> p = re.compile(r'\W+')
     >>> p2 = re.compile(r'(\W+)')
     >>> p.split('This... is a test.')
     ['This', 'is', 'a', 'test', '']
     >>> p2.split('This... is a test.')
     ['This', '... ', 'is', ' ', 'a', ' ', 'test', '.', '']

モジュールレベル関数 *note re.split(): 5a2. は最初の引数に利用する正規表
現を追加しますが、それ以外は同じです。

     >>> re.split(r'[\W]+', 'Words, words, words.')
     ['Words', 'words', 'words', '']
     >>> re.split(r'([\W]+)', 'Words, words, words.')
     ['Words', ', ', 'words', ', ', 'words', '.', '']
     >>> re.split(r'[\W]+', 'Words, words, words.', 1)
     ['Words', 'words, words.']


File: python.info,  Node: 検索と置換<2>,  Prev: 文字列の分割,  Up: 文字列を変更する

9.10.5.2 検索と置換
...................

もう一つのよくある作業は、パターンにマッチする全ての文字列を探し、異なる
文字列に置換します。 *note sub(): 277d. メソッドは置換する値をとります、
文字列と関数の両方をとることができ、文字列を処理します。

 -- メソッド: .sub (replacement, string[, count=0])

     'string' 内で最も長く、他の部分と重複するところがない正規表現を
     'replacement' に置換した文字列を返します。パターンが見つからなかっ
     た場合 'string' は変更されずに返されます。

     オプション引数 'count' はパターンの出現の最大置換回数です; 'count'
     は非負の整数でなければいけません。デフォルト値 0 は全ての出現で置換
     することを意味します。

ここに *note sub(): 277d. メソッドを使った単純な例があります。これは色の
名前を ‘colour’ に置換します:

     >>> p = re.compile('(blue|white|red)')
     >>> p.sub('colour', 'blue socks and red shoes')
     'colour socks and colour shoes'
     >>> p.sub('colour', 'blue socks and red shoes', count=1)
     'colour socks and red shoes'

*note subn(): 277e. メソッドも同じ働きをしますが、新しい文字列と置換の実
行回数を含む 2-タプルを返します:

     >>> p = re.compile('(blue|white|red)')
     >>> p.subn('colour', 'blue socks and red shoes')
     ('colour socks and colour shoes', 2)
     >>> p.subn('colour', 'no colours at all')
     ('no colours at all', 0)

空文字列とのマッチは、直前の空文字列とマッチした部分と隣接していない場合
にのみ置換されます。

     >>> p = re.compile('x*')
     >>> p.sub('-', 'abxd')
     '-a-b--d-'

'replacement' が文字列の場合、文字列内のバックスラッシュエスケープは処理
されます。つまり、‘\n’ は改行文字に ‘\r’ はキャリッジリターンに、等とな
ります。‘\&’ のような未知のエスケープシーケンスはそのまま残されます。
‘\6’ のような後方参照は正規表現内の対応するグループにマッチする文字列に
置換されます。これを使うことで元のテキストの一部を、置換後の文字列に組み
込むことができます。

この例は単語 ‘section’ に続く ‘{’ と ‘}’ で閉じられた文字列にマッチし、
‘section’ を ‘subsection’ に変更します:

     >>> p = re.compile('section{ ( [^}]* ) }', re.VERBOSE)
     >>> p.sub(r'subsection{\1}','section{First} section{second}')
     'subsection{First} subsection{second}'

‘(?P<name>...)’ 構文で定義された名前つきグループを参照するための構文もあ
ります。 ‘\g<name>’ は ‘name’ で名前づけされたグループにマッチする文字列
を利用し、 ‘\g<number>’ は対応するグループ番号を利用します。つまり
‘\g<2>’ は ‘\2’ と等価ですが、 ‘\g<2>0’ のような置換文字列に対しては明確
に異なります。 (‘\20’ はグループ番号20への参照と解釈され、グループ2の後
にリテラル文字 ‘'0'’ が続くとは解釈されません。) 以下に示す置換は全て等
価ですが、これらは文字列置換に全部で3種の変種を利用しています。

     >>> p = re.compile('section{ (?P<name> [^}]* ) }', re.VERBOSE)
     >>> p.sub(r'subsection{\1}','section{First}')
     'subsection{First}'
     >>> p.sub(r'subsection{\g<1>}','section{First}')
     'subsection{First}'
     >>> p.sub(r'subsection{\g<name>}','section{First}')
     'subsection{First}'

より細かな制御を手中にするために 'replacement' として関数を使うことが出
来ます。 'replacement' が関数であれば、その関数は重なり合わない
'pattern' の発生のたびに呼び出されます。それぞれの呼び出しで、マッチした
*note Match オブジェクト: 118a. が引数として渡されるので、望みの置換と返
却のためにこの情報を利用出来ます。

続く例では、置換関数は十進数文字列を十六進数文字列に変換しています:

     >>> def hexrepl(match):
     ...     "Return the hex string for a decimal number"
     ...     value = int(match.group())
     ...     return hex(value)
     ...
     >>> p = re.compile(r'\d+')
     >>> p.sub(hexrepl, 'Call 65490 for printing, 49152 for user code.')
     'Call 0xffd2 for printing, 0xc000 for user code.'

モジュールレベルの *note re.sub(): 5a3. 関数を使うときには、パターンが最
初の引数として渡されます。パターンはオブジェクトや文字列をとります; 正規
表現フラグを指定する必要がある場合、パターンオブジェクトを最初の引数とし
て使うか、修飾子を埋め込んだパターン文字列を使うかしなければいけません、
例えば ‘sub("(?i)b+", "x", "bbbb BBBB")’ は ‘'x x'’ を返します。


File: python.info,  Node: よくある問題,  Next: フィードバック,  Prev: 文字列を変更する,  Up: 正規表現 HOWTO

9.10.6 よくある問題
-------------------

正規表現はいくつかの応用に対して強力なツールですが、いくつかの部分でそれ
らの振る舞いは直感的ではなく、期待通りに振る舞わないことがあります。この
節では最もよくある落とし穴を指摘します。

* Menu:

* 文字列メソッドを利用する::
* match() 対 search(): match 対 search.
* 貪欲 (greedy) 対非貪欲 (non-greedy): 貪欲 greedy 対非貪欲 non-greedy.
* re.VERBOSE の利用: re VERBOSE の利用.


File: python.info,  Node: 文字列メソッドを利用する,  Next: match 対 search,  Up: よくある問題

9.10.6.1 文字列メソッドを利用する
.................................

いくつかの場合 *note re: be. モジュールを利用することは間違いである場合
があります。固定文字列や単一の文字クラスにマッチさせる場合や、 *note
IGNORECASE: 1a96. フラグのような *note re: be. の機能を利用しない場合、
正規表現の全ての能力は必要とされていなでしょう。文字列は固定文字列に対す
る操作を実行するメソッドを持っていて、大きな汎用化された正規表現エンジン
ではなく、目的のために最適化された単一の小さな C loop で実装されているた
め、大抵の場合高速です.

一つの例としては、単一の固定文字列を別の固定文字列に置き換える作業がある
でしょう; 例えば ‘word’ を ‘deed’ で置換したい場合です。 *note re.sub():
5a3. はこの目的で使う関数のように思えますが、 *note replace(): 4b8. メソ
ッドを利用することを考えた方がいいでしょう。 ‘replace()’ は単語内の
‘word’ も置換し、 ‘swordfish’ を ‘sdeedfish’ に変えますが、安直な正規表
現 ‘word’ も同様に動作することに注意して下さい。(単語の一部に対する置換
の実行を避けるには、パターンを ‘\bword\b’ として、 ‘word’ の両側に単語の
境界が要求されるようにします。これは ‘replace()’ の能力を越えた作業です
。)

別のよくある作業は、文字列の中に出現する文字を全て削除することと、別の文
字で置換することです。この作業を ‘re.sub('\n', ' ', S)’ のようにして行う
かもしれませんが、 *note translate(): 264c. は削除と置換の両方の作業をこ
なし、正規表現操作よりも高速に行うことができます。

要は、 *note re: be. モジュールに向う前に問題が高速で単純な文字列メソッ
ドで解決できるか考えましょうということです。


File: python.info,  Node: match 対 search,  Next: 貪欲 greedy 対非貪欲 non-greedy,  Prev: 文字列メソッドを利用する,  Up: よくある問題

9.10.6.2 match() 対 search()
............................

*note match(): 1445. 関数は文字列の先頭に正規表現がマッチするかどうか調
べるだけですが、その一方 *note search(): 1444. はマッチするために文字列
の先の方まで走査します。 この違いを覚えておくことは重要なことです。
‘match()’ は開始位置0でマッチが成功したときのみ報告する; もし開始位置0で
マッチしなければ、 ‘match()’ はそれを報告 'しない' 、ということを覚えて
おいてください。

     >>> print(re.match('super', 'superstition').span())
     (0, 5)
     >>> print(re.match('super', 'insuperable'))
     None

一方 *note search(): 1444. は文字列の先の方まで走査し、最初にみつけたマ
ッチを報告します。:

     >>> print(re.search('super', 'superstition').span())
     (0, 5)
     >>> print(re.search('super', 'insuperable').span())
     (2, 7)

しばしば、 *note re.match(): 1445. を使い、 ‘.*’ を正規表現の最初に付け
加える誘惑にからされることがあるでしょう。この誘惑に打ち克って、代わりに
*note re.search(): 1444. を利用すべきです。正規表現コンパイラはマッチを
探す処理の高速化のためにいくつかの解析を行います。そのような解析のうちの
ひとつはマッチの最初の文字が何であるか評価することです; 例えば、 ‘Crow’
で始まるパターンは ‘'C'’ から始まらなければいけません。解析によってエン
ジンは速やかに開始文字を探して走査します、 ‘'C'’ が発見された場合にはじ
めて完全なマッチを試みます。

‘.*’ を追加することはこの最適化を無効にします、文字列の終端までの走査が
必要となり、走査後には残りの正規表現とのマッチ部分を見つけるために引き返
すことになります。代わりに *note re.search(): 1444. を利用して下さい。


File: python.info,  Node: 貪欲 greedy 対非貪欲 non-greedy,  Next: re VERBOSE の利用,  Prev: match 対 search,  Up: よくある問題

9.10.6.3 貪欲 (greedy) 対非貪欲 (non-greedy)
............................................

正規表現を繰り返す場合、たとえば ‘a*’ のように、できるだけパターンの多く
にマッチするように動作することになります。この動作は、例えば角括弧で囲ま
れた HTML タグのような左右対称のデリミタの対にマッチしようという場合に問
題となります。単一の HTML タグにマッチする素朴な正規表現はうまく動作しま
せん、なぜならば ‘.*’ は貪欲に動作するからです。

     >>> s = '<html><head><title>Title</title>'
     >>> len(s)
     32
     >>> print(re.match('<.*>', s).span())
     (0, 32)
     >>> print(re.match('<.*>', s).group())
     <html><head><title>Title</title>

正規表現は ‘'<html>'’ 内の ‘'<'’ にマッチし、 ‘.*’ は残りの文字列の全て
にマッチします。 しかし、正規表現には依然として残っている部分があって、
‘>’ は文字列の終端にマッチしないので、正規表現エンジンは一文字ずつ ‘>’ と
マッチするまで引き返すことになります。 最終的にマッチする領域は
‘'<html>'’ の ‘'<'’ から ‘'</title>'’ の ‘'>'’ まで広がりますが、これは
望んだ結果ではありません。

この場合の解決策は、非貪欲 (non-greedy) な数量子 ‘*?’, ‘+?’, ‘??’, ある
いは ‘{m,n}?’ を使うことです。これらはできるだけ '少ない' テキストにマッ
チしようとします。上記の例では、 ‘'>'’ は ‘'<'’ がマッチした直後の文字か
らマッチするかどうかを調べられ、失敗すると同時にエンジンは文字を先に進め
ながら、各ステップで ‘'>'’ のマッチを試みます。この動作は正しい結果を生
成します:

     >>> print(re.match('<.*?>', s).group())
     <html>

(HTML や XML を正規表現でパースすることは苦痛を伴うものであることは記憶
に留めておいて下さい。素早く、汚いパターンは大抵の場合うまく動作しますが
、HTML と XML は正規表現が破綻する特別な例です; 全ての可能な場合にうまく
動作する正規表現を書き上げたときには、パターンは '非常に' 複雑なものにな
ります。そのような作業をする場合には HTML や XML パーサを利用しましょう
。)


File: python.info,  Node: re VERBOSE の利用,  Prev: 貪欲 greedy 対非貪欲 non-greedy,  Up: よくある問題

9.10.6.4 re.VERBOSE の利用
..........................

ここまでで、正規表現がとても簡潔な表記であることに気づいたでしょう、また
、正規表現は読みやすいものでもないということにも気づいたことでしょう。そ
こそこに入り組んだ正規表現ははバックスラッシュ、括弧、特殊文字が長く続い
て、読みにくく、理解しづらいものになります。

そのような正規表現に対しては、正規表現をコンパイルする時に *note
re.VERBOSE: 2772. フラグを指定することが助けになります。なぜなら、より明
確な書式で正規表現を書けるからです。

‘re.VERBOSE’ の効果はいくつかあります。正規表現内の文字クラス内に '無い'
空白は無視されます。これは、 ‘dog | cat’ のような表現が少々可読性の落ち
る ‘dog|cat’ と等価となるということです、しかし、 ‘[a b]’ は依然として
‘'a'’, ‘'b'’, または空白にマッチします。加えて、正規表現にコメントを入れ
ることもできるようになります; ‘#’ 文字から次の改行までがコメントの範囲で
す。三重クォートを利用することで、正規表現をきちんとフォーマットすること
ができます:

     pat = re.compile(r"""
      \s*                 # Skip leading whitespace
      (?P<header>[^:]+)   # Header name
      \s* :               # Whitespace, and a colon
      (?P<value>.*?)      # The header's value -- *? used to
                          # lose the following trailing whitespace
      \s*$                # Trailing whitespace to end-of-line
     """, re.VERBOSE)

これは下よりはるかに読みやすいです:

     pat = re.compile(r"\s*(?P<header>[^:]+)\s*:(?P<value>.*?)\s*$")


File: python.info,  Node: フィードバック,  Prev: よくある問題,  Up: 正規表現 HOWTO

9.10.7 フィードバック
---------------------

正規表現は複雑な話題です。このドキュメントは助けになったでしょうか？わか
りにくかったところや、あなたが遭遇した問題が扱われていない等なかったでし
ょうか？もしそんな問題があれば、著者に改善の提案を送って下さい。

O'Reilly から出版されている Jeffrey Friedl の Mastering Regular
Expressions は正規表現に関するほぼ完璧な書籍です (訳注　日本語訳「詳説　
正規表現」が出版されています) 。不幸なことに、この本は Perl と Java の正
規表現を集中して扱っていて、 Python の正規表現については全く扱っていませ
ん、そのため Python プログラミングのためのレファレンスとして使うことはで
きません。 (第一版はいまや削除された Python の ‘regex’ モジュールについ
て扱っていましたが、これはあまり役に立たないでしょう。) 図書館で調べるの
を検討してみましょう。


File: python.info,  Node: ソケットプログラミング HOWTO,  Next: ソートのテクニック,  Prev: 正規表現 HOWTO,  Up: Python HOWTO

9.11 ソケットプログラミング HOWTO
=================================


著者: Gordon McMillan

概要
....

ソケットはそこかしこで使われているが、最大級に誤解されている技術でもある
。この文書はソケットの全体像を俯瞰しており、チュートリアルとしてはあまり
役に立たない。実際に動くモノを完成させるには、他にもやらなければいけない
ことがあるからだ。この文書はソケットの微妙なところ (たくさんある) までは
カバーしていないが、恥ずかしくない使い方ができるようになる程度の情報は得
られるはずだ。

* Menu:

* ソケット::
* ソケットの作成: ソケットの作成<3>.
* ソケットの利用::
* 切断::
* ノンブロッキングソケット::


File: python.info,  Node: ソケット,  Next: ソケットの作成<3>,  Up: ソケットプログラミング HOWTO

9.11.1 ソケット
---------------

INET (すなわち IPv4) ソケットのことしか語らないつもりだが、利用率でいう
とソケットの 99% 以上はこれだ。さらに中でも STREAM (すなわち TCP) ソケッ
トに話題を絞ろうと思う - 自分が何をしているのか分かっているのでない限り
(分かってるならこの HOWTO なんて要らないだろ!)、STREAM ソケットが一番分
かりやすく、一番性能が出るのだ。そうやって謎に包まれたソケットの正体を明
らかにしてゆくと共に、ブロッキングおよびノンブロッキングなソケットの扱い
に関するいくつかのヒントを提示しよう。だが、まずはブロッキングソケットか
ら始めることにする。ノンブロッキングを扱うより先に、ブロッキングの仕組み
を知っておかなくてはならないのだ。

話を理解しにくくしている要因として、「ソケット」という言葉が文脈によって
微妙に違うものを指すことが挙げられる。そこでまず、「クライアント」ソケッ
ト - 対話の両端 - と「サーバ」ソケット - 電話交換手みたいなもの - の区別
を付けておこう。クライアントアプリケーション (たとえばブラウザ) は「クラ
イアント」ソケットだけを使うが、話し相手のウェブサーバは「サーバ」ソケッ
トと「クライアント」ソケットの両方を使う。

* Menu:

* 歴史::


File: python.info,  Node: 歴史,  Up: ソケット

9.11.1.1 歴史
.............

各種 IPC (Inter Process Communication (プロセス間通信) の中でも、ソケッ
トは群を抜いて人気がある。どのプラットフォームにも、ソケットより速い IPC
はあるだろう。だが、プラットフォームをまたぐ通信はソケットの独擅場だ。

ソケットは BSD Unix の一部としてバークレイで発明され、インターネットの普
及と共に野火のごとく広まった。それももっともなことで、ソケットと INET の
コンビによって世界中どんなマシンとも、信じられないほど簡単 (少なくとも他
のスキームと比べて) に通信できるようになったのだ。


File: python.info,  Node: ソケットの作成<3>,  Next: ソケットの利用,  Prev: ソケット,  Up: ソケットプログラミング HOWTO

9.11.2 ソケットの作成
---------------------

あなたがリンクをクリックしてこのページに来たとき、ブラウザは大雑把に言っ
て次のようなことをしたのである:

     # create an INET, STREAMing socket
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     # now connect to the web server on port 80 - the normal http port
     s.connect(("www.python.org", 80))

この ‘connect’ が完了すると、ソケット ‘s’ を使ってこのページ文章への要求
を送ることができるようになる。その同じソケットが返答を読み、そして破壊さ
れる。そう、破壊される。クライアントソケットは通常、一回 (か少数の) やり
取りで使い捨てになるのだ。

ウェブサーバで起こる事柄はもう少し複雑だ。まず「サーバソケット」を作る:

     # create an INET, STREAMing socket
     serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     # bind the socket to a public host, and a well-known port
     serversocket.bind((socket.gethostname(), 80))
     # become a server socket
     serversocket.listen(5)

ここで注意すべき点がいくつかある: 今回はソケットが外界に見えるよう、
‘socket.gethostname()’ を使った。 ‘s.bind(('localhost', 80))’ や
‘s.bind(('127.0.0.1', 80))’ でも「サーバ」ソケットにはなるが、それだと同
じマシン内にしか見えないものになってしまう。 ‘s.bind(('', 80))’ はこのマ
シンが持っている全てのアドレスで接続可能になるようにという指定になる。

ふたつめ: 小さな番号のポートは大抵、「ウェルノウン (有名)」なサービス
(HTTP, SNMP 等々) のために取ってある。お遊びで使うのなら適当に大きな数
(4桁) を使おう。

最後に: ‘listen’ の引数はソケットライブラリに、接続要求を 5 個 (通常の最
大値) まで順番待ちさせるように命じている。これ以降の外部接続は拒否するの
だが、コードが適切に書かれていれば、それで十分すぎるほどだ。

よし、「サーバーソケット」ができて、80 番ポートで耳を澄ましているところ
まで来た。では、ウェブサーバのメインループに入ろう:

     while True:
         # accept connections from outside
         (clientsocket, address) = serversocket.accept()
         # now do something with the clientsocket
         # in this case, we'll pretend this is a threaded server
         ct = make_client_thread(clientsocket)
         ct.start()

このループには実際のところ、3 通りの一般的な動作方法がある -
‘clientsocket’ を扱うようにスレッドを割り当てたり、‘clientsocket’ を扱う
新しいプロセスを作ったり、あるいはノンブロッキングソケットを使うようにア
プリを作り直して ‘select’ で「サーバ」ソケットとアクティブな
‘clientsocket’ の間を多重化したりするのだ。最後のについてはまた後にしよ
う。ここで理解しておくべき要点はこれだ: 以上が「サーバ」ソケットの仕事の
'すべて' である。データは一切送信しないし、受信しない。「クライアント」
ソケットを生み出すだけ。我々のバインドされているホストとポートに
‘connect()’ してくる '他の' 「クライアント」ソケットに応える形で
‘clientsocket’ を作り、作るや否や、さらなる接続を聞きに戻っていくのだ。
このふたつの「クライアント」は、あとは勝手に喋っていればいい - 使うポー
トは動的に割り当てられ、会話が終わればリサイクルに廻される。

* Menu:

* IPC::


File: python.info,  Node: IPC,  Up: ソケットの作成<3>

9.11.2.1 IPC
............

1つのマシン上の2プロセス間で高速なIPCを行いたい場合は、pipe か共有メモリ
を検討するべきです。AF_INET ソケットを使用すると決めた場合、「サーバー」
ソケットは ‘'localhost'’ にバインドしましょう。ほとんどのプラットフォー
ムで、いくつかのネットワークレイヤーをショートカットすることでかなり高速
になります。

参考
....

*note multiprocessing: 98. はクロスプラットフォームなIPCの高級なAPIを提
供しています。


File: python.info,  Node: ソケットの利用,  Next: 切断,  Prev: ソケットの作成<3>,  Up: ソケットプログラミング HOWTO

9.11.3 ソケットの利用
---------------------

はじめに憶えておくべきなのは、ウェブブラウザの「クライアント」ソケットと
ウェブサーバの「クライアント」ソケットがまったく同じ種族だということだ。
つまり、これは「ピア・トゥ・ピア」(1 対 1) の会話である。別の言い方をす
ると、 '設計者として自分で会話のエチケット規則を決めなくてはいけない' と
いうことでもある。通常は、 ‘connect’ してくるソケットが要求あるいは宣言
をして会話を始める。だが、それはそう設計しただけのことだ - ソケットの規
則ではない。

さて、コミュニケーションに使う動詞は二組ある。 ‘send’ と ‘recv’ を使うこ
ともできるし、クライアントソケットをファイルっぽい種族に変形して ‘read’
と ‘write’ を使っても良い。後者は Java のソケットの表現方法だ。ここで詳
しく語るつもりはないが、その場合はソケットも ‘flush’ しなければいけない
、とだけ言っておく。これはバッファリングした「ファイル」なので、何かを
‘write’ してすぐに返答を ‘read’ するというのはよくある間違いだ。間に
‘flush’ を入れないと、要求がまだ出力バッファにあって永遠に返事が来ない、
という可能性がある。

さあ、ソケットの主要な難関に進もう - ‘send’ と ‘recv’ はネットワークバッ
ファに働きかけるものだ。だから、手渡したもの (や返してもらいたいもの) を
1 バイトも残さず実際に処理してくれているとは限らない。一般的に言って、
‘send’ はバッファが埋まるまで、‘recv’ はバッファが空になるまで処理をして
、そのバイト数を返す。メッセージが完全に処理されるまで繰り返し呼び出すの
は '自分の' 責任なのだ。

‘recv’ が 0 バイトを返したときは、向こう側が接続を閉じてしまった (または
閉じようとしている途中) という意味だ。もうこの接続でデータを受け取ること
はない。永遠にだ。ただ、データ送信は成功するかもしれない; これについては
あとで語ることにしよう。

HTTP のようなプロトコルでは、ひとつのソケットを1回の転送にしか使わない。
クライアントは要求を送り、返答を受ける。以上だ。これでソケットは破棄され
る。だからこの場合、クライアントは受信 0 バイトの時点で返答の末尾を検出
することができる。

だが、以降の転送にもそのソケットを使い回すつもりなら、ソケットに EOT
(End of Transfer) など '存在しない' ことを認識する必要がある。もう一度言
おう: ソケットの ‘send’ や ‘recv’ が 0 バイト処理で返ってきたなら、その
接続は終わっている。終わって 'いない' なら、いつまで ‘recv’ を待てばいい
かは分からない。ソケットは「もう読むものが (今のところ) ないぜ」などと
'言わない' のだから。このことを少し考えれば、ソケットの真実を悟ることに
なるだろう: 'メッセージは必ず固定長か' (うげぇ) '区切り文字を使うか' (や
れやれ) '長さ標識を付けておくか' (かなりマシ) '接続を閉じて終わらせるか
のいずれかでなければいけない' のだ。選ぶ権利と責任はまったくもって自分に
ある (が、正しさの程度に違いはある)。

毎回接続を終わらせるのはイヤだとして、最も単純な解決策は固定長メッセージ
だろう:

     class MySocket:
         """demonstration class only
           - coded for clarity, not efficiency
         """

         def __init__(self, sock=None):
             if sock is None:
                 self.sock = socket.socket(
                                 socket.AF_INET, socket.SOCK_STREAM)
             else:
                 self.sock = sock

         def connect(self, host, port):
             self.sock.connect((host, port))

         def mysend(self, msg):
             totalsent = 0
             while totalsent < MSGLEN:
                 sent = self.sock.send(msg[totalsent:])
                 if sent == 0:
                     raise RuntimeError("socket connection broken")
                 totalsent = totalsent + sent

         def myreceive(self):
             chunks = []
             bytes_recd = 0
             while bytes_recd < MSGLEN:
                 chunk = self.sock.recv(min(MSGLEN - bytes_recd, 2048))
                 if chunk == b'':
                     raise RuntimeError("socket connection broken")
                 chunks.append(chunk)
                 bytes_recd = bytes_recd + len(chunk)
             return b''.join(chunks)

この送信コードは、ほぼあらゆるメッセージ通信スキームで使える - 文字列を
送るとき、Python なら長さを ‘len()’ で見極めることができる (中に ‘\0’ が
埋め込まれていても大丈夫)。難しくしているのは、おもに受信コードである。
(なお、C でも事態はあまり悪くならないが、メッセージに ‘\0’ が埋め込まれ
ていると ‘strlen’ が使えないのは面倒だ。)

最も簡単な改良法は、メッセージの最初の一文字をタイプ標識にして、そのタイ
プで長さを決定するというものだ。この場合ふたつの ‘recv’ があることになる
- 一番目でその一文字 (だけじゃなくても可) を取って長さを調べ、二番目でル
ープして残りを取るのだ。あるいはもし区切り方式の道を行くのであれば、任意
のサイズ (4096 か 8192 がネットワークバッファには最適なことが多い) で受
信して区切り文字を走査していくことになる。

心に留めておくべき面倒な点がひとつ: 複数メッセージが次々に (何らかの返事
を待たずに) 返ってくることのある会話プロトコルなら、そして任意のサイズを
‘recv’ に渡しているなら、次のメッセージの冒頭部分まで読んでしまうことが
あるかもしれない。そのときは、必要になるまで脇によけて、大切に保管してお
く必要がある。

メッセージ冒頭に長さを (たとえば 5 桁の数字で) 付けるのは、それよりもさ
らに複雑になる。というのも、(信じられないかもしれないが) 一回の ‘recv’ で
5 文字を全部受け取ることができるとは限らないからだ。お遊びでやっている間
はごまかせても、高負荷ネットワークのもとでは、‘recv’ ループをふたつ使わ
ないコードは、あっと言う間にダメになってしまう - 一番目は長さを見定める
用で、二番目はデータ部分を受け取る用だ。うーむ、いやらしい。さらにこのと
き、‘send’ も一発で全部を出し切れるとは限らないことに気付くだろう。なお
、今こうやって読んでいても、いつか誰もが痛い目を見るのである!

紙面の都合および教育的配慮 (と著者の地位確保) のため、こうした改良は練習
問題として残しておく。さあ片付けてしまおう。

* Menu:

* バイナリデータ::


File: python.info,  Node: バイナリデータ,  Up: ソケットの利用

9.11.3.1 バイナリデータ
.......................

It is perfectly possible to send binary data over a socket.  The major
problem is that not all machines use the same formats for binary data.
For example, network byte order(1) is big-endian, with the most
significant byte first, so a 16 bit integer with the value ‘1’ would be
the two hex bytes ‘00 01’.  However, most common processors (x86/AMD64,
ARM, RISC-V), are little-endian, with the least significant byte first -
that same ‘1’ would be ‘01 00’.

Socket libraries have calls for converting 16 and 32 bit integers -
‘ntohl, htonl, ntohs, htons’ where "n" means 'network' and "h" means
'host', "s" means 'short' and "l" means 'long'.  Where network order is
host order, these do nothing, but where the machine is byte-reversed,
these swap the bytes around appropriately.

In these days of 64-bit machines, the ASCII representation of binary
data is frequently smaller than the binary representation.  That's
because a surprising amount of the time, most integers have the value 0,
or maybe 1.  The string ‘"0"’ would be two bytes, while a full 64-bit
integer would be 8.  Of course, this doesn't fit well with fixed-length
messages.  Decisions, decisions.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Endianness#Networking


File: python.info,  Node: 切断,  Next: ノンブロッキングソケット,  Prev: ソケットの利用,  Up: ソケットプログラミング HOWTO

9.11.4 切断
-----------

厳密には、ソケットを ‘close’ する前には ‘shutdown’ することになっている
。 ‘shutdown’ は相手ソケットに対する報告であり、渡す引数によって「これ以
上こっちからは送らないけど、まだ聞いてるぜ」という意味になったり、「もう
聞かない。せいせいした!」だったりする。しかしほとんどのソケットライブラ
リは、このエチケットを怠るプログラマに慣れてしまって、通常 ‘close’ だけ
で ‘shutdown(); close()’ と同じことになる。だから大抵はわざわざ
‘shutdown’ しなくてもいい。

‘shutdown’ の効果的な使い方のひとつは、HTTP 風のやりとりだ。クライアント
は要求を出してすぐに ‘shutdown(1)’ する。これでサーバに、「クライアント
は送信完了ですが、まだ受信可能です」と伝わる。サーバは 0 バイト受信で
"EOF" を検出することができる。要求を残さず受け取ったことにして良いのだ。
対してサーバは返答を送る。その ‘send’ が成功したなら、クライアントは実際
にまだ受信していたことになる。

Python はこの自動 shutdown をもう一歩進めて、ソケットが GC されるときに
必要なら自動で ‘close’ してくれると言っている。しかしこれに頼るクセをつ
けてはいけない。もしソケットが ‘close’ せずに姿を消せば、相手ソケットは
こちらが遅いだけだと思ってハングしてしまうかもしれない。 'お願いだから'
終わったらちゃんと ‘close’ してくれ。

* Menu:

* ソケットが死ぬと::


File: python.info,  Node: ソケットが死ぬと,  Up: 切断

9.11.4.1 ソケットが死ぬと
.........................

ブロッキングソケットを使っていて一番いやなのは多分、相手側が意地悪く
(‘close’ せずに) ダウンするときに起こる事柄だ。自分側のソケットは高確率
でハングするだろう。TCP は信頼性の高いプロトコルなので、ずっとずっと待ち
続けて、なかなか見捨てないのだ。スレッドを使っているのであれば、そのスレ
ッド全体が根本から死んだ状態になる。こうなると、もう手の施しようがない。
まあ、ブロッキング読み出しの間ロックし続けるといった馬鹿げたことをしてい
ない限り、リソースの点ではたいして消費にならない。だから 'ぜったいに' そ
のスレッドを殺そうとしてはいけない - プロセスよりスレッドが効率的である
理由のひとつは、自動リソース回収にまつわるオーバヘッドを避けられるという
点にあるのだ。つまり別の言い方をすると、どうにかしてそのスレッドを殺した
なら、プロセス全体がぐちゃぐちゃになってしまうだろうということだ。


File: python.info,  Node: ノンブロッキングソケット,  Prev: 切断,  Up: ソケットプログラミング HOWTO

9.11.5 ノンブロッキングソケット
-------------------------------

ここまで理解してきたなら、もうソケットの仕組みについて必要なことはほとん
ど知っていることになる。これからも同じコールを、ほぼ同じように使っていく
だけ、それだけだ。これをちゃんとやっていれば、そのアプリはだいたい完璧で
あろう。

Python の場合、ノンブロッキングにするには ‘socket.setblocking(False)’ を
使う。 C ならもっと複雑だ (一例を挙げると、BSD 方式の ‘O_NONBLOCK’ およ
びほぼ違いのない POSIX 方式 ‘O_NDELAY’ のどちらを選ぶか決めなくてはなら
なくて、後者は ‘TCP_NODELAY’ とは全然別物だったりする) が、考え方はまっ
たく一緒だ。これは、ソケットを作成した後、使用する前に行う。(実際、常識
破りなら、切り替えることができます。)

構造上の大きな違いは、 ‘send’, ‘recv’, ‘connect’, ‘accept’ が何もしない
で戻ってくるかもしれないという点である。選択肢は (当然ながら) いくつかあ
る。返り値とエラーコードをチェックするという方法もある。が、発狂すること
請け合いだ。信じないなら、いつかやってみるといい。アプリは肥大化し、バグ
が増え、CPU を喰い尽くすだろう。だからそんな愚かな解法は飛ばして、正解に
進もう。

‘select’ を使え。

C において ‘select’ でコードを書くのはかなり面倒だが、Python なら造作も
ない。しかし Python で ‘select’ を理解しておけば C でもほとんど問題なく
書ける、という程度には似ている:

     ready_to_read, ready_to_write, in_error = \
                    select.select(
                       potential_readers,
                       potential_writers,
                       potential_errs,
                       timeout)

‘select’ に三つのリストを渡しているが、一番目にはあとで読みたくなるかも
しれないソケットすべて、二番目には書き込みたくなるかもしれないソケットす
べて、最後に (通常は空のままだが) エラーをチェックしたいソケットが入って
いる。ひとつのソケットが複数にまたがってリストされても構わないことを憶え
ておくと良い。なお、 ‘select’ コールはブロックするが、時間制限を与えるこ
とができる。これは、やっておいて損はない - 特に理由がなければ、かなり長
い (たとえば 1 分とかの) 時間制限を付けておくことだ。

戻り値として、三つのリストが手に入る。それぞれには、実際に読めるソケット
、書けるソケット、エラー中のソケットが入っていて、渡したリストの部分集合
(空集合かもしれない) になっている。

出力のうち、readable リストにあるソケットについては、 ‘recv’ がとりあえ
ず '何か' を返すであろう、ということは史上最高度に確信できる。 writable
リストも考え方は同じで、 '何か' は送れる。送りたいもの全体は無理かもしれ
ないが、 '何も' ないよりはマシだろう。 (実のところ、ふつうに健康なソケッ
トなら writable で返ってくることができる - それは外向きネットワークバッ
ファに空きがあるというだけの意味しかないのだから)

「サーバ」ソケットは potential_readers リストに入れておこう。それが
readable リストに入って出てきたら、 ‘accept’ は (ほぼ) 確実に成功するは
ずだ。どこかへ ‘connect’ するために作った新しいソケットは
potential_writers リストに入れる。それが writable リストに現れたら、接続
が成功している可能性は高いと言える。

じつは ‘select’ はブロッキングソケットにも便利に使える。それはブロックす
るかどうかを見極める方法のひとつである - バッファに何かがあれば readable
として返ってくるのだ。しかしこれも、相手の用事がもう済んでいるのか、それ
とも単に他のことで忙しいだけなのかを見極める役には立たない。

'非互換警報': Unix ではソケットにもファイルにも ‘select’ が使える。これ
を Windows でやろうとしてはいけない。Windows で ‘select’ はソケットにし
か使えない。また C の場合、高度なソケットオプションの多くは、やり方が
Windows では違っている。実際、Windows なら著者は通常、ソケットにスレッド
を使っている (これは実に、実にうまくいく)。


File: python.info,  Node: ソートのテクニック,  Next: Unicode HOWTO,  Prev: ソケットプログラミング HOWTO,  Up: Python HOWTO

9.12 ソートのテクニック
=======================


著者: Andrew Dalke and Raymond Hettinger

Python のリストにはリストをインプレースに変更する、組み込みメソッド
*note list.sort(): dc8. があります。他にもイテラブルからソートしたリスト
を作成する組み込み関数 *note sorted(): dc7. があります。

このドキュメントでは Python を使った様々なソートのテクニックを探索します
。

* Menu:

* ソートの基本::
* Key 関数::
* operator モジュールの関数や partial 関数による評価::
* 昇順と降順::
* ソートの安定性と複合的なソート::
* デコレート - ソート - アンデコレート (DSU): デコレート - ソート - アンデコレート DSU.
* 比較関数::
* Strategies For Unorderable Types and Values::
* 残りのはしばし: 残りのはしばし<2>.
* 部分的なソート::


File: python.info,  Node: ソートの基本,  Next: Key 関数,  Up: ソートのテクニック

9.12.1 ソートの基本
-------------------

単純な昇順のソートはとても簡単です: *note sorted(): dc7. 関数を呼ぶだけ
です。そうすれば、新たにソートされたリストが返されます:

     >>> sorted([5, 2, 3, 1, 4])
     [1, 2, 3, 4, 5]

*note list.sort(): dc8. メソッドを呼びだしても同じことができます。この方
法はリストをインプレースに変更します (そして sorted との混乱を避けるため
‘None’ を返します)。多くの場合、こちらの方法は *note sorted(): dc7. と比
べると不便です - ただし、元々のリストが不要な場合には、わずかですがより
効率的です。

     >>> a = [5, 2, 3, 1, 4]
     >>> a.sort()
     >>> a
     [1, 2, 3, 4, 5]

違いは他にもあります、 *note list.sort(): dc8. メソッドはリストにのみ定
義されています。一方 *note sorted(): dc7. 関数は任意のイテラブルを受け付
けます。

     >>> sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'})
     [1, 2, 3, 4, 5]


File: python.info,  Node: Key 関数,  Next: operator モジュールの関数や partial 関数による評価,  Prev: ソートの基本,  Up: ソートのテクニック

9.12.2 Key 関数
---------------

The *note list.sort(): dc8. method and the functions *note sorted():
dc7, *note min(): 110b, *note max(): 110c, *note heapq.nsmallest():
29a6, and *note heapq.nlargest(): 29a5. have a 'key' parameter to
specify a function (or other callable) to be called on each list element
prior to making comparisons.

For example, here's a case-insensitive string comparison using *note
str.casefold(): fd6.:

     >>> sorted("This is a test string from Andrew".split(), key=str.casefold)
     ['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']

'key' パラメータの値は関数または呼び出し可能オブジェクトであって、単一の
引数をとり、ソートに利用されるキー値を返すものでなければいけません。この
制約によりソートを高速に行えます、キー関数は各入力レコードに対してきっち
り一回だけ呼び出されるからです。

よくある利用パターンはいくつかの要素から成る対象をインデクスのどれかをキ
ーとしてソートすることです。例えば:

     >>> student_tuples = [
     ...     ('john', 'A', 15),
     ...     ('jane', 'B', 12),
     ...     ('dave', 'B', 10),
     ... ]
     >>> sorted(student_tuples, key=lambda student: student[2])   # sort by age
     [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]

同じテクニックは名前づけされた属性 (named attributes) を使うことでオブジ
ェクトに対しても動作します。例えば:

     >>> class Student:
     ...     def __init__(self, name, grade, age):
     ...         self.name = name
     ...         self.grade = grade
     ...         self.age = age
     ...     def __repr__(self):
     ...         return repr((self.name, self.grade, self.age))

     >>> student_objects = [
     ...     Student('john', 'A', 15),
     ...     Student('jane', 'B', 12),
     ...     Student('dave', 'B', 10),
     ... ]
     >>> sorted(student_objects, key=lambda student: student.age)   # sort by age
     [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]

名前づけされた属性を持つオブジェクトは上で示したとおり通常のクラスから作
れますし、*note dataclass: 4e1. や *note named tuple: 85e. のインスタン
スでもよいです。


File: python.info,  Node: operator モジュールの関数や partial 関数による評価,  Next: 昇順と降順,  Prev: Key 関数,  Up: ソートのテクニック

9.12.3 operator モジュールの関数や partial 関数による評価
---------------------------------------------------------

上で示した *note key function: 1006. パターンは非常に一般的なので、
Python はアクセサ関数を簡単に速く作れる便利な関数を提供しています。*note
operator: a3. モジュールに *note itemgetter(): c57.、*note attrgetter():
1033.、および *note methodcaller(): 1034. 関数があります。

これらの関数を利用すると、上の例はもっと簡単で高速になります:

     >>> from operator import itemgetter, attrgetter

     >>> sorted(student_tuples, key=itemgetter(2))
     [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]

     >>> sorted(student_objects, key=attrgetter('age'))
     [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]

operator モジュールの関数は複数の段階でのソートを可能にします。例えば、
'grade' でソートしてさらに 'age' でソートする場合:

     >>> sorted(student_tuples, key=itemgetter(1,2))
     [('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]

     >>> sorted(student_objects, key=attrgetter('grade', 'age'))
     [('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]

*note functools: 63. モジュールには他にもキー関数を作るための便利なツー
ルがあります。*note partial(): 217. 関数は複数引数の関数の アリティ(1) を
減らし、キー関数に適したものにできます。

     >>> from functools import partial
     >>> from unicodedata import normalize

     >>> names = 'Zoë Åbjørn Núñez Élana Zeke Abe Nubia Eloise'.split()

     >>> sorted(names, key=partial(normalize, 'NFD'))
     ['Abe', 'Åbjørn', 'Eloise', 'Élana', 'Nubia', 'Núñez', 'Zeke', 'Zoë']

     >>> sorted(names, key=partial(normalize, 'NFC'))
     ['Abe', 'Eloise', 'Nubia', 'Núñez', 'Zeke', 'Zoë', 'Åbjørn', 'Élana']

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Arity


File: python.info,  Node: 昇順と降順,  Next: ソートの安定性と複合的なソート,  Prev: operator モジュールの関数や partial 関数による評価,  Up: ソートのテクニック

9.12.4 昇順と降順
-----------------

*note list.sort(): dc8. と *note sorted(): dc7. の両方とも 'reverse' パ
ラメータを 真偽値として受け付けます。このパラメータは降順ソートを行うか
どうかの フラグとして利用されます。 例えば、学生のデータを 'age' の逆順
で得たい場合:

     >>> sorted(student_tuples, key=itemgetter(2), reverse=True)
     [('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]

     >>> sorted(student_objects, key=attrgetter('age'), reverse=True)
     [('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]


File: python.info,  Node: ソートの安定性と複合的なソート,  Next: デコレート - ソート - アンデコレート DSU,  Prev: 昇順と降順,  Up: ソートのテクニック

9.12.5 ソートの安定性と複合的なソート
-------------------------------------

ソートは、 安定 (stable)(1) であることが保証されています。これはレコード
の中に同じキーがある場合、元々の順序が維持されるということを意味します。

     >>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]
     >>> sorted(data, key=itemgetter(0))
     [('blue', 1), ('blue', 2), ('red', 1), ('red', 2)]

二つの 'blue' のレコードが元々の順序を維持して、 ‘('blue', 1)’ が
‘('blue', 2)’ の前にあることに注意してください。

この素晴しい性質によって複数のソートを段階的に組み合わせることができます
。例えば、学生データを 'grade' の降順にソートし、さらに 'age' の昇順にソ
ートしたい場合には、まず 'age' でソートし、次に 'grade' でもう一度ソート
します:

     >>> s = sorted(student_objects, key=attrgetter('age'))     # sort on secondary key
     >>> sorted(s, key=attrgetter('grade'), reverse=True)       # now sort on primary key, descending
     [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]

この処理は、リストおよびフィールド名とソート順序のタプルを複数受け取れる
ラッパー関数へ抽象化できます。

     >>> def multisort(xs, specs):
     ...     for key, reverse in reversed(specs):
     ...         xs.sort(key=attrgetter(key), reverse=reverse)
     ...     return xs

     >>> multisort(list(student_objects), (('grade', True), ('age', False)))
     [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]

Python では Timsort(2) アルゴリズムが利用されていて、効率良く複数のソー
トを行うことができます、これは現在のデータセット中のあらゆる順序をそのま
ま利用できるからです。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Sorting_algorithm#Stability

   (2) https://en.wikipedia.org/wiki/Timsort


File: python.info,  Node: デコレート - ソート - アンデコレート DSU,  Next: 比較関数,  Prev: ソートの安定性と複合的なソート,  Up: ソートのテクニック

9.12.6 デコレート - ソート - アンデコレート (DSU)
-------------------------------------------------

このイディオムは以下の3つのステップにちなんでデコレート-ソート-アンデコ
レート (Decorate-Sort-Undecorate) と呼ばれています:

   * まず、元となるリストをソートしたい順序を制御する新しい値でデコレー
     トします。

   * 次に、デコレートしたリストをソートします。

   * 最後に、デコレートを取り除き、新しい順序で元々の値のみを持つリスト
     を作ります。

例えば、DSU アプローチを利用して学生データを 'grade' でソートする場合:

     >>> decorated = [(student.grade, i, student) for i, student in enumerate(student_objects)]
     >>> decorated.sort()
     >>> [student for grade, i, student in decorated]               # undecorate
     [('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]

このイディオムはタブルが辞書編集的に比較されるため正しく動作します; 最初
の要素が比較され、同じ場合には第二の要素が比較され、以下も同様に動きます
。

デコレートしたリストのインデクス 'i' は全ての場合で含まれる必要はありま
せんが、そうすることで二つの利点があります:

   * ソートが安定になります - もし二つの要素が同じキーを持つ場合、それら
     の順序がソートされたリストでも維持されます。

   * 元々の要素が比較可能な要素を持つとは限りません、なぜならデコレート
     されたタブルの順序は多くの場合、最初の二つの要素で決定されるからで
     す。例として元のリストは直接比較できない複素数を含むことができます
     。

このイディオムの別名に Schwartzian transform(1) があります。これは Perl
プログラマの間で有名な Randal L. Schwartz にちなんでいます。

いまや Python のソートは key 関数による方法を提供しているので、このテク
ニックは不要でしょう。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Schwartzian_transform


File: python.info,  Node: 比較関数,  Next: Strategies For Unorderable Types and Values,  Prev: デコレート - ソート - アンデコレート DSU,  Up: ソートのテクニック

9.12.7 比較関数
---------------

ソートのための絶対的な値を返すキー関数と違って、2つの入力を受け取り、そ
の相対的な順序を計算するような関数を比較関数といいます。

例えば、 天秤(1) は2つのサンプルを比較し、より軽いか、同じか、より重いか
の相対的な順序を与えます。同じように、 ‘cmp(a, b)’ などの比較関数はより
小さいときは負の値を、入力が等しい場合は 0 を、より大きい場合は正の値を
返します。

他のプログラミング言語で書かれたアルゴリズムを Python に書き直すときに比
較関数を目にすることがよくあります。また、その API の一部として比較関数
を提供しているライブラリもあります。例えば、 *note locale.strcoll():
42ca. は比較関数です。

このような場合に対処するため、Python は比較関数をラップしてキー関数とし
て使えるようにする関数 *note functools.cmp_to_key: 13f2. を提供していま
す。

     sorted(words, key=cmp_to_key(strcoll))  # locale-aware sort order

   ---------- Footnotes ----------

   (1) 
https://upload.wikimedia.org/wikipedia/commons/1/17/Balance_à_tabac_1850.JPG


File: python.info,  Node: Strategies For Unorderable Types and Values,  Next: 残りのはしばし<2>,  Prev: 比較関数,  Up: ソートのテクニック

9.12.8 Strategies For Unorderable Types and Values
--------------------------------------------------

A number of type and value issues can arise when sorting.  Here are some
strategies that can help:

   * Convert non-comparable input types to strings prior to sorting:

     >>> data = ['twelve', '11', 10]
     >>> sorted(map(str, data))
     ['10', '11', 'twelve']

This is needed because most cross-type comparisons raise a *note
TypeError: 198.

   * Remove special values prior to sorting:

     >>> from math import isnan
     >>> from itertools import filterfalse
     >>> data = [3.3, float('nan'), 1.1, 2.2]
     >>> sorted(filterfalse(isnan, data))
     [1.1, 2.2, 3.3]

This is needed because the IEEE-754 standard(1) specifies that, "Every
NaN shall compare unordered with everything, including itself."

Likewise, ‘None’ can be stripped from datasets as well:

     >>> data = [3.3, None, 1.1, 2.2]
     >>> sorted(x for x in data if x is not None)
     [1.1, 2.2, 3.3]

This is needed because ‘None’ is not comparable to other types.

   * Convert mapping types into sorted item lists before sorting:

     >>> data = [{'a': 1}, {'b': 2}]
     >>> sorted(data, key=lambda d: sorted(d.items()))
     [{'a': 1}, {'b': 2}]

This is needed because dict-to-dict comparisons raise a *note TypeError:
198.

   * Convert set types into sorted lists before sorting:

     >>> data = [{'a', 'b', 'c'}, {'b', 'c', 'd'}]
     >>> sorted(map(sorted, data))
     [['a', 'b', 'c'], ['b', 'c', 'd']]

This is needed because the elements contained in set types do not have a
deterministic order.  For example, ‘list({'a', 'b'})’ may produce either
‘['a', 'b']’ or ‘['b', 'a']’.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/IEEE_754


File: python.info,  Node: 残りのはしばし<2>,  Next: 部分的なソート,  Prev: Strategies For Unorderable Types and Values,  Up: ソートのテクニック

9.12.9 残りのはしばし
---------------------

   * ロケールに対応したソートを行うには、キー関数に *note
     locale.strxfrm(): 17bd. を使うか、比較関数に *note
     locale.strcoll(): 42ca. を使ってください。これが必要なのは、同じア
     ルファベットを使っていたとしても、文化が違えば "アルファベット順" の
     意味するものが変わることがあるからです。

   * 'reverse' パラメータはソートの安定性を保ちます (ですから、レコード
     のキーが等しい場合元々の順序が維持されます)。面白いことにこの影響は
     パラメータ無しで *note reversed(): a65. 関数を二回使うことで模倣す
     ることができます:

          >>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]
          >>> standard_way = sorted(data, key=itemgetter(0), reverse=True)
          >>> double_reversed = list(reversed(sorted(reversed(data), key=itemgetter(0))))
          >>> assert standard_way == double_reversed
          >>> standard_way
          [('red', 1), ('red', 2), ('blue', 1), ('blue', 2)]

   * ソート関数は、2つのオブジェクトを比較する際 ‘<’ を用います。したが
     って、クラスに標準のソート順序を追加することは *note __lt__():
     14b8. メソッドを定義することで達成できます。

          >>> Student.__lt__ = lambda self, other: self.age < other.age
          >>> sorted(student_objects)
          [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]

     ただし、‘<’ は *note __lt__(): 14b8. が実装されていなければ *note
     __gt__(): 1523. を使って代替することに注意してください (この技法に
     ついて詳しくは *note object.__lt__(): 14b8. を参照してください)。驚
     きを防ぐため、 PEP 8(1) は6つの比較メソッドを全て実装することを推奨
     しています。この作業を簡単にするため、*note total_ordering(): 1144.
     デコレータが提供されています。

   * key 関数はソートするオブジェクトに依存する必要はありません。 key 関
     数は外部リソースにアクセスすることもできます。例えば学生の成績が辞
     書に保存されている場合、それを利用して別の学生の名前のリストをソー
     トすることができます:

          >>> students = ['dave', 'john', 'jane']
          >>> newgrades = {'john': 'F', 'jane':'A', 'dave': 'C'}
          >>> sorted(students, key=newgrades.__getitem__)
          ['jane', 'dave', 'john']

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0008/


File: python.info,  Node: 部分的なソート,  Prev: 残りのはしばし<2>,  Up: ソートのテクニック

9.12.10 部分的なソート
----------------------

アプリケーションには、データの一部のみが整列されていればよいものがありま
す。標準ライブラリは完全なソートより少ない作業をするいくつかのツールを提
供します。

   * *note min(): 110b. と *note max(): 110c. はそれぞれ最小値と最大値を
     返します。これらの関数は入力データを一度だけ通過し、補助的なメモリ
     をほとんど要求しません。

   * *note heapq.nsmallest(): 29a6. と *note heapq.nlargest(): 29a5. は
     それぞれ最小と最大の値 'n' 個を返します。これらの関数はデータを一度
     だけ通過し、一度に 'n' 要素だけを記憶します。入力の数に対して小さい
     'n' の値では、これらの関数は完全なソートより比較の回数がはるかに少
     なくなります。

   * *note heapq.heappush(): 16d5. と *note heapq.heappop(): 16d6. は最
     小の要素がつねに位置 ‘0’ になる、部分的にソートされたデータの配列を
     作り維持します。これらの関数はタスクスケジューリングに一般的に使わ
     れる優先度キューを実装するのに適しています。


File: python.info,  Node: Unicode HOWTO,  Next: urllib パッケージを使ってインターネット上のリソースを取得するには,  Prev: ソートのテクニック,  Up: Python HOWTO

9.13 Unicode HOWTO
==================


リリース: 1.12

この HOWTO 文書は、文字データの表現のための Unicode 仕様の Python におけ
るサポートについて論じ、さらに Unicode を使おうというときによく出喰わす
多くの問題について説明します。

* Menu:

* Unicode 入門::
* Python の Unicode サポート::
* Unicode データを読み書きする::
* 謝辞: 謝辞<10>.


File: python.info,  Node: Unicode 入門,  Next: Python の Unicode サポート,  Up: Unicode HOWTO

9.13.1 Unicode 入門
-------------------

* Menu:

* 定義::
* エンコーディング: エンコーディング<3>.
* 参考資料: 参考資料<3>.


File: python.info,  Node: 定義,  Next: エンコーディング<3>,  Up: Unicode 入門

9.13.1.1 定義
.............

今日のプログラムは広範囲の文字を扱える必要があります。 アプリケーション
は国際化され、ユーザーが選べる様々な言語でメッセージや出力を表示します;
同じプログラムが、英語、フランス語、日本語、ヘブライ語、ロシア語でエラー
メッセージを出力する必要があるかもしれません。 Webコンテンツはどんな言語
でも書かれる可能性がありますし、様々な絵文字が含まれることもあります。
Python の文字列型は文字表現のための Unicode 標準を使っていて、 Python プ
ログラムは有り得る様々な文字を全て扱えます。

Unicode (‘https://www.unicode.org/’) は、人類の言語で使われる全ての文字
を列挙し、それぞれの文字自身の一意な符号を与えるのを目的とした仕様です。
Unicode 仕様は継続的に改訂され、新しい言語や記号を追加する更新がなされて
います。

'文字' は文章の最小の構成要素です。 'A', 'B', 'C' などは全て異なる文字で
す。 'È' と 'Í' も同様に異なる文字です。 文字は、話している言語や文脈に
よって変わってきます。 例えば、「ローマ数字の 1」という文字 'Ⅰ' は大文字
の 'I' とは別の文字です。 両者は通常は同じに見えますが、異なる意味を持つ
別々の2つの文字です。

The Unicode standard describes how characters are represented by 'code
points'.  A code point value is an integer in the range 0 to 0x10FFFF
(about 1.1 million values, the actual number assigned(1) is less than
that).  In the standard and in this document, a code point is written
using the notation ‘U+265E’ to mean the character with value ‘0x265e’
(9,822 in decimal).

Unicode 標準は、文字とそれに対応するコードポイントを列挙した多くの表を含
んでいます:

     0061    'a'; LATIN SMALL LETTER A
     0062    'b'; LATIN SMALL LETTER B
     0063    'c'; LATIN SMALL LETTER C
     ...
     007B    '{'; LEFT CURLY BRACKET
     ...
     2167    'Ⅷ'; ROMAN NUMERAL EIGHT
     2168    'Ⅸ'; ROMAN NUMERAL NINE
     ...
     265E    '♞'; BLACK CHESS KNIGHT
     265F    '♟'; BLACK CHESS PAWN
     ...
     1F600   '😀'; GRINNING FACE
     1F609   '😉'; WINKING FACE
     ...

厳密には、この定義から「これは文字 ‘U+265E’ です」と言うのは意味の無いこ
とだと分かります。‘U+265E’ はコードポイントであり、それはある特定の文字
を表しているのです; この場合では、 'BLACK CHESS KNIGHT', '♞' という文字
を表しています。 形式ばらない文脈では、このコードポイントと文字の区別は
忘れ去られることもあります。

文字は画面や紙面上では 'グリフ (glyph)' と呼ばれるグラフィック要素の組で
表示されます。大文字の A のグリフは例えば、厳密な形は使っているフォント
によって異なりますが、斜めの線と水平の線です。たいていの Python コードで
はグリフの心配をする必要はありません; 一般的には表示する正しいグリフを見
付けることは GUI toolkit や端末のフォントレンダラーの仕事です。

   ---------- Footnotes ----------

   (1) https://www.unicode.org/versions/latest/#Summary


File: python.info,  Node: エンコーディング<3>,  Next: 参考資料<3>,  Prev: 定義,  Up: Unicode 入門

9.13.1.2 エンコーディング
.........................

前の節をまとめると: Unicode 文字列はコードポイントの列であり、コードポイ
ントとは 0 から ‘0x10FFFF’ (10 進表記で 1,114,111) までの数値です。この
コードポイント列はメモリ上では 'コードユニット' 列として表され、その 'コ
ードユニット' 列は 8-bit のバイト列にマップされます。Unicode 文字列をバ
イト列として翻訳する規則を '文字エンコーディング' または単に 'エンコーデ
ィング' と呼びます。

The first encoding you might think of is using 32-bit integers as the
code unit, and then using the CPU's representation of 32-bit integers.
In this representation, the string "Python" might look like this:

        P           y           t           h           o           n
     0x50 00 00 00 79 00 00 00 74 00 00 00 68 00 00 00 6f 00 00 00 6e 00 00 00
        0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

この表現は直接的でわかりやすい方法ですが、この表現を使うにはいくつかの問
題があります。

  1. 可搬性がない; プロセッサが異なるとバイトの順序づけも変わってしまい
     ます。

  2. 無駄な領域が多いです。多くの文書では、コードポイントは 127 未満もし
     くは 255 未満が多数派を占め、そのため多くの領域が ‘0x00’ というバイ
     トで埋め尽くされます。上の文字列は、ASCII 表現では 6 バイトなのに対
     し、24 バイトのサイズになっています。RAM の使用量が増加するのはそれ
     ほど問題にはなりません (デスクトップコンピュータはギガバイト単位の
     RAM を持っており、通常、文字列はそんな大きさにはなりません) が、デ
     ィスクとネットワーク帯域が 4 倍多く使われてしまうのは我慢できるもの
     ではありません。

  3. ‘strlen()’ のような現存する C 関数と互換性がありません、そのためワ
     イド文字列関数一式が新たに必要となります。

Therefore this encoding isn't used very much, and people instead choose
other encodings that are more efficient and convenient, such as UTF-8.

UTF-8 is one of the most commonly used encodings, and Python often
defaults to using it.  UTF stands for "Unicode Transformation Format",
and the '8' means that 8-bit values are used in the encoding.  (There
are also UTF-16 and UTF-32 encodings, but they are less frequently used
than UTF-8.)  UTF-8 uses the following rules:

  1. コードポイントが 128 未満だった場合、対応するバイト値で表現します。

  2. コードポイントが 128 以上の場合、128 から 255 までのバイトからなる
     、2、3 または 4 バイトのシーケンスに変換します。

UTF-8 はいくつかの便利な性質を持っています:

  1. 任意の Unicode コードポイントを扱うことができる。

  2. A Unicode string is turned into a sequence of bytes that contains
     embedded zero bytes only where they represent the null character
     (U+0000).  This means that UTF-8 strings can be processed by C
     functions such as ‘strcpy()’ and sent through protocols that can't
     handle zero bytes for anything other than end-of-string markers.

  3. ASCII テキストの文字列は UTF-8 テキストとしても有効です。

  4. UTF-8 はかなりコンパクトです; よく使われている文字の大多数は 1 バイ
     トか 2 バイトで表現できます。

  5. バイトが欠落したり、失われた場合、次の UTF-8 でエンコードされたコー
     ドポイントの開始を決定し、再同期することができる可能性があります。
     同様の理由でランダムな 8-bit データは正当な UTF-8 とみなされにくく
     なっています。

  6. UTF-8 is a byte oriented encoding.  The encoding specifies that
     each character is represented by a specific sequence of one or more
     bytes.  This avoids the byte-ordering issues that can occur with
     integer and word oriented encodings, like UTF-16 and UTF-32, where
     the sequence of bytes varies depending on the hardware on which the
     string was encoded.


File: python.info,  Node: 参考資料<3>,  Prev: エンコーディング<3>,  Up: Unicode 入門

9.13.1.3 参考資料
.................

Unicode コンソーシアムのサイト(1) には文字の図表、用語辞典、PDF 版の
Unicode 仕様があります。これ読むのはそれなりに難しいので覚悟してください
。Unicode の起源と発展の 年表(2) もサイトにあります。

On the Computerphile Youtube channel, Tom Scott briefly discusses the
history of Unicode and UTF-8(3) (9 minutes 36 seconds).

標準を理解する助けにするために、Jukka Korpela が Unicode 文字表を読むた
めの 入門ガイド(4) を書いています。

Another good introductory article(5) was written by Joel Spolsky.  If
this introduction didn't make things clear to you, you should try
reading this alternate article before continuing.

Wikipedia の記事はしばしば役に立ちます; 例えば、"character encoding(6)"
や UTF-8(7) の記事を読んでみてください。

   ---------- Footnotes ----------

   (1) https://www.unicode.org

   (2) https://www.unicode.org/history/

   (3) https://www.youtube.com/watch?v=MijmeoH9LT4

   (4) https://jkorpela.fi/unicode/guide.html

   (5) 
https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/

   (6) https://en.wikipedia.org/wiki/Character_encoding

   (7) https://en.wikipedia.org/wiki/UTF-8


File: python.info,  Node: Python の Unicode サポート,  Next: Unicode データを読み書きする,  Prev: Unicode 入門,  Up: Unicode HOWTO

9.13.2 Python の Unicode サポート
---------------------------------

ここまでで Unicode の基礎を学びました、ここから Python の Unicode 機能に
触れます。

* Menu:

* 文字列型::
* バイト列への変換::
* Python ソースコード内の Unicode リテラル::
* Unicode プロパティ::
* Comparing Strings::
* Unicode 正規表現::
* 参考資料: 参考資料<4>.


File: python.info,  Node: 文字列型,  Next: バイト列への変換,  Up: Python の Unicode サポート

9.13.2.1 文字列型
.................

Since Python 3.0, the language's *note str: 169. type contains Unicode
characters, meaning any string created using ‘"unicode rocks!"’,
‘'unicode rocks!'’, or the triple-quoted string syntax is stored as
Unicode.

Python ソースコードのデフォルトエンコーディングは UTF-8 なので、文字列リ
テラルの中に Unicode 文字をそのまま含めることができます:

     try:
         with open('/tmp/input.txt', 'r') as f:
             ...
     except OSError:
         # 'File not found' error message.
         print("Fichier non trouvé")

追記: Python3 は Unicode 文字を使った識別子もサポートしています:

     répertoire = "/tmp/records.log"
     with open(répertoire, "w") as f:
         f.write("test\n")

エディタである特定の文字が入力できなかったり、とある理由でソースコードを
ASCII のみに保ちたい場合は、文字列リテラルでエスケープシーケンスが使えま
す。(使ってるシステムによっては、u でエスケープされた文字列ではなく、実
物の大文字のラムダのグリフが見えるかもしれません。):

     >>> "\N{GREEK CAPITAL LETTER DELTA}"  # Using the character name
     '\u0394'
     >>> "\u0394"                          # Using a 16-bit hex value
     '\u0394'
     >>> "\U00000394"                      # Using a 32-bit hex value
     '\u0394'

加えて、 *note bytes: 192. クラスの *note decode(): ad3. メソッドを使っ
て文字列を作ることもできます。このメソッドは ‘UTF-8’ のような値を
'encoding' 引数に取り、オプションで 'errors' 引数を取ります。

'errors' 引数は、入力文字列に対しエンコーディングルールに従った変換がで
きなかったときの対応方法を指定します。この引数に使える値は ‘'strict'’
(*note UnicodeDecodeError: c08. を送出する)、 ‘'replace'’ (‘REPLACEMENT
CHARACTER’ である ‘U+FFFD’ を使う)、 ‘'ignore'’ (結果となる Unicode から
単に文字を除く) 、‘'backslashreplace'’ (エスケープシーケンス ‘\xNN’ を挿
入する) です。次の例はこれらの違いを示しています:

     >>> b'\x80abc'.decode("utf-8", "strict")
     Traceback (most recent call last):
         ...
     UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0:
       invalid start byte
     >>> b'\x80abc'.decode("utf-8", "replace")
     '\ufffdabc'
     >>> b'\x80abc'.decode("utf-8", "backslashreplace")
     '\\x80abc'
     >>> b'\x80abc'.decode("utf-8", "ignore")
     'abc'

エンコーディングはエンコーディングの名前を含んだ文字列で指定されます。
Python はおよそ 100 の異なるエンコーディングに対応しています; 一覧は
Python ライブラリリファレンスの *note 標準エンコーディング: fb8. を参照
してください。いくつかのエンコーディングは複数の名前を持っています; 例え
ば、 ‘'latin-1'’ と ‘'iso_8859_1'’ と ‘'8859'’ は全て同じエンコーディン
グの別名です。

Unicode 文字列の一つの文字は *note chr(): 19ef. 組み込み関数で作成するこ
とができます、この関数は整数を引数にとり、対応するコードポイントを含む長
さ1の Unicode 文字列を返します。逆の操作は *note ord(): 233b. 組み込み関
数です、この関数は一文字の Unicode 文字列を引数にとり、コードポイント値
を返します:

     >>> chr(57344)
     '\ue000'
     >>> ord('\ue000')
     57344


File: python.info,  Node: バイト列への変換,  Next: Python ソースコード内の Unicode リテラル,  Prev: 文字列型,  Up: Python の Unicode サポート

9.13.2.2 バイト列への変換
.........................

*note bytes.decode(): ad3. とは処理が逆向きのメソッドが *note
str.encode(): ad2. です。このメソッドは、 Unicode 文字列を指定された
'encoding' でエンコードして、 *note bytes: 192. による表現で返します。

'errors' 引数は *note decode(): ad3. メソッドのパラメータと同じものです
が、サポートされているハンドラの数がもう少し多いです。 ‘'strict'’ 、
‘'ignore'’ 、 ‘'replace'’ (このメソッドでは、エンコードできなかった文字
の代わりに疑問符を挿入する) の他に、 ‘'xmlcharrefreplace'’ (XML 文字参照
を挿入する) と ‘backslashreplace’ (エスケープシーケンス ‘\nNNNN’ を挿入
する)、 ‘namereplace’ (エスケープシーケンス ‘\N{...}’ を挿入する) があり
ます。

次の例では、それぞれの異なる処理結果が示されています:

     >>> u = chr(40960) + 'abcd' + chr(1972)
     >>> u.encode('utf-8')
     b'\xea\x80\x80abcd\xde\xb4'
     >>> u.encode('ascii')
     Traceback (most recent call last):
         ...
     UnicodeEncodeError: 'ascii' codec can't encode character '\ua000' in
       position 0: ordinal not in range(128)
     >>> u.encode('ascii', 'ignore')
     b'abcd'
     >>> u.encode('ascii', 'replace')
     b'?abcd?'
     >>> u.encode('ascii', 'xmlcharrefreplace')
     b'&#40960;abcd&#1972;'
     >>> u.encode('ascii', 'backslashreplace')
     b'\\ua000abcd\\u07b4'
     >>> u.encode('ascii', 'namereplace')
     b'\\N{YI SYLLABLE IT}abcd\\u07b4'

利用可能なエンコーディングを登録したり、アクセスしたりする低レベルのルー
チンは *note codecs: 1c. モジュールにあります。新しいエンコーディングを
実装するには、 *note codecs: 1c. モジュールを理解していることも必要にな
ります。しかし、このモジュールのエンコードやデコードの関数は、使い勝手が
良いというより低レベルな関数で、新しいエンコーディングを書くのは特殊な作
業なので、この HOWTO では扱わないことにします。


File: python.info,  Node: Python ソースコード内の Unicode リテラル,  Next: Unicode プロパティ,  Prev: バイト列への変換,  Up: Python の Unicode サポート

9.13.2.3 Python ソースコード内の Unicode リテラル
.................................................

Python のソースコード内では、特定のコードポイントはエスケープシーケンス
‘\u’ を使い、続けてコードポイントを4桁の16進数を書きます。エスケープシー
ケンス ‘\U’ も同様です、ただし4桁ではなく8桁の16進数を使います:

     >>> s = "a\xac\u1234\u20ac\U00008000"
     ... #     ^^^^ two-digit hex escape
     ... #         ^^^^^^ four-digit Unicode escape
     ... #                     ^^^^^^^^^^ eight-digit Unicode escape
     >>> [ord(c) for c in s]
     [97, 172, 4660, 8364, 32768]

127 より大きいコードポイントに対してエスケープシーケンスを使うのは、エス
ケープシーケンスがあまり多くないうちは有効ですが、フランス語等のアクセン
トを使う言語でメッセージのような多くのアクセント文字を使う場合には邪魔に
なります。文字を *note chr(): 19ef. 組み込み関数を使って組み上げることも
できますが、それはさらに長くなってしまうでしょう。

理想的にはあなたの言語の自然なエンコーディングでリテラルを書くことでしょ
う。そうなれば、Python のソースコードをアクセント付きの文字を自然に表示
するお気に入りのエディタで編集し、実行時に正しい文字が得られます。

Python はデフォルトでは UTF-8 ソースコードを書くことができます、ただしど
のエンコーディングを使うかを宣言すればほとんどのエンコーディングを使えま
す。それはソースファイルの一行目や二行目に特別なコメントを含めることによ
ってできます:

     #!/usr/bin/env python
     # -*- coding: latin-1 -*-

     u = 'abcdé'
     print(ord(u[-1]))

この構文は Emacs のファイル固有の変数を指定する表記から影響を受けていま
す。Emacs は様々な変数をサポートしていますが、Python がサポートしている
のは 'coding' のみです。 ‘-*-’ の記法は Emacs に対してコメントが特別であ
ることを示します。これは Python にとって意味はありませんが慣習で使われて
います。 Python はコメント中に ‘coding: name’ または ‘coding=name’ を探
します。

このようなコメントを含んでいない場合、すでに述べた通り、使われるデフォル
トエンコーディングは UTF-8 になります。より詳しい情報は PEP 263(1) を参
照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0263/


File: python.info,  Node: Unicode プロパティ,  Next: Comparing Strings,  Prev: Python ソースコード内の Unicode リテラル,  Up: Python の Unicode サポート

9.13.2.4 Unicode プロパティ
...........................

The Unicode specification includes a database of information about code
points.  For each defined code point, the information includes the
character's name, its category, the numeric value if applicable (for
characters representing numeric concepts such as the Roman numerals,
fractions such as one-third and four-fifths, etc.).  There are also
display-related properties, such as how to use the code point in
bidirectional text.

以下のプログラムはいくつかの文字に対する情報を表示し、特定の文字の数値を
印字します:

     import unicodedata

     u = chr(233) + chr(0x0bf2) + chr(3972) + chr(6000) + chr(13231)

     for i, c in enumerate(u):
         print(i, '%04x' % ord(c), unicodedata.category(c), end=" ")
         print(unicodedata.name(c))

     # Get numeric value of second character
     print(unicodedata.numeric(u[1]))

実行すると、このように出力されます:

     0 00e9 Ll LATIN SMALL LETTER E WITH ACUTE
     1 0bf2 No TAMIL NUMBER ONE THOUSAND
     2 0f84 Mn TIBETAN MARK HALANTA
     3 1770 Lo TAGBANWA LETTER SA
     4 33af So SQUARE RAD OVER S SQUARED
     1000.0

カテゴリーコードは文字の性質を略記で表したものです。カテゴリーコードは
"Letter"、"Number"、"Punctuation"、"Symbol" などのカテゴリーに分類され、
さらにサブカテゴリーに細分化されます。上記の出力からコードを拾うと、
‘'Ll'’ は 'Letter, lowercase'、‘'No'’ は "Number, other"、‘'Mn'’ は
"Mark, nonspacing"、‘'So'’ は "Symbol, other" を意味しています。カテゴリ
ーコードの一覧は Unicode Character Database 文書の General Category
Values 節(1) を参照してください。

   ---------- Footnotes ----------

   (1) https://www.unicode.org/reports/tr44/#General_Category_Values


File: python.info,  Node: Comparing Strings,  Next: Unicode 正規表現,  Prev: Unicode プロパティ,  Up: Python の Unicode サポート

9.13.2.5 Comparing Strings
..........................

Unicode adds some complication to comparing strings, because the same
set of characters can be represented by different sequences of code
points.  For example, a letter like 'ê' can be represented as a single
code point U+00EA, or as U+0065 U+0302, which is the code point for 'e'
followed by a code point for 'COMBINING CIRCUMFLEX ACCENT'. These will
produce the same output when printed, but one is a string of length 1
and the other is of length 2.

One tool for a case-insensitive comparison is the *note casefold(): fd6.
string method that converts a string to a case-insensitive form
following an algorithm described by the Unicode Standard.  This
algorithm has special handling for characters such as the German letter
'ß' (code point U+00DF), which becomes the pair of lowercase letters
'ss'.

     >>> street = 'Gürzenichstraße'
     >>> street.casefold()
     'gürzenichstrasse'

A second tool is the *note unicodedata: 10b. module's *note normalize():
8e4. function that converts strings to one of several normal forms,
where letters followed by a combining character are replaced with single
characters.  *note normalize(): 8e4. can be used to perform string
comparisons that won't falsely report inequality if two strings use
combining characters differently:

     import unicodedata

     def compare_strs(s1, s2):
         def NFD(s):
             return unicodedata.normalize('NFD', s)

         return NFD(s1) == NFD(s2)

     single_char = 'ê'
     multiple_chars = '\N{LATIN SMALL LETTER E}\N{COMBINING CIRCUMFLEX ACCENT}'
     print('length of first string=', len(single_char))
     print('length of second string=', len(multiple_chars))
     print(compare_strs(single_char, multiple_chars))

実行すると、このように出力されます:

     $ python compare-strs.py
     length of first string= 1
     length of second string= 2
     True

The first argument to the *note normalize(): 8e4. function is a string
giving the desired normalization form, which can be one of 'NFC',
'NFKC', 'NFD', and 'NFKD'.

The Unicode Standard also specifies how to do caseless comparisons:

     import unicodedata

     def compare_caseless(s1, s2):
         def NFD(s):
             return unicodedata.normalize('NFD', s)

         return NFD(NFD(s1).casefold()) == NFD(NFD(s2).casefold())

     # Example usage
     single_char = 'ê'
     multiple_chars = '\N{LATIN CAPITAL LETTER E}\N{COMBINING CIRCUMFLEX ACCENT}'

     print(compare_caseless(single_char, multiple_chars))

This will print ‘True’.  (Why is ‘NFD()’ invoked twice?  Because there
are a few characters that make *note casefold(): fd6. return a
non-normalized string, so the result needs to be normalized again.  See
section 3.13 of the Unicode Standard for a discussion and an example.)


File: python.info,  Node: Unicode 正規表現,  Next: 参考資料<4>,  Prev: Comparing Strings,  Up: Python の Unicode サポート

9.13.2.6 Unicode 正規表現
.........................

*note re: be. モジュールがサポートしている正規表現はバイト列や文字列とし
て与えられます。 ‘\d’ や ‘\w’ などのいくつかの特殊な文字シーケンスは、そ
のパターンがバイト列として与えられたのか文字列として与えられたのかによっ
て、異なる意味を持ちます。例えば、 ‘\d’ はバイト列では ‘[0-9]’ の範囲の
文字と一致しますが、文字列では ‘'Nd'’ カテゴリーにある任意の文字と一致し
ます。

この例にある文字列には、タイ語の数字とアラビア数字の両方で数字の 57 が書
いてあります。

     import re
     p = re.compile(r'\d+')

     s = "Over \u0e55\u0e57 57 flavours"
     m = p.search(s)
     print(repr(m.group()))

実行すると、 ‘\d+’ はタイ語の数字と一致し、それを出力します。フラグ
*note re.ASCII: 83e. を *note compile(): dce. に渡した場合、 ‘\d+’ は先
程とは違って部分文字列 "57" に一致します。

同様に、 ‘\w’ は非常に多くの Unicode 文字に一致しますが、バイト列の場合
もしくは *note re.ASCII: 83e. が渡された場合は ‘[a-zA-Z0-9_]’ にしか一致
しません。 ‘\s’ は文字列では Unicode 空白文字に、バイト列では ‘[
\t\n\r\f\v]’ に一致します。


File: python.info,  Node: 参考資料<4>,  Prev: Unicode 正規表現,  Up: Python の Unicode サポート

9.13.2.7 参考資料
.................

Python の Unicode サポートについての参考になる議論は以下の2つです:

   * Nick Coghlan による Processing Text Files in Python 3(1)

   * Ned Batchelder による PyCon 2012 での発表 Pragmatic Unicode(2)

*note str: 169. 型については Python ライブラリリファレンスの *note
テキストシーケンス型 -- str: 1fe0. で解説されています。

*note unicodedata: 10b. モジュールについてのドキュメント。

*note codecs: 1c. モジュールについてのドキュメント。

Marc-André Lemburg は EuroPython 2002 で "Python and Unicode" というタイ
トルのプレゼンテーション (PDF スライド)(3) を行いました。このスライドは
Python 2 の Unicode 機能 (Unicode 文字列型が ‘unicode’ と呼ばれ、リテラ
ルは ‘u’ で始まります) の設計について概観する素晴しい資料です。

   ---------- Footnotes ----------

   (1) 
https://python-notes.curiousefficiency.org/en/latest/python3/text_file_processing.html

   (2) https://nedbatchelder.com/text/unipain.html

   (3) https://downloads.egenix.com/python/Unicode-EPC2002-Talk.pdf


File: python.info,  Node: Unicode データを読み書きする,  Next: 謝辞<10>,  Prev: Python の Unicode サポート,  Up: Unicode HOWTO

9.13.3 Unicode データを読み書きする
-----------------------------------

一旦 Unicode データに対してコードが動作するように書き終えたら、次の問題
は入出力です。プログラムは Unicode 文字列をどう受けとり、どう Unicode を
外部記憶装置や送受信装置に適した形式に変換するのでしょう?

入力ソースと出力先に依存しないような方法は可能です; アプリケーションに利
用されているライブラリが Unicode をそのままサポートしているかを調べなけ
ればいけません。例えば XML パーサーは大抵 Unicode データを返します。多く
のリレーショナルデータベースも Unicode 値の入ったコラムをサポートしてい
ますし、 SQL の問い合わせで Unicode 値を返すことができます。

Unicode のデータはディスクに書き込まれたり、ソケットを介して送信されたり
するにあたって、通常、特定のエンコーディングに変換されます。推奨はされま
せんが、これを手動で行うことも可能です。ファイルを開き、8バイトオブジェ
クトを読み込み、バイト列を ‘bytes.decode(encoding)’ で変換することにより
実現できます。

1つの問題はエンコーディングがマルチバイトに渡るという性質です; 1つの
Unicode 文字はいくつかのバイトで表現され得ます。任意のサイズのチャンク
(例えば、1024 もしくは 4096 バイト) にファイルの内容を読み込みたい場合、
ある1つの Unicode 文字をエンコードしたバイト列の一部だけがチャンクの末尾
まで読み込まれたケースに対応する、エラー処理コードを書く必要があります。
1つの解決策はファイル全体をメモリに読み込み、デコード処理を実行すること
ですが、こうしてしまうと非常に大きなファイルを処理するときの妨げになりま
す; 2 GiB のファイルを読み込む必要がある場合、2 GiB の RAM が必要になり
ます。(実際には、少なくともある瞬間では、エンコードされた文字列と
Unicode 文字列の両方をメモリに保持する必要があるため、より多くのメモリが
必要です。)

The solution would be to use the low-level decoding interface to catch
the case of partial coding sequences.  The work of implementing this has
already been done for you: the built-in *note open(): 316. function can
return a file-like object that assumes the file's contents are in a
specified encoding and accepts Unicode parameters for methods such as
*note read(): 206c. and *note write(): 205b.  This works through *note
open(): 316.'s 'encoding' and 'errors' parameters which are interpreted
just like those in *note str.encode(): ad2. and *note bytes.decode():
ad3.

そのためファイルから Unicode を読むのは単純です:

     with open('unicode.txt', encoding='utf-8') as f:
         for line in f:
             print(repr(line))

読み書きの両方ができる update モードでファイルを開くことも可能です:

     with open('test', encoding='utf-8', mode='w+') as f:
         f.write('\u4500 blah blah blah\n')
         f.seek(0)
         print(repr(f.readline()[:1]))

Unicode 文字 ‘U+FEFF’ は byte-order mark (BOM) として使われ、ファイルの
バイト順の自動判定を支援するために、ファイルの最初の文字として書かれます
。UTF-16 のようないくつかのエンコーディングは、ファイルの先頭に BOM があ
ることを要求します; そのようなエンコーディングが使われるとき、自動的に
BOM が最初の文字として書かれ、ファイルを読むときに暗黙の内に取り除かれま
す。これらのエンコーディングには、リトルエンディアン (little-endian) 用
の 'utf-16-le' やビッグエンディアン (big-endian) 用の 'utf-16-be' という
ような変種があり、これらは特定の1つのバイト順を指定していて BOM をスキッ
プしません。

In some areas, it is also convention to use a "BOM" at the start of
UTF-8 encoded files; the name is misleading since UTF-8 is not
byte-order dependent.  The mark simply announces that the file is
encoded in UTF-8.  For reading such files, use the 'utf-8-sig' codec to
automatically skip the mark if present.

* Menu:

* Unicode ファイル名::
* Unicode 対応のプログラムを書くための Tips::
* 参考資料: 参考資料<5>.


File: python.info,  Node: Unicode ファイル名,  Next: Unicode 対応のプログラムを書くための Tips,  Up: Unicode データを読み書きする

9.13.3.1 Unicode ファイル名
...........................

Most of the operating systems in common use today support filenames that
contain arbitrary Unicode characters.  Usually this is implemented by
converting the Unicode string into some encoding that varies depending
on the system.  Today Python is converging on using UTF-8: Python on
MacOS has used UTF-8 for several versions, and Python 3.6 switched to
using UTF-8 on Windows as well.  On Unix systems, there will only be a
*note filesystem encoding: 75d.  if you've set the ‘LANG’ or ‘LC_CTYPE’
environment variables; if you haven't, the default encoding is again
UTF-8.

*note sys.getfilesystemencoding(): e53. 関数は現在のシステムで利用するエ
ンコーディングを返し、エンコーディングを手動で設定したい場合利用します、
ただしわざわざそうする積極的な理由はありません。読み書きのためにファイル
を開く時には、ファイル名を Unicode 文字列として渡すだけで正しいエンコー
ディングに自動的に変更されます:

     filename = 'filename\u4500abc'
     with open(filename, 'w') as f:
         f.write('blah\n')

*note os.stat(): 26d. のような *note os: a5. モジュールの関数も Unicode
のファイル名を受け付けます。

The *note os.listdir(): 1312. function returns filenames, which raises
an issue: should it return the Unicode version of filenames, or should
it return bytes containing the encoded versions?  *note os.listdir():
1312. can do both, depending on whether you provided the directory path
as bytes or a Unicode string.  If you pass a Unicode string as the path,
filenames will be decoded using the filesystem's encoding and a list of
Unicode strings will be returned, while passing a byte path will return
the filenames as bytes.  For example, assuming the default *note
filesystem encoding: 75d. is UTF-8, running the following program:

     fn = 'filename\u4500abc'
     f = open(fn, 'w')
     f.close()

     import os
     print(os.listdir(b'.'))
     print(os.listdir('.'))

以下の出力結果が生成されます:

     $ python listdir-test.py
     [b'filename\xe4\x94\x80abc', ...]
     ['filename\u4500abc', ...]

最初のリストは UTF-8 でエンコーディングされたファイル名を含み、第二のリ
ストは Unicode 版を含んでいます。

Note that on most occasions, you should can just stick with using
Unicode with these APIs.  The bytes APIs should only be used on systems
where undecodable file names can be present; that's pretty much only
Unix systems now.


File: python.info,  Node: Unicode 対応のプログラムを書くための Tips,  Next: 参考資料<5>,  Prev: Unicode ファイル名,  Up: Unicode データを読み書きする

9.13.3.2 Unicode 対応のプログラムを書くための Tips
..................................................

この章では Unicode を扱うプログラムを書くためのいくつかの提案を紹介しま
す。

最も重要な助言としては:

     ソフトウェアは内部では Unicode 文字列のみを利用し、入力データはでき
     るだけ早期にデコードし、出力の直前でエンコードすべきです。

If you attempt to write processing functions that accept both Unicode
and byte strings, you will find your program vulnerable to bugs wherever
you combine the two different kinds of strings.  There is no automatic
encoding or decoding: if you do e.g.  ‘str + bytes’, a *note TypeError:
198. will be raised.

web ブラウザから来るデータやその他の信頼できないところからのデータを利用
する場合、それらの文字列から生成したコマンド行の実行や、それらの文字列を
データベースに蓄える前に文字列の中に不正な文字が含まれていないか確認する
のが一般的です。もしそういう状況になった場合には、エンコードされたバイト
データではなく、デコードされた文字列のチェックを入念に行なって下さい; い
くつかのエンコーディングは問題となる性質を持っています、例えば全単射でな
かったり、完全に ASCII 互換でないなど。入力データがエンコーディングを指
定している場合でもそうして下さい、なぜなら攻撃者は巧みに悪意あるテキスト
をエンコードした文字列の中に隠すことができるからです。

* Menu:

* ファイルエンコーディングの変換::
* 不明なエンコーディングのファイル::


File: python.info,  Node: ファイルエンコーディングの変換,  Next: 不明なエンコーディングのファイル,  Up: Unicode 対応のプログラムを書くための Tips

9.13.3.3 ファイルエンコーディングの変換
.......................................

The *note StreamRecoder: 1dd4. class can transparently convert between
encodings, taking a stream that returns data in encoding #1 and behaving
like a stream returning data in encoding #2.

For example, if you have an input file 'f' that's in Latin-1, you can
wrap it with a *note StreamRecoder: 1dd4. to return bytes encoded in
UTF-8:

     new_f = codecs.StreamRecoder(f,
         # en/decoder: used by read() to encode its results and
         # by write() to decode its input.
         codecs.getencoder('utf-8'), codecs.getdecoder('utf-8'),

         # reader/writer: used to read and write to the stream.
         codecs.getreader('latin-1'), codecs.getwriter('latin-1') )


File: python.info,  Node: 不明なエンコーディングのファイル,  Prev: ファイルエンコーディングの変換,  Up: Unicode 対応のプログラムを書くための Tips

9.13.3.4 不明なエンコーディングのファイル
.........................................

What can you do if you need to make a change to a file, but don't know
the file's encoding?  If you know the encoding is ASCII-compatible and
only want to examine or modify the ASCII parts, you can open the file
with the ‘surrogateescape’ error handler:

     with open(fname, 'r', encoding="ascii", errors="surrogateescape") as f:
         data = f.read()

     # make changes to the string 'data'

     with open(fname + '.new', 'w',
               encoding="ascii", errors="surrogateescape") as f:
         f.write(data)

The ‘surrogateescape’ error handler will decode any non-ASCII bytes as
code points in a special range running from U+DC80 to U+DCFF. These code
points will then turn back into the same bytes when the
‘surrogateescape’ error handler is used to encode the data and write it
back out.


File: python.info,  Node: 参考資料<5>,  Prev: Unicode 対応のプログラムを書くための Tips,  Up: Unicode データを読み書きする

9.13.3.5 参考資料
.................

One section of Mastering Python 3 Input/Output(1), a PyCon 2010 talk by
David Beazley, discusses text processing and binary data handling.

Marc-André Lemburg のプレゼンテーション "Writing Unicode-aware
Applications in Python" の PDF スライドが
<‘https://downloads.egenix.com/python/LSM2005-Developing-Unicode-aware-applications-in-Python.pdf’>
から入手可能です、そして文字エンコーディングの問題と同様にアプリケーショ
ンの国際化やローカライズについても議論されています。このスライドは
Python 2.x のみをカバーしています。

The Guts of Unicode in Python(2) is a PyCon 2013 talk by Benjamin
Peterson that discusses the internal Unicode representation in Python
3.3.

   ---------- Footnotes ----------

   (1) https://pyvideo.org/video/289/pycon-2010-mastering-python-3-i-o

   (2) https://pyvideo.org/video/1768/the-guts-of-unicode-in-python


File: python.info,  Node: 謝辞<10>,  Prev: Unicode データを読み書きする,  Up: Unicode HOWTO

9.13.4 謝辞
-----------

このドキュメントの最初の草稿は Andrew Kuchling によって書かれました。そ
れからさらに Alexander Belopolsky, Georg Brandl, Andrew Kuchling, Ezio
Melotti らで改訂が重ねられています。

この記事中の誤りの指摘や提案を申し出てくれた以下の人々に感謝します: Éric
Araujo, Nicholas Bastin, Nick Coghlan, Marius Gedminas, Kent Johnson,
Ken Krugler, Marc-André Lemburg, Martin von Löwis, Terry J. Reedy,
Serhiy Storchaka, Eryk Sun, Chad Whitacre, Graham Wideman.


File: python.info,  Node: urllib パッケージを使ってインターネット上のリソースを取得するには,  Next: ipaddressモジュールの紹介,  Prev: Unicode HOWTO,  Up: Python HOWTO

9.14 urllib パッケージを使ってインターネット上のリソースを取得するには
======================================================================


著者: Michael Foord(1)

* Menu:

* はじめに: はじめに<17>.
* URL を取得する::
* 例外を処理する: 例外を処理する<2>.
* info と geturl::
* Openers と Handlers::
* Basic 認証::
* プロキシ::
* ソケットとレイヤー::
* 脚注::

   ---------- Footnotes ----------

   (1) https://agileabstractions.com/


File: python.info,  Node: はじめに<17>,  Next: URL を取得する,  Up: urllib パッケージを使ってインターネット上のリソースを取得するには

9.14.1 はじめに
---------------

Related Articles
................

同じように Python でインターネットリソースを取得するのに以下の記事が役に
立ちます:

   * Basic Authentication(1)

          'Basic 認証' についてのチュートリアルで Python の例がついてい
          ます。

'urllib.request' は URLs (Uniform Resource Locators) を取得するための
Python モジュールです。このモジュールはとても簡単なインターフェースを
'urlopen' 関数の形式で提供しています。また、このモジュールは一般的な状況
で利用するためにいくらか複雑なインターフェースも提供しています - basic 認
証やクッキー、プロキシ等。これらは handler や opener と呼ばれるオブジェ
クトとして提供されます。

urllib.request は多くの "URL スキーム" (URL の ":" の前の文字列で識別さ
れるもの - 例えば "‘ftp://python.org/’" では "ftp") の URL を、関連する
ネットワークプロトコル(例えば FTP, HTTP) を利用することで、取得できます
。

単純な状況では 'urlopen' はとても簡単に使うことができます。しかし HTTP の
URL を開くときにエラーが起きたり、特殊なケースに遭遇すると、 HyperText
Transfer Protocol に関するいくつかのことを理解する必要があります。 HTTP
に関して最も包括的で信頼できる文献は RFC 2616(2) です。この文書は技術文
書なので簡単には読めません。この HOWTO の目的は 'urllib' の利用法を例示
することです、 HTTP についてはその助けになるのに十分に詳しく載せています
。このドキュメントは *note urllib.request: 111. のドキュメントの代わりに
はなりませんが、補完する役割を持っています。

   ---------- Footnotes ----------

   (1) 
https://web.archive.org/web/20201215133350/http://www.voidspace.org.uk/python/articles/authentication.shtml

   (2) https://datatracker.ietf.org/doc/html/rfc2616.html


File: python.info,  Node: URL を取得する,  Next: 例外を処理する<2>,  Prev: はじめに<17>,  Up: urllib パッケージを使ってインターネット上のリソースを取得するには

9.14.2 URL を取得する
---------------------

urllib.request を利用する最も簡単な方法は以下です:

     import urllib.request
     with urllib.request.urlopen('http://python.org/') as response:
        html = response.read()

URL によってリソースを取得し、それを一時的な場所に保存しておきたいときは
、 *note shutil.copyfileobj(): c52. と *note
tempfile.NamedTemporaryFile(): 6ed. 関数を使って行うことができます:

     import shutil
     import tempfile
     import urllib.request

     with urllib.request.urlopen('http://python.org/') as response:
         with tempfile.NamedTemporaryFile(delete=False) as tmp_file:
             shutil.copyfileobj(response, tmp_file)

     with open(tmp_file.name) as html:
         pass

多くの urllib の利用法はこのように簡単です ('http:' の代わりに URL を
'ftp:' や 'file:' 等で始めればできます)。しかし、このチュートリアルの目
的は、特に HTTP に絞って、より複雑な状況を説明することです。

HTTP はリクエスト (request) とレスポンス (response) が基本となっています
- クライアントがリクエストし、サーバーがレスポンスを送ります。
urllib.request はこれを真似て、作成する HTTP リクエストを表現する
‘Request’ オブジェクトを備えています。リクエストオブジェクトを作成する最
も簡単な方法は取得したい URL を指定することです。‘urlopen’ をこのオブジ
ェクトを使って呼び出すと、リクエストした URL のレスポンスオブジェクトが
返されます。このレスポンスはファイルライクオブジェクトで、これはつまりレ
スポンスに ‘.read()’ と呼び出せることを意味しています:

     import urllib.request

     req = urllib.request.Request('http://python.org/')
     with urllib.request.urlopen(req) as response:
        the_page = response.read()

urllib.request は同じリクエストインターフェースを全ての URL スキームに対
して利用できるようにしています。例えば、FTP リクエストの場合はこうできま
す:

     req = urllib.request.Request('ftp://example.com/')

HTTP の場合には、リクエストオブジェクトに対して二つの特別な操作ができま
す: 一つ目はサーバーに送るデータを渡すことができる、二つ目はサーバーに送
るデータやリクエスト自身に 'ついての' 特別な情報 ("metadata")を渡すこと
ができます - これらの送られる情報は HTTP 「ヘッダ」です。今度はこれらに
関してひとつひとつ見ていきましょう。

* Menu:

* データ::
* ヘッダ::


File: python.info,  Node: データ,  Next: ヘッダ,  Up: URL を取得する

9.14.2.1 データ
...............

URL にデータを送りたい場合はよくあります (しばしば、その URL は CGI
(Common Gateway Interface) スクリプトや他の web アプリケーションを参照す
ることになります)。これは HTTP では、 'POST' リクエストとして知られる方
法で行なわれます。これは web 上で HTML フォームを埋めて送信するときにブ
ラウザが行なっていることです。全ての POST がフォームから送られるとは限り
ません: 自身のアプリケーションに対して任意のデータを POST を使って送るこ
とができます。一般的な HTML フォームの場合、データは標準的な方法でエンコ
ードされている必要があり、リクエストオブジェクトに ‘data’ 引数として渡し
ます。エンコーディングは *note urllib.parse: 110. ライブラリの関数を使っ
て行います。

     import urllib.parse
     import urllib.request

     url = 'http://www.someserver.com/cgi-bin/register.cgi'
     values = {'name' : 'Michael Foord',
               'location' : 'Northampton',
               'language' : 'Python' }

     data = urllib.parse.urlencode(values)
     data = data.encode('ascii') # data should be bytes
     req = urllib.request.Request(url, data)
     with urllib.request.urlopen(req) as response:
        the_page = response.read()

他のエンコーディングが必要な場合があることに注意して下さい (例えば、
HTML フォームからファイルをアップロードするための詳細については HTML
Specification, Form Submission(1) を見て下さい)。

‘data’ 引数を渡さない場合、urllib は 'GET' リクエストを利用します。GET と
POST リクエストの一つの違いは、POST リクエストにしばしば、「副作用」があ
ることです: POST リクエストはいくつかの方法によってシステムの状態を変化
させます (例えば100ポンドのスパムの缶詰をドアの前まで配達する注文を web
サイトで行う)。とはいえ HTTP 標準で明確にされている内容では、POST は '常
に' 副作用を持ち、GET リクエストは '決して' 副作用を持たないことを意図す
るけれども、、GET リクエストが副作用を持つことも、POST リクエストが副作
用を持たないことも、妨げられません。HTTP の GET リクエストでもデータ自身
をエンコーディングすることでデータを渡すことができます。

以下のようにして行います:

     >>> import urllib.request
     >>> import urllib.parse
     >>> data = {}
     >>> data['name'] = 'Somebody Here'
     >>> data['location'] = 'Northampton'
     >>> data['language'] = 'Python'
     >>> url_values = urllib.parse.urlencode(data)
     >>> print(url_values)  # The order may differ from below.
     name=Somebody+Here&language=Python&location=Northampton
     >>> url = 'http://www.example.com/example.cgi'
     >>> full_url = url + '?' + url_values
     >>> data = urllib.request.urlopen(full_url)

‘?’ を URL に加え、それにエンコードされた値が続くことで、完全な URL が作
られていることに注意して下さい。

   ---------- Footnotes ----------

   (1) https://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13


File: python.info,  Node: ヘッダ,  Prev: データ,  Up: URL を取得する

9.14.2.2 ヘッダ
...............

ここでは特定の HTTP ヘッダについて議論します、 HTTP リクエストにヘッダを
追加する方法について例示します。

いくつかの web サイト (1) はプログラムからブラウズされることを嫌っていた
り、異なるブラウザに対して異なるバージョンを送ります (2)。デフォルトでは
urllib は自身の情報を ‘Python-urllib/x.y’ として扱います ( ‘x’ と ‘y’ は
Python のリリースバージョンのメジャーバージョンとマイナーバージョンです
、例えば ‘Python-urllib/2.5’ など)。これによって web サイト側が混乱した
り、動作しないかもしれません。ブラウザは自身の情報を ‘User-Agent’ ヘッダ
(3) を通して扱っています。リクエストオブジェクトを作るときに、ヘッダに辞
書を渡すことができます。以下の例は上の例と同じですが、自身を Internet
Explorer (4) のバージョンの一つとして扱っています。

     import urllib.parse
     import urllib.request

     url = 'http://www.someserver.com/cgi-bin/register.cgi'
     user_agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'
     values = {'name': 'Michael Foord',
               'location': 'Northampton',
               'language': 'Python' }
     headers = {'User-Agent': user_agent}

     data = urllib.parse.urlencode(values)
     data = data.encode('ascii')
     req = urllib.request.Request(url, data, headers)
     with urllib.request.urlopen(req) as response:
        the_page = response.read()

レスポンスは二つの便利なメソッドも持っています。 *note info と geturl:
57ff. の節を見て下さい、この節は後で問題が起きた場合に見ておくべき内容で
す。

   ---------- Footnotes ----------

   (1) Google を例題にする。

   (2) ブラウザを検知すること (browser sniffing) は web サイトのデザイン
におけるとても悪い習慣です - web 標準を利用する方が賢明でしょう。 不幸な
ことに未だに多くの web サイトが異なるブラウザに対して異なるバージョンを
返しています。

   (3) MSIE 6 のユーザエージェントは ''Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" です。

   (4) HTTP リクエストヘッダの詳細については、 Quick Reference to HTTP
Headers (https://jkorpela.fi/http.html) を参照して下さい。


File: python.info,  Node: 例外を処理する<2>,  Next: info と geturl,  Prev: URL を取得する,  Up: urllib パッケージを使ってインターネット上のリソースを取得するには

9.14.3 例外を処理する
---------------------

'urlopen' raises *note URLError: 2be. when it cannot handle a response
(though as usual with Python APIs, built-in exceptions such as *note
ValueError: 2ec, *note TypeError: 198. etc.  may also be raised).

*note HTTPError: 11e0. is the subclass of *note URLError: 2be. raised in
the specific case of HTTP URLs.

例外クラスは *note urllib.error: 10f. モジュールから提供されています。

* Menu:

* URLError::
* HTTPError::
* エラーをラップする::


File: python.info,  Node: URLError,  Next: HTTPError,  Up: 例外を処理する<2>

9.14.3.1 URLError
.................

URLError が送出されることはよく起こります、それはネットワーク接続が無い
場合や、指定したサーバが無い場合です。この場合、例外は 'reason' 属性を持
っていて、この属性はエラーコードとエラーメッセージのテキストを含むタプル
です。

例:

     >>> req = urllib.request.Request('http://www.pretend_server.org')
     >>> try: urllib.request.urlopen(req)
     ... except urllib.error.URLError as e:
     ...     print(e.reason)
     ...
     (4, 'getaddrinfo failed')


File: python.info,  Node: HTTPError,  Next: エラーをラップする,  Prev: URLError,  Up: 例外を処理する<2>

9.14.3.2 HTTPError
..................

Every HTTP response from the server contains a numeric "status code".
Sometimes the status code indicates that the server is unable to fulfil
the request.  The default handlers will handle some of these responses
for you (for example, if the response is a "redirection" that requests
the client fetch the document from a different URL, urllib will handle
that for you).  For those it can't handle, urlopen will raise an *note
HTTPError: 11e0.  Typical errors include '404' (page not found), '403'
(request forbidden), and '401' (authentication required).

HTTP のエラーコード全てについては RFC 2616(1) の10節を参照して下さい。

The *note HTTPError: 11e0. instance raised will have an integer 'code'
attribute, which corresponds to the error sent by the server.

* Menu:

* エラーコード::

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2616.html


File: python.info,  Node: エラーコード,  Up: HTTPError

9.14.3.3 エラーコード
.....................

デフォルトハンドラーはリダイレクト(コードは300番台にあります) を処理し、
100-299番台のコードは成功を意味しているので、たいていの場合は400-599番台
のエラーコードのみを見るだけですみます。

*note http.server.BaseHTTPRequestHandler.responses: 3faf. is a useful
dictionary of response codes that shows all the response codes used by
RFC 2616(1).  An excerpt from the dictionary is shown below

     responses = {
         ...
         <HTTPStatus.OK: 200>: ('OK', 'Request fulfilled, document follows'),
         ...
         <HTTPStatus.FORBIDDEN: 403>: ('Forbidden',
                                       'Request forbidden -- authorization will '
                                       'not help'),
         <HTTPStatus.NOT_FOUND: 404>: ('Not Found',
                                       'Nothing matches the given URI'),
         ...
         <HTTPStatus.IM_A_TEAPOT: 418>: ("I'm a Teapot",
                                         'Server refuses to brew coffee because '
                                         'it is a teapot'),
         ...
         <HTTPStatus.SERVICE_UNAVAILABLE: 503>: ('Service Unavailable',
                                                 'The server cannot process the '
                                                 'request due to a high load'),
         ...
         }

エラーが起きた場合、サーバーは HTTP エラーコード 'および' エラーページを
返して応答します。 *note HTTPError: 11e0. インスタンスはエラーページのレ
スポンスとして扱えます。これは code 属性だけでなく、 ‘urllib.response’ モ
ジュールが返すような read, geturl, info メソッドも持つことを意味します:

     >>> req = urllib.request.Request('http://www.python.org/fish.html')
     >>> try:
     ...     urllib.request.urlopen(req)
     ... except urllib.error.HTTPError as e:
     ...     print(e.code)
     ...     print(e.read())
     ...
     404
     b'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n\n\n<html
       ...
       <title>Page Not Found</title>\n
       ...

   ---------- Footnotes ----------

   (1) https://datatracker.ietf.org/doc/html/rfc2616.html


File: python.info,  Node: エラーをラップする,  Prev: HTTPError,  Up: 例外を処理する<2>

9.14.3.4 エラーをラップする
...........................

So if you want to be prepared for *note HTTPError: 11e0. 'or' *note
URLError: 2be. there are two basic approaches.  I prefer the second
approach.

* Menu:

* その1::
* その2::


File: python.info,  Node: その1,  Next: その2,  Up: エラーをラップする

9.14.3.5 その1
..............

     from urllib.request import Request, urlopen
     from urllib.error import URLError, HTTPError
     req = Request(someurl)
     try:
         response = urlopen(req)
     except HTTPError as e:
         print('The server couldn\'t fulfill the request.')
         print('Error code: ', e.code)
     except URLError as e:
         print('We failed to reach a server.')
         print('Reason: ', e.reason)
     else:
         # everything is fine

     注釈: The ‘except HTTPError’ 'must' come first, otherwise ‘except
     URLError’ will 'also' catch an *note HTTPError: 11e0.


File: python.info,  Node: その2,  Prev: その1,  Up: エラーをラップする

9.14.3.6 その2
..............

     from urllib.request import Request, urlopen
     from urllib.error import URLError
     req = Request(someurl)
     try:
         response = urlopen(req)
     except URLError as e:
         if hasattr(e, 'reason'):
             print('We failed to reach a server.')
             print('Reason: ', e.reason)
         elif hasattr(e, 'code'):
             print('The server couldn\'t fulfill the request.')
             print('Error code: ', e.code)
     else:
         # everything is fine


File: python.info,  Node: info と geturl,  Next: Openers と Handlers,  Prev: 例外を処理する<2>,  Up: urllib パッケージを使ってインターネット上のリソースを取得するには

9.14.4 info と geturl
---------------------

The response returned by urlopen (or the *note HTTPError: 11e0.
instance) has two useful methods ‘info()’ and ‘geturl()’ and is defined
in the module *note urllib.response: 112.

   * 'geturl' - これは取得したページの実際の URL を返します。 ‘urlopen’
     (または利用される opener オブジェクト) はリダイレクトに追従するため
     、有用です。取得したページの URL は要求した URL と同じとは限りませ
     ん。

   * 'info' - これは取得したページ (特にサーバからヘッダ)を表す辞書風オ
     ブジェクトを返します。これは現在では *note http.client.HTTPMessage:
     3fc8. インスタンスです。

典型的なヘッダは 'Content-length', 'Content-type' 等を含んでいます。
HTTP ヘッダの意味と利用法について簡単な説明つきの便利な一覧 Quick
Reference to HTTP Headers(1) を参照して下さい。

   ---------- Footnotes ----------

   (1) https://jkorpela.fi/http.html


File: python.info,  Node: Openers と Handlers,  Next: Basic 認証,  Prev: info と geturl,  Up: urllib パッケージを使ってインターネット上のリソースを取得するには

9.14.5 Openers と Handlers
--------------------------

URL を取得する場合、opener (混乱を招きやすい名前ですが、 *note
urllib.request.OpenerDirector: 3f18. のインスタンス) を利用します。標準
的にはデフォルトの opener を - ‘urlopen’ を通して - 利用していますが、カ
スタムの opener を作成することもできます。 opener は handler を利用しま
す。全ての「一番厄介な仕事」はハンドラによって行なわれます。各 handler は
特定の URL スキーム (http, ftp, 等) での URL の開き方を知っていたり、
URL を開く局面でどう処理するかを知っています、例えば HTTP リダイレクショ
ンや HTTP のクッキーなど。

インストール済みの特定のハンドラで URL を取得したい場合には、 opener を
作成したいと思うでしょう、例えばクッキーを処理する opener が得たい場合や
、リダイレクションを処理しない opener を得たい場合。

opener を作成するには、 ‘OpenerDirector’ をインスタンス化して、続けて、
‘.add_handler(some_handler_instance)’ を呼び出します。

それに代わる方法として、 ‘build_opener’ を利用することもできます、これは
opener オブジェクトを一回の関数呼び出しで作成できる便利な関数です。
‘build_opener’ はいくつかのハンドラをデフォルトで追加しますが、デフォル
トのハンドラに対して追加、継承のどちらかまたは両方を行うのに手っ取り早い
方法を提供してくれます。

追加したくなる可能性がある handler としては、プロキシ処理、認証など、一
般的ですがいくらか特定の状況に限られるものでしょう。

‘install_opener’ も (グローバルな) デフォルト ‘opener’ オブジェクトの作
成に利用できます。つまり、 ‘urlopen’ を呼び出すと、インストールした
opener が利用されます。

opener オブジェクトは ‘open’ メソッドを持っていて、 ‘urlopen’ 関数と同じ
様に、url を取得するのに直接呼び出すことができます: 利便性を除けば
‘install_opener’ を使う必要はありません。


File: python.info,  Node: Basic 認証,  Next: プロキシ,  Prev: Openers と Handlers,  Up: urllib パッケージを使ってインターネット上のリソースを取得するには

9.14.6 Basic 認証
-----------------

To illustrate creating and installing a handler we will use the
‘HTTPBasicAuthHandler’.  For a more detailed discussion of this subject
- including an explanation of how Basic Authentication works - see the
Basic Authentication Tutorial(1).

認証が必要な場合、サーバは認証を要求するヘッダ (401 のエラーコードととも
に) を送ります。これによって認証スキームと 'realm' が指定されます。ヘッ
ダはこのようになっています: ‘WWW-Authenticate: SCHEME realm="REALM"’ 。

例

     WWW-Authenticate: Basic realm="cPanel Users"

クライアントはリクエストヘッダに含まれる realm に対して適切な名前とパス
ワードとともにリクエストを再試行する必要があります。これが 'basic 認証'
です。一連の流れを簡単化するために、 ‘HTTPBasicAuthHandler’ のインスタン
スを作成し、 opener が handler を利用するようにします。

‘HTTPBasicAuthHandler’ はパスワードマネージャーと呼ばれる、 URL と realm
をパスワードとユーザ名への対応づけを処理する、オブジェクトを利用します。
realm が何なのか(サーバから返される認証ヘッダから) 知りたい場合には、
‘HTTPPasswordMgr’ を利用できます。多くの場合、realm が何なのかについて気
にすることはありません。そのような場合には
‘HTTPPasswordMgrWithDefaultRealm’ を使うと便利です。これは URL に対して
デフォルトのユーザ名とパスワードを指定できます。これによって特定の realm
に対する代替の組み合わせを提供することなしに利用できるようになります。こ
のことは ‘add_password’ メソッドの realm 引数として ‘None’ を与えること
で明示することができます。

トップレベルの URL が認証が必要なはじめに URL です。この URL よりも「深
い」URL を渡しても .add_password() は同様にマッチします。:

     # create a password manager
     password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()

     # Add the username and password.
     # If we knew the realm, we could use it instead of None.
     top_level_url = "http://example.com/foo/"
     password_mgr.add_password(None, top_level_url, username, password)

     handler = urllib.request.HTTPBasicAuthHandler(password_mgr)

     # create "opener" (OpenerDirector instance)
     opener = urllib.request.build_opener(handler)

     # use the opener to fetch a URL
     opener.open(a_url)

     # Install the opener.
     # Now all calls to urllib.request.urlopen use our opener.
     urllib.request.install_opener(opener)

     注釈: In the above example we only supplied our
     ‘HTTPBasicAuthHandler’ to ‘build_opener’.  By default openers have
     the handlers for normal situations - ‘ProxyHandler’ (if a proxy
     setting such as an ‘http_proxy’ environment variable is set),
     ‘UnknownHandler’, ‘HTTPHandler’, ‘HTTPDefaultErrorHandler’,
     ‘HTTPRedirectHandler’, ‘FTPHandler’, ‘FileHandler’, ‘DataHandler’,
     ‘HTTPErrorProcessor’.

‘top_level_url’ は実際には "‘http://example.com/’" のような完全な URL
('http:' スキームとホスト名、オプションとしてポート番号、含む) 'あるいは
' "example.com" や "example.com:8080" (後者はポート番号を含む) のような
"authority" (つまり、ホスト名とオプションとしてポート番号を含む) の 'ど
ちらでも' かまいません。authority の場合には "userinfo" 要素は含んではい
けません - 例えば "joe:password@example.com" は不適切です。

   ---------- Footnotes ----------

   (1) 
https://web.archive.org/web/20201215133350/http://www.voidspace.org.uk/python/articles/authentication.shtml


File: python.info,  Node: プロキシ,  Next: ソケットとレイヤー,  Prev: Basic 認証,  Up: urllib パッケージを使ってインターネット上のリソースを取得するには

9.14.7 プロキシ
---------------

'urllib' は自動でプロキシ設定を認識して使います。これは通常の handler の
組に含まれる ‘ProxyHandler’ を通して行なわれます。たいていの場合はこれで
うまくいきますが、役に立たない場合もあります (1)。この問題に対処する一つ
の方法はプロキシを定義しない ‘ProxyHandler’ を組み立てることです。この方
法は *note Basic Authentication: 5808. handler を設定したときと同じよう
な流れで行うことができます:

     >>> proxy_support = urllib.request.ProxyHandler({})
     >>> opener = urllib.request.build_opener(proxy_support)
     >>> urllib.request.install_opener(opener)

     注釈: 現在 ‘urllib.request’ はプロキシ経由で ‘https’ ロケーションを
     取得する機能をサポートしていません。しかし、urllib.request をこのレ
     シピ (2) で拡張することで可能にすることができます。

     注釈: 変数 ‘REQUEST_METHOD’ が設定されている場合、 ‘HTTP_PROXY’ は
     無視されます; *note getproxies(): 3f15. のドキュメンテーションを参
     照してください。

   ---------- Footnotes ----------

   (1) 私の場合は仕事中にインターネットにアクセスするにはプロキシを利用
する必要があります。'localhost' の URL に対してこのプロキシを経由してア
クセスしようとすれば、ブロックされます。IE を proxy を利用するように設定
すれば、urllib はその情報を利用します。localhost のサーバでスクリプトを
テストしようとすると、urllib がプロキシを利用するのを止めなければいけま
せん。

   (2) urllib opener for SSL proxy (CONNECT method): ASPN Cookbook
Recipe
(https://code.activestate.com/recipes/456195-urrlib2-opener-for-ssl-proxy-connect-method/).


File: python.info,  Node: ソケットとレイヤー,  Next: 脚注,  Prev: プロキシ,  Up: urllib パッケージを使ってインターネット上のリソースを取得するには

9.14.8 ソケットとレイヤー
-------------------------

Web 上からリソースを取得する Python の機能はレイヤー化されています。
urllib は *note http.client: 73. ライブラリを利用していますが、そのライ
ブラリはさらに socket ライブラリを利用しています。

Python 2.3 ではレスポンスがタイムアウトするまでのソケットの待ち時間を指
定することができます。これは web ページを取得する場合に便利に使うことが
できます。socket モジュールのデフォルトでは 'タイムアウトが無く' ハング
してしまうかもしれません。現在では socket のタイムアウトは http.client や
urllib.request のレベルからは隠蔽されていています。しかし、以下を利用す
ることで全てのソケットに対してグローバルにデフォルトタイムアウトを設定す
ることができます

     import socket
     import urllib.request

     # timeout in seconds
     timeout = 10
     socket.setdefaulttimeout(timeout)

     # this call to urllib.request.urlopen now uses the default timeout
     # we have set in the socket module
     req = urllib.request.Request('http://www.voidspace.org.uk')
     response = urllib.request.urlopen(req)

__________________________________________________________________


File: python.info,  Node: 脚注,  Prev: ソケットとレイヤー,  Up: urllib パッケージを使ってインターネット上のリソースを取得するには

9.14.9 脚注
-----------

このドキュメントは John Lee によって査読、改訂されました。


File: python.info,  Node: ipaddressモジュールの紹介,  Next: DTrace と SystemTap で CPython を測定する,  Prev: urllib パッケージを使ってインターネット上のリソースを取得するには,  Up: Python HOWTO

9.15 ipaddressモジュールの紹介
==============================


author: Peter Moody


author: Nick Coghlan

概要
....

このドキュメントは *note ipaddress: 84. モジュールへのやさしい入門を提供
するのが目的です。これは主にまだIPネットワーキングの用語に詳しくないユー
ザーを対象としていますが、*note ipaddress: 84. がどのようにIPネットワー
クアドレス処理の概念を表現しているかをざっと見るのにも役立つかもしれませ
ん。

* Menu:

* アドレス/ネットワーク/インターフェースオブジェクトの作成::
* アドレス/ネットワーク/インターフェースオブジェクト::
* アドレスのリストとしてのネットワーク::
* 比較: 比較<4>.
* 他のモジュールでIPアドレスを使用する::
* インスタンスの生成に失敗した場合にさらに詳細を取得する::


File: python.info,  Node: アドレス/ネットワーク/インターフェースオブジェクトの作成,  Next: アドレス/ネットワーク/インターフェースオブジェクト,  Up: ipaddressモジュールの紹介

9.15.1 アドレス/ネットワーク/インターフェースオブジェクトの作成
---------------------------------------------------------------

*note ipaddress: 84. はIPアドレスを検査したり操作したりするためのモジュ
ールであるため、まずはオブジェクトを作成したほうが良いでしょう。文字列お
よび整数を使用して *note ipaddress: 84. を使用してオブジェクトを作成でき
ます。

* Menu:

* IPバージョンについての注意::
* IPホストアドレス::
* ネットワークを定義する::
* ホストインターフェース::


File: python.info,  Node: IPバージョンについての注意,  Next: IPホストアドレス,  Up: アドレス/ネットワーク/インターフェースオブジェクトの作成

9.15.1.1 IPバージョンについての注意
...................................

IPアドレッシングに詳しくない読者にとっては、インターネットプロトコル
(IP)が現在バージョン4プロトコルからバージョン6へと移行している途中である
ことを知っておくのが重要です。この移行はプロトコルのバージョン4が世界中
の需要に対応するために十分なアドレスを提供できないことが大きな理由で起こ
っており、特にインターネットへ直接接続する機器が増えている状況を踏まえた
ものです。

上述した2つのプロトコルバージョンの違いの詳細を説明するのはこの入門ドキ
ュメントの対象範囲を超えていますが、読者は少なくともこれらの2つのバージ
ョンが存在することと、どちらかのバージョンを強制的に使用することが必要に
なることもあるということを認識する必要があります。


File: python.info,  Node: IPホストアドレス,  Next: ネットワークを定義する,  Prev: IPバージョンについての注意,  Up: アドレス/ネットワーク/インターフェースオブジェクトの作成

9.15.1.2 IPホストアドレス
.........................

アドレスは多くの場合「ホストアドレス」と呼ばれ、IPアドレッシングを扱う場
合の最も基本的な単位です。アドレスを作成する単純な方法は *note
ipaddress.ip_address(): 41ca. ファクトリー関数を使用することで、この方法
では渡された値をもとにIPv4かIPv6アドレスのどちらかを自動的に決定します:

     >>> ipaddress.ip_address('192.0.2.1')
     IPv4Address('192.0.2.1')
     >>> ipaddress.ip_address('2001:DB8::1')
     IPv6Address('2001:db8::1')

アドレスは整数から直接作成することも可能です。32ビットに収まる値はIPv4ア
ドレスであるとみなされます:

     >>> ipaddress.ip_address(3221225985)
     IPv4Address('192.0.2.1')
     >>> ipaddress.ip_address(42540766411282592856903984951653826561)
     IPv6Address('2001:db8::1')

IPv4またはIPv6アドレスの使用を強制するには、適切なクラスを直接呼び出す必
要があります。これは特にIPv6アドレスを小さな整数で作成する場合に役立ちま
す:

     >>> ipaddress.ip_address(1)
     IPv4Address('0.0.0.1')
     >>> ipaddress.IPv4Address(1)
     IPv4Address('0.0.0.1')
     >>> ipaddress.IPv6Address(1)
     IPv6Address('::1')


File: python.info,  Node: ネットワークを定義する,  Next: ホストインターフェース,  Prev: IPホストアドレス,  Up: アドレス/ネットワーク/インターフェースオブジェクトの作成

9.15.1.3 ネットワークを定義する
...............................

ホストアドレスは通常IPネットワークへ統合され、 *note ipaddress: 84. はネ
ットワーク定義の作成、検査、操作の手段を提供します。IPネットワークオブジ
ェクトはネットワークの一部であるホストアドレスの範囲を定義する文字列から
生成されます。この情報の最も単純な形式は「ネットワークアドレス/ネットワ
ークプレフィックス」のペアであり、プレフィックスは先頭のビット数として定
義され、アドレスがネットワークの一部であるかどうか、それらのビットに期待
される値がネットワークアドレスに定義されているかを判断するために比較され
ます。

アドレスについては、正しいIPバージョンを自動的に判断するファクトリー関数
が提供されます:

     >>> ipaddress.ip_network('192.0.2.0/24')
     IPv4Network('192.0.2.0/24')
     >>> ipaddress.ip_network('2001:db8::0/96')
     IPv6Network('2001:db8::/96')

ネットワークオブジェクトにはホストビットを設定することができません。これ
についての実践的な効果は ‘192.0.2.1/24’ がネットワークを表さないというこ
とです。次の項でより詳しく説明しますが、ネットワーク内IP表記は一般的に特
定のネットワーク上のネットワークインターフェースを表すのに使用されるため
、このような定義はインターフェースオブジェクトと呼ばれます。

デフォルトでは、ホストビットセットの指定でネットワークオブジェクトを作成
しようとすると *note ValueError: 2ec. が発生する結果となります。
‘strict=False’ フラグをコンストラクタに渡すと、追加分のビットをゼロとし
て強制的に処理するように要求できます:

     >>> ipaddress.ip_network('192.0.2.1/24')
     Traceback (most recent call last):
        ...
     ValueError: 192.0.2.1/24 has host bits set
     >>> ipaddress.ip_network('192.0.2.1/24', strict=False)
     IPv4Network('192.0.2.0/24')

文字列形式では劇的に柔軟性を提供できる一方、ネットワークはちょうどホスト
アドレスのように整数で定義することもできます。この場合、ネットワークは整
数により特定できる単一のアドレスのみを含むものとして処理され、ネットワー
クプレフィックスはネットワークアドレスの全体を含みます:

     >>> ipaddress.ip_network(3221225984)
     IPv4Network('192.0.2.0/32')
     >>> ipaddress.ip_network(42540766411282592856903984951653826560)
     IPv6Network('2001:db8::/128')

アドレスについては、ファクトリー関数を呼ぶ代わりにクラスコンストラクタを
直接呼ぶことで、作成対象のネットワークを特定の種類に強制することができま
す。


File: python.info,  Node: ホストインターフェース,  Prev: ネットワークを定義する,  Up: アドレス/ネットワーク/インターフェースオブジェクトの作成

9.15.1.4 ホストインターフェース
...............................

直前に述べたように、特定のネットワーク上のアドレスを示したい場合には、ア
ドレスもネットワーククラスも十分ではありません。 ‘192.0.2.1/24’ のような
表記は「 ‘192.0.2.0/24’ のネットワーク上の ‘192.0.2.1’ のホスト」の短縮
形として通常ネットワークエンジニアやファイアウォールやルータ用のツールを
書く人が使用し、 *note ipaddress: 84. はそれに応じて特定のネットワークと
アドレスを関連づけるハイブリッドクラス集を提供します。アドレス部分がネッ
トワークアドレスであることに制限されないことを除き、作成用のインターフェ
ースはネットワーク定義用のインターフェースと同一です。

     >>> ipaddress.ip_interface('192.0.2.1/24')
     IPv4Interface('192.0.2.1/24')
     >>> ipaddress.ip_interface('2001:db8::1/96')
     IPv6Interface('2001:db8::1/96')

整数入力は(ネットワークと同様に)受け入れられ、適切なコンストラクタを直接
呼び出すことで特定のIPバージョンの使用を強制できます。


File: python.info,  Node: アドレス/ネットワーク/インターフェースオブジェクト,  Next: アドレスのリストとしてのネットワーク,  Prev: アドレス/ネットワーク/インターフェースオブジェクトの作成,  Up: ipaddressモジュールの紹介

9.15.2 アドレス/ネットワーク/インターフェースオブジェクト
---------------------------------------------------------

さて、IPv(4|6)(アドレス|ネットワーク|インターフェース)オブジェクトをわざ
わざ作成したので、多分それについて情報がほしいことでしょう。 *note
ipaddress: 84. はこの作業を簡単で直観的にできるようにします。

IPバージョンを抽出する:

     >>> addr4 = ipaddress.ip_address('192.0.2.1')
     >>> addr6 = ipaddress.ip_address('2001:db8::1')
     >>> addr6.version
     6
     >>> addr4.version
     4

インターフェースからネットワークを取得する:

     >>> host4 = ipaddress.ip_interface('192.0.2.1/24')
     >>> host4.network
     IPv4Network('192.0.2.0/24')
     >>> host6 = ipaddress.ip_interface('2001:db8::1/96')
     >>> host6.network
     IPv6Network('2001:db8::/96')

個別なアドレスがいくつネットワークに存在するかを調べる:

     >>> net4 = ipaddress.ip_network('192.0.2.0/24')
     >>> net4.num_addresses
     256
     >>> net6 = ipaddress.ip_network('2001:db8::0/96')
     >>> net6.num_addresses
     4294967296

「使用可能」なネットワーク上のアドレスを順番にたどる:

     >>> net4 = ipaddress.ip_network('192.0.2.0/24')
     >>> for x in net4.hosts():
     ...     print(x)
     192.0.2.1
     192.0.2.2
     192.0.2.3
     192.0.2.4
     ...
     192.0.2.252
     192.0.2.253
     192.0.2.254

ネットマスクを取得(例: ネットワークプレフィックスに応じてビットを設定)し
たりホストマスク(ネットマスクの一部ではない任意のビット)を取得する:

     >>> net4 = ipaddress.ip_network('192.0.2.0/24')
     >>> net4.netmask
     IPv4Address('255.255.255.0')
     >>> net4.hostmask
     IPv4Address('0.0.0.255')
     >>> net6 = ipaddress.ip_network('2001:db8::0/96')
     >>> net6.netmask
     IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff::')
     >>> net6.hostmask
     IPv6Address('::ffff:ffff')

アドレスを展開したり圧縮したりする:

     >>> addr6.exploded
     '2001:0db8:0000:0000:0000:0000:0000:0001'
     >>> addr6.compressed
     '2001:db8::1'
     >>> net6.exploded
     '2001:0db8:0000:0000:0000:0000:0000:0000/96'
     >>> net6.compressed
     '2001:db8::/96'

IPv4は展開や圧縮には対応していませんが、それでも関連したオブジェクトが適
切なプロパティを提供し、バージョンに対して中立なコードがIPv4アドレスを正
しく処理する一方でIPv6向けには最も簡潔または最も詳細な形式が使用されるこ
とを保証します。


File: python.info,  Node: アドレスのリストとしてのネットワーク,  Next: 比較<4>,  Prev: アドレス/ネットワーク/インターフェースオブジェクト,  Up: ipaddressモジュールの紹介

9.15.3 アドレスのリストとしてのネットワーク
-------------------------------------------

ネットワークをリストとして扱うと便利な場合があります。これは、ネットワー
クを次のようにインデックス付けすることが可能なことを意味します:

     >>> net4[1]
     IPv4Address('192.0.2.1')
     >>> net4[-1]
     IPv4Address('192.0.2.255')
     >>> net6[1]
     IPv6Address('2001:db8::1')
     >>> net6[-1]
     IPv6Address('2001:db8::ffff:ffff')

以下のようなリストのメンバーシップの判定用文法が使用可能なように、ネット
ワークオブジェクト自身が適応します:

     if address in network:
         # do something

ネットワークプレフィックスに基づき、所属しているかどうかの判定が効果的に
できます:

     >>> addr4 = ipaddress.ip_address('192.0.2.1')
     >>> addr4 in ipaddress.ip_network('192.0.2.0/24')
     True
     >>> addr4 in ipaddress.ip_network('192.0.3.0/24')
     False


File: python.info,  Node: 比較<4>,  Next: 他のモジュールでIPアドレスを使用する,  Prev: アドレスのリストとしてのネットワーク,  Up: ipaddressモジュールの紹介

9.15.4 比較
-----------

*note ipaddress: 84. はオブジェクトの比較をするための単純で、かつ願わく
ば直観的な方法を意味が通じるように提供します:

     >>> ipaddress.ip_address('192.0.2.1') < ipaddress.ip_address('192.0.2.2')
     True

異なるバージョンや異なるタイプのオブジェクトを比較しようとすると *note
TypeError: 198. 例外が発生します。


File: python.info,  Node: 他のモジュールでIPアドレスを使用する,  Next: インスタンスの生成に失敗した場合にさらに詳細を取得する,  Prev: 比較<4>,  Up: ipaddressモジュールの紹介

9.15.5 他のモジュールでIPアドレスを使用する
-------------------------------------------

IPアドレスを使用する他のモジュール(*note socket: d1. など)は通常このモジ
ュールからオブジェクトを直接受け付けません。直接渡すのではなく、他のモジ
ュールが受け付ける整数や文字列に強制的に変換する必要があります:

     >>> addr4 = ipaddress.ip_address('192.0.2.1')
     >>> str(addr4)
     '192.0.2.1'
     >>> int(addr4)
     3221225985


File: python.info,  Node: インスタンスの生成に失敗した場合にさらに詳細を取得する,  Prev: 他のモジュールでIPアドレスを使用する,  Up: ipaddressモジュールの紹介

9.15.6 インスタンスの生成に失敗した場合にさらに詳細を取得する
-------------------------------------------------------------

上述したバージョンに関知しないファクトリー関数を使用してアドレス/ネット
ワーク/インターフェースオブジェクトを作成する場合、渡された値がそのタイ
プのオブジェクトとして認識されなかったと単純に通知する汎用的なメッセージ
とともに、どのエラーでも *note ValueError: 2ec. として報告されます。特定
のエラーが提供されないのは、拒否された理由をより詳細に提供するために、値
がIPv4またはIPv6である 'はず' かどうかを知る必要があるためです。

追加の詳細を得ると役立つ場合のユースケースに対応するため、個別のクラスの
コンストラクタは実際に *note ValueError: 2ec. のサブクラスである *note
ipaddress.AddressValueError: 41cf. と *note ipaddress.NetmaskValueError:
41f0. を発生させて具体的に定義のどの部分のパースに失敗したのかを示します
。

クラスコンストラクタを直接使用する場合にはこれらのエラーメッセージはさら
に非常に詳細になっています。例えば:

     >>> ipaddress.ip_address("192.168.0.256")
     Traceback (most recent call last):
       ...
     ValueError: '192.168.0.256' does not appear to be an IPv4 or IPv6 address
     >>> ipaddress.IPv4Address("192.168.0.256")
     Traceback (most recent call last):
       ...
     ipaddress.AddressValueError: Octet 256 (> 255) not permitted in '192.168.0.256'

     >>> ipaddress.ip_network("192.168.0.1/64")
     Traceback (most recent call last):
       ...
     ValueError: '192.168.0.1/64' does not appear to be an IPv4 or IPv6 network
     >>> ipaddress.IPv4Network("192.168.0.1/64")
     Traceback (most recent call last):
       ...
     ipaddress.NetmaskValueError: '64' is not a valid netmask

しかし、モジュールについて固有の上記例外のどちらも *note ValueError:
2ec. を親クラスとして持ち、エラーの特定のタイプに興味がない場合でも、以
下のようにコードを記述できます:

     try:
         network = ipaddress.IPv4Network(address)
     except ValueError:
         print('address/netmask is invalid for IPv4:', address)


File: python.info,  Node: DTrace と SystemTap で CPython を測定する,  Next: Python support for the Linux perf profiler,  Prev: ipaddressモジュールの紹介,  Up: Python HOWTO

9.16 DTrace と SystemTap で CPython を測定する
==============================================


author: David Malcolm


author: Łukasz Langa

Dtrace と SystemTap はモニタリングツールで、コンピュータシステムのプロセ
スが何をしているかを調べる方法を提供します。 どちらもドメイン固有言語
(domain-specific language) を使用して、次のことができるスクリプトをユー
ザが書けます:

   - 観測対象のプロセスを絞り込む

   - 関心のあるプロセスからデータを収集する

   - 収集したデータからレポートを生成する

Python 3.6 では、 CPython は "プローブ" としても知られる "マーカー" を埋
め込んだビルドが行えます。 マーカーは DTrace や SystemTap のスクリプトか
ら観測でき、システムの CPython プロセスが何をしているかを観察するのが簡
単になります。

DTrace マーカーは CPython インタプリタの実装詳細です。 CPython のバージ
ョン間でプローブの互換性があるという保証はありません。 CPython のバージ
ョンを変えると、 DTrace スクリプトは警告無しに動作しなくなったり、おかし
な動作をする可能性があります。

* Menu:

* 静的マーカーの有効化::
* 静的 DTrace プローブ::
* 静的 SystemTap マーカー::
* 利用可能な静的マーカー::
* SystemTap Tapset::
* 使用例: 使用例<58>.


File: python.info,  Node: 静的マーカーの有効化,  Next: 静的 DTrace プローブ,  Up: DTrace と SystemTap で CPython を測定する

9.16.1 静的マーカーの有効化
---------------------------

macOS には組み込みの DTrace サポートが備わっています。 Linux では
SystemTap 用のマーカーを埋め込んで CPython をビルドするためには、
SystemTap 開発ツールをインストールしなければなりません。

Linux マシンでは、 SystemTap 開発ツールのインストールは次のように行えま
す:

     $ yum install systemtap-sdt-devel

もしくは:

     $ sudo apt-get install systemtap-sdt-dev

CPython must then be *note configured with the -with-dtrace option:
21a9.:

     checking for --with-dtrace... yes

On macOS, you can list available DTrace probes by running a Python
process in the background and listing all probes made available by the
Python provider:

     $ python3.6 -q &
     $ sudo dtrace -l -P python$!  # or: dtrace -l -m python3.6

        ID   PROVIDER            MODULE                          FUNCTION NAME
     29564 python18035        python3.6          _PyEval_EvalFrameDefault function-entry
     29565 python18035        python3.6             dtrace_function_entry function-entry
     29566 python18035        python3.6          _PyEval_EvalFrameDefault function-return
     29567 python18035        python3.6            dtrace_function_return function-return
     29568 python18035        python3.6                           collect gc-done
     29569 python18035        python3.6                           collect gc-start
     29570 python18035        python3.6          _PyEval_EvalFrameDefault line
     29571 python18035        python3.6                 maybe_dtrace_line line

On Linux, you can verify if the SystemTap static markers are present in
the built binary by seeing if it contains a ".note.stapsdt" section.

     $ readelf -S ./python | grep .note.stapsdt
     [30] .note.stapsdt        NOTE         0000000000000000 00308d78

If you've built Python as a shared library (with the *note
-enable-shared: a63. configure option), you need to look instead within
the shared library.  For example:

     $ readelf -S libpython3.3dm.so.1.0 | grep .note.stapsdt
     [29] .note.stapsdt        NOTE         0000000000000000 00365b68

十分に新しい readelf ではメタデータを出力できます:

     $ readelf -n ./python

     Displaying notes found at file offset 0x00000254 with length 0x00000020:
         Owner                 Data size          Description
         GNU                  0x00000010          NT_GNU_ABI_TAG (ABI version tag)
             OS: Linux, ABI: 2.6.32

     Displaying notes found at file offset 0x00000274 with length 0x00000024:
         Owner                 Data size          Description
         GNU                  0x00000014          NT_GNU_BUILD_ID (unique build ID bitstring)
             Build ID: df924a2b08a7e89f6e11251d4602022977af2670

     Displaying notes found at file offset 0x002d6c30 with length 0x00000144:
         Owner                 Data size          Description
         stapsdt              0x00000031          NT_STAPSDT (SystemTap probe descriptors)
             Provider: python
             Name: gc__start
             Location: 0x00000000004371c3, Base: 0x0000000000630ce2, Semaphore: 0x00000000008d6bf6
             Arguments: -4@%ebx
         stapsdt              0x00000030          NT_STAPSDT (SystemTap probe descriptors)
             Provider: python
             Name: gc__done
             Location: 0x00000000004374e1, Base: 0x0000000000630ce2, Semaphore: 0x00000000008d6bf8
             Arguments: -8@%rax
         stapsdt              0x00000045          NT_STAPSDT (SystemTap probe descriptors)
             Provider: python
             Name: function__entry
             Location: 0x000000000053db6c, Base: 0x0000000000630ce2, Semaphore: 0x00000000008d6be8
             Arguments: 8@%rbp 8@%r12 -4@%eax
         stapsdt              0x00000046          NT_STAPSDT (SystemTap probe descriptors)
             Provider: python
             Name: function__return
             Location: 0x000000000053dba8, Base: 0x0000000000630ce2, Semaphore: 0x00000000008d6bea
             Arguments: 8@%rbp 8@%r12 -4@%eax

The above metadata contains information for SystemTap describing how it
can patch strategically placed machine code instructions to enable the
tracing hooks used by a SystemTap script.


File: python.info,  Node: 静的 DTrace プローブ,  Next: 静的 SystemTap マーカー,  Prev: 静的マーカーの有効化,  Up: DTrace と SystemTap で CPython を測定する

9.16.2 静的 DTrace プローブ
---------------------------

The following example DTrace script can be used to show the call/return
hierarchy of a Python script, only tracing within the invocation of a
function called "start".  In other words, import-time function
invocations are not going to be listed:

     self int indent;

     python$target:::function-entry
     /copyinstr(arg1) == "start"/
     {
             self->trace = 1;
     }

     python$target:::function-entry
     /self->trace/
     {
             printf("%d\t%*s:", timestamp, 15, probename);
             printf("%*s", self->indent, "");
             printf("%s:%s:%d\n", basename(copyinstr(arg0)), copyinstr(arg1), arg2);
             self->indent++;
     }

     python$target:::function-return
     /self->trace/
     {
             self->indent--;
             printf("%d\t%*s:", timestamp, 15, probename);
             printf("%*s", self->indent, "");
             printf("%s:%s:%d\n", basename(copyinstr(arg0)), copyinstr(arg1), arg2);
     }

     python$target:::function-return
     /copyinstr(arg1) == "start"/
     {
             self->trace = 0;
     }

この例は次のように実行できます:

     $ sudo dtrace -q -s call_stack.d -c "python3.6 script.py"

出力はこのようになります:

     156641360502280  function-entry:call_stack.py:start:23
     156641360518804  function-entry: call_stack.py:function_1:1
     156641360532797  function-entry:  call_stack.py:function_3:9
     156641360546807 function-return:  call_stack.py:function_3:10
     156641360563367 function-return: call_stack.py:function_1:2
     156641360578365  function-entry: call_stack.py:function_2:5
     156641360591757  function-entry:  call_stack.py:function_1:1
     156641360605556  function-entry:   call_stack.py:function_3:9
     156641360617482 function-return:   call_stack.py:function_3:10
     156641360629814 function-return:  call_stack.py:function_1:2
     156641360642285 function-return: call_stack.py:function_2:6
     156641360656770  function-entry: call_stack.py:function_3:9
     156641360669707 function-return: call_stack.py:function_3:10
     156641360687853  function-entry: call_stack.py:function_4:13
     156641360700719 function-return: call_stack.py:function_4:14
     156641360719640  function-entry: call_stack.py:function_5:18
     156641360732567 function-return: call_stack.py:function_5:21
     156641360747370 function-return:call_stack.py:start:28


File: python.info,  Node: 静的 SystemTap マーカー,  Next: 利用可能な静的マーカー,  Prev: 静的 DTrace プローブ,  Up: DTrace と SystemTap で CPython を測定する

9.16.3 静的 SystemTap マーカー
------------------------------

The low-level way to use the SystemTap integration is to use the static
markers directly.  This requires you to explicitly state the binary file
containing them.

例えば、この SystemTap スクリプトは Python の呼び出し/返却 (call/return)
階層を表示するのに使えます:

     probe process("python").mark("function__entry") {
          filename = user_string($arg1);
          funcname = user_string($arg2);
          lineno = $arg3;

          printf("%s => %s in %s:%d\\n",
                 thread_indent(1), funcname, filename, lineno);
     }

     probe process("python").mark("function__return") {
         filename = user_string($arg1);
         funcname = user_string($arg2);
         lineno = $arg3;

         printf("%s <= %s in %s:%d\\n",
                thread_indent(-1), funcname, filename, lineno);
     }

この例は次のように実行できます:

     $ stap \
       show-call-hierarchy.stp \
       -c "./python test.py"

出力はこのようになります:

     11408 python(8274):        => __contains__ in Lib/_abcoll.py:362
     11414 python(8274):         => __getitem__ in Lib/os.py:425
     11418 python(8274):          => encode in Lib/os.py:490
     11424 python(8274):          <= encode in Lib/os.py:493
     11428 python(8274):         <= __getitem__ in Lib/os.py:426
     11433 python(8274):        <= __contains__ in Lib/_abcoll.py:366

それぞれの列の内容は次の通りです:

   - スクリプトを起動してからのマイクロ秒単位の時間

   - 実行可能ファイルの名前

   - プロセスの PID

そして、残りの部分はスクリプトが実行していた呼び出し/返却階層を表示して
います。

For a *note -enable-shared: a63. build of CPython, the markers are
contained within the libpython shared library, and the probe's dotted
path needs to reflect this.  For example, this line from the above
example:

     probe process("python").mark("function__entry") {

should instead read:

     probe process("python").library("libpython3.6dm.so.1.0").mark("function__entry") {

(assuming a *note debug build: 509. of CPython 3.6)


File: python.info,  Node: 利用可能な静的マーカー,  Next: SystemTap Tapset,  Prev: 静的 SystemTap マーカー,  Up: DTrace と SystemTap で CPython を測定する

9.16.4 利用可能な静的マーカー
-----------------------------

 -- Object: function__entry(str filename, str funcname, int lineno)

     このマーカーは Python の関数の実行が開始されたことを示しています。
     このマーカーは、ピュア Python (バイトコード) の関数でしか起動されま
     せん。

     トレーススクリプトには位置引数として、ファイル名、関数名、行番号が
     渡され、必ず ‘$arg1’, ‘$arg2’, ‘$arg3’ で渡されます:

             * ‘$arg1’ : ‘(const char *)’ ファイル名、
               ‘user_string($arg1)’ でアクセスできます

             * ‘$arg2’ : ‘(const char *)’ 関数名、 ‘user_string($arg2)’
               でアクセスできます

             * ‘$arg3’ : ‘int’ 行番号

 -- Object: function__return(str filename, str funcname, int lineno)

     This marker is the converse of ‘function__entry()’, and indicates
     that execution of a Python function has ended (either via ‘return’,
     or via an exception).  It is only triggered for pure-Python
     (bytecode) functions.

     The arguments are the same as for ‘function__entry()’

 -- Object: line(str filename, str funcname, int lineno)

     このマーカーは、これから実行される Python の行を示しています。 これ
     は Python プロファイラによる行ごとのトレースと同等です。 このマーカ
     ーは C 関数の内部では起動されません。

     The arguments are the same as for ‘function__entry()’.

 -- Object: gc__start(int generation)

     Fires when the Python interpreter starts a garbage collection
     cycle.  ‘arg0’ is the generation to scan, like *note gc.collect():
     1b3.

 -- Object: gc__done(long collected)

     Python インタプリタによる循環参照のガベージコレクションが完了したと
     きに発火します。 ‘arg0’ は回収したオブジェクトの数です。

 -- Object: import__find__load__start(str modulename)

     Fires before *note importlib: 7b. attempts to find and load the
     module.  ‘arg0’ is the module name.

     Added in version 3.7.

 -- Object: import__find__load__done(str modulename, int found)

     Fires after *note importlib: 7b.'s find_and_load function is
     called.  ‘arg0’ is the module name, ‘arg1’ indicates if module was
     successfully loaded.

     Added in version 3.7.

 -- Object: audit(str event, void *tuple)

     Fires when *note sys.audit(): 191b. or *note PySys_Audit(): 613. is
     called.  ‘arg0’ is the event name as C string, ‘arg1’ is a *note
     PyObject: 5df. pointer to a tuple object.

     Added in version 3.8.


File: python.info,  Node: SystemTap Tapset,  Next: 使用例<58>,  Prev: 利用可能な静的マーカー,  Up: DTrace と SystemTap で CPython を測定する

9.16.5 SystemTap Tapset
-----------------------

The higher-level way to use the SystemTap integration is to use a
"tapset": SystemTap's equivalent of a library, which hides some of the
lower-level details of the static markers.

Here is a tapset file, based on a non-shared build of CPython:

     /*
        Provide a higher-level wrapping around the function__entry and
        function__return markers:
      \*/
     probe python.function.entry = process("python").mark("function__entry")
     {
         filename = user_string($arg1);
         funcname = user_string($arg2);
         lineno = $arg3;
         frameptr = $arg4
     }
     probe python.function.return = process("python").mark("function__return")
     {
         filename = user_string($arg1);
         funcname = user_string($arg2);
         lineno = $arg3;
         frameptr = $arg4
     }

If this file is installed in SystemTap's tapset directory (e.g.
‘/usr/share/systemtap/tapset’), then these additional probepoints become
available:

 -- Object: python.function.entry(str filename, str funcname, int
          lineno, frameptr)

     This probe point indicates that execution of a Python function has
     begun.  It is only triggered for pure-Python (bytecode) functions.

 -- Object: python.function.return(str filename, str funcname, int
          lineno, frameptr)

     This probe point is the converse of ‘python.function.return’, and
     indicates that execution of a Python function has ended (either via
     ‘return’, or via an exception).  It is only triggered for
     pure-Python (bytecode) functions.


File: python.info,  Node: 使用例<58>,  Prev: SystemTap Tapset,  Up: DTrace と SystemTap で CPython を測定する

9.16.6 使用例
-------------

This SystemTap script uses the tapset above to more cleanly implement
the example given above of tracing the Python function-call hierarchy,
without needing to directly name the static markers:

     probe python.function.entry
     {
       printf("%s => %s in %s:%d\n",
              thread_indent(1), funcname, filename, lineno);
     }

     probe python.function.return
     {
       printf("%s <= %s in %s:%d\n",
              thread_indent(-1), funcname, filename, lineno);
     }

The following script uses the tapset above to provide a top-like view of
all running CPython code, showing the top 20 most frequently entered
bytecode frames, each second, across the whole system:

     global fn_calls;

     probe python.function.entry
     {
         fn_calls[pid(), filename, funcname, lineno] += 1;
     }

     probe timer.ms(1000) {
         printf("\033[2J\033[1;1H") /* clear screen \*/
         printf("%6s %80s %6s %30s %6s\n",
                "PID", "FILENAME", "LINE", "FUNCTION", "CALLS")
         foreach ([pid, filename, funcname, lineno] in fn_calls- limit 20) {
             printf("%6d %80s %6d %30s %6d\n",
                 pid, filename, lineno, funcname,
                 fn_calls[pid, filename, funcname, lineno]);
         }
         delete fn_calls;
     }


File: python.info,  Node: Python support for the Linux perf profiler,  Next: Annotations Best Practices,  Prev: DTrace と SystemTap で CPython を測定する,  Up: Python HOWTO

9.17 Python support for the Linux ‘perf’ profiler
=================================================


author: Pablo Galindo

The Linux perf profiler(1) is a very powerful tool that allows you to
profile and obtain information about the performance of your
application.  ‘perf’ also has a very vibrant ecosystem of tools that aid
with the analysis of the data that it produces.

The main problem with using the ‘perf’ profiler with Python applications
is that ‘perf’ only gets information about native symbols, that is, the
names of functions and procedures written in C. This means that the
names and file names of Python functions in your code will not appear in
the output of ‘perf’.

Since Python 3.12, the interpreter can run in a special mode that allows
Python functions to appear in the output of the ‘perf’ profiler.  When
this mode is enabled, the interpreter will interpose a small piece of
code compiled on the fly before the execution of every Python function
and it will teach ‘perf’ the relationship between this piece of code and
the associated Python function using *note perf map files: 5272.

     注釈: Support for the ‘perf’ profiler is currently only available
     for Linux on select architectures.  Check the output of the
     ‘configure’ build step or check the output of ‘python -m sysconfig
     | grep HAVE_PERF_TRAMPOLINE’ to see if your system is supported.

For example, consider the following script:

     def foo(n):
         result = 0
         for _ in range(n):
             result += 1
         return result

     def bar(n):
         foo(n)

     def baz(n):
         bar(n)

     if __name__ == "__main__":
         baz(1000000)

We can run ‘perf’ to sample CPU stack traces at 9999 hertz:

     $ perf record -F 9999 -g -o perf.data python my_script.py

Then we can use ‘perf report’ to analyze the data:

     $ perf report --stdio -n -g

     # Children      Self       Samples  Command     Shared Object       Symbol
     # ........  ........  ............  ..........  ..................  ..........................................
     #
         91.08%     0.00%             0  python.exe  python.exe          [.] _start
                 |
                 ---_start
                 |
                     --90.71%--__libc_start_main
                             Py_BytesMain
                             |
                             |--56.88%--pymain_run_python.constprop.0
                             |          |
                             |          |--56.13%--_PyRun_AnyFileObject
                             |          |          _PyRun_SimpleFileObject
                             |          |          |
                             |          |          |--55.02%--run_mod
                             |          |          |          |
                             |          |          |           --54.65%--PyEval_EvalCode
                             |          |          |                     _PyEval_EvalFrameDefault
                             |          |          |                     PyObject_Vectorcall
                             |          |          |                     _PyEval_Vector
                             |          |          |                     _PyEval_EvalFrameDefault
                             |          |          |                     PyObject_Vectorcall
                             |          |          |                     _PyEval_Vector
                             |          |          |                     _PyEval_EvalFrameDefault
                             |          |          |                     PyObject_Vectorcall
                             |          |          |                     _PyEval_Vector
                             |          |          |                     |
                             |          |          |                     |--51.67%--_PyEval_EvalFrameDefault
                             |          |          |                     |          |
                             |          |          |                     |          |--11.52%--_PyLong_Add
                             |          |          |                     |          |          |
                             |          |          |                     |          |          |--2.97%--_PyObject_Malloc
     ...

As you can see, the Python functions are not shown in the output, only
‘_PyEval_EvalFrameDefault’ (the function that evaluates the Python
bytecode) shows up.  Unfortunately that's not very useful because all
Python functions use the same C function to evaluate bytecode so we
cannot know which Python function corresponds to which
bytecode-evaluating function.

Instead, if we run the same experiment with ‘perf’ support enabled we
get:

     $ perf report --stdio -n -g

     # Children      Self       Samples  Command     Shared Object       Symbol
     # ........  ........  ............  ..........  ..................  .....................................................................
     #
         90.58%     0.36%             1  python.exe  python.exe          [.] _start
                 |
                 ---_start
                 |
                     --89.86%--__libc_start_main
                             Py_BytesMain
                             |
                             |--55.43%--pymain_run_python.constprop.0
                             |          |
                             |          |--54.71%--_PyRun_AnyFileObject
                             |          |          _PyRun_SimpleFileObject
                             |          |          |
                             |          |          |--53.62%--run_mod
                             |          |          |          |
                             |          |          |           --53.26%--PyEval_EvalCode
                             |          |          |                     py::<module>:/src/script.py
                             |          |          |                     _PyEval_EvalFrameDefault
                             |          |          |                     PyObject_Vectorcall
                             |          |          |                     _PyEval_Vector
                             |          |          |                     py::baz:/src/script.py
                             |          |          |                     _PyEval_EvalFrameDefault
                             |          |          |                     PyObject_Vectorcall
                             |          |          |                     _PyEval_Vector
                             |          |          |                     py::bar:/src/script.py
                             |          |          |                     _PyEval_EvalFrameDefault
                             |          |          |                     PyObject_Vectorcall
                             |          |          |                     _PyEval_Vector
                             |          |          |                     py::foo:/src/script.py
                             |          |          |                     |
                             |          |          |                     |--51.81%--_PyEval_EvalFrameDefault
                             |          |          |                     |          |
                             |          |          |                     |          |--13.77%--_PyLong_Add
                             |          |          |                     |          |          |
                             |          |          |                     |          |          |--3.26%--_PyObject_Malloc

* Menu:

* How to enable perf profiling support::
* How to obtain the best results::
* How to work without frame pointers::

   ---------- Footnotes ----------

   (1) https://perf.wiki.kernel.org


File: python.info,  Node: How to enable perf profiling support,  Next: How to obtain the best results,  Up: Python support for the Linux perf profiler

9.17.1 How to enable ‘perf’ profiling support
---------------------------------------------

‘perf’ profiling support can be enabled either from the start using the
environment variable *note PYTHONPERFSUPPORT: 699. or the *note -X perf:
16f. option, or dynamically using *note sys.activate_stack_trampoline():
69a. and *note sys.deactivate_stack_trampoline(): 69b.

The ‘sys’ functions take precedence over the ‘-X’ option, the ‘-X’
option takes precedence over the environment variable.

Example, using the environment variable:

     $ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python my_script.py
     $ perf report -g -i perf.data

Example, using the ‘-X’ option:

     $ perf record -F 9999 -g -o perf.data python -X perf my_script.py
     $ perf report -g -i perf.data

Example, using the *note sys: df. APIs in file ‘example.py’:

     import sys

     sys.activate_stack_trampoline("perf")
     do_profiled_stuff()
     sys.deactivate_stack_trampoline()

     non_profiled_stuff()

...then:

     $ perf record -F 9999 -g -o perf.data python ./example.py
     $ perf report -g -i perf.data


File: python.info,  Node: How to obtain the best results,  Next: How to work without frame pointers,  Prev: How to enable perf profiling support,  Up: Python support for the Linux perf profiler

9.17.2 How to obtain the best results
-------------------------------------

For best results, Python should be compiled with
‘CFLAGS="-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"’ as this
allows profilers to unwind using only the frame pointer and not on DWARF
debug information.  This is because as the code that is interposed to
allow ‘perf’ support is dynamically generated it doesn't have any DWARF
debugging information available.

You can check if your system has been compiled with this flag by
running:

     $ python -m sysconfig | grep 'no-omit-frame-pointer'

If you don't see any output it means that your interpreter has not been
compiled with frame pointers and therefore it may not be able to show
Python functions in the output of ‘perf’.


File: python.info,  Node: How to work without frame pointers,  Prev: How to obtain the best results,  Up: Python support for the Linux perf profiler

9.17.3 How to work without frame pointers
-----------------------------------------

If you are working with a Python interpreter that has been compiled
without frame pointers, you can still use the ‘perf’ profiler, but the
overhead will be a bit higher because Python needs to generate unwinding
information for every Python function call on the fly.  Additionally,
‘perf’ will take more time to process the data because it will need to
use the DWARF debugging information to unwind the stack and this is a
slow process.

To enable this mode, you can use the environment variable *note
PYTHON_PERF_JIT_SUPPORT: 4af. or the *note -X perf_jit: 16f. option,
which will enable the JIT mode for the ‘perf’ profiler.

     注釈: Due to a bug in the ‘perf’ tool, only ‘perf’ versions higher
     than v6.8 will work with the JIT mode.  The fix was also backported
     to the v6.7.2 version of the tool.

     Note that when checking the version of the ‘perf’ tool (which can
     be done by running ‘perf version’) you must take into account that
     some distros add some custom version numbers including a ‘-’
     character.  This means that ‘perf 6.7-3’ is not necessarily ‘perf
     6.7.3’.

When using the perf JIT mode, you need an extra step before you can run
‘perf report’.  You need to call the ‘perf inject’ command to inject the
JIT information into the ‘perf.data’ file.:

     $ perf record -F 9999 -g -k 1 --call-graph dwarf -o perf.data python -Xperf_jit my_script.py
     $ perf inject -i perf.data --jit --output perf.jit.data
     $ perf report -g -i perf.jit.data

or using the environment variable:

     $ PYTHON_PERF_JIT_SUPPORT=1 perf record -F 9999 -g --call-graph dwarf -o perf.data python my_script.py
     $ perf inject -i perf.data --jit --output perf.jit.data
     $ perf report -g -i perf.jit.data

‘perf inject --jit’ command will read ‘perf.data’, automatically pick up
the perf dump file that Python creates (in ‘/tmp/perf-$PID.dump’), and
then create ‘perf.jit.data’ which merges all the JIT information
together.  It should also create a lot of ‘jitted-XXXX-N.so’ files in
the current directory which are ELF images for all the JIT trampolines
that were created by Python.

     警告: When using ‘--call-graph dwarf’, the ‘perf’ tool will take
     snapshots of the stack of the process being profiled and save the
     information in the ‘perf.data’ file.  By default, the size of the
     stack dump is 8192 bytes, but you can change the size by passing it
     after a comma like ‘--call-graph dwarf,16384’.

     The size of the stack dump is important because if the size is too
     small ‘perf’ will not be able to unwind the stack and the output
     will be incomplete.  On the other hand, if the size is too big,
     then ‘perf’ won't be able to sample the process as frequently as it
     would like as the overhead will be higher.

     The stack size is particularly important when profiling Python code
     compiled with low optimization levels (like ‘-O0’), as these builds
     tend to have larger stack frames.  If you are compiling Python with
     ‘-O0’ and not seeing Python functions in your profiling output, try
     increasing the stack dump size to 65528 bytes (the maximum):

          $ perf record -F 9999 -g -k 1 --call-graph dwarf,65528 -o perf.data python -Xperf_jit my_script.py

     Different compilation flags can significantly impact stack sizes:

        - Builds with ‘-O0’ typically have much larger stack frames than
          those with ‘-O1’ or higher

        - Adding optimizations (‘-O1’, ‘-O2’, etc.)  typically reduces
          stack size

        - Frame pointers (‘-fno-omit-frame-pointer’) generally provide
          more reliable stack unwinding


File: python.info,  Node: Annotations Best Practices,  Next: 拡張モジュールを分離する,  Prev: Python support for the Linux perf profiler,  Up: Python HOWTO

9.18 Annotations Best Practices
===============================


author: Larry Hastings

概要
....

This document is designed to encapsulate the best practices for working
with annotations dicts.  If you write Python code that examines
‘__annotations__’ on Python objects, we encourage you to follow the
guidelines described below.

The document is organized into four sections: best practices for
accessing the annotations of an object in Python versions 3.10 and
newer, best practices for accessing the annotations of an object in
Python versions 3.9 and older, other best practices for
‘__annotations__’ that apply to any Python version, and quirks of
‘__annotations__’.

Note that this document is specifically about working with
‘__annotations__’, not uses 'for' annotations.  If you're looking for
information on how to use "type hints" in your code, please see the
*note typing: 10a. module.

* Menu:

* Accessing The Annotations Dict Of An Object In Python 3.10 And Newer: Accessing The Annotations Dict Of An Object In Python 3 10 And Newer.
* Accessing The Annotations Dict Of An Object In Python 3.9 And Older: Accessing The Annotations Dict Of An Object In Python 3 9 And Older.
* Manually Un-Stringizing Stringized Annotations::
* Best Practices For __annotations__ In Any Python Version::
* __annotations__ Quirks::


File: python.info,  Node: Accessing The Annotations Dict Of An Object In Python 3 10 And Newer,  Next: Accessing The Annotations Dict Of An Object In Python 3 9 And Older,  Up: Annotations Best Practices

9.18.1 Accessing The Annotations Dict Of An Object In Python 3.10 And Newer
---------------------------------------------------------------------------

Python 3.10 adds a new function to the standard library: *note
inspect.get_annotations(): a14.  In Python versions 3.10 through 3.13,
calling this function is the best practice for accessing the annotations
dict of any object that supports annotations.  This function can also
"un-stringize" stringized annotations for you.

In Python 3.14, there is a new *note annotationlib: 6. module with
functionality for working with annotations.  This includes a *note
annotationlib.get_annotations(): 459. function, which supersedes *note
inspect.get_annotations(): a14.

If for some reason *note inspect.get_annotations(): a14. isn't viable
for your use case, you may access the ‘__annotations__’ data member
manually.  Best practice for this changed in Python 3.10 as well: as of
Python 3.10, ‘o.__annotations__’ is guaranteed to 'always' work on
Python functions, classes, and modules.  If you're certain the object
you're examining is one of these three 'specific' objects, you may
simply use ‘o.__annotations__’ to get at the object's annotations dict.

However, other types of callables-for example, callables created by
*note functools.partial(): 217.-may not have an ‘__annotations__’
attribute defined.  When accessing the ‘__annotations__’ of a possibly
unknown object, best practice in Python versions 3.10 and newer is to
call *note getattr(): dca. with three arguments, for example ‘getattr(o,
'__annotations__', None)’.

Before Python 3.10, accessing ‘__annotations__’ on a class that defines
no annotations but that has a parent class with annotations would return
the parent's ‘__annotations__’.  In Python 3.10 and newer, the child
class's annotations will be an empty dict instead.


File: python.info,  Node: Accessing The Annotations Dict Of An Object In Python 3 9 And Older,  Next: Manually Un-Stringizing Stringized Annotations,  Prev: Accessing The Annotations Dict Of An Object In Python 3 10 And Newer,  Up: Annotations Best Practices

9.18.2 Accessing The Annotations Dict Of An Object In Python 3.9 And Older
--------------------------------------------------------------------------

In Python 3.9 and older, accessing the annotations dict of an object is
much more complicated than in newer versions.  The problem is a design
flaw in these older versions of Python, specifically to do with class
annotations.

Best practice for accessing the annotations dict of other
objects-functions, other callables, and modules-is the same as best
practice for 3.10, assuming you aren't calling *note
inspect.get_annotations(): a14.: you should use three-argument *note
getattr(): dca. to access the object's ‘__annotations__’ attribute.

Unfortunately, this isn't best practice for classes.  The problem is
that, since ‘__annotations__’ is optional on classes, and because
classes can inherit attributes from their base classes, accessing the
‘__annotations__’ attribute of a class may inadvertently return the
annotations dict of a 'base class.'  As an example:

     class Base:
         a: int = 3
         b: str = 'abc'

     class Derived(Base):
         pass

     print(Derived.__annotations__)

This will print the annotations dict from ‘Base’, not ‘Derived’.

Your code will have to have a separate code path if the object you're
examining is a class (‘isinstance(o, type)’).  In that case, best
practice relies on an implementation detail of Python 3.9 and before: if
a class has annotations defined, they are stored in the class's *note
__dict__: e57. dictionary.  Since the class may or may not have
annotations defined, best practice is to call the *note get(): 2034.
method on the class dict.

To put it all together, here is some sample code that safely accesses
the ‘__annotations__’ attribute on an arbitrary object in Python 3.9 and
before:

     if isinstance(o, type):
         ann = o.__dict__.get('__annotations__', None)
     else:
         ann = getattr(o, '__annotations__', None)

After running this code, ‘ann’ should be either a dictionary or ‘None’.
You're encouraged to double-check the type of ‘ann’ using *note
isinstance(): 2ad. before further examination.

Note that some exotic or malformed type objects may not have a *note
__dict__: e57. attribute, so for extra safety you may also wish to use
*note getattr(): dca. to access ‘__dict__’.


File: python.info,  Node: Manually Un-Stringizing Stringized Annotations,  Next: Best Practices For __annotations__ In Any Python Version,  Prev: Accessing The Annotations Dict Of An Object In Python 3 9 And Older,  Up: Annotations Best Practices

9.18.3 Manually Un-Stringizing Stringized Annotations
-----------------------------------------------------

In situations where some annotations may be "stringized", and you wish
to evaluate those strings to produce the Python values they represent,
it really is best to call *note inspect.get_annotations(): a14. to do
this work for you.

If you're using Python 3.9 or older, or if for some reason you can't use
*note inspect.get_annotations(): a14, you'll need to duplicate its
logic.  You're encouraged to examine the implementation of *note
inspect.get_annotations(): a14. in the current Python version and follow
a similar approach.

In a nutshell, if you wish to evaluate a stringized annotation on an
arbitrary object ‘o’:

   * If ‘o’ is a module, use ‘o.__dict__’ as the ‘globals’ when calling
     *note eval(): 4a3.

   * If ‘o’ is a class, use ‘sys.modules[o.__module__].__dict__’ as the
     ‘globals’, and ‘dict(vars(o))’ as the ‘locals’, when calling *note
     eval(): 4a3.

   * If ‘o’ is a wrapped callable using *note
     functools.update_wrapper(): 1223, *note functools.wraps(): 115f, or
     *note functools.partial(): 217, iteratively unwrap it by accessing
     either ‘o.__wrapped__’ or ‘o.func’ as appropriate, until you have
     found the root unwrapped function.

   * If ‘o’ is a callable (but not a class), use *note o.__globals__:
     14eb. as the globals when calling *note eval(): 4a3.

However, not all string values used as annotations can be successfully
turned into Python values by *note eval(): 4a3.  String values could
theoretically contain any valid string, and in practice there are valid
use cases for type hints that require annotating with string values that
specifically 'can't' be evaluated.  For example:

   * PEP 604(1) union types using ‘|’, before support for this was added
     to Python 3.10.

   * Definitions that aren't needed at runtime, only imported when *note
     typing.TYPE_CHECKING: ef0. is true.

If *note eval(): 4a3. attempts to evaluate such values, it will fail and
raise an exception.  So, when designing a library API that works with
annotations, it's recommended to only attempt to evaluate string values
when explicitly requested to by the caller.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0604/


File: python.info,  Node: Best Practices For __annotations__ In Any Python Version,  Next: __annotations__ Quirks,  Prev: Manually Un-Stringizing Stringized Annotations,  Up: Annotations Best Practices

9.18.4 Best Practices For ‘__annotations__’ In Any Python Version
-----------------------------------------------------------------

   * You should avoid assigning to the ‘__annotations__’ member of
     objects directly.  Let Python manage setting ‘__annotations__’.

   * If you do assign directly to the ‘__annotations__’ member of an
     object, you should always set it to a ‘dict’ object.

   * You should avoid accessing ‘__annotations__’ directly on any
     object.  Instead, use *note annotationlib.get_annotations(): 459.
     (Python 3.14+) or *note inspect.get_annotations(): a14. (Python
     3.10+).

   * If you do directly access the ‘__annotations__’ member of an
     object, you should ensure that it's a dictionary before attempting
     to examine its contents.

   * You should avoid modifying ‘__annotations__’ dicts.

   * You should avoid deleting the ‘__annotations__’ attribute of an
     object.


File: python.info,  Node: __annotations__ Quirks,  Prev: Best Practices For __annotations__ In Any Python Version,  Up: Annotations Best Practices

9.18.5 ‘__annotations__’ Quirks
-------------------------------

In all versions of Python 3, function objects lazy-create an annotations
dict if no annotations are defined on that object.  You can delete the
‘__annotations__’ attribute using ‘del fn.__annotations__’, but if you
then access ‘fn.__annotations__’ the object will create a new empty dict
that it will store and return as its annotations.  Deleting the
annotations on a function before it has lazily created its annotations
dict will throw an ‘AttributeError’; using ‘del fn.__annotations__’
twice in a row is guaranteed to always throw an ‘AttributeError’.

Everything in the above paragraph also applies to class and module
objects in Python 3.10 and newer.

In all versions of Python 3, you can set ‘__annotations__’ on a function
object to ‘None’.  However, subsequently accessing the annotations on
that object using ‘fn.__annotations__’ will lazy-create an empty
dictionary as per the first paragraph of this section.  This is 'not'
true of modules and classes, in any Python version; those objects permit
setting ‘__annotations__’ to any Python value, and will retain whatever
value is set.

If Python stringizes your annotations for you (using ‘from __future__
import annotations’), and you specify a string as an annotation, the
string will itself be quoted.  In effect the annotation is quoted
'twice.'  For example:

     from __future__ import annotations
     def foo(a: "str"): pass

     print(foo.__annotations__)

This prints ‘{'a': "'str'"}’.  This shouldn't really be considered a
"quirk"; it's mentioned here simply because it might be surprising.

If you use a class with a custom metaclass and access ‘__annotations__’
on the class, you may observe unexpected behavior; see 749(1) for some
examples.  You can avoid these quirks by using *note
annotationlib.get_annotations(): 459. on Python 3.14+ or *note
inspect.get_annotations(): a14. on Python 3.10+.  On earlier versions of
Python, you can avoid these bugs by accessing the annotations from the
class's *note __dict__: e57. (for example,
‘cls.__dict__.get('__annotations__', None)’).

In some versions of Python, instances of classes may have an
‘__annotations__’ attribute.  However, this is not supported
functionality.  If you need the annotations of an instance, you can use
*note type(): f44. to access its class (for example,
‘annotationlib.get_annotations(type(myinstance))’ on Python 3.14+).

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0749/#pep749-metaclasses


File: python.info,  Node: 拡張モジュールを分離する,  Next: timer file descriptor HOWTO,  Prev: Annotations Best Practices,  Up: Python HOWTO

9.19 拡張モジュールを分離する
=============================

概要
....

Traditionally, state belonging to Python extension modules was kept in C
‘static’ variables, which have process-wide scope.  This document
describes problems of such per-process state and shows a safer way:
per-module state.

The document also describes how to switch to per-module state where
possible.  This transition involves allocating space for that state,
potentially switching from static types to heap types, and—perhaps most
importantly—accessing per-module state from code.

* Menu:

* Who should read this::
* 背景: 背景<2>.
* Making Modules Safe with Multiple Interpreters::
* Heap Types: Heap Types<2>.
* 取り掛かり中の問題::


File: python.info,  Node: Who should read this,  Next: 背景<2>,  Up: 拡張モジュールを分離する

9.19.1 Who should read this
---------------------------

This guide is written for maintainers of *note C-API: 1fbe. extensions
who would like to make that extension safer to use in applications where
Python itself is used as a library.


File: python.info,  Node: 背景<2>,  Next: Making Modules Safe with Multiple Interpreters,  Prev: Who should read this,  Up: 拡張モジュールを分離する

9.19.2 背景
-----------

An 'interpreter' is the context in which Python code runs.  It contains
configuration (e.g.  the import path) and runtime state (e.g.  the set
of imported modules).

Python supports running multiple interpreters in one process.  There are
two cases to think about—users may run interpreters:

   - in sequence, with several *note Py_InitializeEx(): 5133./*note
     Py_FinalizeEx(): f11. cycles, and

   - in parallel, managing "sub-interpreters" using *note
     Py_NewInterpreter(): 1b31./*note Py_EndInterpreter(): 1845.

Both cases (and combinations of them) would be most useful when
embedding Python within a library.  Libraries generally shouldn't make
assumptions about the application that uses them, which include assuming
a process-wide "main Python interpreter".

Historically, Python extension modules don't handle this use case well.
Many extension modules (and even some stdlib modules) use 'per-process'
global state, because C ‘static’ variables are extremely easy to use.
Thus, data that should be specific to an interpreter ends up being
shared between interpreters.  Unless the extension developer is careful,
it is very easy to introduce edge cases that lead to crashes when a
module is loaded in more than one interpreter in the same process.

Unfortunately, 'per-interpreter' state is not easy to achieve.
Extension authors tend to not keep multiple interpreters in mind when
developing, and it is currently cumbersome to test the behavior.

* Menu:

* Enter Per-Module State::
* Isolated Module Objects::
* Surprising Edge Cases::


File: python.info,  Node: Enter Per-Module State,  Next: Isolated Module Objects,  Up: 背景<2>

9.19.2.1 Enter Per-Module State
...............................

Instead of focusing on per-interpreter state, Python's C API is evolving
to better support the more granular 'per-module' state.  This means that
C-level data should be attached to a 'module object'.  Each interpreter
creates its own module object, keeping the data separate.  For testing
the isolation, multiple module objects corresponding to a single
extension can even be loaded in a single interpreter.

Per-module state provides an easy way to think about lifetime and
resource ownership: the extension module will initialize when a module
object is created, and clean up when it's freed.  In this regard, a
module is just like any other *note PyObject: 5df.*; there are no "on
interpreter shutdown" hooks to think—or forget—about.

Note that there are use cases for different kinds of "globals":
per-process, per-interpreter, per-thread or per-task state.  With
per-module state as the default, these are still possible, but you
should treat them as exceptional cases: if you need them, you should
give them additional care and testing.  (Note that this guide does not
cover them.)


File: python.info,  Node: Isolated Module Objects,  Next: Surprising Edge Cases,  Prev: Enter Per-Module State,  Up: 背景<2>

9.19.2.2 Isolated Module Objects
................................

The key point to keep in mind when developing an extension module is
that several module objects can be created from a single shared library.
For example:

     >>> import sys
     >>> import binascii
     >>> old_binascii = binascii
     >>> del sys.modules['binascii']
     >>> import binascii  # create a new module object
     >>> old_binascii == binascii
     False

As a rule of thumb, the two modules should be completely independent.
All objects and state specific to the module should be encapsulated
within the module object, not shared with other module objects, and
cleaned up when the module object is deallocated.  Since this just is a
rule of thumb, exceptions are possible (see *note Managing Global State:
5836.), but they will need more thought and attention to edge cases.

While some modules could do with less stringent restrictions, isolated
modules make it easier to set clear expectations and guidelines that
work across a variety of use cases.


File: python.info,  Node: Surprising Edge Cases,  Prev: Isolated Module Objects,  Up: 背景<2>

9.19.2.3 Surprising Edge Cases
..............................

Note that isolated modules do create some surprising edge cases.  Most
notably, each module object will typically not share its classes and
exceptions with other similar modules.  Continuing from the *note
example above: 5835, note that ‘old_binascii.Error’ and ‘binascii.Error’
are separate objects.  In the following code, the exception is 'not'
caught:

     >>> old_binascii.Error == binascii.Error
     False
     >>> try:
     ...     old_binascii.unhexlify(b'qwertyuiop')
     ... except binascii.Error:
     ...     print('boo')
     ...
     Traceback (most recent call last):
       File "<stdin>", line 2, in <module>
     binascii.Error: Non-hexadecimal digit found

This is expected.  Notice that pure-Python modules behave the same way:
it is a part of how Python works.

The goal is to make extension modules safe at the C level, not to make
hacks behave intuitively.  Mutating ‘sys.modules’ "manually" counts as a
hack.


File: python.info,  Node: Making Modules Safe with Multiple Interpreters,  Next: Heap Types<2>,  Prev: 背景<2>,  Up: 拡張モジュールを分離する

9.19.3 Making Modules Safe with Multiple Interpreters
-----------------------------------------------------

* Menu:

* Managing Global State::
* Managing Per-Module State::
* Opt-Out; Limiting to One Module Object per Process: Opt-Out Limiting to One Module Object per Process.
* Module State Access from Functions::


File: python.info,  Node: Managing Global State,  Next: Managing Per-Module State,  Up: Making Modules Safe with Multiple Interpreters

9.19.3.1 Managing Global State
..............................

Sometimes, the state associated with a Python module is not specific to
that module, but to the entire process (or something else "more global"
than a module).  For example:

   - The ‘readline’ module manages 'the' terminal.

   - A module running on a circuit board wants to control 'the' on-board
     LED.

In these cases, the Python module should provide 'access' to the global
state, rather than 'own' it.  If possible, write the module so that
multiple copies of it can access the state independently (along with
other libraries, whether for Python or other languages).  If that is not
possible, consider explicit locking.

If it is necessary to use process-global state, the simplest way to
avoid issues with multiple interpreters is to explicitly prevent a
module from being loaded more than once per process—see *note Opt-Out;
Limiting to One Module Object per Process: 5210.


File: python.info,  Node: Managing Per-Module State,  Next: Opt-Out Limiting to One Module Object per Process,  Prev: Managing Global State,  Up: Making Modules Safe with Multiple Interpreters

9.19.3.2 Managing Per-Module State
..................................

To use per-module state, use *note multi-phase extension module
initialization: 5213.  This signals that your module supports multiple
interpreters correctly.

Set ‘PyModuleDef.m_size’ to a positive number to request that many bytes
of storage local to the module.  Usually, this will be set to the size
of some module-specific ‘struct’, which can store all of the module's
C-level state.  In particular, it is where you should put pointers to
classes (including exceptions, but excluding static types) and settings
(e.g.  ‘csv’'s *note field_size_limit: 1b91.) which the C code needs to
function.

     注釈: Another option is to store state in the module's ‘__dict__’,
     but you must avoid crashing when users modify ‘__dict__’ from
     Python code.  This usually means error- and type-checking at the C
     level, which is easy to get wrong and hard to test sufficiently.

     However, if module state is not needed in C code, storing it in
     ‘__dict__’ only is a good idea.

If the module state includes ‘PyObject’ pointers, the module object must
hold references to those objects and implement the module-level hooks
‘m_traverse’, ‘m_clear’ and ‘m_free’.  These work like ‘tp_traverse’,
‘tp_clear’ and ‘tp_free’ of a class.  Adding them will require some work
and make the code longer; this is the price for modules which can be
unloaded cleanly.

An example of a module with per-module state is currently available as
xxlimited(1); example module initialization shown at the bottom of the
file.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/blob/master/Modules/xxlimited.c


File: python.info,  Node: Opt-Out Limiting to One Module Object per Process,  Next: Module State Access from Functions,  Prev: Managing Per-Module State,  Up: Making Modules Safe with Multiple Interpreters

9.19.3.3 Opt-Out: Limiting to One Module Object per Process
...........................................................

A non-negative ‘PyModuleDef.m_size’ signals that a module supports
multiple interpreters correctly.  If this is not yet the case for your
module, you can explicitly make your module loadable only once per
process.  For example:

     // A process-wide flag
     static int loaded = 0;

     // Mutex to provide thread safety (only needed for free-threaded Python)
     static PyMutex modinit_mutex = {0};

     static int
     exec_module(PyObject* module)
     {
         PyMutex_Lock(&modinit_mutex);
         if (loaded) {
             PyMutex_Unlock(&modinit_mutex);
             PyErr_SetString(PyExc_ImportError,
                             "cannot load module more than once per process");
             return -1;
         }
         loaded = 1;
         PyMutex_Unlock(&modinit_mutex);
         // ... rest of initialization
     }

If your module's *note PyModuleDef.m_clear: b72. function is able to
prepare for future re-initialization, it should clear the ‘loaded’ flag.
In this case, your module won't support multiple instances existing
'concurrently', but it will, for example, support being loaded after
Python runtime shutdown (*note Py_FinalizeEx(): f11.) and
re-initialization (*note Py_Initialize(): 460.).


File: python.info,  Node: Module State Access from Functions,  Prev: Opt-Out Limiting to One Module Object per Process,  Up: Making Modules Safe with Multiple Interpreters

9.19.3.4 Module State Access from Functions
...........................................

Accessing the state from module-level functions is straightforward.
Functions get the module object as their first argument; for extracting
the state, you can use ‘PyModule_GetState’:

     static PyObject *
     func(PyObject *module, PyObject *args)
     {
         my_struct *state = (my_struct*)PyModule_GetState(module);
         if (state == NULL) {
             return NULL;
         }
         // ... rest of logic
     }

     注釈: ‘PyModule_GetState’ may return ‘NULL’ without setting an
     exception if there is no module state, i.e.  ‘PyModuleDef.m_size’
     was zero.  In your own module, you're in control of ‘m_size’, so
     this is easy to prevent.


File: python.info,  Node: Heap Types<2>,  Next: 取り掛かり中の問題,  Prev: Making Modules Safe with Multiple Interpreters,  Up: 拡張モジュールを分離する

9.19.4 Heap Types
-----------------

Traditionally, types defined in C code are 'static'; that is, ‘static
PyTypeObject’ structures defined directly in code and initialized using
‘PyType_Ready()’.

Such types are necessarily shared across the process.  Sharing them
between module objects requires paying attention to any state they own
or access.  To limit the possible issues, static types are immutable at
the Python level: for example, you can't set ‘str.myattribute = 123’.

'CPython 実装の詳細:' Sharing truly immutable objects between
interpreters is fine, as long as they don't provide access to mutable
objects.  However, in CPython, every Python object has a mutable
implementation detail: the reference count.  Changes to the refcount are
guarded by the GIL. Thus, code that shares any Python objects across
interpreters implicitly depends on CPython's current, process-wide GIL.

Because they are immutable and process-global, static types cannot
access "their" module state.  If any method of such a type requires
access to module state, the type must be converted to a 'heap-allocated
type', or 'heap type' for short.  These correspond more closely to
classes created by Python's ‘class’ statement.

For new modules, using heap types by default is a good rule of thumb.

* Menu:

* Changing Static Types to Heap Types::
* Defining Heap Types::
* Garbage-Collection Protocol::
* Module State Access from Classes::
* Module State Access from Regular Methods::
* Module State Access from Slot Methods, Getters and Setters: Module State Access from Slot Methods Getters and Setters.
* Lifetime of the Module State::


File: python.info,  Node: Changing Static Types to Heap Types,  Next: Defining Heap Types,  Up: Heap Types<2>

9.19.4.1 Changing Static Types to Heap Types
............................................

Static types can be converted to heap types, but note that the heap type
API was not designed for "lossless" conversion from static types—that
is, creating a type that works exactly like a given static type.  So,
when rewriting the class definition in a new API, you are likely to
unintentionally change a few details (e.g.  pickleability or inherited
slots).  Always test the details that are important to you.

Watch out for the following two points in particular (but note that this
is not a comprehensive list):

   * Unlike static types, heap type objects are mutable by default.  Use
     the *note Py_TPFLAGS_IMMUTABLETYPE: 3cf. flag to prevent
     mutability.

   * Heap types inherit *note tp_new: 79f. by default, so it may become
     possible to instantiate them from Python code.  You can prevent
     this with the *note Py_TPFLAGS_DISALLOW_INSTANTIATION: 7a2. flag.


File: python.info,  Node: Defining Heap Types,  Next: Garbage-Collection Protocol,  Prev: Changing Static Types to Heap Types,  Up: Heap Types<2>

9.19.4.2 Defining Heap Types
............................

Heap types can be created by filling a *note PyType_Spec: 1a89.
structure, a description or "blueprint" of a class, and calling *note
PyType_FromModuleAndSpec(): 773. to construct a new class object.

     注釈: Other functions, like *note PyType_FromSpec(): 79d, can also
     create heap types, but *note PyType_FromModuleAndSpec(): 773.
     associates the module with the class, allowing access to the module
     state from methods.

The class should generally be stored in 'both' the module state (for
safe access from C) and the module's ‘__dict__’ (for access from Python
code).


File: python.info,  Node: Garbage-Collection Protocol,  Next: Module State Access from Classes,  Prev: Defining Heap Types,  Up: Heap Types<2>

9.19.4.3 Garbage-Collection Protocol
....................................

Instances of heap types hold a reference to their type.  This ensures
that the type isn't destroyed before all its instances are, but may
result in reference cycles that need to be broken by the garbage
collector.

To avoid memory leaks, instances of heap types must implement the
garbage collection protocol.  That is, heap types should:

   - Have the *note Py_TPFLAGS_HAVE_GC: 981. flag.

   - Define a traverse function using *note Py_tp_traverse: 519d, which
     visits the type (e.g.  using ‘Py_VISIT(Py_TYPE(self))’).

Please refer to the documentation of *note Py_TPFLAGS_HAVE_GC: 981. and
*note tp_traverse: 982. for additional considerations.

The API for defining heap types grew organically, leaving it somewhat
awkward to use in its current state.  The following sections will guide
you through common issues.

* Menu:

* tp_traverse in Python 3.8 and lower: tp_traverse in Python 3 8 and lower.
* Delegating tp_traverse::
* Defining tp_dealloc::
* Not overriding tp_free::
* Avoiding PyObject_New::


File: python.info,  Node: tp_traverse in Python 3 8 and lower,  Next: Delegating tp_traverse,  Up: Garbage-Collection Protocol

9.19.4.4 ‘tp_traverse’ in Python 3.8 and lower
..............................................

The requirement to visit the type from ‘tp_traverse’ was added in Python
3.9.  If you support Python 3.8 and lower, the traverse function must
'not' visit the type, so it must be more complicated:

     static int my_traverse(PyObject *self, visitproc visit, void *arg)
     {
         if (Py_Version >= 0x03090000) {
             Py_VISIT(Py_TYPE(self));
         }
         return 0;
     }

Unfortunately, *note Py_Version: 381. was only added in Python 3.11.  As
a replacement, use:

   * *note PY_VERSION_HEX: 382, if not using the stable ABI, or

   * *note sys.version_info: 8af. (via *note PySys_GetObject(): 62a. and
     *note PyArg_ParseTuple(): 3c1.).


File: python.info,  Node: Delegating tp_traverse,  Next: Defining tp_dealloc,  Prev: tp_traverse in Python 3 8 and lower,  Up: Garbage-Collection Protocol

9.19.4.5 Delegating ‘tp_traverse’
.................................

If your traverse function delegates to the *note tp_traverse: 982. of
its base class (or another type), ensure that ‘Py_TYPE(self)’ is visited
only once.  Note that only heap type are expected to visit the type in
‘tp_traverse’.

For example, if your traverse function includes:

     base->tp_traverse(self, visit, arg)

...and ‘base’ may be a static type, then it should also include:

     if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
         // a heap type's tp_traverse already visited Py_TYPE(self)
     } else {
         if (Py_Version >= 0x03090000) {
             Py_VISIT(Py_TYPE(self));
         }
     }

It is not necessary to handle the type's reference count in *note
tp_new: 79f. and *note tp_clear: 4ee2.


File: python.info,  Node: Defining tp_dealloc,  Next: Not overriding tp_free,  Prev: Delegating tp_traverse,  Up: Garbage-Collection Protocol

9.19.4.6 Defining ‘tp_dealloc’
..............................

If your type has a custom *note tp_dealloc: 4ebc. function, it needs to:

   - call *note PyObject_GC_UnTrack(): 171e. before any fields are
     invalidated, and

   - decrement the reference count of the type.

To keep the type valid while ‘tp_free’ is called, the type's refcount
needs to be decremented 'after' the instance is deallocated.  For
example:

     static void my_dealloc(PyObject *self)
     {
         PyObject_GC_UnTrack(self);
         ...
         PyTypeObject *type = Py_TYPE(self);
         type->tp_free(self);
         Py_DECREF(type);
     }

The default ‘tp_dealloc’ function does this, so if your type does 'not'
override ‘tp_dealloc’ you don't need to add it.


File: python.info,  Node: Not overriding tp_free,  Next: Avoiding PyObject_New,  Prev: Defining tp_dealloc,  Up: Garbage-Collection Protocol

9.19.4.7 Not overriding ‘tp_free’
.................................

The *note tp_free: 4ecf. slot of a heap type must be set to *note
PyObject_GC_Del(): 171c.  This is the default; do not override it.


File: python.info,  Node: Avoiding PyObject_New,  Prev: Not overriding tp_free,  Up: Garbage-Collection Protocol

9.19.4.8 Avoiding ‘PyObject_New’
................................

GC-tracked objects need to be allocated using GC-aware functions.

If you use *note PyObject_New(): b7c. or *note PyObject_NewVar(): b7d.:

   - Get and call type's *note tp_alloc: 4ed0. slot, if possible.  That
     is, replace ‘TYPE *o = PyObject_New(TYPE, typeobj)’ with:

          TYPE *o = typeobj->tp_alloc(typeobj, 0);

     Replace ‘o = PyObject_NewVar(TYPE, typeobj, size)’ with the same,
     but use size instead of the 0.

   - If the above is not possible (e.g.  inside a custom ‘tp_alloc’),
     call *note PyObject_GC_New(): c99. or *note PyObject_GC_NewVar():
     c9a.:

          TYPE *o = PyObject_GC_New(TYPE, typeobj);

          TYPE *o = PyObject_GC_NewVar(TYPE, typeobj, size);


File: python.info,  Node: Module State Access from Classes,  Next: Module State Access from Regular Methods,  Prev: Garbage-Collection Protocol,  Up: Heap Types<2>

9.19.4.9 Module State Access from Classes
.........................................

If you have a type object defined with *note PyType_FromModuleAndSpec():
773, you can call *note PyType_GetModule(): b66. to get the associated
module, and then *note PyModule_GetState(): b77. to get the module's
state.

To save a some tedious error-handling boilerplate code, you can combine
these two steps with *note PyType_GetModuleState(): b67, resulting in:

     my_struct *state = (my_struct*)PyType_GetModuleState(type);
     if (state == NULL) {
         return NULL;
     }


File: python.info,  Node: Module State Access from Regular Methods,  Next: Module State Access from Slot Methods Getters and Setters,  Prev: Module State Access from Classes,  Up: Heap Types<2>

9.19.4.10 Module State Access from Regular Methods
..................................................

Accessing the module-level state from methods of a class is somewhat
more complicated, but is possible thanks to API introduced in Python
3.9.  To get the state, you need to first get the 'defining class', and
then get the module state from it.

The largest roadblock is getting 'the class a method was defined in', or
that method's "defining class" for short.  The defining class can have a
reference to the module it is part of.

Do not confuse the defining class with ‘Py_TYPE(self)’.  If the method
is called on a 'subclass' of your type, ‘Py_TYPE(self)’ will refer to
that subclass, which may be defined in different module than yours.

     注釈: The following Python code can illustrate the concept.
     ‘Base.get_defining_class’ returns ‘Base’ even if ‘type(self) ==
     Sub’:

          class Base:
              def get_type_of_self(self):
                  return type(self)

              def get_defining_class(self):
                  return __class__

          class Sub(Base):
              pass

For a method to get its "defining class", it must use the *note
METH_METHOD | METH_FASTCALL | METH_KEYWORDS: 1a09. *note calling
convention: 16f0. and the corresponding *note PyCMethod: 968. signature:

     PyObject *PyCMethod(
         PyObject *self,               // object the method was called on
         PyTypeObject *defining_class, // defining class
         PyObject *const *args,        // C array of arguments
         Py_ssize_t nargs,             // length of "args"
         PyObject *kwnames)            // NULL, or dict of keyword arguments

Once you have the defining class, call *note PyType_GetModuleState():
b67. to get the state of its associated module.

例えば:

     static PyObject *
     example_method(PyObject *self,
             PyTypeObject *defining_class,
             PyObject *const *args,
             Py_ssize_t nargs,
             PyObject *kwnames)
     {
         my_struct *state = (my_struct*)PyType_GetModuleState(defining_class);
         if (state == NULL) {
             return NULL;
         }
         ... // rest of logic
     }

     PyDoc_STRVAR(example_method_doc, "...");

     static PyMethodDef my_methods[] = {
         {"example_method",
           (PyCFunction)(void(*)(void))example_method,
           METH_METHOD|METH_FASTCALL|METH_KEYWORDS,
           example_method_doc}
         {NULL},
     }


File: python.info,  Node: Module State Access from Slot Methods Getters and Setters,  Next: Lifetime of the Module State,  Prev: Module State Access from Regular Methods,  Up: Heap Types<2>

9.19.4.11 Module State Access from Slot Methods, Getters and Setters
....................................................................

     注釈: これは Python 3.11 の新機能です。

Slot methods—the fast C equivalents for special methods, such as *note
nb_add: 52e2. for *note __add__: 23dd. or *note tp_new: 79f. for
initialization—have a very simple API that doesn't allow passing in the
defining class, unlike with *note PyCMethod: 968.  The same goes for
getters and setters defined with *note PyGetSetDef: db2.

To access the module state in these cases, use the *note
PyType_GetModuleByDef(): 635. function, and pass in the module
definition.  Once you have the module, call *note PyModule_GetState():
b77. to get the state:

     PyObject *module = PyType_GetModuleByDef(Py_TYPE(self), &module_def);
     my_struct *state = (my_struct*)PyModule_GetState(module);
     if (state == NULL) {
         return NULL;
     }

‘PyType_GetModuleByDef()’ works by searching the *note method resolution
order: 25df. (i.e.  all superclasses) for the first superclass that has
a corresponding module.

     注釈: In very exotic cases (inheritance chains spanning multiple
     modules created from the same definition),
     ‘PyType_GetModuleByDef()’ might not return the module of the true
     defining class.  However, it will always return a module with the
     same definition, ensuring a compatible C memory layout.


File: python.info,  Node: Lifetime of the Module State,  Prev: Module State Access from Slot Methods Getters and Setters,  Up: Heap Types<2>

9.19.4.12 Lifetime of the Module State
......................................

When a module object is garbage-collected, its module state is freed.
For each pointer to (a part of) the module state, you must hold a
reference to the module object.

Usually this is not an issue, because types created with *note
PyType_FromModuleAndSpec(): 773, and their instances, hold a reference
to the module.  However, you must be careful in reference counting when
you reference module state from other places, such as callbacks for
external libraries.


File: python.info,  Node: 取り掛かり中の問題,  Prev: Heap Types<2>,  Up: 拡張モジュールを分離する

9.19.5 取り掛かり中の問題
-------------------------

Several issues around per-module state and heap types are still open.

Discussions about improving the situation are best held on the discuss
forum under c-api tag(1).

* Menu:

* クラスごとのスコープ::
* Lossless Conversion to Heap Types::

   ---------- Footnotes ----------

   (1) https://discuss.python.org/c/core-dev/c-api/30


File: python.info,  Node: クラスごとのスコープ,  Next: Lossless Conversion to Heap Types,  Up: 取り掛かり中の問題

9.19.5.1 クラスごとのスコープ
.............................

It is currently (as of Python 3.11) not possible to attach state to
individual 'types' without relying on CPython implementation details
(which may change in the future—perhaps, ironically, to allow a proper
solution for per-class scope).


File: python.info,  Node: Lossless Conversion to Heap Types,  Prev: クラスごとのスコープ,  Up: 取り掛かり中の問題

9.19.5.2 Lossless Conversion to Heap Types
..........................................

The heap type API was not designed for "lossless" conversion from static
types; that is, creating a type that works exactly like a given static
type.


File: python.info,  Node: timer file descriptor HOWTO,  Next: The Python 2 3 Method Resolution Order,  Prev: 拡張モジュールを分離する,  Up: Python HOWTO

9.20 timer file descriptor HOWTO
================================


リリース: 1.13

This HOWTO discusses Python's support for the linux timer file
descriptor.

* Menu:

* 使用例: 使用例<59>.


File: python.info,  Node: 使用例<59>,  Up: timer file descriptor HOWTO

9.20.1 使用例
-------------

The following example shows how to use a timer file descriptor to
execute a function twice a second:

     # Practical scripts should use really use a non-blocking timer,
     # we use a blocking timer here for simplicity.
     import os, time

     # Create the timer file descriptor
     fd = os.timerfd_create(time.CLOCK_REALTIME)

     # Start the timer in 1 second, with an interval of half a second
     os.timerfd_settime(fd, initial=1, interval=0.5)

     try:
         # Process timer events four times.
         for _ in range(4):
             # read() will block until the timer expires
             _ = os.read(fd, 8)
             print("Timer expired")
     finally:
         # Remember to close the timer file descriptor!
         os.close(fd)

To avoid the precision loss caused by the *note float: 196. type, timer
file descriptors allow specifying initial expiration and interval in
integer nanoseconds with ‘_ns’ variants of the functions.

This example shows how *note epoll(): 1196. can be used with timer file
descriptors to wait until the file descriptor is ready for reading:

     import os, time, select, socket, sys

     # Create an epoll object
     ep = select.epoll()

     # In this example, use loopback address to send "stop" command to the server.
     #
     # $ telnet 127.0.0.1 1234
     # Trying 127.0.0.1...
     # Connected to 127.0.0.1.
     # Escape character is '^]'.
     # stop
     # Connection closed by foreign host.
     #
     sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     sock.bind(("127.0.0.1", 1234))
     sock.setblocking(False)
     sock.listen(1)
     ep.register(sock, select.EPOLLIN)

     # Create timer file descriptors in non-blocking mode.
     num = 3
     fds = []
     for _ in range(num):
         fd = os.timerfd_create(time.CLOCK_REALTIME, flags=os.TFD_NONBLOCK)
         fds.append(fd)
         # Register the timer file descriptor for read events
         ep.register(fd, select.EPOLLIN)

     # Start the timer with os.timerfd_settime_ns() in nanoseconds.
     # Timer 1 fires every 0.25 seconds; timer 2 every 0.5 seconds; etc
     for i, fd in enumerate(fds, start=1):
         one_sec_in_nsec = 10**9
         i = i * one_sec_in_nsec
         os.timerfd_settime_ns(fd, initial=i//4, interval=i//4)

     timeout = 3
     try:
         conn = None
         is_active = True
         while is_active:
             # Wait for the timer to expire for 3 seconds.
             # epoll.poll() returns a list of (fd, event) pairs.
             # fd is a file descriptor.
             # sock and conn[=returned value of socket.accept()] are socket objects, not file descriptors.
             # So use sock.fileno() and conn.fileno() to get the file descriptors.
             events = ep.poll(timeout)

             # If more than one timer file descriptors are ready for reading at once,
             # epoll.poll() returns a list of (fd, event) pairs.
             #
             # In this example settings,
             #    1st timer fires every 0.25 seconds in 0.25 seconds. (0.25, 0.5, 0.75, 1.0, ...)
             #    2nd timer every 0.5 seconds in 0.5 seconds. (0.5, 1.0, 1.5, 2.0, ...)
             #    3rd timer every 0.75 seconds in 0.75 seconds. (0.75, 1.5, 2.25, 3.0, ...)
             #
             #    In 0.25 seconds, only 1st timer fires.
             #    In 0.5 seconds, 1st timer and 2nd timer fires at once.
             #    In 0.75 seconds, 1st timer and 3rd timer fires at once.
             #    In 1.5 seconds, 1st timer, 2nd timer and 3rd timer fires at once.
             #
             # If a timer file descriptor is signaled more than once since
             # the last os.read() call, os.read() returns the number of signaled
             # as host order of class bytes.
             print(f"Signaled events={events}")
             for fd, event in events:
                 if event & select.EPOLLIN:
                     if fd == sock.fileno():
                         # Check if there is a connection request.
                         print(f"Accepting connection {fd}")
                         conn, addr = sock.accept()
                         conn.setblocking(False)
                         print(f"Accepted connection {conn} from {addr}")
                         ep.register(conn, select.EPOLLIN)
                     elif conn and fd == conn.fileno():
                         # Check if there is data to read.
                         print(f"Reading data {fd}")
                         data = conn.recv(1024)
                         if data:
                             # You should catch UnicodeDecodeError exception for safety.
                             cmd = data.decode()
                             if cmd.startswith("stop"):
                                 print(f"Stopping server")
                                 is_active = False
                             else:
                                 print(f"Unknown command: {cmd}")
                         else:
                             # No more data, close connection
                             print(f"Closing connection {fd}")
                             ep.unregister(conn)
                             conn.close()
                             conn = None
                     elif fd in fds:
                         print(f"Reading timer {fd}")
                         count = int.from_bytes(os.read(fd, 8), byteorder=sys.byteorder)
                         print(f"Timer {fds.index(fd) + 1} expired {count} times")
                     else:
                         print(f"Unknown file descriptor {fd}")
     finally:
         for fd in fds:
             ep.unregister(fd)
             os.close(fd)
         ep.close()

This example shows how *note select(): fa0. can be used with timer file
descriptors to wait until the file descriptor is ready for reading:

     import os, time, select, socket, sys

     # In this example, use loopback address to send "stop" command to the server.
     #
     # $ telnet 127.0.0.1 1234
     # Trying 127.0.0.1...
     # Connected to 127.0.0.1.
     # Escape character is '^]'.
     # stop
     # Connection closed by foreign host.
     #
     sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     sock.bind(("127.0.0.1", 1234))
     sock.setblocking(False)
     sock.listen(1)

     # Create timer file descriptors in non-blocking mode.
     num = 3
     fds = [os.timerfd_create(time.CLOCK_REALTIME, flags=os.TFD_NONBLOCK)
            for _ in range(num)]
     select_fds = fds + [sock]

     # Start the timers with os.timerfd_settime() in seconds.
     # Timer 1 fires every 0.25 seconds; timer 2 every 0.5 seconds; etc
     for i, fd in enumerate(fds, start=1):
        os.timerfd_settime(fd, initial=i/4, interval=i/4)

     timeout = 3
     try:
         conn = None
         is_active = True
         while is_active:
            # Wait for the timer to expire for 3 seconds.
            # select.select() returns a list of file descriptors or objects.
            rfd, wfd, xfd = select.select(select_fds, select_fds, select_fds, timeout)
            for fd in rfd:
                if fd == sock:
                    # Check if there is a connection request.
                    print(f"Accepting connection {fd}")
                    conn, addr = sock.accept()
                    conn.setblocking(False)
                    print(f"Accepted connection {conn} from {addr}")
                    select_fds.append(conn)
                elif conn and fd == conn:
                    # Check if there is data to read.
                    print(f"Reading data {fd}")
                    data = conn.recv(1024)
                    if data:
                        # You should catch UnicodeDecodeError exception for safety.
                        cmd = data.decode()
                        if cmd.startswith("stop"):
                            print(f"Stopping server")
                            is_active = False
                        else:
                            print(f"Unknown command: {cmd}")
                    else:
                        # No more data, close connection
                        print(f"Closing connection {fd}")
                        select_fds.remove(conn)
                        conn.close()
                        conn = None
                elif fd in fds:
                    print(f"Reading timer {fd}")
                    count = int.from_bytes(os.read(fd, 8), byteorder=sys.byteorder)
                    print(f"Timer {fds.index(fd) + 1} expired {count} times")
                else:
                    print(f"Unknown file descriptor {fd}")
     finally:
         for fd in fds:
            os.close(fd)
         sock.close()
         sock = None


File: python.info,  Node: The Python 2 3 Method Resolution Order,  Next: Python support for free threading,  Prev: timer file descriptor HOWTO,  Up: Python HOWTO

9.21 The Python 2.3 Method Resolution Order
===========================================

     注釈: This is a historical document, provided as an appendix to the
     official documentation.  The Method Resolution Order discussed here
     was 'introduced' in Python 2.3, but it is still used in later
     versions - including Python 3.

By Michele Simionato(1).


概要: 'This document is intended for Python programmers who want to
understand the C3 Method Resolution Order used in Python 2.3.  Although
it is not intended for newbies, it is quite pedagogical with many worked
out examples.  I am not aware of other publicly available documents with
the same scope, therefore it should be useful.'

Disclaimer:

     'I donate this document to the Python Software Foundation, under
     the Python 2.3 license.  As usual in these circumstances, I warn
     the reader that what follows' should 'be correct, but I don't give
     any warranty.  Use it at your own risk and peril!'

Acknowledgments:

     'All the people of the Python mailing list who sent me their
     support.  Paul Foley who pointed out various imprecisions and made
     me to add the part on local precedence ordering.  David Goodger for
     help with the formatting in reStructuredText.  David Mertz for help
     with the editing.  Finally, Guido van Rossum who enthusiastically
     added this document to the official Python 2.3 home-page.'

* Menu:

* The beginning::
* The C3 Method Resolution Order::
* 使用例: 使用例<60>.
* Bad Method Resolution Orders::
* The end::
* Resources::

   ---------- Footnotes ----------

   (1) https://www.phyast.pitt.edu/~micheles/


File: python.info,  Node: The beginning,  Next: The C3 Method Resolution Order,  Up: The Python 2 3 Method Resolution Order

9.21.1 The beginning
--------------------

     'Felix qui potuit rerum cognoscere causas' - Virgilius

Everything started with a post by Samuele Pedroni to the Python
development mailing list (1).  In his post, Samuele showed that the
Python 2.2 method resolution order is not monotonic and he proposed to
replace it with the C3 method resolution order.  Guido agreed with his
arguments and therefore now Python 2.3 uses C3.  The C3 method itself
has nothing to do with Python, since it was invented by people working
on Dylan and it is described in a paper intended for lispers (2).  The
present paper gives a (hopefully) readable discussion of the C3
algorithm for Pythonistas who want to understand the reasons for the
change.

First of all, let me point out that what I am going to say only applies
to the 'new style classes' introduced in Python 2.2: 'classic classes'
maintain their old method resolution order, depth first and then left to
right.  Therefore, there is no breaking of old code for classic classes;
and even if in principle there could be breaking of code for Python 2.2
new style classes, in practice the cases in which the C3 resolution
order differs from the Python 2.2 method resolution order are so rare
that no real breaking of code is expected.  Therefore:

     'Don't be scared!'

Moreover, unless you make strong use of multiple inheritance and you
have non-trivial hierarchies, you don't need to understand the C3
algorithm, and you can easily skip this paper.  On the other hand, if
you really want to know how multiple inheritance works, then this paper
is for you.  The good news is that things are not as complicated as you
might expect.

Let me begin with some basic definitions.

  1. Given a class C in a complicated multiple inheritance hierarchy, it
     is a non-trivial task to specify the order in which methods are
     overridden, i.e.  to specify the order of the ancestors of C.

  2. The list of the ancestors of a class C, including the class itself,
     ordered from the nearest ancestor to the furthest, is called the
     class precedence list or the 'linearization' of C.

  3. The 'Method Resolution Order' (MRO) is the set of rules that
     construct the linearization.  In the Python literature, the idiom
     "the MRO of C" is also used as a synonymous for the linearization
     of the class C.

  4. For instance, in the case of single inheritance hierarchy, if C is
     a subclass of C1, and C1 is a subclass of C2, then the
     linearization of C is simply the list [C, C1 , C2].  However, with
     multiple inheritance hierarchies, the construction of the
     linearization is more cumbersome, since it is more difficult to
     construct a linearization that respects 'local precedence ordering'
     and 'monotonicity'.

  5. I will discuss the local precedence ordering later, but I can give
     the definition of monotonicity here.  A MRO is monotonic when the
     following is true: 'if C1 precedes C2 in the linearization of C,
     then C1 precedes C2 in the linearization of any subclass of C'.
     Otherwise, the innocuous operation of deriving a new class could
     change the resolution order of methods, potentially introducing
     very subtle bugs.  Examples where this happens will be shown later.

  6. Not all classes admit a linearization.  There are cases, in
     complicated hierarchies, where it is not possible to derive a class
     such that its linearization respects all the desired properties.

Here I give an example of this situation.  Consider the hierarchy

     >>> O = object
     >>> class X(O): pass
     >>> class Y(O): pass
     >>> class A(X,Y): pass
     >>> class B(Y,X): pass

which can be represented with the following inheritance graph, where I
have denoted with O the ‘object’ class, which is the beginning of any
hierarchy for new style classes:

           -----------
          |           |
          |    O      |
          |  /   \    |
           - X    Y  /
             |  / | /
             | /  |/
             A    B
             \   /
               ?

In this case, it is not possible to derive a new class C from A and B,
since X precedes Y in A, but Y precedes X in B, therefore the method
resolution order would be ambiguous in C.

Python 2.3 raises an exception in this situation (TypeError: MRO
conflict among bases Y, X) forbidding the naive programmer from creating
ambiguous hierarchies.  Python 2.2 instead does not raise an exception,
but chooses an 'ad hoc' ordering (CABXYO in this case).

   ---------- Footnotes ----------

   (1) The thread on python-dev started by Samuele Pedroni:
‘https://mail.python.org/pipermail/python-dev/2002-October/029035.html’

   (2) The paper 'A Monotonic Superclass Linearization for Dylan':
‘https://doi.org/10.1145/236337.236343’


File: python.info,  Node: The C3 Method Resolution Order,  Next: 使用例<60>,  Prev: The beginning,  Up: The Python 2 3 Method Resolution Order

9.21.2 The C3 Method Resolution Order
-------------------------------------

Let me introduce a few simple notations which will be useful for the
following discussion.  I will use the shortcut notation:

     C1 C2 ... CN

to indicate the list of classes [C1, C2, ...  , CN].

The 'head' of the list is its first element:

     head = C1

whereas the 'tail' is the rest of the list:

     tail = C2 ... CN.

I shall also use the notation:

     C + (C1 C2 ... CN) = C C1 C2 ... CN

to denote the sum of the lists [C] + [C1, C2, ...  ,CN].

Now I can explain how the MRO works in Python 2.3.

Consider a class C in a multiple inheritance hierarchy, with C
inheriting from the base classes B1, B2, ...  , BN. We want to compute
the linearization L[C] of the class C. The rule is the following:

     'the linearization of C is the sum of C plus the merge of the
     linearizations of the parents and the list of the parents.'

In symbolic notation:

     L[C(B1 ... BN)] = C + merge(L[B1] ... L[BN], B1 ... BN)

In particular, if C is the ‘object’ class, which has no parents, the
linearization is trivial:

     L[object] = object.

However, in general one has to compute the merge according to the
following prescription:

     'take the head of the first list, i.e L[B1][0]; if this head is not
     in the tail of any of the other lists, then add it to the
     linearization of C and remove it from the lists in the merge,
     otherwise look at the head of the next list and take it, if it is a
     good head.  Then repeat the operation until all the class are
     removed or it is impossible to find good heads.  In this case, it
     is impossible to construct the merge, Python 2.3 will refuse to
     create the class C and will raise an exception.'

This prescription ensures that the merge operation 'preserves' the
ordering, if the ordering can be preserved.  On the other hand, if the
order cannot be preserved (as in the example of serious order
disagreement discussed above) then the merge cannot be computed.

The computation of the merge is trivial if C has only one parent (single
inheritance); in this case:

     L[C(B)] = C + merge(L[B],B) = C + L[B]

However, in the case of multiple inheritance things are more cumbersome
and I don't expect you can understand the rule without a couple of
examples ;-)


File: python.info,  Node: 使用例<60>,  Next: Bad Method Resolution Orders,  Prev: The C3 Method Resolution Order,  Up: The Python 2 3 Method Resolution Order

9.21.3 使用例
-------------

First example.  Consider the following hierarchy:

     >>> O = object
     >>> class F(O): pass
     >>> class E(O): pass
     >>> class D(O): pass
     >>> class C(D,F): pass
     >>> class B(D,E): pass
     >>> class A(B,C): pass

In this case the inheritance graph can be drawn as:

                                    6
                                   ---
          Level 3                 | O |                  (more general)
                                /  ---  \
                               /    |    \                      |
                              /     |     \                     |
                             /      |      \                    |
                            ---    ---    ---                   |
          Level 2        3 | D | 4| E |  | F | 5                |
                            ---    ---    ---                   |
                             \  \ _ /       |                   |
                              \    / \ _    |                   |
                               \  /      \  |                   |
                                ---      ---                    |
          Level 1            1 | B |    | C | 2                 |
                                ---      ---                    |
                                  \      /                      |
                                   \    /                      \ /
                                     ---
          Level 0                 0 | A |                (more specialized)
                                     ---

The linearizations of O,D,E and F are trivial:

     L[O] = O
     L[D] = D O
     L[E] = E O
     L[F] = F O

The linearization of B can be computed as:

     L[B] = B + merge(DO, EO, DE)

We see that D is a good head, therefore we take it and we are reduced to
compute ‘merge(O,EO,E)’.  Now O is not a good head, since it is in the
tail of the sequence EO. In this case the rule says that we have to skip
to the next sequence.  Then we see that E is a good head; we take it and
we are reduced to compute ‘merge(O,O)’ which gives O. Therefore:

     L[B] =  B D E O

Using the same procedure one finds:

     L[C] = C + merge(DO,FO,DF)
          = C + D + merge(O,FO,F)
          = C + D + F + merge(O,O)
          = C D F O

Now we can compute:

     L[A] = A + merge(BDEO,CDFO,BC)
          = A + B + merge(DEO,CDFO,C)
          = A + B + C + merge(DEO,DFO)
          = A + B + C + D + merge(EO,FO)
          = A + B + C + D + E + merge(O,FO)
          = A + B + C + D + E + F + merge(O,O)
          = A B C D E F O

In this example, the linearization is ordered in a pretty nice way
according to the inheritance level, in the sense that lower levels (i.e.
more specialized classes) have higher precedence (see the inheritance
graph).  However, this is not the general case.

I leave as an exercise for the reader to compute the linearization for
my second example:

     >>> O = object
     >>> class F(O): pass
     >>> class E(O): pass
     >>> class D(O): pass
     >>> class C(D,F): pass
     >>> class B(E,D): pass
     >>> class A(B,C): pass

The only difference with the previous example is the change B(D,E) ->
B(E,D); however even such a little modification completely changes the
ordering of the hierarchy:

                                     6
                                    ---
          Level 3                  | O |
                                 /  ---  \
                                /    |    \
                               /     |     \
                              /      |      \
                            ---     ---    ---
          Level 2        2 | E | 4 | D |  | F | 5
                            ---     ---    ---
                             \      / \     /
                              \    /   \   /
                               \  /     \ /
                                ---     ---
          Level 1            1 | B |   | C | 3
                                ---     ---
                                 \       /
                                  \     /
                                    ---
          Level 0                0 | A |
                                    ---

Notice that the class E, which is in the second level of the hierarchy,
precedes the class C, which is in the first level of the hierarchy, i.e.
E is more specialized than C, even if it is in a higher level.

A lazy programmer can obtain the MRO directly from Python 2.2, since in
this case it coincides with the Python 2.3 linearization.  It is enough
to invoke the *note mro(): 237a. method of class A:

     >>> A.mro()
     [<class 'A'>, <class 'B'>, <class 'E'>,
     <class 'C'>, <class 'D'>, <class 'F'>,
     <class 'object'>]

Finally, let me consider the example discussed in the first section,
involving a serious order disagreement.  In this case, it is
straightforward to compute the linearizations of O, X, Y, A and B:

          L[O] = 0
          L[X] = X O
          L[Y] = Y O
          L[A] = A X Y O
          L[B] = B Y X O

However, it is impossible to compute the linearization for a class C
that inherits from A and B:

     L[C] = C + merge(AXYO, BYXO, AB)
          = C + A + merge(XYO, BYXO, B)
          = C + A + B + merge(XYO, YXO)

At this point we cannot merge the lists XYO and YXO, since X is in the
tail of YXO whereas Y is in the tail of XYO: therefore there are no good
heads and the C3 algorithm stops.  Python 2.3 raises an error and
refuses to create the class C.


File: python.info,  Node: Bad Method Resolution Orders,  Next: The end,  Prev: 使用例<60>,  Up: The Python 2 3 Method Resolution Order

9.21.4 Bad Method Resolution Orders
-----------------------------------

A MRO is 'bad' when it breaks such fundamental properties as local
precedence ordering and monotonicity.  In this section, I will show that
both the MRO for classic classes and the MRO for new style classes in
Python 2.2 are bad.

It is easier to start with the local precedence ordering.  Consider the
following example:

     >>> F=type('Food',(),{'remember2buy':'spam'})
     >>> E=type('Eggs',(F,),{'remember2buy':'eggs'})
     >>> G=type('GoodFood',(F,E),{}) # under Python 2.3 this is an error!

with inheritance diagram

                       O
                       |
          (buy spam)   F
                       | \
                       | E   (buy eggs)
                       | /
                       G

                (buy eggs or spam ?)

We see that class G inherits from F and E, with F 'before' E: therefore
we would expect the attribute 'G.remember2buy' to be inherited by
'F.remember2buy' and not by 'E.remember2buy': nevertheless Python 2.2
gives

     >>> G.remember2buy
     'eggs'

This is a breaking of local precedence ordering since the order in the
local precedence list, i.e.  the list of the parents of G, is not
preserved in the Python 2.2 linearization of G:

     L[G,P22]= G E F object   # F *follows* E

One could argue that the reason why F follows E in the Python 2.2
linearization is that F is less specialized than E, since F is the
superclass of E; nevertheless the breaking of local precedence ordering
is quite non-intuitive and error prone.  This is particularly true since
it is a different from old style classes:

     >>> class F: remember2buy='spam'
     >>> class E(F): remember2buy='eggs'
     >>> class G(F,E): pass
     >>> G.remember2buy
     'spam'

In this case the MRO is GFEF and the local precedence ordering is
preserved.

As a general rule, hierarchies such as the previous one should be
avoided, since it is unclear if F should override E or vice-versa.
Python 2.3 solves the ambiguity by raising an exception in the creation
of class G, effectively stopping the programmer from generating
ambiguous hierarchies.  The reason for that is that the C3 algorithm
fails when the merge:

     merge(FO,EFO,FE)

cannot be computed, because F is in the tail of EFO and E is in the tail
of FE.

The real solution is to design a non-ambiguous hierarchy, i.e.  to
derive G from E and F (the more specific first) and not from F and E; in
this case the MRO is GEF without any doubt.

                     O
                     |
                     F (spam)
                   / |
          (eggs)   E |
                   \ |
                     G
                       (eggs, no doubt)

Python 2.3 forces the programmer to write good hierarchies (or, at
least, less error-prone ones).

On a related note, let me point out that the Python 2.3 algorithm is
smart enough to recognize obvious mistakes, as the duplication of
classes in the list of parents:

     >>> class A(object): pass
     >>> class C(A,A): pass # error
     Traceback (most recent call last):
       File "<stdin>", line 1, in ?
     TypeError: duplicate base class A

Python 2.2 (both for classic classes and new style classes) in this
situation, would not raise any exception.

Finally, I would like to point out two lessons we have learned from this
example:

  1. despite the name, the MRO determines the resolution order of
     attributes, not only of methods;

  2. the default food for Pythonistas is spam !  (but you already knew
     that ;-)

Having discussed the issue of local precedence ordering, let me now
consider the issue of monotonicity.  My goal is to show that neither the
MRO for classic classes nor that for Python 2.2 new style classes is
monotonic.

To prove that the MRO for classic classes is non-monotonic is rather
trivial, it is enough to look at the diamond diagram:

             C
            / \
           /   \
          A     B
           \   /
            \ /
             D

One easily discerns the inconsistency:

     L[B,P21] = B C        # B precedes C : B's methods win
     L[D,P21] = D A C B C  # B follows C  : C's methods win!

On the other hand, there are no problems with the Python 2.2 and 2.3
MROs, they give both:

     L[D] = D A B C

Guido points out in his essay (1) that the classic MRO is not so bad in
practice, since one can typically avoids diamonds for classic classes.
But all new style classes inherit from ‘object’, therefore diamonds are
unavoidable and inconsistencies shows up in every multiple inheritance
graph.

The MRO of Python 2.2 makes breaking monotonicity difficult, but not
impossible.  The following example, originally provided by Samuele
Pedroni, shows that the MRO of Python 2.2 is non-monotonic:

     >>> class A(object): pass
     >>> class B(object): pass
     >>> class C(object): pass
     >>> class D(object): pass
     >>> class E(object): pass
     >>> class K1(A,B,C): pass
     >>> class K2(D,B,E): pass
     >>> class K3(D,A):   pass
     >>> class Z(K1,K2,K3): pass

Here are the linearizations according to the C3 MRO (the reader should
verify these linearizations as an exercise and draw the inheritance
diagram ;-)

     L[A] = A O
     L[B] = B O
     L[C] = C O
     L[D] = D O
     L[E] = E O
     L[K1]= K1 A B C O
     L[K2]= K2 D B E O
     L[K3]= K3 D A O
     L[Z] = Z K1 K2 K3 D A B C E O

Python 2.2 gives exactly the same linearizations for A, B, C, D, E, K1,
K2 and K3, but a different linearization for Z:

     L[Z,P22] = Z K1 K3 A K2 D B C E O

It is clear that this linearization is 'wrong', since A comes before D
whereas in the linearization of K3 A comes 'after' D. In other words, in
K3 methods derived by D override methods derived by A, but in Z, which
still is a subclass of K3, methods derived by A override methods derived
by D! This is a violation of monotonicity.  Moreover, the Python 2.2
linearization of Z is also inconsistent with local precedence ordering,
since the local precedence list of the class Z is [K1, K2, K3] (K2
precedes K3), whereas in the linearization of Z K2 'follows' K3.  These
problems explain why the 2.2 rule has been dismissed in favor of the C3
rule.

   ---------- Footnotes ----------

   (1) Guido van Rossum's essay, 'Unifying types and classes in Python
2.2':
‘https://web.archive.org/web/20140210194412/http://www.python.org/download/releases/2.2.2/descrintro’


File: python.info,  Node: The end,  Next: Resources,  Prev: Bad Method Resolution Orders,  Up: The Python 2 3 Method Resolution Order

9.21.5 The end
--------------

This section is for the impatient reader, who skipped all the previous
sections and jumped immediately to the end.  This section is for the
lazy programmer too, who didn't want to exercise her/his brain.
Finally, it is for the programmer with some hubris, otherwise s/he would
not be reading a paper on the C3 method resolution order in multiple
inheritance hierarchies ;-) These three virtues taken all together (and
'not' separately) deserve a prize: the prize is a short Python 2.2
script that allows you to compute the 2.3 MRO without risk to your
brain.  Simply change the last line to play with the various examples I
have discussed in this paper.:

     #<mro.py>

     """C3 algorithm by Samuele Pedroni (with readability enhanced by me)."""

     class __metaclass__(type):
         "All classes are metamagically modified to be nicely printed"
         __repr__ = lambda cls: cls.__name__

     class ex_2:
         "Serious order disagreement" #From Guido
         class O: pass
         class X(O): pass
         class Y(O): pass
         class A(X,Y): pass
         class B(Y,X): pass
         try:
             class Z(A,B): pass #creates Z(A,B) in Python 2.2
         except TypeError:
             pass # Z(A,B) cannot be created in Python 2.3

     class ex_5:
         "My first example"
         class O: pass
         class F(O): pass
         class E(O): pass
         class D(O): pass
         class C(D,F): pass
         class B(D,E): pass
         class A(B,C): pass

     class ex_6:
         "My second example"
         class O: pass
         class F(O): pass
         class E(O): pass
         class D(O): pass
         class C(D,F): pass
         class B(E,D): pass
         class A(B,C): pass

     class ex_9:
         "Difference between Python 2.2 MRO and C3" #From Samuele
         class O: pass
         class A(O): pass
         class B(O): pass
         class C(O): pass
         class D(O): pass
         class E(O): pass
         class K1(A,B,C): pass
         class K2(D,B,E): pass
         class K3(D,A): pass
         class Z(K1,K2,K3): pass

     def merge(seqs):
         print '\n\nCPL[%s]=%s' % (seqs[0][0],seqs),
         res = []; i=0
         while 1:
           nonemptyseqs=[seq for seq in seqs if seq]
           if not nonemptyseqs: return res
           i+=1; print '\n',i,'round: candidates...',
           for seq in nonemptyseqs: # find merge candidates among seq heads
               cand = seq[0]; print ' ',cand,
               nothead=[s for s in nonemptyseqs if cand in s[1:]]
               if nothead: cand=None #reject candidate
               else: break
           if not cand: raise "Inconsistent hierarchy"
           res.append(cand)
           for seq in nonemptyseqs: # remove cand
               if seq[0] == cand: del seq[0]

     def mro(C):
         "Compute the class precedence list (mro) according to C3"
         return merge([[C]]+map(mro,C.__bases__)+[list(C.__bases__)])

     def print_mro(C):
         print '\nMRO[%s]=%s' % (C,mro(C))
         print '\nP22 MRO[%s]=%s' % (C,C.mro())

     print_mro(ex_9.Z)

     #</mro.py>

That's all folks,

     enjoy !


File: python.info,  Node: Resources,  Prev: The end,  Up: The Python 2 3 Method Resolution Order

9.21.6 Resources
----------------


File: python.info,  Node: Python support for free threading,  Next: C API Extension Support for Free Threading,  Prev: The Python 2 3 Method Resolution Order,  Up: Python HOWTO

9.22 Python support for free threading
======================================

Starting with the 3.13 release, CPython has support for a build of
Python called *note free threading: 1f4. where the *note global
interpreter lock: 474. (GIL) is disabled.  Free-threaded execution
allows for full utilization of the available processing power by running
threads in parallel on available CPU cores.  While not all software will
benefit from this automatically, programs designed with threading in
mind will run faster on multi-core hardware.

Some third-party packages, in particular ones with an *note extension
module: 2251, may not be ready for use in a free-threaded build, and
will re-enable the *note GIL: 164.

This document describes the implications of free threading for Python
code.  See *note C API Extension Support for Free Threading: 585d. for
information on how to write C extensions that support the free-threaded
build.

参考
....

PEP 703(1) – Making the Global Interpreter Lock Optional in CPython for
an overall description of free-threaded Python.

* Menu:

* Installation: Installation<2>.
* Identifying free-threaded Python::
* The global interpreter lock in free-threaded Python::
* Thread safety::
* Known limitations::
* Behavioral changes::

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0703/


File: python.info,  Node: Installation<2>,  Next: Identifying free-threaded Python,  Up: Python support for free threading

9.22.1 Installation
-------------------

Starting with Python 3.13, the official macOS and Windows installers
optionally support installing free-threaded Python binaries.  The
installers are available at ‘https://www.python.org/downloads/’.

For information on other platforms, see the Installing a Free-Threaded
Python(1), a community-maintained installation guide for installing
free-threaded Python.

When building CPython from source, the *note -disable-gil: 499.
configure option should be used to build a free-threaded Python
interpreter.

   ---------- Footnotes ----------

   (1) https://py-free-threading.github.io/installing-cpython/


File: python.info,  Node: Identifying free-threaded Python,  Next: The global interpreter lock in free-threaded Python,  Prev: Installation<2>,  Up: Python support for free threading

9.22.2 Identifying free-threaded Python
---------------------------------------

To check if the current interpreter supports free-threading, *note
python -VV: 49b. and *note sys.version: 49c. contain "free-threading
build".  The new *note sys._is_gil_enabled(): 4926. function can be used
to check whether the GIL is actually disabled in the running process.

The ‘sysconfig.get_config_var("Py_GIL_DISABLED")’ configuration variable
can be used to determine whether the build supports free threading.  If
the variable is set to ‘1’, then the build supports free threading.
This is the recommended mechanism for decisions related to the build
configuration.


File: python.info,  Node: The global interpreter lock in free-threaded Python,  Next: Thread safety,  Prev: Identifying free-threaded Python,  Up: Python support for free threading

9.22.3 The global interpreter lock in free-threaded Python
----------------------------------------------------------

Free-threaded builds of CPython support optionally running with the GIL
enabled at runtime using the environment variable *note PYTHON_GIL: 49a.
or the command-line option *note -X gil: 16f.

The GIL may also automatically be enabled when importing a C-API
extension module that is not explicitly marked as supporting free
threading.  A warning will be printed in this case.

In addition to individual package documentation, the following websites
track the status of popular packages support for free threading:

   * ‘https://py-free-threading.github.io/tracking/’

   * ‘https://hugovk.github.io/free-threaded-wheels/’


File: python.info,  Node: Thread safety,  Next: Known limitations,  Prev: The global interpreter lock in free-threaded Python,  Up: Python support for free threading

9.22.4 Thread safety
--------------------

The free-threaded build of CPython aims to provide similar thread-safety
behavior at the Python level to the default GIL-enabled build.  Built-in
types like *note dict: 183, *note list: 24d, and *note set: 184. use
internal locks to protect against concurrent modifications in ways that
behave similarly to the GIL. However, Python has not historically
guaranteed specific behavior for concurrent modifications to these
built-in types, so this should be treated as a description of the
current implementation, not a guarantee of current or future behavior.

     注釈: It's recommended to use the *note threading.Lock: 19f4. or
     other synchronization primitives instead of relying on the internal
     locks of built-in types, when possible.


File: python.info,  Node: Known limitations,  Next: Behavioral changes,  Prev: Thread safety,  Up: Python support for free threading

9.22.5 Known limitations
------------------------

This section describes known limitations of the free-threaded CPython
build.

* Menu:

* Immortalization::
* フレーム (frame) オブジェクト: フレーム frame オブジェクト<3>.
* イテレータ (iterator): イテレータ iterator<3>.
* Single-threaded performance::


File: python.info,  Node: Immortalization,  Next: フレーム frame オブジェクト<3>,  Up: Known limitations

9.22.5.1 Immortalization
........................

In the free-threaded build, some objects are *note immortal: 290.
Immortal objects are not deallocated and have reference counts that are
never modified.  This is done to avoid reference count contention that
would prevent efficient multi-threaded scaling.

As of the 3.14 release, immortalization is limited to:

   * Code constants: numeric literals, string literals, and tuple
     literals composed of other constants.

   * Strings interned by *note sys.intern(): 14f3.


File: python.info,  Node: フレーム frame オブジェクト<3>,  Next: イテレータ iterator<3>,  Prev: Immortalization,  Up: Known limitations

9.22.5.2 フレーム (frame) オブジェクト
......................................

It is not safe to access *note frame.f_locals: 4a5. from a *note frame:
8ef. object if that frame is currently executing in another thread, and
doing so may crash the interpreter.


File: python.info,  Node: イテレータ iterator<3>,  Next: Single-threaded performance,  Prev: フレーム frame オブジェクト<3>,  Up: Known limitations

9.22.5.3 イテレータ (iterator)
..............................

It is generally not thread-safe to access the same iterator object from
multiple threads concurrently, and threads may see duplicate or missing
elements.


File: python.info,  Node: Single-threaded performance,  Prev: イテレータ iterator<3>,  Up: Known limitations

9.22.5.4 Single-threaded performance
....................................

The free-threaded build has additional overhead when executing Python
code compared to the default GIL-enabled build.  The amount of overhead
depends on the workload and hardware.  On the pyperformance benchmark
suite, the average overhead ranges from about 1% on macOS aarch64 to 8%
on x86-64 Linux systems.


File: python.info,  Node: Behavioral changes,  Prev: Known limitations,  Up: Python support for free threading

9.22.6 Behavioral changes
-------------------------

This section describes CPython behavioural changes with the
free-threaded build.

* Menu:

* Context variables::
* Warning filters::


File: python.info,  Node: Context variables,  Next: Warning filters,  Up: Behavioral changes

9.22.6.1 Context variables
..........................

In the free-threaded build, the flag *note thread_inherit_context: 175.
is set to true by default which causes threads created with *note
threading.Thread: 176. to start with a copy of the *note Context(): 177.
of the caller of *note start(): 178.  In the default GIL-enabled build,
the flag defaults to false so threads start with an empty *note
Context(): 177.


File: python.info,  Node: Warning filters,  Prev: Context variables,  Up: Behavioral changes

9.22.6.2 Warning filters
........................

In the free-threaded build, the flag *note context_aware_warnings: 18a.
is set to true by default.  In the default GIL-enabled build, the flag
defaults to false.  If the flag is true then the *note
warnings.catch_warnings: 179. context manager uses a context variable
for warning filters.  If the flag is false then *note catch_warnings:
179. modifies the global filters list, which is not thread-safe.  See
the *note warnings: 118. module for more details.


File: python.info,  Node: C API Extension Support for Free Threading,  Next: Remote debugging attachment protocol,  Prev: Python support for free threading,  Up: Python HOWTO

9.23 C API Extension Support for Free Threading
===============================================

Starting with the 3.13 release, CPython has support for running with the
*note global interpreter lock: 474. (GIL) disabled in a configuration
called *note free threading: 1f4.  This document describes how to adapt
C API extensions to support free threading.

* Menu:

* Identifying the Free-Threaded Build in C::
* Module Initialization::
* General API Guidelines::
* Borrowed References::
* Memory Allocation APIs::
* Thread State and GIL APIs::
* Protecting Internal Extension State::
* Critical Sections::
* Building Extensions for the Free-Threaded Build::


File: python.info,  Node: Identifying the Free-Threaded Build in C,  Next: Module Initialization,  Up: C API Extension Support for Free Threading

9.23.1 Identifying the Free-Threaded Build in C
-----------------------------------------------

The CPython C API exposes the ‘Py_GIL_DISABLED’ macro: in the
free-threaded build it's defined to ‘1’, and in the regular build it's
not defined.  You can use it to enable code that only runs under the
free-threaded build:

     #ifdef Py_GIL_DISABLED
     /* code that only runs in the free-threaded build */
     #endif

     注釈: On Windows, this macro is not defined automatically, but must
     be specified to the compiler when building.  The *note
     sysconfig.get_config_var(): 174. function can be used to determine
     whether the current running interpreter had the macro defined.


File: python.info,  Node: Module Initialization,  Next: General API Guidelines,  Prev: Identifying the Free-Threaded Build in C,  Up: C API Extension Support for Free Threading

9.23.2 Module Initialization
----------------------------

Extension modules need to explicitly indicate that they support running
with the GIL disabled; otherwise importing the extension will raise a
warning and enable the GIL at runtime.

There are two ways to indicate that an extension module supports running
with the GIL disabled depending on whether the extension uses
multi-phase or single-phase initialization.

* Menu:

* Multi-Phase Initialization::
* Single-Phase Initialization::


File: python.info,  Node: Multi-Phase Initialization,  Next: Single-Phase Initialization,  Up: Module Initialization

9.23.2.1 Multi-Phase Initialization
...................................

Extensions that use multi-phase initialization (i.e., *note
PyModuleDef_Init(): 4ea3.) should add a *note Py_mod_gil: 482. slot in
the module definition.  If your extension supports older versions of
CPython, you should guard the slot with a *note PY_VERSION_HEX: 382.
check.

     static struct PyModuleDef_Slot module_slots[] = {
         ...
     #if PY_VERSION_HEX >= 0x030D0000
         {Py_mod_gil, Py_MOD_GIL_NOT_USED},
     #endif
         {0, NULL}
     };

     static struct PyModuleDef moduledef = {
         PyModuleDef_HEAD_INIT,
         .m_slots = module_slots,
         ...
     };


File: python.info,  Node: Single-Phase Initialization,  Prev: Multi-Phase Initialization,  Up: Module Initialization

9.23.2.2 Single-Phase Initialization
....................................

Extensions that use single-phase initialization (i.e., *note
PyModule_Create(): 5217.) should call *note PyUnstable_Module_SetGIL():
49d. to indicate that they support running with the GIL disabled.  The
function is only defined in the free-threaded build, so you should guard
the call with ‘#ifdef Py_GIL_DISABLED’ to avoid compilation errors in
the regular build.

     static struct PyModuleDef moduledef = {
         PyModuleDef_HEAD_INIT,
         ...
     };

     PyMODINIT_FUNC
     PyInit_mymodule(void)
     {
         PyObject *m = PyModule_Create(&moduledef);
         if (m == NULL) {
             return NULL;
         }
     #ifdef Py_GIL_DISABLED
         PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
     #endif
         return m;
     }


File: python.info,  Node: General API Guidelines,  Next: Borrowed References,  Prev: Module Initialization,  Up: C API Extension Support for Free Threading

9.23.3 General API Guidelines
-----------------------------

Most of the C API is thread-safe, but there are some exceptions.

   * 'Struct Fields': Accessing fields in Python C API objects or
     structs directly is not thread-safe if the field may be
     concurrently modified.

   * 'Macros': Accessor macros like *note PyList_GET_ITEM: 4f5f, *note
     PyList_SET_ITEM: 62f, and macros like *note
     PySequence_Fast_GET_SIZE: 3ca. that use the object returned by
     *note PySequence_Fast(): 18a2. do not perform any error checking or
     locking.  These macros are not thread-safe if the container object
     may be modified concurrently.

   * 'Borrowed References': C API functions that return *note borrowed
     references: 3d7. may not be thread-safe if the containing object is
     modified concurrently.  See the section on *note borrowed
     references: 5872. for more information.

* Menu:

* Container Thread Safety::


File: python.info,  Node: Container Thread Safety,  Up: General API Guidelines

9.23.3.1 Container Thread Safety
................................

Containers like *note PyListObject: 52a8, *note PyDictObject: 64f, and
*note PySetObject: 53c9. perform internal locking in the free-threaded
build.  For example, the *note PyList_Append(): 503f. will lock the list
before appending an item.

* Menu:

* PyDict_Next::


File: python.info,  Node: PyDict_Next,  Up: Container Thread Safety

9.23.3.2 ‘PyDict_Next’
......................

A notable exception is *note PyDict_Next(): 198f, which does not lock
the dictionary.  You should use *note Py_BEGIN_CRITICAL_SECTION: 53ab.
to protect the dictionary while iterating over it if the dictionary may
be concurrently modified:

     Py_BEGIN_CRITICAL_SECTION(dict);
     PyObject *key, *value;
     Py_ssize_t pos = 0;
     while (PyDict_Next(dict, &pos, &key, &value)) {
         ...
     }
     Py_END_CRITICAL_SECTION();


File: python.info,  Node: Borrowed References,  Next: Memory Allocation APIs,  Prev: General API Guidelines,  Up: C API Extension Support for Free Threading

9.23.4 Borrowed References
--------------------------

Some C API functions return *note borrowed references: 3d7.  These APIs
are not thread-safe if the containing object is modified concurrently.
For example, it's not safe to use *note PyList_GetItem(): 5ff. if the
list may be modified concurrently.

The following table lists some borrowed reference APIs and their
replacements that return *note strong references: 5e2.

Borrowed reference API                  Strong reference API
                                        
--------------------------------------------------------------------------------
                                        
*note PyList_GetItem(): 5ff.            *note PyList_GetItemRef(): 5fe.
                                        
                                        
*note PyList_GET_ITEM(): 4f5f.          *note PyList_GetItemRef(): 5fe.
                                        
                                        
*note PyDict_GetItem(): 628.            *note PyDict_GetItemRef(): 5e0.
                                        
                                        
*note PyDict_GetItemWithError(): 5e1.   *note PyDict_GetItemRef(): 5e0.
                                        
                                        
*note PyDict_GetItemString(): 629.      *note PyDict_GetItemStringRef(): 421.
                                        
                                        
*note PyDict_SetDefault(): 5e4.         *note PyDict_SetDefaultRef(): 5e3.
                                        
                                        
*note PyDict_Next(): 198f.              none (see *note PyDict_Next: 5875.)
                                        
                                        
*note PyWeakref_GetObject(): 3dd.       *note PyWeakref_GetRef(): 3df.
                                        
                                        
*note PyWeakref_GET_OBJECT(): 3de.      *note PyWeakref_GetRef(): 3df.
                                        
                                        
*note PyImport_AddModule(): 5fc.        *note PyImport_AddModuleRef(): 5fb.
                                        
                                        
*note PyCell_GET(): 540a.               *note PyCell_Get(): 5409.
                                        

Not all APIs that return borrowed references are problematic.  For
example, *note PyTuple_GetItem(): 4eb7. is safe because tuples are
immutable.  Similarly, not all uses of the above APIs are problematic.
For example, *note PyDict_GetItem(): 628. is often used for parsing
keyword argument dictionaries in function calls; those keyword argument
dictionaries are effectively private (not accessible by other threads),
so using borrowed references in that context is safe.

Some of these functions were added in Python 3.13.  You can use the
pythoncapi-compat(1) package to provide implementations of these
functions for older Python versions.

   ---------- Footnotes ----------

   (1) https://github.com/python/pythoncapi-compat


File: python.info,  Node: Memory Allocation APIs,  Next: Thread State and GIL APIs,  Prev: Borrowed References,  Up: C API Extension Support for Free Threading

9.23.5 Memory Allocation APIs
-----------------------------

Python's memory management C API provides functions in three different
*note allocation domains: 55b1.: "raw", "mem", and "object".  For
thread-safety, the free-threaded build requires that only Python objects
are allocated using the object domain, and that all Python objects are
allocated using that domain.  This differs from the prior Python
versions, where this was only a best practice and not a hard
requirement.

     注釈: Search for uses of *note PyObject_Malloc(): e62. in your
     extension and check that the allocated memory is used for Python
     objects.  Use *note PyMem_Malloc(): e5f. to allocate buffers
     instead of *note PyObject_Malloc(): e62.


File: python.info,  Node: Thread State and GIL APIs,  Next: Protecting Internal Extension State,  Prev: Memory Allocation APIs,  Up: C API Extension Support for Free Threading

9.23.6 Thread State and GIL APIs
--------------------------------

Python provides a set of functions and macros to manage thread state and
the GIL, such as:

   * *note PyGILState_Ensure(): 64a. and *note PyGILState_Release():
     64b.

   * *note PyEval_SaveThread(): 647. and *note PyEval_RestoreThread():
     648.

   * *note Py_BEGIN_ALLOW_THREADS: 4ebd. and *note Py_END_ALLOW_THREADS:
     c7f.

These functions should still be used in the free-threaded build to
manage thread state even when the *note GIL: 164. is disabled.  For
example, if you create a thread outside of Python, you must call *note
PyGILState_Ensure(): 64a. before calling into the Python API to ensure
that the thread has a valid Python thread state.

You should continue to call *note PyEval_SaveThread(): 647. or *note
Py_BEGIN_ALLOW_THREADS: 4ebd. around blocking operations, such as I/O or
lock acquisitions, to allow other threads to run the *note cyclic
garbage collector: 17d8.


File: python.info,  Node: Protecting Internal Extension State,  Next: Critical Sections,  Prev: Thread State and GIL APIs,  Up: C API Extension Support for Free Threading

9.23.7 Protecting Internal Extension State
------------------------------------------

Your extension may have internal state that was previously protected by
the GIL. You may need to add locking to protect this state.  The
approach will depend on your extension, but some common patterns
include:

   * 'Caches': global caches are a common source of shared state.
     Consider using a lock to protect the cache or disabling it in the
     free-threaded build if the cache is not critical for performance.

   * 'Global State': global state may need to be protected by a lock or
     moved to thread local storage.  C11 and C++11 provide the
     ‘thread_local’ or ‘_Thread_local’ for thread-local storage(1).

   ---------- Footnotes ----------

   (1) https://en.cppreference.com/w/c/language/storage_duration


File: python.info,  Node: Critical Sections,  Next: Building Extensions for the Free-Threaded Build,  Prev: Protecting Internal Extension State,  Up: C API Extension Support for Free Threading

9.23.8 Critical Sections
------------------------

In the free-threaded build, CPython provides a mechanism called
"critical sections" to protect data that would otherwise be protected by
the GIL. While extension authors may not interact with the internal
critical section implementation directly, understanding their behavior
is crucial when using certain C API functions or managing shared state
in the free-threaded build.

* Menu:

* What Are Critical Sections?::
* Using Critical Sections::
* How Critical Sections Work::
* Deadlock Avoidance::
* Important Considerations::


File: python.info,  Node: What Are Critical Sections?,  Next: Using Critical Sections,  Up: Critical Sections

9.23.8.1 What Are Critical Sections?
....................................

Conceptually, critical sections act as a deadlock avoidance layer built
on top of simple mutexes.  Each thread maintains a stack of active
critical sections.  When a thread needs to acquire a lock associated
with a critical section (e.g., implicitly when calling a thread-safe C
API function like *note PyDict_SetItem(): 4eb9, or explicitly using
macros), it attempts to acquire the underlying mutex.


File: python.info,  Node: Using Critical Sections,  Next: How Critical Sections Work,  Prev: What Are Critical Sections?,  Up: Critical Sections

9.23.8.2 Using Critical Sections
................................

The primary APIs for using critical sections are:

   * *note Py_BEGIN_CRITICAL_SECTION: 53ab. and *note
     Py_END_CRITICAL_SECTION: 5559. - For locking a single object

   * *note Py_BEGIN_CRITICAL_SECTION2: 5557. and *note
     Py_END_CRITICAL_SECTION2: 555b. - For locking two objects
     simultaneously

These macros must be used in matching pairs and must appear in the same
C scope, since they establish a new local scope.  These macros are
no-ops in non-free-threaded builds, so they can be safely added to code
that needs to support both build types.

A common use of a critical section would be to lock an object while
accessing an internal attribute of it.  For example, if an extension
type has an internal count field, you could use a critical section while
reading or writing that field:

     // read the count, returns new reference to internal count value
     PyObject *result;
     Py_BEGIN_CRITICAL_SECTION(obj);
     result = Py_NewRef(obj->count);
     Py_END_CRITICAL_SECTION();
     return result;

     // write the count, consumes reference from new_count
     Py_BEGIN_CRITICAL_SECTION(obj);
     obj->count = new_count;
     Py_END_CRITICAL_SECTION();


File: python.info,  Node: How Critical Sections Work,  Next: Deadlock Avoidance,  Prev: Using Critical Sections,  Up: Critical Sections

9.23.8.3 How Critical Sections Work
...................................

Unlike traditional locks, critical sections do not guarantee exclusive
access throughout their entire duration.  If a thread would block while
holding a critical section (e.g., by acquiring another lock or
performing I/O), the critical section is temporarily suspended—all locks
are released—and then resumed when the blocking operation completes.

This behavior is similar to what happens with the GIL when a thread
makes a blocking call.  The key differences are:

   * Critical sections operate on a per-object basis rather than
     globally

   * Critical sections follow a stack discipline within each thread (the
     "begin" and "end" macros enforce this since they must be paired and
     within the same scope)

   * Critical sections automatically release and reacquire locks around
     potential blocking operations


File: python.info,  Node: Deadlock Avoidance,  Next: Important Considerations,  Prev: How Critical Sections Work,  Up: Critical Sections

9.23.8.4 Deadlock Avoidance
...........................

Critical sections help avoid deadlocks in two ways:

  1. If a thread tries to acquire a lock that's already held by another
     thread, it first suspends all of its active critical sections,
     temporarily releasing their locks

  2. When the blocking operation completes, only the top-most critical
     section is reacquired first

This means you cannot rely on nested critical sections to lock multiple
objects at once, as the inner critical section may suspend the outer
ones.  Instead, use *note Py_BEGIN_CRITICAL_SECTION2: 5557. to lock two
objects simultaneously.

Note that the locks described above are only *note PyMutex: 484. based
locks.  The critical section implementation does not know about or
affect other locking mechanisms that might be in use, like POSIX
mutexes.  Also note that while blocking on any *note PyMutex: 484.
causes the critical sections to be suspended, only the mutexes that are
part of the critical sections are released.  If *note PyMutex: 484. is
used without a critical section, it will not be released and therefore
does not get the same deadlock avoidance.


File: python.info,  Node: Important Considerations,  Prev: Deadlock Avoidance,  Up: Critical Sections

9.23.8.5 Important Considerations
.................................

   * Critical sections may temporarily release their locks, allowing
     other threads to modify the protected data.  Be careful about
     making assumptions about the state of the data after operations
     that might block.

   * Because locks can be temporarily released (suspended), entering a
     critical section does not guarantee exclusive access to the
     protected resource throughout the section's duration.  If code
     within a critical section calls another function that blocks (e.g.,
     acquires another lock, performs blocking I/O), all locks held by
     the thread via critical sections will be released.  This is similar
     to how the GIL can be released during blocking calls.

   * Only the lock(s) associated with the most recently entered
     (top-most) critical section are guaranteed to be held at any given
     time.  Locks for outer, nested critical sections might have been
     suspended.

   * You can lock at most two objects simultaneously with these APIs.
     If you need to lock more objects, you'll need to restructure your
     code.

   * While critical sections will not deadlock if you attempt to lock
     the same object twice, they are less efficient than purpose-built
     reentrant locks for this use case.

   * When using *note Py_BEGIN_CRITICAL_SECTION2: 5557, the order of the
     objects doesn't affect correctness (the implementation handles
     deadlock avoidance), but it's good practice to always lock objects
     in a consistent order.

   * Remember that the critical section macros are primarily for
     protecting access to 'Python objects' that might be involved in
     internal CPython operations susceptible to the deadlock scenarios
     described above.  For protecting purely internal extension state,
     standard mutexes or other synchronization primitives might be more
     appropriate.


File: python.info,  Node: Building Extensions for the Free-Threaded Build,  Prev: Critical Sections,  Up: C API Extension Support for Free Threading

9.23.9 Building Extensions for the Free-Threaded Build
------------------------------------------------------

C API extensions need to be built specifically for the free-threaded
build.  The wheels, shared libraries, and binaries are indicated by a
‘t’ suffix.

   * pypa/manylinux(1) supports the free-threaded build, with the ‘t’
     suffix, such as ‘python3.13t’.

   * pypa/cibuildwheel(2) supports the free-threaded build on Python
     3.13 and 3.14.  On Python 3.14, free-threaded wheels will be built
     by default.  On Python 3.13, you will need to set CIBW_ENABLE to
     cpython-freethreading(3).

* Menu:

* Limited C API and Stable ABI::
* Windows: Windows<85>.

   ---------- Footnotes ----------

   (1) https://github.com/pypa/manylinux

   (2) https://github.com/pypa/cibuildwheel

   (3) https://cibuildwheel.pypa.io/en/stable/options/#enable


File: python.info,  Node: Limited C API and Stable ABI,  Next: Windows<85>,  Up: Building Extensions for the Free-Threaded Build

9.23.9.1 Limited C API and Stable ABI
.....................................

The free-threaded build does not currently support the *note Limited C
API: 637. or the stable ABI. If you use setuptools(1) to build your
extension and currently set ‘py_limited_api=True’ you can use
‘py_limited_api=not sysconfig.get_config_var("Py_GIL_DISABLED")’ to opt
out of the limited API when building with the free-threaded build.

     注釈: You will need to build separate wheels specifically for the
     free-threaded build.  If you currently use the stable ABI, you can
     continue to build a single wheel for multiple non-free-threaded
     Python versions.

   ---------- Footnotes ----------

   (1) https://setuptools.pypa.io/en/latest/setuptools.html


File: python.info,  Node: Windows<85>,  Prev: Limited C API and Stable ABI,  Up: Building Extensions for the Free-Threaded Build

9.23.9.2 Windows
................

Due to a limitation of the official Windows installer, you will need to
manually define ‘Py_GIL_DISABLED=1’ when building extensions from
source.

参考
....

Porting Extension Modules to Support Free-Threading(1): A
community-maintained porting guide for extension authors.

   ---------- Footnotes ----------

   (1) https://py-free-threading.github.io/porting/


File: python.info,  Node: Remote debugging attachment protocol,  Next: Permission requirements,  Prev: C API Extension Support for Free Threading,  Up: Python HOWTO

9.24 Remote debugging attachment protocol
=========================================

This protocol enables external tools to attach to a running CPython
process and execute Python code remotely.

Most platforms require elevated privileges to attach to another Python
process.

* Menu:

* Disabling remote debugging::


File: python.info,  Node: Disabling remote debugging,  Up: Remote debugging attachment protocol

9.24.1 Disabling remote debugging
---------------------------------

To disable remote debugging support, use any of the following:

   * Set the *note PYTHON_DISABLE_REMOTE_DEBUG: 16e. environment
     variable to ‘1’ before starting the interpreter.

   * Use the *note -X disable_remote_debug: 16f. command-line option.

   * Compile Python with the *note -without-remote-debug: 170. build
     flag.


File: python.info,  Node: Permission requirements,  Next: Locating the PyRuntime structure,  Prev: Remote debugging attachment protocol,  Up: Python HOWTO

9.25 Permission requirements
============================

Attaching to a running Python process for remote debugging requires
elevated privileges on most platforms.  The specific requirements and
troubleshooting steps depend on your operating system:

Linux
.....

The tracer process must have the ‘CAP_SYS_PTRACE’ capability or
equivalent privileges.  You can only trace processes you own and can
signal.  Tracing may fail if the process is already being traced, or if
it is running with set-user-ID or set-group-ID. Security modules like
Yama may further restrict tracing.

To temporarily relax ptrace restrictions (until reboot), run:

     ‘echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope’

     注釈: Disabling ‘ptrace_scope’ reduces system hardening and should
     only be done in trusted environments.

If running inside a container, use ‘--cap-add=SYS_PTRACE’ or
‘--privileged’, and run as root if needed.

Try re-running the command with elevated privileges:

     ‘sudo -E !!’

macOS
.....

To attach to another process, you typically need to run your debugging
tool with elevated privileges.  This can be done by using ‘sudo’ or
running as root.

Even when attaching to processes you own, macOS may block debugging
unless the debugger is run with root privileges due to system security
restrictions.

Windows
.......

To attach to another process, you usually need to run your debugging
tool with administrative privileges.  Start the command prompt or
terminal as Administrator.

Some processes may still be inaccessible even with Administrator rights,
unless you have the ‘SeDebugPrivilege’ privilege enabled.

To resolve file or folder access issues, adjust the security
permissions:

       1. Right-click the file or folder and select 'Properties'.

       2. Go to the 'Security' tab to view users and groups with access.

       3. Click 'Edit' to modify permissions.

       4. Select your user account.

       5. In 'Permissions', check 'Read' or 'Full control' as needed.

       6. Click 'Apply', then 'OK' to confirm.

     注釈: Ensure you've satisfied all *note Permission requirements:
     5889. before proceeding.

This section describes the low-level protocol that enables external
tools to inject and execute a Python script within a running CPython
process.

This mechanism forms the basis of the *note sys.remote_exec(): 16d.
function, which instructs a remote Python process to execute a ‘.py’
file.  However, this section does not document the usage of that
function.  Instead, it provides a detailed explanation of the underlying
protocol, which takes as input the ‘pid’ of a target Python process and
the path to a Python source file to be executed.  This information
supports independent reimplementation of the protocol, regardless of
programming language.

     警告: The execution of the injected script depends on the
     interpreter reaching a safe evaluation point.  As a result,
     execution may be delayed depending on the runtime state of the
     target process.

Once injected, the script is executed by the interpreter within the
target process the next time a safe evaluation point is reached.  This
approach enables remote execution capabilities without modifying the
behavior or structure of the running Python application.

Subsequent sections provide a step-by-step description of the protocol,
including techniques for locating interpreter structures in memory,
safely accessing internal fields, and triggering code execution.
Platform-specific variations are noted where applicable, and example
implementations are included to clarify each operation.


File: python.info,  Node: Locating the PyRuntime structure,  Next: Reading _Py_DebugOffsets,  Prev: Permission requirements,  Up: Python HOWTO

9.26 Locating the PyRuntime structure
=====================================

CPython places the ‘PyRuntime’ structure in a dedicated binary section
to help external tools find it at runtime.  The name and format of this
section vary by platform.  For example, ‘.PyRuntime’ is used on ELF
systems, and ‘__DATA,__PyRuntime’ is used on macOS. Tools can find the
offset of this structure by examining the binary on disk.

The ‘PyRuntime’ structure contains CPython’s global interpreter state
and provides access to other internal data, including the list of
interpreters, thread states, and debugger support fields.

To work with a remote Python process, a debugger must first find the
memory address of the ‘PyRuntime’ structure in the target process.  This
address can’t be hardcoded or calculated from a symbol name, because it
depends on where the operating system loaded the binary.

The method for finding ‘PyRuntime’ depends on the platform, but the
steps are the same in general:

  1. Find the base address where the Python binary or shared library was
     loaded in the target process.

  2. Use the on-disk binary to locate the offset of the ‘.PyRuntime’
     section.

  3. Add the section offset to the base address to compute the address
     in memory.

The sections below explain how to do this on each supported platform and
include example code.

Linux (ELF)
...........

To find the ‘PyRuntime’ structure on Linux:

  1. Read the process’s memory map (for example, ‘/proc/<pid>/maps’) to
     find the address where the Python executable or ‘libpython’ was
     loaded.

  2. Parse the ELF section headers in the binary to get the offset of
     the ‘.PyRuntime’ section.

  3. Add that offset to the base address from step 1 to get the memory
     address of ‘PyRuntime’.

The following is an example implementation:

     def find_py_runtime_linux(pid: int) -> int:
         # Step 1: Try to find the Python executable in memory
         binary_path, base_address = find_mapped_binary(
             pid, name_contains="python"
         )

         # Step 2: Fallback to shared library if executable is not found
         if binary_path is None:
             binary_path, base_address = find_mapped_binary(
                 pid, name_contains="libpython"
             )

         # Step 3: Parse ELF headers to get .PyRuntime section offset
         section_offset = parse_elf_section_offset(
             binary_path, ".PyRuntime"
         )

         # Step 4: Compute PyRuntime address in memory
         return base_address + section_offset

On Linux systems, there are two main approaches to read memory from
another process.  The first is through the ‘/proc’ filesystem,
specifically by reading from ‘/proc/[pid]/mem’ which provides direct
access to the process's memory.  This requires appropriate permissions -
either being the same user as the target process or having root access.
The second approach is using the ‘process_vm_readv()’ system call which
provides a more efficient way to copy memory between processes.  While
ptrace's ‘PTRACE_PEEKTEXT’ operation can also be used to read memory, it
is significantly slower as it only reads one word at a time and requires
multiple context switches between the tracer and tracee processes.

For parsing ELF sections, the process involves reading and interpreting
the ELF file format structures from the binary file on disk.  The ELF
header contains a pointer to the section header table.  Each section
header contains metadata about a section including its name (stored in a
separate string table), offset, and size.  To find a specific section
like .PyRuntime, you need to walk through these headers and match the
section name.  The section header then provides the offset where that
section exists in the file, which can be used to calculate its runtime
address when the binary is loaded into memory.

You can read more about the ELF file format in the ELF specification(1).

macOS (Mach-O)
..............

To find the ‘PyRuntime’ structure on macOS:

  1. Call ‘task_for_pid()’ to get the ‘mach_port_t’ task port for the
     target process.  This handle is needed to read memory using APIs
     like ‘mach_vm_read_overwrite’ and ‘mach_vm_region’.

  2. Scan the memory regions to find the one containing the Python
     executable or ‘libpython’.

  3. Load the binary file from disk and parse the Mach-O headers to find
     the section named ‘PyRuntime’ in the ‘__DATA’ segment.  On macOS,
     symbol names are automatically prefixed with an underscore, so the
     ‘PyRuntime’ symbol appears as ‘_PyRuntime’ in the symbol table, but
     the section name is not affected.

The following is an example implementation:

     def find_py_runtime_macos(pid: int) -> int:
         # Step 1: Get access to the process's memory
         handle = get_memory_access_handle(pid)

         # Step 2: Try to find the Python executable in memory
         binary_path, base_address = find_mapped_binary(
             handle, name_contains="python"
         )

         # Step 3: Fallback to libpython if the executable is not found
         if binary_path is None:
             binary_path, base_address = find_mapped_binary(
                 handle, name_contains="libpython"
             )

         # Step 4: Parse Mach-O headers to get __DATA,__PyRuntime section offset
         section_offset = parse_macho_section_offset(
             binary_path, "__DATA", "__PyRuntime"
         )

         # Step 5: Compute the PyRuntime address in memory
         return base_address + section_offset

On macOS, accessing another process's memory requires using Mach-O
specific APIs and file formats.  The first step is obtaining a
‘task_port’ handle via ‘task_for_pid()’, which provides access to the
target process's memory space.  This handle enables memory operations
through APIs like ‘mach_vm_read_overwrite()’.

The process memory can be examined using ‘mach_vm_region()’ to scan
through the virtual memory space, while ‘proc_regionfilename()’ helps
identify which binary files are loaded at each memory region.  When the
Python binary or library is found, its Mach-O headers need to be parsed
to locate the ‘PyRuntime’ structure.

The Mach-O format organizes code and data into segments and sections.
The ‘PyRuntime’ structure lives in a section named ‘__PyRuntime’ within
the ‘__DATA’ segment.  The actual runtime address calculation involves
finding the ‘__TEXT’ segment which serves as the binary's base address,
then locating the ‘__DATA’ segment containing our target section.  The
final address is computed by combining the base address with the
appropriate section offsets from the Mach-O headers.

Note that accessing another process's memory on macOS typically requires
elevated privileges - either root access or special security
entitlements granted to the debugging process.

Windows (PE)
............

To find the ‘PyRuntime’ structure on Windows:

  1. Use the ToolHelp API to enumerate all modules loaded in the target
     process.  This is done using functions such as
     CreateToolhelp32Snapshot(2), Module32First(3), and Module32Next(4).

  2. Identify the module corresponding to ‘python.exe’ or
     ‘python`XY'.dll’, where ‘X’ and ‘Y’ are the major and minor version
     numbers of the Python version, and record its base address.

  3. Locate the ‘PyRuntim’ section.  Due to the PE format's 8-character
     limit on section names (defined as ‘IMAGE_SIZEOF_SHORT_NAME’), the
     original name ‘PyRuntime’ is truncated.  This section contains the
     ‘PyRuntime’ structure.

  4. Retrieve the section’s relative virtual address (RVA) and add it to
     the base address of the module.

The following is an example implementation:

     def find_py_runtime_windows(pid: int) -> int:
         # Step 1: Try to find the Python executable in memory
         binary_path, base_address = find_loaded_module(
             pid, name_contains="python"
         )

         # Step 2: Fallback to shared pythonXY.dll if the executable is not
         # found
         if binary_path is None:
             binary_path, base_address = find_loaded_module(
                 pid, name_contains="python3"
             )

         # Step 3: Parse PE section headers to get the RVA of the PyRuntime
         # section. The section name appears as "PyRuntim" due to the
         # 8-character limit defined by the PE format (IMAGE_SIZEOF_SHORT_NAME).
         section_rva = parse_pe_section_offset(binary_path, "PyRuntim")

         # Step 4: Compute PyRuntime address in memory
         return base_address + section_rva

On Windows, accessing another process's memory requires using the
Windows API functions like ‘CreateToolhelp32Snapshot()’ and
‘Module32First()/Module32Next()’ to enumerate loaded modules.  The
‘OpenProcess()’ function provides a handle to access the target
process's memory space, enabling memory operations through
‘ReadProcessMemory()’.

The process memory can be examined by enumerating loaded modules to find
the Python binary or DLL. When found, its PE headers need to be parsed
to locate the ‘PyRuntime’ structure.

The PE format organizes code and data into sections.  The ‘PyRuntime’
structure lives in a section named "PyRuntim" (truncated from
"PyRuntime" due to PE's 8-character name limit).  The actual runtime
address calculation involves finding the module's base address from the
module entry, then locating our target section in the PE headers.  The
final address is computed by combining the base address with the
section's virtual address from the PE section headers.

Note that accessing another process's memory on Windows typically
requires appropriate privileges - either administrative access or the
‘SeDebugPrivilege’ privilege granted to the debugging process.

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Executable_and_Linkable_Format

   (2) 
https://learn.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot

   (3) 
https://learn.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-module32first

   (4) 
https://learn.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-module32next


File: python.info,  Node: Reading _Py_DebugOffsets,  Next: Locating the interpreter and thread state,  Prev: Locating the PyRuntime structure,  Up: Python HOWTO

9.27 Reading _Py_DebugOffsets
=============================

Once the address of the ‘PyRuntime’ structure has been determined, the
next step is to read the ‘_Py_DebugOffsets’ structure located at the
beginning of the ‘PyRuntime’ block.

This structure provides version-specific field offsets that are needed
to safely read interpreter and thread state memory.  These offsets vary
between CPython versions and must be checked before use to ensure they
are compatible.

To read and check the debug offsets, follow these steps:

  1. Read memory from the target process starting at the ‘PyRuntime’
     address, covering the same number of bytes as the
     ‘_Py_DebugOffsets’ structure.  This structure is located at the
     very start of the ‘PyRuntime’ memory block.  Its layout is defined
     in CPython’s internal headers and stays the same within a given
     minor version, but may change in major versions.

  2. Check that the structure contains valid data:

        - The ‘cookie’ field must match the expected debug marker.

        - The ‘version’ field must match the version of the Python
          interpreter used by the debugger.

        - If either the debugger or the target process is using a
          pre-release version (for example, an alpha, beta, or release
          candidate), the versions must match exactly.

        - The ‘free_threaded’ field must have the same value in both the
          debugger and the target process.

  3. If the structure is valid, the offsets it contains can be used to
     locate fields in memory.  If any check fails, the debugger should
     stop the operation to avoid reading memory in the wrong format.

The following is an example implementation that reads and checks
‘_Py_DebugOffsets’:

     def read_debug_offsets(pid: int, py_runtime_addr: int) -> DebugOffsets:
         # Step 1: Read memory from the target process at the PyRuntime address
         data = read_process_memory(
             pid, address=py_runtime_addr, size=DEBUG_OFFSETS_SIZE
         )

         # Step 2: Deserialize the raw bytes into a _Py_DebugOffsets structure
         debug_offsets = parse_debug_offsets(data)

         # Step 3: Validate the contents of the structure
         if debug_offsets.cookie != EXPECTED_COOKIE:
             raise RuntimeError("Invalid or missing debug cookie")
         if debug_offsets.version != LOCAL_PYTHON_VERSION:
             raise RuntimeError(
                 "Mismatch between caller and target Python versions"
             )
         if debug_offsets.free_threaded != LOCAL_FREE_THREADED:
             raise RuntimeError("Mismatch in free-threaded configuration")

         return debug_offsets

     警告: 'Process suspension recommended'

     To avoid race conditions and ensure memory consistency, it is
     strongly recommended that the target process be suspended before
     performing any operations that read or write internal interpreter
     state.  The Python runtime may concurrently mutate interpreter data
     structures—such as creating or destroying threads—during normal
     execution.  This can result in invalid memory reads or writes.

     A debugger may suspend execution by attaching to the process with
     ‘ptrace’ or by sending a ‘SIGSTOP’ signal.  Execution should only
     be resumed after debugger-side memory operations are complete.

          注釈: Some tools, such as profilers or sampling-based
          debuggers, may operate on a running process without
          suspension.  In such cases, tools must be explicitly designed
          to handle partially updated or inconsistent memory.  For most
          debugger implementations, suspending the process remains the
          safest and most robust approach.


File: python.info,  Node: Locating the interpreter and thread state,  Next: Writing control information,  Prev: Reading _Py_DebugOffsets,  Up: Python HOWTO

9.28 Locating the interpreter and thread state
==============================================

Before code can be injected and executed in a remote Python process, the
debugger must choose a thread in which to schedule execution.  This is
necessary because the control fields used to perform remote code
injection are located in the ‘_PyRemoteDebuggerSupport’ structure, which
is embedded in a ‘PyThreadState’ object.  These fields are modified by
the debugger to request execution of injected scripts.

The ‘PyThreadState’ structure represents a thread running inside a
Python interpreter.  It maintains the thread’s evaluation context and
contains the fields required for debugger coordination.  Locating a
valid ‘PyThreadState’ is therefore a key prerequisite for triggering
execution remotely.

A thread is typically selected based on its role or ID. In most cases,
the main thread is used, but some tools may target a specific thread by
its native thread ID. Once the target thread is chosen, the debugger
must locate both the interpreter and the associated thread state
structures in memory.

The relevant internal structures are defined as follows:

   - ‘PyInterpreterState’ represents an isolated Python interpreter
     instance.  Each interpreter maintains its own set of imported
     modules, built-in state, and thread state list.  Although most
     Python applications use a single interpreter, CPython supports
     multiple interpreters in the same process.

   - ‘PyThreadState’ represents a thread running within an interpreter.
     It contains execution state and the control fields used by the
     debugger.

To locate a thread:

  1. Use the offset ‘runtime_state.interpreters_head’ to obtain the
     address of the first interpreter in the ‘PyRuntime’ structure.
     This is the entry point to the linked list of active interpreters.

  2. Use the offset ‘interpreter_state.threads_main’ to access the main
     thread state associated with the selected interpreter.  This is
     typically the most reliable thread to target.

  3. Optionally, use the offset ‘interpreter_state.threads_head’ to
     iterate through the linked list of all thread states.  Each
     ‘PyThreadState’ structure contains a ‘native_thread_id’ field,
     which may be compared to a target thread ID to find a specific
     thread.

  4. Once a valid ‘PyThreadState’ has been found, its address can be
     used in later steps of the protocol, such as writing debugger
     control fields and scheduling execution.

The following is an example implementation that locates the main thread
state:

     def find_main_thread_state(
         pid: int, py_runtime_addr: int, debug_offsets: DebugOffsets,
     ) -> int:
         # Step 1: Read interpreters_head from PyRuntime
         interp_head_ptr = (
             py_runtime_addr + debug_offsets.runtime_state.interpreters_head
         )
         interp_addr = read_pointer(pid, interp_head_ptr)
         if interp_addr == 0:
             raise RuntimeError("No interpreter found in the target process")

         # Step 2: Read the threads_main pointer from the interpreter
         threads_main_ptr = (
             interp_addr + debug_offsets.interpreter_state.threads_main
         )
         thread_state_addr = read_pointer(pid, threads_main_ptr)
         if thread_state_addr == 0:
             raise RuntimeError("Main thread state is not available")

         return thread_state_addr

The following example demonstrates how to locate a thread by its native
thread ID:

     def find_thread_by_id(
         pid: int,
         interp_addr: int,
         debug_offsets: DebugOffsets,
         target_tid: int,
     ) -> int:
         # Start at threads_head and walk the linked list
         thread_ptr = read_pointer(
             pid,
             interp_addr + debug_offsets.interpreter_state.threads_head
         )

         while thread_ptr:
             native_tid_ptr = (
                 thread_ptr + debug_offsets.thread_state.native_thread_id
             )
             native_tid = read_int(pid, native_tid_ptr)
             if native_tid == target_tid:
                 return thread_ptr
             thread_ptr = read_pointer(
                 pid,
                 thread_ptr + debug_offsets.thread_state.next
             )

         raise RuntimeError("Thread with the given ID was not found")

Once a valid thread state has been located, the debugger can proceed
with modifying its control fields and scheduling execution, as described
in the next section.


File: python.info,  Node: Writing control information,  Next: Summary,  Prev: Locating the interpreter and thread state,  Up: Python HOWTO

9.29 Writing control information
================================

Once a valid ‘PyThreadState’ structure has been identified, the debugger
may modify control fields within it to schedule the execution of a
specified Python script.  These control fields are checked periodically
by the interpreter, and when set correctly, they trigger the execution
of remote code at a safe point in the evaluation loop.

Each ‘PyThreadState’ contains a ‘_PyRemoteDebuggerSupport’ structure
used for communication between the debugger and the interpreter.  The
locations of its fields are defined by the ‘_Py_DebugOffsets’ structure
and include the following:

   - ‘debugger_script_path’: A fixed-size buffer that holds the full
     path to a Python source file (‘.py’).  This file must be accessible
     and readable by the target process when execution is triggered.

   - ‘debugger_pending_call’: An integer flag.  Setting this to ‘1’
     tells the interpreter that a script is ready to be executed.

   - ‘eval_breaker’: A field checked by the interpreter during
     execution.  Setting bit 5 (‘_PY_EVAL_PLEASE_STOP_BIT’, value ‘1U <<
     5’) in this field causes the interpreter to pause and check for
     debugger activity.

To complete the injection, the debugger must perform the following
steps:

  1. Write the full script path into the ‘debugger_script_path’ buffer.

  2. Set ‘debugger_pending_call’ to ‘1’.

  3. Read the current value of ‘eval_breaker’, set bit 5
     (‘_PY_EVAL_PLEASE_STOP_BIT’), and write the updated value back.
     This signals the interpreter to check for debugger activity.

The following is an example implementation:

     def inject_script(
         pid: int,
         thread_state_addr: int,
         debug_offsets: DebugOffsets,
         script_path: str
     ) -> None:
         # Compute the base offset of _PyRemoteDebuggerSupport
         support_base = (
             thread_state_addr +
             debug_offsets.debugger_support.remote_debugger_support
         )

         # Step 1: Write the script path into debugger_script_path
         script_path_ptr = (
             support_base +
             debug_offsets.debugger_support.debugger_script_path
         )
         write_string(pid, script_path_ptr, script_path)

         # Step 2: Set debugger_pending_call to 1
         pending_ptr = (
             support_base +
             debug_offsets.debugger_support.debugger_pending_call
         )
         write_int(pid, pending_ptr, 1)

         # Step 3: Set _PY_EVAL_PLEASE_STOP_BIT (bit 5, value 1 << 5) in
         # eval_breaker
         eval_breaker_ptr = (
             thread_state_addr +
             debug_offsets.debugger_support.eval_breaker
         )
         breaker = read_int(pid, eval_breaker_ptr)
         breaker |= (1 << 5)
         write_int(pid, eval_breaker_ptr, breaker)

Once these fields are set, the debugger may resume the process (if it
was suspended).  The interpreter will process the request at the next
safe evaluation point, load the script from disk, and execute it.

It is the responsibility of the debugger to ensure that the script file
remains present and accessible to the target process during execution.

     注釈: Script execution is asynchronous.  The script file cannot be
     deleted immediately after injection.  The debugger should wait
     until the injected script has produced an observable effect before
     removing the file.  This effect depends on what the script is
     designed to do.  For example, a debugger might wait until the
     remote process connects back to a socket before removing the
     script.  Once such an effect is observed, it is safe to assume the
     file is no longer needed.


File: python.info,  Node: Summary,  Prev: Writing control information,  Up: Python HOWTO

9.30 Summary
============

To inject and execute a Python script in a remote process:

  1. Locate the ‘PyRuntime’ structure in the target process’s memory.

  2. Read and validate the ‘_Py_DebugOffsets’ structure at the beginning
     of ‘PyRuntime’.

  3. Use the offsets to locate a valid ‘PyThreadState’.

  4. Write the path to a Python script into ‘debugger_script_path’.

  5. Set the ‘debugger_pending_call’ flag to ‘1’.

  6. Set ‘_PY_EVAL_PLEASE_STOP_BIT’ in the ‘eval_breaker’ field.

  7. Resume the process (if suspended).  The script will execute at the
     next safe evaluation point.

General:

   * *note A Conceptual Overview of asyncio: 37b7.

   * *note Annotations Best Practices: 9d9.

   * *note Argparse チュートリアル: 336c.

   * *note デスクリプタ ガイド: 1706.

   * *note 列挙型 HOWTO: 56f0.

   * *note 関数型プログラミング HOWTO: 5722.

   * *note ipaddressモジュールの紹介: 41c8.

   * *note Logging HOWTO: 5741.

   * *note Logging クックブック: 1410.

   * *note 正規表現 HOWTO: 2762.

   * *note ソートのテクニック: 13f3.

   * *note Unicode HOWTO: 14bc.

   * *note urllib
     パッケージを使ってインターネット上のリソースを取得するには: 3f8a.

Advanced development:

   * *note Python で Curses プログラミング: 345f.

   * *note Python support for free threading: 2619.

   * *note C API Extension Support for Free Threading: 585d.

   * *note 拡張モジュールを分離する: 166.

   * *note The Python 2.3 Method Resolution Order: 16c3.

   * *note ソケットプログラミング HOWTO: 39a1.

   * *note timer file descriptor HOWTO: 584e.

   * *note Python 3 への拡張モジュール移植: 14f8.

Debugging and profiling:

   * *note Debugging C API extensions and CPython Internals with GDB:
     56e1.

   * *note DTrace と SystemTap で CPython を測定する: e66.

   * *note Python support for the Linux perf profiler: 4ae.

   * *note Remote debugging attachment protocol: 4927.


File: python.info,  Node: Python よくある質問,  Next: 非推奨<14>,  Prev: Python HOWTO,  Up: Top

10 Python よくある質問
**********************

* Menu:

* 一般 Python FAQ::
* プログラミング FAQ::
* デザインと歴史 FAQ::
* ライブラリと拡張 FAQ::
* 拡張と埋め込み FAQ::
* Windows 上の Python FAQ::
* グラフィックユーザインターフェース FAQ::
* "なぜ Python が私のコンピュータにインストールされているのですか？" FAQ::


File: python.info,  Node: 一般 Python FAQ,  Next: プログラミング FAQ,  Up: Python よくある質問

10.1 一般 Python FAQ
====================

* Menu:

* 一般情報::
* 現実世界での Python::


File: python.info,  Node: 一般情報,  Next: 現実世界での Python,  Up: 一般 Python FAQ

10.1.1 一般情報
---------------

* Menu:

* Python とは何ですか？::
* Python Software Foundation とは何ですか？::
* Python を使うのに著作権の制限はありますか？::
* そもそも Python は何故創られたのですか？::
* Python は何をするのに向いていますか？::
* Python のバージョン番号の仕組みはどうなっているのですか？::
* Python のソースのコピーはどこで手に入りますか？::
* Python のドキュメントはどこで手に入りますか？::
* プログラミングをしたことがないのですが、Python のチュートリアルはありますか？::
* Python のためのニュースグループやメーリングリストはありますか？::
* Python のベータテスト版はどこで手に入りますか？::
* Python のバグ報告やパッチを上げるにはどうしたら良いですか？::
* Python について発行された記事を何か参照できますか？::
* Python の本はありますか？::
* www.python.org は世界のどこにあるのですか？: www python org は世界のどこにあるのですか？.
* なぜ Python という名前なのですか？::
* 『空飛ぶモンティ・パイソン』を好きでなくてはいけませんか？::


File: python.info,  Node: Python とは何ですか？,  Next: Python Software Foundation とは何ですか？,  Up: 一般情報

10.1.1.1 Python とは何ですか？
..............................

Python は、インタプリタ形式の、対話的な、オブジェクト指向プログラミング
言語です。この言語には、モジュール、例外、動的な型付け、超高水準の動的な
データ型、およびクラスが取り入れられています。 Pythonは、オブジェクト指
向プログラミングを越えて、手続き型プログラミングや関数型プログラミングな
ど複数のプログラミングパラダイムをサポートしています。 Python は驚くべき
パワーと非常に分かりやすい文法を持ち合わせています。そして、多くのシステ
ムコールやライブラリへだけでなく、様々なウィンドウシステムへのインターフ
ェースがあり、C や C++ で拡張することもできます。また、プログラム可能な
インターフェースが必要なアプリケーションのための拡張言語としても利用でき
ます。最後に、Python はポータブルです。Linux や macOS を含む多くの Unix
の派生システムで動き、Windows でも動きます。

さらに知りたければ、 *note Python チュートリアル: 1fbc. から始めましょう
。他にも、 Beginner's Guide to Python(1) から、Python 学習のための入門用
チュートリアルやリソースを参照できます。

   ---------- Footnotes ----------

   (1) https://wiki.python.org/moin/BeginnersGuide


File: python.info,  Node: Python Software Foundation とは何ですか？,  Next: Python を使うのに著作権の制限はありますか？,  Prev: Python とは何ですか？,  Up: 一般情報

10.1.1.2 Python Software Foundation とは何ですか？
..................................................

Python Software Foundation は、Python バージョン 2.1 以降の著作権を保持
する独立の非営利組織です。PSF の任務は、Python プログラミング言語に関す
るオープンソース技術を進め、Python の使用を広めることです。PSF のホーム
ページが ‘https://www.python.org/psf/’ にあります。

PSF への寄付は米国で免税されています。Python を利用して役立ったと感じた
ら、the PSF donation page(1) で貢献をお願いします。

   ---------- Footnotes ----------

   (1) https://www.python.org/psf/donations/


File: python.info,  Node: Python を使うのに著作権の制限はありますか？,  Next: そもそも Python は何故創られたのですか？,  Prev: Python Software Foundation とは何ですか？,  Up: 一般情報

10.1.1.3 Python を使うのに著作権の制限はありますか？
....................................................

あなたが作成する Python に関するドキュメントのすべてに著作権を残し、それ
らの著作権を表示する限り、ソースコードをどのように扱ってもかまいません。
この著作権規則を尊重する限り、商用に Python を利用しても、ソースあるいは
バイナリ形式で(変更の有無にかかわらず) Python のコピーを販売しても、
Python が何らかの形で組み込まれた製品を販売してかまいません。もちろん、
Python のあらゆる商業用途についても同様です。

PSF License のより詳しい説明と全文へのリンクは the license page(1) を参
照してください。

Python のロゴは商標登録されていて、使用に許可が必要な場合があります。詳
しい情報は the Trademark Usage Policy(2) を参照してください。

   ---------- Footnotes ----------

   (1) https://docs.python.org/3/license.html

   (2) https://www.python.org/psf/trademarks/


File: python.info,  Node: そもそも Python は何故創られたのですか？,  Next: Python は何をするのに向いていますか？,  Prev: Python を使うのに著作権の制限はありますか？,  Up: 一般情報

10.1.1.4 そもそも Python は何故創られたのですか？
.................................................

Guido van Rossum によると、すべての始まりについての '非常に' 簡潔な概要
は以下のとおりです:

     私は CWI の ABC グループでインタプリタ言語を実装する幅広い経験をし
     ていて、そこで共に働くことで言語設計に関して大いに学びました。これ
     は文のグループ化にインデントを使用することや超高水準のデータ型の包
     含など、(詳細は Python とは全く異なりますが) Python の多くの特徴の
     もととなっています。

     私は ABC 言語に対して多くの不満を持っていましたが、同時に特徴の多く
     が好きでもありました。ABC 言語 (やその実装)を拡張して私の不満を解消
     することは不可能でした (実際、拡張性の欠如は大きな問題だったのです
     )。私は Modula-2+ を使用することでいくらかの経験を積み、Modula-3 の
     デザイナーと話して Modula-3 のレポートを読みました。Modula-3 は例外
     処理に使う構文や語義、その他いくつかの Python の特徴の起源です。

     私は CWI で Amoeba 分散オペレーティングシステムのグループで働いてい
     ました。Amoeba のシステムコールインターフェースには Bourne シェルか
     らアクセスしにくかったので、C プログラムや Bourne シェルスクリプト
     を書くよりも良いシステム管理の方法が必要でした。Amoeba のエラー処理
     の経験から、プログラミング言語の機能としての例外の重要さを強く意識
     するようになりました。

     ABC のような構文と Amoeba のようなシステムコールを合わせ持ったスク
     リプト言語が必要だろうと思いつきました。Amoeba 専用の言語を書くのは
     愚かであるだろうと気づき、一般に拡張できるような言語を求めることに
     決めました。

     1989 年のクリスマス休暇の間、自由な時間がたくさんできたので、その言
     語を実際に作ってみることにしました。翌年の間、勤務時間以外はほとん
     どその開発に費やし、Python は Amoeba プロジェクトのなかで成果を重ね
     、同僚からのフィードバックは私の開発を大いに加速させてくれました。

     1991 年 2 月、1 年間と少しの開発を経て、USENET に投稿することにしま
     した。それは ‘Misc/HISTORY’ ファイルに残っています。


File: python.info,  Node: Python は何をするのに向いていますか？,  Next: Python のバージョン番号の仕組みはどうなっているのですか？,  Prev: そもそも Python は何故創られたのですか？,  Up: 一般情報

10.1.1.5 Python は何をするのに向いていますか？
..............................................

Python は、多岐にわたる問題に適用できる高水準な汎用プログラム言語です。

この言語は、文字列処理(正規表現、Unicode、ファイル間の差分の計算)、イン
ターネットプロトコル(HTTP、FTP、SMTP、XML-RPC、POP、IMAP)、ソフトウェア
エンジニアリング(Python コードのユニットテスト、ロギング、プロファイリン
グ、解析)、オペレーティングシステムインターフェース(システムコール、ファ
イルシステム、 TCP/IP ソケット) のような領域をカバーする大規模な標準ライ
ブラリから成り立っています。何ができるかを知るには *note Python
標準ライブラリ: 149. の一覧を参照してください。また、様々なサードパーテ
ィの拡張も使えます。 the Python Package Index(1) から興味のあるパッケー
ジを探してみましょう。

   ---------- Footnotes ----------

   (1) https://pypi.org


File: python.info,  Node: Python のバージョン番号の仕組みはどうなっているのですか？,  Next: Python のソースのコピーはどこで手に入りますか？,  Prev: Python は何をするのに向いていますか？,  Up: 一般情報

10.1.1.6 Python のバージョン番号の仕組みはどうなっているのですか？
..................................................................

Python のバージョン番号は "A.B.C" または "A.B" が付けられます :

   * 'A' はメジャーバージョン番号です - 言語に本当に大きな変更があった場
     合に増やされます。

   * 'B' はマイナーバージョン番号です - 驚きの少ない変更があった場合に増
     やされます。

   * 'C' はマイクロバージョン番号です - バグフィックスリリースごとに増や
     されます。

すべてのリリースがバグフィックスリリースであるというわけではありません。
フィーチャーリリースへの準備段階では、一連の開発リリースが作られ、アルフ
ァ版、ベータ版、またはリリース候補と名付けられます。アルファ版はインター
フェースが確定されないうちにリリースされる早期リリースで、２つのアルファ
リリース間でインターフェースが変わるかもしれません。ベータ版はもっと安定
していて、現存のインターフェースは保存されますが新しいモジュールが追加さ
れるかもしれません。リリース候補は固まったもので、致命的なバグを直すので
なければ変更されません。

アルファ、ベータとリリース候補のバージョンは、追加の接尾辞を持ちます:

   * アルファバージョンの接尾辞は、ある小さな数 'N' に対して "aN "となり
     ます。

   * ベータバージョンの接尾辞は、ある小さな数 'N' に対して "bN" となりま
     す。

   * リリース候補バージョンの接尾辞は、ある小さな数 'N' に対して "rcN" と
     なります。

つまり、 '2.0aN' と付けられたバージョンはすべて '2.0bN' に先立ち、
'2.0bN' は '2.0rcN' に先立ち、そして 'これら' は 2.0 に先立ちます。

また、"2.2+" のように "+" 接尾語が付いたバージョン番号もあります。これは
未発表のバージョンで、 CPython 開発リポジトリから直接ビルドされています
。実際、最後のマイナーリリースが行われた後、バージョンは "2.4a0" のよう
に "a0" がつく次のマイナーバージョンになります。

開発サイクルの詳細は Developer's Guide(1) を、 Python の後方互換性ポリシ
ーについては PEP 387(2) を参照してください。 ドキュメント *note
sys.version: 49c. 、 *note sys.hexversion: 4921. 、 *note
sys.version_info: 8af. も参照してください。

   ---------- Footnotes ----------

   (1) https://devguide.python.org/developer-workflow/development-cycle/

   (2) https://peps.python.org/pep-0387/


File: python.info,  Node: Python のソースのコピーはどこで手に入りますか？,  Next: Python のドキュメントはどこで手に入りますか？,  Prev: Python のバージョン番号の仕組みはどうなっているのですか？,  Up: 一般情報

10.1.1.7 Python のソースのコピーはどこで手に入りますか？
........................................................

最新の Python ソースは python.org (‘https://www.python.org/downloads/’)
からいつでも手に入れることができます。最新の開発版ソースは
‘https://github.com/python/cpython/’ にアクセスして手に入れることができ
ます。

ソースは gzip された tar ファイルで配布され、完全な C のソース、Sphinx に
よりフォーマットされたドキュメント、Python ライブラリモジュール、サンプ
ルプログラム、そしていくつかの役立つ配布自由なソフトウェアを含んでいます
。このソースはほとんどの UNIX プラットフォームでそのままコンパイルして動
かせます。

ソースコードの入手とコンパイルについて、より詳しい情報は Getting Started
section of the Python Developer's Guide(1) を参照してください。

   ---------- Footnotes ----------

   (1) https://devguide.python.org/setup/


File: python.info,  Node: Python のドキュメントはどこで手に入りますか？,  Next: プログラミングをしたことがないのですが、Python のチュートリアルはありますか？,  Prev: Python のソースのコピーはどこで手に入りますか？,  Up: 一般情報

10.1.1.8 Python のドキュメントはどこで手に入りますか？
......................................................

現行の安定版 Python の標準ドキュメントは ‘https://docs.python.org/3/’ か
ら利用できます。 また、 EPUB 、プレーンテキスト、ダウンロード可能な HTML
版も ‘https://docs.python.org/3/download.html’ から利用できます。

このドキュメントは reStructuredText で書かれ、the Sphinx documentation
tool(1) で構成されました。このドキュメントに使われた reStructuredText の
ソースは Python のソース配布に含まれます。

   ---------- Footnotes ----------

   (1) https://www.sphinx-doc.org/


File: python.info,  Node: プログラミングをしたことがないのですが、Python のチュートリアルはありますか？,  Next: Python のためのニュースグループやメーリングリストはありますか？,  Prev: Python のドキュメントはどこで手に入りますか？,  Up: 一般情報

10.1.1.9 プログラミングをしたことがないのですが、Python のチュートリアルはありますか？
......................................................................................

膨大な量の役に立つチュートリアルや書籍があります。標準のドキュメントには
*note Python チュートリアル: 1fbc. などがあります。

Python プログラム初心者のための情報のチュートリアルのリストは the
Beginner's Guide(1) を参照してください。

   ---------- Footnotes ----------

   (1) https://wiki.python.org/moin/BeginnersGuide


File: python.info,  Node: Python のためのニュースグループやメーリングリストはありますか？,  Next: Python のベータテスト版はどこで手に入りますか？,  Prev: プログラミングをしたことがないのですが、Python のチュートリアルはありますか？,  Up: 一般情報

10.1.1.10 Python のためのニュースグループやメーリングリストはありますか？
.........................................................................

ニュースグループ ‘comp.lang.python’ やメーリングリスト python-list(1) が
あります。ニュースグループとメーリングリストは互いに接続されていて、ニュ
ースを購読すればメーリングリストに参加する必要はありません。
‘comp.lang.python’ は一日に数百のポスティングを受ける高いトラフィックで
、USENET 読者は多くの場合、このボリュームに応えることができます。

新しいソフトウェアリリースとイベントの告知は comp.lang.python.announce で
見つけられます。これは一日に 5 ポスティング程度を受ける低トラフィックの
手頃なメーリングリストです。the python-announce mailing list(2) から利用
可能です。

その他のメーリングリストやニュースグループについての詳しい情報は
‘https://www.python.org/community/lists/’ にあります。

   ---------- Footnotes ----------

   (1) https://mail.python.org/mailman/listinfo/python-list

   (2) 
https://mail.python.org/mailman3/lists/python-announce-list.python.org/


File: python.info,  Node: Python のベータテスト版はどこで手に入りますか？,  Next: Python のバグ報告やパッチを上げるにはどうしたら良いですか？,  Prev: Python のためのニュースグループやメーリングリストはありますか？,  Up: 一般情報

10.1.1.11 Python のベータテスト版はどこで手に入りますか？
.........................................................

アルファ/ベータリリースは ‘https://www.python.org/downloads/’ で手に入り
ます。リリースはすべて comp.lang.python や comp.lang.python.announce の
ニュースグループと Python ホームページ ‘https://www.python.org/’ で告知
され、RSS ニュースフィードが利用できます。

Git から開発版を手に入れることもできます。詳細は The Python Developer's
guide(1) を参照してください。

   ---------- Footnotes ----------

   (1) https://devguide.python.org/


File: python.info,  Node: Python のバグ報告やパッチを上げるにはどうしたら良いですか？,  Next: Python について発行された記事を何か参照できますか？,  Prev: Python のベータテスト版はどこで手に入りますか？,  Up: 一般情報

10.1.1.12 Python のバグ報告やパッチを上げるにはどうしたら良いですか？
.....................................................................

バグの報告やパッチの提出には、issue tracker
‘https://github.com/python/CPython/issues’ をご利用ください。

Python 開発の工程について、詳しくは the Python Developer's Guide(1) を参
照してください。

   ---------- Footnotes ----------

   (1) https://devguide.python.org/


File: python.info,  Node: Python について発行された記事を何か参照できますか？,  Next: Python の本はありますか？,  Prev: Python のバグ報告やパッチを上げるにはどうしたら良いですか？,  Up: 一般情報

10.1.1.13 Python について発行された記事を何か参照できますか？
.............................................................

Python に関するあなたの愛読書を引用するのが一番でしょう。

Python に関する 一番初めの記事(1) はとても古く、1991年に書かれています。

     Guido van Rossum and Jelke de Boer, "Interactively Testing Remote
     Servers Using the Python Programming Language", CWI Quarterly,
     Volume 4, Issue 4 (December 1991), Amsterdam, pp 283-303.

   ---------- Footnotes ----------

   (1) https://ir.cwi.nl/pub/18204


File: python.info,  Node: Python の本はありますか？,  Next: www python org は世界のどこにあるのですか？,  Prev: Python について発行された記事を何か参照できますか？,  Up: 一般情報

10.1.1.14 Python の本はありますか？
...................................

はい、たくさんあり、そのほとんどは現在も出版されています。リストは
python.org wiki ‘https://wiki.python.org/moin/PythonBooks’ にあります。

また、オンライン書店で "Python" で検索し、Monty Python をフィルタで除外
してもいいです (または、"Python" と "言語" で検索してください)。


File: python.info,  Node: www python org は世界のどこにあるのですか？,  Next: なぜ Python という名前なのですか？,  Prev: Python の本はありますか？,  Up: 一般情報

10.1.1.15 www.python.org は世界のどこにあるのですか？
.....................................................

Pythonプロジェクトのインフラは世界中にあり、Pythonインフラストラクチャチ
ームによって管理されています。詳細は こちら(1).

   ---------- Footnotes ----------

   (1) https://infra.psf.io


File: python.info,  Node: なぜ Python という名前なのですか？,  Next: 『空飛ぶモンティ・パイソン』を好きでなくてはいけませんか？,  Prev: www python org は世界のどこにあるのですか？,  Up: 一般情報

10.1.1.16 なぜ Python という名前なのですか？
............................................

Python の開発が始まった頃、Guido van Rossum は 1970 年代に始まった BBC の
コメディシリーズ "Monty Python's Flying Circus"(1) の台本を読んでいまし
た。Van Rossum は、短くて、ユニークで、少しミステリアスな名前が欲しかっ
たので、この言語の名前を Python と呼ぶことにしたのです。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/Monty_Python


File: python.info,  Node: 『空飛ぶモンティ・パイソン』を好きでなくてはいけませんか？,  Prev: なぜ Python という名前なのですか？,  Up: 一般情報

10.1.1.17 『空飛ぶモンティ・パイソン』を好きでなくてはいけませんか？
....................................................................

いいえ。でも、好きになってくれるといいな。: ）


File: python.info,  Node: 現実世界での Python,  Prev: 一般情報,  Up: 一般 Python FAQ

10.1.2 現実世界での Python
--------------------------

* Menu:

* Python はどれくらい安定していますか？::
* どれくらいの人が Python を使っていますか？::
* Python で行われた大きなプロジェクトはありますか？::
* 将来 Python にどのような新しい開発が期待されますか？::
* Python の互換性を無くすような提案をしてもいいのですか？::
* Python は初心者プログラマに向いている言語ですか？::


File: python.info,  Node: Python はどれくらい安定していますか？,  Next: どれくらいの人が Python を使っていますか？,  Up: 現実世界での Python

10.1.2.1 Python はどれくらい安定していますか？
..............................................

とても安定しています。1991 年以来新しい安定リリースはおよそ 6 から 18 ヶ
月毎に出されていて、このペースが続きそうです。バージョン3.9の時点では、
Pythonは12ヶ月に一度のペースで新しいフィーチャーリリースを行っています (
PEP 602(1)) 。

開発者が旧バージョンのバグフィックスリリースを公開するので、既存リリース
の安定性は徐々に向上していきます。バグフィックスリリースは、バージョン番
号の 3 番目の要素によって示され(例: 3.5.3、3.6.2)、安定性のために管理さ
れています。バグフィックスリリースには既知の問題への修正だけが含まれ、一
連のバグフィックスリリースを通じて同じインターフェースが保たれることが保
証されているのです。

最新の安定版は Python download page(2) で見つけられます。 Python 3.x が
推奨されるバージョンで、最も広く利用されているライブラリでサポートされて
います。 Python 2.x は もはや保守されていません(3) 。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0602/

   (2) https://www.python.org/downloads/

   (3) https://peps.python.org/pep-0373/


File: python.info,  Node: どれくらいの人が Python を使っていますか？,  Next: Python で行われた大きなプロジェクトはありますか？,  Prev: Python はどれくらい安定していますか？,  Up: 現実世界での Python

10.1.2.2 どれくらいの人が Python を使っていますか？
...................................................

正確な人数を調べるのは難しいですが、おそらく何百万人ものユーザーがいるで
しょう。

Python は自由にダウンロード可能なので、売上高がなく、多数のサイトから利
用でき、多くの Linux ディストーションに同梱されているので、ダウンロード
統計から全体の状況を知ることはできません。

comp.lang.python ニュースグループはとても活発ですが、すべての Python ユ
ーザーが投稿するわけではなく、読みすらしない人もいます。


File: python.info,  Node: Python で行われた大きなプロジェクトはありますか？,  Next: 将来 Python にどのような新しい開発が期待されますか？,  Prev: どれくらいの人が Python を使っていますか？,  Up: 現実世界での Python

10.1.2.3 Python で行われた大きなプロジェクトはありますか？
..........................................................

Python を利用しているプロジェクトのリストは
‘https://www.python.org/about/success’ を参照してください。past Python
conferences(1) から議事録を参照すると、多くの会社や組織の貢献がわかるで
しょう。

注目されている Python のプロジェクトは the Mailman mailing list
manager(2) や the Zope application server(3) などです。Red Hat(4) をはじ
めとするいくつかの Linux ディストーションのインストーラやシステムアドミ
ニストレーションソフトウェアは、一部や全部が Python で書かれています。内
部で Python を利用している企業には、Google、Yahoo、Lucasfilm Ltd.  など
があります。

   ---------- Footnotes ----------

   (1) https://www.python.org/community/workshops/

   (2) https://www.list.org

   (3) https://www.zope.dev

   (4) https://www.redhat.com


File: python.info,  Node: 将来 Python にどのような新しい開発が期待されますか？,  Next: Python の互換性を無くすような提案をしてもいいのですか？,  Prev: Python で行われた大きなプロジェクトはありますか？,  Up: 現実世界での Python

10.1.2.4 将来 Python にどのような新しい開発が期待されますか？
.............................................................

Python Enhancement Proposals (PEP) ‘https://peps.python.org/’ を参照して
ください。PEP は Python に提案された新機能について書かれた設計書で、簡潔
な技術仕様と原理が提供されています。"Python X.Y Release Schedule" (X.Y は
まだリリースされていないバージョン) を探してください。

新しい開発については the python-dev mailing list(1) で議論されています。

   ---------- Footnotes ----------

   (1) https://mail.python.org/mailman3/lists/python-dev.python.org/


File: python.info,  Node: Python の互換性を無くすような提案をしてもいいのですか？,  Next: Python は初心者プログラマに向いている言語ですか？,  Prev: 将来 Python にどのような新しい開発が期待されますか？,  Up: 現実世界での Python

10.1.2.5 Python の互換性を無くすような提案をしてもいいのですか？
................................................................

一般的には、してはいけません。世界中にすでに何百万行もの Python コードが
あるので、既存のプログラムのどんなに僅かな部分でも無効にしてしまうような
言語仕様の変更も認められてはなりません。コンバートするプログラムが出来て
さえ、すべてのドキュメントをアップデートしなければならないという問題があ
ります。 Python に関する多くの本が出版されているので、それらを一発で不適
切にするようなことはしたくないです。

仕様を変えなければならないのなら、緩やかなアップグレード計画が組まれなく
てはなりません。 PEP 5(1) で、ユーザーの受ける分裂を最小限にしながら後方
互換性のない変更を行うために従うべき手順について説明しています。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0005/


File: python.info,  Node: Python は初心者プログラマに向いている言語ですか？,  Prev: Python の互換性を無くすような提案をしてもいいのですか？,  Up: 現実世界での Python

10.1.2.6 Python は初心者プログラマに向いている言語ですか？
..........................................................

はい。

未だにプログラミング初学者にとって一般的なのは、Pascal、C、C++ のサブセ
ット、 Java など、手続き型の静的型付けの言語です。生徒にとっては、第一の
言語として Python を学ぶのが役に立つでしょう。Python には非常に簡潔で一
貫した構文と大きな標準ライブラリがあります。そして一番重要なことに、初心
者プログラミングのコースで Python を学ぶことで、生徒は問題の分析やデータ
型の設計など、重要なプログラミングスキルに集中することができるのです。
Python なら、生徒はループや手続きなどの基本概念をすぐに取り入れられます
。最初の課程でいきなりユーザ定義のオブジェクトを操ることさえできるでしょ
う。

プログラミングをしたことがない初心者にとって、静的型付け言語を使うのは不
自然に思われます。習得すべき内容はより複雑になり、学習のペースが遅くなっ
てしまいます。生徒は、コンピュータのように思考し、問題を分析し、一貫した
インターフェースを設計して、データをカプセル化することを学ぶことになりま
す。長期的に見れば静的型付け言語を学ぶことは重要ですが、それが最初のプロ
グラミングの授業で学ぶべき最高の話題とは限りません。

Python の良いところは他にもたくさんあります。Python には、Java のように
大きな標準ライブラリがあり、生徒が何かを 'する' 段階で非常に早くプログラ
ミングプロジェクトに参加できるようになります。宿題は標準の四則演算機や平
均を求めるプログラムに限定されません。標準ライブラリを使用することで、生
徒はプログラミングの原理を学びながら現実的なアプリケーションに取り組む満
足感を得ることができます。また、標準ライブラリの使用からコードの再利用を
学ぶことができます。 PyGame などのサードパーティモジュールもまた手が届く
範囲を広げるのに役立ちます。

Python のインタラクティブインタプリタによって、プログラミングをしながら
、言語機能を確認することができます。別のウィンドウでプログラムのソースに
入っている間、ウィンドウでインタプリタを起動させたままにしておくことがで
きます。リストのメソッドを思い出せないときは、例えばこのようにできます:

     >>> L = []
     >>> dir(L)
     ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',
     '__dir__', '__doc__', '__eq__', '__format__', '__ge__',
     '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__',
     '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__',
     '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__',
     '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__',
     '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear',
     'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
     'reverse', 'sort']
     >>> [d for d in dir(L) if '__' not in d]
     ['append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']

     >>> help(L.append)
     Help on built-in function append:

     append(...)
         L.append(object) -> None -- append object to end

     >>> L.append(1)
     >>> L
     [1]

インタプリタがあれば、プログラミングをしている間にドキュメントは生徒のそ
ばを離れません。

Python のための良い IDE もあります。IDLE は Python で Tkinter を使って書
かれたクロスプラットフォーム IDE です。Emacs には、ユーザにとって幸運な
ことに、素晴らしい Python モードがあります。これらすべてのプログラミング
環境から、シンタックスハイライト、オートインデント、コーディング中のイン
タラクティブインタプリタへのアクセスが使えます。the Python wiki(1) から
Python 編集環境の一覧を参照してください。

Python の教育における利用についての議論がしたいなら、the edu-sig mailing
list(2) に参加するとよいでしょう。

   ---------- Footnotes ----------

   (1) https://wiki.python.org/moin/PythonEditors

   (2) https://www.python.org/community/sigs/current/edu-sig


File: python.info,  Node: プログラミング FAQ,  Next: デザインと歴史 FAQ,  Prev: 一般 Python FAQ,  Up: Python よくある質問

10.2 プログラミング FAQ
=======================

* Menu:

* 一般的な質問::
* コア言語::
* 数と文字列::
* 性能: 性能<4>.
* シーケンス(タプル/リスト): シーケンス タプル/リスト.
* オブジェクト::
* モジュール: モジュール<5>.


File: python.info,  Node: 一般的な質問,  Next: コア言語,  Up: プログラミング FAQ

10.2.1 一般的な質問
-------------------

* Menu:

* ブレークポイントやシングルステップ実行などを備えたソースコードレベルデバッガはありますか？::
* バグの発見や静的解析に役立つツールはありますか？::
* どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？::
* Python プログラムのためのコーディングスタンダードやスタイルガイドはありますか？::


File: python.info,  Node: ブレークポイントやシングルステップ実行などを備えたソースコードレベルデバッガはありますか？,  Next: バグの発見や静的解析に役立つツールはありますか？,  Up: 一般的な質問

10.2.1.1 ブレークポイントやシングルステップ実行などを備えたソースコードレベルデバッガはありますか？
...................................................................................................

はい。

Python 用のデバッガについては次に解説してあり、組み込みの *note
breakpoint(): 271. 関数でそれらのデバッガに処理を移せます。

pdb モジュールは簡素にして十分な Python のコンソールモードデバッガです。
これは Python の標準ライブラリに含まれているもので、 *note
ライブラリリファレンスマニュアルにドキュメントがあります: aa. 。 pdb の
コードを手本にして自分用のデバッガを書くこともできます。

Python に同梱されている統合開発環境の IDLE は通常の Python の配布形態の
一部 (普通は Tools/scripts/idle3(1) から利用可能) であり、グラフィカルな
デバッガを含んでいます。

PythonWin は、pdb をベースとした GUI デバッガを含む Python IDE です。
Pythonwin デバッガは、ブレークポイントの色付けや非 PythonWin プログラム
のデバッグなどの素敵な機能をたくさん持っています。PythonWin は
pywin32(2) プロジェクトの一部、あるいは ActivePython(3) ディストリビュー
ションの一部として利用可能です。

Eric(4) は PyQt や Scintilla editing component をもとにした IDE です。

trepan3k(5) は gdbライクなデバッガです。

Visual Studio Code(6) はバージョン管理ソフトと一緒になったデバッグツール
を備えた IDE です

商業のグラフィカルデバッガ付き Python IDE もあります。例えば:

   * Wing IDE(7)

   * Komodo IDE(8)

   * PyCharm(9)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/blob/main/Tools/scripts/idle3

   (2) https://github.com/mhammond/pywin32

   (3) https://www.activestate.com/products/python/

   (4) https://eric-ide.python-projects.org/

   (5) https://github.com/rocky/python3-trepan/

   (6) https://code.visualstudio.com/

   (7) https://wingware.com/

   (8) https://www.activestate.com/products/komodo-ide/

   (9) https://www.jetbrains.com/pycharm/


File: python.info,  Node: バグの発見や静的解析に役立つツールはありますか？,  Next: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？,  Prev: ブレークポイントやシングルステップ実行などを備えたソースコードレベルデバッガはありますか？,  Up: 一般的な質問

10.2.1.2 バグの発見や静的解析に役立つツールはありますか？
.........................................................

はい。

Pylint(1) と Pyflakes(2) は、バグの早期発見に役立つ基本的なチェックを行
います。

Mypy(3), Pyre(4), Pytype(5) などの静的型チェッカーは、 Python ソースコー
ドにある型ヒントをチェックできます。

   ---------- Footnotes ----------

   (1) https://pylint.pycqa.org/en/latest/index.html

   (2) https://github.com/PyCQA/pyflakes

   (3) https://mypy-lang.org/

   (4) https://pyre-check.org/

   (5) https://github.com/google/pytype


File: python.info,  Node: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？,  Next: Python プログラムのためのコーディングスタンダードやスタイルガイドはありますか？,  Prev: バグの発見や静的解析に役立つツールはありますか？,  Up: 一般的な質問

10.2.1.3 どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？
.............................................................................

ユーザがダウンロードでき、Python ディストリビューションをインストールせ
ずに実行できるようなスタンドアロンプログラムだけでいいなら、Python を C
コードにコンパイルできなくても構いません。プログラムに対して必要なモジュ
ールを選び、そのモジュールを Python バイナリに束縛して一つの実行可能ファ
イルにまとめる多くのツールがあります。

一つは freeze ツールで、Python ソースツリーに Tools/freeze(1) として含ま
れています。これは Python バイトコードを C 配列に変換します。すべてのモ
ジュールを新しいプログラムに埋め込む C コンパイラで、そのプログラムは
Python モジュールにリンクされます。

これはあなたのソースの (両方の形式の) import 文を再帰的にスキャンし、
import されたモジュールを標準の Python パスと (組み込みモジュールのある)
ソースディレクトリから探します。そして Python で書かれたモジュールのバイ
トコードを C コード (marshal モジュールでコードオブジェクトに変換できる
配列) に変換し、実際にそのプログラム内で使われている組み込みモジュールだ
けが含まれたカスタムメイドの設定ファイルを作成します。そして生成された C
コードをコンパイルして Python インタプリタの残りとリンクし、元のスクリプ
トと全く同じように動作する自己完結的なバイナリを形成します。

以下のパッケージはコンソールやGUIの実行ファイル作成に役立ちます。

   * Nuitka(2) (Cross-platform)

   * PyInstaller(3) (Cross-platform)

   * PyOxidizer(4) (Cross-platform)

   * cx_Freeze(5) (Cross-platform)

   * py2app(6) (macOS only)

   * py2exe(7) (Windows only)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/main/Tools/freeze

   (2) https://nuitka.net/

   (3) https://pyinstaller.org/

   (4) https://pyoxidizer.readthedocs.io/en/stable/

   (5) https://marcelotduarte.github.io/cx_Freeze/

   (6) https://github.com/ronaldoussoren/py2app

   (7) https://www.py2exe.org/


File: python.info,  Node: Python プログラムのためのコーディングスタンダードやスタイルガイドはありますか？,  Prev: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？,  Up: 一般的な質問

10.2.1.4 Python プログラムのためのコーディングスタンダードやスタイルガイドはありますか？
........................................................................................

はい。標準ライブラリモジュールに求められるコーディングスタイルは PEP
8(1) として文書化されています。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0008/


File: python.info,  Node: コア言語,  Next: 数と文字列,  Prev: 一般的な質問,  Up: プログラミング FAQ

10.2.2 コア言語
---------------

* Menu:

* なぜ変数に値があるのに UnboundLocalError が出るのですか？::
* Python のローカルとグローバル変数のルールは何ですか？::
* ループの中で異なる値で定義されたラムダ式が、同じ値を返すのはなぜですか？::
* グローバル変数をモジュール間で共有するにはどうしたらいいですか？::
* モジュールで import を使う際の「ベストプラクティス」は何ですか？::
* なぜオブジェクト間でデフォルト値が共有されるのですか？::
* オプションパラメータやキーワードパラメータを関数から関数へ渡すにはどうしたらいいですか？::
* 実引数と仮引数の違いは何ですか?::
* なぜ list 'y' を変更すると list 'x' も変更されるのですか?::
* 出力引数のある関数 (参照渡し) はどのように書きますか？: 出力引数のある関数 参照渡し はどのように書きますか？.
* Python で高次関数はどのようにつくりますか？::
* Python のオブジェクトはどのようにコピーしますか？::
* オブジェクトのメソッドや属性はどのように見つけますか？::
* コードはどのようにオブジェクトの名前を見つけるのですか？::
* カンマ演算子はなぜ優先されるのですか？::
* C の "?;" 三項演算子と等価なものはありますか？: C の "? " 三項演算子と等価なものはありますか？.
* Python で解し難いワンライナーを書くことはできますか？::
* 関数の引数リストにあるスラッシュ (/) は何を意味しますか？: 関数の引数リストにあるスラッシュ / は何を意味しますか？.


File: python.info,  Node: なぜ変数に値があるのに UnboundLocalError が出るのですか？,  Next: Python のローカルとグローバル変数のルールは何ですか？,  Up: コア言語

10.2.2.1 なぜ変数に値があるのに UnboundLocalError が出るのですか？
..................................................................

もともと動いていたコードが、関数の本体のどこかに代入文を加えるという変更
をしたら *note UnboundLocalError: 174f. を出すのには驚くかもしれません。

このコード:

     >>> x = 10
     >>> def bar():
     ...     print(x)
     ...
     >>> bar()
     10

は動きますが、このコード:

     >>> x = 10
     >>> def foo():
     ...     print(x)
     ...     x += 1

は ‘UnboundLocalError’ になります:

     >>> foo()
     Traceback (most recent call last):
       ...
     UnboundLocalError: local variable 'x' referenced before assignment

これは、あるスコープの中で変数に代入を行うとき、その変数はそのスコープに
対してローカルになり、外のスコープにある同じ名前の変数を隠すからです。
foo の最後の文が ‘x’ に新しい値を代入しているので、コンパイラはこれをロ
ーカル変数であると認識します。その結果、先の ‘print(x)’ が初期化されてい
ないローカル変数を表示しようとして結果はエラーとなります。

上の例では、グローバルであると宣言することで外のスコープにアクセスできま
す:

     >>> x = 10
     >>> def foobar():
     ...     global x
     ...     print(x)
     ...     x += 1
     ...
     >>> foobar()
     10

この明示的な宣言は (表面的には似ているクラスとインスタンス変数の例とは違
って) あなたは実際は他のスコープの変数の値を変えようとしているのだ、とい
うことを知らせるのに必要です:

     >>> print(x)
     11

同様のことを、ネストされたスコープで *note nonlocal: 14bf. 予約語を使う
ことでもできます:

     >>> def foo():
     ...    x = 10
     ...    def bar():
     ...        nonlocal x
     ...        print(x)
     ...        x += 1
     ...    bar()
     ...    print(x)
     ...
     >>> foo()
     10
     11


File: python.info,  Node: Python のローカルとグローバル変数のルールは何ですか？,  Next: ループの中で異なる値で定義されたラムダ式が、同じ値を返すのはなぜですか？,  Prev: なぜ変数に値があるのに UnboundLocalError が出るのですか？,  Up: コア言語

10.2.2.2 Python のローカルとグローバル変数のルールは何ですか？
..............................................................

Python では、関数内で参照されるだけの変数は暗黙的にグローバルとなります
。 関数の本体のどこかで値が変数に代入されたなら、それは明示的にグローバ
ルであると宣言されない限り、ローカルであるとみなされます。

最初はちょっと驚くでしょうが、少し考えると納得できます。一方では、代入さ
れた変数に *note global: 4ac. を要求することで、意図しない副作用を防げま
す。他方では、グローバルな参照の度に ‘global’ が要求されてしまうと、
‘global’ を使ってばかりになってしまいます。ビルトイン関数やインポートさ
れたモジュールの内容を参照するたびにグローバル宣言をしなければならないの
です。その乱雑さは副作用を特定するための ‘global’ 宣言の便利さよりも重大
です。


File: python.info,  Node: ループの中で異なる値で定義されたラムダ式が、同じ値を返すのはなぜですか？,  Next: グローバル変数をモジュール間で共有するにはどうしたらいいですか？,  Prev: Python のローカルとグローバル変数のルールは何ですか？,  Up: コア言語

10.2.2.3 ループの中で異なる値で定義されたラムダ式が、同じ値を返すのはなぜですか？
.................................................................................

for ループを使って、少しずつ異なるラムダを定義 (もしくは簡単な関数) する
とします。例えば:

     >>> squares = []
     >>> for x in range(5):
     ...     squares.append(lambda: x**2)

これで ‘x**2’ を計算する 5 つのラムダのリストが得られます。それらを呼び
出したとき、それぞれ ‘0’、‘1’、‘4’、‘9’、‘16’ を返すと予想するかもしれま
せん。しかし実際にやってみると、全て ‘16’ が返ってくるのを目にするでしょ
う:

     >>> squares[2]()
     16
     >>> squares[4]()
     16

これは、‘x’ がラムダにとってのローカル変数ではなく外側のスコープで定義さ
れていて、ラムダが定義されたときでなく呼び出されたときにアクセスされるた
めに起こります。ループが終わった時点では ‘x’ は ‘4’ であり、従って、全て
の関数は ‘4**2’ つまり ‘16’ を返します。このことは ‘x’ の値を変えてみる
ことで検証でき、ラムダの返り値がどのように変わるのか観察できます:

     >>> x = 8
     >>> squares[2]()
     64

これを避けるためには、グローバルの ‘x’ の値に依存しないために、ラムダに
とってのローカル変数に値を保存する必要があります:

     >>> squares = []
     >>> for x in range(5):
     ...     squares.append(lambda n=x: n**2)

ここで、‘n=x’ は新しいラムダにとってのローカル変数 ‘n’ を作成し、ラムダ
が定義されるときに計算されるので、ループのその時点での ‘x’ と同じ値を持
っています。これは、1 つ目のラムダでは ‘n’ の値は ‘0’ になり、2 つ目では
‘1’、3 つ目では ‘2’ 以下同様、となることを意味します。従って、それぞれの
ラムダは今や正しい値を返すようになりました:

     >>> squares[2]()
     4
     >>> squares[4]()
     16

この動作はラムダに特有なものではなく、通常の関数にも適用されることに注意
してください。


File: python.info,  Node: グローバル変数をモジュール間で共有するにはどうしたらいいですか？,  Next: モジュールで import を使う際の「ベストプラクティス」は何ですか？,  Prev: ループの中で異なる値で定義されたラムダ式が、同じ値を返すのはなぜですか？,  Up: コア言語

10.2.2.4 グローバル変数をモジュール間で共有するにはどうしたらいいですか？
.........................................................................

一つのプログラムのモジュール間で情報を共有する正準な方法は、特別なモジュ
ール (しばしば config や cfg と呼ばれる) を作ることです。単に設定モジュ
ールをアプリケーションのすべてのモジュールにインポートしてください。この
モジュールはグローバルな名前として使えます。それぞれのモジュールのただ一
つのインスタンスがあるので、設定モジュールオブジェクトに対するいかなる変
更も全体に反映されます。例えば:

config.py:

     x = 0   # Default value of the 'x' configuration setting

mod.py:

     import config
     config.x = 1

main.py:

     import config
     import mod
     print(config.x)

なお、同じ理由から、モジュールを使うということは、シングルトンデザインパ
ターンを実装することの基礎でもあります。


File: python.info,  Node: モジュールで import を使う際の「ベストプラクティス」は何ですか？,  Next: なぜオブジェクト間でデフォルト値が共有されるのですか？,  Prev: グローバル変数をモジュール間で共有するにはどうしたらいいですか？,  Up: コア言語

10.2.2.5 モジュールで import を使う際の「ベストプラクティス」は何ですか？
.........................................................................

一般的に ‘from modulename import *’ を使ってはいけません。そのようにする
とインポータの名前空間は汚染され、linter が未定義の名前を発見することが
難しくなります。

モジュールはファイルの先頭でインポートしてください。これによってコードが
必要とする他のモジュールが明確になり、モジュール名がスコープに含まれるか
どうかに迷わなくなります。行に一つのインポートにすると、モジュールのイン
ポートの追加と削除が容易になりますが、行に複数のインポートにすると画面の
領域が少なく済みます。

次の手順でモジュールをインポートするのが、良い習慣になります:

  1. 標準ライブラリモジュール - 例 *note sys: df.、*note os: a5.、*note
     argparse: 7.、*note re: be.

  2. サードパーティのライブラリモジュール (Python の site-packages ディ
     レクトリにあるもの) - 例 ‘dateutil’、‘requests’、‘PIL.Image’、など

  3. 自前で開発したモジュール

循環参照の問題を避けるために、インポートを関数やクラスに移すことが必要な
ときもあります。Gordon McMillan によれば:

     循環参照は両方のモジュールが "import <module>" 形式のインポートを使
     っていれば大丈夫です。二つ目のモジュールが最初のモジュールから名前
     を確保しようとして ("from module import name")、そのインポートがト
     ップレベルにあると駄目です。最初のモジュールが二つ目のモジュールを
     インポートするのに忙しくて、最初のモジュールの名前が利用可能になっ
     ていないからです。

この状況では、二つ目のモジュールが一つの関数の中でのみ使われているならば
、そのインポートは簡単に関数の中に移せます。インポートが呼ばれたとき、最
初のモジュールは初期化を完了していて、二つ目のモジュールは自分のインポー
トをできます。

プラットフォーム依存のモジュールがあるときには、インポートをトップレベル
の外に動かすことも必要です。この場合、ファイルの先頭ではすべてのモジュー
ルをインポートすることさえできないかもしれません。この場合は、対応するプ
ラットフォームに合わせたコードで正しいモジュールをインポートすることを選
ぶと良いです。

循環参照の問題を避けたりモジュールの初期化にかかる時間を減らしたりしたい
なら、単にインポートを関数定義の中などのローカルなスコープに移してくださ
い。この手法は多くのインポートがプログラムがどのように実行されるかに依存
しなくてよいときに特に有効です。ある関数の中でのみモジュールが使われるの
なら、インポートをその関数の中に移すことを考えてもいいでしょう。なお、モ
ジュールを読み込む最初の回はモジュールの初期化の時間のために高価になりえ
ますが、複数回目にモジュールを読み込むのは事実上無料、辞書探索の数回のコ
ストだけで済みます。モジュール名がスコープから外れてさえ、そのモジュール
はおそらく *note sys.modules: 17e6. から利用できるでしょう。


File: python.info,  Node: なぜオブジェクト間でデフォルト値が共有されるのですか？,  Next: オプションパラメータやキーワードパラメータを関数から関数へ渡すにはどうしたらいいですか？,  Prev: モジュールで import を使う際の「ベストプラクティス」は何ですか？,  Up: コア言語

10.2.2.6 なぜオブジェクト間でデフォルト値が共有されるのですか？
...............................................................

この種のバグがよく初心者プログラマに噛み付きます。この関数を考えてみてく
ださい:

     def foo(mydict={}):  # Danger: shared reference to one dict for all calls
         ... compute something ...
         mydict[key] = value
         return mydict

初めてこの関数を呼び出した時、‘mydict’ には一つの要素があります。二回目
には、‘foo()’ が実行されるときに ‘mydict’ には初めから一つの要素をすでに
持っているので、‘mydict’ には二つの要素があります。

関数の呼び出しによって、デフォルトの値に対する新しいオブジェクトが作られ
るのだと予想しがちです。実はそうなりません。デフォルト値は、関数が定義さ
れたときに一度だけ生成されます。この例の辞書のように、そのオブジェクトが
変更されたとき、その後の関数の呼び出しは変更後のオブジェクトを参照します
。

定義の時に、数、文字列、タプル、‘None’ など、イミュータブルなオブジェク
トを使うと変更される危険がありません。辞書、リスト、クラスインスタンスな
どのミュータブルなオブジェクトは混乱のもとです。

この性質から、ミュータブルなオブジェクトをデフォルト値として使わないプロ
グラミング手法がいいです。代わりに、‘None’ をデフォルト値に使い、そのパ
ラメタが ‘None’ である時にだけ、関数の内部で新しいリスト/辞書/その他をつ
くるようにしてください。例えば、こう書かずに:

     def foo(mydict={}):
         ...

代わりに:

     def foo(mydict=None):
         if mydict is None:
             mydict = {}  # create a new dict for local namespace

この性質が便利なこともあります。時間のかかる計算を行う関数があるときに使
われる一般的な技法は、関数が呼び出されるごとにパラメタと結果の値をキャッ
シュし、再び同じ値が要求されたらキャッシュされた値を返すというものです。
これは "memoizing" と呼ばれ、このように実装されます:

     # Callers can only provide two parameters and optionally pass _cache by keyword
     def expensive(arg1, arg2, *, _cache={}):
         if (arg1, arg2) in _cache:
             return _cache[(arg1, arg2)]

         # Calculate the value
         result = ... expensive computation ...
         _cache[(arg1, arg2)] = result           # Store result in the cache
         return result

デフォルト値の代わりに、辞書を含むグローバル変数も使えます。これは好みの
問題です。


File: python.info,  Node: オプションパラメータやキーワードパラメータを関数から関数へ渡すにはどうしたらいいですか？,  Next: 実引数と仮引数の違いは何ですか?,  Prev: なぜオブジェクト間でデフォルト値が共有されるのですか？,  Up: コア言語

10.2.2.7 オプションパラメータやキーワードパラメータを関数から関数へ渡すにはどうしたらいいですか？
.................................................................................................

関数のパラメータリストに引数を ‘*’ と ‘**’ 指定子 (specifier) で集めてく
ださい。そうすれば、位置引数をタプルとして、キーワード引数を辞書として得
られます。これで、他の関数を呼び出すときに ‘*’ と ‘**’ を使ってそれらの
引数を渡せます:

     def f(x, *args, **kwargs):
         ...
         kwargs['width'] = '14.3c'
         ...
         g(x, *args, **kwargs)


File: python.info,  Node: 実引数と仮引数の違いは何ですか?,  Next: なぜ list 'y' を変更すると list 'x' も変更されるのですか?,  Prev: オプションパラメータやキーワードパラメータを関数から関数へ渡すにはどうしたらいいですか？,  Up: コア言語

10.2.2.8 実引数と仮引数の違いは何ですか?
........................................

*note 仮引数 (parameter): 234b. は関数定義に表れる名前で定義されるのに対
し、 *note 実引数 (argument): 67b. は関数を呼び出すときに実際に渡す値の
ことです。仮引数は関数が受け取ることの出来る *note 実引数の型: 234b. を
定義します。例えば、以下のような関数定義があったとして:

     def func(foo, bar=None, **kwargs):
         pass

'foo'、'bar'、'kwargs' は ‘func’ の仮引数です。一方、‘func’ を呼び出すと
きには、例えば:

     func(42, bar=314, extra=somevar)

‘42’、‘314’、‘somevar’ という値は実引数です。


File: python.info,  Node: なぜ list 'y' を変更すると list 'x' も変更されるのですか?,  Next: 出力引数のある関数 参照渡し はどのように書きますか？,  Prev: 実引数と仮引数の違いは何ですか?,  Up: コア言語

10.2.2.9 なぜ list 'y' を変更すると list 'x' も変更されるのですか?
..................................................................

次のようなコードを書いたとします:

     >>> x = []
     >>> y = x
     >>> y.append(10)
     >>> y
     [10]
     >>> x
     [10]

どうして ‘y’ への要素の追加が ‘x’ も変更してしまうのか疑問に思うかもしれ
ません。

このような結果になる2つの要因があります:

  1. 変数とは、単にオブジェクトを参照するための名前に過ぎません。 ‘y =
     x’ とすることは、リストのコピーを作りません - それは ‘x’ が参照する
     のと同じオブジェクトを参照する新しい変数 ‘y’ を作ります。つまり、あ
     るのは一つのオブジェクト(この場合リスト)だけであって、 ‘x’ と ‘y’ の
     両方がそれを参照しているのです。

  2. リストは *note mutable: 15ba. です。内容を変更出来る、ということで
     す。

After the call to *note append(): 23d6, the content of the mutable
object has changed from ‘[]’ to ‘[10]’.  Since both the variables refer
to the same object, using either name accesses the modified value
‘[10]’.

代わりに ‘x’ にイミュータブルを代入すると:

     >>> x = 5  # ints are immutable
     >>> y = x
     >>> x = x + 1  # 5 can't be mutated, we are creating a new object here
     >>> x
     6
     >>> y
     5

この場合ご覧の通り ‘x’ と ‘y’ はまったく同じではありませんね。これは整数
が *note immutable: 15b9. だからで、 ‘x = x + 1’ は整数の ‘5’ の値を変更
しているのではありません; 代わりに新しいオブジェクト(整数 ‘6’)を作って
‘x’ に代入しています (つまり ‘x’ が参照するオブジェクトが変わります)。こ
の代入の後では私たちは 2 つのオブジェクト(整数の ‘6’ と ‘5’)を持っていて
、2 つの変数はそれらを参照しています(‘x’ はいまや ‘6’ を参照していますが
‘y’ は ‘5’ を参照したままです)。

ある演算 (たとえば ‘y.append(10)’, ‘y.sort()’) がオブジェクトを変更する
一方で、外見上は似た演算 (たとえば ‘y = y + [10]’, *note sorted(y):
dc7.) は新しいオブジェクトを作ります。Python では一般に (そして標準ライ
ブラリの全てのケースで)、このような 2 つのタイプの演算にまつわる混乱を避
けるために、オブジェクトを変更するメソッドは ‘None’ を返します。ですから
もしあなたが誤って ‘y’ の複製の並び替えをするつもりで ‘y.sort()’ と書い
た場合に結果手にするのは ‘None’ でしょうから、あなたのプログラムは簡単に
診断出来るエラーを起こすでしょう。

しかしながら、同じ操作が型ごとに異なる振る舞いをする演算の種類が一つあり
ます: 累算代入演算です。例えば ‘+=’ はリストを変更しますが、タプルや整数
は変更しません(‘a_list += [1, 2, 3]’ は ‘a_list.extend([1, 2, 3])’ と同
じ意味で、そして ‘a_list’ を変更しますが、 ‘some_tuple += (1, 2, 3)’ と
‘some_int += 1’ は新しいオブジェクトを作ります)。

言い換えると:

   * ミュータブルなオブジェクト(*note list: 24d, *note dict: 183, *note
     set: 184, 等)を持っている場合、私たちはその内容を変更するある種の演
     算を使うことが出来、それを参照している全ての変数はその変化を見るこ
     とになるでしょう。

   * イミュータブルなオブジェクト(*note str: 169, *note int: 19b, *note
     tuple: 614, 等)を持っている場合、それを参照している全ての変数は同じ
     値を参照しているでしょうが、持っている値を新しい値に変換する演算は
     いつでも新しいオブジェクトを返します。

2つの変数が同じオブジェクトを参照しているかどうかが知りたければ、 *note
is: 34c. 演算子や組み込み関数 *note id(): 163c. が使えます。


File: python.info,  Node: 出力引数のある関数 参照渡し はどのように書きますか？,  Next: Python で高次関数はどのようにつくりますか？,  Prev: なぜ list 'y' を変更すると list 'x' も変更されるのですか?,  Up: コア言語

10.2.2.10 出力引数のある関数 (参照渡し) はどのように書きますか？
................................................................

前提として、Python では引数は代入によって渡されます。代入はオブジェクト
への参照を作るだけなので、呼び出し元と呼び出し先にある引数名の間にエイリ
アスはありませんし、参照渡しそれ自体はありません。望む効果を得るためには
幾つかの方法があります。

  1. 結果のタプルを返すことによって:

          >>> def func1(a, b):
          ...     a = 'new-value'        # a and b are local names
          ...     b = b + 1              # assigned to new objects
          ...     return a, b            # return new values
          ...
          >>> x, y = 'old-value', 99
          >>> func1(x, y)
          ('new-value', 100)

     これはたいてい一番明確な方法です。

  2. グローバル変数を使って。これはスレッドセーフでないので、推奨されま
     せん。

  3. ミュータブルな (インプレースに変更可能な) オブジェクトを渡すことに
     よって:

          >>> def func2(a):
          ...     a[0] = 'new-value'     # 'a' references a mutable list
          ...     a[1] = a[1] + 1        # changes a shared object
          ...
          >>> args = ['old-value', 99]
          >>> func2(args)
          >>> args
          ['new-value', 100]

  4. 変更される辞書に渡すことによって:

          >>> def func3(args):
          ...     args['a'] = 'new-value'     # args is a mutable dictionary
          ...     args['b'] = args['b'] + 1   # change it in-place
          ...
          >>> args = {'a': 'old-value', 'b': 99}
          >>> func3(args)
          >>> args
          {'a': 'new-value', 'b': 100}

  5. または、クラスインスタンスに値を同梱することによって:

          >>> class Namespace:
          ...     def __init__(self, /, **args):
          ...         for key, value in args.items():
          ...             setattr(self, key, value)
          ...
          >>> def func4(args):
          ...     args.a = 'new-value'        # args is a mutable Namespace
          ...     args.b = args.b + 1         # change object in-place
          ...
          >>> args = Namespace(a='old-value', b=99)
          >>> func4(args)
          >>> vars(args)
          {'a': 'new-value', 'b': 100}

     このような複雑なことをする理由はめったに無いでしょう。

一番の選択は、複数の結果を含むタプルを返すことです。


File: python.info,  Node: Python で高次関数はどのようにつくりますか？,  Next: Python のオブジェクトはどのようにコピーしますか？,  Prev: 出力引数のある関数 参照渡し はどのように書きますか？,  Up: コア言語

10.2.2.11 Python で高次関数はどのようにつくりますか？
.....................................................

二つの方法があります: ネストされたスコープを使う方法と、呼び出し可能オブ
ジェクトを使う方法です。例えば、‘a*x+b’ の値を計算する ‘f(x)’ 関数を返す
‘linear(a,b)’ を定義したいとします。ネストされたスコープを使うと:

     def linear(a, b):
         def result(x):
             return a * x + b
         return result

また、呼び出し可能オブジェクトを使うと:

     class linear:

         def __init__(self, a, b):
             self.a, self.b = a, b

         def __call__(self, x):
             return self.a * x + self.b

どちらの場合でも、

     taxes = linear(0.3, 2)

とすれば、‘taxes(10e6) == 0.3 * 10e6 + 2’ となるような呼び出し可能オブジ
ェクトを得られます。

呼び出し可能オブジェクトを使う方法は、少し遅くなり、わずかにコードが長く
なるという短所があります。ですが、継承を使って呼び出し可能オブジェクト同
士で記号を共有することもできます:

     class exponential(linear):
         # __init__ inherited
         def __call__(self, x):
             return self.a * (x ** self.b)

オブジェクトはいくつかのメソッドに状態をカプセル化できます:

     class counter:

         value = 0

         def set(self, x):
             self.value = x

         def up(self):
             self.value = self.value + 1

         def down(self):
             self.value = self.value - 1

     count = counter()
     inc, dec, reset = count.up, count.down, count.set

ここで、‘inc()’、‘dec()’、‘reset()’ は同じカウント変数を共有する関数のよ
うにふるまいます。


File: python.info,  Node: Python のオブジェクトはどのようにコピーしますか？,  Next: オブジェクトのメソッドや属性はどのように見つけますか？,  Prev: Python で高次関数はどのようにつくりますか？,  Up: コア言語

10.2.2.12 Python のオブジェクトはどのようにコピーしますか？
...........................................................

一般的に、普通は *note copy.copy(): 757. や *note copy.deepcopy(): d65.
を試してください。何でもコピーできるとは限りませんが、たいていはできます
。

もっと簡単にコピーできるオブジェクトもあります。辞書には *note copy():
dc9. メソッドがあります:

     newdict = olddict.copy()

シーケンスはスライシングでコピーできます:

     new_l = l[:]


File: python.info,  Node: オブジェクトのメソッドや属性はどのように見つけますか？,  Next: コードはどのようにオブジェクトの名前を見つけるのですか？,  Prev: Python のオブジェクトはどのようにコピーしますか？,  Up: コア言語

10.2.2.13 オブジェクトのメソッドや属性はどのように見つけますか？
................................................................

ユーザー定義クラスのインスタンス ‘x’ で、*note dir(x): 844,< はインスタ
ンス属性とそのクラスで定義されたメソッドや属性を含む名前のアルファベット
順リストを返します。


File: python.info,  Node: コードはどのようにオブジェクトの名前を見つけるのですか？,  Next: カンマ演算子はなぜ優先されるのですか？,  Prev: オブジェクトのメソッドや属性はどのように見つけますか？,  Up: コア言語

10.2.2.14 コードはどのようにオブジェクトの名前を見つけるのですか？
..................................................................

概して、オブジェクトは本当は名前を持たないので、見つけることはできません
。本質的には、代入とはいつも値に名前を束縛することです。‘def’ と ‘class’
文も同じですが、この場合は値はコーラブルです。以下のコードを考えてみまし
ょう:

     >>> class A:
     ...     pass
     ...
     >>> B = A
     >>> a = B()
     >>> b = a
     >>> print(b)
     <__main__.A object at 0x16D07CC>
     >>> print(a)
     <__main__.A object at 0x16D07CC>

おそらく、このクラスには名前があります。このクラスは二つの名前に縛られて
、名前 ‘B’ を通して呼び出されますが、それでもクラス ‘A’ のインスタンスと
して報告されるのです。しかし、両方の名前が同じ値に束縛されている以上、こ
のインスタンスの名前が ‘a’ か ‘b’ か決めることはできないのです。

概して、コードにとってある値の「名前を知っている」事は重要ではありません
。あなたがわざと内省的なコードを書いているのでない限り、方針を変えた方が
いいかもしれないということになるでしょう。

comp.lang.python で、Fredrik Lundh はこの問題の答えとして素晴らしい喩え
をしてくれました:

     玄関にいた猫の名前を知るのと同じ方法です: その猫 (オブジェクト) 自
     体はその名前を言うことができないし、それは実は問題ではありません -
     その猫が何と呼ばれているかを知る唯一の方法は、すべての隣人 (名前空
     間) にその猫 (オブジェクト) が何と呼ばれているかを聞くことです。

     ……そして、その猫が沢山の名前で知られていたり、逆に全く名前が無かっ
     たりしても驚かないでください！


File: python.info,  Node: カンマ演算子はなぜ優先されるのですか？,  Next: C の "? " 三項演算子と等価なものはありますか？,  Prev: コードはどのようにオブジェクトの名前を見つけるのですか？,  Up: コア言語

10.2.2.15 カンマ演算子はなぜ優先されるのですか？
................................................

カンマは Python では演算子ではありません。このセッションを考えてください
:

     >>> "a" in "b", "a"
     (False, 'a')

カンマは演算子ではなく、式の分離子なので、上の式は次の式と同じように評価
されます:

     ("a" in "b"), "a"

こうではありません:

     "a" in ("b", "a")

他のさまざまな演算子(‘=’、‘+=’ など)も同じです。これらは真の演算子ではあ
りませんが、代入文の構文上のデリミタです。


File: python.info,  Node: C の "? " 三項演算子と等価なものはありますか？,  Next: Python で解し難いワンライナーを書くことはできますか？,  Prev: カンマ演算子はなぜ優先されるのですか？,  Up: コア言語

10.2.2.16 C の "?:" 三項演算子と等価なものはありますか？
........................................................

はい、あります。構文は以下のようになります:

     [on_true] if [expression] else [on_false]

     x, y = 50, 25
     small = x if x < y else y

この構文が導入された 2.5 以前のバージョンに関しては、論理演算子を使った
このイディオムが一般的でした:

     [expression] and [on_true] or [on_false]

しかし、このイディオムは安全ではありません。'on_true' のブール値が偽であ
るときに間違った結果を与えることがあります。ですから、いつでも ‘... if
... else ...’ 形式を使ったほうが良いです。


File: python.info,  Node: Python で解し難いワンライナーを書くことはできますか？,  Next: 関数の引数リストにあるスラッシュ / は何を意味しますか？,  Prev: C の "? " 三項演算子と等価なものはありますか？,  Up: コア言語

10.2.2.17 Python で解し難いワンライナーを書くことはできますか？
...............................................................

はい。そういうものはたいてい、 ‘lambda’ の中に *note lambda: 14b5. がネ
ストされています。Ulf Bartelt によるものを少しアレンジした下の３つの例を
見てください:

     from functools import reduce

     # Primes < 1000
     print(list(filter(None,map(lambda y:y*reduce(lambda x,y:x*y!=0,
     map(lambda x,y=y:y%x,range(2,int(pow(y,0.5)+1))),1),range(2,1000)))))

     # First 10 Fibonacci numbers
     print(list(map(lambda x,f=lambda x,f:(f(x-1,f)+f(x-2,f)) if x>1 else 1:
     f(x,f), range(10))))

     # Mandelbrot set
     print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+'\n'+y,map(lambda y,
     Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,Sy=Sy,L=lambda yc,Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,i=IM,
     Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,
     i=i,Sx=Sx,F=lambda xc,yc,x,y,k,f=lambda xc,yc,x,y,k,f:(k<=0)or (x*x+y*y
     >=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr(
     64+F(Ru+x*(Ro-Ru)/Sx,yc,0,0,i)),range(Sx))):L(Iu+y*(Io-Iu)/Sy),range(Sy
     ))))(-2.1, 0.7, -1.2, 1.2, 30, 80, 24))
     #    \___ ___/  \___ ___/  |   |   |__ lines on screen
     #        V          V      |   |______ columns on screen
     #        |          |      |__________ maximum of "iterations"
     #        |          |_________________ range on y axis
     #        |____________________________ range on x axis

よい子はまねしないでね！


File: python.info,  Node: 関数の引数リストにあるスラッシュ / は何を意味しますか？,  Prev: Python で解し難いワンライナーを書くことはできますか？,  Up: コア言語

10.2.2.18 関数の引数リストにあるスラッシュ (/) は何を意味しますか？
...................................................................

パラメータ関数の仮引数にあるスラッシュは、それより前にある仮引数は位置専
用引数であることを示します。 位置専用引数は、外で使える名前を持たない仮
引数です。 位置専用引数を受け付ける関数の呼び出しにおいて、実引数はその
位置だけに基づいて仮引数に対応付けられます。 例えば、 *note divmod():
b99. は位置専用引数を受け付けます。 そのドキュメントは次のようになります
:

     >>> help(divmod)
     Help on built-in function divmod in module builtins:

     divmod(x, y, /)
         Return the tuple (x//y, x%y).  Invariant: div*y + mod == x.

この引数リストの末尾にスラッシュは、この2つの仮引数が両方とも位置専用引
数であることを意味します。 したがって、*note divmod(): b99. をキーワード
引数を使って呼び出すとエラーになります:

     >>> divmod(x=3, y=4)
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
     TypeError: divmod() takes no keyword arguments


File: python.info,  Node: 数と文字列,  Next: 性能<4>,  Prev: コア言語,  Up: プログラミング FAQ

10.2.3 数と文字列
-----------------

* Menu:

* 十六進数や八進数を指定するにはどうしたらいいですか？::
* なぜ -22 // 10 は -3 を返すのですか？::
* どうすれば SyntaxError を起こさずに整数リテラルの属性を得られますか？::
* 文字列を数に変換するにはどうしたらいいですか？::
* 数を文字列に変換するにはどうしたらいいですか？::
* 文字列をインプレースに変更するにはどうしたらいいですか？::
* 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？::
* Is there an equivalent to Perl's chomp() for removing trailing newlines from strings?: Is there an equivalent to Perl's chomp for removing trailing newlines from strings?.
* Is there a scanf() or sscanf() equivalent?: Is there a scanf or sscanf equivalent?.
* What does UnicodeDecodeError or UnicodeEncodeError error mean?::
* raw string を奇数個のバックスラッシュで終えることはできますか？::


File: python.info,  Node: 十六進数や八進数を指定するにはどうしたらいいですか？,  Next: なぜ -22 // 10 は -3 を返すのですか？,  Up: 数と文字列

10.2.3.1 十六進数や八進数を指定するにはどうしたらいいですか？
.............................................................

八進数を指定するには、八進数での値の先頭に 0 と "o" (小文字または大文字)
を加えてください。たとえば、変数 "a" に八進数での "10" (十進数での"8") を
代入するには、こう打ってください:

     >>> a = 0o10
     >>> a
     8

十六進数も簡単です。ただ十六進数での値の先頭に 0 と "x" (小文字または大
文字) を加えてください。十六進数は小文字でも大文字でも指定できます。たと
えば、Python インタプリタで:

     >>> a = 0xa5
     >>> a
     165
     >>> b = 0XB2
     >>> b
     178


File: python.info,  Node: なぜ -22 // 10 は -3 を返すのですか？,  Next: どうすれば SyntaxError を起こさずに整数リテラルの属性を得られますか？,  Prev: 十六進数や八進数を指定するにはどうしたらいいですか？,  Up: 数と文字列

10.2.3.2 なぜ -22 // 10 は -3 を返すのですか？
..............................................

‘i % j’ が ‘j’ と同じ符号であってほしいことに基づいています。それに加え
て以下のようにもしたいとすると:

     i == (i // j) * j + (i % j)

整数除算は床を返すことになります。C にも C の一貫性があって、‘i % j’ が
‘i’ と同じ符号を持つように ‘i // j’ を丸めています。

‘i % j’ は、‘j’ が負の時には実際にはほとんど使いません。‘j’ が正なら、た
くさん使います。その事実上すべての場合、‘i % j’ は ‘>= 0’ となる方が便利
です。時計が 10 時を指している時、その 200 時間前は何時でしょうか。‘-190
% 12 == 2’ となるのが便利です。‘-190 % 12 == -10’ は噛み付きかねないバグ
です。


File: python.info,  Node: どうすれば SyntaxError を起こさずに整数リテラルの属性を得られますか？,  Next: 文字列を数に変換するにはどうしたらいいですか？,  Prev: なぜ -22 // 10 は -3 を返すのですか？,  Up: 数と文字列

10.2.3.3 どうすれば SyntaxError を起こさずに整数リテラルの属性を得られますか？
..............................................................................

ふつうの方法で ‘int’ リテラルの属性を探そうとすると、ピリオドが小数点と
みなされ、*note SyntaxError: 18e. となります:

     >>> 1.__class__
       File "<stdin>", line 1
       1.__class__
        ^
     SyntaxError: invalid decimal literal

解決策は、リテラルとピリオドを スペースや括弧で分けることです。

     >>> 1 .__class__
     <class 'int'>
     >>> (1).__class__
     <class 'int'>


File: python.info,  Node: 文字列を数に変換するにはどうしたらいいですか？,  Next: 数を文字列に変換するにはどうしたらいいですか？,  Prev: どうすれば SyntaxError を起こさずに整数リテラルの属性を得られますか？,  Up: 数と文字列

10.2.3.4 文字列を数に変換するにはどうしたらいいですか？
.......................................................

For integers, use the built-in *note int(): 19b. type constructor, e.g.
‘int('144') == 144’.  Similarly, *note float(): 196. converts to a
floating-point number, e.g.  ‘float('144') == 144.0’.

デフォルトでは、これらは数を十進数として解釈するので、 ‘int('0144') ==
144’ は成立しますが ‘int('0x144')’ は *note ValueError: 2ec. を送出しま
す。 ‘int(string, base)’ はオプションの第二引数をとって変換元の基数にし
ます。つまり ‘int( '0x144', 16) == 324’ です。基数が 0 と指定された場合
、その数は Python の基準によって解釈されます。先頭が '0o' なら八進数で、
'0x' なら十六進数を表します。

文字列を数に変換するだけのために *note eval(): 4a3. を使わないでください
。 *note eval(): 4a3. は特に遅いですし、セキュリティ上のリスクもあります
。求められない副作用を持つような Python の式を渡そうとする人がいるかも知
れません。例えば、あなたのホームディレクトリを消去する
‘__import__('os').system("rm -rf $HOME")’ を渡そうとする人がいるかも知れ
ません。

*note eval(): 4a3. にも数を Python の式として解釈する機能があります。だ
から例えば、 ‘eval('09')’ は構文エラー起こします。Python は ('0' 以外の)
十進数を '0' で始めてはならないからです。


File: python.info,  Node: 数を文字列に変換するにはどうしたらいいですか？,  Next: 文字列をインプレースに変更するにはどうしたらいいですか？,  Prev: 文字列を数に変換するにはどうしたらいいですか？,  Up: 数と文字列

10.2.3.5 数を文字列に変換するにはどうしたらいいですか？
.......................................................

例えば、‘144’ という数を ‘'144'’ という文字列に変換したいなら、組み込み
型のコンストラクタ *note str(): 169. を使ってください。 十六進数や八進数
にしたければ、組み込み関数の *note hex(): 14e7. や *note oct(): 14e6. を
使ってください。 手の込んだフォーマット形式を使うなら、 *note f-strings:
19a. と *note 書式指定文字列の文法: 15b3. の節を参照してください。 例え
ば、 ‘"{:04d}".format(144)’ は ‘'0144'’ になり、
‘"{:.3f}".format(1.0/3.0)’ は ‘'0.333'’ になります。


File: python.info,  Node: 文字列をインプレースに変更するにはどうしたらいいですか？,  Next: 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？,  Prev: 数を文字列に変換するにはどうしたらいいですか？,  Up: 数と文字列

10.2.3.6 文字列をインプレースに変更するにはどうしたらいいですか？
.................................................................

文字列はイミュータブルなので、それはできません。殆どの場合、組み立てたい
個別の部品から単純に新しい文字列を構成するべきです。しかし、Unicode デー
タをインプレースに変更できるオブジェクトが必要なら、 *note array: 8. モ
ジュールの *note io.StringIO: 112a. オブジェクトを試してください:

     >>> import io
     >>> s = "Hello, world"
     >>> sio = io.StringIO(s)
     >>> sio.getvalue()
     'Hello, world'
     >>> sio.seek(7)
     7
     >>> sio.write("there!")
     6
     >>> sio.getvalue()
     'Hello, there!'

     >>> import array
     >>> a = array.array('w', s)
     >>> print(a)
     array('w', 'Hello, world')
     >>> a[0] = 'y'
     >>> print(a)
     array('w', 'yello, world')
     >>> a.tounicode()
     'yello, world'


File: python.info,  Node: 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？,  Next: Is there an equivalent to Perl's chomp for removing trailing newlines from strings?,  Prev: 文字列をインプレースに変更するにはどうしたらいいですか？,  Up: 数と文字列

10.2.3.7 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？
.......................................................................

様々なテクニックがあります。

   * 一番いいのは、文字列を関数に対応させる辞書を使うことです。このテク
     ニックの一番の利点は、文字列が関数の名前と同じ必要がないことです。
     この方法は case 構造をエミュレートするための一番のテクニックでもあ
     ります:

          def a():
              pass

          def b():
              pass

          dispatch = {'go': a, 'stop': b}  # Note lack of parens for funcs

          dispatch[get_input()]()  # Note trailing parens to call function

   * 組み込み関数の *note getattr(): dca. を使う方法:

          import foo
          getattr(foo, 'bar')()

     なお、 *note getattr(): dca. はクラス、クラスインスタンス、モジュー
     ルなど、どんなオブジェクトにも使えます。

     これは標準ライブラリでも何箇所か使われています。このように:

          class Foo:
              def do_foo(self):
                  ...

              def do_bar(self):
                  ...

          f = getattr(foo_instance, 'do_' + opname)
          f()

   * *note locals(): 46f. を使って関数名を決める方法:

          def myFunc():
              print("hello")

          fname = "myFunc"

          f = locals()[fname]
          f()


File: python.info,  Node: Is there an equivalent to Perl's chomp for removing trailing newlines from strings?,  Next: Is there a scanf or sscanf equivalent?,  Prev: 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？,  Up: 数と文字列

10.2.3.8 Is there an equivalent to Perl's ‘chomp()’ for removing trailing newlines from strings?
................................................................................................

‘S.rstrip("\r\n")’ を使って文字列 ‘S’ の終端から他の空白文字を取り除くこ
となくすべての行末記号を取り除くことができます。文字列 ‘S’ が複数行を表
し、終端に空行があるとき、そのすべての空行も取り除かれます:

     >>> lines = ("line 1 \r\n"
     ...          "\r\n"
     ...          "\r\n")
     >>> lines.rstrip("\n\r")
     'line 1 '

これは典型的に一度に一行ずつテキストを読みたい時にのみ使われるので、
‘S.rstrip()’ をこの方法で使うとうまくいきます。


File: python.info,  Node: Is there a scanf or sscanf equivalent?,  Next: What does UnicodeDecodeError or UnicodeEncodeError error mean?,  Prev: Is there an equivalent to Perl's chomp for removing trailing newlines from strings?,  Up: 数と文字列

10.2.3.9 Is there a ‘scanf()’ or ‘sscanf()’ equivalent?
.......................................................

そのようなものはありません。

For simple input parsing, the easiest approach is usually to split the
line into whitespace-delimited words using the *note split(): 10aa.
method of string objects and then convert decimal strings to numeric
values using *note int(): 19b. or *note float(): 196.  ‘split()’
supports an optional "sep" parameter which is useful if the line uses
something other than whitespace as a separator.

もっと複雑な入力解析をしたいなら、C の ‘sscanf’ よりも正規表現の方が便利
ですし、この処理に向いています。


File: python.info,  Node: What does UnicodeDecodeError or UnicodeEncodeError error mean?,  Next: raw string を奇数個のバックスラッシュで終えることはできますか？,  Prev: Is there a scanf or sscanf equivalent?,  Up: 数と文字列

10.2.3.10 What does ‘UnicodeDecodeError’ or ‘UnicodeEncodeError’ error mean?
............................................................................

*note Unicode HOWTO: 14bc. を参照して下さい。


File: python.info,  Node: raw string を奇数個のバックスラッシュで終えることはできますか？,  Prev: What does UnicodeDecodeError or UnicodeEncodeError error mean?,  Up: 数と文字列

10.2.3.11 raw string を奇数個のバックスラッシュで終えることはできますか？
.........................................................................

奇数個のバックスラッシュで終わる raw string は文字列のクォートをエスケー
プします:

     >>> r'C:\this\will\not\work\'
       File "<stdin>", line 1
         r'C:\this\will\not\work\'
         ^
     SyntaxError: unterminated string literal (detected at line 1)

これにはいくつかの回避策があります。ひとつは通常文字列と二重バックスラッ
シュを使うことです:

     >>> 'C:\\this\\will\\work\\'
     'C:\\this\\will\\work\\'

もうひとつは、エスケープされたバックスラッシュを含む通常の文字列を、 raw
string に連結します:

     >>> r'C:\this\will\work' '\\'
     'C:\\this\\will\\work\\'

Windowsでは、 *note os.path.join(): 19a9. を使ってバックスラッシュを追加
することもできます:

     >>> os.path.join(r'C:\this\will\work', '')
     'C:\\this\\will\\work\\'

注意点として、バックスラッシュは raw string 終端のクォートを「エスケープ
」しますが、 raw string の値を解釈する際にはエスケープが生じません。つま
り、バックスラッシュは raw string 値の中に残ったままになります:

     >>> r'backslash\'preserved'
     "backslash\\'preserved"

*note 言語リファレンス: 229f. の仕様も参照してください。


File: python.info,  Node: 性能<4>,  Next: シーケンス タプル/リスト,  Prev: 数と文字列,  Up: プログラミング FAQ

10.2.4 性能
-----------

* Menu:

* プログラムが遅すぎます。どうしたら速くなりますか？::
* 多くの文字列を結合するのに最も効率的な方法は何ですか？::


File: python.info,  Node: プログラムが遅すぎます。どうしたら速くなりますか？,  Next: 多くの文字列を結合するのに最も効率的な方法は何ですか？,  Up: 性能<4>

10.2.4.1 プログラムが遅すぎます。どうしたら速くなりますか？
...........................................................

これは、一般的に難しい問題です。まず、先に進む前に覚えておいて欲しいこと
をここに挙げます:

   * 性能の傾向は Python 実装によって変わります。この FAQ では *note
     CPython: 905. に焦点を当てます。

   * 振る舞いはオペレーティングシステムによって変わりえます。特に、I/O や
     マルチスレッドに関しては顕著です。

   * 常に、コードの最適化を始める '前に' プログラムのホットスポットを見
     つけるべきです (*note profile: b4. モジュールを参照してください)。

   * ベンチマークスクリプトを書くことで、改善箇所の捜索を素早く繰り返せ
     ます (*note timeit: f5. モジュールを参照してください)。

   * 洗練された最適化に隠れたリグレッションの可能性を生む前に、(ユニット
     テストやその他の技法で) コードカバレッジを上げることを強く推奨しま
     す。

とは言っても、Python コードを高速化する技法はたくさんあります。ここでは
、満足な性能のレベルにたどり着くまでの長い道のりを進む、一般的な方針を示
します:

   * コード中に細かい最適化の技法をばらまこうとするよりも、アルゴリズム
     を高速化 (または高速なアルゴリズムに変更) するほうが、大きな利益を
     生むことがあります。

   * 適切なデータ構造を使ってください。*note 組み込み型: 25e9. や *note
     collections: 1e. を調べてください。

   * 何かをするための基本要素が標準ライブラリにあるなら、自分で発明した
     代用品よりもそちらのほうが、(絶対にとは言えませんが) おそらく速いで
     す。 それが組み込み型やある種の拡張型のように C で書かれたものなら
     なおさらです。 たとえば、ソートするには、必ず *note list.sort():
     dc8. 組み込みメソッドか *note sorted(): dc7. 関数を使ってください
     (また、中程度に高度な例は、 *note ソートのテクニック: 13f3. を参照
     してください)。

   * 抽象化は、遠回りにしがちで、インタプリタの作業を増やすことになりま
     す。この遠回りさが、なされる作業の量より重大になると、プログラムが
     遅くなってしまいます。過度な抽象化、特に細かい関数やメソッドの形で
     現れるもの (これは読みにくさも落とします) は防ぐべきです。

pure Python にできる限界に達したなら、更に進むためのツールがあります。例
えば、Cython(1) は、Python コードのわずかに変形した版を C 拡張にコンパイ
ルし、多種のプラットフォームで使えます。Cython は、コンパイル (と任意の
型アノテーション) を利用し、コードの解釈を大幅に速くします。C プログラミ
ングに自信があるなら、自分で *note write a C extension module: 1fbd. こ
ともできます。

参考
....

パフォーマンス tips(2) が載っている wiki のページ。

   ---------- Footnotes ----------

   (1) https://cython.org

   (2) https://wiki.python.org/moin/PythonSpeed/PerformanceTips


File: python.info,  Node: 多くの文字列を結合するのに最も効率的な方法は何ですか？,  Prev: プログラムが遅すぎます。どうしたら速くなりますか？,  Up: 性能<4>

10.2.4.2 多くの文字列を結合するのに最も効率的な方法は何ですか？
...............................................................

*note str: 169. および *note bytes: 192. オブジェクトはイミュータブルな
ので、多くの文字列の結合は結合ごとに新しいオブジェクトを作成し、効率が悪
いです。 一般的に、全体の実行時間のコストは文字列の長さの二乗に比例しま
す。

多くの *note str: 169. オブジェクトを累積するのにおすすめのイディオムは
、すべてをリストに配置してから最後に *note str.join(): 2609. を呼び出す
ことです:

     chunks = []
     for s in my_strings:
         chunks.append(s)
     result = ''.join(chunks)

(他の割と効率的なイディオムは、 *note io.StringIO: 112a. を使うことです)

多くの *note bytes: 192. オブジェクトを累積するのにおすすめのイディオム
は、 *note bytearray: 344. オブジェクトをインプレース結合 (‘+=’ 演算子)
で拡張することです:

     result = bytearray()
     for b in my_bytes_objects:
         result += b


File: python.info,  Node: シーケンス タプル/リスト,  Next: オブジェクト,  Prev: 性能<4>,  Up: プログラミング FAQ

10.2.5 シーケンス(タプル/リスト)
--------------------------------

* Menu:

* タプル、リスト間の変更はどのようにするのですか？::
* 負の添え字は何ですか？::
* シーケンスを逆順にイテレートするにはどうしたらいいですか？::
* リストから重複を取り除くにはどうしますか？::
* How do you remove multiple items from a list?::
* Python で配列を作るにはどうしますか？::
* 多次元のリストを作るにはどうしますか？::
* オブジェクトのシーケンスにメソッドや関数を適用するにはどうしますか？::
* なぜ加算はされるのに a_tuple[i] += ['item'] は例外を送出するのですか?::
* 複雑なソートがしたいのですが、Python でシュワルツ変換はできますか？::
* リストを別のリストの値によってソートするにはどうしますか？::


File: python.info,  Node: タプル、リスト間の変更はどのようにするのですか？,  Next: 負の添え字は何ですか？,  Up: シーケンス タプル/リスト

10.2.5.1 タプル、リスト間の変更はどのようにするのですか？
.........................................................

型コンストラクタ ‘tuple(seq)’ はすべてのシーケンス (実際には、すべてのイ
テラブル) を同じ要素、同じ順序のタプルに変換します。

例えば、 ‘tuple([1, 2, 3])’ は ‘(1, 2, 3)’ を与え、 ‘tuple('abc')’ は
‘('a', 'b', 'c')’ を与えます。引数がタプルなら、コピーを作らずに引数のオ
ブジェクトそのものを返すので、あるオブジェクトが既にタプルになっているか
確信が持てないのなら、 *note tuple(): 614. を呼ぶのが手軽です。

型コンストラクタ ‘list(seq)’ はすべてのシーケンスあるいはイテラブルを同
じ要素、同じ順序のリストに変換します。例えば、‘list((1, 2, 3))’ は ‘[1,
2, 3]’ を与え、‘list('abc')’ は ‘['a', 'b', 'c']’ を与えます。引数がリス
トなら、‘seq[:]’ と同様にコピーを作ります。


File: python.info,  Node: 負の添え字は何ですか？,  Next: シーケンスを逆順にイテレートするにはどうしたらいいですか？,  Prev: タプル、リスト間の変更はどのようにするのですか？,  Up: シーケンス タプル/リスト

10.2.5.2 負の添え字は何ですか？
...............................

Python のシーケンスは正の数と負の数でインデクスされます。正の数では、0 が
最初のインデクス、1 が 2 番目のインデクス、以下も同様です。負のインデク
スでは、-1 が最後のインデクス、-2 が最後から 2 番目のインデクス、以下も
同様です。‘seq[-n]’ は ‘seq[len(seq)-n]’ と同じだと考えてください。

負のインデクスを使うと便利なことがあります。例えば、‘S[:-1]’ は文字列の
最後以外のすべての文字を表すので、文字列の末尾の改行を取り除くときに便利
です。


File: python.info,  Node: シーケンスを逆順にイテレートするにはどうしたらいいですか？,  Next: リストから重複を取り除くにはどうしますか？,  Prev: 負の添え字は何ですか？,  Up: シーケンス タプル/リスト

10.2.5.3 シーケンスを逆順にイテレートするにはどうしたらいいですか？
...................................................................

組み込み関数 *note reversed(): a65. を使ってください。

     for x in reversed(sequence):
         ...  # do something with x ...

これは元のシーケンスをいじるのではなく、逆順の新しいコピーを作ってイテレ
ートさせます。


File: python.info,  Node: リストから重複を取り除くにはどうしますか？,  Next: How do you remove multiple items from a list?,  Prev: シーケンスを逆順にイテレートするにはどうしたらいいですか？,  Up: シーケンス タプル/リスト

10.2.5.4 リストから重複を取り除くにはどうしますか？
...................................................

Python Cookbook の長い議論に多くの方法があるので参照してください:

     ‘https://code.activestate.com/recipes/52560/’

リストを並び替えて構わないのなら、ソートした上でリストの最初から最後まで
を調べ、次のように重複を削除してください:

     if mylist:
         mylist.sort()
         last = mylist[-1]
         for i in range(len(mylist)-2, -1, -1):
             if last == mylist[i]:
                 del mylist[i]
             else:
                 last = mylist[i]

リストのすべての要素が集合のキーとして使える (つまり、すべての要素が
*note hashable: 824.) なら、おそらくこのほうが速いです

     mylist = list(set(mylist))

リストを集合に変換するときに重複は取り除かれるので、それをリストに戻せば
いいのです。


File: python.info,  Node: How do you remove multiple items from a list?,  Next: Python で配列を作るにはどうしますか？,  Prev: リストから重複を取り除くにはどうしますか？,  Up: シーケンス タプル/リスト

10.2.5.5 How do you remove multiple items from a list?
......................................................

As with removing duplicates, explicitly iterating in reverse with a
delete condition is one possibility.  However, it is easier and faster
to use slice replacement with an implicit or explicit forward iteration.
Here are three variations:

     mylist[:] = filter(keep_function, mylist)
     mylist[:] = (x for x in mylist if keep_condition)
     mylist[:] = [x for x in mylist if keep_condition]

リスト内包表記がおそらく最も高速です。


File: python.info,  Node: Python で配列を作るにはどうしますか？,  Next: 多次元のリストを作るにはどうしますか？,  Prev: How do you remove multiple items from a list?,  Up: シーケンス タプル/リスト

10.2.5.6 Python で配列を作るにはどうしますか？
..............................................

リストを使ってください:

     ["this", 1, "is", "an", "array"]

リストの時間計算量は C や Pascal の配列と同じです。大きな違いは、Python
のリストは多くの異なる型のオブジェクトを含めることです。

‘array’ モジュールにも固定された型を簡潔に表現する配列を作るためのメソッ
ドがありますが、リストよりもインデクスが遅いです。また、NumPy(1) やその
他のサードパーティー拡張でも、様々な特徴をもつ配列的な構造体が定義されて
います。

Lisp 方式の連結リストを得るのに、タプルを使って 'cons cells' をエミュレ
ートできます:

     lisp_list = ("like",  ("this",  ("example", None) ) )

ミュータブルな必要があるなら、タプルではなくリストを使いましょう。Lisp の
'car' にあたるものが ‘lisp_list[0]’ で、cdr にあたるものが
‘lisp_list[1]’ です。本当に必要だと確信できるとき以外はこれはしないでく
ださい。たいてい、これは Python のリストを使うよりも非常に遅いですから。

   ---------- Footnotes ----------

   (1) https://numpy.org/


File: python.info,  Node: 多次元のリストを作るにはどうしますか？,  Next: オブジェクトのシーケンスにメソッドや関数を適用するにはどうしますか？,  Prev: Python で配列を作るにはどうしますか？,  Up: シーケンス タプル/リスト

10.2.5.7 多次元のリストを作るにはどうしますか？
...............................................

このようにして多次元の配列を作ろうとしてしまったことがあるでしょう:

     >>> A = [[None] * 2] * 3

これを表示したときには問題なさそうに見えます:

     >>> A
     [[None, None], [None, None], [None, None]]

しかし値を代入すると、その値が複数の場所に現れてしまいます:

     >>> A[0][0] = 5
     >>> A
     [[5, None], [5, None], [5, None]]

これは、‘*’ を使ったリストの複製がコピーを作らず、存在するオブジェクトへ
の参照を作るだけだからです。この ‘*3’ は長さ 2 の同じリストへの参照を含
むリストを作ります。一つの列に対する変更はすべての列に現れますが、これが
望んだ結果であることはまずないでしょう。

おすすめの方法は、最初に望んだ長さのリストを作り、それから新しく作ったリ
ストでそれぞれの要素を埋めていくことです:

     A = [None] * 3
     for i in range(3):
         A[i] = [None] * 2

これは長さ 2 の異なるリスト 3 つを含むリストを生成します。リスト内包表記
も使えます:

     w, h = 2, 3
     A = [[None] * w for i in range(h)]

あるいは、行列データ型を提供している拡張を使用することもできます;
NumPy(1) が最もよく知られています。

   ---------- Footnotes ----------

   (1) https://numpy.org/


File: python.info,  Node: オブジェクトのシーケンスにメソッドや関数を適用するにはどうしますか？,  Next: なぜ加算はされるのに a_tuple[i] += ['item'] は例外を送出するのですか?,  Prev: 多次元のリストを作るにはどうしますか？,  Up: シーケンス タプル/リスト

10.2.5.8 オブジェクトのシーケンスにメソッドや関数を適用するにはどうしますか？
.............................................................................

メソッドや関数を呼び出して結果を蓄積するのには、 *note list
comprehension: 8dd. （リスト内包表記） がエレガントな解決策です:

     result = [obj.method() for obj in mylist]

     result = [function(obj) for obj in mylist]

戻り値を保存せずにメソッドや関数を実行するだけなら、ただの *note for:
34a. ループで十分です:

     for obj in mylist:
         obj.method()

     for obj in mylist:
         function(obj)


File: python.info,  Node: なぜ加算はされるのに a_tuple[i] += ['item'] は例外を送出するのですか?,  Next: 複雑なソートがしたいのですが、Python でシュワルツ変換はできますか？,  Prev: オブジェクトのシーケンスにメソッドや関数を適用するにはどうしますか？,  Up: シーケンス タプル/リスト

10.2.5.9 なぜ加算はされるのに a_tuple[i] += ['item'] は例外を送出するのですか?
..............................................................................

これは、累算代入演算子は '代入' 演算子だ、という事実と、Python での可変
オブジェクトと不変オブジェクトの違いが組み合わさって起きるのです。

この議論は一般的に、可変オブジェクトを指すタプルの要素に、累算代入演算子
が適用されたときにも適用できますが、例として ‘list’ と ‘+=’ を使います。

次のように書いたとします:

     >>> a_tuple = (1, 2)
     >>> a_tuple[0] += 1
     Traceback (most recent call last):
        ...
     TypeError: 'tuple' object does not support item assignment

例外が送出された理由は明らかです: ‘1’ が (‘1’) を指すオブジェクト
‘a_tuple[0]’ に加えられ、結果のオブジェクト ‘2’ が生成されますが、計算結
果 ‘2’ をタプルの第 ‘0’ 要素に代入しようとしたときに、エラーが発生します
。なぜならば、タプルの要素が何を指すかは変えられないからです。

このような裏事情の元、累算代入文はだいたい次のようなことをしています:

     >>> result = a_tuple[0] + 1
     >>> a_tuple[0] = result
     Traceback (most recent call last):
       ...
     TypeError: 'tuple' object does not support item assignment

タプルは不変なので、例外を生み出しているのは操作の代入部分なのです。

次のように書いたとします:

     >>> a_tuple = (['foo'], 'bar')
     >>> a_tuple[0] += ['item']
     Traceback (most recent call last):
       ...
     TypeError: 'tuple' object does not support item assignment

この例外にはちょっと驚きますが、もっと驚くべきことは、エラーがあったとし
ても追記はきちんと動いている、という事実です:

     >>> a_tuple[0]
     ['foo', 'item']

To see why this happens, you need to know that (a) if an object
implements an *note __iadd__(): 23df. magic method, it gets called when
the ‘+=’ augmented assignment is executed, and its return value is what
gets used in the assignment statement; and (b) for lists, ‘__iadd__()’
is equivalent to calling *note extend(): 23d9. on the list and returning
the list.  That's why we say that for lists, ‘+=’ is a "shorthand" for
*note list.extend(): 602.:

     >>> a_list = []
     >>> a_list += [1]
     >>> a_list
     [1]

これは次と等価です:

     >>> result = a_list.__iadd__([1])
     >>> a_list = result

a_list が指していたオブジェクトは更新され、更新されたオブジェクトへのポ
インタは再度 ‘a_list’ に代入されます。代入しているのは、‘a_list’ が更新
前まで指していた同じオブジェクトへのポインタなので、代入は最終的には何も
していないのですが、代入処理自体は起きています。

従って、今のタプルの例では、次のと同じことが起きています:

     >>> result = a_tuple[0].__iadd__(['item'])
     >>> a_tuple[0] = result
     Traceback (most recent call last):
       ...
     TypeError: 'tuple' object does not support item assignment

‘__iadd__()’ は成功し、リストは拡張 (extend) されますが、‘result’ が
‘a_tuple[0]’ が既に指しているオブジェクトと同じオブジェクトを指していた
としても、タプルは不変なので、その最後の代入はやはりエラーとなります。


File: python.info,  Node: 複雑なソートがしたいのですが、Python でシュワルツ変換はできますか？,  Next: リストを別のリストの値によってソートするにはどうしますか？,  Prev: なぜ加算はされるのに a_tuple[i] += ['item'] は例外を送出するのですか?,  Up: シーケンス タプル/リスト

10.2.5.10 複雑なソートがしたいのですが、Python でシュワルツ変換はできますか？
.............................................................................

Perl コミュニティの Randal Schwartz の作とされるこのテクニックは、リスト
の要素を、それぞれの要素をその「ソート値」に対応付けるメトリックによって
ソートします。Python では、 *note list.sort(): dc8. メソッドに ‘key’ 引
数を使ってください:

     Isorted = L[:]
     Isorted.sort(key=lambda s: int(s[10:15]))


File: python.info,  Node: リストを別のリストの値によってソートするにはどうしますか？,  Prev: 複雑なソートがしたいのですが、Python でシュワルツ変換はできますか？,  Up: シーケンス タプル/リスト

10.2.5.11 リストを別のリストの値によってソートするにはどうしますか？
....................................................................

二つのイテレータを混ぜあわせてタプルのイテレータにしてから、必要な要素を
選んでください。

     >>> list1 = ["what", "I'm", "sorting", "by"]
     >>> list2 = ["something", "else", "to", "sort"]
     >>> pairs = zip(list1, list2)
     >>> pairs = sorted(pairs)
     >>> pairs
     [("I'm", 'else'), ('by', 'sort'), ('sorting', 'to'), ('what', 'something')]
     >>> result = [x[1] for x in pairs]
     >>> result
     ['else', 'sort', 'to', 'something']


File: python.info,  Node: オブジェクト,  Next: モジュール<5>,  Prev: シーケンス タプル/リスト,  Up: プログラミング FAQ

10.2.6 オブジェクト
-------------------

* Menu:

* クラスとは何ですか？::
* メソッドとは何ですか？::
* self とは何ですか？::
* あるオブジェクトが、与えられたクラスやそのサブクラスのインスタンスであるかを調べるにはどうしますか？::
* 委譲とは何ですか？::
* 基底クラスで定義されたメソッドを、そのクラスを継承した派生クラスから呼び出すにはどうしますか？::
* 基底クラスの名前を変えやすいコードを書くにはどうしますか？::
* 静的なクラスデータや静的なクラスメソッドを作るにはどうしますか？::
* Python でコンストラクタ(やメソッド)をオーバーロードするにはどうしたらいいですか？: Python でコンストラクタ やメソッド をオーバーロードするにはどうしたらいいですか？.
* __spam を使おうとしたら _SomeClassName__spam からエラーがでました。::
* クラスに __del__ メソッドを定義しているのですが、オブジェクトを削除したときに呼ばれません。::
* 与えられたクラスのすべてのインスタンスのリストを得るにはどうしますか？::
* なぜ id() の結果は一意でないように見えるのですか?: なぜ id の結果は一意でないように見えるのですか?.
* いつ is 演算子での同一性テストが頼れますか？::
* どうすればサブクラスはイミュータブルなインスタンスに格納されたデータを制御できますか？::
* メソッド呼び出しをキャッシュするには どうしたらいいですか？::


File: python.info,  Node: クラスとは何ですか？,  Next: メソッドとは何ですか？,  Up: オブジェクト

10.2.6.1 クラスとは何ですか？
.............................

クラスは、class 文の実行で生成される特殊なオブジェクトです。クラスオブジ
ェクトはインスタンスオブジェクトを生成するためのテンプレートとして使われ
、あるデータ型に特有のデータ (attribute/属性) とコード (メソッド) の両方
を内蔵しています。

新しいクラスを一つ以上の他のクラス (新しいクラスの基底クラスと呼ばれます
) に基づいて作ることもできます。この新しいクラスは、基底クラスから属性と
メソッドを継承します。これにより、オブジェクトモデルを継承で連続的に洗練
できます。メールボックスへの基本的なアクセサを提供する一般的な ‘Mailbox’
クラスを作って、それからいろいろな特定のメールボックスの形式を扱う
‘MboxMailbox’、‘MaildirMailbox’、‘OutlookMailbox’ のようなサブクラスを作
れるのです。


File: python.info,  Node: メソッドとは何ですか？,  Next: self とは何ですか？,  Prev: クラスとは何ですか？,  Up: オブジェクト

10.2.6.2 メソッドとは何ですか？
...............................

メソッドは、オブジェクト ‘x’ が持つ関数で、通常 ‘x.name(arguments...)’ と
して呼び出されるものです。メソッドはクラス定義の中で関数として定義されま
す:

     class C:
         def meth(self, arg):
             return arg * 2 + self.attribute


File: python.info,  Node: self とは何ですか？,  Next: あるオブジェクトが、与えられたクラスやそのサブクラスのインスタンスであるかを調べるにはどうしますか？,  Prev: メソッドとは何ですか？,  Up: オブジェクト

10.2.6.3 self とは何ですか？
............................

self はメソッドの第一引数に慣習的につけられる名前にすぎません。
‘meth(self, a, b, c)’ として定義されたメソッドは、その定義がなされたクラ
スのインスタンス ‘x’ に対して ‘x.meth(a, b, c)’ として呼び出されます。呼
び出されたメソッドは、‘meth(x, a, b, c)’ が呼ばれたものと考えます。

*note なぜメソッドの定義や呼び出しにおいて 'self'
を明示しなければならないのですか？: 58ea. も参照してください。


File: python.info,  Node: あるオブジェクトが、与えられたクラスやそのサブクラスのインスタンスであるかを調べるにはどうしますか？,  Next: 委譲とは何ですか？,  Prev: self とは何ですか？,  Up: オブジェクト

10.2.6.4 あるオブジェクトが、与えられたクラスやそのサブクラスのインスタンスであるかを調べるにはどうしますか？
.............................................................................................................

ビルトイン関数 *note isinstance(obj, cls): 2ad. を使ってください。クラス
のタプルを与えて ‘isinstance(obj, (class1, class2, ...))’ のようにすれば
、あるオブジェクトが任意の数のクラスのオブジェクトであるかを調べられます
し、‘isinstance(obj, str)’ や ‘isinstance(obj, (int, float, complex))’ の
ようにすれば、Python のビルトイン型のオブジェクトであるかも調べられます
。

注意： *note isinstance(): 2ad. は *note abstract base class: 13ce. (抽
象基底クラス)からの仮想継承もチェックします。そのため、登録 (register) さ
れたクラスが直接/間接的にそれを継承していなくても ‘True’ を返します。「
真のインスタンス」をテストする場合は、クラスの *note MRO: 18dd. を調べま
す:

     from collections.abc import Mapping

     class P:
          pass

     class C(P):
         pass

     Mapping.register(P)

     >>> c = C()
     >>> isinstance(c, C)        # direct
     True
     >>> isinstance(c, P)        # indirect
     True
     >>> isinstance(c, Mapping)  # virtual
     True

     # Actual inheritance chain
     >>> type(c).__mro__
     (<class 'C'>, <class 'P'>, <class 'object'>)

     # Test for "true inheritance"
     >>> Mapping in type(c).__mro__
     False

なお、大部分のプログラムでは、 *note isinstance(): 2ad. をユーザー定義の
クラスに何度も使うべきではありません。クラスを自分で開発するときに、適切
なオブジェクト指向スタイルは、特定の振る舞いをカプセル化するクラスのメソ
ッドを定義するものであって、オブジェクトのクラスを調べてそのクラスに応じ
て違うことをするものではありません。例えば、何かをする関数があったとして
:

     def search(obj):
         if isinstance(obj, Mailbox):
             ...  # code to search a mailbox
         elif isinstance(obj, Document):
             ...  # code to search a document
         elif ...

よりよいアプローチは、‘search()’ メソッドをすべてのクラスに定義して、そ
れをただ呼び出すことです:

     class Mailbox:
         def search(self):
             ...  # code to search a mailbox

     class Document:
         def search(self):
             ...  # code to search a document

     obj.search()


File: python.info,  Node: 委譲とは何ですか？,  Next: 基底クラスで定義されたメソッドを、そのクラスを継承した派生クラスから呼び出すにはどうしますか？,  Prev: あるオブジェクトが、与えられたクラスやそのサブクラスのインスタンスであるかを調べるにはどうしますか？,  Up: オブジェクト

10.2.6.5 委譲とは何ですか？
...........................

委譲 (delegation) とは、オブジェクト指向のテクニック (デザインパターンと
も呼ばれる) の一つです。オブジェクト ‘x’ があって、そのメソッドのうちた
だ一つの振る舞いを変えたいとしましょう。新しいクラスを作成し、変えたいメ
ソッドだけを新しく実装し、他のすべてのメソッドを ‘x’ の対応するメソッド
に委譲する新しいクラスを作れます。

Python プログラマは簡単に委譲を実装できます。例えば、以下のクラスは、フ
ァイルのように振る舞いながらすべての文字を大文字に変換するクラスを実装し
ます:

     class UpperOut:

         def __init__(self, outfile):
             self._outfile = outfile

         def write(self, s):
             self._outfile.write(s.upper())

         def __getattr__(self, name):
             return getattr(self._outfile, name)

ここで ‘UpperOut’ クラスは ‘write()’ メソッドを定義しなおして、引数の文
字列を大文字に変換してから基礎となる ‘self._outfile.write()’ メソッドを
呼び出すようにします。その他すべてのメソッドは基礎となる ‘self._outfile’
オブジェクトに移譲されます。この委譲は *note __getattr__(): 6fa. メソッ
ドを通してなされます。属性の制御の詳細は *note 言語リファレンス: 23af. を
参照してください。

なお、一般的に委譲はトリッキーになりがちです。属性が設定される時には読み
出される時と同様に、そのクラスに *note __setattr__(): 237c. メソッドを定
義する必要があり、それには細心の注意が必要です。 ‘__setattr__()’ の基本
的な実装はおおよそ以下のようになります:

     class X:
         ...
         def __setattr__(self, name, value):
             self.__dict__[name] = value
         ...

Many *note __setattr__(): 237c. implementations call
‘object.__setattr__()’ to set an attribute on self without causing
infinite recursion:

     class X:
         def __setattr__(self, name, value):
             # Custom logic here...
             object.__setattr__(self, name, value)

Alternatively, it is possible to set attributes by inserting entries
into *note self.__dict__: 77d. directly.


File: python.info,  Node: 基底クラスで定義されたメソッドを、そのクラスを継承した派生クラスから呼び出すにはどうしますか？,  Next: 基底クラスの名前を変えやすいコードを書くにはどうしますか？,  Prev: 委譲とは何ですか？,  Up: オブジェクト

10.2.6.6 基底クラスで定義されたメソッドを、そのクラスを継承した派生クラスから呼び出すにはどうしますか？
.......................................................................................................

組み込みの *note super(): 1a6. 関数を使ってください:

     class Derived(Base):
         def meth(self):
             super().meth()  # calls Base.meth

この例では、 *note super(): 1a6. は呼ばれたインスタンス (‘self’ の値) を
自動判断し、 ‘type(self).__mro__’ で *note method resolution order:
25df. (MRO メソッド解決順) を検索し、そしてMRO内で ‘Derived’ の次行を返
します: ‘Base’ 。


File: python.info,  Node: 基底クラスの名前を変えやすいコードを書くにはどうしますか？,  Next: 静的なクラスデータや静的なクラスメソッドを作るにはどうしますか？,  Prev: 基底クラスで定義されたメソッドを、そのクラスを継承した派生クラスから呼び出すにはどうしますか？,  Up: オブジェクト

10.2.6.7 基底クラスの名前を変えやすいコードを書くにはどうしますか？
...................................................................

基底クラスをエイリアス (alias) に代入しておいてから、そのエイリアスを継
承するといいかもしれません。そうすればエイリアスに代入する値を変えるだけ
で済みます。ちなみに、この手法は使用する基底クラスを動的に選びたいとき、
例えば使えるリソースによって選びたいときなどにも便利です。例:

     class Base:
         ...

     BaseAlias = Base

     class Derived(BaseAlias):
         ...


File: python.info,  Node: 静的なクラスデータや静的なクラスメソッドを作るにはどうしますか？,  Next: Python でコンストラクタ やメソッド をオーバーロードするにはどうしたらいいですか？,  Prev: 基底クラスの名前を変えやすいコードを書くにはどうしますか？,  Up: オブジェクト

10.2.6.8 静的なクラスデータや静的なクラスメソッドを作るにはどうしますか？
.........................................................................

(C++ や Java の意味で) 静的なデータも静的なメソッドも Python でサポート
されています。

静的なデータを作るには、単純にクラス属性を定義してください。その属性に新
しい値を代入するには、代入するクラス名を明示する必要があります:

     class C:
         count = 0   # number of times C.__init__ called

         def __init__(self):
             C.count = C.count + 1

         def getcount(self):
             return C.count  # or return self.count

‘c’ そのものや ‘c.__class__’ から ‘C’ にいたるパス探索経路上のクラスによ
ってオーバーライドされない限り、‘c.count’ も ‘isinstance(c, C)’ であるす
べての ‘c’ に対する ‘C.count’ を参照します。

注意: C のメソッド内では、‘self.count = 42’ のような代入は ‘self’ 自身の
辞書に "count" という名前の新しくて関係ないインスタンスを作ります。クラ
スの静的なデータの再束縛には、メソッド内であるか否かにかかわらず、いつも
クラスを指定しなければなりません:

     C.count = 314

静的メソッドが使えます:

     class C:
         @staticmethod
         def static(arg1, arg2, arg3):
             # No 'self' parameter!
             ...

しかし、静的メソッドの効果を得るもっと簡単な方法は、単にモジュールレベル
関数を使うことです:

     def getcount():
         return C.count

モジュールあたりに一つのクラスを定義するように (あるいはクラス組織を厳密
に関連させるように) コードが構成されているなら、これで必要なカプセル化が
できます。


File: python.info,  Node: Python でコンストラクタ やメソッド をオーバーロードするにはどうしたらいいですか？,  Next: __spam を使おうとしたら _SomeClassName__spam からエラーがでました。,  Prev: 静的なクラスデータや静的なクラスメソッドを作るにはどうしますか？,  Up: オブジェクト

10.2.6.9 Python でコンストラクタ(やメソッド)をオーバーロードするにはどうしたらいいですか？
..........................................................................................

この質問の答えはすべてのメソッドについて言えることですが、この質問はだい
たい以下の構造の文脈から出てきます。

C++ では、このように書けます

     class C {
         C() { cout << "No arguments\n"; }
         C(int i) { cout << "Argument is " << i << "\n"; }
     }

Python では、一つのコンストラクタでデフォルトの引数を使ってすべての場合
に対応するように書かなければなりません。例えば:

     class C:
         def __init__(self, i=None):
             if i is None:
                 print("No arguments")
             else:
                 print("Argument is", i)

これで完全に等価とは言えませんが、実用上は十分に近いです。

長さが変えられる引数のリストを試すには、例えば

     def __init__(self, *args):
         ...

これと同じやり方がすべてのメソッド定義で使えます。


File: python.info,  Node: __spam を使おうとしたら _SomeClassName__spam からエラーがでました。,  Next: クラスに __del__ メソッドを定義しているのですが、オブジェクトを削除したときに呼ばれません。,  Prev: Python でコンストラクタ やメソッド をオーバーロードするにはどうしたらいいですか？,  Up: オブジェクト

10.2.6.10 __spam を使おうとしたら _SomeClassName__spam からエラーがでました。
.............................................................................

先頭にアンダースコアが二つ付いた変数名は、クラスのプライベートな変数を、
"マングル化" という単純かつ効率のいい方法で定義します。‘__spam’ のような
形式 (先頭に二つ以上、末尾にもしあっても一つのアンダースコアがある) のす
べての識別子は、‘classname’ が先頭のアンダースコアをすべて削除した現在の
クラス名とすれば、‘_classname__spam’ のように文字上で置換えられます。

The identifier can be used unchanged within the class, but to access it
outside the class, the mangled name must be used:

     class A:
         def __one(self):
             return 1
         def two(self):
             return 2 * self.__one()

     class B(A):
         def three(self):
             return 3 * self._A__one()

     four = 4 * A()._A__one()

In particular, this does not guarantee privacy since an outside user can
still deliberately access the private attribute; many Python programmers
never bother to use private variable names at all.

参考
....

詳細と特例は、 *note private name mangling specifications: 20a3. 。


File: python.info,  Node: クラスに __del__ メソッドを定義しているのですが、オブジェクトを削除したときに呼ばれません。,  Next: 与えられたクラスのすべてのインスタンスのリストを得るにはどうしますか？,  Prev: __spam を使おうとしたら _SomeClassName__spam からエラーがでました。,  Up: オブジェクト

10.2.6.11 クラスに __del__ メソッドを定義しているのですが、オブジェクトを削除したときに呼ばれません。
.....................................................................................................

いくつかの可能性があります。

*note del: 1b1f. 文は必ずしも *note __del__(): 11ff. を呼び出すとは限り
ません - これは単純にオブジェクトの参照カウントを減らすもので、カウント
がゼロになったときに ‘__del__()’ が呼び出されます。

データ構造が循環リンク (子のそれぞれが親の参照を持ち、親のそれぞれが子の
リストを持つツリーなど) を含む場合、その参照カウントは決して 0 にはなり
ません。時々、Python はこのようなサイクルを検出するアルゴリズムを実行し
ますが、データ構造への参照がなくなってからこのガベージコレクタが実行され
るまでいくらか時間が掛かるかもしれないので、 ‘__del__()’ メソッドは不都
合な予期できないタイミングで呼び出されるかもしれません。これは問題を再現
しようとするときに不便です。さらに悪いことに、オブジェクトの ‘__del__()’
メソッドが実行される順序は任意です。 *note gc.collect(): 1b3. を起動して
収集を強制することができますが、オブジェクトが決して回収されないような本
当に病的な場合も 'あります' 。

循環参照コレクタがあるとはいえ、オブジェクトに ‘close()’ メソッドを明示
的に定義し、使い終わったらいつでも呼び出せるようにするのはいいことです。
‘close()’ メソッドを使うと、サブオブジェクトを参照している属性を取り除け
ます。 ‘__del__()’ を直接呼び出さないでください - ‘__del__()’ は
‘close()’ を呼び出すでしょうし、 ‘close()’ なら同じオブジェクトに対して
複数回呼ばれてもいいことが保証されているでしょう。

循環参照を避ける他の方法は、 *note weakref: 11a. モジュールを使って、参
照カウントを増やすことなくオブジェクトを示すことです。例えばツリー構造は
、親と (必要なら！) 兄弟に弱参照を使うべきです。

最後に、 ‘__del__()’ メソッドが例外を発生させた場合、警告のメッセージが
*note sys.stderr: b33. に書きこまれます。


File: python.info,  Node: 与えられたクラスのすべてのインスタンスのリストを得るにはどうしますか？,  Next: なぜ id の結果は一意でないように見えるのですか?,  Prev: クラスに __del__ メソッドを定義しているのですが、オブジェクトを削除したときに呼ばれません。,  Up: オブジェクト

10.2.6.12 与えられたクラスのすべてのインスタンスのリストを得るにはどうしますか？
................................................................................

Python はクラス (やビルトイン型) のすべてのインスタンスをたどりません。
クラスのコンストラクタにそれぞれのインスタンスへの弱参照のリストを作らせ
ることですべてのインスタンスをたどらせられます。


File: python.info,  Node: なぜ id の結果は一意でないように見えるのですか?,  Next: いつ is 演算子での同一性テストが頼れますか？,  Prev: 与えられたクラスのすべてのインスタンスのリストを得るにはどうしますか？,  Up: オブジェクト

10.2.6.13 なぜ ‘id()’ の結果は一意でないように見えるのですか?
.............................................................

組み込みの *note id(): 163c. は、オブジェクトが生存している間は一意なこ
とが保証されている整数値を返します。 CPython では、それはオブジェクトの
メモリアドレスなので、オブジェクトがメモリから削除された後に、次に新しく
生成されたオブジェクトはメモリの同じ場所にメモリ領域を確保されていること
が、しばしば起きます。この現象を次の例で示しましょう:

     >>> id(1000)
     13901272
     >>> id(2000)
     13901272

2 つの同じ値を持つ id は ‘id()’ の実行の前に作られてすぐさま削除された異
なる整数オブジェクトによるものです。id を調べたいオブジェクトがまだ生き
てることを保証したいなら、オブジェクトへの別の参照を作ってください:

     >>> a = 1000; b = 2000
     >>> id(a)
     13901272
     >>> id(b)
     13891296


File: python.info,  Node: いつ is 演算子での同一性テストが頼れますか？,  Next: どうすればサブクラスはイミュータブルなインスタンスに格納されたデータを制御できますか？,  Prev: なぜ id の結果は一意でないように見えるのですか?,  Up: オブジェクト

10.2.6.14 いつ 'is' 演算子での同一性テストが頼れますか？
........................................................

‘is’ 演算子はオブジェクトの同一性をテストします。 テスト ‘a is b’ は
‘id(a) == id(b)’ と同等です。

同一性テストの最も重要な特性は、オブジェクトは常にそれ自身と同一であり、
‘a is a’ は常に ‘True’ を返すということです。 同一性テストは通常、等価性
テストよりも高速です。 また、等価性テストとは異なり、同一性テストは真偽
値 ‘True’ または''False'' を返すことが保証されています。

ただし、同一性テストを等価性テストの代用とできるのは、オブジェクトの同一
性が保証されている場合 'のみ' です。 一般的に、同一性が保証される状況は
3つあります:

  1. Assignments create new names but do not change object identity.
     After the assignment ‘new = old’, it is guaranteed that ‘new is
     old’.

  2. Putting an object in a container that stores object references does
     not change object identity.  After the list assignment ‘s[0] = x’,
     it is guaranteed that ‘s[0] is x’.

  3. If an object is a singleton, it means that only one instance of
     that object can exist.  After the assignments ‘a = None’ and ‘b =
     None’, it is guaranteed that ‘a is b’ because ‘None’ is a
     singleton.

多くの他の状況では、同一性テストは賢明でなく、等価性テストをお勧めします
。 特に、シングルトンであることが保証されていない *note int: 19b. や
*note str: 169. などの定数をチェックするために同一性テストを使わないでく
ださい。

     >>> a = 1000
     >>> b = 500
     >>> c = b + 500
     >>> a is c
     False

     >>> a = 'Python'
     >>> b = 'Py'
     >>> c = b + 'thon'
     >>> a is c
     False

同様に、ミュータブルなコンテナの新しいインスタンスは同一ではありません:

     >>> a = []
     >>> b = []
     >>> a is b
     False

標準ライブラリのコードには、同一性テストを正しく使うための一般的なパター
ンがあります:

  1. PEP 8(1) で推奨されているとおり、同一性テストは ‘None’ をチェックす
     る際に望ましい方法です。これはコードの中で自然な英語に読むことがで
     き、また

  2. オプション引数の検出は、 ‘None’ が有効な入力値である場合に厄介なこ
     とになる場合があります。この状況では、他のオブジェクトと必ず区別で
     きる唯一のマーカーオブジェクト（ singleton sentinel object ）を作る
     ことで対策できます。例えば、 *note dict.pop(): 5e6. のように振る舞
     うメソッドを実装する方法を示します:

          _sentinel = object()

          def pop(self, key, default=_sentinel):
              if key in self:
                  value = self[key]
                  del self[key]
                  return value
              if default is _sentinel:
                  raise KeyError(key)
              return default

  3. コンテナの実装では、等価性テストを同一性テストで補強する必要がある
     場合があります。これは、 ‘float('NaN')’ のような自分自身と等しくな
     いオブジェクトによってコードが混乱するのを防ぎます。

例えば、これは ‘collections.abc.Sequence.__contains__()’: の実装です:

     def __contains__(self, value):
         for v in self:
             if v is value or v == value:
                 return True
         return False

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0008/


File: python.info,  Node: どうすればサブクラスはイミュータブルなインスタンスに格納されたデータを制御できますか？,  Next: メソッド呼び出しをキャッシュするには どうしたらいいですか？,  Prev: いつ is 演算子での同一性テストが頼れますか？,  Up: オブジェクト

10.2.6.15 どうすればサブクラスはイミュータブルなインスタンスに格納されたデータを制御できますか？
................................................................................................

イミュータブル型をサブクラス化する場合、 *note __init__(): 8bf. ではなく
*note __new__(): 7a0. メソッドを継承します。 前者はインスタンスが生成さ
れた '後' に動くため、イミュータブルなインスタンスのデータを変えるには遅
すぎます。

これらのイミュータブルクラスはすべて、親クラスと異なるシグネチャを持ちま
す:

     from datetime import date

     class FirstOfMonthDate(date):
         "Always choose the first day of the month"
         def __new__(cls, year, month, day):
             return super().__new__(cls, year, month, 1)

     class NamedInt(int):
         "Allow text names for some numbers"
         xlat = {'zero': 0, 'one': 1, 'ten': 10}
         def __new__(cls, value):
             value = cls.xlat.get(value, value)
             return super().__new__(cls, value)

     class TitleStr(str):
         "Convert str to name suitable for a URL path"
         def __new__(cls, s):
             s = s.lower().replace(' ', '-')
             s = ''.join([c for c in s if c.isalnum() or c == '-'])
             return super().__new__(cls, s)

クラスはこのように使えます:

     >>> FirstOfMonthDate(2012, 2, 14)
     FirstOfMonthDate(2012, 2, 1)
     >>> NamedInt('ten')
     10
     >>> NamedInt(20)
     20
     >>> TitleStr('Blog: Why Python Rocks')
     'blog-why-python-rocks'


File: python.info,  Node: メソッド呼び出しをキャッシュするには どうしたらいいですか？,  Prev: どうすればサブクラスはイミュータブルなインスタンスに格納されたデータを制御できますか？,  Up: オブジェクト

10.2.6.16 メソッド呼び出しをキャッシュするには どうしたらいいですか？
.....................................................................

メソッドキャッシュの主な道具は２つあり、 *note
functools.cached_property(): 763. と *note functools.lru_cache(): be2. で
す。前者はインスタンスレベル、後者はクラスレベルで結果を保存します。

'cached_property' アプローチは、引数を取らないメソッドでのみ働きます。こ
れはインスタンスへの参照を作りません。キャッシュされたメソッドの結果は、
インスタンスが生きている間だけ保持されます。

利点は、インスタンスが使われなくなった場合、キャッシュされたメソッドの結
果がすぐに解放されることです。欠点は、インスタンスが溜まると、溜められた
メソッドの結果も増えてしまうことです。それらは際限なく増える恐れがありま
す。

'lru_cache' アプローチは、 *note hashable: 824. な引数を持つメソッドで働
きます。 weak references を渡すための特別な努力がない限り、インスタンス
への参照を作ります。

least recently used アルゴリズム（訳注：LRU 直近に使われたものを残す）の
利点は、キャッシュが指定された 'maxsize' で制限されることです。欠点は、
キャッシュから期限切れで追い出されるかクリアされるまで、インスタンスが生
き続けることです。

この例は各種テクニックを示します:

     class Weather:
         "Lookup weather information on a government website"

         def __init__(self, station_id):
             self._station_id = station_id
             # The _station_id is private and immutable

         def current_temperature(self):
             "Latest hourly observation"
             # Do not cache this because old results
             # can be out of date.

         @cached_property
         def location(self):
             "Return the longitude/latitude coordinates of the station"
             # Result only depends on the station_id

         @lru_cache(maxsize=20)
         def historic_rainfall(self, date, units='mm'):
             "Rainfall on a given date"
             # Depends on the station_id, date, and units.

上の例では、 'station_id' が常に変わらないことを前提としています。関連す
るインスタンスの属性が可変である場合、 'cached_property' アプローチは属
性の変更を検出できないため、機能しなくなります。

'station_id' が可変の場合に 'lru_cache' アプローチを機能させるには、クラ
スで *note __eq__(): cf2. と *note __hash__(): cf3. メソッドを定義する必
要があります。これにより、キャッシュは関連する属性の更新を検出できます:

     class Weather:
         "Example with a mutable station identifier"

         def __init__(self, station_id):
             self.station_id = station_id

         def change_station(self, station_id):
             self.station_id = station_id

         def __eq__(self, other):
             return self.station_id == other.station_id

         def __hash__(self):
             return hash(self.station_id)

         @lru_cache(maxsize=20)
         def historic_rainfall(self, date, units='cm'):
             'Rainfall on a given date'
             # Depends on the station_id, date, and units.


File: python.info,  Node: モジュール<5>,  Prev: オブジェクト,  Up: プログラミング FAQ

10.2.7 モジュール
-----------------

* Menu:

* .pyc ファイルを作るにはどうしますか？: pyc ファイルを作るにはどうしますか？.
* 現在のモジュール名を知るにはどうしますか？::
* 相互にインポートしあうモジュールを作るにはどうしたらいいですか？::
* __import__('x.y.z') は <module 'x'> を返しますが、z を得るためにはどうしますか？: __import__ 'x y z' は <module 'x'> を返しますが、z を得るためにはどうしますか？.
* インポートされたモジュールを編集してから再インポートしましたが、変化が現れません。なぜですか？::


File: python.info,  Node: pyc ファイルを作るにはどうしますか？,  Next: 現在のモジュール名を知るにはどうしますか？,  Up: モジュール<5>

10.2.7.1 .pyc ファイルを作るにはどうしますか？
..............................................

モジュールが初めてインポートされたとき (もしくは、現在のコンパイルされた
ファイルが作られてから、ソースファイルが変更されたとき) 、コンパイルされ
たコードが入っている ‘.pyc’ ファイルが、 ‘.py’ ファイルのあるディレクト
リのサブディレクトリ ‘__pycache__’ に作成されます。 ‘.pyc’ ファイルのフ
ァイル名は、 ‘.py’ ファイルの名前で始まり、 ‘.pyc’ で終わり、中間部分は
このファイルを作った ‘python’ バイナリに依存した文字列になります。 (詳細
は PEP 3147(1) を参照してください。)

‘.pyc’ が作られない理由の 1 つは、ソースファイルがあるディレクトリの権限
の問題、つまり ‘__pycache__’ サブディレクトリが作れない問題です。これは
、例えば、ウェブサーバーでテストを行っているときのような、開発者のユーザ
と実行者のユーザが別な場合に、起こり得ます。

*note PYTHONDONTWRITEBYTECODE: 15e7. 環境変数がセットされない限り、モジ
ュールをインポートしていて、 Python に ‘__pycache__’ サブディレクトリを
作り、そこにコンパイルされたモジュールが置ける能力 (権限、ディスクの空き
スペース、など) がある場合は、 .pyc ファイルは自動的に作られます。

最上位のスクリプトを Python で実行するのはインポートとはみなされず、
‘.pyc’ は作成されません。例えば、最上位のモジュール ‘foo.py’ が別のモジ
ュール ‘xyz.py’ をインポートしている場合、(シェルコマンドとして ‘python
foo.py’ と打ち込んで) ‘foo’ を実行すると、‘xyz’ はインポートされるので
‘xyz’ の ‘.pyc’ は作成されますが、‘foo.py’ はインポートされたわけではな
いので ‘foo’ の ‘.pyc’ は作られません。

‘foo’ の ‘.pyc’ ファイルを作成する - つまり、インポートされていないモジ
ュールの ‘.pyc’ ファイルを作成する - 必要がある場合、 *note py_compile:
b8. モジュールと *note compileall: 21. モジュールを使えば可能です。

*note py_compile: b8. モジュールは手動で任意のモジュールをコンパイルでき
ます。やり方の一つは、このモジュールの ‘compile()’ 関数をインタラクティ
ブに実行することです:

     >>> import py_compile
     >>> py_compile.compile('foo.py')

このように実行すると、‘foo.py’ と同じ場所の ‘__pycache__’ サブディレクト
リに ‘.pyc’ が書き出されます (出力ファイルの位置は、オプション引数
‘cfile’ で上書きすることもできます)。

*note compileall: 21. モジュールを使えば自動的に一つや複数のディレクトリ
のすべてのファイルをコンパイルできます。シェルプロンプトから
‘compileall.py’ を起動して、コンパイルしたいファイルを含むディレクトリの
パスを指定してください:

     python -m compileall .

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-3147/


File: python.info,  Node: 現在のモジュール名を知るにはどうしますか？,  Next: 相互にインポートしあうモジュールを作るにはどうしたらいいですか？,  Prev: pyc ファイルを作るにはどうしますか？,  Up: モジュール<5>

10.2.7.2 現在のモジュール名を知るにはどうしますか？
...................................................

モジュールは前もって定義されたグローバル変数 ‘__name__’ を検索することで
自身の名前を決定できます。この値が ‘'__main__'’ であるとき、そのプログラ
ムはスクリプトとして実行されています。インポートされることによって使われ
る大抵のモジュールはコマンドラインインターフェースや自己テストも提供して
いて、‘__name__’ をチェックしてからそのコードだけを実行します:

     def main():
         print('Running test...')
         ...

     if __name__ == '__main__':
         main()


File: python.info,  Node: 相互にインポートしあうモジュールを作るにはどうしたらいいですか？,  Next: __import__ 'x y z' は <module 'x'> を返しますが、z を得るためにはどうしますか？,  Prev: 現在のモジュール名を知るにはどうしますか？,  Up: モジュール<5>

10.2.7.3 相互にインポートしあうモジュールを作るにはどうしたらいいですか？
.........................................................................

以下のモジュールがあったとしましょう:

‘foo.py’:

     from bar import bar_var
     foo_var = 1

‘bar.py’:

     from foo import foo_var
     bar_var = 2

問題はインタプリタが以下の段階を実行することです:

   * main が ‘foo’ をインポートする

   * ‘foo’ の空のグローバルが生成される

   * ‘foo’ がコンパイルされ実行を始める

   * ‘foo’ が ‘bar’ をインポートする

   * ‘bar’ の空のグローバルが生成される

   * ‘bar’ がコンパイルされ実行を始める

   * ‘bar’ が ‘foo’ をインポートする(すでに ‘foo’ という名前のモジュール
     があるので no-op となる)

   * インポートメカニズムは ‘foo’ のグローバルから ‘foo_var’ を読んで、
     ‘bar.foo_var = foo.foo_var’ に設定しようとします。

この最後の段階は失敗します。Python が ‘foo’ を解釈し終わっていなくて、
‘foo’ のグローバルなシンボルの辞書はまだ空ですから。

‘import foo’ を使って、グローバルコードの ‘foo.foo_var’ にアクセスしよう
としたときにも、これと同じことが起こります。

この問題には (少なくとも) 三つの解決策があります。

Guido van Rossum は ‘from <module> import ...’ を全く使わないで、すべて
のコードを関数の中に入れることを勧めています。グローバル変数とクラス変数
の初期化は定数とビルトイン関数のみで行われるべきです。これでインポートさ
れたすべてのモジュールは ‘<module>.<name>’ として参照されることになりま
す。

Jim Roskind はそれぞれのモジュールに対して以下の順に進めることを提案して
います:

   * エクスポート (インポートされた基底クラスを必要としないグローバル、
     関数、クラス)

   * ‘import’ 文

   * アクティブなコード (インポートされた値によって初期化されるグローバ
     ルを含む)。

インポートが奇妙な場所に現れることから Van Rossum はこの方法をそれほど好
みませんが、これは有効です。

Matthias Urlichs は第一に再帰インポートが必要ないようにコードを構築しな
おすことを推奨しています。

これらの解決策はそれぞれ両立させることもできます。


File: python.info,  Node: __import__ 'x y z' は <module 'x'> を返しますが、z を得るためにはどうしますか？,  Next: インポートされたモジュールを編集してから再インポートしましたが、変化が現れません。なぜですか？,  Prev: 相互にインポートしあうモジュールを作るにはどうしたらいいですか？,  Up: モジュール<5>

10.2.7.4 __import__('x.y.z') は <module 'x'> を返しますが、z を得るためにはどうしますか？
.........................................................................................

*note importlib: 7b. に *note import_module(): 73c. という便利な関数があ
るので、代わりにそちらを使用することを検討してください。

     z = importlib.import_module('x.y.z')


File: python.info,  Node: インポートされたモジュールを編集してから再インポートしましたが、変化が現れません。なぜですか？,  Prev: __import__ 'x y z' は <module 'x'> を返しますが、z を得るためにはどうしますか？,  Up: モジュール<5>

10.2.7.5 インポートされたモジュールを編集してから再インポートしましたが、変化が現れません。なぜですか？
.......................................................................................................

効率と一貫性上の理由から、Python はモジュールが最初にインポートされた時
にのみモジュールファイルを読み込みます。そうしないと、たくさんのモジュー
ルでできていて、それぞれが同じ基本モジュールをインポートしているようなプ
ログラムでは、その基本モジュールの解析と再解析が繰り返されることになりま
す。変更されさたモジュールの再読込を強制するには、こうしてください:

     import importlib
     import modname
     importlib.reload(modname)

注意:この手法は 100%安全とは言えません。とりわけ

     from modname import some_objects

のような文を含むモジュールは、インポートされたオブジェクトの古いバージョ
ンを使い続けます。そのモジュールにクラス定義が含まれていたら、存在するク
ラスインスタンスは新しいクラス定義を使うようにアップデート 'されません
'。これによって以下の矛盾した振舞いがなされえます:

     >>> import importlib
     >>> import cls
     >>> c = cls.C()                # Create an instance of C
     >>> importlib.reload(cls)
     <module 'cls' from 'cls.py'>
     >>> isinstance(c, cls.C)       # isinstance is false?!?
     False

この問題の本質は、クラスオブジェクトの "固有値" を印字することで明らかに
なります:

     >>> hex(id(c.__class__))
     '0x7352a0'
     >>> hex(id(cls.C))
     '0x4198d0'


File: python.info,  Node: デザインと歴史 FAQ,  Next: ライブラリと拡張 FAQ,  Prev: プログラミング FAQ,  Up: Python よくある質問

10.3 デザインと歴史 FAQ
=======================

* Menu:

* Python はなぜ文のグループ化にインデントを使うのですか？::
* なぜ単純な算術演算が奇妙な結果になるのですか？::
* なぜ浮動小数点数の計算はこんなに不正確なんですか？::
* なぜ Python の文字列はイミュータブルなのですか？::
* なぜメソッドの定義や呼び出しにおいて 'self' を明示しなければならないのですか？::
* 式中で代入ができないのはなぜですか？::
* Python にメソッドを使う機能 (list.index() 等) と関数を使う機能 (len(list) 等) があるのはなぜですか？: Python にメソッドを使う機能 list index 等 と関数を使う機能 len list 等 があるのはなぜですか？.
* join() がリストやタプルのメソッドではなく文字列のメソッドなのはなぜですか？: join がリストやタプルのメソッドではなく文字列のメソッドなのはなぜですか？.
* 例外はどれくらい速いのですか？::
* Python に switch や case 文がないのはなぜですか？::
* OS 特有のスレッド実装に依らずにインタプリタでスレッドをエミュレートすることはできないのですか？::
* なぜラムダ式は文を含むことができないのですか?::
* Python は C やその他の言語のように機械語にコンパイルできますか？::
* Python はメモリをどのように管理するのですか？::
* CPython はなぜ伝統的なガベージコレクションスキームを使わないのですか？::
* なぜ CPython の終了時にすべてのメモリが解放されるわけではないのですか？::
* なぜタプルとリストという別のデータ型が用意されているのですか？::
* CPythonでリストはどのように実装されているのですか？::
* CPythonで辞書はどのように実装されていますか？::
* なぜ辞書のキーはイミュータブルでなくてはならないのですか？::
* なぜ list.sort() はソートされたリストを返さないのですか？: なぜ list sort はソートされたリストを返さないのですか？.
* Python ではどのようにインターフェース仕様を特定し適用するのですか？::
* なぜ goto が無いのですか？::
* なぜ raw 文字列 (r-strings) はバックスラッシュで終わってはいけないのですか？: なぜ raw 文字列 r-strings はバックスラッシュで終わってはいけないのですか？.
* 属性の代入に "with" 文が使えないのはなぜですか？::
* なぜジェネレータは with 文をサポートしないのですか？::
* if/while/def/class 文にコロンが必要なのはなぜですか？::
* なぜ Python ではリストやタプルの最後にカンマがあっても良いのですか？::


File: python.info,  Node: Python はなぜ文のグループ化にインデントを使うのですか？,  Next: なぜ単純な算術演算が奇妙な結果になるのですか？,  Up: デザインと歴史 FAQ

10.3.1 Python はなぜ文のグループ化にインデントを使うのですか？
--------------------------------------------------------------

Guido van Rossum の信じるところによれば、インデントによるグループ化は非
常にエレガントで、普通の Python プログラムを大いに読みやすくします。しば
らくすればほとんどの人はこの仕様を気に入るようになります。

開始/終了の括弧がないので、構文解析器と人間の読者の間にグループ化の解釈
の違いは起こりえません。時折、C のプログラマはこのようなコード片に出くわ
します:

     if (x <= y)
             x++;
             y--;
     z++;

条件式が真のとき、 ‘x++’ 行のみが実行されます。しかしインデントによって
、多くの人が別のことを考えてしまいます。経験豊富なCプログラマでさえ、 ‘x
> y’ なのに ‘y’ がデクリメントされるのはなぜだろうと、このコードをしばら
く凝視することがあります。

Python は開始/終了の括弧がないので、コーディングスタイルの争いに余り影響
されません。C言語では中括弧の置き方についてさまざまな流儀があります。特
定のスタイルを使ってコードを読み書きするのに慣れたあと、別のスタイルでコ
ードを読んだり(あるいは書く必要に迫られたり)するときに、何となく心配にな
るのはよくあることです。

多くのコーディングスタイルは begin/end の括弧にそれぞれ一行を使います。
これではプログラムは冗長になって画面を浪費し、プログラムの見通しが悪くな
ります。一つの関数は一画面 (例えば 20 から 30 行) に収めるのが理想です。
20 行の Python は 20 行の C よりもはるかに多くの作業ができます。これは
begin/end の括弧がないからだけではありません - 宣言が不要なことや高レベ
ルなデータ型もその理由です - が、インデントに基づく構文は確かに役に立っ
ています。


File: python.info,  Node: なぜ単純な算術演算が奇妙な結果になるのですか？,  Next: なぜ浮動小数点数の計算はこんなに不正確なんですか？,  Prev: Python はなぜ文のグループ化にインデントを使うのですか？,  Up: デザインと歴史 FAQ

10.3.2 なぜ単純な算術演算が奇妙な結果になるのですか？
-----------------------------------------------------

次の質問を参照してください。


File: python.info,  Node: なぜ浮動小数点数の計算はこんなに不正確なんですか？,  Next: なぜ Python の文字列はイミュータブルなのですか？,  Prev: なぜ単純な算術演算が奇妙な結果になるのですか？,  Up: デザインと歴史 FAQ

10.3.3 なぜ浮動小数点数の計算はこんなに不正確なんですか？
---------------------------------------------------------

ユーザーはよく次のような結果に驚きます:

     >>> 1.2 - 1.0
     0.19999999999999996

そしてこれが Python のバグだと考えます。が、これはバグではありません。こ
の結果に Python はほとんど関与しておらず、むしろ基底のプラットフォームに
よる浮動小数点数の扱い方が関与しています。

CPython における *note float: 196. 型は記憶に C 言語の ‘double’ 型を使い
ます。 *note float: 196. オブジェクトの値は固定精度 (典型的には 53 bit)
の 2 進浮動小数点数として格納され、 Python はプロセッサのハードウェアが
実装している C 言語上の演算を使います。つまり、浮動小数点数に関して
Python は C 言語や Java のような多くの一般的な言語と同じように振る舞いま
す。

Many numbers that can be written easily in decimal notation cannot be
expressed exactly in binary floating point.  For example, after:

     >>> x = 1.2

‘x’ に保存された値は 10 進数の ‘1.2’ の (とても高い精度の) 近似値であっ
て、厳密な ‘1.2’ ではありません。一般的なコンピューターでは、実際に格納
される値は:

     1.0011001100110011001100110011001100110011001100110011 (binary)

で、正確には次の値です:

     1.1999999999999999555910790149937383830547332763671875 (decimal)

53bit の典型的な精度は、Python の float に 10 進数で 15〜16桁の精度を与
えます。

For a fuller explanation, please see the *note floating-point
arithmetic: 2101. chapter in the Python tutorial.


File: python.info,  Node: なぜ Python の文字列はイミュータブルなのですか？,  Next: なぜメソッドの定義や呼び出しにおいて 'self' を明示しなければならないのですか？,  Prev: なぜ浮動小数点数の計算はこんなに不正確なんですか？,  Up: デザインと歴史 FAQ

10.3.4 なぜ Python の文字列はイミュータブルなのですか？
-------------------------------------------------------

これにはいくつかの利点があります。

一つはパフォーマンスです。文字列がイミュータブルなら、生成時に領域を割り
当てることができるので、必要な記憶域は固定されて、変更されません。これは
タプルとリストを区別する理由の一つでもあります。

他の利点は、Python の文字列は数と同じくらい "基本的" なものと考えられる
ことです。8 という値を他の何かに変える手段が無いように、文字列 "eight" を
他の何かに変える手段も無いのです。


File: python.info,  Node: なぜメソッドの定義や呼び出しにおいて 'self' を明示しなければならないのですか？,  Next: 式中で代入ができないのはなぜですか？,  Prev: なぜ Python の文字列はイミュータブルなのですか？,  Up: デザインと歴史 FAQ

10.3.5 なぜメソッドの定義や呼び出しにおいて 'self' を明示しなければならないのですか？
-------------------------------------------------------------------------------------

このアイデアは Modula-3 から取り入れられました。これは様々な理由からとて
も便利だと言えます。

まず、ローカル変数ではなく、メソッドやインスタンス属性を扱っていることが
より明確になります。 ‘self.x’ や ‘self.meth()’ と書いてあれば、そのクラ
スの定義を憶えていなくても、それがインスタンス変数やメソッドであることは
明らかです。C++ では、(グローバルが滅多になかったり、簡単に見分けがつく
なら) ローカル変数宣言がないことからある程度わかるでしょう。- しかし
Python にはローカル変数宣言がないので、クラス定義を調べて確かめなくては
なりません。C++ や Java のコーディングスタンダードに、インスタンス属性に
‘m_’ 接頭辞をつけるものがあるので、この明示性はそれらの言語においても有
用です。

第二に、特定のクラスからメソッドを明示的に参照または呼び出ししたい時に、
特別な構文が必要なくなります。C++ では、派生クラスでオーバーライドされた
基底クラスからメソッドを使うには、 ‘::’ 演算子を使わなければなりません。
- Python では、 ‘baseclass.methodname(self, <argument list>)’ と書けます
。これは特に、 *note __init__(): 8bf. メソッドに便利ですし、派生クラスの
メソッドが、基底クラスにある同じ名前のメソッドを拡張するために、基底クラ
スのメソッドをどうにかして呼び出したい時にも便利です。

最後に、インスタンス変数に対する、代入の構文の問題を解決できます。Python
のローカル変数は、関数の中で (global が明示的に宣言されることなく) 値が
代入された変数 (と定義されています！) です。なので、ある代入が意図するの
が、ローカル変数へではなくインスタンス変数への代入であると、インタプリタ
が判断する手段が必要です。そしてそれは構文を見るだけで分かる方が (効率が
) 良いのです。C++ ではその区別を宣言時に行いますが、Python では宣言がな
いので、この方法でしか区別できなかったら残念です。 ‘self.var’ を明示すれ
ばうまく解決できます。同様に、インスタンス変数を使うのにも ‘self.var’ と
書かなければならないので、メソッドの中の self が付いていない名前への参照
は、そのインスタンスのディレクトリを検索するまでもなくローカル変数とわか
ります。別の言い方をすれば、ローカル変数とインスタンス変数は二つの異なる
名前空間に存在し、Python にどちらの名前空間を使うかを伝えなくてはならな
いのです。


File: python.info,  Node: 式中で代入ができないのはなぜですか？,  Next: Python にメソッドを使う機能 list index 等 と関数を使う機能 len list 等 があるのはなぜですか？,  Prev: なぜメソッドの定義や呼び出しにおいて 'self' を明示しなければならないのですか？,  Up: デザインと歴史 FAQ

10.3.6 式中で代入ができないのはなぜですか？
-------------------------------------------

Python 3.8 以降ならできるよ!

セイウチ演算子 ‘:=’ を使った代入式は、式の中で変数に代入します:

     while chunk := fp.read(200):
        print(chunk)

より詳しくは PEP 572(1) を参照してください。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0572/


File: python.info,  Node: Python にメソッドを使う機能 list index 等 と関数を使う機能 len list 等 があるのはなぜですか？,  Next: join がリストやタプルのメソッドではなく文字列のメソッドなのはなぜですか？,  Prev: 式中で代入ができないのはなぜですか？,  Up: デザインと歴史 FAQ

10.3.7 Python にメソッドを使う機能 (list.index() 等) と関数を使う機能 (len(list) 等) があるのはなぜですか？
-----------------------------------------------------------------------------------------------------------

Guidoいわく：

     (a) For some operations, prefix notation just reads better than
     postfix - prefix (and infix!)  operations have a long tradition in
     mathematics which likes notations where the visuals help the
     mathematician thinking about a problem.  Compare the easy with
     which we rewrite a formula like x*(a+b) into x*a + x*b to the
     clumsiness of doing the same thing using a raw OO notation.

     (b) When I read code that says len(x) I 'know' that it is asking
     for the length of something.  This tells me two things: the result
     is an integer, and the argument is some kind of container.  To the
     contrary, when I read x.len(), I have to already know that x is
     some kind of container implementing an interface or inheriting from
     a class that has a standard len().  Witness the confusion we
     occasionally have when a class that is not implementing a mapping
     has a get() or keys() method, or something that isn't a file has a
     write() method.

-- ‘https://mail.python.org/pipermail/python-3000/2006-November/004643.html’


File: python.info,  Node: join がリストやタプルのメソッドではなく文字列のメソッドなのはなぜですか？,  Next: 例外はどれくらい速いのですか？,  Prev: Python にメソッドを使う機能 list index 等 と関数を使う機能 len list 等 があるのはなぜですか？,  Up: デザインと歴史 FAQ

10.3.8 join() がリストやタプルのメソッドではなく文字列のメソッドなのはなぜですか？
----------------------------------------------------------------------------------

文字列は Python 1.6 から他の標準型に大きく近づきました。それ以前は常に
string モジュールの関数を使ってできていたことと同等の機能を持つメソッド
がこの時に追加されました。その新しいメソッドの多くは広く受け入れられまし
たが、一部のプログラマに不快を感じさせていると思われるものがこれで:

     ", ".join(['1', '2', '4', '8', '16'])

結果はこうなります:

     "1, 2, 4, 8, 16"

この使い方には二つの議論があります。

一つ目は、「文字列リテラル (文字列定数) のメソッドを使うのは醜すぎる」と
いうようなものです。確かにそうかも知れませんが、文字列リテラルは単なる固
定された値に過ぎないというのが答えです。文字列に束縛された名前にメソッド
が許されるなら、リテラルに使えないようにする論理的な理由はないでしょう。

二つ目の反対理由は、典型的には「私は実際、要素を文字列定数とともに結合さ
せるよう、シーケンスに命じているのだ」というものです。残念ながら、そうで
はないのです。いくつかの理由から *note split(): 10aa. を文字列のメソッド
としておいた方がはるかに簡単です。これを見ると分かりやすいでしょう

     "1, 2, 4, 8, 16".split(", ")

これは文字列リテラルに対する、与えられたセパレータ (または、デフォルトで
は任意の空白文字の連続) で区切られた部分文字列を返せという指示です。

*note join(): 2609. は、セパレータ文字列に、文字列のシーケンスをイテレー
トして隣り合う要素の間に自身を挿入するように指示しているので、文字列のメ
ソッドです。このメソッドは、独自に定義された新しいクラスを含め、シーケン
スの規則を満たすいかなる引数にも使えます。バイト列やバイト配列にも同様の
メソッドがあります。


File: python.info,  Node: 例外はどれくらい速いのですか？,  Next: Python に switch や case 文がないのはなぜですか？,  Prev: join がリストやタプルのメソッドではなく文字列のメソッドなのはなぜですか？,  Up: デザインと歴史 FAQ

10.3.9 例外はどれくらい速いのですか？
-------------------------------------

*note try: 8f8./*note except: 1ab. ブロックは例外が送出されなければ極端
に効率的です。実際に例外を捕捉するのは高価です。Python 2.0 より前のバー
ジョンでは、このイディオムを使うのが一般的でした:

     try:
         value = mydict[key]
     except KeyError:
         mydict[key] = getvalue(key)
         value = mydict[key]

これは、辞書がほとんどの場合にキーを持っていると予想できるときにのみ意味
をなします。そうでなければ、このように書きます:

     if key in mydict:
         value = mydict[key]
     else:
         value = mydict[key] = getvalue(key)

この特殊な場合では ‘value = dict.setdefault(key, getvalue(key))’ も使え
ますが、これは ‘getvalue()’ 呼び出しが十分安価な場合に限ります。なぜなら
それが全ての場合に評価されるからです。


File: python.info,  Node: Python に switch や case 文がないのはなぜですか？,  Next: OS 特有のスレッド実装に依らずにインタプリタでスレッドをエミュレートすることはできないのですか？,  Prev: 例外はどれくらい速いのですか？,  Up: デザインと歴史 FAQ

10.3.10 Python に switch や case 文がないのはなぜですか？
---------------------------------------------------------

一般的に、構造化された switch 文は、式が特定の値または値の集合を持つとき
、１つのコードブロックを実行します。 Python 3.10 以降では、リテラル値や
名前空間内の定数を、 ‘match ... case’ 文で簡単にマッチさせることができま
す。より古い手段は一連の ‘if... elif... elif... else’ です。

非常に大きな数の選択肢から選ぶとき、値を呼び出す関数に対応づける辞書を作
れます。例えば:

     functions = {'a': function_1,
                  'b': function_2,
                  'c': self.method_1}

     func = functions[value]
     func()

オブジェクトのメソッドを呼び出すには、さらに単純に *note getattr(): dca.
組み込み関数で特定の名前のメソッドを検索できます:

     class MyVisitor:
         def visit_a(self):
             ...

         def dispatch(self, value):
             method_name = 'visit_' + str(value)
             method = getattr(self, method_name)
             method()

メソッドの名前にこの例の ‘visit_’ のような接頭辞を使うことを勧めます。こ
のような接頭辞がないと、信頼できないソースから値が与えられたときに、オブ
ジェクトの任意のメソッドを呼び出す攻撃をされる可能性があります。

C の switch-case-default のような、フォールスルーのある switch を模倣す
ることもできますが、はるかに難しいうえに必要性も少ないでしょう。


File: python.info,  Node: OS 特有のスレッド実装に依らずにインタプリタでスレッドをエミュレートすることはできないのですか？,  Next: なぜラムダ式は文を含むことができないのですか?,  Prev: Python に switch や case 文がないのはなぜですか？,  Up: デザインと歴史 FAQ

10.3.11 OS 特有のスレッド実装に依らずにインタプリタでスレッドをエミュレートすることはできないのですか？
-------------------------------------------------------------------------------------------------------

答 1: 残念なことに、インタプリタは Python のスタックフレームごとに少なく
とも一つの C のスタックフレームを push します。同様に、拡張もほとんどラ
ンダムなときに Python にコールバックすることがあります。よって、完全なス
レッド実装には C のスレッドサポートが必要です。

答 2: 幸運なことに、Stackless Python(1) があります。これは完全に再デザイ
ンされたインタープリタで、Cのスタックを回避しています。

   ---------- Footnotes ----------

   (1) https://github.com/stackless-dev/stackless/wiki


File: python.info,  Node: なぜラムダ式は文を含むことができないのですか?,  Next: Python は C やその他の言語のように機械語にコンパイルできますか？,  Prev: OS 特有のスレッド実装に依らずにインタプリタでスレッドをエミュレートすることはできないのですか？,  Up: デザインと歴史 FAQ

10.3.12 なぜラムダ式は文を含むことができないのですか?
-----------------------------------------------------

Python のラムダ式が文を含むことができないのは、Python の文法的な枠組みが
式の中にネストされた文を扱うことができないからです。しかし、Python では
、これは深刻な問題ではありません。他の言語のラムダに機能が追加されている
のと違い、Python のラムダは単なる、関数を定義するのが面倒すぎる場合のた
めの簡略な記法に過ぎないのです。

関数は既に Python の第一級オブジェクトで、ローカルスコープ内で宣言できま
す。従って、ローカルで定義された関数ではなくラムダを使う利点は、関数の名
前を考える必要が無いことだけです - しかし、(ラムダ式が生み出すオブジェク
トと厳密に同じ型の) 関数オブジェクトが代入される先はただのローカル変数で
す！


File: python.info,  Node: Python は C やその他の言語のように機械語にコンパイルできますか？,  Next: Python はメモリをどのように管理するのですか？,  Prev: なぜラムダ式は文を含むことができないのですか?,  Up: デザインと歴史 FAQ

10.3.13 Python は C やその他の言語のように機械語にコンパイルできますか？
------------------------------------------------------------------------

Cython(1) compiles a modified version of Python with optional
annotations into C extensions.  Nuitka(2) is an up-and-coming compiler
of Python into C++ code, aiming to support the full Python language.

   ---------- Footnotes ----------

   (1) https://cython.org/

   (2) https://nuitka.net/


File: python.info,  Node: Python はメモリをどのように管理するのですか？,  Next: CPython はなぜ伝統的なガベージコレクションスキームを使わないのですか？,  Prev: Python は C やその他の言語のように機械語にコンパイルできますか？,  Up: デザインと歴史 FAQ

10.3.14 Python はメモリをどのように管理するのですか？
-----------------------------------------------------

Python のメモリ管理の詳細は実装に依ります。Python の標準の C 実装 *note
CPython: 905. は参照カウントを使って、アクセスできないオブジェクトを探し
ます。また別のメカニズムを使って参照サイクルを集めます。これはサイクル検
出アルゴリズムを定期的に実行し、アクセスできないサイクルを探し、巻き込ま
れたオブジェクトを削除します。 *note gc: 64. モジュールの関数で、ガベー
ジコレクションを実行し、デバッグ統計を取得し、コレクタのパラメタを変更で
きます。

Other implementations (such as Jython(1) or PyPy(2)), however, can rely
on a different mechanism such as a full-blown garbage collector.  This
difference can cause some subtle porting problems if your Python code
depends on the behavior of the reference counting implementation.

Python の実装によっては、以下の (CPython では通る) コードはおそらく、フ
ァイルディスクリプタを使い果たすでしょう:

     for file in very_long_list_of_files:
         f = open(file)
         c = f.read(1)

実際、CPython の参照カウントとデストラクタのスキームを使えば ‘f’ への新
しい代入ごとにファイルは閉じられます。しかし、伝統的な GC を使うと、これ
らのファイルオブジェクトが回収され (て閉じられる) までに不定な、場合によ
っては長い、間隔が空くことがあります。

Python の実装に依らずに動くコードを書くには、ファイルを明示的に閉じるか
、 *note with: 186. 文を使ってください。これでメモリ管理のスキームに関係
なく動きます:

     for file in very_long_list_of_files:
         with open(file) as f:
             c = f.read(1)

   ---------- Footnotes ----------

   (1) https://www.jython.org

   (2) https://pypy.org


File: python.info,  Node: CPython はなぜ伝統的なガベージコレクションスキームを使わないのですか？,  Next: なぜ CPython の終了時にすべてのメモリが解放されるわけではないのですか？,  Prev: Python はメモリをどのように管理するのですか？,  Up: デザインと歴史 FAQ

10.3.15 CPython はなぜ伝統的なガベージコレクションスキームを使わないのですか？
------------------------------------------------------------------------------

まず、それは C の標準的な機能ではないのでポータブルではありません。(確か
に Boehm GC ライブラリはあります。しかし、これにはアセンブリコードが含ま
れ、'ほとんどの' 有名なプラットフォームに対応していますが全てではありま
せん。また、ほとんど透過的ですが、完全に透過的ではありません。Python を
対応させるにはパッチが必要です。)

伝統的な GC は Python が他のアプリケーションに組み込まれるときにも問題と
なります。スタンドアロンの Python で動く限りでは、標準の ‘malloc()’ と
‘free()’ を GC ライブラリから提供されるものに置き換えても問題ありません
が、Python を実装したアプリケーションは Python のものではない '独自の' 代
替品を使おうとするかもしれません。現在のようにすることで、CPython は
‘malloc()’ と ‘free()’ が適切に実装されている限りどんなものにも対応させ
られます。


File: python.info,  Node: なぜ CPython の終了時にすべてのメモリが解放されるわけではないのですか？,  Next: なぜタプルとリストという別のデータ型が用意されているのですか？,  Prev: CPython はなぜ伝統的なガベージコレクションスキームを使わないのですか？,  Up: デザインと歴史 FAQ

10.3.16 なぜ CPython の終了時にすべてのメモリが解放されるわけではないのですか？
-------------------------------------------------------------------------------

Python モジュールのグローバルな名前空間から参照されるオブジェクトは、
Python の終了時にメモリの割り当てを解除されるとは限りません。これは、循
環参照があるときに起こりえます。解放できない C ライブラリ (例えば、
Purify のようなツールなどが当てはまります) によって割り当てられたいくら
かのメモリも含まれます。しかし、Python は終了時にメモリをクリーンアップ
することには積極的で、全ての単一のオブジェクトを破棄しようとします。

再割り当て時に Python が特定のものを削除するように強制したいときは、
*note atexit: d. モジュールを使って削除を強制する関数を実行してください
。


File: python.info,  Node: なぜタプルとリストという別のデータ型が用意されているのですか？,  Next: CPythonでリストはどのように実装されているのですか？,  Prev: なぜ CPython の終了時にすべてのメモリが解放されるわけではないのですか？,  Up: デザインと歴史 FAQ

10.3.17 なぜタプルとリストという別のデータ型が用意されているのですか？
----------------------------------------------------------------------

リストとタプルは、多くの点で似ていますが、一般には本質的に異なる方法で使
われます。タプルは、Pascal の ‘レコード’ や C の　‘構造体’ と同様なもの
と考えられます。型が異なっても良い関連するデータの小さな集合で、グループ
として演算されます。例えば、デカルト座標は 2 つや 3 つの数のタプルとして
適切に表せます。

一方、リストは、もっと他の言語の配列に近いものです。全て同じ型の可変数の
オブジェクトを持ち、それらが一つ一つ演算される傾向にあります。例えば、
*note os.listdir('.'): 1312. はカレントディレクトリ内にあるファイルの文
字列表現のリストを返します。この出力を演算する関数は一般に、ディレクトリ
に一つや二つの別のファイルを加えても壊れません。

タプルはイミュータブルなので、一度タプルが生成されたら、そのどの要素も新
しい値に置き換えられません。リストはミュータブルなので、リストの要素はい
つでも変更できます。イミュータブルな要素だけが辞書のキーとして使えるので
、リストではなくタプルだけがキーとして使えます。


File: python.info,  Node: CPythonでリストはどのように実装されているのですか？,  Next: CPythonで辞書はどのように実装されていますか？,  Prev: なぜタプルとリストという別のデータ型が用意されているのですか？,  Up: デザインと歴史 FAQ

10.3.18 CPythonでリストはどのように実装されているのですか？
-----------------------------------------------------------

CPythonのリストは実際に変数分の長さの配列で、Lispスタイルの連結リストで
はありません。この実装は他のオブジェクトへの参照の連続した配列を使用して
いて、この配列へのポインタおよび配列長はリストの先頭の構造体に保存されて
います。

これにより、リストのインデクシング ‘a[i]’ は、リストの大きさやインデクス
の値に依存しないコストで演算できます。

要素が追加または挿入されるとき、この参照の配列は大きさが変更されます。要
素追加の繰り返しのパフォーマンスを上げるために、少し工夫されています。配
列が大きくなるとき、次の何回かは実際に大きさを変更する必要がないように、
いくらかの追加の領域が割り当てられます。


File: python.info,  Node: CPythonで辞書はどのように実装されていますか？,  Next: なぜ辞書のキーはイミュータブルでなくてはならないのですか？,  Prev: CPythonでリストはどのように実装されているのですか？,  Up: デザインと歴史 FAQ

10.3.19 CPythonで辞書はどのように実装されていますか？
-----------------------------------------------------

CPython の辞書は大きさを変更できるハッシュテーブルとして実装されています
。B 木と比べて、ほとんどの条件下で (特に一般的な演算である) 探索のパフォ
ーマンスが良いですし、実装も単純です。

辞書は、辞書に保存されているそれぞれのキーに対応するハッシュコードを
*note hash(): 801. ビルトイン関数で計算することで機能します。このハッシ
ュコードはキーやプロセスごとのシードによって大きく変化します。例えば、
‘'Python'’ のハッシュ値は ‘-539294296’ ですが、ビットが一つ違うだけの文
字列 ‘'python'’ のハッシュ値は ‘1142331976’ です。そしてこのハッシュコー
ドは、値が保存される内部配列での位置を計算するために使われます。保存して
いるキーのハッシュ値が全て異なるとすれば、一定の時間 − Big-O 記法では
'O'(1) − でキーを検索できることになります。


File: python.info,  Node: なぜ辞書のキーはイミュータブルでなくてはならないのですか？,  Next: なぜ list sort はソートされたリストを返さないのですか？,  Prev: CPythonで辞書はどのように実装されていますか？,  Up: デザインと歴史 FAQ

10.3.20 なぜ辞書のキーはイミュータブルでなくてはならないのですか？
------------------------------------------------------------------

辞書のハッシュテーブルの実装は、キーを見つけるために、キー値から計算され
たハッシュ値を使います。もしキーがミュータブルなオブジェクトだったら、そ
の値は変えられ、それによりハッシュ値も変わってしまいます。しかし、キーオ
ブジェクトを変更したのが何者であれ、値が辞書のキーとして使われていたと気
付けないので、辞書の中のエントリを適切な場所に動かせません。そして、同じ
オブジェクトを探そうとしても、ハッシュ値が違うため見つかりません。古い値
を探そうとしても、そのハッシュバイナリから見つかるオブジェクトの値は異な
るでしょうから、これも見つかりません。

リストでインデクシングされた辞書が必要なら、まず単純にリストをタプルに変
換してください。関数 ‘tuple(L)’ は、リスト ‘L’ と同じエントリのタプルを
生成します。タプルはイミュータブルなので、辞書のキーとして使えます。

いくつかの受け入れられなかった提案:

   - アドレス (オブジェクト ID) のハッシュリスト。これは、同じ値の新しい
     リストを作っても見つからないので駄目です。例えば:

          mydict = {[1, 2]: '12'}
          print(mydict[[1, 2]])

     ‘[1, 2]’ の2行目のidは1行目のそれと異なってしまうために *note
     KeyError: 5e7. 例外を送出するでしょう。言い換えれば、辞書のキーは
     ‘==’ を使って比較されるべきであり、 *note is: 34c. ではないというこ
     とです。

   - リストをキーとして使うときにコピーを作る。リストはミュータブルなの
     で、自分自身への参照を含むことができ、コードをコピーするときに無限
     ループにハマる可能性があるので、これは駄目です。

   - リストをキーとして使うことを認めるが、ユーザにそれを変更させないよ
     うに伝える。もしユーザが忘れたり、偶然にリストが変更されてしまった
     りしたら、追跡困難なバグの可能性を生じてしまいます。またこれは、
     ‘d.keys()’ のすべての値は辞書のキーとして使えるという、辞書の重要な
     不変性も潰してしまいます。

   - リストが一旦辞書のキーとして使われたら、読み出し専用のマークを付け
     る。問題は、値を変えられるのはトップレベルオブジェクトだけではない
     ことです。リストを含むタプルもキーとして使えます。全てを辞書のキー
     として導入すると、そこから到達可能な全てのオブジェクトに読み出し専
     用のマークを付ける必要があります - そして再び、自己参照オブジェクト
     が無限ループを引き起こします。

必要ならばこれを回避する方法がありますが、自己責任のもとで行ってください
。ミュータブルな構造を、 *note __eq__(): cf2. と *note __hash__(): cf3.
メソッドの両方を持つクラスインスタンスに含めることができます。その時、辞
書 (またはハッシュに基づく別の構造体) に属するような全てのラッパーオブジ
ェクトのハッシュ値が、そのオブジェクトが辞書 (その他の構造体) 中にある間
固定され続けることを確実にしてください。

     class ListWrapper:
         def __init__(self, the_list):
             self.the_list = the_list

         def __eq__(self, other):
             return self.the_list == other.the_list

         def __hash__(self):
             l = self.the_list
             result = 98767 - len(l)*555
             for i, el in enumerate(l):
                 try:
                     result = result + (hash(el) % 9999999) * 1001 + i
                 except Exception:
                     result = (result % 7777777) + i * 333
             return result

なお、リストのメンバーの中にハッシュ化できないものがある可能性や、算術オ
ーバーフローの可能性から、ハッシュ計算は複雑になります。

さらに、そのオブジェクトが辞書に含まれるか否かにかかわらず、 ‘o1 == o2’
(すなわち ‘o1.__eq__(o2) is True’) ならばいつでも ‘hash(o1) == hash(o2)’
(すなわち ‘o1.__hash__() == o2.__hash__()’) でなくてはなりません。その制
限に適合できなければ、辞書やその他のハッシュに基づく構造体は間違いを起こ
します。

この ‘ListWrapper’ の例では、異常を避けるため、ラッパオブジェクトが辞書
内にある限りラップされたリストが変更されてはなりません。この条件と満たせ
なかった時の結果について知恵を絞る覚悟がない限り、これをしてはいけません
。よく考えてください。


File: python.info,  Node: なぜ list sort はソートされたリストを返さないのですか？,  Next: Python ではどのようにインターフェース仕様を特定し適用するのですか？,  Prev: なぜ辞書のキーはイミュータブルでなくてはならないのですか？,  Up: デザインと歴史 FAQ

10.3.21 なぜ list.sort() はソートされたリストを返さないのですか？
-----------------------------------------------------------------

パフォーマンスが問題となる状況では、ソートするためだけにリストのコピーを
作るのは無駄が多いです。そこで、 *note list.sort(): dc8. はインプレース
にリストをソートします。このことを忘れないため、この関数はソートされたリ
ストを返しません。こうすることで、ソートされたコピーが必要で、ソートされ
ていないものも残しておきたいときに、うっかり上書きしてしまうようなことが
なくなります。

新しいリストを返したいなら、代わりに組み込みの *note sorted(): dc7. 関数
を使ってください。この関数は、与えられたイテレート可能オブジェクトから新
しいリストを生成し、ソートして返します。例えば、辞書のキーをソートされた
順序でイテレートする方法は:

     for key in sorted(mydict):
         ...  # do whatever with mydict[key]...


File: python.info,  Node: Python ではどのようにインターフェース仕様を特定し適用するのですか？,  Next: なぜ goto が無いのですか？,  Prev: なぜ list sort はソートされたリストを返さないのですか？,  Up: デザインと歴史 FAQ

10.3.22 Python ではどのようにインターフェース仕様を特定し適用するのですか？
---------------------------------------------------------------------------

C++ や Java のような言語が提供するような、モジュールに対するインターフェ
ース仕様の特定は、モジュールのメソッドや関数の原型を表現します。インター
フェースの特定がコンパイル時に適用されることが、大きなプログラムの構成に
役立つと、広く感じられています。

Python 2.6 で、抽象基底クラス (Abstract Base Class, ABC) が定義できるよ
うになる *note abc: 4. モジュールが追加されました。なので *note
isinstance(): 2ad. と *note issubclass(): 9c4. を使って、インスタンスや
クラスが、ある ABC を実装しているかどうかチェックできます。*note
collections.abc: 1f. モジュールでは、 *note Iterable: 26ae. 、 *note
Container: 26b0. 、 *note MutableMapping: 12c0. などの便利な ABC が定義
されています。

Pythonでは、インターフェース仕様の多くの利点は、コンポーネントへの適切な
テスト規律により得られます。

モジュールのための適切なテストスイートは、回帰テストを提供し、モジュール
のインターフェース仕様や用例集としても役立ちます。多くの Python モジュー
ルは、簡単な「自己テスト」を提供するスクリプトとして実行できます。複雑な
外部インターフェースを使うモジュールさえ、外部インターフェースの細かい「
スタブ」エミュレーションで単独にテストできることが多いです。 *note
doctest: 3e. や *note unittest: 10c. モジュール、あるいはサードパーティ
のテストフレームワークで、モジュールのコードの全ての行に及ぶ徹底的なテス
トスイートを構成できます。

An appropriate testing discipline can help build large complex
applications in Python as well as having interface specifications would.
In fact, it can be better because an interface specification cannot test
certain properties of a program.  For example, the *note list.append():
8dc. method is expected to add new elements to the end of some internal
list; an interface specification cannot test that your *note
list.append(): 8dc. implementation will actually do this correctly, but
it's trivial to check this property in a test suite.

テストスイートを書くことはとても有用ですし、簡単にテストできるコード設計
を心がけると良いでしょう。人気を博している開発手法の一つ、テスト駆動開発
は、実際のコードを記述するよりも先に、まずテストスイートの部分を記述する
よう求めています。ご心配なく、Python は、あなたがいい加減でもテストケー
スを全く書かなくても構いません。


File: python.info,  Node: なぜ goto が無いのですか？,  Next: なぜ raw 文字列 r-strings はバックスラッシュで終わってはいけないのですか？,  Prev: Python ではどのようにインターフェース仕様を特定し適用するのですか？,  Up: デザインと歴史 FAQ

10.3.23 なぜ goto が無いのですか？
----------------------------------

1970年代、人々は気付きました。秩序なき goto は、理解するのも手直しするの
も困難という厄介な"スパゲッティ"コードに陥りがちであると。 高水準言語で
は、分岐とループの手段があれば goto は不要です。 (Pythonだと、分岐には
*note if: 181. 文及び *note or: 34d. ・ *note and: 349. ・ *note if:
181./*note else: 17c. 式を使います。ループには *note while: 1973. 文と
*note for: 34a. 文を使い、 ループ内に *note continue: 180. ・ *note
break: 17f. を含むことがあります)

関数の呼び出しをまたいでも動作する "構造化された goto" をまかなうものと
して例外を使えます。C、Fortran、その他の言語での ‘go’ あるいは ‘goto’ 構
造の適切な用途は全て、例外で同じようなことをすれば便利であると、広く感じ
られています。例えば:

     class label(Exception): pass  # declare a label

     try:
         ...
         if condition: raise label()  # goto label
         ...
     except label:  # where to goto
         pass
     ...

例外ではループ内へ跳ぶことはできませんが、どちらにしてもそれは ‘goto’ の
乱用と見なされるものです。使うのは控えてください。


File: python.info,  Node: なぜ raw 文字列 r-strings はバックスラッシュで終わってはいけないのですか？,  Next: 属性の代入に "with" 文が使えないのはなぜですか？,  Prev: なぜ goto が無いのですか？,  Up: デザインと歴史 FAQ

10.3.24 なぜ raw 文字列 (r-strings) はバックスラッシュで終わってはいけないのですか？
------------------------------------------------------------------------------------

正確には、奇数個のバックスラッシュで終わってはいけません。終わりの対にな
っていないバックスラッシュは、閉じ引用文字をエスケープし、終っていない文
字列を残してしまいます。

raw 文字列は、独自にバックスラッシュの処理をしようとするプロセッサ (主に
正規表現エンジン) への入力を生成しやすいように設計されたものです。このよ
うなプロセッサは、終端の対になっていないバックスラッシュを結局エラーとみ
なすので、raw 文字列はそれを認めません。その代わりに、バックスラッシュで
エスケープすることで、引用文字を文字列として渡すことができます。r-string
が意図された目的に使われるときに、この規則が役に立つのです。

Windows のパス名を構築するときには、Windows のシステムコールは普通のスラ
ッシュも受け付けることを憶えておいてください:

     f = open("/mydir/file.txt")  # works fine!

DOS コマンドのパス名を構築するときには、例えばこの中のどれかを試してくだ
さい:

     dir = r"\this\is\my\dos\dir" "\\"
     dir = r"\this\is\my\dos\dir\ "[:-1]
     dir = "\\this\\is\\my\\dos\\dir\\"


File: python.info,  Node: 属性の代入に "with" 文が使えないのはなぜですか？,  Next: なぜジェネレータは with 文をサポートしないのですか？,  Prev: なぜ raw 文字列 r-strings はバックスラッシュで終わってはいけないのですか？,  Up: デザインと歴史 FAQ

10.3.25 属性の代入に "with" 文が使えないのはなぜですか？
--------------------------------------------------------

Python には、ブロックの実行を包む *note with: 186. 文があり、ブロックに
入るときとブロックから出るときに、コードを呼び出します。以下のような構造
を持つ言語があります:

     with obj:
         a = 1               # equivalent to obj.a = 1
         total = total + 1   # obj.total = obj.total + 1

Python では、このような構造は曖昧になるでしょう。

Object Pascal、Delphi、C++のような他の言語では、静的な型を使うので、曖昧
な方法でも、どのメンバに代入されているのか分かります。これが静的型付けの
要点です - コンパイラは 'いつでも' コンパイル時にすべての変数のスコープ
を知るのです。

Python は動的な型を使います。実行時にどの属性が参照されるか事前に分かり
ません。動作中にメンバ属性が追加あるいは除去されるかもしれません。これで
は、単純に読むだけではどのアトリビュートが参照されているか分かりません。
ローカルなのか、グローバルなのか、メンバ属性なのか？

例えば、以下の不完全なコード片を考えましょう:

     def foo(a):
         with a:
             print(x)

このコード片では、‘a’ は ‘x’.  というメンバ属性を持っていると仮定されて
います。しかし、Python ではインタプリタにはこの仮定を伝えられる仕組みは
ありません。 ‘a’ が、例えば整数だったら、どうなってしまうでしょうか。
‘x’ という名前のグローバル変数があったら、それが *note with: 186. ブロッ
クの中で使われるのでしょうか。この通り、Python の動的な特質から、このよ
うな選択はとても難しい物になっています。

しかし、*note with: 186. やそれに類する言語の機能の一番の利点 (コード量
の削減) は、 Python では代入により簡単に手に入れられます:

     function(args).mydict[index][index].a = 21
     function(args).mydict[index][index].b = 42
     function(args).mydict[index][index].c = 63

こう書いてください:

     ref = function(args).mydict[index][index]
     ref.a = 21
     ref.b = 42
     ref.c = 63

Python では実行時に名前束縛が解決され、後者はその解決が一度で済むため、
これには実行速度をあげる副作用もあります。

似た提案として、「先頭のドット」を使うなどして さらにコード量を減らす構
文は、明白さを優先をして却下されました
(‘https://mail.python.org/pipermail/python-ideas/2016-May/040070.html’ 参
照)。


File: python.info,  Node: なぜジェネレータは with 文をサポートしないのですか？,  Next: if/while/def/class 文にコロンが必要なのはなぜですか？,  Prev: 属性の代入に "with" 文が使えないのはなぜですか？,  Up: デザインと歴史 FAQ

10.3.26 なぜジェネレータは with 文をサポートしないのですか？
------------------------------------------------------------

技術的な理由で、ジェネレータは直接コンテキストマネージャとして使ってもう
まく動きません。最も一般的なように、ジェネレータが最後まで回りきるイテレ
ータとして使われる場合、クローズ処理は不要です。必要な場合は、 *note
with: 186. 文で *note contextlib.closing(generator): 15a1. のようにラッ
プします。


File: python.info,  Node: if/while/def/class 文にコロンが必要なのはなぜですか？,  Next: なぜ Python ではリストやタプルの最後にカンマがあっても良いのですか？,  Prev: なぜジェネレータは with 文をサポートしないのですか？,  Up: デザインと歴史 FAQ

10.3.27 if/while/def/class 文にコロンが必要なのはなぜですか？
-------------------------------------------------------------

主に可読性を高めるため (実験的な ABC 言語の結果の一つ) に、コロンが必要
です:

     if a == b
         print(a)

と:

     if a == b:
         print(a)

を考えれば、後者のほうが少し読みやすいでしょう。さらに言えば、この FAQ の
解答例は次のようになるでしょう。これは、英語の標準的な用法です。

他の小さな理由は、コロンによってエディタがシンタックスハイライトをしやす
くなることです。プログラムテキストの手の込んだ解析をしなくても、コロンを
探せばいつインデントを増やすべきかを決められます。


File: python.info,  Node: なぜ Python ではリストやタプルの最後にカンマがあっても良いのですか？,  Prev: if/while/def/class 文にコロンが必要なのはなぜですか？,  Up: デザインと歴史 FAQ

10.3.28 なぜ Python ではリストやタプルの最後にカンマがあっても良いのですか？
----------------------------------------------------------------------------

Python では、リスト、タプル、辞書の最後の要素の後端にカンマをつけても良
いことになっています:

     [1, 2, 3,]
     ('a', 'b', 'c',)
     d = {
         "A": [1, 5],
         "B": [6, 7],  # last trailing comma is optional but good style
     }

これを許すのには、いくつかの理由があります。

リストやタプルや辞書のリテラルが複数行に渡っているときに、前の行にカンマ
を追加するのを覚えておく必要が無いため、要素を追加するのが楽になります。
また、文法エラーを起こすこと無く、行の並べ替えを行うことができます。

間違えてカンマを落としてしまうと、診断しづらいエラーにつながります。例え
ば:

     x = [
       "fee",
       "fie"
       "foo",
       "fum"
     ]

このリストには4つの要素があるように見えますが、実際には3つしかありません
。 "fee"、"fiefoo"、"fum" です。 常にカンマを付けるようにすれば、この種
のエラーが避けられます。

後端にカンマをつけても良いことにすれば、プログラムによるコード生成も簡単
になります。


File: python.info,  Node: ライブラリと拡張 FAQ,  Next: 拡張と埋め込み FAQ,  Prev: デザインと歴史 FAQ,  Up: Python よくある質問

10.4 ライブラリと拡張 FAQ
=========================

* Menu:

* ライブラリ一般の質問::
* よくある作業::
* スレッド::
* 入力と出力: 入力と出力<2>.
* ネットワーク/インターネットプログラミング::
* データベース::
* 数学と数::


File: python.info,  Node: ライブラリ一般の質問,  Next: よくある作業,  Up: ライブラリと拡張 FAQ

10.4.1 ライブラリ一般の質問
---------------------------

* Menu:

* 作業 X を行うためのモジュールやアプリケーションを探すにはどうしますか？::
* math.py (socket.py, regex.py, etc.) のソースファイルはどこにありますか？: math py socket py regex py etc のソースファイルはどこにありますか？.
* Python のスクリプトを Unix で実行可能にするにはどうしますか？::
* Python には curses/termcap パッケージはありますか？::
* Python には C の onexit() に相当するものはありますか？: Python には C の onexit に相当するものはありますか？.
* シグナルハンドラが動かないのですがなぜですか？::


File: python.info,  Node: 作業 X を行うためのモジュールやアプリケーションを探すにはどうしますか？,  Next: math py socket py regex py etc のソースファイルはどこにありますか？,  Up: ライブラリ一般の質問

10.4.1.1 作業 X を行うためのモジュールやアプリケーションを探すにはどうしますか？
................................................................................

*note ライブラリリファンレス: 149. から関係がありそうな標準ライブラリモ
ジュールがあるかどうか調べてください。 (標準ライブラリに何があるかが分か
るようになると、この段階をスキップすることができます。)

サードパーティのパッケージについては、Python Package Index(1) を探したり
、Google(2) その他の web サーチエンジンを試してください。"Python" に加え
て一つか二つのキーワードで興味のある話題を検索すれば、たいてい役に立つも
のが見つかるでしょう。

   ---------- Footnotes ----------

   (1) https://pypi.org

   (2) https://www.google.com


File: python.info,  Node: math py socket py regex py etc のソースファイルはどこにありますか？,  Next: Python のスクリプトを Unix で実行可能にするにはどうしますか？,  Prev: 作業 X を行うためのモジュールやアプリケーションを探すにはどうしますか？,  Up: ライブラリ一般の質問

10.4.1.2 math.py (socket.py, regex.py, etc.) のソースファイルはどこにありますか？
.................................................................................

モジュールのソースファイルが見付けられない場合は、それは C 、 C++ かもし
くは別のコンパイル言語で実装された、ビルトインもしくは動的に読み込まれる
モジュールかもしれません。この場合、ソースは手に入らないかもしれませんし
、 ‘mathmodule.c’ のようなものが (Python の読み込みパスに無い) C ソース
ディレクトリのどこかにあるかもしれません。

Python のモジュールには、(少なくとも) 3 種類あります:

  1. Python で書かれたモジュール (.py)。

  2. C で書かれ、動的にロードされるモジュール (.dll, .pyd, .so, .sl,
     etc)。

  3. C で書かれ、インタプリタにリンクされているモジュール。このリストを
     得るには、こうタイプしてください:

          import sys
          print(sys.builtin_module_names)


File: python.info,  Node: Python のスクリプトを Unix で実行可能にするにはどうしますか？,  Next: Python には curses/termcap パッケージはありますか？,  Prev: math py socket py regex py etc のソースファイルはどこにありますか？,  Up: ライブラリ一般の質問

10.4.1.3 Python のスクリプトを Unix で実行可能にするにはどうしますか？
......................................................................

二つの条件があります :スクリプトファイルのモードが実行可能で、最初の行が
‘#!’ で始まり Python インタプリタのパスが続いていなければなりません。

前者は、‘chmod +x scriptfile’ 、場合によっては ‘chmod 755 scriptfile’ を
実行すればできます。

後者は、いくつかの方法でできます。最も直接的な方法はこのように

     #!/usr/local/bin/python

のようにファイルの一番最初の行に、プラットフォーム上の Python がインスト
ールされているパス名を書くことです。

スクリプトを Python インタプリタの場所に依存させたくない場合は、 ‘env’ プ
ログラムが使えます。 Python インタプリタがユーザの ‘PATH’ のディレクトリ
にあることを前提とすれば、ほとんど全ての Unix 系 OS では次の書き方をサポ
ートしています:

     #!/usr/bin/env python

CGI スクリプトでこれをやっては 'いけません' 。 CGI スクリプトの ‘PATH’ 変
数はたいてい最小限のものになっているので、実際のインタプリタの絶対パスを
使う必要があります。

ときおり、ユーザ環境に余裕が無く ‘/usr/bin/env’ プログラムが失敗すること
があります; もしくは、 env プログラム自体が無いことがあります。そのよう
な場合は、次の (Alex Rezinsky による) ハックが試せます:

     #! /bin/sh
     """:"
     exec python $0 ${1+"$@"}
     """

これには、スクリプトの __doc__ 文字列を定義するというちょっとした欠点が
あります。しかし、これを付け足せば直せます:

     __doc__ = """...Whatever..."""


File: python.info,  Node: Python には curses/termcap パッケージはありますか？,  Next: Python には C の onexit に相当するものはありますか？,  Prev: Python のスクリプトを Unix で実行可能にするにはどうしますか？,  Up: ライブラリ一般の質問

10.4.1.4 Python には curses/termcap パッケージはありますか？
............................................................

Unix 系 OS において: 標準の Python ソースディストリビューションには
Modules(1) サブディレクトリに curses モジュールが付いてきますが、デフォ
ルトではコンパイルされていません。 (これは Windows 用ディストリビューシ
ョンでは利用できないことに注意してください - Windows には curses モジュ
ールはありません。)

*note curses: 2f. モジュールは基本的な curses の機能や、色付きの表示、別
の文字集合サポート、パッド、マウスサポートなどの ncurses や SYSV curses
の多くの機能をサポートしています。このことは、モジュールが BSD curses だ
けしか持っていない OS とは互換性が無いことを意味しますが、現在メンテナン
スされている OS でそういう類のものは無さそうです。

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Modules


File: python.info,  Node: Python には C の onexit に相当するものはありますか？,  Next: シグナルハンドラが動かないのですがなぜですか？,  Prev: Python には curses/termcap パッケージはありますか？,  Up: ライブラリ一般の質問

10.4.1.5 Python には C の onexit() に相当するものはありますか？
...............................................................

*note atexit: d. モジュールは、 C の ‘onexit()’ と同じような関数登録を提
供します。


File: python.info,  Node: シグナルハンドラが動かないのですがなぜですか？,  Prev: Python には C の onexit に相当するものはありますか？,  Up: ライブラリ一般の質問

10.4.1.6 シグナルハンドラが動かないのですがなぜですか？
.......................................................

最もありがちな問題は、シグナルハンドラが間違った引数リストで宣言されてい
ることです。これは次のように呼び出されます

     handler(signum, frame)

だから、これは二つの仮引数で宣言されるべきです:

     def handler(signum, frame):
         ...


File: python.info,  Node: よくある作業,  Next: スレッド,  Prev: ライブラリ一般の質問,  Up: ライブラリと拡張 FAQ

10.4.2 よくある作業
-------------------

* Menu:

* Python のプログラムやコンポーネントをテストするにはどうしますか？::
* Python のドキュメント文字列からドキュメントを生成するにはどうしますか？::
* 一度に一つの押鍵を取得するにはどうしますか？::


File: python.info,  Node: Python のプログラムやコンポーネントをテストするにはどうしますか？,  Next: Python のドキュメント文字列からドキュメントを生成するにはどうしますか？,  Up: よくある作業

10.4.2.1 Python のプログラムやコンポーネントをテストするにはどうしますか？
..........................................................................

Python には二つのテストフレームワークがついています。*note doctest: 3e.
モジュールは、モジュールの docstring から使用例を見つけてそれらを実行し
、出力を docstring によって与えられた望まれる出力と比較します。

*note unittest: 10c. モジュールは、Java や Smalltalk のテストフレームワ
ークを模した装飾されたテストフレームワークです。

テスト作業を簡単にするために、プログラムにおいてモジュール性の良い設計を
使うべきです。プログラムでは、ほぼ全ての処理を関数やクラスのメソッドで包
むべきです - こうすることで、プログラムが速くなるという驚くような愉快な
効果がときおり得られることがあります (というのも、ローカル変数へのアクセ
スはグローバルなアクセスよりも速いからです)。さらに言うと、テストを行う
のがより難しくなってしまうため、プログラムは可変なグローバル変数に依存す
るのを避けるべきです。

プログラムの "global main logic" は

     if __name__ == "__main__":
         main_logic()

のように main モジュールの最後に出来る限りシンプルなものを書くのが良いで
しょう。

プログラムが整理され、関数やクラスの動作が追いやすい状態になったら、その
動作を試すテスト関数を書くべきです。一連のテストを自動化するテストスイー
トは、それぞれのモジュールに関連付けることができます。これは手間が掛かり
そうに思えますが、Python は簡素で融通が効くので、驚くほど簡単です。"製品
コード (production code)" と並行でテスト関数を書くことで、バグや設計の不
備でさえも早い段階で簡単に見付かるようになるので、コーディング作業をより
心地良く楽しいものにできます。

プログラムのメインモジュールとして設計されたのではない "補助モジュール"
には、モジュールの自己テストを含めるといいでしょう。

     if __name__ == "__main__":
         self_test()

複雑な外部インターフェースと作用し合うプログラムでさえ、外部インターフェ
ースが使えない時でも、Python で実装された "fake" インターフェースを使っ
てテストできます。


File: python.info,  Node: Python のドキュメント文字列からドキュメントを生成するにはどうしますか？,  Next: 一度に一つの押鍵を取得するにはどうしますか？,  Prev: Python のプログラムやコンポーネントをテストするにはどうしますか？,  Up: よくある作業

10.4.2.2 Python のドキュメント文字列からドキュメントを生成するにはどうしますか？
................................................................................

*note pydoc: ba. モジュールで Python ソースコード内のドキュメント文字列
から HTML を生成できます。純粋に docstring から API ドキュメントを生成す
るには、他に epydoc(1) という選択肢もあります。 Sphinx(2) も docstring の
内容を含めることができます。

   ---------- Footnotes ----------

   (1) https://epydoc.sourceforge.net/

   (2) https://www.sphinx-doc.org


File: python.info,  Node: 一度に一つの押鍵を取得するにはどうしますか？,  Prev: Python のドキュメント文字列からドキュメントを生成するにはどうしますか？,  Up: よくある作業

10.4.2.3 一度に一つの押鍵を取得するにはどうしますか？
.....................................................

Unix 系 OS ではいくつか解決方法があります。curses を使うのが素直なやり方
ですが、curses は学ぶには少し大き過ぎるモジュールです。


File: python.info,  Node: スレッド,  Next: 入力と出力<2>,  Prev: よくある作業,  Up: ライブラリと拡張 FAQ

10.4.3 スレッド
---------------

* Menu:

* スレッドを使ったプログラムを書くにはどうしますか？::
* スレッドが一つも実行されていないようです。なぜですか？::
* たくさんのワーカースレッドに作業を割り振るにはどうしますか？::
* グローバルな値のどんな種類の変更がスレッドセーフになるのですか？::
* グローバルインタプリタロック (Global Interpreter Lock) を取り除くことはできないのですか？: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？.


File: python.info,  Node: スレッドを使ったプログラムを書くにはどうしますか？,  Next: スレッドが一つも実行されていないようです。なぜですか？,  Up: スレッド

10.4.3.1 スレッドを使ったプログラムを書くにはどうしますか？
...........................................................

*note _thread: 2. モジュールではなく、必ず *note threading: f3. モジュー
ルを使ってください。 *note threading: f3. モジュールは、 *note _thread:
2. モジュールで提供される低レベルな基本要素の、便利な抽象化を構成します
。


File: python.info,  Node: スレッドが一つも実行されていないようです。なぜですか？,  Next: たくさんのワーカースレッドに作業を割り振るにはどうしますか？,  Prev: スレッドを使ったプログラムを書くにはどうしますか？,  Up: スレッド

10.4.3.2 スレッドが一つも実行されていないようです。なぜですか？
...............................................................

メインスレッドが終了するとともに、全てのスレッドは終了されます。メインス
レッドは速く働きすぎるので、スレッドには何をする時間も与えられません。

簡単な解決策は、プログラムの終わりに、スレッドが完了するのに十分な時間の
スリープを加えることです:

     import threading, time

     def thread_task(name, n):
         for i in range(n):
             print(name, i)

     for i in range(10):
         T = threading.Thread(target=thread_task, args=(str(i), i))
         T.start()

     time.sleep(10)  # <---------------------------!

しかし、実際は (ほとんどのプラットフォームでは) スレッドは並行して実行さ
れるのではなく、一つづつ実行されるのです！なぜなら、OS のスレッドスケジ
ューラは、前のスレッドがブロックされるまで新しいスレッドを開始しないから
です。

簡単に直すには、関数の実行の最初にちょっとスリープを加えることです:

     def thread_task(name, n):
         time.sleep(0.001)  # <--------------------!
         for i in range(n):
             print(name, i)

     for i in range(10):
         T = threading.Thread(target=thread_task, args=(str(i), i))
         T.start()

     time.sleep(10)

*note time.sleep(): 8ac. の良い遅延時間を推測しようとするよりも、セマフ
ォのような仕組みを使う方が良いでしょう。 1 つのアイディアは *note queue:
bb. モジュールを使って、キューオブジェクトを作り、各スレッドが完了したと
きにキューにトークンを追加し、メインスレッドにスレッドと同じ数のトークン
をキューから読み出させることです。


File: python.info,  Node: たくさんのワーカースレッドに作業を割り振るにはどうしますか？,  Next: グローバルな値のどんな種類の変更がスレッドセーフになるのですか？,  Prev: スレッドが一つも実行されていないようです。なぜですか？,  Up: スレッド

10.4.3.3 たくさんのワーカースレッドに作業を割り振るにはどうしますか？
.....................................................................

最も簡単な方法は、新しい *note concurrent.futures: 24. モジュール、特に
*note ThreadPoolExecutor: 949. クラスを使うことです。

もしくは、実行アルゴリズムを上手にコントロールしたい場合は、自身の手でロ
ジックを書くこともできます。 *note queue: bb. モジュールを使って、ジョブ
のリストを含むキューを作ってください。 *note Queue: 15ac. クラスはオブジ
ェクトのリストを保持し、キューに要素を追加する ‘.put(obj)’ メソッド、そ
れら要素を返す ‘.get()’ メソッドを持っています。このクラスは、それぞれの
ジョブがきっちり 1 回だけ取り出されることを保証するのに必要なロック処理
にも配慮します。

ここにちょっとした例があります:

     import threading, queue, time

     # The worker thread gets jobs off the queue.  When the queue is empty, it
     # assumes there will be no more work and exits.
     # (Realistically workers will run until terminated.)
     def worker():
         print('Running worker')
         time.sleep(0.1)
         while True:
             try:
                 arg = q.get(block=False)
             except queue.Empty:
                 print('Worker', threading.current_thread(), end=' ')
                 print('queue empty')
                 break
             else:
                 print('Worker', threading.current_thread(), end=' ')
                 print('running with argument', arg)
                 time.sleep(0.5)

     # Create queue
     q = queue.Queue()

     # Start a pool of 5 workers
     for i in range(5):
         t = threading.Thread(target=worker, name='worker %i' % (i+1))
         t.start()

     # Begin adding work to the queue
     for i in range(50):
         q.put(i)

     # Give threads time to run
     print('Main thread sleeping')
     time.sleep(5)

実行時には、以下のように出力されます:

     Running worker
     Running worker
     Running worker
     Running worker
     Running worker
     Main thread sleeping
     Worker <Thread(worker 1, started 130283832797456)> running with argument 0
     Worker <Thread(worker 2, started 130283824404752)> running with argument 1
     Worker <Thread(worker 3, started 130283816012048)> running with argument 2
     Worker <Thread(worker 4, started 130283807619344)> running with argument 3
     Worker <Thread(worker 5, started 130283799226640)> running with argument 4
     Worker <Thread(worker 1, started 130283832797456)> running with argument 5
     ...

より詳しいことはモジュールのドキュメントを調べてください; *note Queue:
15ac. クラスは多機能なインターフェースを提供しています。


File: python.info,  Node: グローバルな値のどんな種類の変更がスレッドセーフになるのですか？,  Next: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？,  Prev: たくさんのワーカースレッドに作業を割り振るにはどうしますか？,  Up: スレッド

10.4.3.4 グローバルな値のどんな種類の変更がスレッドセーフになるのですか？
.........................................................................

*note global interpreter lock: 474. (GIL) が内部で使われ、Python VM で一
度に一つだけのスレッドが実行されることが保証されています。一般に、Python
ではスレッド間の切り替えをバイトコード命令の間でのみ行います。切り替えの
周期は、 *note sys.setswitchinterval(): b44. で設定できます。したがって
、それぞれのバイトコード命令、そしてそれぞれの命令が届く全ての C 実装コ
ードは、 Python プログラムの観点からは、アトミックです。

このことから、理論上は、正確な勘定のためには PVM バイトコードの実装を理
解することが必要です。実際上は、組み込みデータ型(整数、リスト、辞書、等
)の、変数を共有する "アトミックそうな" 演算は、実際にアトミックです。

例えば、以下の演算は全てアトミックです (L、L1、L2 はリスト、 D、D1、D2 は
辞書、x、y はオブジェクト、i、j は整数です):

     L.append(x)
     L1.extend(L2)
     x = L[i]
     x = L.pop()
     L1[i:j] = L2
     L.sort()
     x = y
     x.field = y
     D[x] = y
     D1.update(D2)
     D.keys()

これらは、アトミックではありません:

     i = i+1
     L.append(L[-1])
     L[i] = L[j]
     D[x] = D[x] + 1

他のオブジェクトを置き換えるような演算は、そのオブジェクトの参照カウント
がゼロになったときに *note __del__(): 11ff. メソッドを呼び出すことがあり
、これが影響を及ぼすかもしれません。これは特に、辞書やリストの大規模な更
新に当てはまります。疑わしければ、mutex を使ってください！


File: python.info,  Node: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？,  Prev: グローバルな値のどんな種類の変更がスレッドセーフになるのですか？,  Up: スレッド

10.4.3.5 グローバルインタプリタロック (Global Interpreter Lock) を取り除くことはできないのですか？
..................................................................................................

マルチスレッド Python プログラムは事実上一つの CPU しか使えず、 (ほとん
ど) 全ての Python コードが *note グローバルインタプリタロック: 474.
(GIL) が保持されている間しか作動しなくなるということで、GIL は、 Python
をハイエンドなマルチプロセッササーバマシン上に配備する上で邪魔であると見
なされがちです。

PEP 703(1) の承認により、Python の CPython 実装から GIL を削除する作業が
現在進められています。はじめに、インタープリタをビルドする際にオプション
のコンパイラフラグとして実装され、そのため GIL あり・なしの別々のビルド
が利用可能になります。長期的には、GIL を削除することのパフォーマンスへの
影響が十分に理解された時点で、1つのビルドに落ち着くことが望まれています
。Python 3.13 がこの作業を含む最初のリリースになる可能性がありますが、こ
のリリースで完全に機能するとは限りません。

The current work to remove the GIL is based on a fork of Python 3.9 with
the GIL removed(2) by Sam Gross.  Prior to that, in the days of Python
1.5, Greg Stein actually implemented a comprehensive patch set (the
"free threading" patches) that removed the GIL and replaced it with
fine-grained locking.  Adam Olsen did a similar experiment in his
python-safethread(3) project.  Unfortunately, both of these earlier
experiments exhibited a sharp drop in single-thread performance (at
least 30% slower), due to the amount of fine-grained locking necessary
to compensate for the removal of the GIL. The Python 3.9 fork is the
first attempt at removing the GIL with an acceptable performance impact.

The presence of the GIL in current Python releases doesn't mean that you
can't make good use of Python on multi-CPU machines!  You just have to
be creative with dividing the work up between multiple 'processes'
rather than multiple 'threads'.  The *note ProcessPoolExecutor: 1d6.
class in the new *note concurrent.futures: 24. module provides an easy
way of doing so; the *note multiprocessing: 98. module provides a
lower-level API in case you want more control over dispatching of tasks.

C 拡張をうまく使うことも役立ちます。C 拡張を時間のかかるタスクの実行に使
えば、その拡張は実行が C コードで行われている間 GIL を解放でき、その間に
他のスレッドで作業が進められます。 *note zlib: 139. や *note hashlib:
6c. など、すでにこれを行なっている標準ライブラリモジュールもあります。

An alternative approach to reducing the impact of the GIL is to make the
GIL a per-interpreter-state lock rather than truly global.  This was
*note first implemented in Python 3.12: 670. and is available in the C
API. A Python interface to it is expected in Python 3.13.  The main
limitation to it at the moment is likely to be 3rd party extension
modules, since these must be written with multiple interpreters in mind
in order to be usable, so many older extension modules will not be
usable.

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0703/

   (2) https://github.com/colesbury/nogil

   (3) https://code.google.com/archive/p/python-safethread


File: python.info,  Node: 入力と出力<2>,  Next: ネットワーク/インターネットプログラミング,  Prev: スレッド,  Up: ライブラリと拡張 FAQ

10.4.4 入力と出力
-----------------

* Menu:

* ファイルを削除するにはどうしますか？ (その他、ファイルに関する質問...): ファイルを削除するにはどうしますか？ その他、ファイルに関する質問.
* ファイルをコピーするにはどうしますか？::
* バイナリデータを読み書きするにはどうしますか？::
* os.popen() によって作られたパイプで os.read() が使われていないようです。なぜですか？: os popen によって作られたパイプで os read が使われていないようです。なぜですか？.
* シリアル (RS232) ポートにアクセスするにはどうしますか？: シリアル RS232 ポートにアクセスするにはどうしますか？.
* sys.stdout (stdin, stderr) を閉じようとしても実際に閉じられないのはなぜですか？: sys stdout stdin stderr を閉じようとしても実際に閉じられないのはなぜですか？.


File: python.info,  Node: ファイルを削除するにはどうしますか？ その他、ファイルに関する質問,  Next: ファイルをコピーするにはどうしますか？,  Up: 入力と出力<2>

10.4.4.1 ファイルを削除するにはどうしますか？ (その他、ファイルに関する質問...)
...............................................................................

‘os.remove(filename)’ または ‘os.unlink(filename)’ を使ってください。ド
キュメントは、 *note os: a5. モジュールを参照してください。この二つの関
数は同じものです。 *note unlink(): 130d. は単に、この関数の Unix システ
ムコールの名称です。

ディレクトリを削除するには、*note os.rmdir(): 130b. を使ってください。作
成には *note os.mkdir(): 52b. を使ってください。‘os.makedirs(path)’ は
‘path’ の中間のディレクトリの、存在しないものを作成します。
‘os.removedirs(path)’ は中間のディレクトリが空である限り、それらを削除し
ます。ディレクトリツリー全体とその中身全てを削除したいなら、*note
shutil.rmtree(): 356. を使ってください。

ファイルの名前を変更するには、‘os.rename(old_path, new_path)’ を使ってく
ださい。

ファイルを切り詰めるには、 ‘f = open(filename, "rb+")’ を使ってファイル
を開き、 ‘f.truncate(offset)’ を使ってください; offset はデフォルトでは
現在のシーク位置です。 *note os.open(): f92. で開かれたファイル用の
‘os.ftruncate(fd, offset)’ もあります。 'fd' はファイルディスクリプタ (小
さい整数値) です。

*note shutil: ca. モジュールにも、*note copyfile(): c4e.、 *note
copytree(): c1e.、*note rmtree(): 356. 等、ファイルに作用する関数がいく
つか含まれます。


File: python.info,  Node: ファイルをコピーするにはどうしますか？,  Next: バイナリデータを読み書きするにはどうしますか？,  Prev: ファイルを削除するにはどうしますか？ その他、ファイルに関する質問,  Up: 入力と出力<2>

10.4.4.2 ファイルをコピーするにはどうしますか？
...............................................

*note shutil: ca. モジュールに *note copyfile(): c4e. 関数があります。注
意点として、これは Windows NTFS ボリューム上の alternate data streams(1)
も macOS HFS+ 上の resource forks(2) もコピーしません。ただし現在ではど
ちらも使われることは ほとんどありません。またファイルのパーミッションや
メタデータもコピーされませんが、この代わりに *note shutil.copy2(): c50.
を使うとそのほとんど (すべてではありませんが) が保持されます。

   ---------- Footnotes ----------

   (1) https://en.wikipedia.org/wiki/NTFS#Alternate_data_stream_(ADS)

   (2) https://en.wikipedia.org/wiki/Resource_fork


File: python.info,  Node: バイナリデータを読み書きするにはどうしますか？,  Next: os popen によって作られたパイプで os read が使われていないようです。なぜですか？,  Prev: ファイルをコピーするにはどうしますか？,  Up: 入力と出力<2>

10.4.4.3 バイナリデータを読み書きするにはどうしますか？
.......................................................

複雑なバイナリデータ形式の読み書きには、*note struct: db. モジュールを使
うのが一番です。これでバイナリデータ (通常は数) を含む文字列を取って、
Python オブジェクトに変換することができますし、その逆もできます。

例えば、以下のコードはファイルから 2 バイトの整数 2 個と 4 バイトの整数
1 個をビッグエンディアンフォーマットで読み込みます:

     import struct

     with open(filename, "rb") as f:
         s = f.read(8)
         x, y, z = struct.unpack(">hhl", s)

フォーマット中の '>' はデータを強制的にビッグエンディアンにします。ファ
イルから、文字 'h' は一つの"整数"(2 バイト)を読み込み、文字 'l' は一つの
"long 整数"を読み込みます。

より規則的なデータ (例えば、整数や浮動小数点数の中身の型が揃ったリスト)
に対しては、 *note array: 8. モジュールを使うこともできます。

     注釈: バイナリデータを読み書きするには、 (ここにあるように ‘"rb"’ を
     *note open(): 316. に渡して) ファイルをバイナリモードで開く義務があ
     ります。代わりに (デフォルトの) ‘"r"’ を使った場合は、ファイルはテ
     キストモードで開かれ、 ‘f.read()’ は *note bytes: 192. オブジェクト
     ではなく *note str: 169. オブジェクトを返します。


File: python.info,  Node: os popen によって作られたパイプで os read が使われていないようです。なぜですか？,  Next: シリアル RS232 ポートにアクセスするにはどうしますか？,  Prev: バイナリデータを読み書きするにはどうしますか？,  Up: 入力と出力<2>

10.4.4.4 os.popen() によって作られたパイプで os.read() が使われていないようです。なぜですか？
.............................................................................................

*note os.read(): f95. は、開かれたファイルを表す小さな整数、ファイルディ
スクリプタを引数に取る、低レベルの関数です。 *note os.popen(): 31a. は、
組み込みの *note open(): 316. 関数の返り値と同じ型の、高レベルなファイル
オブジェクトを作成します。従って、 *note os.popen(): 31a. によって作成さ
れたパイプ 'p' から 'n' バイト分だけ読み取るには、 ‘p.read(n)’ を使う必
要があります。


File: python.info,  Node: シリアル RS232 ポートにアクセスするにはどうしますか？,  Next: sys stdout stdin stderr を閉じようとしても実際に閉じられないのはなぜですか？,  Prev: os popen によって作られたパイプで os read が使われていないようです。なぜですか？,  Up: 入力と出力<2>

10.4.4.5 シリアル (RS232) ポートにアクセスするにはどうしますか？
................................................................

Win32、OSX、Linux、BSD、Jython、IronPython では:

     pyserial(1)

Unix では、Mitch Chapman による Usenet の投稿を参照してください:

     ‘https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com’

   ---------- Footnotes ----------

   (1) https://pypi.org/project/pyserial/


File: python.info,  Node: sys stdout stdin stderr を閉じようとしても実際に閉じられないのはなぜですか？,  Prev: シリアル RS232 ポートにアクセスするにはどうしますか？,  Up: 入力と出力<2>

10.4.4.6 sys.stdout (stdin, stderr) を閉じようとしても実際に閉じられないのはなぜですか？
........................................................................................

Python の *note file object: 13db. は、低水準の C ファイルディスクリプタ
上の、抽象の高水準レイヤです。

組み込みの *note open(): 316. 関数によって生成されたほとんどのファイルオ
ブジェクトでは、 ‘f.close()’ は Python ファイルオブジェクトが Python の
視点からは閉じられているものとする印をつけ、その下にある C ファイルディ
スクリプタを閉じるように手配します。これは、 ‘f’ がガベージとなったとき
にも、 ‘f’ のデストラクタで自動的に起こります。

しかし、stdin、stdout、stderr は C で特別な立場が与えられていることから
、Python でも同様に特別に扱われます。‘sys.stdout.close()’ を実行すると、
Python レベルのファイルオブジェクトには閉じられているものとする印がつけ
られますが、C ファイルディスクリプタは '閉じられません'。

下にある C ファイルディスクリプタのうち、この三つのどれかを閉じるには、
まず本当に閉じる必要があることを確かめるべきです (例えば、拡張モジュール
の I/O を混乱させてしまうかもしれません)。本当に必要ならば、 *note
os.close(): d6b. を使ってください:

     os.close(stdin.fileno())
     os.close(stdout.fileno())
     os.close(stderr.fileno())

または、数の定数としてそれぞれ 0, 1, 2 も使えます。


File: python.info,  Node: ネットワーク/インターネットプログラミング,  Next: データベース,  Prev: 入力と出力<2>,  Up: ライブラリと拡張 FAQ

10.4.5 ネットワーク/インターネットプログラミング
------------------------------------------------

* Menu:

* Python の WWW ツールには何がありますか？::
* どのモジュールが HTML の生成の役に立ちますか？::
* Python のスクリプトからメールを送るにはどうしますか？::
* ソケットの connect() メソッドでブロッキングされなくするにはどうしますか？: ソケットの connect メソッドでブロッキングされなくするにはどうしますか？.


File: python.info,  Node: Python の WWW ツールには何がありますか？,  Next: どのモジュールが HTML の生成の役に立ちますか？,  Up: ネットワーク/インターネットプログラミング

10.4.5.1 Python の WWW ツールには何がありますか？
.................................................

ライブラリリファレンスマニュアルの *note
インターネットプロトコルとサポート: 3ebd. と *note
インターネット上のデータの操作: 3ab1. という章を参照してください。Python
には、サーバサイドとクライアントサイドの web システムを構築するのに便利
な多くのモジュールがあります。

利用可能なフレームワークの概要は Paul Boddie によって、
‘https://wiki.python.org/moin/WebProgramming’ でメンテナンスされています
。


File: python.info,  Node: どのモジュールが HTML の生成の役に立ちますか？,  Next: Python のスクリプトからメールを送るにはどうしますか？,  Prev: Python の WWW ツールには何がありますか？,  Up: ネットワーク/インターネットプログラミング

10.4.5.2 どのモジュールが HTML の生成の役に立ちますか？
.......................................................

Web Programming についての wiki のページ(1) から役に立つリンクが見付けら
れます。

   ---------- Footnotes ----------

   (1) https://wiki.python.org/moin/WebProgramming


File: python.info,  Node: Python のスクリプトからメールを送るにはどうしますか？,  Next: ソケットの connect メソッドでブロッキングされなくするにはどうしますか？,  Prev: どのモジュールが HTML の生成の役に立ちますか？,  Up: ネットワーク/インターネットプログラミング

10.4.5.3 Python のスクリプトからメールを送るにはどうしますか？
..............................................................

標準ライブラリモジュール *note smtplib: cf. を使ってください。

以下に示すのが、これを使ったごく単純な対話型のメール送信器です。このメソ
ッドは SMTP リスナをサポートするホストならどこででも作動します。

     import sys, smtplib

     fromaddr = input("From: ")
     toaddrs  = input("To: ").split(',')
     print("Enter message, end with ^D:")
     msg = ''
     while True:
         line = sys.stdin.readline()
         if not line:
             break
         msg += line

     # The actual mail send
     server = smtplib.SMTP('localhost')
     server.sendmail(fromaddr, toaddrs, msg)
     server.quit()

Unix 限定の代わりの選択肢は sendmail を使うことです。sendmail プログラム
の場所はシステムによって様々です; あるときは ‘/usr/lib/sendmail’ だった
り、あるときは ‘/usr/sbin/sendmail’ だったり。sendmail のマニュアルペー
ジが助けになるでしょう。サンプルコードはこのようになります:

     import os

     SENDMAIL = "/usr/sbin/sendmail"  # sendmail location
     p = os.popen("%s -t -i" % SENDMAIL, "w")
     p.write("To: receiver@example.com\n")
     p.write("Subject: test\n")
     p.write("\n")  # blank line separating headers from body
     p.write("Some text\n")
     p.write("some more text\n")
     sts = p.close()
     if sts != 0:
         print("Sendmail exit status", sts)


File: python.info,  Node: ソケットの connect メソッドでブロッキングされなくするにはどうしますか？,  Prev: Python のスクリプトからメールを送るにはどうしますか？,  Up: ネットワーク/インターネットプログラミング

10.4.5.4 ソケットの connect() メソッドでブロッキングされなくするにはどうしますか？
..................................................................................

主に *note select: c6. モジュールがソケットの非同期の I/O を扱うのに使わ
れます。

TCP 接続がブロッキングされないようにするために、ソケットをノンブロッキン
グモードに設定することが出来ます。そして *note connect(): fa3. したとき
に、即座に接続できるか、エラー番号を ‘.errno’ として含む例外を受け取るか
のどちらかになります。‘errno.EINPROGRESS’ は、接続が進行中であるが、まだ
完了していないということを示します。異なる OS では異なる値が返されるので
、あなたのシステムで何が返されるかを確かめておく必要があります。

*note connect_ex(): 1753. メソッドを使えば例外を生成しなくて済みます。こ
れは単に errno の値を返すでしょう。ポーリングのためには、後でまた *note
connect_ex(): 1753. を呼び出すことができます - ‘0’ または
‘errno.EISCONN’ は接続されたことを表します - または、このソケットを
*note select.select(): fa0. に渡して書き込み可能か調べることができます。

     注釈: *note asyncio: b. モジュールは、ノンブロッキングのネットワー
     クコードを書く作業のためにフレームワークのような方法を提供します。
     その他の選択肢として、Twisted(1) は多機能で著名なサードパーティのラ
     イブラリです。

   ---------- Footnotes ----------

   (1) https://twisted.org/


File: python.info,  Node: データベース,  Next: 数学と数,  Prev: ネットワーク/インターネットプログラミング,  Up: ライブラリと拡張 FAQ

10.4.6 データベース
-------------------

* Menu:

* Python にはデータベースパッケージへのインターフェースはありますか？::
* Python で永続的なオブジェクトを実装するにはどうしますか？::


File: python.info,  Node: Python にはデータベースパッケージへのインターフェースはありますか？,  Next: Python で永続的なオブジェクトを実装するにはどうしますか？,  Up: データベース

10.4.6.1 Python にはデータベースパッケージへのインターフェースはありますか？
............................................................................

はい。

標準の Python には、 *note DBM: 38. や *note GDBM: 37. などの、ディスク
ベースのハッシュへのインターフェースも含まれています。また、 *note
sqlite3: d4. モジュールは、軽量なディスクベースの関係データベースを提供
します。

ほとんどの関係データベースがサポートされています。詳細は
DatabaseProgramming wiki page(1) を参照してください。

   ---------- Footnotes ----------

   (1) https://wiki.python.org/moin/DatabaseProgramming


File: python.info,  Node: Python で永続的なオブジェクトを実装するにはどうしますか？,  Prev: Python にはデータベースパッケージへのインターフェースはありますか？,  Up: データベース

10.4.6.2 Python で永続的なオブジェクトを実装するにはどうしますか？
..................................................................

*note pickle: ab. ライブラリモジュールで、ごく一般的な方法でこれを解決で
きます (開かれたファイル、ソケット、ウィンドウのようなものを保管すること
はできませんが)。 *note shelve: c8. ライブラリモジュールは pickle と
(g)dbm を使い、任意の Python オブジェクトを含む永続的なマッピングを生成
します。


File: python.info,  Node: 数学と数,  Prev: データベース,  Up: ライブラリと拡張 FAQ

10.4.7 数学と数
---------------

* Menu:

* Python で乱数を生成するにはどうしますか？::


File: python.info,  Node: Python で乱数を生成するにはどうしますか？,  Up: 数学と数

10.4.7.1 Python で乱数を生成するにはどうしますか？
..................................................

標準モジュールの *note random: bd. が乱数生成器を実装しています。使い方
は単純です:

     import random
     random.random()

これは、 [0, 1) の範囲のランダムな浮動小数点数を返します。

このモジュールにはその他多くの特化した生成器もあります。例えば:

   * ‘randrange(a, b)’ は区間 [a, b) から整数を選びます。

   * >>''<<uniform(a, b)''は [a, b) の範囲の浮動小数点数を選びます。

   * ‘normalvariate(mean, sdev)’ は正規 (ガウス) 分布をサンプリングしま
     す。

シーケンスに直接作用する高水準な関数もあります。例えば:

   * ‘choice(S)’ は与えられたシーケンスからランダムな要素を選びます。

   * ‘shuffle(L)’ はリストをインプレースにシャッフルします。すなわち、ラ
     ンダムに並び替えます。

‘Random’ クラスのインスタンスを生成して、複数の独立な乱数生成器をつくる
こともできます。


File: python.info,  Node: 拡張と埋め込み FAQ,  Next: Windows 上の Python FAQ,  Prev: ライブラリと拡張 FAQ,  Up: Python よくある質問

10.5 拡張と埋め込み FAQ
=======================

* Menu:

* C で独自の関数を作ることはできますか？::
* C++ で独自の関数を作ることはできますか？::
* C を書くのは大変です。他の方法はありませんか？::
* C から任意の Python 文を実行するにはどうしますか？::
* C から任意の Python 式を評価するにはどうしますか？::
* Python オブジェクトから C の値を取り出すにはどうしますか？::
* Py_BuildValue() で任意長のタプルを作るにはどうしますか？: Py_BuildValue で任意長のタプルを作るにはどうしますか？.
* C からオブジェクトのメソッドを呼び出すにはどうしますか？::
* PyErr_Print() (その他 stdout/stderr に印字するもの) からの出力を受け取るにはどうしますか？: PyErr_Print その他 stdout/stderr に印字するもの からの出力を受け取るにはどうしますか？.
* C から Python で書かれたモジュールにアクセスするにはどうしますか？::
* Python から C++ へインターフェースするにはどうしますか？::
* セットアップファイルでモジュールを追加しようとしたらメイクに失敗しました。なぜですか？::
* 拡張をデバッグするにはどうしますか？::
* Linux システムで Python モジュールをコンパイルしたいのですが、見つからないファイルがあります。なぜですか？::
* "不完全 (incomplete) な入力" を "不適切 (invalid) な入力" から区別するにはどうしますか？: "不完全 incomplete な入力" を "不適切 invalid な入力" から区別するにはどうしますか？.
* 未定義の g++ シンボル __builtin_new や __pure_virtual を見つけるにはどうしますか？::
* メソッドのいくつかは C で、その他は Python で実装されたオブジェクトクラスを (継承などで) 作ることはできますか？: メソッドのいくつかは C で、その他は Python で実装されたオブジェクトクラスを 継承などで 作ることはできますか？.


File: python.info,  Node: C で独自の関数を作ることはできますか？,  Next: C++ で独自の関数を作ることはできますか？,  Up: 拡張と埋め込み FAQ

10.5.1 C で独自の関数を作ることはできますか？
---------------------------------------------

はい。関数、変数、例外、そして新しいタイプまで含んだビルトインモジュール
を C で作れます。これはドキュメント *note Python
インタプリタの拡張と埋め込み: 1fbd. で説明されています。

ほとんどの中級から上級の Python 本もこの話題を扱っています。


File: python.info,  Node: C++ で独自の関数を作ることはできますか？,  Next: C を書くのは大変です。他の方法はありませんか？,  Prev: C で独自の関数を作ることはできますか？,  Up: 拡張と埋め込み FAQ

10.5.2 C++ で独自の関数を作ることはできますか？
-----------------------------------------------

はい。C++ 内にある C 互換機能を使ってできます。 ‘extern "C" { ... }’ で
Python のインクルードファイルを囲み、 ‘extern "C"’ を Python インタプリ
タから呼ぶ各関数の前に置いてください。グローバルや静的な C++ オブジェク
トの構造体を持つものは良くないでしょう。


File: python.info,  Node: C を書くのは大変です。他の方法はありませんか？,  Next: C から任意の Python 文を実行するにはどうしますか？,  Prev: C++ で独自の関数を作ることはできますか？,  Up: 拡張と埋め込み FAQ

10.5.3 C を書くのは大変です。他の方法はありませんか？
-----------------------------------------------------

There are a number of alternatives to writing your own C extensions,
depending on what you're trying to do.  *note Recommended third party
tools: 4e8e. offer both simpler and more sophisticated approaches to
creating C and C++ extensions for Python.


File: python.info,  Node: C から任意の Python 文を実行するにはどうしますか？,  Next: C から任意の Python 式を評価するにはどうしますか？,  Prev: C を書くのは大変です。他の方法はありませんか？,  Up: 拡張と埋め込み FAQ

10.5.4 C から任意の Python 文を実行するにはどうしますか？
---------------------------------------------------------

これを行う最高水準の関数は *note PyRun_SimpleString(): 4f0b. で、一つの
文字列引数を取り、モジュール ‘__main__’ のコンテキストでそれを実行し、成
功なら ‘0’、例外 (*note SyntaxError: 18e. を含む) が発生したら ‘-1’ を返
します。更に制御したければ、 *note PyRun_String(): 1dc0. を使ってくださ
い。ソースは ‘Python/pythonrun.c’ の '*note PyRun_SimpleString(): 4f0b.
を参照してください。


File: python.info,  Node: C から任意の Python 式を評価するにはどうしますか？,  Next: Python オブジェクトから C の値を取り出すにはどうしますか？,  Prev: C から任意の Python 文を実行するにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.5 C から任意の Python 式を評価するにはどうしますか？
---------------------------------------------------------

先の質問の *note PyRun_String(): 1dc0. を、スタートシンボル *note
Py_eval_input: 51c1. を渡して呼び出してください。これは式を解析し、評価
してその値を返します。


File: python.info,  Node: Python オブジェクトから C の値を取り出すにはどうしますか？,  Next: Py_BuildValue で任意長のタプルを作るにはどうしますか？,  Prev: C から任意の Python 式を評価するにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.6 Python オブジェクトから C の値を取り出すにはどうしますか？
-----------------------------------------------------------------

オブジェクトの型に依ります。タプルなら、 *note PyTuple_Size(): 50d8. が
長さを返し、 *note PyTuple_GetItem(): 4eb7. が指定されたインデックスの要
素を返します。リストにも同様の関数 *note PyList_Size(): 1633. と *note
PyList_GetItem(): 5ff. があります。

bytes では、 *note PyBytes_Size(): 4f87. がその長さを返し、 *note
PyBytes_AsStringAndSize(): 4f7f. がその値へのポインタと長さを提供します
。 Python の bytes オブジェクトは null を含むこともできるので、 C の
‘strlen()’ を使うべきではないことに注意してください。

オブジェクトの型を検査するには、まず最初にそれが ‘NULL’ でないことを確か
めた上で、 *note PyBytes_Check(): 15b7. 、 *note PyTuple_Check(): 5390.
、 *note PyList_Check(): 53a1. などを使います。

いわゆる 'abstract' インターフェースから提供される、 Python オブジェクト
に対する高レベル API もあります - より詳しいことは ‘Include/abstract.h’
を読んでください。これを使うと、数値型プロトコル (*note
PyNumber_Index(): a93. など) や PyMapping API のマップ型プロトコルなどの
役に立つプロトコルに加え、 *note PySequence_Length(): 50a8. や *note
PySequence_GetItem(): 1e34. などの任意の種類の Python シーケンスへのイン
ターフェースにアクセスできます。


File: python.info,  Node: Py_BuildValue で任意長のタプルを作るにはどうしますか？,  Next: C からオブジェクトのメソッドを呼び出すにはどうしますか？,  Prev: Python オブジェクトから C の値を取り出すにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.7 Py_BuildValue() で任意長のタプルを作るにはどうしますか？
---------------------------------------------------------------

できません。代わりに *note PyTuple_Pack(): 50d7. を使ってください。


File: python.info,  Node: C からオブジェクトのメソッドを呼び出すにはどうしますか？,  Next: PyErr_Print その他 stdout/stderr に印字するもの からの出力を受け取るにはどうしますか？,  Prev: Py_BuildValue で任意長のタプルを作るにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.8 C からオブジェクトのメソッドを呼び出すにはどうしますか？
---------------------------------------------------------------

*note PyObject_CallMethod(): 640. 関数でオブジェクトの任意のメソッドを呼
び出せます。パラメタは、オブジェクト、呼び出すメソッドの名前、 *note
Py_BuildValue(): 3c2. で使われるようなフォーマット文字列、そして引数です
:

     PyObject *
     PyObject_CallMethod(PyObject *object, const char *method_name,
                         const char *arg_format, ...);

これはメソッドを持ついかなるオブジェクトにも有効で、組み込みかユーザ定義
かは関係ありません。返り値に対して *note Py_DECREF(): 790. する必要があ
ることもあります。

例えば、あるファイルオブジェクトの "seek" メソッドを 10, 0 を引数として
呼ぶとき (ファイルオブジェクトのポインタを "f" とします):

     res = PyObject_CallMethod(f, "seek", "(ii)", 10, 0);
     if (res == NULL) {
             ... an exception occurred ...
     }
     else {
             Py_DECREF(res);
     }

なお、 *note PyObject_CallObject(): 4eac. の引数リストには '常に' タプル
が必要です。関数を引数なしで呼び出すには、フォーマットに "()" を渡し、関
数を一つの引数で呼び出すには、関数を括弧でくくって例えば "(i)" としてく
ださい。


File: python.info,  Node: PyErr_Print その他 stdout/stderr に印字するもの からの出力を受け取るにはどうしますか？,  Next: C から Python で書かれたモジュールにアクセスするにはどうしますか？,  Prev: C からオブジェクトのメソッドを呼び出すにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.9 PyErr_Print() (その他 stdout/stderr に印字するもの) からの出力を受け取るにはどうしますか？
-------------------------------------------------------------------------------------------------

Python コード内で、 ‘write()’ メソッドをサポートするオブジェクトを定義し
てください。そのオブジェクトを *note sys.stdout: ccd. と *note
sys.stderr: b33. に代入してください。print_error を呼び出すか、単に標準
のトレースバック機構を作動させてください。そうすれば、出力は ‘write()’ が
送る任意の所に行きます。

最も簡単な方法は、 *note io.StringIO: 112a. クラスを使うことです:

     >>> import io, sys
     >>> sys.stdout = io.StringIO()
     >>> print('foo')
     >>> print('hello world!')
     >>> sys.stderr.write(sys.stdout.getvalue())
     foo
     hello world!

これと同じことをするカスタムオブジェクトは次のようになるでしょう:

     >>> import io, sys
     >>> class StdoutCatcher(io.TextIOBase):
     ...     def __init__(self):
     ...         self.data = []
     ...     def write(self, stuff):
     ...         self.data.append(stuff)
     ...
     >>> import sys
     >>> sys.stdout = StdoutCatcher()
     >>> print('foo')
     >>> print('hello world!')
     >>> sys.stderr.write(''.join(sys.stdout.data))
     foo
     hello world!


File: python.info,  Node: C から Python で書かれたモジュールにアクセスするにはどうしますか？,  Next: Python から C++ へインターフェースするにはどうしますか？,  Prev: PyErr_Print その他 stdout/stderr に印字するもの からの出力を受け取るにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.10 C から Python で書かれたモジュールにアクセスするにはどうしますか？
--------------------------------------------------------------------------

以下のようにモジュールオブジェクトへのポインタを得られます:

     module = PyImport_ImportModule("<modulename>");

そのモジュールがまだインポートされていない (つまり、まだ *note
sys.modules: 17e6. に現れていない) なら、これはモジュールを初期化します
。そうでなければ、単純に ‘sys.modules["<modulename>"]’ の値を返します。
なお、これはモジュールをいかなる名前空間にも代入しません。これはモジュー
ルが初期化されて '*note sys.modules: 17e6. に保管されていることを保証す
るだけです。

これで、モジュールの属性 (つまり、モジュールで定義された任意の名前) に以
下のようにアクセスできるようになります:

     attr = PyObject_GetAttrString(module, "<attrname>");

*note PyObject_SetAttrString(): 198e. を呼んでモジュールの変数に代入する
こともできます。


File: python.info,  Node: Python から C++ へインターフェースするにはどうしますか？,  Next: セットアップファイルでモジュールを追加しようとしたらメイクに失敗しました。なぜですか？,  Prev: C から Python で書かれたモジュールにアクセスするにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.11 Python から C++ へインターフェースするにはどうしますか？
----------------------------------------------------------------

やりたいことに応じて、いろいろな方法があります。手動でやるなら、 *note
"拡張と埋め込み" ドキュメント: 1fbd. を読むことから始めてください。なお
、Python ランタイムシステムにとっては、 C と C++ はあまり変わりません。
だから、C 構造体 (ポインタ)型に基づいて新しい Python の型を構築する方針
は C++ オブジェクトに対しても有効です。

C++ ライブラリに関しては、 *note C
を書くのは大変です。他の方法はありませんか？: 5947. を参照してください。


File: python.info,  Node: セットアップファイルでモジュールを追加しようとしたらメイクに失敗しました。なぜですか？,  Next: 拡張をデバッグするにはどうしますか？,  Prev: Python から C++ へインターフェースするにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.12 セットアップファイルでモジュールを追加しようとしたらメイクに失敗しました。なぜですか？
----------------------------------------------------------------------------------------------

セットアップは改行で終わらなければならなくて、改行がないと、ビルド工程は
失敗します。(これを直すには、ある種の醜いシェルスクリプトハックが必要で
すが、このバグは小さいものですから努力に見合う価値はないでしょう。)


File: python.info,  Node: 拡張をデバッグするにはどうしますか？,  Next: Linux システムで Python モジュールをコンパイルしたいのですが、見つからないファイルがあります。なぜですか？,  Prev: セットアップファイルでモジュールを追加しようとしたらメイクに失敗しました。なぜですか？,  Up: 拡張と埋め込み FAQ

10.5.13 拡張をデバッグするにはどうしますか？
--------------------------------------------

動的にロードされた拡張に GDB を使うとき、拡張がロードされるまでブレーク
ポイントを設定してはいけません。

‘.gdbinit’ ファイルに(または対話的に)、このコマンドを加えてください:

     br _PyImport_LoadDynamicModule

そして、GDB を起動するときに:

     $ gdb /local/bin/python
     gdb) run myscript.py
     gdb) continue # repeat until your extension is loaded
     gdb) finish   # so that your extension is loaded
     gdb) br myfunction.c:50
     gdb) continue


File: python.info,  Node: Linux システムで Python モジュールをコンパイルしたいのですが、見つからないファイルがあります。なぜですか？,  Next: "不完全 incomplete な入力" を "不適切 invalid な入力" から区別するにはどうしますか？,  Prev: 拡張をデバッグするにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.14 Linux システムで Python モジュールをコンパイルしたいのですが、見つからないファイルがあります。なぜですか？
------------------------------------------------------------------------------------------------------------------

Most packaged versions of Python omit some files required for compiling
Python extensions.

For Red Hat, install the python3-devel RPM to get the necessary files.

For Debian, run ‘apt-get install python3-dev’.


File: python.info,  Node: "不完全 incomplete な入力" を "不適切 invalid な入力" から区別するにはどうしますか？,  Next: 未定義の g++ シンボル __builtin_new や __pure_virtual を見つけるにはどうしますか？,  Prev: Linux システムで Python モジュールをコンパイルしたいのですが、見つからないファイルがあります。なぜですか？,  Up: 拡張と埋め込み FAQ

10.5.15 "不完全 (incomplete) な入力" を "不適切 (invalid) な入力" から区別するにはどうしますか？
------------------------------------------------------------------------------------------------

Python インタラクティブインタプリタでは、入力が不完全なとき (例えば、
"if" 文の始まりをタイプした時や、カッコや三重文字列引用符を閉じていない
時など) には継続プロンプトを与えられますが、入力が不適切であるときには即
座に構文エラーメッセージが与えられます。このようなふるまいを模倣したいこ
とがあります。

Python では構文解析器のふるまいに十分に近い *note codeop: 1d. モジュール
が使えます。例えば IDLE がこれを使っています。

これを C で行う最も簡単な方法は、 *note PyRun_InteractiveLoop(): 51c9. を
(おそらく別のスレッドで) 呼び出し、Python インタプリタにあなたの入力を扱
わせることです。独自の入力関数を指定するのに *note
PyOS_ReadlineFunctionPointer(): 7a5. を設定することもできます。詳しいヒ
ントは、 ‘Modules/readline.c’ や ‘Parser/myreadline.c’ を参照してくださ
い。


File: python.info,  Node: 未定義の g++ シンボル __builtin_new や __pure_virtual を見つけるにはどうしますか？,  Next: メソッドのいくつかは C で、その他は Python で実装されたオブジェクトクラスを 継承などで 作ることはできますか？,  Prev: "不完全 incomplete な入力" を "不適切 invalid な入力" から区別するにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.16 未定義の g++ シンボル __builtin_new や __pure_virtual を見つけるにはどうしますか？
------------------------------------------------------------------------------------------

g++ モジュールを動的にロードするには、Python を再コンパイルし、それを
g++ で再リンク (Python Modules Makefile 内の LINKCC を変更) し、拡張を
g++ でリンク (例えば ‘g++ -shared -o mymodule.so mymodule.o’) しなければ
なりません。


File: python.info,  Node: メソッドのいくつかは C で、その他は Python で実装されたオブジェクトクラスを 継承などで 作ることはできますか？,  Prev: 未定義の g++ シンボル __builtin_new や __pure_virtual を見つけるにはどうしますか？,  Up: 拡張と埋め込み FAQ

10.5.17 メソッドのいくつかは C で、その他は Python で実装されたオブジェクトクラスを (継承などで) 作ることはできますか？
-----------------------------------------------------------------------------------------------------------------------

はい、 *note int: 19b. 、 *note list: 24d. 、 *note dict: 183. などのビ
ルトインクラスから継承できます。

The Boost Python Library (BPL,
‘https://www.boost.org/libs/python/doc/index.html’) を使えば、これを C++
からできます。 (すなわち、BPL を使って C++ で書かれた拡張クラスを継承で
きます).


File: python.info,  Node: Windows 上の Python FAQ,  Next: グラフィックユーザインターフェース FAQ,  Prev: 拡張と埋め込み FAQ,  Up: Python よくある質問

10.6 Windows 上の Python FAQ
============================

* Menu:

* Python プログラムを Windows で動かすにはどうしますか？::
* Python スクリプトを実行可能にするにはどうしますか？::
* Python の起動に時間がかかることがあるのはなぜですか？::
* どうすれば Python スクリプトを EXE に出来ますか?::
* *.pyd ファイルは DLL と同じですか？: * pyd ファイルは DLL と同じですか？.
* Python を Windows アプリケーションに埋め込むにはどうしたらいいですか？::
* エディタが Python ソースにタブを勝手に挿入しないようにするにはどうしますか？::
* ブロックすることなく押鍵を検出するにはどうしますか？::
* missing api-ms-win-crt-runtime-l1-1-0.dll エラーを解決するにはどうしますか？: missing api-ms-win-crt-runtime-l1-1-0 dll エラーを解決するにはどうしますか？.


File: python.info,  Node: Python プログラムを Windows で動かすにはどうしますか？,  Next: Python スクリプトを実行可能にするにはどうしますか？,  Up: Windows 上の Python FAQ

10.6.1 Python プログラムを Windows で動かすにはどうしますか？
-------------------------------------------------------------

これは必ずしも単純な質問ではありません。Windows コマンドラインからプログ
ラムを実行するのに慣れてしまっている場合は、全て明らかなことに思えるでし
ょう; そうでない場合は、もう少し手引きが必要でしょう。

ある種の統合開発環境を使っているのでなければ、最終的には "コマンドプロン
プト" などと呼ばれているものに、 Windows コマンドをタイプすることになる
でしょう。 通常そういうウィンドウは検索バーで ‘cmd’ を検索して起動します
。 通常は次のような見た目の Windows の "コマンド プロンプト" が現れるの
で、ウィンドウが起動したのが分かるはずです:

     C:\>

この文字は異なっていたり、続きがあったりするので、コンピュータの設定や、
あなたが最近何をしたかに依って、このようになっていることもあるでしょう:

     D:\YourName\Projects\Python>

このようなウィンドウさえ開けば、Python プログラムを動かす手順は順調に進
みます。

Python スクリプトは Python 'インタプリタ' と呼ばれる別のプログラムで処理
されなければならないということを、理解する必要があります。インタプリタは
スクリプトを読み込み、バイトコードにコンパイルし、バイトコードを実行しプ
ログラムを走らせます。では、インタプリタが Python スクリプトを取り扱うた
めには、どんな用意をするのでしょうか?

まず最初に、コマンドウィンドウに "py" という単語がインタプリタを起動する
指示であると認識させる必要があります。 コマンドウィンドウを開いたら、
‘py’ というコマンドを入力し、リターンキーを叩いてください。:

     C:\Users\YourName> py

次のような出力が見えるでしょう:

     Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
     Type "help", "copyright", "credits" or "license" for more information.
     >>>

インタプリタの"対話モード"が始まりました。これで Python の文や式を対話的
に入力して、待っている間に実行や評価させることができます。これが Python
の最強の機能のひとつです。いくつかの式を選んで入力し、結果を見て確かめて
みましょう:

     >>> print("Hello")
     Hello
     >>> "Hello" * 3
     'HelloHelloHello'

多くの人が対話モードを便利で高度なプログラム可能計算機として使っています
。対話式 Python セッションを終わらせたいなら、 *note exit(): 25e7. 関数
を呼び出すか、 ‘Ctrl’ キーを押しながら ‘Z’ を入力し "‘Enter’" キーを押し
て、 Windows コマンドプロンプトに戻ってください。

スタート ‣ すべてのプログラム ‣ Python 3.x ‣ Python (command line) のよ
うな項目がスタートメニューに見付かるかもしれません。 これを起動すると、
新しいウィンドウに ‘>>>’ というプロンプトが見られるでしょう。その場合、
*note exit(): 25e7. 関数を呼び出すか ‘Ctrl’-‘Z’ を入力するとウィンドウは
閉じます; Windows は 1 つの "python" コマンドをウィンドウで実行していて
、インタプリタを終了させたときに、そのウィンドウを閉じます。

‘py’ コマンドが認識されていることが確認できたので、 Python スクリプトを
与えられるようになりました。 そのためには Python スクリプトの絶対パスあ
るいは相対パスを与える必要があります。 Python スクリプトがデスクトップに
あり、 ‘hellp.py’ という名前で、ちょうど良いことにコマンドプロンプトがホ
ームディレクトリを開いていると仮定しましょう。そうすると次のような表示が
見られます:

     C:\Users\YourName>

ここまで来れば ‘py’ の後ろにスクリプトのパスを入力することで、 Python に
スクリプトを渡すよう ‘py’ コマンドに命令できます:

     C:\Users\YourName> py Desktop\hello.py
     hello


File: python.info,  Node: Python スクリプトを実行可能にするにはどうしますか？,  Next: Python の起動に時間がかかることがあるのはなぜですか？,  Prev: Python プログラムを Windows で動かすにはどうしますか？,  Up: Windows 上の Python FAQ

10.6.2 Python スクリプトを実行可能にするにはどうしますか？
----------------------------------------------------------

Windows では、標準の Python インストーラはすでに .py 拡張子をあるファイ
ル型 (Python.File) に関連付け、そのファイル型にインタプリタを実行するオ
ープンコマンド (‘D:\Program Files\Python\python.exe "%1" %*’) を与えます
。コマンドプロンプトから 'foo.py' としてスクリプトを実行可能にするにはこ
れで十分です。スクリプトを拡張子なしで 'foo' とだけタイプして実行したい
のなら、PATHEXT 環境変数に .py を加えてください。


File: python.info,  Node: Python の起動に時間がかかることがあるのはなぜですか？,  Next: どうすれば Python スクリプトを EXE に出来ますか?,  Prev: Python スクリプトを実行可能にするにはどうしますか？,  Up: Windows 上の Python FAQ

10.6.3 Python の起動に時間がかかることがあるのはなぜですか？
------------------------------------------------------------

通常 Python は Windows でとても早く起動しますが、ときどき Python が急に
スタートアップに時間がかかるようになったというバグレポートがあります。更
に複雑なことに、Python は同様に設定された他の Windows システムではきちん
と動くのです。

この問題はそのマシンのウイルス対策ソフトウェアの設定ミスによって起こされ
ることがあります。ウイルススキャナの中には、ファイルシステムからの全ての
読み込みを監視するように設定した場合に、二桁のスタートアップオーバーヘッ
ドを引き起すことが知られているものがあります。あなたのシステムのウイルス
スキャンソフトウェアの設定を確かめて、本当に同様に設定されていることを確
実にしてください。


File: python.info,  Node: どうすれば Python スクリプトを EXE に出来ますか?,  Next: * pyd ファイルは DLL と同じですか？,  Prev: Python の起動に時間がかかることがあるのはなぜですか？,  Up: Windows 上の Python FAQ

10.6.4 どうすれば Python スクリプトを EXE に出来ますか?
-------------------------------------------------------

実行可能ファイルを作れるツールの一覧 *note どうしたら Python
スクリプトからスタンドアロンバイナリを作れますか？: 58b3. を参照してくだ
さい。


File: python.info,  Node: * pyd ファイルは DLL と同じですか？,  Next: Python を Windows アプリケーションに埋め込むにはどうしたらいいですか？,  Prev: どうすれば Python スクリプトを EXE に出来ますか?,  Up: Windows 上の Python FAQ

10.6.5 ‘*.pyd’ ファイルは DLL と同じですか？
--------------------------------------------

はい、.pyd ファイルは dll と同じようなものですが、少し違いがあります。
‘foo.pyd’ という名前の DLL があったとしたら、それには関数 ‘PyInit_foo()’
が含まれていなければなりません。そうすれば Python で "import foo" を書け
て、Python は foo.pyd (や foo.py、foo.pyc) を探して、あれば、
‘PyInit_foo()’ を呼び出して初期化しようとします。Windows が DLL の存在を
必要とするのと違い、.exe ファイルを foo.lib にリンクするわけではありませ
ん。

なお、foo.pyd を検索するパスは PYTHONPATH であり、Windows が foo.dll を
検索するパスと同じではありません。また、プログラムを dll にリンクしたと
きはプログラムの実行に dll が必要ですが、foo.pyd は実行には必要はありま
せん。もちろん、 ‘import foo’ したいなら foo.pyd は必要です。DLL では、
リンクはソースコード内で ‘__declspec(dllexport)’ によって宣言されます。
.pyd では、リンクは使える関数のリストで定義されます。


File: python.info,  Node: Python を Windows アプリケーションに埋め込むにはどうしたらいいですか？,  Next: エディタが Python ソースにタブを勝手に挿入しないようにするにはどうしますか？,  Prev: * pyd ファイルは DLL と同じですか？,  Up: Windows 上の Python FAQ

10.6.6 Python を Windows アプリケーションに埋め込むにはどうしたらいいですか？
-----------------------------------------------------------------------------

Python インタプリタを Windows app に埋め込む方法は、次のように要約できま
す:

  1. あなたの .exe 内に直接 Python を取り込んでビルド 'しないで' 下さい
     。Windows では、それ自身が DLL になっているようなモジュールのインポ
     ートを処理するために、Python は DLL でなければなりません。(ドキュメ
     ント化されていない重大な事実の一つ目です。)代わりに、
     ‘python`NN'.dll’ とリンクしてください; 普通はそれは
     ‘C:\Windows\System’ にインストールされています。 'NN' は Python バ
     ージョンで Python 3.3 であれば "33" のような数字です。

     Python には、load-time に、または run-time にリンクできます。
     load-time なリンクは、 ‘python`NN'.lib’ に対してリンクするもので、
     run-time なリンクは ‘python`NN'.dll’ に対してリンクするものです。
     (一般的な注意: ‘python`NN'.lib’ は ‘python`NN'.dll’ に対するいわゆ
     る "インポートライブラリ" です。これは単にリンカに対するシンボルを
     定義します。)

     run-time なリンクは、リンクの選択を大いに単純化します。全ては実行時
     に行われます。コードは Windows の ‘LoadLibraryEx()’ ルーチンで
     ‘python`NN'.dll’ をロードしなければなりません。コードはまた、
     Windows の ‘GetProcAddress()’ ルーチンで得られるポインタで、
     ‘python`NN'.dll’ (すなわち、Python の C API)のルーチンとデータへア
     クセスしていなければなりません。マクロによって、このポインタを
     Python の C API のルーチンを呼び出す任意の C コードに通して使えます
     。

  2. SWIG を使えば、app のデータとメソッドを Python で使えるようにする
     Python "拡張モジュール"を簡単に作れます。SWIG は雑用を殆どやってく
     れるでしょう。結果として、.exe ファイル 'の中に' リンクする C コー
     ドができます(！)。DLL を作 'らなくてもよく'、リンクも簡潔になります
     。

  3. SWIG は拡張の名前に依る名前の init 関数 (C 関数) を作ります。例えば
     、モジュールの名前が leo なら、init 関数の名前は initleo() になりま
     す。SWIG shadow クラスを使ったほうがよく、そうすると init 関数の名
     前は initleoc() になります。これは shadow クラスが使うほとんど隠れ
     た helper クラスを初期化します。

     ステップ 2 の C コードを .exe ファイルにリンクできるのは、初期化関
     数の呼び出しと Python へのモジュールのインポートが同等だからです！
     (ドキュメント化されていない重大な事実の二つ目です)

  4. 要するに、以下のコードを使って Python インタプリタを拡張モジュール
     込みで初期化することができます。

          #include <Python.h>
          ...
          Py_Initialize();  // Pythonの初期化
          initmyAppc();  // ヘルパーclassの初期化(import)
          PyRun_SimpleString("import myApp");  // shadowクラスのimport

  5. Python の C API には、pythonNN.dll をビルドするのに使われたコンパイ
     ラ MSVC 以外のコンパイラを使うと現れる二つの問題があります。

     問題 1: コンパイラによって ‘struct FILE’ に対する概念が異なるため、
     ‘FILE *’ 引数を取るいわゆる "超高水準" 関数は、多コンパイラ環境で働
     きません。実装の観点から、これらは超低水準関数になっています。

     問題 2: SWIG は void 関数へのラッパを生成するときに以下のコードを生
     成します:

          Py_INCREF(Py_None);
          _resultobj = Py_None;
          return _resultobj;

     ああ、Py_none は pythonNN.dll 内の _Py_NoneStruct という複雑なデー
     タ構造に展開するマクロです。また、このコードは他コンパイラ環境では
     失敗します。このコードを次のように置き換えてください:

          return Py_BuildValue("");

     これで、SWIG をまだ仕事に使えない (私は SWIG の完全な初心者です) 私
     でも、SWIG の ‘%typemap’ コマンドを使って自動的に変更できるようにな
     ります。

  6. Python シェルスクリプトを使って Windows app 内から Python インタプ
     リタウィンドウを掲示するのはいい方法ではありません。そのように表示
     されるウィンドウは app のウィンドウシステムとは関係ありません。むし
     ろ "ネイティブな" インタプリタウィンドウを (wxPythonWindow を使った
     りして) 作るべきです。そのウィンドウを Python インタプリタにつなぐ
     のは簡単です。Python の i/o は読み書きをサポートする _どんな_ オブ
     ジェクトにもリダイレクトできるので、read() と write() メソッドを含
     む (拡張モジュールで定義された) Python オブジェクトさえあればいいの
     です。


File: python.info,  Node: エディタが Python ソースにタブを勝手に挿入しないようにするにはどうしますか？,  Next: ブロックすることなく押鍵を検出するにはどうしますか？,  Prev: Python を Windows アプリケーションに埋め込むにはどうしたらいいですか？,  Up: Windows 上の Python FAQ

10.6.7 エディタが Python ソースにタブを勝手に挿入しないようにするにはどうしますか？
-----------------------------------------------------------------------------------

この FAQ ではタブを使うことを勧めません。Python スタイルガイド PEP 8(1)
では、配布される Python コードにはスペース 4 つを使うことを推奨していま
す。これは Emacs の python-mode のデフォルトでも同じです。

いかなるエディタでも、タブとスペースを混ぜるのは良くないです。 MSVC も全
く同じ立場であり、スペースを使うようにする設定が簡単にできます。 Tools ‣
Options ‣ Tabs を選択し、ファイルタイプの "デフォルト" の "タブ幅" と "イ
ンデント幅" に 4 を設定して、 "スペースを挿入する" のラジオボタンを選択
してください。

Python は、もしタブとスペースが混在していることで先頭の空白に問題がある
場合、*note IndentationError: 1750. または *note TabError: 765. を送出し
ます。 *note tabnanny: e3. モジュールを実行することで、ディレクトリーツ
リーをバッチモードでチェックすることができます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0008/


File: python.info,  Node: ブロックすることなく押鍵を検出するにはどうしますか？,  Next: missing api-ms-win-crt-runtime-l1-1-0 dll エラーを解決するにはどうしますか？,  Prev: エディタが Python ソースにタブを勝手に挿入しないようにするにはどうしますか？,  Up: Windows 上の Python FAQ

10.6.8 ブロックすることなく押鍵を検出するにはどうしますか？
-----------------------------------------------------------

*note msvcrt: 97. モジュールを使ってください。これは標準の Windows 専用
拡張モジュールです。これはキーボードが打たれているかを調べる関数
‘kbhit()’ と、反響することなく一文字を得る ‘getch()’ を定義します。


File: python.info,  Node: missing api-ms-win-crt-runtime-l1-1-0 dll エラーを解決するにはどうしますか？,  Prev: ブロックすることなく押鍵を検出するにはどうしますか？,  Up: Windows 上の Python FAQ

10.6.9 missing api-ms-win-crt-runtime-l1-1-0.dll エラーを解決するにはどうしますか？
-----------------------------------------------------------------------------------

この問題は更新がインストールされていない Windows 8.1 以前を使っていると
Python 3.5 以降で発生することがあります。まずはあなたのオペレーティング
システムがサポートされており最新であることを確認してください。それでも解
決しない場合は、 C ランタイムアップデートの手動インストール方法について
Microsoft support page(1) を参照してください。

   ---------- Footnotes ----------

   (1) https://support.microsoft.com/en-us/help/3118401/


File: python.info,  Node: グラフィックユーザインターフェース FAQ,  Next: "なぜ Python が私のコンピュータにインストールされているのですか？" FAQ,  Prev: Windows 上の Python FAQ,  Up: Python よくある質問

10.7 グラフィックユーザインターフェース FAQ
===========================================

* Menu:

* 一般的な GUI の質問::
* Python の GUI ツールキットには何がありますか？::
* Tkinter の質問::


File: python.info,  Node: 一般的な GUI の質問,  Next: Python の GUI ツールキットには何がありますか？,  Up: グラフィックユーザインターフェース FAQ

10.7.1 一般的な GUI の質問
--------------------------


File: python.info,  Node: Python の GUI ツールキットには何がありますか？,  Next: Tkinter の質問,  Prev: 一般的な GUI の質問,  Up: グラフィックユーザインターフェース FAQ

10.7.2 Python の GUI ツールキットには何がありますか？
-----------------------------------------------------

Python の標準的なビルドには、 *note tkinter: 42e1. という Tcl/Tk ウィジ
ェットセットのオブジェクト指向インターフェースが含まれています。これは最
も簡単にインストールして使えるでしょう (なぜなら、これは Python のほとん
どの バイナリディストリビューション(1) に同梱されているからです)。ソース
へのポインタなど、 Tk に関する詳しい情報は、 Tcl/Tk ホームページ(2) を参
照してください。 Tcl/Tk は、 macOS 、Windows 、 Unix プラットフォームに
完全にポータブルです。

対象とするプラットフォームによっては他の選択肢もあります。プラットフォー
ム互換(3) および プラットフォーム固有(4) の GUI フレームワークのリストを
python wiki で参照できます。

   ---------- Footnotes ----------

   (1) https://www.python.org/downloads/

   (2) https://www.tcl.tk

   (3) 
https://wiki.python.org/moin/GuiProgramming#Cross-Platform_Frameworks

   (4) 
https://wiki.python.org/moin/GuiProgramming#Platform-specific_Frameworks


File: python.info,  Node: Tkinter の質問,  Prev: Python の GUI ツールキットには何がありますか？,  Up: グラフィックユーザインターフェース FAQ

10.7.3 Tkinter の質問
---------------------

* Menu:

* Tkinter アプリケーションを凍結するにはどうしますか？::
* I/O を待つ間に扱われる Tk イベントを作れますか？::
* Tkinter で働くキーバインディングが得られません。なぜですか？::


File: python.info,  Node: Tkinter アプリケーションを凍結するにはどうしますか？,  Next: I/O を待つ間に扱われる Tk イベントを作れますか？,  Up: Tkinter の質問

10.7.3.1 Tkinter アプリケーションを凍結するにはどうしますか？
.............................................................

Freeze はスタンドアロンアプリケーションを生成するツールです。Tkinter ア
プリケーションを凍結するとき、それは Tcl と Tk ライブラリを必要とするの
で、真のスタンドアロンにはなりません。

一つの解決策は、アプリケーションに Tcl と Tk ライブラリを同梱し、環境変
数 ‘TCL_LIBRARY’ と ‘TK_LIBRARY’ でランタイムに指定することです。

Various third-party freeze libraries such as py2exe and cx_Freeze have
handling for Tkinter applications built-in.


File: python.info,  Node: I/O を待つ間に扱われる Tk イベントを作れますか？,  Next: Tkinter で働くキーバインディングが得られません。なぜですか？,  Prev: Tkinter アプリケーションを凍結するにはどうしますか？,  Up: Tkinter の質問

10.7.3.2 I/O を待つ間に扱われる Tk イベントを作れますか？
.........................................................

Windows 以外のプラットフォームについては、はい、スレッドさえ必要ありませ
ん！ ただし、I/O コードを少し再構成しなければなりません。Tk には Xt の
‘XtAddInput()’ コールと同等なものがあるので、ファイルディスクリプタ上で
I/O が可能なときに Tk メインループから呼ばれるコールバック関数を登録でき
ます。 *note ファイルハンドラ: 42ff. を参照してください。


File: python.info,  Node: Tkinter で働くキーバインディングが得られません。なぜですか？,  Prev: I/O を待つ間に扱われる Tk イベントを作れますか？,  Up: Tkinter の質問

10.7.3.3 Tkinter で働くキーバインディングが得られません。なぜですか？
.....................................................................

‘bind()’ メソッドでイベントに *note 結び付けられた: 42fa. イベントハンド
ラが、適切なキーが押されたときにさえハンドルされないという苦情がよく聞か
れます。

最も一般的な原因は、バインディングが適用されるウィジェットが "キーボード
フォーカス" を持たないことです。Tk ドキュメントでフォーカスコマンドを確
認してください。通常はウィジェットの中をクリックすることでキーボードフォ
ーカスを与えられます (ただしラベルには与えられません。takefocus オプショ
ンを参照してください)。


File: python.info,  Node: "なぜ Python が私のコンピュータにインストールされているのですか？" FAQ,  Prev: グラフィックユーザインターフェース FAQ,  Up: Python よくある質問

10.8 "なぜ Python が私のコンピュータにインストールされているのですか？" FAQ
===========================================================================

* Menu:

* Python とは何ですか？: Python とは何ですか？<2>.
* なぜ Python が私のマシンにインストールされているのですか？::
* Python を削除してもいいですか？::


File: python.info,  Node: Python とは何ですか？<2>,  Next: なぜ Python が私のマシンにインストールされているのですか？,  Up: "なぜ Python が私のコンピュータにインストールされているのですか？" FAQ

10.8.1 Python とは何ですか？
----------------------------

Python はプログラミング言語の一つです。Python は様々なアプリケーションに
使われています。Python は習得しやすいので、一部の高校や大学で入門用のプ
ログラミング言語として使われています。一方で、Google、NASA、Lucasfilm
Ltd.  のような組織でプロフェッショナルなソフトウェア開発者にも使われてい
ます。

Python についてもっと詳しく知りたいなら、Beginner's Guide to Python(1) か
ら始めましょう。

   ---------- Footnotes ----------

   (1) https://wiki.python.org/moin/BeginnersGuide


File: python.info,  Node: なぜ Python が私のマシンにインストールされているのですか？,  Next: Python を削除してもいいですか？,  Prev: Python とは何ですか？<2>,  Up: "なぜ Python が私のコンピュータにインストールされているのですか？" FAQ

10.8.2 なぜ Python が私のマシンにインストールされているのですか？
-----------------------------------------------------------------

インストールした覚えがないのに Python があなたのシステムにインストールさ
れているとしたら、その理由にはいくつかの可能性があります。

   * もしかしたら、コンピュータの他のユーザがプログラミングを学ぶために
     インストールしたのかもしれません。誰がそのマシンを使っていて Python
     をインストールしたか知る必要があります。

   * マシンにインストールされているサードパーティのアプリケーションが、
     Python で書かれていて Python のインストールを含んでいるかもしれませ
     ん。そのようなアプリケーションは、GUI プログラムからネットワーク・
     サーバや管理スクリプトまで、たくさんあります。

   * Windows マシンにも Python がインストールされたものがあります。この
     執筆時点で Hewlett-Packard や Compaq が Python を組み込んでいること
     を確認しています。 HP/Compaq の管理ツールの中には、Python で書かれ
     たものもあるようです。

   * macOS や一部の Linux ディストリビューションなど、多くの Unix 互換オ
     ペレーティングシステムシステムには、Python がデフォルトでインストー
     ルされています。標準インストールに Python が含まれているのです。


File: python.info,  Node: Python を削除してもいいですか？,  Prev: なぜ Python が私のマシンにインストールされているのですか？,  Up: "なぜ Python が私のコンピュータにインストールされているのですか？" FAQ

10.8.3 Python を削除してもいいですか？
--------------------------------------

Python をどこから手に入れたかによります。

誰かが Python を意図してダウンロードしたのであれば、何の問題もなく削除す
ることができます。Windows では、コントロールパネルのプログラムの追加と削
除を使ってください。

Python がサードパーティのアプリケーションによってインストールされたなら
、同様に削除できますが、そのアプリケーションは動作しなくなります。
Python のディレクトリを削除するのではなく、そのアプリケーションのアンイ
ンストーラーを使うべきです。

Python がオペレーティングシステムに含まれて来たなら、削除はお勧めできま
せん。削除してしまうと、Python で書かれたプログラムは全く動かなくなり、
その中には重要なものが含まれているかもしれません。その場合、修復にはシス
テム全体の再インストールが必要になるでしょう。


File: python.info,  Node: 非推奨<14>,  Next: 用語集<2>,  Prev: Python よくある質問,  Up: Top

11 非推奨
*********

* Menu:

* Pending removal in Python 3.15: Pending removal in Python 3 15<7>.
* Pending removal in Python 3.16: Pending removal in Python 3 16<7>.
* Pending removal in Python 3.17: Pending removal in Python 3 17<4>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<5>.
* Pending removal in Python 3.19: Pending removal in Python 3 19<3>.
* Pending removal in future versions: Pending removal in future versions<7>.
* C API deprecations::


File: python.info,  Node: Pending removal in Python 3 15<7>,  Next: Pending removal in Python 3 16<7>,  Up: 非推奨<14>

11.1 Pending removal in Python 3.15
===================================

   * The import system:

        * Setting *note __cached__: 321. on a module while failing to
          set *note __spec__.cached: 322. is deprecated.  In Python
          3.15, ‘__cached__’ will cease to be set or take into
          consideration by the import system or standard library.
          (gh-97879(1))

        * Setting *note __package__: 323. on a module while failing to
          set *note __spec__.parent: 324. is deprecated.  In Python
          3.15, ‘__package__’ will cease to be set or take into
          consideration by the import system or standard library.
          (gh-97879(2))

   * *note ctypes: 2e.:

        * The undocumented ‘ctypes.SetPointerType()’ function has been
          deprecated since Python 3.13.

   * *note http.server: 76.:

        * The obsolete and rarely used *note CGIHTTPRequestHandler: 325.
          has been deprecated since Python 3.13.  No direct replacement
          exists.  'Anything' is better than CGI to interface a web
          server with a request handler.

        * The ‘--cgi’ flag to the ‘python -m http.server’ command-line
          interface has been deprecated since Python 3.13.

   * *note importlib: 7b.:

        * ‘load_module()’ method: use ‘exec_module()’ instead.

   * *note locale: 8a.:

        * The *note getdefaultlocale(): 326. function has been
          deprecated since Python 3.11.  Its removal was originally
          planned for Python 3.13 (gh-90817(3)), but has been postponed
          to Python 3.15.  Use *note getlocale(): 327, *note
          setlocale(): 328, and *note getencoding(): 329. instead.
          (Contributed by Hugo van Kemenade in gh-111187(4).)

   * *note pathlib: a8.:

        * *note PurePath.is_reserved(): 32a. has been deprecated since
          Python 3.13.  Use *note os.path.isreserved(): 32b. to detect
          reserved paths on Windows.

   * *note platform: af.:

        * *note java_ver(): 32c. has been deprecated since Python 3.13.
          This function is only useful for Jython support, has a
          confusing API, and is largely untested.

   * *note sysconfig: e1.:

        * The 'check_home' argument of *note
          sysconfig.is_python_build(): 32d. has been deprecated since
          Python 3.12.

   * *note threading: f3.:

        * *note RLock(): 32e. will take no arguments in Python 3.15.
          Passing any arguments has been deprecated since Python 3.14,
          as the Python version does not permit any arguments, but the C
          version allows any number of positional or keyword arguments,
          ignoring every argument.

   * *note types: 109.:

        * *note types.CodeType: 32f.: Accessing *note co_lnotab: 330.
          was deprecated in PEP 626(5) since 3.10 and was planned to be
          removed in 3.12, but it only got a proper *note
          DeprecationWarning: 1a3. in 3.12.  May be removed in 3.15.
          (Contributed by Nikita Sobolev in gh-101866(6).)

   * *note typing: 10a.:

        * The undocumented keyword argument syntax for creating *note
          NamedTuple: 331. classes (for example, ‘Point =
          NamedTuple("Point", x=int, y=int)’) has been deprecated since
          Python 3.13.  Use the class-based syntax or the functional
          syntax instead.

        * When using the functional syntax of *note TypedDict: 332.s,
          failing to pass a value to the 'fields' parameter (‘TD =
          TypedDict("TD")’) or passing ‘None’ (‘TD = TypedDict("TD",
          None)’) has been deprecated since Python 3.13.  Use ‘class
          TD(TypedDict): pass’ or ‘TD = TypedDict("TD", {})’ to create a
          TypedDict with zero field.

        * The *note typing.no_type_check_decorator(): 333. decorator
          function has been deprecated since Python 3.13.  After eight
          years in the *note typing: 10a. module, it has yet to be
          supported by any major type checker.

   * *note wave: 119.:

        * The *note getmark(): 334, ‘setmark()’, and *note getmarkers():
          335. methods of the *note Wave_read: 336. and *note
          Wave_write: 337. classes have been deprecated since Python
          3.13.

   * *note zipimport: 138.:

        * *note load_module(): 338. has been deprecated since Python
          3.10.  Use *note exec_module(): 339. instead.  (Contributed by
          Jiahao Li in gh-125746(7).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/97879

   (2) https://github.com/python/cpython/issues/97879

   (3) https://github.com/python/cpython/issues/90817

   (4) https://github.com/python/cpython/issues/111187

   (5) https://peps.python.org/pep-0626/

   (6) https://github.com/python/cpython/issues/101866

   (7) https://github.com/python/cpython/issues/125746


File: python.info,  Node: Pending removal in Python 3 16<7>,  Next: Pending removal in Python 3 17<4>,  Prev: Pending removal in Python 3 15<7>,  Up: 非推奨<14>

11.2 Pending removal in Python 3.16
===================================

   * The import system:

        * Setting *note __loader__: 33b. on a module while failing to
          set *note __spec__.loader: 33c. is deprecated.  In Python
          3.16, ‘__loader__’ will cease to be set or taken into
          consideration by the import system or the standard library.

   * *note array: 8.:

        * The ‘'u'’ format code (‘wchar_t’) has been deprecated in
          documentation since Python 3.3 and at runtime since Python
          3.13.  Use the ‘'w'’ format code (*note Py_UCS4: 33d.) for
          Unicode characters instead.

   * *note asyncio: b.:

        * ‘asyncio.iscoroutinefunction()’ is deprecated and will be
          removed in Python 3.16; use *note
          inspect.iscoroutinefunction(): 30d. instead.  (Contributed by
          Jiahao Li and Kumar Aditya in gh-122875(1).)

        * *note asyncio: b. policy system is deprecated and will be
          removed in Python 3.16.  In particular, the following classes
          and functions are deprecated:

             * *note asyncio.AbstractEventLoopPolicy: 30e.

             * *note asyncio.DefaultEventLoopPolicy: 30f.

             * *note asyncio.WindowsSelectorEventLoopPolicy: 310.

             * *note asyncio.WindowsProactorEventLoopPolicy: 311.

             * *note asyncio.get_event_loop_policy(): 312.

             * *note asyncio.set_event_loop_policy(): 313.

          Users should use *note asyncio.run(): 2f3. or *note
          asyncio.Runner: 2f5. with 'loop_factory' to use the desired
          event loop implementation.

          For example, to use *note asyncio.SelectorEventLoop: 314. on
          Windows:

               import asyncio

               async def main():
                   ...

               asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)

          (Contributed by Kumar Aditya in gh-127949(2).)

   * *note builtins: 13.:

        * Bitwise inversion on boolean types, ‘~True’ or ‘~False’ has
          been deprecated since Python 3.12, as it produces surprising
          and unintuitive results (‘-2’ and ‘-1’).  Use ‘not x’ instead
          for the logical negation of a Boolean.  In the rare case that
          you need the bitwise inversion of the underlying integer,
          convert to ‘int’ explicitly (‘~int(x)’).

   * *note functools: 63.:

        * Calling the Python implementation of *note functools.reduce():
          21a. with 'function' or 'sequence' as keyword arguments has
          been deprecated since Python 3.14.

   * *note logging: 8b.:

     Support for custom logging handlers with the 'strm' argument is
     deprecated and scheduled for removal in Python 3.16.  Define
     handlers with the 'stream' argument instead.  (Contributed by
     Mariusz Felisiak in gh-115032(3).)

   * *note mimetypes: 93.:

        * Valid extensions start with a '.'  or are empty for *note
          mimetypes.MimeTypes.add_type(): 319.  Undotted extensions are
          deprecated and will raise a *note ValueError: 2ec. in Python
          3.16.  (Contributed by Hugo van Kemenade in gh-75223(4).)

   * *note shutil: ca.:

        * The ‘ExecError’ exception has been deprecated since Python
          3.14.  It has not been used by any function in ‘shutil’ since
          Python 3.4, and is now an alias of *note RuntimeError: 244.

   * *note symtable: de.:

        * The *note Class.get_methods: 31d. method has been deprecated
          since Python 3.14.

   * *note sys: df.:

        * The *note _enablelegacywindowsfsencoding(): 33e. function has
          been deprecated since Python 3.13.  Use the *note
          PYTHONLEGACYWINDOWSFSENCODING: 33f. environment variable
          instead.

   * *note sysconfig: e1.:

        * The ‘sysconfig.expand_makefile_vars()’ function has been
          deprecated since Python 3.14.  Use the ‘vars’ argument of
          *note sysconfig.get_paths(): 340. instead.

   * *note tarfile: e4.:

        * The undocumented and unused ‘TarFile.tarfile’ attribute has
          been deprecated since Python 3.13.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/122875

   (2) https://github.com/python/cpython/issues/127949

   (3) https://github.com/python/cpython/issues/115032

   (4) https://github.com/python/cpython/issues/75223


File: python.info,  Node: Pending removal in Python 3 17<4>,  Next: Pending removal in Python 3 18<5>,  Prev: Pending removal in Python 3 16<7>,  Up: 非推奨<14>

11.3 Pending removal in Python 3.17
===================================

   * *note collections.abc: 1f.:

        - *note collections.abc.ByteString: 342. is scheduled for
          removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 260. at runtime.  For
          use in type annotations, either use *note Buffer: 343. or a
          union that explicitly specifies the types your code supports
          (e.g., ‘bytes | bytearray | memoryview’).

          ‘ByteString’ was originally intended to be an abstract class
          that would serve as a supertype of both *note bytes: 192. and
          *note bytearray: 344.  However, since the ABC never had any
          methods, knowing that an object was an instance of
          ‘ByteString’ never actually told you anything useful about the
          object.  Other common buffer types such as *note memoryview:
          165. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(1) for more details.  (Contributed by Shantanu
          Jain in gh-91896(2).)

   * *note typing: 10a.:

        - Before Python 3.14, old-style unions were implemented using
          the private class ‘typing._UnionGenericAlias’.  This class is
          no longer needed for the implementation, but it has been
          retained for backward compatibility, with removal scheduled
          for Python 3.17.  Users should use documented introspection
          helpers like *note typing.get_origin(): 2ab. and *note
          typing.get_args(): 2ac. instead of relying on private
          implementation details.

        - *note typing.ByteString: 345, deprecated since Python 3.9, is
          scheduled for removal in Python 3.17.

          Use ‘isinstance(obj, collections.abc.Buffer)’ to test if ‘obj’
          implements the *note buffer protocol: 260. at runtime.  For
          use in type annotations, either use *note Buffer: 343. or a
          union that explicitly specifies the types your code supports
          (e.g., ‘bytes | bytearray | memoryview’).

          ‘ByteString’ was originally intended to be an abstract class
          that would serve as a supertype of both *note bytes: 192. and
          *note bytearray: 344.  However, since the ABC never had any
          methods, knowing that an object was an instance of
          ‘ByteString’ never actually told you anything useful about the
          object.  Other common buffer types such as *note memoryview:
          165. were also never understood as subtypes of ‘ByteString’
          (either at runtime or by static type checkers).

          See PEP 688(3) for more details.  (Contributed by Shantanu
          Jain in gh-91896(4).)

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0688/#current-options

   (2) https://github.com/python/cpython/issues/91896

   (3) https://peps.python.org/pep-0688/#current-options

   (4) https://github.com/python/cpython/issues/91896


File: python.info,  Node: Pending removal in Python 3 18<5>,  Next: Pending removal in Python 3 19<3>,  Prev: Pending removal in Python 3 17<4>,  Up: 非推奨<14>

11.4 Pending removal in Python 3.18
===================================

   * *note decimal: 3a.:

        * The non-standard and undocumented *note Decimal: 1fe. format
          specifier ‘'N'’, which is only supported in the ‘decimal’
          module's C implementation, has been deprecated since Python
          3.13.  (Contributed by Serhiy Storchaka in gh-89902(1).)

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/89902


File: python.info,  Node: Pending removal in Python 3 19<3>,  Next: Pending removal in future versions<7>,  Prev: Pending removal in Python 3 18<5>,  Up: 非推奨<14>

11.5 Pending removal in Python 3.19
===================================

   * *note ctypes: 2e.:

        * Implicitly switching to the MSVC-compatible struct layout by
          setting *note _pack_: 317. but not *note _layout_: 1e7. on
          non-Windows platforms.


File: python.info,  Node: Pending removal in future versions<7>,  Next: C API deprecations,  Prev: Pending removal in Python 3 19<3>,  Up: 非推奨<14>

11.6 Pending removal in future versions
=======================================

The following APIs will be removed in the future, although there is
currently no date scheduled for their removal.

   * *note argparse: 7.:

        * Nesting argument groups and nesting mutually exclusive groups
          are deprecated.

        * Passing the undocumented keyword argument 'prefix_chars' to
          *note add_argument_group(): 2eb. is now deprecated.

        * The *note argparse.FileType: 30c. type converter is
          deprecated.

   * *note builtins: 13.:

        * Generators: ‘throw(type, exc, tb)’ and ‘athrow(type, exc, tb)’
          signature is deprecated: use ‘throw(exc)’ and ‘athrow(exc)’
          instead, the single argument signature.

        * Currently Python accepts numeric literals immediately followed
          by keywords, for example ‘0in x’, ‘1or x’, ‘0if 1else 2’.  It
          allows confusing and ambiguous expressions like ‘[0x1for x in
          y]’ (which can be interpreted as ‘[0x1 for x in y]’ or ‘[0x1f
          or x in y]’).  A syntax warning is raised if the numeric
          literal is immediately followed by one of keywords *note and:
          349, *note else: 17c, *note for: 34a, *note if: 181, *note in:
          34b, *note is: 34c. and *note or: 34d.  In a future release it
          will be changed to a syntax error.  (gh-87999(1))

        * Support for ‘__index__()’ and ‘__int__()’ method returning
          non-int type: these methods will be required to return an
          instance of a strict subclass of *note int: 19b.

        * Support for ‘__float__()’ method returning a strict subclass
          of *note float: 196.: these methods will be required to return
          an instance of *note float: 196.

        * Support for ‘__complex__()’ method returning a strict subclass
          of *note complex: 197.: these methods will be required to
          return an instance of *note complex: 197.

        * Passing a complex number as the 'real' or 'imag' argument in
          the *note complex(): 197. constructor is now deprecated; it
          should only be passed as a single positional argument.
          (Contributed by Serhiy Storchaka in gh-109218(2).)

   * *note calendar: 15.: ‘calendar.January’ and ‘calendar.February’
     constants are deprecated and replaced by *note calendar.JANUARY:
     34e. and *note calendar.FEBRUARY: 34f.  (Contributed by Prince
     Roshan in gh-103636(3).)

   * *note codecs: 1c.: use *note open(): 316. instead of *note
     codecs.open(): 315.  (gh-133038(4))

   * *note codeobject.co_lnotab: 330.: use the *note
     codeobject.co_lines(): 350. method instead.

   * *note datetime: 34.:

        * *note utcnow(): 351.: use
          ‘datetime.datetime.now(tz=datetime.UTC)’.

        * *note utcfromtimestamp(): 352.: use
          ‘datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)’.

   * *note gettext: 67.: Plural value must be an integer.

   * *note importlib: 7b.:

        * *note cache_from_source(): 353. 'debug_override' parameter is
          deprecated: use the 'optimization' parameter instead.

   * *note importlib.metadata: 7e.:

        * ‘EntryPoints’ tuple interface.

        * Implicit ‘None’ on return values.

   * *note logging: 8b.: the ‘warn()’ method has been deprecated since
     Python 3.3, use *note warning(): 354. instead.

   * *note mailbox: 8f.: Use of StringIO input and text mode is
     deprecated, use BytesIO and binary mode instead.

   * *note os: a5.: Calling *note os.register_at_fork(): 355. in
     multi-threaded process.

   * ‘pydoc.ErrorDuringImport’: A tuple value for 'exc_info' parameter
     is deprecated, use an exception instance.

   * *note re: be.: More strict rules are now applied for numerical
     group references and group names in regular expressions.  Only
     sequence of ASCII digits is now accepted as a numerical reference.
     The group name in bytes patterns and replacement strings can now
     only contain ASCII letters and digits and underscore.  (Contributed
     by Serhiy Storchaka in gh-91760(5).)

   * ‘sre_compile’, ‘sre_constants’ and ‘sre_parse’ modules.

   * *note shutil: ca.: *note rmtree(): 356.'s 'onerror' parameter is
     deprecated in Python 3.12; use the 'onexc' parameter instead.

   * *note ssl: d5. options and protocols:

        * *note ssl.SSLContext: 357. without protocol argument is
          deprecated.

        * *note ssl.SSLContext: 357.: *note set_npn_protocols(): 358.
          and ‘selected_npn_protocol()’ are deprecated: use ALPN
          instead.

        * ‘ssl.OP_NO_SSL*’ options

        * ‘ssl.OP_NO_TLS*’ options

        * ‘ssl.PROTOCOL_SSLv3’

        * ‘ssl.PROTOCOL_TLS’

        * ‘ssl.PROTOCOL_TLSv1’

        * ‘ssl.PROTOCOL_TLSv1_1’

        * ‘ssl.PROTOCOL_TLSv1_2’

        * ‘ssl.TLSVersion.SSLv3’

        * ‘ssl.TLSVersion.TLSv1’

        * ‘ssl.TLSVersion.TLSv1_1’

   * *note threading: f3. methods:

        * ‘threading.Condition.notifyAll()’: use *note notify_all():
          359.

        * ‘threading.Event.isSet()’: use *note is_set(): 35a.

        * ‘threading.Thread.isDaemon()’, *note
          threading.Thread.setDaemon(): 35b.: use *note
          threading.Thread.daemon: 35c. attribute.

        * ‘threading.Thread.getName()’, *note
          threading.Thread.setName(): 35d.: use *note
          threading.Thread.name: 2a0. attribute.

        * ‘threading.currentThread()’: use *note
          threading.current_thread(): 35e.

        * ‘threading.activeCount()’: use *note threading.active_count():
          35f.

   * *note typing.Text: 360. (gh-92332(6)).

   * The internal class ‘typing._UnionGenericAlias’ is no longer used to
     implement *note typing.Union: 2a8.  To preserve compatibility with
     users using this private class, a compatibility shim will be
     provided until at least Python 3.17.  (Contributed by Jelle
     Zijlstra in gh-105499(7).)

   * *note unittest.IsolatedAsyncioTestCase: 361.: it is deprecated to
     return a value that is not ‘None’ from a test case.

   * *note urllib.parse: 110. deprecated functions: *note urlparse():
     362. instead

        * ‘splitattr()’

        * ‘splithost()’

        * ‘splitnport()’

        * ‘splitpasswd()’

        * ‘splitport()’

        * ‘splitquery()’

        * ‘splittag()’

        * ‘splittype()’

        * ‘splituser()’

        * ‘splitvalue()’

        * ‘to_bytes()’

   * *note wsgiref: 11e.: ‘SimpleHandler.stdout.write()’ should not do
     partial writes.

   * *note xml.etree.ElementTree: 12b.: Testing the truth value of an
     *note Element: 363. is deprecated.  In a future release it will
     always return ‘True’.  Prefer explicit ‘len(elem)’ or ‘elem is not
     None’ tests instead.

   * *note sys._clear_type_cache(): 292. is deprecated: use *note
     sys._clear_internal_caches(): 364. instead.

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/issues/87999

   (2) https://github.com/python/cpython/issues/109218

   (3) https://github.com/python/cpython/issues/103636

   (4) https://github.com/python/cpython/issues/133038

   (5) https://github.com/python/cpython/issues/91760

   (6) https://github.com/python/cpython/issues/92332

   (7) https://github.com/python/cpython/issues/105499


File: python.info,  Node: C API deprecations,  Prev: Pending removal in future versions<7>,  Up: 非推奨<14>

11.7 C API deprecations
=======================

* Menu:

* Pending removal in Python 3.15: Pending removal in Python 3 15<8>.
* Pending removal in Python 3.18: Pending removal in Python 3 18<6>.
* Pending removal in future versions: Pending removal in future versions<8>.


File: python.info,  Node: Pending removal in Python 3 15<8>,  Next: Pending removal in Python 3 18<6>,  Up: C API deprecations

11.7.1 Pending removal in Python 3.15
-------------------------------------

   * The *note PyImport_ImportModuleNoBlock(): 3db.: Use *note
     PyImport_ImportModule(): 3dc. instead.

   * *note PyWeakref_GetObject(): 3dd. and *note PyWeakref_GET_OBJECT():
     3de.: Use *note PyWeakref_GetRef(): 3df. instead.  The
     pythoncapi-compat project(1) can be used to get *note
     PyWeakref_GetRef(): 3df. on Python 3.12 and older.

   * *note Py_UNICODE: 3e0. type and the ‘Py_UNICODE_WIDE’ macro: Use
     ‘wchar_t’ instead.

   * ‘PyUnicode_AsDecodedObject()’: Use *note PyCodec_Decode(): 3e1.
     instead.

   * ‘PyUnicode_AsDecodedUnicode()’: Use *note PyCodec_Decode(): 3e1.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note str: 169, such as *note bytes: 192.

   * ‘PyUnicode_AsEncodedObject()’: Use *note PyCodec_Encode(): 3e2.
     instead.

   * ‘PyUnicode_AsEncodedUnicode()’: Use *note PyCodec_Encode(): 3e2.
     instead; Note that some codecs (for example, "base64") may return a
     type other than *note bytes: 192, such as *note str: 169.

   * Python initialization functions, deprecated in Python 3.13:

        * *note Py_GetPath(): 3e3.: Use *note
          PyConfig_Get("module_search_paths"): 37c. (*note sys.path:
          3e4.) instead.

        * *note Py_GetPrefix(): 3e5.: Use *note
          PyConfig_Get("base_prefix"): 37c. (*note sys.base_prefix:
          3e6.) instead.  Use *note PyConfig_Get("prefix"): 37c. (*note
          sys.prefix: 3e7.) if *note virtual environments: 3e8. need to
          be handled.

        * *note Py_GetExecPrefix(): 3e9.: Use *note
          PyConfig_Get("base_exec_prefix"): 37c. (*note
          sys.base_exec_prefix: 3ea.) instead.  Use *note
          PyConfig_Get("exec_prefix"): 37c. (*note sys.exec_prefix:
          3eb.) if *note virtual environments: 3e8. need to be handled.

        * *note Py_GetProgramFullPath(): 3ec.: Use *note
          PyConfig_Get("executable"): 37c. (*note sys.executable: 3ed.)
          instead.

        * *note Py_GetProgramName(): 3ee.: Use *note
          PyConfig_Get("executable"): 37c. (*note sys.executable: 3ed.)
          instead.

        * *note Py_GetPythonHome(): 3ef.: Use *note
          PyConfig_Get("home"): 37c. or the *note PYTHONHOME: 3f0.
          environment variable instead.

     The pythoncapi-compat project(2) can be used to get *note
     PyConfig_Get(): 37c. on Python 3.13 and older.

   * Functions to configure Python's initialization, deprecated in
     Python 3.11:

        * ‘PySys_SetArgvEx()’: Set *note PyConfig.argv: 3f1. instead.

        * ‘PySys_SetArgv()’: Set *note PyConfig.argv: 3f1. instead.

        * ‘Py_SetProgramName()’: Set *note PyConfig.program_name: 3f2.
          instead.

        * ‘Py_SetPythonHome()’: Set *note PyConfig.home: 3f3. instead.

        * *note PySys_ResetWarnOptions(): 3f4.: Clear *note
          sys.warnoptions: 3f5. and ‘warnings.filters’ instead.

     The *note Py_InitializeFromConfig(): 3f6. API should be used with
     *note PyConfig: 3f7. instead.

   * Global configuration variables:

        * *note Py_DebugFlag: 3f8.: Use *note PyConfig.parser_debug:
          3f9. or *note PyConfig_Get("parser_debug"): 37c. instead.

        * *note Py_VerboseFlag: 3fa.: Use *note PyConfig.verbose: 3fb.
          or *note PyConfig_Get("verbose"): 37c. instead.

        * *note Py_QuietFlag: 3fc.: Use *note PyConfig.quiet: 3fd. or
          *note PyConfig_Get("quiet"): 37c. instead.

        * *note Py_InteractiveFlag: 3fe.: Use *note
          PyConfig.interactive: 3ff. or *note
          PyConfig_Get("interactive"): 37c. instead.

        * *note Py_InspectFlag: 400.: Use *note PyConfig.inspect: 401.
          or *note PyConfig_Get("inspect"): 37c. instead.

        * *note Py_OptimizeFlag: 402.: Use *note
          PyConfig.optimization_level: 403. or *note
          PyConfig_Get("optimization_level"): 37c. instead.

        * *note Py_NoSiteFlag: 404.: Use *note PyConfig.site_import:
          405. or *note PyConfig_Get("site_import"): 37c. instead.

        * *note Py_BytesWarningFlag: 406.: Use *note
          PyConfig.bytes_warning: 407. or *note
          PyConfig_Get("bytes_warning"): 37c. instead.

        * *note Py_FrozenFlag: 408.: Use *note
          PyConfig.pathconfig_warnings: 409. or *note
          PyConfig_Get("pathconfig_warnings"): 37c. instead.

        * *note Py_IgnoreEnvironmentFlag: 40a.: Use *note
          PyConfig.use_environment: 40b. or *note
          PyConfig_Get("use_environment"): 37c. instead.

        * *note Py_DontWriteBytecodeFlag: 40c.: Use *note
          PyConfig.write_bytecode: 40d. or *note
          PyConfig_Get("write_bytecode"): 37c. instead.

        * *note Py_NoUserSiteDirectory: 40e.: Use *note
          PyConfig.user_site_directory: 40f. or *note
          PyConfig_Get("user_site_directory"): 37c. instead.

        * *note Py_UnbufferedStdioFlag: 410.: Use *note
          PyConfig.buffered_stdio: 411. or *note
          PyConfig_Get("buffered_stdio"): 37c. instead.

        * *note Py_HashRandomizationFlag: 412.: Use *note
          PyConfig.use_hash_seed: 413. and *note PyConfig.hash_seed:
          414. or *note PyConfig_Get("hash_seed"): 37c. instead.

        * *note Py_IsolatedFlag: 415.: Use *note PyConfig.isolated: 416.
          or *note PyConfig_Get("isolated"): 37c. instead.

        * *note Py_LegacyWindowsFSEncodingFlag: 417.: Use *note
          PyPreConfig.legacy_windows_fs_encoding: 418. or *note
          PyConfig_Get("legacy_windows_fs_encoding"): 37c. instead.

        * *note Py_LegacyWindowsStdioFlag: 419.: Use *note
          PyConfig.legacy_windows_stdio: 41a. or *note
          PyConfig_Get("legacy_windows_stdio"): 37c. instead.

        * ‘Py_FileSystemDefaultEncoding’,
          ‘Py_HasFileSystemDefaultEncoding’: Use *note
          PyConfig.filesystem_encoding: 41b. or *note
          PyConfig_Get("filesystem_encoding"): 37c. instead.

        * ‘Py_FileSystemDefaultEncodeErrors’: Use *note
          PyConfig.filesystem_errors: 41c. or *note
          PyConfig_Get("filesystem_errors"): 37c. instead.

        * ‘Py_UTF8Mode’: Use *note PyPreConfig.utf8_mode: 41d. or *note
          PyConfig_Get("utf8_mode"): 37c. instead.  (see *note
          Py_PreInitialize(): 41e.)

     The *note Py_InitializeFromConfig(): 3f6. API should be used with
     *note PyConfig: 3f7. to set these options.  Or *note
     PyConfig_Get(): 37c. can be used to get these options at runtime.

   ---------- Footnotes ----------

   (1) https://github.com/python/pythoncapi-compat/

   (2) https://github.com/python/pythoncapi-compat/


File: python.info,  Node: Pending removal in Python 3 18<6>,  Next: Pending removal in future versions<8>,  Prev: Pending removal in Python 3 15<8>,  Up: C API deprecations

11.7.2 Pending removal in Python 3.18
-------------------------------------

   * The following private functions are deprecated and planned for
     removal in Python 3.18:

        * ‘_PyBytes_Join()’: use *note PyBytes_Join(): 383.

        * ‘_PyDict_GetItemStringWithError()’: use *note
          PyDict_GetItemStringRef(): 421.

        * ‘_PyDict_Pop()’: use *note PyDict_Pop(): 422.

        * ‘_PyLong_Sign()’: use *note PyLong_GetSign(): 39a.

        * ‘_PyLong_FromDigits()’ and ‘_PyLong_New()’: use *note
          PyLongWriter_Create(): 3aa.

        * ‘_PyThreadState_UncheckedGet()’: use *note
          PyThreadState_GetUnchecked(): 423.

        * ‘_PyUnicode_AsString()’: use *note PyUnicode_AsUTF8(): 424.

        * ‘_PyUnicodeWriter_Init()’: replace
          ‘_PyUnicodeWriter_Init(&writer)’ with *note writer =
          PyUnicodeWriter_Create(0): 3b4.

        * ‘_PyUnicodeWriter_Finish()’: replace
          ‘_PyUnicodeWriter_Finish(&writer)’ with *note
          PyUnicodeWriter_Finish(writer): 3b7.

        * ‘_PyUnicodeWriter_Dealloc()’: replace
          ‘_PyUnicodeWriter_Dealloc(&writer)’ with *note
          PyUnicodeWriter_Discard(writer): 3b6.

        * ‘_PyUnicodeWriter_WriteChar()’: replace
          ‘_PyUnicodeWriter_WriteChar(&writer, ch)’ with *note
          PyUnicodeWriter_WriteChar(writer, ch): 3ba.

        * ‘_PyUnicodeWriter_WriteStr()’: replace
          ‘_PyUnicodeWriter_WriteStr(&writer, str)’ with *note
          PyUnicodeWriter_WriteStr(writer, str): 3bc.

        * ‘_PyUnicodeWriter_WriteSubstring()’: replace
          ‘_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)’
          with *note PyUnicodeWriter_WriteSubstring(writer, str, start,
          end): 3bd.

        * ‘_PyUnicodeWriter_WriteASCIIString()’: replace
          ‘_PyUnicodeWriter_WriteASCIIString(&writer, str)’ with *note
          PyUnicodeWriter_WriteASCII(writer, str): 3b9.

        * ‘_PyUnicodeWriter_WriteLatin1String()’: replace
          ‘_PyUnicodeWriter_WriteLatin1String(&writer, str)’ with *note
          PyUnicodeWriter_WriteUTF8(writer, str): 3bf.

        * ‘_PyUnicodeWriter_Prepare()’: (no replacement).

        * ‘_PyUnicodeWriter_PrepareKind()’: (no replacement).

        * ‘_Py_HashPointer()’: use *note Py_HashPointer(): 425.

        * ‘_Py_fopen_obj()’: use *note Py_fopen(): 393.

     The pythoncapi-compat project(1) can be used to get these new
     public functions on Python 3.13 and older.  (Contributed by Victor
     Stinner in gh-128863(2).)

   ---------- Footnotes ----------

   (1) https://github.com/python/pythoncapi-compat/

   (2) https://github.com/python/cpython/issues/128863


File: python.info,  Node: Pending removal in future versions<8>,  Prev: Pending removal in Python 3 18<6>,  Up: C API deprecations

11.7.3 Pending removal in future versions
-----------------------------------------

The following APIs are deprecated and will be removed, although there is
currently no date scheduled for their removal.

   * *note Py_TPFLAGS_HAVE_FINALIZE: 427.: Unneeded since Python 3.8.

   * *note PyErr_Fetch(): 428.: Use *note PyErr_GetRaisedException():
     429. instead.

   * *note PyErr_NormalizeException(): 42a.: Use *note
     PyErr_GetRaisedException(): 429. instead.

   * *note PyErr_Restore(): 42b.: Use *note PyErr_SetRaisedException():
     42c. instead.

   * *note PyModule_GetFilename(): 42d.: Use *note
     PyModule_GetFilenameObject(): 42e. instead.

   * *note PyOS_AfterFork(): 42f.: Use *note PyOS_AfterFork_Child():
     430. instead.

   * *note PySlice_GetIndicesEx(): 431.: Use *note PySlice_Unpack():
     432. and *note PySlice_AdjustIndices(): 433. instead.

   * *note PyUnicode_READY(): 434.: Unneeded since Python 3.12

   * ‘PyErr_Display()’: Use *note PyErr_DisplayException(): 435.
     instead.

   * ‘_PyErr_ChainExceptions()’: Use ‘_PyErr_ChainExceptions1()’
     instead.

   * ‘PyBytesObject.ob_shash’ member: call *note PyObject_Hash(): 436.
     instead.

   * Thread Local Storage (TLS) API:

        * *note PyThread_create_key(): 437.: Use *note
          PyThread_tss_alloc(): 438. instead.

        * *note PyThread_delete_key(): 439.: Use *note
          PyThread_tss_free(): 43a. instead.

        * *note PyThread_set_key_value(): 43b.: Use *note
          PyThread_tss_set(): 43c. instead.

        * *note PyThread_get_key_value(): 43d.: Use *note
          PyThread_tss_get(): 43e. instead.

        * *note PyThread_delete_key_value(): 43f.: Use *note
          PyThread_tss_delete(): 440. instead.

        * *note PyThread_ReInitTLS(): 441.: Unneeded since Python 3.7.


File: python.info,  Node: 用語集<2>,  Next: このドキュメントについて,  Prev: 非推奨<14>,  Up: Top

12 用語集
*********

‘>>>’

     *note 対話型: 1b5. シェルにおけるデフォルトの Python プロンプトです
     。インタープリターで対話的に実行されるコード例でよく見られます。

‘...’

     次のものが考えられます:

        * 対話型 (*note interactive: 1b5.) シェルにおいて、インデントさ
          れたコードブロック、対応する左右の区切り文字の組 (丸括弧、角括
          弧、波括弧、三重引用符) の内側、デコレーターの後に、コードを入
          力する際に表示されるデフォルトの Python プロンプトです。

        * The three dots form of the *note Ellipsis: 1ffc. object.

abstract base class

     (抽象基底クラス) 抽象基底クラスは *note duck-typing: 5984. を補完す
     るもので、 *note hasattr(): 6f9. などの別のテクニックでは不恰好であ
     ったり微妙に誤る (例えば *note magic methods: 23b1. の場合) 場合に
     インターフェースを定義する方法を提供します。ABC は仮想 (virtual) サ
     ブクラスを導入します。これは親クラスから継承しませんが、それでも
     *note isinstance(): 2ad. や *note issubclass(): 9c4. に認識されます
     ; *note abc: 4. モジュールのドキュメントを参照してください。Python
     には、多くの組み込み ABC が同梱されています。その対象は、(*note
     collections.abc: 1f. モジュールで) データ構造、(*note numbers: a2.
     モジュールで) 数、(*note io: 83. モジュールで) ストリーム、(*note
     importlib.abc: 7c. モジュールで) インポートファインダ及びローダーで
     す。 *note abc: 4. モジュールを利用して独自の ABC を作成できます。

annotate function

     A function that can be called to retrieve the *note annotations:
     15c. of an object.  This function is accessible as the *note
     __annotate__: 1983. attribute of functions, classes, and modules.
     Annotate functions are a subset of *note evaluate functions: 44ef.

annotation

     (アノテーション) 変数、クラス属性、関数のパラメータや返り値に関係す
     るラベルです。 慣例により *note type hint: 23cb. として使われていま
     す。

     Annotations of local variables cannot be accessed at runtime, but
     annotations of global variables, class attributes, and functions
     can be retrieved by calling *note annotationlib.get_annotations():
     459. on modules, classes, and functions, respectively.

     機能の説明がある *note variable annotation: f51, *note function
     annotation: 2019, PEP 484(1), PEP 526(2), PEP 649(3) を参照してくだ
     さい。また、アノテーションを利用するベストプラクティスとして *note
     Annotations Best Practices: 9d9. も参照してください。

引数 (argument)

     (実引数) 関数を呼び出す際に、 *note 関数: 24b7. (または *note
     メソッド: 1864.) に渡す値です。実引数には２種類あります:

        * 'キーワード引数': 関数呼び出しの際に引数の前に識別子がついたも
          の (例: ‘name=’) や、 ‘**’ に続けた辞書の中の値として渡された
          引数。例えば、次の *note complex(): 197. の呼び出しでは、 ‘3’
          と ‘5’ がキーワード引数です:

               complex(real=3, imag=5)
               complex(**{'real': 3, 'imag': 5})

        * '位置引数': キーワード引数以外の引数。位置引数は引数リストの先
          頭に書くことができ、また ‘*’ に続けた *note iterable: 12f1. の
          要素として渡すことができます。例えば、次の例では ‘3’ と ‘5’ は
          両方共位置引数です:

               complex(3, 5)
               complex(*(3, 5))

     実引数は関数の実体において名前付きのローカル変数に割り当てられます
     。割り当てを行う規則については *note 呼び出し (call): f7d. を参照し
     てください。シンタックスにおいて実引数を表すためにあらゆる式を使う
     ことが出来ます。評価された値はローカル変数に割り当てられます。

     *note 仮引数: 234b. 、FAQ の *note 実引数と仮引数の違いは何ですか?:
     58be. 、 PEP 362(4) を参照してください。

asynchronous context manager

     (非同期コンテキストマネージャ) *note __aenter__(): 241d. と *note
     __aexit__(): 19a1. メソッドを定義することで *note async with: 185.
     文内の環境を管理するオブジェクトです。 PEP 492(5) で導入されました
     。

asynchronous generator

     (非同期ジェネレータ) *note asynchronous generator iterator: 4918. を
     返す関数です。 *note async def: 7ed. で定義されたコルーチン関数に似
     ていますが、 *note yield: bc2. 式を持つ点で異なります。 *note
     yield: bc2. 式は *note async for: ca1. ループで使用できる値の並びを
     生成するのに使用されます。

     通常は非同期ジェネレータ関数を指しますが、文脈によっては '非同期ジ
     ェネレータイテレータ' を指す場合があります。 意図された意味が明らか
     でない場合、 明瞭化のために完全な単語を使用します。

     非同期ジェネレータ関数には、 *note async for: ca1. 文や *note async
     with: 185. 文だけでなく *note await: 18d. 式もあることがあります。

asynchronous generator iterator

     (非同期ジェネレータイテレータ) *note asynchronous generator: 249b.
     関数で生成されるオブジェクトです。

     これは *note asynchronous iterator: 4c7. で、 *note __anext__():
     1882. メソッドを使って呼ばれると awaitable オブジェクトを返します。
     この awaitable オブジェクトは、次の *note yield: bc2. 式まで非同期
     ジェネレータ関数の本体を実行します。

     各 *note yield: bc2. では一時的に処理を中断し、その実行状態 (ローカ
     ル変数や保留中の try 文を含む) を記憶します。 '非同期ジェネレータイ
     テレータ' が *note __anext__(): 1882. で返された他の awaitable で実
     際に再開する時には、その中断箇所が選ばれます。 PEP 492(6) および
     PEP 525(7) を参照してください。

asynchronous iterable

     (非同期イテラブル) *note async for: ca1. 文の中で使用できるオブジェ
     クトです。 自身の *note __aiter__(): df6. メソッドから *note
     asynchronous iterator: 4c7. を返さなければなりません。 PEP 492(8) で
     導入されました。

asynchronous iterator

     (非同期イテレータ) *note __aiter__(): df6. と *note __anext__():
     1882. メソッドを実装したオブジェクトです。 *note __anext__(): 1882.
     は *note awaitable: 4c9. オブジェクトを返さなければなりません。
     *note async for: ca1. は *note StopAsyncIteration: 1e0f. 例外を送出
     するまで、非同期イテレータの *note __anext__(): 1882. メソッドが返
     す awaitable を解決します。 PEP 492(9) で導入されました。

atomic operation

     An operation that appears to execute as a single, indivisible step:
     no other thread can observe it half-done, and its effects become
     visible all at once.  Python does not guarantee that high-level
     statements are atomic (for example, ‘x += 1’ performs multiple
     bytecode operations and is not atomic).  Atomicity is only
     guaranteed where explicitly documented.  See also *note race
     condition: 5985. and *note data race: 5986.

attached thread state

     A *note thread state: 1846. that is active for the current OS
     thread.

     When a *note thread state: 1846. is attached, the OS thread has
     access to the full Python C API and can safely invoke the bytecode
     interpreter.

     Unless a function explicitly notes otherwise, attempting to call
     the C API without an attached thread state will result in a fatal
     error or undefined behavior.  A thread state can be attached and
     detached explicitly by the user through the C API, or implicitly by
     the runtime, including during blocking C calls and by the bytecode
     interpreter in between calls.

     On most builds of Python, having an attached thread state implies
     that the caller holds the *note GIL: 164. for the current
     interpreter, so only one OS thread can have an attached thread
     state at a given moment.  In *note free-threaded builds: 176d. of
     Python, threads can concurrently hold an attached thread state,
     allowing for true parallelism of the bytecode interpreter.

属性

     (属性) オブジェクトに関連付けられ、ドット表記式によって名前で通常参
     照される値です。例えば、オブジェクト 'o' が属性 'a' を持っていると
     き、その属性は 'o.a' で参照されます。

     オブジェクトには、 *note Names (identifiers and keywords): 22a0. で
     定義される識別子ではない名前の属性を与えることができます。たとえば
     *note setattr(): 25be. を使い、オブジェクトがそれを許可している場合
     に行えます。このような属性はドット表記式ではアクセスできず、代わり
     に *note getattr(): dca. を使って取る必要があります。

awaitable

     (待機可能) *note await: 18d. 式で使用することが出来るオブジェクトで
     す。 *note coroutine: 6b9. か、 *note __await__(): f75. メソッドが
     あるオブジェクトです。 PEP 492(10) を参照してください。

BDFL

     慈悲深き終身独裁者 (Benevolent Dictator For Life) の略です。Python
     の作者、Guido van Rossum(11) のことです。

binary file

     (バイナリファイル) *note bytes-like オブジェクト: 193. の読み込みお
     よび書き込みができる *note ファイルオブジェクト: 13db. です。 バイ
     ナリファイルの例は、バイナリモード (‘'rb'’, ‘'wb'’ or ‘'rb+'’) で開
     かれたファイル、*note sys.stdin.buffer: 75f.、*note
     sys.stdout.buffer: ccd.、 *note io.BytesIO: 10a4. や *note
     gzip.GzipFile: 65c.  のインスタンスです。

     *note str: 169. オブジェクトの読み書きができるファイルオブジェクト
     については、 *note text file: 206d. も参照してください。

borrowed reference

     In Python's C API, a borrowed reference is a reference to an
     object, where the code using the object does not own the reference.
     It becomes a dangling pointer if the object is destroyed.  For
     example, a garbage collection can remove the last *note strong
     reference: 5e2. to the object and so destroy it.

     Calling *note Py_INCREF(): 78f. on the *note borrowed reference:
     3d7. is recommended to convert it to a *note strong reference: 5e2.
     in-place, except when the object cannot be destroyed before the
     last usage of the borrowed reference.  The *note Py_NewRef(): a9a.
     function can be used to create a new *note strong reference: 5e2.

bytes-like object

     *note バッファプロトコル (buffer Protocol): 260. をサポートしていて
     、 C 言語の意味で *note 連続した: 124e. バッファーを提供可能なオブ
     ジェクト。 *note bytes: 192, *note bytearray: 344, *note
     array.array: 4be. や、多くの一般的な *note memoryview: 165. オブジ
     ェクトがこれに当たります。 bytes-like オブジェクトは、データ圧縮、
     バイナリファイルへの保存、ソケットを経由した送信など、バイナリデー
     タを要求するいろいろな操作に利用することができます。

     幾つかの操作ではバイナリデータを変更する必要があります。 その操作の
     ドキュメントではよく "読み書き可能な bytes-like オブジェクト" に言
     及しています。 変更可能なバッファーオブジェクトには、 *note
     bytearray: 344. と *note bytearray: 344. の *note memoryview: 165.
     などが含まれます。 また、他の幾つかの操作では不変なオブジェクト内の
     バイナリデータ ("読み出し専用の bytes-like オブジェクト") を必要し
     ます。それには *note bytes: 192. と *note bytes: 192. の *note
     memoryview: 165. オブジェクトが含まれます。

bytecode

     (バイトコード) Python のソースコードは、 Python プログラムの
     CPython インタプリタの内部表現であるバイトコードへとコンパイルされ
     ます。 バイトコードは ‘.pyc’ ファイルにキャッシュされ、同じファイル
     が二度目に実行されるときはより高速になります (ソースコードからバイ
     トコードへの再度のコンパイルは回避されます)。 この "中間言語
     (intermediate language)" は、各々のバイトコードに対応する機械語を実
     行する *note 仮想マシン: 3a5b. で動作するといえます。 重要な注意と
     して、バイトコードは異なる Python 仮想マシン間で動作することや、
     Python リリース間で安定であることは期待されていません。

     バイトコードの命令一覧は *note dis モジュール: 7cf. にあります。

callable

     A callable is an object that can be called, possibly with a set of
     arguments (see *note argument: 67b.), with the following syntax:

          callable(argument1, argument2, argumentN)

     A *note function: 24b7, and by extension a *note method: 1864, is a
     callable.  An instance of a class that implements the *note
     __call__(): 77a. method is also a callable.

callback

     (コールバック) 将来のある時点で実行されるために引数として渡される関
     数

クラス

     (クラス) ユーザー定義オブジェクトを作成するためのテンプレートです。
     クラス定義は普通、そのクラスのインスタンス上の操作をするメソッドの
     定義を含みます。

class variable

     (クラス変数) クラス上に定義され、クラスレベルで (つまり、クラスのイ
     ンスタンス上ではなしに) 変更されることを目的としている変数です。

closure variable

     A *note free variable: 2428. referenced from a *note nested scope:
     238d. that is defined in an outer scope rather than being resolved
     at runtime from the globals or builtin namespaces.  May be
     explicitly defined with the *note nonlocal: 14bf. keyword to allow
     write access, or implicitly defined if the variable is only being
     read.

     For example, in the ‘inner’ function in the following code, both
     ‘x’ and ‘print’ are *note free variables: 2428, but only ‘x’ is a
     'closure variable':

          def outer():
              x = 0
              def inner():
                  nonlocal x
                  x += 1
                  print(x)
              return inner

     Due to the *note codeobject.co_freevars: 2347. attribute (which,
     despite its name, only includes the names of closure variables
     rather than listing all referenced free variables), the more
     general *note free variable: 2428. term is sometimes used even when
     the intended meaning is to refer specifically to closure variables.

complex number

     (複素数) よく知られている実数系を拡張したもので、すべての数は実部と
     虚部の和として表されます。虚数は虚数単位 (‘-1’ の平方根) に実数を掛
     けたもので、一般に数学では ‘i’ と書かれ、工学では ‘j’ と書かれます
     。Python は複素数に組み込みで対応し、後者の表記を取っています。虚部
     は末尾に ‘j’ をつけて書きます。例えば ‘3+1j’ です。 *note math: 92.
     モジュールの複素数版を利用するには、 *note cmath: 19. を使います。
     複素数の使用はかなり高度な数学の機能です。必要性を感じなければ、ほ
     ぼ間違いなく無視してしまってよいでしょう。

concurrency

     The ability of a computer program to perform multiple tasks at the
     same time.  Python provides libraries for writing programs that
     make use of different forms of concurrency.  *note asyncio: b. is a
     library for dealing with asynchronous tasks and coroutines.  *note
     threading: f3. provides access to operating system threads and
     *note multiprocessing: 98. to operating system processes.
     Multi-core processors can execute threads and processes on
     different CPU cores at the same time (see *note parallelism:
     598b.).

concurrent modification

     When multiple threads modify shared data at the same time.
     Concurrent modification without proper synchronization can cause
     *note race conditions: 5985, and might also trigger a *note data
     race: 5986, data corruption, or both.

context

     This term has different meanings depending on where and how it is
     used.  Some common meanings:

        * The temporary state or environment established by a *note
          context manager: 1e1. via a *note with: 186. statement.

        * The collection of key­value bindings associated with a
          particular *note contextvars.Context: 177. object and accessed
          via *note ContextVar: 1875. objects.  Also see *note context
          variable: 598d.

        * A *note contextvars.Context: 177. object.  Also see *note
          current context: 1964.

コンテキスト管理プロトコル

     The *note __enter__(): 7e4. and *note __exit__(): 1518. methods
     called by the *note with: 186. statement.  See PEP 343(12).

context manager

     An object which implements the *note context management protocol:
     1965. and controls the environment seen in a *note with: 186.
     statement.  See PEP 343(13).

context variable

     A variable whose value depends on which context is the *note
     current context: 1964.  Values are accessed via *note
     contextvars.ContextVar: 1875. objects.  Context variables are
     primarily used to isolate state between concurrent asynchronous
     tasks.

contiguous

     (隣接、連続) バッファが厳密に 'C-連続' または 'Fortran 連続' である
     場合に、そのバッファは連続しているとみなせます。 ゼロ次元バッファは
     C 連続であり Fortran 連続です。 一次元の配列では、その要素は必ずメ
     モリ上で隣接するように配置され、添字がゼロから始まり増えていく順序
     で並びます。 多次元の C-連続な配列では、メモリアドレス順に要素を巡
     る際には最後の添え字が最初に変わるのに対し、 Fortran 連続な配列では
     最初の添え字が最初に動きます。

コルーチン

     (コルーチン) コルーチンはサブルーチンのより一般的な形式です。 サブ
     ルーチンには決められた地点から入り、別の決められた地点から出ます。
     コルーチンには多くの様々な地点から入る、出る、再開することができま
     す。 コルーチンは *note async def: 7ed. 文で実装できます。 PEP
     492(14) を参照してください。

coroutine function

     (コルーチン関数) *note coroutine: 6b9. オブジェクトを返す関数です。
     コルーチン関数は *note async def: 7ed. 文で実装され、*note await:
     18d.、*note async for: ca1.、 および *note async with: 185. キーワ
     ードを持つことが出来ます。 これらは PEP 492(15) で導入されました。

CPython

     python.org(16) で配布されている、Python プログラミング言語の標準的
     な実装です。"CPython" という単語は、この実装を Jython や IronPython
     といった他の実装と区別する必要が有る場合に利用されます。

current context

     The *note context: 1963. (*note contextvars.Context: 177. object)
     that is currently used by *note ContextVar: 1875. objects to access
     (get or set) the values of *note context variables: 598d.  Each
     thread has its own current context.  Frameworks for executing
     asynchronous tasks (see *note asyncio: b.) associate each task with
     a context which becomes the current context whenever the task
     starts or resumes execution.

cyclic isolate

     A subgroup of one or more objects that reference each other in a
     reference cycle, but are not referenced by objects outside the
     group.  The goal of the *note cyclic garbage collector: 17d8. is to
     identify these groups and break the reference cycles so that the
     memory can be reclaimed.

data race

     A situation where multiple threads access the same memory location
     concurrently, at least one of the accesses is a write, and the
     threads do not use any synchronization to control their access.
     Data races lead to *note non-deterministic: 598e. behavior and can
     cause data corruption.  Proper use of *note locks: 598f. and other
     *note synchronization primitives: 5990. prevents data races.  Note
     that data races can only happen in native code, but that *note
     native code: 5991. might be exposed in a Python API. See also *note
     race condition: 5985. and *note thread-safe: 5992.

deadlock

     A situation in which two or more tasks (threads, processes, or
     coroutines) wait indefinitely for each other to release resources
     or complete actions, preventing any from making progress.  For
     example, if thread A holds lock 1 and waits for lock 2, while
     thread B holds lock 2 and waits for lock 1, both threads will wait
     indefinitely.  In Python this often arises from acquiring multiple
     locks in conflicting orders or from circular join/await
     dependencies.  Deadlocks can be avoided by always acquiring
     multiple *note locks: 598f. in a consistent order.  See also *note
     lock: 598f. and *note reentrant: 5994.

decorator

     (デコレータ) 別の関数を返す関数で、通常、 ‘@wrapper’ 構文で関数変換
     として適用されます。デコレータの一般的な利用例は、 *note
     classmethod(): 48e. と *note staticmethod(): 453. です。

     デコレータの文法はシンタックスシュガーです。次の2つの関数定義は意味
     的に同じものです:

          def f(arg):
              ...
          f = staticmethod(f)

          @staticmethod
          def f(arg):
              ...

     同じ概念がクラスにも存在しますが、あまり使われません。デコレータに
     ついて詳しくは、 *note 関数定義: 2018. および *note クラス定義:
     14ef. のドキュメントを参照してください。

descriptor

     Any object which defines the methods *note __get__(): 1701, *note
     __set__(): 23b5, or *note __delete__(): 194f.  When a class
     attribute is a descriptor, its special binding behavior is
     triggered upon attribute lookup.  Normally, using 'a.b' to get, set
     or delete an attribute looks up the object named 'b' in the class
     dictionary for 'a', but if 'b' is a descriptor, the respective
     descriptor method gets called.  Understanding descriptors is a key
     to a deep understanding of Python because they are the basis for
     many features including functions, methods, properties, class
     methods, static methods, and reference to super classes.

     デスクリプタのメソッドに関しての詳細は、 *note デスクリプタ
     (descriptor) の実装: e49. や *note Descriptor How To Guide: 1706. を
     参照してください。

dictionary

     An associative array, where arbitrary keys are mapped to values.
     The keys can be any object with *note __hash__(): cf3. and *note
     __eq__(): cf2. methods.  Called a hash in Perl.

dictionary comprehension

     (辞書内包表記) iterable 内の全てあるいは一部の要素を処理して、その
     結果からなる辞書を返すコンパクトな書き方です。 ‘results = {n: n **
     2 for n in range(10)}’ とすると、キー ‘n’ を値 ‘n ** 2’ に対応付け
     る辞書を生成します。 *note リスト、集合、辞書の表示: 7ec. を参照し
     てください。

dictionary view

     (辞書ビュー) *note dict.keys(): 9d0.、*note dict.values(): 9d1.、
     *note dict.items(): 9d2. が返すオブジェクトです。 辞書の項目の動的
     なビューを提供します。 すなわち、辞書が変更されるとビューはそれを反
     映します。 辞書ビューを強制的に完全なリストにするには
     ‘list(dictview)’ を使用してください。 *note 辞書ビューオブジェクト:
     2618. を参照してください。

docstring

     A string literal which appears as the first expression in a class,
     function or module.  While ignored when the suite is executed, it
     is recognized by the compiler and put into the *note __doc__: b21.
     attribute of the enclosing class, function or module.  Since it is
     available via introspection, it is the canonical place for
     documentation of the object.

duck-typing

     あるオブジェクトが正しいインターフェースを持っているかを決定するの
     にオブジェクトの型を見ないプログラミングスタイルです。代わりに、単
     純にオブジェクトのメソッドや属性が呼ばれたり使われたりします。（「
     アヒルのように見えて、アヒルのように鳴けば、それはアヒルである。」
     ）インターフェースを型より重視することで、上手くデザインされたコー
     ドは、ポリモーフィックな代替を許して柔軟性を向上させます。ダックタ
     イピングは *note type(): f44. や *note isinstance(): 2ad. による判
     定を避けます。 (ただし、ダックタイピングを *note 抽象基底クラス:
     13ce. で補完することもできます。) その代わり、典型的に *note
     hasattr(): 6f9. 判定や *note EAFP: 3079. プログラミングを利用します
     。

dunder

     An informal short-hand for "double underscore", used when talking
     about a *note special method: 1c60.  For example, ‘__init__’ is
     often pronounced "dunder init".

EAFP

     「認可をとるより許しを請う方が容易 (easier to ask for forgiveness
     than permission、マーフィーの法則)」の略です。この Python で広く使
     われているコーディングスタイルでは、通常は有効なキーや属性が存在す
     るものと仮定し、その仮定が誤っていた場合に例外を捕捉します。この簡
     潔で手早く書けるコーディングスタイルには、 *note try: 8f8. 文および
     *note except: 1ab. 文がたくさんあるのが特徴です。このテクニックは、
     C のような言語でよく使われている *note LBYL: 5997. スタイルと対照的
     なものです。

evaluate function

     A function that can be called to evaluate a lazily evaluated
     attribute of an object, such as the value of type aliases created
     with the *note type: 66d. statement.

expression

     (式) 何かの値と評価される、一まとまりの構文 (a piece of syntax) で
     す。言い換えると、式とはリテラル、名前、属性アクセス、演算子や関数
     呼び出しなど、値を返す式の要素の積み重ねです。他の多くの言語と違い
     、Python では言語の全ての構成要素が式というわけではありません。
     *note while: 1973. のように、式としては使えない *note 文: 2bfc. も
     あります。代入も式ではなく文です。

extension module

     (拡張モジュール) C や C++ で書かれたモジュールで、Python の C API を
     利用して Python コアやユーザーコードとやりとりします。

f-string

f-strings

     String literals prefixed with ‘f’ or ‘F’ are commonly called
     "f-strings" which is short for *note formatted string literals:
     19a.  See also PEP 498(17).

file object

     An object exposing a file-oriented API (with methods such as
     ‘read()’ or ‘write()’) to an underlying resource.  Depending on the
     way it was created, a file object can mediate access to a real
     on-disk file or to another type of storage or communication device
     (for example standard input/output, in-memory buffers, sockets,
     pipes, etc.).  File objects are also called 'file-like objects' or
     'streams'.

     ファイルオブジェクトには実際には 3 種類あります: 生の *note
     バイナリーファイル: 206e.、バッファされた *note バイナリーファイル:
     206e.、そして *note テキストファイル: 206d. です。インターフェイス
     は *note io: 83. モジュールで定義されています。ファイルオブジェクト
     を作る標準的な方法は *note open(): 316. 関数を使うことです。

file-like object

     *note file object: 13db. と同義です。

filesystem encoding and error handler

     Encoding and error handler used by Python to decode bytes from the
     operating system and encode Unicode to the operating system.

     ファイルシステムのエンコーディングでは、すべてが 128 バイト以下に正
     常にデコードされることが保証されなくてはなりません。ファイルシステ
     ムのエンコーディングでこれが保証されなかった場合は、API 関数が
     *note UnicodeError: 462. を送出することがあります。

     The *note sys.getfilesystemencoding(): e53. and *note
     sys.getfilesystemencodeerrors(): ee2. functions can be used to get
     the filesystem encoding and error handler.

     term:‘ファイルシステムのエンコーディングとエラーハンドラ
     <filesystem encoding and error handler>’ は、Pythonの開始時に
     :c:func:‘PyConfig_Read’ 関数により設定されます。 *note PyConfig:
     3f7. のメンバー *note filesystem_encoding: 41b. と *note
     filesystem_errors: 41c. を参照してください。

     See also the *note locale encoding: 54a.

finder

     (ファインダ) インポートされているモジュールの *note loader: 1a28. の
     発見を試行するオブジェクトです。

     There are two types of finder: *note meta path finders: 127c. for
     use with *note sys.meta_path: f27, and *note path entry finders:
     127d. for use with *note sys.path_hooks: 1225.

     See *note ファインダーとローダー: 2446. and *note importlib: 7b.
     for much more detail.

floor division

     (切り捨て除算) 一番近い整数に切り捨てる数学的除算。 切り捨て除算演
     算子は ‘//’ です。 例えば、 ‘11 // 4’ は ‘2’ になり、それとは対称に
     浮動小数点数の真の除算では ‘2.75’ が 返ってきます。 ‘(-11) // 4’ は
     ‘-2.75’ を '小さい方に' 丸める (訳注: 負の無限大への丸めを行う) の
     で ‘-3’ になることに注意してください。 PEP 238(18) を参照してくださ
     い。

free threading

     A threading model where multiple threads can run Python bytecode
     simultaneously within the same interpreter.  This is in contrast to
     the *note global interpreter lock: 474. which allows only one
     thread to execute Python bytecode at a time.  See PEP 703(19).

free-threaded build

     A build of *note CPython: 905. that supports *note free threading:
     1f4, configured using the *note -disable-gil: 499. option before
     compilation.

     See *note Python support for free threading: 2619.

free variable

     Formally, as defined in the *note language execution model: 2425, a
     free variable is any variable used in a namespace which is not a
     local variable in that namespace.  See *note closure variable:
     1893. for an example.  Pragmatically, due to the name of the *note
     codeobject.co_freevars: 2347. attribute, the term is also sometimes
     used as a synonym for *note closure variable: 1893.

関数

     (関数) 呼び出し側に値を返す一連の文のことです。関数には0以上の
     *note 実引数: 67b. を渡すことが出来ます。実体の実行時に引数を使用す
     ることが出来ます。 *note 仮引数: 234b.、*note メソッド: 1864.、
     *note 関数定義: 2018. を参照してください。

function annotation

     (関数アノテーション) 関数のパラメータや返り値の *note annotation:
     15c. です。

     関数アノテーションは、通常は *note 型ヒント: 23cb. のために使われま
     す: 例えば、この関数は 2 つの *note int: 19b. 型の引数を取ると期待
     され、また *note int: 19b. 型の返り値を持つと期待されています。

          def sum_two_numbers(a: int, b: int) -> int:
             return a + b

     関数アノテーションの文法は *note 関数定義: 2018. の節で解説されてい
     ます。

     機能の説明がある *note variable annotation: f51, PEP 484(20),を参照
     してください。また、アノテーションを利用するベストプラクティスとし
     て *note Annotations Best Practices: 9d9. も参照してください。

__future__

     ‘from __future__ import <feature>’ という *note future 文: 45d. は
     、コンパイラーに将来の Python リリースで標準となる構文や意味を使用
     して現在のモジュールをコンパイルするよう指示します。 *note
     __future__: 0. モジュールでは、 'feature' のとりうる値をドキュメン
     ト化しています。このモジュールをインポートし、その変数を評価するこ
     とで、新機能が最初に言語に追加されたのはいつかや、いつデフォルトに
     なるか (またはなったか) を見ることができます:

          >>> import __future__
          >>> __future__.division
          _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)

garbage collection

     (ガベージコレクション) これ以降使われることのないメモリを解放する処
     理です。 Pythonは、参照カウントと、循環参照を検出し破壊する循環ガベ
     ージコレクタを使ってガベージコレクションを行います。 ガベージコレク
     タは *note gc: 64. モジュールを使って操作できます。

ジェネレータ

     (ジェネレータ) *note generator iterator: dd9. を返す関数です。 通常
     の関数に似ていますが、 *note yield: bc2. 式を持つ点で異なります。
     *note yield: bc2. 式は、 for ループで使用できたり、*note next():
     9d8. 関数で値を 1 つずつ取り出したりできる、値の並びを生成するのに
     使用されます。

     通常はジェネレータ関数を指しますが、文脈によっては 'ジェネレータイ
     テレータ' を指す場合があります。 意図された意味が明らかでない場合、
     明瞭化のために完全な単語を使用します。

generator iterator

     (ジェネレータイテレータ) *note generator: 126c. 関数で生成されるオ
     ブジェクトです。

     Each *note yield: bc2. temporarily suspends processing, remembering
     the execution state (including local variables and pending
     try-statements).  When the 'generator iterator' resumes, it picks
     up where it left off (in contrast to functions which start fresh on
     every invocation).

generator expression

     (ジェネレータ式) iterator を返す *note 式: 23cf. です。 普通の式に
     、ループ変数を定義する ‘for’ 節、範囲、そして省略可能な ‘if’ 節がつ
     づいているように見えます。 こうして構成された式は、外側の関数に向け
     て値を生成します:

          >>> sum(i*i for i in range(10))         # sum of squares 0, 1, 4, ... 81
          285

generic function

     (ジェネリック関数) 異なる型に対し同じ操作をする関数群から構成される
     関数です。呼び出し時にどの実装を用いるかはディスパッチアルゴリズム
     により決定されます。

     *note single dispatch: be3.、*note functools.singledispatch(): 84b.
     デコレータ、 PEP 443(21) を参照してください。

generic type

     A *note type: 1cfe. that can be parameterized; typically a *note
     container class: 23d4. such as *note list: 24d. or *note dict: 183.
     Used for *note type hints: 23cb. and *note annotations: 15c.

     For more details, see *note generic alias types: 8c1, PEP 483(22),
     PEP 484(23), PEP 585(24), and the *note typing: 10a. module.

GIL

     *note global interpreter lock: 474. を参照してください。

global interpreter lock

     (グローバルインタプリタロック) *note CPython: 905. インタプリタが利
     用している、一度に Python の *note バイトコード: 4aa. を実行するス
     レッドは一つだけであることを保証する仕組みです。これにより (*note
     dict: 183. などの重要な組み込み型を含む) オブジェクトモデルが同時ア
     クセスに対して暗黙的に安全になるので、 CPython の実装がシンプルにな
     ります。インタプリタ全体をロックすることで、マルチプロセッサマシン
     が生じる並列化のコストと引き換えに、インタプリタを簡単にマルチスレ
     ッド化できるようになります。

     ただし、標準あるいは外部のいくつかの拡張モジュールは、圧縮やハッシ
     ュ計算などの計算の重い処理をするときに GIL を解除するように設計され
     ています。また、I/O 処理をする場合 GIL は常に解除されます。

     As of Python 3.13, the GIL can be disabled using the *note
     -disable-gil: 499. build configuration.  After building Python with
     this option, code must be run with *note -X gil=0: 16f. or after
     setting the *note PYTHON_GIL=0: 49a. environment variable.  This
     feature enables improved performance for multi-threaded
     applications and makes it easier to use multi-core CPUs
     efficiently.  For more details, see PEP 703(25).

     In prior versions of Python's C API, a function might declare that
     it requires the GIL to be held in order to use it.  This refers to
     having an *note attached thread state: 4ed1.

global state

     Data that is accessible throughout a program, such as module-level
     variables, class variables, or C static variables in *note
     extension modules: 2251.  In multi-threaded programs, global state
     shared between threads typically requires synchronization to avoid
     *note race conditions: 5985. and *note data races: 5986.

hash-based pyc

     (ハッシュベース pyc ファイル) 正当性を判別するために、対応するソー
     スファイルの最終更新時刻ではなくハッシュ値を使用するバイトコードの
     キャッシュファイルです。*note キャッシュされたバイトコードの無効化:
     802. を参照してください。

hashable

     An object is 'hashable' if it has a hash value which never changes
     during its lifetime (it needs a *note __hash__(): cf3. method), and
     can be compared to other objects (it needs an *note __eq__(): cf2.
     method).  Hashable objects which compare equal must have the same
     hash value.

     ハッシュ可能なオブジェクトは辞書のキーや集合のメンバーとして使えま
     す。辞書や集合のデータ構造は内部でハッシュ値を使っているからです。

     Python のイミュータブルな組み込みオブジェクトは、ほとんどがハッシュ
     可能です。(リストや辞書のような) ミュータブルなコンテナはハッシュ不
     可能です。(タプルや frozenset のような) イミュータブルなコンテナは
     、要素がハッシュ可能であるときのみハッシュ可能です。 ユーザー定義の
     クラスのインスタンスであるようなオブジェクトはデフォルトでハッシュ
     可能です。 それらは全て (自身を除いて) 比較結果は非等価であり、ハッ
     シュ値は *note id(): 163c. より得られます。

IDLE

     Python の統合開発環境 (Integrated DeveLopment Environment)及び学習
     環境 (Learning Environment) です。*note IDLE -- Python
     のエディタとシェル: 1217. は Python の標準的な配布に同梱されている
     基本的な機能のエディタとインタプリタ環境です。

永続オブジェクト (immortal)

     'Immortal objects' are a CPython implementation detail introduced
     in PEP 683(26).

     If an object is immortal, its *note reference count: 4ec9. is never
     modified, and therefore it is never deallocated while the
     interpreter is running.  For example, *note True: e07. and *note
     None: 885. are immortal in CPython.

     Immortal objects can be identified via *note sys._is_immortal():
     28f, or via *note PyUnstable_IsImmortal(): 3c4. in the C API.

immutable

     An object with a fixed value.  Immutable objects include numbers,
     strings and tuples.  Such an object cannot be altered.  A new
     object has to be created if a different value has to be stored.
     They play an important role in places where a constant hash value
     is needed, for example as a key in a dictionary.  Immutable objects
     are inherently *note thread-safe: 5992. because their state cannot
     be modified after creation, eliminating concerns about improperly
     synchronized *note concurrent modification: 598c.

import path

     *note path based finder: 244d. が import するモジュールを検索する場
     所 (または *note path entry: 2458.) のリスト。 import 中、このリス
     トは通常 *note sys.path: 3e4. から来ますが、サブパッケージの場合は
     親パッケージの ‘__path__’ 属性からも来ます。

importing

     あるモジュールの Python コードが別のモジュールの Python コードで使
     えるようにする処理です。

importer

     モジュールを探してロードするオブジェクト。 *note finder: 236a. と
     *note loader: 1a28. のどちらでもあるオブジェクト。

index

     A numeric value that represents the position of an element in a
     *note sequence: 716.

     In Python, indexing starts at zero.  For example, ‘things[0]’ names
     the 'first' element of ‘things’; ‘things[1]’ names the second one.

     In some contexts, Python allows negative indexes for counting from
     the end of a sequence, and indexing using *note slices: 24ae.

     See also *note subscript: 599d.

interactive

     Python has an interactive interpreter which means you can enter
     statements and expressions at the interpreter prompt, immediately
     execute them and see their results.  Just launch ‘python’ with no
     arguments (possibly by selecting it from your computer's main
     menu).  It is a very powerful way to test out new ideas or inspect
     modules and packages (remember ‘help(x)’).  For more on interactive
     mode, see *note 対話モード: 494.

interpreted

     Python はインタプリタ形式の言語であり、コンパイラ言語の対極に位置し
     ます。 (バイトコードコンパイラがあるために、この区別は曖昧ですが。)
     ここでのインタプリタ言語とは、ソースコードのファイルを、まず実行可
     能形式にしてから実行させるといった操作なしに、直接実行できることを
     意味します。インタプリタ形式の言語は通常、コンパイラ形式の言語より
     も開発／デバッグのサイクルは短いものの、プログラムの実行は一般に遅
     いです。 *note 対話的: 1b5. も参照してください。

interpreter shutdown

     Python インタープリターはシャットダウンを要請された時に、モジュール
     やすべてのクリティカルな内部構造をなどの、すべての確保したリソース
     を段階的に開放する、特別なフェーズに入ります。 このフェーズは *note
     ガベージコレクタ: 17d8. を複数回呼び出します。 これによりユーザー定
     義のデストラクターや weakref コールバックが呼び出されることがありま
     す。 シャットダウンフェーズ中に実行されるコードは、それが依存するリ
     ソースがすでに機能しない(よくある例はライブラリーモジュールや
     warning 機構です) ために様々な例外に直面します。

     インタープリタがシャットダウンする主な理由は ‘__main__’ モジュール
     や実行されていたスクリプトの実行が終了したことです。

iterable

     An object capable of returning its members one at a time.  Examples
     of iterables include all sequence types (such as *note list: 24d,
     *note str: 169, and *note tuple: 614.) and some non-sequence types
     like *note dict: 183, *note file objects: 13db, and objects of any
     classes you define with an *note __iter__(): e69. method or with a
     *note __getitem__(): 588. method that implements *note sequence:
     716. semantics.

     反復可能オブジェクトは *note for: 34a. ループ内やその他多くのシーケ
     ンス (訳注: ここでのシーケンスとは、シーケンス型ではなくただの列と
     いう意味)が必要となる状況 (*note zip(): 1a0, *note map(): 19f, ...)
     で利用できます。 反復可能オブジェクトを組み込み関数 *note iter():
     9d7. の引数として渡すと、 オブジェクトに対するイテレータを返します
     。 このイテレータは一連の値を引き渡す際に便利です。 通常は反復可能
     オブジェクトを使う際には、 *note iter(): 9d7. を呼んだりイテレータ
     オブジェクトを自分で操作する必要はありません。 *note for: 34a. 文で
     はこの操作を自動的に行い、一時的な無名の変数を作成してループを回し
     ている間イテレータを保持します。 *note イテレータ: 4c8. 、 *note
     シーケンス: 716. 、 *note ジェネレータ: 126c. も参照してください。

iterator

     データの流れを表現するオブジェクトです。イテレータの *note
     __next__(): 14e5. メソッドを繰り返し呼び出す (または組み込み関数
     *note next(): 9d8. に渡す) と、流れの中の要素を一つずつ返します。デ
     ータがなくなると、代わりに *note StopIteration: df5. 例外を送出しま
     す。その時点で、イテレータオブジェクトは尽きており、それ以降は
     ‘__next__()’ を何度呼んでも *note StopIteration: df5. を送出します
     。イテレータは、そのイテレータオブジェクト自体を返す *note
     __iter__(): 20ad. メソッドを実装しなければならないので、イテレータ
     は他の iterable を受理するほとんどの場所で利用できます。はっきりと
     した例外は複数の反復を行うようなコードです。 (*note list: 24d. のよ
     うな) コンテナオブジェクトは、自身を *note iter(): 9d7. 関数にオブ
     ジェクトに渡したり *note for: 34a. ループ内で使うたびに、新たな未使
     用のイテレータを生成します。これをイテレータで行おうとすると、前回
     のイテレーションで使用済みの同じイテレータオブジェクトを単純に返す
     ため、空のコンテナのようになってしまいます。

     詳細な情報は *note イテレータ型: 25d7. にあります。

     'CPython 実装の詳細:' CPython does not consistently apply the
     requirement that an iterator define *note __iter__(): 20ad.  And
     also please note that *note free-threaded: 1f4. CPython does not
     guarantee *note thread-safe: 5992. behavior of iterator operations.

キー

     A value that identifies an entry in a *note mapping: 13d3.  See
     also *note subscript: 599d.

key function

     (キー関数) キー関数、あるいは照合関数とは、ソートや順序比較のための
     値を返す呼び出し可能オブジェクト(callable)です。例えば、 *note
     locale.strxfrm(): 17bd. をキー関数に使えば、ロケール依存のソートの
     慣習にのっとったソートキーを返します。

     Python の多くのツールはキー関数を受け取り要素の並び順やグループ化を
     管理します。 *note min(): 110b, *note max(): 110c, *note sorted():
     dc7, *note list.sort(): dc8, *note heapq.merge(): 1005, *note
     heapq.nsmallest(): 29a6, *note heapq.nlargest(): 29a5, *note
     itertools.groupby(): 2ba5. 等があります。

     There are several ways to create a key function.  For example.  the
     *note str.casefold(): fd6. method can serve as a key function for
     case insensitive sorts.  Alternatively, a key function can be built
     from a *note lambda: 14b5. expression such as ‘lambda r: (r[0],
     r[2])’.  Also, *note operator.attrgetter(): 1033, *note
     operator.itemgetter(): c57, and *note operator.methodcaller():
     1034. are three key function constructors.  See the *note Sorting
     HOW TO: 13f3. for examples of how to create and use key functions.

keyword argument

     *note 実引数: 67b. を参照してください。

lambda

     (ラムダ) 無名のインライン関数で、関数が呼び出されたときに評価される
     1 つの *note 式: 23cf. を含みます。ラムダ関数を作る構文は ‘lambda
     [parameters]: expression’ です。

LBYL

     「ころばぬ先の杖 (look before you leap)」 の略です。このコーディン
     グスタイルでは、呼び出しや検索を行う前に、明示的に前提条件
     (pre-condition) 判定を行います。 *note EAFP: 3079. アプローチと対照
     的で、 *note if: 181. 文がたくさん使われるのが特徴的です。

     In a multi-threaded environment, the LBYL approach can risk
     introducing a *note race condition: 5985. between "the looking" and
     "the leaping".  For example, the code, ‘if key in mapping: return
     mapping[key]’ can fail if another thread removes 'key' from
     'mapping' after the test, but before the lookup.  This issue can be
     solved with *note locks: 598f. or by using the *note EAFP: 3079.
     approach.  See also *note thread-safe: 5992.

lexical analyzer

     Formal name for the 'tokenizer'; see *note token: 2288.

list

     A built-in Python *note sequence: 716.  Despite its name it is more
     akin to an array in other languages than to a linked list since
     access to elements is 'O'(1).

list comprehension

     (リスト内包表記) シーケンス中の全てあるいは一部の要素を処理して、そ
     の結果からなるリストを返す、コンパクトな方法です。 ‘result =
     ['{:#04x}'.format(x) for x in range(256) if x % 2 == 0]’ とすると、
     0 から 255 までの偶数を 16進数表記 (0x..)  した文字列からなるリスト
     を生成します。 *note if: 181. 節はオプションです。 *note if: 181. 節
     がない場合、 ‘range(256)’ の全ての要素が処理されます。

lock

     A *note synchronization primitive: 5990. that allows only one
     thread at a time to access a shared resource.  A thread must
     acquire a lock before accessing the protected resource and release
     it afterward.  If a thread attempts to acquire a lock that is
     already held by another thread, it will block until the lock
     becomes available.  Python's *note threading: f3. module provides
     *note Lock: 19f4. (a basic lock) and *note RLock: 32e. (a *note
     reentrant: 5994. lock).  Locks are used to prevent *note race
     conditions: 5985. and ensure *note thread-safe: 5992. access to
     shared data.  Alternative design patterns to locks exist such as
     queues, producer/consumer patterns, and thread-local state.  See
     also *note deadlock: 5993, and *note reentrant: 5994.

lock-free

     An operation that does not acquire any *note lock: 598f. and uses
     atomic CPU instructions to ensure correctness.  Lock-free
     operations can execute concurrently without blocking each other and
     cannot be blocked by operations that hold locks.  In *note
     free-threaded: 1f4. Python, built-in types like *note dict: 183.
     and *note list: 24d. provide lock-free read operations, which means
     other threads may observe intermediate states during multi-step
     modifications even when those modifications hold the *note
     per-object lock: 2616.

loader

     An object that loads a module.  It must define the ‘exec_module()’
     and ‘create_module()’ methods to implement the *note Loader: 10c7.
     interface.  A loader is typically returned by a *note finder: 236a.
     See also:

        * *note ファインダーとローダー: 2446.

        * *note importlib.abc.Loader: 10c7.

        * PEP 302(27)

ロケールエンコーディング

     On Unix, it is the encoding of the LC_CTYPE locale.  It can be set
     with *note locale.setlocale(locale.LC_CTYPE, new_locale): 328.

     On Windows, it is the ANSI code page (ex: ‘"cp1252"’).

     On Android and VxWorks, Python uses ‘"utf-8"’ as the locale
     encoding.

     *note locale.getencoding(): 329. can be used to get the locale
     encoding.

     See also the *note filesystem encoding and error handler: 75d.

magic method

     *note special method: 1c60. のくだけた同義語です。

mapping

     (マッピング) 任意のキー探索をサポートしていて、 *note
     collections.abc.Mapping: ac7. か *note
     collections.abc.MutableMapping: 12c0. の *note 抽象基底クラス: a78.
     で指定されたメソッドを実装しているコンテナオブジェクトです。例えば
     、 *note dict: 183, *note collections.defaultdict: 13d4, *note
     collections.OrderedDict: 7f3, *note collections.Counter: 12a3. など
     です。

meta path finder

     *note sys.meta_path: f27. を検索して得られた *note finder: 236a.
     meta path finder は *note path entry finder: 127d. と関係はあります
     が、別物です。

     meta path finder が実装するメソッドについては *note
     importlib.abc.MetaPathFinder: a6e. を参照してください。

metaclass

     (メタクラス) クラスのクラスです。クラス定義は、クラス名、クラスの辞
     書と、基底クラスのリストを作ります。メタクラスは、それら 3 つを引数
     として受け取り、クラスを作る責任を負います。ほとんどのオブジェクト
     指向言語は(訳注:メタクラスの)デフォルトの実装を提供しています。
     Python が特別なのはカスタムのメタクラスを作成できる点です。ほとんど
     のユーザーに取って、メタクラスは全く必要のないものです。しかし、一
     部の場面では、メタクラスは強力でエレガントな方法を提供します。たと
     えば属性アクセスのログを取ったり、スレッドセーフ性を追加したり、オ
     ブジェクトの生成を追跡したり、シングルトンを実装するなど、多くの場
     面で利用されます。

     詳細は *note メタクラス: 23be. を参照してください。

メソッド

     (メソッド) クラス本体の中で定義された関数。そのクラスのインスタンス
     の属性として呼び出された場合、メソッドはインスタンスオブジェクトを
     第一 *note 引数: 67b. として受け取ります (この第一引数は通常 ‘self’
     と呼ばれます)。 *note 関数: 24b7. と *note ネストされたスコープ:
     238d. も参照してください。

method resolution order

     Method Resolution Order is the order in which base classes are
     searched for a member during lookup.  See *note The Python 2.3
     Method Resolution Order: 16c3. for details of the algorithm used by
     the Python interpreter since the 2.3 release.

module

     (モジュール) Python コードの組織単位としてはたらくオブジェクトです
     。モジュールは任意の Python オブジェクトを含む名前空間を持ちます。
     モジュールは *note importing: 243c. の処理によって Python に読み込
     まれます。

     *note パッケージ: 233. を参照してください。

module spec

     モジュールをロードするのに使われるインポート関連の情報を含む名前空
     間です。 *note importlib.machinery.ModuleSpec: 226c. のインスタンス
     です。

     See also *note Module specs: 2366.

MRO

     *note method resolution order: 25df. を参照してください。

mutable

     An *note object: 59a0. with state that is allowed to change during
     the course of the program.  In multi-threaded programs, mutable
     objects that are shared between threads require careful
     synchronization to avoid *note race conditions: 5985.  See also
     *note immutable: 15b9, *note thread-safe: 5992, and *note
     concurrent modification: 598c.

named tuple

     "名前付きタプル" という用語は、タプルを継承していて、インデックスが
     付く要素に対し属性を使ってのアクセスもできる任意の型やクラスに応用
     されています。 その型やクラスは他の機能も持っていることもあります。

     *note time.localtime(): 1712. や *note os.stat(): 26d. の返り値を含
     むいくつかの組み込み型は名前付きタプルです。 他の例は *note
     sys.float_info: 1dcf. です:

          >>> sys.float_info[1]                   # indexed access
          1024
          >>> sys.float_info.max_exp              # named field access
          1024
          >>> isinstance(sys.float_info, tuple)   # kind of tuple
          True

     Some named tuples are built-in types (such as the above examples).
     Alternatively, a named tuple can be created from a regular class
     definition that inherits from *note tuple: 614. and that defines
     named fields.  Such a class can be written by hand, or it can be
     created by inheriting *note typing.NamedTuple: 331, or with the
     factory function *note collections.namedtuple(): 4e0.  The latter
     techniques also add some extra methods that may not be found in
     hand-written or built-in named tuples.

namespace

     (名前空間) 変数が格納される場所です。名前空間は辞書として実装されま
     す。名前空間にはオブジェクトの (メソッドの) 入れ子になったものだけ
     でなく、局所的なもの、大域的なもの、そして組み込みのものがあります
     。名前空間は名前の衝突を防ぐことによってモジュール性をサポートする
     。例えば関数 *note builtins.open: 316. と *note os.open(): f92. は
     名前空間で区別されています。また、どのモジュールが関数を実装してい
     るか明示することによって名前空間は可読性と保守性を支援します。例え
     ば、*note random.seed(): 148b. や *note itertools.islice(): d43. と
     書くと、それぞれモジュール *note random: bd. や *note itertools:
     85. で実装されていることが明らかです。

namespace package

     A *note package: 233. which serves only as a container for
     subpackages.  Namespace packages may have no physical
     representation, and specifically are not like a *note regular
     package: 2440. because they have no ‘__init__.py’ file.

     Namespace packages allow several individually installable packages
     to have a common parent package.  Otherwise, it is recommended to
     use a *note regular package: 2440.

     For more information, see PEP 420(28) and *note 名前空間パッケージ:
     2442.

     *note module: 19de. を参照してください。

native code

     Code that is compiled to machine instructions and runs directly on
     the processor, as opposed to code that is interpreted or runs in a
     virtual machine.  In the context of Python, native code typically
     refers to C, C++, Rust or Fortran code in *note extension modules:
     2251. that can be called from Python.  See also *note extension
     module: 2251.

nested scope

     (ネストされたスコープ) 外側で定義されている変数を参照する機能です。
     例えば、ある関数が別の関数の中で定義されている場合、内側の関数は外
     側の関数中の変数を参照できます。ネストされたスコープはデフォルトで
     は変数の参照だけができ、変数の代入はできないので注意してください。
     ローカル変数は、最も内側のスコープで変数を読み書きします。同様に、
     グローバル変数を使うとグローバル名前空間の値を読み書きします。
     *note nonlocal: 14bf. で外側の変数に書き込めます。

new-style class

     Old name for the flavor of classes now used for all class objects.
     In earlier Python versions, only new-style classes could use
     Python's newer, versatile features like *note __slots__: 1704,
     descriptors, properties, *note __getattribute__(): dcb, class
     methods, and static methods.

non-deterministic

     Behavior where the outcome of a program can vary between executions
     with the same inputs.  In multi-threaded programs,
     non-deterministic behavior often results from *note race
     conditions: 5985. where the relative timing or interleaving of
     threads affects the result.  Proper synchronization using *note
     locks: 598f. and other *note synchronization primitives: 5990.
     helps ensure deterministic behavior.

object

     (オブジェクト) 状態 (属性や値) と定義された振る舞い (メソッド) をも
     つ全てのデータ。もしくは、全ての *note 新スタイルクラス: 2d0a. の究
     極の基底クラスのこと。

optimized scope

     A scope where target local variable names are reliably known to the
     compiler when the code is compiled, allowing optimization of read
     and write access to these names.  The local namespaces for
     functions, generators, coroutines, comprehensions, and generator
     expressions are optimized in this fashion.  Note: most interpreter
     optimizations are applied to all scopes, only those relying on a
     known set of local and nonlocal variable names are restricted to
     optimized scopes.

optional module

     An *note extension module: 2251. that is part of the *note standard
     library: 59a1, but may be absent in some builds of *note CPython:
     905, usually due to missing third-party libraries or because the
     module is not available for a given platform.

     See *note オプションのモジュールの要件: 2158. for a list of
     optional modules that require third-party libraries.

package

     (パッケージ) サブモジュールや再帰的にサブパッケージを含むことの出来
     る *note module: 19de. のことです。専門的には、パッケージは
     ‘__path__’ 属性を持つ Python オブジェクトです。

     *note regular package: 2440. と *note namespace package: 2b2. を参
     照してください。

parallelism

     Executing multiple operations at the same time (e.g.  on multiple
     CPU cores).  In Python builds with the *note global interpreter
     lock (GIL): 474, only one thread runs Python bytecode at a time, so
     taking advantage of multiple CPU cores typically involves multiple
     processes (e.g.  *note multiprocessing: 98.) or native extensions
     that release the GIL. In *note free-threaded: 1f4. Python, multiple
     Python threads can run Python code simultaneously on different
     cores.

parameter

     (仮引数) 名前付の実体で *note 関数: 24b7. (や *note メソッド: 1864.
     ) の定義において関数が受ける *note 実引数: 67b. を指定します。仮引
     数には5種類あります:

        * '位置またはキーワード': *note 位置: 67b. であるいは *note
          キーワード引数: 67b. として渡すことができる引数を指定します。
          これはたとえば以下の 'foo' や 'bar' のように、デフォルトの仮引
          数の種類です:

               def func(foo, bar=None): ...

        * '位置専用': 位置によってのみ与えられる引数を指定します。位置専
          用の引数は関数定義の引数のリストの中でそれらの後ろに ‘/’ を含
          めることで定義できます。例えば下記の 'posonly1' と 'posonly2'
          は位置専用引数になります:

               def func(posonly1, posonly2, /, positional_or_keyword): ...

        * 'キーワード専用': キーワードによってのみ与えられる引数を指定し
          ます。キーワード専用の引数を定義できる場所は、例えば以下の
          'kw_only1' や 'kw_only2' のように、関数定義の仮引数リストに含
          めた可変長位置引数または裸の ‘*’ の後です:

               def func(arg, *, kw_only1, kw_only2): ...

        * '可変長位置': (他の仮引数で既に受けられた任意の位置引数に加え
          て) 任意の個数の位置引数が与えられることを指定します。このよう
          な仮引数は、以下の 'args' のように仮引数名の前に ‘*’ をつける
          ことで定義できます:

               def func(*args, **kwargs): ...

        * '可変長キーワード': (他の仮引数で既に受けられた任意のキーワー
          ド引数に加えて) 任意の個数のキーワード引数が与えられることを指
          定します。このような仮引数は、上の例の 'kwargs' のように仮引数
          名の前に ‘**’ をつけることで定義できます。

     仮引数はオプションと必須の引数のどちらも指定でき、オプションの引数
     にはデフォルト値も指定できます。

     *note 仮引数: 234b. 、FAQ の *note 実引数と仮引数の違いは何ですか?:
     58be. 、*note inspect.Parameter: 4e4. クラス、 *note 関数定義:
     2018. セクション、 PEP 362(29) を参照してください。

per-object lock

     A *note lock: 598f. associated with an individual object instance
     rather than a global lock shared across all objects.  In *note
     free-threaded: 1f4. Python, built-in types like *note dict: 183.
     and *note list: 24d. use per-object locks to allow concurrent
     operations on different objects while serializing operations on the
     same object.  Operations that hold the per-object lock prevent
     other locking operations on the same object from proceeding, but do
     not block *note lock-free: 2617. operations.

path entry

     *note path based finder: 244d. が import するモジュールを探す *note
     import path: 244a. 上の1つの場所です。

path entry finder

     *note sys.path_hooks: 1225. にある callable (つまり *note path
     entry hook: 245a.) が返した *note finder: 236a. です。与えられた
     *note path entry: 2458. にあるモジュールを見つける方法を知っていま
     す。

     パスエントリーファインダが実装するメソッドについては *note
     importlib.abc.PathEntryFinder: a6f. を参照してください。

path entry hook

     A callable on the *note sys.path_hooks: 1225. list which returns a
     *note path entry finder: 127d. if it knows how to find modules on a
     specific *note path entry: 2458.

path based finder

     デフォルトの *note meta path finder: 127c. の1つは、モジュールの
     *note import path: 244a. を検索します。

path-like object

     (path-like オブジェクト) ファイルシステムパスを表します。 path-like
     オブジェクトは、パスを表す *note str: 169. オブジェクトや *note
     bytes: 192. オブジェクト、または *note os.PathLike: e4b. プロトコル
     を実装したオブジェクトのどれかです。 *note os.PathLike: e4b. プロト
     コルをサポートしているオブジェクトは *note os.fspath(): e4d. を呼び
     出すことで *note str: 169. または *note bytes: 192. のファイルシス
     テムパスに変換できます。 *note os.fsdecode(): e4e. と *note
     os.fsencode(): e4f. はそれぞれ *note str: 169. あるいは *note
     bytes: 192. になるのを保証するのに使えます。 PEP 519(30) で導入され
     ました。

PEP

     Python Enhancement Proposal。PEP は、Python コミュニティに対して情
     報を提供する、あるいは Python の新機能やその過程や環境について記述
     する設計文書です。 PEP は、機能についての簡潔な技術的仕様と提案する
     機能の論拠 (理論) を伝えるべきです。

     PEP は、新機能の提案にかかる、コミュニティによる問題提起の集積と
     Python になされる設計決断の文書化のための最上位の機構となることを意
     図しています。PEP の著者にはコミュニティ内の合意形成を行うこと、反
     対意見を文書化することの責務があります。

     PEP 1(31) を参照してください。

portion

     PEP 420(32) で定義されている、namespace package に属する、複数のフ
     ァイルが (zipファイルに格納されている場合もある) 1つのディレクトリ
     に格納されたもの。

位置引数 (positional argument)

     *note 実引数: 67b. を参照してください。

provisional API

     (暫定 API) 標準ライブラリの後方互換性保証から計画的に除外されたもの
     です。そのようなインターフェースへの大きな変更は、暫定であるとされ
     ている間は期待されていませんが、コア開発者によって必要とみなされれ
     ば、後方非互換な変更 (インターフェースの削除まで含まれる) が行われ
     えます。このような変更はむやみに行われるものではありません - これは
     API を組み込む前には見落とされていた重大な欠陥が露呈したときにのみ
     行われます。

     暫定 API についても、後方互換性のない変更は「最終手段」とみなされて
     います。問題点が判明した場合でも後方互換な解決策を探すべきです。

     このプロセスにより、標準ライブラリは問題となるデザインエラーに長い
     間閉じ込められることなく、時代を超えて進化を続けられます。詳細は
     PEP 411(33) を参照してください。

provisional package

     *note provisional API: 3d1. を参照してください。

Python 3000

     Python 3.x リリースラインのニックネームです。(Python 3 が遠い将来の
     話だった頃に作られた言葉です。) "Py3k" と略されることもあります。

Pythonic

     他の言語で一般的な考え方で書かれたコードではなく、Python の特に一般
     的なイディオムに従った考え方やコード片。例えば、Python の一般的なイ
     ディオムでは *note for: 34a. 文を使ってイテラブルのすべての要素に渡
     ってループします。他の多くの言語にはこの仕組みはないので、Python に
     慣れていない人は代わりに数値のカウンターを使うかもしれません:

          for i in range(len(food)):
              print(food[i])

     これに対し、きれいな Pythonic な方法は:

          for piece in food:
              print(piece)

qualified name

     (修飾名) モジュールのグローバルスコープから、そのモジュールで定義さ
     れたクラス、関数、メソッドへの、 "パス" を表すドット名表記です。
     PEP 3155(34) で定義されています。トップレベルの関数やクラスでは、修
     飾名はオブジェクトの名前と同じです:

          >>> class C:
          ...     class D:
          ...         def meth(self):
          ...             pass
          ...
          >>> C.__qualname__
          'C'
          >>> C.D.__qualname__
          'C.D'
          >>> C.D.meth.__qualname__
          'C.D.meth'

     モジュールへの参照で使われると、'完全修飾名 (fully qualified name)'
     はすべての親パッケージを含む全体のドット名表記、例えば
     ‘email.mime.text’ を意味します:

          >>> import email.mime.text
          >>> email.mime.text.__name__
          'email.mime.text'

race condition

     A condition of a program where the behavior depends on the relative
     timing or ordering of events, particularly in multi-threaded
     programs.  Race conditions can lead to *note non-deterministic:
     598e. behavior and bugs that are difficult to reproduce.  A *note
     data race: 5986. is a specific type of race condition involving
     unsynchronized access to shared memory.  The *note LBYL: 5997.
     coding style is particularly susceptible to race conditions in
     multi-threaded code.  Using *note locks: 598f. and other *note
     synchronization primitives: 5990. helps prevent race conditions.

reference count

     (参照カウント) あるオブジェクトに対する参照の数。参照カウントが0に
     なったとき、そのオブジェクトは破棄されます。 *note 永続: 290. であ
     り、参照カウントが決して変更されないために割り当てが解除されないオ
     ブジェクトもあります。参照カウントは通常は Python のコード上には現
     れませんが、 *note CPython: 905. 実装の重要な要素です。プログラマー
     は、 任意のオブジェクトの参照カウントを知るために *note
     sys.getrefcount(): 2ce. 関数を呼び出すことが出来ます。

     In *note CPython: 905, reference counts are not considered to be
     stable or well-defined values; the number of references to an
     object, and how that number is affected by Python code, may be
     different between versions.

regular package

     伝統的な、 ‘__init__.py’ ファイルを含むディレクトリとしての *note
     package: 233.。

     *note namespace package: 2b2. を参照してください。

reentrant

     A property of a function or *note lock: 598f. that allows it to be
     called or acquired multiple times by the same thread without
     causing errors or a *note deadlock: 5993.

     For functions, reentrancy means the function can be safely called
     again before a previous invocation has completed, which is
     important when functions may be called recursively or from signal
     handlers.  Thread-unsafe functions may be *note non-deterministic:
     598e. if they're called reentrantly in a multithreaded program.

     For locks, Python's *note threading.RLock: 32e. (reentrant lock) is
     reentrant, meaning a thread that already holds the lock can acquire
     it again without blocking.  In contrast, *note threading.Lock:
     19f4. is not reentrant - attempting to acquire it twice from the
     same thread will cause a deadlock.

     See also *note lock: 598f. and *note deadlock: 5993.

REPL

     "read–eval–print loop" の頭字語で、 *note 対話型: 1b5. インタープリ
     ターシェルの別名。

__slots__

     クラス内での宣言で、インスタンス属性の領域をあらかじめ定義しておき
     、インスタンス辞書を排除することで、メモリを節約します。これはよく
     使われるテクニックですが、正しく扱うには少しトリッキーなので、稀な
     ケース、例えばメモリが死活問題となるアプリケーションでインスタンス
     が大量に存在する、といったときを除き、使わないのがベストです。

sequence

     An *note iterable: 12f1. which supports efficient element access
     using integer indices via the *note __getitem__(): 588. special
     method and defines a *note __len__(): 178f. method that returns the
     length of the sequence.  Some built-in sequence types are *note
     list: 24d, *note str: 169, *note tuple: 614, and *note bytes: 192.
     Note that *note dict: 183. also supports *note __getitem__(): 588.
     and ‘__len__()’, but is considered a mapping rather than a sequence
     because the lookups use arbitrary *note hashable: 824. keys rather
     than integers.

     The *note collections.abc.Sequence: 13dc. abstract base class
     defines a much richer interface that goes beyond just *note
     __getitem__(): 588. and *note __len__(): 178f, adding *note
     count(): 23d8, *note index(): 1979, *note __contains__(): 15d3, and
     *note __reversed__(): e86.  Types that implement this expanded
     interface can be registered explicitly using *note register():
     129a.  For more documentation on sequence methods generally, see
     *note Common Sequence Operations: 2607.

set comprehension

     (集合内包表記) iterable 内の全てあるいは一部の要素を処理して、その
     結果からなる集合を返すコンパクトな書き方です。 ‘results = {c for c
     in 'abracadabra' if c not in 'abc'}’ とすると、‘{'r', 'd'}’ という
     文字列の辞書を生成します。 *note リスト、集合、辞書の表示: 7ec. を
     参照してください。

single dispatch

     *note generic function: be4. の一種で実装は一つの引数の型により選択
     されます。

slice

     An object of type *note slice: 694, used to describe a portion of a
     *note sequence: 716.  A slice object is created when using the
     *note slicing: 24ad. form of *note subscript notation: 23ce, with
     colons inside square brackets, such as in ‘variable_name[1:3:5]’.

soft deprecated

     A soft deprecated API should not be used in new code, but it is
     safe for already existing code to use it.  The API remains
     documented and tested, but will not be enhanced further.

     Soft deprecation, unlike normal deprecation, does not plan on
     removing the API and will not emit warnings.

     See PEP 387: Soft Deprecation(35).

special method

     (特殊メソッド) ある型に特定の操作、例えば加算をするために Python か
     ら暗黙に呼び出されるメソッド。この種類のメソッドは、メソッド名の最
     初と最後にアンダースコア 2 つがついています。特殊メソッドについては
     *note 特殊メソッド名: e68. で解説されています。

standard library

     The collection of *note packages: 233, *note modules: 19de. and
     *note extension modules: 2251. distributed as a part of the
     official Python interpreter package.  The exact membership of the
     collection may vary based on platform, available system libraries,
     or other criteria.  Documentation can be found at *note Python
     標準ライブラリ: 149.

     See also *note sys.stdlib_module_names: a42. for a list of all
     possible standard library module names.

statement

     (文) 文はスイート (コードの"ブロック") に不可欠な要素です。文は
     *note 式: 23cf. かキーワードから構成されるもののどちらかです。後者
     には *note if: 181.、*note while: 1973.、*note for: 34a. があります
     。

static type checker

     An external tool that reads Python code and analyzes it, looking
     for issues such as incorrect types.  See also *note type hints:
     23cb. and the *note typing: 10a. module.

stdlib

     An abbreviation of *note standard library: 59a1.

strong reference

     In Python's C API, a strong reference is a reference to an object
     which is owned by the code holding the reference.  The strong
     reference is taken by calling *note Py_INCREF(): 78f. when the
     reference is created and released with *note Py_DECREF(): 790. when
     the reference is deleted.

     The *note Py_NewRef(): a9a. function can be used to create a strong
     reference to an object.  Usually, the *note Py_DECREF(): 790.
     function must be called on the strong reference before exiting the
     scope of the strong reference, to avoid leaking one reference.

     See also *note borrowed reference: 3d7.

添字

     The expression in square brackets of a *note subscription
     expression: 23ce, for example, the ‘3’ in ‘items[3]’.  Usually used
     to select an element of a container.  Also called a *note key:
     23e4. when subscripting a *note mapping: 13d3, or an *note index:
     23e3. when subscripting a *note sequence: 716.

synchronization primitive

     A basic building block for coordinating (synchronizing) the
     execution of multiple threads to ensure *note thread-safe: 5992.
     access to shared resources.  Python's *note threading: f3. module
     provides several synchronization primitives including *note Lock:
     19f4, *note RLock: 32e, *note Semaphore: 136e, *note Condition:
     136d, *note Event: 1370, and *note Barrier: 13fc.  Additionally,
     the *note queue: bb. module provides multi-producer, multi-consumer
     queues that are especially useful in multithreaded programs.  These
     primitives help prevent *note race conditions: 5985. and coordinate
     thread execution.  See also *note lock: 598f.

t-string

t-strings

     String literals prefixed with ‘t’ or ‘T’ are commonly called
     "t-strings" which is short for *note template string literals:
     17fa.

text encoding

     A string in Python is a sequence of Unicode code points (in range
     ‘U+0000’-‘U+10FFFF’).  To store or transfer a string, it needs to
     be serialized as a sequence of bytes.

     Serializing a string into a sequence of bytes is known as
     "encoding", and recreating the string from the sequence of bytes is
     known as "decoding".

     There are a variety of different text serialization *note codecs:
     fb8, which are collectively referred to as "text encodings".

text file

     (テキストファイル) *note str: 169. オブジェクトを読み書きできる
     *note file object: 13db. です。 しばしば、テキストファイルは実際に
     バイト指向のデータストリームにアクセスし、 *note
     テキストエンコーディング: 25db. を自動的に行います。 テキストファイ
     ルの例は、 *note sys.stdin: 75f, *note sys.stdout: ccd, *note
     io.StringIO: 112a. インスタンスなどをテキストモード (‘'r'’ or
     ‘'w'’) で開いたファイルです。

     *note bytes-like オブジェクト: 193. を読み書きできるファイルオブジ
     ェクトについては、 *note バイナリファイル: 206e. も参照してください
     。

thread state

     The information used by the *note CPython: 905. runtime to run in
     an OS thread.  For example, this includes the current exception, if
     any, and the state of the bytecode interpreter.

     Each thread state is bound to a single OS thread, but threads may
     have many thread states available.  At most, one of them may be
     *note attached: 4ed1. at once.

     An *note attached thread state: 4ed1. is required to call most of
     Python's C API, unless a function explicitly documents otherwise.
     The bytecode interpreter only runs under an attached thread state.

     Each thread state belongs to a single interpreter, but each
     interpreter may have many thread states, including multiple for the
     same OS thread.  Thread states from multiple interpreters may be
     bound to the same thread, but only one can be *note attached: 4ed1.
     in that thread at any given moment.

     See *note Thread State and the Global Interpreter Lock: 551f. for
     more information.

thread-safe

     A module, function, or class that behaves correctly when used by
     multiple threads concurrently.  Thread-safe code uses appropriate
     *note synchronization primitives: 5990. like *note locks: 598f. to
     protect shared mutable state, or is designed to avoid shared
     mutable state entirely.  In the *note free-threaded: 1f4. build,
     built-in types like *note dict: 183, *note list: 24d, and *note
     set: 184. use internal locking to make many operations thread-safe,
     although thread safety is not necessarily guaranteed.  Code that is
     not thread-safe may experience *note race conditions: 5985. and
     *note data races: 5986. when used in multi-threaded programs.

トークン

     A small unit of source code, generated by the *note lexical
     analyzer: 2295. (also called the 'tokenizer').  Names, numbers,
     strings, operators, newlines and similar are represented by tokens.

     The *note tokenize: 101. module exposes Python's lexical analyzer.
     The *note token: 100. module contains information on the various
     types of tokens.

triple-quoted string

     (三重クォート文字列) 3つの連続したクォート記号(")かアポストロフィー
     (')で囲まれた文字列。通常の(一重)クォート文字列に比べて表現できる文
     字列に違いはありませんが、幾つかの理由で有用です。1つか2つの連続し
     たクォート記号をエスケープ無しに書くことができますし、行継続文字
     (\)を使わなくても複数行にまたがることができるので、ドキュメンテーシ
     ョン文字列を書く時に特に便利です。

type

     The type of a Python object determines what kind of object it is;
     every object has a type.  An object's type is accessible as its
     *note __class__: 16c6. attribute or can be retrieved with
     ‘type(obj)’.

type alias

     (型エイリアス) 型の別名で、型を識別子に代入して作成します。

     型エイリアスは *note 型ヒント: 23cb. を単純化するのに有用です。例え
     ば:

          def remove_gray_shades(
                  colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:
              pass

     これは次のようにより読みやすくできます:

          Color = tuple[int, int, int]

          def remove_gray_shades(colors: list[Color]) -> list[Color]:
              pass

     機能の説明がある *note typing: 10a. と PEP 484(36) を参照してくださ
     い。

type hint

     (型ヒント) 変数、クラス属性、関数のパラメータや返り値の期待される型
     を指定する *note annotation: 15c. です。

     Type hints are optional and are not enforced by Python but they are
     useful to *note static type checkers: 574.  They can also aid IDEs
     with code completion and refactoring.

     グローバル変数、クラス属性、関数で、ローカル変数でないものの型ヒン
     トは *note typing.get_type_hints(): 8c0. で取得できます。

     機能の説明がある *note typing: 10a. と PEP 484(37) を参照してくださ
     い。

universal newlines

     テキストストリームの解釈法の一つで、以下のすべてを行末と認識します:
     Unix の行末規定 ‘'\n'’、Windows の規定 ‘'\r\n'’、古い Macintosh の
     規定 ‘'\r'’。利用法について詳しくは、 PEP 278(38) と PEP 3116(39) 、
     さらに *note bytes.splitlines(): 2628. も参照してください。

variable annotation

     (変数アノテーション) 変数あるいはクラス属性の *note annotation:
     15c. 。

     変数あるいはクラス属性に注釈を付けたときは、代入部分は任意です:

          class C:
              field: 'annotation'

     変数アノテーションは通常は *note 型ヒント: 23cb. のために使われます
     : 例えば、この変数は *note int: 19b. の値を取ることを期待されていま
     す:

          count: int = 0

     変数アノテーションの構文については *note 注釈付き代入文 (annotated
     assignment statements): 250b. 節で解説しています。

     機能の説明がある *note function annotation: 2019, PEP 484(40) , PEP
     526(41) を参照してください。また、アノテーションを利用するベストプ
     ラクティスとして *note Annotations Best Practices: 9d9. も参照して
     ください。

virtual environment

     (仮想環境) 協調的に切り離された実行環境です。これにより Python ユー
     ザとアプリケーションは同じシステム上で動いている他の Python アプリ
     ケーションの挙動に干渉することなく Python パッケージのインストール
     と更新を行うことができます。

     *note venv: 117. を参照してください。

virtual machine

     (仮想マシン) 完全にソフトウェアにより定義されたコンピュータ。
     Python の仮想マシンは、バイトコードコンパイラが出力した *note
     バイトコード: 4aa. を実行します。

walrus operator

     A light-hearted way to refer to the *note assignment expression:
     24dd. operator ‘:=’ because it looks a bit like a walrus if you
     turn your head.

Zen of Python

     (Pythonの悟り) Python を理解し利用する上での導きとなる、Python の設
     計原則と哲学をリストにしたものです。対話プロンプトで "‘import
     this’" とするとこのリストを読めます。

   ---------- Footnotes ----------

   (1) https://peps.python.org/pep-0484/

   (2) https://peps.python.org/pep-0526/

   (3) https://peps.python.org/pep-0649/

   (4) https://peps.python.org/pep-0362/

   (5) https://peps.python.org/pep-0492/

   (6) https://peps.python.org/pep-0492/

   (7) https://peps.python.org/pep-0525/

   (8) https://peps.python.org/pep-0492/

   (9) https://peps.python.org/pep-0492/

   (10) https://peps.python.org/pep-0492/

   (11) https://gvanrossum.github.io/

   (12) https://peps.python.org/pep-0343/

   (13) https://peps.python.org/pep-0343/

   (14) https://peps.python.org/pep-0492/

   (15) https://peps.python.org/pep-0492/

   (16) https://www.python.org

   (17) https://peps.python.org/pep-0498/

   (18) https://peps.python.org/pep-0238/

   (19) https://peps.python.org/pep-0703/

   (20) https://peps.python.org/pep-0484/

   (21) https://peps.python.org/pep-0443/

   (22) https://peps.python.org/pep-0483/

   (23) https://peps.python.org/pep-0484/

   (24) https://peps.python.org/pep-0585/

   (25) https://peps.python.org/pep-0703/

   (26) https://peps.python.org/pep-0683/

   (27) https://peps.python.org/pep-0302/

   (28) https://peps.python.org/pep-0420/

   (29) https://peps.python.org/pep-0362/

   (30) https://peps.python.org/pep-0519/

   (31) https://peps.python.org/pep-0001/

   (32) https://peps.python.org/pep-0420/

   (33) https://peps.python.org/pep-0411/

   (34) https://peps.python.org/pep-3155/

   (35) https://peps.python.org/pep-0387/#soft-deprecation

   (36) https://peps.python.org/pep-0484/

   (37) https://peps.python.org/pep-0484/

   (38) https://peps.python.org/pep-0278/

   (39) https://peps.python.org/pep-3116/

   (40) https://peps.python.org/pep-0484/

   (41) https://peps.python.org/pep-0526/


File: python.info,  Node: このドキュメントについて,  Next: バグへの対処,  Prev: 用語集<2>,  Up: Top

13 このドキュメントについて
***************************

Pythonのドキュメントは、Sphinx(1) を使って、reStructuredText(2) のソース
から生成されています。 Sphinx はもともとPythonのために作られ、現在は独立
したプロジェクトとして保守されています。

ドキュメントとそのツール群の開発は、Python 自身と同様に完全にボランティ
アの努力です。 もしあなたが貢献したいなら、どのようにすればよいかについ
て *note バグへの対処: 4f19. ページをご覧下さい。 新しいボランティアはい
つでも歓迎です!  （訳注: 日本語訳の問題については、 GitHub 上の Issue
Tracker(3) で報告をお願いします。）

多大な感謝を:

   * Fred L. Drake, Jr., オリジナルの Python ドキュメントツールセットの
     作成者で、ドキュメントの多くを書きました。

   * Docutils(4) プロジェクトは、 reStructuredText と Docutils ツールセ
     ットを作成しました。

   * Fredrik Lundh の Alternative Python Reference プロジェクトから
     Sphinx は多くのアイデアを得ました。

* Menu:

* Pythonドキュメントへの貢献者::

   ---------- Footnotes ----------

   (1) https://www.sphinx-doc.org/

   (2) https://docutils.sourceforge.io/rst.html

   (3) https://github.com/python-doc-ja/python-doc-ja/issues

   (4) https://docutils.sourceforge.io/


File: python.info,  Node: Pythonドキュメントへの貢献者,  Up: このドキュメントについて

13.1 Pythonドキュメントへの貢献者
=================================

多くの方々が Python 言語、Python 標準ライブラリ、そして Python ドキュメ
ンテーションに貢献してくれています。ソース配布物の Misc/ACKS(1) に、それ
ら貢献してくれた人々を部分的にではありますがリストアップしてあります。

Python コミュニティからの情報提供と貢献がなければこの素晴らしいドキュメ
ントは生まれませんでした - ありがとう!

   ---------- Footnotes ----------

   (1) https://github.com/python/cpython/tree/3.14/Misc/ACKS


File: python.info,  Node: バグへの対処,  Next: Copyright,  Prev: このドキュメントについて,  Up: Top

14 バグへの対処
***************

Python は安定性について高い評価を得た、成熟した言語です。この評価を守る
ために、開発者たちはあなたが見つけた Python の不備を知りたいと思っていま
す。

It can be sometimes faster to fix bugs yourself and contribute patches
to Python as it streamlines the process and involves fewer people.
Learn how to *note contribute: 59b2.

* Menu:

* ドキュメントの不備::
* Python の課題管理システムを使う::
* Python への貢献をはじめる::


File: python.info,  Node: ドキュメントの不備,  Next: Python の課題管理システムを使う,  Up: バグへの対処

14.1 ドキュメントの不備
=======================

If you find a bug in this documentation or would like to propose an
improvement, please submit a bug report on the *note issue tracker: 557.
If you have a suggestion on how to fix it, include that as well.

If the bug or suggested improvement concerns the translation of this
documentation, submit the report to the translation’s repository(1)
instead.

または Documentation Discourse forum(2) でディスカッションを行うこともで
きます。

If you find a bug in the theme (HTML / CSS / JavaScript) of the
documentation, please submit a bug report on the python-doc-theme issue
tracker(3).

参考
....

ドキュメントのバグ(4)

     Python issue tracker に出されたドキュメントバグのリスト。

イシュートラッカー(5)

     issue tracker への改善報告に関する作業過程の概観。

ドキュメントを手伝う(6)

     Python ドキュメントへの貢献に興味がある個人へ向けた包括的なガイド。

ドキュメントの翻訳(7)

     ドキュメントの翻訳とその連絡先の載った GitHub pages のリスト。

   ---------- Footnotes ----------

   (1) https://github.com/python/python-docs-ja

   (2) https://discuss.python.org/c/documentation/26

   (3) https://github.com/python/python-docs-theme

   (4) 
https://github.com/python/cpython/issues?q=is%3Aissue+is%3Aopen+label%3Adocs

   (5) https://devguide.python.org/tracker/

   (6) 
https://devguide.python.org/docquality/#helping-with-documentation

   (7) https://devguide.python.org/documentation/translating/


File: python.info,  Node: Python の課題管理システムを使う,  Next: Python への貢献をはじめる,  Prev: ドキュメントの不備,  Up: バグへの対処

14.2 Python の課題管理システムを使う
====================================

Python 自体に関する問題は Githubのissue tracker
(‘https://github.com/python/cpython/issues’) で報告してください。この
Github issue trackerは、関連情報を入力して開発者に報告するための Web フ
ォームを提供しています。

レポートを書くには、初めにその問題が既にレポートされていないか確認します
。これにより、開発者の時間が無駄にならないだけでなく、あなたが、問題に対
して為された対処について知ることもできます。次のリリースに向けて問題が修
正されたのかもしれませんし、追加の情報が必要とされているのかもしれません
（この場合は是非情報を提供してください）。確認のためにはページの上の検索
ボックスを利用してください。

報告しようとしている問題がまだリストにない場合は、GitHub にログインして
ください。GitHubのアカウントをまだお持ちでない場合は、「Sign up」リンク
から新しいアカウントを作成してください。匿名でバグレポートを提出すること
はできません。

ログインした状態で、課題を送信することができます。トップバーの「New
issue」ボタンをクリックして、新しい課題を報告してください。

報告のフォームには、「Title」と「Comment」の2つのフィールドがあります。

「Title」フィールドには、問題の 'とても' 短い説明を（訳注: 英語で）入力
してください。10語以内が望ましいです。

"Comment" フィールドで、あなたが期待した結果と実際の結果も含め、問題の詳
細を説明してください。拡張モジュールが関与しているかどうかと、使用してい
るハードウェアとソフトウェアプラットフォームも (必要に応じてバージョン情
報も) 必ず報告に含めてください。

各問題レポートは開発者によってレビューされ、問題を修正するために何が必要
かを判断します。issueで何らかの行動があるたびに、最新情報を通知します。

参考
....

How to Report Bugs Effectively(1)

     有益なバグ報告について詳しく説明した記事です。どんな情報が、なぜ有
     益なのかを説明しています。

Bug Writing Guidelines(2)

     良いバグ報告を書くための情報です。この情報の一部はMozillaプロジェク
     ト独自のものですが、一般的に良い習慣を解説しています。

   ---------- Footnotes ----------

   (1) https://www.chiark.greenend.org.uk/~sgtatham/bugs.html

   (2) http://developer.mozilla.org/en/docs/Bug_writing_guidelines


File: python.info,  Node: Python への貢献をはじめる,  Prev: Python の課題管理システムを使う,  Up: バグへの対処

14.3 Python への貢献をはじめる
==============================

見つけたバグの報告だけでなく、修正パッチの提出も歓迎します。Python
Developer's Guide(1) には Python へのパッチの始め方について詳しい情報が
あります。疑問があれば、core-mentorship mailing list(2) は Python の問題
解決の過程に関するありとあらゆる疑問への答えを得ることが出来るフレンドリ
ーな場所です。

   ---------- Footnotes ----------

   (1) https://devguide.python.org/

   (2) 
https://mail.python.org/mailman3/lists/core-mentorship.python.org/


File: python.info,  Node: Copyright,  Next: 歴史とライセンス,  Prev: バグへの対処,  Up: Top

15 Copyright
************

Python and this documentation is:

Copyright © 2001 Python Software Foundation.  All rights reserved.

Copyright © 2000 BeOpen.com.  All rights reserved.

Copyright © 1995-2000 Corporation for National Research Initiatives.
All rights reserved.

Copyright © 1991-1995 Stichting Mathematisch Centrum.  All rights
reserved.

__________________________________________________________________

ライセンスおよび許諾に関する完全な情報は、 *note 歴史とライセンス: 59b9.
を参照してください。


File: python.info,  Node: 歴史とライセンス,  Next: Pythonモジュール索引,  Prev: Copyright,  Up: Top

16 歴史とライセンス
*******************

* Menu:

* Python の歴史::
* Terms and conditions for accessing or otherwise using Python::
* Licenses and Acknowledgements for Incorporated Software::


File: python.info,  Node: Python の歴史,  Next: Terms and conditions for accessing or otherwise using Python,  Up: 歴史とライセンス

16.1 Python の歴史
==================

Python was created in the early 1990s by Guido van Rossum at Stichting
Mathematisch Centrum (CWI, see ‘https://www.cwi.nl’) in the Netherlands
as a successor of a language called ABC. Guido remains Python's
principal author, although it includes many contributions from others.

In 1995, Guido continued his work on Python at the Corporation for
National Research Initiatives (CNRI, see
‘https://www.cnri.reston.va.us’) in Reston, Virginia where he released
several versions of the software.

In May 2000, Guido and the Python core development team moved to
BeOpen.com to form the BeOpen PythonLabs team.  In October of the same
year, the PythonLabs team moved to Digital Creations, which became Zope
Corporation.  In 2001, the Python Software Foundation (PSF, see
‘https://www.python.org/psf/’) was formed, a non-profit organization
created specifically to own Python-related Intellectual Property.  Zope
Corporation was a sponsoring member of the PSF.

All Python releases are Open Source (see ‘https://opensource.org’ for
the Open Source Definition).  Historically, most, but not all, Python
releases have also been GPL-compatible; the table below summarizes the
various releases.

リリース             ベース             西暦年           権利             GPL-compatible?  (1)
                                                                          
----------------------------------------------------------------------------------------------------
                                                                          
0.9.0 - 1.2          n/a                1991-1995        CWI              yes
                                                                          
                                                                          
1.3 - 1.5.2          1.2                1995-1999        CNRI             yes
                                                                          
                                                                          
1.6                  1.5.2              2000             CNRI             no
                                                                          
                                                                          
2.0                  1.6                2000             BeOpen.com       no
                                                                          
                                                                          
1.6.1                1.6                2001             CNRI             yes (2)
                                                                          
                                                                          
2.1                  2.0+1.6.1          2001             PSF              no
                                                                          
                                                                          
2.0.1                2.0+1.6.1          2001             PSF              yes
                                                                          
                                                                          
2.1.1                2.1+2.0.1          2001             PSF              yes
                                                                          
                                                                          
2.1.2                2.1.1              2002             PSF              yes
                                                                          
                                                                          
2.1.3                2.1.2              2002             PSF              yes
                                                                          
                                                                          
2.2 以降             2.1.1              2001-現在        PSF              yes
                                                                          

     注釈: 
       1. GPL-compatible doesn't mean that we're distributing Python
          under the GPL. All Python licenses, unlike the GPL, let you
          distribute a modified version without making your changes open
          source.  The GPL-compatible licenses make it possible to
          combine Python with other software that is released under the
          GPL; the others don't.

       2. According to Richard Stallman, 1.6.1 is not GPL-compatible,
          because its license has a choice of law clause.  According to
          CNRI, however, Stallman's lawyer has told CNRI's lawyer that
          1.6.1 is "not incompatible" with the GPL.

Guido の指示の下、これらのリリースを可能にしてくださった多くのボランティ
アのみなさんに感謝します。


File: python.info,  Node: Terms and conditions for accessing or otherwise using Python,  Next: Licenses and Acknowledgements for Incorporated Software,  Prev: Python の歴史,  Up: 歴史とライセンス

16.2 Terms and conditions for accessing or otherwise using Python
=================================================================

Python software and documentation are licensed under the Python Software
Foundation License Version 2.

Starting with Python 3.8.6, examples, recipes, and other code in the
documentation are dual licensed under the PSF License Version 2 and the
*note Zero-Clause BSD license: 59bf.

Some software incorporated into Python is under different licenses.  The
licenses are listed with code falling under that license.  See *note
Licenses and Acknowledgements for Incorporated Software: 59c0. for an
incomplete list of these licenses.

* Menu:

* PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2::
* BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0: BEOPEN COM LICENSE AGREEMENT FOR PYTHON 2 0.
* CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1: CNRI LICENSE AGREEMENT FOR PYTHON 1 6 1.
* CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2: CWI LICENSE AGREEMENT FOR PYTHON 0 9 0 THROUGH 1 2.
* ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION::


File: python.info,  Node: PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2,  Next: BEOPEN COM LICENSE AGREEMENT FOR PYTHON 2 0,  Up: Terms and conditions for accessing or otherwise using Python

16.2.1 PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
---------------------------------------------------

     1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and
        the Individual or Organization ("Licensee") accessing and otherwise using this
        software ("Python") in source or binary form and its associated documentation.

     2. Subject to the terms and conditions of this License Agreement, PSF hereby
        grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
        analyze, test, perform and/or display publicly, prepare derivative works,
        distribute, and otherwise use Python alone or in any derivative
        version, provided, however, that PSF's License Agreement and PSF's notice of
        copyright, i.e., "Copyright © 2001 Python Software Foundation; All Rights
        Reserved" are retained in Python alone or in any derivative version
        prepared by Licensee.

     3. In the event Licensee prepares a derivative work that is based on or
        incorporates Python or any part thereof, and wants to make the
        derivative work available to others as provided herein, then Licensee hereby
        agrees to include in any such work a brief summary of the changes made to Python.

     4. PSF is making Python available to Licensee on an "AS IS" basis.
        PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.  BY WAY OF
        EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR
        WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
        USE OF PYTHON WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.

     5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
        FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF
        MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE
        THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.

     6. This License Agreement will automatically terminate upon a material breach of
        its terms and conditions.

     7. Nothing in this License Agreement shall be deemed to create any relationship
        of agency, partnership, or joint venture between PSF and Licensee.  This License
        Agreement does not grant permission to use PSF trademarks or trade name in a
        trademark sense to endorse or promote products or services of Licensee, or any
        third party.

     8. By copying, installing or otherwise using Python, Licensee agrees
        to be bound by the terms and conditions of this License Agreement.


File: python.info,  Node: BEOPEN COM LICENSE AGREEMENT FOR PYTHON 2 0,  Next: CNRI LICENSE AGREEMENT FOR PYTHON 1 6 1,  Prev: PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2,  Up: Terms and conditions for accessing or otherwise using Python

16.2.2 BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
--------------------------------------------------

BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1

     1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an office at
        160 Saratoga Avenue, Santa Clara, CA 95051, and the Individual or Organization
        ("Licensee") accessing and otherwise using this software in source or binary
        form and its associated documentation ("the Software").

     2. Subject to the terms and conditions of this BeOpen Python License Agreement,
        BeOpen hereby grants Licensee a non-exclusive, royalty-free, world-wide license
        to reproduce, analyze, test, perform and/or display publicly, prepare derivative
        works, distribute, and otherwise use the Software alone or in any derivative
        version, provided, however, that the BeOpen Python License is retained in the
        Software, alone or in any derivative version prepared by Licensee.

     3. BeOpen is making the Software available to Licensee on an "AS IS" basis.
        BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.  BY WAY OF
        EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND DISCLAIMS ANY REPRESENTATION OR
        WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
        USE OF THE SOFTWARE WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.

     4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE SOFTWARE FOR
        ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF USING,
        MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY DERIVATIVE THEREOF, EVEN IF
        ADVISED OF THE POSSIBILITY THEREOF.

     5. This License Agreement will automatically terminate upon a material breach of
        its terms and conditions.

     6. This License Agreement shall be governed by and interpreted in all respects
        by the law of the State of California, excluding conflict of law provisions.
        Nothing in this License Agreement shall be deemed to create any relationship of
        agency, partnership, or joint venture between BeOpen and Licensee.  This License
        Agreement does not grant permission to use BeOpen trademarks or trade names in a
        trademark sense to endorse or promote products or services of Licensee, or any
        third party.  As an exception, the "BeOpen Python" logos available at
        ‘http://www.pythonlabs.com/logos.html’ may be used according to the permissions
        granted on that web page.

     7. By copying, installing or otherwise using the software, Licensee agrees to be
        bound by the terms and conditions of this License Agreement.


File: python.info,  Node: CNRI LICENSE AGREEMENT FOR PYTHON 1 6 1,  Next: CWI LICENSE AGREEMENT FOR PYTHON 0 9 0 THROUGH 1 2,  Prev: BEOPEN COM LICENSE AGREEMENT FOR PYTHON 2 0,  Up: Terms and conditions for accessing or otherwise using Python

16.2.3 CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
----------------------------------------------

     1. This LICENSE AGREEMENT is between the Corporation for National Research
        Initiatives, having an office at 1895 Preston White Drive, Reston, VA 20191
        ("CNRI"), and the Individual or Organization ("Licensee") accessing and
        otherwise using Python 1.6.1 software in source or binary form and its
        associated documentation.

     2. Subject to the terms and conditions of this License Agreement, CNRI hereby
        grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
        analyze, test, perform and/or display publicly, prepare derivative works,
        distribute, and otherwise use Python 1.6.1 alone or in any derivative version,
        provided, however, that CNRI's License Agreement and CNRI's notice of copyright,
        i.e., "Copyright © 1995-2001 Corporation for National Research Initiatives; All
        Rights Reserved" are retained in Python 1.6.1 alone or in any derivative version
        prepared by Licensee.  Alternately, in lieu of CNRI's License Agreement,
        Licensee may substitute the following text (omitting the quotes): "Python 1.6.1
        is made available subject to the terms and conditions in CNRI's License
        Agreement.  This Agreement together with Python 1.6.1 may be located on the
        internet using the following unique, persistent identifier (known as a handle):
        1895.22/1013.  This Agreement may also be obtained from a proxy server on the
        internet using the following URL: ‘http://hdl.handle.net/1895.22/1013’".

     3. In the event Licensee prepares a derivative work that is based on or
        incorporates Python 1.6.1 or any part thereof, and wants to make the derivative
        work available to others as provided herein, then Licensee hereby agrees to
        include in any such work a brief summary of the changes made to Python 1.6.1.

     4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" basis.  CNRI
        MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.  BY WAY OF EXAMPLE,
        BUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY
        OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
        PYTHON 1.6.1 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.

     5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 1.6.1 FOR
        ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF
        MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, OR ANY DERIVATIVE
        THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.

     6. This License Agreement will automatically terminate upon a material breach of
        its terms and conditions.

     7. This License Agreement shall be governed by the federal intellectual property
        law of the United States, including without limitation the federal copyright
        law, and, to the extent such U.S. federal law does not apply, by the law of the
        Commonwealth of Virginia, excluding Virginia's conflict of law provisions.
        Notwithstanding the foregoing, with regard to derivative works based on Python
        1.6.1 that incorporate non-separable material that was previously distributed
        under the GNU General Public License (GPL), the law of the Commonwealth of
        Virginia shall govern this License Agreement only as to issues arising under or
        with respect to Paragraphs 4, 5, and 7 of this License Agreement.  Nothing in
        this License Agreement shall be deemed to create any relationship of agency,
        partnership, or joint venture between CNRI and Licensee.  This License Agreement
        does not grant permission to use CNRI trademarks or trade name in a trademark
        sense to endorse or promote products or services of Licensee, or any third
        party.

     8. By clicking on the "ACCEPT" button where indicated, or by copying, installing
        or otherwise using Python 1.6.1, Licensee agrees to be bound by the terms and
        conditions of this License Agreement.


File: python.info,  Node: CWI LICENSE AGREEMENT FOR PYTHON 0 9 0 THROUGH 1 2,  Next: ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION,  Prev: CNRI LICENSE AGREEMENT FOR PYTHON 1 6 1,  Up: Terms and conditions for accessing or otherwise using Python

16.2.4 CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
---------------------------------------------------------

     Copyright © 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, The
     Netherlands.  All rights reserved.

     Permission to use, copy, modify, and distribute this software and its
     documentation for any purpose and without fee is hereby granted, provided that
     the above copyright notice appear in all copies and that both that copyright
     notice and this permission notice appear in supporting documentation, and that
     the name of Stichting Mathematisch Centrum or CWI not be used in advertising or
     publicity pertaining to distribution of the software without specific, written
     prior permission.

     STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
     SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
     EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE FOR ANY SPECIAL, INDIRECT
     OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
     DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
     ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
     SOFTWARE.


File: python.info,  Node: ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION,  Prev: CWI LICENSE AGREEMENT FOR PYTHON 0 9 0 THROUGH 1 2,  Up: Terms and conditions for accessing or otherwise using Python

16.2.5 ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION
-------------------------------------------------------------------

     Permission to use, copy, modify, and/or distribute this software for any
     purpose with or without fee is hereby granted.

     THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
     REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
     AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
     INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
     LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
     OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
     PERFORMANCE OF THIS SOFTWARE.


File: python.info,  Node: Licenses and Acknowledgements for Incorporated Software,  Prev: Terms and conditions for accessing or otherwise using Python,  Up: 歴史とライセンス

16.3 Licenses and Acknowledgements for Incorporated Software
============================================================

This section is an incomplete, but growing list of licenses and
acknowledgements for third-party software incorporated in the Python
distribution.

* Menu:

* Mersenne Twister::
* ソケット: ソケット<2>.
* Asynchronous socket services::
* Cookie management::
* Execution tracing::
* UUencode and UUdecode functions::
* XML Remote Procedure Calls::
* test_epoll::
* Select kqueue::
* SipHash24::
* strtod と dtoa::
* OpenSSL: OpenSSL<2>.
* expat::
* libffi::
* zlib: zlib<4>.
* cfuhash::
* libmpdec::
* W3C C14N test suite::
* mimalloc::
* asyncio: asyncio<15>.
* Global Unbounded Sequences (GUS): Global Unbounded Sequences GUS.
* Zstandard bindings::


File: python.info,  Node: Mersenne Twister,  Next: ソケット<2>,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.1 Mersenne Twister
-----------------------

The ‘_random’ C extension underlying the *note random: bd. module
includes code based on a download from
‘http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html’.
The following are the verbatim comments from the original code:

     A C-program for MT19937, with initialization improved 2002/1/26.
     Coded by Takuji Nishimura and Makoto Matsumoto.

     Before using, initialize the state by using init_genrand(seed)
     or init_by_array(init_key, key_length).

     Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
     All rights reserved.

     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
     are met:

      1. Redistributions of source code must retain the above copyright
         notice, this list of conditions and the following disclaimer.

      2. Redistributions in binary form must reproduce the above copyright
         notice, this list of conditions and the following disclaimer in the
         documentation and/or other materials provided with the distribution.

      3. The names of its contributors may not be used to endorse or promote
         products derived from this software without specific prior written
         permission.

     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


     Any feedback is very welcome.
     http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
     email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)


File: python.info,  Node: ソケット<2>,  Next: Asynchronous socket services,  Prev: Mersenne Twister,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.2 ソケット
---------------

The *note socket: d1. module uses the functions, ‘getaddrinfo()’, and
‘getnameinfo()’, which are coded in separate source files from the WIDE
Project, ‘https://www.wide.ad.jp/’.

     Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
     All rights reserved.

     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
     are met:
     1. Redistributions of source code must retain the above copyright
        notice, this list of conditions and the following disclaimer.
     2. Redistributions in binary form must reproduce the above copyright
        notice, this list of conditions and the following disclaimer in the
        documentation and/or other materials provided with the distribution.
     3. Neither the name of the project nor the names of its contributors
        may be used to endorse or promote products derived from this software
        without specific prior written permission.

     THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS "AS IS" AND
     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
     FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     SUCH DAMAGE.


File: python.info,  Node: Asynchronous socket services,  Next: Cookie management,  Prev: ソケット<2>,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.3 Asynchronous socket services
-----------------------------------

The ‘test.support.asynchat’ and ‘test.support.asyncore’ modules contain
the following notice:

     Copyright 1996 by Sam Rushing

                             All Rights Reserved

     Permission to use, copy, modify, and distribute this software and
     its documentation for any purpose and without fee is hereby
     granted, provided that the above copyright notice appear in all
     copies and that both that copyright notice and this permission
     notice appear in supporting documentation, and that the name of Sam
     Rushing not be used in advertising or publicity pertaining to
     distribution of the software without specific, written prior
     permission.

     SAM RUSHING DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
     INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
     NO EVENT SHALL SAM RUSHING BE LIABLE FOR ANY SPECIAL, INDIRECT OR
     CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
     OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
     NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
     CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.


File: python.info,  Node: Cookie management,  Next: Execution tracing,  Prev: Asynchronous socket services,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.4 Cookie management
------------------------

The *note http.cookies: 75. module contains the following notice:

     Copyright 2000 by Timothy O'Malley <timo@alum.mit.edu>

                    All Rights Reserved

     Permission to use, copy, modify, and distribute this software
     and its documentation for any purpose and without fee is hereby
     granted, provided that the above copyright notice appear in all
     copies and that both that copyright notice and this permission
     notice appear in supporting documentation, and that the name of
     Timothy O'Malley  not be used in advertising or publicity
     pertaining to distribution of the software without specific, written
     prior permission.

     Timothy O'Malley DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
     SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
     AND FITNESS, IN NO EVENT SHALL Timothy O'Malley BE LIABLE FOR
     ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
     WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
     ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
     PERFORMANCE OF THIS SOFTWARE.


File: python.info,  Node: Execution tracing,  Next: UUencode and UUdecode functions,  Prev: Cookie management,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.5 Execution tracing
------------------------

The *note trace: 103. module contains the following notice:

     portions copyright 2001, Autonomous Zones Industries, Inc., all rights...
     err...  reserved and offered to the public under the terms of the
     Python 2.2 license.
     Author: Zooko O'Whielacronx
     http://zooko.com/
     mailto:zooko@zooko.com

     Copyright 2000, Mojam Media, Inc., all rights reserved.
     Author: Skip Montanaro

     Copyright 1999, Bioreason, Inc., all rights reserved.
     Author: Andrew Dalke

     Copyright 1995-1997, Automatrix, Inc., all rights reserved.
     Author: Skip Montanaro

     Copyright 1991-1995, Stichting Mathematisch Centrum, all rights reserved.


     Permission to use, copy, modify, and distribute this Python software and
     its associated documentation for any purpose without fee is hereby
     granted, provided that the above copyright notice appears in all copies,
     and that both that copyright notice and this permission notice appear in
     supporting documentation, and that the name of neither Automatrix,
     Bioreason or Mojam Media be used in advertising or publicity pertaining to
     distribution of the software without specific, written prior permission.


File: python.info,  Node: UUencode and UUdecode functions,  Next: XML Remote Procedure Calls,  Prev: Execution tracing,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.6 UUencode and UUdecode functions
--------------------------------------

The ‘uu’ codec contains the following notice:

     Copyright 1994 by Lance Ellinghouse
     Cathedral City, California Republic, United States of America.
                            All Rights Reserved
     Permission to use, copy, modify, and distribute this software and its
     documentation for any purpose and without fee is hereby granted,
     provided that the above copyright notice appear in all copies and that
     both that copyright notice and this permission notice appear in
     supporting documentation, and that the name of Lance Ellinghouse
     not be used in advertising or publicity pertaining to distribution
     of the software without specific, written prior permission.
     LANCE ELLINGHOUSE DISCLAIMS ALL WARRANTIES WITH REGARD TO
     THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
     FITNESS, IN NO EVENT SHALL LANCE ELLINGHOUSE CENTRUM BE LIABLE
     FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
     OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

     Modified by Jack Jansen, CWI, July 1995:
     - Use binascii module to do the actual line-by-line conversion
       between ascii and binary. This results in a 1000-fold speedup. The C
       version is still 5 times faster, though.
     - Arguments more compliant with Python standard


File: python.info,  Node: XML Remote Procedure Calls,  Next: test_epoll,  Prev: UUencode and UUdecode functions,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.7 XML Remote Procedure Calls
---------------------------------

The *note xmlrpc.client: 134. module contains the following notice:

         The XML-RPC client interface is

     Copyright (c) 1999-2002 by Secret Labs AB
     Copyright (c) 1999-2002 by Fredrik Lundh

     By obtaining, using, and/or copying this software and/or its
     associated documentation, you agree that you have read, understood,
     and will comply with the following terms and conditions:

     Permission to use, copy, modify, and distribute this software and
     its associated documentation for any purpose and without fee is
     hereby granted, provided that the above copyright notice appears in
     all copies, and that both that copyright notice and this permission
     notice appear in supporting documentation, and that the name of
     Secret Labs AB or the author not be used in advertising or publicity
     pertaining to distribution of the software without specific, written
     prior permission.

     SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
     TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
     ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
     BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
     DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
     WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
     ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
     OF THIS SOFTWARE.


File: python.info,  Node: test_epoll,  Next: Select kqueue,  Prev: XML Remote Procedure Calls,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.8 test_epoll
-----------------

The ‘test.test_epoll’ module contains the following notice:

     Copyright (c) 2001-2006 Twisted Matrix Laboratories.

     Permission is hereby granted, free of charge, to any person obtaining
     a copy of this software and associated documentation files (the
     "Software"), to deal in the Software without restriction, including
     without limitation the rights to use, copy, modify, merge, publish,
     distribute, sublicense, and/or sell copies of the Software, and to
     permit persons to whom the Software is furnished to do so, subject to
     the following conditions:

     The above copyright notice and this permission notice shall be
     included in all copies or substantial portions of the Software.

     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
     LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
     OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
     WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


File: python.info,  Node: Select kqueue,  Next: SipHash24,  Prev: test_epoll,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.9 Select kqueue
--------------------

*note select: c6. モジュールは kqueue インターフェースについての次の告知
を含んでいます:

     Copyright (c) 2000 Doug White, 2006 James Knight, 2007 Christian Heimes
     All rights reserved.

     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
     are met:
     1. Redistributions of source code must retain the above copyright
        notice, this list of conditions and the following disclaimer.
     2. Redistributions in binary form must reproduce the above copyright
        notice, this list of conditions and the following disclaimer in the
        documentation and/or other materials provided with the distribution.

     THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     SUCH DAMAGE.


File: python.info,  Node: SipHash24,  Next: strtod と dtoa,  Prev: Select kqueue,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.10 SipHash24
-----------------

The file ‘Python/pyhash.c’ contains Marek Majkowski' implementation of
Dan Bernstein's SipHash24 algorithm.  It contains the following note:

     <MIT License>
     Copyright (c) 2013  Marek Majkowski <marek@popcount.org>

     Permission is hereby granted, free of charge, to any person obtaining a copy
     of this software and associated documentation files (the "Software"), to deal
     in the Software without restriction, including without limitation the rights
     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     copies of the Software, and to permit persons to whom the Software is
     furnished to do so, subject to the following conditions:

     The above copyright notice and this permission notice shall be included in
     all copies or substantial portions of the Software.
     </MIT License>

     Original location:
        https://github.com/majek/csiphash/

     Solution inspired by code from:
        Samuel Neves (supercop/crypto_auth/siphash24/little)
        djb (supercop/crypto_auth/siphash24/little2)
        Jean-Philippe Aumasson (https://131002.net/siphash/siphash24.c)


File: python.info,  Node: strtod と dtoa,  Next: OpenSSL<2>,  Prev: SipHash24,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.11 strtod と dtoa
----------------------

The file ‘Python/dtoa.c’, which supplies C functions dtoa and strtod for
conversion of C doubles to and from strings, is derived from the file of
the same name by David M. Gay, currently available from
‘https://web.archive.org/web/20220517033456/http://www.netlib.org/fp/dtoa.c’.
The original file, as retrieved on March 16, 2009, contains the
following copyright and licensing notice:

     /****************************************************************
      *
      * The author of this software is David M. Gay.
      *
      * Copyright (c) 1991, 2000, 2001 by Lucent Technologies.
      *
      * Permission to use, copy, modify, and distribute this software for any
      * purpose without fee is hereby granted, provided that this entire notice
      * is included in all copies of any software which is or includes a copy
      * or modification of this software and in all copies of the supporting
      * documentation for such software.
      *
      * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
      * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY
      * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
      * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
      *
      ***************************************************************/


File: python.info,  Node: OpenSSL<2>,  Next: expat,  Prev: strtod と dtoa,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.12 OpenSSL
---------------

The modules *note hashlib: 6c, *note posix: b2. and *note ssl: d5. use
the OpenSSL library for added performance if made available by the
operating system.  Additionally, the Windows and macOS installers for
Python may include a copy of the OpenSSL libraries, so we include a copy
of the OpenSSL license here.  For the OpenSSL 3.0 release, and later
releases derived from that, the Apache License v2 applies:

                                   Apache License
                             Version 2.0, January 2004
                          https://www.apache.org/licenses/

     TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

     1. Definitions.

        "License" shall mean the terms and conditions for use, reproduction,
        and distribution as defined by Sections 1 through 9 of this document.

        "Licensor" shall mean the copyright owner or entity authorized by
        the copyright owner that is granting the License.

        "Legal Entity" shall mean the union of the acting entity and all
        other entities that control, are controlled by, or are under common
        control with that entity. For the purposes of this definition,
        "control" means (i) the power, direct or indirect, to cause the
        direction or management of such entity, whether by contract or
        otherwise, or (ii) ownership of fifty percent (50%) or more of the
        outstanding shares, or (iii) beneficial ownership of such entity.

        "You" (or "Your") shall mean an individual or Legal Entity
        exercising permissions granted by this License.

        "Source" form shall mean the preferred form for making modifications,
        including but not limited to software source code, documentation
        source, and configuration files.

        "Object" form shall mean any form resulting from mechanical
        transformation or translation of a Source form, including but
        not limited to compiled object code, generated documentation,
        and conversions to other media types.

        "Work" shall mean the work of authorship, whether in Source or
        Object form, made available under the License, as indicated by a
        copyright notice that is included in or attached to the work
        (an example is provided in the Appendix below).

        "Derivative Works" shall mean any work, whether in Source or Object
        form, that is based on (or derived from) the Work and for which the
        editorial revisions, annotations, elaborations, or other modifications
        represent, as a whole, an original work of authorship. For the purposes
        of this License, Derivative Works shall not include works that remain
        separable from, or merely link (or bind by name) to the interfaces of,
        the Work and Derivative Works thereof.

        "Contribution" shall mean any work of authorship, including
        the original version of the Work and any modifications or additions
        to that Work or Derivative Works thereof, that is intentionally
        submitted to Licensor for inclusion in the Work by the copyright owner
        or by an individual or Legal Entity authorized to submit on behalf of
        the copyright owner. For the purposes of this definition, "submitted"
        means any form of electronic, verbal, or written communication sent
        to the Licensor or its representatives, including but not limited to
        communication on electronic mailing lists, source code control systems,
        and issue tracking systems that are managed by, or on behalf of, the
        Licensor for the purpose of discussing and improving the Work, but
        excluding communication that is conspicuously marked or otherwise
        designated in writing by the copyright owner as "Not a Contribution."

        "Contributor" shall mean Licensor and any individual or Legal Entity
        on behalf of whom a Contribution has been received by Licensor and
        subsequently incorporated within the Work.

     2. Grant of Copyright License. Subject to the terms and conditions of
        this License, each Contributor hereby grants to You a perpetual,
        worldwide, non-exclusive, no-charge, royalty-free, irrevocable
        copyright license to reproduce, prepare Derivative Works of,
        publicly display, publicly perform, sublicense, and distribute the
        Work and such Derivative Works in Source or Object form.

     3. Grant of Patent License. Subject to the terms and conditions of
        this License, each Contributor hereby grants to You a perpetual,
        worldwide, non-exclusive, no-charge, royalty-free, irrevocable
        (except as stated in this section) patent license to make, have made,
        use, offer to sell, sell, import, and otherwise transfer the Work,
        where such license applies only to those patent claims licensable
        by such Contributor that are necessarily infringed by their
        Contribution(s) alone or by combination of their Contribution(s)
        with the Work to which such Contribution(s) was submitted. If You
        institute patent litigation against any entity (including a
        cross-claim or counterclaim in a lawsuit) alleging that the Work
        or a Contribution incorporated within the Work constitutes direct
        or contributory patent infringement, then any patent licenses
        granted to You under this License for that Work shall terminate
        as of the date such litigation is filed.

     4. Redistribution. You may reproduce and distribute copies of the
        Work or Derivative Works thereof in any medium, with or without
        modifications, and in Source or Object form, provided that You
        meet the following conditions:

        (a) You must give any other recipients of the Work or
            Derivative Works a copy of this License; and

        (b) You must cause any modified files to carry prominent notices
            stating that You changed the files; and

        (c) You must retain, in the Source form of any Derivative Works
            that You distribute, all copyright, patent, trademark, and
            attribution notices from the Source form of the Work,
            excluding those notices that do not pertain to any part of
            the Derivative Works; and

        (d) If the Work includes a "NOTICE" text file as part of its
            distribution, then any Derivative Works that You distribute must
            include a readable copy of the attribution notices contained
            within such NOTICE file, excluding those notices that do not
            pertain to any part of the Derivative Works, in at least one
            of the following places: within a NOTICE text file distributed
            as part of the Derivative Works; within the Source form or
            documentation, if provided along with the Derivative Works; or,
            within a display generated by the Derivative Works, if and
            wherever such third-party notices normally appear. The contents
            of the NOTICE file are for informational purposes only and
            do not modify the License. You may add Your own attribution
            notices within Derivative Works that You distribute, alongside
            or as an addendum to the NOTICE text from the Work, provided
            that such additional attribution notices cannot be construed
            as modifying the License.

        You may add Your own copyright statement to Your modifications and
        may provide additional or different license terms and conditions
        for use, reproduction, or distribution of Your modifications, or
        for any such Derivative Works as a whole, provided Your use,
        reproduction, and distribution of the Work otherwise complies with
        the conditions stated in this License.

     5. Submission of Contributions. Unless You explicitly state otherwise,
        any Contribution intentionally submitted for inclusion in the Work
        by You to the Licensor shall be under the terms and conditions of
        this License, without any additional terms or conditions.
        Notwithstanding the above, nothing herein shall supersede or modify
        the terms of any separate license agreement you may have executed
        with Licensor regarding such Contributions.

     6. Trademarks. This License does not grant permission to use the trade
        names, trademarks, service marks, or product names of the Licensor,
        except as required for reasonable and customary use in describing the
        origin of the Work and reproducing the content of the NOTICE file.

     7. Disclaimer of Warranty. Unless required by applicable law or
        agreed to in writing, Licensor provides the Work (and each
        Contributor provides its Contributions) on an "AS IS" BASIS,
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
        implied, including, without limitation, any warranties or conditions
        of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
        PARTICULAR PURPOSE. You are solely responsible for determining the
        appropriateness of using or redistributing the Work and assume any
        risks associated with Your exercise of permissions under this License.

     8. Limitation of Liability. In no event and under no legal theory,
        whether in tort (including negligence), contract, or otherwise,
        unless required by applicable law (such as deliberate and grossly
        negligent acts) or agreed to in writing, shall any Contributor be
        liable to You for damages, including any direct, indirect, special,
        incidental, or consequential damages of any character arising as a
        result of this License or out of the use or inability to use the
        Work (including but not limited to damages for loss of goodwill,
        work stoppage, computer failure or malfunction, or any and all
        other commercial damages or losses), even if such Contributor
        has been advised of the possibility of such damages.

     9. Accepting Warranty or Additional Liability. While redistributing
        the Work or Derivative Works thereof, You may choose to offer,
        and charge a fee for, acceptance of support, warranty, indemnity,
        or other liability obligations and/or rights consistent with this
        License. However, in accepting such obligations, You may act only
        on Your own behalf and on Your sole responsibility, not on behalf
        of any other Contributor, and only if You agree to indemnify,
        defend, and hold each Contributor harmless for any liability
        incurred by, or claims asserted against, such Contributor by reason
        of your accepting any such warranty or additional liability.

     END OF TERMS AND CONDITIONS


File: python.info,  Node: expat,  Next: libffi,  Prev: OpenSSL<2>,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.13 expat
-------------

The *note pyexpat: 12c. extension is built using an included copy of the
expat sources unless the build is configured ‘--with-system-expat’:

     Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
                                    and Clark Cooper

     Permission is hereby granted, free of charge, to any person obtaining
     a copy of this software and associated documentation files (the
     "Software"), to deal in the Software without restriction, including
     without limitation the rights to use, copy, modify, merge, publish,
     distribute, sublicense, and/or sell copies of the Software, and to
     permit persons to whom the Software is furnished to do so, subject to
     the following conditions:

     The above copyright notice and this permission notice shall be included
     in all copies or substantial portions of the Software.

     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
     IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
     CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
     TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


File: python.info,  Node: libffi,  Next: zlib<4>,  Prev: expat,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.14 libffi
--------------

The ‘_ctypes’ C extension underlying the *note ctypes: 2e. module is
built using an included copy of the libffi sources unless the build is
configured ‘--with-system-libffi’:

     Copyright (c) 1996-2008  Red Hat, Inc and others.

     Permission is hereby granted, free of charge, to any person obtaining
     a copy of this software and associated documentation files (the
     "Software"), to deal in the Software without restriction, including
     without limitation the rights to use, copy, modify, merge, publish,
     distribute, sublicense, and/or sell copies of the Software, and to
     permit persons to whom the Software is furnished to do so, subject to
     the following conditions:

     The above copyright notice and this permission notice shall be included
     in all copies or substantial portions of the Software.

     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
     DEALINGS IN THE SOFTWARE.


File: python.info,  Node: zlib<4>,  Next: cfuhash,  Prev: libffi,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.15 zlib
------------

The *note zlib: 139. extension is built using an included copy of the
zlib sources if the zlib version found on the system is too old to be
used for the build:

     Copyright (C) 1995-2011 Jean-loup Gailly and Mark Adler

     This software is provided 'as-is', without any express or implied
     warranty.  In no event will the authors be held liable for any damages
     arising from the use of this software.

     Permission is granted to anyone to use this software for any purpose,
     including commercial applications, and to alter it and redistribute it
     freely, subject to the following restrictions:

     1. The origin of this software must not be misrepresented; you must not
        claim that you wrote the original software. If you use this software
        in a product, an acknowledgment in the product documentation would be
        appreciated but is not required.

     2. Altered source versions must be plainly marked as such, and must not be
        misrepresented as being the original software.

     3. This notice may not be removed or altered from any source distribution.

     Jean-loup Gailly        Mark Adler
     jloup@gzip.org          madler@alumni.caltech.edu


File: python.info,  Node: cfuhash,  Next: libmpdec,  Prev: zlib<4>,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.16 cfuhash
---------------

The implementation of the hash table used by the *note tracemalloc: 105.
で使用しているハッシュテーブルの実装は、cfuhashプロジェクトのものに基づ
きます:

     Copyright (c) 2005 Don Owens
     All rights reserved.

     This code is released under the BSD license:

     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
     are met:

       * Redistributions of source code must retain the above copyright
         notice, this list of conditions and the following disclaimer.

       * Redistributions in binary form must reproduce the above
         copyright notice, this list of conditions and the following
         disclaimer in the documentation and/or other materials provided
         with the distribution.

       * Neither the name of the author nor the names of its
         contributors may be used to endorse or promote products derived
         from this software without specific prior written permission.

     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
     COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
     OF THE POSSIBILITY OF SUCH DAMAGE.


File: python.info,  Node: libmpdec,  Next: W3C C14N test suite,  Prev: cfuhash,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.17 libmpdec
----------------

The ‘_decimal’ C extension underlying the *note decimal: 3a. module is
built using an included copy of the libmpdec library unless the build is
configured ‘--with-system-libmpdec’:

     Copyright (c) 2008-2020 Stefan Krah. All rights reserved.

     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
     are met:

     1. Redistributions of source code must retain the above copyright
        notice, this list of conditions and the following disclaimer.

     2. Redistributions in binary form must reproduce the above copyright
        notice, this list of conditions and the following disclaimer in the
        documentation and/or other materials provided with the distribution.

     THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     SUCH DAMAGE.


File: python.info,  Node: W3C C14N test suite,  Next: mimalloc,  Prev: libmpdec,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.18 W3C C14N test suite
---------------------------

The C14N 2.0 test suite in the *note test: e8. package
(‘Lib/test/xmltestdata/c14n-20/’) was retrieved from the W3C website at
‘https://www.w3.org/TR/xml-c14n2-testcases/’ and is distributed under
the 3-clause BSD license:

     Copyright (c) 2013 W3C(R) (MIT, ERCIM, Keio, Beihang),
     All Rights Reserved.

     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
     are met:

     * Redistributions of works must retain the original copyright notice,
       this list of conditions and the following disclaimer.
     * Redistributions in binary form must reproduce the original copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.
     * Neither the name of the W3C nor the names of its contributors may be
       used to endorse or promote products derived from this work without
       specific prior written permission.

     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


File: python.info,  Node: mimalloc,  Next: asyncio<15>,  Prev: W3C C14N test suite,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.19 mimalloc
----------------

MIT License:

     Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen

     Permission is hereby granted, free of charge, to any person obtaining a copy
     of this software and associated documentation files (the "Software"), to deal
     in the Software without restriction, including without limitation the rights
     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     copies of the Software, and to permit persons to whom the Software is
     furnished to do so, subject to the following conditions:

     The above copyright notice and this permission notice shall be included in all
     copies or substantial portions of the Software.

     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     SOFTWARE.


File: python.info,  Node: asyncio<15>,  Next: Global Unbounded Sequences GUS,  Prev: mimalloc,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.20 asyncio
---------------

Parts of the *note asyncio: b. module are incorporated from uvloop
0.16(1), which is distributed under the MIT license:

     Copyright (c) 2015-2021 MagicStack Inc.  http://magic.io

     Permission is hereby granted, free of charge, to any person obtaining
     a copy of this software and associated documentation files (the
     "Software"), to deal in the Software without restriction, including
     without limitation the rights to use, copy, modify, merge, publish,
     distribute, sublicense, and/or sell copies of the Software, and to
     permit persons to whom the Software is furnished to do so, subject to
     the following conditions:

     The above copyright notice and this permission notice shall be
     included in all copies or substantial portions of the Software.

     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
     LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
     OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
     WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

   ---------- Footnotes ----------

   (1) https://github.com/MagicStack/uvloop/tree/v0.16.0


File: python.info,  Node: Global Unbounded Sequences GUS,  Next: Zstandard bindings,  Prev: asyncio<15>,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.21 Global Unbounded Sequences (GUS)
----------------------------------------

The file ‘Python/qsbr.c’ is adapted from FreeBSD's "Global Unbounded
Sequences" safe memory reclamation scheme in subr_smr.c(1).  The file is
distributed under the 2-Clause BSD License:

     Copyright (c) 2019,2020 Jeffrey Roberson <jeff@FreeBSD.org>

     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
     are met:
     1. Redistributions of source code must retain the above copyright
        notice unmodified, this list of conditions, and the following
        disclaimer.
     2. Redistributions in binary form must reproduce the above copyright
        notice, this list of conditions and the following disclaimer in the
        documentation and/or other materials provided with the distribution.

     THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

   ---------- Footnotes ----------

   (1) 
https://github.com/freebsd/freebsd-src/blob/main/sys/kern/subr_smr.c


File: python.info,  Node: Zstandard bindings,  Prev: Global Unbounded Sequences GUS,  Up: Licenses and Acknowledgements for Incorporated Software

16.3.22 Zstandard bindings
--------------------------

Zstandard bindings in ‘Modules/_zstd’ and ‘Lib/compression/zstd’ are
based on code from the pyzstd library(1), copyright Ma Lin and
contributors.  The pyzstd code is distributed under the 3-Clause BSD
License:

     Copyright (c) 2020-present, Ma Lin and contributors.
     All rights reserved.

     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions are met:

     1. Redistributions of source code must retain the above copyright notice, this
        list of conditions and the following disclaimer.

     2. Redistributions in binary form must reproduce the above copyright notice,
        this list of conditions and the following disclaimer in the documentation
        and/or other materials provided with the distribution.

     3. Neither the name of the copyright holder nor the names of its
        contributors may be used to endorse or promote products derived from
        this software without specific prior written permission.

     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
     FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

   ---------- Footnotes ----------

   (1) https://github.com/Rogdham/pyzstd/


File: python.info,  Node: Pythonモジュール索引,  Next: 索引,  Prev: 歴史とライセンス,  Up: Top

Pythonモジュール索引
********************

* Menu:

* __future__: 0. Future statement definitions
* __main__: 1. The environment where top-level code is run. Covers
                        command-line interfaces, import-time
                        behavior, and ''__name__ ==
                        '__main__'''.
* _thread: 2. Low-level threading API.
* _tkinter: 3. A binary module that contains the low-level interface
                        to Tcl/Tk.
* abc: 4. Abstract base classes according to :pep:'3119'.
* aifc: 5. Removed in 3.13.
* annotationlib: 6. Functionality for introspecting annotations
* argparse: 7. Command-line option and argument parsing library.
* array: 8. Space efficient arrays of uniformly typed numeric
                        values.
* ast: 9. Abstract Syntax Tree classes and manipulation.
* asynchat: a. Removed in 3.12.
* asyncio: b. Asynchronous I/O.
* asyncore: c. Removed in 3.12.
* atexit: d. Register and execute cleanup functions.
* audioop: e. Removed in 3.13.
* base64: f. RFC 4648: Base16, Base32, Base64 Data
                        Encodings; Base85 and Ascii85
* bdb: 10. Debugger framework.
* binascii: 11. Tools for converting between binary and various ASCII-
                        encoded binary representations.
* bisect: 12. Array bisection algorithms for binary searching.
* builtins: 13. The module that provides the built-in namespace.
* bz2: 14. Interfaces for bzip2 compression and decompression.
* calendar: 15. Functions for working with calendars, including
                        some emulation of the Unix cal program.
* cgi: 16. Removed in 3.13.
* cgitb: 17. Removed in 3.13.
* chunk: 18. Removed in 3.13.
* cmath: 19. Mathematical functions for complex numbers.
* cmd: 1a. Build line-oriented command interpreters.
* code: 1b. Facilities to implement read-eval-print loops.
* codecs: 1c. Encode and decode data and streams.
* codeop: 1d. Compile (possibly incomplete) Python code.
* collections: 1e. Container datatypes
* collections.abc: 1f. Abstract base classes for containers
* colorsys: 20. Conversion functions between RGB and other color
                        systems.
* compileall: 21. Tools for byte-compiling all Python source files in a
                        directory tree.
* compression: 22.
* compression.zstd: 23. Low-level interface to compression and decompression
                        routines in the zstd library.
* concurrent.futures: 24. Execute computations concurrently using threads or
                        processes.
* concurrent.interpreters: 25. Multiple interpreters in the same process
* configparser: 26. Configuration file parser.
* contextlib: 27. Utilities for with-statement contexts.
* contextvars: 28. Context Variables
* copy: 29. Shallow and deep copy operations.
* copyreg: 2a. Register pickle support functions.
* cProfile: 2b.
* crypt: 2c. Removed in 3.13.
* csv: 2d. Write and read tabular data to and from delimited
                        files.
* ctypes: 2e. A foreign function library for Python.
* curses: 2f. An interface to the curses library, providing
                        portable terminal handling.
* curses.ascii: 30. Constants and set-membership functions for ASCII
                        characters.
* curses.panel: 31. A panel stack extension that adds depth to curses
                        windows.
* curses.textpad: 32. Emacs-like input editing in a curses window.
* dataclasses: 33. Generate special methods on user-defined classes.
* datetime: 34. Basic date and time types.
* dbm: 35. Interfaces to various Unix "database" formats.
* dbm.dumb: 36. Portable implementation of the simple DBM interface.
* dbm.gnu: 37. GNU database manager
* dbm.ndbm: 38. The New Database Manager
* dbm.sqlite3: 39. SQLite backend for dbm
* decimal: 3a. Implementation of the General Decimal Arithmetic
                        Specification.
* difflib: 3b. Helpers for computing differences between objects.
* dis: 3c. Disassembler for Python bytecode.
* distutils: 3d. Removed in 3.12.
* doctest: 3e. Test pieces of code within docstrings.
* email: 3f. Package supporting the parsing,
                        manipulating, and generating email messages.
* email.charset: 40. Character Sets
* email.contentmanager: 41. Storing and Retrieving Content from MIME Parts
* email.encoders: 42. Encoders for email message payloads.
* email.errors: 43. The exception classes used by the email package.
* email.generator: 44. Generate flat text email messages from a message
                        structure.
* email.header: 45. Representing non-ASCII headers
* email.headerregistry: 46. Automatic Parsing of headers based on the field name
* email.iterators: 47. Iterate over a message object tree.
* email.message: 48. The base class representing email messages.
* email.mime: 49. Build MIME messages.
* email.mime.application: 4a.
* email.mime.audio: 4b.
* email.mime.base: 4c.
* email.mime.image: 4d.
* email.mime.message: 4e.
* email.mime.multipart: 4f.
* email.mime.nonmultipart: 50.
* email.mime.text: 51.
* email.parser: 52. Parse flat text email messages to produce a message
                        object structure.
* email.policy: 53. Controlling the parsing and generating of messages
* email.utils: 54. Miscellaneous email package utilities.
* encodings: 55. Encodings package
* encodings.idna: 56. Internationalized Domain Names implementation
* encodings.mbcs: 57. Windows ANSI codepage
* encodings.utf_8_sig: 58. UTF-8 codec with BOM signature
* ensurepip: 59. Bootstrapping the "pip" installer into an existing
                        Python installation or virtual environment.
* enum: 5a. Implementation of an enumeration class.
* errno: 5b. Standard errno system symbols.
* faulthandler: 5c. Dump the Python traceback.
* fcntl: 5d. The fcntl() and ioctl() system calls.
* filecmp: 5e. Compare files efficiently.
* fileinput: 5f. Loop over standard input or a list of files.
* fnmatch: 60. Unix shell style filename pattern matching.
* fractions: 61. Rational numbers.
* ftplib: 62. FTP protocol client (requires sockets).
* functools: 63. Higher-order functions and operations on callable
                        objects.
* gc: 64. Interface to the cycle-detecting garbage collector.
* getopt: 65. Portable parser for command line options; support both
                        short and long option names.
* getpass: 66. Portable reading of passwords and retrieval of the
                        userid.
* gettext: 67. Multilingual internationalization services.
* glob: 68. Unix shell style pathname pattern expansion.
* graphlib: 69. Functionality to operate with graph-like structures
* grp: 6a. The group database (getgrnam() and friends).
* gzip: 6b. Interfaces for gzip compression and decompression
                        using file objects.
* hashlib: 6c. Secure hash and message digest algorithms.
* heapq: 6d. Heap queue algorithm (a.k.a. priority queue).
* hmac: 6e. Keyed-Hashing for Message Authentication (HMAC)
                        implementation
* html: 6f. Helpers for manipulating HTML.
* html.entities: 70. Definitions of HTML general entities.
* html.parser: 71. A simple parser that can handle HTML and XHTML.
* http: 72. HTTP status codes and messages
* http.client: 73. HTTP and HTTPS protocol client (requires sockets).
* http.cookiejar: 74. Classes for automatic handling of HTTP cookies.
* http.cookies: 75. Support for HTTP state management (cookies).
* http.server: 76. HTTP server and request handlers.
* idlelib: 77. Implementation package for the IDLE shell/editor.
* imaplib: 78. IMAP4 protocol client (requires sockets).
* imghdr: 79. Removed in 3.13.
* imp: 7a. Removed in 3.12.
* importlib: 7b. The implementation of the import machinery.
* importlib.abc: 7c. Abstract base classes related to import
* importlib.machinery: 7d. Importers and path hooks
* importlib.metadata: 7e. Accessing package metadata
* importlib.resources: 7f. Package resource reading, opening, and
                        access
* importlib.resources.abc: 80. Abstract base classes for resources
* importlib.util: 81. Utility code for importers
* inspect: 82. Extract information and source code from live objects.
* io: 83. Core tools for working with streams.
* ipaddress: 84. IPv4/IPv6 manipulation library.
* itertools: 85. Functions creating iterators for efficient looping.
* json: 86. Encode and decode the JSON format.
* json.tool: 87. A command-line interface to validate and pretty-print
                        JSON.
* keyword: 88. Test whether a string is a keyword in Python.
* linecache: 89. Provides random access to individual lines from text
                        files.
* locale: 8a. Internationalization services.
* logging: 8b. Flexible event logging system for applications.
* logging.config: 8c. Configuration of the logging module.
* logging.handlers: 8d. Handlers for the logging module.
* lzma: 8e. A Python wrapper for the liblzma compression library.
* mailbox: 8f. Manipulate mailboxes in various formats
* mailcap: 90. Removed in 3.13.
* marshal: 91. Convert Python objects to streams of bytes and back
                        (with different constraints).
* math: 92. Mathematical functions (sin() etc.).
* mimetypes: 93. Mapping of filename extensions to MIME types.
* mmap: 94. Interface to memory-mapped files for Unix and Windows.
* modulefinder: 95. Find modules used by a script.
* msilib: 96. Removed in 3.13.
* msvcrt: 97. Miscellaneous useful routines from the MS VC++
                        runtime.
* multiprocessing: 98. Process-based parallelism.
* multiprocessing.connection: 99. API for dealing with sockets.
* multiprocessing.dummy: 9a. Dumb wrapper around threading.
* multiprocessing.managers: 9b. Share data between process with shared objects.
* multiprocessing.pool: 9c. Create pools of processes.
* multiprocessing.shared_memory: 9d. Provides shared memory for direct access
                                 across processes.
* multiprocessing.sharedctypes: 9e. Allocate ctypes objects from shared memory.
* netrc: 9f. Loading of .netrc files.
* nis: a0. Removed in 3.13.
* nntplib: a1. Removed in 3.13.
* numbers: a2. Numeric abstract base classes (Complex,
                        Real, Integral, etc.).
* operator: a3. Functions corresponding to the standard operators.
* optparse: a4. Command-line option parsing library.
* os: a5. Miscellaneous operating system interfaces.
* os.path: a6. Operations on pathnames.
* ossaudiodev: a7. Removed in 3.13.
* pathlib: a8. Object-oriented filesystem paths
* pathlib.types: a9. pathlib types for static type checking
* pdb: aa. The Python debugger for interactive interpreters.
* pickle: ab. Convert Python objects to streams of bytes and back.
* pickletools: ac. Contains extensive comments about the pickle protocols
                        and pickle-machine opcodes, as well as some
                        useful functions.
* pipes: ad. Removed in 3.13.
* pkgutil: ae. Utilities for the import system.
* platform: af. Retrieves as much platform identifying data as
                        possible.
* plistlib: b0. Generate and parse Apple plist files.
* poplib: b1. POP3 protocol client (requires sockets).
* posix: b2. The most common POSIX system calls (normally used via
                        module os).
* pprint: b3. Data pretty printer.
* profile: b4. Python source profiler.
* pstats: b5. Statistics object for use with the profiler.
* pty: b6. Pseudo-Terminal Handling for Unix.
* pwd: b7. The password database (getpwnam() and friends).
* py_compile: b8. Generate byte-code files from Python source files.
* pyclbr: b9. Supports information extraction for a Python module
                        browser.
* pydoc: ba. Documentation generator and online help system.
* queue: bb. A synchronized queue class.
* quopri: bc. Encode and decode files using the MIME quoted-
                        printable encoding.
* random: bd. Generate pseudo-random numbers with various common
                        distributions.
* re: be. Regular expression operations.
* readline: bf. GNU readline support for Python.
* reprlib: c0. Alternate repr() implementation with size limits.
* resource: c1. An interface to provide resource usage information on
                        the current process.
* rlcompleter: c2. Python identifier completion, suitable for the
                        GNU readline library.
* runpy: c3. Locate and run Python modules without importing them
                        first.
* sched: c4. General purpose event scheduler.
* secrets: c5. Generate secure random numbers for managing secrets.
* select: c6. Wait for I/O completion on multiple streams.
* selectors: c7. High-level I/O multiplexing.
* shelve: c8. Python object persistence.
* shlex: c9. Simple lexical analysis for Unix shell-like languages.
* shutil: ca. High-level file operations, including copying.
* signal: cb. Set handlers for asynchronous events.
* site: cc. Module responsible for site-specific configuration.
* sitecustomize: cd.
* smtpd: ce. Removed in 3.12.
* smtplib: cf. SMTP protocol client (requires sockets).
* sndhdr: d0. Removed in 3.13.
* socket: d1. Low-level networking interface.
* socketserver: d2. A framework for network servers.
* spwd: d3. Removed in 3.13.
* sqlite3: d4. A DB-API 2.0 implementation using SQLite 3.x.
* ssl: d5. TLS/SSL wrapper for socket objects
* stat: d6. Utilities for interpreting the results of
                        os.stat(), os.lstat() and os.fstat().
* statistics: d7. Mathematical statistics functions
* string: d8. Common string operations.
* string.templatelib: d9. Support for template string literals.
* stringprep: da. String preparation, as per RFC 3453
* struct: db. Interpret bytes as packed binary data.
* subprocess: dc. Subprocess management.
* sunau: dd. Removed in 3.13.
* symtable: de. Interface to the compiler's internal symbol tables.
* sys: df. Access system-specific parameters and functions.
* sys.monitoring: e0. Access and control event monitoring
* sysconfig: e1. Python's configuration information
* syslog: e2. An interface to the Unix syslog library routines.
* tabnanny: e3. Tool for detecting white space related problems in
                        Python source files in a directory tree.
* tarfile: e4. Read and write tar-format archive files.
* telnetlib: e5. Removed in 3.13.
* tempfile: e6. Generate temporary files and directories.
* termios: e7. POSIX style tty control.
* test: e8. Regression tests package containing the testing suite
                        for Python.
* test.regrtest: e9. Drives the regression test suite.
* test.support: ea. Support for Python's regression test suite.
* test.support.bytecode_helper: eb. Support tools for testing correct bytecode
                                generation.
* test.support.import_helper: ec. Support for import tests.
* test.support.os_helper: ed. Support for os tests.
* test.support.script_helper: ee. Support for Python's script execution tests.
* test.support.socket_helper: ef. Support for socket tests.
* test.support.threading_helper: f0. Support for threading tests.
* test.support.warnings_helper: f1. Support for warnings tests.
* textwrap: f2. Text wrapping and filling
* threading: f3. Thread-based parallelism.
* time: f4. Time access and conversions.
* timeit: f5. Measure the execution time of small code snippets.
* tkinter: f6. Interface to Tcl/Tk for graphical user interfaces
* tkinter.colorchooser: f7. Color choosing dialog
* tkinter.commondialog: f8. Tkinter base class for dialogs
* tkinter.dnd: f9. Tkinter drag-and-drop interface
* tkinter.filedialog: fa. Dialog classes for file selection
* tkinter.font: fb. Tkinter font-wrapping class
* tkinter.messagebox: fc. Various types of alert dialogs
* tkinter.scrolledtext: fd. Text widget with a vertical scroll bar.
* tkinter.simpledialog: fe. Simple dialog windows
* tkinter.ttk: ff. Tk themed widget set
* token: 100. Constants representing terminal nodes of the parse
                        tree.
* tokenize: 101. Lexical scanner for Python source code.
* tomllib: 102. Parse TOML files.
* trace: 103. Trace or track Python statement execution.
* traceback: 104. Print or retrieve a stack traceback.
* tracemalloc: 105. Trace memory allocations.
* tty: 106. Utility functions that perform common terminal control
                        operations.
* turtle: 107. An educational framework for simple graphics
                        applications
* turtledemo: 108. A viewer for example turtle scripts
* types: 109. Names for built-in types.
* typing: 10a. Support for type hints (see :pep:'484').
* unicodedata: 10b. Access the Unicode Database.
* unittest: 10c. Unit testing framework for Python.
* unittest.mock: 10d. Mock object library.
* urllib: 10e.
* urllib.error: 10f. Exception classes raised by urllib.request.
* urllib.parse: 110. Parse URLs into or assemble them from components.
* urllib.request: 111. Extensible library for opening URLs.
* urllib.response: 112. Response classes used by urllib.
* urllib.robotparser: 113. Load a robots.txt file and answer questions about
                        fetchability of other URLs.
* usercustomize: 114.
* uu: 115. Removed in 3.13.
* uuid: 116. UUID objects (universally unique identifiers)
                        according to RFC 9562
* venv: 117. Creation of virtual environments.
* warnings: 118. Issue warning messages and control their disposition.
* wave: 119. Provide an interface to the WAV sound format.
* weakref: 11a. Support for weak references and weak dictionaries.
* webbrowser: 11b. Easy-to-use controller for web browsers.
* winreg: 11c. Routines and objects for manipulating the Windows
                        registry.
* winsound: 11d. Access to the sound-playing machinery for Windows.
* wsgiref: 11e. WSGI Utilities and Reference Implementation.
* wsgiref.handlers: 11f. WSGI server/gateway base classes.
* wsgiref.headers: 120. WSGI response header tools.
* wsgiref.simple_server: 121. A simple WSGI HTTP server.
* wsgiref.types: 122. WSGI types for static type checking
* wsgiref.util: 123. WSGI environment utilities.
* wsgiref.validate: 124. WSGI conformance checker.
* xdrlib: 125. Removed in 3.13.
* xml: 126. Package containing XML processing modules
* xml.dom: 127. Document Object Model API for Python.
* xml.dom.minidom: 128. Minimal Document Object Model (DOM) implementation.
* xml.dom.pulldom: 129. Support for building partial DOM trees from SAX
                        events.
* xml.etree.ElementInclude: 12a.
* xml.etree.ElementTree: 12b. Implementation of the ElementTree API.
* xml.parsers.expat: 12c. An interface to the Expat non-validating XML parser.
* xml.parsers.expat.errors: 12d.
* xml.parsers.expat.model: 12e.
* xml.sax: 12f. Package containing SAX2 base classes and convenience
                        functions.
* xml.sax.handler: 130. Base classes for SAX event handlers.
* xml.sax.saxutils: 131. Convenience functions and classes for use with SAX.
* xml.sax.xmlreader: 132. Interface which SAX-compliant XML parsers must
                        implement.
* xmlrpc: 133. Server and client modules implementing XML-RPC.
* xmlrpc.client: 134. XML-RPC client access.
* xmlrpc.server: 135. Basic XML-RPC server implementations.
* zipapp: 136. Manage executable Python zip archives
* zipfile: 137. Read and write ZIP-format archive files.
* zipimport: 138. Support for importing Python modules from ZIP
                        archives.
* zlib: 139. Low-level interface to compression and decompression
                        routines compatible with gzip.
* zoneinfo: 13a. IANA time zone support


File: python.info,  Node: 索引,  Prev: Pythonモジュール索引,  Up: Top

索引
****

[index]
* Menu:

* _ (下線);gettext:                      GNU gettext API.    (line   33)
* _ (下線);in numeric literal:           数値リテラル.       (line   20)
* _ (下線);in numeric literal <1>:       整数リテラル.       (line   64)
* _ (下線);文字列のフォーマットで:       書式指定ミニ言語仕様.
                                                             (line  130)
* __, identifiers:                       ソフトキーワード.   (line   24)
* __abs__() (object のメソッド):         数値型をエミュレートする.
                                                             (line  115)
* __abs__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line   83)
* __add__() (object のメソッド):         数値型をエミュレートする.
                                                             (line   11)
* __add__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line   88)
* __aenter__() (object のメソッド):      非同期コンテキストマネージャ Asynchronous Context Manager.
                                                             (line   13)
* __aexit__() (object のメソッド):       非同期コンテキストマネージャ Asynchronous Context Manager.
                                                             (line   18)
* __aiter__() (object のメソッド):       非同期イテレータ Asynchronous Iterator.
                                                             (line   13)
* __all__:                               パッケージから * を import する.
                                                             (line    6)
* __all__ (module の属性):               import 文.          (line   85)
* __all__ (package variable):            モジュールのインポート<2>.
                                                             (line    8)
* __all__ (オプションの module 属性):    import 文.          (line   85)
* __and__() (enum.Flag のメソッド):      データ型<2>.        (line  502)
* __and__() (object のメソッド):         数値型をエミュレートする.
                                                             (line   11)
* __and__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line   93)
* __anext__() (agen のメソッド):         非同期ジェネレータイテレータメソッド.
                                                             (line    9)
* __anext__() (object のメソッド):       非同期イテレータ Asynchronous Iterator.
                                                             (line   17)
* __annotate__ (class attribute):        Special attributes. (line    6)
* __annotate__ (function attribute):     Special writable attributes.
                                                             (line    6)
* __annotate__ (function の属性):        Special writable attributes.
                                                             (line   55)
* __annotate__ (module attribute):       モジュール<3>.      (line   21)
* __annotate__ (module の属性):          Other writable attributes on module objects.
                                                             (line   23)
* __annotate__() (object のメソッド):    Annotations.        (line   20)
* __annotate__() (type のメソッド):      Special attributes. (line   70)
* __annotations__ (class attribute):     Special attributes. (line    6)
* __annotations__ (function の属性):     Special writable attributes.
                                                             (line   45)
* __annotations__ (module attribute):    モジュール<3>.      (line   21)
* __annotations__ (module の属性):       Other writable attributes on module objects.
                                                             (line   14)
* __annotations__ (object の属性):       Annotations.        (line   10)
* __annotations__ (type の属性):         Special attributes. (line   42)
* __annotations__ (関数属性):            Special writable attributes.
                                                             (line    6)
* __args__ (genericalias の属性):        GenericAlias オブジェクトの特別な属性.
                                                             (line   17)
* __await__() (object のメソッド):       待機可能オブジェクト Awaitable Object.
                                                             (line   15)
* __base__ (class attribute):            Special attributes. (line    6)
* __base__ (type の属性):                Special attributes. (line   32)
* __bases__ (type の属性):               Special attributes. (line   26)
* __bases__ (クラス属性):                Special attributes. (line    6)
* __bool__() (object のメソッド):        基本的なカスタマイズ.
                                                             (line  317)
* __bool__() (オブジェクトメソッド):     コンテナをエミュレートする.
                                                             (line   46)
* __bound__ (typing.TypeVar の属性):     Building generic types and type aliases.
                                                             (line  175)
* __breakpointhook__ (sys モジュール):   sys --- システム固有のパラメーターと関数.
                                                             (line  412)
* __buffer__() (object のメソッド):      Emulating buffer types.
                                                             (line   15)
* __builtins__ (function attribute):     Special read-only attributes.
                                                             (line    6)
* __builtins__ (function の属性):        Special read-only attributes.
                                                             (line   10)
* __bytes__() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  129)
* __bytes__() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  139)
* __bytes__() (object のメソッド):       基本的なカスタマイズ.
                                                             (line  142)
* __cached__ (module attribute):         モジュール<3>.      (line   21)
* __cached__ (module の属性):            Import-related attributes on module objects.
                                                             (line  137)
* __call__() (argparse.Action のメソッド): Action クラス.    (line   28)
* __call__() (email.headerregistry.HeaderRegistry のメソッド): email headerregistry Custom Header Objects.
                                                             (line  384)
* __call__() (enum.EnumType のメソッド): データ型<2>.        (line   20)
* __call__() (object のメソッド):        呼び出し可能オブジェクトをエミュレートする.
                                                             (line    6)
* __call__() (operator モジュール):      operator --- 関数形式の標準演算子.
                                                             (line  228)
* __call__() (weakref.finalize のメソッド): weakref --- Weak references.
                                                             (line  285)
* __call__() (オブジェクトメソッド):     呼び出し call.      (line  154)
* __callback__ (weakref.ref の属性):     weakref --- Weak references.
                                                             (line  119)
* __cause__ (BaseException の属性):      例外コンテキスト.   (line    9)
* __cause__ (exception の属性):          raise 文.           (line   30)
* __cause__ (exception の属性) <1>:      例外コンテキスト.   (line    6)
* __cause__ (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   44)
* __ceil__() (fractions.Fraction のメソッド): fractions --- 有理数.
                                                             (line  195)
* __ceil__() (object のメソッド):        数値型をエミュレートする.
                                                             (line  145)
* __class__ (method cell):               クラスオブジェクトの作成.
                                                             (line    6)
* __class__ (module attribute):          モジュールの属性値アクセスをカスタマイズする.
                                                             (line    6)
* __class__ (module の属性):             モジュールの属性値アクセスをカスタマイズする.
                                                             (line   23)
* __class__ (object の属性):             Special attributes<2>.
                                                             (line    6)
* __class__ (unittest.mock.Mock の属性): Mock クラス.        (line  553)
* __class__ (インスタンス属性):          Special attributes<2>.
                                                             (line    6)
* __class_getitem__() (object のクラスメソッド): ジェネリック型をエミュレートする.
                                                             (line   32)
* __classcell__ (class namespace entry): クラスオブジェクトの作成.
                                                             (line    6)
* __closure__ (function の属性):         Special read-only attributes.
                                                             (line   22)
* __closure__ (関数属性):                Special read-only attributes.
                                                             (line    6)
* __code__ (function の属性):            Special writable attributes.
                                                             (line   36)
* __code__ (関数オブジェクトの属性):     コードオブジェクト<2>.
                                                             (line    6)
* __code__ (関数属性):                   Special writable attributes.
                                                             (line    6)
* __complex__() (object のメソッド):     数値型をエミュレートする.
                                                             (line  123)
* __concat__() (operator モジュール):    operator --- 関数形式の標準演算子.
                                                             (line  184)
* __constraints__ (typing.TypeVar の属性): Building generic types and type aliases.
                                                             (line  196)
* __contains__() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  179)
* __contains__() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  302)
* __contains__() (enum.EnumType のメソッド): データ型<2>.    (line   64)
* __contains__() (enum.Flag のメソッド): データ型<2>.        (line  439)
* __contains__() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  199)
* __contains__() (object のメソッド):    コンテナをエミュレートする.
                                                             (line  168)
* __contains__() (operator モジュール):  operator --- 関数形式の標準演算子.
                                                             (line  189)
* __context__ (BaseException の属性):    例外コンテキスト.   (line    9)
* __context__ (exception の属性):        raise 文.           (line   30)
* __context__ (exception の属性) <1>:    例外コンテキスト.   (line    6)
* __context__ (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   48)
* __contravariant__ (typing.TypeVar の属性): Building generic types and type aliases.
                                                             (line  163)
* __copy__() (コピープロトコル):         copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   81)
* __covariant__ (typing.TypeVar の属性): Building generic types and type aliases.
                                                             (line  159)
* __debug__:                             assert 文.          (line   22)
* __debug__ (組み込み変数):              組み込み定数.       (line   68)
* __deepcopy__() (コピープロトコル):     copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   81)
* __default__ (typing.ParamSpec の属性): Building generic types and type aliases.
                                                             (line  475)
* __default__ (typing.TypeVar の属性):   Building generic types and type aliases.
                                                             (line  218)
* __default__ (typing.TypeVarTuple の属性): Building generic types and type aliases.
                                                             (line  362)
* __defaults__ (function の属性):        Special writable attributes.
                                                             (line   30)
* __defaults__ (関数属性):               Special writable attributes.
                                                             (line    6)
* __del__() (io.IOBase のメソッド):      I/O 基底クラス.     (line  164)
* __del__() (object のメソッド):         基本的なカスタマイズ.
                                                             (line   51)
* __delattr__() (object のメソッド):     属性値アクセスをカスタマイズする.
                                                             (line   69)
* __delete__() (object のメソッド):      デスクリプタ descriptor の実装.
                                                             (line   42)
* __delitem__() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  226)
* __delitem__() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  337)
* __delitem__() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line   76)
* __delitem__() (mailbox.MH のメソッド): MH オブジェクト.    (line   81)
* __delitem__() (object のメソッド):     コンテナをエミュレートする.
                                                             (line  127)
* __delitem__() (operator モジュール):   operator --- 関数形式の標準演算子.
                                                             (line  199)
* __dict__ (function の属性):            Special writable attributes.
                                                             (line   40)
* __dict__ (module の属性):              Module dictionaries.
                                                             (line    8)
* __dict__ (object の属性):              Special attributes<2>.
                                                             (line   10)
* __dict__ (type の属性):                Special attributes. (line   21)
* __dict__ (インスタンス属性):           Special attributes<2>.
                                                             (line    6)
* __dict__ (クラス属性):                 Special attributes. (line    6)
* __dict__ (モジュール属性):             Module dictionaries.
                                                             (line    8)
* __dict__ (モジュール属性) <1>:         モジュールオブジェクト module object.
                                                             (line   46)
* __dict__ (関数属性):                   Special writable attributes.
                                                             (line    6)
* __dir__ (module attribute):            モジュールの属性値アクセスをカスタマイズする.
                                                             (line    6)
* __dir__() (enum.Enum のメソッド):      データ型<2>.        (line  174)
* __dir__() (enum.EnumType のメソッド):  データ型<2>.        (line   77)
* __dir__() (module のメソッド):         モジュールの属性値アクセスをカスタマイズする.
                                                             (line    6)
* __dir__() (object のメソッド):         属性値アクセスをカスタマイズする.
                                                             (line   79)
* __dir__() (unittest.mock.Mock のメソッド): Mock クラス.    (line  296)
* __displayhook__ (sys モジュール):      sys --- システム固有のパラメーターと関数.
                                                             (line  412)
* __divmod__() (object のメソッド):      数値型をエミュレートする.
                                                             (line   11)
* __doc__ (definition の属性):           特殊属性.           (line   26)
* __doc__ (function の属性):             Special writable attributes.
                                                             (line   12)
* __doc__ (method の属性):               インスタンスメソッド.
                                                             (line   18)
* __doc__ (module の属性):               Other writable attributes on module objects.
                                                             (line    9)
* __doc__ (type の属性):                 Special attributes. (line   38)
* __doc__ (クラス属性):                  Special attributes. (line    6)
* __doc__ (メソッド属性):                インスタンスメソッド.
                                                             (line    9)
* __doc__ (モジュール属性):              モジュール<3>.      (line   21)
* __doc__ (モジュール属性) <1>:          モジュールオブジェクト module object.
                                                             (line   25)
* __doc__ (関数属性):                    Special writable attributes.
                                                             (line    6)
* __enter__() (contextmanager のメソッド): コンテキストマネージャ型.
                                                             (line   11)
* __enter__() (object のメソッド):       with文とコンテキストマネージャ.
                                                             (line   21)
* __enter__() (winreg.PyHKEY のメソッド): レジストリハンドルオブジェクト.
                                                             (line   53)
* __eq__() (email.charset.Charset のメソッド): email charset 文字集合の表現.
                                                             (line  155)
* __eq__() (email.header.Header のメソッド): email header 国際化されたヘッダー.
                                                             (line  163)
* __eq__() (memoryview のメソッド):      メモリビュー.       (line  116)
* __eq__() (object のメソッド):          基本的なカスタマイズ.
                                                             (line  175)
* __eq__() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line   24)
* __eq__() (インスタンスメソッド):       比較<2>.            (line   49)
* __excepthook__ (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line  412)
* __excepthook__ (threading モジュール): リファレンス<2>.    (line   63)
* __exit__() (contextmanager のメソッド): コンテキストマネージャ型.
                                                             (line   30)
* __exit__() (object のメソッド):        with文とコンテキストマネージャ.
                                                             (line   27)
* __exit__() (winreg.PyHKEY のメソッド): レジストリハンドルオブジェクト.
                                                             (line   53)
* __file__ (module の属性):              Import-related attributes on module objects.
                                                             (line  135)
* __file__ (モジュール属性):             モジュール<3>.      (line   21)
* __file__ (モジュール属性) <1>:         モジュールオブジェクト module object.
                                                             (line   25)
* __file__ (モジュール属性) <2>:         モジュールオブジェクト module object.
                                                             (line   99)
* __firstlineno__ (class attribute):     Special attributes. (line    6)
* __firstlineno__ (type の属性):         Special attributes. (line   91)
* __float__() (object のメソッド):       数値型をエミュレートする.
                                                             (line  123)
* __floor__() (fractions.Fraction のメソッド): fractions --- 有理数.
                                                             (line  186)
* __floor__() (object のメソッド):       数値型をエミュレートする.
                                                             (line  145)
* __floordiv__() (object のメソッド):    数値型をエミュレートする.
                                                             (line   11)
* __floordiv__() (operator モジュール):  operator --- 関数形式の標準演算子.
                                                             (line   98)
* __format__:                            組み込み関数.       (line  778)
* __format__() (datetime.date のメソッド): date objects.     (line  332)
* __format__() (datetime.datetime のメソッド): datetime objects.
                                                             (line  762)
* __format__() (datetime.time のメソッド): time objects.     (line  240)
* __format__() (enum.Enum のメソッド):   データ型<2>.        (line  317)
* __format__() (fractions.Fraction のメソッド): fractions --- 有理数.
                                                             (line  210)
* __format__() (ipaddress.IPv4Address のメソッド): Address オブジェクト.
                                                             (line  196)
* __format__() (ipaddress.IPv6Address のメソッド): Address オブジェクト.
                                                             (line  326)
* __format__() (object のメソッド):      基本的なカスタマイズ.
                                                             (line  149)
* __forward_arg__ (annotationlib.ForwardRef の属性): クラス<5>.
                                                             (line   59)
* __fspath__() (os.PathLike のメソッド): プロセスのパラメーター.
                                                             (line  151)
* __func__ (method の属性):              インスタンスメソッド.
                                                             (line   15)
* __func__ (メソッド属性):               インスタンスメソッド.
                                                             (line    9)
* __future__:                            用語集<2>.          (line  691)
* __future__;future statement:           future 文 future statement.
                                                             (line    6)
* __ge__() (object のメソッド):          基本的なカスタマイズ.
                                                             (line  175)
* __ge__() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line   24)
* __ge__() (インスタンスメソッド):       比較<2>.            (line   49)
* __get__() (object のメソッド):         デスクリプタ descriptor の実装.
                                                             (line   15)
* __getattr__ (module attribute):        モジュールの属性値アクセスをカスタマイズする.
                                                             (line    6)
* __getattr__() (module のメソッド):     モジュールの属性値アクセスをカスタマイズする.
                                                             (line    6)
* __getattr__() (object のメソッド):     属性値アクセスをカスタマイズする.
                                                             (line   10)
* __getattribute__() (object のメソッド): 属性値アクセスをカスタマイズする.
                                                             (line   33)
* __getitem__() (email.headerregistry.HeaderRegistry のメソッド): email headerregistry Custom Header Objects.
                                                             (line  379)
* __getitem__() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  189)
* __getitem__() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  312)
* __getitem__() (enum.EnumType のメソッド): データ型<2>.     (line   85)
* __getitem__() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  146)
* __getitem__() (object のメソッド):     コンテナをエミュレートする.
                                                             (line   82)
* __getitem__() (operator モジュール):   operator --- 関数形式の標準演算子.
                                                             (line  204)
* __getitem__() (re.Match のメソッド):   マッチオブジェクト. (line   85)
* __getitem__() (マップオブジェクトのメソッド): 特殊メソッド名.
                                                             (line    6)
* __getnewargs__() (object のメソッド):  クラスインスタンスの pickle 化.
                                                             (line   45)
* __getnewargs_ex__() (object のメソッド): クラスインスタンスの pickle 化.
                                                             (line   28)
* __getstate__() (copy プロトコル):      状態を持つオブジェクトの扱い.
                                                             (line    6)
* __getstate__() (object のメソッド):    クラスインスタンスの pickle 化.
                                                             (line   59)
* __globals__ (function の属性):         Special read-only attributes.
                                                             (line   16)
* __globals__ (関数属性):                Special read-only attributes.
                                                             (line    6)
* __gt__() (object のメソッド):          基本的なカスタマイズ.
                                                             (line  175)
* __gt__() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line   24)
* __gt__() (インスタンスメソッド):       比較<2>.            (line   49)
* __hash__() (object のメソッド):        基本的なカスタマイズ.
                                                             (line  236)
* __iadd__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   84)
* __iadd__() (operator モジュール):      インプレース in-place 演算子.
                                                             (line   34)
* __iand__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   84)
* __iand__() (operator モジュール):      インプレース in-place 演算子.
                                                             (line   39)
* __iconcat__() (operator モジュール):   インプレース in-place 演算子.
                                                             (line   44)
* __ifloordiv__() (object のメソッド):   数値型をエミュレートする.
                                                             (line   84)
* __ifloordiv__() (operator モジュール): インプレース in-place 演算子.
                                                             (line   50)
* __ilshift__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   84)
* __ilshift__() (operator モジュール):   インプレース in-place 演算子.
                                                             (line   55)
* __imatmul__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   84)
* __imatmul__() (operator モジュール):   インプレース in-place 演算子.
                                                             (line   70)
* __imod__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   84)
* __imod__() (operator モジュール):      インプレース in-place 演算子.
                                                             (line   60)
* __import__() (importlib モジュール):   関数<13>.           (line    6)
* __imul__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   84)
* __imul__() (operator モジュール):      インプレース in-place 演算子.
                                                             (line   65)
* __index__() (object のメソッド):       数値型をエミュレートする.
                                                             (line  131)
* __index__() (operator モジュール):     operator --- 関数形式の標準演算子.
                                                             (line  103)
* __infer_variance__ (typing.TypeVar の属性): Building generic types and type aliases.
                                                             (line  168)
* __init__() (asyncio.Future のメソッド): Future and Task private constructors.
                                                             (line   17)
* __init__() (asyncio.Task のメソッド):  Future and Task private constructors.
                                                             (line   23)
* __init__() (difflib.HtmlDiff のメソッド): difflib --- 差分の計算の補助.
                                                             (line   89)
* __init__() (enum.Enum のメソッド):     データ型<2>.        (line  225)
* __init__() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   14)
* __init__() (logging.logging.Formatter のメソッド): フォーマッタ.
                                                             (line   14)
* __init__() (object のメソッド):        基本的なカスタマイズ.
                                                             (line   35)
* __init_subclass__() (enum.Enum のメソッド): データ型<2>.   (line  237)
* __init_subclass__() (object のクラスメソッド): クラス生成をカスタマイズする.
                                                             (line   13)
* __instancecheck__() (type のメソッド): インスタンスのカスタマイズとサブクラスチェック.
                                                             (line   14)
* __int__() (object のメソッド):         数値型をエミュレートする.
                                                             (line  123)
* __interactivehook__ (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 1203)
* __inv__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  111)
* __invert__() (object のメソッド):      数値型をエミュレートする.
                                                             (line  115)
* __invert__() (operator モジュール):    operator --- 関数形式の標準演算子.
                                                             (line  111)
* __ior__() (object のメソッド):         数値型をエミュレートする.
                                                             (line   84)
* __ior__() (operator モジュール):       インプレース in-place 演算子.
                                                             (line   77)
* __ipow__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   84)
* __ipow__() (operator モジュール):      インプレース in-place 演算子.
                                                             (line   82)
* __irshift__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   84)
* __irshift__() (operator モジュール):   インプレース in-place 演算子.
                                                             (line   87)
* __isub__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   84)
* __isub__() (operator モジュール):      インプレース in-place 演算子.
                                                             (line   92)
* __iter__() (container のメソッド):     イテレータ型.       (line   14)
* __iter__() (enum.EnumType のメソッド): データ型<2>.        (line   93)
* __iter__() (iterator のメソッド):      イテレータ型.       (line   29)
* __iter__() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  115)
* __iter__() (object のメソッド):        コンテナをエミュレートする.
                                                             (line  142)
* __iter__() (unittest.TestSuite のメソッド): テストのグループ化.
                                                             (line   59)
* __itruediv__() (object のメソッド):    数値型をエミュレートする.
                                                             (line   84)
* __itruediv__() (operator モジュール):  インプレース in-place 演算子.
                                                             (line   97)
* __ixor__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   84)
* __ixor__() (operator モジュール):      インプレース in-place 演算子.
                                                             (line  102)
* __kwdefaults__ (function の属性):      Special writable attributes.
                                                             (line   62)
* __kwdefaults__ (関数属性):             Special writable attributes.
                                                             (line    6)
* __le__() (object のメソッド):          基本的なカスタマイズ.
                                                             (line  175)
* __le__() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line   24)
* __le__() (インスタンスメソッド):       比較<2>.            (line   49)
* __len__() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  175)
* __len__() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  298)
* __len__() (enum.EnumType のメソッド):  データ型<2>.        (line  100)
* __len__() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  204)
* __len__() (object のメソッド):         コンテナをエミュレートする.
                                                             (line   44)
* __len__() (マップオブジェクトのメソッド): 基本的なカスタマイズ.
                                                             (line  319)
* __length_hint__() (object のメソッド): コンテナをエミュレートする.
                                                             (line   59)
* __loader__ (module attribute):         モジュール<3>.      (line   21)
* __loader__ (module attribute) <1>:     モジュールオブジェクト module object.
                                                             (line   25)
* __loader__ (module の属性):            Import-related attributes on module objects.
                                                             (line   97)
* __lshift__() (object のメソッド):      数値型をエミュレートする.
                                                             (line   11)
* __lshift__() (operator モジュール):    operator --- 関数形式の標準演算子.
                                                             (line  118)
* __lt__() (object のメソッド):          基本的なカスタマイズ.
                                                             (line  175)
* __lt__() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line   24)
* __lt__() (インスタンスメソッド):       比較<2>.            (line   49)
* __matmul__() (object のメソッド):      数値型をエミュレートする.
                                                             (line   11)
* __matmul__() (operator モジュール):    operator --- 関数形式の標準演算子.
                                                             (line  133)
* __members__ (enum.EnumType の属性):    データ型<2>.        (line  107)
* __missing__():                         マッピング型 --- dict.
                                                             (line  112)
* __missing__() (collections.defaultdict のメソッド): defaultdict オブジェクト.
                                                             (line   21)
* __missing__() (object のメソッド):     コンテナをエミュレートする.
                                                             (line  136)
* __mod__() (object のメソッド):         数値型をエミュレートする.
                                                             (line   11)
* __mod__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  123)
* __module__ (definition の属性):        特殊属性.           (line   22)
* __module__ (function の属性):          Special writable attributes.
                                                             (line   26)
* __module__ (method の属性):            インスタンスメソッド.
                                                             (line   28)
* __module__ (type の属性):              Special attributes. (line   18)
* __module__ (typing.NewType の属性):    Other special directives.
                                                             (line  121)
* __module__ (typing.TypeAliasType の属性): Building generic types and type aliases.
                                                             (line  573)
* __module__ (クラス属性):               Special attributes. (line    6)
* __module__ (メソッド属性):             インスタンスメソッド.
                                                             (line    9)
* __module__ (関数属性):                 Special writable attributes.
                                                             (line    6)
* __mro__ (type の属性):                 Special attributes. (line   99)
* __mro_entries__() (object のメソッド): MRO エントリの解決. (line    6)
* __mul__() (object のメソッド):         数値型をエミュレートする.
                                                             (line   11)
* __mul__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  128)
* __mutable_keys__ (typing.TypedDict の属性): Other special directives.
                                                             (line  459)
* __name__ (definition の属性):          特殊属性.           (line   10)
* __name__ (function の属性):            Special writable attributes.
                                                             (line   16)
* __name__ (method の属性):              インスタンスメソッド.
                                                             (line   24)
* __name__ (module の属性):              Import-related attributes on module objects.
                                                             (line   36)
* __name__ (property の属性):            組み込み関数.       (line 1678)
* __name__ (type の属性):                Special attributes. (line   10)
* __name__ (typing.NewType の属性):      Other special directives.
                                                             (line  125)
* __name__ (typing.ParamSpec の属性):    Building generic types and type aliases.
                                                             (line  471)
* __name__ (typing.TypeAliasType の属性): Building generic types and type aliases.
                                                             (line  565)
* __name__ (typing.TypeVar の属性):      Building generic types and type aliases.
                                                             (line  155)
* __name__ (typing.TypeVarTuple の属性): Building generic types and type aliases.
                                                             (line  358)
* __name__ (クラス属性):                 Special attributes. (line    6)
* __name__ (メソッド属性):               インスタンスメソッド.
                                                             (line    9)
* __name__ (モジュール属性):             モジュール<3>.      (line   21)
* __name__ (モジュール属性) <1>:         モジュールオブジェクト module object.
                                                             (line   25)
* __name__ (モジュール属性) <2>:         モジュールオブジェクト module object.
                                                             (line   64)
* __name__ (関数属性):                   Special writable attributes.
                                                             (line    6)
* __ne__() (email.charset.Charset のメソッド): email charset 文字集合の表現.
                                                             (line  160)
* __ne__() (email.header.Header のメソッド): email header 国際化されたヘッダー.
                                                             (line  168)
* __ne__() (object のメソッド):          基本的なカスタマイズ.
                                                             (line  175)
* __ne__() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line   24)
* __ne__() (インスタンスメソッド):       比較<2>.            (line   49)
* __neg__() (object のメソッド):         数値型をエミュレートする.
                                                             (line  115)
* __neg__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  140)
* __new__() (enum.Enum のメソッド):      データ型<2>.        (line  265)
* __new__() (object のメソッド):         基本的なカスタマイズ.
                                                             (line    6)
* __new__() (string.templatelib.Interpolation のメソッド): 型.
                                                             (line  279)
* __new__() (string.templatelib.Template のメソッド): 型.    (line  106)
* __next__() (csv.csvreader のメソッド): reader オブジェクト.
                                                             (line   10)
* __next__() (generator のメソッド):     ジェネレータ-イテレータメソッド.
                                                             (line   12)
* __next__() (iterator のメソッド):      イテレータ型.       (line   37)
* __not__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line   47)
* __notes__ (BaseException の属性):      基底クラス.         (line   56)
* __notes__ (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   64)
* __objclass__ (object の属性):          デスクリプタ descriptor の実装.
                                                             (line   50)
* __optional_keys__ (typing.TypedDict の属性): Other special directives.
                                                             (line  410)
* __or__() (enum.Flag のメソッド):       データ型<2>.        (line  495)
* __or__() (object のメソッド):          数値型をエミュレートする.
                                                             (line   11)
* __or__() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line  145)
* __origin__ (genericalias の属性):      GenericAlias オブジェクトの特別な属性.
                                                             (line    9)
* __package__ (module attribute):        モジュール<3>.      (line   21)
* __package__ (module attribute) <1>:    モジュールオブジェクト module object.
                                                             (line   25)
* __package__ (module の属性):           Import-related attributes on module objects.
                                                             (line   54)
* __parameters__ (genericalias の属性):  GenericAlias オブジェクトの特別な属性.
                                                             (line   25)
* __path__ (module attribute):           モジュール<3>.      (line   21)
* __path__ (module の属性):              Import-related attributes on module objects.
                                                             (line  124)
* __pointer_type__ (ctypes._CData の属性): データ型<3>.      (line   74)
* __pos__() (object のメソッド):         数値型をエミュレートする.
                                                             (line  115)
* __pos__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  150)
* __post_init__() (dataclasses モジュール): 初期化後の処理.  (line    6)
* __pow__() (object のメソッド):         数値型をエミュレートする.
                                                             (line   11)
* __pow__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  155)
* __prepare__ (metaclass method):        クラスの名前空間の準備.
                                                             (line    6)
* __PYVENV_LAUNCHER__:                   PyConfig.           (line  186)
* __PYVENV_LAUNCHER__ <1>:               PyConfig.           (line  730)
* __qualname__ (definition の属性):      特殊属性.           (line   15)
* __qualname__ (function の属性):        Special writable attributes.
                                                             (line   20)
* __qualname__ (type の属性):            Special attributes. (line   14)
* __radd__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   42)
* __rand__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   42)
* __rdivmod__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   42)
* __readonly_keys__ (typing.TypedDict の属性): Other special directives.
                                                             (line  451)
* __reduce__() (object のメソッド):      クラスインスタンスの pickle 化.
                                                             (line  124)
* __reduce_ex__() (object のメソッド):   クラスインスタンスの pickle 化.
                                                             (line  180)
* __release_buffer__() (object のメソッド): Emulating buffer types.
                                                             (line   25)
* __replace__() (replace protocol):      copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   99)
* __repr__() (enum.Enum のメソッド):     データ型<2>.        (line  282)
* __repr__() (multiprocessing.managers.BaseProxy のメソッド): Proxy オブジェクト.
                                                             (line  141)
* __repr__() (netrc.netrc のメソッド):   netrc オブジェクト. (line   16)
* __repr__() (object のメソッド):        基本的なカスタマイズ.
                                                             (line  112)
* __required_keys__ (typing.TypedDict の属性): Other special directives.
                                                             (line  406)
* __reversed__() (enum.EnumType のメソッド): データ型<2>.    (line  112)
* __reversed__() (object のメソッド):    コンテナをエミュレートする.
                                                             (line  150)
* __rfloordiv__() (object のメソッド):   数値型をエミュレートする.
                                                             (line   42)
* __rlshift__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   42)
* __rmatmul__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   42)
* __rmod__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   42)
* __rmul__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   42)
* __ror__() (object のメソッド):         数値型をエミュレートする.
                                                             (line   42)
* __round__() (fractions.Fraction のメソッド): fractions --- 有理数.
                                                             (line  200)
* __round__() (object のメソッド):       数値型をエミュレートする.
                                                             (line  145)
* __rpow__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   42)
* __rrshift__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   42)
* __rshift__() (object のメソッド):      数値型をエミュレートする.
                                                             (line   11)
* __rshift__() (operator モジュール):    operator --- 関数形式の標準演算子.
                                                             (line  160)
* __rsub__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   42)
* __rtruediv__() (object のメソッド):    数値型をエミュレートする.
                                                             (line   42)
* __rxor__() (object のメソッド):        数値型をエミュレートする.
                                                             (line   42)
* __self__ (method の属性):              インスタンスメソッド.
                                                             (line   11)
* __self__ (メソッド属性):               インスタンスメソッド.
                                                             (line    9)
* __set__() (object のメソッド):         デスクリプタ descriptor の実装.
                                                             (line   33)
* __set_name__() (object のメソッド):    クラス生成をカスタマイズする.
                                                             (line   47)
* __setattr__() (object のメソッド):     属性値アクセスをカスタマイズする.
                                                             (line   55)
* __setitem__() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  204)
* __setitem__() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  323)
* __setitem__() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line   90)
* __setitem__() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line  191)
* __setitem__() (object のメソッド):     コンテナをエミュレートする.
                                                             (line  117)
* __setitem__() (operator モジュール):   operator --- 関数形式の標準演算子.
                                                             (line  213)
* __setstate__() (copy プロトコル):      状態を持つオブジェクトの扱い.
                                                             (line    6)
* __setstate__() (object のメソッド):    クラスインスタンスの pickle 化.
                                                             (line   86)
* __slots__:                             用語集<2>.          (line 1566)
* __spec__ (module attribute):           モジュール<3>.      (line   21)
* __spec__ (module の属性):              Import-related attributes on module objects.
                                                             (line   45)
* __static_attributes__ (class attribute): Special attributes.
                                                             (line    6)
* __static_attributes__ (type の属性):   Special attributes. (line   84)
* __stderr__ (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 2025)
* __stdin__ (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 2025)
* __stdout__ (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 2025)
* __str__() (datetime.date のメソッド):  date objects.       (line  305)
* __str__() (datetime.datetime のメソッド): datetime objects.
                                                             (line  732)
* __str__() (datetime.time のメソッド):  time objects.       (line  230)
* __str__() (email.charset.Charset のメソッド): email charset 文字集合の表現.
                                                             (line  150)
* __str__() (email.header.Header のメソッド): email header 国際化されたヘッダー.
                                                             (line  152)
* __str__() (email.headerregistry.Address のメソッド): email headerregistry Custom Header Objects.
                                                             (line  440)
* __str__() (email.headerregistry.Group のメソッド): email headerregistry Custom Header Objects.
                                                             (line  475)
* __str__() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line   95)
* __str__() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  102)
* __str__() (enum.Enum のメソッド):      データ型<2>.        (line  300)
* __str__() (multiprocessing.managers.BaseProxy のメソッド): Proxy オブジェクト.
                                                             (line  145)
* __str__() (object のメソッド):         基本的なカスタマイズ.
                                                             (line  128)
* __sub__() (object のメソッド):         数値型をエミュレートする.
                                                             (line   11)
* __sub__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  165)
* __subclasscheck__() (type のメソッド): インスタンスのカスタマイズとサブクラスチェック.
                                                             (line   20)
* __subclasses__() (type のメソッド):    Special methods.    (line   15)
* __subclasshook__() (abc.ABCMeta のメソッド): abc --- 抽象基底クラス.
                                                             (line   91)
* __supertype__ (typing.NewType の属性): Other special directives.
                                                             (line  129)
* __suppress_context__ (BaseException の属性): 例外コンテキスト.
                                                             (line    9)
* __suppress_context__ (exception の属性): 例外コンテキスト. (line    6)
* __suppress_context__ (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   60)
* __test__ (module の属性):              どの docstring が検証されるのか?.
                                                             (line   10)
* __total__ (typing.TypedDict の属性):   Other special directives.
                                                             (line  381)
* __traceback__ (BaseException の属性):  基底クラス.         (line   42)
* __traceback__ (exception の属性):      raise 文.           (line    6)
* __truediv__() (importlib.resources.abc.Traversable のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  139)
* __truediv__() (object のメソッド):     数値型をエミュレートする.
                                                             (line   11)
* __truediv__() (operator モジュール):   operator --- 関数形式の標準演算子.
                                                             (line  170)
* __trunc__() (object のメソッド):       数値型をエミュレートする.
                                                             (line  145)
* __type_params__ (class attribute):     Special attributes. (line    6)
* __type_params__ (definition の属性):   特殊属性.           (line   31)
* __type_params__ (function attribute):  Special writable attributes.
                                                             (line    6)
* __type_params__ (function の属性):     Special writable attributes.
                                                             (line   66)
* __type_params__ (type の属性):         Special attributes. (line   77)
* __type_params__ (typing.TypeAliasType の属性): Building generic types and type aliases.
                                                             (line  581)
* __unpacked__ (genericalias の属性):    GenericAlias オブジェクトの特別な属性.
                                                             (line   41)
* __unraisablehook__ (sys モジュール):   sys --- システム固有のパラメーターと関数.
                                                             (line  412)
* __value__ (typing.TypeAliasType の属性): Building generic types and type aliases.
                                                             (line  593)
* __xor__() (enum.Flag のメソッド):      データ型<2>.        (line  511)
* __xor__() (object のメソッド):         数値型をエミュレートする.
                                                             (line   11)
* __xor__() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  176)
* _, identifiers:                        ソフトキーワード.   (line   25)
* _add_alias_() (enum.Enum のメソッド):  データ型<2>.        (line  339)
* _add_value_alias_() (enum.Enum のメソッド): データ型<2>.   (line  352)
* _align_ (ctypes.Structure の属性):     構造化データ型.     (line  115)
* _anonymous_ (ctypes.Structure の属性): 構造化データ型.     (line  167)
* _asdict() (collections.somenamedtuple のメソッド): namedtuple 名前付きフィールドを持つタプルのファクトリ関数.
                                                             (line  109)
* _b_base_ (ctypes._CData の属性):       データ型<3>.        (line   84)
* _b_needsfree_ (ctypes._CData の属性):  データ型<3>.        (line   91)
* _callmethod() (multiprocessing.managers.BaseProxy のメソッド): Proxy オブジェクト.
                                                             (line   96)
* _CData (ctypes のクラス):              データ型<3>.        (line    6)
* _CFuncPtr (ctypes のクラス):           外部関数.           (line   22)
* _clear_internal_caches() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  188)
* _clear_type_cache() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line  177)
* _current_exceptions() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  215)
* _current_frames() (sys モジュール):    sys --- システム固有のパラメーターと関数.
                                                             (line  196)
* _debugmallocstats() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line  271)
* _emscripten_info (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line  336)
* _enablelegacywindowsfsencoding() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1932)
* _enter_task() (asyncio モジュール):    Task lifetime support.
                                                             (line   22)
* _exit() (os モジュール):               プロセス管理.       (line  124)
* _Feature (__future__ のクラス):        モジュールコンテンツ<5>.
                                                             (line   54)
* _field_defaults (collections.somenamedtuple の属性): namedtuple 名前付きフィールドを持つタプルのファクトリ関数.
                                                             (line  159)
* _field_types (ast.AST の属性):         Node クラス.        (line   38)
* _fields (ast.AST の属性):              Node クラス.        (line   21)
* _fields (collections.somenamedtuple の属性): namedtuple 名前付きフィールドを持つタプルのファクトリ関数.
                                                             (line  145)
* _fields_ (ctypes.Structure の属性):    構造化データ型.     (line   51)
* _flush() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line  117)
* _for_archive() (zipfile.ZipInfo のメソッド): zipfile --- ZIP アーカイブの処理.
                                                             (line   85)
* _frozen (C struct):                    モジュールのインポート<2>.
                                                             (line  271)
* _generate_next_value_() (enum.Enum のメソッド): データ型<2>.
                                                             (line  196)
* _get_child_mock() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  305)
* _get_preferred_schemes() (sysconfig モジュール): Installation path functions.
                                                             (line   41)
* _getframe() (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line  902)
* _getframemodulename() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  916)
* _getvalue() (multiprocessing.managers.BaseProxy のメソッド): Proxy オブジェクト.
                                                             (line  135)
* _handle (ctypes.PyDLL の属性):         共有ライブラリをロードする.
                                                             (line  154)
* _ignore_ (enum.Enum の属性):           データ型<2>.        (line  165)
* _incompatible_extension_module_restrictions() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line  172)
* _inittab (C struct):                   モジュールのインポート<2>.
                                                             (line  308)
* _inittab.initfunc (C member):          モジュールのインポート<2>.
                                                             (line  320)
* _inittab.name (C member):              モジュールのインポート<2>.
                                                             (line  316)
* _is_gil_enabled() (sys モジュール):    sys --- システム固有のパラメーターと関数.
                                                             (line 1232)
* _is_immortal() (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line 1320)
* _is_interned() (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line 1336)
* _jit (sys モジュール):                 sys --- システム固有のパラメーターと関数.
                                                             (line 1251)
* _jit.is_active() (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line 1279)
* _jit.is_available() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 1262)
* _jit.is_enabled() (sys モジュール):    sys --- システム固有のパラメーターと関数.
                                                             (line 1270)
* _layout_ (ctypes.Structure の属性):    構造化データ型.     (line  136)
* _leave_task() (asyncio モジュール):    Task lifetime support.
                                                             (line   30)
* _length_ (ctypes.Array の属性):        配列とポインタ.     (line   18)
* _log (logging.LoggerAdapter の属性):   LoggerAdapter オブジェクト.
                                                             (line   36)
* _make() (collections.somenamedtuple のクラスメソッド): namedtuple 名前付きフィールドを持つタプルのファクトリ関数.
                                                             (line  100)
* _makeResult() (unittest.TextTestRunner のメソッド): テストのロードと起動.
                                                             (line  485)
* _missing_() (enum.Enum のメソッド):    データ型<2>.        (line  242)
* _name (ctypes.PyDLL の属性):           共有ライブラリをロードする.
                                                             (line  158)
* _name_ (enum.Enum の属性):             データ型<2>.        (line  152)
* _numeric_repr_() (enum.Flag のメソッド): データ型<2>.      (line  531)
* _objects (ctypes._CData の属性):       データ型<3>.        (line   97)
* _order_ (enum.Enum の属性):            データ型<2>.        (line  160)
* _pack_ (ctypes.Structure の属性):      構造化データ型.     (line   92)
* _parse() (gettext.NullTranslations のメソッド): NullTranslations クラス.
                                                             (line   22)
* _Pointer (ctypes のクラス):            配列とポインタ.     (line   39)
* _Py_c_diff (C function):               C 構造体としての複素数.
                                                             (line   32)
* _Py_c_neg (C function):                C 構造体としての複素数.
                                                             (line   37)
* _Py_c_pow (C function):                C 構造体としての複素数.
                                                             (line   54)
* _Py_c_prod (C function):               C 構造体としての複素数.
                                                             (line   41)
* _Py_c_quot (C function):               C 構造体としての複素数.
                                                             (line   46)
* _Py_c_sum (C function):                C 構造体としての複素数.
                                                             (line   27)
* _Py_NoneStruct (C var):                オブジェクトをヒープ上にメモリ確保する.
                                                             (line  142)
* _Py_TPFLAGS_HAVE_VECTORCALL (C macro): PyTypeObject スロット.
                                                             (line  851)
* _PyBytes_Resize (C function):          バイトオブジェクト<2>.
                                                             (line  190)
* _PyCode_GetExtra (C function):         Extra information.  (line   35)
* _PyCode_SetExtra (C function):         Extra information.  (line   51)
* _PyEval_RequestCodeExtraIndex (C function): Extra information.
                                                             (line   14)
* _PyFrameEvalFunction (C type):         低レベルAPI.        (line  217)
* _PyInterpreterFrame (C struct):        Internal Frames.    (line    8)
* _PyInterpreterState_GetEvalFrameFunc (C function): 低レベルAPI.
                                                             (line  231)
* _PyInterpreterState_SetEvalFrameFunc (C function): 低レベルAPI.
                                                             (line  241)
* _PyObject_GetDictPtr (C function):     オブジェクトプロトコル object protocol.
                                                             (line  283)
* _PyObject_New (C function):            オブジェクトをヒープ上にメモリ確保する.
                                                             (line    6)
* _PyObject_NewVar (C function):         オブジェクトをヒープ上にメモリ確保する.
                                                             (line    9)
* _PyObject_Vectorcall (C function):     Object Calling API. (line  194)
* _PyTuple_Resize (C function):          タプルオブジェクト tuple object.
                                                             (line  105)
* _register_task() (asyncio モジュール): Task lifetime support.
                                                             (line   10)
* _replace() (collections.somenamedtuple のメソッド): namedtuple 名前付きフィールドを持つタプルのファクトリ関数.
                                                             (line  127)
* _setroot() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   14)
* _SimpleCData (ctypes のクラス):        基本データ型<2>.    (line    6)
* _structure() (email.iterators モジュール): email iterators イテレータ.
                                                             (line   44)
* _type_ (ctypes._Pointer の属性):       配列とポインタ.     (line   54)
* _type_ (ctypes.Array の属性):          配列とポインタ.     (line   24)
* _unregister_task() (asyncio モジュール): Task lifetime support.
                                                             (line   16)
* _value_ (enum.Enum の属性):            データ型<2>.        (line  156)
* _write() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line  109)
* _xoptions (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 2206)
* - (負符号);glob 形式のワイルドカード:  glob --- Unix 形式のパス名のパターン展開.
                                                             (line   10)
* - (負符号);glob 形式のワイルドカード <1>: fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   15)
* - (負符号);in doctests:                オプションフラグ.   (line  163)
* - (負符号);in printf-style formatting: printf 形式の文字列書式化.
                                                             (line   68)
* - (負符号);in printf-style formatting <1>: printf 形式での bytes の書式化.
                                                             (line   61)
* - (負符号);in regular expressions:     正規表現のシンタックス.
                                                             (line  173)
* - (負符号);二項演算子:                 二項算術演算 binary arithmetic operation.
                                                             (line   89)
* - (負符号);二項演算子 <1>:             数値型 int float complex.
                                                             (line   27)
* - (負符号);単項演算子:                 単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
                                                             (line   10)
* - (負符号);単項演算子 <1>:             数値型 int float complex.
                                                             (line   27)
* - (負符号);文字列のフォーマットで:     書式指定ミニ言語仕様.
                                                             (line   76)
* -=;augmented assignment:               累算代入文 augmented assignment statement.
                                                             (line    6)
* ->;関数のアノテーション:               関数のアノテーション.
                                                             (line    6)
* ->;関数のアノテーション <1>:           関数定義.           (line  106)
* , (comma):                             丸括弧形式 parenthesized form.
                                                             (line   19)
* , (comma);argument list:               Formal subscription grammar.
                                                             (line   16)
* , (comma);expression list:             リスト表示.         (line    6)
* , (comma);expression list <1>:         集合表示.           (line    6)
* , (comma);expression list <2>:         式のリスト.         (line    6)
* , (comma);expression list <3>:         assert 文.          (line    6)
* , (comma);expression list <4>:         クラス定義.         (line    6)
* , (comma);identifier list:             global 文.          (line    6)
* , (comma);identifier list <1>:         nonlocal 文.        (line    6)
* , (comma);import statement:            import 文.          (line    6)
* , (comma);in dictionary displays:      辞書表示.           (line    6)
* , (comma);in target list:              代入文 assignment statement.
                                                             (line   34)
* , (comma);parameter list:              関数定義.           (line    6)
* , (comma);with statement:              with 文.            (line    6)
* , (comma);スライス:                    Subscriptions and slicings.
                                                             (line   70)
* , (カンマ);文字列のフォーマットで:     書式指定ミニ言語仕様.
                                                             (line  130)
* ; (semicolon):                         複合文 compound statement.
                                                             (line   17)
* ; (semicolon) <1>:                     雑多なシステム情報. (line  135)
* ; (コロン);annotated variable:         注釈付き代入文 annotated assignment statements.
                                                             (line    6)
* ; (コロン);compound statement:         if 文<2>.           (line    6)
* ; (コロン);compound statement <1>:     while 文.           (line    6)
* ; (コロン);compound statement <2>:     for 文<2>.          (line    6)
* ; (コロン);compound statement <3>:     try 文.             (line    6)
* ; (コロン);compound statement <4>:     with 文.            (line    6)
* ; (コロン);compound statement <5>:     match 文<2>.        (line    6)
* ; (コロン);compound statement <6>:     関数定義.           (line    6)
* ; (コロン);compound statement <7>:     クラス定義.         (line    6)
* ; (コロン);in dictionary expressions:  辞書表示.           (line    6)
* ; (コロン);in formatted string literal: Raw string literals.
                                                             (line   25)
* ; (コロン);in formatted string literal <1>: 文字列メソッド<2>.
                                                             (line  928)
* ; (コロン);in SQL statements:          Cursor オブジェクト.
                                                             (line   24)
* ; (コロン);lambda expression:          ラムダ lambda.      (line    6)
* ; (コロン);path separator (POSIX):     雑多なシステム情報. (line  135)
* ; (コロン);スライス:                   Subscriptions and slicings.
                                                             (line   70)
* ; (コロン);文字列のフォーマットで:     書式指定文字列の文法.
                                                             (line   14)
* ; (コロン);関数のアノテーション:       関数のアノテーション.
                                                             (line    6)
* ; (コロン);関数のアノテーション <1>:   関数定義.           (line  106)
* ;= (colon equals):                     ブール演算 boolean operation.
                                                             (line   34)
* ! (exclamation mark);in formatted string literal: 文字列メソッド<2>.
                                                             (line  928)
* ! (pdb command):                       Debugger commands.  (line  407)
* ! (エクスクラメーション);curses モジュール内: curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  226)
* ! (エクスクラメーション);glob 形式のワイルドカード: glob --- Unix 形式のパス名のパターン展開.
                                                             (line   10)
* ! (エクスクラメーション);glob 形式のワイルドカード <1>: fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   15)
* ! (エクスクラメーション);in a command interpreter: Cmdオブジェクト.
                                                             (line   26)
* ! (エクスクラメーション);in formatted string literal: Raw string literals.
                                                             (line   25)
* ! (エクスクラメーション);in struct format strings: バイトオーダ、サイズ、アラインメント.
                                                             (line   13)
* ! (エクスクラメーション);文字列のフォーマットで: 書式指定文字列の文法.
                                                             (line   14)
* ! f-string:                            文字列メソッド<2>.  (line  928)
* ! formatted string literal:            文字列メソッド<2>.  (line  928)
* ! patterns:                            パターン.           (line    6)
* ? (クエスチョンマーク);argparse モジュール内: nargs.       (line   24)
* ? (クエスチョンマーク);glob 形式のワイルドカード: glob --- Unix 形式のパス名のパターン展開.
                                                             (line   10)
* ? (クエスチョンマーク);glob 形式のワイルドカード <1>: fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   15)
* ? (クエスチョンマーク);in a command interpreter: Cmdオブジェクト.
                                                             (line   26)
* ? (クエスチョンマーク);in AST grammar: Node クラス.        (line   21)
* ? (クエスチョンマーク);in regular expressions: 正規表現のシンタックス.
                                                             (line   77)
* ? (クエスチョンマーク);in SQL statements: Cursor オブジェクト.
                                                             (line   24)
* ? (クエスチョンマーク);in struct format strings: 書式指定文字.
                                                             (line   96)
* ? (クエスチョンマーク);in struct format strings <1>: 書式指定文字.
                                                             (line  187)
* ? (クエスチョンマーク);replacement character: エラーハンドラ.
                                                             (line   14)
* ??;in regular expressions:             正規表現のシンタックス.
                                                             (line   82)
* ?+;in regular expressions:             正規表現のシンタックス.
                                                             (line   92)
* . (ドット);attribute reference:        属性参照.           (line    6)
* . (ドット);glob 形式のワイルドカード:  glob --- Unix 形式のパス名のパターン展開.
                                                             (line   10)
* . (ドット);in numeric literal:         整数リテラル.       (line   65)
* . (ドット);in pathnames:               雑多なシステム情報. (line  100)
* . (ドット);in pathnames <1>:           雑多なシステム情報. (line  130)
* . (ドット);in printf-style formatting: printf 形式の文字列書式化.
                                                             (line   30)
* . (ドット);in printf-style formatting <1>: printf 形式での bytes の書式化.
                                                             (line   23)
* . (ドット);in regular expressions:     正規表現のシンタックス.
                                                             (line   42)
* . (ドット);文字列のフォーマットで:     書式指定文字列の文法.
                                                             (line   14)
* ..;in pathnames:                       雑多なシステム情報. (line  106)
* ...:                                   用語集<2>.          (line    9)
* ...;ellipsisリテラル:                  ループの else 節.   (line   55)
* ...;ellipsisリテラル <1>:              Ellipsis.           (line    6)
* ...;ellipsisリテラル <2>:              組み込み定数.       (line   60)
* ...;ellipsisリテラル <3>:              ヌルオブジェクト.   (line   12)
* ...;ellipsisリテラル <4>:              呼び出し可能オブジェクトのアノテーション.
                                                             (line   28)
* ...;ellipsisリテラル <5>:              タプルのアノテーション.
                                                             (line   42)
* ...;ellipsisリテラル <6>:              特殊形式.           (line   86)
* ...;ellipsisリテラル <7>:              用語集<2>.          (line   20)
* ...;in doctests:                       オプションフラグ.   (line   46)
* ...;interpreter prompt:                docstring 内の実行例をどのように認識するのか?.
                                                             (line   26)
* ...;interpreter prompt <1>:            sys --- システム固有のパラメーターと関数.
                                                             (line 1601)
* ...;placeholder:                       textwrap --- テキストの折り返しと詰め込み.
                                                             (line  273)
* ...;placeholder <1>:                   PrettyPrinter オブジェクト.
                                                             (line    6)
* ...;placeholder <2>:                   reprlib --- もう一つの repr の実装.
                                                             (line   59)
* .ini;ファイル:                         configparser --- 設定ファイルのパーサー.
                                                             (line    8)
* .pdbrc;ファイル:                       Debugger commands.  (line   60)
* ' (single quote);文字列リテラル:       リテラル.           (line   15)
* ''';文字列リテラル:                    文字列およびバイト列リテラル.
                                                             (line   33)
* " (double quote);文字列リテラル:       リテラル.           (line   14)
* """;文字列リテラル:                    文字列およびバイト列リテラル.
                                                             (line   33)
* (?;;in regular expressions:            正規表現のシンタックス.
                                                             (line  276)
* (?;in regular expressions:             正規表現のシンタックス.
                                                             (line  238)
* (?!;in regular expressions:            正規表現のシンタックス.
                                                             (line  393)
* (?(;in regular expressions:            正規表現のシンタックス.
                                                             (line  436)
* (?#;in regular expressions:            正規表現のシンタックス.
                                                             (line  382)
* (?<!;in regular expressions:           正規表現のシンタックス.
                                                             (line  427)
* (?<=;in regular expressions:           正規表現のシンタックス.
                                                             (line  400)
* (?=;in regular expressions:            正規表現のシンタックス.
                                                             (line  386)
* (?P<;in regular expressions:           正規表現のシンタックス.
                                                             (line  338)
* (?P=;in regular expressions:           正規表現のシンタックス.
                                                             (line  377)
* () (丸括弧);call:                      Formal subscription grammar.
                                                             (line   16)
* () (丸括弧);class definition:          クラス定義.         (line    6)
* () (丸括弧);function definition:       関数定義.           (line    6)
* () (丸括弧);generator expression:      ジェネレータ式<2>.  (line    6)
* () (丸括弧);in assignment target list: 代入文 assignment statement.
                                                             (line   34)
* () (丸括弧);in printf-style formatting: printf 形式の文字列書式化.
                                                             (line   30)
* () (丸括弧);in printf-style formatting <1>: printf 形式での bytes の書式化.
                                                             (line   23)
* () (丸括弧);in regular expressions:    正規表現のシンタックス.
                                                             (line  230)
* () (丸括弧);tuple display:             丸括弧形式 parenthesized form.
                                                             (line    6)
* [] (角カッコ);glob 形式のワイルドカード: glob --- Unix 形式のパス名のパターン展開.
                                                             (line   10)
* [] (角カッコ);glob 形式のワイルドカード <1>: fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   15)
* [] (角カッコ);in assignment target list: 代入文 assignment statement.
                                                             (line   34)
* [] (角カッコ);in regular expressions:  正規表現のシンタックス.
                                                             (line  166)
* [] (角カッコ);list expression:         リスト表示.         (line    6)
* [] (角カッコ);文字列のフォーマットで:  書式指定文字列の文法.
                                                             (line   14)
* [] (角カッコ);添字表記:                Subscriptions and slicings.
                                                             (line    6)
* {} (波括弧);dictionary expression:     辞書表示.           (line    6)
* {} (波括弧);in formatted string literal: Raw string literals.
                                                             (line   25)
* {} (波括弧);in formatted string literal <1>: 文字列メソッド<2>.
                                                             (line  928)
* {} (波括弧);in regular expressions:    正規表現のシンタックス.
                                                             (line  111)
* {} (波括弧);set expression:            集合表示.           (line    6)
* {} (波括弧);文字列のフォーマットで:    書式指定文字列の文法.
                                                             (line   14)
* @ (at);class definition:               クラス定義.         (line   44)
* @ (at);function definition:            関数定義.           (line   35)
* @ (at);in struct format strings:       バイトオーダ、サイズ、アラインメント.
                                                             (line   13)
* * (アスタリスク);argparse モジュール内: nargs.             (line   54)
* * (アスタリスク);function definition:  関数定義.           (line   91)
* * (アスタリスク);glob 形式のワイルドカード: glob --- Unix 形式のパス名のパターン展開.
                                                             (line   10)
* * (アスタリスク);glob 形式のワイルドカード <1>: fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   15)
* * (アスタリスク);import statement:     import 文.          (line   81)
* * (アスタリスク);in assignment target list: 代入文 assignment statement.
                                                             (line   34)
* * (アスタリスク);in AST grammar:       Node クラス.        (line   21)
* * (アスタリスク);in expression lists:  式のリスト.         (line   17)
* * (アスタリスク);in printf-style formatting: printf 形式の文字列書式化.
                                                             (line   30)
* * (アスタリスク);in printf-style formatting <1>: printf 形式での bytes の書式化.
                                                             (line   23)
* * (アスタリスク);in regular expressions: 正規表現のシンタックス.
                                                             (line   65)
* * (アスタリスク);関数呼び出しの中の:   任意引数リスト.     (line    6)
* * (アスタリスク);関数呼び出しの中の <1>: 呼び出し call.    (line   70)
* *?;in regular expressions:             正規表現のシンタックス.
                                                             (line   82)
* **;function definition:                関数定義.           (line   91)
* **;glob 形式のワイルドカード:          glob --- Unix 形式のパス名のパターン展開.
                                                             (line   52)
* **;in dictionary displays:             辞書表示.           (line   23)
* **;関数呼び出しの中の:                 引数リストのアンパック.
                                                             (line   18)
* **;関数呼び出しの中の <1>:             呼び出し call.      (line   97)
* **=;augmented assignment:              累算代入文 augmented assignment statement.
                                                             (line    6)
* *+;in regular expressions:             正規表現のシンタックス.
                                                             (line   92)
* *=;augmented assignment:               累算代入文 augmented assignment statement.
                                                             (line    6)
* / (スラッシュ);function definition:    関数定義.           (line   91)
* / (スラッシュ);in pathnames:           雑多なシステム情報. (line  112)
* / (スラッシュ);in pathnames <1>:       雑多なシステム情報. (line  122)
* //=;augmented assignment:              累算代入文 augmented assignment statement.
                                                             (line    6)
* /=;augmented assignment:               累算代入文 augmented assignment statement.
                                                             (line    6)
* \ (backslash);in pathnames (Windows):  雑多なシステム情報. (line  112)
* \ (backslash);in regular expressions:  正規表現のシンタックス.
                                                             (line  151)
* \ (backslash);in regular expressions <1>: 正規表現のシンタックス.
                                                             (line  185)
* \ (backslash);in regular expressions <2>: 正規表現のシンタックス.
                                                             (line  454)
* \ (backslash);エスケープシーケンス:    Formal grammar.     (line   28)
* \ (backslash);エスケープシーケンス <1>: エラーハンドラ.    (line   14)
* \\;in regular expressions:             正規表現のシンタックス.
                                                             (line  585)
* \\;エスケープシーケンス:               Formal grammar.     (line   28)
* \A;in regular expressions:             正規表現のシンタックス.
                                                             (line  466)
* \a;in regular expressions:             正規表現のシンタックス.
                                                             (line  585)
* \a;エスケープシーケンス:               Formal grammar.     (line   28)
* \b;in regular expressions:             正規表現のシンタックス.
                                                             (line  470)
* \B;in regular expressions:             正規表現のシンタックス.
                                                             (line  487)
* \b;in regular expressions <1>:         正規表現のシンタックス.
                                                             (line  585)
* \b;エスケープシーケンス:               Formal grammar.     (line   28)
* \d;in regular expressions:             正規表現のシンタックス.
                                                             (line  499)
* \D;in regular expressions:             正規表現のシンタックス.
                                                             (line  513)
* \f;in regular expressions:             正規表現のシンタックス.
                                                             (line  585)
* \f;エスケープシーケンス:               Formal grammar.     (line   28)
* \g;in regular expressions:             関数<2>.            (line  208)
* \n;in regular expressions:             正規表現のシンタックス.
                                                             (line  585)
* \N;in regular expressions:             正規表現のシンタックス.
                                                             (line  585)
* \n;エスケープシーケンス:               Formal grammar.     (line   28)
* \N;エスケープシーケンス:               Formal grammar.     (line   28)
* \N;エスケープシーケンス <1>:           エラーハンドラ.     (line   52)
* \r;in regular expressions:             正規表現のシンタックス.
                                                             (line  585)
* \r;エスケープシーケンス:               Formal grammar.     (line   28)
* \s;in regular expressions:             正規表現のシンタックス.
                                                             (line  520)
* \S;in regular expressions:             正規表現のシンタックス.
                                                             (line  537)
* \t;in regular expressions:             正規表現のシンタックス.
                                                             (line  585)
* \t;エスケープシーケンス:               Formal grammar.     (line   28)
* \u;in regular expressions:             正規表現のシンタックス.
                                                             (line  585)
* \U;in regular expressions:             正規表現のシンタックス.
                                                             (line  585)
* \u;エスケープシーケンス:               Formal grammar.     (line   28)
* \U;エスケープシーケンス:               Formal grammar.     (line   27)
* \u;エスケープシーケンス <1>:           エラーハンドラ.     (line   14)
* \U;エスケープシーケンス <1>:           エラーハンドラ.     (line   14)
* \v;in regular expressions:             正規表現のシンタックス.
                                                             (line  585)
* \v;エスケープシーケンス:               Formal grammar.     (line   28)
* \w;in regular expressions:             正規表現のシンタックス.
                                                             (line  545)
* \W;in regular expressions:             正規表現のシンタックス.
                                                             (line  563)
* \x;in regular expressions:             正規表現のシンタックス.
                                                             (line  585)
* \x;エスケープシーケンス:               Formal grammar.     (line   28)
* \x;エスケープシーケンス <1>:           エラーハンドラ.     (line   14)
* \z;in regular expressions:             正規表現のシンタックス.
                                                             (line  575)
* \Z;in regular expressions:             正規表現のシンタックス.
                                                             (line  575)
* &=;augmented assignment:               累算代入文 augmented assignment statement.
                                                             (line    6)
* # (hash);in doctests:                  オプションフラグ.   (line  164)
* # (hash);in printf-style formatting:   printf 形式の文字列書式化.
                                                             (line   68)
* # (hash);in printf-style formatting <1>: printf 形式での bytes の書式化.
                                                             (line   61)
* # (hash);in regular expressions:       フラグ.             (line  125)
* # (hash);source encoding declaration:  エンコード宣言 encoding declaration.
                                                             (line    6)
* # (hash);コメント:                     形式ばらない Python の紹介.
                                                             (line   10)
* # (hash);コメント <1>:                 コメント Comments.  (line    6)
* # (hash);コメント <2>:                 site --- サイト固有の設定フック.
                                                             (line   56)
* # (hash);文字列のフォーマットで:       書式指定ミニ言語仕様.
                                                             (line   99)
* % (パーセント);datetime format:        timezone objects.   (line   72)
* % (パーセント);datetime format <1>:    関数<5>.            (line  318)
* % (パーセント);datetime format <2>:    関数<5>.            (line  475)
* % (パーセント);environment variables expansion (Windows): os path --- 一般的なパス名操作.
                                                             (line  169)
* % (パーセント);environment variables expansion (Windows) <1>: 関数<14>.
                                                             (line  226)
* % (パーセント);interpolation in configuration files: 値の補間.
                                                             (line   10)
* % (パーセント);printf 形式の書式化:    printf 形式の文字列書式化.
                                                             (line    6)
* % (パーセント);printf 形式の書式化 <1>: printf 形式での bytes の書式化.
                                                             (line    6)
* %=;augmented assignment:               累算代入文 augmented assignment statement.
                                                             (line    6)
* ''parser'':                            字句解析.           (line    6)
* ^ (キャレット);curses モジュール内:    curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  226)
* ^ (キャレット);in regular expressions: 正規表現のシンタックス.
                                                             (line   49)
* ^ (キャレット);in regular expressions <1>: 正規表現のシンタックス.
                                                             (line  195)
* ^ (キャレット);marker:                 例外はどう扱えばよいか?.
                                                             (line   92)
* ^ (キャレット);marker <1>:             モジュールレベルの関数<2>.
                                                             (line   36)
* ^ (キャレット);文字列のフォーマットで: 書式指定ミニ言語仕様.
                                                             (line   46)
* ^=;augmented assignment:               累算代入文 augmented assignment statement.
                                                             (line    6)
* + (プラス記号);argparse モジュール内:  nargs.              (line   65)
* + (プラス記号);in doctests:            オプションフラグ.   (line  164)
* + (プラス記号);in printf-style formatting: printf 形式の文字列書式化.
                                                             (line   68)
* + (プラス記号);in printf-style formatting <1>: printf 形式での bytes の書式化.
                                                             (line   61)
* + (プラス記号);in regular expressions: 正規表現のシンタックス.
                                                             (line   71)
* + (プラス記号);二項演算子:             二項算術演算 binary arithmetic operation.
                                                             (line   77)
* + (プラス記号);二項演算子 <1>:         数値型 int float complex.
                                                             (line   27)
* + (プラス記号);単項演算子:             単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
                                                             (line   14)
* + (プラス記号);単項演算子 <1>:         数値型 int float complex.
                                                             (line   27)
* + (プラス記号);文字列のフォーマットで: 書式指定ミニ言語仕様.
                                                             (line   76)
* +?;in regular expressions:             正規表現のシンタックス.
                                                             (line   82)
* ++;in regular expressions:             正規表現のシンタックス.
                                                             (line   92)
* +=;augmented assignment:               累算代入文 augmented assignment statement.
                                                             (line    6)
* < (小さい);in struct format strings:   バイトオーダ、サイズ、アラインメント.
                                                             (line   13)
* < (小さい);文字列のフォーマットで:     書式指定ミニ言語仕様.
                                                             (line   46)
* <<=;augmented assignment:              累算代入文 augmented assignment statement.
                                                             (line    6)
* <BLANKLINE>:                           オプションフラグ.   (line   28)
* = (等号);assignment statement:         代入文 assignment statement.
                                                             (line    6)
* = (等号);class definition:             メタクラス.         (line    6)
* = (等号);for help in debugging using string literals: Raw string literals.
                                                             (line   25)
* = (等号);for help in debugging using string literals <1>: 文字列メソッド<2>.
                                                             (line  927)
* = (等号);function definition:          関数定義.           (line   67)
* = (等号);in struct format strings:     バイトオーダ、サイズ、アラインメント.
                                                             (line   13)
* = (等号);文字列のフォーマットで:       書式指定ミニ言語仕様.
                                                             (line   46)
* = (等号);関数呼び出しの中の:           Formal subscription grammar.
                                                             (line   15)
* > (大きい);in struct format strings:   バイトオーダ、サイズ、アラインメント.
                                                             (line   13)
* > (大きい);文字列のフォーマットで:     書式指定ミニ言語仕様.
                                                             (line   46)
* >>=;augmented assignment:              累算代入文 augmented assignment statement.
                                                             (line    6)
* >>>:                                   用語集<2>.          (line    6)
* >>>;interpreter prompt:                docstring 内の実行例をどのように認識するのか?.
                                                             (line   26)
* >>>;interpreter prompt <1>:            sys --- システム固有のパラメーターと関数.
                                                             (line 1601)
* | (縦棒);in regular expressions:       正規表現のシンタックス.
                                                             (line  217)
* |=;augmented assignment:               累算代入文 augmented assignment statement.
                                                             (line    6)
* ~ (チルダ);home directory expansion:   os path --- 一般的なパス名操作.
                                                             (line  143)
* $ (ダラー);environment variables expansion: os path --- 一般的なパス名操作.
                                                             (line  169)
* $ (ダラー);in regular expressions:     正規表現のシンタックス.
                                                             (line   54)
* $ (ダラー);interpolation in configuration files: 値の補間. (line   39)
* $ (ダラー);テンプレート文字列の中で:   Template strings $-strings.
                                                             (line   23)
* 0b;整数リテラル:                       数値リテラル.       (line   20)
* 0o;整数リテラル:                       数値リテラル.       (line   20)
* 0x;整数リテラル:                       数値リテラル.       (line   20)
* 10進数リテラル:                        数値リテラル.       (line    6)
* 16進数;リテラル:                       数値型 int float complex.
                                                             (line   17)
* 16進数リテラル:                        数値リテラル.       (line    6)
* 2-digit years:                         time --- 時刻データへのアクセスと変換.
                                                             (line   34)
* 2038年:                                time --- 時刻データへのアクセスと変換.
                                                             (line   29)
* 2進数;ビット単位;演算:                 ビット単位演算の二項演算 binary bitwise operation.
                                                             (line    6)
* 2進数;リテラル:                        数値型 int float complex.
                                                             (line   17)
* 2進数;算術;演算:                       二項算術演算 binary arithmetic operation.
                                                             (line    6)
* 2進数リテラル:                         数値リテラル.       (line    6)
* 8進数;リテラル:                        数値型 int float complex.
                                                             (line   17)
* 8進数リテラル:                         数値リテラル.       (line    6)
* A (re モジュール):                     フラグ.             (line   16)
* A_ALTCHARSET (curses モジュール):      定数<6>.            (line   65)
* A_ATTRIBUTES (curses モジュール):      定数<6>.            (line  126)
* A_BLINK (curses モジュール):           定数<6>.            (line   68)
* A_BOLD (curses モジュール):            定数<6>.            (line   71)
* A_CHARTEXT (curses モジュール):        定数<6>.            (line  129)
* A_COLOR (curses モジュール):           定数<6>.            (line  132)
* A_DIM (curses モジュール):             定数<6>.            (line   74)
* A_HORIZONTAL (curses モジュール):      定数<6>.            (line   99)
* A_INVIS (curses モジュール):           定数<6>.            (line   77)
* A_ITALIC (curses モジュール):          定数<6>.            (line   80)
* A_LEFT (curses モジュール):            定数<6>.            (line  102)
* A_LOW (curses モジュール):             定数<6>.            (line  105)
* A_NORMAL (curses モジュール):          定数<6>.            (line   83)
* A_PROTECT (curses モジュール):         定数<6>.            (line   86)
* A_REVERSE (curses モジュール):         定数<6>.            (line   89)
* A_RIGHT (curses モジュール):           定数<6>.            (line  108)
* A_STANDOUT (curses モジュール):        定数<6>.            (line   93)
* A_TOP (curses モジュール):             定数<6>.            (line  111)
* A_UNDERLINE (curses モジュール):       定数<6>.            (line   96)
* A_VERTICAL (curses モジュール):        定数<6>.            (line  114)
* a2b_base64() (binascii モジュール):    binascii --- バイナリ と ASCII 間の変換.
                                                             (line   41)
* a2b_hex() (binascii モジュール):       binascii --- バイナリ と ASCII 間の変換.
                                                             (line  145)
* a2b_qp() (binascii モジュール):        binascii --- バイナリ と ASCII 間の変換.
                                                             (line   71)
* a2b_uu() (binascii モジュール):        binascii --- バイナリ と ASCII 間の変換.
                                                             (line   25)
* a85decode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line   51)
* a85encode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line   28)
* ABC (abc のクラス):                    abc --- 抽象基底クラス.
                                                             (line   27)
* ABCMeta (abc のクラス):                abc --- 抽象基底クラス.
                                                             (line   52)
* ABDAY_1 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  230)
* ABDAY_2 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  230)
* ABDAY_3 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  230)
* ABDAY_4 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  230)
* ABDAY_5 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  230)
* ABDAY_6 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  230)
* ABDAY_7 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  230)
* abiflags (sys モジュール):             sys --- システム固有のパラメーターと関数.
                                                             (line   13)
* ABMON_1 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  255)
* ABMON_10 (locale モジュール):          locale --- 国際化サービス.
                                                             (line  255)
* ABMON_11 (locale モジュール):          locale --- 国際化サービス.
                                                             (line  255)
* ABMON_12 (locale モジュール):          locale --- 国際化サービス.
                                                             (line  255)
* ABMON_2 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  255)
* ABMON_3 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  255)
* ABMON_4 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  255)
* ABMON_5 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  255)
* ABMON_6 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  255)
* ABMON_7 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  255)
* ABMON_8 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  255)
* ABMON_9 (locale モジュール):           locale --- 国際化サービス.
                                                             (line  255)
* abort (C function):                    プロセス制御.       (line    7)
* ABORT (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  147)
* abort_clients() (asyncio.Server のメソッド): Serverオブジェクト.
                                                             (line   56)
* abort() (asyncio.Barrier のメソッド):  Barrier.            (line   88)
* abort() (asyncio.DatagramTransport のメソッド): データグラムトランスポート.
                                                             (line   20)
* abort() (asyncio.WriteTransport のメソッド): 書き込み専用のトランスポート.
                                                             (line    6)
* abort() (ftplib.FTP のメソッド):       FTP オブジェクト.   (line  151)
* abort() (os モジュール):               プロセス管理.       (line   16)
* abort() (threading.Barrier のメソッド): Barrier objects.   (line   80)
* ABORTRETRYIGNORE (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  162)
* ABOVE_NORMAL_PRIORITY_CLASS (subprocess モジュール): Windows Constants.
                                                             (line   68)
* above() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   13)
* abs() (decimal.Context のメソッド):    Context オブジェクト.
                                                             (line  266)
* abs() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line   83)
* absolute_import (__future__ モジュール): モジュールコンテンツ<5>.
                                                             (line   26)
* absolute() (pathlib.Path のメソッド):  パスの展開と解決.   (line   38)
* AbsoluteLinkError:                     tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  304)
* AbsolutePathError:                     tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  290)
* abspath() (os.path モジュール):        os path --- 一般的なパス名操作.
                                                             (line   49)
* abstract base class:                   用語集<2>.          (line   21)
* AbstractAsyncContextManager (contextlib のクラス): ユーティリティ.
                                                             (line   19)
* AbstractBasicAuthHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  387)
* abstractclassmethod() (abc モジュール): abc --- 抽象基底クラス.
                                                             (line  235)
* AbstractContextManager (contextlib のクラス): ユーティリティ.
                                                             (line    8)
* AbstractDigestAuthHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  425)
* AbstractEventLoop (asyncio のクラス):  イベントループの実装.
                                                             (line   52)
* AbstractEventLoopPolicy (asyncio のクラス): ポリシーオブジェクト.
                                                             (line    8)
* abstractmethod() (abc モジュール):     abc --- 抽象基底クラス.
                                                             (line  159)
* abstractproperty() (abc モジュール):   abc --- 抽象基底クラス.
                                                             (line  279)
* AbstractSet (typing のクラス):         Aliases to container ABCs in collections abc.
                                                             (line    6)
* abstractstaticmethod() (abc モジュール): abc --- 抽象基底クラス.
                                                             (line  257)
* accept() (multiprocessing.connection.Listener のメソッド): リスナーとクライアント.
                                                             (line   84)
* accept() (socket.socket のメソッド):   socket オブジェクト.
                                                             (line   13)
* access() (os モジュール):              ファイルとディレクトリ.
                                                             (line   50)
* accumulate() (itertools モジュール):   Itertool関数.       (line   10)
* ACK (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   36)
* aclose() (agen のメソッド):            非同期ジェネレータイテレータメソッド.
                                                             (line   60)
* aclose() (contextlib.AsyncExitStack のメソッド): ユーティリティ.
                                                             (line  650)
* aclosing() (contextlib モジュール):    ユーティリティ.     (line  190)
* acos() (cmath モジュール):             三角関数<2>.        (line    6)
* acos() (math モジュール):              三角関数.           (line    6)
* acosh() (cmath モジュール):            双曲線関数<2>.      (line    6)
* acosh() (math モジュール):             双曲線関数.         (line    9)
* acquire() (_thread.lock のメソッド):   _thread --- 低水準なスレッド API.
                                                             (line  141)
* acquire() (asyncio.Condition のメソッド): Condition.       (line   46)
* acquire() (asyncio.Lock のメソッド):   Lock.               (line   36)
* acquire() (asyncio.Semaphore のメソッド): Semaphore.       (line   44)
* acquire() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   27)
* acquire() (multiprocessing.Lock のメソッド): 同期プリミティブ.
                                                             (line   86)
* acquire() (multiprocessing.RLock のメソッド): 同期プリミティブ.
                                                             (line  145)
* acquire() (threading.Condition のメソッド): Condition objects.
                                                             (line   85)
* acquire() (threading.Lock のメソッド): Lock objects.       (line   45)
* acquire() (threading.RLock のメソッド): RLock objects.     (line   45)
* acquire() (threading.Semaphore のメソッド): Semaphore objects.
                                                             (line   35)
* ACS_BBSS (curses モジュール):          定数<6>.            (line  470)
* ACS_BLOCK (curses モジュール):         定数<6>.            (line  473)
* ACS_BOARD (curses モジュール):         定数<6>.            (line  476)
* ACS_BSBS (curses モジュール):          定数<6>.            (line  479)
* ACS_BSSB (curses モジュール):          定数<6>.            (line  482)
* ACS_BSSS (curses モジュール):          定数<6>.            (line  485)
* ACS_BTEE (curses モジュール):          定数<6>.            (line  488)
* ACS_BULLET (curses モジュール):        定数<6>.            (line  491)
* ACS_CKBOARD (curses モジュール):       定数<6>.            (line  494)
* ACS_DARROW (curses モジュール):        定数<6>.            (line  497)
* ACS_DEGREE (curses モジュール):        定数<6>.            (line  500)
* ACS_DIAMOND (curses モジュール):       定数<6>.            (line  503)
* ACS_GEQUAL (curses モジュール):        定数<6>.            (line  506)
* ACS_HLINE (curses モジュール):         定数<6>.            (line  509)
* ACS_LANTERN (curses モジュール):       定数<6>.            (line  512)
* ACS_LARROW (curses モジュール):        定数<6>.            (line  515)
* ACS_LEQUAL (curses モジュール):        定数<6>.            (line  518)
* ACS_LLCORNER (curses モジュール):      定数<6>.            (line  521)
* ACS_LRCORNER (curses モジュール):      定数<6>.            (line  524)
* ACS_LTEE (curses モジュール):          定数<6>.            (line  527)
* ACS_NEQUAL (curses モジュール):        定数<6>.            (line  530)
* ACS_PI (curses モジュール):            定数<6>.            (line  533)
* ACS_PLMINUS (curses モジュール):       定数<6>.            (line  536)
* ACS_PLUS (curses モジュール):          定数<6>.            (line  539)
* ACS_RARROW (curses モジュール):        定数<6>.            (line  542)
* ACS_RTEE (curses モジュール):          定数<6>.            (line  545)
* ACS_S1 (curses モジュール):            定数<6>.            (line  548)
* ACS_S3 (curses モジュール):            定数<6>.            (line  551)
* ACS_S7 (curses モジュール):            定数<6>.            (line  554)
* ACS_S9 (curses モジュール):            定数<6>.            (line  557)
* ACS_SBBS (curses モジュール):          定数<6>.            (line  560)
* ACS_SBSB (curses モジュール):          定数<6>.            (line  563)
* ACS_SBSS (curses モジュール):          定数<6>.            (line  566)
* ACS_SSBB (curses モジュール):          定数<6>.            (line  569)
* ACS_SSBS (curses モジュール):          定数<6>.            (line  572)
* ACS_SSSB (curses モジュール):          定数<6>.            (line  575)
* ACS_SSSS (curses モジュール):          定数<6>.            (line  578)
* ACS_STERLING (curses モジュール):      定数<6>.            (line  581)
* ACS_TTEE (curses モジュール):          定数<6>.            (line  584)
* ACS_UARROW (curses モジュール):        定数<6>.            (line  587)
* ACS_ULCORNER (curses モジュール):      定数<6>.            (line  590)
* ACS_URCORNER (curses モジュール):      定数<6>.            (line  593)
* ACS_VLINE (curses モジュール):         定数<6>.            (line  596)
* Action (argparse のクラス):            Action クラス.      (line   11)
* action (optparse.Option の属性):       オプション属性.     (line   19)
* ACTIONS (optparse.Option の属性):      新しいアクションの追加.
                                                             (line   31)
* activate_stack_trampoline() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1859)
* active_children() (multiprocessing モジュール): その他<5>. (line    6)
* active_count() (threading モジュール): リファレンス<2>.    (line    8)
* actual() (tkinter.font.Font のメソッド): tkinter font --- Tkinter フォントラッパー.
                                                             (line   47)
* Add (ast のクラス):                    式 expression<2>.   (line   55)
* add_alias() (email.charset モジュール): email charset 文字集合の表現.
                                                             (line  199)
* add_alternative() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  641)
* add_argument_group() (argparse.ArgumentParser のメソッド): 引数グループ.
                                                             (line    6)
* add_argument() (argparse.ArgumentParser のメソッド): add_argument メソッド.
                                                             (line    6)
* add_attachment() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  653)
* add_cgi_vars() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line  135)
* add_charset() (email.charset モジュール): email charset 文字集合の表現.
                                                             (line  169)
* add_codec() (email.charset モジュール): email charset 文字集合の表現.
                                                             (line  208)
* add_cookie_header() (http.cookiejar.CookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line   12)
* add_dll_directory() (os モジュール):   プロセス管理.       (line   24)
* add_done_callback() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line   82)
* add_done_callback() (asyncio.Task のメソッド): Task オブジェクト.
                                                             (line  102)
* add_done_callback() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   67)
* add_fallback() (gettext.NullTranslations のメソッド): NullTranslations クラス.
                                                             (line   31)
* add_flag() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line  127)
* add_flag() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line   81)
* add_flag() (mailbox.mboxMessage のメソッド): mboxMessage オブジェクト.
                                                             (line   78)
* add_flag() (mailbox.MMDFMessage のメソッド): MMDFMessage オブジェクト.
                                                             (line   77)
* add_folder() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line   73)
* add_folder() (mailbox.MH のメソッド):  MH オブジェクト.    (line   47)
* add_get_handler() (email.contentmanager.ContentManager のメソッド): email contentmanager Managing MIME Content.
                                                             (line   74)
* add_handler() (urllib.request.OpenerDirector のメソッド): OpenerDirector オブジェクト.
                                                             (line    8)
* add_header() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  261)
* add_header() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  371)
* add_header() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line   79)
* add_header() (wsgiref.headers.Headers のメソッド): wsgiref headers -- WSGI response header tools.
                                                             (line   60)
* add_history() (readline モジュール):   履歴リスト.         (line   37)
* add_label() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   55)
* add_mutually_exclusive_group() (argparse.ArgumentParser のメソッド): 相互排他.
                                                             (line    6)
* add_note() (BaseException のメソッド): 基底クラス.         (line   48)
* add_option() (optparse.OptionParser のメソッド): オプションの定義.
                                                             (line   14)
* add_parent() (urllib.request.BaseHandler のメソッド): BaseHandler オブジェクト.
                                                             (line   10)
* add_password() (urllib.request.HTTPPasswordMgr のメソッド): HTTPPasswordMgr オブジェクト.
                                                             (line    9)
* add_password() (urllib.request.HTTPPasswordMgrWithPriorAuth のメソッド): HTTPPasswordMgrWithPriorAuth オブジェクト.
                                                             (line   10)
* add_reader() (asyncio.loop のメソッド): ファイル記述子の監視.
                                                             (line    6)
* add_related() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  628)
* add_section() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  117)
* add_section() (configparser.RawConfigParser のメソッド): RawConfigParser オブジェクト.
                                                             (line   36)
* add_sequence() (mailbox.MHMessage のメソッド): MHMessage オブジェクト.
                                                             (line   40)
* add_set_handler() (email.contentmanager.ContentManager のメソッド): email contentmanager Managing MIME Content.
                                                             (line   79)
* add_signal_handler() (asyncio.loop のメソッド): Unix シグナル.
                                                             (line    6)
* add_subparsers() (argparse.ArgumentParser のメソッド): Subcommands.
                                                             (line    6)
* add_type() (mimetypes モジュール):     mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  125)
* add_type() (mimetypes.MimeTypes のメソッド): MimeTypes objects.
                                                             (line  106)
* add_unredirected_header() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line   92)
* add_writer() (asyncio.loop のメソッド): ファイル記述子の監視.
                                                             (line   20)
* add() (decimal.Context のメソッド):    Context オブジェクト.
                                                             (line  270)
* add() (graphlib.TopologicalSorter のメソッド): graphlib --- グラフ構造を操作する機能.
                                                             (line   79)
* add() (mailbox.Mailbox のメソッド):    Mailbox オブジェクト.
                                                             (line   58)
* add() (mailbox.Maildir のメソッド):    Maildir オブジェクト.
                                                             (line  191)
* add() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line   88)
* add() (pstats.Stats のメソッド):       Stats クラス.       (line   44)
* add() (set のメソッド):                set（集合）型 --- set frozenset.
                                                             (line  198)
* add() (tarfile.TarFile のメソッド):    TarFile オブジェクト.
                                                             (line  276)
* add() (tkinter.ttk.Notebook のメソッド): ttk Notebook.     (line    8)
* addAsyncCleanup() (unittest.IsolatedAsyncioTestCase のメソッド): テストクラス.
                                                             (line  949)
* addaudithook() (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line   25)
* addch() (curses.window のメソッド):    Window オブジェクト.
                                                             (line   11)
* addClassCleanup() (unittest.TestCase のクラスメソッド): テストクラス.
                                                             (line  872)
* addCleanup() (unittest.TestCase のメソッド): テストクラス. (line  833)
* addcomponent() (turtle.Shape のメソッド): Public classes.  (line   67)
* addDuration() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  429)
* addError() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  360)
* addExpectedFailure() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  396)
* addFailure() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  371)
* addfile() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  296)
* addFilter() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   55)
* addFilter() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  315)
* addHandler() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  332)
* addinfourl (urllib.response のクラス): urllib response --- Response classes used by urllib.
                                                             (line   12)
* addLevelName() (logging モジュール):   モジュールレベルの関数.
                                                             (line  122)
* addModuleCleanup() (unittest モジュール): setUpModule と tearDownModule.
                                                             (line   22)
* addnstr() (curses.window のメソッド):  Window オブジェクト.
                                                             (line   24)
* AddPackagePath() (modulefinder モジュール): modulefinder --- スクリプト中で使用されているモジュールの検索.
                                                             (line   16)
* addr_spec (email.headerregistry.Address の属性): email headerregistry Custom Header Objects.
                                                             (line  434)
* Address (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  397)
* address (email.headerregistry.SingleAddressHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  217)
* address (multiprocessing.connection.Listener の属性): リスナーとクライアント.
                                                             (line  100)
* address (multiprocessing.managers.BaseManager の属性): マネージャー.
                                                             (line  138)
* address_exclude() (ipaddress.IPv4Network のメソッド): Network オブジェクト.
                                                             (line  160)
* address_exclude() (ipaddress.IPv6Network のメソッド): Network オブジェクト.
                                                             (line  344)
* address_family (socketserver.BaseServer の属性): Serverオブジェクト<2>.
                                                             (line   65)
* address_string() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  380)
* addresses (email.headerregistry.AddressHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  192)
* addresses (email.headerregistry.Group の属性): email headerregistry Custom Header Objects.
                                                             (line  470)
* AddressHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  177)
* addressof() (ctypes モジュール):       ユーティリティー関数.
                                                             (line    6)
* AddressValueError:                     Custom Exceptions.  (line    9)
* addshape() (turtle モジュール):        設定と特殊なメソッド.
                                                             (line   70)
* addsitedir() (site モジュール):        モジュールの内容<5>.
                                                             (line   52)
* addSkip() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  388)
* addstr() (curses.window のメソッド):   Window オブジェクト.
                                                             (line   31)
* addSubTest() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  414)
* addSuccess() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  382)
* addTest() (unittest.TestSuite のメソッド): テストのグループ化.
                                                             (line   25)
* addTests() (unittest.TestSuite のメソッド): テストのグループ化.
                                                             (line   30)
* addTypeEqualityFunc() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  655)
* addUnexpectedSuccess() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  406)
* adjust_int_max_str_digits() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  777)
* adjusted() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  113)
* adler32() (zlib モジュール):           zlib --- gzip 互換の圧縮.
                                                             (line   30)
* AF_ALG (socket モジュール):            定数<8>.            (line  272)
* AF_BLUETOOTH (socket モジュール):      定数<8>.            (line  307)
* AF_CAN (socket モジュール):            定数<8>.            (line  134)
* AF_DIVERT (socket モジュール):         定数<8>.            (line  211)
* AF_HYPERV (socket モジュール):         定数<8>.            (line  445)
* AF_INET (socket モジュール):           定数<8>.            (line   11)
* AF_INET6 (socket モジュール):          定数<8>.            (line   11)
* AF_LINK (socket モジュール):           定数<8>.            (line  296)
* AF_PACKET (socket モジュール):         定数<8>.            (line  221)
* AF_QIPCRTR (socket モジュール):        定数<8>.            (line  406)
* AF_RDS (socket モジュール):            定数<8>.            (line  243)
* AF_UNIX (socket モジュール):           定数<8>.            (line   11)
* AF_UNSPEC (socket モジュール):         定数<8>.            (line   21)
* AF_VSOCK (socket モジュール):          定数<8>.            (line  283)
* alarm() (signal モジュール):           モジュールの内容<2>.
                                                             (line  295)
* ALERT_DESCRIPTION_HANDSHAKE_FAILURE (ssl モジュール): 定数<9>.
                                                             (line  517)
* ALERT_DESCRIPTION_INTERNAL_ERROR (ssl モジュール): 定数<9>.
                                                             (line  517)
* AlertDescription (ssl のクラス):       定数<9>.            (line  531)
* algorithm (sys.hash_info の属性):      sys --- システム固有のパラメーターと関数.
                                                             (line 1074)
* algorithms_available (hashlib モジュール): 属性.           (line   18)
* algorithms_guaranteed (hashlib モジュール): 属性.          (line    8)
* alias (ast のクラス):                  インポート.         (line   39)
* alias (pdb command):                   Debugger commands.  (line  379)
* alignment() (ctypes モジュール):       ユーティリティー関数.
                                                             (line   14)
* alive (weakref.finalize の属性):       weakref --- Weak references.
                                                             (line  302)
* ALL_COMPLETED (asyncio モジュール):    要素の終了待機.     (line   45)
* ALL_COMPLETED (concurrent.futures モジュール): モジュール関数<2>.
                                                             (line   39)
* all_errors (ftplib モジュール):        モジュール変数.     (line   25)
* all_features (xml.sax.handler モジュール): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   99)
* all_frames (tracemalloc.Filter の属性): Filter.            (line   59)
* all_properties (xml.sax.handler モジュール): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line  131)
* all_suffixes() (importlib.machinery モジュール): importlib machinery -- Importers and path hooks.
                                                             (line   55)
* all_tasks() (asyncio モジュール):      イントロスペクション.
                                                             (line   16)
* allocate_lock() (_thread モジュール):  _thread --- 低水準なスレッド API.
                                                             (line   81)
* allocfunc (C type):                    Slot Type typedefs. (line    6)
* ALLOW_MISSING (os.path モジュール):    os path --- 一般的なパス名操作.
                                                             (line  447)
* allow_reuse_address (socketserver.BaseServer の属性): Serverオブジェクト<2>.
                                                             (line   93)
* allowed_domains() (http.cookiejar.DefaultCookiePolicy のメソッド): DefaultCookiePolicy オブジェクト.
                                                             (line   64)
* ALT_DIGITS (locale モジュール):        locale --- 国際化サービス.
                                                             (line  335)
* alt() (curses.ascii モジュール):       curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  218)
* altsep (os モジュール):                雑多なシステム情報. (line  122)
* altzone (time モジュール):             Timezone Constants. (line    6)
* ALWAYS_EQ (test.support モジュール):   test support --- Utilities for the Python test suite.
                                                             (line  195)
* ALWAYS_TYPED_ACTIONS (optparse.Option の属性): 新しいアクションの追加.
                                                             (line   43)
* AmbiguousOptionError:                  例外<12>.           (line   25)
* AMPER (token モジュール):              token --- Python 解析木で使われる定数.
                                                             (line  239)
* AMPEREQUAL (token モジュール):         token --- Python 解析木で使われる定数.
                                                             (line  305)
* Anchor (importlib.resources のクラス): importlib resources -- パッケージリソースの読み取り、オープン、アクセス.
                                                             (line   47)
* anchor (pathlib.PurePath の属性):      メソッドとプロパティ.
                                                             (line   65)
* And (ast のクラス):                    式 expression<2>.   (line   89)
* and_() (operator モジュール):          operator --- 関数形式の標準演算子.
                                                             (line   93)
* android_ver() (platform モジュール):   Android platform.   (line    6)
* AnnAssign (ast のクラス):              文 Statements.      (line   41)
* annotate function:                     用語集<2>.          (line   35)
* Annotated (typing モジュール):         特殊形式.           (line  299)
* annotated;代入:                        注釈付き代入文 annotated assignment statements.
                                                             (line    6)
* annotation:                            用語集<2>.          (line   43)
* annotation (inspect.Parameter の属性): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  249)
* ANNOTATION (symtable.SymbolTableType の属性): 記号表の検査.
                                                             (line   26)
* annotations (__future__ モジュール):   モジュールコンテンツ<5>.
                                                             (line   47)
* annotations_to_string() (annotationlib モジュール): 関数<12>.
                                                             (line    6)
* answer_challenge() (multiprocessing.connection モジュール): リスナーとクライアント.
                                                             (line   25)
* anticipate_failure() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  477)
* Any (typing モジュール):               特殊型.             (line    9)
* ANY (unittest.mock モジュール):        ANY.                (line    6)
* ANY_CONTIGUOUS (inspect.BufferFlags の属性): Buffer flags. (line   29)
* AnyStr (typing モジュール):            特殊型.             (line   21)
* api_version (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line 2163)
* apilevel (sqlite3 モジュール):         モジュール定数.     (line   64)
* apop() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   40)
* append_history_file() (readline モジュール): 履歴ファイル. (line   27)
* append() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  123)
* append() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   35)
* append() (email.header.Header のメソッド): email header 国際化されたヘッダー.
                                                             (line   93)
* append() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line   32)
* append() (sequence のメソッド):        ミュータブルなシーケンス型.
                                                             (line   69)
* append() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   83)
* appendChild() (xml.dom.Node のメソッド): Node オブジェクト.
                                                             (line  114)
* appendleft() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   39)
* AppleFrameworkLoader (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line  440)
* application_uri() (wsgiref.util モジュール): wsgiref util -- WSGI environment utilities.
                                                             (line   33)
* apply_async() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line   78)
* apply_defaults() (inspect.BoundArguments のメソッド): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  391)
* apply() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line   70)
* APRIL (calendar モジュール):           calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  483)
* architecture() (platform モジュール):  Cross platform.     (line    6)
* archive (zipimport.zipimporter の属性): zipimporter オブジェクト.
                                                             (line   96)
* AREGTYPE (tarfile モジュール):         tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  329)
* aRepr (reprlib モジュール):            reprlib --- もう一つの repr の実装.
                                                             (line   42)
* arg (ast のクラス):                    関数およびクラス定義.
                                                             (line   67)
* args (BaseException の属性):           基底クラス.         (line   16)
* args (functools.partial の属性):       partial オブジェクト.
                                                             (line   16)
* args (inspect.BoundArguments の属性):  Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  376)
* args (pdb command):                    Debugger commands.  (line  267)
* args (subprocess.CompletedProcess の属性): Using the subprocess Module.
                                                             (line  104)
* args (subprocess.Popen の属性):        Popen オブジェクト. (line  111)
* args (typing.ParamSpec の属性):        Building generic types and type aliases.
                                                             (line  456)
* args_from_interpreter_flags() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  344)
* argtypes (ctypes._CFuncPtr の属性):    外部関数.           (line   45)
* ArgumentDefaultsHelpFormatter (argparse のクラス): formatter_class.
                                                             (line   10)
* ArgumentError:                         例外<10>.           (line    6)
* ArgumentError <1>:                     例外<11>.           (line    6)
* ArgumentParser (argparse のクラス):    ArgumentParser オブジェクト.
                                                             (line    6)
* arguments (ast のクラス):              関数およびクラス定義.
                                                             (line   49)
* arguments (inspect.BoundArguments の属性): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  356)
* ArgumentTypeError:                     例外<11>.           (line   14)
* argv (in module sys):                  プロセスワイドのパラメータ.
                                                             (line  223)
* argv (in module sys) <1>:              PyConfig.           (line  129)
* argv (sys モジュール):                 sys --- システム固有のパラメーターと関数.
                                                             (line   69)
* ArithmeticError:                       基底クラス.         (line   68)
* array (array のクラス):                array --- 効率的な数値配列.
                                                             (line   90)
* Array (ctypes のクラス):               配列とポインタ.     (line    6)
* ARRAY() (ctypes モジュール):           配列とポインタ.     (line   31)
* Array() (multiprocessing モジュール):  共有 ctypes オブジェクト.
                                                             (line   42)
* Array() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  216)
* Array() (multiprocessing.sharedctypes モジュール): The multiprocessing sharedctypes module.
                                                             (line   51)
* arrays:                                array --- 効率的な数値配列.
                                                             (line    6)
* arraysize (sqlite3.Cursor の属性):     Cursor オブジェクト.
                                                             (line  174)
* AS pattern, OR pattern, capture pattern, wildcard pattern: パターン.
                                                             (line    6)
* as_bytes() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  107)
* as_bytes() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  107)
* as_completed() (asyncio モジュール):   要素の終了待機.     (line   60)
* as_completed() (concurrent.futures モジュール): モジュール関数<2>.
                                                             (line   43)
* as_digested_dict (compression.zstd.ZstdDict の属性): Zstandard dictionaries.
                                                             (line  143)
* as_file() (importlib.resources モジュール): importlib resources -- パッケージリソースの読み取り、オープン、アクセス.
                                                             (line   75)
* as_integer_ratio():                    fractions --- 有理数.
                                                             (line   15)
* as_integer_ratio() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  120)
* as_integer_ratio() (float のメソッド): 浮動小数点数に対する追加のメソッド.
                                                             (line   23)
* as_integer_ratio() (fractions.Fraction のメソッド): fractions --- 有理数.
                                                             (line  123)
* as_integer_ratio() (int のメソッド):   整数型における追加のメソッド.
                                                             (line  148)
* as_posix() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  181)
* as_string() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line   61)
* as_string() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line   60)
* as_tuple() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  133)
* as_undigested_dict (compression.zstd.ZstdDict の属性): Zstandard dictionaries.
                                                             (line  147)
* as_uri() (pathlib.Path のメソッド):    URIのパースと生成.  (line   47)
* as;except clause:                      except 節.          (line   29)
* as;import statement:                   import 文.          (line   39)
* as;match statement:                    match 文<2>.        (line    6)
* as;with statement:                     with 文.            (line    6)
* ASCII:                                 リテラル.           (line   15)
* ASCII (re モジュール):                 フラグ.             (line   16)
* ascii_letters (string モジュール):     文字列定数.         (line    8)
* ascii_lowercase (string モジュール):   文字列定数.         (line   13)
* ascii_uppercase (string モジュール):   文字列定数.         (line   18)
* ascii() (curses.ascii モジュール):     curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  209)
* asctime() (time モジュール):           関数<5>.            (line    6)
* asdict() (dataclasses モジュール):     モジュールの内容<4>.
                                                             (line  342)
* asend() (agen のメソッド):             非同期ジェネレータイテレータメソッド.
                                                             (line   27)
* asin() (cmath モジュール):             三角関数<2>.        (line   12)
* asin() (math モジュール):              三角関数.           (line   10)
* asinh() (cmath モジュール):            双曲線関数<2>.      (line   11)
* asinh() (math モジュール):             双曲線関数.         (line   13)
* askcolor() (tkinter.colorchooser モジュール): tkinter colorchooser --- カラー選択ダイアログ.
                                                             (line   17)
* askdirectory() (tkinter.filedialog モジュール): ネイティブの読み込み/保存ダイアログ.
                                                             (line   53)
* askfloat() (tkinter.simpledialog モジュール): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   14)
* askinteger() (tkinter.simpledialog モジュール): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   14)
* askokcancel() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  119)
* askopenfile() (tkinter.filedialog モジュール): ネイティブの読み込み/保存ダイアログ.
                                                             (line   30)
* askopenfilename() (tkinter.filedialog モジュール): ネイティブの読み込み/保存ダイアログ.
                                                             (line   41)
* askopenfilenames() (tkinter.filedialog モジュール): ネイティブの読み込み/保存ダイアログ.
                                                             (line   41)
* askopenfiles() (tkinter.filedialog モジュール): ネイティブの読み込み/保存ダイアログ.
                                                             (line   30)
* askquestion() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  113)
* askretrycancel() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  126)
* asksaveasfile() (tkinter.filedialog モジュール): ネイティブの読み込み/保存ダイアログ.
                                                             (line   36)
* asksaveasfilename() (tkinter.filedialog モジュール): ネイティブの読み込み/保存ダイアログ.
                                                             (line   48)
* askstring() (tkinter.simpledialog モジュール): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   14)
* askyesno() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  133)
* askyesnocancel() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  139)
* Assert (ast のクラス):                 文 Statements.      (line  127)
* assert_any_await() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  834)
* assert_any_call() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  149)
* assert_awaited_once_with() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  817)
* assert_awaited_once() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  784)
* assert_awaited_with() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  800)
* assert_awaited() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  764)
* assert_called_once_with() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  134)
* assert_called_once() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  106)
* assert_called_with() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  124)
* assert_called() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line   95)
* assert_has_awaits() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  851)
* assert_has_calls() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  165)
* assert_never() (typing モジュール):    Functions and decorators.
                                                             (line   43)
* assert_not_awaited() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  878)
* assert_not_called() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  188)
* assert_python_failure() (test.support.script_helper モジュール): test support script_helper --- Utilities for the Python execution tests.
                                                             (line   57)
* assert_python_ok() (test.support.script_helper モジュール): test support script_helper --- Utilities for the Python execution tests.
                                                             (line   40)
* assert_type() (typing モジュール):     Functions and decorators.
                                                             (line   14)
* assertAlmostEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  549)
* assertCountEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  605)
* assertDictEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  743)
* assertEndsWith() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  630)
* assertEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  185)
* assertFalse() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  208)
* assertGreater() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  573)
* assertGreaterEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  573)
* assertHasAttr() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  640)
* assertIn() (unittest.TestCase のメソッド): テストクラス.   (line  237)
* assertInBytecode() (test.support.bytecode_helper.BytecodeTestCase のメソッド): test support bytecode_helper --- Support tools for testing correct bytecode generation.
                                                             (line   22)
* AssertionError:                        具象例外.           (line    8)
* assertIs() (unittest.TestCase のメソッド): テストクラス.   (line  221)
* assertIsInstance() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  245)
* assertIsNone() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  229)
* assertIsNot() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  221)
* assertIsNotNone() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  229)
* assertIsSubclass() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  256)
* assertLess() (unittest.TestCase のメソッド): テストクラス. (line  573)
* assertLessEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  573)
* assertListEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  720)
* assertLogs() (unittest.TestCase のメソッド): テストクラス. (line  432)
* assertMultiLineEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  696)
* assertNoLogs() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  476)
* assertNotAlmostEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  549)
* assertNotEndsWith() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  632)
* assertNotEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  203)
* assertNotHasAttr() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  642)
* assertNotIn() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  237)
* assertNotInBytecode() (test.support.bytecode_helper.BytecodeTestCase のメソッド): test support bytecode_helper --- Support tools for testing correct bytecode generation.
                                                             (line   28)
* assertNotIsInstance() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  245)
* assertNotIsSubclass() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  256)
* assertNotRegex() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  587)
* assertNotStartsWith() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  622)
* assertRaises() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  297)
* assertRaisesRegex() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  339)
* assertRegex() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  587)
* assertSequenceEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  706)
* assertSetEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  731)
* assertStartsWith() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  620)
* assertTrue() (unittest.TestCase のメソッド): テストクラス. (line  208)
* assertTupleEqual() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  720)
* assertWarns() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  366)
* assertWarnsRegex() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  408)
* Assign (ast のクラス):                 文 Statements.      (line    6)
* assignment expression:                 ブール演算 boolean operation.
                                                             (line   34)
* assume_default_colors() (curses モジュール): 関数<6>.      (line   18)
* AST (ast のクラス):                    Node クラス.        (line    6)
* ast コマンドラインオプション; -a:      コマンドラインでの使用<8>.
                                                             (line   29)
* ast コマンドラインオプション; -feature-version: コマンドラインでの使用<8>.
                                                             (line   38)
* ast コマンドラインオプション; -h:      コマンドラインでの使用<8>.
                                                             (line   15)
* ast コマンドラインオプション; -help:   コマンドラインでの使用<8>.
                                                             (line   15)
* ast コマンドラインオプション; -i:      コマンドラインでの使用<8>.
                                                             (line   33)
* ast コマンドラインオプション; -include-attributes: コマンドラインでの使用<8>.
                                                             (line   29)
* ast コマンドラインオプション; -indent: コマンドラインでの使用<8>.
                                                             (line   33)
* ast コマンドラインオプション; -m:      コマンドラインでの使用<8>.
                                                             (line   19)
* ast コマンドラインオプション; -mode:   コマンドラインでの使用<8>.
                                                             (line   19)
* ast コマンドラインオプション; -no-type-comments: コマンドラインでの使用<8>.
                                                             (line   25)
* ast コマンドラインオプション; -O:      コマンドラインでの使用<8>.
                                                             (line   45)
* ast コマンドラインオプション; -optimize: コマンドラインでの使用<8>.
                                                             (line   45)
* ast コマンドラインオプション; -show-empty: コマンドラインでの使用<8>.
                                                             (line   52)
* astimezone() (datetime.datetime のメソッド): datetime objects.
                                                             (line  482)
* astuple() (dataclasses モジュール):    モジュールの内容<4>.
                                                             (line  374)
* async for;in comprehensions:           リスト、集合、辞書の表示.
                                                             (line   14)
* AsyncContextDecorator (contextlib のクラス): ユーティリティ.
                                                             (line  469)
* AsyncContextManager (typing のクラス): Aliases to contextlib ABCs.
                                                             (line   25)
* asynccontextmanager() (contextlib モジュール): ユーティリティ.
                                                             (line   94)
* AsyncExitStack (contextlib のクラス):  ユーティリティ.     (line  621)
* AsyncFor (ast のクラス):               async と await.     (line   34)
* AsyncFunctionDef (ast のクラス):       async と await.     (line    6)
* AsyncGenerator (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  188)
* AsyncGenerator (typing のクラス):      Aliases to asynchronous ABCs in collections abc.
                                                             (line   21)
* AsyncGeneratorType (types モジュール): 標準的なインタプリタ型.
                                                             (line   48)
* asynchronous context manager:          用語集<2>.          (line   87)
* asynchronous generator:                用語集<2>.          (line   94)
* asynchronous generator iterator:       用語集<2>.          (line  109)
* asynchronous generator;asynchronous iterator: 非同期ジェネレータ関数 asynchronous generator function.
                                                             (line    6)
* asynchronous generator;関数:           非同期ジェネレータ関数 asynchronous generator function.
                                                             (line    6)
* asynchronous iterable:                 用語集<2>.          (line  125)
* asynchronous iterator:                 用語集<2>.          (line  132)
* asyncio.subprocess.DEVNULL (組み込み変数): 定数<7>.        (line   22)
* asyncio.subprocess.PIPE (組み込み変数): 定数<7>.           (line    6)
* asyncio.subprocess.Process (組み込みクラス): サブプロセスとやりとりする.
                                                             (line   11)
* asyncio.subprocess.STDOUT (組み込み変数): 定数<7>.         (line   17)
* AsyncIterable (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  174)
* AsyncIterable (typing のクラス):       Aliases to asynchronous ABCs in collections abc.
                                                             (line   38)
* AsyncIterator (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  181)
* AsyncIterator (typing のクラス):       Aliases to asynchronous ABCs in collections abc.
                                                             (line   48)
* AsyncMock (unittest.mock のクラス):    Mock クラス.        (line  692)
* AsyncResult (multiprocessing.pool のクラス): プロセスプール.
                                                             (line  200)
* asyncSetUp() (unittest.IsolatedAsyncioTestCase のメソッド): テストクラス.
                                                             (line  927)
* asyncTearDown() (unittest.IsolatedAsyncioTestCase のメソッド): テストクラス.
                                                             (line  936)
* AsyncWith (ast のクラス):              async と await.     (line   34)
* AT (token モジュール):                 token --- Python 解析木で使われる定数.
                                                             (line  329)
* at_eof() (asyncio.StreamReader のメソッド): StreamReader.  (line   84)
* atan() (cmath モジュール):             三角関数<2>.        (line   17)
* atan() (math モジュール):              三角関数.           (line   15)
* atan2() (math モジュール):             三角関数.           (line   20)
* atanh() (cmath モジュール):            双曲線関数<2>.      (line   17)
* atanh() (math モジュール):             双曲線関数.         (line   17)
* ATEQUAL (token モジュール):            token --- Python 解析木で使われる定数.
                                                             (line  332)
* atexit (weakref.finalize の属性):      weakref --- Weak references.
                                                             (line  307)
* athrow() (agen のメソッド):            非同期ジェネレータイテレータメソッド.
                                                             (line   42)
* atof() (locale モジュール):            locale --- 国際化サービス.
                                                             (line  509)
* atoi() (locale モジュール):            locale --- 国際化サービス.
                                                             (line  515)
* atom:                                  アトム、原子的要素 atom.
                                                             (line    6)
* atomic operation:                      用語集<2>.          (line  141)
* attach_mock() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  257)
* attach() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  168)
* attached thread state:                 用語集<2>.          (line  151)
* attempted (doctest.TestResults の属性): TestResults objects.
                                                             (line   12)
* AttlistDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  289)
* attrgetter() (operator モジュール):    operator --- 関数形式の標準演算子.
                                                             (line  241)
* attrib (xml.etree.ElementTree.Element の属性): Element オブジェクト.
                                                             (line   46)
* Attribute (ast のクラス):              式 expression<2>.   (line  172)
* AttributeError:                        具象例外.           (line   12)
* attributes (xml.dom.Node の属性):      Node オブジェクト.  (line   26)
* AttributesImpl (xml.sax.xmlreader のクラス): xml sax xmlreader --- XML パーサーのインターフェース.
                                                             (line   67)
* AttributesNSImpl (xml.sax.xmlreader のクラス): xml sax xmlreader --- XML パーサーのインターフェース.
                                                             (line   77)
* attroff() (curses.window のメソッド):  Window オブジェクト.
                                                             (line   53)
* attron() (curses.window のメソッド):   Window オブジェクト.
                                                             (line   58)
* attrset() (curses.window のメソッド):  Window オブジェクト.
                                                             (line   63)
* audit() (sys モジュール):              sys --- システム固有のパラメーターと関数.
                                                             (line   89)
* auditing:                              sys --- システム固有のパラメーターと関数.
                                                             (line   91)
* AugAssign (ast のクラス):              文 Statements.      (line   95)
* augmented;代入:                        累算代入文 augmented assignment statement.
                                                             (line    6)
* AUGUST (calendar モジュール):          calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  483)
* auth() (ftplib.FTP_TLS のメソッド):    FTP_TLS オブジェクト.
                                                             (line   89)
* auth() (smtplib.SMTP のメソッド):      SMTP オブジェクト.  (line  135)
* authenticate() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line   36)
* AuthenticationError:                   Process クラスと例外.
                                                             (line  292)
* authenticators() (netrc.netrc のメソッド): netrc オブジェクト.
                                                             (line    8)
* authkey (multiprocessing.Process の属性): Process クラスと例外.
                                                             (line  175)
* auto (enum のクラス):                  ユーティリティとデコレータ.
                                                             (line    6)
* autocommit (sqlite3.Connection の属性): Connection オブジェクト.
                                                             (line  745)
* autorange() (timeit.Timer のメソッド): Python インターフェイス.
                                                             (line   87)
* available_timezones() (zoneinfo モジュール): 関数<3>.      (line    6)
* avoids_symlink_attacks (shutil.rmtree の属性): ディレクトリとファイルの操作.
                                                             (line  345)
* Await (ast のクラス):                  async と await.     (line   14)
* await_args (unittest.mock.AsyncMock の属性): Mock クラス.  (line  907)
* await_args_list (unittest.mock.AsyncMock の属性): Mock クラス.
                                                             (line  925)
* await_count (unittest.mock.AsyncMock の属性): Mock クラス. (line  891)
* await;in comprehensions:               リスト、集合、辞書の表示.
                                                             (line   41)
* awaitable:                             用語集<2>.          (line  186)
* Awaitable (collections.abc のクラス):  コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  134)
* Awaitable (typing のクラス):           Aliases to asynchronous ABCs in collections abc.
                                                             (line   58)
* b';バイト列リテラル:                   Unrecognized escape sequences.
                                                             (line   25)
* b";バイト列リテラル:                   Unrecognized escape sequences.
                                                             (line   24)
* b16decode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line  127)
* b16encode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line  122)
* b2a_base64() (binascii モジュール):    binascii --- バイナリ と ASCII 間の変換.
                                                             (line   63)
* b2a_hex() (binascii モジュール):       binascii --- バイナリ と ASCII 間の変換.
                                                             (line  116)
* b2a_qp() (binascii モジュール):        binascii --- バイナリ と ASCII 間の変換.
                                                             (line   78)
* b2a_uu() (binascii モジュール):        binascii --- バイナリ と ASCII 間の変換.
                                                             (line   32)
* b32decode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line   80)
* b32encode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line   75)
* b32hexdecode() (base64 モジュール):    RFC 4648 エンコーディング.
                                                             (line  110)
* b32hexencode() (base64 モジュール):    RFC 4648 エンコーディング.
                                                             (line  103)
* b64decode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line   25)
* b64encode() (base64 モジュール):       RFC 4648 エンコーディング.
                                                             (line   10)
* b85decode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line   83)
* b85encode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line   72)
* Babyl (mailbox のクラス):              Babyl オブジェクト. (line    6)
* BabylMessage (mailbox のクラス):       BabylMessage オブジェクト.
                                                             (line    6)
* back() (turtle モジュール):            Turtle の動き.      (line   24)
* backend (readline モジュール):         readline --- GNU readline のインターフェース.
                                                             (line   56)
* backslashreplace_errors() (codecs モジュール): エラーハンドラ.
                                                             (line  154)
* backslashreplace;error handler's name: エラーハンドラ.     (line   14)
* backup() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  539)
* backward() (turtle モジュール):        Turtle の動き.      (line   24)
* BadGzipFile:                           gzip --- gzip ファイルのサポート.
                                                             (line   68)
* BadOptionError:                        例外<12>.           (line   21)
* BadStatusLine:                         http client --- HTTP プロトコルクライアント.
                                                             (line  183)
* BadZipFile:                            zipfile --- ZIP アーカイブの処理.
                                                             (line   32)
* BadZipfile:                            zipfile --- ZIP アーカイブの処理.
                                                             (line   38)
* Barrier (asyncio のクラス):            Barrier.            (line    6)
* Barrier (multiprocessing のクラス):    同期プリミティブ.   (line   13)
* Barrier (threading のクラス):          Barrier objects.    (line   34)
* Barrier() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  163)
* base_exec_prefix (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line  120)
* base_prefix (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line  133)
* base64;encoding:                       base64 --- Base16 Base32 Base64 Base85 データのエンコード.
                                                             (line    8)
* BaseCGIHandler (wsgiref.handlers のクラス): wsgiref handlers -- server/gateway base classes.
                                                             (line   54)
* BaseCookie (http.cookies のクラス):    http cookies --- HTTP の状態管理.
                                                             (line   38)
* BaseException:                         基底クラス.         (line    8)
* BaseExceptionGroup:                    例外グループ.       (line   13)
* BaseHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  326)
* BaseHandler (wsgiref.handlers のクラス): wsgiref handlers -- server/gateway base classes.
                                                             (line   89)
* BaseHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line   39)
* BaseHTTPRequestHandler (http.server のクラス): http server --- HTTP サーバー.
                                                             (line   98)
* BaseManager (multiprocessing.managers のクラス): マネージャー.
                                                             (line   24)
* basename() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line   63)
* BaseProtocol (asyncio のクラス):       基底プロトコル.     (line    6)
* BaseProxy (multiprocessing.managers のクラス): Proxy オブジェクト.
                                                             (line   91)
* BaseRequestHandler (socketserver のクラス): Request Handler Objects.
                                                             (line    6)
* BaseRotatingHandler (logging.handlers のクラス): BaseRotatingHandler.
                                                             (line   12)
* BaseSelector (selectors のクラス):     クラス<4>.          (line   54)
* BaseServer (socketserver のクラス):    Serverオブジェクト<2>.
                                                             (line    6)
* BaseTransport (asyncio のクラス):      トランスポートのクラス階層構造.
                                                             (line    6)
* basicConfig() (logging モジュール):    モジュールレベルの関数.
                                                             (line  194)
* BasicContext (decimal モジュール):     Context オブジェクト.
                                                             (line   71)
* BasicInterpolation (configparser のクラス): 値の補間.      (line   10)
* batched() (itertools モジュール):      Itertool関数.       (line   71)
* baudrate() (curses モジュール):        関数<6>.            (line   33)
* bbox() (tkinter.ttk.Treeview のメソッド): ttk Treeview.    (line    8)
* BDADDR_ANY (socket モジュール):        定数<8>.            (line  315)
* BDADDR_BREDR (socket モジュール):      定数<8>.            (line  323)
* BDADDR_LE_PUBLIC (socket モジュール):  定数<8>.            (line  323)
* BDADDR_LE_RANDOM (socket モジュール):  定数<8>.            (line  323)
* BDADDR_LOCAL (socket モジュール):      定数<8>.            (line  315)
* Bdb (bdb のクラス):                    bdb --- デバッガーフレームワーク.
                                                             (line  130)
* BdbQuit:                               bdb --- デバッガーフレームワーク.
                                                             (line   15)
* BDFL:                                  用語集<2>.          (line  192)
* beep() (curses モジュール):            関数<6>.            (line   41)
* Beep() (winsound モジュール):          winsound --- Windows 用の音声再生インターフェース.
                                                             (line   14)
* begin_fill() (turtle モジュール):      塗りつぶし.         (line   35)
* begin_poly() (turtle モジュール):      特別な Turtle のメソッド.
                                                             (line   18)
* BEL (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   39)
* BELOW_NORMAL_PRIORITY_CLASS (subprocess モジュール): Windows Constants.
                                                             (line   75)
* below() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   17)
* betavariate() (random モジュール):     実数分布.           (line   29)
* bgcolor() (turtle モジュール):         ウィンドウの制御.   (line    6)
* bgpic() (turtle モジュール):           ウィンドウの制御.   (line   48)
* bidirectional() (unicodedata モジュール): unicodedata --- Unicode データベース.
                                                             (line   90)
* bigaddrspacetest() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  596)
* BigEndianStructure (ctypes のクラス):  構造化データ型.     (line   27)
* BigEndianUnion (ctypes のクラス):      構造化データ型.     (line   13)
* bigmemtest() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  580)
* bin() (enum モジュール):               ユーティリティとデコレータ.
                                                             (line  109)
* Binary (xmlrpc.client のクラス):       Binary オブジェクト.
                                                             (line    6)
* binary file:                           用語集<2>.          (line  197)
* binary semaphores:                     _thread --- 低水準なスレッド API.
                                                             (line    6)
* BINARY_OP (opcode):                    Python バイトコード命令.
                                                             (line  255)
* BINARY_SLICE (opcode):                 Python バイトコード命令.
                                                             (line  286)
* binaryfunc (C type):                   Slot Type typedefs. (line  121)
* BinaryIO (typing のクラス):            ABCs and Protocols for working with I/O.
                                                             (line    6)
* bind (widgets):                        バインドとイベント. (line    6)
* bind_partial() (inspect.Signature のメソッド): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  140)
* bind_port() (test.support.socket_helper モジュール): test support socket_helper --- Utilities for socket tests.
                                                             (line   37)
* bind_textdomain_codeset() (locale モジュール): メッセージカタログへのアクセス.
                                                             (line   16)
* bind_unix_socket() (test.support.socket_helper モジュール): test support socket_helper --- Utilities for socket tests.
                                                             (line   54)
* bind() (inspect.Signature のメソッド): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  133)
* bind() (socket.socket のメソッド):     socket オブジェクト.
                                                             (line   30)
* bindtextdomain() (gettext モジュール): GNU gettext API.    (line   14)
* bindtextdomain() (locale モジュール):  メッセージカタログへのアクセス.
                                                             (line   14)
* binomialvariate() (random モジュール): Discrete distributions.
                                                             (line    8)
* BinOp (ast のクラス):                  式 expression<2>.   (line   43)
* bisect_left() (bisect モジュール):     bisect --- 配列二分法アルゴリズム.
                                                             (line   32)
* bisect_right() (bisect モジュール):    bisect --- 配列二分法アルゴリズム.
                                                             (line   56)
* bisect() (bisect モジュール):          bisect --- 配列二分法アルゴリズム.
                                                             (line   56)
* bit_count() (int のメソッド):          整数型における追加のメソッド.
                                                             (line   30)
* bit_length() (int のメソッド):         整数型における追加のメソッド.
                                                             (line    9)
* bit_offset (ctypes.CField の属性):     構造化データ型.     (line  288)
* bit_size (ctypes.CField の属性):       構造化データ型.     (line  288)
* BitAnd (ast のクラス):                 式 expression<2>.   (line   55)
* BitOr (ast のクラス):                  式 expression<2>.   (line   55)
* bits_per_digit (sys.int_info の属性):  sys --- システム固有のパラメーターと関数.
                                                             (line 1177)
* BitXor (ast のクラス):                 式 expression<2>.   (line   55)
* bk() (turtle モジュール):              Turtle の動き.      (line   24)
* bkgd() (curses.window のメソッド):     Window オブジェクト.
                                                             (line   68)
* bkgdset() (curses.window のメソッド):  Window オブジェクト.
                                                             (line   79)
* blake2b, blake2s:                      BLAKE2.             (line    6)
* blake2b.MAX_DIGEST_SIZE (hashlib モジュール): 定数<5>.     (line   24)
* blake2b.MAX_KEY_SIZE (hashlib モジュール): 定数<5>.        (line   18)
* blake2b.PERSON_SIZE (hashlib モジュール): 定数<5>.         (line   12)
* blake2b.SALT_SIZE (hashlib モジュール): 定数<5>.           (line    6)
* blake2b() (hashlib モジュール):        ハッシュオブジェクトの作成.
                                                             (line    9)
* blake2s.MAX_DIGEST_SIZE (hashlib モジュール): 定数<5>.     (line   26)
* blake2s.MAX_KEY_SIZE (hashlib モジュール): 定数<5>.        (line   20)
* blake2s.PERSON_SIZE (hashlib モジュール): 定数<5>.         (line   14)
* blake2s.SALT_SIZE (hashlib モジュール): 定数<5>.           (line    8)
* blake2s() (hashlib モジュール):        ハッシュオブジェクトの作成.
                                                             (line   14)
* BLKTYPE (tarfile モジュール):          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  346)
* Blob (sqlite3 のクラス):               Blob オブジェクト.  (line    6)
* blobopen() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line   35)
* block_on_close (socketserver.ThreadingMixIn の属性): サーバ生成に関するノート.
                                                             (line   45)
* block_size (hmac.HMAC の属性):         hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   98)
* blocked_domains() (http.cookiejar.DefaultCookiePolicy のメソッド): DefaultCookiePolicy オブジェクト.
                                                             (line   51)
* BlockingIOError:                       OS 例外.            (line    9)
* BlockingIOError <1>:                   高水準のモジュールインターフェイス.
                                                             (line   67)
* blocksize (http.client.HTTPConnection の属性): HTTPConnection オブジェクト.
                                                             (line  164)
* BNF:                                   本マニュアルにおける表記法.
                                                             (line    6)
* BNF <1>:                               式 expression.      (line    6)
* body_encode() (email.charset.Charset のメソッド): email charset 文字集合の表現.
                                                             (line  140)
* body_encoding (email.charset.Charset の属性): email charset 文字集合の表現.
                                                             (line   68)
* body_line_iterator() (email.iterators モジュール): email iterators イテレータ.
                                                             (line   14)
* body() (tkinter.simpledialog.Dialog のメソッド): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   25)
* BOLD (tkinter.font モジュール):        tkinter font --- Tkinter フォントラッパー.
                                                             (line   15)
* BOM (codecs モジュール):               codecs --- codec レジストリと基底クラス.
                                                             (line  278)
* BOM_BE (codecs モジュール):            codecs --- codec レジストリと基底クラス.
                                                             (line  278)
* BOM_LE (codecs モジュール):            codecs --- codec レジストリと基底クラス.
                                                             (line  278)
* BOM_UTF16 (codecs モジュール):         codecs --- codec レジストリと基底クラス.
                                                             (line  278)
* BOM_UTF16_BE (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  278)
* BOM_UTF16_LE (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  278)
* BOM_UTF32 (codecs モジュール):         codecs --- codec レジストリと基底クラス.
                                                             (line  278)
* BOM_UTF32_BE (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  278)
* BOM_UTF32_LE (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  278)
* BOM_UTF8 (codecs モジュール):          codecs --- codec レジストリと基底クラス.
                                                             (line  278)
* bool (組み込みクラス):                 組み込み関数.       (line  134)
* BOOLEAN_STATES (configparser.ConfigParser の属性): パーサーの振る舞いをカスタマイズする.
                                                             (line  235)
* Boolean;''values'':                    ブーリアン型 - bool.
                                                             (line    9)
* Boolean;type:                          組み込み関数.       (line  145)
* Boolean;操作:                          真理値判定.         (line    6)
* Boolean;操作 <1>:                      ブール演算 --- and or not.
                                                             (line    6)
* Boolean;演算:                          ブール演算 boolean operation.
                                                             (line    6)
* BooleanOptionalAction (argparse のクラス): Action クラス.  (line   64)
* BoolOp (ast のクラス):                 式 expression<2>.   (line   71)
* bootstrap() (ensurepip モジュール):    モジュール API.     (line   13)
* border() (curses.window のメソッド):   Window オブジェクト.
                                                             (line   88)
* borrowed reference:                    用語集<2>.          (line  209)
* bottom_panel() (curses.panel モジュール): 関数<7>.         (line    8)
* bottom() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   21)
* BoundArguments (inspect のクラス):     Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  350)
* BoundaryError:                         email errors Exception and Defect classes.
                                                             (line   38)
* BoundedSemaphore (asyncio のクラス):   BoundedSemaphore.   (line    6)
* BoundedSemaphore (multiprocessing のクラス): 同期プリミティブ.
                                                             (line   23)
* BoundedSemaphore (threading のクラス): Semaphore objects.  (line   73)
* BoundedSemaphore() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  170)
* bounds() (compression.zstd.CompressionParameter のメソッド): Advanced parameter control.
                                                             (line   28)
* bounds() (compression.zstd.DecompressionParameter のメソッド): Advanced parameter control.
                                                             (line  279)
* box() (curses.window のメソッド):      Window オブジェクト.
                                                             (line  127)
* bpbynumber (bdb.Breakpoint の属性):    bdb --- デバッガーフレームワーク.
                                                             (line  111)
* bpformat() (bdb.Breakpoint のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line   57)
* bplist (bdb.Breakpoint の属性):        bdb --- デバッガーフレームワーク.
                                                             (line  116)
* bpprint() (bdb.Breakpoint のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line   76)
* BRANCH_LEFT (monitoring event):        Events.             (line    8)
* BRANCH_RIGHT (monitoring event):       Events.             (line   17)
* Break (ast のクラス):                  制御フロー.         (line   99)
* break (pdb command):                   Debugger commands.  (line  103)
* break_anywhere() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  290)
* break_here() (bdb.Bdb のメソッド):     bdb --- デバッガーフレームワーク.
                                                             (line  281)
* break_long_words (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  246)
* break_on_hyphens (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  255)
* Breakpoint (bdb のクラス):             bdb --- デバッガーフレームワーク.
                                                             (line   21)
* breakpointhook() (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line  233)
* breakpoints:                           Help メニュー Shell ウィンドウ、Editor ウィンドウ.
                                                             (line   31)
* broadcast_address (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line   89)
* broadcast_address (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  313)
* broken (asyncio.Barrier の属性):       Barrier.            (line  104)
* broken (threading.Barrier の属性):     Barrier objects.    (line  100)
* BrokenBarrierError:                    Barrier objects.    (line  104)
* BrokenBarrierError <1>:                Barrier.            (line  108)
* BrokenExecutor:                        例外クラス.         (line   18)
* BrokenInterpreterPool:                 例外クラス.         (line   41)
* BrokenPipeError:                       OS 例外.            (line   38)
* BrokenProcessPool:                     例外クラス.         (line   49)
* BrokenThreadPool:                      例外クラス.         (line   33)
* BROWSER:                               webbrowser.         (line    6)
* BROWSER <1>:                           webbrowser.         (line   10)
* BROWSER <2>:                           ライブラリ<24>.     (line  420)
* BROWSER <3>:                           ライブラリ<24>.     (line  424)
* BROWSER <4>:                           webbrowser --- 便利なウェブブラウザコントローラー.
                                                             (line   20)
* BROWSER <5>:                           webbrowser --- 便利なウェブブラウザコントローラー.
                                                             (line   30)
* BROWSER <6>:                           webbrowser --- 便利なウェブブラウザコントローラー.
                                                             (line   40)
* BROWSER <7>:                           コマンドライン・インターフェース<6>.
                                                             (line   87)
* BS (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   42)
* BsdDbShelf (shelve のクラス):          制限事項.           (line   61)
* btlazy2 (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  319)
* btopt (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  321)
* BTPROTO_HCI (socket モジュール):       定数<8>.            (line  307)
* BTPROTO_L2CAP (socket モジュール):     定数<8>.            (line  307)
* BTPROTO_RFCOMM (socket モジュール):    定数<8>.            (line  307)
* BTPROTO_SCO (socket モジュール):       定数<8>.            (line  307)
* btultra (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  323)
* btultra2 (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  325)
* buf (multiprocessing.shared_memory.SharedMemory の属性): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  115)
* Buffer (collections.abc のクラス):     コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  198)
* buffer (io.TextIOBase の属性):         テキスト I/O<2>.    (line   30)
* buffer (unittest.TestResult の属性):   テストのロードと起動.
                                                             (line  290)
* buffer interface;(see buffer protocol): イテレータプロトコル iterator protocol.
                                                             (line   64)
* buffer object;(see buffer protocol):   イテレータプロトコル iterator protocol.
                                                             (line   63)
* buffer protocol:                       イテレータプロトコル iterator protocol.
                                                             (line   64)
* buffer protocol;str (組み込みクラス):  テキストシーケンス型 --- str.
                                                             (line   64)
* buffer protocol;バイナリシーケンス型:  printf 形式の文字列書式化.
                                                             (line  185)
* buffer size, I/O:                      組み込み関数.       (line 1466)
* buffer_info() (array.array のメソッド): array --- 効率的な数値配列.
                                                             (line  127)
* buffer_size (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  169)
* buffer_text (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  175)
* buffer_updated() (asyncio.BufferedProtocol のメソッド): バッファリングされたストリーミングプロトコル.
                                                             (line   34)
* buffer_used (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  186)
* BufferedIOBase (io のクラス):          I/O 基底クラス.     (line  223)
* BufferedProtocol (asyncio のクラス):   基底プロトコル.     (line   16)
* BufferedRandom (io のクラス):          バッファ付きストリーム.
                                                             (line  138)
* BufferedReader (io のクラス):          バッファ付きストリーム.
                                                             (line   57)
* BufferedRWPair (io のクラス):          バッファ付きストリーム.
                                                             (line  154)
* BufferedWriter (io のクラス):          バッファ付きストリーム.
                                                             (line   96)
* BufferError:                           基底クラス.         (line   74)
* BufferFlags (inspect のクラス):        Buffer flags.       (line    6)
* BufferingFormatter (logging のクラス): フォーマッタオブジェクト.
                                                             (line  127)
* BufferingHandler (logging.handlers のクラス): MemoryHandler.
                                                             (line   19)
* BufferTooShort:                        Process クラスと例外.
                                                             (line  284)
* BUILD_INTERPOLATION (opcode):          Python バイトコード命令.
                                                             (line  666)
* BUILD_LIST (opcode):                   Python バイトコード命令.
                                                             (line  707)
* BUILD_MAP (opcode):                    Python バイトコード命令.
                                                             (line  717)
* build_opener() (urllib.request モジュール): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  122)
* BUILD_SET (opcode):                    Python バイトコード命令.
                                                             (line  712)
* BUILD_SLICE (opcode):                  Python バイトコード命令.
                                                             (line 1188)
* BUILD_STRING (opcode):                 Python バイトコード命令.
                                                             (line  727)
* BUILD_TEMPLATE (opcode):               Python バイトコード命令.
                                                             (line  654)
* BUILD_TUPLE (opcode):                  Python バイトコード命令.
                                                             (line  694)
* built-in function; __import__():       組み込み関数.       (line 2175)
* built-in function; abs():              組み込み関数.       (line   43)
* built-in function; aiter():            組み込み関数.       (line   49)
* built-in function; all():              組み込み関数.       (line   59)
* built-in function; anext():            組み込み関数.       (line   70)
* built-in function; any():              組み込み関数.       (line   90)
* built-in function; ascii():            組み込み関数.       (line  101)
* built-in function; bin():              組み込み関数.       (line  109)
* built-in function; breakpoint():       組み込み関数.       (line  147)
* built-in function; callable():         組み込み関数.       (line  227)
* built-in function; chr():              組み込み関数.       (line  240)
* built-in function; classmethod():      組み込み関数.       (line  249)
* built-in function; compile():          組み込み関数.       (line  289)
* built-in function; delattr():          組み込み関数.       (line  440)
* built-in function; dir():              組み込み関数.       (line  463)
* built-in function; divmod():           組み込み関数.       (line  522)
* built-in function; enumerate():        組み込み関数.       (line  533)
* built-in function; eval():             組み込み関数.       (line  556)
* built-in function; exec():             組み込み関数.       (line  630)
* built-in function; filter():           組み込み関数.       (line  696)
* built-in function; format():           組み込み関数.       (line  778)
* built-in function; getattr():          組み込み関数.       (line  811)
* built-in function; globals():          組み込み関数.       (line  830)
* built-in function; hasattr():          組み込み関数.       (line  836)
* built-in function; hash():             組み込み関数.       (line  843)
* built-in function; help():             組み込み関数.       (line  854)
* built-in function; hex():              組み込み関数.       (line  878)
* built-in function; id():               組み込み関数.       (line  908)
* built-in function; input():            組み込み関数.       (line  920)
* built-in function; isinstance():       組み込み関数.       (line 1018)
* built-in function; issubclass():       組み込み関数.       (line 1035)
* built-in function; iter():             組み込み関数.       (line 1048)
* built-in function; len():              組み込み関数.       (line 1078)
* built-in function; locals():           組み込み関数.       (line 1094)
* built-in function; map():              組み込み関数.       (line 1142)
* built-in function; max():              組み込み関数.       (line 1156)
* built-in function; min():              組み込み関数.       (line 1191)
* built-in function; multiprocessing.Manager(): マネージャー.
                                                             (line   12)
* built-in function; next():             組み込み関数.       (line 1221)
* built-in function; oct():              組み込み関数.       (line 1241)
* built-in function; open():             組み込み関数.       (line 1266)
* built-in function; ord():              組み込み関数.       (line 1513)
* built-in function; pow():              組み込み関数.       (line 1526)
* built-in function; print():            組み込み関数.       (line 1568)
* built-in function; property.deleter(): 組み込み関数.       (line 1644)
* built-in function; property.getter():  組み込み関数.       (line 1640)
* built-in function; property.setter():  組み込み関数.       (line 1642)
* built-in function; repr():             組み込み関数.       (line 1693)
* built-in function; reversed():         組み込み関数.       (line 1715)
* built-in function; round():            組み込み関数.       (line 1723)
* built-in function; setattr():          組み込み関数.       (line 1758)
* built-in function; sorted():           組み込み関数.       (line 1807)
* built-in function; staticmethod():     組み込み関数.       (line 1842)
* built-in function; sum():              組み込み関数.       (line 1901)
* built-in function; vars():             組み込み関数.       (line 2056)
* built-in function; zip():              組み込み関数.       (line 2079)
* builtin_module_names (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  152)
* BuiltinFunctionType (types モジュール): 標準的なインタプリタ型.
                                                             (line   80)
* BuiltinImporter (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line   65)
* BuiltinMethodType (types モジュール):  標準的なインタプリタ型.
                                                             (line   80)
* burst() (imaplib.IMAP4.Idler のメソッド): IMAP4 オブジェクト.
                                                             (line  163)
* busy_retry() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  217)
* BUTTON_ALT (curses モジュール):        定数<6>.            (line  627)
* BUTTON_CTRL (curses モジュール):       定数<6>.            (line  624)
* BUTTON_SHIFT (curses モジュール):      定数<6>.            (line  621)
* buttonbox() (tkinter.simpledialog.Dialog のメソッド): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   30)
* BUTTONn_CLICKED (curses モジュール):   定数<6>.            (line  612)
* BUTTONn_DOUBLE_CLICKED (curses モジュール): 定数<6>.       (line  615)
* BUTTONn_PRESSED (curses モジュール):   定数<6>.            (line  606)
* BUTTONn_RELEASED (curses モジュール):  定数<6>.            (line  609)
* BUTTONn_TRIPLE_CLICKED (curses モジュール): 定数<6>.       (line  618)
* bye() (turtle モジュール):             Screen 独自のメソッド、TurtleScreen から継承したもの以外.
                                                             (line    6)
* byref() (ctypes モジュール):           ユーティリティー関数.
                                                             (line   19)
* byte_offset (ctypes.CField の属性):    構造化データ型.     (line  259)
* byte_size (ctypes.CField の属性):      構造化データ型.     (line  267)
* bytearray:                             変更可能なシーケンス型 mutable sequence.
                                                             (line   27)
* bytearray (組み込みクラス):            bytearray オブジェクト.
                                                             (line    9)
* bytearray;メソッド:                    bytes と bytearray の操作.
                                                             (line    6)
* bytearray;書式化:                      printf 形式での bytes の書式化.
                                                             (line    6)
* bytearray;補間:                        printf 形式での bytes の書式化.
                                                             (line    6)
* bytecode:                              コードオブジェクト. (line    6)
* bytecode <1>:                          用語集<2>.          (line  242)
* Bytecode (dis のクラス):               バイトコード解析.   (line   12)
* BYTECODE_SUFFIXES (importlib.machinery モジュール): importlib machinery -- Importers and path hooks.
                                                             (line   38)
* Bytecode.codeobj (dis モジュール):     バイトコード解析.   (line   54)
* Bytecode.first_line (dis モジュール):  バイトコード解析.   (line   58)
* BytecodeTestCase (test.support.bytecode_helper のクラス): test support bytecode_helper --- Support tools for testing correct bytecode generation.
                                                             (line   13)
* byteorder (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line  146)
* bytes:                                 変更不能なシーケンス immutable sequence.
                                                             (line   45)
* bytes (uuid.UUID の属性):              uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   87)
* bytes (組み込みクラス):                バイトオブジェクト. (line   11)
* bytes_le (uuid.UUID の属性):           uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   92)
* bytes_warning (sys.flags の属性):      sys --- システム固有のパラメーターと関数.
                                                             (line  557)
* bytes-like object:                     用語集<2>.          (line  223)
* bytes;str (組み込みクラス):            テキストシーケンス型 --- str.
                                                             (line   64)
* bytes;メソッド:                        bytes と bytearray の操作.
                                                             (line    6)
* bytes;書式化:                          printf 形式での bytes の書式化.
                                                             (line    6)
* bytes;補間:                            printf 形式での bytes の書式化.
                                                             (line    6)
* BytesFeedParser (email.parser のクラス): FeedParser API.   (line   29)
* BytesGenerator (email.generator のクラス): email generator Generating MIME documents.
                                                             (line   42)
* BytesHeaderParser (email.parser のクラス): Parser API.     (line   67)
* BytesIO (io のクラス):                 バッファ付きストリーム.
                                                             (line    9)
* BytesParser (email.parser のクラス):   Parser API.         (line   17)
* ByteString (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   68)
* ByteString (typing のクラス):          Aliases to container ABCs in collections abc.
                                                             (line   14)
* byteswap() (array.array のメソッド):   array --- 効率的な数値配列.
                                                             (line  147)
* BytesWarning:                          警告.               (line   79)
* BZ2Compressor (bz2 のクラス):          逐次圧縮および展開. (line    6)
* BZ2Decompressor (bz2 のクラス):        逐次圧縮および展開. (line   33)
* BZ2File (bz2 のクラス):                ファイルの圧縮/解凍.
                                                             (line   40)
* C:                                     Formal grammar.     (line   28)
* c_bool (ctypes のクラス):              基本データ型<2>.    (line  227)
* c_byte (ctypes のクラス):              基本データ型<2>.    (line   45)
* c_char (ctypes のクラス):              基本データ型<2>.    (line   51)
* c_char_p (ctypes のクラス):            基本データ型<2>.    (line   57)
* C_CONTIGUOUS (inspect.BufferFlags の属性): Buffer flags.   (line   25)
* c_contiguous (memoryview の属性):      メモリビュー.       (line  503)
* c_double (ctypes のクラス):            基本データ型<2>.    (line   64)
* c_double_complex (ctypes のクラス):    基本データ型<2>.    (line   81)
* c_float (ctypes のクラス):             基本データ型<2>.    (line   76)
* c_float_complex (ctypes のクラス):     基本データ型<2>.    (line   88)
* c_int (ctypes のクラス):               基本データ型<2>.    (line  102)
* c_int16 (ctypes のクラス):             基本データ型<2>.    (line  114)
* c_int32 (ctypes のクラス):             基本データ型<2>.    (line  119)
* c_int64 (ctypes のクラス):             基本データ型<2>.    (line  124)
* c_int8 (ctypes のクラス):              基本データ型<2>.    (line  109)
* c_long (ctypes のクラス):              基本データ型<2>.    (line  129)
* c_longdouble (ctypes のクラス):        基本データ型<2>.    (line   69)
* c_longdouble_complex (ctypes のクラス): 基本データ型<2>.   (line   95)
* c_longlong (ctypes のクラス):          基本データ型<2>.    (line  134)
* C_RAISE (monitoring event):            Events.             (line   25)
* C_RETURN (monitoring event):           Events.             (line   30)
* c_short (ctypes のクラス):             基本データ型<2>.    (line  140)
* c_size_t (ctypes のクラス):            基本データ型<2>.    (line  145)
* c_ssize_t (ctypes のクラス):           基本データ型<2>.    (line  149)
* c_time_t (ctypes のクラス):            基本データ型<2>.    (line  155)
* c_ubyte (ctypes のクラス):             基本データ型<2>.    (line  161)
* c_uint (ctypes のクラス):              基本データ型<2>.    (line  167)
* c_uint16 (ctypes のクラス):            基本データ型<2>.    (line  179)
* c_uint32 (ctypes のクラス):            基本データ型<2>.    (line  184)
* c_uint64 (ctypes のクラス):            基本データ型<2>.    (line  189)
* c_uint8 (ctypes のクラス):             基本データ型<2>.    (line  174)
* c_ulong (ctypes のクラス):             基本データ型<2>.    (line  194)
* c_ulonglong (ctypes のクラス):         基本データ型<2>.    (line  199)
* c_ushort (ctypes のクラス):            基本データ型<2>.    (line  205)
* c_void_p (ctypes のクラス):            基本データ型<2>.    (line  210)
* c_wchar (ctypes のクラス):             基本データ型<2>.    (line  215)
* c_wchar_p (ctypes のクラス):           基本データ型<2>.    (line  221)
* C-contiguous:                          shape strides suboffsets.
                                                             (line   34)
* C-contiguous <1>:                      用語集<2>.          (line  379)
* C;構造体:                              struct --- バイト列をパックされたバイナリデータとして解釈する.
                                                             (line    8)
* C;言語:                                標準型の階層.       (line    6)
* C;言語 <1>:                            numbers Real float 実数.
                                                             (line    6)
* C;言語 <2>:                            組み込み関数 built-in function.
                                                             (line    6)
* C;言語 <3>:                            比較.               (line    6)
* C;言語 <4>:                            数値型 int float complex.
                                                             (line    6)
* C14NWriterTarget (xml.etree.ElementTree のクラス): TreeBuilder オブジェクト.
                                                             (line   92)
* CACHE (opcode):                        Python バイトコード命令.
                                                             (line  190)
* cache_clear() (functools.lru_cache のメソッド): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  204)
* cache_from_source() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line   21)
* cache_info() (functools.lru_cache のメソッド): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  199)
* cache() (functools モジュール):        functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line   16)
* cached (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  419)
* cached_property() (functools モジュール): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line   49)
* CacheFTPHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  487)
* calcobjsize() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  460)
* calcsize() (struct モジュール):        関数と例外.         (line   53)
* calcvobjsize() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  466)
* Calendar (calendar のクラス):          calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line   25)
* calendar コマンドラインオプション; -c: コマンドラインでの使用.
                                                             (line  120)
* calendar コマンドラインオプション; -css: コマンドラインでの使用.
                                                             (line  120)
* calendar コマンドラインオプション; -e: コマンドラインでの使用.
                                                             (line   66)
* calendar コマンドラインオプション; -encoding: コマンドラインでの使用.
                                                             (line   66)
* calendar コマンドラインオプション; -f: コマンドラインでの使用.
                                                             (line   75)
* calendar コマンドラインオプション; -first-weekday: コマンドラインでの使用.
                                                             (line   75)
* calendar コマンドラインオプション; -h: コマンドラインでの使用.
                                                             (line   57)
* calendar コマンドラインオプション; -help: コマンドラインでの使用.
                                                             (line   57)
* calendar コマンドラインオプション; -L: コマンドラインでの使用.
                                                             (line   61)
* calendar コマンドラインオプション; -l: コマンドラインでの使用.
                                                             (line  100)
* calendar コマンドラインオプション; -lines: コマンドラインでの使用.
                                                             (line  100)
* calendar コマンドラインオプション; -locale: コマンドラインでの使用.
                                                             (line   61)
* calendar コマンドラインオプション; -m: コマンドラインでの使用.
                                                             (line  111)
* calendar コマンドラインオプション; -months: コマンドラインでの使用.
                                                             (line  111)
* calendar コマンドラインオプション; -s: コマンドラインでの使用.
                                                             (line  106)
* calendar コマンドラインオプション; -spacing: コマンドラインでの使用.
                                                             (line  106)
* calendar コマンドラインオプション; -t: コマンドラインでの使用.
                                                             (line   71)
* calendar コマンドラインオプション; -type: コマンドラインでの使用.
                                                             (line   71)
* calendar コマンドラインオプション; -w: コマンドラインでの使用.
                                                             (line   94)
* calendar コマンドラインオプション; -width: コマンドラインでの使用.
                                                             (line   94)
* calendar コマンドラインオプション; month: コマンドラインでの使用.
                                                             (line   86)
* calendar コマンドラインオプション; year: コマンドラインでの使用.
                                                             (line   82)
* calendar() (calendar モジュール):      calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  405)
* call:                                  Formal subscription grammar.
                                                             (line   16)
* Call (ast のクラス):                   式 expression<2>.   (line  123)
* CALL (monitoring event):               Events.             (line   21)
* CALL (opcode):                         Python バイトコード命令.
                                                             (line 1076)
* call_annotate_function() (annotationlib モジュール): 関数<12>.
                                                             (line   26)
* call_args (unittest.mock.Mock の属性): Mock クラス.        (line  429)
* call_args_list (unittest.mock.Mock の属性): Mock クラス.   (line  474)
* call_at() (asyncio.loop のメソッド):   遅延コールバックのスケジューリング.
                                                             (line   43)
* call_count (unittest.mock.Mock の属性): Mock クラス.       (line  326)
* call_evaluate_function() (annotationlib モジュール): 関数<12>.
                                                             (line   55)
* call_exception_handler() (asyncio.loop のメソッド): エラーハンドリング API.
                                                             (line   45)
* CALL_FUNCTION_EX (opcode):             Python バイトコード命令.
                                                             (line 1128)
* call_in_thread() (concurrent.interpreters.Interpreter のメソッド): Interpreter objects.
                                                             (line   53)
* CALL_INTRINSIC_1 (opcode):             Python バイトコード命令.
                                                             (line 1338)
* CALL_INTRINSIC_2 (opcode):             Python バイトコード命令.
                                                             (line 1399)
* CALL_KW (opcode):                      Python バイトコード命令.
                                                             (line 1101)
* call_later() (asyncio.loop のメソッド): 遅延コールバックのスケジューリング.
                                                             (line   10)
* call_list() (unittest.mock.call のメソッド): call.         (line   20)
* call_soon_threadsafe() (asyncio.loop のメソッド): コールバックのスケジューリング.
                                                             (line   26)
* call_soon() (asyncio.loop のメソッド): コールバックのスケジューリング.
                                                             (line    6)
* call_tracing() (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line  161)
* call;instance:                         呼び出し可能オブジェクトをエミュレートする.
                                                             (line    8)
* call() (concurrent.interpreters.Interpreter のメソッド): Interpreter objects.
                                                             (line   48)
* call() (operator モジュール):          operator --- 関数形式の標準演算子.
                                                             (line  228)
* call() (subprocess モジュール):        古い高水準 API.     (line   11)
* call() (unittest.mock モジュール):     call.               (line    6)
* callable:                              用語集<2>.          (line  256)
* Callable (collections.abc のクラス):   コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   18)
* Callable (typing モジュール):          Aliases to other ABCs in collections abc.
                                                             (line   22)
* CallableProxyType (weakref モジュール): weakref --- Weak references.
                                                             (line  330)
* callback:                              用語集<2>.          (line  267)
* callback (optparse.Option の属性):     オプション属性.     (line   67)
* callback_args (optparse.Option の属性): オプション属性.    (line   74)
* callback_kwargs (optparse.Option の属性): オプション属性.  (line   74)
* callback() (contextlib.ExitStack のメソッド): ユーティリティ.
                                                             (line  584)
* callbacks (gc モジュール):             gc --- ガベージコレクターインターフェース.
                                                             (line  283)
* called (unittest.mock.Mock の属性):    Mock クラス.        (line  315)
* CalledProcessError:                    Using the subprocess Module.
                                                             (line  205)
* calloc (C function):                   概要<4>.            (line   33)
* CAN (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   96)
* CAN_BCM (socket モジュール):           定数<8>.            (line  153)
* can_change_color() (curses モジュール): 関数<6>.           (line   45)
* can_fetch() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   33)
* CAN_ISOTP (socket モジュール):         定数<8>.            (line  193)
* CAN_J1939 (socket モジュール):         定数<8>.            (line  202)
* CAN_RAW_FD_FRAMES (socket モジュール): 定数<8>.            (line  168)
* CAN_RAW_JOIN_FILTERS (socket モジュール): 定数<8>.         (line  182)
* can_symlink() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   75)
* can_write_eof() (asyncio.StreamWriter のメソッド): StreamWriter.
                                                             (line   51)
* can_write_eof() (asyncio.WriteTransport のメソッド): 書き込み専用のトランスポート.
                                                             (line   14)
* can_xattr() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   80)
* CANCEL (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  155)
* cancel_command() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line   81)
* cancel_dump_traceback_later() (faulthandler モジュール): タイムアウト後にtracebackをダンプする.
                                                             (line   29)
* cancel_join_thread() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  200)
* cancel() (asyncio.Future のメソッド):  Future オブジェクト<2>.
                                                             (line  117)
* cancel() (asyncio.Handle のメソッド):  コールバックのハンドル.
                                                             (line   18)
* cancel() (asyncio.Task のメソッド):    Task オブジェクト.  (line  201)
* cancel() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   16)
* cancel() (sched.scheduler のメソッド): スケジューラオブジェクト.
                                                             (line   40)
* cancel() (threading.Timer のメソッド): Timer objects.      (line   33)
* cancel() (tkinter.dnd.DndHandler のメソッド): tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   47)
* cancelled() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line   71)
* cancelled() (asyncio.Handle のメソッド): コールバックのハンドル.
                                                             (line   23)
* cancelled() (asyncio.Task のメソッド): Task オブジェクト.  (line  265)
* cancelled() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   23)
* CancelledError:                        例外クラス.         (line    6)
* CancelledError <1>:                    例外<16>.           (line   18)
* cancelling() (asyncio.Task のメソッド): Task オブジェクト. (line  323)
* CannotSendHeader:                      http client --- HTTP プロトコルクライアント.
                                                             (line  175)
* CannotSendRequest:                     http client --- HTTP プロトコルクライアント.
                                                             (line  171)
* canonic() (bdb.Bdb のメソッド):        bdb --- デバッガーフレームワーク.
                                                             (line  162)
* canonical() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  274)
* canonical() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  138)
* canonicalize() (xml.etree.ElementTree モジュール): 関数<9>.
                                                             (line    6)
* capa() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   23)
* capitalize() (bytearray のメソッド):   bytes と bytearray の操作.
                                                             (line  470)
* capitalize() (bytes のメソッド):       bytes と bytearray の操作.
                                                             (line  470)
* capitalize() (str のメソッド):         文字列メソッド<2>.  (line   20)
* capitals (decimal.Context の属性):     Context オブジェクト.
                                                             (line  149)
* CapsuleType (types のクラス):          標準的なインタプリタ型.
                                                             (line  296)
* capture_call_graph() (asyncio モジュール): Call Graph Introspection.
                                                             (line   77)
* captured_stderr() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  354)
* captured_stdin() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  354)
* captured_stdout() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  354)
* captureWarnings() (logging モジュール): warnings モジュールとの統合.
                                                             (line    9)
* capwords() (string モジュール):        ヘルパー関数.       (line    6)
* case block:                            論駁不可能なケースブロック.
                                                             (line    6)
* casefold() (str のメソッド):           文字列メソッド<2>.  (line   30)
* cast() (ctypes モジュール):            ユーティリティー関数.
                                                             (line   51)
* cast() (memoryview のメソッド):        メモリビュー.       (line  282)
* cast() (typing モジュール):            Functions and decorators.
                                                             (line    6)
* catch_threading_exception() (test.support.threading_helper モジュール): test support threading_helper --- Utilities for threading tests.
                                                             (line   47)
* catch_unraisable_exception() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  635)
* catch_warnings (warnings のクラス):    利用可能なコンテキストマネージャー.
                                                             (line    6)
* category() (unicodedata モジュール):   unicodedata --- Unicode データベース.
                                                             (line   80)
* cbreak() (curses モジュール):          関数<6>.            (line   50)
* cbrt() (math モジュール):              Power exponential and logarithmic functions.
                                                             (line    6)
* CC:                                    新たなモジュール、改良されたモジュール、非推奨のモジュール<4>.
                                                             (line   56)
* ccc() (ftplib.FTP_TLS のメソッド):     FTP_TLS オブジェクト.
                                                             (line   99)
* cdf() (statistics.NormalDist のメソッド): NormalDist オブジェクト.
                                                             (line   86)
* CDLL (ctypes のクラス):                共有ライブラリをロードする.
                                                             (line    9)
* ceil() (math モジュール):              数値型 int float complex.
                                                             (line  115)
* ceil() (math モジュール) <1>:          Floating point arithmetic.
                                                             (line    6)
* CellType (types モジュール):           標準的なインタプリタ型.
                                                             (line   69)
* center() (bytearray のメソッド):       bytes と bytearray の操作.
                                                             (line  291)
* center() (bytes のメソッド):           bytes と bytearray の操作.
                                                             (line  291)
* center() (str のメソッド):             文字列メソッド<2>.  (line   52)
* CERT_NONE (ssl モジュール):            定数<9>.            (line   11)
* CERT_OPTIONAL (ssl モジュール):        定数<9>.            (line   25)
* CERT_REQUIRED (ssl モジュール):        定数<9>.            (line   41)
* cert_store_stats() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line   89)
* cert_time_to_seconds() (ssl モジュール): 証明書の取り扱い. (line    6)
* CertificateError:                      例外<19>.           (line   92)
* certificates:                          SSL コンテキスト.   (line  761)
* CField (ctypes のクラス):              構造化データ型.     (line  217)
* CFLAGS:                                新たなモジュール、改良されたモジュール、非推奨のモジュール<4>.
                                                             (line   57)
* CFLAGS <1>:                            パフォーマンスに関するオプション.
                                                             (line   28)
* CFLAGS <2>:                            Compiler flags.     (line   26)
* CFLAGS <3>:                            Compiler flags.     (line   28)
* CFLAGS <4>:                            Compiler flags.     (line   32)
* CFLAGS <5>:                            Compiler flags.     (line   54)
* CFLAGS <6>:                            Linker flags.       (line   18)
* CFLAGS_NODIST:                         Compiler flags.     (line   24)
* CFLAGS_NODIST <1>:                     Compiler flags.     (line   61)
* CFLAGS_NODIST <2>:                     Linker flags.       (line   26)
* cfmakecbreak() (tty モジュール):       tty --- 端末制御用の関数群.
                                                             (line   28)
* cfmakeraw() (tty モジュール):          tty --- 端末制御用の関数群.
                                                             (line   20)
* CFUNCTYPE() (ctypes モジュール):       関数プロトタイプ.   (line   14)
* cget() (tkinter.font.Font のメソッド): tkinter font --- Tkinter フォントラッパー.
                                                             (line   51)
* cgi_directories (http.server.CGIHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  512)
* CGIHandler (wsgiref.handlers のクラス): wsgiref handlers -- server/gateway base classes.
                                                             (line   11)
* CGIHTTPRequestHandler (http.server のクラス): http server --- HTTP サーバー.
                                                             (line  487)
* CGIXMLRPCRequestHandler (xmlrpc.server のクラス): xmlrpc server --- 基本的な XML-RPC サーバー.
                                                             (line   49)
* chain_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line   73)
* chain() (itertools モジュール):        Itertool関数.       (line  105)
* ChainMap (collections のクラス):       ChainMap オブジェクト.
                                                             (line   15)
* ChainMap (typing のクラス):            Aliases to types in collections.
                                                             (line   28)
* change_cwd() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   84)
* CHANNEL_BINDING_TYPES (ssl モジュール): 定数<9>.           (line  479)
* CHAR_MAX (locale モジュール):          locale --- 国際化サービス.
                                                             (line  578)
* CharacterDataHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  318)
* characters_written (BlockingIOError の属性): OS 例外.      (line   19)
* characters() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line  121)
* charmap_build() (codecs モジュール):   codecs --- codec レジストリと基底クラス.
                                                             (line   45)
* Charset (email.charset のクラス):      email charset 文字集合の表現.
                                                             (line   23)
* charset() (gettext.NullTranslations のメソッド): NullTranslations クラス.
                                                             (line   73)
* chdir() (contextlib モジュール):       ユーティリティ.     (line  371)
* chdir() (os モジュール):               ファイルとディレクトリ.
                                                             (line  118)
* check (lzma.LZMADecompressor の属性):  メモリ上での圧縮と展開<2>.
                                                             (line  147)
* check__all__() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  715)
* check_call() (subprocess モジュール):  古い高水準 API.     (line   45)
* check_disallow_instantiation() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  769)
* CHECK_EG_MATCH (opcode):               Python バイトコード命令.
                                                             (line  469)
* CHECK_EXC_MATCH (opcode):              Python バイトコード命令.
                                                             (line  461)
* check_free_after_iterating() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  703)
* check_hostname (ssl.SSLContext の属性): SSL コンテキスト.  (line  493)
* check_impl_detail() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  318)
* check_no_resource_warning() (test.support.warnings_helper モジュール): test support warnings_helper --- Utilities for warnings tests.
                                                             (line   25)
* check_output() (doctest.OutputChecker のメソッド): OutputChecker オブジェクト.
                                                             (line   17)
* check_output() (subprocess モジュール): 古い高水準 API.    (line   83)
* check_returncode() (subprocess.CompletedProcess のメソッド): Using the subprocess Module.
                                                             (line  135)
* check_syntax_error() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  609)
* check_syntax_warning() (test.support.warnings_helper モジュール): test support warnings_helper --- Utilities for warnings tests.
                                                             (line   32)
* check_unused_args() (string.Formatter のメソッド): カスタムの文字列書式化.
                                                             (line   93)
* check_warnings() (test.support.warnings_helper モジュール): test support warnings_helper --- Utilities for warnings tests.
                                                             (line   48)
* check() (imaplib.IMAP4 のメソッド):    IMAP4 オブジェクト. (line   57)
* check() (tabnanny モジュール):         tabnanny --- あいまいなインデントの検出.
                                                             (line   17)
* checkcache() (linecache モジュール):   linecache --- テキストラインへのランダムアクセス.
                                                             (line   49)
* CHECKED_HASH (py_compile.PycInvalidationMode の属性): py_compile --- Python ソースファイルをコンパイルする.
                                                             (line  110)
* checkfuncname() (bdb モジュール):      bdb --- デバッガーフレームワーク.
                                                             (line  506)
* checksizeof() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  472)
* checksum_flag (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  205)
* chflags() (os モジュール):             ファイルとディレクトリ.
                                                             (line  139)
* chgat() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  133)
* childNodes (xml.dom.Node の属性):      Node オブジェクト.  (line   48)
* ChildProcessError:                     OS 例外.            (line   25)
* children (pyclbr.Class の属性):        クラスオブジェクト<2>.
                                                             (line   35)
* children (pyclbr.Function の属性):     Function オブジェクト.
                                                             (line   34)
* children (tkinter.Tk の属性):          Tkinter モジュール. (line   87)
* chksum (tarfile.TarInfo の属性):       TarInfo オブジェクト.
                                                             (line  139)
* chmod() (os モジュール):               ファイルとディレクトリ.
                                                             (line  182)
* chmod() (pathlib.Path のメソッド):     パーミッションと所有者.
                                                             (line   40)
* choice() (random モジュール):          シーケンス用の関数. (line    6)
* choice() (secrets モジュール):         乱数.               (line   15)
* choices (optparse.Option の属性):      オプション属性.     (line   62)
* choices() (random モジュール):         シーケンス用の関数. (line   11)
* Chooser (tkinter.colorchooser のクラス): tkinter colorchooser --- カラー選択ダイアログ.
                                                             (line   15)
* chown() (os モジュール):               ファイルとディレクトリ.
                                                             (line  252)
* chown() (shutil モジュール):           ディレクトリとファイルの操作.
                                                             (line  419)
* chroot() (os モジュール):              ファイルとディレクトリ.
                                                             (line  281)
* CHRTYPE (tarfile モジュール):          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  342)
* cipher() (ssl.SSLSocket のメソッド):   SSL ソケット.       (line  230)
* circle() (turtle モジュール):          Turtle の動き.      (line  209)
* CIRCUMFLEX (token モジュール):         token --- Python 解析木で使われる定数.
                                                             (line  278)
* CIRCUMFLEXEQUAL (token モジュール):    token --- Python 解析木で使われる定数.
                                                             (line  311)
* clamp (decimal.Context の属性):        Context オブジェクト.
                                                             (line  155)
* Clamped (decimal のクラス):            シグナル.           (line   19)
* Class (pyclbr のクラス):               クラスオブジェクト<2>.
                                                             (line    6)
* Class (symtable のクラス):             記号表の検査.       (line  151)
* CLASS (symtable.SymbolTableType の属性): 記号表の検査.     (line   19)
* class variable:                        用語集<2>.          (line  278)
* ClassDef (ast のクラス):               関数およびクラス定義.
                                                             (line  168)
* ClassMethodDescriptorType (types モジュール): 標準的なインタプリタ型.
                                                             (line  115)
* ClassVar (typing モジュール):          特殊形式.           (line  201)
* clause:                                複合文 compound statement.
                                                             (line   17)
* CLD_CONTINUED (os モジュール):         プロセス管理.       (line 1054)
* CLD_DUMPED (os モジュール):            プロセス管理.       (line 1054)
* CLD_EXITED (os モジュール):            プロセス管理.       (line 1054)
* CLD_KILLED (os モジュール):            プロセス管理.       (line 1054)
* CLD_STOPPED (os モジュール):           プロセス管理.       (line 1054)
* CLD_TRAPPED (os モジュール):           プロセス管理.       (line 1054)
* clean() (mailbox.Maildir のメソッド):  Maildir オブジェクト.
                                                             (line   84)
* cleandoc() (inspect モジュール):       ソースコードの情報取得.
                                                             (line   72)
* CleanImport (test.support.import_helper のクラス): test support import_helper --- Utilities for import tests.
                                                             (line   87)
* cleanup functions:                     プロセス制御.       (line   33)
* CLEANUP_THROW (opcode):                Python バイトコード命令.
                                                             (line  359)
* cleanup() (tempfile.TemporaryDirectory のメソッド): tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  201)
* clear (pdb command):                   Debugger commands.  (line  133)
* Clear Breakpoint [ブレークポイントのクリア]: Help メニュー Shell ウィンドウ、Editor ウィンドウ.
                                                             (line   32)
* clear_all_breaks() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  399)
* clear_all_file_breaks() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  394)
* clear_bpbynumber() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  388)
* clear_break() (bdb.Bdb のメソッド):    bdb --- デバッガーフレームワーク.
                                                             (line  382)
* clear_cache() (filecmp モジュール):    filecmp --- ファイルとディレクトリの比較.
                                                             (line   56)
* clear_cache() (zoneinfo.ZoneInfo のクラスメソッド): ZoneInfo クラス.
                                                             (line   61)
* clear_content() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  673)
* clear_flags() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  186)
* clear_frames() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line  174)
* clear_history() (readline モジュール): 履歴リスト.         (line    8)
* clear_memo() (pickle.Pickler のメソッド): モジュールインターフェース.
                                                             (line  237)
* clear_overloads() (typing モジュール): Functions and decorators.
                                                             (line  301)
* clear_session_cookies() (http.cookiejar.CookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line   94)
* clear_tool_id() (sys.monitoring モジュール): Registering and using tools.
                                                             (line   13)
* clear_traces() (tracemalloc モジュール): 関数<11>.         (line    6)
* clear_traps() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  190)
* clear() (array.array のメソッド):      array --- 効率的な数値配列.
                                                             (line  227)
* clear() (asyncio.Event のメソッド):    Event.              (line   59)
* clear() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   43)
* clear() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  149)
* clear() (dict のメソッド):             マッピング型 --- dict.
                                                             (line  160)
* clear() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  669)
* clear() (frame のメソッド):            Frame object methods.
                                                             (line    8)
* clear() (http.cookiejar.CookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line   81)
* clear() (mailbox.Mailbox のメソッド):  Mailbox オブジェクト.
                                                             (line  208)
* clear() (sequence のメソッド):         ミュータブルなシーケンス型.
                                                             (line   74)
* clear() (set のメソッド):              set（集合）型 --- set frozenset.
                                                             (line  216)
* clear() (threading.Event のメソッド):  Event objects.      (line   38)
* clear() (turtle モジュール):           さらなる描画の制御. (line   23)
* clear() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   56)
* clearcache() (linecache モジュール):   linecache --- テキストラインへのランダムアクセス.
                                                             (line   43)
* clearok() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  154)
* clearscreen() (turtle モジュール):     ウィンドウの制御.   (line   72)
* clearstamp() (turtle モジュール):      Turtle の動き.      (line  286)
* clearstamps() (turtle モジュール):     Turtle の動き.      (line  305)
* client_address (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  119)
* client_address (socketserver.BaseRequestHandler の属性): Request Handler Objects.
                                                             (line   46)
* Client() (multiprocessing.connection モジュール): リスナーとクライアント.
                                                             (line   34)
* CLOCK_BOOTTIME (time モジュール):      Clock ID Constants. (line    9)
* clock_getres() (time モジュール):      関数<5>.            (line   40)
* clock_gettime_ns() (time モジュール):  関数<5>.            (line   63)
* clock_gettime() (time モジュール):     関数<5>.            (line   50)
* CLOCK_HIGHRES (time モジュール):       Clock ID Constants. (line   23)
* CLOCK_MONOTONIC (time モジュール):     Clock ID Constants. (line   33)
* CLOCK_MONOTONIC_RAW (time モジュール): Clock ID Constants. (line   42)
* CLOCK_MONOTONIC_RAW_APPROX (time モジュール): Clock ID Constants.
                                                             (line   51)
* CLOCK_PROCESS_CPUTIME_ID (time モジュール): Clock ID Constants.
                                                             (line   60)
* CLOCK_PROF (time モジュール):          Clock ID Constants. (line   68)
* CLOCK_REALTIME (time モジュール):      Clock ID Constants. (line  128)
* clock_seq (uuid.UUID の属性):          uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  136)
* clock_seq_hi_variant (uuid.UUID の属性): uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  117)
* clock_seq_low (uuid.UUID の属性):      uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  121)
* clock_settime_ns() (time モジュール):  関数<5>.            (line   84)
* clock_settime() (time モジュール):     関数<5>.            (line   72)
* CLOCK_TAI (time モジュール):           Clock ID Constants. (line   76)
* CLOCK_THREAD_CPUTIME_ID (time モジュール): Clock ID Constants.
                                                             (line   88)
* CLOCK_UPTIME (time モジュール):        Clock ID Constants. (line   96)
* CLOCK_UPTIME_RAW (time モジュール):    Clock ID Constants. (line  106)
* CLOCK_UPTIME_RAW_APPROX (time モジュール): Clock ID Constants.
                                                             (line  116)
* CLONE_FILES (os モジュール):           プロセスのパラメーター.
                                                             (line  651)
* CLONE_FS (os モジュール):              プロセスのパラメーター.
                                                             (line  651)
* CLONE_NEWCGROUP (os モジュール):       プロセスのパラメーター.
                                                             (line  651)
* CLONE_NEWIPC (os モジュール):          プロセスのパラメーター.
                                                             (line  651)
* CLONE_NEWNET (os モジュール):          プロセスのパラメーター.
                                                             (line  651)
* CLONE_NEWNS (os モジュール):           プロセスのパラメーター.
                                                             (line  651)
* CLONE_NEWPID (os モジュール):          プロセスのパラメーター.
                                                             (line  651)
* CLONE_NEWTIME (os モジュール):         プロセスのパラメーター.
                                                             (line  651)
* CLONE_NEWUSER (os モジュール):         プロセスのパラメーター.
                                                             (line  651)
* CLONE_NEWUTS (os モジュール):          プロセスのパラメーター.
                                                             (line  651)
* CLONE_SIGHAND (os モジュール):         プロセスのパラメーター.
                                                             (line  651)
* CLONE_SYSVSEM (os モジュール):         プロセスのパラメーター.
                                                             (line  651)
* CLONE_THREAD (os モジュール):          プロセスのパラメーター.
                                                             (line  651)
* CLONE_VM (os モジュール):              プロセスのパラメーター.
                                                             (line  651)
* clone() (email.generator.BytesGenerator のメソッド): email generator Generating MIME documents.
                                                             (line  111)
* clone() (email.generator.Generator のメソッド): email generator Generating MIME documents.
                                                             (line  207)
* clone() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  221)
* clone() (turtle モジュール):           特別な Turtle のメソッド.
                                                             (line   43)
* cloneNode() (xml.dom.Node のメソッド): Node オブジェクト.  (line  147)
* close (in module os):                  サブインタプリタサポート.
                                                             (line  196)
* close_clients() (asyncio.Server のメソッド): Serverオブジェクト.
                                                             (line   44)
* close_connection (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  128)
* close() (asyncio.BaseTransport のメソッド): 基底トランスポート.
                                                             (line    6)
* close() (asyncio.loop のメソッド):     ループの開始と停止. (line   47)
* close() (asyncio.Runner のメソッド):   Runner context manager.
                                                             (line   57)
* close() (asyncio.Server のメソッド):   Serverオブジェクト. (line   32)
* close() (asyncio.StreamWriter のメソッド): StreamWriter.   (line   41)
* close() (asyncio.SubprocessTransport のメソッド): サブプロセス化されたトランスポート.
                                                             (line   59)
* close() (concurrent.interpreters.Interpreter のメソッド): Interpreter objects.
                                                             (line   31)
* close() (contextlib.ExitStack のメソッド): ユーティリティ. (line  614)
* close() (coroutine のメソッド):        コルーチンオブジェクト.
                                                             (line   48)
* close() (dbm.dumb.dumbdbm のメソッド): dbm dumb --- Portable DBM implementation.
                                                             (line   80)
* close() (dbm.gnu.gdbm のメソッド):     dbm gnu --- GNU database manager.
                                                             (line   95)
* close() (dbm.ndbm.ndbm のメソッド):    dbm ndbm --- New Database Manager.
                                                             (line   82)
* close() (dbm.sqlite3.sqlite3 のメソッド): dbm sqlite3 --- SQLite backend for dbm.
                                                             (line   54)
* close() (email.parser.BytesFeedParser のメソッド): FeedParser API.
                                                             (line   66)
* close() (fileinput モジュール):        fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  128)
* close() (ftplib.FTP のメソッド):       FTP オブジェクト.   (line  366)
* close() (generator のメソッド):        ジェネレータ-イテレータメソッド.
                                                             (line   63)
* close() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   15)
* close() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  160)
* close() (imaplib.IMAP4 のメソッド):    IMAP4 オブジェクト. (line   61)
* close() (io.IOBase のメソッド):        I/O 基底クラス.     (line   47)
* close() (logging.FileHandler のメソッド): FileHandler.     (line   27)
* close() (logging.Handler のメソッド):  ハンドラオブジェクト.
                                                             (line   76)
* close() (logging.handlers.MemoryHandler のメソッド): MemoryHandler.
                                                             (line   58)
* close() (logging.handlers.NTEventLogHandler のメソッド): NTEventLogHandler.
                                                             (line   27)
* close() (logging.handlers.SocketHandler のメソッド): SocketHandler.
                                                             (line   20)
* close() (logging.handlers.SysLogHandler のメソッド): SysLogHandler.
                                                             (line   53)
* close() (mailbox.Mailbox のメソッド):  Mailbox オブジェクト.
                                                             (line  264)
* close() (mailbox.Maildir のメソッド):  Maildir オブジェクト.
                                                             (line  212)
* close() (mailbox.MH のメソッド):       MH オブジェクト.    (line  108)
* close() (mmap.mmap のメソッド):        mmap --- メモリマップファイルのサポート.
                                                             (line  184)
* close() (multiprocessing.connection.Connection のメソッド): Connection オブジェクト<2>.
                                                             (line   35)
* close() (multiprocessing.connection.Listener のメソッド): リスナーとクライアント.
                                                             (line   91)
* close() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line  177)
* close() (multiprocessing.Process のメソッド): Process クラスと例外.
                                                             (line  249)
* close() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  176)
* close() (multiprocessing.shared_memory.SharedMemory のメソッド): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line   92)
* close() (multiprocessing.SimpleQueue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  230)
* close() (os モジュール):               ファイル記述子の操作.
                                                             (line   22)
* close() (os.scandir のメソッド):       ファイルとディレクトリ.
                                                             (line  895)
* close() (select.devpoll のメソッド):   /dev/poll ポーリングオブジェクト.
                                                             (line   12)
* close() (select.epoll のメソッド):     エッジおよびレベルトリガポーリング epoll オブジェクト.
                                                             (line   72)
* close() (select.kqueue のメソッド):    kqueue オブジェクト.
                                                             (line    6)
* close() (selectors.BaseSelector のメソッド): クラス<4>.    (line  141)
* close() (shelve.Shelf のメソッド):     shelve --- Python オブジェクトの永続化.
                                                             (line   76)
* close() (socket モジュール):           その他の関数<2>.    (line    8)
* close() (socket.socket のメソッド):    socket オブジェクト.
                                                             (line   41)
* close() (sqlite3.Blob のメソッド):     Blob オブジェクト.  (line   38)
* close() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line   90)
* close() (sqlite3.Cursor のメソッド):   Cursor オブジェクト.
                                                             (line  157)
* close() (tarfile.TarFile のメソッド):  TarFile オブジェクト.
                                                             (line  329)
* close() (urllib.request.BaseHandler のメソッド): BaseHandler オブジェクト.
                                                             (line   14)
* close() (wave.Wave_read のメソッド):   Wave_read オブジェクト.
                                                             (line   13)
* close() (wave.Wave_write のメソッド):  Wave_write オブジェクト.
                                                             (line   30)
* Close() (winreg.PyHKEY のメソッド):    レジストリハンドルオブジェクト.
                                                             (line   31)
* close() (xml.etree.ElementTree.TreeBuilder のメソッド): TreeBuilder オブジェクト.
                                                             (line   27)
* close() (xml.etree.ElementTree.XMLParser のメソッド): XMLParser オブジェクト.
                                                             (line   21)
* close() (xml.etree.ElementTree.XMLPullParser のメソッド): XMLPullParser オブジェクト.
                                                             (line   41)
* close() (xml.sax.xmlreader.IncrementalParser のメソッド): IncrementalParser オブジェクト.
                                                             (line   13)
* close() (zipfile.ZipFile のメソッド):  ZipFile objects.    (line  115)
* CloseBoundaryNotFoundDefect:           email errors Exception and Defect classes.
                                                             (line   85)
* closed (http.client.HTTPResponse の属性): HTTPResponse オブジェクト.
                                                             (line   76)
* closed (io.IOBase の属性):             I/O 基底クラス.     (line   57)
* closed (mmap.mmap の属性):             mmap --- メモリマップファイルのサポート.
                                                             (line  191)
* closed (select.devpoll の属性):        /dev/poll ポーリングオブジェクト.
                                                             (line   18)
* closed (select.epoll の属性):          エッジおよびレベルトリガポーリング epoll オブジェクト.
                                                             (line   76)
* closed (select.kqueue の属性):         kqueue オブジェクト.
                                                             (line   10)
* CloseKey() (winreg モジュール):        関数<14>.           (line    8)
* closelog() (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line   79)
* closerange() (os モジュール):          ファイル記述子の操作.
                                                             (line   33)
* closing() (contextlib モジュール):     ユーティリティ.     (line  155)
* closure variable:                      用語集<2>.          (line  283)
* clrtobot() (curses.window のメソッド): Window オブジェクト.
                                                             (line  159)
* clrtoeol() (curses.window のメソッド): Window オブジェクト.
                                                             (line  164)
* Cmd (cmd のクラス):                    cmd --- 行指向のコマンドインタープリターのサポート.
                                                             (line   15)
* cmd (subprocess.CalledProcessError の属性): Using the subprocess Module.
                                                             (line  217)
* cmd (subprocess.TimeoutExpired の属性): Using the subprocess Module.
                                                             (line  172)
* cmdloop() (cmd.Cmd のメソッド):        Cmdオブジェクト.    (line    8)
* cmdqueue (cmd.Cmd の属性):             Cmdオブジェクト.    (line  140)
* cmp_op (dis モジュール):               命令コードコレクション.
                                                             (line   22)
* cmp_to_key() (functools モジュール):   functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  120)
* cmp() (filecmp モジュール):            filecmp --- ファイルとディレクトリの比較.
                                                             (line   16)
* cmpfiles() (filecmp モジュール):       filecmp --- ファイルとディレクトリの比較.
                                                             (line   36)
* CMSG_LEN() (socket モジュール):        その他の関数<2>.    (line  332)
* CMSG_SPACE() (socket モジュール):      その他の関数<2>.    (line  350)
* co_argcount (codeobject の属性):       Special read-only attributes<2>.
                                                             (line   14)
* co_argcount (コードオブジェクトの属性): コードオブジェクト.
                                                             (line   16)
* CO_ASYNC_GENERATOR (C macro):          Code Object Flags.  (line   48)
* CO_ASYNC_GENERATOR (inspect モジュール): Code Objects Bit Flags.
                                                             (line   52)
* co_cellvars (codeobject の属性):       Special read-only attributes<2>.
                                                             (line   39)
* co_cellvars (コードオブジェクトの属性): コードオブジェクト.
                                                             (line   16)
* co_code (codeobject の属性):           Special read-only attributes<2>.
                                                             (line   54)
* co_code (コードオブジェクトの属性):    コードオブジェクト. (line   16)
* co_consts (codeobject の属性):         Special read-only attributes<2>.
                                                             (line   58)
* co_consts (コードオブジェクトの属性):  コードオブジェクト. (line   16)
* CO_COROUTINE (C macro):                Code Object Flags.  (line   42)
* CO_COROUTINE (inspect モジュール):     Code Objects Bit Flags.
                                                             (line   35)
* co_filename (codeobject の属性):       Special read-only attributes<2>.
                                                             (line   66)
* co_filename (コードオブジェクトの属性): コードオブジェクト.
                                                             (line   16)
* co_firstlineno (codeobject の属性):    Special read-only attributes<2>.
                                                             (line   70)
* co_firstlineno (コードオブジェクトの属性): コードオブジェクト.
                                                             (line   16)
* co_flags (codeobject の属性):          Special read-only attributes<2>.
                                                             (line   85)
* co_flags (コードオブジェクトの属性):   コードオブジェクト. (line   16)
* co_freevars (codeobject の属性):       Special read-only attributes<2>.
                                                             (line   45)
* co_freevars (コードオブジェクトの属性): コードオブジェクト.
                                                             (line   16)
* CO_FUTURE_ABSOLUTE_IMPORT (C macro):   Code Object Flags.  (line   60)
* CO_FUTURE_ANNOTATIONS (C macro):       Code Object Flags.  (line   75)
* CO_FUTURE_DIVISION (C macro):          Code Object Flags.  (line   57)
* CO_FUTURE_GENERATOR_STOP (C macro):    Code Object Flags.  (line   72)
* CO_FUTURE_PRINT_FUNCTION (C macro):    Code Object Flags.  (line   66)
* CO_FUTURE_UNICODE_LITERALS (C macro):  Code Object Flags.  (line   69)
* CO_FUTURE_WITH_STATEMENT (C macro):    Code Object Flags.  (line   63)
* CO_GENERATOR (C macro):                Code Object Flags.  (line   39)
* CO_GENERATOR (inspect モジュール):     Code Objects Bit Flags.
                                                             (line   30)
* CO_HAS_DOCSTRING (C macro):            Code Object Flags.  (line   51)
* CO_HAS_DOCSTRING (inspect モジュール): Code Objects Bit Flags.
                                                             (line   60)
* CO_ITERABLE_COROUTINE (C macro):       Code Object Flags.  (line   45)
* CO_ITERABLE_COROUTINE (inspect モジュール): Code Objects Bit Flags.
                                                             (line   43)
* co_kwonlyargcount (code object attribute): コードオブジェクト.
                                                             (line   16)
* co_kwonlyargcount (codeobject の属性): Special read-only attributes<2>.
                                                             (line   25)
* co_lines() (codeobject のメソッド):    Methods on code objects.
                                                             (line   43)
* co_lnotab (codeobject の属性):         Special read-only attributes<2>.
                                                             (line   73)
* co_lnotab (コードオブジェクトの属性):  コードオブジェクト. (line   16)
* CO_METHOD (C macro):                   Code Object Flags.  (line   54)
* CO_METHOD (inspect モジュール):        Code Objects Bit Flags.
                                                             (line   68)
* co_name (codeobject の属性):           Special read-only attributes<2>.
                                                             (line    6)
* co_name (コードオブジェクトの属性):    コードオブジェクト. (line   16)
* co_names (codeobject の属性):          Special read-only attributes<2>.
                                                             (line   62)
* co_names (コードオブジェクトの属性):   コードオブジェクト. (line   16)
* CO_NESTED (C macro):                   Code Object Flags.  (line   36)
* CO_NESTED (inspect モジュール):        Code Objects Bit Flags.
                                                             (line   26)
* CO_NEWLOCALS (C macro):                Code Object Flags.  (line   27)
* CO_NEWLOCALS (inspect モジュール):     Code Objects Bit Flags.
                                                             (line   13)
* co_nlocals (codeobject の属性):        Special read-only attributes<2>.
                                                             (line   30)
* co_nlocals (コードオブジェクトの属性): コードオブジェクト. (line   16)
* CO_OPTIMIZED (C macro):                Code Object Flags.  (line   24)
* CO_OPTIMIZED (inspect モジュール):     Code Objects Bit Flags.
                                                             (line    9)
* co_positions() (codeobject のメソッド): Methods on code objects.
                                                             (line    6)
* co_posonlyargcount (code object attribute): コードオブジェクト.
                                                             (line   16)
* co_posonlyargcount (codeobject の属性): Special read-only attributes<2>.
                                                             (line   20)
* co_qualname (code object attribute):   コードオブジェクト. (line   16)
* co_qualname (codeobject の属性):       Special read-only attributes<2>.
                                                             (line    9)
* co_stacksize (codeobject の属性):      Special read-only attributes<2>.
                                                             (line   82)
* co_stacksize (コードオブジェクトの属性): コードオブジェクト.
                                                             (line   16)
* CO_VARARGS (C macro):                  Code Object Flags.  (line   30)
* CO_VARARGS (inspect モジュール):       Code Objects Bit Flags.
                                                             (line   18)
* CO_VARKEYWORDS (C macro):              Code Object Flags.  (line   33)
* CO_VARKEYWORDS (inspect モジュール):   Code Objects Bit Flags.
                                                             (line   22)
* co_varnames (codeobject の属性):       Special read-only attributes<2>.
                                                             (line   34)
* co_varnames (コードオブジェクトの属性): コードオブジェクト.
                                                             (line   16)
* code (SystemExit の属性):              具象例外.           (line  397)
* code (urllib.error.HTTPError の属性):  urllib error --- urllib request によって送出される例外クラス.
                                                             (line   43)
* code (urllib.response.addinfourl の属性): urllib response --- Response classes used by urllib.
                                                             (line   40)
* code (xml.etree.ElementTree.ParseError の属性): 例外<22>.  (line   12)
* code (xml.parsers.expat.ExpatError の属性): ExpatError 例外.
                                                             (line    8)
* code_context (inspect.FrameInfo の属性): インタープリタスタック.
                                                             (line   31)
* code_context (inspect.Traceback の属性): インタープリタスタック.
                                                             (line   71)
* code_info() (dis モジュール):          解析関数.           (line   11)
* Codec (codecs のクラス):               ステートレスなエンコードとデコード.
                                                             (line   10)
* CodecInfo (codecs のクラス):           codecs --- codec レジストリと基底クラス.
                                                             (line   68)
* CodecRegistryError:                    encodings --- Encodings package.
                                                             (line   53)
* Codecs:                                codecs --- codec レジストリと基底クラス.
                                                             (line    8)
* Codecs;decode:                         codecs --- codec レジストリと基底クラス.
                                                             (line    8)
* Codecs;encode:                         codecs --- codec レジストリと基底クラス.
                                                             (line    8)
* codecs.escape_decode() (codecs モジュール): Standalone Codec Functions.
                                                             (line   22)
* codecs.escape_encode() (codecs モジュール): Standalone Codec Functions.
                                                             (line   12)
* coded_value (http.cookies.Morsel の属性): Morselオブジェクト.
                                                             (line   67)
* codepoint2name (html.entities モジュール): html entities --- HTML 一般実体の定義.
                                                             (line   33)
* codes (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   16)
* CODESET (locale モジュール):           locale --- 国際化サービス.
                                                             (line  187)
* CodeType (types のクラス):             標準的なインタプリタ型.
                                                             (line   55)
* coding;style:                          間奏曲 コーディングスタイル.
                                                             (line    6)
* col_offset (ast.AST の属性):           Node クラス.        (line   49)
* collapse_addresses() (ipaddress モジュール): その他のモジュールレベル関数.
                                                             (line   43)
* collapse_rfc2231_value() (email.utils モジュール): email utils Miscellaneous utilities.
                                                             (line  200)
* collect() (gc モジュール):             gc --- ガベージコレクターインターフェース.
                                                             (line   33)
* collectedDurations (unittest.TestResult の属性): テストのロードと起動.
                                                             (line  274)
* Collection (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   37)
* Collection (typing のクラス):          Aliases to container ABCs in collections abc.
                                                             (line   37)
* colno (json.JSONDecodeError の属性):   例外<20>.           (line   26)
* colno (re.PatternError の属性):        例外<3>.            (line   32)
* colno (tomllib.TOMLDecodeError の属性): tomllib --- TOML ファイルの解析.
                                                             (line   81)
* colno (traceback.FrameSummary の属性): FrameSummary オブジェクト.
                                                             (line   57)
* colon (mailbox.Maildir の属性):        Maildir オブジェクト.
                                                             (line   43)
* COLON (token モジュール):              token --- Python 解析木で使われる定数.
                                                             (line  215)
* COLONEQUAL (token モジュール):         token --- Python 解析木で使われる定数.
                                                             (line  341)
* COLOR_BLACK (curses モジュール):       定数<6>.            (line  639)
* COLOR_BLUE (curses モジュール):        定数<6>.            (line  642)
* color_content() (curses モジュール):   関数<6>.            (line   60)
* COLOR_CYAN (curses モジュール):        定数<6>.            (line  645)
* COLOR_GREEN (curses モジュール):       定数<6>.            (line  648)
* COLOR_MAGENTA (curses モジュール):     定数<6>.            (line  651)
* color_pair() (curses モジュール):      関数<6>.            (line   68)
* COLOR_PAIRS (curses モジュール):       定数<6>.            (line   39)
* COLOR_RED (curses モジュール):         定数<6>.            (line  654)
* COLOR_WHITE (curses モジュール):       定数<6>.            (line  657)
* COLOR_YELLOW (curses モジュール):      定数<6>.            (line  660)
* color() (turtle モジュール):           色の制御<2>.        (line  111)
* colormode() (turtle モジュール):       設定と特殊なメソッド.
                                                             (line   33)
* COLORS (curses モジュール):            定数<6>.            (line   34)
* COLS (curses モジュール):              定数<6>.            (line   44)
* column() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line   35)
* columnize() (cmd.Cmd のメソッド):      Cmdオブジェクト.    (line   87)
* COLUMNS:                               関数<6>.            (line  597)
* COLUMNS <1>:                           関数<6>.            (line  598)
* columns (os.terminal_size の属性):     ターミナルのサイズの問い合わせ.
                                                             (line   29)
* comb() (math モジュール):              Number-theoretic functions.
                                                             (line    6)
* combinations_with_replacement() (itertools モジュール): Itertool関数.
                                                             (line  169)
* combinations() (itertools モジュール): Itertool関数.       (line  128)
* combine() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line  183)
* combining() (unicodedata モジュール):  unicodedata --- Unicode データベース.
                                                             (line  101)
* Combobox (tkinter.ttk のクラス):       ttk Combobox.       (line    6)
* COMError:                              例外<10>.           (line   11)
* COMMA (token モジュール):              token --- Python 解析木で使われる定数.
                                                             (line  218)
* command (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  141)
* CommandCompiler (codeop のクラス):     codeop --- Python コードをコンパイルする.
                                                             (line   65)
* commands (pdb command):                Debugger commands.  (line  167)
* comment (http.cookiejar.Cookie の属性): Cookieオブジェクト<2>.
                                                             (line   63)
* comment (http.cookies.Morsel の属性):  Morselオブジェクト. (line   13)
* COMMENT (token モジュール):            token --- Python 解析木で使われる定数.
                                                             (line   67)
* comment (zipfile.ZipFile の属性):      ZipFile objects.    (line  375)
* comment (zipfile.ZipInfo の属性):      ZipInfo objects.    (line  104)
* comment_url (http.cookiejar.Cookie の属性): Cookieオブジェクト<2>.
                                                             (line   68)
* Comment() (xml.etree.ElementTree モジュール): 関数<9>.     (line   72)
* comment() (xml.etree.ElementTree.TreeBuilder のメソッド): TreeBuilder オブジェクト.
                                                             (line   47)
* comment() (xml.sax.handler.LexicalHandler のメソッド): LexicalHandler Objects.
                                                             (line   18)
* commenters (shlex.shlex の属性):       shlex オブジェクト. (line   84)
* CommentHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  377)
* commit() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line   73)
* common (filecmp.dircmp の属性):        dircmp クラス.      (line   62)
* Common Vulnerabilities and Exposures; CVE 2008-5983: ビルドならびに C API の変更<8>.
                                                             (line   77)
* Common Vulnerabilities and Exposures; CVE 2008-5983 <1>: ビルドならびに C API の変更<9>.
                                                             (line   48)
* Common Vulnerabilities and Exposures; CVE 2008-5983 <2>: プロセスワイドのパラメータ.
                                                             (line  260)
* Common Vulnerabilities and Exposures; CVE 2012-0876: セキュリティ<49>.
                                                             (line   23)
* Common Vulnerabilities and Exposures; CVE 2012-0876 <1>: セキュリティ<52>.
                                                             (line   14)
* Common Vulnerabilities and Exposures; CVE 2012-0876 <2>: セキュリティ<58>.
                                                             (line   14)
* Common Vulnerabilities and Exposures; CVE 2013-0340: セキュリティ<29>.
                                                             (line   22)
* Common Vulnerabilities and Exposures; CVE 2013-1753: ライブラリ<207>.
                                                             (line  193)
* Common Vulnerabilities and Exposures; CVE 2014-0224: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張.
                                                             (line   30)
* Common Vulnerabilities and Exposures; CVE 2014-4616: ライブラリ<207>.
                                                             (line 1122)
* Common Vulnerabilities and Exposures; CVE 2015-1283: セキュリティ<55>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2015-1283 <1>: セキュリティ<60>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2016-0718: セキュリティ<49>.
                                                             (line   22)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <1>: セキュリティ<49>.
                                                             (line   23)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <2>: セキュリティ<49>.
                                                             (line   35)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <3>: セキュリティ<52>.
                                                             (line   13)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <4>: セキュリティ<52>.
                                                             (line   14)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <5>: セキュリティ<53>.
                                                             (line    7)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <6>: セキュリティ<58>.
                                                             (line   13)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <7>: セキュリティ<58>.
                                                             (line   14)
* Common Vulnerabilities and Exposures; CVE 2016-0718 <8>: セキュリティ<58>.
                                                             (line   26)
* Common Vulnerabilities and Exposures; CVE 2016-0772: セキュリティ<55>.
                                                             (line    8)
* Common Vulnerabilities and Exposures; CVE 2016-0772 <1>: セキュリティ<60>.
                                                             (line    8)
* Common Vulnerabilities and Exposures; CVE 2016-1000110: ライブラリ<186>.
                                                             (line   82)
* Common Vulnerabilities and Exposures; CVE 2016-1000110 <1>: ライブラリ<193>.
                                                             (line  267)
* Common Vulnerabilities and Exposures; CVE 2016-2183: ライブラリ<185>.
                                                             (line  178)
* Common Vulnerabilities and Exposures; CVE 2016-2183 <1>: ライブラリ<193>.
                                                             (line  205)
* Common Vulnerabilities and Exposures; CVE 2016-3189: Windows<31>.
                                                             (line   25)
* Common Vulnerabilities and Exposures; CVE 2016-4472: セキュリティ<49>.
                                                             (line   35)
* Common Vulnerabilities and Exposures; CVE 2016-4472 <1>: セキュリティ<53>.
                                                             (line    7)
* Common Vulnerabilities and Exposures; CVE 2016-4472 <2>: セキュリティ<58>.
                                                             (line   26)
* Common Vulnerabilities and Exposures; CVE 2016-5300: セキュリティ<49>.
                                                             (line   24)
* Common Vulnerabilities and Exposures; CVE 2016-5300 <1>: セキュリティ<52>.
                                                             (line   15)
* Common Vulnerabilities and Exposures; CVE 2016-5300 <2>: セキュリティ<58>.
                                                             (line   15)
* Common Vulnerabilities and Exposures; CVE 2016-9063: セキュリティ<49>.
                                                             (line   21)
* Common Vulnerabilities and Exposures; CVE 2016-9063 <1>: セキュリティ<52>.
                                                             (line   12)
* Common Vulnerabilities and Exposures; CVE 2016-9063 <2>: セキュリティ<58>.
                                                             (line   12)
* Common Vulnerabilities and Exposures; CVE 2017-1000158: セキュリティ<57>.
                                                             (line   21)
* Common Vulnerabilities and Exposures; CVE 2017-9233: セキュリティ<49>.
                                                             (line   20)
* Common Vulnerabilities and Exposures; CVE 2017-9233 <1>: セキュリティ<52>.
                                                             (line   11)
* Common Vulnerabilities and Exposures; CVE 2017-9233 <2>: セキュリティ<58>.
                                                             (line   11)
* Common Vulnerabilities and Exposures; CVE 2018-1060: セキュリティ<46>.
                                                             (line   48)
* Common Vulnerabilities and Exposures; CVE 2018-1060 <1>: セキュリティ<47>.
                                                             (line   15)
* Common Vulnerabilities and Exposures; CVE 2018-1060 <2>: セキュリティ<50>.
                                                             (line   11)
* Common Vulnerabilities and Exposures; CVE 2018-1061: セキュリティ<46>.
                                                             (line   49)
* Common Vulnerabilities and Exposures; CVE 2018-1061 <1>: セキュリティ<47>.
                                                             (line   16)
* Common Vulnerabilities and Exposures; CVE 2018-1061 <2>: セキュリティ<50>.
                                                             (line   12)
* Common Vulnerabilities and Exposures; CVE 2018-14647: セキュリティ<46>.
                                                             (line   26)
* Common Vulnerabilities and Exposures; CVE 2018-25032: Windows<31>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2018-8970: セキュリティ<46>.
                                                             (line   38)
* Common Vulnerabilities and Exposures; CVE 2018-8970 <1>: セキュリティ<47>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2019-12900: Windows<31>.
                                                             (line   26)
* Common Vulnerabilities and Exposures; CVE 2019-15903: セキュリティ<42>.
                                                             (line   20)
* Common Vulnerabilities and Exposures; CVE 2019-18348: セキュリティ<39>.
                                                             (line    7)
* Common Vulnerabilities and Exposures; CVE 2019-20907: ライブラリ<150>.
                                                             (line  186)
* Common Vulnerabilities and Exposures; CVE 2019-5010: セキュリティ<46>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2019-9740: セキュリティ<44>.
                                                             (line    9)
* Common Vulnerabilities and Exposures; CVE 2019-9948: セキュリティ<43>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2020-10735: その他の CPython の実装の変更.
                                                             (line   56)
* Common Vulnerabilities and Exposures; CVE 2020-10735 <1>: Notable security feature in 3 10 7.
                                                             (line   10)
* Common Vulnerabilities and Exposures; CVE 2020-10735 <2>: Notable security feature in 3 9 14.
                                                             (line   10)
* Common Vulnerabilities and Exposures; CVE 2020-10735 <3>: Notable security feature in 3 8 14.
                                                             (line   10)
* Common Vulnerabilities and Exposures; CVE 2020-10735 <4>: Notable security feature in 3 7 14.
                                                             (line   10)
* Common Vulnerabilities and Exposures; CVE 2020-10735 <5>: 整数と文字列の変換での長さ制限.
                                                             (line   19)
* Common Vulnerabilities and Exposures; CVE 2020-15523: セキュリティ<36>.
                                                             (line   13)
* Common Vulnerabilities and Exposures; CVE 2020-15801: セキュリティ<36>.
                                                             (line    7)
* Common Vulnerabilities and Exposures; CVE 2020-8492: セキュリティ<38>.
                                                             (line   11)
* Common Vulnerabilities and Exposures; CVE 2021-3426: セキュリティ<31>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2022-26488: Windows<31>.
                                                             (line   28)
* Common Vulnerabilities and Exposures; CVE 2022-37434: Windows<28>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2022-42919: セキュリティ<27>.
                                                             (line   24)
* Common Vulnerabilities and Exposures; CVE 2022-4303: セキュリティ<23>.
                                                             (line   10)
* Common Vulnerabilities and Exposures; CVE 2022-4303 <1>: セキュリティ<23>.
                                                             (line   11)
* Common Vulnerabilities and Exposures; CVE 2023-0286: セキュリティ<23>.
                                                             (line   10)
* Common Vulnerabilities and Exposures; CVE 2023-24329: セキュリティ<22>.
                                                             (line   19)
* Common Vulnerabilities and Exposures; CVE 2023-27043: email<2>.
                                                             (line   22)
* Common Vulnerabilities and Exposures; CVE 2023-27043 <1>: ライブラリ<62>.
                                                             (line  429)
* Common Vulnerabilities and Exposures; CVE 2023-40217: セキュリティ<21>.
                                                             (line   10)
* Common Vulnerabilities and Exposures; CVE 2023-52425: xml. (line    6)
* Common Vulnerabilities and Exposures; CVE 2023-52425 <1>: セキュリティ<18>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2023-52425 <2>: ドキュメント<17>.
                                                             (line    6)
* Common Vulnerabilities and Exposures; CVE 2023-52425 <3>: XML security.
                                                             (line   55)
* Common Vulnerabilities and Exposures; CVE 2024-12718: tarfile.
                                                             (line   12)
* Common Vulnerabilities and Exposures; CVE 2024-12718 <1>: tarfile.
                                                             (line   20)
* Common Vulnerabilities and Exposures; CVE 2024-12718 <2>: セキュリティ<8>.
                                                             (line   15)
* Common Vulnerabilities and Exposures; CVE 2024-4030: os<2>.
                                                             (line   38)
* Common Vulnerabilities and Exposures; CVE 2024-4030 <1>: tempfile.
                                                             (line    8)
* Common Vulnerabilities and Exposures; CVE 2024-4030 <2>: セキュリティ<16>.
                                                             (line   54)
* Common Vulnerabilities and Exposures; CVE 2025-4138: tarfile.
                                                             (line    8)
* Common Vulnerabilities and Exposures; CVE 2025-4138 <1>: セキュリティ<8>.
                                                             (line   15)
* Common Vulnerabilities and Exposures; CVE 2025-4330: tarfile.
                                                             (line   19)
* Common Vulnerabilities and Exposures; CVE 2025-4330 <1>: セキュリティ<8>.
                                                             (line   15)
* Common Vulnerabilities and Exposures; CVE 2025-4435: tarfile.
                                                             (line   24)
* Common Vulnerabilities and Exposures; CVE 2025-4517: os path.
                                                             (line   10)
* Common Vulnerabilities and Exposures; CVE 2025-4517 <1>: セキュリティ<8>.
                                                             (line   16)
* Common Weakness Enumeration; CWE 257:  レシピとベストプラクティス.
                                                             (line   16)
* Common Weakness Enumeration; CWE 295:  ssl<3>.             (line   21)
* Common Weakness Enumeration; CWE 295 <1>: ライブラリ<87>.  (line  514)
* common_dirs (filecmp.dircmp の属性):   dircmp クラス.      (line   75)
* common_files (filecmp.dircmp の属性):  dircmp クラス.      (line   79)
* common_funny (filecmp.dircmp の属性):  dircmp クラス.      (line   83)
* common_types (mimetypes モジュール):   mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  161)
* commonpath() (os.path モジュール):     os path --- 一般的なパス名操作.
                                                             (line   74)
* commonprefix() (os.path モジュール):   os path --- 一般的なパス名操作.
                                                             (line   90)
* communicate() (asyncio.subprocess.Process のメソッド): サブプロセスとやりとりする.
                                                             (line   50)
* communicate() (subprocess.Popen のメソッド): Popen オブジェクト.
                                                             (line   37)
* Compare (ast のクラス):                式 expression<2>.   (line   94)
* compare_digest() (hmac モジュール):    hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line  115)
* compare_digest() (secrets モジュール): その他の関数.       (line    6)
* compare_networks() (ipaddress.IPv4Network のメソッド): Network オブジェクト.
                                                             (line  239)
* compare_networks() (ipaddress.IPv6Network のメソッド): Network オブジェクト.
                                                             (line  354)
* COMPARE_OP (opcode):                   Python バイトコード命令.
                                                             (line  822)
* compare_signal() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  282)
* compare_signal() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  155)
* compare_to() (tracemalloc.Snapshot のメソッド): Snapshot.  (line   13)
* compare_total_mag() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  290)
* compare_total_mag() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  184)
* compare_total() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  286)
* compare_total() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  162)
* compare() (ast モジュール):            Compiler flags<2>.  (line   35)
* compare() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  278)
* compare() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  144)
* compare() (difflib.Differ のメソッド): Differ オブジェクト.
                                                             (line   36)
* COMPARISON_FLAGS (doctest モジュール): オプションフラグ.   (line  100)
* Compat32 (email.policy のクラス):      email policy Policy Objects.
                                                             (line  561)
* compat32 (email.policy モジュール):    email policy Policy Objects.
                                                             (line  615)
* Compile (codeop のクラス):             codeop --- Python コードをコンパイルする.
                                                             (line   56)
* compile_command() (code モジュール):   code --- インタープリター基底クラス.
                                                             (line   61)
* compile_command() (codeop モジュール): codeop --- Python コードをコンパイルする.
                                                             (line   30)
* compile_dir() (compileall モジュール): パブリックな関数.   (line    6)
* compile_file() (compileall モジュール): パブリックな関数.  (line   96)
* compile_path() (compileall モジュール): パブリックな関数.  (line  160)
* compile() (py_compile モジュール):     py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   23)
* compile() (re モジュール):             関数<2>.            (line    6)
* compileall コマンドラインオプション; -b: コマンドラインでの使用<9>.
                                                             (line   64)
* compileall コマンドラインオプション; -d: コマンドラインでの使用<9>.
                                                             (line   31)
* compileall コマンドラインオプション; -e: コマンドラインでの使用<9>.
                                                             (line  104)
* compileall コマンドラインオプション; -f: コマンドラインでの使用<9>.
                                                             (line   21)
* compileall コマンドラインオプション; -hardlink-dupes: コマンドラインでの使用<9>.
                                                             (line  108)
* compileall コマンドラインオプション; -i: コマンドラインでの使用<9>.
                                                             (line   58)
* compileall コマンドラインオプション; -invalidation-mode: コマンドラインでの使用<9>.
                                                             (line   84)
* compileall コマンドラインオプション; -j: コマンドラインでの使用<9>.
                                                             (line   78)
* compileall コマンドラインオプション; -l: コマンドラインでの使用<9>.
                                                             (line   16)
* compileall コマンドラインオプション; -o: コマンドラインでの使用<9>.
                                                             (line   98)
* compileall コマンドラインオプション; -p: コマンドラインでの使用<9>.
                                                             (line   46)
* compileall コマンドラインオプション; -q: コマンドラインでの使用<9>.
                                                             (line   25)
* compileall コマンドラインオプション; -r: コマンドラインでの使用<9>.
                                                             (line   71)
* compileall コマンドラインオプション; -s: コマンドラインでの使用<9>.
                                                             (line   39)
* compileall コマンドラインオプション; -x: コマンドラインでの使用<9>.
                                                             (line   53)
* compileall コマンドラインオプション; directory: コマンドラインでの使用<9>.
                                                             (line    9)
* compileall コマンドラインオプション; file: コマンドラインでの使用<9>.
                                                             (line    9)
* compiler_flag (__future__._Feature の属性): モジュールコンテンツ<5>.
                                                             (line   90)
* complete_statement() (sqlite3 モジュール): モジュール関数. (line  103)
* complete() (rlcompleter.Completer のメソッド): rlcompleter --- GNU readline の補完機能.
                                                             (line   43)
* completedefault() (cmd.Cmd のメソッド): Cmdオブジェクト.   (line   81)
* CompletedProcess (subprocess のクラス): Using the subprocess Module.
                                                             (line  100)
* Completer (rlcompleter のクラス):      rlcompleter --- GNU readline の補完機能.
                                                             (line   39)
* Complex (numbers のクラス):            数値塔.             (line    6)
* complex (組み込みクラス):              組み込み関数.       (line  364)
* complex number:                        用語集<2>.          (line  311)
* complex number;リテラル:               数値型 int float complex.
                                                             (line   17)
* compound;statement:                    複合文 compound statement.
                                                             (line    6)
* comprehension (ast のクラス):          内包表記 Comprehension.
                                                             (line   58)
* compress_size (zipfile.ZipInfo の属性): ZipInfo objects.   (line  155)
* compress_type (zipfile.ZipInfo の属性): ZipInfo objects.   (line  100)
* compress() (bz2 モジュール):           一括圧縮/解凍.      (line    6)
* compress() (bz2.BZ2Compressor のメソッド): 逐次圧縮および展開.
                                                             (line   15)
* compress() (compression.zstd モジュール): メモリ上での圧縮と展開.
                                                             (line    6)
* compress() (compression.zstd.ZstdCompressor のメソッド): メモリ上での圧縮と展開.
                                                             (line   77)
* compress() (gzip モジュール):          gzip --- gzip ファイルのサポート.
                                                             (line  197)
* compress() (itertools モジュール):     Itertool関数.       (line  210)
* compress() (lzma モジュール):          メモリ上での圧縮と展開<2>.
                                                             (line  171)
* compress() (lzma.LZMACompressor のメソッド): メモリ上での圧縮と展開<2>.
                                                             (line   75)
* compress() (zlib モジュール):          zlib --- gzip 互換の圧縮.
                                                             (line   45)
* compress() (zlib.Compress のメソッド): zlib --- gzip 互換の圧縮.
                                                             (line  201)
* compressed (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line   60)
* compressed (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line  107)
* compressed (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  251)
* compressed (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  321)
* compression_level (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line   39)
* COMPRESSION_LEVEL_DEFAULT (compression.zstd モジュール): その他<3>.
                                                             (line   28)
* compression() (ssl.SSLSocket のメソッド): SSL ソケット.    (line  247)
* CompressionError:                      tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  260)
* CompressionParameter (compression.zstd のクラス): Advanced parameter control.
                                                             (line    6)
* compressobj() (zlib モジュール):       zlib --- gzip 互換の圧縮.
                                                             (line   82)
* COMSPEC:                               プロセス管理.       (line  783)
* COMSPEC <1>:                           Popen コンストラクター.
                                                             (line  111)
* concat() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line  184)
* Concatenate (typing モジュール):       特殊形式.           (line   82)
* concurrency:                           用語集<2>.          (line  321)
* concurrent modification:               用語集<2>.          (line  333)
* cond (bdb.Breakpoint の属性):          bdb --- デバッガーフレームワーク.
                                                             (line   97)
* Condition (asyncio のクラス):          Condition.          (line    6)
* Condition (multiprocessing のクラス):  同期プリミティブ.   (line   45)
* condition (pdb command):               Debugger commands.  (line  160)
* Condition (threading のクラス):        Condition objects.  (line   71)
* Condition() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  175)
* config() (tkinter.font.Font のメソッド): tkinter font --- Tkinter フォントラッパー.
                                                             (line   55)
* ConfigParser (configparser のクラス):  ConfigParser オブジェクト.
                                                             (line    6)
* configuration information:             sysconfig --- Python の構成情報へのアクセスを提供する.
                                                             (line   10)
* configure_mock() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  263)
* configure() (tkinter.ttk.Style のメソッド): Ttk スタイル.  (line   25)
* CONFORM (enum.FlagBoundary の属性):    データ型<2>.        (line  692)
* confstr_names (os モジュール):         雑多なシステム情報. (line   26)
* confstr() (os モジュール):             雑多なシステム情報. (line    6)
* conjugate() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  196)
* conjugate() (numbers.Complex のメソッド): 数値塔.          (line   23)
* conjugate() (複素数のメソッド):        数値型 int float complex.
                                                             (line  102)
* connect_accepted_socket() (asyncio.loop のメソッド): ネットワークサーバの生成.
                                                             (line  149)
* connect_ex() (socket.socket のメソッド): socket オブジェクト.
                                                             (line   86)
* connect_read_pipe() (asyncio.loop のメソッド): パイプとやりとりする.
                                                             (line    6)
* connect_write_pipe() (asyncio.loop のメソッド): パイプとやりとりする.
                                                             (line   23)
* connect() (ftplib.FTP のメソッド):     FTP オブジェクト.   (line   89)
* connect() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  151)
* connect() (multiprocessing.managers.BaseManager のメソッド): マネージャー.
                                                             (line   79)
* connect() (smtplib.SMTP のメソッド):   SMTP オブジェクト.  (line   34)
* connect() (socket.socket のメソッド):  socket オブジェクト.
                                                             (line   62)
* connect() (sqlite3 モジュール):        モジュール関数.     (line    6)
* Connection (multiprocessing.connection のクラス): Connection オブジェクト<2>.
                                                             (line   13)
* Connection (sqlite3 のクラス):         Connection オブジェクト.
                                                             (line    6)
* connection (sqlite3.Cursor の属性):    Cursor オブジェクト.
                                                             (line  183)
* connection_lost() (asyncio.BaseProtocol のメソッド): 基底プロトコル<2>.
                                                             (line   23)
* connection_made() (asyncio.BaseProtocol のメソッド): 基底プロトコル<2>.
                                                             (line   16)
* ConnectionAbortedError:                OS 例外.            (line   45)
* ConnectionError:                       OS 例外.            (line   30)
* ConnectionRefusedError:                OS 例外.            (line   51)
* ConnectionResetError:                  OS 例外.            (line   57)
* ConnectRegistry() (winreg モジュール): 関数<14>.           (line   17)
* const (optparse.Option の属性):        オプション属性.     (line   58)
* Constant (ast のクラス):               リテラル<3>.        (line    6)
* constructor() (copyreg モジュール):    copyreg --- pickle サポート関数を登録する.
                                                             (line   17)
* consumed (asyncio.LimitOverrunError の属性): 例外<16>.     (line   68)
* Container (collections.abc のクラス):  コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line    6)
* Container (typing のクラス):           Aliases to container ABCs in collections abc.
                                                             (line   47)
* CONTAINS_OP (opcode):                  Python バイトコード命令.
                                                             (line  837)
* contains() (operator モジュール):      operator --- 関数形式の標準演算子.
                                                             (line  189)
* content (urllib.error.ContentTooShortError の属性): urllib error --- urllib request によって送出される例外クラス.
                                                             (line   72)
* content_disposition (email.headerregistry.ContentDispositionHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  279)
* content_manager (email.policy.EmailPolicy の属性): email policy Policy Objects.
                                                             (line  417)
* content_size_flag (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  179)
* content_type (email.headerregistry.ContentTypeHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  266)
* ContentDispositionHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  274)
* ContentHandler (xml.sax.handler のクラス): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   18)
* ContentManager (email.contentmanager のクラス): email contentmanager Managing MIME Content.
                                                             (line   12)
* contents (ctypes._Pointer の属性):     配列とポインタ.     (line   58)
* contents() (importlib.resources モジュール): 関数 API.     (line  150)
* contents() (importlib.resources.abc.ResourceReader のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line   71)
* ContentTooShortError:                  urllib error --- urllib request によって送出される例外クラス.
                                                             (line   66)
* ContentTransferEncodingHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  284)
* ContentTypeHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  261)
* context:                               用語集<2>.          (line  340)
* Context (contextvars のクラス):        マニュアルでのコンテキスト管理.
                                                             (line   20)
* Context (decimal のクラス):            Context オブジェクト.
                                                             (line  118)
* context (ssl.SSLSocket の属性):        SSL ソケット.       (line  338)
* context manager:                       with文とコンテキストマネージャ.
                                                             (line   13)
* context manager <1>:                   コンテキストマネージャ型.
                                                             (line    6)
* context manager <2>:                   用語集<2>.          (line  361)
* context variable:                      用語集<2>.          (line  367)
* context_aware_warnings (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  590)
* context_diff() (difflib モジュール):   difflib --- 差分の計算の補助.
                                                             (line  150)
* ContextDecorator (contextlib のクラス): ユーティリティ.    (line  390)
* ContextManager (typing のクラス):      Aliases to contextlib ABCs.
                                                             (line    6)
* contextmanager() (contextlib モジュール): ユーティリティ.  (line   31)
* ContextVar (contextvars のクラス):     コンテキスト変数.   (line    6)
* CONTIG (inspect.BufferFlags の属性):   Buffer flags.       (line   33)
* CONTIG_RO (inspect.BufferFlags の属性): Buffer flags.      (line   35)
* contiguous:                            shape strides suboffsets.
                                                             (line   34)
* contiguous <1>:                        用語集<2>.          (line  375)
* contiguous (memoryview の属性):        メモリビュー.       (line  517)
* Continue (ast のクラス):               制御フロー.         (line   99)
* CONTINUE (compression.zstd.ZstdCompressor の属性): メモリ上での圧縮と展開.
                                                             (line  129)
* continue (pdb command):                Debugger commands.  (line  232)
* CONTINUOUS (enum.EnumCheck の属性):    データ型<2>.        (line  631)
* control() (select.kqueue のメソッド):  kqueue オブジェクト.
                                                             (line   22)
* controlnames (curses.ascii モジュール): curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  236)
* CONTTYPE (tarfile モジュール):         tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  358)
* conversion (string.templatelib.Interpolation の属性): 型.  (line  239)
* convert_arg_line_to_args() (argparse.ArgumentParser のメソッド): ファイル解析のカスタマイズ.
                                                             (line    6)
* convert_field() (string.Formatter のメソッド): カスタムの文字列書式化.
                                                             (line  109)
* CONVERT_VALUE (opcode):                Python バイトコード命令.
                                                             (line 1214)
* convert() (string.templatelib モジュール): ヘルパー関数<2>.
                                                             (line    6)
* Cookie (http.cookiejar のクラス):      http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line  113)
* CookieError:                           http cookies --- HTTP の状態管理.
                                                             (line   33)
* CookieJar (http.cookiejar のクラス):   http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line   45)
* cookiejar (urllib.request.HTTPCookieProcessor の属性): HTTPCookieProcessor オブジェクト.
                                                             (line    8)
* CookiePolicy (http.cookiejar のクラス): http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line   77)
* COPY (opcode):                         Python バイトコード命令.
                                                             (line  172)
* Copy [コピー]:                         Help メニュー Shell ウィンドウ、Editor ウィンドウ.
                                                             (line   32)
* copy_abs() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  294)
* copy_abs() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  201)
* copy_context() (contextvars モジュール): マニュアルでのコンテキスト管理.
                                                             (line    6)
* copy_decimal() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  200)
* copy_file_range() (os モジュール):     ファイル記述子の操作.
                                                             (line   44)
* COPY_FREE_VARS (opcode):               Python バイトコード命令.
                                                             (line 1055)
* copy_into() (pathlib.Path のメソッド): Copying moving and deleting.
                                                             (line   31)
* copy_location() (ast モジュール):      ast helpers.        (line  162)
* copy_negate() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  298)
* copy_negate() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  206)
* copy_sign() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  302)
* copy_sign() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  211)
* copy;プロトコル:                       クラスインスタンスの pickle 化.
                                                             (line  110)
* copy() (collections.deque のメソッド): deque オブジェクト. (line   47)
* copy() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line  103)
* copy() (copy モジュール):              copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   19)
* copy() (decimal.Context のメソッド):   Context オブジェクト.
                                                             (line  196)
* copy() (dict のメソッド):              マッピング型 --- dict.
                                                             (line  164)
* copy() (frozenset のメソッド):         set（集合）型 --- set frozenset.
                                                             (line  128)
* copy() (hashlib.hash のメソッド):      Hash Objects.       (line   49)
* copy() (hmac.HMAC のメソッド):         hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   86)
* copy() (http.cookies.Morsel のメソッド): Morselオブジェクト.
                                                             (line  110)
* copy() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line   67)
* copy() (multiprocessing.sharedctypes モジュール): The multiprocessing sharedctypes module.
                                                             (line   91)
* copy() (pathlib.Path のメソッド):      Copying moving and deleting.
                                                             (line    6)
* copy() (sequence のメソッド):          ミュータブルなシーケンス型.
                                                             (line   81)
* copy() (set のメソッド):               set（集合）型 --- set frozenset.
                                                             (line  128)
* copy() (shutil モジュール):            ディレクトリとファイルの操作.
                                                             (line  136)
* copy() (tkinter.font.Font のメソッド): tkinter font --- Tkinter フォントラッパー.
                                                             (line   59)
* copy() (types.MappingProxyType のメソッド): 標準的なインタプリタ型.
                                                             (line  258)
* copy() (zlib.Compress のメソッド):     zlib --- gzip 互換の圧縮.
                                                             (line  223)
* copy() (zlib.Decompress のメソッド):   zlib --- gzip 互換の圧縮.
                                                             (line  288)
* copy2() (shutil モジュール):           ディレクトリとファイルの操作.
                                                             (line  169)
* CopyComPointer() (ctypes モジュール):  ユーティリティー関数.
                                                             (line   34)
* copyfile() (shutil モジュール):        ディレクトリとファイルの操作.
                                                             (line   24)
* copyfileobj() (shutil モジュール):     ディレクトリとファイルの操作.
                                                             (line    6)
* copymode() (shutil モジュール):        ディレクトリとファイルの操作.
                                                             (line   74)
* copyright (in module sys):             プロセスワイドのパラメータ.
                                                             (line  195)
* copyright (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line  173)
* copyright (組み込み変数):              site モジュールで追加される定数.
                                                             (line   26)
* copysign() (math モジュール):          Floating point manipulation functions.
                                                             (line    6)
* copystat() (shutil モジュール):        ディレクトリとファイルの操作.
                                                             (line   92)
* copytree() (shutil モジュール):        ディレクトリとファイルの操作.
                                                             (line  210)
* Coroutine (collections.abc のクラス):  コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  152)
* Coroutine (typing のクラス):           Aliases to asynchronous ABCs in collections abc.
                                                             (line    6)
* coroutine function:                    用語集<2>.          (line  393)
* coroutine() (types モジュール):        コルーチンユーティリティ関数.
                                                             (line    6)
* CoroutineType (types モジュール):      標準的なインタプリタ型.
                                                             (line   41)
* correlation() (statistics モジュール): 関数の詳細.         (line  562)
* cos() (cmath モジュール):              三角関数<2>.        (line   23)
* cos() (math モジュール):               三角関数.           (line   29)
* cosh() (cmath モジュール):             双曲線関数<2>.      (line   23)
* cosh() (math モジュール):              双曲線関数.         (line   21)
* count (tracemalloc.Statistic の属性):  Statistic.          (line   15)
* count (tracemalloc.StatisticDiff の属性): StatisticDiff.   (line   15)
* count_diff (tracemalloc.StatisticDiff の属性): StatisticDiff.
                                                             (line   21)
* count() (array.array のメソッド):      array --- 効率的な数値配列.
                                                             (line  156)
* count() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line   36)
* count() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line   36)
* count() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   53)
* count() (itertools モジュール):        Itertool関数.       (line  223)
* count() (memoryview のメソッド):       メモリビュー.       (line  381)
* count() (multiprocessing.shared_memory.ShareableList のメソッド): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  331)
* count() (sequence のメソッド):         共通のシーケンス演算.
                                                             (line  167)
* count() (str のメソッド):              文字列メソッド<2>.  (line   66)
* Counter (collections のクラス):        Counter オブジェクト.
                                                             (line   23)
* Counter (typing のクラス):             Aliases to types in collections.
                                                             (line   39)
* countOf() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  195)
* countTestCases() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  800)
* countTestCases() (unittest.TestSuite のメソッド): テストのグループ化.
                                                             (line   54)
* covariance() (statistics モジュール):  関数の詳細.         (line  540)
* CoverageResults (trace のクラス):      プログラミングインターフェース.
                                                             (line   46)
* CPPFLAGS:                              新たなモジュール、改良されたモジュール、非推奨のモジュール<4>.
                                                             (line   57)
* CPPFLAGS <1>:                          Preprocessor flags. (line    8)
* CPPFLAGS <2>:                          Preprocessor flags. (line   18)
* CPPFLAGS <3>:                          Linker flags.       (line   50)
* cProfile コマンドラインオプション; -m: かんたんユーザマニュアル.
                                                             (line   96)
* cProfile コマンドラインオプション; -o: かんたんユーザマニュアル.
                                                             (line   86)
* cProfile コマンドラインオプション; -s: かんたんユーザマニュアル.
                                                             (line   90)
* CPU 時間:                              関数<5>.            (line  247)
* CPU 時間 <1>:                          関数<5>.            (line  612)
* cpu_count() (multiprocessing モジュール): その他<5>.       (line   14)
* cpu_count() (os モジュール):           雑多なシステム情報. (line   34)
* CPython:                               用語集<2>.          (line  400)
* cpython_only() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  553)
* CR (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   63)
* crawl_delay() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   50)
* CRC:                                   zlib --- gzip 互換の圧縮.
                                                             (line  122)
* CRC (zipfile.ZipInfo の属性):          ZipInfo objects.    (line  151)
* crc_hqx() (binascii モジュール):       binascii --- バイナリ と ASCII 間の変換.
                                                             (line   93)
* crc32() (binascii モジュール):         binascii --- バイナリ と ASCII 間の変換.
                                                             (line  100)
* crc32() (zlib モジュール):             zlib --- gzip 互換の圧縮.
                                                             (line  120)
* create_aggregate() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  163)
* create_archive() (zipapp モジュール):  Python API.         (line    8)
* create_autospec() (unittest.mock モジュール): create_autospec.
                                                             (line    6)
* CREATE_BREAKAWAY_FROM_JOB (subprocess モジュール): Windows Constants.
                                                             (line  140)
* create_collation() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  305)
* create_configuration() (venv.EnvBuilder のメソッド): API<2>.
                                                             (line  142)
* create_connection() (asyncio.loop のメソッド): ネットワーク接続の確立.
                                                             (line    6)
* create_connection() (socket モジュール): ソケットの作成.   (line   82)
* create_datagram_endpoint() (asyncio.loop のメソッド): ネットワーク接続の確立.
                                                             (line  158)
* create_decimal_from_float() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  229)
* create_decimal() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  204)
* create_default_context() (ssl モジュール): コンテキストの作成.
                                                             (line    9)
* CREATE_DEFAULT_ERROR_MODE (subprocess モジュール): Windows Constants.
                                                             (line  130)
* create_eager_task_factory() (asyncio モジュール): Eager Task Factory.
                                                             (line   32)
* create_empty_file() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   93)
* create_function() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  118)
* create_future() (asyncio.loop のメソッド): フューチャーとタスクの生成.
                                                             (line    6)
* create_git_ignore_file() (venv.EnvBuilder のメソッド): API<2>.
                                                             (line  206)
* create_module() (importlib.abc.Loader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  103)
* create_module() (importlib.machinery.ExtensionFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  310)
* create_module() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   23)
* CREATE_NEW_CONSOLE (subprocess モジュール): Windows Constants.
                                                             (line   54)
* CREATE_NEW_PROCESS_GROUP (subprocess モジュール): Windows Constants.
                                                             (line   59)
* CREATE_NO_WINDOW (subprocess モジュール): Windows Constants.
                                                             (line  115)
* create_queue() (concurrent.interpreters モジュール): リファレンス<4>.
                                                             (line   30)
* create_server() (asyncio.loop のメソッド): ネットワークサーバの生成.
                                                             (line    6)
* create_server() (socket モジュール):   ソケットの作成.     (line  112)
* create_stats() (profile.Profile のメソッド): profile and cProfile Module Reference.
                                                             (line   84)
* create_string_buffer() (ctypes モジュール): ユーティリティー関数.
                                                             (line   58)
* create_subprocess_exec() (asyncio モジュール): サブプロセスの生成.
                                                             (line    6)
* create_subprocess_shell() (asyncio モジュール): サブプロセスの生成.
                                                             (line   26)
* create_system (zipfile.ZipInfo の属性): ZipInfo objects.   (line  115)
* create_task() (asyncio モジュール):    Task の作成.        (line   10)
* create_task() (asyncio.loop のメソッド): フューチャーとタスクの生成.
                                                             (line   18)
* create_task() (asyncio.TaskGroup のメソッド): Task Groups. (line   17)
* create_unicode_buffer() (ctypes モジュール): ユーティリティー関数.
                                                             (line   99)
* create_unix_connection() (asyncio.loop のメソッド): ネットワーク接続の確立.
                                                             (line  245)
* create_unix_server() (asyncio.loop のメソッド): ネットワークサーバの生成.
                                                             (line  118)
* create_version (zipfile.ZipInfo の属性): ZipInfo objects.  (line  119)
* create_window_function() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  216)
* create() (concurrent.interpreters モジュール): リファレンス<4>.
                                                             (line   25)
* create() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line   72)
* create() (venv モジュール):            API<2>.             (line  227)
* create() (venv.EnvBuilder のメソッド): API<2>.             (line   59)
* createAttribute() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   45)
* createAttributeNS() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   52)
* createComment() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   33)
* createDocument() (xml.dom.DOMImplementation のメソッド): DOMImplementation オブジェクト.
                                                             (line   17)
* createDocumentType() (xml.dom.DOMImplementation のメソッド): DOMImplementation オブジェクト.
                                                             (line   28)
* createElement() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   14)
* createElementNS() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   20)
* createfilehandler() (_tkinter.Widget.tk のメソッド): ファイルハンドラ.
                                                             (line   28)
* CreateKey() (winreg モジュール):       関数<14>.           (line   36)
* CreateKeyEx() (winreg モジュール):     関数<14>.           (line   63)
* createLock() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   21)
* createLock() (logging.NullHandler のメソッド): NullHandler.
                                                             (line   24)
* createProcessingInstruction() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   39)
* createSocket() (logging.handlers.SocketHandler のメソッド): SocketHandler.
                                                             (line   71)
* createSocket() (logging.handlers.SysLogHandler のメソッド): SysLogHandler.
                                                             (line   57)
* createTextNode() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   27)
* credits (組み込み変数):                site モジュールで追加される定数.
                                                             (line   26)
* CRITICAL (logging モジュール):         ロギングレベル.     (line   44)
* critical() (logging モジュール):       モジュールレベルの関数.
                                                             (line   83)
* critical() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  297)
* CRNCYSTR (locale モジュール):          locale --- 国際化サービス.
                                                             (line  295)
* CRT_ASSEMBLY_VERSION (msvcrt モジュール): その多の関数.    (line   89)
* CRT_ASSERT (msvcrt モジュール):        その多の関数.       (line   66)
* CRT_ERROR (msvcrt モジュール):         その多の関数.       (line   61)
* CRT_WARN (msvcrt モジュール):          その多の関数.       (line   56)
* CRTDBG_MODE_DEBUG (msvcrt モジュール): その多の関数.       (line   70)
* CRTDBG_MODE_FILE (msvcrt モジュール):  その多の関数.       (line   74)
* CRTDBG_MODE_WNDW (msvcrt モジュール):  その多の関数.       (line   80)
* CRTDBG_REPORT_MODE (msvcrt モジュール): その多の関数.      (line   85)
* CrtSetReportFile() (msvcrt モジュール): その多の関数.      (line   48)
* CrtSetReportMode() (msvcrt モジュール): その多の関数.      (line   40)
* cryptography:                          暗号関連のサービス. (line    6)
* cssclass_month (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  286)
* cssclass_month_head (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  279)
* cssclass_noday (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  265)
* cssclass_year (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  293)
* cssclass_year_head (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  300)
* cssclasses (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  252)
* cssclasses_weekday_head (calendar.HTMLCalendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  272)
* csv:                                   csv --- CSV ファイルの読み書き.
                                                             (line    8)
* cte (email.headerregistry.ContentTransferEncodingHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  288)
* cte_type (email.policy.Policy の属性): email policy Policy Objects.
                                                             (line  158)
* ctermid() (os モジュール):             プロセスのパラメーター.
                                                             (line    9)
* ctime() (datetime.date のメソッド):    date objects.       (line  309)
* ctime() (datetime.datetime のメソッド): datetime objects.  (line  737)
* ctime() (time モジュール):             関数<5>.            (line   93)
* CTRL_BREAK_EVENT (signal モジュール):  モジュールの内容<2>.
                                                             (line  227)
* CTRL_C_EVENT (signal モジュール):      モジュールの内容<2>.
                                                             (line  218)
* ctrl() (curses.ascii モジュール):      curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  213)
* curdir (os モジュール):                雑多なシステム情報. (line  100)
* currency() (locale モジュール):        locale --- 国際化サービス.
                                                             (line  474)
* current context:                       用語集<2>.          (line  406)
* current_process() (multiprocessing モジュール): その他<5>. (line   36)
* current_task() (asyncio モジュール):   イントロスペクション.
                                                             (line    6)
* current_thread() (threading モジュール): リファレンス<2>.  (line   15)
* current() (tkinter.ttk.Combobox のメソッド): ttk Combobox. (line    8)
* CurrentByteIndex (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  241)
* CurrentColumnNumber (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  245)
* currentframe() (inspect モジュール):   インタープリタスタック.
                                                             (line  155)
* CurrentLineNumber (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  249)
* curs_set() (curses モジュール):        関数<6>.            (line   76)
* Cursor (sqlite3 のクラス):             Cursor オブジェクト.
                                                             (line   20)
* cursor() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line   27)
* cursyncup() (curses.window のメソッド): Window オブジェクト.
                                                             (line  168)
* Cut [切り取り]:                        Help メニュー Shell ウィンドウ、Editor ウィンドウ.
                                                             (line   32)
* cutoff (sys.hash_info の属性):         sys --- システム固有のパラメーターと関数.
                                                             (line 1087)
* cwd() (ftplib.FTP のメソッド):         FTP オブジェクト.   (line  334)
* cwd() (pathlib.Path のクラスメソッド): パスの展開と解決.   (line   30)
* cycle() (itertools モジュール):        Itertool関数.       (line  245)
* CycleError:                            例外<4>.            (line    8)
* cyclic isolate:                        用語集<2>.          (line  416)
* D_FMT (locale モジュール):             locale --- 国際化サービス.
                                                             (line  198)
* D_T_FMT (locale モジュール):           locale --- 国際化サービス.
                                                             (line  192)
* daemon (multiprocessing.Process の属性): Process クラスと例外.
                                                             (line  134)
* daemon (threading.Thread の属性):      Thread objects.     (line  245)
* daemon_threads (socketserver.ThreadingMixIn の属性): サーバ生成に関するノート.
                                                             (line   62)
* dangling;else:                         複合文 compound statement.
                                                             (line   52)
* data (collections.UserDict の属性):    UserDict オブジェクト.
                                                             (line   22)
* data (collections.UserList の属性):    UserList オブジェクト.
                                                             (line   27)
* data (collections.UserString の属性):  UserString オブジェクト.
                                                             (line   22)
* data (plistlib.UID の属性):            plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line  146)
* data (select.kevent の属性):           kevent オブジェクト.
                                                             (line  174)
* data (selectors.SelectorKey の属性):   クラス<4>.          (line   48)
* data (urllib.request.Request の属性):  Request オブジェクト.
                                                             (line   39)
* data (xml.dom.Comment の属性):         Comment オブジェクト.
                                                             (line    9)
* data (xml.dom.ProcessingInstruction の属性): ProcessingInstruction オブジェクト.
                                                             (line   13)
* data (xml.dom.Text の属性):            Text オブジェクトおよび CDATASection オブジェクト.
                                                             (line   15)
* data (xmlrpc.client.Binary の属性):    Binary オブジェクト.
                                                             (line   11)
* data race:                             用語集<2>.          (line  424)
* data_filter() (tarfile モジュール):    Default named filters.
                                                             (line   36)
* data_open() (urllib.request.DataHandler のメソッド): DataHandler オブジェクト.
                                                             (line    6)
* data_received() (asyncio.Protocol のメソッド): ストリーミングプロトコル.
                                                             (line   13)
* data() (xml.etree.ElementTree.TreeBuilder のメソッド): TreeBuilder オブジェクト.
                                                             (line   32)
* DatabaseError:                         例外<7>.            (line   42)
* dataclass_transform() (typing モジュール): Functions and decorators.
                                                             (line  113)
* dataclass() (dataclasses モジュール):  モジュールの内容<4>.
                                                             (line    6)
* DataError:                             例外<7>.            (line   49)
* datagram_received() (asyncio.DatagramProtocol のメソッド): データグラムプロトコル.
                                                             (line   10)
* DatagramHandler (logging.handlers のクラス): DatagramHandler.
                                                             (line   10)
* DatagramProtocol (asyncio のクラス):   基底プロトコル.     (line   21)
* DatagramRequestHandler (socketserver のクラス): Request Handler Objects.
                                                             (line   55)
* DatagramTransport (asyncio のクラス):  トランスポートのクラス階層構造.
                                                             (line   44)
* DataHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  477)
* date (datetime のクラス):              date objects.       (line   12)
* date_time (zipfile.ZipInfo の属性):    ZipInfo objects.    (line   55)
* date_time_string() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  367)
* date() (datetime.datetime のメソッド): datetime objects.   (line  445)
* DateHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  134)
* datetime (datetime のクラス):          datetime objects.   (line   17)
* datetime (email.headerregistry.DateHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  143)
* DateTime (xmlrpc.client のクラス):     DateTime オブジェクト.
                                                             (line    6)
* Day (calendar のクラス):               calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  453)
* day (datetime.date の属性):            date objects.       (line  154)
* day (datetime.datetime の属性):        datetime objects.   (line  316)
* DAY_1 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  216)
* DAY_2 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  216)
* DAY_3 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  216)
* DAY_4 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  216)
* DAY_5 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  216)
* DAY_6 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  216)
* DAY_7 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  216)
* day_abbr (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  431)
* day_name (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  422)
* daylight (time モジュール):            Timezone Constants. (line   13)
* days (datetime.timedelta の属性):      timedelta objects.  (line  107)
* DbfilenameShelf (shelve のクラス):     制限事項.           (line   74)
* DC1 (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   75)
* DC2 (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   78)
* DC3 (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   81)
* DC4 (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   84)
* dcgettext() (locale モジュール):       メッセージカタログへのアクセス.
                                                             (line   10)
* deactivate_stack_trampoline() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1877)
* deadlock:                              用語集<2>.          (line  436)
* deallocation, object:                  ファイナライズとメモリ解放.
                                                             (line    6)
* debug (imaplib.IMAP4 の属性):          IMAP4 オブジェクト. (line  489)
* DEBUG (logging モジュール):            ロギングレベル.     (line   24)
* debug (pdb command):                   Debugger commands.  (line  449)
* DEBUG (re モジュール):                 フラグ.             (line   31)
* debug (shlex.shlex の属性):            shlex オブジェクト. (line  161)
* debug (sys.flags の属性):              sys --- システム固有のパラメーターと関数.
                                                             (line  527)
* debug (zipfile.ZipFile の属性):        ZipFile objects.    (line  369)
* DEBUG_BYTECODE_SUFFIXES (importlib.machinery モジュール): importlib machinery -- Importers and path hooks.
                                                             (line   20)
* DEBUG_COLLECTABLE (gc モジュール):     gc --- ガベージコレクターインターフェース.
                                                             (line  325)
* DEBUG_LEAK (gc モジュール):            gc --- ガベージコレクターインターフェース.
                                                             (line  345)
* DEBUG_SAVEALL (gc モジュール):         gc --- ガベージコレクターインターフェース.
                                                             (line  339)
* debug_src() (doctest モジュール):      デバッグ.           (line  144)
* DEBUG_STATS (gc モジュール):           gc --- ガベージコレクターインターフェース.
                                                             (line  320)
* DEBUG_UNCOLLECTABLE (gc モジュール):   gc --- ガベージコレクターインターフェース.
                                                             (line  329)
* debug() (doctest モジュール):          デバッグ.           (line  123)
* debug() (logging モジュール):          モジュールレベルの関数.
                                                             (line   44)
* debug() (logging.Logger のメソッド):   ロガーオブジェクト. (line  182)
* debug() (unittest.TestCase のメソッド): テストクラス.      (line  124)
* debug() (unittest.TestSuite のメソッド): テストのグループ化.
                                                             (line   48)
* debugger:                              リファレンス<2>.    (line  129)
* debugger <1>:                          Debug メニュー Shell ウィンドウのみ.
                                                             (line   15)
* debugger <2>:                          sys --- システム固有のパラメーターと関数.
                                                             (line  964)
* debugger <3>:                          sys --- システム固有のパラメーターと関数.
                                                             (line 1717)
* debugger;設定;ファイル:                Debugger commands.  (line   60)
* debuglevel (http.client.HTTPResponse の属性): HTTPResponse オブジェクト.
                                                             (line   70)
* DebugRunner (doctest のクラス):        デバッグ.           (line  164)
* DECEMBER (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  483)
* Decimal (decimal のクラス):            Decimal オブジェクト.
                                                             (line    6)
* decimal() (unicodedata モジュール):    unicodedata --- Unicode データベース.
                                                             (line   51)
* DecimalException (decimal のクラス):   シグナル.           (line   29)
* decode (codecs.CodecInfo の属性):      codecs --- codec レジストリと基底クラス.
                                                             (line   79)
* decode_header() (email.header モジュール): email header 国際化されたヘッダー.
                                                             (line  176)
* decode_params() (email.utils モジュール): email utils Miscellaneous utilities.
                                                             (line  219)
* decode_rfc2231() (email.utils モジュール): email utils Miscellaneous utilities.
                                                             (line  187)
* decode_source() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line   74)
* decode() (base64 モジュール):          レガシーインターフェース.
                                                             (line    6)
* decode() (bytearray のメソッド):       bytes と bytearray の操作.
                                                             (line   92)
* decode() (bytes のメソッド):           bytes と bytearray の操作.
                                                             (line   92)
* decode() (codecs モジュール):          codecs --- codec レジストリと基底クラス.
                                                             (line   34)
* decode() (codecs.Codec のメソッド):    ステートレスなエンコードとデコード.
                                                             (line   32)
* decode() (codecs.IncrementalDecoder のメソッド): IncrementalDecoder オブジェクト.
                                                             (line   28)
* decode() (json.JSONDecoder のメソッド): エンコーダとデコーダ.
                                                             (line   88)
* decode() (quopri モジュール):          quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line   19)
* decode() (xmlrpc.client.Binary のメソッド): Binary オブジェクト.
                                                             (line   19)
* decode() (xmlrpc.client.DateTime のメソッド): DateTime オブジェクト.
                                                             (line   14)
* decodebytes() (base64 モジュール):     レガシーインターフェース.
                                                             (line   13)
* DecodedGenerator (email.generator のクラス): email generator Generating MIME documents.
                                                             (line  231)
* decodestring() (quopri モジュール):    quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line   42)
* decomposition() (unicodedata モジュール): unicodedata --- Unicode データベース.
                                                             (line  124)
* decompress() (bz2 モジュール):         一括圧縮/解凍.      (line   16)
* decompress() (bz2.BZ2Decompressor のメソッド): 逐次圧縮および展開.
                                                             (line   46)
* decompress() (compression.zstd モジュール): メモリ上での圧縮と展開.
                                                             (line   31)
* decompress() (compression.zstd.ZstdDecompressor のメソッド): メモリ上での圧縮と展開.
                                                             (line  184)
* decompress() (gzip モジュール):        gzip --- gzip ファイルのサポート.
                                                             (line  224)
* decompress() (lzma モジュール):        メモリ上での圧縮と展開<2>.
                                                             (line  180)
* decompress() (lzma.LZMADecompressor のメソッド): メモリ上での圧縮と展開<2>.
                                                             (line  121)
* decompress() (zlib モジュール):        zlib --- gzip 互換の圧縮.
                                                             (line  134)
* decompress() (zlib.Decompress のメソッド): zlib --- gzip 互換の圧縮.
                                                             (line  259)
* decompressed_size (compression.zstd.FrameInfo の属性): その他<3>.
                                                             (line   16)
* DecompressionParameter (compression.zstd のクラス): Advanced parameter control.
                                                             (line  259)
* decompressobj() (zlib モジュール):     zlib --- gzip 互換の圧縮.
                                                             (line  179)
* decorator:                             用語集<2>.          (line  449)
* DEDENT (token モジュール):             token --- Python 解析木で使われる定数.
                                                             (line   87)
* DEDENT トークン:                       インデント.         (line   31)
* DEDENT トークン <1>:                   複合文 compound statement.
                                                             (line   52)
* dedent() (textwrap モジュール):        textwrap --- テキストの折り返しと詰め込み.
                                                             (line   76)
* deepcopy() (copy モジュール):          copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   23)
* DEF_BUF_SIZE (zlib モジュール):        zlib --- gzip 互換の圧縮.
                                                             (line  314)
* DEF_MEM_LEVEL (zlib モジュール):       zlib --- gzip 互換の圧縮.
                                                             (line  310)
* def_prog_mode() (curses モジュール):   関数<6>.            (line   85)
* def_shell_mode() (curses モジュール):  関数<6>.            (line   92)
* default (email.policy モジュール):     email policy Policy Objects.
                                                             (line  502)
* default (inspect.Parameter の属性):    Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  244)
* default (optparse.Option の属性):      オプション属性.     (line   44)
* DEFAULT (unittest.mock モジュール):    DEFAULT.            (line    6)
* DEFAULT_BUFFER_SIZE (io モジュール):   高水準のモジュールインターフェイス.
                                                             (line    6)
* default_bufsize (xml.dom.pulldom モジュール): xml dom pulldom --- 部分的な DOM ツリー構築のサポート.
                                                             (line  101)
* DEFAULT_ENTROPY (secrets モジュール):  トークンは何バイト使うべきか？.
                                                             (line   20)
* default_exception_handler() (asyncio.loop のメソッド): エラーハンドリング API.
                                                             (line   34)
* default_factory (collections.defaultdict の属性): defaultdict オブジェクト.
                                                             (line   48)
* DEFAULT_FORMAT (tarfile モジュール):   tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  390)
* DEFAULT_IGNORES (filecmp モジュール):  dircmp クラス.      (line  113)
* default_loader() (xml.etree.ElementInclude モジュール): 関数<10>.
                                                             (line    6)
* default_max_str_digits (sys.int_info の属性): sys --- システム固有のパラメーターと関数.
                                                             (line 1186)
* default_open() (urllib.request.BaseHandler のメソッド): BaseHandler オブジェクト.
                                                             (line   30)
* DEFAULT_PROTOCOL (pickle モジュール):  モジュールインターフェース.
                                                             (line   21)
* DEFAULT_TIMEOUT (unittest.mock.ThreadingMock の属性): Mock クラス.
                                                             (line  989)
* default_timer() (timeit モジュール):   Python インターフェイス.
                                                             (line   31)
* default;parameter;value:               関数定義.           (line   67)
* default() (cmd.Cmd のメソッド):        Cmdオブジェクト.    (line   75)
* default() (json.JSONEncoder のメソッド): エンコーダとデコーダ.
                                                             (line  205)
* DefaultContext (decimal モジュール):   Context オブジェクト.
                                                             (line   94)
* DefaultCookiePolicy (http.cookiejar のクラス): http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line   82)
* defaultdict (collections のクラス):    defaultdict オブジェクト.
                                                             (line    6)
* DefaultDict (typing のクラス):         Aliases to types in collections.
                                                             (line    6)
* DefaultEventLoopPolicy (asyncio のクラス): ポリシーオブジェクト.
                                                             (line   38)
* DefaultHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  392)
* DefaultHandlerExpand() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  399)
* defaults() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  108)
* DefaultSelector (selectors のクラス):  クラス<4>.          (line  164)
* defaultTestLoader (unittest モジュール): テストのロードと起動.
                                                             (line  449)
* defaultTestResult() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  805)
* defects (email.headerregistry.BaseHeader の属性): email headerregistry Custom Header Objects.
                                                             (line   53)
* defects (email.message.EmailMessage の属性): email message Representing an email message.
                                                             (line  714)
* defects (email.message.Message の属性): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  734)
* DEFLATED (zlib モジュール):            zlib --- gzip 互換の圧縮.
                                                             (line  301)
* defpath (os モジュール):               雑多なシステム情報. (line  142)
* DefragResult (urllib.parse のクラス):  構造化された解析結果.
                                                             (line   39)
* DefragResultBytes (urllib.parse のクラス): 構造化された解析結果.
                                                             (line   64)
* degrees() (math モジュール):           角度変換.           (line    6)
* degrees() (turtle モジュール):         設定と計測.         (line    6)
* Del (ast のクラス):                    変数.               (line   11)
* DEL (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  123)
* del_param() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  384)
* del_param() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  550)
* delay_output() (curses モジュール):    関数<6>.            (line  100)
* delay() (turtle モジュール):           アニメーションの制御.
                                                             (line   19)
* delayload (http.cookiejar.FileCookieJar の属性): CookieJar および FileCookieJar オブジェクト.
                                                             (line  166)
* delch() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  173)
* dele() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   67)
* Delete (ast のクラス):                 文 Statements.      (line  139)
* DELETE_ATTR (opcode):                  Python バイトコード命令.
                                                             (line  599)
* DELETE_DEREF (opcode):                 Python バイトコード命令.
                                                             (line 1045)
* DELETE_FAST (opcode):                  Python バイトコード命令.
                                                             (line 1006)
* DELETE_GLOBAL (opcode):                Python バイトコード命令.
                                                             (line  614)
* DELETE_NAME (opcode):                  Python バイトコード命令.
                                                             (line  553)
* DELETE_SUBSCR (opcode):                Python バイトコード命令.
                                                             (line  278)
* delete() (ftplib.FTP のメソッド):      FTP オブジェクト.   (line  327)
* delete() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line   76)
* delete() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line   74)
* deleteacl() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line   80)
* deletefilehandler() (_tkinter.Widget.tk のメソッド): ファイルハンドラ.
                                                             (line   38)
* DeleteKey() (winreg モジュール):       関数<14>.           (line  101)
* DeleteKeyEx() (winreg モジュール):     関数<14>.           (line  123)
* deleteln() (curses.window のメソッド): Window オブジェクト.
                                                             (line  177)
* deleteMe() (bdb.Breakpoint のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line   42)
* DeleteValue() (winreg モジュール):     関数<14>.           (line  159)
* deletion;target:                       del 文<2>.          (line    6)
* deletion;target;list:                  del 文<2>.          (line    6)
* delimiter (csv.Dialect の属性):        Dialect クラスと書式化パラメータ.
                                                             (line   19)
* delitem() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  199)
* deliver_challenge() (multiprocessing.connection モジュール): リスナーとクライアント.
                                                             (line   15)
* delocalize() (locale モジュール):      locale --- 国際化サービス.
                                                             (line  495)
* demo_app() (wsgiref.simple_server モジュール): wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line   36)
* denominator (fractions.Fraction の属性): fractions --- 有理数.
                                                             (line  118)
* denominator (numbers.Rational の属性): 数値塔.             (line   55)
* deprecated() (warnings モジュール):    利用可能な関数.     (line  137)
* DeprecationWarning:                    警告.               (line   17)
* deque (collections のクラス):          deque オブジェクト. (line    6)
* Deque (typing のクラス):               Aliases to types in collections.
                                                             (line   49)
* dequeue() (logging.handlers.QueueListener のメソッド): QueueListener.
                                                             (line   56)
* DER_cert_to_PEM_cert() (ssl モジュール): 証明書の取り扱い. (line   53)
* derive() (BaseExceptionGroup のメソッド): 例外グループ.    (line   71)
* derwin() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  182)
* descrgetfunc (C type):                 Slot Type typedefs. (line   75)
* description (inspect.Parameter.kind の属性): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  303)
* description (sqlite3.Cursor の属性):   Cursor オブジェクト.
                                                             (line  196)
* descriptor:                            用語集<2>.          (line  470)
* descrsetfunc (C type):                 Slot Type typedefs. (line   80)
* deserialize() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  712)
* dest (optparse.Option の属性):         オプション属性.     (line   35)
* destructor (C type):                   Slot Type typedefs. (line   25)
* detach() (io.BufferedIOBase のメソッド): I/O 基底クラス.   (line  257)
* detach() (io.TextIOBase のメソッド):   テキスト I/O<2>.    (line   37)
* detach() (socket.socket のメソッド):   socket オブジェクト.
                                                             (line  100)
* detach() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line   80)
* detach() (weakref.finalize のメソッド): weakref --- Weak references.
                                                             (line  291)
* Detach() (winreg.PyHKEY のメソッド):   レジストリハンドルオブジェクト.
                                                             (line   37)
* DETACHED_PROCESS (subprocess モジュール): Windows Constants.
                                                             (line  122)
* details (ctypes.COMError の属性):      例外<10>.           (line   23)
* detect_api_mismatch() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  677)
* detect_encoding() (tokenize モジュール): 入力のトークナイズ.
                                                             (line   76)
* deterministic profiling:               プロファイラとは.   (line    6)
* dev_mode (sys.flags の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line  566)
* device_encoding() (os モジュール):     ファイル記述子の操作.
                                                             (line   81)
* devmajor (tarfile.TarInfo の属性):     TarInfo オブジェクト.
                                                             (line  143)
* devminor (tarfile.TarInfo の属性):     TarInfo オブジェクト.
                                                             (line  147)
* devnull (os モジュール):               雑多なシステム情報. (line  157)
* DEVNULL (subprocess モジュール):       Using the subprocess Module.
                                                             (line  142)
* devpoll() (select モジュール):         select --- I/O 完了の待機.
                                                             (line   37)
* DevpollSelector (selectors のクラス):  クラス<4>.          (line  187)
* dfast (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  311)
* dgettext() (gettext モジュール):       GNU gettext API.    (line   40)
* dgettext() (locale モジュール):        メッセージカタログへのアクセス.
                                                             (line    8)
* Dialect (csv のクラス):                モジュールコンテンツ<3>.
                                                             (line  184)
* dialect (csv.csvreader の属性):        reader オブジェクト.
                                                             (line   20)
* dialect (csv.csvwriter の属性):        writer オブジェクト.
                                                             (line   33)
* Dialog (tkinter.commondialog のクラス): tkinter commondialog --- Dialog window templates.
                                                             (line   13)
* Dialog (tkinter.simpledialog のクラス): tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line   21)
* Dict (ast のクラス):                   リテラル<3>.        (line  167)
* Dict (typing のクラス):                Aliases to built-in types.
                                                             (line    6)
* dict (組み込みクラス):                 マッピング型 --- dict.
                                                             (line   20)
* dict_content (compression.zstd.ZstdDict の属性): Zstandard dictionaries.
                                                             (line  121)
* dict_id (compression.zstd.ZstdDict の属性): Zstandard dictionaries.
                                                             (line  128)
* dict_id_flag (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  215)
* DICT_MERGE (opcode):                   Python バイトコード命令.
                                                             (line  767)
* DICT_UPDATE (opcode):                  Python バイトコード命令.
                                                             (line  756)
* dict() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  225)
* DictComp (ast のクラス):               内包表記 Comprehension.
                                                             (line    6)
* dictConfig() (logging.config モジュール): 環境設定のための関数.
                                                             (line   13)
* dictionary:                            用語集<2>.          (line  487)
* dictionary comprehension:              用語集<2>.          (line  493)
* dictionary view:                       用語集<2>.          (line  501)
* dictionary_id (compression.zstd.FrameInfo の属性): その他<3>.
                                                             (line   20)
* dictionary;内包表記:                   辞書表示.           (line    6)
* dictionary;表示:                       辞書表示.           (line    6)
* DictReader (csv のクラス):             モジュールコンテンツ<3>.
                                                             (line  103)
* DictWriter (csv のクラス):             モジュールコンテンツ<3>.
                                                             (line  150)
* diff_bytes() (difflib モジュール):     difflib --- 差分の計算の補助.
                                                             (line  331)
* diff_files (filecmp.dircmp の属性):    dircmp クラス.      (line   93)
* Differ (difflib のクラス):             difflib --- 差分の計算の補助.
                                                             (line   49)
* difference_update() (set のメソッド):  set（集合）型 --- set frozenset.
                                                             (line  185)
* difference() (frozenset のメソッド):   set（集合）型 --- set frozenset.
                                                             (line  112)
* difference() (set のメソッド):         set（集合）型 --- set frozenset.
                                                             (line  112)
* dig (sys.float_info の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line  646)
* digest_size (hmac.HMAC の属性):        hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   94)
* digest() (hashlib.hash のメソッド):    Hash Objects.       (line   37)
* digest() (hashlib.shake のメソッド):   SHAKE 可変長ダイジェスト.
                                                             (line   15)
* digest() (hmac モジュール):            hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   33)
* digest() (hmac.HMAC のメソッド):       hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   61)
* digit() (unicodedata モジュール):      unicodedata --- Unicode データベース.
                                                             (line   62)
* digits (string モジュール):            文字列定数.         (line   23)
* dir() (ftplib.FTP のメソッド):         FTP オブジェクト.   (line  308)
* dircmp (filecmp のクラス):             dircmp クラス.      (line    6)
* Directory (tkinter.filedialog のクラス): ネイティブの読み込み/保存ダイアログ.
                                                             (line   70)
* DirEntry (os のクラス):                ファイルとディレクトリ.
                                                             (line  933)
* dirname() (os.path モジュール):        os path --- 一般的なパス名操作.
                                                             (line  111)
* dirs_double_event() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line   85)
* dirs_select_event() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line   89)
* DirsOnSysPath (test.support.import_helper のクラス): test support import_helper --- Utilities for import tests.
                                                             (line   97)
* DIRTYPE (tarfile モジュール):          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  350)
* dis コマンドラインオプション; -C:      コマンドライン・インターフェース<12>.
                                                             (line   16)
* dis コマンドラインオプション; -h:      コマンドライン・インターフェース<12>.
                                                             (line   12)
* dis コマンドラインオプション; -help:   コマンドライン・インターフェース<12>.
                                                             (line   12)
* dis コマンドラインオプション; -O:      コマンドライン・インターフェース<12>.
                                                             (line   22)
* dis コマンドラインオプション; -P:      コマンドライン・インターフェース<12>.
                                                             (line   28)
* dis コマンドラインオプション; -S:      コマンドライン・インターフェース<12>.
                                                             (line   34)
* dis コマンドラインオプション; -show-caches: コマンドライン・インターフェース<12>.
                                                             (line   16)
* dis コマンドラインオプション; -show-offsets: コマンドライン・インターフェース<12>.
                                                             (line   22)
* dis コマンドラインオプション; -show-positions: コマンドライン・インターフェース<12>.
                                                             (line   28)
* dis コマンドラインオプション; -specialized: コマンドライン・インターフェース<12>.
                                                             (line   34)
* dis() (dis モジュール):                解析関数.           (line   38)
* dis() (dis.Bytecode のメソッド):       バイトコード解析.   (line   62)
* dis() (pickletools モジュール):        Programmatic interface.
                                                             (line    6)
* disable (pdb command):                 Debugger commands.  (line  141)
* DISABLE (sys.monitoring モジュール):   Disabling events.   (line    6)
* disable_current_event() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  436)
* disable_faulthandler() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  378)
* disable_gc() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  390)
* disable_interspersed_args() (optparse.OptionParser のメソッド): オプション解析器への問い合わせと操作.
                                                             (line   10)
* disable() (bdb.Breakpoint のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line   53)
* disable() (faulthandler モジュール):   フォールトハンドラの状態.
                                                             (line   37)
* disable() (gc モジュール):             gc --- ガベージコレクターインターフェース.
                                                             (line   25)
* disable() (logging モジュール):        モジュールレベルの関数.
                                                             (line  102)
* disable() (profile.Profile のメソッド): profile and cProfile Module Reference.
                                                             (line   80)
* disabled (logging.Logger の属性):      ロガーオブジェクト. (line   96)
* DisableReflectionKey() (winreg モジュール): 関数<14>.      (line  477)
* disassemble() (dis モジュール):        解析関数.           (line  102)
* discard (http.cookiejar.Cookie の属性): Cookieオブジェクト<2>.
                                                             (line   59)
* discard() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line   76)
* discard() (mailbox.MH のメソッド):     MH オブジェクト.    (line   81)
* discard() (set のメソッド):            set（集合）型 --- set frozenset.
                                                             (line  207)
* disco() (dis モジュール):              解析関数.           (line  102)
* discover() (unittest.TestLoader のメソッド): テストのロードと起動.
                                                             (line  114)
* disk_usage() (shutil モジュール):      ディレクトリとファイルの操作.
                                                             (line  400)
* dispatch_call() (bdb.Bdb のメソッド):  bdb --- デバッガーフレームワーク.
                                                             (line  238)
* dispatch_exception() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  258)
* dispatch_line() (bdb.Bdb のメソッド):  bdb --- デバッガーフレームワーク.
                                                             (line  228)
* dispatch_return() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  248)
* dispatch_table (pickle.Pickler の属性): モジュールインターフェース.
                                                             (line  186)
* DISPLAY:                               Tkinter モジュール. (line   26)
* display (pdb command):                 Debugger commands.  (line  296)
* display_name (email.headerregistry.Address の属性): email headerregistry Custom Header Objects.
                                                             (line  420)
* display_name (email.headerregistry.Group の属性): email headerregistry Custom Header Objects.
                                                             (line  464)
* displayhook() (sys モジュール):        sys --- システム固有のパラメーターと関数.
                                                             (line  291)
* dist() (math モジュール):              Summation and product functions.
                                                             (line    6)
* distance() (turtle モジュール):        Turtle の状態を知る.
                                                             (line   66)
* distb() (dis モジュール):              解析関数.           (line   83)
* Distribution (importlib.metadata のクラス): Distributions. (line   14)
* distribution() (importlib.metadata モジュール): Distributions.
                                                             (line    6)
* Div (ast のクラス):                    式 expression<2>.   (line   55)
* divide_int() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  310)
* divide() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  306)
* division:                              二項算術演算 binary arithmetic operation.
                                                             (line   37)
* division (__future__ モジュール):      モジュールコンテンツ<5>.
                                                             (line   22)
* DivisionByZero (decimal のクラス):     シグナル.           (line   34)
* divmod() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  314)
* DLE (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   72)
* DllCanUnloadNow() (ctypes モジュール): ユーティリティー関数.
                                                             (line  113)
* DllGetClassObject() (ctypes モジュール): ユーティリティー関数.
                                                             (line  121)
* dllhandle (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line  285)
* dllist() (ctypes.util モジュール):     ユーティリティー関数.
                                                             (line  154)
* dnd_start() (tkinter.dnd モジュール):  tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   64)
* DndHandler (tkinter.dnd のクラス):     tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   42)
* dngettext() (gettext モジュール):      GNU gettext API.    (line   59)
* dnpgettext() (gettext モジュール):     GNU gettext API.    (line   70)
* do_clear() (bdb.Bdb のメソッド):       bdb --- デバッガーフレームワーク.
                                                             (line  321)
* do_command() (curses.textpad.Textbox のメソッド): Textbox オブジェクト.
                                                             (line   31)
* do_GET() (http.server.SimpleHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  432)
* do_handshake() (ssl.SSLSocket のメソッド): SSL ソケット.   (line  127)
* do_HEAD() (http.server.SimpleHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  425)
* do_help() (cmd.Cmd のメソッド):        Cmdオブジェクト.    (line   48)
* do_POST() (http.server.CGIHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  519)
* doc (json.JSONDecodeError の属性):     例外<20>.           (line   14)
* doc (tomllib.TOMLDecodeError の属性):  tomllib --- TOML ファイルの解析.
                                                             (line   69)
* doc_header (cmd.Cmd の属性):           Cmdオブジェクト.    (line  153)
* DocCGIXMLRPCRequestHandler (xmlrpc.server のクラス): XMLRPC サーバの文書化.
                                                             (line   22)
* DocFileSuite() (doctest モジュール):   単体テスト API.     (line   25)
* doClassCleanups() (unittest.TestCase のクラスメソッド): テストクラス.
                                                             (line  896)
* doCleanups() (unittest.TestCase のメソッド): テストクラス. (line  856)
* docmd() (smtplib.SMTP のメソッド):     SMTP オブジェクト.  (line   17)
* docstring:                             クラス定義.         (line    6)
* docstring <1>:                         用語集<2>.          (line  510)
* docstring (doctest.DocTest の属性):    DocTest オブジェクト.
                                                             (line   47)
* docstrings:                            関数を定義する.     (line   21)
* docstrings <1>:                        ドキュメンテーション文字列.
                                                             (line    6)
* DocTest (doctest のクラス):            DocTest オブジェクト.
                                                             (line    6)
* doctest コマンドラインオプション; -f:  コマンドラインでの使用<6>.
                                                             (line   34)
* doctest コマンドラインオプション; -fail-fast: コマンドラインでの使用<6>.
                                                             (line   34)
* doctest コマンドラインオプション; -o:  コマンドラインでの使用<6>.
                                                             (line   27)
* doctest コマンドラインオプション; -option: コマンドラインでの使用<6>.
                                                             (line   27)
* doctest コマンドラインオプション; -v:  コマンドラインでの使用<6>.
                                                             (line   10)
* doctest コマンドラインオプション; -verbose: コマンドラインでの使用<6>.
                                                             (line   10)
* DocTestFailure:                        デバッグ.           (line  182)
* DocTestFinder (doctest のクラス):      DocTestFinder オブジェクト.
                                                             (line    6)
* DocTestParser (doctest のクラス):      DocTestParser オブジェクト.
                                                             (line    6)
* DocTestRunner (doctest のクラス):      DocTestRunner オブジェクト.
                                                             (line    6)
* DocTestSuite() (doctest モジュール):   単体テスト API.     (line  103)
* doctype() (xml.etree.ElementTree.TreeBuilder のメソッド): TreeBuilder オブジェクト.
                                                             (line   65)
* documentation strings:                 関数を定義する.     (line   21)
* documentation strings <1>:             ドキュメンテーション文字列.
                                                             (line    6)
* documentation;generation:              pydoc --- ドキュメント生成とオンラインヘルプシステム.
                                                             (line    8)
* documentation;online:                  pydoc --- ドキュメント生成とオンラインヘルプシステム.
                                                             (line    8)
* documentElement (xml.dom.Document の属性): Document オブジェクト.
                                                             (line   10)
* DocXMLRPCRequestHandler (xmlrpc.server のクラス): XMLRPC サーバの文書化.
                                                             (line   27)
* DocXMLRPCServer (xmlrpc.server のクラス): XMLRPC サーバの文書化.
                                                             (line   11)
* does_esmtp (smtplib.SMTP の属性):      SMTP オブジェクト.  (line  352)
* domain (email.headerregistry.Address の属性): email headerregistry Custom Header Objects.
                                                             (line  430)
* domain (http.cookiejar.Cookie の属性): Cookieオブジェクト<2>.
                                                             (line   40)
* domain (http.cookies.Morsel の属性):   Morselオブジェクト. (line   13)
* domain (tracemalloc.DomainFilter の属性): DomainFilter.    (line   20)
* domain (tracemalloc.Filter の属性):    Filter.             (line   31)
* domain (tracemalloc.Trace の属性):     Trace.              (line   15)
* domain_initial_dot (http.cookiejar.Cookie の属性): Cookieオブジェクト<2>.
                                                             (line   91)
* domain_return_ok() (http.cookiejar.CookiePolicy のメソッド): CookiePolicy オブジェクト.
                                                             (line   27)
* domain_specified (http.cookiejar.Cookie の属性): Cookieオブジェクト<2>.
                                                             (line   87)
* DomainFilter (tracemalloc のクラス):   DomainFilter.       (line    6)
* DomainLiberal (http.cookiejar.DefaultCookiePolicy の属性): DefaultCookiePolicy オブジェクト.
                                                             (line  157)
* DomainRFC2965Match (http.cookiejar.DefaultCookiePolicy の属性): DefaultCookiePolicy オブジェクト.
                                                             (line  149)
* DomainStrict (http.cookiejar.DefaultCookiePolicy の属性): DefaultCookiePolicy オブジェクト.
                                                             (line  162)
* DomainStrictNoDots (http.cookiejar.DefaultCookiePolicy の属性): DefaultCookiePolicy オブジェクト.
                                                             (line  135)
* DomainStrictNonDomain (http.cookiejar.DefaultCookiePolicy の属性): DefaultCookiePolicy オブジェクト.
                                                             (line  142)
* DOMEventStream (xml.dom.pulldom のクラス): DOMEventStream オブジェクト.
                                                             (line    6)
* DOMException:                          例外<23>.           (line   17)
* doModuleCleanups() (unittest モジュール): setUpModule と tearDownModule.
                                                             (line   45)
* DomstringSizeErr:                      例外<23>.           (line   22)
* done() (asyncio.Future のメソッド):    Future オブジェクト<2>.
                                                             (line   63)
* done() (asyncio.Task のメソッド):      Task オブジェクト.  (line   67)
* done() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   32)
* done() (graphlib.TopologicalSorter のメソッド): graphlib --- グラフ構造を操作する機能.
                                                             (line  140)
* done() (turtle モジュール):            スクリーンイベントを利用する.
                                                             (line  105)
* DONT_ACCEPT_BLANKLINE (doctest モジュール): オプションフラグ.
                                                             (line   28)
* DONT_ACCEPT_TRUE_FOR_1 (doctest モジュール): オプションフラグ.
                                                             (line   16)
* dont_write_bytecode (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line  328)
* dont_write_bytecode (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  542)
* doRollover() (logging.handlers.RotatingFileHandler のメソッド): RotatingFileHandler.
                                                             (line   44)
* doRollover() (logging.handlers.TimedRotatingFileHandler のメソッド): TimedRotatingFileHandler.
                                                             (line  102)
* DOT (token モジュール):                token --- Python 解析木で使われる定数.
                                                             (line  251)
* dot() (turtle モジュール):             Turtle の動き.      (line  248)
* DOTALL (re モジュール):                フラグ.             (line  103)
* doublequote (csv.Dialect の属性):      Dialect クラスと書式化パラメータ.
                                                             (line   24)
* DOUBLESLASH (token モジュール):        token --- Python 解析木で使われる定数.
                                                             (line  323)
* DOUBLESLASHEQUAL (token モジュール):   token --- Python 解析木で使われる定数.
                                                             (line  326)
* DOUBLESTAR (token モジュール):         token --- Python 解析木で使われる定数.
                                                             (line  287)
* DOUBLESTAREQUAL (token モジュール):    token --- Python 解析木で使われる定数.
                                                             (line  320)
* doupdate() (curses モジュール):        関数<6>.            (line  104)
* down (pdb command):                    Debugger commands.  (line   93)
* down() (turtle モジュール):            描画状態.           (line    6)
* dpgettext() (gettext モジュール):      GNU gettext API.    (line   66)
* drain() (asyncio.StreamWriter のメソッド): StreamWriter.   (line   71)
* drive (pathlib.PurePath の属性):       メソッドとプロパティ.
                                                             (line   15)
* drop_whitespace (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  203)
* dropwhile() (itertools モジュール):    Itertool関数.       (line  266)
* dst() (datetime.datetime のメソッド):  datetime objects.   (line  544)
* dst() (datetime.time のメソッド):      time objects.       (line  258)
* dst() (datetime.timezone のメソッド):  timezone objects.   (line   57)
* dst() (datetime.tzinfo のメソッド):    tzinfo objects.     (line   66)
* DTDHandler (xml.sax.handler のクラス): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   24)
* duck-typing:                           用語集<2>.          (line  519)
* dump_c_stack() (faulthandler モジュール): Dumping the C stack.
                                                             (line    8)
* dump_stats() (profile.Profile のメソッド): profile and cProfile Module Reference.
                                                             (line  102)
* dump_stats() (pstats.Stats のメソッド): Stats クラス.      (line   53)
* dump_traceback_later() (faulthandler モジュール): タイムアウト後にtracebackをダンプする.
                                                             (line    6)
* dump_traceback() (faulthandler モジュール): tracebackのダンプ.
                                                             (line    6)
* dump() (ast モジュール):               ast helpers.        (line  269)
* dump() (json モジュール):              基本的な使い方<4>.  (line    6)
* dump() (marshal モジュール):           marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line   71)
* dump() (pickle モジュール):            モジュールインターフェース.
                                                             (line   39)
* dump() (pickle.Pickler のメソッド):    モジュールインターフェース.
                                                             (line  162)
* dump() (plistlib モジュール):          plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line   92)
* dump() (tracemalloc.Snapshot のメソッド): Snapshot.        (line   29)
* dump() (xml.etree.ElementTree モジュール): 関数<9>.        (line   85)
* dumps() (json モジュール):             基本的な使い方<4>.  (line   93)
* dumps() (marshal モジュール):          marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line  113)
* dumps() (pickle モジュール):           モジュールインターフェース.
                                                             (line   51)
* dumps() (plistlib モジュール):         plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line  129)
* dumps() (xmlrpc.client モジュール):    補助関数.           (line    6)
* dunder:                                用語集<2>.          (line  533)
* dup() (os モジュール):                 ファイル記述子の操作.
                                                             (line   93)
* dup() (socket.socket のメソッド):      socket オブジェクト.
                                                             (line  108)
* dup2() (os モジュール):                ファイル記述子の操作.
                                                             (line  106)
* DuplicateOptionError:                  例外<9>.            (line   24)
* DuplicateSectionError:                 例外<9>.            (line   14)
* dwFlags (subprocess.STARTUPINFO の属性): Windows Popen ヘルパー.
                                                             (line   20)
* DynamicClassAttribute() (types モジュール): 追加のユーティリティクラスと関数.
                                                             (line   55)
* e (cmath モジュール):                  定数<3>.            (line   10)
* e (math モジュール):                   定数<2>.            (line   10)
* e;in numeric literal:                  整数リテラル.       (line   65)
* E2BIG (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line   56)
* EACCES (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line   82)
* EADDRINUSE (errno モジュール):         errno --- 標準の errno システムシンボル.
                                                             (line  450)
* EADDRNOTAVAIL (errno モジュール):      errno --- 標準の errno システムシンボル.
                                                             (line  454)
* EADV (errno モジュール):               errno --- 標準の errno システムシンボル.
                                                             (line  313)
* EAFNOSUPPORT (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  445)
* EAFP:                                  用語集<2>.          (line  539)
* EAGAIN (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line   73)
* eager_task_factory() (asyncio モジュール): Eager Task Factory.
                                                             (line    6)
* EALREADY (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  529)
* east_asian_width() (unicodedata モジュール): unicodedata --- Unicode データベース.
                                                             (line  108)
* EAUTH (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  609)
* EBADARCH (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  615)
* EBADE (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  248)
* EBADEXEC (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  621)
* EBADF (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line   64)
* EBADFD (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  350)
* EBADMACHO (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  627)
* EBADMSG (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  337)
* EBADR (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  252)
* EBADRPC (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  693)
* EBADRQC (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  264)
* EBADSLT (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  268)
* EBFONT (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  277)
* EBUSY (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line   95)
* ECANCELED (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  720)
* ECHILD (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line   68)
* echo() (curses モジュール):            関数<6>.            (line  120)
* echochar() (curses.window のメソッド): Window オブジェクト.
                                                             (line  191)
* ECHRNG (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  215)
* ECOMM (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  321)
* ECONNABORTED (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  472)
* ECONNREFUSED (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  510)
* ECONNRESET (errno モジュール):         errno --- 標準の errno システムシンボル.
                                                             (line  477)
* EDEADLK (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  177)
* EDEADLOCK (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  272)
* EDESTADDRREQ (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  404)
* EDEVERR (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  633)
* edit() (curses.textpad.Textbox のメソッド): Textbox オブジェクト.
                                                             (line   20)
* EDOM (errno モジュール):               errno --- 標準の errno システムシンボル.
                                                             (line  167)
* EDOTDOT (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  333)
* EDQUOT (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  563)
* EEXIST (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line   99)
* EFAULT (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line   87)
* EFBIG (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  142)
* EFD_CLOEXEC (os モジュール):           ファイルとディレクトリ.
                                                             (line 1953)
* EFD_NONBLOCK (os モジュール):          ファイルとディレクトリ.
                                                             (line 1962)
* EFD_SEMAPHORE (os モジュール):         ファイルとディレクトリ.
                                                             (line 1971)
* effective() (bdb モジュール):          bdb --- デバッガーフレームワーク.
                                                             (line  517)
* EFTYPE (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  639)
* ehlo_or_helo_if_needed() (smtplib.SMTP のメソッド): SMTP オブジェクト.
                                                             (line   71)
* ehlo_resp (smtplib.SMTP の属性):       SMTP オブジェクト.  (line  348)
* ehlo() (smtplib.SMTP のメソッド):      SMTP オブジェクト.  (line   56)
* EHOSTDOWN (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  515)
* EHOSTUNREACH (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  519)
* EHWPOISON (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  523)
* EIDRM (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  211)
* EILSEQ (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  383)
* EINPROGRESS (errno モジュール):        errno --- 標準の errno システムシンボル.
                                                             (line  534)
* EINTR (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line   42)
* EINVAL (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  122)
* EIO (errno モジュール):                errno --- 標準の errno システムシンボル.
                                                             (line   47)
* EISCONN (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  486)
* EISDIR (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  117)
* EISNAM (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  555)
* EJECT (enum.FlagBoundary の属性):      データ型<2>.        (line  706)
* EKEYEXPIRED (errno モジュール):        errno --- 標準の errno システムシンボル.
                                                             (line  585)
* EKEYREJECTED (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  593)
* EKEYREVOKED (errno モジュール):        errno --- 標準の errno システムシンボル.
                                                             (line  589)
* EL2HLT (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  244)
* EL2NSYNC (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  219)
* EL3HLT (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  223)
* EL3RST (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  227)
* Element (xml.etree.ElementTree のクラス): Element オブジェクト.
                                                             (line    6)
* element_create() (tkinter.ttk.Style のメソッド): Ttk スタイル.
                                                             (line  133)
* element_names() (tkinter.ttk.Style のメソッド): Ttk スタイル.
                                                             (line  252)
* element_options() (tkinter.ttk.Style のメソッド): Ttk スタイル.
                                                             (line  256)
* ElementDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  284)
* elements() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line   65)
* ElementTree (xml.etree.ElementTree のクラス): ElementTree オブジェクト.
                                                             (line    6)
* ELIBACC (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  358)
* ELIBBAD (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  363)
* ELIBEXEC (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  378)
* ELIBMAX (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  373)
* ELIBSCN (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  368)
* ELLIPSIS (doctest モジュール):         オプションフラグ.   (line   46)
* ELLIPSIS (token モジュール):           token --- Python 解析木で使われる定数.
                                                             (line  338)
* Ellipsis (組み込み変数):               組み込み定数.       (line   60)
* EllipsisType (types モジュール):       標準的なインタプリタ型.
                                                             (line  143)
* ELNRNG (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  231)
* ELOCKUNMAPPED (errno モジュール):      errno --- 標準の errno システムシンボル.
                                                             (line  601)
* ELOOP (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  197)
* else;conditional expression:           条件式 Conditional Expressions.
                                                             (line    6)
* EM (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   99)
* EmailMessage (email.message のクラス): email message Representing an email message.
                                                             (line   52)
* EmailPolicy (email.policy のクラス):   email policy Policy Objects.
                                                             (line  358)
* Emax (decimal.Context の属性):         Context オブジェクト.
                                                             (line  142)
* EMEDIUMTYPE (errno モジュール):        errno --- 標準の errno システムシンボル.
                                                             (line  577)
* EMFILE (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  130)
* Emin (decimal.Context の属性):         Context オブジェクト.
                                                             (line  142)
* emit() (logging.FileHandler のメソッド): FileHandler.      (line   31)
* emit() (logging.Handler のメソッド):   ハンドラオブジェクト.
                                                             (line  111)
* emit() (logging.handlers.BufferingHandler のメソッド): MemoryHandler.
                                                             (line   24)
* emit() (logging.handlers.DatagramHandler のメソッド): DatagramHandler.
                                                             (line   29)
* emit() (logging.handlers.HTTPHandler のメソッド): HTTPHandler.
                                                             (line   35)
* emit() (logging.handlers.NTEventLogHandler のメソッド): NTEventLogHandler.
                                                             (line   36)
* emit() (logging.handlers.QueueHandler のメソッド): QueueHandler.
                                                             (line   43)
* emit() (logging.handlers.RotatingFileHandler のメソッド): RotatingFileHandler.
                                                             (line   48)
* emit() (logging.handlers.SMTPHandler のメソッド): SMTPHandler.
                                                             (line   33)
* emit() (logging.handlers.SocketHandler のメソッド): SocketHandler.
                                                             (line   24)
* emit() (logging.handlers.SysLogHandler のメソッド): SysLogHandler.
                                                             (line   68)
* emit() (logging.handlers.TimedRotatingFileHandler のメソッド): TimedRotatingFileHandler.
                                                             (line  106)
* emit() (logging.handlers.WatchedFileHandler のメソッド): WatchedFileHandler.
                                                             (line   50)
* emit() (logging.NullHandler のメソッド): NullHandler.      (line   16)
* emit() (logging.StreamHandler のメソッド): StreamHandler.  (line   18)
* EMLINK (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  158)
* Empty:                                 queue --- 同期キュークラス.
                                                             (line   76)
* empty (inspect.Parameter の属性):      Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  226)
* empty (inspect.Signature の属性):      Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  111)
* EMPTY_NAMESPACE (xml.dom モジュール):  モジュールコンテンツ<4>.
                                                             (line   34)
* empty() (asyncio.Queue のメソッド):    Queue.              (line   26)
* empty() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  119)
* empty() (multiprocessing.SimpleQueue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  240)
* empty() (queue.Queue のメソッド):      キューオブジェクト. (line   15)
* empty() (queue.SimpleQueue のメソッド): SimpleQueue オブジェクト.
                                                             (line   15)
* empty() (sched.scheduler のメソッド):  スケジューラオブジェクト.
                                                             (line   46)
* emptyline() (cmd.Cmd のメソッド):      Cmdオブジェクト.    (line   69)
* emscripten_version (sys._emscripten_info の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  342)
* EMSGSIZE (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  408)
* EMULTIHOP (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  329)
* enable (pdb command):                  Debugger commands.  (line  148)
* enable_callback_tracebacks() (sqlite3 モジュール): モジュール関数.
                                                             (line  125)
* enable_interspersed_args() (optparse.OptionParser のメソッド): オプション解析器への問い合わせと操作.
                                                             (line   32)
* enable_load_extension() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  435)
* enable_long_distance_matching (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  132)
* enable_traversal() (tkinter.ttk.Notebook のメソッド): ttk Notebook.
                                                             (line   74)
* ENABLE_USER_SITE (site モジュール):    モジュールの内容<5>.
                                                             (line   10)
* enable() (bdb.Breakpoint のメソッド):  bdb --- デバッガーフレームワーク.
                                                             (line   49)
* enable() (faulthandler モジュール):    フォールトハンドラの状態.
                                                             (line    6)
* enable() (gc モジュール):              gc --- ガベージコレクターインターフェース.
                                                             (line   21)
* enable() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line   84)
* enable() (profile.Profile のメソッド): profile and cProfile Module Reference.
                                                             (line   76)
* EnableControlFlowGuard:                ビルド<42>.         (line   47)
* enabled (bdb.Breakpoint の属性):       bdb --- デバッガーフレームワーク.
                                                             (line  107)
* EnableReflectionKey() (winreg モジュール): 関数<14>.       (line  495)
* ENAMETOOLONG (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  181)
* ENAVAIL (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  551)
* enclose() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  196)
* encode (codecs.CodecInfo の属性):      codecs --- codec レジストリと基底クラス.
                                                             (line   79)
* encode_7or8bit() (email.encoders モジュール): email encoders エンコーダー.
                                                             (line   58)
* encode_base64() (email.encoders モジュール): email encoders エンコーダー.
                                                             (line   49)
* encode_noop() (email.encoders モジュール): email encoders エンコーダー.
                                                             (line   64)
* encode_quopri() (email.encoders モジュール): email encoders エンコーダー.
                                                             (line   41)
* encode_rfc2231() (email.utils モジュール): email utils Miscellaneous utilities.
                                                             (line  191)
* encode() (base64 モジュール):          レガシーインターフェース.
                                                             (line   21)
* encode() (codecs モジュール):          codecs --- codec レジストリと基底クラス.
                                                             (line   23)
* encode() (codecs.Codec のメソッド):    ステートレスなエンコードとデコード.
                                                             (line   12)
* encode() (codecs.IncrementalEncoder のメソッド): IncrementalEncoder オブジェクト.
                                                             (line   28)
* encode() (email.header.Header のメソッド): email header 国際化されたヘッダー.
                                                             (line  121)
* encode() (json.JSONEncoder のメソッド): エンコーダとデコーダ.
                                                             (line  224)
* encode() (quopri モジュール):          quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line   30)
* encode() (str のメソッド):             文字列メソッド<2>.  (line   87)
* encode() (xmlrpc.client.Binary のメソッド): Binary オブジェクト.
                                                             (line   24)
* encode() (xmlrpc.client.DateTime のメソッド): DateTime オブジェクト.
                                                             (line   18)
* encodebytes() (base64 モジュール):     レガシーインターフェース.
                                                             (line   31)
* EncodedFile() (codecs モジュール):     codecs --- codec レジストリと基底クラス.
                                                             (line  217)
* encodePriority() (logging.handlers.SysLogHandler のメソッド): SysLogHandler.
                                                             (line  100)
* encodestring() (quopri モジュール):    quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line   47)
* encoding (curses.window の属性):       Window オブジェクト.
                                                             (line  206)
* encoding (io.TextIOBase の属性):       テキスト I/O<2>.    (line   15)
* ENCODING (tarfile モジュール):         tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  324)
* ENCODING (token モジュール):           token --- Python 解析木で使われる定数.
                                                             (line  153)
* encoding (UnicodeError の属性):        具象例外.           (line  434)
* encoding declarations (source file):   エンコード宣言 encoding declaration.
                                                             (line    6)
* encodings_map (mimetypes モジュール):  mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  153)
* encodings_map (mimetypes.MimeTypes の属性): MimeTypes objects.
                                                             (line   32)
* EncodingWarning:                       警告.               (line   71)
* end (UnicodeError の属性):             具象例外.           (line  455)
* END_ASYNC_FOR (opcode):                Python バイトコード命令.
                                                             (line  346)
* end_col_offset (ast.AST の属性):       Node クラス.        (line   49)
* end_colno (traceback.FrameSummary の属性): FrameSummary オブジェクト.
                                                             (line   62)
* end_fill() (turtle モジュール):        塗りつぶし.         (line   39)
* END_FOR (opcode):                      Python バイトコード命令.
                                                             (line  158)
* end_headers() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  323)
* end_lineno (ast.AST の属性):           Node クラス.        (line   49)
* end_lineno (SyntaxError の属性):       具象例外.           (line  330)
* end_lineno (traceback.FrameSummary の属性): FrameSummary オブジェクト.
                                                             (line   49)
* end_lineno (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   97)
* end_ns() (xml.etree.ElementTree.TreeBuilder のメソッド): TreeBuilder オブジェクト.
                                                             (line   84)
* end_offset (SyntaxError の属性):       具象例外.           (line  335)
* end_offset (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line  112)
* end_poly() (turtle モジュール):        特別な Turtle のメソッド.
                                                             (line   23)
* END_SEND (opcode):                     Python バイトコード命令.
                                                             (line  165)
* end() (re.Match のメソッド):           マッチオブジェクト. (line  140)
* end() (xml.etree.ElementTree.TreeBuilder のメソッド): TreeBuilder オブジェクト.
                                                             (line   37)
* endCDATA() (xml.sax.handler.LexicalHandler のメソッド): LexicalHandler Objects.
                                                             (line   39)
* EndCdataSectionHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  388)
* EndDoctypeDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  279)
* endDocument() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line   38)
* endDTD() (xml.sax.handler.LexicalHandler のメソッド): LexicalHandler Objects.
                                                             (line   28)
* endElement() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line   89)
* EndElementHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  310)
* endElementNS() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line  114)
* endheaders() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  191)
* ENDMARKER (token モジュール):          token --- Python 解析木で使われる定数.
                                                             (line  148)
* EndNamespaceDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  368)
* endpos (re.Match の属性):              マッチオブジェクト. (line  177)
* endPrefixMapping() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line   68)
* endswith() (bytearray のメソッド):     bytes と bytearray の操作.
                                                             (line  122)
* endswith() (bytes のメソッド):         bytes と bytearray の操作.
                                                             (line  122)
* endswith() (str のメソッド):           文字列メソッド<2>.  (line  118)
* endwin() (curses モジュール):          関数<6>.            (line  125)
* ENEEDAUTH (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  645)
* ENETDOWN (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  459)
* ENETRESET (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  467)
* ENETUNREACH (errno モジュール):        errno --- 標準の errno システムシンボル.
                                                             (line  463)
* ENFILE (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  126)
* ENOANO (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  260)
* ENOATTR (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  651)
* ENOBUFS (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  482)
* ENOCSI (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  240)
* ENODATA (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  285)
* ENODEV (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  108)
* ENOENT (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line   32)
* ENOEXEC (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line   60)
* ENOKEY (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  581)
* ENOLCK (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  185)
* ENOLINK (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  309)
* ENOMEDIUM (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  573)
* ENOMEM (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line   78)
* ENOMSG (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  207)
* ENONET (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  297)
* ENOPKG (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  301)
* ENOPOLICY (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  657)
* ENOPROTOOPT (errno モジュール):        errno --- 標準の errno システムシンボル.
                                                             (line  417)
* ENOSPC (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  146)
* ENOSR (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  293)
* ENOSTR (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  281)
* ENOSYS (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  189)
* ENOTACTIVE (errno モジュール):         errno --- 標準の errno システムシンボル.
                                                             (line  605)
* ENOTBLK (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line   91)
* ENOTCAPABLE (errno モジュール):        errno --- 標準の errno システムシンボル.
                                                             (line  711)
* ENOTCONN (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  491)
* ENOTDIR (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  112)
* ENOTEMPTY (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  193)
* ENOTNAM (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  547)
* ENOTRECOVERABLE (errno モジュール):    errno --- 標準の errno システムシンボル.
                                                             (line  732)
* ENOTSOCK (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  400)
* ENOTSUP (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  434)
* ENOTTY (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  134)
* ENOTUNIQ (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  346)
* ENQ (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   33)
* enqueue_sentinel() (logging.handlers.QueueListener のメソッド): QueueListener.
                                                             (line  101)
* enqueue() (logging.handlers.QueueHandler のメソッド): QueueHandler.
                                                             (line   89)
* ensure_directories() (venv.EnvBuilder のメソッド): API<2>. (line   86)
* ensure_future() (asyncio モジュール):  Future の関数.      (line   19)
* ensurepip コマンドラインオプション; -altinstall: コマンドライン・インターフェース<9>.
                                                             (line   40)
* ensurepip コマンドラインオプション; -default-pip: コマンドライン・インターフェース<9>.
                                                             (line   45)
* ensurepip コマンドラインオプション; -root: コマンドライン・インターフェース<9>.
                                                             (line   24)
* ensurepip コマンドラインオプション; -user: コマンドライン・インターフェース<9>.
                                                             (line   30)
* enter_async_context() (contextlib.AsyncExitStack のメソッド): ユーティリティ.
                                                             (line  631)
* enter_context() (contextlib.ExitStack のメソッド): ユーティリティ.
                                                             (line  549)
* enter() (sched.scheduler のメソッド):  スケジューラオブジェクト.
                                                             (line   29)
* enterabs() (sched.scheduler のメソッド): スケジューラオブジェクト.
                                                             (line    8)
* enterAsyncContext() (unittest.IsolatedAsyncioTestCase のメソッド): テストクラス.
                                                             (line  954)
* enterClassContext() (unittest.TestCase のクラスメソッド): テストクラス.
                                                             (line  887)
* enterContext() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  847)
* enterModuleContext() (unittest モジュール): setUpModule と tearDownModule.
                                                             (line   36)
* entities (xml.dom.DocumentType の属性): DocumentType オブジェクト.
                                                             (line   38)
* EntityDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  339)
* entitydefs (html.entities モジュール): html entities --- HTML 一般実体の定義.
                                                             (line   24)
* EntityResolver (xml.sax.handler のクラス): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   31)
* entry_points() (importlib.metadata モジュール): エントリポイント.
                                                             (line    6)
* EntryPoint (importlib.metadata のクラス): エントリポイント.
                                                             (line   26)
* EntryPoints (importlib.metadata のクラス): エントリポイント.
                                                             (line   18)
* Enum (enum のクラス):                  データ型<2>.        (line  119)
* enum_certificates() (ssl モジュール):  証明書の取り扱い.   (line   86)
* enum_crls() (ssl モジュール):          証明書の取り扱い.   (line  109)
* EnumCheck (enum のクラス):             データ型<2>.        (line  610)
* EnumDict (enum のクラス):              データ型<2>.        (line  737)
* enumerate() (threading モジュール):    リファレンス<2>.    (line   96)
* EnumKey() (winreg モジュール):         関数<14>.           (line  171)
* EnumType (enum のクラス):              データ型<2>.        (line    6)
* EnumValue() (winreg モジュール):       関数<14>.           (line  189)
* EnvBuilder (venv のクラス):            API<2>.             (line   10)
* environ (os モジュール):               プロセスのパラメーター.
                                                             (line   15)
* environ (posix モジュール):            注目すべきモジュールの内容.
                                                             (line    9)
* environb (os モジュール):              プロセスのパラメーター.
                                                             (line   63)
* EnvironmentError:                      具象例外.           (line  492)
* EnvironmentVarGuard (test.support.os_helper のクラス): test support os_helper --- Utilities for os tests.
                                                             (line   48)
* ENXIO (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line   51)
* eof (bz2.BZ2Decompressor の属性):      逐次圧縮および展開. (line   72)
* eof (compression.zstd.ZstdDecompressor の属性): メモリ上での圧縮と展開.
                                                             (line  208)
* eof (lzma.LZMADecompressor の属性):    メモリ上での圧縮と展開<2>.
                                                             (line  154)
* eof (shlex.shlex の属性):              shlex オブジェクト. (line  177)
* eof (ssl.MemoryBIO の属性):            メモリ BIO サポート<2>.
                                                             (line  141)
* eof (zlib.Decompress の属性):          zlib --- gzip 互換の圧縮.
                                                             (line  250)
* eof_received() (asyncio.BufferedProtocol のメソッド): バッファリングされたストリーミングプロトコル.
                                                             (line   40)
* eof_received() (asyncio.Protocol のメソッド): ストリーミングプロトコル.
                                                             (line   30)
* EOFError:                              具象例外.           (line   32)
* EOFError (組み込み例外):               ファイルオブジェクト.
                                                             (line   42)
* EOPNOTSUPP (errno モジュール):         errno --- 標準の errno システムシンボル.
                                                             (line  429)
* EOT (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   30)
* EOVERFLOW (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  341)
* EOWNERDEAD (errno モジュール):         errno --- 標準の errno システムシンボル.
                                                             (line  726)
* EPERM (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line   27)
* EPFNOSUPPORT (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  440)
* epilogue (email.message.EmailMessage の属性): email message Representing an email message.
                                                             (line  706)
* epilogue (email.message.Message の属性): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  725)
* EPIPE (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  162)
* epoll() (select モジュール):           select --- I/O 完了の待機.
                                                             (line   55)
* EpollSelector (selectors のクラス):    クラス<4>.          (line  178)
* EPROCLIM (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  663)
* EPROCUNAVAIL (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  669)
* EPROGMISMATCH (errno モジュール):      errno --- 標準の errno システムシンボル.
                                                             (line  675)
* EPROGUNAVAIL (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  681)
* EPROTO (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  325)
* EPROTONOSUPPORT (errno モジュール):    errno --- 標準の errno システムシンボル.
                                                             (line  421)
* EPROTOTYPE (errno モジュール):         errno --- 標準の errno システムシンボル.
                                                             (line  412)
* epsilon (sys.float_info の属性):       sys --- システム固有のパラメーターと関数.
                                                             (line  638)
* EPWROFF (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  687)
* Eq (ast のクラス):                     式 expression<2>.   (line  110)
* eq() (operator モジュール):            operator --- 関数形式の標準演算子.
                                                             (line   24)
* EQEQUAL (token モジュール):            token --- Python 解析木で使われる定数.
                                                             (line  263)
* EQFULL (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  567)
* EQUAL (token モジュール):              token --- Python 解析木で使われる定数.
                                                             (line  248)
* ERA (locale モジュール):               locale --- 国際化サービス.
                                                             (line  301)
* ERA_D_FMT (locale モジュール):         locale --- 国際化サービス.
                                                             (line  323)
* ERA_D_T_FMT (locale モジュール):       locale --- 国際化サービス.
                                                             (line  317)
* ERA_T_FMT (locale モジュール):         locale --- 国際化サービス.
                                                             (line  329)
* ERANGE (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  172)
* erase() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  216)
* erasechar() (curses モジュール):       関数<6>.            (line  129)
* EREMCHG (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  354)
* EREMOTE (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  305)
* EREMOTEIO (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  559)
* ERESTART (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  387)
* erf() (math モジュール):               特殊関数.           (line    6)
* erfc() (math モジュール):              特殊関数.           (line   20)
* ERFKILL (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  597)
* EROFS (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  154)
* ERPCMISMATCH (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  699)
* ERR (curses モジュール):               定数<6>.            (line    8)
* errcheck (ctypes._CFuncPtr の属性):    外部関数.           (line   67)
* errcode (xmlrpc.client.ProtocolError の属性): ProtocolError オブジェクト.
                                                             (line   16)
* errmsg (xmlrpc.client.ProtocolError の属性): ProtocolError オブジェクト.
                                                             (line   20)
* errno (OSError の属性):                具象例外.           (line  168)
* error:                                 関数と例外.         (line    8)
* Error:                                 copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   34)
* Error <1>:                             ディレクトリとファイルの操作.
                                                             (line  494)
* error <1>:                             dbm --- Unix "データベース" へのインターフェース.
                                                             (line   22)
* error <2>:                             dbm gnu --- GNU database manager.
                                                             (line   24)
* error <3>:                             dbm ndbm --- New Database Manager.
                                                             (line   30)
* error <4>:                             dbm dumb --- Portable DBM implementation.
                                                             (line   21)
* Error <2>:                             例外<7>.            (line   15)
* error <5>:                             zlib --- gzip 互換の圧縮.
                                                             (line   26)
* Error <3>:                             モジュールコンテンツ<3>.
                                                             (line  333)
* Error <4>:                             例外<9>.            (line    6)
* error <6>:                             os --- 雑多なオペレーティングシステムインターフェース.
                                                             (line   50)
* error <7>:                             関数<6>.            (line    8)
* error <8>:                             _thread --- 低水準なスレッド API.
                                                             (line   20)
* error <9>:                             例外<18>.           (line    6)
* error <10>:                            select --- I/O 完了の待機.
                                                             (line   30)
* Error <5>:                             例外<21>.           (line    8)
* Error <6>:                             binascii --- バイナリ と ASCII 間の変換.
                                                             (line  157)
* error <11>:                            xml parsers expat --- Expat を使用した高速な XML 解析.
                                                             (line   31)
* Error <7>:                             コマンドライン・インターフェース<6>.
                                                             (line   26)
* Error <8>:                             wave --- WAV ファイルの読み書き.
                                                             (line   53)
* Error <9>:                             locale --- 国際化サービス.
                                                             (line   21)
* error <12>:                            resource --- リソース使用情報.
                                                             (line   18)
* error <13>:                            getopt --- C-style parser for command line options.
                                                             (line  105)
* ERROR (logging モジュール):            ロギングレベル.     (line   40)
* ERROR (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  192)
* error_body (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  261)
* error_content_type (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  205)
* error_headers (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  254)
* error_leader() (shlex.shlex のメソッド): shlex オブジェクト.
                                                             (line   69)
* error_message_format (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  197)
* error_output() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line  225)
* error_perm:                            モジュール変数.     (line   15)
* error_proto:                           モジュール変数.     (line   20)
* error_proto <1>:                       poplib --- POP3 プロトコルクライアント.
                                                             (line   88)
* error_received() (asyncio.DatagramProtocol のメソッド): データグラムプロトコル.
                                                             (line   16)
* error_reply:                           モジュール変数.     (line    6)
* error_status (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  248)
* error_temp:                            モジュール変数.     (line   10)
* error() (argparse.ArgumentParser のメソッド): 終了メソッド.
                                                             (line   19)
* error() (logging モジュール):          モジュールレベルの関数.
                                                             (line   77)
* error() (logging.Logger のメソッド):   ロガーオブジェクト. (line  292)
* error() (urllib.request.OpenerDirector のメソッド): OpenerDirector オブジェクト.
                                                             (line   59)
* error() (xml.sax.handler.ErrorHandler のメソッド): ErrorHandler オブジェクト.
                                                             (line   16)
* ErrorByteIndex (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  217)
* errorcode (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line   13)
* ErrorCode (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  221)
* ErrorColumnNumber (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  227)
* ErrorHandler (xml.sax.handler のクラス): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   37)
* errorlevel (tarfile.TarFile の属性):   TarFile オブジェクト.
                                                             (line  228)
* ErrorLineNumber (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  231)
* errors (io.TextIOBase の属性):         テキスト I/O<2>.    (line   20)
* errors (unittest.TestLoader の属性):   テストのロードと起動.
                                                             (line   17)
* errors (unittest.TestResult の属性):   テストのロードと起動.
                                                             (line  243)
* ErrorStream (wsgiref.types のクラス):  wsgiref types -- WSGI types for static type checking.
                                                             (line   28)
* ErrorString() (xml.parsers.expat モジュール): xml parsers expat --- Expat を使用した高速な XML 解析.
                                                             (line   41)
* ERRORTOKEN (token モジュール):         token --- Python 解析木で使われる定数.
                                                             (line  186)
* ESC (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  105)
* escape (shlex.shlex の属性):           shlex オブジェクト. (line  109)
* escape() (glob モジュール):            glob --- Unix 形式のパス名のパターン展開.
                                                             (line  107)
* escape() (html モジュール):            html --- HyperText Markup Language のサポート.
                                                             (line   12)
* escape() (re モジュール):              関数<2>.            (line  250)
* escape() (xml.sax.saxutils モジュール): xml sax saxutils --- SAX ユーティリティー.
                                                             (line   14)
* escapechar (csv.Dialect の属性):       Dialect クラスと書式化パラメータ.
                                                             (line   36)
* escapedquotes (shlex.shlex の属性):    shlex オブジェクト. (line  121)
* ESHLIBVERS (errno モジュール):         errno --- 標準の errno システムシンボル.
                                                             (line  705)
* ESHUTDOWN (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  495)
* esmtp_features (smtplib.SMTP の属性):  SMTP オブジェクト.  (line  357)
* ESOCKTNOSUPPORT (errno モジュール):    errno --- 標準の errno システムシンボル.
                                                             (line  425)
* ESPIPE (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  150)
* ESRCH (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line   37)
* ESRMNT (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  317)
* ESTALE (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  539)
* ESTRPIPE (errno モジュール):           errno --- 標準の errno システムシンボル.
                                                             (line  392)
* ETB (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   93)
* ETH_P_ALL (socket モジュール):         定数<8>.            (line  231)
* ETHERTYPE_ARP (socket モジュール):     定数<8>.            (line  465)
* ETHERTYPE_IP (socket モジュール):      定数<8>.            (line  465)
* ETHERTYPE_IPV6 (socket モジュール):    定数<8>.            (line  465)
* ETHERTYPE_VLAN (socket モジュール):    定数<8>.            (line  465)
* ETIME (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  289)
* ETIMEDOUT (errno モジュール):          errno --- 標準の errno システムシンボル.
                                                             (line  505)
* Etiny() (decimal.Context のメソッド):  Context オブジェクト.
                                                             (line  248)
* ETOOMANYREFS (errno モジュール):       errno --- 標準の errno システムシンボル.
                                                             (line  500)
* Etop() (decimal.Context のメソッド):   Context オブジェクト.
                                                             (line  254)
* ETX (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   27)
* ETXTBSY (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  138)
* EUCLEAN (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  543)
* EUNATCH (errno モジュール):            errno --- 標準の errno システムシンボル.
                                                             (line  235)
* EUSERS (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  396)
* evaluate function:                     用語集<2>.          (line  550)
* evaluate_bound() (typing.TypeVar のメソッド): Building generic types and type aliases.
                                                             (line  184)
* evaluate_constraints() (typing.TypeVar のメソッド): Building generic types and type aliases.
                                                             (line  206)
* evaluate_default() (typing.ParamSpec のメソッド): Building generic types and type aliases.
                                                             (line  482)
* evaluate_default() (typing.TypeVar のメソッド): Building generic types and type aliases.
                                                             (line  225)
* evaluate_default() (typing.TypeVarTuple のメソッド): Building generic types and type aliases.
                                                             (line  369)
* evaluate_forward_ref() (typing モジュール): Introspection helpers.
                                                             (line  174)
* evaluate_value() (typing.TypeAliasType のメソッド): Building generic types and type aliases.
                                                             (line  610)
* evaluate() (annotationlib.ForwardRef のメソッド): クラス<5>.
                                                             (line   65)
* Event (asyncio のクラス):              Event.              (line    6)
* Event (multiprocessing のクラス):      同期プリミティブ.   (line   58)
* Event (threading のクラス):            Event objects.      (line   14)
* EVENT_READ (selectors モジュール):     クラス<4>.          (line   23)
* EVENT_WRITE (selectors モジュール):    クラス<4>.          (line   26)
* Event() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  186)
* eventfd_read() (os モジュール):        ファイルとディレクトリ.
                                                             (line 1933)
* eventfd_write() (os モジュール):       ファイルとディレクトリ.
                                                             (line 1943)
* eventfd() (os モジュール):             ファイルとディレクトリ.
                                                             (line 1880)
* EventLoop (asyncio のクラス):          イベントループの実装.
                                                             (line   42)
* events (selectors.SelectorKey の属性): クラス<4>.          (line   44)
* events (widgets):                      バインドとイベント. (line    6)
* EWOULDBLOCK (errno モジュール):        errno --- 標準の errno システムシンボル.
                                                             (line  202)
* EX_CANTCREAT (os モジュール):          プロセス管理.       (line  208)
* EX_CONFIG (os モジュール):             プロセス管理.       (line  243)
* EX_DATAERR (os モジュール):            プロセス管理.       (line  157)
* EX_IOERR (os モジュール):              プロセス管理.       (line  215)
* EX_NOHOST (os モジュール):             プロセス管理.       (line  176)
* EX_NOINPUT (os モジュール):            プロセス管理.       (line  163)
* EX_NOPERM (os モジュール):             プロセス管理.       (line  236)
* EX_NOTFOUND (os モジュール):           プロセス管理.       (line  249)
* EX_NOUSER (os モジュール):             プロセス管理.       (line  170)
* EX_OK (os モジュール):                 プロセス管理.       (line  142)
* EX_OSERR (os モジュール):              プロセス管理.       (line  194)
* EX_OSFILE (os モジュール):             プロセス管理.       (line  201)
* EX_PROTOCOL (os モジュール):           プロセス管理.       (line  229)
* EX_SOFTWARE (os モジュール):           プロセス管理.       (line  188)
* EX_TEMPFAIL (os モジュール):           プロセス管理.       (line  221)
* EX_UNAVAILABLE (os モジュール):        プロセス管理.       (line  182)
* EX_USAGE (os モジュール):              プロセス管理.       (line  150)
* EXACT_TOKEN_TYPES (token モジュール):  token --- Python 解析木で使われる定数.
                                                             (line  353)
* Example (doctest のクラス):            Example オブジェクト.
                                                             (line    6)
* example (doctest.DocTestFailure の属性): デバッグ.         (line  195)
* example (doctest.UnexpectedException の属性): デバッグ.    (line  216)
* examples (doctest.DocTest の属性):     DocTest オブジェクト.
                                                             (line   16)
* exc_info (doctest.UnexpectedException の属性): デバッグ.   (line  220)
* exc_info (sys モジュール):             トレースバック traceback オブジェクト.
                                                             (line    6)
* exc_info (sys モジュール) <1>:         例外<24>.           (line   45)
* exc_info() (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line  439)
* exc_msg (doctest.Example の属性):      Example オブジェクト.
                                                             (line   30)
* exc_type (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   77)
* exc_type_str (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   83)
* excel (csv のクラス):                  モジュールコンテンツ<3>.
                                                             (line  203)
* excel_tab (csv のクラス):              モジュールコンテンツ<3>.
                                                             (line  209)
* ExceptHandler (ast のクラス):          制御フロー.         (line  201)
* excepthook() (sys モジュール):         sys --- システム固有のパラメーターと関数.
                                                             (line  385)
* excepthook() (threading モジュール):   リファレンス<2>.    (line   24)
* Exception:                             基底クラス.         (line   63)
* EXCEPTION (_tkinter モジュール):       ファイルハンドラ.   (line   42)
* EXCEPTION_HANDLED (monitoring event):  Events.             (line   35)
* exception() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line  128)
* exception() (asyncio.Task のメソッド): Task オブジェクト.  (line   88)
* exception() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   52)
* exception() (logging モジュール):      モジュールレベルの関数.
                                                             (line   89)
* exception() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  308)
* exception() (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line  427)
* ExceptionGroup:                        例外グループ.       (line   11)
* exceptions (BaseExceptionGroup の属性): 例外グループ.      (line   34)
* exceptions (pdb command):              Debugger commands.  (line  459)
* exceptions (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   52)
* excinfo (concurrent.interpreters.ExecutionFailed の属性): 例外<13>.
                                                             (line   21)
* EXCLAMATION (token モジュール):        token --- Python 解析木で使われる定数.
                                                             (line  344)
* EXDEV (errno モジュール):              errno --- 標準の errno システムシンボル.
                                                             (line  104)
* exec_module() (importlib.abc.InspectLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  263)
* exec_module() (importlib.abc.Loader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  115)
* exec_module() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  403)
* exec_module() (importlib.machinery.ExtensionFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  317)
* exec_module() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   31)
* exec_prefix (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line  459)
* exec() (concurrent.interpreters.Interpreter のメソッド): Interpreter objects.
                                                             (line   43)
* execl() (os モジュール):               プロセス管理.       (line   53)
* execle() (os モジュール):              プロセス管理.       (line   53)
* execlp() (os モジュール):              プロセス管理.       (line   53)
* execlpe() (os モジュール):             プロセス管理.       (line   53)
* executable (in module sys):            プロセスワイドのパラメータ.
                                                             (line  120)
* executable (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line  483)
* Executable Zip Files:                  zipapp --- 実行可能な Python zip アーカイブを管理する.
                                                             (line   10)
* execute() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  100)
* execute() (sqlite3.Cursor のメソッド): Cursor オブジェクト.
                                                             (line   24)
* executemany() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  106)
* executemany() (sqlite3.Cursor のメソッド): Cursor オブジェクト.
                                                             (line   60)
* executescript() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  112)
* executescript() (sqlite3.Cursor のメソッド): Cursor オブジェクト.
                                                             (line  102)
* ExecutionFailed:                       例外<13>.           (line   16)
* ExecutionLoader (importlib.abc のクラス): importlib abc -- Abstract base classes related to import.
                                                             (line  276)
* Executor (concurrent.futures のクラス): Executor オブジェクト.
                                                             (line    6)
* execv() (os モジュール):               プロセス管理.       (line   53)
* execve() (os モジュール):              プロセス管理.       (line   53)
* execvp() (os モジュール):              プロセス管理.       (line   53)
* execvpe() (os モジュール):             プロセス管理.       (line   53)
* EXFULL (errno モジュール):             errno --- 標準の errno システムシンボル.
                                                             (line  256)
* exists() (os.path モジュール):         os path --- 一般的なパス名操作.
                                                             (line  119)
* exists() (pathlib.Path のメソッド):    ファイルの種類とステータスを問い合わせる.
                                                             (line   45)
* exists() (pathlib.types.PathInfo のメソッド): プロトコル.  (line   16)
* exists() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line   90)
* exists() (zipfile.Path のメソッド):    Path objects.       (line   74)
* exit (C function):                     プロセス制御.       (line   23)
* exit (組み込み変数):                   site モジュールで追加される定数.
                                                             (line   11)
* exit() (_thread モジュール):           _thread --- 低水準なスレッド API.
                                                             (line   76)
* exit() (argparse.ArgumentParser のメソッド): 終了メソッド. (line    6)
* exit() (sys モジュール):               sys --- システム固有のパラメーターと関数.
                                                             (line  490)
* exitcode (multiprocessing.Process の属性): Process クラスと例外.
                                                             (line  160)
* exitonclick() (turtle モジュール):     Screen 独自のメソッド、TurtleScreen から継承したもの以外.
                                                             (line   10)
* ExitStack (contextlib のクラス):       ユーティリティ.     (line  510)
* exp() (cmath モジュール):              指数関数と対数関数. (line    6)
* exp() (decimal.Context のメソッド):    Context オブジェクト.
                                                             (line  318)
* exp() (decimal.Decimal のメソッド):    Decimal オブジェクト.
                                                             (line  224)
* exp() (math モジュール):               Power exponential and logarithmic functions.
                                                             (line   12)
* exp2() (math モジュール):              Power exponential and logarithmic functions.
                                                             (line   18)
* expand_tabs (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  172)
* expand() (re.Match のメソッド):        マッチオブジェクト. (line   22)
* ExpandEnvironmentStrings() (winreg モジュール): 関数<14>.  (line  226)
* expandNode() (xml.dom.pulldom.DOMEventStream のメソッド): DOMEventStream オブジェクト.
                                                             (line   20)
* expandtabs() (bytearray のメソッド):   bytes と bytearray の操作.
                                                             (line  481)
* expandtabs() (bytes のメソッド):       bytes と bytearray の操作.
                                                             (line  481)
* expandtabs() (str のメソッド):         文字列メソッド<2>.  (line  138)
* expanduser() (os.path モジュール):     os path --- 一般的なパス名操作.
                                                             (line  143)
* expanduser() (pathlib.Path のメソッド): パスの展開と解決.  (line   18)
* expandvars() (os.path モジュール):     os path --- 一般的なパス名操作.
                                                             (line  169)
* Expat:                                 xml parsers expat --- Expat を使用した高速な XML 解析.
                                                             (line   11)
* ExpatError:                            xml parsers expat --- Expat を使用した高速な XML 解析.
                                                             (line   25)
* expected (asyncio.IncompleteReadError の属性): 例外<16>.   (line   53)
* expectedFailure() (unittest モジュール): テストのスキップと予期された失敗.
                                                             (line   99)
* expectedFailures (unittest.TestResult の属性): テストのロードと起動.
                                                             (line  263)
* expired() (asyncio.Timeout のメソッド): タイムアウト.      (line   76)
* expires (http.cookiejar.Cookie の属性): Cookieオブジェクト<2>.
                                                             (line   53)
* expires (http.cookies.Morsel の属性):  Morselオブジェクト. (line   13)
* exploded (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line   62)
* exploded (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line  109)
* exploded (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  259)
* exploded (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  323)
* expm1() (math モジュール):             Power exponential and logarithmic functions.
                                                             (line   24)
* expovariate() (random モジュール):     実数分布.           (line   34)
* Expr (ast のクラス):                   式 expression<2>.   (line    6)
* expression:                            式 expression.      (line    6)
* expression <1>:                        用語集<2>.          (line  556)
* Expression (ast のクラス):             Root nodes.         (line   26)
* expression (string.templatelib.Interpolation の属性): 型.  (line  221)
* expression;list:                       式のリスト.         (line    6)
* expression;list <1>:                   式文 expression statement.
                                                             (line    6)
* expression;list <2>:                   式文 expression statement.
                                                             (line    6)
* expression;statement:                  式文 expression statement.
                                                             (line    6)
* expunge() (imaplib.IMAP4 のメソッド):  IMAP4 オブジェクト. (line   93)
* extend_path() (pkgutil モジュール):    pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line   19)
* extend() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  160)
* extend() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   59)
* extend() (sequence のメソッド):        ミュータブルなシーケンス型.
                                                             (line   92)
* extend() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   89)
* EXTENDED_ARG (opcode):                 Python バイトコード命令.
                                                             (line 1206)
* ExtendedContext (decimal モジュール):  Context オブジェクト.
                                                             (line   82)
* ExtendedInterpolation (configparser のクラス): 値の補間.   (line   39)
* extendleft() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   64)
* extension module:                      用語集<2>.          (line  565)
* EXTENSION_SUFFIXES (importlib.machinery モジュール): importlib machinery -- Importers and path hooks.
                                                             (line   48)
* ExtensionFileLoader (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line  285)
* extensions_map (http.server.SimpleHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  412)
* external_attr (zipfile.ZipInfo の属性): ZipInfo objects.   (line  143)
* ExternalClashError:                    例外<21>.           (line   26)
* ExternalEntityParserCreate() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line   43)
* ExternalEntityRefHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  414)
* extra (zipfile.ZipInfo の属性):        ZipInfo objects.    (line  109)
* extract_cookies() (http.cookiejar.CookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line   32)
* extract_stack() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line   92)
* extract_tb() (traceback モジュール):   モジュールレベルの関数<2>.
                                                             (line   80)
* extract_version (zipfile.ZipInfo の属性): ZipInfo objects. (line  123)
* extract() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  181)
* extract() (traceback.StackSummary のクラスメソッド): StackSummary オブジェクト.
                                                             (line   13)
* extract() (zipfile.ZipFile のメソッド): ZipFile objects.   (line  196)
* extractall() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  141)
* extractall() (zipfile.ZipFile のメソッド): ZipFile objects.
                                                             (line  224)
* ExtractError:                          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  270)
* extractfile() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  212)
* extraction_filter (tarfile.TarFile の属性): TarFile オブジェクト.
                                                             (line  248)
* extsep (os モジュール):                雑多なシステム情報. (line  130)
* f_back (frame の属性):                 Special read-only attributes<3>.
                                                             (line    6)
* f_back (フレーム属性):                 フレーム frame オブジェクト.
                                                             (line   10)
* f_builtins (frame の属性):             Special read-only attributes<3>.
                                                             (line   29)
* f_builtins (フレーム属性):             フレーム frame オブジェクト.
                                                             (line   10)
* f_code (frame の属性):                 Special read-only attributes<3>.
                                                             (line   10)
* f_code (フレーム属性):                 フレーム frame オブジェクト.
                                                             (line   10)
* F_CONTIGUOUS (inspect.BufferFlags の属性): Buffer flags.   (line   27)
* f_contiguous (memoryview の属性):      メモリビュー.       (line  510)
* f_generator (frame attribute):         フレーム frame オブジェクト.
                                                             (line   10)
* f_generator (frame の属性):            Special read-only attributes<3>.
                                                             (line   38)
* f_globals (frame の属性):              Special read-only attributes<3>.
                                                             (line   25)
* f_globals (フレーム属性):              フレーム frame オブジェクト.
                                                             (line   10)
* f_lasti (frame の属性):                Special read-only attributes<3>.
                                                             (line   33)
* f_lasti (フレーム属性):                フレーム frame オブジェクト.
                                                             (line   10)
* f_lineno (frame の属性):               Special writable attributes<2>.
                                                             (line   23)
* f_lineno (フレーム属性):               Special read-only attributes<3>.
                                                             (line   44)
* f_locals (frame の属性):               Special read-only attributes<3>.
                                                             (line   16)
* f_locals (フレーム属性):               フレーム frame オブジェクト.
                                                             (line   10)
* F_LOCK (os モジュール):                ファイル記述子の操作.
                                                             (line  279)
* F_OK (os モジュール):                  ファイルとディレクトリ.
                                                             (line  109)
* F_TEST (os モジュール):                ファイル記述子の操作.
                                                             (line  279)
* F_TLOCK (os モジュール):               ファイル記述子の操作.
                                                             (line  279)
* f_trace (frame の属性):                Special writable attributes<2>.
                                                             (line    6)
* f_trace (フレーム属性):                Special read-only attributes<3>.
                                                             (line   45)
* f_trace_lines (frame attribute):       Special read-only attributes<3>.
                                                             (line   45)
* f_trace_lines (frame の属性):          Special writable attributes<2>.
                                                             (line   12)
* f_trace_opcodes (frame attribute):     Special read-only attributes<3>.
                                                             (line   45)
* f_trace_opcodes (frame の属性):        Special writable attributes<2>.
                                                             (line   16)
* F_ULOCK (os モジュール):               ファイル記述子の操作.
                                                             (line  279)
* f-string:                              出力を見やすくフォーマットする.
                                                             (line   90)
* f-string <1>:                          Raw string literals.
                                                             (line   25)
* f-string <2>:                          用語集<2>.          (line  570)
* f-strings:                             文字列メソッド<2>.  (line  928)
* f-strings <1>:                         用語集<2>.          (line  573)
* f';formatted string literal:           Raw string literals.
                                                             (line   25)
* f";formatted string literal:           Raw string literals.
                                                             (line   25)
* fabs() (math モジュール):              Floating point arithmetic.
                                                             (line   12)
* factorial() (math モジュール):         Number-theoretic functions.
                                                             (line   22)
* factory() (importlib.util.LazyLoader のクラスメソッド): importlib util -- Utility code for importers.
                                                             (line  226)
* FAIL_FAST (doctest モジュール):        オプションフラグ.   (line  138)
* fail() (unittest.TestCase のメソッド): テストクラス.       (line  754)
* failed (doctest.TestResults の属性):   TestResults objects.
                                                             (line    8)
* failfast (unittest.TestResult の属性): テストのロードと起動.
                                                             (line  301)
* failureException (unittest.TestCase の属性): テストクラス. (line  759)
* failures (doctest.DocTestRunner の属性): DocTestRunner オブジェクト.
                                                             (line  141)
* failures (unittest.TestResult の属性): テストのロードと起動.
                                                             (line  249)
* FakePath (test.support.os_helper のクラス): test support os_helper --- Utilities for os tests.
                                                             (line   58)
* False:                                 numbers Integral 整数.
                                                             (line   24)
* false:                                 真理値判定.         (line    6)
* False <1>:                             真理値判定.         (line   25)
* False <2>:                             ブーリアン型 - bool.
                                                             (line    9)
* False (組み込みオブジェクト):          真理値判定.         (line   17)
* False (組み込み変数):                  組み込み定数.       (line    8)
* families() (tkinter.font モジュール):  tkinter font --- Tkinter フォントラッパー.
                                                             (line   88)
* family (socket.socket の属性):         socket オブジェクト.
                                                             (line  606)
* fast (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  309)
* fast (pickle.Pickler の属性):          モジュールインターフェース.
                                                             (line  226)
* fatalError() (xml.sax.handler.ErrorHandler のメソッド): ErrorHandler オブジェクト.
                                                             (line   24)
* Fault (xmlrpc.client のクラス):        Fault オブジェクト. (line    6)
* faultCode (xmlrpc.client.Fault の属性): Fault オブジェクト.
                                                             (line   11)
* faultString (xmlrpc.client.Fault の属性): Fault オブジェクト.
                                                             (line   15)
* fchdir() (os モジュール):              ファイルとディレクトリ.
                                                             (line  290)
* fchmod() (os モジュール):              ファイル記述子の操作.
                                                             (line  121)
* fchown() (os モジュール):              ファイル記述子の操作.
                                                             (line  137)
* fcntl() (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line   70)
* fd (selectors.SelectorKey の属性):     クラス<4>.          (line   40)
* fd_count() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   98)
* fd() (turtle モジュール):              Turtle の動き.      (line    6)
* fdatasync() (os モジュール):           ファイル記述子の操作.
                                                             (line  152)
* fdopen() (os モジュール):              ファイルオブジェクトの生成.
                                                             (line    9)
* feature_external_ges (xml.sax.handler モジュール): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   80)
* feature_external_pes (xml.sax.handler モジュール): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   92)
* feature_namespace_prefixes (xml.sax.handler モジュール): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   59)
* feature_namespaces (xml.sax.handler モジュール): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   52)
* feature_string_interning (xml.sax.handler モジュール): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   66)
* feature_validation (xml.sax.handler モジュール): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   73)
* FEBRUARY (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  483)
* feed_eof() (asyncio.StreamReader のメソッド): StreamReader.
                                                             (line   16)
* feed() (email.parser.BytesFeedParser のメソッド): FeedParser API.
                                                             (line   57)
* feed() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line    8)
* feed() (xml.etree.ElementTree.XMLParser のメソッド): XMLParser オブジェクト.
                                                             (line   27)
* feed() (xml.etree.ElementTree.XMLPullParser のメソッド): XMLPullParser オブジェクト.
                                                             (line   18)
* feed() (xml.sax.xmlreader.IncrementalParser のメソッド): IncrementalParser オブジェクト.
                                                             (line    9)
* FeedParser (email.parser のクラス):    FeedParser API.     (line   72)
* fetch() (imaplib.IMAP4 のメソッド):    IMAP4 オブジェクト. (line  100)
* fetchall() (sqlite3.Cursor のメソッド): Cursor オブジェクト.
                                                             (line  150)
* fetchmany() (sqlite3.Cursor のメソッド): Cursor オブジェクト.
                                                             (line  131)
* fetchone() (sqlite3.Cursor のメソッド): Cursor オブジェクト.
                                                             (line  124)
* FF (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   60)
* fflags (select.kevent の属性):         kevent オブジェクト.
                                                             (line   89)
* Field (dataclasses のクラス):          モジュールの内容<4>.
                                                             (line  306)
* field_size_limit() (csv モジュール):   モジュールコンテンツ<3>.
                                                             (line   94)
* field() (dataclasses モジュール):      モジュールの内容<4>.
                                                             (line  205)
* fieldnames (csv.DictReader の属性):    reader オブジェクト.
                                                             (line   31)
* fields (uuid.UUID の属性):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   97)
* fields() (dataclasses モジュール):     モジュールの内容<4>.
                                                             (line  334)
* FIFOTYPE (tarfile モジュール):         tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  354)
* file (bdb.Breakpoint の属性):          bdb --- デバッガーフレームワーク.
                                                             (line   83)
* file (pyclbr.Class の属性):            クラスオブジェクト<2>.
                                                             (line   12)
* file (pyclbr.Function の属性):         Function オブジェクト.
                                                             (line   11)
* file object:                           用語集<2>.          (line  578)
* file object;io module:                 概要<2>.            (line    6)
* file object;open() built-in function:  組み込み関数.       (line 1266)
* FILE_ATTRIBUTE_ARCHIVE (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_COMPRESSED (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_DEVICE (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_DIRECTORY (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_ENCRYPTED (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_HIDDEN (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_INTEGRITY_STREAM (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_NO_SCRUB_DATA (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_NORMAL (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_NOT_CONTENT_INDEXED (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_OFFLINE (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_READONLY (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_REPARSE_POINT (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_SPARSE_FILE (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_SYSTEM (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_TEMPORARY (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* FILE_ATTRIBUTE_VIRTUAL (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  459)
* file_digest() (hashlib モジュール):    ファイルのハッシュ化.
                                                             (line    9)
* file_open() (urllib.request.FileHandler のメソッド): FileHandler オブジェクト.
                                                             (line    6)
* file_size (zipfile.ZipInfo の属性):    ZipInfo objects.    (line  159)
* file-like object:                      用語集<2>.          (line  594)
* fileConfig() (logging.config モジュール): 環境設定のための関数.
                                                             (line   60)
* FileCookieJar (http.cookiejar のクラス): http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line   57)
* FileDialog (tkinter.filedialog のクラス): ネイティブの読み込み/保存ダイアログ.
                                                             (line   77)
* FileExistsError:                       OS 例外.            (line   63)
* FileFinder (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line  152)
* FileHandler (logging のクラス):        FileHandler.        (line   10)
* FileHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  473)
* FileInput (fileinput のクラス):        fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  135)
* FileIO (io のクラス):                  生ファイルI/O.      (line    6)
* filelineno() (fileinput モジュール):   fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  102)
* FileLoader (importlib.abc のクラス):   importlib abc -- Abstract base classes related to import.
                                                             (line  295)
* filemode() (stat モジュール):          stat --- stat の結果を解釈する.
                                                             (line  126)
* filename (doctest.DocTest の属性):     DocTest オブジェクト.
                                                             (line   35)
* filename (http.cookiejar.FileCookieJar の属性): CookieJar および FileCookieJar オブジェクト.
                                                             (line  161)
* filename (inspect.FrameInfo の属性):   インタープリタスタック.
                                                             (line   17)
* filename (inspect.Traceback の属性):   インタープリタスタック.
                                                             (line   56)
* filename (netrc.NetrcParseError の属性): netrc --- netrc ファイルの処理.
                                                             (line   59)
* filename (OSError の属性):             具象例外.           (line  189)
* filename (SyntaxError の属性):         具象例外.           (line  312)
* filename (traceback.FrameSummary の属性): FrameSummary オブジェクト.
                                                             (line   28)
* filename (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   89)
* filename (tracemalloc.Frame の属性):   Frame.              (line   13)
* filename (zipfile.ZipFile の属性):     ZipFile objects.    (line  365)
* filename (zipfile.ZipInfo の属性):     ZipInfo objects.    (line   51)
* filename_only (tabnanny モジュール):   tabnanny --- あいまいなインデントの検出.
                                                             (line   31)
* filename_pattern (tracemalloc.Filter の属性): Filter.      (line   54)
* filename() (fileinput モジュール):     fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line   85)
* filename2 (OSError の属性):            具象例外.           (line  189)
* filenames;pathname expansion:          glob --- Unix 形式のパス名のパターン展開.
                                                             (line    8)
* filenames;ワイルドカード展開:          fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line    8)
* fileno() (bz2.BZ2File のメソッド):     ファイルの圧縮/解凍.
                                                             (line   86)
* fileno() (fileinput モジュール):       fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line   90)
* fileno() (http.client.HTTPResponse のメソッド): HTTPResponse オブジェクト.
                                                             (line   37)
* fileno() (io.IOBase のメソッド):       I/O 基底クラス.     (line   61)
* fileno() (multiprocessing.connection.Connection のメソッド): Connection オブジェクト<2>.
                                                             (line   31)
* fileno() (select.devpoll のメソッド):  /dev/poll ポーリングオブジェクト.
                                                             (line   24)
* fileno() (select.epoll のメソッド):    エッジおよびレベルトリガポーリング epoll オブジェクト.
                                                             (line   80)
* fileno() (select.kqueue のメソッド):   kqueue オブジェクト.
                                                             (line   14)
* fileno() (selectors.DevpollSelector のメソッド): クラス<4>.
                                                             (line  191)
* fileno() (selectors.EpollSelector のメソッド): クラス<4>.  (line  182)
* fileno() (selectors.KqueueSelector のメソッド): クラス<4>. (line  202)
* fileno() (socket.socket のメソッド):   socket オブジェクト.
                                                             (line  119)
* fileno() (socketserver.BaseServer のメソッド): Serverオブジェクト<2>.
                                                             (line   15)
* FileNotFoundError:                     OS 例外.            (line   68)
* fileobj (selectors.SelectorKey の属性): クラス<4>.         (line   36)
* files_double_event() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line   93)
* files_select_event() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line   97)
* files() (importlib.metadata モジュール): 配布物ファイル.   (line    6)
* files() (importlib.resources モジュール): importlib resources -- パッケージリソースの読み取り、オープン、アクセス.
                                                             (line   53)
* files() (importlib.resources.abc.TraversableResources のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  172)
* filesystem encoding and error handler: 用語集<2>.          (line  598)
* FileType (argparse のクラス):          FileType オブジェクト.
                                                             (line    6)
* FileWrapper (wsgiref.types のクラス):  wsgiref types -- WSGI types for static type checking.
                                                             (line   32)
* FileWrapper (wsgiref.util のクラス):   wsgiref util -- WSGI environment utilities.
                                                             (line  117)
* fill() (textwrap モジュール):          textwrap --- テキストの折り返しと詰め込み.
                                                             (line   33)
* fill() (textwrap.TextWrapper のメソッド): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  291)
* fill() (turtle モジュール):            塗りつぶし.         (line   16)
* fillcolor() (turtle モジュール):       色の制御<2>.        (line   61)
* filling() (turtle モジュール):         塗りつぶし.         (line    6)
* fillvalue (reprlib.Repr の属性):       Reprオブジェクト.   (line   10)
* Filter (logging のクラス):             フィルタオブジェクト.
                                                             (line   14)
* filter (select.kevent の属性):         kevent オブジェクト.
                                                             (line   15)
* Filter (tracemalloc のクラス):         Filter.             (line    6)
* filter_command() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  101)
* FILTER_DIR (unittest.mock モジュール): FILTER_DIR.         (line    6)
* filter_traces() (tracemalloc.Snapshot のメソッド): Snapshot.
                                                             (line   36)
* filter() (curses モジュール):          関数<6>.            (line  136)
* filter() (fnmatch モジュール):         fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   76)
* filter() (logging.Filter のメソッド):  フィルタオブジェクト.
                                                             (line   21)
* filter() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   63)
* filter() (logging.Logger のメソッド):  ロガーオブジェクト. (line  323)
* FilterError:                           tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  281)
* filterfalse() (fnmatch モジュール):    fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   83)
* filterfalse() (itertools モジュール):  Itertool関数.       (line  287)
* filterwarnings() (warnings モジュール): 利用可能な関数.    (line  110)
* Final (typing モジュール):             特殊形式.           (line  232)
* final() (typing モジュール):           Functions and decorators.
                                                             (line  309)
* finalization, of objects:              ファイナライズとメモリ解放.
                                                             (line    6)
* finalize (weakref のクラス):           weakref --- Weak references.
                                                             (line  258)
* finalize_dict() (compression.zstd モジュール): Zstandard dictionaries.
                                                             (line   28)
* finalizer:                             基本的なカスタマイズ.
                                                             (line   53)
* find_class() (pickle プロトコル):      グローバル変数を制限する.
                                                             (line    6)
* find_class() (pickle.Unpickler のメソッド): モジュールインターフェース.
                                                             (line  311)
* find_library() (ctypes.util モジュール): ユーティリティー関数.
                                                             (line  129)
* find_longest_match() (difflib.SequenceMatcher のメソッド): SequenceMatcherオブジェクト.
                                                             (line   65)
* find_msvcrt() (ctypes.util モジュール): ユーティリティー関数.
                                                             (line  142)
* find_spec() (importlib.abc.MetaPathFinder のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line   34)
* find_spec() (importlib.abc.PathEntryFinder のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line   70)
* find_spec() (importlib.machinery.FileFinder のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  180)
* find_spec() (importlib.machinery.PathFinder のクラスメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  115)
* find_spec() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line  104)
* find_spec() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   37)
* find_unused_port() (test.support.socket_helper モジュール): test support socket_helper --- Utilities for socket tests.
                                                             (line   15)
* find_user_password() (urllib.request.HTTPPasswordMgr のメソッド): HTTPPasswordMgr オブジェクト.
                                                             (line   16)
* find_user_password() (urllib.request.HTTPPasswordMgrWithPriorAuth のメソッド): HTTPPasswordMgrWithPriorAuth オブジェクト.
                                                             (line   20)
* find() (bytearray のメソッド):         bytes と bytearray の操作.
                                                             (line  134)
* find() (bytes のメソッド):             bytes と bytearray の操作.
                                                             (line  134)
* find() (doctest.DocTestFinder のメソッド): DocTestFinder オブジェクト.
                                                             (line   32)
* find() (gettext モジュール):           クラス形式の API.   (line   14)
* find() (mmap.mmap のメソッド):         mmap --- メモリマップファイルのサポート.
                                                             (line  197)
* find() (str のメソッド):               文字列メソッド<2>.  (line  162)
* find() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   97)
* find() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   20)
* findall() (re モジュール):             関数<2>.            (line  127)
* findall() (re.Pattern のメソッド):     正規表現オブジェクト.
                                                             (line   82)
* findall() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  106)
* findall() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   25)
* findCaller() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  340)
* finder:                                ファインダーとローダー.
                                                             (line    6)
* finder <1>:                            用語集<2>.          (line  620)
* finder;find_spec:                      メタパス.           (line    6)
* findfile() (test.support モジュール):  test support --- Utilities for the Python test suite.
                                                             (line  296)
* finditer() (re モジュール):            関数<2>.            (line  153)
* finditer() (re.Pattern のメソッド):    正規表現オブジェクト.
                                                             (line   88)
* findlabels() (dis モジュール):         解析関数.           (line  186)
* findlinestarts() (dis モジュール):     解析関数.           (line  169)
* findtext() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  115)
* findtext() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   30)
* finish_request() (socketserver.BaseServer のメソッド): Serverオブジェクト<2>.
                                                             (line  125)
* finish() (socketserver.BaseRequestHandler のメソッド): Request Handler Objects.
                                                             (line   34)
* finish() (tkinter.dnd.DndHandler のメソッド): tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   51)
* FIRST_COMPLETED (asyncio モジュール):  要素の終了待機.     (line   35)
* FIRST_COMPLETED (concurrent.futures モジュール): モジュール関数<2>.
                                                             (line   29)
* FIRST_EXCEPTION (asyncio モジュール):  要素の終了待機.     (line   39)
* FIRST_EXCEPTION (concurrent.futures モジュール): モジュール関数<2>.
                                                             (line   33)
* firstChild (xml.dom.Node の属性):      Node オブジェクト.  (line   53)
* FirstHeaderLineIsContinuationDefect:   email errors Exception and Defect classes.
                                                             (line   92)
* firstkey() (dbm.gnu.gdbm のメソッド):  dbm gnu --- GNU database manager.
                                                             (line   99)
* firstweekday (calendar.Calendar の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line   38)
* firstweekday() (calendar モジュール):  calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  354)
* fix_missing_locations() (ast モジュール): ast helpers.     (line  146)
* fix_sentence_endings (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  223)
* Flag (enum のクラス):                  データ型<2>.        (line  432)
* flag_bits (zipfile.ZipInfo の属性):    ZipInfo objects.    (line  131)
* FlagBoundary (enum のクラス):          データ型<2>.        (line  669)
* flags (decimal.Context の属性):        Context オブジェクト.
                                                             (line  136)
* flags (re.Pattern の属性):             正規表現オブジェクト.
                                                             (line  104)
* flags (select.kevent の属性):          kevent オブジェクト.
                                                             (line   51)
* flags (sys モジュール):                sys --- システム固有のパラメーターと関数.
                                                             (line  521)
* flash() (curses モジュール):           関数<6>.            (line  147)
* flatten() (email.generator.BytesGenerator のメソッド): email generator Generating MIME documents.
                                                             (line   79)
* flatten() (email.generator.Generator のメソッド): email generator Generating MIME documents.
                                                             (line  174)
* float (組み込みクラス):                組み込み関数.       (line  713)
* float_info (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line  625)
* float_repr_style (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line  732)
* floating-point literal:                数値リテラル.       (line    6)
* FloatingPointError:                    具象例外.           (line   39)
* FloatOperation (decimal のクラス):     シグナル.           (line  107)
* flock() (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  169)
* floor division:                        用語集<2>.          (line  632)
* floor() (math モジュール):             数値型 int float complex.
                                                             (line  115)
* floor() (math モジュール) <1>:         Floating point arithmetic.
                                                             (line   16)
* FloorDiv (ast のクラス):               式 expression<2>.   (line   55)
* floordiv() (operator モジュール):      operator --- 関数形式の標準演算子.
                                                             (line   98)
* FLUSH_BLOCK (compression.zstd.ZstdCompressor の属性): メモリ上での圧縮と展開.
                                                             (line  136)
* FLUSH_FRAME (compression.zstd.ZstdCompressor の属性): メモリ上での圧縮と展開.
                                                             (line  143)
* flush_headers() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  332)
* flush_std_streams() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  429)
* flush() (bz2.BZ2Compressor のメソッド): 逐次圧縮および展開.
                                                             (line   25)
* flush() (compression.zstd.ZstdCompressor のメソッド): メモリ上での圧縮と展開.
                                                             (line   97)
* flush() (io.BufferedWriter のメソッド): バッファ付きストリーム.
                                                             (line  124)
* flush() (io.IOBase のメソッド):        I/O 基底クラス.     (line   67)
* flush() (logging.Handler のメソッド):  ハンドラオブジェクト.
                                                             (line   71)
* flush() (logging.handlers.BufferingHandler のメソッド): MemoryHandler.
                                                             (line   30)
* flush() (logging.handlers.MemoryHandler のメソッド): MemoryHandler.
                                                             (line   63)
* flush() (logging.StreamHandler のメソッド): StreamHandler. (line   26)
* flush() (lzma.LZMACompressor のメソッド): メモリ上での圧縮と展開<2>.
                                                             (line   84)
* flush() (mailbox.Mailbox のメソッド):  Mailbox オブジェクト.
                                                             (line  245)
* flush() (mailbox.Maildir のメソッド):  Maildir オブジェクト.
                                                             (line  201)
* flush() (mailbox.MH のメソッド):       MH オブジェクト.    (line  103)
* flush() (mmap.mmap のメソッド):        mmap --- メモリマップファイルのサポート.
                                                             (line  207)
* flush() (xml.etree.ElementTree.XMLParser のメソッド): XMLParser オブジェクト.
                                                             (line   32)
* flush() (xml.etree.ElementTree.XMLPullParser のメソッド): XMLPullParser オブジェクト.
                                                             (line   22)
* flush() (zlib.Compress のメソッド):    zlib --- gzip 互換の圧縮.
                                                             (line  209)
* flush() (zlib.Decompress のメソッド):  zlib --- gzip 互換の圧縮.
                                                             (line  279)
* flushinp() (curses モジュール):        関数<6>.            (line  153)
* FlushKey() (winreg モジュール):        関数<14>.           (line  237)
* fma() (decimal.Context のメソッド):    Context オブジェクト.
                                                             (line  322)
* fma() (decimal.Decimal のメソッド):    Decimal オブジェクト.
                                                             (line  276)
* fma() (math モジュール):               Floating point arithmetic.
                                                             (line   22)
* fmean() (statistics モジュール):       関数の詳細.         (line   45)
* fmod() (math モジュール):              Floating point arithmetic.
                                                             (line   37)
* FMT_BINARY (plistlib モジュール):      plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line  161)
* FMT_XML (plistlib モジュール):         plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line  155)
* fnmatch() (fnmatch モジュール):        fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   51)
* fnmatchcase() (fnmatch モジュール):    fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   70)
* focus() (tkinter.ttk.Treeview のメソッド): ttk Treeview.   (line   94)
* fold (datetime.datetime の属性):       datetime objects.   (line  341)
* fold (datetime.time の属性):           time objects.       (line   71)
* fold_binary() (email.policy.Compat32 のメソッド): email policy Policy Objects.
                                                             (line  605)
* fold_binary() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  485)
* fold_binary() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  349)
* fold() (email.headerregistry.BaseHeader のメソッド): email headerregistry Custom Header Objects.
                                                             (line   72)
* fold() (email.policy.Compat32 のメソッド): email policy Policy Objects.
                                                             (line  597)
* fold() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  465)
* fold() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  334)
* Font (tkinter.font のクラス):          tkinter font --- Tkinter フォントラッパー.
                                                             (line   20)
* For (ast のクラス):                    制御フロー.         (line   44)
* FOR_ITER (opcode):                     Python バイトコード命令.
                                                             (line  923)
* for;in comprehensions:                 リスト、集合、辞書の表示.
                                                             (line   14)
* forget() (test.support.import_helper モジュール): test support import_helper --- Utilities for import tests.
                                                             (line   11)
* forget() (tkinter.ttk.Notebook のメソッド): ttk Notebook.  (line   18)
* fork() (os モジュール):                プロセス管理.       (line  255)
* fork() (pty モジュール):               pty --- 擬似端末ユーティリティ.
                                                             (line   22)
* ForkingMixIn (socketserver のクラス):  サーバ生成に関するノート.
                                                             (line   26)
* ForkingTCPServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   74)
* ForkingUDPServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   74)
* ForkingUnixDatagramServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   74)
* ForkingUnixStreamServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   74)
* forkpty() (os モジュール):             プロセス管理.       (line  300)
* Format (annotationlib のクラス):       クラス<5>.          (line    6)
* FORMAT (inspect.BufferFlags の属性):   Buffer flags.       (line   19)
* format (memoryview の属性):            メモリビュー.       (line  450)
* format (multiprocessing.shared_memory.ShareableList の属性): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  340)
* format (struct.Struct の属性):         クラス<3>.          (line   56)
* format_call_graph() (asyncio モジュール): Call Graph Introspection.
                                                             (line   70)
* format_datetime() (email.utils モジュール): email utils Miscellaneous utilities.
                                                             (line  173)
* format_exc() (traceback モジュール):   モジュールレベルの関数<2>.
                                                             (line  161)
* format_exception_only() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line  116)
* format_exception_only() (traceback.TracebackException のメソッド): TracebackException オブジェクト.
                                                             (line  151)
* format_exception() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line  146)
* format_field() (string.Formatter のメソッド): カスタムの文字列書式化.
                                                             (line  103)
* format_frame_summary() (traceback.StackSummary のメソッド): StackSummary オブジェクト.
                                                             (line   54)
* format_help() (argparse.ArgumentParser のメソッド): ヘルプの表示.
                                                             (line   30)
* format_list() (traceback モジュール):  モジュールレベルの関数<2>.
                                                             (line  106)
* format_map() (str のメソッド):         文字列メソッド<2>.  (line  217)
* FORMAT_SIMPLE (opcode):                Python バイトコード命令.
                                                             (line 1232)
* format_spec (string.templatelib.Interpolation の属性): 型. (line  257)
* format_stack_entry() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  466)
* format_stack() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line  170)
* format_string() (locale モジュール):   locale --- 国際化サービス.
                                                             (line  457)
* format_tb() (traceback モジュール):    モジュールレベルの関数<2>.
                                                             (line  166)
* format_usage() (argparse.Action のメソッド): Action クラス.
                                                             (line   57)
* format_usage() (argparse.ArgumentParser のメソッド): ヘルプの表示.
                                                             (line   25)
* FORMAT_WITH_SPEC (opcode):             Python バイトコード命令.
                                                             (line 1244)
* format() (inspect.Signature のメソッド): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  169)
* format() (logging.BufferingFormatter のメソッド): フォーマッタオブジェクト.
                                                             (line  150)
* format() (logging.Formatter のメソッド): フォーマッタオブジェクト.
                                                             (line   52)
* format() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line  105)
* format() (pprint.PrettyPrinter のメソッド): PrettyPrinter オブジェクト.
                                                             (line   81)
* format() (str のメソッド):             文字列メソッド<2>.  (line  183)
* format() (string.Formatter のメソッド): カスタムの文字列書式化.
                                                             (line   17)
* format() (traceback.StackSummary のメソッド): StackSummary オブジェクト.
                                                             (line   39)
* format() (traceback.TracebackException のメソッド): TracebackException オブジェクト.
                                                             (line  140)
* format() (tracemalloc.Traceback のメソッド): Traceback.    (line   37)
* format() (組み込み関数);__str__() (オブジェクトメソッド): 基本的なカスタマイズ.
                                                             (line  128)
* formataddr() (email.utils モジュール): email utils Miscellaneous utilities.
                                                             (line   71)
* formatargvalues() (inspect モジュール): クラスと関数<2>.   (line   69)
* formatdate() (email.utils モジュール): email utils Miscellaneous utilities.
                                                             (line  151)
* formatday() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  149)
* FormatError:                           例外<21>.           (line   33)
* FormatError() (ctypes モジュール):     ユーティリティー関数.
                                                             (line  170)
* formatException() (logging.Formatter のメソッド): フォーマッタオブジェクト.
                                                             (line  113)
* formatFooter() (logging.BufferingFormatter のメソッド): フォーマッタオブジェクト.
                                                             (line  143)
* formatHeader() (logging.BufferingFormatter のメソッド): フォーマッタオブジェクト.
                                                             (line  135)
* formatmonth() (calendar.HTMLCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  220)
* formatmonth() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  178)
* formatmonthname() (calendar.HTMLCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  243)
* formatmonthname() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  186)
* formatStack() (logging.Formatter のメソッド): フォーマッタオブジェクト.
                                                             (line  120)
* formatted string literal:              出力を見やすくフォーマットする.
                                                             (line   90)
* formatted string literal <1>:          Raw string literals.
                                                             (line   25)
* formatted string literals:             文字列メソッド<2>.  (line  928)
* FormattedValue (ast のクラス):         リテラル<3>.        (line   18)
* Formatter (logging のクラス):          フォーマッタオブジェクト.
                                                             (line    6)
* Formatter (string のクラス):           カスタムの文字列書式化.
                                                             (line   13)
* formatTime() (logging.Formatter のメソッド): フォーマッタオブジェクト.
                                                             (line   75)
* formatwarning() (warnings モジュール): 利用可能な関数.     (line  101)
* formatweek() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  156)
* formatweekday() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  164)
* formatweekheader() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  171)
* formatyear() (calendar.HTMLCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  226)
* formatyear() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  200)
* formatyearpage() (calendar.HTMLCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  232)
* Fortran contiguous:                    shape strides suboffsets.
                                                             (line   33)
* Fortran contiguous <1>:                用語集<2>.          (line  379)
* forward() (turtle モジュール):         Turtle の動き.      (line    6)
* ForwardRef (annotationlib のクラス):   クラス<5>.          (line   49)
* FORWARDREF (annotationlib.Format の属性): クラス<5>.       (line   30)
* ForwardRef (typing のクラス):          Introspection helpers.
                                                             (line  153)
* fp (urllib.error.HTTPError の属性):    urllib error --- urllib request によって送出される例外クラス.
                                                             (line   61)
* fpathconf() (os モジュール):           ファイル記述子の操作.
                                                             (line  161)
* Fraction (fractions のクラス):         fractions --- 有理数.
                                                             (line   15)
* frame (inspect.FrameInfo の属性):      インタープリタスタック.
                                                             (line   13)
* frame (tkinter.scrolledtext.ScrolledText の属性): tkinter scrolledtext --- スクロール可能なテキストウィジェット.
                                                             (line   26)
* Frame (tracemalloc のクラス):          Frame.              (line    6)
* FrameInfo (compression.zstd のクラス): その他<3>.          (line   12)
* FrameInfo (inspect のクラス):          インタープリタスタック.
                                                             (line   11)
* FrameSummary (traceback のクラス):     FrameSummary オブジェクト.
                                                             (line   11)
* FrameType (types モジュール):          標準的なインタプリタ型.
                                                             (line  197)
* free (C function):                     概要<4>.            (line   33)
* free threading:                        用語集<2>.          (line  641)
* free variable:                         用語集<2>.          (line  656)
* free_tool_id() (sys.monitoring モジュール): Registering and using tools.
                                                             (line   18)
* free-threaded build:                   用語集<2>.          (line  648)
* freedesktop_os_release() (platform モジュール): Linux platforms.
                                                             (line    6)
* freefunc (C type):                     Slot Type typedefs. (line   28)
* freeze_support() (multiprocessing モジュール): その他<5>.  (line   51)
* freeze() (gc モジュール):              gc --- ガベージコレクターインターフェース.
                                                             (line  229)
* frexp() (math モジュール):             Floating point manipulation functions.
                                                             (line   12)
* FRIDAY (calendar モジュール):          calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  440)
* from_address() (ctypes._CData のメソッド): データ型<3>.    (line   43)
* from_buffer_copy() (ctypes._CData のメソッド): データ型<3>.
                                                             (line   32)
* from_buffer() (ctypes._CData のメソッド): データ型<3>.     (line   19)
* from_bytes() (int のクラスメソッド):   整数型における追加のメソッド.
                                                             (line   98)
* from_callable() (inspect.Signature のクラスメソッド): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  190)
* from_decimal() (fractions.Fraction のクラスメソッド): fractions --- 有理数.
                                                             (line  148)
* from_exception() (traceback.TracebackException のクラスメソッド): TracebackException オブジェクト.
                                                             (line  123)
* from_file() (zipfile.ZipInfo のクラスメソッド): ZipInfo objects.
                                                             (line   14)
* from_file() (zoneinfo.ZoneInfo のクラスメソッド): ZoneInfo クラス.
                                                             (line   28)
* from_float() (decimal.Decimal のクラスメソッド): Decimal オブジェクト.
                                                             (line  234)
* from_float() (fractions.Fraction のクラスメソッド): fractions --- 有理数.
                                                             (line  137)
* from_iterable() (itertools.chain のクラスメソッド): Itertool関数.
                                                             (line  117)
* from_list() (traceback.StackSummary のクラスメソッド): StackSummary オブジェクト.
                                                             (line   32)
* from_number() (complex のクラスメソッド): 複素数に対する追加のメソッド.
                                                             (line   10)
* from_number() (decimal.Decimal のクラスメソッド): Decimal オブジェクト.
                                                             (line  261)
* from_number() (float のクラスメソッド): 浮動小数点数に対する追加のメソッド.
                                                             (line    9)
* from_number() (fractions.Fraction のクラスメソッド): fractions --- 有理数.
                                                             (line  157)
* from_param() (ctypes._CData のメソッド): データ型<3>.      (line   53)
* from_samples() (statistics.NormalDist のクラスメソッド): NormalDist オブジェクト.
                                                             (line   45)
* from_traceback() (dis.Bytecode のクラスメソッド): バイトコード解析.
                                                             (line   48)
* from_uri() (pathlib.Path のクラスメソッド): URIのパースと生成.
                                                             (line   12)
* from;import statement:                 名前の束縛.         (line    9)
* from;import statement <1>:             import 文.          (line   51)
* from;yield from expression:            Yield 式.           (line   62)
* frombuf() (tarfile.TarInfo のクラスメソッド): TarInfo オブジェクト.
                                                             (line   37)
* frombytes() (array.array のメソッド):  array --- 効率的な数値配列.
                                                             (line  169)
* fromfd() (select.epoll のメソッド):    エッジおよびレベルトリガポーリング epoll オブジェクト.
                                                             (line   84)
* fromfd() (select.kqueue のメソッド):   kqueue オブジェクト.
                                                             (line   18)
* fromfd() (socket モジュール):          ソケットの作成.     (line  157)
* fromfile() (array.array のメソッド):   array --- 効率的な数値配列.
                                                             (line  179)
* fromhex() (bytearray のクラスメソッド): bytearray オブジェクト.
                                                             (line   37)
* fromhex() (bytes のクラスメソッド):    バイトオブジェクト. (line   63)
* fromhex() (float のクラスメソッド):    浮動小数点数に対する追加のメソッド.
                                                             (line   49)
* fromisocalendar() (datetime.date のクラスメソッド): date objects.
                                                             (line   89)
* fromisocalendar() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line  246)
* fromisoformat() (datetime.date のクラスメソッド): date objects.
                                                             (line   62)
* fromisoformat() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line  199)
* fromisoformat() (datetime.time のクラスメソッド): time objects.
                                                             (line  106)
* fromkeys() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line  113)
* fromkeys() (dict のクラスメソッド):    マッピング型 --- dict.
                                                             (line  168)
* fromlist() (array.array のメソッド):   array --- 効率的な数値配列.
                                                             (line  187)
* fromordinal() (datetime.date のクラスメソッド): date objects.
                                                             (line   53)
* fromordinal() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line  175)
* fromshare() (socket モジュール):       ソケットの作成.     (line  174)
* fromstring() (xml.etree.ElementTree モジュール): 関数<9>.  (line   98)
* fromstringlist() (xml.etree.ElementTree モジュール): 関数<9>.
                                                             (line  106)
* fromtarfile() (tarfile.TarInfo のクラスメソッド): TarInfo オブジェクト.
                                                             (line   44)
* fromtimestamp() (datetime.date のクラスメソッド): date objects.
                                                             (line   34)
* fromtimestamp() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line  100)
* fromunicode() (array.array のメソッド): array --- 効率的な数値配列.
                                                             (line  193)
* fromutc() (datetime.timezone のメソッド): timezone objects.
                                                             (line   61)
* fromutc() (datetime.tzinfo のメソッド): tzinfo objects.    (line  166)
* FrozenImporter (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line   79)
* FrozenInstanceError:                   モジュールの内容<4>.
                                                             (line  518)
* FrozenSet (typing のクラス):           Aliases to built-in types.
                                                             (line   42)
* frozenset (組み込みクラス):            set（集合）型 --- set frozenset.
                                                             (line   33)
* FS (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  108)
* fs_is_case_insensitive() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line  102)
* FS_NONASCII (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   10)
* fsdecode() (os モジュール):            プロセスのパラメーター.
                                                             (line  119)
* fsencode() (os モジュール):            プロセスのパラメーター.
                                                             (line  106)
* fspath() (os モジュール):              プロセスのパラメーター.
                                                             (line  132)
* fstat() (os モジュール):               ファイル記述子の操作.
                                                             (line  181)
* fstatvfs() (os モジュール):            ファイル記述子の操作.
                                                             (line  193)
* fstring:                               出力を見やすくフォーマットする.
                                                             (line   90)
* fstring <1>:                           Raw string literals.
                                                             (line   25)
* fstring <2>:                           文字列メソッド<2>.  (line  928)
* FSTRING_END (token モジュール):        token --- Python 解析木で使われる定数.
                                                             (line  110)
* FSTRING_MIDDLE (token モジュール):     token --- Python 解析木で使われる定数.
                                                             (line  100)
* FSTRING_START (token モジュール):      token --- Python 解析木で使われる定数.
                                                             (line   92)
* fsum() (math モジュール):              Summation and product functions.
                                                             (line   18)
* fsync() (os モジュール):               ファイル記述子の操作.
                                                             (line  201)
* FTP:                                   urllib request Restrictions.
                                                             (line   37)
* FTP (ftplib のクラス):                 FTP オブジェクト.   (line    6)
* ftp_open() (urllib.request.FTPHandler のメソッド): FTPHandler オブジェクト.
                                                             (line    6)
* FTP_TLS (ftplib のクラス):             FTP_TLS オブジェクト.
                                                             (line    6)
* FTP;ftplib (standard module):          ftplib --- FTP プロトコルクライアント.
                                                             (line    8)
* FTP;プロトコル:                        urllib request Restrictions.
                                                             (line    6)
* FTP;プロトコル <1>:                    ftplib --- FTP プロトコルクライアント.
                                                             (line    8)
* FTPHandler (urllib.request のクラス):  urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  483)
* ftruncate() (os モジュール):           ファイル記述子の操作.
                                                             (line  213)
* Full:                                  queue --- 同期キュークラス.
                                                             (line   82)
* FULL (inspect.BufferFlags の属性):     Buffer flags.       (line   45)
* full_match() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  262)
* FULL_RO (inspect.BufferFlags の属性):  Buffer flags.       (line   47)
* full_url (urllib.request.Request の属性): Request オブジェクト.
                                                             (line   11)
* full() (asyncio.Queue のメソッド):     Queue.              (line   31)
* full() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  128)
* full() (queue.Queue のメソッド):       キューオブジェクト. (line   22)
* fullmatch() (re モジュール):           関数<2>.            (line   65)
* fullmatch() (re.Pattern のメソッド):   正規表現オブジェクト.
                                                             (line   60)
* fully_trusted_filter() (tarfile モジュール): Default named filters.
                                                             (line    9)
* func (functools.partial の属性):       partial オブジェクト.
                                                             (line   10)
* funcname (bdb.Breakpoint の属性):      bdb --- デバッガーフレームワーク.
                                                             (line  102)
* function (inspect.FrameInfo の属性):   インタープリタスタック.
                                                             (line   27)
* function (inspect.Traceback の属性):   インタープリタスタック.
                                                             (line   66)
* Function (pyclbr のクラス):            Function オブジェクト.
                                                             (line    6)
* Function (symtable のクラス):          記号表の検査.       (line  124)
* FUNCTION (symtable.SymbolTableType の属性): 記号表の検査.  (line   15)
* function annotation:                   用語集<2>.          (line  672)
* FunctionDef (ast のクラス):            関数およびクラス定義.
                                                             (line    6)
* FunctionTestCase (unittest のクラス):  テストクラス.       (line 1014)
* FunctionType (ast のクラス):           Root nodes.         (line   57)
* FunctionType (types モジュール):       標準的なインタプリタ型.
                                                             (line   24)
* funny_files (filecmp.dircmp の属性):   dircmp クラス.      (line   98)
* Future (asyncio のクラス):             Future オブジェクト<2>.
                                                             (line    6)
* Future (concurrent.futures のクラス):  Future オブジェクト.
                                                             (line   10)
* future_add_to_awaited_by() (asyncio モジュール): Low level utility functions.
                                                             (line   14)
* future_discard_from_awaited_by() (asyncio モジュール): Low level utility functions.
                                                             (line   26)
* future;statement:                      future 文 future statement.
                                                             (line    6)
* FutureWarning:                         警告.               (line   54)
* fwalk() (os モジュール):               ファイルとディレクトリ.
                                                             (line 1776)
* gaierror:                              例外<18>.           (line   26)
* gamma() (math モジュール):             特殊関数.           (line   28)
* gammavariate() (random モジュール):    実数分布.           (line   43)
* garbage (gc モジュール):               gc --- ガベージコレクターインターフェース.
                                                             (line  263)
* garbage collection:                    オブジェクト、値、および型.
                                                             (line   35)
* garbage collection <1>:                用語集<2>.          (line  706)
* gather() (asyncio モジュール):         並行な Task 実行.   (line    6)
* gather() (curses.textpad.Textbox のメソッド): Textbox オブジェクト.
                                                             (line  112)
* gauss() (random モジュール):           実数分布.           (line   56)
* gc_collect() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  382)
* gcd() (math モジュール):               Number-theoretic functions.
                                                             (line   29)
* gcvisitobjects_t (C type):             Querying Garbage Collector State.
                                                             (line   26)
* ge() (operator モジュール):            operator --- 関数形式の標準演算子.
                                                             (line   24)
* generate_tokens() (tokenize モジュール): 入力のトークナイズ.
                                                             (line   36)
* Generator (collections.abc のクラス):  コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   56)
* Generator (email.generator のクラス):  email generator Generating MIME documents.
                                                             (line  139)
* Generator (typing のクラス):           Aliases to other ABCs in collections abc.
                                                             (line   38)
* generator expression:                  用語集<2>.          (line  737)
* generator expression <1>:              用語集<2>.          (line  737)
* generator iterator:                    用語集<2>.          (line  724)
* generator_stop (__future__ モジュール): モジュールコンテンツ<5>.
                                                             (line   43)
* GeneratorExit:                         具象例外.           (line   43)
* GeneratorExp (ast のクラス):           内包表記 Comprehension.
                                                             (line    6)
* generators (__future__ モジュール):    モジュールコンテンツ<5>.
                                                             (line   18)
* GeneratorType (types モジュール):      標準的なインタプリタ型.
                                                             (line   36)
* Generic (typing のクラス):             Building generic types and type aliases.
                                                             (line   15)
* generic function:                      用語集<2>.          (line  746)
* generic type:                          用語集<2>.          (line  754)
* generic_visit() (ast.NodeVisitor のメソッド): ast helpers. (line  201)
* Generic;Alias:                         ジェネリックエイリアス型.
                                                             (line    6)
* GenericAlias (types のクラス):         標準的なインタプリタ型.
                                                             (line  149)
* genops() (pickletools モジュール):     Programmatic interface.
                                                             (line   21)
* geometric_mean() (statistics モジュール): 関数の詳細.      (line   73)
* GET_AITER (opcode):                    Python バイトコード命令.
                                                             (line  330)
* get_all_breaks() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  428)
* get_all_start_methods() (multiprocessing モジュール): その他<5>.
                                                             (line   77)
* get_all() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  255)
* get_all() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  365)
* get_all() (wsgiref.headers.Headers のメソッド): wsgiref headers -- WSGI response header tools.
                                                             (line   50)
* GET_ANEXT (opcode):                    Python バイトコード命令.
                                                             (line  339)
* get_annotate_from_class_namespace() (annotationlib モジュール): 関数<12>.
                                                             (line  105)
* get_annotations() (annotationlib モジュール): 関数<12>.    (line  117)
* get_annotations() (inspect モジュール): クラスと関数<2>.   (line  151)
* get_app() (wsgiref.simple_server.WSGIServer のメソッド): wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line   69)
* get_archive_formats() (shutil モジュール): アーカイブ化操作.
                                                             (line   71)
* get_args() (typing モジュール):        Introspection helpers.
                                                             (line   86)
* get_asyncgen_hooks() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1024)
* get_attribute() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  630)
* GET_AWAITABLE (opcode):                Python バイトコード命令.
                                                             (line  311)
* get_begidx() (readline モジュール):    補完.               (line   41)
* get_blocking() (os モジュール):        ファイル記述子の操作.
                                                             (line  226)
* get_body_encoding() (email.charset.Charset のメソッド): email charset 文字集合の表現.
                                                             (line   98)
* get_body() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  519)
* get_boundary() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  404)
* get_boundary() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  588)
* get_bpbynumber() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  404)
* get_break() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  413)
* get_breaks() (bdb.Bdb のメソッド):     bdb --- デバッガーフレームワーク.
                                                             (line  418)
* get_buffer() (asyncio.BufferedProtocol のメソッド): バッファリングされたストリーミングプロトコル.
                                                             (line   21)
* get_bytes() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  165)
* get_bytes() (mailbox.mbox のメソッド): mbox オブジェクト.  (line   32)
* get_bytes() (mailbox.MMDF のメソッド): MMDF オブジェクト.  (line   28)
* get_ca_certs() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  179)
* get_cache_token() (abc モジュール):    abc --- 抽象基底クラス.
                                                             (line  324)
* get_channel_binding() (ssl.SSLSocket のメソッド): SSL ソケット.
                                                             (line  258)
* get_charset() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  268)
* get_charsets() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  433)
* get_charsets() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  623)
* get_children() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line  120)
* get_children() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line   19)
* get_ciphers() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  194)
* get_clock_info() (time モジュール):    関数<5>.            (line  105)
* get_close_matches() (difflib モジュール): difflib --- 差分の計算の補助.
                                                             (line  199)
* get_code() (importlib.abc.InspectLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  210)
* get_code() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  399)
* get_code() (importlib.machinery.ExtensionFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  329)
* get_code() (importlib.machinery.SourcelessFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  266)
* get_code() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   44)
* get_completer_delims() (readline モジュール): 補完.        (line   51)
* get_completer() (readline モジュール): 補完.               (line   30)
* get_completion_type() (readline モジュール): 補完.         (line   35)
* get_config_h_filename() (sysconfig モジュール): その他の関数<3>.
                                                             (line   64)
* get_config_var() (sysconfig モジュール): 構成変数.         (line   26)
* get_config_vars() (sysconfig モジュール): 構成変数.        (line   16)
* get_content_charset() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  426)
* get_content_charset() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  611)
* get_content_disposition() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  455)
* get_content_disposition() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  636)
* get_content_maintype() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  324)
* get_content_maintype() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  436)
* get_content_subtype() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  330)
* get_content_subtype() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  442)
* get_content_type() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  308)
* get_content_type() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  418)
* get_content() (email.contentmanager モジュール): Content Manager Instances.
                                                             (line   24)
* get_content() (email.contentmanager.ContentManager のメソッド): email contentmanager Managing MIME Content.
                                                             (line   19)
* get_content() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  583)
* get_context() (asyncio.Handle のメソッド): コールバックのハンドル.
                                                             (line   11)
* get_context() (asyncio.Task のメソッド): Task オブジェクト.
                                                             (line  172)
* get_context() (multiprocessing モジュール): その他<5>.     (line   86)
* get_coro() (asyncio.Task のメソッド):  Task オブジェクト.  (line  158)
* get_coroutine_origin_tracking_depth() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1038)
* get_count() (gc モジュール):           gc --- ガベージコレクターインターフェース.
                                                             (line  140)
* get_current_history_length() (readline モジュール): 履歴リスト.
                                                             (line   14)
* get_current() (concurrent.interpreters モジュール): リファレンス<4>.
                                                             (line   13)
* get_data() (importlib.abc.FileLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  326)
* get_data() (importlib.abc.ResourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  190)
* get_data() (pkgutil モジュール):       pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line  146)
* get_data() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   50)
* get_date() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line   96)
* get_debug() (asyncio.loop のメソッド): デバッグモードの有効化.
                                                             (line    6)
* get_debug() (gc モジュール):           gc --- ガベージコレクターインターフェース.
                                                             (line   66)
* get_default_backend() (pdb モジュール): コマンドライン・インターフェース<8>.
                                                             (line  170)
* get_default_scheme() (sysconfig モジュール): Installation path functions.
                                                             (line   14)
* get_default_type() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  336)
* get_default_type() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  448)
* get_default_verify_paths() (ssl モジュール): 証明書の取り扱い.
                                                             (line   63)
* get_default() (argparse.ArgumentParser のメソッド): パーサーのデフォルト値.
                                                             (line   34)
* get_dialect() (csv モジュール):        モジュールコンテンツ<3>.
                                                             (line   84)
* get_disassembly_as_string() (test.support.bytecode_helper.BytecodeTestCase のメソッド): test support bytecode_helper --- Support tools for testing correct bytecode generation.
                                                             (line   18)
* get_docstring() (ast モジュール):      ast helpers.        (line  122)
* get_doctest() (doctest.DocTestParser のメソッド): DocTestParser オブジェクト.
                                                             (line   13)
* get_endidx() (readline モジュール):    補完.               (line   41)
* get_environ() (wsgiref.simple_server.WSGIRequestHandler のメソッド): wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line   92)
* get_errno() (ctypes モジュール):       ユーティリティー関数.
                                                             (line  186)
* get_escdelay() (curses モジュール):    関数<6>.            (line  451)
* get_event_loop_policy() (asyncio モジュール): ポリシーの取得と設定.
                                                             (line    9)
* get_event_loop() (asyncio モジュール): イベントループ.     (line   38)
* get_event_loop() (asyncio.AbstractEventLoopPolicy のメソッド): ポリシーオブジェクト.
                                                             (line   12)
* get_events() (sys.monitoring モジュール): Setting events globally.
                                                             (line    9)
* get_examples() (doctest.DocTestParser のメソッド): DocTestParser オブジェクト.
                                                             (line   22)
* get_exception_handler() (asyncio.loop のメソッド): エラーハンドリング API.
                                                             (line   27)
* get_exec_path() (os モジュール):       プロセスのパラメーター.
                                                             (line  190)
* get_extra_info() (asyncio.BaseTransport のメソッド): 基底トランスポート.
                                                             (line   21)
* get_extra_info() (asyncio.StreamWriter のメソッド): StreamWriter.
                                                             (line   66)
* get_field() (string.Formatter のメソッド): カスタムの文字列書式化.
                                                             (line   56)
* get_file_breaks() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  423)
* get_file() (mailbox.Babyl のメソッド): Babyl オブジェクト. (line   47)
* get_file() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  179)
* get_file() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line  218)
* get_file() (mailbox.mbox のメソッド):  mbox オブジェクト.  (line   39)
* get_file() (mailbox.MH のメソッド):    MH オブジェクト.    (line   98)
* get_file() (mailbox.MMDF のメソッド):  MMDF オブジェクト.  (line   35)
* get_filename() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  395)
* get_filename() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  579)
* get_filename() (importlib.abc.ExecutionLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  282)
* get_filename() (importlib.abc.FileLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  322)
* get_filename() (importlib.machinery.ExtensionFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  338)
* get_filename() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   58)
* get_filter() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  105)
* get_flags() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line   90)
* get_flags() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line   68)
* get_flags() (mailbox.mboxMessage のメソッド): mboxMessage オブジェクト.
                                                             (line   66)
* get_flags() (mailbox.MMDFMessage のメソッド): MMDFMessage オブジェクト.
                                                             (line   65)
* get_folder() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line   67)
* get_folder() (mailbox.MH のメソッド):  MH オブジェクト.    (line   41)
* get_frame_info() (compression.zstd モジュール): その他<3>. (line    6)
* get_frees() (symtable.Function のメソッド): 記号表の検査.  (line  146)
* get_freeze_count() (gc モジュール):    gc --- ガベージコレクターインターフェース.
                                                             (line  254)
* get_from() (mailbox.mboxMessage のメソッド): mboxMessage オブジェクト.
                                                             (line   49)
* get_from() (mailbox.MMDFMessage のメソッド): MMDFMessage オブジェクト.
                                                             (line   48)
* get_full_url() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line  108)
* get_globals() (symtable.Function のメソッド): 記号表の検査.
                                                             (line  137)
* get_grouped_opcodes() (difflib.SequenceMatcher のメソッド): SequenceMatcherオブジェクト.
                                                             (line  167)
* get_handle_inheritable() (os モジュール): ファイル記述子の継承.
                                                             (line   38)
* get_header() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line  122)
* get_history_item() (readline モジュール): 履歴リスト.      (line   19)
* get_history_length() (readline モジュール): 履歴ファイル.  (line   40)
* get_id() (symtable.SymbolTable のメソッド): 記号表の検査.  (line   70)
* get_ident() (_thread モジュール):      _thread --- 低水準なスレッド API.
                                                             (line   86)
* get_ident() (threading モジュール):    リファレンス<2>.    (line   71)
* get_identifiers() (string.Template のメソッド): Template strings $-strings.
                                                             (line   85)
* get_identifiers() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line  105)
* get_importer() (pkgutil モジュール):   pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line   53)
* get_info() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line  153)
* get_info() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line  106)
* get_inheritable() (os モジュール):     ファイル記述子の継承.
                                                             (line   28)
* get_inheritable() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  129)
* get_instructions() (dis モジュール):   解析関数.           (line  142)
* get_int_max_str_digits() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  840)
* get_interpreter() (zipapp モジュール): Python API.         (line   79)
* GET_ITER (opcode):                     Python バイトコード命令.
                                                             (line  227)
* get_key() (selectors.BaseSelector のメソッド): クラス<4>.  (line  148)
* get_labels() (mailbox.Babyl のメソッド): Babyl オブジェクト.
                                                             (line   34)
* get_labels() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   46)
* get_last_error() (ctypes モジュール):  ユーティリティー関数.
                                                             (line  194)
* GET_LEN (opcode):                      Python バイトコード命令.
                                                             (line  508)
* get_line_buffer() (readline モジュール): 行バッファ.       (line    8)
* get_lineno() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line   86)
* get_local_events() (sys.monitoring モジュール): Per code object events.
                                                             (line   11)
* get_locals() (symtable.Function のメソッド): 記号表の検査. (line  133)
* get_logger() (multiprocessing モジュール): ログ記録<2>.    (line   11)
* get_loop() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line  141)
* get_loop() (asyncio.Runner のメソッド): Runner context manager.
                                                             (line   65)
* get_loop() (asyncio.Server のメソッド): Serverオブジェクト.
                                                             (line   69)
* get_main() (concurrent.interpreters モジュール): リファレンス<4>.
                                                             (line   18)
* get_makefile_filename() (sysconfig モジュール): その他の関数<3>.
                                                             (line   68)
* get_map() (selectors.BaseSelector のメソッド): クラス<4>.  (line  156)
* get_matching_blocks() (difflib.SequenceMatcher のメソッド): SequenceMatcherオブジェクト.
                                                             (line  107)
* get_message() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  158)
* get_method() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line   68)
* get_methods() (symtable.Class のメソッド): 記号表の検査.   (line  156)
* get_mixed_type_key() (ipaddress モジュール): その他のモジュールレベル関数.
                                                             (line   56)
* get_name() (asyncio.Task のメソッド):  Task オブジェクト.  (line  179)
* get_name() (symtable.Symbol のメソッド): 記号表の検査.     (line  200)
* get_name() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line   74)
* get_namespace() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  311)
* get_namespaces() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  307)
* get_native_id() (_thread モジュール):  _thread --- 低水準なスレッド API.
                                                             (line   94)
* get_native_id() (threading モジュール): リファレンス<2>.   (line   81)
* get_nonlocals() (symtable.Function のメソッド): 記号表の検査.
                                                             (line  141)
* get_nonstandard_attr() (http.cookiejar.Cookie のメソッド): Cookieオブジェクト<2>.
                                                             (line  104)
* get_nowait() (asyncio.Queue のメソッド): Queue.            (line   48)
* get_nowait() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  168)
* get_nowait() (queue.Queue のメソッド): キューオブジェクト. (line   66)
* get_nowait() (queue.SimpleQueue のメソッド): SimpleQueue オブジェクト.
                                                             (line   52)
* get_object_traceback() (tracemalloc モジュール): 関数<11>. (line   12)
* get_objects() (gc モジュール):         gc --- ガベージコレクターインターフェース.
                                                             (line   70)
* get_opcodes() (difflib.SequenceMatcher のメソッド): SequenceMatcherオブジェクト.
                                                             (line  124)
* get_option_group() (optparse.OptionParser のメソッド): オプションをグループ化する.
                                                             (line  102)
* get_option() (optparse.OptionParser のメソッド): オプション解析器への問い合わせと操作.
                                                             (line   38)
* get_origin() (typing モジュール):      Introspection helpers.
                                                             (line   63)
* get_original_bases() (types モジュール): 動的な型生成.     (line   66)
* get_original_stdout() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  339)
* get_osfhandle() (msvcrt モジュール):   ファイル操作関連.   (line   58)
* get_output_charset() (email.charset.Charset のメソッド): email charset 文字集合の表現.
                                                             (line  115)
* get_overloads() (typing モジュール):   Functions and decorators.
                                                             (line  284)
* get_pagesize() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  306)
* get_param() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  483)
* get_parameters() (symtable.Function のメソッド): 記号表の検査.
                                                             (line  129)
* get_params() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  462)
* get_path_names() (sysconfig モジュール): Installation path functions.
                                                             (line   57)
* get_path() (sysconfig モジュール):     Installation path functions.
                                                             (line   62)
* get_paths() (sysconfig モジュール):    Installation path functions.
                                                             (line   92)
* get_payload() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  182)
* get_pid() (asyncio.SubprocessTransport のメソッド): サブプロセス化されたトランスポート.
                                                             (line    6)
* get_pipe_transport() (asyncio.SubprocessTransport のメソッド): サブプロセス化されたトランスポート.
                                                             (line   10)
* get_platform() (sysconfig モジュール): その他の関数<3>.    (line   11)
* get_poly() (turtle モジュール):        特別な Turtle のメソッド.
                                                             (line   28)
* get_preferred_scheme() (sysconfig モジュール): Installation path functions.
                                                             (line   24)
* get_protocol_members() (typing モジュール): Introspection helpers.
                                                             (line  104)
* get_protocol() (asyncio.BaseTransport のメソッド): 基底トランスポート.
                                                             (line   89)
* get_proxy_response_headers() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  142)
* get_python_version() (sysconfig モジュール): その他の関数<3>.
                                                             (line    6)
* get_ready() (graphlib.TopologicalSorter のメソッド): graphlib --- グラフ構造を操作する機能.
                                                             (line  155)
* get_referents() (gc モジュール):       gc --- ガベージコレクターインターフェース.
                                                             (line  170)
* get_referrers() (gc モジュール):       gc --- ガベージコレクターインターフェース.
                                                             (line  149)
* get_request() (socketserver.BaseServer のメソッド): Serverオブジェクト<2>.
                                                             (line  130)
* get_resource_value() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  271)
* get_returncode() (asyncio.SubprocessTransport のメソッド): サブプロセス化されたトランスポート.
                                                             (line   29)
* get_running_loop() (asyncio モジュール): イベントループ.   (line   28)
* get_scheme_names() (sysconfig モジュール): Installation path functions.
                                                             (line    9)
* get_scheme() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line  189)
* get_selection() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  109)
* get_sequences() (mailbox.MH のメソッド): MH オブジェクト.  (line   58)
* get_sequences() (mailbox.MHMessage のメソッド): MHMessage オブジェクト.
                                                             (line   32)
* get_server_certificate() (ssl モジュール): 証明書の取り扱い.
                                                             (line   30)
* get_server() (multiprocessing.managers.BaseManager のメソッド): マネージャー.
                                                             (line   66)
* get_shapepoly() (turtle モジュール):   見た目.             (line  167)
* get_source_segment() (ast モジュール): ast helpers.        (line  134)
* get_source() (importlib.abc.InspectLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  224)
* get_source() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  416)
* get_source() (importlib.machinery.ExtensionFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  334)
* get_source() (importlib.machinery.SourcelessFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  271)
* get_source() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   66)
* get_stack() (asyncio.Task のメソッド): Task オブジェクト.  (line  122)
* get_stack() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  457)
* get_start_method() (multiprocessing モジュール): その他<5>.
                                                             (line  101)
* get_starttag_text() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   33)
* get_stats_profile() (pstats.Stats のメソッド): Stats クラス.
                                                             (line  211)
* get_stats() (gc モジュール):           gc --- ガベージコレクターインターフェース.
                                                             (line   89)
* get_stderr() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line  129)
* get_stderr() (wsgiref.simple_server.WSGIRequestHandler のメソッド): wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line  101)
* get_stdin() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line  123)
* get_string() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  172)
* get_string() (mailbox.mbox のメソッド): mbox オブジェクト. (line   51)
* get_subdir() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line   51)
* get_symbols() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line  115)
* get_tabsize() (curses モジュール):     関数<6>.            (line  466)
* get_task_factory() (asyncio.loop のメソッド): フューチャーとタスクの生成.
                                                             (line   83)
* get_terminal_size() (os モジュール):   ターミナルのサイズの問い合わせ.
                                                             (line    8)
* get_terminal_size() (shutil モジュール): 出力ターミナルのサイズの取得.
                                                             (line    6)
* get_threshold() (gc モジュール):       gc --- ガベージコレクターインターフェース.
                                                             (line  144)
* get_token() (shlex.shlex のメソッド):  shlex オブジェクト. (line    8)
* get_tool() (sys.monitoring モジュール): Registering and using tools.
                                                             (line   23)
* get_traceback_limit() (tracemalloc モジュール): 関数<11>.  (line   22)
* get_traced_memory() (tracemalloc モジュール): 関数<11>.    (line   32)
* get_tracemalloc_memory() (tracemalloc モジュール): 関数<11>.
                                                             (line   55)
* get_type_hints() (typing モジュール):  Introspection helpers.
                                                             (line    6)
* get_type() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line   54)
* get_unixfrom() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  152)
* get_unixfrom() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  163)
* get_unpack_formats() (shutil モジュール): アーカイブ化操作.
                                                             (line  207)
* get_unverified_chain() (ssl.SSLSocket のメソッド): SSL ソケット.
                                                             (line  223)
* get_usage() (optparse.OptionParser のメソッド): その他のメソッド.
                                                             (line   22)
* get_value() (multiprocessing.Semaphore のメソッド): 同期プリミティブ.
                                                             (line  212)
* get_value() (string.Formatter のメソッド): カスタムの文字列書式化.
                                                             (line   68)
* get_verified_chain() (ssl.SSLSocket のメソッド): SSL ソケット.
                                                             (line  214)
* get_version() (optparse.OptionParser のメソッド): バージョン番号の出力.
                                                             (line   33)
* get_visible() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   64)
* get_wch() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  236)
* get_write_buffer_limits() (asyncio.WriteTransport のメソッド): 書き込み専用のトランスポート.
                                                             (line   25)
* get_write_buffer_size() (asyncio.WriteTransport のメソッド): 書き込み専用のトランスポート.
                                                             (line   20)
* GET_YIELD_FROM_ITER (opcode):          Python バイトコード命令.
                                                             (line  231)
* get() (asyncio.Queue のメソッド):      Queue.              (line   39)
* get() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  221)
* get() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line  118)
* get() (contextvars.ContextVar のメソッド): コンテキスト変数.
                                                             (line   30)
* get() (dict のメソッド):               マッピング型 --- dict.
                                                             (line  180)
* get() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  246)
* get() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  357)
* get() (mailbox.Mailbox のメソッド):    Mailbox オブジェクト.
                                                             (line  146)
* get() (multiprocessing.pool.AsyncResult のメソッド): プロセスプール.
                                                             (line  205)
* get() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  154)
* get() (multiprocessing.SimpleQueue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  248)
* get() (queue.Queue のメソッド):        キューオブジェクト. (line   46)
* get() (queue.SimpleQueue のメソッド):  SimpleQueue オブジェクト.
                                                             (line   41)
* get() (tkinter.ttk.Combobox のメソッド): ttk Combobox.     (line   15)
* get() (tkinter.ttk.Spinbox のメソッド): ttk Spinbox.       (line    8)
* get() (types.MappingProxyType のメソッド): 標準的なインタプリタ型.
                                                             (line  262)
* get() (webbrowser モジュール):         コマンドライン・インターフェース<6>.
                                                             (line   69)
* get() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   61)
* getacl() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  107)
* getaddresses() (email.utils モジュール): email utils Miscellaneous utilities.
                                                             (line   85)
* getaddrinfo() (asyncio.loop のメソッド): DNS.              (line    6)
* getaddrinfo() (socket モジュール):     その他の関数<2>.    (line   16)
* getallocatedblocks() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  743)
* getandroidapilevel() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  764)
* getannotation() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  112)
* getargvalues() (inspect モジュール):   クラスと関数<2>.    (line   58)
* getasyncgenlocals() (inspect モジュール): Current State of Generators Coroutines and Asynchronous Generators.
                                                             (line   99)
* getasyncgenstate() (inspect モジュール): Current State of Generators Coroutines and Asynchronous Generators.
                                                             (line   47)
* getatime() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  182)
* getattr_static() (inspect モジュール): 属性の静的なフェッチ.
                                                             (line   16)
* getattrfunc (C type):                  Slot Type typedefs. (line   48)
* getAttribute() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   32)
* getAttributeNode() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   38)
* getAttributeNodeNS() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   48)
* getAttributeNS() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   42)
* getattrofunc (C type):                 Slot Type typedefs. (line   59)
* GetBase() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line   30)
* getbegyx() (curses.window のメソッド): Window オブジェクト.
                                                             (line  220)
* getbkgd() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  224)
* getblocking() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  165)
* getboolean() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  251)
* getbuffer() (io.BytesIO のメソッド):   バッファ付きストリーム.
                                                             (line   22)
* getbufferproc (C type):                Slot Type typedefs. (line  109)
* getByteStream() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   48)
* getcallargs() (inspect モジュール):    クラスと関数<2>.    (line   87)
* getcanvas() (turtle モジュール):       設定と特殊なメソッド.
                                                             (line   54)
* getch() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  228)
* getch() (msvcrt モジュール):           コンソール I/O 関連.
                                                             (line   11)
* getCharacterStream() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   63)
* getche() (msvcrt モジュール):          コンソール I/O 関連.
                                                             (line   25)
* getChild() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  158)
* getChildren() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  169)
* getclasstree() (inspect モジュール):   クラスと関数<2>.    (line    6)
* getclosurevars() (inspect モジュール): クラスと関数<2>.    (line  116)
* getcode() (http.client.HTTPResponse のメソッド): HTTPResponse オブジェクト.
                                                             (line   90)
* getcode() (urllib.response.addinfourl のメソッド): urllib response --- Response classes used by urllib.
                                                             (line   45)
* getColumnNumber() (xml.sax.xmlreader.Locator のメソッド): Locator オブジェクト.
                                                             (line    8)
* getcomments() (inspect モジュール):    ソースコードの情報取得.
                                                             (line   18)
* getcompname() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   41)
* getcomptype() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   36)
* getconfig() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  662)
* getContentHandler() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   22)
* getcontext() (decimal モジュール):     Context オブジェクト.
                                                             (line   14)
* getcoroutinelocals() (inspect モジュール): Current State of Generators Coroutines and Asynchronous Generators.
                                                             (line   91)
* getcoroutinestate() (inspect モジュール): Current State of Generators Coroutines and Asynchronous Generators.
                                                             (line   28)
* getctime() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  199)
* getcwd() (os モジュール):              ファイルとディレクトリ.
                                                             (line  302)
* getcwdb() (os モジュール):             ファイルとディレクトリ.
                                                             (line  306)
* getdecoder() (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  119)
* getdefaultencoding() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  775)
* getdefaultlocale() (locale モジュール): locale --- 国際化サービス.
                                                             (line  350)
* getdefaulttimeout() (socket モジュール): その他の関数<2>.  (line  371)
* getdlopenflags() (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line  780)
* getdoc() (inspect モジュール):         ソースコードの情報取得.
                                                             (line    6)
* getDOMImplementation() (xml.dom モジュール): モジュールコンテンツ<4>.
                                                             (line   17)
* getDTDHandler() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   32)
* getEffectiveLevel() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  148)
* getegid() (os モジュール):             プロセスのパラメーター.
                                                             (line  199)
* getElementsByTagName() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   60)
* getElementsByTagName() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   14)
* getElementsByTagNameNS() (xml.dom.Document のメソッド): Document オブジェクト.
                                                             (line   65)
* getElementsByTagNameNS() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   18)
* getencoder() (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  111)
* getencoding() (locale モジュール):     locale --- 国際化サービス.
                                                             (line  411)
* getEncoding() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   32)
* getEntityResolver() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   41)
* getenv() (os モジュール):              プロセスのパラメーター.
                                                             (line  158)
* getenvb() (os モジュール):             プロセスのパラメーター.
                                                             (line  173)
* getErrorHandler() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   52)
* geteuid() (os モジュール):             プロセスのパラメーター.
                                                             (line  206)
* getEvent() (xml.dom.pulldom.DOMEventStream のメソッド): DOMEventStream オブジェクト.
                                                             (line   11)
* getEventCategory() (logging.handlers.NTEventLogHandler のメソッド): NTEventLogHandler.
                                                             (line   41)
* getEventType() (logging.handlers.NTEventLogHandler のメソッド): NTEventLogHandler.
                                                             (line   47)
* getException() (xml.sax.SAXException のメソッド): SAXException オブジェクト.
                                                             (line   13)
* getFeature() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   70)
* getfile() (inspect モジュール):        ソースコードの情報取得.
                                                             (line   27)
* getFilesToDelete() (logging.handlers.TimedRotatingFileHandler のメソッド): TimedRotatingFileHandler.
                                                             (line  111)
* getfilesystemencodeerrors() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  821)
* getfilesystemencoding() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  789)
* getfirstweekday() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line   46)
* getfloat() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  244)
* getfqdn() (socket モジュール):         その他の関数<2>.    (line   96)
* getframeinfo() (inspect モジュール):   インタープリタスタック.
                                                             (line  117)
* getframerate() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   28)
* getfullargspec() (inspect モジュール): クラスと関数<2>.    (line   15)
* getgeneratorlocals() (inspect モジュール): Current State of Generators Coroutines and Asynchronous Generators.
                                                             (line   72)
* getgeneratorstate() (inspect モジュール): Current State of Generators Coroutines and Asynchronous Generators.
                                                             (line   12)
* getgid() (os モジュール):              プロセスのパラメーター.
                                                             (line  212)
* getgrall() (grp モジュール):           grp --- グループデータベース.
                                                             (line   60)
* getgrgid() (grp モジュール):           grp --- グループデータベース.
                                                             (line   45)
* getgrnam() (grp モジュール):           grp --- グループデータベース.
                                                             (line   54)
* getgrouplist() (os モジュール):        プロセスのパラメーター.
                                                             (line  221)
* getgroups() (os モジュール):           プロセスのパラメーター.
                                                             (line  232)
* getHandlerByName() (logging モジュール): モジュールレベルの関数.
                                                             (line  174)
* getHandlerNames() (logging モジュール): モジュールレベルの関数.
                                                             (line  181)
* getheader() (http.client.HTTPResponse のメソッド): HTTPResponse オブジェクト.
                                                             (line   25)
* getheaders() (http.client.HTTPResponse のメソッド): HTTPResponse オブジェクト.
                                                             (line   33)
* gethostbyaddr() (socket モジュール):   プロセスのパラメーター.
                                                             (line  574)
* gethostbyaddr() (socket モジュール) <1>: その他の関数<2>.  (line  154)
* gethostbyname_ex() (socket モジュール): その他の関数<2>.   (line  123)
* gethostbyname() (socket モジュール):   その他の関数<2>.    (line  108)
* gethostname() (socket モジュール):     プロセスのパラメーター.
                                                             (line  574)
* gethostname() (socket モジュール) <1>: その他の関数<2>.    (line  140)
* getincrementaldecoder() (codecs モジュール): codecs --- codec レジストリと基底クラス.
                                                             (line  135)
* getincrementalencoder() (codecs モジュール): codecs --- codec レジストリと基底クラス.
                                                             (line  127)
* getinfo() (zipfile.ZipFile のメソッド): ZipFile objects.   (line  121)
* getinnerframes() (inspect モジュール): インタープリタスタック.
                                                             (line  140)
* GetInputContext() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line   36)
* getint() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  237)
* getitem() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  204)
* getiterfunc (C type):                  Slot Type typedefs. (line   95)
* getitimer() (signal モジュール):       モジュールの内容<2>.
                                                             (line  462)
* getkey() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  244)
* GetLastError() (ctypes モジュール):    ユーティリティー関数.
                                                             (line  178)
* getLength() (xml.sax.xmlreader.Attributes のメソッド): Attributes インターフェース.
                                                             (line   11)
* getLevelName() (logging モジュール):   モジュールレベルの関数.
                                                             (line  144)
* getLevelNamesMapping() (logging モジュール): モジュールレベルの関数.
                                                             (line  135)
* getlimit() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  603)
* getline() (linecache モジュール):      linecache --- テキストラインへのランダムアクセス.
                                                             (line   23)
* getLineNumber() (xml.sax.xmlreader.Locator のメソッド): Locator オブジェクト.
                                                             (line   12)
* getloadavg() (os モジュール):          雑多なシステム情報. (line   49)
* getlocale() (locale モジュール):       locale --- 国際化サービス.
                                                             (line  375)
* getLogger() (logging モジュール):      モジュールレベルの関数.
                                                             (line    8)
* getLoggerClass() (logging モジュール): モジュールレベルの関数.
                                                             (line   21)
* getlogin() (os モジュール):            プロセスのパラメーター.
                                                             (line  254)
* getLogRecordFactory() (logging モジュール): モジュールレベルの関数.
                                                             (line   32)
* getMandatoryRelease() (__future__._Feature のメソッド): モジュールコンテンツ<5>.
                                                             (line   77)
* getmark() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   72)
* getmarkers() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   64)
* getmaxyx() (curses.window のメソッド): Window オブジェクト.
                                                             (line  251)
* getmember() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  106)
* getmembers_static() (inspect モジュール): 型とメンバー.    (line  373)
* getmembers() (inspect モジュール):     型とメンバー.       (line  360)
* getmembers() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  115)
* getMessage() (logging.LogRecord のメソッド): LogRecord オブジェクト.
                                                             (line   61)
* getMessage() (xml.sax.SAXException のメソッド): SAXException オブジェクト.
                                                             (line    9)
* getMessageID() (logging.handlers.NTEventLogHandler のメソッド): NTEventLogHandler.
                                                             (line   57)
* getmodule() (inspect モジュール):      ソースコードの情報取得.
                                                             (line   33)
* getmodulename() (inspect モジュール):  型とメンバー.       (line  391)
* getmouse() (curses モジュール):        関数<6>.            (line  159)
* getmro() (inspect モジュール):         クラスと関数<2>.    (line   79)
* getmtime() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  189)
* getName() (threading.Thread のメソッド): Thread objects.   (line  202)
* getNameByQName() (xml.sax.xmlreader.AttributesNS のメソッド): AttributesNS インターフェース.
                                                             (line   17)
* getnameinfo() (asyncio.loop のメソッド): DNS.              (line   11)
* getnameinfo() (socket モジュール):     その他の関数<2>.    (line  170)
* getnames() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  120)
* getNames() (xml.sax.xmlreader.Attributes のメソッド): Attributes インターフェース.
                                                             (line   15)
* getnchannels() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   19)
* getnframes() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   32)
* getnode() (uuid モジュール):           uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  174)
* getobjects() (sys モジュール):         sys --- システム固有のパラメーターと関数.
                                                             (line  932)
* getopt() (getopt モジュール):          getopt --- C-style parser for command line options.
                                                             (line   33)
* GetoptError:                           getopt --- C-style parser for command line options.
                                                             (line   94)
* getOptionalRelease() (__future__._Feature のメソッド): モジュールコンテンツ<5>.
                                                             (line   72)
* getouterframes() (inspect モジュール): インタープリタスタック.
                                                             (line  125)
* getoutput() (subprocess モジュール):   レガシーなシェル呼び出し関数.
                                                             (line   45)
* getpagesize() (resource モジュール):   リソースの使用状態. (line  102)
* getparams() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   46)
* getparyx() (curses.window のメソッド): Window オブジェクト.
                                                             (line  255)
* getpass() (getpass モジュール):        getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   17)
* GetPassWarning:                        getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   49)
* getpeercert() (ssl.SSLSocket のメソッド): SSL ソケット.    (line  149)
* getpeername() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  137)
* getpen() (turtle モジュール):          特別な Turtle のメソッド.
                                                             (line   51)
* getpgid() (os モジュール):             プロセスのパラメーター.
                                                             (line  264)
* getpgrp() (os モジュール):             プロセスのパラメーター.
                                                             (line  271)
* getpid() (os モジュール):              プロセスのパラメーター.
                                                             (line  277)
* getpos() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   29)
* getppid() (os モジュール):             プロセスのパラメーター.
                                                             (line  284)
* getpreferredencoding() (locale モジュール): locale --- 国際化サービス.
                                                             (line  387)
* getpriority() (os モジュール):         プロセスのパラメーター.
                                                             (line  295)
* getprofile() (sys モジュール):         sys --- システム固有のパラメーターと関数.
                                                             (line  957)
* getprofile() (threading モジュール):   リファレンス<2>.    (line  149)
* getProperty() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   83)
* getprotobyname() (socket モジュール):  その他の関数<2>.    (line  190)
* getproxies() (urllib.request モジュール): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  211)
* getPublicId() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   10)
* getPublicId() (xml.sax.xmlreader.Locator のメソッド): Locator オブジェクト.
                                                             (line   16)
* getpwall() (pwd モジュール):           pwd --- パスワードデータベース.
                                                             (line   67)
* getpwnam() (pwd モジュール):           pwd --- パスワードデータベース.
                                                             (line   62)
* getpwuid() (pwd モジュール):           pwd --- パスワードデータベース.
                                                             (line   58)
* getQNameByName() (xml.sax.xmlreader.AttributesNS のメソッド): AttributesNS インターフェース.
                                                             (line   22)
* getQNames() (xml.sax.xmlreader.AttributesNS のメソッド): AttributesNS インターフェース.
                                                             (line   26)
* getquota() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  117)
* getquotaroot() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  122)
* getrandbits() (random モジュール):     整数用の関数.       (line   36)
* getrandbits() (random.Random のメソッド): 他の生成器.      (line   42)
* getrandom() (os モジュール):           乱数<2>.            (line    6)
* getreader() (codecs モジュール):       codecs --- codec レジストリと基底クラス.
                                                             (line  143)
* getrecursionlimit() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line  866)
* getrefcount() (sys モジュール):        sys --- システム固有のパラメーターと関数.
                                                             (line  848)
* GetReparseDeferralEnabled() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  109)
* getresgid() (os モジュール):           プロセスのパラメーター.
                                                             (line  342)
* getresponse() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line   81)
* getresuid() (os モジュール):           プロセスのパラメーター.
                                                             (line  333)
* getrlimit() (resource モジュール):     リソースの制限.     (line   26)
* getroot() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   35)
* getrusage() (resource モジュール):     リソースの使用状態. (line    8)
* getsampwidth() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   24)
* getscreen() (turtle モジュール):       特別な Turtle のメソッド.
                                                             (line   62)
* getservbyname() (socket モジュール):   その他の関数<2>.    (line  201)
* getservbyport() (socket モジュール):   その他の関数<2>.    (line  213)
* GetSetDescriptorType (types モジュール): 標準的なインタプリタ型.
                                                             (line  202)
* getshapes() (turtle モジュール):       設定と特殊なメソッド.
                                                             (line   63)
* getsid() (os モジュール):              プロセスのパラメーター.
                                                             (line  532)
* getsignal() (signal モジュール):       モジュールの内容<2>.
                                                             (line  310)
* getsitepackages() (site モジュール):   モジュールの内容<5>.
                                                             (line   58)
* getsize() (os.path モジュール):        os path --- 一般的なパス名操作.
                                                             (line  210)
* getsizeof() (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line  874)
* getsockname() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  144)
* getsockopt() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  150)
* getsource() (inspect モジュール):      ソースコードの情報取得.
                                                             (line   59)
* getsourcefile() (inspect モジュール):  ソースコードの情報取得.
                                                             (line   38)
* getsourcelines() (inspect モジュール): ソースコードの情報取得.
                                                             (line   45)
* getstate() (codecs.IncrementalDecoder のメソッド): IncrementalDecoder オブジェクト.
                                                             (line   44)
* getstate() (codecs.IncrementalEncoder のメソッド): IncrementalEncoder オブジェクト.
                                                             (line   42)
* getstate() (random モジュール):        保守 bookkeeping 関数.
                                                             (line   32)
* getstate() (random.Random のメソッド): 他の生成器.         (line   24)
* getstatusoutput() (subprocess モジュール): レガシーなシェル呼び出し関数.
                                                             (line   11)
* getstr() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  260)
* getSubject() (logging.handlers.SMTPHandler のメソッド): SMTPHandler.
                                                             (line   37)
* getswitchinterval() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line  895)
* getSystemId() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   18)
* getSystemId() (xml.sax.xmlreader.Locator のメソッド): Locator オブジェクト.
                                                             (line   20)
* getsyx() (curses モジュール):          関数<6>.            (line  178)
* gettarinfo() (tarfile.TarFile のメソッド): TarFile オブジェクト.
                                                             (line  308)
* gettempdir() (tempfile モジュール):    tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  317)
* gettempdirb() (tempfile モジュール):   tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  348)
* gettempprefix() (tempfile モジュール): tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  354)
* gettempprefixb() (tempfile モジュール): tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  359)
* getter (C type):                       Defining Getters and Setters.
                                                             (line   33)
* getTestCaseNames() (unittest.TestLoader のメソッド): テストのロードと起動.
                                                             (line  108)
* gettext() (gettext モジュール):        GNU gettext API.    (line   33)
* gettext() (gettext.GNUTranslations のメソッド): GNUTranslations クラス.
                                                             (line   37)
* gettext() (gettext.NullTranslations のメソッド): NullTranslations クラス.
                                                             (line   38)
* gettext() (locale モジュール):         メッセージカタログへのアクセス.
                                                             (line    6)
* gettimeout() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  174)
* gettrace() (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line  962)
* gettrace() (threading モジュール):     リファレンス<2>.    (line  127)
* getturtle() (turtle モジュール):       特別な Turtle のメソッド.
                                                             (line   51)
* getType() (xml.sax.xmlreader.Attributes のメソッド): Attributes インターフェース.
                                                             (line   19)
* getuid() (os モジュール):              プロセスのパラメーター.
                                                             (line  351)
* getunicodeinternedsize() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line  758)
* geturl() (http.client.HTTPResponse のメソッド): HTTPResponse オブジェクト.
                                                             (line   80)
* geturl() (urllib.parse.urllib.parse.SplitResult のメソッド): 構造化された解析結果.
                                                             (line   12)
* geturl() (urllib.response.addinfourl のメソッド): urllib response --- Response classes used by urllib.
                                                             (line   30)
* getuser() (getpass モジュール):        getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   54)
* getuserbase() (site モジュール):       モジュールの内容<5>.
                                                             (line   64)
* getusersitepackages() (site モジュール): モジュールの内容<5>.
                                                             (line   72)
* getvalue() (io.BytesIO のメソッド):    バッファ付きストリーム.
                                                             (line   39)
* getvalue() (io.StringIO のメソッド):   テキスト I/O<2>.    (line  264)
* getValue() (xml.sax.xmlreader.Attributes のメソッド): Attributes インターフェース.
                                                             (line   23)
* getValueByQName() (xml.sax.xmlreader.AttributesNS のメソッド): AttributesNS インターフェース.
                                                             (line   13)
* getwch() (msvcrt モジュール):          コンソール I/O 関連.
                                                             (line   21)
* getwche() (msvcrt モジュール):         コンソール I/O 関連.
                                                             (line   30)
* getweakrefcount() (weakref モジュール): weakref --- Weak references.
                                                             (line  149)
* getweakrefs() (weakref モジュール):    weakref --- Weak references.
                                                             (line  153)
* getwelcome() (ftplib.FTP のメソッド):  FTP オブジェクト.   (line  121)
* getwelcome() (poplib.POP3 のメソッド): POP3 オブジェクト.  (line   19)
* getwin() (curses モジュール):          関数<6>.            (line  184)
* getwindowsversion() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line  971)
* getwriter() (codecs モジュール):       codecs --- codec レジストリと基底クラス.
                                                             (line  151)
* getxattr() (os モジュール):            Linux 拡張属性.     (line   10)
* getyx() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  274)
* gid (tarfile.TarInfo の属性):          TarInfo オブジェクト.
                                                             (line  115)
* GIL:                                   用語集<2>.          (line  763)
* gil (sys.flags の属性):                sys --- システム固有のパラメーターと関数.
                                                             (line  583)
* glob() (glob モジュール):              glob --- Unix 形式のパス名のパターン展開.
                                                             (line   29)
* glob() (pathlib.Path のメソッド):      ディレクトリを読む. (line   30)
* Global (ast のクラス):                 関数およびクラス定義.
                                                             (line  144)
* global interpreter lock:               スレッド状態 thread state とグローバルインタプリタロック global interpreter lock.
                                                             (line    6)
* global interpreter lock <1>:           用語集<2>.          (line  767)
* global state:                          用語集<2>.          (line  794)
* global_enum() (enum モジュール):       ユーティリティとデコレータ.
                                                             (line   93)
* globs (doctest.DocTest の属性):        DocTest オブジェクト.
                                                             (line   22)
* gmtime() (time モジュール):            関数<5>.            (line  139)
* gname (tarfile.TarInfo の属性):        TarInfo オブジェクト.
                                                             (line  131)
* GNOME:                                 Catalog コンストラクタ.
                                                             (line    6)
* GNU_FORMAT (tarfile モジュール):       tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  382)
* gnu_getopt() (getopt モジュール):      getopt --- C-style parser for command line options.
                                                             (line   73)
* GNUTranslations (gettext のクラス):    GNUTranslations クラス.
                                                             (line   33)
* GNUTYPE_LONGLINK (tarfile モジュール): tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  366)
* GNUTYPE_LONGNAME (tarfile モジュール): tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  362)
* GNUTYPE_SPARSE (tarfile モジュール):   tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  370)
* go() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  113)
* got (doctest.DocTestFailure の属性):   デバッグ.           (line  199)
* goto() (turtle モジュール):            Turtle の動き.      (line   74)
* grantpt() (os モジュール):             ファイル記述子の操作.
                                                             (line  246)
* GREATER (token モジュール):            token --- Python 解析木で使われる定数.
                                                             (line  245)
* GREATEREQUAL (token モジュール):       token --- Python 解析木で使われる定数.
                                                             (line  272)
* greedy (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  313)
* GRND_NONBLOCK (os モジュール):         乱数<2>.            (line   77)
* GRND_RANDOM (os モジュール):           乱数<2>.            (line   90)
* Group (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  450)
* group() (pathlib.Path のメソッド):     パーミッションと所有者.
                                                             (line   23)
* group() (re.Match のメソッド):         マッチオブジェクト. (line   35)
* groupby() (itertools モジュール):      Itertool関数.       (line  304)
* groupdict() (re.Match のメソッド):     マッチオブジェクト. (line  130)
* groupindex (re.Pattern の属性):        正規表現オブジェクト.
                                                             (line  115)
* groups (email.headerregistry.AddressHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  185)
* groups (re.Pattern の属性):            正規表現オブジェクト.
                                                             (line  111)
* groups() (re.Match のメソッド):        マッチオブジェクト. (line  108)
* GS (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  111)
* Gt (ast のクラス):                     式 expression<2>.   (line  110)
* gt() (operator モジュール):            operator --- 関数形式の標準演算子.
                                                             (line   24)
* GtE (ast のクラス):                    式 expression<2>.   (line  110)
* guard:                                 ガード<2>.          (line    6)
* guess_all_extensions() (mimetypes モジュール): mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line   68)
* guess_all_extensions() (mimetypes.MimeTypes のメソッド): MimeTypes objects.
                                                             (line   69)
* guess_extension() (mimetypes モジュール): mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line   80)
* guess_extension() (mimetypes.MimeTypes のメソッド): MimeTypes objects.
                                                             (line   52)
* guess_file_type() (mimetypes モジュール): mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line   59)
* guess_file_type() (mimetypes.MimeTypes のメソッド): MimeTypes objects.
                                                             (line   62)
* guess_scheme() (wsgiref.util モジュール): wsgiref util -- WSGI environment utilities.
                                                             (line   13)
* guess_type() (mimetypes モジュール):   mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line   24)
* guess_type() (mimetypes.MimeTypes のメソッド): MimeTypes objects.
                                                             (line   57)
* GUI:                                   Graphical user interfaces with Tk.
                                                             (line    6)
* gzip コマンドラインオプション; -best:  コマンドラインオプション.
                                                             (line   14)
* gzip コマンドラインオプション; -d:     コマンドラインオプション.
                                                             (line   18)
* gzip コマンドラインオプション; -decompress: コマンドラインオプション.
                                                             (line   18)
* gzip コマンドラインオプション; -fast:  コマンドラインオプション.
                                                             (line   10)
* gzip コマンドラインオプション; -h:     コマンドラインオプション.
                                                             (line   22)
* gzip コマンドラインオプション; -help:  コマンドラインオプション.
                                                             (line   22)
* gzip コマンドラインオプション; file:   コマンドラインオプション.
                                                             (line    6)
* GzipFile (gzip のクラス):              gzip --- gzip ファイルのサポート.
                                                             (line   76)
* halfdelay() (curses モジュール):       関数<6>.            (line  224)
* Handle (asyncio のクラス):             コールバックのハンドル.
                                                             (line    6)
* handle_charref() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   89)
* handle_comment() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   98)
* handle_data() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   77)
* handle_decl() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line  111)
* handle_defect() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  233)
* handle_endtag() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   62)
* handle_entityref() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   82)
* handle_error() (socketserver.BaseServer のメソッド): Serverオブジェクト<2>.
                                                             (line  136)
* handle_expect_100() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  254)
* handle_one_request() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  248)
* handle_pi() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line  119)
* handle_request() (socketserver.BaseServer のメソッド): Serverオブジェクト<2>.
                                                             (line   21)
* handle_request() (xmlrpc.server.CGIXMLRPCRequestHandler のメソッド): CGIXMLRPCRequestHandler.
                                                             (line   49)
* handle_startendtag() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   69)
* handle_starttag() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   45)
* handle_timeout() (socketserver.BaseServer のメソッド): Serverオブジェクト<2>.
                                                             (line  146)
* handle() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  241)
* handle() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   85)
* handle() (logging.handlers.QueueListener のメソッド): QueueListener.
                                                             (line   74)
* handle() (logging.Logger のメソッド):  ロガーオブジェクト. (line  355)
* handle() (logging.NullHandler のメソッド): NullHandler.    (line   20)
* handle() (socketserver.BaseRequestHandler のメソッド): Request Handler Objects.
                                                             (line   19)
* handle() (wsgiref.simple_server.WSGIRequestHandler のメソッド): wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line  106)
* handleError() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   91)
* handleError() (logging.handlers.SocketHandler のメソッド): SocketHandler.
                                                             (line   33)
* Handler (logging のクラス):            ハンドラオブジェクト.
                                                             (line   12)
* handlers (logging.Logger の属性):      ロガーオブジェクト. (line   85)
* Handlers (signal のクラス):            モジュールの内容<2>.
                                                             (line   24)
* hardlink_to() (pathlib.Path のメソッド): ファイルとディレクトリの作成.
                                                             (line   72)
* harmonic_mean() (statistics モジュール): 関数の詳細.       (line   93)
* HAS_ALPN (ssl モジュール):             定数<9>.            (line  384)
* has_children() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line   99)
* has_colors() (curses モジュール):      関数<6>.            (line  191)
* has_default() (typing.ParamSpec のメソッド): Building generic types and type aliases.
                                                             (line  494)
* has_default() (typing.TypeVar のメソッド): Building generic types and type aliases.
                                                             (line  237)
* has_default() (typing.TypeVarTuple のメソッド): Building generic types and type aliases.
                                                             (line  381)
* has_dualstack_ipv6() (socket モジュール): ソケットの作成.  (line  150)
* HAS_ECDH (ssl モジュール):             定数<9>.            (line  400)
* has_extended_color_support() (curses モジュール): 関数<6>. (line  196)
* has_extn() (smtplib.SMTP のメソッド):  SMTP オブジェクト.  (line   82)
* has_header() (csv.Sniffer のメソッド): モジュールコンテンツ<3>.
                                                             (line  238)
* has_header() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line   96)
* has_ic() (curses モジュール):          関数<6>.            (line  207)
* has_il() (curses モジュール):          関数<6>.            (line  213)
* has_ipv6 (socket モジュール):          定数<8>.            (line  302)
* has_key() (curses モジュール):         関数<6>.            (line  219)
* has_location (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  433)
* HAS_NEVER_CHECK_COMMON_NAME (ssl モジュール): 定数<9>.     (line  392)
* has_nonstandard_attr() (http.cookiejar.Cookie のメソッド): Cookieオブジェクト<2>.
                                                             (line   99)
* HAS_NPN (ssl モジュール):              定数<9>.            (line  415)
* has_option() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  139)
* has_option() (optparse.OptionParser のメソッド): オプション解析器への問い合わせと操作.
                                                             (line   43)
* HAS_PHA (ssl モジュール):              定数<9>.            (line  473)
* HAS_PSK (ssl モジュール):              定数<9>.            (line  467)
* has_section() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  129)
* HAS_SNI (ssl モジュール):              定数<9>.            (line  408)
* HAS_SSLv2 (ssl モジュール):            定数<9>.            (line  425)
* HAS_SSLv3 (ssl モジュール):            定数<9>.            (line  432)
* has_ticket (ssl.SSLSession の属性):    SSL セッション.     (line   20)
* HAS_TLSv1 (ssl モジュール):            定数<9>.            (line  439)
* HAS_TLSv1_1 (ssl モジュール):          定数<9>.            (line  446)
* HAS_TLSv1_2 (ssl モジュール):          定数<9>.            (line  453)
* HAS_TLSv1_3 (ssl モジュール):          定数<9>.            (line  460)
* hasarg (dis モジュール):               命令コードコレクション.
                                                             (line   26)
* hasAttribute() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   22)
* hasAttributeNS() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   27)
* hasAttributes() (xml.dom.Node のメソッド): Node オブジェクト.
                                                             (line   92)
* hasChildNodes() (xml.dom.Node のメソッド): Node オブジェクト.
                                                             (line   96)
* hascompare (dis モジュール):           命令コードコレクション.
                                                             (line   59)
* hasconst (dis モジュール):             命令コードコレクション.
                                                             (line   32)
* hasexc (dis モジュール):               命令コードコレクション.
                                                             (line   63)
* hasFeature() (xml.dom.DOMImplementation のメソッド): DOMImplementation オブジェクト.
                                                             (line   12)
* hasfree (dis モジュール):              命令コードコレクション.
                                                             (line   36)
* hash_bits (sys.hash_info の属性):      sys --- システム固有のパラメーターと関数.
                                                             (line 1079)
* hash_info (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 1048)
* hash_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line   63)
* hash_randomization (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  563)
* hash-based pyc:                        用語集<2>.          (line  802)
* hash.block_size (hashlib モジュール):  Hash Objects.       (line   13)
* hash.digest_size (hashlib モジュール): Hash Objects.       (line    9)
* hashable:                              辞書表示.           (line   35)
* hashable <1>:                          用語集<2>.          (line  809)
* Hashable (collections.abc のクラス):   コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   10)
* Hashable (typing のクラス):            Aliases to other ABCs in collections abc.
                                                             (line   54)
* hasHandlers() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  371)
* hashfunc (C type):                     Slot Type typedefs. (line   85)
* hasjabs (dis モジュール):              命令コードコレクション.
                                                             (line   76)
* hasjrel (dis モジュール):              命令コードコレクション.
                                                             (line   69)
* hasjump (dis モジュール):              命令コードコレクション.
                                                             (line   48)
* haslocal (dis モジュール):             命令コードコレクション.
                                                             (line   55)
* hasname (dis モジュール):              命令コードコレクション.
                                                             (line   44)
* HAVE_ARGUMENT (opcode):                Python バイトコード命令.
                                                             (line 1318)
* HAVE_CONTEXTVAR (decimal モジュール):  定数<4>.            (line   35)
* HAVE_DOCSTRINGS (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  183)
* HAVE_THREADS (decimal モジュール):     定数<4>.            (line   28)
* HCI_CHANNEL_CONTROL (socket モジュール): 定数<8>.          (line  393)
* HCI_CHANNEL_LOGGING (socket モジュール): 定数<8>.          (line  393)
* HCI_CHANNEL_MONITOR (socket モジュール): 定数<8>.          (line  393)
* HCI_CHANNEL_RAW (socket モジュール):   定数<8>.            (line  393)
* HCI_CHANNEL_USER (socket モジュール):  定数<8>.            (line  393)
* HCI_DATA_DIR (socket モジュール):      定数<8>.            (line  371)
* HCI_DEV_NONE (socket モジュール):      定数<8>.            (line  384)
* HCI_FILTER (socket モジュール):        定数<8>.            (line  371)
* HCI_TIME_STAMP (socket モジュール):    定数<8>.            (line  371)
* Header (email.header のクラス):        email header 国際化されたヘッダー.
                                                             (line   58)
* header_encode_lines() (email.charset.Charset のメソッド): email charset 文字集合の表現.
                                                             (line  129)
* header_encode() (email.charset.Charset のメソッド): email charset 文字集合の表現.
                                                             (line  122)
* header_encoding (email.charset.Charset の属性): email charset 文字集合の表現.
                                                             (line   59)
* header_factory (email.policy.EmailPolicy の属性): email policy Policy Objects.
                                                             (line  406)
* header_fetch_parse() (email.policy.Compat32 のメソッド): email policy Policy Objects.
                                                             (line  591)
* header_fetch_parse() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  456)
* header_fetch_parse() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  317)
* header_items() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line  127)
* header_max_count() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  433)
* header_max_count() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  258)
* header_offset (zipfile.ZipInfo の属性): ZipInfo objects.   (line  147)
* header_source_parse() (email.policy.Compat32 のメソッド): email policy Policy Objects.
                                                             (line  579)
* header_source_parse() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  439)
* header_source_parse() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  279)
* header_store_parse() (email.policy.Compat32 のメソッド): email policy Policy Objects.
                                                             (line  587)
* header_store_parse() (email.policy.EmailPolicy のメソッド): email policy Policy Objects.
                                                             (line  447)
* header_store_parse() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  301)
* HeaderDefect:                          email errors Exception and Defect classes.
                                                             (line   60)
* HeaderError:                           tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  276)
* HeaderParseError:                      email errors Exception and Defect classes.
                                                             (line   26)
* HeaderParser (email.parser のクラス):  Parser API.         (line  109)
* HeaderRegistry (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  293)
* headers (http.client.HTTPResponse の属性): HTTPResponse オブジェクト.
                                                             (line   57)
* headers (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  158)
* headers (urllib.error.HTTPError の属性): urllib error --- urllib request によって送出される例外クラス.
                                                             (line   54)
* headers (urllib.response.addinfourl の属性): urllib response --- Response classes used by urllib.
                                                             (line   19)
* Headers (wsgiref.headers のクラス):    wsgiref headers -- WSGI response header tools.
                                                             (line    9)
* headers (xmlrpc.client.ProtocolError の属性): ProtocolError オブジェクト.
                                                             (line   24)
* HeaderWriteError:                      email errors Exception and Defect classes.
                                                             (line   50)
* heading() (tkinter.ttk.Treeview のメソッド): ttk Treeview. (line  100)
* heading() (turtle モジュール):         Turtle の状態を知る.
                                                             (line   56)
* heapify_max() (heapq モジュール):      heapq --- ヒープキューアルゴリズム.
                                                             (line   95)
* heapify() (heapq モジュール):          heapq --- ヒープキューアルゴリズム.
                                                             (line   55)
* heapmin() (msvcrt モジュール):         その多の関数.       (line    6)
* heappop_max() (heapq モジュール):      heapq --- ヒープキューアルゴリズム.
                                                             (line  108)
* heappop() (heapq モジュール):          heapq --- ヒープキューアルゴリズム.
                                                             (line   64)
* heappush_max() (heapq モジュール):     heapq --- ヒープキューアルゴリズム.
                                                             (line  101)
* heappush() (heapq モジュール):         heapq --- ヒープキューアルゴリズム.
                                                             (line   59)
* heappushpop_max() (heapq モジュール):  heapq --- ヒープキューアルゴリズム.
                                                             (line  117)
* heappushpop() (heapq モジュール):      heapq --- ヒープキューアルゴリズム.
                                                             (line   71)
* heapreplace_max() (heapq モジュール):  heapq --- ヒープキューアルゴリズム.
                                                             (line  126)
* heapreplace() (heapq モジュール):      heapq --- ヒープキューアルゴリズム.
                                                             (line   77)
* helo_resp (smtplib.SMTP の属性):       SMTP オブジェクト.  (line  344)
* helo() (smtplib.SMTP のメソッド):      SMTP オブジェクト.  (line   47)
* help (optparse.Option の属性):         オプション属性.     (line   80)
* help (pdb command):                    Debugger commands.  (line   74)
* help;online:                           pydoc --- ドキュメント生成とオンラインヘルプシステム.
                                                             (line    8)
* herror:                                例外<18>.           (line   13)
* hex (uuid.UUID の属性):                uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  140)
* hex() (bytearray のメソッド):          bytearray オブジェクト.
                                                             (line   58)
* hex() (bytes のメソッド):              バイトオブジェクト. (line   84)
* hex() (float のメソッド):              浮動小数点数に対する追加のメソッド.
                                                             (line   44)
* hex() (memoryview のメソッド):         メモリビュー.       (line  192)
* hexdigest() (hashlib.hash のメソッド): Hash Objects.       (line   43)
* hexdigest() (hashlib.shake のメソッド): SHAKE 可変長ダイジェスト.
                                                             (line   21)
* hexdigest() (hmac.HMAC のメソッド):    hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   74)
* hexdigits (string モジュール):         文字列定数.         (line   27)
* hexlify() (binascii モジュール):       binascii --- バイナリ と ASCII 間の変換.
                                                             (line  116)
* hexversion (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1097)
* hidden() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   25)
* hide_cookie2 (http.cookiejar.CookiePolicy の属性): CookiePolicy オブジェクト.
                                                             (line   79)
* hide() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   30)
* hide() (tkinter.ttk.Notebook のメソッド): ttk Notebook.    (line   23)
* hideturtle() (turtle モジュール):      可視性.             (line    6)
* HierarchyRequestErr:                   例外<23>.           (line   28)
* HIGH_PRIORITY_CLASS (subprocess モジュール): Windows Constants.
                                                             (line   82)
* HIGHEST_PROTOCOL (pickle モジュール):  モジュールインターフェース.
                                                             (line   14)
* hits (bdb.Breakpoint の属性):          bdb --- デバッガーフレームワーク.
                                                             (line  125)
* HKEY_CLASSES_ROOT (winreg モジュール): HKEY_* 定数.        (line    6)
* HKEY_CURRENT_CONFIG (winreg モジュール): HKEY_* 定数.      (line   37)
* HKEY_CURRENT_USER (winreg モジュール): HKEY_* 定数.        (line   12)
* HKEY_DYN_DATA (winreg モジュール):     HKEY_* 定数.        (line   42)
* HKEY_LOCAL_MACHINE (winreg モジュール): HKEY_* 定数.       (line   19)
* HKEY_PERFORMANCE_DATA (winreg モジュール): HKEY_* 定数.    (line   31)
* HKEY_USERS (winreg モジュール):        HKEY_* 定数.        (line   25)
* hline() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  279)
* hls_to_rgb() (colorsys モジュール):    colorsys --- 色体系間の変換.
                                                             (line   40)
* HMAC (hmac のクラス):                  hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   47)
* HOME:                                  os path<5>.         (line   15)
* HOME <1>:                              Python API の変更<6>.
                                                             (line  118)
* HOME <2>:                              Windows<48>.        (line   15)
* HOME <3>:                              Windows<48>.        (line   18)
* HOME <4>:                              os path --- 一般的なパス名操作.
                                                             (line  149)
* HOME <5>:                              os path --- 一般的なパス名操作.
                                                             (line  167)
* HOME <6>:                              Tkinter モジュール. (line   65)
* home() (pathlib.Path のクラスメソッド): パスの展開と解決.  (line    6)
* home() (turtle モジュール):            Turtle の動き.      (line  193)
* HOMEDRIVE:                             os path --- 一般的なパス名操作.
                                                             (line  156)
* HOMEPATH:                              os path --- 一般的なパス名操作.
                                                             (line  156)
* hook_compressed() (fileinput モジュール): fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  194)
* hook_encoded() (fileinput モジュール): fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  214)
* hooks;import:                          インポートフック.   (line    6)
* hooks;meta:                            インポートフック.   (line    6)
* hooks;パス:                            インポートフック.   (line    6)
* host (urllib.request.Request の属性):  Request オブジェクト.
                                                             (line   25)
* hostmask (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line   95)
* hostmask (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  315)
* hostname_checks_common_name (ssl.SSLContext の属性): SSL コンテキスト.
                                                             (line  613)
* hosts (netrc.netrc の属性):            netrc オブジェクト. (line   25)
* hosts() (ipaddress.IPv4Network のメソッド): Network オブジェクト.
                                                             (line  136)
* hosts() (ipaddress.IPv6Network のメソッド): Network オブジェクト.
                                                             (line  333)
* hour (datetime.datetime の属性):       datetime objects.   (line  320)
* hour (datetime.time の属性):           time objects.       (line   50)
* HRESULT (ctypes のクラス):             基本データ型<2>.    (line  233)
* hresult (ctypes.COMError の属性):      例外<10>.           (line   15)
* hStdError (subprocess.STARTUPINFO の属性): Windows Popen ヘルパー.
                                                             (line   42)
* hStdInput (subprocess.STARTUPINFO の属性): Windows Popen ヘルパー.
                                                             (line   28)
* hStdOutput (subprocess.STARTUPINFO の属性): Windows Popen ヘルパー.
                                                             (line   35)
* hsv_to_rgb() (colorsys モジュール):    colorsys --- 色体系間の変換.
                                                             (line   48)
* HT (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   48)
* ht() (turtle モジュール):              可視性.             (line    6)
* HTML:                                  html parser --- HTML と XHTML のシンプルなパーサー.
                                                             (line    8)
* HTML <1>:                              urllib request Restrictions.
                                                             (line   29)
* html5 (html.entities モジュール):      html entities --- HTML 一般実体の定義.
                                                             (line   14)
* HTMLCalendar (calendar のクラス):      calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  214)
* HtmlDiff (difflib のクラス):           difflib --- 差分の計算の補助.
                                                             (line   80)
* HTMLParser (html.parser のクラス):     html parser --- HTML と XHTML のシンプルなパーサー.
                                                             (line   14)
* htonl() (socket モジュール):           その他の関数<2>.    (line  242)
* htons() (socket モジュール):           その他の関数<2>.    (line  249)
* HTTP (email.policy モジュール):        email policy Policy Objects.
                                                             (line  523)
* http_error_301() (urllib.request.HTTPRedirectHandler のメソッド): HTTPRedirectHandler オブジェクト.
                                                             (line   35)
* http_error_302() (urllib.request.HTTPRedirectHandler のメソッド): HTTPRedirectHandler オブジェクト.
                                                             (line   42)
* http_error_303() (urllib.request.HTTPRedirectHandler のメソッド): HTTPRedirectHandler オブジェクト.
                                                             (line   48)
* http_error_307() (urllib.request.HTTPRedirectHandler のメソッド): HTTPRedirectHandler オブジェクト.
                                                             (line   54)
* http_error_308() (urllib.request.HTTPRedirectHandler のメソッド): HTTPRedirectHandler オブジェクト.
                                                             (line   61)
* http_error_401() (urllib.request.HTTPBasicAuthHandler のメソッド): HTTPBasicAuthHandler オブジェクト.
                                                             (line    6)
* http_error_401() (urllib.request.HTTPDigestAuthHandler のメソッド): HTTPDigestAuthHandler オブジェクト.
                                                             (line    6)
* http_error_407() (urllib.request.ProxyBasicAuthHandler のメソッド): ProxyBasicAuthHandler オブジェクト.
                                                             (line    6)
* http_error_407() (urllib.request.ProxyDigestAuthHandler のメソッド): ProxyDigestAuthHandler オブジェクト.
                                                             (line    6)
* http_error_auth_reqed() (urllib.request.AbstractBasicAuthHandler のメソッド): AbstractBasicAuthHandler オブジェクト.
                                                             (line    6)
* http_error_auth_reqed() (urllib.request.AbstractDigestAuthHandler のメソッド): AbstractDigestAuthHandler オブジェクト.
                                                             (line    6)
* http_error_default() (urllib.request.BaseHandler のメソッド): BaseHandler オブジェクト.
                                                             (line   67)
* http_open() (urllib.request.HTTPHandler のメソッド): HTTPHandler オブジェクト.
                                                             (line    6)
* HTTP_PORT (http.client モジュール):    http client --- HTTP プロトコルクライアント.
                                                             (line  206)
* http_response() (urllib.request.HTTPErrorProcessor のメソッド): HTTPErrorProcessor オブジェクト.
                                                             (line    6)
* http_version (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  300)
* HTTP;http (標準モジュール):            http --- HTTP モジュール群.
                                                             (line    8)
* HTTP;http.client (標準モジュール):     http client --- HTTP プロトコルクライアント.
                                                             (line    8)
* HTTP;プロトコル:                       urllib request Restrictions.
                                                             (line    6)
* HTTP;プロトコル <1>:                   urllib request Restrictions.
                                                             (line   29)
* HTTP;プロトコル <2>:                   http --- HTTP モジュール群.
                                                             (line    8)
* HTTP;プロトコル <3>:                   http client --- HTTP プロトコルクライアント.
                                                             (line    8)
* HTTP;プロトコル <4>:                   http server --- HTTP サーバー.
                                                             (line    8)
* http.server コマンドラインオプション; -b: コマンドライン・インターフェース<7>.
                                                             (line   21)
* http.server コマンドラインオプション; -bind: コマンドライン・インターフェース<7>.
                                                             (line   21)
* http.server コマンドラインオプション; -cgi: コマンドライン・インターフェース<7>.
                                                             (line   54)
* http.server コマンドラインオプション; -d: コマンドライン・インターフェース<7>.
                                                             (line   34)
* http.server コマンドラインオプション; -directory: コマンドライン・インターフェース<7>.
                                                             (line   34)
* http.server コマンドラインオプション; -p: コマンドライン・インターフェース<7>.
                                                             (line   44)
* http.server コマンドラインオプション; -protocol: コマンドライン・インターフェース<7>.
                                                             (line   44)
* http.server コマンドラインオプション; -tls-cert: コマンドライン・インターフェース<7>.
                                                             (line   70)
* http.server コマンドラインオプション; -tls-key: コマンドライン・インターフェース<7>.
                                                             (line   78)
* http.server コマンドラインオプション; -tls-password-file: コマンドライン・インターフェース<7>.
                                                             (line   86)
* http.server コマンドラインオプション; port: コマンドライン・インターフェース<7>.
                                                             (line   14)
* http.server;セキュリティ:              セキュリティで考慮すべき点<5>.
                                                             (line    6)
* HTTPBasicAuthHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  408)
* HTTPConnection (http.client のクラス): http client --- HTTP プロトコルクライアント.
                                                             (line   32)
* HTTPCookieProcessor (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  341)
* httpd:                                 http server --- HTTP サーバー.
                                                             (line    8)
* HTTPDefaultErrorHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  332)
* HTTPDigestAuthHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  437)
* HTTPError:                             urllib error --- urllib request によって送出される例外クラス.
                                                             (line   31)
* HTTPErrorProcessor (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  496)
* HTTPException:                         http client --- HTTP プロトコルクライアント.
                                                             (line  136)
* HTTPHandler (logging.handlers のクラス): HTTPHandler.      (line   10)
* HTTPHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  460)
* HTTPMessage (http.client のクラス):    HTTPMessage オブジェクト.
                                                             (line    6)
* HTTPMethod (http のクラス):            HTTP ステータスコードカテゴリ.
                                                             (line   38)
* httponly (http.cookies.Morsel の属性): Morselオブジェクト. (line   13)
* HTTPPasswordMgr (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  367)
* HTTPPasswordMgrWithDefaultRealm (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  372)
* HTTPPasswordMgrWithPriorAuth (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  378)
* HTTPRedirectHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  337)
* HTTPResponse (http.client のクラス):   http client --- HTTP プロトコルクライアント.
                                                             (line  103)
* https_open() (urllib.request.HTTPSHandler のメソッド): HTTPSHandler オブジェクト.
                                                             (line    6)
* HTTPS_PORT (http.client モジュール):   http client --- HTTP プロトコルクライアント.
                                                             (line  210)
* https_response() (urllib.request.HTTPErrorProcessor のメソッド): HTTPErrorProcessor オブジェクト.
                                                             (line   18)
* HTTPSConnection (http.client のクラス): http client --- HTTP プロトコルクライアント.
                                                             (line   64)
* HTTPServer (http.server のクラス):     http server --- HTTP サーバー.
                                                             (line   30)
* HTTPSHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  464)
* HTTPSServer (http.server のクラス):    http server --- HTTP サーバー.
                                                             (line   47)
* HTTPStatus (http のクラス):            http --- HTTP モジュール群.
                                                             (line   28)
* HV_GUID_BROADCAST (socket モジュール): 定数<8>.            (line  445)
* HV_GUID_CHILDREN (socket モジュール):  定数<8>.            (line  445)
* HV_GUID_LOOPBACK (socket モジュール):  定数<8>.            (line  445)
* HV_GUID_PARENT (socket モジュール):    定数<8>.            (line  445)
* HV_GUID_WILDCARD (socket モジュール):  定数<8>.            (line  445)
* HV_GUID_ZERO (socket モジュール):      定数<8>.            (line  445)
* HV_PROTOCOL_RAW (socket モジュール):   定数<8>.            (line  445)
* HVSOCKET_ADDRESS_FLAG_PASSTHRU (socket モジュール): 定数<8>.
                                                             (line  445)
* HVSOCKET_CONNECT_TIMEOUT (socket モジュール): 定数<8>.     (line  445)
* HVSOCKET_CONNECT_TIMEOUT_MAX (socket モジュール): 定数<8>. (line  445)
* HVSOCKET_CONNECTED_SUSPEND (socket モジュール): 定数<8>.   (line  445)
* hypot() (math モジュール):             Summation and product functions.
                                                             (line   33)
* I (re モジュール):                     フラグ.             (line   37)
* I/O control;buffering:                 組み込み関数.       (line 1466)
* I/O control;buffering <1>:             socket オブジェクト.
                                                             (line  214)
* iadd() (operator モジュール):          インプレース in-place 演算子.
                                                             (line   34)
* iand() (operator モジュール):          インプレース in-place 演算子.
                                                             (line   39)
* iconcat() (operator モジュール):       インプレース in-place 演算子.
                                                             (line   44)
* id (concurrent.interpreters.Interpreter の属性): Interpreter objects.
                                                             (line   14)
* id (concurrent.interpreters.Queue の属性): Communicating Between Interpreters.
                                                             (line   16)
* id (ssl.SSLSession の属性):            SSL セッション.     (line   12)
* id() (unittest.TestCase のメソッド):   テストクラス.       (line  816)
* idcok() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  286)
* ident (select.kevent の属性):          kevent オブジェクト.
                                                             (line    8)
* ident (threading.Thread の属性):       Thread objects.     (line  210)
* identchars (cmd.Cmd の属性):           Cmdオブジェクト.    (line  132)
* identify_column() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  146)
* identify_element() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  175)
* identify_region() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  153)
* identify_row() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  142)
* identify() (tkinter.ttk.Notebook のメソッド): ttk Notebook.
                                                             (line   31)
* identify() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  132)
* identify() (tkinter.ttk.Widget のメソッド): ttk Widget.    (line   12)
* IDLE:                                  IDLE --- Python のエディタとシェル<2>.
                                                             (line    8)
* IDLE <1>:                              用語集<2>.          (line  828)
* idle コマンドラインオプション; -:      コマンドラインでの使用<5>.
                                                             (line   49)
* idle コマンドラインオプション; -c:     コマンドラインでの使用<5>.
                                                             (line   13)
* idle コマンドラインオプション; -d:     コマンドラインでの使用<5>.
                                                             (line   19)
* idle コマンドラインオプション; -e:     コマンドラインでの使用<5>.
                                                             (line   23)
* idle コマンドラインオプション; -h:     コマンドラインでの使用<5>.
                                                             (line   27)
* idle コマンドラインオプション; -i:     コマンドラインでの使用<5>.
                                                             (line   31)
* idle コマンドラインオプション; -r:     コマンドラインでの使用<5>.
                                                             (line   35)
* idle コマンドラインオプション; -s:     コマンドラインでの使用<5>.
                                                             (line   39)
* idle コマンドラインオプション; -t:     コマンドラインでの使用<5>.
                                                             (line   45)
* IDLE_PRIORITY_CLASS (subprocess モジュール): Windows Constants.
                                                             (line   89)
* idle() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line  128)
* IDLESTARTUP:                           IDLE<37>.           (line  176)
* IDLESTARTUP <1>:                       IDLE<41>.           (line    9)
* IDLESTARTUP <2>:                       IDLE<47>.           (line    9)
* IDLESTARTUP <3>:                       Startup and Code Execution.
                                                             (line    6)
* IDLESTARTUP <4>:                       コマンドラインでの使用<5>.
                                                             (line   41)
* idlok() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  293)
* IEEE_CONTEXT_MAX_BITS (decimal モジュール): 定数<4>.       (line   25)
* IEEEContext() (decimal モジュール):    Context オブジェクト.
                                                             (line   59)
* If (ast のクラス):                     制御フロー.         (line    9)
* if_indextoname() (socket モジュール):  その他の関数<2>.    (line  441)
* if_nameindex() (socket モジュール):    その他の関数<2>.    (line  397)
* if_nametoindex() (socket モジュール):  その他の関数<2>.    (line  423)
* if;conditional expression:             条件式 Conditional Expressions.
                                                             (line    6)
* if;in comprehensions:                  リスト、集合、辞書の表示.
                                                             (line   14)
* IfExp (ast のクラス):                  式 expression<2>.   (line  159)
* ifloordiv() (operator モジュール):     インプレース in-place 演算子.
                                                             (line   50)
* iglob() (glob モジュール):             glob --- Unix 形式のパス名のパターン展開.
                                                             (line   82)
* ignorableWhitespace() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line  142)
* ignore (bdb.Breakpoint の属性):        bdb --- デバッガーフレームワーク.
                                                             (line  121)
* ignore (pdb command):                  Debugger commands.  (line  152)
* IGNORE (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  151)
* ignore_environment (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  551)
* ignore_errors() (codecs モジュール):   エラーハンドラ.     (line  140)
* IGNORE_EXCEPTION_DETAIL (doctest モジュール): オプションフラグ.
                                                             (line   55)
* ignore_patterns() (shutil モジュール): ディレクトリとファイルの操作.
                                                             (line  203)
* ignore_warnings() (test.support.warnings_helper モジュール): test support warnings_helper --- Utilities for warnings tests.
                                                             (line   11)
* ignore;error handler's name:           エラーハンドラ.     (line   14)
* IGNORECASE (re モジュール):            フラグ.             (line   37)
* IISCGIHandler (wsgiref.handlers のクラス): wsgiref handlers -- server/gateway base classes.
                                                             (line   25)
* IllegalMonthError:                     calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  511)
* IllegalWeekdayError:                   calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  520)
* ilshift() (operator モジュール):       インプレース in-place 演算子.
                                                             (line   55)
* imag (numbers.Complex の属性):         数値塔.             (line   19)
* imag (sys.hash_info の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line 1070)
* imap_unordered() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line  150)
* imap() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line  135)
* IMAP4 (imaplib のクラス):              imaplib --- IMAP4 プロトコルクライアント.
                                                             (line   25)
* IMAP4_SSL (imaplib のクラス):          imaplib --- IMAP4 プロトコルクライアント.
                                                             (line   76)
* IMAP4_SSL;プロトコル:                  imaplib --- IMAP4 プロトコルクライアント.
                                                             (line    8)
* IMAP4_stream (imaplib のクラス):       imaplib --- IMAP4 プロトコルクライアント.
                                                             (line  109)
* IMAP4_stream;プロトコル:               imaplib --- IMAP4 プロトコルクライアント.
                                                             (line    8)
* IMAP4;プロトコル:                      imaplib --- IMAP4 プロトコルクライアント.
                                                             (line    8)
* IMAP4.abort:                           imaplib --- IMAP4 プロトコルクライアント.
                                                             (line   58)
* IMAP4.error:                           imaplib --- IMAP4 プロトコルクライアント.
                                                             (line   53)
* IMAP4.readonly:                        imaplib --- IMAP4 プロトコルクライアント.
                                                             (line   65)
* imatmul() (operator モジュール):       インプレース in-place 演算子.
                                                             (line   70)
* immedok() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  299)
* immutable:                             用語集<2>.          (line  848)
* immutable;object:                      リテラル<2>.        (line   31)
* immutable;object <1>:                  辞書表示.           (line   35)
* immutable;sequence;types:              イミュータブルなシーケンス型.
                                                             (line    6)
* immutable;データ;type:                 リテラル<2>.        (line   31)
* imod() (operator モジュール):          インプレース in-place 演算子.
                                                             (line   60)
* impl_detail() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  557)
* implementation (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line 1119)
* Import (ast のクラス):                 インポート.         (line    6)
* import hooks:                          インポートフック.   (line    6)
* import machinery:                      インポートシステム. (line    6)
* import path:                           用語集<2>.          (line  859)
* import_curses (C macro):               Curses C API.       (line   15)
* import_fresh_module() (test.support.import_helper モジュール): test support import_helper --- Utilities for import tests.
                                                             (line   16)
* IMPORT_FROM (opcode):                  Python バイトコード命令.
                                                             (line  852)
* import_module() (importlib モジュール): 関数<13>.          (line   14)
* import_module() (test.support.import_helper モジュール): test support import_helper --- Utilities for import tests.
                                                             (line   52)
* IMPORT_NAME (opcode):                  Python バイトコード命令.
                                                             (line  843)
* importer:                              用語集<2>.          (line  871)
* ImportError:                           具象例外.           (line   51)
* ImportFrom (ast のクラス):             インポート.         (line   20)
* importing:                             用語集<2>.          (line  866)
* ImportWarning:                         警告.               (line   59)
* ImproperConnectionState:               http client --- HTTP プロトコルクライアント.
                                                             (line  167)
* imul() (operator モジュール):          インプレース in-place 演算子.
                                                             (line   65)
* In (ast のクラス):                     式 expression<2>.   (line  110)
* in_dll() (ctypes._CData のメソッド):   データ型<3>.        (line   65)
* in_table_a1() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line   39)
* in_table_b1() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line   44)
* in_table_c11_c12() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line   68)
* in_table_c11() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line   59)
* in_table_c12() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line   63)
* in_table_c21_c22() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line   81)
* in_table_c21() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line   73)
* in_table_c22() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line   77)
* in_table_c3() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line   86)
* in_table_c4() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line   90)
* in_table_c5() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line   95)
* in_table_c6() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line   99)
* in_table_c7() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line  104)
* in_table_c8() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line  109)
* in_table_c9() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line  114)
* in_table_d1() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line  118)
* in_table_d2() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line  123)
* in_transaction (sqlite3.Connection の属性): Connection オブジェクト.
                                                             (line  781)
* inch() (curses.window のメソッド):     Window オブジェクト.
                                                             (line  307)
* include() (xml.etree.ElementInclude モジュール): 関数<10>. (line   17)
* inclusive (tracemalloc.DomainFilter の属性): DomainFilter. (line   12)
* inclusive (tracemalloc.Filter の属性): Filter.             (line   39)
* Incomplete:                            binascii --- バイナリ と ASCII 間の変換.
                                                             (line  162)
* IncompleteRead:                        http client --- HTTP プロトコルクライアント.
                                                             (line  163)
* IncompleteReadError:                   例外<16>.           (line   45)
* incr_item():                           例外<24>.           (line   78)
* incr_item() <1>:                       例外<24>.           (line  123)
* increment_lineno() (ast モジュール):   ast helpers.        (line  156)
* IncrementalDecoder (codecs のクラス):  IncrementalDecoder オブジェクト.
                                                             (line   11)
* incrementaldecoder (codecs.CodecInfo の属性): codecs --- codec レジストリと基底クラス.
                                                             (line   89)
* IncrementalEncoder (codecs のクラス):  IncrementalEncoder オブジェクト.
                                                             (line   11)
* incrementalencoder (codecs.CodecInfo の属性): codecs --- codec レジストリと基底クラス.
                                                             (line   89)
* IncrementalNewlineDecoder (io のクラス): テキスト I/O<2>.  (line  286)
* IncrementalParser (xml.sax.xmlreader のクラス): xml sax xmlreader --- XML パーサーのインターフェース.
                                                             (line   19)
* indent (doctest.Example の属性):       Example オブジェクト.
                                                             (line   44)
* indent (reprlib.Repr の属性):          Reprオブジェクト.   (line   52)
* INDENT (token モジュール):             token --- Python 解析木で使われる定数.
                                                             (line   82)
* INDENT トークン:                       インデント.         (line   31)
* indent() (textwrap モジュール):        textwrap --- テキストの折り返しと詰め込み.
                                                             (line  107)
* indent() (xml.etree.ElementTree モジュール): 関数<9>.      (line  116)
* IndentationError:                      具象例外.           (line  349)
* index:                                 用語集<2>.          (line  876)
* index (inspect.FrameInfo の属性):      インタープリタスタック.
                                                             (line   36)
* index (inspect.Traceback の属性):      インタープリタスタック.
                                                             (line   76)
* index() (array.array のメソッド):      array --- 効率的な数値配列.
                                                             (line  201)
* index() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  156)
* index() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  156)
* index() (collections.abc.ByteString のメソッド): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   84)
* index() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   70)
* index() (memoryview のメソッド):       メモリビュー.       (line  387)
* index() (multiprocessing.shared_memory.ShareableList のメソッド): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  335)
* index() (operator モジュール):         operator --- 関数形式の標準演算子.
                                                             (line  103)
* index() (sequence のメソッド):         共通のシーケンス演算.
                                                             (line  171)
* index() (str のメソッド):              文字列メソッド<2>.  (line  232)
* index() (tkinter.ttk.Notebook のメソッド): ttk Notebook.   (line   36)
* index() (tkinter.ttk.Treeview のメソッド): ttk Treeview.   (line  181)
* IndexError:                            具象例外.           (line   79)
* indexOf() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  209)
* IndexSizeErr:                          例外<23>.           (line   32)
* indices() (slice のメソッド):          スライス slice オブジェクト.
                                                             (line   16)
* INDIRECT (inspect.BufferFlags の属性): Buffer flags.       (line   31)
* inet_aton() (socket モジュール):       その他の関数<2>.    (line  259)
* inet_ntoa() (socket モジュール):       その他の関数<2>.    (line  277)
* inet_ntop() (socket モジュール):       その他の関数<2>.    (line  310)
* inet_pton() (socket モジュール):       その他の関数<2>.    (line  294)
* Inexact (decimal のクラス):            シグナル.           (line   43)
* inf (cmath モジュール):                定数<3>.            (line   20)
* inf (math モジュール):                 定数<2>.            (line   24)
* inf (sys.hash_info の属性):            sys --- システム固有のパラメーターと関数.
                                                             (line 1062)
* infile (shlex.shlex の属性):           shlex オブジェクト. (line  139)
* Infinity:                              組み込み関数.       (line  717)
* infj (cmath モジュール):               定数<3>.            (line   26)
* INFO (logging モジュール):             ロギングレベル.     (line   29)
* info (pathlib.Path の属性):            ファイルの種類とステータスを問い合わせる.
                                                             (line  174)
* INFO (tkinter.messagebox モジュール):  tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  194)
* info() (dis.Bytecode のメソッド):      バイトコード解析.   (line   67)
* info() (gettext.NullTranslations のメソッド): NullTranslations クラス.
                                                             (line   68)
* info() (http.client.HTTPResponse のメソッド): HTTPResponse オブジェクト.
                                                             (line   85)
* info() (logging モジュール):           モジュールレベルの関数.
                                                             (line   61)
* info() (logging.Logger のメソッド):    ロガーオブジェクト. (line  278)
* info() (urllib.response.addinfourl のメソッド): urllib response --- Response classes used by urllib.
                                                             (line   35)
* infolist() (zipfile.ZipFile のメソッド): ZipFile objects.  (line  128)
* inheritance:                           クラス定義.         (line    6)
* ini ファイル:                          configparser --- 設定ファイルのパーサー.
                                                             (line    8)
* init_color() (curses モジュール):      関数<6>.            (line  232)
* init_pair() (curses モジュール):       関数<6>.            (line  242)
* init() (mimetypes モジュール):         mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line   96)
* inited (mimetypes モジュール):         mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  135)
* initgroups() (os モジュール):          プロセスのパラメーター.
                                                             (line  360)
* initial_indent (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  211)
* initproc (C type):                     Slot Type typedefs. (line   38)
* initscr() (curses モジュール):         関数<6>.            (line  256)
* InitVar (dataclasses のクラス):        モジュールの内容<4>.
                                                             (line  325)
* inode() (os.DirEntry のメソッド):      ファイルとディレクトリ.
                                                             (line  984)
* input_charset (email.charset.Charset の属性): email charset 文字集合の表現.
                                                             (line   52)
* input_codec (email.charset.Charset の属性): email charset 文字集合の表現.
                                                             (line   83)
* input() (fileinput モジュール):        fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line   56)
* InputSource (xml.sax.xmlreader のクラス): xml sax xmlreader --- XML パーサーのインターフェース.
                                                             (line   49)
* InputStream (wsgiref.types のクラス):  wsgiref types -- WSGI types for static type checking.
                                                             (line   24)
* inquiry (C type):                      循環参照ガベージコレクションをサポートする.
                                                             (line  273)
* insch() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  312)
* insdelln() (curses.window のメソッド): Window オブジェクト.
                                                             (line  319)
* insert_text() (readline モジュール):   行バッファ.         (line   13)
* insert() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  212)
* insert() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   78)
* insert() (sequence のメソッド):        ミュータブルなシーケンス型.
                                                             (line   98)
* insert() (tkinter.ttk.Notebook のメソッド): ttk Notebook.  (line   41)
* insert() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line  185)
* insert() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  126)
* insertBefore() (xml.dom.Node のメソッド): Node オブジェクト.
                                                             (line  120)
* insertln() (curses.window のメソッド): Window オブジェクト.
                                                             (line  327)
* insnstr() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  332)
* insort_left() (bisect モジュール):     bisect --- 配列二分法アルゴリズム.
                                                             (line   69)
* insort_right() (bisect モジュール):    bisect --- 配列二分法アルゴリズム.
                                                             (line   87)
* insort() (bisect モジュール):          bisect --- 配列二分法アルゴリズム.
                                                             (line   87)
* inspect (sys.flags の属性):            sys --- システム固有のパラメーターと関数.
                                                             (line  530)
* inspect コマンドラインオプション; -details: コマンドライン・インターフェース<10>.
                                                             (line   13)
* InspectLoader (importlib.abc のクラス): importlib abc -- Abstract base classes related to import.
                                                             (line  205)
* insstr() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  342)
* install_opener() (urllib.request モジュール): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  111)
* install_scripts() (venv.EnvBuilder のメソッド): API<2>.    (line  176)
* install() (gettext モジュール):        クラス形式の API.   (line   68)
* install() (gettext.NullTranslations のメソッド): NullTranslations クラス.
                                                             (line   77)
* installHandler() (unittest モジュール): シグナルハンドリング.
                                                             (line   27)
* instance;call:                         呼び出し call.      (line  154)
* instate() (tkinter.ttk.Widget のメソッド): ttk Widget.     (line   19)
* instr() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  351)
* instream (shlex.shlex の属性):         shlex オブジェクト. (line  145)
* Instruction (dis のクラス):            Python バイトコード命令.
                                                             (line   10)
* INSTRUCTION (monitoring event):        Events.             (line   39)
* Instruction.arg (dis モジュール):      Python バイトコード命令.
                                                             (line   33)
* Instruction.argrepr (dis モジュール):  Python バイトコード命令.
                                                             (line   45)
* Instruction.argval (dis モジュール):   Python バイトコード命令.
                                                             (line   41)
* Instruction.baseopcode (dis モジュール): Python バイトコード命令.
                                                             (line   23)
* Instruction.baseopname (dis モジュール): Python バイトコード命令.
                                                             (line   28)
* Instruction.cache_info (dis モジュール): Python バイトコード命令.
                                                             (line   92)
* Instruction.cache_offset (dis モジュール): Python バイトコード命令.
                                                             (line   60)
* Instruction.end_offset (dis モジュール): Python バイトコード命令.
                                                             (line   64)
* Instruction.is_jump_target (dis モジュール): Python バイトコード命令.
                                                             (line   77)
* Instruction.jump_target (dis モジュール): Python バイトコード命令.
                                                             (line   82)
* Instruction.line_number (dis モジュール): Python バイトコード命令.
                                                             (line   72)
* Instruction.offset (dis モジュール):   Python バイトコード命令.
                                                             (line   50)
* Instruction.oparg (dis モジュール):    Python バイトコード命令.
                                                             (line   37)
* Instruction.opcode (dis モジュール):   Python バイトコード命令.
                                                             (line   14)
* Instruction.opname (dis モジュール):   Python バイトコード命令.
                                                             (line   19)
* Instruction.positions (dis モジュール): Python バイトコード命令.
                                                             (line   87)
* Instruction.start_offset (dis モジュール): Python バイトコード命令.
                                                             (line   54)
* Instruction.starts_line (dis モジュール): Python バイトコード命令.
                                                             (line   68)
* int (uuid.UUID の属性):                uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  144)
* int (組み込みクラス):                  組み込み関数.       (line  943)
* int_info (sys モジュール):             sys --- システム固有のパラメーターと関数.
                                                             (line 1172)
* int_max_str_digits (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  576)
* Int2AP() (imaplib モジュール):         imaplib --- IMAP4 プロトコルクライアント.
                                                             (line  123)
* Integral (numbers のクラス):           数値塔.             (line   59)
* Integrated Development Environment:    IDLE --- Python のエディタとシェル<2>.
                                                             (line    8)
* IntegrityError:                        例外<7>.            (line   62)
* IntEnum (enum のクラス):               データ型<2>.        (line  365)
* interact (pdb command):                Debugger commands.  (line  358)
* interact() (code モジュール):          code --- インタープリター基底クラス.
                                                             (line   42)
* interact() (code.InteractiveConsole のメソッド): 対話的なコンソールオブジェクト.
                                                             (line   10)
* interactive:                           用語集<2>.          (line  889)
* Interactive (ast のクラス):            Root nodes.         (line   37)
* interactive (sys.flags の属性):        sys --- システム固有のパラメーターと関数.
                                                             (line  533)
* InteractiveConsole (code のクラス):    code --- インタープリター基底クラス.
                                                             (line   30)
* InteractiveInterpreter (code のクラス): code --- インタープリター基底クラス.
                                                             (line   15)
* InterfaceError:                        例外<7>.            (line   36)
* intern() (sys モジュール):             sys --- システム固有のパラメーターと関数.
                                                             (line 1217)
* internal_attr (zipfile.ZipInfo の属性): ZipInfo objects.   (line  139)
* Internaldate2tuple() (imaplib モジュール): imaplib --- IMAP4 プロトコルクライアント.
                                                             (line  117)
* InternalError:                         例外<7>.            (line   68)
* internalSubset (xml.dom.DocumentType の属性): DocumentType オブジェクト.
                                                             (line   27)
* Internet:                              インターネットプロトコルとサポート.
                                                             (line    6)
* INTERNET_TIMEOUT (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line   82)
* interpolated string literal:           出力を見やすくフォーマットする.
                                                             (line   90)
* interpolated string literal <1>:       Raw string literals.
                                                             (line   25)
* interpolated string literal <2>:       文字列メソッド<2>.  (line  928)
* Interpolation (ast のクラス):          リテラル<3>.        (line   92)
* Interpolation (string.templatelib のクラス): 型.           (line  192)
* InterpolationDepthError:               例外<9>.            (line   40)
* InterpolationError:                    例外<9>.            (line   36)
* InterpolationMissingOptionError:       例外<9>.            (line   46)
* interpolations (string.templatelib.Template の属性): 型.   (line   74)
* InterpolationSyntaxError:              例外<9>.            (line   51)
* interpreted:                           用語集<2>.          (line  899)
* Interpreter (concurrent.interpreters のクラス): Interpreter objects.
                                                             (line    6)
* interpreter lock:                      スレッド状態 thread state とグローバルインタプリタロック global interpreter lock.
                                                             (line    6)
* interpreter prompts:                   sys --- システム固有のパラメーターと関数.
                                                             (line 1601)
* interpreter shutdown:                  用語集<2>.          (line  909)
* interpreter_requires_environment() (test.support.script_helper モジュール): test support script_helper --- Utilities for the Python execution tests.
                                                             (line    9)
* InterpreterError:                      例外<13>.           (line    6)
* InterpreterNotFoundError:              例外<13>.           (line   11)
* InterpreterPoolExecutor (concurrent.futures のクラス): InterpreterPoolExecutor.
                                                             (line   54)
* interrupt_main() (_thread モジュール): _thread --- 低水準なスレッド API.
                                                             (line   54)
* interrupt() (multiprocessing.Process のメソッド): Process クラスと例外.
                                                             (line  204)
* interrupt() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  347)
* InterruptedError:                      OS 例外.            (line   73)
* intersection_update() (set のメソッド): set（集合）型 --- set frozenset.
                                                             (line  178)
* intersection() (frozenset のメソッド): set（集合）型 --- set frozenset.
                                                             (line  105)
* intersection() (set のメソッド):       set（集合）型 --- set frozenset.
                                                             (line  105)
* IntFlag (enum のクラス):               データ型<2>.        (line  546)
* intro (cmd.Cmd の属性):                Cmdオブジェクト.    (line  147)
* InuseAttributeErr:                     例外<23>.           (line   37)
* inv_cdf() (statistics.NormalDist のメソッド): NormalDist オブジェクト.
                                                             (line   92)
* inv() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  111)
* InvalidAccessErr:                      例外<23>.           (line   42)
* invalidate_caches() (importlib モジュール): 関数<13>.      (line   38)
* invalidate_caches() (importlib.abc.MetaPathFinder のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line   48)
* invalidate_caches() (importlib.abc.PathEntryFinder のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line   83)
* invalidate_caches() (importlib.machinery.FileFinder のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  187)
* invalidate_caches() (importlib.machinery.PathFinder のクラスメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  138)
* invalidate_caches() (platform モジュール): Cross platform. (line  166)
* invalidate_caches() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   89)
* InvalidBase64CharactersDefect:         email errors Exception and Defect classes.
                                                             (line  129)
* InvalidBase64LengthDefect:             email errors Exception and Defect classes.
                                                             (line  135)
* InvalidBase64PaddingDefect:            email errors Exception and Defect classes.
                                                             (line  123)
* InvalidCharacterErr:                   例外<23>.           (line   47)
* InvalidDateDefect:                     email errors Exception and Defect classes.
                                                             (line  141)
* InvalidFileException:                  plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line  169)
* InvalidModificationErr:                例外<23>.           (line   54)
* InvalidOperation (decimal のクラス):   シグナル.           (line   51)
* InvalidStateErr:                       例外<23>.           (line   58)
* InvalidStateError:                     例外クラス.         (line   26)
* InvalidStateError <1>:                 例外<16>.           (line   30)
* InvalidTZPathWarning:                  例外と警告.         (line   12)
* InvalidURL:                            http client --- HTTP プロトコルクライアント.
                                                             (line  145)
* InvalidWriteError:                     例外<9>.            (line   83)
* Invert (ast のクラス):                 式 expression<2>.   (line   28)
* invert() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line  111)
* IO (typing のクラス):                  ABCs and Protocols for working with I/O.
                                                             (line    6)
* IO_REPARSE_TAG_APPEXECLINK (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  483)
* IO_REPARSE_TAG_MOUNT_POINT (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  483)
* IO_REPARSE_TAG_SYMLINK (stat モジュール): stat --- stat の結果を解釈する.
                                                             (line  483)
* IOBase (io のクラス):                  I/O 基底クラス.     (line    6)
* IOCTL_VM_SOCKETS_GET_LOCAL_CID (socket モジュール): 定数<8>.
                                                             (line  283)
* ioctl() (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  109)
* ioctl() (socket.socket のメソッド):    socket オブジェクト.
                                                             (line  182)
* IOError:                               具象例外.           (line  494)
* ior() (operator モジュール):           インプレース in-place 演算子.
                                                             (line   77)
* ios_ver() (platform モジュール):       iOS platform.       (line    6)
* ip (ipaddress.IPv4Interface の属性):   インターフェイスオブジェクト.
                                                             (line   19)
* ip (ipaddress.IPv6Interface の属性):   インターフェイスオブジェクト.
                                                             (line   74)
* ip_address() (ipaddress モジュール):   便利なファクトリ関数.
                                                             (line    9)
* ip_interface() (ipaddress モジュール): 便利なファクトリ関数.
                                                             (line   37)
* ip_network() (ipaddress モジュール):   便利なファクトリ関数.
                                                             (line   22)
* ipow() (operator モジュール):          インプレース in-place 演算子.
                                                             (line   82)
* ipv4_mapped (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  299)
* IPv4Address (ipaddress のクラス):      Address オブジェクト.
                                                             (line   12)
* IPv4Interface (ipaddress のクラス):    インターフェイスオブジェクト.
                                                             (line    9)
* IPv4Network (ipaddress のクラス):      Network オブジェクト.
                                                             (line   13)
* IPV6_ENABLED (test.support.socket_helper モジュール): test support socket_helper --- Utilities for socket tests.
                                                             (line   11)
* ipv6_mapped (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line  189)
* IPv6Address (ipaddress のクラス):      Address オブジェクト.
                                                             (line  221)
* IPv6Interface (ipaddress のクラス):    インターフェイスオブジェクト.
                                                             (line   64)
* IPv6Network (ipaddress のクラス):      Network オブジェクト.
                                                             (line  255)
* irrefutable case block:                論駁不可能なケースブロック.
                                                             (line    6)
* irshift() (operator モジュール):       インプレース in-place 演算子.
                                                             (line   87)
* Is (ast のクラス):                     式 expression<2>.   (line  110)
* is_() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line   61)
* is_absolute() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  191)
* is_active() (graphlib.TopologicalSorter のメソッド): graphlib --- グラフ構造を操作する機能.
                                                             (line  115)
* is_alive() (multiprocessing.Process のメソッド): Process クラスと例外.
                                                             (line  126)
* is_alive() (threading.Thread のメソッド): Thread objects.  (line  236)
* is_android (test.support モジュール):  test support --- Utilities for the Python test suite.
                                                             (line   40)
* is_annotated() (symtable.Symbol のメソッド): 記号表の検査. (line  239)
* is_anonymous (ctypes.CField の属性):   構造化データ型.     (line  302)
* is_apple (test.support モジュール):    test support --- Utilities for the Python test suite.
                                                             (line   56)
* is_apple_mobile (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line   52)
* is_assigned() (symtable.Symbol のメソッド): 記号表の検査.  (line  270)
* is_async (pyclbr.Function の属性):     Function オブジェクト.
                                                             (line   41)
* is_attachment() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  446)
* is_authenticated() (urllib.request.HTTPPasswordMgrWithPriorAuth のメソッド): HTTPPasswordMgrWithPriorAuth オブジェクト.
                                                             (line   32)
* is_bitfield (ctypes.CField の属性):    構造化データ型.     (line  284)
* is_block_device() (pathlib.Path のメソッド): ファイルの種類とステータスを問い合わせる.
                                                             (line  141)
* is_blocked() (http.cookiejar.DefaultCookiePolicy のメソッド): DefaultCookiePolicy オブジェクト.
                                                             (line   59)
* is_canonical() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  326)
* is_canonical() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  284)
* is_char_device() (pathlib.Path のメソッド): ファイルの種類とステータスを問い合わせる.
                                                             (line  148)
* IS_CHARACTER_JUNK() (difflib モジュール): difflib --- 差分の計算の補助.
                                                             (line  358)
* is_check_supported() (lzma モジュール): その他<4>.         (line    6)
* is_closed() (asyncio.loop のメソッド): ループの開始と停止. (line   43)
* is_closing() (asyncio.BaseTransport のメソッド): 基底トランスポート.
                                                             (line   17)
* is_closing() (asyncio.StreamWriter のメソッド): StreamWriter.
                                                             (line  112)
* is_comp_cell() (symtable.Symbol のメソッド): 記号表の検査. (line  282)
* is_comp_iter() (symtable.Symbol のメソッド): 記号表の検査. (line  275)
* is_dataclass() (dataclasses モジュール): モジュールの内容<4>.
                                                             (line  475)
* is_declared_global() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  230)
* is_dir() (importlib.resources.abc.Traversable のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  106)
* is_dir() (os.DirEntry のメソッド):     ファイルとディレクトリ.
                                                             (line  995)
* is_dir() (pathlib.Path のメソッド):    ファイルの種類とステータスを問い合わせる.
                                                             (line   81)
* is_dir() (pathlib.types.PathInfo のメソッド): プロトコル.  (line   25)
* is_dir() (zipfile.Path のメソッド):    Path objects.       (line   57)
* is_dir() (zipfile.ZipInfo のメソッド): ZipInfo objects.    (line   43)
* is_emscripten (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line   44)
* is_enabled() (faulthandler モジュール): フォールトハンドラの状態.
                                                             (line   42)
* is_expired() (http.cookiejar.Cookie のメソッド): Cookieオブジェクト<2>.
                                                             (line  115)
* is_fifo() (pathlib.Path のメソッド):   ファイルの種類とステータスを問い合わせる.
                                                             (line  134)
* is_file() (importlib.resources.abc.Traversable のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  110)
* is_file() (os.DirEntry のメソッド):    ファイルとディレクトリ.
                                                             (line 1026)
* is_file() (pathlib.Path のメソッド):   ファイルの種類とステータスを問い合わせる.
                                                             (line   68)
* is_file() (pathlib.types.PathInfo のメソッド): プロトコル. (line   36)
* is_file() (zipfile.Path のメソッド):   Path objects.       (line   61)
* is_finalized() (gc モジュール):        gc --- ガベージコレクターインターフェース.
                                                             (line  209)
* is_finalizing() (sys モジュール):      sys --- システム固有のパラメーターと関数.
                                                             (line 1242)
* is_finite() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  331)
* is_finite() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  291)
* is_free_class() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  250)
* is_free() (symtable.Symbol のメソッド): 記号表の検査.      (line  245)
* is_global (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line  136)
* is_global (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  279)
* is_global() (symtable.Symbol のメソッド): 記号表の検査.    (line  222)
* is_hop_by_hop() (wsgiref.util モジュール): wsgiref util -- WSGI environment utilities.
                                                             (line  112)
* is_imported() (symtable.Symbol のメソッド): 記号表の検査.  (line  208)
* is_infinite() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  336)
* is_infinite() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  296)
* is_integer() (float のメソッド):       浮動小数点数に対する追加のメソッド.
                                                             (line   30)
* is_integer() (fractions.Fraction のメソッド): fractions --- 有理数.
                                                             (line  131)
* is_integer() (int のメソッド):         整数型における追加のメソッド.
                                                             (line  156)
* is_junction() (os.DirEntry のメソッド): ファイルとディレクトリ.
                                                             (line 1062)
* is_junction() (pathlib.Path のメソッド): ファイルの種類とステータスを問い合わせる.
                                                             (line  103)
* is_jython (test.support モジュール):   test support --- Utilities for the Python test suite.
                                                             (line   36)
* IS_LINE_JUNK() (difflib モジュール):   difflib --- 差分の計算の補助.
                                                             (line  351)
* is_linetouched() (curses.window のメソッド): Window オブジェクト.
                                                             (line  365)
* is_link_local (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line  184)
* is_link_local (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line   78)
* is_link_local (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  289)
* is_link_local (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  309)
* is_local() (symtable.Symbol のメソッド): 記号表の検査.     (line  235)
* is_loopback (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line  179)
* is_loopback (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line   76)
* is_loopback (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  287)
* is_loopback (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  307)
* is_mount() (pathlib.Path のメソッド):  ファイルの種類とステータスを問い合わせる.
                                                             (line  111)
* is_multicast (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line   93)
* is_multicast (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line   68)
* is_multicast (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  275)
* is_multicast (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  299)
* is_multipart() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  134)
* is_multipart() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  146)
* is_namespace() (symtable.Symbol のメソッド): 記号表の検査. (line  289)
* is_nan() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  341)
* is_nan() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  301)
* is_nested() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line   95)
* is_none() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line   69)
* is_nonlocal() (symtable.Symbol のメソッド): 記号表の検査.  (line  226)
* is_normal() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  346)
* is_normal() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  306)
* is_normalized() (unicodedata モジュール): unicodedata --- Unicode データベース.
                                                             (line  167)
* is_not_allowed() (http.cookiejar.DefaultCookiePolicy のメソッド): DefaultCookiePolicy オブジェクト.
                                                             (line   73)
* is_not_none() (operator モジュール):   operator --- 関数形式の標準演算子.
                                                             (line   75)
* is_not() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line   65)
* IS_OP (opcode):                        Python バイトコード命令.
                                                             (line  831)
* is_optimized() (symtable.SymbolTable のメソッド): 記号表の検査.
                                                             (line   90)
* is_package() (importlib.abc.InspectLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  236)
* is_package() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  420)
* is_package() (importlib.machinery.ExtensionFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  324)
* is_package() (importlib.machinery.SourceFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  217)
* is_package() (importlib.machinery.SourcelessFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  261)
* is_package() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   73)
* is_parameter() (symtable.Symbol のメソッド): 記号表の検査. (line  212)
* is_private (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line   98)
* is_private (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line   70)
* is_private (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  277)
* is_private (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  301)
* is_protocol() (typing モジュール):     Introspection helpers.
                                                             (line  119)
* is_python_build() (sysconfig モジュール): その他の関数<3>. (line   46)
* is_qnan() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  351)
* is_qnan() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  312)
* is_reading() (asyncio.ReadTransport のメソッド): 読み出し専用のトランスポート.
                                                             (line    6)
* is_referenced() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  204)
* is_relative_to() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  210)
* is_reserved (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line  164)
* is_reserved (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line   74)
* is_reserved (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  285)
* is_reserved (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  305)
* is_reserved() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  234)
* is_resource_enabled() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  265)
* is_resource() (importlib.resources モジュール): 関数 API.  (line  136)
* is_resource() (importlib.resources.abc.ResourceReader のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line   62)
* is_running() (asyncio.loop のメソッド): ループの開始と停止.
                                                             (line   39)
* is_running() (concurrent.interpreters.Interpreter のメソッド): Interpreter objects.
                                                             (line   26)
* is_safe (uuid.UUID の属性):            uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  165)
* is_serving() (asyncio.Server のメソッド): Serverオブジェクト.
                                                             (line  118)
* is_set() (asyncio.Event のメソッド):   Event.              (line   66)
* is_set() (threading.Event のメソッド): Event objects.      (line   25)
* is_signed() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  356)
* is_signed() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  317)
* is_site_local (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  291)
* is_site_local (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  359)
* is_skipped_module() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  272)
* is_snan() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  361)
* is_snan() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  323)
* is_socket() (pathlib.Path のメソッド): ファイルの種類とステータスを問い合わせる.
                                                             (line  127)
* is_stack_trampoline_active() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1887)
* is_subnormal() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  366)
* is_subnormal() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  328)
* is_symlink() (os.DirEntry のメソッド): ファイルとディレクトリ.
                                                             (line 1042)
* is_symlink() (pathlib.Path のメソッド): ファイルの種類とステータスを問い合わせる.
                                                             (line   95)
* is_symlink() (pathlib.types.PathInfo のメソッド): プロトコル.
                                                             (line   47)
* is_symlink() (zipfile.Path のメソッド): Path objects.      (line   65)
* is_tarfile() (tarfile モジュール):     tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  240)
* is_term_resized() (curses モジュール): 関数<6>.            (line  264)
* is_tracing() (tracemalloc モジュール): 関数<11>.           (line   60)
* is_tracked() (gc モジュール):          gc --- ガベージコレクターインターフェース.
                                                             (line  185)
* is_type_parameter() (symtable.Symbol のメソッド): 記号表の検査.
                                                             (line  216)
* is_typeddict() (typing モジュール):    Introspection helpers.
                                                             (line  134)
* is_unspecified (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line  159)
* is_unspecified (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line   72)
* is_unspecified (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  283)
* is_unspecified (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  303)
* is_valid() (string.Template のメソッド): Template strings $-strings.
                                                             (line   77)
* is_wasi (test.support モジュール):     test support --- Utilities for the Python test suite.
                                                             (line   48)
* is_wintouched() (curses.window のメソッド): Window オブジェクト.
                                                             (line  372)
* is_zero() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  371)
* is_zero() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  333)
* is_zipfile() (zipfile モジュール):     zipfile --- ZIP アーカイブの処理.
                                                             (line   95)
* isabs() (os.path モジュール):          os path --- 一般的なパス名操作.
                                                             (line  218)
* isabstract() (inspect モジュール):     型とメンバー.       (line  575)
* IsADirectoryError:                     OS 例外.            (line   83)
* isalnum() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  507)
* isalnum() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  507)
* isalnum() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  133)
* isalnum() (str のメソッド):            文字列メソッド<2>.  (line  248)
* isalpha() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  524)
* isalpha() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  524)
* isalpha() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  138)
* isalpha() (str のメソッド):            文字列メソッド<2>.  (line  267)
* isascii() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  540)
* isascii() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  540)
* isascii() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  143)
* isascii() (str のメソッド):            文字列メソッド<2>.  (line  287)
* isasyncgen() (inspect モジュール):     型とメンバー.       (line  534)
* isasyncgenfunction() (inspect モジュール): 型とメンバー.   (line  513)
* isatty() (io.IOBase のメソッド):       I/O 基底クラス.     (line   72)
* isatty() (os モジュール):              ファイル記述子の操作.
                                                             (line  258)
* isawaitable() (inspect モジュール):    型とメンバー.       (line  492)
* isblank() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  147)
* isblk() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line  211)
* isbuiltin() (inspect モジュール):      型とメンバー.       (line  554)
* ischr() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line  207)
* isclass() (inspect モジュール):        型とメンバー.       (line  411)
* isclose() (cmath モジュール):          類別関数.           (line   23)
* isclose() (math モジュール):           Floating point manipulation functions.
                                                             (line   25)
* iscntrl() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  151)
* iscode() (inspect モジュール):         型とメンバー.       (line  550)
* iscoroutine() (asyncio モジュール):    イントロスペクション.
                                                             (line   26)
* iscoroutine() (inspect モジュール):    型とメンバー.       (line  485)
* iscoroutinefunction() (inspect モジュール): 型とメンバー.  (line  447)
* isctrl() (curses.ascii モジュール):    curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  191)
* isDaemon() (threading.Thread のメソッド): Thread objects.  (line  258)
* isdatadescriptor() (inspect モジュール): 型とメンバー.     (line  605)
* isdecimal() (str のメソッド):          文字列メソッド<2>.  (line  300)
* isdev() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line  219)
* isdevdrive() (os.path モジュール):     os path --- 一般的なパス名操作.
                                                             (line  293)
* isdigit() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  549)
* isdigit() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  549)
* isdigit() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  156)
* isdigit() (str のメソッド):            文字列メソッド<2>.  (line  316)
* isdir() (os.path モジュール):          os path --- 一般的なパス名操作.
                                                             (line  245)
* isdir() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line  195)
* isdisjoint() (frozenset のメソッド):   set（集合）型 --- set frozenset.
                                                             (line   67)
* isdisjoint() (set のメソッド):         set（集合）型 --- set frozenset.
                                                             (line   67)
* isdown() (turtle モジュール):          描画状態.           (line   85)
* iselement() (xml.etree.ElementTree モジュール): 関数<9>.   (line  128)
* isenabled() (gc モジュール):           gc --- ガベージコレクターインターフェース.
                                                             (line   29)
* isEnabledFor() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  140)
* isendwin() (curses モジュール):        関数<6>.            (line  269)
* ISEOF() (token モジュール):            token --- Python 解析木で使われる定数.
                                                             (line   36)
* isfifo() (tarfile.TarInfo のメソッド): TarInfo オブジェクト.
                                                             (line  215)
* isfile() (os.path モジュール):         os path --- 一般的なパス名操作.
                                                             (line  235)
* isfile() (tarfile.TarInfo のメソッド): TarInfo オブジェクト.
                                                             (line  186)
* isfinite() (cmath モジュール):         類別関数.           (line    6)
* isfinite() (math モジュール):          Floating point manipulation functions.
                                                             (line   59)
* isfirstline() (fileinput モジュール):  fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  108)
* isframe() (inspect モジュール):        型とメンバー.       (line  546)
* isfunction() (inspect モジュール):     型とメンバー.       (line  426)
* isfuture() (asyncio モジュール):       Future の関数.      (line    6)
* isgenerator() (inspect モジュール):    型とメンバー.       (line  443)
* isgeneratorfunction() (inspect モジュール): 型とメンバー.  (line  431)
* isgetsetdescriptor() (inspect モジュール): 型とメンバー.   (line  619)
* isgraph() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  161)
* isidentifier() (str のメソッド):       文字列メソッド<2>.  (line  325)
* isinf() (cmath モジュール):            類別関数.           (line   13)
* isinf() (math モジュール):             Floating point manipulation functions.
                                                             (line   66)
* isjunction() (os.path モジュール):     os path --- 一般的なパス名操作.
                                                             (line  255)
* iskeyword() (keyword モジュール):      keyword --- Python キーワードのテスト.
                                                             (line   13)
* isleap() (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  358)
* islice() (itertools モジュール):       Itertool関数.       (line  366)
* islink() (os.path モジュール):         os path --- 一般的なパス名操作.
                                                             (line  263)
* islnk() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line  203)
* islower() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  563)
* islower() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  563)
* islower() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  165)
* islower() (str のメソッド):            文字列メソッド<2>.  (line  343)
* ismemberdescriptor() (inspect モジュール): 型とメンバー.   (line  627)
* ismeta() (curses.ascii モジュール):    curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  195)
* ismethod() (inspect モジュール):       型とメンバー.       (line  416)
* ismethoddescriptor() (inspect モジュール): 型とメンバー.   (line  579)
* ismethodwrapper() (inspect モジュール): 型とメンバー.      (line  559)
* ismodule() (inspect モジュール):       型とメンバー.       (line  407)
* ismount() (os.path モジュール):        os path --- 一般的なパス名操作.
                                                             (line  272)
* isnan() (cmath モジュール):            類別関数.           (line   18)
* isnan() (math モジュール):             Floating point manipulation functions.
                                                             (line   71)
* ISNONTERMINAL() (token モジュール):    token --- Python 解析木で使われる定数.
                                                             (line   32)
* IsNot (ast のクラス):                  式 expression<2>.   (line  110)
* isnumeric() (str のメソッド):          文字列メソッド<2>.  (line  349)
* isocalendar() (datetime.date のメソッド): date objects.    (line  272)
* isocalendar() (datetime.datetime のメソッド): datetime objects.
                                                             (line  654)
* isoformat() (datetime.date のメソッド): date objects.      (line  297)
* isoformat() (datetime.datetime のメソッド): datetime objects.
                                                             (line  659)
* isoformat() (datetime.time のメソッド): time objects.      (line  179)
* isolated (sys.flags の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line  536)
* IsolatedAsyncioTestCase (unittest のクラス): テストクラス. (line  912)
* isolation_level (sqlite3.Connection の属性): Connection オブジェクト.
                                                             (line  791)
* isoweekday() (datetime.date のメソッド): date objects.     (line  265)
* isoweekday() (datetime.datetime のメソッド): datetime objects.
                                                             (line  648)
* ispackage() (inspect モジュール):      型とメンバー.       (line  420)
* isprint() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  169)
* isprintable() (str のメソッド):        文字列メソッド<2>.  (line  371)
* ispunct() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  173)
* isqrt() (math モジュール):             Number-theoretic functions.
                                                             (line   40)
* isreadable() (pprint モジュール):      関数<4>.            (line   83)
* isreadable() (pprint.PrettyPrinter のメソッド): PrettyPrinter オブジェクト.
                                                             (line   65)
* isrecursive() (pprint モジュール):     関数<4>.            (line   92)
* isrecursive() (pprint.PrettyPrinter のメソッド): PrettyPrinter オブジェクト.
                                                             (line   73)
* isreg() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line  191)
* isreserved() (os.path モジュール):     os path --- 一般的なパス名操作.
                                                             (line  312)
* isReservedKey() (http.cookies.Morsel のメソッド): Morselオブジェクト.
                                                             (line   79)
* isroutine() (inspect モジュール):      型とメンバー.       (line  570)
* isSameNode() (xml.dom.Node のメソッド): Node オブジェクト. (line  100)
* issoftkeyword() (keyword モジュール):  keyword --- Python キーワードのテスト.
                                                             (line   24)
* isspace() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  581)
* isspace() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  581)
* isspace() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  177)
* isspace() (str のメソッド):            文字列メソッド<2>.  (line  395)
* isstdin() (fileinput モジュール):      fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  113)
* issubset() (frozenset のメソッド):     set（集合）型 --- set frozenset.
                                                             (line   74)
* issubset() (set のメソッド):           set（集合）型 --- set frozenset.
                                                             (line   74)
* issuperset() (frozenset のメソッド):   set（集合）型 --- set frozenset.
                                                             (line   86)
* issuperset() (set のメソッド):         set（集合）型 --- set frozenset.
                                                             (line   86)
* issym() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line  199)
* ISTERMINAL() (token モジュール):       token --- Python 解析木で使われる定数.
                                                             (line   28)
* istitle() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  590)
* istitle() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  590)
* istitle() (str のメソッド):            文字列メソッド<2>.  (line  405)
* istraceback() (inspect モジュール):    型とメンバー.       (line  542)
* isub() (operator モジュール):          インプレース in-place 演算子.
                                                             (line   92)
* isupper() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  605)
* isupper() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  605)
* isupper() (curses.ascii モジュール):   curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  182)
* isupper() (str のメソッド):            文字列メソッド<2>.  (line  423)
* isvisible() (turtle モジュール):       可視性.             (line   22)
* isxdigit() (curses.ascii モジュール):  curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  186)
* ITALIC (tkinter.font モジュール):      tkinter font --- Tkinter フォントラッパー.
                                                             (line   15)
* item() (tkinter.ttk.Treeview のメソッド): ttk Treeview.    (line  201)
* item() (xml.dom.NamedNodeMap のメソッド): NamedNodeMap Objects.
                                                             (line   12)
* item() (xml.dom.NodeList のメソッド):  NodeList オブジェクト.
                                                             (line   16)
* itemgetter() (operator モジュール):    operator --- 関数形式の標準演算子.
                                                             (line  277)
* items() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  262)
* items() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line  142)
* items() (dict のメソッド):             マッピング型 --- dict.
                                                             (line  187)
* items() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  241)
* items() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  352)
* items() (mailbox.Mailbox のメソッド):  Mailbox オブジェクト.
                                                             (line  140)
* items() (types.MappingProxyType のメソッド): 標準的なインタプリタ型.
                                                             (line  270)
* items() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   67)
* itemsize (array.array の属性):         array --- 効率的な数値配列.
                                                             (line  119)
* itemsize (memoryview の属性):          メモリビュー.       (line  464)
* ItemsView (collections.abc のクラス):  コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  127)
* ItemsView (typing のクラス):           Aliases to container ABCs in collections abc.
                                                             (line   55)
* iter_attachments() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  561)
* iter_child_nodes() (ast モジュール):   ast helpers.        (line  173)
* iter_fields() (ast モジュール):        ast helpers.        (line  168)
* iter_importers() (pkgutil モジュール): pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line   67)
* iter_modules() (pkgutil モジュール):   pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line   86)
* iter_parts() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  577)
* iter_unpack() (struct モジュール):     関数と例外.         (line   41)
* iter_unpack() (struct.Struct のメソッド): クラス<3>.       (line   48)
* iter() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  132)
* iter() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   39)
* iterable:                              用語集<2>.          (line  923)
* Iterable (collections.abc のクラス):   コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   26)
* Iterable (typing のクラス):            Aliases to other ABCs in collections abc.
                                                             (line    6)
* iterable;unpacking:                    式のリスト.         (line   17)
* iterator:                              用語集<2>.          (line  945)
* Iterator (collections.abc のクラス):   コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   43)
* Iterator (typing のクラス):            Aliases to other ABCs in collections abc.
                                                             (line   14)
* iterdecode() (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  250)
* iterdir() (importlib.resources.abc.Traversable のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  102)
* iterdir() (pathlib.Path のメソッド):   ディレクトリを読む. (line    6)
* iterdir() (zipfile.Path のメソッド):   Path objects.       (line   53)
* iterdump() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  510)
* iterencode() (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  237)
* iterencode() (json.JSONEncoder のメソッド): エンコーダとデコーダ.
                                                             (line  231)
* iterfind() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  143)
* iterfind() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   45)
* iteritems() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  132)
* iterkeys() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  106)
* itermonthdates() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line   65)
* itermonthdays() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line   72)
* itermonthdays2() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line   80)
* itermonthdays3() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line   88)
* itermonthdays4() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line   98)
* iternextfunc (C type):                 Slot Type typedefs. (line  100)
* iterparse() (xml.etree.ElementTree モジュール): 関数<9>.   (line  134)
* itertext() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  152)
* itervalues() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  115)
* iterweekdays() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line   59)
* ITIMER_PROF (signal モジュール):       モジュールの内容<2>.
                                                             (line  251)
* ITIMER_REAL (signal モジュール):       モジュールの内容<2>.
                                                             (line  241)
* ITIMER_VIRTUAL (signal モジュール):    モジュールの内容<2>.
                                                             (line  246)
* ItimerError:                           モジュールの内容<2>.
                                                             (line  282)
* itruediv() (operator モジュール):      インプレース in-place 演算子.
                                                             (line   97)
* ixor() (operator モジュール):          インプレース in-place 演算子.
                                                             (line  102)
* j;in numeric literal:                  Floating-point literals.
                                                             (line   56)
* JANUARY (calendar モジュール):         calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  483)
* java_ver() (platform モジュール):      Java platform.      (line    6)
* Java;言語:                             numbers Real float 実数.
                                                             (line    6)
* job_size (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  233)
* join_thread() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  188)
* join_thread() (test.support.threading_helper モジュール): test support threading_helper --- Utilities for threading tests.
                                                             (line   11)
* join() (asyncio.Queue のメソッド):     Queue.              (line   53)
* join() (bytearray のメソッド):         bytes と bytearray の操作.
                                                             (line  168)
* join() (bytes のメソッド):             bytes と bytearray の操作.
                                                             (line  168)
* join() (multiprocessing.JoinableQueue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  281)
* join() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line  188)
* join() (multiprocessing.Process のメソッド): Process クラスと例外.
                                                             (line   99)
* join() (os.path モジュール):           os path --- 一般的なパス名操作.
                                                             (line  334)
* join() (queue.Queue のメソッド):       キューオブジェクト. (line   87)
* join() (shlex モジュール):             shlex --- 単純な字句解析.
                                                             (line   28)
* join() (str のメソッド):               文字列メソッド<2>.  (line  438)
* join() (threading.Thread のメソッド):  Thread objects.     (line  153)
* JoinableQueue (multiprocessing のクラス): パイプ Pipe とキュー Queue.
                                                             (line  256)
* JoinedStr (ast のクラス):              リテラル<3>.        (line   42)
* joinpath() (importlib.resources.abc.Traversable のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  114)
* joinpath() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  248)
* joinpath() (zipfile.Path のメソッド):  Path objects.       (line  114)
* js_output() (http.cookies.BaseCookie のメソッド): Cookieオブジェクト.
                                                             (line   32)
* js_output() (http.cookies.Morsel のメソッド): Morselオブジェクト.
                                                             (line   90)
* json コマンドラインオプション; -compact: コマンドラインオプション<4>.
                                                             (line   49)
* json コマンドラインオプション; -h:     コマンドラインオプション<4>.
                                                             (line   55)
* json コマンドラインオプション; -help:  コマンドラインオプション<4>.
                                                             (line   55)
* json コマンドラインオプション; -indent: コマンドラインオプション<4>.
                                                             (line   49)
* json コマンドラインオプション; -json-lines: コマンドラインオプション<4>.
                                                             (line   43)
* json コマンドラインオプション; -no-ensure-ascii: コマンドラインオプション<4>.
                                                             (line   36)
* json コマンドラインオプション; -no-indent: コマンドラインオプション<4>.
                                                             (line   49)
* json コマンドラインオプション; -sort-keys: コマンドラインオプション<4>.
                                                             (line   30)
* json コマンドラインオプション; -tab:   コマンドラインオプション<4>.
                                                             (line   49)
* json コマンドラインオプション; infile: コマンドラインオプション<4>.
                                                             (line    6)
* json コマンドラインオプション; outfile: コマンドラインオプション<4>.
                                                             (line   25)
* JSONDecodeError:                       例外<20>.           (line    6)
* JSONDecoder (json のクラス):           エンコーダとデコーダ.
                                                             (line    6)
* JSONEncoder (json のクラス):           エンコーダとデコーダ.
                                                             (line  105)
* JULY (calendar モジュール):            calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  483)
* JUMP (monitoring event):               Events.             (line   43)
* JUMP (opcode):                         Python バイトコード命令.
                                                             (line 1488)
* jump (pdb command):                    Debugger commands.  (line  236)
* JUMP_BACKWARD (opcode):                Python バイトコード命令.
                                                             (line  862)
* JUMP_BACKWARD_NO_INTERRUPT (opcode):   Python バイトコード命令.
                                                             (line  868)
* JUMP_FORWARD (opcode):                 Python バイトコード命令.
                                                             (line  858)
* JUMP_IF_FALSE (opcode):                Python バイトコード命令.
                                                             (line 1494)
* JUMP_IF_TRUE (opcode):                 Python バイトコード命令.
                                                             (line 1494)
* JUMP_NO_INTERRUPT (opcode):            Python バイトコード命令.
                                                             (line 1488)
* JUNE (calendar モジュール):            calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  483)
* kbhit() (msvcrt モジュール):           コンソール I/O 関連.
                                                             (line    6)
* kde_random() (statistics モジュール):  関数の詳細.         (line  179)
* kde() (statistics モジュール):         関数の詳細.         (line  131)
* KEEP (enum.FlagBoundary の属性):       データ型<2>.        (line  720)
* kevent() (select モジュール):          select --- I/O 完了の待機.
                                                             (line  109)
* key (http.cookies.Morsel の属性):      Morselオブジェクト. (line   71)
* key (zoneinfo.ZoneInfo の属性):        ZoneInfo クラス.    (line   78)
* key function:                          用語集<2>.          (line  975)
* KEY_A1 (curses モジュール):            定数<6>.            (line  235)
* KEY_A3 (curses モジュール):            定数<6>.            (line  238)
* KEY_ALL_ACCESS (winreg モジュール):    アクセス権限.       (line    9)
* KEY_B2 (curses モジュール):            定数<6>.            (line  241)
* KEY_BACKSPACE (curses モジュール):     定数<6>.            (line  164)
* KEY_BEG (curses モジュール):           定数<6>.            (line  253)
* KEY_BREAK (curses モジュール):         定数<6>.            (line  146)
* KEY_BTAB (curses モジュール):          定数<6>.            (line  250)
* KEY_C1 (curses モジュール):            定数<6>.            (line  244)
* KEY_C3 (curses モジュール):            定数<6>.            (line  247)
* KEY_CANCEL (curses モジュール):        定数<6>.            (line  256)
* KEY_CATAB (curses モジュール):         定数<6>.            (line  216)
* KEY_CLEAR (curses モジュール):         定数<6>.            (line  189)
* KEY_CLOSE (curses モジュール):         定数<6>.            (line  259)
* KEY_COMMAND (curses モジュール):       定数<6>.            (line  262)
* KEY_COPY (curses モジュール):          定数<6>.            (line  265)
* KEY_CREATE (curses モジュール):        定数<6>.            (line  268)
* KEY_CREATE_LINK (winreg モジュール):   アクセス権限.       (line   51)
* KEY_CREATE_SUB_KEY (winreg モジュール): アクセス権限.      (line   39)
* KEY_CTAB (curses モジュール):          定数<6>.            (line  213)
* KEY_DC (curses モジュール):            定数<6>.            (line  180)
* KEY_DL (curses モジュール):            定数<6>.            (line  174)
* KEY_DOWN (curses モジュール):          定数<6>.            (line  149)
* KEY_EIC (curses モジュール):           定数<6>.            (line  186)
* KEY_END (curses モジュール):           定数<6>.            (line  271)
* KEY_ENTER (curses モジュール):         定数<6>.            (line  219)
* KEY_ENUMERATE_SUB_KEYS (winreg モジュール): アクセス権限.  (line   43)
* KEY_EOL (curses モジュール):           定数<6>.            (line  195)
* KEY_EOS (curses モジュール):           定数<6>.            (line  192)
* KEY_EXECUTE (winreg モジュール):       アクセス権限.       (line   27)
* KEY_EXIT (curses モジュール):          定数<6>.            (line  274)
* KEY_F0 (curses モジュール):            定数<6>.            (line  167)
* KEY_FIND (curses モジュール):          定数<6>.            (line  277)
* KEY_Fn (curses モジュール):            定数<6>.            (line  171)
* KEY_HELP (curses モジュール):          定数<6>.            (line  280)
* KEY_HOME (curses モジュール):          定数<6>.            (line  161)
* KEY_IC (curses モジュール):            定数<6>.            (line  183)
* KEY_IL (curses モジュール):            定数<6>.            (line  177)
* KEY_LEFT (curses モジュール):          定数<6>.            (line  155)
* KEY_LL (curses モジュール):            定数<6>.            (line  232)
* KEY_MARK (curses モジュール):          定数<6>.            (line  283)
* KEY_MAX (curses モジュール):           定数<6>.            (line  424)
* KEY_MESSAGE (curses モジュール):       定数<6>.            (line  286)
* KEY_MIN (curses モジュール):           定数<6>.            (line  143)
* KEY_MOUSE (curses モジュール):         定数<6>.            (line  418)
* KEY_MOVE (curses モジュール):          定数<6>.            (line  289)
* KEY_NEXT (curses モジュール):          定数<6>.            (line  292)
* KEY_NOTIFY (winreg モジュール):        アクセス権限.       (line   47)
* KEY_NPAGE (curses モジュール):         定数<6>.            (line  204)
* KEY_OPEN (curses モジュール):          定数<6>.            (line  295)
* KEY_OPTIONS (curses モジュール):       定数<6>.            (line  298)
* KEY_PPAGE (curses モジュール):         定数<6>.            (line  207)
* KEY_PREVIOUS (curses モジュール):      定数<6>.            (line  301)
* KEY_PRINT (curses モジュール):         定数<6>.            (line  229)
* KEY_QUERY_VALUE (winreg モジュール):   アクセス権限.       (line   31)
* KEY_READ (winreg モジュール):          アクセス権限.       (line   21)
* KEY_REDO (curses モジュール):          定数<6>.            (line  304)
* KEY_REFERENCE (curses モジュール):     定数<6>.            (line  307)
* KEY_REFRESH (curses モジュール):       定数<6>.            (line  310)
* KEY_REPLACE (curses モジュール):       定数<6>.            (line  313)
* KEY_RESET (curses モジュール):         定数<6>.            (line  226)
* KEY_RESIZE (curses モジュール):        定数<6>.            (line  421)
* KEY_RESTART (curses モジュール):       定数<6>.            (line  316)
* KEY_RESUME (curses モジュール):        定数<6>.            (line  319)
* KEY_RIGHT (curses モジュール):         定数<6>.            (line  158)
* KEY_SAVE (curses モジュール):          定数<6>.            (line  322)
* KEY_SBEG (curses モジュール):          定数<6>.            (line  325)
* KEY_SCANCEL (curses モジュール):       定数<6>.            (line  328)
* KEY_SCOMMAND (curses モジュール):      定数<6>.            (line  331)
* KEY_SCOPY (curses モジュール):         定数<6>.            (line  334)
* KEY_SCREATE (curses モジュール):       定数<6>.            (line  337)
* KEY_SDC (curses モジュール):           定数<6>.            (line  340)
* KEY_SDL (curses モジュール):           定数<6>.            (line  343)
* KEY_SELECT (curses モジュール):        定数<6>.            (line  346)
* KEY_SEND (curses モジュール):          定数<6>.            (line  349)
* KEY_SEOL (curses モジュール):          定数<6>.            (line  352)
* KEY_SET_VALUE (winreg モジュール):     アクセス権限.       (line   35)
* KEY_SEXIT (curses モジュール):         定数<6>.            (line  355)
* KEY_SF (curses モジュール):            定数<6>.            (line  198)
* KEY_SFIND (curses モジュール):         定数<6>.            (line  358)
* KEY_SHELP (curses モジュール):         定数<6>.            (line  361)
* KEY_SHOME (curses モジュール):         定数<6>.            (line  364)
* KEY_SIC (curses モジュール):           定数<6>.            (line  367)
* KEY_SLEFT (curses モジュール):         定数<6>.            (line  370)
* KEY_SMESSAGE (curses モジュール):      定数<6>.            (line  373)
* KEY_SMOVE (curses モジュール):         定数<6>.            (line  376)
* KEY_SNEXT (curses モジュール):         定数<6>.            (line  379)
* KEY_SOPTIONS (curses モジュール):      定数<6>.            (line  382)
* KEY_SPREVIOUS (curses モジュール):     定数<6>.            (line  385)
* KEY_SPRINT (curses モジュール):        定数<6>.            (line  388)
* KEY_SR (curses モジュール):            定数<6>.            (line  201)
* KEY_SREDO (curses モジュール):         定数<6>.            (line  391)
* KEY_SREPLACE (curses モジュール):      定数<6>.            (line  394)
* KEY_SRESET (curses モジュール):        定数<6>.            (line  222)
* KEY_SRIGHT (curses モジュール):        定数<6>.            (line  397)
* KEY_SRSUME (curses モジュール):        定数<6>.            (line  400)
* KEY_SSAVE (curses モジュール):         定数<6>.            (line  403)
* KEY_SSUSPEND (curses モジュール):      定数<6>.            (line  406)
* KEY_STAB (curses モジュール):          定数<6>.            (line  210)
* KEY_SUNDO (curses モジュール):         定数<6>.            (line  409)
* KEY_SUSPEND (curses モジュール):       定数<6>.            (line  412)
* KEY_UNDO (curses モジュール):          定数<6>.            (line  415)
* KEY_UP (curses モジュール):            定数<6>.            (line  152)
* KEY_WOW64_32KEY (winreg モジュール):   64-bit 特有のアクセス権.
                                                             (line   15)
* KEY_WOW64_64KEY (winreg モジュール):   64-bit 特有のアクセス権.
                                                             (line    9)
* KEY_WRITE (winreg モジュール):         アクセス権限.       (line   16)
* key/value pair:                        辞書表示.           (line    6)
* KeyboardInterrupt:                     具象例外.           (line   90)
* KeyboardInterrupt (組み込み例外):      シグナルハンドリング<2>.
                                                             (line    7)
* KeyboardInterrupt (組み込み例外) <1>:  シグナルハンドリング<2>.
                                                             (line   34)
* KeyboardInterrupt (組み込み例外) <2>:  シグナルハンドリング<2>.
                                                             (line   44)
* KeyError:                              具象例外.           (line   85)
* keylog_filename (ssl.SSLContext の属性): SSL コンテキスト. (line  528)
* keyname() (curses モジュール):         関数<6>.            (line  274)
* keypad() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  378)
* keyrefs() (weakref.WeakKeyDictionary のメソッド): weakref --- Weak references.
                                                             (line  201)
* keys() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line  133)
* keys() (dict のメソッド):              マッピング型 --- dict.
                                                             (line  192)
* keys() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  232)
* keys() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  343)
* keys() (mailbox.Mailbox のメソッド):   Mailbox オブジェクト.
                                                             (line  110)
* keys() (sqlite3.Row のメソッド):       Row オブジェクト.   (line   20)
* keys() (types.MappingProxyType のメソッド): 標準的なインタプリタ型.
                                                             (line  275)
* keys() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   72)
* KeysView (collections.abc のクラス):   コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  127)
* KeysView (typing のクラス):            Aliases to container ABCs in collections abc.
                                                             (line   64)
* keyword (ast のクラス):                式 expression<2>.   (line  153)
* keyword argument:                      用語集<2>.          (line  998)
* keywords (functools.partial の属性):   partial オブジェクト.
                                                             (line   21)
* kill_python() (test.support.script_helper モジュール): test support script_helper --- Utilities for the Python execution tests.
                                                             (line   77)
* kill_workers() (concurrent.futures.ProcessPoolExecutor のメソッド): ProcessPoolExecutor.
                                                             (line  111)
* kill() (asyncio.subprocess.Process のメソッド): サブプロセスとやりとりする.
                                                             (line  108)
* kill() (asyncio.SubprocessTransport のメソッド): サブプロセス化されたトランスポート.
                                                             (line   35)
* kill() (multiprocessing.Process のメソッド): Process クラスと例外.
                                                             (line  242)
* kill() (os モジュール):                プロセス管理.       (line  324)
* kill() (subprocess.Popen のメソッド):  Popen オブジェクト. (line  102)
* killchar() (curses モジュール):        関数<6>.            (line  284)
* killpg() (os モジュール):              プロセス管理.       (line  346)
* kind (inspect.Parameter の属性):       Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  254)
* knownfiles (mimetypes モジュール):     mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  140)
* kqueue() (select モジュール):          select --- I/O 完了の待機.
                                                             (line   99)
* KqueueSelector (selectors のクラス):   クラス<4>.          (line  198)
* KW_ONLY (dataclasses モジュール):      モジュールの内容<4>.
                                                             (line  492)
* kwargs (inspect.BoundArguments の属性): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  381)
* kwargs (typing.ParamSpec の属性):      Building generic types and type aliases.
                                                             (line  458)
* kwlist (keyword モジュール):           keyword --- Python キーワードのテスト.
                                                             (line   18)
* L (re モジュール):                     フラグ.             (line   57)
* L2CAP_LM (socket モジュール):          定数<8>.            (line  346)
* lambda:                                用語集<2>.          (line 1001)
* Lambda (ast のクラス):                 関数およびクラス定義.
                                                             (line   32)
* lambda;expression:                     ラムダ lambda.      (line    6)
* lambda;expression <1>:                 関数定義.           (line  119)
* lambda;形式:                           ラムダ lambda.      (line    6)
* LambdaType (types モジュール):         標準的なインタプリタ型.
                                                             (line   24)
* LANG:                                  GNU gettext API.    (line   21)
* LANG <1>:                              クラス形式の API.   (line   25)
* LANG <2>:                              locale --- 国際化サービス.
                                                             (line   62)
* LANG <3>:                              locale --- 国際化サービス.
                                                             (line  357)
* LANG <4>:                              locale --- 国際化サービス.
                                                             (line  361)
* LANGUAGE:                              GNU gettext API.    (line   20)
* LANGUAGE <1>:                          クラス形式の API.   (line   25)
* large files:                           ラージファイルのサポート.
                                                             (line    6)
* LARGEST (test.support モジュール):     test support --- Utilities for the Python test suite.
                                                             (line  205)
* LargeZipFile:                          zipfile --- ZIP アーカイブの処理.
                                                             (line   45)
* last_accepted (multiprocessing.connection.Listener の属性): リスナーとクライアント.
                                                             (line  104)
* last_exc (sys モジュール):             sys --- システム固有のパラメーターと関数.
                                                             (line 1307)
* last_mode (compression.zstd.ZstdCompressor の属性): メモリ上での圧縮と展開.
                                                             (line  149)
* last_traceback (sys モジュール):       トレースバック traceback オブジェクト.
                                                             (line    6)
* last_traceback (sys モジュール) <1>:   sys --- システム固有のパラメーターと関数.
                                                             (line 1346)
* last_type (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 1346)
* last_value (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1346)
* lastChild (xml.dom.Node の属性):       Node オブジェクト.  (line   58)
* lastcmd (cmd.Cmd の属性):              Cmdオブジェクト.    (line  136)
* lastgroup (re.Match の属性):           マッチオブジェクト. (line  191)
* lastindex (re.Match の属性):           マッチオブジェクト. (line  183)
* lastResort (logging モジュール):       モジュールレベル属性.
                                                             (line    6)
* lastrowid (sqlite3.Cursor の属性):     Cursor オブジェクト.
                                                             (line  205)
* layout() (tkinter.ttk.Style のメソッド): Ttk スタイル.     (line   97)
* lazy (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  315)
* lazy2 (compression.zstd.Strategy の属性): Advanced parameter control.
                                                             (line  317)
* lazycache() (linecache モジュール):    linecache --- テキストラインへのランダムアクセス.
                                                             (line   56)
* LazyLoader (importlib.util のクラス):  importlib util -- Utility code for importers.
                                                             (line  196)
* LBRACE (token モジュール):             token --- Python 解析木で使われる定数.
                                                             (line  257)
* LBYL:                                  用語集<2>.          (line 1007)
* LC_ALL:                                GNU gettext API.    (line   20)
* LC_ALL <1>:                            クラス形式の API.   (line   25)
* LC_ALL (locale モジュール):            locale --- 国際化サービス.
                                                             (line  569)
* LC_COLLATE (locale モジュール):        locale --- 国際化サービス.
                                                             (line  534)
* LC_CTYPE (locale モジュール):          locale --- 国際化サービス.
                                                             (line  520)
* LC_MESSAGES:                           GNU gettext API.    (line   20)
* LC_MESSAGES <1>:                       クラス形式の API.   (line   25)
* LC_MESSAGES (locale モジュール):       locale --- 国際化サービス.
                                                             (line  550)
* LC_MONETARY (locale モジュール):       locale --- 国際化サービス.
                                                             (line  545)
* LC_NUMERIC (locale モジュール):        locale --- 国際化サービス.
                                                             (line  561)
* LC_TIME (locale モジュール):           locale --- 国際化サービス.
                                                             (line  540)
* lchflags() (os モジュール):            ファイルとディレクトリ.
                                                             (line  315)
* lchmod() (os モジュール):              ファイルとディレクトリ.
                                                             (line  329)
* lchmod() (pathlib.Path のメソッド):    パーミッションと所有者.
                                                             (line   60)
* lchown() (os モジュール):              ファイルとディレクトリ.
                                                             (line  351)
* lcm() (math モジュール):               Number-theoretic functions.
                                                             (line   51)
* ldexp() (math モジュール):             Floating point manipulation functions.
                                                             (line   76)
* LDFLAGS:                               新たなモジュール、改良されたモジュール、非推奨のモジュール<4>.
                                                             (line   57)
* LDFLAGS <1>:                           Preprocessor flags. (line   18)
* LDFLAGS <2>:                           Linker flags.       (line   15)
* LDFLAGS <3>:                           Linker flags.       (line   18)
* LDFLAGS <4>:                           Linker flags.       (line   28)
* LDFLAGS <5>:                           Linker flags.       (line   31)
* LDFLAGS <6>:                           Linker flags.       (line   35)
* LDFLAGS <7>:                           Linker flags.       (line   50)
* LDFLAGS_NODIST:                        Linker flags.       (line   26)
* LDFLAGS_NODIST <1>:                    Linker flags.       (line   40)
* ldm_bucket_size_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  162)
* ldm_hash_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  147)
* ldm_hash_rate_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  170)
* ldm_min_match (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  155)
* le() (operator モジュール):            operator --- 関数形式の標準演算子.
                                                             (line   24)
* leapdays() (calendar モジュール):      calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  363)
* leaveok() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  385)
* left (filecmp.dircmp の属性):          dircmp クラス.      (line   44)
* left_list (filecmp.dircmp の属性):     dircmp クラス.      (line   52)
* left_only (filecmp.dircmp の属性):     dircmp クラス.      (line   67)
* left() (turtle モジュール):            Turtle の動き.      (line   57)
* LEFTSHIFT (token モジュール):          token --- Python 解析木で使われる定数.
                                                             (line  281)
* LEFTSHIFTEQUAL (token モジュール):     token --- Python 解析木で使われる定数.
                                                             (line  314)
* LEGACY_TRANSACTION_CONTROL (sqlite3 モジュール): モジュール定数.
                                                             (line    6)
* lenfunc (C type):                      Slot Type typedefs. (line  105)
* length (xml.dom.NamedNodeMap の属性):  NamedNodeMap Objects.
                                                             (line    8)
* length (xml.dom.NodeList の属性):      NodeList オブジェクト.
                                                             (line   22)
* length_hint() (operator モジュール):   operator --- 関数形式の標準演算子.
                                                             (line  218)
* LESS (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  242)
* LESSEQUAL (token モジュール):          token --- Python 解析木で使われる定数.
                                                             (line  269)
* level (logging.Logger の属性):         ロガーオブジェクト. (line   32)
* lexical analyzer:                      用語集<2>.          (line 1022)
* LexicalHandler (xml.sax.handler のクラス): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line   44)
* lexists() (os.path モジュール):        os path --- 一般的なパス名操作.
                                                             (line  134)
* LF (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   51)
* lgamma() (math モジュール):            特殊関数.           (line   34)
* libc_ver() (platform モジュール):      Unix platforms.     (line    6)
* LIBRARIES_ASSEMBLY_NAME_PREFIX (msvcrt モジュール): その多の関数.
                                                             (line   98)
* library (dbm.ndbm モジュール):         dbm ndbm --- New Database Manager.
                                                             (line   36)
* library (ssl.SSLError の属性):         例外<19>.           (line   18)
* LibraryLoader (ctypes のクラス):       共有ライブラリをロードする.
                                                             (line  167)
* license (組み込み変数):                site モジュールで追加される定数.
                                                             (line   32)
* LifoQueue (asyncio のクラス):          LIFO キュー.        (line    6)
* LifoQueue (queue のクラス):            queue --- 同期キュークラス.
                                                             (line   39)
* light-weight processes:                _thread --- 低水準なスレッド API.
                                                             (line    6)
* limit_denominator() (fractions.Fraction のメソッド): fractions --- 有理数.
                                                             (line  166)
* LimitOverrunError:                     例外<16>.           (line   62)
* line (bdb.Breakpoint の属性):          bdb --- デバッガーフレームワーク.
                                                             (line   87)
* LINE (monitoring event):               Events.             (line   47)
* line (traceback.FrameSummary の属性):  FrameSummary オブジェクト.
                                                             (line   43)
* line_buffering (io.TextIOWrapper の属性): テキスト I/O<2>. (line  171)
* line_num (csv.csvreader の属性):       reader オブジェクト.
                                                             (line   24)
* line-buffered I/O:                     組み込み関数.       (line 1466)
* linear_regression() (statistics モジュール): 関数の詳細.   (line  610)
* lineno (ast.AST の属性):               Node クラス.        (line   49)
* lineno (doctest.DocTest の属性):       DocTest オブジェクト.
                                                             (line   41)
* lineno (doctest.Example の属性):       Example オブジェクト.
                                                             (line   39)
* lineno (inspect.FrameInfo の属性):     インタープリタスタック.
                                                             (line   22)
* lineno (inspect.Traceback の属性):     インタープリタスタック.
                                                             (line   61)
* lineno (json.JSONDecodeError の属性):  例外<20>.           (line   22)
* lineno (netrc.NetrcParseError の属性): netrc --- netrc ファイルの処理.
                                                             (line   63)
* lineno (pyclbr.Class の属性):          クラスオブジェクト<2>.
                                                             (line   24)
* lineno (pyclbr.Function の属性):       Function オブジェクト.
                                                             (line   23)
* lineno (re.PatternError の属性):       例外<3>.            (line   28)
* lineno (shlex.shlex の属性):           shlex オブジェクト. (line  168)
* lineno (SyntaxError の属性):           具象例外.           (line  316)
* lineno (tomllib.TOMLDecodeError の属性): tomllib --- TOML ファイルの解析.
                                                             (line   77)
* lineno (traceback.FrameSummary の属性): FrameSummary オブジェクト.
                                                             (line   34)
* lineno (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   93)
* lineno (tracemalloc.Filter の属性):    Filter.             (line   49)
* lineno (tracemalloc.Frame の属性):     Frame.              (line   17)
* lineno (xml.parsers.expat.ExpatError の属性): ExpatError 例外.
                                                             (line   26)
* lineno() (fileinput モジュール):       fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line   96)
* LINES:                                 関数<6>.            (line  140)
* LINES <1>:                             関数<6>.            (line  596)
* LINES <2>:                             関数<6>.            (line  598)
* LINES (curses モジュール):             定数<6>.            (line   51)
* lines (os.terminal_size の属性):       ターミナルのサイズの問い合わせ.
                                                             (line   33)
* linesep (email.policy.Policy の属性):  email policy Policy Objects.
                                                             (line  151)
* linesep (os モジュール):               雑多なシステム情報. (line  148)
* lineterminator (csv.Dialect の属性):   Dialect クラスと書式化パラメータ.
                                                             (line   56)
* LineTooLong:                           http client --- HTTP プロトコルクライアント.
                                                             (line  188)
* link() (os モジュール):                ファイルとディレクトリ.
                                                             (line  366)
* linked_to_musl() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  600)
* LinkFallbackError:                     tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  313)
* linkname (tarfile.TarInfo の属性):     TarInfo オブジェクト.
                                                             (line   97)
* LinkOutsideDestinationError:           tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  308)
* list:                                  用語集<2>.          (line 1026)
* List (ast のクラス):                   リテラル<3>.        (line  129)
* list (pdb command):                    Debugger commands.  (line  245)
* List (typing のクラス):                Aliases to built-in types.
                                                             (line   18)
* list (組み込みクラス):                 リスト型 list<2>.   (line   10)
* list comprehension:                    用語集<2>.          (line 1032)
* list_all() (concurrent.interpreters モジュール): リファレンス<4>.
                                                             (line    8)
* LIST_APPEND (opcode):                  Python バイトコード命令.
                                                             (line  380)
* list_dialects() (csv モジュール):      モジュールコンテンツ<3>.
                                                             (line   90)
* LIST_EXTEND (opcode):                  Python バイトコード命令.
                                                             (line  734)
* list_folders() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line   63)
* list_folders() (mailbox.MH のメソッド): MH オブジェクト.   (line   37)
* list;内包表記:                         リスト表示.         (line    6)
* list;表示:                             リスト表示.         (line    6)
* list() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line  207)
* list() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  234)
* list() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   55)
* list() (tarfile.TarFile のメソッド):   TarFile オブジェクト.
                                                             (line  125)
* ListComp (ast のクラス):               内包表記 Comprehension.
                                                             (line    6)
* listdir() (os モジュール):             ファイルとディレクトリ.
                                                             (line  389)
* listdrives() (os モジュール):          ファイルとディレクトリ.
                                                             (line  425)
* listen() (logging.config モジュール):  環境設定のための関数.
                                                             (line  115)
* listen() (socket.socket のメソッド):   socket オブジェクト.
                                                             (line  199)
* listen() (turtle モジュール):          スクリーンイベントを利用する.
                                                             (line    6)
* listener (logging.handlers.QueueHandler の属性): QueueHandler.
                                                             (line   95)
* Listener (multiprocessing.connection のクラス): リスナーとクライアント.
                                                             (line   50)
* listMethods() (xmlrpc.client.ServerProxy.system のメソッド): ServerProxy オブジェクト.
                                                             (line   16)
* listmounts() (os モジュール):          ファイルとディレクトリ.
                                                             (line  444)
* listvolumes() (os モジュール):         ファイルとディレクトリ.
                                                             (line  468)
* listxattr() (os モジュール):           Linux 拡張属性.     (line   26)
* Literal (typing モジュール):           特殊形式.           (line  140)
* literal_eval() (ast モジュール):       ast helpers.        (line   84)
* LiteralString (typing モジュール):     特殊型.             (line   67)
* LittleEndianStructure (ctypes のクラス): 構造化データ型.   (line   32)
* LittleEndianUnion (ctypes のクラス):   構造化データ型.     (line   20)
* ljust() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  303)
* ljust() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  303)
* ljust() (str のメソッド):              文字列メソッド<2>.  (line  453)
* LK_LOCK (msvcrt モジュール):           ファイル操作関連.   (line   19)
* LK_NBLCK (msvcrt モジュール):          ファイル操作関連.   (line   27)
* LK_NBRLCK (msvcrt モジュール):         ファイル操作関連.   (line   27)
* LK_RLCK (msvcrt モジュール):           ファイル操作関連.   (line   19)
* LK_UNLCK (msvcrt モジュール):          ファイル操作関連.   (line   33)
* ll (pdb command):                      Debugger commands.  (line  260)
* LMTP (smtplib のクラス):               smtplib --- SMTP プロトコルクライアント.
                                                             (line  106)
* ln() (decimal.Context のメソッド):     Context オブジェクト.
                                                             (line  376)
* ln() (decimal.Decimal のメソッド):     Decimal オブジェクト.
                                                             (line  338)
* LNKTYPE (tarfile モジュール):          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  334)
* Load (ast のクラス):                   変数.               (line   11)
* LOAD_ATTR (opcode):                    Python バイトコード命令.
                                                             (line  774)
* LOAD_BUILD_CLASS (opcode):             Python バイトコード命令.
                                                             (line  503)
* load_cert_chain() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  101)
* LOAD_CLOSURE (opcode):                 Python バイトコード命令.
                                                             (line 1500)
* LOAD_COMMON_CONSTANT (opcode):         Python バイトコード命令.
                                                             (line  494)
* LOAD_CONST (opcode):                   Python バイトコード命令.
                                                             (line  619)
* LOAD_CONST_IMMORTAL (opcode):          Python バイトコード命令.
                                                             (line 1483)
* load_default_certs() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  130)
* LOAD_DEREF (opcode):                   Python バイトコード命令.
                                                             (line 1017)
* load_dh_params() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  351)
* load_extension() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  482)
* LOAD_FAST (opcode):                    Python バイトコード命令.
                                                             (line  941)
* LOAD_FAST_AND_CLEAR (opcode):          Python バイトコード命令.
                                                             (line  979)
* LOAD_FAST_BORROW (opcode):             Python バイトコード命令.
                                                             (line  950)
* LOAD_FAST_BORROW_LOAD_FAST_BORROW (opcode): Python バイトコード命令.
                                                             (line  964)
* LOAD_FAST_CHECK (opcode):              Python バイトコード命令.
                                                             (line  971)
* LOAD_FAST_LOAD_FAST (opcode):          Python バイトコード命令.
                                                             (line  957)
* LOAD_FROM_DICT_OR_DEREF (opcode):      Python バイトコード命令.
                                                             (line 1025)
* LOAD_FROM_DICT_OR_GLOBALS (opcode):    Python バイトコード命令.
                                                             (line  644)
* LOAD_GLOBAL (opcode):                  Python バイトコード命令.
                                                             (line  933)
* LOAD_LOCALS (opcode):                  Python バイトコード命令.
                                                             (line  635)
* load_module() (importlib.abc.FileLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  315)
* load_module() (importlib.abc.InspectLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  269)
* load_module() (importlib.abc.Loader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  128)
* load_module() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  409)
* load_module() (importlib.machinery.SourceFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  231)
* load_module() (importlib.machinery.SourcelessFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  276)
* load_module() (zipimport.zipimporter のメソッド): zipimporter オブジェクト.
                                                             (line   79)
* LOAD_NAME (opcode):                    Python バイトコード命令.
                                                             (line  629)
* load_package_tests() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  662)
* LOAD_SMALL_INT (opcode):               Python バイトコード命令.
                                                             (line  623)
* LOAD_SPECIAL (opcode):                 Python バイトコード命令.
                                                             (line 1437)
* LOAD_SUPER_ATTR (opcode):              Python バイトコード命令.
                                                             (line  792)
* load_verify_locations() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  149)
* load() (http.cookiejar.FileCookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line  132)
* load() (http.cookies.BaseCookie のメソッド): Cookieオブジェクト.
                                                             (line   39)
* load() (json モジュール):              基本的な使い方<4>.  (line  108)
* load() (marshal モジュール):           marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line   92)
* load() (pickle モジュール):            モジュールインターフェース.
                                                             (line   62)
* load() (pickle.Unpickler のメソッド):  モジュールインターフェース.
                                                             (line  289)
* load() (plistlib モジュール):          plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line   46)
* load() (tomllib モジュール):           tomllib --- TOML ファイルの解析.
                                                             (line   32)
* load() (tracemalloc.Snapshot のクラスメソッド): Snapshot.  (line   51)
* loader:                                ファインダーとローダー.
                                                             (line    6)
* loader <1>:                            用語集<2>.          (line 1068)
* Loader (importlib.abc のクラス):       importlib abc -- Abstract base classes related to import.
                                                             (line   91)
* loader (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  384)
* loader_state (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  413)
* LoadError:                             http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line   33)
* LoadFileDialog (tkinter.filedialog のクラス): ネイティブの読み込み/保存ダイアログ.
                                                             (line  134)
* LoadKey() (winreg モジュール):         関数<14>.           (line  256)
* LoadLibrary() (ctypes.LibraryLoader のメソッド): 共有ライブラリをロードする.
                                                             (line  178)
* loads() (json モジュール):             基本的な使い方<4>.  (line  191)
* loads() (marshal モジュール):          marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line  130)
* loads() (pickle モジュール):           モジュールインターフェース.
                                                             (line   80)
* loads() (plistlib モジュール):         plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line   81)
* loads() (tomllib モジュール):          tomllib --- TOML ファイルの解析.
                                                             (line   49)
* loads() (xmlrpc.client モジュール):    補助関数.           (line   19)
* loadTestsFromModule() (unittest.TestLoader のメソッド): テストのロードと起動.
                                                             (line   41)
* loadTestsFromName() (unittest.TestLoader のメソッド): テストのロードと起動.
                                                             (line   71)
* loadTestsFromNames() (unittest.TestLoader のメソッド): テストのロードと起動.
                                                             (line  101)
* loadTestsFromTestCase() (unittest.TestLoader のメソッド): テストのロードと起動.
                                                             (line   29)
* local (threading のクラス):            Thread-local data.  (line  127)
* LOCAL_CREDS (socket モジュール):       定数<8>.            (line  413)
* LOCAL_CREDS_PERSISTENT (socket モジュール): 定数<8>.       (line  413)
* localcontext() (decimal モジュール):   Context オブジェクト.
                                                             (line   25)
* LOCALE (re モジュール):                フラグ.             (line   57)
* localeconv() (locale モジュール):      locale --- 国際化サービス.
                                                             (line   66)
* LocaleHTMLCalendar (calendar のクラス): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  329)
* LocaleTextCalendar (calendar のクラス): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  323)
* localize() (locale モジュール):        locale --- 国際化サービス.
                                                             (line  502)
* localName (xml.dom.Attr の属性):       Attr オブジェクト.  (line   13)
* localName (xml.dom.Node の属性):       Node オブジェクト.  (line   63)
* localtime() (email.utils モジュール):  email utils Miscellaneous utilities.
                                                             (line   13)
* localtime() (time モジュール):         関数<5>.            (line  149)
* Locator (xml.sax.xmlreader のクラス):  xml sax xmlreader --- XML パーサーのインターフェース.
                                                             (line   42)
* lock:                                  用語集<2>.          (line 1041)
* Lock (asyncio のクラス):               Lock.               (line    6)
* Lock (multiprocessing のクラス):       同期プリミティブ.   (line   65)
* lock (sys.thread_info の属性):         sys --- システム固有のパラメーターと関数.
                                                             (line 2082)
* Lock (threading のクラス):             Lock objects.       (line   34)
* LOCK_EX (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  198)
* LOCK_NB (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  202)
* LOCK_SH (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  194)
* LOCK_UN (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  190)
* lock-free:                             用語集<2>.          (line 1056)
* lock, interpreter:                     スレッド状態 thread state とグローバルインタプリタロック global interpreter lock.
                                                             (line    6)
* lock() (mailbox.Babyl のメソッド):     Babyl オブジェクト. (line   56)
* lock() (mailbox.Mailbox のメソッド):   Mailbox オブジェクト.
                                                             (line  252)
* lock() (mailbox.Maildir のメソッド):   Maildir オブジェクト.
                                                             (line  206)
* lock() (mailbox.mbox のメソッド):      mbox オブジェクト.  (line   58)
* lock() (mailbox.MH のメソッド):        MH オブジェクト.    (line   89)
* lock() (mailbox.MMDF のメソッド):      MMDF オブジェクト.  (line   47)
* Lock() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  191)
* locked() (_thread.lock のメソッド):    _thread --- 低水準なスレッド API.
                                                             (line  176)
* locked() (asyncio.Condition のメソッド): Condition.        (line   63)
* locked() (asyncio.Lock のメソッド):    Lock.               (line   60)
* locked() (asyncio.Semaphore のメソッド): Semaphore.        (line   53)
* locked() (multiprocessing.BoundedSemaphore のメソッド): 同期プリミティブ.
                                                             (line   35)
* locked() (multiprocessing.Lock のメソッド): 同期プリミティブ.
                                                             (line  119)
* locked() (multiprocessing.RLock のメソッド): 同期プリミティブ.
                                                             (line  193)
* locked() (multiprocessing.Semaphore のメソッド): 同期プリミティブ.
                                                             (line  220)
* locked() (threading.Condition のメソッド): Condition objects.
                                                             (line   96)
* locked() (threading.Lock のメソッド):  Lock objects.       (line   91)
* locked() (threading.RLock のメソッド): RLock objects.      (line  111)
* lockf() (fcntl モジュール):            fcntl --- fcntl および ioctl システムコール.
                                                             (line  183)
* lockf() (os モジュール):               ファイル記述子の操作.
                                                             (line  264)
* locking() (msvcrt モジュール):         ファイル操作関連.   (line    6)
* LockType (_thread モジュール):         _thread --- 低水準なスレッド API.
                                                             (line   27)
* LOG_ALERT (syslog モジュール):         syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  113)
* LOG_AUTH (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_AUTHPRIV (syslog モジュール):      syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_CONS (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  159)
* LOG_CRIT (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  113)
* LOG_CRON (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_DAEMON (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* log_date_time_string() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  376)
* LOG_DEBUG (syslog モジュール):         syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  113)
* LOG_EMERG (syslog モジュール):         syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  113)
* LOG_ERR (syslog モジュール):           syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  113)
* log_error() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  346)
* log_exception() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line  209)
* LOG_FTP (syslog モジュール):           syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_INFO (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  113)
* LOG_INSTALL (syslog モジュール):       syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_KERN (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_LAUNCHD (syslog モジュール):       syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_LOCAL0 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_LOCAL1 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_LOCAL2 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_LOCAL3 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_LOCAL4 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_LOCAL5 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_LOCAL6 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_LOCAL7 (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_LPR (syslog モジュール):           syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_MAIL (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* log_message() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  352)
* LOG_NDELAY (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  159)
* LOG_NETINFO (syslog モジュール):       syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_NEWS (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_NOTICE (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  113)
* LOG_NOWAIT (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  159)
* LOG_ODELAY (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  159)
* LOG_PERROR (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  159)
* LOG_PID (syslog モジュール):           syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  159)
* LOG_RAS (syslog モジュール):           syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_REMOTEAUTH (syslog モジュール):    syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* log_request() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  339)
* LOG_SYSLOG (syslog モジュール):        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* log_to_stderr() (multiprocessing モジュール): ログ記録<2>. (line   24)
* LOG_USER (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_UUCP (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  124)
* LOG_WARNING (syslog モジュール):       syslog --- Unix syslog ライブラリルーチン群.
                                                             (line  113)
* log() (cmath モジュール):              指数関数と対数関数. (line   11)
* log() (logging モジュール):            モジュールレベルの関数.
                                                             (line   96)
* log() (logging.Logger のメソッド):     ロガーオブジェクト. (line  302)
* log() (math モジュール):               Power exponential and logarithmic functions.
                                                             (line   40)
* log10() (cmath モジュール):            指数関数と対数関数. (line   17)
* log10() (decimal.Context のメソッド):  Context オブジェクト.
                                                             (line  380)
* log10() (decimal.Decimal のメソッド):  Decimal オブジェクト.
                                                             (line  343)
* log10() (math モジュール):             Power exponential and logarithmic functions.
                                                             (line   65)
* log1p() (math モジュール):             Power exponential and logarithmic functions.
                                                             (line   47)
* log2() (math モジュール):              Power exponential and logarithmic functions.
                                                             (line   52)
* logb() (decimal.Context のメソッド):   Context オブジェクト.
                                                             (line  384)
* logb() (decimal.Decimal のメソッド):   Decimal オブジェクト.
                                                             (line  348)
* Logger (logging のクラス):             ロガーオブジェクト. (line   23)
* LoggerAdapter (logging のクラス):      LoggerAdapter オブジェクト.
                                                             (line   10)
* logical_and() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  388)
* logical_and() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  356)
* logical_invert() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  392)
* logical_invert() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  362)
* logical_or() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  396)
* logical_or() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  367)
* logical_xor() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  400)
* logical_xor() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  373)
* login_cram_md5() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  219)
* login_tty() (os モジュール):           ファイル記述子の操作.
                                                             (line  290)
* login() (ftplib.FTP のメソッド):       FTP オブジェクト.   (line  127)
* login() (imaplib.IMAP4 のメソッド):    IMAP4 オブジェクト. (line  214)
* login() (smtplib.SMTP のメソッド):     SMTP オブジェクト.  (line   98)
* LOGNAME:                               プロセスのパラメーター.
                                                             (line  259)
* LOGNAME <1>:                           getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   58)
* lognormvariate() (random モジュール):  実数分布.           (line   72)
* logout() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  228)
* LogRecord (logging のクラス):          LogRecord オブジェクト.
                                                             (line   11)
* LONG_MAX (C macro):                    整数型オブジェクト integer object.
                                                             (line  165)
* LONG_TIMEOUT (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  110)
* longMessage (unittest.TestCase の属性): テストクラス.      (line  766)
* longname() (curses モジュール):        関数<6>.            (line  291)
* lookup_error() (codecs モジュール):    エラーハンドラ.     (line  125)
* lookup() (codecs モジュール):          codecs --- codec レジストリと基底クラス.
                                                             (line   56)
* lookup() (symtable.SymbolTable のメソッド): 記号表の検査.  (line  110)
* lookup() (tkinter.ttk.Style のメソッド): Ttk スタイル.     (line   82)
* lookup() (unicodedata モジュール):     unicodedata --- Unicode データベース.
                                                             (line   22)
* LookupError:                           基底クラス.         (line   79)
* loop control;target:                   break 文.           (line   12)
* loop_factory (unittest.IsolatedAsyncioTestCase の属性): テストクラス.
                                                             (line  919)
* loop;over mutable sequence:            共通のシーケンス演算.
                                                             (line   61)
* loop;statement:                        break 文.           (line    6)
* loop;statement <1>:                    continue 文.        (line    6)
* loop;statement <2>:                    while 文.           (line    6)
* loop;statement <3>:                    for 文<2>.          (line    6)
* LOOPBACK_TIMEOUT (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line   65)
* lower() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  623)
* lower() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  623)
* lower() (str のメソッド):              文字列メソッド<2>.  (line  470)
* LPAR (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  203)
* lpAttributeList (subprocess.STARTUPINFO の属性): Windows Popen ヘルパー.
                                                             (line   60)
* lru_cache() (functools モジュール):    functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  144)
* lseek() (os モジュール):               ファイル記述子の操作.
                                                             (line  301)
* LShift (ast のクラス):                 式 expression<2>.   (line   55)
* lshift() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line  118)
* LSQB (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  209)
* lstat() (os モジュール):               ファイルとディレクトリ.
                                                             (line  489)
* lstat() (pathlib.Path のメソッド):     ファイルの種類とステータスを問い合わせる.
                                                             (line   39)
* lstrip() (bytearray のメソッド):       bytes と bytearray の操作.
                                                             (line  315)
* lstrip() (bytes のメソッド):           bytes と bytearray の操作.
                                                             (line  315)
* lstrip() (str のメソッド):             文字列メソッド<2>.  (line  481)
* lsub() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line  235)
* Lt (ast のクラス):                     式 expression<2>.   (line  110)
* lt() (operator モジュール):            operator --- 関数形式の標準演算子.
                                                             (line   24)
* lt() (turtle モジュール):              Turtle の動き.      (line   57)
* LtE (ast のクラス):                    式 expression<2>.   (line  110)
* LWPCookieJar (http.cookiejar のクラス): FileCookieJar のサブクラスと web ブラウザとの連携.
                                                             (line   28)
* LZMACompressor (lzma のクラス):        メモリ上での圧縮と展開<2>.
                                                             (line    6)
* LZMADecompressor (lzma のクラス):      メモリ上での圧縮と展開<2>.
                                                             (line   91)
* LZMAError:                             lzma --- LZMA アルゴリズムを使用した圧縮.
                                                             (line   28)
* LZMAFile (lzma のクラス):              圧縮ファイルへの読み書き<2>.
                                                             (line   45)
* M (re モジュール):                     フラグ.             (line   80)
* mac_ver() (platform モジュール):       macOS platform.     (line    6)
* machine() (platform モジュール):       Cross platform.     (line   34)
* macros (netrc.netrc の属性):           netrc オブジェクト. (line   31)
* MADV_AUTOSYNC (mmap モジュール):       MADV_* 定数.        (line    6)
* MADV_CORE (mmap モジュール):           MADV_* 定数.        (line    6)
* MADV_DODUMP (mmap モジュール):         MADV_* 定数.        (line    6)
* MADV_DOFORK (mmap モジュール):         MADV_* 定数.        (line    6)
* MADV_DONTDUMP (mmap モジュール):       MADV_* 定数.        (line    6)
* MADV_DONTFORK (mmap モジュール):       MADV_* 定数.        (line    6)
* MADV_DONTNEED (mmap モジュール):       MADV_* 定数.        (line    6)
* MADV_FREE (mmap モジュール):           MADV_* 定数.        (line    6)
* MADV_FREE_REUSABLE (mmap モジュール):  MADV_* 定数.        (line    6)
* MADV_FREE_REUSE (mmap モジュール):     MADV_* 定数.        (line    6)
* MADV_HUGEPAGE (mmap モジュール):       MADV_* 定数.        (line    6)
* MADV_HWPOISON (mmap モジュール):       MADV_* 定数.        (line    6)
* MADV_MERGEABLE (mmap モジュール):      MADV_* 定数.        (line    6)
* MADV_NOCORE (mmap モジュール):         MADV_* 定数.        (line    6)
* MADV_NOHUGEPAGE (mmap モジュール):     MADV_* 定数.        (line    6)
* MADV_NORMAL (mmap モジュール):         MADV_* 定数.        (line    6)
* MADV_NOSYNC (mmap モジュール):         MADV_* 定数.        (line    6)
* MADV_PROTECT (mmap モジュール):        MADV_* 定数.        (line    6)
* MADV_RANDOM (mmap モジュール):         MADV_* 定数.        (line    6)
* MADV_REMOVE (mmap モジュール):         MADV_* 定数.        (line    6)
* MADV_SEQUENTIAL (mmap モジュール):     MADV_* 定数.        (line    6)
* MADV_SOFT_OFFLINE (mmap モジュール):   MADV_* 定数.        (line    6)
* MADV_UNMERGEABLE (mmap モジュール):    MADV_* 定数.        (line    6)
* MADV_WILLNEED (mmap モジュール):       MADV_* 定数.        (line    6)
* madvise() (mmap.mmap のメソッド):      mmap --- メモリマップファイルのサポート.
                                                             (line  227)
* magic method:                          用語集<2>.          (line 1096)
* MAGIC_NUMBER (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line   13)
* magic;メソッド:                        用語集<2>.          (line 1100)
* MagicMock (unittest.mock のクラス):    Magic Mock.         (line    9)
* Mailbox (mailbox のクラス):            Mailbox オブジェクト.
                                                             (line    6)
* Maildir (mailbox のクラス):            Maildir オブジェクト.
                                                             (line    6)
* MaildirMessage (mailbox のクラス):     MaildirMessage オブジェクト.
                                                             (line    6)
* main_thread() (threading モジュール):  リファレンス<2>.    (line  104)
* main():                                プロセスワイドのパラメータ.
                                                             (line    7)
* main() <1>:                            プロセスワイドのパラメータ.
                                                             (line  223)
* main() <2>:                            PyConfig.           (line  129)
* main() (site モジュール):              モジュールの内容<5>.
                                                             (line   43)
* main() (unittest モジュール):          テストのロードと起動.
                                                             (line  508)
* mainloop() (turtle モジュール):        スクリーンイベントを利用する.
                                                             (line  105)
* maintype (email.headerregistry.ContentTypeHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  270)
* major (email.headerregistry.MIMEVersionHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  241)
* major() (os モジュール):               ファイルとディレクトリ.
                                                             (line  642)
* make_alternative() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  608)
* make_archive() (shutil モジュール):    アーカイブ化操作.   (line   14)
* make_bad_fd() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line  107)
* MAKE_CELL (opcode):                    Python バイトコード命令.
                                                             (line 1010)
* make_cookies() (http.cookiejar.CookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line   63)
* make_dataclass() (dataclasses モジュール): モジュールの内容<4>.
                                                             (line  394)
* make_file() (difflib.HtmlDiff のメソッド): difflib --- 差分の計算の補助.
                                                             (line  109)
* MAKE_FUNCTION (opcode):                Python バイトコード命令.
                                                             (line 1149)
* make_header() (email.header モジュール): email header 国際化されたヘッダー.
                                                             (line  213)
* make_legacy_pyc() (test.support.import_helper モジュール): test support import_helper --- Utilities for import tests.
                                                             (line   80)
* make_mixed() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  618)
* make_msgid() (email.utils モジュール): email utils Miscellaneous utilities.
                                                             (line   27)
* make_parser() (xml.sax モジュール):    xml sax --- SAX2 バーサーのサポート.
                                                             (line   28)
* make_pkg() (test.support.script_helper モジュール): test support script_helper --- Utilities for the Python execution tests.
                                                             (line   97)
* make_related() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  599)
* make_script() (test.support.script_helper モジュール): test support script_helper --- Utilities for the Python execution tests.
                                                             (line   82)
* make_server() (wsgiref.simple_server モジュール): wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line   14)
* make_table() (difflib.HtmlDiff のメソッド): difflib --- 差分の計算の補助.
                                                             (line  140)
* make_zip_pkg() (test.support.script_helper モジュール): test support script_helper --- Utilities for the Python execution tests.
                                                             (line  103)
* make_zip_script() (test.support.script_helper モジュール): test support script_helper --- Utilities for the Python execution tests.
                                                             (line   89)
* makedev() (os モジュール):             ファイルとディレクトリ.
                                                             (line  652)
* makedirs() (os モジュール):            ファイルとディレクトリ.
                                                             (line  557)
* makeelement() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  160)
* makefile() (socket のメソッド):        I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* makefile() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  211)
* makeLogRecord() (logging モジュール):  モジュールレベルの関数.
                                                             (line  187)
* makePickle() (logging.handlers.SocketHandler のメソッド): SocketHandler.
                                                             (line   45)
* makeRecord() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  364)
* makeSocket() (logging.handlers.DatagramHandler のメソッド): DatagramHandler.
                                                             (line   38)
* makeSocket() (logging.handlers.SocketHandler のメソッド): SocketHandler.
                                                             (line   39)
* maketrans() (bytearray の静的メソッド): bytes と bytearray の操作.
                                                             (line  177)
* maketrans() (bytes の静的メソッド):    bytes と bytearray の操作.
                                                             (line  177)
* maketrans() (str の静的メソッド):      文字列メソッド<2>.  (line  502)
* MalformedHeaderDefect:                 email errors Exception and Defect classes.
                                                             (line  108)
* malloc (C function):                   概要<4>.            (line   33)
* manager (logging.LoggerAdapter の属性): LoggerAdapter オブジェクト.
                                                             (line   31)
* mangle_from_ (email.policy.Compat32 の属性): email policy Policy Objects.
                                                             (line  572)
* mangle_from_ (email.policy.Policy の属性): email policy Policy Objects.
                                                             (line  185)
* MANPAGER:                              pydoc --- ドキュメント生成とオンラインヘルプシステム.
                                                             (line   46)
* MANPAGER <1>:                          pydoc --- ドキュメント生成とオンラインヘルプシステム.
                                                             (line   48)
* mant_dig (sys.float_info の属性):      sys --- システム固有のパラメーターと関数.
                                                             (line  651)
* MAP_32BIT (mmap モジュール):           MAP_* 定数.         (line    6)
* MAP_ADD (opcode):                      Python バイトコード命令.
                                                             (line  389)
* MAP_ALIGNED_SUPER (mmap モジュール):   MAP_* 定数.         (line    6)
* MAP_ANON (mmap モジュール):            MAP_* 定数.         (line    6)
* MAP_ANONYMOUS (mmap モジュール):       MAP_* 定数.         (line    6)
* map_async() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line  115)
* MAP_CONCEAL (mmap モジュール):         MAP_* 定数.         (line    6)
* MAP_DENYWRITE (mmap モジュール):       MAP_* 定数.         (line    6)
* MAP_EXECUTABLE (mmap モジュール):      MAP_* 定数.         (line    6)
* MAP_HASSEMAPHORE (mmap モジュール):    MAP_* 定数.         (line    6)
* MAP_JIT (mmap モジュール):             MAP_* 定数.         (line    6)
* MAP_NOCACHE (mmap モジュール):         MAP_* 定数.         (line    6)
* MAP_NOEXTEND (mmap モジュール):        MAP_* 定数.         (line    6)
* MAP_NORESERVE (mmap モジュール):       MAP_* 定数.         (line    6)
* MAP_POPULATE (mmap モジュール):        MAP_* 定数.         (line    6)
* MAP_PRIVATE (mmap モジュール):         MAP_* 定数.         (line    6)
* MAP_RESILIENT_CODESIGN (mmap モジュール): MAP_* 定数.      (line    6)
* MAP_RESILIENT_MEDIA (mmap モジュール): MAP_* 定数.         (line    6)
* MAP_SHARED (mmap モジュール):          MAP_* 定数.         (line    6)
* MAP_STACK (mmap モジュール):           MAP_* 定数.         (line    6)
* map_table_b2() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line   49)
* map_table_b3() (stringprep モジュール): stringprep --- インターネットの文字列調製.
                                                             (line   54)
* map_to_type() (email.headerregistry.HeaderRegistry のメソッド): email headerregistry Custom Header Objects.
                                                             (line  371)
* MAP_TPRO (mmap モジュール):            MAP_* 定数.         (line    6)
* MAP_TRANSLATED_ALLOW_EXECUTE (mmap モジュール): MAP_* 定数.
                                                             (line    6)
* MAP_UNIX03 (mmap モジュール):          MAP_* 定数.         (line    6)
* map() (concurrent.futures.Executor のメソッド): Executor オブジェクト.
                                                             (line   21)
* map() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line   98)
* map() (tkinter.ttk.Style のメソッド):  Ttk スタイル.       (line   49)
* mapLogRecord() (logging.handlers.HTTPHandler のメソッド): HTTPHandler.
                                                             (line   26)
* mapping:                               用語集<2>.          (line 1100)
* Mapping (collections.abc のクラス):    コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  121)
* Mapping (typing のクラス):             Aliases to container ABCs in collections abc.
                                                             (line   72)
* MappingProxyType (types のクラス):     標準的なインタプリタ型.
                                                             (line  226)
* MappingView (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  127)
* MappingView (typing のクラス):         Aliases to container ABCs in collections abc.
                                                             (line   80)
* mapPriority() (logging.handlers.SysLogHandler のメソッド): SysLogHandler.
                                                             (line  206)
* maps (collections.ChainMap の属性):    ChainMap オブジェクト.
                                                             (line   37)
* MARCH (calendar モジュール):           calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  483)
* markcoroutinefunction() (inspect モジュール): 型とメンバー.
                                                             (line  469)
* master (tkinter.Tk の属性):            Tkinter モジュール. (line   76)
* Match (ast のクラス):                  Pattern matching.   (line    6)
* Match (re のクラス):                   マッチオブジェクト. (line   14)
* Match (typing のクラス):               Aliases to other concrete types.
                                                             (line    6)
* match_case (ast のクラス):             Pattern matching.   (line   15)
* MATCH_CLASS (opcode):                  Python バイトコード命令.
                                                             (line 1257)
* MATCH_KEYS (opcode):                   Python バイトコード命令.
                                                             (line  534)
* MATCH_MAPPING (opcode):                Python バイトコード命令.
                                                             (line  515)
* MATCH_SEQUENCE (opcode):               Python バイトコード命令.
                                                             (line  524)
* match_value() (test.support.Matcher のメソッド): test support --- Utilities for the Python test suite.
                                                             (line  825)
* match;case:                            match 文<2>.        (line    6)
* match() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  294)
* match() (re モジュール):               関数<2>.            (line   46)
* match() (re.Pattern のメソッド):       正規表現オブジェクト.
                                                             (line   41)
* MatchAs (ast のクラス):                Pattern matching.   (line  293)
* MatchClass (ast のクラス):             Pattern matching.   (line  230)
* Matcher (test.support のクラス):       test support --- Utilities for the Python test suite.
                                                             (line  819)
* matches() (test.support.Matcher のメソッド): test support --- Utilities for the Python test suite.
                                                             (line  821)
* MatchMapping (ast のクラス):           Pattern matching.   (line  184)
* MatchOr (ast のクラス):                Pattern matching.   (line  333)
* MatchSequence (ast のクラス):          Pattern matching.   (line  114)
* MatchSingleton (ast のクラス):         Pattern matching.   (line   90)
* MatchStar (ast のクラス):              Pattern matching.   (line  144)
* MatchValue (ast のクラス):             Pattern matching.   (line   63)
* matmul() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line  133)
* MatMult (ast のクラス):                式 expression<2>.   (line   55)
* matrix multiplication:                 二項算術演算 binary arithmetic operation.
                                                             (line   29)
* max (datetime.date の属性):            date objects.       (line  134)
* max (datetime.datetime の属性):        datetime objects.   (line  295)
* max (datetime.time の属性):            time objects.       (line   37)
* max (datetime.timedelta の属性):       timedelta objects.  (line   90)
* max (sys.float_info の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line  656)
* MAX (uuid モジュール):                 uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  319)
* max_10_exp (sys.float_info の属性):    sys --- システム固有のパラメーターと関数.
                                                             (line  665)
* max_children (socketserver.ThreadingMixIn の属性): サーバ生成に関するノート.
                                                             (line   55)
* max_count (email.headerregistry.BaseHeader の属性): email headerregistry Custom Header Objects.
                                                             (line   61)
* MAX_EMAX (decimal モジュール):         定数<4>.            (line   16)
* max_exp (sys.float_info の属性):       sys --- システム固有のパラメーターと関数.
                                                             (line  660)
* MAX_INTERPOLATION_DEPTH (configparser モジュール): ConfigParser オブジェクト.
                                                             (line  338)
* max_line_length (email.policy.Policy の属性): email policy Policy Objects.
                                                             (line  144)
* max_lines (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  265)
* max_mag() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  408)
* max_mag() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  386)
* max_memuse (test.support モジュール):  test support --- Utilities for the Python test suite.
                                                             (line  163)
* MAX_PREC (decimal モジュール):         定数<4>.            (line   13)
* max_prefixlen (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line   50)
* max_prefixlen (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line   63)
* max_prefixlen (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  273)
* max_prefixlen (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  297)
* MAX_Py_ssize_t (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  158)
* MAX_WBITS (zlib モジュール):           zlib --- gzip 互換の圧縮.
                                                             (line  305)
* max() (decimal.Context のメソッド):    Context オブジェクト.
                                                             (line  404)
* max() (decimal.Decimal のメソッド):    Decimal オブジェクト.
                                                             (line  379)
* maxarray (reprlib.Repr の属性):        Reprオブジェクト.   (line   21)
* maxdeque (reprlib.Repr の属性):        Reprオブジェクト.   (line   21)
* maxdict (reprlib.Repr の属性):         Reprオブジェクト.   (line   21)
* maxDiff (unittest.TestCase の属性):    テストクラス.       (line  784)
* maxfrozenset (reprlib.Repr の属性):    Reprオブジェクト.   (line   21)
* MAXIMUM_SUPPORTED (ssl.TLSVersion の属性): 定数<9>.        (line  572)
* maximum_version (ssl.SSLContext の属性): SSL コンテキスト. (line  539)
* maxlen (collections.deque の属性):     deque オブジェクト. (line  121)
* maxlevel (reprlib.Repr の属性):        Reprオブジェクト.   (line   17)
* maxlist (reprlib.Repr の属性):         Reprオブジェクト.   (line   21)
* maxlong (reprlib.Repr の属性):         Reprオブジェクト.   (line   33)
* maxother (reprlib.Repr の属性):        Reprオブジェクト.   (line   45)
* maxset (reprlib.Repr の属性):          Reprオブジェクト.   (line   21)
* maxsize (asyncio.Queue の属性):        Queue.              (line   22)
* maxsize (sys モジュール):              sys --- システム固有のパラメーターと関数.
                                                             (line 1354)
* maxstring (reprlib.Repr の属性):       Reprオブジェクト.   (line   38)
* maxtuple (reprlib.Repr の属性):        Reprオブジェクト.   (line   21)
* maxunicode (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1360)
* MAXYEAR (datetime モジュール):         定数.               (line   13)
* MAY (calendar モジュール):             calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  483)
* MB_ICONASTERISK (winsound モジュール): winsound --- Windows 用の音声再生インターフェース.
                                                             (line  161)
* MB_ICONERROR (winsound モジュール):    winsound --- Windows 用の音声再生インターフェース.
                                                             (line  181)
* MB_ICONEXCLAMATION (winsound モジュール): winsound --- Windows 用の音声再生インターフェース.
                                                             (line  165)
* MB_ICONHAND (winsound モジュール):     winsound --- Windows 用の音声再生インターフェース.
                                                             (line  169)
* MB_ICONINFORMATION (winsound モジュール): winsound --- Windows 用の音声再生インターフェース.
                                                             (line  187)
* MB_ICONQUESTION (winsound モジュール): winsound --- Windows 用の音声再生インターフェース.
                                                             (line  173)
* MB_ICONSTOP (winsound モジュール):     winsound --- Windows 用の音声再生インターフェース.
                                                             (line  193)
* MB_ICONWARNING (winsound モジュール):  winsound --- Windows 用の音声再生インターフェース.
                                                             (line  199)
* MB_OK (winsound モジュール):           winsound --- Windows 用の音声再生インターフェース.
                                                             (line  177)
* mbox (mailbox のクラス):               mbox オブジェクト.  (line    6)
* mboxMessage (mailbox のクラス):        mboxMessage オブジェクト.
                                                             (line    6)
* md5() (hashlib モジュール):            コンストラクタ.     (line   20)
* mean (statistics.NormalDist の属性):   NormalDist オブジェクト.
                                                             (line   21)
* mean() (statistics モジュール):        関数の詳細.         (line    9)
* measure() (tkinter.font.Font のメソッド): tkinter font --- Tkinter フォントラッパー.
                                                             (line   63)
* median (statistics.NormalDist の属性): NormalDist オブジェクト.
                                                             (line   26)
* median_grouped() (statistics モジュール): 関数の詳細.      (line  265)
* median_high() (statistics モジュール): 関数の詳細.         (line  248)
* median_low() (statistics モジュール):  関数の詳細.         (line  231)
* median() (statistics モジュール):      関数の詳細.         (line  205)
* member_names (enum.EnumDict の属性):   データ型<2>.        (line  752)
* member() (enum モジュール):            ユーティリティとデコレータ.
                                                             (line   81)
* MemberDescriptorType (types モジュール): 標準的なインタプリタ型.
                                                             (line  210)
* memfd_create() (os モジュール):        ファイルとディレクトリ.
                                                             (line 1836)
* memmove() (ctypes モジュール):         ユーティリティー関数.
                                                             (line  204)
* MemoryBIO (ssl のクラス):              メモリ BIO サポート<2>.
                                                             (line  132)
* MemoryError:                           具象例外.           (line  106)
* MemoryHandler (logging.handlers のクラス): MemoryHandler.  (line   42)
* memoryview (組み込みクラス):           メモリビュー.       (line   10)
* memoryview_at() (ctypes モジュール):   ユーティリティー関数.
                                                             (line  299)
* memset() (ctypes モジュール):          ユーティリティー関数.
                                                             (line  210)
* merge() (heapq モジュール):            heapq --- ヒープキューアルゴリズム.
                                                             (line  140)
* message (BaseExceptionGroup の属性):   例外グループ.       (line   30)
* Message (email.message のクラス):      email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line   49)
* Message (mailbox のクラス):            Message オブジェクト.
                                                             (line    6)
* Message (tkinter.messagebox のクラス): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line   21)
* message digest, MD5:                   hashlib --- セキュアハッシュとメッセージダイジェスト.
                                                             (line    8)
* message_factory (email.policy.Policy の属性): email policy Policy Objects.
                                                             (line  194)
* message_from_binary_file() (email モジュール): Parser API. (line  132)
* message_from_bytes() (email モジュール): Parser API.       (line  119)
* message_from_file() (email モジュール): Parser API.        (line  155)
* message_from_string() (email モジュール): Parser API.      (line  145)
* MessageBeep() (winsound モジュール):   winsound --- Windows 用の音声再生インターフェース.
                                                             (line   33)
* MessageClass (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  221)
* MessageDefect:                         email errors Exception and Defect classes.
                                                             (line   55)
* MessageError:                          email errors Exception and Defect classes.
                                                             (line   13)
* MessageParseError:                     email errors Exception and Defect classes.
                                                             (line   19)
* messages (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   22)
* meta hooks:                            インポートフック.   (line    6)
* meta path finder:                      用語集<2>.          (line 1110)
* meta_path (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 1369)
* meta() (curses モジュール):            関数<6>.            (line  298)
* metaclass:                             メタクラス.         (line    6)
* metaclass <1>:                         用語集<2>.          (line 1119)
* metaclass hint:                        適切なメタクラスの決定.
                                                             (line    6)
* metadata() (importlib.metadata モジュール): 配布物メタデータ.
                                                             (line    6)
* MetaPathFinder (importlib.abc のクラス): importlib abc -- Abstract base classes related to import.
                                                             (line   26)
* metavar (optparse.Option の属性):      オプション属性.     (line   88)
* MetavarTypeHelpFormatter (argparse のクラス): formatter_class.
                                                             (line   10)
* METH_CLASS (C macro):                  Implementing functions and methods.
                                                             (line  194)
* METH_COEXIST (C macro):                Implementing functions and methods.
                                                             (line  212)
* METH_FASTCALL (C macro):               Implementing functions and methods.
                                                             (line  124)
* METH_KEYWORDS (C macro):               Implementing functions and methods.
                                                             (line  108)
* METH_METHOD (C macro):                 Implementing functions and methods.
                                                             (line  151)
* METH_NOARGS (C macro):                 Implementing functions and methods.
                                                             (line  169)
* METH_O (C macro):                      Implementing functions and methods.
                                                             (line  181)
* METH_STATIC (C macro):                 Implementing functions and methods.
                                                             (line  202)
* METH_VARARGS (C macro):                Implementing functions and methods.
                                                             (line   98)
* method (urllib.request.Request の属性): Request オブジェクト.
                                                             (line   53)
* method resolution order:               用語集<2>.          (line 1142)
* method_calls (unittest.mock.Mock の属性): Mock クラス.     (line  498)
* methodcaller() (operator モジュール):  operator --- 関数形式の標準演算子.
                                                             (line  328)
* MethodDescriptorType (types モジュール): 標準的なインタプリタ型.
                                                             (line  108)
* methodHelp() (xmlrpc.client.ServerProxy.system のメソッド): ServerProxy オブジェクト.
                                                             (line   38)
* methods (pyclbr.Class の属性):         クラスオブジェクト<2>.
                                                             (line   50)
* methodSignature() (xmlrpc.client.ServerProxy.system のメソッド): ServerProxy オブジェクト.
                                                             (line   21)
* MethodType (in module types):          Function オブジェクト<3>.
                                                             (line   14)
* MethodType (in module types) <1>:      メソッドオブジェクト<2>.
                                                             (line   12)
* MethodType (types モジュール):         標準的なインタプリタ型.
                                                             (line   76)
* MethodWrapperType (types モジュール):  標準的なインタプリタ型.
                                                             (line   95)
* metrics() (tkinter.font.Font のメソッド): tkinter font --- Tkinter フォントラッパー.
                                                             (line   69)
* MFD_ALLOW_SEALING (os モジュール):     ファイルとディレクトリ.
                                                             (line 1854)
* MFD_CLOEXEC (os モジュール):           ファイルとディレクトリ.
                                                             (line 1854)
* MFD_HUGE_16GB (os モジュール):         ファイルとディレクトリ.
                                                             (line 1854)
* MFD_HUGE_16MB (os モジュール):         ファイルとディレクトリ.
                                                             (line 1854)
* MFD_HUGE_1GB (os モジュール):          ファイルとディレクトリ.
                                                             (line 1854)
* MFD_HUGE_1MB (os モジュール):          ファイルとディレクトリ.
                                                             (line 1854)
* MFD_HUGE_256MB (os モジュール):        ファイルとディレクトリ.
                                                             (line 1854)
* MFD_HUGE_2GB (os モジュール):          ファイルとディレクトリ.
                                                             (line 1854)
* MFD_HUGE_2MB (os モジュール):          ファイルとディレクトリ.
                                                             (line 1854)
* MFD_HUGE_32MB (os モジュール):         ファイルとディレクトリ.
                                                             (line 1854)
* MFD_HUGE_512KB (os モジュール):        ファイルとディレクトリ.
                                                             (line 1854)
* MFD_HUGE_512MB (os モジュール):        ファイルとディレクトリ.
                                                             (line 1854)
* MFD_HUGE_64KB (os モジュール):         ファイルとディレクトリ.
                                                             (line 1854)
* MFD_HUGE_8MB (os モジュール):          ファイルとディレクトリ.
                                                             (line 1854)
* MFD_HUGE_MASK (os モジュール):         ファイルとディレクトリ.
                                                             (line 1854)
* MFD_HUGE_SHIFT (os モジュール):        ファイルとディレクトリ.
                                                             (line 1854)
* MFD_HUGETLB (os モジュール):           ファイルとディレクトリ.
                                                             (line 1854)
* MH (mailbox のクラス):                 MH オブジェクト.    (line    6)
* MHMessage (mailbox のクラス):          MHMessage オブジェクト.
                                                             (line    6)
* microsecond (datetime.datetime の属性): datetime objects.  (line  332)
* microsecond (datetime.time の属性):    time objects.       (line   62)
* microseconds (datetime.timedelta の属性): timedelta objects.
                                                             (line  126)
* MIME;base64 encoding:                  base64 --- Base16 Base32 Base64 Base85 データのエンコード.
                                                             (line    8)
* MIME;content type:                     mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line    8)
* MIME;quoted-printable encoding:        quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line    8)
* MIME;ヘッダー:                         mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line   26)
* MIME;ヘッダー <1>:                     mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line   61)
* MIMEApplication (email.mime.application のクラス): email mime Creating email and MIME objects from scratch.
                                                             (line  101)
* MIMEAudio (email.mime.audio のクラス): email mime Creating email and MIME objects from scratch.
                                                             (line  131)
* MIMEBase (email.mime.base のクラス):   email mime Creating email and MIME objects from scratch.
                                                             (line   33)
* MIMEImage (email.mime.image のクラス): email mime Creating email and MIME objects from scratch.
                                                             (line  164)
* MIMEMessage (email.mime.message のクラス): email mime Creating email and MIME objects from scratch.
                                                             (line  197)
* MIMEMultipart (email.mime.multipart のクラス): email mime Creating email and MIME objects from scratch.
                                                             (line   71)
* MIMENonMultipart (email.mime.nonmultipart のクラス): email mime Creating email and MIME objects from scratch.
                                                             (line   60)
* MIMEPart (email.message のクラス):     email message Representing an email message.
                                                             (line  721)
* MIMEText (email.mime.text のクラス):   email mime Creating email and MIME objects from scratch.
                                                             (line  217)
* MimeTypes (mimetypes のクラス):        MimeTypes objects.  (line   10)
* mimetypes コマンドラインオプション; -e: コマンドラインでの使用<4>.
                                                             (line   18)
* mimetypes コマンドラインオプション; -extension: コマンドラインでの使用<4>.
                                                             (line   18)
* mimetypes コマンドラインオプション; -h: コマンドラインでの使用<4>.
                                                             (line   13)
* mimetypes コマンドラインオプション; -help: コマンドラインでの使用<4>.
                                                             (line   13)
* mimetypes コマンドラインオプション; -l: コマンドラインでの使用<4>.
                                                             (line   23)
* mimetypes コマンドラインオプション; -lenient: コマンドラインでの使用<4>.
                                                             (line   23)
* MIMEVersionHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  229)
* min (datetime.date の属性):            date objects.       (line  130)
* min (datetime.datetime の属性):        datetime objects.   (line  290)
* min (datetime.time の属性):            time objects.       (line   33)
* min (datetime.timedelta の属性):       timedelta objects.  (line   85)
* min (sys.float_info の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line  670)
* min_10_exp (sys.float_info の属性):    sys --- システム固有のパラメーターと関数.
                                                             (line  683)
* MIN_EMIN (decimal モジュール):         定数<4>.            (line   19)
* MIN_ETINY (decimal モジュール):        定数<4>.            (line   22)
* min_exp (sys.float_info の属性):       sys --- システム固有のパラメーターと関数.
                                                             (line  678)
* min_mag() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  416)
* min_mag() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  398)
* min_match (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line   93)
* min() (decimal.Context のメソッド):    Context オブジェクト.
                                                             (line  412)
* min() (decimal.Decimal のメソッド):    Decimal オブジェクト.
                                                             (line  391)
* MINEQUAL (token モジュール):           token --- Python 解析木で使われる定数.
                                                             (line  293)
* MINIMUM_SUPPORTED (ssl.TLSVersion の属性): 定数<9>.        (line  570)
* minimum_version (ssl.SSLContext の属性): SSL コンテキスト. (line  557)
* minor (email.headerregistry.MIMEVersionHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  245)
* minor() (os モジュール):               ファイルとディレクトリ.
                                                             (line  647)
* MINUS (token モジュール):              token --- Python 解析木で使われる定数.
                                                             (line  227)
* minus() (decimal.Context のメソッド):  Context オブジェクト.
                                                             (line  420)
* minute (datetime.datetime の属性):     datetime objects.   (line  324)
* minute (datetime.time の属性):         time objects.       (line   54)
* MINYEAR (datetime モジュール):         定数.               (line    8)
* mirrored() (unicodedata モジュール):   unicodedata --- Unicode データベース.
                                                             (line  114)
* misc_header (cmd.Cmd の属性):          Cmdオブジェクト.    (line  158)
* MisplacedEnvelopeHeaderDefect:         email errors Exception and Defect classes.
                                                             (line   96)
* MISSING (contextvars.Token の属性):    コンテキスト変数.   (line  128)
* MISSING (dataclasses モジュール):      モジュールの内容<4>.
                                                             (line  487)
* MISSING (sys.monitoring モジュール):   Callback function arguments.
                                                             (line    6)
* MISSING_C_DOCSTRINGS (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  175)
* missing_compiler_executable() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  708)
* MissingHeaderBodySeparatorDefect:      email errors Exception and Defect classes.
                                                             (line  100)
* MissingSectionHeaderError:             例外<9>.            (line   56)
* mkd() (ftplib.FTP のメソッド):         FTP オブジェクト.   (line  338)
* mkdir() (os モジュール):               ファイルとディレクトリ.
                                                             (line  522)
* mkdir() (pathlib.Path のメソッド):     ファイルとディレクトリの作成.
                                                             (line   21)
* mkdir() (zipfile.ZipFile のメソッド):  ZipFile objects.    (line  351)
* mkdtemp() (tempfile モジュール):       tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  287)
* mkfifo() (os モジュール):              ファイルとディレクトリ.
                                                             (line  597)
* mknod() (os モジュール):               ファイルとディレクトリ.
                                                             (line  620)
* mkstemp() (tempfile モジュール):       tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  229)
* mktemp() (tempfile モジュール):        非推奨の関数と変数. (line   14)
* mktime_tz() (email.utils モジュール):  email utils Miscellaneous utilities.
                                                             (line  145)
* mktime() (time モジュール):            関数<5>.            (line  162)
* mlsd() (ftplib.FTP のメソッド):        FTP オブジェクト.   (line  283)
* mmap (mmap のクラス):                  mmap --- メモリマップファイルのサポート.
                                                             (line   54)
* MMDF (mailbox のクラス):               MMDF オブジェクト.  (line    6)
* MMDFMessage (mailbox のクラス):        MMDFMessage オブジェクト.
                                                             (line    6)
* Mock (unittest.mock のクラス):         Mock クラス.        (line   23)
* mock_add_spec() (unittest.mock.Mock のメソッド): Mock クラス.
                                                             (line  249)
* mock_calls (unittest.mock.Mock の属性): Mock クラス.       (line  515)
* mock_open() (unittest.mock モジュール): mock_open.         (line    6)
* Mod (ast のクラス):                    式 expression<2>.   (line   55)
* mod() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  123)
* mode (bz2.BZ2File の属性):             ファイルの圧縮/解凍.
                                                             (line  128)
* mode (compression.zstd.ZstdFile の属性): 圧縮ファイルへの読み書き.
                                                             (line  106)
* mode (gzip.GzipFile の属性):           gzip --- gzip ファイルのサポート.
                                                             (line  149)
* mode (io.FileIO の属性):               生ファイルI/O.      (line   55)
* mode (lzma.LZMAFile の属性):           圧縮ファイルへの読み書き<2>.
                                                             (line   98)
* mode (statistics.NormalDist の属性):   NormalDist オブジェクト.
                                                             (line   31)
* mode (tarfile.TarInfo の属性):         TarInfo オブジェクト.
                                                             (line   79)
* mode() (statistics モジュール):        関数の詳細.         (line  314)
* mode() (turtle モジュール):            設定と特殊なメソッド.
                                                             (line    6)
* modf() (math モジュール):              Floating point arithmetic.
                                                             (line   54)
* modified() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   45)
* modify() (select.devpoll のメソッド):  /dev/poll ポーリングオブジェクト.
                                                             (line   49)
* modify() (select.epoll のメソッド):    エッジおよびレベルトリガポーリング epoll オブジェクト.
                                                             (line   92)
* modify() (select.poll のメソッド):     ポーリングオブジェクト.
                                                             (line   60)
* modify() (selectors.BaseSelector のメソッド): クラス<4>.   (line   97)
* module:                                用語集<2>.          (line 1149)
* Module (ast のクラス):                 Root nodes.         (line    6)
* module (pyclbr.Class の属性):          クラスオブジェクト<2>.
                                                             (line   16)
* module (pyclbr.Function の属性):       Function オブジェクト.
                                                             (line   15)
* MODULE (symtable.SymbolTableType の属性): 記号表の検査.    (line   11)
* Module browser:                        File メニュー Shell ウィンドウ、Editor ウィンドウ.
                                                             (line   23)
* module spec:                           ファインダーとローダー.
                                                             (line    6)
* module spec <1>:                       用語集<2>.          (line 1158)
* module_from_spec() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line  125)
* module; __future__:                    __future__ --- future 文の定義.
                                                             (line    6)
* module; __main__:                      __main__ --- トップレベルのコード環境.
                                                             (line    6)
* module; _thread:                       _thread --- 低水準なスレッド API.
                                                             (line    6)
* module; _tkinter:                      Tkinter モジュール. (line  149)
* module; abc:                           abc --- 抽象基底クラス.
                                                             (line    6)
* module; aifc:                          aifc --- Read and write AIFF and AIFC files.
                                                             (line    6)
* module; annotationlib:                 annotationlib --- Functionality for introspecting annotations.
                                                             (line    6)
* module; argparse:                      argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー.
                                                             (line    6)
* module; array:                         array --- 効率的な数値配列.
                                                             (line    6)
* module; ast:                           ast --- Abstract syntax trees.
                                                             (line    6)
* module; asynchat:                      asynchat --- Asynchronous socket command/response handler.
                                                             (line    6)
* module; asyncio:                       asyncio --- 非同期 I/O.
                                                             (line    6)
* module; asyncore:                      asyncore --- Asynchronous socket handler.
                                                             (line    6)
* module; atexit:                        atexit --- 終了ハンドラー.
                                                             (line    6)
* module; audioop:                       audioop --- Manipulate raw audio data.
                                                             (line    6)
* module; base64:                        base64 --- Base16 Base32 Base64 Base85 データのエンコード.
                                                             (line    6)
* module; bdb:                           bdb --- デバッガーフレームワーク.
                                                             (line    6)
* module; binascii:                      binascii --- バイナリ と ASCII 間の変換.
                                                             (line    6)
* module; bisect:                        bisect --- 配列二分法アルゴリズム.
                                                             (line    6)
* module; builtins:                      builtins --- 組み込みオブジェクト.
                                                             (line    6)
* module; bz2:                           bz2 --- bzip2 圧縮のサポート.
                                                             (line    6)
* module; calendar:                      calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line    6)
* module; cgi:                           cgi --- Common Gateway Interface のサポート.
                                                             (line    6)
* module; cgitb:                         cgitb --- Traceback manager for CGI scripts.
                                                             (line    6)
* module; chunk:                         chunk --- Read IFF chunked data.
                                                             (line    6)
* module; cmath:                         cmath --- 複素数用の数学関数.
                                                             (line    6)
* module; cmd:                           cmd --- 行指向のコマンドインタープリターのサポート.
                                                             (line    6)
* module; code:                          code --- インタープリター基底クラス.
                                                             (line    6)
* module; codecs:                        codecs --- codec レジストリと基底クラス.
                                                             (line    6)
* module; codeop:                        codeop --- Python コードをコンパイルする.
                                                             (line    6)
* module; collections:                   collections --- コンテナデータ型.
                                                             (line    6)
* module; collections.abc:               collections abc --- コンテナの抽象基底クラス.
                                                             (line    6)
* module; colorsys:                      colorsys --- 色体系間の変換.
                                                             (line    6)
* module; compileall:                    compileall --- Python ライブラリをバイトコンパイルする.
                                                             (line    6)
* module; compression:                   compression パッケージ.
                                                             (line    6)
* module; compression.zstd:              compression zstd --- Compression compatible with the Zstandard format.
                                                             (line    6)
* module; concurrent.futures:            concurrent futures --- 並列タスク実行.
                                                             (line    6)
* module; concurrent.interpreters:       concurrent interpreters --- Multiple interpreters in the same process.
                                                             (line    6)
* module; configparser:                  configparser --- 設定ファイルのパーサー.
                                                             (line    6)
* module; contextlib:                    contextlib --- with 文コンテキスト用ユーティリティ.
                                                             (line    6)
* module; contextvars:                   contextvars --- コンテキスト変数.
                                                             (line    6)
* module; copy:                          copy --- 浅いコピーおよび深いコピー操作.
                                                             (line    6)
* module; copyreg:                       copyreg --- pickle サポート関数を登録する.
                                                             (line    6)
* module; cProfile:                      profile and cProfile Module Reference.
                                                             (line    6)
* module; crypt:                         crypt --- Function to check Unix passwords.
                                                             (line    6)
* module; csv:                           csv --- CSV ファイルの読み書き.
                                                             (line    6)
* module; ctypes:                        ctypes --- Python 用の外部関数ライブラリ.
                                                             (line    6)
* module; curses:                        curses --- 文字セル表示のターミナル処理.
                                                             (line    6)
* module; curses.ascii:                  curses ascii --- ASCII 文字のユーティリティー.
                                                             (line    6)
* module; curses.panel:                  curses panel --- curses のためのパネルスタック拡張.
                                                             (line    6)
* module; curses.textpad:                curses textpad --- Text input widget for curses programs.
                                                             (line    6)
* module; dataclasses:                   dataclasses --- データクラス.
                                                             (line    6)
* module; datetime:                      datetime --- 基本的な日付と時間の型.
                                                             (line    6)
* module; dbm:                           dbm --- Unix "データベース" へのインターフェース.
                                                             (line    6)
* module; dbm.dumb:                      dbm dumb --- Portable DBM implementation.
                                                             (line    6)
* module; dbm.gnu:                       dbm gnu --- GNU database manager.
                                                             (line    6)
* module; dbm.ndbm:                      dbm ndbm --- New Database Manager.
                                                             (line    6)
* module; dbm.sqlite3:                   dbm sqlite3 --- SQLite backend for dbm.
                                                             (line    6)
* module; decimal:                       decimal --- 10進固定小数点と浮動小数点の演算.
                                                             (line    6)
* module; difflib:                       difflib --- 差分の計算の補助.
                                                             (line    6)
* module; dis:                           dis --- Python バイトコードの逆アセンブラー.
                                                             (line    6)
* module; distutils:                     distutils --- Building and installing Python modules.
                                                             (line    6)
* module; doctest:                       doctest --- 対話型の Python の例をテストする.
                                                             (line    6)
* module; email:                         email --- 電子メールと MIME 処理のためのパッケージ.
                                                             (line    6)
* module; email.charset:                 email charset 文字集合の表現.
                                                             (line    6)
* module; email.contentmanager:          email contentmanager Managing MIME Content.
                                                             (line    6)
* module; email.encoders:                email encoders エンコーダー.
                                                             (line    6)
* module; email.errors:                  email errors Exception and Defect classes.
                                                             (line    6)
* module; email.generator:               email generator Generating MIME documents.
                                                             (line    6)
* module; email.header:                  email header 国際化されたヘッダー.
                                                             (line    6)
* module; email.headerregistry:          email headerregistry Custom Header Objects.
                                                             (line    6)
* module; email.iterators:               email iterators イテレータ.
                                                             (line    6)
* module; email.message:                 email message Representing an email message.
                                                             (line    6)
* module; email.mime:                    email mime Creating email and MIME objects from scratch.
                                                             (line    6)
* module; email.mime.application:        email mime Creating email and MIME objects from scratch.
                                                             (line  101)
* module; email.mime.audio:              email mime Creating email and MIME objects from scratch.
                                                             (line  131)
* module; email.mime.base:               email mime Creating email and MIME objects from scratch.
                                                             (line   33)
* module; email.mime.image:              email mime Creating email and MIME objects from scratch.
                                                             (line  164)
* module; email.mime.message:            email mime Creating email and MIME objects from scratch.
                                                             (line  197)
* module; email.mime.multipart:          email mime Creating email and MIME objects from scratch.
                                                             (line   71)
* module; email.mime.nonmultipart:       email mime Creating email and MIME objects from scratch.
                                                             (line   60)
* module; email.mime.text:               email mime Creating email and MIME objects from scratch.
                                                             (line  217)
* module; email.parser:                  email parser Parsing email messages.
                                                             (line    6)
* module; email.policy:                  email policy Policy Objects.
                                                             (line    6)
* module; email.utils:                   email utils Miscellaneous utilities.
                                                             (line    6)
* module; encodings:                     encodings --- Encodings package.
                                                             (line    6)
* module; encodings.idna:                encodings idna --- Internationalized Domain Names in Applications.
                                                             (line    6)
* module; encodings.mbcs:                encodings mbcs --- Windows ANSI codepage.
                                                             (line    6)
* module; encodings.utf_8_sig:           encodings utf_8_sig --- UTF-8 codec with BOM signature.
                                                             (line    6)
* module; ensurepip:                     ensurepip --- pip インストーラーのブートストラップ.
                                                             (line    6)
* module; enum:                          enum --- 列挙型のサポート.
                                                             (line    6)
* module; errno:                         errno --- 標準の errno システムシンボル.
                                                             (line    6)
* module; faulthandler:                  faulthandler --- Python トレースバックをダンプする.
                                                             (line    6)
* module; fcntl:                         fcntl --- fcntl および ioctl システムコール.
                                                             (line    6)
* module; filecmp:                       filecmp --- ファイルとディレクトリの比較.
                                                             (line    6)
* module; fileinput:                     fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line    6)
* module; fnmatch:                       fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line    6)
* module; fractions:                     fractions --- 有理数.
                                                             (line    6)
* module; ftplib:                        ftplib --- FTP プロトコルクライアント.
                                                             (line    6)
* module; functools:                     functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line    6)
* module; gc:                            gc --- ガベージコレクターインターフェース.
                                                             (line    6)
* module; getopt:                        getopt --- C-style parser for command line options.
                                                             (line    6)
* module; getpass:                       getpass --- 可搬性のあるパスワード入力機構.
                                                             (line    6)
* module; gettext:                       gettext --- 多言語国際化サービス.
                                                             (line    6)
* module; glob:                          glob --- Unix 形式のパス名のパターン展開.
                                                             (line    6)
* module; graphlib:                      graphlib --- グラフ構造を操作する機能.
                                                             (line    6)
* module; grp:                           grp --- グループデータベース.
                                                             (line    6)
* module; gzip:                          gzip --- gzip ファイルのサポート.
                                                             (line    6)
* module; hashlib:                       hashlib --- セキュアハッシュとメッセージダイジェスト.
                                                             (line    6)
* module; heapq:                         heapq --- ヒープキューアルゴリズム.
                                                             (line    6)
* module; hmac:                          hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line    6)
* module; html:                          html --- HyperText Markup Language のサポート.
                                                             (line    6)
* module; html.entities:                 html entities --- HTML 一般実体の定義.
                                                             (line    6)
* module; html.parser:                   html parser --- HTML と XHTML のシンプルなパーサー.
                                                             (line    6)
* module; http:                          http --- HTTP モジュール群.
                                                             (line    6)
* module; http.client:                   http client --- HTTP プロトコルクライアント.
                                                             (line    6)
* module; http.cookiejar:                http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line    6)
* module; http.cookies:                  http cookies --- HTTP の状態管理.
                                                             (line    6)
* module; http.server:                   http server --- HTTP サーバー.
                                                             (line    6)
* module; idlelib:                       idlelib --- implementation of IDLE application.
                                                             (line    6)
* module; imaplib:                       imaplib --- IMAP4 プロトコルクライアント.
                                                             (line    6)
* module; imghdr:                        imghdr --- Determine the type of an image.
                                                             (line    6)
* module; imp:                           imp --- Access the import internals.
                                                             (line    6)
* module; importlib:                     importlib --- import の実装.
                                                             (line    6)
* module; importlib.abc:                 importlib abc -- Abstract base classes related to import.
                                                             (line    6)
* module; importlib.machinery:           importlib machinery -- Importers and path hooks.
                                                             (line    6)
* module; importlib.metadata:            importlib metadata -- パッケージメタデータへのアクセス.
                                                             (line    6)
* module; importlib.resources:           importlib resources -- パッケージリソースの読み取り、オープン、アクセス.
                                                             (line    6)
* module; importlib.resources.abc:       importlib resources abc -- リソースの抽象基底クラス.
                                                             (line    6)
* module; importlib.util:                importlib util -- Utility code for importers.
                                                             (line    6)
* module; inspect:                       inspect --- 活動中のオブジェクトを調査する.
                                                             (line    6)
* module; io:                            io --- ストリームを扱うコアツール.
                                                             (line    6)
* module; ipaddress:                     ipaddress --- IPv4/IPv6 操作ライブラリ.
                                                             (line    6)
* module; itertools:                     itertools --- 効率的なループ用のイテレータ生成関数群.
                                                             (line    6)
* module; json:                          json --- JSON エンコーダーとデコーダー.
                                                             (line    6)
* module; json.tool:                     コマンドライン・インターフェース<5>.
                                                             (line    6)
* module; keyword:                       keyword --- Python キーワードのテスト.
                                                             (line    6)
* module; linecache:                     linecache --- テキストラインへのランダムアクセス.
                                                             (line    6)
* module; locale:                        locale --- 国際化サービス.
                                                             (line    6)
* module; logging:                       logging --- Python 用のログ記録手段.
                                                             (line    6)
* module; logging.config:                logging config --- ログ記録の環境設定.
                                                             (line    6)
* module; logging.handlers:              logging handlers --- ログ記録ハンドラー.
                                                             (line    6)
* module; lzma:                          lzma --- LZMA アルゴリズムを使用した圧縮.
                                                             (line    6)
* module; mailbox:                       mailbox --- 様々な形式のメールボックスを操作する.
                                                             (line    6)
* module; mailcap:                       mailcap --- Mailcap file handling.
                                                             (line    6)
* module; marshal:                       marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line    6)
* module; math:                          math --- 数学関数.  (line    6)
* module; mimetypes:                     mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line    6)
* module; mmap:                          mmap --- メモリマップファイルのサポート.
                                                             (line    6)
* module; modulefinder:                  modulefinder --- スクリプト中で使用されているモジュールの検索.
                                                             (line    6)
* module; msilib:                        msilib --- Read and write Microsoft Installer files.
                                                             (line    6)
* module; msvcrt:                        msvcrt --- MS VC++ ランタイムの有用なルーチン群.
                                                             (line    6)
* module; multiprocessing:               multiprocessing --- プロセスベースの並列処理.
                                                             (line    6)
* module; multiprocessing.connection:    リスナーとクライアント.
                                                             (line    6)
* module; multiprocessing.dummy:         The multiprocessing dummy module.
                                                             (line    6)
* module; multiprocessing.managers:      マネージャー.       (line   20)
* module; multiprocessing.pool:          プロセスプール.     (line    6)
* module; multiprocessing.shared_memory: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line    6)
* module; multiprocessing.sharedctypes:  The multiprocessing sharedctypes module.
                                                             (line    6)
* module; netrc:                         netrc --- netrc ファイルの処理.
                                                             (line    6)
* module; nis:                           nis --- Interface to Sun’s NIS Yellow Pages.
                                                             (line    6)
* module; nntplib:                       nntplib --- NNTP protocol client.
                                                             (line    6)
* module; numbers:                       numbers --- 数の抽象基底クラス.
                                                             (line    6)
* module; operator:                      operator --- 関数形式の標準演算子.
                                                             (line    6)
* module; optparse:                      optparse --- Parser for command line options.
                                                             (line    6)
* module; os:                            os --- 雑多なオペレーティングシステムインターフェース.
                                                             (line    6)
* module; os.path:                       os path --- 一般的なパス名操作.
                                                             (line    6)
* module; ossaudiodev:                   ossaudiodev --- Access to OSS-compatible audio devices.
                                                             (line    6)
* module; pathlib:                       pathlib --- オブジェクト指向のファイルシステムパス.
                                                             (line    6)
* module; pathlib.types:                 プロトコル.         (line    6)
* module; pdb:                           pdb --- The Python Debugger.
                                                             (line    6)
* module; pickle:                        pickle --- Python オブジェクトの直列化.
                                                             (line    6)
* module; pickletools:                   pickletools --- pickle 開発者用のツール群.
                                                             (line    6)
* module; pipes:                         pipes --- Interface to shell pipelines.
                                                             (line    6)
* module; pkgutil:                       pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line    6)
* module; platform:                      platform --- 実行中プラットフォームの固有情報を参照する.
                                                             (line    6)
* module; plistlib:                      plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line    6)
* module; poplib:                        poplib --- POP3 プロトコルクライアント.
                                                             (line    6)
* module; posix:                         posix --- 最も一般的な POSIX システムコール群.
                                                             (line    6)
* module; pprint:                        pprint --- データの整形表示.
                                                             (line    6)
* module; profile:                       profile and cProfile Module Reference.
                                                             (line    6)
* module; pstats:                        Stats クラス.       (line    8)
* module; pty:                           pty --- 擬似端末ユーティリティ.
                                                             (line    6)
* module; pwd:                           pwd --- パスワードデータベース.
                                                             (line    6)
* module; py_compile:                    py_compile --- Python ソースファイルをコンパイルする.
                                                             (line    6)
* module; pyclbr:                        pyclbr --- Python モジュールブラウザーサポート.
                                                             (line    6)
* module; pydoc:                         pydoc --- ドキュメント生成とオンラインヘルプシステム.
                                                             (line    6)
* module; queue:                         queue --- 同期キュークラス.
                                                             (line    6)
* module; quopri:                        quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line    6)
* module; random:                        random --- 疑似乱数を生成する.
                                                             (line    6)
* module; re:                            re --- 正規表現操作.
                                                             (line    6)
* module; readline:                      readline --- GNU readline のインターフェース.
                                                             (line    6)
* module; reprlib:                       reprlib --- もう一つの repr の実装.
                                                             (line    6)
* module; resource:                      resource --- リソース使用情報.
                                                             (line    6)
* module; rlcompleter:                   rlcompleter --- GNU readline の補完機能.
                                                             (line    6)
* module; runpy:                         runpy --- Python モジュールの位置特定と実行.
                                                             (line    6)
* module; sched:                         sched --- イベントスケジューラー.
                                                             (line    6)
* module; secrets:                       secrets --- 機密を扱うために安全な乱数を生成する.
                                                             (line    6)
* module; select:                        select --- I/O 完了の待機.
                                                             (line    6)
* module; selectors:                     selectors --- 高水準の I/O 多重化.
                                                             (line    6)
* module; shelve:                        shelve --- Python オブジェクトの永続化.
                                                             (line    6)
* module; shlex:                         shlex --- 単純な字句解析.
                                                             (line    6)
* module; shutil:                        shutil --- 高水準のファイル操作.
                                                             (line    6)
* module; signal:                        signal --- 非同期イベントにハンドラーを設定する.
                                                             (line    6)
* module; site:                          site --- サイト固有の設定フック.
                                                             (line    6)
* module; sitecustomize:                 sitecustomize.      (line    6)
* module; smtpd:                         smtpd --- SMTP Server.
                                                             (line    6)
* module; smtplib:                       smtplib --- SMTP プロトコルクライアント.
                                                             (line    6)
* module; sndhdr:                        sndhdr --- Determine type of sound file.
                                                             (line    6)
* module; socket:                        socket --- 低水準ネットワークインターフェース.
                                                             (line    6)
* module; socketserver:                  socketserver --- ネットワークサーバーのフレームワーク.
                                                             (line    6)
* module; spwd:                          spwd --- The shadow password database.
                                                             (line    6)
* module; sqlite3:                       sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース.
                                                             (line    6)
* module; ssl:                           ssl --- ソケットオブジェクト用の TLS/SSL ラッパー.
                                                             (line    6)
* module; stat:                          stat --- stat の結果を解釈する.
                                                             (line    6)
* module; statistics:                    statistics --- 数学的統計関数.
                                                             (line    6)
* module; string:                        string --- 一般的な文字列操作.
                                                             (line    6)
* module; string.templatelib:            string templatelib --- テンプレート文字列リテラルのサポート.
                                                             (line    6)
* module; stringprep:                    stringprep --- インターネットの文字列調製.
                                                             (line    6)
* module; struct:                        struct --- バイト列をパックされたバイナリデータとして解釈する.
                                                             (line    6)
* module; subprocess:                    subprocess --- サブプロセス管理.
                                                             (line    6)
* module; sunau:                         sunau --- Read and write Sun AU files.
                                                             (line    6)
* module; symtable:                      symtable --- コンパイラーの記号表へのアクセス.
                                                             (line    6)
* module; sys:                           sys --- システム固有のパラメーターと関数.
                                                             (line    6)
* module; sys.monitoring:                sys monitoring --- 実行イベントモニタリング.
                                                             (line    6)
* module; sysconfig:                     sysconfig --- Python の構成情報へのアクセスを提供する.
                                                             (line    6)
* module; syslog:                        syslog --- Unix syslog ライブラリルーチン群.
                                                             (line    6)
* module; tabnanny:                      tabnanny --- あいまいなインデントの検出.
                                                             (line    6)
* module; tarfile:                       tarfile --- tar アーカイブファイルの読み書き.
                                                             (line    6)
* module; telnetlib:                     telnetlib --- Telnet client.
                                                             (line    6)
* module; tempfile:                      tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line    6)
* module; termios:                       termios --- POSIX スタイルの端末制御.
                                                             (line    6)
* module; test:                          test --- Regression tests package for Python.
                                                             (line    6)
* module; test.regrtest:                 コマンドラインインターフェースを利用してテストを実行する.
                                                             (line    6)
* module; test.support:                  test support --- Utilities for the Python test suite.
                                                             (line    6)
* module; test.support.bytecode_helper:  test support bytecode_helper --- Support tools for testing correct bytecode generation.
                                                             (line    6)
* module; test.support.import_helper:    test support import_helper --- Utilities for import tests.
                                                             (line    6)
* module; test.support.os_helper:        test support os_helper --- Utilities for os tests.
                                                             (line    6)
* module; test.support.script_helper:    test support script_helper --- Utilities for the Python execution tests.
                                                             (line    6)
* module; test.support.socket_helper:    test support socket_helper --- Utilities for socket tests.
                                                             (line    6)
* module; test.support.threading_helper: test support threading_helper --- Utilities for threading tests.
                                                             (line    6)
* module; test.support.warnings_helper:  test support warnings_helper --- Utilities for warnings tests.
                                                             (line    6)
* module; textwrap:                      textwrap --- テキストの折り返しと詰め込み.
                                                             (line    6)
* module; threading:                     threading --- スレッドベースの並列処理.
                                                             (line    6)
* module; time:                          time --- 時刻データへのアクセスと変換.
                                                             (line    6)
* module; timeit:                        timeit --- 小さなコードスニペットの実行時間計測.
                                                             (line    6)
* module; tkinter:                       tkinter --- Tcl/Tk の Python インターフェース.
                                                             (line    6)
* module; tkinter.colorchooser:          tkinter colorchooser --- カラー選択ダイアログ.
                                                             (line    6)
* module; tkinter.commondialog:          tkinter commondialog --- Dialog window templates.
                                                             (line    6)
* module; tkinter.dnd:                   tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line    6)
* module; tkinter.filedialog:            tkinter filedialog --- File selection dialogs.
                                                             (line    6)
* module; tkinter.font:                  tkinter font --- Tkinter フォントラッパー.
                                                             (line    6)
* module; tkinter.messagebox:            tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line    6)
* module; tkinter.scrolledtext:          tkinter scrolledtext --- スクロール可能なテキストウィジェット.
                                                             (line    6)
* module; tkinter.simpledialog:          tkinter simpledialog --- Standard Tkinter input dialogs.
                                                             (line    6)
* module; tkinter.ttk:                   tkinter ttk --- Tk のテーマ付きウィジェット.
                                                             (line    6)
* module; token:                         token --- Python 解析木で使われる定数.
                                                             (line    6)
* module; tokenize:                      tokenize --- Python ソース用のトークナイザー.
                                                             (line    6)
* module; tomllib:                       tomllib --- TOML ファイルの解析.
                                                             (line    6)
* module; trace:                         trace --- Python 文実行のトレースと追跡.
                                                             (line    6)
* module; traceback:                     traceback --- スタックトレースの表示または取得.
                                                             (line    6)
* module; tracemalloc:                   tracemalloc --- メモリ割り当ての追跡.
                                                             (line    6)
* module; tty:                           tty --- 端末制御用の関数群.
                                                             (line    6)
* module; turtle:                        turtle --- Turtle graphics.
                                                             (line    6)
* module; turtledemo:                    turtledemo --- Demo scripts.
                                                             (line    6)
* module; types:                         types --- 動的な型生成と組み込み型の名前.
                                                             (line    6)
* module; typing:                        typing --- Support for type hints.
                                                             (line    6)
* module; unicodedata:                   unicodedata --- Unicode データベース.
                                                             (line    6)
* module; unittest:                      unittest --- ユニットテストフレームワーク.
                                                             (line    6)
* module; unittest.mock:                 unittest mock --- モックオブジェクトライブラリ.
                                                             (line    6)
* module; urllib:                        urllib --- URL を扱うモジュール群.
                                                             (line    6)
* module; urllib.error:                  urllib error --- urllib request によって送出される例外クラス.
                                                             (line    6)
* module; urllib.parse:                  urllib parse --- URL を構成要素に解析する.
                                                             (line    6)
* module; urllib.request:                urllib request --- URL を開くための大規模なライブラリ.
                                                             (line    6)
* module; urllib.response:               urllib response --- Response classes used by urllib.
                                                             (line    6)
* module; urllib.robotparser:            urllib robotparser --- robots txt 用のパーサー.
                                                             (line    6)
* module; usercustomize:                 usercustomize.      (line    6)
* module; uu:                            uu --- Encode and decode uuencode files.
                                                             (line    6)
* module; uuid:                          uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line    8)
* module; venv:                          venv --- 仮想環境の作成.
                                                             (line    6)
* module; warnings:                      warnings --- 警告の制御.
                                                             (line    6)
* module; wave:                          wave --- WAV ファイルの読み書き.
                                                             (line    6)
* module; weakref:                       weakref --- Weak references.
                                                             (line    6)
* module; webbrowser:                    webbrowser --- 便利なウェブブラウザコントローラー.
                                                             (line    6)
* module; winreg:                        winreg --- Windows レジストリへのアクセス.
                                                             (line    6)
* module; winsound:                      winsound --- Windows 用の音声再生インターフェース.
                                                             (line    6)
* module; wsgiref:                       wsgiref --- WSGI ユーティリティとリファレンス実装.
                                                             (line    6)
* module; wsgiref.handlers:              wsgiref handlers -- server/gateway base classes.
                                                             (line    6)
* module; wsgiref.headers:               wsgiref headers -- WSGI response header tools.
                                                             (line    6)
* module; wsgiref.simple_server:         wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line    6)
* module; wsgiref.types:                 wsgiref types -- WSGI types for static type checking.
                                                             (line    6)
* module; wsgiref.util:                  wsgiref util -- WSGI environment utilities.
                                                             (line    6)
* module; wsgiref.validate:              wsgiref validate --- WSGI conformance checker.
                                                             (line    6)
* module; xdrlib:                        xdrlib --- Encode and decode XDR data.
                                                             (line    6)
* module; xml:                           XMLを扱うモジュール群.
                                                             (line    6)
* module; xml.dom:                       xml dom --- ドキュメントオブジェクトモデル API.
                                                             (line    6)
* module; xml.dom.minidom:               xml dom minidom --- 最小限の DOM の実装.
                                                             (line    6)
* module; xml.dom.pulldom:               xml dom pulldom --- 部分的な DOM ツリー構築のサポート.
                                                             (line    6)
* module; xml.etree.ElementInclude:      関数<10>.           (line    6)
* module; xml.etree.ElementTree:         xml etree ElementTree --- ElementTree XML API.
                                                             (line    6)
* module; xml.parsers.expat:             xml parsers expat --- Expat を使用した高速な XML 解析.
                                                             (line    6)
* module; xml.parsers.expat.errors:      Expat エラー定数.   (line    6)
* module; xml.parsers.expat.model:       内容モデルの記述.   (line    6)
* module; xml.sax:                       xml sax --- SAX2 バーサーのサポート.
                                                             (line    6)
* module; xml.sax.handler:               xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line    6)
* module; xml.sax.saxutils:              xml sax saxutils --- SAX ユーティリティー.
                                                             (line    6)
* module; xml.sax.xmlreader:             xml sax xmlreader --- XML パーサーのインターフェース.
                                                             (line    6)
* module; xmlrpc:                        xmlrpc --- XMLRPC サーバーとクライアントモジュール群.
                                                             (line    6)
* module; xmlrpc.client:                 xmlrpc client --- XML-RPC クライアントアクセス.
                                                             (line    6)
* module; xmlrpc.server:                 xmlrpc server --- 基本的な XML-RPC サーバー.
                                                             (line    6)
* module; zipapp:                        zipapp --- 実行可能な Python zip アーカイブを管理する.
                                                             (line    6)
* module; zipfile:                       zipfile --- ZIP アーカイブの処理.
                                                             (line    6)
* module; zipimport:                     zipimport --- Zip アーカイブからモジュールをインポートする.
                                                             (line    6)
* module; zlib:                          zlib --- gzip 互換の圧縮.
                                                             (line    6)
* module; zoneinfo:                      zoneinfo --- IANA タイムゾーンのサポート.
                                                             (line    6)
* module;__main__:                       名前解決.           (line   52)
* module;__main__ <1>:                   完全な Python プログラム.
                                                             (line    6)
* module;__main__ <2>:                   完全な Python プログラム.
                                                             (line   18)
* module;__main__ <3>:                   runpy --- Python モジュールの位置特定と実行.
                                                             (line   29)
* module;__main__ <4>:                   runpy --- Python モジュールの位置特定と実行.
                                                             (line   99)
* module;__main__ <5>:                   Python の埋め込み<2>.
                                                             (line   11)
* module;__main__ <6>:                   インタープリタの初期化と終了処理.
                                                             (line    7)
* module;__main__ <7>:                   サブインタプリタサポート.
                                                             (line  109)
* module;__main__ <8>:                   サブインタプリタサポート.
                                                             (line  197)
* module;_locale:                        locale --- 国際化サービス.
                                                             (line   16)
* module;_thread:                        高レベルAPI.        (line   52)
* module;array:                          変更可能なシーケンス型 mutable sequence.
                                                             (line   11)
* module;array <1>:                      バイナリシーケンス型 --- bytes bytearray memoryview.
                                                             (line    6)
* module;base64:                         binascii --- バイナリ と ASCII 間の変換.
                                                             (line    6)
* module;bdb:                            pdb --- The Python Debugger.
                                                             (line   17)
* module;builtins:                       dir 関数.           (line   47)
* module;builtins <1>:                   完全な Python プログラム.
                                                             (line    6)
* module;builtins <2>:                   組み込み関数.       (line 2178)
* module;builtins <3>:                   Python の埋め込み<2>.
                                                             (line   11)
* module;builtins <4>:                   インタープリタの初期化と終了処理.
                                                             (line    7)
* module;builtins <5>:                   サブインタプリタサポート.
                                                             (line  109)
* module;builtins <6>:                   サブインタプリタサポート.
                                                             (line  197)
* module;cmd:                            pdb --- The Python Debugger.
                                                             (line   17)
* module;collections:                    変更可能なシーケンス型 mutable sequence.
                                                             (line   12)
* module;copy:                           copyreg --- pickle サポート関数を登録する.
                                                             (line    8)
* module;dbm.gnu:                        辞書型 dictionary<2>.
                                                             (line   21)
* module;dbm.gnu <1>:                    制限事項.           (line    6)
* module;dbm.ndbm:                       辞書型 dictionary<2>.
                                                             (line   21)
* module;dbm.ndbm <1>:                   制限事項.           (line    6)
* module;errno:                          具象例外.           (line  152)
* module;glob:                           fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   34)
* module;importing:                      import 文.          (line    6)
* module;io:                             I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* module;json:                           json による構造化されたデータの保存.
                                                             (line    6)
* module;math:                           数値型 int float complex.
                                                             (line  115)
* module;math <1>:                       定数<3>.            (line   47)
* module;namespace:                      モジュール<3>.      (line   21)
* module;os:                             posix --- 最も一般的な POSIX システムコール群.
                                                             (line   14)
* module;pickle:                         copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   76)
* module;pickle <1>:                     copyreg --- pickle サポート関数を登録する.
                                                             (line    8)
* module;pickle <2>:                     shelve --- Python オブジェクトの永続化.
                                                             (line    8)
* module;pickle <3>:                     marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line   15)
* module;pty:                            ファイル記述子の操作.
                                                             (line  481)
* module;pwd:                            os path --- 一般的なパス名操作.
                                                             (line  149)
* module;pyexpat:                        xml parsers expat --- Expat を使用した高速な XML 解析.
                                                             (line   19)
* module;re:                             文字列メソッド<2>.  (line    6)
* module;re <1>:                         fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line    8)
* module;shelve:                         marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line   15)
* module;signal:                         _thread --- 低水準なスレッド API.
                                                             (line  193)
* module;signal <1>:                     シグナルハンドリング<2>.
                                                             (line    7)
* module;signal <2>:                     シグナルハンドリング<2>.
                                                             (line   34)
* module;signal <3>:                     シグナルハンドリング<2>.
                                                             (line   44)
* module;socket:                         インターネットプロトコルとサポート.
                                                             (line    6)
* module;stat:                           ファイルとディレクトリ.
                                                             (line 1137)
* module;struct:                         socket オブジェクト.
                                                             (line  556)
* module;sys:                            標準モジュール.     (line    6)
* module;sys <1>:                        except 節.          (line   57)
* module;sys <2>:                        完全な Python プログラム.
                                                             (line    6)
* module;sys <3>:                        組み込み関数.       (line 1466)
* module;sys <4>:                        Python の埋め込み<2>.
                                                             (line   11)
* module;sys <5>:                        インタープリタの初期化と終了処理.
                                                             (line    7)
* module;sys <6>:                        サブインタプリタサポート.
                                                             (line  109)
* module;sys <7>:                        サブインタプリタサポート.
                                                             (line  197)
* module;types:                          型オブジェクト.     (line    6)
* module;urllib.request:                 http client --- HTTP プロトコルクライアント.
                                                             (line    8)
* module;検索;パス:                      モジュール検索パス. (line    6)
* module;検索;パス <1>:                  linecache --- テキストラインへのランダムアクセス.
                                                             (line   29)
* module;検索;パス <2>:                  sys --- システム固有のパラメーターと関数.
                                                             (line 1429)
* module;検索;パス <3>:                  site --- サイト固有の設定フック.
                                                             (line   13)
* module;検索;パス <4>:                  Python の埋め込み<2>.
                                                             (line   11)
* module;検索;パス <5>:                  インタープリタの初期化と終了処理.
                                                             (line    7)
* module;検索;パス <6>:                  プロセスワイドのパラメータ.
                                                             (line  140)
* ModuleFinder (modulefinder のクラス):  modulefinder --- スクリプト中で使用されているモジュールの検索.
                                                             (line   26)
* ModuleInfo (pkgutil のクラス):         pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line   13)
* ModuleNotFoundError:                   具象例外.           (line   71)
* modules (in module sys):               モジュールのインポート<2>.
                                                             (line    8)
* modules (in module sys) <1>:           インタープリタの初期化と終了処理.
                                                             (line    7)
* modules (modulefinder.ModuleFinder の属性): modulefinder --- スクリプト中で使用されているモジュールの検索.
                                                             (line   51)
* modules (sys モジュール):              sys --- システム固有のパラメーターと関数.
                                                             (line 1402)
* modules_cleanup() (test.support.import_helper モジュール): test support import_helper --- Utilities for import tests.
                                                             (line   71)
* modules_setup() (test.support.import_helper モジュール): test support import_helper --- Utilities for import tests.
                                                             (line   67)
* ModuleSpec (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line  362)
* ModuleType (in module types):          モジュールオブジェクト module object.
                                                             (line    7)
* ModuleType (types のクラス):           標準的なインタプリタ型.
                                                             (line  122)
* modulus (sys.hash_info の属性):        sys --- システム固有のパラメーターと関数.
                                                             (line 1058)
* MON_1 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  240)
* MON_10 (locale モジュール):            locale --- 国際化サービス.
                                                             (line  240)
* MON_11 (locale モジュール):            locale --- 国際化サービス.
                                                             (line  240)
* MON_12 (locale モジュール):            locale --- 国際化サービス.
                                                             (line  240)
* MON_2 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  240)
* MON_3 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  240)
* MON_4 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  240)
* MON_5 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  240)
* MON_6 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  240)
* MON_7 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  240)
* MON_8 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  240)
* MON_9 (locale モジュール):             locale --- 国際化サービス.
                                                             (line  240)
* MONDAY (calendar モジュール):          calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  440)
* monotonic_ns() (time モジュール):      関数<5>.            (line  207)
* monotonic() (time モジュール):         関数<5>.            (line  175)
* Month (calendar のクラス):             calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  501)
* month (calendar.IllegalMonthError の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  516)
* month (datetime.date の属性):          date objects.       (line  150)
* month (datetime.datetime の属性):      datetime objects.   (line  312)
* month_abbr (calendar モジュール):      calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  472)
* month_name (calendar モジュール):      calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  461)
* month() (calendar モジュール):         calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  395)
* monthcalendar() (calendar モジュール): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  384)
* monthdatescalendar() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  108)
* monthdays2calendar() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  113)
* monthdayscalendar() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  118)
* monthrange() (calendar モジュール):    calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  380)
* Morsel (http.cookies のクラス):        Morselオブジェクト. (line    6)
* most_common() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line   75)
* mouseinterval() (curses モジュール):   関数<6>.            (line  303)
* mousemask() (curses モジュール):       関数<6>.            (line  309)
* move_into() (pathlib.Path のメソッド): Copying moving and deleting.
                                                             (line  100)
* move_to_end() (collections.OrderedDict のメソッド): OrderedDict オブジェクト.
                                                             (line   72)
* move() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   35)
* move() (curses.window のメソッド):     Window オブジェクト.
                                                             (line  394)
* move() (mmap.mmap のメソッド):         mmap --- メモリマップファイルのサポート.
                                                             (line  240)
* move() (pathlib.Path のメソッド):      Copying moving and deleting.
                                                             (line   83)
* move() (shutil モジュール):            ディレクトリとファイルの操作.
                                                             (line  354)
* move() (tkinter.ttk.Treeview のメソッド): ttk Treeview.    (line  211)
* MozillaCookieJar (http.cookiejar のクラス): FileCookieJar のサブクラスと web ブラウザとの連携.
                                                             (line    9)
* MRO:                                   用語集<2>.          (line 1166)
* mro() (type のメソッド):               Special methods.    (line    9)
* msg (http.client.HTTPResponse の属性): HTTPResponse オブジェクト.
                                                             (line   41)
* msg (json.JSONDecodeError の属性):     例外<20>.           (line   10)
* msg (netrc.NetrcParseError の属性):    netrc --- netrc ファイルの処理.
                                                             (line   55)
* msg (re.PatternError の属性):          例外<3>.            (line   15)
* msg (tomllib.TOMLDecodeError の属性):  tomllib --- TOML ファイルの解析.
                                                             (line   65)
* msg (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line  119)
* mtime (gzip.GzipFile の属性):          gzip --- gzip ファイルのサポート.
                                                             (line  156)
* mtime (tarfile.TarInfo の属性):        TarInfo オブジェクト.
                                                             (line   70)
* mtime() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   39)
* mul() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  128)
* Mult (ast のクラス):                   式 expression<2>.   (line   55)
* MultiCall (xmlrpc.client のクラス):    MultiCall オブジェクト.
                                                             (line    9)
* MULTILINE (re モジュール):             フラグ.             (line   80)
* MultilineContinuationError:            例外<9>.            (line   69)
* multimode() (statistics モジュール):   関数の詳細.         (line  348)
* MultipartConversionError:              email errors Exception and Defect classes.
                                                             (line   42)
* MultipartInvariantViolationDefect:     email errors Exception and Defect classes.
                                                             (line  116)
* multiply() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  424)
* mutable:                               用語集<2>.          (line 1170)
* mutable;sequence;types:                ミュータブルなシーケンス型.
                                                             (line    6)
* MutableMapping (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  121)
* MutableMapping (typing のクラス):      Aliases to container ABCs in collections abc.
                                                             (line   88)
* MutableSequence (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   68)
* MutableSequence (typing のクラス):     Aliases to container ABCs in collections abc.
                                                             (line   96)
* MutableSet (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  116)
* MutableSet (typing のクラス):          Aliases to container ABCs in collections abc.
                                                             (line  104)
* mvderwin() (curses.window のメソッド): Window オブジェクト.
                                                             (line  398)
* mvwin() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  404)
* myrights() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  243)
* N_TOKENS (token モジュール):           token --- Python 解析木で使われる定数.
                                                             (line  349)
* n_waiting (asyncio.Barrier の属性):    Barrier.            (line   99)
* n_waiting (threading.Barrier の属性):  Barrier objects.    (line   96)
* NAK (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   87)
* name:                                  Names identifiers and keywords.
                                                             (line    6)
* name <1>:                              名前の束縛.         (line    6)
* name <2>:                              識別子 identifier、または名前 name.
                                                             (line    6)
* Name (ast のクラス):                   変数.               (line    6)
* name (AttributeError の属性):          具象例外.           (line   21)
* name (bz2.BZ2File の属性):             ファイルの圧縮/解凍.
                                                             (line  134)
* name (codecs.CodecInfo の属性):        codecs --- codec レジストリと基底クラス.
                                                             (line   75)
* name (compression.zstd.ZstdFile の属性): 圧縮ファイルへの読み書き.
                                                             (line  110)
* name (contextvars.ContextVar の属性):  コンテキスト変数.   (line   24)
* name (ctypes.CField の属性):           構造化データ型.     (line  251)
* name (doctest.DocTest の属性):         DocTest オブジェクト.
                                                             (line   30)
* name (email.headerregistry.BaseHeader の属性): email headerregistry Custom Header Objects.
                                                             (line   47)
* name (enum.Enum の属性):               データ型<2>.        (line  123)
* name (gzip.GzipFile の属性):           gzip --- gzip ファイルのサポート.
                                                             (line  164)
* name (hashlib.hash の属性):            Hash Objects.       (line   19)
* name (hmac.HMAC の属性):               hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line  104)
* name (http.cookiejar.Cookie の属性):   Cookieオブジェクト<2>.
                                                             (line   27)
* name (ImportError の属性):             具象例外.           (line   60)
* name (importlib.abc.FileLoader の属性): importlib abc -- Abstract base classes related to import.
                                                             (line  307)
* name (importlib.machinery.AppleFrameworkLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  499)
* name (importlib.machinery.ExtensionFileLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  302)
* name (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  378)
* name (importlib.machinery.SourceFileLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  209)
* name (importlib.machinery.SourcelessFileLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  253)
* name (importlib.resources.abc.Traversable の属性): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line   97)
* name (inspect.Parameter の属性):       Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  231)
* name (io.FileIO の属性):               生ファイルI/O.      (line   59)
* name (logging.Logger の属性):          ロガーオブジェクト. (line   25)
* name (lzma.LZMAFile の属性):           圧縮ファイルへの読み書き<2>.
                                                             (line  104)
* name (multiprocessing.Process の属性): Process クラスと例外.
                                                             (line  115)
* name (multiprocessing.shared_memory.SharedMemory の属性): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  119)
* name (NameError の属性):               具象例外.           (line  125)
* name (os モジュール):                  os --- 雑多なオペレーティングシステムインターフェース.
                                                             (line   54)
* name (os.DirEntry の属性):             ファイルとディレクトリ.
                                                             (line  959)
* name (pathlib.PurePath の属性):        メソッドとプロパティ.
                                                             (line  122)
* name (pyclbr.Class の属性):            クラスオブジェクト<2>.
                                                             (line   20)
* name (pyclbr.Function の属性):         Function オブジェクト.
                                                             (line   19)
* name (sys.thread_info の属性):         sys --- システム固有のパラメーターと関数.
                                                             (line 2069)
* name (tarfile.TarInfo の属性):         TarInfo オブジェクト.
                                                             (line   62)
* name (tempfile.TemporaryDirectory の属性): tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  194)
* name (threading.Thread の属性):        Thread objects.     (line  185)
* NAME (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line   42)
* name (traceback.FrameSummary の属性):  FrameSummary オブジェクト.
                                                             (line   38)
* name (webbrowser.controller の属性):   Browser controller objects.
                                                             (line   10)
* name (xml.dom.Attr の属性):            Attr オブジェクト.  (line    8)
* name (xml.dom.DocumentType の属性):    DocumentType オブジェクト.
                                                             (line   33)
* name (zipfile.Path の属性):            Path objects.       (line   31)
* name;束縛:                             import 文.          (line    6)
* name;束縛 <1>:                         import 文.          (line   51)
* name;束縛 <2>:                         関数定義.           (line    6)
* name;束縛 <3>:                         関数定義.           (line    6)
* name;束縛 <4>:                         クラス定義.         (line    6)
* name;難号化:                           プライベート変数.   (line   12)
* name;難号化 <1>:                       識別子 identifier、または名前 name.
                                                             (line   15)
* name() (unicodedata モジュール):       unicodedata --- Unicode データベース.
                                                             (line   40)
* name2codepoint (html.entities モジュール): html entities --- HTML 一般実体の定義.
                                                             (line   29)
* named expression:                      ブール演算 boolean operation.
                                                             (line   34)
* Named Shared Memory:                   multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line   10)
* named tuple:                           用語集<2>.          (line 1179)
* NAMED_FLAGS (enum.EnumCheck の属性):   データ型<2>.        (line  646)
* NamedExpr (ast のクラス):              式 expression<2>.   (line  186)
* NamedTemporaryFile() (tempfile モジュール): tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line   73)
* NamedTuple (typing のクラス):          Other special directives.
                                                             (line   10)
* namedtuple() (collections モジュール): namedtuple 名前付きフィールドを持つタプルのファクトリ関数.
                                                             (line   11)
* NameError:                             具象例外.           (line  116)
* NameError (組み込み例外):              名前解決.           (line   17)
* namelist() (zipfile.ZipFile のメソッド): ZipFile objects.  (line  134)
* nameprep() (encodings.idna モジュール): encodings idna --- Internationalized Domain Names in Applications.
                                                             (line   48)
* namer (logging.handlers.BaseRotatingHandler の属性): BaseRotatingHandler.
                                                             (line   17)
* namereplace_errors() (codecs モジュール): エラーハンドラ.  (line  174)
* namereplace;error handler's name:      エラーハンドラ.     (line   52)
* names() (tkinter.font モジュール):     tkinter font --- Tkinter フォントラッパー.
                                                             (line   92)
* namespace:                             名前づけと束縛 naming and binding.
                                                             (line    6)
* namespace <1>:                         用語集<2>.          (line 1205)
* Namespace (argparse のクラス):         Namespace オブジェクト.
                                                             (line    6)
* Namespace (multiprocessing.managers のクラス): マネージャー.
                                                             (line  257)
* namespace package:                     用語集<2>.          (line 1218)
* NAMESPACE_DNS (uuid モジュール):       uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  271)
* NAMESPACE_OID (uuid モジュール):       uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  280)
* NAMESPACE_URL (uuid モジュール):       uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  276)
* NAMESPACE_X500 (uuid モジュール):      uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  284)
* namespace() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  248)
* Namespace() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  196)
* NamespaceErr:                          例外<23>.           (line   63)
* NamespaceLoader (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line  344)
* namespaceURI (xml.dom.Node の属性):    Node オブジェクト.  (line   73)
* nametofont() (tkinter.font モジュール): tkinter font --- Tkinter フォントラッパー.
                                                             (line   96)
* NaN:                                   組み込み関数.       (line  717)
* nan (cmath モジュール):                定数<3>.            (line   33)
* nan (math モジュール):                 定数<2>.            (line   31)
* nan (sys.hash_info の属性):            sys --- システム固有のパラメーターと関数.
                                                             (line 1066)
* nanj (cmath モジュール):               定数<3>.            (line   40)
* NannyNag:                              tabnanny --- あいまいなインデントの検出.
                                                             (line   37)
* napms() (curses モジュール):           関数<6>.            (line  318)
* nargs (optparse.Option の属性):        オプション属性.     (line   50)
* native code:                           用語集<2>.          (line 1234)
* native_id (threading.Thread の属性):   Thread objects.     (line  218)
* nb_workers (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  223)
* nbytes (memoryview の属性):            メモリビュー.       (line  410)
* ncurses_version (curses モジュール):   定数<6>.            (line   22)
* ND (inspect.BufferFlags の属性):       Buffer flags.       (line   21)
* ndiff() (difflib モジュール):          difflib --- 差分の計算の補助.
                                                             (line  227)
* ndim (memoryview の属性):              メモリビュー.       (line  477)
* ne() (operator モジュール):            operator --- 関数形式の標準演算子.
                                                             (line   24)
* needs_input (bz2.BZ2Decompressor の属性): 逐次圧縮および展開.
                                                             (line   85)
* needs_input (compression.zstd.ZstdDecompressor の属性): メモリ上での圧縮と展開.
                                                             (line  218)
* needs_input (lzma.LZMADecompressor の属性): メモリ上での圧縮と展開<2>.
                                                             (line  164)
* neg() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  140)
* nested scope:                          用語集<2>.          (line 1243)
* nested_scopes (__future__ モジュール): モジュールコンテンツ<5>.
                                                             (line   14)
* netmask (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line  100)
* netmask (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  317)
* NetmaskValueError:                     Custom Exceptions.  (line   13)
* netrc (netrc のクラス):                netrc --- netrc ファイルの処理.
                                                             (line   14)
* NetrcParseError:                       netrc --- netrc ファイルの処理.
                                                             (line   49)
* netscape (http.cookiejar.CookiePolicy の属性): CookiePolicy オブジェクト.
                                                             (line   71)
* network (ipaddress.IPv4Interface の属性): インターフェイスオブジェクト.
                                                             (line   28)
* network (ipaddress.IPv6Interface の属性): インターフェイスオブジェクト.
                                                             (line   76)
* network_address (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line   84)
* network_address (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  311)
* Never (typing モジュール):             特殊型.             (line   99)
* NEVER_EQ (test.support モジュール):    test support --- Utilities for the Python test suite.
                                                             (line  200)
* new_child() (collections.ChainMap のメソッド): ChainMap オブジェクト.
                                                             (line   45)
* new_class() (types モジュール):        動的な型生成.       (line    6)
* new_event_loop() (asyncio モジュール): イベントループ.     (line   70)
* new_event_loop() (asyncio.AbstractEventLoopPolicy のメソッド): ポリシーオブジェクト.
                                                             (line   27)
* new_panel() (curses.panel モジュール): 関数<7>.            (line   12)
* new-style class:                       用語集<2>.          (line 1253)
* new() (hashlib モジュール):            コンストラクタ.     (line    6)
* new() (hmac モジュール):               hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   15)
* newfunc (C type):                      Slot Type typedefs. (line   32)
* NEWLINE (token モジュール):            token --- Python 解析木で使われる定数.
                                                             (line   72)
* NEWLINE トークン:                      論理行 logical line.
                                                             (line    6)
* NEWLINE トークン <1>:                  複合文 compound statement.
                                                             (line   52)
* newlines (io.TextIOBase の属性):       テキスト I/O<2>.    (line   24)
* newpad() (curses モジュール):          関数<6>.            (line  322)
* NewType (typing のクラス):             Other special directives.
                                                             (line  108)
* newwin() (curses モジュール):          関数<6>.            (line  339)
* next (pdb command):                    Debugger commands.  (line  210)
* next_minus() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  428)
* next_minus() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  403)
* next_plus() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  432)
* next_plus() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  409)
* next_toward() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  436)
* next_toward() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  415)
* next() (tarfile.TarFile のメソッド):   TarFile オブジェクト.
                                                             (line  135)
* next() (tkinter.ttk.Treeview のメソッド): ttk Treeview.    (line  221)
* nextafter() (math モジュール):         Floating point manipulation functions.
                                                             (line   81)
* nextfile() (fileinput モジュール):     fileinput --- 複数の入力ストリームをまたいだ行を反復する.
                                                             (line  118)
* nextkey() (dbm.gnu.gdbm のメソッド):   dbm gnu --- GNU database manager.
                                                             (line  107)
* nextSibling (xml.dom.Node の属性):     Node オブジェクト.  (line   41)
* ngettext() (gettext モジュール):       GNU gettext API.    (line   45)
* ngettext() (gettext.GNUTranslations のメソッド): GNUTranslations クラス.
                                                             (line   46)
* ngettext() (gettext.NullTranslations のメソッド): NullTranslations クラス.
                                                             (line   45)
* nice() (os モジュール):                プロセス管理.       (line  355)
* NIL (uuid モジュール):                 uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  312)
* NL (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   54)
* NL (token モジュール):                 token --- Python 解析木で使われる定数.
                                                             (line   76)
* nl_langinfo() (locale モジュール):     locale --- 国際化サービス.
                                                             (line  176)
* nl() (curses モジュール):              関数<6>.            (line  349)
* nlargest() (heapq モジュール):         heapq --- ヒープキューアルゴリズム.
                                                             (line  166)
* nlst() (ftplib.FTP のメソッド):        FTP オブジェクト.   (line  298)
* NO (tkinter.messagebox モジュール):    tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  159)
* no_animation() (turtle モジュール):    アニメーションの制御.
                                                             (line    6)
* no_cache() (zoneinfo.ZoneInfo のクラスメソッド): ZoneInfo クラス.
                                                             (line   44)
* NO_EVENTS (monitoring event):          Events.             (line  105)
* no_proxy:                              urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  358)
* no_site (sys.flags の属性):            sys --- システム固有のパラメーターと関数.
                                                             (line  548)
* no_tracing() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  568)
* no_type_check_decorator() (typing モジュール): Functions and decorators.
                                                             (line  358)
* no_type_check() (typing モジュール):   Functions and decorators.
                                                             (line  346)
* no_user_site (sys.flags の属性):       sys --- システム固有のパラメーターと関数.
                                                             (line  545)
* NoBoundaryInMultipartDefect:           email errors Exception and Defect classes.
                                                             (line   75)
* nocbreak() (curses モジュール):        関数<6>.            (line  355)
* NoDataAllowedErr:                      例外<23>.           (line   79)
* node (uuid.UUID の属性):               uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  125)
* node() (platform モジュール):          Cross platform.     (line   42)
* NoDefault (typing モジュール):         Introspection helpers.
                                                             (line  197)
* nodelay() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  408)
* nodeName (xml.dom.Node の属性):        Node オブジェクト.  (line   78)
* NodeTransformer (ast のクラス):        ast helpers.        (line  225)
* nodeType (xml.dom.Node の属性):        Node オブジェクト.  (line    8)
* nodeValue (xml.dom.Node の属性):       Node オブジェクト.  (line   86)
* NodeVisitor (ast のクラス):            ast helpers.        (line  185)
* noecho() (curses モジュール):          関数<6>.            (line  360)
* NOEXPR (locale モジュール):            locale --- 国際化サービス.
                                                             (line  284)
* NOFLAG (re モジュール):                フラグ.             (line   91)
* NoModificationAllowedErr:              例外<23>.           (line   84)
* non-deterministic:                     用語集<2>.          (line 1261)
* NonCallableMagicMock (unittest.mock のクラス): Magic Mock. (line   21)
* NonCallableMock (unittest.mock のクラス): Mock クラス.     (line  573)
* None (組み込みオブジェクト):           真理値判定.         (line   17)
* None (組み込み変数):                   組み込み定数.       (line   18)
* NoneType (types モジュール):           標準的なインタプリタ型.
                                                             (line   18)
* nonl() (curses モジュール):            関数<6>.            (line  364)
* Nonlocal (ast のクラス):               関数およびクラス定義.
                                                             (line  144)
* nonmember() (enum モジュール):         ユーティリティとデコレータ.
                                                             (line   87)
* noop() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line  252)
* noop() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   78)
* NoOptionError:                         例外<9>.            (line   31)
* NOP (opcode):                          Python バイトコード命令.
                                                             (line  133)
* noqiflush() (curses モジュール):       関数<6>.            (line  373)
* noraw() (curses モジュール):           関数<6>.            (line  381)
* NoReturn (typing モジュール):          特殊型.             (line   99)
* NORMAL (tkinter.font モジュール):      tkinter font --- Tkinter フォントラッパー.
                                                             (line   15)
* NORMAL_PRIORITY_CLASS (subprocess モジュール): Windows Constants.
                                                             (line   96)
* NormalDist (statistics のクラス):      NormalDist オブジェクト.
                                                             (line   13)
* normalize_encoding() (encodings モジュール): encodings --- Encodings package.
                                                             (line    8)
* NORMALIZE_WHITESPACE (doctest モジュール): オプションフラグ.
                                                             (line   37)
* normalize() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  440)
* normalize() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  421)
* normalize() (locale モジュール):       locale --- 国際化サービス.
                                                             (line  433)
* normalize() (unicodedata モジュール):  unicodedata --- Unicode データベース.
                                                             (line  133)
* normalize() (xml.dom.Node のメソッド): Node オブジェクト.  (line  141)
* normalvariate() (random モジュール):   実数分布.           (line   78)
* normcase() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  369)
* normpath() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  378)
* NoSectionError:                        例外<9>.            (line   10)
* NoSuchMailboxError:                    例外<21>.           (line   12)
* Not (ast のクラス):                    式 expression<2>.   (line   28)
* not_() (operator モジュール):          operator --- 関数形式の標準演算子.
                                                             (line   47)
* NOT_TAKEN (opcode):                    Python バイトコード命令.
                                                             (line  138)
* NotADirectoryError:                    OS 例外.            (line   89)
* notationDecl() (xml.sax.handler.DTDHandler のメソッド): DTDHandler オブジェクト.
                                                             (line    8)
* NotationDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  354)
* notations (xml.dom.DocumentType の属性): DocumentType オブジェクト.
                                                             (line   46)
* NotConnected:                          http client --- HTTP プロトコルクライアント.
                                                             (line  141)
* Notebook (tkinter.ttk のクラス):       ttk Notebook.       (line    6)
* NotEmptyError:                         例外<21>.           (line   20)
* NotEq (ast のクラス):                  式 expression<2>.   (line  110)
* NOTEQUAL (token モジュール):           token --- Python 解析木で使われる定数.
                                                             (line  266)
* NotFoundErr:                           例外<23>.           (line   68)
* notify_all() (asyncio.Condition のメソッド): Condition.    (line   67)
* notify_all() (threading.Condition のメソッド): Condition objects.
                                                             (line  178)
* notify() (asyncio.Condition のメソッド): Condition.        (line   53)
* notify() (threading.Condition のメソッド): Condition objects.
                                                             (line  159)
* notimeout() (curses.window のメソッド): Window オブジェクト.
                                                             (line  413)
* NotImplemented (組み込み変数):         組み込み定数.       (line   25)
* NotImplementedError:                   具象例外.           (line  131)
* NotImplementedType (types モジュール): 標準的なインタプリタ型.
                                                             (line  102)
* NotIn (ast のクラス):                  式 expression<2>.   (line  110)
* NotRequired (typing モジュール):       特殊形式.           (line  268)
* NOTSET (logging モジュール):           ロギングレベル.     (line   15)
* NotShareableError:                     例外<13>.           (line   26)
* NotStandaloneHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  405)
* NotSupportedErr:                       例外<23>.           (line   74)
* NotSupportedError:                     例外<7>.            (line   82)
* noutrefresh() (curses.window のメソッド): Window オブジェクト.
                                                             (line  421)
* NOVEMBER (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  483)
* now() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line   61)
* npgettext() (gettext モジュール):      GNU gettext API.    (line   68)
* npgettext() (gettext.GNUTranslations のメソッド): GNUTranslations クラス.
                                                             (line   79)
* npgettext() (gettext.NullTranslations のメソッド): NullTranslations クラス.
                                                             (line   60)
* NSIG (signal モジュール):              モジュールの内容<2>.
                                                             (line  236)
* nsmallest() (heapq モジュール):        heapq --- ヒープキューアルゴリズム.
                                                             (line  174)
* NTEventLogHandler (logging.handlers のクラス): NTEventLogHandler.
                                                             (line   11)
* ntohl() (socket モジュール):           その他の関数<2>.    (line  225)
* ntohs() (socket モジュール):           その他の関数<2>.    (line  232)
* ntransfercmd() (ftplib.FTP のメソッド): FTP オブジェクト.  (line  276)
* NUL (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   18)
* null;演算:                             pass 文<2>.         (line    6)
* null;演算 <1>:                         pass 文<2>.         (line    6)
* nullcontext() (contextlib モジュール): ユーティリティ.     (line  223)
* NullHandler (logging のクラス):        NullHandler.        (line   12)
* NullTranslations (gettext のクラス):   NullTranslations クラス.
                                                             (line   12)
* num_addresses (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line  128)
* num_addresses (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  329)
* num_tickets (ssl.SSLContext の属性):   SSL コンテキスト.   (line  564)
* number:                                数値リテラル.       (line    6)
* Number (numbers のクラス):             numbers --- 数の抽象基底クラス.
                                                             (line   15)
* NUMBER (token モジュール):             token --- Python 解析木で使われる定数.
                                                             (line   46)
* number_class() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  444)
* number_class() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  444)
* numerator (fractions.Fraction の属性): fractions --- 有理数.
                                                             (line  114)
* numerator (numbers.Rational の属性):   数値塔.             (line   51)
* numeric() (unicodedata モジュール):    unicodedata --- Unicode データベース.
                                                             (line   71)
* numinput() (turtle モジュール):        入力メソッド.       (line   22)
* O_APPEND (os モジュール):              ファイル記述子の操作.
                                                             (line  418)
* O_ASYNC (os モジュール):               ファイル記述子の操作.
                                                             (line  462)
* O_BINARY (os モジュール):              ファイル記述子の操作.
                                                             (line  441)
* O_CLOEXEC (os モジュール):             ファイル記述子の操作.
                                                             (line  428)
* O_CREAT (os モジュール):               ファイル記述子の操作.
                                                             (line  418)
* O_DIRECT (os モジュール):              ファイル記述子の操作.
                                                             (line  462)
* O_DIRECTORY (os モジュール):           ファイル記述子の操作.
                                                             (line  462)
* O_DSYNC (os モジュール):               ファイル記述子の操作.
                                                             (line  428)
* O_EVTONLY (os モジュール):             ファイル記述子の操作.
                                                             (line  451)
* O_EXCL (os モジュール):                ファイル記述子の操作.
                                                             (line  418)
* O_EXLOCK (os モジュール):              ファイル記述子の操作.
                                                             (line  462)
* O_FSYNC (os モジュール):               ファイル記述子の操作.
                                                             (line  451)
* O_NDELAY (os モジュール):              ファイル記述子の操作.
                                                             (line  428)
* O_NOATIME (os モジュール):             ファイル記述子の操作.
                                                             (line  462)
* O_NOCTTY (os モジュール):              ファイル記述子の操作.
                                                             (line  428)
* O_NOFOLLOW (os モジュール):            ファイル記述子の操作.
                                                             (line  462)
* O_NOFOLLOW_ANY (os モジュール):        ファイル記述子の操作.
                                                             (line  451)
* O_NOINHERIT (os モジュール):           ファイル記述子の操作.
                                                             (line  441)
* O_NONBLOCK (os モジュール):            ファイル記述子の操作.
                                                             (line  428)
* O_PATH (os モジュール):                ファイル記述子の操作.
                                                             (line  462)
* O_RANDOM (os モジュール):              ファイル記述子の操作.
                                                             (line  441)
* O_RDONLY (os モジュール):              ファイル記述子の操作.
                                                             (line  418)
* O_RDWR (os モジュール):                ファイル記述子の操作.
                                                             (line  418)
* O_RSYNC (os モジュール):               ファイル記述子の操作.
                                                             (line  428)
* O_SEQUENTIAL (os モジュール):          ファイル記述子の操作.
                                                             (line  441)
* O_SHLOCK (os モジュール):              ファイル記述子の操作.
                                                             (line  462)
* O_SHORT_LIVED (os モジュール):         ファイル記述子の操作.
                                                             (line  441)
* O_SYMLINK (os モジュール):             ファイル記述子の操作.
                                                             (line  451)
* O_SYNC (os モジュール):                ファイル記述子の操作.
                                                             (line  428)
* O_TEMPORARY (os モジュール):           ファイル記述子の操作.
                                                             (line  441)
* O_TEXT (os モジュール):                ファイル記述子の操作.
                                                             (line  441)
* O_TMPFILE (os モジュール):             ファイル記述子の操作.
                                                             (line  462)
* O_TRUNC (os モジュール):               ファイル記述子の操作.
                                                             (line  418)
* O_WRONLY (os モジュール):              ファイル記述子の操作.
                                                             (line  418)
* obj (AttributeError の属性):           具象例外.           (line   25)
* obj (memoryview の属性):               メモリビュー.       (line  399)
* object:                                オブジェクト、値、および型.
                                                             (line    6)
* object <1>:                            用語集<2>.          (line 1271)
* object (UnicodeError の属性):          具象例外.           (line  442)
* object (組み込みクラス):               組み込み関数.       (line 1230)
* object;asynchronous-generator:         非同期ジェネレータ関数 asynchronous generator function<2>.
                                                             (line   63)
* object;Boolean:                        numbers Integral 整数.
                                                             (line   24)
* object;Boolean <1>:                    数値型 int float complex.
                                                             (line    6)
* object;bytearray:                      ミュータブルなシーケンス型.
                                                             (line    6)
* object;bytearray <1>:                  バイナリシーケンス型 --- bytes bytearray memoryview.
                                                             (line    6)
* object;bytearray <2>:                  bytearray オブジェクト.
                                                             (line    6)
* object;bytearray <3>:                  bytearray オブジェクト<2>.
                                                             (line    6)
* object;bytes:                          バイナリシーケンス型 --- bytes bytearray memoryview.
                                                             (line    6)
* object;bytes <1>:                      バイトオブジェクト. (line    6)
* object;bytes <2>:                      バイトオブジェクト<2>.
                                                             (line   10)
* object;callable:                       呼び出し可能型 callable type.
                                                             (line    6)
* object;callable <1>:                   Formal subscription grammar.
                                                             (line   16)
* object;complex number:                 数値型 int float complex.
                                                             (line    6)
* object;complex number <1>:             複素数オブジェクト. (line    6)
* object;deallocation:                   ファイナライズとメモリ解放.
                                                             (line    6)
* object;dictionary:                     辞書型 dictionary<2>.
                                                             (line    6)
* object;dictionary <1>:                 カスタムクラス型.   (line   19)
* object;dictionary <2>:                 基本的なカスタマイズ.
                                                             (line  238)
* object;dictionary <3>:                 辞書表示.           (line    6)
* object;dictionary <4>:                 Subscriptions and slicings.
                                                             (line    6)
* object;dictionary <5>:                 代入文 assignment statement.
                                                             (line  117)
* object;dictionary <6>:                 マッピング型 --- dict.
                                                             (line    6)
* object;dictionary <7>:                 辞書オブジェクト dictionary object.
                                                             (line    6)
* object;Ellipsis:                       Ellipsis.           (line    6)
* object;finalization:                   ファイナライズとメモリ解放.
                                                             (line    6)
* object;frozenset:                      集合型<2>.          (line   28)
* object;frozenset <1>:                  Set オブジェクト.   (line    6)
* object;GenericAlias:                   ジェネリックエイリアス型.
                                                             (line    6)
* object;immutable:                      変更不能なシーケンス immutable sequence.
                                                             (line    6)
* object;instance:                       カスタムクラス型.   (line   19)
* object;instance <1>:                   クラスインスタンス class instance.
                                                             (line    6)
* object;instance <2>:                   呼び出し call.      (line  148)
* object;instancemethod:                 インスタンスメソッドオブジェクト Instance Method Objects.
                                                             (line    6)
* object;io.StringIO:                    テキストシーケンス型 --- str.
                                                             (line   36)
* object;list:                           変更可能なシーケンス型 mutable sequence.
                                                             (line   20)
* object;list <1>:                       リスト表示.         (line    6)
* object;list <2>:                       属性参照.           (line   10)
* object;list <3>:                       Subscriptions and slicings.
                                                             (line    6)
* object;list <4>:                       Subscriptions and slicings.
                                                             (line   70)
* object;list <5>:                       代入文 assignment statement.
                                                             (line  108)
* object;list <6>:                       ミュータブルなシーケンス型.
                                                             (line    6)
* object;list <7>:                       リスト型 list<2>.   (line    6)
* object;list <8>:                       リストオブジェクト. (line    6)
* object;long integer:                   整数型オブジェクト integer object.
                                                             (line    6)
* object;mapping:                        マッピング型 mapping.
                                                             (line    6)
* object;mapping <1>:                    クラスインスタンス class instance.
                                                             (line   26)
* object;mapping <2>:                    Subscriptions and slicings.
                                                             (line    6)
* object;mapping <3>:                    代入文 assignment statement.
                                                             (line  117)
* object;mapping <4>:                    マッピング型 --- dict.
                                                             (line    6)
* object;mapping <5>:                    Container オブジェクト.
                                                             (line    6)
* object;memoryview:                     バイナリシーケンス型 --- bytes bytearray memoryview.
                                                             (line    6)
* object;memoryview <1>:                 Ellipsis オブジェクト<2>.
                                                             (line   19)
* object;module:                         モジュール<3>.      (line    6)
* object;module <1>:                     属性参照.           (line   10)
* object;module <2>:                     モジュールオブジェクト module object.
                                                             (line    6)
* object;mutable:                        変更可能なシーケンス型 mutable sequence.
                                                             (line    6)
* object;mutable <1>:                    代入文 assignment statement.
                                                             (line    6)
* object;mutable <2>:                    代入文 assignment statement.
                                                             (line   98)
* object;None:                           None.               (line    6)
* object;None <1>:                       式文 expression statement.
                                                             (line   16)
* object;NotImplemented:                 NotImplemented.     (line    6)
* object;PickleBuffer:                   memoryview オブジェクト.
                                                             (line   83)
* object;range:                          range.              (line    6)
* object;sequence:                       シーケンス型 sequence.
                                                             (line    6)
* object;sequence <1>:                   クラスインスタンス class instance.
                                                             (line   26)
* object;sequence <2>:                   Subscriptions and slicings.
                                                             (line    6)
* object;sequence <3>:                   Subscriptions and slicings.
                                                             (line   70)
* object;sequence <4>:                   所属検査演算.       (line   36)
* object;sequence <5>:                   代入文 assignment statement.
                                                             (line  108)
* object;sequence <6>:                   for 文<2>.          (line    6)
* object;sequence <7>:                   共通のシーケンス演算.
                                                             (line    6)
* object;sequence <8>:                   シーケンスオブジェクト sequence object.
                                                             (line    6)
* object;slice:                          コンテナをエミュレートする.
                                                             (line   71)
* object;socket:                         socket --- 低水準ネットワークインターフェース.
                                                             (line   22)
* object;string:                         Subscriptions and slicings.
                                                             (line    6)
* object;string <1>:                     Subscriptions and slicings.
                                                             (line   70)
* object;string <2>:                     range.              (line  118)
* object;traceback:                      トレースバック traceback オブジェクト.
                                                             (line    6)
* object;traceback <1>:                  raise 文.           (line   21)
* object;traceback <2>:                  except 節.          (line   57)
* object;traceback <3>:                  sys --- システム固有のパラメーターと関数.
                                                             (line  450)
* object;traceback <4>:                  traceback --- スタックトレースの表示または取得.
                                                             (line   19)
* object;tuple:                          変更不能なシーケンス immutable sequence.
                                                             (line   35)
* object;tuple <1>:                      Subscriptions and slicings.
                                                             (line    6)
* object;tuple <2>:                      Subscriptions and slicings.
                                                             (line   70)
* object;tuple <3>:                      式のリスト.         (line   13)
* object;tuple <4>:                      イミュータブルなシーケンス型.
                                                             (line    6)
* object;tuple <5>:                      タプル型 tuple.     (line    6)
* object;tuple <6>:                      タプルオブジェクト tuple object.
                                                             (line    6)
* object;type:                           組み込み関数.       (line 2018)
* object;type <1>:                       オブジェクト、型および参照カウント.
                                                             (line    6)
* object;type <2>:                       型オブジェクト<2>.  (line    6)
* object;Union:                          Union 型.           (line    6)
* object;クラス:                         カスタムクラス型.   (line   19)
* object;クラス <1>:                     呼び出し call.      (line  144)
* object;クラス <2>:                     クラス定義.         (line    6)
* object;クラスインスタンス:             カスタムクラス型.   (line   19)
* object;クラスインスタンス <1>:         クラスインスタンス class instance.
                                                             (line    6)
* object;クラスインスタンス <2>:         呼び出し call.      (line  148)
* object;コード:                         コードオブジェクト. (line    6)
* object;コード <1>:                     メソッド.           (line   44)
* object;コード <2>:                     marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line   36)
* object;ジェネレータ:                   Special read-only attributes<2>.
                                                             (line   89)
* object;ジェネレータ <1>:               ジェネレータ式<2>.  (line    6)
* object;ジェネレータ <2>:               Yield 式.           (line  103)
* object;ファイル:                       ファイルを読み書きする.
                                                             (line    6)
* object;ファイル <1>:                   ファイルオブジェクト.
                                                             (line    6)
* object;フレーム:                       フレーム frame オブジェクト.
                                                             (line    6)
* object;メソッド:                       インスタンスオブジェクト.
                                                             (line   25)
* object;メソッド <1>:                   インスタンスメソッド.
                                                             (line    6)
* object;メソッド <2>:                   組み込みメソッド built-in method.
                                                             (line    6)
* object;メソッド <3>:                   呼び出し call.      (line  139)
* object;メソッド <4>:                   メソッド.           (line    6)
* object;メソッド <5>:                   メソッドオブジェクト<2>.
                                                             (line    6)
* object;ユーザ定義メソッド:             インスタンスメソッド.
                                                             (line    6)
* object;ユーザ定義関数:                 ユーザ定義関数 user-defined function.
                                                             (line    6)
* object;ユーザ定義関数 <1>:             呼び出し call.      (line  128)
* object;ユーザ定義関数 <2>:             関数定義.           (line    6)
* object;変更不能なシーケンス:           変更不能なシーケンス immutable sequence.
                                                             (line    6)
* object;変更可能なシーケンス:           変更可能なシーケンス型 mutable sequence.
                                                             (line    6)
* object;数値:                           numbers Number.     (line    6)
* object;数値 <1>:                       クラスインスタンス class instance.
                                                             (line   26)
* object;数値 <2>:                       比較<2>.            (line   42)
* object;数値 <3>:                       数値型 int float complex.
                                                             (line    6)
* object;数値 <4>:                       数値型オブジェクト numeric object.
                                                             (line    6)
* object;整数:                           numbers Integral 整数.
                                                             (line    6)
* object;整数 <1>:                       数値型 int float complex.
                                                             (line    6)
* object;整数 <2>:                       整数型オブジェクト integer object.
                                                             (line    6)
* object;浮動小数点:                     numbers Real float 実数.
                                                             (line    6)
* object;浮動小数点 <1>:                 数値型 int float complex.
                                                             (line    6)
* object;浮動小数点 <2>:                 Floating-Point Objects.
                                                             (line    6)
* object;組み込みメソッド:               組み込みメソッド built-in method.
                                                             (line    6)
* object;組み込みメソッド <1>:           呼び出し call.      (line  139)
* object;組み込み関数:                   組み込み関数 built-in function.
                                                             (line    6)
* object;組み込み関数 <1>:               呼び出し call.      (line  139)
* object;複素数:                         numbers Complex complex.
                                                             (line    6)
* object;関数:                           ユーザ定義関数 user-defined function.
                                                             (line    6)
* object;関数 <1>:                       組み込み関数 built-in function.
                                                             (line    6)
* object;関数 <2>:                       呼び出し call.      (line  128)
* object;関数 <3>:                       呼び出し call.      (line  139)
* object;関数 <4>:                       関数定義.           (line    6)
* object;関数 <5>:                       Function オブジェクト<3>.
                                                             (line    6)
* object;集合:                           集合型<2>.          (line   22)
* object;集合 <1>:                       集合表示.           (line    6)
* object;集合 <2>:                       set（集合）型 --- set frozenset.
                                                             (line    6)
* object;集合 <3>:                       Set オブジェクト.   (line    6)
* object;集合型:                         集合型<2>.          (line    6)
* object.__match_args__ (組み込み変数):  クラスパターンマッチの位置引数のカスタマイズ.
                                                             (line   11)
* object.__slots__ (組み込み変数):       __slots__<2>.       (line   13)
* objobjargproc (C type):                Slot Type typedefs. (line  147)
* objobjproc (C type):                   Slot Type typedefs. (line  143)
* octdigits (string モジュール):         文字列定数.         (line   31)
* OCTOBER (calendar モジュール):         calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  483)
* offset (ctypes.CField の属性):         構造化データ型.     (line  259)
* offset (SyntaxError の属性):           具象例外.           (line  321)
* offset (tarfile.TarInfo の属性):       TarInfo オブジェクト.
                                                             (line  151)
* offset (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line  108)
* offset (xml.parsers.expat.ExpatError の属性): ExpatError 例外.
                                                             (line   30)
* offset_data (tarfile.TarInfo の属性):  TarInfo オブジェクト.
                                                             (line  155)
* OK (curses モジュール):                定数<6>.            (line   13)
* OK (tkinter.messagebox モジュール):    tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  153)
* ok_command() (tkinter.filedialog.LoadFileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  139)
* ok_command() (tkinter.filedialog.SaveFileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  149)
* ok_event() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  118)
* OKCANCEL (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  171)
* old_value (contextvars.Token の属性):  コンテキスト変数.   (line  121)
* OleDLL (ctypes のクラス):              共有ライブラリをロードする.
                                                             (line   35)
* on_motion() (tkinter.dnd.DndHandler のメソッド): tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   55)
* on_release() (tkinter.dnd.DndHandler のメソッド): tkinter dnd --- ドラッグアンドドロップのサポート.
                                                             (line   60)
* onclick() (turtle モジュール):         スクリーンイベントを利用する.
                                                             (line   56)
* ondrag() (turtle モジュール):          イベントを利用する. (line   56)
* onecmd() (cmd.Cmd のメソッド):         Cmdオブジェクト.    (line   58)
* onkey() (turtle モジュール):           スクリーンイベントを利用する.
                                                             (line   12)
* onkeypress() (turtle モジュール):      スクリーンイベントを利用する.
                                                             (line   35)
* onkeyrelease() (turtle モジュール):    スクリーンイベントを利用する.
                                                             (line   12)
* onrelease() (turtle モジュール):       イベントを利用する. (line   29)
* onscreenclick() (turtle モジュール):   スクリーンイベントを利用する.
                                                             (line   56)
* ontimer() (turtle モジュール):         スクリーンイベントを利用する.
                                                             (line   85)
* OP (token モジュール):                 token --- Python 解析木で使われる定数.
                                                             (line   58)
* OP_ALL (ssl モジュール):               定数<9>.            (line  211)
* OP_CIPHER_SERVER_PREFERENCE (ssl モジュール): 定数<9>.     (line  301)
* OP_ENABLE_KTLS (ssl モジュール):       定数<9>.            (line  360)
* OP_ENABLE_MIDDLEBOX_COMPAT (ssl モジュール): 定数<9>.      (line  325)
* OP_IGNORE_UNEXPECTED_EOF (ssl モジュール): 定数<9>.        (line  352)
* OP_LEGACY_SERVER_CONNECT (ssl モジュール): 定数<9>.        (line  377)
* OP_NO_COMPRESSION (ssl モジュール):    定数<9>.            (line  334)
* OP_NO_RENEGOTIATION (ssl モジュール):  定数<9>.            (line  291)
* OP_NO_SSLv2 (ssl モジュール):          定数<9>.            (line  220)
* OP_NO_SSLv3 (ssl モジュール):          定数<9>.            (line  230)
* OP_NO_TICKET (ssl モジュール):         定数<9>.            (line  345)
* OP_NO_TLSv1 (ssl モジュール):          定数<9>.            (line  240)
* OP_NO_TLSv1_1 (ssl モジュール):        定数<9>.            (line  252)
* OP_NO_TLSv1_2 (ssl モジュール):        定数<9>.            (line  264)
* OP_NO_TLSv1_3 (ssl モジュール):        定数<9>.            (line  276)
* OP_SINGLE_DH_USE (ssl モジュール):     定数<9>.            (line  309)
* OP_SINGLE_ECDH_USE (ssl モジュール):   定数<9>.            (line  317)
* Open (tkinter.filedialog のクラス):    ネイティブの読み込み/保存ダイアログ.
                                                             (line   59)
* open_binary() (importlib.resources モジュール): 関数 API.  (line   35)
* open_code() (io モジュール):           高水準のモジュールインターフェイス.
                                                             (line   22)
* open_connection() (asyncio モジュール): ストリーム.        (line   42)
* open_flags (dbm.gnu モジュール):       dbm gnu --- GNU database manager.
                                                             (line   30)
* open_new_tab() (webbrowser モジュール): コマンドライン・インターフェース<6>.
                                                             (line   60)
* open_new_tab() (webbrowser.controller のメソッド): Browser controller objects.
                                                             (line   27)
* open_new() (webbrowser モジュール):    コマンドライン・インターフェース<6>.
                                                             (line   51)
* open_new() (webbrowser.controller のメソッド): Browser controller objects.
                                                             (line   21)
* open_osfhandle() (msvcrt モジュール):  ファイル操作関連.   (line   44)
* open_resource() (importlib.resources.abc.ResourceReader のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line   47)
* open_text() (importlib.resources モジュール): 関数 API.    (line   51)
* open_unix_connection() (asyncio モジュール): ストリーム.   (line  118)
* open_urlresource() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  619)
* open() (bz2 モジュール):               ファイルの圧縮/解凍.
                                                             (line    6)
* open() (codecs モジュール):            codecs --- codec レジストリと基底クラス.
                                                             (line  185)
* open() (compression.zstd モジュール):  圧縮ファイルへの読み書き.
                                                             (line    6)
* open() (dbm モジュール):               dbm --- Unix "データベース" へのインターフェース.
                                                             (line   50)
* open() (dbm.dumb モジュール):          dbm dumb --- Portable DBM implementation.
                                                             (line   27)
* open() (dbm.gnu モジュール):           dbm gnu --- GNU database manager.
                                                             (line   35)
* open() (dbm.ndbm モジュール):          dbm ndbm --- New Database Manager.
                                                             (line   40)
* open() (dbm.sqlite3 モジュール):       dbm sqlite3 --- SQLite backend for dbm.
                                                             (line   22)
* open() (gzip モジュール):              gzip --- gzip ファイルのサポート.
                                                             (line   32)
* open() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line  256)
* open() (importlib.resources.abc.Traversable のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  144)
* open() (io モジュール):                高水準のモジュールインターフェイス.
                                                             (line   12)
* open() (lzma モジュール):              圧縮ファイルへの読み書き<2>.
                                                             (line    6)
* open() (os モジュール):                ファイル記述子の操作.
                                                             (line  373)
* open() (pathlib.Path のメソッド):      ファイルを読み書きする<2>.
                                                             (line    6)
* open() (shelve モジュール):            shelve --- Python オブジェクトの永続化.
                                                             (line   17)
* open() (tarfile モジュール):           tarfile --- tar アーカイブファイルの読み書き.
                                                             (line   54)
* open() (tarfile.TarFile のクラスメソッド): TarFile オブジェクト.
                                                             (line  100)
* open() (tokenize モジュール):          入力のトークナイズ. (line   98)
* open() (urllib.request.OpenerDirector のメソッド): OpenerDirector オブジェクト.
                                                             (line   47)
* open() (wave モジュール):              wave --- WAV ファイルの読み書き.
                                                             (line   19)
* open() (webbrowser モジュール):        コマンドライン・インターフェース<6>.
                                                             (line   32)
* open() (webbrowser.controller のメソッド): Browser controller objects.
                                                             (line   14)
* open() (zipfile.Path のメソッド):      Path objects.       (line   35)
* open() (zipfile.ZipFile のメソッド):   ZipFile objects.    (line  138)
* OpenerDirector (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  320)
* OpenKey() (winreg モジュール):         関数<14>.           (line  284)
* OpenKeyEx() (winreg モジュール):       関数<14>.           (line  284)
* openlog() (syslog モジュール):         syslog --- Unix syslog ライブラリルーチン群.
                                                             (line   52)
* openpty() (os モジュール):             ファイル記述子の操作.
                                                             (line  479)
* openpty() (pty モジュール):            pty --- 擬似端末ユーティリティ.
                                                             (line   34)
* OPENSSL_VERSION (ssl モジュール):      定数<9>.            (line  487)
* OPENSSL_VERSION_INFO (ssl モジュール): 定数<9>.            (line  497)
* OPENSSL_VERSION_NUMBER (ssl モジュール): 定数<9>.          (line  506)
* OpenSSL;(use in module hashlib):       ハッシュアルゴリズム.
                                                             (line   18)
* OpenSSL;(use in module ssl):           ssl --- ソケットオブジェクト用の TLS/SSL ラッパー.
                                                             (line    8)
* OperationalError:                      例外<7>.            (line   55)
* operator;- (負符号):                   単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
                                                             (line   10)
* operator;- (負符号) <1>:               二項算術演算 binary arithmetic operation.
                                                             (line   89)
* operator;- (負符号) <2>:               数値型 int float complex.
                                                             (line   27)
* operator;!=:                           比較.               (line    6)
* operator;!= <1>:                       比較<2>.            (line    6)
* operator;@ (at):                       二項算術演算 binary arithmetic operation.
                                                             (line   29)
* operator;* (アスタリスク):             二項算術演算 binary arithmetic operation.
                                                             (line   16)
* operator;* (アスタリスク) <1>:         数値型 int float complex.
                                                             (line   27)
* operator;**:                           べき乗演算 power operator.
                                                             (line    6)
* operator;** <1>:                       数値型 int float complex.
                                                             (line   27)
* operator;/ (スラッシュ):               二項算術演算 binary arithmetic operation.
                                                             (line   37)
* operator;/ (スラッシュ) <1>:           数値型 int float complex.
                                                             (line   27)
* operator;//:                           二項算術演算 binary arithmetic operation.
                                                             (line   37)
* operator;// <1>:                       数値型 int float complex.
                                                             (line   27)
* operator;& (アンパサンド):             ビット単位演算の二項演算 binary bitwise operation.
                                                             (line   12)
* operator;& (アンパサンド) <1>:         整数型におけるビット単位演算.
                                                             (line    6)
* operator;% (パーセント):               二項算術演算 binary arithmetic operation.
                                                             (line   50)
* operator;% (パーセント) <1>:           数値型 int float complex.
                                                             (line   27)
* operator;^ (キャレット):               ビット単位演算の二項演算 binary bitwise operation.
                                                             (line   16)
* operator;^ (キャレット) <1>:           整数型におけるビット単位演算.
                                                             (line    6)
* operator;+ (プラス記号):               単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
                                                             (line   14)
* operator;+ (プラス記号) <1>:           二項算術演算 binary arithmetic operation.
                                                             (line   77)
* operator;+ (プラス記号) <2>:           数値型 int float complex.
                                                             (line   27)
* operator;< (小さい):                   比較.               (line    6)
* operator;< (小さい) <1>:               比較<2>.            (line    6)
* operator;<<:                           シフト演算 shifting operation.
                                                             (line    6)
* operator;<< <1>:                       整数型におけるビット単位演算.
                                                             (line    6)
* operator;<=:                           比較.               (line    6)
* operator;<= <1>:                       比較<2>.            (line    6)
* operator;==:                           比較.               (line    6)
* operator;== <1>:                       比較<2>.            (line    6)
* operator;> (大きい):                   比較.               (line    6)
* operator;> (大きい) <1>:               比較<2>.            (line    6)
* operator;>=:                           比較.               (line    6)
* operator;>= <1>:                       比較<2>.            (line    6)
* operator;>>:                           シフト演算 shifting operation.
                                                             (line    6)
* operator;>> <1>:                       整数型におけるビット単位演算.
                                                             (line    6)
* operator;| (縦棒):                     ビット単位演算の二項演算 binary bitwise operation.
                                                             (line   20)
* operator;| (縦棒) <1>:                 整数型におけるビット単位演算.
                                                             (line    6)
* operator;~ (チルダ):                   単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
                                                             (line   18)
* operator;~ (チルダ) <1>:               整数型におけるビット単位演算.
                                                             (line    6)
* operator;and:                          ブール演算 boolean operation.
                                                             (line   21)
* operator;and <1>:                      真理値判定.         (line   25)
* operator;and <2>:                      ブール演算 --- and or not.
                                                             (line   24)
* operator;in:                           所属検査演算.       (line   36)
* operator;in <1>:                       比較<2>.            (line   63)
* operator;in <2>:                       共通のシーケンス演算.
                                                             (line   18)
* operator;is:                           所属検査演算.       (line   39)
* operator;is <1>:                       比較<2>.            (line    6)
* operator;is not:                       所属検査演算.       (line   39)
* operator;is not <1>:                   比較<2>.            (line    6)
* operator;not:                          ブール演算 boolean operation.
                                                             (line   18)
* operator;not <1>:                      ブール演算 --- and or not.
                                                             (line   24)
* operator;not in:                       所属検査演算.       (line   36)
* operator;not in <1>:                   比較<2>.            (line   63)
* operator;not in <2>:                   共通のシーケンス演算.
                                                             (line   18)
* operator;or:                           ブール演算 boolean operation.
                                                             (line   24)
* operator;or <1>:                       真理値判定.         (line   25)
* operator;or <2>:                       ブール演算 --- and or not.
                                                             (line   24)
* operator;オーバーロード:               特殊メソッド名.     (line    6)
* operator;優先順位:                     演算子の優先順位.   (line    6)
* operator;比較:                         比較<2>.            (line    6)
* opmap (dis モジュール):                命令コードコレクション.
                                                             (line   18)
* opname (dis モジュール):               命令コードコレクション.
                                                             (line   13)
* OPT:                                   Debug options.      (line   39)
* optim_args_from_interpreter_flags() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  349)
* optimize (sys.flags の属性):           sys --- システム固有のパラメーターと関数.
                                                             (line  539)
* optimize() (pickletools モジュール):   Programmatic interface.
                                                             (line   30)
* optimized scope:                       用語集<2>.          (line 1277)
* OPTIMIZED_BYTECODE_SUFFIXES (importlib.machinery モジュール): importlib machinery -- Importers and path hooks.
                                                             (line   29)
* Option (optparse のクラス):            オプション属性.     (line    6)
* Optional (typing モジュール):          特殊形式.           (line   60)
* optional module:                       用語集<2>.          (line 1288)
* OptionConflictError:                   例外<12>.           (line   11)
* OptionError:                           例外<12>.           (line    6)
* OptionGroup (optparse のクラス):       オプションをグループ化する.
                                                             (line   12)
* OptionParser (optparse のクラス):      parserを作る.       (line    9)
* options (doctest.Example の属性):      Example オブジェクト.
                                                             (line   49)
* Options (ssl のクラス):                定数<9>.            (line  341)
* options (ssl.SSLContext の属性):       SSL コンテキスト.   (line  572)
* options() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  134)
* OptionValueError:                      例外<12>.           (line   16)
* optionxform() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  314)
* Or (ast のクラス):                     式 expression<2>.   (line   89)
* or_() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  145)
* ordered_attributes (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  193)
* OrderedDict (collections のクラス):    OrderedDict オブジェクト.
                                                             (line   59)
* OrderedDict (typing のクラス):         Aliases to types in collections.
                                                             (line   17)
* orig_argv (sys モジュール):            sys --- システム固有のパラメーターと関数.
                                                             (line 1414)
* origin (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  390)
* origin_req_host (urllib.request.Request の属性): Request オブジェクト.
                                                             (line   30)
* origin_server (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  289)
* os_environ (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  167)
* OSError:                               具象例外.           (line  148)
* OUT_TO_DEFAULT (msvcrt モジュール):    その多の関数.       (line   20)
* OUT_TO_MSGBOX (msvcrt モジュール):     その多の関数.       (line   30)
* OUT_TO_STDERR (msvcrt モジュール):     その多の関数.       (line   25)
* output:                                式文 expression statement.
                                                             (line   16)
* output (subprocess.CalledProcessError の属性): Using the subprocess Module.
                                                             (line  221)
* output (subprocess.TimeoutExpired の属性): Using the subprocess Module.
                                                             (line  180)
* output (unittest.TestCase の属性):     テストクラス.       (line  461)
* output_charset (email.charset.Charset の属性): email charset 文字集合の表現.
                                                             (line   75)
* output_codec (email.charset.Charset の属性): email charset 文字集合の表現.
                                                             (line   89)
* output_difference() (doctest.OutputChecker のメソッド): OutputChecker オブジェクト.
                                                             (line   27)
* output() (http.cookies.BaseCookie のメソッド): Cookieオブジェクト.
                                                             (line   24)
* output() (http.cookies.Morsel のメソッド): Morselオブジェクト.
                                                             (line   83)
* OutputChecker (doctest のクラス):      OutputChecker オブジェクト.
                                                             (line    6)
* OutputString() (http.cookies.Morsel のメソッド): Morselオブジェクト.
                                                             (line   97)
* OutsideDestinationError:               tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  294)
* Overflow (decimal のクラス):           シグナル.           (line   69)
* OverflowError:                         具象例外.           (line  208)
* OverflowError (組み込み例外):          整数型オブジェクト integer object.
                                                             (line  165)
* OverflowError (組み込み例外) <1>:      整数型オブジェクト integer object.
                                                             (line  221)
* OverflowError (組み込み例外) <2>:      整数型オブジェクト integer object.
                                                             (line  264)
* OverflowError (組み込み例外) <3>:      整数型オブジェクト integer object.
                                                             (line  276)
* OverflowError (組み込み例外) <4>:      整数型オブジェクト integer object.
                                                             (line  288)
* OverflowError (組み込み例外) <5>:      整数型オブジェクト integer object.
                                                             (line  301)
* overlap_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  242)
* overlap() (statistics.NormalDist のメソッド): NormalDist オブジェクト.
                                                             (line  102)
* overlaps() (ipaddress.IPv4Network のメソッド): Network オブジェクト.
                                                             (line  155)
* overlaps() (ipaddress.IPv6Network のメソッド): Network オブジェクト.
                                                             (line  342)
* overlay() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  428)
* overload() (typing モジュール):        Functions and decorators.
                                                             (line  246)
* override() (typing モジュール):        Functions and decorators.
                                                             (line  370)
* overwrite() (curses.window のメソッド): Window オブジェクト.
                                                             (line  440)
* owner() (pathlib.Path のメソッド):     パーミッションと所有者.
                                                             (line    6)
* p (pdb command):                       Debugger commands.  (line  272)
* P_ALL (os モジュール):                 プロセス管理.       (line  967)
* P_DETACH (os モジュール):              プロセス管理.       (line  700)
* P_NOWAIT (os モジュール):              プロセス管理.       (line  680)
* P_NOWAITO (os モジュール):             プロセス管理.       (line  680)
* P_OVERLAY (os モジュール):             プロセス管理.       (line  700)
* P_PGID (os モジュール):                プロセス管理.       (line  967)
* P_PID (os モジュール):                 プロセス管理.       (line  967)
* P_PIDFD (os モジュール):               プロセス管理.       (line  967)
* P_WAIT (os モジュール):                プロセス管理.       (line  690)
* pack_into() (struct モジュール):       関数と例外.         (line   19)
* pack_into() (struct.Struct のメソッド): クラス<3>.         (line   30)
* pack() (mailbox.MH のメソッド):        MH オブジェクト.    (line   69)
* pack() (struct モジュール):            関数と例外.         (line   13)
* pack() (struct.Struct のメソッド):     クラス<3>.          (line   24)
* package:                               パッケージ<2>.      (line    6)
* package <1>:                           site --- サイト固有の設定フック.
                                                             (line   76)
* package <2>:                           用語集<2>.          (line 1298)
* package variable;__all__:              モジュールのインポート<2>.
                                                             (line    8)
* package;namespace:                     名前空間パッケージ. (line    6)
* package;portion:                       名前空間パッケージ. (line    6)
* package;regular:                       通常のパッケージ.   (line    6)
* PackageMetadata (importlib.metadata のクラス): 配布物メタデータ.
                                                             (line   14)
* PackageNotFoundError:                  概要<3>.            (line   37)
* PackagePath (importlib.metadata のクラス): 配布物ファイル. (line   18)
* packages_distributions() (importlib.metadata モジュール): Mapping import to distribution packages.
                                                             (line    6)
* packed (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line   72)
* packed (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  267)
* packing (widgets):                     Packer.             (line    6)
* PAGER:                                 pydoc --- ドキュメント生成とオンラインヘルプシステム.
                                                             (line   46)
* pair_content() (curses モジュール):    関数<6>.            (line  386)
* pair_number() (curses モジュール):     関数<6>.            (line  392)
* pairwise() (itertools モジュール):     Itertool関数.       (line  411)
* parallelism:                           用語集<2>.          (line 1307)
* parameter:                             用語集<2>.          (line 1318)
* Parameter (inspect のクラス):          Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  214)
* parameter;call の意味付け:             呼び出し call.      (line   26)
* parameter;difference from argument:    オプションパラメータやキーワードパラメータを関数から関数へ渡すにはどうしたらいいですか？.
                                                             (line   16)
* parameter;function definition:         クラスパターン.     (line  139)
* ParameterizedMIMEHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  249)
* parameters (inspect.Signature の属性): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  116)
* params (email.headerregistry.ParameterizedMIMEHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  257)
* ParamSpec (ast のクラス):              Type parameters.    (line   36)
* ParamSpec (typing のクラス):           Building generic types and type aliases.
                                                             (line  399)
* ParamSpecArgs (typing モジュール):     Building generic types and type aliases.
                                                             (line  531)
* ParamSpecKwargs (typing モジュール):   Building generic types and type aliases.
                                                             (line  531)
* paramstyle (sqlite3 モジュール):       モジュール定数.     (line   69)
* pardir (os モジュール):                雑多なシステム情報. (line  106)
* parent (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  426)
* parent (logging.Logger の属性):        ロガーオブジェクト. (line   42)
* parent (pathlib.PurePath の属性):      メソッドとプロパティ.
                                                             (line   94)
* parent (pyclbr.Class の属性):          クラスオブジェクト<2>.
                                                             (line   28)
* parent (pyclbr.Function の属性):       Function オブジェクト.
                                                             (line   27)
* parent (urllib.request.BaseHandler の属性): BaseHandler オブジェクト.
                                                             (line   25)
* parent_process() (multiprocessing モジュール): その他<5>.  (line   43)
* parent() (tkinter.ttk.Treeview のメソッド): ttk Treeview.  (line  226)
* parentNode (xml.dom.Node の属性):      Node オブジェクト.  (line   17)
* parents (collections.ChainMap の属性): ChainMap オブジェクト.
                                                             (line   62)
* parents (pathlib.PurePath の属性):     メソッドとプロパティ.
                                                             (line   78)
* paretovariate() (random モジュール):   実数分布.           (line   92)
* parse_and_bind() (readline モジュール): 初期化ファイル.    (line    8)
* parse_args() (argparse.ArgumentParser のメソッド): parse_args メソッド.
                                                             (line    6)
* parse_args() (optparse.OptionParser のメソッド): 引数を解析する.
                                                             (line    9)
* PARSE_COLNAMES (sqlite3 モジュール):   モジュール定数.     (line   34)
* parse_config_h() (sysconfig モジュール): その他の関数<3>.  (line   53)
* PARSE_DECLTYPES (sqlite3 モジュール):  モジュール定数.     (line   13)
* parse_headers() (http.client モジュール): http client --- HTTP プロトコルクライアント.
                                                             (line  115)
* parse_intermixed_args() (argparse.ArgumentParser のメソッド): 混在した引数の解析.
                                                             (line    6)
* parse_known_args() (argparse.ArgumentParser のメソッド): 部分解析.
                                                             (line    6)
* parse_known_intermixed_args() (argparse.ArgumentParser のメソッド): 混在した引数の解析.
                                                             (line    9)
* parse_qs() (urllib.parse モジュール):  URL の解析.         (line  159)
* parse_qsl() (urllib.parse モジュール): URL の解析.         (line  209)
* parse() (ast モジュール):              ast helpers.        (line    9)
* parse() (doctest.DocTestParser のメソッド): DocTestParser オブジェクト.
                                                             (line   30)
* parse() (email.parser.BytesParser のメソッド): Parser API. (line   34)
* parse() (email.parser.Parser のメソッド): Parser API.      (line   86)
* parse() (string.Formatter のメソッド): カスタムの文字列書式化.
                                                             (line   39)
* parse() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   29)
* parse() (xml.dom.minidom モジュール):  xml dom minidom --- 最小限の DOM の実装.
                                                             (line   35)
* parse() (xml.dom.pulldom モジュール):  xml dom pulldom --- 部分的な DOM ツリー構築のサポート.
                                                             (line   83)
* parse() (xml.etree.ElementTree モジュール): 関数<9>.       (line  173)
* parse() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   52)
* Parse() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line    8)
* parse() (xml.sax モジュール):          xml sax --- SAX2 バーサーのサポート.
                                                             (line   39)
* parse() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line    8)
* parseaddr() (email.utils モジュール):  email utils Miscellaneous utilities.
                                                             (line   58)
* parsebytes() (email.parser.BytesParser のメソッド): Parser API.
                                                             (line   54)
* parsedate_to_datetime() (email.utils モジュール): email utils Miscellaneous utilities.
                                                             (line  129)
* parsedate_tz() (email.utils モジュール): email utils Miscellaneous utilities.
                                                             (line  118)
* parsedate() (email.utils モジュール):  email utils Miscellaneous utilities.
                                                             (line  107)
* ParseError (xml.etree.ElementTree のクラス): 例外<22>.     (line    6)
* ParseFile() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line   16)
* ParseFlags() (imaplib モジュール):     imaplib --- IMAP4 プロトコルクライアント.
                                                             (line  128)
* Parser (email.parser のクラス):        Parser API.         (line   75)
* parser (pathlib.PurePath の属性):      メソッドとプロパティ.
                                                             (line    8)
* ParserCreate() (xml.parsers.expat モジュール): xml parsers expat --- Expat を使用した高速な XML 解析.
                                                             (line   45)
* ParseResult (urllib.parse のクラス):   構造化された解析結果.
                                                             (line   47)
* ParseResultBytes (urllib.parse のクラス): 構造化された解析結果.
                                                             (line   72)
* parsestr() (email.parser.Parser のメソッド): Parser API.   (line   98)
* parseString() (xml.dom.minidom モジュール): xml dom minidom --- 最小限の DOM の実装.
                                                             (line   48)
* parseString() (xml.dom.pulldom モジュール): xml dom pulldom --- 部分的な DOM ツリー構築のサポート.
                                                             (line   96)
* parseString() (xml.sax モジュール):    xml sax --- SAX2 バーサーのサポート.
                                                             (line   52)
* ParsingError:                          例外<9>.            (line   61)
* partial (asyncio.IncompleteReadError の属性): 例外<16>.    (line   57)
* partial() (functools モジュール):      functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  330)
* partial() (imaplib.IMAP4 のメソッド):  IMAP4 オブジェクト. (line  275)
* partialmethod (functools のクラス):    functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  400)
* parties (asyncio.Barrier の属性):      Barrier.            (line   95)
* parties (threading.Barrier の属性):    Barrier objects.    (line   92)
* partition() (bytearray のメソッド):    bytes と bytearray の操作.
                                                             (line  188)
* partition() (bytes のメソッド):        bytes と bytearray の操作.
                                                             (line  188)
* partition() (str のメソッド):          文字列メソッド<2>.  (line  520)
* partitioned (http.cookies.Morsel の属性): Morselオブジェクト.
                                                             (line   13)
* parts (pathlib.PurePath の属性):       個別の構成要素へのアクセス.
                                                             (line    9)
* Pass (ast のクラス):                   文 Statements.      (line  153)
* pass_() (poplib.POP3 のメソッド):      POP3 オブジェクト.  (line   34)
* Paste [貼り付け]:                      Help メニュー Shell ウィンドウ、Editor ウィンドウ.
                                                             (line   32)
* patch.dict() (unittest.mock モジュール): patch dict.       (line    6)
* patch.multiple() (unittest.mock モジュール): patch multiple.
                                                             (line    6)
* patch.object() (unittest.mock モジュール): patch object.   (line    6)
* patch.stopall() (unittest.mock モジュール): patch のメソッド start と stop.
                                                             (line   69)
* patch() (test.support モジュール):     test support --- Utilities for the Python test suite.
                                                             (line  690)
* patch() (unittest.mock モジュール):    patch.              (line    9)
* PATH:                                  Python API の変更<6>.
                                                             (line  145)
* PATH <1>:                              'python' コマンドの挙動の変更<2>.
                                                             (line    6)
* PATH <2>:                              'python' コマンドの挙動の変更<2>.
                                                             (line   10)
* PATH <3>:                              'python' コマンドの挙動の変更<2>.
                                                             (line   11)
* PATH <4>:                              macOS<9>.           (line   14)
* PATH <5>:                              Windows<29>.        (line   56)
* PATH <6>:                              Windows<33>.        (line   14)
* PATH <7>:                              セキュリティ<44>.   (line   16)
* PATH <8>:                              セキュリティ<44>.   (line   20)
* PATH <9>:                              モジュール検索パス. (line   16)
* PATH <10>:                             実行可能な Python スクリプト.
                                                             (line   11)
* PATH <11>:                             環境変数.           (line   26)
* PATH <12>:                             その他<2>.          (line   15)
* PATH <13>:                             Installation.       (line   19)
* PATH <14>:                             Installation.       (line   24)
* PATH <15>:                             Installation.       (line   32)
* PATH <16>:                             Configuration.      (line  114)
* PATH <17>:                             Shebang lines.      (line   40)
* PATH <18>:                             Shebang lines.      (line   42)
* PATH <19>:                             Shebang lines.      (line   49)
* PATH <20>:                             Advanced installation.
                                                             (line   10)
* PATH <21>:                             Advanced installation.
                                                             (line   28)
* PATH <22>:                             Advanced installation.
                                                             (line   31)
* PATH <23>:                             Installing free-threaded binaries.
                                                             (line   18)
* PATH <24>:                             Troubleshooting.    (line   33)
* PATH <25>:                             Troubleshooting.    (line   52)
* PATH <26>:                             Troubleshooting.    (line   68)
* PATH <27>:                             Troubleshooting.    (line  110)
* PATH <28>:                             インストール手順.   (line   35)
* PATH <29>:                             インストール手順.   (line   58)
* PATH <30>:                             Installing without UI.
                                                             (line   77)
* PATH <31>:                             Installing without UI.
                                                             (line   82)
* PATH <32>:                             Python launcher for Windows deprecated.
                                                             (line   17)
* PATH <33>:                             コマンドラインから起動する.
                                                             (line    8)
* PATH <34>:                             Shebang lines<2>.   (line   55)
* PATH <35>:                             Shebang lines<2>.   (line   61)
* PATH <36>:                             Shebang lines<2>.   (line   63)
* PATH <37>:                             Shebang lines<2>.   (line   68)
* PATH <38>:                             os と os path モジュールの比較.
                                                             (line   41)
* PATH <39>:                             ディレクトリとファイルの操作.
                                                             (line  450)
* PATH <40>:                             ディレクトリとファイルの操作.
                                                             (line  455)
* PATH <41>:                             プロセス管理.       (line   45)
* PATH <42>:                             プロセス管理.       (line   87)
* PATH <43>:                             プロセス管理.       (line   90)
* PATH <44>:                             プロセス管理.       (line   93)
* PATH <45>:                             プロセス管理.       (line  547)
* PATH <46>:                             プロセス管理.       (line  635)
* PATH <47>:                             プロセス管理.       (line  637)
* PATH <48>:                             プロセス管理.       (line  639)
* PATH <49>:                             雑多なシステム情報. (line  137)
* PATH <50>:                             Popen コンストラクター.
                                                             (line   35)
* PATH <51>:                             webbrowser --- 便利なウェブブラウザコントローラー.
                                                             (line   57)
* PATH <52>:                             webbrowser --- 便利なウェブブラウザコントローラー.
                                                             (line   32)
* PATH <53>:                             仮想環境のしくみ.   (line   15)
* PATH <54>:                             仮想環境のしくみ.   (line   60)
* PATH <55>:                             仮想環境のしくみ.   (line   65)
* PATH <56>:                             site --- サイト固有の設定フック.
                                                             (line   68)
* PATH <57>:                             Python の埋め込み<2>.
                                                             (line   26)
* PATH <58>:                             Python の埋め込み<2>.
                                                             (line   34)
* PATH <59>:                             Python のスクリプトを Unix で実行可能にするにはどうしますか？.
                                                             (line   20)
* PATH <60>:                             Python のスクリプトを Unix で実行可能にするにはどうしますか？.
                                                             (line   26)
* path (http.cookiejar.Cookie の属性):   Cookieオブジェクト<2>.
                                                             (line   44)
* path (http.cookies.Morsel の属性):     Morselオブジェクト. (line   13)
* path (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  146)
* path (ImportError の属性):             具象例外.           (line   64)
* path (importlib.abc.FileLoader の属性): importlib abc -- Abstract base classes related to import.
                                                             (line  311)
* path (importlib.machinery.AppleFrameworkLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  503)
* path (importlib.machinery.ExtensionFileLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  306)
* path (importlib.machinery.FileFinder の属性): importlib machinery -- Importers and path hooks.
                                                             (line  176)
* path (importlib.machinery.SourceFileLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  213)
* path (importlib.machinery.SourcelessFileLoader の属性): importlib machinery -- Importers and path hooks.
                                                             (line  257)
* path (os.DirEntry の属性):             ファイルとディレクトリ.
                                                             (line  969)
* Path (pathlib のクラス):               具象パス.           (line   10)
* path (sys モジュール):                 sys --- システム固有のパラメーターと関数.
                                                             (line 1427)
* path (sys モジュール) <1>:             Python の埋め込み<2>.
                                                             (line   11)
* path (sys モジュール) <2>:             インタープリタの初期化と終了処理.
                                                             (line    7)
* path (sys モジュール) <3>:             プロセスワイドのパラメータ.
                                                             (line  140)
* Path (zipfile のクラス):               Path objects.       (line    6)
* path based finder:                     パスベース・ファインダー.
                                                             (line    6)
* path based finder <1>:                 用語集<2>.          (line 1396)
* Path browser:                          File メニュー Shell ウィンドウ、Editor ウィンドウ.
                                                             (line   23)
* path entry:                            用語集<2>.          (line 1375)
* path entry finder:                     用語集<2>.          (line 1380)
* path entry hook:                       用語集<2>.          (line 1390)
* path hooks:                            インポートフック.   (line    6)
* path_hook() (importlib.machinery.FileFinder のクラスメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  191)
* path_hooks (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1460)
* path_importer_cache (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 1469)
* path_mtime() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  374)
* path_return_ok() (http.cookiejar.CookiePolicy のメソッド): CookiePolicy オブジェクト.
                                                             (line   59)
* path_stats() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  355)
* path_stats() (importlib.machinery.SourceFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  221)
* path-like object:                      用語集<2>.          (line 1401)
* Path.stem (zipfile モジュール):        Path objects.       (line   86)
* Path.suffix (zipfile モジュール):      Path objects.       (line   79)
* Path.suffixes (zipfile モジュール):    Path objects.       (line   92)
* path() (importlib.resources モジュール): 関数 API.         (line  110)
* pathconf_names (os モジュール):        ファイルとディレクトリ.
                                                             (line  679)
* pathconf() (os モジュール):            ファイルとディレクトリ.
                                                             (line  657)
* PathEntryFinder (importlib.abc のクラス): importlib abc -- Abstract base classes related to import.
                                                             (line   58)
* PATHEXT:                               その他の改善<2>.    (line   30)
* PATHEXT <1>:                           ライブラリ<135>.    (line  138)
* PATHEXT <2>:                           Installing without UI.
                                                             (line   78)
* PATHEXT <3>:                           Installing without UI.
                                                             (line   83)
* PATHEXT <4>:                           ディレクトリとファイルの操作.
                                                             (line  465)
* PathFinder (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line  106)
* PathInfo (pathlib.types のクラス):     プロトコル.         (line   10)
* PathLike (os のクラス):                プロセスのパラメーター.
                                                             (line  144)
* pathname2url() (urllib.request モジュール): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  143)
* pathsep (os モジュール):               雑多なシステム情報. (line  135)
* Pattern (re のクラス):                 正規表現オブジェクト.
                                                             (line    6)
* pattern (re.Pattern の属性):           正規表現オブジェクト.
                                                             (line  121)
* pattern (re.PatternError の属性):      例外<3>.            (line   19)
* Pattern (typing のクラス):             Aliases to other concrete types.
                                                             (line    6)
* pattern matching:                      match 文<2>.        (line    6)
* PatternError:                          例外<3>.            (line    6)
* pause_reading() (asyncio.ReadTransport のメソッド): 読み出し専用のトランスポート.
                                                             (line   12)
* pause_writing() (asyncio.BaseProtocol のメソッド): 基底プロトコル<2>.
                                                             (line   41)
* pause() (signal モジュール):           モジュールの内容<2>.
                                                             (line  338)
* PAX_FORMAT (tarfile モジュール):       tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  386)
* pax_headers (tarfile.TarFile の属性):  TarFile オブジェクト.
                                                             (line  334)
* pax_headers (tarfile.TarInfo の属性):  TarInfo オブジェクト.
                                                             (line  163)
* pbkdf2_hmac() (hashlib モジュール):    鍵導出.             (line   11)
* pd() (turtle モジュール):              描画状態.           (line    6)
* Pdb (class in pdb):                    pdb --- The Python Debugger.
                                                             (line   17)
* Pdb (pdb のクラス):                    コマンドライン・インターフェース<8>.
                                                             (line  180)
* pdb コマンドラインオプション; -c:      コマンドライン・インターフェース<8>.
                                                             (line   18)
* pdb コマンドラインオプション; -command: コマンドライン・インターフェース<8>.
                                                             (line   18)
* pdb コマンドラインオプション; -m:      コマンドライン・インターフェース<8>.
                                                             (line   25)
* pdb コマンドラインオプション; -p:      コマンドライン・インターフェース<8>.
                                                             (line   33)
* pdb コマンドラインオプション; -pid:    コマンドライン・インターフェース<8>.
                                                             (line   33)
* pdf() (statistics.NormalDist のメソッド): NormalDist オブジェクト.
                                                             (line   74)
* peek() (bz2.BZ2File のメソッド):       ファイルの圧縮/解凍.
                                                             (line   72)
* peek() (compression.zstd.ZstdFile のメソッド): 圧縮ファイルへの読み書き.
                                                             (line   93)
* peek() (gzip.GzipFile のメソッド):     gzip --- gzip ファイルのサポート.
                                                             (line  137)
* peek() (io.BufferedReader のメソッド): バッファ付きストリーム.
                                                             (line   77)
* peek() (lzma.LZMAFile のメソッド):     圧縮ファイルへの読み書き<2>.
                                                             (line   85)
* peek() (weakref.finalize のメソッド):  weakref --- Weak references.
                                                             (line  297)
* PEM_cert_to_DER_cert() (ssl モジュール): 証明書の取り扱い. (line   58)
* pen() (turtle モジュール):             描画状態.           (line   32)
* pencolor() (turtle モジュール):        色の制御<2>.        (line    6)
* pending (ssl.MemoryBIO の属性):        メモリ BIO サポート<2>.
                                                             (line  137)
* pending() (ssl.SSLSocket のメソッド):  SSL ソケット.       (line  333)
* PendingDeprecationWarning:             警告.               (line   28)
* pendown() (turtle モジュール):         描画状態.           (line    6)
* pensize() (turtle モジュール):         描画状態.           (line   18)
* penup() (turtle モジュール):           描画状態.           (line   12)
* PEP:                                   用語集<2>.          (line 1414)
* per-object lock:                       用語集<2>.          (line 1364)
* PERCENT (token モジュール):            token --- Python 解析木で使われる定数.
                                                             (line  254)
* PERCENTEQUAL (token モジュール):       token --- Python 解析木で使われる定数.
                                                             (line  302)
* perf_counter_ns() (time モジュール):   関数<5>.            (line  238)
* perf_counter() (time モジュール):      関数<5>.            (line  214)
* perm() (math モジュール):              Number-theoretic functions.
                                                             (line   60)
* PermissionError:                       OS 例外.            (line   97)
* permutations() (itertools モジュール): Itertool関数.       (line  434)
* persistent_id (pickle プロトコル):     外部オブジェクトの永続化.
                                                             (line    6)
* persistent_id() (pickle.Pickler のメソッド): モジュールインターフェース.
                                                             (line  167)
* persistent_load (pickle プロトコル):   外部オブジェクトの永続化.
                                                             (line    6)
* persistent_load() (pickle.Unpickler のメソッド): モジュールインターフェース.
                                                             (line  296)
* PF_CAN (socket モジュール):            定数<8>.            (line  134)
* PF_DIVERT (socket モジュール):         定数<8>.            (line  211)
* PF_PACKET (socket モジュール):         定数<8>.            (line  221)
* PF_RDS (socket モジュール):            定数<8>.            (line  243)
* pformat() (pprint モジュール):         関数<4>.            (line   74)
* pformat() (pprint.PrettyPrinter のメソッド): PrettyPrinter オブジェクト.
                                                             (line   50)
* pgettext() (gettext モジュール):       GNU gettext API.    (line   64)
* pgettext() (gettext.GNUTranslations のメソッド): GNUTranslations クラス.
                                                             (line   68)
* pgettext() (gettext.NullTranslations のメソッド): NullTranslations クラス.
                                                             (line   52)
* PGO (test.support モジュール):         test support --- Utilities for the Python test suite.
                                                             (line  124)
* phase() (cmath モジュール):            極座標変換.         (line   18)
* Philbrick, Geoff:                      拡張モジュール関数のキーワードパラメタ.
                                                             (line   24)
* pi (cmath モジュール):                 定数<3>.            (line    6)
* pi (math モジュール):                  定数<2>.            (line    6)
* pi() (xml.etree.ElementTree.TreeBuilder のメソッド): TreeBuilder オブジェクト.
                                                             (line   54)
* pickle コマンドラインオプション; pickle_file: コマンドライン・インターフェース.
                                                             (line   16)
* pickle 化;オブジェクト:                pickle --- Python オブジェクトの直列化.
                                                             (line    8)
* pickle() (copyreg モジュール):         copyreg --- pickle サポート関数を登録する.
                                                             (line   23)
* PickleBuffer (pickle のクラス):        モジュールインターフェース.
                                                             (line  327)
* PickleError:                           モジュールインターフェース.
                                                             (line   98)
* Pickler (pickle のクラス):             モジュールインターフェース.
                                                             (line  124)
* pickletools コマンドラインオプション; -a: コマンドラインオプション<6>.
                                                             (line    6)
* pickletools コマンドラインオプション; -annotate: コマンドラインオプション<6>.
                                                             (line    6)
* pickletools コマンドラインオプション; -indentlevel: コマンドラインオプション<6>.
                                                             (line   14)
* pickletools コマンドラインオプション; -l: コマンドラインオプション<6>.
                                                             (line   14)
* pickletools コマンドラインオプション; -m: コマンドラインオプション<6>.
                                                             (line   18)
* pickletools コマンドラインオプション; -memo: コマンドラインオプション<6>.
                                                             (line   18)
* pickletools コマンドラインオプション; -o: コマンドラインオプション<6>.
                                                             (line   10)
* pickletools コマンドラインオプション; -output: コマンドラインオプション<6>.
                                                             (line   10)
* pickletools コマンドラインオプション; -p: コマンドラインオプション<6>.
                                                             (line   23)
* pickletools コマンドラインオプション; -preamble: コマンドラインオプション<6>.
                                                             (line   23)
* pickletools コマンドラインオプション; pickle_file: コマンドラインオプション<6>.
                                                             (line   28)
* PicklingError:                         モジュールインターフェース.
                                                             (line  103)
* pid (asyncio.subprocess.Process の属性): サブプロセスとやりとりする.
                                                             (line  140)
* pid (multiprocessing.Process の属性):  Process クラスと例外.
                                                             (line  155)
* pid (subprocess.Popen の属性):         Popen オブジェクト. (line  152)
* PIDFD_NONBLOCK (os モジュール):        プロセス管理.       (line  375)
* pidfd_open() (os モジュール):          プロセス管理.       (line  362)
* pidfd_send_signal() (signal モジュール): モジュールの内容<2>.
                                                             (line  356)
* PIP_USER:                              Windows<50>.        (line  102)
* PIPE (subprocess モジュール):          Using the subprocess Module.
                                                             (line  150)
* PIPE_BUF (select モジュール):          select --- I/O 完了の待機.
                                                             (line  165)
* pipe_connection_lost() (asyncio.SubprocessProtocol のメソッド): サブプロセスプロトコル.
                                                             (line   19)
* pipe_data_received() (asyncio.SubprocessProtocol のメソッド): サブプロセスプロトコル.
                                                             (line   10)
* PIPE_MAX_SIZE (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  129)
* Pipe() (multiprocessing モジュール):   パイプ Pipe とキュー Queue.
                                                             (line   80)
* pipe() (os モジュール):                ファイル記述子の操作.
                                                             (line  490)
* pipe2() (os モジュール):               ファイル記述子の操作.
                                                             (line  500)
* Placeholder (functools モジュール):    functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  322)
* placeholder (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  273)
* platform (in module sys):              プロセスワイドのパラメータ.
                                                             (line  178)
* platform (sys モジュール):             sys --- システム固有のパラメーターと関数.
                                                             (line 1479)
* platform コマンドラインオプション; -nonaliased: コマンドラインでの使用<3>.
                                                             (line   19)
* platform コマンドラインオプション; -terse: コマンドラインでの使用<3>.
                                                             (line   13)
* platform() (platform モジュール):      Cross platform.     (line   47)
* platlibdir (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1551)
* PlaySound() (winsound モジュール):     winsound --- Windows 用の音声再生インターフェース.
                                                             (line   22)
* plist;ファイル:                        plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line    8)
* plock() (os モジュール):               プロセス管理.       (line  387)
* PLUS (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  224)
* plus() (decimal.Context のメソッド):   Context オブジェクト.
                                                             (line  448)
* PLUSEQUAL (token モジュール):          token --- Python 解析木で使われる定数.
                                                             (line  290)
* pm() (pdb モジュール):                 コマンドライン・インターフェース<8>.
                                                             (line  151)
* POINTER() (ctypes モジュール):         ユーティリティー関数.
                                                             (line  217)
* pointer() (ctypes モジュール):         ユーティリティー関数.
                                                             (line  230)
* polar() (cmath モジュール):            極座標変換.         (line   36)
* Policy (email.policy のクラス):        email policy Policy Objects.
                                                             (line  127)
* poll() (multiprocessing.connection.Connection のメソッド): Connection オブジェクト<2>.
                                                             (line   42)
* poll() (select モジュール):            select --- I/O 完了の待機.
                                                             (line   90)
* poll() (select.devpoll のメソッド):    /dev/poll ポーリングオブジェクト.
                                                             (line   65)
* poll() (select.epoll のメソッド):      エッジおよびレベルトリガポーリング epoll オブジェクト.
                                                             (line  103)
* poll() (select.poll のメソッド):       ポーリングオブジェクト.
                                                             (line   77)
* poll() (subprocess.Popen のメソッド):  Popen オブジェクト. (line    9)
* PollSelector (selectors のクラス):     クラス<4>.          (line  174)
* poly() (turtle モジュール):            特別な Turtle のメソッド.
                                                             (line    6)
* Pool (multiprocessing.pool のクラス):  プロセスプール.     (line    9)
* pop_all() (contextlib.ExitStack のメソッド): ユーティリティ.
                                                             (line  594)
* POP_BLOCK (opcode):                    Python バイトコード命令.
                                                             (line 1478)
* POP_EXCEPT (opcode):                   Python バイトコード命令.
                                                             (line  434)
* POP_ITER (opcode):                     Python バイトコード命令.
                                                             (line  146)
* POP_JUMP_IF_FALSE (opcode):            Python バイトコード命令.
                                                             (line  890)
* POP_JUMP_IF_NONE (opcode):             Python バイトコード命令.
                                                             (line  914)
* POP_JUMP_IF_NOT_NONE (opcode):         Python バイトコード命令.
                                                             (line  905)
* POP_JUMP_IF_TRUE (opcode):             Python バイトコード命令.
                                                             (line  875)
* pop_source() (shlex.shlex のメソッド): shlex オブジェクト. (line   63)
* POP_TOP (opcode):                      Python バイトコード命令.
                                                             (line  152)
* pop() (array.array のメソッド):        array --- 効率的な数値配列.
                                                             (line  217)
* pop() (collections.deque のメソッド):  deque オブジェクト. (line   87)
* pop() (dict のメソッド):               マッピング型 --- dict.
                                                             (line  197)
* pop() (mailbox.Mailbox のメソッド):    Mailbox オブジェクト.
                                                             (line  212)
* pop() (sequence のメソッド):           ミュータブルなシーケンス型.
                                                             (line  103)
* pop() (set のメソッド):                set（集合）型 --- set frozenset.
                                                             (line  211)
* POP3 (poplib のクラス):                poplib --- POP3 プロトコルクライアント.
                                                             (line   34)
* POP3_SSL (poplib のクラス):            poplib --- POP3 プロトコルクライアント.
                                                             (line   53)
* POP3;プロトコル:                       poplib --- POP3 プロトコルクライアント.
                                                             (line    8)
* Popen (subprocess のクラス):           Popen コンストラクター.
                                                             (line   11)
* popen() (os モジュール):               I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* popen() (os モジュール) <1>:           プロセス管理.       (line  395)
* popen() (os モジュール) <2>:           select --- I/O 完了の待機.
                                                             (line  145)
* popitem() (collections.OrderedDict のメソッド): OrderedDict オブジェクト.
                                                             (line   66)
* popitem() (dict のメソッド):           マッピング型 --- dict.
                                                             (line  206)
* popitem() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  220)
* popleft() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   93)
* port (http.cookiejar.Cookie の属性):   Cookieオブジェクト<2>.
                                                             (line   35)
* port_specified (http.cookiejar.Cookie の属性): Cookieオブジェクト<2>.
                                                             (line   81)
* portion:                               用語集<2>.          (line 1428)
* pos (json.JSONDecodeError の属性):     例外<20>.           (line   18)
* pos (re.Match の属性):                 マッチオブジェクト. (line  171)
* pos (re.PatternError の属性):          例外<3>.            (line   23)
* pos (tomllib.TOMLDecodeError の属性):  tomllib --- TOML ファイルの解析.
                                                             (line   73)
* pos() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  150)
* pos() (turtle モジュール):             Turtle の状態を知る.
                                                             (line    6)
* position (xml.etree.ElementTree.ParseError の属性): 例外<22>.
                                                             (line   18)
* position() (turtle モジュール):        Turtle の状態を知る.
                                                             (line    6)
* Positions (dis のクラス):              Python バイトコード命令.
                                                             (line  110)
* positions (inspect.FrameInfo の属性):  インタープリタスタック.
                                                             (line   41)
* positions (inspect.Traceback の属性):  インタープリタスタック.
                                                             (line   81)
* Positions.col_offset (dis モジュール): Python バイトコード命令.
                                                             (line  119)
* Positions.end_col_offset (dis モジュール): Python バイトコード命令.
                                                             (line  121)
* Positions.end_lineno (dis モジュール): Python バイトコード命令.
                                                             (line  117)
* Positions.lineno (dis モジュール):     Python バイトコード命令.
                                                             (line  115)
* POSIX Shared Memory:                   multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line   10)
* POSIX_FADV_DONTNEED (os モジュール):   ファイル記述子の操作.
                                                             (line  534)
* POSIX_FADV_NOREUSE (os モジュール):    ファイル記述子の操作.
                                                             (line  534)
* POSIX_FADV_NORMAL (os モジュール):     ファイル記述子の操作.
                                                             (line  534)
* POSIX_FADV_RANDOM (os モジュール):     ファイル記述子の操作.
                                                             (line  534)
* POSIX_FADV_SEQUENTIAL (os モジュール): ファイル記述子の操作.
                                                             (line  534)
* POSIX_FADV_WILLNEED (os モジュール):   ファイル記述子の操作.
                                                             (line  534)
* posix_fadvise() (os モジュール):       ファイル記述子の操作.
                                                             (line  520)
* posix_fallocate() (os モジュール):     ファイル記述子の操作.
                                                             (line  511)
* posix_openpt() (os モジュール):        ファイル記述子の操作.
                                                             (line  560)
* POSIX_SPAWN_CLOSE (os モジュール):     プロセス管理.       (line  466)
* POSIX_SPAWN_CLOSEFROM (os モジュール): プロセス管理.       (line  478)
* POSIX_SPAWN_DUP2 (os モジュール):      プロセス管理.       (line  472)
* POSIX_SPAWN_OPEN (os モジュール):      プロセス管理.       (line  460)
* posix_spawn() (os モジュール):         プロセス管理.       (line  436)
* posix_spawnp() (os モジュール):        プロセス管理.       (line  539)
* POSIX;I/O control:                     termios --- POSIX スタイルの端末制御.
                                                             (line    6)
* PosixPath (pathlib のクラス):          具象パス.           (line   21)
* post_handshake_auth (ssl.SSLContext の属性): SSL コンテキスト.
                                                             (line  589)
* post_mortem() (pdb モジュール):        コマンドライン・インターフェース<8>.
                                                             (line  141)
* post_setup() (venv.EnvBuilder のメソッド): API<2>.         (line  170)
* postcmd() (cmd.Cmd のメソッド):        Cmdオブジェクト.    (line  103)
* postloop() (cmd.Cmd のメソッド):       Cmdオブジェクト.    (line  119)
* Pow (ast のクラス):                    式 expression<2>.   (line   55)
* pow() (math モジュール):               Power exponential and logarithmic functions.
                                                             (line   70)
* pow() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  155)
* power;演算:                            べき乗演算 power operator.
                                                             (line    6)
* power() (decimal.Context のメソッド):  Context オブジェクト.
                                                             (line  454)
* pp (pdb command):                      Debugger commands.  (line  281)
* pp() (pprint モジュール):              関数<4>.            (line    6)
* pprint() (pprint モジュール):          関数<4>.            (line   65)
* pprint() (pprint.PrettyPrinter のメソッド): PrettyPrinter オブジェクト.
                                                             (line   56)
* prcal() (calendar モジュール):         calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  400)
* pread() (os モジュール):               ファイル記述子の操作.
                                                             (line  548)
* preadv() (os モジュール):              ファイル記述子の操作.
                                                             (line  578)
* preamble (email.message.EmailMessage の属性): email message Representing an email message.
                                                             (line  681)
* preamble (email.message.Message の属性): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  700)
* prec (decimal.Context の属性):         Context オブジェクト.
                                                             (line  126)
* precmd() (cmd.Cmd のメソッド):         Cmdオブジェクト.    (line   93)
* prefix (sys モジュール):               sys --- システム固有のパラメーターと関数.
                                                             (line 1576)
* prefix (xml.dom.Attr の属性):          Attr オブジェクト.  (line   18)
* prefix (xml.dom.Node の属性):          Node オブジェクト.  (line   68)
* prefix (zipimport.zipimporter の属性): zipimporter オブジェクト.
                                                             (line  101)
* PREFIXES (site モジュール):            モジュールの内容<5>.
                                                             (line    6)
* prefixlen (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line  132)
* prefixlen (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  331)
* preloop() (cmd.Cmd のメソッド):        Cmdオブジェクト.    (line  113)
* prepare_class() (types モジュール):    動的な型生成.       (line   21)
* prepare_input_source() (xml.sax.saxutils モジュール): xml sax saxutils --- SAX ユーティリティー.
                                                             (line   78)
* prepare_main() (concurrent.interpreters.Interpreter のメソッド): Interpreter objects.
                                                             (line   35)
* prepare() (graphlib.TopologicalSorter のメソッド): graphlib --- グラフ構造を操作する機能.
                                                             (line   97)
* prepare() (logging.handlers.QueueHandler のメソッド): QueueHandler.
                                                             (line   53)
* prepare() (logging.handlers.QueueListener のメソッド): QueueListener.
                                                             (line   65)
* PrepareProtocol (sqlite3 のクラス):    PrepareProtocol オブジェクト.
                                                             (line    6)
* PrettyPrinter (pprint のクラス):       PrettyPrinter オブジェクト.
                                                             (line    6)
* prev() (tkinter.ttk.Treeview のメソッド): ttk Treeview.    (line  231)
* previousSibling (xml.dom.Node の属性): Node オブジェクト.  (line   32)
* print_call_graph() (asyncio モジュール): Call Graph Introspection.
                                                             (line   17)
* print_callees() (pstats.Stats のメソッド): Stats クラス.   (line  204)
* print_callers() (pstats.Stats のメソッド): Stats クラス.   (line  185)
* print_exc() (timeit.Timer のメソッド): Python インターフェイス.
                                                             (line  125)
* print_exc() (traceback モジュール):    モジュールレベルの関数<2>.
                                                             (line   57)
* print_exception() (traceback モジュール): モジュールレベルの関数<2>.
                                                             (line   24)
* print_function (__future__ モジュール): モジュールコンテンツ<5>.
                                                             (line   35)
* print_help() (argparse.ArgumentParser のメソッド): ヘルプの表示.
                                                             (line   16)
* print_last() (traceback モジュール):   モジュールレベルの関数<2>.
                                                             (line   62)
* print_list() (traceback モジュール):   モジュールレベルの関数<2>.
                                                             (line   99)
* print_stack() (asyncio.Task のメソッド): Task オブジェクト.
                                                             (line  143)
* print_stack() (traceback モジュール):  モジュールレベルの関数<2>.
                                                             (line   68)
* print_stats() (profile.Profile のメソッド): profile and cProfile Module Reference.
                                                             (line   89)
* print_stats() (pstats.Stats のメソッド): Stats クラス.     (line  155)
* print_tb() (traceback モジュール):     モジュールレベルの関数<2>.
                                                             (line    6)
* print_usage() (argparse.ArgumentParser のメソッド): ヘルプの表示.
                                                             (line   10)
* print_usage() (optparse.OptionParser のメソッド): その他のメソッド.
                                                             (line   15)
* print_version() (optparse.OptionParser のメソッド): バージョン番号の出力.
                                                             (line   25)
* print_warning() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  437)
* print() (traceback.TracebackException のメソッド): TracebackException オブジェクト.
                                                             (line  133)
* print() (組み込み関数);__str__() (オブジェクトメソッド): 基本的なカスタマイズ.
                                                             (line  128)
* printable (string モジュール):         文字列定数.         (line   40)
* printdir() (zipfile.ZipFile のメソッド): ZipFile objects.  (line  246)
* printf 形式の書式化:                   printf 形式の文字列書式化.
                                                             (line    6)
* printf 形式の書式化 <1>:               printf 形式での bytes の書式化.
                                                             (line    6)
* PRIO_DARWIN_BG (os モジュール):        プロセスのパラメーター.
                                                             (line  321)
* PRIO_DARWIN_NONUI (os モジュール):     プロセスのパラメーター.
                                                             (line  321)
* PRIO_DARWIN_PROCESS (os モジュール):   プロセスのパラメーター.
                                                             (line  321)
* PRIO_DARWIN_THREAD (os モジュール):    プロセスのパラメーター.
                                                             (line  321)
* PRIO_PGRP (os モジュール):             プロセスのパラメーター.
                                                             (line  310)
* PRIO_PROCESS (os モジュール):          プロセスのパラメーター.
                                                             (line  310)
* PRIO_USER (os モジュール):             プロセスのパラメーター.
                                                             (line  310)
* PriorityQueue (asyncio のクラス):      優先度付きのキュー. (line    6)
* PriorityQueue (queue のクラス):        queue --- 同期キュークラス.
                                                             (line   46)
* prlimit() (resource モジュール):       リソースの制限.     (line   58)
* prmonth() (calendar モジュール):       calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  390)
* prmonth() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  195)
* ProactorEventLoop (asyncio のクラス):  イベントループの実装.
                                                             (line   30)
* procedure;call:                        式文 expression statement.
                                                             (line   16)
* Process (multiprocessing のクラス):    Process クラスと例外.
                                                             (line    6)
* process_cpu_count() (os モジュール):   雑多なシステム情報. (line   57)
* process_exited() (asyncio.SubprocessProtocol のメソッド): サブプロセスプロトコル.
                                                             (line   26)
* process_request() (socketserver.BaseServer のメソッド): Serverオブジェクト<2>.
                                                             (line  154)
* process_time_ns() (time モジュール):   関数<5>.            (line  257)
* process_time() (time モジュール):      関数<5>.            (line  245)
* process_tokens() (tabnanny モジュール): tabnanny --- あいまいなインデントの検出.
                                                             (line   43)
* process;id:                            プロセスのパラメーター.
                                                             (line  279)
* process;kill:                          プロセス管理.       (line  326)
* process;kill <1>:                      プロセス管理.       (line  348)
* process;グループ:                      プロセスのパラメーター.
                                                             (line  214)
* process;グループ <1>:                  プロセスのパラメーター.
                                                             (line  273)
* process;シグナル:                      プロセス管理.       (line  326)
* process;シグナル <1>:                  プロセス管理.       (line  348)
* process;スケジューリング優先度:        プロセスのパラメーター.
                                                             (line  297)
* process;スケジューリング優先度 <1>:    プロセスのパラメーター.
                                                             (line  487)
* process;親の ID:                       プロセスのパラメーター.
                                                             (line  286)
* process() (logging.LoggerAdapter のメソッド): LoggerAdapter オブジェクト.
                                                             (line   22)
* ProcessError:                          Process クラスと例外.
                                                             (line  280)
* processes, light-weight:               _thread --- 低水準なスレッド API.
                                                             (line    6)
* ProcessingInstruction() (xml.etree.ElementTree モジュール): 関数<9>.
                                                             (line  181)
* processingInstruction() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line  156)
* ProcessingInstructionHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  314)
* ProcessLookupError:                    OS 例外.            (line  106)
* processor() (platform モジュール):     Cross platform.     (line   68)
* ProcessPoolExecutor (concurrent.futures のクラス): ProcessPoolExecutor.
                                                             (line   27)
* prod() (math モジュール):              Summation and product functions.
                                                             (line   48)
* product() (itertools モジュール):      Itertool関数.       (line  485)
* Profile (profile のクラス):            profile and cProfile Module Reference.
                                                             (line   34)
* profile function:                      リファレンス<2>.    (line  135)
* profile function <1>:                  リファレンス<2>.    (line  151)
* profile function <2>:                  sys --- システム固有のパラメーターと関数.
                                                             (line  959)
* profile function <3>:                  sys --- システム固有のパラメーターと関数.
                                                             (line 1630)
* PROFILE_TASK:                          ビルド<22>.         (line   13)
* PROFILE_TASK <1>:                      パフォーマンスに関するオプション.
                                                             (line   12)
* profiler:                              sys --- システム固有のパラメーターと関数.
                                                             (line  959)
* profiler <1>:                          sys --- システム固有のパラメーターと関数.
                                                             (line 1630)
* profiling, deterministic:              プロファイラとは.   (line    6)
* ProgrammingError:                      例外<7>.            (line   75)
* Progressbar (tkinter.ttk のクラス):    ttk Progressbar.    (line    6)
* prompt (cmd.Cmd の属性):               Cmdオブジェクト.    (line  128)
* prompts, interpreter:                  sys --- システム固有のパラメーターと関数.
                                                             (line 1601)
* propagate (logging.Logger の属性):     ロガーオブジェクト. (line   50)
* property (組み込みクラス):             組み込み関数.       (line 1593)
* property list:                         plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line    8)
* property_declaration_handler (xml.sax.handler モジュール): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line  110)
* property_dom_node (xml.sax.handler モジュール): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line  117)
* property_lexical_handler (xml.sax.handler モジュール): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line  103)
* property_xml_string (xml.sax.handler モジュール): xml sax handler --- SAX ハンドラーの基底クラス.
                                                             (line  124)
* property() (enum モジュール):          ユーティリティとデコレータ.
                                                             (line   41)
* PropertyMock (unittest.mock のクラス): Mock クラス.        (line  640)
* prot_c() (ftplib.FTP_TLS のメソッド):  FTP_TLS オブジェクト.
                                                             (line  111)
* prot_p() (ftplib.FTP_TLS のメソッド):  FTP_TLS オブジェクト.
                                                             (line  107)
* proto (socket.socket の属性):          socket オブジェクト.
                                                             (line  614)
* Protocol (asyncio のクラス):           基底プロトコル.     (line   11)
* protocol (ssl.SSLContext の属性):      SSL コンテキスト.   (line  608)
* Protocol (typing のクラス):            Other special directives.
                                                             (line  138)
* PROTOCOL_SSLv23 (ssl モジュール):      定数<9>.            (line  161)
* PROTOCOL_SSLv3 (ssl モジュール):       定数<9>.            (line  168)
* PROTOCOL_TLS (ssl モジュール):         定数<9>.            (line  131)
* PROTOCOL_TLS_CLIENT (ssl モジュール):  定数<9>.            (line  144)
* PROTOCOL_TLS_SERVER (ssl モジュール):  定数<9>.            (line  153)
* PROTOCOL_TLSv1 (ssl モジュール):       定数<9>.            (line  184)
* PROTOCOL_TLSv1_1 (ssl モジュール):     定数<9>.            (line  191)
* PROTOCOL_TLSv1_2 (ssl モジュール):     定数<9>.            (line  201)
* protocol_version (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  210)
* PROTOCOL_VERSION (imaplib.IMAP4 の属性): IMAP4 オブジェクト.
                                                             (line  484)
* ProtocolError (xmlrpc.client のクラス): ProtocolError オブジェクト.
                                                             (line    6)
* provisional API:                       用語集<2>.          (line 1438)
* provisional package:                   用語集<2>.          (line 1455)
* proxy() (weakref モジュール):          weakref --- Weak references.
                                                             (line  128)
* proxyauth() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  280)
* ProxyBasicAuthHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  417)
* ProxyDigestAuthHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  452)
* ProxyHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  345)
* ProxyType (weakref モジュール):        weakref --- Weak references.
                                                             (line  326)
* ProxyTypes (weakref モジュール):       weakref --- Weak references.
                                                             (line  334)
* pryear() (calendar.TextCalendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  209)
* ps1 (sys モジュール):                  sys --- システム固有のパラメーターと関数.
                                                             (line 1598)
* ps2 (sys モジュール):                  sys --- システム固有のパラメーターと関数.
                                                             (line 1598)
* pstdev() (statistics モジュール):      関数の詳細.         (line  362)
* pthread_getcpuclockid() (time モジュール): 関数<5>.        (line   21)
* pthread_kill() (signal モジュール):    モジュールの内容<2>.
                                                             (line  371)
* pthread_sigmask() (signal モジュール): モジュールの内容<2>.
                                                             (line  401)
* pthreads:                              _thread --- 低水準なスレッド API.
                                                             (line   15)
* pthreads (sys._emscripten_info の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  352)
* ptsname() (os モジュール):             ファイル記述子の操作.
                                                             (line  637)
* pu() (turtle モジュール):              描画状態.           (line   12)
* publicId (xml.dom.DocumentType の属性): DocumentType オブジェクト.
                                                             (line   16)
* PullDOM (xml.dom.pulldom のクラス):    xml dom pulldom --- 部分的な DOM ツリー構築のサポート.
                                                             (line   75)
* punctuation (string モジュール):       文字列定数.         (line   35)
* punctuation_chars (shlex.shlex の属性): shlex オブジェクト.
                                                             (line  182)
* PurePath (pathlib のクラス):           純粋パス.           (line   10)
* PurePosixPath (pathlib のクラス):      純粋パス.           (line   74)
* PureWindowsPath (pathlib のクラス):    純粋パス.           (line   84)
* purge() (re モジュール):               関数<2>.            (line  282)
* Purpose.CLIENT_AUTH (ssl モジュール):  定数<9>.            (line  547)
* Purpose.SERVER_AUTH (ssl モジュール):  定数<9>.            (line  538)
* push_async_callback() (contextlib.AsyncExitStack のメソッド): ユーティリティ.
                                                             (line  645)
* push_async_exit() (contextlib.AsyncExitStack のメソッド): ユーティリティ.
                                                             (line  640)
* PUSH_EXC_INFO (opcode):                Python バイトコード命令.
                                                             (line  453)
* PUSH_NULL (opcode):                    Python バイトコード命令.
                                                             (line 1142)
* push_source() (shlex.shlex のメソッド): shlex オブジェクト.
                                                             (line   56)
* push_token() (shlex.shlex のメソッド): shlex オブジェクト. (line   16)
* push() (code.InteractiveConsole のメソッド): 対話的なコンソールオブジェクト.
                                                             (line   29)
* push() (contextlib.ExitStack のメソッド): ユーティリティ.  (line  563)
* put_nowait() (asyncio.Queue のメソッド): Queue.            (line   72)
* put_nowait() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  150)
* put_nowait() (queue.Queue のメソッド): キューオブジェクト. (line   42)
* put_nowait() (queue.SimpleQueue のメソッド): SimpleQueue オブジェクト.
                                                             (line   36)
* put() (asyncio.Queue のメソッド):      Queue.              (line   64)
* put() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  134)
* put() (multiprocessing.SimpleQueue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  252)
* put() (queue.Queue のメソッド):        キューオブジェクト. (line   29)
* put() (queue.SimpleQueue のメソッド):  SimpleQueue オブジェクト.
                                                             (line   21)
* putch() (msvcrt モジュール):           コンソール I/O 関連.
                                                             (line   34)
* putenv() (os モジュール):              プロセスのパラメーター.
                                                             (line  370)
* putheader() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  184)
* putp() (curses モジュール):            関数<6>.            (line  397)
* putrequest() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  174)
* putwch() (msvcrt モジュール):          コンソール I/O 関連.
                                                             (line   39)
* putwin() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  452)
* pvariance() (statistics モジュール):   関数の詳細.         (line  370)
* pwd() (ftplib.FTP のメソッド):         FTP オブジェクト.   (line  342)
* pwrite() (os モジュール):              ファイル記述子の操作.
                                                             (line  651)
* pwritev() (os モジュール):             ファイル記述子の操作.
                                                             (line  662)
* Py_ABS (C macro):                      Numeric utilities.  (line    6)
* Py_AddPendingCall (C function):        非同期通知.         (line   10)
* Py_ALIGNED (C macro):                  Outdated macros.    (line    9)
* Py_ALWAYS_INLINE (C macro):            Declaration utilities.
                                                             (line   11)
* Py_am_aiter (C macro):                 async オブジェクト構造体.
                                                             (line   44)
* Py_am_anext (C macro):                 async オブジェクト構造体.
                                                             (line   60)
* Py_am_await (C macro):                 async オブジェクト構造体.
                                                             (line   27)
* Py_am_send (C macro):                  async オブジェクト構造体.
                                                             (line   73)
* Py_ARITHMETIC_RIGHT_SHIFT (C macro):   Numeric utilities.  (line   32)
* Py_ARRAY_LENGTH (C macro):             Type size utilities.
                                                             (line    6)
* Py_ASNATIVEBYTES_ALLOW_INDEX (C macro): 整数型オブジェクト integer object.
                                                             (line  539)
* Py_ASNATIVEBYTES_BIG_ENDIAN (C macro): 整数型オブジェクト integer object.
                                                             (line  517)
* Py_ASNATIVEBYTES_DEFAULTS (C macro):   整数型オブジェクト integer object.
                                                             (line  513)
* Py_ASNATIVEBYTES_LITTLE_ENDIAN (C macro): 整数型オブジェクト integer object.
                                                             (line  521)
* Py_ASNATIVEBYTES_NATIVE_ENDIAN (C macro): 整数型オブジェクト integer object.
                                                             (line  525)
* Py_ASNATIVEBYTES_REJECT_NEGATIVE (C macro): 整数型オブジェクト integer object.
                                                             (line  534)
* Py_ASNATIVEBYTES_UNSIGNED_BUFFER (C macro): 整数型オブジェクト integer object.
                                                             (line  529)
* Py_AtExit (C function):                プロセス制御.       (line   32)
* Py_AUDIT_READ (C macro):               Member flags.       (line   12)
* Py_AuditHookFunction (C type):         システム関数.       (line  149)
* Py_BEGIN_ALLOW_THREADS (C macro):      Detaching the thread state from extension code.
                                                             (line   20)
* Py_BEGIN_ALLOW_THREADS (C macro) <1>:  高レベルAPI.        (line  211)
* Py_BEGIN_CRITICAL_SECTION (C macro):   Python Critical Section API.
                                                             (line   64)
* Py_BEGIN_CRITICAL_SECTION_MUTEX (C macro): Python Critical Section API.
                                                             (line   79)
* Py_BEGIN_CRITICAL_SECTION2 (C macro):  Python Critical Section API.
                                                             (line  110)
* Py_BEGIN_CRITICAL_SECTION2_MUTEX (C macro): Python Critical Section API.
                                                             (line  126)
* Py_bf_getbuffer (C macro):             バッファオブジェクト構造体 buffer object structure.
                                                             (line   17)
* Py_bf_releasebuffer (C macro):         バッファオブジェクト構造体 buffer object structure.
                                                             (line   71)
* Py_BLOCK_THREADS (C macro):            高レベルAPI.        (line  225)
* Py_buffer (C type):                    buffer 構造体.      (line   23)
* Py_buffer.buf (C member):              buffer 構造体.      (line   25)
* Py_buffer.format (C member):           buffer 構造体.      (line   86)
* Py_buffer.internal (C member):         buffer 構造体.      (line  147)
* Py_buffer.itemsize (C member):         buffer 構造体.      (line   66)
* Py_buffer.len (C member):              buffer 構造体.      (line   49)
* Py_buffer.ndim (C member):             buffer 構造体.      (line   95)
* Py_buffer.obj (C member):              buffer 構造体.      (line   36)
* Py_buffer.readonly (C member):         buffer 構造体.      (line   61)
* Py_buffer.shape (C member):            buffer 構造体.      (line  104)
* Py_buffer.strides (C member):          buffer 構造体.      (line  117)
* Py_buffer.suboffsets (C member):       buffer 構造体.      (line  129)
* Py_BUILD_ASSERT (C macro):             Assertion utilities.
                                                             (line   51)
* Py_BUILD_ASSERT_EXPR (C macro):        Assertion utilities.
                                                             (line   65)
* Py_BuildValue (C function):            値の構築.           (line    6)
* Py_BytesMain (C function):             インタープリタの初期化と終了処理.
                                                             (line  126)
* Py_BytesWarningFlag (C var):           グローバルな設定変数.
                                                             (line   15)
* Py_CAN_START_THREADS (C macro):        便利なマクロ.       (line   12)
* Py_CHARMASK (C macro):                 Numeric utilities.  (line   53)
* Py_CLEANUP_SUPPORTED (C macro):        その他のオブジェクト.
                                                             (line   38)
* Py_CLEAR (C function):                 参照カウント.       (line  158)
* Py_CompileString (C function):         超高水準レイヤ.     (line  221)
* Py_CompileString (C function) <1>:     Available start symbols.
                                                             (line    8)
* Py_CompileString (C function) <2>:     Available start symbols.
                                                             (line   13)
* Py_CompileString (C function) <3>:     Available start symbols.
                                                             (line   20)
* Py_CompileString (C function) <4>:     Available start symbols.
                                                             (line   26)
* Py_CompileStringExFlags (C function):  超高水準レイヤ.     (line  252)
* Py_CompileStringFlags (C function):    超高水準レイヤ.     (line  227)
* Py_CompileStringObject (C function):   超高水準レイヤ.     (line  232)
* Py_complex (C type):                   C 構造体としての複素数.
                                                             (line   10)
* Py_complex.imag (C member):            C 構造体としての複素数.
                                                             (line   17)
* Py_complex.real (C member):            C 構造体としての複素数.
                                                             (line   17)
* Py_CONSTANT_ELLIPSIS (C macro):        オブジェクトプロトコル object protocol.
                                                             (line   28)
* Py_CONSTANT_EMPTY_BYTES (C macro):     オブジェクトプロトコル object protocol.
                                                             (line   43)
* Py_CONSTANT_EMPTY_STR (C macro):       オブジェクトプロトコル object protocol.
                                                             (line   40)
* Py_CONSTANT_EMPTY_TUPLE (C macro):     オブジェクトプロトコル object protocol.
                                                             (line   46)
* Py_CONSTANT_FALSE (C macro):           オブジェクトプロトコル object protocol.
                                                             (line   22)
* Py_CONSTANT_NONE (C macro):            オブジェクトプロトコル object protocol.
                                                             (line   19)
* Py_CONSTANT_NOT_IMPLEMENTED (C macro): オブジェクトプロトコル object protocol.
                                                             (line   31)
* Py_CONSTANT_ONE (C macro):             オブジェクトプロトコル object protocol.
                                                             (line   37)
* Py_CONSTANT_TRUE (C macro):            オブジェクトプロトコル object protocol.
                                                             (line   25)
* Py_CONSTANT_ZERO (C macro):            オブジェクトプロトコル object protocol.
                                                             (line   34)
* PY_CXX_CONST (C macro):                API 関数.           (line  111)
* Py_DEBUG (C macro):                    デバッグ版ビルド Debugging Builds.
                                                             (line   17)
* Py_DEBUG (test.support モジュール):    test support --- Utilities for the Python test suite.
                                                             (line  134)
* Py_DebugFlag (C var):                  グローバルな設定変数.
                                                             (line   30)
* Py_DecodeLocale (C function):          オペレーティングシステム関連のユーティリティ.
                                                             (line  131)
* Py_DECREF (C function):                参照カウント法<2>.  (line   18)
* Py_DECREF (C function) <1>:            参照カウント.       (line  116)
* Py_DecRef (C function):                参照カウント.       (line  181)
* Py_DEPRECATED (C macro):               Declaration utilities.
                                                             (line   54)
* Py_DontWriteBytecodeFlag (C var):      グローバルな設定変数.
                                                             (line   44)
* Py_DTSF_ADD_DOT_0 (C macro):           文字列の変換と書式化.
                                                             (line  129)
* Py_DTSF_ALT (C macro):                 文字列の変換と書式化.
                                                             (line  133)
* Py_DTSF_NO_NEG_0 (C macro):            文字列の変換と書式化.
                                                             (line  138)
* Py_DTSF_SIGN (C macro):                文字列の変換と書式化.
                                                             (line  124)
* Py_DTST_FINITE (C macro):              文字列の変換と書式化.
                                                             (line  151)
* Py_DTST_INFINITE (C macro):            文字列の変換と書式化.
                                                             (line  154)
* Py_DTST_NAN (C macro):                 文字列の変換と書式化.
                                                             (line  157)
* Py_Ellipsis (C var):                   Ellipsis オブジェクト<2>.
                                                             (line   11)
* Py_EncodeLocale (C function):          オペレーティングシステム関連のユーティリティ.
                                                             (line  185)
* Py_END_ALLOW_THREADS (C macro):        Detaching the thread state from extension code.
                                                             (line   20)
* Py_END_ALLOW_THREADS (C macro) <1>:    高レベルAPI.        (line  218)
* Py_END_CRITICAL_SECTION (C macro):     Python Critical Section API.
                                                             (line   97)
* Py_END_CRITICAL_SECTION2 (C macro):    Python Critical Section API.
                                                             (line  144)
* Py_EndInterpreter (C function):        サブインタプリタサポート.
                                                             (line  206)
* Py_EnterRecursiveCall (C function):    再帰の管理.         (line   13)
* Py_EQ (C macro):                       PyTypeObject スロット.
                                                             (line 1280)
* Py_eval_input (C var):                 Available start symbols.
                                                             (line    6)
* Py_Exit (C function):                  プロセス制御.       (line   22)
* Py_ExitStatusException (C function):   PyStatus.           (line   63)
* Py_EXPORTED_SYMBOL (C macro):          Declaration utilities.
                                                             (line   85)
* Py_False (C var):                      Boolean オブジェクト.
                                                             (line   21)
* Py_FatalError (C function):            プロセス制御.       (line    6)
* Py_FatalError():                       プロセスワイドのパラメータ.
                                                             (line  223)
* Py_fclose (C function):                オペレーティングシステム関連のユーティリティ.
                                                             (line  249)
* Py_FdIsInteractive (C function):       オペレーティングシステム関連のユーティリティ.
                                                             (line   18)
* Py_file_input (C var):                 Available start symbols.
                                                             (line   11)
* Py_Finalize (C function):              インタープリタの初期化と終了処理.
                                                             (line  121)
* Py_FinalizeEx (C function):            プロセス制御.       (line   23)
* Py_FinalizeEx (C function) <1>:        プロセス制御.       (line   33)
* Py_FinalizeEx (C function) <2>:        インタープリタの初期化と終了処理.
                                                             (line    7)
* Py_FinalizeEx (C function) <3>:        インタープリタの初期化と終了処理.
                                                             (line   64)
* Py_FinalizeEx (C function) <4>:        サブインタプリタサポート.
                                                             (line  169)
* Py_FinalizeEx (C function) <5>:        サブインタプリタサポート.
                                                             (line  207)
* Py_fopen (C function):                 オペレーティングシステム関連のユーティリティ.
                                                             (line  229)
* Py_FORCE_EXPANSION (C macro):          Macro definition utilities.
                                                             (line    6)
* Py_FrozenFlag (C var):                 グローバルな設定変数.
                                                             (line   58)
* Py_func_type_input (C var):            Available start symbols.
                                                             (line   24)
* Py_GCC_ATTRIBUTE (C macro):            General utility macros.
                                                             (line   15)
* Py_GE (C macro):                       PyTypeObject スロット.
                                                             (line 1289)
* Py_GenericAlias (C function):          型ヒントのためのオブジェクト.
                                                             (line   10)
* Py_GenericAliasType (C var):           型ヒントのためのオブジェクト.
                                                             (line   43)
* Py_GetArgcArgv (C function):           Py_GetArgcArgv.     (line    6)
* Py_GetBuildInfo (C function):          プロセスワイドのパラメータ.
                                                             (line  210)
* Py_GetCompiler (C function):           プロセスワイドのパラメータ.
                                                             (line  199)
* Py_GetConstant (C function):           オブジェクトプロトコル object protocol.
                                                             (line    6)
* Py_GetConstantBorrowed (C function):   オブジェクトプロトコル object protocol.
                                                             (line   57)
* Py_GetCopyright (C function):          プロセスワイドのパラメータ.
                                                             (line  189)
* Py_GETENV (C macro):                   便利なマクロ.       (line   23)
* Py_GetExecPrefix (C function):         Python の埋め込み<2>.
                                                             (line   39)
* Py_GetExecPrefix (C function) <1>:     プロセスワイドのパラメータ.
                                                             (line   70)
* Py_GetPath (C function):               Python の埋め込み<2>.
                                                             (line   39)
* Py_GetPath (C function) <1>:           プロセスワイドのパラメータ.
                                                             (line  139)
* Py_GetPath():                          プロセスワイドのパラメータ.
                                                             (line    7)
* Py_GetPlatform (C function):           プロセスワイドのパラメータ.
                                                             (line  177)
* Py_GetPrefix (C function):             Python の埋め込み<2>.
                                                             (line   39)
* Py_GetPrefix (C function) <1>:         プロセスワイドのパラメータ.
                                                             (line   45)
* Py_GetProgramFullPath (C function):    Python の埋め込み<2>.
                                                             (line   39)
* Py_GetProgramFullPath (C function) <1>: プロセスワイドのパラメータ.
                                                             (line  119)
* Py_GetProgramName (C function):        プロセスワイドのパラメータ.
                                                             (line   29)
* Py_GetPythonHome (C function):         プロセスワイドのパラメータ.
                                                             (line  311)
* Py_GetRecursionLimit (C function):     再帰の管理.         (line   71)
* Py_GetVersion (C function):            プロセスワイドのパラメータ.
                                                             (line  163)
* Py_GT (C macro):                       PyTypeObject スロット.
                                                             (line 1286)
* Py_HASH_ALGORITHM (C macro):           PyHash API.         (line   21)
* Py_HASH_CUTOFF (C macro):              PyHash API.         (line   44)
* Py_HASH_FNV (C macro):                 PyHash API.         (line   31)
* Py_HASH_SIPHASH13 (C macro):           PyHash API.         (line   31)
* Py_HASH_SIPHASH24 (C macro):           PyHash API.         (line   31)
* Py_hash_t (C type):                    PyHash API.         (line    9)
* Py_HashBuffer (C function):            PyHash API.         (line  153)
* Py_HashPointer (C function):           PyHash API.         (line  144)
* Py_HashRandomizationFlag (C var):      グローバルな設定変数.
                                                             (line   72)
* PY_HAVE_THREAD_NATIVE_ID (C macro):    Operating System Thread APIs.
                                                             (line   50)
* Py_hexdigits (C var):                  Codec utility variables.
                                                             (line    6)
* Py_HUGE_VAL (C macro):                 Floating-Point Objects.
                                                             (line   84)
* Py_IgnoreEnvironmentFlag (C var):      グローバルな設定変数.
                                                             (line   87)
* Py_IMPORTED_SYMBOL (C macro):          Declaration utilities.
                                                             (line   93)
* Py_INCREF (C function):                参照カウント法<2>.  (line   18)
* Py_INCREF (C function) <1>:            参照カウント.       (line   52)
* Py_IncRef (C function):                参照カウント.       (line  175)
* Py_INFINITY (C macro):                 Floating-Point Objects.
                                                             (line   68)
* Py_Initialize (C function):            Python の埋め込み<2>.
                                                             (line   11)
* Py_Initialize (C function) <1>:        インタープリタの初期化と終了処理.
                                                             (line    6)
* Py_Initialize (C function) <2>:        サブインタプリタサポート.
                                                             (line  169)
* Py_Initialize():                       プロセスワイドのパラメータ.
                                                             (line    7)
* Py_InitializeEx (C function):          インタープリタの初期化と終了処理.
                                                             (line   30)
* Py_InitializeFromConfig (C function):  インタープリタの初期化と終了処理.
                                                             (line   40)
* Py_InitializeFromInitConfig (C function): Initialize Python.
                                                             (line    6)
* Py_InspectFlag (C var):                グローバルな設定変数.
                                                             (line  100)
* Py_InteractiveFlag (C var):            グローバルな設定変数.
                                                             (line  116)
* PY_INVALID_STACK_EFFECT (C macro):     Stack Effects.      (line   11)
* Py_Is (C function):                    Base object types and macros.
                                                             (line   93)
* Py_IS_FINITE (C macro):                Floating-Point Objects.
                                                             (line  132)
* Py_IS_INFINITY (C macro):              Floating-Point Objects.
                                                             (line  141)
* Py_IS_NAN (C macro):                   Floating-Point Objects.
                                                             (line  149)
* Py_IS_TYPE (C function):               Base object types and macros.
                                                             (line  132)
* Py_ISALNUM (C macro):                  Character classification and conversion.
                                                             (line   10)
* Py_ISALPHA (C macro):                  Character classification and conversion.
                                                             (line   14)
* Py_ISDIGIT (C macro):                  Character classification and conversion.
                                                             (line   19)
* Py_IsFalse (C function):               Base object types and macros.
                                                             (line  114)
* Py_IsFinalizing (C function):          インタープリタの初期化と終了処理.
                                                             (line   57)
* Py_IsInitialized (C function):         Python の埋め込み<2>.
                                                             (line   48)
* Py_IsInitialized (C function) <1>:     インタープリタの初期化と終了処理.
                                                             (line   51)
* Py_ISLOWER (C macro):                  Character classification and conversion.
                                                             (line   23)
* Py_IsNone (C function):                Base object types and macros.
                                                             (line  100)
* Py_IsolatedFlag (C var):               グローバルな設定変数.
                                                             (line  126)
* Py_ISSPACE (C macro):                  Character classification and conversion.
                                                             (line   33)
* Py_IsTrue (C function):                Base object types and macros.
                                                             (line  107)
* Py_ISUPPER (C macro):                  Character classification and conversion.
                                                             (line   28)
* Py_ISXDIGIT (C macro):                 Character classification and conversion.
                                                             (line   38)
* Py_LE (C macro):                       PyTypeObject スロット.
                                                             (line 1277)
* Py_LeaveRecursiveCall (C function):    再帰の管理.         (line   34)
* Py_LegacyWindowsFSEncodingFlag (C var): グローバルな設定変数.
                                                             (line  142)
* Py_LegacyWindowsStdioFlag (C var):     グローバルな設定変数.
                                                             (line  162)
* Py_LIMITED_API (C macro):              Limited C API.      (line   11)
* Py_LL (C macro):                       Outdated macros.    (line   16)
* Py_LOCAL (C macro):                    Declaration utilities.
                                                             (line   65)
* Py_LOCAL_INLINE (C macro):             Declaration utilities.
                                                             (line   71)
* Py_LOCAL_SYMBOL (C macro):             Declaration utilities.
                                                             (line   76)
* PY_LOCK_ACQUIRED (C enumerator):       Legacy Locking APIs.
                                                             (line   24)
* PY_LOCK_FAILURE (C enumerator):        Legacy Locking APIs.
                                                             (line   20)
* PY_LOCK_INTR (C enumerator):           Legacy Locking APIs.
                                                             (line   28)
* Py_LT (C macro):                       PyTypeObject スロット.
                                                             (line 1274)
* Py_Main (C function):                  インタープリタの初期化と終了処理.
                                                             (line  134)
* PY_MAJOR_VERSION (C macro):            Build-time version constants.
                                                             (line   13)
* Py_MakePendingCalls (C function):      非同期通知.         (line   56)
* Py_MARSHAL_VERSION (C macro):          データ整列化 data marshalling のサポート.
                                                             (line   16)
* Py_MATH_E (C macro):                   Floating-Point Objects.
                                                             (line   90)
* Py_MATH_El (C macro):                  Floating-Point Objects.
                                                             (line   95)
* Py_MATH_PI (C macro):                  Floating-Point Objects.
                                                             (line   99)
* Py_MATH_PIl (C macro):                 Floating-Point Objects.
                                                             (line  104)
* Py_MATH_TAU (C macro):                 Floating-Point Objects.
                                                             (line  109)
* Py_MAX (C macro):                      Numeric utilities.  (line   20)
* Py_MEMBER_SIZE (C macro):              Type size utilities.
                                                             (line   20)
* Py_MEMCPY (C macro):                   Outdated macros.    (line   28)
* PY_MICRO_VERSION (C macro):            Build-time version constants.
                                                             (line   21)
* Py_MIN (C macro):                      Numeric utilities.  (line   20)
* PY_MINOR_VERSION (C macro):            Build-time version constants.
                                                             (line   17)
* Py_mod_create (C macro):               Module slots.       (line   22)
* Py_mod_exec (C macro):                 Module slots.       (line   58)
* Py_mod_gil (C macro):                  Module slots.       (line  103)
* Py_MOD_GIL_NOT_USED (C macro):         Module slots.       (line  113)
* Py_MOD_GIL_USED (C macro):             Module slots.       (line  107)
* Py_mod_multiple_interpreters (C macro): Module slots.      (line   72)
* Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED (C macro): Module slots.
                                                             (line   76)
* Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED (C macro): Module slots.
                                                             (line   80)
* Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (C macro): Module slots.
                                                             (line   86)
* PY_MONITORING_EVENT_BRANCH_LEFT (C macro): Managing the Monitoring State.
                                                             (line   44)
* PY_MONITORING_EVENT_BRANCH_RIGHT (C macro): Managing the Monitoring State.
                                                             (line   47)
* PY_MONITORING_EVENT_C_RAISE (C macro): Managing the Monitoring State.
                                                             (line   53)
* PY_MONITORING_EVENT_C_RETURN (C macro): Managing the Monitoring State.
                                                             (line   56)
* PY_MONITORING_EVENT_CALL (C macro):    Managing the Monitoring State.
                                                             (line   50)
* PY_MONITORING_EVENT_EXCEPTION_HANDLED (C macro): Managing the Monitoring State.
                                                             (line   59)
* PY_MONITORING_EVENT_INSTRUCTION (C macro): Managing the Monitoring State.
                                                             (line   62)
* PY_MONITORING_EVENT_JUMP (C macro):    Managing the Monitoring State.
                                                             (line   65)
* PY_MONITORING_EVENT_LINE (C macro):    Managing the Monitoring State.
                                                             (line   68)
* PY_MONITORING_EVENT_PY_RESUME (C macro): Managing the Monitoring State.
                                                             (line   71)
* PY_MONITORING_EVENT_PY_RETURN (C macro): Managing the Monitoring State.
                                                             (line   74)
* PY_MONITORING_EVENT_PY_START (C macro): Managing the Monitoring State.
                                                             (line   77)
* PY_MONITORING_EVENT_PY_THROW (C macro): Managing the Monitoring State.
                                                             (line   80)
* PY_MONITORING_EVENT_PY_UNWIND (C macro): Managing the Monitoring State.
                                                             (line   83)
* PY_MONITORING_EVENT_PY_YIELD (C macro): Managing the Monitoring State.
                                                             (line   86)
* PY_MONITORING_EVENT_RAISE (C macro):   Managing the Monitoring State.
                                                             (line   89)
* PY_MONITORING_EVENT_RERAISE (C macro): Managing the Monitoring State.
                                                             (line   92)
* PY_MONITORING_EVENT_STOP_ITERATION (C macro): Managing the Monitoring State.
                                                             (line   95)
* PY_MONITORING_IS_INSTRUMENTED_EVENT (C function): Managing the Monitoring State.
                                                             (line  103)
* Py_mp_ass_subscript (C macro):         マップオブジェクト構造体.
                                                             (line   38)
* Py_mp_length (C macro):                マップオブジェクト構造体.
                                                             (line   15)
* Py_mp_subscript (C macro):             マップオブジェクト構造体.
                                                             (line   26)
* Py_NAN (C macro):                      Floating-Point Objects.
                                                             (line   76)
* Py_nb_absolute (C macro):              数値オブジェクト構造体.
                                                             (line  122)
* Py_nb_add (C macro):                   数値オブジェクト構造体.
                                                             (line   74)
* Py_nb_and (C macro):                   数値オブジェクト構造体.
                                                             (line  152)
* Py_nb_bool (C macro):                  数値オブジェクト構造体.
                                                             (line  128)
* Py_nb_divmod (C macro):                数値オブジェクト構造体.
                                                             (line   98)
* Py_nb_float (C macro):                 数値オブジェクト構造体.
                                                             (line  178)
* Py_nb_floor_divide (C macro):          数値オブジェクト構造体.
                                                             (line  244)
* Py_nb_index (C macro):                 数値オブジェクト構造体.
                                                             (line  268)
* Py_nb_inplace_add (C macro):           数値オブジェクト構造体.
                                                             (line  184)
* Py_nb_inplace_and (C macro):           数値オブジェクト構造体.
                                                             (line  226)
* Py_nb_inplace_floor_divide (C macro):  数値オブジェクト構造体.
                                                             (line  257)
* Py_nb_inplace_lshift (C macro):        数値オブジェクト構造体.
                                                             (line  214)
* Py_nb_inplace_matrix_multiply (C macro): 数値オブジェクト構造体.
                                                             (line  281)
* Py_nb_inplace_multiply (C macro):      数値オブジェクト構造体.
                                                             (line  196)
* Py_nb_inplace_or (C macro):            数値オブジェクト構造体.
                                                             (line  238)
* Py_nb_inplace_power (C macro):         数値オブジェクト構造体.
                                                             (line  208)
* Py_nb_inplace_remainder (C macro):     数値オブジェクト構造体.
                                                             (line  202)
* Py_nb_inplace_rshift (C macro):        数値オブジェクト構造体.
                                                             (line  220)
* Py_nb_inplace_subtract (C macro):      数値オブジェクト構造体.
                                                             (line  190)
* Py_nb_inplace_true_divide (C macro):   数値オブジェクト構造体.
                                                             (line  263)
* Py_nb_inplace_xor (C macro):           数値オブジェクト構造体.
                                                             (line  232)
* Py_nb_int (C macro):                   数値オブジェクト構造体.
                                                             (line  170)
* Py_nb_invert (C macro):                数値オブジェクト構造体.
                                                             (line  134)
* Py_nb_lshift (C macro):                数値オブジェクト構造体.
                                                             (line  140)
* Py_nb_matrix_multiply (C macro):       数値オブジェクト構造体.
                                                             (line  274)
* Py_nb_multiply (C macro):              数値オブジェクト構造体.
                                                             (line   86)
* Py_nb_negative (C macro):              数値オブジェクト構造体.
                                                             (line  110)
* Py_nb_or (C macro):                    数値オブジェクト構造体.
                                                             (line  164)
* Py_nb_positive (C macro):              数値オブジェクト構造体.
                                                             (line  116)
* Py_nb_power (C macro):                 数値オブジェクト構造体.
                                                             (line  104)
* Py_nb_remainder (C macro):             数値オブジェクト構造体.
                                                             (line   92)
* Py_nb_rshift (C macro):                数値オブジェクト構造体.
                                                             (line  146)
* Py_nb_subtract (C macro):              数値オブジェクト構造体.
                                                             (line   80)
* Py_nb_true_divide (C macro):           数値オブジェクト構造体.
                                                             (line  250)
* Py_nb_xor (C macro):                   数値オブジェクト構造体.
                                                             (line  158)
* Py_NE (C macro):                       PyTypeObject スロット.
                                                             (line 1283)
* Py_NewInterpreter (C function):        サブインタプリタサポート.
                                                             (line  196)
* Py_NewInterpreterFromConfig (C function): サブインタプリタサポート.
                                                             (line  106)
* Py_NewRef (C function):                参照カウント.       (line   84)
* Py_NO_INLINE (C macro):                Declaration utilities.
                                                             (line   39)
* Py_NO_LINK_LIB (C macro):              Unix と Windows の相違点.
                                                             (line   55)
* Py_None (C var):                       None オブジェクト.  (line   11)
* Py_NoSiteFlag (C var):                 グローバルな設定変数.
                                                             (line  180)
* Py_NotImplemented (C var):             オブジェクトプロトコル object protocol.
                                                             (line   71)
* Py_NoUserSiteDirectory (C var):        グローバルな設定変数.
                                                             (line  196)
* py_object (ctypes のクラス):           基本データ型<2>.    (line  240)
* Py_OpenCodeHookFunction (C type):      ファイルオブジェクト.
                                                             (line   62)
* Py_OptimizeFlag (C var):               グローバルな設定変数.
                                                             (line  210)
* Py_PACK_FULL_VERSION (C function):     Bit-packing macros. (line    6)
* Py_PACK_VERSION (C function):          Bit-packing macros. (line   64)
* Py_PreInitialize (C function):         Preinitialize Python with PyPreConfig.
                                                             (line   21)
* Py_PreInitializeFromArgs (C function): Preinitialize Python with PyPreConfig.
                                                             (line   38)
* Py_PreInitializeFromBytesArgs (C function): Preinitialize Python with PyPreConfig.
                                                             (line   28)
* Py_PRINT_RAW (C macro):                オブジェクトプロトコル object protocol.
                                                             (line   82)
* Py_PRINT_RAW (Cのマクロ):              ファイルオブジェクト.
                                                             (line  116)
* Py_QuietFlag (C var):                  グローバルな設定変数.
                                                             (line  221)
* Py_READONLY (C macro):                 Member flags.       (line    8)
* Py_REFCNT (C function):                参照カウント.       (line    9)
* Py_RELATIVE_OFFSET (C macro):          Member flags.       (line   17)
* PY_RELEASE_LEVEL (C macro):            Build-time version constants.
                                                             (line   25)
* PY_RELEASE_SERIAL (C macro):           Build-time version constants.
                                                             (line   30)
* Py_REMOTE_DEBUG (C macro):             パフォーマンスに関するオプション.
                                                             (line  156)
* Py_ReprEnter (C function):             再帰の管理.         (line   49)
* Py_ReprLeave (C function):             再帰の管理.         (line   66)
* PY_RESUME (monitoring event):          Events.             (line   52)
* PY_RETURN (monitoring event):          Events.             (line   57)
* Py_RETURN_FALSE (C macro):             Boolean オブジェクト.
                                                             (line   37)
* Py_RETURN_INF (C macro):               Floating-Point Objects.
                                                             (line  123)
* Py_RETURN_NAN (C macro):               Floating-Point Objects.
                                                             (line  116)
* Py_RETURN_NONE (C macro):              None オブジェクト.  (line   19)
* Py_RETURN_NOTIMPLEMENTED (C macro):    オブジェクトプロトコル object protocol.
                                                             (line   76)
* Py_RETURN_RICHCOMPARE (C macro):       PyTypeObject スロット.
                                                             (line 1295)
* Py_RETURN_TRUE (C macro):              Boolean オブジェクト.
                                                             (line   41)
* Py_RunMain (C function):               インタープリタの初期化と終了処理.
                                                             (line  182)
* Py_SAFE_DOWNCAST (C macro):            Assertion utilities.
                                                             (line   34)
* Py_SET_REFCNT (C function):            参照カウント.       (line   37)
* Py_SET_SIZE (C function):              Base object types and macros.
                                                             (line  165)
* Py_SET_TYPE (C function):              Base object types and macros.
                                                             (line  139)
* Py_SetProgramName (C function):        プロセスワイドのパラメータ.
                                                             (line    6)
* Py_SetPythonHome (C function):         プロセスワイドのパラメータ.
                                                             (line  293)
* Py_SetRecursionLimit (C function):     再帰の管理.         (line   85)
* Py_SETREF (C macro):                   参照カウント.       (line  187)
* Py_single_input (C var):               Available start symbols.
                                                             (line   18)
* Py_SIZE (C function):                  Base object types and macros.
                                                             (line  157)
* Py_sq_ass_item (C macro):              シーケンスオブジェクト構造体.
                                                             (line   65)
* Py_sq_concat (C macro):                シーケンスオブジェクト構造体.
                                                             (line   26)
* Py_sq_contains (C macro):              シーケンスオブジェクト構造体.
                                                             (line   78)
* Py_sq_inplace_concat (C macro):        シーケンスオブジェクト構造体.
                                                             (line   89)
* Py_sq_inplace_repeat (C macro):        シーケンスオブジェクト構造体.
                                                             (line  103)
* Py_sq_item (C macro):                  シーケンスオブジェクト構造体.
                                                             (line   46)
* Py_sq_length (C macro):                シーケンスオブジェクト構造体.
                                                             (line   15)
* Py_sq_repeat (C macro):                シーケンスオブジェクト構造体.
                                                             (line   36)
* Py_ssize_t (C type):                   型<2>.              (line   13)
* PY_SSIZE_T_MAX (C macro):              整数型オブジェクト integer object.
                                                             (line  264)
* PY_START (monitoring event):           Events.             (line   62)
* Py_STRINGIFY (C macro):                Macro definition utilities.
                                                             (line   12)
* Py_T_BOOL (C macro):                   Member types.       (line   85)
* Py_T_BYTE (C macro):                   Member types.       (line   20)
* Py_T_CHAR (C macro):                   Member types.       (line  101)
* Py_T_DOUBLE (C macro):                 Member types.       (line   80)
* Py_T_FLOAT (C macro):                  Member types.       (line   75)
* Py_T_INT (C macro):                    Member types.       (line   30)
* Py_T_LONG (C macro):                   Member types.       (line   35)
* Py_T_LONGLONG (C macro):               Member types.       (line   40)
* Py_T_OBJECT_EX (C macro):              Member types.       (line  106)
* Py_T_PYSSIZET (C macro):               Member types.       (line   70)
* Py_T_SHORT (C macro):                  Member types.       (line   25)
* Py_T_STRING (C macro):                 Member types.       (line   90)
* Py_T_STRING_INPLACE (C macro):         Member types.       (line   95)
* Py_T_UBYTE (C macro):                  Member types.       (line   45)
* Py_T_UINT (C macro):                   Member types.       (line   50)
* Py_T_ULONG (C macro):                  Member types.       (line   60)
* Py_T_ULONGLONG (C macro):              Member types.       (line   65)
* Py_T_USHORT (C macro):                 Member types.       (line   55)
* PY_THROW (monitoring event):           Events.             (line   67)
* Py_TOLOWER (C macro):                  Character classification and conversion.
                                                             (line   43)
* Py_TOUPPER (C macro):                  Character classification and conversion.
                                                             (line   47)
* Py_tp_alloc (C macro):                 PyTypeObject スロット.
                                                             (line 1660)
* Py_tp_base (C macro):                  PyTypeObject スロット.
                                                             (line 1468)
* Py_tp_bases (C macro):                 PyTypeObject スロット.
                                                             (line 1794)
* Py_tp_call (C macro):                  PyTypeObject スロット.
                                                             (line  499)
* Py_tp_clear (C macro):                 PyTypeObject スロット.
                                                             (line 1093)
* Py_tp_dealloc (C macro):               PyTypeObject スロット.
                                                             (line  139)
* Py_tp_del (C macro):                   PyTypeObject スロット.
                                                             (line 1872)
* Py_tp_descr_get (C macro):             PyTypeObject スロット.
                                                             (line 1541)
* Py_tp_descr_set (C macro):             PyTypeObject スロット.
                                                             (line 1557)
* Py_tp_doc (C macro):                   PyTypeObject スロット.
                                                             (line  975)
* Py_tp_finalize (C macro):              PyTypeObject スロット.
                                                             (line 1890)
* Py_tp_free (C macro):                  PyTypeObject スロット.
                                                             (line 1727)
* Py_tp_getattr (C macro):               PyTypeObject スロット.
                                                             (line  325)
* Py_tp_getattro (C macro):              PyTypeObject スロット.
                                                             (line  546)
* Py_tp_getset (C macro):                PyTypeObject スロット.
                                                             (line 1450)
* Py_tp_hash (C macro):                  PyTypeObject スロット.
                                                             (line  454)
* Py_tp_init (C macro):                  PyTypeObject スロット.
                                                             (line 1620)
* Py_tp_is_gc (C macro):                 PyTypeObject スロット.
                                                             (line 1760)
* Py_tp_iter (C macro):                  PyTypeObject スロット.
                                                             (line 1367)
* Py_tp_iternext (C macro):              PyTypeObject スロット.
                                                             (line 1387)
* Py_tp_members (C macro):               PyTypeObject スロット.
                                                             (line 1432)
* Py_tp_methods (C macro):               PyTypeObject スロット.
                                                             (line 1414)
* Py_tp_new (C macro):                   PyTypeObject スロット.
                                                             (line 1685)
* Py_tp_repr (C macro):                  PyTypeObject スロット.
                                                             (line  388)
* Py_tp_richcompare (C macro):           PyTypeObject スロット.
                                                             (line 1252)
* Py_tp_setattr (C macro):               PyTypeObject スロット.
                                                             (line  348)
* Py_tp_setattro (C macro):              PyTypeObject スロット.
                                                             (line  577)
* Py_tp_str (C macro):                   PyTypeObject スロット.
                                                             (line  515)
* Py_tp_token (C macro):                 Creating Heap-Allocated Types.
                                                             (line  277)
* Py_tp_traverse (C macro):              PyTypeObject スロット.
                                                             (line  989)
* Py_TP_USE_SPEC (C macro):              Creating Heap-Allocated Types.
                                                             (line  307)
* Py_tp_vectorcall (C macro):            PyTypeObject スロット.
                                                             (line 2060)
* Py_TPFLAGS_BASE_EXC_SUBCLASS (C macro): PyTypeObject スロット.
                                                             (line  827)
* Py_TPFLAGS_BASETYPE (C macro):         PyTypeObject スロット.
                                                             (line  677)
* Py_TPFLAGS_BYTES_SUBCLASS (C macro):   PyTypeObject スロット.
                                                             (line  821)
* Py_TPFLAGS_DEFAULT (C macro):          PyTypeObject スロット.
                                                             (line  727)
* Py_TPFLAGS_DICT_SUBCLASS (C macro):    PyTypeObject スロット.
                                                             (line  825)
* Py_TPFLAGS_DISALLOW_INSTANTIATION (C macro): PyTypeObject スロット.
                                                             (line  888)
* Py_TPFLAGS_HAVE_FINALIZE (C macro):    PyTypeObject スロット.
                                                             (line  840)
* Py_TPFLAGS_HAVE_GC (C macro):          PyTypeObject スロット.
                                                             (line  705)
* Py_TPFLAGS_HAVE_VECTORCALL (C macro):  PyTypeObject スロット.
                                                             (line  851)
* Py_TPFLAGS_HEAPTYPE (C macro):         PyTypeObject スロット.
                                                             (line  659)
* Py_TPFLAGS_IMMUTABLETYPE (C macro):    PyTypeObject スロット.
                                                             (line  874)
* Py_TPFLAGS_ITEMS_AT_END (C macro):     PyTypeObject スロット.
                                                             (line  795)
* Py_TPFLAGS_LIST_SUBCLASS (C macro):    PyTypeObject スロット.
                                                             (line  817)
* Py_TPFLAGS_LONG_SUBCLASS (C macro):    PyTypeObject スロット.
                                                             (line  815)
* Py_TPFLAGS_MANAGED_DICT (C macro):     PyTypeObject スロット.
                                                             (line  763)
* Py_TPFLAGS_MANAGED_WEAKREF (C macro):  PyTypeObject スロット.
                                                             (line  783)
* Py_TPFLAGS_MAPPING (C macro):          PyTypeObject スロット.
                                                             (line  916)
* Py_TPFLAGS_METHOD_DESCRIPTOR (C macro): PyTypeObject スロット.
                                                             (line  738)
* Py_TPFLAGS_READY (C macro):            PyTypeObject スロット.
                                                             (line  687)
* Py_TPFLAGS_READYING (C macro):         PyTypeObject スロット.
                                                             (line  696)
* Py_TPFLAGS_SEQUENCE (C macro):         PyTypeObject スロット.
                                                             (line  940)
* Py_TPFLAGS_TUPLE_SUBCLASS (C macro):   PyTypeObject スロット.
                                                             (line  819)
* Py_TPFLAGS_TYPE_SUBCLASS (C macro):    PyTypeObject スロット.
                                                             (line  829)
* Py_TPFLAGS_UNICODE_SUBCLASS (C macro): PyTypeObject スロット.
                                                             (line  823)
* Py_TPFLAGS_VALID_VERSION_TAG (C macro): PyTypeObject スロット.
                                                             (line  964)
* Py_tracefunc (C type):                 プロファイルとトレース profiling and tracing.
                                                             (line   19)
* Py_True (C var):                       Boolean オブジェクト.
                                                             (line   29)
* Py_tss_NEEDS_INIT (C macro):           スレッド固有ストレージ Thread Specific Storage TSS API.
                                                             (line   27)
* Py_tss_t (C type):                     スレッド固有ストレージ Thread Specific Storage TSS API.
                                                             (line   17)
* Py_TYPE (C function):                  Base object types and macros.
                                                             (line  121)
* Py_UCS1 (C type):                      Unicode 型.         (line   19)
* Py_UCS2 (C type):                      Unicode 型.         (line   19)
* Py_UCS4 (C type):                      Unicode 型.         (line   19)
* Py_uhash_t (C type):                   PyHash API.         (line   15)
* Py_ULL (C macro):                      Outdated macros.    (line   16)
* Py_UNBLOCK_THREADS (C macro):          高レベルAPI.        (line  230)
* Py_UnbufferedStdioFlag (C var):        グローバルな設定変数.
                                                             (line  236)
* Py_UNICODE (C type):                   Deprecated API<2>.  (line    8)
* Py_UNICODE_HIGH_SURROGATE (C function): Unicode 文字プロパティ.
                                                             (line  106)
* Py_UNICODE_IS_HIGH_SURROGATE (C function): Unicode 文字プロパティ.
                                                             (line   96)
* Py_UNICODE_IS_LOW_SURROGATE (C function): Unicode 文字プロパティ.
                                                             (line  101)
* Py_UNICODE_IS_SURROGATE (C function):  Unicode 文字プロパティ.
                                                             (line   91)
* Py_UNICODE_ISALNUM (C function):       Unicode 文字プロパティ.
                                                             (line   49)
* Py_UNICODE_ISALPHA (C function):       Unicode 文字プロパティ.
                                                             (line   44)
* Py_UNICODE_ISDECIMAL (C function):     Unicode 文字プロパティ.
                                                             (line   31)
* Py_UNICODE_ISDIGIT (C function):       Unicode 文字プロパティ.
                                                             (line   35)
* Py_UNICODE_ISLINEBREAK (C function):   Unicode 文字プロパティ.
                                                             (line   27)
* Py_UNICODE_ISLOWER (C function):       Unicode 文字プロパティ.
                                                             (line   14)
* Py_UNICODE_ISNUMERIC (C function):     Unicode 文字プロパティ.
                                                             (line   39)
* Py_UNICODE_ISPRINTABLE (C function):   Unicode 文字プロパティ.
                                                             (line   53)
* Py_UNICODE_ISSPACE (C function):       Unicode 文字プロパティ.
                                                             (line   10)
* Py_UNICODE_ISTITLE (C function):       Unicode 文字プロパティ.
                                                             (line   22)
* Py_UNICODE_ISUPPER (C function):       Unicode 文字プロパティ.
                                                             (line   18)
* Py_UNICODE_JOIN_SURROGATES (C function): Unicode 文字プロパティ.
                                                             (line  116)
* Py_UNICODE_LOW_SURROGATE (C function): Unicode 文字プロパティ.
                                                             (line  111)
* Py_UNICODE_REPLACEMENT_CHARACTER (C macro): 汎用 codec.    (line    8)
* Py_UNICODE_TODECIMAL (C function):     Unicode 文字プロパティ.
                                                             (line   72)
* Py_UNICODE_TODIGIT (C function):       Unicode 文字プロパティ.
                                                             (line   78)
* Py_UNICODE_TOLOWER (C function):       Unicode 文字プロパティ.
                                                             (line   60)
* Py_UNICODE_TONUMERIC (C function):     Unicode 文字プロパティ.
                                                             (line   84)
* Py_UNICODE_TOTITLE (C function):       Unicode 文字プロパティ.
                                                             (line   68)
* Py_UNICODE_TOUPPER (C function):       Unicode 文字プロパティ.
                                                             (line   64)
* Py_UNREACHABLE (C macro):              Assertion utilities.
                                                             (line    6)
* Py_UNUSED (C macro):                   General utility macros.
                                                             (line    8)
* PY_UNWIND (monitoring event):          Events.             (line   71)
* Py_VA_COPY (C macro):                  Outdated macros.    (line   35)
* Py_VaBuildValue (C function):          値の構築.           (line  218)
* PY_VECTORCALL_ARGUMENTS_OFFSET (C macro): The Vectorcall Protocol.
                                                             (line   69)
* Py_VerboseFlag (C var):                グローバルな設定変数.
                                                             (line  249)
* Py_Version (C var):                    Run-time version.   (line    6)
* PY_VERSION_HEX (C macro):              Build-time version constants.
                                                             (line   34)
* Py_VISIT (C macro):                    循環参照ガベージコレクションをサポートする.
                                                             (line  255)
* Py_XDECREF (C function):               例外<24>.           (line  123)
* Py_XDECREF (C function) <1>:           参照カウント.       (line  152)
* Py_XINCREF (C function):               参照カウント.       (line   77)
* Py_XNewRef (C function):               参照カウント.       (line  108)
* Py_XSETREF (C macro):                  参照カウント.       (line  213)
* PY_YIELD (monitoring event):           Events.             (line   77)
* PyAIter_Check (C function):            イテレータプロトコル iterator protocol.
                                                             (line   14)
* PyAnySet_Check (C function):           Set オブジェクト.   (line   52)
* PyAnySet_CheckExact (C function):      Set オブジェクト.   (line   65)
* PyAPI_DATA (C macro):                  Declaration utilities.
                                                             (line  106)
* PyAPI_FUNC (C macro):                  Declaration utilities.
                                                             (line   99)
* PyArg_Parse (C function):              API 関数.           (line   53)
* PyArg_ParseTuple (C function):         拡張モジュール関数でのパラメタ展開.
                                                             (line    6)
* PyArg_ParseTuple (C function) <1>:     API 関数.           (line    6)
* PyArg_ParseTupleAndKeywords (C function): 拡張モジュール関数のキーワードパラメタ.
                                                             (line    6)
* PyArg_ParseTupleAndKeywords (C function) <1>: API 関数.    (line   18)
* PyArg_UnpackTuple (C function):        API 関数.           (line   72)
* PyArg_ValidateKeywordArguments (C function): API 関数.     (line   45)
* PyArg_VaParse (C function):            API 関数.           (line   12)
* PyArg_VaParseTupleAndKeywords (C function): API 関数.      (line   38)
* PyASCIIObject (C type):                Unicode 型.         (line   29)
* PyAsyncGen_CheckExact (C function):    Asynchronous Generator Objects.
                                                             (line   32)
* PyAsyncGen_New (C function):           Asynchronous Generator Objects.
                                                             (line   19)
* PyAsyncGen_Type (C var):               Asynchronous Generator Objects.
                                                             (line   11)
* PyAsyncGenASend_CheckExact (C macro):  Deprecated API<5>.  (line    6)
* PyAsyncMethods (C type):               async オブジェクト構造体.
                                                             (line    8)
* PyAsyncMethods.am_aiter (C member):    async オブジェクト構造体.
                                                             (line   40)
* PyAsyncMethods.am_anext (C member):    async オブジェクト構造体.
                                                             (line   56)
* PyAsyncMethods.am_await (C member):    async オブジェクト構造体.
                                                             (line   23)
* PyAsyncMethods.am_send (C member):     async オブジェクト構造体.
                                                             (line   69)
* PyBaseObject_Type (C var):             Base object types and macros.
                                                             (line   89)
* PyBool_Check (C function):             Boolean オブジェクト.
                                                             (line   16)
* PyBool_FromLong (C function):          Boolean オブジェクト.
                                                             (line   45)
* PyBool_Type (C var):                   Boolean オブジェクト.
                                                             (line   11)
* PyBUF_ANY_CONTIGUOUS (C macro):        隣接性のリクエスト. (line   24)
* PyBUF_C_CONTIGUOUS (C macro):          隣接性のリクエスト. (line   14)
* PyBUF_CONTIG (C macro):                複合リクエスト.     (line   48)
* PyBUF_CONTIG_RO (C macro):             複合リクエスト.     (line   53)
* PyBUF_F_CONTIGUOUS (C macro):          隣接性のリクエスト. (line   19)
* PyBUF_FORMAT (C macro):                readonly format.    (line   21)
* PyBUF_FULL (C macro):                  複合リクエスト.     (line   18)
* PyBUF_FULL_RO (C macro):               複合リクエスト.     (line   23)
* PyBUF_INDIRECT (C macro):              shape strides suboffsets.
                                                             (line   14)
* PyBUF_MAX_NDIM (C macro):              buffer 構造体.      (line  158)
* PyBUF_ND (C macro):                    shape strides suboffsets.
                                                             (line   24)
* PyBUF_READ (C macro):                  memoryview オブジェクト.
                                                             (line   24)
* PyBUF_RECORDS (C macro):               複合リクエスト.     (line   28)
* PyBUF_RECORDS_RO (C macro):            複合リクエスト.     (line   33)
* PyBUF_SIMPLE (C macro):                shape strides suboffsets.
                                                             (line   29)
* PyBUF_STRIDED (C macro):               複合リクエスト.     (line   38)
* PyBUF_STRIDED_RO (C macro):            複合リクエスト.     (line   43)
* PyBUF_STRIDES (C macro):               shape strides suboffsets.
                                                             (line   19)
* PyBUF_WRITABLE (C macro):              readonly format.    (line    6)
* PyBUF_WRITE (C macro):                 memoryview オブジェクト.
                                                             (line   28)
* PyBUF_WRITEABLE (C macro):             readonly format.    (line   16)
* PyBuffer_FillContiguousStrides (C function): バッファ関連の関数.
                                                             (line   90)
* PyBuffer_FillInfo (C function):        バッファ関連の関数. (line   97)
* PyBuffer_FromContiguous (C function):  バッファ関連の関数. (line   66)
* PyBuffer_GetPointer (C function):      バッファ関連の関数. (line   59)
* PyBuffer_IsContiguous (C function):    バッファ関連の関数. (line   51)
* PyBuffer_Release (C function):         バッファ関連の関数. (line   33)
* PyBuffer_SizeFromFormat (C function):  バッファ関連の関数. (line   43)
* PyBuffer_ToContiguous (C function):    バッファ関連の関数. (line   73)
* PyBufferProcs (C type):                バッファプロトコル buffer Protocol.
                                                             (line   20)
* PyBufferProcs (C type) <1>:            バッファオブジェクト構造体 buffer object structure.
                                                             (line    6)
* PyBufferProcs.bf_getbuffer (C member): バッファオブジェクト構造体 buffer object structure.
                                                             (line   13)
* PyBufferProcs.bf_releasebuffer (C member): バッファオブジェクト構造体 buffer object structure.
                                                             (line   67)
* PyByteArray_AS_STRING (C function):    マクロ.             (line    9)
* PyByteArray_AsString (C function):     ダイレクト API 関数.
                                                             (line   33)
* PyByteArray_Check (C function):        型チェックマクロ.   (line    6)
* PyByteArray_CheckExact (C function):   型チェックマクロ.   (line   12)
* PyByteArray_Concat (C function):       ダイレクト API 関数.
                                                             (line   20)
* PyByteArray_FromObject (C function):   ダイレクト API 関数.
                                                             (line    6)
* PyByteArray_FromStringAndSize (C function): ダイレクト API 関数.
                                                             (line   13)
* PyByteArray_GET_SIZE (C function):     マクロ.             (line   14)
* PyByteArray_Resize (C function):       ダイレクト API 関数.
                                                             (line   38)
* PyByteArray_Size (C function):         ダイレクト API 関数.
                                                             (line   28)
* PyByteArray_Type (C var):              bytearray オブジェクト<2>.
                                                             (line   11)
* PyByteArrayIter_Type (C var):          Other Iterator Objects.
                                                             (line    6)
* PyByteArrayObject (C type):            bytearray オブジェクト<2>.
                                                             (line    6)
* PyBytes_AS_STRING (C function):        バイトオブジェクト<2>.
                                                             (line  131)
* PyBytes_AsString (C function):         バイトオブジェクト<2>.
                                                             (line  120)
* PyBytes_AsStringAndSize (C function):  バイトオブジェクト<2>.
                                                             (line  136)
* PyBytes_Check (C function):            バイトオブジェクト<2>.
                                                             (line   20)
* PyBytes_CheckExact (C function):       バイトオブジェクト<2>.
                                                             (line   25)
* PyBytes_Concat (C function):           バイトオブジェクト<2>.
                                                             (line  157)
* PyBytes_ConcatAndDel (C function):     バイトオブジェクト<2>.
                                                             (line  165)
* PyBytes_DecodeEscape (C function):     バイトオブジェクト<2>.
                                                             (line  221)
* PyBytes_FromFormat (C function):       バイトオブジェクト<2>.
                                                             (line   43)
* PyBytes_FromFormatV (C function):      バイトオブジェクト<2>.
                                                             (line  101)
* PyBytes_FromObject (C function):       バイトオブジェクト<2>.
                                                             (line  107)
* PyBytes_FromString (C function):       バイトオブジェクト<2>.
                                                             (line   30)
* PyBytes_FromStringAndSize (C function): バイトオブジェクト<2>.
                                                             (line   36)
* PyBytes_GET_SIZE (C function):         バイトオブジェクト<2>.
                                                             (line  115)
* PyBytes_Join (C function):             バイトオブジェクト<2>.
                                                             (line  172)
* PyBytes_Repr (C function):             バイトオブジェクト<2>.
                                                             (line  202)
* PyBytes_Size (C function):             バイトオブジェクト<2>.
                                                             (line  111)
* PyBytes_Type (C var):                  バイトオブジェクト<2>.
                                                             (line   15)
* PyBytesIter_Type (C var):              Other Iterator Objects.
                                                             (line    9)
* PyBytesObject (C type):                バイトオブジェクト<2>.
                                                             (line   10)
* pycache_prefix (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line  364)
* PyCallable_Check (C function):         Call Support API.   (line    6)
* PyCallIter_Check (C function):         イテレータオブジェクト iterator object.
                                                             (line   34)
* PyCallIter_New (C function):           イテレータオブジェクト iterator object.
                                                             (line   39)
* PyCallIter_Type (C var):               イテレータオブジェクト iterator object.
                                                             (line   29)
* PyCapsule (C type):                    カプセル<2>.        (line   11)
* PyCapsule_CheckExact (C function):     カプセル<2>.        (line   34)
* PyCapsule_Destructor (C type):         カプセル<2>.        (line   25)
* PyCapsule_GetContext (C function):     カプセル<2>.        (line   81)
* PyCapsule_GetDestructor (C function):  カプセル<2>.        (line   70)
* PyCapsule_GetName (C function):        カプセル<2>.        (line   91)
* PyCapsule_GetPointer (C function):     カプセル<2>.        (line   59)
* PyCapsule_Import (C function):         カプセル<2>.        (line  101)
* PyCapsule_IsValid (C function):        カプセル<2>.        (line  123)
* PyCapsule_New (C function):            カプセル<2>.        (line   39)
* PyCapsule_SetContext (C function):     カプセル<2>.        (line  138)
* PyCapsule_SetDestructor (C function):  カプセル<2>.        (line  145)
* PyCapsule_SetName (C function):        カプセル<2>.        (line  152)
* PyCapsule_SetPointer (C function):     カプセル<2>.        (line  161)
* PyCapsule_Type (C var):                カプセル<2>.        (line   20)
* PyCell_Check (C function):             セルオブジェクト cell object.
                                                             (line   24)
* PyCell_Get (C function):               セルオブジェクト cell object.
                                                             (line   33)
* PyCell_GET (C function):               セルオブジェクト cell object.
                                                             (line   38)
* PyCell_New (C function):               セルオブジェクト cell object.
                                                             (line   29)
* PyCell_Set (C function):               セルオブジェクト cell object.
                                                             (line   42)
* PyCell_SET (C function):               セルオブジェクト cell object.
                                                             (line   51)
* PyCell_Type (C var):                   セルオブジェクト cell object.
                                                             (line   20)
* PyCellObject (C type):                 セルオブジェクト cell object.
                                                             (line   16)
* PyCF_ALLOW_TOP_LEVEL_AWAIT (ast モジュール): Compiler flags<2>.
                                                             (line    9)
* PyCF_ALLOW_TOP_LEVEL_AWAIT (C macro):  超高水準レイヤ.     (line  332)
* PyCF_ONLY_AST (ast モジュール):        Compiler flags<2>.  (line   16)
* PyCF_ONLY_AST (C macro):               超高水準レイヤ.     (line  332)
* PyCF_OPTIMIZED_AST (ast モジュール):   Compiler flags<2>.  (line   21)
* PyCF_OPTIMIZED_AST (C macro):          超高水準レイヤ.     (line  332)
* PyCF_TYPE_COMMENTS (ast モジュール):   Compiler flags<2>.  (line   28)
* PyCF_TYPE_COMMENTS (C macro):          超高水準レイヤ.     (line  332)
* PyCFunction (C type):                  Implementing functions and methods.
                                                             (line    6)
* PyCFunction_Check (C function):        Implementing functions and methods.
                                                             (line  272)
* PyCFunction_CheckExact (C function):   Implementing functions and methods.
                                                             (line  277)
* PyCFunction_GET_FLAGS (C function):    Implementing functions and methods.
                                                             (line  303)
* PyCFunction_GET_FUNCTION (C function): Implementing functions and methods.
                                                             (line  319)
* PyCFunction_GET_SELF (C function):     Implementing functions and methods.
                                                             (line  338)
* PyCFunction_GetFlags (C function):     Implementing functions and methods.
                                                             (line  293)
* PyCFunction_GetFunction (C function):  Implementing functions and methods.
                                                             (line  308)
* PyCFunction_GetSelf (C function):      Implementing functions and methods.
                                                             (line  324)
* PyCFunction_New (C function):          Implementing functions and methods.
                                                             (line  287)
* PyCFunction_NewEx (C function):        Implementing functions and methods.
                                                             (line  282)
* PyCFunction_Type (C var):              Implementing functions and methods.
                                                             (line  267)
* PyCFunctionFast (C type):              Implementing functions and methods.
                                                             (line   29)
* PyCFunctionFastWithKeywords (C type):  Implementing functions and methods.
                                                             (line   38)
* PyCFunctionWithKeywords (C type):      Implementing functions and methods.
                                                             (line   20)
* PycInvalidationMode (py_compile のクラス): py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   93)
* PyClassMethod_New (C function):        Built-in descriptors.
                                                             (line   23)
* PyClassMethod_Type (C var):            Built-in descriptors.
                                                             (line   11)
* PyClassMethodDescr_Type (C var):       Built-in descriptors.
                                                             (line   16)
* PyCMethod (C type):                    Implementing functions and methods.
                                                             (line   49)
* PyCMethod_Check (C function):          Implementing functions and methods.
                                                             (line  230)
* PyCMethod_CheckExact (C function):     Implementing functions and methods.
                                                             (line  235)
* PyCMethod_New (C function):            Implementing functions and methods.
                                                             (line  240)
* PyCMethod_Type (C var):                Implementing functions and methods.
                                                             (line  224)
* PyCode_Addr2Line (C function):         コードオブジェクト<3>.
                                                             (line   97)
* PyCode_Addr2Location (C function):     コードオブジェクト<3>.
                                                             (line  106)
* PyCode_AddWatcher (C function):        コードオブジェクト<3>.
                                                             (line  163)
* PyCode_Check (C function):             コードオブジェクト<3>.
                                                             (line   20)
* PyCode_ClearWatcher (C function):      コードオブジェクト<3>.
                                                             (line  172)
* PyCode_GetCellvars (C function):       コードオブジェクト<3>.
                                                             (line  142)
* PyCode_GetCode (C function):           コードオブジェクト<3>.
                                                             (line  118)
* PyCode_GetFreevars (C function):       コードオブジェクト<3>.
                                                             (line  153)
* PyCode_GetNumFree (C function):        コードオブジェクト<3>.
                                                             (line   25)
* PyCode_GetVarnames (C function):       コードオブジェクト<3>.
                                                             (line  132)
* PyCode_New (C 関数):                   コードオブジェクト<3>.
                                                             (line   64)
* PyCode_NewEmpty (C function):          コードオブジェクト<3>.
                                                             (line   91)
* PyCode_NewWithPosOnlyArgs (C function): コードオブジェクト<3>.
                                                             (line   68)
* PyCode_Optimize (C function):          コードオブジェクト<3>.
                                                             (line  224)
* PyCode_Type (C var):                   コードオブジェクト<3>.
                                                             (line   15)
* PyCode_WatchCallback (C type):         コードオブジェクト<3>.
                                                             (line  188)
* PyCodec_BackslashReplaceErrors (C function): Unicode エラーハンドラ用レジストリ API.
                                                             (line   51)
* PyCodec_Decode (C function):           codec レジストリとサポート関数.
                                                             (line   38)
* PyCodec_Decoder (C function):          コーデック検索API.  (line   15)
* PyCodec_Encode (C function):           codec レジストリとサポート関数.
                                                             (line   27)
* PyCodec_Encoder (C function):          コーデック検索API.  (line   10)
* PyCodec_IgnoreErrors (C function):     Unicode エラーハンドラ用レジストリ API.
                                                             (line   37)
* PyCodec_IncrementalDecoder (C function): コーデック検索API.
                                                             (line   26)
* PyCodec_IncrementalEncoder (C function): コーデック検索API.
                                                             (line   20)
* PyCodec_KnownEncoding (C function):    codec レジストリとサポート関数.
                                                             (line   22)
* PyCodec_LookupError (C function):      Unicode エラーハンドラ用レジストリ API.
                                                             (line   26)
* PyCodec_NameReplaceErrors (C function): Unicode エラーハンドラ用レジストリ API.
                                                             (line   57)
* PyCodec_Register (C function):         codec レジストリとサポート関数.
                                                             (line    6)
* PyCodec_RegisterError (C function):    Unicode エラーハンドラ用レジストリ API.
                                                             (line    6)
* PyCodec_ReplaceErrors (C function):    Unicode エラーハンドラ用レジストリ API.
                                                             (line   41)
* PyCodec_StreamReader (C function):     コーデック検索API.  (line   32)
* PyCodec_StreamWriter (C function):     コーデック検索API.  (line   38)
* PyCodec_StrictErrors (C function):     Unicode エラーハンドラ用レジストリ API.
                                                             (line   33)
* PyCodec_Unregister (C function):       codec レジストリとサポート関数.
                                                             (line   14)
* PyCodec_XMLCharRefReplaceErrors (C function): Unicode エラーハンドラ用レジストリ API.
                                                             (line   46)
* PyCodeEvent (C type):                  コードオブジェクト<3>.
                                                             (line  181)
* PyCodeObject (C type):                 コードオブジェクト<3>.
                                                             (line   10)
* PyCompactUnicodeObject (C type):       Unicode 型.         (line   29)
* PyCompile_OpcodeStackEffect (C function): Stack Effects.   (line   19)
* PyCompile_OpcodeStackEffectWithJump (C function): Stack Effects.
                                                             (line   28)
* PyCompileError:                        py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   19)
* PyCompilerFlags (C struct):            超高水準レイヤ.     (line  305)
* PyCompilerFlags.cf_feature_version (C member): 超高水準レイヤ.
                                                             (line  320)
* PyCompilerFlags.cf_flags (C member):   超高水準レイヤ.     (line  316)
* PyComplex_AsCComplex (C function):     Python オブジェクトとしての複素数型.
                                                             (line   69)
* PyComplex_Check (C function):          Python オブジェクトとしての複素数型.
                                                             (line   16)
* PyComplex_CheckExact (C function):     Python オブジェクトとしての複素数型.
                                                             (line   21)
* PyComplex_FromCComplex (C function):   Python オブジェクトとしての複素数型.
                                                             (line   27)
* PyComplex_FromDoubles (C function):    Python オブジェクトとしての複素数型.
                                                             (line   33)
* PyComplex_ImagAsDouble (C function):   Python オブジェクトとしての複素数型.
                                                             (line   54)
* PyComplex_RealAsDouble (C function):   Python オブジェクトとしての複素数型.
                                                             (line   39)
* PyComplex_Type (C var):                Python オブジェクトとしての複素数型.
                                                             (line   11)
* PyComplexObject (C type):              Python オブジェクトとしての複素数型.
                                                             (line    6)
* PyConfig (C type):                     PyConfig.           (line    6)
* PyConfig_Clear (C function):           PyConfig.           (line   96)
* PyConfig_Get (C function):             Runtime Python configuration API.
                                                             (line   16)
* PyConfig_GetInt (C function):          Runtime Python configuration API.
                                                             (line   43)
* PyConfig_InitIsolatedConfig (C function): PyConfig.        (line   20)
* PyConfig_InitPythonConfig (C function): PyConfig.          (line   15)
* PyConfig_Names (C function):           Runtime Python configuration API.
                                                             (line   53)
* PyConfig_Read (C function):            PyConfig.           (line   66)
* PyConfig_Set (C function):             Runtime Python configuration API.
                                                             (line   67)
* PyConfig_SetArgv (C function):         PyConfig.           (line   41)
* PyConfig_SetBytesArgv (C function):    PyConfig.           (line   49)
* PyConfig_SetBytesString (C function):  PyConfig.           (line   32)
* PyConfig_SetString (C function):       PyConfig.           (line   25)
* PyConfig_SetWideStringList (C function): PyConfig.         (line   58)
* PyConfig._pystats (C member):          PyConfig.           (line 1021)
* PyConfig.argv (C member):              PyConfig.           (line  127)
* PyConfig.base_exec_prefix (C member):  PyConfig.           (line  172)
* PyConfig.base_executable (C member):   PyConfig.           (line  182)
* PyConfig.base_prefix (C member):       PyConfig.           (line  196)
* PyConfig.buffered_stdio (C member):    PyConfig.           (line  206)
* PyConfig.bytes_warning (C member):     PyConfig.           (line  219)
* PyConfig.check_hash_pycs_mode (C member): PyConfig.        (line  256)
* PyConfig.code_debug_ranges (C member): PyConfig.           (line  242)
* PyConfig.configure_c_stdio (C member): PyConfig.           (line  276)
* PyConfig.cpu_count (C member):         PyConfig.           (line  513)
* PyConfig.dev_mode (C member):          PyConfig.           (line  291)
* PyConfig.dump_refs (C member):         PyConfig.           (line  300)
* PyConfig.dump_refs_file (C member):    PyConfig.           (line  314)
* PyConfig.exec_prefix (C member):       PyConfig.           (line  325)
* PyConfig.executable (C member):        PyConfig.           (line  337)
* PyConfig.faulthandler (C member):      PyConfig.           (line  348)
* PyConfig.filesystem_encoding (C member): PyConfig.         (line  360)
* PyConfig.filesystem_errors (C member): PyConfig.           (line  393)
* PyConfig.hash_seed (C member):         PyConfig.           (line  425)
* PyConfig.home (C member):              PyConfig.           (line  440)
* PyConfig.import_time (C member):       PyConfig.           (line  451)
* PyConfig.inspect (C member):           PyConfig.           (line  464)
* PyConfig.install_signal_handlers (C member): PyConfig.     (line  479)
* PyConfig.int_max_str_digits (C member): PyConfig.          (line  493)
* PyConfig.interactive (C member):       PyConfig.           (line  485)
* PyConfig.isolated (C member):          PyConfig.           (line  527)
* PyConfig.legacy_windows_stdio (C member): PyConfig.        (line  552)
* PyConfig.malloc_stats (C member):      PyConfig.           (line  569)
* PyConfig.module_search_paths (C member): PyConfig.         (line  613)
* PyConfig.module_search_paths_set (C member): PyConfig.     (line  616)
* PyConfig.optimization_level (C member): PyConfig.          (line  630)
* PyConfig.orig_argv (C member):         PyConfig.           (line  646)
* PyConfig.parse_argv (C member):        PyConfig.           (line  664)
* PyConfig.parser_debug (C member):      PyConfig.           (line  685)
* PyConfig.pathconfig_warnings (C member): PyConfig.         (line  699)
* PyConfig.perf_profiling (C member):    PyConfig.           (line  893)
* PyConfig.platlibdir (C member):        PyConfig.           (line  582)
* PyConfig.prefix (C member):            PyConfig.           (line  711)
* PyConfig.program_name (C member):      PyConfig.           (line  722)
* PyConfig.pycache_prefix (C member):    PyConfig.           (line  743)
* PyConfig.pythonpath_env (C member):    PyConfig.           (line  602)
* PyConfig.quiet (C member):             PyConfig.           (line  756)
* PyConfig.run_command (C member):       PyConfig.           (line  765)
* PyConfig.run_filename (C member):      PyConfig.           (line  773)
* PyConfig.run_module (C member):        PyConfig.           (line  787)
* PyConfig.run_presite (C member):       PyConfig.           (line  795)
* PyConfig.safe_path (C member):         PyConfig.           (line  150)
* PyConfig.show_ref_count (C member):    PyConfig.           (line  809)
* PyConfig.site_import (C member):       PyConfig.           (line  821)
* PyConfig.skip_source_first_line (C member): PyConfig.      (line  840)
* PyConfig.stdio_encoding (C member):    PyConfig.           (line  852)
* PyConfig.stdio_errors (C member):      PyConfig.           (line  854)
* PyConfig.stdlib_dir (C member):        PyConfig.           (line  920)
* PyConfig.tracemalloc (C member):       PyConfig.           (line  882)
* PyConfig.use_environment (C member):   PyConfig.           (line  928)
* PyConfig.use_frozen_modules (C member): PyConfig.          (line  415)
* PyConfig.use_hash_seed (C member):     PyConfig.           (line  427)
* PyConfig.use_system_logger (C member): PyConfig.           (line  939)
* PyConfig.user_site_directory (C member): PyConfig.         (line  951)
* PyConfig.verbose (C member):           PyConfig.           (line  964)
* PyConfig.warn_default_encoding (C member): PyConfig.       (line  232)
* PyConfig.warnoptions (C member):       PyConfig.           (line  981)
* PyConfig.write_bytecode (C member):    PyConfig.           (line 1001)
* PyConfig.xoptions (C member):          PyConfig.           (line 1014)
* PyContext (C type):                    コンテキスト変数オブジェクト.
                                                             (line   26)
* PyContext_AddWatcher (C function):     コンテキスト変数オブジェクト.
                                                             (line   95)
* PyContext_CheckExact (C function):     コンテキスト変数オブジェクト.
                                                             (line   55)
* PyContext_ClearWatcher (C function):   コンテキスト変数オブジェクト.
                                                             (line  105)
* PyContext_Copy (C function):           コンテキスト変数オブジェクト.
                                                             (line   76)
* PyContext_CopyCurrent (C function):    コンテキスト変数オブジェクト.
                                                             (line   80)
* PyContext_Enter (C function):          コンテキスト変数オブジェクト.
                                                             (line   84)
* PyContext_Exit (C function):           コンテキスト変数オブジェクト.
                                                             (line   89)
* PyContext_New (C function):            コンテキスト変数オブジェクト.
                                                             (line   72)
* PyContext_Type (C var):                コンテキスト変数オブジェクト.
                                                             (line   41)
* PyContext_WatchCallback (C type):      コンテキスト変数オブジェクト.
                                                             (line  125)
* PyContextEvent (C type):               コンテキスト変数オブジェクト.
                                                             (line  114)
* PyContextToken (C type):               コンテキスト変数オブジェクト.
                                                             (line   36)
* PyContextToken_CheckExact (C function): コンテキスト変数オブジェクト.
                                                             (line   65)
* PyContextToken_Type (C var):           コンテキスト変数オブジェクト.
                                                             (line   49)
* PyContextVar (C type):                 コンテキスト変数オブジェクト.
                                                             (line   31)
* PyContextVar_CheckExact (C function):  コンテキスト変数オブジェクト.
                                                             (line   60)
* PyContextVar_Get (C function):         コンテキスト変数オブジェクト.
                                                             (line  154)
* PyContextVar_New (C function):         コンテキスト変数オブジェクト.
                                                             (line  147)
* PyContextVar_Reset (C function):       コンテキスト変数オブジェクト.
                                                             (line  179)
* PyContextVar_Set (C function):         コンテキスト変数オブジェクト.
                                                             (line  173)
* PyContextVar_Type (C var):             コンテキスト変数オブジェクト.
                                                             (line   45)
* PyCoro_CheckExact (C function):        コルーチンオブジェクト<2>.
                                                             (line   19)
* PyCoro_New (C function):               コルーチンオブジェクト<2>.
                                                             (line   24)
* PyCoro_Type (C var):                   コルーチンオブジェクト<2>.
                                                             (line   15)
* PyCoroObject (C type):                 コルーチンオブジェクト<2>.
                                                             (line   11)
* PyCurses_API (C var):                  Curses C API.       (line   29)
* PyCurses_API_pointers (C macro):       Curses C API.       (line   52)
* PyCurses_CAPSULE_NAME (C macro):       Internal data.      (line    9)
* PyCursesInitialised (C macro):         Curses C API.       (line   85)
* PyCursesInitialisedColor (C macro):    Curses C API.       (line   99)
* PyCursesSetupTermCalled (C macro):     Curses C API.       (line   71)
* PyCursesWindow_Check (C function):     Curses C API.       (line   62)
* PyCursesWindow_Type (C var):           Curses C API.       (line   57)
* PyDate_Check (C function):             DateTime オブジェクト<2>.
                                                             (line  104)
* PyDate_CheckExact (C function):        DateTime オブジェクト<2>.
                                                             (line  110)
* PyDate_FromDate (C function):          DateTime オブジェクト<2>.
                                                             (line  164)
* PyDate_FromTimestamp (C function):     DateTime オブジェクト<2>.
                                                             (line  338)
* PyDateTime_CAPI (C type):              DateTime オブジェクト<2>.
                                                             (line   28)
* PyDateTime_CAPSULE_NAME (C macro):     Internal data<2>.   (line    9)
* PyDateTime_Check (C function):         DateTime オブジェクト<2>.
                                                             (line  115)
* PyDateTime_CheckExact (C function):    DateTime オブジェクト<2>.
                                                             (line  122)
* PyDateTime_Date (C type):              DateTime オブジェクト<2>.
                                                             (line   43)
* PyDateTime_DATE_GET_FOLD (C function): DateTime オブジェクト<2>.
                                                             (line  257)
* PyDateTime_DATE_GET_HOUR (C function): DateTime オブジェクト<2>.
                                                             (line  240)
* PyDateTime_DATE_GET_MICROSECOND (C function): DateTime オブジェクト<2>.
                                                             (line  252)
* PyDateTime_DATE_GET_MINUTE (C function): DateTime オブジェクト<2>.
                                                             (line  244)
* PyDateTime_DATE_GET_SECOND (C function): DateTime オブジェクト<2>.
                                                             (line  248)
* PyDateTime_DATE_GET_TZINFO (C function): DateTime オブジェクト<2>.
                                                             (line  264)
* PyDateTime_DateTime (C type):          DateTime オブジェクト<2>.
                                                             (line   48)
* PyDateTime_DateTimeType (C var):       DateTime オブジェクト<2>.
                                                             (line   69)
* PyDateTime_DateType (C var):           DateTime オブジェクト<2>.
                                                             (line   63)
* PyDateTime_Delta (C type):             DateTime オブジェクト<2>.
                                                             (line   58)
* PyDateTime_DELTA_GET_DAYS (C function): DateTime オブジェクト<2>.
                                                             (line  311)
* PyDateTime_DELTA_GET_MICROSECONDS (C function): DateTime オブジェクト<2>.
                                                             (line  323)
* PyDateTime_DELTA_GET_SECONDS (C function): DateTime オブジェクト<2>.
                                                             (line  317)
* PyDateTime_DeltaType (C var):          DateTime オブジェクト<2>.
                                                             (line   81)
* PyDateTime_FromDateAndTime (C function): DateTime オブジェクト<2>.
                                                             (line  169)
* PyDateTime_FromDateAndTimeAndFold (C function): DateTime オブジェクト<2>.
                                                             (line  175)
* PyDateTime_FromTimestamp (C function): DateTime オブジェクト<2>.
                                                             (line  332)
* PyDateTime_GET_DAY (C function):       DateTime オブジェクト<2>.
                                                             (line  231)
* PyDateTime_GET_MONTH (C function):     DateTime オブジェクト<2>.
                                                             (line  227)
* PyDateTime_GET_YEAR (C function):      DateTime オブジェクト<2>.
                                                             (line  223)
* PyDateTime_IMPORT (C macro):           DateTime オブジェクト<2>.
                                                             (line   14)
* PyDateTime_Time (C type):              DateTime オブジェクト<2>.
                                                             (line   53)
* PyDateTime_TIME_GET_FOLD (C function): DateTime オブジェクト<2>.
                                                             (line  292)
* PyDateTime_TIME_GET_HOUR (C function): DateTime オブジェクト<2>.
                                                             (line  276)
* PyDateTime_TIME_GET_MICROSECOND (C function): DateTime オブジェクト<2>.
                                                             (line  288)
* PyDateTime_TIME_GET_MINUTE (C function): DateTime オブジェクト<2>.
                                                             (line  280)
* PyDateTime_TIME_GET_SECOND (C function): DateTime オブジェクト<2>.
                                                             (line  284)
* PyDateTime_TIME_GET_TZINFO (C function): DateTime オブジェクト<2>.
                                                             (line  299)
* PyDateTime_TimeType (C var):           DateTime オブジェクト<2>.
                                                             (line   75)
* PyDateTime_TimeZone_UTC (C var):       DateTime オブジェクト<2>.
                                                             (line   95)
* PyDateTime_TZInfoType (C var):         DateTime オブジェクト<2>.
                                                             (line   87)
* PyDateTimeAPI (C var):                 DateTime オブジェクト<2>.
                                                             (line   36)
* PyDelta_Check (C function):            DateTime オブジェクト<2>.
                                                             (line  138)
* PyDelta_CheckExact (C function):       DateTime オブジェクト<2>.
                                                             (line  145)
* PyDelta_FromDSU (C function):          DateTime オブジェクト<2>.
                                                             (line  195)
* PyDescr_IsData (C function):           デスクリプタオブジェクト descriptor object.
                                                             (line   63)
* PyDescr_NewClassMethod (C function):   デスクリプタオブジェクト descriptor object.
                                                             (line   59)
* PyDescr_NewGetSet (C function):        デスクリプタオブジェクト descriptor object.
                                                             (line   14)
* PyDescr_NewMember (C function):        デスクリプタオブジェクト descriptor object.
                                                             (line   18)
* PyDescr_NewMethod (C function):        デスクリプタオブジェクト descriptor object.
                                                             (line   36)
* PyDescr_NewWrapper (C function):       デスクリプタオブジェクト descriptor object.
                                                             (line   47)
* PyDict_AddWatcher (C function):        辞書オブジェクト dictionary object.
                                                             (line  340)
* PyDict_Check (C function):             辞書オブジェクト dictionary object.
                                                             (line   16)
* PyDict_CheckExact (C function):        辞書オブジェクト dictionary object.
                                                             (line   21)
* PyDict_Clear (C function):             辞書オブジェクト dictionary object.
                                                             (line   47)
* PyDict_ClearWatcher (C function):      辞書オブジェクト dictionary object.
                                                             (line  349)
* PyDict_Contains (C function):          辞書オブジェクト dictionary object.
                                                             (line   51)
* PyDict_ContainsString (C function):    辞書オブジェクト dictionary object.
                                                             (line   57)
* PyDict_Copy (C function):              辞書オブジェクト dictionary object.
                                                             (line   65)
* PyDict_DelItem (C function):           辞書オブジェクト dictionary object.
                                                             (line   84)
* PyDict_DelItemString (C function):     辞書オブジェクト dictionary object.
                                                             (line   91)
* PyDict_GET_SIZE (C function):          辞書オブジェクト dictionary object.
                                                             (line  236)
* PyDict_GetItem (C function):           辞書オブジェクト dictionary object.
                                                             (line  113)
* PyDict_GetItemRef (C function):        辞書オブジェクト dictionary object.
                                                             (line   96)
* PyDict_GetItemString (C function):     辞書オブジェクト dictionary object.
                                                             (line  136)
* PyDict_GetItemStringRef (C function):  辞書オブジェクト dictionary object.
                                                             (line  149)
* PyDict_GetItemWithError (C function):  辞書オブジェクト dictionary object.
                                                             (line  129)
* PyDict_Items (C function):             辞書オブジェクト dictionary object.
                                                             (line  218)
* PyDict_Keys (C function):              辞書オブジェクト dictionary object.
                                                             (line  222)
* PyDict_Merge (C function):             辞書オブジェクト dictionary object.
                                                             (line  306)
* PyDict_MergeFromSeq2 (C function):     辞書オブジェクト dictionary object.
                                                             (line  324)
* PyDict_New (C function):               辞書オブジェクト dictionary object.
                                                             (line   26)
* PyDict_Next (C function):              辞書オブジェクト dictionary object.
                                                             (line  240)
* PyDict_Pop (C function):               辞書オブジェクト dictionary object.
                                                             (line  190)
* PyDict_PopString (C function):         辞書オブジェクト dictionary object.
                                                             (line  209)
* PyDict_SetDefault (C function):        辞書オブジェクト dictionary object.
                                                             (line  158)
* PyDict_SetDefaultRef (C function):     辞書オブジェクト dictionary object.
                                                             (line  169)
* PyDict_SetItem (C function):           辞書オブジェクト dictionary object.
                                                             (line   69)
* PyDict_SetItemString (C function):     辞書オブジェクト dictionary object.
                                                             (line   78)
* PyDict_Size (C function):              辞書オブジェクト dictionary object.
                                                             (line  230)
* PyDict_Type (C var):                   辞書オブジェクト dictionary object.
                                                             (line   11)
* PyDict_Unwatch (C function):           辞書オブジェクト dictionary object.
                                                             (line  366)
* PyDict_Update (C function):            辞書オブジェクト dictionary object.
                                                             (line  316)
* PyDict_Values (C function):            辞書オブジェクト dictionary object.
                                                             (line  226)
* PyDict_Watch (C function):             辞書オブジェクト dictionary object.
                                                             (line  357)
* PyDict_WatchCallback (C type):         辞書オブジェクト dictionary object.
                                                             (line  385)
* PyDict_WatchEvent (C type):            辞書オブジェクト dictionary object.
                                                             (line  376)
* PyDictItems_Check (C function):        Dictionary View Objects.
                                                             (line   38)
* PyDictItems_Type (C var):              Dictionary View Objects.
                                                             (line   33)
* PyDictIterItem_Type (C var):           Other Iterator Objects.
                                                             (line   42)
* PyDictIterKey_Type (C var):            Other Iterator Objects.
                                                             (line   30)
* PyDictIterValue_Type (C var):          Other Iterator Objects.
                                                             (line   36)
* PyDictKeys_Check (C function):         Dictionary View Objects.
                                                             (line   18)
* PyDictKeys_Type (C var):               Dictionary View Objects.
                                                             (line   13)
* PyDictObject (C type):                 辞書オブジェクト dictionary object.
                                                             (line    6)
* PyDictProxy_New (C function):          辞書オブジェクト dictionary object.
                                                             (line   30)
* PyDictProxy_Type (C var):              辞書オブジェクト dictionary object.
                                                             (line   37)
* PyDictRevIterItem_Type (C var):        Other Iterator Objects.
                                                             (line   45)
* PyDictRevIterKey_Type (C var):         Other Iterator Objects.
                                                             (line   33)
* PyDictRevIterValue_Type (C var):       Other Iterator Objects.
                                                             (line   39)
* PyDictValues_Check (C function):       Dictionary View Objects.
                                                             (line   28)
* PyDictValues_Type (C var):             Dictionary View Objects.
                                                             (line   23)
* PyDictViewSet_Check (C function):      Dictionary View Objects.
                                                             (line    6)
* PyDLL (ctypes のクラス):               共有ライブラリをロードする.
                                                             (line   69)
* PyDoc_STR (C macro):                   Docstring macros.   (line   24)
* PyDoc_STRVAR (C macro):                Docstring macros.   (line    6)
* PyDoc_VAR (C macro):                   Docstring macros.   (line   37)
* PyEllipsis_Type (C var):               Ellipsis オブジェクト<2>.
                                                             (line    6)
* PyEnum_Type (C var):                   Builtin Iterator Types.
                                                             (line   13)
* PyErr_BadArgument (C function):        例外の送出.         (line   45)
* PyErr_BadInternalCall (C function):    例外の送出.         (line  226)
* PyErr_CheckSignals (C function):       シグナルハンドリング<2>.
                                                             (line    6)
* PyErr_Clear (C function):              例外<24>.           (line   24)
* PyErr_Clear (C function) <1>:          例外<24>.           (line  123)
* PyErr_Clear (C function) <2>:          出力とクリア.       (line    6)
* PyErr_DisplayException (C function):   出力とクリア.       (line   68)
* PyErr_ExceptionMatches (C function):   例外<24>.           (line  123)
* PyErr_ExceptionMatches (C function) <1>: エラーインジケータの問い合わせ.
                                                             (line   22)
* PyErr_Fetch (C function):              ファイナライズとメモリ解放.
                                                             (line   35)
* PyErr_Fetch (C function) <1>:          エラーインジケータの問い合わせ.
                                                             (line   73)
* PyErr_Format (C function):             例外の送出.         (line   24)
* PyErr_FormatUnraisable (C function):   出力とクリア.       (line   57)
* PyErr_FormatV (C function):            例外の送出.         (line   33)
* PyErr_GetExcInfo (C function):         エラーインジケータの問い合わせ.
                                                             (line  178)
* PyErr_GetHandledException (C function): エラーインジケータの問い合わせ.
                                                             (line  148)
* PyErr_GetRaisedException (C function): エラーインジケータの問い合わせ.
                                                             (line   36)
* PyErr_GivenExceptionMatches (C function): エラーインジケータの問い合わせ.
                                                             (line   28)
* PyErr_NewException (C function):       例外クラス<2>.      (line    6)
* PyErr_NewExceptionWithDoc (C function): 例外クラス<2>.     (line   24)
* PyErr_NoMemory (C function):           例外の送出.         (line   51)
* PyErr_NormalizeException (C function): エラーインジケータの問い合わせ.
                                                             (line  125)
* PyErr_Occurred (C function):           例外<24>.           (line   12)
* PyErr_Occurred (C function) <1>:       エラーインジケータの問い合わせ.
                                                             (line    6)
* PyErr_Print (C function):              出力とクリア.       (line   31)
* PyErr_PrintEx (C function):            出力とクリア.       (line   11)
* PyErr_ProgramText (C function):        例外の送出.         (line  243)
* PyErr_ProgramTextObject (C function):  例外の送出.         (line  233)
* PyErr_RangedSyntaxLocationObject (C function): 例外の送出. (line  200)
* PyErr_ResourceWarning (C function):    警告<3>.            (line   80)
* PyErr_Restore (C function):            ファイナライズとメモリ解放.
                                                             (line   35)
* PyErr_Restore (C function) <1>:        エラーインジケータの問い合わせ.
                                                             (line  102)
* PyErr_SetExcFromWindowsErr (C function): 例外の送出.       (line  114)
* PyErr_SetExcFromWindowsErrWithFilename (C function): 例外の送出.
                                                             (line  159)
* PyErr_SetExcFromWindowsErrWithFilenameObject (C function): 例外の送出.
                                                             (line  135)
* PyErr_SetExcFromWindowsErrWithFilenameObjects (C function): 例外の送出.
                                                             (line  147)
* PyErr_SetExcInfo (C function):         エラーインジケータの問い合わせ.
                                                             (line  197)
* PyErr_SetFromErrno (C function):       例外の送出.         (line   57)
* PyErr_SetFromErrnoWithFilename (C function): 例外の送出.   (line   91)
* PyErr_SetFromErrnoWithFilenameObject (C function): 例外の送出.
                                                             (line   72)
* PyErr_SetFromErrnoWithFilenameObjects (C function): 例外の送出.
                                                             (line   81)
* PyErr_SetFromWindowsErr (C function):  例外の送出.         (line   99)
* PyErr_SetFromWindowsErrWithFilename (C function): 例外の送出.
                                                             (line  123)
* PyErr_SetHandledException (C function): エラーインジケータの問い合わせ.
                                                             (line  164)
* PyErr_SetImportError (C function):     例外の送出.         (line  169)
* PyErr_SetImportErrorSubclass (C function): 例外の送出.     (line  180)
* PyErr_SetInterrupt (C function):       シグナルハンドリング<2>.
                                                             (line   33)
* PyErr_SetInterruptEx (C function):     シグナルハンドリング<2>.
                                                             (line   43)
* PyErr_SetNone (C function):            例外の送出.         (line   41)
* PyErr_SetObject (C function):          例外の送出.         (line   19)
* PyErr_SetRaisedException (C function): エラーインジケータの問い合わせ.
                                                             (line   63)
* PyErr_SetString (C function):          例外<24>.           (line   24)
* PyErr_SetString (C function) <1>:      例外の送出.         (line   10)
* PyErr_SyntaxLocation (C function):     例外の送出.         (line  220)
* PyErr_SyntaxLocationEx (C function):   例外の送出.         (line  210)
* PyErr_SyntaxLocationObject (C function): 例外の送出.       (line  190)
* PyErr_WarnEx (C function):             警告<3>.            (line   17)
* PyErr_WarnExplicit (C function):       警告<3>.            (line   51)
* PyErr_WarnExplicitFormat (C function): 警告<3>.            (line   70)
* PyErr_WarnExplicitObject (C function): 警告<3>.            (line   39)
* PyErr_WarnFormat (C function):         警告<3>.            (line   61)
* PyErr_WriteUnraisable (C function):    出力とクリア.       (line   35)
* PyEval_AcquireThread (C function):     低レベルAPI.        (line  275)
* PyEval_AcquireThread():                高レベルAPI.        (line   35)
* PyEval_EvalCode (C function):          超高水準レイヤ.     (line  262)
* PyEval_EvalCodeEx (C function):        超高水準レイヤ.     (line  269)
* PyEval_EvalFrame (C function):         超高水準レイヤ.     (line  281)
* PyEval_EvalFrameEx (C function):       超高水準レイヤ.     (line  286)
* PyEval_GetBuiltins (C function):       リフレクション.     (line    6)
* PyEval_GetFrame (C function):          リフレクション.     (line   55)
* PyEval_GetFrameBuiltins (C function):  リフレクション.     (line   62)
* PyEval_GetFrameGlobals (C function):   リフレクション.     (line   84)
* PyEval_GetFrameLocals (C function):    リフレクション.     (line   70)
* PyEval_GetFuncDesc (C function):       リフレクション.     (line   98)
* PyEval_GetFuncName (C function):       リフレクション.     (line   93)
* PyEval_GetGlobals (C function):        リフレクション.     (line   46)
* PyEval_GetLocals (C function):         リフレクション.     (line   15)
* PyEval_InitThreads (C function):       高レベルAPI.        (line   34)
* PyEval_InitThreads():                  インタープリタの初期化と終了処理.
                                                             (line    7)
* PyEval_MergeCompilerFlags (C function): 超高水準レイヤ.    (line  300)
* PyEval_ReleaseThread (C function):     低レベルAPI.        (line  300)
* PyEval_ReleaseThread():                高レベルAPI.        (line   35)
* PyEval_RestoreThread (C function):     Detaching the thread state from extension code.
                                                             (line   32)
* PyEval_RestoreThread (C function) <1>: 高レベルAPI.        (line   57)
* PyEval_RestoreThread():                高レベルAPI.        (line   35)
* PyEval_SaveThread (C function):        Detaching the thread state from extension code.
                                                             (line   32)
* PyEval_SaveThread (C function) <1>:    高レベルAPI.        (line   52)
* PyEval_SaveThread():                   高レベルAPI.        (line   35)
* PyEval_SetProfile (C function):        プロファイルとトレース profiling and tracing.
                                                             (line  118)
* PyEval_SetProfileAllThreads (C function): プロファイルとトレース profiling and tracing.
                                                             (line  132)
* PyEval_SetTrace (C function):          プロファイルとトレース profiling and tracing.
                                                             (line  147)
* PyEval_SetTraceAllThreads (C function): プロファイルとトレース profiling and tracing.
                                                             (line  162)
* PyExc_ArithmeticError (C var):         Exception types.    (line   22)
* PyExc_AssertionError (C var):          Exception types.    (line   26)
* PyExc_AttributeError (C var):          Exception types.    (line   30)
* PyExc_BaseException (C var):           Exception types.    (line   10)
* PyExc_BaseExceptionGroup (C var):      Exception types.    (line   14)
* PyExc_BlockingIOError (C var):         Exception types.    (line   34)
* PyExc_BrokenPipeError (C var):         Exception types.    (line   39)
* PyExc_BufferError (C var):             Exception types.    (line   44)
* PyExc_BytesWarning (C var):            Warning types.      (line   13)
* PyExc_ChildProcessError (C var):       Exception types.    (line   47)
* PyExc_ConnectionAbortedError (C var):  Exception types.    (line   52)
* PyExc_ConnectionError (C var):         Exception types.    (line   57)
* PyExc_ConnectionRefusedError (C var):  Exception types.    (line   62)
* PyExc_ConnectionResetError (C var):    Exception types.    (line   67)
* PyExc_DeprecationWarning (C var):      Warning types.      (line   16)
* PyExc_EncodingWarning (C var):         Warning types.      (line   20)
* PyExc_EnvironmentError (C var):        OSError aliases.    (line   15)
* PyExc_EOFError (C var):                Exception types.    (line   72)
* PyExc_Exception (C var):               Exception types.    (line   19)
* PyExc_FileExistsError (C var):         Exception types.    (line   75)
* PyExc_FileNotFoundError (C var):       Exception types.    (line   80)
* PyExc_FloatingPointError (C var):      Exception types.    (line   85)
* PyExc_FutureWarning (C var):           Warning types.      (line   25)
* PyExc_GeneratorExit (C var):           Exception types.    (line   89)
* PyExc_ImportError (C var):             Exception types.    (line   93)
* PyExc_ImportWarning (C var):           Warning types.      (line   29)
* PyExc_IndentationError (C var):        Exception types.    (line   96)
* PyExc_IndexError (C var):              Exception types.    (line  100)
* PyExc_InterruptedError (C var):        Exception types.    (line  103)
* PyExc_IOError (C var):                 OSError aliases.    (line   20)
* PyExc_IsADirectoryError (C var):       Exception types.    (line  108)
* PyExc_KeyboardInterrupt (C var):       Exception types.    (line  116)
* PyExc_KeyError (C var):                Exception types.    (line  113)
* PyExc_LookupError (C var):             Exception types.    (line  120)
* PyExc_MemoryError (C var):             Exception types.    (line  123)
* PyExc_ModuleNotFoundError (C var):     Exception types.    (line  126)
* PyExc_NameError (C var):               Exception types.    (line  131)
* PyExc_NotADirectoryError (C var):      Exception types.    (line  134)
* PyExc_NotImplementedError (C var):     Exception types.    (line  139)
* PyExc_OSError (C var):                 Exception types.    (line  143)
* PyExc_OverflowError (C var):           Exception types.    (line  146)
* PyExc_PendingDeprecationWarning (C var): Warning types.    (line   33)
* PyExc_PermissionError (C var):         Exception types.    (line  150)
* PyExc_ProcessLookupError (C var):      Exception types.    (line  155)
* PyExc_PythonFinalizationError (C var): Exception types.    (line  160)
* PyExc_RecursionError (C var):          Exception types.    (line  163)
* PyExc_ReferenceError (C var):          Exception types.    (line  168)
* PyExc_ResourceWarning (C var):         Warning types.      (line   37)
* PyExc_RuntimeError (C var):            Exception types.    (line  172)
* PyExc_RuntimeWarning (C var):          Warning types.      (line   42)
* PyExc_StopAsyncIteration (C var):      Exception types.    (line  175)
* PyExc_StopIteration (C var):           Exception types.    (line  180)
* PyExc_SyntaxError (C var):             Exception types.    (line  184)
* PyExc_SyntaxWarning (C var):           Warning types.      (line   46)
* PyExc_SystemError (C var):             Exception types.    (line  187)
* PyExc_SystemExit (C var):              Exception types.    (line  190)
* PyExc_TabError (C var):                Exception types.    (line  193)
* PyExc_TimeoutError (C var):            Exception types.    (line  196)
* PyExc_TypeError (C var):               Exception types.    (line  200)
* PyExc_UnboundLocalError (C var):       Exception types.    (line  203)
* PyExc_UnicodeDecodeError (C var):      Exception types.    (line  207)
* PyExc_UnicodeEncodeError (C var):      Exception types.    (line  211)
* PyExc_UnicodeError (C var):            Exception types.    (line  215)
* PyExc_UnicodeTranslateError (C var):   Exception types.    (line  218)
* PyExc_UnicodeWarning (C var):          Warning types.      (line   50)
* PyExc_UserWarning (C var):             Warning types.      (line   54)
* PyExc_ValueError (C var):              Exception types.    (line  222)
* PyExc_Warning (C var):                 Warning types.      (line   10)
* PyExc_WindowsError (C var):            OSError aliases.    (line   25)
* PyExc_ZeroDivisionError (C var):       Exception types.    (line  225)
* PyException_GetArgs (C function):      例外オブジェクト.   (line   58)
* PyException_GetCause (C function):     例外オブジェクト.   (line   42)
* PyException_GetContext (C function):   例外オブジェクト.   (line   27)
* PyException_GetTraceback (C function): 例外オブジェクト.   (line   15)
* PyException_SetArgs (C function):      例外オブジェクト.   (line   62)
* PyException_SetCause (C function):     例外オブジェクト.   (line   49)
* PyException_SetContext (C function):   例外オブジェクト.   (line   36)
* PyException_SetTraceback (C function): 例外オブジェクト.   (line   22)
* PyExceptionClass_Check (C function):   例外クラス<2>.      (line   33)
* PyExceptionClass_Name (C function):    例外クラス<2>.      (line   38)
* PyExceptionInstance_Check (C function): 例外オブジェクト.  (line    6)
* PyExceptionInstance_Class (C macro):   例外オブジェクト.   (line   11)
* PyFile_FromFd (C function):            ファイルオブジェクト.
                                                             (line   15)
* PyFile_GetLine (C function):           ファイルオブジェクト.
                                                             (line   41)
* PyFile_NewStdPrinter (C function):     Deprecated API<4>.  (line   10)
* PyFile_OpenCode (C function):          ファイルオブジェクト.
                                                             (line  107)
* PyFile_OpenCodeObject (C function):    ファイルオブジェクト.
                                                             (line   91)
* PyFile_SetOpenCodeHook (C function):   ファイルオブジェクト.
                                                             (line   54)
* PyFile_WriteObject (C function):       ファイルオブジェクト.
                                                             (line  114)
* PyFile_WriteString (C function):       ファイルオブジェクト.
                                                             (line  125)
* PyFilter_Type (C var):                 Builtin Iterator Types.
                                                             (line   16)
* PyFloat_AS_DOUBLE (C function):        Floating-Point Objects.
                                                             (line   50)
* PyFloat_AsDouble (C function):         Floating-Point Objects.
                                                             (line   37)
* PyFloat_Check (C function):            Floating-Point Objects.
                                                             (line   16)
* PyFloat_CheckExact (C function):       Floating-Point Objects.
                                                             (line   21)
* PyFloat_FromDouble (C function):       Floating-Point Objects.
                                                             (line   32)
* PyFloat_FromString (C function):       Floating-Point Objects.
                                                             (line   27)
* PyFloat_GetInfo (C function):          Floating-Point Objects.
                                                             (line   55)
* PyFloat_GetMax (C function):           Floating-Point Objects.
                                                             (line   60)
* PyFloat_GetMin (C function):           Floating-Point Objects.
                                                             (line   64)
* PyFloat_Pack2 (C function):            Pack functions.     (line   22)
* PyFloat_Pack4 (C function):            Pack functions.     (line   26)
* PyFloat_Pack8 (C function):            Pack functions.     (line   30)
* PyFloat_Type (C var):                  Floating-Point Objects.
                                                             (line   11)
* PyFloat_Unpack2 (C function):          Unpack functions.   (line   20)
* PyFloat_Unpack4 (C function):          Unpack functions.   (line   24)
* PyFloat_Unpack8 (C function):          Unpack functions.   (line   28)
* PyFloatObject (C type):                Floating-Point Objects.
                                                             (line    6)
* PyFrame_Check (C function):            フレーム frame オブジェクト<2>.
                                                             (line   38)
* PyFrame_FastToLocals (C function):     Legacy Local Variable APIs.
                                                             (line   21)
* PyFrame_FastToLocalsWithError (C function): Legacy Local Variable APIs.
                                                             (line   32)
* PyFrame_GetBack (C function):          フレーム frame オブジェクト<2>.
                                                             (line   45)
* PyFrame_GetBuiltins (C function):      フレーム frame オブジェクト<2>.
                                                             (line   54)
* PyFrame_GetCode (C function):          フレーム frame オブジェクト<2>.
                                                             (line   63)
* PyFrame_GetGenerator (C function):     フレーム frame オブジェクト<2>.
                                                             (line   74)
* PyFrame_GetGlobals (C function):       フレーム frame オブジェクト<2>.
                                                             (line   85)
* PyFrame_GetLasti (C function):         フレーム frame オブジェクト<2>.
                                                             (line   94)
* PyFrame_GetLineNumber (C function):    フレーム frame オブジェクト<2>.
                                                             (line  141)
* PyFrame_GetLocals (C function):        フレーム frame オブジェクト<2>.
                                                             (line  125)
* PyFrame_GetVar (C function):           フレーム frame オブジェクト<2>.
                                                             (line  102)
* PyFrame_GetVarString (C function):     フレーム frame オブジェクト<2>.
                                                             (line  118)
* PyFrame_LocalsToFast (C function):     Legacy Local Variable APIs.
                                                             (line    9)
* PyFrame_New (C function):              フレーム frame オブジェクト<2>.
                                                             (line   30)
* PyFrame_Type (C var):                  フレーム frame オブジェクト<2>.
                                                             (line   22)
* PyFrameLocalsProxy_Check (C function): Frame Locals Proxies.
                                                             (line   20)
* PyFrameLocalsProxy_Type (C var):       Frame Locals Proxies.
                                                             (line   16)
* PyFrameObject (C type):                フレーム frame オブジェクト<2>.
                                                             (line    6)
* PyFrozenSet_Check (C function):        Set オブジェクト.   (line   47)
* PyFrozenSet_CheckExact (C function):   Set オブジェクト.   (line   71)
* PyFrozenSet_New (C function):          Set オブジェクト.   (line   84)
* PyFrozenSet_Type (C var):              Set オブジェクト.   (line   33)
* PyFunction_AddWatcher (C function):    Function オブジェクト<3>.
                                                             (line  146)
* PyFunction_Check (C function):         Function オブジェクト<3>.
                                                             (line   18)
* PyFunction_ClearWatcher (C function):  Function オブジェクト<3>.
                                                             (line  156)
* PyFunction_GET_ANNOTATIONS (C function): Function オブジェクト<3>.
                                                             (line  129)
* PyFunction_GET_CLOSURE (C function):   Function オブジェクト<3>.
                                                             (line  129)
* PyFunction_GET_CODE (C function):      Function オブジェクト<3>.
                                                             (line  129)
* PyFunction_GET_DEFAULTS (C function):  Function オブジェクト<3>.
                                                             (line  129)
* PyFunction_GET_GLOBALS (C function):   Function オブジェクト<3>.
                                                             (line  129)
* PyFunction_GET_KW_DEFAULTS (C function): Function オブジェクト<3>.
                                                             (line  129)
* PyFunction_GET_MODULE (C function):    Function オブジェクト<3>.
                                                             (line  129)
* PyFunction_GetAnnotations (C function): Function オブジェクト<3>.
                                                             (line  115)
* PyFunction_GetClosure (C function):    Function オブジェクト<3>.
                                                             (line  102)
* PyFunction_GetCode (C function):       Function オブジェクト<3>.
                                                             (line   46)
* PyFunction_GetDefaults (C function):   Function オブジェクト<3>.
                                                             (line   62)
* PyFunction_GetGlobals (C function):    Function オブジェクト<3>.
                                                             (line   50)
* PyFunction_GetKwDefaults (C function): Function オブジェクト<3>.
                                                             (line   86)
* PyFunction_GetModule (C function):     Function オブジェクト<3>.
                                                             (line   54)
* PyFunction_New (C function):           Function オブジェクト<3>.
                                                             (line   24)
* PyFunction_NewWithQualName (C function): Function オブジェクト<3>.
                                                             (line   36)
* PyFunction_SetAnnotations (C function): Function オブジェクト<3>.
                                                             (line  120)
* PyFunction_SetClosure (C function):    Function オブジェクト<3>.
                                                             (line  106)
* PyFunction_SetDefaults (C function):   Function オブジェクト<3>.
                                                             (line   67)
* PyFunction_SetKwDefaults (C function): Function オブジェクト<3>.
                                                             (line   92)
* PyFunction_SetVectorcall (C function): Function オブジェクト<3>.
                                                             (line   76)
* PyFunction_Type (C var):               Function オブジェクト<3>.
                                                             (line   12)
* PyFunction_WatchCallback (C type):     Function オブジェクト<3>.
                                                             (line  181)
* PyFunction_WatchEvent (C type):        Function オブジェクト<3>.
                                                             (line  165)
* PyFunctionObject (C type):             Function オブジェクト<3>.
                                                             (line    8)
* PYFUNCTYPE() (ctypes モジュール):      関数プロトタイプ.   (line   33)
* PyGC_Collect (C function):             Controlling the Garbage Collector State.
                                                             (line    9)
* PyGC_Disable (C function):             Controlling the Garbage Collector State.
                                                             (line   27)
* PyGC_Enable (C function):              Controlling the Garbage Collector State.
                                                             (line   20)
* PyGC_IsEnabled (C function):           Controlling the Garbage Collector State.
                                                             (line   34)
* PyGen_Check (C function):              ジェネレータオブジェクト.
                                                             (line   19)
* PyGen_CheckExact (C function):         ジェネレータオブジェクト.
                                                             (line   24)
* PyGen_GetCode (C function):            ジェネレータオブジェクト.
                                                             (line   41)
* PyGen_New (C function):                ジェネレータオブジェクト.
                                                             (line   29)
* PyGen_NewWithQualName (C function):    ジェネレータオブジェクト.
                                                             (line   34)
* PyGen_Type (C var):                    ジェネレータオブジェクト.
                                                             (line   15)
* PyGenObject (C type):                  ジェネレータオブジェクト.
                                                             (line   11)
* PyGetSetDef (C type):                  Defining Getters and Setters.
                                                             (line    6)
* PyGetSetDef.closure (C member):        Defining Getters and Setters.
                                                             (line   28)
* PyGetSetDef.doc (C member):            Defining Getters and Setters.
                                                             (line   24)
* PyGetSetDef.get (C member):            Defining Getters and Setters.
                                                             (line   15)
* PyGetSetDef.name (C member):           Defining Getters and Setters.
                                                             (line   11)
* PyGetSetDef.set (C member):            Defining Getters and Setters.
                                                             (line   19)
* PyGetSetDescr_Type (C var):            デスクリプタオブジェクト descriptor object.
                                                             (line   29)
* PyGILState_Check (C function):         高レベルAPI.        (line  190)
* PyGILState_Ensure (C function):        高レベルAPI.        (line  126)
* PyGILState_GetThisThreadState (C function): 高レベルAPI.   (line  171)
* PyGILState_Release (C function):       高レベルAPI.        (line  160)
* PyGILState_STATE (C type):             高レベルAPI.        (line  111)
* PyGILState_STATE.PyGILState_LOCKED (C enumerator): 高レベルAPI.
                                                             (line  116)
* PyGILState_STATE.PyGILState_UNLOCKED (C enumerator): 高レベルAPI.
                                                             (line  121)
* PyHASH_BITS (C macro):                 PyHash API.         (line   73)
* PyHash_FuncDef (C type):               PyHash API.         (line  101)
* PyHash_FuncDef.hash (C member):        PyHash API.         (line  105)
* PyHash_FuncDef.hash_bits (C member):   PyHash API.         (line  117)
* PyHash_FuncDef.name (C member):        PyHash API.         (line  110)
* PyHash_FuncDef.seed_bits (C member):   PyHash API.         (line  124)
* PyHash_GetFuncDef (C function):        PyHash API.         (line  133)
* PyHASH_IMAG (C macro):                 PyHash API.         (line   93)
* PyHASH_INF (C macro):                  PyHash API.         (line   85)
* PyHASH_MODULUS (C macro):              PyHash API.         (line   64)
* PyHASH_MULTIPLIER (C macro):           PyHash API.         (line   79)
* PyImport_AddModule (C function):       モジュールのインポート<2>.
                                                             (line  121)
* PyImport_AddModuleObject (C function): モジュールのインポート<2>.
                                                             (line  112)
* PyImport_AddModuleRef (C function):    モジュールのインポート<2>.
                                                             (line   89)
* PyImport_AppendInittab (C function):   モジュールのインポート<2>.
                                                             (line  298)
* PyImport_ExecCodeModule (C function):  モジュールのインポート<2>.
                                                             (line  127)
* PyImport_ExecCodeModuleEx (C function): モジュールのインポート<2>.
                                                             (line  166)
* PyImport_ExecCodeModuleObject (C function): モジュールのインポート<2>.
                                                             (line  176)
* PyImport_ExecCodeModuleWithPathnames (C function): モジュールのインポート<2>.
                                                             (line  190)
* PyImport_ExtendInittab (C function):   モジュールのインポート<2>.
                                                             (line  325)
* PyImport_FrozenModules (C var):        モジュールのインポート<2>.
                                                             (line  289)
* PyImport_GetImporter (C function):     モジュールのインポート<2>.
                                                             (line  237)
* PyImport_GetMagicNumber (C function):  モジュールのインポート<2>.
                                                             (line  207)
* PyImport_GetMagicTag (C function):     モジュールのインポート<2>.
                                                             (line  215)
* PyImport_GetModule (C function):       モジュールのインポート<2>.
                                                             (line  228)
* PyImport_GetModuleDict (C function):   モジュールのインポート<2>.
                                                             (line  223)
* PyImport_Import (C function):          モジュールのインポート<2>.
                                                             (line   72)
* PyImport_ImportFrozenModule (C function): モジュールのインポート<2>.
                                                             (line  265)
* PyImport_ImportFrozenModuleObject (C function): モジュールのインポート<2>.
                                                             (line  250)
* PyImport_ImportModule (C function):    モジュールのインポート<2>.
                                                             (line    6)
* PyImport_ImportModuleAttr (C function): モジュールのインポート<2>.
                                                             (line  346)
* PyImport_ImportModuleAttrString (C function): モジュールのインポート<2>.
                                                             (line  360)
* PyImport_ImportModuleEx (C function):  モジュールのインポート<2>.
                                                             (line   27)
* PyImport_ImportModuleLevel (C function): モジュールのインポート<2>.
                                                             (line   62)
* PyImport_ImportModuleLevelObject (C function): モジュールのインポート<2>.
                                                             (line   45)
* PyImport_ImportModuleNoBlock (C function): モジュールのインポート<2>.
                                                             (line   13)
* PyImport_Inittab (C var):              モジュールのインポート<2>.
                                                             (line  340)
* PyImport_ReloadModule (C function):    モジュールのインポート<2>.
                                                             (line   82)
* PyIndex_Check (C function):            数値型プロトコル number protocol.
                                                             (line  280)
* PyInit_modulename (C function):        初期化関数.         (line    8)
* PyInitConfig (C struct):               設定の作成.         (line    6)
* PyInitConfig_AddModule (C function):   Module.             (line    6)
* PyInitConfig_Create (C function):      設定の作成.         (line   10)
* PyInitConfig_Free (C function):        設定の作成.         (line   19)
* PyInitConfig_FreeStrList (C function): Get Options.        (line   55)
* PyInitConfig_GetError (C function):    エラー処理<2>.      (line    6)
* PyInitConfig_GetExitCode (C function): エラー処理<2>.      (line   24)
* PyInitConfig_GetInt (C function):      Get Options.        (line   17)
* PyInitConfig_GetStr (C function):      Get Options.        (line   26)
* PyInitConfig_GetStrList (C function):  Get Options.        (line   42)
* PyInitConfig_HasOption (C function):   Get Options.        (line   10)
* PyInitConfig_SetInt (C function):      Set Options.        (line   15)
* PyInitConfig_SetStr (C function):      Set Options.        (line   24)
* PyInitConfig_SetStrList (C function):  Set Options.        (line   34)
* PyInstanceMethod_Check (C function):   インスタンスメソッドオブジェクト Instance Method Objects.
                                                             (line   16)
* PyInstanceMethod_Function (C function): インスタンスメソッドオブジェクト Instance Method Objects.
                                                             (line   28)
* PyInstanceMethod_GET_FUNCTION (C function): インスタンスメソッドオブジェクト Instance Method Objects.
                                                             (line   33)
* PyInstanceMethod_New (C function):     インスタンスメソッドオブジェクト Instance Method Objects.
                                                             (line   22)
* PyInstanceMethod_Type (C var):         インスタンスメソッドオブジェクト Instance Method Objects.
                                                             (line   10)
* PyInterpreterConfig (C type):          サブインタプリタサポート.
                                                             (line   21)
* PyInterpreterConfig_DEFAULT_GIL (C macro): サブインタプリタサポート.
                                                             (line   90)
* PyInterpreterConfig_OWN_GIL (C macro): サブインタプリタサポート.
                                                             (line   99)
* PyInterpreterConfig_SHARED_GIL (C macro): サブインタプリタサポート.
                                                             (line   95)
* PyInterpreterConfig.allow_daemon_threads (C member): サブインタプリタサポート.
                                                             (line   66)
* PyInterpreterConfig.allow_exec (C member): サブインタプリタサポート.
                                                             (line   51)
* PyInterpreterConfig.allow_fork (C member): サブインタプリタサポート.
                                                             (line   42)
* PyInterpreterConfig.allow_threads (C member): サブインタプリタサポート.
                                                             (line   61)
* PyInterpreterConfig.check_multi_interp_extensions (C member): サブインタプリタサポート.
                                                             (line   73)
* PyInterpreterConfig.gil (C member):    サブインタプリタサポート.
                                                             (line   85)
* PyInterpreterConfig.use_main_obmalloc (C member): サブインタプリタサポート.
                                                             (line   32)
* PyInterpreterState (C type):           高レベルAPI.        (line    9)
* PyInterpreterState_Clear (C function): 低レベルAPI.        (line   21)
* PyInterpreterState_Delete (C function): 低レベルAPI.       (line   29)
* PyInterpreterState_Get (C function):   低レベルAPI.        (line  180)
* PyInterpreterState_GetDict (C function): 低レベルAPI.      (line  200)
* PyInterpreterState_GetID (C function): 低レベルAPI.        (line  190)
* PyInterpreterState_Head (C function):  高度なデバッガサポート advanced debugger support.
                                                             (line    8)
* PyInterpreterState_Main (C function):  高度なデバッガサポート advanced debugger support.
                                                             (line   13)
* PyInterpreterState_New (C function):   低レベルAPI.        (line   12)
* PyInterpreterState_Next (C function):  高度なデバッガサポート advanced debugger support.
                                                             (line   17)
* PyInterpreterState_ThreadHead (C function): 高度なデバッガサポート advanced debugger support.
                                                             (line   23)
* PyIter_Check (C function):             イテレータプロトコル iterator protocol.
                                                             (line    8)
* PyIter_Next (C function):              イテレータプロトコル iterator protocol.
                                                             (line   30)
* PyIter_NextItem (C function):          イテレータプロトコル iterator protocol.
                                                             (line   21)
* PyIter_Send (C function):              イテレータプロトコル iterator protocol.
                                                             (line   48)
* PYLAUNCHER_ALLOW_INSTALL:              Windows<17>.        (line   24)
* PYLAUNCHER_ALLOW_INSTALL <1>:          Windows<31>.        (line   15)
* PyList_Append (C function):            リストオブジェクト. (line  107)
* PyList_AsTuple (C function):           リストオブジェクト. (line  162)
* PyList_Check (C function):             リストオブジェクト. (line   16)
* PyList_CheckExact (C function):        リストオブジェクト. (line   21)
* PyList_Clear (C function):             リストオブジェクト. (line  141)
* PyList_Extend (C function):            リストオブジェクト. (line  130)
* PyList_GET_ITEM (C function):          リストオブジェクト. (line   68)
* PyList_GET_SIZE (C function):          リストオブジェクト. (line   46)
* PyList_GetItem (C function):           参照カウントの詳細. (line  115)
* PyList_GetItem (C function) <1>:       リストオブジェクト. (line   62)
* PyList_GetItemRef (C function):        リストオブジェクト. (line   51)
* PyList_GetSlice (C function):          リストオブジェクト. (line  113)
* PyList_Insert (C function):            リストオブジェクト. (line  100)
* PyList_New (C function):               リストオブジェクト. (line   26)
* PyList_Reverse (C function):           リストオブジェクト. (line  157)
* PyList_SET_ITEM (C function):          リストオブジェクト. (line   84)
* PyList_SetItem (C function):           参照カウントの詳細. (line   26)
* PyList_SetItem (C function) <1>:       リストオブジェクト. (line   73)
* PyList_SetSlice (C function):          リストオブジェクト. (line  121)
* PyList_Size (C function):              リストオブジェクト. (line   40)
* PyList_Sort (C function):              リストオブジェクト. (line  152)
* PyList_Type (C var):                   リストオブジェクト. (line   11)
* PyListIter_Type (C var):               Other Iterator Objects.
                                                             (line   12)
* PyListObject (C type):                 リストオブジェクト. (line    6)
* PyListRevIter_Type (C var):            Other Iterator Objects.
                                                             (line   15)
* PyLockStatus (C type):                 Legacy Locking APIs.
                                                             (line   16)
* PyLong_AS_LONG (C function):           整数型オブジェクト integer object.
                                                             (line  184)
* PyLong_AsDouble (C function):          整数型オブジェクト integer object.
                                                             (line  395)
* PyLong_AsInt (C function):             整数型オブジェクト integer object.
                                                             (line  192)
* PyLong_AsInt32 (C function):           整数型オブジェクト integer object.
                                                             (line  353)
* PyLong_AsInt64 (C function):           整数型オブジェクト integer object.
                                                             (line  353)
* PyLong_AsLong (C function):            整数型オブジェクト integer object.
                                                             (line  164)
* PyLong_AsLongAndOverflow (C function): 整数型オブジェクト integer object.
                                                             (line  199)
* PyLong_AsLongLong (C function):        整数型オブジェクト integer object.
                                                             (line  220)
* PyLong_AsLongLongAndOverflow (C function): 整数型オブジェクト integer object.
                                                             (line  240)
* PyLong_AsNativeBytes (C function):     整数型オブジェクト integer object.
                                                             (line  416)
* PyLong_AsPid (C macro):                整数型オブジェクト integer object.
                                                             (line  578)
* PyLong_AsSize_t (C function):          整数型オブジェクト integer object.
                                                             (line  287)
* PyLong_AsSsize_t (C function):         整数型オブジェクト integer object.
                                                             (line  263)
* PyLong_AsUInt32 (C function):          整数型オブジェクト integer object.
                                                             (line  373)
* PyLong_AsUInt64 (C function):          整数型オブジェクト integer object.
                                                             (line  373)
* PyLong_AsUnsignedLong (C function):    整数型オブジェクト integer object.
                                                             (line  275)
* PyLong_AsUnsignedLongLong (C function): 整数型オブジェクト integer object.
                                                             (line  299)
* PyLong_AsUnsignedLongLongMask (C function): 整数型オブジェクト integer object.
                                                             (line  334)
* PyLong_AsUnsignedLongMask (C function): 整数型オブジェクト integer object.
                                                             (line  316)
* PyLong_AsVoidPtr (C function):         整数型オブジェクト integer object.
                                                             (line  406)
* PyLong_BASE (C macro):                 Deprecated API.     (line   20)
* PyLong_Check (C function):             整数型オブジェクト integer object.
                                                             (line   21)
* PyLong_CheckExact (C function):        整数型オブジェクト integer object.
                                                             (line   26)
* PyLong_Export (C function):            Export API.         (line   89)
* PyLong_FreeExport (C function):        Export API.         (line  106)
* PyLong_FromDouble (C function):        整数型オブジェクト integer object.
                                                             (line   84)
* PyLong_FromInt32 (C function):         整数型オブジェクト integer object.
                                                             (line   62)
* PyLong_FromInt64 (C function):         整数型オブジェクト integer object.
                                                             (line   62)
* PyLong_FromLong (C function):          整数型オブジェクト integer object.
                                                             (line   31)
* PyLong_FromLongLong (C function):      整数型オブジェクト integer object.
                                                             (line   57)
* PyLong_FromNativeBytes (C function):   整数型オブジェクト integer object.
                                                             (line  125)
* PyLong_FromPid (C macro):              整数型オブジェクト integer object.
                                                             (line  154)
* PyLong_FromSize_t (C function):        整数型オブジェクト integer object.
                                                             (line   52)
* PyLong_FromSsize_t (C function):       整数型オブジェクト integer object.
                                                             (line   47)
* PyLong_FromString (C function):        整数型オブジェクト integer object.
                                                             (line   89)
* PyLong_FromUInt32 (C function):        整数型オブジェクト integer object.
                                                             (line   76)
* PyLong_FromUInt64 (C function):        整数型オブジェクト integer object.
                                                             (line   76)
* PyLong_FromUnicodeObject (C function): 整数型オブジェクト integer object.
                                                             (line  113)
* PyLong_FromUnsignedLong (C function):  整数型オブジェクト integer object.
                                                             (line   41)
* PyLong_FromUnsignedLongLong (C function): 整数型オブジェクト integer object.
                                                             (line   70)
* PyLong_FromUnsignedNativeBytes (C function): 整数型オブジェクト integer object.
                                                             (line  141)
* PyLong_FromVoidPtr (C function):       整数型オブジェクト integer object.
                                                             (line  120)
* PyLong_GetInfo (C function):           整数型オブジェクト integer object.
                                                             (line  630)
* PyLong_GetNativeLayout (C function):   Export API.         (line   46)
* PyLong_GetSign (C function):           整数型オブジェクト integer object.
                                                             (line  588)
* PyLong_IsNegative (C function):        整数型オブジェクト integer object.
                                                             (line  610)
* PyLong_IsPositive (C function):        整数型オブジェクト integer object.
                                                             (line  600)
* PyLong_IsZero (C function):            整数型オブジェクト integer object.
                                                             (line  620)
* PyLong_MASK (C macro):                 Deprecated API.     (line   24)
* PyLong_SHIFT (C macro):                Deprecated API.     (line   15)
* PyLong_Type (C var):                   整数型オブジェクト integer object.
                                                             (line   16)
* PyLongExport (C struct):               Export API.         (line   58)
* PyLongExport.digits (C member):        Export API.         (line   85)
* PyLongExport.ndigits (C member):       Export API.         (line   80)
* PyLongExport.negative (C member):      Export API.         (line   75)
* PyLongExport.value (C member):         Export API.         (line   70)
* PyLongLayout (C struct):               Export API.         (line    8)
* PyLongLayout.bits_per_digit (C member): Export API.        (line   20)
* PyLongLayout.digit_endianness (C member): Export API.      (line   38)
* PyLongLayout.digit_size (C member):    Export API.         (line   25)
* PyLongLayout.digits_order (C member):  Export API.         (line   30)
* PyLongObject (C type):                 整数型オブジェクト integer object.
                                                             (line   12)
* PyLongRangeIter_Type (C var):          Other Iterator Objects.
                                                             (line   27)
* PyLongWriter (C struct):               PyLongWriter API.   (line   10)
* PyLongWriter_Create (C function):      PyLongWriter API.   (line   17)
* PyLongWriter_Discard (C function):     PyLongWriter API.   (line   59)
* PyLongWriter_Finish (C function):      PyLongWriter API.   (line   45)
* PyMap_Type (C var):                    Builtin Iterator Types.
                                                             (line   19)
* PyMapping_Check (C function):          マップ型プロトコル mapping protocol.
                                                             (line    9)
* PyMapping_DelItem (C function):        マップ型プロトコル mapping protocol.
                                                             (line   60)
* PyMapping_DelItemString (C function):  マップ型プロトコル mapping protocol.
                                                             (line   64)
* PyMapping_GetItemString (C function):  マップ型プロトコル mapping protocol.
                                                             (line   24)
* PyMapping_GetOptionalItem (C function): マップ型プロトコル mapping protocol.
                                                             (line   31)
* PyMapping_GetOptionalItemString (C function): マップ型プロトコル mapping protocol.
                                                             (line   45)
* PyMapping_HasKey (C function):         マップ型プロトコル mapping protocol.
                                                             (line   87)
* PyMapping_HasKeyString (C function):   マップ型プロトコル mapping protocol.
                                                             (line   99)
* PyMapping_HasKeyStringWithError (C function): マップ型プロトコル mapping protocol.
                                                             (line   78)
* PyMapping_HasKeyWithError (C function): マップ型プロトコル mapping protocol.
                                                             (line   70)
* PyMapping_Items (C function):          マップ型プロトコル mapping protocol.
                                                             (line  127)
* PyMapping_Keys (C function):           マップ型プロトコル mapping protocol.
                                                             (line  111)
* PyMapping_Length (C function):         マップ型プロトコル mapping protocol.
                                                             (line   17)
* PyMapping_SetItemString (C function):  マップ型プロトコル mapping protocol.
                                                             (line   54)
* PyMapping_Size (C function):           マップ型プロトコル mapping protocol.
                                                             (line   17)
* PyMapping_Values (C function):         マップ型プロトコル mapping protocol.
                                                             (line  119)
* PyMappingMethods (C type):             マップオブジェクト構造体.
                                                             (line    6)
* PyMappingMethods.mp_ass_subscript (C member): マップオブジェクト構造体.
                                                             (line   34)
* PyMappingMethods.mp_length (C member): マップオブジェクト構造体.
                                                             (line   11)
* PyMappingMethods.mp_subscript (C member): マップオブジェクト構造体.
                                                             (line   22)
* PyMarshal_ReadLastObjectFromFile (C function): データ整列化 data marshalling のサポート.
                                                             (line   72)
* PyMarshal_ReadLongFromFile (C function): データ整列化 data marshalling のサポート.
                                                             (line   46)
* PyMarshal_ReadObjectFromFile (C function): データ整列化 data marshalling のサポート.
                                                             (line   64)
* PyMarshal_ReadObjectFromString (C function): データ整列化 data marshalling のサポート.
                                                             (line   87)
* PyMarshal_ReadShortFromFile (C function): データ整列化 data marshalling のサポート.
                                                             (line   55)
* PyMarshal_WriteLongToFile (C function): データ整列化 data marshalling のサポート.
                                                             (line   20)
* PyMarshal_WriteObjectToFile (C function): データ整列化 data marshalling のサポート.
                                                             (line   30)
* PyMarshal_WriteObjectToString (C function): データ整列化 data marshalling のサポート.
                                                             (line   39)
* PyMem_Calloc (C function):             メモリインターフェース.
                                                             (line   28)
* PyMem_Del (C function):                メモリインターフェース.
                                                             (line   85)
* PyMem_DEL (C macro):                   非推奨のエイリアス<2>.
                                                             (line   28)
* PYMEM_DOMAIN_MEM (C macro):            メモリアロケータをカスタマイズする.
                                                             (line   54)
* PYMEM_DOMAIN_OBJ (C macro):            メモリアロケータをカスタマイズする.
                                                             (line   66)
* PYMEM_DOMAIN_RAW (C macro):            メモリアロケータをカスタマイズする.
                                                             (line   42)
* PyMem_Free (C function):               メモリインターフェース.
                                                             (line   57)
* PyMem_FREE (C macro):                  非推奨のエイリアス<2>.
                                                             (line   25)
* PyMem_GetAllocator (C function):       メモリアロケータをカスタマイズする.
                                                             (line   78)
* PyMem_Malloc (C function):             メモリインターフェース.
                                                             (line   19)
* PyMem_MALLOC (C macro):                非推奨のエイリアス<2>.
                                                             (line   13)
* PyMem_New (C macro):                   メモリインターフェース.
                                                             (line   69)
* PyMem_NEW (C macro):                   非推奨のエイリアス<2>.
                                                             (line   16)
* PyMem_RawCalloc (C function):          生メモリインターフェース.
                                                             (line   25)
* PyMem_RawFree (C function):            生メモリインターフェース.
                                                             (line   54)
* PyMem_RawMalloc (C function):          生メモリインターフェース.
                                                             (line   16)
* PyMem_RawRealloc (C function):         生メモリインターフェース.
                                                             (line   38)
* PyMem_Realloc (C function):            メモリインターフェース.
                                                             (line   41)
* PyMem_REALLOC (C macro):               非推奨のエイリアス<2>.
                                                             (line   19)
* PyMem_Resize (C macro):                メモリインターフェース.
                                                             (line   75)
* PyMem_RESIZE (C macro):                非推奨のエイリアス<2>.
                                                             (line   22)
* PyMem_SetAllocator (C function):       メモリアロケータをカスタマイズする.
                                                             (line   83)
* PyMem_SetupDebugHooks (C function):    メモリアロケータをカスタマイズする.
                                                             (line  126)
* PyMemAllocatorDomain (C type):         メモリアロケータをカスタマイズする.
                                                             (line   38)
* PyMemAllocatorEx (C type):             メモリアロケータをカスタマイズする.
                                                             (line    8)
* PyMember_GetOne (C function):          Accessing attributes of extension types.
                                                             (line   76)
* PyMember_SetOne (C function):          Accessing attributes of extension types.
                                                             (line   85)
* PyMemberDef (C type):                  Accessing attributes of extension types.
                                                             (line    6)
* PyMemberDef.doc (C member):            Accessing attributes of extension types.
                                                             (line   36)
* PyMemberDef.flags (C member):          Accessing attributes of extension types.
                                                             (line   31)
* PyMemberDef.name (C member):           Accessing attributes of extension types.
                                                             (line   14)
* PyMemberDef.offset (C member):         Accessing attributes of extension types.
                                                             (line   26)
* PyMemberDef.type (C member):           Accessing attributes of extension types.
                                                             (line   21)
* PyMemberDescr_Type (C var):            デスクリプタオブジェクト descriptor object.
                                                             (line   22)
* PyMemoryView_Check (C function):       memoryview オブジェクト.
                                                             (line   61)
* PyMemoryView_FromBuffer (C function):  memoryview オブジェクト.
                                                             (line   41)
* PyMemoryView_FromMemory (C function):  memoryview オブジェクト.
                                                             (line   32)
* PyMemoryView_FromObject (C function):  memoryview オブジェクト.
                                                             (line   15)
* PyMemoryView_GET_BASE (C function):    memoryview オブジェクト.
                                                             (line   75)
* PyMemoryView_GET_BUFFER (C function):  memoryview オブジェクト.
                                                             (line   67)
* PyMemoryView_GetContiguous (C function): memoryview オブジェクト.
                                                             (line   48)
* PyMemoryView_Type (C var):             memoryview オブジェクト.
                                                             (line   10)
* PyMethod_Check (C function):           メソッドオブジェクト<2>.
                                                             (line   16)
* PyMethod_Function (C function):        メソッドオブジェクト<2>.
                                                             (line   29)
* PyMethod_GET_FUNCTION (C function):    メソッドオブジェクト<2>.
                                                             (line   33)
* PyMethod_GET_SELF (C function):        メソッドオブジェクト<2>.
                                                             (line   42)
* PyMethod_New (C function):             メソッドオブジェクト<2>.
                                                             (line   22)
* PyMethod_Self (C function):            メソッドオブジェクト<2>.
                                                             (line   38)
* PyMethod_Type (C var):                 メソッドオブジェクト<2>.
                                                             (line   10)
* PyMethodDef (C type):                  Implementing functions and methods.
                                                             (line   63)
* PyMethodDef.ml_doc (C member):         Implementing functions and methods.
                                                             (line   80)
* PyMethodDef.ml_flags (C member):       Implementing functions and methods.
                                                             (line   76)
* PyMethodDef.ml_meth (C member):        Implementing functions and methods.
                                                             (line   72)
* PyMethodDef.ml_name (C member):        Implementing functions and methods.
                                                             (line   68)
* PyMethodDescr_Type (C var):            デスクリプタオブジェクト descriptor object.
                                                             (line   40)
* PyMODINIT_FUNC (C macro):              初期化関数.         (line   28)
* PyModule_Add (C function):             サポート関数.       (line   63)
* PyModule_AddFunctions (C function):    サポート関数.       (line  159)
* PyModule_AddIntConstant (C function):  サポート関数.       (line  113)
* PyModule_AddIntMacro (C macro):        サポート関数.       (line  136)
* PyModule_AddObject (C function):       サポート関数.       (line   79)
* PyModule_AddObjectRef (C function):    サポート関数.       (line   11)
* PyModule_AddStringConstant (C function): サポート関数.     (line  124)
* PyModule_AddStringMacro (C macro):     サポート関数.       (line  144)
* PyModule_AddType (C function):         サポート関数.       (line  148)
* PyModule_Check (C function):           モジュールオブジェクト module object.
                                                             (line   13)
* PyModule_CheckExact (C function):      モジュールオブジェクト module object.
                                                             (line   18)
* PyModule_Create (C function):          Creating extension modules dynamically.
                                                             (line   10)
* PyModule_Create2 (C function):         Creating extension modules dynamically.
                                                             (line   17)
* PyModule_ExecDef (C function):         Creating extension modules dynamically.
                                                             (line   64)
* PyModule_FromDefAndSpec (C function):  Creating extension modules dynamically.
                                                             (line   34)
* PyModule_FromDefAndSpec2 (C function): Creating extension modules dynamically.
                                                             (line   43)
* PyModule_GetDef (C function):          モジュールオブジェクト module object.
                                                             (line   87)
* PyModule_GetDict (C function):         モジュールオブジェクト module object.
                                                             (line   45)
* PyModule_GetFilename (C function):     モジュールオブジェクト module object.
                                                             (line  108)
* PyModule_GetFilenameObject (C function): モジュールオブジェクト module object.
                                                             (line   97)
* PyModule_GetName (C function):         モジュールオブジェクト module object.
                                                             (line   72)
* PyModule_GetNameObject (C function):   モジュールオブジェクト module object.
                                                             (line   61)
* PyModule_GetState (C function):        モジュールオブジェクト module object.
                                                             (line   81)
* PyModule_New (C function):             モジュールオブジェクト module object.
                                                             (line   40)
* PyModule_NewObject (C function):       モジュールオブジェクト module object.
                                                             (line   23)
* PyModule_SetDocString (C function):    サポート関数.       (line  181)
* PyModule_Type (C var):                 モジュールオブジェクト module object.
                                                             (line    6)
* PyModuleDef (C type):                  Module definitions. (line   22)
* PyModuleDef_Init (C function):         多段階初期化.       (line   11)
* PyModuleDef_Slot (C type):             Module slots.       (line    6)
* PyModuleDef_Slot.slot (C member):      Module slots.       (line    8)
* PyModuleDef_Slot.value (C member):     Module slots.       (line   14)
* PyModuleDef.m_base (C member):         Module definitions. (line   30)
* PyModuleDef.m_clear (C member):        Module definitions. (line  100)
* PyModuleDef.m_doc (C member):          Module definitions. (line   39)
* PyModuleDef.m_free (C member):         Module definitions. (line  122)
* PyModuleDef.m_methods (C member):      Module definitions. (line   67)
* PyModuleDef.m_name (C member):         Module definitions. (line   35)
* PyModuleDef.m_size (C member):         Module definitions. (line   44)
* PyModuleDef.m_slots (C member):        Module definitions. (line   73)
* PyModuleDef.m_slots.m_reload (C member): Module definitions.
                                                             (line   82)
* PyModuleDef.m_traverse (C member):     Module definitions. (line   84)
* PyMonitoring_EnterScope (C function):  Managing the Monitoring State.
                                                             (line    9)
* PyMonitoring_ExitScope (C function):   Managing the Monitoring State.
                                                             (line   98)
* PyMonitoring_FireBranchLeftEvent (C function): Generating Execution Events.
                                                             (line   69)
* PyMonitoring_FireBranchRightEvent (C function): Generating Execution Events.
                                                             (line   75)
* PyMonitoring_FireCallEvent (C function): Generating Execution Events.
                                                             (line   53)
* PyMonitoring_FireCRaiseEvent (C function): Generating Execution Events.
                                                             (line   98)
* PyMonitoring_FireCReturnEvent (C function): Generating Execution Events.
                                                             (line   81)
* PyMonitoring_FireExceptionHandledEvent (C function): Generating Execution Events.
                                                             (line  110)
* PyMonitoring_FireJumpEvent (C function): Generating Execution Events.
                                                             (line   64)
* PyMonitoring_FireLineEvent (C function): Generating Execution Events.
                                                             (line   59)
* PyMonitoring_FirePyResumeEvent (C function): Generating Execution Events.
                                                             (line   38)
* PyMonitoring_FirePyReturnEvent (C function): Generating Execution Events.
                                                             (line   43)
* PyMonitoring_FirePyStartEvent (C function): Generating Execution Events.
                                                             (line   33)
* PyMonitoring_FirePyThrowEvent (C function): Generating Execution Events.
                                                             (line   86)
* PyMonitoring_FirePyUnwindEvent (C function): Generating Execution Events.
                                                             (line  116)
* PyMonitoring_FirePyYieldEvent (C function): Generating Execution Events.
                                                             (line   48)
* PyMonitoring_FireRaiseEvent (C function): Generating Execution Events.
                                                             (line   92)
* PyMonitoring_FireReraiseEvent (C function): Generating Execution Events.
                                                             (line  104)
* PyMonitoring_FireStopIterationEvent (C function): Generating Execution Events.
                                                             (line  122)
* PyMonitoringState (C type):            Generating Execution Events.
                                                             (line   22)
* PyMutex (C type):                      同期プリミティブ<3>.
                                                             (line    8)
* PyMutex_IsLocked (C function):         同期プリミティブ<3>.
                                                             (line   41)
* PyMutex_Lock (C function):             同期プリミティブ<3>.
                                                             (line   25)
* PyMutex_Unlock (C function):           同期プリミティブ<3>.
                                                             (line   34)
* PyNumber_Absolute (C function):        数値型プロトコル number protocol.
                                                             (line   91)
* PyNumber_Add (C function):             数値型プロトコル number protocol.
                                                             (line   14)
* PyNumber_And (C function):             数値型プロトコル number protocol.
                                                             (line  114)
* PyNumber_AsSsize_t (C function):       数値型プロトコル number protocol.
                                                             (line  267)
* PyNumber_Check (C function):           数値型プロトコル number protocol.
                                                             (line    6)
* PyNumber_Divmod (C function):          数値型プロトコル number protocol.
                                                             (line   64)
* PyNumber_Float (C function):           数値型プロトコル number protocol.
                                                             (line  244)
* PyNumber_FloorDivide (C function):     数値型プロトコル number protocol.
                                                             (line   41)
* PyNumber_Index (C function):           数値型プロトコル number protocol.
                                                             (line  250)
* PyNumber_InPlaceAdd (C function):      数値型プロトコル number protocol.
                                                             (line  133)
* PyNumber_InPlaceAnd (C function):      数値型プロトコル number protocol.
                                                             (line  216)
* PyNumber_InPlaceFloorDivide (C function): 数値型プロトコル number protocol.
                                                             (line  164)
* PyNumber_InPlaceLshift (C function):   数値型プロトコル number protocol.
                                                             (line  202)
* PyNumber_InPlaceMatrixMultiply (C function): 数値型プロトコル number protocol.
                                                             (line  154)
* PyNumber_InPlaceMultiply (C function): 数値型プロトコル number protocol.
                                                             (line  147)
* PyNumber_InPlaceOr (C function):       数値型プロトコル number protocol.
                                                             (line  231)
* PyNumber_InPlacePower (C function):    数値型プロトコル number protocol.
                                                             (line  190)
* PyNumber_InPlaceRemainder (C function): 数値型プロトコル number protocol.
                                                             (line  183)
* PyNumber_InPlaceRshift (C function):   数値型プロトコル number protocol.
                                                             (line  209)
* PyNumber_InPlaceSubtract (C function): 数値型プロトコル number protocol.
                                                             (line  140)
* PyNumber_InPlaceTrueDivide (C function): 数値型プロトコル number protocol.
                                                             (line  171)
* PyNumber_InPlaceXor (C function):      数値型プロトコル number protocol.
                                                             (line  223)
* PyNumber_Invert (C function):          数値型プロトコル number protocol.
                                                             (line   97)
* PyNumber_Long (C function):            数値型プロトコル number protocol.
                                                             (line  238)
* PyNumber_Lshift (C function):          数値型プロトコル number protocol.
                                                             (line  102)
* PyNumber_MatrixMultiply (C function):  数値型プロトコル number protocol.
                                                             (line   32)
* PyNumber_Multiply (C function):        数値型プロトコル number protocol.
                                                             (line   26)
* PyNumber_Negative (C function):        数値型プロトコル number protocol.
                                                             (line   81)
* PyNumber_Or (C function):              数値型プロトコル number protocol.
                                                             (line  127)
* PyNumber_Positive (C function):        数値型プロトコル number protocol.
                                                             (line   86)
* PyNumber_Power (C function):           数値型プロトコル number protocol.
                                                             (line   71)
* PyNumber_Remainder (C function):       数値型プロトコル number protocol.
                                                             (line   58)
* PyNumber_Rshift (C function):          数値型プロトコル number protocol.
                                                             (line  108)
* PyNumber_Subtract (C function):        数値型プロトコル number protocol.
                                                             (line   20)
* PyNumber_ToBase (C function):          数値型プロトコル number protocol.
                                                             (line  258)
* PyNumber_TrueDivide (C function):      数値型プロトコル number protocol.
                                                             (line   47)
* PyNumber_Xor (C function):             数値型プロトコル number protocol.
                                                             (line  120)
* PyNumberMethods (C type):              数値オブジェクト構造体.
                                                             (line    6)
* PyNumberMethods.nb_absolute (C member): 数値オブジェクト構造体.
                                                             (line  118)
* PyNumberMethods.nb_add (C member):     数値オブジェクト構造体.
                                                             (line   70)
* PyNumberMethods.nb_and (C member):     数値オブジェクト構造体.
                                                             (line  148)
* PyNumberMethods.nb_bool (C member):    数値オブジェクト構造体.
                                                             (line  124)
* PyNumberMethods.nb_divmod (C member):  数値オブジェクト構造体.
                                                             (line   94)
* PyNumberMethods.nb_float (C member):   数値オブジェクト構造体.
                                                             (line  174)
* PyNumberMethods.nb_floor_divide (C member): 数値オブジェクト構造体.
                                                             (line  240)
* PyNumberMethods.nb_index (C member):   数値オブジェクト構造体.
                                                             (line  264)
* PyNumberMethods.nb_inplace_add (C member): 数値オブジェクト構造体.
                                                             (line  180)
* PyNumberMethods.nb_inplace_and (C member): 数値オブジェクト構造体.
                                                             (line  222)
* PyNumberMethods.nb_inplace_floor_divide (C member): 数値オブジェクト構造体.
                                                             (line  252)
* PyNumberMethods.nb_inplace_lshift (C member): 数値オブジェクト構造体.
                                                             (line  210)
* PyNumberMethods.nb_inplace_matrix_multiply (C member): 数値オブジェクト構造体.
                                                             (line  276)
* PyNumberMethods.nb_inplace_multiply (C member): 数値オブジェクト構造体.
                                                             (line  192)
* PyNumberMethods.nb_inplace_or (C member): 数値オブジェクト構造体.
                                                             (line  234)
* PyNumberMethods.nb_inplace_power (C member): 数値オブジェクト構造体.
                                                             (line  204)
* PyNumberMethods.nb_inplace_remainder (C member): 数値オブジェクト構造体.
                                                             (line  198)
* PyNumberMethods.nb_inplace_rshift (C member): 数値オブジェクト構造体.
                                                             (line  216)
* PyNumberMethods.nb_inplace_subtract (C member): 数値オブジェクト構造体.
                                                             (line  186)
* PyNumberMethods.nb_inplace_true_divide (C member): 数値オブジェクト構造体.
                                                             (line  258)
* PyNumberMethods.nb_inplace_xor (C member): 数値オブジェクト構造体.
                                                             (line  228)
* PyNumberMethods.nb_int (C member):     数値オブジェクト構造体.
                                                             (line  166)
* PyNumberMethods.nb_invert (C member):  数値オブジェクト構造体.
                                                             (line  130)
* PyNumberMethods.nb_lshift (C member):  数値オブジェクト構造体.
                                                             (line  136)
* PyNumberMethods.nb_matrix_multiply (C member): 数値オブジェクト構造体.
                                                             (line  270)
* PyNumberMethods.nb_multiply (C member): 数値オブジェクト構造体.
                                                             (line   82)
* PyNumberMethods.nb_negative (C member): 数値オブジェクト構造体.
                                                             (line  106)
* PyNumberMethods.nb_or (C member):      数値オブジェクト構造体.
                                                             (line  160)
* PyNumberMethods.nb_positive (C member): 数値オブジェクト構造体.
                                                             (line  112)
* PyNumberMethods.nb_power (C member):   数値オブジェクト構造体.
                                                             (line  100)
* PyNumberMethods.nb_remainder (C member): 数値オブジェクト構造体.
                                                             (line   88)
* PyNumberMethods.nb_reserved (C member): 数値オブジェクト構造体.
                                                             (line  172)
* PyNumberMethods.nb_rshift (C member):  数値オブジェクト構造体.
                                                             (line  142)
* PyNumberMethods.nb_subtract (C member): 数値オブジェクト構造体.
                                                             (line   76)
* PyNumberMethods.nb_true_divide (C member): 数値オブジェクト構造体.
                                                             (line  246)
* PyNumberMethods.nb_xor (C member):     数値オブジェクト構造体.
                                                             (line  154)
* PyObject (C type):                     Base object types and macros.
                                                             (line   14)
* PyObject_ASCII (C function):           オブジェクトプロトコル object protocol.
                                                             (line  337)
* PyObject_AsFileDescriptor (C function): ファイルオブジェクト.
                                                             (line   33)
* PyObject_Bytes (C function):           オブジェクトプロトコル object protocol.
                                                             (line  358)
* PyObject_Call (C function):            Object Calling API. (line   57)
* PyObject_CallFinalizer (C function):   関数<15>.           (line    9)
* PyObject_CallFinalizerFromDealloc (C function): 関数<15>.  (line   21)
* PyObject_CallFunction (C function):    Object Calling API. (line  106)
* PyObject_CallFunctionObjArgs (C function): Object Calling API.
                                                             (line  147)
* PyObject_CallMethod (C function):      Object Calling API. (line  126)
* PyObject_CallMethodNoArgs (C function): Object Calling API.
                                                             (line  170)
* PyObject_CallMethodObjArgs (C function): Object Calling API.
                                                             (line  159)
* PyObject_CallMethodOneArg (C function): Object Calling API.
                                                             (line  182)
* PyObject_CallNoArgs (C function):      Object Calling API. (line   72)
* PyObject_CallObject (C function):      C から Python 関数を呼び出す.
                                                             (line   65)
* PyObject_CallObject (C function) <1>:  Object Calling API. (line   94)
* PyObject_Calloc (C function):          オブジェクトアロケータ.
                                                             (line   30)
* PyObject_CallOneArg (C function):      Object Calling API. (line   84)
* PyObject_CheckBuffer (C function):     バッファ関連の関数. (line    6)
* PyObject_ClearManagedDict (C function): オブジェクトプロトコル object protocol.
                                                             (line  581)
* PyObject_ClearWeakRefs (C function):   弱参照オブジェクト<2>.
                                                             (line  114)
* PyObject_CopyData (C function):        バッファ関連の関数. (line   83)
* PyObject_DEL (C macro):                非推奨のエイリアス<3>.
                                                             (line   34)
* PyObject_Del (C macro):                非推奨のエイリアス<3>.
                                                             (line   37)
* PyObject_DelAttr (C function):         オブジェクトプロトコル object protocol.
                                                             (line  238)
* PyObject_DelAttrString (C function):   オブジェクトプロトコル object protocol.
                                                             (line  244)
* PyObject_DelItem (C function):         オブジェクトプロトコル object protocol.
                                                             (line  486)
* PyObject_DelItemString (C function):   オブジェクトプロトコル object protocol.
                                                             (line  491)
* PyObject_Dir (C function):             オブジェクトプロトコル object protocol.
                                                             (line  496)
* PyObject_Format (C function):          オブジェクトプロトコル object protocol.
                                                             (line  316)
* PyObject_Free (C function):            オブジェクトアロケータ.
                                                             (line   60)
* PyObject_FREE (C macro):               非推奨のエイリアス<3>.
                                                             (line   31)
* PyObject_GC_Del (C function):          循環参照ガベージコレクションをサポートする.
                                                             (line  183)
* PyObject_GC_IsFinalized (C function):  循環参照ガベージコレクションをサポートする.
                                                             (line  172)
* PyObject_GC_IsTracked (C function):    循環参照ガベージコレクションをサポートする.
                                                             (line  161)
* PyObject_GC_New (C macro):             循環参照ガベージコレクションをサポートする.
                                                             (line   56)
* PyObject_GC_NewVar (C macro):          循環参照ガベージコレクションをサポートする.
                                                             (line   83)
* PyObject_GC_Resize (C macro):          循環参照ガベージコレクションをサポートする.
                                                             (line  135)
* PyObject_GC_Track (C function):        循環参照ガベージコレクションをサポートする.
                                                             (line  145)
* PyObject_GC_UnTrack (C function):      循環参照ガベージコレクションをサポートする.
                                                             (line  209)
* PyObject_GenericGetAttr (C function):  オブジェクトプロトコル object protocol.
                                                             (line  187)
* PyObject_GenericGetDict (C function):  オブジェクトプロトコル object protocol.
                                                             (line  259)
* PyObject_GenericHash (C function):     PyHash API.         (line  171)
* PyObject_GenericSetAttr (C function):  オブジェクトプロトコル object protocol.
                                                             (line  227)
* PyObject_GenericSetDict (C function):  オブジェクトプロトコル object protocol.
                                                             (line  275)
* PyObject_GetAIter (C function):        オブジェクトプロトコル object protocol.
                                                             (line  518)
* PyObject_GetArenaAllocator (C function): pymalloc アリーナアロケータのカスタマイズ.
                                                             (line   26)
* PyObject_GetAttr (C function):         オブジェクトプロトコル object protocol.
                                                             (line  143)
* PyObject_GetAttrString (C function):   オブジェクトプロトコル object protocol.
                                                             (line  153)
* PyObject_GetBuffer (C function):       バッファ関連の関数. (line   13)
* PyObject_GetItem (C function):         オブジェクトプロトコル object protocol.
                                                             (line  473)
* PyObject_GetItemData (C function):     オブジェクトプロトコル object protocol.
                                                             (line  560)
* PyObject_GetIter (C function):         オブジェクトプロトコル object protocol.
                                                             (line  505)
* PyObject_GetOptionalAttr (C function): オブジェクトプロトコル object protocol.
                                                             (line  163)
* PyObject_GetOptionalAttrString (C function): オブジェクトプロトコル object protocol.
                                                             (line  178)
* PyObject_GetTypeData (C function):     オブジェクトプロトコル object protocol.
                                                             (line  529)
* PyObject_HasAttr (C function):         オブジェクトプロトコル object protocol.
                                                             (line  115)
* PyObject_HasAttrString (C function):   オブジェクトプロトコル object protocol.
                                                             (line  128)
* PyObject_HasAttrStringWithError (C function): オブジェクトプロトコル object protocol.
                                                             (line  106)
* PyObject_HasAttrWithError (C function): オブジェクトプロトコル object protocol.
                                                             (line   97)
* PyObject_Hash (C function):            オブジェクトプロトコル object protocol.
                                                             (line  410)
* PyObject_HashNotImplemented (C function): オブジェクトプロトコル object protocol.
                                                             (line  419)
* PyObject_HEAD (C macro):               Base object types and macros.
                                                             (line   69)
* PyObject_HEAD_INIT (C macro):          Base object types and macros.
                                                             (line  171)
* PyObject_Init (C function):            オブジェクトをヒープ上にメモリ確保する.
                                                             (line   13)
* PyObject_INIT (C macro):               非推奨のエイリアス<3>.
                                                             (line   19)
* PyObject_INIT_VAR (C macro):           非推奨のエイリアス<3>.
                                                             (line   22)
* PyObject_InitVar (C function):         オブジェクトをヒープ上にメモリ確保する.
                                                             (line   32)
* PyObject_IS_GC (C function):           循環参照ガベージコレクションをサポートする.
                                                             (line  153)
* PyObject_IsInstance (C function):      オブジェクトプロトコル object protocol.
                                                             (line  388)
* PyObject_IsSubclass (C function):      オブジェクトプロトコル object protocol.
                                                             (line  367)
* PyObject_IsTrue (C function):          オブジェクトプロトコル object protocol.
                                                             (line  427)
* PyObject_Length (C function):          オブジェクトプロトコル object protocol.
                                                             (line  454)
* PyObject_LengthHint (C function):      オブジェクトプロトコル object protocol.
                                                             (line  463)
* PyObject_Malloc (C function):          オブジェクトアロケータ.
                                                             (line   21)
* PyObject_MALLOC (C macro):             非推奨のエイリアス<3>.
                                                             (line   25)
* PyObject_New (C macro):                オブジェクトをヒープ上にメモリ確保する.
                                                             (line   41)
* PyObject_NEW (C macro):                非推奨のエイリアス<3>.
                                                             (line   13)
* PyObject_NEW_VAR (C macro):            非推奨のエイリアス<3>.
                                                             (line   16)
* PyObject_NewVar (C macro):             オブジェクトをヒープ上にメモリ確保する.
                                                             (line   90)
* PyObject_Not (C function):             オブジェクトプロトコル object protocol.
                                                             (line  432)
* PyObject_Print (C function):           オブジェクトプロトコル object protocol.
                                                             (line   89)
* PyObject_Realloc (C function):         オブジェクトアロケータ.
                                                             (line   43)
* PyObject_REALLOC (C macro):            非推奨のエイリアス<3>.
                                                             (line   28)
* PyObject_Repr (C function):            オブジェクトプロトコル object protocol.
                                                             (line  326)
* PyObject_RichCompare (C function):     オブジェクトプロトコル object protocol.
                                                             (line  293)
* PyObject_RichCompareBool (C function): オブジェクトプロトコル object protocol.
                                                             (line  305)
* PyObject_SelfIter (C function):        オブジェクトプロトコル object protocol.
                                                             (line  512)
* PyObject_SetArenaAllocator (C function): pymalloc アリーナアロケータのカスタマイズ.
                                                             (line   31)
* PyObject_SetAttr (C function):         オブジェクトプロトコル object protocol.
                                                             (line  198)
* PyObject_SetAttrString (C function):   オブジェクトプロトコル object protocol.
                                                             (line  209)
* PyObject_SetItem (C function):         オブジェクトプロトコル object protocol.
                                                             (line  479)
* PyObject_Size (C function):            オブジェクトプロトコル object protocol.
                                                             (line  454)
* PyObject_Str (C function):             オブジェクトプロトコル object protocol.
                                                             (line  347)
* PyObject_Type (C function):            オブジェクトプロトコル object protocol.
                                                             (line  437)
* PyObject_TypeCheck (C function):       オブジェクトプロトコル object protocol.
                                                             (line  449)
* PyObject_VAR_HEAD (C macro):           Base object types and macros.
                                                             (line   78)
* PyObject_Vectorcall (C function):      Object Calling API. (line  194)
* PyObject_VectorcallDict (C function):  Object Calling API. (line  212)
* PyObject_VectorcallMethod (C function): Object Calling API.
                                                             (line  228)
* PyObject_VisitManagedDict (C function): オブジェクトプロトコル object protocol.
                                                             (line  571)
* PyObject.ob_refcnt (C member):         Base object types and macros.
                                                             (line   27)
* PyObject.ob_type (C member):           Base object types and macros.
                                                             (line   37)
* PyObjectArenaAllocator (C type):       pymalloc アリーナアロケータのカスタマイズ.
                                                             (line    8)
* PyODict_Check (C function):            Ordered Dictionaries.
                                                             (line   16)
* PyODict_CheckExact (C function):       Ordered Dictionaries.
                                                             (line   22)
* PyODict_Contains (C macro):            Ordered Dictionaries.
                                                             (line   79)
* PyODict_DelItem (C function):          Ordered Dictionaries.
                                                             (line   57)
* PyODict_GetItem (C macro):             Ordered Dictionaries.
                                                             (line   70)
* PyODict_GetItemString (C macro):       Ordered Dictionaries.
                                                             (line   76)
* PyODict_GetItemWithError (C macro):    Ordered Dictionaries.
                                                             (line   73)
* PyODict_New (C function):              Ordered Dictionaries.
                                                             (line   42)
* PyODict_SetItem (C function):          Ordered Dictionaries.
                                                             (line   48)
* PyODict_Size (C macro):                Ordered Dictionaries.
                                                             (line   82)
* PyODict_SIZE (C macro):                Ordered Dictionaries.
                                                             (line   85)
* PyODict_Type (C var):                  Ordered Dictionaries.
                                                             (line   11)
* PyODictItems_Type (C var):             Ordered Dictionaries.
                                                             (line   37)
* PyODictIter_Type (C var):              Other Iterator Objects.
                                                             (line   48)
* PyODictKeys_Type (C var):              Ordered Dictionaries.
                                                             (line   28)
* PyODictValues_Type (C var):            Ordered Dictionaries.
                                                             (line   32)
* PyOS_AfterFork (C function):           オペレーティングシステム関連のユーティリティ.
                                                             (line   79)
* PyOS_AfterFork_Child (C function):     オペレーティングシステム関連のユーティリティ.
                                                             (line   56)
* PyOS_AfterFork_Parent (C function):    オペレーティングシステム関連のユーティリティ.
                                                             (line   42)
* PyOS_BeforeFork (C function):          オペレーティングシステム関連のユーティリティ.
                                                             (line   29)
* PyOS_CheckStack (C function):          オペレーティングシステム関連のユーティリティ.
                                                             (line   89)
* PyOS_double_to_string (C function):    文字列の変換と書式化.
                                                             (line  112)
* PyOS_FSPath (C function):              オペレーティングシステム関連のユーティリティ.
                                                             (line    6)
* PyOS_getsig (C function):              オペレーティングシステム関連のユーティリティ.
                                                             (line  103)
* PyOS_InputHook (C var):                超高水準レイヤ.     (line  140)
* PyOS_InterruptOccurred (C function):   オペレーティングシステム関連のユーティリティ.
                                                             (line  115)
* PyOS_mystricmp (C function):           文字列の変換と書式化.
                                                             (line  166)
* PyOS_mystrnicmp (C function):          文字列の変換と書式化.
                                                             (line  166)
* PyOS_ReadlineFunctionPointer (C var):  超高水準レイヤ.     (line  152)
* PyOS_setsig (C function):              オペレーティングシステム関連のユーティリティ.
                                                             (line  108)
* PyOS_sighandler_t (C type):            オペレーティングシステム関連のユーティリティ.
                                                             (line  100)
* PyOS_snprintf (C function):            文字列の変換と書式化.
                                                             (line    8)
* PyOS_stricmp (C function):             文字列の変換と書式化.
                                                             (line  185)
* PyOS_string_to_double (C function):    文字列の変換と書式化.
                                                             (line   82)
* PyOS_strnicmp (C function):            文字列の変換と書式化.
                                                             (line  185)
* PyOS_strtol (C function):              文字列の変換と書式化.
                                                             (line   69)
* PyOS_strtoul (C function):             文字列の変換と書式化.
                                                             (line   47)
* PyOS_vsnprintf (C function):           文字列の変換と書式化.
                                                             (line   14)
* PyPickleBuffer_Check (C function):     Pickle buffer objects.
                                                             (line   18)
* PyPickleBuffer_FromObject (C function): Pickle buffer objects.
                                                             (line   23)
* PyPickleBuffer_GetBuffer (C function): Pickle buffer objects.
                                                             (line   37)
* PyPickleBuffer_Release (C function):   Pickle buffer objects.
                                                             (line   51)
* PyPickleBuffer_Type (C var):           Pickle buffer objects.
                                                             (line   12)
* PyPreConfig (C type):                  PyPreConfig.        (line    6)
* PyPreConfig_InitIsolatedConfig (C function): PyPreConfig.  (line   18)
* PyPreConfig_InitPythonConfig (C function): PyPreConfig.    (line   12)
* PyPreConfig.allocator (C member):      PyPreConfig.        (line   26)
* PyPreConfig.coerce_c_locale (C member): PyPreConfig.       (line   82)
* PyPreConfig.coerce_c_locale_warn (C member): PyPreConfig.  (line   93)
* PyPreConfig.configure_locale (C member): PyPreConfig.      (line   71)
* PyPreConfig.dev_mode (C member):       PyPreConfig.        (line   99)
* PyPreConfig.isolated (C member):       PyPreConfig.        (line  106)
* PyPreConfig.legacy_windows_fs_encoding (C member): PyPreConfig.
                                                             (line  112)
* PyPreConfig.parse_argv (C member):     PyPreConfig.        (line  131)
* PyPreConfig.use_environment (C member): PyPreConfig.       (line  140)
* PyPreConfig.utf8_mode (C member):      PyPreConfig.        (line  147)
* PyProperty_Type (C var):               デスクリプタオブジェクト descriptor object.
                                                             (line   10)
* PyRange_Check (C function):            Range Objects.      (line   10)
* PyRange_Type (C var):                  Range Objects.      (line    6)
* PyRangeIter_Type (C var):              Other Iterator Objects.
                                                             (line   24)
* PyRefTracer (C type):                  Reference tracing.  (line    8)
* PyRefTracer_CREATE (C var):            Reference tracing.  (line   21)
* PyRefTracer_DESTROY (C var):           Reference tracing.  (line   26)
* PyRefTracer_GetTracer (C function):    Reference tracing.  (line   50)
* PyRefTracer_SetTracer (C function):    Reference tracing.  (line   31)
* PyReversed_Type (C var):               Builtin Iterator Types.
                                                             (line   22)
* PyRun_AnyFile (C function):            超高水準レイヤ.     (line   25)
* PyRun_AnyFileEx (C function):          超高水準レイヤ.     (line   36)
* PyRun_AnyFileExFlags (C function):     超高水準レイヤ.     (line   42)
* PyRun_AnyFileFlags (C function):       超高水準レイヤ.     (line   30)
* PyRun_File (C function):               超高水準レイヤ.     (line  193)
* PyRun_FileEx (C function):             超高水準レイヤ.     (line  199)
* PyRun_FileExFlags (C function):        超高水準レイヤ.     (line  211)
* PyRun_FileFlags (C function):          超高水準レイヤ.     (line  205)
* PyRun_InteractiveLoop (C function):    超高水準レイヤ.     (line  126)
* PyRun_InteractiveLoopFlags (C function): 超高水準レイヤ.   (line  131)
* PyRun_InteractiveOne (C function):     超高水準レイヤ.     (line  114)
* PyRun_InteractiveOneFlags (C function): 超高水準レイヤ.    (line  119)
* PyRun_InteractiveOneObject (C function): 超高水準レイヤ.   (line   99)
* PyRun_SimpleFile (C function):         超高水準レイヤ.     (line   74)
* PyRun_SimpleFileEx (C function):       超高水準レイヤ.     (line   79)
* PyRun_SimpleFileExFlags (C function):  超高水準レイヤ.     (line   85)
* PyRun_SimpleString (C function):       超高水準レイヤ.     (line   55)
* PyRun_SimpleStringFlags (C function):  超高水準レイヤ.     (line   61)
* PyRun_String (C function):             超高水準レイヤ.     (line  175)
* PyRun_StringFlags (C function):        超高水準レイヤ.     (line  180)
* PySendResult (C type):                 イテレータプロトコル iterator protocol.
                                                             (line   41)
* PySeqIter_Check (C function):          イテレータオブジェクト iterator object.
                                                             (line   18)
* PySeqIter_New (C function):            イテレータオブジェクト iterator object.
                                                             (line   23)
* PySeqIter_Type (C var):                イテレータオブジェクト iterator object.
                                                             (line   12)
* PySequence_Check (C function):         シーケンス型プロトコル sequence protocol.
                                                             (line    6)
* PySequence_Concat (C function):        シーケンス型プロトコル sequence protocol.
                                                             (line   21)
* PySequence_Contains (C function):      シーケンス型プロトコル sequence protocol.
                                                             (line   93)
* PySequence_Count (C function):         シーケンス型プロトコル sequence protocol.
                                                             (line   86)
* PySequence_DelItem (C function):       シーケンス型プロトコル sequence protocol.
                                                             (line   69)
* PySequence_DelSlice (C function):      シーケンス型プロトコル sequence protocol.
                                                             (line   80)
* PySequence_Fast (C function):          シーケンス型プロトコル sequence protocol.
                                                             (line  127)
* PySequence_Fast_GET_ITEM (C function): シーケンス型プロトコル sequence protocol.
                                                             (line  151)
* PySequence_Fast_GET_SIZE (C function): シーケンス型プロトコル sequence protocol.
                                                             (line  142)
* PySequence_Fast_ITEMS (C function):    シーケンス型プロトコル sequence protocol.
                                                             (line  158)
* PySequence_GetItem (C function):       参照カウントの詳細. (line  115)
* PySequence_GetItem (C function) <1>:   シーケンス型プロトコル sequence protocol.
                                                             (line   47)
* PySequence_GetSlice (C function):      シーケンス型プロトコル sequence protocol.
                                                             (line   53)
* PySequence_In (C function):            シーケンス型プロトコル sequence protocol.
                                                             (line   99)
* PySequence_Index (C function):         シーケンス型プロトコル sequence protocol.
                                                             (line  106)
* PySequence_InPlaceConcat (C function): シーケンス型プロトコル sequence protocol.
                                                             (line   33)
* PySequence_InPlaceRepeat (C function): シーケンス型プロトコル sequence protocol.
                                                             (line   40)
* PySequence_ITEM (C function):          シーケンス型プロトコル sequence protocol.
                                                             (line  168)
* PySequence_Length (C function):        シーケンス型プロトコル sequence protocol.
                                                             (line   14)
* PySequence_List (C function):          シーケンス型プロトコル sequence protocol.
                                                             (line  112)
* PySequence_Repeat (C function):        シーケンス型プロトコル sequence protocol.
                                                             (line   27)
* PySequence_SetItem (C function):       シーケンス型プロトコル sequence protocol.
                                                             (line   59)
* PySequence_SetSlice (C function):      シーケンス型プロトコル sequence protocol.
                                                             (line   74)
* PySequence_Size (C function):          シーケンス型プロトコル sequence protocol.
                                                             (line   14)
* PySequence_Tuple (C function):         シーケンス型プロトコル sequence protocol.
                                                             (line  119)
* PySequenceMethods (C type):            シーケンスオブジェクト構造体.
                                                             (line    6)
* PySequenceMethods.sq_ass_item (C member): シーケンスオブジェクト構造体.
                                                             (line   61)
* PySequenceMethods.sq_concat (C member): シーケンスオブジェクト構造体.
                                                             (line   22)
* PySequenceMethods.sq_contains (C member): シーケンスオブジェクト構造体.
                                                             (line   74)
* PySequenceMethods.sq_inplace_concat (C member): シーケンスオブジェクト構造体.
                                                             (line   85)
* PySequenceMethods.sq_inplace_repeat (C member): シーケンスオブジェクト構造体.
                                                             (line   99)
* PySequenceMethods.sq_item (C member):  シーケンスオブジェクト構造体.
                                                             (line   42)
* PySequenceMethods.sq_length (C member): シーケンスオブジェクト構造体.
                                                             (line   11)
* PySequenceMethods.sq_repeat (C member): シーケンスオブジェクト構造体.
                                                             (line   32)
* PySet_Add (C function):                Set オブジェクト.   (line  116)
* PySet_Check (C function):              Set オブジェクト.   (line   42)
* PySet_CheckExact (C function):         Set オブジェクト.   (line   58)
* PySet_Clear (C function):              Set オブジェクト.   (line  148)
* PySet_Contains (C function):           Set オブジェクト.   (line  107)
* PySet_Discard (C function):            Set オブジェクト.   (line  130)
* PySet_GET_SIZE (C function):           Set オブジェクト.   (line  103)
* PySet_MINSIZE (C macro):               Deprecated API<3>.  (line    6)
* PySet_New (C function):                Set オブジェクト.   (line   76)
* PySet_Pop (C function):                Set オブジェクト.   (line  140)
* PySet_Size (C function):               Set オブジェクト.   (line   95)
* PySet_Type (C var):                    Set オブジェクト.   (line   29)
* PySetIter_Type (C var):                Other Iterator Objects.
                                                             (line   18)
* PySetObject (C type):                  Set オブジェクト.   (line   18)
* PySignal_SetWakeupFd (C function):     シグナルハンドリング<2>.
                                                             (line   69)
* PySlice_AdjustIndices (C function):    スライスオブジェクト slice object.
                                                             (line   99)
* PySlice_Check (C function):            スライスオブジェクト slice object.
                                                             (line   11)
* PySlice_GetIndices (C function):       スライスオブジェクト slice object.
                                                             (line   28)
* PySlice_GetIndicesEx (C function):     スライスオブジェクト slice object.
                                                             (line   45)
* PySlice_New (C function):              スライスオブジェクト slice object.
                                                             (line   16)
* PySlice_Type (C var):                  スライスオブジェクト slice object.
                                                             (line    6)
* PySlice_Unpack (C function):           スライスオブジェクト slice object.
                                                             (line   86)
* PyState_AddModule (C function):        Module lookup single-phase initialization.
                                                             (line   24)
* PyState_FindModule (C function):       Module lookup single-phase initialization.
                                                             (line   14)
* PyState_RemoveModule (C function):     Module lookup single-phase initialization.
                                                             (line   50)
* PyStaticMethod_New (C function):       Built-in descriptors.
                                                             (line   38)
* PyStaticMethod_Type (C var):           Built-in descriptors.
                                                             (line   33)
* PyStatus (C type):                     PyStatus.           (line    6)
* PyStatus_Error (C function):           PyStatus.           (line   32)
* PyStatus_Exception (C function):       PyStatus.           (line   49)
* PyStatus_Exit (C function):            PyStatus.           (line   43)
* PyStatus_IsError (C function):         PyStatus.           (line   55)
* PyStatus_IsExit (C function):          PyStatus.           (line   59)
* PyStatus_NoMemory (C function):        PyStatus.           (line   39)
* PyStatus_Ok (C function):              PyStatus.           (line   28)
* PyStatus.err_msg (C member):           PyStatus.           (line   18)
* PyStatus.exitcode (C member):          PyStatus.           (line   14)
* PyStatus.func (C member):              PyStatus.           (line   22)
* PyStdPrinter_Type (C var):             Deprecated API<4>.  (line   15)
* PyStructSequence_Desc (C type):        Struct Sequence オブジェクト.
                                                             (line   34)
* PyStructSequence_Desc.doc (C member):  Struct Sequence オブジェクト.
                                                             (line   43)
* PyStructSequence_Desc.fields (C member): Struct Sequence オブジェクト.
                                                             (line   47)
* PyStructSequence_Desc.n_in_sequence (C member): Struct Sequence オブジェクト.
                                                             (line   52)
* PyStructSequence_Desc.name (C member): Struct Sequence オブジェクト.
                                                             (line   38)
* PyStructSequence_Field (C type):       Struct Sequence オブジェクト.
                                                             (line   57)
* PyStructSequence_Field.doc (C member): Struct Sequence オブジェクト.
                                                             (line   71)
* PyStructSequence_Field.name (C member): Struct Sequence オブジェクト.
                                                             (line   65)
* PyStructSequence_GET_ITEM (C function): Struct Sequence オブジェクト.
                                                             (line   99)
* PyStructSequence_GetItem (C function): Struct Sequence オブジェクト.
                                                             (line   90)
* PyStructSequence_InitType (C function): Struct Sequence オブジェクト.
                                                             (line   20)
* PyStructSequence_InitType2 (C function): Struct Sequence オブジェクト.
                                                             (line   26)
* PyStructSequence_New (C function):     Struct Sequence オブジェクト.
                                                             (line   81)
* PyStructSequence_NewType (C function): Struct Sequence オブジェクト.
                                                             (line   11)
* PyStructSequence_SET_ITEM (C function): Struct Sequence オブジェクト.
                                                             (line  119)
* PyStructSequence_SetItem (C function): Struct Sequence オブジェクト.
                                                             (line  107)
* PyStructSequence_UnnamedField (C var): Struct Sequence オブジェクト.
                                                             (line   75)
* PySuper_Type (C var):                  Built-in descriptors.
                                                             (line    6)
* PySys_AddAuditHook (C function):       システム関数.       (line  115)
* PySys_Audit (C function):              システム関数.       (line   74)
* PySys_AuditTuple (C function):         システム関数.       (line  107)
* PySys_FormatStderr (C function):       システム関数.       (line   59)
* PySys_FormatStdout (C function):       システム関数.       (line   52)
* PySys_GetObject (C function):          システム関数.       (line   11)
* PySys_GetXOptions (C function):        システム関数.       (line   66)
* PySys_ResetWarnOptions (C function):   システム関数.       (line   22)
* PySys_SetArgv (C function):            プロセスワイドのパラメータ.
                                                             (line  272)
* PySys_SetArgvEx (C function):          プロセスワイドのパラメータ.
                                                             (line  221)
* PySys_SetObject (C function):          システム関数.       (line   16)
* PySys_WriteStderr (C function):        システム関数.       (line   47)
* PySys_WriteStdout (C function):        システム関数.       (line   30)
* Python 3000:                           用語集<2>.          (line 1459)
* Python Editor:                         IDLE --- Python のエディタとシェル<2>.
                                                             (line    8)
* Python Enhancement Proposals; PEP 0007#documentation-strings: ドキュメント<29>.
                                                             (line   35)
* Python Enhancement Proposals; PEP 0249#threadsafety: モジュール定数.
                                                             (line  110)
* Python Enhancement Proposals; PEP 0453#recommendations-for-downstream-distributors: デフォルトでの pip のブートストラッピング.
                                                             (line   39)
* Python Enhancement Proposals; PEP 0477#disabling-ensurepip-by-downstream-distributors: デフォルトでの pip のブートストラッピング<2>.
                                                             (line   29)
* Python Enhancement Proposals; PEP 0564#annex-clocks-resolution-in-python: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数.
                                                             (line   26)
* Python Enhancement Proposals; PEP 0626#out-of-process-debuggers-and-profilers: コードオブジェクト<3>.
                                                             (line  104)
* Python Enhancement Proposals; PEP 0632#migration-advice: 概要 -- リリースハイライト<3>.
                                                             (line  111)
* Python Enhancement Proposals; PEP 0683: 参照カウント.      (line   73)
* Python Enhancement Proposals; PEP 1:   新しい開発プロセス. (line   65)
* Python Enhancement Proposals; PEP 1 <1>: 新しい開発プロセス.
                                                             (line   78)
* Python Enhancement Proposals; PEP 1 <2>: 用語集<2>.        (line 1428)
* Python Enhancement Proposals; PEP 100: Unicode 文字列型<2>.
                                                             (line   18)
* Python Enhancement Proposals; PEP 11:  Build changes.      (line   19)
* Python Enhancement Proposals; PEP 11 <1>: Support for mobile platforms.
                                                             (line    6)
* Python Enhancement Proposals; PEP 11 <2>: Support for mobile platforms.
                                                             (line   15)
* Python Enhancement Proposals; PEP 11 <3>: Build Changes.   (line    6)
* Python Enhancement Proposals; PEP 11 <4>: Build Changes.   (line   10)
* Python Enhancement Proposals; PEP 11 <5>: Build Changes.   (line   14)
* Python Enhancement Proposals; PEP 11 <6>: Build Changes.   (line   17)
* Python Enhancement Proposals; PEP 11 <7>: Build Changes<3>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 11 <8>: PEP 538 レガシーな C ロケールの抑圧.
                                                             (line   19)
* Python Enhancement Proposals; PEP 11 <9>: サポートされないオペレーティングシステム.
                                                             (line    6)
* Python Enhancement Proposals; PEP 11 <10>: ライブラリの変更.
                                                             (line   14)
* Python Enhancement Proposals; PEP 11 <11>: ビルド<32>.     (line   56)
* Python Enhancement Proposals; PEP 11 <12>: ビルド<32>.     (line  107)
* Python Enhancement Proposals; PEP 11 <13>: ビルド<70>.     (line   14)
* Python Enhancement Proposals; PEP 11 <14>: ビルド要件.     (line   28)
* Python Enhancement Proposals; PEP 11 <15>: Supported Windows versions.
                                                             (line    6)
* Python Enhancement Proposals; PEP 11 <16>: 便利なマクロ.   (line   17)
* Python Enhancement Proposals; PEP 11#tier-2: 概要 -- リリースハイライト<2>.
                                                             (line  138)
* Python Enhancement Proposals; PEP 11#tier-3: 概要 -- リリースハイライト.
                                                             (line   69)
* Python Enhancement Proposals; PEP 11#tier-3 <1>: Build changes.
                                                             (line    6)
* Python Enhancement Proposals; PEP 11#tier-3 <2>: 概要 -- リリースハイライト<2>.
                                                             (line  132)
* Python Enhancement Proposals; PEP 11#tier-3 <3>: 概要 -- リリースハイライト<2>.
                                                             (line  135)
* Python Enhancement Proposals; PEP 11#tier-3 <4>: Build Changes<3>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 201: 新しい開発プロセス. (line   81)
* Python Enhancement Proposals; PEP 205: PEP 205 弱参照.     (line   82)
* Python Enhancement Proposals; PEP 205 <1>: weakref --- Weak references.
                                                             (line  343)
* Python Enhancement Proposals; PEP 207: PEP 207 拡張比較.   (line   68)
* Python Enhancement Proposals; PEP 207 <1>: PEP 207 拡張比較.
                                                             (line   74)
* Python Enhancement Proposals; PEP 208: PEP 208 新しい型強制モデル.
                                                             (line   26)
* Python Enhancement Proposals; PEP 217: PEP 217 対話モード用 Display Hook.
                                                             (line   27)
* Python Enhancement Proposals; PEP 218: PEP 218 ビルトインの集合オブジェクト.
                                                             (line   51)
* Python Enhancement Proposals; PEP 218 <1>: その他の言語変更<17>.
                                                             (line   11)
* Python Enhancement Proposals; PEP 218 <2>: PEP 218 標準の集合データ型.
                                                             (line   86)
* Python Enhancement Proposals; PEP 227: PEP 227 入れ子状のスコープ.
                                                             (line   89)
* Python Enhancement Proposals; PEP 227 <1>: PEP 227 入れ子状のスコープ<2>.
                                                             (line   90)
* Python Enhancement Proposals; PEP 227 <2>: モジュールコンテンツ<5>.
                                                             (line   14)
* Python Enhancement Proposals; PEP 229: PEP 229 新しいビルドシステム.
                                                             (line   39)
* Python Enhancement Proposals; PEP 230: PEP 230 警告フレームワーク.
                                                             (line   71)
* Python Enhancement Proposals; PEP 232: PEP 232 関数の属性. (line   36)
* Python Enhancement Proposals; PEP 234: PEP 234 イテレータ. (line  126)
* Python Enhancement Proposals; PEP 235: はじめに<13>.       (line   49)
* Python Enhancement Proposals; PEP 236: PEP 227 入れ子状のスコープ<2>.
                                                             (line   80)
* Python Enhancement Proposals; PEP 236 <1>: PEP 227 入れ子状のスコープ<2>.
                                                             (line   82)
* Python Enhancement Proposals; PEP 236 <2>: PEP 236 __future__ 指示文.
                                                             (line   28)
* Python Enhancement Proposals; PEP 236 <3>: future 文 future statement.
                                                             (line   83)
* Python Enhancement Proposals; PEP 236 <4>: モジュールコンテンツ<5>.
                                                             (line  104)
* Python Enhancement Proposals; PEP 237: 整数.               (line    6)
* Python Enhancement Proposals; PEP 237 <1>: PEP 237 長整数と整数を一体化していく.
                                                             (line   21)
* Python Enhancement Proposals; PEP 237 <2>: その他の言語変更<17>.
                                                             (line   16)
* Python Enhancement Proposals; PEP 237 <3>: PEP 237 長整数と整数を一体化していく<2>.
                                                             (line   42)
* Python Enhancement Proposals; PEP 237 <4>: printf 形式の文字列書式化.
                                                             (line  178)
* Python Enhancement Proposals; PEP 237 <5>: printf 形式での bytes の書式化.
                                                             (line  181)
* Python Enhancement Proposals; PEP 238: 整数.               (line   10)
* Python Enhancement Proposals; PEP 238 <1>: PEP 238 除算演算子を変更していく.
                                                             (line   20)
* Python Enhancement Proposals; PEP 238 <2>: PEP 238 除算演算子を変更していく.
                                                             (line   27)
* Python Enhancement Proposals; PEP 238 <3>: PEP 238 除算演算子を変更していく.
                                                             (line   67)
* Python Enhancement Proposals; PEP 238 <4>: モジュールコンテンツ<5>.
                                                             (line   22)
* Python Enhancement Proposals; PEP 238 <5>: 用語集<2>.      (line  640)
* Python Enhancement Proposals; PEP 241: PEP 241 Pythonソフトウェアパッケージのためのメタデータ.
                                                             (line   17)
* Python Enhancement Proposals; PEP 241 <1>: PEP 241 Pythonソフトウェアパッケージのためのメタデータ.
                                                             (line   30)
* Python Enhancement Proposals; PEP 241 <2>: PEP 241 Pythonソフトウェアパッケージのためのメタデータ.
                                                             (line   37)
* Python Enhancement Proposals; PEP 243: PEP 241 Pythonソフトウェアパッケージのためのメタデータ.
                                                             (line   41)
* Python Enhancement Proposals; PEP 246: ドキュメント<28>.   (line   48)
* Python Enhancement Proposals; PEP 246 <1>: PrepareProtocol オブジェクト.
                                                             (line   10)
* Python Enhancement Proposals; PEP 247: hmac<4>.            (line   20)
* Python Enhancement Proposals; PEP 249: sqlite3<3>.         (line   11)
* Python Enhancement Proposals; PEP 249 <1>: sqlite3 パッケージ.
                                                             (line   17)
* Python Enhancement Proposals; PEP 249 <2>: sqlite3 パッケージ.
                                                             (line  110)
* Python Enhancement Proposals; PEP 249 <3>: ライブラリ<77>. (line  124)
* Python Enhancement Proposals; PEP 249 <4>: ライブラリ<92>. (line  296)
* Python Enhancement Proposals; PEP 249 <5>: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース.
                                                             (line   16)
* Python Enhancement Proposals; PEP 249 <6>: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース.
                                                             (line   50)
* Python Enhancement Proposals; PEP 249 <7>: モジュール関数. (line   71)
* Python Enhancement Proposals; PEP 249 <8>: Connection オブジェクト.
                                                             (line  747)
* Python Enhancement Proposals; PEP 249 <9>: Connection オブジェクト.
                                                             (line  750)
* Python Enhancement Proposals; PEP 249 <10>: Connection オブジェクト.
                                                             (line  763)
* Python Enhancement Proposals; PEP 249 <11>: 例外<7>.       (line    6)
* Python Enhancement Proposals; PEP 249 <12>: プレースホルダを使用して SQL クエリに値を結び付ける方法.
                                                             (line   54)
* Python Enhancement Proposals; PEP 249 <13>: autocommit 属性に依るトランザクション制御.
                                                             (line   11)
* Python Enhancement Proposals; PEP 249 <14>: autocommit 属性に依るトランザクション制御.
                                                             (line   34)
* Python Enhancement Proposals; PEP 252: 関連リンク.         (line   16)
* Python Enhancement Proposals; PEP 252 <1>: 関連リンク.     (line   16)
* Python Enhancement Proposals; PEP 252 <2>: デスクリプタ descriptor の実装.
                                                             (line   26)
* Python Enhancement Proposals; PEP 253: 旧と新クラス.       (line   28)
* Python Enhancement Proposals; PEP 253 <1>: 多重継承 ダイヤモンドルール.
                                                             (line    8)
* Python Enhancement Proposals; PEP 253 <2>: 関連リンク.     (line   16)
* Python Enhancement Proposals; PEP 253 <3>: 関連リンク.     (line   18)
* Python Enhancement Proposals; PEP 253 <4>: 関連リンク.     (line   21)
* Python Enhancement Proposals; PEP 255: PEP 255 単純なジェネレータ.
                                                             (line   41)
* Python Enhancement Proposals; PEP 255 <1>: PEP 255 単純なジェネレータ.
                                                             (line  140)
* Python Enhancement Proposals; PEP 255 <2>: PEP 255 単純なジェネレータ<2>.
                                                             (line   41)
* Python Enhancement Proposals; PEP 255 <3>: PEP 255 単純なジェネレータ<2>.
                                                             (line  140)
* Python Enhancement Proposals; PEP 255 <4>: Yield 式.       (line   84)
* Python Enhancement Proposals; PEP 255 <5>: モジュールコンテンツ<5>.
                                                             (line   18)
* Python Enhancement Proposals; PEP 261: Unicode の変更.     (line   19)
* Python Enhancement Proposals; PEP 261 <1>: Unicode の変更. (line   62)
* Python Enhancement Proposals; PEP 263: その他の言語変更<16>.
                                                             (line   99)
* Python Enhancement Proposals; PEP 263 <1>: PEP 263 ソースコードのエンコーディング.
                                                             (line   29)
* Python Enhancement Proposals; PEP 263 <2>: Core and Builtins<102>.
                                                             (line   30)
* Python Enhancement Proposals; PEP 263 <3>: はじめに<13>.   (line   53)
* Python Enhancement Proposals; PEP 263 <4>: 入力のトークナイズ.
                                                             (line   33)
* Python Enhancement Proposals; PEP 263 <5>: 入力のトークナイズ.
                                                             (line   86)
* Python Enhancement Proposals; PEP 263 <6>: Python ソースコード内の Unicode リテラル.
                                                             (line   46)
* Python Enhancement Proposals; PEP 264: その他の変更と修正<3>.
                                                             (line   52)
* Python Enhancement Proposals; PEP 273: PEP 273 Zip アーカイブからモジュールをインポートする.
                                                             (line   41)
* Python Enhancement Proposals; PEP 273 <1>: PEP 273 Zip アーカイブからモジュールをインポートする.
                                                             (line   44)
* Python Enhancement Proposals; PEP 273 <2>: zipimport --- Zip アーカイブからモジュールをインポートする.
                                                             (line   44)
* Python Enhancement Proposals; PEP 273 <3>: zipimport --- Zip アーカイブからモジュールをインポートする.
                                                             (line   47)
* Python Enhancement Proposals; PEP 274: 新たな構文.         (line   44)
* Python Enhancement Proposals; PEP 277: PEP 277 Windows NT での Unicode ファイル名サポート.
                                                             (line   35)
* Python Enhancement Proposals; PEP 278: PEP 278 Universal Newline サポート.
                                                             (line   31)
* Python Enhancement Proposals; PEP 278 <1>: 用語集<2>.      (line 1837)
* Python Enhancement Proposals; PEP 279: PEP 279 enumerate.  (line   28)
* Python Enhancement Proposals; PEP 282: PEP 282 ロギングパッケージ.
                                                             (line  103)
* Python Enhancement Proposals; PEP 282 <1>: PEP 282 ロギングパッケージ.
                                                             (line  109)
* Python Enhancement Proposals; PEP 282 <2>: アーカイブ化操作.
                                                             (line   50)
* Python Enhancement Proposals; PEP 282 <3>: warnings モジュールとの統合.
                                                             (line   34)
* Python Enhancement Proposals; PEP 285: PEP 285 Boolean 型. (line   46)
* Python Enhancement Proposals; PEP 285 <1>: PEP 285 Boolean 型.
                                                             (line   69)
* Python Enhancement Proposals; PEP 288: PEP 342 ジェネレータの新機能.
                                                             (line  139)
* Python Enhancement Proposals; PEP 289: PEP 289 ジェネレータ式.
                                                             (line   55)
* Python Enhancement Proposals; PEP 289 <1>: その他の言語変更<17>.
                                                             (line   14)
* Python Enhancement Proposals; PEP 289 <2>: Python 文書.    (line   12)
* Python Enhancement Proposals; PEP 292: PEP 292 より単純な文字列置換 string substitution.
                                                             (line   45)
* Python Enhancement Proposals; PEP 292 <1>: Template strings $-strings.
                                                             (line   16)
* Python Enhancement Proposals; PEP 293: PEP 293 コーデックエラーを処理するコールバック.
                                                             (line   29)
* Python Enhancement Proposals; PEP 3000: Python 3 0.        (line   42)
* Python Enhancement Proposals; PEP 301: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ.
                                                             (line   43)
* Python Enhancement Proposals; PEP 302: インポート実装としての importlib の使用.
                                                             (line   12)
* Python Enhancement Proposals; PEP 302 <1>: 目に見える変化. (line   19)
* Python Enhancement Proposals; PEP 302 <2>: Python コードの移植.
                                                             (line   72)
* Python Enhancement Proposals; PEP 302 <3>: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>.
                                                             (line  107)
* Python Enhancement Proposals; PEP 302 <4>: 新たなモジュール、改良されたモジュール、削除されたモジュール.
                                                             (line  280)
* Python Enhancement Proposals; PEP 302 <5>: PEP 273 Zip アーカイブからモジュールをインポートする.
                                                             (line   45)
* Python Enhancement Proposals; PEP 302 <6>: PEP 302 新たなインポートフック.
                                                             (line   14)
* Python Enhancement Proposals; PEP 302 <7>: PEP 302 新たなインポートフック.
                                                             (line   43)
* Python Enhancement Proposals; PEP 302 <8>: PEP 302 新たなインポートフック.
                                                             (line   67)
* Python Enhancement Proposals; PEP 302 <9>: インポートシステム.
                                                             (line   40)
* Python Enhancement Proposals; PEP 302 <10>: 参考資料.      (line   10)
* Python Enhancement Proposals; PEP 302 <11>: 組み込み関数.  (line 2185)
* Python Enhancement Proposals; PEP 302 <12>: linecache --- テキストラインへのランダムアクセス.
                                                             (line   34)
* Python Enhancement Proposals; PEP 302 <13>: sys --- システム固有のパラメーターと関数.
                                                             (line 1467)
* Python Enhancement Proposals; PEP 302 <14>: sys --- システム固有のパラメーターと関数.
                                                             (line 1477)
* Python Enhancement Proposals; PEP 302 <15>: zipimport --- Zip アーカイブからモジュールをインポートする.
                                                             (line   48)
* Python Enhancement Proposals; PEP 302 <16>: pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line   63)
* Python Enhancement Proposals; PEP 302 <17>: pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line   82)
* Python Enhancement Proposals; PEP 302 <18>: pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line  103)
* Python Enhancement Proposals; PEP 302 <19>: pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line  142)
* Python Enhancement Proposals; PEP 302 <20>: runpy --- Python モジュールの位置特定と実行.
                                                             (line   31)
* Python Enhancement Proposals; PEP 302 <21>: はじめに<13>.  (line   57)
* Python Enhancement Proposals; PEP 302 <22>: importlib abc -- Abstract base classes related to import.
                                                             (line   93)
* Python Enhancement Proposals; PEP 302 <23>: importlib abc -- Abstract base classes related to import.
                                                             (line  181)
* Python Enhancement Proposals; PEP 302 <24>: importlib abc -- Abstract base classes related to import.
                                                             (line  208)
* Python Enhancement Proposals; PEP 302 <25>: importlib abc -- Abstract base classes related to import.
                                                             (line  280)
* Python Enhancement Proposals; PEP 302 <26>: 用語集<2>.     (line 1081)
* Python Enhancement Proposals; PEP 305: PEP 305 カンマ区切り形式ファイル.
                                                             (line   41)
* Python Enhancement Proposals; PEP 305 <1>: csv --- CSV ファイルの読み書き.
                                                             (line   39)
* Python Enhancement Proposals; PEP 307: PEP 307 Pickle の機能拡張.
                                                             (line    8)
* Python Enhancement Proposals; PEP 307 <1>: PEP 307 Pickle の機能拡張.
                                                             (line   30)
* Python Enhancement Proposals; PEP 307 <2>: PEP 307 Pickle の機能拡張.
                                                             (line   42)
* Python Enhancement Proposals; PEP 307 <3>: データストリームの形式.
                                                             (line   32)
* Python Enhancement Proposals; PEP 308: PEP 308 条件式 Conditional Expressions.
                                                             (line   63)
* Python Enhancement Proposals; PEP 308 <1>: PEP 308 条件式 Conditional Expressions.
                                                             (line   70)
* Python Enhancement Proposals; PEP 308 <2>: 条件式 Conditional Expressions.
                                                             (line   17)
* Python Enhancement Proposals; PEP 309: PEP 309 関数の部分適用.
                                                             (line   71)
* Python Enhancement Proposals; PEP 3100: Python 3 0.        (line   43)
* Python Enhancement Proposals; PEP 3101: PEP 3101 文字列整形の新たなアプローチ.
                                                             (line    3)
* Python Enhancement Proposals; PEP 3101 <1>: PEP 3101 文字列整形の新たなアプローチ.
                                                             (line    8)
* Python Enhancement Proposals; PEP 3101 <2>: PEP 3101 進化版文字列フォーマッティング.
                                                             (line    3)
* Python Enhancement Proposals; PEP 3101 <3>: PEP 3101 進化版文字列フォーマッティング.
                                                             (line  156)
* Python Enhancement Proposals; PEP 3101 <4>: カスタムの文字列書式化.
                                                             (line    8)
* Python Enhancement Proposals; PEP 3101 <5>: カスタムの文字列書式化.
                                                             (line   62)
* Python Enhancement Proposals; PEP 3102: 新たな構文.        (line   14)
* Python Enhancement Proposals; PEP 3104: 新たな構文.        (line   29)
* Python Enhancement Proposals; PEP 3104 <1>: nonlocal 文.   (line   25)
* Python Enhancement Proposals; PEP 3105: print関数.         (line    7)
* Python Enhancement Proposals; PEP 3105 <1>: PEP 3105 print を関数にする.
                                                             (line   33)
* Python Enhancement Proposals; PEP 3105 <2>: モジュールコンテンツ<5>.
                                                             (line   35)
* Python Enhancement Proposals; PEP 3106: PEP 3106 辞書 View.
                                                             (line   57)
* Python Enhancement Proposals; PEP 3107: PEP 563 アノテーションの遅延評価.
                                                             (line    6)
* Python Enhancement Proposals; PEP 3107 <1>: PEP 484 - 型ヒント.
                                                             (line    6)
* Python Enhancement Proposals; PEP 3107 <2>: 新たな構文.    (line    6)
* Python Enhancement Proposals; PEP 3107 <3>: 関数のアノテーション.
                                                             (line    7)
* Python Enhancement Proposals; PEP 3107 <4>: 関数定義.      (line  136)
* Python Enhancement Proposals; PEP 3107 <5>: Annotation semantics.
                                                             (line   10)
* Python Enhancement Proposals; PEP 3107 <6>: Annotation semantics.
                                                             (line   45)
* Python Enhancement Proposals; PEP 3108: ライブラリの変更.  (line    7)
* Python Enhancement Proposals; PEP 3108 <1>: ライブラリの変更.
                                                             (line   16)
* Python Enhancement Proposals; PEP 3108 <2>: ライブラリの変更.
                                                             (line   94)
* Python Enhancement Proposals; PEP 3109: 変更された構文.    (line    6)
* Python Enhancement Proposals; PEP 3109 <1>: 例外に関する変更.
                                                             (line   28)
* Python Enhancement Proposals; PEP 3110: 変更された構文.    (line   15)
* Python Enhancement Proposals; PEP 3110 <1>: 例外に関する変更.
                                                             (line   34)
* Python Enhancement Proposals; PEP 3110 <2>: PEP 3110 例外処理の変更.
                                                             (line   45)
* Python Enhancement Proposals; PEP 3111: 組み込み.          (line   12)
* Python Enhancement Proposals; PEP 3112: PEP 3112 バイトリテラル.
                                                             (line   75)
* Python Enhancement Proposals; PEP 3112 <1>: モジュールコンテンツ<5>.
                                                             (line   39)
* Python Enhancement Proposals; PEP 3113: 削除された操作.    (line    6)
* Python Enhancement Proposals; PEP 3114: 演算子と特殊メソッド.
                                                             (line   19)
* Python Enhancement Proposals; PEP 3115: types<8>.          (line   10)
* Python Enhancement Proposals; PEP 3115 <1>: 変更された構文.
                                                             (line   17)
* Python Enhancement Proposals; PEP 3115 <2>: クラスの名前空間の準備.
                                                             (line   20)
* Python Enhancement Proposals; PEP 3115 <3>: クラス定義.    (line   83)
* Python Enhancement Proposals; PEP 3115 <4>: 動的な型生成.  (line   48)
* Python Enhancement Proposals; PEP 3115 <5>: 関数およびクラス定義.
                                                             (line  180)
* Python Enhancement Proposals; PEP 3116: 最適化<13>.        (line    8)
* Python Enhancement Proposals; PEP 3116 <1>: PEP 3116 新しい I/O ライブラリ.
                                                             (line   73)
* Python Enhancement Proposals; PEP 3116 <2>: 用語集<2>.     (line 1837)
* Python Enhancement Proposals; PEP 3118: Pickle プロトコルバージョン 5 による帯域外データバッファ.
                                                             (line   10)
* Python Enhancement Proposals; PEP 3118 <1>: PEP 3118 新たなメモリビューの実装とバッファプロトコルのドキュメント.
                                                             (line    6)
* Python Enhancement Proposals; PEP 3118 <2>: API の変更.    (line   31)
* Python Enhancement Proposals; PEP 3118 <3>: ビルドならびに C API の変更<4>.
                                                             (line    8)
* Python Enhancement Proposals; PEP 3118 <4>: ビルドならびに C API の変更<7>.
                                                             (line   11)
* Python Enhancement Proposals; PEP 3118 <5>: PEP 3118 改訂版バッファプロトコル.
                                                             (line   45)
* Python Enhancement Proposals; PEP 3118 <6>: ライブラリ<173>.
                                                             (line   99)
* Python Enhancement Proposals; PEP 3118 <7>: ライブラリ<178>.
                                                             (line   61)
* Python Enhancement Proposals; PEP 3118 <8>: ライブラリ<207>.
                                                             (line  958)
* Python Enhancement Proposals; PEP 3118 <9>: メモリビュー.  (line  118)
* Python Enhancement Proposals; PEP 3118 <10>: モジュールインターフェース.
                                                             (line   27)
* Python Enhancement Proposals; PEP 3119: PEP 3119 抽象基底クラス.
                                                             (line  137)
* Python Enhancement Proposals; PEP 3119 <1>: インスタンスのカスタマイズとサブクラスチェック.
                                                             (line   34)
* Python Enhancement Proposals; PEP 3119 <2>: 例とレシピ.    (line   70)
* Python Enhancement Proposals; PEP 3119 <3>: abc --- 抽象基底クラス.
                                                             (line   10)
* Python Enhancement Proposals; PEP 3119 <4>: オブジェクトプロトコル object protocol.
                                                             (line  378)
* Python Enhancement Proposals; PEP 3119 <5>: オブジェクトプロトコル object protocol.
                                                             (line  399)
* Python Enhancement Proposals; PEP 3120: Unicode 対 8 ビット、ではなく、テキスト対データに.
                                                             (line  112)
* Python Enhancement Proposals; PEP 3120 <1>: はじめに<13>.  (line   89)
* Python Enhancement Proposals; PEP 3121: ビルドならびに C API の変更<7>.
                                                             (line   13)
* Python Enhancement Proposals; PEP 3121 <1>: ライブラリ<147>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 3121 <2>: Module definitions.
                                                             (line   65)
* Python Enhancement Proposals; PEP 3123: ビルドならびに C API の変更<7>.
                                                             (line   15)
* Python Enhancement Proposals; PEP 3127: PEP 3127 整数リテラルのサポートと文法.
                                                             (line   46)
* Python Enhancement Proposals; PEP 3129: PEP 3129 クラスデコレータ.
                                                             (line   24)
* Python Enhancement Proposals; PEP 3129 <1>: 関数定義.      (line  157)
* Python Enhancement Proposals; PEP 3129 <2>: クラス定義.    (line   88)
* Python Enhancement Proposals; PEP 3131: Unicode 対 8 ビット、ではなく、テキスト対データに.
                                                             (line  114)
* Python Enhancement Proposals; PEP 3131 <1>: ライブラリ<162>.
                                                             (line  600)
* Python Enhancement Proposals; PEP 3131 <2>: Non-ASCII characters in names.
                                                             (line   91)
* Python Enhancement Proposals; PEP 3132: 新たな構文.        (line   33)
* Python Enhancement Proposals; PEP 3132 <1>: 代入文 assignment statement.
                                                             (line  150)
* Python Enhancement Proposals; PEP 3134: 変更された構文.    (line    6)
* Python Enhancement Proposals; PEP 3134 <1>: 例外に関する変更.
                                                             (line   39)
* Python Enhancement Proposals; PEP 3134 <2>: 例外に関する変更.
                                                             (line   60)
* Python Enhancement Proposals; PEP 3134 <3>: ライブラリ<92>.
                                                             (line   48)
* Python Enhancement Proposals; PEP 3134 <4>: 基底クラス.    (line   27)
* Python Enhancement Proposals; PEP 3135: 組み込み.          (line    6)
* Python Enhancement Proposals; PEP 3135 <1>: クラスオブジェクトの作成.
                                                             (line   52)
* Python Enhancement Proposals; PEP 3137: PEP 3137 memoryview オブジェクト.
                                                             (line   49)
* Python Enhancement Proposals; PEP 3138: Unicode 対 8 ビット、ではなく、テキスト対データに.
                                                             (line  108)
* Python Enhancement Proposals; PEP 314: PEP 314 Metadata for Python Software Packages v1 1.
                                                             (line   42)
* Python Enhancement Proposals; PEP 3141: PEP 3141 数値の型階層.
                                                             (line   41)
* Python Enhancement Proposals; PEP 3141 <1>: numbers --- 数の抽象基底クラス.
                                                             (line   10)
* Python Enhancement Proposals; PEP 3141 <2>: abc --- 抽象基底クラス.
                                                             (line   13)
* Python Enhancement Proposals; PEP 3144: ipaddress<6>.      (line   11)
* Python Enhancement Proposals; PEP 3147: PEP 421 sys implementation の追加.
                                                             (line   19)
* Python Enhancement Proposals; PEP 3147 <1>: PEP 3147 PYC リポジトリーディレクトリ.
                                                             (line   68)
* Python Enhancement Proposals; PEP 3147 <2>: "コンパイル" された Python ファイル.
                                                             (line   49)
* Python Enhancement Proposals; PEP 3147 <3>: Import-related attributes on module objects.
                                                             (line  155)
* Python Enhancement Proposals; PEP 3147 <4>: test support import_helper --- Utilities for import tests.
                                                             (line   82)
* Python Enhancement Proposals; PEP 3147 <5>: runpy --- Python モジュールの位置特定と実行.
                                                             (line   86)
* Python Enhancement Proposals; PEP 3147 <6>: はじめに<13>.  (line   93)
* Python Enhancement Proposals; PEP 3147 <7>: importlib util -- Utility code for importers.
                                                             (line   24)
* Python Enhancement Proposals; PEP 3147 <8>: importlib util -- Utility code for importers.
                                                             (line   60)
* Python Enhancement Proposals; PEP 3147 <9>: importlib util -- Utility code for importers.
                                                             (line   64)
* Python Enhancement Proposals; PEP 3147 <10>: py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   29)
* Python Enhancement Proposals; PEP 3147 <11>: py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   70)
* Python Enhancement Proposals; PEP 3147 <12>: コマンドラインでの使用<9>.
                                                             (line   68)
* Python Enhancement Proposals; PEP 3147 <13>: パブリックな関数.
                                                             (line   40)
* Python Enhancement Proposals; PEP 3147 <14>: パブリックな関数.
                                                             (line  122)
* Python Enhancement Proposals; PEP 3147 <15>: モジュールのインポート<2>.
                                                             (line  217)
* Python Enhancement Proposals; PEP 3147 <16>: pyc ファイルを作るにはどうしますか？.
                                                             (line   12)
* Python Enhancement Proposals; PEP 3148: PEP 3148 concurrent futures モジュール.
                                                             (line   53)
* Python Enhancement Proposals; PEP 3148 <1>: モジュール関数<2>.
                                                             (line   60)
* Python Enhancement Proposals; PEP 3149: PEP 3149 ABI バージョンでタグ付けされた so ファイル.
                                                             (line   33)
* Python Enhancement Proposals; PEP 3149 <1>: Core and Builtins<201>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 3149 <2>: sys --- システム固有のパラメーターと関数.
                                                             (line   16)
* Python Enhancement Proposals; PEP 3151: PEP 3151 OS および IO 例外階層の手直し.
                                                             (line   82)
* Python Enhancement Proposals; PEP 3151 <1>: OS 例外.       (line  122)
* Python Enhancement Proposals; PEP 3151 <2>: 例外<18>.      (line   10)
* Python Enhancement Proposals; PEP 3151 <3>: select --- I/O 完了の待機.
                                                             (line   34)
* Python Enhancement Proposals; PEP 3151 <4>: resource --- リソース使用情報.
                                                             (line   22)
* Python Enhancement Proposals; PEP 3151 <5>: Exception types.
                                                             (line  238)
* Python Enhancement Proposals; PEP 3153: asyncio<14>.       (line   22)
* Python Enhancement Proposals; PEP 3154: 概要 -- リリースハイライト<11>.
                                                             (line   58)
* Python Enhancement Proposals; PEP 3154 <1>: pickle<5>.     (line   16)
* Python Enhancement Proposals; PEP 3154 <2>: ライブラリ<162>.
                                                             (line 1280)
* Python Enhancement Proposals; PEP 3154 <3>: データストリームの形式.
                                                             (line   44)
* Python Enhancement Proposals; PEP 3155: PEP 3155 クラスと関数の正規名.
                                                             (line   63)
* Python Enhancement Proposals; PEP 3155 <1>: 用語集<2>.     (line 1485)
* Python Enhancement Proposals; PEP 3156: 概要 -- リリースハイライト<11>.
                                                             (line   32)
* Python Enhancement Proposals; PEP 3156 <1>: 概要 -- リリースハイライト<11>.
                                                             (line   44)
* Python Enhancement Proposals; PEP 3156 <2>: asyncio<14>.   (line    6)
* Python Enhancement Proposals; PEP 3156 <3>: asyncio<14>.   (line   18)
* Python Enhancement Proposals; PEP 3156 <4>: selectors<2>.  (line    6)
* Python Enhancement Proposals; PEP 318: PEP 318 関数とメソッドのためのデコレータ.
                                                             (line  100)
* Python Enhancement Proposals; PEP 318 <1>: PEP 318 関数とメソッドのためのデコレータ.
                                                             (line  124)
* Python Enhancement Proposals; PEP 318 <2>: その他の言語変更<17>.
                                                             (line    8)
* Python Enhancement Proposals; PEP 318 <3>: 関数定義.       (line  154)
* Python Enhancement Proposals; PEP 318 <4>: クラス定義.     (line   91)
* Python Enhancement Proposals; PEP 322: PEP 322 逆順のイテレーション.
                                                             (line   34)
* Python Enhancement Proposals; PEP 322 <1>: その他の言語変更<17>.
                                                             (line   12)
* Python Enhancement Proposals; PEP 324: PEP 324 新しい subprocess モジュール.
                                                             (line   83)
* Python Enhancement Proposals; PEP 324 <1>: subprocess --- サブプロセス管理.
                                                             (line   23)
* Python Enhancement Proposals; PEP 325: PEP 342 ジェネレータの新機能.
                                                             (line  140)
* Python Enhancement Proposals; PEP 327: Context 型.         (line   55)
* Python Enhancement Proposals; PEP 328: Python コードの移植.
                                                             (line   39)
* Python Enhancement Proposals; PEP 328 <1>: 削除された操作. (line   31)
* Python Enhancement Proposals; PEP 328 <2>: PEP 328 絶対インポート、相対インポート.
                                                             (line    6)
* Python Enhancement Proposals; PEP 328 <3>: PEP 328 絶対インポート、相対インポート.
                                                             (line   84)
* Python Enhancement Proposals; PEP 328 <4>: PEP 328 マルチラインインポート.
                                                             (line   34)
* Python Enhancement Proposals; PEP 328 <5>: その他の言語変更<17>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 328 <6>: 参考資料.       (line   20)
* Python Enhancement Proposals; PEP 328 <7>: 組み込み関数.   (line 2202)
* Python Enhancement Proposals; PEP 328 <8>: モジュールコンテンツ<5>.
                                                             (line   26)
* Python Enhancement Proposals; PEP 328 <9>: はじめに<13>.   (line   61)
* Python Enhancement Proposals; PEP 331: PEP 331 Locale に依存しない Float/String 変換.
                                                             (line   37)
* Python Enhancement Proposals; PEP 333: wsgiref パッケージ. (line    7)
* Python Enhancement Proposals; PEP 333 <1>: wsgiref パッケージ.
                                                             (line   31)
* Python Enhancement Proposals; PEP 3333: 新たなモジュール<3>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 3333 <1>: PEP 3333 Python Web Server Gateway Interface v1 0 1.
                                                             (line   54)
* Python Enhancement Proposals; PEP 3333 <2>: wsgiref --- WSGI ユーティリティとリファレンス実装.
                                                             (line   30)
* Python Enhancement Proposals; PEP 3333 <3>: wsgiref util -- WSGI environment utilities.
                                                             (line    7)
* Python Enhancement Proposals; PEP 3333 <4>: wsgiref util -- WSGI environment utilities.
                                                             (line    9)
* Python Enhancement Proposals; PEP 3333 <5>: wsgiref util -- WSGI environment utilities.
                                                             (line   28)
* Python Enhancement Proposals; PEP 3333 <6>: wsgiref util -- WSGI environment utilities.
                                                             (line   75)
* Python Enhancement Proposals; PEP 3333 <7>: wsgiref headers -- WSGI response header tools.
                                                             (line   11)
* Python Enhancement Proposals; PEP 3333 <8>: wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line   20)
* Python Enhancement Proposals; PEP 3333 <9>: wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line   98)
* Python Enhancement Proposals; PEP 3333 <10>: wsgiref validate --- WSGI conformance checker.
                                                             (line   13)
* Python Enhancement Proposals; PEP 3333 <11>: wsgiref validate --- WSGI conformance checker.
                                                             (line   36)
* Python Enhancement Proposals; PEP 3333 <12>: wsgiref handlers -- server/gateway base classes.
                                                             (line  234)
* Python Enhancement Proposals; PEP 3333 <13>: wsgiref handlers -- server/gateway base classes.
                                                             (line  250)
* Python Enhancement Proposals; PEP 3333 <14>: wsgiref handlers -- server/gateway base classes.
                                                             (line  256)
* Python Enhancement Proposals; PEP 3333 <15>: wsgiref handlers -- server/gateway base classes.
                                                             (line  268)
* Python Enhancement Proposals; PEP 3333 <16>: wsgiref handlers -- server/gateway base classes.
                                                             (line  308)
* Python Enhancement Proposals; PEP 3333 <17>: wsgiref types -- WSGI types for static type checking.
                                                             (line    7)
* Python Enhancement Proposals; PEP 3333 <18>: wsgiref types -- WSGI types for static type checking.
                                                             (line   14)
* Python Enhancement Proposals; PEP 3333#input-and-error-streams: wsgiref types -- WSGI types for static type checking.
                                                             (line   26)
* Python Enhancement Proposals; PEP 3333#input-and-error-streams <1>: wsgiref types -- WSGI types for static type checking.
                                                             (line   30)
* Python Enhancement Proposals; PEP 3333#optional-platform-specific-file-handling: wsgiref types -- WSGI types for static type checking.
                                                             (line   34)
* Python Enhancement Proposals; PEP 3333#the-start-response-callable: wsgiref types -- WSGI types for static type checking.
                                                             (line   13)
* Python Enhancement Proposals; PEP 338: PEP 338 - モジュールをスクリプトとして実行する.
                                                             (line   21)
* Python Enhancement Proposals; PEP 338 <1>: インターフェイスオプション.
                                                             (line  101)
* Python Enhancement Proposals; PEP 338 <2>: 参考資料.       (line   24)
* Python Enhancement Proposals; PEP 338 <3>: runpy --- Python モジュールの位置特定と実行.
                                                             (line  176)
* Python Enhancement Proposals; PEP 339: ビルドならびに C API の変更<10>.
                                                             (line   44)
* Python Enhancement Proposals; PEP 341: PEP 341 try/except/finally の一体化.
                                                             (line   45)
* Python Enhancement Proposals; PEP 342: PEP 342 ジェネレータの新機能.
                                                             (line   40)
* Python Enhancement Proposals; PEP 342 <1>: PEP 342 ジェネレータの新機能.
                                                             (line  133)
* Python Enhancement Proposals; PEP 342 <2>: Python 2 5 への移植.
                                                             (line   15)
* Python Enhancement Proposals; PEP 342 <3>: Yield 式.       (line   88)
* Python Enhancement Proposals; PEP 342 <4>: コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   58)
* Python Enhancement Proposals; PEP 342 <5>: ジェネレータに値を渡す.
                                                             (line   23)
* Python Enhancement Proposals; PEP 342 <6>: Python 文書.    (line   14)
* Python Enhancement Proposals; PEP 343: contextlib モジュール.
                                                             (line   64)
* Python Enhancement Proposals; PEP 343 <1>: PEP 342 ジェネレータの新機能.
                                                             (line  123)
* Python Enhancement Proposals; PEP 343 <2>: contextlib モジュール<2>.
                                                             (line   64)
* Python Enhancement Proposals; PEP 343 <3>: with文とコンテキストマネージャ.
                                                             (line   45)
* Python Enhancement Proposals; PEP 343 <4>: with 文.        (line  112)
* Python Enhancement Proposals; PEP 343 <5>: コンテキストマネージャーを関数デコレーターとして使う.
                                                             (line   50)
* Python Enhancement Proposals; PEP 343 <6>: モジュールコンテンツ<5>.
                                                             (line   31)
* Python Enhancement Proposals; PEP 343 <7>: 用語集<2>.      (line  361)
* Python Enhancement Proposals; PEP 343 <8>: 用語集<2>.      (line  367)
* Python Enhancement Proposals; PEP 347: ビルドならびに C API の変更<10>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 352: 例外に関する変更.   (line    8)
* Python Enhancement Proposals; PEP 352 <1>: 非推奨と削除.   (line    9)
* Python Enhancement Proposals; PEP 352 <2>: PEP 352 例外の新スタイルクラス化.
                                                             (line   65)
* Python Enhancement Proposals; PEP 353: Porting to Python 3 10<2>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 353 <1>: PEP 353 添え字型に ssize_t を使う.
                                                             (line   53)
* Python Enhancement Proposals; PEP 353 <2>: PEP 353 添え字型に ssize_t を使う.
                                                             (line   59)
* Python Enhancement Proposals; PEP 353 <3>: ビルドならびに C API の変更<10>.
                                                             (line   19)
* Python Enhancement Proposals; PEP 353 <4>: C API<45>.      (line   80)
* Python Enhancement Proposals; PEP 353 <5>: 型<2>.          (line   17)
* Python Enhancement Proposals; PEP 356: What's New in Python 2 5.
                                                             (line   10)
* Python Enhancement Proposals; PEP 357: PEP 357 '__index__' メソッド.
                                                             (line   37)
* Python Enhancement Proposals; PEP 361: What's New in Python 2 6.
                                                             (line   10)
* Python Enhancement Proposals; PEP 362: PEP 362 関数シグニチャオブジェクト.
                                                             (line   20)
* Python Enhancement Proposals; PEP 362 <1>: Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  422)
* Python Enhancement Proposals; PEP 362 <2>: 用語集<2>.      (line   87)
* Python Enhancement Proposals; PEP 362 <3>: 用語集<2>.      (line 1364)
* Python Enhancement Proposals; PEP 366: 目に見える変化.     (line   25)
* Python Enhancement Proposals; PEP 366 <1>: Import-related attributes on module objects.
                                                             (line   62)
* Python Enhancement Proposals; PEP 366 <2>: 参考資料.       (line   17)
* Python Enhancement Proposals; PEP 366 <3>: 参考資料.       (line   21)
* Python Enhancement Proposals; PEP 366 <4>: runpy --- Python モジュールの位置特定と実行.
                                                             (line  180)
* Python Enhancement Proposals; PEP 366 <5>: はじめに<13>.   (line   65)
* Python Enhancement Proposals; PEP 370: PEP 370 ユーザごとの site-packages ディレクトリ.
                                                             (line   36)
* Python Enhancement Proposals; PEP 370 <1>: ライブラリ<87>. (line  603)
* Python Enhancement Proposals; PEP 370 <2>: その他のオプション.
                                                             (line  165)
* Python Enhancement Proposals; PEP 370 <3>: 環境変数.       (line  203)
* Python Enhancement Proposals; PEP 370 <4>: 環境変数.       (line  215)
* Python Enhancement Proposals; PEP 370 <5>: コマンドライン・インターフェース<11>.
                                                             (line   37)
* Python Enhancement Proposals; PEP 371: PEP 371 multiprocessing パッケージ.
                                                             (line  146)
* Python Enhancement Proposals; PEP 372: PEP 372 順序付き辞書.
                                                             (line   30)
* Python Enhancement Proposals; PEP 372 <1>: PEP 372 collections に順序付き辞書を追加.
                                                             (line   95)
* Python Enhancement Proposals; PEP 373: Python 2 x の今後.  (line   21)
* Python Enhancement Proposals; PEP 373 <1>: Python はどれくらい安定していますか？.
                                                             (line   20)
* Python Enhancement Proposals; PEP 378: PEP 378 1000区切りのための書式指定子.
                                                             (line   31)
* Python Enhancement Proposals; PEP 378 <1>: PEP 378 1000区切りのための書式指定子<2>.
                                                             (line   35)
* Python Enhancement Proposals; PEP 378 <2>: 書式指定ミニ言語仕様.
                                                             (line  150)
* Python Enhancement Proposals; PEP 380: PEP 380 サブジェネレータへの委譲構文.
                                                             (line   66)
* Python Enhancement Proposals; PEP 380 <1>: Yield 式.       (line   93)
* Python Enhancement Proposals; PEP 380#use-of-stopiteration-to-return-values: The STOP_ITERATION event.
                                                             (line    6)
* Python Enhancement Proposals; PEP 383: ドキュメント<29>.   (line   29)
* Python Enhancement Proposals; PEP 383 <1>: エラーハンドラ. (line   49)
* Python Enhancement Proposals; PEP 383 <2>: ソケットファミリー.
                                                             (line   15)
* Python Enhancement Proposals; PEP 383 <3>: ロケールエンコーディング.
                                                             (line   15)
* Python Enhancement Proposals; PEP 383 <4>: ロケールエンコーディング.
                                                             (line   51)
* Python Enhancement Proposals; PEP 383 <5>: ファイルシステムエンコーディング.
                                                             (line    7)
* Python Enhancement Proposals; PEP 384: 削除<7>.            (line   53)
* Python Enhancement Proposals; PEP 384 <1>: その他のビルド並びに C API の変更.
                                                             (line   10)
* Python Enhancement Proposals; PEP 384 <2>: PEP 384 安定 ABI の定義.
                                                             (line   24)
* Python Enhancement Proposals; PEP 384 <3>: C API<39>.      (line  100)
* Python Enhancement Proposals; PEP 385: コードリポジトリ.   (line   12)
* Python Enhancement Proposals; PEP 387: 警告.               (line   26)
* Python Enhancement Proposals; PEP 387 <1>: 警告.           (line   40)
* Python Enhancement Proposals; PEP 387 <2>: C API の安定性. (line    7)
* Python Enhancement Proposals; PEP 387 <3>: Stable ABI.     (line   13)
* Python Enhancement Proposals; PEP 387 <4>: Python のバージョン番号の仕組みはどうなっているのですか？.
                                                             (line   46)
* Python Enhancement Proposals; PEP 389: PEP 389 argparse コマンドライン解析モジュール.
                                                             (line   92)
* Python Enhancement Proposals; PEP 389 <1>: PEP 389 コマンドライン解析のための argparse モジュール.
                                                             (line  100)
* Python Enhancement Proposals; PEP 391: PEP 391 logging の辞書ベースの設定.
                                                             (line   52)
* Python Enhancement Proposals; PEP 391 <1>: PEP 391 logging の辞書ベースの設定<2>.
                                                             (line   94)
* Python Enhancement Proposals; PEP 392: What's New In Python 3 2.
                                                             (line   17)
* Python Enhancement Proposals; PEP 393: 削除<7>.            (line   26)
* Python Enhancement Proposals; PEP 393 <1>: Python 3 9への移植<2>.
                                                             (line   45)
* Python Enhancement Proposals; PEP 393 <2>: 削除<9>.        (line  101)
* Python Enhancement Proposals; PEP 393 <3>: PEP 393 文字列の柔軟な表現.
                                                             (line   16)
* Python Enhancement Proposals; PEP 393 <4>: 機能性.         (line    6)
* Python Enhancement Proposals; PEP 393 <5>: 性能およびリソース使用量.
                                                             (line   32)
* Python Enhancement Proposals; PEP 393 <6>: 最適化<11>.     (line    8)
* Python Enhancement Proposals; PEP 393 <7>: ビルドならびに C API の変更<4>.
                                                             (line   12)
* Python Enhancement Proposals; PEP 393 <8>: 非推奨の Python モジュール、関数、メソッド<4>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 393 <9>: C API の非推奨の関数ならびに型<3>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 393 <10>: C コードの移植.
                                                             (line   16)
* Python Enhancement Proposals; PEP 393 <11>: C API<37>.     (line  142)
* Python Enhancement Proposals; PEP 393 <12>: エンコーディングと Unicode.
                                                             (line    7)
* Python Enhancement Proposals; PEP 393 <13>: sys --- システム固有のパラメーターと関数.
                                                             (line 1365)
* Python Enhancement Proposals; PEP 393 <14>: Unicode オブジェクト.
                                                             (line    6)
* Python Enhancement Proposals; PEP 397: PEP 486 Python ランチャーが仮想環境を認識する.
                                                             (line    6)
* Python Enhancement Proposals; PEP 397 <1>: PEP 397 Windows の Python ランチャ.
                                                             (line   31)
* Python Enhancement Proposals; PEP 397 <2>: Python launcher for Windows deprecated.
                                                             (line   22)
* Python Enhancement Proposals; PEP 398: What's New In Python 3 3.
                                                             (line   13)
* Python Enhancement Proposals; PEP 4:   ライブラリの変更.   (line   12)
* Python Enhancement Proposals; PEP 405: PEP 405 仮想環境.   (line   22)
* Python Enhancement Proposals; PEP 405 <1>: venv --- 仮想環境の作成.
                                                             (line   46)
* Python Enhancement Proposals; PEP 409: PEP 409 例外コンテキストの抑制.
                                                             (line   63)
* Python Enhancement Proposals; PEP 411: sys --- システム固有のパラメーターと関数.
                                                             (line 1036)
* Python Enhancement Proposals; PEP 411 <1>: sys --- システム固有のパラメーターと関数.
                                                             (line 1046)
* Python Enhancement Proposals; PEP 411 <2>: sys --- システム固有のパラメーターと関数.
                                                             (line 1837)
* Python Enhancement Proposals; PEP 411 <3>: sys --- システム固有のパラメーターと関数.
                                                             (line 1857)
* Python Enhancement Proposals; PEP 411 <4>: 用語集<2>.      (line 1454)
* Python Enhancement Proposals; PEP 412: PEP 412 キー共有辞書.
                                                             (line   14)
* Python Enhancement Proposals; PEP 412 <1>: functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line   91)
* Python Enhancement Proposals; PEP 414: PEP 414 明示的なユニコードリテラル.
                                                             (line   17)
* Python Enhancement Proposals; PEP 414 <1>: String prefixes.
                                                             (line   36)
* Python Enhancement Proposals; PEP 418: time<8>.            (line    6)
* Python Enhancement Proposals; PEP 420: importlib<9>.       (line   35)
* Python Enhancement Proposals; PEP 420 <1>: PEP 420 暗黙的な名前空間パッケージ.
                                                             (line    7)
* Python Enhancement Proposals; PEP 420 <2>: PEP 420 暗黙的な名前空間パッケージ.
                                                             (line   13)
* Python Enhancement Proposals; PEP 420 <3>: Core and Builtins<186>.
                                                             (line   56)
* Python Enhancement Proposals; PEP 420 <4>: Core and Builtins<191>.
                                                             (line  114)
* Python Enhancement Proposals; PEP 420 <5>: インポートシステム.
                                                             (line   43)
* Python Enhancement Proposals; PEP 420 <6>: 名前空間パッケージ.
                                                             (line   27)
* Python Enhancement Proposals; PEP 420 <7>: __path__ attributes on modules.
                                                             (line   23)
* Python Enhancement Proposals; PEP 420 <8>: __path__ attributes on modules.
                                                             (line   23)
* Python Enhancement Proposals; PEP 420 <9>: 参考資料.       (line   11)
* Python Enhancement Proposals; PEP 420 <10>: 参考資料.      (line   13)
* Python Enhancement Proposals; PEP 420 <11>: 参考資料.      (line   13)
* Python Enhancement Proposals; PEP 420 <12>: はじめに<13>.  (line   69)
* Python Enhancement Proposals; PEP 420 <13>: 用語集<2>.     (line 1231)
* Python Enhancement Proposals; PEP 420 <14>: 用語集<2>.     (line 1432)
* Python Enhancement Proposals; PEP 421: SimpleNamespace.    (line   16)
* Python Enhancement Proposals; PEP 421 <1>: sys --- システム固有のパラメーターと関数.
                                                             (line 1162)
* Python Enhancement Proposals; PEP 421 <2>: sys --- システム固有のパラメーターと関数.
                                                             (line 1170)
* Python Enhancement Proposals; PEP 424: その他の言語変更<10>.
                                                             (line   60)
* Python Enhancement Proposals; PEP 424 <1>: operator<4>.    (line    7)
* Python Enhancement Proposals; PEP 428: 概要 -- リリースハイライト<11>.
                                                             (line   41)
* Python Enhancement Proposals; PEP 428 <1>: pathlib<14>.    (line   18)
* Python Enhancement Proposals; PEP 428 <2>: pathlib --- オブジェクト指向のファイルシステムパス.
                                                             (line   40)
* Python Enhancement Proposals; PEP 429: What's New In Python 3 4.
                                                             (line   16)
* Python Enhancement Proposals; PEP 432: その他の CPython の実装の変更<3>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 432 <1>: Core and Builtins<169>.
                                                             (line  312)
* Python Enhancement Proposals; PEP 434: PEP 434 IDLE 拡張についての全てのブランチにおける例外的な扱い.
                                                             (line    6)
* Python Enhancement Proposals; PEP 434 <1>: idlelib --- implementation of IDLE application.
                                                             (line   17)
* Python Enhancement Proposals; PEP 435: 概要 -- リリースハイライト<11>.
                                                             (line   38)
* Python Enhancement Proposals; PEP 435 <1>: enum<9>.        (line    6)
* Python Enhancement Proposals; PEP 435 <2>: enum<9>.        (line   15)
* Python Enhancement Proposals; PEP 436: 概要 -- リリースハイライト<11>.
                                                             (line  126)
* Python Enhancement Proposals; PEP 436 <1>: PEP 436 Argument Clinic.
                                                             (line    6)
* Python Enhancement Proposals; PEP 436 <2>: PEP 436 Argument Clinic.
                                                             (line   28)
* Python Enhancement Proposals; PEP 441: zipapp<2>.          (line    6)
* Python Enhancement Proposals; PEP 441 <1>: zipapp<2>.      (line   24)
* Python Enhancement Proposals; PEP 442: 削除<8>.            (line   68)
* Python Enhancement Proposals; PEP 442 <1>: 概要 -- リリースハイライト<11>.
                                                             (line  117)
* Python Enhancement Proposals; PEP 442 <2>: 概要 -- リリースハイライト<11>.
                                                             (line  120)
* Python Enhancement Proposals; PEP 442 <3>: PEP 442 オブジェクトの安全なファイナライゼーション.
                                                             (line    6)
* Python Enhancement Proposals; PEP 442 <4>: PEP 442 オブジェクトの安全なファイナライゼーション.
                                                             (line   22)
* Python Enhancement Proposals; PEP 442 <5>: C API<52>.      (line   55)
* Python Enhancement Proposals; PEP 442 <6>: gc --- ガベージコレクターインターフェース.
                                                             (line  279)
* Python Enhancement Proposals; PEP 442 <7>: 薄氷.           (line   37)
* Python Enhancement Proposals; PEP 442 <8>: ファイナライズとメモリ解放.
                                                             (line   93)
* Python Enhancement Proposals; PEP 442 <9>: Cyclic Isolate Destruction.
                                                             (line   42)
* Python Enhancement Proposals; PEP 442 <10>: PyTypeObject スロット.
                                                             (line 2047)
* Python Enhancement Proposals; PEP 443: 概要 -- リリースハイライト<11>.
                                                             (line   56)
* Python Enhancement Proposals; PEP 443 <1>: functools<6>.   (line   25)
* Python Enhancement Proposals; PEP 443 <2>: 用語集<2>.      (line  754)
* Python Enhancement Proposals; PEP 445: 概要 -- リリースハイライト<11>.
                                                             (line  124)
* Python Enhancement Proposals; PEP 445 <1>: PEP 445 CPython のメモリアロケータのカスタマイズ.
                                                             (line    6)
* Python Enhancement Proposals; PEP 445 <2>: PEP 445 CPython のメモリアロケータのカスタマイズ.
                                                             (line   12)
* Python Enhancement Proposals; PEP 445 <3>: その他の改善<2>.
                                                             (line   62)
* Python Enhancement Proposals; PEP 446: 概要 -- リリースハイライト<11>.
                                                             (line   16)
* Python Enhancement Proposals; PEP 446 <1>: 概要 -- リリースハイライト<11>.
                                                             (line   82)
* Python Enhancement Proposals; PEP 446 <2>: PEP 446 新規作成されたファイル記述子は継承不可.
                                                             (line    6)
* Python Enhancement Proposals; PEP 446 <3>: PEP 446 新規作成されたファイル記述子は継承不可.
                                                             (line   26)
* Python Enhancement Proposals; PEP 446 <4>: Core and Builtins<57>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 446 <5>: オペレーティングシステム関連のユーティリティ.
                                                             (line  243)
* Python Enhancement Proposals; PEP 448: PEP 448 - 追加可能なアンパックへの一般化.
                                                             (line    6)
* Python Enhancement Proposals; PEP 448 <1>: PEP 448 - 追加可能なアンパックへの一般化.
                                                             (line   38)
* Python Enhancement Proposals; PEP 448 <2>: ドキュメント<76>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 448 <3>: ドキュメント<80>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 448 <4>: Core and Builtins<194>.
                                                             (line   12)
* Python Enhancement Proposals; PEP 448 <5>: Core and Builtins<197>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 448 <6>: 辞書表示.       (line   28)
* Python Enhancement Proposals; PEP 448 <7>: 呼び出し call.  (line  118)
* Python Enhancement Proposals; PEP 448 <8>: 式のリスト.     (line   22)
* Python Enhancement Proposals; PEP 450: 概要 -- リリースハイライト<11>.
                                                             (line   48)
* Python Enhancement Proposals; PEP 450 <1>: statistics<6>.  (line    6)
* Python Enhancement Proposals; PEP 450 <2>: statistics<6>.  (line   13)
* Python Enhancement Proposals; PEP 451: zipimport<2>.       (line    8)
* Python Enhancement Proposals; PEP 451 <1>: zipimport<3>.   (line    6)
* Python Enhancement Proposals; PEP 451 <2>: PEP 489 拡張モジュールの多段階初期化.
                                                             (line    6)
* Python Enhancement Proposals; PEP 451 <3>: 概要 -- リリースハイライト<11>.
                                                             (line   24)
* Python Enhancement Proposals; PEP 451 <4>: PEP 451 インポートシステムのための ModuleSpec 型.
                                                             (line    6)
* Python Enhancement Proposals; PEP 451 <5>: ライブラリ<87>. (line  455)
* Python Enhancement Proposals; PEP 451 <6>: Core and Builtins<186>.
                                                             (line   75)
* Python Enhancement Proposals; PEP 451 <7>: 参考資料.       (line   27)
* Python Enhancement Proposals; PEP 451 <8>: sys --- システム固有のパラメーターと関数.
                                                             (line 1396)
* Python Enhancement Proposals; PEP 451 <9>: runpy --- Python モジュールの位置特定と実行.
                                                             (line   89)
* Python Enhancement Proposals; PEP 451 <10>: runpy --- Python モジュールの位置特定と実行.
                                                             (line  166)
* Python Enhancement Proposals; PEP 451 <11>: runpy --- Python モジュールの位置特定と実行.
                                                             (line  184)
* Python Enhancement Proposals; PEP 451 <12>: はじめに<13>.  (line   73)
* Python Enhancement Proposals; PEP 451 <13>: Module slots.  (line   31)
* Python Enhancement Proposals; PEP 453: 概要 -- リリースハイライト<11>.
                                                             (line   13)
* Python Enhancement Proposals; PEP 453 <1>: 概要 -- リリースハイライト<11>.
                                                             (line   36)
* Python Enhancement Proposals; PEP 453 <2>: デフォルトでの pip のブートストラッピング.
                                                             (line    6)
* Python Enhancement Proposals; PEP 453 <3>: ドキュメントの変更.
                                                             (line   21)
* Python Enhancement Proposals; PEP 453 <4>: ensurepip<2>.   (line    6)
* Python Enhancement Proposals; PEP 453 <5>: venv<7>.        (line   13)
* Python Enhancement Proposals; PEP 453 <6>: その他の改善<2>.
                                                             (line   73)
* Python Enhancement Proposals; PEP 453 <7>: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート.
                                                             (line    6)
* Python Enhancement Proposals; PEP 453 <8>: デフォルトでの pip のブートストラッピング<2>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 453 <9>: ドキュメントの変更<2>.
                                                             (line   21)
* Python Enhancement Proposals; PEP 453 <10>: ensurepip --- pip インストーラーのブートストラップ.
                                                             (line   42)
* Python Enhancement Proposals; PEP 454: 概要 -- リリースハイライト<11>.
                                                             (line   51)
* Python Enhancement Proposals; PEP 454 <1>: tracemalloc<4>. (line    6)
* Python Enhancement Proposals; PEP 454 <2>: tracemalloc<4>. (line   21)
* Python Enhancement Proposals; PEP 456: 概要 -- リリースハイライト<11>.
                                                             (line   78)
* Python Enhancement Proposals; PEP 456 <1>: PEP 456 安全で取り換え可能なハッシュアルゴリズム.
                                                             (line    6)
* Python Enhancement Proposals; PEP 456 <2>: PyHash API.     (line  140)
* Python Enhancement Proposals; PEP 461: PEP 461 - bytes および bytearray のパーセント書式化サポート.
                                                             (line    6)
* Python Enhancement Proposals; PEP 461 <1>: PEP 461 - bytes および bytearray のパーセント書式化サポート.
                                                             (line   41)
* Python Enhancement Proposals; PEP 461 <2>: printf 形式での bytes の書式化.
                                                             (line  189)
* Python Enhancement Proposals; PEP 465: PEP 465 - 行列の乗算専用の中置演算子.
                                                             (line    6)
* Python Enhancement Proposals; PEP 465 <1>: PEP 465 - 行列の乗算専用の中置演算子.
                                                             (line   44)
* Python Enhancement Proposals; PEP 465 <2>: ビルドならびに C API の変更<3>.
                                                             (line   43)
* Python Enhancement Proposals; PEP 465 <3>: Tools/Demos<61>.
                                                             (line   39)
* Python Enhancement Proposals; PEP 466: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張.
                                                             (line    6)
* Python Enhancement Proposals; PEP 466 <1>: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張.
                                                             (line   10)
* Python Enhancement Proposals; PEP 466 <2>: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張.
                                                             (line   21)
* Python Enhancement Proposals; PEP 466 <3>: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張.
                                                             (line   32)
* Python Enhancement Proposals; PEP 468: PEP 468 キーワード引数の順番の保持.
                                                             (line   12)
* Python Enhancement Proposals; PEP 468 <1>: ライブラリ<180>.
                                                             (line   87)
* Python Enhancement Proposals; PEP 468 <2>: OrderedDict オブジェクト.
                                                             (line  103)
* Python Enhancement Proposals; PEP 471: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ.
                                                             (line    6)
* Python Enhancement Proposals; PEP 471 <1>: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ.
                                                             (line   29)
* Python Enhancement Proposals; PEP 471 <2>: ライブラリ<206>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 475: PEP 475 EINTR で失敗したシステムコールの再試行.
                                                             (line   32)
* Python Enhancement Proposals; PEP 475 <1>: PEP 475 EINTR で失敗したシステムコールの再試行.
                                                             (line   77)
* Python Enhancement Proposals; PEP 475 <2>: Python API の変更<10>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 475 <3>: ライブラリ<171>.
                                                             (line  228)
* Python Enhancement Proposals; PEP 475 <4>: ライブラリ<204>.
                                                             (line  143)
* Python Enhancement Proposals; PEP 475 <5>: 組み込み関数.   (line 1498)
* Python Enhancement Proposals; PEP 475 <6>: OS 例外.        (line   81)
* Python Enhancement Proposals; PEP 475 <7>: ファイル記述子の操作.
                                                             (line  407)
* Python Enhancement Proposals; PEP 475 <8>: ファイル記述子の操作.
                                                             (line  747)
* Python Enhancement Proposals; PEP 475 <9>: ファイル記述子の操作.
                                                             (line  983)
* Python Enhancement Proposals; PEP 475 <10>: プロセス管理.  (line  938)
* Python Enhancement Proposals; PEP 475 <11>: I/O 基底クラス.
                                                             (line  279)
* Python Enhancement Proposals; PEP 475 <12>: I/O 基底クラス.
                                                             (line  297)
* Python Enhancement Proposals; PEP 475 <13>: 関数<5>.       (line  310)
* Python Enhancement Proposals; PEP 475 <14>: socket オブジェクト.
                                                             (line   28)
* Python Enhancement Proposals; PEP 475 <15>: socket オブジェクト.
                                                             (line   82)
* Python Enhancement Proposals; PEP 475 <16>: socket オブジェクト.
                                                             (line  247)
* Python Enhancement Proposals; PEP 475 <17>: socket オブジェクト.
                                                             (line  261)
* Python Enhancement Proposals; PEP 475 <18>: socket オブジェクト.
                                                             (line  333)
* Python Enhancement Proposals; PEP 475 <19>: socket オブジェクト.
                                                             (line  405)
* Python Enhancement Proposals; PEP 475 <20>: socket オブジェクト.
                                                             (line  423)
* Python Enhancement Proposals; PEP 475 <21>: socket オブジェクト.
                                                             (line  441)
* Python Enhancement Proposals; PEP 475 <22>: socket オブジェクト.
                                                             (line  484)
* Python Enhancement Proposals; PEP 475 <23>: select --- I/O 完了の待機.
                                                             (line  162)
* Python Enhancement Proposals; PEP 475 <24>: /dev/poll ポーリングオブジェクト.
                                                             (line   83)
* Python Enhancement Proposals; PEP 475 <25>: エッジおよびレベルトリガポーリング epoll オブジェクト.
                                                             (line  111)
* Python Enhancement Proposals; PEP 475 <26>: ポーリングオブジェクト.
                                                             (line   95)
* Python Enhancement Proposals; PEP 475 <27>: kqueue オブジェクト.
                                                             (line   37)
* Python Enhancement Proposals; PEP 475 <28>: クラス<4>.     (line  138)
* Python Enhancement Proposals; PEP 475 <29>: モジュールの内容<2>.
                                                             (line  615)
* Python Enhancement Proposals; PEP 475 <30>: モジュールの内容<2>.
                                                             (line  634)
* Python Enhancement Proposals; PEP 476: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化<2>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 477: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート.
                                                             (line    6)
* Python Enhancement Proposals; PEP 478: What's New In Python 3 5.
                                                             (line   17)
* Python Enhancement Proposals; PEP 479: Python の挙動の変更<2>.
                                                             (line   11)
* Python Enhancement Proposals; PEP 479 <1>: PEP 479 ジェネレータ内の StopIteration の処理の変更.
                                                             (line   12)
* Python Enhancement Proposals; PEP 479 <2>: PEP 479 ジェネレータ内の StopIteration の処理の変更.
                                                             (line   47)
* Python Enhancement Proposals; PEP 479 <3>: ライブラリ<162>.
                                                             (line 1268)
* Python Enhancement Proposals; PEP 479 <4>: ライブラリ<166>.
                                                             (line   52)
* Python Enhancement Proposals; PEP 479 <5>: Core and Builtins<165>.
                                                             (line   34)
* Python Enhancement Proposals; PEP 479 <6>: ライブラリ<174>.
                                                             (line   95)
* Python Enhancement Proposals; PEP 479 <7>: ライブラリ<187>.
                                                             (line   80)
* Python Enhancement Proposals; PEP 479 <8>: ライブラリ<193>.
                                                             (line  326)
* Python Enhancement Proposals; PEP 479 <9>: 具象例外.       (line  287)
* Python Enhancement Proposals; PEP 479 <10>: 具象例外.      (line  290)
* Python Enhancement Proposals; PEP 479 <11>: モジュールコンテンツ<5>.
                                                             (line   43)
* Python Enhancement Proposals; PEP 483: PEP 484 - 型ヒント. (line   43)
* Python Enhancement Proposals; PEP 483 <1>: 用語集<2>.      (line  762)
* Python Enhancement Proposals; PEP 484: PEP 695 型パラメータの構文.
                                                             (line    6)
* Python Enhancement Proposals; PEP 484 <1>: 型ヒントに関連する新しい機能.
                                                             (line    6)
* Python Enhancement Proposals; PEP 484 <2>: PEP 692 Using TypedDict for more precise **kwargs typing.
                                                             (line    6)
* Python Enhancement Proposals; PEP 484 <3>: 型ヒントに関連する新しい機能<2>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 484 <4>: PEP 646 Variadic generics.
                                                             (line    6)
* Python Enhancement Proposals; PEP 484 <5>: 型ヒントに関連する新しい機能<3>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 484 <6>: PEP 612 Parameter Specification Variables.
                                                             (line    7)
* Python Enhancement Proposals; PEP 484 <7>: PEP 613 TypeAlias.
                                                             (line    6)
* Python Enhancement Proposals; PEP 484 <8>: ast<5>.         (line   17)
* Python Enhancement Proposals; PEP 484 <9>: ast<5>.         (line   20)
* Python Enhancement Proposals; PEP 484 <10>: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート.
                                                             (line    6)
* Python Enhancement Proposals; PEP 484 <11>: PEP 526 変数アノテーションの文法.
                                                             (line    6)
* Python Enhancement Proposals; PEP 484 <12>: PEP 484 - 型ヒント.
                                                             (line   13)
* Python Enhancement Proposals; PEP 484 <13>: PEP 484 - 型ヒント.
                                                             (line   37)
* Python Enhancement Proposals; PEP 484 <14>: 関数のアノテーション.
                                                             (line    7)
* Python Enhancement Proposals; PEP 484 <15>: ジェネリック型をエミュレートする.
                                                             (line   15)
* Python Enhancement Proposals; PEP 484 <16>: 注釈付き代入文 annotated assignment statements.
                                                             (line   43)
* Python Enhancement Proposals; PEP 484 <17>: 関数定義.      (line  140)
* Python Enhancement Proposals; PEP 484 <18>: GenericAlias オブジェクトの特別な属性.
                                                             (line   51)
* Python Enhancement Proposals; PEP 484 <19>: NewType.       (line   61)
* Python Enhancement Proposals; PEP 484 <20>: 名前的部分型 vs 構造的部分型.
                                                             (line    6)
* Python Enhancement Proposals; PEP 484 <21>: 名前的部分型 vs 構造的部分型.
                                                             (line   15)
* Python Enhancement Proposals; PEP 484 <22>: Building generic types and type aliases.
                                                             (line  113)
* Python Enhancement Proposals; PEP 484 <23>: Functions and decorators.
                                                             (line  279)
* Python Enhancement Proposals; PEP 484 <24>: Root nodes.    (line   60)
* Python Enhancement Proposals; PEP 484 <25>: ast helpers.   (line   18)
* Python Enhancement Proposals; PEP 484 <26>: ast helpers.   (line   29)
* Python Enhancement Proposals; PEP 484 <27>: Compiler flags<2>.
                                                             (line   30)
* Python Enhancement Proposals; PEP 484 <28>: Available start symbols.
                                                             (line   28)
* Python Enhancement Proposals; PEP 484 <29>: Available start symbols.
                                                             (line   37)
* Python Enhancement Proposals; PEP 484 <30>: 用語集<2>.     (line   56)
* Python Enhancement Proposals; PEP 484 <31>: 用語集<2>.     (line  689)
* Python Enhancement Proposals; PEP 484 <32>: 用語集<2>.     (line  762)
* Python Enhancement Proposals; PEP 484 <33>: 用語集<2>.     (line 1815)
* Python Enhancement Proposals; PEP 484 <34>: 用語集<2>.     (line 1830)
* Python Enhancement Proposals; PEP 484 <35>: 用語集<2>.     (line 1859)
* Python Enhancement Proposals; PEP 484#annotating-instance-and-class-methods: PEP 673 Self 型.
                                                             (line    8)
* Python Enhancement Proposals; PEP 485: PEP 485 近似的に等しいことを調べる関数.
                                                             (line    6)
* Python Enhancement Proposals; PEP 485 <1>: PEP 485 近似的に等しいことを調べる関数.
                                                             (line   34)
* Python Enhancement Proposals; PEP 485 <2>: ライブラリ<202>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 485 <3>: Floating point manipulation functions.
                                                             (line   57)
* Python Enhancement Proposals; PEP 485 <4>: 類別関数.       (line   55)
* Python Enhancement Proposals; PEP 486: PEP 486 Python ランチャーが仮想環境を認識する.
                                                             (line    6)
* Python Enhancement Proposals; PEP 486 <1>: PEP 486 Python ランチャーが仮想環境を認識する.
                                                             (line   14)
* Python Enhancement Proposals; PEP 486 <2>: Windows<82>.    (line    6)
* Python Enhancement Proposals; PEP 487: PEP 487 Simpler customization of class creation.
                                                             (line   32)
* Python Enhancement Proposals; PEP 487 <1>: PEP 487 記述子プロトコルの改善.
                                                             (line    6)
* Python Enhancement Proposals; PEP 487 <2>: PEP 487 記述子プロトコルの改善.
                                                             (line   33)
* Python Enhancement Proposals; PEP 487 <3>: Python API の変更<9>.
                                                             (line  103)
* Python Enhancement Proposals; PEP 487 <4>: ドキュメント<66>.
                                                             (line   52)
* Python Enhancement Proposals; PEP 487 <5>: ドキュメント<73>.
                                                             (line    8)
* Python Enhancement Proposals; PEP 487 <6>: Core and Builtins<183>.
                                                             (line   46)
* Python Enhancement Proposals; PEP 488: PEP 488 PYO ファイルの廃止.
                                                             (line    6)
* Python Enhancement Proposals; PEP 488 <1>: PEP 488 PYO ファイルの廃止.
                                                             (line   20)
* Python Enhancement Proposals; PEP 488 <2>: Python API の変更<10>.
                                                             (line   85)
* Python Enhancement Proposals; PEP 488 <3>: Core and Builtins<201>.
                                                             (line   15)
* Python Enhancement Proposals; PEP 488 <4>: その他のオプション.
                                                             (line   89)
* Python Enhancement Proposals; PEP 488 <5>: その他のオプション.
                                                             (line   91)
* Python Enhancement Proposals; PEP 488 <6>: その他のオプション.
                                                             (line   98)
* Python Enhancement Proposals; PEP 488 <7>: その他のオプション.
                                                             (line  100)
* Python Enhancement Proposals; PEP 488 <8>: test support import_helper --- Utilities for import tests.
                                                             (line   82)
* Python Enhancement Proposals; PEP 488 <9>: はじめに<13>.   (line   77)
* Python Enhancement Proposals; PEP 488 <10>: importlib util -- Utility code for importers.
                                                             (line   25)
* Python Enhancement Proposals; PEP 488 <11>: importlib util -- Utility code for importers.
                                                             (line   64)
* Python Enhancement Proposals; PEP 488 <12>: py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   30)
* Python Enhancement Proposals; PEP 489: PEP 489 拡張モジュールの多段階初期化.
                                                             (line    6)
* Python Enhancement Proposals; PEP 489 <1>: PEP 489 拡張モジュールの多段階初期化.
                                                             (line   18)
* Python Enhancement Proposals; PEP 489 <2>: ビルドならびに C API の変更<3>.
                                                             (line   37)
* Python Enhancement Proposals; PEP 489 <3>: ライブラリ<46>. (line   84)
* Python Enhancement Proposals; PEP 489 <4>: C API<15>.      (line   23)
* Python Enhancement Proposals; PEP 489 <5>: ライブラリ<55>. (line  254)
* Python Enhancement Proposals; PEP 489 <6>: ライブラリ<71>. (line   24)
* Python Enhancement Proposals; PEP 489 <7>: ライブラリ<126>.
                                                             (line   64)
* Python Enhancement Proposals; PEP 489 <8>: ライブラリ<126>.
                                                             (line   79)
* Python Enhancement Proposals; PEP 489 <9>: ライブラリ<128>.
                                                             (line   28)
* Python Enhancement Proposals; PEP 489 <10>: ライブラリ<129>.
                                                             (line   68)
* Python Enhancement Proposals; PEP 489 <11>: ライブラリ<129>.
                                                             (line  177)
* Python Enhancement Proposals; PEP 489 <12>: ライブラリ<130>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <13>: ライブラリ<133>.
                                                             (line  103)
* Python Enhancement Proposals; PEP 489 <14>: C API<43>.     (line   11)
* Python Enhancement Proposals; PEP 489 <15>: C API<43>.     (line   14)
* Python Enhancement Proposals; PEP 489 <16>: C API<43>.     (line   17)
* Python Enhancement Proposals; PEP 489 <17>: C API<43>.     (line   20)
* Python Enhancement Proposals; PEP 489 <18>: C API<43>.     (line   23)
* Python Enhancement Proposals; PEP 489 <19>: C API<43>.     (line   26)
* Python Enhancement Proposals; PEP 489 <20>: C API<43>.     (line   29)
* Python Enhancement Proposals; PEP 489 <21>: C API<43>.     (line   38)
* Python Enhancement Proposals; PEP 489 <22>: C API<43>.     (line   41)
* Python Enhancement Proposals; PEP 489 <23>: C API<43>.     (line   44)
* Python Enhancement Proposals; PEP 489 <24>: C API<43>.     (line   47)
* Python Enhancement Proposals; PEP 489 <25>: ライブラリ<135>.
                                                             (line   31)
* Python Enhancement Proposals; PEP 489 <26>: ライブラリ<136>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <27>: ライブラリ<137>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <28>: ライブラリ<137>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 489 <29>: ライブラリ<137>.
                                                             (line   13)
* Python Enhancement Proposals; PEP 489 <30>: ライブラリ<137>.
                                                             (line   16)
* Python Enhancement Proposals; PEP 489 <31>: ライブラリ<138>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <32>: ライブラリ<138>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 489 <33>: ライブラリ<138>.
                                                             (line   13)
* Python Enhancement Proposals; PEP 489 <34>: ライブラリ<140>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <35>: ライブラリ<142>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <36>: ライブラリ<143>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 489 <37>: ライブラリ<150>.
                                                             (line   75)
* Python Enhancement Proposals; PEP 489 <38>: ライブラリ<150>.
                                                             (line   78)
* Python Enhancement Proposals; PEP 489 <39>: ライブラリ<150>.
                                                             (line  423)
* Python Enhancement Proposals; PEP 489 <40>: Core and Builtins<148>.
                                                             (line   28)
* Python Enhancement Proposals; PEP 489 <41>: Core and Builtins<148>.
                                                             (line   35)
* Python Enhancement Proposals; PEP 489 <42>: Core and Builtins<148>.
                                                             (line   50)
* Python Enhancement Proposals; PEP 489 <43>: Core and Builtins<149>.
                                                             (line   46)
* Python Enhancement Proposals; PEP 489 <44>: Core and Builtins<149>.
                                                             (line   49)
* Python Enhancement Proposals; PEP 489 <45>: Core and Builtins<149>.
                                                             (line   51)
* Python Enhancement Proposals; PEP 489 <46>: Core and Builtins<149>.
                                                             (line   71)
* Python Enhancement Proposals; PEP 489 <47>: Core and Builtins<149>.
                                                             (line   75)
* Python Enhancement Proposals; PEP 489 <48>: Core and Builtins<150>.
                                                             (line   17)
* Python Enhancement Proposals; PEP 489 <49>: Core and Builtins<150>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 489 <50>: Core and Builtins<150>.
                                                             (line   40)
* Python Enhancement Proposals; PEP 489 <51>: Core and Builtins<150>.
                                                             (line   54)
* Python Enhancement Proposals; PEP 489 <52>: Core and Builtins<150>.
                                                             (line  109)
* Python Enhancement Proposals; PEP 489 <53>: Core and Builtins<150>.
                                                             (line  118)
* Python Enhancement Proposals; PEP 489 <54>: Core and Builtins<151>.
                                                             (line   29)
* Python Enhancement Proposals; PEP 489 <55>: Core and Builtins<151>.
                                                             (line   32)
* Python Enhancement Proposals; PEP 489 <56>: Core and Builtins<151>.
                                                             (line   52)
* Python Enhancement Proposals; PEP 489 <57>: Core and Builtins<151>.
                                                             (line   55)
* Python Enhancement Proposals; PEP 489 <58>: Core and Builtins<151>.
                                                             (line   58)
* Python Enhancement Proposals; PEP 489 <59>: Core and Builtins<152>.
                                                             (line   62)
* Python Enhancement Proposals; PEP 489 <60>: はじめに<13>.  (line   81)
* Python Enhancement Proposals; PEP 489 <61>: importlib machinery -- Importers and path hooks.
                                                             (line   75)
* Python Enhancement Proposals; PEP 489 <62>: importlib machinery -- Importers and path hooks.
                                                             (line  294)
* Python Enhancement Proposals; PEP 489 <63>: importlib machinery -- Importers and path hooks.
                                                             (line  312)
* Python Enhancement Proposals; PEP 489 <64>: importlib machinery -- Importers and path hooks.
                                                             (line  319)
* Python Enhancement Proposals; PEP 489 <65>: importlib util -- Utility code for importers.
                                                             (line  187)
* Python Enhancement Proposals; PEP 489 <66>: サードパーティツールなしで拡張を作る.
                                                             (line   13)
* Python Enhancement Proposals; PEP 489 <67>: 拡張モジュールの定義.
                                                             (line   44)
* Python Enhancement Proposals; PEP 489 <68>: 初期化関数.    (line   57)
* Python Enhancement Proposals; PEP 489 <69>: サブインタプリタサポート.
                                                             (line   78)
* Python Enhancement Proposals; PEP 492: PEP 525 非同期ジェネレータ.
                                                             (line    6)
* Python Enhancement Proposals; PEP 492 <1>: 新たなキーワード.
                                                             (line    7)
* Python Enhancement Proposals; PEP 492 <2>: PEP 492 - コルーチン、 async と await 構文.
                                                             (line    6)
* Python Enhancement Proposals; PEP 492 <3>: PEP 492 - コルーチン、 async と await 構文.
                                                             (line   97)
* Python Enhancement Proposals; PEP 492 <4>: 新たなキーワード<2>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 492 <5>: C API の変更<14>.
                                                             (line   25)
* Python Enhancement Proposals; PEP 492 <6>: Core and Builtins<168>.
                                                             (line   98)
* Python Enhancement Proposals; PEP 492 <7>: ライブラリ<188>.
                                                             (line   51)
* Python Enhancement Proposals; PEP 492 <8>: ライブラリ<194>.
                                                             (line   16)
* Python Enhancement Proposals; PEP 492 <9>: Core and Builtins<198>.
                                                             (line   14)
* Python Enhancement Proposals; PEP 492 <10>: 待機可能オブジェクト Awaitable Object.
                                                             (line   34)
* Python Enhancement Proposals; PEP 492 <11>: Yield 式.      (line  100)
* Python Enhancement Proposals; PEP 492 <12>: async with 文. (line   44)
* Python Enhancement Proposals; PEP 492 <13>: コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  190)
* Python Enhancement Proposals; PEP 492 <14>: Code Objects Bit Flags.
                                                             (line   38)
* Python Enhancement Proposals; PEP 492 <15>: Code Objects Bit Flags.
                                                             (line   47)
* Python Enhancement Proposals; PEP 492 <16>: 用語集<2>.     (line   93)
* Python Enhancement Proposals; PEP 492 <17>: 用語集<2>.     (line  124)
* Python Enhancement Proposals; PEP 492 <18>: 用語集<2>.     (line  131)
* Python Enhancement Proposals; PEP 492 <19>: 用語集<2>.     (line  141)
* Python Enhancement Proposals; PEP 492 <20>: 用語集<2>.     (line  192)
* Python Enhancement Proposals; PEP 492 <21>: 用語集<2>.     (line  392)
* Python Enhancement Proposals; PEP 492 <22>: 用語集<2>.     (line  400)
* Python Enhancement Proposals; PEP 493: PEP 493 HTTPS verification migration tools for Python 2 7.
                                                             (line    6)
* Python Enhancement Proposals; PEP 494: What's New In Python 3 6.
                                                             (line   17)
* Python Enhancement Proposals; PEP 495: PEP 495 地域時間の曖昧さ回避.
                                                             (line   12)
* Python Enhancement Proposals; PEP 495 <1>: PEP 495 地域時間の曖昧さ回避.
                                                             (line   33)
* Python Enhancement Proposals; PEP 495 <2>: ライブラリ<186>.
                                                             (line   96)
* Python Enhancement Proposals; PEP 495 <3>: ZoneInfo を使用する.
                                                             (line   34)
* Python Enhancement Proposals; PEP 498: PEP 498 フォーマット済み文字列リテラル.
                                                             (line    6)
* Python Enhancement Proposals; PEP 498 <1>: PEP 498 フォーマット済み文字列リテラル.
                                                             (line   26)
* Python Enhancement Proposals; PEP 498 <2>: Core and Builtins<186>.
                                                             (line  283)
* Python Enhancement Proposals; PEP 498 <3>: f-strings.      (line  150)
* Python Enhancement Proposals; PEP 498 <4>: 用語集<2>.      (line  578)
* Python Enhancement Proposals; PEP 5:   PEP 230 警告フレームワーク.
                                                             (line   64)
* Python Enhancement Proposals; PEP 5 <1>: Python の互換性を無くすような提案をしてもいいのですか？.
                                                             (line   14)
* Python Enhancement Proposals; PEP 506: secrets.            (line   19)
* Python Enhancement Proposals; PEP 506 <1>: ライブラリ<189>.
                                                             (line   60)
* Python Enhancement Proposals; PEP 506 <2>: secrets --- 機密を扱うために安全な乱数を生成する.
                                                             (line   23)
* Python Enhancement Proposals; PEP 509: C API<15>.          (line   16)
* Python Enhancement Proposals; PEP 511: Python API の変更<9>.
                                                             (line   33)
* Python Enhancement Proposals; PEP 514: Windows py exe ランチャーの改善.
                                                             (line    7)
* Python Enhancement Proposals; PEP 514 <1>: Windows<31>.    (line   13)
* Python Enhancement Proposals; PEP 514 <2>: Windows<74>.    (line    8)
* Python Enhancement Proposals; PEP 514 <3>: コマンドラインから起動する.
                                                             (line   46)
* Python Enhancement Proposals; PEP 515: fractions<4>.       (line    6)
* Python Enhancement Proposals; PEP 515 <1>: PEP 515 数値リテラル内のアンダースコア.
                                                             (line    6)
* Python Enhancement Proposals; PEP 515 <2>: PEP 515 数値リテラル内のアンダースコア.
                                                             (line   31)
* Python Enhancement Proposals; PEP 515 <3>: Core and Builtins<182>.
                                                             (line   15)
* Python Enhancement Proposals; PEP 515 <4>: Core and Builtins<182>.
                                                             (line   43)
* Python Enhancement Proposals; PEP 515 <5>: 書式指定ミニ言語仕様.
                                                             (line  153)
* Python Enhancement Proposals; PEP 515 <6>: fractions --- 有理数.
                                                             (line   94)
* Python Enhancement Proposals; PEP 519: PEP 519 ファイルシステムパスプロトコルの追加.
                                                             (line   62)
* Python Enhancement Proposals; PEP 519 <1>: ライブラリ<186>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 519 <2>: Core and Builtins<185>.
                                                             (line   19)
* Python Enhancement Proposals; PEP 519 <3>: ライブラリ<188>.
                                                             (line   31)
* Python Enhancement Proposals; PEP 519 <4>: ライブラリ<188>.
                                                             (line   42)
* Python Enhancement Proposals; PEP 519 <5>: ライブラリ<188>.
                                                             (line   44)
* Python Enhancement Proposals; PEP 519 <6>: C API<73>.      (line    6)
* Python Enhancement Proposals; PEP 519 <7>: 用語集<2>.      (line 1413)
* Python Enhancement Proposals; PEP 520: PEP 520 クラス属性の定義の順番を保持.
                                                             (line   17)
* Python Enhancement Proposals; PEP 523: 新しい機能<5>.      (line   19)
* Python Enhancement Proposals; PEP 523 <1>: Porting to Python 3 11<2>.
                                                             (line   33)
* Python Enhancement Proposals; PEP 523 <2>: Python 3 9への移植<2>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 523 <3>: PEP 523 CPython にフレーム評価 API を追加.
                                                             (line   12)
* Python Enhancement Proposals; PEP 523 <4>: PEP 523 CPython にフレーム評価 API を追加.
                                                             (line   26)
* Python Enhancement Proposals; PEP 523 <5>: Core and Builtins<60>.
                                                             (line   23)
* Python Enhancement Proposals; PEP 523 <6>: Tools/Demos<43>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 523 <7>: Tools/Demos<47>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 523 <8>: Core and Builtins<182>.
                                                             (line   83)
* Python Enhancement Proposals; PEP 523 <9>: Internal Frames.
                                                             (line    6)
* Python Enhancement Proposals; PEP 523 <10>: 低レベルAPI.   (line  237)
* Python Enhancement Proposals; PEP 523 <11>: 低レベルAPI.   (line  246)
* Python Enhancement Proposals; PEP 524: 概要 -- リリースハイライト<9>.
                                                             (line   76)
* Python Enhancement Proposals; PEP 524 <1>: os<9>.          (line   20)
* Python Enhancement Proposals; PEP 524 <2>: os<9>.          (line   25)
* Python Enhancement Proposals; PEP 524 <3>: ライブラリ<185>.
                                                             (line  150)
* Python Enhancement Proposals; PEP 524 <4>: ライブラリ<185>.
                                                             (line  154)
* Python Enhancement Proposals; PEP 524 <5>: 乱数<2>.        (line   42)
* Python Enhancement Proposals; PEP 525: PEP 525 非同期ジェネレータ.
                                                             (line   22)
* Python Enhancement Proposals; PEP 525 <1>: Core and Builtins<182>.
                                                             (line   49)
* Python Enhancement Proposals; PEP 525 <2>: Yield 式.       (line   98)
* Python Enhancement Proposals; PEP 525 <3>: コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  190)
* Python Enhancement Proposals; PEP 525 <4>: sys --- システム固有のパラメーターと関数.
                                                             (line 1033)
* Python Enhancement Proposals; PEP 525 <5>: sys --- システム固有のパラメーターと関数.
                                                             (line 1832)
* Python Enhancement Proposals; PEP 525 <6>: Code Objects Bit Flags.
                                                             (line   56)
* Python Enhancement Proposals; PEP 525 <7>: Asynchronous Generator Objects.
                                                             (line    9)
* Python Enhancement Proposals; PEP 525 <8>: 用語集<2>.      (line  124)
* Python Enhancement Proposals; PEP 526: その他の言語変更<4>.
                                                             (line   56)
* Python Enhancement Proposals; PEP 526 <1>: ast<5>.         (line   17)
* Python Enhancement Proposals; PEP 526 <2>: PEP 563 アノテーションの遅延評価.
                                                             (line    6)
* Python Enhancement Proposals; PEP 526 <3>: PEP 526 変数アノテーションの文法.
                                                             (line   29)
* Python Enhancement Proposals; PEP 526 <4>: typing<10>.     (line   23)
* Python Enhancement Proposals; PEP 526 <5>: Core and Builtins<182>.
                                                             (line   51)
* Python Enhancement Proposals; PEP 526 <6>: 注釈付き代入文 annotated assignment statements.
                                                             (line   38)
* Python Enhancement Proposals; PEP 526 <7>: 関数定義.       (line  144)
* Python Enhancement Proposals; PEP 526 <8>: 特殊形式.       (line  205)
* Python Enhancement Proposals; PEP 526 <9>: Other special directives.
                                                             (line   70)
* Python Enhancement Proposals; PEP 526 <10>: dataclasses --- データクラス.
                                                             (line   15)
* Python Enhancement Proposals; PEP 526 <11>: クラス変数.    (line    8)
* Python Enhancement Proposals; PEP 526 <12>: Annotation semantics.
                                                             (line   11)
* Python Enhancement Proposals; PEP 526 <13>: Annotation semantics.
                                                             (line   47)
* Python Enhancement Proposals; PEP 526 <14>: ast helpers.   (line   18)
* Python Enhancement Proposals; PEP 526 <15>: Compiler flags<2>.
                                                             (line   30)
* Python Enhancement Proposals; PEP 526 <16>: 用語集<2>.     (line   56)
* Python Enhancement Proposals; PEP 526 <17>: 用語集<2>.     (line 1859)
* Python Enhancement Proposals; PEP 528: PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更.
                                                             (line   17)
* Python Enhancement Proposals; PEP 528 <1>: UTF-8 モード.   (line   33)
* Python Enhancement Proposals; PEP 528 <2>: グローバルな設定変数.
                                                             (line  174)
* Python Enhancement Proposals; PEP 528 <3>: PyConfig.       (line  566)
* Python Enhancement Proposals; PEP 529: Python API の変更<6>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 529 <1>: PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更.
                                                             (line   22)
* Python Enhancement Proposals; PEP 529 <2>: ドキュメント<29>.
                                                             (line   29)
* Python Enhancement Proposals; PEP 529 <3>: ライブラリ<157>.
                                                             (line  619)
* Python Enhancement Proposals; PEP 529 <4>: Windows<69>.    (line   14)
* Python Enhancement Proposals; PEP 529 <5>: 環境変数.       (line  354)
* Python Enhancement Proposals; PEP 529 <6>: UTF-8 モード.   (line   36)
* Python Enhancement Proposals; PEP 529 <7>: ファイルとディレクトリ.
                                                             (line  312)
* Python Enhancement Proposals; PEP 529 <8>: sys --- システム固有のパラメーターと関数.
                                                             (line  815)
* Python Enhancement Proposals; PEP 529 <9>: sys --- システム固有のパラメーターと関数.
                                                             (line 1952)
* Python Enhancement Proposals; PEP 529 <10>: ファイルシステムエンコーディング.
                                                             (line    7)
* Python Enhancement Proposals; PEP 529 <11>: グローバルな設定変数.
                                                             (line  156)
* Python Enhancement Proposals; PEP 530: PEP 530 非同期内包表記.
                                                             (line    6)
* Python Enhancement Proposals; PEP 530 <1>: PEP 530 非同期内包表記.
                                                             (line   18)
* Python Enhancement Proposals; PEP 530 <2>: Core and Builtins<182>.
                                                             (line  145)
* Python Enhancement Proposals; PEP 530 <3>: リスト、集合、辞書の表示.
                                                             (line   52)
* Python Enhancement Proposals; PEP 538: PEP 538 レガシーな C ロケールの抑圧.
                                                             (line   11)
* Python Enhancement Proposals; PEP 538 <1>: PEP 538 レガシーな C ロケールの抑圧.
                                                             (line   35)
* Python Enhancement Proposals; PEP 538 <2>: PEP 538 レガシーな C ロケールの抑圧.
                                                             (line   46)
* Python Enhancement Proposals; PEP 538 <3>: PEP 540 強制 UTF-8 実行モード.
                                                             (line   27)
* Python Enhancement Proposals; PEP 538 <4>: ドキュメント<56>.
                                                             (line   68)
* Python Enhancement Proposals; PEP 538 <5>: ドキュメント<57>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 538 <6>: Core and Builtins<169>.
                                                             (line  134)
* Python Enhancement Proposals; PEP 538 <7>: 環境変数.       (line  423)
* Python Enhancement Proposals; PEP 538 <8>: 一般的なオプション.
                                                             (line   89)
* Python Enhancement Proposals; PEP 538 <9>: locale --- 国際化サービス.
                                                             (line  524)
* Python Enhancement Proposals; PEP 538 <10>: Python Configuration.
                                                             (line   13)
* Python Enhancement Proposals; PEP 539: PEP 539 スレッドローカルストレージのための新しい C API.
                                                             (line   12)
* Python Enhancement Proposals; PEP 539 <1>: PEP 539 スレッドローカルストレージのための新しい C API.
                                                             (line   30)
* Python Enhancement Proposals; PEP 539 <2>: C API<62>.      (line   13)
* Python Enhancement Proposals; PEP 539 <3>: スレッド固有ストレージ Thread Specific Storage TSS API.
                                                             (line   15)
* Python Enhancement Proposals; PEP 540: PEP 540 強制 UTF-8 実行モード.
                                                             (line   18)
* Python Enhancement Proposals; PEP 540 <1>: PEP 540 強制 UTF-8 実行モード.
                                                             (line   35)
* Python Enhancement Proposals; PEP 540 <2>: Core and Builtins<166>.
                                                             (line   63)
* Python Enhancement Proposals; PEP 540 <3>: Python UTF-8 Mode.
                                                             (line    6)
* Python Enhancement Proposals; PEP 540 <4>: locale --- 国際化サービス.
                                                             (line  524)
* Python Enhancement Proposals; PEP 540 <5>: Python Configuration.
                                                             (line   14)
* Python Enhancement Proposals; PEP 544: typing<9>.          (line   32)
* Python Enhancement Proposals; PEP 544 <1>: 名前的部分型 vs 構造的部分型.
                                                             (line   24)
* Python Enhancement Proposals; PEP 544 <2>: Other special directives.
                                                             (line  160)
* Python Enhancement Proposals; PEP 545: PEP 545 Python Documentation Translations.
                                                             (line    6)
* Python Enhancement Proposals; PEP 545 <1>: PEP 545 Python Documentation Translations.
                                                             (line   20)
* Python Enhancement Proposals; PEP 552: その他の CPython の実装の変更.
                                                             (line   16)
* Python Enhancement Proposals; PEP 552 <1>: PEP 552 Hash-based pyc Files.
                                                             (line   15)
* Python Enhancement Proposals; PEP 552 <2>: PEP 552 Hash-based pyc Files.
                                                             (line   36)
* Python Enhancement Proposals; PEP 552 <3>: ライブラリ<162>.
                                                             (line  795)
* Python Enhancement Proposals; PEP 552 <4>: Core and Builtins<166>.
                                                             (line   75)
* Python Enhancement Proposals; PEP 552 <5>: はじめに<13>.   (line   85)
* Python Enhancement Proposals; PEP 552 <6>: py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   83)
* Python Enhancement Proposals; PEP 552 <7>: PyConfig.       (line  274)
* Python Enhancement Proposals; PEP 553: PEP 553 組み込みの breakpoint.
                                                             (line   20)
* Python Enhancement Proposals; PEP 553 <1>: Core and Builtins<168>.
                                                             (line   72)
* Python Enhancement Proposals; PEP 554: PEP 684 インタープリタごとの GIL.
                                                             (line   10)
* Python Enhancement Proposals; PEP 554 <1>: concurrent interpreters --- Multiple interpreters in the same process.
                                                             (line   36)
* Python Enhancement Proposals; PEP 554 <2>: A Per-Interpreter GIL.
                                                             (line   13)
* Python Enhancement Proposals; PEP 557: データクラス<3>.    (line   26)
* Python Enhancement Proposals; PEP 557 <1>: dataclasses --- データクラス.
                                                             (line   12)
* Python Enhancement Proposals; PEP 560: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート.
                                                             (line   20)
* Python Enhancement Proposals; PEP 560 <1>: types<5>.       (line   12)
* Python Enhancement Proposals; PEP 560 <2>: Core and Builtins<166>.
                                                             (line   66)
* Python Enhancement Proposals; PEP 560 <3>: MRO エントリの解決.
                                                             (line   30)
* Python Enhancement Proposals; PEP 560 <4>: __class_getitem__ versus __getitem__.
                                                             (line   85)
* Python Enhancement Proposals; PEP 560 <5>: 動的な型生成.   (line   54)
* Python Enhancement Proposals; PEP 560 <6>: 動的な型生成.   (line   70)
* Python Enhancement Proposals; PEP 560 <7>: 動的な型生成.   (line  108)
* Python Enhancement Proposals; PEP 562: PEP 562 モジュール属性へのアクセスのカスタマイズ.
                                                             (line   16)
* Python Enhancement Proposals; PEP 562 <1>: ライブラリ<169>.
                                                             (line   63)
* Python Enhancement Proposals; PEP 562 <2>: Core and Builtins<166>.
                                                             (line   69)
* Python Enhancement Proposals; PEP 562 <3>: モジュールの属性値アクセスをカスタマイズする.
                                                             (line   57)
* Python Enhancement Proposals; PEP 563: from __future__ import annotations.
                                                             (line    6)
* Python Enhancement Proposals; PEP 563 <1>: PEP 563 may not be the future.
                                                             (line    6)
* Python Enhancement Proposals; PEP 563 <2>: PEP 563 アノテーションの遅延評価.
                                                             (line   49)
* Python Enhancement Proposals; PEP 563 <3>: ライブラリ<119>.
                                                             (line  300)
* Python Enhancement Proposals; PEP 563 <4>: Core and Builtins<132>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 563 <5>: future 文 future statement.
                                                             (line   31)
* Python Enhancement Proposals; PEP 563 <6>: 関数定義.       (line  149)
* Python Enhancement Proposals; PEP 563 <7>: モジュールコンテンツ<5>.
                                                             (line   47)
* Python Enhancement Proposals; PEP 563 <8>: Annotation semantics.
                                                             (line   15)
* Python Enhancement Proposals; PEP 563 <9>: Annotation semantics.
                                                             (line   52)
* Python Enhancement Proposals; PEP 564: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数.
                                                             (line    8)
* Python Enhancement Proposals; PEP 564 <1>: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数.
                                                             (line   33)
* Python Enhancement Proposals; PEP 564 <2>: time<5>.        (line    6)
* Python Enhancement Proposals; PEP 564 <3>: ライブラリ<171>.
                                                             (line  299)
* Python Enhancement Proposals; PEP 565: PEP 565 Show DeprecationWarning in __main__.
                                                             (line   41)
* Python Enhancement Proposals; PEP 565 <1>: 警告.           (line   22)
* Python Enhancement Proposals; PEP 566: 配布物メタデータ.   (line   34)
* Python Enhancement Proposals; PEP 567: contextvars<2>.     (line   20)
* Python Enhancement Proposals; PEP 567 <1>: asyncio<10>.    (line   19)
* Python Enhancement Proposals; PEP 567 <2>: ドキュメント<56>.
                                                             (line   86)
* Python Enhancement Proposals; PEP 567 <3>: ドキュメント<58>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 567 <4>: Core and Builtins<165>.
                                                             (line   63)
* Python Enhancement Proposals; PEP 567 <5>: contextvars --- コンテキスト変数.
                                                             (line   18)
* Python Enhancement Proposals; PEP 567 <6>: コールバックのスケジューリング.
                                                             (line   45)
* Python Enhancement Proposals; PEP 567 <7>: 遅延コールバックのスケジューリング.
                                                             (line   36)
* Python Enhancement Proposals; PEP 567 <8>: 遅延コールバックのスケジューリング.
                                                             (line   60)
* Python Enhancement Proposals; PEP 567 <9>: Future オブジェクト<2>.
                                                             (line  108)
* Python Enhancement Proposals; PEP 570: 位置専用引数.       (line   68)
* Python Enhancement Proposals; PEP 570 <1>: Python API の変更<6>.
                                                             (line  161)
* Python Enhancement Proposals; PEP 570 <2>: Core and Builtins<156>.
                                                             (line   36)
* Python Enhancement Proposals; PEP 570 <3>: 関数定義.       (line  104)
* Python Enhancement Proposals; PEP 572: その他の言語変更<2>.
                                                             (line   31)
* Python Enhancement Proposals; PEP 572 <1>: 代入式.         (line   39)
* Python Enhancement Proposals; PEP 572 <2>: CPython バイトコードの変更<6>.
                                                             (line   27)
* Python Enhancement Proposals; PEP 572 <3>: Core and Builtins<67>.
                                                             (line   40)
* Python Enhancement Proposals; PEP 572 <4>: ドキュメント<47>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 572 <5>: Core and Builtins<154>.
                                                             (line  184)
* Python Enhancement Proposals; PEP 572 <6>: Core and Builtins<159>.
                                                             (line   92)
* Python Enhancement Proposals; PEP 572 <7>: 辞書表示.       (line   43)
* Python Enhancement Proposals; PEP 572 <8>: 代入式<2>.      (line   29)
* Python Enhancement Proposals; PEP 572 <9>: キャプチャパターン.
                                                             (line   18)
* Python Enhancement Proposals; PEP 572 <10>: 式中で代入ができないのはなぜですか？.
                                                             (line   13)
* Python Enhancement Proposals; PEP 573: 概要 -- リリースハイライト<6>.
                                                             (line   29)
* Python Enhancement Proposals; PEP 573 <1>: 新しい機能<11>. (line    6)
* Python Enhancement Proposals; PEP 573 <2>: Core and Builtins<148>.
                                                             (line   19)
* Python Enhancement Proposals; PEP 573 <3>: C API<46>.      (line   57)
* Python Enhancement Proposals; PEP 574: Pickle プロトコルバージョン 5 による帯域外データバッファ.
                                                             (line   14)
* Python Enhancement Proposals; PEP 574 <1>: データストリームの形式.
                                                             (line   50)
* Python Enhancement Proposals; PEP 574 <2>: 使用例<10>.     (line   65)
* Python Enhancement Proposals; PEP 578: PEP 578 Pythonランタイムの監査フック.
                                                             (line   12)
* Python Enhancement Proposals; PEP 578 <1>: 監査イベント表. (line    9)
* Python Enhancement Proposals; PEP 578 <2>: sys --- システム固有のパラメーターと関数.
                                                             (line   57)
* Python Enhancement Proposals; PEP 578 <3>: システム関数.   (line  137)
* Python Enhancement Proposals; PEP 584: 概要 -- リリースハイライト<6>.
                                                             (line    8)
* Python Enhancement Proposals; PEP 584 <1>: 辞書のマージと更新演算子.
                                                             (line   19)
* Python Enhancement Proposals; PEP 584 <2>: ライブラリ<152>.
                                                             (line  193)
* Python Enhancement Proposals; PEP 584 <3>: ライブラリ<152>.
                                                             (line  196)
* Python Enhancement Proposals; PEP 584 <4>: ライブラリ<152>.
                                                             (line  210)
* Python Enhancement Proposals; PEP 584 <5>: ライブラリ<153>.
                                                             (line   49)
* Python Enhancement Proposals; PEP 584 <6>: ライブラリ<153>.
                                                             (line   62)
* Python Enhancement Proposals; PEP 584 <7>: ライブラリ<153>.
                                                             (line  120)
* Python Enhancement Proposals; PEP 584 <8>: ライブラリ<153>.
                                                             (line  142)
* Python Enhancement Proposals; PEP 584 <9>: ChainMap オブジェクト.
                                                             (line   88)
* Python Enhancement Proposals; PEP 584 <10>: defaultdict オブジェクト.
                                                             (line   54)
* Python Enhancement Proposals; PEP 584 <11>: OrderedDict オブジェクト.
                                                             (line  107)
* Python Enhancement Proposals; PEP 584 <12>: weakref --- Weak references.
                                                             (line  191)
* Python Enhancement Proposals; PEP 584 <13>: weakref --- Weak references.
                                                             (line  210)
* Python Enhancement Proposals; PEP 584 <14>: 標準的なインタプリタ型.
                                                             (line  235)
* Python Enhancement Proposals; PEP 584 <15>: プロセスのパラメーター.
                                                             (line   60)
* Python Enhancement Proposals; PEP 584 <16>: プロセスのパラメーター.
                                                             (line   76)
* Python Enhancement Proposals; PEP 585: 概要 -- リリースハイライト<6>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 585 <1>: 標準コレクション型の型ヒントにおける総称型 generics の使用.
                                                             (line   17)
* Python Enhancement Proposals; PEP 585 <2>: ライブラリ<74>. (line  158)
* Python Enhancement Proposals; PEP 585 <3>: ライブラリ<105>.
                                                             (line  124)
* Python Enhancement Proposals; PEP 585 <4>: ドキュメント<35>.
                                                             (line   31)
* Python Enhancement Proposals; PEP 585 <5>: GenericAlias オブジェクトの特別な属性.
                                                             (line   55)
* Python Enhancement Proposals; PEP 585 <6>: collections abc --- コンテナの抽象基底クラス.
                                                             (line   87)
* Python Enhancement Proposals; PEP 585 <7>: 標準的なインタプリタ型.
                                                             (line  175)
* Python Enhancement Proposals; PEP 585 <8>: Introspection helpers.
                                                             (line  162)
* Python Enhancement Proposals; PEP 585 <9>: 非推奨のエイリアス.
                                                             (line   10)
* Python Enhancement Proposals; PEP 585 <10>: Aliases to built-in types.
                                                             (line   15)
* Python Enhancement Proposals; PEP 585 <11>: Aliases to built-in types.
                                                             (line   27)
* Python Enhancement Proposals; PEP 585 <12>: Aliases to built-in types.
                                                             (line   39)
* Python Enhancement Proposals; PEP 585 <13>: Aliases to built-in types.
                                                             (line   47)
* Python Enhancement Proposals; PEP 585 <14>: Aliases to built-in types.
                                                             (line   58)
* Python Enhancement Proposals; PEP 585 <15>: Aliases to built-in types.
                                                             (line   71)
* Python Enhancement Proposals; PEP 585 <16>: Aliases to types in collections.
                                                             (line   14)
* Python Enhancement Proposals; PEP 585 <17>: Aliases to types in collections.
                                                             (line   25)
* Python Enhancement Proposals; PEP 585 <18>: Aliases to types in collections.
                                                             (line   36)
* Python Enhancement Proposals; PEP 585 <19>: Aliases to types in collections.
                                                             (line   46)
* Python Enhancement Proposals; PEP 585 <20>: Aliases to types in collections.
                                                             (line   56)
* Python Enhancement Proposals; PEP 585 <21>: Aliases to other concrete types.
                                                             (line   18)
* Python Enhancement Proposals; PEP 585 <22>: Aliases to container ABCs in collections abc.
                                                             (line   11)
* Python Enhancement Proposals; PEP 585 <23>: Aliases to container ABCs in collections abc.
                                                             (line   44)
* Python Enhancement Proposals; PEP 585 <24>: Aliases to container ABCs in collections abc.
                                                             (line   52)
* Python Enhancement Proposals; PEP 585 <25>: Aliases to container ABCs in collections abc.
                                                             (line   61)
* Python Enhancement Proposals; PEP 585 <26>: Aliases to container ABCs in collections abc.
                                                             (line   69)
* Python Enhancement Proposals; PEP 585 <27>: Aliases to container ABCs in collections abc.
                                                             (line   77)
* Python Enhancement Proposals; PEP 585 <28>: Aliases to container ABCs in collections abc.
                                                             (line   85)
* Python Enhancement Proposals; PEP 585 <29>: Aliases to container ABCs in collections abc.
                                                             (line   93)
* Python Enhancement Proposals; PEP 585 <30>: Aliases to container ABCs in collections abc.
                                                             (line  101)
* Python Enhancement Proposals; PEP 585 <31>: Aliases to container ABCs in collections abc.
                                                             (line  109)
* Python Enhancement Proposals; PEP 585 <32>: Aliases to container ABCs in collections abc.
                                                             (line  117)
* Python Enhancement Proposals; PEP 585 <33>: Aliases to container ABCs in collections abc.
                                                             (line  125)
* Python Enhancement Proposals; PEP 585 <34>: Aliases to asynchronous ABCs in collections abc.
                                                             (line   18)
* Python Enhancement Proposals; PEP 585 <35>: Aliases to asynchronous ABCs in collections abc.
                                                             (line   33)
* Python Enhancement Proposals; PEP 585 <36>: Aliases to asynchronous ABCs in collections abc.
                                                             (line   45)
* Python Enhancement Proposals; PEP 585 <37>: Aliases to asynchronous ABCs in collections abc.
                                                             (line   55)
* Python Enhancement Proposals; PEP 585 <38>: Aliases to asynchronous ABCs in collections abc.
                                                             (line   65)
* Python Enhancement Proposals; PEP 585 <39>: Aliases to other ABCs in collections abc.
                                                             (line   11)
* Python Enhancement Proposals; PEP 585 <40>: Aliases to other ABCs in collections abc.
                                                             (line   19)
* Python Enhancement Proposals; PEP 585 <41>: Aliases to other ABCs in collections abc.
                                                             (line   31)
* Python Enhancement Proposals; PEP 585 <42>: Aliases to other ABCs in collections abc.
                                                             (line   48)
* Python Enhancement Proposals; PEP 585 <43>: Aliases to other ABCs in collections abc.
                                                             (line   66)
* Python Enhancement Proposals; PEP 585 <44>: Aliases to contextlib ABCs.
                                                             (line   19)
* Python Enhancement Proposals; PEP 585 <45>: Aliases to contextlib ABCs.
                                                             (line   39)
* Python Enhancement Proposals; PEP 585 <46>: メジャーな機能の非推奨時系列.
                                                             (line   15)
* Python Enhancement Proposals; PEP 585 <47>: 用語集<2>.     (line  763)
* Python Enhancement Proposals; PEP 586: typing<6>.          (line    8)
* Python Enhancement Proposals; PEP 586 <1>: typing<8>.      (line    6)
* Python Enhancement Proposals; PEP 586 <2>: typing<9>.      (line   18)
* Python Enhancement Proposals; PEP 586 <3>: 特殊形式.       (line  162)
* Python Enhancement Proposals; PEP 587: Python configuration C API.
                                                             (line   10)
* Python Enhancement Proposals; PEP 587 <1>: Python configuration C API.
                                                             (line   17)
* Python Enhancement Proposals; PEP 587 <2>: Python configuration C API.
                                                             (line   34)
* Python Enhancement Proposals; PEP 587 <3>: Removed C APIs. (line   15)
* Python Enhancement Proposals; PEP 587 <4>: Removed C APIs<2>.
                                                             (line  104)
* Python Enhancement Proposals; PEP 587 <5>: 非推奨<5>.      (line   34)
* Python Enhancement Proposals; PEP 587 <6>: PEP 587 Python 初期化設定.
                                                             (line    6)
* Python Enhancement Proposals; PEP 587 <7>: PEP 587 Python 初期化設定.
                                                             (line   80)
* Python Enhancement Proposals; PEP 587 <8>: C API<11>.      (line   31)
* Python Enhancement Proposals; PEP 587 <9>: C API<37>.      (line  124)
* Python Enhancement Proposals; PEP 587 <10>: Core and Builtins<154>.
                                                             (line   76)
* Python Enhancement Proposals; PEP 587 <11>: C API<53>.     (line    6)
* Python Enhancement Proposals; PEP 587 <12>: PyConfig C API.
                                                             (line   33)
* Python Enhancement Proposals; PEP 589: typing<9>.          (line    8)
* Python Enhancement Proposals; PEP 590: Removed C APIs<2>.  (line  135)
* Python Enhancement Proposals; PEP 590 <1>: Porting to Python 3 11<2>.
                                                             (line   98)
* Python Enhancement Proposals; PEP 590 <2>: 最適化<5>.      (line   55)
* Python Enhancement Proposals; PEP 590 <3>: 概要 -- リリースハイライト<6>.
                                                             (line   36)
* Python Enhancement Proposals; PEP 590 <4>: 最適化<6>.      (line   37)
* Python Enhancement Proposals; PEP 590 <5>: PEP 590 Vectorcall a fast calling protocol for CPython.
                                                             (line   14)
* Python Enhancement Proposals; PEP 590 <6>: Core and Builtins<50>.
                                                             (line  145)
* Python Enhancement Proposals; PEP 590 <7>: ライブラリ<64>. (line 1079)
* Python Enhancement Proposals; PEP 590 <8>: C API<22>.      (line  146)
* Python Enhancement Proposals; PEP 590 <9>: Core and Builtins<72>.
                                                             (line  113)
* Python Enhancement Proposals; PEP 590 <10>: ライブラリ<92>.
                                                             (line   69)
* Python Enhancement Proposals; PEP 590 <11>: Core and Builtins<94>.
                                                             (line   57)
* Python Enhancement Proposals; PEP 590 <12>: Core and Builtins<103>.
                                                             (line  118)
* Python Enhancement Proposals; PEP 590 <13>: Core and Builtins<112>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 590 <14>: Core and Builtins<118>.
                                                             (line   12)
* Python Enhancement Proposals; PEP 590 <15>: Core and Builtins<118>.
                                                             (line   59)
* Python Enhancement Proposals; PEP 590 <16>: Core and Builtins<133>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 590 <17>: Core and Builtins<133>.
                                                             (line   16)
* Python Enhancement Proposals; PEP 590 <18>: Core and Builtins<149>.
                                                             (line   39)
* Python Enhancement Proposals; PEP 590 <19>: Core and Builtins<149>.
                                                             (line   91)
* Python Enhancement Proposals; PEP 590 <20>: Core and Builtins<150>.
                                                             (line   42)
* Python Enhancement Proposals; PEP 590 <21>: Core and Builtins<150>.
                                                             (line   50)
* Python Enhancement Proposals; PEP 590 <22>: Core and Builtins<150>.
                                                             (line   67)
* Python Enhancement Proposals; PEP 590 <23>: C API<53>.     (line   17)
* Python Enhancement Proposals; PEP 590 <24>: The Vectorcall Protocol.
                                                             (line    8)
* Python Enhancement Proposals; PEP 591: typing<9>.          (line   25)
* Python Enhancement Proposals; PEP 591 <1>: 特殊形式.       (line  250)
* Python Enhancement Proposals; PEP 591 <2>: Functions and decorators.
                                                             (line  333)
* Python Enhancement Proposals; PEP 593: 概要 -- リリースハイライト<6>.
                                                             (line   21)
* Python Enhancement Proposals; PEP 593 <1>: typing<7>.      (line    6)
* Python Enhancement Proposals; PEP 593 <2>: ライブラリ<154>.
                                                             (line   91)
* Python Enhancement Proposals; PEP 593 <3>: 特殊形式.       (line  440)
* Python Enhancement Proposals; PEP 593 <4>: Introspection helpers.
                                                             (line   55)
* Python Enhancement Proposals; PEP 594: 概要 -- リリースハイライト<2>.
                                                             (line   19)
* Python Enhancement Proposals; PEP 594 <1>: PEP 594 Remove "dead batteries" from the standard library.
                                                             (line    6)
* Python Enhancement Proposals; PEP 594 <2>: Pending removal in Python 3 13.
                                                             (line    6)
* Python Enhancement Proposals; PEP 594 <3>: asynchat and asyncore.
                                                             (line    6)
* Python Enhancement Proposals; PEP 594 <4>: smtpd.          (line    6)
* Python Enhancement Proposals; PEP 594 <5>: 概要 -- リリースハイライト<4>.
                                                             (line   46)
* Python Enhancement Proposals; PEP 594 <6>: モジュール.     (line    6)
* Python Enhancement Proposals; PEP 594 <7>: ライブラリ<64>. (line  845)
* Python Enhancement Proposals; PEP 594 <8>: ライブラリ<64>. (line  848)
* Python Enhancement Proposals; PEP 594 <9>: ライブラリ<64>. (line  851)
* Python Enhancement Proposals; PEP 594 <10>: ライブラリ<64>.
                                                             (line  859)
* Python Enhancement Proposals; PEP 594 <11>: ライブラリ<64>.
                                                             (line  863)
* Python Enhancement Proposals; PEP 594 <12>: ライブラリ<64>.
                                                             (line  869)
* Python Enhancement Proposals; PEP 594 <13>: ライブラリ<64>.
                                                             (line  872)
* Python Enhancement Proposals; PEP 594 <14>: ライブラリ<64>.
                                                             (line  887)
* Python Enhancement Proposals; PEP 594 <15>: ライブラリ<64>.
                                                             (line  890)
* Python Enhancement Proposals; PEP 594 <16>: ライブラリ<64>.
                                                             (line  897)
* Python Enhancement Proposals; PEP 594 <17>: ライブラリ<64>.
                                                             (line  900)
* Python Enhancement Proposals; PEP 594 <18>: ライブラリ<64>.
                                                             (line  903)
* Python Enhancement Proposals; PEP 594 <19>: ライブラリ<64>.
                                                             (line  906)
* Python Enhancement Proposals; PEP 594 <20>: ライブラリ<64>.
                                                             (line  909)
* Python Enhancement Proposals; PEP 594 <21>: ライブラリ<64>.
                                                             (line  964)
* Python Enhancement Proposals; PEP 594 <22>: ライブラリ<64>.
                                                             (line  967)
* Python Enhancement Proposals; PEP 594 <23>: ライブラリ<64>.
                                                             (line  970)
* Python Enhancement Proposals; PEP 594 <24>: ライブラリ<64>.
                                                             (line  973)
* Python Enhancement Proposals; PEP 594 <25>: ライブラリ<77>.
                                                             (line  105)
* Python Enhancement Proposals; PEP 594 <26>: ライブラリ<87>.
                                                             (line  681)
* Python Enhancement Proposals; PEP 594 <27>: ライブラリ<89>.
                                                             (line   94)
* Python Enhancement Proposals; PEP 594 <28>: ライブラリ<92>.
                                                             (line  124)
* Python Enhancement Proposals; PEP 594 <29>: ライブラリ<92>.
                                                             (line  150)
* Python Enhancement Proposals; PEP 594 <30>: テスト<29>.    (line   25)
* Python Enhancement Proposals; PEP 594 <31>: 取って代わられたモジュール群.
                                                             (line   21)
* Python Enhancement Proposals; PEP 594 <32>: aifc --- Read and write AIFF and AIFC files.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <33>: asynchat --- Asynchronous socket command/response handler.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <34>: asyncore --- Asynchronous socket handler.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <35>: audioop --- Manipulate raw audio data.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <36>: cgi --- Common Gateway Interface のサポート.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <37>: cgitb --- Traceback manager for CGI scripts.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <38>: chunk --- Read IFF chunked data.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <39>: crypt --- Function to check Unix passwords.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <40>: imghdr --- Determine the type of an image.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <41>: mailcap --- Mailcap file handling.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <42>: msilib --- Read and write Microsoft Installer files.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <43>: nis --- Interface to Sun’s NIS Yellow Pages.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <44>: nntplib --- NNTP protocol client.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <45>: ossaudiodev --- Access to OSS-compatible audio devices.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <46>: pipes --- Interface to shell pipelines.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <47>: smtpd --- SMTP Server.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <48>: sndhdr --- Determine type of sound file.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <49>: spwd --- The shadow password database.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <50>: sunau --- Read and write Sun AU files.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <51>: telnetlib --- Telnet client.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <52>: uu --- Encode and decode uuencode files.
                                                             (line   10)
* Python Enhancement Proposals; PEP 594 <53>: xdrlib --- Encode and decode XDR data.
                                                             (line   10)
* Python Enhancement Proposals; PEP 596: What's New In Python 3 9.
                                                             (line   16)
* Python Enhancement Proposals; PEP 597: 概要 -- リリースハイライト<5>.
                                                             (line   44)
* Python Enhancement Proposals; PEP 597 <1>: ライブラリ<121>.
                                                             (line   44)
* Python Enhancement Proposals; PEP 597 <2>: Opt-in EncodingWarning.
                                                             (line    6)
* Python Enhancement Proposals; PEP 602: 概要 -- リリースハイライト<2>.
                                                             (line  167)
* Python Enhancement Proposals; PEP 602 <1>: 概要 -- リリースハイライト<6>.
                                                             (line   61)
* Python Enhancement Proposals; PEP 602 <2>: Python はどれくらい安定していますか？.
                                                             (line    9)
* Python Enhancement Proposals; PEP 604: 概要 -- リリースハイライト<5>.
                                                             (line   26)
* Python Enhancement Proposals; PEP 604 <1>: PEP 604 New Type Union Operator.
                                                             (line   28)
* Python Enhancement Proposals; PEP 604 <2>: ライブラリ<129>.
                                                             (line   25)
* Python Enhancement Proposals; PEP 604 <3>: ドキュメント<44>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 604 <4>: Union 型.       (line  105)
* Python Enhancement Proposals; PEP 604 <5>: Manually Un-Stringizing Stringized Annotations.
                                                             (line   42)
* Python Enhancement Proposals; PEP 610: Distributions.      (line   49)
* Python Enhancement Proposals; PEP 612: 概要 -- リリースハイライト<5>.
                                                             (line   28)
* Python Enhancement Proposals; PEP 612 <1>: PEP 612 Parameter Specification Variables.
                                                             (line   25)
* Python Enhancement Proposals; PEP 612 <2>: ライブラリ<116>.
                                                             (line  691)
* Python Enhancement Proposals; PEP 612 <3>: ライブラリ<119>.
                                                             (line   95)
* Python Enhancement Proposals; PEP 612 <4>: ライブラリ<128>.
                                                             (line   17)
* Python Enhancement Proposals; PEP 612 <5>: ライブラリ<129>.
                                                             (line   25)
* Python Enhancement Proposals; PEP 612 <6>: ライブラリ<129>.
                                                             (line  119)
* Python Enhancement Proposals; PEP 612 <7>: 呼び出し可能オブジェクトのアノテーション.
                                                             (line   77)
* Python Enhancement Proposals; PEP 612 <8>: ユーザー定義のジェネリック型.
                                                             (line  179)
* Python Enhancement Proposals; PEP 612 <9>: 特殊形式.       (line  133)
* Python Enhancement Proposals; PEP 612 <10>: Building generic types and type aliases.
                                                             (line  524)
* Python Enhancement Proposals; PEP 612 <11>: Aliases to other ABCs in collections abc.
                                                             (line   35)
* Python Enhancement Proposals; PEP 613: 概要 -- リリースハイライト<5>.
                                                             (line   30)
* Python Enhancement Proposals; PEP 613 <1>: PEP 613 TypeAlias.
                                                             (line   21)
* Python Enhancement Proposals; PEP 613 <2>: ライブラリ<135>.
                                                             (line   98)
* Python Enhancement Proposals; PEP 613 <3>: 特殊型.         (line  228)
* Python Enhancement Proposals; PEP 614: 概要 -- リリースハイライト<6>.
                                                             (line   13)
* Python Enhancement Proposals; PEP 614 <1>: その他の言語変更<5>.
                                                             (line   38)
* Python Enhancement Proposals; PEP 614 <2>: Core and Builtins<150>.
                                                             (line  112)
* Python Enhancement Proposals; PEP 614 <3>: 関数定義.       (line   56)
* Python Enhancement Proposals; PEP 614 <4>: クラス定義.     (line   61)
* Python Enhancement Proposals; PEP 615: 概要 -- リリースハイライト<6>.
                                                             (line   53)
* Python Enhancement Proposals; PEP 615 <1>: zoneinfo.       (line   37)
* Python Enhancement Proposals; PEP 615 <2>: ライブラリ<151>.
                                                             (line   54)
* Python Enhancement Proposals; PEP 615 <3>: zoneinfo --- IANA タイムゾーンのサポート.
                                                             (line   13)
* Python Enhancement Proposals; PEP 616: 概要 -- リリースハイライト<6>.
                                                             (line   17)
* Python Enhancement Proposals; PEP 616 <1>: prefixとsuffixを削除する新しい文字列メソッド.
                                                             (line    9)
* Python Enhancement Proposals; PEP 616 <2>: Core and Builtins<149>.
                                                             (line   82)
* Python Enhancement Proposals; PEP 617: PEP 701 f-strings の構文的な形式化.
                                                             (line   67)
* Python Enhancement Proposals; PEP 617 <1>: モジュール.     (line   30)
* Python Enhancement Proposals; PEP 617 <2>: カッコ内のコンテキストマネージャー.
                                                             (line   45)
* Python Enhancement Proposals; PEP 617 <3>: 概要 -- リリースハイライト<6>.
                                                             (line   32)
* Python Enhancement Proposals; PEP 617 <4>: 新しいパーサー. (line   20)
* Python Enhancement Proposals; PEP 617 <5>: 非推奨<8>.      (line   95)
* Python Enhancement Proposals; PEP 617 <6>: ライブラリ<116>.
                                                             (line  178)
* Python Enhancement Proposals; PEP 617 <7>: ライブラリ<152>.
                                                             (line   34)
* Python Enhancement Proposals; PEP 617 <8>: 本マニュアルにおける表記法.
                                                             (line   49)
* Python Enhancement Proposals; PEP 618: 概要 -- リリースハイライト<5>.
                                                             (line   18)
* Python Enhancement Proposals; PEP 618 <1>: その他の言語変更<4>.
                                                             (line   17)
* Python Enhancement Proposals; PEP 618 <2>: Core and Builtins<144>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 623: 概要 -- リリースハイライト<3>.
                                                             (line  107)
* Python Enhancement Proposals; PEP 623 <1>: 最適化<3>.      (line    7)
* Python Enhancement Proposals; PEP 623 <2>: 削除<3>.        (line   11)
* Python Enhancement Proposals; PEP 623 <3>: 概要 -- リリースハイライト<5>.
                                                             (line   40)
* Python Enhancement Proposals; PEP 623 <4>: C API<30>.      (line   21)
* Python Enhancement Proposals; PEP 623 <5>: Core and Builtins<119>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 623 <6>: ドキュメント<39>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 623 <7>: Unicode オブジェクト.
                                                             (line   16)
* Python Enhancement Proposals; PEP 624: 概要 -- リリースハイライト<4>.
                                                             (line   50)
* Python Enhancement Proposals; PEP 624 <1>: 削除<5>.        (line   97)
* Python Enhancement Proposals; PEP 624 <2>: 概要 -- リリースハイライト<5>.
                                                             (line   42)
* Python Enhancement Proposals; PEP 624 <3>: C API<37>.      (line  142)
* Python Enhancement Proposals; PEP 624#alternative-apis: 削除<5>.
                                                             (line   97)
* Python Enhancement Proposals; PEP 626: Pending removal in Python 3 15.
                                                             (line   77)
* Python Enhancement Proposals; PEP 626 <1>: Pending removal in Python 3 15<3>.
                                                             (line   77)
* Python Enhancement Proposals; PEP 626 <2>: 非推奨<2>.      (line  227)
* Python Enhancement Proposals; PEP 626 <3>: Pending removal in Python 3 15<5>.
                                                             (line   77)
* Python Enhancement Proposals; PEP 626 <4>: 概要 -- リリースハイライト<5>.
                                                             (line   22)
* Python Enhancement Proposals; PEP 626 <5>: Core and Builtins<80>.
                                                             (line   45)
* Python Enhancement Proposals; PEP 626 <6>: Methods on code objects.
                                                             (line   81)
* Python Enhancement Proposals; PEP 626 <7>: 解析関数.       (line  179)
* Python Enhancement Proposals; PEP 626 <8>: Pending removal in Python 3 15<7>.
                                                             (line   77)
* Python Enhancement Proposals; PEP 628: cmath.              (line    7)
* Python Enhancement Proposals; PEP 628 <1>: math<8>.        (line    7)
* Python Enhancement Proposals; PEP 628 <2>: ライブラリ<186>.
                                                             (line   32)
* Python Enhancement Proposals; PEP 630: C API<15>.          (line   24)
* Python Enhancement Proposals; PEP 630#type-checking: New features in the C API.
                                                             (line  141)
* Python Enhancement Proposals; PEP 632: 概要 -- リリースハイライト<3>.
                                                             (line  111)
* Python Enhancement Proposals; PEP 632 <1>: distutils.      (line    7)
* Python Enhancement Proposals; PEP 632 <2>: 概要 -- リリースハイライト<5>.
                                                             (line   38)
* Python Enhancement Proposals; PEP 632 <3>: distutils<2>.   (line   14)
* Python Enhancement Proposals; PEP 632 <4>: ライブラリ<77>. (line   41)
* Python Enhancement Proposals; PEP 632 <5>: distutils --- Building and installing Python modules.
                                                             (line   10)
* Python Enhancement Proposals; PEP 634: 概要 -- リリースハイライト<5>.
                                                             (line    8)
* Python Enhancement Proposals; PEP 634 <1>: その他の主要な機能.
                                                             (line   55)
* Python Enhancement Proposals; PEP 634 <2>: Core and Builtins<84>.
                                                             (line   55)
* Python Enhancement Proposals; PEP 634 <3>: Core and Builtins<115>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 634 <4>: Core and Builtins<120>.
                                                             (line   16)
* Python Enhancement Proposals; PEP 634 <5>: クラスパターンマッチの位置引数のカスタマイズ.
                                                             (line   30)
* Python Enhancement Proposals; PEP 634 <6>: match 文<2>.    (line   32)
* Python Enhancement Proposals; PEP 634 <7>: クラスパターン. (line  135)
* Python Enhancement Proposals; PEP 634 <8>: PyTypeObject スロット.
                                                             (line  936)
* Python Enhancement Proposals; PEP 634 <9>: PyTypeObject スロット.
                                                             (line  960)
* Python Enhancement Proposals; PEP 635: 概要 -- リリースハイライト<5>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 635 <1>: その他の主要な機能.
                                                             (line   56)
* Python Enhancement Proposals; PEP 636: 概要 -- リリースハイライト<5>.
                                                             (line   12)
* Python Enhancement Proposals; PEP 636 <1>: その他の主要な機能.
                                                             (line   56)
* Python Enhancement Proposals; PEP 636 <2>: match 文.       (line  176)
* Python Enhancement Proposals; PEP 636 <3>: match 文<2>.    (line   34)
* Python Enhancement Proposals; PEP 636 <4>: クラスパターン. (line  137)
* Python Enhancement Proposals; PEP 644: hashlib.            (line    8)
* Python Enhancement Proposals; PEP 644 <1>: 概要 -- リリースハイライト<5>.
                                                             (line   36)
* Python Enhancement Proposals; PEP 644 <2>: hashlib<3>.     (line    7)
* Python Enhancement Proposals; PEP 644 <3>: ssl<4>.         (line    7)
* Python Enhancement Proposals; PEP 644 <4>: Build Changes<4>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 644 <5>: Core and Builtins<57>.
                                                             (line  167)
* Python Enhancement Proposals; PEP 644 <6>: ライブラリ<87>. (line  523)
* Python Enhancement Proposals; PEP 644 <7>: ビルド<43>.     (line    9)
* Python Enhancement Proposals; PEP 644 <8>: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー.
                                                             (line   59)
* Python Enhancement Proposals; PEP 646: PEP 646 Variadic generics.
                                                             (line    7)
* Python Enhancement Proposals; PEP 646 <1>: PEP 646 Variadic generics.
                                                             (line   18)
* Python Enhancement Proposals; PEP 646 <2>: ライブラリ<5>.  (line  251)
* Python Enhancement Proposals; PEP 646 <3>: "Starred" subscriptions.
                                                             (line    7)
* Python Enhancement Proposals; PEP 646 <4>: 式のリスト.     (line   26)
* Python Enhancement Proposals; PEP 646 <5>: 関数定義.       (line  117)
* Python Enhancement Proposals; PEP 646 <6>: Building generic types and type aliases.
                                                             (line  356)
* Python Enhancement Proposals; PEP 647: 概要 -- リリースハイライト<5>.
                                                             (line   32)
* Python Enhancement Proposals; PEP 647 <1>: PEP 647 User-Defined Type Guards.
                                                             (line    9)
* Python Enhancement Proposals; PEP 647 <2>: ライブラリ<119>.
                                                             (line  182)
* Python Enhancement Proposals; PEP 647 <3>: 特殊形式.       (line  554)
* Python Enhancement Proposals; PEP 649: 概要 -- リリースハイライト.
                                                             (line   30)
* Python Enhancement Proposals; PEP 649 <1>: PEP 649 と PEP 749 アノテーションの遅延評価.
                                                             (line    3)
* Python Enhancement Proposals; PEP 649 <2>: PEP 649 と PEP 749 アノテーションの遅延評価.
                                                             (line   41)
* Python Enhancement Proposals; PEP 649 <3>: PEP 649 と PEP 749 アノテーションの遅延評価.
                                                             (line   47)
* Python Enhancement Proposals; PEP 649 <4>: typing.         (line   28)
* Python Enhancement Proposals; PEP 649 <5>: Changes in annotations PEP 649 and PEP 749.
                                                             (line    6)
* Python Enhancement Proposals; PEP 649 <6>: ライブラリ<46>. (line  791)
* Python Enhancement Proposals; PEP 649 <7>: Core and Builtins<47>.
                                                             (line   63)
* Python Enhancement Proposals; PEP 649 <8>: Core and Builtins<47>.
                                                             (line  115)
* Python Enhancement Proposals; PEP 649 <9>: Core and Builtins<47>.
                                                             (line  134)
* Python Enhancement Proposals; PEP 649 <10>: Special writable attributes.
                                                             (line   52)
* Python Enhancement Proposals; PEP 649 <11>: Other writable attributes on module objects.
                                                             (line   21)
* Python Enhancement Proposals; PEP 649 <12>: Special attributes.
                                                             (line   67)
* Python Enhancement Proposals; PEP 649 <13>: Annotations.   (line   48)
* Python Enhancement Proposals; PEP 649 <14>: Annotation scopes.
                                                             (line   63)
* Python Enhancement Proposals; PEP 649 <15>: 定数<10>.      (line   15)
* Python Enhancement Proposals; PEP 649 <16>: モジュールコンテンツ<5>.
                                                             (line  129)
* Python Enhancement Proposals; PEP 649 <17>: モジュールコンテンツ<5>.
                                                             (line   49)
* Python Enhancement Proposals; PEP 649 <18>: annotationlib --- Functionality for introspecting annotations.
                                                             (line   56)
* Python Enhancement Proposals; PEP 649 <19>: annotationlib --- Functionality for introspecting annotations.
                                                             (line   59)
* Python Enhancement Proposals; PEP 649 <20>: Annotation semantics.
                                                             (line   18)
* Python Enhancement Proposals; PEP 649 <21>: Annotation semantics.
                                                             (line   57)
* Python Enhancement Proposals; PEP 649 <22>: 用語集<2>.     (line   56)
* Python Enhancement Proposals; PEP 649#the-stringizer-and-the-fake-globals-environment: 関数<12>.
                                                             (line   50)
* Python Enhancement Proposals; PEP 652: PEP 652 Maintaining the Stable ABI.
                                                             (line   11)
* Python Enhancement Proposals; PEP 652 <1>: C API<38>.      (line   41)
* Python Enhancement Proposals; PEP 654: PEP 654 例外グループと except*.
                                                             (line    6)
* Python Enhancement Proposals; PEP 654 <1>: PEP 654 例外グループと except*.
                                                             (line   13)
* Python Enhancement Proposals; PEP 654 <2>: New opcodes.    (line   19)
* Python Enhancement Proposals; PEP 654 <3>: Core and Builtins<77>.
                                                             (line   23)
* Python Enhancement Proposals; PEP 654 <4>: Core and Builtins<100>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 654 <5>: Core and Builtins<103>.
                                                             (line   88)
* Python Enhancement Proposals; PEP 655: PEP 655 Marking individual TypedDict items as required or not-required.
                                                             (line   30)
* Python Enhancement Proposals; PEP 655 <1>: ライブラリ<89>. (line  266)
* Python Enhancement Proposals; PEP 655 <2>: 特殊形式.       (line  264)
* Python Enhancement Proposals; PEP 655 <3>: 特殊形式.       (line  273)
* Python Enhancement Proposals; PEP 655 <4>: Other special directives.
                                                             (line  476)
* Python Enhancement Proposals; PEP 657: PEP 657 トレースバックのエラー位置の詳細化.
                                                             (line   54)
* Python Enhancement Proposals; PEP 657 <1>: inspect<3>.     (line   17)
* Python Enhancement Proposals; PEP 657 <2>: ライブラリ<89>. (line  223)
* Python Enhancement Proposals; PEP 657 <3>: Core and Builtins<111>.
                                                             (line   11)
* Python Enhancement Proposals; PEP 659: Free-threaded mode improvements.
                                                             (line   10)
* Python Enhancement Proposals; PEP 659 <1>: PEP 659 Specializing Adaptive Interpreter.
                                                             (line    6)
* Python Enhancement Proposals; PEP 659 <2>: PEP 659 Specializing Adaptive Interpreter.
                                                             (line   30)
* Python Enhancement Proposals; PEP 667: New deprecations.   (line  116)
* Python Enhancement Proposals; PEP 667 <1>: 概要 -- リリースハイライト<2>.
                                                             (line   38)
* Python Enhancement Proposals; PEP 667 <2>: Defined mutation semantics for locals.
                                                             (line    8)
* Python Enhancement Proposals; PEP 667 <3>: Defined mutation semantics for locals.
                                                             (line   41)
* Python Enhancement Proposals; PEP 667 <4>: Deprecated C APIs<2>.
                                                             (line   33)
* Python Enhancement Proposals; PEP 667 <5>: Python API の変更<2>.
                                                             (line   17)
* Python Enhancement Proposals; PEP 667 <6>: Python API の変更<2>.
                                                             (line   26)
* Python Enhancement Proposals; PEP 667 <7>: Python API の変更<2>.
                                                             (line   32)
* Python Enhancement Proposals; PEP 667 <8>: 組み込み関数.   (line 1136)
* Python Enhancement Proposals; PEP 667 <9>: コマンドライン・インターフェース<8>.
                                                             (line   77)
* Python Enhancement Proposals; PEP 667 <10>: リフレクション.
                                                             (line   40)
* Python Enhancement Proposals; PEP 667 <11>: フレーム frame オブジェクト<2>.
                                                             (line  138)
* Python Enhancement Proposals; PEP 667 <12>: Frame Locals Proxies.
                                                             (line   14)
* Python Enhancement Proposals; PEP 667 <13>: Legacy Local Variable APIs.
                                                             (line   45)
* Python Enhancement Proposals; PEP 669: 概要 -- リリースハイライト<2>.
                                                             (line  110)
* Python Enhancement Proposals; PEP 669 <1>: 新しい機能<3>.  (line    6)
* Python Enhancement Proposals; PEP 669 <2>: PEP 669 CPython の低影響モニタリング.
                                                             (line    6)
* Python Enhancement Proposals; PEP 669 <3>: Core and Builtins<61>.
                                                             (line   68)
* Python Enhancement Proposals; PEP 670: 概要 -- リリースハイライト<4>.
                                                             (line   53)
* Python Enhancement Proposals; PEP 670 <1>: Porting to Python 3 11<2>.
                                                             (line   12)
* Python Enhancement Proposals; PEP 672: Non-ASCII characters in names.
                                                             (line   93)
* Python Enhancement Proposals; PEP 673: PEP 673 Self 型.    (line   32)
* Python Enhancement Proposals; PEP 673 <1>: ライブラリ<96>. (line  134)
* Python Enhancement Proposals; PEP 673 <2>: 特殊型.         (line  194)
* Python Enhancement Proposals; PEP 675: PEP 675 Arbitrary literal string type.
                                                             (line   32)
* Python Enhancement Proposals; PEP 675 <1>: ライブラリ<92>. (line   59)
* Python Enhancement Proposals; PEP 675 <2>: 特殊型.         (line   95)
* Python Enhancement Proposals; PEP 676: ドキュメント<30>.   (line    8)
* Python Enhancement Proposals; PEP 678: その他の言語変更<2>.
                                                             (line   36)
* Python Enhancement Proposals; PEP 678 <1>: PEP 678 ノートによって例外を充実させる.
                                                             (line   11)
* Python Enhancement Proposals; PEP 678 <2>: Core and Builtins<61>.
                                                             (line   48)
* Python Enhancement Proposals; PEP 678 <3>: Core and Builtins<63>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 678 <4>: Core and Builtins<84>.
                                                             (line  118)
* Python Enhancement Proposals; PEP 680: 概要 -- リリースハイライト<4>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 680 <1>: 新たなモジュール<3>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 680 <2>: ライブラリ<92>. (line  205)
* Python Enhancement Proposals; PEP 681: PEP 681 Data class transforms.
                                                             (line   30)
* Python Enhancement Proposals; PEP 681 <1>: ライブラリ<89>. (line  110)
* Python Enhancement Proposals; PEP 681 <2>: Functions and decorators.
                                                             (line  242)
* Python Enhancement Proposals; PEP 682: その他の言語変更<3>.
                                                             (line   49)
* Python Enhancement Proposals; PEP 682 <1>: 書式指定ミニ言語仕様.
                                                             (line   96)
* Python Enhancement Proposals; PEP 683: 新しい機能<5>.      (line  147)
* Python Enhancement Proposals; PEP 683 <1>: Core and Builtins<60>.
                                                             (line   70)
* Python Enhancement Proposals; PEP 683 <2>: 参照カウント.   (line  136)
* Python Enhancement Proposals; PEP 683 <3>: 用語集<2>.      (line  840)
* Python Enhancement Proposals; PEP 684: PEP 734 Multiple interpreters in the standard library.
                                                             (line   33)
* Python Enhancement Proposals; PEP 684 <1>: PEP 684 インタープリタごとの GIL.
                                                             (line    6)
* Python Enhancement Proposals; PEP 684 <2>: 新しい機能<5>.  (line  182)
* Python Enhancement Proposals; PEP 684 <3>: concurrent interpreters --- Multiple interpreters in the same process.
                                                             (line   40)
* Python Enhancement Proposals; PEP 684 <4>: sys --- システム固有のパラメーターと関数.
                                                             (line 1155)
* Python Enhancement Proposals; PEP 684 <5>: 高レベルAPI.    (line   21)
* Python Enhancement Proposals; PEP 684 <6>: A Per-Interpreter GIL.
                                                             (line   14)
* Python Enhancement Proposals; PEP 686: Python UTF-8 Mode.  (line   71)
* Python Enhancement Proposals; PEP 686 <1>: Text Encoding.  (line   32)
* Python Enhancement Proposals; PEP 687: ライブラリ<60>.     (line  137)
* Python Enhancement Proposals; PEP 687 <1>: Core and Builtins<59>.
                                                             (line  326)
* Python Enhancement Proposals; PEP 687 <2>: ライブラリ<67>. (line  293)
* Python Enhancement Proposals; PEP 687 <3>: ライブラリ<67>. (line  300)
* Python Enhancement Proposals; PEP 687 <4>: ライブラリ<67>. (line  333)
* Python Enhancement Proposals; PEP 687 <5>: ライブラリ<67>. (line  336)
* Python Enhancement Proposals; PEP 687 <6>: ライブラリ<67>. (line  346)
* Python Enhancement Proposals; PEP 687 <7>: ライブラリ<67>. (line  403)
* Python Enhancement Proposals; PEP 687 <8>: ライブラリ<69>. (line    6)
* Python Enhancement Proposals; PEP 687 <9>: ライブラリ<70>. (line  111)
* Python Enhancement Proposals; PEP 687 <10>: ライブラリ<70>.
                                                             (line  118)
* Python Enhancement Proposals; PEP 688: PEP 688 バッファプロトコルを Python で利用可能にする.
                                                             (line    6)
* Python Enhancement Proposals; PEP 688 <1>: Core and Builtins<61>.
                                                             (line   76)
* Python Enhancement Proposals; PEP 688 <2>: Emulating buffer types.
                                                             (line   39)
* Python Enhancement Proposals; PEP 688 <3>: コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  201)
* Python Enhancement Proposals; PEP 688#current-options: Pending removal in Python 3 17.
                                                             (line   26)
* Python Enhancement Proposals; PEP 688#current-options <1>: Pending removal in Python 3 17.
                                                             (line   58)
* Python Enhancement Proposals; PEP 688#current-options <2>: Pending removal in Python 3 17<2>.
                                                             (line   26)
* Python Enhancement Proposals; PEP 688#current-options <3>: Pending removal in Python 3 17<2>.
                                                             (line   58)
* Python Enhancement Proposals; PEP 688#current-options <4>: 非推奨<2>.
                                                             (line   70)
* Python Enhancement Proposals; PEP 688#current-options <5>: Pending removal in Python 3 17<3>.
                                                             (line   26)
* Python Enhancement Proposals; PEP 688#current-options <6>: Pending removal in Python 3 17<3>.
                                                             (line   58)
* Python Enhancement Proposals; PEP 688#current-options <7>: コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  114)
* Python Enhancement Proposals; PEP 688#current-options <8>: Aliases to container ABCs in collections abc.
                                                             (line   33)
* Python Enhancement Proposals; PEP 688#current-options <9>: Pending removal in Python 3 17<4>.
                                                             (line   26)
* Python Enhancement Proposals; PEP 688#current-options <10>: Pending removal in Python 3 17<4>.
                                                             (line   58)
* Python Enhancement Proposals; PEP 689: C API<25>.          (line   26)
* Python Enhancement Proposals; PEP 692: PEP 692 Using TypedDict for more precise **kwargs typing.
                                                             (line   10)
* Python Enhancement Proposals; PEP 692 <1>: PEP 692 Using TypedDict for more precise **kwargs typing.
                                                             (line   21)
* Python Enhancement Proposals; PEP 692 <2>: ライブラリ<67>. (line  120)
* Python Enhancement Proposals; PEP 692 <3>: ドキュメント<21>.
                                                             (line   11)
* Python Enhancement Proposals; PEP 692 <4>: 特殊形式.       (line  634)
* Python Enhancement Proposals; PEP 693: What's New In Python 3 12.
                                                             (line   16)
* Python Enhancement Proposals; PEP 695: PEP 695 型パラメータの構文.
                                                             (line   10)
* Python Enhancement Proposals; PEP 695 <1>: PEP 695 型パラメータの構文.
                                                             (line   59)
* Python Enhancement Proposals; PEP 695 <2>: CPython バイトコードの変更<2>.
                                                             (line   41)
* Python Enhancement Proposals; PEP 695 <3>: ライブラリ<46>. (line  814)
* Python Enhancement Proposals; PEP 695 <4>: ライブラリ<55>. (line  123)
* Python Enhancement Proposals; PEP 695 <5>: ライブラリ<64>. (line   95)
* Python Enhancement Proposals; PEP 695 <6>: ライブラリ<64>. (line  661)
* Python Enhancement Proposals; PEP 695 <7>: ライブラリ<64>. (line  856)
* Python Enhancement Proposals; PEP 695 <8>: ライブラリ<64>. (line  949)
* Python Enhancement Proposals; PEP 695 <9>: Core and Builtins<60>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 695 <10>: Core and Builtins<60>.
                                                             (line  105)
* Python Enhancement Proposals; PEP 695 <11>: ライブラリ<67>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 695 <12>: Annotation scopes.
                                                             (line   57)
* Python Enhancement Proposals; PEP 695 <13>: The type statement.
                                                             (line   40)
* Python Enhancement Proposals; PEP 695 <14>: 特殊型.        (line   60)
* Python Enhancement Proposals; PEP 695 <15>: Building generic types and type aliases.
                                                             (line  113)
* Python Enhancement Proposals; PEP 695 <16>: Building generic types and type aliases.
                                                             (line  248)
* Python Enhancement Proposals; PEP 695 <17>: Building generic types and type aliases.
                                                             (line  394)
* Python Enhancement Proposals; PEP 695 <18>: Building generic types and type aliases.
                                                             (line  513)
* Python Enhancement Proposals; PEP 695 <19>: メジャーな機能の非推奨時系列.
                                                             (line   29)
* Python Enhancement Proposals; PEP 696: 概要 -- リリースハイライト<2>.
                                                             (line  115)
* Python Enhancement Proposals; PEP 696 <1>: Core and Builtins<50>.
                                                             (line  165)
* Python Enhancement Proposals; PEP 696 <2>: Annotation scopes.
                                                             (line   60)
* Python Enhancement Proposals; PEP 696 <3>: Type parameter lists.
                                                             (line    8)
* Python Enhancement Proposals; PEP 697: 新しい機能<5>.      (line    6)
* Python Enhancement Proposals; PEP 697 <1>: 新しい機能<5>.  (line   33)
* Python Enhancement Proposals; PEP 697 <2>: C API<23>.      (line   38)
* Python Enhancement Proposals; PEP 698: PEP 698 Override Decorator for Static Typing.
                                                             (line   30)
* Python Enhancement Proposals; PEP 698 <1>: ライブラリ<70>. (line  100)
* Python Enhancement Proposals; PEP 698 <2>: Functions and decorators.
                                                             (line  405)
* Python Enhancement Proposals; PEP 699: Pending removal in Python 3 14<2>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 699 <1>: 非推奨<3>.      (line    6)
* Python Enhancement Proposals; PEP 699 <2>: Pending removal in Python 3 14<4>.
                                                             (line    7)
* Python Enhancement Proposals; PEP 699 <3>: C API<15>.      (line   15)
* Python Enhancement Proposals; PEP 699 <4>: ビルド<27>.     (line   15)
* Python Enhancement Proposals; PEP 7:   ビルドならびに C API の変更<2>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 7 <1>: ビルド要件.       (line   28)
* Python Enhancement Proposals; PEP 7 <2>: コーディング基準. (line    6)
* Python Enhancement Proposals; PEP 701: PEP 701 f-strings の構文的な形式化.
                                                             (line    6)
* Python Enhancement Proposals; PEP 701 <1>: PEP 701 f-strings の構文的な形式化.
                                                             (line   65)
* Python Enhancement Proposals; PEP 701 <2>: tokenize.       (line    6)
* Python Enhancement Proposals; PEP 701 <3>: 最適化<3>.      (line   26)
* Python Enhancement Proposals; PEP 701 <4>: Python API の変更<3>.
                                                             (line   76)
* Python Enhancement Proposals; PEP 701 <5>: Python API の変更<3>.
                                                             (line   78)
* Python Enhancement Proposals; PEP 701 <6>: Python API の変更<3>.
                                                             (line  100)
* Python Enhancement Proposals; PEP 701 <7>: f-strings.      (line  152)
* Python Enhancement Proposals; PEP 702: 概要 -- リリースハイライト<2>.
                                                             (line  119)
* Python Enhancement Proposals; PEP 702 <1>: warnings.       (line    6)
* Python Enhancement Proposals; PEP 702 <2>: ライブラリ<62>. (line  469)
* Python Enhancement Proposals; PEP 702 <3>: 利用可能な関数. (line  183)
* Python Enhancement Proposals; PEP 703: Free-threaded mode improvements.
                                                             (line    6)
* Python Enhancement Proposals; PEP 703 <1>: New features in the C API.
                                                             (line  193)
* Python Enhancement Proposals; PEP 703 <2>: 概要 -- リリースハイライト<2>.
                                                             (line    9)
* Python Enhancement Proposals; PEP 703 <3>: 概要 -- リリースハイライト<2>.
                                                             (line   44)
* Python Enhancement Proposals; PEP 703 <4>: フリースレッドの CPython.
                                                             (line   54)
* Python Enhancement Proposals; PEP 703 <5>: C API<14>.      (line   21)
* Python Enhancement Proposals; PEP 703 <6>: Core and Builtins<47>.
                                                             (line  169)
* Python Enhancement Proposals; PEP 703 <7>: Core and Builtins<53>.
                                                             (line   11)
* Python Enhancement Proposals; PEP 703 <8>: C API<21>.      (line  137)
* Python Enhancement Proposals; PEP 703 <9>: Installing free-threaded binaries<2>.
                                                             (line    8)
* Python Enhancement Proposals; PEP 703 <10>: フリースレッドバイナリ Free-threaded Binaries のインストール.
                                                             (line    9)
* Python Enhancement Proposals; PEP 703 <11>: GIL and performance considerations.
                                                             (line   16)
* Python Enhancement Proposals; PEP 703 <12>: Python support for free threading.
                                                             (line   26)
* Python Enhancement Proposals; PEP 703 <13>: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？.
                                                             (line   12)
* Python Enhancement Proposals; PEP 703 <14>: 用語集<2>.     (line  648)
* Python Enhancement Proposals; PEP 703 <15>: 用語集<2>.     (line  790)
* Python Enhancement Proposals; PEP 705: 概要 -- リリースハイライト<2>.
                                                             (line  123)
* Python Enhancement Proposals; PEP 705 <1>: typing<2>.      (line    6)
* Python Enhancement Proposals; PEP 705 <2>: ライブラリ<60>. (line   17)
* Python Enhancement Proposals; PEP 705 <3>: 特殊形式.       (line  295)
* Python Enhancement Proposals; PEP 706: その他の言語変更<2>.
                                                             (line   78)
* Python Enhancement Proposals; PEP 706 <1>: tarfile<2>.     (line   13)
* Python Enhancement Proposals; PEP 706 <2>: tarfile<3>.     (line   13)
* Python Enhancement Proposals; PEP 706 <3>: tarfile<4>.     (line   13)
* Python Enhancement Proposals; PEP 706 <4>: tarfile<6>.     (line   13)
* Python Enhancement Proposals; PEP 706 <5>: Extraction filters.
                                                             (line   27)
* Python Enhancement Proposals; PEP 709: Python API の変更<2>.
                                                             (line   26)
* Python Enhancement Proposals; PEP 709 <1>: PEP 709 内包表記のインライン化.
                                                             (line    8)
* Python Enhancement Proposals; PEP 709 <2>: PEP 709 内包表記のインライン化.
                                                             (line   35)
* Python Enhancement Proposals; PEP 709 <3>: CPython バイトコードの変更<2>.
                                                             (line   33)
* Python Enhancement Proposals; PEP 709 <4>: Core and Builtins<61>.
                                                             (line   78)
* Python Enhancement Proposals; PEP 709 <5>: 組み込み関数.   (line 1134)
* Python Enhancement Proposals; PEP 719: What's New In Python 3 13.
                                                             (line   16)
* Python Enhancement Proposals; PEP 730: 概要 -- リリースハイライト<2>.
                                                             (line  132)
* Python Enhancement Proposals; PEP 730 <1>: Support for mobile platforms.
                                                             (line    6)
* Python Enhancement Proposals; PEP 730 <2>: Support for mobile platforms.
                                                             (line   25)
* Python Enhancement Proposals; PEP 734: 概要 -- リリースハイライト.
                                                             (line   32)
* Python Enhancement Proposals; PEP 734 <1>: PEP 734 Multiple interpreters in the standard library.
                                                             (line    3)
* Python Enhancement Proposals; PEP 734 <2>: PEP 734 Multiple interpreters in the standard library.
                                                             (line   97)
* Python Enhancement Proposals; PEP 734 <3>: ライブラリ<19>. (line   44)
* Python Enhancement Proposals; PEP 734 <4>: ライブラリ<42>. (line  348)
* Python Enhancement Proposals; PEP 734 <5>: ライブラリ<55>. (line  161)
* Python Enhancement Proposals; PEP 734 <6>: InterpreterPoolExecutor.
                                                             (line   50)
* Python Enhancement Proposals; PEP 734 <7>: concurrent interpreters --- Multiple interpreters in the same process.
                                                             (line   38)
* Python Enhancement Proposals; PEP 734 <8>: sys --- システム固有のパラメーターと関数.
                                                             (line 1155)
* Python Enhancement Proposals; PEP 737: Changed C APIs.     (line   44)
* Python Enhancement Proposals; PEP 737 <1>: C API<17>.      (line    6)
* Python Enhancement Proposals; PEP 737 <2>: C API<17>.      (line   49)
* Python Enhancement Proposals; PEP 738: 概要 -- リリースハイライト<2>.
                                                             (line  135)
* Python Enhancement Proposals; PEP 738 <1>: Support for mobile platforms.
                                                             (line   15)
* Python Enhancement Proposals; PEP 738 <2>: Support for mobile platforms.
                                                             (line   25)
* Python Enhancement Proposals; PEP 738 <3>: ライブラリ<55>. (line   54)
* Python Enhancement Proposals; PEP 739: build-details json. (line   19)
* Python Enhancement Proposals; PEP 739 <1>: ビルド<6>.      (line   21)
* Python Enhancement Proposals; PEP 739 <2>: ビルド<7>.      (line    7)
* Python Enhancement Proposals; PEP 739 <3>: Core and Builtins<27>.
                                                             (line  101)
* Python Enhancement Proposals; PEP 741: 概要 -- リリースハイライト.
                                                             (line   65)
* Python Enhancement Proposals; PEP 741 <1>: Python configuration C API.
                                                             (line   34)
* Python Enhancement Proposals; PEP 741 <2>: C API<11>.      (line   27)
* Python Enhancement Proposals; PEP 741 <3>: C API<15>.      (line   39)
* Python Enhancement Proposals; PEP 741 <4>: PyInitConfig C API.
                                                             (line   19)
* Python Enhancement Proposals; PEP 742: 概要 -- リリースハイライト<2>.
                                                             (line  127)
* Python Enhancement Proposals; PEP 742 <1>: typing<2>.      (line    9)
* Python Enhancement Proposals; PEP 742 <2>: ライブラリ<55>. (line  239)
* Python Enhancement Proposals; PEP 742 <3>: 特殊形式.       (line  532)
* Python Enhancement Proposals; PEP 744: Binary releases for the experimental just-in-time compiler.
                                                             (line   34)
* Python Enhancement Proposals; PEP 744 <1>: 概要 -- リリースハイライト<2>.
                                                             (line   10)
* Python Enhancement Proposals; PEP 744 <2>: 概要 -- リリースハイライト<2>.
                                                             (line   48)
* Python Enhancement Proposals; PEP 744 <3>: 実験的な Just-in-time JIT コンパイラ.
                                                             (line   60)
* Python Enhancement Proposals; PEP 745: What's new in Python 3 14.
                                                             (line   16)
* Python Enhancement Proposals; PEP 749: 概要 -- リリースハイライト.
                                                             (line   30)
* Python Enhancement Proposals; PEP 749 <1>: PEP 649 と PEP 749 アノテーションの遅延評価.
                                                             (line    3)
* Python Enhancement Proposals; PEP 749 <2>: PEP 649 と PEP 749 アノテーションの遅延評価.
                                                             (line   41)
* Python Enhancement Proposals; PEP 749 <3>: PEP 649 と PEP 749 アノテーションの遅延評価.
                                                             (line   51)
* Python Enhancement Proposals; PEP 749 <4>: Changes in annotations PEP 649 and PEP 749.
                                                             (line    6)
* Python Enhancement Proposals; PEP 749 <5>: ライブラリ<46>. (line  528)
* Python Enhancement Proposals; PEP 749 <6>: ライブラリ<46>. (line  791)
* Python Enhancement Proposals; PEP 749 <7>: Annotation scopes.
                                                             (line   63)
* Python Enhancement Proposals; PEP 749 <8>: Annotations<2>. (line   41)
* Python Enhancement Proposals; PEP 749 <9>: モジュールコンテンツ<5>.
                                                             (line  129)
* Python Enhancement Proposals; PEP 749 <10>: annotationlib --- Functionality for introspecting annotations.
                                                             (line   59)
* Python Enhancement Proposals; PEP 749 <11>: Annotation semantics.
                                                             (line   19)
* Python Enhancement Proposals; PEP 749#pep749-metaclasses: Special attributes.
                                                             (line   58)
* Python Enhancement Proposals; PEP 749#pep749-metaclasses <1>: __annotations__ Quirks.
                                                             (line   40)
* Python Enhancement Proposals; PEP 750: 概要 -- リリースハイライト.
                                                             (line   34)
* Python Enhancement Proposals; PEP 750 <1>: PEP 750 テンプレート文字列リテラル.
                                                             (line    3)
* Python Enhancement Proposals; PEP 750 <2>: PEP 750 テンプレート文字列リテラル.
                                                             (line   73)
* Python Enhancement Proposals; PEP 750 <3>: Core and Builtins<14>.
                                                             (line   20)
* Python Enhancement Proposals; PEP 750 <4>: ライブラリ<23>. (line  140)
* Python Enhancement Proposals; PEP 750 <5>: Core and Builtins<23>.
                                                             (line   43)
* Python Enhancement Proposals; PEP 750 <6>: string templatelib --- テンプレート文字列リテラルのサポート.
                                                             (line   17)
* Python Enhancement Proposals; PEP 757: New features in the C API.
                                                             (line  114)
* Python Enhancement Proposals; PEP 757 <1>: C API<11>.      (line   76)
* Python Enhancement Proposals; PEP 757 <2>: C API<13>.      (line   41)
* Python Enhancement Proposals; PEP 758: 概要 -- リリースハイライト.
                                                             (line   36)
* Python Enhancement Proposals; PEP 758 <1>: PEP 758 Allow except and except* expressions without brackets.
                                                             (line   15)
* Python Enhancement Proposals; PEP 758 <2>: ライブラリ<25>. (line    6)
* Python Enhancement Proposals; PEP 758 <3>: Core and Builtins<25>.
                                                             (line   27)
* Python Enhancement Proposals; PEP 758 <4>: try 文.         (line   26)
* Python Enhancement Proposals; PEP 761: 概要 -- リリースハイライト.
                                                             (line   77)
* Python Enhancement Proposals; PEP 761 <1>: Discontinuation of PGP signatures.
                                                             (line   11)
* Python Enhancement Proposals; PEP 765: 概要 -- リリースハイライト.
                                                             (line   38)
* Python Enhancement Proposals; PEP 765 <1>: PEP 765 Control flow in finally blocks.
                                                             (line    8)
* Python Enhancement Proposals; PEP 765 <2>: Core and Builtins<8>.
                                                             (line   62)
* Python Enhancement Proposals; PEP 765 <3>: クリーンアップ動作を定義する.
                                                             (line   38)
* Python Enhancement Proposals; PEP 765 <4>: クリーンアップ動作を定義する.
                                                             (line   50)
* Python Enhancement Proposals; PEP 765 <5>: finally 節.     (line   46)
* Python Enhancement Proposals; PEP 768: 概要 -- リリースハイライト.
                                                             (line   40)
* Python Enhancement Proposals; PEP 768 <1>: PEP 768 Safe external debugger interface.
                                                             (line    3)
* Python Enhancement Proposals; PEP 768 <2>: PEP 768 Safe external debugger interface.
                                                             (line   53)
* Python Enhancement Proposals; PEP 768 <3>: Core and Builtins<19>.
                                                             (line    6)
* Python Enhancement Proposals; PEP 768 <4>: Core and Builtins<23>.
                                                             (line   36)
* Python Enhancement Proposals; PEP 768 <5>: Core and Builtins<25>.
                                                             (line   17)
* Python Enhancement Proposals; PEP 768 <6>: その他のオプション.
                                                             (line  384)
* Python Enhancement Proposals; PEP 768 <7>: その他のオプション.
                                                             (line  391)
* Python Enhancement Proposals; PEP 768 <8>: 環境変数.       (line  495)
* Python Enhancement Proposals; PEP 768 <9>: パフォーマンスに関するオプション.
                                                             (line  149)
* Python Enhancement Proposals; PEP 768 <10>: パフォーマンスに関するオプション.
                                                             (line  152)
* Python Enhancement Proposals; PEP 768 <11>: sys --- システム固有のパラメーターと関数.
                                                             (line 1930)
* Python Enhancement Proposals; PEP 776: 概要 -- リリースハイライト.
                                                             (line   69)
* Python Enhancement Proposals; PEP 776 <1>: Build changes.  (line    6)
* Python Enhancement Proposals; PEP 779: 概要 -- リリースハイライト.
                                                             (line   74)
* Python Enhancement Proposals; PEP 779 <1>: Free-threaded Python is officially supported.
                                                             (line   28)
* Python Enhancement Proposals; PEP 784: 概要 -- リリースハイライト.
                                                             (line   53)
* Python Enhancement Proposals; PEP 784 <1>: PEP 784 Zstandard support in the standard library.
                                                             (line    3)
* Python Enhancement Proposals; PEP 784 <2>: PEP 784 Zstandard support in the standard library.
                                                             (line   41)
* Python Enhancement Proposals; PEP 8:   ライブラリの変更.   (line   25)
* Python Enhancement Proposals; PEP 8 <1>: ライブラリ<171>.  (line  124)
* Python Enhancement Proposals; PEP 8 <2>: IDLE<63>.         (line   81)
* Python Enhancement Proposals; PEP 8 <3>: 間奏曲 コーディングスタイル.
                                                             (line   13)
* Python Enhancement Proposals; PEP 8 <4>: エディタと IDE.   (line    7)
* Python Enhancement Proposals; PEP 8 <5>: 値の比較.         (line   53)
* Python Enhancement Proposals; PEP 8 <6>: 組み込み関数.     (line 1831)
* Python Enhancement Proposals; PEP 8 <7>: 残りのはしばし<2>.
                                                             (line   35)
* Python Enhancement Proposals; PEP 8 <8>: Python プログラムのためのコーディングスタンダードやスタイルガイドはありますか？.
                                                             (line    6)
* Python Enhancement Proposals; PEP 8 <9>: いつ is 演算子での同一性テストが頼れますか？.
                                                             (line   58)
* Python Enhancement Proposals; PEP 8 <10>: エディタが Python ソースにタブを勝手に挿入しないようにするにはどうしますか？.
                                                             (line    6)
* PYTHON_ABI_VERSION (C macro):          Creating extension modules dynamically.
                                                             (line   78)
* PYTHON_API_VERSION (C macro):          Creating extension modules dynamically.
                                                             (line   71)
* PYTHON_BASIC_REPL:                     Default interactive shell.
                                                             (line    7)
* PYTHON_BASIC_REPL <1>:                 改善された対話的インタープリタ.
                                                             (line   28)
* PYTHON_BASIC_REPL <2>:                 ライブラリ<46>.     (line   52)
* PYTHON_BASIC_REPL <3>:                 ライブラリ<46>.     (line   56)
* PYTHON_BASIC_REPL <4>:                 Core and Builtins<47>.
                                                             (line   13)
* PYTHON_BASIC_REPL <5>:                 対話モード<2>.      (line   21)
* PYTHON_BASIC_REPL <6>:                 使用例<2>.          (line   79)
* PYTHON_BASIC_REPL <7>:                 asyncio --- 非同期 I/O.
                                                             (line   79)
* python_branch() (platform モジュール): Cross platform.     (line   86)
* python_build() (platform モジュール):  Cross platform.     (line   76)
* PYTHON_COLORS:                         概要 -- リリースハイライト<2>.
                                                             (line   55)
* PYTHON_COLORS <1>:                     エラーメッセージの改善<2>.
                                                             (line    7)
* PYTHON_COLORS <2>:                     doctest.            (line    7)
* PYTHON_COLORS <3>:                     色の制御.           (line   20)
* PYTHON_COLORS <4>:                     color.              (line   24)
* python_compiler() (platform モジュール): Cross platform.   (line   81)
* PYTHON_CONTEXT_AWARE_WARNINGS:         ライブラリ<24>.     (line  369)
* PYTHON_CONTEXT_AWARE_WARNINGS <1>:     その他のオプション. (line  435)
* PYTHON_CONTEXT_AWARE_WARNINGS <2>:     sys --- システム固有のパラメーターと関数.
                                                             (line  590)
* PYTHON_CONTEXT_AWARE_WARNINGS <3>:     Concurrent safety of Context Managers.
                                                             (line   41)
* PYTHON_CPU_COUNT:                      os<2>.              (line   11)
* PYTHON_CPU_COUNT <1>:                  その他のオプション. (line  399)
* PYTHON_CPU_COUNT <2>:                  雑多なシステム情報. (line   45)
* PYTHON_CPU_COUNT <3>:                  雑多なシステム情報. (line   66)
* PYTHON_CPU_COUNT <4>:                  その他<5>.          (line   32)
* PYTHON_CPU_COUNT <5>:                  PyConfig.           (line  521)
* PYTHON_DISABLE_REMOTE_DEBUG:           PEP 768 Safe external debugger interface.
                                                             (line   40)
* PYTHON_DISABLE_REMOTE_DEBUG <1>:       その他のオプション. (line  390)
* PYTHON_DISABLE_REMOTE_DEBUG <2>:       Disabling remote debugging.
                                                             (line    8)
* PYTHON_DOM:                            モジュールコンテンツ<4>.
                                                             (line   22)
* PYTHON_FROZEN_MODULES:                 その他の言語変更.   (line   46)
* PYTHON_FROZEN_MODULES <1>:             Core and Builtins<58>.
                                                             (line  105)
* PYTHON_FROZEN_MODULES <2>:             その他のオプション. (line  358)
* PYTHON_FROZEN_MODULES <3>:             PyConfig.           (line  419)
* PYTHON_GIL:                            フリースレッドの CPython.
                                                             (line   23)
* PYTHON_GIL <1>:                        フリースレッドの CPython.
                                                             (line   37)
* PYTHON_GIL <2>:                        Core and Builtins<43>.
                                                             (line   50)
* PYTHON_GIL <3>:                        その他のオプション. (line  417)
* PYTHON_GIL <4>:                        sys --- システム固有のパラメーターと関数.
                                                             (line  583)
* PYTHON_GIL <5>:                        The global interpreter lock in free-threaded Python.
                                                             (line    7)
* PYTHON_GIL <6>:                        用語集<2>.          (line  787)
* PYTHON_HISTORY:                        その他の言語変更.   (line   57)
* PYTHON_HISTORY <1>:                    ライブラリ<62>.     (line  544)
* python_implementation() (platform モジュール): Cross platform.
                                                             (line   91)
* python_is_optimized() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  276)
* PYTHON_JIT:                            Binary releases for the experimental just-in-time compiler.
                                                             (line    8)
* PYTHON_JIT <1>:                        一般的なオプション. (line  242)
* PYTHON_JIT <2>:                        一般的なオプション. (line  245)
* PYTHON_JIT <3>:                        一般的なオプション. (line  250)
* PYTHON_JIT <4>:                        sys --- システム固有のパラメーターと関数.
                                                             (line 1275)
* PYTHON_MANAGER_AUTOMATIC_INSTALL:      Installing runtimes.
                                                             (line   41)
* PYTHON_MANAGER_DEFAULT:                基本的な使い方.     (line   46)
* PYTHON_MANAGER_DEFAULT <1>:            Troubleshooting.    (line   76)
* PYTHON_PERF_JIT_SUPPORT:               その他の言語変更.   (line   52)
* PYTHON_PERF_JIT_SUPPORT <1>:           その他のオプション. (line  377)
* PYTHON_PERF_JIT_SUPPORT <2>:           PyConfig.           (line  907)
* PYTHON_PERF_JIT_SUPPORT <3>:           How to work without frame pointers.
                                                             (line   14)
* PYTHON_PRESITE:                        その他のオプション. (line  411)
* PYTHON_PRESITE <1>:                    PyConfig.           (line  801)
* PYTHON_PRESITE=package.module:         Core and Builtins<58>.
                                                             (line  154)
* python_revision() (platform モジュール): Cross platform.   (line   96)
* PYTHON_THREAD_INHERIT_CONTEXT:         Core and Builtins<24>.
                                                             (line  135)
* PYTHON_THREAD_INHERIT_CONTEXT <1>:     その他のオプション. (line  427)
* PYTHON_THREAD_INHERIT_CONTEXT <2>:     sys --- システム固有のパラメーターと関数.
                                                             (line  586)
* PYTHON_TLBC:                           その他のオプション. (line  443)
* python_version_tuple() (platform モジュール): Cross platform.
                                                             (line  109)
* python_version() (platform モジュール): Cross platform.    (line  101)
* python-m-py_compile コマンドラインオプション; -: コマンドラインインターフェイス<5>.
                                                             (line   13)
* python-m-py_compile コマンドラインオプション; -q: コマンドラインインターフェイス<5>.
                                                             (line   19)
* python-m-py_compile コマンドラインオプション; -quiet: コマンドラインインターフェイス<5>.
                                                             (line   19)
* python-m-py_compile コマンドラインオプション; <file>: コマンドラインインターフェイス<5>.
                                                             (line   13)
* python-m-sqlite3-[-h]-[-v]-[filename]-[sql] コマンドラインオプション; -h: コマンドライン・インターフェース<2>.
                                                             (line   14)
* python-m-sqlite3-[-h]-[-v]-[filename]-[sql] コマンドラインオプション; -help: コマンドライン・インターフェース<2>.
                                                             (line   14)
* python-m-sqlite3-[-h]-[-v]-[filename]-[sql] コマンドラインオプション; -v: コマンドライン・インターフェース<2>.
                                                             (line   18)
* python-m-sqlite3-[-h]-[-v]-[filename]-[sql] コマンドラインオプション; -version: コマンドライン・インターフェース<2>.
                                                             (line   18)
* PYTHONASYNCIODEBUG:                    デバッグモードの有効化.
                                                             (line   10)
* PYTHONASYNCIODEBUG <1>:                デバッグモード.     (line   11)
* PYTHONASYNCIODEBUG <2>:                Python 開発モードの影響.
                                                             (line   65)
* PYTHONBREAKPOINT:                      PEP 553 組み込みの breakpoint.
                                                             (line   13)
* PYTHONBREAKPOINT <1>:                  組み込み関数.       (line  161)
* PYTHONBREAKPOINT <2>:                  sys --- システム固有のパラメーターと関数.
                                                             (line  247)
* PYTHONBREAKPOINT <3>:                  sys --- システム固有のパラメーターと関数.
                                                             (line  261)
* PYTHONBREAKPOINT <4>:                  sys --- システム固有のパラメーターと関数.
                                                             (line  266)
* PYTHONCASEOK:                          Python API の変更<5>.
                                                             (line   29)
* PYTHONCASEOK <1>:                      PEP 235 大文字小文字を区別しないプラットフォームでのモジュールの読み込み.
                                                             (line   17)
* PYTHONCASEOK <2>:                      ライブラリ<153>.    (line  144)
* PYTHONCASEOK <3>:                      組み込み関数.       (line 2242)
* PYTHONCOERCECLOCALE:                   PEP 538 レガシーな C ロケールの抑圧.
                                                             (line   12)
* PYTHONCOERCECLOCALE <1>:               一般的なオプション. (line   89)
* PYTHONCOERCECLOCALE <2>:               Python UTF-8 Mode.  (line   57)
* PYTHONCOERCECLOCALE <3>:               Python Configuration.
                                                             (line   15)
* PYTHONDEBUG:                           その他のオプション. (line   38)
* PYTHONDEBUG <1>:                       Python デバッグビルド.
                                                             (line   20)
* PYTHONDEBUG <2>:                       グローバルな設定変数.
                                                             (line   39)
* PYTHONDEBUG <3>:                       PyConfig.           (line  692)
* PYTHONDEVMODE:                         Python Development Mode -X dev.
                                                             (line    6)
* PYTHONDEVMODE <1>:                     その他のオプション. (line  317)
* PYTHONDEVMODE <2>:                     Python 開発モード.  (line   14)
* PYTHONDEVMODE <3>:                     PyConfig.           (line  295)
* PYTHONDONTWRITEBYTECODE:               インタプリタの変更<2>.
                                                             (line   15)
* PYTHONDONTWRITEBYTECODE <1>:           新しいモジュールと改良されたモジュール<2>.
                                                             (line  637)
* PYTHONDONTWRITEBYTECODE <2>:           その他のオプション. (line   19)
* PYTHONDONTWRITEBYTECODE <3>:           sys --- システム固有のパラメーターと関数.
                                                             (line  332)
* PYTHONDONTWRITEBYTECODE <4>:           グローバルな設定変数.
                                                             (line   53)
* PYTHONDONTWRITEBYTECODE <5>:           PyConfig.           (line 1006)
* PYTHONDONTWRITEBYTECODE <6>:           pyc ファイルを作るにはどうしますか？.
                                                             (line   19)
* PYTHONDUMPREFS:                        デバッグビルドとリリースビルドのABI 共通化.
                                                             (line   15)
* PYTHONDUMPREFS <1>:                    ビルド<59>.         (line   54)
* PYTHONDUMPREFS <2>:                    Debug options.      (line   22)
* PYTHONDUMPREFS <3>:                    Debug options.      (line   24)
* PYTHONDUMPREFS <4>:                    PyConfig.           (line  306)
* PYTHONDUMPREFSFILE:                    Core and Builtins<109>.
                                                             (line   16)
* PYTHONDUMPREFSFILE <1>:                PyConfig.           (line  318)
* PYTHONEXECUTABLE:                      PyConfig.           (line  727)
* PYTHONFAULTHANDLER:                    faulthandler<5>.    (line   12)
* PYTHONFAULTHANDLER <1>:                その他のオプション. (line  269)
* PYTHONFAULTHANDLER <2>:                Python 開発モードの影響.
                                                             (line   59)
* PYTHONFAULTHANDLER <3>:                faulthandler --- Python トレースバックをダンプする.
                                                             (line   15)
* PYTHONFAULTHANDLER <4>:                PyConfig.           (line  355)
* PythonFinalizationError:               具象例外.           (line  217)
* PYTHONHASHSEED:                        組み込みの関数と型. (line   18)
* PYTHONHASHSEED <1>:                    Python コードの移植.
                                                             (line    7)
* PYTHONHASHSEED <2>:                    Core and Builtins<166>.
                                                             (line   30)
* PYTHONHASHSEED <3>:                    その他のオプション. (line  131)
* PYTHONHASHSEED <4>:                    その他のオプション. (line  148)
* PYTHONHASHSEED <5>:                    環境変数.           (line  156)
* PYTHONHASHSEED <6>:                    基本的なカスタマイズ.
                                                             (line  312)
* PYTHONHASHSEED <7>:                    グローバルな設定変数.
                                                             (line   79)
* PYTHONHASHSEED <8>:                    グローバルな設定変数.
                                                             (line   82)
* PYTHONHASHSEED <9>:                    PyConfig.           (line  435)
* PYTHONHOME:                            Pending removal in Python 3 15<2>.
                                                             (line   58)
* PYTHONHOME <1>:                        Deprecated C APIs<2>.
                                                             (line   26)
* PYTHONHOME <2>:                        Pending removal in Python 3 15<4>.
                                                             (line   58)
* PYTHONHOME <3>:                        Pending removal in Python 3 15<6>.
                                                             (line   58)
* PYTHONHOME <4>:                        概要 -- リリースハイライト<9>.
                                                             (line  106)
* PYTHONHOME <5>:                        その他のオプション. (line   47)
* PYTHONHOME <6>:                        環境変数.           (line   18)
* PYTHONHOME <7>:                        環境変数.           (line   20)
* PYTHONHOME <8>:                        環境変数.           (line   37)
* PYTHONHOME <9>:                        モジュールの検索.   (line   28)
* PYTHONHOME <10>:                       モジュールの検索.   (line   43)
* PYTHONHOME <11>:                       モジュールの検索.   (line   78)
* PYTHONHOME <12>:                       iOS プロジェクトに Python を追加する.
                                                             (line   91)
* PYTHONHOME <13>:                       test support script_helper --- Utilities for the Python execution tests.
                                                             (line   25)
* PYTHONHOME <14>:                       sys path モジュール検索パスの初期化.
                                                             (line   30)
* PYTHONHOME <15>:                       sys path モジュール検索パスの初期化.
                                                             (line   56)
* PYTHONHOME <16>:                       Virtual Environments.
                                                             (line   19)
* PYTHONHOME <17>:                       Python の埋め込み<2>.
                                                             (line   34)
* PYTHONHOME <18>:                       Python の埋め込み<2>.
                                                             (line   41)
* PYTHONHOME <19>:                       グローバルな設定変数.
                                                             (line   94)
* PYTHONHOME <20>:                       プロセスワイドのパラメータ.
                                                             (line  299)
* PYTHONHOME <21>:                       プロセスワイドのパラメータ.
                                                             (line  314)
* PYTHONHOME <22>:                       プロセスワイドのパラメータ.
                                                             (line  323)
* PYTHONHOME <23>:                       PyConfig.           (line  443)
* PYTHONHOME <24>:                       PyConfig.           (line  445)
* PYTHONHOME <25>:                       Pending removal in Python 3 15<8>.
                                                             (line   58)
* Pythonic:                              用語集<2>.          (line 1464)
* PYTHONINSPECT:                         その他の変更と修正<2>.
                                                             (line   13)
* PYTHONINSPECT <1>:                     Core and Builtins<2>.
                                                             (line   57)
* PYTHONINSPECT <2>:                     その他のオプション. (line   69)
* PYTHONINSPECT <3>:                     グローバルな設定変数.
                                                             (line  111)
* PYTHONINSPECT <4>:                     PyConfig.           (line  474)
* PYTHONINTMAXSTRDIGITS:                 Core and Builtins<75>.
                                                             (line   74)
* PYTHONINTMAXSTRDIGITS <1>:             その他のオプション. (line  291)
* PYTHONINTMAXSTRDIGITS <2>:             上限値を設定する.   (line    9)
* PYTHONINTMAXSTRDIGITS <3>:             上限値を設定する.   (line   16)
* PYTHONINTMAXSTRDIGITS <4>:             sys --- システム固有のパラメーターと関数.
                                                             (line 1194)
* PYTHONINTMAXSTRDIGITS <5>:             PyConfig.           (line  505)
* PYTHONIOENCODING:                      その他の改善<2>.    (line   75)
* PYTHONIOENCODING <1>:                  インタプリタの変更<2>.
                                                             (line   22)
* PYTHONIOENCODING <2>:                  環境変数.           (line  406)
* PYTHONIOENCODING <3>:                  Python UTF-8 Mode.  (line   29)
* PYTHONIOENCODING <4>:                  sys --- システム固有のパラメーターと関数.
                                                             (line 1997)
* PYTHONIOENCODING <5>:                  PyConfig.           (line  861)
* PYTHONLEGACYWINDOWSFSENCODING:         Pending removal in Python 3 16.
                                                             (line  102)
* PYTHONLEGACYWINDOWSFSENCODING <1>:     New Deprecations.   (line  131)
* PYTHONLEGACYWINDOWSFSENCODING <2>:     Pending removal in Python 3 16<3>.
                                                             (line  102)
* PYTHONLEGACYWINDOWSFSENCODING <3>:     Pending removal in Python 3 16<5>.
                                                             (line  102)
* PYTHONLEGACYWINDOWSFSENCODING <4>:     PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更.
                                                             (line   18)
* PYTHONLEGACYWINDOWSFSENCODING <5>:     Windows<19>.        (line   37)
* PYTHONLEGACYWINDOWSFSENCODING <6>:     sys --- システム固有のパラメーターと関数.
                                                             (line 1938)
* PYTHONLEGACYWINDOWSFSENCODING <7>:     sys --- システム固有のパラメーターと関数.
                                                             (line 1949)
* PYTHONLEGACYWINDOWSFSENCODING <8>:     sys --- システム固有のパラメーターと関数.
                                                             (line 1955)
* PYTHONLEGACYWINDOWSFSENCODING <9>:     グローバルな設定変数.
                                                             (line  153)
* PYTHONLEGACYWINDOWSFSENCODING <10>:    PyPreConfig.        (line  123)
* PYTHONLEGACYWINDOWSFSENCODING <11>:    Pending removal in Python 3 16<7>.
                                                             (line  102)
* PYTHONLEGACYWINDOWSSTDIO:              PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更.
                                                             (line   12)
* PYTHONLEGACYWINDOWSSTDIO <1>:          環境変数.           (line  190)
* PYTHONLEGACYWINDOWSSTDIO <2>:          sys --- システム固有のパラメーターと関数.
                                                             (line 2001)
* PYTHONLEGACYWINDOWSSTDIO <3>:          グローバルな設定変数.
                                                             (line  171)
* PYTHONLEGACYWINDOWSSTDIO <4>:          PyConfig.           (line  558)
* PYTHONMALLOC:                          PYTHONMALLOC 環境変数.
                                                             (line    6)
* PYTHONMALLOC <1>:                      C API の変更<13>.   (line    9)
* PYTHONMALLOC <2>:                      Core and Builtins<186>.
                                                             (line   90)
* PYTHONMALLOC <3>:                      環境変数.           (line  333)
* PYTHONMALLOC <4>:                      パフォーマンスに関するオプション.
                                                             (line  119)
* PYTHONMALLOC <5>:                      パフォーマンスに関するオプション.
                                                             (line  126)
* PYTHONMALLOC <6>:                      Python 開発モードの影響.
                                                             (line   46)
* PYTHONMALLOC <7>:                      Python 開発モードの影響.
                                                             (line   50)
* PYTHONMALLOC <8>:                      概要<4>.            (line   75)
* PYTHONMALLOC <9>:                      Default Memory Allocators.
                                                             (line   26)
* PYTHONMALLOC <10>:                     Debug hooks on the Python memory allocators.
                                                             (line   11)
* PYTHONMALLOC <11>:                     pymalloc アロケータ.
                                                             (line   27)
* PYTHONMALLOCSTATS:                     Core and Builtins<186>.
                                                             (line   96)
* PYTHONMALLOCSTATS <1>:                 PyConfig.           (line  574)
* PYTHONMALLOCSTATS <2>:                 概要<4>.            (line   78)
* PYTHONNODEBUGRANGES:                   PEP 657 トレースバックのエラー位置の詳細化.
                                                             (line   61)
* PYTHONNODEBUGRANGES <1>:               その他のオプション. (line  346)
* PYTHONNODEBUGRANGES <2>:               Methods on code objects.
                                                             (line   40)
* PYTHONNODEBUGRANGES <3>:               PyConfig.           (line  248)
* PYTHONNOUSERSITE:                      PEP 370 ユーザごとの site-packages ディレクトリ.
                                                             (line   30)
* PYTHONNOUSERSITE <1>:                  その他のオプション. (line  160)
* PYTHONNOUSERSITE <2>:                  モジュールの内容<5>.
                                                             (line   15)
* PYTHONNOUSERSITE <3>:                  グローバルな設定変数.
                                                             (line  205)
* PYTHONNOUSERSITE <4>:                  PyConfig.           (line  959)
* PYTHONOPTIMIZE:                        その他のオプション. (line   89)
* PYTHONOPTIMIZE <1>:                    グローバルな設定変数.
                                                             (line  216)
* PYTHONOPTIMIZE <2>:                    PyConfig.           (line  642)
* PYTHONPATH:                            'python' コマンドの挙動の変更<2>.
                                                             (line    7)
* PYTHONPATH <1>:                        'python' コマンドの挙動の変更<2>.
                                                             (line    9)
* PYTHONPATH <2>:                        モジュール検索パス. (line   16)
* PYTHONPATH <3>:                        標準モジュール.     (line   31)
* PYTHONPATH <4>:                        標準モジュール.     (line   32)
* PYTHONPATH <5>:                        その他のオプション. (line   46)
* PYTHONPATH <6>:                        環境変数.           (line   31)
* PYTHONPATH <7>:                        環境変数.           (line   38)
* PYTHONPATH <8>:                        環境変数.           (line   42)
* PYTHONPATH <9>:                        モジュールの検索.   (line   15)
* PYTHONPATH <10>:                       モジュールの検索.   (line   36)
* PYTHONPATH <11>:                       モジュールの検索.   (line   77)
* PYTHONPATH <12>:                       iOS プロジェクトに Python を追加する.
                                                             (line   94)
* PYTHONPATH <13>:                       iOS プロジェクトに Python を追加する.
                                                             (line  120)
* PYTHONPATH <14>:                       iOS プロジェクトに Python を追加する.
                                                             (line  124)
* PYTHONPATH <15>:                       パスエントリ・ファインダー.
                                                             (line    6)
* PYTHONPATH <16>:                       パスエントリ・ファインダー.
                                                             (line   22)
* PYTHONPATH <17>:                       test support script_helper --- Utilities for the Python execution tests.
                                                             (line   26)
* PYTHONPATH <18>:                       sys --- システム固有のパラメーターと関数.
                                                             (line 1429)
* PYTHONPATH <19>:                       sys --- システム固有のパラメーターと関数.
                                                             (line 1435)
* PYTHONPATH <20>:                       sys path モジュール検索パスの初期化.
                                                             (line   14)
* PYTHONPATH <21>:                       sys path モジュール検索パスの初期化.
                                                             (line   18)
* PYTHONPATH <22>:                       Python の埋め込み<2>.
                                                             (line   35)
* PYTHONPATH <23>:                       Python の埋め込み<2>.
                                                             (line   42)
* PYTHONPATH <24>:                       グローバルな設定変数.
                                                             (line   93)
* PYTHONPATH <25>:                       PyConfig.           (line  607)
* PYTHONPERFSUPPORT:                     その他の言語変更<2>.
                                                             (line   85)
* PYTHONPERFSUPPORT <1>:                 その他のオプション. (line  366)
* PYTHONPERFSUPPORT <2>:                 PyConfig.           (line  903)
* PYTHONPERFSUPPORT <3>:                 How to enable perf profiling support.
                                                             (line    7)
* PYTHONPLATLIBDIR:                      Core and Builtins<145>.
                                                             (line   47)
* PYTHONPLATLIBDIR <1>:                  sys path モジュール検索パスの初期化.
                                                             (line   51)
* PYTHONPLATLIBDIR <2>:                  PyConfig.           (line  586)
* PYTHONPROFILEIMPORTTIME:               その他の言語変更<7>.
                                                             (line   47)
* PYTHONPROFILEIMPORTTIME <1>:           Core and Builtins<168>.
                                                             (line   66)
* PYTHONPROFILEIMPORTTIME <2>:           その他のオプション. (line  307)
* PYTHONPROFILEIMPORTTIME <3>:           PyConfig.           (line  457)
* PYTHONPYCACHEPREFIX:                   コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム.
                                                             (line    8)
* PYTHONPYCACHEPREFIX <1>:               Core and Builtins<159>.
                                                             (line  402)
* PYTHONPYCACHEPREFIX <2>:               その他のオプション. (line  330)
* PYTHONPYCACHEPREFIX <3>:               sys --- システム固有のパラメーターと関数.
                                                             (line  379)
* PYTHONPYCACHEPREFIX <4>:               PyConfig.           (line  749)
* PYTHONREGRTEST_UNICODE_GUARD:          テスト<28>.         (line   13)
* PYTHONSAFEPATH:                        概要 -- リリースハイライト<4>.
                                                             (line   27)
* PYTHONSAFEPATH <1>:                    その他の言語変更<3>.
                                                             (line   37)
* PYTHONSAFEPATH <2>:                    セキュリティ<28>.   (line    6)
* PYTHONSAFEPATH <3>:                    その他のオプション. (line  117)
* PYTHONSAFEPATH <4>:                    sys --- システム固有のパラメーターと関数.
                                                             (line 1447)
* PYTHONSAFEPATH <5>:                    セキュリティで考慮すべき点<6>.
                                                             (line   47)
* PYTHONSAFEPATH <6>:                    PyConfig.           (line  165)
* PYTHONSTARTUP:                         Default interactive shell.
                                                             (line   15)
* PYTHONSTARTUP <1>:                     sys<12>.            (line   16)
* PYTHONSTARTUP <2>:                     sys<12>.            (line   21)
* PYTHONSTARTUP <3>:                     ライブラリ<2>.      (line  144)
* PYTHONSTARTUP <4>:                     Core and Builtins<11>.
                                                             (line   41)
* PYTHONSTARTUP <5>:                     IDLE<37>.           (line  176)
* PYTHONSTARTUP <6>:                     IDLE<41>.           (line    9)
* PYTHONSTARTUP <7>:                     IDLE<47>.           (line    9)
* PYTHONSTARTUP <8>:                     対話モード用の起動時実行ファイル.
                                                             (line    7)
* PYTHONSTARTUP <9>:                     その他のオプション. (line   65)
* PYTHONSTARTUP <10>:                    環境変数.           (line  116)
* PYTHONSTARTUP <11>:                    使用例<2>.          (line   10)
* PYTHONSTARTUP <12>:                    asyncio --- 非同期 I/O.
                                                             (line   88)
* PYTHONSTARTUP <13>:                    Startup and Code Execution.
                                                             (line    6)
* PYTHONSTARTUP <14>:                    コマンドラインでの使用<5>.
                                                             (line   42)
* PYTHONSTARTUP <15>:                    sys --- システム固有のパラメーターと関数.
                                                             (line 1206)
* PYTHONSTARTUP <16>:                    readline の設定.    (line   12)
* PYTHONTRACEMALLOC:                     その他のオプション. (line  286)
* PYTHONTRACEMALLOC <1>:                 tracemalloc --- メモリ割り当ての追跡.
                                                             (line   23)
* PYTHONTRACEMALLOC <2>:                 tracemalloc --- メモリ割り当ての追跡.
                                                             (line   30)
* PYTHONTRACEMALLOC <3>:                 関数<11>.           (line   90)
* PYTHONTRACEMALLOC <4>:                 PyConfig.           (line  889)
* PYTHONTZPATH:                          例外と警告.         (line   14)
* PYTHONUNBUFFERED:                      Core and Builtins<152>.
                                                             (line  107)
* PYTHONUNBUFFERED <1>:                  その他のオプション. (line  180)
* PYTHONUNBUFFERED <2>:                  sys --- システム固有のパラメーターと関数.
                                                             (line 2008)
* PYTHONUNBUFFERED <3>:                  グローバルな設定変数.
                                                             (line  244)
* PYTHONUNBUFFERED <4>:                  PyConfig.           (line  212)
* PYTHONUOPS:                            Core and Builtins<59>.
                                                             (line   27)
* PYTHONUOPS <1>:                        Core and Builtins<59>.
                                                             (line  179)
* PYTHONUOPS <2>:                        Core and Builtins<59>.
                                                             (line  258)
* PYTHONUOPS <3>:                        Core and Builtins<59>.
                                                             (line  317)
* PYTHONUOPS <4>:                        Core and Builtins<59>.
                                                             (line  382)
* PYTHONUSERBASE:                        PEP 370 ユーザごとの site-packages ディレクトリ.
                                                             (line   23)
* PYTHONUSERBASE <1>:                    モジュールの内容<5>.
                                                             (line   41)
* PYTHONUSERBASE <2>:                    モジュールの内容<5>.
                                                             (line   67)
* PYTHONUSERSITE:                        test support script_helper --- Utilities for the Python execution tests.
                                                             (line   26)
* PYTHONUTF8:                            PEP 540 強制 UTF-8 実行モード.
                                                             (line    6)
* PYTHONUTF8 <1>:                        その他のオプション. (line  324)
* PYTHONUTF8 <2>:                        環境変数.           (line  416)
* PYTHONUTF8 <3>:                        UTF-8 モード.       (line   18)
* PYTHONUTF8 <4>:                        Python UTF-8 Mode.  (line   52)
* PYTHONUTF8 <5>:                        Python UTF-8 Mode.  (line   54)
* PYTHONUTF8 <6>:                        sys --- システム固有のパラメーターと関数.
                                                             (line 1999)
* PYTHONUTF8 <7>:                        PyPreConfig.        (line  152)
* PYTHONUTF8 <8>:                        Python Configuration.
                                                             (line   14)
* PYTHONVERBOSE:                         その他のオプション. (line  196)
* PYTHONVERBOSE <1>:                     グローバルな設定変数.
                                                             (line  261)
* PYTHONVERBOSE <2>:                     PyConfig.           (line  976)
* PYTHONWARNDEFAULTENCODING:             Optional EncodingWarning and encoding="locale" option.
                                                             (line   19)
* PYTHONWARNDEFAULTENCODING <1>:         ライブラリ<121>.    (line   45)
* PYTHONWARNDEFAULTENCODING <2>:         その他のオプション. (line  336)
* PYTHONWARNDEFAULTENCODING <3>:         Opt-in EncodingWarning.
                                                             (line    9)
* PYTHONWARNINGS:                        warnings<3>.        (line   21)
* PYTHONWARNINGS <1>:                    その他の言語変更<12>.
                                                             (line  158)
* PYTHONWARNINGS <2>:                    Deprecation Warnings の扱いの変更.
                                                             (line   24)
* PYTHONWARNINGS <3>:                    インタプリタの変更. (line    6)
* PYTHONWARNINGS <4>:                    ドキュメント<28>.   (line   67)
* PYTHONWARNINGS <5>:                    その他のオプション. (line  250)
* PYTHONWARNINGS <6>:                    Python 開発モードの影響.
                                                             (line   30)
* PYTHONWARNINGS <7>:                    警告フィルタ.       (line   49)
* PYTHONWARNINGS <8>:                    警告フィルタ.       (line   59)
* PYTHONWARNINGS <9>:                    Describing Warning Filters.
                                                             (line    7)
* PYTHONWARNINGS <10>:                   Describing Warning Filters.
                                                             (line   21)
* PYTHONWARNINGS <11>:                   デフォルトの警告フィルタ.
                                                             (line    7)
* PYTHONWARNINGS <12>:                   PyConfig.           (line  995)
* PyThread_acquire_lock (C function):    Legacy Locking APIs.
                                                             (line   76)
* PyThread_acquire_lock_timed (C function): Legacy Locking APIs.
                                                             (line   53)
* PyThread_allocate_lock (C function):   Legacy Locking APIs.
                                                             (line   32)
* PyThread_create_key (C function):      スレッドローカルストレージ TLS API.
                                                             (line   18)
* PyThread_delete_key (C function):      スレッドローカルストレージ TLS API.
                                                             (line   21)
* PyThread_delete_key_value (C function): スレッドローカルストレージ TLS API.
                                                             (line   30)
* PyThread_exit_thread (C function):     Operating System Thread APIs.
                                                             (line   71)
* PyThread_free_lock (C function):       Legacy Locking APIs.
                                                             (line   46)
* PyThread_get_key_value (C function):   スレッドローカルストレージ TLS API.
                                                             (line   27)
* PyThread_get_stacksize (C function):   Operating System Thread APIs.
                                                             (line  110)
* PyThread_get_thread_ident (C function): Operating System Thread APIs.
                                                             (line   26)
* PyThread_get_thread_native_id (C function): Operating System Thread APIs.
                                                             (line   54)
* PyThread_GetInfo (C function):         Operating System Thread APIs.
                                                             (line   38)
* PyThread_init_thread (C function):     Operating System Thread APIs.
                                                             (line   94)
* PYTHREAD_INVALID_THREAD_ID (C macro):  Operating System Thread APIs.
                                                             (line    6)
* PyThread_ReInitTLS (C function):       スレッドローカルストレージ TLS API.
                                                             (line   33)
* PyThread_release_lock (C function):    Legacy Locking APIs.
                                                             (line   95)
* PyThread_set_key_value (C function):   スレッドローカルストレージ TLS API.
                                                             (line   24)
* PyThread_set_stacksize (C function):   Operating System Thread APIs.
                                                             (line   99)
* PyThread_start_new_thread (C function): Operating System Thread APIs.
                                                             (line   12)
* PyThread_tss_alloc (C function):       動的メモリ確保.     (line   10)
* PyThread_tss_create (C function):      メソッド<2>.        (line   16)
* PyThread_tss_delete (C function):      メソッド<2>.        (line   24)
* PyThread_tss_free (C function):        動的メモリ確保.     (line   16)
* PyThread_tss_get (C function):         メソッド<2>.        (line   39)
* PyThread_tss_is_created (C function):  メソッド<2>.        (line   11)
* PyThread_tss_set (C function):         メソッド<2>.        (line   33)
* PyThread_type_lock (C type):           Legacy Locking APIs.
                                                             (line   12)
* PyThreadState (C type):                スレッド状態 thread state とグローバルインタプリタロック global interpreter lock.
                                                             (line   24)
* PyThreadState (C type) <1>:            高レベルAPI.        (line   25)
* PyThreadState_Clear (C function):      低レベルAPI.        (line   43)
* PyThreadState_Delete (C function):     低レベルAPI.        (line   55)
* PyThreadState_DeleteCurrent (C function): 低レベルAPI.     (line   61)
* PyThreadState_EnterTracing (C function): 低レベルAPI.      (line  102)
* PyThreadState_Get (C function):        高レベルAPI.        (line   72)
* PyThreadState_GetDict (C function):    低レベルAPI.        (line  250)
* PyThreadState_GetFrame (C function):   低レベルAPI.        (line   70)
* PyThreadState_GetID (C function):      低レベルAPI.        (line   84)
* PyThreadState_GetInterpreter (C function): 低レベルAPI.    (line   93)
* PyThreadState_GetUnchecked (C function): 高レベルAPI.      (line   81)
* PyThreadState_LeaveTracing (C function): 低レベルAPI.      (line  111)
* PyThreadState_New (C function):        低レベルAPI.        (line   37)
* PyThreadState_Next (C function):       高度なデバッガサポート advanced debugger support.
                                                             (line   29)
* PyThreadState_SetAsyncExc (C function): 低レベルAPI.       (line  259)
* PyThreadState_Swap (C function):       高レベルAPI.        (line   90)
* PyThreadState.interp (C member):       高レベルAPI.        (line   30)
* PyTime_AsSecondsDouble (C function):   Conversion functions.
                                                             (line    6)
* PyTime_Check (C function):             DateTime オブジェクト<2>.
                                                             (line  127)
* PyTime_CheckExact (C function):        DateTime オブジェクト<2>.
                                                             (line  133)
* PyTime_FromTime (C function):          DateTime オブジェクト<2>.
                                                             (line  183)
* PyTime_FromTimeAndFold (C function):   DateTime オブジェクト<2>.
                                                             (line  188)
* PyTime_MAX (C var):                    型<3>.              (line   24)
* PyTime_MIN (C var):                    型<3>.              (line   20)
* PyTime_Monotonic (C function):         Clock Functions.    (line   21)
* PyTime_MonotonicRaw (C function):      Raw Clock Functions.
                                                             (line   16)
* PyTime_PerfCounter (C function):       Clock Functions.    (line   26)
* PyTime_PerfCounterRaw (C function):    Raw Clock Functions.
                                                             (line   22)
* PyTime_t (C type):                     型<3>.              (line    6)
* PyTime_Time (C function):              Clock Functions.    (line   31)
* PyTime_TimeRaw (C function):           Raw Clock Functions.
                                                             (line   28)
* PyTimeZone_FromOffset (C function):    DateTime オブジェクト<2>.
                                                             (line  202)
* PyTimeZone_FromOffsetAndName (C function): DateTime オブジェクト<2>.
                                                             (line  210)
* PyTrace_C_CALL (C var):                プロファイルとトレース profiling and tracing.
                                                             (line   95)
* PyTrace_C_EXCEPTION (C var):           プロファイルとトレース profiling and tracing.
                                                             (line  100)
* PyTrace_C_RETURN (C var):              プロファイルとトレース profiling and tracing.
                                                             (line  105)
* PyTrace_CALL (C var):                  プロファイルとトレース profiling and tracing.
                                                             (line   63)
* PyTrace_EXCEPTION (C var):             プロファイルとトレース profiling and tracing.
                                                             (line   71)
* PyTrace_LINE (C var):                  プロファイルとトレース profiling and tracing.
                                                             (line   83)
* PyTrace_OPCODE (C var):                プロファイルとトレース profiling and tracing.
                                                             (line  110)
* PyTrace_RETURN (C var):                プロファイルとトレース profiling and tracing.
                                                             (line   90)
* PyTraceBack_Check (C function):        Tracebacks.         (line   11)
* PyTraceBack_Here (C function):         Tracebacks.         (line   16)
* PyTraceBack_Print (C function):        Tracebacks.         (line   27)
* PyTraceBack_Type (C var):              Tracebacks.         (line    6)
* PyTraceMalloc_Track (C function):      tracemalloc C API.  (line    8)
* PyTraceMalloc_Untrack (C function):    tracemalloc C API.  (line   20)
* PyTuple_Check (C function):            タプルオブジェクト tuple object.
                                                             (line   16)
* PyTuple_CheckExact (C function):       タプルオブジェクト tuple object.
                                                             (line   21)
* PyTuple_GET_ITEM (C function):         タプルオブジェクト tuple object.
                                                             (line   60)
* PyTuple_GET_SIZE (C function):         タプルオブジェクト tuple object.
                                                             (line   43)
* PyTuple_GetItem (C function):          タプルオブジェクト tuple object.
                                                             (line   47)
* PyTuple_GetSlice (C function):         タプルオブジェクト tuple object.
                                                             (line   65)
* PyTuple_New (C function):              タプルオブジェクト tuple object.
                                                             (line   26)
* PyTuple_Pack (C function):             タプルオブジェクト tuple object.
                                                             (line   31)
* PyTuple_SET_ITEM (C function):         タプルオブジェクト tuple object.
                                                             (line   85)
* PyTuple_SetItem (C function):          参照カウントの詳細. (line   26)
* PyTuple_SetItem (C function) <1>:      タプルオブジェクト tuple object.
                                                             (line   74)
* PyTuple_Size (C function):             タプルオブジェクト tuple object.
                                                             (line   38)
* PyTuple_Type (C var):                  タプルオブジェクト tuple object.
                                                             (line   11)
* PyTupleIter_Type (C var):              Other Iterator Objects.
                                                             (line   21)
* PyTupleObject (C type):                タプルオブジェクト tuple object.
                                                             (line    6)
* PyType_AddWatcher (C function):        型オブジェクト<2>.  (line   66)
* PyType_Check (C function):             型オブジェクト<2>.  (line   15)
* PyType_CheckExact (C function):        型オブジェクト<2>.  (line   21)
* PyType_ClearCache (C function):        型オブジェクト<2>.  (line   27)
* PyType_ClearWatcher (C function):      型オブジェクト<2>.  (line   79)
* PyType_FastSubclass (C function):      型オブジェクト<2>.  (line  137)
* PyType_Freeze (C function):            Creating Heap-Allocated Types.
                                                             (line  112)
* PyType_FromMetaclass (C function):     Creating Heap-Allocated Types.
                                                             (line    9)
* PyType_FromModuleAndSpec (C function): Creating Heap-Allocated Types.
                                                             (line   56)
* PyType_FromSpec (C function):          Creating Heap-Allocated Types.
                                                             (line   97)
* PyType_FromSpecWithBases (C function): Creating Heap-Allocated Types.
                                                             (line   78)
* PyType_GenericAlloc (C function):      型オブジェクト<2>.  (line  165)
* PyType_GenericNew (C function):        型オブジェクト<2>.  (line  187)
* PyType_GetBaseByToken (C function):    型オブジェクト<2>.  (line  314)
* PyType_GetDict (C function):           型オブジェクト<2>.  (line   43)
* PyType_GetFlags (C function):          型オブジェクト<2>.  (line   31)
* PyType_GetFullyQualifiedName (C function): 型オブジェクト<2>.
                                                             (line  225)
* PyType_GetModule (C function):         型オブジェクト<2>.  (line  258)
* PyType_GetModuleByDef (C function):    型オブジェクト<2>.  (line  292)
* PyType_GetModuleName (C function):     型オブジェクト<2>.  (line  235)
* PyType_GetModuleState (C function):    型オブジェクト<2>.  (line  278)
* PyType_GetName (C function):           型オブジェクト<2>.  (line  210)
* PyType_GetQualName (C function):       型オブジェクト<2>.  (line  217)
* PyType_GetSlot (C function):           型オブジェクト<2>.  (line  243)
* PyType_GetTypeDataSize (C function):   オブジェクトプロトコル object protocol.
                                                             (line  542)
* PyType_HasFeature (C function):        型オブジェクト<2>.  (line  132)
* PyType_IS_GC (C function):             型オブジェクト<2>.  (line  151)
* PyType_IsSubtype (C function):         型オブジェクト<2>.  (line  156)
* PyType_Modified (C function):          型オブジェクト<2>.  (line   60)
* PyType_Ready (C function):             型オブジェクト<2>.  (line  194)
* PyType_Slot (C type):                  Creating Heap-Allocated Types.
                                                             (line  195)
* PyType_Slot.pfunc (C member):          Creating Heap-Allocated Types.
                                                             (line  264)
* PyType_Slot.slot (C member):           Creating Heap-Allocated Types.
                                                             (line  200)
* PyType_Spec (C type):                  Creating Heap-Allocated Types.
                                                             (line  128)
* PyType_Spec.basicsize (C member):      Creating Heap-Allocated Types.
                                                             (line  137)
* PyType_Spec.flags (C member):          Creating Heap-Allocated Types.
                                                             (line  181)
* PyType_Spec.itemsize (C member):       Creating Heap-Allocated Types.
                                                             (line  155)
* PyType_Spec.name (C member):           Creating Heap-Allocated Types.
                                                             (line  132)
* PyType_Spec.slots (C member):          Creating Heap-Allocated Types.
                                                             (line  188)
* PyType_SUPPORTS_WEAKREFS (C function): 型オブジェクト<2>.  (line  346)
* PyType_Type (C var):                   型オブジェクト<2>.  (line   10)
* PyType_Unwatch (C function):           型オブジェクト<2>.  (line  107)
* PyType_Watch (C function):             型オブジェクト<2>.  (line   91)
* PyType_WatchCallback (C type):         型オブジェクト<2>.  (line  121)
* PyTypeObject (C type):                 型オブジェクト<2>.  (line    6)
* PyTypeObject.tp_alloc (C member):      PyTypeObject スロット.
                                                             (line 1656)
* PyTypeObject.tp_as_async (C member):   PyTypeObject スロット.
                                                             (line  367)
* PyTypeObject.tp_as_buffer (C member):  PyTypeObject スロット.
                                                             (line  605)
* PyTypeObject.tp_as_mapping (C member): PyTypeObject スロット.
                                                             (line  438)
* PyTypeObject.tp_as_number (C member):  PyTypeObject スロット.
                                                             (line  414)
* PyTypeObject.tp_as_sequence (C member): PyTypeObject スロット.
                                                             (line  426)
* PyTypeObject.tp_base (C member):       PyTypeObject スロット.
                                                             (line 1464)
* PyTypeObject.tp_bases (C member):      PyTypeObject スロット.
                                                             (line 1790)
* PyTypeObject.tp_basicsize (C member):  PyTypeObject スロット.
                                                             (line   48)
* PyTypeObject.tp_cache (C member):      PyTypeObject スロット.
                                                             (line 1828)
* PyTypeObject.tp_call (C member):       PyTypeObject スロット.
                                                             (line  495)
* PyTypeObject.tp_clear (C member):      PyTypeObject スロット.
                                                             (line 1089)
* PyTypeObject.tp_dealloc (C member):    PyTypeObject スロット.
                                                             (line  135)
* PyTypeObject.tp_del (C member):        PyTypeObject スロット.
                                                             (line 1868)
* PyTypeObject.tp_descr_get (C member):  PyTypeObject スロット.
                                                             (line 1537)
* PyTypeObject.tp_descr_set (C member):  PyTypeObject スロット.
                                                             (line 1553)
* PyTypeObject.tp_dict (C member):       PyTypeObject スロット.
                                                             (line 1500)
* PyTypeObject.tp_dictoffset (C member): PyTypeObject スロット.
                                                             (line 1572)
* PyTypeObject.tp_doc (C member):        PyTypeObject スロット.
                                                             (line  972)
* PyTypeObject.tp_finalize (C member):   PyTypeObject スロット.
                                                             (line 1886)
* PyTypeObject.tp_flags (C member):      PyTypeObject スロット.
                                                             (line  618)
* PyTypeObject.tp_free (C member):       PyTypeObject スロット.
                                                             (line 1723)
* PyTypeObject.tp_getattr (C member):    PyTypeObject スロット.
                                                             (line  321)
* PyTypeObject.tp_getattro (C member):   PyTypeObject スロット.
                                                             (line  542)
* PyTypeObject.tp_getset (C member):     PyTypeObject スロット.
                                                             (line 1446)
* PyTypeObject.tp_hash (C member):       PyTypeObject スロット.
                                                             (line  450)
* PyTypeObject.tp_init (C member):       PyTypeObject スロット.
                                                             (line 1616)
* PyTypeObject.tp_is_gc (C member):      PyTypeObject スロット.
                                                             (line 1756)
* PyTypeObject.tp_itemsize (C member):   PyTypeObject スロット.
                                                             (line   48)
* PyTypeObject.tp_iter (C member):       PyTypeObject スロット.
                                                             (line 1363)
* PyTypeObject.tp_iternext (C member):   PyTypeObject スロット.
                                                             (line 1383)
* PyTypeObject.tp_members (C member):    PyTypeObject スロット.
                                                             (line 1428)
* PyTypeObject.tp_methods (C member):    PyTypeObject スロット.
                                                             (line 1410)
* PyTypeObject.tp_mro (C member):        PyTypeObject スロット.
                                                             (line 1814)
* PyTypeObject.tp_name (C member):       PyTypeObject スロット.
                                                             (line   12)
* PyTypeObject.tp_new (C member):        PyTypeObject スロット.
                                                             (line 1682)
* PyTypeObject.tp_repr (C member):       PyTypeObject スロット.
                                                             (line  384)
* PyTypeObject.tp_richcompare (C member): PyTypeObject スロット.
                                                             (line 1248)
* PyTypeObject.tp_setattr (C member):    PyTypeObject スロット.
                                                             (line  344)
* PyTypeObject.tp_setattro (C member):   PyTypeObject スロット.
                                                             (line  573)
* PyTypeObject.tp_str (C member):        PyTypeObject スロット.
                                                             (line  512)
* PyTypeObject.tp_subclasses (C member): PyTypeObject スロット.
                                                             (line 1837)
* PyTypeObject.tp_traverse (C member):   PyTypeObject スロット.
                                                             (line  985)
* PyTypeObject.tp_vectorcall (C member): PyTypeObject スロット.
                                                             (line 2056)
* PyTypeObject.tp_vectorcall_offset (C member): PyTypeObject スロット.
                                                             (line  281)
* PyTypeObject.tp_version_tag (C member): PyTypeObject スロット.
                                                             (line 1877)
* PyTypeObject.tp_watched (C member):    PyTypeObject スロット.
                                                             (line 2099)
* PyTypeObject.tp_weaklist (C member):   PyTypeObject スロット.
                                                             (line 1853)
* PyTypeObject.tp_weaklistoffset (C member): PyTypeObject スロット.
                                                             (line 1327)
* PyTZInfo_Check (C function):           DateTime オブジェクト<2>.
                                                             (line  150)
* PyTZInfo_CheckExact (C function):      DateTime オブジェクト<2>.
                                                             (line  157)
* PyUnicode_1BYTE_DATA (C function):     Unicode 型.         (line   80)
* PyUnicode_1BYTE_KIND (C macro):        Unicode 型.         (line   94)
* PyUnicode_2BYTE_DATA (C function):     Unicode 型.         (line   80)
* PyUnicode_2BYTE_KIND (C macro):        Unicode 型.         (line   94)
* PyUnicode_4BYTE_DATA (C function):     Unicode 型.         (line   80)
* PyUnicode_4BYTE_KIND (C macro):        Unicode 型.         (line   94)
* PyUnicode_Append (C function):         Unicode 文字列の生成とアクセス.
                                                             (line  313)
* PyUnicode_AppendAndDel (C function):   Unicode 文字列の生成とアクセス.
                                                             (line  323)
* PyUnicode_AsASCIIString (C function):  ASCII Codecs.       (line   16)
* PyUnicode_AsCharmapString (C function): Character Map Codecs.
                                                             (line   31)
* PyUnicode_AsEncodedString (C function): 汎用 codec.        (line   26)
* PyUnicode_AsLatin1String (C function): Latin-1 Codecs.     (line   16)
* PyUnicode_AsMBCSString (C function):   Windows 用の MBCS codec.
                                                             (line   38)
* PyUnicode_AsRawUnicodeEscapeString (C function): Raw-Unicode-Escape Codecs.
                                                             (line   15)
* PyUnicode_AsUCS4 (C function):         Unicode 文字列の生成とアクセス.
                                                             (line  444)
* PyUnicode_AsUCS4Copy (C function):     Unicode 文字列の生成とアクセス.
                                                             (line  455)
* PyUnicode_AsUnicodeEscapeString (C function): Unicode-Escape Codecs.
                                                             (line   15)
* PyUnicode_AsUTF16String (C function):  UTF-16 Codecs.      (line   48)
* PyUnicode_AsUTF32String (C function):  UTF-32 Codecs.      (line   46)
* PyUnicode_AsUTF8 (C function):         UTF-8 Codecs.       (line   64)
* PyUnicode_AsUTF8AndSize (C function):  UTF-8 Codecs.       (line   34)
* PyUnicode_AsUTF8String (C function):   UTF-8 Codecs.       (line   24)
* PyUnicode_AsWideChar (C function):     wchar_t サポート.   (line   16)
* PyUnicode_AsWideCharString (C function): wchar_t サポート. (line   34)
* PyUnicode_BuildEncodingMap (C function): Unicode 文字列の生成とアクセス.
                                                             (line  329)
* PyUnicode_Check (C function):          Unicode 型.         (line   61)
* PyUnicode_CHECK_INTERNED (C function): メソッドおよびスロット関数 slot function.
                                                             (line  278)
* PyUnicode_CheckExact (C function):     Unicode 型.         (line   66)
* PyUnicode_Compare (C function):        メソッドおよびスロット関数 slot function.
                                                             (line  133)
* PyUnicode_CompareWithASCIIString (C function): メソッドおよびスロット関数 slot function.
                                                             (line  192)
* PyUnicode_Concat (C function):         メソッドおよびスロット関数 slot function.
                                                             (line   13)
* PyUnicode_Contains (C function):       メソッドおよびスロット関数 slot function.
                                                             (line  226)
* PyUnicode_CopyCharacters (C function): Unicode 文字列の生成とアクセス.
                                                             (line  358)
* PyUnicode_Count (C function):          メソッドおよびスロット関数 slot function.
                                                             (line  119)
* PyUnicode_DATA (C function):           Unicode 型.         (line  113)
* PyUnicode_Decode (C function):         汎用 codec.         (line   17)
* PyUnicode_DecodeASCII (C function):    ASCII Codecs.       (line    9)
* PyUnicode_DecodeCharmap (C function):  Character Map Codecs.
                                                             (line   15)
* PyUnicode_DecodeCodePageStateful (C function): Windows 用の MBCS codec.
                                                             (line   30)
* PyUnicode_DecodeFSDefault (C function): ファイルシステムエンコーディング.
                                                             (line   79)
* PyUnicode_DecodeFSDefaultAndSize (C function): ファイルシステムエンコーディング.
                                                             (line   62)
* PyUnicode_DecodeLatin1 (C function):   Latin-1 Codecs.     (line    9)
* PyUnicode_DecodeLocale (C function):   ロケールエンコーディング.
                                                             (line   37)
* PyUnicode_DecodeLocaleAndSize (C function): ロケールエンコーディング.
                                                             (line    9)
* PyUnicode_DecodeMBCS (C function):     Windows 用の MBCS codec.
                                                             (line   13)
* PyUnicode_DecodeMBCSStateful (C function): Windows 用の MBCS codec.
                                                             (line   20)
* PyUnicode_DecodeRawUnicodeEscape (C function): Raw-Unicode-Escape Codecs.
                                                             (line    8)
* PyUnicode_DecodeUnicodeEscape (C function): Unicode-Escape Codecs.
                                                             (line    8)
* PyUnicode_DecodeUTF16 (C function):    UTF-16 Codecs.      (line    8)
* PyUnicode_DecodeUTF16Stateful (C function): UTF-16 Codecs. (line   37)
* PyUnicode_DecodeUTF32 (C function):    UTF-32 Codecs.      (line    8)
* PyUnicode_DecodeUTF32Stateful (C function): UTF-32 Codecs. (line   35)
* PyUnicode_DecodeUTF7 (C function):     UTF-7 Codecs.       (line    8)
* PyUnicode_DecodeUTF7Stateful (C function): UTF-7 Codecs.   (line   15)
* PyUnicode_DecodeUTF8 (C function):     UTF-8 Codecs.       (line    8)
* PyUnicode_DecodeUTF8Stateful (C function): UTF-8 Codecs.   (line   15)
* PyUnicode_EncodeCodePage (C function): Windows 用の MBCS codec.
                                                             (line   46)
* PyUnicode_EncodeFSDefault (C function): ファイルシステムエンコーディング.
                                                             (line   91)
* PyUnicode_EncodeLocale (C function):   ロケールエンコーディング.
                                                             (line   46)
* PyUnicode_Equal (C function):          メソッドおよびスロット関数 slot function.
                                                             (line  146)
* PyUnicode_EqualToUTF8 (C function):    メソッドおよびスロット関数 slot function.
                                                             (line  183)
* PyUnicode_EqualToUTF8AndSize (C function): メソッドおよびスロット関数 slot function.
                                                             (line  170)
* PyUnicode_Fill (C function):           Unicode 文字列の生成とアクセス.
                                                             (line  388)
* PyUnicode_Find (C function):           メソッドおよびスロット関数 slot function.
                                                             (line   92)
* PyUnicode_FindChar (C function):       メソッドおよびスロット関数 slot function.
                                                             (line  103)
* PyUnicode_Format (C function):         メソッドおよびスロット関数 slot function.
                                                             (line  220)
* PyUnicode_FromEncodedObject (C function): Unicode 文字列の生成とアクセス.
                                                             (line  294)
* PyUnicode_FromFormat (C function):     Unicode 文字列の生成とアクセス.
                                                             (line   82)
* PyUnicode_FromFormatV (C function):    Unicode 文字列の生成とアクセス.
                                                             (line  271)
* PyUnicode_FromKindAndData (C function): Unicode 文字列の生成とアクセス.
                                                             (line   43)
* PyUnicode_FromObject (C function):     Unicode 文字列の生成とアクセス.
                                                             (line  277)
* PyUnicode_FromOrdinal (C function):    Unicode 文字列の生成とアクセス.
                                                             (line  286)
* PyUnicode_FromString (C function):     Unicode 文字列の生成とアクセス.
                                                             (line   76)
* PyUnicode_FromStringAndSize (C function): Unicode 文字列の生成とアクセス.
                                                             (line   59)
* PyUnicode_FromWideChar (C function):   wchar_t サポート.   (line    8)
* PyUnicode_FSConverter (C function):    ファイルシステムエンコーディング.
                                                             (line   13)
* PyUnicode_FSDecoder (C function):      ファイルシステムエンコーディング.
                                                             (line   39)
* PyUnicode_GET_LENGTH (C function):     Unicode 型.         (line   71)
* PyUnicode_GetDefaultEncoding (C function): Unicode 文字列の生成とアクセス.
                                                             (line  341)
* PyUnicode_GetLength (C function):      Unicode 文字列の生成とアクセス.
                                                             (line  349)
* PyUnicode_InternFromString (C function): メソッドおよびスロット関数 slot function.
                                                             (line  260)
* PyUnicode_InternInPlace (C function):  メソッドおよびスロット関数 slot function.
                                                             (line  234)
* PyUnicode_IS_ASCII (C function):       Unicode 型.         (line  175)
* PyUnicode_IS_COMPACT (C macro):        Unicode 型.         (line   45)
* PyUnicode_IS_COMPACT_ASCII (C macro):  Unicode 型.         (line   52)
* PyUnicode_IS_READY (C function):       Deprecated API<2>.  (line   31)
* PyUnicode_IsIdentifier (C function):   Unicode 型.         (line  167)
* PyUnicode_Join (C function):           メソッドおよびスロット関数 slot function.
                                                             (line   78)
* PyUnicode_KIND (C function):           Unicode 型.         (line  104)
* PyUnicode_MAX_CHAR_VALUE (C function): Unicode 型.         (line  157)
* PyUnicode_New (C function):            Unicode 文字列の生成とアクセス.
                                                             (line    9)
* PyUnicode_Partition (C function):      メソッドおよびスロット関数 slot function.
                                                             (line   49)
* PyUnicode_READ (C function):           Unicode 型.         (line  138)
* PyUnicode_READ_CHAR (C function):      Unicode 型.         (line  147)
* PyUnicode_ReadChar (C function):       Unicode 文字列の生成とアクセス.
                                                             (line  422)
* PyUnicode_READY (C function):          Deprecated API<2>.  (line   20)
* PyUnicode_Replace (C function):        メソッドおよびスロット関数 slot function.
                                                             (line  125)
* PyUnicode_Resize (C function):         Unicode 文字列の生成とアクセス.
                                                             (line  372)
* PyUnicode_RichCompare (C function):    メソッドおよびスロット関数 slot function.
                                                             (line  203)
* PyUnicode_RPartition (C function):     メソッドおよびスロット関数 slot function.
                                                             (line   64)
* PyUnicode_RSplit (C function):         メソッドおよびスロット関数 slot function.
                                                             (line   31)
* PyUnicode_Split (C function):          メソッドおよびスロット関数 slot function.
                                                             (line   18)
* PyUnicode_Splitlines (C function):     メソッドおよびスロット関数 slot function.
                                                             (line   41)
* PyUnicode_Substring (C function):      Unicode 文字列の生成とアクセス.
                                                             (line  434)
* PyUnicode_Tailmatch (C function):      メソッドおよびスロット関数 slot function.
                                                             (line   84)
* PyUnicode_Translate (C function):      Character Map Codecs.
                                                             (line   47)
* PyUnicode_Type (C var):                Unicode 型.         (line    9)
* PyUnicode_WRITE (C function):          Unicode 型.         (line  121)
* PyUnicode_WriteChar (C function):      Unicode 文字列の生成とアクセス.
                                                             (line  405)
* PyUnicodeDecodeError_Create (C function): Unicode 例外オブジェクト.
                                                             (line    9)
* PyUnicodeDecodeError_GetEncoding (C function): Unicode 例外オブジェクト.
                                                             (line   17)
* PyUnicodeDecodeError_GetEnd (C function): Unicode 例外オブジェクト.
                                                             (line   67)
* PyUnicodeDecodeError_GetObject (C function): Unicode 例外オブジェクト.
                                                             (line   24)
* PyUnicodeDecodeError_GetReason (C function): Unicode 例外オブジェクト.
                                                             (line   96)
* PyUnicodeDecodeError_GetStart (C function): Unicode 例外オブジェクト.
                                                             (line   33)
* PyUnicodeDecodeError_SetEnd (C function): Unicode 例外オブジェクト.
                                                             (line   81)
* PyUnicodeDecodeError_SetReason (C function): Unicode 例外オブジェクト.
                                                             (line  105)
* PyUnicodeDecodeError_SetStart (C function): Unicode 例外オブジェクト.
                                                             (line   53)
* PyUnicodeEncodeError_GetEncoding (C function): Unicode 例外オブジェクト.
                                                             (line   17)
* PyUnicodeEncodeError_GetEnd (C function): Unicode 例外オブジェクト.
                                                             (line   67)
* PyUnicodeEncodeError_GetObject (C function): Unicode 例外オブジェクト.
                                                             (line   24)
* PyUnicodeEncodeError_GetReason (C function): Unicode 例外オブジェクト.
                                                             (line   96)
* PyUnicodeEncodeError_GetStart (C function): Unicode 例外オブジェクト.
                                                             (line   33)
* PyUnicodeEncodeError_SetEnd (C function): Unicode 例外オブジェクト.
                                                             (line   81)
* PyUnicodeEncodeError_SetReason (C function): Unicode 例外オブジェクト.
                                                             (line  105)
* PyUnicodeEncodeError_SetStart (C function): Unicode 例外オブジェクト.
                                                             (line   53)
* PyUnicodeIter_Type (C var):            Unicode 型.         (line   14)
* PyUnicodeObject (C type):              Unicode 型.         (line   29)
* PyUnicodeTranslateError_GetEnd (C function): Unicode 例外オブジェクト.
                                                             (line   67)
* PyUnicodeTranslateError_GetObject (C function): Unicode 例外オブジェクト.
                                                             (line   24)
* PyUnicodeTranslateError_GetReason (C function): Unicode 例外オブジェクト.
                                                             (line   96)
* PyUnicodeTranslateError_GetStart (C function): Unicode 例外オブジェクト.
                                                             (line   33)
* PyUnicodeTranslateError_SetEnd (C function): Unicode 例外オブジェクト.
                                                             (line   81)
* PyUnicodeTranslateError_SetReason (C function): Unicode 例外オブジェクト.
                                                             (line  105)
* PyUnicodeTranslateError_SetStart (C function): Unicode 例外オブジェクト.
                                                             (line   53)
* PyUnicodeWriter (C type):              PyUnicodeWriter.    (line   11)
* PyUnicodeWriter_Create (C function):   PyUnicodeWriter.    (line   18)
* PyUnicodeWriter_DecodeUTF8Stateful (C function): PyUnicodeWriter.
                                                             (line  147)
* PyUnicodeWriter_Discard (C function):  PyUnicodeWriter.    (line   40)
* PyUnicodeWriter_Finish (C function):   PyUnicodeWriter.    (line   30)
* PyUnicodeWriter_Format (C function):   PyUnicodeWriter.    (line  138)
* PyUnicodeWriter_WriteASCII (C function): PyUnicodeWriter.  (line   71)
* PyUnicodeWriter_WriteChar (C function): PyUnicodeWriter.   (line   49)
* PyUnicodeWriter_WriteRepr (C function): PyUnicodeWriter.   (line  117)
* PyUnicodeWriter_WriteStr (C function): PyUnicodeWriter.    (line  108)
* PyUnicodeWriter_WriteSubstring (C function): PyUnicodeWriter.
                                                             (line  126)
* PyUnicodeWriter_WriteUCS4 (C function): PyUnicodeWriter.   (line   98)
* PyUnicodeWriter_WriteUTF8 (C function): PyUnicodeWriter.   (line   57)
* PyUnicodeWriter_WriteWideChar (C function): PyUnicodeWriter.
                                                             (line   87)
* PyUnstable:                            Unstable C API.     (line    6)
* PyUnstable_AtExit (C function):        インタープリタの初期化と終了処理.
                                                             (line  214)
* PyUnstable_Code_GetExtra (C function): Extra information.  (line   35)
* PyUnstable_Code_GetFirstFree (C function): コードオブジェクト<3>.
                                                             (line   31)
* PyUnstable_Code_New (C function):      コードオブジェクト<3>.
                                                             (line   41)
* PyUnstable_Code_NewWithPosOnlyArgs (C function): コードオブジェクト<3>.
                                                             (line   68)
* PyUnstable_Code_SetExtra (C function): Extra information.  (line   51)
* PyUnstable_EnableTryIncRef (C function): オブジェクトプロトコル object protocol.
                                                             (line  736)
* PyUnstable_Eval_RequestCodeExtraIndex (C function): Extra information.
                                                             (line   14)
* PyUnstable_Exc_PrepReraiseStar (C function): 例外オブジェクト.
                                                             (line   66)
* PyUnstable_GC_VisitObjects (C function): Querying Garbage Collector State.
                                                             (line    9)
* PyUnstable_InterpreterFrame_GetCode (C function): Internal Frames.
                                                             (line   14)
* PyUnstable_InterpreterFrame_GetLasti (C function): Internal Frames.
                                                             (line   23)
* PyUnstable_InterpreterFrame_GetLine (C function): Internal Frames.
                                                             (line   31)
* PyUnstable_IsImmortal (C function):    オブジェクトプロトコル object protocol.
                                                             (line  652)
* PyUnstable_Long_CompactValue (C function): 整数型オブジェクト integer object.
                                                             (line  658)
* PyUnstable_Long_IsCompact (C function): 整数型オブジェクト integer object.
                                                             (line  640)
* PyUnstable_Module_SetGIL (C function): サポート関数.       (line  193)
* PyUnstable_Object_ClearWeakRefsNoCallbacks (C function): 弱参照オブジェクト<2>.
                                                             (line  122)
* PyUnstable_Object_EnableDeferredRefcount (C function): オブジェクトプロトコル object protocol.
                                                             (line  590)
* PyUnstable_Object_GC_NewWithExtraData (C function): 循環参照ガベージコレクションをサポートする.
                                                             (line  110)
* PyUnstable_Object_IsUniquelyReferenced (C function): オブジェクトプロトコル object protocol.
                                                             (line  745)
* PyUnstable_Object_IsUniqueReferencedTemporary (C function): オブジェクトプロトコル object protocol.
                                                             (line  619)
* PyUnstable_PerfMapState_Fini (C function): Support for Perf Maps.
                                                             (line   48)
* PyUnstable_PerfMapState_Init (C function): Support for Perf Maps.
                                                             (line   19)
* PyUnstable_ThreadState_ResetStackProtection (C function): 低レベルAPI.
                                                             (line  160)
* PyUnstable_ThreadState_SetStackProtection (C function): 低レベルAPI.
                                                             (line  121)
* PyUnstable_TryIncRef (C function):     オブジェクトプロトコル object protocol.
                                                             (line  663)
* PyUnstable_Type_AssignVersionTag (C function): 型オブジェクト<2>.
                                                             (line  336)
* PyUnstable_WritePerfMapEntry (C function): Support for Perf Maps.
                                                             (line   33)
* PyVarObject (C type):                  Base object types and macros.
                                                             (line   42)
* PyVarObject_HEAD_INIT (C macro):       Base object types and macros.
                                                             (line  179)
* PyVarObject.ob_size (C member):        Base object types and macros.
                                                             (line   52)
* PyVectorcall_Call (C function):        Vectorcall Support API.
                                                             (line   32)
* PyVectorcall_Function (C function):    Vectorcall Support API.
                                                             (line   18)
* PyVectorcall_NARGS (C function):       Vectorcall Support API.
                                                             (line    6)
* PyWeakref_Check (C function):          弱参照オブジェクト<2>.
                                                             (line   11)
* PyWeakref_CheckProxy (C function):     弱参照オブジェクト<2>.
                                                             (line   26)
* PyWeakref_CheckRef (C function):       弱参照オブジェクト<2>.
                                                             (line   16)
* PyWeakref_CheckRefExact (C function):  弱参照オブジェクト<2>.
                                                             (line   21)
* PyWeakref_GET_OBJECT (C function):     弱参照オブジェクト<2>.
                                                             (line   99)
* PyWeakref_GetObject (C function):      弱参照オブジェクト<2>.
                                                             (line   84)
* PyWeakref_GetRef (C function):         弱参照オブジェクト<2>.
                                                             (line   70)
* PyWeakref_IsDead (C function):         弱参照オブジェクト<2>.
                                                             (line  106)
* PyWeakref_NewProxy (C function):       弱参照オブジェクト<2>.
                                                             (line   51)
* PyWeakref_NewRef (C function):         弱参照オブジェクト<2>.
                                                             (line   31)
* PyWideStringList (C type):             PyWideStringList.   (line    6)
* PyWideStringList_Append (C function):  PyWideStringList.   (line   15)
* PyWideStringList_Insert (C function):  PyWideStringList.   (line   22)
* PyWideStringList.items (C member):     PyWideStringList.   (line   41)
* PyWideStringList.length (C member):    PyWideStringList.   (line   37)
* PyWrapper_New (C function):            デスクリプタオブジェクト descriptor object.
                                                             (line   69)
* PyWrapperDescr_Type (C var):           デスクリプタオブジェクト descriptor object.
                                                             (line   51)
* PyZip_Type (C var):                    Builtin Iterator Types.
                                                             (line   25)
* PyZipFile (zipfile のクラス):          PyZipFile objects.  (line    9)
* qiflush() (curses モジュール):         関数<6>.            (line  403)
* QName (xml.etree.ElementTree のクラス): QName オブジェクト.
                                                             (line    6)
* qsize() (asyncio.Queue のメソッド):    Queue.              (line   79)
* qsize() (multiprocessing.Queue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  110)
* qsize() (queue.Queue のメソッド):      キューオブジェクト. (line    9)
* qsize() (queue.SimpleQueue のメソッド): SimpleQueue オブジェクト.
                                                             (line    9)
* qualified name:                        用語集<2>.          (line 1481)
* quantiles() (statistics モジュール):   関数の詳細.         (line  483)
* quantiles() (statistics.NormalDist のメソッド): NormalDist オブジェクト.
                                                             (line  109)
* quantize() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  491)
* quantize() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  470)
* QueryInfoKey() (winreg モジュール):    関数<14>.           (line  317)
* QueryReflectionKey() (winreg モジュール): 関数<14>.        (line  512)
* QueryValue() (winreg モジュール):      関数<14>.           (line  345)
* QueryValueEx() (winreg モジュール):    関数<14>.           (line  365)
* QUESTION (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  196)
* Queue (asyncio のクラス):              Queue.              (line    6)
* Queue (concurrent.interpreters のクラス): Communicating Between Interpreters.
                                                             (line    6)
* Queue (multiprocessing のクラス):      パイプ Pipe とキュー Queue.
                                                             (line   92)
* Queue (queue のクラス):                queue --- 同期キュークラス.
                                                             (line   32)
* queue (sched.scheduler の属性):        スケジューラオブジェクト.
                                                             (line   73)
* Queue() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  201)
* QueueEmpty:                            例外<15>.           (line    6)
* QueueEmptyError:                       Communicating Between Interpreters.
                                                             (line   22)
* QueueFull:                             例外<15>.           (line   11)
* QueueFullError:                        Communicating Between Interpreters.
                                                             (line   28)
* QueueHandler (logging.handlers のクラス): QueueHandler.    (line   21)
* QueueListener (logging.handlers のクラス): QueueListener.  (line   25)
* QueueShutDown:                         例外<15>.           (line   16)
* quick_ratio() (difflib.SequenceMatcher のメソッド): SequenceMatcherオブジェクト.
                                                             (line  202)
* quiet (sys.flags の属性):              sys --- システム固有のパラメーターと関数.
                                                             (line  560)
* quit (pdb command):                    Debugger commands.  (line  435)
* quit (組み込み変数):                   site モジュールで追加される定数.
                                                             (line   11)
* quit() (ftplib.FTP のメソッド):        FTP オブジェクト.   (line  357)
* quit() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   82)
* quit() (smtplib.SMTP のメソッド):      SMTP オブジェクト.  (line  332)
* quit() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  122)
* quitting (bdb.Bdb attribute):          bdb --- デバッガーフレームワーク.
                                                             (line  366)
* QUOTE_ALL (csv モジュール):            モジュールコンテンツ<3>.
                                                             (line  268)
* quote_from_bytes() (urllib.parse モジュール): URL のクオート.
                                                             (line   52)
* QUOTE_MINIMAL (csv モジュール):        モジュールコンテンツ<3>.
                                                             (line  273)
* QUOTE_NONE (csv モジュール):           モジュールコンテンツ<3>.
                                                             (line  293)
* QUOTE_NONNUMERIC (csv モジュール):     モジュールコンテンツ<3>.
                                                             (line  279)
* QUOTE_NOTNULL (csv モジュール):        モジュールコンテンツ<3>.
                                                             (line  306)
* quote_plus() (urllib.parse モジュール): URL のクオート.    (line   40)
* QUOTE_STRINGS (csv モジュール):        モジュールコンテンツ<3>.
                                                             (line  318)
* quote() (email.utils モジュール):      email utils Miscellaneous utilities.
                                                             (line   45)
* quote() (shlex モジュール):            shlex --- 単純な字句解析.
                                                             (line   42)
* quote() (urllib.parse モジュール):     URL のクオート.     (line   11)
* quoteattr() (xml.sax.saxutils モジュール): xml sax saxutils --- SAX ユーティリティー.
                                                             (line   38)
* quotechar (csv.Dialect の属性):        Dialect クラスと書式化パラメータ.
                                                             (line   65)
* quoted-printable;encoding:             quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line    8)
* quotes (shlex.shlex の属性):           shlex オブジェクト. (line  114)
* quoting (csv.Dialect の属性):          Dialect クラスと書式化パラメータ.
                                                             (line   76)
* R_OK (os モジュール):                  ファイルとディレクトリ.
                                                             (line  109)
* r';raw string literal:                 Bytes literals.     (line   21)
* r";raw string literal:                 Bytes literals.     (line   20)
* race condition:                        用語集<2>.          (line 1508)
* radians() (math モジュール):           角度変換.           (line   10)
* radians() (turtle モジュール):         設定と計測.         (line   28)
* radix (sys.float_info の属性):         sys --- システム固有のパラメーターと関数.
                                                             (line  687)
* radix() (decimal.Context のメソッド):  Context オブジェクト.
                                                             (line  495)
* radix() (decimal.Decimal のメソッド):  Decimal オブジェクト.
                                                             (line  495)
* RADIXCHAR (locale モジュール):         locale --- 国際化サービス.
                                                             (line  270)
* Raise (ast のクラス):                  文 Statements.      (line  113)
* RAISE (monitoring event):              Events.             (line   82)
* raise_on_defect (email.policy.Policy の属性): email policy Policy Objects.
                                                             (line  179)
* raise_signal() (signal モジュール):    モジュールの内容<2>.
                                                             (line  350)
* RAISE_VARARGS (opcode):                Python バイトコード命令.
                                                             (line 1063)
* raiseExceptions (logging モジュール):  モジュールレベル属性.
                                                             (line   19)
* raising;例外:                          raise 文.           (line    6)
* RAND_add() (ssl モジュール):           乱数生成.           (line   32)
* RAND_bytes() (ssl モジュール):         乱数生成.           (line    6)
* RAND_status() (ssl モジュール):        乱数生成.           (line   25)
* randbelow() (secrets モジュール):      乱数.               (line   19)
* randbits() (secrets モジュール):       乱数.               (line   23)
* randbytes() (random モジュール):       バイト列用の関数.   (line    6)
* randbytes() (random.Random のメソッド): 他の生成器.        (line   47)
* randint() (random モジュール):         整数用の関数.       (line   31)
* Random (random のクラス):              他の生成器.         (line    6)
* random コマンドラインオプション; -c:   コマンドラインでの使用<2>.
                                                             (line   18)
* random コマンドラインオプション; -choice: コマンドラインでの使用<2>.
                                                             (line   18)
* random コマンドラインオプション; -f:   コマンドラインでの使用<2>.
                                                             (line   29)
* random コマンドラインオプション; -float: コマンドラインでの使用<2>.
                                                             (line   29)
* random コマンドラインオプション; -h:   コマンドラインでの使用<2>.
                                                             (line   14)
* random コマンドラインオプション; -help: コマンドラインでの使用<2>.
                                                             (line   14)
* random コマンドラインオプション; -i:   コマンドラインでの使用<2>.
                                                             (line   23)
* random コマンドラインオプション; -integer: コマンドラインでの使用<2>.
                                                             (line   23)
* random() (random モジュール):          実数分布.           (line   10)
* random() (random.Random のメソッド):   他の生成器.         (line   34)
* randrange() (random モジュール):       整数用の関数.       (line    6)
* range (組み込みクラス):                range.              (line    9)
* RARROW (token モジュール):             token --- Python 解析木で使われる定数.
                                                             (line  335)
* ratio() (difflib.SequenceMatcher のメソッド): SequenceMatcherオブジェクト.
                                                             (line  178)
* Rational (numbers のクラス):           数値塔.             (line   41)
* raw (io.BufferedIOBase の属性):        I/O 基底クラス.     (line  250)
* raw_data_manager (email.contentmanager モジュール): Content Manager Instances.
                                                             (line   11)
* raw_decode() (json.JSONDecoder のメソッド): エンコーダとデコーダ.
                                                             (line   96)
* raw_input() (code.InteractiveConsole のメソッド): 対話的なコンソールオブジェクト.
                                                             (line   45)
* raw() (curses モジュール):             関数<6>.            (line  409)
* raw() (pickle.PickleBuffer のメソッド): モジュールインターフェース.
                                                             (line  345)
* RawArray() (multiprocessing.sharedctypes モジュール): The multiprocessing sharedctypes module.
                                                             (line   16)
* RawConfigParser (configparser のクラス): RawConfigParser オブジェクト.
                                                             (line    6)
* RawDescriptionHelpFormatter (argparse のクラス): formatter_class.
                                                             (line   10)
* RawIOBase (io のクラス):               I/O 基底クラス.     (line  170)
* RawPen (turtle のクラス):              Public classes.     (line    6)
* RawTextHelpFormatter (argparse のクラス): formatter_class. (line   10)
* RawTurtle (turtle のクラス):           Public classes.     (line    6)
* RawValue() (multiprocessing.sharedctypes モジュール): The multiprocessing sharedctypes module.
                                                             (line   33)
* RBRACE (token モジュール):             token --- Python 解析木で使われる定数.
                                                             (line  260)
* re (re.Match の属性):                  マッチオブジェクト. (line  196)
* READ (inspect.BufferFlags の属性):     Buffer flags.       (line   49)
* read_binary() (importlib.resources モジュール): 関数 API.  (line   75)
* read_byte() (mmap.mmap のメソッド):    mmap --- メモリマップファイルのサポート.
                                                             (line  257)
* read_bytes() (importlib.resources.abc.Traversable のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  153)
* read_bytes() (pathlib.Path のメソッド): ファイルを読み書きする<2>.
                                                             (line   35)
* read_bytes() (zipfile.Path のメソッド): Path objects.      (line  110)
* read_dict() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  206)
* read_environ() (wsgiref.handlers モジュール): wsgiref handlers -- server/gateway base classes.
                                                             (line  306)
* read_events() (xml.etree.ElementTree.XMLPullParser のメソッド): XMLPullParser オブジェクト.
                                                             (line   49)
* read_file() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  184)
* read_history_file() (readline モジュール): 履歴ファイル.   (line    8)
* read_init_file() (readline モジュール): 初期化ファイル.    (line   13)
* read_mime_types() (mimetypes モジュール): mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  117)
* READ_RESTRICTED (C macro):             Member flags.       (line   30)
* read_string() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  196)
* read_text() (importlib.resources モジュール): 関数 API.    (line   89)
* read_text() (importlib.resources.abc.Traversable のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  157)
* read_text() (pathlib.Path のメソッド): ファイルを読み書きする<2>.
                                                             (line   18)
* read_text() (zipfile.Path のメソッド): Path objects.       (line   98)
* read_token() (shlex.shlex のメソッド): shlex オブジェクト. (line   20)
* read_windows_registry() (mimetypes.MimeTypes のメソッド): MimeTypes objects.
                                                             (line   94)
* read() (asyncio.StreamReader のメソッド): StreamReader.    (line   20)
* read() (codecs.StreamReader のメソッド): StreamReader オブジェクト.
                                                             (line   36)
* read() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  146)
* read() (http.client.HTTPResponse のメソッド): HTTPResponse オブジェクト.
                                                             (line   14)
* read() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line  285)
* read() (io.BufferedIOBase のメソッド): I/O 基底クラス.     (line  270)
* read() (io.BufferedReader のメソッド): バッファ付きストリーム.
                                                             (line   84)
* read() (io.RawIOBase のメソッド):      I/O 基底クラス.     (line  183)
* read() (io.Reader のメソッド):         Static Typing.      (line   18)
* read() (io.TextIOBase のメソッド):     テキスト I/O<2>.    (line   51)
* read() (mimetypes.MimeTypes のメソッド): MimeTypes objects.
                                                             (line   74)
* read() (mmap.mmap のメソッド):         mmap --- メモリマップファイルのサポート.
                                                             (line  246)
* read() (os モジュール):                ファイル記述子の操作.
                                                             (line  729)
* read() (sqlite3.Blob のメソッド):      Blob オブジェクト.  (line   46)
* read() (ssl.MemoryBIO のメソッド):     メモリ BIO サポート<2>.
                                                             (line  145)
* read() (ssl.SSLSocket のメソッド):     SSL ソケット.       (line   77)
* read() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   25)
* read() (zipfile.ZipFile のメソッド):   ZipFile objects.    (line  255)
* read1() (bz2.BZ2File のメソッド):      ファイルの圧縮/解凍.
                                                             (line  110)
* read1() (io.BufferedIOBase のメソッド): I/O 基底クラス.    (line  294)
* read1() (io.BufferedReader のメソッド): バッファ付きストリーム.
                                                             (line   89)
* read1() (io.BytesIO のメソッド):       バッファ付きストリーム.
                                                             (line   43)
* READABLE (_tkinter モジュール):        ファイルハンドラ.   (line   42)
* readable() (bz2.BZ2File のメソッド):   ファイルの圧縮/解凍.
                                                             (line   92)
* readable() (io.IOBase のメソッド):     I/O 基底クラス.     (line   77)
* readall() (io.RawIOBase のメソッド):   I/O 基底クラス.     (line  199)
* readbuffer_encode() (codecs モジュール): codecs --- codec レジストリと基底クラス.
                                                             (line  264)
* Reader (io のクラス):                  Static Typing.      (line   10)
* reader() (csv モジュール):             モジュールコンテンツ<3>.
                                                             (line    8)
* ReadError:                             tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  255)
* readexactly() (asyncio.StreamReader のメソッド): StreamReader.
                                                             (line   47)
* readfp() (mimetypes.MimeTypes のメソッド): MimeTypes objects.
                                                             (line   84)
* readframes() (wave.Wave_read のメソッド): Wave_read オブジェクト.
                                                             (line   52)
* readinto() (bz2.BZ2File のメソッド):   ファイルの圧縮/解凍.
                                                             (line  120)
* readinto() (http.client.HTTPResponse のメソッド): HTTPResponse オブジェクト.
                                                             (line   18)
* readinto() (io.BufferedIOBase のメソッド): I/O 基底クラス. (line  306)
* readinto() (io.RawIOBase のメソッド):  I/O 基底クラス.     (line  204)
* readinto() (os モジュール):            ファイル記述子の操作.
                                                             (line  749)
* readinto1() (io.BufferedIOBase のメソッド): I/O 基底クラス.
                                                             (line  320)
* readinto1() (io.BytesIO のメソッド):   バッファ付きストリーム.
                                                             (line   50)
* readline() (asyncio.StreamReader のメソッド): StreamReader.
                                                             (line   36)
* readline() (codecs.StreamReader のメソッド): StreamReader オブジェクト.
                                                             (line   60)
* readline() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  290)
* readline() (io.IOBase のメソッド):     I/O 基底クラス.     (line   82)
* readline() (io.TextIOBase のメソッド): テキスト I/O<2>.    (line   57)
* readline() (mmap.mmap のメソッド):     mmap --- メモリマップファイルのサポート.
                                                             (line  262)
* readlines() (codecs.StreamReader のメソッド): StreamReader オブジェクト.
                                                             (line   70)
* readlines() (io.IOBase のメソッド):    I/O 基底クラス.     (line   91)
* readlink() (os モジュール):            ファイルとディレクトリ.
                                                             (line  688)
* readlink() (pathlib.Path のメソッド):  パスの展開と解決.   (line   80)
* readmodule_ex() (pyclbr モジュール):   pyclbr --- Python モジュールブラウザーサポート.
                                                             (line   31)
* readmodule() (pyclbr モジュール):      pyclbr --- Python モジュールブラウザーサポート.
                                                             (line   19)
* READONLY (C macro):                    Member flags.       (line   35)
* readonly (memoryview の属性):          メモリビュー.       (line  446)
* ReadOnly (typing モジュール):          特殊形式.           (line  278)
* ReadTransport (asyncio のクラス):      トランスポートのクラス階層構造.
                                                             (line   20)
* readuntil() (asyncio.StreamReader のメソッド): StreamReader.
                                                             (line   56)
* readv() (os モジュール):               ファイル記述子の操作.
                                                             (line  914)
* ready() (multiprocessing.pool.AsyncResult のメソッド): プロセスプール.
                                                             (line  217)
* Real (numbers のクラス):               数値塔.             (line   28)
* real (numbers.Complex の属性):         数値塔.             (line   15)
* real_max_memuse (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  169)
* real_quick_ratio() (difflib.SequenceMatcher のメソッド): SequenceMatcherオブジェクト.
                                                             (line  206)
* realloc (C function):                  概要<4>.            (line   33)
* realpath() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  397)
* REALTIME_PRIORITY_CLASS (subprocess モジュール): Windows Constants.
                                                             (line  103)
* reap_children() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  623)
* reap_threads() (test.support.threading_helper モジュール): test support threading_helper --- Utilities for threading tests.
                                                             (line   17)
* reason (http.client.HTTPResponse の属性): HTTPResponse オブジェクト.
                                                             (line   66)
* reason (ssl.SSLError の属性):          例外<19>.           (line   26)
* reason (UnicodeError の属性):          具象例外.           (line  438)
* reason (urllib.error.HTTPError の属性): urllib error --- urllib request によって送出される例外クラス.
                                                             (line   49)
* reason (urllib.error.URLError の属性): urllib error --- urllib request によって送出される例外クラス.
                                                             (line   22)
* reattach() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  236)
* rebinding;name:                        代入文 assignment statement.
                                                             (line    6)
* recent() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  295)
* recipients (smtplib.SMTPRecipientsRefused の属性): smtplib --- SMTP プロトコルクライアント.
                                                             (line  163)
* reconfigure() (io.TextIOWrapper のメソッド): テキスト I/O<2>.
                                                             (line  181)
* record_original_stdout() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  334)
* RECORDS (inspect.BufferFlags の属性):  Buffer flags.       (line   41)
* records (unittest.TestCase の属性):    テストクラス.       (line  456)
* RECORDS_RO (inspect.BufferFlags の属性): Buffer flags.     (line   43)
* rect() (cmath モジュール):             極座標変換.         (line   42)
* rectangle() (curses.textpad モジュール): curses textpad --- Text input widget for curses programs.
                                                             (line   15)
* RecursionError:                        具象例外.           (line  240)
* recursive_repr() (reprlib モジュール): reprlib --- もう一つの repr の実装.
                                                             (line   59)
* recv_bytes_into() (multiprocessing.connection.Connection のメソッド): Connection オブジェクト<2>.
                                                             (line   80)
* recv_bytes() (multiprocessing.connection.Connection のメソッド): Connection オブジェクト<2>.
                                                             (line   66)
* recv_fds() (socket モジュール):        その他の関数<2>.    (line  473)
* recv_into() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  383)
* recv() (multiprocessing.connection.Connection のメソッド): Connection オブジェクト<2>.
                                                             (line   24)
* recv() (socket.socket のメソッド):     socket オブジェクト.
                                                             (line  235)
* recvfrom_into() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  373)
* recvfrom() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  249)
* recvmsg_into() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  335)
* recvmsg() (socket.socket のメソッド):  socket オブジェクト.
                                                             (line  267)
* redirect_request() (urllib.request.HTTPRedirectHandler のメソッド): HTTPRedirectHandler オブジェクト.
                                                             (line   15)
* redirect_stderr() (contextlib モジュール): ユーティリティ. (line  360)
* redirect_stdout() (contextlib モジュール): ユーティリティ. (line  318)
* redisplay() (readline モジュール):     行バッファ.         (line   19)
* redrawln() (curses.window のメソッド): Window オブジェクト.
                                                             (line  458)
* redrawwin() (curses.window のメソッド): Window オブジェクト.
                                                             (line  464)
* reduce() (functools モジュール):       functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  445)
* reducer_override() (pickle.Pickler のメソッド): モジュールインターフェース.
                                                             (line  210)
* reentrant:                             用語集<2>.          (line 1541)
* ref (weakref のクラス):                weakref --- Weak references.
                                                             (line   87)
* refcount_test() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  573)
* reference count:                       用語集<2>.          (line 1519)
* ReferenceError:                        具象例外.           (line  249)
* ReferenceType (weakref モジュール):    weakref --- Weak references.
                                                             (line  322)
* refold_source (email.policy.EmailPolicy の属性): email policy Policy Objects.
                                                             (line  386)
* refresh() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  469)
* REG_BINARY (winreg モジュール):        値の型.             (line    8)
* REG_DWORD (winreg モジュール):         値の型.             (line   12)
* REG_DWORD_BIG_ENDIAN (winreg モジュール): 値の型.          (line   21)
* REG_DWORD_LITTLE_ENDIAN (winreg モジュール): 値の型.       (line   16)
* REG_EXPAND_SZ (winreg モジュール):     値の型.             (line   25)
* REG_FULL_RESOURCE_DESCRIPTOR (winreg モジュール): 値の型.  (line   59)
* REG_LINK (winreg モジュール):          値の型.             (line   29)
* REG_MULTI_SZ (winreg モジュール):      値の型.             (line   33)
* REG_NONE (winreg モジュール):          値の型.             (line   38)
* REG_QWORD (winreg モジュール):         値の型.             (line   42)
* REG_QWORD_LITTLE_ENDIAN (winreg モジュール): 値の型.       (line   48)
* REG_RESOURCE_LIST (winreg モジュール): 値の型.             (line   55)
* REG_RESOURCE_REQUIREMENTS_LIST (winreg モジュール): 値の型.
                                                             (line   63)
* REG_SZ (winreg モジュール):            値の型.             (line   67)
* RegexFlag (re のクラス):               フラグ.             (line    9)
* register_adapter() (sqlite3 モジュール): モジュール関数.   (line  138)
* register_archive_format() (shutil モジュール): アーカイブ化操作.
                                                             (line  101)
* register_at_fork() (os モジュール):    プロセス管理.       (line  559)
* register_callback() (sys.monitoring モジュール): Registering callback functions.
                                                             (line    6)
* register_converter() (sqlite3 モジュール): モジュール関数. (line  146)
* register_defect() (email.policy.Policy のメソッド): email policy Policy Objects.
                                                             (line  244)
* register_dialect() (csv モジュール):   モジュールコンテンツ<3>.
                                                             (line   70)
* register_error() (codecs モジュール):  エラーハンドラ.     (line   98)
* register_function() (xmlrpc.server.CGIXMLRPCRequestHandler のメソッド): CGIXMLRPCRequestHandler.
                                                             (line    9)
* register_function() (xmlrpc.server.SimpleXMLRPCServer のメソッド): SimpleXMLRPCServer オブジェクト.
                                                             (line   10)
* register_instance() (xmlrpc.server.CGIXMLRPCRequestHandler のメソッド): CGIXMLRPCRequestHandler.
                                                             (line   26)
* register_instance() (xmlrpc.server.SimpleXMLRPCServer のメソッド): SimpleXMLRPCServer オブジェクト.
                                                             (line   27)
* register_introspection_functions() (xmlrpc.server.CGIXMLRPCRequestHandler のメソッド): CGIXMLRPCRequestHandler.
                                                             (line   39)
* register_introspection_functions() (xmlrpc.server.SimpleXMLRPCServer のメソッド): SimpleXMLRPCServer オブジェクト.
                                                             (line   52)
* register_multicall_functions() (xmlrpc.server.CGIXMLRPCRequestHandler のメソッド): CGIXMLRPCRequestHandler.
                                                             (line   45)
* register_multicall_functions() (xmlrpc.server.SimpleXMLRPCServer のメソッド): SimpleXMLRPCServer オブジェクト.
                                                             (line   57)
* register_namespace() (xml.etree.ElementTree モジュール): 関数<9>.
                                                             (line  195)
* register_optionflag() (doctest モジュール): オプションフラグ.
                                                             (line  153)
* register_shape() (turtle モジュール):  設定と特殊なメソッド.
                                                             (line   70)
* register_unpack_format() (shutil モジュール): アーカイブ化操作.
                                                             (line  178)
* register() (abc.ABCMeta のメソッド):   abc --- 抽象基底クラス.
                                                             (line   68)
* register() (argparse.ArgumentParser のメソッド): Registering custom types or actions.
                                                             (line    6)
* register() (atexit モジュール):        atexit --- 終了ハンドラー.
                                                             (line   26)
* register() (codecs モジュール):        codecs --- codec レジストリと基底クラス.
                                                             (line  162)
* register() (faulthandler モジュール):  ユーザシグナルに対してtracebackをダンプする.
                                                             (line    6)
* register() (functools.singledispatch のメソッド): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  495)
* register() (multiprocessing.managers.BaseManager のメソッド): マネージャー.
                                                             (line   95)
* register() (select.devpoll のメソッド): /dev/poll ポーリングオブジェクト.
                                                             (line   30)
* register() (select.epoll のメソッド):  エッジおよびレベルトリガポーリング epoll オブジェクト.
                                                             (line   88)
* register() (select.poll のメソッド):   ポーリングオブジェクト.
                                                             (line   15)
* register() (selectors.BaseSelector のメソッド): クラス<4>. (line   67)
* register() (webbrowser モジュール):    コマンドライン・インターフェース<6>.
                                                             (line   75)
* registerDOMImplementation() (xml.dom モジュール): モジュールコンテンツ<4>.
                                                             (line    8)
* registerResult() (unittest モジュール): シグナルハンドリング.
                                                             (line   33)
* REGTYPE (tarfile モジュール):          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  329)
* regular package:                       用語集<2>.          (line 1534)
* relative_to() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  317)
* relative;import:                       import 文.          (line  102)
* relative;URL:                          urllib parse --- URL を構成要素に解析する.
                                                             (line    8)
* release() (_thread.lock のメソッド):   _thread --- 低水準なスレッド API.
                                                             (line  170)
* release() (asyncio.Condition のメソッド): Condition.       (line   79)
* release() (asyncio.Lock のメソッド):   Lock.               (line   50)
* release() (asyncio.Semaphore のメソッド): Semaphore.       (line   57)
* release() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   32)
* release() (memoryview のメソッド):     メモリビュー.       (line  246)
* release() (multiprocessing.Lock のメソッド): 同期プリミティブ.
                                                             (line  110)
* release() (multiprocessing.RLock のメソッド): 同期プリミティブ.
                                                             (line  175)
* release() (pickle.PickleBuffer のメソッド): モジュールインターフェース.
                                                             (line  353)
* release() (platform モジュール):       Cross platform.     (line  117)
* release() (threading.Condition のメソッド): Condition objects.
                                                             (line   91)
* release() (threading.Lock のメソッド): Lock objects.       (line   76)
* release() (threading.RLock のメソッド): RLock objects.     (line   95)
* release() (threading.Semaphore のメソッド): Semaphore objects.
                                                             (line   63)
* releasebufferproc (C type):            Slot Type typedefs. (line  113)
* reload_environ() (os モジュール):      プロセスのパラメーター.
                                                             (line   79)
* reload() (importlib モジュール):       関数<13>.           (line   53)
* relpath() (os.path モジュール):        os path --- 一般的なパス名操作.
                                                             (line  454)
* remainder_near() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  505)
* remainder_near() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  501)
* remainder() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  499)
* remainder() (math モジュール):         Floating point arithmetic.
                                                             (line   64)
* remote_exec() (sys モジュール):        sys --- システム固有のパラメーターと関数.
                                                             (line 1895)
* RemoteDisconnected:                    http client --- HTTP プロトコルクライアント.
                                                             (line  193)
* remove_done_callback() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line  110)
* remove_done_callback() (asyncio.Task のメソッド): Task オブジェクト.
                                                             (line  112)
* remove_flag() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line  140)
* remove_flag() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line   88)
* remove_flag() (mailbox.mboxMessage のメソッド): mboxMessage オブジェクト.
                                                             (line   84)
* remove_flag() (mailbox.MMDFMessage のメソッド): MMDFMessage オブジェクト.
                                                             (line   83)
* remove_folder() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line   78)
* remove_folder() (mailbox.MH のメソッド): MH オブジェクト.  (line   52)
* remove_header() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line  101)
* remove_history_item() (readline モジュール): 履歴リスト.   (line   25)
* remove_label() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   59)
* remove_option() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  301)
* remove_option() (optparse.OptionParser のメソッド): オプション解析器への問い合わせと操作.
                                                             (line   48)
* remove_reader() (asyncio.loop のメソッド): ファイル記述子の監視.
                                                             (line   15)
* remove_section() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  308)
* remove_sequence() (mailbox.MHMessage のメソッド): MHMessage オブジェクト.
                                                             (line   45)
* remove_signal_handler() (asyncio.loop のメソッド): Unix シグナル.
                                                             (line   27)
* remove_writer() (asyncio.loop のメソッド): ファイル記述子の監視.
                                                             (line   32)
* remove() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  223)
* remove() (collections.deque のメソッド): deque オブジェクト.
                                                             (line   99)
* remove() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line   76)
* remove() (mailbox.MH のメソッド):      MH オブジェクト.    (line   81)
* remove() (os モジュール):              ファイルとディレクトリ.
                                                             (line  725)
* remove() (sequence のメソッド):        ミュータブルなシーケンス型.
                                                             (line  108)
* remove() (set のメソッド):             set（集合）型 --- set frozenset.
                                                             (line  202)
* remove() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line  166)
* removeAttribute() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   53)
* removeAttributeNode() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   58)
* removeAttributeNS() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   63)
* removeChild() (xml.dom.Node のメソッド): Node オブジェクト.
                                                             (line  128)
* removedirs() (os モジュール):          ファイルとディレクトリ.
                                                             (line  749)
* removeFilter() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   59)
* removeFilter() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  319)
* removeHandler() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  336)
* removeHandler() (unittest モジュール): シグナルハンドリング.
                                                             (line   50)
* removeprefix() (bytearray のメソッド): bytes と bytearray の操作.
                                                             (line   52)
* removeprefix() (bytes のメソッド):     bytes と bytearray の操作.
                                                             (line   52)
* removeprefix() (str のメソッド):       文字列メソッド<2>.  (line  538)
* removeResult() (unittest モジュール):  シグナルハンドリング.
                                                             (line   44)
* removesuffix() (bytearray のメソッド): bytes と bytearray の操作.
                                                             (line   72)
* removesuffix() (bytes のメソッド):     bytes と bytearray の操作.
                                                             (line   72)
* removesuffix() (str のメソッド):       文字列メソッド<2>.  (line  553)
* removexattr() (os モジュール):         Linux 拡張属性.     (line   42)
* rename() (ftplib.FTP のメソッド):      FTP オブジェクト.   (line  322)
* rename() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  300)
* rename() (os モジュール):              ファイルとディレクトリ.
                                                             (line  767)
* rename() (pathlib.Path のメソッド):    Copying moving and deleting.
                                                             (line   41)
* renames() (os モジュール):             ファイルとディレクトリ.
                                                             (line  804)
* reopenIfNeeded() (logging.handlers.WatchedFileHandler のメソッド): WatchedFileHandler.
                                                             (line   42)
* reorganize() (dbm.gnu.gdbm のメソッド): dbm gnu --- GNU database manager.
                                                             (line  118)
* repeat() (itertools モジュール):       Itertool関数.       (line  524)
* repeat() (timeit モジュール):          Python インターフェイス.
                                                             (line   18)
* repeat() (timeit.Timer のメソッド):    Python インターフェイス.
                                                             (line  103)
* REPL:                                  用語集<2>.          (line 1561)
* replace_errors() (codecs モジュール):  エラーハンドラ.     (line  147)
* replace_header() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  301)
* replace_header() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  411)
* replace_history_item() (readline モジュール): 履歴リスト.  (line   31)
* replace_whitespace (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  186)
* replace;error handler's name:          エラーハンドラ.     (line   14)
* replace() (bytearray のメソッド):      bytes と bytearray の操作.
                                                             (line  201)
* replace() (bytes のメソッド):          bytes と bytearray の操作.
                                                             (line  201)
* replace() (codeobject のメソッド):     Methods on code objects.
                                                             (line   85)
* replace() (copy モジュール):           copy --- 浅いコピーおよび深いコピー操作.
                                                             (line   27)
* replace() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   39)
* replace() (dataclasses モジュール):    モジュールの内容<4>.
                                                             (line  444)
* replace() (datetime.date のメソッド):  date objects.       (line  223)
* replace() (datetime.datetime のメソッド): datetime objects.
                                                             (line  467)
* replace() (datetime.time のメソッド):  time objects.       (line  165)
* replace() (inspect.Parameter のメソッド): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  322)
* replace() (inspect.Signature のメソッド): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  148)
* replace() (os モジュール):             ファイルとディレクトリ.
                                                             (line  821)
* replace() (pathlib.Path のメソッド):   Copying moving and deleting.
                                                             (line   69)
* replace() (str のメソッド):            文字列メソッド<2>.  (line  568)
* replace() (tarfile.TarInfo のメソッド): TarInfo オブジェクト.
                                                             (line  167)
* replaceChild() (xml.dom.Node のメソッド): Node オブジェクト.
                                                             (line  135)
* ReplacePackage() (modulefinder モジュール): modulefinder --- スクリプト中で使用されているモジュールの検索.
                                                             (line   21)
* REPORT_CDIFF (doctest モジュール):     オプションフラグ.   (line  111)
* REPORT_ERRMODE (msvcrt モジュール):    その多の関数.       (line   35)
* report_failure() (doctest.DocTestRunner のメソッド): DocTestRunner オブジェクト.
                                                             (line   77)
* report_full_closure() (filecmp.dircmp のメソッド): dircmp クラス.
                                                             (line   31)
* REPORT_NDIFF (doctest モジュール):     オプションフラグ.   (line  116)
* REPORT_ONLY_FIRST_FAILURE (doctest モジュール): オプションフラグ.
                                                             (line  126)
* report_partial_closure() (filecmp.dircmp のメソッド): dircmp クラス.
                                                             (line   26)
* report_start() (doctest.DocTestRunner のメソッド): DocTestRunner オブジェクト.
                                                             (line   54)
* report_success() (doctest.DocTestRunner のメソッド): DocTestRunner オブジェクト.
                                                             (line   65)
* REPORT_UDIFF (doctest モジュール):     オプションフラグ.   (line  106)
* report_unexpected_exception() (doctest.DocTestRunner のメソッド): DocTestRunner オブジェクト.
                                                             (line   89)
* report() (filecmp.dircmp のメソッド):  dircmp クラス.      (line   22)
* report() (modulefinder.ModuleFinder のメソッド): modulefinder --- スクリプト中で使用されているモジュールの検索.
                                                             (line   39)
* REPORTING_FLAGS (doctest モジュール):  オプションフラグ.   (line  145)
* Repr (reprlib のクラス):               reprlib --- もう一つの repr の実装.
                                                             (line   16)
* repr() (reprlib モジュール):           reprlib --- もう一つの repr の実装.
                                                             (line   49)
* repr() (reprlib.Repr のメソッド):      Reprオブジェクト.   (line  105)
* repr() (組み込み関数);__repr__() (オブジェクトメソッド): 基本的なカスタマイズ.
                                                             (line  112)
* repr1() (reprlib.Repr のメソッド):     Reprオブジェクト.   (line  110)
* ReprEnum (enum のクラス):              データ型<2>.        (line  594)
* reprfunc (C type):                     Slot Type typedefs. (line   43)
* request (socketserver.BaseRequestHandler の属性): Request Handler Objects.
                                                             (line   41)
* Request (urllib.request のクラス):     urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  232)
* request_queue_size (socketserver.BaseServer の属性): Serverオブジェクト<2>.
                                                             (line   99)
* request_rate() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   60)
* request_uri() (wsgiref.util モジュール): wsgiref util -- WSGI environment utilities.
                                                             (line   26)
* request_version (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  153)
* request() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line    8)
* RequestHandlerClass (socketserver.BaseServer の属性): Serverオブジェクト<2>.
                                                             (line   74)
* requestline (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  134)
* Required (typing モジュール):          特殊形式.           (line  258)
* requires_bz2() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  532)
* requires_docstrings() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  544)
* requires_freebsd_version() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  500)
* requires_gil_enabled() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  515)
* requires_gzip() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  528)
* requires_IEEE_754() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  520)
* requires_limited_api() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  548)
* requires_linux_version() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  505)
* requires_lzma() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  536)
* requires_mac_version() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  510)
* requires_resource() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  540)
* requires_zlib() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  524)
* requires() (importlib.metadata モジュール): 配布物の要件.  (line    6)
* requires() (test.support モジュール):  test support --- Utilities for the Python test suite.
                                                             (line  284)
* RERAISE (monitoring event):            Events.             (line   87)
* RERAISE (opcode):                      Python バイトコード命令.
                                                             (line  442)
* reschedule() (asyncio.Timeout のメソッド): タイムアウト.   (line   72)
* reserved (zipfile.ZipInfo の属性):     ZipInfo objects.    (line  127)
* RESERVED_FUTURE (uuid モジュール):     uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  306)
* RESERVED_MICROSOFT (uuid モジュール):  uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  302)
* RESERVED_NCS (uuid モジュール):        uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  292)
* reset_mock() (unittest.mock.AsyncMock のメソッド): Mock クラス.
                                                             (line  885)
* reset_mock() (unittest.mock.Mock のメソッド): Mock クラス. (line  203)
* reset_peak() (tracemalloc モジュール): 関数<11>.           (line   37)
* reset_prog_mode() (curses モジュール): 関数<6>.            (line  416)
* reset_shell_mode() (curses モジュール): 関数<6>.           (line  421)
* reset_tzpath() (zoneinfo モジュール):  関数<3>.            (line   27)
* reset() (asyncio.Barrier のメソッド):  Barrier.            (line   79)
* reset() (bdb.Bdb のメソッド):          bdb --- デバッガーフレームワーク.
                                                             (line  186)
* reset() (codecs.IncrementalDecoder のメソッド): IncrementalDecoder オブジェクト.
                                                             (line   40)
* reset() (codecs.IncrementalEncoder のメソッド): IncrementalEncoder オブジェクト.
                                                             (line   35)
* reset() (codecs.StreamReader のメソッド): StreamReader オブジェクト.
                                                             (line   81)
* reset() (codecs.StreamWriter のメソッド): StreamWriter オブジェクト.
                                                             (line   44)
* reset() (contextvars.ContextVar のメソッド): コンテキスト変数.
                                                             (line   83)
* reset() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line   24)
* reset() (threading.Barrier のメソッド): Barrier objects.   (line   69)
* reset() (turtle モジュール):           さらなる描画の制御. (line    6)
* reset() (xml.dom.pulldom.DOMEventStream のメソッド): DOMEventStream オブジェクト.
                                                             (line   36)
* reset() (xml.sax.xmlreader.IncrementalParser のメソッド): IncrementalParser オブジェクト.
                                                             (line   18)
* resetbuffer() (code.InteractiveConsole のメソッド): 対話的なコンソールオブジェクト.
                                                             (line   41)
* resetscreen() (turtle モジュール):     ウィンドウの制御.   (line   84)
* resetty() (curses モジュール):         関数<6>.            (line  426)
* resetwarnings() (warnings モジュール): 利用可能な関数.     (line  130)
* resize_term() (curses モジュール):     関数<6>.            (line  431)
* resize() (bytearray のメソッド):       bytearray オブジェクト.
                                                             (line   75)
* resize() (ctypes モジュール):          ユーティリティー関数.
                                                             (line  238)
* resize() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  487)
* resize() (mmap.mmap のメソッド):       mmap --- メモリマップファイルのサポート.
                                                             (line  268)
* resizemode() (turtle モジュール):      見た目.             (line   24)
* resizeterm() (curses モジュール):      関数<6>.            (line  440)
* resolution (datetime.date の属性):     date objects.       (line  138)
* resolution (datetime.datetime の属性): datetime objects.   (line  300)
* resolution (datetime.time の属性):     time objects.       (line   42)
* resolution (datetime.timedelta の属性): timedelta objects. (line   96)
* resolve_bases() (types モジュール):    動的な型生成.       (line   52)
* resolve_name() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line   83)
* resolve_name() (pkgutil モジュール):   pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line  171)
* resolve() (pathlib.Path のメソッド):   パスの展開と解決.   (line   49)
* resolveEntity() (xml.sax.handler.EntityResolver のメソッド): EntityResolver オブジェクト.
                                                             (line    6)
* resource_path() (importlib.resources.abc.ResourceReader のメソッド): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line   55)
* ResourceDenied:                        test support --- Utilities for the Python test suite.
                                                             (line   22)
* ResourceLoader (importlib.abc のクラス): importlib abc -- Abstract base classes related to import.
                                                             (line  176)
* ResourceReader (importlib.resources.abc のクラス): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line   12)
* ResourceWarning:                       警告.               (line   84)
* response() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  305)
* ResponseNotReady:                      http client --- HTTP プロトコルクライアント.
                                                             (line  179)
* responses (http.client モジュール):    http client --- HTTP プロトコルクライアント.
                                                             (line  214)
* responses (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  228)
* restart (pdb command):                 Debugger commands.  (line  422)
* restart_events() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  444)
* restart_events() (sys.monitoring モジュール): Disabling events.
                                                             (line   25)
* restore() (difflib モジュール):        difflib --- 差分の計算の補助.
                                                             (line  265)
* restore() (test.support.SaveSignals のメソッド): test support --- Utilities for the Python test suite.
                                                             (line  814)
* RESTRICTED (C macro):                  Member flags.       (line   30)
* restype (ctypes._CFuncPtr の属性):     外部関数.           (line   32)
* result() (asyncio.Future のメソッド):  Future オブジェクト<2>.
                                                             (line   33)
* result() (asyncio.Task のメソッド):    Task オブジェクト.  (line   74)
* result() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   37)
* results() (trace.Trace のメソッド):    プログラミングインターフェース.
                                                             (line   39)
* RESUME (opcode):                       Python バイトコード命令.
                                                             (line 1273)
* resume_reading() (asyncio.ReadTransport のメソッド): 読み出し専用のトランスポート.
                                                             (line   22)
* resume_writing() (asyncio.BaseProtocol のメソッド): 基底プロトコル<2>.
                                                             (line   46)
* retr() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   61)
* retrbinary() (ftplib.FTP のメソッド):  FTP オブジェクト.   (line  174)
* retrlines() (ftplib.FTP のメソッド):   FTP オブジェクト.   (line  199)
* RETRY (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  149)
* RETRYCANCEL (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  176)
* Return (ast のクラス):                 関数およびクラス定義.
                                                             (line  113)
* return (pdb command):                  Debugger commands.  (line  228)
* return_annotation (inspect.Signature の属性): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  127)
* RETURN_GENERATOR (opcode):             Python バイトコード命令.
                                                             (line 1298)
* return_ok() (http.cookiejar.CookiePolicy のメソッド): CookiePolicy オブジェクト.
                                                             (line   18)
* RETURN_VALUE (opcode):                 Python バイトコード命令.
                                                             (line  409)
* return_value (unittest.mock.Mock の属性): Mock クラス.     (line  338)
* returncode (asyncio.subprocess.Process の属性): サブプロセスとやりとりする.
                                                             (line  148)
* returncode (subprocess.CalledProcessError の属性): Using the subprocess Module.
                                                             (line  212)
* returncode (subprocess.CompletedProcess の属性): Using the subprocess Module.
                                                             (line  109)
* returncode (subprocess.Popen の属性):  Popen オブジェクト. (line  159)
* retval (pdb command):                  Debugger commands.  (line  455)
* reveal_type() (typing モジュール):     Functions and decorators.
                                                             (line   81)
* reverse_order() (pstats.Stats のメソッド): Stats クラス.   (line  149)
* reverse_pointer (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line   78)
* reverse_pointer (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  269)
* reverse() (array.array のメソッド):    array --- 効率的な数値配列.
                                                             (line  233)
* reverse() (collections.deque のメソッド): deque オブジェクト.
                                                             (line  104)
* reverse() (sequence のメソッド):       ミュータブルなシーケンス型.
                                                             (line  115)
* Reversible (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   49)
* Reversible (typing のクラス):          Aliases to other ABCs in collections abc.
                                                             (line   61)
* revert() (http.cookiejar.FileCookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line  149)
* rewind() (wave.Wave_read のメソッド):  Wave_read オブジェクト.
                                                             (line   57)
* RFC_4122 (uuid モジュール):            uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  296)
* RFC; RFC 1123:                         関数<5>.            (line  744)
* RFC; RFC 1123 <1>:                     関数<5>.            (line  757)
* RFC; RFC 1123 <2>:                     関数<5>.            (line  774)
* RFC; RFC 1321:                         hashlib --- セキュアハッシュとメッセージダイジェスト.
                                                             (line   15)
* RFC; RFC 1422:                         証明書.             (line   32)
* RFC; RFC 1422 <1>:                     TLS 1 3.            (line   41)
* RFC; RFC 1494:                         mimetypes.          (line   39)
* RFC; RFC 1521:                         セキュリティで考慮すべき点<4>.
                                                             (line   18)
* RFC; RFC 1521 <1>:                     quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line   10)
* RFC; RFC 1521 <2>:                     quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line   37)
* RFC; RFC 1522:                         binascii --- バイナリ と ASCII 間の変換.
                                                             (line   87)
* RFC; RFC 1522 <1>:                     quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line   25)
* RFC; RFC 1522 <2>:                     quopri --- MIME quoted-printable データのエンコードとデコード.
                                                             (line   39)
* RFC; RFC 1730:                         imaplib --- IMAP4 プロトコルクライアント.
                                                             (line   14)
* RFC; RFC 1738:                         URL の解析.         (line  271)
* RFC; RFC 1738 <1>:                     URL のクオート.     (line  189)
* RFC; RFC 1750:                         乱数生成.           (line   36)
* RFC; RFC 1808:                         urllib<4>.          (line   23)
* RFC; RFC 1808 <1>:                     urllib parse --- URL を構成要素に解析する.
                                                             (line   34)
* RFC; RFC 1808 <2>:                     URL の解析.         (line   43)
* RFC; RFC 1808 <3>:                     URL の解析.         (line  271)
* RFC; RFC 1808 <4>:                     URL のクオート.     (line  184)
* RFC; RFC 1869:                         smtplib --- SMTP プロトコルクライアント.
                                                             (line   13)
* RFC; RFC 1869 <1>:                     smtplib --- SMTP プロトコルクライアント.
                                                             (line  201)
* RFC; RFC 1870:                         smtpd<4>.           (line    6)
* RFC; RFC 1939:                         poplib --- POP3 プロトコルクライアント.
                                                             (line   11)
* RFC; RFC 1939 <1>:                     poplib --- POP3 プロトコルクライアント.
                                                             (line   12)
* RFC; RFC 2033:                         新しいモジュールと改良されたモジュール<2>.
                                                             (line  582)
* RFC; RFC 2045:                         email --- 電子メールと MIME 処理のためのパッケージ.
                                                             (line   15)
* RFC; RFC 2045 <1>:                     email message Representing an email message.
                                                             (line  316)
* RFC; RFC 2045 <2>:                     email message Representing an email message.
                                                             (line  318)
* RFC; RFC 2045 <3>:                     email message Representing an email message.
                                                             (line  321)
* RFC; RFC 2045 <4>:                     email headerregistry Custom Header Objects.
                                                             (line  234)
* RFC; RFC 2045 <5>:                     email headerregistry Custom Header Objects.
                                                             (line  291)
* RFC; RFC 2045 <6>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  424)
* RFC; RFC 2045 <7>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  428)
* RFC; RFC 2045 <8>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  433)
* RFC; RFC 2045 <9>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  529)
* RFC; RFC 2045 <10>:                    email header 国際化されたヘッダー.
                                                             (line   28)
* RFC; RFC 2045 <11>:                    base64 --- Base16 Base32 Base64 Base85 データのエンコード.
                                                             (line   24)
* RFC; RFC 2045 <12>:                    base64 --- Base16 Base32 Base64 Base85 データのエンコード.
                                                             (line   25)
* RFC; RFC 2045 <13>:                    レガシーインターフェース.
                                                             (line   27)
* RFC; RFC 2045 <14>:                    レガシーインターフェース.
                                                             (line   34)
* RFC; RFC 2045 Section 6.8:             Binary オブジェクト.
                                                             (line   29)
* RFC; RFC 2046:                         email --- 電子メールと MIME 処理のためのパッケージ.
                                                             (line   15)
* RFC; RFC 2046 <1>:                     Content Manager Instances.
                                                             (line   93)
* RFC; RFC 2046 <2>:                     email header 国際化されたヘッダー.
                                                             (line   29)
* RFC; RFC 2047:                         PEP 3333 Python Web Server Gateway Interface v1 0 1.
                                                             (line   21)
* RFC; RFC 2047 <1>:                     email<7>.           (line   29)
* RFC; RFC 2047 <2>:                     email --- 電子メールと MIME 処理のためのパッケージ.
                                                             (line   15)
* RFC; RFC 2047 <3>:                     email policy Policy Objects.
                                                             (line  362)
* RFC; RFC 2047 <4>:                     email policy Policy Objects.
                                                             (line  368)
* RFC; RFC 2047 <5>:                     email headerregistry Custom Header Objects.
                                                             (line   78)
* RFC; RFC 2047 <6>:                     email headerregistry Custom Header Objects.
                                                             (line  121)
* RFC; RFC 2047 <7>:                     email headerregistry Custom Header Objects.
                                                             (line  125)
* RFC; RFC 2047 <8>:                     email header 国際化されたヘッダー.
                                                             (line   29)
* RFC; RFC 2047 <9>:                     email header 国際化されたヘッダー.
                                                             (line   52)
* RFC; RFC 2047 <10>:                    email header 国際化されたヘッダー.
                                                             (line  112)
* RFC; RFC 2047 <11>:                    email header 国際化されたヘッダー.
                                                             (line  136)
* RFC; RFC 2047 <12>:                    email utils Miscellaneous utilities.
                                                             (line   79)
* RFC; RFC 2060:                         imaplib --- IMAP4 プロトコルクライアント.
                                                             (line   12)
* RFC; RFC 2060 <1>:                     IMAP4 オブジェクト. (line  406)
* RFC; RFC 2068:                         http cookies --- HTTP の状態管理.
                                                             (line   15)
* RFC; RFC 2087:                         IMAP4 オブジェクト. (line  120)
* RFC; RFC 2087 <1>:                     IMAP4 オブジェクト. (line  125)
* RFC; RFC 2087 <2>:                     IMAP4 オブジェクト. (line  355)
* RFC; RFC 2104:                         hmac.               (line    6)
* RFC; RFC 2104 <1>:                     新しいモジュールと改良されたモジュール<3>.
                                                             (line   34)
* RFC; RFC 2104 <2>:                     ライブラリ<29>.     (line    6)
* RFC; RFC 2104 <3>:                     hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   10)
* RFC; RFC 2109:                         Python API の変更<10>.
                                                             (line   79)
* RFC; RFC 2109 <1>:                     http cookies --- HTTP の状態管理.
                                                             (line   15)
* RFC; RFC 2109 <2>:                     http cookies --- HTTP の状態管理.
                                                             (line   35)
* RFC; RFC 2109 <3>:                     http cookies --- HTTP の状態管理.
                                                             (line   65)
* RFC; RFC 2109 <4>:                     Morselオブジェクト. (line    8)
* RFC; RFC 2109 <5>:                     Morselオブジェクト. (line   10)
* RFC; RFC 2109 <6>:                     Morselオブジェクト. (line  106)
* RFC; RFC 2109 <7>:                     Morselオブジェクト. (line  118)
* RFC; RFC 2109 <8>:                     http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line   18)
* RFC; RFC 2109 <9>:                     http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line  104)
* RFC; RFC 2109 <10>:                    http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line  115)
* RFC; RFC 2109 <11>:                    http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line  142)
* RFC; RFC 2109 <12>:                    DefaultCookiePolicy オブジェクト.
                                                             (line   84)
* RFC; RFC 2109 <13>:                    Cookieオブジェクト<2>.
                                                             (line   11)
* RFC; RFC 2109 <14>:                    Cookieオブジェクト<2>.
                                                             (line   22)
* RFC; RFC 2109 <15>:                    Cookieオブジェクト<2>.
                                                             (line   75)
* RFC; RFC 2177:                         imaplib.            (line    7)
* RFC; RFC 2177 <1>:                     IMAP4 オブジェクト. (line  131)
* RFC; RFC 2183:                         email --- 電子メールと MIME 処理のためのパッケージ.
                                                             (line   16)
* RFC; RFC 2183 <1>:                     email message Representing an email message.
                                                             (line  460)
* RFC; RFC 2183 <2>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  641)
* RFC; RFC 2231:                         ライブラリ<19>.     (line   68)
* RFC; RFC 2231 <1>:                     ライブラリ<55>.     (line  135)
* RFC; RFC 2231 <2>:                     email --- 電子メールと MIME 処理のためのパッケージ.
                                                             (line   16)
* RFC; RFC 2231 <3>:                     email message Representing an email message.
                                                             (line  280)
* RFC; RFC 2231 <4>:                     email message Representing an email message.
                                                             (line  283)
* RFC; RFC 2231 <5>:                     email message Representing an email message.
                                                             (line  366)
* RFC; RFC 2231 <6>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  388)
* RFC; RFC 2231 <7>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  391)
* RFC; RFC 2231 <8>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  495)
* RFC; RFC 2231 <9>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  503)
* RFC; RFC 2231 <10>:                    email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  538)
* RFC; RFC 2231 <11>:                    email header 国際化されたヘッダー.
                                                             (line   29)
* RFC; RFC 2231 <12>:                    email utils Miscellaneous utilities.
                                                             (line  189)
* RFC; RFC 2231 <13>:                    email utils Miscellaneous utilities.
                                                             (line  193)
* RFC; RFC 2231 <14>:                    email utils Miscellaneous utilities.
                                                             (line  203)
* RFC; RFC 2231 <15>:                    email utils Miscellaneous utilities.
                                                             (line  210)
* RFC; RFC 2231 <16>:                    email utils Miscellaneous utilities.
                                                             (line  221)
* RFC; RFC 2295:                         HTTP ステータスコード.
                                                             (line  184)
* RFC; RFC 2324:                         HTTP ステータスコード.
                                                             (line  133)
* RFC; RFC 2342:                         新しいモジュールと改良されたモジュール<3>.
                                                             (line   93)
* RFC; RFC 2342 <1>:                     IMAP4 オブジェクト. (line  250)
* RFC; RFC 2361:                         mimetypes.          (line   57)
* RFC; RFC 2368:                         URL のクオート.     (line  180)
* RFC; RFC 2373:                         Address オブジェクト.
                                                             (line   96)
* RFC; RFC 2373 <1>:                     Address オブジェクト.
                                                             (line  161)
* RFC; RFC 2373 <2>:                     Address オブジェクト.
                                                             (line  182)
* RFC; RFC 2396:                         urllib parse<5>.    (line    6)
* RFC; RFC 2396 <1>:                     urllib<4>.          (line   24)
* RFC; RFC 2396 <2>:                     URL のクオート.     (line   23)
* RFC; RFC 2396 <3>:                     URL のクオート.     (line  174)
* RFC; RFC 2397:                         DataHandler オブジェクト.
                                                             (line    9)
* RFC; RFC 2449:                         POP3 オブジェクト.  (line   25)
* RFC; RFC 2487:                         新しいモジュールと改良されたモジュール<3>.
                                                             (line   86)
* RFC; RFC 2518:                         HTTP ステータスコード.
                                                             (line   19)
* RFC; RFC 2595:                         poplib --- POP3 プロトコルクライアント.
                                                             (line   14)
* RFC; RFC 2595 <1>:                     POP3 オブジェクト.  (line  116)
* RFC; RFC 2616:                         PEP 3333 Python Web Server Gateway Interface v1 0 1.
                                                             (line   20)
* RFC; RFC 2616 <1>:                     wsgiref util -- WSGI environment utilities.
                                                             (line  114)
* RFC; RFC 2616 <2>:                     wsgiref validate --- WSGI conformance checker.
                                                             (line   26)
* RFC; RFC 2616 <3>:                     HTTPRedirectHandler オブジェクト.
                                                             (line    8)
* RFC; RFC 2616 <4>:                     HTTPRedirectHandler オブジェクト.
                                                             (line   27)
* RFC; RFC 2616 <5>:                     HTTPRedirectHandler オブジェクト.
                                                             (line   28)
* RFC; RFC 2616 <6>:                     urllib error --- urllib request によって送出される例外クラス.
                                                             (line   45)
* RFC; RFC 2616 <7>:                     はじめに<17>.       (line   32)
* RFC; RFC 2616 <8>:                     HTTPError.          (line   15)
* RFC; RFC 2616 <9>:                     エラーコード.       (line   11)
* RFC; RFC 2616 Section 14.23:           HTTPConnection オブジェクト.
                                                             (line   31)
* RFC; RFC 2616 Section 5.1.2:           HTTPConnection オブジェクト.
                                                             (line   13)
* RFC; RFC 2616 Section 5.1.2 <1>:       HTTPConnection オブジェクト.
                                                             (line   32)
* RFC; RFC 2640:                         Python API の変更<5>.
                                                             (line   36)
* RFC; RFC 2640 <1>:                     テスト<45>.         (line   22)
* RFC; RFC 2640 <2>:                     ftplib --- FTP プロトコルクライアント.
                                                             (line   18)
* RFC; RFC 2640 <3>:                     FTP オブジェクト.   (line   64)
* RFC; RFC 2640 <4>:                     FTP_TLS オブジェクト.
                                                             (line   65)
* RFC; RFC 2732:                         urllib parse<6>.    (line    9)
* RFC; RFC 2732 <1>:                     新しいモジュールと改良されたモジュール.
                                                             (line  631)
* RFC; RFC 2732 <2>:                     URL のクオート.     (line  170)
* RFC; RFC 2774:                         HTTP ステータスコード.
                                                             (line  193)
* RFC; RFC 2818:                         ssl<13>.            (line   17)
* RFC; RFC 2821:                         email --- 電子メールと MIME 処理のためのパッケージ.
                                                             (line   12)
* RFC; RFC 2822:                         新しいモジュールと改良されたモジュール<3>.
                                                             (line   98)
* RFC; RFC 2822 <1>:                     関数<5>.            (line  746)
* RFC; RFC 2822 <2>:                     関数<5>.            (line  759)
* RFC; RFC 2822 <3>:                     関数<5>.            (line  776)
* RFC; RFC 2822 <4>:                     email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  276)
* RFC; RFC 2822 <5>:                     email header 国際化されたヘッダー.
                                                             (line   18)
* RFC; RFC 2822 <6>:                     email header 国際化されたヘッダー.
                                                             (line   20)
* RFC; RFC 2822 <7>:                     email header 国際化されたヘッダー.
                                                             (line   28)
* RFC; RFC 2822 <8>:                     email header 国際化されたヘッダー.
                                                             (line   85)
* RFC; RFC 2822 <9>:                     email header 国際化されたヘッダー.
                                                             (line  112)
* RFC; RFC 2822 <10>:                    email header 国際化されたヘッダー.
                                                             (line  130)
* RFC; RFC 2822 <11>:                    email utils Miscellaneous utilities.
                                                             (line   29)
* RFC; RFC 2822 <12>:                    email utils Miscellaneous utilities.
                                                             (line  109)
* RFC; RFC 2822 <13>:                    email utils Miscellaneous utilities.
                                                             (line  112)
* RFC; RFC 2822 <14>:                    email utils Miscellaneous utilities.
                                                             (line  241)
* RFC; RFC 2822 <15>:                    email utils Miscellaneous utilities.
                                                             (line  154)
* RFC; RFC 2964:                         http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line  156)
* RFC; RFC 2965:                         urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  277)
* RFC; RFC 2965 <1>:                     urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  286)
* RFC; RFC 2965 <2>:                     Request オブジェクト.
                                                             (line   50)
* RFC; RFC 2965 <3>:                     http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line   16)
* RFC; RFC 2965 <4>:                     http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line  102)
* RFC; RFC 2965 <5>:                     http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line  115)
* RFC; RFC 2965 <6>:                     http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line  144)
* RFC; RFC 2965 <7>:                     http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line  147)
* RFC; RFC 2965 <8>:                     http cookiejar --- HTTP クライアント用の Cookie 処理.
                                                             (line  154)
* RFC; RFC 2965 <9>:                     FileCookieJar のサブクラスと web ブラウザとの連携.
                                                             (line   16)
* RFC; RFC 2965 <10>:                    CookiePolicy オブジェクト.
                                                             (line   77)
* RFC; RFC 2965 <11>:                    CookiePolicy オブジェクト.
                                                             (line   82)
* RFC; RFC 2965 <12>:                    DefaultCookiePolicy オブジェクト.
                                                             (line    8)
* RFC; RFC 2965 <13>:                    DefaultCookiePolicy オブジェクト.
                                                             (line   89)
* RFC; RFC 2965 <14>:                    DefaultCookiePolicy オブジェクト.
                                                             (line  101)
* RFC; RFC 2965 <15>:                    DefaultCookiePolicy オブジェクト.
                                                             (line  106)
* RFC; RFC 2965 <16>:                    DefaultCookiePolicy オブジェクト.
                                                             (line  114)
* RFC; RFC 2965 <17>:                    DefaultCookiePolicy オブジェクト.
                                                             (line  151)
* RFC; RFC 2965 <18>:                    Cookieオブジェクト<2>.
                                                             (line   22)
* RFC; RFC 2965 <19>:                    使用例<42>.         (line   23)
* RFC; RFC 3056:                         Address オブジェクト.
                                                             (line  314)
* RFC; RFC 3164:                         RFC5424 をサポートする syslog へのロギング.
                                                             (line    7)
* RFC; RFC 3171:                         Address オブジェクト.
                                                             (line   95)
* RFC; RFC 3207:                         新しいモジュールと改良されたモジュール<2>.
                                                             (line  587)
* RFC; RFC 3229:                         HTTP ステータスコード.
                                                             (line   52)
* RFC; RFC 3280:                         SSL ソケット.       (line  159)
* RFC; RFC 3330:                         Address オブジェクト.
                                                             (line  181)
* RFC; RFC 3339:                         メッセージ内での日付と時刻の表示.
                                                             (line   17)
* RFC; RFC 3362:                         mimetypes.          (line   41)
* RFC; RFC 3454:                         セキュリティ<26>.   (line   19)
* RFC; RFC 3454 <1>:                     stringprep --- インターネットの文字列調製.
                                                             (line   17)
* RFC; RFC 3454 <2>:                     stringprep --- インターネットの文字列調製.
                                                             (line   26)
* RFC; RFC 3490:                         テキストエンコーディング.
                                                             (line   14)
* RFC; RFC 3490 <1>:                     encodings idna --- Internationalized Domain Names in Applications.
                                                             (line    6)
* RFC; RFC 3490 <2>:                     encodings idna --- Internationalized Domain Names in Applications.
                                                             (line   55)
* RFC; RFC 3490 <3>:                     encodings idna --- Internationalized Domain Names in Applications.
                                                             (line   60)
* RFC; RFC 3490 Section 3.1:             encodings idna --- Internationalized Domain Names in Applications.
                                                             (line   27)
* RFC; RFC 3491:                         セキュリティ<26>.   (line   21)
* RFC; RFC 3492:                         テキストエンコーディング.
                                                             (line   37)
* RFC; RFC 3492 <1>:                     encodings idna --- Internationalized Domain Names in Applications.
                                                             (line    7)
* RFC; RFC 3493:                         使用例<27>.         (line  227)
* RFC; RFC 3501:                         IMAP4 オブジェクト. (line  419)
* RFC; RFC 3542:                         ライブラリ<162>.    (line  351)
* RFC; RFC 3542 <1>:                     その他の関数<2>.    (line  338)
* RFC; RFC 3548:                         新たなモジュール、改良されたモジュール、非推奨のモジュール<3>.
                                                             (line   15)
* RFC; RFC 3548 <1>:                     binascii --- バイナリ と ASCII 間の変換.
                                                             (line   52)
* RFC; RFC 3548 <2>:                     binascii --- バイナリ と ASCII 間の変換.
                                                             (line   67)
* RFC; RFC 3596 Section 2.5:             ライブラリ<46>.     (line  340)
* RFC; RFC 3659:                         FTP オブジェクト.   (line  286)
* RFC; RFC 3745:                         mimetypes.          (line   43)
* RFC; RFC 3879:                         Address オブジェクト.
                                                             (line  177)
* RFC; RFC 3879 <1>:                     Address オブジェクト.
                                                             (line  294)
* RFC; RFC 3927:                         Address オブジェクト.
                                                             (line  186)
* RFC; RFC 3950:                         mimetypes.          (line   46)
* RFC; RFC 3986:                         urllib parse.       (line   17)
* RFC; RFC 3986 <1>:                     urllib parse<3>.    (line    7)
* RFC; RFC 3986 <2>:                     urllib parse<4>.    (line    7)
* RFC; RFC 3986 <3>:                     urllib parse<5>.    (line    6)
* RFC; RFC 3986 <4>:                     urllib<4>.          (line   22)
* RFC; RFC 3986 <5>:                     新しいモジュールと改良されたモジュール.
                                                             (line  610)
* RFC; RFC 3986 <6>:                     Python 2 7 への移植.
                                                             (line   76)
* RFC; RFC 3986 <7>:                     ライブラリ<42>.     (line  197)
* RFC; RFC 3986 <8>:                     urllib parse --- URL を構成要素に解析する.
                                                             (line   35)
* RFC; RFC 3986 <9>:                     URL の解析.         (line  116)
* RFC; RFC 3986 <10>:                    URL の解析.         (line  142)
* RFC; RFC 3986 <11>:                    URL の解析.         (line  274)
* RFC; RFC 3986 <12>:                    URL の解析.         (line  321)
* RFC; RFC 3986 <13>:                    URL parsing security.
                                                             (line   25)
* RFC; RFC 3986 <14>:                    URL のクオート.     (line   23)
* RFC; RFC 3986 <15>:                    URL のクオート.     (line  162)
* RFC; RFC 3986 <16>:                    http server --- HTTP サーバー.
                                                             (line  150)
* RFC; RFC 4007:                         Address オブジェクト.
                                                             (line  237)
* RFC; RFC 4007 <1>:                     Address オブジェクト.
                                                             (line  307)
* RFC; RFC 4047:                         mimetypes.          (line   49)
* RFC; RFC 4086:                         TLS 1 3.            (line   45)
* RFC; RFC 4122:                         新たなモジュール、改良されたモジュール、削除されたモジュール.
                                                             (line  414)
* RFC; RFC 4122 <1>:                     新たなモジュール、改良されたモジュール、削除されたモジュール.
                                                             (line  420)
* RFC; RFC 4122 <2>:                     uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   15)
* RFC; RFC 4122 <3>:                     uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  179)
* RFC; RFC 4122 <4>:                     uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  298)
* RFC; RFC 4122 <5>:                     uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  299)
* RFC; RFC 4180:                         csv --- CSV ファイルの読み書き.
                                                             (line   12)
* RFC; RFC 4193:                         Address オブジェクト.
                                                             (line  295)
* RFC; RFC 4217:                         FTP_TLS オブジェクト.
                                                             (line   11)
* RFC; RFC 4291:                         ライブラリ<64>.     (line 1075)
* RFC; RFC 4291 <1>:                     ライブラリ<116>.    (line  653)
* RFC; RFC 4291 <2>:                     Address オブジェクト.
                                                             (line  192)
* RFC; RFC 4291 <3>:                     Address オブジェクト.
                                                             (line  231)
* RFC; RFC 4337:                         mimetypes.          (line   60)
* RFC; RFC 4366:                         ssl<13>.            (line   26)
* RFC; RFC 4380:                         Address オブジェクト.
                                                             (line  321)
* RFC; RFC 4627:                         json --- JSON エンコーダーとデコーダー.
                                                             (line   10)
* RFC; RFC 4627 <1>:                     トップレベルの非オブジェクト、非配列の値の扱い.
                                                             (line    6)
* RFC; RFC 4648:                         ドキュメント<36>.   (line   32)
* RFC; RFC 4648 <1>:                     base64 --- Base16 Base32 Base64 Base85 データのエンコード.
                                                             (line   11)
* RFC; RFC 4648 <2>:                     base64 --- Base16 Base32 Base64 Base85 データのエンコード.
                                                             (line   18)
* RFC; RFC 4648 <3>:                     RFC 4648 エンコーディング.
                                                             (line    6)
* RFC; RFC 4648 <4>:                     RFC 4648 エンコーディング.
                                                             (line   90)
* RFC; RFC 4648 <5>:                     セキュリティで考慮すべき点<4>.
                                                             (line    6)
* RFC; RFC 4648 <6>:                     セキュリティで考慮すべき点<6>.
                                                             (line    8)
* RFC; RFC 4918:                         HTTP ステータスコード.
                                                             (line   46)
* RFC; RFC 4918 <1>:                     HTTP ステータスコード.
                                                             (line  142)
* RFC; RFC 4918 <2>:                     HTTP ステータスコード.
                                                             (line  145)
* RFC; RFC 4918 <3>:                     HTTP ステータスコード.
                                                             (line  187)
* RFC; RFC 4954:                         SMTP オブジェクト.  (line  129)
* RFC; RFC 4954 <1>:                     SMTP オブジェクト.  (line  152)
* RFC; RFC 5161:                         imaplib<3>.         (line   11)
* RFC; RFC 5161 <1>:                     IMAP4 オブジェクト. (line   86)
* RFC; RFC 5246:                         定数<9>.            (line  522)
* RFC; RFC 5246 <1>:                     TLS 1 3.            (line   53)
* RFC; RFC 5280:                         ssl<2>.             (line   10)
* RFC; RFC 5280 <1>:                     その他の変更.       (line   20)
* RFC; RFC 5280 <2>:                     Python API の変更<10>.
                                                             (line  100)
* RFC; RFC 5280 <3>:                     コンテキストの作成. (line   40)
* RFC; RFC 5280 <4>:                     コンテキストの作成. (line   65)
* RFC; RFC 5280 <5>:                     証明書の取り扱い.   (line   22)
* RFC; RFC 5280 <6>:                     TLS 1 3.            (line   49)
* RFC; RFC 5321:                         smtpd<4>.           (line    6)
* RFC; RFC 5321 <1>:                     email headerregistry Custom Header Objects.
                                                             (line  446)
* RFC; RFC 5322:                         バッテリー同梱.     (line   15)
* RFC; RFC 5322 <1>:                     関数<5>.            (line  746)
* RFC; RFC 5322 <2>:                     関数<5>.            (line  759)
* RFC; RFC 5322 <3>:                     関数<5>.            (line  458)
* RFC; RFC 5322 <4>:                     関数<5>.            (line  776)
* RFC; RFC 5322 <5>:                     email --- 電子メールと MIME 処理のためのパッケージ.
                                                             (line   14)
* RFC; RFC 5322 <6>:                     email message Representing an email message.
                                                             (line   20)
* RFC; RFC 5322 <7>:                     email message Representing an email message.
                                                             (line   31)
* RFC; RFC 5322 <8>:                     Parser API.         (line   41)
* RFC; RFC 5322 <9>:                     email generator Generating MIME documents.
                                                             (line  101)
* RFC; RFC 5322 <10>:                    email generator Generating MIME documents.
                                                             (line  194)
* RFC; RFC 5322 <11>:                    email policy Policy Objects.
                                                             (line  147)
* RFC; RFC 5322 <12>:                    email policy Policy Objects.
                                                             (line  341)
* RFC; RFC 5322 <13>:                    email policy Policy Objects.
                                                             (line  362)
* RFC; RFC 5322 <14>:                    email policy Policy Objects.
                                                             (line  368)
* RFC; RFC 5322 <15>:                    email policy Policy Objects.
                                                             (line  380)
* RFC; RFC 5322 <16>:                    email policy Policy Objects.
                                                             (line  413)
* RFC; RFC 5322 <17>:                    email errors Exception and Defect classes.
                                                             (line   28)
* RFC; RFC 5322 <18>:                    email headerregistry Custom Header Objects.
                                                             (line   15)
* RFC; RFC 5322 <19>:                    email headerregistry Custom Header Objects.
                                                             (line  115)
* RFC; RFC 5322 <20>:                    email headerregistry Custom Header Objects.
                                                             (line  120)
* RFC; RFC 5322 <21>:                    email headerregistry Custom Header Objects.
                                                             (line  122)
* RFC; RFC 5322 <22>:                    email headerregistry Custom Header Objects.
                                                             (line  136)
* RFC; RFC 5322 <23>:                    email headerregistry Custom Header Objects.
                                                             (line  156)
* RFC; RFC 5322 <24>:                    email headerregistry Custom Header Objects.
                                                             (line  410)
* RFC; RFC 5322 <25>:                    email headerregistry Custom Header Objects.
                                                             (line  443)
* RFC; RFC 5322 <26>:                    email headerregistry Custom Header Objects.
                                                             (line  477)
* RFC; RFC 5322 <27>:                    email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line   21)
* RFC; RFC 5322 <28>:                    Message オブジェクト.
                                                             (line   17)
* RFC; RFC 5322 <29>:                    http client --- HTTP プロトコルクライアント.
                                                             (line  119)
* RFC; RFC 5322 <30>:                    SMTP オブジェクト.  (line  306)
* RFC; RFC 5322 <31>:                    http server --- HTTP サーバー.
                                                             (line  165)
* RFC; RFC 5322 Section 2.2:             ライブラリ<28>.     (line  171)
* RFC; RFC 5334:                         mimetypes.          (line   62)
* RFC; RFC 5424:                         SysLogHandler.      (line   77)
* RFC; RFC 5424 <1>:                     SysLogHandler に送るメッセージに BOM を挿入する.
                                                             (line    6)
* RFC; RFC 5424 <2>:                     SysLogHandler に送るメッセージに BOM を挿入する.
                                                             (line   17)
* RFC; RFC 5424 <3>:                     SysLogHandler に送るメッセージに BOM を挿入する.
                                                             (line   41)
* RFC; RFC 5424 <4>:                     RFC5424 をサポートする syslog へのロギング.
                                                             (line    6)
* RFC; RFC 5424 Section 6:               SysLogHandler に送るメッセージに BOM を挿入する.
                                                             (line    8)
* RFC; RFC 5735:                         Address オブジェクト.
                                                             (line  161)
* RFC; RFC 5789:                         HTTP メソッド.      (line   37)
* RFC; RFC 5802:                         ssl<12>.            (line   30)
* RFC; RFC 5842:                         HTTP ステータスコード.
                                                             (line   49)
* RFC; RFC 5842 <1>:                     HTTP ステータスコード.
                                                             (line  190)
* RFC; RFC 5891:                         encodings idna --- Internationalized Domain Names in Applications.
                                                             (line   12)
* RFC; RFC 5894:                         セキュリティ<26>.   (line   20)
* RFC; RFC 5895:                         encodings idna --- Internationalized Domain Names in Applications.
                                                             (line   12)
* RFC; RFC 5929:                         SSL ソケット.       (line  265)
* RFC; RFC 6066:                         定数<9>.            (line  410)
* RFC; RFC 6066 <1>:                     SSL コンテキスト.   (line  288)
* RFC; RFC 6066 <2>:                     TLS 1 3.            (line   57)
* RFC; RFC 6152:                         smtpd<2>.           (line   15)
* RFC; RFC 6531:                         email<4>.           (line   19)
* RFC; RFC 6531 <1>:                     smtpd<2>.           (line   21)
* RFC; RFC 6531 <2>:                     smtplib<2>.         (line   15)
* RFC; RFC 6531 <3>:                     email message Representing an email message.
                                                             (line  103)
* RFC; RFC 6531 <4>:                     email policy Policy Objects.
                                                             (line  384)
* RFC; RFC 6531 <5>:                     smtplib --- SMTP プロトコルクライアント.
                                                             (line   68)
* RFC; RFC 6532:                         email<4>.           (line   18)
* RFC; RFC 6532 <1>:                     email --- 電子メールと MIME 処理のためのパッケージ.
                                                             (line   14)
* RFC; RFC 6532 <2>:                     email message Representing an email message.
                                                             (line   20)
* RFC; RFC 6532 <3>:                     Parser API.         (line   42)
* RFC; RFC 6532 <4>:                     email policy Policy Objects.
                                                             (line  382)
* RFC; RFC 6585:                         HTTP ステータスコード.
                                                             (line  154)
* RFC; RFC 6585 <1>:                     HTTP ステータスコード.
                                                             (line  157)
* RFC; RFC 6585 <2>:                     HTTP ステータスコード.
                                                             (line  160)
* RFC; RFC 6585 <3>:                     HTTP ステータスコード.
                                                             (line  196)
* RFC; RFC 6713:                         mimetypes.          (line   64)
* RFC; RFC 6855:                         imaplib<3>.         (line   12)
* RFC; RFC 6855 <1>:                     imaplib<3>.         (line   14)
* RFC; RFC 6855 <2>:                     IMAP4 オブジェクト. (line   88)
* RFC; RFC 6855 <3>:                     IMAP4 オブジェクト. (line   90)
* RFC; RFC 6856:                         poplib<2>.          (line    6)
* RFC; RFC 6856 <1>:                     POP3 オブジェクト.  (line  109)
* RFC; RFC 7159:                         json --- JSON エンコーダーとデコーダー.
                                                             (line   10)
* RFC; RFC 7159 <1>:                     標準への準拠と互換性.
                                                             (line    6)
* RFC; RFC 7159 <2>:                     トップレベルの非オブジェクト、非配列の値の扱い.
                                                             (line   10)
* RFC; RFC 7230:                         urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  247)
* RFC; RFC 7230 <1>:                     HTTPConnection オブジェクト.
                                                             (line  199)
* RFC; RFC 7301:                         Application-Layer Protocol Negotiation Support.
                                                             (line   10)
* RFC; RFC 7301 <1>:                     定数<9>.            (line  386)
* RFC; RFC 7301 <2>:                     SSL コンテキスト.   (line  258)
* RFC; RFC 7525:                         TLS 1 3.            (line   65)
* RFC; RFC 7538:                         ライブラリ<106>.    (line  171)
* RFC; RFC 7616:                         urllib.             (line    8)
* RFC; RFC 7616 <1>:                     ライブラリ<38>.     (line    8)
* RFC; RFC 7693:                         BLAKE2.             (line    6)
* RFC; RFC 7725:                         HTTP ステータスコード.
                                                             (line  163)
* RFC; RFC 7903:                         mimetypes.          (line   51)
* RFC; RFC 7914:                         鍵導出.             (line   52)
* RFC; RFC 8081:                         mimetypes.          (line   15)
* RFC; RFC 8089:                         URIのパースと生成.  (line    7)
* RFC; RFC 8089 Section 3:               urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  184)
* RFC; RFC 821:                          smtplib --- SMTP プロトコルクライアント.
                                                             (line   12)
* RFC; RFC 821 <1>:                      smtplib --- SMTP プロトコルクライアント.
                                                             (line  196)
* RFC; RFC 822:                          新しいモジュールと改良されたモジュール<3>.
                                                             (line   98)
* RFC; RFC 822 <1>:                      関数<5>.            (line  739)
* RFC; RFC 822 <2>:                      関数<5>.            (line  742)
* RFC; RFC 822 <3>:                      関数<5>.            (line  752)
* RFC; RFC 822 <4>:                      関数<5>.            (line  755)
* RFC; RFC 822 <5>:                      関数<5>.            (line  769)
* RFC; RFC 822 <6>:                      関数<5>.            (line  772)
* RFC; RFC 822 <7>:                      email 使用例.       (line   36)
* RFC; RFC 822 <8>:                      email header 国際化されたヘッダー.
                                                             (line   19)
* RFC; RFC 822 <9>:                      HTTPConnection オブジェクト.
                                                             (line  186)
* RFC; RFC 822 <10>:                     SMTP オブジェクト.  (line   91)
* RFC; RFC 822 <11>:                     SMTP オブジェクト.  (line  224)
* RFC; RFC 822 <12>:                     SMTP オブジェクト.  (line  225)
* RFC; RFC 822 <13>:                     SMTP 使用例.        (line   10)
* RFC; RFC 822 <14>:                     GNUTranslations クラス.
                                                             (line   13)
* RFC; RFC 8297:                         HTTP ステータスコード.
                                                             (line   22)
* RFC; RFC 8305:                         ネットワーク接続の確立.
                                                             (line   75)
* RFC; RFC 8305 <1>:                     ネットワーク接続の確立.
                                                             (line   84)
* RFC; RFC 8470:                         HTTP ステータスコード.
                                                             (line  148)
* RFC; RFC 850:                          ライブラリ<40>.     (line  212)
* RFC; RFC 9110:                         ライブラリ<40>.     (line  212)
* RFC; RFC 9110 <1>:                     HTTP ステータスコード.
                                                             (line   13)
* RFC; RFC 9110 <2>:                     HTTP ステータスコード.
                                                             (line   16)
* RFC; RFC 9110 <3>:                     HTTP ステータスコード.
                                                             (line   25)
* RFC; RFC 9110 <4>:                     HTTP ステータスコード.
                                                             (line   28)
* RFC; RFC 9110 <5>:                     HTTP ステータスコード.
                                                             (line   31)
* RFC; RFC 9110 <6>:                     HTTP ステータスコード.
                                                             (line   34)
* RFC; RFC 9110 <7>:                     HTTP ステータスコード.
                                                             (line   37)
* RFC; RFC 9110 <8>:                     HTTP ステータスコード.
                                                             (line   40)
* RFC; RFC 9110 <9>:                     HTTP ステータスコード.
                                                             (line   43)
* RFC; RFC 9110 <10>:                    HTTP ステータスコード.
                                                             (line   55)
* RFC; RFC 9110 <11>:                    HTTP ステータスコード.
                                                             (line   58)
* RFC; RFC 9110 <12>:                    HTTP ステータスコード.
                                                             (line   61)
* RFC; RFC 9110 <13>:                    HTTP ステータスコード.
                                                             (line   64)
* RFC; RFC 9110 <14>:                    HTTP ステータスコード.
                                                             (line   67)
* RFC; RFC 9110 <15>:                    HTTP ステータスコード.
                                                             (line   70)
* RFC; RFC 9110 <16>:                    HTTP ステータスコード.
                                                             (line   73)
* RFC; RFC 9110 <17>:                    HTTP ステータスコード.
                                                             (line   76)
* RFC; RFC 9110 <18>:                    HTTP ステータスコード.
                                                             (line   79)
* RFC; RFC 9110 <19>:                    HTTP ステータスコード.
                                                             (line   82)
* RFC; RFC 9110 <20>:                    HTTP ステータスコード.
                                                             (line   85)
* RFC; RFC 9110 <21>:                    HTTP ステータスコード.
                                                             (line   88)
* RFC; RFC 9110 <22>:                    HTTP ステータスコード.
                                                             (line   91)
* RFC; RFC 9110 <23>:                    HTTP ステータスコード.
                                                             (line   94)
* RFC; RFC 9110 <24>:                    HTTP ステータスコード.
                                                             (line   97)
* RFC; RFC 9110 <25>:                    HTTP ステータスコード.
                                                             (line  100)
* RFC; RFC 9110 <26>:                    HTTP ステータスコード.
                                                             (line  103)
* RFC; RFC 9110 <27>:                    HTTP ステータスコード.
                                                             (line  106)
* RFC; RFC 9110 <28>:                    HTTP ステータスコード.
                                                             (line  109)
* RFC; RFC 9110 <29>:                    HTTP ステータスコード.
                                                             (line  112)
* RFC; RFC 9110 <30>:                    HTTP ステータスコード.
                                                             (line  115)
* RFC; RFC 9110 <31>:                    HTTP ステータスコード.
                                                             (line  118)
* RFC; RFC 9110 <32>:                    HTTP ステータスコード.
                                                             (line  121)
* RFC; RFC 9110 <33>:                    HTTP ステータスコード.
                                                             (line  124)
* RFC; RFC 9110 <34>:                    HTTP ステータスコード.
                                                             (line  127)
* RFC; RFC 9110 <35>:                    HTTP ステータスコード.
                                                             (line  130)
* RFC; RFC 9110 <36>:                    HTTP ステータスコード.
                                                             (line  136)
* RFC; RFC 9110 <37>:                    HTTP ステータスコード.
                                                             (line  139)
* RFC; RFC 9110 <38>:                    HTTP ステータスコード.
                                                             (line  151)
* RFC; RFC 9110 <39>:                    HTTP ステータスコード.
                                                             (line  166)
* RFC; RFC 9110 <40>:                    HTTP ステータスコード.
                                                             (line  169)
* RFC; RFC 9110 <41>:                    HTTP ステータスコード.
                                                             (line  172)
* RFC; RFC 9110 <42>:                    HTTP ステータスコード.
                                                             (line  175)
* RFC; RFC 9110 <43>:                    HTTP ステータスコード.
                                                             (line  178)
* RFC; RFC 9110 <44>:                    HTTP ステータスコード.
                                                             (line  181)
* RFC; RFC 9110 <45>:                    HTTP ステータスコードカテゴリ.
                                                             (line   15)
* RFC; RFC 9110 <46>:                    HTTP ステータスコードカテゴリ.
                                                             (line   18)
* RFC; RFC 9110 <47>:                    HTTP ステータスコードカテゴリ.
                                                             (line   21)
* RFC; RFC 9110 <48>:                    HTTP ステータスコードカテゴリ.
                                                             (line   24)
* RFC; RFC 9110 <49>:                    HTTP ステータスコードカテゴリ.
                                                             (line   27)
* RFC; RFC 9110 <50>:                    HTTP メソッド.      (line   13)
* RFC; RFC 9110 <51>:                    HTTP メソッド.      (line   16)
* RFC; RFC 9110 <52>:                    HTTP メソッド.      (line   19)
* RFC; RFC 9110 <53>:                    HTTP メソッド.      (line   22)
* RFC; RFC 9110 <54>:                    HTTP メソッド.      (line   25)
* RFC; RFC 9110 <55>:                    HTTP メソッド.      (line   28)
* RFC; RFC 9110 <56>:                    HTTP メソッド.      (line   31)
* RFC; RFC 9110 <57>:                    HTTP メソッド.      (line   34)
* RFC; RFC 9239:                         ライブラリ<87>.     (line   74)
* RFC; RFC 9512:                         mimetypes.          (line   68)
* RFC; RFC 9512 <1>:                     ライブラリ<24>.     (line  274)
* RFC; RFC 9559:                         mimetypes.          (line   27)
* RFC; RFC 9559 <1>:                     ライブラリ<42>.     (line  105)
* RFC; RFC 9562:                         uuid.               (line    8)
* RFC; RFC 9562 <1>:                     uuid.               (line   12)
* RFC; RFC 9562 <2>:                     ライブラリ<30>.     (line  256)
* RFC; RFC 9562 <3>:                     ライブラリ<30>.     (line  259)
* RFC; RFC 9562 <4>:                     ライブラリ<33>.     (line  174)
* RFC; RFC 9562 <5>:                     ライブラリ<42>.     (line  373)
* RFC; RFC 9562 <6>:                     uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line    6)
* RFC; RFC 9562 <7>:                     uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   14)
* RFC; RFC 9562 <8>:                     uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   75)
* RFC; RFC 9562 <9>:                     uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  150)
* RFC; RFC 9562 <10>:                    uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  300)
* RFC; RFC 9562 <11>:                    uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  329)
* RFC; RFC 9562 Section 5.1:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  194)
* RFC; RFC 9562 Section 5.10:            uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  322)
* RFC; RFC 9562 Section 5.3:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  208)
* RFC; RFC 9562 Section 5.4:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  214)
* RFC; RFC 9562 Section 5.5:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  220)
* RFC; RFC 9562 Section 5.6:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  226)
* RFC; RFC 9562 Section 5.7:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  243)
* RFC; RFC 9562 Section 5.8:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  253)
* RFC; RFC 9562 Section 5.9:             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  315)
* RFC; RFC 9562 Section 6.10-3:          ライブラリ<19>.     (line   33)
* RFC; RFC 959:                          ftplib --- FTP プロトコルクライアント.
                                                             (line   16)
* RFC; RFC 9639:                         mimetypes.          (line   66)
* rfc2109 (http.cookiejar.Cookie の属性): Cookieオブジェクト<2>.
                                                             (line   73)
* rfc2109_as_netscape (http.cookiejar.DefaultCookiePolicy の属性): DefaultCookiePolicy オブジェクト.
                                                             (line   82)
* rfc2965 (http.cookiejar.CookiePolicy の属性): CookiePolicy オブジェクト.
                                                             (line   75)
* rfile (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  167)
* rfile (socketserver.DatagramRequestHandler の属性): Request Handler Objects.
                                                             (line   62)
* rfind() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  215)
* rfind() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  215)
* rfind() (mmap.mmap のメソッド):        mmap --- メモリマップファイルのサポート.
                                                             (line  287)
* rfind() (str のメソッド):              文字列メソッド<2>.  (line  583)
* rgb_to_hls() (colorsys モジュール):    colorsys --- 色体系間の変換.
                                                             (line   36)
* rgb_to_hsv() (colorsys モジュール):    colorsys --- 色体系間の変換.
                                                             (line   44)
* rgb_to_yiq() (colorsys モジュール):    colorsys --- 色体系間の変換.
                                                             (line   28)
* rglob() (pathlib.Path のメソッド):     ディレクトリを読む. (line   81)
* richcmpfunc (C type):                  Slot Type typedefs. (line   90)
* right (filecmp.dircmp の属性):         dircmp クラス.      (line   48)
* right_list (filecmp.dircmp の属性):    dircmp クラス.      (line   57)
* right_only (filecmp.dircmp の属性):    dircmp クラス.      (line   71)
* right() (turtle モジュール):           Turtle の動き.      (line   40)
* RIGHTSHIFT (token モジュール):         token --- Python 解析木で使われる定数.
                                                             (line  284)
* RIGHTSHIFTEQUAL (token モジュール):    token --- Python 解析木で使われる定数.
                                                             (line  317)
* rindex() (bytearray のメソッド):       bytes と bytearray の操作.
                                                             (line  229)
* rindex() (bytes のメソッド):           bytes と bytearray の操作.
                                                             (line  229)
* rindex() (str のメソッド):             文字列メソッド<2>.  (line  597)
* rjust() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  345)
* rjust() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  345)
* rjust() (str のメソッド):              文字列メソッド<2>.  (line  613)
* RLIM_INFINITY (resource モジュール):   リソースの制限.     (line   22)
* RLIMIT_AS (resource モジュール):       リソースの制限.     (line  151)
* RLIMIT_CORE (resource モジュール):     リソースの制限.     (line   94)
* RLIMIT_CPU (resource モジュール):      リソースの制限.     (line  101)
* RLIMIT_DATA (resource モジュール):     リソースの制限.     (line  113)
* RLIMIT_FSIZE (resource モジュール):    リソースの制限.     (line  109)
* RLIMIT_KQUEUES (resource モジュール):  リソースの制限.     (line  225)
* RLIMIT_MEMLOCK (resource モジュール):  リソースの制限.     (line  140)
* RLIMIT_MSGQUEUE (resource モジュール): リソースの制限.     (line  155)
* RLIMIT_NICE (resource モジュール):     リソースの制限.     (line  163)
* RLIMIT_NOFILE (resource モジュール):   リソースの制限.     (line  132)
* RLIMIT_NPROC (resource モジュール):    リソースの制限.     (line  128)
* RLIMIT_NPTS (resource モジュール):     リソースの制限.     (line  217)
* RLIMIT_OFILE (resource モジュール):    リソースの制限.     (line  136)
* RLIMIT_RSS (resource モジュール):      リソースの制限.     (line  123)
* RLIMIT_RTPRIO (resource モジュール):   リソースの制限.     (line  171)
* RLIMIT_RTTIME (resource モジュール):   リソースの制限.     (line  179)
* RLIMIT_SBSIZE (resource モジュール):   リソースの制限.     (line  196)
* RLIMIT_SIGPENDING (resource モジュール): リソースの制限.   (line  188)
* RLIMIT_STACK (resource モジュール):    リソースの制限.     (line  117)
* RLIMIT_SWAP (resource モジュール):     リソースの制限.     (line  206)
* RLIMIT_VMEM (resource モジュール):     リソースの制限.     (line  144)
* RLock (multiprocessing のクラス):      同期プリミティブ.   (line  126)
* RLock (threading のクラス):            RLock objects.      (line   33)
* RLock() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  206)
* rmd() (ftplib.FTP のメソッド):         FTP オブジェクト.   (line  346)
* rmdir() (os モジュール):               ファイルとディレクトリ.
                                                             (line  842)
* rmdir() (pathlib.Path のメソッド):     Copying moving and deleting.
                                                             (line  121)
* rmdir() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line  112)
* rmtree() (shutil モジュール):          ディレクトリとファイルの操作.
                                                             (line  280)
* rmtree() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line  119)
* RobotFileParser (urllib.robotparser のクラス): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   16)
* robots.txt:                            urllib robotparser --- robots txt 用のパーサー.
                                                             (line    8)
* rollback() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line   81)
* rollover() (tempfile.SpooledTemporaryFile のメソッド): tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  161)
* ROMAN (tkinter.font モジュール):       tkinter font --- Tkinter フォントラッパー.
                                                             (line   15)
* root (pathlib.PurePath の属性):        メソッドとプロパティ.
                                                             (line   31)
* rotate() (collections.deque のメソッド): deque オブジェクト.
                                                             (line  110)
* rotate() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  511)
* rotate() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  518)
* rotate() (logging.handlers.BaseRotatingHandler のメソッド): BaseRotatingHandler.
                                                             (line   75)
* RotatingFileHandler (logging.handlers のクラス): RotatingFileHandler.
                                                             (line    9)
* rotation_filename() (logging.handlers.BaseRotatingHandler のメソッド): BaseRotatingHandler.
                                                             (line   57)
* rotator (logging.handlers.BaseRotatingHandler の属性): BaseRotatingHandler.
                                                             (line   49)
* ROUND_05UP (decimal モジュール):       丸めモード.         (line   34)
* ROUND_CEILING (decimal モジュール):    丸めモード.         (line    6)
* ROUND_DOWN (decimal モジュール):       丸めモード.         (line   10)
* ROUND_FLOOR (decimal モジュール):      丸めモード.         (line   14)
* ROUND_HALF_DOWN (decimal モジュール):  丸めモード.         (line   18)
* ROUND_HALF_EVEN (decimal モジュール):  丸めモード.         (line   22)
* ROUND_HALF_UP (decimal モジュール):    丸めモード.         (line   26)
* ROUND_UP (decimal モジュール):         丸めモード.         (line   30)
* Rounded (decimal のクラス):            シグナル.           (line   80)
* rounding (decimal.Context の属性):     Context オブジェクト.
                                                             (line  131)
* rounds (sys.float_info の属性):        sys --- システム固有のパラメーターと関数.
                                                             (line  691)
* Row (sqlite3 のクラス):                Row オブジェクト.   (line    6)
* row_factory (sqlite3.Connection の属性): Connection オブジェクト.
                                                             (line  811)
* row_factory (sqlite3.Cursor の属性):   Cursor オブジェクト.
                                                             (line  229)
* rowcount (sqlite3.Cursor の属性):      Cursor オブジェクト.
                                                             (line  220)
* RPAR (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  206)
* rpartition() (bytearray のメソッド):   bytes と bytearray の操作.
                                                             (line  241)
* rpartition() (bytes のメソッド):       bytes と bytearray の操作.
                                                             (line  241)
* rpartition() (str のメソッド):         文字列メソッド<2>.  (line  619)
* rpc_paths (xmlrpc.server.SimpleXMLRPCRequestHandler の属性): SimpleXMLRPCServer オブジェクト.
                                                             (line   62)
* rpop() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   45)
* RS (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  114)
* rset() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   74)
* RShift (ast のクラス):                 式 expression<2>.   (line   55)
* rshift() (operator モジュール):        operator --- 関数形式の標準演算子.
                                                             (line  160)
* rsplit() (bytearray のメソッド):       bytes と bytearray の操作.
                                                             (line  357)
* rsplit() (bytes のメソッド):           bytes と bytearray の操作.
                                                             (line  357)
* rsplit() (str のメソッド):             文字列メソッド<2>.  (line  637)
* RSQB (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  212)
* rstrip() (bytearray のメソッド):       bytes と bytearray の操作.
                                                             (line  368)
* rstrip() (bytes のメソッド):           bytes と bytearray の操作.
                                                             (line  368)
* rstrip() (str のメソッド):             文字列メソッド<2>.  (line  646)
* rt() (turtle モジュール):              Turtle の動き.      (line   40)
* RTLD_DEEPBIND (os モジュール):         雑多なシステム情報. (line  163)
* RTLD_GLOBAL (os モジュール):           雑多なシステム情報. (line  163)
* RTLD_LAZY (os モジュール):             雑多なシステム情報. (line  163)
* RTLD_LOCAL (os モジュール):            雑多なシステム情報. (line  163)
* RTLD_NODELETE (os モジュール):         雑多なシステム情報. (line  163)
* RTLD_NOLOAD (os モジュール):           雑多なシステム情報. (line  163)
* RTLD_NOW (os モジュール):              雑多なシステム情報. (line  163)
* ruler (cmd.Cmd の属性):                Cmdオブジェクト.    (line  170)
* run (pdb command):                     Debugger commands.  (line  422)
* Run script:                            Format メニュー Shell ウィンドウ、Editor ウィンドウ.
                                                             (line   56)
* run_concurrently() (test.support.threading_helper モジュール): test support threading_helper --- Utilities for threading tests.
                                                             (line   82)
* run_coroutine_threadsafe() (asyncio モジュール): 外部スレッドからのスケジュール.
                                                             (line    6)
* run_docstring_examples() (doctest モジュール): 基本 API.   (line  132)
* run_forever() (asyncio.loop のメソッド): ループの開始と停止.
                                                             (line   17)
* run_in_executor() (asyncio.loop のメソッド): スレッドまたはプロセスプールでコードを実行する.
                                                             (line    6)
* run_in_subinterp() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  698)
* run_module() (runpy モジュール):       runpy --- Python モジュールの位置特定と実行.
                                                             (line   26)
* run_path() (runpy モジュール):         runpy --- Python モジュールの位置特定と実行.
                                                             (line   97)
* run_python_until_end() (test.support.script_helper モジュール): test support script_helper --- Utilities for the Python execution tests.
                                                             (line   30)
* run_script() (modulefinder.ModuleFinder のメソッド): modulefinder --- スクリプト中で使用されているモジュールの検索.
                                                             (line   46)
* run_until_complete() (asyncio.loop のメソッド): ループの開始と停止.
                                                             (line    6)
* run_with_locale() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  488)
* run_with_tz() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  495)
* run() (asyncio モジュール):            非同期プログラムの実行.
                                                             (line    6)
* run() (asyncio.Runner のメソッド):     Runner context manager.
                                                             (line   37)
* run() (bdb.Bdb のメソッド):            bdb --- デバッガーフレームワーク.
                                                             (line  484)
* run() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line   64)
* run() (doctest.DocTestRunner のメソッド): DocTestRunner オブジェクト.
                                                             (line  103)
* run() (multiprocessing.Process のメソッド): Process クラスと例外.
                                                             (line   68)
* run() (pdb モジュール):                コマンドライン・インターフェース<8>.
                                                             (line   84)
* run() (pdb.Pdb のメソッド):            コマンドライン・インターフェース<8>.
                                                             (line  242)
* run() (profile モジュール):            profile and cProfile Module Reference.
                                                             (line    9)
* run() (profile.Profile のメソッド):    profile and cProfile Module Reference.
                                                             (line  106)
* run() (sched.scheduler のメソッド):    スケジューラオブジェクト.
                                                             (line   50)
* run() (subprocess モジュール):         Using the subprocess Module.
                                                             (line   10)
* run() (threading.Thread のメソッド):   Thread objects.     (line  130)
* run() (trace.Trace のメソッド):        プログラミングインターフェース.
                                                             (line   21)
* run() (unittest.IsolatedAsyncioTestCase のメソッド): テストクラス.
                                                             (line  963)
* run() (unittest.TestCase のメソッド):  テストクラス.       (line   85)
* run() (unittest.TestSuite のメソッド): テストのグループ化. (line   41)
* run() (unittest.TextTestRunner のメソッド): テストのロードと起動.
                                                             (line  500)
* run() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line   99)
* runcall() (bdb.Bdb のメソッド):        bdb --- デバッガーフレームワーク.
                                                             (line  500)
* runcall() (pdb モジュール):            コマンドライン・インターフェース<8>.
                                                             (line  103)
* runcall() (pdb.Pdb のメソッド):        コマンドライン・インターフェース<8>.
                                                             (line  242)
* runcall() (profile.Profile のメソッド): profile and cProfile Module Reference.
                                                             (line  115)
* runcode() (code.InteractiveInterpreter のメソッド): 対話的なインタプリタオブジェクト.
                                                             (line   33)
* runctx() (bdb.Bdb のメソッド):         bdb --- デバッガーフレームワーク.
                                                             (line  495)
* runctx() (profile モジュール):         profile and cProfile Module Reference.
                                                             (line   23)
* runctx() (profile.Profile のメソッド): profile and cProfile Module Reference.
                                                             (line  110)
* runctx() (trace.Trace のメソッド):     プログラミングインターフェース.
                                                             (line   27)
* runeval() (bdb.Bdb のメソッド):        bdb --- デバッガーフレームワーク.
                                                             (line  490)
* runeval() (pdb モジュール):            コマンドライン・インターフェース<8>.
                                                             (line   96)
* runeval() (pdb.Pdb のメソッド):        コマンドライン・インターフェース<8>.
                                                             (line  242)
* runfunc() (trace.Trace のメソッド):    プログラミングインターフェース.
                                                             (line   34)
* Runner (asyncio のクラス):             Runner context manager.
                                                             (line    6)
* running() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   27)
* runsource() (code.InteractiveInterpreter のメソッド): 対話的なインタプリタオブジェクト.
                                                             (line    6)
* runtime (sys._emscripten_info の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  347)
* runtime_checkable() (typing モジュール): Other special directives.
                                                             (line  184)
* RuntimeError:                          具象例外.           (line  256)
* RuntimeWarning:                        警告.               (line   50)
* RUSAGE_BOTH (resource モジュール):     リソースの使用状態. (line  123)
* RUSAGE_CHILDREN (resource モジュール): リソースの使用状態. (line  117)
* RUSAGE_SELF (resource モジュール):     リソースの使用状態. (line  111)
* RUSAGE_THREAD (resource モジュール):   リソースの使用状態. (line  129)
* RWF_APPEND (os モジュール):            ファイル記述子の操作.
                                                             (line  715)
* RWF_DSYNC (os モジュール):             ファイル記述子の操作.
                                                             (line  695)
* RWF_HIPRI (os モジュール):             ファイル記述子の操作.
                                                             (line  624)
* RWF_NOWAIT (os モジュール):            ファイル記述子の操作.
                                                             (line  610)
* RWF_SYNC (os モジュール):              ファイル記述子の操作.
                                                             (line  705)
* S (re モジュール):                     フラグ.             (line  103)
* S_ENFMT (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  323)
* S_IEXEC (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  337)
* S_IFBLK (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  211)
* S_IFCHR (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  219)
* S_IFDIR (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  215)
* S_IFDOOR (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  227)
* S_IFIFO (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  223)
* S_IFLNK (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  203)
* S_IFMT() (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line   83)
* S_IFPORT (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  233)
* S_IFREG (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  207)
* S_IFSOCK (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  199)
* S_IFWHT (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  239)
* S_IMODE() (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line   75)
* S_IREAD (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  329)
* S_IRGRP (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  295)
* S_IROTH (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  311)
* S_IRUSR (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  279)
* S_IRWXG (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  291)
* S_IRWXO (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  307)
* S_IRWXU (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  275)
* S_ISBLK() (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line   31)
* S_ISCHR() (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line   26)
* S_ISDIR() (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line   22)
* S_ISDOOR() (stat モジュール):          stat --- stat の結果を解釈する.
                                                             (line   54)
* S_ISFIFO() (stat モジュール):          stat --- stat の結果を解釈する.
                                                             (line   40)
* S_ISGID (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  256)
* S_ISLNK() (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line   45)
* S_ISPORT() (stat モジュール):          stat --- stat の結果を解釈する.
                                                             (line   60)
* S_ISREG() (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line   36)
* S_ISSOCK() (stat モジュール):          stat --- stat の結果を解釈する.
                                                             (line   50)
* S_ISUID (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  252)
* S_ISVTX (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  268)
* S_ISWHT() (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line   66)
* S_IWGRP (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  299)
* S_IWOTH (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  315)
* S_IWRITE (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  333)
* S_IWUSR (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  283)
* S_IXGRP (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  303)
* S_IXOTH (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  319)
* S_IXUSR (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  287)
* safe (uuid.SafeUUID の属性):           uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   37)
* safe_path (sys.flags の属性):          sys --- システム固有のパラメーターと関数.
                                                             (line  573)
* safe_substitute() (string.Template のメソッド): Template strings $-strings.
                                                             (line   60)
* saferepr() (pprint モジュール):        関数<4>.            (line   99)
* SafeUUID (uuid のクラス):              uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   33)
* same_files (filecmp.dircmp の属性):    dircmp クラス.      (line   88)
* same_quantum() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  515)
* same_quantum() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  528)
* samefile() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  467)
* samefile() (pathlib.Path のメソッド):  ファイルの種類とステータスを問い合わせる.
                                                             (line  155)
* SameFileError:                         ディレクトリとファイルの操作.
                                                             (line   67)
* sameopenfile() (os.path モジュール):   os path --- 一般的なパス名操作.
                                                             (line  482)
* samesite (http.cookies.Morsel の属性): Morselオブジェクト. (line   13)
* samestat() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  492)
* sample() (random モジュール):          シーケンス用の関数. (line   66)
* samples() (statistics.NormalDist のメソッド): NormalDist オブジェクト.
                                                             (line   58)
* SATURDAY (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  440)
* save() (http.cookiejar.FileCookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line  110)
* save() (test.support.SaveSignals のメソッド): test support --- Utilities for the Python test suite.
                                                             (line  809)
* save() (turtle モジュール):            Screen 独自のメソッド、TurtleScreen から継承したもの以外.
                                                             (line   20)
* SaveAs (tkinter.filedialog のクラス):  ネイティブの読み込み/保存ダイアログ.
                                                             (line   59)
* SAVEDCWD (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   14)
* SaveFileDialog (tkinter.filedialog のクラス): ネイティブの読み込み/保存ダイアログ.
                                                             (line  144)
* SaveKey() (winreg モジュール):         関数<14>.           (line  393)
* SaveSignals (test.support のクラス):   test support --- Utilities for the Python test suite.
                                                             (line  804)
* savetty() (curses モジュール):         関数<6>.            (line  446)
* SAX2DOM (xml.dom.pulldom のクラス):    xml dom pulldom --- 部分的な DOM ツリー構築のサポート.
                                                             (line   79)
* SAXException:                          xml sax --- SAX2 バーサーのサポート.
                                                             (line   88)
* SAXNotRecognizedException:             xml sax --- SAX2 バーサーのサポート.
                                                             (line  112)
* SAXNotSupportedException:              xml sax --- SAX2 バーサーのサポート.
                                                             (line  119)
* SAXParseException:                     xml sax --- SAX2 バーサーのサポート.
                                                             (line  104)
* scaleb() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  519)
* scaleb() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  538)
* scandir() (os モジュール):             ファイルとディレクトリ.
                                                             (line  860)
* scanf (C function):                    scanf をシミュレートする.
                                                             (line    6)
* SCHED_BATCH (os モジュール):           スケジューラーへのインターフェイス.
                                                             (line   19)
* SCHED_DEADLINE (os モジュール):        スケジューラーへのインターフェイス.
                                                             (line   24)
* SCHED_FIFO (os モジュール):            スケジューラーへのインターフェイス.
                                                             (line   45)
* sched_get_priority_max() (os モジュール): スケジューラーへのインターフェイス.
                                                             (line   78)
* sched_get_priority_min() (os モジュール): スケジューラーへのインターフェイス.
                                                             (line   73)
* sched_getaffinity() (os モジュール):   スケジューラーへのインターフェイス.
                                                             (line  124)
* sched_getparam() (os モジュール):      スケジューラーへのインターフェイス.
                                                             (line  102)
* sched_getscheduler() (os モジュール):  スケジューラーへのインターフェイス.
                                                             (line   90)
* SCHED_IDLE (os モジュール):            スケジューラーへのインターフェイス.
                                                             (line   30)
* SCHED_NORMAL (os モジュール):          スケジューラーへのインターフェイス.
                                                             (line   35)
* SCHED_OTHER (os モジュール):           スケジューラーへのインターフェイス.
                                                             (line   15)
* sched_param (os のクラス):             スケジューラーへのインターフェイス.
                                                             (line   60)
* sched_priority (os.sched_param の属性): スケジューラーへのインターフェイス.
                                                             (line   69)
* SCHED_RESET_ON_FORK (os モジュール):   スケジューラーへのインターフェイス.
                                                             (line   53)
* SCHED_RR (os モジュール):              スケジューラーへのインターフェイス.
                                                             (line   49)
* sched_rr_get_interval() (os モジュール): スケジューラーへのインターフェイス.
                                                             (line  108)
* sched_setaffinity() (os モジュール):   スケジューラーへのインターフェイス.
                                                             (line  118)
* sched_setparam() (os モジュール):      スケジューラーへのインターフェイス.
                                                             (line   96)
* sched_setscheduler() (os モジュール):  スケジューラーへのインターフェイス.
                                                             (line   83)
* SCHED_SPORADIC (os モジュール):        スケジューラーへのインターフェイス.
                                                             (line   41)
* sched_yield() (os モジュール):         スケジューラーへのインターフェイス.
                                                             (line  113)
* scheduler (sched のクラス):            sched --- イベントスケジューラー.
                                                             (line   13)
* SCM_CREDS2 (socket モジュール):        定数<8>.            (line  413)
* scope_id (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  305)
* Screen (turtle のクラス):              Public classes.     (line   30)
* screensize() (turtle モジュール):      ウィンドウの制御.   (line   88)
* script_from_examples() (doctest モジュール): デバッグ.     (line   73)
* scroll() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  493)
* ScrolledCanvas (turtle のクラス):      Public classes.     (line   35)
* ScrolledText (tkinter.scrolledtext のクラス): tkinter scrolledtext --- スクロール可能なテキストウィジェット.
                                                             (line   24)
* scrollok() (curses.window のメソッド): Window オブジェクト.
                                                             (line  497)
* scrypt() (hashlib モジュール):         鍵導出.             (line   49)
* seal() (unittest.mock モジュール):     Sealing mocks.      (line    6)
* search_function() (encodings モジュール): encodings --- Encodings package.
                                                             (line   23)
* search_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line   84)
* search() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  311)
* search() (re モジュール):              関数<2>.            (line   34)
* search() (re.Pattern のメソッド):      正規表現オブジェクト.
                                                             (line   15)
* second (datetime.datetime の属性):     datetime objects.   (line  328)
* second (datetime.time の属性):         time objects.       (line   58)
* seconds (datetime.timedelta の属性):   timedelta objects.  (line  111)
* SECTCRE (configparser.ConfigParser の属性): パーサーの振る舞いをカスタマイズする.
                                                             (line  289)
* sections() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  112)
* secure (http.cookiejar.Cookie の属性): Cookieオブジェクト<2>.
                                                             (line   48)
* secure (http.cookies.Morsel の属性):   Morselオブジェクト. (line   13)
* secure hash algorithm, SHA1, SHA2, SHA224, SHA256, SHA384, SHA512, SHA3, Shake, Blake2: hashlib --- セキュアハッシュとメッセージダイジェスト.
                                                             (line    8)
* Secure Sockets Layer:                  ssl --- ソケットオブジェクト用の TLS/SSL ラッパー.
                                                             (line    8)
* security considerations:               xdrlib --- Encode and decode XDR data.
                                                             (line   15)
* security_level (ssl.SSLContext の属性): SSL コンテキスト.  (line  625)
* see() (tkinter.ttk.Treeview のメソッド): ttk Treeview.     (line  240)
* seed_bits (sys.hash_info の属性):      sys --- システム固有のパラメーターと関数.
                                                             (line 1083)
* seed() (random モジュール):            保守 bookkeeping 関数.
                                                             (line    6)
* seed() (random.Random のメソッド):     他の生成器.         (line   19)
* SEEK_CUR (os モジュール):              ファイル記述子の操作.
                                                             (line  324)
* SEEK_DATA (os モジュール):             ファイル記述子の操作.
                                                             (line  348)
* SEEK_END (os モジュール):              ファイル記述子の操作.
                                                             (line  324)
* SEEK_HOLE (os モジュール):             ファイル記述子の操作.
                                                             (line  348)
* SEEK_SET (os モジュール):              ファイル記述子の操作.
                                                             (line  324)
* seek() (io.IOBase のメソッド):         I/O 基底クラス.     (line  105)
* seek() (io.TextIOBase のメソッド):     テキスト I/O<2>.    (line   64)
* seek() (io.TextIOWrapper のメソッド):  テキスト I/O<2>.    (line  204)
* seek() (mmap.mmap のメソッド):         mmap --- メモリマップファイルのサポート.
                                                             (line  297)
* seek() (sqlite3.Blob のメソッド):      Blob オブジェクト.  (line   66)
* seekable() (bz2.BZ2File のメソッド):   ファイルの圧縮/解凍.
                                                             (line   98)
* seekable() (io.IOBase のメソッド):     I/O 基底クラス.     (line  128)
* seekable() (mmap.mmap のメソッド):     mmap --- メモリマップファイルのサポート.
                                                             (line  308)
* select() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  328)
* select() (select モジュール):          select --- I/O 完了の待機.
                                                             (line  116)
* select() (selectors.BaseSelector のメソッド): クラス<4>.   (line  112)
* select() (tkinter.ttk.Notebook のメソッド): ttk Notebook.  (line   52)
* selected_alpn_protocol() (ssl.SSLSocket のメソッド): SSL ソケット.
                                                             (line  272)
* selected_npn_protocol() (ssl.SSLSocket のメソッド): SSL ソケット.
                                                             (line  282)
* selection_add() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  263)
* selection_remove() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  270)
* selection_set() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  256)
* selection_toggle() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  277)
* selection() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  248)
* selector (urllib.request.Request の属性): Request オブジェクト.
                                                             (line   34)
* SelectorEventLoop (asyncio のクラス):  イベントループの実装.
                                                             (line   11)
* SelectorKey (selectors のクラス):      クラス<4>.          (line   29)
* SelectSelector (selectors のクラス):   クラス<4>.          (line  170)
* Self (typing モジュール):              特殊型.             (line  138)
* Semaphore (asyncio のクラス):          Semaphore.          (line    6)
* Semaphore (multiprocessing のクラス):  同期プリミティブ.   (line  200)
* Semaphore (threading のクラス):        Semaphore objects.  (line   20)
* Semaphore() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  211)
* semaphores, binary:                    _thread --- 低水準なスレッド API.
                                                             (line    6)
* SEMI (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  221)
* SEND (opcode):                         Python バイトコード命令.
                                                             (line 1307)
* send_bytes() (multiprocessing.connection.Connection のメソッド): Connection オブジェクト<2>.
                                                             (line   55)
* send_error() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  265)
* send_fds() (socket モジュール):        その他の関数<2>.    (line  459)
* send_header() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  301)
* send_message() (smtplib.SMTP のメソッド): SMTP オブジェクト.
                                                             (line  296)
* send_response_only() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  313)
* send_response() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  285)
* send_signal() (asyncio.subprocess.Process のメソッド): サブプロセスとやりとりする.
                                                             (line   88)
* send_signal() (asyncio.SubprocessTransport のメソッド): サブプロセス化されたトランスポート.
                                                             (line   44)
* send_signal() (subprocess.Popen のメソッド): Popen オブジェクト.
                                                             (line   85)
* send() (coroutine のメソッド):         コルーチンオブジェクト.
                                                             (line   22)
* send() (generator のメソッド):         ジェネレータ-イテレータメソッド.
                                                             (line   27)
* send() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  218)
* send() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line  335)
* send() (logging.handlers.DatagramHandler のメソッド): DatagramHandler.
                                                             (line   44)
* send() (logging.handlers.SocketHandler のメソッド): SocketHandler.
                                                             (line   62)
* send() (multiprocessing.connection.Connection のメソッド): Connection オブジェクト<2>.
                                                             (line   15)
* send() (socket.socket のメソッド):     socket オブジェクト.
                                                             (line  392)
* sendall() (socket.socket のメソッド):  socket オブジェクト.
                                                             (line  407)
* sendcmd() (ftplib.FTP のメソッド):     FTP オブジェクト.   (line  156)
* sendfile() (asyncio.loop のメソッド):  ファイルの転送.     (line    6)
* sendfile() (os モジュール):            ファイル記述子の操作.
                                                             (line  776)
* sendfile() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  497)
* sendfile() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line  278)
* SendfileNotAvailableError:             例外<16>.           (line   38)
* sendfunc (C type):                     Slot Type typedefs. (line  125)
* sendmail() (smtplib.SMTP のメソッド):  SMTP オブジェクト.  (line  221)
* sendmsg_afalg() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  486)
* sendmsg() (socket.socket のメソッド):  socket オブジェクト.
                                                             (line  443)
* sendto() (asyncio.DatagramTransport のメソッド): データグラムトランスポート.
                                                             (line    6)
* sendto() (socket.socket のメソッド):   socket オブジェクト.
                                                             (line  425)
* sentinel (multiprocessing.Process の属性): Process クラスと例外.
                                                             (line  188)
* sentinel (unittest.mock モジュール):   sentinel.           (line    6)
* sep (os モジュール):                   雑多なシステム情報. (line  112)
* SEPTEMBER (calendar モジュール):       calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  483)
* sequence:                              用語集<2>.          (line 1574)
* Sequence (collections.abc のクラス):   コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   68)
* Sequence (typing のクラス):            Aliases to container ABCs in collections abc.
                                                             (line  112)
* sequence;反復処理:                     イテレータ型.       (line    6)
* sequence;要素:                         Subscriptions and slicings.
                                                             (line    6)
* SequenceMatcher (difflib のクラス):    SequenceMatcherオブジェクト.
                                                             (line    9)
* serialize() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  691)
* serve_forever() (asyncio.Server のメソッド): Serverオブジェクト.
                                                             (line   92)
* serve_forever() (socketserver.BaseServer のメソッド): Serverオブジェクト<2>.
                                                             (line   32)
* Server (asyncio のクラス):             Serverオブジェクト. (line   12)
* server (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  124)
* server (socketserver.BaseRequestHandler の属性): Request Handler Objects.
                                                             (line   51)
* server_activate() (socketserver.BaseServer のメソッド): Serverオブジェクト<2>.
                                                             (line  162)
* server_address (socketserver.BaseServer の属性): Serverオブジェクト<2>.
                                                             (line   79)
* server_bind() (socketserver.BaseServer のメソッド): Serverオブジェクト<2>.
                                                             (line  168)
* server_close() (socketserver.BaseServer のメソッド): Serverオブジェクト<2>.
                                                             (line   61)
* server_hostname (ssl.SSLSocket の属性): SSL ソケット.      (line  351)
* server_side (ssl.SSLSocket の属性):    SSL ソケット.       (line  344)
* server_software (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  177)
* server_version (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  184)
* server_version (http.server.SimpleHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  407)
* ServerProxy (xmlrpc.client のクラス):  xmlrpc client --- XML-RPC クライアントアクセス.
                                                             (line   29)
* service_actions() (socketserver.BaseServer のメソッド): Serverオブジェクト<2>.
                                                             (line   45)
* session (ssl.SSLSocket の属性):        SSL ソケット.       (line  363)
* session_reused (ssl.SSLSocket の属性): SSL ソケット.       (line  373)
* session_stats() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  481)
* Set (ast のクラス):                    リテラル<3>.        (line  154)
* Set (collections.abc のクラス):        コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  116)
* Set (typing のクラス):                 Aliases to built-in types.
                                                             (line   30)
* set (組み込みクラス):                  set（集合）型 --- set frozenset.
                                                             (line   33)
* Set Breakpoint [ブレークポイントのセット]: Help メニュー Shell ウィンドウ、Editor ウィンドウ.
                                                             (line   32)
* set comprehension:                     用語集<2>.          (line 1595)
* SET_ADD (opcode):                      Python バイトコード命令.
                                                             (line  371)
* set_all():                             参照カウントの詳細. (line   97)
* set_allowed_domains() (http.cookiejar.DefaultCookiePolicy のメソッド): DefaultCookiePolicy オブジェクト.
                                                             (line   69)
* set_alpn_protocols() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  254)
* set_app() (wsgiref.simple_server.WSGIServer のメソッド): wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line   64)
* set_asyncgen_hooks() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1814)
* set_authorizer() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  354)
* set_auto_history() (readline モジュール): 履歴リスト.      (line   42)
* set_blocked_domains() (http.cookiejar.DefaultCookiePolicy のメソッド): DefaultCookiePolicy オブジェクト.
                                                             (line   55)
* set_blocking() (os モジュール):        ファイル記述子の操作.
                                                             (line  837)
* set_boundary() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  412)
* set_boundary() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  596)
* set_break() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  374)
* set_charset() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  239)
* set_children() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line   26)
* set_ciphers() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  240)
* set_completer_delims() (readline モジュール): 補完.        (line   51)
* set_completer() (readline モジュール): 補完.               (line   14)
* set_completion_display_matches_hook() (readline モジュール): 補完.
                                                             (line   60)
* set_content() (email.contentmanager モジュール): Content Manager Instances.
                                                             (line   35)
* set_content() (email.contentmanager.ContentManager のメソッド): email contentmanager Managing MIME Content.
                                                             (line   39)
* set_content() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  591)
* set_continue() (bdb.Bdb のメソッド):   bdb --- デバッガーフレームワーク.
                                                             (line  358)
* set_cookie_if_ok() (http.cookiejar.CookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line   71)
* set_cookie() (http.cookiejar.CookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line   76)
* set_coroutine_origin_tracking_depth() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1839)
* set_data() (importlib.abc.SourceLoader のメソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  386)
* set_data() (importlib.machinery.SourceFileLoader のメソッド): importlib machinery -- Importers and path hooks.
                                                             (line  226)
* set_date() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line  101)
* set_debug() (asyncio.loop のメソッド): デバッグモードの有効化.
                                                             (line   14)
* set_debug() (gc モジュール):           gc --- ガベージコレクターインターフェース.
                                                             (line   60)
* set_debuglevel() (ftplib.FTP のメソッド): FTP オブジェクト.
                                                             (line   74)
* set_debuglevel() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line   95)
* set_debuglevel() (poplib.POP3 のメソッド): POP3 オブジェクト.
                                                             (line   11)
* set_debuglevel() (smtplib.SMTP のメソッド): SMTP オブジェクト.
                                                             (line    8)
* set_default_backend() (pdb モジュール): コマンドライン・インターフェース<8>.
                                                             (line  156)
* set_default_executor() (asyncio.loop のメソッド): スレッドまたはプロセスプールでコードを実行する.
                                                             (line   82)
* set_default_type() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  343)
* set_default_type() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  455)
* set_default_verify_paths() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  231)
* set_defaults() (argparse.ArgumentParser のメソッド): パーサーのデフォルト値.
                                                             (line    6)
* set_defaults() (optparse.OptionParser のメソッド): その他のメソッド.
                                                             (line   27)
* set_ecdh_curve() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  365)
* set_errno() (ctypes モジュール):       ユーティリティー関数.
                                                             (line  245)
* set_error_mode() (msvcrt モジュール):  その多の関数.       (line   12)
* set_escdelay() (curses モジュール):    関数<6>.            (line  457)
* set_event_loop_policy() (asyncio モジュール): ポリシーの取得と設定.
                                                             (line   16)
* set_event_loop() (asyncio モジュール): イベントループ.     (line   66)
* set_event_loop() (asyncio.AbstractEventLoopPolicy のメソッド): ポリシーオブジェクト.
                                                             (line   23)
* set_events() (sys.monitoring モジュール): Setting events globally.
                                                             (line   13)
* set_exception_handler() (asyncio.loop のメソッド): エラーハンドリング API.
                                                             (line    8)
* set_exception() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line   56)
* set_exception() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line  119)
* set_executable() (multiprocessing モジュール): その他<5>.  (line  118)
* set_filter() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  126)
* set_flags() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line  108)
* set_flags() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line   77)
* set_flags() (mailbox.mboxMessage のメソッド): mboxMessage オブジェクト.
                                                             (line   72)
* set_flags() (mailbox.MMDFMessage のメソッド): MMDFMessage オブジェクト.
                                                             (line   71)
* set_forkserver_preload() (multiprocessing モジュール): その他<5>.
                                                             (line  134)
* set_from() (mailbox.mboxMessage のメソッド): mboxMessage オブジェクト.
                                                             (line   55)
* set_from() (mailbox.MMDFMessage のメソッド): MMDFMessage オブジェクト.
                                                             (line   54)
* SET_FUNCTION_ATTRIBUTE (opcode):       Python バイトコード命令.
                                                             (line 1163)
* set_handle_inheritable() (os モジュール): ファイル記述子の継承.
                                                             (line   45)
* set_history_length() (readline モジュール): 履歴ファイル.  (line   40)
* set_info() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line  170)
* set_info() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line  112)
* set_inheritable() (os モジュール):     ファイル記述子の継承.
                                                             (line   33)
* set_inheritable() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  513)
* set_int_max_str_digits() (sys モジュール): sys --- システム固有のパラメーターと関数.
                                                             (line 1620)
* set_labels() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   50)
* set_last_error() (ctypes モジュール):  ユーティリティー関数.
                                                             (line  253)
* set_local_events() (sys.monitoring モジュール): Per code object events.
                                                             (line   16)
* set_memlimit() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  329)
* set_name() (asyncio.Task のメソッド):  Task オブジェクト.  (line  189)
* set_next() (bdb.Bdb のメソッド):       bdb --- デバッガーフレームワーク.
                                                             (line  335)
* set_nonstandard_attr() (http.cookiejar.Cookie のメソッド): Cookieオブジェクト<2>.
                                                             (line  109)
* set_npn_protocols() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  268)
* set_ok() (http.cookiejar.CookiePolicy のメソッド): CookiePolicy オブジェクト.
                                                             (line    9)
* set_param() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  352)
* set_param() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  523)
* set_pasv() (ftplib.FTP のメソッド):    FTP オブジェクト.   (line  212)
* set_payload() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  228)
* set_pledged_input_size() (compression.zstd.ZstdCompressor のメソッド): メモリ上での圧縮と展開.
                                                             (line  106)
* set_policy() (http.cookiejar.CookieJar のメソッド): CookieJar および FileCookieJar オブジェクト.
                                                             (line   59)
* set_pre_input_hook() (readline モジュール): 開始フック.    (line   14)
* set_progress_handler() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  387)
* set_protocol() (asyncio.BaseTransport のメソッド): 基底トランスポート.
                                                             (line   82)
* set_proxy() (urllib.request.Request のメソッド): Request オブジェクト.
                                                             (line  116)
* set_psk_client_callback() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  660)
* set_psk_server_callback() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  712)
* set_quit() (bdb.Bdb のメソッド):       bdb --- デバッガーフレームワーク.
                                                             (line  364)
* set_result() (asyncio.Future のメソッド): Future オブジェクト<2>.
                                                             (line   49)
* set_result() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line  107)
* set_return() (bdb.Bdb のメソッド):     bdb --- デバッガーフレームワーク.
                                                             (line  340)
* set_running_or_notify_cancel() (concurrent.futures.Future のメソッド): Future オブジェクト.
                                                             (line   86)
* set_selection() (tkinter.filedialog.FileDialog のメソッド): ネイティブの読み込み/保存ダイアログ.
                                                             (line  130)
* set_seq1() (difflib.SequenceMatcher のメソッド): SequenceMatcherオブジェクト.
                                                             (line   55)
* set_seq2() (difflib.SequenceMatcher のメソッド): SequenceMatcherオブジェクト.
                                                             (line   60)
* set_seqs() (difflib.SequenceMatcher のメソッド): SequenceMatcherオブジェクト.
                                                             (line   45)
* set_sequences() (mailbox.MH のメソッド): MH オブジェクト.  (line   63)
* set_sequences() (mailbox.MHMessage のメソッド): MHMessage オブジェクト.
                                                             (line   36)
* set_server_documentation() (xmlrpc.server.DocCGIXMLRPCRequestHandler のメソッド): DocCGIXMLRPCRequestHandler.
                                                             (line   23)
* set_server_documentation() (xmlrpc.server.DocXMLRPCServer のメソッド): DocXMLRPCServer オブジェクト.
                                                             (line   22)
* set_server_name() (xmlrpc.server.DocCGIXMLRPCRequestHandler のメソッド): DocCGIXMLRPCRequestHandler.
                                                             (line   18)
* set_server_name() (xmlrpc.server.DocXMLRPCServer のメソッド): DocXMLRPCServer オブジェクト.
                                                             (line   17)
* set_server_title() (xmlrpc.server.DocCGIXMLRPCRequestHandler のメソッド): DocCGIXMLRPCRequestHandler.
                                                             (line   13)
* set_server_title() (xmlrpc.server.DocXMLRPCServer のメソッド): DocXMLRPCServer オブジェクト.
                                                             (line   12)
* set_servername_callback() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  336)
* set_start_method() (multiprocessing モジュール): その他<5>.
                                                             (line  151)
* set_startup_hook() (readline モジュール): 開始フック.      (line    6)
* set_step() (bdb.Bdb のメソッド):       bdb --- デバッガーフレームワーク.
                                                             (line  331)
* set_subdir() (mailbox.MaildirMessage のメソッド): MaildirMessage オブジェクト.
                                                             (line   62)
* set_tabsize() (curses モジュール):     関数<6>.            (line  472)
* set_task_factory() (asyncio.loop のメソッド): フューチャーとタスクの生成.
                                                             (line   61)
* set_threshold() (gc モジュール):       gc --- ガベージコレクターインターフェース.
                                                             (line  105)
* set_trace_async() (pdb モジュール):    コマンドライン・インターフェース<8>.
                                                             (line  127)
* set_trace_callback() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  406)
* set_trace() (bdb モジュール):          bdb --- デバッガーフレームワーク.
                                                             (line  533)
* set_trace() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  349)
* set_trace() (pdb モジュール):          コマンドライン・インターフェース<8>.
                                                             (line  110)
* set_trace() (pdb.Pdb のメソッド):      コマンドライン・インターフェース<8>.
                                                             (line  242)
* set_tunnel() (http.client.HTTPConnection のメソッド): HTTPConnection オブジェクト.
                                                             (line  105)
* set_type() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  560)
* set_unittest_reportflags() (doctest モジュール): 単体テスト API.
                                                             (line  171)
* set_unixfrom() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  146)
* set_unixfrom() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  158)
* set_until() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  344)
* SET_UPDATE (opcode):                   Python バイトコード命令.
                                                             (line  745)
* set_url() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   21)
* set_usage() (optparse.OptionParser のメソッド): その他のメソッド.
                                                             (line    8)
* set_userptr() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   43)
* set_visible() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   69)
* set_wakeup_fd() (signal モジュール):   モジュールの内容<2>.
                                                             (line  468)
* set_write_buffer_limits() (asyncio.WriteTransport のメソッド): 書き込み専用のトランスポート.
                                                             (line   35)
* set() (asyncio.Event のメソッド):      Event.              (line   52)
* set() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  277)
* set() (configparser.RawConfigParser のメソッド): RawConfigParser オブジェクト.
                                                             (line   54)
* set() (contextvars.ContextVar のメソッド): コンテキスト変数.
                                                             (line   45)
* set() (http.cookies.Morsel のメソッド): Morselオブジェクト.
                                                             (line   75)
* set() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  241)
* set() (test.support.os_helper.EnvironmentVarGuard のメソッド): test support os_helper --- Utilities for os tests.
                                                             (line   64)
* set() (threading.Event のメソッド):    Event objects.      (line   31)
* set() (tkinter.ttk.Combobox のメソッド): ttk Combobox.     (line   19)
* set() (tkinter.ttk.Spinbox のメソッド): ttk Spinbox.       (line   12)
* set() (tkinter.ttk.Treeview のメソッド): ttk Treeview.     (line  284)
* set() (xml.etree.ElementTree.Element のメソッド): Element オブジェクト.
                                                             (line   77)
* setacl() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  343)
* SetAllocTrackerActivationThreshold() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  119)
* SetAllocTrackerMaximumAmplification() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  135)
* setannotation() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  348)
* setattrfunc (C type):                  Slot Type typedefs. (line   53)
* setAttribute() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   69)
* setAttributeNode() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   73)
* setAttributeNodeNS() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   80)
* setAttributeNS() (xml.dom.Element のメソッド): Element オブジェクト<2>.
                                                             (line   88)
* setattrofunc (C type):                 Slot Type typedefs. (line   66)
* SetBase() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line   22)
* setblocking() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  520)
* setByteStream() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   36)
* setcbreak() (tty モジュール):          tty --- 端末制御用の関数群.
                                                             (line   54)
* setCharacterStream() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   55)
* SetComp (ast のクラス):                内包表記 Comprehension.
                                                             (line    6)
* setcomptype() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   59)
* setconfig() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  675)
* setContentHandler() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   26)
* setcontext() (decimal モジュール):     Context オブジェクト.
                                                             (line   18)
* setDaemon() (threading.Thread のメソッド): Thread objects. (line  258)
* setdefault() (dict のメソッド):        マッピング型 --- dict.
                                                             (line  227)
* setdefault() (http.cookies.Morsel のメソッド): Morselオブジェクト.
                                                             (line  116)
* setdefaulttimeout() (socket モジュール): その他の関数<2>.  (line  378)
* setdlopenflags() (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line 1607)
* setDocumentLocator() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line   10)
* setDTDHandler() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   36)
* setegid() (os モジュール):             プロセスのパラメーター.
                                                             (line  397)
* setEncoding() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   22)
* setEntityResolver() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   45)
* setErrorHandler() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   56)
* seteuid() (os モジュール):             プロセスのパラメーター.
                                                             (line  403)
* setFeature() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   76)
* setfirstweekday() (calendar モジュール): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  343)
* setfirstweekday() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line   52)
* setFormatter() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   50)
* setframerate() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   46)
* setgid() (os モジュール):              プロセスのパラメーター.
                                                             (line  409)
* setgroups() (os モジュール):           プロセスのパラメーター.
                                                             (line  415)
* seth() (turtle モジュール):            Turtle の動き.      (line  164)
* setheading() (turtle モジュール):      Turtle の動き.      (line  164)
* sethostname() (socket モジュール):     その他の関数<2>.    (line  385)
* setinputsizes() (sqlite3.Cursor のメソッド): Cursor オブジェクト.
                                                             (line  166)
* setitem() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  213)
* setitimer() (signal モジュール):       モジュールの内容<2>.
                                                             (line  439)
* setLevel() (logging.Handler のメソッド): ハンドラオブジェクト.
                                                             (line   36)
* setLevel() (logging.Logger のメソッド): ロガーオブジェクト.
                                                             (line  104)
* setlimit() (sqlite3.Connection のメソッド): Connection オブジェクト.
                                                             (line  627)
* setlocale() (locale モジュール):       locale --- 国際化サービス.
                                                             (line   26)
* setLocale() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   61)
* setLoggerClass() (logging モジュール): モジュールレベルの関数.
                                                             (line  311)
* setlogmask() (syslog モジュール):      syslog --- Unix syslog ライブラリルーチン群.
                                                             (line   99)
* setLogRecordFactory() (logging モジュール): モジュールレベルの関数.
                                                             (line  323)
* setMaxConns() (urllib.request.CacheFTPHandler のメソッド): CacheFTPHandler オブジェクト.
                                                             (line   13)
* setmode() (msvcrt モジュール):         ファイル操作関連.   (line   38)
* setName() (threading.Thread のメソッド): Thread objects.   (line  202)
* setnchannels() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   38)
* setnframes() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   53)
* setns() (os モジュール):               プロセスのパラメーター.
                                                             (line  430)
* setoutputsize() (sqlite3.Cursor のメソッド): Cursor オブジェクト.
                                                             (line  170)
* SetParamEntityParsing() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line   53)
* setparams() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   64)
* setpassword() (zipfile.ZipFile のメソッド): ZipFile objects.
                                                             (line  250)
* setpgid() (os モジュール):             プロセスのパラメーター.
                                                             (line  477)
* setpgrp() (os モジュール):             プロセスのパラメーター.
                                                             (line  469)
* setpos() (turtle モジュール):          Turtle の動き.      (line   74)
* setpos() (wave.Wave_read のメソッド):  Wave_read オブジェクト.
                                                             (line   83)
* setposition() (turtle モジュール):     Turtle の動き.      (line   74)
* setpriority() (os モジュール):         プロセスのパラメーター.
                                                             (line  485)
* setprofile_all_threads() (threading モジュール): リファレンス<2>.
                                                             (line  139)
* setprofile() (sys モジュール):         sys --- システム固有のパラメーターと関数.
                                                             (line 1628)
* setprofile() (threading モジュール):   リファレンス<2>.    (line  133)
* setProperty() (xml.sax.xmlreader.XMLReader のメソッド): XMLReader オブジェクト.
                                                             (line   89)
* setPublicId() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line    6)
* setquota() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  353)
* setraw() (tty モジュール):             tty --- 端末制御用の関数群.
                                                             (line   43)
* setrecursionlimit() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 1685)
* setregid() (os モジュール):            プロセスのパラメーター.
                                                             (line  502)
* SetReparseDeferralEnabled() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line   80)
* setresgid() (os モジュール):           プロセスのパラメーター.
                                                             (line  508)
* setresuid() (os モジュール):           プロセスのパラメーター.
                                                             (line  517)
* setreuid() (os モジュール):            プロセスのパラメーター.
                                                             (line  526)
* setrlimit() (resource モジュール):     リソースの制限.     (line   33)
* setsampwidth() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   42)
* setscrreg() (curses.window のメソッド): Window オブジェクト.
                                                             (line  506)
* setsid() (os モジュール):              プロセスのパラメーター.
                                                             (line  539)
* setsockopt() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  552)
* setstate() (codecs.IncrementalDecoder のメソッド): IncrementalDecoder オブジェクト.
                                                             (line   58)
* setstate() (codecs.IncrementalEncoder のメソッド): IncrementalEncoder オブジェクト.
                                                             (line   50)
* setstate() (random モジュール):        保守 bookkeeping 関数.
                                                             (line   38)
* setstate() (random.Random のメソッド): 他の生成器.         (line   29)
* setStream() (logging.StreamHandler のメソッド): StreamHandler.
                                                             (line   33)
* setswitchinterval (in module sys):     スレッド状態 thread state とグローバルインタプリタロック global interpreter lock.
                                                             (line   16)
* setswitchinterval() (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 1703)
* setswitchinterval() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  312)
* setSystemId() (xml.sax.xmlreader.InputSource のメソッド): InputSource オブジェクト.
                                                             (line   14)
* setsyx() (curses モジュール):          関数<6>.            (line  480)
* setTarget() (logging.handlers.MemoryHandler のメソッド): MemoryHandler.
                                                             (line   70)
* setter (C type):                       Defining Getters and Setters.
                                                             (line   42)
* settimeout() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  536)
* setTimeout() (urllib.request.CacheFTPHandler のメソッド): CacheFTPHandler オブジェクト.
                                                             (line    9)
* settrace_all_threads() (threading モジュール): リファレンス<2>.
                                                             (line  117)
* settrace() (sys モジュール):           sys --- システム固有のパラメーターと関数.
                                                             (line 1715)
* settrace() (threading モジュール):     リファレンス<2>.    (line  111)
* setuid() (os モジュール):              プロセスのパラメーター.
                                                             (line  546)
* setundobuffer() (turtle モジュール):   特別な Turtle のメソッド.
                                                             (line   73)
* SETUP_ANNOTATIONS (opcode):            Python バイトコード命令.
                                                             (line  425)
* SETUP_CLEANUP (opcode):                Python バイトコード命令.
                                                             (line 1460)
* setup_environ() (wsgiref.handlers.BaseHandler のメソッド): wsgiref handlers -- server/gateway base classes.
                                                             (line  196)
* SETUP_FINALLY (opcode):                Python バイトコード命令.
                                                             (line 1453)
* setup_python() (venv.EnvBuilder のメソッド): API<2>.       (line  146)
* setup_scripts() (venv.EnvBuilder のメソッド): API<2>.      (line  154)
* setup_testing_defaults() (wsgiref.util モジュール): wsgiref util -- WSGI environment utilities.
                                                             (line   69)
* SETUP_WITH (opcode):                   Python バイトコード命令.
                                                             (line 1468)
* setup() (socketserver.BaseRequestHandler のメソッド): Request Handler Objects.
                                                             (line   14)
* setup() (turtle モジュール):           Screen 独自のメソッド、TurtleScreen から継承したもの以外.
                                                             (line   39)
* setUp() (unittest.TestCase のメソッド): テストクラス.      (line   34)
* setUpClass() (unittest.TestCase のメソッド): テストクラス. (line   54)
* setUpModule() (unittest モジュール):   setUpModule と tearDownModule.
                                                             (line    6)
* setupterm() (curses モジュール):       関数<6>.            (line  485)
* SetValue() (winreg モジュール):        関数<14>.           (line  417)
* SetValueEx() (winreg モジュール):      関数<14>.           (line  446)
* setworldcoordinates() (turtle モジュール): ウィンドウの制御.
                                                             (line  116)
* setx() (turtle モジュール):            Turtle の動き.      (line  138)
* setxattr() (os モジュール):            Linux 拡張属性.     (line   58)
* sety() (turtle モジュール):            Turtle の動き.      (line  151)
* SF_APPEND (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line  421)
* SF_ARCHIVED (stat モジュール):         stat --- stat の結果を解釈する.
                                                             (line  413)
* SF_DATALESS (stat モジュール):         stat --- stat の結果を解釈する.
                                                             (line  445)
* SF_FIRMLINK (stat モジュール):         stat --- stat の結果を解釈する.
                                                             (line  439)
* SF_IMMUTABLE (stat モジュール):        stat --- stat の結果を解釈する.
                                                             (line  417)
* SF_MNOWAIT (os モジュール):            ファイル記述子の操作.
                                                             (line  816)
* SF_NOCACHE (os モジュール):            ファイル記述子の操作.
                                                             (line  827)
* SF_NODISKIO (os モジュール):           ファイル記述子の操作.
                                                             (line  816)
* SF_NOUNLINK (stat モジュール):         stat --- stat の結果を解釈する.
                                                             (line  431)
* SF_RESTRICTED (stat モジュール):       stat --- stat の結果を解釈する.
                                                             (line  425)
* SF_SETTABLE (stat モジュール):         stat --- stat の結果を解釈する.
                                                             (line  391)
* SF_SNAPSHOT (stat モジュール):         stat --- stat の結果を解釈する.
                                                             (line  435)
* SF_SUPPORTED (stat モジュール):        stat --- stat の結果を解釈する.
                                                             (line  397)
* SF_SYNC (os モジュール):               ファイル記述子の操作.
                                                             (line  816)
* SF_SYNTHETIC (stat モジュール):        stat --- stat の結果を解釈する.
                                                             (line  405)
* sha1() (hashlib モジュール):           コンストラクタ.     (line   22)
* sha224() (hashlib モジュール):         コンストラクタ.     (line   24)
* sha256() (hashlib モジュール):         コンストラクタ.     (line   26)
* sha3_224() (hashlib モジュール):       コンストラクタ.     (line   32)
* sha3_256() (hashlib モジュール):       コンストラクタ.     (line   34)
* sha3_384() (hashlib モジュール):       コンストラクタ.     (line   36)
* sha3_512() (hashlib モジュール):       コンストラクタ.     (line   38)
* sha384() (hashlib モジュール):         コンストラクタ.     (line   28)
* sha512() (hashlib モジュール):         コンストラクタ.     (line   30)
* shake_128() (hashlib モジュール):      SHAKE 可変長ダイジェスト.
                                                             (line    6)
* shake_256() (hashlib モジュール):      SHAKE 可変長ダイジェスト.
                                                             (line    8)
* shape (memoryview の属性):             メモリビュー.       (line  481)
* Shape (turtle のクラス):               Public classes.     (line   44)
* shape() (turtle モジュール):           見た目.             (line    6)
* shapesize() (turtle モジュール):       見た目.             (line   50)
* shapetransform() (turtle モジュール):  見た目.             (line  135)
* share() (socket.socket のメソッド):    socket オブジェクト.
                                                             (line  584)
* ShareableList (multiprocessing.shared_memory のクラス): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  271)
* ShareableList() (multiprocessing.managers.SharedMemoryManager のメソッド): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  231)
* Shared Memory:                         multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line   10)
* shared_ciphers() (ssl.SSLSocket のメソッド): SSL ソケット. (line  236)
* shared_memory (sys._emscripten_info の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  356)
* SharedMemory (multiprocessing.shared_memory のクラス): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line   32)
* SharedMemory() (multiprocessing.managers.SharedMemoryManager のメソッド): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  226)
* SharedMemoryManager (multiprocessing.managers のクラス): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  199)
* shearfactor() (turtle モジュール):     見た目.             (line   81)
* Shelf (shelve のクラス):               制限事項.           (line   27)
* shield() (asyncio モジュール):         キャンセルからの保護.
                                                             (line    6)
* shift_path_info() (wsgiref.util モジュール): wsgiref util -- WSGI environment utilities.
                                                             (line   39)
* shift() (decimal.Context のメソッド):  Context オブジェクト.
                                                             (line  523)
* shift() (decimal.Decimal のメソッド):  Decimal オブジェクト.
                                                             (line  544)
* shlex (shlex のクラス):                shlex --- 単純な字句解析.
                                                             (line   90)
* shm (multiprocessing.shared_memory.ShareableList の属性): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  345)
* SHORT_TIMEOUT (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line   97)
* shortDescription() (unittest.TestCase のメソッド): テストクラス.
                                                             (line  821)
* shorten() (textwrap モジュール):       textwrap --- テキストの折り返しと詰め込み.
                                                             (line   48)
* shouldFlush() (logging.handlers.BufferingHandler のメソッド): MemoryHandler.
                                                             (line   36)
* shouldFlush() (logging.handlers.MemoryHandler のメソッド): MemoryHandler.
                                                             (line   74)
* shouldRollover() (logging.handlers.RotatingFileHandler のメソッド): RotatingFileHandler.
                                                             (line   53)
* shouldRollover() (logging.handlers.TimedRotatingFileHandler のメソッド): TimedRotatingFileHandler.
                                                             (line  117)
* shouldStop (unittest.TestResult の属性): テストのロードと起動.
                                                             (line  281)
* show_code() (dis モジュール):          解析関数.           (line   25)
* show_flag_values() (enum モジュール):  ユーティリティとデコレータ.
                                                             (line  103)
* show() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   49)
* show() (tkinter.commondialog.Dialog のメソッド): tkinter commondialog --- Dialog window templates.
                                                             (line   15)
* show() (tkinter.messagebox.Message のメソッド): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line   82)
* showerror() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  105)
* showinfo() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line   91)
* showsyntaxerror() (code.InteractiveInterpreter のメソッド): 対話的なインタプリタオブジェクト.
                                                             (line   44)
* showtraceback() (code.InteractiveInterpreter のメソッド): 対話的なインタプリタオブジェクト.
                                                             (line   53)
* showturtle() (turtle モジュール):      可視性.             (line   15)
* showwarning() (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line   99)
* showwarning() (warnings モジュール):   利用可能な関数.     (line   89)
* shuffle() (random モジュール):         シーケンス用の関数. (line   51)
* SHUT_RD (socket モジュール):           定数<8>.            (line  476)
* SHUT_RDWR (socket モジュール):         定数<8>.            (line  476)
* SHUT_WR (socket モジュール):           定数<8>.            (line  476)
* ShutDown:                              queue --- 同期キュークラス.
                                                             (line   88)
* shutdown_asyncgens() (asyncio.loop のメソッド): ループの開始と停止.
                                                             (line   61)
* shutdown_default_executor() (asyncio.loop のメソッド): ループの開始と停止.
                                                             (line   84)
* shutdown() (asyncio.Queue のメソッド): Queue.              (line   83)
* shutdown() (concurrent.futures.Executor のメソッド): Executor オブジェクト.
                                                             (line   60)
* shutdown() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  358)
* shutdown() (logging モジュール):       モジュールレベルの関数.
                                                             (line  300)
* shutdown() (multiprocessing.managers.BaseManager のメソッド): マネージャー.
                                                             (line   87)
* shutdown() (queue.Queue のメソッド):   Terminating queues. (line    9)
* shutdown() (socket.socket のメソッド): socket オブジェクト.
                                                             (line  575)
* shutdown() (socketserver.BaseServer のメソッド): Serverオブジェクト<2>.
                                                             (line   54)
* SI (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   69)
* side_effect (unittest.mock.Mock の属性): Mock クラス.      (line  364)
* SIG_BLOCK (signal モジュール):         モジュールの内容<2>.
                                                             (line  259)
* SIG_DFL (signal モジュール):           モジュールの内容<2>.
                                                             (line   46)
* SIG_IGN (signal モジュール):           モジュールの内容<2>.
                                                             (line   53)
* SIG_SETMASK (signal モジュール):       モジュールの内容<2>.
                                                             (line  273)
* SIG_UNBLOCK (signal モジュール):       モジュールの内容<2>.
                                                             (line  266)
* SIGABRT (signal モジュール):           モジュールの内容<2>.
                                                             (line   58)
* SIGALRM (signal モジュール):           モジュールの内容<2>.
                                                             (line   62)
* SIGBREAK (signal モジュール):          モジュールの内容<2>.
                                                             (line   68)
* SIGBUS (signal モジュール):            モジュールの内容<2>.
                                                             (line   74)
* SIGCHLD (signal モジュール):           モジュールの内容<2>.
                                                             (line   80)
* SIGCLD (signal モジュール):            モジュールの内容<2>.
                                                             (line   86)
* SIGCONT (signal モジュール):           モジュールの内容<2>.
                                                             (line   92)
* SIGFPE (signal モジュール):            モジュールの内容<2>.
                                                             (line   98)
* SIGHUP (signal モジュール):            モジュールの内容<2>.
                                                             (line  108)
* SIGILL (signal モジュール):            モジュールの内容<2>.
                                                             (line  115)
* SIGINT (C macro):                      シグナルハンドリング<2>.
                                                             (line    7)
* SIGINT (C macro) <1>:                  シグナルハンドリング<2>.
                                                             (line   34)
* SIGINT (signal モジュール):            モジュールの内容<2>.
                                                             (line  119)
* siginterrupt() (signal モジュール):    モジュールの内容<2>.
                                                             (line  514)
* SIGKILL (signal モジュール):           モジュールの内容<2>.
                                                             (line  125)
* Sigmasks (signal のクラス):            モジュールの内容<2>.
                                                             (line   31)
* signal() (signal モジュール):          モジュールの内容<2>.
                                                             (line  529)
* Signals (signal のクラス):             モジュールの内容<2>.
                                                             (line   17)
* Signature (inspect のクラス):          Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line   85)
* signature (inspect.BoundArguments の属性): Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line  387)
* signature() (inspect モジュール):      Signature オブジェクトで呼び出し可能オブジェクトを内省する.
                                                             (line   12)
* sigpending() (signal モジュール):      モジュールの内容<2>.
                                                             (line  557)
* SIGPIPE (signal モジュール):           モジュールの内容<2>.
                                                             (line  133)
* SIGPROF (signal モジュール):           モジュールの内容<2>.
                                                             (line  141)
* SIGQUIT (signal モジュール):           モジュールの内容<2>.
                                                             (line  147)
* SIGSEGV (signal モジュール):           モジュールの内容<2>.
                                                             (line  153)
* SIGSTKFLT (signal モジュール):         モジュールの内容<2>.
                                                             (line  161)
* SIGSTOP (signal モジュール):           モジュールの内容<2>.
                                                             (line  157)
* SIGTERM (signal モジュール):           モジュールの内容<2>.
                                                             (line  173)
* sigtimedwait() (signal モジュール):    モジュールの内容<2>.
                                                             (line  617)
* SIGUSR1 (signal モジュール):           モジュールの内容<2>.
                                                             (line  177)
* SIGUSR2 (signal モジュール):           モジュールの内容<2>.
                                                             (line  183)
* SIGVTALRM (signal モジュール):         モジュールの内容<2>.
                                                             (line  189)
* sigwait() (signal モジュール):         モジュールの内容<2>.
                                                             (line  572)
* sigwaitinfo() (signal モジュール):     モジュールの内容<2>.
                                                             (line  588)
* SIGWINCH (signal モジュール):          モジュールの内容<2>.
                                                             (line  195)
* SIGXCPU (signal モジュール):           モジュールの内容<2>.
                                                             (line  201)
* SIMPLE (inspect.BufferFlags の属性):   Buffer flags.       (line   15)
* Simple Mail Transfer Protocol:         smtplib --- SMTP プロトコルクライアント.
                                                             (line    8)
* simple;statement:                      単純文 simple statement.
                                                             (line    6)
* SimpleCookie (http.cookies のクラス):  http cookies --- HTTP の状態管理.
                                                             (line   48)
* simplefilter() (warnings モジュール):  利用可能な関数.     (line  121)
* SimpleHandler (wsgiref.handlers のクラス): wsgiref handlers -- server/gateway base classes.
                                                             (line   70)
* SimpleHTTPRequestHandler (http.server のクラス): http server --- HTTP サーバー.
                                                             (line  388)
* SimpleNamespace (types のクラス):      追加のユーティリティクラスと関数.
                                                             (line    6)
* SimpleQueue (multiprocessing のクラス): パイプ Pipe とキュー Queue.
                                                             (line  222)
* SimpleQueue (queue のクラス):          queue --- 同期キュークラス.
                                                             (line   69)
* SimpleXMLRPCRequestHandler (xmlrpc.server のクラス): xmlrpc server --- 基本的な XML-RPC サーバー.
                                                             (line   61)
* SimpleXMLRPCServer (xmlrpc.server のクラス): xmlrpc server --- 基本的な XML-RPC サーバー.
                                                             (line   24)
* sin() (cmath モジュール):              三角関数<2>.        (line   27)
* sin() (math モジュール):               三角関数.           (line   33)
* single dispatch:                       用語集<2>.          (line 1603)
* SingleAddressHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  213)
* singledispatch() (functools モジュール): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  478)
* singledispatchmethod (functools のクラス): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  649)
* sinh() (cmath モジュール):             双曲線関数<2>.      (line   27)
* sinh() (math モジュール):              双曲線関数.         (line   25)
* SIO_KEEPALIVE_VALS (socket モジュール): 定数<8>.           (line  256)
* SIO_LOOPBACK_FAST_PATH (socket モジュール): 定数<8>.       (line  256)
* SIO_RCVALL (socket モジュール):        定数<8>.            (line  256)
* site コマンドラインオプション; -user-base: コマンドライン・インターフェース<11>.
                                                             (line   17)
* site コマンドラインオプション; -user-site: コマンドライン・インターフェース<11>.
                                                             (line   21)
* site_maps() (urllib.robotparser.RobotFileParser のメソッド): urllib robotparser --- robots txt 用のパーサー.
                                                             (line   71)
* site-packages;ディレクトリ:            site --- サイト固有の設定フック.
                                                             (line   24)
* sitecustomize:                         カスタマイズ用モジュール.
                                                             (line    6)
* sitecustomize <1>:                     カスタマイズ用モジュール.
                                                             (line   20)
* sixtofour (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  312)
* size (ctypes.CField の属性):           構造化データ型.     (line  275)
* size (multiprocessing.shared_memory.SharedMemory の属性): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  124)
* size (struct.Struct の属性):           クラス<3>.          (line   64)
* size (tarfile.TarInfo の属性):         TarInfo オブジェクト.
                                                             (line   66)
* size (tracemalloc.Statistic の属性):   Statistic.          (line   19)
* size (tracemalloc.StatisticDiff の属性): StatisticDiff.    (line   27)
* size (tracemalloc.Trace の属性):       Trace.              (line   23)
* size_diff (tracemalloc.StatisticDiff の属性): StatisticDiff.
                                                             (line   33)
* SIZE_MAX (C macro):                    整数型オブジェクト integer object.
                                                             (line  288)
* size() (ftplib.FTP のメソッド):        FTP オブジェクト.   (line  350)
* size() (mmap.mmap のメソッド):         mmap --- メモリマップファイルのサポート.
                                                             (line  315)
* Sized (collections.abc のクラス):      コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line   14)
* Sized (typing のクラス):               Aliases to other ABCs in collections abc.
                                                             (line   69)
* sizeof_digit (sys.int_info の属性):    sys --- システム固有のパラメーターと関数.
                                                             (line 1182)
* sizeof() (ctypes モジュール):          ユーティリティー関数.
                                                             (line  264)
* SKIP (doctest モジュール):             オプションフラグ.   (line   89)
* skip_if_broken_multiprocessing_synchronize() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  761)
* skip_unless_bind_unix_socket() (test.support.socket_helper モジュール): test support socket_helper --- Utilities for socket tests.
                                                             (line   59)
* skip_unless_symlink() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line  127)
* skip_unless_xattr() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line  132)
* skip() (unittest モジュール):          テストのスキップと予期された失敗.
                                                             (line   86)
* skipIf() (unittest モジュール):        テストのスキップと予期された失敗.
                                                             (line   91)
* skipinitialspace (csv.Dialect の属性): Dialect クラスと書式化パラメータ.
                                                             (line   83)
* skipped (doctest.TestResults の属性):  TestResults objects.
                                                             (line   16)
* skipped (unittest.TestResult の属性):  テストのロードと起動.
                                                             (line  256)
* skippedEntity() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line  168)
* skips (doctest.DocTestRunner の属性):  DocTestRunner オブジェクト.
                                                             (line  145)
* SkipTest:                              テストのスキップと予期された失敗.
                                                             (line  106)
* skipTest() (unittest.TestCase のメソッド): テストクラス.   (line  101)
* skipUnless() (unittest モジュール):    テストのスキップと予期された失敗.
                                                             (line   95)
* SLASH (token モジュール):              token --- Python 解析木で使われる定数.
                                                             (line  233)
* SLASHEQUAL (token モジュール):         token --- Python 解析木で使われる定数.
                                                             (line  299)
* sleep() (asyncio モジュール):          スリープ.           (line    6)
* sleep() (time モジュール):             関数<5>.            (line  264)
* sleeping_retry() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  239)
* slice:                                 Subscriptions and slicings.
                                                             (line   70)
* slice <1>:                             用語集<2>.          (line 1608)
* Slice (ast のクラス):                  配列要素の参照 Subscripting.
                                                             (line   28)
* slice (組み込みクラス):                組み込み関数.       (line 1779)
* slice;代入:                            ミュータブルなシーケンス型.
                                                             (line   16)
* slice;演算:                            共通のシーケンス演算.
                                                             (line   18)
* slow_callback_duration (asyncio.loop の属性): デバッグモードの有効化.
                                                             (line   21)
* SMALLEST (test.support モジュール):    test support --- Utilities for the Python test suite.
                                                             (line  210)
* SMTP (email.policy モジュール):        email policy Policy Objects.
                                                             (line  508)
* SMTP (smtplib のクラス):               smtplib --- SMTP プロトコルクライアント.
                                                             (line   21)
* smtp_code (smtplib.SMTPResponseException の属性): smtplib --- SMTP プロトコルクライアント.
                                                             (line  145)
* smtp_error (smtplib.SMTPResponseException の属性): smtplib --- SMTP プロトコルクライアント.
                                                             (line  149)
* SMTP_SSL (smtplib のクラス):           smtplib --- SMTP プロトコルクライアント.
                                                             (line   75)
* SMTP;プロトコル:                       smtplib --- SMTP プロトコルクライアント.
                                                             (line    8)
* SMTPAuthenticationError:               smtplib --- SMTP プロトコルクライアント.
                                                             (line  188)
* SMTPConnectError:                      smtplib --- SMTP プロトコルクライアント.
                                                             (line  174)
* SMTPDataError:                         smtplib --- SMTP プロトコルクライアント.
                                                             (line  169)
* SMTPException:                         smtplib --- SMTP プロトコルクライアント.
                                                             (line  126)
* SMTPHandler (logging.handlers のクラス): SMTPHandler.      (line    9)
* SMTPHeloError:                         smtplib --- SMTP プロトコルクライアント.
                                                             (line  178)
* SMTPNotSupportedError:                 smtplib --- SMTP プロトコルクライアント.
                                                             (line  182)
* SMTPRecipientsRefused:                 smtplib --- SMTP プロトコルクライアント.
                                                             (line  159)
* SMTPResponseException:                 smtplib --- SMTP プロトコルクライアント.
                                                             (line  139)
* SMTPSenderRefused:                     smtplib --- SMTP プロトコルクライアント.
                                                             (line  153)
* SMTPServerDisconnected:                smtplib --- SMTP プロトコルクライアント.
                                                             (line  134)
* SMTPUTF8 (email.policy モジュール):    email policy Policy Objects.
                                                             (line  514)
* Snapshot (tracemalloc のクラス):       Snapshot.           (line    6)
* SND_ALIAS (winsound モジュール):       winsound --- Windows 用の音声再生インターフェース.
                                                             (line   49)
* SND_APPLICATION (winsound モジュール): winsound --- Windows 用の音声再生インターフェース.
                                                             (line  136)
* SND_ASYNC (winsound モジュール):       winsound --- Windows 用の音声再生インターフェース.
                                                             (line  115)
* SND_FILENAME (winsound モジュール):    winsound --- Windows 用の音声再生インターフェース.
                                                             (line   44)
* SND_LOOP (winsound モジュール):        winsound --- Windows 用の音声再生インターフェース.
                                                             (line   91)
* SND_MEMORY (winsound モジュール):      winsound --- Windows 用の音声再生インターフェース.
                                                             (line   97)
* SND_NODEFAULT (winsound モジュール):   winsound --- Windows 用の音声再生インターフェース.
                                                             (line  119)
* SND_NOSTOP (winsound モジュール):      winsound --- Windows 用の音声再生インターフェース.
                                                             (line  124)
* SND_NOWAIT (winsound モジュール):      winsound --- Windows 用の音声再生インターフェース.
                                                             (line  128)
* SND_PURGE (winsound モジュール):       winsound --- Windows 用の音声再生インターフェース.
                                                             (line  108)
* SND_SENTRY (winsound モジュール):      winsound --- Windows 用の音声再生インターフェース.
                                                             (line  142)
* SND_SYNC (winsound モジュール):        winsound --- Windows 用の音声再生インターフェース.
                                                             (line  148)
* SND_SYSTEM (winsound モジュール):      winsound --- Windows 用の音声再生インターフェース.
                                                             (line  154)
* sni_callback (ssl.SSLContext の属性):  SSL コンテキスト.   (line  284)
* sniff() (csv.Sniffer のメソッド):      モジュールコンテンツ<3>.
                                                             (line  231)
* Sniffer (csv のクラス):                モジュールコンテンツ<3>.
                                                             (line  224)
* SO (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   66)
* SO_HCI_EVT_FILTER (socket モジュール): 定数<8>.            (line  371)
* SO_HCI_PKT_FILTER (socket モジュール): 定数<8>.            (line  371)
* SO_INCOMING_CPU (socket モジュール):   定数<8>.            (line  427)
* SO_REUSEPORT_LB (socket モジュール):   定数<8>.            (line  436)
* sock_accept() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line  110)
* SOCK_CLOEXEC (socket モジュール):      定数<8>.            (line   38)
* sock_connect() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line   89)
* SOCK_DGRAM (socket モジュール):        定数<8>.            (line   27)
* SOCK_MAX_SIZE (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  141)
* SOCK_NONBLOCK (socket モジュール):     定数<8>.            (line   38)
* SOCK_RAW (socket モジュール):          定数<8>.            (line   27)
* SOCK_RDM (socket モジュール):          定数<8>.            (line   27)
* sock_recv_into() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line   26)
* sock_recv() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line   12)
* sock_recvfrom_into() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line   49)
* sock_recvfrom() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line   38)
* sock_sendall() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line   60)
* sock_sendfile() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line  132)
* sock_sendto() (asyncio.loop のメソッド): ソケットオブジェクトと直接やりとりする.
                                                             (line   78)
* SOCK_SEQPACKET (socket モジュール):    定数<8>.            (line   27)
* SOCK_STREAM (socket モジュール):       定数<8>.            (line   27)
* socket (socket のクラス):              ソケットの作成.     (line    8)
* socket (socketserver.BaseServer の属性): Serverオブジェクト<2>.
                                                             (line   87)
* socket_type (socketserver.BaseServer の属性): Serverオブジェクト<2>.
                                                             (line  108)
* socket() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  364)
* socket() (in module socket):           select --- I/O 完了の待機.
                                                             (line  145)
* SocketHandler (logging.handlers のクラス): SocketHandler.  (line   10)
* socketpair() (socket モジュール):      ソケットの作成.     (line   63)
* sockets (asyncio.Server の属性):       Serverオブジェクト. (line  130)
* SocketType (socket モジュール):        ソケットの作成.     (line  184)
* soft deprecated:                       用語集<2>.          (line 1615)
* soft keyword:                          ソフトキーワード.   (line    6)
* SOFT_KEYWORD (token モジュール):       token --- Python 解析木で使われる定数.
                                                             (line  178)
* softkwlist (keyword モジュール):       keyword --- Python キーワードのテスト.
                                                             (line   31)
* SOH (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   21)
* SOL_ALG (socket モジュール):           定数<8>.            (line  272)
* SOL_BLUETOOTH (socket モジュール):     定数<8>.            (line  334)
* SOL_HCI (socket モジュール):           定数<8>.            (line  334)
* SOL_L2CAP (socket モジュール):         定数<8>.            (line  334)
* SOL_RDS (socket モジュール):           定数<8>.            (line  243)
* SOL_RFCOMM (socket モジュール):        定数<8>.            (line  334)
* SOL_SCO (socket モジュール):           定数<8>.            (line  334)
* SOMAXCONN (socket モジュール):         定数<8>.            (line   55)
* sort_stats() (pstats.Stats のメソッド): Stats クラス.      (line   61)
* sort() (imaplib.IMAP4 のメソッド):     IMAP4 オブジェクト. (line  368)
* sort() (list のメソッド):              リスト型 list<2>.   (line   37)
* sortdict() (test.support モジュール):  test support --- Utilities for the Python test suite.
                                                             (line  292)
* sortTestMethodsUsing (unittest.TestLoader の属性): テストのロードと起動.
                                                             (line  194)
* source (doctest.Example の属性):       Example オブジェクト.
                                                             (line   16)
* source (pdb command):                  Debugger commands.  (line  290)
* source (shlex.shlex の属性):           shlex オブジェクト. (line  150)
* SOURCE_DATE_EPOCH:                     zipfile.            (line   11)
* SOURCE_DATE_EPOCH <1>:                 py_compile<3>.      (line    7)
* SOURCE_DATE_EPOCH <2>:                 ライブラリ<162>.    (line  452)
* SOURCE_DATE_EPOCH <3>:                 ビルド<67>.         (line   15)
* SOURCE_DATE_EPOCH <4>:                 py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   66)
* SOURCE_DATE_EPOCH <5>:                 py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   83)
* SOURCE_DATE_EPOCH <6>:                 py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   87)
* SOURCE_DATE_EPOCH <7>:                 コマンドラインでの使用<9>.
                                                             (line   94)
* source_from_cache() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line   58)
* source_hash() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line  164)
* SOURCE_SUFFIXES (importlib.machinery モジュール): importlib machinery -- Importers and path hooks.
                                                             (line   13)
* source_to_code() (importlib.abc.InspectLoader の静的メソッド): importlib abc -- Abstract base classes related to import.
                                                             (line  246)
* SourceFileLoader (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line  201)
* sourcehook() (shlex.shlex のメソッド): shlex オブジェクト. (line   26)
* SourcelessFileLoader (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line  240)
* SourceLoader (importlib.abc のクラス): importlib abc -- Abstract base classes related to import.
                                                             (line  331)
* SP (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  120)
* span() (re.Match のメソッド):          マッチオブジェクト. (line  165)
* sparse (tarfile.TarInfo の属性):       TarInfo オブジェクト.
                                                             (line  159)
* spawn_python() (test.support.script_helper モジュール): test support script_helper --- Utilities for the Python execution tests.
                                                             (line   69)
* spawn() (pty モジュール):              pty --- 擬似端末ユーティリティ.
                                                             (line   41)
* spawnl() (os モジュール):              プロセス管理.       (line  595)
* spawnle() (os モジュール):             プロセス管理.       (line  595)
* spawnlp() (os モジュール):             プロセス管理.       (line  595)
* spawnlpe() (os モジュール):            プロセス管理.       (line  595)
* spawnv() (os モジュール):              プロセス管理.       (line  595)
* spawnve() (os モジュール):             プロセス管理.       (line  595)
* spawnvp() (os モジュール):             プロセス管理.       (line  595)
* spawnvpe() (os モジュール):            プロセス管理.       (line  595)
* spec_from_file_location() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line  151)
* spec_from_loader() (importlib.util モジュール): importlib util -- Utility code for importers.
                                                             (line  142)
* special method:                        用語集<2>.          (line 1626)
* SpecialFileError:                      ディレクトリとファイルの操作.
                                                             (line   60)
* SpecialFileError <1>:                  tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  299)
* specified_attributes (xml.parsers.expat.xmlparser の属性): XMLParser オブジェクト<2>.
                                                             (line  202)
* speed() (turtle モジュール):           Turtle の動き.      (line  332)
* Spinbox (tkinter.ttk のクラス):        ttk Spinbox.        (line    6)
* SPLICE_F_MORE (os モジュール):         ファイル記述子の操作.
                                                             (line  908)
* SPLICE_F_MOVE (os モジュール):         ファイル記述子の操作.
                                                             (line  908)
* SPLICE_F_NONBLOCK (os モジュール):     ファイル記述子の操作.
                                                             (line  908)
* splice() (os モジュール):              ファイル記述子の操作.
                                                             (line  857)
* split() (BaseExceptionGroup のメソッド): 例外グループ.     (line   65)
* split() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  398)
* split() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  398)
* split() (os.path モジュール):          os path --- 一般的なパス名操作.
                                                             (line  502)
* split() (re モジュール):               関数<2>.            (line   77)
* split() (re.Pattern のメソッド):       正規表現オブジェクト.
                                                             (line   77)
* split() (shlex モジュール):            shlex --- 単純な字句解析.
                                                             (line   16)
* split() (str のメソッド):              文字列メソッド<2>.  (line  670)
* splitdrive() (os.path モジュール):     os path --- 一般的なパス名操作.
                                                             (line  518)
* splitext() (os.path モジュール):       os path --- 一般的なパス名操作.
                                                             (line  574)
* splitlines() (bytearray のメソッド):   bytes と bytearray の操作.
                                                             (line  642)
* splitlines() (bytes のメソッド):       bytes と bytearray の操作.
                                                             (line  642)
* splitlines() (str のメソッド):         文字列メソッド<2>.  (line  725)
* SplitResult (urllib.parse のクラス):   構造化された解析結果.
                                                             (line   54)
* SplitResultBytes (urllib.parse のクラス): 構造化された解析結果.
                                                             (line   81)
* splitroot() (os.path モジュール):      os path --- 一般的なパス名操作.
                                                             (line  543)
* SpooledTemporaryFile (tempfile のクラス): tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  151)
* sprintf 形式の書式化:                  printf 形式の文字列書式化.
                                                             (line    6)
* sprintf 形式の書式化 <1>:              printf 形式での bytes の書式化.
                                                             (line    6)
* SQLITE_DBCONFIG_DEFENSIVE (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DBCONFIG_DQS_DDL (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DBCONFIG_DQS_DML (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DBCONFIG_ENABLE_FKEY (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DBCONFIG_ENABLE_QPSG (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DBCONFIG_ENABLE_TRIGGER (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DBCONFIG_ENABLE_VIEW (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DBCONFIG_LEGACY_ALTER_TABLE (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DBCONFIG_LEGACY_FILE_FORMAT (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DBCONFIG_RESET_DATABASE (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DBCONFIG_TRIGGER_EQP (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DBCONFIG_TRUSTED_SCHEMA (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DBCONFIG_WRITABLE_SCHEMA (sqlite3 モジュール): モジュール定数.
                                                             (line  130)
* SQLITE_DENY (sqlite3 モジュール):      モジュール定数.     (line   48)
* sqlite_errorcode (sqlite3.Error の属性): 例外<7>.          (line   24)
* sqlite_errorname (sqlite3.Error の属性): 例外<7>.          (line   30)
* SQLITE_IGNORE (sqlite3 モジュール):    モジュール定数.     (line   48)
* SQLITE_OK (sqlite3 モジュール):        モジュール定数.     (line   48)
* sqlite_version (sqlite3 モジュール):   モジュール定数.     (line   78)
* sqlite_version_info (sqlite3 モジュール): モジュール定数.  (line   83)
* sqrt() (cmath モジュール):             指数関数と対数関数. (line   22)
* sqrt() (decimal.Context のメソッド):   Context オブジェクト.
                                                             (line  527)
* sqrt() (decimal.Decimal のメソッド):   Decimal オブジェクト.
                                                             (line  554)
* sqrt() (math モジュール):              Power exponential and logarithmic functions.
                                                             (line   87)
* ssizeargfunc (C type):                 Slot Type typedefs. (line  135)
* ssizeobjargproc (C type):              Slot Type typedefs. (line  139)
* SSL:                                   ssl --- ソケットオブジェクト用の TLS/SSL ラッパー.
                                                             (line    8)
* ssl_version (ftplib.FTP_TLS の属性):   FTP_TLS オブジェクト.
                                                             (line   84)
* SSLCertVerificationError:              例外<19>.           (line   77)
* SSLContext (ssl のクラス):             SSL コンテキスト.   (line   13)
* SSLEOFError:                           例外<19>.           (line   69)
* SSLError:                              例外<19>.           (line    6)
* SSLErrorNumber (ssl のクラス):         定数<9>.            (line  556)
* SSLKEYLOGFILE:                         コンテキストの作成. (line   34)
* SSLKEYLOGFILE <1>:                     コンテキストの作成. (line   83)
* SSLObject (ssl のクラス):              メモリ BIO サポート<2>.
                                                             (line   30)
* sslobject_class (ssl.SSLContext の属性): SSL コンテキスト. (line  472)
* SSLSession (ssl のクラス):             SSL セッション.     (line    8)
* SSLSocket (ssl のクラス):              SSL ソケット.       (line    6)
* sslsocket_class (ssl.SSLContext の属性): SSL コンテキスト. (line  446)
* SSLSyscallError:                       例外<19>.           (line   61)
* SSLv3 (ssl.TLSVersion の属性):         定数<9>.            (line  578)
* SSLWantReadError:                      例外<19>.           (line   43)
* SSLWantWriteError:                     例外<19>.           (line   52)
* SSLZeroReturnError:                    例外<19>.           (line   34)
* st_atime (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1214)
* ST_ATIME (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  168)
* st_atime_ns (os.stat_result の属性):   ファイルとディレクトリ.
                                                             (line 1231)
* st_birthtime (os.stat_result の属性):  ファイルとディレクトリ.
                                                             (line 1255)
* st_birthtime_ns (os.stat_result の属性): ファイルとディレクトリ.
                                                             (line 1263)
* st_blksize (os.stat_result の属性):    ファイルとディレクトリ.
                                                             (line 1301)
* st_blocks (os.stat_result の属性):     ファイルとディレクトリ.
                                                             (line 1295)
* st_creator (os.stat_result の属性):    ファイルとディレクトリ.
                                                             (line 1337)
* st_ctime (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1222)
* ST_CTIME (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  176)
* st_ctime_ns (os.stat_result の属性):   ファイルとディレクトリ.
                                                             (line 1243)
* st_dev (os.stat_result の属性):        ファイルとディレクトリ.
                                                             (line 1189)
* ST_DEV (stat モジュール):              stat --- stat の結果を解釈する.
                                                             (line  147)
* st_file_attributes (os.stat_result の属性): ファイルとディレクトリ.
                                                             (line 1347)
* st_flags (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1311)
* st_fstype (os.stat_result の属性):     ファイルとディレクトリ.
                                                             (line 1326)
* st_gen (os.stat_result の属性):        ファイルとディレクトリ.
                                                             (line 1319)
* st_gid (os.stat_result の属性):        ファイルとディレクトリ.
                                                             (line 1201)
* ST_GID (stat モジュール):              stat --- stat の結果を解釈する.
                                                             (line  159)
* st_ino (os.stat_result の属性):        ファイルとディレクトリ.
                                                             (line 1180)
* ST_INO (stat モジュール):              stat --- stat の結果を解釈する.
                                                             (line  143)
* st_mode (os.stat_result の属性):       ファイルとディレクトリ.
                                                             (line 1175)
* ST_MODE (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  139)
* st_mtime (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1218)
* ST_MTIME (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  172)
* st_mtime_ns (os.stat_result の属性):   ファイルとディレクトリ.
                                                             (line 1237)
* st_nlink (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1193)
* ST_NLINK (stat モジュール):            stat --- stat の結果を解釈する.
                                                             (line  151)
* st_rdev (os.stat_result の属性):       ファイルとディレクトリ.
                                                             (line 1307)
* st_reparse_tag (os.stat_result の属性): ファイルとディレクトリ.
                                                             (line 1357)
* st_rsize (os.stat_result の属性):      ファイルとディレクトリ.
                                                             (line 1333)
* st_size (os.stat_result の属性):       ファイルとディレクトリ.
                                                             (line 1205)
* ST_SIZE (stat モジュール):             stat --- stat の結果を解釈する.
                                                             (line  163)
* st_type (os.stat_result の属性):       ファイルとディレクトリ.
                                                             (line 1341)
* st_uid (os.stat_result の属性):        ファイルとディレクトリ.
                                                             (line 1197)
* ST_UID (stat モジュール):              stat --- stat の結果を解釈する.
                                                             (line  155)
* st() (turtle モジュール):              可視性.             (line   15)
* stack (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line   73)
* stack viewer:                          Debug メニュー Shell ウィンドウのみ.
                                                             (line   15)
* stack_effect() (dis モジュール):       解析関数.           (line  191)
* stack_size() (_thread モジュール):     _thread --- 低水準なスレッド API.
                                                             (line  109)
* stack_size() (threading モジュール):   リファレンス<2>.    (line  156)
* stack() (inspect モジュール):          インタープリタスタック.
                                                             (line  164)
* StackSummary (traceback のクラス):     StackSummary オブジェクト.
                                                             (line   11)
* stamp() (turtle モジュール):           Turtle の動き.      (line  276)
* standard library:                      用語集<2>.          (line 1633)
* standard_b64decode() (base64 モジュール): RFC 4648 エンコーディング.
                                                             (line   55)
* standard_b64encode() (base64 モジュール): RFC 4648 エンコーディング.
                                                             (line   49)
* standard;output:                       式文 expression statement.
                                                             (line   16)
* standend() (curses.window のメソッド): Window オブジェクト.
                                                             (line  511)
* standout() (curses.window のメソッド): Window オブジェクト.
                                                             (line  516)
* STAR (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  230)
* STAREQUAL (token モジュール):          token --- Python 解析木で使われる定数.
                                                             (line  296)
* starmap_async() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line  167)
* starmap() (itertools モジュール):      Itertool関数.       (line  546)
* starmap() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line  156)
* Starred (ast のクラス):                変数.               (line   40)
* start (range の属性):                  range.              (line   56)
* start (slice の属性):                  組み込み関数.       (line 1793)
* start (UnicodeError の属性):           具象例外.           (line  447)
* start (スライスオブジェクトの属性):    シーケンス型 sequence.
                                                             (line   18)
* start (スライスオブジェクトの属性) <1>: スライス slice オブジェクト.
                                                             (line   10)
* start_color() (curses モジュール):     関数<6>.            (line  492)
* start_new_thread() (_thread モジュール): _thread --- 低水準なスレッド API.
                                                             (line   31)
* start_ns() (xml.etree.ElementTree.TreeBuilder のメソッド): TreeBuilder オブジェクト.
                                                             (line   74)
* start_server() (asyncio モジュール):   ストリーム.         (line   76)
* start_serving() (asyncio.Server のメソッド): Serverオブジェクト.
                                                             (line   75)
* start_threads() (test.support.threading_helper モジュール): test support threading_helper --- Utilities for threading tests.
                                                             (line   22)
* start_tls() (asyncio.loop のメソッド): TLS へのアップグレード.
                                                             (line    6)
* start_tls() (asyncio.StreamWriter のメソッド): StreamWriter.
                                                             (line   86)
* start_trace() (bdb.Bdb のメソッド):    bdb --- デバッガーフレームワーク.
                                                             (line  172)
* start_unix_server() (asyncio モジュール): ストリーム.      (line  145)
* start() (logging.handlers.QueueListener のメソッド): QueueListener.
                                                             (line   82)
* start() (multiprocessing.managers.BaseManager のメソッド): マネージャー.
                                                             (line   60)
* start() (multiprocessing.Process のメソッド): Process クラスと例外.
                                                             (line   91)
* start() (re.Match のメソッド):         マッチオブジェクト. (line  140)
* start() (threading.Thread のメソッド): Thread objects.     (line  112)
* start() (tkinter.ttk.Progressbar のメソッド): ttk Progressbar.
                                                             (line    8)
* start() (tracemalloc モジュール):      関数<11>.           (line   68)
* start() (xml.etree.ElementTree.TreeBuilder のメソッド): TreeBuilder オブジェクト.
                                                             (line   42)
* StartBoundaryNotFoundDefect:           email errors Exception and Defect classes.
                                                             (line   80)
* startCDATA() (xml.sax.handler.LexicalHandler のメソッド): LexicalHandler Objects.
                                                             (line   32)
* StartCdataSectionHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  382)
* StartDoctypeDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  268)
* startDocument() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line   30)
* startDTD() (xml.sax.handler.LexicalHandler のメソッド): LexicalHandler Objects.
                                                             (line   23)
* startElement() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line   77)
* StartElementHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  303)
* startElementNS() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line   96)
* STARTF_FORCEOFFFEEDBACK (subprocess モジュール): Windows Constants.
                                                             (line   47)
* STARTF_FORCEONFEEDBACK (subprocess モジュール): Windows Constants.
                                                             (line   38)
* STARTF_USESHOWWINDOW (subprocess モジュール): Windows Constants.
                                                             (line   33)
* STARTF_USESTDHANDLES (subprocess モジュール): Windows Constants.
                                                             (line   27)
* startfile() (os モジュール):           プロセス管理.       (line  712)
* StartNamespaceDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  362)
* startPrefixMapping() (xml.sax.handler.ContentHandler のメソッド): ContentHandler オブジェクト.
                                                             (line   47)
* StartResponse (wsgiref.types のクラス): wsgiref types -- WSGI types for static type checking.
                                                             (line   11)
* startswith() (bytearray のメソッド):   bytes と bytearray の操作.
                                                             (line  253)
* startswith() (bytes のメソッド):       bytes と bytearray の操作.
                                                             (line  253)
* startswith() (str のメソッド):         文字列メソッド<2>.  (line  796)
* startTest() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  340)
* startTestRun() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  348)
* starttls() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  386)
* starttls() (smtplib.SMTP のメソッド):  SMTP オブジェクト.  (line  179)
* STARTUPINFO (subprocess のクラス):     Windows Popen ヘルパー.
                                                             (line    9)
* stat_result (os のクラス):             ファイルとディレクトリ.
                                                             (line 1167)
* stat() (os モジュール):                ファイルとディレクトリ.
                                                             (line 1110)
* stat() (os.DirEntry のメソッド):       ファイルとディレクトリ.
                                                             (line 1073)
* stat() (pathlib.Path のメソッド):      ファイルの種類とステータスを問い合わせる.
                                                             (line   20)
* stat() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   50)
* state() (tkinter.ttk.Widget のメソッド): ttk Widget.       (line   27)
* statement:                             用語集<2>.          (line 1645)
* statement;assert:                      assert 文.          (line    6)
* statement;assert <1>:                  具象例外.           (line   10)
* statement;assignment, annotated:       注釈付き代入文 annotated assignment statements.
                                                             (line    6)
* statement;assignment, augmented:       累算代入文 augmented assignment statement.
                                                             (line    6)
* statement;async def:                   コルーチン<2>.      (line    8)
* statement;async for:                   コルーチン関数定義. (line   28)
* statement;async with:                  async for 文.       (line   42)
* statement;break:                       break 文.           (line    6)
* statement;break <1>:                   while 文.           (line   16)
* statement;break <2>:                   for 文<2>.          (line   22)
* statement;break <3>:                   except* 節.         (line   66)
* statement;break <4>:                   finally 節.         (line   26)
* statement;continue:                    continue 文.        (line    6)
* statement;continue <1>:                while 文.           (line   16)
* statement;continue <2>:                for 文<2>.          (line   22)
* statement;continue <3>:                except* 節.         (line   65)
* statement;continue <4>:                finally 節.         (line   26)
* statement;def:                         関数定義.           (line    6)
* statement;del:                         基本的なカスタマイズ.
                                                             (line   53)
* statement;del <1>:                     del 文<2>.          (line    6)
* statement;del <2>:                     ミュータブルなシーケンス型.
                                                             (line   16)
* statement;del <3>:                     マッピング型 --- dict.
                                                             (line    6)
* statement;except:                      組み込み例外.       (line    6)
* statement;for:                         for 文.             (line    6)
* statement;for <1>:                     break 文.           (line    6)
* statement;for <2>:                     continue 文.        (line    6)
* statement;for <3>:                     for 文<2>.          (line    6)
* statement;if:                          if 文<2>.           (line    6)
* statement;if <1>:                      真理値判定.         (line    6)
* statement;import:                      モジュール<3>.      (line    6)
* statement;import <1>:                  import 文.          (line    6)
* statement;import <2>:                  組み込み関数.       (line 2178)
* statement;import <3>:                  site --- サイト固有の設定フック.
                                                             (line   56)
* statement;match:                       match 文<2>.        (line    6)
* statement;nonlocal:                    nonlocal 文.        (line    6)
* statement;pass:                        pass 文<2>.         (line    6)
* statement;raise:                       raise 文.           (line    6)
* statement;raise <1>:                   組み込み例外.       (line   13)
* statement;return:                      return 文.          (line    6)
* statement;return <1>:                  except* 節.         (line   66)
* statement;return <2>:                  finally 節.         (line   26)
* statement;try:                         トレースバック traceback オブジェクト.
                                                             (line   31)
* statement;try <1>:                     try 文.             (line    6)
* statement;try <2>:                     組み込み例外.       (line    6)
* statement;type:                        The type statement. (line    6)
* statement;while:                       break 文.           (line    6)
* statement;while <1>:                   continue 文.        (line    6)
* statement;while <2>:                   while 文.           (line    6)
* statement;while <3>:                   真理値判定.         (line    6)
* statement;with:                        with文とコンテキストマネージャ.
                                                             (line   13)
* statement;with <1>:                    with 文.            (line    6)
* statement;yield:                       yield 文.           (line    6)
* statement;クラス:                      クラス定義.         (line    6)
* statement;グローバル:                  del 文<2>.          (line   15)
* statement;グローバル <1>:              global 文.          (line    6)
* static type checker:                   用語集<2>.          (line 1652)
* static_order() (graphlib.TopologicalSorter のメソッド): graphlib --- グラフ構造を操作する機能.
                                                             (line  167)
* Statistic (tracemalloc のクラス):      Statistic.          (line    6)
* StatisticDiff (tracemalloc のクラス):  StatisticDiff.      (line    6)
* statistics() (tracemalloc.Snapshot のメソッド): Snapshot.  (line   57)
* StatisticsError:                       例外<5>.            (line    8)
* Stats (pstats のクラス):               Stats クラス.       (line    8)
* status (http.client.HTTPResponse の属性): HTTPResponse オブジェクト.
                                                             (line   62)
* status (urllib.response.addinfourl の属性): urllib response --- Response classes used by urllib.
                                                             (line   24)
* status() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  399)
* statvfs() (os モジュール):             ファイルとディレクトリ.
                                                             (line 1409)
* STD_ERROR_HANDLE (subprocess モジュール): Windows Constants.
                                                             (line   18)
* STD_INPUT_HANDLE (subprocess モジュール): Windows Constants.
                                                             (line    8)
* STD_OUTPUT_HANDLE (subprocess モジュール): Windows Constants.
                                                             (line   13)
* stderr (asyncio.subprocess.Process の属性): サブプロセスとやりとりする.
                                                             (line  128)
* stderr (subprocess.CalledProcessError の属性): Using the subprocess Module.
                                                             (line  231)
* stderr (subprocess.CompletedProcess の属性): Using the subprocess Module.
                                                             (line  128)
* stderr (subprocess.Popen の属性):      Popen オブジェクト. (line  137)
* stderr (subprocess.TimeoutExpired の属性): Using the subprocess Module.
                                                             (line  192)
* stderr (sys モジュール):               I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* stderr (sys モジュール) <1>:           sys --- システム固有のパラメーターと関数.
                                                             (line 1957)
* stderr (sys モジュール) <2>:           サブインタプリタサポート.
                                                             (line  109)
* stderr (sys モジュール) <3>:           サブインタプリタサポート.
                                                             (line  197)
* stdev (statistics.NormalDist の属性):  NormalDist オブジェクト.
                                                             (line   35)
* stdev() (statistics モジュール):       関数の詳細.         (line  422)
* stdin (asyncio.subprocess.Process の属性): サブプロセスとやりとりする.
                                                             (line  118)
* stdin (subprocess.Popen の属性):       Popen オブジェクト. (line  118)
* stdin (sys モジュール):                I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* stdin (sys モジュール) <1>:            sys --- システム固有のパラメーターと関数.
                                                             (line 1957)
* stdin (sys モジュール) <2>:            サブインタプリタサポート.
                                                             (line  109)
* stdin (sys モジュール) <3>:            サブインタプリタサポート.
                                                             (line  197)
* stdio:                                 I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* stdlib:                                用語集<2>.          (line 1658)
* stdlib_module_names (sys モジュール):  sys --- システム固有のパラメーターと関数.
                                                             (line 2045)
* stdout (asyncio.subprocess.Process の属性): サブプロセスとやりとりする.
                                                             (line  123)
* STDOUT (subprocess モジュール):        Using the subprocess Module.
                                                             (line  156)
* stdout (subprocess.CalledProcessError の属性): Using the subprocess Module.
                                                             (line  227)
* stdout (subprocess.CompletedProcess の属性): Using the subprocess Module.
                                                             (line  117)
* stdout (subprocess.Popen の属性):      Popen オブジェクト. (line  127)
* stdout (subprocess.TimeoutExpired の属性): Using the subprocess Module.
                                                             (line  188)
* stdout (sys モジュール):               I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* stdout (sys モジュール) <1>:           sys --- システム固有のパラメーターと関数.
                                                             (line 1957)
* stdout (sys モジュール) <2>:           サブインタプリタサポート.
                                                             (line  109)
* stdout (sys モジュール) <3>:           サブインタプリタサポート.
                                                             (line  197)
* stem (pathlib.PurePath の属性):        メソッドとプロパティ.
                                                             (line  167)
* step (pdb command):                    Debugger commands.  (line  205)
* step (range の属性):                   range.              (line   64)
* step (slice の属性):                   組み込み関数.       (line 1793)
* step (スライスオブジェクトの属性):     シーケンス型 sequence.
                                                             (line   18)
* step (スライスオブジェクトの属性) <1>: スライス slice オブジェクト.
                                                             (line   10)
* step() (tkinter.ttk.Progressbar のメソッド): ttk Progressbar.
                                                             (line   15)
* stls() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line  114)
* stop (range の属性):                   range.              (line   60)
* stop (slice の属性):                   組み込み関数.       (line 1793)
* stop (スライスオブジェクトの属性):     シーケンス型 sequence.
                                                             (line   18)
* stop (スライスオブジェクトの属性) <1>: スライス slice オブジェクト.
                                                             (line   10)
* stop_here() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  276)
* STOP_ITERATION (monitoring event):     Events.             (line   92)
* stop_trace() (bdb.Bdb のメソッド):     bdb --- デバッガーフレームワーク.
                                                             (line  179)
* stop() (asyncio.loop のメソッド):      ループの開始と停止. (line   35)
* stop() (logging.handlers.QueueListener のメソッド): QueueListener.
                                                             (line   92)
* stop() (tkinter.ttk.Progressbar のメソッド): ttk Progressbar.
                                                             (line   22)
* stop() (tracemalloc モジュール):       関数<11>.           (line   98)
* stop() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  323)
* StopAsyncIteration:                    具象例外.           (line  294)
* StopIteration:                         具象例外.           (line  261)
* stopListening() (logging.config モジュール): 環境設定のための関数.
                                                             (line  169)
* stopTest() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  344)
* stopTestRun() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  354)
* storbinary() (ftplib.FTP のメソッド):  FTP オブジェクト.   (line  217)
* Store (ast のクラス):                  変数.               (line   11)
* STORE_ACTIONS (optparse.Option の属性): 新しいアクションの追加.
                                                             (line   35)
* STORE_ATTR (opcode):                   Python バイトコード命令.
                                                             (line  588)
* STORE_DEREF (opcode):                  Python バイトコード命令.
                                                             (line 1037)
* STORE_FAST (opcode):                   Python バイトコード命令.
                                                             (line  987)
* STORE_FAST_LOAD_FAST (opcode):         Python バイトコード命令.
                                                             (line  998)
* STORE_FAST_STORE_FAST (opcode):        Python バイトコード命令.
                                                             (line  991)
* STORE_GLOBAL (opcode):                 Python バイトコード命令.
                                                             (line  609)
* STORE_NAME (opcode):                   Python バイトコード命令.
                                                             (line  546)
* STORE_SLICE (opcode):                  Python バイトコード命令.
                                                             (line  297)
* STORE_SUBSCR (opcode):                 Python バイトコード命令.
                                                             (line  269)
* store() (imaplib.IMAP4 のメソッド):    IMAP4 オブジェクト. (line  403)
* storlines() (ftplib.FTP のメソッド):   FTP オブジェクト.   (line  246)
* str (組み込みクラス):                  テキストシーケンス型 --- str.
                                                             (line   44)
* str (組み込みクラス);(string も参照のこと): range.         (line  119)
* str_digits_check_threshold (sys.int_info の属性): sys --- システム固有のパラメーターと関数.
                                                             (line 1191)
* str() (locale モジュール):             locale --- 国際化サービス.
                                                             (line  489)
* Strategy (compression.zstd のクラス):  Advanced parameter control.
                                                             (line  296)
* strategy (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  121)
* strcoll() (locale モジュール):         locale --- 国際化サービス.
                                                             (line  443)
* StreamError:                           tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  265)
* StreamHandler (logging のクラス):      StreamHandler.      (line   12)
* StreamReader (asyncio のクラス):       StreamReader.       (line    6)
* StreamReader (codecs のクラス):        StreamReader オブジェクト.
                                                             (line   11)
* streamreader (codecs.CodecInfo の属性): codecs --- codec レジストリと基底クラス.
                                                             (line   98)
* StreamReaderWriter (codecs のクラス):  StreamReaderWriter オブジェクト.
                                                             (line   12)
* StreamRecoder (codecs のクラス):       StreamRecoder オブジェクト.
                                                             (line   13)
* StreamRequestHandler (socketserver のクラス): Request Handler Objects.
                                                             (line   55)
* StreamWriter (asyncio のクラス):       StreamWriter.       (line    6)
* StreamWriter (codecs のクラス):        StreamWriter オブジェクト.
                                                             (line   11)
* streamwriter (codecs.CodecInfo の属性): codecs --- codec レジストリと基底クラス.
                                                             (line   98)
* StrEnum (enum のクラス):               データ型<2>.        (line  395)
* strerror (C function):                 例外の送出.         (line   58)
* strerror (OSError の属性):             具象例外.           (line  183)
* strerror() (os モジュール):            プロセスのパラメーター.
                                                             (line  552)
* strftime() (datetime.date のメソッド): date objects.       (line  325)
* strftime() (datetime.datetime のメソッド): datetime objects.
                                                             (line  756)
* strftime() (datetime.time のメソッド): time objects.       (line  234)
* strftime() (time モジュール):          関数<5>.            (line  318)
* strict (csv.Dialect の属性):           Dialect クラスと書式化パラメータ.
                                                             (line   90)
* strict (email.policy モジュール):      email policy Policy Objects.
                                                             (line  529)
* STRICT (enum.FlagBoundary の属性):     データ型<2>.        (line  674)
* strict_domain (http.cookiejar.DefaultCookiePolicy の属性): DefaultCookiePolicy オブジェクト.
                                                             (line   95)
* strict_errors() (codecs モジュール):   エラーハンドラ.     (line  134)
* strict_ns_domain (http.cookiejar.DefaultCookiePolicy の属性): DefaultCookiePolicy オブジェクト.
                                                             (line  117)
* strict_ns_set_initial_dollar (http.cookiejar.DefaultCookiePolicy の属性): DefaultCookiePolicy オブジェクト.
                                                             (line  123)
* strict_ns_set_path (http.cookiejar.DefaultCookiePolicy の属性): DefaultCookiePolicy オブジェクト.
                                                             (line  127)
* strict_ns_unverifiable (http.cookiejar.DefaultCookiePolicy の属性): DefaultCookiePolicy オブジェクト.
                                                             (line  112)
* strict_rfc2965_unverifiable (http.cookiejar.DefaultCookiePolicy の属性): DefaultCookiePolicy オブジェクト.
                                                             (line  103)
* strict;error handler's name:           エラーハンドラ.     (line   14)
* STRIDED (inspect.BufferFlags の属性):  Buffer flags.       (line   37)
* STRIDED_RO (inspect.BufferFlags の属性): Buffer flags.     (line   39)
* STRIDES (inspect.BufferFlags の属性):  Buffer flags.       (line   23)
* strides (memoryview の属性):           メモリビュー.       (line  489)
* STRING (annotationlib.Format の属性):  クラス<5>.          (line   37)
* string (re.Match の属性):              マッチオブジェクト. (line  202)
* STRING (token モジュール):             token --- Python 解析木で使われる定数.
                                                             (line   50)
* string_at() (ctypes モジュール):       ユーティリティー関数.
                                                             (line  269)
* string;__format__() (オブジェクトメソッド): 基本的なカスタマイズ.
                                                             (line  149)
* string;__str__() (オブジェクトメソッド): 基本的なカスタマイズ.
                                                             (line  128)
* string;format() (組み込み関数):        組み込み関数.       (line  778)
* string;formatted literal:              出力を見やすくフォーマットする.
                                                             (line   90)
* string;formatted literal <1>:          Raw string literals.
                                                             (line   25)
* string;formatted literal <2>:          文字列メソッド<2>.  (line  928)
* string;formatting, printf:             printf 形式の文字列書式化.
                                                             (line    6)
* string;immutable sequences:            変更不能なシーケンス immutable sequence.
                                                             (line   14)
* string;interpolated literal:           出力を見やすくフォーマットする.
                                                             (line   90)
* string;interpolated literal <1>:       Raw string literals.
                                                             (line   25)
* string;interpolated literal <2>:       文字列メソッド<2>.  (line  928)
* string;interpolation, printf:          printf 形式の文字列書式化.
                                                             (line    6)
* string;object representation:          ファイナライズとメモリ解放.
                                                             (line   95)
* string;PyObject_Str (C 関数):          オブジェクトプロトコル object protocol.
                                                             (line  347)
* string;str (組み込みクラス):           テキストシーケンス型 --- str.
                                                             (line   44)
* string;str() (built-in function):      組み込み関数.       (line 1886)
* string;テキストシーケンス型:           range.              (line  119)
* string;メソッド:                       テキストシーケンス型 --- str.
                                                             (line   91)
* string;変換:                           基本的なカスタマイズ.
                                                             (line  149)
* string;変換 <1>:                       式文 expression statement.
                                                             (line   16)
* string;要素:                           変更不能なシーケンス immutable sequence.
                                                             (line   16)
* StringIO (io のクラス):                テキスト I/O<2>.    (line  239)
* strings (string.templatelib.Template の属性): 型.          (line   45)
* strings, documentation:                関数を定義する.     (line   21)
* strings, documentation <1>:            ドキュメンテーション文字列.
                                                             (line    6)
* strip_dirs() (pstats.Stats のメソッド): Stats クラス.      (line   32)
* strip() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  442)
* strip() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  442)
* strip() (str のメソッド):              文字列メソッド<2>.  (line  814)
* stripspaces (curses.textpad.Textbox の属性): Textbox オブジェクト.
                                                             (line  118)
* strong reference:                      用語集<2>.          (line 1662)
* strptime() (datetime.date のクラスメソッド): date objects. (line   97)
* strptime() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line  256)
* strptime() (datetime.time のクラスメソッド): time objects. (line  146)
* strptime() (time モジュール):          関数<5>.            (line  475)
* strsignal() (signal モジュール):       モジュールの内容<2>.
                                                             (line  321)
* Struct (struct のクラス):              クラス<3>.          (line    8)
* struct_time (time のクラス):           関数<5>.            (line  509)
* structmember.h:                        Member types.       (line  122)
* Structure (ctypes のクラス):           構造化データ型.     (line   41)
* strxfrm() (locale モジュール):         locale --- 国際化サービス.
                                                             (line  450)
* STX (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   24)
* Style (tkinter.ttk のクラス):          Ttk スタイル.       (line   21)
* Sub (ast のクラス):                    式 expression<2>.   (line   55)
* SUB (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  102)
* sub() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  165)
* sub() (re モジュール):                 関数<2>.            (line  167)
* sub() (re.Pattern のメソッド):         正規表現オブジェクト.
                                                             (line   94)
* subdirs (filecmp.dircmp の属性):       dircmp クラス.      (line  102)
* SubElement() (xml.etree.ElementTree モジュール): 関数<9>.  (line  205)
* subgroup() (BaseExceptionGroup のメソッド): 例外グループ.  (line   39)
* submit() (concurrent.futures.Executor のメソッド): Executor オブジェクト.
                                                             (line   11)
* submodule_search_locations (importlib.machinery.ModuleSpec の属性): importlib machinery -- Importers and path hooks.
                                                             (line  400)
* subn() (re モジュール):                関数<2>.            (line  241)
* subn() (re.Pattern のメソッド):        正規表現オブジェクト.
                                                             (line   99)
* subnet_of() (ipaddress.IPv4Network のメソッド): Network オブジェクト.
                                                             (line  215)
* subnet_of() (ipaddress.IPv6Network のメソッド): Network オブジェクト.
                                                             (line  350)
* subnets() (ipaddress.IPv4Network のメソッド): Network オブジェクト.
                                                             (line  173)
* subnets() (ipaddress.IPv6Network のメソッド): Network オブジェクト.
                                                             (line  346)
* Subnormal (decimal のクラス):          シグナル.           (line   90)
* suboffsets (memoryview の属性):        メモリビュー.       (line  498)
* subpad() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  520)
* subprocess_exec() (asyncio.loop のメソッド): サブプロセスの実行.
                                                             (line   16)
* subprocess_shell() (asyncio.loop のメソッド): サブプロセスの実行.
                                                             (line  117)
* SubprocessError:                       Using the subprocess Module.
                                                             (line  161)
* SubprocessProtocol (asyncio のクラス): 基底プロトコル.     (line   25)
* SubprocessTransport (asyncio のクラス): トランスポートのクラス階層構造.
                                                             (line   52)
* subscribe() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  429)
* Subscript (ast のクラス):              配列要素の参照 Subscripting.
                                                             (line    6)
* subsequent_indent (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  217)
* substitute() (string.Template のメソッド): Template strings $-strings.
                                                             (line   50)
* subTest() (unittest.TestCase のメソッド): テストクラス.    (line  109)
* subtract() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line   85)
* subtract() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  531)
* subtype (email.headerregistry.ContentTypeHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  272)
* subwin() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  527)
* successful() (multiprocessing.pool.AsyncResult のメソッド): プロセスプール.
                                                             (line  221)
* suffix (pathlib.PurePath の属性):      メソッドとプロパティ.
                                                             (line  137)
* suffix_map (mimetypes モジュール):     mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  146)
* suffix_map (mimetypes.MimeTypes の属性): MimeTypes objects.
                                                             (line   23)
* suffixes (pathlib.PurePath の属性):    メソッドとプロパティ.
                                                             (line  153)
* suite:                                 複合文 compound statement.
                                                             (line   17)
* suiteClass (unittest.TestLoader の属性): テストのロードと起動.
                                                             (line  199)
* sum_list():                            参照カウントの詳細. (line  141)
* sum_sequence():                        参照カウントの詳細. (line  168)
* sum_sequence() <1>:                    例外<24>.           (line   65)
* summarize_address_range() (ipaddress モジュール): その他のモジュールレベル関数.
                                                             (line   27)
* summarize() (doctest.DocTestRunner のメソッド): DocTestRunner オブジェクト.
                                                             (line  125)
* sumprod() (math モジュール):           Summation and product functions.
                                                             (line   58)
* SUNDAY (calendar モジュール):          calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  440)
* super (pyclbr.Class の属性):           クラスオブジェクト<2>.
                                                             (line   42)
* super (組み込みクラス):                組み込み関数.       (line 1924)
* supernet_of() (ipaddress.IPv4Network のメソッド): Network オブジェクト.
                                                             (line  227)
* supernet_of() (ipaddress.IPv6Network のメソッド): Network オブジェクト.
                                                             (line  352)
* supernet() (ipaddress.IPv4Network のメソッド): Network オブジェクト.
                                                             (line  199)
* supernet() (ipaddress.IPv6Network のメソッド): Network オブジェクト.
                                                             (line  348)
* supports_bytes_environ (os モジュール): プロセスのパラメーター.
                                                             (line  558)
* supports_dir_fd (os モジュール):       ファイルとディレクトリ.
                                                             (line 1453)
* supports_effective_ids (os モジュール): ファイルとディレクトリ.
                                                             (line 1478)
* supports_fd (os モジュール):           ファイルとディレクトリ.
                                                             (line 1497)
* supports_follow_symlinks (os モジュール): ファイルとディレクトリ.
                                                             (line 1516)
* supports_unicode_filenames (os.path モジュール): os path --- 一般的なパス名操作.
                                                             (line  605)
* SupportsAbs (typing のクラス):         プロトコル<4>.      (line    9)
* SupportsBytes (typing のクラス):       プロトコル<4>.      (line   13)
* SupportsComplex (typing のクラス):     プロトコル<4>.      (line   17)
* SupportsFloat (typing のクラス):       プロトコル<4>.      (line   21)
* SupportsIndex (typing のクラス):       プロトコル<4>.      (line   25)
* SupportsInt (typing のクラス):         プロトコル<4>.      (line   31)
* SupportsRound (typing のクラス):       プロトコル<4>.      (line   35)
* suppress() (contextlib モジュール):    ユーティリティ.     (line  272)
* SuppressCrashReport (test.support のクラス): test support --- Utilities for the Python test suite.
                                                             (line  789)
* surrogateescape;error handler's name:  エラーハンドラ.     (line   14)
* surrogatepass;error handler's name:    エラーハンドラ.     (line   71)
* SW_HIDE (subprocess モジュール):       Windows Constants.  (line   23)
* SWAP (opcode):                         Python バイトコード命令.
                                                             (line  182)
* swap_attr() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  395)
* swap_item() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  412)
* swapcase() (bytearray のメソッド):     bytes と bytearray の操作.
                                                             (line  667)
* swapcase() (bytes のメソッド):         bytes と bytearray の操作.
                                                             (line  667)
* swapcase() (str のメソッド):           文字列メソッド<2>.  (line  844)
* Symbol (symtable のクラス):            記号表の検査.       (line  195)
* SymbolTable (symtable のクラス):       記号表の検査.       (line   49)
* SymbolTableType (symtable のクラス):   記号表の検査.       (line    6)
* symlink_to() (pathlib.Path のメソッド): ファイルとディレクトリの作成.
                                                             (line   44)
* symlink() (os モジュール):             ファイルとディレクトリ.
                                                             (line 1539)
* symmetric_difference_update() (set のメソッド): set（集合）型 --- set frozenset.
                                                             (line  191)
* symmetric_difference() (frozenset のメソッド): set（集合）型 --- set frozenset.
                                                             (line  120)
* symmetric_difference() (set のメソッド): set（集合）型 --- set frozenset.
                                                             (line  120)
* symtable() (symtable モジュール):      記号表の生成.       (line    6)
* SYMTYPE (tarfile モジュール):          tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  338)
* SYN (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   90)
* sync() (dbm.dumb.dumbdbm のメソッド):  dbm dumb --- Portable DBM implementation.
                                                             (line   84)
* sync() (dbm.gnu.gdbm のメソッド):      dbm gnu --- GNU database manager.
                                                             (line  127)
* sync() (os モジュール):                ファイルとディレクトリ.
                                                             (line 1589)
* sync() (shelve.Shelf のメソッド):      shelve --- Python オブジェクトの永続化.
                                                             (line   68)
* syncdown() (curses.window のメソッド): Window オブジェクト.
                                                             (line  537)
* synchronization primitive:             用語集<2>.          (line 1685)
* synchronized() (multiprocessing.sharedctypes モジュール): The multiprocessing sharedctypes module.
                                                             (line   96)
* SyncManager (multiprocessing.managers のクラス): マネージャー.
                                                             (line  153)
* syncok() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  544)
* syncup() (curses.window のメソッド):   Window オブジェクト.
                                                             (line  549)
* SyntaxErr:                             例外<23>.           (line   89)
* SyntaxError:                           具象例外.           (line  302)
* SyntaxWarning:                         警告.               (line   42)
* sys_version (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  191)
* sys.exc_info:                          トレースバック traceback オブジェクト.
                                                             (line    6)
* sys.exception:                         トレースバック traceback オブジェクト.
                                                             (line    6)
* sys.last_traceback:                    トレースバック traceback オブジェクト.
                                                             (line    6)
* sys.meta_path:                         メタパス.           (line    6)
* sys.modules:                           モジュールキャッシュ.
                                                             (line    6)
* sys.path:                              パスエントリ・ファインダー.
                                                             (line    6)
* sys.path_hooks:                        パスエントリ・ファインダー.
                                                             (line    6)
* sys.path_importer_cache:               パスエントリ・ファインダー.
                                                             (line    6)
* sys.stderr:                            I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* sys.stdin:                             I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* sys.stdout:                            I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* sysconf_names (os モジュール):         雑多なシステム情報. (line   84)
* sysconf() (os モジュール):             雑多なシステム情報. (line   74)
* syslog() (syslog モジュール):          syslog --- Unix syslog ライブラリルーチン群.
                                                             (line   21)
* SysLogHandler (logging.handlers のクラス): SysLogHandler.  (line   10)
* system_alias() (platform モジュール):  Cross platform.     (line  131)
* system_must_validate_cert() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  483)
* system() (os モジュール):              プロセス管理.       (line  767)
* system() (platform モジュール):        Cross platform.     (line  122)
* SystemError:                           具象例外.           (line  359)
* SystemError (組み込み例外):            モジュールオブジェクト module object.
                                                             (line   64)
* SystemError (組み込み例外) <1>:        モジュールオブジェクト module object.
                                                             (line   99)
* SystemExit:                            具象例外.           (line  376)
* SystemExit (組み込み例外):             例外<2>.            (line   26)
* systemId (xml.dom.DocumentType の属性): DocumentType オブジェクト.
                                                             (line   21)
* SystemRandom (random のクラス):        他の生成器.         (line   52)
* SystemRandom (secrets のクラス):       乱数.               (line    9)
* T_BOOL (C macro):                      Member types.       (line  122)
* T_BYTE (C macro):                      Member types.       (line  122)
* T_CHAR (C macro):                      Member types.       (line  122)
* T_DOUBLE (C macro):                    Member types.       (line  122)
* T_FLOAT (C macro):                     Member types.       (line  122)
* T_FMT (locale モジュール):             locale --- 国際化サービス.
                                                             (line  204)
* T_FMT_AMPM (locale モジュール):        locale --- 国際化サービス.
                                                             (line  210)
* T_INT (C macro):                       Member types.       (line  122)
* T_LONG (C macro):                      Member types.       (line  122)
* T_LONGLONG (C macro):                  Member types.       (line  122)
* T_NONE (C macro):                      Member types.       (line  133)
* T_OBJECT (C macro):                    Member types.       (line  127)
* T_OBJECT_EX (C macro):                 Member types.       (line  122)
* T_PYSSIZET (C macro):                  Member types.       (line  122)
* T_SHORT (C macro):                     Member types.       (line  122)
* T_STRING (C macro):                    Member types.       (line  122)
* T_STRING_INPLACE (C macro):            Member types.       (line  122)
* T_UBYTE (C macro):                     Member types.       (line  122)
* T_UINT (C macro):                      Member types.       (line  122)
* T_ULONG (C macro):                     Member types.       (line  122)
* T_ULONGULONG (C macro):                Member types.       (line  122)
* T_USHORT (C macro):                    Member types.       (line  122)
* t-string:                              用語集<2>.          (line 1698)
* t-strings:                             用語集<2>.          (line 1701)
* TAB (curses.ascii モジュール):         curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   45)
* tab() (tkinter.ttk.Notebook のメソッド): ttk Notebook.     (line   61)
* TabError:                              具象例外.           (line  354)
* tabs() (tkinter.ttk.Notebook のメソッド): ttk Notebook.    (line   70)
* tabsize (textwrap.TextWrapper の属性): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  178)
* tag (xml.etree.ElementTree.Element の属性): Element オブジェクト.
                                                             (line   16)
* tag_bind() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  292)
* tag_configure() (tkinter.ttk.Treeview のメソッド): ttk Treeview.
                                                             (line  298)
* tag_has() (tkinter.ttk.Treeview のメソッド): ttk Treeview. (line  308)
* tagName (xml.dom.Element の属性):      Element オブジェクト<2>.
                                                             (line    9)
* tail (xml.etree.ElementTree.Element の属性): Element オブジェクト.
                                                             (line   21)
* take_snapshot() (tracemalloc モジュール): 関数<11>.        (line  110)
* takewhile() (itertools モジュール):    Itertool関数.       (line  562)
* tan() (cmath モジュール):              三角関数<2>.        (line   31)
* tan() (math モジュール):               三角関数.           (line   37)
* tanh() (cmath モジュール):             双曲線関数<2>.      (line   31)
* tanh() (math モジュール):              双曲線関数.         (line   29)
* tar_filter() (tarfile モジュール):     Default named filters.
                                                             (line   15)
* TarError:                              tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  251)
* TarFile (tarfile のクラス):            TarFile オブジェクト.
                                                             (line   23)
* tarfile コマンドラインオプション; -c:  コマンドラインオプション<3>.
                                                             (line   11)
* tarfile コマンドラインオプション; -create: コマンドラインオプション<3>.
                                                             (line   11)
* tarfile コマンドラインオプション; -e:  コマンドラインオプション<3>.
                                                             (line   16)
* tarfile コマンドラインオプション; -extract: コマンドラインオプション<3>.
                                                             (line   16)
* tarfile コマンドラインオプション; -filter: コマンドラインオプション<3>.
                                                             (line   31)
* tarfile コマンドラインオプション; -l:  コマンドラインオプション<3>.
                                                             (line    6)
* tarfile コマンドラインオプション; -list: コマンドラインオプション<3>.
                                                             (line    6)
* tarfile コマンドラインオプション; -t:  コマンドラインオプション<3>.
                                                             (line   22)
* tarfile コマンドラインオプション; -test: コマンドラインオプション<3>.
                                                             (line   22)
* tarfile コマンドラインオプション; -v:  コマンドラインオプション<3>.
                                                             (line   27)
* tarfile コマンドラインオプション; -verbose: コマンドラインオプション<3>.
                                                             (line   27)
* target:                                代入文 assignment statement.
                                                             (line   26)
* target (xml.dom.ProcessingInstruction の属性): ProcessingInstruction オブジェクト.
                                                             (line    9)
* target_length (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line  105)
* target;list:                           代入文 assignment statement.
                                                             (line   26)
* target;list <1>:                       for 文<2>.          (line    6)
* target;list;代入:                      代入文 assignment statement.
                                                             (line   34)
* TarInfo (tarfile のクラス):            TarInfo オブジェクト.
                                                             (line   33)
* tarinfo (tarfile.FilterError の属性):  tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  285)
* Task (asyncio のクラス):               Task オブジェクト.  (line    6)
* task_done() (asyncio.Queue のメソッド): Queue.             (line  117)
* task_done() (multiprocessing.JoinableQueue のメソッド): パイプ Pipe とキュー Queue.
                                                             (line  265)
* task_done() (queue.Queue のメソッド):  キューオブジェクト. (line   73)
* TaskGroup (asyncio のクラス):          Task Groups.        (line    9)
* tau (cmath モジュール):                定数<3>.            (line   14)
* tau (math モジュール):                 定数<2>.            (line   14)
* tb_frame (traceback の属性):           トレースバック traceback オブジェクト.
                                                             (line   33)
* tb_frame (トレースバック属性):         トレースバック traceback オブジェクト.
                                                             (line   31)
* tb_lasti (traceback の属性):           トレースバック traceback オブジェクト.
                                                             (line   44)
* tb_lasti (トレースバック属性):         トレースバック traceback オブジェクト.
                                                             (line   31)
* tb_lineno (traceback の属性):          トレースバック traceback オブジェクト.
                                                             (line   41)
* tb_lineno (トレースバック属性):        トレースバック traceback オブジェクト.
                                                             (line   31)
* tb_locals (unittest.TestResult の属性): テストのロードと起動.
                                                             (line  308)
* tb_next (traceback の属性):            トレースバック traceback オブジェクト.
                                                             (line   52)
* tb_next (トレースバック属性):          トレースバック traceback オブジェクト.
                                                             (line   52)
* tbreak (pdb command):                  Debugger commands.  (line  128)
* tcdrain() (termios モジュール):        termios --- POSIX スタイルの端末制御.
                                                             (line   65)
* tcflow() (termios モジュール):         termios --- POSIX スタイルの端末制御.
                                                             (line   76)
* tcflush() (termios モジュール):        termios --- POSIX スタイルの端末制御.
                                                             (line   70)
* tcgetattr() (termios モジュール):      termios --- POSIX スタイルの端末制御.
                                                             (line   28)
* tcgetpgrp() (os モジュール):           ファイル記述子の操作.
                                                             (line  932)
* tcgetwinsize() (termios モジュール):   termios --- POSIX スタイルの端末制御.
                                                             (line   83)
* Tcl() (tkinter モジュール):            Tkinter モジュール. (line   93)
* TCPServer (socketserver のクラス):     socketserver --- ネットワークサーバーのフレームワーク.
                                                             (line   20)
* TCSADRAIN (termios モジュール):        termios --- POSIX スタイルの端末制御.
                                                             (line   50)
* TCSAFLUSH (termios モジュール):        termios --- POSIX スタイルの端末制御.
                                                             (line   54)
* TCSANOW (termios モジュール):          termios --- POSIX スタイルの端末制御.
                                                             (line   46)
* tcsendbreak() (termios モジュール):    termios --- POSIX スタイルの端末制御.
                                                             (line   59)
* tcsetattr() (termios モジュール):      termios --- POSIX スタイルの端末制御.
                                                             (line   39)
* tcsetpgrp() (os モジュール):           ファイル記述子の操作.
                                                             (line  939)
* tcsetwinsize() (termios モジュール):   termios --- POSIX スタイルの端末制御.
                                                             (line   91)
* tearDown() (unittest.TestCase のメソッド): テストクラス.   (line   42)
* tearDownClass() (unittest.TestCase のメソッド): テストクラス.
                                                             (line   69)
* tearDownModule() (unittest モジュール): setUpModule と tearDownModule.
                                                             (line    6)
* tee() (itertools モジュール):          Itertool関数.       (line  581)
* teleport() (turtle モジュール):        Turtle の動き.      (line  104)
* tell() (io.IOBase のメソッド):         I/O 基底クラス.     (line  135)
* tell() (io.TextIOBase のメソッド):     テキスト I/O<2>.    (line   86)
* tell() (io.TextIOWrapper のメソッド):  テキスト I/O<2>.    (line  233)
* tell() (mmap.mmap のメソッド):         mmap --- メモリマップファイルのサポート.
                                                             (line  320)
* tell() (sqlite3.Blob のメソッド):      Blob オブジェクト.  (line   61)
* tell() (wave.Wave_read のメソッド):    Wave_read オブジェクト.
                                                             (line   87)
* tell() (wave.Wave_write のメソッド):   Wave_write オブジェクト.
                                                             (line   70)
* TEMP:                                  tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  327)
* temp_cwd() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line  136)
* temp_dir() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line  151)
* temp_umask() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line  160)
* tempdir (tempfile モジュール):         tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  373)
* Template (string のクラス):            Template strings $-strings.
                                                             (line   46)
* template (string.Template の属性):     Template strings $-strings.
                                                             (line   95)
* Template (string.templatelib のクラス): 型.                (line    6)
* TemplateStr (ast のクラス):            リテラル<3>.        (line   66)
* temporary (bdb.Breakpoint の属性):     bdb --- デバッガーフレームワーク.
                                                             (line   92)
* TemporaryDirectory (tempfile のクラス): tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  184)
* TemporaryFile() (tempfile モジュール): tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line   27)
* teredo (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  319)
* TERM:                                  関数<6>.            (line  488)
* TERM <1>:                              関数<6>.            (line  514)
* termattrs() (curses モジュール):       関数<6>.            (line  506)
* terminal_size (os のクラス):           ターミナルのサイズの問い合わせ.
                                                             (line   24)
* terminate_workers() (concurrent.futures.ProcessPoolExecutor のメソッド): ProcessPoolExecutor.
                                                             (line   98)
* terminate() (asyncio.subprocess.Process のメソッド): サブプロセスとやりとりする.
                                                             (line   98)
* terminate() (asyncio.SubprocessTransport のメソッド): サブプロセス化されたトランスポート.
                                                             (line   49)
* terminate() (multiprocessing.pool.Pool のメソッド): プロセスプール.
                                                             (line  182)
* terminate() (multiprocessing.Process のメソッド): Process クラスと例外.
                                                             (line  225)
* terminate() (subprocess.Popen のメソッド): Popen オブジェクト.
                                                             (line   96)
* terminator (logging.StreamHandler の属性): StreamHandler.  (line   48)
* termname() (curses モジュール):        関数<6>.            (line  512)
* ternaryfunc (C type):                  Slot Type typedefs. (line  131)
* test (doctest.DocTestFailure の属性):  デバッグ.           (line  190)
* test (doctest.UnexpectedException の属性): デバッグ.       (line  211)
* TEST_DATA_DIR (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  154)
* TEST_HOME_DIR (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  150)
* TEST_HTTP_URL (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  191)
* TEST_SUPPORT_DIR (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  146)
* TestCase (unittest のクラス):          テストクラス.       (line    6)
* TestFailed:                            test support --- Utilities for the Python test suite.
                                                             (line   16)
* testfile() (doctest モジュール):       基本 API.           (line   12)
* TESTFN (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   18)
* TESTFN_NONASCII (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   24)
* TESTFN_UNDECODABLE (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   38)
* TESTFN_UNENCODABLE (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   32)
* TESTFN_UNICODE (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line   44)
* TestLoader (unittest のクラス):        テストのロードと起動.
                                                             (line    6)
* testMethodPrefix (unittest.TestLoader の属性): テストのロードと起動.
                                                             (line  186)
* testmod() (doctest モジュール):        基本 API.           (line   94)
* testNamePatterns (unittest.TestLoader の属性): テストのロードと起動.
                                                             (line  207)
* TestResult (unittest のクラス):        テストのロードと起動.
                                                             (line  225)
* TestResults (doctest のクラス):        TestResults objects.
                                                             (line    6)
* testsource() (doctest モジュール):     デバッグ.           (line  105)
* testsRun (unittest.TestResult の属性): テストのロードと起動.
                                                             (line  286)
* TestSuite (unittest のクラス):         テストのグループ化. (line    6)
* testzip() (zipfile.ZipFile のメソッド): ZipFile objects.   (line  273)
* text (ctypes.COMError の属性):         例外<10>.           (line   19)
* text (SyntaxError の属性):             具象例外.           (line  326)
* text (traceback.TracebackException の属性): TracebackException オブジェクト.
                                                             (line  104)
* Text (typing のクラス):                Aliases to other concrete types.
                                                             (line   21)
* text (xml.etree.ElementTree.Element の属性): Element オブジェクト.
                                                             (line   21)
* text encoding:                         用語集<2>.          (line 1706)
* text file:                             用語集<2>.          (line 1719)
* text mode:                             組み込み関数.       (line 1466)
* text_encoding() (io モジュール):       高水準のモジュールインターフェイス.
                                                             (line   38)
* text_factory (sqlite3.Connection の属性): Connection オブジェクト.
                                                             (line  823)
* Textbox (curses.textpad のクラス):     Textbox オブジェクト.
                                                             (line    9)
* TextCalendar (calendar のクラス):      calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  143)
* textdomain() (gettext モジュール):     GNU gettext API.    (line   26)
* textdomain() (locale モジュール):      メッセージカタログへのアクセス.
                                                             (line   12)
* textinput() (turtle モジュール):       入力メソッド.       (line    6)
* TextIO (typing のクラス):              ABCs and Protocols for working with I/O.
                                                             (line    6)
* TextIOBase (io のクラス):              テキスト I/O<2>.    (line    6)
* TextIOWrapper (io のクラス):           テキスト I/O<2>.    (line   96)
* TextTestResult (unittest のクラス):    テストのロードと起動.
                                                             (line  437)
* TextTestRunner (unittest のクラス):    テストのロードと起動.
                                                             (line  456)
* TextWrapper (textwrap のクラス):       textwrap --- テキストの折り返しと詰め込み.
                                                             (line  145)
* TFD_CLOEXEC (os モジュール):           Timer File Descriptors.
                                                             (line  203)
* TFD_NONBLOCK (os モジュール):          Timer File Descriptors.
                                                             (line  192)
* TFD_TIMER_ABSTIME (os モジュール):     Timer File Descriptors.
                                                             (line  213)
* TFD_TIMER_CANCEL_ON_SET (os モジュール): Timer File Descriptors.
                                                             (line  224)
* theme_create() (tkinter.ttk.Style のメソッド): Ttk スタイル.
                                                             (line  260)
* theme_names() (tkinter.ttk.Style のメソッド): Ttk スタイル.
                                                             (line  308)
* theme_settings() (tkinter.ttk.Style のメソッド): Ttk スタイル.
                                                             (line  270)
* theme_use() (tkinter.ttk.Style のメソッド): Ttk スタイル.  (line  312)
* THOUSEP (locale モジュール):           locale --- 国際化サービス.
                                                             (line  274)
* Thread (threading のクラス):           Thread objects.     (line   62)
* thread state:                          用語集<2>.          (line 1733)
* thread_info (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line 2064)
* thread_inherit_context (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  586)
* thread_time_ns() (time モジュール):    関数<5>.            (line  626)
* thread_time() (time モジュール):       関数<5>.            (line  610)
* thread_unsafe() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  563)
* thread-safe:                           用語集<2>.          (line 1756)
* thread() (imaplib.IMAP4 のメソッド):   IMAP4 オブジェクト. (line  433)
* threading_cleanup() (test.support.threading_helper モジュール): test support threading_helper --- Utilities for threading tests.
                                                             (line   31)
* threading_setup() (test.support.threading_helper モジュール): test support threading_helper --- Utilities for threading tests.
                                                             (line   37)
* ThreadingHTTPServer (http.server のクラス): http server --- HTTP サーバー.
                                                             (line   37)
* ThreadingHTTPSServer (http.server のクラス): http server --- HTTP サーバー.
                                                             (line   82)
* ThreadingMixIn (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   26)
* ThreadingMock (unittest.mock のクラス): Mock クラス.       (line  945)
* ThreadingTCPServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   74)
* ThreadingUDPServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   74)
* ThreadingUnixDatagramServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   74)
* ThreadingUnixStreamServer (socketserver のクラス): サーバ生成に関するノート.
                                                             (line   74)
* ThreadPool (multiprocessing.pool のクラス): The multiprocessing dummy module.
                                                             (line   14)
* ThreadPoolExecutor (concurrent.futures のクラス): ThreadPoolExecutor.
                                                             (line   39)
* threads;POSIX:                         _thread --- 低水準なスレッド API.
                                                             (line   15)
* threadsafety (sqlite3 モジュール):     モジュール定数.     (line   88)
* throw() (coroutine のメソッド):        コルーチンオブジェクト.
                                                             (line   32)
* throw() (generator のメソッド):        ジェネレータ-イテレータメソッド.
                                                             (line   37)
* THURSDAY (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  440)
* ticket_lifetime_hint (ssl.SSLSession の属性): SSL セッション.
                                                             (line   18)
* tigetflag() (curses モジュール):       関数<6>.            (line  517)
* tigetnum() (curses モジュール):        関数<6>.            (line  523)
* tigetstr() (curses モジュール):        関数<6>.            (line  529)
* TILDE (token モジュール):              token --- Python 解析木で使われる定数.
                                                             (line  275)
* tilt() (turtle モジュール):            見た目.             (line   99)
* tiltangle() (turtle モジュール):       見た目.             (line  115)
* time (datetime のクラス):              time objects.       (line   10)
* time (ssl.SSLSession の属性):          SSL セッション.     (line   14)
* time (uuid.UUID の属性):               uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  129)
* time_hi_version (uuid.UUID の属性):    uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  113)
* time_low (uuid.UUID の属性):           uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  105)
* time_mid (uuid.UUID の属性):           uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  109)
* time_ns() (time モジュール):           関数<5>.            (line  603)
* time() (asyncio.loop のメソッド):      遅延コールバックのスケジューリング.
                                                             (line   67)
* time() (datetime.datetime のメソッド): datetime objects.   (line  449)
* time() (time モジュール):              関数<5>.            (line  567)
* Time2Internaldate() (imaplib モジュール): imaplib --- IMAP4 プロトコルクライアント.
                                                             (line  132)
* timedelta (datetime のクラス):         timedelta objects.  (line    9)
* TimedRotatingFileHandler (logging.handlers のクラス): TimedRotatingFileHandler.
                                                             (line   10)
* timegm() (calendar モジュール):        calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  411)
* timeit コマンドラインオプション; -h:   コマンドラインインターフェイス<3>.
                                                             (line   43)
* timeit コマンドラインオプション; -help: コマンドラインインターフェイス<3>.
                                                             (line   43)
* timeit コマンドラインオプション; -n:   コマンドラインインターフェイス<3>.
                                                             (line   12)
* timeit コマンドラインオプション; -number: コマンドラインインターフェイス<3>.
                                                             (line   12)
* timeit コマンドラインオプション; -p:   コマンドラインインターフェイス<3>.
                                                             (line   24)
* timeit コマンドラインオプション; -process: コマンドラインインターフェイス<3>.
                                                             (line   24)
* timeit コマンドラインオプション; -r:   コマンドラインインターフェイス<3>.
                                                             (line   16)
* timeit コマンドラインオプション; -repeat: コマンドラインインターフェイス<3>.
                                                             (line   16)
* timeit コマンドラインオプション; -s:   コマンドラインインターフェイス<3>.
                                                             (line   20)
* timeit コマンドラインオプション; -setup: コマンドラインインターフェイス<3>.
                                                             (line   20)
* timeit コマンドラインオプション; -u:   コマンドラインインターフェイス<3>.
                                                             (line   32)
* timeit コマンドラインオプション; -unit: コマンドラインインターフェイス<3>.
                                                             (line   32)
* timeit コマンドラインオプション; -v:   コマンドラインインターフェイス<3>.
                                                             (line   39)
* timeit コマンドラインオプション; -verbose: コマンドラインインターフェイス<3>.
                                                             (line   39)
* timeit() (timeit モジュール):          Python インターフェイス.
                                                             (line    8)
* timeit() (timeit.Timer のメソッド):    Python インターフェイス.
                                                             (line   68)
* timeout:                               例外<18>.           (line   39)
* Timeout (asyncio のクラス):            タイムアウト.       (line   50)
* timeout (socketserver.BaseServer の属性): Serverオブジェクト<2>.
                                                             (line  114)
* timeout (ssl.SSLSession の属性):       SSL セッション.     (line   16)
* timeout (subprocess.TimeoutExpired の属性): Using the subprocess Module.
                                                             (line  176)
* timeout_at() (asyncio モジュール):     タイムアウト.       (line  102)
* TIMEOUT_MAX (_thread モジュール):      _thread --- 低水準なスレッド API.
                                                             (line  131)
* TIMEOUT_MAX (threading モジュール):    リファレンス<2>.    (line  180)
* timeout() (asyncio モジュール):        タイムアウト.       (line    6)
* timeout() (curses.window のメソッド):  Window オブジェクト.
                                                             (line  554)
* TimeoutError:                          OS 例外.            (line  111)
* TimeoutError <1>:                      Process クラスと例外.
                                                             (line  296)
* TimeoutError <2>:                      例外クラス.         (line   10)
* TimeoutError <3>:                      例外<16>.           (line   10)
* TimeoutExpired:                        Using the subprocess Module.
                                                             (line  167)
* Timer (threading のクラス):            Timer objects.      (line   24)
* Timer (timeit のクラス):               Python インターフェイス.
                                                             (line   40)
* timerfd_create() (os モジュール):      Timer File Descriptors.
                                                             (line   11)
* timerfd_gettime_ns() (os モジュール):  Timer File Descriptors.
                                                             (line  183)
* timerfd_gettime() (os モジュール):     Timer File Descriptors.
                                                             (line  163)
* timerfd_settime_ns() (os モジュール):  Timer File Descriptors.
                                                             (line  152)
* timerfd_settime() (os モジュール):     Timer File Descriptors.
                                                             (line   84)
* TimerHandle (asyncio のクラス):        コールバックのハンドル.
                                                             (line   29)
* times() (os モジュール):               プロセス管理.       (line  804)
* TIMESTAMP (py_compile.PycInvalidationMode の属性): py_compile --- Python ソースファイルをコンパイルする.
                                                             (line  103)
* timestamp() (datetime.datetime のメソッド): datetime objects.
                                                             (line  606)
* timetuple() (datetime.date のメソッド): date objects.      (line  239)
* timetuple() (datetime.datetime のメソッド): datetime objects.
                                                             (line  560)
* timetz() (datetime.datetime のメソッド): datetime objects. (line  458)
* timezone (datetime のクラス):          timezone objects.   (line   14)
* timezone (time モジュール):            Timezone Constants. (line   18)
* title() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  692)
* title() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  692)
* title() (str のメソッド):              文字列メソッド<2>.  (line  850)
* title() (turtle モジュール):           Screen 独自のメソッド、TurtleScreen から継承したもの以外.
                                                             (line   68)
* Tk:                                    Graphical user interfaces with Tk.
                                                             (line    6)
* Tk (tkinter のクラス):                 Tkinter モジュール. (line   13)
* tk (tkinter.Tk の属性):                Tkinter モジュール. (line   69)
* Tk オプションデータ型:                 Tk オプションデータ型.
                                                             (line    6)
* Tkinter:                               Graphical user interfaces with Tk.
                                                             (line    6)
* TLS:                                   ssl --- ソケットオブジェクト用の TLS/SSL ラッパー.
                                                             (line    8)
* TLSv1 (ssl.TLSVersion の属性):         定数<9>.            (line  580)
* TLSv1_1 (ssl.TLSVersion の属性):       定数<9>.            (line  582)
* TLSv1_2 (ssl.TLSVersion の属性):       定数<9>.            (line  584)
* TLSv1_3 (ssl.TLSVersion の属性):       定数<9>.            (line  586)
* TLSVersion (ssl のクラス):             定数<9>.            (line  562)
* tm_gmtoff (time.struct_time の属性):   関数<5>.            (line  552)
* tm_hour (time.struct_time の属性):     関数<5>.            (line  528)
* tm_isdst (time.struct_time の属性):    関数<5>.            (line  545)
* tm_mday (time.struct_time の属性):     関数<5>.            (line  525)
* tm_min (time.struct_time の属性):      関数<5>.            (line  531)
* tm_mon (time.struct_time の属性):      関数<5>.            (line  522)
* tm_sec (time.struct_time の属性):      関数<5>.            (line  534)
* tm_wday (time.struct_time の属性):     関数<5>.            (line  539)
* tm_yday (time.struct_time の属性):     関数<5>.            (line  542)
* tm_year (time.struct_time の属性):     関数<5>.            (line  519)
* tm_zone (time.struct_time の属性):     関数<5>.            (line  549)
* TMP:                                   tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  329)
* TMPDIR:                                ライブラリ<23>.     (line   79)
* TMPDIR <1>:                            テスト<27>.         (line   68)
* TMPDIR <2>:                            tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  325)
* TO_BOOL (opcode):                      Python バイトコード命令.
                                                             (line  239)
* to_bytes() (int のメソッド):           整数型における追加のメソッド.
                                                             (line   44)
* to_eng_string() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  535)
* to_eng_string() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  558)
* to_integral_exact() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  543)
* to_integral_exact() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  575)
* to_integral_value() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  584)
* to_integral() (decimal.Decimal のメソッド): Decimal オブジェクト.
                                                             (line  569)
* to_sci_string() (decimal.Context のメソッド): Context オブジェクト.
                                                             (line  547)
* to_thread() (asyncio モジュール):      スレッド内での実行. (line    6)
* ToASCII() (encodings.idna モジュール): encodings idna --- Internationalized Domain Names in Applications.
                                                             (line   53)
* tobuf() (tarfile.TarInfo のメソッド):  TarInfo オブジェクト.
                                                             (line   50)
* tobytes() (array.array のメソッド):    array --- 効率的な数値配列.
                                                             (line  237)
* tobytes() (memoryview のメソッド):     メモリビュー.       (line  166)
* today() (datetime.date のクラスメソッド): date objects.    (line   28)
* today() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line   47)
* tofile() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  246)
* tok_name (token モジュール):           token --- Python 解析木で使われる定数.
                                                             (line   23)
* Token (contextvars のクラス):          コンテキスト変数.   (line  101)
* token (shlex.shlex の属性):            shlex オブジェクト. (line  172)
* token_bytes() (secrets モジュール):    トークンの生成.     (line   10)
* token_hex() (secrets モジュール):      トークンの生成.     (line   20)
* token_urlsafe() (secrets モジュール):  トークンの生成.     (line   31)
* TokenError:                            入力のトークナイズ. (line  105)
* tokenize コマンドラインオプション; -e: コマンドラインからの使用<4>.
                                                             (line   19)
* tokenize コマンドラインオプション; -exact: コマンドラインからの使用<4>.
                                                             (line   19)
* tokenize コマンドラインオプション; -h: コマンドラインからの使用<4>.
                                                             (line   15)
* tokenize コマンドラインオプション; -help: コマンドラインからの使用<4>.
                                                             (line   15)
* tokenize() (tokenize モジュール):      入力のトークナイズ. (line    8)
* tolist() (array.array のメソッド):     array --- 効率的な数値配列.
                                                             (line  251)
* tolist() (memoryview のメソッド):      メモリビュー.       (line  210)
* TOMLDecodeError:                       tomllib --- TOML ファイルの解析.
                                                             (line   61)
* toordinal() (datetime.date のメソッド): date objects.      (line  253)
* toordinal() (datetime.datetime のメソッド): datetime objects.
                                                             (line  601)
* top_panel() (curses.panel モジュール): 関数<7>.            (line   19)
* top() (curses.panel.Panel のメソッド): Panel オブジェクト. (line   53)
* top() (poplib.POP3 のメソッド):        POP3 オブジェクト.  (line   87)
* TopologicalSorter (graphlib のクラス): graphlib --- グラフ構造を操作する機能.
                                                             (line   10)
* toprettyxml() (xml.dom.minidom.Node のメソッド): DOM オブジェクト.
                                                             (line   71)
* toreadonly() (memoryview のメソッド):  メモリビュー.       (line  227)
* tostring() (xml.etree.ElementTree モジュール): 関数<9>.    (line  217)
* tostringlist() (xml.etree.ElementTree モジュール): 関数<9>.
                                                             (line  239)
* total_changes (sqlite3.Connection の属性): Connection オブジェクト.
                                                             (line  834)
* total_nframe (tracemalloc.Traceback の属性): Traceback.    (line   28)
* total_ordering() (functools モジュール): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  273)
* total_seconds() (datetime.timedelta のメソッド): timedelta objects.
                                                             (line  243)
* total() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line   99)
* touch() (pathlib.Path のメソッド):     ファイルとディレクトリの作成.
                                                             (line    6)
* touchline() (curses.window のメソッド): Window オブジェクト.
                                                             (line  563)
* touchwin() (curses.window のメソッド): Window オブジェクト.
                                                             (line  569)
* tounicode() (array.array のメソッド):  array --- 効率的な数値配列.
                                                             (line  255)
* ToUnicode() (encodings.idna モジュール): encodings idna --- Internationalized Domain Names in Applications.
                                                             (line   58)
* towards() (turtle モジュール):         Turtle の状態を知る.
                                                             (line   15)
* toxml() (xml.dom.minidom.Node のメソッド): DOM オブジェクト.
                                                             (line   52)
* tparm() (curses モジュール):           関数<6>.            (line  536)
* Trace (trace のクラス):                プログラミングインターフェース.
                                                             (line    6)
* Trace (tracemalloc のクラス):          Trace.              (line    6)
* trace function:                        リファレンス<2>.    (line  113)
* trace function <1>:                    リファレンス<2>.    (line  129)
* trace function <2>:                    sys --- システム固有のパラメーターと関数.
                                                             (line  964)
* trace function <3>:                    sys --- システム固有のパラメーターと関数.
                                                             (line 1717)
* trace コマンドラインオプション; -c:    主要なオプション.   (line   12)
* trace コマンドラインオプション; -C:    修飾的オプション.   (line   12)
* trace コマンドラインオプション; -count: 主要なオプション.  (line   12)
* trace コマンドラインオプション; -coverdir: 修飾的オプション.
                                                             (line   12)
* trace コマンドラインオプション; -f:    修飾的オプション.   (line    6)
* trace コマンドラインオプション; -file: 修飾的オプション.   (line    6)
* trace コマンドラインオプション; -g:    修飾的オプション.   (line   35)
* trace コマンドラインオプション; -help: コマンドラインからの使用<2>.
                                                             (line   14)
* trace コマンドラインオプション; -ignore-dir: フィルターオプション.
                                                             (line   13)
* trace コマンドラインオプション; -ignore-module: フィルターオプション.
                                                             (line    8)
* trace コマンドラインオプション; -l:    主要なオプション.   (line   22)
* trace コマンドラインオプション; -listfuncs: 主要なオプション.
                                                             (line   22)
* trace コマンドラインオプション; -m:    修飾的オプション.   (line   18)
* trace コマンドラインオプション; -missing: 修飾的オプション.
                                                             (line   18)
* trace コマンドラインオプション; -no-report: 修飾的オプション.
                                                             (line   29)
* trace コマンドラインオプション; -r:    主要なオプション.   (line   26)
* trace コマンドラインオプション; -R:    修飾的オプション.   (line   29)
* trace コマンドラインオプション; -report: 主要なオプション. (line   26)
* trace コマンドラインオプション; -s:    修飾的オプション.   (line   23)
* trace コマンドラインオプション; -summary: 修飾的オプション.
                                                             (line   23)
* trace コマンドラインオプション; -t:    主要なオプション.   (line   18)
* trace コマンドラインオプション; -T:    主要なオプション.   (line   32)
* trace コマンドラインオプション; -timing: 修飾的オプション. (line   35)
* trace コマンドラインオプション; -trace: 主要なオプション.  (line   18)
* trace コマンドラインオプション; -trackcalls: 主要なオプション.
                                                             (line   32)
* trace コマンドラインオプション; -version: コマンドラインからの使用<2>.
                                                             (line   18)
* trace_dispatch() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  192)
* trace() (inspect モジュール):          インタープリタスタック.
                                                             (line  177)
* Traceback (inspect のクラス):          インタープリタスタック.
                                                             (line   54)
* Traceback (tracemalloc のクラス):      Traceback.          (line    6)
* traceback (tracemalloc.Statistic の属性): Statistic.       (line   23)
* traceback (tracemalloc.StatisticDiff の属性): StatisticDiff.
                                                             (line   39)
* traceback (tracemalloc.Trace の属性):  Trace.              (line   27)
* traceback_limit (tracemalloc.Snapshot の属性): Snapshot.   (line   84)
* traceback_limit (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  219)
* TracebackException (traceback のクラス): TracebackException オブジェクト.
                                                             (line   15)
* tracebacklimit (sys モジュール):       sys --- システム固有のパラメーターと関数.
                                                             (line 2100)
* TracebackType (types のクラス):        標準的なインタプリタ型.
                                                             (line  188)
* tracer() (turtle モジュール):          アニメーションの制御.
                                                             (line   36)
* traces (tracemalloc.Snapshot の属性):  Snapshot.           (line   90)
* train_dict() (compression.zstd モジュール): Zstandard dictionaries.
                                                             (line    6)
* transfercmd() (ftplib.FTP のメソッド): FTP オブジェクト.   (line  256)
* transient_internet() (test.support.socket_helper モジュール): test support socket_helper --- Utilities for socket tests.
                                                             (line   64)
* translate() (bytearray のメソッド):    bytes と bytearray の操作.
                                                             (line  265)
* translate() (bytes のメソッド):        bytes と bytearray の操作.
                                                             (line  265)
* translate() (fnmatch モジュール):      fnmatch --- Unix のファイル名パターンマッチ.
                                                             (line   92)
* translate() (glob モジュール):         glob --- Unix 形式のパス名のパターン展開.
                                                             (line  117)
* translate() (str のメソッド):          文字列メソッド<2>.  (line  884)
* translation() (gettext モジュール):    クラス形式の API.   (line   42)
* Transport (asyncio のクラス):          トランスポートのクラス階層構造.
                                                             (line   29)
* transport (asyncio.StreamWriter の属性): StreamWriter.     (line   62)
* Transport Layer Security:              ssl --- ソケットオブジェクト用の TLS/SSL ラッパー.
                                                             (line    8)
* traps (decimal.Context の属性):        Context オブジェクト.
                                                             (line  136)
* Traversable (importlib.resources.abc のクラス): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line   89)
* TraversableResources (importlib.resources.abc のクラス): importlib resources abc -- リソースの抽象基底クラス.
                                                             (line  161)
* traverseproc (C type):                 循環参照ガベージコレクションをサポートする.
                                                             (line  235)
* TreeBuilder (xml.etree.ElementTree のクラス): TreeBuilder オブジェクト.
                                                             (line    6)
* Treeview (tkinter.ttk のクラス):       ttk Treeview.       (line    6)
* triangular() (random モジュール):      実数分布.           (line   22)
* tries (doctest.DocTestRunner の属性):  DocTestRunner オブジェクト.
                                                             (line  137)
* triple-quoted string:                  文字列およびバイト列リテラル.
                                                             (line   33)
* triple-quoted string <1>:              用語集<2>.          (line 1779)
* True:                                  numbers Integral 整数.
                                                             (line   24)
* true:                                  真理値判定.         (line    9)
* True <1>:                              真理値判定.         (line   25)
* True <2>:                              ブーリアン型 - bool.
                                                             (line    9)
* True (組み込み変数):                   組み込み定数.       (line   13)
* truediv() (operator モジュール):       operator --- 関数形式の標準演算子.
                                                             (line  170)
* trunc() (math モジュール):             数値型 int float complex.
                                                             (line  115)
* trunc() (math モジュール) <1>:         Floating point arithmetic.
                                                             (line   85)
* truncate() (io.IOBase のメソッド):     I/O 基底クラス.     (line  139)
* truncate() (os モジュール):            ファイルとディレクトリ.
                                                             (line 1597)
* truth() (operator モジュール):         operator --- 関数形式の標準演算子.
                                                             (line   55)
* Try (ast のクラス):                    制御フロー.         (line  130)
* TryStar (ast のクラス):                制御フロー.         (line  173)
* TSTRING_END (token モジュール):        token --- Python 解析木で使われる定数.
                                                             (line  139)
* TSTRING_MIDDLE (token モジュール):     token --- Python 解析木で使われる定数.
                                                             (line  127)
* TSTRING_START (token モジュール):      token --- Python 解析木で使われる定数.
                                                             (line  117)
* ttk:                                   tkinter ttk --- Tk のテーマ付きウィジェット.
                                                             (line    8)
* tty;I/O control:                       termios --- POSIX スタイルの端末制御.
                                                             (line    6)
* ttyname() (os モジュール):             ファイル記述子の操作.
                                                             (line  946)
* TUESDAY (calendar モジュール):         calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  440)
* Tuple (ast のクラス):                  リテラル<3>.        (line  129)
* Tuple (typing モジュール):             Aliases to built-in types.
                                                             (line   50)
* tuple (組み込みクラス):                タプル型 tuple.     (line   12)
* Turtle (turtle のクラス):              Public classes.     (line   16)
* turtles() (turtle モジュール):         設定と特殊なメソッド.
                                                             (line  107)
* TurtleScreen (turtle のクラス):        Public classes.     (line   22)
* turtlesize() (turtle モジュール):      見た目.             (line   50)
* type:                                  標準型の階層.       (line    6)
* type <1>:                              用語集<2>.          (line 1788)
* type (ctypes.CField の属性):           構造化データ型.     (line  255)
* type (optparse.Option の属性):         オプション属性.     (line   27)
* type (socket.socket の属性):           socket オブジェクト.
                                                             (line  610)
* type (tarfile.TarInfo の属性):         TarInfo オブジェクト.
                                                             (line   87)
* Type (typing のクラス):                Aliases to built-in types.
                                                             (line   61)
* type (urllib.request.Request の属性):  Request オブジェクト.
                                                             (line   21)
* type (組み込みクラス):                 組み込み関数.       (line 2014)
* type alias:                            用語集<2>.          (line 1795)
* type hint:                             用語集<2>.          (line 1816)
* type parameters:                       Type parameter lists.
                                                             (line   11)
* TYPE_ALIAS (symtable.SymbolTableType の属性): 記号表の検査.
                                                             (line   31)
* type_check_only() (typing モジュール): Functions and decorators.
                                                             (line  409)
* TYPE_CHECKER (optparse.Option の属性): 新しい型の追加.     (line   17)
* TYPE_CHECKING (typing モジュール):     定数<10>.           (line    6)
* type_comment (ast.arg の属性):         関数およびクラス定義.
                                                             (line   73)
* type_comment (ast.Assign の属性):      文 Statements.      (line   15)
* type_comment (ast.For の属性):         制御フロー.         (line   54)
* type_comment (ast.FunctionDef の属性): 関数およびクラス定義.
                                                             (line   25)
* type_comment (ast.With の属性):        制御フロー.         (line  237)
* TYPE_COMMENT (token モジュール):       token --- Python 解析木で使われる定数.
                                                             (line  172)
* TYPE_IGNORE (token モジュール):        token --- Python 解析木で使われる定数.
                                                             (line  165)
* TYPE_PARAMETERS (symtable.SymbolTableType の属性): 記号表の検査.
                                                             (line   35)
* type_repr() (annotationlib モジュール): 関数<12>.          (line  226)
* TYPE_VARIABLE (symtable.SymbolTableType の属性): 記号表の検査.
                                                             (line   40)
* type;階層:                             標準型の階層.       (line    6)
* typeahead() (curses モジュール):       関数<6>.            (line  544)
* TypeAlias (ast のクラス):              文 Statements.      (line  162)
* TypeAlias (typing モジュール):         特殊型.             (line  198)
* TypeAliasType (typing のクラス):       Building generic types and type aliases.
                                                             (line  552)
* typecode (array.array の属性):         array --- 効率的な数値配列.
                                                             (line  115)
* typecodes (array モジュール):          array --- 効率的な数値配列.
                                                             (line   84)
* TYPED_ACTIONS (optparse.Option の属性): 新しいアクションの追加.
                                                             (line   39)
* typed_subpart_iterator() (email.iterators モジュール): email iterators イテレータ.
                                                             (line   26)
* TypedDict (typing のクラス):           Other special directives.
                                                             (line  243)
* TypeError:                             具象例外.           (line  402)
* TypeGuard (typing モジュール):         特殊形式.           (line  536)
* TypeIgnore (ast のクラス):             Type annotations.   (line    6)
* TypeIs (typing モジュール):            特殊形式.           (line  446)
* TYPES (optparse.Option の属性):        新しい型の追加.     (line   11)
* types_map (mimetypes モジュール):      mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  157)
* types_map (mimetypes.MimeTypes の属性): MimeTypes objects. (line   38)
* types_map_inv (mimetypes.MimeTypes の属性): MimeTypes objects.
                                                             (line   45)
* TypeVar (ast のクラス):                Type parameters.    (line    9)
* TypeVar (typing のクラス):             Building generic types and type aliases.
                                                             (line   54)
* TypeVarTuple (ast のクラス):           Type parameters.    (line   68)
* TypeVarTuple (typing のクラス):        Building generic types and type aliases.
                                                             (line  253)
* TZ:                                    関数<5>.            (line  636)
* TZ <1>:                                関数<5>.            (line  637)
* TZ <2>:                                関数<5>.            (line  645)
* TZ <3>:                                関数<5>.            (line  649)
* TZ <4>:                                関数<5>.            (line  651)
* TZ <5>:                                関数<5>.            (line  714)
* tzinfo (datetime のクラス):            tzinfo objects.     (line    6)
* tzinfo (datetime.datetime の属性):     datetime objects.   (line  336)
* tzinfo (datetime.time の属性):         time objects.       (line   66)
* tzname (time モジュール):              Timezone Constants. (line   25)
* tzname() (datetime.datetime のメソッド): datetime objects. (line  554)
* tzname() (datetime.time のメソッド):   time objects.       (line  268)
* tzname() (datetime.timezone のメソッド): timezone objects. (line   42)
* tzname() (datetime.tzinfo のメソッド): tzinfo objects.     (line  125)
* TZPATH (zoneinfo モジュール):          Globals.            (line    6)
* tzset() (time モジュール):             関数<5>.            (line  633)
* U (re モジュール):                     フラグ.             (line  112)
* u';文字列リテラル:                     Triple-quoted strings.
                                                             (line   23)
* u";文字列リテラル:                     Triple-quoted strings.
                                                             (line   22)
* UAdd (ast のクラス):                   式 expression<2>.   (line   28)
* ucd_3_2_0 (unicodedata モジュール):    unicodedata --- Unicode データベース.
                                                             (line  180)
* udata (select.kevent の属性):          kevent オブジェクト.
                                                             (line  178)
* UDPServer (socketserver のクラス):     socketserver --- ネットワークサーバーのフレームワーク.
                                                             (line   30)
* UF_APPEND (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line  358)
* UF_COMPRESSED (stat モジュール):       stat --- stat の結果を解釈する.
                                                             (line  371)
* UF_DATAVAULT (stat モジュール):        stat --- stat の結果を解釈する.
                                                             (line  381)
* UF_HIDDEN (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line  387)
* UF_IMMUTABLE (stat モジュール):        stat --- stat の結果を解釈する.
                                                             (line  354)
* UF_NODUMP (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line  350)
* UF_NOUNLINK (stat モジュール):         stat --- stat の結果を解釈する.
                                                             (line  367)
* UF_OPAQUE (stat モジュール):           stat --- stat の結果を解釈する.
                                                             (line  362)
* UF_SETTABLE (stat モジュール):         stat --- stat の結果を解釈する.
                                                             (line  344)
* UF_TRACKED (stat モジュール):          stat --- stat の結果を解釈する.
                                                             (line  375)
* UID (plistlib のクラス):               plistlib --- Apple plist ファイルを生成・解析する.
                                                             (line  140)
* uid (tarfile.TarInfo の属性):          TarInfo オブジェクト.
                                                             (line  107)
* uid() (imaplib.IMAP4 のメソッド):      IMAP4 オブジェクト. (line  456)
* uidl() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   99)
* ULONG_MAX (C macro):                   整数型オブジェクト integer object.
                                                             (line  276)
* ulp() (math モジュール):               Floating point manipulation functions.
                                                             (line  107)
* umask() (os モジュール):               プロセスのパラメーター.
                                                             (line  565)
* unalias (pdb command):                 Debugger commands.  (line  403)
* uname (tarfile.TarInfo の属性):        TarInfo オブジェクト.
                                                             (line  123)
* uname() (os モジュール):               プロセスのパラメーター.
                                                             (line  572)
* uname() (platform モジュール):         Cross platform.     (line  145)
* UNARY_INVERT (opcode):                 Python バイトコード命令.
                                                             (line  223)
* UNARY_NEGATIVE (opcode):               Python バイトコード命令.
                                                             (line  212)
* UNARY_NOT (opcode):                    Python バイトコード命令.
                                                             (line  216)
* unaryfunc (C type):                    Slot Type typedefs. (line  117)
* UnaryOp (ast のクラス):                式 expression<2>.   (line   23)
* unbinding;name:                        del 文<2>.          (line   15)
* UnboundLocalError:                     名前解決.           (line   17)
* UnboundLocalError <1>:                 具象例外.           (line  419)
* unbuffered I/O:                        組み込み関数.       (line 1466)
* UNC パス;os.makedirs():                ファイルとディレクトリ.
                                                             (line  559)
* uncancel() (asyncio.Task のメソッド):  Task オブジェクト.  (line  274)
* UNCHECKED_HASH (py_compile.PycInvalidationMode の属性): py_compile --- Python ソースファイルをコンパイルする.
                                                             (line  116)
* unconsumed_tail (zlib.Decompress の属性): zlib --- gzip 互換の圧縮.
                                                             (line  241)
* unctrl() (curses モジュール):          関数<6>.            (line  556)
* unctrl() (curses.ascii モジュール):    curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  226)
* Underflow (decimal のクラス):          シグナル.           (line   98)
* undisplay (pdb command):               Debugger commands.  (line  350)
* undo() (turtle モジュール):            Turtle の動き.      (line  321)
* undobufferentries() (turtle モジュール): 特別な Turtle のメソッド.
                                                             (line   86)
* undoc_header (cmd.Cmd の属性):         Cmdオブジェクト.    (line  164)
* unescape() (html モジュール):          html --- HyperText Markup Language のサポート.
                                                             (line   24)
* unescape() (xml.sax.saxutils モジュール): xml sax saxutils --- SAX ユーティリティー.
                                                             (line   27)
* UnexpectedException:                   デバッグ.           (line  203)
* unexpectedSuccesses (unittest.TestResult の属性): テストのロードと起動.
                                                             (line  269)
* unfreeze() (gc モジュール):            gc --- ガベージコレクターインターフェース.
                                                             (line  247)
* unget_wch() (curses モジュール):       関数<6>.            (line  578)
* ungetch() (curses モジュール):         関数<6>.            (line  563)
* ungetch() (msvcrt モジュール):         コンソール I/O 関連.
                                                             (line   44)
* ungetmouse() (curses モジュール):      関数<6>.            (line  588)
* ungetwch() (msvcrt モジュール):        コンソール I/O 関連.
                                                             (line   50)
* unhexlify() (binascii モジュール):     binascii --- バイナリ と ASCII 間の変換.
                                                             (line  145)
* UNICODE (re モジュール):               フラグ.             (line  112)
* Unicode 文字列型:                      変更不能なシーケンス immutable sequence.
                                                             (line   16)
* Unicode 文字列型 <1>:                  unicodedata --- Unicode データベース.
                                                             (line    6)
* Unicode 文字列型 <2>:                  codecs --- codec レジストリと基底クラス.
                                                             (line    8)
* Unicode 文字列型;データベース:         unicodedata --- Unicode データベース.
                                                             (line    6)
* unicode_literals (__future__ モジュール): モジュールコンテンツ<5>.
                                                             (line   39)
* UnicodeDecodeError:                    具象例外.           (line  468)
* UnicodeEncodeError:                    具象例外.           (line  463)
* UnicodeError:                          具象例外.           (line  425)
* UnicodeTranslateError:                 具象例外.           (line  473)
* UnicodeWarning:                        警告.               (line   67)
* unidata_version (unicodedata モジュール): unicodedata --- Unicode データベース.
                                                             (line  176)
* unified_diff() (difflib モジュール):   difflib --- 差分の計算の補助.
                                                             (line  288)
* uniform() (random モジュール):         実数分布.           (line   14)
* UnimplementedFileMode:                 http client --- HTTP プロトコルクライアント.
                                                             (line  159)
* Union (ctypes のクラス):               構造化データ型.     (line    6)
* Union (typing のクラス):               特殊形式.           (line    9)
* union;type:                            Union 型.           (line    6)
* union() (frozenset のメソッド):        set（集合）型 --- set frozenset.
                                                             (line   98)
* union() (set のメソッド):              set（集合）型 --- set frozenset.
                                                             (line   98)
* UnionType (types のクラス):            標準的なインタプリタ型.
                                                             (line  179)
* UNIQUE (enum.EnumCheck の属性):        データ型<2>.        (line  616)
* unique() (enum モジュール):            ユーティリティとデコレータ.
                                                             (line   55)
* unittest コマンドラインオプション; -b: コマンドラインオプション<5>.
                                                             (line    8)
* unittest コマンドラインオプション; -buffer: コマンドラインオプション<5>.
                                                             (line    8)
* unittest コマンドラインオプション; -c: コマンドラインオプション<5>.
                                                             (line   15)
* unittest コマンドラインオプション; -catch: コマンドラインオプション<5>.
                                                             (line   15)
* unittest コマンドラインオプション; -durations: コマンドラインオプション<5>.
                                                             (line   49)
* unittest コマンドラインオプション; -f: コマンドラインオプション<5>.
                                                             (line   24)
* unittest コマンドラインオプション; -failfast: コマンドラインオプション<5>.
                                                             (line   24)
* unittest コマンドラインオプション; -k: コマンドラインオプション<5>.
                                                             (line   28)
* unittest コマンドラインオプション; -locals: コマンドラインオプション<5>.
                                                             (line   45)
* unittest-discover コマンドラインオプション; -p: テストディスカバリ.
                                                             (line   34)
* unittest-discover コマンドラインオプション; -pattern: テストディスカバリ.
                                                             (line   34)
* unittest-discover コマンドラインオプション; -s: テストディスカバリ.
                                                             (line   30)
* unittest-discover コマンドラインオプション; -start-directory: テストディスカバリ.
                                                             (line   30)
* unittest-discover コマンドラインオプション; -t: テストディスカバリ.
                                                             (line   38)
* unittest-discover コマンドラインオプション; -top-level-directory: テストディスカバリ.
                                                             (line   38)
* unittest-discover コマンドラインオプション; -v: テストディスカバリ.
                                                             (line   26)
* unittest-discover コマンドラインオプション; -verbose: テストディスカバリ.
                                                             (line   26)
* universal newlines:                    用語集<2>.          (line 1831)
* universal newlines;bytearray.splitlines メソッド: bytes と bytearray の操作.
                                                             (line  642)
* universal newlines;bytes.splitlines メソッド: bytes と bytearray の操作.
                                                             (line  642)
* universal newlines;csv.reader 関数:    モジュールコンテンツ<3>.
                                                             (line    8)
* universal newlines;importlib.abc.InspectLoader.get_source メソッド: importlib abc -- Abstract base classes related to import.
                                                             (line  221)
* universal newlines;io.IncrementalNewlineDecoder class: テキスト I/O<2>.
                                                             (line  286)
* universal newlines;io.TextIOWrapper class: テキスト I/O<2>.
                                                             (line  123)
* universal newlines;open() built-in function: 組み込み関数. (line 1406)
* universal newlines;str.splitlines メソッド: 文字列メソッド<2>.
                                                             (line  725)
* universal newlines;subprocess モジュール: よく使われる引数.
                                                             (line   32)
* universal newlines;What's new:         PEP 3116 新しい I/O ライブラリ.
                                                             (line   45)
* universal newlines;What's new <1>:     新たなモジュール、改良されたモジュール、削除されたモジュール.
                                                             (line  135)
* universal newlines;What's new <2>:     PEP 324 新しい subprocess モジュール.
                                                             (line   36)
* universal newlines;What's new <3>:     PEP 277 Windows NT での Unicode ファイル名サポート.
                                                             (line   38)
* UNIX:                                  完全な Python プログラム.
                                                             (line   24)
* unix_dialect (csv のクラス):           モジュールコンテンツ<3>.
                                                             (line  215)
* unix_shell (test.support モジュール):  test support --- Utilities for the Python test suite.
                                                             (line   61)
* UNIX;file control:                     fcntl --- fcntl および ioctl システムコール.
                                                             (line    6)
* UNIX;I/O control:                      fcntl --- fcntl および ioctl システムコール.
                                                             (line    6)
* UnixDatagramServer (socketserver のクラス): socketserver --- ネットワークサーバーのフレームワーク.
                                                             (line   37)
* UnixStreamServer (socketserver のクラス): socketserver --- ネットワークサーバーのフレームワーク.
                                                             (line   37)
* unknown (uuid.SafeUUID の属性):        uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   46)
* unknown_decl() (html.parser.HTMLParser のメソッド): HTMLParser メソッド.
                                                             (line  131)
* unknown_open() (urllib.request.BaseHandler のメソッド): BaseHandler オブジェクト.
                                                             (line   57)
* unknown_open() (urllib.request.UnknownHandler のメソッド): UnknownHandler オブジェクト.
                                                             (line    6)
* UnknownHandler (urllib.request のクラス): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  492)
* UnknownProtocol:                       http client --- HTTP プロトコルクライアント.
                                                             (line  151)
* UnknownTransferEncoding:               http client --- HTTP プロトコルクライアント.
                                                             (line  155)
* unlink() (multiprocessing.shared_memory.SharedMemory のメソッド): multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ.
                                                             (line  102)
* unlink() (os モジュール):              ファイルとディレクトリ.
                                                             (line 1616)
* unlink() (pathlib.Path のメソッド):    Copying moving and deleting.
                                                             (line  108)
* unlink() (test.support.os_helper モジュール): test support os_helper --- Utilities for os tests.
                                                             (line  164)
* unlink() (xml.dom.minidom.Node のメソッド): DOM オブジェクト.
                                                             (line   10)
* unload() (test.support.import_helper モジュール): test support import_helper --- Utilities for import tests.
                                                             (line   76)
* unlock() (mailbox.Babyl のメソッド):   Babyl オブジェクト. (line   56)
* unlock() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  260)
* unlock() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line  206)
* unlock() (mailbox.mbox のメソッド):    mbox オブジェクト.  (line   58)
* unlock() (mailbox.MH のメソッド):      MH オブジェクト.    (line   89)
* unlock() (mailbox.MMDF のメソッド):    MMDF オブジェクト.  (line   47)
* unlockpt() (os モジュール):            ファイル記述子の操作.
                                                             (line  954)
* UNNAMED_SECTION (configparser モジュール): ConfigParser オブジェクト.
                                                             (line  333)
* UnnamedSectionDisabledError:           例外<9>.            (line   76)
* Unpack (typing モジュール):            特殊形式.           (line  593)
* unpack_archive() (shutil モジュール):  アーカイブ化操作.   (line  135)
* UNPACK_EX (opcode):                    Python バイトコード命令.
                                                             (line  567)
* unpack_from() (struct モジュール):     関数と例外.         (line   33)
* unpack_from() (struct.Struct のメソッド): クラス<3>.       (line   41)
* UNPACK_SEQUENCE (opcode):              Python バイトコード命令.
                                                             (line  558)
* unpack() (struct モジュール):          関数と例外.         (line   25)
* unpack() (struct.Struct のメソッド):   クラス<3>.          (line   35)
* unpacking;dictionary:                  辞書表示.           (line   23)
* unpacking;関数呼び出しの中の:          呼び出し call.      (line   70)
* unparse() (ast モジュール):            ast helpers.        (line   68)
* unparsedEntityDecl() (xml.sax.handler.DTDHandler のメソッド): DTDHandler オブジェクト.
                                                             (line   12)
* UnparsedEntityDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  330)
* Unpickler (pickle のクラス):           モジュールインターフェース.
                                                             (line  246)
* UnpicklingError:                       モジュールインターフェース.
                                                             (line  111)
* unquote_plus() (urllib.parse モジュール): URL のクオート.  (line   80)
* unquote_to_bytes() (urllib.parse モジュール): URL のクオート.
                                                             (line   90)
* unquote() (email.utils モジュール):    email utils Miscellaneous utilities.
                                                             (line   51)
* unquote() (urllib.parse モジュール):   URL のクオート.     (line   60)
* unraisablehook() (sys モジュール):     sys --- システム固有のパラメーターと関数.
                                                             (line 2107)
* unregister_archive_format() (shutil モジュール): アーカイブ化操作.
                                                             (line  130)
* unregister_dialect() (csv モジュール): モジュールコンテンツ<3>.
                                                             (line   79)
* unregister_unpack_format() (shutil モジュール): アーカイブ化操作.
                                                             (line  202)
* unregister() (atexit モジュール):      atexit --- 終了ハンドラー.
                                                             (line   56)
* unregister() (codecs モジュール):      codecs --- codec レジストリと基底クラス.
                                                             (line  173)
* unregister() (faulthandler モジュール): ユーザシグナルに対してtracebackをダンプする.
                                                             (line   23)
* unregister() (select.devpoll のメソッド): /dev/poll ポーリングオブジェクト.
                                                             (line   55)
* unregister() (select.epoll のメソッド): エッジおよびレベルトリガポーリング epoll オブジェクト.
                                                             (line   96)
* unregister() (select.poll のメソッド): ポーリングオブジェクト.
                                                             (line   67)
* unregister() (selectors.BaseSelector のメソッド): クラス<4>.
                                                             (line   82)
* unsafe (uuid.SafeUUID の属性):         uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   41)
* unselect() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト. (line  467)
* unset() (test.support.os_helper.EnvironmentVarGuard のメソッド): test support os_helper --- Utilities for os tests.
                                                             (line   68)
* unsetenv() (os モジュール):            プロセスのパラメーター.
                                                             (line  607)
* unshare() (os モジュール):             プロセスのパラメーター.
                                                             (line  627)
* UnstructuredHeader (email.headerregistry のクラス): email headerregistry Custom Header Objects.
                                                             (line  113)
* unsubscribe() (imaplib.IMAP4 のメソッド): IMAP4 オブジェクト.
                                                             (line  463)
* UnsupportedOperation:                  例外<6>.            (line    6)
* UnsupportedOperation <1>:              高水準のモジュールインターフェイス.
                                                             (line   72)
* until (pdb command):                   Debugger commands.  (line  218)
* untokenize() (tokenize モジュール):    入力のトークナイズ. (line   55)
* untouchwin() (curses.window のメソッド): Window オブジェクト.
                                                             (line  574)
* unused_data (bz2.BZ2Decompressor の属性): 逐次圧縮および展開.
                                                             (line   78)
* unused_data (compression.zstd.ZstdDecompressor の属性): メモリ上での圧縮と展開.
                                                             (line  212)
* unused_data (lzma.LZMADecompressor の属性): メモリ上での圧縮と展開<2>.
                                                             (line  158)
* unused_data (zlib.Decompress の属性):  zlib --- gzip 互換の圧縮.
                                                             (line  233)
* unverifiable (urllib.request.Request の属性): Request オブジェクト.
                                                             (line   48)
* unwrap() (inspect モジュール):         クラスと関数<2>.    (line  133)
* unwrap() (ssl.SSLSocket のメソッド):   SSL ソケット.       (line  293)
* unwrap() (urllib.parse モジュール):    URL の解析.         (line  351)
* up (pdb command):                      Debugger commands.  (line   98)
* up() (turtle モジュール):              描画状態.           (line   12)
* update_abstractmethods() (abc モジュール): abc --- 抽象基底クラス.
                                                             (line  335)
* update_authenticated() (urllib.request.HTTPPasswordMgrWithPriorAuth のメソッド): HTTPPasswordMgrWithPriorAuth オブジェクト.
                                                             (line   26)
* update_lines_cols() (curses モジュール): 関数<6>.          (line  571)
* update_panels() (curses.panel モジュール): 関数<7>.        (line   23)
* update_visible() (mailbox.BabylMessage のメソッド): BabylMessage オブジェクト.
                                                             (line   77)
* update_wrapper() (functools モジュール): functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  699)
* update() (collections.Counter のメソッド): Counter オブジェクト.
                                                             (line  118)
* update() (dict のメソッド):            マッピング型 --- dict.
                                                             (line  233)
* update() (hashlib.hash のメソッド):    Hash Objects.       (line   30)
* update() (hmac.HMAC のメソッド):       hmac --- メッセージ認証のための鍵付きハッシュ化.
                                                             (line   51)
* update() (http.cookies.Morsel のメソッド): Morselオブジェクト.
                                                             (line  103)
* update() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  230)
* update() (mailbox.Maildir のメソッド): Maildir オブジェクト.
                                                             (line  191)
* update() (set のメソッド):             set（集合）型 --- set frozenset.
                                                             (line  172)
* update() (trace.CoverageResults のメソッド): プログラミングインターフェース.
                                                             (line   51)
* update() (turtle モジュール):          アニメーションの制御.
                                                             (line   58)
* upgrade_dependencies() (venv.EnvBuilder のメソッド): API<2>.
                                                             (line  159)
* upper() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  734)
* upper() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  734)
* upper() (str のメソッド):              文字列メソッド<2>.  (line  903)
* urandom() (os モジュール):             乱数<2>.            (line   29)
* URL:                                   urllib parse --- URL を構成要素に解析する.
                                                             (line    8)
* URL <1>:                               urllib robotparser --- robots txt 用のパーサー.
                                                             (line    8)
* URL <2>:                               http server --- HTTP サーバー.
                                                             (line    8)
* url (http.client.HTTPResponse の属性): HTTPResponse オブジェクト.
                                                             (line   52)
* url (urllib.error.HTTPError の属性):   urllib error --- urllib request によって送出される例外クラス.
                                                             (line   39)
* url (urllib.response.addinfourl の属性): urllib response --- Response classes used by urllib.
                                                             (line   14)
* url (xmlrpc.client.ProtocolError の属性): ProtocolError オブジェクト.
                                                             (line   12)
* URL;parsing:                           urllib parse --- URL を構成要素に解析する.
                                                             (line    8)
* url2pathname() (urllib.request モジュール): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  170)
* urlcleanup() (urllib.request モジュール): レガシーインターフェース<2>.
                                                             (line   62)
* urldefrag() (urllib.parse モジュール): URL の解析.         (line  324)
* urlencode() (urllib.parse モジュール): URL のクオート.     (line  103)
* URLError:                              urllib error --- urllib request によって送出される例外クラス.
                                                             (line   16)
* urljoin() (urllib.parse モジュール):   URL の解析.         (line  288)
* urlopen() (urllib.request モジュール): urllib request --- URL を開くための大規模なライブラリ.
                                                             (line   33)
* urlparse() (urllib.parse モジュール):  URL の解析.         (line  261)
* urlretrieve() (urllib.request モジュール): レガシーインターフェース<2>.
                                                             (line   10)
* urlsafe_b64decode() (base64 モジュール): RFC 4648 エンコーディング.
                                                             (line   68)
* urlsafe_b64encode() (base64 モジュール): RFC 4648 エンコーディング.
                                                             (line   61)
* urlsplit() (urllib.parse モジュール):  URL の解析.         (line    9)
* urlunparse() (urllib.parse モジュール): URL の解析.        (line  279)
* urlunsplit() (urllib.parse モジュール): URL の解析.        (line  253)
* urn (uuid.UUID の属性):                uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  148)
* US (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line  117)
* use_default_colors() (curses モジュール): 関数<6>.         (line  603)
* use_env() (curses モジュール):         関数<6>.            (line  593)
* use_rawinput (cmd.Cmd の属性):         Cmdオブジェクト.    (line  176)
* USE_STACKCHECK (C macro):              オペレーティングシステム関連のユーティリティ.
                                                             (line   91)
* use_tool_id() (sys.monitoring モジュール): Registering and using tools.
                                                             (line    6)
* UseForeignDTD() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line   61)
* USER:                                  getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   58)
* USER_BASE (site モジュール):           モジュールの内容<5>.
                                                             (line   32)
* user_call() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  297)
* user_exception() (bdb.Bdb のメソッド): bdb --- デバッガーフレームワーク.
                                                             (line  316)
* user_line() (bdb.Bdb のメソッド):      bdb --- デバッガーフレームワーク.
                                                             (line  305)
* user_return() (bdb.Bdb のメソッド):    bdb --- デバッガーフレームワーク.
                                                             (line  311)
* USER_SITE (site モジュール):           モジュールの内容<5>.
                                                             (line   20)
* user() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line   30)
* usercustomize:                         カスタマイズ用モジュール.
                                                             (line    7)
* usercustomize <1>:                     カスタマイズ用モジュール.
                                                             (line   21)
* UserDict (collections のクラス):       UserDict オブジェクト.
                                                             (line   11)
* UserList (collections のクラス):       UserList オブジェクト.
                                                             (line   15)
* USERNAME:                              os path --- 一般的なパス名操作.
                                                             (line  158)
* USERNAME <1>:                          プロセスのパラメーター.
                                                             (line  259)
* USERNAME <2>:                          getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   58)
* username (email.headerregistry.Address の属性): email headerregistry Custom Header Objects.
                                                             (line  426)
* USERPROFILE:                           os path<5>.         (line   14)
* USERPROFILE <1>:                       Python API の変更<6>.
                                                             (line  117)
* USERPROFILE <2>:                       Windows<48>.        (line   15)
* USERPROFILE <3>:                       os path --- 一般的なパス名操作.
                                                             (line  155)
* userptr() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   57)
* UserString (collections のクラス):     UserString オブジェクト.
                                                             (line   11)
* UserWarning:                           警告.               (line   13)
* USTAR_FORMAT (tarfile モジュール):     tarfile --- tar アーカイブファイルの読み書き.
                                                             (line  378)
* USub (ast のクラス):                   式 expression<2>.   (line   28)
* UTC:                                   time --- 時刻データへのアクセスと変換.
                                                             (line   39)
* UTC (datetime モジュール):             定数.               (line   18)
* utc (datetime.timezone の属性):        timezone objects.   (line   69)
* utcfromtimestamp() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line  133)
* utcnow() (datetime.datetime のクラスメソッド): datetime objects.
                                                             (line   81)
* utcoffset() (datetime.datetime のメソッド): datetime objects.
                                                             (line  534)
* utcoffset() (datetime.time のメソッド): time objects.      (line  248)
* utcoffset() (datetime.timezone のメソッド): timezone objects.
                                                             (line   31)
* utcoffset() (datetime.tzinfo のメソッド): tzinfo objects.  (line   38)
* utctimetuple() (datetime.datetime のメソッド): datetime objects.
                                                             (line  579)
* utf8 (email.policy.EmailPolicy の属性): email policy Policy Objects.
                                                             (line  378)
* utf8_enabled (imaplib.IMAP4 の属性):   IMAP4 オブジェクト. (line  494)
* utf8_mode (sys.flags の属性):          sys --- システム固有のパラメーターと関数.
                                                             (line  570)
* utf8() (poplib.POP3 のメソッド):       POP3 オブジェクト.  (line  106)
* utime() (os モジュール):               ファイルとディレクトリ.
                                                             (line 1630)
* UUID (uuid のクラス):                  uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line   51)
* uuid コマンドラインオプション; -C:     コマンドラインからの使用.
                                                             (line   40)
* uuid コマンドラインオプション; -count: コマンドラインからの使用.
                                                             (line   40)
* uuid コマンドラインオプション; -h:     コマンドラインからの使用.
                                                             (line   14)
* uuid コマンドラインオプション; -help:  コマンドラインからの使用.
                                                             (line   14)
* uuid コマンドラインオプション; -n:     コマンドラインからの使用.
                                                             (line   26)
* uuid コマンドラインオプション; -N:     コマンドラインからの使用.
                                                             (line   34)
* uuid コマンドラインオプション; -name:  コマンドラインからの使用.
                                                             (line   34)
* uuid コマンドラインオプション; -namespace: コマンドラインからの使用.
                                                             (line   26)
* uuid コマンドラインオプション; -u:     コマンドラインからの使用.
                                                             (line   18)
* uuid コマンドラインオプション; -uuid:  コマンドラインからの使用.
                                                             (line   18)
* uuid1() (uuid モジュール):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  191)
* uuid3() (uuid モジュール):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  204)
* uuid4() (uuid モジュール):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  211)
* uuid5() (uuid モジュール):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  216)
* uuid6() (uuid モジュール):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  223)
* uuid7() (uuid モジュール):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  241)
* uuid8() (uuid モジュール):             uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  251)
* v4_int_to_packed() (ipaddress モジュール): その他のモジュールレベル関数.
                                                             (line    8)
* v6_int_to_packed() (ipaddress モジュール): その他のモジュールレベル関数.
                                                             (line   20)
* valid_signals() (signal モジュール):   モジュールの内容<2>.
                                                             (line  330)
* validator() (wsgiref.validate モジュール): wsgiref validate --- WSGI conformance checker.
                                                             (line   21)
* value:                                 辞書表示.           (line    6)
* VALUE (annotationlib.Format の属性):   クラス<5>.          (line   14)
* value (ctypes._SimpleCData の属性):    基本データ型<2>.    (line   17)
* value (enum.Enum の属性):              データ型<2>.        (line  130)
* value (http.cookiejar.Cookie の属性):  Cookieオブジェクト<2>.
                                                             (line   31)
* value (http.cookies.Morsel の属性):    Morselオブジェクト. (line   63)
* value (StopIteration の属性):          具象例外.           (line  267)
* value (string.templatelib.Interpolation の属性): 型.       (line  214)
* value (xml.dom.Attr の属性):           Attr オブジェクト.  (line   23)
* value_decode() (http.cookies.BaseCookie のメソッド): Cookieオブジェクト.
                                                             (line    6)
* value_encode() (http.cookies.BaseCookie のメソッド): Cookieオブジェクト.
                                                             (line   13)
* VALUE_WITH_FAKE_GLOBALS (annotationlib.Format の属性): クラス<5>.
                                                             (line   19)
* Value() (multiprocessing モジュール):  共有 ctypes オブジェクト.
                                                             (line    9)
* Value() (multiprocessing.managers.SyncManager のメソッド): マネージャー.
                                                             (line  220)
* Value() (multiprocessing.sharedctypes モジュール): The multiprocessing sharedctypes module.
                                                             (line   71)
* ValueError:                            具象例外.           (line  478)
* valuerefs() (weakref.WeakValueDictionary のメソッド): weakref --- Weak references.
                                                             (line  217)
* Values (optparse のクラス):            オプションの定義.   (line   87)
* values (string.templatelib.Template の属性): 型.           (line   90)
* values() (contextvars.Context のメソッド): マニュアルでのコンテキスト管理.
                                                             (line  137)
* values() (dict のメソッド):            マッピング型 --- dict.
                                                             (line  251)
* values() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  237)
* values() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  348)
* values() (mailbox.Mailbox のメソッド): Mailbox オブジェクト.
                                                             (line  127)
* values() (types.MappingProxyType のメソッド): 標準的なインタプリタ型.
                                                             (line  279)
* ValuesView (collections.abc のクラス): コレクションの抽象基底クラス -- 詳細な説明.
                                                             (line  127)
* ValuesView (typing のクラス):          Aliases to container ABCs in collections abc.
                                                             (line  120)
* var (contextvars.Token の属性):        コンテキスト変数.   (line  116)
* variable annotation:                   用語集<2>.          (line 1838)
* variance (statistics.NormalDist の属性): NormalDist オブジェクト.
                                                             (line   40)
* variance() (statistics モジュール):    関数の詳細.         (line  430)
* variant (uuid.UUID の属性):            uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  152)
* vbar (tkinter.scrolledtext.ScrolledText の属性): tkinter scrolledtext --- スクロール可能なテキストウィジェット.
                                                             (line   30)
* VBAR (token モジュール):               token --- Python 解析木で使われる定数.
                                                             (line  236)
* VBAREQUAL (token モジュール):          token --- Python 解析木で使われる定数.
                                                             (line  308)
* VC_ASSEMBLY_PUBLICKEYTOKEN (msvcrt モジュール): その多の関数.
                                                             (line   93)
* Vec2D (turtle のクラス):               Public classes.     (line   87)
* vectorcallfunc (C type):               The Vectorcall Protocol.
                                                             (line   41)
* venv コマンドラインオプション; -clear: 仮想環境の作成<2>.  (line   65)
* venv コマンドラインオプション; -copies: 仮想環境の作成<2>. (line   60)
* venv コマンドラインオプション; -prompt: 仮想環境の作成<2>. (line   80)
* venv コマンドラインオプション; -symlinks: 仮想環境の作成<2>.
                                                             (line   55)
* venv コマンドラインオプション; -system-site-packages: 仮想環境の作成<2>.
                                                             (line   50)
* venv コマンドラインオプション; -upgrade: 仮想環境の作成<2>.
                                                             (line   70)
* venv コマンドラインオプション; -upgrade-deps: 仮想環境の作成<2>.
                                                             (line   84)
* venv コマンドラインオプション; -without-pip: 仮想環境の作成<2>.
                                                             (line   75)
* venv コマンドラインオプション; -without-scm-ignore-files: 仮想環境の作成<2>.
                                                             (line   88)
* venv コマンドラインオプション; ENV_DIR: 仮想環境の作成<2>. (line   45)
* VERBOSE (re モジュール):               フラグ.             (line  122)
* verbose (sys.flags の属性):            sys --- システム固有のパラメーターと関数.
                                                             (line  554)
* verbose (tabnanny モジュール):         tabnanny --- あいまいなインデントの検出.
                                                             (line   26)
* verbose (test.support モジュール):     test support --- Utilities for the Python test suite.
                                                             (line   30)
* VERIFY_ALLOW_PROXY_CERTS (ssl モジュール): 定数<9>.        (line   99)
* verify_client_post_handshake() (ssl.SSLSocket のメソッド): SSL ソケット.
                                                             (line  301)
* verify_code (ssl.SSLCertVerificationError の属性): 例外<19>.
                                                             (line   84)
* VERIFY_CRL_CHECK_CHAIN (ssl モジュール): 定数<9>.          (line   84)
* VERIFY_CRL_CHECK_LEAF (ssl モジュール): 定数<9>.           (line   74)
* VERIFY_DEFAULT (ssl モジュール):       定数<9>.            (line   66)
* verify_flags (ssl.SSLContext の属性):  SSL コンテキスト.   (line  632)
* verify_generated_headers (email.policy.Policy の属性): email policy Policy Objects.
                                                             (line  202)
* verify_message (ssl.SSLCertVerificationError の属性): 例外<19>.
                                                             (line   88)
* verify_mode (ssl.SSLContext の属性):   SSL コンテキスト.   (line  647)
* verify_request() (socketserver.BaseServer のメソッド): Serverオブジェクト<2>.
                                                             (line  173)
* VERIFY_X509_PARTIAL_CHAIN (ssl モジュール): 定数<9>.       (line  114)
* VERIFY_X509_STRICT (ssl モジュール):   定数<9>.            (line   92)
* VERIFY_X509_TRUSTED_FIRST (ssl モジュール): 定数<9>.       (line  106)
* verify() (enum モジュール):            ユーティリティとデコレータ.
                                                             (line   73)
* verify() (smtplib.SMTP のメソッド):    SMTP オブジェクト.  (line   88)
* VerifyFlags (ssl のクラス):            定数<9>.            (line  125)
* VerifyMode (ssl のクラス):             定数<9>.            (line   60)
* version (curses モジュール):           定数<6>.            (line   18)
* version (email.headerregistry.MIMEVersionHeader の属性): email headerregistry Custom Header Objects.
                                                             (line  237)
* version (http.client.HTTPResponse の属性): HTTPResponse オブジェクト.
                                                             (line   47)
* version (http.cookiejar.Cookie の属性): Cookieオブジェクト<2>.
                                                             (line   19)
* version (http.cookies.Morsel の属性):  Morselオブジェクト. (line   13)
* version (in module sys):               プロセスワイドのパラメータ.
                                                             (line  169)
* version (in module sys) <1>:           プロセスワイドのパラメータ.
                                                             (line  206)
* version (in module sys) <2>:           プロセスワイドのパラメータ.
                                                             (line  217)
* version (ipaddress.IPv4Address の属性): Address オブジェクト.
                                                             (line   44)
* version (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line   61)
* version (ipaddress.IPv6Address の属性): Address オブジェクト.
                                                             (line  271)
* version (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  295)
* version (marshal モジュール):          marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line  149)
* version (sys モジュール):              sys --- システム固有のパラメーターと関数.
                                                             (line 2155)
* version (sys.thread_info の属性):      sys --- システム固有のパラメーターと関数.
                                                             (line 2093)
* version (uuid.UUID の属性):            uuid --- RFC 9562 に基づく UUID オブジェクト.
                                                             (line  158)
* version_info (sys モジュール):         sys --- システム固有のパラメーターと関数.
                                                             (line 2171)
* version_string() (http.server.BaseHTTPRequestHandler のメソッド): http server --- HTTP サーバー.
                                                             (line  361)
* version() (ensurepip モジュール):      モジュール API.     (line    8)
* version() (importlib.metadata モジュール): 配布物バージョン.
                                                             (line    6)
* version() (platform モジュール):       Cross platform.     (line  137)
* version() (ssl.SSLSocket のメソッド):  SSL ソケット.       (line  323)
* vformat() (string.Formatter のメソッド): カスタムの文字列書式化.
                                                             (line   26)
* virtual environment:                   用語集<2>.          (line 1862)
* virtual machine:                       用語集<2>.          (line 1871)
* visit_Constant() (ast.NodeVisitor のメソッド): ast helpers.
                                                             (line  211)
* visit() (ast.NodeVisitor のメソッド):  ast helpers.        (line  194)
* visitproc (C type):                    循環参照ガベージコレクションをサポートする.
                                                             (line  223)
* vline() (curses.window のメソッド):    Window オブジェクト.
                                                             (line  579)
* voidcmd() (ftplib.FTP のメソッド):     FTP オブジェクト.   (line  164)
* volume (zipfile.ZipInfo の属性):       ZipInfo objects.    (line  135)
* vonmisesvariate() (random モジュール): 実数分布.           (line   85)
* VT (curses.ascii モジュール):          curses ascii --- ASCII 文字のユーティリティー.
                                                             (line   57)
* W_OK (os モジュール):                  ファイルとディレクトリ.
                                                             (line  109)
* wait_closed() (asyncio.Server のメソッド): Serverオブジェクト.
                                                             (line  125)
* wait_closed() (asyncio.StreamWriter のメソッド): StreamWriter.
                                                             (line  119)
* wait_for() (asyncio モジュール):       タイムアウト.       (line  122)
* wait_for() (asyncio.Condition のメソッド): Condition.      (line  104)
* wait_for() (threading.Condition のメソッド): Condition objects.
                                                             (line  134)
* wait_process() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  445)
* wait_threads_exit() (test.support.threading_helper モジュール): test support threading_helper --- Utilities for threading tests.
                                                             (line   41)
* wait_until_any_call_with() (unittest.mock.ThreadingMock のメソッド): Mock クラス.
                                                             (line  975)
* wait_until_called() (unittest.mock.ThreadingMock のメソッド): Mock クラス.
                                                             (line  960)
* wait() (asyncio モジュール):           要素の終了待機.     (line    6)
* wait() (asyncio.Barrier のメソッド):   Barrier.            (line   53)
* wait() (asyncio.Condition のメソッド): Condition.          (line   86)
* wait() (asyncio.Event のメソッド):     Event.              (line   44)
* wait() (asyncio.subprocess.Process のメソッド): サブプロセスとやりとりする.
                                                             (line   37)
* wait() (concurrent.futures モジュール): モジュール関数<2>. (line    6)
* wait() (multiprocessing.connection モジュール): リスナーとクライアント.
                                                             (line  115)
* wait() (multiprocessing.pool.AsyncResult のメソッド): プロセスプール.
                                                             (line  213)
* wait() (os モジュール):                プロセス管理.       (line  832)
* wait() (subprocess.Popen のメソッド):  Popen オブジェクト. (line   14)
* wait() (threading.Barrier のメソッド): Barrier objects.    (line   42)
* wait() (threading.Condition のメソッド): Condition objects.
                                                             (line  103)
* wait() (threading.Event のメソッド):   Event objects.      (line   45)
* wait3() (os モジュール):               プロセス管理.       (line  940)
* wait4() (os モジュール):               プロセス管理.       (line  954)
* waitid() (os モジュール):              プロセス管理.       (line  856)
* waitpid() (os モジュール):             プロセス管理.       (line  895)
* waitstatus_to_exitcode() (os モジュール): プロセス管理.    (line 1070)
* walk_packages() (pkgutil モジュール):  pkgutil --- パッケージ拡張ユーティリティ.
                                                             (line  107)
* walk_stack() (traceback モジュール):   モジュールレベルの関数<2>.
                                                             (line  182)
* walk_tb() (traceback モジュール):      モジュールレベルの関数<2>.
                                                             (line  196)
* walk() (ast モジュール):               ast helpers.        (line  179)
* walk() (email.message.EmailMessage のメソッド): email message Representing an email message.
                                                             (line  467)
* walk() (email.message.Message のメソッド): email message Message compat32 API を使用した電子メールメッセージの表現.
                                                             (line  645)
* walk() (os モジュール):                ファイルとディレクトリ.
                                                             (line 1675)
* walk() (pathlib.Path のメソッド):      ディレクトリを読む. (line  107)
* walrus operator:                       ブール演算 boolean operation.
                                                             (line   34)
* walrus operator <1>:                   用語集<2>.          (line 1877)
* want (doctest.Example の属性):         Example オブジェクト.
                                                             (line   22)
* warn_default_encoding (sys.flags の属性): sys --- システム固有のパラメーターと関数.
                                                             (line  580)
* warn_explicit() (warnings モジュール): 利用可能な関数.     (line   61)
* warn() (warnings モジュール):          利用可能な関数.     (line    6)
* Warning:                               警告.               (line    9)
* Warning <1>:                           例外<7>.            (line    8)
* WARNING (logging モジュール):          ロギングレベル.     (line   33)
* WARNING (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  198)
* warning() (logging モジュール):        モジュールレベルの関数.
                                                             (line   67)
* warning() (logging.Logger のメソッド): ロガーオブジェクト. (line  283)
* warning() (xml.sax.handler.ErrorHandler のメソッド): ErrorHandler オブジェクト.
                                                             (line   29)
* warnings:                              warnings --- 警告の制御.
                                                             (line    8)
* WarningsRecorder (test.support.warnings_helper のクラス): test support warnings_helper --- Utilities for warnings tests.
                                                             (line  112)
* warnoptions (sys モジュール):          sys --- システム固有のパラメーターと関数.
                                                             (line 2184)
* wasSuccessful() (unittest.TestResult のメソッド): テストのロードと起動.
                                                             (line  314)
* WatchedFileHandler (logging.handlers のクラス): WatchedFileHandler.
                                                             (line   25)
* Wave_read (wave のクラス):             Wave_read オブジェクト.
                                                             (line    6)
* Wave_write (wave のクラス):            Wave_write オブジェクト.
                                                             (line    6)
* WCONTINUED (os モジュール):            プロセス管理.       (line  993)
* WCOREDUMP() (os モジュール):           プロセス管理.       (line 1111)
* WeakKeyDictionary (weakref のクラス):  weakref --- Weak references.
                                                             (line  158)
* WeakMethod (weakref のクラス):         weakref --- Weak references.
                                                             (line  226)
* WeakSet (weakref のクラス):            weakref --- Weak references.
                                                             (line  221)
* WeakValueDictionary (weakref のクラス): weakref --- Weak references.
                                                             (line  205)
* webbrowser コマンドラインオプション; -n: コマンドライン・インターフェース<6>.
                                                             (line   10)
* webbrowser コマンドラインオプション; -new-tab: コマンドライン・インターフェース<6>.
                                                             (line   14)
* webbrowser コマンドラインオプション; -new-window: コマンドライン・インターフェース<6>.
                                                             (line   10)
* webbrowser コマンドラインオプション; -t: コマンドライン・インターフェース<6>.
                                                             (line   14)
* WEDNESDAY (calendar モジュール):       calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  440)
* weekday (calendar.IllegalWeekdayError の属性): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  525)
* weekday() (calendar モジュール):       calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  370)
* weekday() (datetime.date のメソッド):  date objects.       (line  259)
* weekday() (datetime.datetime のメソッド): datetime objects.
                                                             (line  642)
* weekheader() (calendar モジュール):    calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  375)
* weibullvariate() (random モジュール):  実数分布.           (line   96)
* WEXITED (os モジュール):               プロセス管理.       (line 1002)
* WEXITSTATUS() (os モジュール):         プロセス管理.       (line 1158)
* wfile (http.server.BaseHTTPRequestHandler の属性): http server --- HTTP サーバー.
                                                             (line  172)
* wfile (socketserver.DatagramRequestHandler の属性): Request Handler Objects.
                                                             (line   67)
* whatis (pdb command):                  Debugger commands.  (line  286)
* when() (asyncio.Timeout のメソッド):   タイムアウト.       (line   67)
* when() (asyncio.TimerHandle のメソッド): コールバックのハンドル.
                                                             (line   36)
* whence (concurrent.interpreters.Interpreter の属性): Interpreter objects.
                                                             (line   20)
* where (pdb command):                   Debugger commands.  (line   82)
* which() (shutil モジュール):           ディレクトリとファイルの操作.
                                                             (line  440)
* whichdb() (dbm モジュール):            dbm --- Unix "データベース" へのインターフェース.
                                                             (line   30)
* While (ast のクラス):                  制御フロー.         (line   77)
* whitespace (shlex.shlex の属性):       shlex オブジェクト. (line  103)
* whitespace (string モジュール):        文字列定数.         (line   51)
* whitespace_split (shlex.shlex の属性): shlex オブジェクト. (line  127)
* Widget (tkinter.ttk のクラス):         ttk Widget.         (line   10)
* width (sys.hash_info の属性):          sys --- システム固有のパラメーターと関数.
                                                             (line 1054)
* width (textwrap.TextWrapper の属性):   textwrap --- テキストの折り返しと詰め込み.
                                                             (line  165)
* width() (turtle モジュール):           描画状態.           (line   18)
* WIFCONTINUED() (os モジュール):        プロセス管理.       (line 1121)
* WIFEXITED() (os モジュール):           プロセス管理.       (line 1150)
* WIFSIGNALED() (os モジュール):         プロセス管理.       (line 1143)
* WIFSTOPPED() (os モジュール):          プロセス管理.       (line 1131)
* win32_code_page_search_function() (encodings モジュール): encodings --- Encodings package.
                                                             (line   39)
* win32_edition() (platform モジュール): Windows platform.   (line   22)
* win32_is_iot() (platform モジュール):  Windows platform.   (line   31)
* win32_ver() (platform モジュール):     Windows platform.   (line    6)
* WinDLL (ctypes のクラス):              共有ライブラリをロードする.
                                                             (line   54)
* window (curses のクラス):              Window オブジェクト.
                                                             (line    6)
* window manager (widgets):              ウィンドウマネージャ.
                                                             (line    6)
* window_height() (turtle モジュール):   設定と特殊なメソッド.
                                                             (line  114)
* window_log (compression.zstd.CompressionParameter の属性): Advanced parameter control.
                                                             (line   53)
* window_log_max (compression.zstd.DecompressionParameter の属性): Advanced parameter control.
                                                             (line  287)
* window_width() (turtle モジュール):    設定と特殊なメソッド.
                                                             (line  121)
* window() (curses.panel.Panel のメソッド): Panel オブジェクト.
                                                             (line   61)
* Windows:                               完全な Python プログラム.
                                                             (line   24)
* Windows ini ファイル:                  configparser --- 設定ファイルのパーサー.
                                                             (line    8)
* WindowsError:                          具象例外.           (line  496)
* WindowsPath (pathlib のクラス):        具象パス.           (line   35)
* WindowsProactorEventLoopPolicy (asyncio のクラス): ポリシーオブジェクト.
                                                             (line   67)
* WindowsRegistryFinder (importlib.machinery のクラス): importlib machinery -- Importers and path hooks.
                                                             (line   91)
* WindowsSelectorEventLoopPolicy (asyncio のクラス): ポリシーオブジェクト.
                                                             (line   57)
* winerror (OSError の属性):             具象例外.           (line  172)
* WinError() (ctypes モジュール):        ユーティリティー関数.
                                                             (line  278)
* WINFUNCTYPE() (ctypes モジュール):     関数プロトタイプ.   (line   23)
* WinSock:                               select --- I/O 完了の待機.
                                                             (line  153)
* winver (sys モジュール):               sys --- システム固有のパラメーターと関数.
                                                             (line 2189)
* With (ast のクラス):                   制御フロー.         (line  231)
* WITH_EXCEPT_START (opcode):            Python バイトコード命令.
                                                             (line  481)
* with_hostmask (ipaddress.IPv4Interface の属性): インターフェイスオブジェクト.
                                                             (line   55)
* with_hostmask (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line  123)
* with_hostmask (ipaddress.IPv6Interface の属性): インターフェイスオブジェクト.
                                                             (line   82)
* with_hostmask (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  327)
* with_name() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  361)
* with_netmask (ipaddress.IPv4Interface の属性): インターフェイスオブジェクト.
                                                             (line   46)
* with_netmask (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line  118)
* with_netmask (ipaddress.IPv6Interface の属性): インターフェイスオブジェクト.
                                                             (line   80)
* with_netmask (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  325)
* with_prefixlen (ipaddress.IPv4Interface の属性): インターフェイスオブジェクト.
                                                             (line   37)
* with_prefixlen (ipaddress.IPv4Network の属性): Network オブジェクト.
                                                             (line  105)
* with_prefixlen (ipaddress.IPv6Interface の属性): インターフェイスオブジェクト.
                                                             (line   78)
* with_prefixlen (ipaddress.IPv6Network の属性): Network オブジェクト.
                                                             (line  319)
* with_pymalloc() (test.support モジュール): test support --- Utilities for the Python test suite.
                                                             (line  280)
* with_segments() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  422)
* with_statement (__future__ モジュール): モジュールコンテンツ<5>.
                                                             (line   31)
* with_stem() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  378)
* with_suffix() (pathlib.PurePath のメソッド): メソッドとプロパティ.
                                                             (line  402)
* with_traceback() (BaseException のメソッド): 基底クラス.   (line   23)
* withitem (ast のクラス):               制御フロー.         (line  242)
* WNOHANG (os モジュール):               プロセス管理.       (line 1036)
* WNOWAIT (os モジュール):               プロセス管理.       (line 1044)
* wordchars (shlex.shlex の属性):        shlex オブジェクト. (line   90)
* World Wide Web:                        インターネットプロトコルとサポート.
                                                             (line    6)
* World Wide Web <1>:                    urllib parse --- URL を構成要素に解析する.
                                                             (line    8)
* World Wide Web <2>:                    urllib robotparser --- robots txt 用のパーサー.
                                                             (line    8)
* wrap_bio() (ssl.SSLContext のメソッド): SSL コンテキスト.  (line  455)
* wrap_future() (asyncio モジュール):    Future の関数.      (line   54)
* wrap_socket() (ssl.SSLContext のメソッド): SSL コンテキスト.
                                                             (line  389)
* wrap() (textwrap モジュール):          textwrap --- テキストの折り返しと詰め込み.
                                                             (line   16)
* wrap() (textwrap.TextWrapper のメソッド): textwrap --- テキストの折り返しと詰め込み.
                                                             (line  283)
* wrapper() (curses モジュール):         関数<6>.            (line  607)
* WrapperDescriptorType (types モジュール): 標準的なインタプリタ型.
                                                             (line   87)
* wraps() (functools モジュール):        functools --- 高階関数と呼び出し可能オブジェクトの操作.
                                                             (line  745)
* WRITABLE (_tkinter モジュール):        ファイルハンドラ.   (line   42)
* WRITABLE (inspect.BufferFlags の属性): Buffer flags.       (line   17)
* writable() (bz2.BZ2File のメソッド):   ファイルの圧縮/解凍.
                                                             (line  104)
* writable() (io.IOBase のメソッド):     I/O 基底クラス.     (line  152)
* WRITE (inspect.BufferFlags の属性):    Buffer flags.       (line   51)
* write_byte() (mmap.mmap のメソッド):   mmap --- メモリマップファイルのサポート.
                                                             (line  340)
* write_bytes() (pathlib.Path のメソッド): ファイルを読み書きする<2>.
                                                             (line   66)
* write_docstringdict() (turtle モジュール): ドキュメント文字列の翻訳.
                                                             (line    9)
* write_eof() (asyncio.StreamWriter のメソッド): StreamWriter.
                                                             (line   57)
* write_eof() (asyncio.WriteTransport のメソッド): 書き込み専用のトランスポート.
                                                             (line   77)
* write_eof() (ssl.MemoryBIO のメソッド): メモリ BIO サポート<2>.
                                                             (line  159)
* write_history_file() (readline モジュール): 履歴ファイル.  (line   17)
* WRITE_RESTRICTED (C macro):            Member flags.       (line   30)
* write_results() (trace.CoverageResults のメソッド): プログラミングインターフェース.
                                                             (line   56)
* write_text() (pathlib.Path のメソッド): ファイルを読み書きする<2>.
                                                             (line   47)
* write_through (io.TextIOWrapper の属性): テキスト I/O<2>.  (line  175)
* write() (asyncio.StreamWriter のメソッド): StreamWriter.   (line   15)
* write() (asyncio.WriteTransport のメソッド): 書き込み専用のトランスポート.
                                                             (line   63)
* write() (code.InteractiveInterpreter のメソッド): 対話的なインタプリタオブジェクト.
                                                             (line   62)
* write() (codecs.StreamWriter のメソッド): StreamWriter オブジェクト.
                                                             (line   33)
* write() (configparser.ConfigParser のメソッド): ConfigParser オブジェクト.
                                                             (line  284)
* write() (email.generator.BytesGenerator のメソッド): email generator Generating MIME documents.
                                                             (line  117)
* write() (email.generator.Generator のメソッド): email generator Generating MIME documents.
                                                             (line  213)
* write() (io.BufferedIOBase のメソッド): I/O 基底クラス.    (line  333)
* write() (io.BufferedWriter のメソッド): バッファ付きストリーム.
                                                             (line  130)
* write() (io.RawIOBase のメソッド):     I/O 基底クラス.     (line  212)
* write() (io.TextIOBase のメソッド):    テキスト I/O<2>.    (line   91)
* write() (io.Writer のメソッド):        Static Typing.      (line   40)
* write() (mmap.mmap のメソッド):        mmap --- メモリマップファイルのサポート.
                                                             (line  324)
* write() (os モジュール):               ファイル記述子の操作.
                                                             (line  966)
* write() (sqlite3.Blob のメソッド):     Blob オブジェクト.  (line   55)
* write() (ssl.MemoryBIO のメソッド):    メモリ BIO サポート<2>.
                                                             (line  150)
* write() (ssl.SSLSocket のメソッド):    SSL ソケット.       (line   97)
* write() (turtle モジュール):           さらなる描画の制御. (line   29)
* write() (xml.etree.ElementTree.ElementTree のメソッド): ElementTree オブジェクト.
                                                             (line   60)
* write() (zipfile.ZipFile のメソッド):  ZipFile objects.    (line  283)
* writeframes() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   83)
* writeframesraw() (wave.Wave_write のメソッド): Wave_write オブジェクト.
                                                             (line   76)
* writeheader() (csv.DictWriter のメソッド): writer オブジェクト.
                                                             (line   39)
* writelines() (asyncio.StreamWriter のメソッド): StreamWriter.
                                                             (line   29)
* writelines() (asyncio.WriteTransport のメソッド): 書き込み専用のトランスポート.
                                                             (line   70)
* writelines() (codecs.StreamWriter のメソッド): StreamWriter オブジェクト.
                                                             (line   37)
* writelines() (io.IOBase のメソッド):   I/O 基底クラス.     (line  158)
* writepy() (zipfile.PyZipFile のメソッド): PyZipFile objects.
                                                             (line   19)
* Writer (io のクラス):                  Static Typing.      (line   32)
* writer() (csv モジュール):             モジュールコンテンツ<3>.
                                                             (line   40)
* writerow() (csv.csvwriter のメソッド): writer オブジェクト.
                                                             (line   16)
* writerows() (csv.csvwriter のメソッド): writer オブジェクト.
                                                             (line   25)
* writestr() (zipfile.ZipFile のメソッド): ZipFile objects.  (line  320)
* WriteTransport (asyncio のクラス):     トランスポートのクラス階層構造.
                                                             (line   11)
* writev() (os モジュール):              ファイル記述子の操作.
                                                             (line  985)
* writexml() (xml.dom.minidom.Node のメソッド): DOM オブジェクト.
                                                             (line   28)
* writing;''values'':                    式文 expression statement.
                                                             (line   16)
* WrongDocumentErr:                      例外<23>.           (line   93)
* wsgi_file_wrapper (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  271)
* wsgi_multiprocess (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  154)
* wsgi_multithread (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  147)
* wsgi_run_once (wsgiref.handlers.BaseHandler の属性): wsgiref handlers -- server/gateway base classes.
                                                             (line  161)
* WSGIApplication (wsgiref.types モジュール): wsgiref types -- WSGI types for static type checking.
                                                             (line   20)
* WSGIEnvironment (wsgiref.types モジュール): wsgiref types -- WSGI types for static type checking.
                                                             (line   16)
* WSGIRequestHandler (wsgiref.simple_server のクラス): wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line   78)
* WSGIServer (wsgiref.simple_server のクラス): wsgiref simple_server -- a simple WSGI HTTP server.
                                                             (line   48)
* wShowWindow (subprocess.STARTUPINFO の属性): Windows Popen ヘルパー.
                                                             (line   49)
* WSTOPPED (os モジュール):              プロセス管理.       (line 1014)
* WSTOPSIG() (os モジュール):            プロセス管理.       (line 1167)
* wstring_at() (ctypes モジュール):      ユーティリティー関数.
                                                             (line  290)
* WTERMSIG() (os モジュール):            プロセス管理.       (line 1176)
* WUNTRACED (os モジュール):             プロセス管理.       (line 1025)
* WWW:                                   インターネットプロトコルとサポート.
                                                             (line    6)
* WWW <1>:                               urllib parse --- URL を構成要素に解析する.
                                                             (line    8)
* WWW <2>:                               urllib robotparser --- robots txt 用のパーサー.
                                                             (line    8)
* WWW;サーバ:                            http server --- HTTP サーバー.
                                                             (line    8)
* X (re モジュール):                     フラグ.             (line  122)
* X_OK (os モジュール):                  ファイルとディレクトリ.
                                                             (line  109)
* X509 certificate:                      SSL コンテキスト.   (line  760)
* xatom() (imaplib.IMAP4 のメソッド):    IMAP4 オブジェクト. (line  477)
* XATTR_CREATE (os モジュール):          Linux 拡張属性.     (line   89)
* XATTR_REPLACE (os モジュール):         Linux 拡張属性.     (line   94)
* XATTR_SIZE_MAX (os モジュール):        Linux 拡張属性.     (line   84)
* xcor() (turtle モジュール):            Turtle の状態を知る.
                                                             (line   32)
* XHTML:                                 html parser --- HTML と XHTML のシンプルなパーサー.
                                                             (line    8)
* XHTML_NAMESPACE (xml.dom モジュール):  モジュールコンテンツ<4>.
                                                             (line   51)
* XML_ERROR_ABORTED (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  174)
* XML_ERROR_AMPLIFICATION_LIMIT_BREACH (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  209)
* XML_ERROR_ASYNC_ENTITY (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   28)
* XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   30)
* XML_ERROR_BAD_CHAR_REF (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   36)
* XML_ERROR_BINARY_ENTITY_REF (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   41)
* XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  131)
* XML_ERROR_DUPLICATE_ATTRIBUTE (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   46)
* XML_ERROR_ENTITY_DECLARED_IN_PE (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  122)
* XML_ERROR_EXTERNAL_ENTITY_HANDLING (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  112)
* XML_ERROR_FEATURE_REQUIRES_XML_DTD (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  124)
* XML_ERROR_FINISHED (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  178)
* XML_ERROR_INCOMPLETE_PE (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  148)
* XML_ERROR_INCORRECT_ENCODING (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   50)
* XML_ERROR_INVALID_ARGUMENT (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  201)
* XML_ERROR_INVALID_TOKEN (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   52)
* XML_ERROR_JUNK_AFTER_DOC_ELEMENT (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   57)
* XML_ERROR_MISPLACED_XML_PI (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   61)
* XML_ERROR_NO_BUFFER (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  205)
* XML_ERROR_NO_ELEMENTS (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   65)
* XML_ERROR_NO_MEMORY (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   70)
* XML_ERROR_NOT_STANDALONE (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  114)
* XML_ERROR_NOT_STARTED (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  215)
* XML_ERROR_NOT_SUSPENDED (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  170)
* XML_ERROR_PARAM_ENTITY_REF (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   74)
* XML_ERROR_PARTIAL_CHAR (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   78)
* XML_ERROR_PUBLICID (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  160)
* XML_ERROR_RECURSIVE_ENTITY_REF (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   82)
* XML_ERROR_RESERVED_NAMESPACE_URI (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  196)
* XML_ERROR_RESERVED_PREFIX_XML (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  186)
* XML_ERROR_RESERVED_PREFIX_XMLNS (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  191)
* XML_ERROR_SUSPEND_PE (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  184)
* XML_ERROR_SUSPENDED (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  164)
* XML_ERROR_SYNTAX (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   87)
* XML_ERROR_TAG_MISMATCH (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   91)
* XML_ERROR_TEXT_DECL (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  156)
* XML_ERROR_UNBOUND_PREFIX (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  138)
* XML_ERROR_UNCLOSED_CDATA_SECTION (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  108)
* XML_ERROR_UNCLOSED_TOKEN (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line   95)
* XML_ERROR_UNDECLARING_PREFIX (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  143)
* XML_ERROR_UNDEFINED_ENTITY (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  100)
* XML_ERROR_UNEXPECTED_STATE (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  120)
* XML_ERROR_UNKNOWN_ENCODING (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  104)
* XML_ERROR_XML_DECL (xml.parsers.expat.errors モジュール): Expat エラー定数.
                                                             (line  152)
* XML_NAMESPACE (xml.dom モジュール):    モジュールコンテンツ<4>.
                                                             (line   41)
* XML() (xml.etree.ElementTree モジュール): 関数<9>.         (line  265)
* xmlcharrefreplace_errors() (codecs モジュール): エラーハンドラ.
                                                             (line  165)
* xmlcharrefreplace;error handler's name: エラーハンドラ.    (line   52)
* XmlDeclHandler() (xml.parsers.expat.xmlparser のメソッド): XMLParser オブジェクト<2>.
                                                             (line  259)
* XMLFilterBase (xml.sax.saxutils のクラス): xml sax saxutils --- SAX ユーティリティー.
                                                             (line   69)
* XMLGenerator (xml.sax.saxutils のクラス): xml sax saxutils --- SAX ユーティリティー.
                                                             (line   54)
* XMLID() (xml.etree.ElementTree モジュール): 関数<9>.       (line  274)
* XMLNS_NAMESPACE (xml.dom モジュール):  モジュールコンテンツ<4>.
                                                             (line   46)
* XMLParser (xml.etree.ElementTree のクラス): XMLParser オブジェクト.
                                                             (line    6)
* XMLParserType (xml.parsers.expat モジュール): xml parsers expat --- Expat を使用した高速な XML 解析.
                                                             (line   35)
* XMLPullParser (xml.etree.ElementTree のクラス): XMLPullParser オブジェクト.
                                                             (line    6)
* XMLReader (xml.sax.xmlreader のクラス): xml sax xmlreader --- XML パーサーのインターフェース.
                                                             (line   15)
* xor() (operator モジュール):           operator --- 関数形式の標準演算子.
                                                             (line  176)
* xview() (tkinter.ttk.Treeview のメソッド): ttk Treeview.   (line  317)
* ycor() (turtle モジュール):            Turtle の状態を知る.
                                                             (line   44)
* year (datetime.date の属性):           date objects.       (line  145)
* year (datetime.datetime の属性):       datetime objects.   (line  307)
* yeardatescalendar() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  123)
* yeardays2calendar() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  130)
* yeardayscalendar() (calendar.Calendar のメソッド): calendar --- 一般的なカレンダーに関係する機能群.
                                                             (line  137)
* YES (tkinter.messagebox モジュール):   tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  157)
* YESEXPR (locale モジュール):           locale --- 国際化サービス.
                                                             (line  279)
* YESNO (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  181)
* YESNOCANCEL (tkinter.messagebox モジュール): tkinter messagebox --- Tkinter メッセージプロンプト.
                                                             (line  186)
* Yield (ast のクラス):                  関数およびクラス定義.
                                                             (line  123)
* YIELD_VALUE (opcode):                  Python バイトコード命令.
                                                             (line  413)
* yield;expression:                      Yield 式.           (line    6)
* yield;yield from (in What's New):      PEP 3151 OS および IO 例外階層の手直し.
                                                             (line   85)
* yield;例:                              ジェネレータ-イテレータメソッド.
                                                             (line   81)
* YieldFrom (ast のクラス):              関数およびクラス定義.
                                                             (line  123)
* yiq_to_rgb() (colorsys モジュール):    colorsys --- 色体系間の変換.
                                                             (line   32)
* yview() (tkinter.ttk.Treeview のメソッド): ttk Treeview.   (line  322)
* Z_BEST_COMPRESSION (zlib モジュール):  zlib --- gzip 互換の圧縮.
                                                             (line  328)
* Z_BEST_SPEED (zlib モジュール):        zlib --- gzip 互換の圧縮.
                                                             (line  324)
* Z_BLOCK (zlib モジュール):             zlib --- gzip 互換の圧縮.
                                                             (line  394)
* Z_DEFAULT_COMPRESSION (zlib モジュール): zlib --- gzip 互換の圧縮.
                                                             (line  332)
* Z_DEFAULT_STRATEGY (zlib モジュール):  zlib --- gzip 互換の圧縮.
                                                             (line  337)
* Z_FILTERED (zlib モジュール):          zlib --- gzip 互換の圧縮.
                                                             (line  341)
* Z_FINISH (zlib モジュール):            zlib --- gzip 互換の圧縮.
                                                             (line  389)
* Z_FIXED (zlib モジュール):             zlib --- gzip 互換の圧縮.
                                                             (line  359)
* Z_FULL_FLUSH (zlib モジュール):        zlib --- gzip 互換の圧縮.
                                                             (line  384)
* Z_HUFFMAN_ONLY (zlib モジュール):      zlib --- gzip 互換の圧縮.
                                                             (line  345)
* Z_NO_COMPRESSION (zlib モジュール):    zlib --- gzip 互換の圧縮.
                                                             (line  318)
* Z_NO_FLUSH (zlib モジュール):          zlib --- gzip 互換の圧縮.
                                                             (line  369)
* Z_PARTIAL_FLUSH (zlib モジュール):     zlib --- gzip 互換の圧縮.
                                                             (line  375)
* Z_RLE (zlib モジュール):               zlib --- gzip 互換の圧縮.
                                                             (line  349)
* Z_SYNC_FLUSH (zlib モジュール):        zlib --- gzip 互換の圧縮.
                                                             (line  379)
* Z_TREES (zlib モジュール):             zlib --- gzip 互換の圧縮.
                                                             (line  403)
* z;文字列のフォーマットで:              書式指定ミニ言語仕様.
                                                             (line   92)
* z85decode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line   99)
* z85encode() (base64 モジュール):       Base85 エンコーディング.
                                                             (line   91)
* Zen of Python:                         用語集<2>.          (line 1883)
* ZeroDivisionError:                     具象例外.           (line  484)
* zfill() (bytearray のメソッド):        bytes と bytearray の操作.
                                                             (line  753)
* zfill() (bytes のメソッド):            bytes と bytearray の操作.
                                                             (line  753)
* zfill() (str のメソッド):              文字列メソッド<2>.  (line  914)
* ZIP_BZIP2 (zipfile モジュール):        zipfile --- ZIP アーカイブの処理.
                                                             (line  114)
* ZIP_DEFLATED (zipfile モジュール):     zipfile --- ZIP アーカイブの処理.
                                                             (line  109)
* zip_longest() (itertools モジュール):  Itertool関数.       (line  654)
* ZIP_LZMA (zipfile モジュール):         zipfile --- ZIP アーカイブの処理.
                                                             (line  121)
* ZIP_STORED (zipfile モジュール):       zipfile --- ZIP アーカイブの処理.
                                                             (line  104)
* ZIP_ZSTANDARD (zipfile モジュール):    zipfile --- ZIP アーカイブの処理.
                                                             (line  128)
* zipapp コマンドラインオプション; -c:   コマンドラインインターフェイス<4>.
                                                             (line   46)
* zipapp コマンドラインオプション; -compress: コマンドラインインターフェイス<4>.
                                                             (line   46)
* zipapp コマンドラインオプション; -h:   コマンドラインインターフェイス<4>.
                                                             (line   62)
* zipapp コマンドラインオプション; -help: コマンドラインインターフェイス<4>.
                                                             (line   62)
* zipapp コマンドラインオプション; -info: コマンドラインインターフェイス<4>.
                                                             (line   56)
* zipapp コマンドラインオプション; -m:   コマンドラインインターフェイス<4>.
                                                             (line   35)
* zipapp コマンドラインオプション; -main: コマンドラインインターフェイス<4>.
                                                             (line   35)
* zipapp コマンドラインオプション; -o:   コマンドラインインターフェイス<4>.
                                                             (line   17)
* zipapp コマンドラインオプション; -output: コマンドラインインターフェイス<4>.
                                                             (line   17)
* zipapp コマンドラインオプション; -p:   コマンドラインインターフェイス<4>.
                                                             (line   29)
* zipapp コマンドラインオプション; -python: コマンドラインインターフェイス<4>.
                                                             (line   29)
* ZipFile (zipfile のクラス):            ZipFile objects.    (line    6)
* zipfile コマンドラインオプション; -c:  コマンドラインオプション<2>.
                                                             (line   11)
* zipfile コマンドラインオプション; -create: コマンドラインオプション<2>.
                                                             (line   11)
* zipfile コマンドラインオプション; -e:  コマンドラインオプション<2>.
                                                             (line   16)
* zipfile コマンドラインオプション; -extract: コマンドラインオプション<2>.
                                                             (line   16)
* zipfile コマンドラインオプション; -l:  コマンドラインオプション<2>.
                                                             (line    6)
* zipfile コマンドラインオプション; -list: コマンドラインオプション<2>.
                                                             (line    6)
* zipfile コマンドラインオプション; -metadata-encoding: コマンドラインオプション<2>.
                                                             (line   26)
* zipfile コマンドラインオプション; -t:  コマンドラインオプション<2>.
                                                             (line   21)
* zipfile コマンドラインオプション; -test: コマンドラインオプション<2>.
                                                             (line   21)
* zipimporter (zipimport のクラス):      zipimporter オブジェクト.
                                                             (line    8)
* ZipImportError:                        zipimport --- Zip アーカイブからモジュールをインポートする.
                                                             (line   58)
* ZipInfo (zipfile のクラス):            zipfile --- ZIP アーカイブの処理.
                                                             (line   67)
* ZLIB_RUNTIME_VERSION (zlib モジュール): zlib --- gzip 互換の圧縮.
                                                             (line  422)
* ZLIB_VERSION (zlib モジュール):        zlib --- gzip 互換の圧縮.
                                                             (line  415)
* ZLIBNG_VERSION (zlib モジュール):      zlib --- gzip 互換の圧縮.
                                                             (line  429)
* ZoneInfo (zoneinfo のクラス):          ZoneInfo クラス.    (line    6)
* ZoneInfoNotFoundError:                 例外と警告.         (line    6)
* zscore() (statistics.NormalDist のメソッド): NormalDist オブジェクト.
                                                             (line  120)
* zstd_version_info (compression.zstd モジュール): その他<3>.
                                                             (line   32)
* ZstdCompressor (compression.zstd のクラス): メモリ上での圧縮と展開.
                                                             (line   50)
* ZstdDecompressor (compression.zstd のクラス): メモリ上での圧縮と展開.
                                                             (line  157)
* ZstdDict (compression.zstd のクラス):  Zstandard dictionaries.
                                                             (line   53)
* ZstdError:                             例外<8>.            (line    6)
* ZstdFile (compression.zstd のクラス):  圧縮ファイルへの読み書き.
                                                             (line   49)
* イテレータプロトコル:                  イテレータ型.       (line    6)
* イベントスケジューリング:              sched --- イベントスケジューラー.
                                                             (line    8)
* インタプリタ:                          トップレベル要素.   (line    6)
* インデックス操作:                      シーケンス型 sequence.
                                                             (line    6)
* インデント:                            インデント.         (line    6)
* エスケープシーケンス:                  Formal grammar.     (line   28)
* エポック:                              time --- 時刻データへのアクセスと変換.
                                                             (line   20)
* エポックからの秒数:                    time --- 時刻データへのアクセスと変換.
                                                             (line   24)
* エラー:                                例外<2>.            (line    6)
* エラー;logging:                        logging --- Python 用のログ記録手段.
                                                             (line    8)
* エラー処理:                            例外<2>.            (line    6)
* オブジェクト;Capsule:                  カプセル<2>.        (line    6)
* オブジェクト;None:                     None オブジェクト.  (line    6)
* オブジェクト;コード:                   セルオブジェクト cell object.
                                                             (line   58)
* オブジェクト;比較する:                 比較<2>.            (line   42)
* オブジェクトの値:                      オブジェクト、値、および型.
                                                             (line   10)
* オブジェクトの同一性:                  オブジェクト、値、および型.
                                                             (line   10)
* オブジェクトの型:                      オブジェクト、値、および型.
                                                             (line   10)
* カンマ:                                丸括弧形式 parenthesized form.
                                                             (line   19)
* キー:                                  辞書表示.           (line    6)
* キー <1>:                              用語集<2>.          (line  971)
* キーワード:                            キーワード keyword. (line    6)
* キーワード <1>:                        ソフトキーワード.   (line    6)
* キーワード;as:                         import 文.          (line    6)
* キーワード;as <1>:                     try 文.             (line    6)
* キーワード;as <2>:                     with 文.            (line    6)
* キーワード;as <3>:                     match 文<2>.        (line    6)
* キーワード;async:                      コルーチン関数定義. (line    9)
* キーワード;await:                      呼び出し call.      (line  156)
* キーワード;await <1>:                  コルーチン関数定義. (line    9)
* キーワード;case:                       match 文<2>.        (line    6)
* キーワード;elif:                       if 文<2>.           (line    6)
* キーワード;else:                       break 文.           (line   12)
* キーワード;else <1>:                   if 文<2>.           (line    6)
* キーワード;else <2>:                   while 文.           (line    6)
* キーワード;else <3>:                   for 文<2>.          (line    6)
* キーワード;else <4>:                   try 文.             (line    6)
* キーワード;else <5>:                   except* 節.         (line   66)
* キーワード;except:                     try 文.             (line    6)
* キーワード;except_star:                except 節.          (line   80)
* キーワード;finally:                    return 文.          (line   17)
* キーワード;finally <1>:                break 文.           (line   18)
* キーワード;finally <2>:                continue 文.        (line    6)
* キーワード;finally <3>:                try 文.             (line    6)
* キーワード;finally <4>:                else 節.            (line   11)
* キーワード;from:                       Yield 式.           (line    6)
* キーワード;from <1>:                   import 文.          (line    6)
* キーワード;if:                         match 文<2>.        (line    6)
* キーワード;in:                         for 文<2>.          (line    6)
* キーワード;yield:                      Yield 式.           (line    6)
* クラス:                                用語集<2>.          (line  272)
* クラス;body:                           クラス本体の実行.   (line    6)
* クラス;definition:                     return 文.          (line    6)
* クラス;definition <1>:                 クラス定義.         (line    6)
* クラス;instance:                       クラスインスタンス class instance.
                                                             (line    6)
* クラス;name:                           クラス定義.         (line    6)
* クラス;コンストラクタ:                 基本的なカスタマイズ.
                                                             (line   37)
* クラス;属性:                           カスタムクラス型.   (line   19)
* クラス;属性;代入:                      カスタムクラス型.   (line   28)
* クラスインスタンス;call:               呼び出し call.      (line  148)
* クラスインスタンス;属性:               クラスインスタンス class instance.
                                                             (line    6)
* クラスインスタンス;属性;代入:          クラスインスタンス class instance.
                                                             (line   21)
* クラスオブジェクト;call:               カスタムクラス型.   (line   19)
* クラスオブジェクト;call <1>:           カスタムクラス型.   (line   31)
* クラスオブジェクト;call <2>:           呼び出し call.      (line  144)
* グラフィカルユーザインターフェース:    Graphical user interfaces with Tk.
                                                             (line    6)
* グリニッジ標準時:                      time --- 時刻データへのアクセスと変換.
                                                             (line   39)
* グループ化:                            インデント.         (line    6)
* グローバル;name;束縛:                  global 文.          (line    6)
* グローバル;namespace:                  Special read-only attributes.
                                                             (line    6)
* コード;ブロック:                       実行モデル.         (line    6)
* コードオブジェクト:                    コードオブジェクト. (line    6)
* コードオブジェクト <1>:                メソッド.           (line   43)
* コードオブジェクト <2>:                marshal --- 内部使用向けの Python オブジェクト直列化.
                                                             (line   36)
* コードオブジェクト <3>:                セルオブジェクト cell object.
                                                             (line   57)
* コマンドライン:                        完全な Python プログラム.
                                                             (line   24)
* コマンドラインオプション; -?:          一般オプション.     (line    6)
* コマンドラインオプション; -b:          その他のオプション. (line    6)
* コマンドラインオプション; -B:          その他のオプション. (line   16)
* コマンドラインオプション; -build:      クロスコンパイルのオプション.
                                                             (line   12)
* コマンドラインオプション; -c:          インターフェイスオプション.
                                                             (line   35)
* コマンドラインオプション; -check-hash-based-pycs: その他のオプション.
                                                             (line   22)
* コマンドラインオプション; -d:          その他のオプション. (line   36)
* コマンドラインオプション; -disable-gil: 一般的なオプション.
                                                             (line  222)
* コマンドラインオプション; -disable-ipv6: 一般的なオプション.
                                                             (line   17)
* コマンドラインオプション; -disable-safety: Security Options.
                                                             (line   57)
* コマンドラインオプション; -disable-test-modules: インストールオプション.
                                                             (line   25)
* コマンドラインオプション; -E:          その他のオプション. (line   44)
* コマンドラインオプション; -enable-big-digits: 一般的なオプション.
                                                             (line   22)
* コマンドラインオプション; -enable-bolt: パフォーマンスに関するオプション.
                                                             (line   62)
* コマンドラインオプション; -enable-experimental-jit: 一般的なオプション.
                                                             (line  234)
* コマンドラインオプション; -enable-framework: macOS のオプション.
                                                             (line   16)
* コマンドラインオプション; -enable-framework <1>: macOS のオプション.
                                                             (line   18)
* コマンドラインオプション; -enable-framework <2>: iOS のオプション.
                                                             (line    8)
* コマンドラインオプション; -enable-loadable-sqlite-extensions: 一般的なオプション.
                                                             (line    6)
* コマンドラインオプション; -enable-optimizations: パフォーマンスに関するオプション.
                                                             (line   10)
* コマンドラインオプション; -enable-profiling: パフォーマンスに関するオプション.
                                                             (line  138)
* コマンドラインオプション; -enable-pystats: 一般的なオプション.
                                                             (line  128)
* コマンドラインオプション; -enable-shared: リンカのオプション<2>.
                                                             (line    6)
* コマンドラインオプション; -enable-slower-safety: Security Options.
                                                             (line   76)
* コマンドラインオプション; -enable-universalsdk: macOS のオプション.
                                                             (line    8)
* コマンドラインオプション; -enable-universalsdk <1>: macOS のオプション.
                                                             (line   10)
* コマンドラインオプション; -enable-wasm-dynamic-linking: WebAssembly オプション.
                                                             (line    6)
* コマンドラインオプション; -enable-wasm-pthreads: WebAssembly オプション.
                                                             (line   16)
* コマンドラインオプション; -exec-prefix: インストールオプション.
                                                             (line   17)
* コマンドラインオプション; -h:          一般オプション.     (line    6)
* コマンドラインオプション; -help:       一般オプション.     (line    6)
* コマンドラインオプション; -help-all:   一般オプション.     (line   27)
* コマンドラインオプション; -help-env:   一般オプション.     (line   13)
* コマンドラインオプション; -help-xoptions: 一般オプション.  (line   20)
* コマンドラインオプション; -host:       クロスコンパイルのオプション.
                                                             (line   17)
* コマンドラインオプション; -i:          その他のオプション. (line   51)
* コマンドラインオプション; -I:          その他のオプション. (line   72)
* コマンドラインオプション; -m:          インターフェイスオプション.
                                                             (line   52)
* コマンドラインオプション; -O:          その他のオプション. (line   84)
* コマンドラインオプション; -OO:         その他のオプション. (line   94)
* コマンドラインオプション; -P:          その他のオプション. (line  103)
* コマンドラインオプション; -prefix:     インストールオプション.
                                                             (line    6)
* コマンドラインオプション; -q:          その他のオプション. (line  122)
* コマンドラインオプション; -R:          その他のオプション. (line  129)
* コマンドラインオプション; -s:          その他のオプション. (line  155)
* コマンドラインオプション; -S:          その他のオプション. (line  167)
* コマンドラインオプション; -u:          その他のオプション. (line  175)
* コマンドラインオプション; -V:          一般オプション.     (line   33)
* コマンドラインオプション; -v:          その他のオプション. (line  185)
* コマンドラインオプション; -version:    一般オプション.     (line   33)
* コマンドラインオプション; -W:          その他のオプション. (line  198)
* コマンドラインオプション; -with-address-sanitizer: Debug options.
                                                             (line   59)
* コマンドラインオプション; -with-app-store-compliance: macOS のオプション.
                                                             (line   58)
* コマンドラインオプション; -with-app-store-compliance <1>: macOS のオプション.
                                                             (line   60)
* コマンドラインオプション; -with-assertions: Debug options. (line   34)
* コマンドラインオプション; -with-build-python: クロスコンパイルのオプション.
                                                             (line   22)
* コマンドラインオプション; -with-builtin-hashlib-hashes: Security Options.
                                                             (line   21)
* コマンドラインオプション; -with-computed-gotos: パフォーマンスに関するオプション.
                                                             (line   99)
* コマンドラインオプション; -with-dbmliborder: 一般的なオプション.
                                                             (line   69)
* コマンドラインオプション; -with-dtrace: Debug options.     (line   51)
* コマンドラインオプション; -with-ensurepip: インストールオプション.
                                                             (line   33)
* コマンドラインオプション; -with-framework-name: macOS のオプション.
                                                             (line   52)
* コマンドラインオプション; -with-framework-name <1>: iOS のオプション.
                                                             (line   13)
* コマンドラインオプション; -with-hash-algorithm: Security Options.
                                                             (line    6)
* コマンドラインオプション; -with-libc:  Libraries options.  (line   64)
* コマンドラインオプション; -with-libm:  Libraries options.  (line   59)
* コマンドラインオプション; -with-libs:  Libraries options.  (line    6)
* コマンドラインオプション; -with-lto:   パフォーマンスに関するオプション.
                                                             (line   46)
* コマンドラインオプション; -with-memory-sanitizer: Debug options.
                                                             (line   69)
* コマンドラインオプション; -with-openssl: Libraries options.
                                                             (line   69)
* コマンドラインオプション; -with-openssl-rpath: Libraries options.
                                                             (line   75)
* コマンドラインオプション; -with-pkg-config: 一般的なオプション.
                                                             (line  115)
* コマンドラインオプション; -with-platlibdir: 一般的なオプション.
                                                             (line   92)
* コマンドラインオプション; -with-pydebug: Debug options.    (line    6)
* コマンドラインオプション; -with-readline: Libraries options.
                                                             (line   41)
* コマンドラインオプション; -with-ssl-default-suites: Security Options.
                                                             (line   40)
* コマンドラインオプション; -with-strict-overflow: パフォーマンスに関するオプション.
                                                             (line  142)
* コマンドラインオプション; -with-suffix: 一般的なオプション.
                                                             (line   33)
* コマンドラインオプション; -with-system-expat: Libraries options.
                                                             (line   10)
* コマンドラインオプション; -with-system-libmpdec: Libraries options.
                                                             (line   15)
* コマンドラインオプション; -with-tail-call-interp: パフォーマンスに関するオプション.
                                                             (line  104)
* コマンドラインオプション; -with-thread-sanitizer: Debug options.
                                                             (line   83)
* コマンドラインオプション; -with-trace-refs: Debug options. (line   11)
* コマンドラインオプション; -with-tzpath: 一般的なオプション.
                                                             (line   45)
* コマンドラインオプション; -with-undefined-behavior-sanitizer: Debug options.
                                                             (line   76)
* コマンドラインオプション; -with-universal-archs: macOS のオプション.
                                                             (line   24)
* コマンドラインオプション; -with-valgrind: Debug options.   (line   47)
* コマンドラインオプション; -with-wheel-pkg-dir: 一般的なオプション.
                                                             (line  102)
* コマンドラインオプション; -without-c-locale-coercion: 一般的なオプション.
                                                             (line   82)
* コマンドラインオプション; -without-decimal-contextvar: 一般的なオプション.
                                                             (line   58)
* コマンドラインオプション; -without-doc-strings: パフォーマンスに関するオプション.
                                                             (line  128)
* コマンドラインオプション; -without-mimalloc: パフォーマンスに関するオプション.
                                                             (line  114)
* コマンドラインオプション; -without-pymalloc: パフォーマンスに関するオプション.
                                                             (line  121)
* コマンドラインオプション; -without-readline: Libraries options.
                                                             (line   51)
* コマンドラインオプション; -without-remote-debug: パフォーマンスに関するオプション.
                                                             (line  147)
* コマンドラインオプション; -without-static-libpython: リンカのオプション<2>.
                                                             (line   11)
* コマンドラインオプション; -x:          その他のオプション. (line  259)
* コマンドラインオプション; -X:          その他のオプション. (line  264)
* コマンドラインオプション; BOLT_APPLY_FLAGS: パフォーマンスに関するオプション.
                                                             (line   87)
* コマンドラインオプション; BOLT_INSTRUMENT_FLAGS: パフォーマンスに関するオプション.
                                                             (line   93)
* コマンドラインオプション; BZIP2_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line    8)
* コマンドラインオプション; BZIP2_LIBS:  サードパーティ依存関係のオプション.
                                                             (line   10)
* コマンドラインオプション; CC:          C コンパイラのオプション.
                                                             (line    6)
* コマンドラインオプション; CFLAGS:      C コンパイラのオプション.
                                                             (line   10)
* コマンドラインオプション; CONFIG_SITE: クロスコンパイルのオプション.
                                                             (line   28)
* コマンドラインオプション; CPP:         C コンパイラのオプション.
                                                             (line   14)
* コマンドラインオプション; CPPFLAGS:    C コンパイラのオプション.
                                                             (line   18)
* コマンドラインオプション; CURSES_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   15)
* コマンドラインオプション; CURSES_LIBS: サードパーティ依存関係のオプション.
                                                             (line   17)
* コマンドラインオプション; GDBM_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   22)
* コマンドラインオプション; GDBM_LIBS:   サードパーティ依存関係のオプション.
                                                             (line   24)
* コマンドラインオプション; HOSTRUNNER:  クロスコンパイルのオプション.
                                                             (line   39)
* コマンドラインオプション; LDFLAGS:     リンカのオプション. (line    6)
* コマンドラインオプション; LIBEDIT_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   28)
* コマンドラインオプション; LIBEDIT_LIBS: サードパーティ依存関係のオプション.
                                                             (line   30)
* コマンドラインオプション; LIBFFI_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   35)
* コマンドラインオプション; LIBFFI_LIBS: サードパーティ依存関係のオプション.
                                                             (line   37)
* コマンドラインオプション; LIBLZMA_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   52)
* コマンドラインオプション; LIBLZMA_LIBS: サードパーティ依存関係のオプション.
                                                             (line   54)
* コマンドラインオプション; LIBMPDEC_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   42)
* コマンドラインオプション; LIBMPDEC_LIBS: サードパーティ依存関係のオプション.
                                                             (line   44)
* コマンドラインオプション; LIBREADLINE_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   59)
* コマンドラインオプション; LIBREADLINE_LIBS: サードパーティ依存関係のオプション.
                                                             (line   61)
* コマンドラインオプション; LIBS:        リンカのオプション. (line   10)
* コマンドラインオプション; LIBSQLITE3_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   66)
* コマンドラインオプション; LIBSQLITE3_LIBS: サードパーティ依存関係のオプション.
                                                             (line   68)
* コマンドラインオプション; LIBUUID_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   73)
* コマンドラインオプション; LIBUUID_LIBS: サードパーティ依存関係のオプション.
                                                             (line   75)
* コマンドラインオプション; LIBZSTD_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   80)
* コマンドラインオプション; LIBZSTD_LIBS: サードパーティ依存関係のオプション.
                                                             (line   82)
* コマンドラインオプション; MACHDEP:     リンカのオプション. (line   14)
* コマンドラインオプション; PANEL_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   89)
* コマンドラインオプション; PANEL_LIBS:  サードパーティ依存関係のオプション.
                                                             (line   91)
* コマンドラインオプション; PKG_CONFIG:  一般的なオプション. (line  263)
* コマンドラインオプション; PKG_CONFIG_LIBDIR: 一般的なオプション.
                                                             (line  267)
* コマンドラインオプション; PKG_CONFIG_PATH: 一般的なオプション.
                                                             (line  269)
* コマンドラインオプション; TCLTK_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line   98)
* コマンドラインオプション; TCLTK_LIBS:  サードパーティ依存関係のオプション.
                                                             (line  100)
* コマンドラインオプション; ZLIB_CFLAGS: サードパーティ依存関係のオプション.
                                                             (line  104)
* コマンドラインオプション; ZLIB_LIBS:   サードパーティ依存関係のオプション.
                                                             (line  106)
* コメント:                              コメント Comments.  (line    6)
* コルーチン:                            特殊メソッド検索.   (line   72)
* コルーチン <1>:                        Yield 式.           (line   51)
* コルーチン <2>:                        用語集<2>.          (line  385)
* コルーチン;関数:                       コルーチン関数 coroutine function.
                                                             (line    6)
* コンテキスト管理プロトコル:            コンテキストマネージャ型.
                                                             (line    6)
* コンテキスト管理プロトコル <1>:        用語集<2>.          (line  357)
* コンテナ:                              オブジェクト、値、および型.
                                                             (line   65)
* コンテナ <1>:                          カスタムクラス型.   (line   19)
* コンテナ;での反復:                     イテレータ型.       (line    6)
* サブクラス化;変更不能な型:             基本的なカスタマイズ.
                                                             (line    8)
* ジェネレータ:                          用語集<2>.          (line  714)
* ジェネレータ <1>:                      用語集<2>.          (line  714)
* ジェネレータ;expression:               ジェネレータ式<2>.  (line    6)
* ジェネレータ;iterator:                 ジェネレータ関数 generator function.
                                                             (line    6)
* ジェネレータ;iterator <1>:             yield 文.           (line    6)
* ジェネレータ;関数:                     ジェネレータ関数 generator function.
                                                             (line    6)
* ジェネレータ;関数 <1>:                 Yield 式.           (line    6)
* ジェネレータ;関数 <2>:                 yield 文.           (line    6)
* シフト;操作:                           整数型におけるビット単位演算.
                                                             (line    6)
* シフト;演算:                           シフト演算 shifting operation.
                                                             (line    6)
* スコープ:                              名前づけと束縛 naming and binding.
                                                             (line    6)
* スコープ <1>:                          名前解決.           (line    6)
* スタック;トレース:                     トレースバック traceback オブジェクト.
                                                             (line    6)
* スタック可能;ストリーム:               codecs --- codec レジストリと基底クラス.
                                                             (line    8)
* ストリーム:                            codecs --- codec レジストリと基底クラス.
                                                             (line    8)
* スライス:                              シーケンス型 sequence.
                                                             (line   18)
* スライス <1>:                          変更可能なシーケンス型 mutable sequence.
                                                             (line    6)
* スライス <2>:                          Subscriptions and slicings.
                                                             (line   70)
* スライス;代入:                         代入文 assignment statement.
                                                             (line  124)
* ソースコード文字セット:                エンコード宣言 encoding declaration.
                                                             (line    6)
* タブ:                                  インデント.         (line    6)
* チェックサム;CRC:                      zlib --- gzip 互換の圧縮.
                                                             (line  122)
* データ:                                オブジェクト、値、および型.
                                                             (line    6)
* データ;type:                           標準型の階層.       (line    6)
* データ;表形式:                         csv --- CSV ファイルの読み書き.
                                                             (line    8)
* データベース:                          dbm dumb --- Portable DBM implementation.
                                                             (line    8)
* ディレクトリ;トラバース:               ファイルとディレクトリ.
                                                             (line 1677)
* ディレクトリ;トラバース <1>:           ファイルとディレクトリ.
                                                             (line 1779)
* ディレクトリ;作成:                     ファイルとディレクトリ.
                                                             (line  559)
* ディレクトリ;削除:                     ディレクトリとファイルの操作.
                                                             (line  283)
* ディレクトリ;削除 <1>:                 ファイルとディレクトリ.
                                                             (line  751)
* ディレクトリ;変更:                     ファイルとディレクトリ.
                                                             (line  120)
* ディレクトリ;走査:                     ファイルとディレクトリ.
                                                             (line 1677)
* ディレクトリ;走査 <1>:                 ファイルとディレクトリ.
                                                             (line 1779)
* デストラクタ:                          基本的なカスタマイズ.
                                                             (line   53)
* デストラクタ <1>:                      代入文 assignment statement.
                                                             (line   70)
* デバッグ:                              pdb --- The Python Debugger.
                                                             (line    8)
* デバッグ;assertions:                   assert 文.          (line    6)
* デリミタ:                              Operators and delimiters.
                                                             (line    6)
* テンポラリ;ファイル:                   tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line    8)
* テンポラリ;ファイル名:                 tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line    8)
* トークン:                              字句解析.           (line    6)
* トークン <1>:                          用語集<2>.          (line 1769)
* ドキュメント文字列:                    Special read-only attributes<2>.
                                                             (line  104)
* バイト:                                変更不能なシーケンス immutable sequence.
                                                             (line   45)
* バイト列リテラル:                      リテラル.           (line   15)
* バイナリモード:                        組み込み関数.       (line 1466)
* パス;操作:                             pathlib --- オブジェクト指向のファイルシステムパス.
                                                             (line   10)
* パス;操作 <1>:                         os path --- 一般的なパス名操作.
                                                             (line    9)
* パス;設定;ファイル:                    site --- サイト固有の設定フック.
                                                             (line   76)
* パック;2進数;データ:                   struct --- バイト列をパックされたバイナリデータとして解釈する.
                                                             (line    8)
* バックスラッシュ文字:                  明示的な行継続.     (line    6)
* ハッシュ文字:                          コメント Comments.  (line    6)
* ビットマスク;操作:                     整数型におけるビット単位演算.
                                                             (line    6)
* ビット単位;and:                        ビット単位演算の二項演算 binary bitwise operation.
                                                             (line   12)
* ビット単位;or:                         ビット単位演算の二項演算 binary bitwise operation.
                                                             (line   20)
* ビット単位;xor:                        ビット単位演算の二項演算 binary bitwise operation.
                                                             (line   16)
* ビット単位;操作:                       整数型におけるビット単位演算.
                                                             (line    6)
* ファイル;large files:                  ラージファイルのサポート.
                                                             (line    6)
* ファイル;mime.types:                   mimetypes --- ファイル名を MIME タイプへマップする.
                                                             (line  142)
* ファイル;modes:                        組み込み関数.       (line 1294)
* ファイル;コピー:                       shutil --- 高水準のファイル操作.
                                                             (line    8)
* ファイル;バイトコード:                 py_compile --- Python ソースファイルをコンパイルする.
                                                             (line    8)
* ファイルのコピー:                      shutil --- 高水準のファイル操作.
                                                             (line    8)
* プライベートな;名前:                   識別子 identifier、または名前 name.
                                                             (line   15)
* プライマリ:                            プライマリ.         (line    6)
* プラス:                                単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
                                                             (line   14)
* プログラム:                            完全な Python プログラム.
                                                             (line    6)
* プロセッサー時間:                      関数<5>.            (line  247)
* プロセッサー時間 <1>:                  関数<5>.            (line  612)
* ブロック:                              プログラムの構造.   (line    6)
* プロトコル;iterator:                   イテレータ型.       (line    6)
* プロトコル;コンテキスト管理:           コンテキストマネージャ型.
                                                             (line    6)
* ベンチマーク:                          関数<5>.            (line  216)
* ベンチマーク <1>:                      関数<5>.            (line  247)
* ベンチマーク <2>:                      関数<5>.            (line  612)
* ベンチマーク <3>:                      timeit --- 小さなコードスニペットの実行時間計測.
                                                             (line    8)
* マイナス:                              単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
                                                             (line   10)
* メソッド:                              用語集<2>.          (line 1134)
* メソッド;call:                         呼び出し call.      (line  139)
* モジュロ:                              二項算術演算 binary arithmetic operation.
                                                             (line   50)
* ユーザー;id:                           プロセスのパラメーター.
                                                             (line  353)
* ユーザー;ID、設定:                     プロセスのパラメーター.
                                                             (line  548)
* ユーザー;実効 ID:                      プロセスのパラメーター.
                                                             (line  208)
* ユーザ定義の;メソッド:                 インスタンスメソッド.
                                                             (line    6)
* ユーザ定義の;関数:                     ユーザ定義関数 user-defined function.
                                                             (line    6)
* ユーザ定義の;関数;call:                呼び出し call.      (line  128)
* リテラル:                              リテラル.           (line    6)
* リテラル <1>:                          リテラル<2>.        (line    6)
* ロケールエンコーディング:              用語集<2>.          (line 1082)
* 三項;operator:                         条件式 Conditional Expressions.
                                                             (line    6)
* 丸括弧形式:                            丸括弧形式 parenthesized form.
                                                             (line    6)
* 乗算:                                  二項算術演算 binary arithmetic operation.
                                                             (line   16)
* 予約語:                                キーワード keyword. (line    6)
* 代入;expression:                       ブール演算 boolean operation.
                                                             (line   33)
* 代入;statement:                        変更可能なシーケンス型 mutable sequence.
                                                             (line    6)
* 代入;statement <1>:                    代入文 assignment statement.
                                                             (line    6)
* 位置引数 (positional argument):        用語集<2>.          (line 1434)
* 例外:                                  例外<2>.            (line    6)
* 例外 <1>:                              raise 文.           (line    6)
* 例外;AssertionError:                   assert 文.          (line   22)
* 例外;AttributeError:                   属性参照.           (line   10)
* 例外;GeneratorExit:                    ジェネレータ-イテレータメソッド.
                                                             (line   63)
* 例外;GeneratorExit <1>:                非同期ジェネレータイテレータメソッド.
                                                             (line   60)
* 例外;ImportError:                      import 文.          (line    6)
* 例外;NameError:                        識別子 identifier、または名前 name.
                                                             (line   11)
* 例外;StopAsyncIteration:               非同期ジェネレータイテレータメソッド.
                                                             (line    9)
* 例外;StopIteration:                    ジェネレータ-イテレータメソッド.
                                                             (line   12)
* 例外;StopIteration <1>:                yield 文.           (line    6)
* 例外;TypeError:                        単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
                                                             (line   23)
* 例外;ValueError:                       シフト演算 shifting operation.
                                                             (line   19)
* 例外;ZeroDivisionError:                二項算術演算 binary arithmetic operation.
                                                             (line   37)
* 例外;ハンドラ:                         トレースバック traceback オブジェクト.
                                                             (line    6)
* 例外;連鎖:                             raise 文.           (line   30)
* 例外;連鎖 <1>:                         例外コンテキスト.   (line    6)
* 例外ハンドラ:                          例外<2>.            (line    6)
* 例外を扱う:                            例外<2>.            (line    6)
* 例外を送出する:                        例外<2>.            (line    6)
* 先頭の空白:                            インデント.         (line    6)
* 入力:                                  式入力.             (line    6)
* 内包表記:                              リスト、集合、辞書の表示.
                                                             (line    6)
* 内部型:                                内部型 internal type.
                                                             (line    6)
* 凍結ユーティリティ:                    モジュールのインポート<2>.
                                                             (line  273)
* 到達不能オブジェクト:                  オブジェクト、値、および型.
                                                             (line   35)
* 制限;実行:                             組み込みと制限付きの実行.
                                                             (line    6)
* 加算:                                  二項算術演算 binary arithmetic operation.
                                                             (line   77)
* 包含的;or:                             ビット単位演算の二項演算 binary bitwise operation.
                                                             (line   20)
* 協定世界時:                            time --- 時刻データへのアクセスと変換.
                                                             (line   39)
* 単一要素の;tuple:                      変更不能なシーケンス immutable sequence.
                                                             (line   35)
* 単項;ビット単位;演算:                  単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
                                                             (line    6)
* 単項;算術;演算:                        単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
                                                             (line    6)
* 参照カウント:                          オブジェクト、値、および型.
                                                             (line   35)
* 反転:                                  単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
                                                             (line   18)
* 同一性;テスト:                         所属検査演算.       (line   39)
* 否定:                                  単項算術演算とビット単位演算 unary arithmetic and bitwise operation.
                                                             (line   10)
* 型, 内部の:                            内部型 internal type.
                                                             (line    6)
* 変更不可能なオブジェクト:              オブジェクト、値、および型.
                                                             (line   10)
* 変更可能なオブジェクト:                オブジェクト、値、および型.
                                                             (line   10)
* 変更可能なシーケンス;loop over:        共通のシーケンス演算.
                                                             (line   61)
* 夏時間:                                time --- 時刻データへのアクセスと変換.
                                                             (line   45)
* 外部データ表現:                        データストリームの形式.
                                                             (line    6)
* 字句解析:                              本マニュアルにおける表記法.
                                                             (line  107)
* 字句解析 <1>:                          字句解析.           (line    6)
* 定数:                                  リテラル.           (line    6)
* 実行;スタック:                         トレースバック traceback オブジェクト.
                                                             (line    6)
* 実行;フレーム:                         プログラムの構造.   (line   18)
* 実行;フレーム <1>:                     クラス定義.         (line    6)
* 実行モデル:                            実行モデル.         (line    6)
* 実行文のグループ化:                    インデント.         (line    6)
* 対話モード:                            完全な Python プログラム.
                                                             (line   18)
* 属性:                                  標準型の階層.       (line   12)
* 属性 <1>:                              用語集<2>.          (line  174)
* 属性;deletion:                         del 文<2>.          (line   20)
* 属性;代入:                             代入文 assignment statement.
                                                             (line    6)
* 属性;代入 <1>:                         代入文 assignment statement.
                                                             (line   76)
* 属性;参照:                             属性参照.           (line    6)
* 帰属;テスト:                           所属検査演算.       (line   36)
* 平坦化;オブジェクト:                   pickle --- Python オブジェクトの直列化.
                                                             (line    8)
* 引数 (argument):                       用語集<2>.          (line   58)
* 引数 (argument);call の意味付け:       Formal subscription grammar.
                                                             (line   16)
* 引数 (argument);difference from parameter: オプションパラメータやキーワードパラメータを関数から関数へ渡すにはどうしたらいいですか？.
                                                             (line   17)
* 引数 (argument);function definition:   関数定義.           (line   67)
* 性能:                                  timeit --- 小さなコードスニペットの実行時間計測.
                                                             (line    8)
* 拡張;module:                           標準型の階層.       (line    6)
* 排他的;or:                             ビット単位演算の二項演算 binary bitwise operation.
                                                             (line   16)
* 数値;リテラル:                         数値型 int float complex.
                                                             (line   17)
* 数値;変換:                             数値型 int float complex.
                                                             (line  115)
* 数値リテラル:                          数値リテラル.       (line    6)
* 整列化;オブジェクト:                   pickle --- Python オブジェクトの直列化.
                                                             (line    8)
* 整数;リテラル:                         数値型 int float complex.
                                                             (line   17)
* 整数;表現:                             numbers Integral 整数.
                                                             (line    9)
* 整数リテラル:                          数値リテラル.       (line    6)
* 文字(str型):                           変更不能なシーケンス immutable sequence.
                                                             (line   16)
* 文字(str型) <1>:                       unicodedata --- Unicode データベース.
                                                             (line    6)
* 文字列リテラル:                        リテラル.           (line   15)
* 文法:                                  本マニュアルにおける表記法.
                                                             (line    6)
* 書式化, 文字列 (%):                    printf 形式の文字列書式化.
                                                             (line    6)
* 書式化;bytearray (%):                  printf 形式での bytes の書式化.
                                                             (line    6)
* 書式化;bytes (%):                      printf 形式での bytes の書式化.
                                                             (line    6)
* 末尾の;カンマ:                         式のリスト.         (line   28)
* 束縛;name:                             名前の束縛.         (line    6)
* 束縛;name <1>:                         代入文 assignment statement.
                                                             (line    6)
* 条件;expression:                       ブール演算 boolean operation.
                                                             (line    6)
* 条件;expression <1>:                   条件式 Conditional Expressions.
                                                             (line    6)
* 構文:                                  本マニュアルにおける表記法.
                                                             (line    6)
* 標準 C:                                Formal grammar.     (line   28)
* 標準入力:                              完全な Python プログラム.
                                                             (line   24)
* 比較:                                  基本的なカスタマイズ.
                                                             (line  182)
* 比較 <1>:                              比較.               (line    6)
* 永続オブジェクト (immortal):           用語集<2>.          (line  835)
* 永続化:                                pickle --- Python オブジェクトの直列化.
                                                             (line    8)
* 永続化;オブジェクト:                   pickle --- Python オブジェクトの直列化.
                                                             (line    8)
* 汎用;特殊;属性:                        標準型の階層.       (line   12)
* 注釈;type annotation; type hint:       型アノテーション型 --- ジェネリックエイリアス 、 ユニオン.
                                                             (line    6)
* 浮動小数点;number:                     numbers Real float 実数.
                                                             (line    6)
* 浮動小数点;リテラル:                   数値型 int float complex.
                                                             (line   17)
* 添字:                                  用語集<2>.          (line 1677)
* 添字;代入:                             ミュータブルなシーケンス型.
                                                             (line   16)
* 添字;演算:                             共通のシーケンス演算.
                                                             (line   18)
* 添字表記:                              シーケンス型 sequence.
                                                             (line    6)
* 添字表記 <1>:                          変更可能なシーケンス型 mutable sequence.
                                                             (line    6)
* 添字表記 <2>:                          マッピング型 mapping.
                                                             (line    6)
* 添字表記 <3>:                          Subscriptions and slicings.
                                                             (line    6)
* 添字表記;代入:                         代入文 assignment statement.
                                                             (line   98)
* 減算:                                  二項算術演算 binary arithmetic operation.
                                                             (line   89)
* 演算;dictionary;type:                  マッピング型 --- dict.
                                                             (line    6)
* 演算;list;type:                        ミュータブルなシーケンス型.
                                                             (line   16)
* 演算;mapping;types:                    マッピング型 --- dict.
                                                             (line    6)
* 演算;sequence;types:                   共通のシーケンス演算.
                                                             (line   18)
* 演算;sequence;types <1>:               ミュータブルなシーケンス型.
                                                             (line   16)
* 演算;数値;types:                       数値型 int float complex.
                                                             (line  102)
* 演算;整数;types:                       整数型におけるビット単位演算.
                                                             (line    6)
* 演算子:                                Operators and delimiters.
                                                             (line    6)
* 無名;関数:                             ラムダ lambda.      (line    6)
* 物理行:                                論理行 logical line.
                                                             (line    6)
* 物理行 <1>:                            明示的な行継続.     (line    6)
* 物理行 <2>:                            Formal grammar.     (line   28)
* 特殊;メソッド:                         用語集<2>.          (line 1630)
* 特殊;属性:                             標準型の階層.       (line   12)
* 環境:                                  名前解決.           (line   12)
* 環境;仮想:                             venv --- 仮想環境の作成.
                                                             (line   10)
* 環境変数; __PYVENV_LAUNCHER__:         PyConfig.           (line  186)
* 環境変数; __PYVENV_LAUNCHER__ <1>:     PyConfig.           (line  730)
* 環境変数; BASECFLAGS:                  Compiler flags.     (line   66)
* 環境変数; BASECPPFLAGS:                Preprocessor flags. (line   22)
* 環境変数; BLDSHARED:                   Linker flags.       (line   67)
* 環境変数; BROWSER:                     webbrowser.         (line    6)
* 環境変数; BROWSER <1>:                 webbrowser.         (line   10)
* 環境変数; BROWSER <2>:                 ライブラリ<24>.     (line  420)
* 環境変数; BROWSER <3>:                 ライブラリ<24>.     (line  424)
* 環境変数; BROWSER <4>:                 webbrowser --- 便利なウェブブラウザコントローラー.
                                                             (line   20)
* 環境変数; BROWSER <5>:                 webbrowser --- 便利なウェブブラウザコントローラー.
                                                             (line   30)
* 環境変数; BROWSER <6>:                 webbrowser --- 便利なウェブブラウザコントローラー.
                                                             (line   40)
* 環境変数; BROWSER <7>:                 コマンドライン・インターフェース<6>.
                                                             (line   87)
* 環境変数; CC:                          新たなモジュール、改良されたモジュール、非推奨のモジュール<4>.
                                                             (line   56)
* 環境変数; CC <1>:                      Compiler flags.     (line    6)
* 環境変数; CCSHARED:                    Compiler flags.     (line   81)
* 環境変数; CFLAGS:                      新たなモジュール、改良されたモジュール、非推奨のモジュール<4>.
                                                             (line   57)
* 環境変数; CFLAGS <1>:                  パフォーマンスに関するオプション.
                                                             (line   28)
* 環境変数; CFLAGS <2>:                  Compiler flags.     (line   18)
* 環境変数; CFLAGS <3>:                  Compiler flags.     (line   26)
* 環境変数; CFLAGS <4>:                  Compiler flags.     (line   28)
* 環境変数; CFLAGS <5>:                  Compiler flags.     (line   32)
* 環境変数; CFLAGS <6>:                  Compiler flags.     (line   54)
* 環境変数; CFLAGS <7>:                  Linker flags.       (line   18)
* 環境変数; CFLAGS_ALIASING:             Compiler flags.     (line   74)
* 環境変数; CFLAGS_NODIST:               Compiler flags.     (line   22)
* 環境変数; CFLAGS_NODIST <1>:           Compiler flags.     (line   24)
* 環境変数; CFLAGS_NODIST <2>:           Compiler flags.     (line   61)
* 環境変数; CFLAGS_NODIST <3>:           Linker flags.       (line   26)
* 環境変数; CFLAGSFORSHARED:             Compiler flags.     (line   87)
* 環境変数; COLUMNS:                     関数<6>.            (line  597)
* 環境変数; COLUMNS <1>:                 関数<6>.            (line  598)
* 環境変数; COMPILEALL_OPTS:             Compiler flags.     (line   41)
* 環境変数; COMSPEC:                     プロセス管理.       (line  783)
* 環境変数; COMSPEC <1>:                 Popen コンストラクター.
                                                             (line  111)
* 環境変数; CONFIGURE_CFLAGS:            Compiler flags.     (line   52)
* 環境変数; CONFIGURE_CFLAGS_NODIST:     Compiler flags.     (line   59)
* 環境変数; CONFIGURE_CPPFLAGS:          Preprocessor flags. (line    6)
* 環境変数; CONFIGURE_LDFLAGS:           Linker flags.       (line   13)
* 環境変数; CONFIGURE_LDFLAGS_NODIST:    Linker flags.       (line   38)
* 環境変数; CPPFLAGS:                    新たなモジュール、改良されたモジュール、非推奨のモジュール<4>.
                                                             (line   57)
* 環境変数; CPPFLAGS <1>:                Preprocessor flags. (line    8)
* 環境変数; CPPFLAGS <2>:                Preprocessor flags. (line   13)
* 環境変数; CPPFLAGS <3>:                Preprocessor flags. (line   18)
* 環境変数; CPPFLAGS <4>:                Linker flags.       (line   50)
* 環境変数; CXX:                         Compiler flags.     (line   12)
* 環境変数; DISPLAY:                     Tkinter モジュール. (line   26)
* 環境変数; EnableControlFlowGuard:      ビルド<42>.         (line   47)
* 環境変数; EXTRA_CFLAGS:                Compiler flags.     (line   48)
* 環境変数; HOME:                        os path<5>.         (line   15)
* 環境変数; HOME <1>:                    Python API の変更<6>.
                                                             (line  118)
* 環境変数; HOME <2>:                    Windows<48>.        (line   15)
* 環境変数; HOME <3>:                    Windows<48>.        (line   18)
* 環境変数; HOME <4>:                    os path --- 一般的なパス名操作.
                                                             (line  149)
* 環境変数; HOME <5>:                    os path --- 一般的なパス名操作.
                                                             (line  167)
* 環境変数; HOME <6>:                    Tkinter モジュール. (line   65)
* 環境変数; HOMEDRIVE:                   os path --- 一般的なパス名操作.
                                                             (line  156)
* 環境変数; HOMEPATH:                    os path --- 一般的なパス名操作.
                                                             (line  156)
* 環境変数; IDLESTARTUP:                 IDLE<37>.           (line  176)
* 環境変数; IDLESTARTUP <1>:             IDLE<41>.           (line    9)
* 環境変数; IDLESTARTUP <2>:             IDLE<47>.           (line    9)
* 環境変数; IDLESTARTUP <3>:             Startup and Code Execution.
                                                             (line    6)
* 環境変数; IDLESTARTUP <4>:             コマンドラインでの使用<5>.
                                                             (line   41)
* 環境変数; LANG:                        GNU gettext API.    (line   21)
* 環境変数; LANG <1>:                    クラス形式の API.   (line   25)
* 環境変数; LANG <2>:                    locale --- 国際化サービス.
                                                             (line   62)
* 環境変数; LANG <3>:                    locale --- 国際化サービス.
                                                             (line  357)
* 環境変数; LANG <4>:                    locale --- 国際化サービス.
                                                             (line  361)
* 環境変数; LANGUAGE:                    GNU gettext API.    (line   20)
* 環境変数; LANGUAGE <1>:                クラス形式の API.   (line   25)
* 環境変数; LC_ALL:                      GNU gettext API.    (line   20)
* 環境変数; LC_ALL <1>:                  クラス形式の API.   (line   25)
* 環境変数; LC_MESSAGES:                 GNU gettext API.    (line   20)
* 環境変数; LC_MESSAGES <1>:             クラス形式の API.   (line   25)
* 環境変数; LDFLAGS:                     新たなモジュール、改良されたモジュール、非推奨のモジュール<4>.
                                                             (line   57)
* 環境変数; LDFLAGS <1>:                 Preprocessor flags. (line   18)
* 環境変数; LDFLAGS <2>:                 Linker flags.       (line   15)
* 環境変数; LDFLAGS <3>:                 Linker flags.       (line   18)
* 環境変数; LDFLAGS <4>:                 Linker flags.       (line   28)
* 環境変数; LDFLAGS <5>:                 Linker flags.       (line   31)
* 環境変数; LDFLAGS <6>:                 Linker flags.       (line   35)
* 環境変数; LDFLAGS <7>:                 Linker flags.       (line   45)
* 環境変数; LDFLAGS <8>:                 Linker flags.       (line   50)
* 環境変数; LDFLAGS_NODIST:              Linker flags.       (line   24)
* 環境変数; LDFLAGS_NODIST <1>:          Linker flags.       (line   26)
* 環境変数; LDFLAGS_NODIST <2>:          Linker flags.       (line   40)
* 環境変数; LDSHARED:                    Linker flags.       (line   61)
* 環境変数; LIBS:                        Linker flags.       (line   54)
* 環境変数; LINES:                       関数<6>.            (line  140)
* 環境変数; LINES <1>:                   関数<6>.            (line  596)
* 環境変数; LINES <2>:                   関数<6>.            (line  598)
* 環境変数; LINKCC:                      Linker flags.       (line    6)
* 環境変数; LOGNAME:                     プロセスのパラメーター.
                                                             (line  259)
* 環境変数; LOGNAME <1>:                 getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   58)
* 環境変数; MANPAGER:                    pydoc --- ドキュメント生成とオンラインヘルプシステム.
                                                             (line   46)
* 環境変数; MANPAGER <1>:                pydoc --- ドキュメント生成とオンラインヘルプシステム.
                                                             (line   48)
* 環境変数; no_proxy:                    urllib request --- URL を開くための大規模なライブラリ.
                                                             (line  358)
* 環境変数; OPT:                         Debug options.      (line   39)
* 環境変数; OPT <1>:                     Compiler flags.     (line   70)
* 環境変数; PAGER:                       pydoc --- ドキュメント生成とオンラインヘルプシステム.
                                                             (line   46)
* 環境変数; PATH:                        Python API の変更<6>.
                                                             (line  145)
* 環境変数; PATH <1>:                    'python' コマンドの挙動の変更<2>.
                                                             (line    6)
* 環境変数; PATH <2>:                    'python' コマンドの挙動の変更<2>.
                                                             (line   10)
* 環境変数; PATH <3>:                    'python' コマンドの挙動の変更<2>.
                                                             (line   11)
* 環境変数; PATH <4>:                    macOS<9>.           (line   14)
* 環境変数; PATH <5>:                    Windows<29>.        (line   56)
* 環境変数; PATH <6>:                    Windows<33>.        (line   14)
* 環境変数; PATH <7>:                    セキュリティ<44>.   (line   16)
* 環境変数; PATH <8>:                    セキュリティ<44>.   (line   20)
* 環境変数; PATH <9>:                    モジュール検索パス. (line   16)
* 環境変数; PATH <10>:                   実行可能な Python スクリプト.
                                                             (line   11)
* 環境変数; PATH <11>:                   環境変数.           (line   26)
* 環境変数; PATH <12>:                   その他<2>.          (line   15)
* 環境変数; PATH <13>:                   Installation.       (line   19)
* 環境変数; PATH <14>:                   Installation.       (line   24)
* 環境変数; PATH <15>:                   Installation.       (line   32)
* 環境変数; PATH <16>:                   Configuration.      (line  114)
* 環境変数; PATH <17>:                   Shebang lines.      (line   40)
* 環境変数; PATH <18>:                   Shebang lines.      (line   42)
* 環境変数; PATH <19>:                   Shebang lines.      (line   49)
* 環境変数; PATH <20>:                   Advanced installation.
                                                             (line   10)
* 環境変数; PATH <21>:                   Advanced installation.
                                                             (line   28)
* 環境変数; PATH <22>:                   Advanced installation.
                                                             (line   31)
* 環境変数; PATH <23>:                   Installing free-threaded binaries.
                                                             (line   18)
* 環境変数; PATH <24>:                   Troubleshooting.    (line   33)
* 環境変数; PATH <25>:                   Troubleshooting.    (line   52)
* 環境変数; PATH <26>:                   Troubleshooting.    (line   68)
* 環境変数; PATH <27>:                   Troubleshooting.    (line  110)
* 環境変数; PATH <28>:                   インストール手順.   (line   35)
* 環境変数; PATH <29>:                   インストール手順.   (line   58)
* 環境変数; PATH <30>:                   Installing without UI.
                                                             (line   77)
* 環境変数; PATH <31>:                   Installing without UI.
                                                             (line   82)
* 環境変数; PATH <32>:                   Python launcher for Windows deprecated.
                                                             (line   17)
* 環境変数; PATH <33>:                   コマンドラインから起動する.
                                                             (line    8)
* 環境変数; PATH <34>:                   Shebang lines<2>.   (line   55)
* 環境変数; PATH <35>:                   Shebang lines<2>.   (line   61)
* 環境変数; PATH <36>:                   Shebang lines<2>.   (line   63)
* 環境変数; PATH <37>:                   Shebang lines<2>.   (line   68)
* 環境変数; PATH <38>:                   os と os path モジュールの比較.
                                                             (line   41)
* 環境変数; PATH <39>:                   ディレクトリとファイルの操作.
                                                             (line  450)
* 環境変数; PATH <40>:                   ディレクトリとファイルの操作.
                                                             (line  455)
* 環境変数; PATH <41>:                   プロセス管理.       (line   45)
* 環境変数; PATH <42>:                   プロセス管理.       (line   87)
* 環境変数; PATH <43>:                   プロセス管理.       (line   90)
* 環境変数; PATH <44>:                   プロセス管理.       (line   93)
* 環境変数; PATH <45>:                   プロセス管理.       (line  547)
* 環境変数; PATH <46>:                   プロセス管理.       (line  635)
* 環境変数; PATH <47>:                   プロセス管理.       (line  637)
* 環境変数; PATH <48>:                   プロセス管理.       (line  639)
* 環境変数; PATH <49>:                   雑多なシステム情報. (line  137)
* 環境変数; PATH <50>:                   Popen コンストラクター.
                                                             (line   35)
* 環境変数; PATH <51>:                   webbrowser --- 便利なウェブブラウザコントローラー.
                                                             (line   57)
* 環境変数; PATH <52>:                   webbrowser --- 便利なウェブブラウザコントローラー.
                                                             (line   32)
* 環境変数; PATH <53>:                   仮想環境のしくみ.   (line   15)
* 環境変数; PATH <54>:                   仮想環境のしくみ.   (line   60)
* 環境変数; PATH <55>:                   仮想環境のしくみ.   (line   65)
* 環境変数; PATH <56>:                   site --- サイト固有の設定フック.
                                                             (line   68)
* 環境変数; PATH <57>:                   Python の埋め込み<2>.
                                                             (line   26)
* 環境変数; PATH <58>:                   Python の埋め込み<2>.
                                                             (line   34)
* 環境変数; PATH <59>:                   Python のスクリプトを Unix で実行可能にするにはどうしますか？.
                                                             (line   20)
* 環境変数; PATH <60>:                   Python のスクリプトを Unix で実行可能にするにはどうしますか？.
                                                             (line   26)
* 環境変数; PATHEXT:                     その他の改善<2>.    (line   30)
* 環境変数; PATHEXT <1>:                 ライブラリ<135>.    (line  138)
* 環境変数; PATHEXT <2>:                 Installing without UI.
                                                             (line   78)
* 環境変数; PATHEXT <3>:                 Installing without UI.
                                                             (line   83)
* 環境変数; PATHEXT <4>:                 ディレクトリとファイルの操作.
                                                             (line  465)
* 環境変数; PIP_USER:                    Windows<50>.        (line  102)
* 環境変数; PROFILE_TASK:                ビルド<22>.         (line   13)
* 環境変数; PROFILE_TASK <1>:            パフォーマンスに関するオプション.
                                                             (line   12)
* 環境変数; PROFILE_TASK <2>:            パフォーマンスに関するオプション.
                                                             (line   35)
* 環境変数; PURIFY:                      Compiler flags.     (line  130)
* 環境変数; PY_BUILTIN_MODULE_CFLAGS:    Compiler flags.     (line  121)
* 環境変数; PY_CFLAGS:                   Compiler flags.     (line   94)
* 環境変数; PY_CFLAGS_NODIST:            Compiler flags.     (line   99)
* 環境変数; PY_CORE_CFLAGS:              Compiler flags.     (line  115)
* 環境変数; PY_CORE_LDFLAGS:             Linker flags.       (line   83)
* 環境変数; PY_CPPFLAGS:                 Preprocessor flags. (line   26)
* 環境変数; PY_LDFLAGS:                  Linker flags.       (line   73)
* 環境変数; PY_LDFLAGS_NODIST:           Linker flags.       (line   77)
* 環境変数; PY_STDMODULE_CFLAGS:         Compiler flags.     (line  106)
* 環境変数; PYLAUNCHER_ALLOW_INSTALL:    Windows<17>.        (line   24)
* 環境変数; PYLAUNCHER_ALLOW_INSTALL <1>: Windows<31>.       (line   15)
* 環境変数; PYTHON_BASIC_REPL:           Default interactive shell.
                                                             (line    7)
* 環境変数; PYTHON_BASIC_REPL <1>:       改善された対話的インタープリタ.
                                                             (line   28)
* 環境変数; PYTHON_BASIC_REPL <2>:       ライブラリ<46>.     (line   52)
* 環境変数; PYTHON_BASIC_REPL <3>:       ライブラリ<46>.     (line   56)
* 環境変数; PYTHON_BASIC_REPL <4>:       Core and Builtins<47>.
                                                             (line   13)
* 環境変数; PYTHON_BASIC_REPL <5>:       対話モード<2>.      (line   21)
* 環境変数; PYTHON_BASIC_REPL <6>:       環境変数.           (line  537)
* 環境変数; PYTHON_BASIC_REPL <7>:       使用例<2>.          (line   79)
* 環境変数; PYTHON_BASIC_REPL <8>:       asyncio --- 非同期 I/O.
                                                             (line   79)
* 環境変数; PYTHON_COLORS:               概要 -- リリースハイライト<2>.
                                                             (line   55)
* 環境変数; PYTHON_COLORS <1>:           エラーメッセージの改善<2>.
                                                             (line    7)
* 環境変数; PYTHON_COLORS <2>:           doctest.            (line    7)
* 環境変数; PYTHON_COLORS <3>:           色の制御.           (line   20)
* 環境変数; PYTHON_COLORS <4>:           環境変数.           (line  529)
* 環境変数; PYTHON_COLORS <5>:           color.              (line   24)
* 環境変数; PYTHON_CONTEXT_AWARE_WARNINGS: ライブラリ<24>.   (line  369)
* 環境変数; PYTHON_CONTEXT_AWARE_WARNINGS <1>: その他のオプション.
                                                             (line  435)
* 環境変数; PYTHON_CONTEXT_AWARE_WARNINGS <2>: 環境変数.     (line  577)
* 環境変数; PYTHON_CONTEXT_AWARE_WARNINGS <3>: sys --- システム固有のパラメーターと関数.
                                                             (line  590)
* 環境変数; PYTHON_CONTEXT_AWARE_WARNINGS <4>: Concurrent safety of Context Managers.
                                                             (line   41)
* 環境変数; PYTHON_CPU_COUNT:            os<2>.              (line   11)
* 環境変数; PYTHON_CPU_COUNT <1>:        その他のオプション. (line  399)
* 環境変数; PYTHON_CPU_COUNT <2>:        環境変数.           (line  505)
* 環境変数; PYTHON_CPU_COUNT <3>:        雑多なシステム情報. (line   45)
* 環境変数; PYTHON_CPU_COUNT <4>:        雑多なシステム情報. (line   66)
* 環境変数; PYTHON_CPU_COUNT <5>:        その他<5>.          (line   32)
* 環境変数; PYTHON_CPU_COUNT <6>:        PyConfig.           (line  521)
* 環境変数; PYTHON_DISABLE_REMOTE_DEBUG: PEP 768 Safe external debugger interface.
                                                             (line   40)
* 環境変数; PYTHON_DISABLE_REMOTE_DEBUG <1>: その他のオプション.
                                                             (line  390)
* 環境変数; PYTHON_DISABLE_REMOTE_DEBUG <2>: 環境変数.       (line  492)
* 環境変数; PYTHON_DISABLE_REMOTE_DEBUG <3>: Disabling remote debugging.
                                                             (line    8)
* 環境変数; PYTHON_DOM:                  モジュールコンテンツ<4>.
                                                             (line   22)
* 環境変数; PYTHON_FROZEN_MODULES:       その他の言語変更.   (line   46)
* 環境変数; PYTHON_FROZEN_MODULES <1>:   Core and Builtins<58>.
                                                             (line  105)
* 環境変数; PYTHON_FROZEN_MODULES <2>:   その他のオプション. (line  358)
* 環境変数; PYTHON_FROZEN_MODULES <3>:   環境変数.           (line  515)
* 環境変数; PYTHON_FROZEN_MODULES <4>:   PyConfig.           (line  419)
* 環境変数; PYTHON_GIL:                  フリースレッドの CPython.
                                                             (line   23)
* 環境変数; PYTHON_GIL <1>:              フリースレッドの CPython.
                                                             (line   37)
* 環境変数; PYTHON_GIL <2>:              Core and Builtins<43>.
                                                             (line   50)
* 環境変数; PYTHON_GIL <3>:              その他のオプション. (line  417)
* 環境変数; PYTHON_GIL <4>:              環境変数.           (line  554)
* 環境変数; PYTHON_GIL <5>:              sys --- システム固有のパラメーターと関数.
                                                             (line  583)
* 環境変数; PYTHON_GIL <6>:              The global interpreter lock in free-threaded Python.
                                                             (line    7)
* 環境変数; PYTHON_GIL <7>:              用語集<2>.          (line  787)
* 環境変数; PYTHON_HISTORY:              その他の言語変更.   (line   57)
* 環境変数; PYTHON_HISTORY <1>:          ライブラリ<62>.     (line  544)
* 環境変数; PYTHON_HISTORY <2>:          環境変数.           (line  546)
* 環境変数; PYTHON_JIT:                  Binary releases for the experimental just-in-time compiler.
                                                             (line    8)
* 環境変数; PYTHON_JIT <1>:              環境変数.           (line  587)
* 環境変数; PYTHON_JIT <2>:              一般的なオプション. (line  242)
* 環境変数; PYTHON_JIT <3>:              一般的なオプション. (line  245)
* 環境変数; PYTHON_JIT <4>:              一般的なオプション. (line  250)
* 環境変数; PYTHON_JIT <5>:              sys --- システム固有のパラメーターと関数.
                                                             (line 1275)
* 環境変数; PYTHON_MANAGER_AUTOMATIC_INSTALL: Installing runtimes.
                                                             (line   41)
* 環境変数; PYTHON_MANAGER_AUTOMATIC_INSTALL <1>: Configuration.
                                                             (line   58)
* 環境変数; PYTHON_MANAGER_DEFAULT:      基本的な使い方.     (line   46)
* 環境変数; PYTHON_MANAGER_DEFAULT <1>:  Configuration.      (line   37)
* 環境変数; PYTHON_MANAGER_DEFAULT <2>:  Troubleshooting.    (line   76)
* 環境変数; PYTHON_PERF_JIT_SUPPORT:     その他の言語変更.   (line   52)
* 環境変数; PYTHON_PERF_JIT_SUPPORT <1>: その他のオプション. (line  377)
* 環境変数; PYTHON_PERF_JIT_SUPPORT <2>: 環境変数.           (line  479)
* 環境変数; PYTHON_PERF_JIT_SUPPORT <3>: PyConfig.           (line  907)
* 環境変数; PYTHON_PERF_JIT_SUPPORT <4>: How to work without frame pointers.
                                                             (line   14)
* 環境変数; PYTHON_PRESITE:              その他のオプション. (line  411)
* 環境変数; PYTHON_PRESITE <1>:          デバッグモード変数. (line   25)
* 環境変数; PYTHON_PRESITE <2>:          PyConfig.           (line  801)
* 環境変数; PYTHON_PRESITE=package.module: Core and Builtins<58>.
                                                             (line  154)
* 環境変数; PYTHON_THREAD_INHERIT_CONTEXT: Core and Builtins<24>.
                                                             (line  135)
* 環境変数; PYTHON_THREAD_INHERIT_CONTEXT <1>: その他のオプション.
                                                             (line  427)
* 環境変数; PYTHON_THREAD_INHERIT_CONTEXT <2>: 環境変数.     (line  566)
* 環境変数; PYTHON_THREAD_INHERIT_CONTEXT <3>: sys --- システム固有のパラメーターと関数.
                                                             (line  586)
* 環境変数; PYTHON_TLBC:                 その他のオプション. (line  443)
* 環境変数; PYTHON_TLBC <1>:             環境変数.           (line  595)
* 環境変数; PYTHONASYNCIODEBUG:          環境変数.           (line  281)
* 環境変数; PYTHONASYNCIODEBUG <1>:      デバッグモードの有効化.
                                                             (line   10)
* 環境変数; PYTHONASYNCIODEBUG <2>:      デバッグモード.     (line   11)
* 環境変数; PYTHONASYNCIODEBUG <3>:      Python 開発モードの影響.
                                                             (line   65)
* 環境変数; PYTHONBREAKPOINT:            PEP 553 組み込みの breakpoint.
                                                             (line   13)
* 環境変数; PYTHONBREAKPOINT <1>:        環境変数.           (line   80)
* 環境変数; PYTHONBREAKPOINT <2>:        組み込み関数.       (line  161)
* 環境変数; PYTHONBREAKPOINT <3>:        sys --- システム固有のパラメーターと関数.
                                                             (line  247)
* 環境変数; PYTHONBREAKPOINT <4>:        sys --- システム固有のパラメーターと関数.
                                                             (line  261)
* 環境変数; PYTHONBREAKPOINT <5>:        sys --- システム固有のパラメーターと関数.
                                                             (line  266)
* 環境変数; PYTHONCASEOK:                Python API の変更<5>.
                                                             (line   29)
* 環境変数; PYTHONCASEOK <1>:            PEP 235 大文字小文字を区別しないプラットフォームでのモジュールの読み込み.
                                                             (line   17)
* 環境変数; PYTHONCASEOK <2>:            ライブラリ<153>.    (line  144)
* 環境変数; PYTHONCASEOK <3>:            環境変数.           (line  130)
* 環境変数; PYTHONCASEOK <4>:            組み込み関数.       (line 2242)
* 環境変数; PYTHONCOERCECLOCALE:         PEP 538 レガシーな C ロケールの抑圧.
                                                             (line   12)
* 環境変数; PYTHONCOERCECLOCALE <1>:     環境変数.           (line  369)
* 環境変数; PYTHONCOERCECLOCALE <2>:     一般的なオプション. (line   89)
* 環境変数; PYTHONCOERCECLOCALE <3>:     Python UTF-8 Mode.  (line   57)
* 環境変数; PYTHONCOERCECLOCALE <4>:     Python Configuration.
                                                             (line   15)
* 環境変数; PYTHONDEBUG:                 その他のオプション. (line   38)
* 環境変数; PYTHONDEBUG <1>:             環境変数.           (line   93)
* 環境変数; PYTHONDEBUG <2>:             Python デバッグビルド.
                                                             (line   20)
* 環境変数; PYTHONDEBUG <3>:             グローバルな設定変数.
                                                             (line   39)
* 環境変数; PYTHONDEBUG <4>:             PyConfig.           (line  692)
* 環境変数; PYTHONDEVMODE:               Python Development Mode -X dev.
                                                             (line    6)
* 環境変数; PYTHONDEVMODE <1>:           その他のオプション. (line  317)
* 環境変数; PYTHONDEVMODE <2>:           環境変数.           (line  426)
* 環境変数; PYTHONDEVMODE <3>:           Python 開発モード.  (line   14)
* 環境変数; PYTHONDEVMODE <4>:           PyConfig.           (line  295)
* 環境変数; PYTHONDONTWRITEBYTECODE:     インタプリタの変更<2>.
                                                             (line   15)
* 環境変数; PYTHONDONTWRITEBYTECODE <1>: 新しいモジュールと改良されたモジュール<2>.
                                                             (line  637)
* 環境変数; PYTHONDONTWRITEBYTECODE <2>: その他のオプション. (line   19)
* 環境変数; PYTHONDONTWRITEBYTECODE <3>: 環境変数.           (line  136)
* 環境変数; PYTHONDONTWRITEBYTECODE <4>: sys --- システム固有のパラメーターと関数.
                                                             (line  332)
* 環境変数; PYTHONDONTWRITEBYTECODE <5>: グローバルな設定変数.
                                                             (line   53)
* 環境変数; PYTHONDONTWRITEBYTECODE <6>: PyConfig.           (line 1006)
* 環境変数; PYTHONDONTWRITEBYTECODE <7>: pyc ファイルを作るにはどうしますか？.
                                                             (line   19)
* 環境変数; PYTHONDUMPREFS:              デバッグビルドとリリースビルドのABI 共通化.
                                                             (line   15)
* 環境変数; PYTHONDUMPREFS <1>:          ビルド<59>.         (line   54)
* 環境変数; PYTHONDUMPREFS <2>:          デバッグモード変数. (line    6)
* 環境変数; PYTHONDUMPREFS <3>:          Debug options.      (line   22)
* 環境変数; PYTHONDUMPREFS <4>:          Debug options.      (line   24)
* 環境変数; PYTHONDUMPREFS <5>:          PyConfig.           (line  306)
* 環境変数; PYTHONDUMPREFSFILE:          Core and Builtins<109>.
                                                             (line   16)
* 環境変数; PYTHONDUMPREFSFILE <1>:      デバッグモード変数. (line   14)
* 環境変数; PYTHONDUMPREFSFILE <2>:      PyConfig.           (line  318)
* 環境変数; PYTHONEXECUTABLE:            環境変数.           (line  217)
* 環境変数; PYTHONEXECUTABLE <1>:        PyConfig.           (line  727)
* 環境変数; PYTHONFAULTHANDLER:          faulthandler<5>.    (line   12)
* 環境変数; PYTHONFAULTHANDLER <1>:      その他のオプション. (line  269)
* 環境変数; PYTHONFAULTHANDLER <2>:      環境変数.           (line  245)
* 環境変数; PYTHONFAULTHANDLER <3>:      Python 開発モードの影響.
                                                             (line   59)
* 環境変数; PYTHONFAULTHANDLER <4>:      faulthandler --- Python トレースバックをダンプする.
                                                             (line   15)
* 環境変数; PYTHONFAULTHANDLER <5>:      PyConfig.           (line  355)
* 環境変数; PYTHONHASHSEED:              組み込みの関数と型. (line   18)
* 環境変数; PYTHONHASHSEED <1>:          Python コードの移植.
                                                             (line    7)
* 環境変数; PYTHONHASHSEED <2>:          Core and Builtins<166>.
                                                             (line   30)
* 環境変数; PYTHONHASHSEED <3>:          その他のオプション. (line  131)
* 環境変数; PYTHONHASHSEED <4>:          その他のオプション. (line  148)
* 環境変数; PYTHONHASHSEED <5>:          環境変数.           (line  151)
* 環境変数; PYTHONHASHSEED <6>:          環境変数.           (line  156)
* 環境変数; PYTHONHASHSEED <7>:          基本的なカスタマイズ.
                                                             (line  312)
* 環境変数; PYTHONHASHSEED <8>:          グローバルな設定変数.
                                                             (line   79)
* 環境変数; PYTHONHASHSEED <9>:          グローバルな設定変数.
                                                             (line   82)
* 環境変数; PYTHONHASHSEED <10>:         PyConfig.           (line  435)
* 環境変数; PYTHONHOME:                  Pending removal in Python 3 15<2>.
                                                             (line   58)
* 環境変数; PYTHONHOME <1>:              Deprecated C APIs<2>.
                                                             (line   26)
* 環境変数; PYTHONHOME <2>:              Pending removal in Python 3 15<4>.
                                                             (line   58)
* 環境変数; PYTHONHOME <3>:              Pending removal in Python 3 15<6>.
                                                             (line   58)
* 環境変数; PYTHONHOME <4>:              概要 -- リリースハイライト<9>.
                                                             (line  106)
* 環境変数; PYTHONHOME <5>:              その他のオプション. (line   47)
* 環境変数; PYTHONHOME <6>:              環境変数.           (line   10)
* 環境変数; PYTHONHOME <7>:              環境変数.           (line   18)
* 環境変数; PYTHONHOME <8>:              環境変数.           (line   20)
* 環境変数; PYTHONHOME <9>:              環境変数.           (line   37)
* 環境変数; PYTHONHOME <10>:             モジュールの検索.   (line   28)
* 環境変数; PYTHONHOME <11>:             モジュールの検索.   (line   43)
* 環境変数; PYTHONHOME <12>:             モジュールの検索.   (line   78)
* 環境変数; PYTHONHOME <13>:             iOS プロジェクトに Python を追加する.
                                                             (line   91)
* 環境変数; PYTHONHOME <14>:             test support script_helper --- Utilities for the Python execution tests.
                                                             (line   25)
* 環境変数; PYTHONHOME <15>:             sys path モジュール検索パスの初期化.
                                                             (line   30)
* 環境変数; PYTHONHOME <16>:             sys path モジュール検索パスの初期化.
                                                             (line   56)
* 環境変数; PYTHONHOME <17>:             Virtual Environments.
                                                             (line   19)
* 環境変数; PYTHONHOME <18>:             Python の埋め込み<2>.
                                                             (line   34)
* 環境変数; PYTHONHOME <19>:             Python の埋め込み<2>.
                                                             (line   41)
* 環境変数; PYTHONHOME <20>:             グローバルな設定変数.
                                                             (line   94)
* 環境変数; PYTHONHOME <21>:             プロセスワイドのパラメータ.
                                                             (line  299)
* 環境変数; PYTHONHOME <22>:             プロセスワイドのパラメータ.
                                                             (line  314)
* 環境変数; PYTHONHOME <23>:             プロセスワイドのパラメータ.
                                                             (line  323)
* 環境変数; PYTHONHOME <24>:             PyConfig.           (line  443)
* 環境変数; PYTHONHOME <25>:             PyConfig.           (line  445)
* 環境変数; PYTHONHOME <26>:             Pending removal in Python 3 15<8>.
                                                             (line   58)
* 環境変数; PYTHONINSPECT:               その他の変更と修正<2>.
                                                             (line   13)
* 環境変数; PYTHONINSPECT <1>:           Core and Builtins<2>.
                                                             (line   57)
* 環境変数; PYTHONINSPECT <2>:           その他のオプション. (line   69)
* 環境変数; PYTHONINSPECT <3>:           環境変数.           (line  102)
* 環境変数; PYTHONINSPECT <4>:           グローバルな設定変数.
                                                             (line  111)
* 環境変数; PYTHONINSPECT <5>:           PyConfig.           (line  474)
* 環境変数; PYTHONINTMAXSTRDIGITS:       Core and Builtins<75>.
                                                             (line   74)
* 環境変数; PYTHONINTMAXSTRDIGITS <1>:   その他のオプション. (line  291)
* 環境変数; PYTHONINTMAXSTRDIGITS <2>:   環境変数.           (line  168)
* 環境変数; PYTHONINTMAXSTRDIGITS <3>:   上限値を設定する.   (line    9)
* 環境変数; PYTHONINTMAXSTRDIGITS <4>:   上限値を設定する.   (line   16)
* 環境変数; PYTHONINTMAXSTRDIGITS <5>:   sys --- システム固有のパラメーターと関数.
                                                             (line 1194)
* 環境変数; PYTHONINTMAXSTRDIGITS <6>:   PyConfig.           (line  505)
* 環境変数; PYTHONIOENCODING:            その他の改善<2>.    (line   75)
* 環境変数; PYTHONIOENCODING <1>:        インタプリタの変更<2>.
                                                             (line   22)
* 環境変数; PYTHONIOENCODING <2>:        環境変数.           (line  176)
* 環境変数; PYTHONIOENCODING <3>:        環境変数.           (line  406)
* 環境変数; PYTHONIOENCODING <4>:        Python UTF-8 Mode.  (line   29)
* 環境変数; PYTHONIOENCODING <5>:        sys --- システム固有のパラメーターと関数.
                                                             (line 1997)
* 環境変数; PYTHONIOENCODING <6>:        PyConfig.           (line  861)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING: Pending removal in Python 3 16.
                                                             (line  102)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <1>: New Deprecations.
                                                             (line  131)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <2>: Pending removal in Python 3 16<3>.
                                                             (line  102)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <3>: Pending removal in Python 3 16<5>.
                                                             (line  102)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <4>: PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更.
                                                             (line   18)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <5>: Windows<19>.  (line   37)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <6>: 環境変数.     (line  342)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <7>: sys --- システム固有のパラメーターと関数.
                                                             (line 1938)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <8>: sys --- システム固有のパラメーターと関数.
                                                             (line 1949)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <9>: sys --- システム固有のパラメーターと関数.
                                                             (line 1955)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <10>: グローバルな設定変数.
                                                             (line  153)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <11>: PyPreConfig. (line  123)
* 環境変数; PYTHONLEGACYWINDOWSFSENCODING <12>: Pending removal in Python 3 16<7>.
                                                             (line  102)
* 環境変数; PYTHONLEGACYWINDOWSSTDIO:    PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更.
                                                             (line   12)
* 環境変数; PYTHONLEGACYWINDOWSSTDIO <1>: 環境変数.          (line  190)
* 環境変数; PYTHONLEGACYWINDOWSSTDIO <2>: 環境変数.          (line  356)
* 環境変数; PYTHONLEGACYWINDOWSSTDIO <3>: sys --- システム固有のパラメーターと関数.
                                                             (line 2001)
* 環境変数; PYTHONLEGACYWINDOWSSTDIO <4>: グローバルな設定変数.
                                                             (line  171)
* 環境変数; PYTHONLEGACYWINDOWSSTDIO <5>: PyConfig.          (line  558)
* 環境変数; PYTHONMALLOC:                PYTHONMALLOC 環境変数.
                                                             (line    6)
* 環境変数; PYTHONMALLOC <1>:            C API の変更<13>.   (line    9)
* 環境変数; PYTHONMALLOC <2>:            Core and Builtins<186>.
                                                             (line   90)
* 環境変数; PYTHONMALLOC <3>:            環境変数.           (line  288)
* 環境変数; PYTHONMALLOC <4>:            環境変数.           (line  333)
* 環境変数; PYTHONMALLOC <5>:            パフォーマンスに関するオプション.
                                                             (line  119)
* 環境変数; PYTHONMALLOC <6>:            パフォーマンスに関するオプション.
                                                             (line  126)
* 環境変数; PYTHONMALLOC <7>:            Python 開発モードの影響.
                                                             (line   46)
* 環境変数; PYTHONMALLOC <8>:            Python 開発モードの影響.
                                                             (line   50)
* 環境変数; PYTHONMALLOC <9>:            概要<4>.            (line   75)
* 環境変数; PYTHONMALLOC <10>:           Default Memory Allocators.
                                                             (line   26)
* 環境変数; PYTHONMALLOC <11>:           Debug hooks on the Python memory allocators.
                                                             (line   11)
* 環境変数; PYTHONMALLOC <12>:           pymalloc アロケータ.
                                                             (line   27)
* 環境変数; PYTHONMALLOCSTATS:           Core and Builtins<186>.
                                                             (line   96)
* 環境変数; PYTHONMALLOCSTATS <1>:       環境変数.           (line  327)
* 環境変数; PYTHONMALLOCSTATS <2>:       PyConfig.           (line  574)
* 環境変数; PYTHONMALLOCSTATS <3>:       概要<4>.            (line   78)
* 環境変数; PYTHONNODEBUGRANGES:         PEP 657 トレースバックのエラー位置の詳細化.
                                                             (line   61)
* 環境変数; PYTHONNODEBUGRANGES <1>:     その他のオプション. (line  346)
* 環境変数; PYTHONNODEBUGRANGES <2>:     環境変数.           (line  456)
* 環境変数; PYTHONNODEBUGRANGES <3>:     Methods on code objects.
                                                             (line   40)
* 環境変数; PYTHONNODEBUGRANGES <4>:     PyConfig.           (line  248)
* 環境変数; PYTHONNOUSERSITE:            PEP 370 ユーザごとの site-packages ディレクトリ.
                                                             (line   30)
* 環境変数; PYTHONNOUSERSITE <1>:        その他のオプション. (line  160)
* 環境変数; PYTHONNOUSERSITE <2>:        環境変数.           (line  194)
* 環境変数; PYTHONNOUSERSITE <3>:        モジュールの内容<5>.
                                                             (line   15)
* 環境変数; PYTHONNOUSERSITE <4>:        グローバルな設定変数.
                                                             (line  205)
* 環境変数; PYTHONNOUSERSITE <5>:        PyConfig.           (line  959)
* 環境変数; PYTHONOPTIMIZE:              その他のオプション. (line   89)
* 環境変数; PYTHONOPTIMIZE <1>:          環境変数.           (line   74)
* 環境変数; PYTHONOPTIMIZE <2>:          グローバルな設定変数.
                                                             (line  216)
* 環境変数; PYTHONOPTIMIZE <3>:          PyConfig.           (line  642)
* 環境変数; PYTHONPATH:                  'python' コマンドの挙動の変更<2>.
                                                             (line    7)
* 環境変数; PYTHONPATH <1>:              'python' コマンドの挙動の変更<2>.
                                                             (line    9)
* 環境変数; PYTHONPATH <2>:              モジュール検索パス. (line   16)
* 環境変数; PYTHONPATH <3>:              標準モジュール.     (line   31)
* 環境変数; PYTHONPATH <4>:              標準モジュール.     (line   32)
* 環境変数; PYTHONPATH <5>:              その他のオプション. (line   46)
* 環境変数; PYTHONPATH <6>:              環境変数.           (line   23)
* 環境変数; PYTHONPATH <7>:              環境変数.           (line   31)
* 環境変数; PYTHONPATH <8>:              環境変数.           (line   38)
* 環境変数; PYTHONPATH <9>:              環境変数.           (line   42)
* 環境変数; PYTHONPATH <10>:             モジュールの検索.   (line   15)
* 環境変数; PYTHONPATH <11>:             モジュールの検索.   (line   36)
* 環境変数; PYTHONPATH <12>:             モジュールの検索.   (line   77)
* 環境変数; PYTHONPATH <13>:             iOS プロジェクトに Python を追加する.
                                                             (line   94)
* 環境変数; PYTHONPATH <14>:             iOS プロジェクトに Python を追加する.
                                                             (line  120)
* 環境変数; PYTHONPATH <15>:             iOS プロジェクトに Python を追加する.
                                                             (line  124)
* 環境変数; PYTHONPATH <16>:             パスエントリ・ファインダー.
                                                             (line   22)
* 環境変数; PYTHONPATH <17>:             test support script_helper --- Utilities for the Python execution tests.
                                                             (line   26)
* 環境変数; PYTHONPATH <18>:             sys --- システム固有のパラメーターと関数.
                                                             (line 1429)
* 環境変数; PYTHONPATH <19>:             sys --- システム固有のパラメーターと関数.
                                                             (line 1435)
* 環境変数; PYTHONPATH <20>:             sys path モジュール検索パスの初期化.
                                                             (line   14)
* 環境変数; PYTHONPATH <21>:             sys path モジュール検索パスの初期化.
                                                             (line   18)
* 環境変数; PYTHONPATH <22>:             Python の埋め込み<2>.
                                                             (line   35)
* 環境変数; PYTHONPATH <23>:             Python の埋め込み<2>.
                                                             (line   42)
* 環境変数; PYTHONPATH <24>:             グローバルな設定変数.
                                                             (line   93)
* 環境変数; PYTHONPATH <25>:             PyConfig.           (line  607)
* 環境変数; PYTHONPERFSUPPORT:           その他の言語変更<2>.
                                                             (line   85)
* 環境変数; PYTHONPERFSUPPORT <1>:       その他のオプション. (line  366)
* 環境変数; PYTHONPERFSUPPORT <2>:       環境変数.           (line  467)
* 環境変数; PYTHONPERFSUPPORT <3>:       PyConfig.           (line  903)
* 環境変数; PYTHONPERFSUPPORT <4>:       How to enable perf profiling support.
                                                             (line    7)
* 環境変数; PYTHONPLATLIBDIR:            Core and Builtins<145>.
                                                             (line   47)
* 環境変数; PYTHONPLATLIBDIR <1>:        環境変数.           (line   54)
* 環境変数; PYTHONPLATLIBDIR <2>:        sys path モジュール検索パスの初期化.
                                                             (line   51)
* 環境変数; PYTHONPLATLIBDIR <3>:        PyConfig.           (line  586)
* 環境変数; PYTHONPROFILEIMPORTTIME:     その他の言語変更<7>.
                                                             (line   47)
* 環境変数; PYTHONPROFILEIMPORTTIME <1>: Core and Builtins<168>.
                                                             (line   66)
* 環境変数; PYTHONPROFILEIMPORTTIME <2>: その他のオプション. (line  307)
* 環境変数; PYTHONPROFILEIMPORTTIME <3>: 環境変数.           (line  269)
* 環境変数; PYTHONPROFILEIMPORTTIME <4>: PyConfig.           (line  457)
* 環境変数; PYTHONPYCACHEPREFIX:         コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム.
                                                             (line    8)
* 環境変数; PYTHONPYCACHEPREFIX <1>:     Core and Builtins<159>.
                                                             (line  402)
* 環境変数; PYTHONPYCACHEPREFIX <2>:     その他のオプション. (line  330)
* 環境変数; PYTHONPYCACHEPREFIX <3>:     環境変数.           (line  142)
* 環境変数; PYTHONPYCACHEPREFIX <4>:     sys --- システム固有のパラメーターと関数.
                                                             (line  379)
* 環境変数; PYTHONPYCACHEPREFIX <5>:     PyConfig.           (line  749)
* 環境変数; PYTHONREGRTEST_UNICODE_GUARD: テスト<28>.        (line   13)
* 環境変数; PYTHONSAFEPATH:              概要 -- リリースハイライト<4>.
                                                             (line   27)
* 環境変数; PYTHONSAFEPATH <1>:          その他の言語変更<3>.
                                                             (line   37)
* 環境変数; PYTHONSAFEPATH <2>:          セキュリティ<28>.   (line    6)
* 環境変数; PYTHONSAFEPATH <3>:          その他のオプション. (line  117)
* 環境変数; PYTHONSAFEPATH <4>:          環境変数.           (line   46)
* 環境変数; PYTHONSAFEPATH <5>:          sys --- システム固有のパラメーターと関数.
                                                             (line 1447)
* 環境変数; PYTHONSAFEPATH <6>:          セキュリティで考慮すべき点<6>.
                                                             (line   47)
* 環境変数; PYTHONSAFEPATH <7>:          PyConfig.           (line  165)
* 環境変数; PYTHONSTARTUP:               Default interactive shell.
                                                             (line   15)
* 環境変数; PYTHONSTARTUP <1>:           sys<12>.            (line   16)
* 環境変数; PYTHONSTARTUP <2>:           sys<12>.            (line   21)
* 環境変数; PYTHONSTARTUP <3>:           ライブラリ<2>.      (line  144)
* 環境変数; PYTHONSTARTUP <4>:           Core and Builtins<11>.
                                                             (line   41)
* 環境変数; PYTHONSTARTUP <5>:           IDLE<37>.           (line  176)
* 環境変数; PYTHONSTARTUP <6>:           IDLE<41>.           (line    9)
* 環境変数; PYTHONSTARTUP <7>:           IDLE<47>.           (line    9)
* 環境変数; PYTHONSTARTUP <8>:           対話モード用の起動時実行ファイル.
                                                             (line    7)
* 環境変数; PYTHONSTARTUP <9>:           その他のオプション. (line   65)
* 環境変数; PYTHONSTARTUP <10>:          環境変数.           (line   61)
* 環境変数; PYTHONSTARTUP <11>:          環境変数.           (line  116)
* 環境変数; PYTHONSTARTUP <12>:          使用例<2>.          (line   10)
* 環境変数; PYTHONSTARTUP <13>:          asyncio --- 非同期 I/O.
                                                             (line   88)
* 環境変数; PYTHONSTARTUP <14>:          Startup and Code Execution.
                                                             (line    6)
* 環境変数; PYTHONSTARTUP <15>:          コマンドラインでの使用<5>.
                                                             (line   42)
* 環境変数; PYTHONSTARTUP <16>:          sys --- システム固有のパラメーターと関数.
                                                             (line 1206)
* 環境変数; PYTHONSTARTUP <17>:          readline の設定.    (line   12)
* 環境変数; PYTHONTRACEMALLOC:           その他のオプション. (line  286)
* 環境変数; PYTHONTRACEMALLOC <1>:       環境変数.           (line  256)
* 環境変数; PYTHONTRACEMALLOC <2>:       tracemalloc --- メモリ割り当ての追跡.
                                                             (line   23)
* 環境変数; PYTHONTRACEMALLOC <3>:       tracemalloc --- メモリ割り当ての追跡.
                                                             (line   30)
* 環境変数; PYTHONTRACEMALLOC <4>:       関数<11>.           (line   90)
* 環境変数; PYTHONTRACEMALLOC <5>:       PyConfig.           (line  889)
* 環境変数; PYTHONTZPATH:                Environment configuration.
                                                             (line   11)
* 環境変数; PYTHONTZPATH <1>:            例外と警告.         (line   14)
* 環境変数; PYTHONUNBUFFERED:            Core and Builtins<152>.
                                                             (line  107)
* 環境変数; PYTHONUNBUFFERED <1>:        その他のオプション. (line  180)
* 環境変数; PYTHONUNBUFFERED <2>:        環境変数.           (line  119)
* 環境変数; PYTHONUNBUFFERED <3>:        sys --- システム固有のパラメーターと関数.
                                                             (line 2008)
* 環境変数; PYTHONUNBUFFERED <4>:        グローバルな設定変数.
                                                             (line  244)
* 環境変数; PYTHONUNBUFFERED <5>:        PyConfig.           (line  212)
* 環境変数; PYTHONUOPS:                  Core and Builtins<59>.
                                                             (line   27)
* 環境変数; PYTHONUOPS <1>:              Core and Builtins<59>.
                                                             (line  179)
* 環境変数; PYTHONUOPS <2>:              Core and Builtins<59>.
                                                             (line  258)
* 環境変数; PYTHONUOPS <3>:              Core and Builtins<59>.
                                                             (line  317)
* 環境変数; PYTHONUOPS <4>:              Core and Builtins<59>.
                                                             (line  382)
* 環境変数; PYTHONUSERBASE:              PEP 370 ユーザごとの site-packages ディレクトリ.
                                                             (line   23)
* 環境変数; PYTHONUSERBASE <1>:          環境変数.           (line  205)
* 環境変数; PYTHONUSERBASE <2>:          モジュールの内容<5>.
                                                             (line   41)
* 環境変数; PYTHONUSERBASE <3>:          モジュールの内容<5>.
                                                             (line   67)
* 環境変数; PYTHONUSERSITE:              test support script_helper --- Utilities for the Python execution tests.
                                                             (line   26)
* 環境変数; PYTHONUTF8:                  PEP 540 強制 UTF-8 実行モード.
                                                             (line    6)
* 環境変数; PYTHONUTF8 <1>:              その他のオプション. (line  324)
* 環境変数; PYTHONUTF8 <2>:              環境変数.           (line  416)
* 環境変数; PYTHONUTF8 <3>:              環境変数.           (line  435)
* 環境変数; PYTHONUTF8 <4>:              UTF-8 モード.       (line   18)
* 環境変数; PYTHONUTF8 <5>:              Python UTF-8 Mode.  (line   52)
* 環境変数; PYTHONUTF8 <6>:              Python UTF-8 Mode.  (line   54)
* 環境変数; PYTHONUTF8 <7>:              sys --- システム固有のパラメーターと関数.
                                                             (line 1999)
* 環境変数; PYTHONUTF8 <8>:              PyPreConfig.        (line  152)
* 環境変数; PYTHONUTF8 <9>:              Python Configuration.
                                                             (line   14)
* 環境変数; PYTHONVERBOSE:               その他のオプション. (line  196)
* 環境変数; PYTHONVERBOSE <1>:           環境変数.           (line  124)
* 環境変数; PYTHONVERBOSE <2>:           グローバルな設定変数.
                                                             (line  261)
* 環境変数; PYTHONVERBOSE <3>:           PyConfig.           (line  976)
* 環境変数; PYTHONWARNDEFAULTENCODING:   Optional EncodingWarning and encoding="locale" option.
                                                             (line   19)
* 環境変数; PYTHONWARNDEFAULTENCODING <1>: ライブラリ<121>.  (line   45)
* 環境変数; PYTHONWARNDEFAULTENCODING <2>: その他のオプション.
                                                             (line  336)
* 環境変数; PYTHONWARNDEFAULTENCODING <3>: 環境変数.         (line  446)
* 環境変数; PYTHONWARNDEFAULTENCODING <4>: Opt-in EncodingWarning.
                                                             (line    9)
* 環境変数; PYTHONWARNINGS:              warnings<3>.        (line   21)
* 環境変数; PYTHONWARNINGS <1>:          その他の言語変更<12>.
                                                             (line  158)
* 環境変数; PYTHONWARNINGS <2>:          Deprecation Warnings の扱いの変更.
                                                             (line   24)
* 環境変数; PYTHONWARNINGS <3>:          インタプリタの変更. (line    6)
* 環境変数; PYTHONWARNINGS <4>:          ドキュメント<28>.   (line   67)
* 環境変数; PYTHONWARNINGS <5>:          その他のオプション. (line  250)
* 環境変数; PYTHONWARNINGS <6>:          環境変数.           (line  223)
* 環境変数; PYTHONWARNINGS <7>:          Python 開発モードの影響.
                                                             (line   30)
* 環境変数; PYTHONWARNINGS <8>:          警告フィルタ.       (line   49)
* 環境変数; PYTHONWARNINGS <9>:          警告フィルタ.       (line   59)
* 環境変数; PYTHONWARNINGS <10>:         Describing Warning Filters.
                                                             (line    7)
* 環境変数; PYTHONWARNINGS <11>:         Describing Warning Filters.
                                                             (line   21)
* 環境変数; PYTHONWARNINGS <12>:         デフォルトの警告フィルタ.
                                                             (line    7)
* 環境変数; PYTHONWARNINGS <13>:         PyConfig.           (line  995)
* 環境変数; SOURCE_DATE_EPOCH:           zipfile.            (line   11)
* 環境変数; SOURCE_DATE_EPOCH <1>:       py_compile<3>.      (line    7)
* 環境変数; SOURCE_DATE_EPOCH <2>:       ライブラリ<162>.    (line  452)
* 環境変数; SOURCE_DATE_EPOCH <3>:       ビルド<67>.         (line   15)
* 環境変数; SOURCE_DATE_EPOCH <4>:       py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   66)
* 環境変数; SOURCE_DATE_EPOCH <5>:       py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   83)
* 環境変数; SOURCE_DATE_EPOCH <6>:       py_compile --- Python ソースファイルをコンパイルする.
                                                             (line   87)
* 環境変数; SOURCE_DATE_EPOCH <7>:       コマンドラインでの使用<9>.
                                                             (line   94)
* 環境変数; SSLKEYLOGFILE:               コンテキストの作成. (line   34)
* 環境変数; SSLKEYLOGFILE <1>:           コンテキストの作成. (line   83)
* 環境変数; TEMP:                        tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  327)
* 環境変数; TERM:                        関数<6>.            (line  488)
* 環境変数; TERM <1>:                    関数<6>.            (line  514)
* 環境変数; TMP:                         tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  329)
* 環境変数; TMPDIR:                      ライブラリ<23>.     (line   79)
* 環境変数; TMPDIR <1>:                  テスト<27>.         (line   68)
* 環境変数; TMPDIR <2>:                  tempfile --- 一時ファイルやディレクトリの作成.
                                                             (line  325)
* 環境変数; TZ:                          関数<5>.            (line  636)
* 環境変数; TZ <1>:                      関数<5>.            (line  637)
* 環境変数; TZ <2>:                      関数<5>.            (line  645)
* 環境変数; TZ <3>:                      関数<5>.            (line  649)
* 環境変数; TZ <4>:                      関数<5>.            (line  651)
* 環境変数; TZ <5>:                      関数<5>.            (line  714)
* 環境変数; USER:                        getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   58)
* 環境変数; USERNAME:                    os path --- 一般的なパス名操作.
                                                             (line  158)
* 環境変数; USERNAME <1>:                プロセスのパラメーター.
                                                             (line  259)
* 環境変数; USERNAME <2>:                getpass --- 可搬性のあるパスワード入力機構.
                                                             (line   58)
* 環境変数; USERPROFILE:                 os path<5>.         (line   14)
* 環境変数; USERPROFILE <1>:             Python API の変更<6>.
                                                             (line  117)
* 環境変数; USERPROFILE <2>:             Windows<48>.        (line   15)
* 環境変数; USERPROFILE <3>:             os path --- 一般的なパス名操作.
                                                             (line  155)
* 環境変数;削除:                         プロセスのパラメーター.
                                                             (line  609)
* 環境変数;設定:                         プロセスのパラメーター.
                                                             (line  372)
* 監査イベント:                          デバッグとプロファイル.
                                                             (line   11)
* 直列化;オブジェクト:                   pickle --- Python オブジェクトの直列化.
                                                             (line    8)
* 真理値;value:                          真理値判定.         (line    6)
* 空の;list:                             リスト表示.         (line    6)
* 空の;tuple:                            変更不能なシーケンス immutable sequence.
                                                             (line   35)
* 空の;tuple <1>:                        丸括弧形式 parenthesized form.
                                                             (line   14)
* 空白:                                  インデント.         (line    6)
* 空白;in printf-style formatting:       printf 形式の文字列書式化.
                                                             (line   68)
* 空白;in printf-style formatting <1>:   printf 形式での bytes の書式化.
                                                             (line   61)
* 空白;文字列のフォーマットで:           書式指定ミニ言語仕様.
                                                             (line   76)
* 空行:                                  空行.               (line    6)
* 算術:                                  数値型 int float complex.
                                                             (line   27)
* 算術;変換:                             算術変換 arithmetic conversion.
                                                             (line    6)
* 終了モデル:                            例外<2>.            (line   20)
* 組み込み;types:                        組み込み型.         (line    9)
* 組み込み;メソッド:                     組み込みメソッド built-in method.
                                                             (line    6)
* 組み込みメソッド;call:                 呼び出し call.      (line  139)
* 組み込み関数;__import__:               モジュールのインポート<2>.
                                                             (line   30)
* 組み込み関数;abs:                      数値型をエミュレートする.
                                                             (line  120)
* 組み込み関数;abs <1>:                  数値型プロトコル number protocol.
                                                             (line   92)
* 組み込み関数;ascii:                    オブジェクトプロトコル object protocol.
                                                             (line  338)
* 組み込み関数;bytes:                    基本的なカスタマイズ.
                                                             (line  144)
* 組み込み関数;bytes <1>:                オブジェクトプロトコル object protocol.
                                                             (line  359)
* 組み込み関数;call:                     呼び出し call.      (line  139)
* 組み込み関数;chr:                      変更不能なシーケンス immutable sequence.
                                                             (line   16)
* 組み込み関数;divmod:                   数値型をエミュレートする.
                                                             (line   26)
* 組み込み関数;divmod <1>:               数値型をエミュレートする.
                                                             (line   57)
* 組み込み関数;divmod <2>:               数値型プロトコル number protocol.
                                                             (line   66)
* 組み込み関数;eval:                     global 文.          (line   23)
* 組み込み関数;eval <1>:                 式入力.             (line    6)
* 組み込み関数;eval <2>:                 コードオブジェクト<2>.
                                                             (line   17)
* 組み込み関数;eval <3>:                 関数<4>.            (line   85)
* 組み込み関数;eval <4>:                 PrettyPrinter オブジェクト.
                                                             (line   67)
* 組み込み関数;exec:                     global 文.          (line   23)
* 組み込み関数;exec <1>:                 組み込み関数.       (line  630)
* 組み込み関数;exec <2>:                 コードオブジェクト<2>.
                                                             (line   17)
* 組み込み関数;hash:                     基本的なカスタマイズ.
                                                             (line  238)
* 組み込み関数;hash <1>:                 イミュータブルなシーケンス型.
                                                             (line    6)
* 組み込み関数;hash <2>:                 オブジェクトプロトコル object protocol.
                                                             (line  411)
* 組み込み関数;hash <3>:                 PyTypeObject スロット.
                                                             (line  456)
* 組み込み関数;help:                     OSへのインターフェース.
                                                             (line   20)
* 組み込み関数;id:                       オブジェクト、値、および型.
                                                             (line   10)
* 組み込み関数;int:                      数値型をエミュレートする.
                                                             (line  127)
* 組み込み関数;int <1>:                  数値型 int float complex.
                                                             (line   27)
* 組み込み関数;int <2>:                  数値型プロトコル number protocol.
                                                             (line  239)
* 組み込み関数;len:                      シーケンス型 sequence.
                                                             (line    6)
* 組み込み関数;len <1>:                  集合型<2>.          (line    6)
* 組み込み関数;len <2>:                  マッピング型 mapping.
                                                             (line    6)
* 組み込み関数;len <3>:                  コンテナをエミュレートする.
                                                             (line   46)
* 組み込み関数;len <4>:                  共通のシーケンス演算.
                                                             (line   18)
* 組み込み関数;len <5>:                  マッピング型 --- dict.
                                                             (line    6)
* 組み込み関数;len <6>:                  オブジェクトプロトコル object protocol.
                                                             (line  456)
* 組み込み関数;len <7>:                  シーケンス型プロトコル sequence protocol.
                                                             (line   16)
* 組み込み関数;len <8>:                  マップ型プロトコル mapping protocol.
                                                             (line   19)
* 組み込み関数;len <9>:                  リストオブジェクト. (line   41)
* 組み込み関数;len <10>:                 辞書オブジェクト dictionary object.
                                                             (line  231)
* 組み込み関数;len <11>:                 Set オブジェクト.   (line   96)
* 組み込み関数;max:                      共通のシーケンス演算.
                                                             (line   18)
* 組み込み関数;min:                      共通のシーケンス演算.
                                                             (line   18)
* 組み込み関数;open:                     ファイルを読み書きする.
                                                             (line    6)
* 組み込み関数;open <1>:                 I/O オブジェクト ファイルオブジェクトの別名.
                                                             (line    6)
* 組み込み関数;ord:                      変更不能なシーケンス immutable sequence.
                                                             (line   16)
* 組み込み関数;pow:                      数値型をエミュレートする.
                                                             (line   26)
* 組み込み関数;pow <1>:                  数値型をエミュレートする.
                                                             (line   26)
* 組み込み関数;pow <2>:                  数値型をエミュレートする.
                                                             (line   57)
* 組み込み関数;pow <3>:                  数値型プロトコル number protocol.
                                                             (line   73)
* 組み込み関数;pow <4>:                  数値型プロトコル number protocol.
                                                             (line  192)
* 組み込み関数;print:                    基本的なカスタマイズ.
                                                             (line  149)
* 組み込み関数;range:                    for 文<2>.          (line   37)
* 組み込み関数;repr:                     式文 expression statement.
                                                             (line   16)
* 組み込み関数;repr <1>:                 ファイナライズとメモリ解放.
                                                             (line   94)
* 組み込み関数;repr <2>:                 オブジェクトプロトコル object protocol.
                                                             (line  327)
* 組み込み関数;repr <3>:                 PyTypeObject スロット.
                                                             (line  390)
* 組み込み関数;round:                    数値型をエミュレートする.
                                                             (line  150)
* 組み込み関数;slice:                    スライス slice オブジェクト.
                                                             (line    6)
* 組み込み関数;slice <1>:                Python バイトコード命令.
                                                             (line 1190)
* 組み込み関数;tuple:                    シーケンス型プロトコル sequence protocol.
                                                             (line  120)
* 組み込み関数;tuple <1>:                リストオブジェクト. (line  163)
* 組み込み関数;type:                     オブジェクト、値、および型.
                                                             (line   10)
* 組み込み関数;type <1>:                 メタクラス.         (line    6)
* 組み込み関数;type <2>:                 型オブジェクト.     (line    6)
* 組み込み関数;type <3>:                 オブジェクトプロトコル object protocol.
                                                             (line  438)
* 組み込み関数;クラスメソッド:           Implementing functions and methods.
                                                             (line  195)
* 組み込み関数;コンパイル:               global 文.          (line   23)
* 組み込み関数;コンパイル <1>:           コードオブジェクト<2>.
                                                             (line    6)
* 組み込み関数;コンパイル <2>:           標準的なインタプリタ型.
                                                             (line   57)
* 組み込み関数;コンパイル <3>:           モジュールのインポート<2>.
                                                             (line  129)
* 組み込み関数;浮動小数点数:             数値型をエミュレートする.
                                                             (line  127)
* 組み込み関数;浮動小数点数 <1>:         数値型 int float complex.
                                                             (line   27)
* 組み込み関数;浮動小数点数 <2>:         数値型プロトコル number protocol.
                                                             (line  245)
* 組み込み関数;複素数:                   数値型をエミュレートする.
                                                             (line  127)
* 組み込み関数;複素数 <1>:               数値型 int float complex.
                                                             (line   27)
* 組み込み関数;静的メソッド:             Implementing functions and methods.
                                                             (line  203)
* 結合;演算:                             共通のシーケンス演算.
                                                             (line   18)
* 繰り返し;演算:                         共通のシーケンス演算.
                                                             (line   18)
* 自由;variable:                         名前の束縛.         (line   47)
* 虚数リテラル:                          数値リテラル.       (line    6)
* 行構造:                                行構造.             (line    6)
* 行継続:                                明示的な行継続.     (line    6)
* 行連結:                                論理行 logical line.
                                                             (line    6)
* 行連結 <1>:                            明示的な行継続.     (line    6)
* 補間, 文字列 (%):                      printf 形式の文字列書式化.
                                                             (line    6)
* 補間;bytearray (%):                    printf 形式での bytes の書式化.
                                                             (line    6)
* 補間;bytes (%):                        printf 形式での bytes の書式化.
                                                             (line    6)
* 複素数;number:                         numbers Complex complex.
                                                             (line    6)
* 複素数リテラル:                        数値リテラル.       (line    6)
* 要素の選択:                            シーケンス型 sequence.
                                                             (line    6)
* 記法:                                  本マニュアルにおける表記法.
                                                             (line    6)
* 設定;ファイル:                         configparser --- 設定ファイルのパーサー.
                                                             (line    8)
* 評価;順序:                             評価順序.           (line    6)
* 認識されなかったエスケープシーケンス:  Hexadecimal Unicode characters.
                                                             (line   17)
* 論理行:                                論理行 logical line.
                                                             (line    6)
* 識別子:                                Names identifiers and keywords.
                                                             (line    6)
* 識別子 <1>:                            識別子 identifier、または名前 name.
                                                             (line    6)
* 連鎖;比較:                             比較.               (line   19)
* 連鎖;比較 <1>:                         比較<2>.            (line    6)
* 関数:                                  用語集<2>.          (line  665)
* 関数;annotations:                      関数のアノテーション.
                                                             (line    6)
* 関数;annotations <1>:                  関数定義.           (line  106)
* 関数;call:                             呼び出し可能型 callable type.
                                                             (line    6)
* 関数;call <1>:                         呼び出し call.      (line  128)
* 関数;call <2>:                         呼び出し call.      (line  139)
* 関数;definition:                       return 文.          (line    6)
* 関数;definition <1>:                   関数定義.           (line    6)
* 関数;name:                             関数定義.           (line    6)
* 関数;name <1>:                         関数定義.           (line    6)
* 関数;ジェネレータ:                     yield 文.           (line    6)
* 関数;引数 (argument):                  呼び出し可能型 callable type.
                                                             (line    6)
* 関数呼び出し:                          呼び出し可能型 callable type.
                                                             (line    6)
* 集合;内包表記:                         集合表示.           (line    6)
* 集合;表示:                             集合表示.           (line    6)

                                                                       
   



Tag Table:
Node: Top346
Ref: contents doc547
Ref: 13b547
Node: What's New in Python312030
Ref: whatsnew/index doc312139
Ref: 13c312139
Ref: whatsnew/index python-documentation-contents312139
Ref: 13d312139
Ref: whatsnew/index what-s-new-in-python312139
Ref: 13e312139
Ref: whatsnew/index whatsnew-index312139
Ref: 13f312139
Node: What's new in Python 3 14313731
Ref: whatsnew/3 14 doc313847
Ref: 140313847
Ref: whatsnew/3 14 what-s-new-in-python-3-14313847
Ref: 141313847
Ref: What's new in Python 3 14-Footnote-1314702
Node: 概要 -- リリースハイライト314744
Ref: whatsnew/3 14 summary-release-highlights314867
Ref: 143314867
Ref: 概要 -- リリースハイライト-Footnote-1318538
Ref: 概要 -- リリースハイライト-Footnote-2318580
Ref: 概要 -- リリースハイライト-Footnote-3318622
Ref: 概要 -- リリースハイライト-Footnote-4318664
Ref: 概要 -- リリースハイライト-Footnote-5318706
Ref: 概要 -- リリースハイライト-Footnote-6318748
Ref: 概要 -- リリースハイライト-Footnote-7318790
Ref: 概要 -- リリースハイライト-Footnote-8318832
Ref: 概要 -- リリースハイライト-Footnote-9318874
Ref: 概要 -- リリースハイライト-Footnote-10318916
Ref: 概要 -- リリースハイライト-Footnote-11318959
Ref: 概要 -- リリースハイライト-Footnote-12319009
Ref: 概要 -- リリースハイライト-Footnote-13319052
Node: 新しい機能319095
Ref: whatsnew/3 14 new-features319249
Ref: 15a319249
Node: PEP 649 と PEP 749 アノテーションの遅延評価320004
Ref: whatsnew/3 14 pep-649-pep-749-deferred-evaluation-of-annotations320174
Ref: 15b320174
Ref: whatsnew/3 14 whatsnew314-deferred-annotations320174
Ref: 145320174
Ref: PEP 649 と PEP 749 アノテーションの遅延評価-Footnote-1322209
Ref: PEP 649 と PEP 749 アノテーションの遅延評価-Footnote-2322251
Ref: PEP 649 と PEP 749 アノテーションの遅延評価-Footnote-3322307
Ref: PEP 649 と PEP 749 アノテーションの遅延評価-Footnote-4322349
Ref: PEP 649 と PEP 749 アノテーションの遅延評価-Footnote-5322391
Node: PEP 734 Multiple interpreters in the standard library322433
Ref: whatsnew/3 14 pep-734-multiple-interpreters-in-the-standard-library322659
Ref: 162322659
Ref: whatsnew/3 14 whatsnew314-multiple-interpreters322659
Ref: 146322659
Ref: PEP 734 Multiple interpreters in the standard library-Footnote-1327010
Ref: PEP 734 Multiple interpreters in the standard library-Footnote-2327052
Ref: PEP 734 Multiple interpreters in the standard library-Footnote-3327108
Node: PEP 750 テンプレート文字列リテラル327150
Ref: whatsnew/3 14 pep-750-template-string-literals327360
Ref: 168327360
Ref: whatsnew/3 14 whatsnew314-template-string-literals327360
Ref: 144327360
Ref: PEP 750 テンプレート文字列リテラル-Footnote-1330252
Ref: PEP 750 テンプレート文字列リテラル-Footnote-2330308
Node: PEP 768 Safe external debugger interface330350
Ref: whatsnew/3 14 pep-768-safe-external-debugger-interface330532
Ref: 16c330532
Ref: whatsnew/3 14 whatsnew314-remote-debugging330532
Ref: 14e330532
Ref: PEP 768 Safe external debugger interface-Footnote-1332510
Ref: PEP 768 Safe external debugger interface-Footnote-2332566
Node: A new type of interpreter332608
Ref: whatsnew/3 14 a-new-type-of-interpreter332774
Ref: 171332774
Ref: whatsnew/3 14 whatsnew314-tail-call-interpreter332774
Ref: 14f332774
Ref: A new type of interpreter-Footnote-1334390
Ref: A new type of interpreter-Footnote-2334438
Node: Free-threaded mode improvements334494
Ref: whatsnew/3 14 free-threaded-mode-improvements334653
Ref: 173334653
Ref: whatsnew/3 14 whatsnew314-free-threaded-cpython334653
Ref: 150334653
Ref: Free-threaded mode improvements-Footnote-1336977
Ref: Free-threaded mode improvements-Footnote-2337019
Node: エラーメッセージの改善337061
Ref: whatsnew/3 14 improved-error-messages337244
Ref: 17a337244
Ref: whatsnew/3 14 whatsnew314-improved-error-messages337244
Ref: 151337244
Ref: エラーメッセージの改善-Footnote-1341843
Ref: エラーメッセージの改善-Footnote-2341899
Ref: エラーメッセージの改善-Footnote-3341955
Ref: エラーメッセージの改善-Footnote-4342011
Ref: エラーメッセージの改善-Footnote-5342066
Ref: エラーメッセージの改善-Footnote-6342122
Ref: エラーメッセージの改善-Footnote-7342178
Ref: エラーメッセージの改善-Footnote-8342234
Ref: エラーメッセージの改善-Footnote-9342290
Ref: エラーメッセージの改善-Footnote-10342346
Node: PEP 784 Zstandard support in the standard library342403
Ref: whatsnew/3 14 pep-784-zstandard-support-in-the-standard-library342589
Ref: 187342589
Ref: whatsnew/3 14 whatsnew314-zstandard342589
Ref: 148342589
Ref: PEP 784 Zstandard support in the standard library-Footnote-1344230
Ref: PEP 784 Zstandard support in the standard library-Footnote-2344271
Ref: PEP 784 Zstandard support in the standard library-Footnote-3344327
Node: Asyncio introspection capabilities344369
Ref: whatsnew/3 14 asyncio-introspection-capabilities344554
Ref: 188344554
Ref: whatsnew/3 14 whatsnew314-asyncio-introspection344554
Ref: 147344554
Ref: Asyncio introspection capabilities-Footnote-1350189
Node: Concurrent safe warnings control350244
Ref: whatsnew/3 14 concurrent-safe-warnings-control350371
Ref: 189350371
Ref: whatsnew/3 14 whatsnew314-concurrent-warnings-control350371
Ref: 153350371
Ref: Concurrent safe warnings control-Footnote-1351053
Node: Other language changes351109
Ref: whatsnew/3 14 other-language-changes351250
Ref: 18b351250
Ref: Other language changes-Footnote-1352750
Ref: Other language changes-Footnote-2352806
Ref: Other language changes-Footnote-3352861
Ref: Other language changes-Footnote-4352917
Ref: Other language changes-Footnote-5352973
Node: Built-ins353029
Ref: whatsnew/3 14 built-ins353136
Ref: 18f353136
Ref: Built-ins-Footnote-1355314
Ref: Built-ins-Footnote-2355370
Ref: Built-ins-Footnote-3355425
Ref: Built-ins-Footnote-4355480
Ref: Built-ins-Footnote-5355536
Ref: Built-ins-Footnote-6355592
Ref: Built-ins-Footnote-7355648
Ref: Built-ins-Footnote-8355704
Ref: Built-ins-Footnote-9355760
Node: コマンドラインと環境355816
Ref: whatsnew/3 14 command-line-and-environment355993
Ref: 1a7355993
Ref: コマンドラインと環境-Footnote-1356902
Ref: コマンドラインと環境-Footnote-2356958
Ref: コマンドラインと環境-Footnote-3357014
Ref: コマンドラインと環境-Footnote-4357046
Node: PEP 758 Allow except and except* expressions without brackets357102
Ref: whatsnew/3 14 pep-758-allow-except-and-except-expressions-without-brackets357308
Ref: 1aa357308
Ref: whatsnew/3 14 whatsnew314-bracketless-except357308
Ref: 14c357308
Ref: PEP 758 Allow except and except* expressions without brackets-Footnote-1357906
Ref: PEP 758 Allow except and except* expressions without brackets-Footnote-2357948
Node: PEP 765 Control flow in finally blocks358004
Ref: whatsnew/3 14 pep-765-control-flow-in-finally-blocks358210
Ref: 1ad358210
Ref: whatsnew/3 14 whatsnew314-finally-syntaxwarning358210
Ref: 14d358210
Ref: PEP 765 Control flow in finally blocks-Footnote-1359402
Ref: PEP 765 Control flow in finally blocks-Footnote-2359444
Node: Incremental garbage collection359500
Ref: whatsnew/3 14 incremental-garbage-collection359670
Ref: 1b2359670
Ref: whatsnew/3 14 whatsnew314-incremental-gc359670
Ref: 152359670
Ref: Incremental garbage collection-Footnote-1360491
Node: Default interactive shell360547
Ref: whatsnew/3 14 default-interactive-shell360670
Ref: 1b4360670
Ref: whatsnew/3 14 whatsnew314-pyrepl-highlighting360739
Ref: 154360739
Ref: Default interactive shell-Footnote-1362008
Ref: Default interactive shell-Footnote-2362064
Node: 新しいモジュール362119
Ref: whatsnew/3 14 new-modules362261
Ref: 1b9362261
Ref: 新しいモジュール-Footnote-1363443
Ref: 新しいモジュール-Footnote-2363499
Ref: 新しいモジュール-Footnote-3363555
Ref: 新しいモジュール-Footnote-4363611
Node: Improved modules363667
Ref: whatsnew/3 14 improved-modules363796
Ref: 1ba363796
Node: argparse364669
Ref: whatsnew/3 14 argparse364742
Ref: 1bb364742
Ref: argparse-Footnote-1365615
Ref: argparse-Footnote-2365670
Ref: argparse-Footnote-3365726
Node: ast365782
Ref: whatsnew/3 14 ast365871
Ref: 1be365871
Ref: ast-Footnote-1366835
Ref: ast-Footnote-2366890
Ref: ast-Footnote-3366946
Ref: ast-Footnote-4367002
Ref: ast-Footnote-5367058
Ref: ast-Footnote-6367114
Node: asyncio367170
Ref: whatsnew/3 14 asyncio367259
Ref: 1c6367259
Ref: asyncio-Footnote-1368390
Ref: asyncio-Footnote-2368446
Node: calendar368501
Ref: whatsnew/3 14 calendar368605
Ref: 1ce368605
Ref: whatsnew/3 14 whatsnew314-color-calendar368640
Ref: 1cf368640
Ref: calendar-Footnote-1368923
Node: concurrent futures368979
Ref: whatsnew/3 14 concurrent-futures369088
Ref: 1d1369088
Ref: whatsnew/3 14 whatsnew314-concurrent-futures-interp-pool369143
Ref: 167369143
Ref: whatsnew/3 14 whatsnew314-concurrent-futures-start-method369566
Ref: 1d3369566
Ref: concurrent futures-Footnote-1371034
Ref: concurrent futures-Footnote-2371090
Ref: concurrent futures-Footnote-3371145
Ref: concurrent futures-Footnote-4371201
Node: configparser371256
Ref: whatsnew/3 14 configparser371368
Ref: 1dd371368
Ref: configparser-Footnote-1371763
Node: contextvars371819
Ref: whatsnew/3 14 contextvars371919
Ref: 1e0371919
Ref: contextvars-Footnote-1372137
Node: ctypes372193
Ref: whatsnew/3 14 ctypes372287
Ref: 1e3372287
Ref: ctypes-Footnote-1374765
Ref: ctypes-Footnote-2374820
Ref: ctypes-Footnote-3374875
Ref: ctypes-Footnote-4374931
Ref: ctypes-Footnote-5374987
Ref: ctypes-Footnote-6375043
Ref: ctypes-Footnote-7375099
Ref: ctypes-Footnote-8375154
Ref: ctypes-Footnote-9375210
Ref: ctypes-Footnote-10375266
Ref: ctypes-Footnote-11375323
Node: curses375380
Ref: whatsnew/3 14 curses375471
Ref: 1f5375471
Ref: curses-Footnote-1375773
Node: datetime375829
Ref: whatsnew/3 14 datetime375921
Ref: 1f8375921
Ref: datetime-Footnote-1376170
Node: decimal376225
Ref: whatsnew/3 14 decimal376318
Ref: 1fc376318
Ref: decimal-Footnote-1376748
Ref: decimal-Footnote-2376804
Node: difflib376859
Ref: whatsnew/3 14 difflib376947
Ref: 200376947
Ref: difflib-Footnote-1377190
Node: dis377246
Ref: whatsnew/3 14 dis377332
Ref: 202377332
Ref: dis-Footnote-1378056
Ref: dis-Footnote-2378112
Node: errno378168
Ref: whatsnew/3 14 errno378259
Ref: 20a378259
Ref: errno-Footnote-1378433
Node: faulthandler378489
Ref: whatsnew/3 14 faulthandler378584
Ref: 20c378584
Ref: faulthandler-Footnote-1378930
Node: fnmatch378986
Ref: whatsnew/3 14 fnmatch379085
Ref: 210379085
Ref: fnmatch-Footnote-1379300
Node: fractions379355
Ref: whatsnew/3 14 fractions379451
Ref: 212379451
Ref: fractions-Footnote-1379866
Ref: fractions-Footnote-2379921
Node: functools379977
Ref: whatsnew/3 14 functools380072
Ref: 215380072
Ref: functools-Footnote-1380602
Ref: functools-Footnote-2380658
Node: getopt380714
Ref: whatsnew/3 14 getopt380807
Ref: 21b380807
Ref: getopt-Footnote-1381136
Ref: getopt-Footnote-2381192
Node: getpass381248
Ref: whatsnew/3 14 getpass381340
Ref: 21c381340
Ref: getpass-Footnote-1381711
Node: graphlib381766
Ref: whatsnew/3 14 graphlib381857
Ref: 21e381857
Ref: graphlib-Footnote-1382103
Node: heapq382159
Ref: whatsnew/3 14 heapq382247
Ref: 220382247
Node: hmac382588
Ref: whatsnew/3 14 hmac382672
Ref: 226382672
Ref: hmac-Footnote-1383024
Ref: hmac-Footnote-2383083
Ref: hmac-Footnote-3383131
Node: http383186
Ref: whatsnew/3 14 http383272
Ref: 227383272
Ref: http-Footnote-1384133
Ref: http-Footnote-2384189
Node: imaplib384244
Ref: whatsnew/3 14 imaplib384333
Ref: 22c384333
Ref: imaplib-Footnote-1384554
Ref: imaplib-Footnote-2384613
Node: inspect384668
Ref: whatsnew/3 14 inspect384755
Ref: 22e384755
Ref: inspect-Footnote-1385433
Ref: inspect-Footnote-2385489
Ref: inspect-Footnote-3385545
Node: io385601
Ref: whatsnew/3 14 io385685
Ref: 234385685
Ref: io-Footnote-1386225
Ref: io-Footnote-2386281
Node: json386337
Ref: whatsnew/3 14 json386423
Ref: 23b386423
Ref: json-Footnote-1387209
Ref: json-Footnote-2387265
Ref: json-Footnote-3387321
Node: linecache387377
Ref: whatsnew/3 14 linecache387477
Ref: 23f387477
Ref: linecache-Footnote-1387678
Node: logging handlers387734
Ref: whatsnew/3 14 logging-handlers387834
Ref: 241387834
Ref: logging handlers-Footnote-1388253
Ref: logging handlers-Footnote-2388309
Node: math388365
Ref: whatsnew/3 14 math388465
Ref: 245388465
Ref: math-Footnote-1388684
Node: mimetypes388740
Ref: whatsnew/3 14 mimetypes388839
Ref: 246388839
Ref: mimetypes-Footnote-1392126
Ref: mimetypes-Footnote-2392181
Ref: mimetypes-Footnote-3392240
Ref: mimetypes-Footnote-4392299
Ref: mimetypes-Footnote-5392358
Ref: mimetypes-Footnote-6392417
Ref: mimetypes-Footnote-7392476
Ref: mimetypes-Footnote-8392535
Ref: mimetypes-Footnote-9392594
Ref: mimetypes-Footnote-10392653
Ref: mimetypes-Footnote-11392713
Ref: mimetypes-Footnote-12392773
Ref: mimetypes-Footnote-13392833
Ref: mimetypes-Footnote-14392893
Ref: mimetypes-Footnote-15392953
Ref: mimetypes-Footnote-16393013
Ref: mimetypes-Footnote-17393101
Ref: mimetypes-Footnote-18393201
Ref: mimetypes-Footnote-19393256
Ref: mimetypes-Footnote-20393312
Ref: mimetypes-Footnote-21393369
Ref: mimetypes-Footnote-22393425
Ref: mimetypes-Footnote-23393481
Node: multiprocessing393538
Ref: whatsnew/3 14 multiprocessing393641
Ref: 248393641
Ref: whatsnew/3 14 whatsnew314-multiprocessing-start-method393692
Ref: 249393692
Ref: multiprocessing-Footnote-1395810
Ref: multiprocessing-Footnote-2395865
Ref: multiprocessing-Footnote-3395920
Ref: multiprocessing-Footnote-4395976
Ref: multiprocessing-Footnote-5396032
Node: operator396088
Ref: whatsnew/3 14 operator396184
Ref: 254396184
Ref: operator-Footnote-1396580
Node: os396636
Ref: whatsnew/3 14 os396724
Ref: 257396724
Ref: os-Footnote-1397433
Ref: os-Footnote-2397489
Ref: os-Footnote-3397545
Node: os path397601
Ref: whatsnew/3 14 os-path397688
Ref: 261397688
Ref: os path-Footnote-1398079
Node: pathlib398134
Ref: whatsnew/3 14 pathlib398222
Ref: 265398222
Ref: pathlib-Footnote-1399210
Ref: pathlib-Footnote-2399265
Node: pdb399321
Ref: whatsnew/3 14 pdb399408
Ref: 26f399408
Ref: pdb-Footnote-1402560
Ref: pdb-Footnote-2402616
Ref: pdb-Footnote-3402672
Ref: pdb-Footnote-4402728
Ref: pdb-Footnote-5402784
Ref: pdb-Footnote-6402840
Ref: pdb-Footnote-7402896
Ref: pdb-Footnote-8402952
Ref: pdb-Footnote-9403008
Ref: pdb-Footnote-10403064
Node: pickle403121
Ref: whatsnew/3 14 pickle403225
Ref: 27a403225
Ref: pickle-Footnote-1403596
Node: プラットフォーム403652
Ref: whatsnew/3 14 platform403758
Ref: 27c403758
Ref: プラットフォーム-Footnote-1404028
Node: pydoc404084
Ref: whatsnew/3 14 pydoc404186
Ref: 27e404186
Ref: pydoc-Footnote-1404435
Node: re404491
Ref: whatsnew/3 14 re404575
Ref: 27f404575
Ref: re-Footnote-1405116
Ref: re-Footnote-2405172
Node: socket405228
Ref: whatsnew/3 14 socket405310
Ref: 280405310
Ref: socket-Footnote-1406547
Ref: socket-Footnote-2406603
Ref: socket-Footnote-3406659
Ref: socket-Footnote-4406714
Ref: socket-Footnote-5406770
Ref: socket-Footnote-6406825
Ref: socket-Footnote-7406881
Ref: socket-Footnote-8406937
Node: ssl406993
Ref: whatsnew/3 14 ssl407079
Ref: 285407079
Ref: ssl-Footnote-1407349
Node: struct407405
Ref: whatsnew/3 14 struct407493
Ref: 287407493
Ref: struct-Footnote-1407784
Node: symtable407840
Ref: whatsnew/3 14 symtable407928
Ref: 288407928
Ref: symtable-Footnote-1408227
Node: sys408283
Ref: whatsnew/3 14 sys408379
Ref: 28d408379
Ref: sys-Footnote-1409674
Ref: sys-Footnote-2409730
Ref: sys-Footnote-3409786
Ref: sys-Footnote-4409842
Ref: sys-Footnote-5409898
Node: sys monitoring409954
Ref: whatsnew/3 14 sys-monitoring410051
Ref: 294410051
Ref: sys monitoring-Footnote-1410336
Node: sysconfig410392
Ref: whatsnew/3 14 sysconfig410493
Ref: 297410493
Ref: sysconfig-Footnote-1410692
Node: tarfile410748
Ref: whatsnew/3 14 tarfile410844
Ref: 299410844
Ref: tarfile-Footnote-1411946
Ref: tarfile-Footnote-2412002
Ref: tarfile-Footnote-3412057
Ref: tarfile-Footnote-4412113
Ref: tarfile-Footnote-5412169
Ref: tarfile-Footnote-6412224
Ref: tarfile-Footnote-7412280
Ref: tarfile-Footnote-8412336
Node: threading412391
Ref: whatsnew/3 14 threading412485
Ref: 29f412485
Ref: threading-Footnote-1412741
Node: tkinter412796
Ref: whatsnew/3 14 tkinter412889
Ref: 2a1412889
Ref: tkinter-Footnote-1413281
Ref: tkinter-Footnote-2413337
Node: turtle413393
Ref: whatsnew/3 14 turtle413482
Ref: 2a2413482
Ref: turtle-Footnote-1413757
Node: types413813
Ref: whatsnew/3 14 types413901
Ref: 2a6413901
Ref: types-Footnote-1414148
Node: typing414204
Ref: whatsnew/3 14 typing414297
Ref: 2aa414297
Ref: whatsnew/3 14 whatsnew314-typing-union414330
Ref: 2a9414330
Ref: typing-Footnote-1417382
Ref: typing-Footnote-2417424
Node: unicodedata417480
Ref: whatsnew/3 14 unicodedata417576
Ref: 2af417576
Node: unittest417682
Ref: whatsnew/3 14 unittest417778
Ref: 2b0417778
Ref: whatsnew/3 14 whatsnew314-color-unittest417815
Ref: 2b1417815
Ref: unittest-Footnote-1418981
Ref: unittest-Footnote-2419037
Ref: unittest-Footnote-3419092
Node: urllib419147
Ref: whatsnew/3 14 urllib419236
Ref: 2bc419236
Ref: urllib-Footnote-1420702
Ref: urllib-Footnote-2420761
Ref: urllib-Footnote-3420817
Node: uuid420873
Ref: whatsnew/3 14 uuid420964
Ref: 2c1420964
Ref: uuid-Footnote-1421605
Ref: uuid-Footnote-2421664
Ref: uuid-Footnote-3421719
Ref: uuid-Footnote-4421778
Ref: uuid-Footnote-5421834
Node: webbrowser421890
Ref: whatsnew/3 14 webbrowser421982
Ref: 2c8421982
Node: zipfile422334
Ref: whatsnew/3 14 zipfile422413
Ref: 2c9422413
Ref: zipfile-Footnote-1422907
Ref: zipfile-Footnote-2422963
Node: 最適化423018
Ref: whatsnew/3 14 optimizations423129
Ref: 2cd423129
Ref: 最適化-Footnote-1424381
Node: asyncio<2>424437
Ref: whatsnew/3 14 id2424508
Ref: 2d1424508
Ref: asyncio<2>-Footnote-1425264
Ref: asyncio<2>-Footnote-2425320
Node: base64425376
Ref: whatsnew/3 14 base64425459
Ref: 2d2425459
Ref: base64-Footnote-1425682
Node: bdb425738
Ref: whatsnew/3 14 bdb425821
Ref: 2d4425821
Ref: bdb-Footnote-1426130
Node: difflib<2>426186
Ref: whatsnew/3 14 id3426265
Ref: 2d6426265
Ref: difflib<2>-Footnote-1426476
Node: gc426532
Ref: whatsnew/3 14 gc426613
Ref: 2d8426613
Ref: gc-Footnote-1428202
Node: io<2>428258
Ref: whatsnew/3 14 id4428339
Ref: 2dd428339
Ref: io<2>-Footnote-1428635
Ref: io<2>-Footnote-2428691
Node: pathlib<2>428746
Ref: whatsnew/3 14 id5428831
Ref: 2de428831
Ref: pathlib<2>-Footnote-1429084
Node: pdb<2>429140
Ref: whatsnew/3 14 id6429228
Ref: 2e0429228
Ref: pdb<2>-Footnote-1429749
Node: textwrap429805
Ref: whatsnew/3 14 textwrap429890
Ref: 2e3429890
Node: uuid<2>430191
Ref: whatsnew/3 14 id7430274
Ref: 2e4430274
Ref: uuid<2>-Footnote-1430694
Ref: uuid<2>-Footnote-2430750
Node: zlib430806
Ref: whatsnew/3 14 zlib430872
Ref: 2e8430872
Ref: zlib-Footnote-1431523
Ref: zlib-Footnote-2431566
Node: 削除431621
Ref: whatsnew/3 14 removed431725
Ref: 2e9431725
Node: argparse<2>431955
Ref: whatsnew/3 14 id8432024
Ref: 2ea432024
Ref: argparse<2>-Footnote-1432828
Ref: argparse<2>-Footnote-2432884
Node: ast<2>432940
Ref: whatsnew/3 14 id9433028
Ref: 2ee433028
Ref: ast<2>-Footnote-1434107
Ref: ast<2>-Footnote-2434163
Node: asyncio<3>434219
Ref: whatsnew/3 14 id10434301
Ref: 2f1434301
Ref: asyncio<3>-Footnote-1437106
Ref: asyncio<3>-Footnote-2437162
Node: email437218
Ref: whatsnew/3 14 email437307
Ref: 2f6437307
Ref: email-Footnote-1437568
Node: importlib abc437624
Ref: whatsnew/3 14 importlib-abc437712
Ref: 2f8437712
Ref: importlib abc-Footnote-1438140
Node: itertools438195
Ref: whatsnew/3 14 itertools438288
Ref: 2fb438288
Ref: itertools-Footnote-1438601
Node: pathlib<3>438657
Ref: whatsnew/3 14 id11438744
Ref: 2fc438744
Ref: pathlib<3>-Footnote-1439268
Ref: pathlib<3>-Footnote-2439323
Node: pkgutil439378
Ref: whatsnew/3 14 pkgutil439459
Ref: 2ff439459
Ref: pkgutil-Footnote-1439705
Node: pty439760
Ref: whatsnew/3 14 pty439838
Ref: 300439838
Ref: pty-Footnote-1440116
Node: sqlite3440172
Ref: whatsnew/3 14 sqlite3440252
Ref: 302440252
Ref: sqlite3-Footnote-1440840
Ref: sqlite3-Footnote-2440896
Ref: sqlite3-Footnote-3440952
Node: urllib<2>441008
Ref: whatsnew/3 14 id12441076
Ref: 306441076
Ref: urllib<2>-Footnote-1441788
Ref: urllib<2>-Footnote-2441844
Node: 非推奨441899
Ref: whatsnew/3 14 deprecated442029
Ref: 30a442029
Node: New deprecations442459
Ref: whatsnew/3 14 new-deprecations442560
Ref: 30b442560
Ref: New deprecations-Footnote-1448652
Ref: New deprecations-Footnote-2448708
Ref: New deprecations-Footnote-3448764
Ref: New deprecations-Footnote-4448819
Ref: New deprecations-Footnote-5448875
Ref: New deprecations-Footnote-6448931
Ref: New deprecations-Footnote-7448987
Ref: New deprecations-Footnote-8449043
Ref: New deprecations-Footnote-9449099
Ref: New deprecations-Footnote-10449155
Ref: New deprecations-Footnote-11449212
Ref: New deprecations-Footnote-12449268
Ref: New deprecations-Footnote-13449325
Ref: New deprecations-Footnote-14449382
Ref: New deprecations-Footnote-15449439
Ref: New deprecations-Footnote-16449482
Ref: New deprecations-Footnote-17449539
Ref: New deprecations-Footnote-18449596
Ref: New deprecations-Footnote-19449653
Ref: New deprecations-Footnote-20449710
Node: Pending removal in Python 3 15449767
Ref: whatsnew/3 14 pending-removal-in-python-3-15449907
Ref: 320449907
Ref: Pending removal in Python 3 15-Footnote-1454462
Ref: Pending removal in Python 3 15-Footnote-2454517
Ref: Pending removal in Python 3 15-Footnote-3454572
Ref: Pending removal in Python 3 15-Footnote-4454627
Ref: Pending removal in Python 3 15-Footnote-5454683
Ref: Pending removal in Python 3 15-Footnote-6454725
Ref: Pending removal in Python 3 15-Footnote-7454781
Node: Pending removal in Python 3 16454837
Ref: whatsnew/3 14 pending-removal-in-python-3-16454991
Ref: 33a454991
Ref: Pending removal in Python 3 16-Footnote-1459232
Ref: Pending removal in Python 3 16-Footnote-2459288
Ref: Pending removal in Python 3 16-Footnote-3459344
Ref: Pending removal in Python 3 16-Footnote-4459400
Node: Pending removal in Python 3 17459455
Ref: whatsnew/3 14 pending-removal-in-python-3-17459609
Ref: 341459609
Ref: Pending removal in Python 3 17-Footnote-1462543
Ref: Pending removal in Python 3 17-Footnote-2462601
Ref: Pending removal in Python 3 17-Footnote-3462656
Ref: Pending removal in Python 3 17-Footnote-4462714
Node: Pending removal in Python 3 18462769
Ref: whatsnew/3 14 pending-removal-in-python-3-18462923
Ref: 346462923
Ref: Pending removal in Python 3 18-Footnote-1463349
Node: Pending removal in Python 3 19463404
Ref: whatsnew/3 14 pending-removal-in-python-3-19463562
Ref: 347463562
Node: Pending removal in future versions463840
Ref: whatsnew/3 14 pending-removal-in-future-versions463959
Ref: 348463959
Ref: Pending removal in future versions-Footnote-1471156
Ref: Pending removal in future versions-Footnote-2471211
Ref: Pending removal in future versions-Footnote-3471267
Ref: Pending removal in future versions-Footnote-4471323
Ref: Pending removal in future versions-Footnote-5471379
Ref: Pending removal in future versions-Footnote-6471434
Ref: Pending removal in future versions-Footnote-7471489
Node: CPython バイトコードの変更471545
Ref: whatsnew/3 14 cpython-bytecode-changes471682
Ref: 365471682
Ref: CPython バイトコードの変更-Footnote-1473594
Ref: CPython バイトコードの変更-Footnote-2473650
Ref: CPython バイトコードの変更-Footnote-3473706
Ref: CPython バイトコードの変更-Footnote-4473762
Ref: CPython バイトコードの変更-Footnote-5473818
Ref: CPython バイトコードの変更-Footnote-6473874
Ref: CPython バイトコードの変更-Footnote-7473930
Node: Pseudo-instructions473986
Ref: whatsnew/3 14 pseudo-instructions474077
Ref: 371474077
Ref: Pseudo-instructions-Footnote-1475716
Ref: Pseudo-instructions-Footnote-2475772
Ref: Pseudo-instructions-Footnote-3475828
Ref: Pseudo-instructions-Footnote-4475884
Ref: Pseudo-instructions-Footnote-5475940
Ref: Pseudo-instructions-Footnote-6475996
Ref: Pseudo-instructions-Footnote-7476052
Node: C API changes476108
Ref: whatsnew/3 14 c-api-changes476249
Ref: 377476249
Node: Python configuration C API476430
Ref: whatsnew/3 14 python-configuration-c-api476540
Ref: 378476540
Ref: whatsnew/3 14 whatsnew314-capi-config476540
Ref: 155476540
Ref: Python configuration C API-Footnote-1477865
Ref: Python configuration C API-Footnote-2477907
Ref: Python configuration C API-Footnote-3477949
Ref: Python configuration C API-Footnote-4478005
Ref: Python configuration C API-Footnote-5478047
Node: New features in the C API478089
Ref: whatsnew/3 14 new-features-in-the-c-api478229
Ref: 37e478229
Ref: New features in the C API-Footnote-1485380
Ref: New features in the C API-Footnote-2485436
Ref: New features in the C API-Footnote-3485492
Ref: New features in the C API-Footnote-4485548
Ref: New features in the C API-Footnote-5485604
Ref: New features in the C API-Footnote-6485660
Ref: New features in the C API-Footnote-7485716
Ref: New features in the C API-Footnote-8485772
Ref: New features in the C API-Footnote-9485828
Ref: New features in the C API-Footnote-10485884
Ref: New features in the C API-Footnote-11485941
Ref: New features in the C API-Footnote-12485998
Ref: New features in the C API-Footnote-13486041
Ref: New features in the C API-Footnote-14486098
Ref: New features in the C API-Footnote-15486155
Ref: New features in the C API-Footnote-16486212
Ref: New features in the C API-Footnote-17486269
Ref: New features in the C API-Footnote-18486326
Ref: New features in the C API-Footnote-19486383
Ref: New features in the C API-Footnote-20486440
Ref: New features in the C API-Footnote-21486497
Ref: New features in the C API-Footnote-22486563
Ref: New features in the C API-Footnote-23486620
Ref: New features in the C API-Footnote-24486663
Ref: New features in the C API-Footnote-25486720
Node: Limited C API changes486777
Ref: whatsnew/3 14 limited-c-api-changes486905
Ref: 3c8486905
Ref: Limited C API changes-Footnote-1487551
Ref: Limited C API changes-Footnote-2487607
Ref: Limited C API changes-Footnote-3487663
Node: Removed C APIs487718
Ref: whatsnew/3 14 removed-c-apis487838
Ref: 3cd487838
Ref: whatsnew/3 14 whatsnew314-c-api-removed487838
Ref: 3ce487838
Ref: Removed C APIs-Footnote-1488867
Ref: Removed C APIs-Footnote-2488923
Ref: Removed C APIs-Footnote-3488979
Ref: Removed C APIs-Footnote-4489021
Ref: Removed C APIs-Footnote-5489077
Ref: Removed C APIs-Footnote-6489133
Node: Deprecated C APIs489189
Ref: whatsnew/3 14 deprecated-c-apis489279
Ref: 3d3489279
Ref: whatsnew/3 14 whatsnew314-c-api-deprecated489279
Ref: 3d4489279
Ref: Deprecated C APIs-Footnote-1490903
Ref: Deprecated C APIs-Footnote-2490959
Ref: Deprecated C APIs-Footnote-3491015
Ref: Deprecated C APIs-Footnote-4491070
Node: Pending removal in Python 3 15<2>491126
Ref: whatsnew/3 14 id13491255
Ref: 3da491255
Ref: Pending removal in Python 3 15<2>-Footnote-1497904
Ref: Pending removal in Python 3 15<2>-Footnote-2497957
Node: Pending removal in Python 3 16<2>498010
Ref: whatsnew/3 14 id14498181
Ref: 41f498181
Node: Pending removal in Python 3 18<2>498304
Ref: whatsnew/3 14 id15498479
Ref: 420498479
Ref: Pending removal in Python 3 18<2>-Footnote-1501154
Ref: Pending removal in Python 3 18<2>-Footnote-2501207
Node: Pending removal in future versions<2>501263
Ref: whatsnew/3 14 id16501396
Ref: 426501396
Node: Build changes503235
Ref: whatsnew/3 14 build-changes503363
Ref: 442503363
Ref: whatsnew/3 14 whatsnew314-build-changes503363
Ref: 156503363
Ref: Build changes-Footnote-1505882
Ref: Build changes-Footnote-2505924
Ref: Build changes-Footnote-3505973
Ref: Build changes-Footnote-4506054
Ref: Build changes-Footnote-5506110
Ref: Build changes-Footnote-6506166
Ref: Build changes-Footnote-7506222
Ref: Build changes-Footnote-8506272
Ref: Build changes-Footnote-9506328
Ref: Build changes-Footnote-10506370
Ref: Build changes-Footnote-11506427
Ref: Build changes-Footnote-12506484
Ref: Build changes-Footnote-13506541
Ref: Build changes-Footnote-14506597
Ref: Build changes-Footnote-15506654
Node: build-details json506711
Ref: whatsnew/3 14 build-details-json506821
Ref: 447506821
Ref: whatsnew/3 14 whatsnew314-build-details506821
Ref: 448506821
Ref: build-details json-Footnote-1507570
Node: Discontinuation of PGP signatures507612
Ref: whatsnew/3 14 discontinuation-of-pgp-signatures507775
Ref: 44a507775
Ref: whatsnew/3 14 whatsnew314-no-more-pgp507775
Ref: 158507775
Ref: Discontinuation of PGP signatures-Footnote-1508211
Ref: Discontinuation of PGP signatures-Footnote-2508271
Ref: Discontinuation of PGP signatures-Footnote-3508305
Node: Free-threaded Python is officially supported508347
Ref: whatsnew/3 14 free-threaded-python-is-officially-supported508550
Ref: 44b508550
Ref: whatsnew/3 14 whatsnew314-free-threaded-now-supported508550
Ref: 157508550
Ref: Free-threaded Python is officially supported-Footnote-1509650
Ref: Free-threaded Python is officially supported-Footnote-2509693
Ref: Free-threaded Python is officially supported-Footnote-3509736
Ref: Free-threaded Python is officially supported-Footnote-4509778
Node: Binary releases for the experimental just-in-time compiler509825
Ref: whatsnew/3 14 binary-releases-for-the-experimental-just-in-time-compiler509986
Ref: 44c509986
Ref: whatsnew/3 14 whatsnew314-jit-compiler509986
Ref: 159509986
Ref: Binary releases for the experimental just-in-time compiler-Footnote-1511524
Node: Porting to Python 3 14511566
Ref: whatsnew/3 14 porting-to-python-3-14511706
Ref: 14b511706
Node: Python API の変更512062
Ref: whatsnew/3 14 changes-in-the-python-api512192
Ref: 451512192
Ref: Python API の変更-Footnote-1514586
Ref: Python API の変更-Footnote-2514642
Ref: Python API の変更-Footnote-3514697
Node: Changes in annotations PEP 649 and PEP 749514753
Ref: whatsnew/3 14 changes-in-annotations-pep-649-and-pep-749514907
Ref: 455514907
Ref: whatsnew/3 14 whatsnew314-porting-annotations514907
Ref: 161514907
Node: Implications for annotated code515472
Ref: whatsnew/3 14 implications-for-annotated-code515634
Ref: 456515634
Node: Implications for readers of __annotations__516425
Ref: whatsnew/3 14 implications-for-readers-of-annotations516611
Ref: 457516611
Ref: Implications for readers of __annotations__-Footnote-1517432
Node: Related changes517484
Ref: whatsnew/3 14 related-changes517673
Ref: 45a517673
Node: from __future__ import annotations518717
Ref: whatsnew/3 14 from-future-import-annotations518854
Ref: 45c518854
Ref: from __future__ import annotations-Footnote-1519523
Node: C API の変更519565
Ref: whatsnew/3 14 changes-in-the-c-api519690
Ref: 45e519690
Ref: whatsnew/3 14 whatsnew314-refcount520633
Ref: 2d0520633
Ref: C API の変更-Footnote-1522829
Ref: C API の変更-Footnote-2522885
Ref: C API の変更-Footnote-3522941
Node: Notable changes in 3 14 1522994
Ref: whatsnew/3 14 notable-changes-in-3-14-1523112
Ref: 464523112
Ref: whatsnew/3 14 pythoncapi-compat-project523112
Ref: 465523112
Ref: Notable changes in 3 14 1-Footnote-1523516
Node: What's New In Python 3 13523572
Ref: whatsnew/3 13 doc523722
Ref: 468523722
Ref: whatsnew/3 13 translation-repo523722
Ref: 469523722
Ref: whatsnew/3 13 what-s-new-in-python-3-13523722
Ref: 46a523722
Ref: What's New In Python 3 13-Footnote-1524632
Node: 概要 -- リリースハイライト<2>524674
Ref: whatsnew/3 13 summary-release-highlights524803
Ref: 46b524803
Ref: 概要 -- リリースハイライト<2>-Footnote-1534034
Ref: 概要 -- リリースハイライト<2>-Footnote-2534076
Ref: 概要 -- リリースハイライト<2>-Footnote-3534118
Ref: 概要 -- リリースハイライト<2>-Footnote-4534160
Ref: 概要 -- リリースハイライト<2>-Footnote-5534202
Ref: 概要 -- リリースハイライト<2>-Footnote-6534244
Ref: 概要 -- リリースハイライト<2>-Footnote-7534286
Ref: 概要 -- リリースハイライト<2>-Footnote-8534316
Ref: 概要 -- リリースハイライト<2>-Footnote-9534356
Ref: 概要 -- リリースハイライト<2>-Footnote-10534398
Ref: 概要 -- リリースハイライト<2>-Footnote-11534441
Ref: 概要 -- リリースハイライト<2>-Footnote-12534484
Ref: 概要 -- リリースハイライト<2>-Footnote-13534527
Ref: 概要 -- リリースハイライト<2>-Footnote-14534570
Ref: 概要 -- リリースハイライト<2>-Footnote-15534613
Ref: 概要 -- リリースハイライト<2>-Footnote-16534663
Ref: 概要 -- リリースハイライト<2>-Footnote-17534706
Ref: 概要 -- リリースハイライト<2>-Footnote-18534756
Ref: 概要 -- リリースハイライト<2>-Footnote-19534806
Node: 新しい機能<2>534849
Ref: whatsnew/3 13 new-features535011
Ref: 48f535011
Node: 改善された対話的インタープリタ535437
Ref: whatsnew/3 13 a-better-interactive-interpreter535582
Ref: 490535582
Ref: whatsnew/3 13 whatsnew313-better-interactive-interpreter535582
Ref: 46c535582
Ref: 改善された対話的インタープリタ-Footnote-1537497
Ref: 改善された対話的インタープリタ-Footnote-2537523
Node: エラーメッセージの改善<2>537579
Ref: whatsnew/3 13 improved-error-messages537765
Ref: 495537765
Ref: whatsnew/3 13 whatsnew313-improved-error-messages537765
Ref: 473537765
Ref: エラーメッセージの改善<2>-Footnote-1540672
Ref: エラーメッセージの改善<2>-Footnote-2540702
Ref: エラーメッセージの改善<2>-Footnote-3540735
Ref: エラーメッセージの改善<2>-Footnote-4540791
Ref: エラーメッセージの改善<2>-Footnote-5540846
Node: フリースレッドの CPython540902
Ref: whatsnew/3 13 free-threaded-cpython541088
Ref: 496541088
Ref: whatsnew/3 13 whatsnew313-free-threaded-cpython541088
Ref: 46d541088
Ref: フリースレッドの CPython-Footnote-1545249
Ref: フリースレッドの CPython-Footnote-2545291
Node: 実験的な Just-in-time JIT コンパイラ545344
Ref: whatsnew/3 13 an-experimental-just-in-time-jit-compiler545531
Ref: 49e545531
Ref: whatsnew/3 13 whatsnew313-jit-compiler545531
Ref: 46e545531
Ref: 実験的な Just-in-time JIT コンパイラ-Footnote-1548269
Ref: 実験的な Just-in-time JIT コンパイラ-Footnote-2548341
Node: Defined mutation semantics for locals548383
Ref: whatsnew/3 13 defined-mutation-semantics-for-locals548566
Ref: 4a0548566
Ref: whatsnew/3 13 whatsnew313-locals-semantics548566
Ref: 470548566
Ref: Defined mutation semantics for locals-Footnote-1551177
Ref: Defined mutation semantics for locals-Footnote-2551219
Ref: Defined mutation semantics for locals-Footnote-3551261
Node: Support for mobile platforms551316
Ref: whatsnew/3 13 support-for-mobile-platforms551445
Ref: 4a8551445
Ref: whatsnew/3 13 whatsnew313-platform-support551445
Ref: 48d551445
Ref: Support for mobile platforms-Footnote-1552486
Ref: Support for mobile platforms-Footnote-2552528
Ref: Support for mobile platforms-Footnote-3552570
Ref: Support for mobile platforms-Footnote-4552626
Ref: Support for mobile platforms-Footnote-5552668
Ref: Support for mobile platforms-Footnote-6552710
Ref: Support for mobile platforms-Footnote-7552766
Ref: Support for mobile platforms-Footnote-8552808
Node: その他の言語変更552850
Ref: whatsnew/3 13 other-language-changes552996
Ref: 4a9552996
Ref: その他の言語変更-Footnote-1557823
Ref: その他の言語変更-Footnote-2557878
Ref: その他の言語変更-Footnote-3557934
Ref: その他の言語変更-Footnote-4557990
Ref: その他の言語変更-Footnote-5558046
Ref: その他の言語変更-Footnote-6558102
Ref: その他の言語変更-Footnote-7558158
Ref: その他の言語変更-Footnote-8558207
Ref: その他の言語変更-Footnote-9558263
Ref: その他の言語変更-Footnote-10558318
Ref: その他の言語変更-Footnote-11558375
Ref: その他の言語変更-Footnote-12558432
Ref: その他の言語変更-Footnote-13558489
Ref: その他の言語変更-Footnote-14558546
Ref: その他の言語変更-Footnote-15558603
Ref: その他の言語変更-Footnote-16558660
Ref: その他の言語変更-Footnote-17558717
Ref: その他の言語変更-Footnote-18558773
Node: 新たなモジュール558830
Ref: whatsnew/3 13 new-modules558988
Ref: 4b9558988
Ref: 新たなモジュール-Footnote-1559230
Node: 改良されたモジュール559286
Ref: whatsnew/3 13 improved-modules559432
Ref: 4ba559432
Node: argparse<3>560381
Ref: whatsnew/3 13 argparse560474
Ref: 4bb560474
Ref: argparse<3>-Footnote-1560797
Node: 配列560852
Ref: whatsnew/3 13 array560960
Ref: 4bd560960
Ref: 配列-Footnote-1561396
Ref: 配列-Footnote-2561451
Node: ast<3>561507
Ref: whatsnew/3 13 ast561614
Ref: 4c1561614
Ref: ast<3>-Footnote-1563174
Ref: ast<3>-Footnote-2563230
Ref: ast<3>-Footnote-3563286
Ref: ast<3>-Footnote-4563342
Node: asyncio<4>563398
Ref: whatsnew/3 13 asyncio563508
Ref: 4c5563508
Ref: asyncio<4>-Footnote-1567268
Ref: asyncio<4>-Footnote-2567323
Ref: asyncio<4>-Footnote-3567379
Ref: asyncio<4>-Footnote-4567435
Ref: asyncio<4>-Footnote-5567491
Ref: asyncio<4>-Footnote-6567547
Ref: asyncio<4>-Footnote-7567602
Ref: asyncio<4>-Footnote-8567658
Ref: asyncio<4>-Footnote-9567714
Node: base64<2>567770
Ref: whatsnew/3 13 base64567884
Ref: 4d8567884
Ref: base64<2>-Footnote-1568179
Ref: base64<2>-Footnote-2568219
Node: compileall568274
Ref: whatsnew/3 13 compileall568399
Ref: 4d9568399
Ref: compileall-Footnote-1568691
Node: concurrent futures<2>568747
Ref: whatsnew/3 13 concurrent-futures568878
Ref: 4dc568878
Ref: concurrent futures<2>-Footnote-1569186
Node: configparser<2>569242
Ref: whatsnew/3 13 configparser569367
Ref: 4dd569367
Ref: configparser<2>-Footnote-1569697
Node: copy569752
Ref: whatsnew/3 13 copy569865
Ref: 4df569865
Ref: copy-Footnote-1570782
Node: ctypes<2>570838
Ref: whatsnew/3 13 ctypes570939
Ref: 4e7570939
Ref: ctypes<2>-Footnote-1571872
Ref: ctypes<2>-Footnote-2571928
Node: dbm571984
Ref: whatsnew/3 13 dbm572087
Ref: 4e9572087
Ref: dbm-Footnote-1572541
Ref: dbm-Footnote-2572597
Node: dis<2>572653
Ref: whatsnew/3 13 dis572754
Ref: 4ea572754
Ref: dis<2>-Footnote-1573508
Ref: dis<2>-Footnote-2573564
Node: doctest573620
Ref: whatsnew/3 13 doctest573726
Ref: 4ed573726
Ref: whatsnew/3 13 whatsnew313-doctest573726
Ref: 475573726
Ref: doctest-Footnote-1574369
Ref: doctest-Footnote-2574399
Ref: doctest-Footnote-3574432
Ref: doctest-Footnote-4574488
Node: email<2>574544
Ref: whatsnew/3 13 email574648
Ref: 4f1574648
Ref: email<2>-Footnote-1575780
Ref: email<2>-Footnote-2575836
Ref: email<2>-Footnote-3575892
Node: enum575948
Ref: whatsnew/3 13 enum576057
Ref: 4f5576057
Node: fractions<2>576190
Ref: whatsnew/3 13 fractions576295
Ref: 4f8576295
Ref: fractions<2>-Footnote-1576613
Node: glob576669
Ref: whatsnew/3 13 glob576779
Ref: 4fa576779
Ref: glob-Footnote-1577028
Node: importlib577083
Ref: whatsnew/3 13 importlib577186
Ref: 4fc577186
Ref: importlib-Footnote-1578087
Ref: importlib-Footnote-2578143
Node: io<3>578199
Ref: whatsnew/3 13 io578307
Ref: 504578307
Ref: io<3>-Footnote-1578733
Node: ipaddress578788
Ref: whatsnew/3 13 ipaddress578899
Ref: 50a578899
Ref: ipaddress-Footnote-1579358
Ref: ipaddress-Footnote-2579414
Node: itertools<2>579470
Ref: whatsnew/3 13 itertools579583
Ref: 510579583
Ref: itertools<2>-Footnote-1579883
Node: marshal579939
Ref: whatsnew/3 13 marshal580050
Ref: 512580050
Ref: marshal-Footnote-1580385
Node: math<2>580441
Ref: whatsnew/3 13 math580552
Ref: 513580552
Ref: math<2>-Footnote-1581043
Node: mimetypes<2>581098
Ref: whatsnew/3 13 mimetypes581206
Ref: 515581206
Ref: mimetypes<2>-Footnote-1581523
Node: mmap581578
Ref: whatsnew/3 13 mmap581697
Ref: 518581697
Ref: mmap-Footnote-1582510
Ref: mmap-Footnote-2582566
Ref: mmap-Footnote-3582622
Node: multiprocessing<2>582677
Ref: whatsnew/3 13 multiprocessing582789
Ref: 51c582789
Ref: multiprocessing<2>-Footnote-1583093
Node: os<2>583149
Ref: whatsnew/3 13 os583267
Ref: 51d583267
Ref: os<2>-Footnote-1585733
Ref: os<2>-Footnote-2585789
Ref: os<2>-Footnote-3585845
Ref: os<2>-Footnote-4585899
Ref: os<2>-Footnote-5585955
Ref: os<2>-Footnote-6586010
Ref: os<2>-Footnote-7586066
Ref: os<2>-Footnote-8586121
Ref: os<2>-Footnote-9586177
Ref: os<2>-Footnote-10586233
Node: os path<2>586290
Ref: whatsnew/3 13 os-path586400
Ref: 530586400
Ref: os path<2>-Footnote-1587023
Ref: os path<2>-Footnote-2587078
Ref: os path<2>-Footnote-3587133
Node: pathlib<4>587188
Ref: whatsnew/3 13 pathlib587299
Ref: 532587299
Ref: pathlib<4>-Footnote-1588813
Ref: pathlib<4>-Footnote-2588868
Ref: pathlib<4>-Footnote-3588924
Ref: pathlib<4>-Footnote-4588979
Ref: pathlib<4>-Footnote-5589034
Ref: pathlib<4>-Footnote-6589089
Ref: pathlib<4>-Footnote-7589145
Node: pdb<3>589201
Ref: whatsnew/3 13 pdb589307
Ref: 53d589307
Ref: pdb<3>-Footnote-1590442
Ref: pdb<3>-Footnote-2590498
Ref: pdb<3>-Footnote-3590554
Ref: pdb<3>-Footnote-4590610
Ref: pdb<3>-Footnote-5590666
Node: queue590722
Ref: whatsnew/3 13 queue590824
Ref: 541590824
Ref: queue-Footnote-1591059
Node: random591115
Ref: whatsnew/3 13 random591216
Ref: 544591216
Ref: random-Footnote-1591390
Node: re<2>591446
Ref: whatsnew/3 13 re591548
Ref: 545591548
Node: shutil591707
Ref: whatsnew/3 13 shutil591807
Ref: 547591807
Ref: shutil-Footnote-1592035
Node: site592090
Ref: whatsnew/3 13 site592195
Ref: 549592195
Ref: site-Footnote-1592446
Node: sqlite3<2>592502
Ref: whatsnew/3 13 sqlite3592607
Ref: 54b592607
Ref: sqlite3<2>-Footnote-1593048
Ref: sqlite3<2>-Footnote-2593104
Node: ssl<2>593159
Ref: whatsnew/3 13 ssl593270
Ref: 550593270
Ref: ssl<2>-Footnote-1593961
Ref: ssl<2>-Footnote-2594020
Node: statistics594076
Ref: whatsnew/3 13 statistics594187
Ref: 552594187
Ref: statistics-Footnote-1594696
Ref: statistics-Footnote-2594752
Node: subprocess594808
Ref: whatsnew/3 13 subprocess594919
Ref: 555594919
Ref: whatsnew/3 13 whatsnew313-subprocess594919
Ref: 556594919
Ref: subprocess-Footnote-1595859
Node: sys<2>595915
Ref: whatsnew/3 13 sys596024
Ref: 558596024
Ref: sys<2>-Footnote-1596313
Node: tempfile596368
Ref: whatsnew/3 13 tempfile596471
Ref: 55a596471
Ref: tempfile-Footnote-1596816
Ref: tempfile-Footnote-2596871
Node: time596927
Ref: whatsnew/3 13 time597034
Ref: 55b597034
Ref: time-Footnote-1597682
Ref: time-Footnote-2597737
Node: tkinter<2>597792
Ref: whatsnew/3 13 tkinter597900
Ref: 55e597900
Ref: tkinter<2>-Footnote-1600164
Ref: tkinter<2>-Footnote-2600219
Ref: tkinter<2>-Footnote-3600274
Ref: tkinter<2>-Footnote-4600329
Ref: tkinter<2>-Footnote-5600384
Ref: tkinter<2>-Footnote-6600439
Ref: tkinter<2>-Footnote-7600494
Ref: tkinter<2>-Footnote-8600550
Ref: tkinter<2>-Footnote-9600606
Node: traceback600662
Ref: whatsnew/3 13 traceback600774
Ref: 561600774
Ref: traceback-Footnote-1601504
Ref: traceback-Footnote-2601560
Node: types<2>601616
Ref: whatsnew/3 13 types601727
Ref: 567601727
Ref: types<2>-Footnote-1602052
Node: typing<2>602108
Ref: whatsnew/3 13 typing602224
Ref: 568602224
Ref: typing<2>-Footnote-1603210
Ref: typing<2>-Footnote-2603252
Ref: typing<2>-Footnote-3603294
Ref: typing<2>-Footnote-4603350
Ref: typing<2>-Footnote-5603406
Ref: typing<2>-Footnote-6603462
Node: unicodedata<2>603517
Ref: whatsnew/3 13 unicodedata603629
Ref: 56f603629
Ref: unicodedata<2>-Footnote-1603817
Ref: unicodedata<2>-Footnote-2603873
Node: venv603929
Ref: whatsnew/3 13 venv604040
Ref: 570604040
Ref: venv-Footnote-1604532
Node: warnings604588
Ref: whatsnew/3 13 warnings604688
Ref: 573604688
Ref: warnings-Footnote-1605152
Ref: warnings-Footnote-2605194
Node: xml605250
Ref: whatsnew/3 13 xml605355
Ref: 575605355
Ref: xml-Footnote-1606121
Ref: xml-Footnote-2606177
Ref: xml-Footnote-3606233
Node: zipimport606288
Ref: whatsnew/3 13 zipimport606376
Ref: 57b606376
Ref: zipimport-Footnote-1606580
Ref: zipimport-Footnote-2606642
Node: 最適化<2>606697
Ref: whatsnew/3 13 optimizations606843
Ref: 57c606843
Ref: 最適化<2>-Footnote-1608039
Ref: 最適化<2>-Footnote-2608095
Ref: 最適化<2>-Footnote-3608151
Node: Removed Modules And APIs608207
Ref: whatsnew/3 13 removed-modules-and-apis608339
Ref: 57e608339
Node: PEP 594 Remove "dead batteries" from the standard library608846
Ref: whatsnew/3 13 pep-594-remove-dead-batteries-from-the-standard-library608977
Ref: 57f608977
Ref: whatsnew/3 13 whatsnew313-pep594608977
Ref: 471608977
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-1614235
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-2614277
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-3614325
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-4614371
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-5614420
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-6614464
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-7614508
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-8614555
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-9614604
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-10614645
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-11614692
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-12614739
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-13614782
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-14614830
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-15614880
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-16614944
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-17614988
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-18615033
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-19615081
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-20615132
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-21615184
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-22615226
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-23615278
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-24615320
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-25615370
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-26615414
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-27615459
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-28615507
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-29615558
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-30615604
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-31615654
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-32615700
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-33615744
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-34615798
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-35615845
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-36615896
Ref: PEP 594 Remove "dead batteries" from the standard library-Footnote-37615953
Node: 2to3616010
Ref: whatsnew/3 13 to3616158
Ref: 583616158
Ref: 2to3-Footnote-1616385
Node: builtins616441
Ref: whatsnew/3 13 builtins616547
Ref: 584616547
Ref: builtins-Footnote-1617288
Ref: builtins-Footnote-2617343
Ref: builtins-Footnote-3617398
Node: configparser<3>617453
Ref: whatsnew/3 13 id3617573
Ref: 586617573
Ref: configparser<3>-Footnote-1617857
Node: importlib metadata617913
Ref: whatsnew/3 13 importlib-metadata618031
Ref: 587618031
Ref: importlib metadata-Footnote-1618288
Node: locale618344
Ref: whatsnew/3 13 locale618453
Ref: 58a618453
Ref: locale-Footnote-1618716
Node: opcode618772
Ref: whatsnew/3 13 opcode618871
Ref: 58b618871
Ref: opcode-Footnote-1619496
Ref: opcode-Footnote-2619552
Node: optparse619608
Ref: whatsnew/3 13 optparse619711
Ref: 58c619711
Ref: optparse-Footnote-1620499
Node: pathlib<5>620555
Ref: whatsnew/3 13 id4620657
Ref: 58d620657
Ref: pathlib<5>-Footnote-1620935
Node: re<3>620990
Ref: whatsnew/3 13 id5621095
Ref: 58e621095
Ref: re<3>-Footnote-1621361
Node: tkinter tix621417
Ref: whatsnew/3 13 tkinter-tix621521
Ref: 58f621521
Ref: tkinter tix-Footnote-1621796
Node: turtle<2>621851
Ref: whatsnew/3 13 turtle621959
Ref: 590621959
Ref: turtle<2>-Footnote-1622237
Node: typing<3>622293
Ref: whatsnew/3 13 id6622401
Ref: 591622401
Ref: typing<3>-Footnote-1622887
Ref: typing<3>-Footnote-2622942
Node: unittest<2>622998
Ref: whatsnew/3 13 unittest623106
Ref: 592623106
Ref: unittest<2>-Footnote-1623808
Ref: unittest<2>-Footnote-2623864
Node: urllib<3>623920
Ref: whatsnew/3 13 urllib624032
Ref: 597624032
Ref: urllib<3>-Footnote-1624637
Node: webbrowser<2>624693
Ref: whatsnew/3 13 webbrowser624785
Ref: 599624785
Ref: webbrowser<2>-Footnote-1625276
Ref: webbrowser<2>-Footnote-2625332
Node: New Deprecations625388
Ref: whatsnew/3 13 new-deprecations625532
Ref: 59b625532
Ref: New Deprecations-Footnote-1634128
Ref: New Deprecations-Footnote-2634183
Ref: New Deprecations-Footnote-3634238
Ref: New Deprecations-Footnote-4634294
Ref: New Deprecations-Footnote-5634350
Ref: New Deprecations-Footnote-6634405
Ref: New Deprecations-Footnote-7634461
Ref: New Deprecations-Footnote-8634516
Ref: New Deprecations-Footnote-9634572
Ref: New Deprecations-Footnote-10634628
Ref: New Deprecations-Footnote-11634685
Ref: New Deprecations-Footnote-12634741
Ref: New Deprecations-Footnote-13634797
Ref: New Deprecations-Footnote-14634853
Ref: New Deprecations-Footnote-15634910
Ref: New Deprecations-Footnote-16634966
Ref: New Deprecations-Footnote-17635023
Ref: New Deprecations-Footnote-18635080
Ref: New Deprecations-Footnote-19635137
Ref: New Deprecations-Footnote-20635193
Ref: New Deprecations-Footnote-21635250
Ref: New Deprecations-Footnote-22635307
Ref: New Deprecations-Footnote-23635364
Ref: New Deprecations-Footnote-24635421
Ref: New Deprecations-Footnote-25635478
Ref: New Deprecations-Footnote-26635535
Ref: New Deprecations-Footnote-27635592
Node: Pending removal in Python 3 14635649
Ref: whatsnew/3 13 pending-removal-in-python-3-14635774
Ref: 5ae635774
Ref: Pending removal in Python 3 14-Footnote-1639992
Ref: Pending removal in Python 3 14-Footnote-2640047
Ref: Pending removal in Python 3 14-Footnote-3640102
Ref: Pending removal in Python 3 14-Footnote-4640157
Ref: Pending removal in Python 3 14-Footnote-5640212
Ref: Pending removal in Python 3 14-Footnote-6640268
Ref: Pending removal in Python 3 14-Footnote-7640323
Ref: Pending removal in Python 3 14-Footnote-8640378
Ref: Pending removal in Python 3 14-Footnote-9640434
Ref: Pending removal in Python 3 14-Footnote-10640489
Ref: Pending removal in Python 3 14-Footnote-11640545
Node: Pending removal in Python 3 15<3>640601
Ref: whatsnew/3 13 pending-removal-in-python-3-15640768
Ref: 5b3640768
Ref: Pending removal in Python 3 15<3>-Footnote-1645323
Ref: Pending removal in Python 3 15<3>-Footnote-2645378
Ref: Pending removal in Python 3 15<3>-Footnote-3645433
Ref: Pending removal in Python 3 15<3>-Footnote-4645488
Ref: Pending removal in Python 3 15<3>-Footnote-5645544
Ref: Pending removal in Python 3 15<3>-Footnote-6645586
Ref: Pending removal in Python 3 15<3>-Footnote-7645642
Node: Pending removal in Python 3 16<3>645698
Ref: whatsnew/3 13 pending-removal-in-python-3-16645868
Ref: 5b4645868
Ref: Pending removal in Python 3 16<3>-Footnote-1650109
Ref: Pending removal in Python 3 16<3>-Footnote-2650165
Ref: Pending removal in Python 3 16<3>-Footnote-3650221
Ref: Pending removal in Python 3 16<3>-Footnote-4650277
Node: Pending removal in Python 3 17<2>650332
Ref: whatsnew/3 13 pending-removal-in-python-3-17650502
Ref: 5b5650502
Ref: Pending removal in Python 3 17<2>-Footnote-1653436
Ref: Pending removal in Python 3 17<2>-Footnote-2653494
Ref: Pending removal in Python 3 17<2>-Footnote-3653549
Ref: Pending removal in Python 3 17<2>-Footnote-4653607
Node: Pending removal in Python 3 18<3>653662
Ref: whatsnew/3 13 pending-removal-in-python-3-18653832
Ref: 5b6653832
Ref: Pending removal in Python 3 18<3>-Footnote-1654258
Node: Pending removal in Python 3 19<2>654313
Ref: whatsnew/3 13 pending-removal-in-python-3-19654487
Ref: 5b7654487
Node: Pending removal in future versions<3>654765
Ref: whatsnew/3 13 pending-removal-in-future-versions654897
Ref: 5b8654897
Ref: Pending removal in future versions<3>-Footnote-1662094
Ref: Pending removal in future versions<3>-Footnote-2662149
Ref: Pending removal in future versions<3>-Footnote-3662205
Ref: Pending removal in future versions<3>-Footnote-4662261
Ref: Pending removal in future versions<3>-Footnote-5662317
Ref: Pending removal in future versions<3>-Footnote-6662372
Ref: Pending removal in future versions<3>-Footnote-7662427
Node: CPython Bytecode Changes662483
Ref: whatsnew/3 13 cpython-bytecode-changes662621
Ref: 5b9662621
Ref: CPython Bytecode Changes-Footnote-1663062
Node: C API の変更<2>663118
Ref: whatsnew/3 13 c-api-changes663253
Ref: 5bc663253
Node: 新しい機能<3>663471
Ref: whatsnew/3 13 id7663567
Ref: 5bd663567
Ref: 新しい機能<3>-Footnote-1674483
Ref: 新しい機能<3>-Footnote-2674525
Ref: 新しい機能<3>-Footnote-3674581
Ref: 新しい機能<3>-Footnote-4674637
Ref: 新しい機能<3>-Footnote-5674693
Ref: 新しい機能<3>-Footnote-6674749
Ref: 新しい機能<3>-Footnote-7674805
Ref: 新しい機能<3>-Footnote-8674861
Ref: 新しい機能<3>-Footnote-9674917
Ref: 新しい機能<3>-Footnote-10674973
Ref: 新しい機能<3>-Footnote-11675030
Ref: 新しい機能<3>-Footnote-12675087
Ref: 新しい機能<3>-Footnote-13675143
Ref: 新しい機能<3>-Footnote-14675200
Ref: 新しい機能<3>-Footnote-15675257
Ref: 新しい機能<3>-Footnote-16675314
Ref: 新しい機能<3>-Footnote-17675371
Ref: 新しい機能<3>-Footnote-18675428
Ref: 新しい機能<3>-Footnote-19675485
Ref: 新しい機能<3>-Footnote-20675542
Ref: 新しい機能<3>-Footnote-21675598
Ref: 新しい機能<3>-Footnote-22675655
Ref: 新しい機能<3>-Footnote-23675712
Ref: 新しい機能<3>-Footnote-24675766
Ref: 新しい機能<3>-Footnote-25675823
Ref: 新しい機能<3>-Footnote-26675879
Ref: 新しい機能<3>-Footnote-27675935
Ref: 新しい機能<3>-Footnote-28675992
Ref: 新しい機能<3>-Footnote-29676049
Ref: 新しい機能<3>-Footnote-30676106
Ref: 新しい機能<3>-Footnote-31676163
Ref: 新しい機能<3>-Footnote-32676220
Node: Changed C APIs676277
Ref: whatsnew/3 13 changed-c-apis676403
Ref: 623676403
Ref: Changed C APIs-Footnote-1678998
Ref: Changed C APIs-Footnote-2679053
Ref: Changed C APIs-Footnote-3679109
Ref: Changed C APIs-Footnote-4679165
Ref: Changed C APIs-Footnote-5679221
Ref: Changed C APIs-Footnote-6679263
Ref: Changed C APIs-Footnote-7679319
Ref: Changed C APIs-Footnote-8679375
Node: Limited C API Changes679431
Ref: whatsnew/3 13 limited-c-api-changes679556
Ref: 630679556
Ref: Limited C API Changes-Footnote-1680259
Ref: Limited C API Changes-Footnote-2680314
Ref: Limited C API Changes-Footnote-3680370
Node: Removed C APIs<2>680426
Ref: whatsnew/3 13 removed-c-apis680557
Ref: 638680557
Ref: Removed C APIs<2>-Footnote-1686920
Ref: Removed C APIs<2>-Footnote-2686976
Ref: Removed C APIs<2>-Footnote-3687031
Ref: Removed C APIs<2>-Footnote-4687087
Ref: Removed C APIs<2>-Footnote-5687129
Ref: Removed C APIs<2>-Footnote-6687185
Ref: Removed C APIs<2>-Footnote-7687241
Ref: Removed C APIs<2>-Footnote-8687297
Ref: Removed C APIs<2>-Footnote-9687350
Ref: Removed C APIs<2>-Footnote-10687406
Ref: Removed C APIs<2>-Footnote-11687449
Ref: Removed C APIs<2>-Footnote-12687506
Ref: Removed C APIs<2>-Footnote-13687563
Ref: Removed C APIs<2>-Footnote-14687620
Node: Deprecated C APIs<2>687677
Ref: whatsnew/3 13 deprecated-c-apis687778
Ref: 64d687778
Ref: Deprecated C APIs<2>-Footnote-1690533
Ref: Deprecated C APIs<2>-Footnote-2690589
Ref: Deprecated C APIs<2>-Footnote-3690631
Ref: Deprecated C APIs<2>-Footnote-4690687
Ref: Deprecated C APIs<2>-Footnote-5690742
Ref: Deprecated C APIs<2>-Footnote-6690798
Ref: Deprecated C APIs<2>-Footnote-7690851
Node: Pending removal in Python 3 14<2>690907
Ref: whatsnew/3 13 id8691039
Ref: 64e691039
Ref: Pending removal in Python 3 14<2>-Footnote-1691359
Ref: Pending removal in Python 3 14<2>-Footnote-2691401
Ref: Pending removal in Python 3 14<2>-Footnote-3691457
Node: Pending removal in Python 3 15<4>691512
Ref: whatsnew/3 13 id9691686
Ref: 650691686
Ref: Pending removal in Python 3 15<4>-Footnote-1698335
Ref: Pending removal in Python 3 15<4>-Footnote-2698388
Node: Pending removal in Python 3 16<4>698441
Ref: whatsnew/3 13 id10698615
Ref: 651698615
Node: Pending removal in Python 3 18<4>698738
Ref: whatsnew/3 13 id11698916
Ref: 652698916
Ref: Pending removal in Python 3 18<4>-Footnote-1701591
Ref: Pending removal in Python 3 18<4>-Footnote-2701644
Node: Pending removal in future versions<4>701700
Ref: whatsnew/3 13 id12701836
Ref: 653701836
Node: Build Changes703677
Ref: whatsnew/3 13 build-changes703810
Ref: 654703810
Ref: whatsnew/3 13 pythoncapi-compat-project703810
Ref: 655703810
Ref: Build Changes-Footnote-1706388
Ref: Build Changes-Footnote-2706430
Ref: Build Changes-Footnote-3706486
Ref: Build Changes-Footnote-4706528
Ref: Build Changes-Footnote-5706584
Ref: Build Changes-Footnote-6706626
Ref: Build Changes-Footnote-7706682
Ref: Build Changes-Footnote-8706724
Ref: Build Changes-Footnote-9706780
Ref: Build Changes-Footnote-10706835
Ref: Build Changes-Footnote-11706892
Ref: Build Changes-Footnote-12706949
Ref: Build Changes-Footnote-13706997
Ref: Build Changes-Footnote-14707054
Ref: Build Changes-Footnote-15707111
Ref: Build Changes-Footnote-16707168
Node: Porting to Python 3 13707224
Ref: whatsnew/3 13 porting-to-python-3-13707362
Ref: 472707362
Node: Python API の変更<2>707669
Ref: whatsnew/3 13 changes-in-the-python-api707778
Ref: 658707778
Ref: whatsnew/3 13 pep667-porting-notes-py707836
Ref: 4a6707836
Ref: Python API の変更<2>-Footnote-1711371
Ref: Python API の変更<2>-Footnote-2711413
Ref: Python API の変更<2>-Footnote-3711455
Ref: Python API の変更<2>-Footnote-4711497
Ref: Python API の変更<2>-Footnote-5711539
Ref: Python API の変更<2>-Footnote-6711595
Ref: Python API の変更<2>-Footnote-7711651
Ref: Python API の変更<2>-Footnote-8711706
Node: C API の変更<3>711762
Ref: whatsnew/3 13 changes-in-the-c-api711871
Ref: 65f711871
Ref: whatsnew/3 13 pep667-porting-notes-c714513
Ref: 4a7714513
Ref: C API の変更<3>-Footnote-1718289
Ref: C API の変更<3>-Footnote-2718345
Ref: C API の変更<3>-Footnote-3718401
Ref: C API の変更<3>-Footnote-4718457
Ref: C API の変更<3>-Footnote-5718512
Ref: C API の変更<3>-Footnote-6718568
Node: Regression Test Changes718621
Ref: whatsnew/3 13 regression-test-changes718737
Ref: 665718737
Ref: Regression Test Changes-Footnote-1719178
Node: What's New In Python 3 12719234
Ref: whatsnew/3 12 doc719384
Ref: 667719384
Ref: whatsnew/3 12 translation-repo719384
Ref: 668719384
Ref: whatsnew/3 12 what-s-new-in-python-3-12719384
Ref: 669719384
Ref: What's New In Python 3 12-Footnote-1720470
Node: 概要 -- リリースハイライト<3>720512
Ref: whatsnew/3 12 summary-release-highlights720641
Ref: 66a720641
Ref: 概要 -- リリースハイライト<3>-Footnote-1726199
Ref: 概要 -- リリースハイライト<3>-Footnote-2726247
Ref: 概要 -- リリースハイライト<3>-Footnote-3726289
Ref: 概要 -- リリースハイライト<3>-Footnote-4726331
Ref: 概要 -- リリースハイライト<3>-Footnote-5726390
Ref: 概要 -- リリースハイライト<3>-Footnote-6726469
Node: 新しい機能<4>726524
Ref: whatsnew/3 12 new-features726704
Ref: 680726704
Node: PEP 695 型パラメータの構文727423
Ref: whatsnew/3 12 pep-695-type-parameter-syntax727564
Ref: 681727564
Ref: whatsnew/3 12 whatsnew312-pep695727564
Ref: 66c727564
Ref: PEP 695 型パラメータの構文-Footnote-1730746
Ref: PEP 695 型パラメータの構文-Footnote-2730788
Ref: PEP 695 型パラメータの構文-Footnote-3730830
Ref: PEP 695 型パラメータの構文-Footnote-4730872
Node: PEP 701 f-strings の構文的な形式化730928
Ref: whatsnew/3 12 pep-701-syntactic-formalization-of-f-strings731120
Ref: 686731120
Ref: whatsnew/3 12 whatsnew312-pep701731120
Ref: 66f731120
Ref: PEP 701 f-strings の構文的な形式化-Footnote-1736383
Ref: PEP 701 f-strings の構文的な形式化-Footnote-2736425
Ref: PEP 701 f-strings の構文的な形式化-Footnote-3736467
Ref: PEP 701 f-strings の構文的な形式化-Footnote-4736509
Node: PEP 684 インタープリタごとの GIL736565
Ref: whatsnew/3 12 pep-684-a-per-interpreter-gil736768
Ref: 688736768
Ref: whatsnew/3 12 whatsnew312-pep684736768
Ref: 670736768
Ref: PEP 684 インタープリタごとの GIL-Footnote-1738060
Ref: PEP 684 インタープリタごとの GIL-Footnote-2738102
Ref: PEP 684 インタープリタごとの GIL-Footnote-3738144
Node: PEP 669 CPython の低影響モニタリング738200
Ref: whatsnew/3 12 pep-669-low-impact-monitoring-for-cpython738431
Ref: 68a738431
Ref: whatsnew/3 12 whatsnew312-pep669738431
Ref: 671738431
Ref: PEP 669 CPython の低影響モニタリング-Footnote-1739177
Ref: PEP 669 CPython の低影響モニタリング-Footnote-2739219
Node: PEP 688 バッファプロトコルを Python で利用可能にする739275
Ref: whatsnew/3 12 pep-688-making-the-buffer-protocol-accessible-in-python739505
Ref: 68b739505
Ref: whatsnew/3 12 whatsnew312-pep688739505
Ref: 673739505
Ref: PEP 688 バッファプロトコルを Python で利用可能にする-Footnote-1740285
Ref: PEP 688 バッファプロトコルを Python で利用可能にする-Footnote-2740327
Node: PEP 709 内包表記のインライン化740383
Ref: whatsnew/3 12 pep-709-comprehension-inlining740603
Ref: 68e740603
Ref: whatsnew/3 12 whatsnew312-pep709740603
Ref: 679740603
Ref: PEP 709 内包表記のインライン化-Footnote-1742396
Ref: PEP 709 内包表記のインライン化-Footnote-2742438
Node: エラーメッセージの改善<3>742480
Ref: whatsnew/3 12 improved-error-messages742621
Ref: 672742621
Ref: エラーメッセージの改善<3>-Footnote-1744986
Ref: エラーメッセージの改善<3>-Footnote-2745041
Ref: エラーメッセージの改善<3>-Footnote-3745096
Ref: エラーメッセージの改善<3>-Footnote-4745151
Node: 型ヒントに関連する新しい機能745206
Ref: whatsnew/3 12 new-features-related-to-type-hints745373
Ref: 68f745373
Ref: 型ヒントに関連する新しい機能-Footnote-1745812
Node: PEP 692 Using TypedDict for more precise **kwargs typing745854
Ref: whatsnew/3 12 pep-692-using-typeddict-for-more-precise-kwargs-typing746042
Ref: 690746042
Ref: whatsnew/3 12 whatsnew312-pep692746042
Ref: 67a746042
Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-1746764
Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-2746806
Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-3746848
Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-4746890
Node: PEP 698 Override Decorator for Static Typing746946
Ref: whatsnew/3 12 pep-698-override-decorator-for-static-typing747134
Ref: 691747134
Ref: whatsnew/3 12 whatsnew312-pep698747134
Ref: 67c747134
Ref: PEP 698 Override Decorator for Static Typing-Footnote-1748138
Ref: PEP 698 Override Decorator for Static Typing-Footnote-2748180
Node: その他の言語変更<2>748236
Ref: whatsnew/3 12 other-language-changes748412
Ref: 692748412
Ref: その他の言語変更<2>-Footnote-1753094
Ref: その他の言語変更<2>-Footnote-2753149
Ref: その他の言語変更<2>-Footnote-3753204
Ref: その他の言語変更<2>-Footnote-4753259
Ref: その他の言語変更<2>-Footnote-5753301
Ref: その他の言語変更<2>-Footnote-6753357
Ref: その他の言語変更<2>-Footnote-7753399
Ref: その他の言語変更<2>-Footnote-8753454
Ref: その他の言語変更<2>-Footnote-9753510
Ref: その他の言語変更<2>-Footnote-10753565
Ref: その他の言語変更<2>-Footnote-11753621
Ref: その他の言語変更<2>-Footnote-12753677
Ref: その他の言語変更<2>-Footnote-13753734
Ref: その他の言語変更<2>-Footnote-14753791
Ref: その他の言語変更<2>-Footnote-15753847
Ref: その他の言語変更<2>-Footnote-16753890
Ref: その他の言語変更<2>-Footnote-17753946
Node: 新たなモジュール<2>754002
Ref: whatsnew/3 12 new-modules754169
Ref: 69d754169
Node: 改良されたモジュール<2>754236
Ref: whatsnew/3 12 improved-modules754388
Ref: 69e754388
Node: array755123
Ref: whatsnew/3 12 array755217
Ref: 69f755217
Ref: array-Footnote-1755445
Node: asyncio<5>755500
Ref: whatsnew/3 12 asyncio755614
Ref: 6a0755614
Ref: asyncio<5>-Footnote-1757577
Ref: asyncio<5>-Footnote-2757632
Ref: asyncio<5>-Footnote-3757688
Ref: asyncio<5>-Footnote-4757744
Ref: asyncio<5>-Footnote-5757800
Ref: asyncio<5>-Footnote-6757855
Ref: asyncio<5>-Footnote-7757910
Ref: asyncio<5>-Footnote-8757965
Ref: asyncio<5>-Footnote-9758021
Ref: asyncio<5>-Footnote-10758077
Node: calendar<2>758133
Ref: whatsnew/3 12 calendar758245
Ref: 6a8758245
Ref: calendar<2>-Footnote-1758497
Node: csv758553
Ref: whatsnew/3 12 csv758661
Ref: 6ab758661
Node: dis<3>758895
Ref: whatsnew/3 12 dis759004
Ref: 6b0759004
Ref: dis<3>-Footnote-1759614
Ref: dis<3>-Footnote-2759669
Node: fractions<3>759724
Ref: whatsnew/3 12 fractions759849
Ref: 6b3759849
Ref: fractions<3>-Footnote-1760071
Node: importlib resources760127
Ref: whatsnew/3 12 importlib-resources760256
Ref: 6b4760256
Ref: importlib resources-Footnote-1760628
Ref: importlib resources-Footnote-2760683
Node: inspect<2>760739
Ref: whatsnew/3 12 inspect760868
Ref: 6b7760868
Ref: inspect<2>-Footnote-1761638
Ref: inspect<2>-Footnote-2761693
Ref: inspect<2>-Footnote-3761748
Node: itertools<3>761804
Ref: whatsnew/3 12 itertools761921
Ref: 6bd761921
Ref: itertools<3>-Footnote-1762186
Node: math<3>762241
Ref: whatsnew/3 12 math762353
Ref: 6be762353
Ref: math<3>-Footnote-1762771
Ref: math<3>-Footnote-2762827
Node: os<3>762882
Ref: whatsnew/3 12 os762992
Ref: 6c1762992
Ref: os<3>-Footnote-1764337
Ref: os<3>-Footnote-2764392
Ref: os<3>-Footnote-3764447
Ref: os<3>-Footnote-4764503
Node: os path<3>764558
Ref: whatsnew/3 12 os-path764671
Ref: 6c9764671
Ref: os path<3>-Footnote-1765036
Ref: os path<3>-Footnote-2765091
Node: pathlib<6>765147
Ref: whatsnew/3 12 pathlib765282
Ref: 6cc765282
Ref: pathlib<6>-Footnote-1766577
Ref: pathlib<6>-Footnote-2766632
Ref: pathlib<6>-Footnote-3766687
Node: プラットフォーム<2>766742
Ref: whatsnew/3 12 platform766873
Ref: 6d4766873
Ref: プラットフォーム<2>-Footnote-1767242
Node: pdb<4>767297
Ref: whatsnew/3 12 pdb767427
Ref: 6d5767427
Ref: pdb<4>-Footnote-1767700
Node: random<2>767756
Ref: whatsnew/3 12 random767868
Ref: 6d6767868
Ref: random<2>-Footnote-1768173
Ref: random<2>-Footnote-2768228
Node: shutil<2>768284
Ref: whatsnew/3 12 shutil768400
Ref: 6d9768400
Ref: shutil<2>-Footnote-1769830
Ref: shutil<2>-Footnote-2769885
Ref: shutil<2>-Footnote-3769941
Ref: shutil<2>-Footnote-4769997
Ref: shutil<2>-Footnote-5770053
Node: sqlite3<3>770109
Ref: whatsnew/3 12 sqlite3770229
Ref: 6dc770229
Ref: sqlite3<3>-Footnote-1771176
Ref: sqlite3<3>-Footnote-2771231
Ref: sqlite3<3>-Footnote-3771273
Ref: sqlite3<3>-Footnote-4771328
Ref: sqlite3<3>-Footnote-5771384
Node: statistics<2>771440
Ref: whatsnew/3 12 statistics771557
Ref: 6e2771557
Ref: statistics<2>-Footnote-1771837
Node: sys<3>771892
Ref: whatsnew/3 12 sys772010
Ref: 6e4772010
Ref: sys<3>-Footnote-1773560
Ref: sys<3>-Footnote-2773616
Ref: sys<3>-Footnote-3773671
Ref: sys<3>-Footnote-4773727
Node: tempfile<2>773783
Ref: whatsnew/3 12 tempfile773900
Ref: 6ec773900
Ref: tempfile<2>-Footnote-1774292
Node: threading<2>774347
Ref: whatsnew/3 12 threading774468
Ref: 6ee774468
Ref: threading<2>-Footnote-1774817
Node: tkinter<3>774872
Ref: whatsnew/3 12 tkinter774990
Ref: 6f1774990
Ref: tkinter<3>-Footnote-1775486
Node: tokenize775541
Ref: whatsnew/3 12 tokenize775655
Ref: 6f2775655
Ref: tokenize-Footnote-1776016
Ref: tokenize-Footnote-2776058
Node: types<3>776114
Ref: whatsnew/3 12 types776227
Ref: 6f4776227
Ref: types<3>-Footnote-1776539
Node: typing<4>776595
Ref: whatsnew/3 12 typing776714
Ref: 6f7776714
Ref: whatsnew/3 12 whatsnew-typing-py312776714
Ref: 6f8776714
Ref: typing<4>-Footnote-1779285
Ref: typing<4>-Footnote-2779341
Ref: typing<4>-Footnote-3779396
Ref: typing<4>-Footnote-4779452
Ref: typing<4>-Footnote-5779508
Node: unicodedata<3>779563
Ref: whatsnew/3 12 unicodedata779685
Ref: 6fc779685
Ref: unicodedata<3>-Footnote-1779883
Node: unittest<3>779938
Ref: whatsnew/3 12 unittest780058
Ref: 6fd780058
Ref: unittest<3>-Footnote-1780842
Node: uuid<3>780897
Ref: whatsnew/3 12 uuid780994
Ref: 6fe780994
Ref: uuid<3>-Footnote-1781157
Node: 最適化<3>781212
Ref: whatsnew/3 12 optimizations781375
Ref: 6ff781375
Ref: 最適化<3>-Footnote-1782816
Ref: 最適化<3>-Footnote-2782858
Ref: 最適化<3>-Footnote-3782913
Ref: 最適化<3>-Footnote-4782968
Ref: 最適化<3>-Footnote-5783024
Ref: 最適化<3>-Footnote-6783079
Ref: 最適化<3>-Footnote-7783135
Ref: 最適化<3>-Footnote-8783177
Ref: 最適化<3>-Footnote-9783233
Node: CPython バイトコードの変更<2>783289
Ref: whatsnew/3 12 cpython-bytecode-changes783434
Ref: 703783434
Ref: CPython バイトコードの変更<2>-Footnote-1785482
Ref: CPython バイトコードの変更<2>-Footnote-2785537
Ref: CPython バイトコードの変更<2>-Footnote-3785593
Ref: CPython バイトコードの変更<2>-Footnote-4785648
Ref: CPython バイトコードの変更<2>-Footnote-5785703
Ref: CPython バイトコードの変更<2>-Footnote-6785758
Ref: CPython バイトコードの変更<2>-Footnote-7785814
Ref: CPython バイトコードの変更<2>-Footnote-8785869
Ref: CPython バイトコードの変更<2>-Footnote-9785925
Ref: CPython バイトコードの変更<2>-Footnote-10785967
Ref: CPython バイトコードの変更<2>-Footnote-11786024
Ref: CPython バイトコードの変更<2>-Footnote-12786080
Ref: CPython バイトコードの変更<2>-Footnote-13786123
Ref: CPython バイトコードの変更<2>-Footnote-14786180
Ref: CPython バイトコードの変更<2>-Footnote-15786237
Node: Demos and Tools786294
Ref: whatsnew/3 12 demos-and-tools786439
Ref: 70f786439
Ref: Demos and Tools-Footnote-1786892
Ref: Demos and Tools-Footnote-2786940
Ref: Demos and Tools-Footnote-3786995
Ref: Demos and Tools-Footnote-4787043
Node: 非推奨<2>787098
Ref: whatsnew/3 12 deprecated787214
Ref: 710787214
Ref: 非推奨<2>-Footnote-1798388
Ref: 非推奨<2>-Footnote-2798443
Ref: 非推奨<2>-Footnote-3798498
Ref: 非推奨<2>-Footnote-4798553
Ref: 非推奨<2>-Footnote-5798608
Ref: 非推奨<2>-Footnote-6798664
Ref: 非推奨<2>-Footnote-7798720
Ref: 非推奨<2>-Footnote-8798778
Ref: 非推奨<2>-Footnote-9798833
Ref: 非推奨<2>-Footnote-10798889
Ref: 非推奨<2>-Footnote-11798945
Ref: 非推奨<2>-Footnote-12799001
Ref: 非推奨<2>-Footnote-13799058
Ref: 非推奨<2>-Footnote-14799114
Ref: 非推奨<2>-Footnote-15799170
Ref: 非推奨<2>-Footnote-16799226
Ref: 非推奨<2>-Footnote-17799282
Ref: 非推奨<2>-Footnote-18799385
Ref: 非推奨<2>-Footnote-19799442
Ref: 非推奨<2>-Footnote-20799498
Ref: 非推奨<2>-Footnote-21799555
Ref: 非推奨<2>-Footnote-22799612
Ref: 非推奨<2>-Footnote-23799668
Ref: 非推奨<2>-Footnote-24799724
Ref: 非推奨<2>-Footnote-25799780
Ref: 非推奨<2>-Footnote-26799836
Ref: 非推奨<2>-Footnote-27799892
Ref: 非推奨<2>-Footnote-28799948
Ref: 非推奨<2>-Footnote-29800005
Ref: 非推奨<2>-Footnote-30800048
Node: Pending removal in Python 3 13800105
Ref: whatsnew/3 12 pending-removal-in-python-3-13800226
Ref: 71f800226
Ref: Pending removal in Python 3 13-Footnote-1801319
Ref: Pending removal in Python 3 13-Footnote-2801361
Ref: Pending removal in Python 3 13-Footnote-3801416
Ref: Pending removal in Python 3 13-Footnote-4801471
Ref: Pending removal in Python 3 13-Footnote-5801526
Ref: Pending removal in Python 3 13-Footnote-6801581
Ref: Pending removal in Python 3 13-Footnote-7801636
Ref: Pending removal in Python 3 13-Footnote-8801691
Ref: Pending removal in Python 3 13-Footnote-9801746
Ref: Pending removal in Python 3 13-Footnote-10801801
Ref: Pending removal in Python 3 13-Footnote-11801857
Node: Pending removal in Python 3 14<3>801913
Ref: whatsnew/3 12 pending-removal-in-python-3-14802076
Ref: 720802076
Ref: Pending removal in Python 3 14<3>-Footnote-1806296
Ref: Pending removal in Python 3 14<3>-Footnote-2806351
Ref: Pending removal in Python 3 14<3>-Footnote-3806406
Ref: Pending removal in Python 3 14<3>-Footnote-4806461
Ref: Pending removal in Python 3 14<3>-Footnote-5806516
Ref: Pending removal in Python 3 14<3>-Footnote-6806572
Ref: Pending removal in Python 3 14<3>-Footnote-7806627
Ref: Pending removal in Python 3 14<3>-Footnote-8806682
Ref: Pending removal in Python 3 14<3>-Footnote-9806738
Ref: Pending removal in Python 3 14<3>-Footnote-10806793
Ref: Pending removal in Python 3 14<3>-Footnote-11806849
Node: Pending removal in Python 3 15<5>806905
Ref: whatsnew/3 12 pending-removal-in-python-3-15807071
Ref: 721807071
Ref: Pending removal in Python 3 15<5>-Footnote-1811628
Ref: Pending removal in Python 3 15<5>-Footnote-2811683
Ref: Pending removal in Python 3 15<5>-Footnote-3811738
Ref: Pending removal in Python 3 15<5>-Footnote-4811793
Ref: Pending removal in Python 3 15<5>-Footnote-5811849
Ref: Pending removal in Python 3 15<5>-Footnote-6811891
Ref: Pending removal in Python 3 15<5>-Footnote-7811947
Node: Pending removal in Python 3 16<5>812003
Ref: whatsnew/3 12 pending-removal-in-python-3-16812169
Ref: 722812169
Ref: Pending removal in Python 3 16<5>-Footnote-1816412
Ref: Pending removal in Python 3 16<5>-Footnote-2816468
Ref: Pending removal in Python 3 16<5>-Footnote-3816524
Ref: Pending removal in Python 3 16<5>-Footnote-4816580
Node: Pending removal in Python 3 17<3>816635
Ref: whatsnew/3 12 pending-removal-in-python-3-17816805
Ref: 723816805
Ref: Pending removal in Python 3 17<3>-Footnote-1819741
Ref: Pending removal in Python 3 17<3>-Footnote-2819799
Ref: Pending removal in Python 3 17<3>-Footnote-3819854
Ref: Pending removal in Python 3 17<3>-Footnote-4819912
Node: Pending removal in future versions<5>819967
Ref: whatsnew/3 12 pending-removal-in-future-versions820095
Ref: 724820095
Ref: Pending removal in future versions<5>-Footnote-1827294
Ref: Pending removal in future versions<5>-Footnote-2827349
Ref: Pending removal in future versions<5>-Footnote-3827405
Ref: Pending removal in future versions<5>-Footnote-4827461
Ref: Pending removal in future versions<5>-Footnote-5827517
Ref: Pending removal in future versions<5>-Footnote-6827572
Ref: Pending removal in future versions<5>-Footnote-7827627
Node: 削除<2>827683
Ref: whatsnew/3 12 removed827808
Ref: 725827808
Ref: whatsnew/3 12 whatsnew312-removed827808
Ref: 726827808
Node: asynchat and asyncore828241
Ref: whatsnew/3 12 asynchat-and-asyncore828332
Ref: 727828332
Ref: asynchat and asyncore-Footnote-1828648
Ref: asynchat and asyncore-Footnote-2828690
Node: configparser<4>828745
Ref: whatsnew/3 12 configparser828854
Ref: 728828854
Ref: configparser<4>-Footnote-1829511
Node: distutils829566
Ref: whatsnew/3 12 distutils829663
Ref: 72b829663
Ref: whatsnew/3 12 whatsnew312-removed-distutils829663
Ref: 72c829663
Ref: distutils-Footnote-1830092
Ref: distutils-Footnote-2830134
Node: ensurepip830189
Ref: whatsnew/3 12 ensurepip830278
Ref: 72d830278
Ref: ensurepip-Footnote-1831299
Node: enum<2>831354
Ref: whatsnew/3 12 enum831440
Ref: 72e831440
Ref: enum<2>-Footnote-1831674
Node: ftplib831729
Ref: whatsnew/3 12 ftplib831810
Ref: 72f831810
Ref: ftplib-Footnote-1832051
Node: gzip832106
Ref: whatsnew/3 12 gzip832187
Ref: 730832187
Ref: gzip-Footnote-1832583
Node: hashlib832638
Ref: whatsnew/3 12 hashlib832725
Ref: 732832725
Ref: hashlib-Footnote-1833150
Ref: hashlib-Footnote-2833192
Node: importlib<2>833247
Ref: whatsnew/3 12 importlib833333
Ref: 734833333
Ref: importlib<2>-Footnote-1834223
Ref: importlib<2>-Footnote-2834278
Ref: importlib<2>-Footnote-3834333
Ref: importlib<2>-Footnote-4834388
Ref: importlib<2>-Footnote-5834443
Node: imp834498
Ref: whatsnew/3 12 imp834582
Ref: 735834582
Ref: whatsnew/3 12 whatsnew312-removed-imp834582
Ref: 736834582
Ref: imp-Footnote-1838729
Node: io<4>838784
Ref: whatsnew/3 12 io838865
Ref: 73f838865
Ref: io<4>-Footnote-1839284
Node: locale<2>839339
Ref: whatsnew/3 12 locale839422
Ref: 741839422
Ref: locale<2>-Footnote-1839690
Node: smtpd839745
Ref: whatsnew/3 12 smtpd839833
Ref: 743839833
Ref: smtpd-Footnote-1840187
Ref: smtpd-Footnote-2840229
Ref: smtpd-Footnote-3840272
Node: sqlite3<4>840327
Ref: whatsnew/3 12 id2840412
Ref: 744840412
Ref: sqlite3<4>-Footnote-1841146
Node: ssl<3>841201
Ref: whatsnew/3 12 ssl841292
Ref: 745841292
Ref: ssl<3>-Footnote-1842349
Ref: ssl<3>-Footnote-2842404
Ref: ssl<3>-Footnote-3842459
Ref: ssl<3>-Footnote-4842515
Node: unittest<4>842570
Ref: whatsnew/3 12 id3842664
Ref: 749842664
Ref: whatsnew/3 12 unittest-testcase-removed-aliases842766
Ref: 67f842766
Ref: unittest<4>-Footnote-1847543
Node: webbrowser<3>847598
Ref: whatsnew/3 12 webbrowser847707
Ref: 755847707
Ref: webbrowser<3>-Footnote-1848014
Node: xml etree ElementTree848070
Ref: whatsnew/3 12 xml-etree-elementtree848180
Ref: 756848180
Ref: xml etree ElementTree-Footnote-1848643
Node: zipimport<2>848698
Ref: whatsnew/3 12 zipimport848804
Ref: 758848804
Ref: zipimport<2>-Footnote-1849139
Ref: zipimport<2>-Footnote-2849181
Node: その他849236
Ref: whatsnew/3 12 others849312
Ref: 759849312
Ref: その他-Footnote-1850323
Ref: その他-Footnote-2850377
Ref: その他-Footnote-3850432
Ref: その他-Footnote-4850487
Ref: その他-Footnote-5850542
Node: Python 3 12 への移植850597
Ref: whatsnew/3 12 porting-to-python-3-12850726
Ref: 75a850726
Ref: whatsnew/3 12 whatsnew312-porting-to-python312850726
Ref: 6f3850726
Node: Python API の変更<3>850994
Ref: whatsnew/3 12 changes-in-the-python-api851078
Ref: 75b851078
Ref: Python API の変更<3>-Footnote-1857368
Ref: Python API の変更<3>-Footnote-2857423
Ref: Python API の変更<3>-Footnote-3857478
Ref: Python API の変更<3>-Footnote-4857521
Ref: Python API の変更<3>-Footnote-5857576
Ref: Python API の変更<3>-Footnote-6857631
Ref: Python API の変更<3>-Footnote-7857686
Ref: Python API の変更<3>-Footnote-8857742
Ref: Python API の変更<3>-Footnote-9857784
Ref: Python API の変更<3>-Footnote-10857826
Ref: Python API の変更<3>-Footnote-11857869
Node: Build Changes<2>857926
Ref: whatsnew/3 12 build-changes858064
Ref: 766858064
Ref: Build Changes<2>-Footnote-1859748
Ref: Build Changes<2>-Footnote-2859803
Ref: Build Changes<2>-Footnote-3859858
Ref: Build Changes<2>-Footnote-4859913
Ref: Build Changes<2>-Footnote-5859968
Ref: Build Changes<2>-Footnote-6860023
Node: C API の変更<4>860078
Ref: whatsnew/3 12 c-api-changes860183
Ref: 767860183
Node: 新しい機能<5>860381
Ref: whatsnew/3 12 id4860490
Ref: 768860490
Ref: whatsnew/3 12 whatsnew312-pep697860536
Ref: 677860536
Ref: whatsnew/3 12 whatsnew312-pep683866678
Ref: 678866678
Ref: 新しい機能<5>-Footnote-1868419
Ref: 新しい機能<5>-Footnote-2868461
Ref: 新しい機能<5>-Footnote-3868503
Ref: 新しい機能<5>-Footnote-4868559
Ref: 新しい機能<5>-Footnote-5868601
Ref: 新しい機能<5>-Footnote-6868657
Ref: 新しい機能<5>-Footnote-7868712
Ref: 新しい機能<5>-Footnote-8868767
Ref: 新しい機能<5>-Footnote-9868822
Ref: 新しい機能<5>-Footnote-10868877
Ref: 新しい機能<5>-Footnote-11868933
Ref: 新しい機能<5>-Footnote-12868989
Ref: 新しい機能<5>-Footnote-13869045
Ref: 新しい機能<5>-Footnote-14869101
Ref: 新しい機能<5>-Footnote-15869157
Ref: 新しい機能<5>-Footnote-16869214
Ref: 新しい機能<5>-Footnote-17869271
Ref: 新しい機能<5>-Footnote-18869328
Ref: 新しい機能<5>-Footnote-19869385
Ref: 新しい機能<5>-Footnote-20869428
Ref: 新しい機能<5>-Footnote-21869484
Ref: 新しい機能<5>-Footnote-22869527
Ref: 新しい機能<5>-Footnote-23869584
Node: Python 3 12 への移植<2>869641
Ref: whatsnew/3 12 id5869771
Ref: 791869771
Ref: Python 3 12 への移植<2>-Footnote-1877242
Ref: Python 3 12 への移植<2>-Footnote-2877297
Ref: Python 3 12 への移植<2>-Footnote-3877352
Ref: Python 3 12 への移植<2>-Footnote-4877407
Ref: Python 3 12 への移植<2>-Footnote-5877462
Ref: Python 3 12 への移植<2>-Footnote-6877517
Ref: Python 3 12 への移植<2>-Footnote-7877572
Ref: Python 3 12 への移植<2>-Footnote-8877628
Node: 非推奨<3>877684
Ref: whatsnew/3 12 id6877805
Ref: 7a9877805
Ref: 非推奨<3>-Footnote-1883208
Ref: 非推奨<3>-Footnote-2883250
Ref: 非推奨<3>-Footnote-3883306
Ref: 非推奨<3>-Footnote-4883361
Ref: 非推奨<3>-Footnote-5883416
Ref: 非推奨<3>-Footnote-6883471
Ref: 非推奨<3>-Footnote-7883527
Ref: 非推奨<3>-Footnote-8883583
Node: Pending removal in Python 3 14<4>883639
Ref: whatsnew/3 12 id7883763
Ref: 7b3883763
Ref: Pending removal in Python 3 14<4>-Footnote-1884083
Ref: Pending removal in Python 3 14<4>-Footnote-2884125
Ref: Pending removal in Python 3 14<4>-Footnote-3884181
Node: Pending removal in Python 3 15<6>884236
Ref: whatsnew/3 12 id8884402
Ref: 7b4884402
Ref: Pending removal in Python 3 15<6>-Footnote-1891051
Ref: Pending removal in Python 3 15<6>-Footnote-2891104
Node: Pending removal in Python 3 16<6>891157
Ref: whatsnew/3 12 id9891327
Ref: 7b5891327
Node: Pending removal in future versions<6>891450
Ref: whatsnew/3 12 id10891578
Ref: 7b6891578
Node: 削除<3>893417
Ref: whatsnew/3 12 id11893502
Ref: 7b7893502
Ref: 削除<3>-Footnote-1894353
Ref: 削除<3>-Footnote-2894408
Ref: 削除<3>-Footnote-3894450
Node: What's New In Python 3 11894505
Ref: whatsnew/3 11 doc894655
Ref: 7b8894655
Ref: whatsnew/3 11 translation-repo894655
Ref: 7b9894655
Ref: whatsnew/3 11 what-s-new-in-python-3-11894655
Ref: 7ba894655
Node: 概要 -- リリースハイライト<4>895957
Ref: whatsnew/3 11 summary-release-highlights896086
Ref: 7bb896086
Ref: whatsnew/3 11 whatsnew311-summary896086
Ref: 7bc896086
Ref: 概要 -- リリースハイライト<4>-Footnote-1897882
Ref: 概要 -- リリースハイライト<4>-Footnote-2897924
Ref: 概要 -- リリースハイライト<4>-Footnote-3897949
Ref: 概要 -- リリースハイライト<4>-Footnote-4897991
Ref: 概要 -- リリースハイライト<4>-Footnote-5898033
Node: 新しい機能<6>898075
Ref: whatsnew/3 11 new-features898258
Ref: 7cc898258
Ref: whatsnew/3 11 whatsnew311-features898258
Ref: 7cd898258
Node: PEP 657 トレースバックのエラー位置の詳細化898711
Ref: whatsnew/3 11 pep-657-fine-grained-error-locations-in-tracebacks898871
Ref: 7ce898871
Ref: whatsnew/3 11 whatsnew311-pep657898871
Ref: 7c0898871
Ref: PEP 657 トレースバックのエラー位置の詳細化-Footnote-1901970
Ref: PEP 657 トレースバックのエラー位置の詳細化-Footnote-2902012
Node: PEP 654 例外グループと except*902077
Ref: whatsnew/3 11 pep-654-exception-groups-and-except902299
Ref: 7d4902299
Ref: whatsnew/3 11 whatsnew311-pep654902299
Ref: 7be902299
Ref: PEP 654 例外グループと except*-Footnote-1903147
Ref: PEP 654 例外グループと except*-Footnote-2903189
Ref: PEP 654 例外グループと except*-Footnote-3903231
Node: PEP 678 ノートによって例外を充実させる903296
Ref: whatsnew/3 11 pep-678-exceptions-can-be-enriched-with-notes903498
Ref: 7d5903498
Ref: whatsnew/3 11 whatsnew311-pep678903498
Ref: 7bf903498
Ref: PEP 678 ノートによって例外を充実させる-Footnote-1904148
Ref: PEP 678 ノートによって例外を充実させる-Footnote-2904190
Node: Windows py exe ランチャーの改善904255
Ref: whatsnew/3 11 whatsnew311-windows-launcher904411
Ref: 7d8904411
Ref: whatsnew/3 11 windows-py-exe-launcher-improvements904411
Ref: 7d9904411
Ref: whatsnew/3 11 new-feat-related-type-hints-311905846
Ref: 7db905846
Ref: Windows py exe ランチャーの改善-Footnote-1905884
Ref: Windows py exe ランチャーの改善-Footnote-2905926
Node: 型ヒントに関連する新しい機能<2>905957
Ref: whatsnew/3 11 new-features-related-to-type-hints906127
Ref: 7dc906127
Ref: whatsnew/3 11 whatsnew311-typing-features906127
Ref: 7dd906127
Ref: 型ヒントに関連する新しい機能<2>-Footnote-1906783
Node: PEP 646 Variadic generics906825
Ref: whatsnew/3 11 pep-646-variadic-generics907011
Ref: 7de907011
Ref: whatsnew/3 11 whatsnew311-pep646907011
Ref: 7c4907011
Ref: PEP 646 Variadic generics-Footnote-1908017
Ref: PEP 646 Variadic generics-Footnote-2908059
Ref: PEP 646 Variadic generics-Footnote-3908101
Ref: PEP 646 Variadic generics-Footnote-4908143
Node: PEP 655 Marking individual TypedDict items as required or not-required908208
Ref: whatsnew/3 11 pep-655-marking-individual-typeddict-items-as-required-or-not-required908419
Ref: 7df908419
Ref: whatsnew/3 11 whatsnew311-pep655908419
Ref: 7c5908419
Ref: PEP 655 Marking individual TypedDict items as required or not-required-Footnote-1909667
Ref: PEP 655 Marking individual TypedDict items as required or not-required-Footnote-2909709
Node: PEP 673 Self 型909774
Ref: whatsnew/3 11 pep-673-self-type909997
Ref: 7e2909997
Ref: whatsnew/3 11 whatsnew311-pep673909997
Ref: 7c6909997
Ref: PEP 673 Self 型-Footnote-1911066
Ref: PEP 673 Self 型-Footnote-2911147
Ref: PEP 673 Self 型-Footnote-3911189
Node: PEP 675 Arbitrary literal string type911254
Ref: whatsnew/3 11 pep-675-arbitrary-literal-string-type911436
Ref: 7e5911436
Ref: whatsnew/3 11 whatsnew311-pep675911436
Ref: 7c7911436
Ref: PEP 675 Arbitrary literal string type-Footnote-1912858
Ref: PEP 675 Arbitrary literal string type-Footnote-2912900
Node: PEP 681 Data class transforms912965
Ref: whatsnew/3 11 pep-681-data-class-transforms913160
Ref: 7e7913160
Ref: whatsnew/3 11 whatsnew311-pep681913160
Ref: 7c8913160
Ref: PEP 681 Data class transforms-Footnote-1914215
Ref: PEP 681 Data class transforms-Footnote-2914257
Node: PEP 563 may not be the future914312
Ref: whatsnew/3 11 pep-563-may-not-be-the-future914461
Ref: 7e8914461
Ref: whatsnew/3 11 whatsnew311-pep563-deferred914461
Ref: 7e9914461
Ref: PEP 563 may not be the future-Footnote-1914856
Ref: PEP 563 may not be the future-Footnote-2914898
Node: その他の言語変更<3>915009
Ref: whatsnew/3 11 other-language-changes915200
Ref: 7ea915200
Ref: whatsnew/3 11 whatsnew311-other-lang-changes915200
Ref: 7eb915200
Ref: whatsnew/3 11 whatsnew311-pythonsafepath917005
Ref: 7c3917005
Ref: その他の言語変更<3>-Footnote-1918348
Ref: その他の言語変更<3>-Footnote-2918413
Ref: その他の言語変更<3>-Footnote-3918478
Ref: その他の言語変更<3>-Footnote-4918543
Ref: その他の言語変更<3>-Footnote-5918608
Ref: その他の言語変更<3>-Footnote-6918663
Ref: その他の言語変更<3>-Footnote-7918728
Ref: その他の言語変更<3>-Footnote-8918783
Ref: その他の言語変更<3>-Footnote-9918825
Ref: その他の言語変更<3>-Footnote-10918880
Node: その他の CPython の実装の変更918936
Ref: whatsnew/3 11 other-cpython-implementation-changes919109
Ref: 7fb919109
Ref: whatsnew/3 11 whatsnew311-other-implementation-changes919109
Ref: 7fc919109
Ref: その他の CPython の実装の変更-Footnote-1922357
Ref: その他の CPython の実装の変更-Footnote-2922422
Ref: その他の CPython の実装の変更-Footnote-3922464
Ref: その他の CPython の実装の変更-Footnote-4922529
Ref: その他の CPython の実装の変更-Footnote-5922594
Ref: その他の CPython の実装の変更-Footnote-6922659
Ref: その他の CPython の実装の変更-Footnote-7922724
Ref: その他の CPython の実装の変更-Footnote-8922789
Node: 新たなモジュール<3>922845
Ref: whatsnew/3 11 new-modules923024
Ref: 80c923024
Ref: whatsnew/3 11 whatsnew311-new-modules923024
Ref: 80d923024
Ref: 新たなモジュール<3>-Footnote-1923391
Ref: 新たなモジュール<3>-Footnote-2923416
Ref: 新たなモジュール<3>-Footnote-3923458
Ref: 新たなモジュール<3>-Footnote-4923523
Ref: 新たなモジュール<3>-Footnote-5923565
Node: 改良されたモジュール<3>923630
Ref: whatsnew/3 11 improved-modules923782
Ref: 80e923782
Ref: whatsnew/3 11 whatsnew311-improved-modules923782
Ref: 80f923782
Node: asyncio<6>924612
Ref: whatsnew/3 11 asyncio924711
Ref: 810924711
Ref: whatsnew/3 11 whatsnew311-asyncio924711
Ref: 811924711
Ref: asyncio<6>-Footnote-1926629
Ref: asyncio<6>-Footnote-2926684
Ref: asyncio<6>-Footnote-3926739
Ref: asyncio<6>-Footnote-4926794
Ref: asyncio<6>-Footnote-5926849
Ref: asyncio<6>-Footnote-6926914
Node: contextlib926979
Ref: whatsnew/3 11 contextlib927105
Ref: 81e927105
Ref: whatsnew/3 11 whatsnew311-contextlib927105
Ref: 81f927105
Ref: contextlib-Footnote-1927420
Node: データクラス927485
Ref: whatsnew/3 11 dataclasses927612
Ref: 822927612
Ref: whatsnew/3 11 whatsnew311-dataclasses927612
Ref: 823927612
Ref: データクラス-Footnote-1927962
Node: datetime<2>928027
Ref: whatsnew/3 11 datetime928151
Ref: 825928151
Ref: whatsnew/3 11 whatsnew311-datetime928151
Ref: 826928151
Ref: datetime<2>-Footnote-1928690
Ref: datetime<2>-Footnote-2928745
Node: enum<3>928800
Ref: whatsnew/3 11 enum928911
Ref: 82b928911
Ref: whatsnew/3 11 whatsnew311-enum928911
Ref: 82c928911
Node: fcntl931555
Ref: whatsnew/3 11 fcntl931667
Ref: 845931667
Ref: whatsnew/3 11 whatsnew311-fcntl931667
Ref: 846931667
Node: fractions<4>931902
Ref: whatsnew/3 11 fractions932019
Ref: 847932019
Ref: whatsnew/3 11 whatsnew311-fractions932019
Ref: 848932019
Ref: fractions<4>-Footnote-1932437
Ref: fractions<4>-Footnote-2932479
Ref: fractions<4>-Footnote-3932544
Node: functools<2>932609
Ref: whatsnew/3 11 functools932728
Ref: 849932728
Ref: whatsnew/3 11 whatsnew311-functools932728
Ref: 84a932728
Ref: functools<2>-Footnote-1933800
Node: gzip<2>933865
Ref: whatsnew/3 11 gzip933982
Ref: 84c933982
Ref: whatsnew/3 11 whatsnew311-gzip933982
Ref: 84d933982
Ref: gzip<2>-Footnote-1934690
Node: hashlib<2>934746
Ref: whatsnew/3 11 hashlib934868
Ref: 850934868
Ref: whatsnew/3 11 whatsnew311-hashlib934868
Ref: 851934868
Ref: hashlib<2>-Footnote-1935689
Ref: hashlib<2>-Footnote-2935721
Ref: hashlib<2>-Footnote-3935786
Ref: hashlib<2>-Footnote-4935851
Node: IDLE と idelelib935906
Ref: whatsnew/3 11 idle-and-idlelib936031
Ref: 855936031
Ref: whatsnew/3 11 whatsnew311-idle936031
Ref: 856936031
Ref: IDLE と idelelib-Footnote-1936366
Ref: IDLE と idelelib-Footnote-2936431
Node: inspect<3>936486
Ref: whatsnew/3 11 inspect936610
Ref: 857936610
Ref: whatsnew/3 11 whatsnew311-inspect936610
Ref: 858936610
Ref: inspect<3>-Footnote-1937697
Ref: inspect<3>-Footnote-2937762
Ref: inspect<3>-Footnote-3937827
Ref: inspect<3>-Footnote-4937869
Node: locale<3>937924
Ref: whatsnew/3 11 locale938038
Ref: 864938038
Ref: whatsnew/3 11 whatsnew311-locale938038
Ref: 865938038
Node: logging938265
Ref: whatsnew/3 11 logging938376
Ref: 867938376
Ref: whatsnew/3 11 whatsnew311-logging938376
Ref: 868938376
Ref: logging-Footnote-1939042
Ref: logging-Footnote-2939097
Node: math<4>939152
Ref: whatsnew/3 11 math939265
Ref: 86e939265
Ref: whatsnew/3 11 whatsnew311-math939265
Ref: 86f939265
Ref: math<4>-Footnote-1940038
Ref: math<4>-Footnote-2940103
Ref: math<4>-Footnote-3940168
Ref: math<4>-Footnote-4940233
Node: operator<2>940298
Ref: whatsnew/3 11 operator940409
Ref: 874940409
Ref: whatsnew/3 11 whatsnew311-operator940409
Ref: 875940409
Ref: operator<2>-Footnote-1940671
Node: os<4>940736
Ref: whatsnew/3 11 os940850
Ref: 876940850
Ref: whatsnew/3 11 whatsnew311-os940850
Ref: 877940850
Ref: os<4>-Footnote-1941099
Node: pathlib<7>941164
Ref: whatsnew/3 11 pathlib941272
Ref: 878941272
Ref: whatsnew/3 11 whatsnew311-pathlib941272
Ref: 879941272
Ref: pathlib<7>-Footnote-1941593
Ref: pathlib<7>-Footnote-2941658
Node: re<4>941723
Ref: whatsnew/3 11 re941835
Ref: 87c941835
Ref: whatsnew/3 11 whatsnew311-re941835
Ref: 87d941835
Ref: re<4>-Footnote-1942137
Node: shutil<3>942203
Ref: whatsnew/3 11 shutil942314
Ref: 87e942314
Ref: whatsnew/3 11 whatsnew311-shutil942314
Ref: 87f942314
Ref: shutil<3>-Footnote-1942508
Node: socket<2>942573
Ref: whatsnew/3 11 socket942689
Ref: 880942689
Ref: whatsnew/3 11 whatsnew311-socket942689
Ref: 881942689
Ref: socket<2>-Footnote-1943102
Ref: socket<2>-Footnote-2943167
Node: sqlite3<5>943232
Ref: whatsnew/3 11 sqlite3943345
Ref: 883943345
Ref: whatsnew/3 11 whatsnew311-sqlite3943345
Ref: 884943345
Ref: sqlite3<5>-Footnote-1945689
Ref: sqlite3<5>-Footnote-2945754
Ref: sqlite3<5>-Footnote-3945819
Ref: sqlite3<5>-Footnote-4945884
Ref: sqlite3<5>-Footnote-5945949
Ref: sqlite3<5>-Footnote-6946014
Ref: sqlite3<5>-Footnote-7946079
Ref: sqlite3<5>-Footnote-8946144
Ref: sqlite3<5>-Footnote-9946209
Ref: sqlite3<5>-Footnote-10946274
Ref: sqlite3<5>-Footnote-11946340
Node: string946406
Ref: whatsnew/3 11 string946516
Ref: 893946516
Ref: whatsnew/3 11 whatsnew311-string946516
Ref: 894946516
Ref: string-Footnote-1946841
Node: sys<4>946896
Ref: whatsnew/3 11 sys947008
Ref: 898947008
Ref: whatsnew/3 11 whatsnew311-sys947008
Ref: 899947008
Ref: sys<4>-Footnote-1947701
Ref: sys<4>-Footnote-2947766
Ref: sys<4>-Footnote-3947831
Node: sysconfig<2>947886
Ref: whatsnew/3 11 sysconfig948003
Ref: 89d948003
Ref: whatsnew/3 11 whatsnew311-sysconfig948003
Ref: 89e948003
Ref: sysconfig<2>-Footnote-1948816
Node: tempfile<3>948881
Ref: whatsnew/3 11 tempfile949004
Ref: 8a0949004
Ref: whatsnew/3 11 whatsnew311-tempfile949004
Ref: 8a1949004
Ref: tempfile<3>-Footnote-1949413
Node: threading<3>949468
Ref: whatsnew/3 11 threading949586
Ref: 8a5949586
Ref: whatsnew/3 11 whatsnew311-threading949586
Ref: 8a6949586
Ref: threading<3>-Footnote-1950091
Node: time<2>950156
Ref: whatsnew/3 11 time950273
Ref: 8aa950273
Ref: whatsnew/3 11 whatsnew311-time950273
Ref: 8ab950273
Ref: time<2>-Footnote-1951074
Ref: time<2>-Footnote-2951139
Ref: time<2>-Footnote-3951236
Ref: time<2>-Footnote-4951301
Node: tkinter<4>951366
Ref: whatsnew/3 11 tkinter951483
Ref: 8ad951483
Ref: whatsnew/3 11 whatsnew311-tkinter951483
Ref: 8ae951483
Ref: tkinter<4>-Footnote-1951766
Node: traceback<2>951821
Ref: whatsnew/3 11 traceback951940
Ref: 8b0951940
Ref: whatsnew/3 11 whatsnew311-traceback951940
Ref: 8b1951940
Ref: traceback<2>-Footnote-1952432
Ref: traceback<2>-Footnote-2952497
Node: typing<5>952562
Ref: whatsnew/3 11 typing952685
Ref: 8b4952685
Ref: whatsnew/3 11 whatsnew311-typing952685
Ref: 8b5952685
Ref: typing<5>-Footnote-1955985
Ref: typing<5>-Footnote-2956040
Ref: typing<5>-Footnote-3956095
Ref: typing<5>-Footnote-4956150
Ref: typing<5>-Footnote-5956205
Ref: typing<5>-Footnote-6956270
Ref: typing<5>-Footnote-7956325
Ref: typing<5>-Footnote-8956380
Ref: typing<5>-Footnote-9956435
Ref: typing<5>-Footnote-10956490
Ref: typing<5>-Footnote-11956546
Ref: typing<5>-Footnote-12956602
Ref: typing<5>-Footnote-13956658
Ref: typing<5>-Footnote-14956714
Ref: typing<5>-Footnote-15956770
Node: unicodedata<4>956826
Ref: whatsnew/3 11 unicodedata956948
Ref: 8c4956948
Ref: whatsnew/3 11 whatsnew311-unicodedata956948
Ref: 8c5956948
Ref: unicodedata<4>-Footnote-1957147
Node: unittest<5>957212
Ref: whatsnew/3 11 unittest957332
Ref: 8c6957332
Ref: whatsnew/3 11 whatsnew311-unittest957332
Ref: 8c7957332
Ref: unittest<5>-Footnote-1957734
Node: venv<2>957799
Ref: whatsnew/3 11 venv957916
Ref: 8cc957916
Ref: whatsnew/3 11 whatsnew311-venv957916
Ref: 8cd957916
Ref: venv<2>-Footnote-1958539
Node: warnings<2>958604
Ref: whatsnew/3 11 warnings958720
Ref: 8ce958720
Ref: whatsnew/3 11 whatsnew311-warnings958720
Ref: 8cf958720
Ref: warnings<2>-Footnote-1959051
Node: zipfile<2>959116
Ref: whatsnew/3 11 whatsnew311-zipfile959216
Ref: 8d1959216
Ref: whatsnew/3 11 zipfile959216
Ref: 8d2959216
Ref: zipfile<2>-Footnote-1959805
Ref: zipfile<2>-Footnote-2959870
Ref: zipfile<2>-Footnote-3959925
Node: 最適化<4>959980
Ref: whatsnew/3 11 optimizations960119
Ref: 8d9960119
Ref: whatsnew/3 11 whatsnew311-optimizations960119
Ref: 8da960119
Ref: 最適化<4>-Footnote-1962518
Ref: 最適化<4>-Footnote-2962583
Ref: 最適化<4>-Footnote-3962638
Ref: 最適化<4>-Footnote-4962693
Ref: 最適化<4>-Footnote-5962748
Ref: 最適化<4>-Footnote-6962813
Ref: 最適化<4>-Footnote-7962868
Ref: 最適化<4>-Footnote-8962933
Ref: 最適化<4>-Footnote-9962988
Node: Faster CPython963053
Ref: whatsnew/3 11 faster-cpython963197
Ref: 8e5963197
Ref: whatsnew/3 11 whatsnew311-faster-cpython963197
Ref: 7bd963197
Ref: Faster CPython-Footnote-1963778
Ref: Faster CPython-Footnote-2963844
Node: Faster Startup963892
Ref: whatsnew/3 11 faster-startup963980
Ref: 8e8963980
Ref: whatsnew/3 11 whatsnew311-faster-startup963980
Ref: 8e6963980
Node: Frozen imports / Static code objects964078
Ref: whatsnew/3 11 frozen-imports-static-code-objects964165
Ref: 8e9964165
Ref: whatsnew/3 11 whatsnew311-faster-imports964165
Ref: 8ea964165
Node: Faster Runtime965010
Ref: whatsnew/3 11 faster-runtime965111
Ref: 8ec965111
Ref: whatsnew/3 11 whatsnew311-faster-runtime965111
Ref: 8e7965111
Node: Cheaper lazy Python frames965350
Ref: whatsnew/3 11 cheaper-lazy-python-frames965465
Ref: 8ed965465
Ref: whatsnew/3 11 whatsnew311-lazy-python-frames965465
Ref: 8ee965465
Ref: whatsnew/3 11 inline-calls966408
Ref: 8f2966408
Ref: Cheaper lazy Python frames-Footnote-1966446
Node: Inlined Python function calls966511
Ref: whatsnew/3 11 inlined-python-function-calls966676
Ref: 8f3966676
Ref: whatsnew/3 11 whatsnew311-inline-calls966676
Ref: 8f4966676
Ref: Inlined Python function calls-Footnote-1967624
Node: PEP 659 Specializing Adaptive Interpreter967689
Ref: whatsnew/3 11 pep-659-specializing-adaptive-interpreter967819
Ref: 8f5967819
Ref: whatsnew/3 11 whatsnew311-pep659967819
Ref: 49f967819
Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-1975227
Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-2975269
Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-3975311
Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-4975436
Node: Misc975661
Ref: whatsnew/3 11 misc975751
Ref: 8f6975751
Ref: whatsnew/3 11 whatsnew311-faster-cpython-misc975751
Ref: 8f7975751
Ref: Misc-Footnote-1976758
Ref: Misc-Footnote-2976823
Ref: Misc-Footnote-3976888
Ref: Misc-Footnote-4976953
Ref: Misc-Footnote-5977018
Ref: Misc-Footnote-6977089
Node: FAQ977144
Ref: whatsnew/3 11 faq977225
Ref: 8f9977225
Ref: whatsnew/3 11 whatsnew311-faster-cpython-faq977225
Ref: 8fa977225
Node: How should I write my code to utilize these speedups?977516
Ref: whatsnew/3 11 faster-cpython-faq-my-code977652
Ref: 8fb977652
Ref: whatsnew/3 11 how-should-i-write-my-code-to-utilize-these-speedups977652
Ref: 8fc977652
Node: Will CPython 3 11 use more memory?977945
Ref: whatsnew/3 11 faster-cpython-faq-memory978134
Ref: 8fd978134
Ref: whatsnew/3 11 will-cpython-3-11-use-more-memory978134
Ref: 8fe978134
Node: I don't see any speedups in my workload Why?978395
Ref: whatsnew/3 11 faster-cpython-ymmv978555
Ref: 8ff978555
Ref: whatsnew/3 11 i-don-t-see-any-speedups-in-my-workload-why978555
Ref: 900978555
Node: Is there a JIT compiler?979139
Ref: whatsnew/3 11 faster-cpython-jit979256
Ref: 901979256
Ref: whatsnew/3 11 is-there-a-jit-compiler979256
Ref: 902979256
Node: About979374
Ref: whatsnew/3 11 about979442
Ref: 903979442
Ref: whatsnew/3 11 whatsnew311-faster-cpython-about979442
Ref: 904979442
Node: CPython バイトコードの変更<3>979751
Ref: whatsnew/3 11 cpython-bytecode-changes979895
Ref: 906979895
Ref: whatsnew/3 11 whatsnew311-bytecode-changes979895
Ref: 907979895
Node: New opcodes980455
Ref: whatsnew/3 11 new-opcodes980566
Ref: 909980566
Ref: whatsnew/3 11 whatsnew311-added-opcodes980566
Ref: 90a980566
Ref: New opcodes-Footnote-1981379
Node: Replaced opcodes981421
Ref: whatsnew/3 11 replaced-opcodes981564
Ref: 913981564
Ref: whatsnew/3 11 whatsnew311-replaced-opcodes981564
Ref: 914981564
Ref: whatsnew/3 11 whatsnew311-changed-opcodes984282
Ref: 91b984282
Ref: whatsnew/3 11 whatsnew311-removed-opcodes984282
Ref: 91c984282
Ref: Replaced opcodes-Footnote-1984318
Node: Changed/removed opcodes984536
Ref: whatsnew/3 11 changed-removed-opcodes984659
Ref: 91d984659
Ref: whatsnew/3 11 whatsnew311-changed-removed-opcodes984659
Ref: 91e984659
Ref: whatsnew/3 11 whatsnew311-deprecated985247
Ref: 921985247
Ref: Changed/removed opcodes-Footnote-1985284
Node: 非推奨<4>985339
Ref: whatsnew/3 11 deprecated985499
Ref: 922985499
Ref: whatsnew/3 11 whatsnew311-python-api-deprecated985499
Ref: 923985499
Ref: whatsnew/3 11 whatsnew311-deprecated-language985656
Ref: 925985656
Node: Language/Builtins985730
Ref: whatsnew/3 11 language-builtins985820
Ref: 926985820
Ref: whatsnew/3 11 whatsnew311-deprecated-builtins985820
Ref: 927985820
Ref: Language/Builtins-Footnote-1987041
Ref: Language/Builtins-Footnote-2987106
Ref: Language/Builtins-Footnote-3987161
Ref: Language/Builtins-Footnote-4987216
Node: モジュール987281
Ref: whatsnew/3 11 modules987396
Ref: 928987396
Ref: whatsnew/3 11 whatsnew311-deprecated-modules987396
Ref: 929987396
Ref: whatsnew/3 11 whatsnew311-pep594987442
Ref: 7c9987442
Ref: モジュール-Footnote-1989652
Ref: モジュール-Footnote-2989694
Ref: モジュール-Footnote-3989759
Ref: モジュール-Footnote-4989814
Ref: モジュール-Footnote-5989879
Ref: モジュール-Footnote-6989921
Ref: モジュール-Footnote-7989986
Node: Standard Library990051
Ref: whatsnew/3 11 standard-library990140
Ref: 92a990140
Ref: whatsnew/3 11 whatsnew311-deprecated-stdlib990140
Ref: 92b990140
Ref: whatsnew/3 11 whatsnew311-pending-removal994997
Ref: 930994997
Ref: Standard Library-Footnote-1995034
Ref: Standard Library-Footnote-2995099
Ref: Standard Library-Footnote-3995164
Ref: Standard Library-Footnote-4995219
Ref: Standard Library-Footnote-5995274
Ref: Standard Library-Footnote-6995329
Ref: Standard Library-Footnote-7995384
Ref: Standard Library-Footnote-8995449
Ref: Standard Library-Footnote-9995504
Ref: Standard Library-Footnote-10995559
Ref: Standard Library-Footnote-11995625
Ref: Standard Library-Footnote-12995690
Node: Pending Removal in Python 3 12995746
Ref: whatsnew/3 11 pending-removal-in-python-3-12995877
Ref: 931995877
Ref: whatsnew/3 11 whatsnew311-python-api-pending-removal995877
Ref: 932995877
Ref: whatsnew/3 11 whatsnew311-removed1001629
Ref: 9361001629
Node: 削除<4>1001629
Ref: whatsnew/3 11 removed1001770
Ref: 9371001770
Ref: whatsnew/3 11 whatsnew311-python-api-removed1001770
Ref: 9381001770
Ref: whatsnew/3 11 whatsnew311-porting1006424
Ref: 9441006424
Ref: 削除<4>-Footnote-11006461
Ref: 削除<4>-Footnote-21006526
Ref: 削除<4>-Footnote-31006591
Ref: 削除<4>-Footnote-41006656
Ref: 削除<4>-Footnote-51006721
Ref: 削除<4>-Footnote-61006786
Ref: 削除<4>-Footnote-71006851
Ref: 削除<4>-Footnote-81006916
Ref: 削除<4>-Footnote-91006981
Ref: 削除<4>-Footnote-101007046
Ref: 削除<4>-Footnote-111007112
Ref: 削除<4>-Footnote-121007178
Ref: 削除<4>-Footnote-131007244
Ref: 削除<4>-Footnote-141007310
Ref: 削除<4>-Footnote-151007352
Node: Porting to Python 3 111007406
Ref: whatsnew/3 11 porting-to-python-3-111007533
Ref: 9451007533
Ref: whatsnew/3 11 whatsnew311-python-api-porting1007533
Ref: 9461007533
Ref: Porting to Python 3 11-Footnote-11010577
Ref: Porting to Python 3 11-Footnote-21010642
Ref: Porting to Python 3 11-Footnote-31010697
Ref: Porting to Python 3 11-Footnote-41010762
Ref: Porting to Python 3 11-Footnote-51010827
Ref: Porting to Python 3 11-Footnote-61010892
Ref: Porting to Python 3 11-Footnote-71010957
Ref: Porting to Python 3 11-Footnote-81011022
Node: Build Changes<3>1011087
Ref: whatsnew/3 11 build-changes1011223
Ref: 9501011223
Ref: whatsnew/3 11 whatsnew311-build-changes1011223
Ref: 9511011223
Ref: Build Changes<3>-Footnote-11015451
Ref: Build Changes<3>-Footnote-21015493
Ref: Build Changes<3>-Footnote-31015542
Ref: Build Changes<3>-Footnote-41015575
Ref: Build Changes<3>-Footnote-51015607
Ref: Build Changes<3>-Footnote-61015633
Ref: Build Changes<3>-Footnote-71015662
Ref: Build Changes<3>-Footnote-81015717
Ref: Build Changes<3>-Footnote-91015772
Ref: Build Changes<3>-Footnote-101015827
Ref: Build Changes<3>-Footnote-111015871
Ref: Build Changes<3>-Footnote-121015955
Ref: Build Changes<3>-Footnote-131016021
Ref: Build Changes<3>-Footnote-141016087
Ref: Build Changes<3>-Footnote-151016153
Ref: Build Changes<3>-Footnote-161016201
Ref: Build Changes<3>-Footnote-171016267
Ref: Build Changes<3>-Footnote-181016333
Ref: Build Changes<3>-Footnote-191016361
Ref: Build Changes<3>-Footnote-201016427
Ref: Build Changes<3>-Footnote-211016490
Ref: Build Changes<3>-Footnote-221016518
Ref: Build Changes<3>-Footnote-231016584
Ref: Build Changes<3>-Footnote-241016650
Ref: Build Changes<3>-Footnote-251016716
Ref: Build Changes<3>-Footnote-261016782
Ref: Build Changes<3>-Footnote-271016832
Ref: Build Changes<3>-Footnote-281016898
Ref: Build Changes<3>-Footnote-291016964
Ref: Build Changes<3>-Footnote-301017030
Ref: Build Changes<3>-Footnote-311017096
Ref: Build Changes<3>-Footnote-321017162
Ref: Build Changes<3>-Footnote-331017228
Node: C API の変更<5>1017294
Ref: whatsnew/3 11 c-api-changes1017445
Ref: 9541017445
Ref: whatsnew/3 11 whatsnew311-c-api1017445
Ref: 9551017445
Node: 新しい機能<7>1017708
Ref: whatsnew/3 11 id51017815
Ref: 9561017815
Ref: whatsnew/3 11 whatsnew311-c-api-new-features1017815
Ref: 9571017815
Ref: 新しい機能<7>-Footnote-11020666
Ref: 新しい機能<7>-Footnote-21020731
Ref: 新しい機能<7>-Footnote-31020796
Ref: 新しい機能<7>-Footnote-41020861
Ref: 新しい機能<7>-Footnote-51020926
Ref: 新しい機能<7>-Footnote-61020991
Ref: 新しい機能<7>-Footnote-71021056
Ref: 新しい機能<7>-Footnote-81021121
Ref: 新しい機能<7>-Footnote-91021186
Node: Porting to Python 3 11<2>1021241
Ref: whatsnew/3 11 id61021369
Ref: 9781021369
Ref: whatsnew/3 11 whatsnew311-c-api-porting1021369
Ref: 9471021369
Ref: whatsnew/3 11 whatsnew311-pep6701021434
Ref: 7cb1021434
Ref: whatsnew/3 11 pyframeobject-3-11-hiding1028849
Ref: 98b1028849
Ref: Porting to Python 3 11<2>-Footnote-11034806
Ref: Porting to Python 3 11<2>-Footnote-21034869
Ref: Porting to Python 3 11<2>-Footnote-31034911
Ref: Porting to Python 3 11<2>-Footnote-41034966
Ref: Porting to Python 3 11<2>-Footnote-51035031
Ref: Porting to Python 3 11<2>-Footnote-61035096
Ref: Porting to Python 3 11<2>-Footnote-71035161
Ref: Porting to Python 3 11<2>-Footnote-81035203
Ref: Porting to Python 3 11<2>-Footnote-91035268
Ref: Porting to Python 3 11<2>-Footnote-101035323
Ref: Porting to Python 3 11<2>-Footnote-111035379
Ref: Porting to Python 3 11<2>-Footnote-121035445
Ref: Porting to Python 3 11<2>-Footnote-131035488
Ref: Porting to Python 3 11<2>-Footnote-141035554
Ref: Porting to Python 3 11<2>-Footnote-151035620
Ref: Porting to Python 3 11<2>-Footnote-161035686
Ref: Porting to Python 3 11<2>-Footnote-171035752
Ref: Porting to Python 3 11<2>-Footnote-181035818
Ref: Porting to Python 3 11<2>-Footnote-191035884
Ref: Porting to Python 3 11<2>-Footnote-201035940
Ref: Porting to Python 3 11<2>-Footnote-211035993
Ref: Porting to Python 3 11<2>-Footnote-221036059
Ref: Porting to Python 3 11<2>-Footnote-231036125
Ref: Porting to Python 3 11<2>-Footnote-241036178
Node: 非推奨<5>1036211
Ref: whatsnew/3 11 id71036354
Ref: 9941036354
Ref: whatsnew/3 11 whatsnew311-c-api-deprecated1036354
Ref: 9241036354
Ref: 非推奨<5>-Footnote-11037318
Ref: 非推奨<5>-Footnote-21037360
Ref: 非推奨<5>-Footnote-31037415
Node: Pending Removal in Python 3 12<2>1037480
Ref: whatsnew/3 11 id81037607
Ref: 9961037607
Ref: whatsnew/3 11 whatsnew311-c-api-pending-removal1037607
Ref: 9331037607
Node: 削除<5>1038357
Ref: whatsnew/3 11 id91038463
Ref: 9981038463
Ref: whatsnew/3 11 whatsnew311-c-api-removed1038463
Ref: 9391038463
Ref: whatsnew/3 11 whatsnew311-pep6241040719
Ref: 7ca1040719
Ref: 削除<5>-Footnote-11041679
Ref: 削除<5>-Footnote-21041744
Ref: 削除<5>-Footnote-31041809
Ref: 削除<5>-Footnote-41041874
Ref: 削除<5>-Footnote-51041939
Ref: 削除<5>-Footnote-61042004
Ref: 削除<5>-Footnote-71042069
Ref: 削除<5>-Footnote-81042134
Ref: 削除<5>-Footnote-91042199
Ref: 削除<5>-Footnote-101042264
Ref: 削除<5>-Footnote-111042307
Ref: 削除<5>-Footnote-121042367
Node: Python 3 11 4での重要な変更点1042433
Ref: whatsnew/3 11 notable-changes-in-3-11-41042605
Ref: 99e1042605
Node: tarfile<2>1042721
Ref: whatsnew/3 11 tarfile1042805
Ref: 99f1042805
Ref: tarfile<2>-Footnote-11043409
Node: Python 3 11 5での重要な変更点1043451
Ref: whatsnew/3 11 notable-changes-in-3-11-51043596
Ref: 9a01043596
Node: OpenSSL1043701
Ref: whatsnew/3 11 openssl1043782
Ref: 9a11043782
Node: What's New In Python 3 101043901
Ref: whatsnew/3 10 doc1044050
Ref: 9a21044050
Ref: whatsnew/3 10 translation-repo1044050
Ref: 9a31044050
Ref: whatsnew/3 10 what-s-new-in-python-3-101044050
Ref: 9a41044050
Node: 概要 -- リリースハイライト<5>1045267
Ref: whatsnew/3 10 summary-release-highlights1045396
Ref: 9a51045396
Ref: 概要 -- リリースハイライト<5>-Footnote-11046666
Ref: 概要 -- リリースハイライト<5>-Footnote-21046708
Ref: 概要 -- リリースハイライト<5>-Footnote-31046750
Ref: 概要 -- リリースハイライト<5>-Footnote-41046792
Ref: 概要 -- リリースハイライト<5>-Footnote-51046857
Ref: 概要 -- リリースハイライト<5>-Footnote-61046899
Ref: 概要 -- リリースハイライト<5>-Footnote-71046941
Ref: 概要 -- リリースハイライト<5>-Footnote-81046983
Ref: 概要 -- リリースハイライト<5>-Footnote-91047025
Ref: 概要 -- リリースハイライト<5>-Footnote-101047067
Ref: 概要 -- リリースハイライト<5>-Footnote-111047110
Ref: 概要 -- リリースハイライト<5>-Footnote-121047153
Ref: 概要 -- リリースハイライト<5>-Footnote-131047196
Ref: 概要 -- リリースハイライト<5>-Footnote-141047239
Ref: 概要 -- リリースハイライト<5>-Footnote-151047282
Node: 新しい機能<8>1047325
Ref: whatsnew/3 10 new-features1047508
Ref: 9a61047508
Node: カッコ内のコンテキストマネージャー1047991
Ref: whatsnew/3 10 parenthesized-context-managers1048142
Ref: 9a71048142
Ref: whatsnew/3 10 whatsnew310-pep5631048142
Ref: 9a81048142
Ref: カッコ内のコンテキストマネージャー-Footnote-11049556
Ref: カッコ内のコンテキストマネージャー-Footnote-21049598
Ref: カッコ内のコンテキストマネージャー-Footnote-31049663
Node: エラーメッセージの改善<4>1049728
Ref: whatsnew/3 10 better-error-messages1049965
Ref: 9a91049965
Node: SyntaxErrors1050123
Ref: whatsnew/3 10 syntaxerrors1050234
Ref: 9aa1050234
Ref: SyntaxErrors-Footnote-11056245
Ref: SyntaxErrors-Footnote-21056310
Ref: SyntaxErrors-Footnote-31056375
Ref: SyntaxErrors-Footnote-41056440
Ref: SyntaxErrors-Footnote-51056505
Ref: SyntaxErrors-Footnote-61056570
Ref: SyntaxErrors-Footnote-71056635
Ref: SyntaxErrors-Footnote-81056700
Ref: SyntaxErrors-Footnote-91056765
Ref: SyntaxErrors-Footnote-101056830
Ref: SyntaxErrors-Footnote-111056896
Node: IndentationErrors1056962
Ref: whatsnew/3 10 indentationerrors1057097
Ref: 9ab1057097
Node: AttributeErrors1057567
Ref: whatsnew/3 10 attributeerrors1057700
Ref: 9ac1057700
Ref: AttributeErrors-Footnote-11058450
Node: NameErrors1058515
Ref: whatsnew/3 10 nameerrors1058622
Ref: 9ad1058622
Ref: NameErrors-Footnote-11059432
Node: PEP 626 デバッグおよびその他のツール用の正確な行番号。1059497
Ref: whatsnew/3 10 pep-626-precise-line-numbers-for-debugging-and-other-tools1059721
Ref: 9ae1059721
Node: PEP 634 構造的パターンマッチ1060431
Ref: whatsnew/3 10 pep-634-structural-pattern-matching1060672
Ref: 9b01060672
Node: 構文と演算1061541
Ref: whatsnew/3 10 syntax-and-operations1061667
Ref: 9b11061667
Node: 宣言的なアプローチ1062889
Ref: whatsnew/3 10 declarative-approach1063070
Ref: 9b21063070
Node: 単純パターン リテラルとのマッチ1064563
Ref: whatsnew/3 10 simple-pattern-match-to-a-literal1064783
Ref: 9b31064783
Node: ワイルドカードがないときの振る舞い1066435
Ref: whatsnew/3 10 behavior-without-the-wildcard1066569
Ref: 9b41066569
Node: リテラルと変数を組み合わせたパターン1067335
Ref: whatsnew/3 10 patterns-with-a-literal-and-variable1067552
Ref: 9b51067552
Node: パターンとクラス1068763
Ref: whatsnew/3 10 patterns-and-classes1068961
Ref: 9b61068961
Node: 位置パラメータを用いたパターン1070020
Ref: whatsnew/3 10 patterns-with-positional-parameters1070126
Ref: 9b71070126
Node: ネストしたパターン1070755
Ref: whatsnew/3 10 nested-patterns1070944
Ref: 9b81070944
Node: 複雑なパターンとワイルドカード1071726
Ref: whatsnew/3 10 complex-patterns-and-the-wildcard1071900
Ref: 9b91071900
Node: ガード1072633
Ref: whatsnew/3 10 guard1072807
Ref: 9ba1072807
Node: その他の主要な機能1073351
Ref: whatsnew/3 10 other-key-features1073471
Ref: 9bb1073471
Ref: その他の主要な機能-Footnote-11076388
Ref: その他の主要な機能-Footnote-21076430
Ref: その他の主要な機能-Footnote-31076472
Node: Optional EncodingWarning and encoding="locale" option1076514
Ref: whatsnew/3 10 optional-encodingwarning-and-encoding-locale-option1076669
Ref: 9bc1076669
Ref: whatsnew/3 10 whatsnew310-pep5971076669
Ref: 9bd1076669
Node: 型ヒントに関連する新しい機能<3>1077569
Ref: whatsnew/3 10 new-feat-related-type-hints1077739
Ref: 9c11077739
Ref: whatsnew/3 10 new-features-related-to-type-hints1077739
Ref: 9c21077739
Ref: 型ヒントに関連する新しい機能<3>-Footnote-11078242
Node: PEP 604 New Type Union Operator1078284
Ref: whatsnew/3 10 pep-604-new-type-union-operator1078447
Ref: 9c31078447
Ref: PEP 604 New Type Union Operator-Footnote-11079516
Ref: PEP 604 New Type Union Operator-Footnote-21079558
Ref: PEP 604 New Type Union Operator-Footnote-31079623
Node: PEP 612 Parameter Specification Variables1079688
Ref: whatsnew/3 10 pep-612-parameter-specification-variables1079877
Ref: 9c61079877
Ref: PEP 612 Parameter Specification Variables-Footnote-11081158
Ref: PEP 612 Parameter Specification Variables-Footnote-21081200
Ref: PEP 612 Parameter Specification Variables-Footnote-31081242
Ref: PEP 612 Parameter Specification Variables-Footnote-41081307
Node: PEP 613 TypeAlias1081372
Ref: whatsnew/3 10 pep-613-typealias1081562
Ref: 9cb1081562
Ref: PEP 613 TypeAlias-Footnote-11082415
Ref: PEP 613 TypeAlias-Footnote-21082457
Ref: PEP 613 TypeAlias-Footnote-31082499
Node: PEP 647 User-Defined Type Guards1082564
Ref: whatsnew/3 10 pep-647-user-defined-type-guards1082704
Ref: 9cd1082704
Ref: PEP 647 User-Defined Type Guards-Footnote-11083190
Ref: PEP 647 User-Defined Type Guards-Footnote-21083232
Node: その他の言語変更<4>1083297
Ref: whatsnew/3 10 other-language-changes1083476
Ref: 9ce1083476
Ref: その他の言語変更<4>-Footnote-11088154
Ref: その他の言語変更<4>-Footnote-21088219
Ref: その他の言語変更<4>-Footnote-31088284
Ref: その他の言語変更<4>-Footnote-41088326
Ref: その他の言語変更<4>-Footnote-51088391
Ref: その他の言語変更<4>-Footnote-61088456
Ref: その他の言語変更<4>-Footnote-71088521
Ref: その他の言語変更<4>-Footnote-81088586
Ref: その他の言語変更<4>-Footnote-91088651
Ref: その他の言語変更<4>-Footnote-101088693
Ref: その他の言語変更<4>-Footnote-111088759
Ref: その他の言語変更<4>-Footnote-121088825
Ref: その他の言語変更<4>-Footnote-131088891
Ref: その他の言語変更<4>-Footnote-141088957
Ref: その他の言語変更<4>-Footnote-151089023
Ref: その他の言語変更<4>-Footnote-161089089
Node: 新たなモジュール<4>1089155
Ref: whatsnew/3 10 new-modules1089322
Ref: 9db1089322
Node: 改良されたモジュール<4>1089389
Ref: whatsnew/3 10 improved-modules1089541
Ref: 9dc1089541
Node: asyncio<7>1090791
Ref: whatsnew/3 10 asyncio1090891
Ref: 9dd1090891
Ref: asyncio<7>-Footnote-11091069
Node: argparse<4>1091134
Ref: whatsnew/3 10 argparse1091251
Ref: 9df1091251
Ref: argparse<4>-Footnote-11091533
Node: array<2>1091597
Ref: whatsnew/3 10 array1091727
Ref: 9e01091727
Ref: array<2>-Footnote-11091969
Node: asynchat asyncore smtpd1092034
Ref: whatsnew/3 10 asynchat-asyncore-smtpd1092162
Ref: 9e21092162
Node: base64<3>1092422
Ref: whatsnew/3 10 base641092548
Ref: 9e31092548
Node: bdb<2>1092715
Ref: whatsnew/3 10 bdb1092824
Ref: 9e61092824
Ref: bdb<2>-Footnote-11092993
Node: bisect1093058
Ref: whatsnew/3 10 bisect1093164
Ref: 9e71093164
Ref: bisect-Footnote-11093381
Node: codecs1093445
Ref: whatsnew/3 10 codecs1093560
Ref: 9e81093560
Ref: codecs-Footnote-11093757
Node: collections abc1093822
Ref: whatsnew/3 10 collections-abc1093944
Ref: 9ea1093944
Ref: collections abc-Footnote-11094865
Node: contextlib<2>1094930
Ref: whatsnew/3 10 contextlib1095055
Ref: 9ed1095055
Ref: contextlib<2>-Footnote-11095577
Ref: contextlib<2>-Footnote-21095642
Node: curses<2>1095707
Ref: whatsnew/3 10 curses1095838
Ref: 9f11095838
Ref: curses<2>-Footnote-11096535
Ref: curses<2>-Footnote-21096600
Node: データクラス<2>1096665
Ref: whatsnew/3 10 dataclasses1096795
Ref: 9f71096795
Node: __slots__1096894
Ref: whatsnew/3 10 slots1096989
Ref: 9f81096989
Ref: __slots__-Footnote-11097191
Node: Keyword-only fields1097256
Ref: whatsnew/3 10 keyword-only-fields1097351
Ref: 9f91097351
Ref: Keyword-only fields-Footnote-11098824
Node: distutils<2>1098889
Ref: whatsnew/3 10 distutils1099020
Ref: 9fa1099020
Ref: whatsnew/3 10 distutils-deprecated1099020
Ref: 9341099020
Ref: distutils<2>-Footnote-11099928
Ref: distutils<2>-Footnote-21099970
Node: doctest<2>1100035
Ref: whatsnew/3 10 doctest1100169
Ref: 9fb1100169
Ref: doctest<2>-Footnote-11100373
Node: エンコーディング1100438
Ref: whatsnew/3 10 encodings1100567
Ref: 9fc1100567
Ref: エンコーディング-Footnote-11100785
Node: enum<4>1100850
Ref: whatsnew/3 10 enum1100978
Ref: 9fe1100978
Ref: enum<4>-Footnote-11101451
Ref: enum<4>-Footnote-21101516
Node: fileinput1101581
Ref: whatsnew/3 10 fileinput1101700
Ref: 9ff1101700
Ref: fileinput-Footnote-11102131
Ref: fileinput-Footnote-21102196
Node: faulthandler<2>1102260
Ref: whatsnew/3 10 faulthandler1102377
Ref: a021102377
Ref: faulthandler<2>-Footnote-11102619
Node: gc<2>1102684
Ref: whatsnew/3 10 gc1102799
Ref: a031102799
Ref: gc<2>-Footnote-11103024
Node: glob<2>1103089
Ref: whatsnew/3 10 glob1103199
Ref: a071103199
Ref: glob<2>-Footnote-11103463
Node: hashlib<3>1103528
Ref: whatsnew/3 10 hashlib1103640
Ref: a091103640
Ref: hashlib<3>-Footnote-11104183
Ref: hashlib<3>-Footnote-21104225
Ref: hashlib<3>-Footnote-31104290
Ref: hashlib<3>-Footnote-41104355
Node: hmac<2>1104420
Ref: whatsnew/3 10 hmac1104545
Ref: a0a1104545
Ref: hmac<2>-Footnote-11104729
Node: IDLE と idelelib<2>1104794
Ref: whatsnew/3 10 idle-and-idlelib1104930
Ref: a0b1104930
Ref: IDLE と idelelib<2>-Footnote-11107002
Ref: IDLE と idelelib<2>-Footnote-21107067
Ref: IDLE と idelelib<2>-Footnote-31107132
Ref: IDLE と idelelib<2>-Footnote-41107197
Ref: IDLE と idelelib<2>-Footnote-51107262
Ref: IDLE と idelelib<2>-Footnote-61107327
Ref: IDLE と idelelib<2>-Footnote-71107392
Ref: IDLE と idelelib<2>-Footnote-81107457
Node: importlib metadata<2>1107512
Ref: whatsnew/3 10 importlib-metadata1107651
Ref: a101107651
Ref: importlib metadata<2>-Footnote-11108245
Node: inspect<4>1108318
Ref: whatsnew/3 10 inspect1108449
Ref: a131108449
Ref: inspect<4>-Footnote-11109652
Ref: inspect<4>-Footnote-21109717
Node: itertools<4>1109782
Ref: whatsnew/3 10 itertools1109904
Ref: a151109904
Ref: itertools<4>-Footnote-11110070
Node: linecache<2>1110135
Ref: whatsnew/3 10 linecache1110252
Ref: a171110252
Ref: linecache<2>-Footnote-11110460
Node: os<5>1110525
Ref: whatsnew/3 10 os1110640
Ref: a181110640
Ref: os<5>-Footnote-11111379
Ref: os<5>-Footnote-21111444
Ref: os<5>-Footnote-31111509
Ref: os<5>-Footnote-41111574
Node: os path<4>1111639
Ref: whatsnew/3 10 os-path1111752
Ref: a1f1111752
Ref: os path<4>-Footnote-11112061
Node: pathlib<8>1112126
Ref: whatsnew/3 10 pathlib1112261
Ref: a201112261
Ref: pathlib<8>-Footnote-11112970
Ref: pathlib<8>-Footnote-21113035
Ref: pathlib<8>-Footnote-31113100
Ref: pathlib<8>-Footnote-41113165
Node: プラットフォーム<3>1113230
Ref: whatsnew/3 10 platform1113361
Ref: a261113361
Ref: プラットフォーム<3>-Footnote-11113654
Ref: プラットフォーム<3>-Footnote-21113727
Node: pprint1113792
Ref: whatsnew/3 10 pprint1113923
Ref: a281113923
Ref: pprint-Footnote-11114257
Ref: pprint-Footnote-21114322
Node: py_compile1114387
Ref: whatsnew/3 10 py-compile1114497
Ref: a2a1114497
Ref: py_compile-Footnote-11114705
Node: pyclbr1114770
Ref: whatsnew/3 10 pyclbr1114880
Ref: a2b1114880
Ref: pyclbr-Footnote-11115224
Node: shelve1115289
Ref: whatsnew/3 10 shelve1115402
Ref: a2e1115402
Ref: shelve-Footnote-11115675
Node: statistics<3>1115740
Ref: whatsnew/3 10 statistics1115854
Ref: a301115854
Ref: statistics<3>-Footnote-11116107
Node: site<2>1116172
Ref: whatsnew/3 10 site1116289
Ref: a331116289
Ref: site<2>-Footnote-11116487
Node: socket<3>1116552
Ref: whatsnew/3 10 socket1116662
Ref: a341116662
Ref: socket<3>-Footnote-11117108
Ref: socket<3>-Footnote-21117173
Ref: socket<3>-Footnote-31117238
Node: ssl<4>1117303
Ref: whatsnew/3 10 ssl1117416
Ref: a371117416
Ref: ssl<4>-Footnote-11119255
Ref: ssl<4>-Footnote-21119297
Ref: ssl<4>-Footnote-31119362
Ref: ssl<4>-Footnote-41119427
Ref: ssl<4>-Footnote-51119492
Ref: ssl<4>-Footnote-61119557
Ref: ssl<4>-Footnote-71119622
Ref: ssl<4>-Footnote-81119687
Ref: ssl<4>-Footnote-91119752
Ref: ssl<4>-Footnote-101119817
Ref: ssl<4>-Footnote-111119883
Ref: ssl<4>-Footnote-121119949
Ref: ssl<4>-Footnote-131120015
Ref: ssl<4>-Footnote-141120081
Ref: ssl<4>-Footnote-151120147
Node: sqlite3<6>1120213
Ref: whatsnew/3 10 sqlite31120323
Ref: a3e1120323
Ref: sqlite3<6>-Footnote-11120559
Node: sys<5>1120624
Ref: whatsnew/3 10 sys1120735
Ref: a401120735
Ref: sys<5>-Footnote-11121120
Ref: sys<5>-Footnote-21121185
Node: _thread1121250
Ref: whatsnew/3 10 thread1121363
Ref: a431121363
Ref: _thread-Footnote-11121619
Node: threading<4>1121684
Ref: whatsnew/3 10 threading1121803
Ref: a451121803
Ref: threading<4>-Footnote-11122345
Ref: threading<4>-Footnote-21122410
Node: traceback<3>1122475
Ref: whatsnew/3 10 traceback1122595
Ref: a4c1122595
Ref: traceback<3>-Footnote-11122923
Node: types<4>1122988
Ref: whatsnew/3 10 types1123105
Ref: a501123105
Ref: types<4>-Footnote-11123414
Node: typing<6>1123479
Ref: whatsnew/3 10 typing1123595
Ref: a541123595
Ref: typing<6>-Footnote-11125828
Ref: typing<6>-Footnote-21125870
Ref: typing<6>-Footnote-31125935
Ref: typing<6>-Footnote-41126000
Ref: typing<6>-Footnote-51126065
Node: unittest<6>1126130
Ref: whatsnew/3 10 unittest1126250
Ref: a571126250
Ref: unittest<6>-Footnote-11126466
Node: urllib parse1126531
Ref: whatsnew/3 10 urllib-parse1126648
Ref: a5a1126648
Ref: urllib parse-Footnote-11127797
Ref: urllib parse-Footnote-21127862
Ref: urllib parse-Footnote-31127921
Node: xml<2>1127976
Ref: whatsnew/3 10 xml1128094
Ref: a5b1128094
Ref: xml<2>-Footnote-11128310
Node: zipimport<3>1128375
Ref: whatsnew/3 10 zipimport1128472
Ref: a5d1128472
Ref: zipimport<3>-Footnote-11128852
Ref: zipimport<3>-Footnote-21128894
Ref: zipimport<3>-Footnote-31128959
Node: 最適化<5>1129024
Ref: whatsnew/3 10 optimizations1129161
Ref: a611129161
Ref: 最適化<5>-Footnote-11132630
Ref: 最適化<5>-Footnote-21132695
Ref: 最適化<5>-Footnote-31132760
Ref: 最適化<5>-Footnote-41132825
Ref: 最適化<5>-Footnote-51132890
Ref: 最適化<5>-Footnote-61132955
Ref: 最適化<5>-Footnote-71133076
Ref: 最適化<5>-Footnote-81133141
Ref: 最適化<5>-Footnote-91133206
Ref: 最適化<5>-Footnote-101133271
Ref: 最適化<5>-Footnote-111133337
Ref: 最適化<5>-Footnote-121133403
Ref: 最適化<5>-Footnote-131133446
Ref: 最適化<5>-Footnote-141133512
Ref: 最適化<5>-Footnote-151133578
Ref: 最適化<5>-Footnote-161133644
Ref: 最適化<5>-Footnote-171133710
Ref: 最適化<5>-Footnote-181133776
Node: 非推奨<6>1133842
Ref: whatsnew/3 10 deprecated1133955
Ref: a671133955
Ref: whatsnew/3 10 whatsnew310-deprecated1133955
Ref: a3c1133955
Ref: 非推奨<6>-Footnote-11143377
Ref: 非推奨<6>-Footnote-21143442
Ref: 非推奨<6>-Footnote-31143507
Ref: 非推奨<6>-Footnote-41143572
Ref: 非推奨<6>-Footnote-51143637
Ref: 非推奨<6>-Footnote-61143702
Ref: 非推奨<6>-Footnote-71143767
Ref: 非推奨<6>-Footnote-81143832
Ref: 非推奨<6>-Footnote-91143897
Ref: 非推奨<6>-Footnote-101143962
Ref: 非推奨<6>-Footnote-111144028
Ref: 非推奨<6>-Footnote-121144094
Ref: 非推奨<6>-Footnote-131144160
Ref: 非推奨<6>-Footnote-141144226
Ref: 非推奨<6>-Footnote-151144285
Ref: 非推奨<6>-Footnote-161144351
Ref: 非推奨<6>-Footnote-171144407
Ref: 非推奨<6>-Footnote-181144473
Ref: 非推奨<6>-Footnote-191144539
Ref: 非推奨<6>-Footnote-201144605
Node: 削除<6>1144671
Ref: whatsnew/3 10 removed1144794
Ref: a751144794
Ref: whatsnew/3 10 whatsnew310-removed1144794
Ref: a761144794
Ref: 削除<6>-Footnote-11148025
Ref: 削除<6>-Footnote-21148090
Ref: 削除<6>-Footnote-31148155
Ref: 削除<6>-Footnote-41148220
Ref: 削除<6>-Footnote-51148285
Ref: 削除<6>-Footnote-61148350
Ref: 削除<6>-Footnote-71148415
Node: Porting to Python 3 101148480
Ref: whatsnew/3 10 porting-to-python-3-101148629
Ref: a7b1148629
Node: Changes in the Python syntax1148969
Ref: whatsnew/3 10 changes-in-the-python-syntax1149088
Ref: a7c1149088
Ref: Changes in the Python syntax-Footnote-11149683
Node: Python API の変更<4>1149748
Ref: whatsnew/3 10 changes-in-the-python-api1149894
Ref: a7d1149894
Ref: whatsnew/3 10 changes-python-api1149894
Ref: a7a1149894
Ref: Python API の変更<4>-Footnote-11152804
Ref: Python API の変更<4>-Footnote-21152869
Ref: Python API の変更<4>-Footnote-31152934
Ref: Python API の変更<4>-Footnote-41152999
Ref: Python API の変更<4>-Footnote-51153064
Ref: Python API の変更<4>-Footnote-61153129
Node: C API の変更<6>1153194
Ref: whatsnew/3 10 changes-in-the-c-api1153303
Ref: a841153303
Node: CPython バイトコードの変更<4>1155762
Ref: whatsnew/3 10 cpython-bytecode-changes1155918
Ref: a8a1155918
Ref: CPython バイトコードの変更<4>-Footnote-11156228
Node: Build Changes<4>1156293
Ref: whatsnew/3 10 build-changes1156445
Ref: a8b1156445
Ref: Build Changes<4>-Footnote-11158905
Ref: Build Changes<4>-Footnote-21158947
Ref: Build Changes<4>-Footnote-31159012
Ref: Build Changes<4>-Footnote-41159077
Ref: Build Changes<4>-Footnote-51159142
Ref: Build Changes<4>-Footnote-61159207
Ref: Build Changes<4>-Footnote-71159272
Ref: Build Changes<4>-Footnote-81159337
Ref: Build Changes<4>-Footnote-91159402
Ref: Build Changes<4>-Footnote-101159467
Ref: Build Changes<4>-Footnote-111159533
Node: C API の変更<7>1159599
Ref: whatsnew/3 10 c-api-changes1159747
Ref: a901159747
Node: PEP 652 Maintaining the Stable ABI1160016
Ref: whatsnew/3 10 pep-652-maintaining-the-stable-abi1160132
Ref: a911160132
Ref: PEP 652 Maintaining the Stable ABI-Footnote-11160568
Ref: PEP 652 Maintaining the Stable ABI-Footnote-21160610
Node: 新しい機能<9>1160675
Ref: whatsnew/3 10 id11160825
Ref: a921160825
Ref: 新しい機能<9>-Footnote-11165451
Ref: 新しい機能<9>-Footnote-21165516
Ref: 新しい機能<9>-Footnote-31165581
Ref: 新しい機能<9>-Footnote-41165646
Ref: 新しい機能<9>-Footnote-51165711
Ref: 新しい機能<9>-Footnote-61165776
Ref: 新しい機能<9>-Footnote-71165841
Ref: 新しい機能<9>-Footnote-81165908
Ref: 新しい機能<9>-Footnote-91165973
Ref: 新しい機能<9>-Footnote-101166038
Ref: 新しい機能<9>-Footnote-111166104
Ref: 新しい機能<9>-Footnote-121166170
Ref: 新しい機能<9>-Footnote-131166236
Ref: 新しい機能<9>-Footnote-141166302
Ref: 新しい機能<9>-Footnote-151166368
Ref: 新しい機能<9>-Footnote-161166434
Ref: 新しい機能<9>-Footnote-171166500
Ref: 新しい機能<9>-Footnote-181166566
Node: Porting to Python 3 10<2>1166632
Ref: whatsnew/3 10 id21166760
Ref: aa71166760
Ref: Porting to Python 3 10<2>-Footnote-11170438
Ref: Porting to Python 3 10<2>-Footnote-21170480
Ref: Porting to Python 3 10<2>-Footnote-31170545
Ref: Porting to Python 3 10<2>-Footnote-41170610
Ref: Porting to Python 3 10<2>-Footnote-51170675
Ref: Porting to Python 3 10<2>-Footnote-61170740
Ref: Porting to Python 3 10<2>-Footnote-71170805
Ref: Porting to Python 3 10<2>-Footnote-81170870
Ref: Porting to Python 3 10<2>-Footnote-91170935
Ref: Porting to Python 3 10<2>-Footnote-101171000
Ref: Porting to Python 3 10<2>-Footnote-111171066
Node: 非推奨<7>1171132
Ref: whatsnew/3 10 id31171251
Ref: aad1171251
Ref: 非推奨<7>-Footnote-11171545
Node: 削除<7>1171610
Ref: whatsnew/3 10 id41171695
Ref: aaf1171695
Ref: 削除<7>-Footnote-11176695
Ref: 削除<7>-Footnote-21176760
Ref: 削除<7>-Footnote-31176802
Ref: 削除<7>-Footnote-41176867
Ref: 削除<7>-Footnote-51176932
Ref: 削除<7>-Footnote-61176997
Ref: 削除<7>-Footnote-71177062
Ref: 削除<7>-Footnote-81177127
Ref: 削除<7>-Footnote-91177192
Ref: 削除<7>-Footnote-101177234
Ref: 削除<7>-Footnote-111177300
Ref: 削除<7>-Footnote-121177366
Ref: 削除<7>-Footnote-131177432
Ref: 削除<7>-Footnote-141177498
Ref: 削除<7>-Footnote-151177564
Ref: 削除<7>-Footnote-161177630
Node: Notable security feature in 3 10 71177696
Ref: whatsnew/3 10 notable-security-feature-in-3-10-71177862
Ref: Notable security feature in 3 10 7-Footnote-11178592
Node: Notable security feature in 3 10 81178648
Ref: whatsnew/3 10 notable-security-feature-in-3-10-81178822
Ref: abd1178822
Ref: Notable security feature in 3 10 8-Footnote-11179244
Node: Notable changes in 3 10 121179299
Ref: whatsnew/3 10 notable-changes-in-3-10-121179430
Ref: abe1179430
Node: tarfile<3>1179532
Ref: whatsnew/3 10 tarfile1179605
Ref: abf1179605
Ref: tarfile<3>-Footnote-11180209
Node: What's New In Python 3 91180251
Ref: whatsnew/3 9 doc1180399
Ref: ac01180399
Ref: whatsnew/3 9 translation-repo1180399
Ref: ac11180399
Ref: whatsnew/3 9 what-s-new-in-python-3-91180399
Ref: ac21180399
Ref: What's New In Python 3 9-Footnote-11181881
Node: 概要 -- リリースハイライト<6>1181923
Ref: whatsnew/3 9 summary-release-highlights1182113
Ref: ac31182113
Ref: 概要 -- リリースハイライト<6>-Footnote-11184476
Ref: 概要 -- リリースハイライト<6>-Footnote-21184518
Ref: 概要 -- リリースハイライト<6>-Footnote-31184560
Ref: 概要 -- リリースハイライト<6>-Footnote-41184602
Ref: 概要 -- リリースハイライト<6>-Footnote-51184644
Ref: 概要 -- リリースハイライト<6>-Footnote-61184686
Ref: 概要 -- リリースハイライト<6>-Footnote-71184728
Ref: 概要 -- リリースハイライト<6>-Footnote-81184770
Ref: 概要 -- リリースハイライト<6>-Footnote-91184812
Ref: 概要 -- リリースハイライト<6>-Footnote-101184854
Node: コード中の非推奨警告 DeprecationWarning をチェックして下さい1184897
Ref: whatsnew/3 9 you-should-check-for-deprecationwarning-in-your-code1185115
Ref: ac41185115
Node: 新しい機能<10>1187268
Ref: whatsnew/3 9 new-features1187473
Ref: ac91187473
Node: 辞書のマージと更新演算子1187827
Ref: whatsnew/3 9 dictionary-merge-update-operators1187988
Ref: aca1187988
Ref: 辞書のマージと更新演算子-Footnote-11188804
Ref: 辞書のマージと更新演算子-Footnote-21188846
Node: prefixとsuffixを削除する新しい文字列メソッド1188911
Ref: whatsnew/3 9 new-string-methods-to-remove-prefixes-and-suffixes1189163
Ref: acb1189163
Ref: prefixとsuffixを削除する新しい文字列メソッド-Footnote-11189713
Ref: prefixとsuffixを削除する新しい文字列メソッド-Footnote-21189755
Node: 標準コレクション型の型ヒントにおける総称型 generics の使用1189820
Ref: whatsnew/3 9 type-hinting-generics-in-standard-collections1190057
Ref: ace1190057
Ref: 標準コレクション型の型ヒントにおける総称型 generics の使用-Footnote-11190925
Ref: 標準コレクション型の型ヒントにおける総称型 generics の使用-Footnote-21190967
Node: 新しいパーサー1191032
Ref: whatsnew/3 9 new-parser1191200
Ref: acf1191200
Ref: 新しいパーサー-Footnote-11192271
Ref: 新しいパーサー-Footnote-21192319
Ref: 新しいパーサー-Footnote-31192384
Ref: 新しいパーサー-Footnote-41192426
Node: その他の言語変更<5>1192491
Ref: whatsnew/3 9 other-language-changes1192643
Ref: ad01192643
Ref: その他の言語変更<5>-Footnote-11195745
Ref: その他の言語変更<5>-Footnote-21195810
Ref: その他の言語変更<5>-Footnote-31195875
Ref: その他の言語変更<5>-Footnote-41195940
Ref: その他の言語変更<5>-Footnote-51196005
Ref: その他の言語変更<5>-Footnote-61196047
Ref: その他の言語変更<5>-Footnote-71196112
Ref: その他の言語変更<5>-Footnote-81196177
Ref: その他の言語変更<5>-Footnote-91196242
Ref: その他の言語変更<5>-Footnote-101196307
Ref: その他の言語変更<5>-Footnote-111196373
Node: 新たなモジュール<5>1196439
Ref: whatsnew/3 9 new-modules1196605
Ref: ada1196605
Node: zoneinfo1196708
Ref: whatsnew/3 9 zoneinfo1196800
Ref: adb1196800
Ref: zoneinfo-Footnote-11198021
Ref: zoneinfo-Footnote-21198062
Node: graphlib<2>1198104
Ref: whatsnew/3 9 graphlib1198196
Ref: add1198196
Ref: graphlib<2>-Footnote-11198520
Node: 改良されたモジュール<5>1198585
Ref: whatsnew/3 9 improved-modules1198736
Ref: adf1198736
Node: ast<4>1199599
Ref: whatsnew/3 9 ast1199694
Ref: ae01199694
Ref: ast<4>-Footnote-11200362
Ref: ast<4>-Footnote-21200427
Ref: ast<4>-Footnote-31200492
Node: asyncio<8>1200557
Ref: whatsnew/3 9 asyncio1200674
Ref: ae31200674
Ref: asyncio<8>-Footnote-11202447
Ref: asyncio<8>-Footnote-21202512
Ref: asyncio<8>-Footnote-31202577
Ref: asyncio<8>-Footnote-41202642
Ref: asyncio<8>-Footnote-51202707
Ref: asyncio<8>-Footnote-61202772
Node: compileall<2>1202837
Ref: whatsnew/3 9 compileall1202969
Ref: ae81202969
Ref: compileall<2>-Footnote-11203549
Ref: compileall<2>-Footnote-21203614
Node: concurrent futures<3>1203679
Ref: whatsnew/3 9 concurrent-futures1203810
Ref: ae91203810
Ref: concurrent futures<3>-Footnote-11204689
Ref: concurrent futures<3>-Footnote-21204754
Ref: concurrent futures<3>-Footnote-31204819
Node: curses<3>1204884
Ref: whatsnew/3 9 curses1205013
Ref: aeb1205013
Ref: curses<3>-Footnote-11205327
Node: datetime<3>1205392
Ref: whatsnew/3 9 datetime1205512
Ref: af01205512
Ref: datetime<3>-Footnote-11205830
Node: distutils<3>1205895
Ref: whatsnew/3 9 distutils1206014
Ref: af31206014
Ref: distutils<3>-Footnote-11206265
Node: fcntl<2>1206330
Ref: whatsnew/3 9 fcntl1206447
Ref: af41206447
Ref: fcntl<2>-Footnote-11206654
Node: ftplib<2>1206719
Ref: whatsnew/3 9 ftplib1206829
Ref: af51206829
Ref: ftplib<2>-Footnote-11207119
Node: gc<3>1207184
Ref: whatsnew/3 9 gc1207296
Ref: af81207296
Ref: gc<3>-Footnote-11207834
Ref: gc<3>-Footnote-21207899
Node: hashlib<4>1207964
Ref: whatsnew/3 9 hashlib1208074
Ref: afa1208074
Ref: hashlib<4>-Footnote-11208583
Ref: hashlib<4>-Footnote-21208648
Node: http<2>1208713
Ref: whatsnew/3 9 http1208838
Ref: afb1208838
Ref: http<2>-Footnote-11209110
Ref: http<2>-Footnote-21209175
Node: IDLE と idelelib<3>1209240
Ref: whatsnew/3 9 idle-and-idlelib1209365
Ref: afd1209365
Ref: IDLE と idelelib<3>-Footnote-11210574
Ref: IDLE と idelelib<3>-Footnote-21210638
Ref: IDLE と idelelib<3>-Footnote-31210703
Ref: IDLE と idelelib<3>-Footnote-41210768
Ref: IDLE と idelelib<3>-Footnote-51210833
Ref: IDLE と idelelib<3>-Footnote-61210898
Ref: IDLE と idelelib<3>-Footnote-71210963
Node: imaplib<2>1211028
Ref: whatsnew/3 9 imaplib1211158
Ref: afe1211158
Ref: imaplib<2>-Footnote-11211992
Ref: imaplib<2>-Footnote-21212057
Node: importlib<3>1212122
Ref: whatsnew/3 9 importlib1212242
Ref: b051212242
Ref: importlib<3>-Footnote-11213034
Ref: importlib<3>-Footnote-21213099
Ref: importlib<3>-Footnote-31213164
Node: inspect<5>1213229
Ref: whatsnew/3 9 inspect1213351
Ref: b071213351
Ref: inspect<5>-Footnote-11213597
Ref: inspect<5>-Footnote-21213662
Node: ipaddress<2>1213727
Ref: whatsnew/3 9 ipaddress1213844
Ref: b091213844
Ref: ipaddress<2>-Footnote-11214409
Ref: ipaddress<2>-Footnote-21214474
Node: math<5>1214539
Ref: whatsnew/3 9 math1214664
Ref: b0b1214664
Ref: math<5>-Footnote-11215380
Ref: math<5>-Footnote-21215445
Ref: math<5>-Footnote-31215510
Ref: math<5>-Footnote-41215575
Ref: math<5>-Footnote-51215640
Node: multiprocessing<3>1215705
Ref: whatsnew/3 9 multiprocessing1215825
Ref: b0f1215825
Ref: multiprocessing<3>-Footnote-11216081
Node: nntplib1216146
Ref: whatsnew/3 9 nntplib1216264
Ref: b121216264
Ref: nntplib-Footnote-11216548
Node: os<6>1216613
Ref: whatsnew/3 9 os1216723
Ref: b131216723
Ref: os<6>-Footnote-11217536
Ref: os<6>-Footnote-21217601
Ref: os<6>-Footnote-31217666
Ref: os<6>-Footnote-41217731
Ref: os<6>-Footnote-51217796
Ref: os<6>-Footnote-61217861
Node: pathlib<9>1217926
Ref: whatsnew/3 9 pathlib1218035
Ref: b181218035
Ref: pathlib<9>-Footnote-11218249
Node: pdb<5>1218314
Ref: whatsnew/3 9 pdb1218424
Ref: b1b1218424
Ref: pdb<5>-Footnote-11218612
Node: poplib1218677
Ref: whatsnew/3 9 poplib1218786
Ref: b1c1218786
Ref: poplib-Footnote-11219080
Node: pprint<2>1219145
Ref: whatsnew/3 9 pprint1219256
Ref: b1f1219256
Ref: pprint<2>-Footnote-11219452
Node: pydoc<2>1219517
Ref: whatsnew/3 9 pydoc1219631
Ref: b201219631
Ref: pydoc<2>-Footnote-11219898
Node: random<3>1219963
Ref: whatsnew/3 9 random1220074
Ref: b221220074
Ref: random<3>-Footnote-11220275
Node: signal1220340
Ref: whatsnew/3 9 signal1220450
Ref: b241220450
Ref: signal-Footnote-11220680
Node: smtplib1220745
Ref: whatsnew/3 9 smtplib1220855
Ref: b261220855
Ref: smtplib-Footnote-11221267
Ref: smtplib-Footnote-21221332
Node: socket<4>1221397
Ref: whatsnew/3 9 socket1221508
Ref: b2a1221508
Ref: socket<4>-Footnote-11222094
Ref: socket<4>-Footnote-21222159
Ref: socket<4>-Footnote-31222224
Node: time<3>1222289
Ref: whatsnew/3 9 time1222399
Ref: b2f1222399
Ref: time<3>-Footnote-11222729
Node: sys<6>1222794
Ref: whatsnew/3 9 sys1222906
Ref: b311222906
Ref: sys<6>-Footnote-11223571
Ref: sys<6>-Footnote-21223638
Node: tracemalloc1223703
Ref: whatsnew/3 9 tracemalloc1223817
Ref: b341223817
Ref: tracemalloc-Footnote-11224101
Node: typing<7>1224166
Ref: whatsnew/3 9 typing1224288
Ref: b361224288
Ref: typing<7>-Footnote-11224644
Node: unicodedata<5>1224686
Ref: whatsnew/3 9 unicodedata1224804
Ref: b381224804
Ref: unicodedata<5>-Footnote-11224982
Node: venv<3>1225047
Ref: whatsnew/3 9 venv1225162
Ref: b391225162
Ref: venv<3>-Footnote-11225624
Node: xml<3>1225689
Ref: whatsnew/3 9 xml1225781
Ref: b3a1225781
Ref: xml<3>-Footnote-11226139
Node: 最適化<6>1226204
Ref: whatsnew/3 9 optimizations1226340
Ref: b3b1226340
Ref: 最適化<6>-Footnote-11232090
Ref: 最適化<6>-Footnote-21232155
Ref: 最適化<6>-Footnote-31232220
Ref: 最適化<6>-Footnote-41232285
Ref: 最適化<6>-Footnote-51232350
Ref: 最適化<6>-Footnote-61232392
Ref: 最適化<6>-Footnote-71232457
Ref: 最適化<6>-Footnote-81232521
Ref: 最適化<6>-Footnote-91232586
Ref: 最適化<6>-Footnote-101232651
Ref: 最適化<6>-Footnote-111232717
Ref: 最適化<6>-Footnote-121232846
Node: 非推奨<8>1232895
Ref: whatsnew/3 9 deprecated1233007
Ref: b401233007
Ref: 非推奨<8>-Footnote-11238104
Ref: 非推奨<8>-Footnote-21238169
Ref: 非推奨<8>-Footnote-31238234
Ref: 非推奨<8>-Footnote-41238299
Ref: 非推奨<8>-Footnote-51238364
Ref: 非推奨<8>-Footnote-61238429
Ref: 非推奨<8>-Footnote-71238494
Ref: 非推奨<8>-Footnote-81238559
Ref: 非推奨<8>-Footnote-91238624
Ref: 非推奨<8>-Footnote-101238689
Ref: 非推奨<8>-Footnote-111238755
Ref: 非推奨<8>-Footnote-121238821
Ref: 非推奨<8>-Footnote-131238887
Ref: 非推奨<8>-Footnote-141238953
Ref: 非推奨<8>-Footnote-151239019
Ref: 非推奨<8>-Footnote-161239062
Ref: 非推奨<8>-Footnote-171239102
Ref: 非推奨<8>-Footnote-181239141
Ref: 非推奨<8>-Footnote-191239207
Node: 削除<8>1239273
Ref: whatsnew/3 9 removed1239395
Ref: b421239395
Ref: whatsnew/3 9 removed-in-python-391239395
Ref: ac81239395
Ref: 削除<8>-Footnote-11245535
Ref: 削除<8>-Footnote-21245600
Ref: 削除<8>-Footnote-31245665
Ref: 削除<8>-Footnote-41245730
Ref: 削除<8>-Footnote-51245795
Ref: 削除<8>-Footnote-61245860
Ref: 削除<8>-Footnote-71245925
Ref: 削除<8>-Footnote-81245990
Ref: 削除<8>-Footnote-91246055
Ref: 削除<8>-Footnote-101246120
Ref: 削除<8>-Footnote-111246186
Ref: 削除<8>-Footnote-121246229
Ref: 削除<8>-Footnote-131246295
Ref: 削除<8>-Footnote-141246361
Ref: 削除<8>-Footnote-151246427
Ref: 削除<8>-Footnote-161246493
Ref: 削除<8>-Footnote-171246559
Ref: 削除<8>-Footnote-181246625
Ref: 削除<8>-Footnote-191246691
Ref: 削除<8>-Footnote-201246757
Ref: 削除<8>-Footnote-211246823
Ref: 削除<8>-Footnote-221246889
Node: Python 3 9への移植1246955
Ref: whatsnew/3 9 porting-to-python-3-91247081
Ref: b511247081
Node: Python API の変更<5>1247463
Ref: whatsnew/3 9 changes-in-the-python-api1247572
Ref: b521247572
Ref: Python API の変更<5>-Footnote-11251751
Ref: Python API の変更<5>-Footnote-21251816
Ref: Python API の変更<5>-Footnote-31251881
Ref: Python API の変更<5>-Footnote-41251946
Ref: Python API の変更<5>-Footnote-51252005
Ref: Python API の変更<5>-Footnote-61252070
Ref: Python API の変更<5>-Footnote-71252135
Ref: Python API の変更<5>-Footnote-81252200
Ref: Python API の変更<5>-Footnote-91252265
Ref: Python API の変更<5>-Footnote-101252330
Ref: Python API の変更<5>-Footnote-111252396
Node: C API の変更<8>1252462
Ref: whatsnew/3 9 changes-in-the-c-api1252618
Ref: b5d1252618
Ref: C API の変更<8>-Footnote-11254732
Ref: C API の変更<8>-Footnote-21254797
Ref: C API の変更<8>-Footnote-31254862
Node: CPython バイトコードの変更<5>1254927
Ref: whatsnew/3 9 cpython-bytecode-changes1255051
Ref: b5f1255051
Ref: CPython バイトコードの変更<5>-Footnote-11255856
Ref: CPython バイトコードの変更<5>-Footnote-21255921
Node: Build Changes<5>1255986
Ref: whatsnew/3 9 build-changes1256121
Ref: b621256121
Ref: Build Changes<5>-Footnote-11258535
Ref: Build Changes<5>-Footnote-21258602
Ref: Build Changes<5>-Footnote-31258667
Ref: Build Changes<5>-Footnote-41258732
Ref: Build Changes<5>-Footnote-51258797
Ref: Build Changes<5>-Footnote-61258862
Ref: Build Changes<5>-Footnote-71258927
Ref: Build Changes<5>-Footnote-81258992
Node: C API の変更<9>1259057
Ref: whatsnew/3 9 c-api-changes1259207
Ref: b641259207
Node: 新しい機能<11>1259375
Ref: whatsnew/3 9 id11259483
Ref: b651259483
Ref: 新しい機能<11>-Footnote-11262501
Ref: 新しい機能<11>-Footnote-21262543
Ref: 新しい機能<11>-Footnote-31262608
Ref: 新しい機能<11>-Footnote-41262673
Ref: 新しい機能<11>-Footnote-51262738
Ref: 新しい機能<11>-Footnote-61262803
Ref: 新しい機能<11>-Footnote-71262868
Ref: 新しい機能<11>-Footnote-81262933
Ref: 新しい機能<11>-Footnote-91262998
Ref: 新しい機能<11>-Footnote-101263063
Ref: 新しい機能<11>-Footnote-111263129
Ref: 新しい機能<11>-Footnote-121263195
Node: Python 3 9への移植<2>1263261
Ref: whatsnew/3 9 id21263387
Ref: b701263387
Ref: Python 3 9への移植<2>-Footnote-11267208
Ref: Python 3 9への移植<2>-Footnote-21267250
Ref: Python 3 9への移植<2>-Footnote-31267315
Ref: Python 3 9への移植<2>-Footnote-41267380
Ref: Python 3 9への移植<2>-Footnote-51267444
Ref: Python 3 9への移植<2>-Footnote-61267509
Ref: Python 3 9への移植<2>-Footnote-71267574
Ref: Python 3 9への移植<2>-Footnote-81267616
Ref: Python 3 9への移植<2>-Footnote-91267681
Ref: Python 3 9への移植<2>-Footnote-101267746
Ref: Python 3 9への移植<2>-Footnote-111267812
Node: 削除<9>1267878
Ref: whatsnew/3 9 id31267976
Ref: b831267976
Ref: 削除<9>-Footnote-11271913
Ref: 削除<9>-Footnote-21271978
Ref: 削除<9>-Footnote-31272043
Ref: 削除<9>-Footnote-41272108
Ref: 削除<9>-Footnote-51272173
Ref: 削除<9>-Footnote-61272238
Ref: 削除<9>-Footnote-71272303
Ref: 削除<9>-Footnote-81272368
Ref: 削除<9>-Footnote-91272433
Ref: 削除<9>-Footnote-101272498
Ref: 削除<9>-Footnote-111272564
Ref: 削除<9>-Footnote-121272607
Ref: 削除<9>-Footnote-131272673
Node: Python 3 9 1 での重要な変更点1272739
Ref: whatsnew/3 9 notable-changes-in-python-3-9-11272910
Ref: b861272910
Node: typing<8>1273158
Ref: whatsnew/3 9 id41273313
Ref: b871273313
Ref: typing<8>-Footnote-11274510
Ref: typing<8>-Footnote-21274552
Node: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート1274617
Ref: whatsnew/3 9 macos-11-0-big-sur-and-apple-silicon-mac-support1274772
Ref: b881274772
Ref: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート-Footnote-11275598
Node: Python 3 9 2 での重要な変更点1275663
Ref: whatsnew/3 9 notable-changes-in-python-3-9-21275853
Ref: b891275853
Node: collections abc<2>1276018
Ref: whatsnew/3 9 collections-abc1276134
Ref: b8a1276134
Ref: collections abc<2>-Footnote-11277113
Node: urllib parse<2>1277178
Ref: whatsnew/3 9 urllib-parse1277294
Ref: b8b1277294
Ref: urllib parse<2>-Footnote-11277978
Node: Python 3 9 3 での重要な変更点1278043
Ref: whatsnew/3 9 notable-changes-in-python-3-9-31278232
Ref: b8c1278232
Ref: Python 3 9 3 での重要な変更点-Footnote-11278707
Node: Python 3 9 5での重要な変更点1278762
Ref: whatsnew/3 9 notable-changes-in-python-3-9-51278948
Ref: b8d1278948
Node: urllib parse<3>1279072
Ref: whatsnew/3 9 id51279160
Ref: b8e1279160
Ref: urllib parse<3>-Footnote-11279689
Ref: urllib parse<3>-Footnote-21279748
Node: Notable security feature in 3 9 141279803
Ref: whatsnew/3 9 notable-security-feature-in-3-9-141279977
Ref: b8f1279977
Ref: Notable security feature in 3 9 14-Footnote-11280707
Node: Notable changes in 3 9 171280763
Ref: whatsnew/3 9 notable-changes-in-3-9-171280892
Ref: b901280892
Node: tarfile<4>1280992
Ref: whatsnew/3 9 tarfile1281064
Ref: b911281064
Ref: tarfile<4>-Footnote-11281668
Node: What's New In Python 3 81281710
Ref: whatsnew/3 8 doc1281857
Ref: b921281857
Ref: whatsnew/3 8 translation-repo1281857
Ref: b931281857
Ref: whatsnew/3 8 what-s-new-in-python-3-81281857
Ref: b941281857
Node: 概要 -- リリースハイライト<7>1283314
Ref: whatsnew/3 8 summary-release-highlights1283443
Ref: b951283443
Node: 新しい機能<12>1283519
Ref: whatsnew/3 8 new-features1283684
Ref: b961283684
Node: 代入式1284386
Ref: whatsnew/3 8 assignment-expressions1284478
Ref: b971284478
Ref: 代入式-Footnote-11286198
Ref: 代入式-Footnote-21286295
Ref: 代入式-Footnote-31286337
Node: 位置専用引数1286402
Ref: whatsnew/3 8 positional-only-parameters1286617
Ref: b981286617
Ref: 位置専用引数-Footnote-11289544
Ref: 位置専用引数-Footnote-21289606
Ref: 位置専用引数-Footnote-31289648
Node: コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム1289713
Ref: whatsnew/3 8 parallel-filesystem-cache-for-compiled-bytecode-files1289980
Ref: b9a1289980
Ref: コンパイル済みのバイトコードファイルのキャッシュを併存させるファイルシステム-Footnote-11290912
Node: デバッグビルドとリリースビルドのABI 共通化1290977
Ref: whatsnew/3 8 debug-build-uses-the-same-abi-as-release-build1291283
Ref: b9d1291283
Ref: デバッグビルドとリリースビルドのABI 共通化-Footnote-11294396
Ref: デバッグビルドとリリースビルドのABI 共通化-Footnote-21294461
Ref: デバッグビルドとリリースビルドのABI 共通化-Footnote-31294526
Ref: デバッグビルドとリリースビルドのABI 共通化-Footnote-41294591
Node: f-string での = を用いたオブジェクトの表現1294656
Ref: whatsnew/3 8 bpo-36817-whatsnew1294895
Ref: b9f1294895
Ref: whatsnew/3 8 f-strings-support-for-self-documenting-expressions-and-debugging1294895
Ref: ba01294895
Ref: f-string での = を用いたオブジェクトの表現-Footnote-11296071
Node: PEP 578 Pythonランタイムの監査フック1296136
Ref: whatsnew/3 8 pep-578-python-runtime-audit-hooks1296344
Ref: ba11296344
Ref: PEP 578 Pythonランタイムの監査フック-Footnote-11296997
Node: PEP 587 Python 初期化設定1297039
Ref: whatsnew/3 8 pep-587-python-initialization-configuration1297244
Ref: ba21297244
Ref: PEP 587 Python 初期化設定-Footnote-11299233
Ref: PEP 587 Python 初期化設定-Footnote-21299275
Ref: PEP 587 Python 初期化設定-Footnote-31299317
Node: PEP 590 Vectorcall a fast calling protocol for CPython1299382
Ref: whatsnew/3 8 pep-590-vectorcall-a-fast-calling-protocol-for-cpython1299619
Ref: bbd1299619
Ref: PEP 590 Vectorcall a fast calling protocol for CPython-Footnote-11300266
Ref: PEP 590 Vectorcall a fast calling protocol for CPython-Footnote-21300308
Node: Pickle プロトコルバージョン 5 による帯域外データバッファ1300373
Ref: whatsnew/3 8 pickle-protocol-5-with-out-of-band-data-buffers1300571
Ref: bbe1300571
Ref: Pickle プロトコルバージョン 5 による帯域外データバッファ-Footnote-11301427
Ref: Pickle プロトコルバージョン 5 による帯域外データバッファ-Footnote-21301469
Ref: Pickle プロトコルバージョン 5 による帯域外データバッファ-Footnote-31301511
Node: その他の言語変更<6>1301576
Ref: whatsnew/3 8 other-language-changes1301728
Ref: bbf1301728
Ref: その他の言語変更<6>-Footnote-11309869
Ref: その他の言語変更<6>-Footnote-21309934
Ref: その他の言語変更<6>-Footnote-31309999
Ref: その他の言語変更<6>-Footnote-41310064
Ref: その他の言語変更<6>-Footnote-51310129
Ref: その他の言語変更<6>-Footnote-61310194
Ref: その他の言語変更<6>-Footnote-71310259
Ref: その他の言語変更<6>-Footnote-81310324
Ref: その他の言語変更<6>-Footnote-91310389
Ref: その他の言語変更<6>-Footnote-101310454
Ref: その他の言語変更<6>-Footnote-111310520
Ref: その他の言語変更<6>-Footnote-121310588
Ref: その他の言語変更<6>-Footnote-131310654
Ref: その他の言語変更<6>-Footnote-141310724
Ref: その他の言語変更<6>-Footnote-151310784
Ref: その他の言語変更<6>-Footnote-161310850
Ref: その他の言語変更<6>-Footnote-171310916
Node: 新たなモジュール<6>1310982
Ref: whatsnew/3 8 new-modules1311148
Ref: bc81311148
Ref: 新たなモジュール<6>-Footnote-11312354
Node: 改良されたモジュール<6>1312419
Ref: whatsnew/3 8 improved-modules1312570
Ref: bc91312570
Node: ast<5>1313616
Ref: whatsnew/3 8 ast1313711
Ref: bca1313711
Ref: ast<5>-Footnote-11314943
Ref: ast<5>-Footnote-21315008
Ref: ast<5>-Footnote-31315050
Ref: ast<5>-Footnote-41315092
Ref: ast<5>-Footnote-51315134
Node: asyncio<9>1315199
Ref: whatsnew/3 8 asyncio1315314
Ref: bcc1315314
Ref: asyncio<9>-Footnote-11318968
Ref: asyncio<9>-Footnote-21319033
Ref: asyncio<9>-Footnote-31319098
Ref: asyncio<9>-Footnote-41319163
Ref: asyncio<9>-Footnote-51319228
Ref: asyncio<9>-Footnote-61319293
Ref: asyncio<9>-Footnote-71319358
Ref: asyncio<9>-Footnote-81319423
Ref: asyncio<9>-Footnote-91319488
Ref: asyncio<9>-Footnote-101319541
Node: builtins<2>1319607
Ref: whatsnew/3 8 builtins1319727
Ref: bd21319727
Ref: builtins<2>-Footnote-11320320
Node: collections1320385
Ref: whatsnew/3 8 collections1320503
Ref: bd31320503
Ref: collections-Footnote-11321095
Node: cProfile1321160
Ref: whatsnew/3 8 cprofile1321273
Ref: bd51321273
Ref: cProfile-Footnote-11321713
Node: csv<2>1321778
Ref: whatsnew/3 8 csv1321889
Ref: bd71321889
Ref: csv<2>-Footnote-11322290
Node: curses<4>1322355
Ref: whatsnew/3 8 curses1322467
Ref: bd91322467
Ref: curses<4>-Footnote-11322730
Node: ctypes<3>1322795
Ref: whatsnew/3 8 ctypes1322912
Ref: ctypes<3>-Footnote-11323559
Node: datetime<4>1323624
Ref: whatsnew/3 8 datetime1323744
Ref: bde1323744
Ref: datetime<4>-Footnote-11324177
Node: functools<3>1324242
Ref: whatsnew/3 8 functools1324358
Ref: be11324358
Ref: functools<3>-Footnote-11326047
Ref: functools<3>-Footnote-21326112
Ref: functools<3>-Footnote-31326177
Node: gc<4>1326242
Ref: whatsnew/3 8 gc1326354
Ref: be61326354
Ref: gc<4>-Footnote-11326640
Node: gettext1326705
Ref: whatsnew/3 8 gettext1326812
Ref: be71326812
Ref: gettext-Footnote-11327054
Node: gzip<3>1327118
Ref: whatsnew/3 8 gzip1327240
Ref: be91327240
Ref: gzip<3>-Footnote-11327771
Ref: gzip<3>-Footnote-21327836
Node: IDLE と idelelib<4>1327900
Ref: whatsnew/3 8 idle-and-idlelib1328025
Ref: beb1328025
Ref: IDLE と idelelib<4>-Footnote-11330025
Ref: IDLE と idelelib<4>-Footnote-21330092
Ref: IDLE と idelelib<4>-Footnote-31330156
Ref: IDLE と idelelib<4>-Footnote-41330221
Ref: IDLE と idelelib<4>-Footnote-51330286
Ref: IDLE と idelelib<4>-Footnote-61330351
Ref: IDLE と idelelib<4>-Footnote-71330415
Ref: IDLE と idelelib<4>-Footnote-81330480
Node: inspect<6>1330545
Ref: whatsnew/3 8 inspect1330668
Ref: bec1330668
Ref: inspect<6>-Footnote-11331509
Node: io<5>1331574
Ref: whatsnew/3 8 io1331689
Ref: bee1331689
Ref: io<5>-Footnote-11332037
Node: itertools<5>1332102
Ref: whatsnew/3 8 itertools1332216
Ref: bef1332216
Ref: itertools<5>-Footnote-11332621
Node: json tool1332686
Ref: whatsnew/3 8 json-tool1332805
Ref: bf11332805
Ref: json tool-Footnote-11333057
Node: logging<2>1333122
Ref: whatsnew/3 8 logging1333236
Ref: bf21333236
Ref: logging<2>-Footnote-11333951
Node: math<6>1334016
Ref: whatsnew/3 8 math1334128
Ref: bf41334128
Ref: math<6>-Footnote-11336069
Ref: math<6>-Footnote-21336134
Ref: math<6>-Footnote-31336199
Ref: math<6>-Footnote-41336264
Ref: math<6>-Footnote-51336329
Ref: math<6>-Footnote-61336394
Ref: math<6>-Footnote-71336459
Ref: math<6>-Footnote-81336524
Node: mmap<2>1336589
Ref: whatsnew/3 8 mmap1336709
Ref: bfa1336709
Ref: mmap<2>-Footnote-11336939
Node: multiprocessing<4>1337004
Ref: whatsnew/3 8 multiprocessing1337122
Ref: bfc1337122
Ref: multiprocessing<4>-Footnote-11337426
Ref: multiprocessing<4>-Footnote-21337491
Node: os<7>1337556
Ref: whatsnew/3 8 os1337677
Ref: bfd1337677
Ref: os<7>-Footnote-11339199
Ref: os<7>-Footnote-21339264
Ref: os<7>-Footnote-31339329
Node: os path<5>1339394
Ref: whatsnew/3 8 os-path1339508
Ref: c021339508
Ref: os path<5>-Footnote-11340531
Ref: os path<5>-Footnote-21340596
Ref: os path<5>-Footnote-31340661
Node: pathlib<10>1340726
Ref: whatsnew/3 8 pathlib1340844
Ref: c0a1340844
Ref: pathlib<10>-Footnote-11341753
Ref: pathlib<10>-Footnote-21341818
Node: pickle<2>1341883
Ref: whatsnew/3 8 pickle1341999
Ref: c121341999
Ref: pickle<2>-Footnote-11342337
Node: plistlib1342402
Ref: whatsnew/3 8 plistlib1342516
Ref: c151342516
Ref: plistlib-Footnote-11342754
Node: pprint<3>1342819
Ref: whatsnew/3 8 pprint1342937
Ref: c171342937
Ref: pprint<3>-Footnote-11344002
Node: py_compile<2>1344067
Ref: whatsnew/3 8 py-compile1344182
Ref: c191344182
Ref: py_compile<2>-Footnote-11344371
Node: shlex1344436
Ref: whatsnew/3 8 shlex1344551
Ref: c1b1344551
Ref: shlex-Footnote-11344755
Node: shutil<4>1344820
Ref: whatsnew/3 8 shutil1344931
Ref: c1d1344931
Ref: shutil<4>-Footnote-11345584
Ref: shutil<4>-Footnote-21345649
Ref: shutil<4>-Footnote-31345714
Node: socket<5>1345779
Ref: whatsnew/3 8 socket1345891
Ref: c1f1345891
Ref: socket<5>-Footnote-11346466
Ref: socket<5>-Footnote-21346531
Node: ssl<5>1346596
Ref: whatsnew/3 8 ssl1346712
Ref: c251346712
Ref: ssl<5>-Footnote-11346974
Node: statistics<4>1347039
Ref: whatsnew/3 8 statistics1347152
Ref: c281347152
Ref: statistics<4>-Footnote-11348881
Ref: statistics<4>-Footnote-21348946
Ref: statistics<4>-Footnote-31349011
Ref: statistics<4>-Footnote-41349076
Ref: statistics<4>-Footnote-51349141
Node: sys<7>1349206
Ref: whatsnew/3 8 sys1349323
Ref: c2e1349323
Ref: sys<7>-Footnote-11349762
Node: tarfile<5>1349827
Ref: whatsnew/3 8 tarfile1349943
Ref: c2f1349943
Ref: tarfile<5>-Footnote-11350361
Node: threading<5>1350426
Ref: whatsnew/3 8 threading1350547
Ref: c301350547
Ref: threading<5>-Footnote-11351283
Ref: threading<5>-Footnote-21351350
Node: tokenize<2>1351415
Ref: whatsnew/3 8 tokenize1351536
Ref: c341351536
Ref: tokenize<2>-Footnote-11351862
Node: tkinter<5>1351927
Ref: whatsnew/3 8 tkinter1352043
Ref: c351352043
Ref: tkinter<5>-Footnote-11352586
Ref: tkinter<5>-Footnote-21352651
Ref: tkinter<5>-Footnote-31352716
Node: time<4>1352781
Ref: whatsnew/3 8 time1352895
Ref: c361352895
Ref: time<4>-Footnote-11353074
Node: typing<9>1353139
Ref: whatsnew/3 8 typing1353257
Ref: c381353257
Ref: typing<9>-Footnote-11354723
Ref: typing<9>-Footnote-21354765
Ref: typing<9>-Footnote-31354807
Ref: typing<9>-Footnote-41354849
Node: unicodedata<6>1354891
Ref: whatsnew/3 8 unicodedata1355013
Ref: c3b1355013
Ref: unicodedata<6>-Footnote-11355442
Ref: unicodedata<6>-Footnote-21355504
Ref: unicodedata<6>-Footnote-31355569
Node: unittest<7>1355634
Ref: whatsnew/3 8 unittest1355754
Ref: c3d1355754
Ref: unittest<7>-Footnote-11357076
Ref: unittest<7>-Footnote-21357141
Ref: unittest<7>-Footnote-31357206
Ref: unittest<7>-Footnote-41357271
Node: venv<4>1357336
Ref: whatsnew/3 8 venv1357449
Ref: c441357449
Ref: venv<4>-Footnote-11357701
Node: weakref1357766
Ref: whatsnew/3 8 weakref1357874
Ref: c451357874
Ref: weakref-Footnote-11358167
Node: xml<4>1358232
Ref: whatsnew/3 8 xml1358339
Ref: c471358339
Ref: xml<4>-Footnote-11359495
Ref: xml<4>-Footnote-21359560
Ref: xml<4>-Footnote-31359625
Ref: xml<4>-Footnote-41359690
Ref: xml<4>-Footnote-51359755
Node: xmlrpc1359820
Ref: whatsnew/3 8 xmlrpc1359911
Ref: c4b1359911
Ref: xmlrpc-Footnote-11360303
Node: 最適化<7>1360368
Ref: whatsnew/3 8 optimizations1360529
Ref: c4d1360529
Ref: 最適化<7>-Footnote-11364890
Ref: 最適化<7>-Footnote-21364955
Ref: 最適化<7>-Footnote-31365020
Ref: 最適化<7>-Footnote-41365085
Ref: 最適化<7>-Footnote-51365150
Ref: 最適化<7>-Footnote-61365215
Ref: 最適化<7>-Footnote-71365280
Ref: 最適化<7>-Footnote-81365345
Ref: 最適化<7>-Footnote-91365410
Ref: 最適化<7>-Footnote-101365475
Ref: 最適化<7>-Footnote-111365541
Ref: 最適化<7>-Footnote-121365607
Ref: 最適化<7>-Footnote-131365673
Node: ビルドならびに C API の変更1365739
Ref: whatsnew/3 8 build-and-c-api-changes1365879
Ref: c581365879
Ref: ビルドならびに C API の変更-Footnote-11371472
Ref: ビルドならびに C API の変更-Footnote-21371537
Ref: ビルドならびに C API の変更-Footnote-31371602
Ref: ビルドならびに C API の変更-Footnote-41371667
Ref: ビルドならびに C API の変更-Footnote-51371732
Ref: ビルドならびに C API の変更-Footnote-61371797
Ref: ビルドならびに C API の変更-Footnote-71371862
Ref: ビルドならびに C API の変更-Footnote-81371927
Ref: ビルドならびに C API の変更-Footnote-91371992
Ref: ビルドならびに C API の変更-Footnote-101372057
Ref: ビルドならびに C API の変更-Footnote-111372123
Ref: ビルドならびに C API の変更-Footnote-121372189
Node: 非推奨<9>1372255
Ref: whatsnew/3 8 deprecated1372405
Ref: c621372405
Ref: 非推奨<9>-Footnote-11378262
Ref: 非推奨<9>-Footnote-21378327
Ref: 非推奨<9>-Footnote-31378392
Ref: 非推奨<9>-Footnote-41378457
Ref: 非推奨<9>-Footnote-51378521
Ref: 非推奨<9>-Footnote-61378586
Ref: 非推奨<9>-Footnote-71378651
Ref: 非推奨<9>-Footnote-81378716
Ref: 非推奨<9>-Footnote-91378781
Ref: 非推奨<9>-Footnote-101378846
Ref: 非推奨<9>-Footnote-111378912
Ref: 非推奨<9>-Footnote-121378978
Ref: 非推奨<9>-Footnote-131379044
Node: API と機能の削除1379110
Ref: whatsnew/3 8 api-and-feature-removals1379246
Ref: c791379246
Ref: API と機能の削除-Footnote-11382054
Ref: API と機能の削除-Footnote-21382109
Ref: API と機能の削除-Footnote-31382174
Ref: API と機能の削除-Footnote-41382239
Ref: API と機能の削除-Footnote-51382304
Ref: API と機能の削除-Footnote-61382369
Ref: API と機能の削除-Footnote-71382434
Ref: API と機能の削除-Footnote-81382499
Ref: API と機能の削除-Footnote-91382564
Ref: API と機能の削除-Footnote-101382629
Ref: API と機能の削除-Footnote-111382695
Node: Python 3 8 への移植1382761
Ref: whatsnew/3 8 porting-to-python-3-81382921
Ref: c7c1382921
Node: Python の挙動の変更1383375
Ref: whatsnew/3 8 changes-in-python-behavior1383492
Ref: c7d1383492
Ref: Python の挙動の変更-Footnote-11385849
Ref: Python の挙動の変更-Footnote-21385914
Ref: Python の挙動の変更-Footnote-31385979
Ref: Python の挙動の変更-Footnote-41386044
Ref: Python の挙動の変更-Footnote-51386109
Ref: Python の挙動の変更-Footnote-61386174
Node: Python API の変更<6>1386239
Ref: whatsnew/3 8 changes-in-the-python-api1386384
Ref: c811386384
Ref: whatsnew/3 8 bpo-36085-whatsnew1393412
Ref: c951393412
Ref: Python API の変更<6>-Footnote-11395072
Ref: Python API の変更<6>-Footnote-21395114
Ref: Python API の変更<6>-Footnote-31395179
Ref: Python API の変更<6>-Footnote-41395244
Ref: Python API の変更<6>-Footnote-51395309
Ref: Python API の変更<6>-Footnote-61395374
Ref: Python API の変更<6>-Footnote-71395439
Ref: Python API の変更<6>-Footnote-81395504
Ref: Python API の変更<6>-Footnote-91395569
Ref: Python API の変更<6>-Footnote-101395634
Ref: Python API の変更<6>-Footnote-111395700
Ref: Python API の変更<6>-Footnote-121395766
Ref: Python API の変更<6>-Footnote-131395832
Ref: Python API の変更<6>-Footnote-141395898
Ref: Python API の変更<6>-Footnote-151395964
Ref: Python API の変更<6>-Footnote-161396030
Ref: Python API の変更<6>-Footnote-171396096
Ref: Python API の変更<6>-Footnote-181396161
Ref: Python API の変更<6>-Footnote-191396227
Ref: Python API の変更<6>-Footnote-201396293
Ref: Python API の変更<6>-Footnote-211396359
Ref: Python API の変更<6>-Footnote-221396425
Ref: Python API の変更<6>-Footnote-231396491
Ref: Python API の変更<6>-Footnote-241396557
Ref: Python API の変更<6>-Footnote-251396623
Ref: Python API の変更<6>-Footnote-261396689
Ref: Python API の変更<6>-Footnote-271396755
Node: C API の変更<10>1396798
Ref: whatsnew/3 8 changes-in-the-c-api1396956
Ref: c971396956
Ref: C API の変更<10>-Footnote-11402764
Ref: C API の変更<10>-Footnote-21402829
Ref: C API の変更<10>-Footnote-31402894
Ref: C API の変更<10>-Footnote-41402959
Ref: C API の変更<10>-Footnote-51403024
Ref: C API の変更<10>-Footnote-61403089
Ref: C API の変更<10>-Footnote-71403154
Ref: C API の変更<10>-Footnote-81403219
Node: CPython バイトコードの変更<6>1403284
Ref: whatsnew/3 8 cpython-bytecode-changes1403437
Ref: c9f1403437
Ref: CPython バイトコードの変更<6>-Footnote-11404775
Ref: CPython バイトコードの変更<6>-Footnote-21404840
Ref: CPython バイトコードの変更<6>-Footnote-31404905
Ref: CPython バイトコードの変更<6>-Footnote-41404947
Node: Demos and Tools<2>1405012
Ref: whatsnew/3 8 demos-and-tools1405137
Ref: ca31405137
Ref: Demos and Tools<2>-Footnote-11408432
Ref: Demos and Tools<2>-Footnote-21408497
Ref: Demos and Tools<2>-Footnote-31408625
Node: Python3 8 1 での重要な変更点1408673
Ref: whatsnew/3 8 notable-changes-in-python-3-8-11408847
Ref: ca41408847
Ref: Python3 8 1 での重要な変更点-Footnote-11409410
Node: Python3 8 2 での重要な変更点1409475
Ref: whatsnew/3 8 notable-changes-in-python-3-8-21409657
Ref: ca51409657
Ref: Python3 8 2 での重要な変更点-Footnote-11409981
Node: Notable changes in Python 3 8 31410036
Ref: whatsnew/3 8 notable-changes-in-python-3-8-31410218
Ref: ca61410218
Ref: Notable changes in Python 3 8 3-Footnote-11410605
Node: Python3 8 8 での重要な変更点1410660
Ref: whatsnew/3 8 notable-changes-in-python-3-8-81410837
Ref: ca71410837
Ref: Python3 8 8 での重要な変更点-Footnote-11411557
Node: Notable changes in Python 3 8 91411622
Ref: whatsnew/3 8 notable-changes-in-python-3-8-91411800
Ref: ca81411800
Ref: Notable changes in Python 3 8 9-Footnote-11412271
Node: Notable changes in Python 3 8 101412326
Ref: whatsnew/3 8 notable-changes-in-python-3-8-101412503
Ref: ca91412503
Node: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート<2>1412731
Ref: whatsnew/3 8 macos-11-0-big-sur-and-apple-silicon-mac-support1412866
Ref: caa1412866
Ref: macOS 11 0 Big Sur と Appleシリコンの Mac のサポート<2>-Footnote-11413856
Node: Notable changes in Python 3 8 10<2>1413911
Ref: whatsnew/3 8 id11414089
Ref: cab1414089
Node: urllib parse<4>1414213
Ref: whatsnew/3 8 urllib-parse1414300
Ref: cac1414300
Ref: urllib parse<4>-Footnote-11414830
Ref: urllib parse<4>-Footnote-21414889
Node: Notable changes in Python 3 8 121414954
Ref: whatsnew/3 8 notable-changes-in-python-3-8-121415134
Ref: cad1415134
Node: Python API の変更<7>1415274
Ref: whatsnew/3 8 id21415366
Ref: cae1415366
Ref: Python API の変更<7>-Footnote-11415964
Node: Notable security feature in 3 8 141416029
Ref: whatsnew/3 8 notable-security-feature-in-3-8-141416199
Ref: caf1416199
Ref: Notable security feature in 3 8 14-Footnote-11416929
Node: Notable changes in 3 8 171416985
Ref: whatsnew/3 8 notable-changes-in-3-8-171417114
Ref: cb01417114
Node: tarfile<6>1417214
Ref: whatsnew/3 8 id31417286
Ref: cb11417286
Ref: tarfile<6>-Footnote-11417890
Node: What's New In Python 3 71417932
Ref: whatsnew/3 7 doc1418079
Ref: cb21418079
Ref: whatsnew/3 7 translation-repo1418079
Ref: cb31418079
Ref: whatsnew/3 7 what-s-new-in-python-3-71418079
Ref: cb41418079
Node: 概要 -- リリースハイライト<8>1419745
Ref: whatsnew/3 7 summary-release-highlights1419874
Ref: cb51419874
Ref: 概要 -- リリースハイライト<8>-Footnote-11422492
Ref: 概要 -- リリースハイライト<8>-Footnote-21422516
Ref: 概要 -- リリースハイライト<8>-Footnote-31422552
Ref: 概要 -- リリースハイライト<8>-Footnote-41422588
Node: 新しい機能<13>1422624
Ref: whatsnew/3 7 new-features1422789
Ref: cc91422789
Node: PEP 563 アノテーションの遅延評価1424145
Ref: whatsnew/3 7 pep-563-postponed-evaluation-of-annotations1424301
Ref: cca1424301
Ref: whatsnew/3 7 whatsnew37-pep5631424301
Ref: cb61424301
Ref: PEP 563 アノテーションの遅延評価-Footnote-11426544
Ref: PEP 563 アノテーションの遅延評価-Footnote-21426586
Ref: PEP 563 アノテーションの遅延評価-Footnote-31426628
Node: PEP 538 レガシーな C ロケールの抑圧1426670
Ref: whatsnew/3 7 pep-538-legacy-c-locale-coercion1426871
Ref: ccb1426871
Ref: whatsnew/3 7 whatsnew37-pep5381426871
Ref: cc01426871
Ref: PEP 538 レガシーな C ロケールの抑圧-Footnote-11430035
Ref: PEP 538 レガシーな C ロケールの抑圧-Footnote-21430077
Ref: PEP 538 レガシーな C ロケールの抑圧-Footnote-31430119
Ref: PEP 538 レガシーな C ロケールの抑圧-Footnote-41430161
Node: PEP 540 強制 UTF-8 実行モード1430203
Ref: whatsnew/3 7 pep-540-forced-utf-8-runtime-mode1430394
Ref: cce1430394
Ref: whatsnew/3 7 whatsnew37-pep5401430394
Ref: cc11430394
Ref: PEP 540 強制 UTF-8 実行モード-Footnote-11431964
Ref: PEP 540 強制 UTF-8 実行モード-Footnote-21432006
Ref: PEP 540 強制 UTF-8 実行モード-Footnote-31432048
Node: PEP 553 組み込みの breakpoint1432090
Ref: whatsnew/3 7 pep-553-built-in-breakpoint1432308
Ref: cd01432308
Ref: whatsnew/3 7 whatsnew37-pep5531432308
Ref: cba1432308
Ref: PEP 553 組み込みの breakpoint-Footnote-11433206
Node: PEP 539 スレッドローカルストレージのための新しい C API1433248
Ref: whatsnew/3 7 pep-539-new-c-api-for-thread-local-storage1433498
Ref: cd31433498
Ref: whatsnew/3 7 whatsnew37-pep5391433498
Ref: cc51433498
Ref: PEP 539 スレッドローカルストレージのための新しい C API-Footnote-11435027
Ref: PEP 539 スレッドローカルストレージのための新しい C API-Footnote-21435069
Node: PEP 562 モジュール属性へのアクセスのカスタマイズ1435111
Ref: whatsnew/3 7 pep-562-customization-of-access-to-module-attributes1435392
Ref: cd71435392
Ref: whatsnew/3 7 whatsnew37-pep5621435392
Ref: cbb1435392
Ref: PEP 562 モジュール属性へのアクセスのカスタマイズ-Footnote-11436015
Node: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数1436057
Ref: whatsnew/3 7 pep-564-new-time-functions-with-nanosecond-resolution1436307
Ref: cda1436307
Ref: whatsnew/3 7 whatsnew37-pep5641436307
Ref: cbf1436307
Ref: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数-Footnote-11437412
Ref: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数-Footnote-21437454
Ref: PEP 564 ナノ秒単位の分解能を持つ新しい時間関数-Footnote-31437531
Node: PEP 565 Show DeprecationWarning in __main__1437573
Ref: whatsnew/3 7 pep-565-show-deprecationwarning-in-main1437854
Ref: ce11437854
Ref: whatsnew/3 7 whatsnew37-pep5651437854
Ref: cc41437854
Ref: PEP 565 Show DeprecationWarning in __main__-Footnote-11439778
Node: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート1439820
Ref: whatsnew/3 7 pep-560-core-support-for-typing-module-and-generic-types1440064
Ref: ce21440064
Ref: whatsnew/3 7 whatsnew37-pep5601440064
Ref: cbc1440064
Ref: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート-Footnote-11441120
Ref: PEP 560 typing モジュールとジェネリック型に対する言語コアによるサポート-Footnote-21441162
Node: PEP 552 Hash-based pyc Files1441204
Ref: whatsnew/3 7 pep-552-hash-based-pyc-files1441446
Ref: ce41441446
Ref: whatsnew/3 7 whatsnew37-pep5521441446
Ref: cc21441446
Ref: PEP 552 Hash-based pyc Files-Footnote-11443132
Ref: PEP 552 Hash-based pyc Files-Footnote-21443173
Ref: PEP 552 Hash-based pyc Files-Footnote-31443215
Node: PEP 545 Python Documentation Translations1443257
Ref: whatsnew/3 7 pep-545-python-documentation-translations1443430
Ref: ce51443430
Ref: whatsnew/3 7 whatsnew37-pep5451443430
Ref: cc61443430
Ref: PEP 545 Python Documentation Translations-Footnote-11444017
Ref: PEP 545 Python Documentation Translations-Footnote-21444059
Node: Python Development Mode -X dev1444101
Ref: whatsnew/3 7 python-development-mode-x-dev1444237
Ref: ce61444237
Ref: whatsnew/3 7 whatsnew37-devmode1444237
Ref: cc31444237
Node: その他の言語変更<7>1444691
Ref: whatsnew/3 7 other-language-changes1444843
Ref: ce81444843
Ref: その他の言語変更<7>-Footnote-11447231
Ref: その他の言語変更<7>-Footnote-21447296
Ref: その他の言語変更<7>-Footnote-31447361
Ref: その他の言語変更<7>-Footnote-41447426
Ref: その他の言語変更<7>-Footnote-51447491
Ref: その他の言語変更<7>-Footnote-61447556
Ref: その他の言語変更<7>-Footnote-71447621
Ref: その他の言語変更<7>-Footnote-81447686
Ref: その他の言語変更<7>-Footnote-91447751
Ref: その他の言語変更<7>-Footnote-101447816
Node: 新たなモジュール<7>1447882
Ref: whatsnew/3 7 new-modules1448048
Ref: cee1448048
Node: contextvars<2>1448236
Ref: whatsnew/3 7 contextvars1448344
Ref: cef1448344
Ref: whatsnew/3 7 whatsnew37-pep5671448344
Ref: cb71448344
Ref: contextvars<2>-Footnote-11449072
Node: データクラス<3>1449114
Ref: whatsnew/3 7 dataclasses1449253
Ref: cf11449253
Ref: whatsnew/3 7 whatsnew37-pep5571449253
Ref: cb81449253
Ref: データクラス<3>-Footnote-11450049
Node: importlib resources<2>1450091
Ref: whatsnew/3 7 importlib-resources1450207
Ref: cf41450207
Ref: whatsnew/3 7 whatsnew37-importlib-resources1450207
Ref: cb91450207
Ref: importlib resources<2>-Footnote-11450939
Ref: importlib resources<2>-Footnote-21451004
Node: 改良されたモジュール<7>1451066
Ref: whatsnew/3 7 improved-modules1451224
Ref: cf51451224
Node: argparse<5>1452702
Ref: whatsnew/3 7 argparse1452803
Ref: cf61452803
Ref: argparse<5>-Footnote-11453037
Node: asyncio<10>1453102
Ref: whatsnew/3 7 asyncio1453220
Ref: cf81453220
Ref: whatsnew/3 7 whatsnew37-asyncio1453220
Ref: cbe1453220
Ref: asyncio<10>-Footnote-11459511
Ref: asyncio<10>-Footnote-21459576
Ref: asyncio<10>-Footnote-31459618
Ref: asyncio<10>-Footnote-41459683
Ref: asyncio<10>-Footnote-51459748
Ref: asyncio<10>-Footnote-61459813
Ref: asyncio<10>-Footnote-71459878
Ref: asyncio<10>-Footnote-81459943
Ref: asyncio<10>-Footnote-91460008
Ref: asyncio<10>-Footnote-101460073
Ref: asyncio<10>-Footnote-111460139
Ref: asyncio<10>-Footnote-121460205
Ref: asyncio<10>-Footnote-131460271
Ref: asyncio<10>-Footnote-141460337
Ref: asyncio<10>-Footnote-151460403
Ref: asyncio<10>-Footnote-161460469
Ref: asyncio<10>-Footnote-171460535
Ref: asyncio<10>-Footnote-181460601
Ref: asyncio<10>-Footnote-191460667
Ref: asyncio<10>-Footnote-201460733
Ref: asyncio<10>-Footnote-211460799
Ref: asyncio<10>-Footnote-221460865
Ref: asyncio<10>-Footnote-231460931
Ref: asyncio<10>-Footnote-241460997
Node: binascii1461063
Ref: whatsnew/3 7 binascii1461181
Ref: d151461181
Ref: binascii-Footnote-11461458
Node: calendar<3>1461523
Ref: whatsnew/3 7 calendar1461644
Ref: d171461644
Ref: calendar<3>-Footnote-11461941
Node: collections<2>1462006
Ref: whatsnew/3 7 collections1462132
Ref: d191462132
Ref: collections<2>-Footnote-11462364
Node: compileall<3>1462429
Ref: whatsnew/3 7 compileall1462565
Ref: d1a1462565
Ref: compileall<3>-Footnote-11462962
Node: concurrent futures<4>1463027
Ref: whatsnew/3 7 concurrent-futures1463162
Ref: d1c1463162
Ref: concurrent futures<4>-Footnote-11463690
Ref: concurrent futures<4>-Footnote-21463755
Node: contextlib<3>1463820
Ref: whatsnew/3 7 contextlib1463953
Ref: d1d1463953
Ref: contextlib<3>-Footnote-11464483
Ref: contextlib<3>-Footnote-21464548
Ref: contextlib<3>-Footnote-31464613
Ref: contextlib<3>-Footnote-41464678
Node: cProfile<2>1464743
Ref: whatsnew/3 7 cprofile1464860
Ref: d221464860
Ref: cProfile<2>-Footnote-11465086
Node: crypt1465151
Ref: whatsnew/3 7 crypt1465266
Ref: d231465266
Ref: crypt-Footnote-11465587
Ref: crypt-Footnote-21465652
Node: datetime<5>1465717
Ref: whatsnew/3 7 datetime1465827
Ref: d241465827
Ref: datetime<5>-Footnote-11466238
Ref: datetime<5>-Footnote-21466303
Node: dbm<2>1466367
Ref: whatsnew/3 7 dbm1466482
Ref: d261466482
Node: decimal<2>1466627
Ref: whatsnew/3 7 decimal1466737
Ref: d271466737
Ref: decimal<2>-Footnote-11466958
Node: dis<4>1467023
Ref: whatsnew/3 7 dis1467139
Ref: d281467139
Ref: dis<4>-Footnote-11467542
Node: distutils<4>1467607
Ref: whatsnew/3 7 distutils1467720
Ref: d291467720
Ref: distutils<4>-Footnote-11467968
Node: enum<5>1468033
Ref: whatsnew/3 7 enum1468152
Ref: d2a1468152
Ref: enum<5>-Footnote-11468833
Ref: enum<5>-Footnote-21468898
Node: functools<4>1468963
Ref: whatsnew/3 7 functools1469075
Ref: d2c1469075
Ref: functools<4>-Footnote-11469304
Node: gc<5>1469369
Ref: whatsnew/3 7 gc1469481
Ref: d2d1469481
Ref: gc<5>-Footnote-11470020
Node: hmac<3>1470085
Ref: whatsnew/3 7 hmac1470196
Ref: d311470196
Ref: hmac<3>-Footnote-11470459
Node: http client1470524
Ref: whatsnew/3 7 http-client1470641
Ref: d341470641
Ref: http client-Footnote-11470898
Node: http server1470963
Ref: whatsnew/3 7 http-server1471089
Ref: d371471089
Ref: http server-Footnote-11471972
Ref: http server-Footnote-21472037
Ref: http server-Footnote-31472102
Node: idlelib と IDLE1472167
Ref: whatsnew/3 7 idlelib-and-idle1472294
Ref: d3b1472294
Ref: idlelib と IDLE-Footnote-11475345
Ref: idlelib と IDLE-Footnote-21475410
Ref: idlelib と IDLE-Footnote-31475477
Ref: idlelib と IDLE-Footnote-41475542
Ref: idlelib と IDLE-Footnote-51475607
Ref: idlelib と IDLE-Footnote-61475672
Ref: idlelib と IDLE-Footnote-71475737
Ref: idlelib と IDLE-Footnote-81475802
Ref: idlelib と IDLE-Footnote-91475867
Ref: idlelib と IDLE-Footnote-101475932
Ref: idlelib と IDLE-Footnote-111476000
Ref: idlelib と IDLE-Footnote-121476065
Ref: idlelib と IDLE-Footnote-131476131
Node: importlib<4>1476197
Ref: whatsnew/3 7 importlib1476318
Ref: d3c1476318
Ref: importlib<4>-Footnote-11477205
Ref: importlib<4>-Footnote-21477270
Ref: importlib<4>-Footnote-31477335
Node: io<6>1477400
Ref: whatsnew/3 7 io1477517
Ref: d3f1477517
Ref: io<6>-Footnote-11477782
Ref: io<6>-Footnote-21477847
Node: ipaddress<3>1477912
Ref: whatsnew/3 7 ipaddress1478029
Ref: d411478029
Ref: ipaddress<3>-Footnote-11478349
Node: itertools<6>1478414
Ref: whatsnew/3 7 itertools1478535
Ref: d421478535
Ref: itertools<6>-Footnote-11478772
Node: locale<4>1478837
Ref: whatsnew/3 7 locale1478956
Ref: d441478956
Ref: locale<4>-Footnote-11479370
Node: logging<3>1479435
Ref: whatsnew/3 7 logging1479549
Ref: d451479549
Ref: logging<3>-Footnote-11480111
Ref: logging<3>-Footnote-21480176
Ref: logging<3>-Footnote-31480241
Node: math<7>1480306
Ref: whatsnew/3 7 math1480423
Ref: d491480423
Ref: math<7>-Footnote-11480648
Node: mimetypes<3>1480713
Ref: whatsnew/3 7 mimetypes1480826
Ref: d4b1480826
Ref: mimetypes<3>-Footnote-11481041
Node: msilib1481106
Ref: whatsnew/3 7 msilib1481230
Ref: d4c1481230
Ref: msilib-Footnote-11481425
Node: multiprocessing<5>1481490
Ref: whatsnew/3 7 multiprocessing1481607
Ref: d4d1481607
Ref: multiprocessing<5>-Footnote-11482260
Ref: multiprocessing<5>-Footnote-21482325
Ref: multiprocessing<5>-Footnote-31482390
Node: os<8>1482455
Ref: whatsnew/3 7 os1482577
Ref: d511482577
Ref: os<8>-Footnote-11483875
Ref: os<8>-Footnote-21483940
Ref: os<8>-Footnote-31484005
Ref: os<8>-Footnote-41484070
Ref: os<8>-Footnote-51484135
Ref: os<8>-Footnote-61484200
Ref: os<8>-Footnote-71484265
Node: pathlib<11>1484330
Ref: whatsnew/3 7 pathlib1484440
Ref: d5c1484440
Ref: pathlib<11>-Footnote-11484700
Node: pdb<6>1484765
Ref: whatsnew/3 7 pdb1484883
Ref: d5d1484883
Ref: pdb<6>-Footnote-11485293
Ref: pdb<6>-Footnote-21485358
Node: py_compile<3>1485423
Ref: whatsnew/3 7 py-compile1485538
Ref: d5e1485538
Ref: py_compile<3>-Footnote-11485988
Ref: py_compile<3>-Footnote-21486029
Node: pydoc<3>1486094
Ref: whatsnew/3 7 pydoc1486211
Ref: d5f1486211
Ref: pydoc<3>-Footnote-11486435
Node: queue<2>1486500
Ref: whatsnew/3 7 queue1486609
Ref: d601486609
Ref: queue<2>-Footnote-11486792
Node: re<5>1486857
Ref: whatsnew/3 7 re1486967
Ref: d621486967
Ref: re<5>-Footnote-11488049
Ref: re<5>-Footnote-21488114
Ref: re<5>-Footnote-31488179
Ref: re<5>-Footnote-41488244
Ref: re<5>-Footnote-51488309
Node: signal<2>1488374
Ref: whatsnew/3 7 signal1488485
Ref: d661488485
Ref: signal<2>-Footnote-11488804
Node: socket<6>1488869
Ref: whatsnew/3 7 socket1488987
Ref: d681488987
Ref: socket<6>-Footnote-11490093
Ref: socket<6>-Footnote-21490158
Ref: socket<6>-Footnote-31490223
Ref: socket<6>-Footnote-41490288
Ref: socket<6>-Footnote-51490353
Ref: socket<6>-Footnote-61490418
Node: socketserver1490483
Ref: whatsnew/3 7 socketserver1490602
Ref: d6e1490602
Node: sqlite3<7>1491092
Ref: whatsnew/3 7 sqlite31491208
Ref: d721491208
Ref: sqlite3<7>-Footnote-11491650
Ref: sqlite3<7>-Footnote-21491715
Node: ssl<6>1491780
Ref: whatsnew/3 7 ssl1491893
Ref: d741491893
Ref: ssl<6>-Footnote-11495188
Ref: ssl<6>-Footnote-21495253
Ref: ssl<6>-Footnote-31495318
Ref: ssl<6>-Footnote-41495383
Ref: ssl<6>-Footnote-51495448
Ref: ssl<6>-Footnote-61495513
Ref: ssl<6>-Footnote-71495578
Ref: ssl<6>-Footnote-81495643
Ref: ssl<6>-Footnote-91495708
Ref: ssl<6>-Footnote-101495773
Ref: ssl<6>-Footnote-111495839
Ref: ssl<6>-Footnote-121495905
Ref: ssl<6>-Footnote-131495971
Ref: ssl<6>-Footnote-141496037
Node: string<2>1496093
Ref: whatsnew/3 7 string1496209
Ref: d7d1496209
Ref: string<2>-Footnote-11496486
Node: subprocess<2>1496553
Ref: whatsnew/3 7 subprocess1496669
Ref: d7e1496669
Ref: subprocess<2>-Footnote-11497989
Ref: subprocess<2>-Footnote-21498054
Ref: subprocess<2>-Footnote-31498119
Ref: subprocess<2>-Footnote-41498184
Node: sys<8>1498249
Ref: whatsnew/3 7 sys1498363
Ref: d821498363
Ref: sys<8>-Footnote-11499103
Ref: sys<8>-Footnote-21499168
Ref: sys<8>-Footnote-31499233
Node: time<5>1499298
Ref: whatsnew/3 7 time1499409
Ref: d861499409
Ref: time<5>-Footnote-11500618
Ref: time<5>-Footnote-21500660
Node: tkinter<6>1500725
Ref: whatsnew/3 7 tkinter1500844
Ref: d8c1500844
Ref: tkinter<6>-Footnote-11501025
Node: tracemalloc<2>1501090
Ref: whatsnew/3 7 tracemalloc1501210
Ref: d8e1501210
Ref: tracemalloc<2>-Footnote-11501676
Node: types<5>1501741
Ref: whatsnew/3 7 types1501865
Ref: d911501865
Ref: types<5>-Footnote-11502380
Ref: types<5>-Footnote-21502445
Ref: types<5>-Footnote-31502510
Ref: types<5>-Footnote-41502552
Node: unicodedata<7>1502617
Ref: whatsnew/3 7 unicodedata1502738
Ref: d961502738
Ref: unicodedata<7>-Footnote-11502941
Node: unittest<8>1502997
Ref: whatsnew/3 7 unittest1503123
Ref: d971503123
Ref: unittest<8>-Footnote-11503528
Node: unittest mock1503593
Ref: whatsnew/3 7 unittest-mock1503720
Ref: d981503720
Ref: unittest mock-Footnote-11504238
Ref: unittest mock-Footnote-21504303
Node: urllib parse<5>1504368
Ref: whatsnew/3 7 urllib-parse1504486
Ref: d9b1504486
Ref: urllib parse<5>-Footnote-11504799
Ref: urllib parse<5>-Footnote-21504858
Ref: urllib parse<5>-Footnote-31504917
Node: uu1504982
Ref: whatsnew/3 7 uu1505094
Ref: d9d1505094
Ref: uu-Footnote-11505358
Node: uuid<4>1505423
Ref: whatsnew/3 7 uuid1505531
Ref: d9e1505531
Ref: uuid<4>-Footnote-11506171
Ref: uuid<4>-Footnote-21506236
Node: warnings<3>1506301
Ref: whatsnew/3 7 warnings1506413
Ref: da21506413
Ref: warnings<3>-Footnote-11507838
Ref: warnings<3>-Footnote-21507903
Ref: warnings<3>-Footnote-31507968
Ref: warnings<3>-Footnote-41508033
Node: xml<5>1508098
Ref: whatsnew/3 7 xml1508212
Ref: da41508212
Ref: xml<5>-Footnote-11508496
Node: xml etree1508551
Ref: whatsnew/3 7 xml-etree1508667
Ref: da51508667
Ref: xml etree-Footnote-11509008
Node: xmlrpc server1509073
Ref: whatsnew/3 7 xmlrpc-server1509189
Ref: da71509189
Ref: xmlrpc server-Footnote-11509400
Node: zipapp1509464
Ref: whatsnew/3 7 zipapp1509581
Ref: da81509581
Ref: zipapp-Footnote-11510105
Ref: zipapp-Footnote-21510170
Node: zipfile<3>1510235
Ref: whatsnew/3 7 zipfile1510330
Ref: daa1510330
Ref: zipfile<3>-Footnote-11510695
Ref: zipfile<3>-Footnote-21510760
Node: C API の変更<11>1510825
Ref: whatsnew/3 7 c-api-changes1510972
Ref: dab1510972
Ref: C API の変更<11>-Footnote-11515538
Ref: C API の変更<11>-Footnote-21515603
Ref: C API の変更<11>-Footnote-31515668
Ref: C API の変更<11>-Footnote-41515733
Ref: C API の変更<11>-Footnote-51515798
Ref: C API の変更<11>-Footnote-61515863
Ref: C API の変更<11>-Footnote-71515928
Ref: C API の変更<11>-Footnote-81515993
Ref: C API の変更<11>-Footnote-91516058
Ref: C API の変更<11>-Footnote-101516123
Ref: C API の変更<11>-Footnote-111516189
Ref: C API の変更<11>-Footnote-121516255
Ref: C API の変更<11>-Footnote-131516321
Ref: C API の変更<11>-Footnote-141516387
Ref: C API の変更<11>-Footnote-151516453
Ref: C API の変更<11>-Footnote-161516518
Ref: C API の変更<11>-Footnote-171516584
Ref: C API の変更<11>-Footnote-181516650
Ref: C API の変更<11>-Footnote-191516716
Ref: C API の変更<11>-Footnote-201516782
Node: Build Changes<6>1516848
Ref: whatsnew/3 7 build-changes1516974
Ref: dc41516974
Ref: Build Changes<6>-Footnote-11518107
Ref: Build Changes<6>-Footnote-21518172
Ref: Build Changes<6>-Footnote-31518237
Node: 最適化<8>1518302
Ref: whatsnew/3 7 optimizations1518451
Ref: dc51518451
Ref: whatsnew/3 7 whatsnew37-perf1518451
Ref: cc71518451
Ref: whatsnew/3 7 whatsnew37-asyncio-perf1519134
Ref: cf91519134
Ref: 最適化<8>-Footnote-11523710
Ref: 最適化<8>-Footnote-21523775
Ref: 最適化<8>-Footnote-31523840
Ref: 最適化<8>-Footnote-41523905
Ref: 最適化<8>-Footnote-51523970
Ref: 最適化<8>-Footnote-61524035
Ref: 最適化<8>-Footnote-71524100
Ref: 最適化<8>-Footnote-81524165
Ref: 最適化<8>-Footnote-91524230
Ref: 最適化<8>-Footnote-101524295
Ref: 最適化<8>-Footnote-111524361
Ref: 最適化<8>-Footnote-121524427
Ref: 最適化<8>-Footnote-131524493
Ref: 最適化<8>-Footnote-141524559
Ref: 最適化<8>-Footnote-151524625
Ref: 最適化<8>-Footnote-161524691
Ref: 最適化<8>-Footnote-171524757
Ref: 最適化<8>-Footnote-181524823
Ref: 最適化<8>-Footnote-191524889
Ref: 最適化<8>-Footnote-201524955
Ref: 最適化<8>-Footnote-211525021
Ref: 最適化<8>-Footnote-221525087
Ref: 最適化<8>-Footnote-231525153
Ref: 最適化<8>-Footnote-241525219
Ref: 最適化<8>-Footnote-251525285
Ref: 最適化<8>-Footnote-261525351
Ref: 最適化<8>-Footnote-271525417
Ref: 最適化<8>-Footnote-281525483
Ref: 最適化<8>-Footnote-291525549
Ref: 最適化<8>-Footnote-301525615
Node: その他の CPython の実装の変更<2>1525681
Ref: whatsnew/3 7 other-cpython-implementation-changes1525843
Ref: dd51525843
Ref: その他の CPython の実装の変更<2>-Footnote-11527244
Ref: その他の CPython の実装の変更<2>-Footnote-21527309
Ref: その他の CPython の実装の変更<2>-Footnote-31527374
Ref: その他の CPython の実装の変更<2>-Footnote-41527439
Ref: その他の CPython の実装の変更<2>-Footnote-51527504
Node: 非推奨の Python の挙動1527569
Ref: whatsnew/3 7 deprecated-python-behavior1527778
Ref: dd81527778
Ref: 非推奨の Python の挙動-Footnote-11528884
Ref: 非推奨の Python の挙動-Footnote-21528949
Node: 非推奨の Python モジュール、関数、メソッド1529014
Ref: whatsnew/3 7 deprecated-python-modules-functions-and-methods1529223
Ref: dda1529223
Node: aifc1529627
Ref: whatsnew/3 7 aifc1529747
Ref: ddb1529747
Ref: aifc-Footnote-11529967
Node: asyncio<11>1530032
Ref: whatsnew/3 7 id21530175
Ref: ddc1530175
Ref: whatsnew/3 7 whatsnew37-asyncio-deprecated1530175
Ref: d141530175
Ref: asyncio<11>-Footnote-11530700
Ref: asyncio<11>-Footnote-21530765
Node: collections<3>1530830
Ref: whatsnew/3 7 id31530975
Ref: ddd1530975
Ref: collections<3>-Footnote-11531354
Node: dbm<3>1531419
Ref: whatsnew/3 7 id41531560
Ref: dde1531560
Ref: dbm<3>-Footnote-11531961
Node: enum<6>1532026
Ref: whatsnew/3 7 id51532163
Ref: ddf1532163
Ref: enum<6>-Footnote-11532624
Node: gettext<2>1532689
Ref: whatsnew/3 7 gettext1532832
Ref: de01532832
Ref: gettext<2>-Footnote-11533077
Node: importlib<5>1533142
Ref: whatsnew/3 7 id61533287
Ref: de11533287
Ref: importlib<5>-Footnote-11533797
Node: locale<5>1533862
Ref: whatsnew/3 7 id71534004
Ref: de31534004
Ref: locale<5>-Footnote-11534207
Node: macpath1534272
Ref: whatsnew/3 7 macpath1534414
Ref: de41534414
Ref: macpath-Footnote-11534604
Node: threading<6>1534668
Ref: whatsnew/3 7 threading1534810
Ref: de51534810
Ref: threading<6>-Footnote-11535108
Node: socket<7>1535173
Ref: whatsnew/3 7 id81535314
Ref: de61535314
Ref: socket<7>-Footnote-11535659
Node: ssl<7>1535724
Ref: whatsnew/3 7 id91535858
Ref: de71535858
Ref: ssl<7>-Footnote-11536070
Node: sunau1536135
Ref: whatsnew/3 7 sunau1536266
Ref: de81536266
Ref: sunau-Footnote-11536492
Node: sys<9>1536557
Ref: whatsnew/3 7 id101536686
Ref: de91536686
Ref: sys<9>-Footnote-11537003
Node: wave1537068
Ref: whatsnew/3 7 wave1537183
Ref: dea1537183
Ref: wave-Footnote-11537411
Node: C API の非推奨の関数ならびに型1537476
Ref: whatsnew/3 7 deprecated-functions-and-types-of-the-c-api1537713
Ref: deb1537713
Ref: C API の非推奨の関数ならびに型-Footnote-11538357
Ref: C API の非推奨の関数ならびに型-Footnote-21538422
Node: サポート対象プラットフォームからの除外1538487
Ref: whatsnew/3 7 id111538690
Ref: dec1538690
Ref: whatsnew/3 7 platform-support-removals1538690
Ref: d771538690
Ref: サポート対象プラットフォームからの除外-Footnote-11540178
Ref: サポート対象プラットフォームからの除外-Footnote-21540245
Node: API と機能の削除<2>1540325
Ref: whatsnew/3 7 api-and-feature-removals1540501
Ref: ded1540501
Ref: API と機能の削除<2>-Footnote-11543398
Ref: API と機能の削除<2>-Footnote-21543463
Ref: API と機能の削除<2>-Footnote-31543528
Node: Module Removals1543593
Ref: whatsnew/3 7 module-removals1543732
Ref: df11543732
Ref: Module Removals-Footnote-11544067
Node: Windows-only Changes1544132
Ref: whatsnew/3 7 windows-only-changes1544269
Ref: df21544269
Ref: Windows-only Changes-Footnote-11545146
Ref: Windows-only Changes-Footnote-21545211
Node: Python 3 7 への移植1545276
Ref: whatsnew/3 7 porting-to-python-3-71545435
Ref: df31545435
Ref: whatsnew/3 7 porting-to-python-371545435
Ref: cc81545435
Node: Python の挙動の変更<2>1546015
Ref: whatsnew/3 7 changes-in-python-behavior1546135
Ref: df41546135
Ref: Python の挙動の変更<2>-Footnote-11548012
Ref: Python の挙動の変更<2>-Footnote-21548077
Ref: Python の挙動の変更<2>-Footnote-31548119
Ref: Python の挙動の変更<2>-Footnote-41548184
Ref: Python の挙動の変更<2>-Footnote-51548249
Ref: Python の挙動の変更<2>-Footnote-61548314
Node: Python API の変更<8>1548379
Ref: whatsnew/3 7 changes-in-the-python-api1548527
Ref: df71548527
Ref: Python API の変更<8>-Footnote-11558057
Ref: Python API の変更<8>-Footnote-21558122
Ref: Python API の変更<8>-Footnote-31558187
Ref: Python API の変更<8>-Footnote-41558252
Ref: Python API の変更<8>-Footnote-51558317
Ref: Python API の変更<8>-Footnote-61558382
Ref: Python API の変更<8>-Footnote-71558447
Ref: Python API の変更<8>-Footnote-81558512
Ref: Python API の変更<8>-Footnote-91558577
Ref: Python API の変更<8>-Footnote-101558642
Ref: Python API の変更<8>-Footnote-111558708
Ref: Python API の変更<8>-Footnote-121558774
Ref: Python API の変更<8>-Footnote-131558840
Ref: Python API の変更<8>-Footnote-141558906
Ref: Python API の変更<8>-Footnote-151558949
Ref: Python API の変更<8>-Footnote-161559015
Ref: Python API の変更<8>-Footnote-171559081
Ref: Python API の変更<8>-Footnote-181559147
Ref: Python API の変更<8>-Footnote-191559213
Ref: Python API の変更<8>-Footnote-201559279
Ref: Python API の変更<8>-Footnote-211559345
Ref: Python API の変更<8>-Footnote-221559411
Ref: Python API の変更<8>-Footnote-231559477
Ref: Python API の変更<8>-Footnote-241559543
Ref: Python API の変更<8>-Footnote-251559609
Ref: Python API の変更<8>-Footnote-261559675
Ref: Python API の変更<8>-Footnote-271559741
Ref: Python API の変更<8>-Footnote-281559807
Ref: Python API の変更<8>-Footnote-291559873
Ref: Python API の変更<8>-Footnote-301559939
Node: C API の変更<12>1560005
Ref: whatsnew/3 7 changes-in-the-c-api1560163
Ref: e171560163
Ref: C API の変更<12>-Footnote-11560786
Node: CPython バイトコードの変更<7>1560851
Ref: whatsnew/3 7 cpython-bytecode-changes1561009
Ref: e181561009
Ref: CPython バイトコードの変更<7>-Footnote-11561362
Ref: CPython バイトコードの変更<7>-Footnote-21561427
Node: Windows-only Changes<2>1561492
Ref: whatsnew/3 7 id121561673
Ref: e191561673
Ref: Windows-only Changes<2>-Footnote-11562003
Node: その他の CPython の実装の変更<3>1562068
Ref: whatsnew/3 7 id131562202
Ref: e1b1562202
Ref: その他の CPython の実装の変更<3>-Footnote-11564522
Ref: その他の CPython の実装の変更<3>-Footnote-21564564
Ref: その他の CPython の実装の変更<3>-Footnote-31564629
Node: Python 3 7 1 での重要な変更点1564694
Ref: whatsnew/3 7 notable-changes-in-python-3-7-11564870
Ref: e1d1564870
Ref: Python 3 7 1 での重要な変更点-Footnote-11565812
Ref: Python 3 7 1 での重要な変更点-Footnote-21565877
Ref: Python 3 7 1 での重要な変更点-Footnote-31565942
Node: Python 3 7 2 での重要な変更点1566007
Ref: whatsnew/3 7 notable-changes-in-python-3-7-21566197
Ref: e201566197
Node: Python 3 7 6 での重要な変更点1566696
Ref: whatsnew/3 7 notable-changes-in-python-3-7-61566887
Ref: e211566887
Ref: Python 3 7 6 での重要な変更点-Footnote-11567452
Node: Python 3 7 10 での重要な変更点1567517
Ref: whatsnew/3 7 notable-changes-in-python-3-7-101567703
Ref: e221567703
Ref: Python 3 7 10 での重要な変更点-Footnote-11568427
Node: Notable changes in Python 3 7 111568492
Ref: whatsnew/3 7 notable-changes-in-python-3-7-111568675
Ref: e231568675
Ref: Notable changes in Python 3 7 11-Footnote-11569592
Ref: Notable changes in Python 3 7 11-Footnote-21569647
Node: Notable security feature in 3 7 141569702
Ref: whatsnew/3 7 notable-security-feature-in-3-7-141569838
Ref: e241569838
Ref: Notable security feature in 3 7 14-Footnote-11570568
Node: What's New In Python 3 61570624
Ref: whatsnew/3 6 doc1570771
Ref: e251570771
Ref: whatsnew/3 6 translation-repo1570771
Ref: e261570771
Ref: whatsnew/3 6 what-s-new-in-python-3-61570771
Ref: e271570771
Ref: What's New In Python 3 6-Footnote-11572222
Ref: What's New In Python 3 6-Footnote-21572282
Node: 概要 -- リリースハイライト<9>1572324
Ref: whatsnew/3 6 summary-release-highlights1572453
Ref: e281572453
Ref: 概要 -- リリースハイライト<9>-Footnote-11577291
Ref: 概要 -- リリースハイライト<9>-Footnote-21577371
Ref: 概要 -- リリースハイライト<9>-Footnote-31577461
Node: 新しい機能<14>1577503
Ref: whatsnew/3 6 new-features1577668
Ref: e3c1577668
Ref: whatsnew/3 6 pypy-dict-implementation1577668
Ref: e3d1577668
Node: PEP 498 フォーマット済み文字列リテラル1579339
Ref: whatsnew/3 6 pep-498-formatted-string-literals1579501
Ref: e3e1579501
Ref: whatsnew/3 6 whatsnew36-pep4981579501
Ref: e291579501
Ref: PEP 498 フォーマット済み文字列リテラル-Footnote-11580621
Ref: PEP 498 フォーマット済み文字列リテラル-Footnote-21580663
Node: PEP 526 変数アノテーションの文法1580705
Ref: whatsnew/3 6 pep-526-syntax-for-variable-annotations1580929
Ref: e3f1580929
Ref: whatsnew/3 6 whatsnew36-pep5261580929
Ref: e2b1580929
Ref: PEP 526 変数アノテーションの文法-Footnote-11582323
Ref: PEP 526 変数アノテーションの文法-Footnote-21582365
Ref: PEP 526 変数アノテーションの文法-Footnote-31582407
Ref: PEP 526 変数アノテーションの文法-Footnote-41582442
Node: PEP 515 数値リテラル内のアンダースコア1582483
Ref: whatsnew/3 6 pep-515-underscores-in-numeric-literals1582689
Ref: e401582689
Ref: whatsnew/3 6 whatsnew36-pep5151582689
Ref: e2a1582689
Ref: PEP 515 数値リテラル内のアンダースコア-Footnote-11583873
Ref: PEP 515 数値リテラル内のアンダースコア-Footnote-21583915
Node: PEP 525 非同期ジェネレータ1583957
Ref: whatsnew/3 6 pep-525-asynchronous-generators1584148
Ref: e411584148
Ref: whatsnew/3 6 whatsnew36-pep5251584148
Ref: e2c1584148
Ref: PEP 525 非同期ジェネレータ-Footnote-11585068
Ref: PEP 525 非同期ジェネレータ-Footnote-21585110
Node: PEP 530 非同期内包表記1585152
Ref: whatsnew/3 6 pep-530-asynchronous-comprehensions1585337
Ref: e421585337
Ref: whatsnew/3 6 whatsnew36-pep5301585337
Ref: e2d1585337
Ref: PEP 530 非同期内包表記-Footnote-11585914
Ref: PEP 530 非同期内包表記-Footnote-21585956
Node: PEP 487 Simpler customization of class creation1585998
Ref: whatsnew/3 6 pep-487-simpler-customization-of-class-creation1586189
Ref: e431586189
Ref: whatsnew/3 6 whatsnew36-pep4871586189
Ref: e301586189
Ref: PEP 487 Simpler customization of class creation-Footnote-11587270
Node: PEP 487 記述子プロトコルの改善1587312
Ref: whatsnew/3 6 pep-487-descriptor-protocol-enhancements1587536
Ref: e461587536
Ref: whatsnew/3 6 whatsnew36-pep487-descriptors1587536
Ref: e471587536
Ref: PEP 487 記述子プロトコルの改善-Footnote-11588756
Ref: PEP 487 記述子プロトコルの改善-Footnote-21588798
Node: PEP 519 ファイルシステムパスプロトコルの追加1588840
Ref: whatsnew/3 6 pep-519-adding-a-file-system-path-protocol1589055
Ref: e4a1589055
Ref: whatsnew/3 6 whatsnew36-pep5191589055
Ref: e351589055
Ref: PEP 519 ファイルシステムパスプロトコルの追加-Footnote-11591914
Node: PEP 495 地域時間の曖昧さ回避1591956
Ref: whatsnew/3 6 pep-495-local-time-disambiguation1592216
Ref: e501592216
Ref: whatsnew/3 6 whatsnew36-pep4951592216
Ref: e361592216
Ref: PEP 495 地域時間の曖昧さ回避-Footnote-11593734
Ref: PEP 495 地域時間の曖昧さ回避-Footnote-21593776
Node: PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更1593818
Ref: whatsnew/3 6 pep-529-change-windows-filesystem-encoding-to-utf-81594093
Ref: e521594093
Ref: whatsnew/3 6 whatsnew36-pep5291594093
Ref: e3a1594093
Ref: PEP 529 Windows ファイルシステムのエンコーディングを UTF-8 に変更-Footnote-11595172
Node: PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更1595214
Ref: whatsnew/3 6 pep-528-change-windows-console-encoding-to-utf-81595501
Ref: e541595501
Ref: whatsnew/3 6 whatsnew36-pep5281595501
Ref: e391595501
Ref: PEP 528 Windows コンソールのエンコーディングを UTF-8 に変更-Footnote-11596265
Node: PEP 520 クラス属性の定義の順番を保持1596307
Ref: whatsnew/3 6 pep-520-preserving-class-attribute-definition-order1596555
Ref: e561596555
Ref: whatsnew/3 6 whatsnew36-pep5201596555
Ref: e311596555
Ref: PEP 520 クラス属性の定義の順番を保持-Footnote-11597168
Node: PEP 468 キーワード引数の順番の保持1597210
Ref: whatsnew/3 6 pep-468-preserving-keyword-argument-order1597402
Ref: e591597402
Ref: whatsnew/3 6 whatsnew36-pep4681597402
Ref: e321597402
Ref: PEP 468 キーワード引数の順番の保持-Footnote-11597814
Node: 新たな dict 実装1597856
Ref: whatsnew/3 6 new-dict-implementation1598049
Ref: e5a1598049
Ref: whatsnew/3 6 whatsnew36-compactdict1598049
Ref: e2f1598049
Ref: 新たな dict 実装-Footnote-11599014
Ref: 新たな dict 実装-Footnote-21599094
Ref: 新たな dict 実装-Footnote-31599184
Ref: 新たな dict 実装-Footnote-41599249
Node: PEP 523 CPython にフレーム評価 API を追加1599329
Ref: whatsnew/3 6 pep-523-adding-a-frame-evaluation-api-to-cpython1599500
Ref: e5b1599500
Ref: whatsnew/3 6 whatsnew36-pep5231599500
Ref: e5c1599500
Ref: PEP 523 CPython にフレーム評価 API を追加-Footnote-11600657
Ref: PEP 523 CPython にフレーム評価 API を追加-Footnote-21600699
Node: PYTHONMALLOC 環境変数1600741
Ref: whatsnew/3 6 pythonmalloc-environment-variable1600927
Ref: e5d1600927
Ref: whatsnew/3 6 whatsnew36-pythonmalloc1600927
Ref: e341600927
Ref: PYTHONMALLOC 環境変数-Footnote-11604329
Ref: PYTHONMALLOC 環境変数-Footnote-21604394
Node: DTrace and SystemTap probing support1604459
Ref: whatsnew/3 6 dtrace-and-systemtap-probing-support1604585
Ref: e651604585
Ref: whatsnew/3 6 whatsnew36-tracing1604585
Ref: e331604585
Ref: DTrace and SystemTap probing support-Footnote-11605497
Node: その他の言語変更<8>1605562
Ref: whatsnew/3 6 other-language-changes1605714
Ref: e671605714
Ref: その他の言語変更<8>-Footnote-11607108
Ref: その他の言語変更<8>-Footnote-21607173
Ref: その他の言語変更<8>-Footnote-31607238
Ref: その他の言語変更<8>-Footnote-41607303
Node: 新たなモジュール<8>1607368
Ref: whatsnew/3 6 new-modules1607534
Ref: e6b1607534
Node: secrets1607611
Ref: whatsnew/3 6 secrets1607682
Ref: e6c1607682
Ref: whatsnew/3 6 whatsnew36-pep5061607682
Ref: e2e1607682
Ref: secrets-Footnote-11608354
Node: 改良されたモジュール<8>1608396
Ref: whatsnew/3 6 improved-modules1608547
Ref: e6d1608547
Node: array<3>1610108
Ref: whatsnew/3 6 array1610201
Ref: e6e1610201
Ref: array<3>-Footnote-11610494
Node: ast<6>1610559
Ref: whatsnew/3 6 ast1610672
Ref: e6f1610672
Ref: ast<6>-Footnote-11610921
Node: asyncio<12>1610986
Ref: whatsnew/3 6 asyncio1611102
Ref: e701611102
Ref: asyncio<12>-Footnote-11614566
Ref: asyncio<12>-Footnote-21614631
Ref: asyncio<12>-Footnote-31614676
Ref: asyncio<12>-Footnote-41614741
Ref: asyncio<12>-Footnote-51614806
Ref: asyncio<12>-Footnote-61614871
Ref: asyncio<12>-Footnote-71614936
Ref: asyncio<12>-Footnote-81615001
Ref: asyncio<12>-Footnote-91615066
Ref: asyncio<12>-Footnote-101615131
Ref: asyncio<12>-Footnote-111615197
Ref: asyncio<12>-Footnote-121615263
Node: binascii<2>1615329
Ref: whatsnew/3 6 binascii1615444
Ref: e7a1615444
Ref: binascii<2>-Footnote-11615729
Node: cmath1615794
Ref: whatsnew/3 6 cmath1615912
Ref: e7c1615912
Ref: cmath-Footnote-11616426
Ref: cmath-Footnote-21616491
Ref: cmath-Footnote-31616533
Node: collections<4>1616598
Ref: whatsnew/3 6 collections1616726
Ref: e831616726
Ref: collections<4>-Footnote-11617832
Ref: collections<4>-Footnote-21617897
Ref: collections<4>-Footnote-31617962
Ref: collections<4>-Footnote-41618027
Ref: collections<4>-Footnote-51618092
Ref: collections<4>-Footnote-61618157
Node: concurrent futures<5>1618222
Ref: whatsnew/3 6 concurrent-futures1618358
Ref: e881618358
Ref: concurrent futures<5>-Footnote-11618689
Node: contextlib<4>1618754
Ref: whatsnew/3 6 contextlib1618887
Ref: e891618887
Ref: contextlib<4>-Footnote-11619383
Node: datetime<6>1619448
Ref: whatsnew/3 6 datetime1619570
Ref: e8c1619570
Ref: datetime<6>-Footnote-11620592
Ref: datetime<6>-Footnote-21620657
Ref: datetime<6>-Footnote-31620722
Ref: datetime<6>-Footnote-41620787
Node: decimal<3>1620852
Ref: whatsnew/3 6 decimal1620973
Ref: e911620973
Ref: decimal<3>-Footnote-11621386
Node: distutils<5>1621451
Ref: whatsnew/3 6 distutils1621569
Ref: e931621569
Ref: distutils<5>-Footnote-11621943
Node: email<3>1622008
Ref: whatsnew/3 6 email1622143
Ref: e941622143
Ref: email<3>-Footnote-11623059
Ref: email<3>-Footnote-21623124
Ref: email<3>-Footnote-31623189
Node: エンコーディング<2>1623254
Ref: whatsnew/3 6 encodings1623384
Ref: e981623384
Ref: エンコーディング<2>-Footnote-11623701
Node: enum<7>1623766
Ref: whatsnew/3 6 enum1623903
Ref: e991623903
Ref: enum<7>-Footnote-11624660
Node: faulthandler<3>1624725
Ref: whatsnew/3 6 faulthandler1624847
Ref: e9c1624847
Ref: faulthandler<3>-Footnote-11625110
Node: fileinput<2>1625175
Ref: whatsnew/3 6 fileinput1625300
Ref: e9d1625300
Ref: fileinput<2>-Footnote-11625488
Node: hashlib<5>1625553
Ref: whatsnew/3 6 hashlib1625677
Ref: e9f1625677
Ref: hashlib<5>-Footnote-11626726
Ref: hashlib<5>-Footnote-21626791
Ref: hashlib<5>-Footnote-31626856
Ref: hashlib<5>-Footnote-41626921
Node: http client<2>1626986
Ref: whatsnew/3 6 http-client1627117
Ref: ea61627117
Ref: http client<2>-Footnote-11627377
Node: idlelib と IDLE<2>1627442
Ref: whatsnew/3 6 idlelib-and-idle1627575
Ref: ea91627575
Ref: idlelib と IDLE<2>-Footnote-11631057
Ref: idlelib と IDLE<2>-Footnote-21631122
Ref: idlelib と IDLE<2>-Footnote-31631187
Ref: idlelib と IDLE<2>-Footnote-41631254
Ref: idlelib と IDLE<2>-Footnote-51631319
Ref: idlelib と IDLE<2>-Footnote-61631384
Ref: idlelib と IDLE<2>-Footnote-71631449
Ref: idlelib と IDLE<2>-Footnote-81631514
Ref: idlelib と IDLE<2>-Footnote-91631579
Ref: idlelib と IDLE<2>-Footnote-101631644
Ref: idlelib と IDLE<2>-Footnote-111631710
Node: importlib<6>1631778
Ref: whatsnew/3 6 importlib1631907
Ref: eaa1631907
Ref: importlib<6>-Footnote-11632732
Node: inspect<7>1632797
Ref: whatsnew/3 6 inspect1632914
Ref: eb01632914
Ref: inspect<7>-Footnote-11633689
Ref: inspect<7>-Footnote-21633754
Node: json<2>1633819
Ref: whatsnew/3 6 json1633934
Ref: eb11633934
Ref: json<2>-Footnote-11634257
Node: logging<4>1634322
Ref: whatsnew/3 6 logging1634434
Ref: eb31634434
Ref: logging<4>-Footnote-11634764
Node: math<8>1634829
Ref: whatsnew/3 6 math1634952
Ref: eb51634952
Ref: math<8>-Footnote-11635184
Ref: math<8>-Footnote-21635249
Node: multiprocessing<6>1635291
Ref: whatsnew/3 6 multiprocessing1635409
Ref: eb61635409
Ref: multiprocessing<6>-Footnote-11635638
Node: os<9>1635702
Ref: whatsnew/3 6 os1635824
Ref: eb71635824
Ref: os<9>-Footnote-11636824
Ref: os<9>-Footnote-21636889
Ref: os<9>-Footnote-31636931
Node: pathlib<12>1636973
Ref: whatsnew/3 6 pathlib1637083
Ref: eba1637083
Ref: pathlib<12>-Footnote-11637360
Node: pdb<7>1637425
Ref: whatsnew/3 6 pdb1637539
Ref: ebb1637539
Node: pickle<3>1637777
Ref: whatsnew/3 6 pickle1637891
Ref: ebc1637891
Ref: pickle<3>-Footnote-11638208
Node: pickletools1638273
Ref: whatsnew/3 6 pickletools1638389
Ref: ebd1638389
Ref: pickletools-Footnote-11638617
Node: pydoc<4>1638682
Ref: whatsnew/3 6 pydoc1638798
Ref: ebf1638798
Ref: pydoc<4>-Footnote-11639192
Ref: pydoc<4>-Footnote-21639256
Node: random<4>1639321
Ref: whatsnew/3 6 random1639431
Ref: ec01639431
Ref: random<4>-Footnote-11639686
Node: re<6>1639751
Ref: whatsnew/3 6 re1639861
Ref: ec21639861
Ref: re<6>-Footnote-11640572
Ref: re<6>-Footnote-21640638
Ref: re<6>-Footnote-31640703
Node: readline1640768
Ref: whatsnew/3 6 readline1640880
Ref: ec41640880
Ref: readline-Footnote-11641111
Node: rlcompleter1641176
Ref: whatsnew/3 6 rlcompleter1641291
Ref: ec61641291
Ref: rlcompleter-Footnote-11641595
Ref: rlcompleter-Footnote-21641660
Node: shlex<2>1641725
Ref: whatsnew/3 6 shlex1641839
Ref: ec71641839
Ref: shlex<2>-Footnote-11642129
Node: site<3>1642196
Ref: whatsnew/3 6 site1642309
Ref: eca1642309
Ref: site<3>-Footnote-11642573
Node: sqlite3<8>1642638
Ref: whatsnew/3 6 sqlite31642752
Ref: ecb1642752
Ref: sqlite3<8>-Footnote-11642968
Node: socket<8>1643033
Ref: whatsnew/3 6 socket1643155
Ref: ecd1643155
Ref: socket<8>-Footnote-11644112
Ref: socket<8>-Footnote-21644177
Ref: socket<8>-Footnote-31644242
Ref: socket<8>-Footnote-41644307
Ref: socket<8>-Footnote-51644372
Node: socketserver<2>1644437
Ref: whatsnew/3 6 socketserver1644555
Ref: ed41644555
Ref: socketserver<2>-Footnote-11645190
Ref: socketserver<2>-Footnote-21645255
Node: ssl<8>1645320
Ref: whatsnew/3 6 ssl1645442
Ref: ed81645442
Ref: ssl<8>-Footnote-11646869
Ref: ssl<8>-Footnote-21646934
Ref: ssl<8>-Footnote-31646999
Ref: ssl<8>-Footnote-41647064
Ref: ssl<8>-Footnote-51647129
Ref: ssl<8>-Footnote-61647194
Ref: ssl<8>-Footnote-71647259
Ref: ssl<8>-Footnote-81647324
Node: statistics<5>1647379
Ref: whatsnew/3 6 statistics1647495
Ref: edc1647495
Ref: statistics<5>-Footnote-11647683
Node: struct<2>1647748
Ref: whatsnew/3 6 struct1647871
Ref: ede1647871
Ref: struct<2>-Footnote-11648102
Node: subprocess<3>1648167
Ref: whatsnew/3 6 subprocess1648284
Ref: edf1648284
Ref: subprocess<3>-Footnote-11648977
Ref: subprocess<3>-Footnote-21649042
Node: sys<10>1649106
Ref: whatsnew/3 6 sys1649223
Ref: ee11649223
Ref: sys<10>-Footnote-11649824
Ref: sys<10>-Footnote-21649889
Node: telnetlib1649954
Ref: whatsnew/3 6 telnetlib1650065
Ref: ee41650065
Ref: telnetlib-Footnote-11650240
Node: time<6>1650305
Ref: whatsnew/3 6 time1650415
Ref: ee51650415
Node: timeit1650554
Ref: whatsnew/3 6 timeit1650665
Ref: ee71650665
Ref: timeit-Footnote-11651122
Ref: timeit-Footnote-21651186
Node: tkinter<7>1651251
Ref: whatsnew/3 6 tkinter1651367
Ref: eea1651367
Ref: tkinter<7>-Footnote-11651811
Node: traceback<4>1651876
Ref: whatsnew/3 6 traceback1652000
Ref: eeb1652000
Ref: whatsnew/3 6 whatsnew36-traceback1652000
Ref: e6a1652000
Ref: traceback<4>-Footnote-11652633
Node: tracemalloc<3>1652698
Ref: whatsnew/3 6 tracemalloc1652822
Ref: eec1652822
Ref: tracemalloc<3>-Footnote-11653183
Node: typing<10>1653248
Ref: whatsnew/3 6 typing1653374
Ref: eee1653374
Ref: whatsnew/3 6 whatsnew36-typing1653374
Ref: e371653374
Ref: typing<10>-Footnote-11655026
Ref: typing<10>-Footnote-21655076
Ref: typing<10>-Footnote-31655141
Ref: typing<10>-Footnote-41655206
Ref: typing<10>-Footnote-51655248
Ref: typing<10>-Footnote-61655298
Ref: typing<10>-Footnote-71655350
Node: unicodedata<8>1655402
Ref: whatsnew/3 6 unicodedata1655530
Ref: ef21655530
Ref: unicodedata<8>-Footnote-11655718
Node: unittest mock<2>1655769
Ref: whatsnew/3 6 unittest-mock1655901
Ref: ef31655901
Ref: unittest mock<2>-Footnote-11656448
Ref: unittest mock<2>-Footnote-21656513
Node: urllib request1656578
Ref: whatsnew/3 6 urllib-request1656714
Ref: ef71656714
Ref: urllib request-Footnote-11657086
Node: urllib robotparser1657151
Ref: whatsnew/3 6 urllib-robotparser1657278
Ref: ef91657278
Ref: urllib robotparser-Footnote-11657523
Node: venv<5>1657588
Ref: whatsnew/3 6 venv1657712
Ref: efb1657712
Ref: venv<5>-Footnote-11658038
Node: warnings<4>1658103
Ref: whatsnew/3 6 warnings1658215
Ref: efc1658215
Ref: warnings<4>-Footnote-11659488
Ref: warnings<4>-Footnote-21659553
Node: winreg1659618
Ref: whatsnew/3 6 winreg1659731
Ref: efe1659731
Ref: winreg-Footnote-11659904
Node: winsound1659969
Ref: whatsnew/3 6 winsound1660084
Ref: f001660084
Ref: winsound-Footnote-11660283
Node: xmlrpc client1660348
Ref: whatsnew/3 6 xmlrpc-client1660467
Ref: f041660467
Ref: xmlrpc client-Footnote-11660760
Node: zipfile<4>1660825
Ref: whatsnew/3 6 zipfile1660943
Ref: f051660943
Ref: zipfile<4>-Footnote-11661477
Ref: zipfile<4>-Footnote-21661542
Node: zlib<2>1661607
Ref: whatsnew/3 6 zlib1661703
Ref: f081661703
Ref: zlib<2>-Footnote-11661959
Ref: zlib<2>-Footnote-21662024
Node: 最適化<9>1662089
Ref: whatsnew/3 6 optimizations1662253
Ref: f0a1662253
Ref: 最適化<9>-Footnote-11666107
Ref: 最適化<9>-Footnote-21666172
Ref: 最適化<9>-Footnote-31666237
Ref: 最適化<9>-Footnote-41666302
Ref: 最適化<9>-Footnote-51666367
Ref: 最適化<9>-Footnote-61666432
Ref: 最適化<9>-Footnote-71666497
Ref: 最適化<9>-Footnote-81666562
Ref: 最適化<9>-Footnote-91666627
Ref: 最適化<9>-Footnote-101666692
Ref: 最適化<9>-Footnote-111666758
Ref: 最適化<9>-Footnote-121666824
Ref: 最適化<9>-Footnote-131666890
Ref: 最適化<9>-Footnote-141666956
Ref: 最適化<9>-Footnote-151667022
Ref: 最適化<9>-Footnote-161667088
Ref: 最適化<9>-Footnote-171667154
Ref: 最適化<9>-Footnote-181667220
Ref: 最適化<9>-Footnote-191667286
Ref: 最適化<9>-Footnote-201667352
Ref: 最適化<9>-Footnote-211667418
Node: ビルドならびに C API の変更<2>1667484
Ref: whatsnew/3 6 build-and-c-api-changes1667633
Ref: f101667633
Ref: ビルドならびに C API の変更<2>-Footnote-11670104
Ref: ビルドならびに C API の変更<2>-Footnote-21670146
Ref: ビルドならびに C API の変更<2>-Footnote-31670211
Ref: ビルドならびに C API の変更<2>-Footnote-41670276
Ref: ビルドならびに C API の変更<2>-Footnote-51670341
Ref: ビルドならびに C API の変更<2>-Footnote-61670405
Ref: ビルドならびに C API の変更<2>-Footnote-71670470
Ref: ビルドならびに C API の変更<2>-Footnote-81670535
Ref: ビルドならびに C API の変更<2>-Footnote-91670600
Ref: ビルドならびに C API の変更<2>-Footnote-101670665
Node: その他の改善1670731
Ref: whatsnew/3 6 other-improvements1670881
Ref: f161670881
Node: 非推奨<10>1671257
Ref: whatsnew/3 6 deprecated1671377
Ref: f181671377
Node: 新たなキーワード1671753
Ref: whatsnew/3 6 new-keywords1671862
Ref: f191671862
Ref: 新たなキーワード-Footnote-11672362
Node: 非推奨の Python 挙動1672404
Ref: whatsnew/3 6 deprecated-python-behavior1672584
Ref: f1a1672584
Ref: 非推奨の Python 挙動-Footnote-11673795
Ref: 非推奨の Python 挙動-Footnote-21673860
Ref: 非推奨の Python 挙動-Footnote-31673925
Node: 非推奨の Python モジュール、関数、メソッド<2>1673990
Ref: whatsnew/3 6 deprecated-python-modules-functions-and-methods1674152
Ref: f1c1674152
Node: asynchat1674467
Ref: whatsnew/3 6 asynchat1674591
Ref: f1d1674591
Ref: asynchat-Footnote-11674775
Node: asyncore1674840
Ref: whatsnew/3 6 asyncore1674979
Ref: f1e1674979
Ref: asyncore-Footnote-11675163
Node: dbm<4>1675228
Ref: whatsnew/3 6 dbm1675371
Ref: f1f1675371
Ref: dbm<4>-Footnote-11675731
Node: distutils<6>1675796
Ref: whatsnew/3 6 id21675934
Ref: f201675934
Ref: distutils<6>-Footnote-11676264
Node: grp1676329
Ref: whatsnew/3 6 grp1676473
Ref: f211676473
Ref: grp-Footnote-11676679
Node: importlib<7>1676744
Ref: whatsnew/3 6 id31676882
Ref: f231676882
Node: os<10>1677536
Ref: whatsnew/3 6 id41677676
Ref: f281677676
Ref: os<10>-Footnote-11677970
Ref: os<10>-Footnote-21678035
Node: re<7>1678100
Ref: whatsnew/3 6 id51678234
Ref: f291678234
Ref: re<7>-Footnote-11678560
Node: ssl<9>1678625
Ref: whatsnew/3 6 id61678763
Ref: f2a1678763
Ref: ssl<9>-Footnote-11679621
Ref: ssl<9>-Footnote-21679686
Ref: ssl<9>-Footnote-31679751
Node: tkinter<8>1679816
Ref: whatsnew/3 6 id71679956
Ref: f2b1679956
Node: venv<6>1680109
Ref: whatsnew/3 6 id81680234
Ref: f2c1680234
Ref: whatsnew/3 6 whatsnew36-venv1680234
Ref: f2d1680234
Ref: venv<6>-Footnote-11680585
Node: xml<6>1680650
Ref: whatsnew/3 6 xml1680831
Ref: f2e1680831
Ref: xml<6>-Footnote-11681135
Node: C API の非推奨の関数ならびに型<2>1681190
Ref: whatsnew/3 6 deprecated-functions-and-types-of-the-c-api1681345
Ref: f2f1681345
Node: 非推奨のビルドオプション1681680
Ref: whatsnew/3 6 deprecated-build-options1681820
Ref: f311681820
Node: 削除<10>1682273
Ref: whatsnew/3 6 removed1682398
Ref: f321682398
Node: API と機能の削除<3>1682488
Ref: whatsnew/3 6 api-and-feature-removals1682560
Ref: f331682560
Ref: API と機能の削除<3>-Footnote-11684652
Ref: API と機能の削除<3>-Footnote-21684717
Node: Python 3 6 への移植1684795
Ref: whatsnew/3 6 porting-to-python-3-61684938
Ref: f361684938
Node: 'python' コマンドの挙動の変更1685367
Ref: whatsnew/3 6 changes-in-python-command-behavior1685498
Ref: f371685498
Ref: 'python' コマンドの挙動の変更-Footnote-11685970
Node: Python API の変更<9>1686035
Ref: whatsnew/3 6 changes-in-the-python-api1686194
Ref: f381686194
Ref: Python API の変更<9>-Footnote-11696372
Ref: Python API の変更<9>-Footnote-21696436
Ref: Python API の変更<9>-Footnote-31696478
Ref: Python API の変更<9>-Footnote-41696543
Ref: Python API の変更<9>-Footnote-51696608
Ref: Python API の変更<9>-Footnote-61696673
Ref: Python API の変更<9>-Footnote-71696738
Ref: Python API の変更<9>-Footnote-81696803
Ref: Python API の変更<9>-Footnote-91696868
Ref: Python API の変更<9>-Footnote-101696933
Ref: Python API の変更<9>-Footnote-111696999
Ref: Python API の変更<9>-Footnote-121697042
Ref: Python API の変更<9>-Footnote-131697108
Ref: Python API の変更<9>-Footnote-141697174
Ref: Python API の変更<9>-Footnote-151697240
Ref: Python API の変更<9>-Footnote-161697306
Ref: Python API の変更<9>-Footnote-171697371
Ref: Python API の変更<9>-Footnote-181697437
Ref: Python API の変更<9>-Footnote-191697503
Ref: Python API の変更<9>-Footnote-201697569
Node: C API の変更<13>1697635
Ref: whatsnew/3 6 changes-in-the-c-api1697793
Ref: f4a1697793
Ref: C API の変更<13>-Footnote-11698434
Ref: C API の変更<13>-Footnote-21698499
Node: CPython バイトコードの変更<8>1698563
Ref: whatsnew/3 6 cpython-bytecode-changes1698689
Ref: f4c1698689
Ref: CPython バイトコードの変更<8>-Footnote-11700322
Ref: CPython バイトコードの変更<8>-Footnote-21700387
Ref: CPython バイトコードの変更<8>-Footnote-31700452
Ref: CPython バイトコードの変更<8>-Footnote-41700517
Ref: CPython バイトコードの変更<8>-Footnote-51700582
Ref: CPython バイトコードの変更<8>-Footnote-61700647
Ref: CPython バイトコードの変更<8>-Footnote-71700712
Ref: CPython バイトコードの変更<8>-Footnote-81700777
Ref: CPython バイトコードの変更<8>-Footnote-91700842
Node: Notable changes in Python 3 6 21700907
Ref: whatsnew/3 6 notable-changes-in-python-3-6-21701071
Ref: f521701071
Node: New make regen-all build target1701235
Ref: whatsnew/3 6 new-make-regen-all-build-target1701377
Ref: f531701377
Ref: New make regen-all build target-Footnote-11702166
Ref: New make regen-all build target-Footnote-21702234
Node: Removal of make touch build target1702299
Ref: whatsnew/3 6 removal-of-make-touch-build-target1702441
Ref: f541702441
Ref: Removal of make touch build target-Footnote-11702878
Node: Notable changes in Python 3 6 41702943
Ref: whatsnew/3 6 notable-changes-in-python-3-6-41703115
Ref: f551703115
Ref: Notable changes in Python 3 6 4-Footnote-11703488
Ref: Notable changes in Python 3 6 4-Footnote-21703553
Node: Notable changes in Python 3 6 51703618
Ref: whatsnew/3 6 notable-changes-in-python-3-6-51703790
Ref: f561703790
Ref: Notable changes in Python 3 6 5-Footnote-11704093
Node: Notable changes in Python 3 6 71704158
Ref: whatsnew/3 6 notable-changes-in-python-3-6-71704331
Ref: f571704331
Ref: Notable changes in Python 3 6 7-Footnote-11704840
Ref: Notable changes in Python 3 6 7-Footnote-21704895
Node: Notable changes in Python 3 6 101704960
Ref: whatsnew/3 6 notable-changes-in-python-3-6-101705134
Ref: f581705134
Ref: Notable changes in Python 3 6 10-Footnote-11705697
Node: Notable changes in Python 3 6 131705762
Ref: whatsnew/3 6 notable-changes-in-python-3-6-131705937
Ref: f591705937
Ref: Notable changes in Python 3 6 13-Footnote-11706657
Node: Notable changes in Python 3 6 141706722
Ref: whatsnew/3 6 notable-changes-in-python-3-6-141706856
Ref: f5a1706856
Ref: Notable changes in Python 3 6 14-Footnote-11707773
Ref: Notable changes in Python 3 6 14-Footnote-21707828
Node: What's New In Python 3 51707883
Ref: whatsnew/3 5 doc1708030
Ref: f5b1708030
Ref: whatsnew/3 5 translation-repo1708030
Ref: f5c1708030
Ref: whatsnew/3 5 what-s-new-in-python-3-51708030
Ref: f5d1708030
Ref: What's New In Python 3 5-Footnote-11709099
Ref: What's New In Python 3 5-Footnote-21709159
Node: 概要 -- リリースハイライト<10>1709201
Ref: whatsnew/3 5 summary-release-highlights1709331
Ref: f5e1709331
Ref: 概要 -- リリースハイライト<10>-Footnote-11713985
Ref: 概要 -- リリースハイライト<10>-Footnote-21714049
Ref: 概要 -- リリースハイライト<10>-Footnote-31714114
Ref: 概要 -- リリースハイライト<10>-Footnote-41714179
Ref: 概要 -- リリースハイライト<10>-Footnote-51714244
Ref: 概要 -- リリースハイライト<10>-Footnote-61714309
Ref: 概要 -- リリースハイライト<10>-Footnote-71714374
Node: 新しい機能<15>1714439
Ref: whatsnew/3 5 new-features1714605
Ref: f711714605
Node: PEP 492 - コルーチン、 async と await 構文1715797
Ref: whatsnew/3 5 pep-492-coroutines-with-async-and-await-syntax1715962
Ref: f721715962
Ref: whatsnew/3 5 whatsnew-pep-4921715962
Ref: f5f1715962
Ref: PEP 492 - コルーチン、 async と await 構文-Footnote-11719369
Ref: PEP 492 - コルーチン、 async と await 構文-Footnote-21719411
Node: PEP 465 - 行列の乗算専用の中置演算子1719453
Ref: whatsnew/3 5 pep-465-a-dedicated-infix-operator-for-matrix-multiplication1719682
Ref: f781719682
Ref: whatsnew/3 5 whatsnew-pep-4651719682
Ref: f601719682
Ref: PEP 465 - 行列の乗算専用の中置演算子-Footnote-11721148
Ref: PEP 465 - 行列の乗算専用の中置演算子-Footnote-21721190
Node: PEP 448 - 追加可能なアンパックへの一般化1721232
Ref: whatsnew/3 5 pep-448-additional-unpacking-generalizations1721485
Ref: f7c1721485
Ref: whatsnew/3 5 whatsnew-pep-4481721485
Ref: f611721485
Ref: PEP 448 - 追加可能なアンパックへの一般化-Footnote-11722679
Ref: PEP 448 - 追加可能なアンパックへの一般化-Footnote-21722721
Node: PEP 461 - bytes および bytearray のパーセント書式化サポート1722763
Ref: whatsnew/3 5 pep-461-percent-formatting-support-for-bytes-and-bytearray1722989
Ref: f801722989
Ref: whatsnew/3 5 whatsnew-pep-4611722989
Ref: f641722989
Ref: PEP 461 - bytes および bytearray のパーセント書式化サポート-Footnote-11724725
Ref: PEP 461 - bytes および bytearray のパーセント書式化サポート-Footnote-21724767
Node: PEP 484 - 型ヒント1724809
Ref: whatsnew/3 5 pep-484-type-hints1725065
Ref: f821725065
Ref: whatsnew/3 5 whatsnew-pep-4841725065
Ref: f621725065
Ref: PEP 484 - 型ヒント-Footnote-11726824
Ref: PEP 484 - 型ヒント-Footnote-21726866
Ref: PEP 484 - 型ヒント-Footnote-31726908
Ref: PEP 484 - 型ヒント-Footnote-41726938
Ref: PEP 484 - 型ヒント-Footnote-51726980
Node: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ1727022
Ref: whatsnew/3 5 pep-471-os-scandir-function-a-better-and-faster-directory-iterator1727265
Ref: f831727265
Ref: whatsnew/3 5 whatsnew-pep-4711727265
Ref: f6d1727265
Ref: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ-Footnote-11728809
Ref: PEP 471 - os scandir 関数 -- より良く、速いディレクトリイテレータ-Footnote-21728851
Node: PEP 475 EINTR で失敗したシステムコールの再試行1728893
Ref: whatsnew/3 5 pep-475-retry-system-calls-failing-with-eintr1729179
Ref: f851729179
Ref: whatsnew/3 5 whatsnew-pep-4751729179
Ref: f861729179
Ref: PEP 475 EINTR で失敗したシステムコールの再試行-Footnote-11732662
Ref: PEP 475 EINTR で失敗したシステムコールの再試行-Footnote-21732704
Node: PEP 479 ジェネレータ内の StopIteration の処理の変更1732746
Ref: whatsnew/3 5 pep-479-change-stopiteration-handling-inside-generators1733000
Ref: fac1733000
Ref: whatsnew/3 5 whatsnew-pep-4791733000
Ref: f1b1733000
Ref: PEP 479 ジェネレータ内の StopIteration の処理の変更-Footnote-11735294
Ref: PEP 479 ジェネレータ内の StopIteration の処理の変更-Footnote-21735336
Node: PEP 485 近似的に等しいことを調べる関数1735378
Ref: whatsnew/3 5 pep-485-a-function-for-testing-approximate-equality1735630
Ref: fae1735630
Ref: whatsnew/3 5 whatsnew-pep-4851735630
Ref: faf1735630
Ref: PEP 485 近似的に等しいことを調べる関数-Footnote-11736816
Ref: PEP 485 近似的に等しいことを調べる関数-Footnote-21736858
Node: PEP 486 Python ランチャーが仮想環境を認識する1736900
Ref: whatsnew/3 5 pep-486-make-the-python-launcher-aware-of-virtual-environments1737120
Ref: fb21737120
Ref: whatsnew/3 5 whatsnew-pep-4861737120
Ref: fb31737120
Ref: PEP 486 Python ランチャーが仮想環境を認識する-Footnote-11737769
Ref: PEP 486 Python ランチャーが仮想環境を認識する-Footnote-21737811
Ref: PEP 486 Python ランチャーが仮想環境を認識する-Footnote-31737853
Node: PEP 488 PYO ファイルの廃止1737895
Ref: whatsnew/3 5 pep-488-elimination-of-pyo-files1738112
Ref: fb41738112
Ref: whatsnew/3 5 whatsnew-pep-4881738112
Ref: f691738112
Ref: PEP 488 PYO ファイルの廃止-Footnote-11739255
Ref: PEP 488 PYO ファイルの廃止-Footnote-21739297
Node: PEP 489 拡張モジュールの多段階初期化1739339
Ref: whatsnew/3 5 pep-489-multi-phase-extension-module-initialization1739487
Ref: fb61739487
Ref: whatsnew/3 5 whatsnew-pep-4891739487
Ref: f6a1739487
Ref: PEP 489 拡張モジュールの多段階初期化-Footnote-11740376
Ref: PEP 489 拡張モジュールの多段階初期化-Footnote-21740418
Ref: PEP 489 拡張モジュールの多段階初期化-Footnote-31740460
Node: その他の言語変更<9>1740502
Ref: whatsnew/3 5 other-language-changes1740654
Ref: fb71740654
Ref: その他の言語変更<9>-Footnote-11741912
Ref: その他の言語変更<9>-Footnote-21741977
Ref: その他の言語変更<9>-Footnote-31742042
Ref: その他の言語変更<9>-Footnote-41742107
Ref: その他の言語変更<9>-Footnote-51742172
Ref: その他の言語変更<9>-Footnote-61742237
Ref: その他の言語変更<9>-Footnote-71742302
Node: 新たなモジュール<9>1742367
Ref: whatsnew/3 5 new-modules1742533
Ref: fb91742533
Node: typing<11>1742643
Ref: whatsnew/3 5 typing1742735
Ref: fba1742735
Node: zipapp<2>1742948
Ref: whatsnew/3 5 whatsnew-zipapp1743040
Ref: f631743040
Ref: whatsnew/3 5 zipapp1743040
Ref: fbb1743040
Ref: zipapp<2>-Footnote-11743972
Ref: zipapp<2>-Footnote-21744014
Ref: zipapp<2>-Footnote-31744081
Ref: zipapp<2>-Footnote-41744146
Node: 改良されたモジュール<9>1744188
Ref: whatsnew/3 5 improved-modules1744372
Ref: fbc1744372
Node: argparse<6>1746121
Ref: whatsnew/3 5 argparse1746222
Ref: fbd1746222
Ref: argparse<6>-Footnote-11746600
Node: asyncio<13>1746665
Ref: whatsnew/3 5 asyncio1746778
Ref: fc01746778
Ref: asyncio<13>-Footnote-11750628
Ref: asyncio<13>-Footnote-21750693
Ref: asyncio<13>-Footnote-31750758
Node: bz21750803
Ref: whatsnew/3 5 bz21750908
Ref: fc91750908
Ref: bz2-Footnote-11751228
Node: cgi1751293
Ref: whatsnew/3 5 cgi1751395
Ref: fcb1751395
Ref: cgi-Footnote-11751592
Node: cmath<2>1751657
Ref: whatsnew/3 5 cmath1751765
Ref: fcc1751765
Ref: cmath<2>-Footnote-11752012
Node: コード1752077
Ref: whatsnew/3 5 code1752196
Ref: fcd1752196
Ref: コード-Footnote-11752514
Node: collections<5>1752579
Ref: whatsnew/3 5 collections1752708
Ref: fcf1752708
Ref: whatsnew/3 5 whatsnew-ordereddict1752751
Ref: f6b1752751
Ref: collections<5>-Footnote-11754157
Ref: collections<5>-Footnote-21754222
Ref: collections<5>-Footnote-31754287
Ref: collections<5>-Footnote-41754352
Ref: collections<5>-Footnote-51754417
Node: collections abc<3>1754482
Ref: whatsnew/3 5 collections-abc1754615
Ref: fda1754615
Ref: collections abc<3>-Footnote-11755345
Ref: collections abc<3>-Footnote-21755410
Ref: collections abc<3>-Footnote-31755475
Ref: collections abc<3>-Footnote-41755540
Node: compileall<4>1755588
Ref: whatsnew/3 5 compileall1755728
Ref: fe01755728
Ref: compileall<4>-Footnote-11756605
Ref: compileall<4>-Footnote-21756670
Ref: compileall<4>-Footnote-31756735
Node: concurrent futures<6>1756800
Ref: whatsnew/3 5 concurrent-futures1756937
Ref: fe31756937
Ref: concurrent futures<6>-Footnote-11757439
Ref: concurrent futures<6>-Footnote-21757504
Node: configparser<5>1757569
Ref: whatsnew/3 5 configparser1757706
Ref: fe41757706
Ref: configparser<5>-Footnote-11758685
Node: contextlib<5>1758750
Ref: whatsnew/3 5 contextlib1758872
Ref: fe51758872
Ref: contextlib<5>-Footnote-11759561
Node: csv<3>1759626
Ref: whatsnew/3 5 csv1759742
Ref: fe81759742
Ref: csv<3>-Footnote-11759989
Node: curses<5>1760054
Ref: whatsnew/3 5 curses1760163
Ref: fea1760163
Ref: curses<5>-Footnote-11760453
Node: dbm<5>1760517
Ref: whatsnew/3 5 dbm1760630
Ref: fee1760630
Ref: dbm<5>-Footnote-11760835
Node: difflib<3>1760900
Ref: whatsnew/3 5 difflib1761016
Ref: fef1761016
Ref: difflib<3>-Footnote-11761554
Ref: difflib<3>-Footnote-21761618
Node: distutils<7>1761683
Ref: whatsnew/3 5 distutils1761803
Ref: ff21761803
Ref: distutils<7>-Footnote-11762256
Ref: distutils<7>-Footnote-21762320
Node: doctest<3>1762385
Ref: whatsnew/3 5 doctest1762503
Ref: ff31762503
Ref: doctest<3>-Footnote-11762881
Node: email<4>1762946
Ref: whatsnew/3 5 email1763059
Ref: ff61763059
Ref: email<4>-Footnote-11764172
Ref: email<4>-Footnote-21764237
Ref: email<4>-Footnote-31764302
Ref: email<4>-Footnote-41764361
Ref: email<4>-Footnote-51764420
Ref: email<4>-Footnote-61764485
Node: enum<8>1764550
Ref: whatsnew/3 5 enum1764668
Ref: ffc1764668
Ref: enum<8>-Footnote-11765106
Node: faulthandler<4>1765171
Ref: whatsnew/3 5 faulthandler1765293
Ref: ffd1765293
Ref: faulthandler<4>-Footnote-11765653
Node: functools<5>1765718
Ref: whatsnew/3 5 functools1765840
Ref: 10011765840
Ref: whatsnew/3 5 whatsnew-lrucache1765881
Ref: f6e1765881
Ref: functools<5>-Footnote-11766131
Node: glob<3>1766196
Ref: whatsnew/3 5 glob1766310
Ref: 10021766310
Ref: glob<3>-Footnote-11766602
Node: gzip<4>1766667
Ref: whatsnew/3 5 gzip1766777
Ref: 10031766777
Ref: gzip<4>-Footnote-11767036
Node: heapq<2>1767101
Ref: whatsnew/3 5 heapq1767211
Ref: 10041767211
Ref: heapq<2>-Footnote-11767855
Node: http<3>1767920
Ref: whatsnew/3 5 http1768037
Ref: 10071768037
Ref: http<3>-Footnote-11768322
Node: http client<3>1768387
Ref: whatsnew/3 5 http-client1768515
Ref: 10081768515
Ref: http client<3>-Footnote-11769264
Node: idlelib と IDLE<3>1769328
Ref: whatsnew/3 5 idlelib-and-idle1769459
Ref: 100c1769459
Node: imaplib<3>1769991
Ref: whatsnew/3 5 imaplib1770114
Ref: 100d1770114
Ref: imaplib<3>-Footnote-11771052
Ref: imaplib<3>-Footnote-21771116
Ref: imaplib<3>-Footnote-31771175
Ref: imaplib<3>-Footnote-41771234
Ref: imaplib<3>-Footnote-51771293
Ref: imaplib<3>-Footnote-61771358
Node: imghdr1771423
Ref: whatsnew/3 5 imghdr1771539
Ref: 10101771539
Ref: imghdr-Footnote-11771829
Ref: imghdr-Footnote-21771861
Ref: imghdr-Footnote-31771926
Ref: imghdr-Footnote-41771969
Node: importlib<8>1772034
Ref: whatsnew/3 5 importlib1772150
Ref: 10111772150
Ref: importlib<8>-Footnote-11772991
Ref: importlib<8>-Footnote-21773056
Ref: importlib<8>-Footnote-31773121
Node: inspect<8>1773186
Ref: whatsnew/3 5 inspect1773301
Ref: 10151773301
Ref: inspect<8>-Footnote-11774865
Ref: inspect<8>-Footnote-21774930
Ref: inspect<8>-Footnote-31774995
Ref: inspect<8>-Footnote-41775060
Ref: inspect<8>-Footnote-51775125
Ref: inspect<8>-Footnote-61775190
Ref: inspect<8>-Footnote-71775255
Ref: inspect<8>-Footnote-81775320
Node: io<7>1775385
Ref: whatsnew/3 5 io1775500
Ref: 101b1775500
Ref: io<7>-Footnote-11775801
Node: ipaddress<4>1775866
Ref: whatsnew/3 5 ipaddress1775978
Ref: 101f1775978
Ref: ipaddress<4>-Footnote-11777015
Ref: ipaddress<4>-Footnote-21777080
Node: json<3>1777145
Ref: whatsnew/3 5 json1777264
Ref: 10211777264
Ref: json<3>-Footnote-11777767
Ref: json<3>-Footnote-21777832
Node: linecache<3>1777897
Ref: whatsnew/3 5 linecache1778013
Ref: 10231778013
Ref: linecache<3>-Footnote-11778426
Node: locale<6>1778491
Ref: whatsnew/3 5 locale1778610
Ref: 10251778610
Ref: locale<6>-Footnote-11779178
Node: logging<5>1779243
Ref: whatsnew/3 5 logging1779354
Ref: 10271779354
Ref: logging<5>-Footnote-11780331
Ref: logging<5>-Footnote-21780396
Node: lzma1780461
Ref: whatsnew/3 5 lzma1780570
Ref: 102d1780570
Ref: lzma-Footnote-11780835
Node: math<9>1780900
Ref: whatsnew/3 5 math1781017
Ref: 102f1781017
Ref: math<9>-Footnote-11781592
Ref: math<9>-Footnote-21781657
Ref: math<9>-Footnote-31781722
Node: multiprocessing<7>1781787
Ref: whatsnew/3 5 multiprocessing1781911
Ref: 10301781911
Ref: multiprocessing<7>-Footnote-11782233
Node: operator<3>1782298
Ref: whatsnew/3 5 operator1782421
Ref: 10321782421
Ref: operator<3>-Footnote-11782855
Ref: operator<3>-Footnote-21782920
Node: os<11>1782985
Ref: whatsnew/3 5 os1783101
Ref: 10371783101
Ref: os<11>-Footnote-11785158
Ref: os<11>-Footnote-21785223
Ref: os<11>-Footnote-31785288
Ref: os<11>-Footnote-41785353
Ref: os<11>-Footnote-51785418
Ref: os<11>-Footnote-61785483
Node: pathlib<13>1785548
Ref: whatsnew/3 5 pathlib1785662
Ref: 103f1785662
Ref: pathlib<13>-Footnote-11787142
Ref: pathlib<13>-Footnote-21787207
Ref: pathlib<13>-Footnote-31787272
Ref: pathlib<13>-Footnote-41787337
Ref: pathlib<13>-Footnote-51787402
Node: pickle<4>1787467
Ref: whatsnew/3 5 pickle1787584
Ref: 10471787584
Ref: pickle<4>-Footnote-11787902
Node: poplib<2>1787967
Ref: whatsnew/3 5 poplib1788078
Ref: 10481788078
Ref: poplib<2>-Footnote-11788323
Ref: poplib<2>-Footnote-21788382
Node: re<8>1788447
Ref: whatsnew/3 5 re1788560
Ref: 104a1788560
Ref: re<8>-Footnote-11789803
Ref: re<8>-Footnote-21789867
Ref: re<8>-Footnote-31789932
Ref: re<8>-Footnote-41789999
Node: readline<2>1790064
Ref: whatsnew/3 5 readline1790177
Ref: 10501790177
Ref: readline<2>-Footnote-11790443
Node: selectors1790508
Ref: whatsnew/3 5 selectors1790625
Ref: 10521790625
Ref: selectors-Footnote-11790847
Node: shutil<5>1790912
Ref: whatsnew/3 5 shutil1791027
Ref: 10531791027
Ref: shutil<5>-Footnote-11791508
Ref: shutil<5>-Footnote-21791573
Node: signal<3>1791637
Ref: whatsnew/3 5 signal1791751
Ref: 10541791751
Ref: signal<3>-Footnote-11792261
Ref: signal<3>-Footnote-21792326
Node: smtpd<2>1792391
Ref: whatsnew/3 5 smtpd1792506
Ref: 10551792506
Ref: smtpd<2>-Footnote-11794144
Ref: smtpd<2>-Footnote-21794209
Ref: smtpd<2>-Footnote-31794268
Ref: smtpd<2>-Footnote-41794333
Ref: smtpd<2>-Footnote-51794392
Ref: smtpd<2>-Footnote-61794457
Node: smtplib<2>1794522
Ref: whatsnew/3 5 smtplib1794634
Ref: 10561794634
Ref: smtplib<2>-Footnote-11795261
Ref: smtplib<2>-Footnote-21795326
Ref: smtplib<2>-Footnote-31795391
Ref: smtplib<2>-Footnote-41795450
Node: sndhdr1795515
Ref: whatsnew/3 5 sndhdr1795628
Ref: 105b1795628
Ref: sndhdr-Footnote-11795833
Node: socket<9>1795898
Ref: whatsnew/3 5 socket1796008
Ref: 105c1796008
Ref: socket<9>-Footnote-11796982
Ref: socket<9>-Footnote-21797047
Ref: socket<9>-Footnote-31797112
Ref: socket<9>-Footnote-41797177
Node: ssl<10>1797242
Ref: whatsnew/3 5 ssl1797356
Ref: 10601797356
Node: メモリ BIO サポート1797500
Ref: whatsnew/3 5 memory-bio-support1797625
Ref: 10611797625
Ref: whatsnew/3 5 whatsnew-sslmemorybio1797625
Ref: f6c1797625
Ref: メモリ BIO サポート-Footnote-11798514
Node: Application-Layer Protocol Negotiation Support1798579
Ref: whatsnew/3 5 application-layer-protocol-negotiation-support1798731
Ref: 10631798731
Ref: Application-Layer Protocol Negotiation Support-Footnote-11799441
Ref: Application-Layer Protocol Negotiation Support-Footnote-21799506
Node: その他の変更1799565
Ref: whatsnew/3 5 other-changes1799682
Ref: 10671799682
Ref: その他の変更-Footnote-11801280
Ref: その他の変更-Footnote-21801345
Ref: その他の変更-Footnote-31801410
Ref: その他の変更-Footnote-41801475
Ref: その他の変更-Footnote-51801534
Ref: その他の変更-Footnote-61801599
Ref: その他の変更-Footnote-71801664
Ref: その他の変更-Footnote-81801729
Node: sqlite3<9>1801794
Ref: whatsnew/3 5 sqlite31801912
Ref: 10701801912
Ref: sqlite3<9>-Footnote-11802244
Ref: sqlite3<9>-Footnote-21802309
Node: subprocess<4>1802374
Ref: whatsnew/3 5 subprocess1802492
Ref: 10721802492
Ref: whatsnew/3 5 whatsnew-subprocess1802492
Ref: f6f1802492
Ref: subprocess<4>-Footnote-11803589
Node: sys<11>1803654
Ref: whatsnew/3 5 sys1803774
Ref: 10741803774
Ref: sys<11>-Footnote-11804426
Ref: sys<11>-Footnote-21804491
Node: sysconfig<3>1804556
Ref: whatsnew/3 5 sysconfig1804673
Ref: 10751804673
Ref: sysconfig<3>-Footnote-11804908
Node: tarfile<7>1804973
Ref: whatsnew/3 5 tarfile1805095
Ref: 10761805095
Ref: tarfile<7>-Footnote-11806032
Ref: tarfile<7>-Footnote-21806097
Ref: tarfile<7>-Footnote-31806162
Node: threading<7>1806227
Ref: whatsnew/3 5 threading1806344
Ref: 107a1806344
Ref: threading<7>-Footnote-11806638
Node: time<7>1806703
Ref: whatsnew/3 5 time1806819
Ref: 107c1806819
Ref: time<7>-Footnote-11807018
Node: timeit<2>1807083
Ref: whatsnew/3 5 timeit1807197
Ref: 107d1807197
Ref: timeit<2>-Footnote-11807747
Ref: timeit<2>-Footnote-21807812
Node: tkinter<9>1807876
Ref: whatsnew/3 5 tkinter1807995
Ref: 107f1807995
Ref: tkinter<9>-Footnote-11808329
Node: traceback<5>1808394
Ref: whatsnew/3 5 traceback1808512
Ref: 10801808512
Ref: whatsnew/3 5 whatsnew-traceback1808512
Ref: f701808512
Ref: traceback<5>-Footnote-11809112
Ref: traceback<5>-Footnote-21809177
Ref: traceback<5>-Footnote-31809242
Node: types<6>1809307
Ref: whatsnew/3 5 types1809429
Ref: 10871809429
Ref: types<6>-Footnote-11809976
Ref: types<6>-Footnote-21810041
Node: unicodedata<9>1810106
Ref: whatsnew/3 5 unicodedata1810227
Ref: 108a1810227
Ref: unicodedata<9>-Footnote-11810381
Node: unittest<9>1810432
Ref: whatsnew/3 5 unittest1810561
Ref: 108b1810561
Ref: unittest<9>-Footnote-11811358
Ref: unittest<9>-Footnote-21811423
Ref: unittest<9>-Footnote-31811488
Node: unittest mock<3>1811553
Ref: whatsnew/3 5 unittest-mock1811677
Ref: 108d1811677
Ref: unittest mock<3>-Footnote-11812635
Ref: unittest mock<3>-Footnote-21812700
Ref: unittest mock<3>-Footnote-31812765
Ref: unittest mock<3>-Footnote-41812830
Ref: unittest mock<3>-Footnote-51812895
Ref: unittest mock<3>-Footnote-61812960
Node: urllib<4>1813025
Ref: whatsnew/3 5 urllib1813145
Ref: 10931813145
Ref: urllib<4>-Footnote-11814310
Ref: urllib<4>-Footnote-21814375
Ref: urllib<4>-Footnote-31814439
Ref: urllib<4>-Footnote-41814504
Ref: urllib<4>-Footnote-51814569
Ref: urllib<4>-Footnote-61814628
Ref: urllib<4>-Footnote-71814687
Ref: urllib<4>-Footnote-81814746
Node: wsgiref1814811
Ref: whatsnew/3 5 wsgiref1814924
Ref: 10971814924
Ref: wsgiref-Footnote-11815165
Node: xmlrpc<2>1815229
Ref: whatsnew/3 5 xmlrpc1815340
Ref: 10991815340
Ref: xmlrpc<2>-Footnote-11815813
Ref: xmlrpc<2>-Footnote-21815878
Node: xml sax1815943
Ref: whatsnew/3 5 xml-sax1816057
Ref: 109a1816057
Ref: xml sax-Footnote-11816468
Ref: xml sax-Footnote-21816532
Node: zipfile<5>1816597
Ref: whatsnew/3 5 zipfile1816693
Ref: 109d1816693
Ref: zipfile<5>-Footnote-11817067
Ref: zipfile<5>-Footnote-21817132
Node: その他のモジュールレベルの変更1817197
Ref: whatsnew/3 5 other-module-level-changes1817367
Ref: 109e1817367
Ref: その他のモジュールレベルの変更-Footnote-11817719
Node: 最適化<10>1817784
Ref: whatsnew/3 5 optimizations1817961
Ref: 109f1817961
Ref: 最適化<10>-Footnote-11821195
Ref: 最適化<10>-Footnote-21821260
Ref: 最適化<10>-Footnote-31821325
Ref: 最適化<10>-Footnote-41821390
Ref: 最適化<10>-Footnote-51821455
Ref: 最適化<10>-Footnote-61821520
Ref: 最適化<10>-Footnote-71821585
Ref: 最適化<10>-Footnote-81821650
Ref: 最適化<10>-Footnote-91821715
Ref: 最適化<10>-Footnote-101821780
Ref: 最適化<10>-Footnote-111821846
Ref: 最適化<10>-Footnote-121821912
Ref: 最適化<10>-Footnote-131821978
Ref: 最適化<10>-Footnote-141822044
Ref: 最適化<10>-Footnote-151822110
Ref: 最適化<10>-Footnote-161822176
Ref: 最適化<10>-Footnote-171822242
Ref: 最適化<10>-Footnote-181822308
Ref: 最適化<10>-Footnote-191822374
Ref: 最適化<10>-Footnote-201822440
Node: ビルドならびに C API の変更<3>1822506
Ref: whatsnew/3 5 build-and-c-api-changes1822651
Ref: 10ac1822651
Ref: ビルドならびに C API の変更<3>-Footnote-11827120
Ref: ビルドならびに C API の変更<3>-Footnote-21827185
Ref: ビルドならびに C API の変更<3>-Footnote-31827250
Ref: ビルドならびに C API の変更<3>-Footnote-41827315
Ref: ビルドならびに C API の変更<3>-Footnote-51827380
Ref: ビルドならびに C API の変更<3>-Footnote-61827445
Ref: ビルドならびに C API の変更<3>-Footnote-71827487
Ref: ビルドならびに C API の変更<3>-Footnote-81827552
Ref: ビルドならびに C API の変更<3>-Footnote-91827617
Ref: ビルドならびに C API の変更<3>-Footnote-101827659
Node: 非推奨<11>1827765
Ref: whatsnew/3 5 deprecated1827907
Ref: 10b81827907
Node: 新たなキーワード<2>1828265
Ref: whatsnew/3 5 new-keywords1828383
Ref: 10b91828383
Ref: 新たなキーワード<2>-Footnote-11828755
Node: 非推奨の Python の挙動<2>1828797
Ref: whatsnew/3 5 deprecated-python-behavior1828984
Ref: 10ba1828984
Node: サポートされないオペレーティングシステム1829460
Ref: whatsnew/3 5 unsupported-operating-systems1829682
Ref: 10bb1829682
Ref: サポートされないオペレーティングシステム-Footnote-11830034
Node: 非推奨の Python モジュール、関数、メソッド<3>1830076
Ref: whatsnew/3 5 deprecated-python-modules-functions-and-methods1830257
Ref: 10bc1830257
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-11833515
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-21833580
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-31833644
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-41833709
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-51833774
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-61833839
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-71833904
Ref: 非推奨の Python モジュール、関数、メソッド<3>-Footnote-81833969
Node: 削除<11>1834034
Ref: whatsnew/3 5 removed1834159
Ref: 10c11834159
Node: API と機能の削除<4>1834251
Ref: whatsnew/3 5 api-and-feature-removals1834323
Ref: 10c21834323
Ref: API と機能の削除<4>-Footnote-11835336
Ref: API と機能の削除<4>-Footnote-21835400
Node: Python 3 5 への移植1835465
Ref: whatsnew/3 5 porting-to-python-3-51835608
Ref: 10c31835608
Node: Python の挙動の変更<3>1835976
Ref: whatsnew/3 5 changes-in-python-behavior1836097
Ref: 10c41836097
Node: Python API の変更<10>1836873
Ref: whatsnew/3 5 changes-in-the-python-api1837022
Ref: 10c51837022
Ref: Python API の変更<10>-Footnote-11846228
Ref: Python API の変更<10>-Footnote-21846270
Ref: Python API の変更<10>-Footnote-31846335
Ref: Python API の変更<10>-Footnote-41846400
Ref: Python API の変更<10>-Footnote-51846465
Ref: Python API の変更<10>-Footnote-61846530
Ref: Python API の変更<10>-Footnote-71846595
Ref: Python API の変更<10>-Footnote-81846660
Ref: Python API の変更<10>-Footnote-91846713
Ref: Python API の変更<10>-Footnote-101846778
Ref: Python API の変更<10>-Footnote-111846844
Ref: Python API の変更<10>-Footnote-121846910
Ref: Python API の変更<10>-Footnote-131846976
Ref: Python API の変更<10>-Footnote-141847036
Ref: Python API の変更<10>-Footnote-151847101
Ref: Python API の変更<10>-Footnote-161847144
Ref: Python API の変更<10>-Footnote-171847204
Ref: Python API の変更<10>-Footnote-181847270
Ref: Python API の変更<10>-Footnote-191847336
Ref: Python API の変更<10>-Footnote-201847402
Node: C API の変更<14>1847467
Ref: whatsnew/3 5 changes-in-the-c-api1847579
Ref: 10cd1847579
Ref: C API の変更<14>-Footnote-11848891
Ref: C API の変更<14>-Footnote-21848956
Ref: C API の変更<14>-Footnote-31849021
Node: Notable changes in Python 3 5 41849063
Ref: whatsnew/3 5 notable-changes-in-python-3-5-41849187
Ref: 10d11849187
Node: New make regen-all build target<2>1849426
Ref: whatsnew/3 5 new-make-regen-all-build-target1849574
Ref: 10d21849574
Ref: New make regen-all build target<2>-Footnote-11850365
Ref: New make regen-all build target<2>-Footnote-21850433
Node: Removal of make touch build target<2>1850498
Ref: whatsnew/3 5 removal-of-make-touch-build-target1850646
Ref: 10d31850646
Ref: Removal of make touch build target<2>-Footnote-11851085
Node: What's New In Python 3 41851150
Ref: whatsnew/3 4 doc1851297
Ref: 10d41851297
Ref: whatsnew/3 4 translation-repo1851297
Ref: 10d51851297
Ref: whatsnew/3 4 what-s-new-in-python-3-41851297
Ref: 10d61851297
Ref: What's New In Python 3 4-Footnote-11852167
Ref: What's New In Python 3 4-Footnote-21852226
Node: 概要 -- リリースハイライト<11>1852268
Ref: whatsnew/3 4 summary-release-highlights1852398
Ref: 10d71852398
Ref: 概要 -- リリースハイライト<11>-Footnote-11857852
Ref: 概要 -- リリースハイライト<11>-Footnote-21857894
Ref: 概要 -- リリースハイライト<11>-Footnote-31857936
Ref: 概要 -- リリースハイライト<11>-Footnote-41858001
Ref: 概要 -- リリースハイライト<11>-Footnote-51858043
Ref: 概要 -- リリースハイライト<11>-Footnote-61858108
Ref: 概要 -- リリースハイライト<11>-Footnote-71858150
Ref: 概要 -- リリースハイライト<11>-Footnote-81858192
Ref: 概要 -- リリースハイライト<11>-Footnote-91858234
Ref: 概要 -- リリースハイライト<11>-Footnote-101858276
Ref: 概要 -- リリースハイライト<11>-Footnote-111858319
Ref: 概要 -- リリースハイライト<11>-Footnote-121858362
Ref: 概要 -- リリースハイライト<11>-Footnote-131858405
Ref: 概要 -- リリースハイライト<11>-Footnote-141858448
Ref: 概要 -- リリースハイライト<11>-Footnote-151858491
Ref: 概要 -- リリースハイライト<11>-Footnote-161858556
Ref: 概要 -- リリースハイライト<11>-Footnote-171858622
Ref: 概要 -- リリースハイライト<11>-Footnote-181858665
Ref: 概要 -- リリースハイライト<11>-Footnote-191858708
Ref: 概要 -- リリースハイライト<11>-Footnote-201858774
Ref: 概要 -- リリースハイライト<11>-Footnote-211858820
Ref: 概要 -- リリースハイライト<11>-Footnote-221858863
Ref: 概要 -- リリースハイライト<11>-Footnote-231858906
Ref: 概要 -- リリースハイライト<11>-Footnote-241858972
Ref: 概要 -- リリースハイライト<11>-Footnote-251859015
Node: 新しい機能<16>1859058
Ref: whatsnew/3 4 new-features1859225
Ref: 10f21859225
Node: PEP 453 Python インストール時の PIP の明示的なブートストラッピング1859814
Ref: whatsnew/3 4 pep-453-explicit-bootstrapping-of-pip-in-python-installations1860033
Ref: 10f31860033
Ref: whatsnew/3 4 whatsnew-pep-4531860033
Ref: 10d81860033
Node: デフォルトでの pip のブートストラッピング1860317
Ref: whatsnew/3 4 bootstrapping-pip-by-default1860538
Ref: 10f41860538
Ref: デフォルトでの pip のブートストラッピング-Footnote-11864387
Ref: デフォルトでの pip のブートストラッピング-Footnote-21864429
Node: ドキュメントの変更1864516
Ref: whatsnew/3 4 documentation-changes1864737
Ref: 10f71864737
Ref: ドキュメントの変更-Footnote-11865891
Ref: ドキュメントの変更-Footnote-21865928
Node: PEP 446 新規作成されたファイル記述子は継承不可1865970
Ref: whatsnew/3 4 pep-446-newly-created-file-descriptors-are-non-inheritable1866219
Ref: 10fb1866219
Ref: whatsnew/3 4 whatsnew-pep-4461866219
Ref: 10d91866219
Ref: PEP 446 新規作成されたファイル記述子は継承不可-Footnote-11867457
Ref: PEP 446 新規作成されたファイル記述子は継承不可-Footnote-21867499
Node: Codec 処理の改良1867541
Ref: whatsnew/3 4 codec-handling-improvements1867763
Ref: 10db1867763
Ref: whatsnew/3 4 improvements-to-codec-handling1867763
Ref: 11031867763
Ref: Codec 処理の改良-Footnote-11873044
Ref: Codec 処理の改良-Footnote-21873122
Ref: Codec 処理の改良-Footnote-31873186
Ref: Codec 処理の改良-Footnote-41873251
Ref: Codec 処理の改良-Footnote-51873316
Node: PEP 451 インポートシステムのための ModuleSpec 型1873381
Ref: whatsnew/3 4 pep-451-a-modulespec-type-for-the-import-system1873566
Ref: 11081873566
Ref: whatsnew/3 4 whatsnew-pep-4511873566
Ref: 10dc1873566
Ref: PEP 451 インポートシステムのための ModuleSpec 型-Footnote-11874779
Ref: PEP 451 インポートシステムのための ModuleSpec 型-Footnote-21874821
Node: その他の言語変更<10>1874901
Ref: whatsnew/3 4 other-language-changes1875056
Ref: 110a1875056
Ref: その他の言語変更<10>-Footnote-11878418
Ref: その他の言語変更<10>-Footnote-21878483
Ref: その他の言語変更<10>-Footnote-31878548
Ref: その他の言語変更<10>-Footnote-41878613
Ref: その他の言語変更<10>-Footnote-51878680
Ref: その他の言語変更<10>-Footnote-61878745
Ref: その他の言語変更<10>-Footnote-71878810
Ref: その他の言語変更<10>-Footnote-81878875
Ref: その他の言語変更<10>-Footnote-91878940
Ref: その他の言語変更<10>-Footnote-101879005
Ref: その他の言語変更<10>-Footnote-111879071
Ref: その他の言語変更<10>-Footnote-121879137
Ref: その他の言語変更<10>-Footnote-131879180
Node: 新たなモジュール<10>1879246
Ref: whatsnew/3 4 new-modules1879406
Ref: 11101879406
Node: asyncio<14>1879652
Ref: whatsnew/3 4 asyncio1879749
Ref: 11111879749
Ref: whatsnew/3 4 whatsnew-asyncio1879749
Ref: 10de1879749
Ref: asyncio<14>-Footnote-11880658
Ref: asyncio<14>-Footnote-21880700
Ref: asyncio<14>-Footnote-31880742
Node: ensurepip<2>1880784
Ref: whatsnew/3 4 ensurepip1880897
Ref: 11121880897
Ref: whatsnew/3 4 whatsnew-ensurepip1880897
Ref: 10df1880897
Ref: ensurepip<2>-Footnote-11882668
Node: enum<9>1882710
Ref: whatsnew/3 4 enum1882823
Ref: 11131882823
Ref: whatsnew/3 4 whatsnew-enum1882823
Ref: 10e01882823
Ref: enum<9>-Footnote-11883501
Ref: enum<9>-Footnote-21883543
Node: pathlib<14>1883585
Ref: whatsnew/3 4 pathlib1883698
Ref: 11141883698
Ref: whatsnew/3 4 whatsnew-pathlib1883698
Ref: 10e11883698
Ref: pathlib<14>-Footnote-11884503
Node: selectors<2>1884545
Ref: whatsnew/3 4 selectors1884664
Ref: 11151884664
Ref: whatsnew/3 4 whatsnew-selectors1884664
Ref: 10e21884664
Ref: selectors<2>-Footnote-11884992
Node: statistics<6>1885034
Ref: whatsnew/3 4 statistics1885156
Ref: 11161885156
Ref: whatsnew/3 4 whatsnew-statistics1885156
Ref: 10e31885156
Ref: statistics<6>-Footnote-11885668
Ref: statistics<6>-Footnote-21885710
Node: tracemalloc<4>1885752
Ref: whatsnew/3 4 tracemalloc1885853
Ref: 11171885853
Ref: whatsnew/3 4 whatsnew-tracemalloc1885853
Ref: 10e41885853
Ref: tracemalloc<4>-Footnote-11886735
Ref: tracemalloc<4>-Footnote-21886777
Node: 改良されたモジュール<10>1886819
Ref: whatsnew/3 4 improved-modules1886986
Ref: 11181886986
Node: abc1888374
Ref: whatsnew/3 4 abc1888464
Ref: 11191888464
Ref: abc-Footnote-11889176
Ref: abc-Footnote-21889241
Node: aifc<2>1889306
Ref: whatsnew/3 4 aifc1889416
Ref: 111d1889416
Ref: aifc<2>-Footnote-11890026
Ref: aifc<2>-Footnote-21890091
Ref: aifc<2>-Footnote-31890156
Node: argparse<7>1890220
Ref: whatsnew/3 4 argparse1890334
Ref: 111e1890334
Ref: argparse<7>-Footnote-11890635
Node: audioop1890700
Ref: whatsnew/3 4 audioop1890816
Ref: 111f1890816
Ref: audioop-Footnote-11891340
Ref: audioop-Footnote-21891405
Ref: audioop-Footnote-31891470
Node: base64<4>1891535
Ref: whatsnew/3 4 base641891654
Ref: 11201891654
Ref: base64<4>-Footnote-11892647
Ref: base64<4>-Footnote-21892712
Node: collections<6>1892777
Ref: whatsnew/3 4 collections1892897
Ref: 11251892897
Ref: collections<6>-Footnote-11893344
Node: colorsys1893409
Ref: whatsnew/3 4 colorsys1893533
Ref: 11271893533
Ref: colorsys-Footnote-11893907
Ref: colorsys-Footnote-21893978
Node: contextlib<6>1894043
Ref: whatsnew/3 4 contextlib1894159
Ref: 11281894159
Ref: contextlib<6>-Footnote-11895834
Ref: contextlib<6>-Footnote-21895899
Ref: contextlib<6>-Footnote-31895964
Node: dbm<6>1896029
Ref: whatsnew/3 4 dbm1896143
Ref: 112c1896143
Ref: dbm<6>-Footnote-11896557
Node: dis<5>1896622
Ref: whatsnew/3 4 dis1896733
Ref: 112e1896733
Ref: dis<5>-Footnote-11899998
Ref: dis<5>-Footnote-21900063
Ref: dis<5>-Footnote-31900128
Ref: dis<5>-Footnote-41900193
Node: doctest<4>1900273
Ref: whatsnew/3 4 doctest1900386
Ref: 11331900386
Ref: doctest<4>-Footnote-11901415
Ref: doctest<4>-Footnote-21901480
Ref: doctest<4>-Footnote-31901545
Node: email<5>1901609
Ref: whatsnew/3 4 email1901723
Ref: 11371901723
Ref: whatsnew/3 4 whatsnew-email-contentmanager1903193
Ref: 10e81903193
Ref: email<5>-Footnote-11904382
Ref: email<5>-Footnote-21904447
Ref: email<5>-Footnote-31904512
Ref: email<5>-Footnote-41904577
Node: filecmp1904642
Ref: whatsnew/3 4 filecmp1904758
Ref: 113f1904758
Ref: filecmp-Footnote-11905542
Ref: filecmp-Footnote-21905607
Node: functools<6>1905672
Ref: whatsnew/3 4 functools1905785
Ref: 11431905785
Ref: whatsnew/3 4 whatsnew-singledispatch1906347
Ref: 10e51906347
Ref: functools<6>-Footnote-11907888
Ref: functools<6>-Footnote-21907952
Ref: functools<6>-Footnote-31907994
Ref: functools<6>-Footnote-41908059
Node: gc<6>1908124
Ref: whatsnew/3 4 gc1908237
Ref: 11451908237
Ref: gc<6>-Footnote-11908528
Node: glob<4>1908593
Ref: whatsnew/3 4 glob1908704
Ref: 11461908704
Ref: glob<4>-Footnote-11909047
Node: hashlib<6>1909111
Ref: whatsnew/3 4 hashlib1909224
Ref: 11481909224
Ref: hashlib<6>-Footnote-11910066
Ref: hashlib<6>-Footnote-21910111
Ref: hashlib<6>-Footnote-31910176
Node: hmac<4>1910241
Ref: whatsnew/3 4 hmac1910351
Ref: 114a1910351
Ref: hmac<4>-Footnote-11911613
Ref: hmac<4>-Footnote-21911678
Ref: hmac<4>-Footnote-31911743
Ref: hmac<4>-Footnote-41911785
Node: html1911850
Ref: whatsnew/3 4 html1911957
Ref: 114f1911957
Ref: html-Footnote-11912842
Ref: html-Footnote-21912906
Ref: html-Footnote-31912971
Node: http<4>1913036
Ref: whatsnew/3 4 http1913155
Ref: 11501913155
Ref: http<4>-Footnote-11914334
Ref: http<4>-Footnote-21914399
Node: idlelib と IDLE<4>1914464
Ref: whatsnew/3 4 idlelib-and-idle1914591
Ref: 11541914591
Node: importlib<9>1915123
Ref: whatsnew/3 4 importlib1915253
Ref: 11551915253
Ref: importlib<9>-Footnote-11917652
Ref: importlib<9>-Footnote-21917717
Ref: importlib<9>-Footnote-31917782
Ref: importlib<9>-Footnote-41917847
Ref: importlib<9>-Footnote-51917912
Ref: importlib<9>-Footnote-61917977
Ref: importlib<9>-Footnote-71918042
Ref: importlib<9>-Footnote-81918084
Node: inspect<9>1918149
Ref: whatsnew/3 4 inspect1918272
Ref: 115c1918272
Ref: inspect<9>-Footnote-11920706
Ref: inspect<9>-Footnote-21920771
Ref: inspect<9>-Footnote-31920836
Ref: inspect<9>-Footnote-41920901
Ref: inspect<9>-Footnote-51920966
Ref: inspect<9>-Footnote-61921031
Ref: inspect<9>-Footnote-71921096
Node: ipaddress<5>1921174
Ref: whatsnew/3 4 ipaddress1921295
Ref: 11601921295
Ref: ipaddress<5>-Footnote-11922078
Node: logging<6>1922143
Ref: whatsnew/3 4 logging1922264
Ref: 11621922264
Ref: logging<6>-Footnote-11923609
Ref: logging<6>-Footnote-21923673
Ref: logging<6>-Footnote-31923728
Ref: logging<6>-Footnote-41923793
Node: marshal<2>1923858
Ref: whatsnew/3 4 marshal1923974
Ref: 11681923974
Ref: whatsnew/3 4 whatsnew-marshal-31923974
Ref: 10dd1923974
Ref: marshal<2>-Footnote-11924840
Ref: marshal<2>-Footnote-21924905
Node: mmap<3>1924970
Ref: whatsnew/3 4 mmap1925094
Ref: 11691925094
Ref: mmap<3>-Footnote-11925267
Node: multiprocessing<8>1925331
Ref: whatsnew/3 4 multiprocessing1925456
Ref: 116a1925456
Ref: whatsnew/3 4 whatsnew-multiprocessing-no-fork1925509
Ref: 10e71925509
Ref: multiprocessing<8>-Footnote-11927890
Ref: multiprocessing<8>-Footnote-21927954
Ref: multiprocessing<8>-Footnote-31928019
Ref: multiprocessing<8>-Footnote-41928083
Node: operator<4>1928148
Ref: whatsnew/3 4 operator1928272
Ref: 116e1928272
Ref: operator<4>-Footnote-11928883
Ref: operator<4>-Footnote-21928925
Ref: operator<4>-Footnote-31928990
Node: os<12>1929055
Ref: whatsnew/3 4 os1929167
Ref: 11701929167
Ref: os<12>-Footnote-11930867
Ref: os<12>-Footnote-21930932
Ref: os<12>-Footnote-31930997
Ref: os<12>-Footnote-41931061
Node: pdb<8>1931126
Ref: whatsnew/3 4 pdb1931236
Ref: 11761931236
Ref: pdb<8>-Footnote-11932554
Ref: pdb<8>-Footnote-21932619
Node: pickle<5>1932684
Ref: whatsnew/3 4 pickle1932799
Ref: 11791932799
Ref: whatsnew/3 4 whatsnew-protocol-41932799
Ref: 10e61932799
Ref: pickle<5>-Footnote-11933395
Node: plistlib<2>1933437
Ref: whatsnew/3 4 plistlib1933555
Ref: 117a1933555
Ref: plistlib<2>-Footnote-11934092
Node: poplib<3>1934157
Ref: whatsnew/3 4 poplib1934275
Ref: 117d1934275
Ref: poplib<3>-Footnote-11934731
Node: pprint<4>1934795
Ref: whatsnew/3 4 pprint1934908
Ref: 11801934908
Ref: pprint<4>-Footnote-11935645
Ref: pprint<4>-Footnote-21935710
Node: pty<2>1935775
Ref: whatsnew/3 4 pty1935887
Ref: 11831935887
Node: pydoc<5>1936119
Ref: whatsnew/3 4 pydoc1936227
Ref: 11851936227
Ref: pydoc<5>-Footnote-11937502
Ref: pydoc<5>-Footnote-21937567
Node: re<9>1937632
Ref: whatsnew/3 4 re1937742
Ref: 11861937742
Ref: re<9>-Footnote-11938560
Ref: re<9>-Footnote-21938625
Ref: re<9>-Footnote-31938690
Node: resource1938755
Ref: whatsnew/3 4 resource1938863
Ref: 118b1938863
Ref: resource-Footnote-11939767
Ref: resource-Footnote-21939832
Ref: resource-Footnote-31939897
Node: select1939962
Ref: whatsnew/3 4 select1940074
Ref: 11951940074
Ref: select-Footnote-11940685
Ref: select-Footnote-21940750
Node: shelve<2>1940815
Ref: whatsnew/3 4 shelve1940928
Ref: 119c1940928
Ref: shelve<2>-Footnote-11941266
Node: shutil<6>1941331
Ref: whatsnew/3 4 shutil1941446
Ref: 119e1941446
Ref: shutil<6>-Footnote-11941935
Node: smtpd<3>1942002
Ref: whatsnew/3 4 smtpd1942118
Ref: 11a11942118
Ref: smtpd<3>-Footnote-11942478
Node: smtplib<3>1942543
Ref: whatsnew/3 4 smtplib1942660
Ref: 11a21942660
Ref: smtplib<3>-Footnote-11943146
Node: socket<10>1943210
Ref: whatsnew/3 4 socket1943330
Ref: 11a41943330
Ref: socket<10>-Footnote-11944268
Ref: socket<10>-Footnote-21944333
Node: sqlite3<10>1944397
Ref: whatsnew/3 4 sqlite31944514
Ref: 11a81944514
Ref: sqlite3<10>-Footnote-11944916
Ref: sqlite3<10>-Footnote-21944956
Node: ssl<11>1945021
Ref: whatsnew/3 4 ssl1945132
Ref: 11a91945132
Ref: whatsnew/3 4 whatsnew-tls-11-121945161
Ref: 10ea1945161
Ref: whatsnew/3 4 whatsnew34-sslcontext1945491
Ref: 10ed1945491
Ref: whatsnew/3 4 whatsnew34-win-cert-store1948763
Ref: 10eb1948763
Ref: whatsnew/3 4 whatsnew34-sni1949117
Ref: 10ec1949117
Ref: ssl<11>-Footnote-11949612
Ref: ssl<11>-Footnote-21949677
Ref: ssl<11>-Footnote-31949742
Ref: ssl<11>-Footnote-41949807
Ref: ssl<11>-Footnote-51949872
Ref: ssl<11>-Footnote-61949937
Ref: ssl<11>-Footnote-71950001
Ref: ssl<11>-Footnote-81950066
Ref: ssl<11>-Footnote-91950131
Ref: ssl<11>-Footnote-101950195
Node: stat1950261
Ref: whatsnew/3 4 stat1950370
Ref: 11bb1950370
Ref: stat-Footnote-11950845
Ref: stat-Footnote-21950910
Node: struct<3>1950975
Ref: whatsnew/3 4 struct1951090
Ref: 11c01951090
Ref: struct<3>-Footnote-11951525
Node: subprocess<5>1951590
Ref: whatsnew/3 4 subprocess1951709
Ref: 11c31951709
Ref: subprocess<5>-Footnote-11952269
Ref: subprocess<5>-Footnote-21952334
Node: sunau<2>1952399
Ref: whatsnew/3 4 sunau1952516
Ref: 11c71952516
Ref: sunau<2>-Footnote-11953300
Ref: sunau<2>-Footnote-21953365
Ref: sunau<2>-Footnote-31953430
Ref: sunau<2>-Footnote-41953495
Node: sys<12>1953559
Ref: whatsnew/3 4 sys1953673
Ref: 11c81953673
Ref: sys<12>-Footnote-11955316
Ref: sys<12>-Footnote-21955381
Node: tarfile<8>1955445
Ref: whatsnew/3 4 tarfile1955562
Ref: 11cc1955562
Ref: tarfile<8>-Footnote-11955983
Node: textwrap<2>1956048
Ref: whatsnew/3 4 textwrap1956170
Ref: 11ce1956170
Ref: textwrap<2>-Footnote-11957048
Ref: textwrap<2>-Footnote-21957113
Node: threading<8>1957178
Ref: whatsnew/3 4 threading1957302
Ref: 11d31957302
Ref: threading<8>-Footnote-11957700
Node: traceback<6>1957765
Ref: whatsnew/3 4 traceback1957886
Ref: 11d51957886
Ref: traceback<6>-Footnote-11958277
Node: types<7>1958344
Ref: whatsnew/3 4 types1958462
Ref: 11d71958462
Ref: types<7>-Footnote-11958973
Node: urllib<5>1959038
Ref: whatsnew/3 4 urllib1959156
Ref: 11d81959156
Ref: urllib<5>-Footnote-11960922
Ref: urllib<5>-Footnote-21960987
Ref: urllib<5>-Footnote-31961052
Ref: urllib<5>-Footnote-41961117
Ref: urllib<5>-Footnote-51961182
Ref: urllib<5>-Footnote-61961247
Node: unittest<10>1961312
Ref: whatsnew/3 4 unittest1961429
Ref: 11e21961429
Ref: unittest<10>-Footnote-11965454
Ref: unittest<10>-Footnote-21965519
Ref: unittest<10>-Footnote-31965584
Ref: unittest<10>-Footnote-41965649
Ref: unittest<10>-Footnote-51965714
Ref: unittest<10>-Footnote-61965779
Ref: unittest<10>-Footnote-71965844
Ref: unittest<10>-Footnote-81965909
Ref: unittest<10>-Footnote-91965974
Node: venv<7>1966039
Ref: whatsnew/3 4 venv1966154
Ref: 11ea1966154
Ref: venv<7>-Footnote-11966827
Ref: venv<7>-Footnote-21966892
Ref: venv<7>-Footnote-31966957
Node: wave<2>1966999
Ref: whatsnew/3 4 wave1967112
Ref: 11eb1967112
Ref: wave<2>-Footnote-11967904
Ref: wave<2>-Footnote-21967969
Ref: wave<2>-Footnote-31968034
Ref: wave<2>-Footnote-41968098
Node: weakref<2>1968162
Ref: whatsnew/3 4 weakref1968280
Ref: 11f01968280
Ref: weakref<2>-Footnote-11969063
Ref: weakref<2>-Footnote-21969128
Ref: weakref<2>-Footnote-31969193
Node: xml etree<2>1969258
Ref: whatsnew/3 4 xml-etree1969379
Ref: 11f41969379
Ref: xml etree<2>-Footnote-11970281
Ref: xml etree<2>-Footnote-21970346
Node: zipfile<6>1970411
Ref: whatsnew/3 4 zipfile1970513
Ref: 11f91970513
Ref: zipfile<6>-Footnote-11971188
Ref: zipfile<6>-Footnote-21971253
Node: CPython の実装の変更1971318
Ref: whatsnew/3 4 cpython-implementation-changes1971470
Ref: 11fc1971470
Node: PEP 445 CPython のメモリアロケータのカスタマイズ1972142
Ref: whatsnew/3 4 pep-445-customization-of-cpython-memory-allocators1972349
Ref: 11fd1972349
Ref: whatsnew/3 4 whatsnew-pep-4451972349
Ref: 10f01972349
Ref: PEP 445 CPython のメモリアロケータのカスタマイズ-Footnote-11972860
Ref: PEP 445 CPython のメモリアロケータのカスタマイズ-Footnote-21972902
Node: PEP 442 オブジェクトの安全なファイナライゼーション1972944
Ref: whatsnew/3 4 pep-442-safe-object-finalization1973228
Ref: 11fe1973228
Ref: whatsnew/3 4 whatsnew-pep-4421973228
Ref: 10ef1973228
Ref: PEP 442 オブジェクトの安全なファイナライゼーション-Footnote-11974449
Ref: PEP 442 オブジェクトの安全なファイナライゼーション-Footnote-21974491
Ref: PEP 442 オブジェクトの安全なファイナライゼーション-Footnote-31974556
Ref: PEP 442 オブジェクトの安全なファイナライゼーション-Footnote-41974622
Ref: PEP 442 オブジェクトの安全なファイナライゼーション-Footnote-51974678
Node: PEP 456 安全で取り換え可能なハッシュアルゴリズム1974720
Ref: whatsnew/3 4 pep-456-secure-and-interchangeable-hash-algorithm1974963
Ref: 12001974963
Ref: whatsnew/3 4 whatsnew-pep-4561974963
Ref: 10e91974963
Ref: PEP 456 安全で取り換え可能なハッシュアルゴリズム-Footnote-11976210
Ref: PEP 456 安全で取り換え可能なハッシュアルゴリズム-Footnote-21976252
Node: PEP 436 Argument Clinic1976317
Ref: whatsnew/3 4 pep-436-argument-clinic1976535
Ref: 12021976535
Ref: whatsnew/3 4 whatsnew-pep-4361976535
Ref: 10f11976535
Ref: PEP 436 Argument Clinic-Footnote-11978061
Ref: PEP 436 Argument Clinic-Footnote-21978103
Node: その他のビルド並びに C API の変更1978145
Ref: whatsnew/3 4 other-build-and-c-api-changes1978316
Ref: 12031978316
Ref: その他のビルド並びに C API の変更-Footnote-11980880
Ref: その他のビルド並びに C API の変更-Footnote-21980945
Ref: その他のビルド並びに C API の変更-Footnote-31980987
Ref: その他のビルド並びに C API の変更-Footnote-41981052
Ref: その他のビルド並びに C API の変更-Footnote-51981119
Ref: その他のビルド並びに C API の変更-Footnote-61981183
Ref: その他のビルド並びに C API の変更-Footnote-71981248
Ref: その他のビルド並びに C API の変更-Footnote-81981321
Ref: その他のビルド並びに C API の変更-Footnote-91981385
Ref: その他のビルド並びに C API の変更-Footnote-101981450
Node: その他の改善<2>1981516
Ref: whatsnew/3 4 other-improvements1981682
Ref: 12071981682
Ref: whatsnew/3 4 other-improvements-3-41981682
Ref: 12081981682
Ref: whatsnew/3 4 whatsnew-isolated-mode1981733
Ref: 10da1981733
Ref: その他の改善<2>-Footnote-11986718
Ref: その他の改善<2>-Footnote-21986783
Ref: その他の改善<2>-Footnote-31986847
Ref: その他の改善<2>-Footnote-41986912
Ref: その他の改善<2>-Footnote-51986977
Ref: その他の改善<2>-Footnote-61987042
Ref: その他の改善<2>-Footnote-71987107
Ref: その他の改善<2>-Footnote-81987202
Ref: その他の改善<2>-Footnote-91987253
Ref: その他の改善<2>-Footnote-101987318
Ref: その他の改善<2>-Footnote-111987384
Ref: その他の改善<2>-Footnote-121987438
Ref: その他の改善<2>-Footnote-131987504
Ref: その他の改善<2>-Footnote-141987570
Ref: その他の改善<2>-Footnote-151987613
Ref: その他の改善<2>-Footnote-161987679
Ref: その他の改善<2>-Footnote-171987745
Ref: その他の改善<2>-Footnote-181987811
Ref: その他の改善<2>-Footnote-191987877
Ref: その他の改善<2>-Footnote-201987920
Ref: その他の改善<2>-Footnote-211987986
Ref: その他の改善<2>-Footnote-221988052
Ref: その他の改善<2>-Footnote-231988118
Node: 大幅な最適化1988184
Ref: whatsnew/3 4 significant-optimizations1988295
Ref: 120d1988295
Ref: 大幅な最適化-Footnote-11991762
Ref: 大幅な最適化-Footnote-21991827
Ref: 大幅な最適化-Footnote-31991892
Ref: 大幅な最適化-Footnote-41991957
Ref: 大幅な最適化-Footnote-51992022
Ref: 大幅な最適化-Footnote-61992087
Ref: 大幅な最適化-Footnote-71992152
Ref: 大幅な最適化-Footnote-81992216
Ref: 大幅な最適化-Footnote-91992281
Ref: 大幅な最適化-Footnote-101992346
Ref: 大幅な最適化-Footnote-111992412
Ref: 大幅な最適化-Footnote-121992478
Ref: 大幅な最適化-Footnote-131992544
Node: 非推奨<12>1992610
Ref: whatsnew/3 4 deprecated1992738
Ref: 12111992738
Ref: whatsnew/3 4 deprecated-3-41992738
Ref: 11091992738
Node: Python API の非推奨項目1993276
Ref: whatsnew/3 4 deprecations-in-the-python-api1993382
Ref: 12121993382
Node: 非推奨の機能1997642
Ref: whatsnew/3 4 deprecated-features1997748
Ref: 12161997748
Ref: 非推奨の機能-Footnote-11998315
Ref: 非推奨の機能-Footnote-21998380
Node: 削除<12>1998445
Ref: whatsnew/3 4 removed1998570
Ref: 12181998570
Node: サポートされなくなったオペレーティングシステム1998757
Ref: whatsnew/3 4 operating-systems-no-longer-supported1998907
Ref: 12191998907
Ref: サポートされなくなったオペレーティングシステム-Footnote-11999370
Ref: サポートされなくなったオペレーティングシステム-Footnote-21999435
Ref: サポートされなくなったオペレーティングシステム-Footnote-31999490
Ref: サポートされなくなったオペレーティングシステム-Footnote-41999555
Node: API と機能の削除<5>1999620
Ref: whatsnew/3 4 api-and-feature-removals1999797
Ref: 121a1999797
Ref: API と機能の削除<5>-Footnote-12003709
Ref: API と機能の削除<5>-Footnote-22003745
Ref: API と機能の削除<5>-Footnote-32003803
Ref: API と機能の削除<5>-Footnote-42003854
Ref: API と機能の削除<5>-Footnote-52003919
Ref: API と機能の削除<5>-Footnote-62003984
Ref: API と機能の削除<5>-Footnote-72004049
Ref: API と機能の削除<5>-Footnote-82004114
Ref: API と機能の削除<5>-Footnote-92004178
Node: コードの整理2004243
Ref: whatsnew/3 4 code-cleanups2004342
Ref: 121c2004342
Ref: コードの整理-Footnote-12005158
Node: Python 3 4 への移植2005223
Ref: whatsnew/3 4 porting-to-python-3-42005350
Ref: 121d2005350
Node: 'python' コマンドの挙動の変更<2>2005744
Ref: whatsnew/3 4 changes-in-python-command-behavior2005879
Ref: 121e2005879
Ref: 'python' コマンドの挙動の変更<2>-Footnote-12007321
Node: Python API の変更<11>2007386
Ref: whatsnew/3 4 changes-in-the-python-api2007549
Ref: 110e2007549
Ref: Python API の変更<11>-Footnote-12025219
Ref: Python API の変更<11>-Footnote-22025284
Ref: Python API の変更<11>-Footnote-32025349
Ref: Python API の変更<11>-Footnote-42025414
Ref: Python API の変更<11>-Footnote-52025469
Ref: Python API の変更<11>-Footnote-62025534
Ref: Python API の変更<11>-Footnote-72025599
Ref: Python API の変更<11>-Footnote-82025664
Ref: Python API の変更<11>-Footnote-92025729
Ref: Python API の変更<11>-Footnote-102025794
Ref: Python API の変更<11>-Footnote-112025859
Ref: Python API の変更<11>-Footnote-122025925
Ref: Python API の変更<11>-Footnote-132025991
Ref: Python API の変更<11>-Footnote-142026057
Ref: Python API の変更<11>-Footnote-152026123
Ref: Python API の変更<11>-Footnote-162026189
Ref: Python API の変更<11>-Footnote-172026255
Ref: Python API の変更<11>-Footnote-182026321
Ref: Python API の変更<11>-Footnote-192026387
Ref: Python API の変更<11>-Footnote-202026453
Ref: Python API の変更<11>-Footnote-212026519
Ref: Python API の変更<11>-Footnote-222026585
Ref: Python API の変更<11>-Footnote-232026651
Ref: Python API の変更<11>-Footnote-242026717
Ref: Python API の変更<11>-Footnote-252026783
Ref: Python API の変更<11>-Footnote-262026848
Node: C API の変更<15>2026914
Ref: whatsnew/3 4 changes-in-the-c-api2027026
Ref: 122e2027026
Ref: C API の変更<15>-Footnote-12029176
Ref: C API の変更<15>-Footnote-22029241
Node: 3 4 3 の変更2029306
Ref: whatsnew/3 4 changed-in-3-4-32029414
Ref: 12342029414
Node: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化2029677
Ref: whatsnew/3 4 pep-4762029830
Ref: 12352029830
Ref: whatsnew/3 4 pep-476-enabling-certificate-verification-by-default-for-stdlib-http-clients2029830
Ref: 12362029830
Node: What's New In Python 3 32031048
Ref: whatsnew/3 3 doc2031195
Ref: 12372031195
Ref: whatsnew/3 3 translation-repo2031195
Ref: 12382031195
Ref: whatsnew/3 3 what-s-new-in-python-3-32031195
Ref: 12392031195
Ref: What's New In Python 3 3-Footnote-12033410
Ref: What's New In Python 3 3-Footnote-22033469
Node: 概要 -- リリースハイライト<12>2033511
Ref: whatsnew/3 3 summary-release-highlights2033642
Ref: 123a2033642
Node: PEP 405 仮想環境2035228
Ref: whatsnew/3 3 pep-4052035415
Ref: 123c2035415
Ref: whatsnew/3 3 pep-405-virtual-environments2035415
Ref: 12442035415
Ref: PEP 405 仮想環境-Footnote-12036619
Node: PEP 420 暗黙的な名前空間パッケージ2036661
Ref: whatsnew/3 3 pep-420-implicit-namespace-packages2036903
Ref: 12452036903
Ref: PEP 420 暗黙的な名前空間パッケージ-Footnote-12037487
Ref: PEP 420 暗黙的な名前空間パッケージ-Footnote-22037529
Node: PEP 3118 新たなメモリビューの実装とバッファプロトコルのドキュメント2037571
Ref: whatsnew/3 3 pep-3118-new-memoryview-implementation-and-buffer-protocol-documentation2037828
Ref: 12462037828
Ref: whatsnew/3 3 pep-3118-update2037828
Ref: 12472037828
Ref: PEP 3118 新たなメモリビューの実装とバッファプロトコルのドキュメント-Footnote-12039461
Node: フィーチャー2039503
Ref: whatsnew/3 3 features2039676
Ref: 124a2039676
Ref: フィーチャー-Footnote-12040836
Node: API の変更2040901
Ref: whatsnew/3 3 api-changes2041074
Ref: 124f2041074
Ref: API の変更-Footnote-12042514
Ref: API の変更-Footnote-22042579
Node: PEP 393 文字列の柔軟な表現2042621
Ref: whatsnew/3 3 pep-3932042870
Ref: 123f2042870
Ref: whatsnew/3 3 pep-393-flexible-string-representation2042870
Ref: 12562042870
Ref: PEP 393 文字列の柔軟な表現-Footnote-12044322
Node: 機能性2044364
Ref: whatsnew/3 3 functionality2044490
Ref: 12572044490
Ref: 機能性-Footnote-12046387
Ref: 機能性-Footnote-22046429
Node: 性能およびリソース使用量2046494
Ref: whatsnew/3 3 performance-and-resource-usage2046620
Ref: 12592046620
Ref: 性能およびリソース使用量-Footnote-12048413
Node: PEP 397 Windows の Python ランチャ2048455
Ref: whatsnew/3 3 pep-3972048657
Ref: 125a2048657
Ref: whatsnew/3 3 pep-397-python-launcher-for-windows2048657
Ref: 125b2048657
Ref: PEP 397 Windows の Python ランチャ-Footnote-12050705
Ref: PEP 397 Windows の Python ランチャ-Footnote-22050769
Node: PEP 3151 OS および IO 例外階層の手直し2050811
Ref: whatsnew/3 3 pep-31512051028
Ref: 123d2051028
Ref: whatsnew/3 3 pep-3151-reworking-the-os-and-io-exception-hierarchy2051028
Ref: 125d2051028
Ref: PEP 3151 OS および IO 例外階層の手直し-Footnote-12053698
Node: PEP 380 サブジェネレータへの委譲構文2053740
Ref: whatsnew/3 3 pep-3802053959
Ref: 123b2053959
Ref: whatsnew/3 3 pep-380-syntax-for-delegating-to-a-subgenerator2053959
Ref: 126b2053959
Ref: PEP 380 サブジェネレータへの委譲構文-Footnote-12056884
Node: PEP 409 例外コンテキストの抑制2056926
Ref: whatsnew/3 3 pep-409-suppressing-exception-context2057143
Ref: 126e2057143
Ref: PEP 409 例外コンテキストの抑制-Footnote-12059470
Node: PEP 414 明示的なユニコードリテラル2059512
Ref: whatsnew/3 3 pep-414-explicit-unicode-literals2059718
Ref: 126f2059718
Ref: PEP 414 明示的なユニコードリテラル-Footnote-12060605
Node: PEP 3155 クラスと関数の正規名2060647
Ref: whatsnew/3 3 pep-3155-qualified-name-for-classes-and-functions2060838
Ref: 12702060838
Ref: PEP 3155 クラスと関数の正規名-Footnote-12062466
Node: PEP 412 キー共有辞書2062508
Ref: whatsnew/3 3 pep-4122062699
Ref: 12402062699
Ref: whatsnew/3 3 pep-412-key-sharing-dictionary2062699
Ref: 12732062699
Ref: PEP 412 キー共有辞書-Footnote-12063244
Node: PEP 362 関数シグニチャオブジェクト2063286
Ref: whatsnew/3 3 pep-362-function-signature-object2063474
Ref: 12742063474
Ref: PEP 362 関数シグニチャオブジェクト-Footnote-12064699
Node: PEP 421 sys implementation の追加2064741
Ref: whatsnew/3 3 pep-421-adding-sys-implementation2064956
Ref: 12762064956
Ref: PEP 421 sys implementation の追加-Footnote-12066509
Node: SimpleNamespace2066551
Ref: whatsnew/3 3 simplenamespace2066639
Ref: 12772066639
Ref: SimpleNamespace-Footnote-12067388
Node: インポート実装としての importlib の使用2067430
Ref: whatsnew/3 3 importlib2067626
Ref: 123e2067626
Ref: whatsnew/3 3 using-importlib-as-the-implementation-of-import2067626
Ref: 12782067626
Ref: インポート実装としての importlib の使用-Footnote-12069219
Ref: インポート実装としての importlib の使用-Footnote-22069283
Ref: インポート実装としての importlib の使用-Footnote-32069348
Ref: インポート実装としての importlib の使用-Footnote-42069413
Ref: インポート実装としての importlib の使用-Footnote-52069478
Node: 新たな API2069520
Ref: whatsnew/3 3 new-apis2069653
Ref: 127b2069653
Node: 目に見える変化2071897
Ref: whatsnew/3 3 visible-changes2072030
Ref: 12822072030
Ref: 目に見える変化-Footnote-12074648
Ref: 目に見える変化-Footnote-22074690
Node: その他の言語変更<11>2074732
Ref: whatsnew/3 3 other-language-changes2074928
Ref: 12832074928
Ref: その他の言語変更<11>-Footnote-12077453
Ref: その他の言語変更<11>-Footnote-22077518
Ref: その他の言語変更<11>-Footnote-32077583
Ref: その他の言語変更<11>-Footnote-42077648
Ref: その他の言語変更<11>-Footnote-52077713
Ref: その他の言語変更<11>-Footnote-62077778
Ref: その他の言語変更<11>-Footnote-72077843
Ref: その他の言語変更<11>-Footnote-82077908
Node: 細粒度のインポートロック2077973
Ref: whatsnew/3 3 a-finer-grained-import-lock2078143
Ref: 12862078143
Ref: 細粒度のインポートロック-Footnote-12079244
Node: 組み込みの関数と型2079308
Ref: whatsnew/3 3 builtin-functions-and-types2079478
Ref: 12872079478
Ref: 組み込みの関数と型-Footnote-12081054
Node: 新たなモジュール<11>2081118
Ref: whatsnew/3 3 new-modules2081286
Ref: 128a2081286
Node: faulthandler<5>2081432
Ref: whatsnew/3 3 faulthandler2081533
Ref: 128b2081533
Node: ipaddress<6>2082514
Ref: whatsnew/3 3 ipaddress2082631
Ref: 12922082631
Ref: ipaddress<6>-Footnote-12083087
Node: lzma<2>2083129
Ref: whatsnew/3 3 lzma2083222
Ref: 12932083222
Ref: lzma<2>-Footnote-12083536
Node: 改良されたモジュール<11>2083600
Ref: whatsnew/3 3 improved-modules2083754
Ref: 12942083754
Node: abc<2>2085110
Ref: whatsnew/3 3 abc2085204
Ref: 12952085204
Ref: abc<2>-Footnote-12086438
Ref: abc<2>-Footnote-22086503
Node: array<4>2086568
Ref: whatsnew/3 3 array2086680
Ref: 129b2086680
Ref: array<4>-Footnote-12086914
Node: base64<5>2086981
Ref: whatsnew/3 3 base642087098
Ref: 129c2087098
Ref: base64<5>-Footnote-12087506
Node: binascii<3>2087571
Ref: whatsnew/3 3 binascii2087686
Ref: 129d2087686
Ref: binascii<3>-Footnote-12087995
Node: bz2<2>2088060
Ref: whatsnew/3 3 bz22088175
Ref: 129e2088175
Ref: bz2<2>-Footnote-12089364
Ref: bz2<2>-Footnote-22089428
Node: codecs<2>2089492
Ref: whatsnew/3 3 codecs2089610
Ref: 12a12089610
Ref: codecs<2>-Footnote-12091418
Ref: codecs<2>-Footnote-22091483
Ref: codecs<2>-Footnote-32091548
Node: collections<7>2091613
Ref: whatsnew/3 3 collections2091738
Ref: 12a22091738
Ref: collections<7>-Footnote-12092687
Ref: collections<7>-Footnote-22092752
Ref: collections<7>-Footnote-32092817
Ref: collections<7>-Footnote-42092882
Node: contextlib<7>2092947
Ref: whatsnew/3 3 contextlib2093071
Ref: 12a42093071
Ref: contextlib<7>-Footnote-12093891
Node: crypt<2>2093956
Ref: whatsnew/3 3 crypt2094075
Ref: 12a52094075
Ref: crypt<2>-Footnote-12094279
Node: curses<6>2094344
Ref: whatsnew/3 3 curses2094461
Ref: 12a62094461
Ref: curses<6>-Footnote-12095925
Ref: curses<6>-Footnote-22095990
Ref: curses<6>-Footnote-32096054
Node: datetime<7>2096119
Ref: whatsnew/3 3 datetime2096238
Ref: 12ab2096238
Ref: datetime<7>-Footnote-12097199
Node: decimal<4>2097264
Ref: whatsnew/3 3 decimal2097382
Ref: 12ad2097382
Ref: whatsnew/3 3 new-decimal2097382
Ref: 12412097382
Ref: decimal<4>-Footnote-12099135
Node: フィーチャー<2>2099199
Ref: whatsnew/3 3 id12099292
Ref: 12ae2099292
Node: API の変更<2>2099812
Ref: whatsnew/3 3 id22099905
Ref: 12b32099905
Node: email<6>2103355
Ref: whatsnew/3 3 email2103471
Ref: 12c52103471
Ref: whatsnew/3 3 new-email2103471
Ref: 12422103471
Node: ポリシーフレームワーク2103638
Ref: whatsnew/3 3 policy-framework2103775
Ref: 12c62103775
Node: 新規ヘッダ API を伴った暫定ポリシー2107638
Ref: whatsnew/3 3 provisional-policy-with-new-header-api2107808
Ref: 12ca2107808
Node: その他のAPIの変更2113389
Ref: whatsnew/3 3 other-api-changes2113517
Ref: 12d02113517
Node: ftplib<3>2114720
Ref: whatsnew/3 3 ftplib2114838
Ref: 12d62114838
Ref: ftplib<3>-Footnote-12116020
Ref: ftplib<3>-Footnote-22116084
Ref: ftplib<3>-Footnote-32116149
Node: functools<7>2116214
Ref: whatsnew/3 3 functools2116329
Ref: 12dc2116329
Ref: functools<7>-Footnote-12116773
Node: gc<7>2116838
Ref: whatsnew/3 3 gc2116951
Ref: 12dd2116951
Node: hmac<5>2117169
Ref: whatsnew/3 3 hmac2117277
Ref: 12df2117277
Ref: hmac<5>-Footnote-12117606
Ref: hmac<5>-Footnote-22117664
Node: http<5>2117729
Ref: whatsnew/3 3 http2117839
Ref: 12e12117839
Ref: http<5>-Footnote-12118728
Ref: http<5>-Footnote-22118792
Ref: http<5>-Footnote-32118857
Node: html<2>2118922
Ref: whatsnew/3 3 html2119035
Ref: 12e82119035
Ref: html<2>-Footnote-12120047
Ref: html<2>-Footnote-22120112
Ref: html<2>-Footnote-32120177
Ref: html<2>-Footnote-42120242
Ref: html<2>-Footnote-52120307
Ref: html<2>-Footnote-62120372
Ref: html<2>-Footnote-72120439
Ref: html<2>-Footnote-82120505
Ref: html<2>-Footnote-92120570
Ref: html<2>-Footnote-102120635
Ref: html<2>-Footnote-112120703
Ref: html<2>-Footnote-122120770
Ref: html<2>-Footnote-132120836
Ref: html<2>-Footnote-142120902
Ref: html<2>-Footnote-152120967
Ref: html<2>-Footnote-162121033
Node: imaplib<4>2121099
Ref: whatsnew/3 3 imaplib2121216
Ref: 12ea2121216
Ref: imaplib<4>-Footnote-12121531
Node: inspect<10>2121595
Ref: whatsnew/3 3 inspect2121710
Ref: 12eb2121710
Ref: inspect<10>-Footnote-12122718
Ref: inspect<10>-Footnote-22122783
Node: io<8>2122848
Ref: whatsnew/3 3 io2122965
Ref: 12ee2122965
Ref: io<8>-Footnote-12123656
Node: itertools<7>2123721
Ref: whatsnew/3 3 itertools2123837
Ref: 12ef2123837
Node: logging<7>2124037
Ref: whatsnew/3 3 logging2124156
Ref: 12f02124156
Node: math<10>2124685
Ref: whatsnew/3 3 math2124799
Ref: 12f22124799
Ref: math<10>-Footnote-12125063
Node: mmap<4>2125128
Ref: whatsnew/3 3 mmap2125250
Ref: 12f42125250
Ref: mmap<4>-Footnote-12125661
Node: multiprocessing<9>2125726
Ref: whatsnew/3 3 multiprocessing2125850
Ref: 12f62125850
Ref: multiprocessing<9>-Footnote-12127284
Ref: multiprocessing<9>-Footnote-22127349
Ref: multiprocessing<9>-Footnote-32127413
Ref: multiprocessing<9>-Footnote-42127477
Node: nntplib<2>2127542
Ref: whatsnew/3 3 nntplib2127665
Ref: 12ff2127665
Ref: nntplib<2>-Footnote-12128225
Node: os<13>2128289
Ref: whatsnew/3 3 os2128400
Ref: 13002128400
Ref: os<13>-Footnote-12137586
Ref: os<13>-Footnote-22137651
Ref: os<13>-Footnote-32137715
Ref: os<13>-Footnote-42137780
Ref: os<13>-Footnote-52137845
Ref: os<13>-Footnote-62137910
Ref: os<13>-Footnote-72137974
Ref: os<13>-Footnote-82138039
Ref: os<13>-Footnote-92138104
Ref: os<13>-Footnote-102138169
Ref: os<13>-Footnote-112138234
Node: pdb<9>2138300
Ref: whatsnew/3 3 pdb2138410
Ref: 13382138410
Ref: pdb<9>-Footnote-12138752
Node: pickle<6>2138817
Ref: whatsnew/3 3 pickle2138929
Ref: 13392138929
Ref: pickle<6>-Footnote-12139248
Node: pydoc<6>2139313
Ref: whatsnew/3 3 pydoc2139425
Ref: 133b2139425
Node: re<10>2139624
Ref: whatsnew/3 3 re2139732
Ref: 133c2139732
Ref: re<10>-Footnote-12139956
Node: sched2140020
Ref: whatsnew/3 3 sched2140129
Ref: 133d2140129
Ref: sched-Footnote-12141907
Ref: sched-Footnote-22141972
Ref: sched-Footnote-32142036
Ref: sched-Footnote-42142101
Ref: sched-Footnote-52142166
Node: select<2>2142231
Ref: whatsnew/3 3 select2142342
Ref: 13422142342
Ref: select<2>-Footnote-12142718
Node: shlex<3>2142782
Ref: whatsnew/3 3 shlex2142897
Ref: 13432142897
Node: shutil<7>2143204
Ref: whatsnew/3 3 shutil2143319
Ref: 13442143319
Ref: shutil<7>-Footnote-12145899
Ref: shutil<7>-Footnote-22145964
Ref: shutil<7>-Footnote-32146029
Ref: shutil<7>-Footnote-42146094
Ref: shutil<7>-Footnote-52146159
Ref: shutil<7>-Footnote-62146224
Ref: shutil<7>-Footnote-72146289
Ref: shutil<7>-Footnote-82146353
Node: signal<4>2146417
Ref: whatsnew/3 3 signal2146532
Ref: 13472146532
Ref: signal<4>-Footnote-12148029
Node: smtpd<4>2148093
Ref: whatsnew/3 3 smtpd2148209
Ref: 134e2148209
Ref: smtpd<4>-Footnote-12148692
Ref: smtpd<4>-Footnote-22148751
Ref: smtpd<4>-Footnote-32148810
Node: smtplib<4>2148874
Ref: whatsnew/3 3 smtplib2148991
Ref: 134f2148991
Ref: smtplib<4>-Footnote-12149963
Ref: smtplib<4>-Footnote-22150028
Ref: smtplib<4>-Footnote-32150093
Node: socket<11>2150157
Ref: whatsnew/3 3 socket2150281
Ref: 13512150281
Ref: socket<11>-Footnote-12151653
Ref: socket<11>-Footnote-22151717
Ref: socket<11>-Footnote-32151782
Ref: socket<11>-Footnote-42151871
Ref: socket<11>-Footnote-52151936
Node: socketserver<3>2152001
Ref: whatsnew/3 3 socketserver2152126
Ref: 13542152126
Ref: socketserver<3>-Footnote-12152609
Node: sqlite3<11>2152674
Ref: whatsnew/3 3 sqlite32152796
Ref: 13582152796
Ref: sqlite3<11>-Footnote-12153146
Node: ssl<12>2153211
Ref: whatsnew/3 3 ssl2153325
Ref: 13592153325
Ref: ssl<12>-Footnote-12156006
Ref: ssl<12>-Footnote-22156071
Ref: ssl<12>-Footnote-32156136
Ref: ssl<12>-Footnote-42156201
Ref: ssl<12>-Footnote-52156266
Ref: ssl<12>-Footnote-62156331
Ref: ssl<12>-Footnote-72156390
Ref: ssl<12>-Footnote-82156455
Ref: ssl<12>-Footnote-92156520
Ref: ssl<12>-Footnote-102156585
Ref: ssl<12>-Footnote-112156651
Ref: ssl<12>-Footnote-122156717
Node: stat<2>2156783
Ref: whatsnew/3 3 stat2156895
Ref: 13622156895
Ref: stat<2>-Footnote-12157252
Node: struct<4>2157317
Ref: whatsnew/3 3 struct2157435
Ref: 13642157435
Ref: struct<4>-Footnote-12157684
Node: subprocess<6>2157748
Ref: whatsnew/3 3 subprocess2157866
Ref: 13652157866
Ref: subprocess<6>-Footnote-12158284
Ref: subprocess<6>-Footnote-22158348
Node: sys<13>2158412
Ref: whatsnew/3 3 sys2158531
Ref: 13672158531
Ref: sys<13>-Footnote-12158812
Node: tarfile<9>2158877
Ref: whatsnew/3 3 tarfile2158994
Ref: 13692158994
Ref: tarfile<9>-Footnote-12159267
Node: tempfile<4>2159331
Ref: whatsnew/3 3 tempfile2159452
Ref: 136a2159452
Ref: tempfile<4>-Footnote-12159679
Node: textwrap<3>2159743
Ref: whatsnew/3 3 textwrap2159866
Ref: 136b2159866
Ref: textwrap<3>-Footnote-12160177
Node: threading<9>2160242
Ref: whatsnew/3 3 threading2160361
Ref: 136c2160361
Ref: threading<9>-Footnote-12161577
Ref: threading<9>-Footnote-22161642
Node: time<8>2161706
Ref: whatsnew/3 3 time2161822
Ref: 13732161822
Ref: time<8>-Footnote-12163007
Ref: time<8>-Footnote-22163049
Node: types<8>2163114
Ref: whatsnew/3 3 types2163230
Ref: 13782163230
Ref: types<8>-Footnote-12163620
Ref: types<8>-Footnote-22163685
Ref: types<8>-Footnote-32163727
Node: unittest<11>2163792
Ref: whatsnew/3 3 unittest2163910
Ref: 137b2163910
Ref: unittest<11>-Footnote-12164448
Node: urllib<6>2164513
Ref: whatsnew/3 3 urllib2164636
Ref: 13802164636
Ref: urllib<6>-Footnote-12165078
Node: webbrowser<4>2165145
Ref: whatsnew/3 3 webbrowser2165280
Ref: 13822165280
Ref: webbrowser<4>-Footnote-12165875
Ref: webbrowser<4>-Footnote-22165940
Node: xml etree ElementTree<2>2166005
Ref: whatsnew/3 3 xml-etree-elementtree2166138
Ref: 13832166138
Node: zlib<3>2166657
Ref: whatsnew/3 3 zlib2166768
Ref: 13842166768
Ref: zlib<3>-Footnote-12167244
Ref: zlib<3>-Footnote-22167309
Node: 最適化<11>2167374
Ref: whatsnew/3 3 optimizations2167540
Ref: 13872167540
Ref: 最適化<11>-Footnote-12168470
Ref: 最適化<11>-Footnote-22168512
Ref: 最適化<11>-Footnote-32168577
Ref: 最適化<11>-Footnote-42168642
Node: ビルドならびに C API の変更<4>2168707
Ref: whatsnew/3 3 build-and-c-api-changes2168852
Ref: 12542168852
Ref: ビルドならびに C API の変更<4>-Footnote-12170836
Ref: ビルドならびに C API の変更<4>-Footnote-22170878
Ref: ビルドならびに C API の変更<4>-Footnote-32170920
Node: 非推奨<13>2170985
Ref: whatsnew/3 3 deprecated2171140
Ref: 139d2171140
Node: サポートされないオペレーティングシステム<2>2171578
Ref: whatsnew/3 3 unsupported-operating-systems2171762
Ref: 139e2171762
Node: 非推奨の Python モジュール、関数、メソッド<4>2172251
Ref: whatsnew/3 3 deprecated-python-modules-functions-and-methods2172489
Ref: 139f2172489
Ref: 非推奨の Python モジュール、関数、メソッド<4>-Footnote-12175351
Ref: 非推奨の Python モジュール、関数、メソッド<4>-Footnote-22175415
Ref: 非推奨の Python モジュール、関数、メソッド<4>-Footnote-32175457
Ref: 非推奨の Python モジュール、関数、メソッド<4>-Footnote-42175522
Ref: 非推奨の Python モジュール、関数、メソッド<4>-Footnote-52175587
Node: C API の非推奨の関数ならびに型<3>2175652
Ref: whatsnew/3 3 deprecated-functions-and-types-of-the-c-api2175848
Ref: 13a32175848
Ref: C API の非推奨の関数ならびに型<3>-Footnote-12178899
Node: 非推奨の機能<2>2178941
Ref: whatsnew/3 3 deprecated-features2179066
Ref: 13ad2179066
Node: Python 3 3 への移植2179315
Ref: whatsnew/3 3 porting-to-python-3-32179421
Ref: 13ae2179421
Node: Python コードの移植2179767
Ref: whatsnew/3 3 porting-python-code2179881
Ref: 127a2179881
Ref: whatsnew/3 3 portingpythoncode2179881
Ref: 13af2179881
Ref: Python コードの移植-Footnote-12188970
Ref: Python コードの移植-Footnote-22189035
Ref: Python コードの移植-Footnote-32189100
Ref: Python コードの移植-Footnote-42189165
Ref: Python コードの移植-Footnote-52189207
Ref: Python コードの移植-Footnote-62189249
Ref: Python コードの移植-Footnote-72189313
Ref: Python コードの移植-Footnote-82189380
Ref: Python コードの移植-Footnote-92189445
Ref: Python コードの移植-Footnote-102189509
Node: C コードの移植2189575
Ref: whatsnew/3 3 porting-c-code2189718
Ref: 12552189718
Ref: C コードの移植-Footnote-12191504
Node: C 拡張のビルド2191546
Ref: whatsnew/3 3 building-c-extensions2191706
Ref: 13be2191706
Ref: C 拡張のビルド-Footnote-12192405
Node: コマンドラインスイッチの変更2192470
Ref: whatsnew/3 3 command-line-switch-changes2192601
Ref: 13bf2192601
Ref: コマンドラインスイッチの変更-Footnote-12193350
Ref: コマンドラインスイッチの変更-Footnote-22193415
Node: What's New In Python 3 22193480
Ref: whatsnew/3 2 doc2193627
Ref: 13c12193627
Ref: whatsnew/3 2 translation-repo2193627
Ref: 13c22193627
Ref: whatsnew/3 2 what-s-new-in-python-3-22193627
Ref: 13c32193627
Ref: What's New In Python 3 2-Footnote-12195232
Ref: What's New In Python 3 2-Footnote-22195331
Node: PEP 384 安定 ABI の定義2195373
Ref: whatsnew/3 2 pep-384-defining-a-stable-abi2195530
Ref: 13c42195530
Ref: PEP 384 安定 ABI の定義-Footnote-12196949
Node: PEP 389 argparse コマンドライン解析モジュール2196991
Ref: whatsnew/3 2 pep-389-argparse-command-line-parsing-module2197200
Ref: 13c52197200
Ref: PEP 389 argparse コマンドライン解析モジュール-Footnote-12201849
Node: PEP 391 logging の辞書ベースの設定2201891
Ref: whatsnew/3 2 pep-391-dictionary-based-configuration-for-logging2202115
Ref: 13c72202115
Ref: PEP 391 logging の辞書ベースの設定-Footnote-12204499
Node: PEP 3148 concurrent futures モジュール2204541
Ref: whatsnew/3 2 pep-3148-the-concurrent-futures-module2204755
Ref: 13c92204755
Ref: PEP 3148 concurrent futures モジュール-Footnote-12208440
Node: PEP 3147 PYC リポジトリーディレクトリ2208482
Ref: whatsnew/3 2 pep-3147-pyc-repository-directories2208721
Ref: 13cd2208721
Ref: PEP 3147 PYC リポジトリーディレクトリ-Footnote-12212408
Ref: PEP 3147 PYC リポジトリーディレクトリ-Footnote-22212479
Node: PEP 3149 ABI バージョンでタグ付けされた so ファイル2212521
Ref: whatsnew/3 2 pep-3149-abi-version-tagged-so-files2212768
Ref: 13cf2212768
Ref: PEP 3149 ABI バージョンでタグ付けされた so ファイル-Footnote-12214420
Node: PEP 3333 Python Web Server Gateway Interface v1 0 12214462
Ref: whatsnew/3 2 pep-3333-python-web-server-gateway-interface-v1-0-12214688
Ref: 13d02214688
Ref: PEP 3333 Python Web Server Gateway Interface v1 0 1-Footnote-12217807
Ref: PEP 3333 Python Web Server Gateway Interface v1 0 1-Footnote-22217866
Ref: PEP 3333 Python Web Server Gateway Interface v1 0 1-Footnote-32217925
Node: その他の言語変更<12>2217967
Ref: whatsnew/3 2 other-language-changes2218212
Ref: 13d22218212
Ref: その他の言語変更<12>-Footnote-12228625
Ref: その他の言語変更<12>-Footnote-22228689
Ref: その他の言語変更<12>-Footnote-32228753
Ref: その他の言語変更<12>-Footnote-42228820
Ref: その他の言語変更<12>-Footnote-52228884
Ref: その他の言語変更<12>-Footnote-62228948
Ref: その他の言語変更<12>-Footnote-72229012
Ref: その他の言語変更<12>-Footnote-82229076
Ref: その他の言語変更<12>-Footnote-92229140
Ref: その他の言語変更<12>-Footnote-102229204
Ref: その他の言語変更<12>-Footnote-112229270
Ref: その他の言語変更<12>-Footnote-122229337
Ref: その他の言語変更<12>-Footnote-132229402
Ref: その他の言語変更<12>-Footnote-142229467
Ref: その他の言語変更<12>-Footnote-152229533
Ref: その他の言語変更<12>-Footnote-162229599
Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール2229664
Ref: whatsnew/3 2 new-improved-and-deprecated-modules2229888
Ref: 13df2229888
Node: email<7>2232238
Ref: whatsnew/3 2 email2232390
Ref: 13e02232390
Ref: email<7>-Footnote-12234954
Ref: email<7>-Footnote-22235013
Ref: email<7>-Footnote-32235077
Node: elementtree2235142
Ref: whatsnew/3 2 elementtree2235315
Ref: 13e82235315
Ref: elementtree-Footnote-12236945
Ref: elementtree-Footnote-22237045
Node: functools<8>2237109
Ref: whatsnew/3 2 functools2237286
Ref: 13ef2237286
Ref: functools<8>-Footnote-12241186
Ref: functools<8>-Footnote-22241269
Ref: functools<8>-Footnote-32241348
Ref: functools<8>-Footnote-42241413
Ref: functools<8>-Footnote-52241478
Ref: functools<8>-Footnote-62241542
Ref: functools<8>-Footnote-72241606
Node: itertools<8>2241670
Ref: whatsnew/3 2 itertools2241850
Ref: 13f42241850
Ref: itertools<8>-Footnote-12242625
Ref: itertools<8>-Footnote-22242667
Node: collections<8>2242697
Ref: whatsnew/3 2 collections2242878
Ref: 13f62242878
Ref: collections<8>-Footnote-12245519
Ref: collections<8>-Footnote-22245579
Node: threading<10>2245655
Ref: whatsnew/3 2 threading2245841
Ref: 13fb2245841
Ref: threading<10>-Footnote-12249252
Ref: threading<10>-Footnote-22249313
Ref: threading<10>-Footnote-32249412
Ref: threading<10>-Footnote-42249484
Node: datetime と time2249548
Ref: whatsnew/3 2 datetime-and-time2249728
Ref: 13ff2249728
Ref: datetime と time-Footnote-12252803
Ref: datetime と time-Footnote-22252870
Ref: datetime と time-Footnote-32252934
Ref: datetime と time-Footnote-42252998
Ref: datetime と time-Footnote-52253062
Ref: datetime と time-Footnote-62253129
Ref: datetime と time-Footnote-72253193
Node: math<11>2253258
Ref: whatsnew/3 2 math2253431
Ref: 14032253431
Ref: math<11>-Footnote-12255387
Ref: math<11>-Footnote-22255463
Node: abc<3>2255548
Ref: whatsnew/3 2 abc2255709
Ref: 14082255709
Ref: abc<3>-Footnote-12256392
Node: io<9>2256456
Ref: whatsnew/3 2 io2256616
Ref: 14092256616
Ref: io<9>-Footnote-12257876
Node: reprlib2257940
Ref: whatsnew/3 2 reprlib2258104
Ref: 140b2258104
Ref: reprlib-Footnote-12259084
Ref: reprlib-Footnote-22259148
Node: logging<8>2259212
Ref: whatsnew/3 2 logging2259377
Ref: 140d2259377
Node: csv<4>2261501
Ref: whatsnew/3 2 csv2261672
Ref: 14152261672
Ref: csv<4>-Footnote-12262647
Ref: csv<4>-Footnote-22262711
Node: contextlib<8>2262778
Ref: whatsnew/3 2 contextlib2262960
Ref: 14192262960
Ref: contextlib<8>-Footnote-12265865
Node: decimal と fractions2265929
Ref: whatsnew/3 2 decimal-and-fractions2266108
Ref: 141c2266108
Ref: decimal と fractions-Footnote-12268691
Ref: decimal と fractions-Footnote-22268755
Ref: decimal と fractions-Footnote-32268819
Ref: decimal と fractions-Footnote-42268883
Ref: decimal と fractions-Footnote-52268947
Ref: decimal と fractions-Footnote-62269011
Node: ftp2269075
Ref: whatsnew/3 2 ftp2269246
Ref: 14202269246
Ref: ftp-Footnote-12270951
Ref: ftp-Footnote-22271015
Ref: ftp-Footnote-32271079
Ref: ftp-Footnote-42271143
Node: popen2271207
Ref: whatsnew/3 2 popen2271366
Ref: 14212271366
Ref: popen-Footnote-12271693
Ref: popen-Footnote-22271757
Node: select<3>2271822
Ref: whatsnew/3 2 select2271994
Ref: 14222271994
Ref: select<3>-Footnote-12272428
Node: gzip と zipfile2272492
Ref: whatsnew/3 2 gzip-and-zipfile2272670
Ref: 14242272670
Ref: gzip と zipfile-Footnote-12274411
Ref: gzip と zipfile-Footnote-22274475
Ref: gzip と zipfile-Footnote-32274539
Ref: gzip と zipfile-Footnote-42274606
Ref: gzip と zipfile-Footnote-52274670
Ref: gzip と zipfile-Footnote-62274734
Node: tarfile<10>2274798
Ref: whatsnew/3 2 tarfile2274977
Ref: 14282274977
Ref: tarfile<10>-Footnote-12276830
Node: hashlib<7>2276894
Ref: whatsnew/3 2 hashlib2277063
Ref: 142b2277063
Ref: hashlib<7>-Footnote-12277902
Node: ast<7>2277966
Ref: whatsnew/3 2 ast2278130
Ref: 142c2278130
Node: os<14>2279267
Ref: whatsnew/3 2 os2279430
Ref: 142d2279430
Node: shutil<8>2280347
Ref: whatsnew/3 2 shutil2280515
Ref: 14302280515
Node: sqlite3<12>2283287
Ref: whatsnew/3 2 sqlite32283456
Ref: 14322283456
Ref: sqlite3<12>-Footnote-12284221
Node: html<3>2284285
Ref: whatsnew/3 2 html2284455
Ref: 14332284455
Node: socket<12>2284828
Ref: whatsnew/3 2 socket2284994
Ref: 14342284994
Ref: socket<12>-Footnote-12286208
Ref: socket<12>-Footnote-22286272
Ref: socket<12>-Footnote-32286336
Node: ssl<13>2286397
Ref: whatsnew/3 2 ssl2286560
Ref: 14362286560
Ref: ssl<13>-Footnote-12289031
Ref: ssl<13>-Footnote-22289090
Ref: ssl<13>-Footnote-32289162
Ref: ssl<13>-Footnote-42289221
Ref: ssl<13>-Footnote-52289285
Ref: ssl<13>-Footnote-62289349
Ref: ssl<13>-Footnote-72289413
Ref: ssl<13>-Footnote-82289477
Ref: ssl<13>-Footnote-92289541
Ref: ssl<13>-Footnote-102289605
Node: nntp2289670
Ref: whatsnew/3 2 nntp2289835
Ref: 143a2289835
Ref: nntp-Footnote-12290390
Ref: nntp-Footnote-22290454
Node: certificates2290518
Ref: whatsnew/3 2 certificates2290686
Ref: 143b2290686
Ref: certificates-Footnote-12291361
Node: imaplib<5>2291425
Ref: whatsnew/3 2 imaplib2291603
Ref: 143d2291603
Ref: imaplib<5>-Footnote-12291893
Node: http client<4>2291957
Ref: whatsnew/3 2 http-client2292135
Ref: 143f2292135
Ref: http client<4>-Footnote-12294144
Node: unittest<12>2294209
Ref: whatsnew/3 2 unittest2294386
Ref: 14412294386
Ref: unittest<12>-Footnote-12299458
Ref: unittest<12>-Footnote-22299523
Ref: unittest<12>-Footnote-32299587
Node: random<5>2299651
Ref: whatsnew/3 2 random2299823
Ref: 14462299823
Ref: random<5>-Footnote-12300550
Node: poplib<4>2300614
Ref: whatsnew/3 2 poplib2300785
Ref: 14492300785
Ref: poplib<4>-Footnote-12301262
Node: asyncore<2>2301326
Ref: whatsnew/3 2 asyncore2301499
Ref: 144a2301499
Ref: asyncore<2>-Footnote-12301954
Node: tempfile<5>2302018
Ref: whatsnew/3 2 tempfile2302193
Ref: 144b2302193
Ref: tempfile<5>-Footnote-12302659
Node: inspect<11>2302723
Ref: whatsnew/3 2 inspect2302895
Ref: 144d2302895
Ref: inspect<11>-Footnote-12304774
Node: pydoc<7>2304839
Ref: whatsnew/3 2 pydoc2305006
Ref: 144f2305006
Ref: pydoc<7>-Footnote-12305325
Node: dis<6>2305389
Ref: whatsnew/3 2 dis2305551
Ref: 14502305551
Ref: dis<6>-Footnote-12307926
Node: dbm<7>2307990
Ref: whatsnew/3 2 dbm2308153
Ref: 14522308153
Ref: dbm<7>-Footnote-12308342
Node: ctypes<4>2308406
Ref: whatsnew/3 2 ctypes2308570
Ref: 14532308570
Node: site<4>2308721
Ref: whatsnew/3 2 site2308891
Ref: 14552308891
Ref: site<4>-Footnote-12310298
Node: sysconfig<4>2310362
Ref: whatsnew/3 2 sysconfig2310530
Ref: 14592310530
Node: pdb<10>2312989
Ref: whatsnew/3 2 pdb2313165
Ref: 145c2313165
Node: configparser<6>2314332
Ref: whatsnew/3 2 configparser2314511
Ref: 145d2314511
Node: urllib parse<6>2317687
Ref: whatsnew/3 2 urllib-parse2317866
Ref: 145e2317866
Ref: urllib parse<6>-Footnote-12320154
Ref: urllib parse<6>-Footnote-22320213
Ref: urllib parse<6>-Footnote-32320256
Ref: urllib parse<6>-Footnote-42320320
Ref: urllib parse<6>-Footnote-52320384
Node: mailbox2320448
Ref: whatsnew/3 2 mailbox2320622
Ref: 14622320622
Ref: mailbox-Footnote-12322657
Node: turtledemo2322721
Ref: whatsnew/3 2 turtledemo2322871
Ref: 14692322871
Ref: turtledemo-Footnote-12323308
Node: マルチスレッディング2323373
Ref: whatsnew/3 2 multi-threading2323582
Ref: 146a2323582
Ref: マルチスレッディング-Footnote-12325428
Ref: マルチスレッディング-Footnote-22325507
Ref: マルチスレッディング-Footnote-32325571
Ref: マルチスレッディング-Footnote-42325637
Node: 最適化<12>2325701
Ref: whatsnew/3 2 optimizations2325843
Ref: 146c2325843
Ref: 最適化<12>-Footnote-12329372
Ref: 最適化<12>-Footnote-22329436
Ref: 最適化<12>-Footnote-32329500
Ref: 最適化<12>-Footnote-42329564
Ref: 最適化<12>-Footnote-52329610
Ref: 最適化<12>-Footnote-62329674
Ref: 最適化<12>-Footnote-72329738
Ref: 最適化<12>-Footnote-82329803
Ref: 最適化<12>-Footnote-92329867
Ref: 最適化<12>-Footnote-102329931
Ref: 最適化<12>-Footnote-112329996
Ref: 最適化<12>-Footnote-122330061
Ref: 最適化<12>-Footnote-132330126
Ref: 最適化<12>-Footnote-142330194
Ref: 最適化<12>-Footnote-152330259
Ref: 最適化<12>-Footnote-162330325
Node: Unicode 文字列型2330390
Ref: whatsnew/3 2 unicode2330508
Ref: 14712330508
Ref: Unicode 文字列型-Footnote-12331082
Ref: Unicode 文字列型-Footnote-22331133
Ref: Unicode 文字列型-Footnote-32331177
Node: Codecs2331249
Ref: whatsnew/3 2 codecs2331372
Ref: 14722331372
Ref: Codecs-Footnote-12332649
Node: ドキュメント2332716
Ref: whatsnew/3 2 documentation2332823
Ref: 14732332823
Ref: ドキュメント-Footnote-12334941
Ref: ドキュメント-Footnote-22334991
Ref: ドキュメント-Footnote-32335060
Ref: ドキュメント-Footnote-42335136
Ref: ドキュメント-Footnote-52335200
Node: IDLE2335264
Ref: whatsnew/3 2 idle2335389
Ref: 14772335389
Ref: IDLE-Footnote-12335879
Ref: IDLE-Footnote-22335943
Node: コードリポジトリ2336007
Ref: whatsnew/3 2 code-repository2336154
Ref: 14782336154
Ref: コードリポジトリ-Footnote-12336859
Ref: コードリポジトリ-Footnote-22336898
Ref: コードリポジトリ-Footnote-32336940
Ref: コードリポジトリ-Footnote-42336994
Node: ビルドならびに C API の変更<5>2337038
Ref: whatsnew/3 2 build-and-c-api-changes2337204
Ref: 14792337204
Ref: ビルドならびに C API の変更<5>-Footnote-12342047
Ref: ビルドならびに C API の変更<5>-Footnote-22342112
Ref: ビルドならびに C API の変更<5>-Footnote-32342176
Ref: ビルドならびに C API の変更<5>-Footnote-42342240
Ref: ビルドならびに C API の変更<5>-Footnote-52342304
Ref: ビルドならびに C API の変更<5>-Footnote-62342368
Ref: ビルドならびに C API の変更<5>-Footnote-72342432
Ref: ビルドならびに C API の変更<5>-Footnote-82342496
Ref: ビルドならびに C API の変更<5>-Footnote-92342560
Ref: ビルドならびに C API の変更<5>-Footnote-102342624
Ref: ビルドならびに C API の変更<5>-Footnote-112342689
Ref: ビルドならびに C API の変更<5>-Footnote-122342754
Ref: ビルドならびに C API の変更<5>-Footnote-132342819
Ref: ビルドならびに C API の変更<5>-Footnote-142342884
Ref: ビルドならびに C API の変更<5>-Footnote-152342967
Node: Python 3 2 への移植2343068
Ref: whatsnew/3 2 porting-to-python-3-22343201
Ref: 14822343201
Ref: Python 3 2 への移植-Footnote-12351449
Ref: Python 3 2 への移植-Footnote-22351513
Ref: Python 3 2 への移植-Footnote-32351577
Ref: Python 3 2 への移植-Footnote-42351622
Ref: Python 3 2 への移植-Footnote-52351687
Ref: Python 3 2 への移植-Footnote-62351752
Ref: Python 3 2 への移植-Footnote-72351817
Node: What's New In Python 3 12351881
Ref: whatsnew/3 1 doc2352028
Ref: 14922352028
Ref: whatsnew/3 1 translation-repo2352028
Ref: 14932352028
Ref: whatsnew/3 1 what-s-new-in-python-3-12352028
Ref: 14942352028
Node: PEP 372 順序付き辞書2352824
Ref: whatsnew/3 1 pep-372-ordered-dictionaries2352968
Ref: 14952352968
Ref: PEP 372 順序付き辞書-Footnote-12355823
Ref: PEP 372 順序付き辞書-Footnote-22355851
Node: PEP 378 1000区切りのための書式指定子2355893
Ref: whatsnew/3 1 pep-378-format-specifier-for-thousands-separator2356074
Ref: 14962356074
Ref: PEP 378 1000区切りのための書式指定子-Footnote-12357543
Node: その他の言語変更<13>2357585
Ref: whatsnew/3 1 other-language-changes2357830
Ref: 14972357830
Ref: その他の言語変更<13>-Footnote-12362941
Ref: その他の言語変更<13>-Footnote-22363008
Ref: その他の言語変更<13>-Footnote-32363072
Ref: その他の言語変更<13>-Footnote-42363136
Ref: その他の言語変更<13>-Footnote-52363200
Ref: その他の言語変更<13>-Footnote-62363245
Ref: その他の言語変更<13>-Footnote-72363309
Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>2363373
Ref: whatsnew/3 1 new-improved-and-deprecated-modules2363583
Ref: 14982363583
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-12373903
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-22373970
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-32374034
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-42374076
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-52374140
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-62374204
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-72374268
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-82374310
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-92374374
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-102374438
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-112374503
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-122374568
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-132374633
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<2>-Footnote-142374698
Node: 最適化<13>2374763
Ref: whatsnew/3 1 optimizations2374952
Ref: 14a82374952
Ref: 最適化<13>-Footnote-12377123
Ref: 最適化<13>-Footnote-22377165
Ref: 最適化<13>-Footnote-32377229
Ref: 最適化<13>-Footnote-42377293
Ref: 最適化<13>-Footnote-52377357
Ref: 最適化<13>-Footnote-62377383
Ref: 最適化<13>-Footnote-72377447
Node: IDLE<2>2377511
Ref: whatsnew/3 1 idle2377650
Ref: 14a92377650
Ref: IDLE<2>-Footnote-12377934
Node: ビルドならびに C API の変更<6>2377998
Ref: whatsnew/3 1 build-and-c-api-changes2378147
Ref: 14aa2378147
Ref: ビルドならびに C API の変更<6>-Footnote-12380906
Ref: ビルドならびに C API の変更<6>-Footnote-22380970
Ref: ビルドならびに C API の変更<6>-Footnote-32381034
Ref: ビルドならびに C API の変更<6>-Footnote-42381098
Ref: ビルドならびに C API の変更<6>-Footnote-52381162
Node: Python 3 1 への移植2381226
Ref: whatsnew/3 1 porting-to-python-3-12381359
Ref: 14ae2381359
Node: What's New In Python 3 02382658
Ref: whatsnew/3 0 doc2382805
Ref: 14af2382805
Ref: whatsnew/3 0 translation-repo2382805
Ref: 14b02382805
Ref: whatsnew/3 0 what-s-new-in-python-3-02382805
Ref: 14b12382805
Node: よくある悩みの種2384951
Ref: whatsnew/3 0 common-stumbling-blocks2385069
Ref: 14b22385069
Node: print関数2385429
Ref: whatsnew/3 0 print-is-a-function2385561
Ref: 14b32385561
Ref: print関数-Footnote-12387381
Node: リストからビューおよびイテレータへ2387423
Ref: whatsnew/3 0 views-and-iterators-instead-of-lists2387576
Ref: 14b42387576
Node: 順序比較2389900
Ref: whatsnew/3 0 ordering-comparisons2390048
Ref: 14b72390048
Node: 整数2391688
Ref: whatsnew/3 0 integers2391853
Ref: 14b92391853
Ref: 整数-Footnote-12393178
Ref: 整数-Footnote-22393220
Node: Unicode 対 8 ビット、ではなく、テキスト対データに2393262
Ref: whatsnew/3 0 text-vs-data-instead-of-unicode-vs-8-bit2393406
Ref: 14ba2393406
Ref: Unicode 対 8 ビット、ではなく、テキスト対データに-Footnote-12402412
Ref: Unicode 対 8 ビット、ではなく、テキスト対データに-Footnote-22402454
Ref: Unicode 対 8 ビット、ではなく、テキスト対データに-Footnote-32402496
Node: 構文の変更の概要2402538
Ref: whatsnew/3 0 overview-of-syntax-changes2402700
Ref: 14bd2402700
Node: 新たな構文2402957
Ref: whatsnew/3 0 new-syntax2403063
Ref: 14be2403063
Ref: 新たな構文-Footnote-12406693
Ref: 新たな構文-Footnote-22406735
Ref: 新たな構文-Footnote-32406777
Ref: 新たな構文-Footnote-42406819
Ref: 新たな構文-Footnote-52406861
Node: 変更された構文2406903
Ref: whatsnew/3 0 changed-syntax2407039
Ref: 14c12407039
Ref: 変更された構文-Footnote-12409046
Ref: 変更された構文-Footnote-22409088
Ref: 変更された構文-Footnote-32409130
Ref: 変更された構文-Footnote-42409172
Node: 削除された操作2409214
Ref: whatsnew/3 0 removed-syntax2409326
Ref: 14c22409326
Ref: 削除された操作-Footnote-12411051
Ref: 削除された操作-Footnote-22411093
Node: Python 2 6 で既にあった変更2411135
Ref: whatsnew/3 0 changes-already-present-in-python-2-62411297
Ref: 14c42411297
Node: ライブラリの変更2416168
Ref: whatsnew/3 0 library-changes2416357
Ref: 14d72416357
Ref: ライブラリの変更-Footnote-12423025
Ref: ライブラリの変更-Footnote-22423067
Ref: ライブラリの変更-Footnote-32423109
Ref: ライブラリの変更-Footnote-42423151
Ref: ライブラリの変更-Footnote-52423193
Ref: ライブラリの変更-Footnote-62423235
Node: PEP 3101 文字列整形の新たなアプローチ2423277
Ref: whatsnew/3 0 pep-3101-a-new-approach-to-string-formatting2423455
Ref: 14dc2423455
Ref: PEP 3101 文字列整形の新たなアプローチ-Footnote-12424027
Node: 例外に関する変更2424069
Ref: whatsnew/3 0 changes-to-exceptions2424244
Ref: 14dd2424244
Ref: 例外に関する変更-Footnote-12428082
Ref: 例外に関する変更-Footnote-22428124
Ref: 例外に関する変更-Footnote-32428166
Ref: 例外に関する変更-Footnote-42428208
Ref: 例外に関する変更-Footnote-52428250
Node: その他の変更<2>2428292
Ref: whatsnew/3 0 miscellaneous-other-changes2428456
Ref: 14e12428456
Node: 演算子と特殊メソッド2428565
Ref: whatsnew/3 0 operators-and-special-methods2428674
Ref: 14e22428674
Ref: 演算子と特殊メソッド-Footnote-12430449
Node: 組み込み2430491
Ref: whatsnew/3 0 builtins2430600
Ref: 14ee2430600
Ref: 組み込み-Footnote-12433432
Ref: 組み込み-Footnote-22433474
Ref: 組み込み-Footnote-32433516
Node: ビルドならびに C API の変更<7>2433576
Ref: whatsnew/3 0 build-and-c-api-changes2433722
Ref: 14f42433722
Ref: ビルドならびに C API の変更<7>-Footnote-12434957
Ref: ビルドならびに C API の変更<7>-Footnote-22434999
Ref: ビルドならびに C API の変更<7>-Footnote-32435041
Node: 性能2435083
Ref: whatsnew/3 0 performance2435231
Ref: 14f62435231
Node: Python 3 0 への移植2435667
Ref: whatsnew/3 0 porting-to-python-3-02435766
Ref: 14f72435766
Node: What's New in Python 2 72438444
Ref: whatsnew/2 7 doc2438591
Ref: 14f92438591
Ref: whatsnew/2 7 translation-repo2438591
Ref: 14fa2438591
Ref: whatsnew/2 7 what-s-new-in-python-2-72438591
Ref: 14fb2438591
Node: Python 2 x の今後2441499
Ref: whatsnew/2 7 the-future-for-python-2-x2441628
Ref: 14fc2441628
Ref: whatsnew/2 7 whatsnew27-python312441628
Ref: 14fd2441628
Ref: Python 2 x の今後-Footnote-12445904
Ref: Python 2 x の今後-Footnote-22445946
Node: Deprecation Warnings の扱いの変更2445983
Ref: whatsnew/2 7 changes-to-the-handling-of-deprecation-warnings2446141
Ref: 14ff2446141
Ref: Deprecation Warnings の扱いの変更-Footnote-12447950
Node: Python 3 1 の機能2448014
Ref: whatsnew/2 7 python-3-1-features2448202
Ref: 15002448202
Node: PEP 372 collections に順序付き辞書を追加2450516
Ref: whatsnew/2 7 pep-03722450716
Ref: 15012450716
Ref: whatsnew/2 7 pep-372-adding-an-ordered-dictionary-to-collections2450716
Ref: 15042450716
Ref: PEP 372 collections に順序付き辞書を追加-Footnote-12454537
Ref: PEP 372 collections に順序付き辞書を追加-Footnote-22454565
Node: PEP 378 1000区切りのための書式指定子<2>2454607
Ref: whatsnew/2 7 pep-03782454859
Ref: 15022454859
Ref: whatsnew/2 7 pep-378-format-specifier-for-thousands-separator2454859
Ref: 15062454859
Ref: PEP 378 1000区切りのための書式指定子<2>-Footnote-12456584
Node: PEP 389 コマンドライン解析のための argparse モジュール2456626
Ref: whatsnew/2 7 pep-389-the-argparse-module-for-parsing-command-lines2456874
Ref: 15072456874
Ref: PEP 389 コマンドライン解析のための argparse モジュール-Footnote-12461274
Node: PEP 391 logging の辞書ベースの設定<2>2461316
Ref: whatsnew/2 7 pep-391-dictionary-based-configuration-for-logging2461533
Ref: 15082461533
Ref: PEP 391 logging の辞書ベースの設定<2>-Footnote-12465724
Node: PEP 3106 辞書 View2465766
Ref: whatsnew/2 7 pep-3106-dictionary-views2465949
Ref: 150f2465949
Ref: PEP 3106 辞書 View-Footnote-12468201
Ref: PEP 3106 辞書 View-Footnote-22468243
Node: PEP 3137 memoryview オブジェクト2468307
Ref: whatsnew/2 7 pep-3137-the-memoryview-object2468472
Ref: 15102468472
Ref: PEP 3137 memoryview オブジェクト-Footnote-12470286
Ref: PEP 3137 memoryview オブジェクト-Footnote-22470328
Node: その他の言語変更<14>2470392
Ref: whatsnew/2 7 other-language-changes2470594
Ref: 15112470594
Ref: その他の言語変更<14>-Footnote-12481919
Ref: その他の言語変更<14>-Footnote-22481983
Ref: その他の言語変更<14>-Footnote-32482047
Ref: その他の言語変更<14>-Footnote-42482111
Ref: その他の言語変更<14>-Footnote-52482175
Ref: その他の言語変更<14>-Footnote-62482239
Ref: その他の言語変更<14>-Footnote-72482303
Ref: その他の言語変更<14>-Footnote-82482367
Ref: その他の言語変更<14>-Footnote-92482431
Ref: その他の言語変更<14>-Footnote-102482495
Ref: その他の言語変更<14>-Footnote-112482560
Ref: その他の言語変更<14>-Footnote-122482625
Ref: その他の言語変更<14>-Footnote-132482690
Ref: その他の言語変更<14>-Footnote-142482755
Ref: その他の言語変更<14>-Footnote-152482823
Ref: その他の言語変更<14>-Footnote-162482888
Ref: その他の言語変更<14>-Footnote-172482953
Ref: その他の言語変更<14>-Footnote-182483018
Ref: その他の言語変更<14>-Footnote-192483086
Ref: その他の言語変更<14>-Footnote-202483151
Ref: その他の言語変更<14>-Footnote-212483216
Ref: その他の言語変更<14>-Footnote-222483281
Ref: その他の言語変更<14>-Footnote-232483346
Ref: その他の言語変更<14>-Footnote-242483411
Node: インタプリタの変更2483476
Ref: whatsnew/2 7 interpreter-changes2483590
Ref: 15152483590
Ref: whatsnew/2 7 new-27-interpreter2483590
Ref: 15162483590
Ref: インタプリタの変更-Footnote-12484297
Node: 最適化<14>2484361
Ref: whatsnew/2 7 optimizations2484475
Ref: 15172484475
Ref: 最適化<14>-Footnote-12489819
Ref: 最適化<14>-Footnote-22489883
Ref: 最適化<14>-Footnote-32489947
Ref: 最適化<14>-Footnote-42490011
Ref: 最適化<14>-Footnote-52490075
Ref: 最適化<14>-Footnote-62490139
Ref: 最適化<14>-Footnote-72490206
Ref: 最適化<14>-Footnote-82490270
Ref: 最適化<14>-Footnote-92490334
Ref: 最適化<14>-Footnote-102490398
Ref: 最適化<14>-Footnote-112490463
Ref: 最適化<14>-Footnote-122490528
Ref: 最適化<14>-Footnote-132490593
Node: 新しいモジュールと改良されたモジュール2490658
Ref: whatsnew/2 7 new-and-improved-modules2490862
Ref: 15192490862
Ref: 新しいモジュールと改良されたモジュール-Footnote-12531342
Ref: 新しいモジュールと改良されたモジュール-Footnote-22531406
Ref: 新しいモジュールと改良されたモジュール-Footnote-32531470
Ref: 新しいモジュールと改良されたモジュール-Footnote-42531523
Ref: 新しいモジュールと改良されたモジュール-Footnote-52531587
Ref: 新しいモジュールと改良されたモジュール-Footnote-62531651
Ref: 新しいモジュールと改良されたモジュール-Footnote-72531718
Ref: 新しいモジュールと改良されたモジュール-Footnote-82531782
Ref: 新しいモジュールと改良されたモジュール-Footnote-92531846
Ref: 新しいモジュールと改良されたモジュール-Footnote-102531910
Ref: 新しいモジュールと改良されたモジュール-Footnote-112531975
Ref: 新しいモジュールと改良されたモジュール-Footnote-122532040
Ref: 新しいモジュールと改良されたモジュール-Footnote-132532105
Ref: 新しいモジュールと改良されたモジュール-Footnote-142532145
Ref: 新しいモジュールと改良されたモジュール-Footnote-152532210
Ref: 新しいモジュールと改良されたモジュール-Footnote-162532275
Ref: 新しいモジュールと改良されたモジュール-Footnote-172532340
Ref: 新しいモジュールと改良されたモジュール-Footnote-182532405
Ref: 新しいモジュールと改良されたモジュール-Footnote-192532470
Ref: 新しいモジュールと改良されたモジュール-Footnote-202532535
Ref: 新しいモジュールと改良されたモジュール-Footnote-212532600
Ref: 新しいモジュールと改良されたモジュール-Footnote-222532665
Ref: 新しいモジュールと改良されたモジュール-Footnote-232532730
Ref: 新しいモジュールと改良されたモジュール-Footnote-242532795
Ref: 新しいモジュールと改良されたモジュール-Footnote-252532860
Ref: 新しいモジュールと改良されたモジュール-Footnote-262532925
Ref: 新しいモジュールと改良されたモジュール-Footnote-272532993
Ref: 新しいモジュールと改良されたモジュール-Footnote-282533058
Ref: 新しいモジュールと改良されたモジュール-Footnote-292533123
Ref: 新しいモジュールと改良されたモジュール-Footnote-302533188
Ref: 新しいモジュールと改良されたモジュール-Footnote-312533253
Ref: 新しいモジュールと改良されたモジュール-Footnote-322533318
Ref: 新しいモジュールと改良されたモジュール-Footnote-332533383
Ref: 新しいモジュールと改良されたモジュール-Footnote-342533448
Ref: 新しいモジュールと改良されたモジュール-Footnote-352533513
Ref: 新しいモジュールと改良されたモジュール-Footnote-362533578
Ref: 新しいモジュールと改良されたモジュール-Footnote-372533643
Ref: 新しいモジュールと改良されたモジュール-Footnote-382533708
Ref: 新しいモジュールと改良されたモジュール-Footnote-392533773
Ref: 新しいモジュールと改良されたモジュール-Footnote-402533838
Ref: 新しいモジュールと改良されたモジュール-Footnote-412533903
Ref: 新しいモジュールと改良されたモジュール-Footnote-422533968
Ref: 新しいモジュールと改良されたモジュール-Footnote-432534033
Ref: 新しいモジュールと改良されたモジュール-Footnote-442534098
Ref: 新しいモジュールと改良されたモジュール-Footnote-452534163
Ref: 新しいモジュールと改良されたモジュール-Footnote-462534228
Ref: 新しいモジュールと改良されたモジュール-Footnote-472534293
Ref: 新しいモジュールと改良されたモジュール-Footnote-482534358
Ref: 新しいモジュールと改良されたモジュール-Footnote-492534426
Ref: 新しいモジュールと改良されたモジュール-Footnote-502534491
Ref: 新しいモジュールと改良されたモジュール-Footnote-512534556
Ref: 新しいモジュールと改良されたモジュール-Footnote-522534621
Ref: 新しいモジュールと改良されたモジュール-Footnote-532534686
Ref: 新しいモジュールと改良されたモジュール-Footnote-542534751
Ref: 新しいモジュールと改良されたモジュール-Footnote-552534816
Ref: 新しいモジュールと改良されたモジュール-Footnote-562534881
Ref: 新しいモジュールと改良されたモジュール-Footnote-572534946
Ref: 新しいモジュールと改良されたモジュール-Footnote-582535011
Ref: 新しいモジュールと改良されたモジュール-Footnote-592535076
Ref: 新しいモジュールと改良されたモジュール-Footnote-602535141
Ref: 新しいモジュールと改良されたモジュール-Footnote-612535206
Ref: 新しいモジュールと改良されたモジュール-Footnote-622535271
Ref: 新しいモジュールと改良されたモジュール-Footnote-632535336
Ref: 新しいモジュールと改良されたモジュール-Footnote-642535401
Ref: 新しいモジュールと改良されたモジュール-Footnote-652535466
Ref: 新しいモジュールと改良されたモジュール-Footnote-662535531
Ref: 新しいモジュールと改良されたモジュール-Footnote-672535596
Ref: 新しいモジュールと改良されたモジュール-Footnote-682535661
Ref: 新しいモジュールと改良されたモジュール-Footnote-692535726
Ref: 新しいモジュールと改良されたモジュール-Footnote-702535772
Ref: 新しいモジュールと改良されたモジュール-Footnote-712535837
Ref: 新しいモジュールと改良されたモジュール-Footnote-722535902
Ref: 新しいモジュールと改良されたモジュール-Footnote-732535956
Ref: 新しいモジュールと改良されたモジュール-Footnote-742536021
Ref: 新しいモジュールと改良されたモジュール-Footnote-752536086
Ref: 新しいモジュールと改良されたモジュール-Footnote-762536151
Ref: 新しいモジュールと改良されたモジュール-Footnote-772536216
Ref: 新しいモジュールと改良されたモジュール-Footnote-782536281
Ref: 新しいモジュールと改良されたモジュール-Footnote-792536349
Ref: 新しいモジュールと改良されたモジュール-Footnote-802536414
Ref: 新しいモジュールと改良されたモジュール-Footnote-812536479
Ref: 新しいモジュールと改良されたモジュール-Footnote-822536544
Ref: 新しいモジュールと改良されたモジュール-Footnote-832536609
Ref: 新しいモジュールと改良されたモジュール-Footnote-842536674
Ref: 新しいモジュールと改良されたモジュール-Footnote-852536739
Ref: 新しいモジュールと改良されたモジュール-Footnote-862536807
Ref: 新しいモジュールと改良されたモジュール-Footnote-872536875
Ref: 新しいモジュールと改良されたモジュール-Footnote-882536940
Ref: 新しいモジュールと改良されたモジュール-Footnote-892537000
Ref: 新しいモジュールと改良されたモジュール-Footnote-902537060
Ref: 新しいモジュールと改良されたモジュール-Footnote-912537125
Ref: 新しいモジュールと改良されたモジュール-Footnote-922537190
Ref: 新しいモジュールと改良されたモジュール-Footnote-932537255
Ref: 新しいモジュールと改良されたモジュール-Footnote-942537320
Ref: 新しいモジュールと改良されたモジュール-Footnote-952537385
Ref: 新しいモジュールと改良されたモジュール-Footnote-962537450
Ref: 新しいモジュールと改良されたモジュール-Footnote-972537515
Node: 新しいモジュール importlib2537580
Ref: whatsnew/2 7 importlib-section2537751
Ref: 15032537751
Ref: whatsnew/2 7 new-module-importlib2537751
Ref: 15432537751
Node: 新しいモジュール sysconfig2539474
Ref: whatsnew/2 7 new-module-sysconfig2539697
Ref: 15442539697
Node: ttk Tk のテーマ付きウィジェット2541402
Ref: whatsnew/2 7 ttk-themed-widgets-for-tk2541630
Ref: 15462541630
Ref: ttk Tk のテーマ付きウィジェット-Footnote-12542875
Ref: ttk Tk のテーマ付きウィジェット-Footnote-22542939
Node: 更新されたモジュール unittest2543003
Ref: whatsnew/2 7 unittest-section2543243
Ref: 15472543243
Ref: whatsnew/2 7 updated-module-unittest2543243
Ref: 15482543243
Ref: 更新されたモジュール unittest-Footnote-12553941
Ref: 更新されたモジュール unittest-Footnote-22553985
Ref: 更新されたモジュール unittest-Footnote-32554012
Ref: 更新されたモジュール unittest-Footnote-42554049
Ref: 更新されたモジュール unittest-Footnote-52554113
Ref: 更新されたモジュール unittest-Footnote-62554177
Ref: 更新されたモジュール unittest-Footnote-72554244
Ref: 更新されたモジュール unittest-Footnote-82554308
Ref: 更新されたモジュール unittest-Footnote-92554372
Ref: 更新されたモジュール unittest-Footnote-102554436
Ref: 更新されたモジュール unittest-Footnote-112554501
Ref: 更新されたモジュール unittest-Footnote-122554566
Ref: 更新されたモジュール unittest-Footnote-132554631
Ref: 更新されたモジュール unittest-Footnote-142554696
Ref: 更新されたモジュール unittest-Footnote-152554761
Node: 更新されたモジュール ElementTree 1 32554826
Ref: whatsnew/2 7 elementtree-section2555014
Ref: 15632555014
Ref: whatsnew/2 7 updated-module-elementtree-1-32555014
Ref: 15642555014
Ref: 更新されたモジュール ElementTree 1 3-Footnote-12559296
Node: ビルドならびに C API の変更<8>2559360
Ref: whatsnew/2 7 build-and-c-api-changes2559563
Ref: 15672559563
Ref: ビルドならびに C API の変更<8>-Footnote-12569161
Ref: ビルドならびに C API の変更<8>-Footnote-22569274
Ref: ビルドならびに C API の変更<8>-Footnote-32569338
Ref: ビルドならびに C API の変更<8>-Footnote-42569402
Ref: ビルドならびに C API の変更<8>-Footnote-52569466
Ref: ビルドならびに C API の変更<8>-Footnote-62569530
Ref: ビルドならびに C API の変更<8>-Footnote-72569594
Ref: ビルドならびに C API の変更<8>-Footnote-82569658
Ref: ビルドならびに C API の変更<8>-Footnote-92569713
Ref: ビルドならびに C API の変更<8>-Footnote-102569777
Ref: ビルドならびに C API の変更<8>-Footnote-112569842
Ref: ビルドならびに C API の変更<8>-Footnote-122569907
Ref: ビルドならびに C API の変更<8>-Footnote-132569972
Ref: ビルドならびに C API の変更<8>-Footnote-142570040
Ref: ビルドならびに C API の変更<8>-Footnote-152570108
Ref: ビルドならびに C API の変更<8>-Footnote-162570173
Ref: ビルドならびに C API の変更<8>-Footnote-172570238
Ref: ビルドならびに C API の変更<8>-Footnote-182570303
Ref: ビルドならびに C API の変更<8>-Footnote-192570368
Ref: ビルドならびに C API の変更<8>-Footnote-202570433
Ref: ビルドならびに C API の変更<8>-Footnote-212570501
Ref: ビルドならびに C API の変更<8>-Footnote-222570566
Node: カプセル2570631
Ref: whatsnew/2 7 capsules2570761
Ref: 15722570761
Ref: whatsnew/2 7 whatsnew27-capsules2570761
Ref: 15732570761
Ref: カプセル-Footnote-12573017
Node: ポート特有の変更 Windows2573081
Ref: whatsnew/2 7 port-specific-changes-windows2573253
Ref: 15762573253
Ref: ポート特有の変更 Windows-Footnote-12575083
Ref: ポート特有の変更 Windows-Footnote-22575147
Ref: ポート特有の変更 Windows-Footnote-32575211
Ref: ポート特有の変更 Windows-Footnote-42575275
Ref: ポート特有の変更 Windows-Footnote-52575342
Ref: ポート特有の変更 Windows-Footnote-62575406
Node: ポート特有の変更 Mac OS X2575470
Ref: whatsnew/2 7 port-specific-changes-mac-os-x2575662
Ref: 15822575662
Ref: ポート特有の変更 Mac OS X-Footnote-12576724
Ref: ポート特有の変更 Mac OS X-Footnote-22576788
Node: ポート特有の変更 FreeBSD2576853
Ref: whatsnew/2 7 port-specific-changes-freebsd2577004
Ref: 15832577004
Ref: ポート特有の変更 FreeBSD-Footnote-12577405
Node: その他の変更と修正2577469
Ref: whatsnew/2 7 other-changes-and-fixes2577638
Ref: 15842577638
Ref: その他の変更と修正-Footnote-12580293
Ref: その他の変更と修正-Footnote-22580357
Ref: その他の変更と修正-Footnote-32580424
Ref: その他の変更と修正-Footnote-42580488
Ref: その他の変更と修正-Footnote-52580552
Node: Python 2 7 への移植2580616
Ref: whatsnew/2 7 porting-to-python-2-72580813
Ref: 15862580813
Ref: Python 2 7 への移植-Footnote-12586881
Ref: Python 2 7 への移植-Footnote-22586945
Ref: Python 2 7 への移植-Footnote-32587009
Ref: Python 2 7 への移植-Footnote-42587073
Ref: Python 2 7 への移植-Footnote-52587137
Ref: Python 2 7 への移植-Footnote-62587201
Ref: Python 2 7 への移植-Footnote-72587265
Ref: Python 2 7 への移植-Footnote-82587329
Ref: Python 2 7 への移植-Footnote-92587393
Ref: Python 2 7 への移植-Footnote-102587457
Ref: Python 2 7 への移植-Footnote-112587522
Ref: Python 2 7 への移植-Footnote-122587587
Ref: Python 2 7 への移植-Footnote-132587652
Ref: Python 2 7 への移植-Footnote-142587712
Node: Python 2 7 メンテナンスリリースで追加された新機能2587777
Ref: whatsnew/2 7 new-features-added-to-python-2-7-maintenance-releases2587953
Ref: 15872587953
Ref: whatsnew/2 7 py27-maintenance-enhancements2587953
Ref: 14fe2587953
Node: デバッグモード用の2つの新しい環境変数2589801
Ref: whatsnew/2 7 two-new-environment-variables-for-debug-mode2590055
Ref: 15882590055
Ref: デバッグモード用の2つの新しい環境変数-Footnote-12590740
Ref: デバッグモード用の2つの新しい環境変数-Footnote-22590805
Node: PEP 434 IDLE 拡張についての全てのブランチにおける例外的な扱い2590870
Ref: whatsnew/2 7 pep-434-idle-enhancement-exception-for-all-branches2591206
Ref: 15892591206
Ref: PEP 434 IDLE 拡張についての全てのブランチにおける例外的な扱い-Footnote-12591901
Node: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張2591943
Ref: whatsnew/2 7 pep-466-network-security-enhancements-for-python-2-72592286
Ref: 158a2592286
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-12595124
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-22595166
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-32595208
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-42595273
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-52595338
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-62595380
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-72595445
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-82595510
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-92595565
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-102595607
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-112595673
Ref: PEP 466 Python 2 7 のためのネットワークセキュリティ拡張-Footnote-122595739
Node: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート2595805
Ref: whatsnew/2 7 pep-477-backport-ensurepip-pep-453-to-python-2-72596167
Ref: 158d2596167
Ref: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート-Footnote-12596822
Ref: PEP 477 Python 2 7 への ensurepip PEP 453 バックポート-Footnote-22596864
Node: デフォルトでの pip のブートストラッピング<2>2596906
Ref: whatsnew/2 7 bootstrapping-pip-by-default2597106
Ref: 158e2597106
Ref: デフォルトでの pip のブートストラッピング<2>-Footnote-12599185
Ref: デフォルトでの pip のブートストラッピング<2>-Footnote-22599227
Node: ドキュメントの変更<2>2599317
Ref: whatsnew/2 7 documentation-changes2599517
Ref: 158f2599517
Ref: ドキュメントの変更<2>-Footnote-12600673
Ref: ドキュメントの変更<2>-Footnote-22600710
Node: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化<2>2600752
Ref: whatsnew/2 7 pep-476-enabling-certificate-verification-by-default-for-stdlib-http-clients2601098
Ref: 15902601098
Ref: PEP 476 stdlib http クライアントが証明書の検証を行うのをデフォルトで有効化<2>-Footnote-12602250
Node: PEP 493 HTTPS verification migration tools for Python 2 72602292
Ref: whatsnew/2 7 pep-493-https-verification-migration-tools-for-python-2-72602610
Ref: 15912602610
Ref: PEP 493 HTTPS verification migration tools for Python 2 7-Footnote-12603768
Node: New make regen-all build target<3>2603810
Ref: whatsnew/2 7 new-make-regen-all-build-target2604061
Ref: 15922604061
Ref: New make regen-all build target<3>-Footnote-12604853
Ref: New make regen-all build target<3>-Footnote-22604921
Node: Removal of make touch build target<3>2604986
Ref: whatsnew/2 7 removal-of-make-touch-build-target2605171
Ref: 15932605171
Ref: Removal of make touch build target<3>-Footnote-12605613
Node: 謝辞2605678
Ref: whatsnew/2 7 acknowledgements2605822
Ref: 15942605822
Ref: whatsnew/2 7 acks272605822
Ref: 15952605822
Node: What's New in Python 2 62606114
Ref: whatsnew/2 6 doc2606261
Ref: 15962606261
Ref: whatsnew/2 6 translation-repo2606261
Ref: 15972606261
Ref: whatsnew/2 6 what-s-new-in-python-2-62606261
Ref: 15982606261
Ref: whatsnew/2 6 whats-new-in-2-62606261
Ref: 14c52606261
Ref: What's New in Python 2 6-Footnote-12609788
Node: Python 3 02609830
Ref: whatsnew/2 6 python-3-02609946
Ref: 15992609946
Ref: Python 3 0-Footnote-12612317
Ref: Python 3 0-Footnote-22612359
Node: 開発プロセスに関する変更2612401
Ref: whatsnew/2 6 changes-to-the-development-process2612562
Ref: 159a2612562
Node: 新しい課題トラッカー Roundup2613256
Ref: whatsnew/2 6 new-issue-tracker-roundup2613473
Ref: 159b2613473
Ref: 新しい課題トラッカー Roundup-Footnote-12615907
Ref: 新しい課題トラッカー Roundup-Footnote-22615956
Ref: 新しい課題トラッカー Roundup-Footnote-32615987
Ref: 新しい課題トラッカー Roundup-Footnote-42616027
Ref: 新しい課題トラッカー Roundup-Footnote-52616062
Node: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText2616100
Ref: whatsnew/2 6 new-documentation-format-restructuredtext-using-sphinx2616317
Ref: 159c2616317
Ref: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText-Footnote-12619488
Ref: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText-Footnote-22619547
Ref: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText-Footnote-32619596
Ref: 新しいドキュメンテーションフォーマット Sphinx を使っての reStructuredText-Footnote-42619632
Node: PEP 343 "with" ステートメント2619672
Ref: whatsnew/2 6 pep-03432619894
Ref: 14c62619894
Ref: whatsnew/2 6 pep-343-the-with-statement2619894
Ref: 159d2619894
Node: コンテキストマネージャを書く2623620
Ref: whatsnew/2 6 new-26-context-managers2623770
Ref: 14c72623770
Ref: whatsnew/2 6 writing-context-managers2623770
Ref: 159f2623770
Node: contextlib モジュール2629001
Ref: whatsnew/2 6 new-module-contextlib2629151
Ref: 14c82629151
Ref: whatsnew/2 6 the-contextlib-module2629151
Ref: 15a02629151
Ref: contextlib モジュール-Footnote-12632016
Node: PEP 366 メインモジュールからの明示的相対インポート2632058
Ref: whatsnew/2 6 pep-03662632303
Ref: 14c92632303
Ref: whatsnew/2 6 pep-366-explicit-relative-imports-from-a-main-module2632303
Ref: 15a22632303
Node: PEP 370 ユーザごとの site-packages ディレクトリ2633152
Ref: whatsnew/2 6 pep-03702633400
Ref: 14ca2633400
Ref: whatsnew/2 6 pep-370-per-user-site-packages-directory2633400
Ref: 15a42633400
Ref: PEP 370 ユーザごとの site-packages ディレクトリ-Footnote-12635046
Node: PEP 371 multiprocessing パッケージ2635088
Ref: whatsnew/2 6 pep-03712635319
Ref: 14cb2635319
Ref: whatsnew/2 6 pep-371-the-multiprocessing-package2635319
Ref: 15a82635319
Ref: PEP 371 multiprocessing パッケージ-Footnote-12640799
Node: PEP 3101 進化版文字列フォーマッティング2640841
Ref: whatsnew/2 6 pep-31012641046
Ref: 14cc2641046
Ref: whatsnew/2 6 pep-3101-advanced-string-formatting2641046
Ref: 15b22641046
Ref: PEP 3101 進化版文字列フォーマッティング-Footnote-12647159
Node: PEP 3105 print を関数にする2647201
Ref: whatsnew/2 6 pep-31052647397
Ref: 14cd2647397
Ref: whatsnew/2 6 pep-3105-print-as-a-function2647397
Ref: 15b42647397
Ref: PEP 3105 print を関数にする-Footnote-12648688
Node: PEP 3110 例外処理の変更2648730
Ref: whatsnew/2 6 pep-31102648902
Ref: 14ce2648902
Ref: whatsnew/2 6 pep-3110-exception-handling-changes2648902
Ref: 15b52648902
Ref: PEP 3110 例外処理の変更-Footnote-12650768
Node: PEP 3112 バイトリテラル2650810
Ref: whatsnew/2 6 pep-31122650987
Ref: 14cf2650987
Ref: whatsnew/2 6 pep-3112-byte-literals2650987
Ref: 15b62650987
Ref: PEP 3112 バイトリテラル-Footnote-12654572
Node: PEP 3116 新しい I/O ライブラリ2654614
Ref: whatsnew/2 6 pep-31162654806
Ref: 14d02654806
Ref: whatsnew/2 6 pep-3116-new-i-o-library2654806
Ref: 15c42654806
Ref: PEP 3116 新しい I/O ライブラリ-Footnote-12658890
Node: PEP 3118 改訂版バッファプロトコル2658932
Ref: whatsnew/2 6 pep-31182659124
Ref: 14d12659124
Ref: whatsnew/2 6 pep-3118-revised-buffer-protocol2659124
Ref: 15ce2659124
Ref: PEP 3118 改訂版バッファプロトコル-Footnote-12661675
Node: PEP 3119 抽象基底クラス2661717
Ref: whatsnew/2 6 pep-31192661922
Ref: 14d22661922
Ref: whatsnew/2 6 pep-3119-abstract-base-classes2661922
Ref: 15d22661922
Ref: PEP 3119 抽象基底クラス-Footnote-12667747
Node: PEP 3127 整数リテラルのサポートと文法2667789
Ref: whatsnew/2 6 pep-31272667982
Ref: 14d32667982
Ref: whatsnew/2 6 pep-3127-integer-literal-support-and-syntax2667982
Ref: 15d42667982
Ref: PEP 3127 整数リテラルのサポートと文法-Footnote-12669586
Node: PEP 3129 クラスデコレータ2669628
Ref: whatsnew/2 6 pep-31292669818
Ref: 14d42669818
Ref: whatsnew/2 6 pep-3129-class-decorators2669818
Ref: 15d52669818
Ref: PEP 3129 クラスデコレータ-Footnote-12670292
Node: PEP 3141 数値の型階層2670334
Ref: whatsnew/2 6 pep-31412670501
Ref: 14d52670501
Ref: whatsnew/2 6 pep-3141-a-type-hierarchy-for-numbers2670501
Ref: 15d62670501
Ref: PEP 3141 数値の型階層-Footnote-12673046
Ref: PEP 3141 数値の型階層-Footnote-22673088
Ref: PEP 3141 数値の型階層-Footnote-32673186
Node: fractions モジュール2673292
Ref: whatsnew/2 6 the-fractions-module2673381
Ref: 15da2673381
Node: その他の言語変更<15>2675128
Ref: whatsnew/2 6 other-language-changes2675322
Ref: 15db2675322
Ref: その他の言語変更<15>-Footnote-12685560
Ref: その他の言語変更<15>-Footnote-22685627
Ref: その他の言語変更<15>-Footnote-32685691
Ref: その他の言語変更<15>-Footnote-42685758
Ref: その他の言語変更<15>-Footnote-52685822
Ref: その他の言語変更<15>-Footnote-62685886
Ref: その他の言語変更<15>-Footnote-72685950
Ref: その他の言語変更<15>-Footnote-82686014
Ref: その他の言語変更<15>-Footnote-92686078
Ref: その他の言語変更<15>-Footnote-102686142
Ref: その他の言語変更<15>-Footnote-112686207
Ref: その他の言語変更<15>-Footnote-122686272
Ref: その他の言語変更<15>-Footnote-132686340
Ref: その他の言語変更<15>-Footnote-142686408
Ref: その他の言語変更<15>-Footnote-152686476
Ref: その他の言語変更<15>-Footnote-162686544
Node: 最適化<15>2686612
Ref: whatsnew/2 6 optimizations2686729
Ref: 15e32686729
Ref: 最適化<15>-Footnote-12690573
Ref: 最適化<15>-Footnote-22690640
Ref: 最適化<15>-Footnote-32690707
Ref: 最適化<15>-Footnote-42690771
Node: インタプリタの変更<2>2690835
Ref: whatsnew/2 6 interpreter-changes2690952
Ref: 15e42690952
Ref: whatsnew/2 6 new-26-interpreter2690952
Ref: 15e52690952
Node: 新しいモジュールと改良されたモジュール<2>2692774
Ref: whatsnew/2 6 new-and-improved-modules2692959
Ref: 15e82692959
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-12746626
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-22746693
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-32746746
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-42746810
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-52746876
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-62746940
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-72747007
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-82747071
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-92747125
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-102747192
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-112747260
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-122747328
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-132747393
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-142747458
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-152747525
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-162747590
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-172747658
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-182747723
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-192747791
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-202747859
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-212747927
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-222747994
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-232748062
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-242748130
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-252748195
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-262748260
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-272748328
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-282748396
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-292748463
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-302748528
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-312748593
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-322748658
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-332748723
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-342748788
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-352748853
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-362748918
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-372748978
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-382749045
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-392749105
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-402749172
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-412749237
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-422749304
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-432749372
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-442749437
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-452749502
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-462749567
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-472749635
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-482749700
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-492749765
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-502749833
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-512749898
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-522749966
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-532750031
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-542750099
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-552750164
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-562750232
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-572750297
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-582750365
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-592750433
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-602750498
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-612750563
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-622750630
Ref: 新しいモジュールと改良されたモジュール<2>-Footnote-632750698
Node: ast モジュール2750766
Ref: whatsnew/2 6 the-ast-module2750917
Ref: 15fd2750917
Node: The future_builtins module2753903
Ref: whatsnew/2 6 the-future-builtins-module2754119
Ref: 15fe2754119
Node: json モジュール JavaScript オブジェクト記法2755414
Ref: whatsnew/2 6 the-json-module-javascript-object-notation2755669
Ref: 16002755669
Node: plistlib モジュール プロパティリストパーサ2756978
Ref: whatsnew/2 6 the-plistlib-module-a-property-list-parser2757223
Ref: 16012757223
Node: ctypes の強化2758739
Ref: whatsnew/2 6 ctypes-enhancements2758953
Ref: 16022758953
Ref: ctypes の強化-Footnote-12761151
Ref: ctypes の強化-Footnote-22761218
Node: SSL サポートの改善2761282
Ref: whatsnew/2 6 improved-ssl-support2761429
Ref: 16032761429
Ref: SSL サポートの改善-Footnote-12762771
Node: 非推奨と削除2762804
Ref: whatsnew/2 6 deprecations-and-removals2763001
Ref: 16042763001
Ref: 非推奨と削除-Footnote-12764996
Node: ビルドならびに C API の変更<9>2765038
Ref: whatsnew/2 6 build-and-c-api-changes2765198
Ref: 16062765198
Ref: ビルドならびに C API の変更<9>-Footnote-12773849
Ref: ビルドならびに C API の変更<9>-Footnote-22773904
Ref: ビルドならびに C API の変更<9>-Footnote-32773959
Ref: ビルドならびに C API の変更<9>-Footnote-42774023
Ref: ビルドならびに C API の変更<9>-Footnote-52774090
Ref: ビルドならびに C API の変更<9>-Footnote-62774154
Ref: ビルドならびに C API の変更<9>-Footnote-72774218
Node: ポート特有の変更 Windows<2>2774285
Ref: whatsnew/2 6 port-specific-changes-windows2774442
Ref: 160d2774442
Ref: ポート特有の変更 Windows<2>-Footnote-12777063
Ref: ポート特有の変更 Windows<2>-Footnote-22777129
Ref: ポート特有の変更 Windows<2>-Footnote-32777196
Node: ポート特有の変更 Mac OS X<2>2777260
Ref: whatsnew/2 6 port-specific-changes-mac-os-x2777455
Ref: 16122777455
Ref: ポート特有の変更 Mac OS X<2>-Footnote-12778773
Node: ポート特有の変更 IRIX2778840
Ref: whatsnew/2 6 port-specific-changes-irix2778991
Ref: 16132778991
Node: Python 2 6 への移植2779508
Ref: whatsnew/2 6 porting-to-python-2-62779659
Ref: 16142779659
Ref: Python 2 6 への移植-Footnote-12784448
Ref: Python 2 6 への移植-Footnote-22784515
Ref: Python 2 6 への移植-Footnote-32784582
Node: 謝辞<2>2784649
Ref: whatsnew/2 6 acknowledgements2784751
Ref: 16162784751
Ref: whatsnew/2 6 acks2784751
Ref: 16172784751
Node: What's New in Python 2 52785061
Ref: whatsnew/2 5 doc2785208
Ref: 16182785208
Ref: whatsnew/2 5 translation-repo2785208
Ref: 16192785208
Ref: whatsnew/2 5 what-s-new-in-python-2-52785208
Ref: 161a2785208
Ref: What's New in Python 2 5-Footnote-12789710
Node: PEP 308 条件式 Conditional Expressions2789752
Ref: whatsnew/2 5 pep-3082789892
Ref: 161b2789892
Ref: whatsnew/2 5 pep-308-conditional-expressions2789892
Ref: 16202789892
Ref: PEP 308 条件式 Conditional Expressions-Footnote-12793947
Ref: PEP 308 条件式 Conditional Expressions-Footnote-22793989
Node: PEP 309 関数の部分適用2794031
Ref: whatsnew/2 5 pep-3092794230
Ref: 16212794230
Ref: whatsnew/2 5 pep-309-partial-function-application2794230
Ref: 16222794230
Ref: PEP 309 関数の部分適用-Footnote-12798166
Node: PEP 314 Metadata for Python Software Packages v1 12798208
Ref: whatsnew/2 5 pep-3142798419
Ref: 16232798419
Ref: whatsnew/2 5 pep-314-metadata-for-python-software-packages-v1-12798419
Ref: 16242798419
Ref: PEP 314 Metadata for Python Software Packages v1 1-Footnote-12800684
Node: PEP 328 絶対インポート、相対インポート2800726
Ref: whatsnew/2 5 pep-3282800972
Ref: 161e2800972
Ref: whatsnew/2 5 pep-328-absolute-and-relative-imports2800972
Ref: 16252800972
Ref: PEP 328 絶対インポート、相対インポート-Footnote-12806273
Ref: PEP 328 絶対インポート、相対インポート-Footnote-22806315
Node: PEP 338 - モジュールをスクリプトとして実行する2806357
Ref: whatsnew/2 5 pep-3382806592
Ref: 16262806592
Ref: whatsnew/2 5 pep-338-executing-modules-as-scripts2806592
Ref: 16272806592
Ref: PEP 338 - モジュールをスクリプトとして実行する-Footnote-12807783
Node: PEP 341 try/except/finally の一体化2807825
Ref: whatsnew/2 5 pep-3412808045
Ref: 161f2808045
Ref: whatsnew/2 5 pep-341-unified-try-except-finally2808045
Ref: 16282808045
Ref: PEP 341 try/except/finally の一体化-Footnote-12810183
Node: PEP 342 ジェネレータの新機能2810225
Ref: whatsnew/2 5 pep-3422810420
Ref: 161d2810420
Ref: whatsnew/2 5 pep-342-new-generator-features2810420
Ref: 16292810420
Ref: PEP 342 ジェネレータの新機能-Footnote-12818007
Ref: PEP 342 ジェネレータの新機能-Footnote-22818049
Ref: PEP 342 ジェネレータの新機能-Footnote-32818091
Ref: PEP 342 ジェネレータの新機能-Footnote-42818133
Ref: PEP 342 ジェネレータの新機能-Footnote-52818175
Node: PEP 343 "with" ステートメント<2>2818217
Ref: whatsnew/2 5 pep-3432818417
Ref: 161c2818417
Ref: whatsnew/2 5 pep-343-the-with-statement2818417
Ref: 162a2818417
Node: コンテキストマネージャを書く<2>2822006
Ref: whatsnew/2 5 new-25-context-managers2822165
Ref: 162b2822165
Ref: whatsnew/2 5 writing-context-managers2822165
Ref: 162c2822165
Node: contextlib モジュール<2>2827681
Ref: whatsnew/2 5 contextlibmod2827840
Ref: 162d2827840
Ref: whatsnew/2 5 the-contextlib-module2827840
Ref: 162e2827840
Ref: contextlib モジュール<2>-Footnote-12830772
Node: PEP 352 例外の新スタイルクラス化2830814
Ref: whatsnew/2 5 pep-3522831017
Ref: 162f2831017
Ref: whatsnew/2 5 pep-352-exceptions-as-new-style-classes2831017
Ref: 16302831017
Ref: PEP 352 例外の新スタイルクラス化-Footnote-12834878
Node: PEP 353 添え字型に ssize_t を使う2834920
Ref: whatsnew/2 5 pep-3532835116
Ref: 16312835116
Ref: whatsnew/2 5 pep-353-using-ssize-t-as-the-index-type2835116
Ref: 16322835116
Ref: PEP 353 添え字型に ssize_t を使う-Footnote-12838628
Ref: PEP 353 添え字型に ssize_t を使う-Footnote-22838670
Node: PEP 357 '__index__' メソッド2838712
Ref: whatsnew/2 5 pep-3572838892
Ref: 16342838892
Ref: whatsnew/2 5 pep-357-the-index-method2838892
Ref: 16352838892
Ref: PEP 357 '__index__' メソッド-Footnote-12840924
Node: その他の言語変更<16>2840966
Ref: whatsnew/2 5 other-lang2841195
Ref: 16382841195
Ref: whatsnew/2 5 other-language-changes2841195
Ref: 16392841195
Ref: その他の言語変更<16>-Footnote-12850536
Node: 対話的なインタプリタの変更2850578
Ref: whatsnew/2 5 interactive2850704
Ref: 163f2850704
Ref: whatsnew/2 5 interactive-interpreter-changes2850704
Ref: 16402850704
Node: 最適化<16>2851777
Ref: whatsnew/2 5 optimizations2851903
Ref: 16422851903
Ref: whatsnew/2 5 opts2851903
Ref: 16432851903
Node: 新たなモジュール、改良されたモジュール、削除されたモジュール2856240
Ref: whatsnew/2 5 modules2856478
Ref: 16442856478
Ref: whatsnew/2 5 new-improved-and-removed-modules2856478
Ref: 16452856478
Ref: 新たなモジュール、改良されたモジュール、削除されたモジュール-Footnote-12886444
Ref: 新たなモジュール、改良されたモジュール、削除されたモジュール-Footnote-22886486
Ref: 新たなモジュール、改良されたモジュール、削除されたモジュール-Footnote-32886545
Node: ctypes パッケージ2886604
Ref: whatsnew/2 5 module-ctypes2886789
Ref: 164f2886789
Ref: whatsnew/2 5 the-ctypes-package2886789
Ref: 16502886789
Node: ElementTree パッケージ2890451
Ref: whatsnew/2 5 module-etree2890668
Ref: 16512890668
Ref: whatsnew/2 5 the-elementtree-package2890668
Ref: 16522890668
Node: hashlib パッケージ2896705
Ref: whatsnew/2 5 module-hashlib2896923
Ref: 16532896923
Ref: whatsnew/2 5 the-hashlib-package2896923
Ref: 16542896923
Node: sqlite3 パッケージ2898661
Ref: whatsnew/2 5 module-sqlite2898875
Ref: 16552898875
Ref: whatsnew/2 5 the-sqlite3-package2898875
Ref: 16562898875
Ref: sqlite3 パッケージ-Footnote-12903943
Ref: sqlite3 パッケージ-Footnote-22903985
Node: wsgiref パッケージ2904027
Ref: whatsnew/2 5 module-wsgiref2904209
Ref: 16572904209
Ref: whatsnew/2 5 the-wsgiref-package2904209
Ref: 16582904209
Ref: wsgiref パッケージ-Footnote-12905343
Ref: wsgiref パッケージ-Footnote-22905385
Node: ビルドならびに C API の変更<10>2905427
Ref: whatsnew/2 5 build-and-c-api-changes2905660
Ref: 16592905660
Ref: whatsnew/2 5 build-api2905660
Ref: 165a2905660
Ref: ビルドならびに C API の変更<10>-Footnote-12912966
Ref: ビルドならびに C API の変更<10>-Footnote-22913008
Ref: ビルドならびに C API の変更<10>-Footnote-32913050
Node: ポート特有の変更2913092
Ref: whatsnew/2 5 port-specific-changes2913194
Ref: 16662913194
Ref: whatsnew/2 5 ports2913194
Ref: 16672913194
Ref: ポート特有の変更-Footnote-12913965
Node: Python 2 5 への移植2914029
Ref: whatsnew/2 5 porting2914181
Ref: 16682914181
Ref: whatsnew/2 5 porting-to-python-2-52914181
Ref: 16692914181
Ref: Python 2 5 への移植-Footnote-12917473
Node: 謝辞<3>2917515
Ref: whatsnew/2 5 acknowledgements2917617
Ref: 166a2917617
Node: What's New in Python 2 42918089
Ref: whatsnew/2 4 doc2918236
Ref: 166b2918236
Ref: whatsnew/2 4 translation-repo2918236
Ref: 166c2918236
Ref: whatsnew/2 4 what-s-new-in-python-2-42918236
Ref: 166d2918236
Node: PEP 218 ビルトインの集合オブジェクト2920922
Ref: whatsnew/2 4 pep-218-built-in-set-objects2921092
Ref: 166e2921092
Ref: PEP 218 ビルトインの集合オブジェクト-Footnote-12923734
Node: PEP 237 長整数と整数を一体化していく2923776
Ref: whatsnew/2 4 pep-237-unifying-long-integers-and-integers2923984
Ref: 166f2923984
Ref: PEP 237 長整数と整数を一体化していく-Footnote-12925277
Node: PEP 289 ジェネレータ式2925319
Ref: whatsnew/2 4 pep-289-generator-expressions2925535
Ref: 16702925535
Ref: PEP 289 ジェネレータ式-Footnote-12928276
Node: PEP 292 より単純な文字列置換 string substitution2928318
Ref: whatsnew/2 4 pep-292-simpler-string-substitutions2928540
Ref: 16712928540
Ref: PEP 292 より単純な文字列置換 string substitution-Footnote-12930883
Node: PEP 318 関数とメソッドのためのデコレータ2930925
Ref: whatsnew/2 4 pep-318-decorators-for-functions-and-methods2931156
Ref: 16722931156
Ref: PEP 318 関数とメソッドのためのデコレータ-Footnote-12936858
Ref: PEP 318 関数とメソッドのためのデコレータ-Footnote-22936900
Node: PEP 322 逆順のイテレーション2936942
Ref: whatsnew/2 4 pep-322-reverse-iteration2937159
Ref: 16742937159
Ref: PEP 322 逆順のイテレーション-Footnote-12938310
Node: PEP 324 新しい subprocess モジュール2938352
Ref: whatsnew/2 4 pep-324-new-subprocess-module2938541
Ref: 16752938541
Ref: PEP 324 新しい subprocess モジュール-Footnote-12942984
Node: PEP 327 Decimal データ型2943026
Ref: whatsnew/2 4 pep-327-decimal-data-type2943218
Ref: 16772943218
Node: なぜ Decimal が必要なのか?2943792
Ref: whatsnew/2 4 why-is-decimal-needed2943911
Ref: 16782943911
Node: Decimal 型2946781
Ref: whatsnew/2 4 the-decimal-type2946920
Ref: 16792946920
Node: Context 型2950421
Ref: whatsnew/2 4 the-context-type2950517
Ref: 167a2950517
Ref: Context 型-Footnote-12953763
Ref: Context 型-Footnote-22953805
Node: PEP 328 マルチラインインポート2953888
Ref: whatsnew/2 4 pep-328-multi-line-imports2954089
Ref: 167b2954089
Ref: PEP 328 マルチラインインポート-Footnote-12955904
Node: PEP 331 Locale に依存しない Float/String 変換2955946
Ref: whatsnew/2 4 pep-331-locale-independent-float-string-conversions2956147
Ref: 167c2956147
Ref: PEP 331 Locale に依存しない Float/String 変換-Footnote-12958065
Ref: PEP 331 Locale に依存しない Float/String 変換-Footnote-22958155
Node: その他の言語変更<17>2958197
Ref: whatsnew/2 4 other-language-changes2958447
Ref: 167d2958447
Ref: その他の言語変更<17>-Footnote-12966553
Ref: その他の言語変更<17>-Footnote-22966595
Ref: その他の言語変更<17>-Footnote-32966637
Ref: その他の言語変更<17>-Footnote-42966679
Ref: その他の言語変更<17>-Footnote-52966721
Ref: その他の言語変更<17>-Footnote-62966763
Node: 最適化<17>2966805
Ref: whatsnew/2 4 optimizations2966883
Ref: 167f2966883
Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール<3>2969619
Ref: whatsnew/2 4 new-improved-and-deprecated-modules2969857
Ref: 16802969857
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<3>-Footnote-12990560
Node: cookielib2990619
Ref: whatsnew/2 4 cookielib2990774
Ref: 16842990774
Node: doctest<5>2991862
Ref: whatsnew/2 4 doctest2992017
Ref: 16852992017
Node: ビルドならびに C API の変更<11>2995157
Ref: whatsnew/2 4 build-and-c-api-changes2995390
Ref: 168b2995390
Node: ポート特有の変更<2>2998133
Ref: whatsnew/2 4 port-specific-changes2998238
Ref: 16922998238
Node: Python 2 4 への移植2998414
Ref: whatsnew/2 4 porting-to-python-2-42998566
Ref: 16932998566
Node: 謝辞<4>3000978
Ref: whatsnew/2 4 acknowledgements3001080
Ref: 16953001080
Ref: whatsnew/2 4 acks3001080
Ref: 16963001080
Node: What's New in Python 2 33001381
Ref: whatsnew/2 3 doc3001528
Ref: 16973001528
Ref: whatsnew/2 3 translation-repo3001528
Ref: 16983001528
Ref: whatsnew/2 3 what-s-new-in-python-2-33001528
Ref: 16993001528
Node: PEP 218 標準の集合データ型3005532
Ref: whatsnew/2 3 pep-218-a-standard-set-datatype3005672
Ref: 169b3005672
Ref: PEP 218 標準の集合データ型-Footnote-13009205
Node: PEP 255 単純なジェネレータ3009247
Ref: whatsnew/2 3 pep-255-simple-generators3009449
Ref: 16a03009449
Ref: whatsnew/2 3 section-generators3009449
Ref: 16a13009449
Ref: PEP 255 単純なジェネレータ-Footnote-13018869
Ref: PEP 255 単純なジェネレータ-Footnote-23018911
Node: PEP 263 ソースコードのエンコーディング3018953
Ref: whatsnew/2 3 pep-263-source-code-encodings3019192
Ref: 16a23019192
Ref: whatsnew/2 3 section-encodings3019192
Ref: 16a33019192
Ref: PEP 263 ソースコードのエンコーディング-Footnote-13020857
Node: PEP 273 Zip アーカイブからモジュールをインポートする3020899
Ref: whatsnew/2 3 pep-273-importing-modules-from-zip-archives3021164
Ref: 16a43021164
Ref: PEP 273 Zip アーカイブからモジュールをインポートする-Footnote-13023614
Ref: PEP 273 Zip アーカイブからモジュールをインポートする-Footnote-23023656
Ref: PEP 273 Zip アーカイブからモジュールをインポートする-Footnote-33023698
Node: PEP 277 Windows NT での Unicode ファイル名サポート3023740
Ref: whatsnew/2 3 pep-277-unicode-file-name-support-for-windows-nt3023990
Ref: 16a63023990
Ref: PEP 277 Windows NT での Unicode ファイル名サポート-Footnote-13026036
Node: PEP 278 Universal Newline サポート3026078
Ref: whatsnew/2 3 pep-278-universal-newline-support3026273
Ref: 16a83026273
Ref: PEP 278 Universal Newline サポート-Footnote-13028155
Node: PEP 279 enumerate3028197
Ref: whatsnew/2 3 pep-279-enumerate3028366
Ref: 16a93028366
Ref: whatsnew/2 3 section-enumerate3028366
Ref: 16aa3028366
Ref: PEP 279 enumerate-Footnote-13029334
Node: PEP 282 ロギングパッケージ3029376
Ref: whatsnew/2 3 pep-282-the-logging-package3029526
Ref: 16ab3029526
Ref: PEP 282 ロギングパッケージ-Footnote-13034993
Ref: PEP 282 ロギングパッケージ-Footnote-23035035
Node: PEP 285 Boolean 型3035077
Ref: whatsnew/2 3 pep-285-a-boolean-type3035275
Ref: 16b13035275
Ref: whatsnew/2 3 section-bool3035275
Ref: 16b23035275
Ref: PEP 285 Boolean 型-Footnote-13038236
Ref: PEP 285 Boolean 型-Footnote-23038278
Node: PEP 293 コーデックエラーを処理するコールバック3038320
Ref: whatsnew/2 3 pep-293-codec-error-handling-callbacks3038565
Ref: 16b33038565
Ref: PEP 293 コーデックエラーを処理するコールバック-Footnote-13040499
Node: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ3040541
Ref: whatsnew/2 3 pep-301-package-index-and-metadata-for-distutils3040808
Ref: 16b63040808
Ref: whatsnew/2 3 section-pep3013040808
Ref: 16b73040808
Ref: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ-Footnote-13042685
Ref: PEP 301 パッケージインデクスと、 Distutils のためのメタデータ-Footnote-23042721
Node: PEP 302 新たなインポートフック3042763
Ref: whatsnew/2 3 pep-302-new-import-hooks3043009
Ref: 16b83043009
Ref: whatsnew/2 3 section-pep3023043009
Ref: 16a53043009
Ref: PEP 302 新たなインポートフック-Footnote-13046744
Ref: PEP 302 新たなインポートフック-Footnote-23046786
Ref: PEP 302 新たなインポートフック-Footnote-33046828
Node: PEP 305 カンマ区切り形式ファイル3046870
Ref: whatsnew/2 3 pep-305-comma-separated-files3047064
Ref: 16b93047064
Ref: whatsnew/2 3 section-pep3053047064
Ref: 16ba3047064
Ref: PEP 305 カンマ区切り形式ファイル-Footnote-13048858
Node: PEP 307 Pickle の機能拡張3048900
Ref: whatsnew/2 3 pep-307-pickle-enhancements3049071
Ref: 16bb3049071
Ref: whatsnew/2 3 section-pep3073049071
Ref: 16bc3049071
Ref: PEP 307 Pickle の機能拡張-Footnote-13051376
Ref: PEP 307 Pickle の機能拡張-Footnote-23051418
Ref: PEP 307 Pickle の機能拡張-Footnote-33051460
Node: 拡張スライス3051502
Ref: whatsnew/2 3 extended-slices3051657
Ref: 16bf3051657
Ref: whatsnew/2 3 section-slices3051657
Ref: 16c03051657
Node: その他の言語変更<18>3055715
Ref: whatsnew/2 3 other-language-changes3055930
Ref: 16c13055930
Ref: その他の言語変更<18>-Footnote-13064946
Node: 文字列に関する変更3065019
Ref: whatsnew/2 3 string-changes3065133
Ref: 16c73065133
Node: 最適化<18>3067899
Ref: whatsnew/2 3 optimizations3068013
Ref: 16cc3068013
Node: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>3069464
Ref: whatsnew/2 3 new-improved-and-deprecated-modules3069721
Ref: 16ce3069721
Ref: 新たなモジュール、改良されたモジュール、非推奨のモジュール<4>-Footnote-13097516
Node: 日付時刻型3097556
Ref: whatsnew/2 3 date-time-type3097731
Ref: 16e23097731
Node: optparse モジュール3100680
Ref: whatsnew/2 3 the-optparse-module3100855
Ref: 16e53100855
Node: Pymalloc 特殊化されたオブジェクトアロケータ3103416
Ref: whatsnew/2 3 pymalloc-a-specialized-object-allocator3103686
Ref: 16e83103686
Ref: whatsnew/2 3 section-pymalloc3103686
Ref: 16e93103686
Node: ビルドならびに C API の変更<12>3108792
Ref: whatsnew/2 3 build-and-c-api-changes3109002
Ref: 16eb3109002
Node: ポート特有の変更<3>3113166
Ref: whatsnew/2 3 port-specific-changes3113271
Ref: 16f13113271
Node: その他の変更と修正<2>3114500
Ref: whatsnew/2 3 other-changes-and-fixes3114673
Ref: 16f23114673
Ref: whatsnew/2 3 section-other3114673
Ref: 16cd3114673
Node: Python 2 3 への移植3117782
Ref: whatsnew/2 3 porting-to-python-2-33117923
Ref: 16f53117923
Node: 謝辞<5>3122205
Ref: whatsnew/2 3 acknowledgements3122307
Ref: 16f63122307
Ref: whatsnew/2 3 acks3122307
Ref: 16f73122307
Node: What's New in Python 2 23122896
Ref: whatsnew/2 2 doc3123043
Ref: 16f83123043
Ref: whatsnew/2 2 translation-repo3123043
Ref: 16f93123043
Ref: whatsnew/2 2 what-s-new-in-python-2-23123043
Ref: 16fa3123043
Node: はじめに3123959
Ref: whatsnew/2 2 introduction3124097
Ref: 16fb3124097
Ref: はじめに-Footnote-13125308
Ref: はじめに-Footnote-23125357
Node: PEP 252 と PEP 253 型とクラスについての変更3125406
Ref: whatsnew/2 2 peps-252-and-253-type-and-class-changes3125576
Ref: 16fc3125576
Node: 旧と新クラス3129745
Ref: whatsnew/2 2 old-and-new-classes3129883
Ref: 16ff3129883
Ref: 旧と新クラス-Footnote-13132815
Node: デスクリプタ3132857
Ref: whatsnew/2 2 descriptors3133044
Ref: 17003133044
Node: 多重継承 ダイヤモンドルール3137268
Ref: whatsnew/2 2 multiple-inheritance-the-diamond-rule3137455
Ref: 17023137455
Ref: 多重継承 ダイヤモンドルール-Footnote-13140481
Node: 属性アクセス3140523
Ref: whatsnew/2 2 attribute-access3140707
Ref: 17033140707
Node: 関連リンク3144705
Ref: whatsnew/2 2 related-links3144840
Ref: 17053144840
Ref: whatsnew/2 2 sect-rellinks3144840
Ref: 16fe3144840
Ref: 関連リンク-Footnote-13146807
Ref: 関連リンク-Footnote-23146849
Ref: 関連リンク-Footnote-33146891
Ref: 関連リンク-Footnote-43146933
Ref: 関連リンク-Footnote-53146975
Node: PEP 234 イテレータ3147017
Ref: whatsnew/2 2 pep-234-iterators3147213
Ref: 17073147213
Ref: PEP 234 イテレータ-Footnote-13152624
Node: PEP 255 単純なジェネレータ<2>3152666
Ref: whatsnew/2 2 pep-255-simple-generators3152859
Ref: 170a3152859
Ref: PEP 255 単純なジェネレータ<2>-Footnote-13162160
Ref: PEP 255 単純なジェネレータ<2>-Footnote-23162202
Node: PEP 237 長整数と整数を一体化していく<2>3162244
Ref: whatsnew/2 2 pep-237-unifying-long-integers-and-integers3162458
Ref: 170b3162458
Ref: PEP 237 長整数と整数を一体化していく<2>-Footnote-13164932
Node: PEP 238 除算演算子を変更していく3164974
Ref: whatsnew/2 2 pep-238-changing-the-division-operator3165167
Ref: 170c3165167
Ref: PEP 238 除算演算子を変更していく-Footnote-13169824
Ref: PEP 238 除算演算子を変更していく-Footnote-23169866
Ref: PEP 238 除算演算子を変更していく-Footnote-33169908
Node: Unicode の変更3169950
Ref: whatsnew/2 2 unicode-changes3170125
Ref: 170e3170125
Ref: Unicode の変更-Footnote-13173380
Ref: Unicode の変更-Footnote-23173422
Node: PEP 227 入れ子状のスコープ3173464
Ref: whatsnew/2 2 pep-227-nested-scopes3173655
Ref: 170f3173655
Ref: PEP 227 入れ子状のスコープ-Footnote-13178762
Node: 新しいモジュールと改良されたモジュール<3>3178804
Ref: whatsnew/2 2 new-and-improved-modules3179014
Ref: 17103179014
Ref: 新しいモジュールと改良されたモジュール<3>-Footnote-13186315
Ref: 新しいモジュールと改良されたモジュール<3>-Footnote-23186374
Ref: 新しいモジュールと改良されたモジュール<3>-Footnote-33186433
Ref: 新しいモジュールと改良されたモジュール<3>-Footnote-43186492
Ref: 新しいモジュールと改良されたモジュール<3>-Footnote-53186551
Node: インタプリタの変更と修正3186609
Ref: whatsnew/2 2 interpreter-changes-and-fixes3186814
Ref: 17153186814
Node: その他の変更と修正<3>3192414
Ref: whatsnew/2 2 other-changes-and-fixes3192568
Ref: 17253192568
Ref: その他の変更と修正<3>-Footnote-13200347
Node: 謝辞<6>3200389
Ref: whatsnew/2 2 acknowledgements3200498
Ref: 17283200498
Node: What's New in Python 2 13201065
Ref: whatsnew/2 1 doc3201212
Ref: 17293201212
Ref: whatsnew/2 1 translation-repo3201212
Ref: 172a3201212
Ref: whatsnew/2 1 what-s-new-in-python-2-13201212
Ref: 172b3201212
Node: はじめに<2>3202523
Ref: whatsnew/2 1 introduction3202646
Ref: 172c3202646
Node: PEP 227 入れ子状のスコープ<2>3203836
Ref: whatsnew/2 1 pep-227-nested-scopes3203996
Ref: 172d3203996
Ref: PEP 227 入れ子状のスコープ<2>-Footnote-13209220
Ref: PEP 227 入れ子状のスコープ<2>-Footnote-23209262
Ref: PEP 227 入れ子状のスコープ<2>-Footnote-33209304
Node: PEP 236 __future__ 指示文3209346
Ref: whatsnew/2 1 pep-236-future-directives3209511
Ref: 172e3209511
Ref: PEP 236 __future__ 指示文-Footnote-13211136
Node: PEP 207 拡張比較3211178
Ref: whatsnew/2 1 pep-207-rich-comparisons3211340
Ref: 172f3211340
Ref: PEP 207 拡張比較-Footnote-13214953
Ref: PEP 207 拡張比較-Footnote-23214995
Node: PEP 230 警告フレームワーク3215037
Ref: whatsnew/2 1 pep-230-warning-framework3215209
Ref: 17313215209
Ref: PEP 230 警告フレームワーク-Footnote-13219038
Ref: PEP 230 警告フレームワーク-Footnote-23219080
Node: PEP 229 新しいビルドシステム3219122
Ref: whatsnew/2 1 pep-229-new-build-system3219291
Ref: 17333219291
Ref: PEP 229 新しいビルドシステム-Footnote-13222084
Node: PEP 205 弱参照3222126
Ref: whatsnew/2 1 pep-205-weak-references3222283
Ref: 17343222283
Ref: PEP 205 弱参照-Footnote-13225852
Node: PEP 232 関数の属性3225894
Ref: whatsnew/2 1 pep-232-function-attributes3226117
Ref: 17353226117
Ref: PEP 232 関数の属性-Footnote-13227645
Node: PEP 235 大文字小文字を区別しないプラットフォームでのモジュールの読み込み3227687
Ref: whatsnew/2 1 pep-235-importing-modules-on-case-insensitive-platforms3227932
Ref: 17363227932
Node: PEP 217 対話モード用 Display Hook3229206
Ref: whatsnew/2 1 pep-217-interactive-display-hook3229463
Ref: 17373229463
Ref: PEP 217 対話モード用 Display Hook-Footnote-13230454
Node: PEP 208 新しい型強制モデル3230496
Ref: whatsnew/2 1 pep-208-new-coercion-model3230723
Ref: 17393230723
Ref: PEP 208 新しい型強制モデル-Footnote-13232683
Node: PEP 241 Pythonソフトウェアパッケージのためのメタデータ3232725
Ref: whatsnew/2 1 pep-241-metadata-in-python-packages3232973
Ref: 173a3232973
Ref: PEP 241 Pythonソフトウェアパッケージのためのメタデータ-Footnote-13235810
Ref: PEP 241 Pythonソフトウェアパッケージのためのメタデータ-Footnote-23235852
Ref: PEP 241 Pythonソフトウェアパッケージのためのメタデータ-Footnote-33235894
Ref: PEP 241 Pythonソフトウェアパッケージのためのメタデータ-Footnote-43235936
Node: 新しいモジュールと改良されたモジュール<4>3235978
Ref: whatsnew/2 1 new-and-improved-modules3236221
Ref: 173b3236221
Node: その他の変更と修正<4>3243259
Ref: whatsnew/2 1 other-changes-and-fixes3243437
Ref: 173c3243437
Node: 謝辞<7>3250245
Ref: whatsnew/2 1 acknowledgements3250354
Ref: 17403250354
Node: What's New in Python 2 03250643
Ref: whatsnew/2 0 doc3250778
Ref: 17413250778
Ref: whatsnew/2 0 translation-repo3250778
Ref: 17423250778
Ref: whatsnew/2 0 what-s-new-in-python-2-03250778
Ref: 17433250778
Node: はじめに<3>3251732
Ref: whatsnew/2 0 introduction3251850
Ref: 17443251850
Node: Python 1 6 はいかがですか?3253037
Ref: whatsnew/2 0 what-about-python-1-63253191
Ref: 17453253191
Node: 新しい開発プロセス3254883
Ref: whatsnew/2 0 new-development-process3255045
Ref: 17463255045
Ref: 新しい開発プロセス-Footnote-13261958
Ref: 新しい開発プロセス-Footnote-23262000
Ref: 新しい開発プロセス-Footnote-33262042
Node: Unicode 文字列型<2>3262084
Ref: whatsnew/2 0 unicode3262237
Ref: 17473262237
Ref: Unicode 文字列型<2>-Footnote-13270834
Node: リストの内包表記3270876
Ref: whatsnew/2 0 list-comprehensions3271035
Ref: 17483271035
Node: 累算代入 Augmented Assignment3275463
Ref: whatsnew/2 0 augmented-assignment3275620
Ref: 17493275620
Node: 文字列メソッド3277225
Ref: whatsnew/2 0 string-methods3277403
Ref: 174a3277403
Node: 循環参照のガベージコレクション3279455
Ref: whatsnew/2 0 garbage-collection-of-cycles3279633
Ref: 174b3279633
Node: その他の言語コアの変更3284565
Ref: whatsnew/2 0 other-core-changes3284745
Ref: 174c3284745
Node: 言語のマイナー変更3285099
Ref: whatsnew/2 0 minor-language-changes3285235
Ref: 174d3285235
Node: ビルトイン関数の変更3290819
Ref: whatsnew/2 0 changes-to-built-in-functions3290955
Ref: 17513290955
Node: Python 2 0 への移植3293848
Ref: whatsnew/2 0 porting-to-2-03294025
Ref: 17523294025
Node: 拡張と埋め込みについての変更3300241
Ref: whatsnew/2 0 extending-embedding-changes3300437
Ref: 17543300437
Node: Distutils モジュールの簡単インストール3305925
Ref: whatsnew/2 0 distutils-making-modules-easy-to-install3306117
Ref: 17593306117
Node: XML モジュール3310060
Ref: whatsnew/2 0 xml-modules3310240
Ref: 175a3310240
Node: SAX2 サポート3311155
Ref: whatsnew/2 0 sax2-support3311253
Ref: 175b3311253
Node: DOM サポート3313111
Ref: whatsnew/2 0 dom-support3313236
Ref: 175f3313236
Node: PyXML との関係3316304
Ref: whatsnew/2 0 relationship-to-pyxml3316403
Ref: 17603316403
Node: 更新されたモジュール3317884
Ref: whatsnew/2 0 module-changes3318039
Ref: 17613318039
Node: 新しいモジュール<2>3320753
Ref: whatsnew/2 0 new-modules3320903
Ref: 17623320903
Node: IDLE の改善3325610
Ref: whatsnew/2 0 idle-improvements3325799
Ref: 17633325799
Node: 削除されたモジュール、非推奨となったモジュール3327515
Ref: whatsnew/2 0 deleted-and-deprecated-modules3327686
Ref: 17643327686
Node: 謝辞<8>3328485
Ref: whatsnew/2 0 acknowledgements3328633
Ref: 17653328633
Ref: 謝辞<8>-Footnote-13329266
Ref: 謝辞<8>-Footnote-23329330
Node: 変更履歴3329370
Ref: whatsnew/changelog doc3329472
Ref: 17663329472
Ref: whatsnew/changelog changelog3329472
Ref: 1423329472
Ref: whatsnew/changelog id13329472
Ref: 17673329472
Ref: whatsnew/changelog translation-repo3329472
Ref: 17683329472
Node: Python next3335513
Ref: whatsnew/changelog python-next3335601
Ref: 17693335601
Node: macOS3335787
Ref: whatsnew/changelog macos3335856
Ref: 176a3335856
Ref: macOS-Footnote-13335989
Node: Windows3336045
Ref: whatsnew/changelog windows3336138
Ref: 176b3336138
Ref: Windows-Footnote-13336275
Node: ライブラリ3336331
Ref: whatsnew/changelog library3336440
Ref: 176c3336440
Ref: ライブラリ-Footnote-13337732
Ref: ライブラリ-Footnote-23337788
Ref: ライブラリ-Footnote-33337844
Ref: ライブラリ-Footnote-43337900
Ref: ライブラリ-Footnote-53337956
Ref: ライブラリ-Footnote-63338012
Ref: ライブラリ-Footnote-73338048
Ref: ライブラリ-Footnote-83338104
Ref: ライブラリ-Footnote-93338160
Ref: ライブラリ-Footnote-103338216
Ref: ライブラリ-Footnote-113338272
Node: ドキュメント<2>3338338
Ref: whatsnew/changelog documentation3338457
Ref: 176e3338457
Ref: ドキュメント<2>-Footnote-13338738
Node: Core and Builtins3338794
Ref: whatsnew/changelog core-and-builtins3338889
Ref: 176f3338889
Ref: Core and Builtins-Footnote-13340328
Ref: Core and Builtins-Footnote-23340384
Ref: Core and Builtins-Footnote-33340440
Ref: Core and Builtins-Footnote-43340496
Ref: Core and Builtins-Footnote-53340552
Ref: Core and Builtins-Footnote-63340608
Ref: Core and Builtins-Footnote-73340664
Node: Python 3 14 3 final3340719
Ref: whatsnew/changelog python-3-14-3-final3340835
Ref: 17703340835
Node: Windows<2>3341172
Ref: whatsnew/changelog id23341258
Ref: 17713341258
Ref: Windows<2>-Footnote-13341461
Node: Tools/Demos3341517
Ref: whatsnew/changelog tools-demos3341621
Ref: 17723341621
Ref: Tools/Demos-Footnote-13341840
Node: テスト3341896
Ref: whatsnew/changelog tests3342008
Ref: 17733342008
Ref: テスト-Footnote-13342974
Ref: テスト-Footnote-23343030
Ref: テスト-Footnote-33343086
Ref: テスト-Footnote-43343141
Ref: テスト-Footnote-53343197
Ref: テスト-Footnote-63343253
Node: セキュリティ3343318
Ref: whatsnew/changelog security3343437
Ref: 17743343437
Ref: セキュリティ-Footnote-13344541
Ref: セキュリティ-Footnote-23344597
Ref: セキュリティ-Footnote-33344653
Ref: セキュリティ-Footnote-43344709
Ref: セキュリティ-Footnote-53344765
Ref: セキュリティ-Footnote-63344821
Node: ライブラリ<2>3344877
Ref: whatsnew/changelog id33344994
Ref: 17753344994
Ref: ライブラリ<2>-Footnote-13357239
Ref: ライブラリ<2>-Footnote-23357295
Ref: ライブラリ<2>-Footnote-33357351
Ref: ライブラリ<2>-Footnote-43357407
Ref: ライブラリ<2>-Footnote-53357463
Ref: ライブラリ<2>-Footnote-63357519
Ref: ライブラリ<2>-Footnote-73357575
Ref: ライブラリ<2>-Footnote-83357631
Ref: ライブラリ<2>-Footnote-93357687
Ref: ライブラリ<2>-Footnote-103357743
Ref: ライブラリ<2>-Footnote-113357800
Ref: ライブラリ<2>-Footnote-123357857
Ref: ライブラリ<2>-Footnote-133357913
Ref: ライブラリ<2>-Footnote-143357970
Ref: ライブラリ<2>-Footnote-153358027
Ref: ライブラリ<2>-Footnote-163358084
Ref: ライブラリ<2>-Footnote-173358141
Ref: ライブラリ<2>-Footnote-183358198
Ref: ライブラリ<2>-Footnote-193358255
Ref: ライブラリ<2>-Footnote-203358312
Ref: ライブラリ<2>-Footnote-213358369
Ref: ライブラリ<2>-Footnote-223358426
Ref: ライブラリ<2>-Footnote-233358483
Ref: ライブラリ<2>-Footnote-243358540
Ref: ライブラリ<2>-Footnote-253358597
Ref: ライブラリ<2>-Footnote-263358654
Ref: ライブラリ<2>-Footnote-273358711
Ref: ライブラリ<2>-Footnote-283358768
Ref: ライブラリ<2>-Footnote-293358825
Ref: ライブラリ<2>-Footnote-303358882
Ref: ライブラリ<2>-Footnote-313358939
Ref: ライブラリ<2>-Footnote-323358996
Ref: ライブラリ<2>-Footnote-333359053
Ref: ライブラリ<2>-Footnote-343359110
Ref: ライブラリ<2>-Footnote-353359167
Ref: ライブラリ<2>-Footnote-363359224
Ref: ライブラリ<2>-Footnote-373359281
Ref: ライブラリ<2>-Footnote-383359338
Ref: ライブラリ<2>-Footnote-393359395
Ref: ライブラリ<2>-Footnote-403359452
Ref: ライブラリ<2>-Footnote-413359509
Ref: ライブラリ<2>-Footnote-423359566
Ref: ライブラリ<2>-Footnote-433359623
Ref: ライブラリ<2>-Footnote-443359680
Ref: ライブラリ<2>-Footnote-453359737
Ref: ライブラリ<2>-Footnote-463359794
Ref: ライブラリ<2>-Footnote-473359851
Ref: ライブラリ<2>-Footnote-483359908
Ref: ライブラリ<2>-Footnote-493359965
Ref: ライブラリ<2>-Footnote-503360022
Ref: ライブラリ<2>-Footnote-513360079
Ref: ライブラリ<2>-Footnote-523360136
Ref: ライブラリ<2>-Footnote-533360193
Ref: ライブラリ<2>-Footnote-543360250
Ref: ライブラリ<2>-Footnote-553360307
Ref: ライブラリ<2>-Footnote-563360364
Ref: ライブラリ<2>-Footnote-573360420
Ref: ライブラリ<2>-Footnote-583360477
Ref: ライブラリ<2>-Footnote-593360533
Ref: ライブラリ<2>-Footnote-603360590
Ref: ライブラリ<2>-Footnote-613360647
Ref: ライブラリ<2>-Footnote-623360704
Ref: ライブラリ<2>-Footnote-633360761
Ref: ライブラリ<2>-Footnote-643360818
Ref: ライブラリ<2>-Footnote-653360874
Ref: ライブラリ<2>-Footnote-663360931
Ref: ライブラリ<2>-Footnote-673360988
Ref: ライブラリ<2>-Footnote-683361045
Node: IDLE<3>3361102
Ref: whatsnew/changelog idle3361222
Ref: 178b3361222
Ref: IDLE<3>-Footnote-13361371
Node: ドキュメント<3>3361427
Ref: whatsnew/changelog id43361549
Ref: 178c3361549
Ref: ドキュメント<3>-Footnote-13361702
Node: Core and Builtins<2>3361758
Ref: whatsnew/changelog id53361878
Ref: 178e3361878
Ref: Core and Builtins<2>-Footnote-13367327
Ref: Core and Builtins<2>-Footnote-23367383
Ref: Core and Builtins<2>-Footnote-33367439
Ref: Core and Builtins<2>-Footnote-43367495
Ref: Core and Builtins<2>-Footnote-53367551
Ref: Core and Builtins<2>-Footnote-63367607
Ref: Core and Builtins<2>-Footnote-73367663
Ref: Core and Builtins<2>-Footnote-83367719
Ref: Core and Builtins<2>-Footnote-93367775
Ref: Core and Builtins<2>-Footnote-103367831
Ref: Core and Builtins<2>-Footnote-113367888
Ref: Core and Builtins<2>-Footnote-123367945
Ref: Core and Builtins<2>-Footnote-133368002
Ref: Core and Builtins<2>-Footnote-143368059
Ref: Core and Builtins<2>-Footnote-153368116
Ref: Core and Builtins<2>-Footnote-163368173
Ref: Core and Builtins<2>-Footnote-173368230
Ref: Core and Builtins<2>-Footnote-183368287
Ref: Core and Builtins<2>-Footnote-193368344
Ref: Core and Builtins<2>-Footnote-203368401
Ref: Core and Builtins<2>-Footnote-213368458
Ref: Core and Builtins<2>-Footnote-223368515
Ref: Core and Builtins<2>-Footnote-233368572
Ref: Core and Builtins<2>-Footnote-243368629
Ref: Core and Builtins<2>-Footnote-253368686
Ref: Core and Builtins<2>-Footnote-263368743
Ref: Core and Builtins<2>-Footnote-273368800
Ref: Core and Builtins<2>-Footnote-283368857
Ref: Core and Builtins<2>-Footnote-293368914
Ref: Core and Builtins<2>-Footnote-303368970
Ref: Core and Builtins<2>-Footnote-313369027
Node: C API3369084
Ref: whatsnew/changelog c-api3369192
Ref: 179a3369192
Ref: C API-Footnote-13369523
Ref: C API-Footnote-23369579
Node: ビルド3369635
Ref: whatsnew/changelog build3369714
Ref: 179b3369714
Ref: ビルド-Footnote-13370448
Ref: ビルド-Footnote-23370504
Ref: ビルド-Footnote-33370560
Node: Python 3 14 2 final3370616
Ref: whatsnew/changelog python-3-14-2-final3370740
Ref: 179c3370740
Node: セキュリティ<2>3370999
Ref: whatsnew/changelog id63371103
Ref: 179d3371103
Ref: セキュリティ<2>-Footnote-13371694
Ref: セキュリティ<2>-Footnote-23371750
Node: ライブラリ<3>3371806
Ref: whatsnew/changelog id73371939
Ref: 179f3371939
Ref: ライブラリ<3>-Footnote-13373328
Ref: ライブラリ<3>-Footnote-23373384
Ref: ライブラリ<3>-Footnote-33373440
Node: Core and Builtins<3>3373496
Ref: whatsnew/changelog id83373626
Ref: 17a03373626
Ref: Core and Builtins<3>-Footnote-13373863
Node: ライブラリ<4>3373919
Ref: whatsnew/changelog id93374022
Ref: 17a13374022
Ref: ライブラリ<4>-Footnote-13374221
Node: Python 3 14 1 final3374277
Ref: whatsnew/changelog python-3-14-1-final3374401
Ref: 17a23374401
Node: Windows<3>3375305
Ref: whatsnew/changelog id103375394
Ref: 17a33375394
Ref: Windows<3>-Footnote-13375588
Node: Tools/Demos<2>3375644
Ref: whatsnew/changelog id113375754
Ref: 17a43375754
Ref: Tools/Demos<2>-Footnote-13376720
Ref: Tools/Demos<2>-Footnote-23376776
Ref: Tools/Demos<2>-Footnote-33376832
Ref: Tools/Demos<2>-Footnote-43376888
Ref: Tools/Demos<2>-Footnote-53376944
Ref: Tools/Demos<2>-Footnote-63377000
Node: テスト<2>3377056
Ref: whatsnew/changelog id123377177
Ref: 17a53377177
Ref: テスト<2>-Footnote-13377840
Ref: テスト<2>-Footnote-23377896
Ref: テスト<2>-Footnote-33377952
Ref: テスト<2>-Footnote-43378008
Node: セキュリティ<3>3378064
Ref: whatsnew/changelog id133378189
Ref: 17a63378189
Ref: セキュリティ<3>-Footnote-13379906
Ref: セキュリティ<3>-Footnote-23379962
Ref: セキュリティ<3>-Footnote-33380018
Ref: セキュリティ<3>-Footnote-43380074
Ref: セキュリティ<3>-Footnote-53380130
Ref: セキュリティ<3>-Footnote-63380186
Ref: セキュリティ<3>-Footnote-73380242
Node: ライブラリ<5>3380298
Ref: whatsnew/changelog id143380418
Ref: 17a93380418
Ref: ライブラリ<5>-Footnote-13400148
Ref: ライブラリ<5>-Footnote-23400203
Ref: ライブラリ<5>-Footnote-33400258
Ref: ライブラリ<5>-Footnote-43400314
Ref: ライブラリ<5>-Footnote-53400369
Ref: ライブラリ<5>-Footnote-63400425
Ref: ライブラリ<5>-Footnote-73400481
Ref: ライブラリ<5>-Footnote-83400537
Ref: ライブラリ<5>-Footnote-93400593
Ref: ライブラリ<5>-Footnote-103400649
Ref: ライブラリ<5>-Footnote-113400706
Ref: ライブラリ<5>-Footnote-123400763
Ref: ライブラリ<5>-Footnote-133400820
Ref: ライブラリ<5>-Footnote-143400877
Ref: ライブラリ<5>-Footnote-153400934
Ref: ライブラリ<5>-Footnote-163400991
Ref: ライブラリ<5>-Footnote-173401048
Ref: ライブラリ<5>-Footnote-183401105
Ref: ライブラリ<5>-Footnote-193401162
Ref: ライブラリ<5>-Footnote-203401219
Ref: ライブラリ<5>-Footnote-213401276
Ref: ライブラリ<5>-Footnote-223401333
Ref: ライブラリ<5>-Footnote-233401390
Ref: ライブラリ<5>-Footnote-243401447
Ref: ライブラリ<5>-Footnote-253401504
Ref: ライブラリ<5>-Footnote-263401561
Ref: ライブラリ<5>-Footnote-273401618
Ref: ライブラリ<5>-Footnote-283401675
Ref: ライブラリ<5>-Footnote-293401732
Ref: ライブラリ<5>-Footnote-303401789
Ref: ライブラリ<5>-Footnote-313401846
Ref: ライブラリ<5>-Footnote-323401903
Ref: ライブラリ<5>-Footnote-333401960
Ref: ライブラリ<5>-Footnote-343402017
Ref: ライブラリ<5>-Footnote-353402074
Ref: ライブラリ<5>-Footnote-363402131
Ref: ライブラリ<5>-Footnote-373402188
Ref: ライブラリ<5>-Footnote-383402245
Ref: ライブラリ<5>-Footnote-393402302
Ref: ライブラリ<5>-Footnote-403402359
Ref: ライブラリ<5>-Footnote-413402416
Ref: ライブラリ<5>-Footnote-423402473
Ref: ライブラリ<5>-Footnote-433402530
Ref: ライブラリ<5>-Footnote-443402587
Ref: ライブラリ<5>-Footnote-453402644
Ref: ライブラリ<5>-Footnote-463402701
Ref: ライブラリ<5>-Footnote-473402758
Ref: ライブラリ<5>-Footnote-483402815
Ref: ライブラリ<5>-Footnote-493402871
Ref: ライブラリ<5>-Footnote-503402927
Ref: ライブラリ<5>-Footnote-513402984
Ref: ライブラリ<5>-Footnote-523403024
Ref: ライブラリ<5>-Footnote-533403066
Ref: ライブラリ<5>-Footnote-543403123
Ref: ライブラリ<5>-Footnote-553403180
Ref: ライブラリ<5>-Footnote-563403237
Ref: ライブラリ<5>-Footnote-573403293
Ref: ライブラリ<5>-Footnote-583403350
Ref: ライブラリ<5>-Footnote-593403407
Ref: ライブラリ<5>-Footnote-603403464
Ref: ライブラリ<5>-Footnote-613403521
Ref: ライブラリ<5>-Footnote-623403578
Ref: ライブラリ<5>-Footnote-633403635
Ref: ライブラリ<5>-Footnote-643403692
Ref: ライブラリ<5>-Footnote-653403749
Ref: ライブラリ<5>-Footnote-663403806
Ref: ライブラリ<5>-Footnote-673403863
Ref: ライブラリ<5>-Footnote-683403906
Ref: ライブラリ<5>-Footnote-693403963
Ref: ライブラリ<5>-Footnote-703404020
Ref: ライブラリ<5>-Footnote-713404077
Ref: ライブラリ<5>-Footnote-723404134
Ref: ライブラリ<5>-Footnote-733404191
Ref: ライブラリ<5>-Footnote-743404248
Ref: ライブラリ<5>-Footnote-753404304
Ref: ライブラリ<5>-Footnote-763404361
Ref: ライブラリ<5>-Footnote-773404417
Ref: ライブラリ<5>-Footnote-783404474
Ref: ライブラリ<5>-Footnote-793404531
Ref: ライブラリ<5>-Footnote-803404588
Ref: ライブラリ<5>-Footnote-813404644
Ref: ライブラリ<5>-Footnote-823404701
Ref: ライブラリ<5>-Footnote-833404758
Ref: ライブラリ<5>-Footnote-843404815
Ref: ライブラリ<5>-Footnote-853404872
Ref: ライブラリ<5>-Footnote-863404929
Ref: ライブラリ<5>-Footnote-873404986
Ref: ライブラリ<5>-Footnote-883405043
Ref: ライブラリ<5>-Footnote-893405100
Ref: ライブラリ<5>-Footnote-903405157
Ref: ライブラリ<5>-Footnote-913405213
Ref: ライブラリ<5>-Footnote-923405269
Ref: ライブラリ<5>-Footnote-933405326
Ref: ライブラリ<5>-Footnote-943405383
Ref: ライブラリ<5>-Footnote-953405440
Ref: ライブラリ<5>-Footnote-963405496
Ref: ライブラリ<5>-Footnote-973405552
Ref: ライブラリ<5>-Footnote-983405609
Ref: ライブラリ<5>-Footnote-993405666
Ref: ライブラリ<5>-Footnote-1003405723
Ref: ライブラリ<5>-Footnote-1013405780
Ref: ライブラリ<5>-Footnote-1023405838
Ref: ライブラリ<5>-Footnote-1033405896
Ref: ライブラリ<5>-Footnote-1043405954
Ref: ライブラリ<5>-Footnote-1053406012
Ref: ライブラリ<5>-Footnote-1063406070
Ref: ライブラリ<5>-Footnote-1073406128
Ref: ライブラリ<5>-Footnote-1083406186
Ref: ライブラリ<5>-Footnote-1093406244
Ref: ライブラリ<5>-Footnote-1103406302
Ref: ライブラリ<5>-Footnote-1113406360
Ref: ライブラリ<5>-Footnote-1123406418
Ref: ライブラリ<5>-Footnote-1133406476
Ref: ライブラリ<5>-Footnote-1143406534
Ref: ライブラリ<5>-Footnote-1153406592
Ref: ライブラリ<5>-Footnote-1163406650
Ref: ライブラリ<5>-Footnote-1173406708
Ref: ライブラリ<5>-Footnote-1183406765
Ref: ライブラリ<5>-Footnote-1193406832
Node: IDLE<4>3406899
Ref: whatsnew/changelog id153407019
Ref: 17cb3407019
Ref: IDLE<4>-Footnote-13407296
Ref: IDLE<4>-Footnote-23407351
Node: ドキュメント<4>3407407
Ref: whatsnew/changelog id163407529
Ref: 17cc3407529
Ref: ドキュメント<4>-Footnote-13408016
Ref: ドキュメント<4>-Footnote-23408072
Ref: ドキュメント<4>-Footnote-33408137
Node: Core and Builtins<4>3408193
Ref: whatsnew/changelog id173408326
Ref: 17ce3408326
Ref: Core and Builtins<4>-Footnote-13408521
Node: ライブラリ<6>3408577
Ref: whatsnew/changelog id183408709
Ref: 17cf3408709
Ref: ライブラリ<6>-Footnote-13408900
Node: Core and Builtins<5>3408956
Ref: whatsnew/changelog id193409086
Ref: 17d03409086
Ref: Core and Builtins<5>-Footnote-13410519
Ref: Core and Builtins<5>-Footnote-23410575
Ref: Core and Builtins<5>-Footnote-33410631
Ref: Core and Builtins<5>-Footnote-43410687
Ref: Core and Builtins<5>-Footnote-53410743
Ref: Core and Builtins<5>-Footnote-63410799
Ref: Core and Builtins<5>-Footnote-73410855
Ref: Core and Builtins<5>-Footnote-83410911
Node: ライブラリ<7>3410967
Ref: whatsnew/changelog id203411099
Ref: 17d23411099
Ref: ライブラリ<7>-Footnote-13411276
Node: Core and Builtins<6>3411332
Ref: whatsnew/changelog id213411462
Ref: 17d33411462
Ref: Core and Builtins<6>-Footnote-13411749
Node: ライブラリ<8>3411805
Ref: whatsnew/changelog id223411937
Ref: 17d43411937
Ref: ライブラリ<8>-Footnote-13412158
Node: Core and Builtins<7>3412214
Ref: whatsnew/changelog id233412344
Ref: 17d53412344
Ref: Core and Builtins<7>-Footnote-13413616
Ref: Core and Builtins<7>-Footnote-23413672
Ref: Core and Builtins<7>-Footnote-33413728
Ref: Core and Builtins<7>-Footnote-43413784
Ref: Core and Builtins<7>-Footnote-53413840
Ref: Core and Builtins<7>-Footnote-63413896
Ref: Core and Builtins<7>-Footnote-73413952
Node: ライブラリ<9>3414008
Ref: whatsnew/changelog id243414140
Ref: 17d93414140
Ref: ライブラリ<9>-Footnote-13414483
Node: Core and Builtins<8>3414539
Ref: whatsnew/changelog id253414670
Ref: 17dd3414670
Ref: Core and Builtins<8>-Footnote-13417962
Ref: Core and Builtins<8>-Footnote-23418018
Ref: Core and Builtins<8>-Footnote-33418074
Ref: Core and Builtins<8>-Footnote-43418130
Ref: Core and Builtins<8>-Footnote-53418186
Ref: Core and Builtins<8>-Footnote-63418242
Ref: Core and Builtins<8>-Footnote-73418298
Ref: Core and Builtins<8>-Footnote-83418354
Ref: Core and Builtins<8>-Footnote-93418410
Ref: Core and Builtins<8>-Footnote-103418466
Ref: Core and Builtins<8>-Footnote-113418523
Ref: Core and Builtins<8>-Footnote-123418580
Ref: Core and Builtins<8>-Footnote-133418637
Ref: Core and Builtins<8>-Footnote-143418694
Ref: Core and Builtins<8>-Footnote-153418751
Ref: Core and Builtins<8>-Footnote-163418808
Ref: Core and Builtins<8>-Footnote-173418851
Ref: Core and Builtins<8>-Footnote-183418908
Node: ライブラリ<10>3418964
Ref: whatsnew/changelog id263419097
Ref: 17de3419097
Ref: ライブラリ<10>-Footnote-13419279
Node: Core and Builtins<9>3419335
Ref: whatsnew/changelog id273419467
Ref: 17df3419467
Ref: Core and Builtins<9>-Footnote-13420331
Ref: Core and Builtins<9>-Footnote-23420387
Ref: Core and Builtins<9>-Footnote-33420443
Ref: Core and Builtins<9>-Footnote-43420499
Ref: Core and Builtins<9>-Footnote-53420555
Node: ライブラリ<11>3420610
Ref: whatsnew/changelog id283420744
Ref: 17e33420744
Ref: ライブラリ<11>-Footnote-13421111
Ref: ライブラリ<11>-Footnote-23421167
Node: Core and Builtins<10>3421223
Ref: whatsnew/changelog id293421345
Ref: 17e43421345
Ref: Core and Builtins<10>-Footnote-13422557
Ref: Core and Builtins<10>-Footnote-23422613
Ref: Core and Builtins<10>-Footnote-33422669
Ref: Core and Builtins<10>-Footnote-43422724
Ref: Core and Builtins<10>-Footnote-53422780
Ref: Core and Builtins<10>-Footnote-63422836
Node: C API<2>3422892
Ref: whatsnew/changelog id303423007
Ref: 17e53423007
Ref: C API<2>-Footnote-13424343
Ref: C API<2>-Footnote-23424399
Ref: C API<2>-Footnote-33424455
Ref: C API<2>-Footnote-43424511
Ref: C API<2>-Footnote-53424567
Ref: C API<2>-Footnote-63424623
Node: ビルド<2>3424679
Ref: whatsnew/changelog id313424764
Ref: 17e83424764
Ref: ビルド<2>-Footnote-13426135
Ref: ビルド<2>-Footnote-23426191
Ref: ビルド<2>-Footnote-33426247
Ref: ビルド<2>-Footnote-43426303
Ref: ビルド<2>-Footnote-53426359
Ref: ビルド<2>-Footnote-63426415
Ref: ビルド<2>-Footnote-73426471
Ref: ビルド<2>-Footnote-83426527
Node: Python 3 14 0 final3426583
Ref: whatsnew/changelog python-3-14-0-final3426721
Ref: 17e93426721
Node: macOS<2>3426972
Ref: whatsnew/changelog id323427055
Ref: 17ea3427055
Ref: macOS<2>-Footnote-13427253
Ref: macOS<2>-Footnote-23427309
Node: Windows<4>3427365
Ref: whatsnew/changelog id333427471
Ref: 17eb3427471
Ref: Windows<4>-Footnote-13427608
Node: Tools/Demos<3>3427664
Ref: whatsnew/changelog id343427783
Ref: 17ec3427783
Ref: Tools/Demos<3>-Footnote-13428402
Ref: Tools/Demos<3>-Footnote-23428458
Ref: Tools/Demos<3>-Footnote-33428514
Node: セキュリティ<4>3428570
Ref: whatsnew/changelog id353428698
Ref: 17ed3428698
Ref: セキュリティ<4>-Footnote-13429045
Node: ライブラリ<12>3429101
Ref: whatsnew/changelog id363429206
Ref: 17ef3429206
Ref: ライブラリ<12>-Footnote-13429342
Node: Python 3 14 0 release candidate 33429398
Ref: whatsnew/changelog python-3-14-0-release-candidate-33429550
Ref: 17f03429550
Node: Windows<5>3429854
Ref: whatsnew/changelog id373429957
Ref: 17f13429957
Ref: Windows<5>-Footnote-13430116
Node: Tools/Demos<4>3430172
Ref: whatsnew/changelog id383430305
Ref: 17f23430305
Ref: Tools/Demos<4>-Footnote-13430575
Node: セキュリティ<5>3430631
Ref: whatsnew/changelog id393430773
Ref: 17f33430773
Ref: セキュリティ<5>-Footnote-13431267
Node: ライブラリ<13>3431323
Ref: whatsnew/changelog id403431472
Ref: 17f43431472
Ref: ライブラリ<13>-Footnote-13433963
Ref: ライブラリ<13>-Footnote-23434019
Ref: ライブラリ<13>-Footnote-33434075
Ref: ライブラリ<13>-Footnote-43434131
Ref: ライブラリ<13>-Footnote-53434187
Ref: ライブラリ<13>-Footnote-63434243
Ref: ライブラリ<13>-Footnote-73434299
Ref: ライブラリ<13>-Footnote-83434355
Ref: ライブラリ<13>-Footnote-93434410
Ref: ライブラリ<13>-Footnote-103434466
Ref: ライブラリ<13>-Footnote-113434523
Ref: ライブラリ<13>-Footnote-123434580
Ref: ライブラリ<13>-Footnote-133434636
Ref: ライブラリ<13>-Footnote-143434693
Ref: ライブラリ<13>-Footnote-153434750
Node: Core and Builtins<11>3434807
Ref: whatsnew/changelog id413434926
Ref: 17f83434926
Ref: Core and Builtins<11>-Footnote-13436606
Ref: Core and Builtins<11>-Footnote-23436661
Ref: Core and Builtins<11>-Footnote-33436717
Ref: Core and Builtins<11>-Footnote-43436773
Ref: Core and Builtins<11>-Footnote-53436829
Ref: Core and Builtins<11>-Footnote-63436885
Ref: Core and Builtins<11>-Footnote-73436941
Ref: Core and Builtins<11>-Footnote-83436997
Ref: Core and Builtins<11>-Footnote-93437053
Ref: Core and Builtins<11>-Footnote-103437109
Ref: Core and Builtins<11>-Footnote-113437166
Node: Python 3 14 0 release candidate 23437223
Ref: whatsnew/changelog python-3-14-0-release-candidate-23437389
Ref: 17fb3437389
Node: macOS<3>3437727
Ref: whatsnew/changelog id423437824
Ref: 17fc3437824
Ref: macOS<3>-Footnote-13438214
Ref: macOS<3>-Footnote-23438270
Node: Windows<6>3438326
Ref: whatsnew/changelog id433438451
Ref: 17fd3438451
Ref: Windows<6>-Footnote-13438595
Node: ライブラリ<14>3438651
Ref: whatsnew/changelog id443438789
Ref: 17fe3438789
Ref: ライブラリ<14>-Footnote-13440348
Ref: ライブラリ<14>-Footnote-23440404
Ref: ライブラリ<14>-Footnote-33440460
Ref: ライブラリ<14>-Footnote-43440516
Ref: ライブラリ<14>-Footnote-53440572
Ref: ライブラリ<14>-Footnote-63440628
Ref: ライブラリ<14>-Footnote-73440684
Ref: ライブラリ<14>-Footnote-83440740
Ref: ライブラリ<14>-Footnote-93440796
Node: ドキュメント<5>3440852
Ref: whatsnew/changelog id453441001
Ref: 17ff3441001
Ref: ドキュメント<5>-Footnote-13441172
Node: Core and Builtins<12>3441228
Ref: whatsnew/changelog id463441366
Ref: 18003441366
Ref: Core and Builtins<12>-Footnote-13442995
Ref: Core and Builtins<12>-Footnote-23443051
Ref: Core and Builtins<12>-Footnote-33443107
Ref: Core and Builtins<12>-Footnote-43443163
Ref: Core and Builtins<12>-Footnote-53443219
Ref: Core and Builtins<12>-Footnote-63443275
Ref: Core and Builtins<12>-Footnote-73443331
Node: C API<3>3443387
Ref: whatsnew/changelog id473443516
Ref: 18013443516
Ref: C API<3>-Footnote-13443714
Node: ビルド<3>3443770
Ref: whatsnew/changelog id483443869
Ref: 18033443869
Ref: ビルド<3>-Footnote-13443990
Node: Python 3 14 0 release candidate 13444046
Ref: whatsnew/changelog python-3-14-0-release-candidate-13444199
Ref: 18043444199
Node: Tools/Demos<5>3444694
Ref: whatsnew/changelog id493444808
Ref: 18053444808
Ref: Tools/Demos<5>-Footnote-13444989
Node: セキュリティ<6>3445045
Ref: whatsnew/changelog id503445187
Ref: 18063445187
Ref: セキュリティ<6>-Footnote-13445580
Ref: セキュリティ<6>-Footnote-23445636
Node: ライブラリ<15>3445692
Ref: whatsnew/changelog id513445841
Ref: 18073445841
Ref: ライブラリ<15>-Footnote-13447616
Ref: ライブラリ<15>-Footnote-23447672
Ref: ライブラリ<15>-Footnote-33447728
Ref: ライブラリ<15>-Footnote-43447784
Ref: ライブラリ<15>-Footnote-53447840
Ref: ライブラリ<15>-Footnote-63447896
Ref: ライブラリ<15>-Footnote-73447952
Ref: ライブラリ<15>-Footnote-83448007
Ref: ライブラリ<15>-Footnote-93448063
Ref: ライブラリ<15>-Footnote-103448119
Ref: ライブラリ<15>-Footnote-113448176
Ref: ライブラリ<15>-Footnote-123448233
Ref: ライブラリ<15>-Footnote-133448290
Node: Core and Builtins<13>3448347
Ref: whatsnew/changelog id523448494
Ref: 18083448494
Ref: Core and Builtins<13>-Footnote-13448709
Node: ライブラリ<16>3448765
Ref: whatsnew/changelog id533448914
Ref: 18093448914
Ref: ライブラリ<16>-Footnote-13449083
Node: Core and Builtins<14>3449139
Ref: whatsnew/changelog id543449286
Ref: 180a3449286
Ref: Core and Builtins<14>-Footnote-13450226
Ref: Core and Builtins<14>-Footnote-23450282
Ref: Core and Builtins<14>-Footnote-33450338
Ref: Core and Builtins<14>-Footnote-43450394
Ref: Core and Builtins<14>-Footnote-53450450
Ref: Core and Builtins<14>-Footnote-63450506
Node: ライブラリ<17>3450548
Ref: whatsnew/changelog id553450697
Ref: 180b3450697
Ref: ライブラリ<17>-Footnote-13450889
Node: Core and Builtins<15>3450945
Ref: whatsnew/changelog id563451081
Ref: 180c3451081
Ref: Core and Builtins<15>-Footnote-13451747
Ref: Core and Builtins<15>-Footnote-23451803
Ref: Core and Builtins<15>-Footnote-33451859
Ref: Core and Builtins<15>-Footnote-43451914
Node: C API<4>3451970
Ref: whatsnew/changelog id573452099
Ref: 180d3452099
Ref: C API<4>-Footnote-13452558
Ref: C API<4>-Footnote-23452614
Ref: C API<4>-Footnote-33452670
Node: ビルド<4>3452726
Ref: whatsnew/changelog id583452825
Ref: 180f3452825
Ref: ビルド<4>-Footnote-13453023
Node: Python 3 14 0 beta 43453079
Ref: whatsnew/changelog python-3-14-0-beta-43453219
Ref: 18103453219
Node: Tools/Demos<6>3453592
Ref: whatsnew/changelog id593453684
Ref: 18113453684
Ref: Tools/Demos<6>-Footnote-13454076
Ref: Tools/Demos<6>-Footnote-23454132
Node: テスト<3>3454188
Ref: whatsnew/changelog id603454310
Ref: 18123454310
Ref: テスト<3>-Footnote-13454601
Ref: テスト<3>-Footnote-23454657
Node: セキュリティ<7>3454713
Ref: whatsnew/changelog id613454840
Ref: 18133454840
Ref: セキュリティ<7>-Footnote-13456738
Ref: セキュリティ<7>-Footnote-23456794
Ref: セキュリティ<7>-Footnote-33456850
Ref: セキュリティ<7>-Footnote-43456906
Node: ライブラリ<18>3456962
Ref: whatsnew/changelog id623457098
Ref: 18143457098
Ref: ライブラリ<18>-Footnote-13461807
Ref: ライブラリ<18>-Footnote-23461863
Ref: ライブラリ<18>-Footnote-33461919
Ref: ライブラリ<18>-Footnote-43461974
Ref: ライブラリ<18>-Footnote-53462030
Ref: ライブラリ<18>-Footnote-63462086
Ref: ライブラリ<18>-Footnote-73462141
Ref: ライブラリ<18>-Footnote-83462196
Ref: ライブラリ<18>-Footnote-93462252
Ref: ライブラリ<18>-Footnote-103462308
Ref: ライブラリ<18>-Footnote-113462365
Ref: ライブラリ<18>-Footnote-123462422
Ref: ライブラリ<18>-Footnote-133462479
Ref: ライブラリ<18>-Footnote-143462536
Ref: ライブラリ<18>-Footnote-153462593
Ref: ライブラリ<18>-Footnote-163462650
Ref: ライブラリ<18>-Footnote-173462707
Ref: ライブラリ<18>-Footnote-183462764
Ref: ライブラリ<18>-Footnote-193462821
Ref: ライブラリ<18>-Footnote-203462878
Ref: ライブラリ<18>-Footnote-213462935
Ref: ライブラリ<18>-Footnote-223462992
Ref: ライブラリ<18>-Footnote-233463049
Ref: ライブラリ<18>-Footnote-243463106
Ref: ライブラリ<18>-Footnote-253463162
Ref: ライブラリ<18>-Footnote-263463218
Node: ドキュメント<6>3463275
Ref: whatsnew/changelog id633463411
Ref: 18193463411
Ref: ドキュメント<6>-Footnote-13463585
Node: Core and Builtins<16>3463641
Ref: whatsnew/changelog id643463766
Ref: 181a3463766
Ref: Core and Builtins<16>-Footnote-13465204
Ref: Core and Builtins<16>-Footnote-23465260
Ref: Core and Builtins<16>-Footnote-33465315
Ref: Core and Builtins<16>-Footnote-43465371
Ref: Core and Builtins<16>-Footnote-53465427
Ref: Core and Builtins<16>-Footnote-63465483
Ref: Core and Builtins<16>-Footnote-73465539
Ref: Core and Builtins<16>-Footnote-83465595
Ref: Core and Builtins<16>-Footnote-93465651
Node: C API<5>3465707
Ref: whatsnew/changelog id653465823
Ref: 181b3465823
Ref: C API<5>-Footnote-13465995
Node: ビルド<5>3466051
Ref: whatsnew/changelog id663466137
Ref: 181c3466137
Ref: ビルド<5>-Footnote-13466311
Node: Python 3 14 0 beta 33466367
Ref: whatsnew/changelog python-3-14-0-beta-33466494
Ref: 181d3466494
Node: Windows<7>3467113
Ref: whatsnew/changelog id673467201
Ref: 181e3467201
Ref: Windows<7>-Footnote-13467456
Node: テスト<4>3467512
Ref: whatsnew/changelog id683467630
Ref: 181f3467630
Ref: テスト<4>-Footnote-13467968
Ref: テスト<4>-Footnote-23468024
Ref: テスト<4>-Footnote-33468080
Node: セキュリティ<8>3468136
Ref: whatsnew/changelog id693468263
Ref: 18203468263
Ref: セキュリティ<8>-Footnote-13468920
Ref: セキュリティ<8>-Footnote-23468976
Ref: セキュリティ<8>-Footnote-33469032
Ref: セキュリティ<8>-Footnote-43469088
Ref: セキュリティ<8>-Footnote-53469143
Ref: セキュリティ<8>-Footnote-63469198
Node: ライブラリ<19>3469253
Ref: whatsnew/changelog id703469389
Ref: 18213469389
Ref: ライブラリ<19>-Footnote-13473731
Ref: ライブラリ<19>-Footnote-23473786
Ref: ライブラリ<19>-Footnote-33473842
Ref: ライブラリ<19>-Footnote-43473898
Ref: ライブラリ<19>-Footnote-53473954
Ref: ライブラリ<19>-Footnote-63474010
Ref: ライブラリ<19>-Footnote-73474066
Ref: ライブラリ<19>-Footnote-83474122
Ref: ライブラリ<19>-Footnote-93474178
Ref: ライブラリ<19>-Footnote-103474234
Ref: ライブラリ<19>-Footnote-113474310
Ref: ライブラリ<19>-Footnote-123474367
Ref: ライブラリ<19>-Footnote-133474424
Ref: ライブラリ<19>-Footnote-143474481
Ref: ライブラリ<19>-Footnote-153474524
Ref: ライブラリ<19>-Footnote-163474581
Ref: ライブラリ<19>-Footnote-173474638
Ref: ライブラリ<19>-Footnote-183474695
Ref: ライブラリ<19>-Footnote-193474752
Ref: ライブラリ<19>-Footnote-203474809
Ref: ライブラリ<19>-Footnote-213474866
Ref: ライブラリ<19>-Footnote-223474926
Ref: ライブラリ<19>-Footnote-233474983
Ref: ライブラリ<19>-Footnote-243475040
Ref: ライブラリ<19>-Footnote-253475097
Ref: ライブラリ<19>-Footnote-263475154
Ref: ライブラリ<19>-Footnote-273475211
Ref: ライブラリ<19>-Footnote-283475268
Ref: ライブラリ<19>-Footnote-293475325
Node: ドキュメント<7>3475382
Ref: whatsnew/changelog id713475518
Ref: 18283475518
Ref: ドキュメント<7>-Footnote-13475875
Ref: ドキュメント<7>-Footnote-23475931
Node: Core and Builtins<17>3475996
Ref: whatsnew/changelog id723476132
Ref: 18293476132
Ref: Core and Builtins<17>-Footnote-13476640
Ref: Core and Builtins<17>-Footnote-23476696
Node: ライブラリ<20>3476752
Ref: whatsnew/changelog id733476888
Ref: 182a3476888
Ref: ライブラリ<20>-Footnote-13477197
Node: Core and Builtins<18>3477253
Ref: whatsnew/changelog id743477387
Ref: 182b3477387
Ref: Core and Builtins<18>-Footnote-13478288
Ref: Core and Builtins<18>-Footnote-23478344
Ref: Core and Builtins<18>-Footnote-33478400
Node: ライブラリ<21>3478456
Ref: whatsnew/changelog id753478592
Ref: 182c3478592
Ref: ライブラリ<21>-Footnote-13478786
Node: Core and Builtins<19>3478842
Ref: whatsnew/changelog id763478976
Ref: 182d3478976
Ref: Core and Builtins<19>-Footnote-13479334
Ref: Core and Builtins<19>-Footnote-23479390
Ref: Core and Builtins<19>-Footnote-33479432
Node: ライブラリ<22>3479488
Ref: whatsnew/changelog id773479624
Ref: 182e3479624
Ref: ライブラリ<22>-Footnote-13479826
Node: Core and Builtins<20>3479882
Ref: whatsnew/changelog id783480005
Ref: 182f3480005
Ref: Core and Builtins<20>-Footnote-13480811
Ref: Core and Builtins<20>-Footnote-23480867
Ref: Core and Builtins<20>-Footnote-33480923
Ref: Core and Builtins<20>-Footnote-43480979
Node: C API<6>3481035
Ref: whatsnew/changelog id793481151
Ref: 18303481151
Ref: C API<6>-Footnote-13481990
Ref: C API<6>-Footnote-23482046
Ref: C API<6>-Footnote-33482102
Node: ビルド<6>3482158
Ref: whatsnew/changelog id803482244
Ref: 18333482244
Ref: ビルド<6>-Footnote-13483064
Ref: ビルド<6>-Footnote-23483120
Ref: ビルド<6>-Footnote-33483176
Ref: ビルド<6>-Footnote-43483232
Ref: ビルド<6>-Footnote-53483288
Ref: ビルド<6>-Footnote-63483344
Node: Python 3 14 0 beta 23483386
Ref: whatsnew/changelog python-3-14-0-beta-23483513
Ref: 18353483513
Node: Windows<8>3483866
Ref: whatsnew/changelog id813483956
Ref: 18363483956
Ref: Windows<8>-Footnote-13484900
Ref: Windows<8>-Footnote-23484956
Ref: Windows<8>-Footnote-33485011
Ref: Windows<8>-Footnote-43485067
Node: Tools/Demos<7>3485123
Ref: whatsnew/changelog id823485234
Ref: 18373485234
Ref: Tools/Demos<7>-Footnote-13485434
Node: テスト<5>3485490
Ref: whatsnew/changelog id833485612
Ref: 18383485612
Ref: テスト<5>-Footnote-13486241
Ref: テスト<5>-Footnote-23486297
Ref: テスト<5>-Footnote-33486353
Node: セキュリティ<9>3486409
Ref: whatsnew/changelog id843486536
Ref: 18393486536
Ref: セキュリティ<9>-Footnote-13486919
Ref: セキュリティ<9>-Footnote-23486975
Node: ライブラリ<23>3487031
Ref: whatsnew/changelog id853487167
Ref: 183a3487167
Ref: ライブラリ<23>-Footnote-13495094
Ref: ライブラリ<23>-Footnote-23495150
Ref: ライブラリ<23>-Footnote-33495205
Ref: ライブラリ<23>-Footnote-43495261
Ref: ライブラリ<23>-Footnote-53495317
Ref: ライブラリ<23>-Footnote-63495373
Ref: ライブラリ<23>-Footnote-73495429
Ref: ライブラリ<23>-Footnote-83495484
Ref: ライブラリ<23>-Footnote-93495540
Ref: ライブラリ<23>-Footnote-103495595
Ref: ライブラリ<23>-Footnote-113495652
Ref: ライブラリ<23>-Footnote-123495709
Ref: ライブラリ<23>-Footnote-133495766
Ref: ライブラリ<23>-Footnote-143495823
Ref: ライブラリ<23>-Footnote-153495879
Ref: ライブラリ<23>-Footnote-163495936
Ref: ライブラリ<23>-Footnote-173495993
Ref: ライブラリ<23>-Footnote-183496050
Ref: ライブラリ<23>-Footnote-193496107
Ref: ライブラリ<23>-Footnote-203496164
Ref: ライブラリ<23>-Footnote-213496221
Ref: ライブラリ<23>-Footnote-223496278
Ref: ライブラリ<23>-Footnote-233496335
Ref: ライブラリ<23>-Footnote-243496391
Ref: ライブラリ<23>-Footnote-253496448
Ref: ライブラリ<23>-Footnote-263496505
Ref: ライブラリ<23>-Footnote-273496562
Ref: ライブラリ<23>-Footnote-283496619
Ref: ライブラリ<23>-Footnote-293496676
Ref: ライブラリ<23>-Footnote-303496733
Ref: ライブラリ<23>-Footnote-313496789
Ref: ライブラリ<23>-Footnote-323496846
Ref: ライブラリ<23>-Footnote-333496903
Ref: ライブラリ<23>-Footnote-343496960
Ref: ライブラリ<23>-Footnote-353497017
Ref: ライブラリ<23>-Footnote-363497060
Ref: ライブラリ<23>-Footnote-373497117
Ref: ライブラリ<23>-Footnote-383497174
Ref: ライブラリ<23>-Footnote-393497231
Ref: ライブラリ<23>-Footnote-403497288
Ref: ライブラリ<23>-Footnote-413497344
Ref: ライブラリ<23>-Footnote-423497401
Ref: ライブラリ<23>-Footnote-433497457
Ref: ライブラリ<23>-Footnote-443497513
Ref: ライブラリ<23>-Footnote-453497569
Ref: ライブラリ<23>-Footnote-463497635
Node: Core and Builtins<21>3497692
Ref: whatsnew/changelog id863497815
Ref: 18423497815
Ref: Core and Builtins<21>-Footnote-13500186
Ref: Core and Builtins<21>-Footnote-23500242
Ref: Core and Builtins<21>-Footnote-33500298
Ref: Core and Builtins<21>-Footnote-43500354
Ref: Core and Builtins<21>-Footnote-53500409
Ref: Core and Builtins<21>-Footnote-63500465
Ref: Core and Builtins<21>-Footnote-73500521
Ref: Core and Builtins<21>-Footnote-83500577
Ref: Core and Builtins<21>-Footnote-93500633
Ref: Core and Builtins<21>-Footnote-103500689
Ref: Core and Builtins<21>-Footnote-113500746
Ref: Core and Builtins<21>-Footnote-123500803
Ref: Core and Builtins<21>-Footnote-133500860
Ref: Core and Builtins<21>-Footnote-143500917
Ref: Core and Builtins<21>-Footnote-153500974
Ref: Core and Builtins<21>-Footnote-163501031
Ref: Core and Builtins<21>-Footnote-173501088
Node: C API<7>3501133
Ref: whatsnew/changelog id873501249
Ref: 18443501249
Ref: C API<7>-Footnote-13501488
Node: ビルド<7>3501544
Ref: whatsnew/changelog id883501630
Ref: 18473501630
Ref: ビルド<7>-Footnote-13502067
Ref: ビルド<7>-Footnote-23502123
Ref: ビルド<7>-Footnote-33502165
Ref: ビルド<7>-Footnote-43502221
Node: Python 3 14 0 beta 13502277
Ref: whatsnew/changelog python-3-14-0-beta-13502405
Ref: 18483502405
Node: Windows<9>3503029
Ref: whatsnew/changelog id893503119
Ref: 18493503119
Ref: Windows<9>-Footnote-13503451
Ref: Windows<9>-Footnote-23503507
Node: Tools/Demos<8>3503563
Ref: whatsnew/changelog id903503674
Ref: 184a3503674
Ref: Tools/Demos<8>-Footnote-13503991
Ref: Tools/Demos<8>-Footnote-23504047
Node: テスト<6>3504103
Ref: whatsnew/changelog id913504226
Ref: 184b3504226
Ref: テスト<6>-Footnote-13505204
Ref: テスト<6>-Footnote-23505260
Ref: テスト<6>-Footnote-33505315
Ref: テスト<6>-Footnote-43505371
Ref: テスト<6>-Footnote-53505427
Node: セキュリティ<10>3505483
Ref: whatsnew/changelog id923505611
Ref: 184c3505611
Ref: セキュリティ<10>-Footnote-13506133
Node: ライブラリ<24>3506189
Ref: whatsnew/changelog id933506312
Ref: 184d3506312
Ref: ライブラリ<24>-Footnote-13525700
Ref: ライブラリ<24>-Footnote-23525756
Ref: ライブラリ<24>-Footnote-33525812
Ref: ライブラリ<24>-Footnote-43525868
Ref: ライブラリ<24>-Footnote-53525924
Ref: ライブラリ<24>-Footnote-63525980
Ref: ライブラリ<24>-Footnote-73526036
Ref: ライブラリ<24>-Footnote-83526092
Ref: ライブラリ<24>-Footnote-93526148
Ref: ライブラリ<24>-Footnote-103526204
Ref: ライブラリ<24>-Footnote-113526261
Ref: ライブラリ<24>-Footnote-123526318
Ref: ライブラリ<24>-Footnote-133526375
Ref: ライブラリ<24>-Footnote-143526432
Ref: ライブラリ<24>-Footnote-153526489
Ref: ライブラリ<24>-Footnote-163526546
Ref: ライブラリ<24>-Footnote-173526603
Ref: ライブラリ<24>-Footnote-183526660
Ref: ライブラリ<24>-Footnote-193526717
Ref: ライブラリ<24>-Footnote-203526774
Ref: ライブラリ<24>-Footnote-213526831
Ref: ライブラリ<24>-Footnote-223526888
Ref: ライブラリ<24>-Footnote-233526945
Ref: ライブラリ<24>-Footnote-243527002
Ref: ライブラリ<24>-Footnote-253527059
Ref: ライブラリ<24>-Footnote-263527116
Ref: ライブラリ<24>-Footnote-273527173
Ref: ライブラリ<24>-Footnote-283527230
Ref: ライブラリ<24>-Footnote-293527287
Ref: ライブラリ<24>-Footnote-303527344
Ref: ライブラリ<24>-Footnote-313527401
Ref: ライブラリ<24>-Footnote-323527458
Ref: ライブラリ<24>-Footnote-333527514
Ref: ライブラリ<24>-Footnote-343527571
Ref: ライブラリ<24>-Footnote-353527628
Ref: ライブラリ<24>-Footnote-363527685
Ref: ライブラリ<24>-Footnote-373527742
Ref: ライブラリ<24>-Footnote-383527799
Ref: ライブラリ<24>-Footnote-393527856
Ref: ライブラリ<24>-Footnote-403527913
Ref: ライブラリ<24>-Footnote-413527970
Ref: ライブラリ<24>-Footnote-423528027
Ref: ライブラリ<24>-Footnote-433528084
Ref: ライブラリ<24>-Footnote-443528141
Ref: ライブラリ<24>-Footnote-453528198
Ref: ライブラリ<24>-Footnote-463528255
Ref: ライブラリ<24>-Footnote-473528312
Ref: ライブラリ<24>-Footnote-483528368
Ref: ライブラリ<24>-Footnote-493528425
Ref: ライブラリ<24>-Footnote-503528482
Ref: ライブラリ<24>-Footnote-513528539
Ref: ライブラリ<24>-Footnote-523528595
Ref: ライブラリ<24>-Footnote-533528652
Ref: ライブラリ<24>-Footnote-543528709
Ref: ライブラリ<24>-Footnote-553528766
Ref: ライブラリ<24>-Footnote-563528823
Ref: ライブラリ<24>-Footnote-573528880
Ref: ライブラリ<24>-Footnote-583528937
Ref: ライブラリ<24>-Footnote-593528994
Ref: ライブラリ<24>-Footnote-603529051
Ref: ライブラリ<24>-Footnote-613529108
Ref: ライブラリ<24>-Footnote-623529165
Ref: ライブラリ<24>-Footnote-633529222
Ref: ライブラリ<24>-Footnote-643529279
Ref: ライブラリ<24>-Footnote-653529336
Ref: ライブラリ<24>-Footnote-663529393
Ref: ライブラリ<24>-Footnote-673529450
Ref: ライブラリ<24>-Footnote-683529507
Ref: ライブラリ<24>-Footnote-693529564
Ref: ライブラリ<24>-Footnote-703529621
Ref: ライブラリ<24>-Footnote-713529681
Ref: ライブラリ<24>-Footnote-723529738
Ref: ライブラリ<24>-Footnote-733529795
Ref: ライブラリ<24>-Footnote-743529851
Ref: ライブラリ<24>-Footnote-753529908
Ref: ライブラリ<24>-Footnote-763529965
Ref: ライブラリ<24>-Footnote-773530022
Ref: ライブラリ<24>-Footnote-783530079
Ref: ライブラリ<24>-Footnote-793530136
Ref: ライブラリ<24>-Footnote-803530192
Ref: ライブラリ<24>-Footnote-813530249
Ref: ライブラリ<24>-Footnote-823530306
Ref: ライブラリ<24>-Footnote-833530362
Ref: ライブラリ<24>-Footnote-843530419
Ref: ライブラリ<24>-Footnote-853530476
Ref: ライブラリ<24>-Footnote-863530533
Ref: ライブラリ<24>-Footnote-873530590
Ref: ライブラリ<24>-Footnote-883530647
Ref: ライブラリ<24>-Footnote-893530703
Ref: ライブラリ<24>-Footnote-903530760
Ref: ライブラリ<24>-Footnote-913530817
Ref: ライブラリ<24>-Footnote-923530874
Ref: ライブラリ<24>-Footnote-933530931
Ref: ライブラリ<24>-Footnote-943530988
Ref: ライブラリ<24>-Footnote-953531045
Ref: ライブラリ<24>-Footnote-963531102
Ref: ライブラリ<24>-Footnote-973531159
Ref: ライブラリ<24>-Footnote-983531216
Ref: ライブラリ<24>-Footnote-993531273
Ref: ライブラリ<24>-Footnote-1003531330
Ref: ライブラリ<24>-Footnote-1013531387
Ref: ライブラリ<24>-Footnote-1023531445
Ref: ライブラリ<24>-Footnote-1033531503
Ref: ライブラリ<24>-Footnote-1043531560
Ref: ライブラリ<24>-Footnote-1053531618
Ref: ライブラリ<24>-Footnote-1063531676
Ref: ライブラリ<24>-Footnote-1073531743
Node: IDLE<5>3531800
Ref: whatsnew/changelog id943531922
Ref: 185d3531922
Ref: IDLE<5>-Footnote-13532062
Node: ドキュメント<8>3532118
Ref: whatsnew/changelog id953532242
Ref: 185e3532242
Ref: ドキュメント<8>-Footnote-13532605
Ref: ドキュメント<8>-Footnote-23532661
Node: Core and Builtins<22>3532717
Ref: whatsnew/changelog id963532853
Ref: 18603532853
Ref: Core and Builtins<22>-Footnote-13534483
Ref: Core and Builtins<22>-Footnote-23534539
Ref: Core and Builtins<22>-Footnote-33534595
Ref: Core and Builtins<22>-Footnote-43534651
Ref: Core and Builtins<22>-Footnote-53534707
Ref: Core and Builtins<22>-Footnote-63534762
Ref: Core and Builtins<22>-Footnote-73534818
Ref: Core and Builtins<22>-Footnote-83534874
Node: ライブラリ<25>3534930
Ref: whatsnew/changelog id973535066
Ref: 18623535066
Ref: ライブラリ<25>-Footnote-13535279
Ref: ライブラリ<25>-Footnote-23535335
Node: Core and Builtins<23>3535377
Ref: whatsnew/changelog id983535511
Ref: 18633535511
Ref: Core and Builtins<23>-Footnote-13538064
Ref: Core and Builtins<23>-Footnote-23538120
Ref: Core and Builtins<23>-Footnote-33538176
Ref: Core and Builtins<23>-Footnote-43538232
Ref: Core and Builtins<23>-Footnote-53538288
Ref: Core and Builtins<23>-Footnote-63538344
Ref: Core and Builtins<23>-Footnote-73538400
Ref: Core and Builtins<23>-Footnote-83538456
Ref: Core and Builtins<23>-Footnote-93538512
Ref: Core and Builtins<23>-Footnote-103538568
Ref: Core and Builtins<23>-Footnote-113538625
Ref: Core and Builtins<23>-Footnote-123538668
Ref: Core and Builtins<23>-Footnote-133538725
Ref: Core and Builtins<23>-Footnote-143538782
Ref: Core and Builtins<23>-Footnote-153538825
Ref: Core and Builtins<23>-Footnote-163538882
Ref: Core and Builtins<23>-Footnote-173538939
Ref: Core and Builtins<23>-Footnote-183538996
Node: ライブラリ<26>3539053
Ref: whatsnew/changelog id993539189
Ref: 18653539189
Ref: ライブラリ<26>-Footnote-13539379
Node: Core and Builtins<24>3539435
Ref: whatsnew/changelog id1003539569
Ref: 18663539569
Ref: Core and Builtins<24>-Footnote-13546503
Ref: Core and Builtins<24>-Footnote-23546559
Ref: Core and Builtins<24>-Footnote-33546615
Ref: Core and Builtins<24>-Footnote-43546671
Ref: Core and Builtins<24>-Footnote-53546727
Ref: Core and Builtins<24>-Footnote-63546783
Ref: Core and Builtins<24>-Footnote-73546839
Ref: Core and Builtins<24>-Footnote-83546895
Ref: Core and Builtins<24>-Footnote-93546951
Ref: Core and Builtins<24>-Footnote-103547007
Ref: Core and Builtins<24>-Footnote-113547064
Ref: Core and Builtins<24>-Footnote-123547121
Ref: Core and Builtins<24>-Footnote-133547178
Ref: Core and Builtins<24>-Footnote-143547235
Ref: Core and Builtins<24>-Footnote-153547292
Ref: Core and Builtins<24>-Footnote-163547349
Ref: Core and Builtins<24>-Footnote-173547406
Ref: Core and Builtins<24>-Footnote-183547463
Ref: Core and Builtins<24>-Footnote-193547520
Ref: Core and Builtins<24>-Footnote-203547577
Ref: Core and Builtins<24>-Footnote-213547634
Ref: Core and Builtins<24>-Footnote-223547691
Ref: Core and Builtins<24>-Footnote-233547748
Ref: Core and Builtins<24>-Footnote-243547805
Ref: Core and Builtins<24>-Footnote-253547862
Ref: Core and Builtins<24>-Footnote-263547919
Ref: Core and Builtins<24>-Footnote-273547976
Ref: Core and Builtins<24>-Footnote-283548033
Ref: Core and Builtins<24>-Footnote-293548090
Ref: Core and Builtins<24>-Footnote-303548147
Ref: Core and Builtins<24>-Footnote-313548204
Ref: Core and Builtins<24>-Footnote-323548260
Ref: Core and Builtins<24>-Footnote-333548317
Ref: Core and Builtins<24>-Footnote-343548374
Ref: Core and Builtins<24>-Footnote-353548431
Ref: Core and Builtins<24>-Footnote-363548488
Node: ライブラリ<27>3548545
Ref: whatsnew/changelog id1013548668
Ref: 18693548668
Ref: ライブラリ<27>-Footnote-13548835
Node: C API<8>3548890
Ref: whatsnew/changelog id1023549004
Ref: 186a3549004
Ref: C API<8>-Footnote-13551884
Ref: C API<8>-Footnote-23551940
Ref: C API<8>-Footnote-33551996
Ref: C API<8>-Footnote-43552052
Ref: C API<8>-Footnote-53552108
Ref: C API<8>-Footnote-63552164
Ref: C API<8>-Footnote-73552220
Ref: C API<8>-Footnote-83552276
Ref: C API<8>-Footnote-93552332
Ref: C API<8>-Footnote-103552388
Ref: C API<8>-Footnote-113552445
Ref: C API<8>-Footnote-123552502
Ref: C API<8>-Footnote-133552559
Node: ビルド<8>3552615
Ref: whatsnew/changelog id1033552701
Ref: 186c3552701
Ref: ビルド<8>-Footnote-13553963
Ref: ビルド<8>-Footnote-23554019
Ref: ビルド<8>-Footnote-33554075
Ref: ビルド<8>-Footnote-43554131
Ref: ビルド<8>-Footnote-53554187
Ref: ビルド<8>-Footnote-63554243
Ref: ビルド<8>-Footnote-73554299
Ref: ビルド<8>-Footnote-83554355
Node: Python 3 14 0 alpha 73554411
Ref: whatsnew/changelog python-3-14-0-alpha-73554540
Ref: 186d3554540
Node: macOS<4>3555048
Ref: whatsnew/changelog id1043555134
Ref: 186e3555134
Ref: macOS<4>-Footnote-13555437
Ref: macOS<4>-Footnote-23555493
Ref: macOS<4>-Footnote-33555549
Node: Windows<10>3555605
Ref: whatsnew/changelog id1053555714
Ref: 186f3555714
Ref: Windows<10>-Footnote-13556274
Ref: Windows<10>-Footnote-23556330
Ref: Windows<10>-Footnote-33556386
Ref: Windows<10>-Footnote-43556441
Node: Tools/Demos<9>3556497
Ref: whatsnew/changelog id1063556610
Ref: 18703556610
Ref: Tools/Demos<9>-Footnote-13556932
Ref: Tools/Demos<9>-Footnote-23556988
Node: テスト<7>3557044
Ref: whatsnew/changelog id1073557168
Ref: 18713557168
Ref: テスト<7>-Footnote-13557558
Ref: テスト<7>-Footnote-23557614
Node: セキュリティ<11>3557670
Ref: whatsnew/changelog id1083557799
Ref: 18733557799
Ref: セキュリティ<11>-Footnote-13558527
Ref: セキュリティ<11>-Footnote-23558583
Ref: セキュリティ<11>-Footnote-33558639
Node: ライブラリ<28>3558695
Ref: whatsnew/changelog id1093558833
Ref: 18743558833
Ref: ライブラリ<28>-Footnote-13567060
Ref: ライブラリ<28>-Footnote-23567116
Ref: ライブラリ<28>-Footnote-33567172
Ref: ライブラリ<28>-Footnote-43567228
Ref: ライブラリ<28>-Footnote-53567284
Ref: ライブラリ<28>-Footnote-63567340
Ref: ライブラリ<28>-Footnote-73567395
Ref: ライブラリ<28>-Footnote-83567451
Ref: ライブラリ<28>-Footnote-93567507
Ref: ライブラリ<28>-Footnote-103567563
Ref: ライブラリ<28>-Footnote-113567620
Ref: ライブラリ<28>-Footnote-123567677
Ref: ライブラリ<28>-Footnote-133567734
Ref: ライブラリ<28>-Footnote-143567791
Ref: ライブラリ<28>-Footnote-153567848
Ref: ライブラリ<28>-Footnote-163567905
Ref: ライブラリ<28>-Footnote-173567962
Ref: ライブラリ<28>-Footnote-183568019
Ref: ライブラリ<28>-Footnote-193568075
Ref: ライブラリ<28>-Footnote-203568132
Ref: ライブラリ<28>-Footnote-213568189
Ref: ライブラリ<28>-Footnote-223568246
Ref: ライブラリ<28>-Footnote-233568303
Ref: ライブラリ<28>-Footnote-243568360
Ref: ライブラリ<28>-Footnote-253568417
Ref: ライブラリ<28>-Footnote-263568474
Ref: ライブラリ<28>-Footnote-273568531
Ref: ライブラリ<28>-Footnote-283568587
Ref: ライブラリ<28>-Footnote-293568644
Ref: ライブラリ<28>-Footnote-303568700
Ref: ライブラリ<28>-Footnote-313568757
Ref: ライブラリ<28>-Footnote-323568814
Ref: ライブラリ<28>-Footnote-333568871
Ref: ライブラリ<28>-Footnote-343568928
Ref: ライブラリ<28>-Footnote-353568985
Ref: ライブラリ<28>-Footnote-363569042
Ref: ライブラリ<28>-Footnote-373569098
Ref: ライブラリ<28>-Footnote-383569155
Ref: ライブラリ<28>-Footnote-393569212
Ref: ライブラリ<28>-Footnote-403569269
Ref: ライブラリ<28>-Footnote-413569326
Ref: ライブラリ<28>-Footnote-423569383
Ref: ライブラリ<28>-Footnote-433569440
Ref: ライブラリ<28>-Footnote-443569497
Ref: ライブラリ<28>-Footnote-453569569
Ref: ライブラリ<28>-Footnote-463569626
Ref: ライブラリ<28>-Footnote-473569683
Ref: ライブラリ<28>-Footnote-483569740
Ref: ライブラリ<28>-Footnote-493569796
Ref: ライブラリ<28>-Footnote-503569853
Node: ドキュメント<9>3569919
Ref: whatsnew/changelog id1103570056
Ref: 187f3570056
Ref: ドキュメント<9>-Footnote-13570259
Node: Core and Builtins<25>3570315
Ref: whatsnew/changelog id1113570452
Ref: 18803570452
Ref: Core and Builtins<25>-Footnote-13573833
Ref: Core and Builtins<25>-Footnote-23573889
Ref: Core and Builtins<25>-Footnote-33573945
Ref: Core and Builtins<25>-Footnote-43574001
Ref: Core and Builtins<25>-Footnote-53574057
Ref: Core and Builtins<25>-Footnote-63574099
Ref: Core and Builtins<25>-Footnote-73574155
Ref: Core and Builtins<25>-Footnote-83574211
Ref: Core and Builtins<25>-Footnote-93574253
Ref: Core and Builtins<25>-Footnote-103574309
Ref: Core and Builtins<25>-Footnote-113574366
Ref: Core and Builtins<25>-Footnote-123574423
Ref: Core and Builtins<25>-Footnote-133574480
Ref: Core and Builtins<25>-Footnote-143574537
Ref: Core and Builtins<25>-Footnote-153574594
Ref: Core and Builtins<25>-Footnote-163574651
Ref: Core and Builtins<25>-Footnote-173574708
Ref: Core and Builtins<25>-Footnote-183574765
Ref: Core and Builtins<25>-Footnote-193574822
Ref: Core and Builtins<25>-Footnote-203574879
Ref: Core and Builtins<25>-Footnote-213574936
Ref: Core and Builtins<25>-Footnote-223574993
Ref: Core and Builtins<25>-Footnote-233575050
Ref: Core and Builtins<25>-Footnote-243575106
Node: ライブラリ<29>3575163
Ref: whatsnew/changelog id1123575300
Ref: 18833575300
Ref: ライブラリ<29>-Footnote-13575514
Ref: ライブラリ<29>-Footnote-23575569
Node: Core and Builtins<26>3575628
Ref: whatsnew/changelog id1133575752
Ref: 18843575752
Ref: Core and Builtins<26>-Footnote-13576398
Ref: Core and Builtins<26>-Footnote-23576454
Ref: Core and Builtins<26>-Footnote-33576510
Ref: Core and Builtins<26>-Footnote-43576566
Ref: Core and Builtins<26>-Footnote-53576622
Node: C API<9>3576678
Ref: whatsnew/changelog id1143576795
Ref: 18853576795
Ref: C API<9>-Footnote-13577051
Ref: C API<9>-Footnote-23577107
Node: ビルド<9>3577163
Ref: whatsnew/changelog id1153577250
Ref: 18863577250
Ref: ビルド<9>-Footnote-13578116
Ref: ビルド<9>-Footnote-23578172
Ref: ビルド<9>-Footnote-33578228
Ref: ビルド<9>-Footnote-43578284
Ref: ビルド<9>-Footnote-53578340
Ref: ビルド<9>-Footnote-63578396
Node: Python 3 14 0 alpha 63578452
Ref: whatsnew/changelog python-3-14-0-alpha-63578582
Ref: 18873578582
Node: macOS<5>3579175
Ref: whatsnew/changelog id1163579261
Ref: 18883579261
Ref: macOS<5>-Footnote-13579459
Node: Windows<11>3579515
Ref: whatsnew/changelog id1173579625
Ref: 188a3579625
Ref: Windows<11>-Footnote-13579813
Ref: Windows<11>-Footnote-23579869
Node: Tools/Demos<10>3579936
Ref: whatsnew/changelog id1183580050
Ref: 188b3580050
Ref: Tools/Demos<10>-Footnote-13580809
Ref: Tools/Demos<10>-Footnote-23580865
Ref: Tools/Demos<10>-Footnote-33580920
Ref: Tools/Demos<10>-Footnote-43580976
Ref: Tools/Demos<10>-Footnote-53581032
Ref: Tools/Demos<10>-Footnote-63581088
Ref: Tools/Demos<10>-Footnote-73581144
Node: テスト<8>3581200
Ref: whatsnew/changelog id1193581325
Ref: 188c3581325
Ref: テスト<8>-Footnote-13582047
Ref: テスト<8>-Footnote-23582103
Ref: テスト<8>-Footnote-33582159
Ref: テスト<8>-Footnote-43582215
Ref: テスト<8>-Footnote-53582271
Node: セキュリティ<12>3582327
Ref: whatsnew/changelog id1203582456
Ref: 188d3582456
Ref: セキュリティ<12>-Footnote-13582796
Node: ライブラリ<30>3582852
Ref: whatsnew/changelog id1213582991
Ref: 188e3582991
Ref: ライブラリ<30>-Footnote-13595705
Ref: ライブラリ<30>-Footnote-23595761
Ref: ライブラリ<30>-Footnote-33595817
Ref: ライブラリ<30>-Footnote-43595873
Ref: ライブラリ<30>-Footnote-53595929
Ref: ライブラリ<30>-Footnote-63595984
Ref: ライブラリ<30>-Footnote-73596039
Ref: ライブラリ<30>-Footnote-83596094
Ref: ライブラリ<30>-Footnote-93596149
Ref: ライブラリ<30>-Footnote-103596205
Ref: ライブラリ<30>-Footnote-113596262
Ref: ライブラリ<30>-Footnote-123596319
Ref: ライブラリ<30>-Footnote-133596376
Ref: ライブラリ<30>-Footnote-143596433
Ref: ライブラリ<30>-Footnote-153596490
Ref: ライブラリ<30>-Footnote-163596547
Ref: ライブラリ<30>-Footnote-173596604
Ref: ライブラリ<30>-Footnote-183596661
Ref: ライブラリ<30>-Footnote-193596717
Ref: ライブラリ<30>-Footnote-203596774
Ref: ライブラリ<30>-Footnote-213596831
Ref: ライブラリ<30>-Footnote-223596887
Ref: ライブラリ<30>-Footnote-233596944
Ref: ライブラリ<30>-Footnote-243597001
Ref: ライブラリ<30>-Footnote-253597058
Ref: ライブラリ<30>-Footnote-263597115
Ref: ライブラリ<30>-Footnote-273597172
Ref: ライブラリ<30>-Footnote-283597229
Ref: ライブラリ<30>-Footnote-293597285
Ref: ライブラリ<30>-Footnote-303597342
Ref: ライブラリ<30>-Footnote-313597399
Ref: ライブラリ<30>-Footnote-323597456
Ref: ライブラリ<30>-Footnote-333597513
Ref: ライブラリ<30>-Footnote-343597570
Ref: ライブラリ<30>-Footnote-353597627
Ref: ライブラリ<30>-Footnote-363597684
Ref: ライブラリ<30>-Footnote-373597741
Ref: ライブラリ<30>-Footnote-383597798
Ref: ライブラリ<30>-Footnote-393597855
Ref: ライブラリ<30>-Footnote-403597911
Ref: ライブラリ<30>-Footnote-413597968
Ref: ライブラリ<30>-Footnote-423598025
Ref: ライブラリ<30>-Footnote-433598082
Ref: ライブラリ<30>-Footnote-443598139
Ref: ライブラリ<30>-Footnote-453598195
Ref: ライブラリ<30>-Footnote-463598252
Ref: ライブラリ<30>-Footnote-473598309
Ref: ライブラリ<30>-Footnote-483598366
Ref: ライブラリ<30>-Footnote-493598422
Ref: ライブラリ<30>-Footnote-503598479
Ref: ライブラリ<30>-Footnote-513598536
Ref: ライブラリ<30>-Footnote-523598593
Ref: ライブラリ<30>-Footnote-533598650
Ref: ライブラリ<30>-Footnote-543598706
Ref: ライブラリ<30>-Footnote-553598763
Ref: ライブラリ<30>-Footnote-563598820
Ref: ライブラリ<30>-Footnote-573598877
Ref: ライブラリ<30>-Footnote-583598934
Ref: ライブラリ<30>-Footnote-593598991
Ref: ライブラリ<30>-Footnote-603599048
Ref: ライブラリ<30>-Footnote-613599105
Ref: ライブラリ<30>-Footnote-623599162
Ref: ライブラリ<30>-Footnote-633599219
Ref: ライブラリ<30>-Footnote-643599275
Ref: ライブラリ<30>-Footnote-653599332
Ref: ライブラリ<30>-Footnote-663599389
Ref: ライブラリ<30>-Footnote-673599445
Ref: ライブラリ<30>-Footnote-683599505
Ref: ライブラリ<30>-Footnote-693599561
Ref: ライブラリ<30>-Footnote-703599621
Ref: ライブラリ<30>-Footnote-713599678
Ref: ライブラリ<30>-Footnote-723599735
Node: ドキュメント<10>3599791
Ref: whatsnew/changelog id1223599929
Ref: 18963599929
Ref: ドキュメント<10>-Footnote-13600388
Ref: ドキュメント<10>-Footnote-23600444
Ref: ドキュメント<10>-Footnote-33600500
Node: Core and Builtins<27>3600555
Ref: whatsnew/changelog id1233600693
Ref: 189a3600693
Ref: Core and Builtins<27>-Footnote-13605255
Ref: Core and Builtins<27>-Footnote-23605311
Ref: Core and Builtins<27>-Footnote-33605367
Ref: Core and Builtins<27>-Footnote-43605423
Ref: Core and Builtins<27>-Footnote-53605479
Ref: Core and Builtins<27>-Footnote-63605535
Ref: Core and Builtins<27>-Footnote-73605591
Ref: Core and Builtins<27>-Footnote-83605647
Ref: Core and Builtins<27>-Footnote-93605703
Ref: Core and Builtins<27>-Footnote-103605759
Ref: Core and Builtins<27>-Footnote-113605816
Ref: Core and Builtins<27>-Footnote-123605873
Ref: Core and Builtins<27>-Footnote-133605930
Ref: Core and Builtins<27>-Footnote-143605987
Ref: Core and Builtins<27>-Footnote-153606044
Ref: Core and Builtins<27>-Footnote-163606101
Ref: Core and Builtins<27>-Footnote-173606158
Ref: Core and Builtins<27>-Footnote-183606215
Ref: Core and Builtins<27>-Footnote-193606272
Ref: Core and Builtins<27>-Footnote-203606329
Ref: Core and Builtins<27>-Footnote-213606386
Ref: Core and Builtins<27>-Footnote-223606445
Ref: Core and Builtins<27>-Footnote-233606502
Ref: Core and Builtins<27>-Footnote-243606559
Ref: Core and Builtins<27>-Footnote-253606616
Ref: Core and Builtins<27>-Footnote-263606673
Ref: Core and Builtins<27>-Footnote-273606730
Ref: Core and Builtins<27>-Footnote-283606787
Ref: Core and Builtins<27>-Footnote-293606844
Ref: Core and Builtins<27>-Footnote-303606887
Ref: Core and Builtins<27>-Footnote-313606944
Ref: Core and Builtins<27>-Footnote-323607000
Node: ライブラリ<31>3607057
Ref: whatsnew/changelog id1243607194
Ref: 189c3607194
Ref: ライブラリ<31>-Footnote-13607348
Node: Core and Builtins<28>3607404
Ref: whatsnew/changelog id1253607539
Ref: 189d3607539
Ref: Core and Builtins<28>-Footnote-13610237
Ref: Core and Builtins<28>-Footnote-23610293
Ref: Core and Builtins<28>-Footnote-33610349
Ref: Core and Builtins<28>-Footnote-43610405
Ref: Core and Builtins<28>-Footnote-53610461
Ref: Core and Builtins<28>-Footnote-63610517
Ref: Core and Builtins<28>-Footnote-73610573
Ref: Core and Builtins<28>-Footnote-83610629
Ref: Core and Builtins<28>-Footnote-93610685
Ref: Core and Builtins<28>-Footnote-103610741
Ref: Core and Builtins<28>-Footnote-113610798
Ref: Core and Builtins<28>-Footnote-123610855
Ref: Core and Builtins<28>-Footnote-133610911
Ref: Core and Builtins<28>-Footnote-143610968
Node: ライブラリ<32>3611025
Ref: whatsnew/changelog id1263611162
Ref: 189f3611162
Ref: ライブラリ<32>-Footnote-13611434
Node: Core and Builtins<29>3611490
Ref: whatsnew/changelog id1273611615
Ref: 18a03611615
Ref: Core and Builtins<29>-Footnote-13611812
Node: C API<10>3611877
Ref: whatsnew/changelog id1283611996
Ref: 18a13611996
Ref: C API<10>-Footnote-13614378
Ref: C API<10>-Footnote-23614434
Ref: C API<10>-Footnote-33614490
Ref: C API<10>-Footnote-43614546
Ref: C API<10>-Footnote-53614599
Node: ビルド<10>3614654
Ref: whatsnew/changelog id1293614743
Ref: 18a33614743
Ref: ビルド<10>-Footnote-13615869
Ref: ビルド<10>-Footnote-23615925
Ref: ビルド<10>-Footnote-33615981
Ref: ビルド<10>-Footnote-43616037
Ref: ビルド<10>-Footnote-53616093
Ref: ビルド<10>-Footnote-63616149
Ref: ビルド<10>-Footnote-73616205
Node: Python 3 14 0 alpha 53616260
Ref: whatsnew/changelog python-3-14-0-alpha-53616390
Ref: 18a43616390
Node: macOS<6>3617016
Ref: whatsnew/changelog id1303617106
Ref: 18a53617106
Ref: macOS<6>-Footnote-13617237
Node: Tools/Demos<11>3617292
Ref: whatsnew/changelog id1313617403
Ref: 18a63617403
Ref: Tools/Demos<11>-Footnote-13617702
Ref: Tools/Demos<11>-Footnote-23617758
Node: テスト<9>3617814
Ref: whatsnew/changelog id1323617939
Ref: 18a73617939
Ref: テスト<9>-Footnote-13618676
Ref: テスト<9>-Footnote-23618732
Ref: テスト<9>-Footnote-33618788
Node: セキュリティ<13>3618844
Ref: whatsnew/changelog id1333618973
Ref: 18a83618973
Ref: セキュリティ<13>-Footnote-13620542
Ref: セキュリティ<13>-Footnote-23620598
Ref: セキュリティ<13>-Footnote-33620659
Ref: セキュリティ<13>-Footnote-43620715
Ref: セキュリティ<13>-Footnote-53620770
Node: ライブラリ<33>3620826
Ref: whatsnew/changelog id1343620950
Ref: 18a93620950
Ref: ライブラリ<33>-Footnote-13632591
Ref: ライブラリ<33>-Footnote-23632647
Ref: ライブラリ<33>-Footnote-33632703
Ref: ライブラリ<33>-Footnote-43632759
Ref: ライブラリ<33>-Footnote-53632815
Ref: ライブラリ<33>-Footnote-63632871
Ref: ライブラリ<33>-Footnote-73632927
Ref: ライブラリ<33>-Footnote-83632983
Ref: ライブラリ<33>-Footnote-93633039
Ref: ライブラリ<33>-Footnote-103633095
Ref: ライブラリ<33>-Footnote-113633152
Ref: ライブラリ<33>-Footnote-123633209
Ref: ライブラリ<33>-Footnote-133633266
Ref: ライブラリ<33>-Footnote-143633323
Ref: ライブラリ<33>-Footnote-153633380
Ref: ライブラリ<33>-Footnote-163633437
Ref: ライブラリ<33>-Footnote-173633494
Ref: ライブラリ<33>-Footnote-183633551
Ref: ライブラリ<33>-Footnote-193633608
Ref: ライブラリ<33>-Footnote-203633665
Ref: ライブラリ<33>-Footnote-213633722
Ref: ライブラリ<33>-Footnote-223633779
Ref: ライブラリ<33>-Footnote-233633835
Ref: ライブラリ<33>-Footnote-243633892
Ref: ライブラリ<33>-Footnote-253633949
Ref: ライブラリ<33>-Footnote-263634006
Ref: ライブラリ<33>-Footnote-273634063
Ref: ライブラリ<33>-Footnote-283634120
Ref: ライブラリ<33>-Footnote-293634177
Ref: ライブラリ<33>-Footnote-303634234
Ref: ライブラリ<33>-Footnote-313634291
Ref: ライブラリ<33>-Footnote-323634348
Ref: ライブラリ<33>-Footnote-333634405
Ref: ライブラリ<33>-Footnote-343634462
Ref: ライブラリ<33>-Footnote-353634519
Ref: ライブラリ<33>-Footnote-363634576
Ref: ライブラリ<33>-Footnote-373634633
Ref: ライブラリ<33>-Footnote-383634690
Ref: ライブラリ<33>-Footnote-393634747
Ref: ライブラリ<33>-Footnote-403634804
Ref: ライブラリ<33>-Footnote-413634861
Ref: ライブラリ<33>-Footnote-423634918
Ref: ライブラリ<33>-Footnote-433634975
Ref: ライブラリ<33>-Footnote-443635032
Ref: ライブラリ<33>-Footnote-453635089
Ref: ライブラリ<33>-Footnote-463635146
Ref: ライブラリ<33>-Footnote-473635203
Ref: ライブラリ<33>-Footnote-483635263
Ref: ライブラリ<33>-Footnote-493635319
Ref: ライブラリ<33>-Footnote-503635376
Ref: ライブラリ<33>-Footnote-513635432
Ref: ライブラリ<33>-Footnote-523635489
Ref: ライブラリ<33>-Footnote-533635546
Ref: ライブラリ<33>-Footnote-543635603
Ref: ライブラリ<33>-Footnote-553635660
Ref: ライブラリ<33>-Footnote-563635717
Ref: ライブラリ<33>-Footnote-573635774
Ref: ライブラリ<33>-Footnote-583635831
Ref: ライブラリ<33>-Footnote-593635888
Ref: ライブラリ<33>-Footnote-603635945
Ref: ライブラリ<33>-Footnote-613636002
Ref: ライブラリ<33>-Footnote-623636059
Ref: ライブラリ<33>-Footnote-633636115
Ref: ライブラリ<33>-Footnote-643636172
Ref: ライブラリ<33>-Footnote-653636229
Ref: ライブラリ<33>-Footnote-663636286
Ref: ライブラリ<33>-Footnote-673636342
Ref: ライブラリ<33>-Footnote-683636399
Ref: ライブラリ<33>-Footnote-693636456
Ref: ライブラリ<33>-Footnote-703636512
Node: IDLE<6>3636578
Ref: whatsnew/changelog id1353636702
Ref: 18b53636702
Ref: IDLE<6>-Footnote-13636924
Node: ドキュメント<11>3636980
Ref: whatsnew/changelog id1363637106
Ref: 18b63637106
Ref: ドキュメント<11>-Footnote-13637534
Ref: ドキュメント<11>-Footnote-23637590
Node: Core and Builtins<30>3637645
Ref: whatsnew/changelog id1373637783
Ref: 18b83637783
Ref: Core and Builtins<30>-Footnote-13638893
Ref: Core and Builtins<30>-Footnote-23638949
Ref: Core and Builtins<30>-Footnote-33639005
Ref: Core and Builtins<30>-Footnote-43639061
Ref: Core and Builtins<30>-Footnote-53639117
Ref: Core and Builtins<30>-Footnote-63639173
Ref: Core and Builtins<30>-Footnote-73639229
Ref: Core and Builtins<30>-Footnote-83639285
Ref: Core and Builtins<30>-Footnote-93639341
Node: ライブラリ<34>3639397
Ref: whatsnew/changelog id1383639534
Ref: 18bb3639534
Ref: ライブラリ<34>-Footnote-13639744
Node: Core and Builtins<31>3639800
Ref: whatsnew/changelog id1393639935
Ref: 18bc3639935
Ref: Core and Builtins<31>-Footnote-13644489
Ref: Core and Builtins<31>-Footnote-23644545
Ref: Core and Builtins<31>-Footnote-33644601
Ref: Core and Builtins<31>-Footnote-43644657
Ref: Core and Builtins<31>-Footnote-53644713
Ref: Core and Builtins<31>-Footnote-63644769
Ref: Core and Builtins<31>-Footnote-73644825
Ref: Core and Builtins<31>-Footnote-83644881
Ref: Core and Builtins<31>-Footnote-93644937
Ref: Core and Builtins<31>-Footnote-103644993
Ref: Core and Builtins<31>-Footnote-113645050
Ref: Core and Builtins<31>-Footnote-123645107
Ref: Core and Builtins<31>-Footnote-133645164
Ref: Core and Builtins<31>-Footnote-143645221
Ref: Core and Builtins<31>-Footnote-153645278
Ref: Core and Builtins<31>-Footnote-163645335
Ref: Core and Builtins<31>-Footnote-173645392
Ref: Core and Builtins<31>-Footnote-183645449
Ref: Core and Builtins<31>-Footnote-193645506
Ref: Core and Builtins<31>-Footnote-203645563
Ref: Core and Builtins<31>-Footnote-213645620
Ref: Core and Builtins<31>-Footnote-223645677
Ref: Core and Builtins<31>-Footnote-233645734
Ref: Core and Builtins<31>-Footnote-243645791
Node: ライブラリ<35>3645848
Ref: whatsnew/changelog id1403645985
Ref: 18c53645985
Ref: ライブラリ<35>-Footnote-13646257
Node: Core and Builtins<32>3646313
Ref: whatsnew/changelog id1413646448
Ref: 18c63646448
Ref: Core and Builtins<32>-Footnote-13646732
Node: ライブラリ<36>3646788
Ref: whatsnew/changelog id1423646913
Ref: 18c73646913
Ref: ライブラリ<36>-Footnote-13647103
Node: C API<11>3647159
Ref: whatsnew/changelog id1433647276
Ref: 18c83647276
Ref: C API<11>-Footnote-13650472
Ref: C API<11>-Footnote-23650528
Ref: C API<11>-Footnote-33650583
Ref: C API<11>-Footnote-43650638
Ref: C API<11>-Footnote-53650694
Ref: C API<11>-Footnote-63650750
Ref: C API<11>-Footnote-73650792
Ref: C API<11>-Footnote-83650848
Ref: C API<11>-Footnote-93650890
Ref: C API<11>-Footnote-103650946
Ref: C API<11>-Footnote-113651003
Ref: C API<11>-Footnote-123651060
Ref: C API<11>-Footnote-133651114
Ref: C API<11>-Footnote-143651171
Ref: C API<11>-Footnote-153651228
Node: ビルド<11>3651271
Ref: whatsnew/changelog id1443651360
Ref: 18cb3651360
Ref: ビルド<11>-Footnote-13651697
Ref: ビルド<11>-Footnote-23651753
Node: Python 3 14 0 alpha 43651809
Ref: whatsnew/changelog python-3-14-0-alpha-43651939
Ref: 18cc3651939
Node: macOS<7>3652417
Ref: whatsnew/changelog id1453652507
Ref: 18cd3652507
Ref: macOS<7>-Footnote-13652711
Node: Tools/Demos<12>3652767
Ref: whatsnew/changelog id1463652879
Ref: 18ce3652879
Ref: Tools/Demos<12>-Footnote-13653131
Node: テスト<10>3653187
Ref: whatsnew/changelog id1473653310
Ref: 18cf3653310
Ref: テスト<10>-Footnote-13653558
Node: ライブラリ<37>3653614
Ref: whatsnew/changelog id1483653743
Ref: 18d03653743
Ref: ライブラリ<37>-Footnote-13662293
Ref: ライブラリ<37>-Footnote-23662349
Ref: ライブラリ<37>-Footnote-33662404
Ref: ライブラリ<37>-Footnote-43662460
Ref: ライブラリ<37>-Footnote-53662516
Ref: ライブラリ<37>-Footnote-63662572
Ref: ライブラリ<37>-Footnote-73662628
Ref: ライブラリ<37>-Footnote-83662684
Ref: ライブラリ<37>-Footnote-93662740
Ref: ライブラリ<37>-Footnote-103662796
Ref: ライブラリ<37>-Footnote-113662853
Ref: ライブラリ<37>-Footnote-123662910
Ref: ライブラリ<37>-Footnote-133662967
Ref: ライブラリ<37>-Footnote-143663023
Ref: ライブラリ<37>-Footnote-153663080
Ref: ライブラリ<37>-Footnote-163663137
Ref: ライブラリ<37>-Footnote-173663194
Ref: ライブラリ<37>-Footnote-183663251
Ref: ライブラリ<37>-Footnote-193663308
Ref: ライブラリ<37>-Footnote-203663365
Ref: ライブラリ<37>-Footnote-213663422
Ref: ライブラリ<37>-Footnote-223663479
Ref: ライブラリ<37>-Footnote-233663535
Ref: ライブラリ<37>-Footnote-243663592
Ref: ライブラリ<37>-Footnote-253663649
Ref: ライブラリ<37>-Footnote-263663697
Ref: ライブラリ<37>-Footnote-273663742
Ref: ライブラリ<37>-Footnote-283663799
Ref: ライブラリ<37>-Footnote-293663856
Ref: ライブラリ<37>-Footnote-303663913
Ref: ライブラリ<37>-Footnote-313663969
Ref: ライブラリ<37>-Footnote-323664026
Ref: ライブラリ<37>-Footnote-333664082
Ref: ライブラリ<37>-Footnote-343664139
Ref: ライブラリ<37>-Footnote-353664196
Ref: ライブラリ<37>-Footnote-363664253
Ref: ライブラリ<37>-Footnote-373664310
Ref: ライブラリ<37>-Footnote-383664367
Ref: ライブラリ<37>-Footnote-393664424
Ref: ライブラリ<37>-Footnote-403664481
Ref: ライブラリ<37>-Footnote-413664538
Ref: ライブラリ<37>-Footnote-423664595
Ref: ライブラリ<37>-Footnote-433664652
Ref: ライブラリ<37>-Footnote-443664709
Ref: ライブラリ<37>-Footnote-453664766
Node: Core and Builtins<33>3664822
Ref: whatsnew/changelog id1493664957
Ref: 18d53664957
Ref: Core and Builtins<33>-Footnote-13665769
Ref: Core and Builtins<33>-Footnote-23665825
Ref: Core and Builtins<33>-Footnote-33665881
Ref: Core and Builtins<33>-Footnote-43665937
Ref: Core and Builtins<33>-Footnote-53665993
Node: ライブラリ<38>3666049
Ref: whatsnew/changelog id1503666186
Ref: 18d63666186
Ref: ライブラリ<38>-Footnote-13666449
Ref: ライブラリ<38>-Footnote-23666505
Node: Core and Builtins<34>3666564
Ref: whatsnew/changelog id1513666699
Ref: 18d73666699
Ref: Core and Builtins<34>-Footnote-13667813
Ref: Core and Builtins<34>-Footnote-23667869
Ref: Core and Builtins<34>-Footnote-33667925
Ref: Core and Builtins<34>-Footnote-43667981
Ref: Core and Builtins<34>-Footnote-53668037
Node: ライブラリ<39>3668093
Ref: whatsnew/changelog id1523668230
Ref: 18d93668230
Ref: ライブラリ<39>-Footnote-13668508
Node: Core and Builtins<35>3668564
Ref: whatsnew/changelog id1533668689
Ref: 18da3668689
Ref: Core and Builtins<35>-Footnote-13670150
Ref: Core and Builtins<35>-Footnote-23670206
Ref: Core and Builtins<35>-Footnote-33670261
Ref: Core and Builtins<35>-Footnote-43670317
Ref: Core and Builtins<35>-Footnote-53670397
Ref: Core and Builtins<35>-Footnote-63670453
Ref: Core and Builtins<35>-Footnote-73670509
Ref: Core and Builtins<35>-Footnote-83670565
Node: C API<12>3670621
Ref: whatsnew/changelog id1543670740
Ref: 18de3670740
Ref: C API<12>-Footnote-13671545
Ref: C API<12>-Footnote-23671601
Ref: C API<12>-Footnote-33671657
Ref: C API<12>-Footnote-43671713
Node: ビルド<12>3671769
Ref: whatsnew/changelog id1553671858
Ref: 18e03671858
Ref: ビルド<12>-Footnote-13673370
Ref: ビルド<12>-Footnote-23673426
Ref: ビルド<12>-Footnote-33673482
Ref: ビルド<12>-Footnote-43673538
Ref: ビルド<12>-Footnote-53673594
Ref: ビルド<12>-Footnote-63673649
Ref: ビルド<12>-Footnote-73673705
Ref: ビルド<12>-Footnote-83673761
Ref: ビルド<12>-Footnote-93673817
Ref: ビルド<12>-Footnote-103673865
Node: Python 3 14 0 alpha 33673922
Ref: whatsnew/changelog python-3-14-0-alpha-33674052
Ref: 18e13674052
Node: Windows<12>3674543
Ref: whatsnew/changelog id1563674636
Ref: 18e23674636
Ref: Windows<12>-Footnote-13675035
Ref: Windows<12>-Footnote-23675091
Node: Tools/Demos<13>3675147
Ref: whatsnew/changelog id1573675262
Ref: 18e33675262
Ref: Tools/Demos<13>-Footnote-13675451
Node: テスト<11>3675507
Ref: whatsnew/changelog id1583675633
Ref: 18e43675633
Ref: テスト<11>-Footnote-13676307
Ref: テスト<11>-Footnote-23676363
Ref: テスト<11>-Footnote-33676419
Ref: テスト<11>-Footnote-43676475
Ref: テスト<11>-Footnote-53676531
Node: セキュリティ<14>3676587
Ref: whatsnew/changelog id1593676717
Ref: 18e53676717
Ref: セキュリティ<14>-Footnote-13677061
Node: ライブラリ<40>3677117
Ref: whatsnew/changelog id1603677256
Ref: 18e63677256
Ref: ライブラリ<40>-Footnote-13687825
Ref: ライブラリ<40>-Footnote-23687881
Ref: ライブラリ<40>-Footnote-33687937
Ref: ライブラリ<40>-Footnote-43687993
Ref: ライブラリ<40>-Footnote-53688049
Ref: ライブラリ<40>-Footnote-63688105
Ref: ライブラリ<40>-Footnote-73688161
Ref: ライブラリ<40>-Footnote-83688217
Ref: ライブラリ<40>-Footnote-93688273
Ref: ライブラリ<40>-Footnote-103688328
Ref: ライブラリ<40>-Footnote-113688385
Ref: ライブラリ<40>-Footnote-123688442
Ref: ライブラリ<40>-Footnote-133688499
Ref: ライブラリ<40>-Footnote-143688556
Ref: ライブラリ<40>-Footnote-153688613
Ref: ライブラリ<40>-Footnote-163688670
Ref: ライブラリ<40>-Footnote-173688727
Ref: ライブラリ<40>-Footnote-183688783
Ref: ライブラリ<40>-Footnote-193688840
Ref: ライブラリ<40>-Footnote-203688897
Ref: ライブラリ<40>-Footnote-213688954
Ref: ライブラリ<40>-Footnote-223689011
Ref: ライブラリ<40>-Footnote-233689068
Ref: ライブラリ<40>-Footnote-243689125
Ref: ライブラリ<40>-Footnote-253689182
Ref: ライブラリ<40>-Footnote-263689239
Ref: ライブラリ<40>-Footnote-273689296
Ref: ライブラリ<40>-Footnote-283689353
Ref: ライブラリ<40>-Footnote-293689410
Ref: ライブラリ<40>-Footnote-303689467
Ref: ライブラリ<40>-Footnote-313689524
Ref: ライブラリ<40>-Footnote-323689581
Ref: ライブラリ<40>-Footnote-333689638
Ref: ライブラリ<40>-Footnote-343689695
Ref: ライブラリ<40>-Footnote-353689752
Ref: ライブラリ<40>-Footnote-363689809
Ref: ライブラリ<40>-Footnote-373689866
Ref: ライブラリ<40>-Footnote-383689923
Ref: ライブラリ<40>-Footnote-393689980
Ref: ライブラリ<40>-Footnote-403690037
Ref: ライブラリ<40>-Footnote-413690094
Ref: ライブラリ<40>-Footnote-423690151
Ref: ライブラリ<40>-Footnote-433690208
Ref: ライブラリ<40>-Footnote-443690265
Ref: ライブラリ<40>-Footnote-453690322
Ref: ライブラリ<40>-Footnote-463690379
Ref: ライブラリ<40>-Footnote-473690435
Ref: ライブラリ<40>-Footnote-483690492
Ref: ライブラリ<40>-Footnote-493690549
Ref: ライブラリ<40>-Footnote-503690606
Ref: ライブラリ<40>-Footnote-513690663
Ref: ライブラリ<40>-Footnote-523690719
Ref: ライブラリ<40>-Footnote-533690776
Ref: ライブラリ<40>-Footnote-543690832
Ref: ライブラリ<40>-Footnote-553690889
Ref: ライブラリ<40>-Footnote-563690946
Ref: ライブラリ<40>-Footnote-573691005
Ref: ライブラリ<40>-Footnote-583691065
Ref: ライブラリ<40>-Footnote-593691122
Ref: ライブラリ<40>-Footnote-603691179
Ref: ライブラリ<40>-Footnote-613691236
Ref: ライブラリ<40>-Footnote-623691292
Ref: ライブラリ<40>-Footnote-633691348
Node: ドキュメント<12>3691404
Ref: whatsnew/changelog id1613691542
Ref: 18ee3691542
Ref: ドキュメント<12>-Footnote-13691736
Node: Core and Builtins<36>3691792
Ref: whatsnew/changelog id1623691930
Ref: 18f03691930
Ref: Core and Builtins<36>-Footnote-13693483
Ref: Core and Builtins<36>-Footnote-23693539
Ref: Core and Builtins<36>-Footnote-33693595
Ref: Core and Builtins<36>-Footnote-43693651
Ref: Core and Builtins<36>-Footnote-53693707
Ref: Core and Builtins<36>-Footnote-63693763
Ref: Core and Builtins<36>-Footnote-73693819
Ref: Core and Builtins<36>-Footnote-83693875
Ref: Core and Builtins<36>-Footnote-93693931
Ref: Core and Builtins<36>-Footnote-103693987
Node: ライブラリ<41>3694044
Ref: whatsnew/changelog id1633694181
Ref: 18f33694181
Ref: ライブラリ<41>-Footnote-13694782
Node: Core and Builtins<37>3694838
Ref: whatsnew/changelog id1643694963
Ref: 18f43694963
Ref: Core and Builtins<37>-Footnote-13697725
Ref: Core and Builtins<37>-Footnote-23697781
Ref: Core and Builtins<37>-Footnote-33697837
Ref: Core and Builtins<37>-Footnote-43697893
Ref: Core and Builtins<37>-Footnote-53697949
Ref: Core and Builtins<37>-Footnote-63698005
Ref: Core and Builtins<37>-Footnote-73698061
Ref: Core and Builtins<37>-Footnote-83698117
Ref: Core and Builtins<37>-Footnote-93698173
Ref: Core and Builtins<37>-Footnote-103698229
Ref: Core and Builtins<37>-Footnote-113698286
Ref: Core and Builtins<37>-Footnote-123698343
Ref: Core and Builtins<37>-Footnote-133698400
Ref: Core and Builtins<37>-Footnote-143698457
Ref: Core and Builtins<37>-Footnote-153698513
Ref: Core and Builtins<37>-Footnote-163698570
Node: C API<13>3698627
Ref: whatsnew/changelog id1653698746
Ref: 18f93698746
Ref: C API<13>-Footnote-13701092
Ref: C API<13>-Footnote-23701148
Ref: C API<13>-Footnote-33701204
Ref: C API<13>-Footnote-43701260
Ref: C API<13>-Footnote-53701316
Ref: C API<13>-Footnote-63701372
Ref: C API<13>-Footnote-73701428
Ref: C API<13>-Footnote-83701484
Ref: C API<13>-Footnote-93701540
Ref: C API<13>-Footnote-103701582
Node: ビルド<13>3701639
Ref: whatsnew/changelog id1663701728
Ref: 18ff3701728
Ref: ビルド<13>-Footnote-13702280
Ref: ビルド<13>-Footnote-23702336
Ref: ビルド<13>-Footnote-33702392
Ref: ビルド<13>-Footnote-43702448
Ref: ビルド<13>-Footnote-53702504
Node: Python 3 14 0 alpha 23702560
Ref: whatsnew/changelog python-3-14-0-alpha-23702690
Ref: 19003702690
Node: Windows<13>3703305
Ref: whatsnew/changelog id1673703398
Ref: 19013703398
Ref: Windows<13>-Footnote-13704504
Ref: Windows<13>-Footnote-23704560
Ref: Windows<13>-Footnote-33704616
Ref: Windows<13>-Footnote-43704672
Ref: Windows<13>-Footnote-53704728
Ref: Windows<13>-Footnote-63704784
Ref: Windows<13>-Footnote-73704840
Ref: Windows<13>-Footnote-83704896
Ref: Windows<13>-Footnote-93704952
Node: Tools/Demos<14>3705008
Ref: whatsnew/changelog id1683705123
Ref: 19023705123
Ref: Tools/Demos<14>-Footnote-13705459
Ref: Tools/Demos<14>-Footnote-23705515
Node: テスト<12>3705571
Ref: whatsnew/changelog id1693705697
Ref: 19033705697
Ref: テスト<12>-Footnote-13706102
Ref: テスト<12>-Footnote-23706158
Ref: テスト<12>-Footnote-33706214
Node: セキュリティ<15>3706270
Ref: whatsnew/changelog id1703706400
Ref: 19043706400
Ref: セキュリティ<15>-Footnote-13706535
Node: ライブラリ<42>3706591
Ref: whatsnew/changelog id1713706730
Ref: 19053706730
Ref: ライブラリ<42>-Footnote-13725012
Ref: ライブラリ<42>-Footnote-23725067
Ref: ライブラリ<42>-Footnote-33725123
Ref: ライブラリ<42>-Footnote-43725178
Ref: ライブラリ<42>-Footnote-53725234
Ref: ライブラリ<42>-Footnote-63725290
Ref: ライブラリ<42>-Footnote-73725346
Ref: ライブラリ<42>-Footnote-83725402
Ref: ライブラリ<42>-Footnote-93725458
Ref: ライブラリ<42>-Footnote-103725514
Ref: ライブラリ<42>-Footnote-113725571
Ref: ライブラリ<42>-Footnote-123725628
Ref: ライブラリ<42>-Footnote-133725685
Ref: ライブラリ<42>-Footnote-143725742
Ref: ライブラリ<42>-Footnote-153725799
Ref: ライブラリ<42>-Footnote-163725856
Ref: ライブラリ<42>-Footnote-173725913
Ref: ライブラリ<42>-Footnote-183725970
Ref: ライブラリ<42>-Footnote-193726027
Ref: ライブラリ<42>-Footnote-203726084
Ref: ライブラリ<42>-Footnote-213726141
Ref: ライブラリ<42>-Footnote-223726198
Ref: ライブラリ<42>-Footnote-233726254
Ref: ライブラリ<42>-Footnote-243726314
Ref: ライブラリ<42>-Footnote-253726371
Ref: ライブラリ<42>-Footnote-263726428
Ref: ライブラリ<42>-Footnote-273726485
Ref: ライブラリ<42>-Footnote-283726542
Ref: ライブラリ<42>-Footnote-293726599
Ref: ライブラリ<42>-Footnote-303726656
Ref: ライブラリ<42>-Footnote-313726713
Ref: ライブラリ<42>-Footnote-323726770
Ref: ライブラリ<42>-Footnote-333726827
Ref: ライブラリ<42>-Footnote-343726884
Ref: ライブラリ<42>-Footnote-353726941
Ref: ライブラリ<42>-Footnote-363726998
Ref: ライブラリ<42>-Footnote-373727055
Ref: ライブラリ<42>-Footnote-383727112
Ref: ライブラリ<42>-Footnote-393727169
Ref: ライブラリ<42>-Footnote-403727226
Ref: ライブラリ<42>-Footnote-413727283
Ref: ライブラリ<42>-Footnote-423727340
Ref: ライブラリ<42>-Footnote-433727397
Ref: ライブラリ<42>-Footnote-443727454
Ref: ライブラリ<42>-Footnote-453727511
Ref: ライブラリ<42>-Footnote-463727568
Ref: ライブラリ<42>-Footnote-473727625
Ref: ライブラリ<42>-Footnote-483727685
Ref: ライブラリ<42>-Footnote-493727742
Ref: ライブラリ<42>-Footnote-503727799
Ref: ライブラリ<42>-Footnote-513727856
Ref: ライブラリ<42>-Footnote-523727913
Ref: ライブラリ<42>-Footnote-533727970
Ref: ライブラリ<42>-Footnote-543728027
Ref: ライブラリ<42>-Footnote-553728084
Ref: ライブラリ<42>-Footnote-563728141
Ref: ライブラリ<42>-Footnote-573728198
Ref: ライブラリ<42>-Footnote-583728255
Ref: ライブラリ<42>-Footnote-593728311
Ref: ライブラリ<42>-Footnote-603728368
Ref: ライブラリ<42>-Footnote-613728425
Ref: ライブラリ<42>-Footnote-623728482
Ref: ライブラリ<42>-Footnote-633728539
Ref: ライブラリ<42>-Footnote-643728596
Ref: ライブラリ<42>-Footnote-653728653
Ref: ライブラリ<42>-Footnote-663728709
Ref: ライブラリ<42>-Footnote-673728766
Ref: ライブラリ<42>-Footnote-683728823
Ref: ライブラリ<42>-Footnote-693728880
Ref: ライブラリ<42>-Footnote-703728937
Ref: ライブラリ<42>-Footnote-713728994
Ref: ライブラリ<42>-Footnote-723729051
Ref: ライブラリ<42>-Footnote-733729108
Ref: ライブラリ<42>-Footnote-743729165
Ref: ライブラリ<42>-Footnote-753729222
Ref: ライブラリ<42>-Footnote-763729279
Ref: ライブラリ<42>-Footnote-773729336
Ref: ライブラリ<42>-Footnote-783729393
Ref: ライブラリ<42>-Footnote-793729449
Ref: ライブラリ<42>-Footnote-803729506
Ref: ライブラリ<42>-Footnote-813729563
Ref: ライブラリ<42>-Footnote-823729620
Ref: ライブラリ<42>-Footnote-833729663
Ref: ライブラリ<42>-Footnote-843729719
Ref: ライブラリ<42>-Footnote-853729775
Ref: ライブラリ<42>-Footnote-863729831
Ref: ライブラリ<42>-Footnote-873729888
Ref: ライブラリ<42>-Footnote-883729944
Ref: ライブラリ<42>-Footnote-893730001
Ref: ライブラリ<42>-Footnote-903730057
Ref: ライブラリ<42>-Footnote-913730117
Ref: ライブラリ<42>-Footnote-923730174
Ref: ライブラリ<42>-Footnote-933730231
Ref: ライブラリ<42>-Footnote-943730288
Ref: ライブラリ<42>-Footnote-953730344
Ref: ライブラリ<42>-Footnote-963730401
Ref: ライブラリ<42>-Footnote-973730458
Ref: ライブラリ<42>-Footnote-983730514
Ref: ライブラリ<42>-Footnote-993730571
Ref: ライブラリ<42>-Footnote-1003730628
Ref: ライブラリ<42>-Footnote-1013730686
Ref: ライブラリ<42>-Footnote-1023730743
Ref: ライブラリ<42>-Footnote-1033730810
Node: ドキュメント<13>3730867
Ref: whatsnew/changelog id1723731005
Ref: 19153731005
Ref: ドキュメント<13>-Footnote-13731557
Ref: ドキュメント<13>-Footnote-23731613
Ref: ドキュメント<13>-Footnote-33731669
Node: Core and Builtins<38>3731724
Ref: whatsnew/changelog id1733731862
Ref: 19163731862
Ref: Core and Builtins<38>-Footnote-13732431
Ref: Core and Builtins<38>-Footnote-23732487
Ref: Core and Builtins<38>-Footnote-33732543
Node: ライブラリ<43>3732599
Ref: whatsnew/changelog id1743732736
Ref: 19173732736
Ref: ライブラリ<43>-Footnote-13733013
Node: Core and Builtins<39>3733069
Ref: whatsnew/changelog id1753733204
Ref: 19183733204
Ref: Core and Builtins<39>-Footnote-13733626
Ref: Core and Builtins<39>-Footnote-23733682
Node: ライブラリ<44>3733738
Ref: whatsnew/changelog id1763733875
Ref: 19193733875
Ref: ライブラリ<44>-Footnote-13734188
Node: Core and Builtins<40>3734244
Ref: whatsnew/changelog id1773734379
Ref: 191a3734379
Ref: Core and Builtins<40>-Footnote-13739069
Ref: Core and Builtins<40>-Footnote-23739125
Ref: Core and Builtins<40>-Footnote-33739181
Ref: Core and Builtins<40>-Footnote-43739237
Ref: Core and Builtins<40>-Footnote-53739293
Ref: Core and Builtins<40>-Footnote-63739349
Ref: Core and Builtins<40>-Footnote-73739405
Ref: Core and Builtins<40>-Footnote-83739461
Ref: Core and Builtins<40>-Footnote-93739517
Ref: Core and Builtins<40>-Footnote-103739572
Ref: Core and Builtins<40>-Footnote-113739629
Ref: Core and Builtins<40>-Footnote-123739686
Ref: Core and Builtins<40>-Footnote-133739743
Ref: Core and Builtins<40>-Footnote-143739800
Ref: Core and Builtins<40>-Footnote-153739857
Ref: Core and Builtins<40>-Footnote-163739914
Ref: Core and Builtins<40>-Footnote-173739971
Ref: Core and Builtins<40>-Footnote-183740028
Ref: Core and Builtins<40>-Footnote-193740085
Ref: Core and Builtins<40>-Footnote-203740142
Ref: Core and Builtins<40>-Footnote-213740199
Ref: Core and Builtins<40>-Footnote-223740256
Ref: Core and Builtins<40>-Footnote-233740313
Ref: Core and Builtins<40>-Footnote-243740370
Ref: Core and Builtins<40>-Footnote-253740427
Ref: Core and Builtins<40>-Footnote-263740484
Ref: Core and Builtins<40>-Footnote-273740541
Node: ライブラリ<45>3740598
Ref: whatsnew/changelog id1783740723
Ref: 191c3740723
Ref: ライブラリ<45>-Footnote-13741082
Ref: ライブラリ<45>-Footnote-23741138
Node: C API<14>3741194
Ref: whatsnew/changelog id1793741311
Ref: 191d3741311
Ref: C API<14>-Footnote-13742322
Ref: C API<14>-Footnote-23742378
Ref: C API<14>-Footnote-33742434
Ref: C API<14>-Footnote-43742490
Ref: C API<14>-Footnote-53742546
Ref: C API<14>-Footnote-63742588
Ref: C API<14>-Footnote-73742644
Node: ビルド<14>3742700
Ref: whatsnew/changelog id1803742789
Ref: 191e3742789
Ref: ビルド<14>-Footnote-13744406
Ref: ビルド<14>-Footnote-23744462
Ref: ビルド<14>-Footnote-33744518
Ref: ビルド<14>-Footnote-43744574
Ref: ビルド<14>-Footnote-53744629
Ref: ビルド<14>-Footnote-63744685
Ref: ビルド<14>-Footnote-73744741
Ref: ビルド<14>-Footnote-83744797
Ref: ビルド<14>-Footnote-93744853
Ref: ビルド<14>-Footnote-103744909
Ref: ビルド<14>-Footnote-113744975
Ref: ビルド<14>-Footnote-123745031
Ref: ビルド<14>-Footnote-133745088
Node: Python 3 14 0 alpha 13745145
Ref: whatsnew/changelog python-3-14-0-alpha-13745274
Ref: 191f3745274
Node: macOS<8>3746305
Ref: whatsnew/changelog id1813746391
Ref: 19203746391
Ref: macOS<8>-Footnote-13746699
Ref: macOS<8>-Footnote-23746755
Ref: macOS<8>-Footnote-33746811
Node: Windows<14>3746867
Ref: whatsnew/changelog id1823746977
Ref: 19213746977
Ref: Windows<14>-Footnote-13748805
Ref: Windows<14>-Footnote-23748861
Ref: Windows<14>-Footnote-33748917
Ref: Windows<14>-Footnote-43748973
Ref: Windows<14>-Footnote-53749029
Ref: Windows<14>-Footnote-63749085
Ref: Windows<14>-Footnote-73749141
Ref: Windows<14>-Footnote-83749197
Ref: Windows<14>-Footnote-93749253
Ref: Windows<14>-Footnote-103749309
Ref: Windows<14>-Footnote-113749366
Ref: Windows<14>-Footnote-123749423
Ref: Windows<14>-Footnote-133749480
Ref: Windows<14>-Footnote-143749537
Ref: Windows<14>-Footnote-153749594
Ref: Windows<14>-Footnote-163749651
Node: Tools/Demos<15>3749707
Ref: whatsnew/changelog id1833749822
Ref: 19223749822
Ref: Tools/Demos<15>-Footnote-13750028
Node: テスト<13>3750084
Ref: whatsnew/changelog id1843750210
Ref: 19233750210
Ref: テスト<13>-Footnote-13753291
Ref: テスト<13>-Footnote-23753347
Ref: テスト<13>-Footnote-33753403
Ref: テスト<13>-Footnote-43753459
Ref: テスト<13>-Footnote-53753515
Ref: テスト<13>-Footnote-63753571
Ref: テスト<13>-Footnote-73753627
Ref: テスト<13>-Footnote-83753682
Ref: テスト<13>-Footnote-93753737
Ref: テスト<13>-Footnote-103753793
Ref: テスト<13>-Footnote-113753850
Ref: テスト<13>-Footnote-123753907
Ref: テスト<13>-Footnote-133753964
Ref: テスト<13>-Footnote-143754021
Ref: テスト<13>-Footnote-153754078
Ref: テスト<13>-Footnote-163754135
Ref: テスト<13>-Footnote-173754192
Ref: テスト<13>-Footnote-183754249
Node: セキュリティ<16>3754306
Ref: whatsnew/changelog id1853754436
Ref: 19273754436
Ref: セキュリティ<16>-Footnote-13756761
Ref: セキュリティ<16>-Footnote-23756817
Ref: セキュリティ<16>-Footnote-33756873
Ref: セキュリティ<16>-Footnote-43756929
Ref: セキュリティ<16>-Footnote-53756985
Ref: セキュリティ<16>-Footnote-63757041
Ref: セキュリティ<16>-Footnote-73757097
Ref: セキュリティ<16>-Footnote-83757153
Ref: セキュリティ<16>-Footnote-93757209
Ref: セキュリティ<16>-Footnote-103757265
Ref: セキュリティ<16>-Footnote-113757322
Ref: セキュリティ<16>-Footnote-123757379
Ref: セキュリティ<16>-Footnote-133757436
Ref: セキュリティ<16>-Footnote-143757493
Node: ライブラリ<46>3757549
Ref: whatsnew/changelog id1863757673
Ref: 19283757673
Ref: ライブラリ<46>-Footnote-13812873
Ref: ライブラリ<46>-Footnote-23812929
Ref: ライブラリ<46>-Footnote-33812985
Ref: ライブラリ<46>-Footnote-43813040
Ref: ライブラリ<46>-Footnote-53813096
Ref: ライブラリ<46>-Footnote-63813151
Ref: ライブラリ<46>-Footnote-73813207
Ref: ライブラリ<46>-Footnote-83813263
Ref: ライブラリ<46>-Footnote-93813319
Ref: ライブラリ<46>-Footnote-103813375
Ref: ライブラリ<46>-Footnote-113813431
Ref: ライブラリ<46>-Footnote-123813488
Ref: ライブラリ<46>-Footnote-133813545
Ref: ライブラリ<46>-Footnote-143813602
Ref: ライブラリ<46>-Footnote-153813659
Ref: ライブラリ<46>-Footnote-163813716
Ref: ライブラリ<46>-Footnote-173813772
Ref: ライブラリ<46>-Footnote-183813829
Ref: ライブラリ<46>-Footnote-193813885
Ref: ライブラリ<46>-Footnote-203813942
Ref: ライブラリ<46>-Footnote-213813985
Ref: ライブラリ<46>-Footnote-223814042
Ref: ライブラリ<46>-Footnote-233814099
Ref: ライブラリ<46>-Footnote-243814155
Ref: ライブラリ<46>-Footnote-253814212
Ref: ライブラリ<46>-Footnote-263814268
Ref: ライブラリ<46>-Footnote-273814325
Ref: ライブラリ<46>-Footnote-283814381
Ref: ライブラリ<46>-Footnote-293814438
Ref: ライブラリ<46>-Footnote-303814495
Ref: ライブラリ<46>-Footnote-313814551
Ref: ライブラリ<46>-Footnote-323814608
Ref: ライブラリ<46>-Footnote-333814665
Ref: ライブラリ<46>-Footnote-343814722
Ref: ライブラリ<46>-Footnote-353814778
Ref: ライブラリ<46>-Footnote-363814835
Ref: ライブラリ<46>-Footnote-373814892
Ref: ライブラリ<46>-Footnote-383814948
Ref: ライブラリ<46>-Footnote-393815005
Ref: ライブラリ<46>-Footnote-403815061
Ref: ライブラリ<46>-Footnote-413815118
Ref: ライブラリ<46>-Footnote-423815175
Ref: ライブラリ<46>-Footnote-433815232
Ref: ライブラリ<46>-Footnote-443815288
Ref: ライブラリ<46>-Footnote-453815345
Ref: ライブラリ<46>-Footnote-463815402
Ref: ライブラリ<46>-Footnote-473815458
Ref: ライブラリ<46>-Footnote-483815515
Ref: ライブラリ<46>-Footnote-493815572
Ref: ライブラリ<46>-Footnote-503815629
Ref: ライブラリ<46>-Footnote-513815686
Ref: ライブラリ<46>-Footnote-523815743
Ref: ライブラリ<46>-Footnote-533815800
Ref: ライブラリ<46>-Footnote-543815856
Ref: ライブラリ<46>-Footnote-553815913
Ref: ライブラリ<46>-Footnote-563815969
Ref: ライブラリ<46>-Footnote-573816025
Ref: ライブラリ<46>-Footnote-583816081
Ref: ライブラリ<46>-Footnote-593816138
Ref: ライブラリ<46>-Footnote-603816194
Ref: ライブラリ<46>-Footnote-613816251
Ref: ライブラリ<46>-Footnote-623816308
Ref: ライブラリ<46>-Footnote-633816365
Ref: ライブラリ<46>-Footnote-643816421
Ref: ライブラリ<46>-Footnote-653816477
Ref: ライブラリ<46>-Footnote-663816533
Ref: ライブラリ<46>-Footnote-673816590
Ref: ライブラリ<46>-Footnote-683816647
Ref: ライブラリ<46>-Footnote-693816704
Ref: ライブラリ<46>-Footnote-703816761
Ref: ライブラリ<46>-Footnote-713816818
Ref: ライブラリ<46>-Footnote-723816875
Ref: ライブラリ<46>-Footnote-733816932
Ref: ライブラリ<46>-Footnote-743816989
Ref: ライブラリ<46>-Footnote-753817046
Ref: ライブラリ<46>-Footnote-763817102
Ref: ライブラリ<46>-Footnote-773817159
Ref: ライブラリ<46>-Footnote-783817216
Ref: ライブラリ<46>-Footnote-793817273
Ref: ライブラリ<46>-Footnote-803817330
Ref: ライブラリ<46>-Footnote-813817387
Ref: ライブラリ<46>-Footnote-823817444
Ref: ライブラリ<46>-Footnote-833817501
Ref: ライブラリ<46>-Footnote-843817558
Ref: ライブラリ<46>-Footnote-853817615
Ref: ライブラリ<46>-Footnote-863817672
Ref: ライブラリ<46>-Footnote-873817744
Ref: ライブラリ<46>-Footnote-883817801
Ref: ライブラリ<46>-Footnote-893817858
Ref: ライブラリ<46>-Footnote-903817915
Ref: ライブラリ<46>-Footnote-913817972
Ref: ライブラリ<46>-Footnote-923818029
Ref: ライブラリ<46>-Footnote-933818086
Ref: ライブラリ<46>-Footnote-943818143
Ref: ライブラリ<46>-Footnote-953818199
Ref: ライブラリ<46>-Footnote-963818256
Ref: ライブラリ<46>-Footnote-973818313
Ref: ライブラリ<46>-Footnote-983818369
Ref: ライブラリ<46>-Footnote-993818426
Ref: ライブラリ<46>-Footnote-1003818483
Ref: ライブラリ<46>-Footnote-1013818541
Ref: ライブラリ<46>-Footnote-1023818599
Ref: ライブラリ<46>-Footnote-1033818656
Ref: ライブラリ<46>-Footnote-1043818714
Ref: ライブラリ<46>-Footnote-1053818772
Ref: ライブラリ<46>-Footnote-1063818830
Ref: ライブラリ<46>-Footnote-1073818888
Ref: ライブラリ<46>-Footnote-1083818946
Ref: ライブラリ<46>-Footnote-1093819004
Ref: ライブラリ<46>-Footnote-1103819062
Ref: ライブラリ<46>-Footnote-1113819120
Ref: ライブラリ<46>-Footnote-1123819178
Ref: ライブラリ<46>-Footnote-1133819236
Ref: ライブラリ<46>-Footnote-1143819294
Ref: ライブラリ<46>-Footnote-1153819352
Ref: ライブラリ<46>-Footnote-1163819410
Ref: ライブラリ<46>-Footnote-1173819468
Ref: ライブラリ<46>-Footnote-1183819526
Ref: ライブラリ<46>-Footnote-1193819584
Ref: ライブラリ<46>-Footnote-1203819642
Ref: ライブラリ<46>-Footnote-1213819700
Ref: ライブラリ<46>-Footnote-1223819758
Ref: ライブラリ<46>-Footnote-1233819816
Ref: ライブラリ<46>-Footnote-1243819874
Ref: ライブラリ<46>-Footnote-1253819932
Ref: ライブラリ<46>-Footnote-1263819989
Ref: ライブラリ<46>-Footnote-1273820047
Ref: ライブラリ<46>-Footnote-1283820105
Ref: ライブラリ<46>-Footnote-1293820162
Ref: ライブラリ<46>-Footnote-1303820220
Ref: ライブラリ<46>-Footnote-1313820278
Ref: ライブラリ<46>-Footnote-1323820336
Ref: ライブラリ<46>-Footnote-1333820394
Ref: ライブラリ<46>-Footnote-1343820452
Ref: ライブラリ<46>-Footnote-1353820510
Ref: ライブラリ<46>-Footnote-1363820568
Ref: ライブラリ<46>-Footnote-1373820626
Ref: ライブラリ<46>-Footnote-1383820684
Ref: ライブラリ<46>-Footnote-1393820728
Ref: ライブラリ<46>-Footnote-1403820786
Ref: ライブラリ<46>-Footnote-1413820844
Ref: ライブラリ<46>-Footnote-1423820902
Ref: ライブラリ<46>-Footnote-1433820960
Ref: ライブラリ<46>-Footnote-1443821018
Ref: ライブラリ<46>-Footnote-1453821076
Ref: ライブラリ<46>-Footnote-1463821133
Ref: ライブラリ<46>-Footnote-1473821191
Ref: ライブラリ<46>-Footnote-1483821249
Ref: ライブラリ<46>-Footnote-1493821307
Ref: ライブラリ<46>-Footnote-1503821365
Ref: ライブラリ<46>-Footnote-1513821422
Ref: ライブラリ<46>-Footnote-1523821480
Ref: ライブラリ<46>-Footnote-1533821538
Ref: ライブラリ<46>-Footnote-1543821596
Ref: ライブラリ<46>-Footnote-1553821654
Ref: ライブラリ<46>-Footnote-1563821712
Ref: ライブラリ<46>-Footnote-1573821770
Ref: ライブラリ<46>-Footnote-1583821828
Ref: ライブラリ<46>-Footnote-1593821885
Ref: ライブラリ<46>-Footnote-1603821942
Ref: ライブラリ<46>-Footnote-1613822000
Ref: ライブラリ<46>-Footnote-1623822058
Ref: ライブラリ<46>-Footnote-1633822116
Ref: ライブラリ<46>-Footnote-1643822174
Ref: ライブラリ<46>-Footnote-1653822232
Ref: ライブラリ<46>-Footnote-1663822290
Ref: ライブラリ<46>-Footnote-1673822348
Ref: ライブラリ<46>-Footnote-1683822405
Ref: ライブラリ<46>-Footnote-1693822463
Ref: ライブラリ<46>-Footnote-1703822521
Ref: ライブラリ<46>-Footnote-1713822579
Ref: ライブラリ<46>-Footnote-1723822637
Ref: ライブラリ<46>-Footnote-1733822695
Ref: ライブラリ<46>-Footnote-1743822753
Ref: ライブラリ<46>-Footnote-1753822811
Ref: ライブラリ<46>-Footnote-1763822869
Ref: ライブラリ<46>-Footnote-1773822926
Ref: ライブラリ<46>-Footnote-1783822984
Ref: ライブラリ<46>-Footnote-1793823042
Ref: ライブラリ<46>-Footnote-1803823100
Ref: ライブラリ<46>-Footnote-1813823158
Ref: ライブラリ<46>-Footnote-1823823216
Ref: ライブラリ<46>-Footnote-1833823274
Ref: ライブラリ<46>-Footnote-1843823332
Ref: ライブラリ<46>-Footnote-1853823389
Ref: ライブラリ<46>-Footnote-1863823447
Ref: ライブラリ<46>-Footnote-1873823505
Ref: ライブラリ<46>-Footnote-1883823563
Ref: ライブラリ<46>-Footnote-1893823621
Ref: ライブラリ<46>-Footnote-1903823679
Ref: ライブラリ<46>-Footnote-1913823737
Ref: ライブラリ<46>-Footnote-1923823795
Ref: ライブラリ<46>-Footnote-1933823853
Ref: ライブラリ<46>-Footnote-1943823910
Ref: ライブラリ<46>-Footnote-1953823968
Ref: ライブラリ<46>-Footnote-1963824026
Ref: ライブラリ<46>-Footnote-1973824084
Ref: ライブラリ<46>-Footnote-1983824142
Ref: ライブラリ<46>-Footnote-1993824200
Ref: ライブラリ<46>-Footnote-2003824258
Ref: ライブラリ<46>-Footnote-2013824316
Ref: ライブラリ<46>-Footnote-2023824374
Ref: ライブラリ<46>-Footnote-2033824432
Ref: ライブラリ<46>-Footnote-2043824490
Ref: ライブラリ<46>-Footnote-2053824548
Ref: ライブラリ<46>-Footnote-2063824606
Ref: ライブラリ<46>-Footnote-2073824663
Ref: ライブラリ<46>-Footnote-2083824721
Ref: ライブラリ<46>-Footnote-2093824779
Ref: ライブラリ<46>-Footnote-2103824823
Ref: ライブラリ<46>-Footnote-2113824867
Ref: ライブラリ<46>-Footnote-2123824925
Ref: ライブラリ<46>-Footnote-2133824983
Ref: ライブラリ<46>-Footnote-2143825040
Ref: ライブラリ<46>-Footnote-2153825098
Ref: ライブラリ<46>-Footnote-2163825156
Ref: ライブラリ<46>-Footnote-2173825200
Ref: ライブラリ<46>-Footnote-2183825258
Ref: ライブラリ<46>-Footnote-2193825316
Ref: ライブラリ<46>-Footnote-2203825374
Ref: ライブラリ<46>-Footnote-2213825432
Ref: ライブラリ<46>-Footnote-2223825489
Ref: ライブラリ<46>-Footnote-2233825547
Ref: ライブラリ<46>-Footnote-2243825605
Ref: ライブラリ<46>-Footnote-2253825663
Ref: ライブラリ<46>-Footnote-2263825721
Ref: ライブラリ<46>-Footnote-2273825779
Ref: ライブラリ<46>-Footnote-2283825837
Ref: ライブラリ<46>-Footnote-2293825895
Ref: ライブラリ<46>-Footnote-2303825953
Ref: ライブラリ<46>-Footnote-2313826011
Ref: ライブラリ<46>-Footnote-2323826069
Ref: ライブラリ<46>-Footnote-2333826127
Ref: ライブラリ<46>-Footnote-2343826185
Ref: ライブラリ<46>-Footnote-2353826243
Ref: ライブラリ<46>-Footnote-2363826300
Ref: ライブラリ<46>-Footnote-2373826358
Ref: ライブラリ<46>-Footnote-2383826416
Ref: ライブラリ<46>-Footnote-2393826473
Ref: ライブラリ<46>-Footnote-2403826531
Ref: ライブラリ<46>-Footnote-2413826589
Ref: ライブラリ<46>-Footnote-2423826647
Ref: ライブラリ<46>-Footnote-2433826705
Ref: ライブラリ<46>-Footnote-2443826762
Ref: ライブラリ<46>-Footnote-2453826820
Ref: ライブラリ<46>-Footnote-2463826877
Ref: ライブラリ<46>-Footnote-2473826934
Ref: ライブラリ<46>-Footnote-2483826992
Ref: ライブラリ<46>-Footnote-2493827049
Ref: ライブラリ<46>-Footnote-2503827107
Ref: ライブラリ<46>-Footnote-2513827165
Ref: ライブラリ<46>-Footnote-2523827223
Ref: ライブラリ<46>-Footnote-2533827281
Ref: ライブラリ<46>-Footnote-2543827339
Ref: ライブラリ<46>-Footnote-2553827397
Ref: ライブラリ<46>-Footnote-2563827455
Ref: ライブラリ<46>-Footnote-2573827513
Ref: ライブラリ<46>-Footnote-2583827571
Ref: ライブラリ<46>-Footnote-2593827628
Ref: ライブラリ<46>-Footnote-2603827686
Ref: ライブラリ<46>-Footnote-2613827744
Ref: ライブラリ<46>-Footnote-2623827802
Ref: ライブラリ<46>-Footnote-2633827860
Ref: ライブラリ<46>-Footnote-2643827918
Ref: ライブラリ<46>-Footnote-2653827976
Ref: ライブラリ<46>-Footnote-2663828034
Ref: ライブラリ<46>-Footnote-2673828092
Ref: ライブラリ<46>-Footnote-2683828150
Ref: ライブラリ<46>-Footnote-2693828208
Ref: ライブラリ<46>-Footnote-2703828266
Ref: ライブラリ<46>-Footnote-2713828324
Ref: ライブラリ<46>-Footnote-2723828382
Ref: ライブラリ<46>-Footnote-2733828440
Ref: ライブラリ<46>-Footnote-2743828498
Ref: ライブラリ<46>-Footnote-2753828555
Ref: ライブラリ<46>-Footnote-2763828612
Ref: ライブラリ<46>-Footnote-2773828669
Ref: ライブラリ<46>-Footnote-2783828727
Ref: ライブラリ<46>-Footnote-2793828785
Ref: ライブラリ<46>-Footnote-2803828843
Ref: ライブラリ<46>-Footnote-2813828901
Ref: ライブラリ<46>-Footnote-2823828959
Ref: ライブラリ<46>-Footnote-2833829017
Ref: ライブラリ<46>-Footnote-2843829075
Ref: ライブラリ<46>-Footnote-2853829133
Ref: ライブラリ<46>-Footnote-2863829191
Ref: ライブラリ<46>-Footnote-2873829249
Ref: ライブラリ<46>-Footnote-2883829307
Ref: ライブラリ<46>-Footnote-2893829365
Ref: ライブラリ<46>-Footnote-2903829423
Ref: ライブラリ<46>-Footnote-2913829480
Ref: ライブラリ<46>-Footnote-2923829538
Ref: ライブラリ<46>-Footnote-2933829595
Ref: ライブラリ<46>-Footnote-2943829653
Ref: ライブラリ<46>-Footnote-2953829711
Ref: ライブラリ<46>-Footnote-2963829769
Ref: ライブラリ<46>-Footnote-2973829827
Ref: ライブラリ<46>-Footnote-2983829885
Ref: ライブラリ<46>-Footnote-2993829943
Ref: ライブラリ<46>-Footnote-3003830001
Ref: ライブラリ<46>-Footnote-3013830059
Ref: ライブラリ<46>-Footnote-3023830117
Ref: ライブラリ<46>-Footnote-3033830175
Ref: ライブラリ<46>-Footnote-3043830259
Ref: ライブラリ<46>-Footnote-3053830317
Ref: ライブラリ<46>-Footnote-3063830375
Ref: ライブラリ<46>-Footnote-3073830433
Ref: ライブラリ<46>-Footnote-3083830491
Ref: ライブラリ<46>-Footnote-3093830549
Ref: ライブラリ<46>-Footnote-3103830607
Ref: ライブラリ<46>-Footnote-3113830665
Ref: ライブラリ<46>-Footnote-3123830723
Ref: ライブラリ<46>-Footnote-3133830781
Ref: ライブラリ<46>-Footnote-3143830839
Ref: ライブラリ<46>-Footnote-3153830897
Ref: ライブラリ<46>-Footnote-3163830954
Ref: ライブラリ<46>-Footnote-3173831012
Ref: ライブラリ<46>-Footnote-3183831069
Ref: ライブラリ<46>-Footnote-3193831127
Ref: ライブラリ<46>-Footnote-3203831194
Ref: ライブラリ<46>-Footnote-3213831261
Ref: ライブラリ<46>-Footnote-3223831328
Ref: ライブラリ<46>-Footnote-3233831395
Ref: ライブラリ<46>-Footnote-3243831452
Node: IDLE<7>3831519
Ref: whatsnew/changelog id1873831643
Ref: 19613831643
Ref: IDLE<7>-Footnote-13832497
Ref: IDLE<7>-Footnote-23832553
Ref: IDLE<7>-Footnote-33832609
Ref: IDLE<7>-Footnote-43832665
Ref: IDLE<7>-Footnote-53832720
Ref: IDLE<7>-Footnote-63832776
Node: ドキュメント<14>3832832
Ref: whatsnew/changelog id1883832958
Ref: 19623832958
Ref: ドキュメント<14>-Footnote-13835467
Ref: ドキュメント<14>-Footnote-23835523
Ref: ドキュメント<14>-Footnote-33835579
Ref: ドキュメント<14>-Footnote-43835635
Ref: ドキュメント<14>-Footnote-53835691
Ref: ドキュメント<14>-Footnote-63835747
Ref: ドキュメント<14>-Footnote-73835803
Ref: ドキュメント<14>-Footnote-83835858
Ref: ドキュメント<14>-Footnote-93835914
Ref: ドキュメント<14>-Footnote-103835970
Ref: ドキュメント<14>-Footnote-113836027
Ref: ドキュメント<14>-Footnote-123836084
Ref: ドキュメント<14>-Footnote-133836141
Node: Core and Builtins<41>3836207
Ref: whatsnew/changelog id1893836345
Ref: 196a3836345
Ref: Core and Builtins<41>-Footnote-13837082
Ref: Core and Builtins<41>-Footnote-23837138
Ref: Core and Builtins<41>-Footnote-33837194
Ref: Core and Builtins<41>-Footnote-43837250
Node: ライブラリ<47>3837306
Ref: whatsnew/changelog id1903837443
Ref: 196c3837443
Ref: ライブラリ<47>-Footnote-13837680
Node: Core and Builtins<42>3837736
Ref: whatsnew/changelog id1913837871
Ref: 196d3837871
Ref: Core and Builtins<42>-Footnote-13842018
Ref: Core and Builtins<42>-Footnote-23842074
Ref: Core and Builtins<42>-Footnote-33842130
Ref: Core and Builtins<42>-Footnote-43842186
Ref: Core and Builtins<42>-Footnote-53842242
Ref: Core and Builtins<42>-Footnote-63842298
Ref: Core and Builtins<42>-Footnote-73842354
Ref: Core and Builtins<42>-Footnote-83842410
Ref: Core and Builtins<42>-Footnote-93842466
Ref: Core and Builtins<42>-Footnote-103842522
Ref: Core and Builtins<42>-Footnote-113842579
Ref: Core and Builtins<42>-Footnote-123842636
Ref: Core and Builtins<42>-Footnote-133842693
Ref: Core and Builtins<42>-Footnote-143842749
Ref: Core and Builtins<42>-Footnote-153842806
Ref: Core and Builtins<42>-Footnote-163842863
Ref: Core and Builtins<42>-Footnote-173842920
Ref: Core and Builtins<42>-Footnote-183842977
Ref: Core and Builtins<42>-Footnote-193843034
Ref: Core and Builtins<42>-Footnote-203843091
Ref: Core and Builtins<42>-Footnote-213843148
Ref: Core and Builtins<42>-Footnote-223843204
Ref: Core and Builtins<42>-Footnote-233843261
Ref: Core and Builtins<42>-Footnote-243843318
Node: ライブラリ<48>3843375
Ref: whatsnew/changelog id1923843512
Ref: 196f3843512
Ref: ライブラリ<48>-Footnote-13843755
Node: Core and Builtins<43>3843811
Ref: whatsnew/changelog id1933843946
Ref: 19713843946
Ref: Core and Builtins<43>-Footnote-13851750
Ref: Core and Builtins<43>-Footnote-23851806
Ref: Core and Builtins<43>-Footnote-33851862
Ref: Core and Builtins<43>-Footnote-43851918
Ref: Core and Builtins<43>-Footnote-53851974
Ref: Core and Builtins<43>-Footnote-63852030
Ref: Core and Builtins<43>-Footnote-73852086
Ref: Core and Builtins<43>-Footnote-83852142
Ref: Core and Builtins<43>-Footnote-93852198
Ref: Core and Builtins<43>-Footnote-103852254
Ref: Core and Builtins<43>-Footnote-113852311
Ref: Core and Builtins<43>-Footnote-123852368
Ref: Core and Builtins<43>-Footnote-133852425
Ref: Core and Builtins<43>-Footnote-143852482
Ref: Core and Builtins<43>-Footnote-153852539
Ref: Core and Builtins<43>-Footnote-163852596
Ref: Core and Builtins<43>-Footnote-173852653
Ref: Core and Builtins<43>-Footnote-183852710
Ref: Core and Builtins<43>-Footnote-193852767
Ref: Core and Builtins<43>-Footnote-203852824
Ref: Core and Builtins<43>-Footnote-213852881
Ref: Core and Builtins<43>-Footnote-223852938
Ref: Core and Builtins<43>-Footnote-233852995
Ref: Core and Builtins<43>-Footnote-243853052
Ref: Core and Builtins<43>-Footnote-253853109
Ref: Core and Builtins<43>-Footnote-263853166
Ref: Core and Builtins<43>-Footnote-273853223
Ref: Core and Builtins<43>-Footnote-283853280
Ref: Core and Builtins<43>-Footnote-293853337
Ref: Core and Builtins<43>-Footnote-303853394
Ref: Core and Builtins<43>-Footnote-313853451
Ref: Core and Builtins<43>-Footnote-323853508
Ref: Core and Builtins<43>-Footnote-333853565
Ref: Core and Builtins<43>-Footnote-343853622
Ref: Core and Builtins<43>-Footnote-353853679
Ref: Core and Builtins<43>-Footnote-363853736
Ref: Core and Builtins<43>-Footnote-373853793
Ref: Core and Builtins<43>-Footnote-383853850
Ref: Core and Builtins<43>-Footnote-393853907
Ref: Core and Builtins<43>-Footnote-403853964
Ref: Core and Builtins<43>-Footnote-413854021
Ref: Core and Builtins<43>-Footnote-423854078
Ref: Core and Builtins<43>-Footnote-433854135
Ref: Core and Builtins<43>-Footnote-443854192
Ref: Core and Builtins<43>-Footnote-453854249
Ref: Core and Builtins<43>-Footnote-463854306
Node: ライブラリ<49>3854362
Ref: whatsnew/changelog id1943854499
Ref: 19763854499
Ref: ライブラリ<49>-Footnote-13854707
Node: Core and Builtins<44>3854763
Ref: whatsnew/changelog id1953854898
Ref: 19773854898
Ref: Core and Builtins<44>-Footnote-13857800
Ref: Core and Builtins<44>-Footnote-23857856
Ref: Core and Builtins<44>-Footnote-33857912
Ref: Core and Builtins<44>-Footnote-43857968
Ref: Core and Builtins<44>-Footnote-53858024
Ref: Core and Builtins<44>-Footnote-63858080
Ref: Core and Builtins<44>-Footnote-73858136
Ref: Core and Builtins<44>-Footnote-83858192
Ref: Core and Builtins<44>-Footnote-93858248
Ref: Core and Builtins<44>-Footnote-103858304
Ref: Core and Builtins<44>-Footnote-113858361
Ref: Core and Builtins<44>-Footnote-123858418
Ref: Core and Builtins<44>-Footnote-133858475
Ref: Core and Builtins<44>-Footnote-143858532
Ref: Core and Builtins<44>-Footnote-153858589
Ref: Core and Builtins<44>-Footnote-163858646
Ref: Core and Builtins<44>-Footnote-173858703
Ref: Core and Builtins<44>-Footnote-183858760
Node: ライブラリ<50>3858817
Ref: whatsnew/changelog id1963858954
Ref: 197b3858954
Ref: ライブラリ<50>-Footnote-13859220
Node: Core and Builtins<45>3859276
Ref: whatsnew/changelog id1973859411
Ref: 197c3859411
Ref: Core and Builtins<45>-Footnote-13862193
Ref: Core and Builtins<45>-Footnote-23862249
Ref: Core and Builtins<45>-Footnote-33862305
Ref: Core and Builtins<45>-Footnote-43862361
Ref: Core and Builtins<45>-Footnote-53862417
Ref: Core and Builtins<45>-Footnote-63862473
Ref: Core and Builtins<45>-Footnote-73862529
Ref: Core and Builtins<45>-Footnote-83862584
Ref: Core and Builtins<45>-Footnote-93862640
Ref: Core and Builtins<45>-Footnote-103862696
Ref: Core and Builtins<45>-Footnote-113862753
Ref: Core and Builtins<45>-Footnote-123862810
Ref: Core and Builtins<45>-Footnote-133862867
Ref: Core and Builtins<45>-Footnote-143862924
Ref: Core and Builtins<45>-Footnote-153862981
Node: ライブラリ<51>3863038
Ref: whatsnew/changelog id1983863175
Ref: 197d3863175
Ref: ライブラリ<51>-Footnote-13863437
Node: Core and Builtins<46>3863493
Ref: whatsnew/changelog id1993863628
Ref: 197e3863628
Ref: Core and Builtins<46>-Footnote-13864152
Ref: Core and Builtins<46>-Footnote-23864208
Node: ライブラリ<52>3864264
Ref: whatsnew/changelog id2003864401
Ref: 197f3864401
Ref: ライブラリ<52>-Footnote-13864687
Node: Core and Builtins<47>3864743
Ref: whatsnew/changelog id2013864878
Ref: 19803864878
Ref: Core and Builtins<47>-Footnote-13872116
Ref: Core and Builtins<47>-Footnote-23872172
Ref: Core and Builtins<47>-Footnote-33872228
Ref: Core and Builtins<47>-Footnote-43872284
Ref: Core and Builtins<47>-Footnote-53872339
Ref: Core and Builtins<47>-Footnote-63872395
Ref: Core and Builtins<47>-Footnote-73872451
Ref: Core and Builtins<47>-Footnote-83872507
Ref: Core and Builtins<47>-Footnote-93872563
Ref: Core and Builtins<47>-Footnote-103872619
Ref: Core and Builtins<47>-Footnote-113872675
Ref: Core and Builtins<47>-Footnote-123872732
Ref: Core and Builtins<47>-Footnote-133872789
Ref: Core and Builtins<47>-Footnote-143872846
Ref: Core and Builtins<47>-Footnote-153872903
Ref: Core and Builtins<47>-Footnote-163872960
Ref: Core and Builtins<47>-Footnote-173873017
Ref: Core and Builtins<47>-Footnote-183873074
Ref: Core and Builtins<47>-Footnote-193873117
Ref: Core and Builtins<47>-Footnote-203873174
Ref: Core and Builtins<47>-Footnote-213873231
Ref: Core and Builtins<47>-Footnote-223873288
Ref: Core and Builtins<47>-Footnote-233873345
Ref: Core and Builtins<47>-Footnote-243873402
Ref: Core and Builtins<47>-Footnote-253873459
Ref: Core and Builtins<47>-Footnote-263873516
Ref: Core and Builtins<47>-Footnote-273873573
Ref: Core and Builtins<47>-Footnote-283873630
Ref: Core and Builtins<47>-Footnote-293873687
Ref: Core and Builtins<47>-Footnote-303873744
Ref: Core and Builtins<47>-Footnote-313873801
Ref: Core and Builtins<47>-Footnote-323873858
Ref: Core and Builtins<47>-Footnote-333873915
Ref: Core and Builtins<47>-Footnote-343873972
Ref: Core and Builtins<47>-Footnote-353874015
Ref: Core and Builtins<47>-Footnote-363874072
Ref: Core and Builtins<47>-Footnote-373874129
Ref: Core and Builtins<47>-Footnote-383874186
Ref: Core and Builtins<47>-Footnote-393874243
Ref: Core and Builtins<47>-Footnote-403874300
Ref: Core and Builtins<47>-Footnote-413874343
Ref: Core and Builtins<47>-Footnote-423874400
Ref: Core and Builtins<47>-Footnote-433874457
Ref: Core and Builtins<47>-Footnote-443874514
Ref: Core and Builtins<47>-Footnote-453874571
Ref: Core and Builtins<47>-Footnote-463874628
Ref: Core and Builtins<47>-Footnote-473874685
Ref: Core and Builtins<47>-Footnote-483874742
Ref: Core and Builtins<47>-Footnote-493874799
Ref: Core and Builtins<47>-Footnote-503874856
Node: ライブラリ<53>3874899
Ref: whatsnew/changelog id2023875036
Ref: 19843875036
Ref: ライブラリ<53>-Footnote-13875275
Node: Core and Builtins<48>3875331
Ref: whatsnew/changelog id2033875456
Ref: 19873875456
Ref: Core and Builtins<48>-Footnote-13876485
Ref: Core and Builtins<48>-Footnote-23876541
Ref: Core and Builtins<48>-Footnote-33876597
Ref: Core and Builtins<48>-Footnote-43876653
Ref: Core and Builtins<48>-Footnote-53876709
Ref: Core and Builtins<48>-Footnote-63876765
Ref: Core and Builtins<48>-Footnote-73876820
Ref: Core and Builtins<48>-Footnote-83876875
Node: C API<15>3876940
Ref: whatsnew/changelog id2043877059
Ref: 19883877059
Ref: C API<15>-Footnote-13888869
Ref: C API<15>-Footnote-23888925
Ref: C API<15>-Footnote-33888981
Ref: C API<15>-Footnote-43889037
Ref: C API<15>-Footnote-53889079
Ref: C API<15>-Footnote-63889121
Ref: C API<15>-Footnote-73889177
Ref: C API<15>-Footnote-83889233
Ref: C API<15>-Footnote-93889275
Ref: C API<15>-Footnote-103889317
Ref: C API<15>-Footnote-113889374
Ref: C API<15>-Footnote-123889431
Ref: C API<15>-Footnote-133889488
Ref: C API<15>-Footnote-143889545
Ref: C API<15>-Footnote-153889588
Ref: C API<15>-Footnote-163889645
Ref: C API<15>-Footnote-173889702
Ref: C API<15>-Footnote-183889759
Ref: C API<15>-Footnote-193889816
Ref: C API<15>-Footnote-203889873
Ref: C API<15>-Footnote-213889930
Ref: C API<15>-Footnote-223889987
Ref: C API<15>-Footnote-233890044
Ref: C API<15>-Footnote-243890101
Ref: C API<15>-Footnote-253890157
Ref: C API<15>-Footnote-263890214
Ref: C API<15>-Footnote-273890271
Ref: C API<15>-Footnote-283890328
Ref: C API<15>-Footnote-293890385
Ref: C API<15>-Footnote-303890442
Ref: C API<15>-Footnote-313890499
Ref: C API<15>-Footnote-323890556
Ref: C API<15>-Footnote-333890613
Ref: C API<15>-Footnote-343890669
Ref: C API<15>-Footnote-353890726
Ref: C API<15>-Footnote-363890783
Ref: C API<15>-Footnote-373890840
Ref: C API<15>-Footnote-383890897
Ref: C API<15>-Footnote-393890954
Ref: C API<15>-Footnote-403891011
Ref: C API<15>-Footnote-413891068
Ref: C API<15>-Footnote-423891125
Ref: C API<15>-Footnote-433891182
Ref: C API<15>-Footnote-443891239
Ref: C API<15>-Footnote-453891296
Ref: C API<15>-Footnote-463891353
Ref: C API<15>-Footnote-473891410
Ref: C API<15>-Footnote-483891467
Ref: C API<15>-Footnote-493891524
Ref: C API<15>-Footnote-503891581
Ref: C API<15>-Footnote-513891638
Ref: C API<15>-Footnote-523891694
Ref: C API<15>-Footnote-533891750
Node: ビルド<15>3891816
Ref: whatsnew/changelog id2053891905
Ref: 19963891905
Ref: ビルド<15>-Footnote-13896466
Ref: ビルド<15>-Footnote-23896522
Ref: ビルド<15>-Footnote-33896578
Ref: ビルド<15>-Footnote-43896634
Ref: ビルド<15>-Footnote-53896690
Ref: ビルド<15>-Footnote-63896746
Ref: ビルド<15>-Footnote-73896802
Ref: ビルド<15>-Footnote-83896858
Ref: ビルド<15>-Footnote-93896914
Ref: ビルド<15>-Footnote-103896970
Ref: ビルド<15>-Footnote-113897027
Ref: ビルド<15>-Footnote-123897084
Ref: ビルド<15>-Footnote-133897141
Ref: ビルド<15>-Footnote-143897198
Ref: ビルド<15>-Footnote-153897255
Ref: ビルド<15>-Footnote-163897312
Ref: ビルド<15>-Footnote-173897369
Ref: ビルド<15>-Footnote-183897426
Ref: ビルド<15>-Footnote-193897483
Ref: ビルド<15>-Footnote-203897540
Ref: ビルド<15>-Footnote-213897597
Ref: ビルド<15>-Footnote-223897654
Ref: ビルド<15>-Footnote-233897711
Ref: ビルド<15>-Footnote-243897768
Ref: ビルド<15>-Footnote-253897825
Ref: ビルド<15>-Footnote-263897882
Ref: ビルド<15>-Footnote-273897939
Ref: ビルド<15>-Footnote-283897996
Ref: ビルド<15>-Footnote-293898053
Ref: ビルド<15>-Footnote-303898110
Ref: ビルド<15>-Footnote-313898167
Ref: ビルド<15>-Footnote-323898224
Node: Python 3 13 0 beta 13898281
Ref: whatsnew/changelog python-3-13-0-beta-13898410
Ref: 19983898410
Node: セキュリティ<17>3898875
Ref: whatsnew/changelog id2063898984
Ref: 19993898984
Ref: セキュリティ<17>-Footnote-13899393
Ref: セキュリティ<17>-Footnote-23899449
Node: Core and Builtins<49>3899505
Ref: whatsnew/changelog id2073899642
Ref: 199a3899642
Ref: Core and Builtins<49>-Footnote-13900784
Ref: Core and Builtins<49>-Footnote-23900840
Ref: Core and Builtins<49>-Footnote-33900896
Node: ライブラリ<54>3900952
Ref: whatsnew/changelog id2083901088
Ref: 199b3901088
Ref: ライブラリ<54>-Footnote-13901430
Node: Core and Builtins<50>3901485
Ref: whatsnew/changelog id2093901619
Ref: 199c3901619
Ref: Core and Builtins<50>-Footnote-13909679
Ref: Core and Builtins<50>-Footnote-23909735
Ref: Core and Builtins<50>-Footnote-33909791
Ref: Core and Builtins<50>-Footnote-43909847
Ref: Core and Builtins<50>-Footnote-53909903
Ref: Core and Builtins<50>-Footnote-63909959
Ref: Core and Builtins<50>-Footnote-73910015
Ref: Core and Builtins<50>-Footnote-83910071
Ref: Core and Builtins<50>-Footnote-93910127
Ref: Core and Builtins<50>-Footnote-103910183
Ref: Core and Builtins<50>-Footnote-113910240
Ref: Core and Builtins<50>-Footnote-123910296
Ref: Core and Builtins<50>-Footnote-133910353
Ref: Core and Builtins<50>-Footnote-143910410
Ref: Core and Builtins<50>-Footnote-153910467
Ref: Core and Builtins<50>-Footnote-163910524
Ref: Core and Builtins<50>-Footnote-173910581
Ref: Core and Builtins<50>-Footnote-183910638
Ref: Core and Builtins<50>-Footnote-193910695
Ref: Core and Builtins<50>-Footnote-203910752
Ref: Core and Builtins<50>-Footnote-213910809
Ref: Core and Builtins<50>-Footnote-223910866
Ref: Core and Builtins<50>-Footnote-233910923
Ref: Core and Builtins<50>-Footnote-243910980
Ref: Core and Builtins<50>-Footnote-253911037
Ref: Core and Builtins<50>-Footnote-263911094
Ref: Core and Builtins<50>-Footnote-273911151
Ref: Core and Builtins<50>-Footnote-283911208
Ref: Core and Builtins<50>-Footnote-293911265
Ref: Core and Builtins<50>-Footnote-303911322
Ref: Core and Builtins<50>-Footnote-313911379
Ref: Core and Builtins<50>-Footnote-323911436
Ref: Core and Builtins<50>-Footnote-333911493
Ref: Core and Builtins<50>-Footnote-343911536
Ref: Core and Builtins<50>-Footnote-353911593
Ref: Core and Builtins<50>-Footnote-363911650
Ref: Core and Builtins<50>-Footnote-373911707
Ref: Core and Builtins<50>-Footnote-383911764
Ref: Core and Builtins<50>-Footnote-393911821
Ref: Core and Builtins<50>-Footnote-403911864
Ref: Core and Builtins<50>-Footnote-413911920
Ref: Core and Builtins<50>-Footnote-423911977
Ref: Core and Builtins<50>-Footnote-433912033
Ref: Core and Builtins<50>-Footnote-443912089
Node: ライブラリ<55>3912146
Ref: whatsnew/changelog id2103912283
Ref: 199f3912283
Ref: ライブラリ<55>-Footnote-13928559
Ref: ライブラリ<55>-Footnote-23928615
Ref: ライブラリ<55>-Footnote-33928671
Ref: ライブラリ<55>-Footnote-43928727
Ref: ライブラリ<55>-Footnote-53928783
Ref: ライブラリ<55>-Footnote-63928839
Ref: ライブラリ<55>-Footnote-73928895
Ref: ライブラリ<55>-Footnote-83928951
Ref: ライブラリ<55>-Footnote-93929007
Ref: ライブラリ<55>-Footnote-103929063
Ref: ライブラリ<55>-Footnote-113929120
Ref: ライブラリ<55>-Footnote-123929177
Ref: ライブラリ<55>-Footnote-133929234
Ref: ライブラリ<55>-Footnote-143929291
Ref: ライブラリ<55>-Footnote-153929334
Ref: ライブラリ<55>-Footnote-163929391
Ref: ライブラリ<55>-Footnote-173929448
Ref: ライブラリ<55>-Footnote-183929505
Ref: ライブラリ<55>-Footnote-193929562
Ref: ライブラリ<55>-Footnote-203929619
Ref: ライブラリ<55>-Footnote-213929676
Ref: ライブラリ<55>-Footnote-223929733
Ref: ライブラリ<55>-Footnote-233929790
Ref: ライブラリ<55>-Footnote-243929847
Ref: ライブラリ<55>-Footnote-253929903
Ref: ライブラリ<55>-Footnote-263929960
Ref: ライブラリ<55>-Footnote-273930017
Ref: ライブラリ<55>-Footnote-283930074
Ref: ライブラリ<55>-Footnote-293930131
Ref: ライブラリ<55>-Footnote-303930188
Ref: ライブラリ<55>-Footnote-313930245
Ref: ライブラリ<55>-Footnote-323930288
Ref: ライブラリ<55>-Footnote-333930345
Ref: ライブラリ<55>-Footnote-343930402
Ref: ライブラリ<55>-Footnote-353930459
Ref: ライブラリ<55>-Footnote-363930515
Ref: ライブラリ<55>-Footnote-373930575
Ref: ライブラリ<55>-Footnote-383930631
Ref: ライブラリ<55>-Footnote-393930688
Ref: ライブラリ<55>-Footnote-403930745
Ref: ライブラリ<55>-Footnote-413930802
Ref: ライブラリ<55>-Footnote-423930858
Ref: ライブラリ<55>-Footnote-433930914
Ref: ライブラリ<55>-Footnote-443930957
Ref: ライブラリ<55>-Footnote-453931014
Ref: ライブラリ<55>-Footnote-463931071
Ref: ライブラリ<55>-Footnote-473931128
Ref: ライブラリ<55>-Footnote-483931185
Ref: ライブラリ<55>-Footnote-493931242
Ref: ライブラリ<55>-Footnote-503931299
Ref: ライブラリ<55>-Footnote-513931356
Ref: ライブラリ<55>-Footnote-523931413
Ref: ライブラリ<55>-Footnote-533931470
Ref: ライブラリ<55>-Footnote-543931527
Ref: ライブラリ<55>-Footnote-553931584
Ref: ライブラリ<55>-Footnote-563931641
Ref: ライブラリ<55>-Footnote-573931698
Ref: ライブラリ<55>-Footnote-583931755
Ref: ライブラリ<55>-Footnote-593931812
Ref: ライブラリ<55>-Footnote-603931869
Ref: ライブラリ<55>-Footnote-613931926
Ref: ライブラリ<55>-Footnote-623931983
Ref: ライブラリ<55>-Footnote-633932026
Ref: ライブラリ<55>-Footnote-643932083
Ref: ライブラリ<55>-Footnote-653932140
Ref: ライブラリ<55>-Footnote-663932197
Ref: ライブラリ<55>-Footnote-673932254
Ref: ライブラリ<55>-Footnote-683932297
Ref: ライブラリ<55>-Footnote-693932353
Ref: ライブラリ<55>-Footnote-703932409
Ref: ライブラリ<55>-Footnote-713932466
Ref: ライブラリ<55>-Footnote-723932523
Ref: ライブラリ<55>-Footnote-733932580
Ref: ライブラリ<55>-Footnote-743932636
Ref: ライブラリ<55>-Footnote-753932692
Ref: ライブラリ<55>-Footnote-763932749
Ref: ライブラリ<55>-Footnote-773932806
Ref: ライブラリ<55>-Footnote-783932863
Ref: ライブラリ<55>-Footnote-793932920
Ref: ライブラリ<55>-Footnote-803932976
Ref: ライブラリ<55>-Footnote-813933033
Ref: ライブラリ<55>-Footnote-823933090
Ref: ライブラリ<55>-Footnote-833933146
Ref: ライブラリ<55>-Footnote-843933203
Ref: ライブラリ<55>-Footnote-853933260
Ref: ライブラリ<55>-Footnote-863933316
Ref: ライブラリ<55>-Footnote-873933372
Ref: ライブラリ<55>-Footnote-883933438
Ref: ライブラリ<55>-Footnote-893933504
Ref: ライブラリ<55>-Footnote-903933570
Ref: ライブラリ<55>-Footnote-913933636
Node: ドキュメント<15>3933702
Ref: whatsnew/changelog id2113933831
Ref: 19ad3933831
Ref: ドキュメント<15>-Footnote-13934017
Node: ビルド<16>3934073
Ref: whatsnew/changelog id2123934194
Ref: 19ae3934194
Ref: ビルド<16>-Footnote-13935148
Ref: ビルド<16>-Footnote-23935204
Ref: ビルド<16>-Footnote-33935260
Ref: ビルド<16>-Footnote-43935316
Ref: ビルド<16>-Footnote-53935372
Ref: ビルド<16>-Footnote-63935428
Node: Windows<15>3935484
Ref: whatsnew/changelog id2133935591
Ref: 19af3935591
Ref: Windows<15>-Footnote-13936630
Ref: Windows<15>-Footnote-23936686
Ref: Windows<15>-Footnote-33936742
Ref: Windows<15>-Footnote-43936798
Ref: Windows<15>-Footnote-53936854
Ref: Windows<15>-Footnote-63936910
Ref: Windows<15>-Footnote-73936965
Node: macOS<9>3937021
Ref: whatsnew/changelog id2143937122
Ref: 19b03937122
Ref: macOS<9>-Footnote-13937566
Ref: macOS<9>-Footnote-23937622
Ref: macOS<9>-Footnote-33937678
Ref: macOS<9>-Footnote-43937734
Node: IDLE<8>3937789
Ref: whatsnew/changelog id2153937888
Ref: 19b13937888
Ref: IDLE<8>-Footnote-13938029
Node: C API<16>3938094
Ref: whatsnew/changelog id2163938176
Ref: 19b23938176
Ref: C API<16>-Footnote-13939455
Ref: C API<16>-Footnote-23939511
Ref: C API<16>-Footnote-33939567
Ref: C API<16>-Footnote-43939623
Ref: C API<16>-Footnote-53939679
Ref: C API<16>-Footnote-63939735
Ref: C API<16>-Footnote-73939790
Node: Python 3 13 0 alpha 63939846
Ref: whatsnew/changelog python-3-13-0-alpha-63939975
Ref: 19ba3939975
Node: Core and Builtins<51>3940388
Ref: whatsnew/changelog id2173940495
Ref: 19bb3940495
Ref: Core and Builtins<51>-Footnote-13945156
Ref: Core and Builtins<51>-Footnote-23945212
Ref: Core and Builtins<51>-Footnote-33945268
Ref: Core and Builtins<51>-Footnote-43945324
Ref: Core and Builtins<51>-Footnote-53945380
Ref: Core and Builtins<51>-Footnote-63945436
Ref: Core and Builtins<51>-Footnote-73945492
Ref: Core and Builtins<51>-Footnote-83945548
Ref: Core and Builtins<51>-Footnote-93945603
Ref: Core and Builtins<51>-Footnote-103945650
Ref: Core and Builtins<51>-Footnote-113945707
Ref: Core and Builtins<51>-Footnote-123945764
Ref: Core and Builtins<51>-Footnote-133945821
Ref: Core and Builtins<51>-Footnote-143945878
Ref: Core and Builtins<51>-Footnote-153945935
Ref: Core and Builtins<51>-Footnote-163945992
Ref: Core and Builtins<51>-Footnote-173946049
Ref: Core and Builtins<51>-Footnote-183946106
Ref: Core and Builtins<51>-Footnote-193946163
Node: ライブラリ<56>3946220
Ref: whatsnew/changelog id2183946357
Ref: 19be3946357
Ref: ライブラリ<56>-Footnote-13946714
Ref: ライブラリ<56>-Footnote-23946770
Node: Core and Builtins<52>3946825
Ref: whatsnew/changelog id2193946960
Ref: 19bf3946960
Ref: Core and Builtins<52>-Footnote-13947189
Node: ライブラリ<57>3947254
Ref: whatsnew/changelog id2203947392
Ref: 19c03947392
Ref: ライブラリ<57>-Footnote-13958175
Ref: ライブラリ<57>-Footnote-23958231
Ref: ライブラリ<57>-Footnote-33958287
Ref: ライブラリ<57>-Footnote-43958343
Ref: ライブラリ<57>-Footnote-53958399
Ref: ライブラリ<57>-Footnote-63958455
Ref: ライブラリ<57>-Footnote-73958511
Ref: ライブラリ<57>-Footnote-83958567
Ref: ライブラリ<57>-Footnote-93958623
Ref: ライブラリ<57>-Footnote-103958679
Ref: ライブラリ<57>-Footnote-113958736
Ref: ライブラリ<57>-Footnote-123958792
Ref: ライブラリ<57>-Footnote-133958848
Ref: ライブラリ<57>-Footnote-143958905
Ref: ライブラリ<57>-Footnote-153958962
Ref: ライブラリ<57>-Footnote-163959018
Ref: ライブラリ<57>-Footnote-173959075
Ref: ライブラリ<57>-Footnote-183959132
Ref: ライブラリ<57>-Footnote-193959189
Ref: ライブラリ<57>-Footnote-203959246
Ref: ライブラリ<57>-Footnote-213959303
Ref: ライブラリ<57>-Footnote-223959360
Ref: ライブラリ<57>-Footnote-233959417
Ref: ライブラリ<57>-Footnote-243959474
Ref: ライブラリ<57>-Footnote-253959531
Ref: ライブラリ<57>-Footnote-263959588
Ref: ライブラリ<57>-Footnote-273959644
Ref: ライブラリ<57>-Footnote-283959701
Ref: ライブラリ<57>-Footnote-293959758
Ref: ライブラリ<57>-Footnote-303959814
Ref: ライブラリ<57>-Footnote-313959871
Ref: ライブラリ<57>-Footnote-323959928
Ref: ライブラリ<57>-Footnote-333959984
Ref: ライブラリ<57>-Footnote-343960041
Ref: ライブラリ<57>-Footnote-353960109
Ref: ライブラリ<57>-Footnote-363960165
Ref: ライブラリ<57>-Footnote-373960222
Ref: ライブラリ<57>-Footnote-383960279
Ref: ライブラリ<57>-Footnote-393960336
Ref: ライブラリ<57>-Footnote-403960393
Ref: ライブラリ<57>-Footnote-413960449
Ref: ライブラリ<57>-Footnote-423960505
Ref: ライブラリ<57>-Footnote-433960561
Ref: ライブラリ<57>-Footnote-443960618
Ref: ライブラリ<57>-Footnote-453960675
Ref: ライブラリ<57>-Footnote-463960732
Ref: ライブラリ<57>-Footnote-473960789
Ref: ライブラリ<57>-Footnote-483960845
Ref: ライブラリ<57>-Footnote-493960901
Ref: ライブラリ<57>-Footnote-503960958
Ref: ライブラリ<57>-Footnote-513961015
Ref: ライブラリ<57>-Footnote-523961072
Ref: ライブラリ<57>-Footnote-533961129
Ref: ライブラリ<57>-Footnote-543961186
Ref: ライブラリ<57>-Footnote-553961242
Ref: ライブラリ<57>-Footnote-563961299
Ref: ライブラリ<57>-Footnote-573961356
Ref: ライブラリ<57>-Footnote-583961413
Ref: ライブラリ<57>-Footnote-593961469
Ref: ライブラリ<57>-Footnote-603961525
Ref: ライブラリ<57>-Footnote-613961591
Ref: ライブラリ<57>-Footnote-623961657
Ref: ライブラリ<57>-Footnote-633961723
Ref: ライブラリ<57>-Footnote-643961779
Node: ドキュメント<16>3961845
Ref: whatsnew/changelog id2213961975
Ref: 19c83961975
Ref: ドキュメント<16>-Footnote-13962392
Ref: ドキュメント<16>-Footnote-23962448
Ref: ドキュメント<16>-Footnote-33962504
Node: テスト<14>3962559
Ref: whatsnew/changelog id2223962683
Ref: 19c93962683
Ref: テスト<14>-Footnote-13963794
Ref: テスト<14>-Footnote-23963849
Ref: テスト<14>-Footnote-33963905
Ref: テスト<14>-Footnote-43963961
Ref: テスト<14>-Footnote-53964017
Ref: テスト<14>-Footnote-63964073
Ref: テスト<14>-Footnote-73964129
Node: ビルド<17>3964185
Ref: whatsnew/changelog id2233964298
Ref: 19ca3964298
Ref: ビルド<17>-Footnote-13964581
Ref: ビルド<17>-Footnote-23964637
Ref: ビルド<17>-Footnote-33964693
Node: Windows<16>3964748
Ref: whatsnew/changelog id2243964857
Ref: 19cb3964857
Ref: Windows<16>-Footnote-13966317
Ref: Windows<16>-Footnote-23966373
Ref: Windows<16>-Footnote-33966429
Ref: Windows<16>-Footnote-43966484
Ref: Windows<16>-Footnote-53966540
Ref: Windows<16>-Footnote-63966595
Node: C API<17>3966651
Ref: whatsnew/changelog id2253966738
Ref: 19cd3966738
Ref: C API<17>-Footnote-13970002
Ref: C API<17>-Footnote-23970058
Ref: C API<17>-Footnote-33970100
Ref: C API<17>-Footnote-43970155
Ref: C API<17>-Footnote-53970211
Ref: C API<17>-Footnote-63970267
Ref: C API<17>-Footnote-73970323
Ref: C API<17>-Footnote-83970379
Ref: C API<17>-Footnote-93970435
Ref: C API<17>-Footnote-103970491
Ref: C API<17>-Footnote-113970548
Ref: C API<17>-Footnote-123970605
Ref: C API<17>-Footnote-133970662
Ref: C API<17>-Footnote-143970719
Ref: C API<17>-Footnote-153970762
Ref: C API<17>-Footnote-163970819
Ref: C API<17>-Footnote-173970876
Ref: C API<17>-Footnote-183970932
Ref: C API<17>-Footnote-193970989
Node: Python 3 13 0 alpha 53971046
Ref: whatsnew/changelog python-3-13-0-alpha-53971176
Ref: 19d03971176
Node: セキュリティ<18>3971788
Ref: whatsnew/changelog id2263971898
Ref: 19d13971898
Ref: セキュリティ<18>-Footnote-13972727
Ref: セキュリティ<18>-Footnote-23972783
Ref: セキュリティ<18>-Footnote-33972839
Node: Core and Builtins<53>3972895
Ref: whatsnew/changelog id2273973033
Ref: 19d23973033
Ref: Core and Builtins<53>-Footnote-13974413
Ref: Core and Builtins<53>-Footnote-23974469
Ref: Core and Builtins<53>-Footnote-33974525
Ref: Core and Builtins<53>-Footnote-43974567
Ref: Core and Builtins<53>-Footnote-53974623
Ref: Core and Builtins<53>-Footnote-63974679
Ref: Core and Builtins<53>-Footnote-73974735
Ref: Core and Builtins<53>-Footnote-83974791
Ref: Core and Builtins<53>-Footnote-93974847
Ref: Core and Builtins<53>-Footnote-103974903
Ref: Core and Builtins<53>-Footnote-113974960
Ref: Core and Builtins<53>-Footnote-123975017
Node: ライブラリ<58>3975074
Ref: whatsnew/changelog id2283975211
Ref: 19d33975211
Ref: ライブラリ<58>-Footnote-13975470
Node: Core and Builtins<54>3975526
Ref: whatsnew/changelog id2293975661
Ref: 19d43975661
Ref: Core and Builtins<54>-Footnote-13975903
Node: ライブラリ<59>3975959
Ref: whatsnew/changelog id2303976096
Ref: 19d53976096
Ref: ライブラリ<59>-Footnote-13976362
Node: Core and Builtins<55>3976418
Ref: whatsnew/changelog id2313976553
Ref: 19d63976553
Ref: Core and Builtins<55>-Footnote-13977382
Ref: Core and Builtins<55>-Footnote-23977438
Ref: Core and Builtins<55>-Footnote-33977494
Node: ライブラリ<60>3977549
Ref: whatsnew/changelog id2323977687
Ref: 19d73977687
Ref: ライブラリ<60>-Footnote-13989486
Ref: ライブラリ<60>-Footnote-23989542
Ref: ライブラリ<60>-Footnote-33989598
Ref: ライブラリ<60>-Footnote-43989654
Ref: ライブラリ<60>-Footnote-53989710
Ref: ライブラリ<60>-Footnote-63989752
Ref: ライブラリ<60>-Footnote-73989808
Ref: ライブラリ<60>-Footnote-83989864
Ref: ライブラリ<60>-Footnote-93989920
Ref: ライブラリ<60>-Footnote-103989975
Ref: ライブラリ<60>-Footnote-113990031
Ref: ライブラリ<60>-Footnote-123990087
Ref: ライブラリ<60>-Footnote-133990143
Ref: ライブラリ<60>-Footnote-143990199
Ref: ライブラリ<60>-Footnote-153990256
Ref: ライブラリ<60>-Footnote-163990313
Ref: ライブラリ<60>-Footnote-173990369
Ref: ライブラリ<60>-Footnote-183990425
Ref: ライブラリ<60>-Footnote-193990482
Ref: ライブラリ<60>-Footnote-203990538
Ref: ライブラリ<60>-Footnote-213990595
Ref: ライブラリ<60>-Footnote-223990652
Ref: ライブラリ<60>-Footnote-233990709
Ref: ライブラリ<60>-Footnote-243990766
Ref: ライブラリ<60>-Footnote-253990822
Ref: ライブラリ<60>-Footnote-263990878
Ref: ライブラリ<60>-Footnote-273990935
Ref: ライブラリ<60>-Footnote-283990992
Ref: ライブラリ<60>-Footnote-293991049
Ref: ライブラリ<60>-Footnote-303991106
Ref: ライブラリ<60>-Footnote-313991163
Ref: ライブラリ<60>-Footnote-323991220
Ref: ライブラリ<60>-Footnote-333991277
Ref: ライブラリ<60>-Footnote-343991334
Ref: ライブラリ<60>-Footnote-353991391
Ref: ライブラリ<60>-Footnote-363991448
Ref: ライブラリ<60>-Footnote-373991491
Ref: ライブラリ<60>-Footnote-383991548
Ref: ライブラリ<60>-Footnote-393991605
Ref: ライブラリ<60>-Footnote-403991662
Ref: ライブラリ<60>-Footnote-413991719
Ref: ライブラリ<60>-Footnote-423991776
Ref: ライブラリ<60>-Footnote-433991833
Ref: ライブラリ<60>-Footnote-443991890
Ref: ライブラリ<60>-Footnote-453991947
Ref: ライブラリ<60>-Footnote-463992004
Ref: ライブラリ<60>-Footnote-473992061
Ref: ライブラリ<60>-Footnote-483992117
Ref: ライブラリ<60>-Footnote-493992174
Ref: ライブラリ<60>-Footnote-503992231
Ref: ライブラリ<60>-Footnote-513992287
Ref: ライブラリ<60>-Footnote-523992343
Ref: ライブラリ<60>-Footnote-533992400
Ref: ライブラリ<60>-Footnote-543992456
Ref: ライブラリ<60>-Footnote-553992513
Ref: ライブラリ<60>-Footnote-563992569
Ref: ライブラリ<60>-Footnote-573992626
Ref: ライブラリ<60>-Footnote-583992683
Ref: ライブラリ<60>-Footnote-593992739
Ref: ライブラリ<60>-Footnote-603992795
Ref: ライブラリ<60>-Footnote-613992851
Ref: ライブラリ<60>-Footnote-623992917
Ref: ライブラリ<60>-Footnote-633992983
Ref: ライブラリ<60>-Footnote-643993049
Ref: ライブラリ<60>-Footnote-653993115
Ref: ライブラリ<60>-Footnote-663993181
Ref: ライブラリ<60>-Footnote-673993247
Node: ドキュメント<17>3993313
Ref: whatsnew/changelog id2333993443
Ref: 19e03993443
Ref: ドキュメント<17>-Footnote-13993699
Ref: ドキュメント<17>-Footnote-23993755
Ref: ドキュメント<17>-Footnote-33993811
Node: テスト<15>3993867
Ref: whatsnew/changelog id2343993991
Ref: 19e13993991
Ref: テスト<15>-Footnote-13995187
Ref: テスト<15>-Footnote-23995242
Ref: テスト<15>-Footnote-33995297
Ref: テスト<15>-Footnote-43995353
Ref: テスト<15>-Footnote-53995409
Ref: テスト<15>-Footnote-63995465
Ref: テスト<15>-Footnote-73995521
Ref: テスト<15>-Footnote-83995577
Ref: テスト<15>-Footnote-93995633
Node: ビルド<18>3995689
Ref: whatsnew/changelog id2353995802
Ref: 19e23995802
Ref: ビルド<18>-Footnote-13996715
Ref: ビルド<18>-Footnote-23996771
Ref: ビルド<18>-Footnote-33996826
Ref: ビルド<18>-Footnote-43996882
Ref: ビルド<18>-Footnote-53996937
Ref: ビルド<18>-Footnote-63996993
Ref: ビルド<18>-Footnote-73997049
Ref: ビルド<18>-Footnote-83997105
Ref: ビルド<18>-Footnote-93997161
Node: Windows<17>3997217
Ref: whatsnew/changelog id2363997326
Ref: 19e33997326
Ref: Windows<17>-Footnote-13998410
Ref: Windows<17>-Footnote-23998466
Ref: Windows<17>-Footnote-33998522
Ref: Windows<17>-Footnote-43998578
Node: macOS<10>3998634
Ref: whatsnew/changelog id2373998737
Ref: 19e43998737
Ref: macOS<10>-Footnote-13998869
Node: IDLE<9>3998925
Ref: whatsnew/changelog id2383999032
Ref: 19e53999032
Ref: IDLE<9>-Footnote-13999216
Node: Tools/Demos<16>3999271
Ref: whatsnew/changelog id2393999378
Ref: 19e63999378
Ref: Tools/Demos<16>-Footnote-13999621
Ref: Tools/Demos<16>-Footnote-23999677
Node: C API<18>3999742
Ref: whatsnew/changelog id2403999833
Ref: 19e73999833
Ref: C API<18>-Footnote-14000404
Ref: C API<18>-Footnote-24000460
Node: Python 3 13 0 alpha 44000516
Ref: whatsnew/changelog python-3-13-0-alpha-44000646
Ref: 19ec4000646
Node: セキュリティ<19>4001091
Ref: whatsnew/changelog id2414001201
Ref: 19ed4001201
Ref: セキュリティ<19>-Footnote-14001476
Ref: セキュリティ<19>-Footnote-24001532
Node: Core and Builtins<56>4001588
Ref: whatsnew/changelog id2424001726
Ref: 19ee4001726
Ref: Core and Builtins<56>-Footnote-14007034
Ref: Core and Builtins<56>-Footnote-24007090
Ref: Core and Builtins<56>-Footnote-34007146
Ref: Core and Builtins<56>-Footnote-44007202
Ref: Core and Builtins<56>-Footnote-54007258
Ref: Core and Builtins<56>-Footnote-64007314
Ref: Core and Builtins<56>-Footnote-74007370
Ref: Core and Builtins<56>-Footnote-84007426
Ref: Core and Builtins<56>-Footnote-94007482
Ref: Core and Builtins<56>-Footnote-104007538
Ref: Core and Builtins<56>-Footnote-114007594
Ref: Core and Builtins<56>-Footnote-124007651
Ref: Core and Builtins<56>-Footnote-134007708
Ref: Core and Builtins<56>-Footnote-144007765
Ref: Core and Builtins<56>-Footnote-154007822
Ref: Core and Builtins<56>-Footnote-164007879
Ref: Core and Builtins<56>-Footnote-174007936
Ref: Core and Builtins<56>-Footnote-184007993
Ref: Core and Builtins<56>-Footnote-194008050
Ref: Core and Builtins<56>-Footnote-204008107
Ref: Core and Builtins<56>-Footnote-214008164
Ref: Core and Builtins<56>-Footnote-224008221
Ref: Core and Builtins<56>-Footnote-234008278
Ref: Core and Builtins<56>-Footnote-244008335
Ref: Core and Builtins<56>-Footnote-254008392
Ref: Core and Builtins<56>-Footnote-264008449
Ref: Core and Builtins<56>-Footnote-274008506
Ref: Core and Builtins<56>-Footnote-284008569
Ref: Core and Builtins<56>-Footnote-294008626
Ref: Core and Builtins<56>-Footnote-304008682
Node: ライブラリ<61>4008739
Ref: whatsnew/changelog id2434008877
Ref: 19f14008877
Ref: ライブラリ<61>-Footnote-14022823
Ref: ライブラリ<61>-Footnote-24022879
Ref: ライブラリ<61>-Footnote-34022935
Ref: ライブラリ<61>-Footnote-44022991
Ref: ライブラリ<61>-Footnote-54023047
Ref: ライブラリ<61>-Footnote-64023103
Ref: ライブラリ<61>-Footnote-74023159
Ref: ライブラリ<61>-Footnote-84023215
Ref: ライブラリ<61>-Footnote-94023270
Ref: ライブラリ<61>-Footnote-104023325
Ref: ライブラリ<61>-Footnote-114023382
Ref: ライブラリ<61>-Footnote-124023438
Ref: ライブラリ<61>-Footnote-134023495
Ref: ライブラリ<61>-Footnote-144023551
Ref: ライブラリ<61>-Footnote-154023608
Ref: ライブラリ<61>-Footnote-164023665
Ref: ライブラリ<61>-Footnote-174023722
Ref: ライブラリ<61>-Footnote-184023779
Ref: ライブラリ<61>-Footnote-194023836
Ref: ライブラリ<61>-Footnote-204023892
Ref: ライブラリ<61>-Footnote-214023949
Ref: ライブラリ<61>-Footnote-224024006
Ref: ライブラリ<61>-Footnote-234024062
Ref: ライブラリ<61>-Footnote-244024119
Ref: ライブラリ<61>-Footnote-254024176
Ref: ライブラリ<61>-Footnote-264024232
Ref: ライブラリ<61>-Footnote-274024288
Ref: ライブラリ<61>-Footnote-284024344
Ref: ライブラリ<61>-Footnote-294024401
Ref: ライブラリ<61>-Footnote-304024457
Ref: ライブラリ<61>-Footnote-314024514
Ref: ライブラリ<61>-Footnote-324024571
Ref: ライブラリ<61>-Footnote-334024628
Ref: ライブラリ<61>-Footnote-344024685
Ref: ライブラリ<61>-Footnote-354024742
Ref: ライブラリ<61>-Footnote-364024799
Ref: ライブラリ<61>-Footnote-374024855
Ref: ライブラリ<61>-Footnote-384024912
Ref: ライブラリ<61>-Footnote-394024969
Ref: ライブラリ<61>-Footnote-404025026
Ref: ライブラリ<61>-Footnote-414025083
Ref: ライブラリ<61>-Footnote-424025140
Ref: ライブラリ<61>-Footnote-434025184
Ref: ライブラリ<61>-Footnote-444025241
Ref: ライブラリ<61>-Footnote-454025298
Ref: ライブラリ<61>-Footnote-464025355
Ref: ライブラリ<61>-Footnote-474025412
Ref: ライブラリ<61>-Footnote-484025468
Ref: ライブラリ<61>-Footnote-494025525
Ref: ライブラリ<61>-Footnote-504025582
Ref: ライブラリ<61>-Footnote-514025638
Ref: ライブラリ<61>-Footnote-524025695
Ref: ライブラリ<61>-Footnote-534025752
Ref: ライブラリ<61>-Footnote-544025808
Ref: ライブラリ<61>-Footnote-554025865
Ref: ライブラリ<61>-Footnote-564025922
Ref: ライブラリ<61>-Footnote-574025979
Ref: ライブラリ<61>-Footnote-584026035
Ref: ライブラリ<61>-Footnote-594026092
Ref: ライブラリ<61>-Footnote-604026148
Ref: ライブラリ<61>-Footnote-614026205
Ref: ライブラリ<61>-Footnote-624026262
Ref: ライブラリ<61>-Footnote-634026319
Ref: ライブラリ<61>-Footnote-644026375
Ref: ライブラリ<61>-Footnote-654026431
Ref: ライブラリ<61>-Footnote-664026488
Ref: ライブラリ<61>-Footnote-674026545
Ref: ライブラリ<61>-Footnote-684026601
Ref: ライブラリ<61>-Footnote-694026657
Ref: ライブラリ<61>-Footnote-704026714
Ref: ライブラリ<61>-Footnote-714026771
Ref: ライブラリ<61>-Footnote-724026828
Ref: ライブラリ<61>-Footnote-734026884
Ref: ライブラリ<61>-Footnote-744026941
Ref: ライブラリ<61>-Footnote-754026997
Ref: ライブラリ<61>-Footnote-764027054
Ref: ライブラリ<61>-Footnote-774027110
Node: ドキュメント<18>4027176
Ref: whatsnew/changelog id2444027306
Ref: 1a014027306
Ref: ドキュメント<18>-Footnote-14027881
Ref: ドキュメント<18>-Footnote-24027937
Node: テスト<16>4027993
Ref: whatsnew/changelog id2454028117
Ref: 1a024028117
Ref: テスト<16>-Footnote-14028514
Ref: テスト<16>-Footnote-24028570
Node: ビルド<19>4028626
Ref: whatsnew/changelog id2464028739
Ref: 1a034028739
Ref: ビルド<19>-Footnote-14029282
Ref: ビルド<19>-Footnote-24029338
Ref: ビルド<19>-Footnote-34029394
Ref: ビルド<19>-Footnote-44029450
Node: Windows<18>4029506
Ref: whatsnew/changelog id2474029615
Ref: 1a044029615
Ref: Windows<18>-Footnote-14030368
Ref: Windows<18>-Footnote-24030424
Ref: Windows<18>-Footnote-34030480
Ref: Windows<18>-Footnote-44030536
Ref: Windows<18>-Footnote-54030592
Ref: Windows<18>-Footnote-64030648
Ref: Windows<18>-Footnote-74030704
Node: macOS<11>4030759
Ref: whatsnew/changelog id2484030863
Ref: 1a054030863
Ref: macOS<11>-Footnote-14031402
Ref: macOS<11>-Footnote-24031458
Ref: macOS<11>-Footnote-34031514
Ref: macOS<11>-Footnote-44031570
Node: IDLE<10>4031625
Ref: whatsnew/changelog id2494031733
Ref: 1a074031733
Ref: IDLE<10>-Footnote-14032060
Ref: IDLE<10>-Footnote-24032115
Node: Tools/Demos<17>4032171
Ref: whatsnew/changelog id2504032279
Ref: 1a084032279
Ref: Tools/Demos<17>-Footnote-14032890
Ref: Tools/Demos<17>-Footnote-24032946
Ref: Tools/Demos<17>-Footnote-34033002
Node: C API<19>4033058
Ref: whatsnew/changelog id2514033149
Ref: 1a0a4033149
Ref: C API<19>-Footnote-14035093
Ref: C API<19>-Footnote-24035149
Ref: C API<19>-Footnote-34035205
Ref: C API<19>-Footnote-44035261
Ref: C API<19>-Footnote-54035317
Ref: C API<19>-Footnote-64035373
Ref: C API<19>-Footnote-74035429
Node: Python 3 13 0 alpha 34035485
Ref: whatsnew/changelog python-3-13-0-alpha-34035615
Ref: 1a0d4035615
Node: セキュリティ<20>4036028
Ref: whatsnew/changelog id2524036138
Ref: 1a0e4036138
Ref: セキュリティ<20>-Footnote-14036441
Ref: セキュリティ<20>-Footnote-24036497
Node: Core and Builtins<57>4036553
Ref: whatsnew/changelog id2534036691
Ref: 1a0f4036691
Ref: Core and Builtins<57>-Footnote-14044070
Ref: Core and Builtins<57>-Footnote-24044126
Ref: Core and Builtins<57>-Footnote-34044182
Ref: Core and Builtins<57>-Footnote-44044238
Ref: Core and Builtins<57>-Footnote-54044294
Ref: Core and Builtins<57>-Footnote-64044349
Ref: Core and Builtins<57>-Footnote-74044391
Ref: Core and Builtins<57>-Footnote-84044447
Ref: Core and Builtins<57>-Footnote-94044503
Ref: Core and Builtins<57>-Footnote-104044559
Ref: Core and Builtins<57>-Footnote-114044616
Ref: Core and Builtins<57>-Footnote-124044672
Ref: Core and Builtins<57>-Footnote-134044729
Ref: Core and Builtins<57>-Footnote-144044786
Ref: Core and Builtins<57>-Footnote-154044843
Ref: Core and Builtins<57>-Footnote-164044900
Ref: Core and Builtins<57>-Footnote-174044957
Ref: Core and Builtins<57>-Footnote-184045014
Ref: Core and Builtins<57>-Footnote-194045071
Ref: Core and Builtins<57>-Footnote-204045128
Ref: Core and Builtins<57>-Footnote-214045185
Ref: Core and Builtins<57>-Footnote-224045242
Ref: Core and Builtins<57>-Footnote-234045299
Ref: Core and Builtins<57>-Footnote-244045356
Ref: Core and Builtins<57>-Footnote-254045412
Ref: Core and Builtins<57>-Footnote-264045469
Ref: Core and Builtins<57>-Footnote-274045526
Ref: Core and Builtins<57>-Footnote-284045582
Ref: Core and Builtins<57>-Footnote-294045639
Ref: Core and Builtins<57>-Footnote-304045696
Ref: Core and Builtins<57>-Footnote-314045753
Ref: Core and Builtins<57>-Footnote-324045810
Ref: Core and Builtins<57>-Footnote-334045867
Ref: Core and Builtins<57>-Footnote-344045923
Ref: Core and Builtins<57>-Footnote-354045980
Ref: Core and Builtins<57>-Footnote-364046037
Ref: Core and Builtins<57>-Footnote-374046094
Ref: Core and Builtins<57>-Footnote-384046151
Ref: Core and Builtins<57>-Footnote-394046207
Ref: Core and Builtins<57>-Footnote-404046264
Ref: Core and Builtins<57>-Footnote-414046321
Ref: Core and Builtins<57>-Footnote-424046378
Ref: Core and Builtins<57>-Footnote-434046434
Ref: Core and Builtins<57>-Footnote-444046500
Ref: Core and Builtins<57>-Footnote-454046566
Ref: Core and Builtins<57>-Footnote-464046609
Node: ライブラリ<62>4046675
Ref: whatsnew/changelog id2544046813
Ref: 1a144046813
Ref: ライブラリ<62>-Footnote-14072015
Ref: ライブラリ<62>-Footnote-24072071
Ref: ライブラリ<62>-Footnote-34072127
Ref: ライブラリ<62>-Footnote-44072183
Ref: ライブラリ<62>-Footnote-54072239
Ref: ライブラリ<62>-Footnote-64072295
Ref: ライブラリ<62>-Footnote-74072351
Ref: ライブラリ<62>-Footnote-84072407
Ref: ライブラリ<62>-Footnote-94072463
Ref: ライブラリ<62>-Footnote-104072519
Ref: ライブラリ<62>-Footnote-114072575
Ref: ライブラリ<62>-Footnote-124072632
Ref: ライブラリ<62>-Footnote-134072689
Ref: ライブラリ<62>-Footnote-144072746
Ref: ライブラリ<62>-Footnote-154072803
Ref: ライブラリ<62>-Footnote-164072860
Ref: ライブラリ<62>-Footnote-174072917
Ref: ライブラリ<62>-Footnote-184072974
Ref: ライブラリ<62>-Footnote-194073031
Ref: ライブラリ<62>-Footnote-204073088
Ref: ライブラリ<62>-Footnote-214073144
Ref: ライブラリ<62>-Footnote-224073201
Ref: ライブラリ<62>-Footnote-234073257
Ref: ライブラリ<62>-Footnote-244073314
Ref: ライブラリ<62>-Footnote-254073371
Ref: ライブラリ<62>-Footnote-264073428
Ref: ライブラリ<62>-Footnote-274073485
Ref: ライブラリ<62>-Footnote-284073542
Ref: ライブラリ<62>-Footnote-294073599
Ref: ライブラリ<62>-Footnote-304073656
Ref: ライブラリ<62>-Footnote-314073713
Ref: ライブラリ<62>-Footnote-324073770
Ref: ライブラリ<62>-Footnote-334073826
Ref: ライブラリ<62>-Footnote-344073883
Ref: ライブラリ<62>-Footnote-354073940
Ref: ライブラリ<62>-Footnote-364073997
Ref: ライブラリ<62>-Footnote-374074053
Ref: ライブラリ<62>-Footnote-384074110
Ref: ライブラリ<62>-Footnote-394074167
Ref: ライブラリ<62>-Footnote-404074224
Ref: ライブラリ<62>-Footnote-414074281
Ref: ライブラリ<62>-Footnote-424074338
Ref: ライブラリ<62>-Footnote-434074395
Ref: ライブラリ<62>-Footnote-444074452
Ref: ライブラリ<62>-Footnote-454074509
Ref: ライブラリ<62>-Footnote-464074566
Ref: ライブラリ<62>-Footnote-474074622
Ref: ライブラリ<62>-Footnote-484074679
Ref: ライブラリ<62>-Footnote-494074735
Ref: ライブラリ<62>-Footnote-504074792
Ref: ライブラリ<62>-Footnote-514074849
Ref: ライブラリ<62>-Footnote-524074906
Ref: ライブラリ<62>-Footnote-534074963
Ref: ライブラリ<62>-Footnote-544075020
Ref: ライブラリ<62>-Footnote-554075077
Ref: ライブラリ<62>-Footnote-564075133
Ref: ライブラリ<62>-Footnote-574075190
Ref: ライブラリ<62>-Footnote-584075246
Ref: ライブラリ<62>-Footnote-594075302
Ref: ライブラリ<62>-Footnote-604075358
Ref: ライブラリ<62>-Footnote-614075415
Ref: ライブラリ<62>-Footnote-624075472
Ref: ライブラリ<62>-Footnote-634075528
Ref: ライブラリ<62>-Footnote-644075584
Ref: ライブラリ<62>-Footnote-654075641
Ref: ライブラリ<62>-Footnote-664075698
Ref: ライブラリ<62>-Footnote-674075755
Ref: ライブラリ<62>-Footnote-684075812
Ref: ライブラリ<62>-Footnote-694075869
Ref: ライブラリ<62>-Footnote-704075926
Ref: ライブラリ<62>-Footnote-714075982
Ref: ライブラリ<62>-Footnote-724076039
Ref: ライブラリ<62>-Footnote-734076096
Ref: ライブラリ<62>-Footnote-744076153
Ref: ライブラリ<62>-Footnote-754076210
Ref: ライブラリ<62>-Footnote-764076267
Ref: ライブラリ<62>-Footnote-774076324
Ref: ライブラリ<62>-Footnote-784076380
Ref: ライブラリ<62>-Footnote-794076437
Ref: ライブラリ<62>-Footnote-804076494
Ref: ライブラリ<62>-Footnote-814076551
Ref: ライブラリ<62>-Footnote-824076607
Ref: ライブラリ<62>-Footnote-834076664
Ref: ライブラリ<62>-Footnote-844076721
Ref: ライブラリ<62>-Footnote-854076778
Ref: ライブラリ<62>-Footnote-864076835
Ref: ライブラリ<62>-Footnote-874076891
Ref: ライブラリ<62>-Footnote-884076948
Ref: ライブラリ<62>-Footnote-894077004
Ref: ライブラリ<62>-Footnote-904077061
Ref: ライブラリ<62>-Footnote-914077118
Ref: ライブラリ<62>-Footnote-924077175
Ref: ライブラリ<62>-Footnote-934077232
Ref: ライブラリ<62>-Footnote-944077289
Ref: ライブラリ<62>-Footnote-954077345
Ref: ライブラリ<62>-Footnote-964077402
Ref: ライブラリ<62>-Footnote-974077458
Ref: ライブラリ<62>-Footnote-984077515
Ref: ライブラリ<62>-Footnote-994077571
Ref: ライブラリ<62>-Footnote-1004077627
Ref: ライブラリ<62>-Footnote-1014077684
Ref: ライブラリ<62>-Footnote-1024077742
Ref: ライブラリ<62>-Footnote-1034077800
Ref: ライブラリ<62>-Footnote-1044077858
Ref: ライブラリ<62>-Footnote-1054077916
Ref: ライブラリ<62>-Footnote-1064077973
Ref: ライブラリ<62>-Footnote-1074078030
Ref: ライブラリ<62>-Footnote-1084078088
Ref: ライブラリ<62>-Footnote-1094078146
Ref: ライブラリ<62>-Footnote-1104078204
Ref: ライブラリ<62>-Footnote-1114078261
Ref: ライブラリ<62>-Footnote-1124078319
Ref: ライブラリ<62>-Footnote-1134078377
Ref: ライブラリ<62>-Footnote-1144078434
Ref: ライブラリ<62>-Footnote-1154078492
Ref: ライブラリ<62>-Footnote-1164078536
Ref: ライブラリ<62>-Footnote-1174078594
Ref: ライブラリ<62>-Footnote-1184078651
Ref: ライブラリ<62>-Footnote-1194078708
Ref: ライブラリ<62>-Footnote-1204078765
Ref: ライブラリ<62>-Footnote-1214078832
Ref: ライブラリ<62>-Footnote-1224078899
Ref: ライブラリ<62>-Footnote-1234078966
Ref: ライブラリ<62>-Footnote-1244079033
Ref: ライブラリ<62>-Footnote-1254079100
Ref: ライブラリ<62>-Footnote-1264079167
Ref: ライブラリ<62>-Footnote-1274079234
Ref: ライブラリ<62>-Footnote-1284079301
Ref: ライブラリ<62>-Footnote-1294079368
Ref: ライブラリ<62>-Footnote-1304079435
Ref: ライブラリ<62>-Footnote-1314079502
Ref: ライブラリ<62>-Footnote-1324079569
Ref: ライブラリ<62>-Footnote-1334079636
Ref: ライブラリ<62>-Footnote-1344079703
Node: ドキュメント<19>4079770
Ref: whatsnew/changelog id2554079900
Ref: 1a2e4079900
Ref: ドキュメント<19>-Footnote-14080470
Ref: ドキュメント<19>-Footnote-24080526
Ref: ドキュメント<19>-Footnote-34080582
Ref: ドキュメント<19>-Footnote-44080637
Node: テスト<17>4080695
Ref: whatsnew/changelog id2564080819
Ref: 1a2f4080819
Ref: テスト<17>-Footnote-14082769
Ref: テスト<17>-Footnote-24082825
Ref: テスト<17>-Footnote-34082881
Ref: テスト<17>-Footnote-44082937
Ref: テスト<17>-Footnote-54082992
Ref: テスト<17>-Footnote-64083048
Ref: テスト<17>-Footnote-74083104
Ref: テスト<17>-Footnote-84083160
Ref: テスト<17>-Footnote-94083216
Ref: テスト<17>-Footnote-104083272
Node: ビルド<20>4083338
Ref: whatsnew/changelog id2574083451
Ref: 1a304083451
Ref: ビルド<20>-Footnote-14084700
Ref: ビルド<20>-Footnote-24084756
Ref: ビルド<20>-Footnote-34084812
Ref: ビルド<20>-Footnote-44084868
Ref: ビルド<20>-Footnote-54084924
Ref: ビルド<20>-Footnote-64084980
Ref: ビルド<20>-Footnote-74085036
Ref: ビルド<20>-Footnote-84085101
Node: Windows<19>4085166
Ref: whatsnew/changelog id2584085275
Ref: 1a314085275
Ref: Windows<19>-Footnote-14087116
Ref: Windows<19>-Footnote-24087172
Ref: Windows<19>-Footnote-34087228
Ref: Windows<19>-Footnote-44087284
Ref: Windows<19>-Footnote-54087340
Ref: Windows<19>-Footnote-64087395
Ref: Windows<19>-Footnote-74087450
Ref: Windows<19>-Footnote-84087506
Ref: Windows<19>-Footnote-94087562
Ref: Windows<19>-Footnote-104087617
Ref: Windows<19>-Footnote-114087673
Node: macOS<12>4087739
Ref: whatsnew/changelog id2594087843
Ref: 1a324087843
Ref: macOS<12>-Footnote-14090239
Ref: macOS<12>-Footnote-24090295
Ref: macOS<12>-Footnote-34090351
Ref: macOS<12>-Footnote-44090407
Ref: macOS<12>-Footnote-54090462
Ref: macOS<12>-Footnote-64090517
Ref: macOS<12>-Footnote-74090572
Ref: macOS<12>-Footnote-84090628
Ref: macOS<12>-Footnote-94090684
Ref: macOS<12>-Footnote-104090740
Ref: macOS<12>-Footnote-114090797
Ref: macOS<12>-Footnote-124090854
Node: IDLE<11>4090911
Ref: whatsnew/changelog id2604091013
Ref: 1a334091013
Ref: IDLE<11>-Footnote-14091589
Ref: IDLE<11>-Footnote-24091644
Ref: IDLE<11>-Footnote-34091700
Ref: IDLE<11>-Footnote-44091756
Ref: IDLE<11>-Footnote-54091812
Ref: IDLE<11>-Footnote-64091868
Node: C API<20>4091933
Ref: whatsnew/changelog id2614092017
Ref: 1a344092017
Ref: C API<20>-Footnote-14092732
Ref: C API<20>-Footnote-24092788
Ref: C API<20>-Footnote-34092844
Ref: C API<20>-Footnote-44092900
Node: Python 3 13 0 alpha 24092955
Ref: whatsnew/changelog python-3-13-0-alpha-24093085
Ref: 1a354093085
Node: Core and Builtins<58>4093438
Ref: whatsnew/changelog id2624093545
Ref: 1a364093545
Ref: Core and Builtins<58>-Footnote-14101371
Ref: Core and Builtins<58>-Footnote-24101427
Ref: Core and Builtins<58>-Footnote-34101483
Ref: Core and Builtins<58>-Footnote-44101539
Ref: Core and Builtins<58>-Footnote-54101595
Ref: Core and Builtins<58>-Footnote-64101651
Ref: Core and Builtins<58>-Footnote-74101707
Ref: Core and Builtins<58>-Footnote-84101763
Ref: Core and Builtins<58>-Footnote-94101818
Ref: Core and Builtins<58>-Footnote-104101873
Ref: Core and Builtins<58>-Footnote-114101929
Ref: Core and Builtins<58>-Footnote-124101986
Ref: Core and Builtins<58>-Footnote-134102043
Ref: Core and Builtins<58>-Footnote-144102100
Ref: Core and Builtins<58>-Footnote-154102157
Ref: Core and Builtins<58>-Footnote-164102214
Ref: Core and Builtins<58>-Footnote-174102271
Ref: Core and Builtins<58>-Footnote-184102328
Ref: Core and Builtins<58>-Footnote-194102385
Ref: Core and Builtins<58>-Footnote-204102442
Ref: Core and Builtins<58>-Footnote-214102499
Ref: Core and Builtins<58>-Footnote-224102556
Ref: Core and Builtins<58>-Footnote-234102613
Ref: Core and Builtins<58>-Footnote-244102670
Ref: Core and Builtins<58>-Footnote-254102727
Ref: Core and Builtins<58>-Footnote-264102784
Ref: Core and Builtins<58>-Footnote-274102841
Ref: Core and Builtins<58>-Footnote-284102898
Ref: Core and Builtins<58>-Footnote-294102955
Ref: Core and Builtins<58>-Footnote-304103011
Ref: Core and Builtins<58>-Footnote-314103067
Ref: Core and Builtins<58>-Footnote-324103124
Ref: Core and Builtins<58>-Footnote-334103181
Ref: Core and Builtins<58>-Footnote-344103238
Ref: Core and Builtins<58>-Footnote-354103295
Ref: Core and Builtins<58>-Footnote-364103352
Ref: Core and Builtins<58>-Footnote-374103409
Ref: Core and Builtins<58>-Footnote-384103466
Ref: Core and Builtins<58>-Footnote-394103523
Ref: Core and Builtins<58>-Footnote-404103580
Ref: Core and Builtins<58>-Footnote-414103637
Ref: Core and Builtins<58>-Footnote-424103694
Ref: Core and Builtins<58>-Footnote-434103751
Ref: Core and Builtins<58>-Footnote-444103807
Ref: Core and Builtins<58>-Footnote-454103873
Ref: Core and Builtins<58>-Footnote-464103930
Ref: Core and Builtins<58>-Footnote-474103996
Ref: Core and Builtins<58>-Footnote-484104053
Ref: Core and Builtins<58>-Footnote-494104110
Ref: Core and Builtins<58>-Footnote-504104167
Node: ライブラリ<63>4104233
Ref: whatsnew/changelog id2634104362
Ref: 1a394104362
Ref: ライブラリ<63>-Footnote-14114933
Ref: ライブラリ<63>-Footnote-24114989
Ref: ライブラリ<63>-Footnote-34115045
Ref: ライブラリ<63>-Footnote-44115101
Ref: ライブラリ<63>-Footnote-54115157
Ref: ライブラリ<63>-Footnote-64115213
Ref: ライブラリ<63>-Footnote-74115269
Ref: ライブラリ<63>-Footnote-84115325
Ref: ライブラリ<63>-Footnote-94115381
Ref: ライブラリ<63>-Footnote-104115437
Ref: ライブラリ<63>-Footnote-114115494
Ref: ライブラリ<63>-Footnote-124115550
Ref: ライブラリ<63>-Footnote-134115607
Ref: ライブラリ<63>-Footnote-144115664
Ref: ライブラリ<63>-Footnote-154115721
Ref: ライブラリ<63>-Footnote-164115778
Ref: ライブラリ<63>-Footnote-174115835
Ref: ライブラリ<63>-Footnote-184115892
Ref: ライブラリ<63>-Footnote-194115949
Ref: ライブラリ<63>-Footnote-204116005
Ref: ライブラリ<63>-Footnote-214116062
Ref: ライブラリ<63>-Footnote-224116119
Ref: ライブラリ<63>-Footnote-234116175
Ref: ライブラリ<63>-Footnote-244116232
Ref: ライブラリ<63>-Footnote-254116288
Ref: ライブラリ<63>-Footnote-264116345
Ref: ライブラリ<63>-Footnote-274116402
Ref: ライブラリ<63>-Footnote-284116459
Ref: ライブラリ<63>-Footnote-294116516
Ref: ライブラリ<63>-Footnote-304116573
Ref: ライブラリ<63>-Footnote-314116630
Ref: ライブラリ<63>-Footnote-324116687
Ref: ライブラリ<63>-Footnote-334116744
Ref: ライブラリ<63>-Footnote-344116801
Ref: ライブラリ<63>-Footnote-354116858
Ref: ライブラリ<63>-Footnote-364116915
Ref: ライブラリ<63>-Footnote-374116972
Ref: ライブラリ<63>-Footnote-384117029
Ref: ライブラリ<63>-Footnote-394117085
Ref: ライブラリ<63>-Footnote-404117141
Ref: ライブラリ<63>-Footnote-414117198
Ref: ライブラリ<63>-Footnote-424117255
Ref: ライブラリ<63>-Footnote-434117312
Ref: ライブラリ<63>-Footnote-444117368
Ref: ライブラリ<63>-Footnote-454117424
Ref: ライブラリ<63>-Footnote-464117481
Ref: ライブラリ<63>-Footnote-474117538
Ref: ライブラリ<63>-Footnote-484117595
Ref: ライブラリ<63>-Footnote-494117652
Ref: ライブラリ<63>-Footnote-504117708
Ref: ライブラリ<63>-Footnote-514117765
Ref: ライブラリ<63>-Footnote-524117822
Ref: ライブラリ<63>-Footnote-534117879
Ref: ライブラリ<63>-Footnote-544117935
Ref: ライブラリ<63>-Footnote-554117991
Ref: ライブラリ<63>-Footnote-564118047
Ref: ライブラリ<63>-Footnote-574118104
Ref: ライブラリ<63>-Footnote-584118161
Ref: ライブラリ<63>-Footnote-594118217
Ref: ライブラリ<63>-Footnote-604118273
Ref: ライブラリ<63>-Footnote-614118358
Ref: ライブラリ<63>-Footnote-624118414
Node: テスト<18>4118470
Ref: whatsnew/changelog id2644118591
Ref: 1a4a4118591
Ref: テスト<18>-Footnote-14120182
Ref: テスト<18>-Footnote-24120238
Ref: テスト<18>-Footnote-34120294
Ref: テスト<18>-Footnote-44120350
Ref: テスト<18>-Footnote-54120406
Ref: テスト<18>-Footnote-64120462
Ref: テスト<18>-Footnote-74120518
Ref: テスト<18>-Footnote-84120574
Node: ビルド<21>4120630
Ref: whatsnew/changelog id2654120743
Ref: 1a4b4120743
Ref: ビルド<21>-Footnote-14121734
Ref: ビルド<21>-Footnote-24121789
Ref: ビルド<21>-Footnote-34121845
Ref: ビルド<21>-Footnote-44121895
Ref: ビルド<21>-Footnote-54121951
Ref: ビルド<21>-Footnote-64122007
Node: Windows<20>4122062
Ref: whatsnew/changelog id2664122171
Ref: 1a4c4122171
Ref: Windows<20>-Footnote-14122625
Ref: Windows<20>-Footnote-24122681
Ref: Windows<20>-Footnote-34122737
Node: macOS<13>4122793
Ref: whatsnew/changelog id2674122897
Ref: 1a4e4122897
Ref: macOS<13>-Footnote-14123828
Ref: macOS<13>-Footnote-24123883
Ref: macOS<13>-Footnote-34123939
Ref: macOS<13>-Footnote-44123995
Ref: macOS<13>-Footnote-54124050
Node: IDLE<12>4124105
Ref: whatsnew/changelog id2684124213
Ref: 1a4f4124213
Ref: IDLE<12>-Footnote-14124551
Node: Tools/Demos<18>4124616
Ref: whatsnew/changelog id2694124724
Ref: 1a504124724
Ref: Tools/Demos<18>-Footnote-14125081
Node: C API<21>4125137
Ref: whatsnew/changelog id2704125228
Ref: 1a514125228
Ref: C API<21>-Footnote-14130594
Ref: C API<21>-Footnote-24130650
Ref: C API<21>-Footnote-34130706
Ref: C API<21>-Footnote-44130762
Ref: C API<21>-Footnote-54130818
Ref: C API<21>-Footnote-64130874
Ref: C API<21>-Footnote-74130930
Ref: C API<21>-Footnote-84130986
Ref: C API<21>-Footnote-94131042
Ref: C API<21>-Footnote-104131098
Ref: C API<21>-Footnote-114131155
Ref: C API<21>-Footnote-124131198
Ref: C API<21>-Footnote-134131255
Ref: C API<21>-Footnote-144131312
Ref: C API<21>-Footnote-154131369
Ref: C API<21>-Footnote-164131426
Ref: C API<21>-Footnote-174131483
Ref: C API<21>-Footnote-184131539
Ref: C API<21>-Footnote-194131595
Ref: C API<21>-Footnote-204131652
Node: Python 3 13 0 alpha 14131708
Ref: whatsnew/changelog python-3-13-0-alpha-14131837
Ref: 1a524131837
Node: セキュリティ<21>4132282
Ref: whatsnew/changelog id2714132392
Ref: 1a534132392
Ref: セキュリティ<21>-Footnote-14133674
Ref: セキュリティ<21>-Footnote-24133730
Ref: セキュリティ<21>-Footnote-34133786
Ref: セキュリティ<21>-Footnote-44133842
Ref: セキュリティ<21>-Footnote-54133898
Ref: セキュリティ<21>-Footnote-64133954
Ref: セキュリティ<21>-Footnote-74134009
Node: Core and Builtins<59>4134065
Ref: whatsnew/changelog id2724134203
Ref: 1a544134203
Ref: Core and Builtins<59>-Footnote-14164953
Ref: Core and Builtins<59>-Footnote-24165009
Ref: Core and Builtins<59>-Footnote-34165065
Ref: Core and Builtins<59>-Footnote-44165121
Ref: Core and Builtins<59>-Footnote-54165177
Ref: Core and Builtins<59>-Footnote-64165233
Ref: Core and Builtins<59>-Footnote-74165289
Ref: Core and Builtins<59>-Footnote-84165345
Ref: Core and Builtins<59>-Footnote-94165401
Ref: Core and Builtins<59>-Footnote-104165457
Ref: Core and Builtins<59>-Footnote-114165514
Ref: Core and Builtins<59>-Footnote-124165571
Ref: Core and Builtins<59>-Footnote-134165628
Ref: Core and Builtins<59>-Footnote-144165685
Ref: Core and Builtins<59>-Footnote-154165742
Ref: Core and Builtins<59>-Footnote-164165799
Ref: Core and Builtins<59>-Footnote-174165856
Ref: Core and Builtins<59>-Footnote-184165913
Ref: Core and Builtins<59>-Footnote-194165970
Ref: Core and Builtins<59>-Footnote-204166027
Ref: Core and Builtins<59>-Footnote-214166084
Ref: Core and Builtins<59>-Footnote-224166141
Ref: Core and Builtins<59>-Footnote-234166198
Ref: Core and Builtins<59>-Footnote-244166255
Ref: Core and Builtins<59>-Footnote-254166312
Ref: Core and Builtins<59>-Footnote-264166369
Ref: Core and Builtins<59>-Footnote-274166426
Ref: Core and Builtins<59>-Footnote-284166483
Ref: Core and Builtins<59>-Footnote-294166540
Ref: Core and Builtins<59>-Footnote-304166597
Ref: Core and Builtins<59>-Footnote-314166654
Ref: Core and Builtins<59>-Footnote-324166711
Ref: Core and Builtins<59>-Footnote-334166768
Ref: Core and Builtins<59>-Footnote-344166825
Ref: Core and Builtins<59>-Footnote-354166882
Ref: Core and Builtins<59>-Footnote-364166939
Ref: Core and Builtins<59>-Footnote-374166996
Ref: Core and Builtins<59>-Footnote-384167053
Ref: Core and Builtins<59>-Footnote-394167110
Ref: Core and Builtins<59>-Footnote-404167167
Ref: Core and Builtins<59>-Footnote-414167224
Ref: Core and Builtins<59>-Footnote-424167281
Ref: Core and Builtins<59>-Footnote-434167338
Ref: Core and Builtins<59>-Footnote-444167395
Ref: Core and Builtins<59>-Footnote-454167451
Ref: Core and Builtins<59>-Footnote-464167508
Ref: Core and Builtins<59>-Footnote-474167565
Ref: Core and Builtins<59>-Footnote-484167622
Ref: Core and Builtins<59>-Footnote-494167679
Ref: Core and Builtins<59>-Footnote-504167736
Ref: Core and Builtins<59>-Footnote-514167793
Ref: Core and Builtins<59>-Footnote-524167850
Ref: Core and Builtins<59>-Footnote-534167907
Ref: Core and Builtins<59>-Footnote-544167964
Ref: Core and Builtins<59>-Footnote-554168021
Ref: Core and Builtins<59>-Footnote-564168078
Ref: Core and Builtins<59>-Footnote-574168135
Ref: Core and Builtins<59>-Footnote-584168192
Ref: Core and Builtins<59>-Footnote-594168249
Ref: Core and Builtins<59>-Footnote-604168306
Ref: Core and Builtins<59>-Footnote-614168363
Ref: Core and Builtins<59>-Footnote-624168420
Ref: Core and Builtins<59>-Footnote-634168477
Ref: Core and Builtins<59>-Footnote-644168534
Ref: Core and Builtins<59>-Footnote-654168590
Ref: Core and Builtins<59>-Footnote-664168647
Ref: Core and Builtins<59>-Footnote-674168704
Ref: Core and Builtins<59>-Footnote-684168760
Ref: Core and Builtins<59>-Footnote-694168817
Ref: Core and Builtins<59>-Footnote-704168874
Ref: Core and Builtins<59>-Footnote-714168931
Ref: Core and Builtins<59>-Footnote-724168988
Ref: Core and Builtins<59>-Footnote-734169045
Ref: Core and Builtins<59>-Footnote-744169101
Ref: Core and Builtins<59>-Footnote-754169158
Ref: Core and Builtins<59>-Footnote-764169215
Ref: Core and Builtins<59>-Footnote-774169272
Ref: Core and Builtins<59>-Footnote-784169329
Ref: Core and Builtins<59>-Footnote-794169386
Ref: Core and Builtins<59>-Footnote-804169443
Ref: Core and Builtins<59>-Footnote-814169500
Ref: Core and Builtins<59>-Footnote-824169557
Ref: Core and Builtins<59>-Footnote-834169614
Ref: Core and Builtins<59>-Footnote-844169671
Ref: Core and Builtins<59>-Footnote-854169714
Ref: Core and Builtins<59>-Footnote-864169771
Ref: Core and Builtins<59>-Footnote-874169828
Ref: Core and Builtins<59>-Footnote-884169885
Ref: Core and Builtins<59>-Footnote-894169941
Ref: Core and Builtins<59>-Footnote-904169998
Ref: Core and Builtins<59>-Footnote-914170055
Ref: Core and Builtins<59>-Footnote-924170112
Ref: Core and Builtins<59>-Footnote-934170169
Ref: Core and Builtins<59>-Footnote-944170226
Ref: Core and Builtins<59>-Footnote-954170283
Ref: Core and Builtins<59>-Footnote-964170340
Ref: Core and Builtins<59>-Footnote-974170397
Ref: Core and Builtins<59>-Footnote-984170454
Ref: Core and Builtins<59>-Footnote-994170511
Ref: Core and Builtins<59>-Footnote-1004170568
Ref: Core and Builtins<59>-Footnote-1014170626
Ref: Core and Builtins<59>-Footnote-1024170684
Ref: Core and Builtins<59>-Footnote-1034170742
Ref: Core and Builtins<59>-Footnote-1044170800
Ref: Core and Builtins<59>-Footnote-1054170858
Ref: Core and Builtins<59>-Footnote-1064170916
Ref: Core and Builtins<59>-Footnote-1074170973
Ref: Core and Builtins<59>-Footnote-1084171030
Ref: Core and Builtins<59>-Footnote-1094171088
Ref: Core and Builtins<59>-Footnote-1104171146
Ref: Core and Builtins<59>-Footnote-1114171204
Ref: Core and Builtins<59>-Footnote-1124171262
Ref: Core and Builtins<59>-Footnote-1134171320
Ref: Core and Builtins<59>-Footnote-1144171378
Ref: Core and Builtins<59>-Footnote-1154171436
Ref: Core and Builtins<59>-Footnote-1164171494
Ref: Core and Builtins<59>-Footnote-1174171552
Ref: Core and Builtins<59>-Footnote-1184171610
Ref: Core and Builtins<59>-Footnote-1194171668
Ref: Core and Builtins<59>-Footnote-1204171726
Ref: Core and Builtins<59>-Footnote-1214171783
Ref: Core and Builtins<59>-Footnote-1224171841
Ref: Core and Builtins<59>-Footnote-1234171899
Ref: Core and Builtins<59>-Footnote-1244171956
Ref: Core and Builtins<59>-Footnote-1254172014
Ref: Core and Builtins<59>-Footnote-1264172072
Ref: Core and Builtins<59>-Footnote-1274172130
Ref: Core and Builtins<59>-Footnote-1284172188
Ref: Core and Builtins<59>-Footnote-1294172246
Ref: Core and Builtins<59>-Footnote-1304172304
Ref: Core and Builtins<59>-Footnote-1314172362
Ref: Core and Builtins<59>-Footnote-1324172420
Ref: Core and Builtins<59>-Footnote-1334172478
Ref: Core and Builtins<59>-Footnote-1344172536
Ref: Core and Builtins<59>-Footnote-1354172594
Ref: Core and Builtins<59>-Footnote-1364172652
Ref: Core and Builtins<59>-Footnote-1374172710
Ref: Core and Builtins<59>-Footnote-1384172768
Ref: Core and Builtins<59>-Footnote-1394172826
Ref: Core and Builtins<59>-Footnote-1404172884
Ref: Core and Builtins<59>-Footnote-1414172942
Ref: Core and Builtins<59>-Footnote-1424173000
Ref: Core and Builtins<59>-Footnote-1434173058
Ref: Core and Builtins<59>-Footnote-1444173116
Ref: Core and Builtins<59>-Footnote-1454173173
Ref: Core and Builtins<59>-Footnote-1464173231
Ref: Core and Builtins<59>-Footnote-1474173289
Ref: Core and Builtins<59>-Footnote-1484173346
Ref: Core and Builtins<59>-Footnote-1494173404
Ref: Core and Builtins<59>-Footnote-1504173462
Ref: Core and Builtins<59>-Footnote-1514173520
Ref: Core and Builtins<59>-Footnote-1524173578
Ref: Core and Builtins<59>-Footnote-1534173636
Ref: Core and Builtins<59>-Footnote-1544173694
Ref: Core and Builtins<59>-Footnote-1554173752
Ref: Core and Builtins<59>-Footnote-1564173810
Ref: Core and Builtins<59>-Footnote-1574173868
Ref: Core and Builtins<59>-Footnote-1584173926
Ref: Core and Builtins<59>-Footnote-1594173984
Ref: Core and Builtins<59>-Footnote-1604174042
Ref: Core and Builtins<59>-Footnote-1614174100
Ref: Core and Builtins<59>-Footnote-1624174158
Ref: Core and Builtins<59>-Footnote-1634174216
Ref: Core and Builtins<59>-Footnote-1644174274
Ref: Core and Builtins<59>-Footnote-1654174332
Ref: Core and Builtins<59>-Footnote-1664174390
Ref: Core and Builtins<59>-Footnote-1674174448
Ref: Core and Builtins<59>-Footnote-1684174505
Ref: Core and Builtins<59>-Footnote-1694174562
Ref: Core and Builtins<59>-Footnote-1704174619
Ref: Core and Builtins<59>-Footnote-1714174677
Node: ライブラリ<64>4174734
Ref: whatsnew/changelog id2734174872
Ref: 1a664174872
Ref: ライブラリ<64>-Footnote-14223251
Ref: ライブラリ<64>-Footnote-24223307
Ref: ライブラリ<64>-Footnote-34223363
Ref: ライブラリ<64>-Footnote-44223419
Ref: ライブラリ<64>-Footnote-54223474
Ref: ライブラリ<64>-Footnote-64223530
Ref: ライブラリ<64>-Footnote-74223586
Ref: ライブラリ<64>-Footnote-84223642
Ref: ライブラリ<64>-Footnote-94223697
Ref: ライブラリ<64>-Footnote-104223753
Ref: ライブラリ<64>-Footnote-114223809
Ref: ライブラリ<64>-Footnote-124223866
Ref: ライブラリ<64>-Footnote-134223923
Ref: ライブラリ<64>-Footnote-144223980
Ref: ライブラリ<64>-Footnote-154224037
Ref: ライブラリ<64>-Footnote-164224094
Ref: ライブラリ<64>-Footnote-174224151
Ref: ライブラリ<64>-Footnote-184224208
Ref: ライブラリ<64>-Footnote-194224265
Ref: ライブラリ<64>-Footnote-204224322
Ref: ライブラリ<64>-Footnote-214224379
Ref: ライブラリ<64>-Footnote-224224436
Ref: ライブラリ<64>-Footnote-234224493
Ref: ライブラリ<64>-Footnote-244224550
Ref: ライブラリ<64>-Footnote-254224593
Ref: ライブラリ<64>-Footnote-264224649
Ref: ライブラリ<64>-Footnote-274224706
Ref: ライブラリ<64>-Footnote-284224763
Ref: ライブラリ<64>-Footnote-294224820
Ref: ライブラリ<64>-Footnote-304224877
Ref: ライブラリ<64>-Footnote-314224934
Ref: ライブラリ<64>-Footnote-324224991
Ref: ライブラリ<64>-Footnote-334225048
Ref: ライブラリ<64>-Footnote-344225105
Ref: ライブラリ<64>-Footnote-354225162
Ref: ライブラリ<64>-Footnote-364225219
Ref: ライブラリ<64>-Footnote-374225276
Ref: ライブラリ<64>-Footnote-384225332
Ref: ライブラリ<64>-Footnote-394225389
Ref: ライブラリ<64>-Footnote-404225446
Ref: ライブラリ<64>-Footnote-414225503
Ref: ライブラリ<64>-Footnote-424225560
Ref: ライブラリ<64>-Footnote-434225617
Ref: ライブラリ<64>-Footnote-444225674
Ref: ライブラリ<64>-Footnote-454225731
Ref: ライブラリ<64>-Footnote-464225788
Ref: ライブラリ<64>-Footnote-474225845
Ref: ライブラリ<64>-Footnote-484225902
Ref: ライブラリ<64>-Footnote-494225959
Ref: ライブラリ<64>-Footnote-504226016
Ref: ライブラリ<64>-Footnote-514226072
Ref: ライブラリ<64>-Footnote-524226129
Ref: ライブラリ<64>-Footnote-534226185
Ref: ライブラリ<64>-Footnote-544226242
Ref: ライブラリ<64>-Footnote-554226299
Ref: ライブラリ<64>-Footnote-564226356
Ref: ライブラリ<64>-Footnote-574226413
Ref: ライブラリ<64>-Footnote-584226470
Ref: ライブラリ<64>-Footnote-594226527
Ref: ライブラリ<64>-Footnote-604226584
Ref: ライブラリ<64>-Footnote-614226641
Ref: ライブラリ<64>-Footnote-624226698
Ref: ライブラリ<64>-Footnote-634226755
Ref: ライブラリ<64>-Footnote-644226812
Ref: ライブラリ<64>-Footnote-654226869
Ref: ライブラリ<64>-Footnote-664226926
Ref: ライブラリ<64>-Footnote-674226983
Ref: ライブラリ<64>-Footnote-684227040
Ref: ライブラリ<64>-Footnote-694227097
Ref: ライブラリ<64>-Footnote-704227153
Ref: ライブラリ<64>-Footnote-714227210
Ref: ライブラリ<64>-Footnote-724227267
Ref: ライブラリ<64>-Footnote-734227324
Ref: ライブラリ<64>-Footnote-744227381
Ref: ライブラリ<64>-Footnote-754227438
Ref: ライブラリ<64>-Footnote-764227494
Ref: ライブラリ<64>-Footnote-774227551
Ref: ライブラリ<64>-Footnote-784227608
Ref: ライブラリ<64>-Footnote-794227665
Ref: ライブラリ<64>-Footnote-804227722
Ref: ライブラリ<64>-Footnote-814227779
Ref: ライブラリ<64>-Footnote-824227836
Ref: ライブラリ<64>-Footnote-834227893
Ref: ライブラリ<64>-Footnote-844227949
Ref: ライブラリ<64>-Footnote-854228005
Ref: ライブラリ<64>-Footnote-864228061
Ref: ライブラリ<64>-Footnote-874228117
Ref: ライブラリ<64>-Footnote-884228174
Ref: ライブラリ<64>-Footnote-894228231
Ref: ライブラリ<64>-Footnote-904228288
Ref: ライブラリ<64>-Footnote-914228345
Ref: ライブラリ<64>-Footnote-924228402
Ref: ライブラリ<64>-Footnote-934228458
Ref: ライブラリ<64>-Footnote-944228515
Ref: ライブラリ<64>-Footnote-954228572
Ref: ライブラリ<64>-Footnote-964228629
Ref: ライブラリ<64>-Footnote-974228685
Ref: ライブラリ<64>-Footnote-984228742
Ref: ライブラリ<64>-Footnote-994228799
Ref: ライブラリ<64>-Footnote-1004228856
Ref: ライブラリ<64>-Footnote-1014228914
Ref: ライブラリ<64>-Footnote-1024228972
Ref: ライブラリ<64>-Footnote-1034229030
Ref: ライブラリ<64>-Footnote-1044229088
Ref: ライブラリ<64>-Footnote-1054229146
Ref: ライブラリ<64>-Footnote-1064229204
Ref: ライブラリ<64>-Footnote-1074229262
Ref: ライブラリ<64>-Footnote-1084229319
Ref: ライブラリ<64>-Footnote-1094229377
Ref: ライブラリ<64>-Footnote-1104229434
Ref: ライブラリ<64>-Footnote-1114229492
Ref: ライブラリ<64>-Footnote-1124229549
Ref: ライブラリ<64>-Footnote-1134229606
Ref: ライブラリ<64>-Footnote-1144229663
Ref: ライブラリ<64>-Footnote-1154229721
Ref: ライブラリ<64>-Footnote-1164229779
Ref: ライブラリ<64>-Footnote-1174229837
Ref: ライブラリ<64>-Footnote-1184229895
Ref: ライブラリ<64>-Footnote-1194229953
Ref: ライブラリ<64>-Footnote-1204230011
Ref: ライブラリ<64>-Footnote-1214230069
Ref: ライブラリ<64>-Footnote-1224230127
Ref: ライブラリ<64>-Footnote-1234230185
Ref: ライブラリ<64>-Footnote-1244230243
Ref: ライブラリ<64>-Footnote-1254230301
Ref: ライブラリ<64>-Footnote-1264230359
Ref: ライブラリ<64>-Footnote-1274230417
Ref: ライブラリ<64>-Footnote-1284230475
Ref: ライブラリ<64>-Footnote-1294230533
Ref: ライブラリ<64>-Footnote-1304230591
Ref: ライブラリ<64>-Footnote-1314230649
Ref: ライブラリ<64>-Footnote-1324230707
Ref: ライブラリ<64>-Footnote-1334230765
Ref: ライブラリ<64>-Footnote-1344230823
Ref: ライブラリ<64>-Footnote-1354230881
Ref: ライブラリ<64>-Footnote-1364230938
Ref: ライブラリ<64>-Footnote-1374230996
Ref: ライブラリ<64>-Footnote-1384231054
Ref: ライブラリ<64>-Footnote-1394231112
Ref: ライブラリ<64>-Footnote-1404231170
Ref: ライブラリ<64>-Footnote-1414231228
Ref: ライブラリ<64>-Footnote-1424231286
Ref: ライブラリ<64>-Footnote-1434231344
Ref: ライブラリ<64>-Footnote-1444231402
Ref: ライブラリ<64>-Footnote-1454231460
Ref: ライブラリ<64>-Footnote-1464231518
Ref: ライブラリ<64>-Footnote-1474231576
Ref: ライブラリ<64>-Footnote-1484231634
Ref: ライブラリ<64>-Footnote-1494231692
Ref: ライブラリ<64>-Footnote-1504231749
Ref: ライブラリ<64>-Footnote-1514231807
Ref: ライブラリ<64>-Footnote-1524231864
Ref: ライブラリ<64>-Footnote-1534231922
Ref: ライブラリ<64>-Footnote-1544231980
Ref: ライブラリ<64>-Footnote-1554232038
Ref: ライブラリ<64>-Footnote-1564232096
Ref: ライブラリ<64>-Footnote-1574232154
Ref: ライブラリ<64>-Footnote-1584232212
Ref: ライブラリ<64>-Footnote-1594232270
Ref: ライブラリ<64>-Footnote-1604232328
Ref: ライブラリ<64>-Footnote-1614232386
Ref: ライブラリ<64>-Footnote-1624232444
Ref: ライブラリ<64>-Footnote-1634232502
Ref: ライブラリ<64>-Footnote-1644232560
Ref: ライブラリ<64>-Footnote-1654232618
Ref: ライブラリ<64>-Footnote-1664232676
Ref: ライブラリ<64>-Footnote-1674232733
Ref: ライブラリ<64>-Footnote-1684232790
Ref: ライブラリ<64>-Footnote-1694232848
Ref: ライブラリ<64>-Footnote-1704232906
Ref: ライブラリ<64>-Footnote-1714232964
Ref: ライブラリ<64>-Footnote-1724233022
Ref: ライブラリ<64>-Footnote-1734233066
Ref: ライブラリ<64>-Footnote-1744233124
Ref: ライブラリ<64>-Footnote-1754233182
Ref: ライブラリ<64>-Footnote-1764233240
Ref: ライブラリ<64>-Footnote-1774233298
Ref: ライブラリ<64>-Footnote-1784233356
Ref: ライブラリ<64>-Footnote-1794233414
Ref: ライブラリ<64>-Footnote-1804233472
Ref: ライブラリ<64>-Footnote-1814233530
Ref: ライブラリ<64>-Footnote-1824233588
Ref: ライブラリ<64>-Footnote-1834233646
Ref: ライブラリ<64>-Footnote-1844233704
Ref: ライブラリ<64>-Footnote-1854233762
Ref: ライブラリ<64>-Footnote-1864233820
Ref: ライブラリ<64>-Footnote-1874233878
Ref: ライブラリ<64>-Footnote-1884233936
Ref: ライブラリ<64>-Footnote-1894233994
Ref: ライブラリ<64>-Footnote-1904234052
Ref: ライブラリ<64>-Footnote-1914234110
Ref: ライブラリ<64>-Footnote-1924234168
Ref: ライブラリ<64>-Footnote-1934234226
Ref: ライブラリ<64>-Footnote-1944234284
Ref: ライブラリ<64>-Footnote-1954234342
Ref: ライブラリ<64>-Footnote-1964234400
Ref: ライブラリ<64>-Footnote-1974234458
Ref: ライブラリ<64>-Footnote-1984234515
Ref: ライブラリ<64>-Footnote-1994234573
Ref: ライブラリ<64>-Footnote-2004234631
Ref: ライブラリ<64>-Footnote-2014234689
Ref: ライブラリ<64>-Footnote-2024234747
Ref: ライブラリ<64>-Footnote-2034234805
Ref: ライブラリ<64>-Footnote-2044234863
Ref: ライブラリ<64>-Footnote-2054234921
Ref: ライブラリ<64>-Footnote-2064234978
Ref: ライブラリ<64>-Footnote-2074235036
Ref: ライブラリ<64>-Footnote-2084235094
Ref: ライブラリ<64>-Footnote-2094235152
Ref: ライブラリ<64>-Footnote-2104235210
Ref: ライブラリ<64>-Footnote-2114235267
Ref: ライブラリ<64>-Footnote-2124235325
Ref: ライブラリ<64>-Footnote-2134235383
Ref: ライブラリ<64>-Footnote-2144235441
Ref: ライブラリ<64>-Footnote-2154235499
Ref: ライブラリ<64>-Footnote-2164235557
Ref: ライブラリ<64>-Footnote-2174235615
Ref: ライブラリ<64>-Footnote-2184235673
Ref: ライブラリ<64>-Footnote-2194235717
Ref: ライブラリ<64>-Footnote-2204235775
Ref: ライブラリ<64>-Footnote-2214235819
Ref: ライブラリ<64>-Footnote-2224235877
Ref: ライブラリ<64>-Footnote-2234235921
Ref: ライブラリ<64>-Footnote-2244235979
Ref: ライブラリ<64>-Footnote-2254236023
Ref: ライブラリ<64>-Footnote-2264236081
Ref: ライブラリ<64>-Footnote-2274236125
Ref: ライブラリ<64>-Footnote-2284236183
Ref: ライブラリ<64>-Footnote-2294236227
Ref: ライブラリ<64>-Footnote-2304236285
Ref: ライブラリ<64>-Footnote-2314236343
Ref: ライブラリ<64>-Footnote-2324236387
Ref: ライブラリ<64>-Footnote-2334236445
Ref: ライブラリ<64>-Footnote-2344236489
Ref: ライブラリ<64>-Footnote-2354236547
Ref: ライブラリ<64>-Footnote-2364236605
Ref: ライブラリ<64>-Footnote-2374236663
Ref: ライブラリ<64>-Footnote-2384236721
Ref: ライブラリ<64>-Footnote-2394236765
Ref: ライブラリ<64>-Footnote-2404236823
Ref: ライブラリ<64>-Footnote-2414236867
Ref: ライブラリ<64>-Footnote-2424236914
Ref: ライブラリ<64>-Footnote-2434236971
Ref: ライブラリ<64>-Footnote-2444237029
Ref: ライブラリ<64>-Footnote-2454237073
Ref: ライブラリ<64>-Footnote-2464237131
Ref: ライブラリ<64>-Footnote-2474237175
Ref: ライブラリ<64>-Footnote-2484237233
Ref: ライブラリ<64>-Footnote-2494237277
Ref: ライブラリ<64>-Footnote-2504237335
Ref: ライブラリ<64>-Footnote-2514237379
Ref: ライブラリ<64>-Footnote-2524237437
Ref: ライブラリ<64>-Footnote-2534237481
Ref: ライブラリ<64>-Footnote-2544237539
Ref: ライブラリ<64>-Footnote-2554237597
Ref: ライブラリ<64>-Footnote-2564237655
Ref: ライブラリ<64>-Footnote-2574237713
Ref: ライブラリ<64>-Footnote-2584237770
Ref: ライブラリ<64>-Footnote-2594237828
Ref: ライブラリ<64>-Footnote-2604237872
Ref: ライブラリ<64>-Footnote-2614237930
Ref: ライブラリ<64>-Footnote-2624237988
Ref: ライブラリ<64>-Footnote-2634238046
Ref: ライブラリ<64>-Footnote-2644238104
Ref: ライブラリ<64>-Footnote-2654238148
Ref: ライブラリ<64>-Footnote-2664238206
Ref: ライブラリ<64>-Footnote-2674238250
Ref: ライブラリ<64>-Footnote-2684238308
Ref: ライブラリ<64>-Footnote-2694238352
Ref: ライブラリ<64>-Footnote-2704238410
Ref: ライブラリ<64>-Footnote-2714238454
Ref: ライブラリ<64>-Footnote-2724238512
Ref: ライブラリ<64>-Footnote-2734238569
Ref: ライブラリ<64>-Footnote-2744238627
Ref: ライブラリ<64>-Footnote-2754238685
Ref: ライブラリ<64>-Footnote-2764238743
Ref: ライブラリ<64>-Footnote-2774238801
Ref: ライブラリ<64>-Footnote-2784238859
Ref: ライブラリ<64>-Footnote-2794238917
Ref: ライブラリ<64>-Footnote-2804238975
Ref: ライブラリ<64>-Footnote-2814239033
Ref: ライブラリ<64>-Footnote-2824239091
Ref: ライブラリ<64>-Footnote-2834239149
Ref: ライブラリ<64>-Footnote-2844239206
Ref: ライブラリ<64>-Footnote-2854239264
Ref: ライブラリ<64>-Footnote-2864239322
Ref: ライブラリ<64>-Footnote-2874239380
Ref: ライブラリ<64>-Footnote-2884239437
Ref: ライブラリ<64>-Footnote-2894239495
Ref: ライブラリ<64>-Footnote-2904239552
Ref: ライブラリ<64>-Footnote-2914239609
Ref: ライブラリ<64>-Footnote-2924239666
Ref: ライブラリ<64>-Footnote-2934239723
Ref: ライブラリ<64>-Footnote-2944239780
Ref: ライブラリ<64>-Footnote-2954239837
Ref: ライブラリ<64>-Footnote-2964239894
Ref: ライブラリ<64>-Footnote-2974239961
Ref: ライブラリ<64>-Footnote-2984240022
Ref: ライブラリ<64>-Footnote-2994240089
Ref: ライブラリ<64>-Footnote-3004240133
Ref: ライブラリ<64>-Footnote-3014240200
Ref: ライブラリ<64>-Footnote-3024240267
Ref: ライブラリ<64>-Footnote-3034240334
Ref: ライブラリ<64>-Footnote-3044240401
Node: ドキュメント<20>4240468
Ref: whatsnew/changelog id2744240598
Ref: 1a7a4240598
Ref: ドキュメント<20>-Footnote-14242552
Ref: ドキュメント<20>-Footnote-24242608
Ref: ドキュメント<20>-Footnote-34242664
Ref: ドキュメント<20>-Footnote-44242720
Ref: ドキュメント<20>-Footnote-54242776
Ref: ドキュメント<20>-Footnote-64242832
Ref: ドキュメント<20>-Footnote-74242888
Ref: ドキュメント<20>-Footnote-84242944
Ref: ドキュメント<20>-Footnote-94243000
Ref: ドキュメント<20>-Footnote-104243055
Ref: ドキュメント<20>-Footnote-114243111
Ref: ドキュメント<20>-Footnote-124243168
Ref: ドキュメント<20>-Footnote-134243224
Ref: ドキュメント<20>-Footnote-144243281
Node: テスト<19>4243338
Ref: whatsnew/changelog id2754243462
Ref: 1a7b4243462
Ref: テスト<19>-Footnote-14256598
Ref: テスト<19>-Footnote-24256654
Ref: テスト<19>-Footnote-34256710
Ref: テスト<19>-Footnote-44256766
Ref: テスト<19>-Footnote-54256822
Ref: テスト<19>-Footnote-64256877
Ref: テスト<19>-Footnote-74256933
Ref: テスト<19>-Footnote-84256989
Ref: テスト<19>-Footnote-94257045
Ref: テスト<19>-Footnote-104257101
Ref: テスト<19>-Footnote-114257158
Ref: テスト<19>-Footnote-124257215
Ref: テスト<19>-Footnote-134257272
Ref: テスト<19>-Footnote-144257329
Ref: テスト<19>-Footnote-154257386
Ref: テスト<19>-Footnote-164257443
Ref: テスト<19>-Footnote-174257500
Ref: テスト<19>-Footnote-184257557
Ref: テスト<19>-Footnote-194257614
Ref: テスト<19>-Footnote-204257671
Ref: テスト<19>-Footnote-214257728
Ref: テスト<19>-Footnote-224257785
Ref: テスト<19>-Footnote-234257842
Ref: テスト<19>-Footnote-244257899
Ref: テスト<19>-Footnote-254257956
Ref: テスト<19>-Footnote-264258013
Ref: テスト<19>-Footnote-274258070
Ref: テスト<19>-Footnote-284258127
Ref: テスト<19>-Footnote-294258184
Ref: テスト<19>-Footnote-304258241
Ref: テスト<19>-Footnote-314258298
Ref: テスト<19>-Footnote-324258355
Ref: テスト<19>-Footnote-334258412
Ref: テスト<19>-Footnote-344258456
Ref: テスト<19>-Footnote-354258512
Ref: テスト<19>-Footnote-364258569
Ref: テスト<19>-Footnote-374258625
Ref: テスト<19>-Footnote-384258681
Ref: テスト<19>-Footnote-394258738
Ref: テスト<19>-Footnote-404258795
Ref: テスト<19>-Footnote-414258852
Ref: テスト<19>-Footnote-424258909
Ref: テスト<19>-Footnote-434258966
Ref: テスト<19>-Footnote-444259023
Ref: テスト<19>-Footnote-454259080
Ref: テスト<19>-Footnote-464259137
Ref: テスト<19>-Footnote-474259194
Ref: テスト<19>-Footnote-484259251
Ref: テスト<19>-Footnote-494259308
Ref: テスト<19>-Footnote-504259365
Ref: テスト<19>-Footnote-514259422
Ref: テスト<19>-Footnote-524259479
Ref: テスト<19>-Footnote-534259536
Ref: テスト<19>-Footnote-544259593
Ref: テスト<19>-Footnote-554259650
Ref: テスト<19>-Footnote-564259707
Ref: テスト<19>-Footnote-574259764
Ref: テスト<19>-Footnote-584259820
Ref: テスト<19>-Footnote-594259877
Node: ビルド<22>4259933
Ref: whatsnew/changelog id2764260046
Ref: 1a7d4260046
Ref: ビルド<22>-Footnote-14264037
Ref: ビルド<22>-Footnote-24264093
Ref: ビルド<22>-Footnote-34264149
Ref: ビルド<22>-Footnote-44264205
Ref: ビルド<22>-Footnote-54264261
Ref: ビルド<22>-Footnote-64264317
Ref: ビルド<22>-Footnote-74264373
Ref: ビルド<22>-Footnote-84264428
Ref: ビルド<22>-Footnote-94264484
Ref: ビルド<22>-Footnote-104264540
Ref: ビルド<22>-Footnote-114264596
Ref: ビルド<22>-Footnote-124264653
Ref: ビルド<22>-Footnote-134264710
Ref: ビルド<22>-Footnote-144264767
Ref: ビルド<22>-Footnote-154264824
Ref: ビルド<22>-Footnote-164264880
Ref: ビルド<22>-Footnote-174264937
Ref: ビルド<22>-Footnote-184264994
Ref: ビルド<22>-Footnote-194265051
Ref: ビルド<22>-Footnote-204265108
Ref: ビルド<22>-Footnote-214265164
Ref: ビルド<22>-Footnote-224265221
Ref: ビルド<22>-Footnote-234265277
Ref: ビルド<22>-Footnote-244265334
Node: Windows<21>4265391
Ref: whatsnew/changelog id2774265500
Ref: 1a7f4265500
Ref: Windows<21>-Footnote-14268005
Ref: Windows<21>-Footnote-24268061
Ref: Windows<21>-Footnote-34268117
Ref: Windows<21>-Footnote-44268172
Ref: Windows<21>-Footnote-54268228
Ref: Windows<21>-Footnote-64268284
Ref: Windows<21>-Footnote-74268339
Ref: Windows<21>-Footnote-84268395
Ref: Windows<21>-Footnote-94268451
Ref: Windows<21>-Footnote-104268507
Ref: Windows<21>-Footnote-114268564
Ref: Windows<21>-Footnote-124268620
Ref: Windows<21>-Footnote-134268677
Node: macOS<14>4268734
Ref: whatsnew/changelog id2784268838
Ref: 1a804268838
Ref: macOS<14>-Footnote-14269102
Ref: macOS<14>-Footnote-24269158
Ref: macOS<14>-Footnote-34269214
Node: IDLE<13>4269269
Ref: whatsnew/changelog id2794269377
Ref: 1a814269377
Ref: IDLE<13>-Footnote-14269566
Node: Tools/Demos<19>4269622
Ref: whatsnew/changelog id2804269730
Ref: 1a824269730
Ref: Tools/Demos<19>-Footnote-14272244
Ref: Tools/Demos<19>-Footnote-24272300
Ref: Tools/Demos<19>-Footnote-34272356
Ref: Tools/Demos<19>-Footnote-44272418
Ref: Tools/Demos<19>-Footnote-54272507
Ref: Tools/Demos<19>-Footnote-64272563
Ref: Tools/Demos<19>-Footnote-74272657
Ref: Tools/Demos<19>-Footnote-84272713
Ref: Tools/Demos<19>-Footnote-94272769
Ref: Tools/Demos<19>-Footnote-104272824
Ref: Tools/Demos<19>-Footnote-114272920
Ref: Tools/Demos<19>-Footnote-124272977
Ref: Tools/Demos<19>-Footnote-134273034
Ref: Tools/Demos<19>-Footnote-144273091
Ref: Tools/Demos<19>-Footnote-154273148
Ref: Tools/Demos<19>-Footnote-164273205
Ref: Tools/Demos<19>-Footnote-174273262
Ref: Tools/Demos<19>-Footnote-184273318
Node: C API<22>4273416
Ref: whatsnew/changelog id2814273507
Ref: 1a834273507
Ref: C API<22>-Footnote-14288420
Ref: C API<22>-Footnote-24288475
Ref: C API<22>-Footnote-34288531
Ref: C API<22>-Footnote-44288587
Ref: C API<22>-Footnote-54288643
Ref: C API<22>-Footnote-64288699
Ref: C API<22>-Footnote-74288755
Ref: C API<22>-Footnote-84288810
Ref: C API<22>-Footnote-94288866
Ref: C API<22>-Footnote-104288922
Ref: C API<22>-Footnote-114288979
Ref: C API<22>-Footnote-124289036
Ref: C API<22>-Footnote-134289093
Ref: C API<22>-Footnote-144289150
Ref: C API<22>-Footnote-154289207
Ref: C API<22>-Footnote-164289264
Ref: C API<22>-Footnote-174289321
Ref: C API<22>-Footnote-184289378
Ref: C API<22>-Footnote-194289435
Ref: C API<22>-Footnote-204289492
Ref: C API<22>-Footnote-214289549
Ref: C API<22>-Footnote-224289606
Ref: C API<22>-Footnote-234289663
Ref: C API<22>-Footnote-244289720
Ref: C API<22>-Footnote-254289777
Ref: C API<22>-Footnote-264289834
Ref: C API<22>-Footnote-274289891
Ref: C API<22>-Footnote-284289948
Ref: C API<22>-Footnote-294290005
Ref: C API<22>-Footnote-304290062
Ref: C API<22>-Footnote-314290119
Ref: C API<22>-Footnote-324290176
Ref: C API<22>-Footnote-334290219
Ref: C API<22>-Footnote-344290276
Ref: C API<22>-Footnote-354290333
Ref: C API<22>-Footnote-364290390
Ref: C API<22>-Footnote-374290447
Ref: C API<22>-Footnote-384290504
Ref: C API<22>-Footnote-394290561
Ref: C API<22>-Footnote-404290618
Ref: C API<22>-Footnote-414290675
Ref: C API<22>-Footnote-424290732
Ref: C API<22>-Footnote-434290789
Ref: C API<22>-Footnote-444290846
Ref: C API<22>-Footnote-454290903
Ref: C API<22>-Footnote-464290960
Ref: C API<22>-Footnote-474291017
Ref: C API<22>-Footnote-484291074
Ref: C API<22>-Footnote-494291131
Ref: C API<22>-Footnote-504291187
Ref: C API<22>-Footnote-514291244
Ref: C API<22>-Footnote-524291301
Ref: C API<22>-Footnote-534291358
Ref: C API<22>-Footnote-544291415
Ref: C API<22>-Footnote-554291472
Ref: C API<22>-Footnote-564291529
Ref: C API<22>-Footnote-574291586
Ref: C API<22>-Footnote-584291643
Ref: C API<22>-Footnote-594291709
Node: Python 3 12 0 beta 14291775
Ref: whatsnew/changelog python-3-12-0-beta-14291904
Ref: 1a8e4291904
Node: セキュリティ<22>4292471
Ref: whatsnew/changelog id2824292578
Ref: 1a8f4292578
Ref: セキュリティ<22>-Footnote-14293411
Ref: セキュリティ<22>-Footnote-24293466
Ref: セキュリティ<22>-Footnote-34293522
Ref: セキュリティ<22>-Footnote-44293577
Ref: セキュリティ<22>-Footnote-54293633
Node: ライブラリ<65>4293689
Ref: whatsnew/changelog id2834293826
Ref: 1a904293826
Ref: ライブラリ<65>-Footnote-14294054
Node: Core and Builtins<60>4294110
Ref: whatsnew/changelog id2844294244
Ref: 1a914294244
Ref: Core and Builtins<60>-Footnote-14300650
Ref: Core and Builtins<60>-Footnote-24300706
Ref: Core and Builtins<60>-Footnote-34300762
Ref: Core and Builtins<60>-Footnote-44300804
Ref: Core and Builtins<60>-Footnote-54300860
Ref: Core and Builtins<60>-Footnote-64300916
Ref: Core and Builtins<60>-Footnote-74300972
Ref: Core and Builtins<60>-Footnote-84301014
Ref: Core and Builtins<60>-Footnote-94301070
Ref: Core and Builtins<60>-Footnote-104301126
Ref: Core and Builtins<60>-Footnote-114301182
Ref: Core and Builtins<60>-Footnote-124301238
Ref: Core and Builtins<60>-Footnote-134301295
Ref: Core and Builtins<60>-Footnote-144301352
Ref: Core and Builtins<60>-Footnote-154301395
Ref: Core and Builtins<60>-Footnote-164301452
Ref: Core and Builtins<60>-Footnote-174301509
Ref: Core and Builtins<60>-Footnote-184301566
Ref: Core and Builtins<60>-Footnote-194301623
Ref: Core and Builtins<60>-Footnote-204301680
Ref: Core and Builtins<60>-Footnote-214301737
Ref: Core and Builtins<60>-Footnote-224301794
Ref: Core and Builtins<60>-Footnote-234301851
Ref: Core and Builtins<60>-Footnote-244301908
Ref: Core and Builtins<60>-Footnote-254301965
Node: ライブラリ<66>4302008
Ref: whatsnew/changelog id2854302144
Ref: 1a924302144
Ref: ライブラリ<66>-Footnote-14302578
Ref: ライブラリ<66>-Footnote-24302634
Node: Core and Builtins<61>4302690
Ref: whatsnew/changelog id2864302824
Ref: 1a934302824
Ref: Core and Builtins<61>-Footnote-14306862
Ref: Core and Builtins<61>-Footnote-24306918
Ref: Core and Builtins<61>-Footnote-34306974
Ref: Core and Builtins<61>-Footnote-44307030
Ref: Core and Builtins<61>-Footnote-54307086
Ref: Core and Builtins<61>-Footnote-64307142
Ref: Core and Builtins<61>-Footnote-74307198
Ref: Core and Builtins<61>-Footnote-84307254
Ref: Core and Builtins<61>-Footnote-94307309
Ref: Core and Builtins<61>-Footnote-104307365
Ref: Core and Builtins<61>-Footnote-114307421
Ref: Core and Builtins<61>-Footnote-124307477
Ref: Core and Builtins<61>-Footnote-134307520
Ref: Core and Builtins<61>-Footnote-144307577
Ref: Core and Builtins<61>-Footnote-154307634
Ref: Core and Builtins<61>-Footnote-164307691
Ref: Core and Builtins<61>-Footnote-174307747
Ref: Core and Builtins<61>-Footnote-184307804
Ref: Core and Builtins<61>-Footnote-194307861
Ref: Core and Builtins<61>-Footnote-204307904
Ref: Core and Builtins<61>-Footnote-214307960
Ref: Core and Builtins<61>-Footnote-224308017
Ref: Core and Builtins<61>-Footnote-234308060
Ref: Core and Builtins<61>-Footnote-244308116
Ref: Core and Builtins<61>-Footnote-254308159
Ref: Core and Builtins<61>-Footnote-264308215
Ref: Core and Builtins<61>-Footnote-274308271
Node: ライブラリ<67>4308337
Ref: whatsnew/changelog id2874308474
Ref: 1a944308474
Ref: ライブラリ<67>-Footnote-14332076
Ref: ライブラリ<67>-Footnote-24332141
Ref: ライブラリ<67>-Footnote-34332197
Ref: ライブラリ<67>-Footnote-44332239
Ref: ライブラリ<67>-Footnote-54332295
Ref: ライブラリ<67>-Footnote-64332351
Ref: ライブラリ<67>-Footnote-74332407
Ref: ライブラリ<67>-Footnote-84332463
Ref: ライブラリ<67>-Footnote-94332518
Ref: ライブラリ<67>-Footnote-104332574
Ref: ライブラリ<67>-Footnote-114332631
Ref: ライブラリ<67>-Footnote-124332688
Ref: ライブラリ<67>-Footnote-134332745
Ref: ライブラリ<67>-Footnote-144332802
Ref: ライブラリ<67>-Footnote-154332859
Ref: ライブラリ<67>-Footnote-164332916
Ref: ライブラリ<67>-Footnote-174332973
Ref: ライブラリ<67>-Footnote-184333049
Ref: ライブラリ<67>-Footnote-194333106
Ref: ライブラリ<67>-Footnote-204333163
Ref: ライブラリ<67>-Footnote-214333219
Ref: ライブラリ<67>-Footnote-224333276
Ref: ライブラリ<67>-Footnote-234333342
Ref: ライブラリ<67>-Footnote-244333399
Ref: ライブラリ<67>-Footnote-254333455
Ref: ライブラリ<67>-Footnote-264333511
Ref: ライブラリ<67>-Footnote-274333568
Ref: ライブラリ<67>-Footnote-284333625
Ref: ライブラリ<67>-Footnote-294333682
Ref: ライブラリ<67>-Footnote-304333739
Ref: ライブラリ<67>-Footnote-314333796
Ref: ライブラリ<67>-Footnote-324333853
Ref: ライブラリ<67>-Footnote-334333910
Ref: ライブラリ<67>-Footnote-344333953
Ref: ライブラリ<67>-Footnote-354334010
Ref: ライブラリ<67>-Footnote-364334067
Ref: ライブラリ<67>-Footnote-374334124
Ref: ライブラリ<67>-Footnote-384334181
Ref: ライブラリ<67>-Footnote-394334237
Ref: ライブラリ<67>-Footnote-404334294
Ref: ライブラリ<67>-Footnote-414334350
Ref: ライブラリ<67>-Footnote-424334407
Ref: ライブラリ<67>-Footnote-434334464
Ref: ライブラリ<67>-Footnote-444334521
Ref: ライブラリ<67>-Footnote-454334578
Ref: ライブラリ<67>-Footnote-464334635
Ref: ライブラリ<67>-Footnote-474334692
Ref: ライブラリ<67>-Footnote-484334748
Ref: ライブラリ<67>-Footnote-494334804
Ref: ライブラリ<67>-Footnote-504334861
Ref: ライブラリ<67>-Footnote-514334918
Ref: ライブラリ<67>-Footnote-524334975
Ref: ライブラリ<67>-Footnote-534335032
Ref: ライブラリ<67>-Footnote-544335088
Ref: ライブラリ<67>-Footnote-554335145
Ref: ライブラリ<67>-Footnote-564335201
Ref: ライブラリ<67>-Footnote-574335258
Ref: ライブラリ<67>-Footnote-584335315
Ref: ライブラリ<67>-Footnote-594335371
Ref: ライブラリ<67>-Footnote-604335427
Ref: ライブラリ<67>-Footnote-614335484
Ref: ライブラリ<67>-Footnote-624335541
Ref: ライブラリ<67>-Footnote-634335597
Ref: ライブラリ<67>-Footnote-644335654
Ref: ライブラリ<67>-Footnote-654335711
Ref: ライブラリ<67>-Footnote-664335768
Ref: ライブラリ<67>-Footnote-674335825
Ref: ライブラリ<67>-Footnote-684335882
Ref: ライブラリ<67>-Footnote-694335939
Ref: ライブラリ<67>-Footnote-704335996
Ref: ライブラリ<67>-Footnote-714336053
Ref: ライブラリ<67>-Footnote-724336110
Ref: ライブラリ<67>-Footnote-734336167
Ref: ライブラリ<67>-Footnote-744336224
Ref: ライブラリ<67>-Footnote-754336281
Ref: ライブラリ<67>-Footnote-764336338
Ref: ライブラリ<67>-Footnote-774336395
Ref: ライブラリ<67>-Footnote-784336452
Ref: ライブラリ<67>-Footnote-794336495
Ref: ライブラリ<67>-Footnote-804336552
Ref: ライブラリ<67>-Footnote-814336609
Ref: ライブラリ<67>-Footnote-824336652
Ref: ライブラリ<67>-Footnote-834336708
Ref: ライブラリ<67>-Footnote-844336764
Ref: ライブラリ<67>-Footnote-854336821
Ref: ライブラリ<67>-Footnote-864336878
Ref: ライブラリ<67>-Footnote-874336935
Ref: ライブラリ<67>-Footnote-884336992
Ref: ライブラリ<67>-Footnote-894337049
Ref: ライブラリ<67>-Footnote-904337092
Ref: ライブラリ<67>-Footnote-914337149
Ref: ライブラリ<67>-Footnote-924337192
Ref: ライブラリ<67>-Footnote-934337248
Ref: ライブラリ<67>-Footnote-944337305
Ref: ライブラリ<67>-Footnote-954337362
Ref: ライブラリ<67>-Footnote-964337405
Ref: ライブラリ<67>-Footnote-974337462
Ref: ライブラリ<67>-Footnote-984337519
Ref: ライブラリ<67>-Footnote-994337576
Ref: ライブラリ<67>-Footnote-1004337632
Ref: ライブラリ<67>-Footnote-1014337690
Ref: ライブラリ<67>-Footnote-1024337748
Ref: ライブラリ<67>-Footnote-1034337806
Ref: ライブラリ<67>-Footnote-1044337864
Ref: ライブラリ<67>-Footnote-1054337922
Ref: ライブラリ<67>-Footnote-1064337980
Ref: ライブラリ<67>-Footnote-1074338037
Ref: ライブラリ<67>-Footnote-1084338094
Ref: ライブラリ<67>-Footnote-1094338152
Ref: ライブラリ<67>-Footnote-1104338196
Ref: ライブラリ<67>-Footnote-1114338253
Ref: ライブラリ<67>-Footnote-1124338311
Ref: ライブラリ<67>-Footnote-1134338369
Ref: ライブラリ<67>-Footnote-1144338426
Ref: ライブラリ<67>-Footnote-1154338483
Ref: ライブラリ<67>-Footnote-1164338540
Ref: ライブラリ<67>-Footnote-1174338598
Ref: ライブラリ<67>-Footnote-1184338656
Ref: ライブラリ<67>-Footnote-1194338713
Ref: ライブラリ<67>-Footnote-1204338770
Ref: ライブラリ<67>-Footnote-1214338827
Ref: ライブラリ<67>-Footnote-1224338884
Ref: ライブラリ<67>-Footnote-1234338941
Ref: ライブラリ<67>-Footnote-1244338998
Ref: ライブラリ<67>-Footnote-1254339055
Ref: ライブラリ<67>-Footnote-1264339112
Ref: ライブラリ<67>-Footnote-1274339169
Ref: ライブラリ<67>-Footnote-1284339226
Ref: ライブラリ<67>-Footnote-1294339283
Ref: ライブラリ<67>-Footnote-1304339340
Ref: ライブラリ<67>-Footnote-1314339397
Ref: ライブラリ<67>-Footnote-1324339454
Ref: ライブラリ<67>-Footnote-1334339511
Ref: ライブラリ<67>-Footnote-1344339578
Ref: ライブラリ<67>-Footnote-1354339645
Ref: ライブラリ<67>-Footnote-1364339712
Ref: ライブラリ<67>-Footnote-1374339779
Ref: ライブラリ<67>-Footnote-1384339846
Ref: ライブラリ<67>-Footnote-1394339913
Ref: ライブラリ<67>-Footnote-1404339980
Node: ドキュメント<21>4340047
Ref: whatsnew/changelog id2884340176
Ref: 1aa04340176
Ref: ドキュメント<21>-Footnote-14340953
Ref: ドキュメント<21>-Footnote-24341008
Ref: ドキュメント<21>-Footnote-34341064
Ref: ドキュメント<21>-Footnote-44341106
Ref: ドキュメント<21>-Footnote-54341161
Ref: ドキュメント<21>-Footnote-64341216
Node: テスト<20>4341271
Ref: whatsnew/changelog id2894341394
Ref: 1aa14341394
Ref: テスト<20>-Footnote-14342306
Ref: テスト<20>-Footnote-24342362
Ref: テスト<20>-Footnote-34342418
Ref: テスト<20>-Footnote-44342473
Ref: テスト<20>-Footnote-54342529
Ref: テスト<20>-Footnote-64342585
Node: ビルド<23>4342640
Ref: whatsnew/changelog id2904342752
Ref: 1aa24342752
Ref: ビルド<23>-Footnote-14344341
Ref: ビルド<23>-Footnote-24344397
Ref: ビルド<23>-Footnote-34344452
Ref: ビルド<23>-Footnote-44344508
Ref: ビルド<23>-Footnote-54344564
Ref: ビルド<23>-Footnote-64344620
Ref: ビルド<23>-Footnote-74344675
Ref: ビルド<23>-Footnote-84344730
Ref: ビルド<23>-Footnote-94344786
Node: Windows<22>4344841
Ref: whatsnew/changelog id2914344949
Ref: 1aa34344949
Ref: Windows<22>-Footnote-14345804
Ref: Windows<22>-Footnote-24345860
Ref: Windows<22>-Footnote-34345915
Ref: Windows<22>-Footnote-44345971
Ref: Windows<22>-Footnote-54346027
Ref: Windows<22>-Footnote-64346083
Node: macOS<15>4346138
Ref: whatsnew/changelog id2924346241
Ref: 1aa44346241
Ref: macOS<15>-Footnote-14347045
Ref: macOS<15>-Footnote-24347100
Ref: macOS<15>-Footnote-34347156
Ref: macOS<15>-Footnote-44347212
Ref: macOS<15>-Footnote-54347268
Ref: macOS<15>-Footnote-64347323
Node: IDLE<14>4347379
Ref: whatsnew/changelog id2934347486
Ref: 1aa54347486
Ref: IDLE<14>-Footnote-14347770
Ref: IDLE<14>-Footnote-24347826
Ref: IDLE<14>-Footnote-34347882
Node: Tools/Demos<20>4347937
Ref: whatsnew/changelog id2944348044
Ref: 1aa64348044
Ref: Tools/Demos<20>-Footnote-14348304
Node: C API<23>4348360
Ref: whatsnew/changelog id2954348450
Ref: 1aa74348450
Ref: C API<23>-Footnote-14351428
Ref: C API<23>-Footnote-24351484
Ref: C API<23>-Footnote-34351540
Ref: C API<23>-Footnote-44351596
Ref: C API<23>-Footnote-54351652
Ref: C API<23>-Footnote-64351708
Ref: C API<23>-Footnote-74351764
Ref: C API<23>-Footnote-84351806
Ref: C API<23>-Footnote-94351862
Ref: C API<23>-Footnote-104351918
Ref: C API<23>-Footnote-114351974
Node: Python 3 12 0 alpha 74352030
Ref: whatsnew/changelog python-3-12-0-alpha-74352159
Ref: 1aae4352159
Node: Core and Builtins<62>4352676
Ref: whatsnew/changelog id2964352783
Ref: 1aaf4352783
Ref: Core and Builtins<62>-Footnote-14354111
Ref: Core and Builtins<62>-Footnote-24354167
Ref: Core and Builtins<62>-Footnote-34354222
Ref: Core and Builtins<62>-Footnote-44354278
Ref: Core and Builtins<62>-Footnote-54354334
Ref: Core and Builtins<62>-Footnote-64354390
Ref: Core and Builtins<62>-Footnote-74354446
Ref: Core and Builtins<62>-Footnote-84354502
Ref: Core and Builtins<62>-Footnote-94354558
Ref: Core and Builtins<62>-Footnote-104354614
Node: ライブラリ<68>4354670
Ref: whatsnew/changelog id2974354807
Ref: 1ab04354807
Ref: ライブラリ<68>-Footnote-14355125
Node: Core and Builtins<63>4355181
Ref: whatsnew/changelog id2984355310
Ref: 1ab14355310
Ref: Core and Builtins<63>-Footnote-14356630
Ref: Core and Builtins<63>-Footnote-24356686
Ref: Core and Builtins<63>-Footnote-34356742
Ref: Core and Builtins<63>-Footnote-44356798
Ref: Core and Builtins<63>-Footnote-54356840
Ref: Core and Builtins<63>-Footnote-64356896
Ref: Core and Builtins<63>-Footnote-74356952
Ref: Core and Builtins<63>-Footnote-84357008
Node: ビルド<24>4357064
Ref: whatsnew/changelog id2994357195
Ref: 1ab24357195
Ref: ビルド<24>-Footnote-14357380
Node: Core and Builtins<64>4357436
Ref: whatsnew/changelog id3004357565
Ref: 1ab34357565
Ref: Core and Builtins<64>-Footnote-14357765
Node: ライブラリ<69>4357821
Ref: whatsnew/changelog id3014357959
Ref: 1ab44357959
Ref: ライブラリ<69>-Footnote-14365899
Ref: ライブラリ<69>-Footnote-24365966
Ref: ライブラリ<69>-Footnote-34366008
Ref: ライブラリ<69>-Footnote-44366064
Ref: ライブラリ<69>-Footnote-54366120
Ref: ライブラリ<69>-Footnote-64366176
Ref: ライブラリ<69>-Footnote-74366232
Ref: ライブラリ<69>-Footnote-84366288
Ref: ライブラリ<69>-Footnote-94366344
Ref: ライブラリ<69>-Footnote-104366400
Ref: ライブラリ<69>-Footnote-114366457
Ref: ライブラリ<69>-Footnote-124366514
Ref: ライブラリ<69>-Footnote-134366571
Ref: ライブラリ<69>-Footnote-144366628
Ref: ライブラリ<69>-Footnote-154366685
Ref: ライブラリ<69>-Footnote-164366741
Ref: ライブラリ<69>-Footnote-174366797
Ref: ライブラリ<69>-Footnote-184366853
Ref: ライブラリ<69>-Footnote-194366910
Ref: ライブラリ<69>-Footnote-204366967
Ref: ライブラリ<69>-Footnote-214367024
Ref: ライブラリ<69>-Footnote-224367081
Ref: ライブラリ<69>-Footnote-234367138
Ref: ライブラリ<69>-Footnote-244367195
Ref: ライブラリ<69>-Footnote-254367251
Ref: ライブラリ<69>-Footnote-264367308
Ref: ライブラリ<69>-Footnote-274367364
Ref: ライブラリ<69>-Footnote-284367421
Ref: ライブラリ<69>-Footnote-294367478
Ref: ライブラリ<69>-Footnote-304367535
Ref: ライブラリ<69>-Footnote-314367591
Ref: ライブラリ<69>-Footnote-324367648
Ref: ライブラリ<69>-Footnote-334367705
Ref: ライブラリ<69>-Footnote-344367762
Ref: ライブラリ<69>-Footnote-354367818
Ref: ライブラリ<69>-Footnote-364367875
Ref: ライブラリ<69>-Footnote-374367931
Ref: ライブラリ<69>-Footnote-384367987
Ref: ライブラリ<69>-Footnote-394368043
Ref: ライブラリ<69>-Footnote-404368099
Ref: ライブラリ<69>-Footnote-414368155
Ref: ライブラリ<69>-Footnote-424368211
Ref: ライブラリ<69>-Footnote-434368267
Node: ドキュメント<22>4368333
Ref: whatsnew/changelog id3024368463
Ref: 1ab94368463
Ref: ドキュメント<22>-Footnote-14368666
Node: テスト<21>4368722
Ref: whatsnew/changelog id3034368846
Ref: 1aba4368846
Ref: テスト<21>-Footnote-14369208
Ref: テスト<21>-Footnote-24369264
Ref: テスト<21>-Footnote-34369320
Node: ビルド<25>4369376
Ref: whatsnew/changelog id3044369489
Ref: 1abb4369489
Ref: ビルド<25>-Footnote-14369740
Ref: ビルド<25>-Footnote-24369796
Node: Windows<23>4369852
Ref: whatsnew/changelog id3054369967
Ref: 1abc4369967
Ref: Windows<23>-Footnote-14370267
Ref: Windows<23>-Footnote-24370323
Node: Tools/Demos<21>4370378
Ref: whatsnew/changelog id3064370489
Ref: 1abd4370489
Ref: Tools/Demos<21>-Footnote-14370624
Node: C API<24>4370680
Ref: whatsnew/changelog id3074370771
Ref: 1abe4370771
Ref: C API<24>-Footnote-14370987
Node: Python 3 12 0 alpha 64371043
Ref: whatsnew/changelog python-3-12-0-alpha-64371173
Ref: 1abf4371173
Node: セキュリティ<23>4371568
Ref: whatsnew/changelog id3084371678
Ref: 1ac04371678
Ref: セキュリティ<23>-Footnote-14372630
Ref: セキュリティ<23>-Footnote-24372685
Ref: セキュリティ<23>-Footnote-34372741
Ref: セキュリティ<23>-Footnote-44372796
Ref: セキュリティ<23>-Footnote-54372851
Ref: セキュリティ<23>-Footnote-64372906
Ref: セキュリティ<23>-Footnote-74372967
Ref: セキュリティ<23>-Footnote-84373022
Ref: セキュリティ<23>-Footnote-94373070
Node: Core and Builtins<65>4373126
Ref: whatsnew/changelog id3094373264
Ref: 1ac14373264
Ref: Core and Builtins<65>-Footnote-14376893
Ref: Core and Builtins<65>-Footnote-24376949
Ref: Core and Builtins<65>-Footnote-34377005
Ref: Core and Builtins<65>-Footnote-44377061
Ref: Core and Builtins<65>-Footnote-54377117
Ref: Core and Builtins<65>-Footnote-64377173
Ref: Core and Builtins<65>-Footnote-74377229
Ref: Core and Builtins<65>-Footnote-84377285
Ref: Core and Builtins<65>-Footnote-94377341
Ref: Core and Builtins<65>-Footnote-104377397
Ref: Core and Builtins<65>-Footnote-114377454
Ref: Core and Builtins<65>-Footnote-124377511
Ref: Core and Builtins<65>-Footnote-134377567
Ref: Core and Builtins<65>-Footnote-144377624
Ref: Core and Builtins<65>-Footnote-154377681
Ref: Core and Builtins<65>-Footnote-164377737
Ref: Core and Builtins<65>-Footnote-174377793
Ref: Core and Builtins<65>-Footnote-184377850
Ref: Core and Builtins<65>-Footnote-194377907
Ref: Core and Builtins<65>-Footnote-204377964
Ref: Core and Builtins<65>-Footnote-214378021
Ref: Core and Builtins<65>-Footnote-224378078
Node: ライブラリ<70>4378134
Ref: whatsnew/changelog id3104378272
Ref: 1ac54378272
Ref: ライブラリ<70>-Footnote-14384110
Ref: ライブラリ<70>-Footnote-24384166
Ref: ライブラリ<70>-Footnote-34384222
Ref: ライブラリ<70>-Footnote-44384277
Ref: ライブラリ<70>-Footnote-54384332
Ref: ライブラリ<70>-Footnote-64384388
Ref: ライブラリ<70>-Footnote-74384444
Ref: ライブラリ<70>-Footnote-84384500
Ref: ライブラリ<70>-Footnote-94384556
Ref: ライブラリ<70>-Footnote-104384623
Ref: ライブラリ<70>-Footnote-114384679
Ref: ライブラリ<70>-Footnote-124384763
Ref: ライブラリ<70>-Footnote-134384820
Ref: ライブラリ<70>-Footnote-144384876
Ref: ライブラリ<70>-Footnote-154384933
Ref: ライブラリ<70>-Footnote-164384989
Ref: ライブラリ<70>-Footnote-174385045
Ref: ライブラリ<70>-Footnote-184385102
Ref: ライブラリ<70>-Footnote-194385159
Ref: ライブラリ<70>-Footnote-204385216
Ref: ライブラリ<70>-Footnote-214385273
Ref: ライブラリ<70>-Footnote-224385330
Ref: ライブラリ<70>-Footnote-234385387
Ref: ライブラリ<70>-Footnote-244385444
Ref: ライブラリ<70>-Footnote-254385500
Ref: ライブラリ<70>-Footnote-264385557
Ref: ライブラリ<70>-Footnote-274385600
Ref: ライブラリ<70>-Footnote-284385656
Ref: ライブラリ<70>-Footnote-294385713
Ref: ライブラリ<70>-Footnote-304385770
Ref: ライブラリ<70>-Footnote-314385813
Ref: ライブラリ<70>-Footnote-324385870
Ref: ライブラリ<70>-Footnote-334385926
Ref: ライブラリ<70>-Footnote-344385969
Ref: ライブラリ<70>-Footnote-354386025
Ref: ライブラリ<70>-Footnote-364386081
Node: ドキュメント<23>4386147
Ref: whatsnew/changelog id3114386277
Ref: 1acf4386277
Ref: ドキュメント<23>-Footnote-14386590
Ref: ドキュメント<23>-Footnote-24386645
Node: テスト<22>4386700
Ref: whatsnew/changelog id3124386824
Ref: 1ad14386824
Ref: テスト<22>-Footnote-14387401
Ref: テスト<22>-Footnote-24387457
Ref: テスト<22>-Footnote-34387512
Node: ビルド<26>4387567
Ref: whatsnew/changelog id3134387680
Ref: 1ad24387680
Ref: ビルド<26>-Footnote-14388364
Ref: ビルド<26>-Footnote-24388419
Ref: ビルド<26>-Footnote-34388474
Ref: ビルド<26>-Footnote-44388530
Node: Windows<24>4388585
Ref: whatsnew/changelog id3144388694
Ref: 1ad44388694
Ref: Windows<24>-Footnote-14389713
Ref: Windows<24>-Footnote-24389769
Ref: Windows<24>-Footnote-34389825
Ref: Windows<24>-Footnote-44389881
Ref: Windows<24>-Footnote-54389937
Ref: Windows<24>-Footnote-64389993
Ref: Windows<24>-Footnote-74390049
Ref: Windows<24>-Footnote-84390105
Node: macOS<16>4390161
Ref: whatsnew/changelog id3154390266
Ref: 1ad54390266
Ref: macOS<16>-Footnote-14390396
Node: C API<25>4390452
Ref: whatsnew/changelog id3164390537
Ref: 1ad64390537
Ref: C API<25>-Footnote-14391632
Ref: C API<25>-Footnote-24391688
Ref: C API<25>-Footnote-34391743
Ref: C API<25>-Footnote-44391799
Ref: C API<25>-Footnote-54391854
Node: Python 3 12 0 alpha 54391896
Ref: whatsnew/changelog python-3-12-0-alpha-54392026
Ref: 1ad74392026
Node: セキュリティ<24>4392381
Ref: whatsnew/changelog id3174392491
Ref: 1ad84392491
Ref: セキュリティ<24>-Footnote-14392883
Ref: セキュリティ<24>-Footnote-24392938
Node: Core and Builtins<66>4392986
Ref: whatsnew/changelog id3194393124
Ref: 1ad94393124
Ref: Core and Builtins<66>-Footnote-14396021
Ref: Core and Builtins<66>-Footnote-24396076
Ref: Core and Builtins<66>-Footnote-34396131
Ref: Core and Builtins<66>-Footnote-44396187
Ref: Core and Builtins<66>-Footnote-54396243
Ref: Core and Builtins<66>-Footnote-64396299
Ref: Core and Builtins<66>-Footnote-74396355
Ref: Core and Builtins<66>-Footnote-84396411
Ref: Core and Builtins<66>-Footnote-94396467
Ref: Core and Builtins<66>-Footnote-104396523
Ref: Core and Builtins<66>-Footnote-114396580
Ref: Core and Builtins<66>-Footnote-124396637
Ref: Core and Builtins<66>-Footnote-134396694
Ref: Core and Builtins<66>-Footnote-144396751
Ref: Core and Builtins<66>-Footnote-154396807
Ref: Core and Builtins<66>-Footnote-164396864
Node: ライブラリ<71>4396921
Ref: whatsnew/changelog id3204397059
Ref: 1adc4397059
Ref: ライブラリ<71>-Footnote-14402322
Ref: ライブラリ<71>-Footnote-24402387
Ref: ライブラリ<71>-Footnote-34402443
Ref: ライブラリ<71>-Footnote-44402499
Ref: ライブラリ<71>-Footnote-54402555
Ref: ライブラリ<71>-Footnote-64402611
Ref: ライブラリ<71>-Footnote-74402667
Ref: ライブラリ<71>-Footnote-84402722
Ref: ライブラリ<71>-Footnote-94402764
Ref: ライブラリ<71>-Footnote-104402820
Ref: ライブラリ<71>-Footnote-114402877
Ref: ライブラリ<71>-Footnote-124402934
Ref: ライブラリ<71>-Footnote-134402990
Ref: ライブラリ<71>-Footnote-144403047
Ref: ライブラリ<71>-Footnote-154403104
Ref: ライブラリ<71>-Footnote-164403161
Ref: ライブラリ<71>-Footnote-174403217
Ref: ライブラリ<71>-Footnote-184403274
Ref: ライブラリ<71>-Footnote-194403331
Ref: ライブラリ<71>-Footnote-204403387
Ref: ライブラリ<71>-Footnote-214403443
Ref: ライブラリ<71>-Footnote-224403499
Ref: ライブラリ<71>-Footnote-234403555
Ref: ライブラリ<71>-Footnote-244403611
Ref: ライブラリ<71>-Footnote-254403667
Ref: ライブラリ<71>-Footnote-264403723
Ref: ライブラリ<71>-Footnote-274403779
Ref: ライブラリ<71>-Footnote-284403845
Ref: ライブラリ<71>-Footnote-294403911
Ref: ライブラリ<71>-Footnote-304403977
Node: ドキュメント<24>4404033
Ref: whatsnew/changelog id3214404163
Ref: 1ae54404163
Ref: ドキュメント<24>-Footnote-14404452
Node: テスト<23>4404507
Ref: whatsnew/changelog id3224404631
Ref: 1ae64404631
Ref: テスト<23>-Footnote-14404798
Node: ビルド<27>4404854
Ref: whatsnew/changelog id3234404967
Ref: 1ae74404967
Ref: ビルド<27>-Footnote-14406411
Ref: ビルド<27>-Footnote-24406467
Ref: ビルド<27>-Footnote-34406523
Ref: ビルド<27>-Footnote-44406578
Ref: ビルド<27>-Footnote-54406634
Ref: ビルド<27>-Footnote-64406676
Ref: ビルド<27>-Footnote-74406732
Ref: ビルド<27>-Footnote-84406788
Ref: ビルド<27>-Footnote-94406843
Ref: ビルド<27>-Footnote-104406898
Node: Windows<25>4406954
Ref: whatsnew/changelog id3244407045
Ref: 1ae84407045
Ref: Windows<25>-Footnote-14408295
Ref: Windows<25>-Footnote-24408351
Ref: Windows<25>-Footnote-34408407
Ref: Windows<25>-Footnote-44408462
Ref: Windows<25>-Footnote-54408518
Ref: Windows<25>-Footnote-64408573
Ref: Windows<25>-Footnote-74408629
Node: Python 3 12 0 alpha 44408685
Ref: whatsnew/changelog python-3-12-0-alpha-44408815
Ref: 1ae94408815
Node: Core and Builtins<67>4409364
Ref: whatsnew/changelog id3254409471
Ref: 1aea4409471
Ref: Core and Builtins<67>-Footnote-14411373
Ref: Core and Builtins<67>-Footnote-24411429
Ref: Core and Builtins<67>-Footnote-34411484
Ref: Core and Builtins<67>-Footnote-44411539
Ref: Core and Builtins<67>-Footnote-54411595
Ref: Core and Builtins<67>-Footnote-64411651
Ref: Core and Builtins<67>-Footnote-74411707
Ref: Core and Builtins<67>-Footnote-84411763
Ref: Core and Builtins<67>-Footnote-94411819
Ref: Core and Builtins<67>-Footnote-104411875
Ref: Core and Builtins<67>-Footnote-114411931
Ref: Core and Builtins<67>-Footnote-124411974
Ref: Core and Builtins<67>-Footnote-134412031
Node: ライブラリ<72>4412088
Ref: whatsnew/changelog id3264412225
Ref: 1aec4412225
Ref: ライブラリ<72>-Footnote-14412425
Node: Core and Builtins<68>4412481
Ref: whatsnew/changelog id3274412616
Ref: 1aee4412616
Ref: Core and Builtins<68>-Footnote-14415349
Ref: Core and Builtins<68>-Footnote-24415405
Ref: Core and Builtins<68>-Footnote-34415461
Ref: Core and Builtins<68>-Footnote-44415516
Ref: Core and Builtins<68>-Footnote-54415572
Ref: Core and Builtins<68>-Footnote-64415627
Ref: Core and Builtins<68>-Footnote-74415683
Ref: Core and Builtins<68>-Footnote-84415738
Ref: Core and Builtins<68>-Footnote-94415793
Ref: Core and Builtins<68>-Footnote-104415848
Ref: Core and Builtins<68>-Footnote-114415905
Ref: Core and Builtins<68>-Footnote-124415962
Ref: Core and Builtins<68>-Footnote-134416019
Ref: Core and Builtins<68>-Footnote-144416076
Ref: Core and Builtins<68>-Footnote-154416132
Ref: Core and Builtins<68>-Footnote-164416188
Ref: Core and Builtins<68>-Footnote-174416244
Ref: Core and Builtins<68>-Footnote-184416300
Node: ライブラリ<73>4416356
Ref: whatsnew/changelog id3284416493
Ref: 1af04416493
Ref: ライブラリ<73>-Footnote-14416642
Node: Core and Builtins<69>4416697
Ref: whatsnew/changelog id3294416832
Ref: 1af24416832
Ref: Core and Builtins<69>-Footnote-14417107
Node: ライブラリ<74>4417172
Ref: whatsnew/changelog id3304417310
Ref: 1af34417310
Ref: ライブラリ<74>-Footnote-14427628
Ref: ライブラリ<74>-Footnote-24427684
Ref: ライブラリ<74>-Footnote-34427740
Ref: ライブラリ<74>-Footnote-44427796
Ref: ライブラリ<74>-Footnote-54427852
Ref: ライブラリ<74>-Footnote-64427907
Ref: ライブラリ<74>-Footnote-74427962
Ref: ライブラリ<74>-Footnote-84428018
Ref: ライブラリ<74>-Footnote-94428074
Ref: ライブラリ<74>-Footnote-104428129
Ref: ライブラリ<74>-Footnote-114428186
Ref: ライブラリ<74>-Footnote-124428242
Ref: ライブラリ<74>-Footnote-134428299
Ref: ライブラリ<74>-Footnote-144428355
Ref: ライブラリ<74>-Footnote-154428411
Ref: ライブラリ<74>-Footnote-164428468
Ref: ライブラリ<74>-Footnote-174428525
Ref: ライブラリ<74>-Footnote-184428582
Ref: ライブラリ<74>-Footnote-194428639
Ref: ライブラリ<74>-Footnote-204428696
Ref: ライブラリ<74>-Footnote-214428753
Ref: ライブラリ<74>-Footnote-224428810
Ref: ライブラリ<74>-Footnote-234428866
Ref: ライブラリ<74>-Footnote-244428923
Ref: ライブラリ<74>-Footnote-254428980
Ref: ライブラリ<74>-Footnote-264429037
Ref: ライブラリ<74>-Footnote-274429093
Ref: ライブラリ<74>-Footnote-284429150
Ref: ライブラリ<74>-Footnote-294429207
Ref: ライブラリ<74>-Footnote-304429264
Ref: ライブラリ<74>-Footnote-314429321
Ref: ライブラリ<74>-Footnote-324429387
Ref: ライブラリ<74>-Footnote-334429444
Ref: ライブラリ<74>-Footnote-344429500
Ref: ライブラリ<74>-Footnote-354429556
Ref: ライブラリ<74>-Footnote-364429612
Ref: ライブラリ<74>-Footnote-374429668
Ref: ライブラリ<74>-Footnote-384429724
Ref: ライブラリ<74>-Footnote-394429780
Ref: ライブラリ<74>-Footnote-404429836
Ref: ライブラリ<74>-Footnote-414429892
Ref: ライブラリ<74>-Footnote-424429948
Ref: ライブラリ<74>-Footnote-434429991
Ref: ライブラリ<74>-Footnote-444430047
Ref: ライブラリ<74>-Footnote-454430103
Ref: ライブラリ<74>-Footnote-464430159
Ref: ライブラリ<74>-Footnote-474430215
Ref: ライブラリ<74>-Footnote-484430271
Ref: ライブラリ<74>-Footnote-494430327
Ref: ライブラリ<74>-Footnote-504430383
Ref: ライブラリ<74>-Footnote-514430439
Ref: ライブラリ<74>-Footnote-524430495
Ref: ライブラリ<74>-Footnote-534430551
Ref: ライブラリ<74>-Footnote-544430607
Ref: ライブラリ<74>-Footnote-554430673
Ref: ライブラリ<74>-Footnote-564430739
Node: ドキュメント<25>4430805
Ref: whatsnew/changelog id3314430935
Ref: 1afd4430935
Ref: ドキュメント<25>-Footnote-14431522
Ref: ドキュメント<25>-Footnote-24431578
Ref: ドキュメント<25>-Footnote-34431634
Node: テスト<24>4431699
Ref: whatsnew/changelog id3324431823
Ref: 1aff4431823
Ref: テスト<24>-Footnote-14432275
Ref: テスト<24>-Footnote-24432331
Ref: テスト<24>-Footnote-34432387
Node: ビルド<28>4432442
Ref: whatsnew/changelog id3334432555
Ref: 1b004432555
Ref: ビルド<28>-Footnote-14433447
Ref: ビルド<28>-Footnote-24433503
Ref: ビルド<28>-Footnote-34433558
Node: Windows<26>4433623
Ref: whatsnew/changelog id3344433732
Ref: 1b014433732
Ref: Windows<26>-Footnote-14434659
Ref: Windows<26>-Footnote-24434715
Ref: Windows<26>-Footnote-34434770
Ref: Windows<26>-Footnote-44434825
Ref: Windows<26>-Footnote-54434880
Ref: Windows<26>-Footnote-64434945
Node: macOS<17>4435010
Ref: whatsnew/changelog id3354435121
Ref: 1b044435121
Ref: macOS<17>-Footnote-14435405
Ref: macOS<17>-Footnote-24435461
Node: Tools/Demos<22>4435517
Ref: whatsnew/changelog id3364435626
Ref: 1b054435626
Ref: Tools/Demos<22>-Footnote-14436002
Ref: Tools/Demos<22>-Footnote-24436067
Node: C API<26>4436123
Ref: whatsnew/changelog id3374436214
Ref: 1b064436214
Ref: C API<26>-Footnote-14436783
Ref: C API<26>-Footnote-24436838
Ref: C API<26>-Footnote-34436893
Node: Python 3 12 0 alpha 34436948
Ref: whatsnew/changelog python-3-12-0-alpha-34437078
Ref: 1b074437078
Node: セキュリティ<25>4437592
Ref: whatsnew/changelog id3384437702
Ref: 1b084437702
Ref: セキュリティ<25>-Footnote-14438276
Ref: セキュリティ<25>-Footnote-24438332
Node: Core and Builtins<70>4438387
Ref: whatsnew/changelog id3394438525
Ref: 1b094438525
Ref: Core and Builtins<70>-Footnote-14439845
Ref: Core and Builtins<70>-Footnote-24439900
Ref: Core and Builtins<70>-Footnote-34439955
Ref: Core and Builtins<70>-Footnote-44440010
Ref: Core and Builtins<70>-Footnote-54440065
Ref: Core and Builtins<70>-Footnote-64440120
Ref: Core and Builtins<70>-Footnote-74440175
Node: ライブラリ<75>4440230
Ref: whatsnew/changelog id3404440367
Ref: 1b0a4440367
Ref: ライブラリ<75>-Footnote-14440713
Ref: ライブラリ<75>-Footnote-24440768
Node: Core and Builtins<71>4440823
Ref: whatsnew/changelog id3414440958
Ref: 1b0b4440958
Ref: Core and Builtins<71>-Footnote-14442763
Ref: Core and Builtins<71>-Footnote-24442818
Ref: Core and Builtins<71>-Footnote-34442873
Ref: Core and Builtins<71>-Footnote-44442928
Ref: Core and Builtins<71>-Footnote-54442983
Ref: Core and Builtins<71>-Footnote-64443038
Ref: Core and Builtins<71>-Footnote-74443093
Ref: Core and Builtins<71>-Footnote-84443158
Ref: Core and Builtins<71>-Footnote-94443223
Node: ライブラリ<76>4443288
Ref: whatsnew/changelog id3424443426
Ref: 1b0c4443426
Ref: ライブラリ<76>-Footnote-14449673
Ref: ライブラリ<76>-Footnote-24449729
Ref: ライブラリ<76>-Footnote-34449784
Ref: ライブラリ<76>-Footnote-44449839
Ref: ライブラリ<76>-Footnote-54449894
Ref: ライブラリ<76>-Footnote-64449949
Ref: ライブラリ<76>-Footnote-74450004
Ref: ライブラリ<76>-Footnote-84450059
Ref: ライブラリ<76>-Footnote-94450114
Ref: ライブラリ<76>-Footnote-104450169
Ref: ライブラリ<76>-Footnote-114450225
Ref: ライブラリ<76>-Footnote-124450281
Ref: ライブラリ<76>-Footnote-134450337
Ref: ライブラリ<76>-Footnote-144450393
Ref: ライブラリ<76>-Footnote-154450449
Ref: ライブラリ<76>-Footnote-164450505
Ref: ライブラリ<76>-Footnote-174450561
Ref: ライブラリ<76>-Footnote-184450617
Ref: ライブラリ<76>-Footnote-194450673
Ref: ライブラリ<76>-Footnote-204450729
Ref: ライブラリ<76>-Footnote-214450785
Ref: ライブラリ<76>-Footnote-224450841
Ref: ライブラリ<76>-Footnote-234450897
Ref: ライブラリ<76>-Footnote-244450953
Ref: ライブラリ<76>-Footnote-254451009
Ref: ライブラリ<76>-Footnote-264451065
Ref: ライブラリ<76>-Footnote-274451121
Ref: ライブラリ<76>-Footnote-284451177
Ref: ライブラリ<76>-Footnote-294451233
Ref: ライブラリ<76>-Footnote-304451289
Ref: ライブラリ<76>-Footnote-314451345
Ref: ライブラリ<76>-Footnote-324451411
Ref: ライブラリ<76>-Footnote-334451477
Ref: ライブラリ<76>-Footnote-344451543
Node: ドキュメント<26>4451609
Ref: whatsnew/changelog id3434451739
Ref: 1b104451739
Ref: ドキュメント<26>-Footnote-14452512
Ref: ドキュメント<26>-Footnote-24452567
Ref: ドキュメント<26>-Footnote-34452619
Ref: ドキュメント<26>-Footnote-44452643
Ref: ドキュメント<26>-Footnote-54452698
Ref: ドキュメント<26>-Footnote-64452753
Ref: ドキュメント<26>-Footnote-74452808
Node: テスト<25>4452873
Ref: whatsnew/changelog id3444452997
Ref: 1b114452997
Ref: テスト<25>-Footnote-14453777
Ref: テスト<25>-Footnote-24453832
Ref: テスト<25>-Footnote-34453887
Ref: テスト<25>-Footnote-44453942
Ref: テスト<25>-Footnote-54453997
Ref: テスト<25>-Footnote-64454052
Node: ビルド<29>4454107
Ref: whatsnew/changelog id3454454220
Ref: 1b124454220
Ref: ビルド<29>-Footnote-14455189
Ref: ビルド<29>-Footnote-24455244
Ref: ビルド<29>-Footnote-34455299
Ref: ビルド<29>-Footnote-44455354
Ref: ビルド<29>-Footnote-54455409
Node: Windows<27>4455464
Ref: whatsnew/changelog id3464455573
Ref: 1b134455573
Ref: Windows<27>-Footnote-14456102
Ref: Windows<27>-Footnote-24456157
Ref: Windows<27>-Footnote-34456212
Ref: Windows<27>-Footnote-44456267
Node: macOS<18>4456332
Ref: whatsnew/changelog id3474456443
Ref: 1b144456443
Ref: macOS<18>-Footnote-14456713
Ref: macOS<18>-Footnote-24456768
Node: Tools/Demos<23>4456823
Ref: whatsnew/changelog id3484456932
Ref: 1b154456932
Ref: Tools/Demos<23>-Footnote-14457424
Node: C API<27>4457479
Ref: whatsnew/changelog id3494457570
Ref: 1b164457570
Ref: C API<27>-Footnote-14458391
Ref: C API<27>-Footnote-24458446
Ref: C API<27>-Footnote-34458501
Node: Python 3 12 0 alpha 24458556
Ref: whatsnew/changelog python-3-12-0-alpha-24458686
Ref: 1b184458686
Node: セキュリティ<26>4459153
Ref: whatsnew/changelog id3504459263
Ref: 1b194459263
Ref: セキュリティ<26>-Footnote-14460406
Ref: セキュリティ<26>-Footnote-24460461
Ref: セキュリティ<26>-Footnote-34460520
Ref: セキュリティ<26>-Footnote-44460579
Ref: セキュリティ<26>-Footnote-54460638
Node: Core and Builtins<72>4460693
Ref: whatsnew/changelog id3514460825
Ref: 1b1a4460825
Ref: Core and Builtins<72>-Footnote-14467561
Ref: Core and Builtins<72>-Footnote-24467616
Ref: Core and Builtins<72>-Footnote-34467671
Ref: Core and Builtins<72>-Footnote-44467726
Ref: Core and Builtins<72>-Footnote-54467781
Ref: Core and Builtins<72>-Footnote-64467836
Ref: Core and Builtins<72>-Footnote-74467891
Ref: Core and Builtins<72>-Footnote-84467946
Ref: Core and Builtins<72>-Footnote-94468001
Ref: Core and Builtins<72>-Footnote-104468056
Ref: Core and Builtins<72>-Footnote-114468112
Ref: Core and Builtins<72>-Footnote-124468168
Ref: Core and Builtins<72>-Footnote-134468224
Ref: Core and Builtins<72>-Footnote-144468280
Ref: Core and Builtins<72>-Footnote-154468336
Ref: Core and Builtins<72>-Footnote-164468392
Ref: Core and Builtins<72>-Footnote-174468448
Ref: Core and Builtins<72>-Footnote-184468504
Ref: Core and Builtins<72>-Footnote-194468560
Ref: Core and Builtins<72>-Footnote-204468616
Ref: Core and Builtins<72>-Footnote-214468672
Ref: Core and Builtins<72>-Footnote-224468728
Ref: Core and Builtins<72>-Footnote-234468784
Ref: Core and Builtins<72>-Footnote-244468840
Ref: Core and Builtins<72>-Footnote-254468883
Ref: Core and Builtins<72>-Footnote-264468939
Ref: Core and Builtins<72>-Footnote-274468995
Node: ビルド<30>4469051
Ref: whatsnew/changelog id3524469182
Ref: 1b214469182
Ref: ビルド<30>-Footnote-14469372
Node: Core and Builtins<73>4469427
Ref: whatsnew/changelog id3534469556
Ref: 1b224469556
Ref: Core and Builtins<73>-Footnote-14470693
Ref: Core and Builtins<73>-Footnote-24470748
Ref: Core and Builtins<73>-Footnote-34470803
Ref: Core and Builtins<73>-Footnote-44470858
Ref: Core and Builtins<73>-Footnote-54470913
Ref: Core and Builtins<73>-Footnote-64470968
Node: ライブラリ<77>4471023
Ref: whatsnew/changelog id3544471161
Ref: 1b254471161
Ref: ライブラリ<77>-Footnote-14477075
Ref: ライブラリ<77>-Footnote-24477130
Ref: ライブラリ<77>-Footnote-34477185
Ref: ライブラリ<77>-Footnote-44477240
Ref: ライブラリ<77>-Footnote-54477295
Ref: ライブラリ<77>-Footnote-64477350
Ref: ライブラリ<77>-Footnote-74477405
Ref: ライブラリ<77>-Footnote-84477460
Ref: ライブラリ<77>-Footnote-94477515
Ref: ライブラリ<77>-Footnote-104477570
Ref: ライブラリ<77>-Footnote-114477626
Ref: ライブラリ<77>-Footnote-124477682
Ref: ライブラリ<77>-Footnote-134477738
Ref: ライブラリ<77>-Footnote-144477781
Ref: ライブラリ<77>-Footnote-154477837
Ref: ライブラリ<77>-Footnote-164477893
Ref: ライブラリ<77>-Footnote-174477949
Ref: ライブラリ<77>-Footnote-184478005
Ref: ライブラリ<77>-Footnote-194478061
Ref: ライブラリ<77>-Footnote-204478117
Ref: ライブラリ<77>-Footnote-214478173
Ref: ライブラリ<77>-Footnote-224478229
Ref: ライブラリ<77>-Footnote-234478285
Ref: ライブラリ<77>-Footnote-244478341
Ref: ライブラリ<77>-Footnote-254478397
Ref: ライブラリ<77>-Footnote-264478453
Ref: ライブラリ<77>-Footnote-274478509
Ref: ライブラリ<77>-Footnote-284478565
Ref: ライブラリ<77>-Footnote-294478621
Ref: ライブラリ<77>-Footnote-304478677
Ref: ライブラリ<77>-Footnote-314478733
Ref: ライブラリ<77>-Footnote-324478789
Ref: ライブラリ<77>-Footnote-334478832
Ref: ライブラリ<77>-Footnote-344478888
Ref: ライブラリ<77>-Footnote-354478944
Ref: ライブラリ<77>-Footnote-364479000
Ref: ライブラリ<77>-Footnote-374479056
Ref: ライブラリ<77>-Footnote-384479099
Ref: ライブラリ<77>-Footnote-394479155
Ref: ライブラリ<77>-Footnote-404479211
Ref: ライブラリ<77>-Footnote-414479277
Ref: ライブラリ<77>-Footnote-424479343
Node: ドキュメント<27>4479409
Ref: whatsnew/changelog id3554479539
Ref: 1b2a4479539
Ref: ドキュメント<27>-Footnote-14479861
Ref: ドキュメント<27>-Footnote-24479916
Node: テスト<26>4479971
Ref: whatsnew/changelog id3564480095
Ref: 1b2b4480095
Ref: テスト<26>-Footnote-14480988
Ref: テスト<26>-Footnote-24481043
Ref: テスト<26>-Footnote-34481098
Ref: テスト<26>-Footnote-44481153
Ref: テスト<26>-Footnote-54481208
Node: ビルド<31>4481273
Ref: whatsnew/changelog id3574481386
Ref: 1b2c4481386
Ref: ビルド<31>-Footnote-14483076
Ref: ビルド<31>-Footnote-24483131
Ref: ビルド<31>-Footnote-34483186
Ref: ビルド<31>-Footnote-44483241
Ref: ビルド<31>-Footnote-54483296
Ref: ビルド<31>-Footnote-64483351
Ref: ビルド<31>-Footnote-74483406
Ref: ビルド<31>-Footnote-84483496
Ref: ビルド<31>-Footnote-94483551
Ref: ビルド<31>-Footnote-104483606
Node: Windows<28>4483662
Ref: whatsnew/changelog id3584483771
Ref: 1b2e4483771
Ref: Windows<28>-Footnote-14484464
Ref: Windows<28>-Footnote-24484519
Ref: Windows<28>-Footnote-34484575
Ref: Windows<28>-Footnote-44484630
Ref: Windows<28>-Footnote-54484685
Ref: Windows<28>-Footnote-64484740
Node: macOS<19>4484795
Ref: whatsnew/changelog id3594484900
Ref: 1b2f4484900
Ref: macOS<19>-Footnote-14485031
Node: C API<28>4485086
Ref: whatsnew/changelog id3604485171
Ref: 1b304485171
Ref: C API<28>-Footnote-14487236
Ref: C API<28>-Footnote-24487291
Ref: C API<28>-Footnote-34487346
Ref: C API<28>-Footnote-44487401
Ref: C API<28>-Footnote-54487456
Ref: C API<28>-Footnote-64487511
Ref: C API<28>-Footnote-74487566
Node: Python 3 12 0 alpha 14487621
Ref: whatsnew/changelog python-3-12-0-alpha-14487750
Ref: 1b324487750
Node: セキュリティ<27>4488951
Ref: whatsnew/changelog id3614489061
Ref: 1b334489061
Ref: セキュリティ<27>-Footnote-14490908
Ref: セキュリティ<27>-Footnote-24490963
Ref: セキュリティ<27>-Footnote-34491018
Ref: セキュリティ<27>-Footnote-44491090
Ref: セキュリティ<27>-Footnote-54491146
Ref: セキュリティ<27>-Footnote-64491201
Ref: セキュリティ<27>-Footnote-74491256
Ref: セキュリティ<27>-Footnote-84491311
Node: Core and Builtins<74>4491366
Ref: whatsnew/changelog id3624491504
Ref: 1b344491504
Ref: Core and Builtins<74>-Footnote-14492780
Ref: Core and Builtins<74>-Footnote-24492835
Ref: Core and Builtins<74>-Footnote-34492890
Ref: Core and Builtins<74>-Footnote-44492945
Ref: Core and Builtins<74>-Footnote-54493000
Ref: Core and Builtins<74>-Footnote-64493055
Ref: Core and Builtins<74>-Footnote-74493110
Ref: Core and Builtins<74>-Footnote-84493165
Node: ライブラリ<78>4493220
Ref: whatsnew/changelog id3634493357
Ref: 1b354493357
Ref: ライブラリ<78>-Footnote-14493635
Ref: ライブラリ<78>-Footnote-24493690
Node: Core and Builtins<75>4493745
Ref: whatsnew/changelog id3644493880
Ref: 1b364493880
Ref: Core and Builtins<75>-Footnote-14497319
Ref: Core and Builtins<75>-Footnote-24497374
Ref: Core and Builtins<75>-Footnote-34497429
Ref: Core and Builtins<75>-Footnote-44497484
Ref: Core and Builtins<75>-Footnote-54497539
Ref: Core and Builtins<75>-Footnote-64497594
Ref: Core and Builtins<75>-Footnote-74497649
Ref: Core and Builtins<75>-Footnote-84497704
Ref: Core and Builtins<75>-Footnote-94497759
Ref: Core and Builtins<75>-Footnote-104497814
Ref: Core and Builtins<75>-Footnote-114497870
Ref: Core and Builtins<75>-Footnote-124497926
Ref: Core and Builtins<75>-Footnote-134497982
Ref: Core and Builtins<75>-Footnote-144498038
Ref: Core and Builtins<75>-Footnote-154498094
Ref: Core and Builtins<75>-Footnote-164498150
Ref: Core and Builtins<75>-Footnote-174498206
Node: ライブラリ<79>4498262
Ref: whatsnew/changelog id3654498399
Ref: 1b3b4498399
Ref: ライブラリ<79>-Footnote-14498546
Node: Core and Builtins<76>4498601
Ref: whatsnew/changelog id3664498736
Ref: 1b3c4498736
Ref: Core and Builtins<76>-Footnote-14500463
Ref: Core and Builtins<76>-Footnote-24500518
Ref: Core and Builtins<76>-Footnote-34500573
Ref: Core and Builtins<76>-Footnote-44500628
Ref: Core and Builtins<76>-Footnote-54500683
Ref: Core and Builtins<76>-Footnote-64500738
Ref: Core and Builtins<76>-Footnote-74500793
Ref: Core and Builtins<76>-Footnote-84500848
Ref: Core and Builtins<76>-Footnote-94500903
Ref: Core and Builtins<76>-Footnote-104500958
Ref: Core and Builtins<76>-Footnote-114501014
Node: ライブラリ<80>4501070
Ref: whatsnew/changelog id3674501207
Ref: 1b3d4501207
Ref: ライブラリ<80>-Footnote-14501426
Ref: ライブラリ<80>-Footnote-24501481
Node: Core and Builtins<77>4501536
Ref: whatsnew/changelog id3684501671
Ref: 1b3e4501671
Ref: Core and Builtins<77>-Footnote-14510916
Ref: Core and Builtins<77>-Footnote-24510971
Ref: Core and Builtins<77>-Footnote-34511026
Ref: Core and Builtins<77>-Footnote-44511081
Ref: Core and Builtins<77>-Footnote-54511136
Ref: Core and Builtins<77>-Footnote-64511191
Ref: Core and Builtins<77>-Footnote-74511246
Ref: Core and Builtins<77>-Footnote-84511288
Ref: Core and Builtins<77>-Footnote-94511343
Ref: Core and Builtins<77>-Footnote-104511398
Ref: Core and Builtins<77>-Footnote-114511454
Ref: Core and Builtins<77>-Footnote-124511510
Ref: Core and Builtins<77>-Footnote-134511566
Ref: Core and Builtins<77>-Footnote-144511622
Ref: Core and Builtins<77>-Footnote-154511678
Ref: Core and Builtins<77>-Footnote-164511734
Ref: Core and Builtins<77>-Footnote-174511790
Ref: Core and Builtins<77>-Footnote-184511846
Ref: Core and Builtins<77>-Footnote-194511902
Ref: Core and Builtins<77>-Footnote-204511958
Ref: Core and Builtins<77>-Footnote-214512014
Ref: Core and Builtins<77>-Footnote-224512070
Ref: Core and Builtins<77>-Footnote-234512126
Ref: Core and Builtins<77>-Footnote-244512182
Ref: Core and Builtins<77>-Footnote-254512238
Ref: Core and Builtins<77>-Footnote-264512294
Ref: Core and Builtins<77>-Footnote-274512350
Ref: Core and Builtins<77>-Footnote-284512406
Ref: Core and Builtins<77>-Footnote-294512462
Ref: Core and Builtins<77>-Footnote-304512518
Ref: Core and Builtins<77>-Footnote-314512574
Ref: Core and Builtins<77>-Footnote-324512630
Ref: Core and Builtins<77>-Footnote-334512686
Ref: Core and Builtins<77>-Footnote-344512742
Ref: Core and Builtins<77>-Footnote-354512798
Ref: Core and Builtins<77>-Footnote-364512854
Ref: Core and Builtins<77>-Footnote-374512910
Ref: Core and Builtins<77>-Footnote-384512966
Ref: Core and Builtins<77>-Footnote-394513022
Ref: Core and Builtins<77>-Footnote-404513078
Ref: Core and Builtins<77>-Footnote-414513134
Ref: Core and Builtins<77>-Footnote-424513190
Ref: Core and Builtins<77>-Footnote-434513246
Ref: Core and Builtins<77>-Footnote-444513302
Ref: Core and Builtins<77>-Footnote-454513358
Ref: Core and Builtins<77>-Footnote-464513414
Node: ライブラリ<81>4513470
Ref: whatsnew/changelog id3694513607
Ref: 1b404513607
Ref: ライブラリ<81>-Footnote-14513812
Node: Core and Builtins<78>4513867
Ref: whatsnew/changelog id3704514002
Ref: 1b434514002
Ref: Core and Builtins<78>-Footnote-14514470
Ref: Core and Builtins<78>-Footnote-24514525
Node: ライブラリ<82>4514580
Ref: whatsnew/changelog id3714514717
Ref: 1b444514717
Ref: ライブラリ<82>-Footnote-14515009
Node: Core and Builtins<79>4515064
Ref: whatsnew/changelog id3724515199
Ref: 1b454515199
Ref: Core and Builtins<79>-Footnote-14515395
Node: ライブラリ<83>4515450
Ref: whatsnew/changelog id3734515587
Ref: 1b464515587
Ref: ライブラリ<83>-Footnote-14516041
Ref: ライブラリ<83>-Footnote-24516096
Node: Core and Builtins<80>4516151
Ref: whatsnew/changelog id3744516286
Ref: 1b474516286
Ref: Core and Builtins<80>-Footnote-14521766
Ref: Core and Builtins<80>-Footnote-24521821
Ref: Core and Builtins<80>-Footnote-34521876
Ref: Core and Builtins<80>-Footnote-44521931
Ref: Core and Builtins<80>-Footnote-54521986
Ref: Core and Builtins<80>-Footnote-64522041
Ref: Core and Builtins<80>-Footnote-74522096
Ref: Core and Builtins<80>-Footnote-84522151
Ref: Core and Builtins<80>-Footnote-94522206
Ref: Core and Builtins<80>-Footnote-104522261
Ref: Core and Builtins<80>-Footnote-114522317
Ref: Core and Builtins<80>-Footnote-124522373
Ref: Core and Builtins<80>-Footnote-134522416
Ref: Core and Builtins<80>-Footnote-144522472
Ref: Core and Builtins<80>-Footnote-154522528
Ref: Core and Builtins<80>-Footnote-164522584
Ref: Core and Builtins<80>-Footnote-174522640
Ref: Core and Builtins<80>-Footnote-184522696
Ref: Core and Builtins<80>-Footnote-194522752
Ref: Core and Builtins<80>-Footnote-204522808
Ref: Core and Builtins<80>-Footnote-214522864
Ref: Core and Builtins<80>-Footnote-224522920
Ref: Core and Builtins<80>-Footnote-234522976
Ref: Core and Builtins<80>-Footnote-244523032
Ref: Core and Builtins<80>-Footnote-254523088
Ref: Core and Builtins<80>-Footnote-264523144
Ref: Core and Builtins<80>-Footnote-274523200
Ref: Core and Builtins<80>-Footnote-284523256
Ref: Core and Builtins<80>-Footnote-294523312
Ref: Core and Builtins<80>-Footnote-304523368
Ref: Core and Builtins<80>-Footnote-314523424
Ref: Core and Builtins<80>-Footnote-324523480
Ref: Core and Builtins<80>-Footnote-334523536
Ref: Core and Builtins<80>-Footnote-344523592
Node: ライブラリ<84>4523648
Ref: whatsnew/changelog id3754523785
Ref: 1b484523785
Ref: ライブラリ<84>-Footnote-14524231
Node: Core and Builtins<81>4524286
Ref: whatsnew/changelog id3764524421
Ref: 1b494524421
Ref: Core and Builtins<81>-Footnote-14529667
Ref: Core and Builtins<81>-Footnote-24529722
Ref: Core and Builtins<81>-Footnote-34529777
Ref: Core and Builtins<81>-Footnote-44529832
Ref: Core and Builtins<81>-Footnote-54529887
Ref: Core and Builtins<81>-Footnote-64529942
Ref: Core and Builtins<81>-Footnote-74529997
Ref: Core and Builtins<81>-Footnote-84530052
Ref: Core and Builtins<81>-Footnote-94530107
Ref: Core and Builtins<81>-Footnote-104530162
Ref: Core and Builtins<81>-Footnote-114530218
Ref: Core and Builtins<81>-Footnote-124530274
Ref: Core and Builtins<81>-Footnote-134530330
Ref: Core and Builtins<81>-Footnote-144530386
Ref: Core and Builtins<81>-Footnote-154530442
Ref: Core and Builtins<81>-Footnote-164530498
Ref: Core and Builtins<81>-Footnote-174530554
Ref: Core and Builtins<81>-Footnote-184530610
Ref: Core and Builtins<81>-Footnote-194530666
Ref: Core and Builtins<81>-Footnote-204530726
Ref: Core and Builtins<81>-Footnote-214530782
Ref: Core and Builtins<81>-Footnote-224530838
Ref: Core and Builtins<81>-Footnote-234530894
Ref: Core and Builtins<81>-Footnote-244530950
Ref: Core and Builtins<81>-Footnote-254531006
Ref: Core and Builtins<81>-Footnote-264531062
Ref: Core and Builtins<81>-Footnote-274531118
Ref: Core and Builtins<81>-Footnote-284531174
Ref: Core and Builtins<81>-Footnote-294531230
Ref: Core and Builtins<81>-Footnote-304531286
Ref: Core and Builtins<81>-Footnote-314531342
Ref: Core and Builtins<81>-Footnote-324531398
Node: ライブラリ<85>4531454
Ref: whatsnew/changelog id3774531591
Ref: 1b4a4531591
Ref: ライブラリ<85>-Footnote-14531763
Node: Core and Builtins<82>4531818
Ref: whatsnew/changelog id3784531953
Ref: 1b4b4531953
Ref: Core and Builtins<82>-Footnote-14532407
Ref: Core and Builtins<82>-Footnote-24532462
Node: ライブラリ<86>4532517
Ref: whatsnew/changelog id3794532654
Ref: 1b4c4532654
Ref: ライブラリ<86>-Footnote-14532818
Node: Core and Builtins<83>4532873
Ref: whatsnew/changelog id3804533008
Ref: 1b4d4533008
Ref: Core and Builtins<83>-Footnote-14533872
Ref: Core and Builtins<83>-Footnote-24533927
Ref: Core and Builtins<83>-Footnote-34533982
Ref: Core and Builtins<83>-Footnote-44534037
Ref: Core and Builtins<83>-Footnote-54534102
Ref: Core and Builtins<83>-Footnote-64534167
Node: ライブラリ<87>4534232
Ref: whatsnew/changelog id3814534370
Ref: 1b4e4534370
Ref: ライブラリ<87>-Footnote-14577591
Ref: ライブラリ<87>-Footnote-24577646
Ref: ライブラリ<87>-Footnote-34577701
Ref: ライブラリ<87>-Footnote-44577756
Ref: ライブラリ<87>-Footnote-54577811
Ref: ライブラリ<87>-Footnote-64577866
Ref: ライブラリ<87>-Footnote-74577921
Ref: ライブラリ<87>-Footnote-84577976
Ref: ライブラリ<87>-Footnote-94578031
Ref: ライブラリ<87>-Footnote-104578086
Ref: ライブラリ<87>-Footnote-114578142
Ref: ライブラリ<87>-Footnote-124578198
Ref: ライブラリ<87>-Footnote-134578254
Ref: ライブラリ<87>-Footnote-144578310
Ref: ライブラリ<87>-Footnote-154578366
Ref: ライブラリ<87>-Footnote-164578422
Ref: ライブラリ<87>-Footnote-174578478
Ref: ライブラリ<87>-Footnote-184578534
Ref: ライブラリ<87>-Footnote-194578590
Ref: ライブラリ<87>-Footnote-204578650
Ref: ライブラリ<87>-Footnote-214578706
Ref: ライブラリ<87>-Footnote-224578762
Ref: ライブラリ<87>-Footnote-234578818
Ref: ライブラリ<87>-Footnote-244578874
Ref: ライブラリ<87>-Footnote-254578930
Ref: ライブラリ<87>-Footnote-264578986
Ref: ライブラリ<87>-Footnote-274579042
Ref: ライブラリ<87>-Footnote-284579098
Ref: ライブラリ<87>-Footnote-294579154
Ref: ライブラリ<87>-Footnote-304579210
Ref: ライブラリ<87>-Footnote-314579266
Ref: ライブラリ<87>-Footnote-324579322
Ref: ライブラリ<87>-Footnote-334579378
Ref: ライブラリ<87>-Footnote-344579434
Ref: ライブラリ<87>-Footnote-354579490
Ref: ライブラリ<87>-Footnote-364579546
Ref: ライブラリ<87>-Footnote-374579602
Ref: ライブラリ<87>-Footnote-384579658
Ref: ライブラリ<87>-Footnote-394579714
Ref: ライブラリ<87>-Footnote-404579770
Ref: ライブラリ<87>-Footnote-414579826
Ref: ライブラリ<87>-Footnote-424579882
Ref: ライブラリ<87>-Footnote-434579938
Ref: ライブラリ<87>-Footnote-444579994
Ref: ライブラリ<87>-Footnote-454580050
Ref: ライブラリ<87>-Footnote-464580106
Ref: ライブラリ<87>-Footnote-474580162
Ref: ライブラリ<87>-Footnote-484580218
Ref: ライブラリ<87>-Footnote-494580274
Ref: ライブラリ<87>-Footnote-504580330
Ref: ライブラリ<87>-Footnote-514580386
Ref: ライブラリ<87>-Footnote-524580442
Ref: ライブラリ<87>-Footnote-534580498
Ref: ライブラリ<87>-Footnote-544580554
Ref: ライブラリ<87>-Footnote-554580610
Ref: ライブラリ<87>-Footnote-564580666
Ref: ライブラリ<87>-Footnote-574580722
Ref: ライブラリ<87>-Footnote-584580778
Ref: ライブラリ<87>-Footnote-594580834
Ref: ライブラリ<87>-Footnote-604580890
Ref: ライブラリ<87>-Footnote-614580946
Ref: ライブラリ<87>-Footnote-624581002
Ref: ライブラリ<87>-Footnote-634581058
Ref: ライブラリ<87>-Footnote-644581114
Ref: ライブラリ<87>-Footnote-654581170
Ref: ライブラリ<87>-Footnote-664581226
Ref: ライブラリ<87>-Footnote-674581282
Ref: ライブラリ<87>-Footnote-684581348
Ref: ライブラリ<87>-Footnote-694581404
Ref: ライブラリ<87>-Footnote-704581460
Ref: ライブラリ<87>-Footnote-714581516
Ref: ライブラリ<87>-Footnote-724581572
Ref: ライブラリ<87>-Footnote-734581628
Ref: ライブラリ<87>-Footnote-744581684
Ref: ライブラリ<87>-Footnote-754581740
Ref: ライブラリ<87>-Footnote-764581796
Ref: ライブラリ<87>-Footnote-774581852
Ref: ライブラリ<87>-Footnote-784581908
Ref: ライブラリ<87>-Footnote-794581964
Ref: ライブラリ<87>-Footnote-804582020
Ref: ライブラリ<87>-Footnote-814582076
Ref: ライブラリ<87>-Footnote-824582132
Ref: ライブラリ<87>-Footnote-834582188
Ref: ライブラリ<87>-Footnote-844582244
Ref: ライブラリ<87>-Footnote-854582300
Ref: ライブラリ<87>-Footnote-864582356
Ref: ライブラリ<87>-Footnote-874582412
Ref: ライブラリ<87>-Footnote-884582468
Ref: ライブラリ<87>-Footnote-894582524
Ref: ライブラリ<87>-Footnote-904582580
Ref: ライブラリ<87>-Footnote-914582636
Ref: ライブラリ<87>-Footnote-924582692
Ref: ライブラリ<87>-Footnote-934582748
Ref: ライブラリ<87>-Footnote-944582804
Ref: ライブラリ<87>-Footnote-954582860
Ref: ライブラリ<87>-Footnote-964582916
Ref: ライブラリ<87>-Footnote-974582972
Ref: ライブラリ<87>-Footnote-984583028
Ref: ライブラリ<87>-Footnote-994583084
Ref: ライブラリ<87>-Footnote-1004583140
Ref: ライブラリ<87>-Footnote-1014583197
Ref: ライブラリ<87>-Footnote-1024583254
Ref: ライブラリ<87>-Footnote-1034583311
Ref: ライブラリ<87>-Footnote-1044583368
Ref: ライブラリ<87>-Footnote-1054583425
Ref: ライブラリ<87>-Footnote-1064583482
Ref: ライブラリ<87>-Footnote-1074583539
Ref: ライブラリ<87>-Footnote-1084583596
Ref: ライブラリ<87>-Footnote-1094583653
Ref: ライブラリ<87>-Footnote-1104583710
Ref: ライブラリ<87>-Footnote-1114583767
Ref: ライブラリ<87>-Footnote-1124583824
Ref: ライブラリ<87>-Footnote-1134583881
Ref: ライブラリ<87>-Footnote-1144583938
Ref: ライブラリ<87>-Footnote-1154583995
Ref: ライブラリ<87>-Footnote-1164584052
Ref: ライブラリ<87>-Footnote-1174584109
Ref: ライブラリ<87>-Footnote-1184584166
Ref: ライブラリ<87>-Footnote-1194584223
Ref: ライブラリ<87>-Footnote-1204584280
Ref: ライブラリ<87>-Footnote-1214584337
Ref: ライブラリ<87>-Footnote-1224584394
Ref: ライブラリ<87>-Footnote-1234584451
Ref: ライブラリ<87>-Footnote-1244584495
Ref: ライブラリ<87>-Footnote-1254584552
Ref: ライブラリ<87>-Footnote-1264584609
Ref: ライブラリ<87>-Footnote-1274584666
Ref: ライブラリ<87>-Footnote-1284584723
Ref: ライブラリ<87>-Footnote-1294584780
Ref: ライブラリ<87>-Footnote-1304584837
Ref: ライブラリ<87>-Footnote-1314584894
Ref: ライブラリ<87>-Footnote-1324584951
Ref: ライブラリ<87>-Footnote-1334585008
Ref: ライブラリ<87>-Footnote-1344585065
Ref: ライブラリ<87>-Footnote-1354585122
Ref: ライブラリ<87>-Footnote-1364585179
Ref: ライブラリ<87>-Footnote-1374585236
Ref: ライブラリ<87>-Footnote-1384585293
Ref: ライブラリ<87>-Footnote-1394585350
Ref: ライブラリ<87>-Footnote-1404585408
Ref: ライブラリ<87>-Footnote-1414585465
Ref: ライブラリ<87>-Footnote-1424585522
Ref: ライブラリ<87>-Footnote-1434585566
Ref: ライブラリ<87>-Footnote-1444585623
Ref: ライブラリ<87>-Footnote-1454585680
Ref: ライブラリ<87>-Footnote-1464585737
Ref: ライブラリ<87>-Footnote-1474585794
Ref: ライブラリ<87>-Footnote-1484585851
Ref: ライブラリ<87>-Footnote-1494585908
Ref: ライブラリ<87>-Footnote-1504585965
Ref: ライブラリ<87>-Footnote-1514586022
Ref: ライブラリ<87>-Footnote-1524586079
Ref: ライブラリ<87>-Footnote-1534586136
Ref: ライブラリ<87>-Footnote-1544586193
Ref: ライブラリ<87>-Footnote-1554586250
Ref: ライブラリ<87>-Footnote-1564586307
Ref: ライブラリ<87>-Footnote-1574586364
Ref: ライブラリ<87>-Footnote-1584586421
Ref: ライブラリ<87>-Footnote-1594586478
Ref: ライブラリ<87>-Footnote-1604586535
Ref: ライブラリ<87>-Footnote-1614586592
Ref: ライブラリ<87>-Footnote-1624586649
Ref: ライブラリ<87>-Footnote-1634586693
Ref: ライブラリ<87>-Footnote-1644586750
Ref: ライブラリ<87>-Footnote-1654586807
Ref: ライブラリ<87>-Footnote-1664586864
Ref: ライブラリ<87>-Footnote-1674586921
Ref: ライブラリ<87>-Footnote-1684586978
Ref: ライブラリ<87>-Footnote-1694587035
Ref: ライブラリ<87>-Footnote-1704587092
Ref: ライブラリ<87>-Footnote-1714587149
Ref: ライブラリ<87>-Footnote-1724587206
Ref: ライブラリ<87>-Footnote-1734587263
Ref: ライブラリ<87>-Footnote-1744587320
Ref: ライブラリ<87>-Footnote-1754587377
Ref: ライブラリ<87>-Footnote-1764587434
Ref: ライブラリ<87>-Footnote-1774587491
Ref: ライブラリ<87>-Footnote-1784587548
Ref: ライブラリ<87>-Footnote-1794587605
Ref: ライブラリ<87>-Footnote-1804587662
Ref: ライブラリ<87>-Footnote-1814587719
Ref: ライブラリ<87>-Footnote-1824587763
Ref: ライブラリ<87>-Footnote-1834587820
Ref: ライブラリ<87>-Footnote-1844587877
Ref: ライブラリ<87>-Footnote-1854587934
Ref: ライブラリ<87>-Footnote-1864587991
Ref: ライブラリ<87>-Footnote-1874588048
Ref: ライブラリ<87>-Footnote-1884588105
Ref: ライブラリ<87>-Footnote-1894588162
Ref: ライブラリ<87>-Footnote-1904588219
Ref: ライブラリ<87>-Footnote-1914588276
Ref: ライブラリ<87>-Footnote-1924588333
Ref: ライブラリ<87>-Footnote-1934588390
Ref: ライブラリ<87>-Footnote-1944588447
Ref: ライブラリ<87>-Footnote-1954588504
Ref: ライブラリ<87>-Footnote-1964588561
Ref: ライブラリ<87>-Footnote-1974588618
Ref: ライブラリ<87>-Footnote-1984588675
Ref: ライブラリ<87>-Footnote-1994588732
Ref: ライブラリ<87>-Footnote-2004588789
Ref: ライブラリ<87>-Footnote-2014588846
Ref: ライブラリ<87>-Footnote-2024588903
Ref: ライブラリ<87>-Footnote-2034588960
Ref: ライブラリ<87>-Footnote-2044589017
Ref: ライブラリ<87>-Footnote-2054589074
Ref: ライブラリ<87>-Footnote-2064589131
Ref: ライブラリ<87>-Footnote-2074589188
Ref: ライブラリ<87>-Footnote-2084589245
Ref: ライブラリ<87>-Footnote-2094589302
Ref: ライブラリ<87>-Footnote-2104589359
Ref: ライブラリ<87>-Footnote-2114589416
Ref: ライブラリ<87>-Footnote-2124589473
Ref: ライブラリ<87>-Footnote-2134589530
Ref: ライブラリ<87>-Footnote-2144589587
Ref: ライブラリ<87>-Footnote-2154589644
Ref: ライブラリ<87>-Footnote-2164589701
Ref: ライブラリ<87>-Footnote-2174589758
Ref: ライブラリ<87>-Footnote-2184589815
Ref: ライブラリ<87>-Footnote-2194589872
Ref: ライブラリ<87>-Footnote-2204589929
Ref: ライブラリ<87>-Footnote-2214589986
Ref: ライブラリ<87>-Footnote-2224590043
Ref: ライブラリ<87>-Footnote-2234590100
Ref: ライブラリ<87>-Footnote-2244590157
Ref: ライブラリ<87>-Footnote-2254590214
Ref: ライブラリ<87>-Footnote-2264590271
Ref: ライブラリ<87>-Footnote-2274590338
Ref: ライブラリ<87>-Footnote-2284590405
Ref: ライブラリ<87>-Footnote-2294590472
Ref: ライブラリ<87>-Footnote-2304590529
Ref: ライブラリ<87>-Footnote-2314590596
Ref: ライブラリ<87>-Footnote-2324590663
Ref: ライブラリ<87>-Footnote-2334590730
Ref: ライブラリ<87>-Footnote-2344590797
Ref: ライブラリ<87>-Footnote-2354590864
Ref: ライブラリ<87>-Footnote-2364590931
Ref: ライブラリ<87>-Footnote-2374590998
Ref: ライブラリ<87>-Footnote-2384591065
Ref: ライブラリ<87>-Footnote-2394591132
Ref: ライブラリ<87>-Footnote-2404591199
Ref: ライブラリ<87>-Footnote-2414591266
Ref: ライブラリ<87>-Footnote-2424591333
Ref: ライブラリ<87>-Footnote-2434591400
Ref: ライブラリ<87>-Footnote-2444591467
Ref: ライブラリ<87>-Footnote-2454591534
Ref: ライブラリ<87>-Footnote-2464591601
Ref: ライブラリ<87>-Footnote-2474591668
Ref: ライブラリ<87>-Footnote-2484591735
Ref: ライブラリ<87>-Footnote-2494591802
Ref: ライブラリ<87>-Footnote-2504591869
Ref: ライブラリ<87>-Footnote-2514591936
Ref: ライブラリ<87>-Footnote-2524592003
Ref: ライブラリ<87>-Footnote-2534592070
Ref: ライブラリ<87>-Footnote-2544592137
Node: ドキュメント<28>4592204
Ref: whatsnew/changelog id3824592334
Ref: 1b694592334
Ref: ドキュメント<28>-Footnote-14596097
Ref: ドキュメント<28>-Footnote-24596152
Ref: ドキュメント<28>-Footnote-34596207
Ref: ドキュメント<28>-Footnote-44596253
Ref: ドキュメント<28>-Footnote-54596308
Ref: ドキュメント<28>-Footnote-64596363
Ref: ドキュメント<28>-Footnote-74596418
Ref: ドキュメント<28>-Footnote-84596473
Ref: ドキュメント<28>-Footnote-94596528
Ref: ドキュメント<28>-Footnote-104596583
Ref: ドキュメント<28>-Footnote-114596639
Ref: ドキュメント<28>-Footnote-124596695
Ref: ドキュメント<28>-Footnote-134596751
Ref: ドキュメント<28>-Footnote-144596807
Ref: ドキュメント<28>-Footnote-154596850
Ref: ドキュメント<28>-Footnote-164596906
Ref: ドキュメント<28>-Footnote-174596962
Ref: ドキュメント<28>-Footnote-184597018
Ref: ドキュメント<28>-Footnote-194597074
Ref: ドキュメント<28>-Footnote-204597130
Ref: ドキュメント<28>-Footnote-214597186
Ref: ドキュメント<28>-Footnote-224597242
Ref: ドキュメント<28>-Footnote-234597298
Ref: ドキュメント<28>-Footnote-244597364
Ref: ドキュメント<28>-Footnote-254597430
Ref: ドキュメント<28>-Footnote-264597496
Ref: ドキュメント<28>-Footnote-274597562
Node: テスト<27>4597628
Ref: whatsnew/changelog id3834597752
Ref: 1b704597752
Ref: テスト<27>-Footnote-14603138
Ref: テスト<27>-Footnote-24603193
Ref: テスト<27>-Footnote-34603248
Ref: テスト<27>-Footnote-44603303
Ref: テスト<27>-Footnote-54603358
Ref: テスト<27>-Footnote-64603445
Ref: テスト<27>-Footnote-74603500
Ref: テスト<27>-Footnote-84603555
Ref: テスト<27>-Footnote-94603610
Ref: テスト<27>-Footnote-104603665
Ref: テスト<27>-Footnote-114603721
Ref: テスト<27>-Footnote-124603777
Ref: テスト<27>-Footnote-134603833
Ref: テスト<27>-Footnote-144603889
Ref: テスト<27>-Footnote-154603945
Ref: テスト<27>-Footnote-164604001
Ref: テスト<27>-Footnote-174604057
Ref: テスト<27>-Footnote-184604113
Ref: テスト<27>-Footnote-194604169
Ref: テスト<27>-Footnote-204604225
Ref: テスト<27>-Footnote-214604281
Ref: テスト<27>-Footnote-224604337
Ref: テスト<27>-Footnote-234604393
Ref: テスト<27>-Footnote-244604449
Ref: テスト<27>-Footnote-254604505
Ref: テスト<27>-Footnote-264604561
Ref: テスト<27>-Footnote-274604617
Ref: テスト<27>-Footnote-284604673
Ref: テスト<27>-Footnote-294604729
Ref: テスト<27>-Footnote-304604785
Ref: テスト<27>-Footnote-314604841
Ref: テスト<27>-Footnote-324604897
Ref: テスト<27>-Footnote-334604953
Ref: テスト<27>-Footnote-344605009
Ref: テスト<27>-Footnote-354605065
Ref: テスト<27>-Footnote-364605121
Node: ビルド<32>4605187
Ref: whatsnew/changelog id3844605300
Ref: 1b744605300
Ref: ビルド<32>-Footnote-14610786
Ref: ビルド<32>-Footnote-24610841
Ref: ビルド<32>-Footnote-34610896
Ref: ビルド<32>-Footnote-44610951
Ref: ビルド<32>-Footnote-54611006
Ref: ビルド<32>-Footnote-64611061
Ref: ビルド<32>-Footnote-74611116
Ref: ビルド<32>-Footnote-84611171
Ref: ビルド<32>-Footnote-94611226
Ref: ビルド<32>-Footnote-104611281
Ref: ビルド<32>-Footnote-114611337
Ref: ビルド<32>-Footnote-124611393
Ref: ビルド<32>-Footnote-134611449
Ref: ビルド<32>-Footnote-144611505
Ref: ビルド<32>-Footnote-154611561
Ref: ビルド<32>-Footnote-164611617
Ref: ビルド<32>-Footnote-174611660
Ref: ビルド<32>-Footnote-184611716
Ref: ビルド<32>-Footnote-194611772
Ref: ビルド<32>-Footnote-204611828
Ref: ビルド<32>-Footnote-214611884
Ref: ビルド<32>-Footnote-224611940
Ref: ビルド<32>-Footnote-234611996
Ref: ビルド<32>-Footnote-244612052
Ref: ビルド<32>-Footnote-254612108
Ref: ビルド<32>-Footnote-264612164
Ref: ビルド<32>-Footnote-274612220
Ref: ビルド<32>-Footnote-284612276
Ref: ビルド<32>-Footnote-294612332
Ref: ビルド<32>-Footnote-304612388
Ref: ビルド<32>-Footnote-314612444
Ref: ビルド<32>-Footnote-324612487
Ref: ビルド<32>-Footnote-334612543
Ref: ビルド<32>-Footnote-344612599
Ref: ビルド<32>-Footnote-354612655
Ref: ビルド<32>-Footnote-364612711
Node: Windows<29>4612777
Ref: whatsnew/changelog id3854612886
Ref: 1b754612886
Ref: Windows<29>-Footnote-14617299
Ref: Windows<29>-Footnote-24617354
Ref: Windows<29>-Footnote-34617409
Ref: Windows<29>-Footnote-44617464
Ref: Windows<29>-Footnote-54617519
Ref: Windows<29>-Footnote-64617574
Ref: Windows<29>-Footnote-74617629
Ref: Windows<29>-Footnote-84617684
Ref: Windows<29>-Footnote-94617739
Ref: Windows<29>-Footnote-104617794
Ref: Windows<29>-Footnote-114617850
Ref: Windows<29>-Footnote-124617906
Ref: Windows<29>-Footnote-134617962
Ref: Windows<29>-Footnote-144618018
Ref: Windows<29>-Footnote-154618074
Ref: Windows<29>-Footnote-164618130
Ref: Windows<29>-Footnote-174618186
Ref: Windows<29>-Footnote-184618242
Ref: Windows<29>-Footnote-194618298
Ref: Windows<29>-Footnote-204618354
Ref: Windows<29>-Footnote-214618410
Ref: Windows<29>-Footnote-224618466
Ref: Windows<29>-Footnote-234618522
Ref: Windows<29>-Footnote-244618578
Ref: Windows<29>-Footnote-254618634
Ref: Windows<29>-Footnote-264618690
Ref: Windows<29>-Footnote-274618756
Ref: Windows<29>-Footnote-284618812
Ref: Windows<29>-Footnote-294618878
Node: macOS<20>4618944
Ref: whatsnew/changelog id3864619048
Ref: 1b774619048
Ref: macOS<20>-Footnote-14619596
Node: IDLE<15>4619651
Ref: whatsnew/changelog id3874619759
Ref: 1b784619759
Ref: IDLE<15>-Footnote-14620672
Ref: IDLE<15>-Footnote-24620727
Ref: IDLE<15>-Footnote-34620782
Ref: IDLE<15>-Footnote-44620837
Ref: IDLE<15>-Footnote-54620892
Ref: IDLE<15>-Footnote-64620947
Ref: IDLE<15>-Footnote-74621002
Node: Tools/Demos<24>4621057
Ref: whatsnew/changelog id3884621165
Ref: 1b794621165
Ref: Tools/Demos<24>-Footnote-14622676
Ref: Tools/Demos<24>-Footnote-24622731
Ref: Tools/Demos<24>-Footnote-34622786
Ref: Tools/Demos<24>-Footnote-44622834
Ref: Tools/Demos<24>-Footnote-54622889
Ref: Tools/Demos<24>-Footnote-64622937
Ref: Tools/Demos<24>-Footnote-74622992
Ref: Tools/Demos<24>-Footnote-84623047
Ref: Tools/Demos<24>-Footnote-94623102
Ref: Tools/Demos<24>-Footnote-104623157
Ref: Tools/Demos<24>-Footnote-114623213
Ref: Tools/Demos<24>-Footnote-124623269
Node: C API<29>4623325
Ref: whatsnew/changelog id3904623416
Ref: 1b7a4623416
Ref: C API<29>-Footnote-14630948
Ref: C API<29>-Footnote-24631003
Ref: C API<29>-Footnote-34631058
Ref: C API<29>-Footnote-44631113
Ref: C API<29>-Footnote-54631168
Ref: C API<29>-Footnote-64631223
Ref: C API<29>-Footnote-74631278
Ref: C API<29>-Footnote-84631333
Ref: C API<29>-Footnote-94631388
Ref: C API<29>-Footnote-104631443
Ref: C API<29>-Footnote-114631499
Ref: C API<29>-Footnote-124631555
Ref: C API<29>-Footnote-134631611
Ref: C API<29>-Footnote-144631667
Ref: C API<29>-Footnote-154631723
Ref: C API<29>-Footnote-164631779
Ref: C API<29>-Footnote-174631835
Ref: C API<29>-Footnote-184631891
Ref: C API<29>-Footnote-194631947
Ref: C API<29>-Footnote-204632003
Ref: C API<29>-Footnote-214632059
Ref: C API<29>-Footnote-224632115
Ref: C API<29>-Footnote-234632171
Ref: C API<29>-Footnote-244632227
Ref: C API<29>-Footnote-254632283
Ref: C API<29>-Footnote-264632339
Ref: C API<29>-Footnote-274632395
Ref: C API<29>-Footnote-284632451
Ref: C API<29>-Footnote-294632507
Ref: C API<29>-Footnote-304632563
Ref: C API<29>-Footnote-314632619
Ref: C API<29>-Footnote-324632675
Ref: C API<29>-Footnote-334632731
Ref: C API<29>-Footnote-344632787
Node: Python 3 11 0 beta 14632853
Ref: whatsnew/changelog python-3-11-0-beta-14632982
Ref: 1b7c4632982
Node: セキュリティ<28>4633563
Ref: whatsnew/changelog id3914633672
Ref: 1b7d4633672
Ref: セキュリティ<28>-Footnote-14633985
Node: Core and Builtins<84>4634040
Ref: whatsnew/changelog id3924634177
Ref: 1b7e4634177
Ref: Core and Builtins<84>-Footnote-14640831
Ref: Core and Builtins<84>-Footnote-24640886
Ref: Core and Builtins<84>-Footnote-34640951
Ref: Core and Builtins<84>-Footnote-44641006
Ref: Core and Builtins<84>-Footnote-54641071
Ref: Core and Builtins<84>-Footnote-64641126
Ref: Core and Builtins<84>-Footnote-74641181
Ref: Core and Builtins<84>-Footnote-84641236
Ref: Core and Builtins<84>-Footnote-94641291
Ref: Core and Builtins<84>-Footnote-104641346
Ref: Core and Builtins<84>-Footnote-114641402
Ref: Core and Builtins<84>-Footnote-124641458
Ref: Core and Builtins<84>-Footnote-134641514
Ref: Core and Builtins<84>-Footnote-144641570
Ref: Core and Builtins<84>-Footnote-154641613
Ref: Core and Builtins<84>-Footnote-164641669
Ref: Core and Builtins<84>-Footnote-174641725
Ref: Core and Builtins<84>-Footnote-184641781
Ref: Core and Builtins<84>-Footnote-194641837
Ref: Core and Builtins<84>-Footnote-204641893
Ref: Core and Builtins<84>-Footnote-214641949
Ref: Core and Builtins<84>-Footnote-224642015
Ref: Core and Builtins<84>-Footnote-234642071
Ref: Core and Builtins<84>-Footnote-244642127
Ref: Core and Builtins<84>-Footnote-254642183
Ref: Core and Builtins<84>-Footnote-264642239
Ref: Core and Builtins<84>-Footnote-274642295
Ref: Core and Builtins<84>-Footnote-284642351
Ref: Core and Builtins<84>-Footnote-294642407
Ref: Core and Builtins<84>-Footnote-304642463
Ref: Core and Builtins<84>-Footnote-314642519
Ref: Core and Builtins<84>-Footnote-324642575
Ref: Core and Builtins<84>-Footnote-334642618
Ref: Core and Builtins<84>-Footnote-344642674
Ref: Core and Builtins<84>-Footnote-354642730
Ref: Core and Builtins<84>-Footnote-364642786
Ref: Core and Builtins<84>-Footnote-374642852
Ref: Core and Builtins<84>-Footnote-384642908
Ref: Core and Builtins<84>-Footnote-394642964
Ref: Core and Builtins<84>-Footnote-404643030
Node: ライブラリ<88>4643096
Ref: whatsnew/changelog id3934643232
Ref: 1b814643232
Ref: ライブラリ<88>-Footnote-14643710
Node: Core and Builtins<85>4643775
Ref: whatsnew/changelog id3944643903
Ref: 1b824643903
Ref: Core and Builtins<85>-Footnote-14645678
Ref: Core and Builtins<85>-Footnote-24645743
Ref: Core and Builtins<85>-Footnote-34645808
Ref: Core and Builtins<85>-Footnote-44645873
Ref: Core and Builtins<85>-Footnote-54645938
Ref: Core and Builtins<85>-Footnote-64646003
Ref: Core and Builtins<85>-Footnote-74646068
Ref: Core and Builtins<85>-Footnote-84646133
Ref: Core and Builtins<85>-Footnote-94646198
Node: ビルド<33>4646263
Ref: whatsnew/changelog id3954646393
Ref: 1b864646393
Ref: ビルド<33>-Footnote-14646525
Node: Core and Builtins<86>4646590
Ref: whatsnew/changelog id3964646718
Ref: 1b874646718
Ref: Core and Builtins<86>-Footnote-14647542
Ref: Core and Builtins<86>-Footnote-24647607
Ref: Core and Builtins<86>-Footnote-34647672
Node: ライブラリ<89>4647737
Ref: whatsnew/changelog id3974647874
Ref: 1b884647874
Ref: ライブラリ<89>-Footnote-14665418
Ref: ライブラリ<89>-Footnote-24665473
Ref: ライブラリ<89>-Footnote-34665528
Ref: ライブラリ<89>-Footnote-44665583
Ref: ライブラリ<89>-Footnote-54665638
Ref: ライブラリ<89>-Footnote-64665693
Ref: ライブラリ<89>-Footnote-74665748
Ref: ライブラリ<89>-Footnote-84665803
Ref: ライブラリ<89>-Footnote-94665858
Ref: ライブラリ<89>-Footnote-104665913
Ref: ライブラリ<89>-Footnote-114665969
Ref: ライブラリ<89>-Footnote-124666025
Ref: ライブラリ<89>-Footnote-134666081
Ref: ライブラリ<89>-Footnote-144666137
Ref: ライブラリ<89>-Footnote-154666193
Ref: ライブラリ<89>-Footnote-164666249
Ref: ライブラリ<89>-Footnote-174666305
Ref: ライブラリ<89>-Footnote-184666361
Ref: ライブラリ<89>-Footnote-194666417
Ref: ライブラリ<89>-Footnote-204666473
Ref: ライブラリ<89>-Footnote-214666529
Ref: ライブラリ<89>-Footnote-224666585
Ref: ライブラリ<89>-Footnote-234666641
Ref: ライブラリ<89>-Footnote-244666697
Ref: ライブラリ<89>-Footnote-254666763
Ref: ライブラリ<89>-Footnote-264666819
Ref: ライブラリ<89>-Footnote-274666875
Ref: ライブラリ<89>-Footnote-284666918
Ref: ライブラリ<89>-Footnote-294666974
Ref: ライブラリ<89>-Footnote-304667030
Ref: ライブラリ<89>-Footnote-314667086
Ref: ライブラリ<89>-Footnote-324667142
Ref: ライブラリ<89>-Footnote-334667185
Ref: ライブラリ<89>-Footnote-344667241
Ref: ライブラリ<89>-Footnote-354667297
Ref: ライブラリ<89>-Footnote-364667353
Ref: ライブラリ<89>-Footnote-374667409
Ref: ライブラリ<89>-Footnote-384667465
Ref: ライブラリ<89>-Footnote-394667521
Ref: ライブラリ<89>-Footnote-404667577
Ref: ライブラリ<89>-Footnote-414667633
Ref: ライブラリ<89>-Footnote-424667689
Ref: ライブラリ<89>-Footnote-434667745
Ref: ライブラリ<89>-Footnote-444667801
Ref: ライブラリ<89>-Footnote-454667857
Ref: ライブラリ<89>-Footnote-464667913
Ref: ライブラリ<89>-Footnote-474667969
Ref: ライブラリ<89>-Footnote-484668025
Ref: ライブラリ<89>-Footnote-494668081
Ref: ライブラリ<89>-Footnote-504668137
Ref: ライブラリ<89>-Footnote-514668193
Ref: ライブラリ<89>-Footnote-524668249
Ref: ライブラリ<89>-Footnote-534668305
Ref: ライブラリ<89>-Footnote-544668361
Ref: ライブラリ<89>-Footnote-554668417
Ref: ライブラリ<89>-Footnote-564668473
Ref: ライブラリ<89>-Footnote-574668539
Ref: ライブラリ<89>-Footnote-584668595
Ref: ライブラリ<89>-Footnote-594668651
Ref: ライブラリ<89>-Footnote-604668707
Ref: ライブラリ<89>-Footnote-614668763
Ref: ライブラリ<89>-Footnote-624668819
Ref: ライブラリ<89>-Footnote-634668875
Ref: ライブラリ<89>-Footnote-644668931
Ref: ライブラリ<89>-Footnote-654668987
Ref: ライブラリ<89>-Footnote-664669043
Ref: ライブラリ<89>-Footnote-674669086
Ref: ライブラリ<89>-Footnote-684669142
Ref: ライブラリ<89>-Footnote-694669198
Ref: ライブラリ<89>-Footnote-704669254
Ref: ライブラリ<89>-Footnote-714669310
Ref: ライブラリ<89>-Footnote-724669366
Ref: ライブラリ<89>-Footnote-734669422
Ref: ライブラリ<89>-Footnote-744669478
Ref: ライブラリ<89>-Footnote-754669534
Ref: ライブラリ<89>-Footnote-764669600
Ref: ライブラリ<89>-Footnote-774669656
Ref: ライブラリ<89>-Footnote-784669712
Ref: ライブラリ<89>-Footnote-794669768
Ref: ライブラリ<89>-Footnote-804669834
Ref: ライブラリ<89>-Footnote-814669900
Ref: ライブラリ<89>-Footnote-824669943
Ref: ライブラリ<89>-Footnote-834670009
Ref: ライブラリ<89>-Footnote-844670075
Ref: ライブラリ<89>-Footnote-854670141
Ref: ライブラリ<89>-Footnote-864670207
Ref: ライブラリ<89>-Footnote-874670273
Ref: ライブラリ<89>-Footnote-884670339
Ref: ライブラリ<89>-Footnote-894670405
Ref: ライブラリ<89>-Footnote-904670471
Ref: ライブラリ<89>-Footnote-914670537
Ref: ライブラリ<89>-Footnote-924670603
Ref: ライブラリ<89>-Footnote-934670669
Ref: ライブラリ<89>-Footnote-944670735
Ref: ライブラリ<89>-Footnote-954670801
Ref: ライブラリ<89>-Footnote-964670867
Ref: ライブラリ<89>-Footnote-974670933
Ref: ライブラリ<89>-Footnote-984670999
Ref: ライブラリ<89>-Footnote-994671065
Ref: ライブラリ<89>-Footnote-1004671131
Ref: ライブラリ<89>-Footnote-1014671198
Ref: ライブラリ<89>-Footnote-1024671265
Ref: ライブラリ<89>-Footnote-1034671332
Ref: ライブラリ<89>-Footnote-1044671399
Ref: ライブラリ<89>-Footnote-1054671466
Ref: ライブラリ<89>-Footnote-1064671533
Ref: ライブラリ<89>-Footnote-1074671600
Ref: ライブラリ<89>-Footnote-1084671667
Ref: ライブラリ<89>-Footnote-1094671734
Ref: ライブラリ<89>-Footnote-1104671801
Ref: ライブラリ<89>-Footnote-1114671868
Ref: ライブラリ<89>-Footnote-1124671935
Ref: ライブラリ<89>-Footnote-1134672002
Ref: ライブラリ<89>-Footnote-1144672069
Ref: ライブラリ<89>-Footnote-1154672136
Ref: ライブラリ<89>-Footnote-1164672203
Ref: ライブラリ<89>-Footnote-1174672270
Ref: ライブラリ<89>-Footnote-1184672337
Ref: ライブラリ<89>-Footnote-1194672404
Ref: ライブラリ<89>-Footnote-1204672471
Node: ドキュメント<29>4672538
Ref: whatsnew/changelog id3984672667
Ref: 1b954672667
Ref: ドキュメント<29>-Footnote-14674213
Ref: ドキュメント<29>-Footnote-24674268
Ref: ドキュメント<29>-Footnote-34674323
Ref: ドキュメント<29>-Footnote-44674378
Ref: ドキュメント<29>-Footnote-54674433
Ref: ドキュメント<29>-Footnote-64674498
Ref: ドキュメント<29>-Footnote-74674563
Ref: ドキュメント<29>-Footnote-84674628
Ref: ドキュメント<29>-Footnote-94674693
Ref: ドキュメント<29>-Footnote-104674735
Ref: ドキュメント<29>-Footnote-114674778
Ref: ドキュメント<29>-Footnote-124674844
Ref: ドキュメント<29>-Footnote-134674910
Ref: ドキュメント<29>-Footnote-144674975
Node: テスト<28>4675041
Ref: whatsnew/changelog id3994675164
Ref: 1b984675164
Ref: テスト<28>-Footnote-14676511
Ref: テスト<28>-Footnote-24676566
Ref: テスト<28>-Footnote-34676621
Ref: テスト<28>-Footnote-44676676
Ref: テスト<28>-Footnote-54676731
Ref: テスト<28>-Footnote-64676786
Ref: テスト<28>-Footnote-74676851
Ref: テスト<28>-Footnote-84676916
Node: ビルド<34>4676981
Ref: whatsnew/changelog id4004677093
Ref: 1b9b4677093
Ref: ビルド<34>-Footnote-14677727
Ref: ビルド<34>-Footnote-24677782
Ref: ビルド<34>-Footnote-34677837
Ref: ビルド<34>-Footnote-44677902
Node: Windows<30>4677967
Ref: whatsnew/changelog id4014678075
Ref: 1b9c4678075
Ref: Windows<30>-Footnote-14678697
Ref: Windows<30>-Footnote-24678762
Ref: Windows<30>-Footnote-34678827
Ref: Windows<30>-Footnote-44678892
Ref: Windows<30>-Footnote-54678957
Node: macOS<21>4679022
Ref: whatsnew/changelog id4024679132
Ref: 1b9d4679132
Ref: macOS<21>-Footnote-14679264
Node: Tools/Demos<25>4679329
Ref: whatsnew/changelog id4034679437
Ref: 1b9e4679437
Ref: Tools/Demos<25>-Footnote-14679996
Ref: Tools/Demos<25>-Footnote-24680051
Ref: Tools/Demos<25>-Footnote-34680106
Node: C API<30>4680161
Ref: whatsnew/changelog id4044680251
Ref: 1b9f4680251
Ref: C API<30>-Footnote-14682406
Ref: C API<30>-Footnote-24682461
Ref: C API<30>-Footnote-34682516
Ref: C API<30>-Footnote-44682571
Ref: C API<30>-Footnote-54682626
Ref: C API<30>-Footnote-64682681
Ref: C API<30>-Footnote-74682723
Ref: C API<30>-Footnote-84682778
Ref: C API<30>-Footnote-94682833
Ref: C API<30>-Footnote-104682898
Ref: C API<30>-Footnote-114682964
Ref: C API<30>-Footnote-124683030
Ref: C API<30>-Footnote-134683096
Node: Python 3 11 0 alpha 74683162
Ref: whatsnew/changelog python-3-11-0-alpha-74683291
Ref: 1ba34683291
Node: Core and Builtins<87>4683840
Ref: whatsnew/changelog id4054683947
Ref: 1ba44683947
Ref: Core and Builtins<87>-Footnote-14687227
Ref: Core and Builtins<87>-Footnote-24687292
Ref: Core and Builtins<87>-Footnote-34687357
Ref: Core and Builtins<87>-Footnote-44687422
Ref: Core and Builtins<87>-Footnote-54687487
Ref: Core and Builtins<87>-Footnote-64687552
Ref: Core and Builtins<87>-Footnote-74687617
Ref: Core and Builtins<87>-Footnote-84687682
Ref: Core and Builtins<87>-Footnote-94687747
Ref: Core and Builtins<87>-Footnote-104687812
Ref: Core and Builtins<87>-Footnote-114687878
Ref: Core and Builtins<87>-Footnote-124687944
Ref: Core and Builtins<87>-Footnote-134688010
Ref: Core and Builtins<87>-Footnote-144688076
Ref: Core and Builtins<87>-Footnote-154688142
Ref: Core and Builtins<87>-Footnote-164688208
Ref: Core and Builtins<87>-Footnote-174688274
Node: ライブラリ<90>4688340
Ref: whatsnew/changelog id4064688477
Ref: 1ba64688477
Ref: ライブラリ<90>-Footnote-14688767
Node: Core and Builtins<88>4688832
Ref: whatsnew/changelog id4074688967
Ref: 1ba74688967
Ref: Core and Builtins<88>-Footnote-14689818
Ref: Core and Builtins<88>-Footnote-24689883
Ref: Core and Builtins<88>-Footnote-34689948
Ref: Core and Builtins<88>-Footnote-44690013
Ref: Core and Builtins<88>-Footnote-54690078
Node: ライブラリ<91>4690143
Ref: whatsnew/changelog id4084690280
Ref: 1ba84690280
Ref: ライブラリ<91>-Footnote-14690502
Node: Core and Builtins<89>4690567
Ref: whatsnew/changelog id4094690702
Ref: 1baa4690702
Ref: Core and Builtins<89>-Footnote-14691967
Ref: Core and Builtins<89>-Footnote-24692032
Ref: Core and Builtins<89>-Footnote-34692097
Ref: Core and Builtins<89>-Footnote-44692162
Ref: Core and Builtins<89>-Footnote-54692227
Ref: Core and Builtins<89>-Footnote-64692292
Ref: Core and Builtins<89>-Footnote-74692357
Ref: Core and Builtins<89>-Footnote-84692422
Ref: Core and Builtins<89>-Footnote-94692487
Node: ライブラリ<92>4692552
Ref: whatsnew/changelog id4104692690
Ref: 1bac4692690
Ref: ライブラリ<92>-Footnote-14706879
Ref: ライブラリ<92>-Footnote-24706944
Ref: ライブラリ<92>-Footnote-34707009
Ref: ライブラリ<92>-Footnote-44707074
Ref: ライブラリ<92>-Footnote-54707139
Ref: ライブラリ<92>-Footnote-64707204
Ref: ライブラリ<92>-Footnote-74707268
Ref: ライブラリ<92>-Footnote-84707333
Ref: ライブラリ<92>-Footnote-94707398
Ref: ライブラリ<92>-Footnote-104707463
Ref: ライブラリ<92>-Footnote-114707529
Ref: ライブラリ<92>-Footnote-124707595
Ref: ライブラリ<92>-Footnote-134707661
Ref: ライブラリ<92>-Footnote-144707727
Ref: ライブラリ<92>-Footnote-154707770
Ref: ライブラリ<92>-Footnote-164707836
Ref: ライブラリ<92>-Footnote-174707902
Ref: ライブラリ<92>-Footnote-184707968
Ref: ライブラリ<92>-Footnote-194708011
Ref: ライブラリ<92>-Footnote-204708077
Ref: ライブラリ<92>-Footnote-214708143
Ref: ライブラリ<92>-Footnote-224708209
Ref: ライブラリ<92>-Footnote-234708252
Ref: ライブラリ<92>-Footnote-244708318
Ref: ライブラリ<92>-Footnote-254708384
Ref: ライブラリ<92>-Footnote-264708450
Ref: ライブラリ<92>-Footnote-274708516
Ref: ライブラリ<92>-Footnote-284708582
Ref: ライブラリ<92>-Footnote-294708648
Ref: ライブラリ<92>-Footnote-304708715
Ref: ライブラリ<92>-Footnote-314708781
Ref: ライブラリ<92>-Footnote-324708847
Ref: ライブラリ<92>-Footnote-334708913
Ref: ライブラリ<92>-Footnote-344708979
Ref: ライブラリ<92>-Footnote-354709022
Ref: ライブラリ<92>-Footnote-364709088
Ref: ライブラリ<92>-Footnote-374709154
Ref: ライブラリ<92>-Footnote-384709219
Ref: ライブラリ<92>-Footnote-394709285
Ref: ライブラリ<92>-Footnote-404709351
Ref: ライブラリ<92>-Footnote-414709417
Ref: ライブラリ<92>-Footnote-424709483
Ref: ライブラリ<92>-Footnote-434709526
Ref: ライブラリ<92>-Footnote-444709592
Ref: ライブラリ<92>-Footnote-454709658
Ref: ライブラリ<92>-Footnote-464709724
Ref: ライブラリ<92>-Footnote-474709790
Ref: ライブラリ<92>-Footnote-484709856
Ref: ライブラリ<92>-Footnote-494709922
Ref: ライブラリ<92>-Footnote-504709988
Ref: ライブラリ<92>-Footnote-514710054
Ref: ライブラリ<92>-Footnote-524710120
Ref: ライブラリ<92>-Footnote-534710186
Ref: ライブラリ<92>-Footnote-544710252
Ref: ライブラリ<92>-Footnote-554710318
Ref: ライブラリ<92>-Footnote-564710384
Ref: ライブラリ<92>-Footnote-574710450
Ref: ライブラリ<92>-Footnote-584710516
Ref: ライブラリ<92>-Footnote-594710582
Ref: ライブラリ<92>-Footnote-604710625
Ref: ライブラリ<92>-Footnote-614710692
Ref: ライブラリ<92>-Footnote-624710758
Ref: ライブラリ<92>-Footnote-634710824
Ref: ライブラリ<92>-Footnote-644710890
Ref: ライブラリ<92>-Footnote-654710956
Ref: ライブラリ<92>-Footnote-664711022
Ref: ライブラリ<92>-Footnote-674711088
Ref: ライブラリ<92>-Footnote-684711154
Ref: ライブラリ<92>-Footnote-694711220
Ref: ライブラリ<92>-Footnote-704711286
Ref: ライブラリ<92>-Footnote-714711352
Ref: ライブラリ<92>-Footnote-724711418
Ref: ライブラリ<92>-Footnote-734711484
Ref: ライブラリ<92>-Footnote-744711550
Ref: ライブラリ<92>-Footnote-754711616
Ref: ライブラリ<92>-Footnote-764711682
Ref: ライブラリ<92>-Footnote-774711748
Ref: ライブラリ<92>-Footnote-784711814
Ref: ライブラリ<92>-Footnote-794711880
Ref: ライブラリ<92>-Footnote-804711946
Ref: ライブラリ<92>-Footnote-814712012
Ref: ライブラリ<92>-Footnote-824712078
Ref: ライブラリ<92>-Footnote-834712144
Ref: ライブラリ<92>-Footnote-844712187
Ref: ライブラリ<92>-Footnote-854712253
Ref: ライブラリ<92>-Footnote-864712319
Ref: ライブラリ<92>-Footnote-874712385
Ref: ライブラリ<92>-Footnote-884712451
Node: ドキュメント<30>4712517
Ref: whatsnew/changelog id4114712647
Ref: 1bb94712647
Ref: ドキュメント<30>-Footnote-14713793
Ref: ドキュメント<30>-Footnote-24713858
Ref: ドキュメント<30>-Footnote-34713923
Ref: ドキュメント<30>-Footnote-44713965
Ref: ドキュメント<30>-Footnote-54714030
Ref: ドキュメント<30>-Footnote-64714095
Ref: ドキュメント<30>-Footnote-74714160
Ref: ドキュメント<30>-Footnote-84714225
Node: テスト<29>4714290
Ref: whatsnew/changelog id4124714414
Ref: 1bbc4714414
Ref: テスト<29>-Footnote-14715382
Ref: テスト<29>-Footnote-24715447
Ref: テスト<29>-Footnote-34715512
Ref: テスト<29>-Footnote-44715577
Ref: テスト<29>-Footnote-54715642
Ref: テスト<29>-Footnote-64715707
Ref: テスト<29>-Footnote-74715772
Ref: テスト<29>-Footnote-84715837
Node: ビルド<35>4715879
Ref: whatsnew/changelog id4134715992
Ref: 1bbd4715992
Ref: ビルド<35>-Footnote-14717283
Ref: ビルド<35>-Footnote-24717348
Ref: ビルド<35>-Footnote-34717413
Ref: ビルド<35>-Footnote-44717478
Ref: ビルド<35>-Footnote-54717543
Ref: ビルド<35>-Footnote-64717608
Ref: ビルド<35>-Footnote-74717673
Ref: ビルド<35>-Footnote-84717738
Ref: ビルド<35>-Footnote-94717803
Node: Windows<31>4717868
Ref: whatsnew/changelog id4144717977
Ref: 1bbf4717977
Ref: Windows<31>-Footnote-14719165
Ref: Windows<31>-Footnote-24719230
Ref: Windows<31>-Footnote-34719286
Ref: Windows<31>-Footnote-44719351
Ref: Windows<31>-Footnote-54719416
Ref: Windows<31>-Footnote-64719458
Ref: Windows<31>-Footnote-74719523
Ref: Windows<31>-Footnote-84719588
Ref: Windows<31>-Footnote-94719653
Ref: Windows<31>-Footnote-104719708
Ref: Windows<31>-Footnote-114719765
Ref: Windows<31>-Footnote-124719831
Node: macOS<22>4719888
Ref: whatsnew/changelog id4154719999
Ref: 1bc04719999
Ref: macOS<22>-Footnote-14720337
Ref: macOS<22>-Footnote-24720402
Node: Tools/Demos<26>4720467
Ref: whatsnew/changelog id4164720576
Ref: 1bc14720576
Ref: Tools/Demos<26>-Footnote-14720779
Node: C API<31>4720844
Ref: whatsnew/changelog id4174720935
Ref: 1bc24720935
Ref: C API<31>-Footnote-14723194
Ref: C API<31>-Footnote-24723259
Ref: C API<31>-Footnote-34723324
Ref: C API<31>-Footnote-44723389
Ref: C API<31>-Footnote-54723454
Ref: C API<31>-Footnote-64723519
Ref: C API<31>-Footnote-74723584
Ref: C API<31>-Footnote-84723649
Node: Python 3 11 0 alpha 64723714
Ref: whatsnew/changelog python-3-11-0-alpha-64723844
Ref: 1bc54723844
Node: Core and Builtins<90>4724443
Ref: whatsnew/changelog id4184724550
Ref: 1bc64724550
Ref: Core and Builtins<90>-Footnote-14727912
Ref: Core and Builtins<90>-Footnote-24727977
Ref: Core and Builtins<90>-Footnote-34728042
Ref: Core and Builtins<90>-Footnote-44728107
Ref: Core and Builtins<90>-Footnote-54728172
Ref: Core and Builtins<90>-Footnote-64728237
Ref: Core and Builtins<90>-Footnote-74728302
Ref: Core and Builtins<90>-Footnote-84728367
Ref: Core and Builtins<90>-Footnote-94728432
Ref: Core and Builtins<90>-Footnote-104728497
Ref: Core and Builtins<90>-Footnote-114728563
Ref: Core and Builtins<90>-Footnote-124728629
Ref: Core and Builtins<90>-Footnote-134728695
Ref: Core and Builtins<90>-Footnote-144728761
Ref: Core and Builtins<90>-Footnote-154728827
Ref: Core and Builtins<90>-Footnote-164728893
Ref: Core and Builtins<90>-Footnote-174728959
Ref: Core and Builtins<90>-Footnote-184729025
Ref: Core and Builtins<90>-Footnote-194729091
Ref: Core and Builtins<90>-Footnote-204729157
Ref: Core and Builtins<90>-Footnote-214729223
Ref: Core and Builtins<90>-Footnote-224729289
Ref: Core and Builtins<90>-Footnote-234729355
Ref: Core and Builtins<90>-Footnote-244729421
Ref: Core and Builtins<90>-Footnote-254729487
Ref: Core and Builtins<90>-Footnote-264729553
Node: ライブラリ<93>4729619
Ref: whatsnew/changelog id4194729756
Ref: 1bca4729756
Ref: ライブラリ<93>-Footnote-14729900
Node: Core and Builtins<91>4729965
Ref: whatsnew/changelog id4204730100
Ref: 1bcb4730100
Ref: Core and Builtins<91>-Footnote-14732187
Ref: Core and Builtins<91>-Footnote-24732252
Ref: Core and Builtins<91>-Footnote-34732317
Ref: Core and Builtins<91>-Footnote-44732382
Ref: Core and Builtins<91>-Footnote-54732447
Ref: Core and Builtins<91>-Footnote-64732512
Ref: Core and Builtins<91>-Footnote-74732577
Ref: Core and Builtins<91>-Footnote-84732642
Ref: Core and Builtins<91>-Footnote-94732707
Ref: Core and Builtins<91>-Footnote-104732772
Ref: Core and Builtins<91>-Footnote-114732838
Node: ライブラリ<94>4732904
Ref: whatsnew/changelog id4214733041
Ref: 1bcc4733041
Ref: ライブラリ<94>-Footnote-14733312
Node: Core and Builtins<92>4733377
Ref: whatsnew/changelog id4224733512
Ref: 1bcd4733512
Ref: Core and Builtins<92>-Footnote-14734114
Ref: Core and Builtins<92>-Footnote-24734179
Ref: Core and Builtins<92>-Footnote-34734244
Ref: Core and Builtins<92>-Footnote-44734309
Node: ライブラリ<95>4734374
Ref: whatsnew/changelog id4234734511
Ref: 1bce4734511
Ref: ライブラリ<95>-Footnote-14734815
Ref: ライブラリ<95>-Footnote-24734880
Node: Core and Builtins<93>4734945
Ref: whatsnew/changelog id4244735080
Ref: 1bcf4735080
Ref: Core and Builtins<93>-Footnote-14735779
Ref: Core and Builtins<93>-Footnote-24735844
Ref: Core and Builtins<93>-Footnote-34735909
Node: ライブラリ<96>4735974
Ref: whatsnew/changelog id4254736112
Ref: 1bd24736112
Ref: ライブラリ<96>-Footnote-14744322
Ref: ライブラリ<96>-Footnote-24744387
Ref: ライブラリ<96>-Footnote-34744452
Ref: ライブラリ<96>-Footnote-44744517
Ref: ライブラリ<96>-Footnote-54744582
Ref: ライブラリ<96>-Footnote-64744647
Ref: ライブラリ<96>-Footnote-74744712
Ref: ライブラリ<96>-Footnote-84744777
Ref: ライブラリ<96>-Footnote-94744842
Ref: ライブラリ<96>-Footnote-104744907
Ref: ライブラリ<96>-Footnote-114744973
Ref: ライブラリ<96>-Footnote-124745039
Ref: ライブラリ<96>-Footnote-134745105
Ref: ライブラリ<96>-Footnote-144745171
Ref: ライブラリ<96>-Footnote-154745237
Ref: ライブラリ<96>-Footnote-164745303
Ref: ライブラリ<96>-Footnote-174745369
Ref: ライブラリ<96>-Footnote-184745435
Ref: ライブラリ<96>-Footnote-194745501
Ref: ライブラリ<96>-Footnote-204745567
Ref: ライブラリ<96>-Footnote-214745633
Ref: ライブラリ<96>-Footnote-224745699
Ref: ライブラリ<96>-Footnote-234745765
Ref: ライブラリ<96>-Footnote-244745831
Ref: ライブラリ<96>-Footnote-254745897
Ref: ライブラリ<96>-Footnote-264745963
Ref: ライブラリ<96>-Footnote-274746029
Ref: ライブラリ<96>-Footnote-284746095
Ref: ライブラリ<96>-Footnote-294746161
Ref: ライブラリ<96>-Footnote-304746227
Ref: ライブラリ<96>-Footnote-314746293
Ref: ライブラリ<96>-Footnote-324746359
Ref: ライブラリ<96>-Footnote-334746425
Ref: ライブラリ<96>-Footnote-344746491
Ref: ライブラリ<96>-Footnote-354746534
Ref: ライブラリ<96>-Footnote-364746600
Ref: ライブラリ<96>-Footnote-374746666
Ref: ライブラリ<96>-Footnote-384746732
Ref: ライブラリ<96>-Footnote-394746798
Ref: ライブラリ<96>-Footnote-404746864
Ref: ライブラリ<96>-Footnote-414746930
Ref: ライブラリ<96>-Footnote-424746996
Ref: ライブラリ<96>-Footnote-434747062
Ref: ライブラリ<96>-Footnote-444747128
Ref: ライブラリ<96>-Footnote-454747194
Ref: ライブラリ<96>-Footnote-464747260
Ref: ライブラリ<96>-Footnote-474747326
Ref: ライブラリ<96>-Footnote-484747392
Node: ドキュメント<31>4747458
Ref: whatsnew/changelog id4264747588
Ref: 1bde4747588
Ref: ドキュメント<31>-Footnote-14747811
Node: テスト<30>4747876
Ref: whatsnew/changelog id4274748000
Ref: 1bdf4748000
Ref: テスト<30>-Footnote-14748976
Ref: テスト<30>-Footnote-24749041
Ref: テスト<30>-Footnote-34749106
Ref: テスト<30>-Footnote-44749171
Ref: テスト<30>-Footnote-54749236
Node: ビルド<36>4749301
Ref: whatsnew/changelog id4284749414
Ref: 1be04749414
Ref: ビルド<36>-Footnote-14750847
Ref: ビルド<36>-Footnote-24750912
Ref: ビルド<36>-Footnote-34750977
Ref: ビルド<36>-Footnote-44751042
Ref: ビルド<36>-Footnote-54751107
Ref: ビルド<36>-Footnote-64751172
Ref: ビルド<36>-Footnote-74751237
Node: Windows<32>4751302
Ref: whatsnew/changelog id4294751410
Ref: 1be14751410
Ref: Windows<32>-Footnote-14752070
Ref: Windows<32>-Footnote-24752135
Ref: Windows<32>-Footnote-34752200
Node: IDLE<16>4752265
Ref: whatsnew/changelog id4304752369
Ref: 1be24752369
Ref: IDLE<16>-Footnote-14752651
Ref: IDLE<16>-Footnote-24752716
Node: C API<32>4752781
Ref: whatsnew/changelog id4314752865
Ref: 1be34752865
Ref: C API<32>-Footnote-14753810
Ref: C API<32>-Footnote-24753875
Ref: C API<32>-Footnote-34753940
Ref: C API<32>-Footnote-44754005
Ref: C API<32>-Footnote-54754070
Node: Python 3 11 0 alpha 54754135
Ref: whatsnew/changelog python-3-11-0-alpha-54754265
Ref: 1be44754265
Node: Core and Builtins<94>4754828
Ref: whatsnew/changelog id4324754935
Ref: 1be54754935
Ref: Core and Builtins<94>-Footnote-14758865
Ref: Core and Builtins<94>-Footnote-24758930
Ref: Core and Builtins<94>-Footnote-34758995
Ref: Core and Builtins<94>-Footnote-44759060
Ref: Core and Builtins<94>-Footnote-54759125
Ref: Core and Builtins<94>-Footnote-64759190
Ref: Core and Builtins<94>-Footnote-74759255
Ref: Core and Builtins<94>-Footnote-84759320
Ref: Core and Builtins<94>-Footnote-94759385
Ref: Core and Builtins<94>-Footnote-104759450
Ref: Core and Builtins<94>-Footnote-114759516
Ref: Core and Builtins<94>-Footnote-124759582
Ref: Core and Builtins<94>-Footnote-134759648
Ref: Core and Builtins<94>-Footnote-144759691
Ref: Core and Builtins<94>-Footnote-154759757
Ref: Core and Builtins<94>-Footnote-164759823
Ref: Core and Builtins<94>-Footnote-174759889
Ref: Core and Builtins<94>-Footnote-184759955
Ref: Core and Builtins<94>-Footnote-194760021
Node: ライブラリ<97>4760087
Ref: whatsnew/changelog id4334760224
Ref: 1be74760224
Ref: ライブラリ<97>-Footnote-14760453
Node: Core and Builtins<95>4760518
Ref: whatsnew/changelog id4344760653
Ref: 1be84760653
Ref: Core and Builtins<95>-Footnote-14761388
Ref: Core and Builtins<95>-Footnote-24761453
Ref: Core and Builtins<95>-Footnote-34761518
Ref: Core and Builtins<95>-Footnote-44761583
Node: ライブラリ<98>4761648
Ref: whatsnew/changelog id4354761777
Ref: 1bea4761777
Ref: ライブラリ<98>-Footnote-14761916
Node: ビルド<37>4761981
Ref: whatsnew/changelog id4364762110
Ref: 1beb4762110
Ref: ビルド<37>-Footnote-14762242
Node: Core and Builtins<96>4762307
Ref: whatsnew/changelog id4374762436
Ref: 1bec4762436
Ref: Core and Builtins<96>-Footnote-14762736
Node: ライブラリ<99>4762801
Ref: whatsnew/changelog id4384762939
Ref: 1bed4762939
Ref: ライブラリ<99>-Footnote-14768889
Ref: ライブラリ<99>-Footnote-24768954
Ref: ライブラリ<99>-Footnote-34769019
Ref: ライブラリ<99>-Footnote-44769084
Ref: ライブラリ<99>-Footnote-54769149
Ref: ライブラリ<99>-Footnote-64769214
Ref: ライブラリ<99>-Footnote-74769279
Ref: ライブラリ<99>-Footnote-84769344
Ref: ライブラリ<99>-Footnote-94769409
Ref: ライブラリ<99>-Footnote-104769474
Ref: ライブラリ<99>-Footnote-114769540
Ref: ライブラリ<99>-Footnote-124769606
Ref: ライブラリ<99>-Footnote-134769672
Ref: ライブラリ<99>-Footnote-144769738
Ref: ライブラリ<99>-Footnote-154769804
Ref: ライブラリ<99>-Footnote-164769870
Ref: ライブラリ<99>-Footnote-174769936
Ref: ライブラリ<99>-Footnote-184770002
Ref: ライブラリ<99>-Footnote-194770068
Ref: ライブラリ<99>-Footnote-204770134
Ref: ライブラリ<99>-Footnote-214770200
Ref: ライブラリ<99>-Footnote-224770266
Ref: ライブラリ<99>-Footnote-234770332
Ref: ライブラリ<99>-Footnote-244770398
Ref: ライブラリ<99>-Footnote-254770464
Ref: ライブラリ<99>-Footnote-264770530
Ref: ライブラリ<99>-Footnote-274770596
Ref: ライブラリ<99>-Footnote-284770662
Ref: ライブラリ<99>-Footnote-294770728
Ref: ライブラリ<99>-Footnote-304770794
Ref: ライブラリ<99>-Footnote-314770860
Ref: ライブラリ<99>-Footnote-324770926
Ref: ライブラリ<99>-Footnote-334770992
Ref: ライブラリ<99>-Footnote-344771058
Ref: ライブラリ<99>-Footnote-354771124
Ref: ライブラリ<99>-Footnote-364771190
Ref: ライブラリ<99>-Footnote-374771256
Node: ドキュメント<32>4771322
Ref: whatsnew/changelog id4394771452
Ref: 1bf34771452
Ref: ドキュメント<32>-Footnote-14771645
Node: テスト<31>4771710
Ref: whatsnew/changelog id4404771834
Ref: 1bf44771834
Ref: テスト<31>-Footnote-14773984
Ref: テスト<31>-Footnote-24774049
Ref: テスト<31>-Footnote-34774114
Ref: テスト<31>-Footnote-44774179
Ref: テスト<31>-Footnote-54774244
Ref: テスト<31>-Footnote-64774309
Ref: テスト<31>-Footnote-74774374
Ref: テスト<31>-Footnote-84774439
Ref: テスト<31>-Footnote-94774504
Ref: テスト<31>-Footnote-104774569
Ref: テスト<31>-Footnote-114774635
Node: ビルド<38>4774701
Ref: whatsnew/changelog id4414774814
Ref: 1bf54774814
Ref: ビルド<38>-Footnote-14776551
Ref: ビルド<38>-Footnote-24776616
Ref: ビルド<38>-Footnote-34776681
Ref: ビルド<38>-Footnote-44776746
Ref: ビルド<38>-Footnote-54776811
Ref: ビルド<38>-Footnote-64776876
Ref: ビルド<38>-Footnote-74776941
Ref: ビルド<38>-Footnote-84777006
Ref: ビルド<38>-Footnote-94777071
Ref: ビルド<38>-Footnote-104777136
Node: Windows<33>4777202
Ref: whatsnew/changelog id4424777311
Ref: 1bf64777311
Ref: Windows<33>-Footnote-14777841
Ref: Windows<33>-Footnote-24777906
Ref: Windows<33>-Footnote-34777971
Node: macOS<23>4778036
Ref: whatsnew/changelog id4434778140
Ref: 1bf74778140
Ref: macOS<23>-Footnote-14778272
Node: IDLE<17>4778337
Ref: whatsnew/changelog id4444778439
Ref: 1bf84778439
Ref: IDLE<17>-Footnote-14778828
Node: C API<33>4778893
Ref: whatsnew/changelog id4454778977
Ref: 1bf94778977
Ref: C API<33>-Footnote-14779870
Ref: C API<33>-Footnote-24779935
Ref: C API<33>-Footnote-34780000
Ref: C API<33>-Footnote-44780065
Ref: C API<33>-Footnote-54780130
Node: Python 3 11 0 alpha 44780195
Ref: whatsnew/changelog python-3-11-0-alpha-44780325
Ref: 1bfa4780325
Node: Core and Builtins<97>4780934
Ref: whatsnew/changelog id4464781042
Ref: 1bfb4781042
Ref: Core and Builtins<97>-Footnote-14783234
Ref: Core and Builtins<97>-Footnote-24783299
Ref: Core and Builtins<97>-Footnote-34783364
Ref: Core and Builtins<97>-Footnote-44783429
Ref: Core and Builtins<97>-Footnote-54783494
Ref: Core and Builtins<97>-Footnote-64783559
Ref: Core and Builtins<97>-Footnote-74783624
Ref: Core and Builtins<97>-Footnote-84783689
Ref: Core and Builtins<97>-Footnote-94783754
Ref: Core and Builtins<97>-Footnote-104783819
Ref: Core and Builtins<97>-Footnote-114783885
Node: ライブラリ<100>4783951
Ref: whatsnew/changelog id4474784089
Ref: 1bfc4784089
Ref: ライブラリ<100>-Footnote-14784289
Node: Core and Builtins<98>4784354
Ref: whatsnew/changelog id4484784491
Ref: 1bfd4784491
Ref: Core and Builtins<98>-Footnote-14785216
Ref: Core and Builtins<98>-Footnote-24785281
Ref: Core and Builtins<98>-Footnote-34785346
Ref: Core and Builtins<98>-Footnote-44785411
Ref: Core and Builtins<98>-Footnote-54785476
Node: ライブラリ<101>4785541
Ref: whatsnew/changelog id4494785679
Ref: 1bfe4785679
Ref: ライブラリ<101>-Footnote-14785834
Node: Core and Builtins<99>4785899
Ref: whatsnew/changelog id4504786036
Ref: 1bff4786036
Ref: Core and Builtins<99>-Footnote-14788585
Ref: Core and Builtins<99>-Footnote-24788650
Ref: Core and Builtins<99>-Footnote-34788715
Ref: Core and Builtins<99>-Footnote-44788780
Ref: Core and Builtins<99>-Footnote-54788845
Ref: Core and Builtins<99>-Footnote-64788910
Ref: Core and Builtins<99>-Footnote-74788975
Ref: Core and Builtins<99>-Footnote-84789040
Ref: Core and Builtins<99>-Footnote-94789105
Ref: Core and Builtins<99>-Footnote-104789170
Ref: Core and Builtins<99>-Footnote-114789236
Ref: Core and Builtins<99>-Footnote-124789302
Ref: Core and Builtins<99>-Footnote-134789368
Ref: Core and Builtins<99>-Footnote-144789434
Ref: Core and Builtins<99>-Footnote-154789500
Node: ライブラリ<102>4789566
Ref: whatsnew/changelog id4514789705
Ref: 1c014789705
Ref: ライブラリ<102>-Footnote-14789888
Node: Core and Builtins<100>4789953
Ref: whatsnew/changelog id4524790091
Ref: 1c024790091
Ref: Core and Builtins<100>-Footnote-14791368
Ref: Core and Builtins<100>-Footnote-24791433
Ref: Core and Builtins<100>-Footnote-34791498
Ref: Core and Builtins<100>-Footnote-44791563
Ref: Core and Builtins<100>-Footnote-54791628
Ref: Core and Builtins<100>-Footnote-64791670
Ref: Core and Builtins<100>-Footnote-74791735
Node: ライブラリ<103>4791800
Ref: whatsnew/changelog id4534791940
Ref: 1c034791940
Ref: ライブラリ<103>-Footnote-14799216
Ref: ライブラリ<103>-Footnote-24799281
Ref: ライブラリ<103>-Footnote-34799346
Ref: ライブラリ<103>-Footnote-44799411
Ref: ライブラリ<103>-Footnote-54799476
Ref: ライブラリ<103>-Footnote-64799541
Ref: ライブラリ<103>-Footnote-74799606
Ref: ライブラリ<103>-Footnote-84799671
Ref: ライブラリ<103>-Footnote-94799736
Ref: ライブラリ<103>-Footnote-104799801
Ref: ライブラリ<103>-Footnote-114799867
Ref: ライブラリ<103>-Footnote-124799933
Ref: ライブラリ<103>-Footnote-134799999
Ref: ライブラリ<103>-Footnote-144800065
Ref: ライブラリ<103>-Footnote-154800131
Ref: ライブラリ<103>-Footnote-164800197
Ref: ライブラリ<103>-Footnote-174800263
Ref: ライブラリ<103>-Footnote-184800329
Ref: ライブラリ<103>-Footnote-194800395
Ref: ライブラリ<103>-Footnote-204800461
Ref: ライブラリ<103>-Footnote-214800527
Ref: ライブラリ<103>-Footnote-224800593
Ref: ライブラリ<103>-Footnote-234800659
Ref: ライブラリ<103>-Footnote-244800725
Ref: ライブラリ<103>-Footnote-254800791
Ref: ライブラリ<103>-Footnote-264800857
Ref: ライブラリ<103>-Footnote-274800923
Ref: ライブラリ<103>-Footnote-284800989
Ref: ライブラリ<103>-Footnote-294801055
Ref: ライブラリ<103>-Footnote-304801121
Ref: ライブラリ<103>-Footnote-314801187
Ref: ライブラリ<103>-Footnote-324801253
Ref: ライブラリ<103>-Footnote-334801319
Ref: ライブラリ<103>-Footnote-344801385
Ref: ライブラリ<103>-Footnote-354801451
Ref: ライブラリ<103>-Footnote-364801517
Ref: ライブラリ<103>-Footnote-374801583
Ref: ライブラリ<103>-Footnote-384801649
Ref: ライブラリ<103>-Footnote-394801715
Ref: ライブラリ<103>-Footnote-404801781
Ref: ライブラリ<103>-Footnote-414801847
Ref: ライブラリ<103>-Footnote-424801913
Ref: ライブラリ<103>-Footnote-434801979
Ref: ライブラリ<103>-Footnote-444802045
Node: ドキュメント<33>4802111
Ref: whatsnew/changelog id4544802242
Ref: 1c084802242
Ref: ドキュメント<33>-Footnote-14802743
Ref: ドキュメント<33>-Footnote-24802808
Ref: ドキュメント<33>-Footnote-34802873
Ref: ドキュメント<33>-Footnote-44802938
Node: テスト<32>4803003
Ref: whatsnew/changelog id4554803127
Ref: 1c0b4803127
Ref: テスト<32>-Footnote-14804062
Ref: テスト<32>-Footnote-24804127
Ref: テスト<32>-Footnote-34804192
Ref: テスト<32>-Footnote-44804257
Ref: テスト<32>-Footnote-54804322
Ref: テスト<32>-Footnote-64804387
Ref: テスト<32>-Footnote-74804452
Ref: テスト<32>-Footnote-84804517
Node: ビルド<39>4804582
Ref: whatsnew/changelog id4564804695
Ref: 1c0c4804695
Ref: ビルド<39>-Footnote-14806763
Ref: ビルド<39>-Footnote-24806828
Ref: ビルド<39>-Footnote-34806893
Ref: ビルド<39>-Footnote-44806958
Ref: ビルド<39>-Footnote-54807023
Ref: ビルド<39>-Footnote-64807088
Ref: ビルド<39>-Footnote-74807153
Ref: ビルド<39>-Footnote-84807218
Ref: ビルド<39>-Footnote-94807283
Ref: ビルド<39>-Footnote-104807348
Ref: ビルド<39>-Footnote-114807414
Ref: ビルド<39>-Footnote-124807480
Node: Windows<34>4807546
Ref: whatsnew/changelog id4574807655
Ref: 1c0d4807655
Ref: Windows<34>-Footnote-14807876
Node: macOS<24>4807941
Ref: whatsnew/changelog id4584808046
Ref: 1c0e4808046
Ref: macOS<24>-Footnote-14808286
Node: C API<34>4808351
Ref: whatsnew/changelog id4594808436
Ref: 1c0f4808436
Ref: C API<34>-Footnote-14809714
Ref: C API<34>-Footnote-24809779
Ref: C API<34>-Footnote-34809844
Ref: C API<34>-Footnote-44809909
Ref: C API<34>-Footnote-54809974
Node: Python 3 11 0 alpha 34810039
Ref: whatsnew/changelog python-3-11-0-alpha-34810169
Ref: 1c114810169
Node: Core and Builtins<101>4810606
Ref: whatsnew/changelog id4604810715
Ref: 1c124810715
Ref: Core and Builtins<101>-Footnote-14813296
Ref: Core and Builtins<101>-Footnote-24813361
Ref: Core and Builtins<101>-Footnote-34813426
Ref: Core and Builtins<101>-Footnote-44813491
Ref: Core and Builtins<101>-Footnote-54813556
Ref: Core and Builtins<101>-Footnote-64813621
Ref: Core and Builtins<101>-Footnote-74813686
Ref: Core and Builtins<101>-Footnote-84813751
Ref: Core and Builtins<101>-Footnote-94813816
Ref: Core and Builtins<101>-Footnote-104813881
Ref: Core and Builtins<101>-Footnote-114813947
Ref: Core and Builtins<101>-Footnote-124814013
Node: ライブラリ<104>4814079
Ref: whatsnew/changelog id4614814219
Ref: 1c144814219
Ref: ライブラリ<104>-Footnote-14814403
Node: Core and Builtins<102>4814468
Ref: whatsnew/changelog id4624814606
Ref: 1c154814606
Ref: Core and Builtins<102>-Footnote-14817624
Ref: Core and Builtins<102>-Footnote-24817689
Ref: Core and Builtins<102>-Footnote-34817754
Ref: Core and Builtins<102>-Footnote-44817819
Ref: Core and Builtins<102>-Footnote-54817884
Ref: Core and Builtins<102>-Footnote-64817949
Ref: Core and Builtins<102>-Footnote-74818014
Ref: Core and Builtins<102>-Footnote-84818079
Ref: Core and Builtins<102>-Footnote-94818144
Ref: Core and Builtins<102>-Footnote-104818186
Ref: Core and Builtins<102>-Footnote-114818252
Ref: Core and Builtins<102>-Footnote-124818318
Ref: Core and Builtins<102>-Footnote-134818384
Ref: Core and Builtins<102>-Footnote-144818450
Ref: Core and Builtins<102>-Footnote-154818516
Ref: Core and Builtins<102>-Footnote-164818582
Ref: Core and Builtins<102>-Footnote-174818648
Ref: Core and Builtins<102>-Footnote-184818714
Ref: Core and Builtins<102>-Footnote-194818780
Ref: Core and Builtins<102>-Footnote-204818846
Ref: Core and Builtins<102>-Footnote-214818912
Node: ライブラリ<105>4818978
Ref: whatsnew/changelog id4634819118
Ref: 1c164819118
Ref: ライブラリ<105>-Footnote-14825098
Ref: ライブラリ<105>-Footnote-24825163
Ref: ライブラリ<105>-Footnote-34825228
Ref: ライブラリ<105>-Footnote-44825293
Ref: ライブラリ<105>-Footnote-54825358
Ref: ライブラリ<105>-Footnote-64825423
Ref: ライブラリ<105>-Footnote-74825488
Ref: ライブラリ<105>-Footnote-84825553
Ref: ライブラリ<105>-Footnote-94825618
Ref: ライブラリ<105>-Footnote-104825683
Ref: ライブラリ<105>-Footnote-114825749
Ref: ライブラリ<105>-Footnote-124825815
Ref: ライブラリ<105>-Footnote-134825881
Ref: ライブラリ<105>-Footnote-144825947
Ref: ライブラリ<105>-Footnote-154826013
Ref: ライブラリ<105>-Footnote-164826079
Ref: ライブラリ<105>-Footnote-174826145
Ref: ライブラリ<105>-Footnote-184826211
Ref: ライブラリ<105>-Footnote-194826277
Ref: ライブラリ<105>-Footnote-204826343
Ref: ライブラリ<105>-Footnote-214826409
Ref: ライブラリ<105>-Footnote-224826475
Ref: ライブラリ<105>-Footnote-234826541
Ref: ライブラリ<105>-Footnote-244826607
Ref: ライブラリ<105>-Footnote-254826673
Ref: ライブラリ<105>-Footnote-264826739
Ref: ライブラリ<105>-Footnote-274826805
Ref: ライブラリ<105>-Footnote-284826871
Ref: ライブラリ<105>-Footnote-294826937
Ref: ライブラリ<105>-Footnote-304827003
Ref: ライブラリ<105>-Footnote-314827069
Ref: ライブラリ<105>-Footnote-324827112
Ref: ライブラリ<105>-Footnote-334827178
Ref: ライブラリ<105>-Footnote-344827244
Ref: ライブラリ<105>-Footnote-354827310
Ref: ライブラリ<105>-Footnote-364827376
Node: ドキュメント<34>4827442
Ref: whatsnew/changelog id4644827573
Ref: 1c184827573
Ref: ドキュメント<34>-Footnote-14828885
Ref: ドキュメント<34>-Footnote-24828950
Ref: ドキュメント<34>-Footnote-34829015
Ref: ドキュメント<34>-Footnote-44829080
Ref: ドキュメント<34>-Footnote-54829145
Ref: ドキュメント<34>-Footnote-64829210
Ref: ドキュメント<34>-Footnote-74829275
Ref: ドキュメント<34>-Footnote-84829340
Ref: ドキュメント<34>-Footnote-94829405
Node: テスト<33>4829470
Ref: whatsnew/changelog id4654829594
Ref: 1c194829594
Ref: テスト<33>-Footnote-14830406
Ref: テスト<33>-Footnote-24830471
Ref: テスト<33>-Footnote-34830536
Ref: テスト<33>-Footnote-44830601
Ref: テスト<33>-Footnote-54830666
Ref: テスト<33>-Footnote-64830731
Node: ビルド<40>4830796
Ref: whatsnew/changelog id4664830909
Ref: 1c1a4830909
Ref: ビルド<40>-Footnote-14836709
Ref: ビルド<40>-Footnote-24836774
Ref: ビルド<40>-Footnote-34836839
Ref: ビルド<40>-Footnote-44836904
Ref: ビルド<40>-Footnote-54836969
Ref: ビルド<40>-Footnote-64837034
Ref: ビルド<40>-Footnote-74837099
Ref: ビルド<40>-Footnote-84837164
Ref: ビルド<40>-Footnote-94837229
Ref: ビルド<40>-Footnote-104837294
Ref: ビルド<40>-Footnote-114837360
Ref: ビルド<40>-Footnote-124837426
Ref: ビルド<40>-Footnote-134837492
Ref: ビルド<40>-Footnote-144837558
Ref: ビルド<40>-Footnote-154837624
Ref: ビルド<40>-Footnote-164837690
Ref: ビルド<40>-Footnote-174837756
Ref: ビルド<40>-Footnote-184837822
Ref: ビルド<40>-Footnote-194837888
Ref: ビルド<40>-Footnote-204837954
Ref: ビルド<40>-Footnote-214838020
Ref: ビルド<40>-Footnote-224838086
Ref: ビルド<40>-Footnote-234838152
Ref: ビルド<40>-Footnote-244838218
Ref: ビルド<40>-Footnote-254838284
Ref: ビルド<40>-Footnote-264838350
Ref: ビルド<40>-Footnote-274838416
Ref: ビルド<40>-Footnote-284838482
Ref: ビルド<40>-Footnote-294838548
Ref: ビルド<40>-Footnote-304838614
Ref: ビルド<40>-Footnote-314838680
Ref: ビルド<40>-Footnote-324838746
Ref: ビルド<40>-Footnote-334838812
Node: Windows<35>4838878
Ref: whatsnew/changelog id4674838987
Ref: 1c1b4838987
Ref: Windows<35>-Footnote-14840168
Ref: Windows<35>-Footnote-24840233
Ref: Windows<35>-Footnote-34840298
Ref: Windows<35>-Footnote-44840363
Ref: Windows<35>-Footnote-54840428
Ref: Windows<35>-Footnote-64840493
Node: macOS<25>4840558
Ref: whatsnew/changelog id4684840663
Ref: 1c1c4840663
Ref: macOS<25>-Footnote-14840813
Node: C API<35>4840878
Ref: whatsnew/changelog id4694840963
Ref: 1c1d4840963
Ref: C API<35>-Footnote-14841170
Node: Python 3 11 0 alpha 24841235
Ref: whatsnew/changelog python-3-11-0-alpha-24841365
Ref: 1c1e4841365
Node: Core and Builtins<103>4841737
Ref: whatsnew/changelog id4704841846
Ref: 1c1f4841846
Ref: Core and Builtins<103>-Footnote-14847206
Ref: Core and Builtins<103>-Footnote-24847271
Ref: Core and Builtins<103>-Footnote-34847336
Ref: Core and Builtins<103>-Footnote-44847401
Ref: Core and Builtins<103>-Footnote-54847466
Ref: Core and Builtins<103>-Footnote-64847531
Ref: Core and Builtins<103>-Footnote-74847596
Ref: Core and Builtins<103>-Footnote-84847661
Ref: Core and Builtins<103>-Footnote-94847726
Ref: Core and Builtins<103>-Footnote-104847791
Ref: Core and Builtins<103>-Footnote-114847857
Ref: Core and Builtins<103>-Footnote-124847923
Ref: Core and Builtins<103>-Footnote-134847989
Ref: Core and Builtins<103>-Footnote-144848055
Ref: Core and Builtins<103>-Footnote-154848121
Ref: Core and Builtins<103>-Footnote-164848187
Ref: Core and Builtins<103>-Footnote-174848253
Ref: Core and Builtins<103>-Footnote-184848319
Ref: Core and Builtins<103>-Footnote-194848385
Ref: Core and Builtins<103>-Footnote-204848451
Ref: Core and Builtins<103>-Footnote-214848494
Ref: Core and Builtins<103>-Footnote-224848560
Ref: Core and Builtins<103>-Footnote-234848626
Ref: Core and Builtins<103>-Footnote-244848692
Ref: Core and Builtins<103>-Footnote-254848758
Ref: Core and Builtins<103>-Footnote-264848824
Node: ライブラリ<106>4848867
Ref: whatsnew/changelog id4714849007
Ref: 1c214849007
Ref: ライブラリ<106>-Footnote-14856572
Ref: ライブラリ<106>-Footnote-24856637
Ref: ライブラリ<106>-Footnote-34856702
Ref: ライブラリ<106>-Footnote-44856767
Ref: ライブラリ<106>-Footnote-54856832
Ref: ライブラリ<106>-Footnote-64856897
Ref: ライブラリ<106>-Footnote-74856962
Ref: ライブラリ<106>-Footnote-84857027
Ref: ライブラリ<106>-Footnote-94857092
Ref: ライブラリ<106>-Footnote-104857157
Ref: ライブラリ<106>-Footnote-114857223
Ref: ライブラリ<106>-Footnote-124857289
Ref: ライブラリ<106>-Footnote-134857355
Ref: ライブラリ<106>-Footnote-144857421
Ref: ライブラリ<106>-Footnote-154857487
Ref: ライブラリ<106>-Footnote-164857553
Ref: ライブラリ<106>-Footnote-174857619
Ref: ライブラリ<106>-Footnote-184857685
Ref: ライブラリ<106>-Footnote-194857751
Ref: ライブラリ<106>-Footnote-204857817
Ref: ライブラリ<106>-Footnote-214857883
Ref: ライブラリ<106>-Footnote-224857949
Ref: ライブラリ<106>-Footnote-234858015
Ref: ライブラリ<106>-Footnote-244858081
Ref: ライブラリ<106>-Footnote-254858147
Ref: ライブラリ<106>-Footnote-264858213
Ref: ライブラリ<106>-Footnote-274858279
Ref: ライブラリ<106>-Footnote-284858345
Ref: ライブラリ<106>-Footnote-294858411
Ref: ライブラリ<106>-Footnote-304858477
Ref: ライブラリ<106>-Footnote-314858543
Ref: ライブラリ<106>-Footnote-324858609
Ref: ライブラリ<106>-Footnote-334858675
Ref: ライブラリ<106>-Footnote-344858741
Ref: ライブラリ<106>-Footnote-354858807
Ref: ライブラリ<106>-Footnote-364858873
Ref: ライブラリ<106>-Footnote-374858939
Ref: ライブラリ<106>-Footnote-384859005
Ref: ライブラリ<106>-Footnote-394859071
Ref: ライブラリ<106>-Footnote-404859137
Ref: ライブラリ<106>-Footnote-414859203
Ref: ライブラリ<106>-Footnote-424859269
Ref: ライブラリ<106>-Footnote-434859335
Ref: ライブラリ<106>-Footnote-444859395
Ref: ライブラリ<106>-Footnote-454859461
Node: ドキュメント<35>4859527
Ref: whatsnew/changelog id4724859658
Ref: 1c264859658
Ref: ドキュメント<35>-Footnote-14861140
Ref: ドキュメント<35>-Footnote-24861205
Ref: ドキュメント<35>-Footnote-34861270
Ref: ドキュメント<35>-Footnote-44861335
Ref: ドキュメント<35>-Footnote-54861400
Ref: ドキュメント<35>-Footnote-64861465
Ref: ドキュメント<35>-Footnote-74861530
Ref: ドキュメント<35>-Footnote-84861595
Ref: ドキュメント<35>-Footnote-94861660
Ref: ドキュメント<35>-Footnote-104861702
Ref: ドキュメント<35>-Footnote-114861768
Node: テスト<34>4861834
Ref: whatsnew/changelog id4734861958
Ref: 1c284861958
Ref: テスト<34>-Footnote-14864229
Ref: テスト<34>-Footnote-24864294
Ref: テスト<34>-Footnote-34864359
Ref: テスト<34>-Footnote-44864424
Ref: テスト<34>-Footnote-54864489
Ref: テスト<34>-Footnote-64864554
Ref: テスト<34>-Footnote-74864619
Ref: テスト<34>-Footnote-84864684
Ref: テスト<34>-Footnote-94864749
Ref: テスト<34>-Footnote-104864814
Ref: テスト<34>-Footnote-114864880
Ref: テスト<34>-Footnote-124864946
Ref: テスト<34>-Footnote-134865012
Node: ビルド<41>4865078
Ref: whatsnew/changelog id4744865191
Ref: 1c294865191
Ref: ビルド<41>-Footnote-14867871
Ref: ビルド<41>-Footnote-24867936
Ref: ビルド<41>-Footnote-34868001
Ref: ビルド<41>-Footnote-44868066
Ref: ビルド<41>-Footnote-54868131
Ref: ビルド<41>-Footnote-64868196
Ref: ビルド<41>-Footnote-74868261
Ref: ビルド<41>-Footnote-84868326
Ref: ビルド<41>-Footnote-94868391
Ref: ビルド<41>-Footnote-104868456
Ref: ビルド<41>-Footnote-114868522
Ref: ビルド<41>-Footnote-124868588
Ref: ビルド<41>-Footnote-134868654
Ref: ビルド<41>-Footnote-144868720
Ref: ビルド<41>-Footnote-154868786
Node: Windows<36>4868852
Ref: whatsnew/changelog id4754868961
Ref: 1c2a4868961
Ref: Windows<36>-Footnote-14869516
Ref: Windows<36>-Footnote-24869581
Ref: Windows<36>-Footnote-34869646
Node: macOS<26>4869711
Ref: whatsnew/changelog id4764869815
Ref: 1c2b4869815
Ref: macOS<26>-Footnote-14870076
Node: IDLE<18>4870141
Ref: whatsnew/changelog id4774870243
Ref: 1c2c4870243
Ref: IDLE<18>-Footnote-14870396
Node: C API<36>4870461
Ref: whatsnew/changelog id4784870545
Ref: 1c2d4870545
Ref: C API<36>-Footnote-14874271
Ref: C API<36>-Footnote-24874336
Ref: C API<36>-Footnote-34874401
Ref: C API<36>-Footnote-44874466
Ref: C API<36>-Footnote-54874531
Ref: C API<36>-Footnote-64874596
Ref: C API<36>-Footnote-74874661
Ref: C API<36>-Footnote-84874726
Ref: C API<36>-Footnote-94874791
Ref: C API<36>-Footnote-104874856
Ref: C API<36>-Footnote-114874922
Ref: C API<36>-Footnote-124874988
Ref: C API<36>-Footnote-134875054
Ref: C API<36>-Footnote-144875120
Node: Python 3 11 0 alpha 14875186
Ref: whatsnew/changelog python-3-11-0-alpha-14875315
Ref: 1c2e4875315
Node: セキュリティ<29>4876536
Ref: whatsnew/changelog id4794876647
Ref: 1c2f4876647
Ref: セキュリティ<29>-Footnote-14878016
Ref: セキュリティ<29>-Footnote-24878081
Ref: セキュリティ<29>-Footnote-34878146
Ref: セキュリティ<29>-Footnote-44878211
Ref: セキュリティ<29>-Footnote-54878276
Ref: セキュリティ<29>-Footnote-64878331
Ref: セキュリティ<29>-Footnote-74878396
Node: Core and Builtins<104>4878461
Ref: whatsnew/changelog id4804878601
Ref: 1c314878601
Ref: Core and Builtins<104>-Footnote-14879712
Ref: Core and Builtins<104>-Footnote-24879777
Ref: Core and Builtins<104>-Footnote-34879842
Ref: Core and Builtins<104>-Footnote-44879907
Ref: Core and Builtins<104>-Footnote-54879972
Ref: Core and Builtins<104>-Footnote-64880037
Node: ライブラリ<107>4880102
Ref: whatsnew/changelog id4814880242
Ref: 1c334880242
Ref: ライブラリ<107>-Footnote-14880751
Ref: ライブラリ<107>-Footnote-24880816
Node: Core and Builtins<105>4880881
Ref: whatsnew/changelog id4824881019
Ref: 1c364881019
Ref: Core and Builtins<105>-Footnote-14881200
Node: ライブラリ<108>4881265
Ref: whatsnew/changelog id4834881405
Ref: 1c374881405
Ref: ライブラリ<108>-Footnote-14881669
Node: Core and Builtins<106>4881734
Ref: whatsnew/changelog id4844881872
Ref: 1c384881872
Ref: Core and Builtins<106>-Footnote-14884685
Ref: Core and Builtins<106>-Footnote-24884750
Ref: Core and Builtins<106>-Footnote-34884815
Ref: Core and Builtins<106>-Footnote-44884882
Ref: Core and Builtins<106>-Footnote-54884947
Ref: Core and Builtins<106>-Footnote-64885012
Ref: Core and Builtins<106>-Footnote-74885077
Ref: Core and Builtins<106>-Footnote-84885142
Ref: Core and Builtins<106>-Footnote-94885207
Node: ライブラリ<109>4885272
Ref: whatsnew/changelog id4854885412
Ref: 1c394885412
Ref: ライブラリ<109>-Footnote-14885696
Node: Core and Builtins<107>4885761
Ref: whatsnew/changelog id4864885899
Ref: 1c3a4885899
Ref: Core and Builtins<107>-Footnote-14886358
Ref: Core and Builtins<107>-Footnote-24886423
Ref: Core and Builtins<107>-Footnote-34886488
Node: ライブラリ<110>4886553
Ref: whatsnew/changelog id4874886693
Ref: 1c3b4886693
Ref: ライブラリ<110>-Footnote-14887043
Node: Core and Builtins<108>4887108
Ref: whatsnew/changelog id4884887246
Ref: 1c3c4887246
Ref: Core and Builtins<108>-Footnote-14888260
Ref: Core and Builtins<108>-Footnote-24888325
Ref: Core and Builtins<108>-Footnote-34888390
Ref: Core and Builtins<108>-Footnote-44888455
Ref: Core and Builtins<108>-Footnote-54888520
Node: ライブラリ<111>4888585
Ref: whatsnew/changelog id4894888725
Ref: 1c3d4888725
Ref: ライブラリ<111>-Footnote-14888934
Node: Core and Builtins<109>4888999
Ref: whatsnew/changelog id4904889137
Ref: 1c3e4889137
Ref: Core and Builtins<109>-Footnote-14894167
Ref: Core and Builtins<109>-Footnote-24894232
Ref: Core and Builtins<109>-Footnote-34894297
Ref: Core and Builtins<109>-Footnote-44894362
Ref: Core and Builtins<109>-Footnote-54894427
Ref: Core and Builtins<109>-Footnote-64894492
Ref: Core and Builtins<109>-Footnote-74894557
Ref: Core and Builtins<109>-Footnote-84894622
Ref: Core and Builtins<109>-Footnote-94894687
Ref: Core and Builtins<109>-Footnote-104894752
Ref: Core and Builtins<109>-Footnote-114894818
Ref: Core and Builtins<109>-Footnote-124894884
Ref: Core and Builtins<109>-Footnote-134894950
Ref: Core and Builtins<109>-Footnote-144895016
Ref: Core and Builtins<109>-Footnote-154895082
Ref: Core and Builtins<109>-Footnote-164895148
Ref: Core and Builtins<109>-Footnote-174895214
Ref: Core and Builtins<109>-Footnote-184895280
Ref: Core and Builtins<109>-Footnote-194895346
Ref: Core and Builtins<109>-Footnote-204895412
Ref: Core and Builtins<109>-Footnote-214895478
Ref: Core and Builtins<109>-Footnote-224895544
Ref: Core and Builtins<109>-Footnote-234895610
Ref: Core and Builtins<109>-Footnote-244895676
Ref: Core and Builtins<109>-Footnote-254895742
Ref: Core and Builtins<109>-Footnote-264895808
Ref: Core and Builtins<109>-Footnote-274895874
Ref: Core and Builtins<109>-Footnote-284895940
Ref: Core and Builtins<109>-Footnote-294896006
Ref: Core and Builtins<109>-Footnote-304896072
Ref: Core and Builtins<109>-Footnote-314896138
Ref: Core and Builtins<109>-Footnote-324896204
Node: ライブラリ<112>4896270
Ref: whatsnew/changelog id4914896410
Ref: 1c404896410
Ref: ライブラリ<112>-Footnote-14896688
Node: Core and Builtins<110>4896753
Ref: whatsnew/changelog id4924896891
Ref: 1c414896891
Ref: Core and Builtins<110>-Footnote-14898733
Ref: Core and Builtins<110>-Footnote-24898798
Ref: Core and Builtins<110>-Footnote-34898863
Ref: Core and Builtins<110>-Footnote-44898928
Ref: Core and Builtins<110>-Footnote-54898993
Ref: Core and Builtins<110>-Footnote-64899058
Ref: Core and Builtins<110>-Footnote-74899123
Ref: Core and Builtins<110>-Footnote-84899188
Ref: Core and Builtins<110>-Footnote-94899253
Node: ライブラリ<113>4899318
Ref: whatsnew/changelog id4934899458
Ref: 1c424899458
Ref: ライブラリ<113>-Footnote-14899795
Node: Core and Builtins<111>4899860
Ref: whatsnew/changelog id4944899998
Ref: 1c434899998
Ref: Core and Builtins<111>-Footnote-14900531
Ref: Core and Builtins<111>-Footnote-24900596
Ref: Core and Builtins<111>-Footnote-34900638
Node: ライブラリ<114>4900703
Ref: whatsnew/changelog id4954900843
Ref: 1c444900843
Ref: ライブラリ<114>-Footnote-14901164
Node: Core and Builtins<112>4901229
Ref: whatsnew/changelog id4964901367
Ref: 1c454901367
Ref: Core and Builtins<112>-Footnote-14905127
Ref: Core and Builtins<112>-Footnote-24905192
Ref: Core and Builtins<112>-Footnote-34905234
Ref: Core and Builtins<112>-Footnote-44905299
Ref: Core and Builtins<112>-Footnote-54905364
Ref: Core and Builtins<112>-Footnote-64905429
Ref: Core and Builtins<112>-Footnote-74905494
Ref: Core and Builtins<112>-Footnote-84905559
Ref: Core and Builtins<112>-Footnote-94905624
Ref: Core and Builtins<112>-Footnote-104905689
Ref: Core and Builtins<112>-Footnote-114905755
Ref: Core and Builtins<112>-Footnote-124905821
Ref: Core and Builtins<112>-Footnote-134905887
Ref: Core and Builtins<112>-Footnote-144905953
Ref: Core and Builtins<112>-Footnote-154906019
Ref: Core and Builtins<112>-Footnote-164906085
Ref: Core and Builtins<112>-Footnote-174906151
Ref: Core and Builtins<112>-Footnote-184906217
Ref: Core and Builtins<112>-Footnote-194906283
Ref: Core and Builtins<112>-Footnote-204906349
Ref: Core and Builtins<112>-Footnote-214906415
Ref: Core and Builtins<112>-Footnote-224906481
Node: ライブラリ<115>4906547
Ref: whatsnew/changelog id4974906687
Ref: 1c464906687
Ref: ライブラリ<115>-Footnote-14906952
Node: Core and Builtins<113>4907017
Ref: whatsnew/changelog id4984907155
Ref: 1c474907155
Ref: Core and Builtins<113>-Footnote-14912808
Ref: Core and Builtins<113>-Footnote-24912873
Ref: Core and Builtins<113>-Footnote-34912938
Ref: Core and Builtins<113>-Footnote-44913003
Ref: Core and Builtins<113>-Footnote-54913068
Ref: Core and Builtins<113>-Footnote-64913133
Ref: Core and Builtins<113>-Footnote-74913198
Ref: Core and Builtins<113>-Footnote-84913263
Ref: Core and Builtins<113>-Footnote-94913328
Ref: Core and Builtins<113>-Footnote-104913393
Ref: Core and Builtins<113>-Footnote-114913459
Ref: Core and Builtins<113>-Footnote-124913525
Ref: Core and Builtins<113>-Footnote-134913591
Ref: Core and Builtins<113>-Footnote-144913657
Ref: Core and Builtins<113>-Footnote-154913723
Ref: Core and Builtins<113>-Footnote-164913789
Ref: Core and Builtins<113>-Footnote-174913855
Ref: Core and Builtins<113>-Footnote-184913921
Ref: Core and Builtins<113>-Footnote-194913987
Ref: Core and Builtins<113>-Footnote-204914053
Ref: Core and Builtins<113>-Footnote-214914119
Ref: Core and Builtins<113>-Footnote-224914185
Ref: Core and Builtins<113>-Footnote-234914251
Ref: Core and Builtins<113>-Footnote-244914317
Ref: Core and Builtins<113>-Footnote-254914383
Ref: Core and Builtins<113>-Footnote-264914449
Ref: Core and Builtins<113>-Footnote-274914515
Ref: Core and Builtins<113>-Footnote-284914581
Ref: Core and Builtins<113>-Footnote-294914647
Ref: Core and Builtins<113>-Footnote-304914713
Node: ライブラリ<116>4914779
Ref: whatsnew/changelog id4994914919
Ref: 1c484914919
Ref: ライブラリ<116>-Footnote-14954693
Ref: ライブラリ<116>-Footnote-24954758
Ref: ライブラリ<116>-Footnote-34954823
Ref: ライブラリ<116>-Footnote-44954888
Ref: ライブラリ<116>-Footnote-54954955
Ref: ライブラリ<116>-Footnote-64955020
Ref: ライブラリ<116>-Footnote-74955085
Ref: ライブラリ<116>-Footnote-84955150
Ref: ライブラリ<116>-Footnote-94955215
Ref: ライブラリ<116>-Footnote-104955280
Ref: ライブラリ<116>-Footnote-114955346
Ref: ライブラリ<116>-Footnote-124955412
Ref: ライブラリ<116>-Footnote-134955478
Ref: ライブラリ<116>-Footnote-144955544
Ref: ライブラリ<116>-Footnote-154955610
Ref: ライブラリ<116>-Footnote-164955676
Ref: ライブラリ<116>-Footnote-174955742
Ref: ライブラリ<116>-Footnote-184955808
Ref: ライブラリ<116>-Footnote-194955874
Ref: ライブラリ<116>-Footnote-204955940
Ref: ライブラリ<116>-Footnote-214956006
Ref: ライブラリ<116>-Footnote-224956072
Ref: ライブラリ<116>-Footnote-234956138
Ref: ライブラリ<116>-Footnote-244956204
Ref: ライブラリ<116>-Footnote-254956270
Ref: ライブラリ<116>-Footnote-264956336
Ref: ライブラリ<116>-Footnote-274956402
Ref: ライブラリ<116>-Footnote-284956468
Ref: ライブラリ<116>-Footnote-294956534
Ref: ライブラリ<116>-Footnote-304956600
Ref: ライブラリ<116>-Footnote-314956666
Ref: ライブラリ<116>-Footnote-324956732
Ref: ライブラリ<116>-Footnote-334956798
Ref: ライブラリ<116>-Footnote-344956864
Ref: ライブラリ<116>-Footnote-354956930
Ref: ライブラリ<116>-Footnote-364956973
Ref: ライブラリ<116>-Footnote-374957039
Ref: ライブラリ<116>-Footnote-384957105
Ref: ライブラリ<116>-Footnote-394957171
Ref: ライブラリ<116>-Footnote-404957237
Ref: ライブラリ<116>-Footnote-414957303
Ref: ライブラリ<116>-Footnote-424957369
Ref: ライブラリ<116>-Footnote-434957435
Ref: ライブラリ<116>-Footnote-444957501
Ref: ライブラリ<116>-Footnote-454957567
Ref: ライブラリ<116>-Footnote-464957633
Ref: ライブラリ<116>-Footnote-474957699
Ref: ライブラリ<116>-Footnote-484957765
Ref: ライブラリ<116>-Footnote-494957831
Ref: ライブラリ<116>-Footnote-504957897
Ref: ライブラリ<116>-Footnote-514957963
Ref: ライブラリ<116>-Footnote-524958029
Ref: ライブラリ<116>-Footnote-534958095
Ref: ライブラリ<116>-Footnote-544958161
Ref: ライブラリ<116>-Footnote-554958227
Ref: ライブラリ<116>-Footnote-564958293
Ref: ライブラリ<116>-Footnote-574958359
Ref: ライブラリ<116>-Footnote-584958425
Ref: ライブラリ<116>-Footnote-594958491
Ref: ライブラリ<116>-Footnote-604958557
Ref: ライブラリ<116>-Footnote-614958623
Ref: ライブラリ<116>-Footnote-624958689
Ref: ライブラリ<116>-Footnote-634958755
Ref: ライブラリ<116>-Footnote-644958821
Ref: ライブラリ<116>-Footnote-654958887
Ref: ライブラリ<116>-Footnote-664958953
Ref: ライブラリ<116>-Footnote-674959019
Ref: ライブラリ<116>-Footnote-684959085
Ref: ライブラリ<116>-Footnote-694959151
Ref: ライブラリ<116>-Footnote-704959217
Ref: ライブラリ<116>-Footnote-714959283
Ref: ライブラリ<116>-Footnote-724959349
Ref: ライブラリ<116>-Footnote-734959415
Ref: ライブラリ<116>-Footnote-744959481
Ref: ライブラリ<116>-Footnote-754959547
Ref: ライブラリ<116>-Footnote-764959613
Ref: ライブラリ<116>-Footnote-774959679
Ref: ライブラリ<116>-Footnote-784959745
Ref: ライブラリ<116>-Footnote-794959811
Ref: ライブラリ<116>-Footnote-804959877
Ref: ライブラリ<116>-Footnote-814959943
Ref: ライブラリ<116>-Footnote-824960009
Ref: ライブラリ<116>-Footnote-834960075
Ref: ライブラリ<116>-Footnote-844960141
Ref: ライブラリ<116>-Footnote-854960207
Ref: ライブラリ<116>-Footnote-864960273
Ref: ライブラリ<116>-Footnote-874960339
Ref: ライブラリ<116>-Footnote-884960405
Ref: ライブラリ<116>-Footnote-894960471
Ref: ライブラリ<116>-Footnote-904960537
Ref: ライブラリ<116>-Footnote-914960603
Ref: ライブラリ<116>-Footnote-924960669
Ref: ライブラリ<116>-Footnote-934960735
Ref: ライブラリ<116>-Footnote-944960801
Ref: ライブラリ<116>-Footnote-954960867
Ref: ライブラリ<116>-Footnote-964960933
Ref: ライブラリ<116>-Footnote-974960999
Ref: ライブラリ<116>-Footnote-984961065
Ref: ライブラリ<116>-Footnote-994961131
Ref: ライブラリ<116>-Footnote-1004961197
Ref: ライブラリ<116>-Footnote-1014961264
Ref: ライブラリ<116>-Footnote-1024961331
Ref: ライブラリ<116>-Footnote-1034961398
Ref: ライブラリ<116>-Footnote-1044961465
Ref: ライブラリ<116>-Footnote-1054961532
Ref: ライブラリ<116>-Footnote-1064961599
Ref: ライブラリ<116>-Footnote-1074961666
Ref: ライブラリ<116>-Footnote-1084961733
Ref: ライブラリ<116>-Footnote-1094961800
Ref: ライブラリ<116>-Footnote-1104961867
Ref: ライブラリ<116>-Footnote-1114961934
Ref: ライブラリ<116>-Footnote-1124962001
Ref: ライブラリ<116>-Footnote-1134962068
Ref: ライブラリ<116>-Footnote-1144962135
Ref: ライブラリ<116>-Footnote-1154962202
Ref: ライブラリ<116>-Footnote-1164962269
Ref: ライブラリ<116>-Footnote-1174962336
Ref: ライブラリ<116>-Footnote-1184962403
Ref: ライブラリ<116>-Footnote-1194962470
Ref: ライブラリ<116>-Footnote-1204962537
Ref: ライブラリ<116>-Footnote-1214962604
Ref: ライブラリ<116>-Footnote-1224962671
Ref: ライブラリ<116>-Footnote-1234962738
Ref: ライブラリ<116>-Footnote-1244962805
Ref: ライブラリ<116>-Footnote-1254962872
Ref: ライブラリ<116>-Footnote-1264962939
Ref: ライブラリ<116>-Footnote-1274963006
Ref: ライブラリ<116>-Footnote-1284963073
Ref: ライブラリ<116>-Footnote-1294963140
Ref: ライブラリ<116>-Footnote-1304963207
Ref: ライブラリ<116>-Footnote-1314963274
Ref: ライブラリ<116>-Footnote-1324963341
Ref: ライブラリ<116>-Footnote-1334963408
Ref: ライブラリ<116>-Footnote-1344963475
Ref: ライブラリ<116>-Footnote-1354963542
Ref: ライブラリ<116>-Footnote-1364963609
Ref: ライブラリ<116>-Footnote-1374963676
Ref: ライブラリ<116>-Footnote-1384963743
Ref: ライブラリ<116>-Footnote-1394963810
Ref: ライブラリ<116>-Footnote-1404963877
Ref: ライブラリ<116>-Footnote-1414963944
Ref: ライブラリ<116>-Footnote-1424964011
Ref: ライブラリ<116>-Footnote-1434964078
Ref: ライブラリ<116>-Footnote-1444964145
Ref: ライブラリ<116>-Footnote-1454964212
Ref: ライブラリ<116>-Footnote-1464964279
Ref: ライブラリ<116>-Footnote-1474964346
Ref: ライブラリ<116>-Footnote-1484964412
Ref: ライブラリ<116>-Footnote-1494964479
Ref: ライブラリ<116>-Footnote-1504964546
Ref: ライブラリ<116>-Footnote-1514964607
Ref: ライブラリ<116>-Footnote-1524964674
Ref: ライブラリ<116>-Footnote-1534964741
Ref: ライブラリ<116>-Footnote-1544964808
Ref: ライブラリ<116>-Footnote-1554964875
Ref: ライブラリ<116>-Footnote-1564964942
Ref: ライブラリ<116>-Footnote-1574965009
Ref: ライブラリ<116>-Footnote-1584965076
Ref: ライブラリ<116>-Footnote-1594965143
Ref: ライブラリ<116>-Footnote-1604965187
Ref: ライブラリ<116>-Footnote-1614965254
Ref: ライブラリ<116>-Footnote-1624965321
Ref: ライブラリ<116>-Footnote-1634965388
Ref: ライブラリ<116>-Footnote-1644965455
Ref: ライブラリ<116>-Footnote-1654965522
Ref: ライブラリ<116>-Footnote-1664965589
Ref: ライブラリ<116>-Footnote-1674965656
Ref: ライブラリ<116>-Footnote-1684965723
Ref: ライブラリ<116>-Footnote-1694965790
Ref: ライブラリ<116>-Footnote-1704965857
Ref: ライブラリ<116>-Footnote-1714965924
Ref: ライブラリ<116>-Footnote-1724965991
Ref: ライブラリ<116>-Footnote-1734966058
Ref: ライブラリ<116>-Footnote-1744966125
Ref: ライブラリ<116>-Footnote-1754966192
Ref: ライブラリ<116>-Footnote-1764966259
Ref: ライブラリ<116>-Footnote-1774966326
Ref: ライブラリ<116>-Footnote-1784966393
Ref: ライブラリ<116>-Footnote-1794966460
Ref: ライブラリ<116>-Footnote-1804966527
Ref: ライブラリ<116>-Footnote-1814966594
Ref: ライブラリ<116>-Footnote-1824966661
Ref: ライブラリ<116>-Footnote-1834966728
Ref: ライブラリ<116>-Footnote-1844966795
Ref: ライブラリ<116>-Footnote-1854966862
Ref: ライブラリ<116>-Footnote-1864966929
Ref: ライブラリ<116>-Footnote-1874966996
Ref: ライブラリ<116>-Footnote-1884967063
Ref: ライブラリ<116>-Footnote-1894967130
Ref: ライブラリ<116>-Footnote-1904967197
Ref: ライブラリ<116>-Footnote-1914967264
Ref: ライブラリ<116>-Footnote-1924967331
Ref: ライブラリ<116>-Footnote-1934967398
Ref: ライブラリ<116>-Footnote-1944967465
Ref: ライブラリ<116>-Footnote-1954967532
Ref: ライブラリ<116>-Footnote-1964967598
Ref: ライブラリ<116>-Footnote-1974967665
Ref: ライブラリ<116>-Footnote-1984967732
Ref: ライブラリ<116>-Footnote-1994967799
Ref: ライブラリ<116>-Footnote-2004967866
Ref: ライブラリ<116>-Footnote-2014967933
Ref: ライブラリ<116>-Footnote-2024968000
Ref: ライブラリ<116>-Footnote-2034968067
Ref: ライブラリ<116>-Footnote-2044968134
Ref: ライブラリ<116>-Footnote-2054968201
Ref: ライブラリ<116>-Footnote-2064968268
Ref: ライブラリ<116>-Footnote-2074968335
Ref: ライブラリ<116>-Footnote-2084968402
Ref: ライブラリ<116>-Footnote-2094968469
Node: ドキュメント<36>4968536
Ref: whatsnew/changelog id5004968667
Ref: 1c5f4968667
Ref: ドキュメント<36>-Footnote-14974959
Ref: ドキュメント<36>-Footnote-24975024
Ref: ドキュメント<36>-Footnote-34975089
Ref: ドキュメント<36>-Footnote-44975154
Ref: ドキュメント<36>-Footnote-54975219
Ref: ドキュメント<36>-Footnote-64975284
Ref: ドキュメント<36>-Footnote-74975336
Ref: ドキュメント<36>-Footnote-84975401
Ref: ドキュメント<36>-Footnote-94975466
Ref: ドキュメント<36>-Footnote-104975525
Ref: ドキュメント<36>-Footnote-114975591
Ref: ドキュメント<36>-Footnote-124975657
Ref: ドキュメント<36>-Footnote-134975723
Ref: ドキュメント<36>-Footnote-144975789
Ref: ドキュメント<36>-Footnote-154975855
Ref: ドキュメント<36>-Footnote-164975921
Ref: ドキュメント<36>-Footnote-174975987
Ref: ドキュメント<36>-Footnote-184976053
Ref: ドキュメント<36>-Footnote-194976119
Ref: ドキュメント<36>-Footnote-204976185
Ref: ドキュメント<36>-Footnote-214976251
Ref: ドキュメント<36>-Footnote-224976317
Ref: ドキュメント<36>-Footnote-234976383
Ref: ドキュメント<36>-Footnote-244976449
Ref: ドキュメント<36>-Footnote-254976515
Ref: ドキュメント<36>-Footnote-264976581
Ref: ドキュメント<36>-Footnote-274976647
Ref: ドキュメント<36>-Footnote-284976713
Ref: ドキュメント<36>-Footnote-294976779
Ref: ドキュメント<36>-Footnote-304976845
Ref: ドキュメント<36>-Footnote-314976911
Ref: ドキュメント<36>-Footnote-324976977
Ref: ドキュメント<36>-Footnote-334977043
Ref: ドキュメント<36>-Footnote-344977109
Ref: ドキュメント<36>-Footnote-354977175
Ref: ドキュメント<36>-Footnote-364977241
Ref: ドキュメント<36>-Footnote-374977307
Ref: ドキュメント<36>-Footnote-384977373
Ref: ドキュメント<36>-Footnote-394977439
Ref: ドキュメント<36>-Footnote-404977505
Ref: ドキュメント<36>-Footnote-414977571
Ref: ドキュメント<36>-Footnote-424977637
Node: テスト<35>4977703
Ref: whatsnew/changelog id5014977827
Ref: 1c614977827
Ref: テスト<35>-Footnote-14983680
Ref: テスト<35>-Footnote-24983745
Ref: テスト<35>-Footnote-34983810
Ref: テスト<35>-Footnote-44983875
Ref: テスト<35>-Footnote-54983940
Ref: テスト<35>-Footnote-64984005
Ref: テスト<35>-Footnote-74984070
Ref: テスト<35>-Footnote-84984135
Ref: テスト<35>-Footnote-94984200
Ref: テスト<35>-Footnote-104984265
Ref: テスト<35>-Footnote-114984331
Ref: テスト<35>-Footnote-124984397
Ref: テスト<35>-Footnote-134984463
Ref: テスト<35>-Footnote-144984529
Ref: テスト<35>-Footnote-154984595
Ref: テスト<35>-Footnote-164984661
Ref: テスト<35>-Footnote-174984727
Ref: テスト<35>-Footnote-184984793
Ref: テスト<35>-Footnote-194984859
Ref: テスト<35>-Footnote-204984925
Ref: テスト<35>-Footnote-214984991
Ref: テスト<35>-Footnote-224985057
Ref: テスト<35>-Footnote-234985123
Ref: テスト<35>-Footnote-244985189
Ref: テスト<35>-Footnote-254985255
Ref: テスト<35>-Footnote-264985321
Ref: テスト<35>-Footnote-274985387
Ref: テスト<35>-Footnote-284985453
Ref: テスト<35>-Footnote-294985519
Ref: テスト<35>-Footnote-304985585
Ref: テスト<35>-Footnote-314985651
Ref: テスト<35>-Footnote-324985717
Ref: テスト<35>-Footnote-334985783
Ref: テスト<35>-Footnote-344985849
Ref: テスト<35>-Footnote-354985915
Node: ビルド<42>4985981
Ref: whatsnew/changelog id5024986094
Ref: 1c644986094
Ref: ビルド<42>-Footnote-14988172
Ref: ビルド<42>-Footnote-24988237
Ref: ビルド<42>-Footnote-34988302
Ref: ビルド<42>-Footnote-44988367
Ref: ビルド<42>-Footnote-54988432
Ref: ビルド<42>-Footnote-64988497
Ref: ビルド<42>-Footnote-74988562
Ref: ビルド<42>-Footnote-84988627
Ref: ビルド<42>-Footnote-94988692
Ref: ビルド<42>-Footnote-104988757
Ref: ビルド<42>-Footnote-114988823
Node: Windows<37>4988889
Ref: whatsnew/changelog id5034988998
Ref: 1c654988998
Ref: Windows<37>-Footnote-14990108
Ref: Windows<37>-Footnote-24990173
Ref: Windows<37>-Footnote-34990238
Ref: Windows<37>-Footnote-44990303
Ref: Windows<37>-Footnote-54990368
Ref: Windows<37>-Footnote-64990433
Ref: Windows<37>-Footnote-74990498
Ref: Windows<37>-Footnote-84990563
Ref: Windows<37>-Footnote-94990628
Node: macOS<27>4990693
Ref: whatsnew/changelog id5044990797
Ref: 1c674990797
Ref: macOS<27>-Footnote-14991944
Ref: macOS<27>-Footnote-24992009
Ref: macOS<27>-Footnote-34992074
Ref: macOS<27>-Footnote-44992139
Ref: macOS<27>-Footnote-54992204
Ref: macOS<27>-Footnote-64992269
Ref: macOS<27>-Footnote-74992334
Node: IDLE<19>4992399
Ref: whatsnew/changelog id5054992507
Ref: 1c684992507
Ref: IDLE<19>-Footnote-14994034
Ref: IDLE<19>-Footnote-24994099
Ref: IDLE<19>-Footnote-34994164
Ref: IDLE<19>-Footnote-44994229
Ref: IDLE<19>-Footnote-54994294
Ref: IDLE<19>-Footnote-64994359
Ref: IDLE<19>-Footnote-74994424
Ref: IDLE<19>-Footnote-84994489
Ref: IDLE<19>-Footnote-94994554
Node: Tools/Demos<27>4994619
Ref: whatsnew/changelog id5064994727
Ref: 1c694994727
Ref: Tools/Demos<27>-Footnote-14995523
Ref: Tools/Demos<27>-Footnote-24995588
Ref: Tools/Demos<27>-Footnote-34995653
Ref: Tools/Demos<27>-Footnote-44995718
Ref: Tools/Demos<27>-Footnote-54995783
Ref: Tools/Demos<27>-Footnote-64995848
Node: C API<37>4995913
Ref: whatsnew/changelog id5074996004
Ref: 1c6a4996004
Ref: C API<37>-Footnote-15001850
Ref: C API<37>-Footnote-25001915
Ref: C API<37>-Footnote-35001980
Ref: C API<37>-Footnote-45002045
Ref: C API<37>-Footnote-55002110
Ref: C API<37>-Footnote-65002175
Ref: C API<37>-Footnote-75002240
Ref: C API<37>-Footnote-85002305
Ref: C API<37>-Footnote-95002370
Ref: C API<37>-Footnote-105002435
Ref: C API<37>-Footnote-115002501
Ref: C API<37>-Footnote-125002567
Ref: C API<37>-Footnote-135002633
Ref: C API<37>-Footnote-145002699
Ref: C API<37>-Footnote-155002765
Ref: C API<37>-Footnote-165002831
Ref: C API<37>-Footnote-175002897
Ref: C API<37>-Footnote-185002963
Ref: C API<37>-Footnote-195003029
Ref: C API<37>-Footnote-205003095
Ref: C API<37>-Footnote-215003138
Ref: C API<37>-Footnote-225003204
Ref: C API<37>-Footnote-235003270
Ref: C API<37>-Footnote-245003336
Ref: C API<37>-Footnote-255003379
Ref: C API<37>-Footnote-265003422
Node: Python 3 10 0 beta 15003488
Ref: whatsnew/changelog python-3-10-0-beta-15003617
Ref: 1c6c5003617
Node: セキュリティ<30>5004205
Ref: whatsnew/changelog id5085004315
Ref: 1c6d5004315
Ref: セキュリティ<30>-Footnote-15007263
Ref: セキュリティ<30>-Footnote-25007328
Ref: セキュリティ<30>-Footnote-35007393
Ref: セキュリティ<30>-Footnote-45007458
Ref: セキュリティ<30>-Footnote-55007523
Ref: セキュリティ<30>-Footnote-65007588
Ref: セキュリティ<30>-Footnote-75007653
Ref: セキュリティ<30>-Footnote-85007718
Ref: セキュリティ<30>-Footnote-95007783
Ref: セキュリティ<30>-Footnote-105007848
Ref: セキュリティ<30>-Footnote-115007914
Node: Core and Builtins<114>5007980
Ref: whatsnew/changelog id5095008119
Ref: 1c705008119
Ref: Core and Builtins<114>-Footnote-15009473
Ref: Core and Builtins<114>-Footnote-25009538
Ref: Core and Builtins<114>-Footnote-35009603
Ref: Core and Builtins<114>-Footnote-45009668
Ref: Core and Builtins<114>-Footnote-55009733
Ref: Core and Builtins<114>-Footnote-65009798
Ref: Core and Builtins<114>-Footnote-75009863
Node: ライブラリ<117>5009928
Ref: whatsnew/changelog id5105010067
Ref: 1c725010067
Ref: ライブラリ<117>-Footnote-15010343
Ref: ライブラリ<117>-Footnote-25010408
Node: Core and Builtins<115>5010473
Ref: whatsnew/changelog id5115010610
Ref: 1c735010610
Ref: Core and Builtins<115>-Footnote-15014627
Ref: Core and Builtins<115>-Footnote-25014692
Ref: Core and Builtins<115>-Footnote-35014757
Ref: Core and Builtins<115>-Footnote-45014822
Ref: Core and Builtins<115>-Footnote-55014887
Ref: Core and Builtins<115>-Footnote-65014929
Ref: Core and Builtins<115>-Footnote-75014994
Ref: Core and Builtins<115>-Footnote-85015059
Ref: Core and Builtins<115>-Footnote-95015124
Ref: Core and Builtins<115>-Footnote-105015189
Ref: Core and Builtins<115>-Footnote-115015255
Ref: Core and Builtins<115>-Footnote-125015321
Ref: Core and Builtins<115>-Footnote-135015387
Ref: Core and Builtins<115>-Footnote-145015453
Ref: Core and Builtins<115>-Footnote-155015519
Ref: Core and Builtins<115>-Footnote-165015585
Ref: Core and Builtins<115>-Footnote-175015651
Ref: Core and Builtins<115>-Footnote-185015717
Ref: Core and Builtins<115>-Footnote-195015783
Ref: Core and Builtins<115>-Footnote-205015849
Ref: Core and Builtins<115>-Footnote-215015915
Ref: Core and Builtins<115>-Footnote-225015981
Node: ライブラリ<118>5016047
Ref: whatsnew/changelog id5125016186
Ref: 1c765016186
Ref: ライブラリ<118>-Footnote-15016388
Node: Core and Builtins<116>5016453
Ref: whatsnew/changelog id5135016590
Ref: 1c775016590
Ref: Core and Builtins<116>-Footnote-15017242
Ref: Core and Builtins<116>-Footnote-25017307
Ref: Core and Builtins<116>-Footnote-35017372
Node: ライブラリ<119>5017437
Ref: whatsnew/changelog id5145017576
Ref: 1c785017576
Ref: ライブラリ<119>-Footnote-15034369
Ref: ライブラリ<119>-Footnote-25034434
Ref: ライブラリ<119>-Footnote-35034499
Ref: ライブラリ<119>-Footnote-45034564
Ref: ライブラリ<119>-Footnote-55034629
Ref: ライブラリ<119>-Footnote-65034694
Ref: ライブラリ<119>-Footnote-75034759
Ref: ライブラリ<119>-Footnote-85034824
Ref: ライブラリ<119>-Footnote-95034889
Ref: ライブラリ<119>-Footnote-105034954
Ref: ライブラリ<119>-Footnote-115035020
Ref: ライブラリ<119>-Footnote-125035086
Ref: ライブラリ<119>-Footnote-135035152
Ref: ライブラリ<119>-Footnote-145035218
Ref: ライブラリ<119>-Footnote-155035284
Ref: ライブラリ<119>-Footnote-165035350
Ref: ライブラリ<119>-Footnote-175035416
Ref: ライブラリ<119>-Footnote-185035482
Ref: ライブラリ<119>-Footnote-195035548
Ref: ライブラリ<119>-Footnote-205035614
Ref: ライブラリ<119>-Footnote-215035680
Ref: ライブラリ<119>-Footnote-225035746
Ref: ライブラリ<119>-Footnote-235035789
Ref: ライブラリ<119>-Footnote-245035855
Ref: ライブラリ<119>-Footnote-255035921
Ref: ライブラリ<119>-Footnote-265035987
Ref: ライブラリ<119>-Footnote-275036053
Ref: ライブラリ<119>-Footnote-285036119
Ref: ライブラリ<119>-Footnote-295036185
Ref: ライブラリ<119>-Footnote-305036251
Ref: ライブラリ<119>-Footnote-315036317
Ref: ライブラリ<119>-Footnote-325036383
Ref: ライブラリ<119>-Footnote-335036449
Ref: ライブラリ<119>-Footnote-345036515
Ref: ライブラリ<119>-Footnote-355036581
Ref: ライブラリ<119>-Footnote-365036647
Ref: ライブラリ<119>-Footnote-375036713
Ref: ライブラリ<119>-Footnote-385036779
Ref: ライブラリ<119>-Footnote-395036845
Ref: ライブラリ<119>-Footnote-405036911
Ref: ライブラリ<119>-Footnote-415036977
Ref: ライブラリ<119>-Footnote-425037043
Ref: ライブラリ<119>-Footnote-435037086
Ref: ライブラリ<119>-Footnote-445037152
Ref: ライブラリ<119>-Footnote-455037218
Ref: ライブラリ<119>-Footnote-465037274
Ref: ライブラリ<119>-Footnote-475037340
Ref: ライブラリ<119>-Footnote-485037406
Ref: ライブラリ<119>-Footnote-495037472
Ref: ライブラリ<119>-Footnote-505037538
Ref: ライブラリ<119>-Footnote-515037604
Ref: ライブラリ<119>-Footnote-525037670
Ref: ライブラリ<119>-Footnote-535037736
Ref: ライブラリ<119>-Footnote-545037801
Ref: ライブラリ<119>-Footnote-555037867
Ref: ライブラリ<119>-Footnote-565037933
Ref: ライブラリ<119>-Footnote-575037999
Ref: ライブラリ<119>-Footnote-585038064
Ref: ライブラリ<119>-Footnote-595038130
Ref: ライブラリ<119>-Footnote-605038196
Ref: ライブラリ<119>-Footnote-615038262
Ref: ライブラリ<119>-Footnote-625038328
Ref: ライブラリ<119>-Footnote-635038394
Ref: ライブラリ<119>-Footnote-645038460
Ref: ライブラリ<119>-Footnote-655038526
Ref: ライブラリ<119>-Footnote-665038592
Ref: ライブラリ<119>-Footnote-675038658
Ref: ライブラリ<119>-Footnote-685038724
Ref: ライブラリ<119>-Footnote-695038767
Ref: ライブラリ<119>-Footnote-705038833
Ref: ライブラリ<119>-Footnote-715038899
Ref: ライブラリ<119>-Footnote-725038965
Ref: ライブラリ<119>-Footnote-735039031
Ref: ライブラリ<119>-Footnote-745039097
Ref: ライブラリ<119>-Footnote-755039163
Ref: ライブラリ<119>-Footnote-765039229
Ref: ライブラリ<119>-Footnote-775039295
Ref: ライブラリ<119>-Footnote-785039361
Ref: ライブラリ<119>-Footnote-795039427
Ref: ライブラリ<119>-Footnote-805039493
Ref: ライブラリ<119>-Footnote-815039559
Ref: ライブラリ<119>-Footnote-825039625
Ref: ライブラリ<119>-Footnote-835039691
Node: ドキュメント<37>5039757
Ref: whatsnew/changelog id5155039887
Ref: 1c7f5039887
Ref: ドキュメント<37>-Footnote-15040899
Ref: ドキュメント<37>-Footnote-25040964
Ref: ドキュメント<37>-Footnote-35041029
Ref: ドキュメント<37>-Footnote-45041094
Ref: ドキュメント<37>-Footnote-55041159
Ref: ドキュメント<37>-Footnote-65041224
Ref: ドキュメント<37>-Footnote-75041289
Node: テスト<36>5041354
Ref: whatsnew/changelog id5165041477
Ref: 1c805041477
Ref: テスト<36>-Footnote-15042559
Ref: テスト<36>-Footnote-25042624
Ref: テスト<36>-Footnote-35042689
Ref: テスト<36>-Footnote-45042754
Ref: テスト<36>-Footnote-55042819
Node: ビルド<43>5042884
Ref: whatsnew/changelog id5175042996
Ref: 1c815042996
Ref: ビルド<43>-Footnote-15043263
Ref: ビルド<43>-Footnote-25043328
Ref: ビルド<43>-Footnote-35043393
Node: Windows<38>5043435
Ref: whatsnew/changelog id5185043543
Ref: 1c825043543
Ref: Windows<38>-Footnote-15044886
Ref: Windows<38>-Footnote-25044951
Ref: Windows<38>-Footnote-35045016
Ref: Windows<38>-Footnote-45045081
Ref: Windows<38>-Footnote-55045146
Ref: Windows<38>-Footnote-65045211
Ref: Windows<38>-Footnote-75045276
Ref: Windows<38>-Footnote-85045341
Ref: Windows<38>-Footnote-95045406
Node: macOS<28>5045471
Ref: whatsnew/changelog id5195045574
Ref: 1c865045574
Ref: macOS<28>-Footnote-15046874
Ref: macOS<28>-Footnote-25046939
Ref: macOS<28>-Footnote-35047004
Ref: macOS<28>-Footnote-45047069
Ref: macOS<28>-Footnote-55047134
Ref: macOS<28>-Footnote-65047199
Node: IDLE<20>5047264
Ref: whatsnew/changelog id5205047365
Ref: 1c875047365
Ref: IDLE<20>-Footnote-15048161
Ref: IDLE<20>-Footnote-25048226
Ref: IDLE<20>-Footnote-35048291
Ref: IDLE<20>-Footnote-45048356
Ref: IDLE<20>-Footnote-55048421
Node: C API<38>5048486
Ref: whatsnew/changelog id5215048569
Ref: 1c885048569
Ref: C API<38>-Footnote-15050818
Ref: C API<38>-Footnote-25050883
Ref: C API<38>-Footnote-35050948
Ref: C API<38>-Footnote-45051013
Ref: C API<38>-Footnote-55051078
Ref: C API<38>-Footnote-65051143
Ref: C API<38>-Footnote-75051208
Ref: C API<38>-Footnote-85051273
Ref: C API<38>-Footnote-95051338
Ref: C API<38>-Footnote-105051380
Node: Python 3 10 0 alpha 75051446
Ref: whatsnew/changelog python-3-10-0-alpha-75051575
Ref: 1c895051575
Node: セキュリティ<31>5052056
Ref: whatsnew/changelog id5225052167
Ref: 1c8a5052167
Ref: セキュリティ<31>-Footnote-15053265
Ref: セキュリティ<31>-Footnote-25053330
Ref: セキュリティ<31>-Footnote-35053385
Ref: セキュリティ<31>-Footnote-45053450
Node: Core and Builtins<117>5053515
Ref: whatsnew/changelog id5235053655
Ref: 1c8b5053655
Ref: Core and Builtins<117>-Footnote-15054275
Ref: Core and Builtins<117>-Footnote-25054340
Ref: Core and Builtins<117>-Footnote-35054405
Ref: Core and Builtins<117>-Footnote-45054470
Node: ライブラリ<120>5054535
Ref: whatsnew/changelog id5245054675
Ref: 1c8c5054675
Ref: ライブラリ<120>-Footnote-15054864
Node: Core and Builtins<118>5054929
Ref: whatsnew/changelog id5255055067
Ref: 1c8d5055067
Ref: Core and Builtins<118>-Footnote-15058946
Ref: Core and Builtins<118>-Footnote-25059011
Ref: Core and Builtins<118>-Footnote-35059076
Ref: Core and Builtins<118>-Footnote-45059141
Ref: Core and Builtins<118>-Footnote-55059183
Ref: Core and Builtins<118>-Footnote-65059248
Ref: Core and Builtins<118>-Footnote-75059313
Ref: Core and Builtins<118>-Footnote-85059378
Ref: Core and Builtins<118>-Footnote-95059443
Ref: Core and Builtins<118>-Footnote-105059508
Ref: Core and Builtins<118>-Footnote-115059574
Ref: Core and Builtins<118>-Footnote-125059640
Ref: Core and Builtins<118>-Footnote-135059706
Ref: Core and Builtins<118>-Footnote-145059772
Ref: Core and Builtins<118>-Footnote-155059838
Ref: Core and Builtins<118>-Footnote-165059904
Ref: Core and Builtins<118>-Footnote-175059970
Ref: Core and Builtins<118>-Footnote-185060013
Ref: Core and Builtins<118>-Footnote-195060079
Node: ライブラリ<121>5060145
Ref: whatsnew/changelog id5265060285
Ref: 1c8e5060285
Ref: ライブラリ<121>-Footnote-15067965
Ref: ライブラリ<121>-Footnote-25068030
Ref: ライブラリ<121>-Footnote-35068095
Ref: ライブラリ<121>-Footnote-45068160
Ref: ライブラリ<121>-Footnote-55068225
Ref: ライブラリ<121>-Footnote-65068290
Ref: ライブラリ<121>-Footnote-75068355
Ref: ライブラリ<121>-Footnote-85068420
Ref: ライブラリ<121>-Footnote-95068485
Ref: ライブラリ<121>-Footnote-105068550
Ref: ライブラリ<121>-Footnote-115068616
Ref: ライブラリ<121>-Footnote-125068682
Ref: ライブラリ<121>-Footnote-135068748
Ref: ライブラリ<121>-Footnote-145068814
Ref: ライブラリ<121>-Footnote-155068880
Ref: ライブラリ<121>-Footnote-165068923
Ref: ライブラリ<121>-Footnote-175068989
Ref: ライブラリ<121>-Footnote-185069055
Ref: ライブラリ<121>-Footnote-195069121
Ref: ライブラリ<121>-Footnote-205069187
Ref: ライブラリ<121>-Footnote-215069253
Ref: ライブラリ<121>-Footnote-225069319
Ref: ライブラリ<121>-Footnote-235069385
Ref: ライブラリ<121>-Footnote-245069451
Ref: ライブラリ<121>-Footnote-255069517
Ref: ライブラリ<121>-Footnote-265069599
Ref: ライブラリ<121>-Footnote-275069665
Ref: ライブラリ<121>-Footnote-285069731
Ref: ライブラリ<121>-Footnote-295069797
Ref: ライブラリ<121>-Footnote-305069863
Ref: ライブラリ<121>-Footnote-315069929
Ref: ライブラリ<121>-Footnote-325069995
Ref: ライブラリ<121>-Footnote-335070061
Ref: ライブラリ<121>-Footnote-345070127
Ref: ライブラリ<121>-Footnote-355070193
Ref: ライブラリ<121>-Footnote-365070259
Ref: ライブラリ<121>-Footnote-375070325
Ref: ライブラリ<121>-Footnote-385070391
Ref: ライブラリ<121>-Footnote-395070457
Ref: ライブラリ<121>-Footnote-405070523
Ref: ライブラリ<121>-Footnote-415070589
Ref: ライブラリ<121>-Footnote-425070655
Ref: ライブラリ<121>-Footnote-435070721
Ref: ライブラリ<121>-Footnote-445070787
Ref: ライブラリ<121>-Footnote-455070853
Node: ドキュメント<38>5070919
Ref: whatsnew/changelog id5275071050
Ref: 1c965071050
Ref: ドキュメント<38>-Footnote-15071748
Ref: ドキュメント<38>-Footnote-25071813
Ref: ドキュメント<38>-Footnote-35071878
Ref: ドキュメント<38>-Footnote-45071943
Node: テスト<37>5072008
Ref: whatsnew/changelog id5285072132
Ref: 1c975072132
Ref: テスト<37>-Footnote-15072440
Ref: テスト<37>-Footnote-25072505
Node: ビルド<44>5072570
Ref: whatsnew/changelog id5295072683
Ref: 1c985072683
Ref: ビルド<44>-Footnote-15073659
Ref: ビルド<44>-Footnote-25073724
Ref: ビルド<44>-Footnote-35073789
Ref: ビルド<44>-Footnote-45073854
Ref: ビルド<44>-Footnote-55073919
Ref: ビルド<44>-Footnote-65073984
Node: Windows<39>5074049
Ref: whatsnew/changelog id5305074157
Ref: 1c995074157
Ref: Windows<39>-Footnote-15074347
Node: IDLE<21>5074412
Ref: whatsnew/changelog id5315074516
Ref: 1c9a5074516
Ref: IDLE<21>-Footnote-15074759
Node: C API<39>5074824
Ref: whatsnew/changelog id5325074908
Ref: 1c9b5074908
Ref: C API<39>-Footnote-15078374
Ref: C API<39>-Footnote-25078439
Ref: C API<39>-Footnote-35078504
Ref: C API<39>-Footnote-45078569
Ref: C API<39>-Footnote-55078634
Ref: C API<39>-Footnote-65078699
Ref: C API<39>-Footnote-75078764
Ref: C API<39>-Footnote-85078829
Ref: C API<39>-Footnote-95078894
Node: Python 3 10 0 alpha 65078936
Ref: whatsnew/changelog python-3-10-0-alpha-65079066
Ref: 1c9c5079066
Node: セキュリティ<32>5079653
Ref: whatsnew/changelog id5335079764
Ref: 1c9d5079764
Ref: セキュリティ<32>-Footnote-15080024
Node: Core and Builtins<119>5080089
Ref: whatsnew/changelog id5345080229
Ref: 1c9e5080229
Ref: Core and Builtins<119>-Footnote-15081874
Ref: Core and Builtins<119>-Footnote-25081939
Ref: Core and Builtins<119>-Footnote-35082004
Ref: Core and Builtins<119>-Footnote-45082046
Ref: Core and Builtins<119>-Footnote-55082111
Ref: Core and Builtins<119>-Footnote-65082176
Ref: Core and Builtins<119>-Footnote-75082241
Ref: Core and Builtins<119>-Footnote-85082306
Node: ライブラリ<122>5082371
Ref: whatsnew/changelog id5355082511
Ref: 1c9f5082511
Ref: ライブラリ<122>-Footnote-15083218
Node: Core and Builtins<120>5083283
Ref: whatsnew/changelog id5365083421
Ref: 1ca05083421
Ref: Core and Builtins<120>-Footnote-15084111
Ref: Core and Builtins<120>-Footnote-25084176
Ref: Core and Builtins<120>-Footnote-35084241
Ref: Core and Builtins<120>-Footnote-45084306
Ref: Core and Builtins<120>-Footnote-55084371
Node: ライブラリ<123>5084413
Ref: whatsnew/changelog id5375084553
Ref: 1ca15084553
Ref: ライブラリ<123>-Footnote-15084974
Node: Core and Builtins<121>5085039
Ref: whatsnew/changelog id5385085177
Ref: 1ca25085177
Ref: Core and Builtins<121>-Footnote-15085490
Node: ライブラリ<124>5085555
Ref: whatsnew/changelog id5395085695
Ref: 1ca35085695
Ref: ライブラリ<124>-Footnote-15088542
Ref: ライブラリ<124>-Footnote-25088607
Ref: ライブラリ<124>-Footnote-35088672
Ref: ライブラリ<124>-Footnote-45088737
Ref: ライブラリ<124>-Footnote-55088802
Ref: ライブラリ<124>-Footnote-65088867
Ref: ライブラリ<124>-Footnote-75088932
Ref: ライブラリ<124>-Footnote-85088997
Ref: ライブラリ<124>-Footnote-95089062
Ref: ライブラリ<124>-Footnote-105089127
Ref: ライブラリ<124>-Footnote-115089193
Ref: ライブラリ<124>-Footnote-125089259
Ref: ライブラリ<124>-Footnote-135089325
Ref: ライブラリ<124>-Footnote-145089391
Ref: ライブラリ<124>-Footnote-155089457
Ref: ライブラリ<124>-Footnote-165089523
Node: ドキュメント<39>5089589
Ref: whatsnew/changelog id5405089720
Ref: 1ca75089720
Ref: ドキュメント<39>-Footnote-15090066
Ref: ドキュメント<39>-Footnote-25090131
Ref: ドキュメント<39>-Footnote-35090196
Node: テスト<38>5090238
Ref: whatsnew/changelog id5415090362
Ref: 1ca85090362
Ref: テスト<38>-Footnote-15090558
Node: ビルド<45>5090623
Ref: whatsnew/changelog id5425090736
Ref: 1ca95090736
Ref: ビルド<45>-Footnote-15091808
Ref: ビルド<45>-Footnote-25091873
Ref: ビルド<45>-Footnote-35091938
Ref: ビルド<45>-Footnote-45092003
Ref: ビルド<45>-Footnote-55092068
Node: Windows<40>5092133
Ref: whatsnew/changelog id5435092242
Ref: 1caa5092242
Ref: Windows<40>-Footnote-15092408
Node: macOS<29>5092473
Ref: whatsnew/changelog id5445092577
Ref: 1cac5092577
Ref: macOS<29>-Footnote-15092720
Node: IDLE<22>5092785
Ref: whatsnew/changelog id5455092887
Ref: 1cad5092887
Ref: IDLE<22>-Footnote-15093157
Node: C API<40>5093222
Ref: whatsnew/changelog id5465093306
Ref: 1cae5093306
Ref: C API<40>-Footnote-15095060
Ref: C API<40>-Footnote-25095125
Ref: C API<40>-Footnote-35095190
Ref: C API<40>-Footnote-45095255
Ref: C API<40>-Footnote-55095320
Ref: C API<40>-Footnote-65095385
Ref: C API<40>-Footnote-75095450
Ref: C API<40>-Footnote-85095515
Ref: C API<40>-Footnote-95095580
Node: Python 3 10 0 alpha 55095645
Ref: whatsnew/changelog python-3-10-0-alpha-55095775
Ref: 1cb65095775
Node: セキュリティ<33>5096276
Ref: whatsnew/changelog id5475096387
Ref: 1cb75096387
Ref: セキュリティ<33>-Footnote-15096623
Node: Core and Builtins<122>5096688
Ref: whatsnew/changelog id5485096828
Ref: 1cba5096828
Ref: Core and Builtins<122>-Footnote-15098954
Ref: Core and Builtins<122>-Footnote-25099019
Ref: Core and Builtins<122>-Footnote-35099084
Ref: Core and Builtins<122>-Footnote-45099149
Ref: Core and Builtins<122>-Footnote-55099214
Ref: Core and Builtins<122>-Footnote-65099279
Ref: Core and Builtins<122>-Footnote-75099344
Ref: Core and Builtins<122>-Footnote-85099409
Ref: Core and Builtins<122>-Footnote-95099474
Ref: Core and Builtins<122>-Footnote-105099539
Ref: Core and Builtins<122>-Footnote-115099605
Ref: Core and Builtins<122>-Footnote-125099671
Node: ライブラリ<125>5099737
Ref: whatsnew/changelog id5495099877
Ref: 1cbb5099877
Ref: ライブラリ<125>-Footnote-15100112
Node: Core and Builtins<123>5100177
Ref: whatsnew/changelog id5505100315
Ref: 1cbc5100315
Ref: Core and Builtins<123>-Footnote-15100654
Ref: Core and Builtins<123>-Footnote-25100719
Node: ライブラリ<126>5100784
Ref: whatsnew/changelog id5515100924
Ref: 1cbd5100924
Ref: ライブラリ<126>-Footnote-15105869
Ref: ライブラリ<126>-Footnote-25105934
Ref: ライブラリ<126>-Footnote-35105999
Ref: ライブラリ<126>-Footnote-45106064
Ref: ライブラリ<126>-Footnote-55106129
Ref: ライブラリ<126>-Footnote-65106194
Ref: ライブラリ<126>-Footnote-75106259
Ref: ライブラリ<126>-Footnote-85106324
Ref: ライブラリ<126>-Footnote-95106389
Ref: ライブラリ<126>-Footnote-105106454
Ref: ライブラリ<126>-Footnote-115106520
Ref: ライブラリ<126>-Footnote-125106586
Ref: ライブラリ<126>-Footnote-135106652
Ref: ライブラリ<126>-Footnote-145106718
Ref: ライブラリ<126>-Footnote-155106784
Ref: ライブラリ<126>-Footnote-165106850
Ref: ライブラリ<126>-Footnote-175106916
Ref: ライブラリ<126>-Footnote-185106982
Ref: ライブラリ<126>-Footnote-195107025
Ref: ライブラリ<126>-Footnote-205107091
Ref: ライブラリ<126>-Footnote-215107157
Ref: ライブラリ<126>-Footnote-225107223
Ref: ライブラリ<126>-Footnote-235107289
Ref: ライブラリ<126>-Footnote-245107357
Ref: ライブラリ<126>-Footnote-255107400
Ref: ライブラリ<126>-Footnote-265107466
Ref: ライブラリ<126>-Footnote-275107532
Ref: ライブラリ<126>-Footnote-285107598
Ref: ライブラリ<126>-Footnote-295107664
Ref: ライブラリ<126>-Footnote-305107730
Ref: ライブラリ<126>-Footnote-315107796
Ref: ライブラリ<126>-Footnote-325107862
Ref: ライブラリ<126>-Footnote-335107928
Ref: ライブラリ<126>-Footnote-345107994
Node: ドキュメント<40>5108060
Ref: whatsnew/changelog id5525108191
Ref: 1cbe5108191
Ref: ドキュメント<40>-Footnote-15108523
Ref: ドキュメント<40>-Footnote-25108588
Node: テスト<39>5108653
Ref: whatsnew/changelog id5535108777
Ref: 1cbf5108777
Ref: テスト<39>-Footnote-15109138
Ref: テスト<39>-Footnote-25109203
Node: ビルド<46>5109268
Ref: whatsnew/changelog id5545109381
Ref: 1cc05109381
Ref: ビルド<46>-Footnote-15110579
Ref: ビルド<46>-Footnote-25110644
Ref: ビルド<46>-Footnote-35110709
Ref: ビルド<46>-Footnote-45110774
Ref: ビルド<46>-Footnote-55110839
Node: Windows<41>5110904
Ref: whatsnew/changelog id5555111013
Ref: 1cc15111013
Ref: Windows<41>-Footnote-15111226
Ref: Windows<41>-Footnote-25111291
Node: macOS<30>5111356
Ref: whatsnew/changelog id5565111460
Ref: 1cc25111460
Ref: macOS<30>-Footnote-15111709
Node: IDLE<23>5111774
Ref: whatsnew/changelog id5575111876
Ref: 1cc35111876
Ref: IDLE<23>-Footnote-15112440
Ref: IDLE<23>-Footnote-25112505
Ref: IDLE<23>-Footnote-35112570
Ref: IDLE<23>-Footnote-45112635
Node: C API<41>5112700
Ref: whatsnew/changelog id5585112784
Ref: 1cc45112784
Ref: C API<41>-Footnote-15113390
Ref: C API<41>-Footnote-25113455
Node: Python 3 10 0 alpha 45113520
Ref: whatsnew/changelog python-3-10-0-alpha-45113650
Ref: 1cc65113650
Node: Core and Builtins<124>5114181
Ref: whatsnew/changelog id5595114290
Ref: 1cc75114290
Ref: Core and Builtins<124>-Footnote-15115762
Ref: Core and Builtins<124>-Footnote-25115827
Ref: Core and Builtins<124>-Footnote-35115892
Ref: Core and Builtins<124>-Footnote-45115957
Ref: Core and Builtins<124>-Footnote-55116022
Ref: Core and Builtins<124>-Footnote-65116087
Ref: Core and Builtins<124>-Footnote-75116152
Ref: Core and Builtins<124>-Footnote-85116217
Ref: Core and Builtins<124>-Footnote-95116282
Ref: Core and Builtins<124>-Footnote-105116347
Node: ライブラリ<127>5116413
Ref: whatsnew/changelog id5605116553
Ref: 1cc85116553
Ref: ライブラリ<127>-Footnote-15116833
Node: Core and Builtins<125>5116898
Ref: whatsnew/changelog id5615117036
Ref: 1cc95117036
Ref: Core and Builtins<125>-Footnote-15117313
Node: ライブラリ<128>5117378
Ref: whatsnew/changelog id5625117518
Ref: 1ccb5117518
Ref: ライブラリ<128>-Footnote-15118791
Ref: ライブラリ<128>-Footnote-25118856
Ref: ライブラリ<128>-Footnote-35118898
Ref: ライブラリ<128>-Footnote-45118963
Ref: ライブラリ<128>-Footnote-55119028
Ref: ライブラリ<128>-Footnote-65119093
Ref: ライブラリ<128>-Footnote-75119160
Node: Core and Builtins<126>5119202
Ref: whatsnew/changelog id5635119340
Ref: 1ccc5119340
Ref: Core and Builtins<126>-Footnote-15119795
Ref: Core and Builtins<126>-Footnote-25119860
Node: ライブラリ<129>5119925
Ref: whatsnew/changelog id5645120065
Ref: 1ccd5120065
Ref: ライブラリ<129>-Footnote-15128895
Ref: ライブラリ<129>-Footnote-25128960
Ref: ライブラリ<129>-Footnote-35129025
Ref: ライブラリ<129>-Footnote-45129090
Ref: ライブラリ<129>-Footnote-55129155
Ref: ライブラリ<129>-Footnote-65129220
Ref: ライブラリ<129>-Footnote-75129285
Ref: ライブラリ<129>-Footnote-85129327
Ref: ライブラリ<129>-Footnote-95129369
Ref: ライブラリ<129>-Footnote-105129434
Ref: ライブラリ<129>-Footnote-115129500
Ref: ライブラリ<129>-Footnote-125129566
Ref: ライブラリ<129>-Footnote-135129632
Ref: ライブラリ<129>-Footnote-145129698
Ref: ライブラリ<129>-Footnote-155129764
Ref: ライブラリ<129>-Footnote-165129830
Ref: ライブラリ<129>-Footnote-175129896
Ref: ライブラリ<129>-Footnote-185129962
Ref: ライブラリ<129>-Footnote-195130027
Ref: ライブラリ<129>-Footnote-205130095
Ref: ライブラリ<129>-Footnote-215130138
Ref: ライブラリ<129>-Footnote-225130204
Ref: ライブラリ<129>-Footnote-235130270
Ref: ライブラリ<129>-Footnote-245130336
Ref: ライブラリ<129>-Footnote-255130402
Ref: ライブラリ<129>-Footnote-265130468
Ref: ライブラリ<129>-Footnote-275130534
Ref: ライブラリ<129>-Footnote-285130600
Ref: ライブラリ<129>-Footnote-295130666
Ref: ライブラリ<129>-Footnote-305130732
Ref: ライブラリ<129>-Footnote-315130798
Ref: ライブラリ<129>-Footnote-325130864
Ref: ライブラリ<129>-Footnote-335130907
Ref: ライブラリ<129>-Footnote-345130973
Ref: ライブラリ<129>-Footnote-355131039
Ref: ライブラリ<129>-Footnote-365131105
Ref: ライブラリ<129>-Footnote-375131171
Ref: ライブラリ<129>-Footnote-385131237
Ref: ライブラリ<129>-Footnote-395131303
Ref: ライブラリ<129>-Footnote-405131369
Ref: ライブラリ<129>-Footnote-415131435
Ref: ライブラリ<129>-Footnote-425131501
Ref: ライブラリ<129>-Footnote-435131567
Ref: ライブラリ<129>-Footnote-445131633
Ref: ライブラリ<129>-Footnote-455131699
Ref: ライブラリ<129>-Footnote-465131765
Ref: ライブラリ<129>-Footnote-475131831
Ref: ライブラリ<129>-Footnote-485131899
Ref: ライブラリ<129>-Footnote-495131942
Ref: ライブラリ<129>-Footnote-505132008
Ref: ライブラリ<129>-Footnote-515132074
Ref: ライブラリ<129>-Footnote-525132140
Ref: ライブラリ<129>-Footnote-535132206
Ref: ライブラリ<129>-Footnote-545132272
Ref: ライブラリ<129>-Footnote-555132338
Ref: ライブラリ<129>-Footnote-565132404
Ref: ライブラリ<129>-Footnote-575132470
Ref: ライブラリ<129>-Footnote-585132536
Node: ドキュメント<41>5132602
Ref: whatsnew/changelog id5655132733
Ref: 1cd35132733
Ref: ドキュメント<41>-Footnote-15133053
Ref: ドキュメント<41>-Footnote-25133118
Node: テスト<40>5133183
Ref: whatsnew/changelog id5665133307
Ref: 1cd55133307
Ref: テスト<40>-Footnote-15134089
Ref: テスト<40>-Footnote-25134154
Ref: テスト<40>-Footnote-35134219
Ref: テスト<40>-Footnote-45134284
Ref: テスト<40>-Footnote-55134349
Ref: テスト<40>-Footnote-65134414
Ref: テスト<40>-Footnote-75134479
Ref: テスト<40>-Footnote-85134544
Node: ビルド<47>5134609
Ref: whatsnew/changelog id5675134720
Ref: 1cd65134720
Ref: ビルド<47>-Footnote-15135690
Ref: ビルド<47>-Footnote-25135755
Ref: ビルド<47>-Footnote-35135820
Ref: ビルド<47>-Footnote-45135885
Ref: ビルド<47>-Footnote-55135950
Ref: ビルド<47>-Footnote-65136015
Node: macOS<31>5136080
Ref: whatsnew/changelog id5685136193
Ref: 1cd75136193
Ref: macOS<31>-Footnote-15136513
Ref: macOS<31>-Footnote-25136578
Ref: macOS<31>-Footnote-35136643
Node: Tools/Demos<28>5136708
Ref: whatsnew/changelog id5695136817
Ref: 1cd85136817
Ref: Tools/Demos<28>-Footnote-15137143
Ref: Tools/Demos<28>-Footnote-25137208
Node: C API<42>5137273
Ref: whatsnew/changelog id5705137364
Ref: 1cd95137364
Ref: C API<42>-Footnote-15138207
Ref: C API<42>-Footnote-25138272
Ref: C API<42>-Footnote-35138337
Ref: C API<42>-Footnote-45138404
Ref: C API<42>-Footnote-55138469
Node: Python 3 10 0 alpha 35138534
Ref: whatsnew/changelog python-3-10-0-alpha-35138664
Ref: 1cda5138664
Node: セキュリティ<34>5139372
Ref: whatsnew/changelog id5715139483
Ref: 1cdb5139483
Ref: セキュリティ<34>-Footnote-15139737
Node: Core and Builtins<127>5139802
Ref: whatsnew/changelog id5725139942
Ref: 1cdc5139942
Ref: Core and Builtins<127>-Footnote-15141560
Ref: Core and Builtins<127>-Footnote-25141625
Ref: Core and Builtins<127>-Footnote-35141690
Ref: Core and Builtins<127>-Footnote-45141755
Ref: Core and Builtins<127>-Footnote-55141820
Node: ライブラリ<130>5141885
Ref: whatsnew/changelog id5735142025
Ref: 1cde5142025
Ref: ライブラリ<130>-Footnote-15142262
Ref: ライブラリ<130>-Footnote-25142329
Node: Core and Builtins<128>5142371
Ref: whatsnew/changelog id5745142509
Ref: 1cdf5142509
Ref: Core and Builtins<128>-Footnote-15144352
Ref: Core and Builtins<128>-Footnote-25144417
Ref: Core and Builtins<128>-Footnote-35144482
Ref: Core and Builtins<128>-Footnote-45144547
Ref: Core and Builtins<128>-Footnote-55144612
Ref: Core and Builtins<128>-Footnote-65144677
Ref: Core and Builtins<128>-Footnote-75144742
Ref: Core and Builtins<128>-Footnote-85144807
Ref: Core and Builtins<128>-Footnote-95144872
Ref: Core and Builtins<128>-Footnote-105144937
Node: ライブラリ<131>5145003
Ref: whatsnew/changelog id5755145143
Ref: 1ce05145143
Ref: ライブラリ<131>-Footnote-15145291
Node: Core and Builtins<129>5145356
Ref: whatsnew/changelog id5765145494
Ref: 1ce15145494
Ref: Core and Builtins<129>-Footnote-15145720
Node: ライブラリ<132>5145785
Ref: whatsnew/changelog id5775145925
Ref: 1ce25145925
Ref: ライブラリ<132>-Footnote-15146072
Node: Core and Builtins<130>5146137
Ref: whatsnew/changelog id5785146275
Ref: 1ce35146275
Ref: Core and Builtins<130>-Footnote-15146860
Ref: Core and Builtins<130>-Footnote-25146925
Ref: Core and Builtins<130>-Footnote-35146990
Node: ライブラリ<133>5147055
Ref: whatsnew/changelog id5795147195
Ref: 1ce45147195
Ref: ライブラリ<133>-Footnote-15158268
Ref: ライブラリ<133>-Footnote-25158332
Ref: ライブラリ<133>-Footnote-35158397
Ref: ライブラリ<133>-Footnote-45158462
Ref: ライブラリ<133>-Footnote-55158527
Ref: ライブラリ<133>-Footnote-65158592
Ref: ライブラリ<133>-Footnote-75158657
Ref: ライブラリ<133>-Footnote-85158722
Ref: ライブラリ<133>-Footnote-95158787
Ref: ライブラリ<133>-Footnote-105158852
Ref: ライブラリ<133>-Footnote-115158918
Ref: ライブラリ<133>-Footnote-125158984
Ref: ライブラリ<133>-Footnote-135159050
Ref: ライブラリ<133>-Footnote-145159116
Ref: ライブラリ<133>-Footnote-155159182
Ref: ライブラリ<133>-Footnote-165159248
Ref: ライブラリ<133>-Footnote-175159314
Ref: ライブラリ<133>-Footnote-185159380
Ref: ライブラリ<133>-Footnote-195159446
Ref: ライブラリ<133>-Footnote-205159512
Ref: ライブラリ<133>-Footnote-215159578
Ref: ライブラリ<133>-Footnote-225159644
Ref: ライブラリ<133>-Footnote-235159710
Ref: ライブラリ<133>-Footnote-245159778
Ref: ライブラリ<133>-Footnote-255159844
Ref: ライブラリ<133>-Footnote-265159910
Ref: ライブラリ<133>-Footnote-275159953
Ref: ライブラリ<133>-Footnote-285160019
Ref: ライブラリ<133>-Footnote-295160085
Ref: ライブラリ<133>-Footnote-305160151
Ref: ライブラリ<133>-Footnote-315160217
Ref: ライブラリ<133>-Footnote-325160283
Ref: ライブラリ<133>-Footnote-335160349
Ref: ライブラリ<133>-Footnote-345160415
Ref: ライブラリ<133>-Footnote-355160481
Ref: ライブラリ<133>-Footnote-365160547
Ref: ライブラリ<133>-Footnote-375160613
Ref: ライブラリ<133>-Footnote-385160679
Ref: ライブラリ<133>-Footnote-395160745
Ref: ライブラリ<133>-Footnote-405160811
Ref: ライブラリ<133>-Footnote-415160877
Ref: ライブラリ<133>-Footnote-425160943
Ref: ライブラリ<133>-Footnote-435161009
Ref: ライブラリ<133>-Footnote-445161075
Ref: ライブラリ<133>-Footnote-455161141
Ref: ライブラリ<133>-Footnote-465161207
Ref: ライブラリ<133>-Footnote-475161273
Ref: ライブラリ<133>-Footnote-485161339
Ref: ライブラリ<133>-Footnote-495161405
Ref: ライブラリ<133>-Footnote-505161471
Ref: ライブラリ<133>-Footnote-515161537
Ref: ライブラリ<133>-Footnote-525161603
Ref: ライブラリ<133>-Footnote-535161669
Ref: ライブラリ<133>-Footnote-545161735
Ref: ライブラリ<133>-Footnote-555161801
Ref: ライブラリ<133>-Footnote-565161867
Ref: ライブラリ<133>-Footnote-575161933
Ref: ライブラリ<133>-Footnote-585161999
Ref: ライブラリ<133>-Footnote-595162065
Ref: ライブラリ<133>-Footnote-605162131
Ref: ライブラリ<133>-Footnote-615162197
Ref: ライブラリ<133>-Footnote-625162263
Ref: ライブラリ<133>-Footnote-635162329
Ref: ライブラリ<133>-Footnote-645162395
Ref: ライブラリ<133>-Footnote-655162461
Node: ドキュメント<42>5162527
Ref: whatsnew/changelog id5805162658
Ref: 1ce95162658
Ref: ドキュメント<42>-Footnote-15163130
Ref: ドキュメント<42>-Footnote-25163195
Ref: ドキュメント<42>-Footnote-35163260
Node: テスト<41>5163325
Ref: whatsnew/changelog id5815163449
Ref: 1cea5163449
Ref: テスト<41>-Footnote-15164662
Ref: テスト<41>-Footnote-25164727
Ref: テスト<41>-Footnote-35164792
Ref: テスト<41>-Footnote-45164857
Ref: テスト<41>-Footnote-55164922
Ref: テスト<41>-Footnote-65164987
Ref: テスト<41>-Footnote-75165052
Ref: テスト<41>-Footnote-85165117
Ref: テスト<41>-Footnote-95165182
Ref: テスト<41>-Footnote-105165247
Ref: テスト<41>-Footnote-115165313
Ref: テスト<41>-Footnote-125165379
Node: ビルド<48>5165445
Ref: whatsnew/changelog id5825165558
Ref: 1ceb5165558
Ref: ビルド<48>-Footnote-15166702
Ref: ビルド<48>-Footnote-25166767
Ref: ビルド<48>-Footnote-35166832
Ref: ビルド<48>-Footnote-45166897
Ref: ビルド<48>-Footnote-55166962
Ref: ビルド<48>-Footnote-65167027
Ref: ビルド<48>-Footnote-75167092
Node: Windows<42>5167157
Ref: whatsnew/changelog id5835167266
Ref: 1cec5167266
Ref: Windows<42>-Footnote-15167560
Ref: Windows<42>-Footnote-25167625
Node: macOS<32>5167690
Ref: whatsnew/changelog id5845167794
Ref: 1ced5167794
Ref: macOS<32>-Footnote-15168732
Ref: macOS<32>-Footnote-25168797
Ref: macOS<32>-Footnote-35168862
Ref: macOS<32>-Footnote-45168927
Ref: macOS<32>-Footnote-55168992
Node: IDLE<24>5169057
Ref: whatsnew/changelog id5855169165
Ref: 1cee5169165
Ref: IDLE<24>-Footnote-15169587
Ref: IDLE<24>-Footnote-25169652
Ref: IDLE<24>-Footnote-35169717
Node: Tools/Demos<29>5169782
Ref: whatsnew/changelog id5865169890
Ref: 1cef5169890
Ref: Tools/Demos<29>-Footnote-15170292
Ref: Tools/Demos<29>-Footnote-25170357
Node: C API<43>5170422
Ref: whatsnew/changelog id5875170513
Ref: 1cf05170513
Ref: C API<43>-Footnote-15175283
Ref: C API<43>-Footnote-25175348
Ref: C API<43>-Footnote-35175415
Ref: C API<43>-Footnote-45175457
Ref: C API<43>-Footnote-55175524
Ref: C API<43>-Footnote-65175566
Ref: C API<43>-Footnote-75175633
Ref: C API<43>-Footnote-85175675
Ref: C API<43>-Footnote-95175742
Ref: C API<43>-Footnote-105175784
Ref: C API<43>-Footnote-115175852
Ref: C API<43>-Footnote-125175895
Ref: C API<43>-Footnote-135175963
Ref: C API<43>-Footnote-145176006
Ref: C API<43>-Footnote-155176074
Ref: C API<43>-Footnote-165176117
Ref: C API<43>-Footnote-175176183
Ref: C API<43>-Footnote-185176251
Ref: C API<43>-Footnote-195176294
Ref: C API<43>-Footnote-205176362
Ref: C API<43>-Footnote-215176405
Ref: C API<43>-Footnote-225176473
Ref: C API<43>-Footnote-235176516
Ref: C API<43>-Footnote-245176584
Ref: C API<43>-Footnote-255176627
Ref: C API<43>-Footnote-265176693
Ref: C API<43>-Footnote-275176759
Ref: C API<43>-Footnote-285176825
Ref: C API<43>-Footnote-295176891
Ref: C API<43>-Footnote-305176957
Ref: C API<43>-Footnote-315177023
Ref: C API<43>-Footnote-325177089
Ref: C API<43>-Footnote-335177157
Ref: C API<43>-Footnote-345177223
Ref: C API<43>-Footnote-355177289
Ref: C API<43>-Footnote-365177355
Node: Python 3 10 0 alpha 25177421
Ref: whatsnew/changelog python-3-10-0-alpha-25177551
Ref: 1cf25177551
Node: セキュリティ<35>5178052
Ref: whatsnew/changelog id5885178163
Ref: 1cf35178163
Ref: セキュリティ<35>-Footnote-15178653
Ref: セキュリティ<35>-Footnote-25178718
Node: Core and Builtins<131>5178783
Ref: whatsnew/changelog id5895178923
Ref: 1cf45178923
Ref: Core and Builtins<131>-Footnote-15182262
Ref: Core and Builtins<131>-Footnote-25182327
Ref: Core and Builtins<131>-Footnote-35182392
Ref: Core and Builtins<131>-Footnote-45182457
Ref: Core and Builtins<131>-Footnote-55182522
Ref: Core and Builtins<131>-Footnote-65182587
Ref: Core and Builtins<131>-Footnote-75182652
Ref: Core and Builtins<131>-Footnote-85182717
Ref: Core and Builtins<131>-Footnote-95182782
Ref: Core and Builtins<131>-Footnote-105182847
Ref: Core and Builtins<131>-Footnote-115182913
Ref: Core and Builtins<131>-Footnote-125182979
Ref: Core and Builtins<131>-Footnote-135183045
Ref: Core and Builtins<131>-Footnote-145183111
Ref: Core and Builtins<131>-Footnote-155183177
Ref: Core and Builtins<131>-Footnote-165183243
Ref: Core and Builtins<131>-Footnote-175183309
Ref: Core and Builtins<131>-Footnote-185183375
Node: ライブラリ<134>5183441
Ref: whatsnew/changelog id5905183581
Ref: 1cf75183581
Ref: ライブラリ<134>-Footnote-15183896
Node: Core and Builtins<132>5183961
Ref: whatsnew/changelog id5915184099
Ref: 1cf85184099
Ref: Core and Builtins<132>-Footnote-15184433
Ref: Core and Builtins<132>-Footnote-25184498
Node: ライブラリ<135>5184540
Ref: whatsnew/changelog id5925184680
Ref: 1cf95184680
Ref: ライブラリ<135>-Footnote-15191722
Ref: ライブラリ<135>-Footnote-25191787
Ref: ライブラリ<135>-Footnote-35191852
Ref: ライブラリ<135>-Footnote-45191917
Ref: ライブラリ<135>-Footnote-55191982
Ref: ライブラリ<135>-Footnote-65192047
Ref: ライブラリ<135>-Footnote-75192112
Ref: ライブラリ<135>-Footnote-85192154
Ref: ライブラリ<135>-Footnote-95192219
Ref: ライブラリ<135>-Footnote-105192284
Ref: ライブラリ<135>-Footnote-115192350
Ref: ライブラリ<135>-Footnote-125192416
Ref: ライブラリ<135>-Footnote-135192482
Ref: ライブラリ<135>-Footnote-145192548
Ref: ライブラリ<135>-Footnote-155192614
Ref: ライブラリ<135>-Footnote-165192680
Ref: ライブラリ<135>-Footnote-175192746
Ref: ライブラリ<135>-Footnote-185192812
Ref: ライブラリ<135>-Footnote-195192878
Ref: ライブラリ<135>-Footnote-205192944
Ref: ライブラリ<135>-Footnote-215193010
Ref: ライブラリ<135>-Footnote-225193076
Ref: ライブラリ<135>-Footnote-235193142
Ref: ライブラリ<135>-Footnote-245193208
Ref: ライブラリ<135>-Footnote-255193274
Ref: ライブラリ<135>-Footnote-265193317
Ref: ライブラリ<135>-Footnote-275193383
Ref: ライブラリ<135>-Footnote-285193449
Ref: ライブラリ<135>-Footnote-295193515
Ref: ライブラリ<135>-Footnote-305193581
Ref: ライブラリ<135>-Footnote-315193647
Ref: ライブラリ<135>-Footnote-325193713
Ref: ライブラリ<135>-Footnote-335193779
Ref: ライブラリ<135>-Footnote-345193845
Ref: ライブラリ<135>-Footnote-355193911
Ref: ライブラリ<135>-Footnote-365193977
Ref: ライブラリ<135>-Footnote-375194042
Ref: ライブラリ<135>-Footnote-385194108
Ref: ライブラリ<135>-Footnote-395194174
Ref: ライブラリ<135>-Footnote-405194240
Ref: ライブラリ<135>-Footnote-415194306
Node: ドキュメント<43>5194372
Ref: whatsnew/changelog id5935194503
Ref: 1cfc5194503
Ref: ドキュメント<43>-Footnote-15195355
Ref: ドキュメント<43>-Footnote-25195420
Ref: ドキュメント<43>-Footnote-35195485
Ref: ドキュメント<43>-Footnote-45195550
Ref: ドキュメント<43>-Footnote-55195615
Ref: ドキュメント<43>-Footnote-65195680
Node: テスト<42>5195745
Ref: whatsnew/changelog id5945195869
Ref: 1cff5195869
Ref: テスト<42>-Footnote-15196511
Ref: テスト<42>-Footnote-25196576
Ref: テスト<42>-Footnote-35196641
Ref: テスト<42>-Footnote-45196706
Node: ビルド<49>5196771
Ref: whatsnew/changelog id5955196884
Ref: 1d005196884
Ref: ビルド<49>-Footnote-15197153
Node: Windows<43>5197218
Ref: whatsnew/changelog id5965197327
Ref: 1d015197327
Ref: Windows<43>-Footnote-15197803
Ref: Windows<43>-Footnote-25197868
Ref: Windows<43>-Footnote-35197933
Ref: Windows<43>-Footnote-45197998
Ref: Windows<43>-Footnote-55198063
Node: macOS<33>5198128
Ref: whatsnew/changelog id5975198232
Ref: 1d025198232
Ref: macOS<33>-Footnote-15198384
Node: IDLE<25>5198449
Ref: whatsnew/changelog id5985198551
Ref: 1d035198551
Ref: IDLE<25>-Footnote-15199162
Ref: IDLE<25>-Footnote-25199227
Ref: IDLE<25>-Footnote-35199292
Node: C API<44>5199357
Ref: whatsnew/changelog id5995199441
Ref: 1d045199441
Ref: C API<44>-Footnote-15200774
Ref: C API<44>-Footnote-25200839
Ref: C API<44>-Footnote-35200904
Ref: C API<44>-Footnote-45200969
Ref: C API<44>-Footnote-55201034
Ref: C API<44>-Footnote-65201099
Ref: C API<44>-Footnote-75201164
Ref: C API<44>-Footnote-85201229
Node: Python 3 10 0 alpha 15201294
Ref: whatsnew/changelog python-3-10-0-alpha-15201422
Ref: 1d065201422
Node: セキュリティ<36>5203041
Ref: whatsnew/changelog id6005203152
Ref: 1d075203152
Ref: セキュリティ<36>-Footnote-15204069
Ref: セキュリティ<36>-Footnote-25204134
Ref: セキュリティ<36>-Footnote-35204199
Ref: セキュリティ<36>-Footnote-45204255
Ref: セキュリティ<36>-Footnote-55204320
Ref: セキュリティ<36>-Footnote-65204385
Ref: セキュリティ<36>-Footnote-75204441
Ref: セキュリティ<36>-Footnote-85204506
Node: Core and Builtins<133>5204571
Ref: whatsnew/changelog id6015204711
Ref: 1d085204711
Ref: Core and Builtins<133>-Footnote-15205403
Ref: Core and Builtins<133>-Footnote-25205468
Ref: Core and Builtins<133>-Footnote-35205533
Ref: Core and Builtins<133>-Footnote-45205575
Ref: Core and Builtins<133>-Footnote-55205640
Ref: Core and Builtins<133>-Footnote-65205705
Node: ライブラリ<136>5205747
Ref: whatsnew/changelog id6025205887
Ref: 1d095205887
Ref: ライブラリ<136>-Footnote-15206081
Ref: ライブラリ<136>-Footnote-25206148
Node: Core and Builtins<134>5206190
Ref: whatsnew/changelog id6035206328
Ref: 1d0a5206328
Ref: Core and Builtins<134>-Footnote-15206716
Ref: Core and Builtins<134>-Footnote-25206781
Node: ライブラリ<137>5206846
Ref: whatsnew/changelog id6045206986
Ref: 1d0b5206986
Ref: ライブラリ<137>-Footnote-15207618
Ref: ライブラリ<137>-Footnote-25207685
Ref: ライブラリ<137>-Footnote-35207727
Ref: ライブラリ<137>-Footnote-45207794
Ref: ライブラリ<137>-Footnote-55207836
Ref: ライブラリ<137>-Footnote-65207903
Ref: ライブラリ<137>-Footnote-75207945
Ref: ライブラリ<137>-Footnote-85208012
Ref: ライブラリ<137>-Footnote-95208054
Node: Core and Builtins<135>5208121
Ref: whatsnew/changelog id6055208259
Ref: 1d0c5208259
Ref: Core and Builtins<135>-Footnote-15208518
Node: ライブラリ<138>5208583
Ref: whatsnew/changelog id6065208723
Ref: 1d0d5208723
Ref: ライブラリ<138>-Footnote-15209153
Ref: ライブラリ<138>-Footnote-25209220
Ref: ライブラリ<138>-Footnote-35209262
Ref: ライブラリ<138>-Footnote-45209329
Ref: ライブラリ<138>-Footnote-55209371
Ref: ライブラリ<138>-Footnote-65209438
Node: Core and Builtins<136>5209480
Ref: whatsnew/changelog id6075209618
Ref: 1d0e5209618
Ref: Core and Builtins<136>-Footnote-15209872
Node: ライブラリ<139>5209937
Ref: whatsnew/changelog id6085210077
Ref: 1d0f5210077
Ref: ライブラリ<139>-Footnote-15210388
Node: Core and Builtins<137>5210453
Ref: whatsnew/changelog id6095210591
Ref: 1d105210591
Ref: Core and Builtins<137>-Footnote-15211034
Ref: Core and Builtins<137>-Footnote-25211099
Node: ライブラリ<140>5211164
Ref: whatsnew/changelog id6105211304
Ref: 1d115211304
Ref: ライブラリ<140>-Footnote-15211505
Ref: ライブラリ<140>-Footnote-25211572
Node: Core and Builtins<138>5211614
Ref: whatsnew/changelog id6115211752
Ref: 1d125211752
Ref: Core and Builtins<138>-Footnote-15212224
Node: ライブラリ<141>5212289
Ref: whatsnew/changelog id6125212429
Ref: 1d135212429
Ref: ライブラリ<141>-Footnote-15212601
Node: Core and Builtins<139>5212666
Ref: whatsnew/changelog id6135212804
Ref: 1d145212804
Ref: Core and Builtins<139>-Footnote-15213001
Node: ライブラリ<142>5213068
Ref: whatsnew/changelog id6145213208
Ref: 1d155213208
Ref: ライブラリ<142>-Footnote-15213414
Ref: ライブラリ<142>-Footnote-25213481
Node: Core and Builtins<140>5213523
Ref: whatsnew/changelog id6155213661
Ref: 1d165213661
Ref: Core and Builtins<140>-Footnote-15214137
Ref: Core and Builtins<140>-Footnote-25214202
Ref: Core and Builtins<140>-Footnote-35214267
Node: ライブラリ<143>5214332
Ref: whatsnew/changelog id6165214472
Ref: 1d175214472
Ref: ライブラリ<143>-Footnote-15214704
Ref: ライブラリ<143>-Footnote-25214771
Node: Core and Builtins<141>5214813
Ref: whatsnew/changelog id6175214951
Ref: 1d185214951
Ref: Core and Builtins<141>-Footnote-15216399
Ref: Core and Builtins<141>-Footnote-25216464
Ref: Core and Builtins<141>-Footnote-35216529
Ref: Core and Builtins<141>-Footnote-45216594
Ref: Core and Builtins<141>-Footnote-55216659
Ref: Core and Builtins<141>-Footnote-65216724
Ref: Core and Builtins<141>-Footnote-75216789
Ref: Core and Builtins<141>-Footnote-85216854
Ref: Core and Builtins<141>-Footnote-95216919
Ref: Core and Builtins<141>-Footnote-105216984
Ref: Core and Builtins<141>-Footnote-115217050
Node: ライブラリ<144>5217118
Ref: whatsnew/changelog id6185217258
Ref: 1d195217258
Ref: ライブラリ<144>-Footnote-15217413
Node: Core and Builtins<142>5217480
Ref: whatsnew/changelog id6195217618
Ref: 1d1a5217618
Ref: Core and Builtins<142>-Footnote-15218187
Ref: Core and Builtins<142>-Footnote-25218252
Node: ライブラリ<145>5218317
Ref: whatsnew/changelog id6205218457
Ref: 1d1b5218457
Ref: ライブラリ<145>-Footnote-15218698
Ref: ライブラリ<145>-Footnote-25218765
Node: Core and Builtins<143>5218832
Ref: whatsnew/changelog id6215218970
Ref: 1d1c5218970
Ref: Core and Builtins<143>-Footnote-15220934
Ref: Core and Builtins<143>-Footnote-25220999
Ref: Core and Builtins<143>-Footnote-35221064
Ref: Core and Builtins<143>-Footnote-45221129
Ref: Core and Builtins<143>-Footnote-55221194
Ref: Core and Builtins<143>-Footnote-65221259
Ref: Core and Builtins<143>-Footnote-75221324
Ref: Core and Builtins<143>-Footnote-85221389
Ref: Core and Builtins<143>-Footnote-95221454
Ref: Core and Builtins<143>-Footnote-105221519
Ref: Core and Builtins<143>-Footnote-115221585
Ref: Core and Builtins<143>-Footnote-125221651
Ref: Core and Builtins<143>-Footnote-135221717
Node: ライブラリ<146>5221783
Ref: whatsnew/changelog id6225221923
Ref: 1d1d5221923
Ref: ライブラリ<146>-Footnote-15222085
Node: Core and Builtins<144>5222150
Ref: whatsnew/changelog id6235222288
Ref: 1d1e5222288
Ref: Core and Builtins<144>-Footnote-15223404
Ref: Core and Builtins<144>-Footnote-25223469
Ref: Core and Builtins<144>-Footnote-35223534
Ref: Core and Builtins<144>-Footnote-45223576
Ref: Core and Builtins<144>-Footnote-55223643
Ref: Core and Builtins<144>-Footnote-65223708
Ref: Core and Builtins<144>-Footnote-75223773
Ref: Core and Builtins<144>-Footnote-85223840
Node: ライブラリ<147>5223905
Ref: whatsnew/changelog id6245224045
Ref: 1d1f5224045
Ref: ライブラリ<147>-Footnote-15224270
Ref: ライブラリ<147>-Footnote-25224335
Node: Core and Builtins<145>5224377
Ref: whatsnew/changelog id6255224515
Ref: 1d205224515
Ref: Core and Builtins<145>-Footnote-15229440
Ref: Core and Builtins<145>-Footnote-25229505
Ref: Core and Builtins<145>-Footnote-35229570
Ref: Core and Builtins<145>-Footnote-45229635
Ref: Core and Builtins<145>-Footnote-55229700
Ref: Core and Builtins<145>-Footnote-65229765
Ref: Core and Builtins<145>-Footnote-75229830
Ref: Core and Builtins<145>-Footnote-85229895
Ref: Core and Builtins<145>-Footnote-95229960
Ref: Core and Builtins<145>-Footnote-105230025
Ref: Core and Builtins<145>-Footnote-115230091
Ref: Core and Builtins<145>-Footnote-125230157
Ref: Core and Builtins<145>-Footnote-135230223
Ref: Core and Builtins<145>-Footnote-145230291
Ref: Core and Builtins<145>-Footnote-155230357
Ref: Core and Builtins<145>-Footnote-165230423
Ref: Core and Builtins<145>-Footnote-175230489
Ref: Core and Builtins<145>-Footnote-185230555
Ref: Core and Builtins<145>-Footnote-195230621
Ref: Core and Builtins<145>-Footnote-205230687
Ref: Core and Builtins<145>-Footnote-215230753
Ref: Core and Builtins<145>-Footnote-225230819
Ref: Core and Builtins<145>-Footnote-235230885
Ref: Core and Builtins<145>-Footnote-245230951
Ref: Core and Builtins<145>-Footnote-255231017
Ref: Core and Builtins<145>-Footnote-265231083
Node: ライブラリ<148>5231148
Ref: whatsnew/changelog id6265231288
Ref: 1d255231288
Ref: ライブラリ<148>-Footnote-15231516
Ref: ライブラリ<148>-Footnote-25231583
Node: Core and Builtins<146>5231650
Ref: whatsnew/changelog id6275231788
Ref: 1d265231788
Ref: Core and Builtins<146>-Footnote-15232375
Ref: Core and Builtins<146>-Footnote-25232440
Node: ライブラリ<149>5232505
Ref: whatsnew/changelog id6285232645
Ref: 1d275232645
Ref: ライブラリ<149>-Footnote-15233024
Node: Core and Builtins<147>5233089
Ref: whatsnew/changelog id6295233227
Ref: 1d285233227
Ref: Core and Builtins<147>-Footnote-15233571
Ref: Core and Builtins<147>-Footnote-25233636
Node: ライブラリ<150>5233701
Ref: whatsnew/changelog id6305233841
Ref: 1d295233841
Ref: ライブラリ<150>-Footnote-15255998
Ref: ライブラリ<150>-Footnote-25256063
Ref: ライブラリ<150>-Footnote-35256128
Ref: ライブラリ<150>-Footnote-45256193
Ref: ライブラリ<150>-Footnote-55256258
Ref: ライブラリ<150>-Footnote-65256323
Ref: ライブラリ<150>-Footnote-75256388
Ref: ライブラリ<150>-Footnote-85256453
Ref: ライブラリ<150>-Footnote-95256518
Ref: ライブラリ<150>-Footnote-105256583
Ref: ライブラリ<150>-Footnote-115256649
Ref: ライブラリ<150>-Footnote-125256715
Ref: ライブラリ<150>-Footnote-135256781
Ref: ライブラリ<150>-Footnote-145256847
Ref: ライブラリ<150>-Footnote-155256913
Ref: ライブラリ<150>-Footnote-165256979
Ref: ライブラリ<150>-Footnote-175257032
Ref: ライブラリ<150>-Footnote-185257098
Ref: ライブラリ<150>-Footnote-195257164
Ref: ライブラリ<150>-Footnote-205257230
Ref: ライブラリ<150>-Footnote-215257298
Ref: ライブラリ<150>-Footnote-225257341
Ref: ライブラリ<150>-Footnote-235257409
Ref: ライブラリ<150>-Footnote-245257452
Ref: ライブラリ<150>-Footnote-255257518
Ref: ライブラリ<150>-Footnote-265257584
Ref: ライブラリ<150>-Footnote-275257650
Ref: ライブラリ<150>-Footnote-285257716
Ref: ライブラリ<150>-Footnote-295257782
Ref: ライブラリ<150>-Footnote-305257848
Ref: ライブラリ<150>-Footnote-315257914
Ref: ライブラリ<150>-Footnote-325257980
Ref: ライブラリ<150>-Footnote-335258046
Ref: ライブラリ<150>-Footnote-345258112
Ref: ライブラリ<150>-Footnote-355258178
Ref: ライブラリ<150>-Footnote-365258244
Ref: ライブラリ<150>-Footnote-375258310
Ref: ライブラリ<150>-Footnote-385258376
Ref: ライブラリ<150>-Footnote-395258442
Ref: ライブラリ<150>-Footnote-405258508
Ref: ライブラリ<150>-Footnote-415258574
Ref: ライブラリ<150>-Footnote-425258640
Ref: ライブラリ<150>-Footnote-435258706
Ref: ライブラリ<150>-Footnote-445258772
Ref: ライブラリ<150>-Footnote-455258838
Ref: ライブラリ<150>-Footnote-465258904
Ref: ライブラリ<150>-Footnote-475258970
Ref: ライブラリ<150>-Footnote-485259036
Ref: ライブラリ<150>-Footnote-495259102
Ref: ライブラリ<150>-Footnote-505259168
Ref: ライブラリ<150>-Footnote-515259234
Ref: ライブラリ<150>-Footnote-525259300
Ref: ライブラリ<150>-Footnote-535259366
Ref: ライブラリ<150>-Footnote-545259432
Ref: ライブラリ<150>-Footnote-555259498
Ref: ライブラリ<150>-Footnote-565259564
Ref: ライブラリ<150>-Footnote-575259630
Ref: ライブラリ<150>-Footnote-585259687
Ref: ライブラリ<150>-Footnote-595259753
Ref: ライブラリ<150>-Footnote-605259819
Ref: ライブラリ<150>-Footnote-615259885
Ref: ライブラリ<150>-Footnote-625259951
Ref: ライブラリ<150>-Footnote-635260017
Ref: ライブラリ<150>-Footnote-645260083
Ref: ライブラリ<150>-Footnote-655260149
Ref: ライブラリ<150>-Footnote-665260215
Ref: ライブラリ<150>-Footnote-675260281
Ref: ライブラリ<150>-Footnote-685260347
Ref: ライブラリ<150>-Footnote-695260413
Ref: ライブラリ<150>-Footnote-705260479
Ref: ライブラリ<150>-Footnote-715260545
Ref: ライブラリ<150>-Footnote-725260611
Ref: ライブラリ<150>-Footnote-735260677
Ref: ライブラリ<150>-Footnote-745260743
Ref: ライブラリ<150>-Footnote-755260809
Ref: ライブラリ<150>-Footnote-765260875
Ref: ライブラリ<150>-Footnote-775260941
Ref: ライブラリ<150>-Footnote-785261007
Ref: ライブラリ<150>-Footnote-795261073
Ref: ライブラリ<150>-Footnote-805261139
Ref: ライブラリ<150>-Footnote-815261205
Ref: ライブラリ<150>-Footnote-825261271
Ref: ライブラリ<150>-Footnote-835261337
Ref: ライブラリ<150>-Footnote-845261403
Ref: ライブラリ<150>-Footnote-855261469
Ref: ライブラリ<150>-Footnote-865261535
Ref: ライブラリ<150>-Footnote-875261601
Ref: ライブラリ<150>-Footnote-885261667
Ref: ライブラリ<150>-Footnote-895261733
Ref: ライブラリ<150>-Footnote-905261799
Ref: ライブラリ<150>-Footnote-915261865
Ref: ライブラリ<150>-Footnote-925261931
Ref: ライブラリ<150>-Footnote-935261997
Ref: ライブラリ<150>-Footnote-945262063
Ref: ライブラリ<150>-Footnote-955262129
Ref: ライブラリ<150>-Footnote-965262195
Ref: ライブラリ<150>-Footnote-975262261
Ref: ライブラリ<150>-Footnote-985262327
Ref: ライブラリ<150>-Footnote-995262393
Ref: ライブラリ<150>-Footnote-1005262459
Ref: ライブラリ<150>-Footnote-1015262526
Ref: ライブラリ<150>-Footnote-1025262593
Ref: ライブラリ<150>-Footnote-1035262660
Ref: ライブラリ<150>-Footnote-1045262727
Ref: ライブラリ<150>-Footnote-1055262794
Ref: ライブラリ<150>-Footnote-1065262861
Ref: ライブラリ<150>-Footnote-1075262928
Ref: ライブラリ<150>-Footnote-1085262995
Ref: ライブラリ<150>-Footnote-1095263062
Ref: ライブラリ<150>-Footnote-1105263129
Ref: ライブラリ<150>-Footnote-1115263196
Ref: ライブラリ<150>-Footnote-1125263263
Ref: ライブラリ<150>-Footnote-1135263330
Ref: ライブラリ<150>-Footnote-1145263397
Ref: ライブラリ<150>-Footnote-1155263464
Ref: ライブラリ<150>-Footnote-1165263531
Ref: ライブラリ<150>-Footnote-1175263598
Ref: ライブラリ<150>-Footnote-1185263665
Ref: ライブラリ<150>-Footnote-1195263732
Ref: ライブラリ<150>-Footnote-1205263799
Ref: ライブラリ<150>-Footnote-1215263865
Ref: ライブラリ<150>-Footnote-1225263932
Ref: ライブラリ<150>-Footnote-1235263999
Ref: ライブラリ<150>-Footnote-1245264066
Ref: ライブラリ<150>-Footnote-1255264133
Ref: ライブラリ<150>-Footnote-1265264177
Ref: ライブラリ<150>-Footnote-1275264244
Ref: ライブラリ<150>-Footnote-1285264311
Ref: ライブラリ<150>-Footnote-1295264378
Ref: ライブラリ<150>-Footnote-1305264445
Ref: ライブラリ<150>-Footnote-1315264512
Ref: ライブラリ<150>-Footnote-1325264579
Ref: ライブラリ<150>-Footnote-1335264646
Ref: ライブラリ<150>-Footnote-1345264713
Ref: ライブラリ<150>-Footnote-1355264780
Ref: ライブラリ<150>-Footnote-1365264847
Ref: ライブラリ<150>-Footnote-1375264914
Ref: ライブラリ<150>-Footnote-1385264981
Ref: ライブラリ<150>-Footnote-1395265048
Ref: ライブラリ<150>-Footnote-1405265115
Ref: ライブラリ<150>-Footnote-1415265182
Ref: ライブラリ<150>-Footnote-1425265249
Ref: ライブラリ<150>-Footnote-1435265316
Ref: ライブラリ<150>-Footnote-1445265383
Ref: ライブラリ<150>-Footnote-1455265450
Ref: ライブラリ<150>-Footnote-1465265517
Ref: ライブラリ<150>-Footnote-1475265584
Ref: ライブラリ<150>-Footnote-1485265651
Ref: ライブラリ<150>-Footnote-1495265718
Ref: ライブラリ<150>-Footnote-1505265785
Ref: ライブラリ<150>-Footnote-1515265852
Ref: ライブラリ<150>-Footnote-1525265919
Ref: ライブラリ<150>-Footnote-1535265986
Ref: ライブラリ<150>-Footnote-1545266053
Node: ドキュメント<44>5266120
Ref: whatsnew/changelog id6315266251
Ref: 1d305266251
Ref: ドキュメント<44>-Footnote-15268014
Ref: ドキュメント<44>-Footnote-25268079
Ref: ドキュメント<44>-Footnote-35268121
Ref: ドキュメント<44>-Footnote-45268186
Ref: ドキュメント<44>-Footnote-55268251
Ref: ドキュメント<44>-Footnote-65268316
Ref: ドキュメント<44>-Footnote-75268381
Ref: ドキュメント<44>-Footnote-85268446
Ref: ドキュメント<44>-Footnote-95268511
Ref: ドキュメント<44>-Footnote-105268576
Ref: ドキュメント<44>-Footnote-115268642
Ref: ドキュメント<44>-Footnote-125268708
Ref: ドキュメント<44>-Footnote-135268774
Ref: ドキュメント<44>-Footnote-145268840
Node: テスト<43>5268906
Ref: whatsnew/changelog id6325269030
Ref: 1d325269030
Ref: テスト<43>-Footnote-15271186
Ref: テスト<43>-Footnote-25271251
Ref: テスト<43>-Footnote-35271316
Ref: テスト<43>-Footnote-45271381
Ref: テスト<43>-Footnote-55271446
Ref: テスト<43>-Footnote-65271511
Ref: テスト<43>-Footnote-75271576
Ref: テスト<43>-Footnote-85271641
Ref: テスト<43>-Footnote-95271706
Ref: テスト<43>-Footnote-105271771
Ref: テスト<43>-Footnote-115271837
Ref: テスト<43>-Footnote-125271903
Ref: テスト<43>-Footnote-135271969
Ref: テスト<43>-Footnote-145272035
Ref: テスト<43>-Footnote-155272101
Ref: テスト<43>-Footnote-165272167
Node: ビルド<50>5272233
Ref: whatsnew/changelog id6335272346
Ref: 1d355272346
Ref: ビルド<50>-Footnote-15273272
Ref: ビルド<50>-Footnote-25273337
Ref: ビルド<50>-Footnote-35273402
Ref: ビルド<50>-Footnote-45273467
Ref: ビルド<50>-Footnote-55273532
Ref: ビルド<50>-Footnote-65273597
Node: Windows<44>5273662
Ref: whatsnew/changelog id6345273771
Ref: 1d365273771
Ref: Windows<44>-Footnote-15275536
Ref: Windows<44>-Footnote-25275601
Ref: Windows<44>-Footnote-35275666
Ref: Windows<44>-Footnote-45275731
Ref: Windows<44>-Footnote-55275796
Ref: Windows<44>-Footnote-65275861
Ref: Windows<44>-Footnote-75275926
Ref: Windows<44>-Footnote-85275991
Ref: Windows<44>-Footnote-95276056
Ref: Windows<44>-Footnote-105276121
Ref: Windows<44>-Footnote-115276187
Ref: Windows<44>-Footnote-125276253
Ref: Windows<44>-Footnote-135276319
Ref: Windows<44>-Footnote-145276385
Node: macOS<34>5276451
Ref: whatsnew/changelog id6355276555
Ref: 1d375276555
Ref: macOS<34>-Footnote-15277446
Ref: macOS<34>-Footnote-25277511
Ref: macOS<34>-Footnote-35277576
Ref: macOS<34>-Footnote-45277641
Ref: macOS<34>-Footnote-55277706
Ref: macOS<34>-Footnote-65277771
Node: IDLE<26>5277836
Ref: whatsnew/changelog id6365277938
Ref: 1d385277938
Ref: IDLE<26>-Footnote-15279095
Ref: IDLE<26>-Footnote-25279160
Ref: IDLE<26>-Footnote-35279225
Ref: IDLE<26>-Footnote-45279290
Ref: IDLE<26>-Footnote-55279355
Ref: IDLE<26>-Footnote-65279420
Ref: IDLE<26>-Footnote-75279485
Ref: IDLE<26>-Footnote-85279550
Ref: IDLE<26>-Footnote-95279615
Ref: IDLE<26>-Footnote-105279680
Ref: IDLE<26>-Footnote-115279746
Node: C API<45>5279812
Ref: whatsnew/changelog id6375279896
Ref: 1d395279896
Ref: C API<45>-Footnote-15285066
Ref: C API<45>-Footnote-25285131
Ref: C API<45>-Footnote-35285196
Ref: C API<45>-Footnote-45285261
Ref: C API<45>-Footnote-55285326
Ref: C API<45>-Footnote-65285391
Ref: C API<45>-Footnote-75285456
Ref: C API<45>-Footnote-85285521
Ref: C API<45>-Footnote-95285586
Ref: C API<45>-Footnote-105285651
Ref: C API<45>-Footnote-115285717
Ref: C API<45>-Footnote-125285783
Ref: C API<45>-Footnote-135285849
Ref: C API<45>-Footnote-145285915
Ref: C API<45>-Footnote-155285981
Ref: C API<45>-Footnote-165286047
Ref: C API<45>-Footnote-175286113
Ref: C API<45>-Footnote-185286179
Ref: C API<45>-Footnote-195286245
Ref: C API<45>-Footnote-205286311
Ref: C API<45>-Footnote-215286354
Ref: C API<45>-Footnote-225286420
Ref: C API<45>-Footnote-235286486
Ref: C API<45>-Footnote-245286552
Ref: C API<45>-Footnote-255286618
Ref: C API<45>-Footnote-265286684
Ref: C API<45>-Footnote-275286750
Ref: C API<45>-Footnote-285286816
Ref: C API<45>-Footnote-295286882
Node: Python 3 9 0 beta 15286948
Ref: whatsnew/changelog python-3-9-0-beta-15287075
Ref: 1d435287075
Node: セキュリティ<37>5287503
Ref: whatsnew/changelog id6385287612
Ref: 1d445287612
Ref: セキュリティ<37>-Footnote-15287830
Node: Core and Builtins<148>5287895
Ref: whatsnew/changelog id6395288033
Ref: 1d455288033
Ref: Core and Builtins<148>-Footnote-15290576
Ref: Core and Builtins<148>-Footnote-25290641
Ref: Core and Builtins<148>-Footnote-35290706
Ref: Core and Builtins<148>-Footnote-45290771
Ref: Core and Builtins<148>-Footnote-55290836
Ref: Core and Builtins<148>-Footnote-65290901
Ref: Core and Builtins<148>-Footnote-75290943
Ref: Core and Builtins<148>-Footnote-85291008
Ref: Core and Builtins<148>-Footnote-95291073
Ref: Core and Builtins<148>-Footnote-105291140
Ref: Core and Builtins<148>-Footnote-115291183
Ref: Core and Builtins<148>-Footnote-125291249
Ref: Core and Builtins<148>-Footnote-135291317
Ref: Core and Builtins<148>-Footnote-145291360
Ref: Core and Builtins<148>-Footnote-155291426
Ref: Core and Builtins<148>-Footnote-165291492
Ref: Core and Builtins<148>-Footnote-175291558
Ref: Core and Builtins<148>-Footnote-185291624
Ref: Core and Builtins<148>-Footnote-195291692
Ref: Core and Builtins<148>-Footnote-205291735
Ref: Core and Builtins<148>-Footnote-215291801
Ref: Core and Builtins<148>-Footnote-225291867
Ref: Core and Builtins<148>-Footnote-235291933
Ref: Core and Builtins<148>-Footnote-245291999
Node: ライブラリ<151>5292065
Ref: whatsnew/changelog id6405292203
Ref: 1d475292203
Ref: ライブラリ<151>-Footnote-15299596
Ref: ライブラリ<151>-Footnote-25299661
Ref: ライブラリ<151>-Footnote-35299726
Ref: ライブラリ<151>-Footnote-45299791
Ref: ライブラリ<151>-Footnote-55299856
Ref: ライブラリ<151>-Footnote-65299921
Ref: ライブラリ<151>-Footnote-75299986
Ref: ライブラリ<151>-Footnote-85300051
Ref: ライブラリ<151>-Footnote-95300116
Ref: ライブラリ<151>-Footnote-105300181
Ref: ライブラリ<151>-Footnote-115300247
Ref: ライブラリ<151>-Footnote-125300313
Ref: ライブラリ<151>-Footnote-135300379
Ref: ライブラリ<151>-Footnote-145300445
Ref: ライブラリ<151>-Footnote-155300511
Ref: ライブラリ<151>-Footnote-165300554
Ref: ライブラリ<151>-Footnote-175300620
Ref: ライブラリ<151>-Footnote-185300686
Ref: ライブラリ<151>-Footnote-195300752
Ref: ライブラリ<151>-Footnote-205300818
Ref: ライブラリ<151>-Footnote-215300884
Ref: ライブラリ<151>-Footnote-225300950
Ref: ライブラリ<151>-Footnote-235301016
Ref: ライブラリ<151>-Footnote-245301082
Ref: ライブラリ<151>-Footnote-255301148
Ref: ライブラリ<151>-Footnote-265301214
Ref: ライブラリ<151>-Footnote-275301280
Ref: ライブラリ<151>-Footnote-285301346
Ref: ライブラリ<151>-Footnote-295301412
Ref: ライブラリ<151>-Footnote-305301478
Ref: ライブラリ<151>-Footnote-315301544
Ref: ライブラリ<151>-Footnote-325301610
Ref: ライブラリ<151>-Footnote-335301676
Ref: ライブラリ<151>-Footnote-345301742
Ref: ライブラリ<151>-Footnote-355301808
Ref: ライブラリ<151>-Footnote-365301874
Ref: ライブラリ<151>-Footnote-375301940
Ref: ライブラリ<151>-Footnote-385302006
Ref: ライブラリ<151>-Footnote-395302072
Ref: ライブラリ<151>-Footnote-405302138
Ref: ライブラリ<151>-Footnote-415302204
Ref: ライブラリ<151>-Footnote-425302270
Ref: ライブラリ<151>-Footnote-435302336
Ref: ライブラリ<151>-Footnote-445302402
Ref: ライブラリ<151>-Footnote-455302468
Ref: ライブラリ<151>-Footnote-465302534
Ref: ライブラリ<151>-Footnote-475302600
Ref: ライブラリ<151>-Footnote-485302666
Ref: ライブラリ<151>-Footnote-495302732
Ref: ライブラリ<151>-Footnote-505302798
Node: ドキュメント<45>5302864
Ref: whatsnew/changelog id6415302993
Ref: 1d4c5302993
Ref: ドキュメント<45>-Footnote-15303662
Ref: ドキュメント<45>-Footnote-25303727
Ref: ドキュメント<45>-Footnote-35303792
Ref: ドキュメント<45>-Footnote-45303857
Ref: ドキュメント<45>-Footnote-55303922
Node: テスト<44>5303987
Ref: whatsnew/changelog id6425304109
Ref: 1d4d5304109
Ref: テスト<44>-Footnote-15304469
Ref: テスト<44>-Footnote-25304534
Node: ビルド<51>5304599
Ref: whatsnew/changelog id6435304710
Ref: 1d4e5304710
Ref: ビルド<51>-Footnote-15305055
Ref: ビルド<51>-Footnote-25305120
Node: Windows<45>5305185
Ref: whatsnew/changelog id6445305292
Ref: 1d4f5305292
Ref: Windows<45>-Footnote-15305745
Ref: Windows<45>-Footnote-25305810
Ref: Windows<45>-Footnote-35305875
Node: macOS<35>5305940
Ref: whatsnew/changelog id6455306049
Ref: 1d505306049
Ref: macOS<35>-Footnote-15306672
Ref: macOS<35>-Footnote-25306737
Node: Tools/Demos<30>5306802
Ref: whatsnew/changelog id6465306909
Ref: 1d515306909
Ref: Tools/Demos<30>-Footnote-15307394
Ref: Tools/Demos<30>-Footnote-25307459
Ref: Tools/Demos<30>-Footnote-35307524
Node: C API<46>5307589
Ref: whatsnew/changelog id6475307678
Ref: 1d525307678
Ref: C API<46>-Footnote-15309704
Ref: C API<46>-Footnote-25309769
Ref: C API<46>-Footnote-35309834
Ref: C API<46>-Footnote-45309899
Ref: C API<46>-Footnote-55309964
Ref: C API<46>-Footnote-65310029
Ref: C API<46>-Footnote-75310094
Ref: C API<46>-Footnote-85310159
Ref: C API<46>-Footnote-95310224
Ref: C API<46>-Footnote-105310289
Ref: C API<46>-Footnote-115310355
Node: Python 3 9 0 alpha 65310398
Ref: whatsnew/changelog python-3-9-0-alpha-65310524
Ref: 1d535310524
Node: セキュリティ<38>5310972
Ref: whatsnew/changelog id6485311082
Ref: 1d545311082
Ref: セキュリティ<38>-Footnote-15311744
Ref: セキュリティ<38>-Footnote-25311809
Ref: セキュリティ<38>-Footnote-35311874
Ref: セキュリティ<38>-Footnote-45311939
Node: Core and Builtins<149>5311994
Ref: whatsnew/changelog id6495312133
Ref: 1d555312133
Ref: Core and Builtins<149>-Footnote-15315907
Ref: Core and Builtins<149>-Footnote-25315972
Ref: Core and Builtins<149>-Footnote-35316037
Ref: Core and Builtins<149>-Footnote-45316102
Ref: Core and Builtins<149>-Footnote-55316167
Ref: Core and Builtins<149>-Footnote-65316232
Ref: Core and Builtins<149>-Footnote-75316297
Ref: Core and Builtins<149>-Footnote-85316362
Ref: Core and Builtins<149>-Footnote-95316427
Ref: Core and Builtins<149>-Footnote-105316492
Ref: Core and Builtins<149>-Footnote-115316535
Ref: Core and Builtins<149>-Footnote-125316601
Ref: Core and Builtins<149>-Footnote-135316669
Ref: Core and Builtins<149>-Footnote-145316712
Ref: Core and Builtins<149>-Footnote-155316780
Ref: Core and Builtins<149>-Footnote-165316823
Ref: Core and Builtins<149>-Footnote-175316891
Ref: Core and Builtins<149>-Footnote-185316934
Ref: Core and Builtins<149>-Footnote-195317000
Ref: Core and Builtins<149>-Footnote-205317066
Ref: Core and Builtins<149>-Footnote-215317134
Ref: Core and Builtins<149>-Footnote-225317202
Ref: Core and Builtins<149>-Footnote-235317268
Ref: Core and Builtins<149>-Footnote-245317336
Ref: Core and Builtins<149>-Footnote-255317379
Ref: Core and Builtins<149>-Footnote-265317447
Ref: Core and Builtins<149>-Footnote-275317490
Ref: Core and Builtins<149>-Footnote-285317556
Ref: Core and Builtins<149>-Footnote-295317622
Ref: Core and Builtins<149>-Footnote-305317665
Ref: Core and Builtins<149>-Footnote-315317731
Ref: Core and Builtins<149>-Footnote-325317797
Ref: Core and Builtins<149>-Footnote-335317863
Node: ライブラリ<152>5317906
Ref: whatsnew/changelog id6505318045
Ref: 1d565318045
Ref: ライブラリ<152>-Footnote-15328296
Ref: ライブラリ<152>-Footnote-25328361
Ref: ライブラリ<152>-Footnote-35328426
Ref: ライブラリ<152>-Footnote-45328491
Ref: ライブラリ<152>-Footnote-55328556
Ref: ライブラリ<152>-Footnote-65328621
Ref: ライブラリ<152>-Footnote-75328663
Ref: ライブラリ<152>-Footnote-85328728
Ref: ライブラリ<152>-Footnote-95328793
Ref: ライブラリ<152>-Footnote-105328858
Ref: ライブラリ<152>-Footnote-115328924
Ref: ライブラリ<152>-Footnote-125328990
Ref: ライブラリ<152>-Footnote-135329056
Ref: ライブラリ<152>-Footnote-145329122
Ref: ライブラリ<152>-Footnote-155329188
Ref: ライブラリ<152>-Footnote-165329254
Ref: ライブラリ<152>-Footnote-175329320
Ref: ライブラリ<152>-Footnote-185329386
Ref: ライブラリ<152>-Footnote-195329452
Ref: ライブラリ<152>-Footnote-205329518
Ref: ライブラリ<152>-Footnote-215329584
Ref: ライブラリ<152>-Footnote-225329650
Ref: ライブラリ<152>-Footnote-235329716
Ref: ライブラリ<152>-Footnote-245329782
Ref: ライブラリ<152>-Footnote-255329848
Ref: ライブラリ<152>-Footnote-265329914
Ref: ライブラリ<152>-Footnote-275329980
Ref: ライブラリ<152>-Footnote-285330046
Ref: ライブラリ<152>-Footnote-295330112
Ref: ライブラリ<152>-Footnote-305330178
Ref: ライブラリ<152>-Footnote-315330244
Ref: ライブラリ<152>-Footnote-325330310
Ref: ライブラリ<152>-Footnote-335330376
Ref: ライブラリ<152>-Footnote-345330442
Ref: ライブラリ<152>-Footnote-355330508
Ref: ライブラリ<152>-Footnote-365330574
Ref: ライブラリ<152>-Footnote-375330640
Ref: ライブラリ<152>-Footnote-385330706
Ref: ライブラリ<152>-Footnote-395330772
Ref: ライブラリ<152>-Footnote-405330838
Ref: ライブラリ<152>-Footnote-415330904
Ref: ライブラリ<152>-Footnote-425330970
Ref: ライブラリ<152>-Footnote-435331036
Ref: ライブラリ<152>-Footnote-445331102
Ref: ライブラリ<152>-Footnote-455331168
Ref: ライブラリ<152>-Footnote-465331234
Ref: ライブラリ<152>-Footnote-475331300
Ref: ライブラリ<152>-Footnote-485331366
Ref: ライブラリ<152>-Footnote-495331409
Ref: ライブラリ<152>-Footnote-505331475
Ref: ライブラリ<152>-Footnote-515331518
Ref: ライブラリ<152>-Footnote-525331584
Ref: ライブラリ<152>-Footnote-535331650
Ref: ライブラリ<152>-Footnote-545331716
Ref: ライブラリ<152>-Footnote-555331759
Ref: ライブラリ<152>-Footnote-565331825
Ref: ライブラリ<152>-Footnote-575331891
Ref: ライブラリ<152>-Footnote-585331957
Ref: ライブラリ<152>-Footnote-595332023
Ref: ライブラリ<152>-Footnote-605332089
Ref: ライブラリ<152>-Footnote-615332155
Node: ドキュメント<46>5332221
Ref: whatsnew/changelog id6515332351
Ref: 1d595332351
Ref: ドキュメント<46>-Footnote-15332936
Ref: ドキュメント<46>-Footnote-25333001
Ref: ドキュメント<46>-Footnote-35333066
Ref: ドキュメント<46>-Footnote-45333131
Node: テスト<45>5333196
Ref: whatsnew/changelog id6525333319
Ref: 1d5c5333319
Ref: テスト<45>-Footnote-15334405
Ref: テスト<45>-Footnote-25334470
Ref: テスト<45>-Footnote-35334535
Ref: テスト<45>-Footnote-45334600
Ref: テスト<45>-Footnote-55334665
Ref: テスト<45>-Footnote-65334730
Ref: テスト<45>-Footnote-75334795
Ref: テスト<45>-Footnote-85334854
Ref: テスト<45>-Footnote-95334919
Node: ビルド<52>5334983
Ref: whatsnew/changelog id6535335095
Ref: 1d5e5335095
Ref: ビルド<52>-Footnote-15335513
Ref: ビルド<52>-Footnote-25335578
Ref: ビルド<52>-Footnote-35335643
Node: Windows<46>5335708
Ref: whatsnew/changelog id6545335816
Ref: 1d5f5335816
Ref: Windows<46>-Footnote-15336029
Ref: Windows<46>-Footnote-25336094
Node: macOS<36>5336158
Ref: whatsnew/changelog id6555336261
Ref: 1d605336261
Ref: macOS<36>-Footnote-15336717
Ref: macOS<36>-Footnote-25336782
Node: IDLE<27>5336847
Ref: whatsnew/changelog id6565336954
Ref: 1d615336954
Ref: IDLE<27>-Footnote-15337298
Ref: IDLE<27>-Footnote-25337363
Node: Tools/Demos<31>5337428
Ref: whatsnew/changelog id6575337535
Ref: 1d625337535
Ref: Tools/Demos<31>-Footnote-15338002
Ref: Tools/Demos<31>-Footnote-25338067
Ref: Tools/Demos<31>-Footnote-35338132
Node: C API<47>5338197
Ref: whatsnew/changelog id6585338287
Ref: 1d635338287
Ref: C API<47>-Footnote-15340262
Ref: C API<47>-Footnote-25340327
Ref: C API<47>-Footnote-35340392
Ref: C API<47>-Footnote-45340457
Ref: C API<47>-Footnote-55340522
Ref: C API<47>-Footnote-65340587
Ref: C API<47>-Footnote-75340652
Ref: C API<47>-Footnote-85340717
Ref: C API<47>-Footnote-95340782
Node: Python 3 9 0 alpha 55340847
Ref: whatsnew/changelog python-3-9-0-alpha-55340974
Ref: 1d645340974
Node: セキュリティ<39>5341422
Ref: whatsnew/changelog id6595341532
Ref: 1d655341532
Ref: セキュリティ<39>-Footnote-15341830
Ref: セキュリティ<39>-Footnote-25341895
Node: Core and Builtins<150>5341951
Ref: whatsnew/changelog id6605342090
Ref: 1d665342090
Ref: Core and Builtins<150>-Footnote-15347935
Ref: Core and Builtins<150>-Footnote-25348000
Ref: Core and Builtins<150>-Footnote-35348067
Ref: Core and Builtins<150>-Footnote-45348109
Ref: Core and Builtins<150>-Footnote-55348176
Ref: Core and Builtins<150>-Footnote-65348218
Ref: Core and Builtins<150>-Footnote-75348283
Ref: Core and Builtins<150>-Footnote-85348348
Ref: Core and Builtins<150>-Footnote-95348415
Ref: Core and Builtins<150>-Footnote-105348482
Ref: Core and Builtins<150>-Footnote-115348525
Ref: Core and Builtins<150>-Footnote-125348591
Ref: Core and Builtins<150>-Footnote-135348634
Ref: Core and Builtins<150>-Footnote-145348700
Ref: Core and Builtins<150>-Footnote-155348766
Ref: Core and Builtins<150>-Footnote-165348809
Ref: Core and Builtins<150>-Footnote-175348877
Ref: Core and Builtins<150>-Footnote-185348920
Ref: Core and Builtins<150>-Footnote-195348986
Ref: Core and Builtins<150>-Footnote-205349052
Ref: Core and Builtins<150>-Footnote-215349118
Ref: Core and Builtins<150>-Footnote-225349184
Ref: Core and Builtins<150>-Footnote-235349227
Ref: Core and Builtins<150>-Footnote-245349293
Ref: Core and Builtins<150>-Footnote-255349359
Ref: Core and Builtins<150>-Footnote-265349425
Ref: Core and Builtins<150>-Footnote-275349491
Ref: Core and Builtins<150>-Footnote-285349557
Ref: Core and Builtins<150>-Footnote-295349623
Ref: Core and Builtins<150>-Footnote-305349689
Ref: Core and Builtins<150>-Footnote-315349755
Ref: Core and Builtins<150>-Footnote-325349823
Ref: Core and Builtins<150>-Footnote-335349866
Ref: Core and Builtins<150>-Footnote-345349932
Ref: Core and Builtins<150>-Footnote-355349975
Ref: Core and Builtins<150>-Footnote-365350041
Ref: Core and Builtins<150>-Footnote-375350109
Ref: Core and Builtins<150>-Footnote-385350152
Ref: Core and Builtins<150>-Footnote-395350218
Ref: Core and Builtins<150>-Footnote-405350284
Ref: Core and Builtins<150>-Footnote-415350350
Ref: Core and Builtins<150>-Footnote-425350416
Node: ライブラリ<153>5350482
Ref: whatsnew/changelog id6615350621
Ref: 1d675350621
Ref: ライブラリ<153>-Footnote-15359751
Ref: ライブラリ<153>-Footnote-25359816
Ref: ライブラリ<153>-Footnote-35359881
Ref: ライブラリ<153>-Footnote-45359946
Ref: ライブラリ<153>-Footnote-55360011
Ref: ライブラリ<153>-Footnote-65360076
Ref: ライブラリ<153>-Footnote-75360141
Ref: ライブラリ<153>-Footnote-85360206
Ref: ライブラリ<153>-Footnote-95360271
Ref: ライブラリ<153>-Footnote-105360336
Ref: ライブラリ<153>-Footnote-115360402
Ref: ライブラリ<153>-Footnote-125360468
Ref: ライブラリ<153>-Footnote-135360511
Ref: ライブラリ<153>-Footnote-145360577
Ref: ライブラリ<153>-Footnote-155360643
Ref: ライブラリ<153>-Footnote-165360709
Ref: ライブラリ<153>-Footnote-175360752
Ref: ライブラリ<153>-Footnote-185360818
Ref: ライブラリ<153>-Footnote-195360884
Ref: ライブラリ<153>-Footnote-205360950
Ref: ライブラリ<153>-Footnote-215361016
Ref: ライブラリ<153>-Footnote-225361082
Ref: ライブラリ<153>-Footnote-235361148
Ref: ライブラリ<153>-Footnote-245361214
Ref: ライブラリ<153>-Footnote-255361280
Ref: ライブラリ<153>-Footnote-265361346
Ref: ライブラリ<153>-Footnote-275361412
Ref: ライブラリ<153>-Footnote-285361478
Ref: ライブラリ<153>-Footnote-295361544
Ref: ライブラリ<153>-Footnote-305361610
Ref: ライブラリ<153>-Footnote-315361676
Ref: ライブラリ<153>-Footnote-325361742
Ref: ライブラリ<153>-Footnote-335361785
Ref: ライブラリ<153>-Footnote-345361851
Ref: ライブラリ<153>-Footnote-355361917
Ref: ライブラリ<153>-Footnote-365361983
Ref: ライブラリ<153>-Footnote-375362049
Ref: ライブラリ<153>-Footnote-385362115
Ref: ライブラリ<153>-Footnote-395362181
Ref: ライブラリ<153>-Footnote-405362224
Ref: ライブラリ<153>-Footnote-415362290
Ref: ライブラリ<153>-Footnote-425362356
Ref: ライブラリ<153>-Footnote-435362422
Ref: ライブラリ<153>-Footnote-445362488
Ref: ライブラリ<153>-Footnote-455362554
Ref: ライブラリ<153>-Footnote-465362620
Ref: ライブラリ<153>-Footnote-475362686
Ref: ライブラリ<153>-Footnote-485362752
Ref: ライブラリ<153>-Footnote-495362818
Ref: ライブラリ<153>-Footnote-505362884
Ref: ライブラリ<153>-Footnote-515362950
Ref: ライブラリ<153>-Footnote-525363016
Ref: ライブラリ<153>-Footnote-535363082
Ref: ライブラリ<153>-Footnote-545363148
Node: ドキュメント<47>5363214
Ref: whatsnew/changelog id6625363344
Ref: 1d6d5363344
Ref: ドキュメント<47>-Footnote-15363983
Ref: ドキュメント<47>-Footnote-25364048
Ref: ドキュメント<47>-Footnote-35364090
Ref: ドキュメント<47>-Footnote-45364155
Ref: ドキュメント<47>-Footnote-55364220
Ref: ドキュメント<47>-Footnote-65364285
Ref: ドキュメント<47>-Footnote-75364350
Node: テスト<46>5364415
Ref: whatsnew/changelog id6635364538
Ref: 1d6e5364538
Ref: テスト<46>-Footnote-15365221
Ref: テスト<46>-Footnote-25365286
Ref: テスト<46>-Footnote-35365351
Ref: テスト<46>-Footnote-45365416
Node: ビルド<53>5365481
Ref: whatsnew/changelog id6645365593
Ref: 1d6f5365593
Ref: ビルド<53>-Footnote-15366473
Ref: ビルド<53>-Footnote-25366538
Ref: ビルド<53>-Footnote-35366603
Node: Windows<47>5366670
Ref: whatsnew/changelog id6655366778
Ref: 1d705366778
Ref: Windows<47>-Footnote-15367660
Ref: Windows<47>-Footnote-25367725
Ref: Windows<47>-Footnote-35367790
Ref: Windows<47>-Footnote-45367855
Ref: Windows<47>-Footnote-55367920
Ref: Windows<47>-Footnote-65367985
Node: macOS<37>5368050
Ref: whatsnew/changelog id6665368153
Ref: 1d715368153
Ref: macOS<37>-Footnote-15368283
Node: IDLE<28>5368348
Ref: whatsnew/changelog id6675368455
Ref: 1d725368455
Ref: IDLE<28>-Footnote-15369009
Ref: IDLE<28>-Footnote-25369074
Ref: IDLE<28>-Footnote-35369139
Ref: IDLE<28>-Footnote-45369204
Node: Tools/Demos<32>5369269
Ref: whatsnew/changelog id6685369376
Ref: 1d735369376
Ref: Tools/Demos<32>-Footnote-15369905
Ref: Tools/Demos<32>-Footnote-25369970
Node: C API<48>5370035
Ref: whatsnew/changelog id6695370125
Ref: 1d745370125
Ref: C API<48>-Footnote-15373669
Ref: C API<48>-Footnote-25373734
Ref: C API<48>-Footnote-35373799
Ref: C API<48>-Footnote-45373864
Ref: C API<48>-Footnote-55373929
Ref: C API<48>-Footnote-65373994
Ref: C API<48>-Footnote-75374059
Ref: C API<48>-Footnote-85374124
Ref: C API<48>-Footnote-95374189
Ref: C API<48>-Footnote-105374254
Ref: C API<48>-Footnote-115374320
Ref: C API<48>-Footnote-125374386
Ref: C API<48>-Footnote-135374452
Ref: C API<48>-Footnote-145374518
Ref: C API<48>-Footnote-155374584
Ref: C API<48>-Footnote-165374650
Ref: C API<48>-Footnote-175374716
Node: Python 3 9 0 alpha 45374782
Ref: whatsnew/changelog python-3-9-0-alpha-45374909
Ref: 1d795374909
Node: セキュリティ<40>5375302
Ref: whatsnew/changelog id6705375412
Ref: 1d7a5375412
Ref: セキュリティ<40>-Footnote-15375837
Ref: セキュリティ<40>-Footnote-25375902
Ref: セキュリティ<40>-Footnote-35375967
Node: Core and Builtins<151>5376032
Ref: whatsnew/changelog id6715376171
Ref: 1d7b5376171
Ref: Core and Builtins<151>-Footnote-15379574
Ref: Core and Builtins<151>-Footnote-25379639
Ref: Core and Builtins<151>-Footnote-35379704
Ref: Core and Builtins<151>-Footnote-45379769
Ref: Core and Builtins<151>-Footnote-55379834
Ref: Core and Builtins<151>-Footnote-65379899
Ref: Core and Builtins<151>-Footnote-75379964
Ref: Core and Builtins<151>-Footnote-85380029
Ref: Core and Builtins<151>-Footnote-95380096
Ref: Core and Builtins<151>-Footnote-105380138
Ref: Core and Builtins<151>-Footnote-115380206
Ref: Core and Builtins<151>-Footnote-125380249
Ref: Core and Builtins<151>-Footnote-135380315
Ref: Core and Builtins<151>-Footnote-145380381
Ref: Core and Builtins<151>-Footnote-155380447
Ref: Core and Builtins<151>-Footnote-165380513
Ref: Core and Builtins<151>-Footnote-175380579
Ref: Core and Builtins<151>-Footnote-185380647
Ref: Core and Builtins<151>-Footnote-195380690
Ref: Core and Builtins<151>-Footnote-205380758
Ref: Core and Builtins<151>-Footnote-215380801
Ref: Core and Builtins<151>-Footnote-225380869
Ref: Core and Builtins<151>-Footnote-235380912
Ref: Core and Builtins<151>-Footnote-245380978
Ref: Core and Builtins<151>-Footnote-255381044
Ref: Core and Builtins<151>-Footnote-265381110
Ref: Core and Builtins<151>-Footnote-275381176
Ref: Core and Builtins<151>-Footnote-285381242
Ref: Core and Builtins<151>-Footnote-295381308
Node: ライブラリ<154>5381374
Ref: whatsnew/changelog id6725381513
Ref: 1d7e5381513
Ref: ライブラリ<154>-Footnote-15387707
Ref: ライブラリ<154>-Footnote-25387772
Ref: ライブラリ<154>-Footnote-35387837
Ref: ライブラリ<154>-Footnote-45387902
Ref: ライブラリ<154>-Footnote-55387967
Ref: ライブラリ<154>-Footnote-65388032
Ref: ライブラリ<154>-Footnote-75388097
Ref: ライブラリ<154>-Footnote-85388162
Ref: ライブラリ<154>-Footnote-95388227
Ref: ライブラリ<154>-Footnote-105388292
Ref: ライブラリ<154>-Footnote-115388358
Ref: ライブラリ<154>-Footnote-125388424
Ref: ライブラリ<154>-Footnote-135388490
Ref: ライブラリ<154>-Footnote-145388556
Ref: ライブラリ<154>-Footnote-155388622
Ref: ライブラリ<154>-Footnote-165388688
Ref: ライブラリ<154>-Footnote-175388770
Ref: ライブラリ<154>-Footnote-185388836
Ref: ライブラリ<154>-Footnote-195388902
Ref: ライブラリ<154>-Footnote-205388968
Ref: ライブラリ<154>-Footnote-215389034
Ref: ライブラリ<154>-Footnote-225389100
Ref: ライブラリ<154>-Footnote-235389166
Ref: ライブラリ<154>-Footnote-245389232
Ref: ライブラリ<154>-Footnote-255389298
Ref: ライブラリ<154>-Footnote-265389364
Ref: ライブラリ<154>-Footnote-275389430
Ref: ライブラリ<154>-Footnote-285389473
Ref: ライブラリ<154>-Footnote-295389539
Ref: ライブラリ<154>-Footnote-305389605
Ref: ライブラリ<154>-Footnote-315389671
Ref: ライブラリ<154>-Footnote-325389737
Ref: ライブラリ<154>-Footnote-335389803
Ref: ライブラリ<154>-Footnote-345389869
Ref: ライブラリ<154>-Footnote-355389935
Ref: ライブラリ<154>-Footnote-365390001
Ref: ライブラリ<154>-Footnote-375390067
Ref: ライブラリ<154>-Footnote-385390133
Ref: ライブラリ<154>-Footnote-395390199
Node: ドキュメント<48>5390265
Ref: whatsnew/changelog id6735390395
Ref: 1d805390395
Ref: ドキュメント<48>-Footnote-15391430
Ref: ドキュメント<48>-Footnote-25391495
Ref: ドキュメント<48>-Footnote-35391560
Ref: ドキュメント<48>-Footnote-45391625
Ref: ドキュメント<48>-Footnote-55391690
Ref: ドキュメント<48>-Footnote-65391755
Ref: ドキュメント<48>-Footnote-75391820
Node: テスト<47>5391884
Ref: whatsnew/changelog id6745392007
Ref: 1d815392007
Ref: テスト<47>-Footnote-15392346
Ref: テスト<47>-Footnote-25392411
Node: ビルド<54>5392476
Ref: whatsnew/changelog id6755392588
Ref: 1d825392588
Ref: ビルド<54>-Footnote-15392723
Node: Windows<48>5392788
Ref: whatsnew/changelog id6765392895
Ref: 1d835392895
Ref: Windows<48>-Footnote-15393703
Ref: Windows<48>-Footnote-25393768
Ref: Windows<48>-Footnote-35393833
Ref: Windows<48>-Footnote-45393898
Ref: Windows<48>-Footnote-55393963
Ref: Windows<48>-Footnote-65394028
Node: IDLE<29>5394093
Ref: whatsnew/changelog id6775394196
Ref: 1d845394196
Ref: IDLE<29>-Footnote-15394743
Ref: IDLE<29>-Footnote-25394808
Ref: IDLE<29>-Footnote-35394873
Ref: IDLE<29>-Footnote-45394938
Ref: IDLE<29>-Footnote-55395003
Node: C API<49>5395068
Ref: whatsnew/changelog id6785395151
Ref: 1d855395151
Ref: C API<49>-Footnote-15397810
Ref: C API<49>-Footnote-25397875
Ref: C API<49>-Footnote-35397940
Ref: C API<49>-Footnote-45398005
Ref: C API<49>-Footnote-55398070
Ref: C API<49>-Footnote-65398135
Ref: C API<49>-Footnote-75398200
Ref: C API<49>-Footnote-85398265
Ref: C API<49>-Footnote-95398330
Ref: C API<49>-Footnote-105398395
Ref: C API<49>-Footnote-115398461
Ref: C API<49>-Footnote-125398527
Node: Python 3 9 0 alpha 35398593
Ref: whatsnew/changelog python-3-9-0-alpha-35398720
Ref: 1d8a5398720
Node: Core and Builtins<152>5399015
Ref: whatsnew/changelog id6795399123
Ref: 1d8b5399123
Ref: Core and Builtins<152>-Footnote-15403209
Ref: Core and Builtins<152>-Footnote-25403274
Ref: Core and Builtins<152>-Footnote-35403339
Ref: Core and Builtins<152>-Footnote-45403404
Ref: Core and Builtins<152>-Footnote-55403469
Ref: Core and Builtins<152>-Footnote-65403534
Ref: Core and Builtins<152>-Footnote-75403599
Ref: Core and Builtins<152>-Footnote-85403664
Ref: Core and Builtins<152>-Footnote-95403729
Ref: Core and Builtins<152>-Footnote-105403794
Ref: Core and Builtins<152>-Footnote-115403860
Ref: Core and Builtins<152>-Footnote-125403928
Ref: Core and Builtins<152>-Footnote-135403971
Ref: Core and Builtins<152>-Footnote-145404037
Ref: Core and Builtins<152>-Footnote-155404103
Ref: Core and Builtins<152>-Footnote-165404169
Ref: Core and Builtins<152>-Footnote-175404235
Ref: Core and Builtins<152>-Footnote-185404301
Ref: Core and Builtins<152>-Footnote-195404367
Ref: Core and Builtins<152>-Footnote-205404433
Ref: Core and Builtins<152>-Footnote-215404499
Ref: Core and Builtins<152>-Footnote-225404565
Ref: Core and Builtins<152>-Footnote-235404631
Ref: Core and Builtins<152>-Footnote-245404697
Node: ライブラリ<155>5404763
Ref: whatsnew/changelog id6805404902
Ref: 1d8f5404902
Ref: ライブラリ<155>-Footnote-15414517
Ref: ライブラリ<155>-Footnote-25414582
Ref: ライブラリ<155>-Footnote-35414647
Ref: ライブラリ<155>-Footnote-45414712
Ref: ライブラリ<155>-Footnote-55414777
Ref: ライブラリ<155>-Footnote-65414842
Ref: ライブラリ<155>-Footnote-75414907
Ref: ライブラリ<155>-Footnote-85414972
Ref: ライブラリ<155>-Footnote-95415037
Ref: ライブラリ<155>-Footnote-105415102
Ref: ライブラリ<155>-Footnote-115415168
Ref: ライブラリ<155>-Footnote-125415234
Ref: ライブラリ<155>-Footnote-135415300
Ref: ライブラリ<155>-Footnote-145415366
Ref: ライブラリ<155>-Footnote-155415432
Ref: ライブラリ<155>-Footnote-165415498
Ref: ライブラリ<155>-Footnote-175415564
Ref: ライブラリ<155>-Footnote-185415630
Ref: ライブラリ<155>-Footnote-195415696
Ref: ライブラリ<155>-Footnote-205415762
Ref: ライブラリ<155>-Footnote-215415828
Ref: ライブラリ<155>-Footnote-225415894
Ref: ライブラリ<155>-Footnote-235415960
Ref: ライブラリ<155>-Footnote-245416026
Ref: ライブラリ<155>-Footnote-255416092
Ref: ライブラリ<155>-Footnote-265416158
Ref: ライブラリ<155>-Footnote-275416224
Ref: ライブラリ<155>-Footnote-285416290
Ref: ライブラリ<155>-Footnote-295416356
Ref: ライブラリ<155>-Footnote-305416422
Ref: ライブラリ<155>-Footnote-315416488
Ref: ライブラリ<155>-Footnote-325416554
Ref: ライブラリ<155>-Footnote-335416620
Ref: ライブラリ<155>-Footnote-345416686
Ref: ライブラリ<155>-Footnote-355416752
Ref: ライブラリ<155>-Footnote-365416818
Ref: ライブラリ<155>-Footnote-375416884
Ref: ライブラリ<155>-Footnote-385416950
Ref: ライブラリ<155>-Footnote-395417016
Ref: ライブラリ<155>-Footnote-405417082
Ref: ライブラリ<155>-Footnote-415417148
Ref: ライブラリ<155>-Footnote-425417214
Ref: ライブラリ<155>-Footnote-435417280
Ref: ライブラリ<155>-Footnote-445417346
Ref: ライブラリ<155>-Footnote-455417412
Ref: ライブラリ<155>-Footnote-465417478
Ref: ライブラリ<155>-Footnote-475417544
Ref: ライブラリ<155>-Footnote-485417610
Ref: ライブラリ<155>-Footnote-495417676
Ref: ライブラリ<155>-Footnote-505417742
Ref: ライブラリ<155>-Footnote-515417808
Ref: ライブラリ<155>-Footnote-525417874
Ref: ライブラリ<155>-Footnote-535417940
Node: ドキュメント<49>5418006
Ref: whatsnew/changelog id6815418136
Ref: 1d915418136
Ref: ドキュメント<49>-Footnote-15418748
Ref: ドキュメント<49>-Footnote-25418813
Ref: ドキュメント<49>-Footnote-35418878
Node: ビルド<55>5418942
Ref: whatsnew/changelog id6825419060
Ref: 1d935419060
Ref: ビルド<55>-Footnote-15419591
Ref: ビルド<55>-Footnote-25419656
Ref: ビルド<55>-Footnote-35419721
Node: IDLE<30>5419786
Ref: whatsnew/changelog id6835419891
Ref: 1d945419891
Ref: IDLE<30>-Footnote-15420312
Ref: IDLE<30>-Footnote-25420377
Ref: IDLE<30>-Footnote-35420442
Node: C API<50>5420507
Ref: whatsnew/changelog id6845420590
Ref: 1d955420590
Ref: C API<50>-Footnote-15421355
Ref: C API<50>-Footnote-25421420
Node: Python 3 9 0 alpha 25421485
Ref: whatsnew/changelog python-3-9-0-alpha-25421612
Ref: 1d965421612
Node: セキュリティ<41>5422025
Ref: whatsnew/changelog id6855422135
Ref: 1d975422135
Ref: セキュリティ<41>-Footnote-15423022
Ref: セキュリティ<41>-Footnote-25423087
Ref: セキュリティ<41>-Footnote-35423152
Ref: セキュリティ<41>-Footnote-45423217
Node: Core and Builtins<153>5423282
Ref: whatsnew/changelog id6865423421
Ref: 1d985423421
Ref: Core and Builtins<153>-Footnote-15427090
Ref: Core and Builtins<153>-Footnote-25427155
Ref: Core and Builtins<153>-Footnote-35427220
Ref: Core and Builtins<153>-Footnote-45427285
Ref: Core and Builtins<153>-Footnote-55427350
Ref: Core and Builtins<153>-Footnote-65427415
Ref: Core and Builtins<153>-Footnote-75427480
Ref: Core and Builtins<153>-Footnote-85427545
Ref: Core and Builtins<153>-Footnote-95427610
Ref: Core and Builtins<153>-Footnote-105427675
Ref: Core and Builtins<153>-Footnote-115427741
Ref: Core and Builtins<153>-Footnote-125427807
Ref: Core and Builtins<153>-Footnote-135427873
Ref: Core and Builtins<153>-Footnote-145427939
Ref: Core and Builtins<153>-Footnote-155428005
Ref: Core and Builtins<153>-Footnote-165428071
Ref: Core and Builtins<153>-Footnote-175428137
Ref: Core and Builtins<153>-Footnote-185428203
Ref: Core and Builtins<153>-Footnote-195428269
Ref: Core and Builtins<153>-Footnote-205428335
Node: ライブラリ<156>5428401
Ref: whatsnew/changelog id6875428540
Ref: 1d995428540
Ref: ライブラリ<156>-Footnote-15436336
Ref: ライブラリ<156>-Footnote-25436401
Ref: ライブラリ<156>-Footnote-35436466
Ref: ライブラリ<156>-Footnote-45436531
Ref: ライブラリ<156>-Footnote-55436596
Ref: ライブラリ<156>-Footnote-65436661
Ref: ライブラリ<156>-Footnote-75436726
Ref: ライブラリ<156>-Footnote-85436791
Ref: ライブラリ<156>-Footnote-95436856
Ref: ライブラリ<156>-Footnote-105436921
Ref: ライブラリ<156>-Footnote-115436987
Ref: ライブラリ<156>-Footnote-125437053
Ref: ライブラリ<156>-Footnote-135437119
Ref: ライブラリ<156>-Footnote-145437185
Ref: ライブラリ<156>-Footnote-155437251
Ref: ライブラリ<156>-Footnote-165437317
Ref: ライブラリ<156>-Footnote-175437383
Ref: ライブラリ<156>-Footnote-185437449
Ref: ライブラリ<156>-Footnote-195437515
Ref: ライブラリ<156>-Footnote-205437581
Ref: ライブラリ<156>-Footnote-215437647
Ref: ライブラリ<156>-Footnote-225437713
Ref: ライブラリ<156>-Footnote-235437779
Ref: ライブラリ<156>-Footnote-245437845
Ref: ライブラリ<156>-Footnote-255437911
Ref: ライブラリ<156>-Footnote-265437977
Ref: ライブラリ<156>-Footnote-275438043
Ref: ライブラリ<156>-Footnote-285438109
Ref: ライブラリ<156>-Footnote-295438175
Ref: ライブラリ<156>-Footnote-305438241
Ref: ライブラリ<156>-Footnote-315438307
Ref: ライブラリ<156>-Footnote-325438373
Ref: ライブラリ<156>-Footnote-335438439
Ref: ライブラリ<156>-Footnote-345438505
Ref: ライブラリ<156>-Footnote-355438571
Ref: ライブラリ<156>-Footnote-365438637
Ref: ライブラリ<156>-Footnote-375438703
Ref: ライブラリ<156>-Footnote-385438769
Ref: ライブラリ<156>-Footnote-395438835
Ref: ライブラリ<156>-Footnote-405438901
Node: ドキュメント<50>5438967
Ref: whatsnew/changelog id6885439097
Ref: 1d9a5439097
Ref: ドキュメント<50>-Footnote-15439686
Ref: ドキュメント<50>-Footnote-25439751
Ref: ドキュメント<50>-Footnote-35439816
Node: テスト<48>5439881
Ref: whatsnew/changelog id6895440004
Ref: 1d9b5440004
Ref: テスト<48>-Footnote-15442575
Ref: テスト<48>-Footnote-25442640
Ref: テスト<48>-Footnote-35442705
Ref: テスト<48>-Footnote-45442770
Ref: テスト<48>-Footnote-55442835
Ref: テスト<48>-Footnote-65442900
Ref: テスト<48>-Footnote-75442965
Ref: テスト<48>-Footnote-85443030
Ref: テスト<48>-Footnote-95443095
Ref: テスト<48>-Footnote-105443160
Ref: テスト<48>-Footnote-115443226
Ref: テスト<48>-Footnote-125443292
Ref: テスト<48>-Footnote-135443358
Node: ビルド<56>5443424
Ref: whatsnew/changelog id6905443536
Ref: 1d9f5443536
Ref: ビルド<56>-Footnote-15443939
Ref: ビルド<56>-Footnote-25444004
Node: Windows<49>5444069
Ref: whatsnew/changelog id6915444177
Ref: 1da05444177
Ref: Windows<49>-Footnote-15444418
Ref: Windows<49>-Footnote-25444483
Node: macOS<38>5444548
Ref: whatsnew/changelog id6925444651
Ref: 1da15444651
Ref: macOS<38>-Footnote-15444959
Node: IDLE<31>5445024
Ref: whatsnew/changelog id6935445125
Ref: 1da25445125
Ref: IDLE<31>-Footnote-15445716
Ref: IDLE<31>-Footnote-25445781
Ref: IDLE<31>-Footnote-35445846
Ref: IDLE<31>-Footnote-45445911
Node: C API<51>5445976
Ref: whatsnew/changelog id6945446059
Ref: 1da35446059
Ref: C API<51>-Footnote-15446593
Ref: C API<51>-Footnote-25446658
Ref: C API<51>-Footnote-35446723
Node: Python 3 9 0 alpha 15446788
Ref: whatsnew/changelog python-3-9-0-alpha-15446914
Ref: 1da45446914
Node: セキュリティ<42>5447359
Ref: whatsnew/changelog id6955447469
Ref: 1da55447469
Ref: セキュリティ<42>-Footnote-15449804
Ref: セキュリティ<42>-Footnote-25449869
Ref: セキュリティ<42>-Footnote-35449934
Ref: セキュリティ<42>-Footnote-45449999
Ref: セキュリティ<42>-Footnote-55450064
Ref: セキュリティ<42>-Footnote-65450129
Ref: セキュリティ<42>-Footnote-75450194
Ref: セキュリティ<42>-Footnote-85450250
Ref: セキュリティ<42>-Footnote-95450315
Ref: セキュリティ<42>-Footnote-105450380
Ref: セキュリティ<42>-Footnote-115450446
Ref: セキュリティ<42>-Footnote-125450512
Ref: セキュリティ<42>-Footnote-135450578
Ref: セキュリティ<42>-Footnote-145450644
Ref: セキュリティ<42>-Footnote-155450710
Node: Core and Builtins<154>5450776
Ref: whatsnew/changelog id6965450915
Ref: 1da85450915
Ref: Core and Builtins<154>-Footnote-15466433
Ref: Core and Builtins<154>-Footnote-25466498
Ref: Core and Builtins<154>-Footnote-35466563
Ref: Core and Builtins<154>-Footnote-45466628
Ref: Core and Builtins<154>-Footnote-55466693
Ref: Core and Builtins<154>-Footnote-65466758
Ref: Core and Builtins<154>-Footnote-75466823
Ref: Core and Builtins<154>-Footnote-85466888
Ref: Core and Builtins<154>-Footnote-95466953
Ref: Core and Builtins<154>-Footnote-105467018
Ref: Core and Builtins<154>-Footnote-115467084
Ref: Core and Builtins<154>-Footnote-125467150
Ref: Core and Builtins<154>-Footnote-135467216
Ref: Core and Builtins<154>-Footnote-145467282
Ref: Core and Builtins<154>-Footnote-155467348
Ref: Core and Builtins<154>-Footnote-165467414
Ref: Core and Builtins<154>-Footnote-175467480
Ref: Core and Builtins<154>-Footnote-185467546
Ref: Core and Builtins<154>-Footnote-195467612
Ref: Core and Builtins<154>-Footnote-205467678
Ref: Core and Builtins<154>-Footnote-215467721
Ref: Core and Builtins<154>-Footnote-225467787
Ref: Core and Builtins<154>-Footnote-235467853
Ref: Core and Builtins<154>-Footnote-245467919
Ref: Core and Builtins<154>-Footnote-255467985
Ref: Core and Builtins<154>-Footnote-265468051
Ref: Core and Builtins<154>-Footnote-275468117
Ref: Core and Builtins<154>-Footnote-285468183
Ref: Core and Builtins<154>-Footnote-295468249
Ref: Core and Builtins<154>-Footnote-305468315
Ref: Core and Builtins<154>-Footnote-315468381
Ref: Core and Builtins<154>-Footnote-325468447
Ref: Core and Builtins<154>-Footnote-335468513
Ref: Core and Builtins<154>-Footnote-345468579
Ref: Core and Builtins<154>-Footnote-355468645
Ref: Core and Builtins<154>-Footnote-365468711
Ref: Core and Builtins<154>-Footnote-375468777
Ref: Core and Builtins<154>-Footnote-385468843
Ref: Core and Builtins<154>-Footnote-395468909
Ref: Core and Builtins<154>-Footnote-405468975
Ref: Core and Builtins<154>-Footnote-415469040
Ref: Core and Builtins<154>-Footnote-425469106
Ref: Core and Builtins<154>-Footnote-435469172
Ref: Core and Builtins<154>-Footnote-445469238
Ref: Core and Builtins<154>-Footnote-455469304
Ref: Core and Builtins<154>-Footnote-465469370
Ref: Core and Builtins<154>-Footnote-475469436
Ref: Core and Builtins<154>-Footnote-485469502
Ref: Core and Builtins<154>-Footnote-495469568
Ref: Core and Builtins<154>-Footnote-505469634
Ref: Core and Builtins<154>-Footnote-515469700
Ref: Core and Builtins<154>-Footnote-525469766
Ref: Core and Builtins<154>-Footnote-535469832
Ref: Core and Builtins<154>-Footnote-545469875
Ref: Core and Builtins<154>-Footnote-555469941
Ref: Core and Builtins<154>-Footnote-565470007
Ref: Core and Builtins<154>-Footnote-575470073
Ref: Core and Builtins<154>-Footnote-585470139
Ref: Core and Builtins<154>-Footnote-595470205
Ref: Core and Builtins<154>-Footnote-605470271
Ref: Core and Builtins<154>-Footnote-615470337
Ref: Core and Builtins<154>-Footnote-625470403
Ref: Core and Builtins<154>-Footnote-635470469
Ref: Core and Builtins<154>-Footnote-645470535
Ref: Core and Builtins<154>-Footnote-655470601
Ref: Core and Builtins<154>-Footnote-665470667
Ref: Core and Builtins<154>-Footnote-675470733
Ref: Core and Builtins<154>-Footnote-685470799
Ref: Core and Builtins<154>-Footnote-695470865
Ref: Core and Builtins<154>-Footnote-705470931
Ref: Core and Builtins<154>-Footnote-715470997
Ref: Core and Builtins<154>-Footnote-725471063
Ref: Core and Builtins<154>-Footnote-735471129
Ref: Core and Builtins<154>-Footnote-745471195
Ref: Core and Builtins<154>-Footnote-755471261
Ref: Core and Builtins<154>-Footnote-765471327
Ref: Core and Builtins<154>-Footnote-775471393
Ref: Core and Builtins<154>-Footnote-785471459
Ref: Core and Builtins<154>-Footnote-795471525
Ref: Core and Builtins<154>-Footnote-805471591
Ref: Core and Builtins<154>-Footnote-815471657
Ref: Core and Builtins<154>-Footnote-825471723
Ref: Core and Builtins<154>-Footnote-835471789
Ref: Core and Builtins<154>-Footnote-845471855
Ref: Core and Builtins<154>-Footnote-855471921
Ref: Core and Builtins<154>-Footnote-865471987
Ref: Core and Builtins<154>-Footnote-875472053
Ref: Core and Builtins<154>-Footnote-885472119
Ref: Core and Builtins<154>-Footnote-895472185
Ref: Core and Builtins<154>-Footnote-905472251
Ref: Core and Builtins<154>-Footnote-915472317
Ref: Core and Builtins<154>-Footnote-925472383
Ref: Core and Builtins<154>-Footnote-935472449
Ref: Core and Builtins<154>-Footnote-945472515
Node: ライブラリ<157>5472581
Ref: whatsnew/changelog id6975472720
Ref: 1daa5472720
Ref: ライブラリ<157>-Footnote-15512103
Ref: ライブラリ<157>-Footnote-25512168
Ref: ライブラリ<157>-Footnote-35512233
Ref: ライブラリ<157>-Footnote-45512298
Ref: ライブラリ<157>-Footnote-55512363
Ref: ライブラリ<157>-Footnote-65512428
Ref: ライブラリ<157>-Footnote-75512493
Ref: ライブラリ<157>-Footnote-85512558
Ref: ライブラリ<157>-Footnote-95512623
Ref: ライブラリ<157>-Footnote-105512688
Ref: ライブラリ<157>-Footnote-115512754
Ref: ライブラリ<157>-Footnote-125512820
Ref: ライブラリ<157>-Footnote-135512886
Ref: ライブラリ<157>-Footnote-145512952
Ref: ライブラリ<157>-Footnote-155513018
Ref: ライブラリ<157>-Footnote-165513084
Ref: ライブラリ<157>-Footnote-175513150
Ref: ライブラリ<157>-Footnote-185513216
Ref: ライブラリ<157>-Footnote-195513282
Ref: ライブラリ<157>-Footnote-205513348
Ref: ライブラリ<157>-Footnote-215513414
Ref: ライブラリ<157>-Footnote-225513480
Ref: ライブラリ<157>-Footnote-235513546
Ref: ライブラリ<157>-Footnote-245513612
Ref: ライブラリ<157>-Footnote-255513678
Ref: ライブラリ<157>-Footnote-265513744
Ref: ライブラリ<157>-Footnote-275513810
Ref: ライブラリ<157>-Footnote-285513876
Ref: ライブラリ<157>-Footnote-295513942
Ref: ライブラリ<157>-Footnote-305514008
Ref: ライブラリ<157>-Footnote-315514074
Ref: ライブラリ<157>-Footnote-325514140
Ref: ライブラリ<157>-Footnote-335514206
Ref: ライブラリ<157>-Footnote-345514272
Ref: ライブラリ<157>-Footnote-355514338
Ref: ライブラリ<157>-Footnote-365514404
Ref: ライブラリ<157>-Footnote-375514470
Ref: ライブラリ<157>-Footnote-385514536
Ref: ライブラリ<157>-Footnote-395514602
Ref: ライブラリ<157>-Footnote-405514668
Ref: ライブラリ<157>-Footnote-415514734
Ref: ライブラリ<157>-Footnote-425514800
Ref: ライブラリ<157>-Footnote-435514866
Ref: ライブラリ<157>-Footnote-445514932
Ref: ライブラリ<157>-Footnote-455514998
Ref: ライブラリ<157>-Footnote-465515064
Ref: ライブラリ<157>-Footnote-475515130
Ref: ライブラリ<157>-Footnote-485515196
Ref: ライブラリ<157>-Footnote-495515262
Ref: ライブラリ<157>-Footnote-505515328
Ref: ライブラリ<157>-Footnote-515515394
Ref: ライブラリ<157>-Footnote-525515460
Ref: ライブラリ<157>-Footnote-535515526
Ref: ライブラリ<157>-Footnote-545515592
Ref: ライブラリ<157>-Footnote-555515658
Ref: ライブラリ<157>-Footnote-565515724
Ref: ライブラリ<157>-Footnote-575515790
Ref: ライブラリ<157>-Footnote-585515856
Ref: ライブラリ<157>-Footnote-595515922
Ref: ライブラリ<157>-Footnote-605515988
Ref: ライブラリ<157>-Footnote-615516054
Ref: ライブラリ<157>-Footnote-625516120
Ref: ライブラリ<157>-Footnote-635516186
Ref: ライブラリ<157>-Footnote-645516251
Ref: ライブラリ<157>-Footnote-655516317
Ref: ライブラリ<157>-Footnote-665516383
Ref: ライブラリ<157>-Footnote-675516449
Ref: ライブラリ<157>-Footnote-685516515
Ref: ライブラリ<157>-Footnote-695516581
Ref: ライブラリ<157>-Footnote-705516647
Ref: ライブラリ<157>-Footnote-715516713
Ref: ライブラリ<157>-Footnote-725516779
Ref: ライブラリ<157>-Footnote-735516845
Ref: ライブラリ<157>-Footnote-745516911
Ref: ライブラリ<157>-Footnote-755516977
Ref: ライブラリ<157>-Footnote-765517043
Ref: ライブラリ<157>-Footnote-775517151
Ref: ライブラリ<157>-Footnote-785517217
Ref: ライブラリ<157>-Footnote-795517283
Ref: ライブラリ<157>-Footnote-805517349
Ref: ライブラリ<157>-Footnote-815517415
Ref: ライブラリ<157>-Footnote-825517481
Ref: ライブラリ<157>-Footnote-835517547
Ref: ライブラリ<157>-Footnote-845517613
Ref: ライブラリ<157>-Footnote-855517679
Ref: ライブラリ<157>-Footnote-865517745
Ref: ライブラリ<157>-Footnote-875517811
Ref: ライブラリ<157>-Footnote-885517877
Ref: ライブラリ<157>-Footnote-895517943
Ref: ライブラリ<157>-Footnote-905518009
Ref: ライブラリ<157>-Footnote-915518075
Ref: ライブラリ<157>-Footnote-925518141
Ref: ライブラリ<157>-Footnote-935518207
Ref: ライブラリ<157>-Footnote-945518273
Ref: ライブラリ<157>-Footnote-955518339
Ref: ライブラリ<157>-Footnote-965518405
Ref: ライブラリ<157>-Footnote-975518471
Ref: ライブラリ<157>-Footnote-985518537
Ref: ライブラリ<157>-Footnote-995518603
Ref: ライブラリ<157>-Footnote-1005518669
Ref: ライブラリ<157>-Footnote-1015518736
Ref: ライブラリ<157>-Footnote-1025518803
Ref: ライブラリ<157>-Footnote-1035518870
Ref: ライブラリ<157>-Footnote-1045518937
Ref: ライブラリ<157>-Footnote-1055519004
Ref: ライブラリ<157>-Footnote-1065519071
Ref: ライブラリ<157>-Footnote-1075519138
Ref: ライブラリ<157>-Footnote-1085519204
Ref: ライブラリ<157>-Footnote-1095519271
Ref: ライブラリ<157>-Footnote-1105519338
Ref: ライブラリ<157>-Footnote-1115519405
Ref: ライブラリ<157>-Footnote-1125519472
Ref: ライブラリ<157>-Footnote-1135519539
Ref: ライブラリ<157>-Footnote-1145519606
Ref: ライブラリ<157>-Footnote-1155519673
Ref: ライブラリ<157>-Footnote-1165519740
Ref: ライブラリ<157>-Footnote-1175519807
Ref: ライブラリ<157>-Footnote-1185519874
Ref: ライブラリ<157>-Footnote-1195519941
Ref: ライブラリ<157>-Footnote-1205520008
Ref: ライブラリ<157>-Footnote-1215520075
Ref: ライブラリ<157>-Footnote-1225520142
Ref: ライブラリ<157>-Footnote-1235520209
Ref: ライブラリ<157>-Footnote-1245520276
Ref: ライブラリ<157>-Footnote-1255520343
Ref: ライブラリ<157>-Footnote-1265520410
Ref: ライブラリ<157>-Footnote-1275520477
Ref: ライブラリ<157>-Footnote-1285520544
Ref: ライブラリ<157>-Footnote-1295520611
Ref: ライブラリ<157>-Footnote-1305520678
Ref: ライブラリ<157>-Footnote-1315520745
Ref: ライブラリ<157>-Footnote-1325520812
Ref: ライブラリ<157>-Footnote-1335520879
Ref: ライブラリ<157>-Footnote-1345520946
Ref: ライブラリ<157>-Footnote-1355521013
Ref: ライブラリ<157>-Footnote-1365521080
Ref: ライブラリ<157>-Footnote-1375521157
Ref: ライブラリ<157>-Footnote-1385521224
Ref: ライブラリ<157>-Footnote-1395521291
Ref: ライブラリ<157>-Footnote-1405521358
Ref: ライブラリ<157>-Footnote-1415521425
Ref: ライブラリ<157>-Footnote-1425521492
Ref: ライブラリ<157>-Footnote-1435521559
Ref: ライブラリ<157>-Footnote-1445521626
Ref: ライブラリ<157>-Footnote-1455521693
Ref: ライブラリ<157>-Footnote-1465521760
Ref: ライブラリ<157>-Footnote-1475521827
Ref: ライブラリ<157>-Footnote-1485521894
Ref: ライブラリ<157>-Footnote-1495521961
Ref: ライブラリ<157>-Footnote-1505522028
Ref: ライブラリ<157>-Footnote-1515522095
Ref: ライブラリ<157>-Footnote-1525522162
Ref: ライブラリ<157>-Footnote-1535522229
Ref: ライブラリ<157>-Footnote-1545522296
Ref: ライブラリ<157>-Footnote-1555522363
Ref: ライブラリ<157>-Footnote-1565522430
Ref: ライブラリ<157>-Footnote-1575522497
Ref: ライブラリ<157>-Footnote-1585522564
Ref: ライブラリ<157>-Footnote-1595522631
Ref: ライブラリ<157>-Footnote-1605522698
Ref: ライブラリ<157>-Footnote-1615522765
Ref: ライブラリ<157>-Footnote-1625522832
Ref: ライブラリ<157>-Footnote-1635522899
Ref: ライブラリ<157>-Footnote-1645522966
Ref: ライブラリ<157>-Footnote-1655523033
Ref: ライブラリ<157>-Footnote-1665523100
Ref: ライブラリ<157>-Footnote-1675523167
Ref: ライブラリ<157>-Footnote-1685523234
Ref: ライブラリ<157>-Footnote-1695523301
Ref: ライブラリ<157>-Footnote-1705523368
Ref: ライブラリ<157>-Footnote-1715523435
Ref: ライブラリ<157>-Footnote-1725523502
Ref: ライブラリ<157>-Footnote-1735523546
Ref: ライブラリ<157>-Footnote-1745523613
Ref: ライブラリ<157>-Footnote-1755523680
Ref: ライブラリ<157>-Footnote-1765523747
Ref: ライブラリ<157>-Footnote-1775523814
Ref: ライブラリ<157>-Footnote-1785523881
Ref: ライブラリ<157>-Footnote-1795523948
Ref: ライブラリ<157>-Footnote-1805524015
Ref: ライブラリ<157>-Footnote-1815524082
Ref: ライブラリ<157>-Footnote-1825524149
Ref: ライブラリ<157>-Footnote-1835524216
Ref: ライブラリ<157>-Footnote-1845524283
Ref: ライブラリ<157>-Footnote-1855524350
Ref: ライブラリ<157>-Footnote-1865524417
Ref: ライブラリ<157>-Footnote-1875524484
Ref: ライブラリ<157>-Footnote-1885524551
Ref: ライブラリ<157>-Footnote-1895524618
Ref: ライブラリ<157>-Footnote-1905524685
Ref: ライブラリ<157>-Footnote-1915524752
Ref: ライブラリ<157>-Footnote-1925524819
Ref: ライブラリ<157>-Footnote-1935524886
Ref: ライブラリ<157>-Footnote-1945524953
Ref: ライブラリ<157>-Footnote-1955525020
Ref: ライブラリ<157>-Footnote-1965525087
Ref: ライブラリ<157>-Footnote-1975525154
Ref: ライブラリ<157>-Footnote-1985525221
Ref: ライブラリ<157>-Footnote-1995525288
Ref: ライブラリ<157>-Footnote-2005525355
Ref: ライブラリ<157>-Footnote-2015525422
Ref: ライブラリ<157>-Footnote-2025525489
Ref: ライブラリ<157>-Footnote-2035525556
Ref: ライブラリ<157>-Footnote-2045525623
Ref: ライブラリ<157>-Footnote-2055525690
Ref: ライブラリ<157>-Footnote-2065525757
Ref: ライブラリ<157>-Footnote-2075525824
Ref: ライブラリ<157>-Footnote-2085525891
Ref: ライブラリ<157>-Footnote-2095525958
Ref: ライブラリ<157>-Footnote-2105526025
Ref: ライブラリ<157>-Footnote-2115526092
Ref: ライブラリ<157>-Footnote-2125526159
Ref: ライブラリ<157>-Footnote-2135526226
Ref: ライブラリ<157>-Footnote-2145526293
Ref: ライブラリ<157>-Footnote-2155526360
Ref: ライブラリ<157>-Footnote-2165526427
Ref: ライブラリ<157>-Footnote-2175526494
Ref: ライブラリ<157>-Footnote-2185526561
Ref: ライブラリ<157>-Footnote-2195526628
Ref: ライブラリ<157>-Footnote-2205526695
Ref: ライブラリ<157>-Footnote-2215526762
Ref: ライブラリ<157>-Footnote-2225526829
Ref: ライブラリ<157>-Footnote-2235526896
Ref: ライブラリ<157>-Footnote-2245526963
Ref: ライブラリ<157>-Footnote-2255527030
Ref: ライブラリ<157>-Footnote-2265527097
Ref: ライブラリ<157>-Footnote-2275527164
Ref: ライブラリ<157>-Footnote-2285527231
Ref: ライブラリ<157>-Footnote-2295527298
Ref: ライブラリ<157>-Footnote-2305527365
Ref: ライブラリ<157>-Footnote-2315527432
Ref: ライブラリ<157>-Footnote-2325527499
Ref: ライブラリ<157>-Footnote-2335527566
Ref: ライブラリ<157>-Footnote-2345527633
Ref: ライブラリ<157>-Footnote-2355527700
Ref: ライブラリ<157>-Footnote-2365527767
Ref: ライブラリ<157>-Footnote-2375527834
Ref: ライブラリ<157>-Footnote-2385527901
Ref: ライブラリ<157>-Footnote-2395527968
Ref: ライブラリ<157>-Footnote-2405528034
Ref: ライブラリ<157>-Footnote-2415528101
Ref: ライブラリ<157>-Footnote-2425528168
Ref: ライブラリ<157>-Footnote-2435528235
Ref: ライブラリ<157>-Footnote-2445528302
Ref: ライブラリ<157>-Footnote-2455528369
Ref: ライブラリ<157>-Footnote-2465528436
Ref: ライブラリ<157>-Footnote-2475528503
Ref: ライブラリ<157>-Footnote-2485528570
Ref: ライブラリ<157>-Footnote-2495528637
Ref: ライブラリ<157>-Footnote-2505528704
Ref: ライブラリ<157>-Footnote-2515528771
Ref: ライブラリ<157>-Footnote-2525528838
Ref: ライブラリ<157>-Footnote-2535528905
Node: ドキュメント<51>5528971
Ref: whatsnew/changelog id6985529101
Ref: 1db75529101
Ref: ドキュメント<51>-Footnote-15533557
Ref: ドキュメント<51>-Footnote-25533622
Ref: ドキュメント<51>-Footnote-35533687
Ref: ドキュメント<51>-Footnote-45533752
Ref: ドキュメント<51>-Footnote-55533817
Ref: ドキュメント<51>-Footnote-65533882
Ref: ドキュメント<51>-Footnote-75533947
Ref: ドキュメント<51>-Footnote-85534012
Ref: ドキュメント<51>-Footnote-95534077
Ref: ドキュメント<51>-Footnote-105534142
Ref: ドキュメント<51>-Footnote-115534208
Ref: ドキュメント<51>-Footnote-125534274
Ref: ドキュメント<51>-Footnote-135534340
Ref: ドキュメント<51>-Footnote-145534406
Ref: ドキュメント<51>-Footnote-155534472
Ref: ドキュメント<51>-Footnote-165534538
Ref: ドキュメント<51>-Footnote-175534604
Ref: ドキュメント<51>-Footnote-185534670
Ref: ドキュメント<51>-Footnote-195534736
Ref: ドキュメント<51>-Footnote-205534802
Ref: ドキュメント<51>-Footnote-215534868
Ref: ドキュメント<51>-Footnote-225534934
Ref: ドキュメント<51>-Footnote-235535000
Ref: ドキュメント<51>-Footnote-245535066
Ref: ドキュメント<51>-Footnote-255535132
Ref: ドキュメント<51>-Footnote-265535198
Ref: ドキュメント<51>-Footnote-275535264
Ref: ドキュメント<51>-Footnote-285535330
Ref: ドキュメント<51>-Footnote-295535396
Ref: ドキュメント<51>-Footnote-305535462
Ref: ドキュメント<51>-Footnote-315535528
Ref: ドキュメント<51>-Footnote-325535594
Ref: ドキュメント<51>-Footnote-335535660
Ref: ドキュメント<51>-Footnote-345535726
Ref: ドキュメント<51>-Footnote-355535792
Node: テスト<49>5535858
Ref: whatsnew/changelog id6995535981
Ref: 1db95535981
Ref: テスト<49>-Footnote-15544067
Ref: テスト<49>-Footnote-25544132
Ref: テスト<49>-Footnote-35544197
Ref: テスト<49>-Footnote-45544262
Ref: テスト<49>-Footnote-55544327
Ref: テスト<49>-Footnote-65544392
Ref: テスト<49>-Footnote-75544457
Ref: テスト<49>-Footnote-85544522
Ref: テスト<49>-Footnote-95544587
Ref: テスト<49>-Footnote-105544652
Ref: テスト<49>-Footnote-115544718
Ref: テスト<49>-Footnote-125544784
Ref: テスト<49>-Footnote-135544850
Ref: テスト<49>-Footnote-145544916
Ref: テスト<49>-Footnote-155544982
Ref: テスト<49>-Footnote-165545048
Ref: テスト<49>-Footnote-175545114
Ref: テスト<49>-Footnote-185545180
Ref: テスト<49>-Footnote-195545246
Ref: テスト<49>-Footnote-205545312
Ref: テスト<49>-Footnote-215545378
Ref: テスト<49>-Footnote-225545444
Ref: テスト<49>-Footnote-235545510
Ref: テスト<49>-Footnote-245545576
Ref: テスト<49>-Footnote-255545642
Ref: テスト<49>-Footnote-265545708
Ref: テスト<49>-Footnote-275545774
Ref: テスト<49>-Footnote-285545840
Ref: テスト<49>-Footnote-295545906
Ref: テスト<49>-Footnote-305545972
Ref: テスト<49>-Footnote-315546038
Ref: テスト<49>-Footnote-325546104
Ref: テスト<49>-Footnote-335546170
Ref: テスト<49>-Footnote-345546236
Ref: テスト<49>-Footnote-355546302
Ref: テスト<49>-Footnote-365546368
Ref: テスト<49>-Footnote-375546434
Ref: テスト<49>-Footnote-385546500
Ref: テスト<49>-Footnote-395546566
Ref: テスト<49>-Footnote-405546632
Ref: テスト<49>-Footnote-415546698
Ref: テスト<49>-Footnote-425546764
Ref: テスト<49>-Footnote-435546830
Ref: テスト<49>-Footnote-445546896
Ref: テスト<49>-Footnote-455546962
Ref: テスト<49>-Footnote-465547028
Ref: テスト<49>-Footnote-475547094
Ref: テスト<49>-Footnote-485547160
Node: ビルド<57>5547226
Ref: whatsnew/changelog id7005547338
Ref: 1dbf5547338
Ref: ビルド<57>-Footnote-15551144
Ref: ビルド<57>-Footnote-25551209
Ref: ビルド<57>-Footnote-35551274
Ref: ビルド<57>-Footnote-45551339
Ref: ビルド<57>-Footnote-55551404
Ref: ビルド<57>-Footnote-65551469
Ref: ビルド<57>-Footnote-75551534
Ref: ビルド<57>-Footnote-85551599
Ref: ビルド<57>-Footnote-95551664
Ref: ビルド<57>-Footnote-105551729
Ref: ビルド<57>-Footnote-115551795
Ref: ビルド<57>-Footnote-125551861
Ref: ビルド<57>-Footnote-135551927
Ref: ビルド<57>-Footnote-145551993
Ref: ビルド<57>-Footnote-155552059
Ref: ビルド<57>-Footnote-165552125
Node: Windows<50>5552191
Ref: whatsnew/changelog id7015552299
Ref: 1dc15552299
Ref: Windows<50>-Footnote-15557201
Ref: Windows<50>-Footnote-25557266
Ref: Windows<50>-Footnote-35557331
Ref: Windows<50>-Footnote-45557396
Ref: Windows<50>-Footnote-55557461
Ref: Windows<50>-Footnote-65557526
Ref: Windows<50>-Footnote-75557591
Ref: Windows<50>-Footnote-85557656
Ref: Windows<50>-Footnote-95557721
Ref: Windows<50>-Footnote-105557786
Ref: Windows<50>-Footnote-115557852
Ref: Windows<50>-Footnote-125557918
Ref: Windows<50>-Footnote-135557984
Ref: Windows<50>-Footnote-145558050
Ref: Windows<50>-Footnote-155558116
Ref: Windows<50>-Footnote-165558182
Ref: Windows<50>-Footnote-175558248
Ref: Windows<50>-Footnote-185558314
Ref: Windows<50>-Footnote-195558380
Ref: Windows<50>-Footnote-205558446
Ref: Windows<50>-Footnote-215558512
Ref: Windows<50>-Footnote-225558578
Ref: Windows<50>-Footnote-235558644
Ref: Windows<50>-Footnote-245558709
Ref: Windows<50>-Footnote-255558774
Ref: Windows<50>-Footnote-265558840
Ref: Windows<50>-Footnote-275558906
Ref: Windows<50>-Footnote-285558972
Ref: Windows<50>-Footnote-295559038
Ref: Windows<50>-Footnote-305559104
Ref: Windows<50>-Footnote-315559170
Ref: Windows<50>-Footnote-325559236
Ref: Windows<50>-Footnote-335559302
Ref: Windows<50>-Footnote-345559368
Ref: Windows<50>-Footnote-355559434
Ref: Windows<50>-Footnote-365559500
Ref: Windows<50>-Footnote-375559566
Ref: Windows<50>-Footnote-385559632
Ref: Windows<50>-Footnote-395559698
Ref: Windows<50>-Footnote-405559764
Ref: Windows<50>-Footnote-415559830
Ref: Windows<50>-Footnote-425559896
Node: macOS<39>5559962
Ref: whatsnew/changelog id7025560065
Ref: 1dc45560065
Ref: macOS<39>-Footnote-15560898
Ref: macOS<39>-Footnote-25560963
Ref: macOS<39>-Footnote-35561028
Ref: macOS<39>-Footnote-45561093
Ref: macOS<39>-Footnote-55561158
Ref: macOS<39>-Footnote-65561223
Node: IDLE<32>5561288
Ref: whatsnew/changelog id7035561395
Ref: 1dc55561395
Ref: IDLE<32>-Footnote-15566097
Ref: IDLE<32>-Footnote-25566162
Ref: IDLE<32>-Footnote-35566226
Ref: IDLE<32>-Footnote-45566291
Ref: IDLE<32>-Footnote-55566356
Ref: IDLE<32>-Footnote-65566421
Ref: IDLE<32>-Footnote-75566486
Ref: IDLE<32>-Footnote-85566551
Ref: IDLE<32>-Footnote-95566616
Ref: IDLE<32>-Footnote-105566681
Ref: IDLE<32>-Footnote-115566747
Ref: IDLE<32>-Footnote-125566813
Ref: IDLE<32>-Footnote-135566879
Ref: IDLE<32>-Footnote-145566945
Ref: IDLE<32>-Footnote-155567011
Ref: IDLE<32>-Footnote-165567077
Ref: IDLE<32>-Footnote-175567143
Ref: IDLE<32>-Footnote-185567209
Ref: IDLE<32>-Footnote-195567275
Ref: IDLE<32>-Footnote-205567341
Ref: IDLE<32>-Footnote-215567407
Ref: IDLE<32>-Footnote-225567473
Ref: IDLE<32>-Footnote-235567539
Ref: IDLE<32>-Footnote-245567605
Ref: IDLE<32>-Footnote-255567671
Ref: IDLE<32>-Footnote-265567737
Ref: IDLE<32>-Footnote-275567803
Ref: IDLE<32>-Footnote-285567869
Ref: IDLE<32>-Footnote-295567935
Ref: IDLE<32>-Footnote-305568000
Node: Tools/Demos<33>5568066
Ref: whatsnew/changelog id7045568173
Ref: 1dc65568173
Ref: Tools/Demos<33>-Footnote-15569168
Ref: Tools/Demos<33>-Footnote-25569233
Ref: Tools/Demos<33>-Footnote-35569298
Ref: Tools/Demos<33>-Footnote-45569363
Ref: Tools/Demos<33>-Footnote-55569428
Ref: Tools/Demos<33>-Footnote-65569493
Ref: Tools/Demos<33>-Footnote-75569558
Ref: Tools/Demos<33>-Footnote-85569623
Node: C API<52>5569688
Ref: whatsnew/changelog id7055569778
Ref: 1dc85569778
Ref: C API<52>-Footnote-15575171
Ref: C API<52>-Footnote-25575236
Ref: C API<52>-Footnote-35575301
Ref: C API<52>-Footnote-45575366
Ref: C API<52>-Footnote-55575431
Ref: C API<52>-Footnote-65575496
Ref: C API<52>-Footnote-75575561
Ref: C API<52>-Footnote-85575626
Ref: C API<52>-Footnote-95575691
Ref: C API<52>-Footnote-105575756
Ref: C API<52>-Footnote-115575822
Ref: C API<52>-Footnote-125575888
Ref: C API<52>-Footnote-135575954
Ref: C API<52>-Footnote-145576020
Ref: C API<52>-Footnote-155576063
Ref: C API<52>-Footnote-165576129
Ref: C API<52>-Footnote-175576195
Ref: C API<52>-Footnote-185576261
Ref: C API<52>-Footnote-195576327
Ref: C API<52>-Footnote-205576393
Ref: C API<52>-Footnote-215576459
Ref: C API<52>-Footnote-225576525
Ref: C API<52>-Footnote-235576591
Ref: C API<52>-Footnote-245576657
Ref: C API<52>-Footnote-255576723
Ref: C API<52>-Footnote-265576789
Ref: C API<52>-Footnote-275576855
Ref: C API<52>-Footnote-285576921
Ref: C API<52>-Footnote-295576987
Ref: C API<52>-Footnote-305577053
Ref: C API<52>-Footnote-315577119
Ref: C API<52>-Footnote-325577185
Ref: C API<52>-Footnote-335577251
Ref: C API<52>-Footnote-345577317
Node: Python 3 8 0 beta 15577383
Ref: whatsnew/changelog python-3-8-0-beta-15577509
Ref: 1dcb5577509
Node: セキュリティ<43>5577952
Ref: whatsnew/changelog id7065578061
Ref: 1dcc5578061
Ref: セキュリティ<43>-Footnote-15578669
Ref: セキュリティ<43>-Footnote-25578734
Ref: セキュリティ<43>-Footnote-35578789
Ref: セキュリティ<43>-Footnote-45578854
Node: Core and Builtins<155>5578919
Ref: whatsnew/changelog id7075579057
Ref: 1dcd5579057
Ref: Core and Builtins<155>-Footnote-15587097
Ref: Core and Builtins<155>-Footnote-25587162
Ref: Core and Builtins<155>-Footnote-35587227
Ref: Core and Builtins<155>-Footnote-45587292
Ref: Core and Builtins<155>-Footnote-55587357
Ref: Core and Builtins<155>-Footnote-65587422
Ref: Core and Builtins<155>-Footnote-75587487
Ref: Core and Builtins<155>-Footnote-85587552
Ref: Core and Builtins<155>-Footnote-95587617
Ref: Core and Builtins<155>-Footnote-105587682
Ref: Core and Builtins<155>-Footnote-115587748
Ref: Core and Builtins<155>-Footnote-125587814
Ref: Core and Builtins<155>-Footnote-135587880
Ref: Core and Builtins<155>-Footnote-145587946
Ref: Core and Builtins<155>-Footnote-155588012
Ref: Core and Builtins<155>-Footnote-165588078
Ref: Core and Builtins<155>-Footnote-175588144
Ref: Core and Builtins<155>-Footnote-185588210
Ref: Core and Builtins<155>-Footnote-195588275
Ref: Core and Builtins<155>-Footnote-205588341
Ref: Core and Builtins<155>-Footnote-215588407
Ref: Core and Builtins<155>-Footnote-225588473
Ref: Core and Builtins<155>-Footnote-235588538
Ref: Core and Builtins<155>-Footnote-245588604
Ref: Core and Builtins<155>-Footnote-255588670
Ref: Core and Builtins<155>-Footnote-265588736
Ref: Core and Builtins<155>-Footnote-275588802
Ref: Core and Builtins<155>-Footnote-285588868
Ref: Core and Builtins<155>-Footnote-295588934
Ref: Core and Builtins<155>-Footnote-305589000
Ref: Core and Builtins<155>-Footnote-315589066
Ref: Core and Builtins<155>-Footnote-325589132
Ref: Core and Builtins<155>-Footnote-335589198
Ref: Core and Builtins<155>-Footnote-345589264
Ref: Core and Builtins<155>-Footnote-355589330
Ref: Core and Builtins<155>-Footnote-365589396
Ref: Core and Builtins<155>-Footnote-375589462
Ref: Core and Builtins<155>-Footnote-385589528
Ref: Core and Builtins<155>-Footnote-395589594
Ref: Core and Builtins<155>-Footnote-405589660
Ref: Core and Builtins<155>-Footnote-415589726
Ref: Core and Builtins<155>-Footnote-425589792
Ref: Core and Builtins<155>-Footnote-435589858
Ref: Core and Builtins<155>-Footnote-445589924
Node: ライブラリ<158>5589990
Ref: whatsnew/changelog id7085590128
Ref: 1dd05590128
Ref: ライブラリ<158>-Footnote-15608372
Ref: ライブラリ<158>-Footnote-25608437
Ref: ライブラリ<158>-Footnote-35608502
Ref: ライブラリ<158>-Footnote-45608567
Ref: ライブラリ<158>-Footnote-55608632
Ref: ライブラリ<158>-Footnote-65608697
Ref: ライブラリ<158>-Footnote-75608762
Ref: ライブラリ<158>-Footnote-85608827
Ref: ライブラリ<158>-Footnote-95608892
Ref: ライブラリ<158>-Footnote-105608957
Ref: ライブラリ<158>-Footnote-115609023
Ref: ライブラリ<158>-Footnote-125609089
Ref: ライブラリ<158>-Footnote-135609155
Ref: ライブラリ<158>-Footnote-145609221
Ref: ライブラリ<158>-Footnote-155609287
Ref: ライブラリ<158>-Footnote-165609353
Ref: ライブラリ<158>-Footnote-175609419
Ref: ライブラリ<158>-Footnote-185609485
Ref: ライブラリ<158>-Footnote-195609551
Ref: ライブラリ<158>-Footnote-205609617
Ref: ライブラリ<158>-Footnote-215609683
Ref: ライブラリ<158>-Footnote-225609749
Ref: ライブラリ<158>-Footnote-235609815
Ref: ライブラリ<158>-Footnote-245609881
Ref: ライブラリ<158>-Footnote-255609949
Ref: ライブラリ<158>-Footnote-265610015
Ref: ライブラリ<158>-Footnote-275610081
Ref: ライブラリ<158>-Footnote-285610147
Ref: ライブラリ<158>-Footnote-295610213
Ref: ライブラリ<158>-Footnote-305610279
Ref: ライブラリ<158>-Footnote-315610345
Ref: ライブラリ<158>-Footnote-325610411
Ref: ライブラリ<158>-Footnote-335610477
Ref: ライブラリ<158>-Footnote-345610543
Ref: ライブラリ<158>-Footnote-355610609
Ref: ライブラリ<158>-Footnote-365610675
Ref: ライブラリ<158>-Footnote-375610741
Ref: ライブラリ<158>-Footnote-385610807
Ref: ライブラリ<158>-Footnote-395610873
Ref: ライブラリ<158>-Footnote-405610939
Ref: ライブラリ<158>-Footnote-415611005
Ref: ライブラリ<158>-Footnote-425611071
Ref: ライブラリ<158>-Footnote-435611137
Ref: ライブラリ<158>-Footnote-445611203
Ref: ライブラリ<158>-Footnote-455611269
Ref: ライブラリ<158>-Footnote-465611335
Ref: ライブラリ<158>-Footnote-475611401
Ref: ライブラリ<158>-Footnote-485611467
Ref: ライブラリ<158>-Footnote-495611533
Ref: ライブラリ<158>-Footnote-505611599
Ref: ライブラリ<158>-Footnote-515611665
Ref: ライブラリ<158>-Footnote-525611731
Ref: ライブラリ<158>-Footnote-535611797
Ref: ライブラリ<158>-Footnote-545611863
Ref: ライブラリ<158>-Footnote-555611929
Ref: ライブラリ<158>-Footnote-565611995
Ref: ライブラリ<158>-Footnote-575612061
Ref: ライブラリ<158>-Footnote-585612127
Ref: ライブラリ<158>-Footnote-595612193
Ref: ライブラリ<158>-Footnote-605612259
Ref: ライブラリ<158>-Footnote-615612325
Ref: ライブラリ<158>-Footnote-625612391
Ref: ライブラリ<158>-Footnote-635612457
Ref: ライブラリ<158>-Footnote-645612523
Ref: ライブラリ<158>-Footnote-655612589
Ref: ライブラリ<158>-Footnote-665612655
Ref: ライブラリ<158>-Footnote-675612721
Ref: ライブラリ<158>-Footnote-685612787
Ref: ライブラリ<158>-Footnote-695612852
Ref: ライブラリ<158>-Footnote-705612918
Ref: ライブラリ<158>-Footnote-715612983
Ref: ライブラリ<158>-Footnote-725613049
Ref: ライブラリ<158>-Footnote-735613115
Ref: ライブラリ<158>-Footnote-745613181
Ref: ライブラリ<158>-Footnote-755613247
Ref: ライブラリ<158>-Footnote-765613313
Ref: ライブラリ<158>-Footnote-775613379
Ref: ライブラリ<158>-Footnote-785613445
Ref: ライブラリ<158>-Footnote-795613511
Ref: ライブラリ<158>-Footnote-805613577
Ref: ライブラリ<158>-Footnote-815613643
Ref: ライブラリ<158>-Footnote-825613709
Ref: ライブラリ<158>-Footnote-835613775
Ref: ライブラリ<158>-Footnote-845613841
Ref: ライブラリ<158>-Footnote-855613907
Ref: ライブラリ<158>-Footnote-865613973
Ref: ライブラリ<158>-Footnote-875614039
Ref: ライブラリ<158>-Footnote-885614105
Ref: ライブラリ<158>-Footnote-895614171
Ref: ライブラリ<158>-Footnote-905614237
Ref: ライブラリ<158>-Footnote-915614303
Ref: ライブラリ<158>-Footnote-925614369
Ref: ライブラリ<158>-Footnote-935614435
Ref: ライブラリ<158>-Footnote-945614501
Ref: ライブラリ<158>-Footnote-955614567
Ref: ライブラリ<158>-Footnote-965614633
Ref: ライブラリ<158>-Footnote-975614699
Ref: ライブラリ<158>-Footnote-985614765
Ref: ライブラリ<158>-Footnote-995614831
Ref: ライブラリ<158>-Footnote-1005614897
Ref: ライブラリ<158>-Footnote-1015614964
Ref: ライブラリ<158>-Footnote-1025615031
Ref: ライブラリ<158>-Footnote-1035615098
Ref: ライブラリ<158>-Footnote-1045615165
Ref: ライブラリ<158>-Footnote-1055615232
Ref: ライブラリ<158>-Footnote-1065615299
Ref: ライブラリ<158>-Footnote-1075615366
Node: ドキュメント<52>5615433
Ref: whatsnew/changelog id7095615562
Ref: 1dd65615562
Ref: ドキュメント<52>-Footnote-15617642
Ref: ドキュメント<52>-Footnote-25617707
Ref: ドキュメント<52>-Footnote-35617772
Ref: ドキュメント<52>-Footnote-45617837
Ref: ドキュメント<52>-Footnote-55617902
Ref: ドキュメント<52>-Footnote-65617967
Ref: ドキュメント<52>-Footnote-75618032
Ref: ドキュメント<52>-Footnote-85618097
Ref: ドキュメント<52>-Footnote-95618162
Ref: ドキュメント<52>-Footnote-105618227
Ref: ドキュメント<52>-Footnote-115618293
Ref: ドキュメント<52>-Footnote-125618359
Ref: ドキュメント<52>-Footnote-135618425
Ref: ドキュメント<52>-Footnote-145618491
Node: テスト<50>5618557
Ref: whatsnew/changelog id7105618679
Ref: 1dd75618679
Ref: テスト<50>-Footnote-15620316
Ref: テスト<50>-Footnote-25620381
Ref: テスト<50>-Footnote-35620446
Ref: テスト<50>-Footnote-45620511
Ref: テスト<50>-Footnote-55620576
Ref: テスト<50>-Footnote-65620641
Ref: テスト<50>-Footnote-75620706
Ref: テスト<50>-Footnote-85620771
Ref: テスト<50>-Footnote-95620836
Ref: テスト<50>-Footnote-105620901
Node: ビルド<58>5620967
Ref: whatsnew/changelog id7115621078
Ref: 1dd95621078
Ref: ビルド<58>-Footnote-15622474
Ref: ビルド<58>-Footnote-25622539
Node: Windows<51>5622604
Ref: whatsnew/changelog id7125622711
Ref: 1dda5622711
Ref: Windows<51>-Footnote-15623143
Ref: Windows<51>-Footnote-25623208
Ref: Windows<51>-Footnote-35623273
Ref: Windows<51>-Footnote-45623338
Node: macOS<40>5623403
Ref: whatsnew/changelog id7135623505
Ref: 1ddb5623505
Ref: macOS<40>-Footnote-15623807
Node: IDLE<33>5623872
Ref: whatsnew/changelog id7145623978
Ref: 1ddc5623978
Ref: IDLE<33>-Footnote-15624580
Ref: IDLE<33>-Footnote-25624645
Ref: IDLE<33>-Footnote-35624710
Ref: IDLE<33>-Footnote-45624775
Ref: IDLE<33>-Footnote-55624840
Ref: IDLE<33>-Footnote-65624905
Node: Tools/Demos<34>5624970
Ref: whatsnew/changelog id7155625076
Ref: 1ddd5625076
Ref: Tools/Demos<34>-Footnote-15625275
Node: C API<53>5625340
Ref: whatsnew/changelog id7165625429
Ref: 1dde5625429
Ref: C API<53>-Footnote-15626765
Ref: C API<53>-Footnote-25626830
Ref: C API<53>-Footnote-35626872
Ref: C API<53>-Footnote-45626937
Ref: C API<53>-Footnote-55627002
Ref: C API<53>-Footnote-65627067
Ref: C API<53>-Footnote-75627109
Ref: C API<53>-Footnote-85627174
Ref: C API<53>-Footnote-95627239
Node: Python 3 8 0 alpha 45627304
Ref: whatsnew/changelog python-3-8-0-alpha-45627430
Ref: 1de05627430
Node: セキュリティ<44>5627875
Ref: whatsnew/changelog id7175627985
Ref: 1de15627985
Ref: セキュリティ<44>-Footnote-15628884
Ref: セキュリティ<44>-Footnote-25628949
Ref: セキュリティ<44>-Footnote-35629014
Ref: セキュリティ<44>-Footnote-45629069
Node: Core and Builtins<156>5629134
Ref: whatsnew/changelog id7185629273
Ref: 1de25629273
Ref: Core and Builtins<156>-Footnote-15632541
Ref: Core and Builtins<156>-Footnote-25632606
Ref: Core and Builtins<156>-Footnote-35632671
Ref: Core and Builtins<156>-Footnote-45632736
Ref: Core and Builtins<156>-Footnote-55632801
Ref: Core and Builtins<156>-Footnote-65632866
Ref: Core and Builtins<156>-Footnote-75632931
Ref: Core and Builtins<156>-Footnote-85632996
Ref: Core and Builtins<156>-Footnote-95633061
Ref: Core and Builtins<156>-Footnote-105633103
Ref: Core and Builtins<156>-Footnote-115633169
Ref: Core and Builtins<156>-Footnote-125633235
Ref: Core and Builtins<156>-Footnote-135633301
Ref: Core and Builtins<156>-Footnote-145633367
Ref: Core and Builtins<156>-Footnote-155633433
Ref: Core and Builtins<156>-Footnote-165633499
Ref: Core and Builtins<156>-Footnote-175633565
Ref: Core and Builtins<156>-Footnote-185633631
Ref: Core and Builtins<156>-Footnote-195633697
Ref: Core and Builtins<156>-Footnote-205633763
Node: ライブラリ<159>5633829
Ref: whatsnew/changelog id7195633968
Ref: 1de35633968
Ref: ライブラリ<159>-Footnote-15643285
Ref: ライブラリ<159>-Footnote-25643350
Ref: ライブラリ<159>-Footnote-35643415
Ref: ライブラリ<159>-Footnote-45643480
Ref: ライブラリ<159>-Footnote-55643547
Ref: ライブラリ<159>-Footnote-65643612
Ref: ライブラリ<159>-Footnote-75643677
Ref: ライブラリ<159>-Footnote-85643742
Ref: ライブラリ<159>-Footnote-95643807
Ref: ライブラリ<159>-Footnote-105643872
Ref: ライブラリ<159>-Footnote-115643938
Ref: ライブラリ<159>-Footnote-125644004
Ref: ライブラリ<159>-Footnote-135644070
Ref: ライブラリ<159>-Footnote-145644136
Ref: ライブラリ<159>-Footnote-155644202
Ref: ライブラリ<159>-Footnote-165644268
Ref: ライブラリ<159>-Footnote-175644334
Ref: ライブラリ<159>-Footnote-185644400
Ref: ライブラリ<159>-Footnote-195644466
Ref: ライブラリ<159>-Footnote-205644532
Ref: ライブラリ<159>-Footnote-215644598
Ref: ライブラリ<159>-Footnote-225644664
Ref: ライブラリ<159>-Footnote-235644730
Ref: ライブラリ<159>-Footnote-245644796
Ref: ライブラリ<159>-Footnote-255644862
Ref: ライブラリ<159>-Footnote-265644928
Ref: ライブラリ<159>-Footnote-275644994
Ref: ライブラリ<159>-Footnote-285645060
Ref: ライブラリ<159>-Footnote-295645126
Ref: ライブラリ<159>-Footnote-305645192
Ref: ライブラリ<159>-Footnote-315645258
Ref: ライブラリ<159>-Footnote-325645324
Ref: ライブラリ<159>-Footnote-335645390
Ref: ライブラリ<159>-Footnote-345645456
Ref: ライブラリ<159>-Footnote-355645522
Ref: ライブラリ<159>-Footnote-365645588
Ref: ライブラリ<159>-Footnote-375645654
Ref: ライブラリ<159>-Footnote-385645720
Ref: ライブラリ<159>-Footnote-395645786
Ref: ライブラリ<159>-Footnote-405645852
Ref: ライブラリ<159>-Footnote-415645918
Ref: ライブラリ<159>-Footnote-425645984
Ref: ライブラリ<159>-Footnote-435646050
Ref: ライブラリ<159>-Footnote-445646116
Ref: ライブラリ<159>-Footnote-455646182
Ref: ライブラリ<159>-Footnote-465646248
Ref: ライブラリ<159>-Footnote-475646314
Ref: ライブラリ<159>-Footnote-485646380
Ref: ライブラリ<159>-Footnote-495646446
Ref: ライブラリ<159>-Footnote-505646512
Ref: ライブラリ<159>-Footnote-515646578
Ref: ライブラリ<159>-Footnote-525646644
Ref: ライブラリ<159>-Footnote-535646710
Ref: ライブラリ<159>-Footnote-545646776
Node: ドキュメント<53>5646842
Ref: whatsnew/changelog id7205646972
Ref: 1de75646972
Ref: ドキュメント<53>-Footnote-15648407
Ref: ドキュメント<53>-Footnote-25648472
Ref: ドキュメント<53>-Footnote-35648537
Ref: ドキュメント<53>-Footnote-45648602
Ref: ドキュメント<53>-Footnote-55648667
Ref: ドキュメント<53>-Footnote-65648706
Ref: ドキュメント<53>-Footnote-75648771
Ref: ドキュメント<53>-Footnote-85648836
Ref: ドキュメント<53>-Footnote-95648901
Ref: ドキュメント<53>-Footnote-105648966
Ref: ドキュメント<53>-Footnote-115649032
Ref: ドキュメント<53>-Footnote-125649098
Node: テスト<51>5649164
Ref: whatsnew/changelog id7215649287
Ref: 1de85649287
Ref: テスト<51>-Footnote-15651543
Ref: テスト<51>-Footnote-25651608
Ref: テスト<51>-Footnote-35651673
Ref: テスト<51>-Footnote-45651738
Ref: テスト<51>-Footnote-55651803
Ref: テスト<51>-Footnote-65651868
Ref: テスト<51>-Footnote-75651933
Ref: テスト<51>-Footnote-85651998
Ref: テスト<51>-Footnote-95652063
Ref: テスト<51>-Footnote-105652128
Ref: テスト<51>-Footnote-115652194
Ref: テスト<51>-Footnote-125652260
Ref: テスト<51>-Footnote-135652326
Ref: テスト<51>-Footnote-145652392
Ref: テスト<51>-Footnote-155652458
Node: ビルド<59>5652524
Ref: whatsnew/changelog id7225652636
Ref: 1dea5652636
Ref: ビルド<59>-Footnote-15655800
Ref: ビルド<59>-Footnote-25655865
Ref: ビルド<59>-Footnote-35655930
Ref: ビルド<59>-Footnote-45655995
Ref: ビルド<59>-Footnote-55656060
Ref: ビルド<59>-Footnote-65656125
Ref: ビルド<59>-Footnote-75656190
Ref: ビルド<59>-Footnote-85656255
Ref: ビルド<59>-Footnote-95656320
Ref: ビルド<59>-Footnote-105656385
Ref: ビルド<59>-Footnote-115656451
Ref: ビルド<59>-Footnote-125656517
Ref: ビルド<59>-Footnote-135656583
Node: Windows<52>5656649
Ref: whatsnew/changelog id7235656757
Ref: 1deb5656757
Ref: Windows<52>-Footnote-15659405
Ref: Windows<52>-Footnote-25659470
Ref: Windows<52>-Footnote-35659535
Ref: Windows<52>-Footnote-45659600
Ref: Windows<52>-Footnote-55659665
Ref: Windows<52>-Footnote-65659730
Ref: Windows<52>-Footnote-75659795
Ref: Windows<52>-Footnote-85659860
Ref: Windows<52>-Footnote-95659925
Ref: Windows<52>-Footnote-105659990
Ref: Windows<52>-Footnote-115660056
Ref: Windows<52>-Footnote-125660122
Node: macOS<41>5660188
Ref: whatsnew/changelog id7245660291
Ref: 1dec5660291
Ref: macOS<41>-Footnote-15660605
Ref: macOS<41>-Footnote-25660670
Node: IDLE<34>5660735
Ref: whatsnew/changelog id7255660842
Ref: 1ded5660842
Ref: IDLE<34>-Footnote-15661085
Node: Tools/Demos<35>5661150
Ref: whatsnew/changelog id7265661257
Ref: 1dee5661257
Ref: Tools/Demos<35>-Footnote-15661411
Node: C API<54>5661476
Ref: whatsnew/changelog id7275661566
Ref: 1def5661566
Ref: C API<54>-Footnote-15663569
Ref: C API<54>-Footnote-25663634
Ref: C API<54>-Footnote-35663699
Ref: C API<54>-Footnote-45663764
Ref: C API<54>-Footnote-55663829
Ref: C API<54>-Footnote-65663894
Node: Python 3 8 0 alpha 35663959
Ref: whatsnew/changelog python-3-8-0-alpha-35664086
Ref: 1df25664086
Node: セキュリティ<45>5664511
Ref: whatsnew/changelog id7285664621
Ref: 1df35664621
Ref: セキュリティ<45>-Footnote-15665197
Ref: セキュリティ<45>-Footnote-25665262
Node: Core and Builtins<157>5665327
Ref: whatsnew/changelog id7295665466
Ref: 1df55665466
Ref: Core and Builtins<157>-Footnote-15669046
Ref: Core and Builtins<157>-Footnote-25669111
Ref: Core and Builtins<157>-Footnote-35669176
Ref: Core and Builtins<157>-Footnote-45669241
Ref: Core and Builtins<157>-Footnote-55669306
Ref: Core and Builtins<157>-Footnote-65669371
Ref: Core and Builtins<157>-Footnote-75669436
Ref: Core and Builtins<157>-Footnote-85669501
Ref: Core and Builtins<157>-Footnote-95669566
Ref: Core and Builtins<157>-Footnote-105669631
Ref: Core and Builtins<157>-Footnote-115669697
Ref: Core and Builtins<157>-Footnote-125669763
Ref: Core and Builtins<157>-Footnote-135669829
Ref: Core and Builtins<157>-Footnote-145669895
Ref: Core and Builtins<157>-Footnote-155669961
Ref: Core and Builtins<157>-Footnote-165670027
Ref: Core and Builtins<157>-Footnote-175670093
Ref: Core and Builtins<157>-Footnote-185670159
Ref: Core and Builtins<157>-Footnote-195670225
Ref: Core and Builtins<157>-Footnote-205670291
Ref: Core and Builtins<157>-Footnote-215670357
Ref: Core and Builtins<157>-Footnote-225670423
Node: ライブラリ<160>5670489
Ref: whatsnew/changelog id7305670628
Ref: 1df75670628
Ref: ライブラリ<160>-Footnote-15676208
Ref: ライブラリ<160>-Footnote-25676273
Ref: ライブラリ<160>-Footnote-35676338
Ref: ライブラリ<160>-Footnote-45676403
Ref: ライブラリ<160>-Footnote-55676468
Ref: ライブラリ<160>-Footnote-65676533
Ref: ライブラリ<160>-Footnote-75676598
Ref: ライブラリ<160>-Footnote-85676663
Ref: ライブラリ<160>-Footnote-95676728
Ref: ライブラリ<160>-Footnote-105676793
Ref: ライブラリ<160>-Footnote-115676859
Ref: ライブラリ<160>-Footnote-125676925
Ref: ライブラリ<160>-Footnote-135676991
Ref: ライブラリ<160>-Footnote-145677057
Ref: ライブラリ<160>-Footnote-155677123
Ref: ライブラリ<160>-Footnote-165677189
Ref: ライブラリ<160>-Footnote-175677255
Ref: ライブラリ<160>-Footnote-185677321
Ref: ライブラリ<160>-Footnote-195677387
Ref: ライブラリ<160>-Footnote-205677453
Ref: ライブラリ<160>-Footnote-215677519
Ref: ライブラリ<160>-Footnote-225677585
Ref: ライブラリ<160>-Footnote-235677651
Ref: ライブラリ<160>-Footnote-245677717
Ref: ライブラリ<160>-Footnote-255677783
Ref: ライブラリ<160>-Footnote-265677849
Ref: ライブラリ<160>-Footnote-275677915
Ref: ライブラリ<160>-Footnote-285677981
Ref: ライブラリ<160>-Footnote-295678047
Ref: ライブラリ<160>-Footnote-305678113
Ref: ライブラリ<160>-Footnote-315678179
Ref: ライブラリ<160>-Footnote-325678245
Ref: ライブラリ<160>-Footnote-335678311
Ref: ライブラリ<160>-Footnote-345678377
Ref: ライブラリ<160>-Footnote-355678443
Ref: ライブラリ<160>-Footnote-365678509
Ref: ライブラリ<160>-Footnote-375678575
Node: ドキュメント<54>5678641
Ref: whatsnew/changelog id7315678771
Ref: 1df95678771
Ref: ドキュメント<54>-Footnote-15679346
Ref: ドキュメント<54>-Footnote-25679411
Ref: ドキュメント<54>-Footnote-35679476
Node: テスト<52>5679541
Ref: whatsnew/changelog id7325679664
Ref: 1dfa5679664
Ref: テスト<52>-Footnote-15680181
Ref: テスト<52>-Footnote-25680246
Ref: テスト<52>-Footnote-35680311
Node: ビルド<60>5680376
Ref: whatsnew/changelog id7335680488
Ref: 1dfb5680488
Ref: ビルド<60>-Footnote-15681013
Ref: ビルド<60>-Footnote-25681078
Ref: ビルド<60>-Footnote-35681143
Ref: ビルド<60>-Footnote-45681208
Node: Windows<53>5681273
Ref: whatsnew/changelog id7345681380
Ref: 1dfc5681380
Ref: Windows<53>-Footnote-15681829
Ref: Windows<53>-Footnote-25681894
Ref: Windows<53>-Footnote-35681959
Node: IDLE<35>5682024
Ref: whatsnew/changelog id7355682133
Ref: 1dfd5682133
Ref: IDLE<35>-Footnote-15683242
Ref: IDLE<35>-Footnote-25683307
Ref: IDLE<35>-Footnote-35683372
Ref: IDLE<35>-Footnote-45683437
Ref: IDLE<35>-Footnote-55683502
Ref: IDLE<35>-Footnote-65683567
Ref: IDLE<35>-Footnote-75683632
Ref: IDLE<35>-Footnote-85683697
Ref: IDLE<35>-Footnote-95683762
Node: Tools/Demos<36>5683827
Ref: whatsnew/changelog id7365683934
Ref: 1dfe5683934
Ref: Tools/Demos<36>-Footnote-15684147
Ref: Tools/Demos<36>-Footnote-25684212
Node: C API<55>5684277
Ref: whatsnew/changelog id7375684367
Ref: 1dff5684367
Ref: C API<55>-Footnote-15684755
Ref: C API<55>-Footnote-25684820
Node: Python 3 8 0 alpha 25684885
Ref: whatsnew/changelog python-3-8-0-alpha-25685012
Ref: 1e005685012
Node: Core and Builtins<158>5685311
Ref: whatsnew/changelog id7385685419
Ref: 1e015685419
Ref: Core and Builtins<158>-Footnote-15688558
Ref: Core and Builtins<158>-Footnote-25688623
Ref: Core and Builtins<158>-Footnote-35688688
Ref: Core and Builtins<158>-Footnote-45688753
Ref: Core and Builtins<158>-Footnote-55688818
Ref: Core and Builtins<158>-Footnote-65688885
Ref: Core and Builtins<158>-Footnote-75688950
Ref: Core and Builtins<158>-Footnote-85689015
Ref: Core and Builtins<158>-Footnote-95689080
Ref: Core and Builtins<158>-Footnote-105689145
Ref: Core and Builtins<158>-Footnote-115689211
Ref: Core and Builtins<158>-Footnote-125689277
Ref: Core and Builtins<158>-Footnote-135689343
Ref: Core and Builtins<158>-Footnote-145689409
Ref: Core and Builtins<158>-Footnote-155689475
Ref: Core and Builtins<158>-Footnote-165689541
Ref: Core and Builtins<158>-Footnote-175689607
Node: ライブラリ<161>5689673
Ref: whatsnew/changelog id7395689812
Ref: 1e025689812
Ref: ライブラリ<161>-Footnote-15693532
Ref: ライブラリ<161>-Footnote-25693597
Ref: ライブラリ<161>-Footnote-35693662
Ref: ライブラリ<161>-Footnote-45693727
Ref: ライブラリ<161>-Footnote-55693792
Ref: ライブラリ<161>-Footnote-65693857
Ref: ライブラリ<161>-Footnote-75693922
Ref: ライブラリ<161>-Footnote-85693987
Ref: ライブラリ<161>-Footnote-95694052
Ref: ライブラリ<161>-Footnote-105694117
Ref: ライブラリ<161>-Footnote-115694183
Ref: ライブラリ<161>-Footnote-125694249
Ref: ライブラリ<161>-Footnote-135694315
Ref: ライブラリ<161>-Footnote-145694381
Ref: ライブラリ<161>-Footnote-155694447
Ref: ライブラリ<161>-Footnote-165694513
Ref: ライブラリ<161>-Footnote-175694579
Node: ドキュメント<55>5694645
Ref: whatsnew/changelog id7405694775
Ref: 1e045694775
Ref: ドキュメント<55>-Footnote-15695155
Ref: ドキュメント<55>-Footnote-25695220
Ref: ドキュメント<55>-Footnote-35695285
Node: テスト<53>5695350
Ref: whatsnew/changelog id7415695471
Ref: 1e055695471
Ref: テスト<53>-Footnote-15696841
Ref: テスト<53>-Footnote-25696906
Ref: テスト<53>-Footnote-35696971
Ref: テスト<53>-Footnote-45697036
Ref: テスト<53>-Footnote-55697101
Ref: テスト<53>-Footnote-65697166
Ref: テスト<53>-Footnote-75697231
Ref: テスト<53>-Footnote-85697296
Node: Windows<54>5697361
Ref: whatsnew/changelog id7425697468
Ref: 1e065697468
Ref: Windows<54>-Footnote-15698065
Ref: Windows<54>-Footnote-25698130
Ref: Windows<54>-Footnote-35698195
Ref: Windows<54>-Footnote-45698260
Ref: Windows<54>-Footnote-55698325
Node: IDLE<36>5698390
Ref: whatsnew/changelog id7435698475
Ref: 1e075698475
Ref: IDLE<36>-Footnote-15698779
Ref: IDLE<36>-Footnote-25698844
Ref: IDLE<36>-Footnote-35698909
Node: Python 3 8 0 alpha 15698974
Ref: whatsnew/changelog python-3-8-0-alpha-15699099
Ref: 1e085699099
Node: セキュリティ<46>5699544
Ref: whatsnew/changelog id7445699654
Ref: 1e095699654
Ref: セキュリティ<46>-Footnote-15702006
Ref: セキュリティ<46>-Footnote-25702071
Ref: セキュリティ<46>-Footnote-35702126
Ref: セキュリティ<46>-Footnote-45702191
Ref: セキュリティ<46>-Footnote-55702256
Ref: セキュリティ<46>-Footnote-65702321
Ref: セキュリティ<46>-Footnote-75702386
Ref: セキュリティ<46>-Footnote-85702442
Ref: セキュリティ<46>-Footnote-95702507
Ref: セキュリティ<46>-Footnote-105702572
Ref: セキュリティ<46>-Footnote-115702638
Ref: セキュリティ<46>-Footnote-125702704
Ref: セキュリティ<46>-Footnote-135702760
Ref: セキュリティ<46>-Footnote-145702826
Ref: セキュリティ<46>-Footnote-155702892
Ref: セキュリティ<46>-Footnote-165702948
Ref: セキュリティ<46>-Footnote-175703004
Node: Core and Builtins<159>5703070
Ref: whatsnew/changelog id7455703209
Ref: 1e0a5703209
Ref: Core and Builtins<159>-Footnote-15729254
Ref: Core and Builtins<159>-Footnote-25729319
Ref: Core and Builtins<159>-Footnote-35729384
Ref: Core and Builtins<159>-Footnote-45729449
Ref: Core and Builtins<159>-Footnote-55729514
Ref: Core and Builtins<159>-Footnote-65729579
Ref: Core and Builtins<159>-Footnote-75729644
Ref: Core and Builtins<159>-Footnote-85729709
Ref: Core and Builtins<159>-Footnote-95729774
Ref: Core and Builtins<159>-Footnote-105729839
Ref: Core and Builtins<159>-Footnote-115729905
Ref: Core and Builtins<159>-Footnote-125729971
Ref: Core and Builtins<159>-Footnote-135730037
Ref: Core and Builtins<159>-Footnote-145730103
Ref: Core and Builtins<159>-Footnote-155730169
Ref: Core and Builtins<159>-Footnote-165730235
Ref: Core and Builtins<159>-Footnote-175730301
Ref: Core and Builtins<159>-Footnote-185730367
Ref: Core and Builtins<159>-Footnote-195730433
Ref: Core and Builtins<159>-Footnote-205730499
Ref: Core and Builtins<159>-Footnote-215730565
Ref: Core and Builtins<159>-Footnote-225730631
Ref: Core and Builtins<159>-Footnote-235730697
Ref: Core and Builtins<159>-Footnote-245730763
Ref: Core and Builtins<159>-Footnote-255730829
Ref: Core and Builtins<159>-Footnote-265730872
Ref: Core and Builtins<159>-Footnote-275730938
Ref: Core and Builtins<159>-Footnote-285731004
Ref: Core and Builtins<159>-Footnote-295731070
Ref: Core and Builtins<159>-Footnote-305731136
Ref: Core and Builtins<159>-Footnote-315731202
Ref: Core and Builtins<159>-Footnote-325731268
Ref: Core and Builtins<159>-Footnote-335731334
Ref: Core and Builtins<159>-Footnote-345731400
Ref: Core and Builtins<159>-Footnote-355731466
Ref: Core and Builtins<159>-Footnote-365731532
Ref: Core and Builtins<159>-Footnote-375731598
Ref: Core and Builtins<159>-Footnote-385731664
Ref: Core and Builtins<159>-Footnote-395731730
Ref: Core and Builtins<159>-Footnote-405731796
Ref: Core and Builtins<159>-Footnote-415731862
Ref: Core and Builtins<159>-Footnote-425731928
Ref: Core and Builtins<159>-Footnote-435731994
Ref: Core and Builtins<159>-Footnote-445732060
Ref: Core and Builtins<159>-Footnote-455732126
Ref: Core and Builtins<159>-Footnote-465732192
Ref: Core and Builtins<159>-Footnote-475732258
Ref: Core and Builtins<159>-Footnote-485732324
Ref: Core and Builtins<159>-Footnote-495732390
Ref: Core and Builtins<159>-Footnote-505732456
Ref: Core and Builtins<159>-Footnote-515732522
Ref: Core and Builtins<159>-Footnote-525732588
Ref: Core and Builtins<159>-Footnote-535732654
Ref: Core and Builtins<159>-Footnote-545732720
Ref: Core and Builtins<159>-Footnote-555732786
Ref: Core and Builtins<159>-Footnote-565732852
Ref: Core and Builtins<159>-Footnote-575732918
Ref: Core and Builtins<159>-Footnote-585732984
Ref: Core and Builtins<159>-Footnote-595733050
Ref: Core and Builtins<159>-Footnote-605733115
Ref: Core and Builtins<159>-Footnote-615733181
Ref: Core and Builtins<159>-Footnote-625733247
Ref: Core and Builtins<159>-Footnote-635733313
Ref: Core and Builtins<159>-Footnote-645733379
Ref: Core and Builtins<159>-Footnote-655733445
Ref: Core and Builtins<159>-Footnote-665733511
Ref: Core and Builtins<159>-Footnote-675733577
Ref: Core and Builtins<159>-Footnote-685733643
Ref: Core and Builtins<159>-Footnote-695733709
Ref: Core and Builtins<159>-Footnote-705733775
Ref: Core and Builtins<159>-Footnote-715733841
Ref: Core and Builtins<159>-Footnote-725733907
Ref: Core and Builtins<159>-Footnote-735733973
Ref: Core and Builtins<159>-Footnote-745734039
Ref: Core and Builtins<159>-Footnote-755734105
Ref: Core and Builtins<159>-Footnote-765734171
Ref: Core and Builtins<159>-Footnote-775734237
Ref: Core and Builtins<159>-Footnote-785734303
Ref: Core and Builtins<159>-Footnote-795734369
Ref: Core and Builtins<159>-Footnote-805734435
Ref: Core and Builtins<159>-Footnote-815734501
Ref: Core and Builtins<159>-Footnote-825734567
Ref: Core and Builtins<159>-Footnote-835734633
Ref: Core and Builtins<159>-Footnote-845734699
Ref: Core and Builtins<159>-Footnote-855734765
Ref: Core and Builtins<159>-Footnote-865734831
Ref: Core and Builtins<159>-Footnote-875734897
Ref: Core and Builtins<159>-Footnote-885734963
Ref: Core and Builtins<159>-Footnote-895735029
Ref: Core and Builtins<159>-Footnote-905735095
Ref: Core and Builtins<159>-Footnote-915735161
Ref: Core and Builtins<159>-Footnote-925735227
Ref: Core and Builtins<159>-Footnote-935735293
Ref: Core and Builtins<159>-Footnote-945735359
Ref: Core and Builtins<159>-Footnote-955735425
Ref: Core and Builtins<159>-Footnote-965735491
Ref: Core and Builtins<159>-Footnote-975735559
Ref: Core and Builtins<159>-Footnote-985735625
Ref: Core and Builtins<159>-Footnote-995735691
Ref: Core and Builtins<159>-Footnote-1005735757
Ref: Core and Builtins<159>-Footnote-1015735824
Ref: Core and Builtins<159>-Footnote-1025735891
Ref: Core and Builtins<159>-Footnote-1035735958
Ref: Core and Builtins<159>-Footnote-1045736025
Ref: Core and Builtins<159>-Footnote-1055736092
Ref: Core and Builtins<159>-Footnote-1065736159
Ref: Core and Builtins<159>-Footnote-1075736226
Ref: Core and Builtins<159>-Footnote-1085736293
Ref: Core and Builtins<159>-Footnote-1095736360
Ref: Core and Builtins<159>-Footnote-1105736427
Ref: Core and Builtins<159>-Footnote-1115736494
Ref: Core and Builtins<159>-Footnote-1125736561
Ref: Core and Builtins<159>-Footnote-1135736628
Ref: Core and Builtins<159>-Footnote-1145736695
Ref: Core and Builtins<159>-Footnote-1155736762
Ref: Core and Builtins<159>-Footnote-1165736829
Ref: Core and Builtins<159>-Footnote-1175736896
Ref: Core and Builtins<159>-Footnote-1185736963
Ref: Core and Builtins<159>-Footnote-1195737030
Ref: Core and Builtins<159>-Footnote-1205737097
Ref: Core and Builtins<159>-Footnote-1215737164
Ref: Core and Builtins<159>-Footnote-1225737231
Ref: Core and Builtins<159>-Footnote-1235737298
Ref: Core and Builtins<159>-Footnote-1245737365
Ref: Core and Builtins<159>-Footnote-1255737432
Ref: Core and Builtins<159>-Footnote-1265737499
Ref: Core and Builtins<159>-Footnote-1275737566
Ref: Core and Builtins<159>-Footnote-1285737633
Ref: Core and Builtins<159>-Footnote-1295737700
Ref: Core and Builtins<159>-Footnote-1305737767
Ref: Core and Builtins<159>-Footnote-1315737834
Ref: Core and Builtins<159>-Footnote-1325737901
Ref: Core and Builtins<159>-Footnote-1335737968
Ref: Core and Builtins<159>-Footnote-1345738035
Ref: Core and Builtins<159>-Footnote-1355738102
Ref: Core and Builtins<159>-Footnote-1365738169
Ref: Core and Builtins<159>-Footnote-1375738236
Ref: Core and Builtins<159>-Footnote-1385738303
Ref: Core and Builtins<159>-Footnote-1395738370
Ref: Core and Builtins<159>-Footnote-1405738437
Ref: Core and Builtins<159>-Footnote-1415738504
Ref: Core and Builtins<159>-Footnote-1425738571
Ref: Core and Builtins<159>-Footnote-1435738638
Ref: Core and Builtins<159>-Footnote-1445738705
Ref: Core and Builtins<159>-Footnote-1455738772
Ref: Core and Builtins<159>-Footnote-1465738839
Ref: Core and Builtins<159>-Footnote-1475738906
Ref: Core and Builtins<159>-Footnote-1485738973
Ref: Core and Builtins<159>-Footnote-1495739040
Ref: Core and Builtins<159>-Footnote-1505739107
Ref: Core and Builtins<159>-Footnote-1515739174
Ref: Core and Builtins<159>-Footnote-1525739241
Ref: Core and Builtins<159>-Footnote-1535739308
Ref: Core and Builtins<159>-Footnote-1545739375
Ref: Core and Builtins<159>-Footnote-1555739442
Ref: Core and Builtins<159>-Footnote-1565739509
Ref: Core and Builtins<159>-Footnote-1575739576
Ref: Core and Builtins<159>-Footnote-1585739643
Ref: Core and Builtins<159>-Footnote-1595739710
Ref: Core and Builtins<159>-Footnote-1605739777
Ref: Core and Builtins<159>-Footnote-1615739844
Ref: Core and Builtins<159>-Footnote-1625739911
Node: ライブラリ<162>5739978
Ref: whatsnew/changelog id7465740117
Ref: 1e105740117
Ref: ライブラリ<162>-Footnote-15811038
Ref: ライブラリ<162>-Footnote-25811103
Ref: ライブラリ<162>-Footnote-35811168
Ref: ライブラリ<162>-Footnote-45811233
Ref: ライブラリ<162>-Footnote-55811298
Ref: ライブラリ<162>-Footnote-65811363
Ref: ライブラリ<162>-Footnote-75811428
Ref: ライブラリ<162>-Footnote-85811493
Ref: ライブラリ<162>-Footnote-95811558
Ref: ライブラリ<162>-Footnote-105811623
Ref: ライブラリ<162>-Footnote-115811689
Ref: ライブラリ<162>-Footnote-125811755
Ref: ライブラリ<162>-Footnote-135811821
Ref: ライブラリ<162>-Footnote-145811887
Ref: ライブラリ<162>-Footnote-155811953
Ref: ライブラリ<162>-Footnote-165812019
Ref: ライブラリ<162>-Footnote-175812085
Ref: ライブラリ<162>-Footnote-185812151
Ref: ライブラリ<162>-Footnote-195812217
Ref: ライブラリ<162>-Footnote-205812283
Ref: ライブラリ<162>-Footnote-215812349
Ref: ライブラリ<162>-Footnote-225812415
Ref: ライブラリ<162>-Footnote-235812481
Ref: ライブラリ<162>-Footnote-245812547
Ref: ライブラリ<162>-Footnote-255812613
Ref: ライブラリ<162>-Footnote-265812679
Ref: ライブラリ<162>-Footnote-275812745
Ref: ライブラリ<162>-Footnote-285812811
Ref: ライブラリ<162>-Footnote-295812877
Ref: ライブラリ<162>-Footnote-305812943
Ref: ライブラリ<162>-Footnote-315813009
Ref: ライブラリ<162>-Footnote-325813075
Ref: ライブラリ<162>-Footnote-335813141
Ref: ライブラリ<162>-Footnote-345813207
Ref: ライブラリ<162>-Footnote-355813273
Ref: ライブラリ<162>-Footnote-365813339
Ref: ライブラリ<162>-Footnote-375813405
Ref: ライブラリ<162>-Footnote-385813471
Ref: ライブラリ<162>-Footnote-395813537
Ref: ライブラリ<162>-Footnote-405813603
Ref: ライブラリ<162>-Footnote-415813669
Ref: ライブラリ<162>-Footnote-425813735
Ref: ライブラリ<162>-Footnote-435813801
Ref: ライブラリ<162>-Footnote-445813867
Ref: ライブラリ<162>-Footnote-455813933
Ref: ライブラリ<162>-Footnote-465813999
Ref: ライブラリ<162>-Footnote-475814065
Ref: ライブラリ<162>-Footnote-485814131
Ref: ライブラリ<162>-Footnote-495814197
Ref: ライブラリ<162>-Footnote-505814263
Ref: ライブラリ<162>-Footnote-515814329
Ref: ライブラリ<162>-Footnote-525814395
Ref: ライブラリ<162>-Footnote-535814461
Ref: ライブラリ<162>-Footnote-545814527
Ref: ライブラリ<162>-Footnote-555814593
Ref: ライブラリ<162>-Footnote-565814659
Ref: ライブラリ<162>-Footnote-575814725
Ref: ライブラリ<162>-Footnote-585814791
Ref: ライブラリ<162>-Footnote-595814857
Ref: ライブラリ<162>-Footnote-605814923
Ref: ライブラリ<162>-Footnote-615814989
Ref: ライブラリ<162>-Footnote-625815055
Ref: ライブラリ<162>-Footnote-635815121
Ref: ライブラリ<162>-Footnote-645815187
Ref: ライブラリ<162>-Footnote-655815253
Ref: ライブラリ<162>-Footnote-665815319
Ref: ライブラリ<162>-Footnote-675815385
Ref: ライブラリ<162>-Footnote-685815451
Ref: ライブラリ<162>-Footnote-695815517
Ref: ライブラリ<162>-Footnote-705815583
Ref: ライブラリ<162>-Footnote-715815649
Ref: ライブラリ<162>-Footnote-725815715
Ref: ライブラリ<162>-Footnote-735815781
Ref: ライブラリ<162>-Footnote-745815847
Ref: ライブラリ<162>-Footnote-755815913
Ref: ライブラリ<162>-Footnote-765815979
Ref: ライブラリ<162>-Footnote-775816045
Ref: ライブラリ<162>-Footnote-785816111
Ref: ライブラリ<162>-Footnote-795816177
Ref: ライブラリ<162>-Footnote-805816243
Ref: ライブラリ<162>-Footnote-815816309
Ref: ライブラリ<162>-Footnote-825816375
Ref: ライブラリ<162>-Footnote-835816441
Ref: ライブラリ<162>-Footnote-845816507
Ref: ライブラリ<162>-Footnote-855816573
Ref: ライブラリ<162>-Footnote-865816639
Ref: ライブラリ<162>-Footnote-875816705
Ref: ライブラリ<162>-Footnote-885816771
Ref: ライブラリ<162>-Footnote-895816837
Ref: ライブラリ<162>-Footnote-905816903
Ref: ライブラリ<162>-Footnote-915816969
Ref: ライブラリ<162>-Footnote-925817035
Ref: ライブラリ<162>-Footnote-935817101
Ref: ライブラリ<162>-Footnote-945817161
Ref: ライブラリ<162>-Footnote-955817227
Ref: ライブラリ<162>-Footnote-965817293
Ref: ライブラリ<162>-Footnote-975817359
Ref: ライブラリ<162>-Footnote-985817425
Ref: ライブラリ<162>-Footnote-995817491
Ref: ライブラリ<162>-Footnote-1005817557
Ref: ライブラリ<162>-Footnote-1015817624
Ref: ライブラリ<162>-Footnote-1025817691
Ref: ライブラリ<162>-Footnote-1035817758
Ref: ライブラリ<162>-Footnote-1045817825
Ref: ライブラリ<162>-Footnote-1055817892
Ref: ライブラリ<162>-Footnote-1065817959
Ref: ライブラリ<162>-Footnote-1075818026
Ref: ライブラリ<162>-Footnote-1085818093
Ref: ライブラリ<162>-Footnote-1095818160
Ref: ライブラリ<162>-Footnote-1105818227
Ref: ライブラリ<162>-Footnote-1115818294
Ref: ライブラリ<162>-Footnote-1125818361
Ref: ライブラリ<162>-Footnote-1135818428
Ref: ライブラリ<162>-Footnote-1145818495
Ref: ライブラリ<162>-Footnote-1155818562
Ref: ライブラリ<162>-Footnote-1165818629
Ref: ライブラリ<162>-Footnote-1175818696
Ref: ライブラリ<162>-Footnote-1185818763
Ref: ライブラリ<162>-Footnote-1195818830
Ref: ライブラリ<162>-Footnote-1205818897
Ref: ライブラリ<162>-Footnote-1215818964
Ref: ライブラリ<162>-Footnote-1225819031
Ref: ライブラリ<162>-Footnote-1235819098
Ref: ライブラリ<162>-Footnote-1245819165
Ref: ライブラリ<162>-Footnote-1255819232
Ref: ライブラリ<162>-Footnote-1265819298
Ref: ライブラリ<162>-Footnote-1275819365
Ref: ライブラリ<162>-Footnote-1285819432
Ref: ライブラリ<162>-Footnote-1295819499
Ref: ライブラリ<162>-Footnote-1305819566
Ref: ライブラリ<162>-Footnote-1315819633
Ref: ライブラリ<162>-Footnote-1325819700
Ref: ライブラリ<162>-Footnote-1335819767
Ref: ライブラリ<162>-Footnote-1345819834
Ref: ライブラリ<162>-Footnote-1355819901
Ref: ライブラリ<162>-Footnote-1365819968
Ref: ライブラリ<162>-Footnote-1375820034
Ref: ライブラリ<162>-Footnote-1385820101
Ref: ライブラリ<162>-Footnote-1395820168
Ref: ライブラリ<162>-Footnote-1405820235
Ref: ライブラリ<162>-Footnote-1415820302
Ref: ライブラリ<162>-Footnote-1425820369
Ref: ライブラリ<162>-Footnote-1435820436
Ref: ライブラリ<162>-Footnote-1445820503
Ref: ライブラリ<162>-Footnote-1455820570
Ref: ライブラリ<162>-Footnote-1465820637
Ref: ライブラリ<162>-Footnote-1475820704
Ref: ライブラリ<162>-Footnote-1485820771
Ref: ライブラリ<162>-Footnote-1495820838
Ref: ライブラリ<162>-Footnote-1505820905
Ref: ライブラリ<162>-Footnote-1515820972
Ref: ライブラリ<162>-Footnote-1525821039
Ref: ライブラリ<162>-Footnote-1535821106
Ref: ライブラリ<162>-Footnote-1545821173
Ref: ライブラリ<162>-Footnote-1555821239
Ref: ライブラリ<162>-Footnote-1565821306
Ref: ライブラリ<162>-Footnote-1575821373
Ref: ライブラリ<162>-Footnote-1585821440
Ref: ライブラリ<162>-Footnote-1595821507
Ref: ライブラリ<162>-Footnote-1605821574
Ref: ライブラリ<162>-Footnote-1615821641
Ref: ライブラリ<162>-Footnote-1625821685
Ref: ライブラリ<162>-Footnote-1635821752
Ref: ライブラリ<162>-Footnote-1645821819
Ref: ライブラリ<162>-Footnote-1655821886
Ref: ライブラリ<162>-Footnote-1665821952
Ref: ライブラリ<162>-Footnote-1675822019
Ref: ライブラリ<162>-Footnote-1685822086
Ref: ライブラリ<162>-Footnote-1695822153
Ref: ライブラリ<162>-Footnote-1705822220
Ref: ライブラリ<162>-Footnote-1715822287
Ref: ライブラリ<162>-Footnote-1725822354
Ref: ライブラリ<162>-Footnote-1735822421
Ref: ライブラリ<162>-Footnote-1745822488
Ref: ライブラリ<162>-Footnote-1755822554
Ref: ライブラリ<162>-Footnote-1765822621
Ref: ライブラリ<162>-Footnote-1775822688
Ref: ライブラリ<162>-Footnote-1785822755
Ref: ライブラリ<162>-Footnote-1795822822
Ref: ライブラリ<162>-Footnote-1805822889
Ref: ライブラリ<162>-Footnote-1815822955
Ref: ライブラリ<162>-Footnote-1825823022
Ref: ライブラリ<162>-Footnote-1835823089
Ref: ライブラリ<162>-Footnote-1845823156
Ref: ライブラリ<162>-Footnote-1855823223
Ref: ライブラリ<162>-Footnote-1865823290
Ref: ライブラリ<162>-Footnote-1875823357
Ref: ライブラリ<162>-Footnote-1885823424
Ref: ライブラリ<162>-Footnote-1895823491
Ref: ライブラリ<162>-Footnote-1905823558
Ref: ライブラリ<162>-Footnote-1915823625
Ref: ライブラリ<162>-Footnote-1925823692
Ref: ライブラリ<162>-Footnote-1935823759
Ref: ライブラリ<162>-Footnote-1945823826
Ref: ライブラリ<162>-Footnote-1955823893
Ref: ライブラリ<162>-Footnote-1965823960
Ref: ライブラリ<162>-Footnote-1975824027
Ref: ライブラリ<162>-Footnote-1985824094
Ref: ライブラリ<162>-Footnote-1995824161
Ref: ライブラリ<162>-Footnote-2005824228
Ref: ライブラリ<162>-Footnote-2015824295
Ref: ライブラリ<162>-Footnote-2025824362
Ref: ライブラリ<162>-Footnote-2035824430
Ref: ライブラリ<162>-Footnote-2045824497
Ref: ライブラリ<162>-Footnote-2055824564
Ref: ライブラリ<162>-Footnote-2065824631
Ref: ライブラリ<162>-Footnote-2075824698
Ref: ライブラリ<162>-Footnote-2085824765
Ref: ライブラリ<162>-Footnote-2095824832
Ref: ライブラリ<162>-Footnote-2105824899
Ref: ライブラリ<162>-Footnote-2115824966
Ref: ライブラリ<162>-Footnote-2125825033
Ref: ライブラリ<162>-Footnote-2135825100
Ref: ライブラリ<162>-Footnote-2145825144
Ref: ライブラリ<162>-Footnote-2155825211
Ref: ライブラリ<162>-Footnote-2165825278
Ref: ライブラリ<162>-Footnote-2175825345
Ref: ライブラリ<162>-Footnote-2185825412
Ref: ライブラリ<162>-Footnote-2195825479
Ref: ライブラリ<162>-Footnote-2205825546
Ref: ライブラリ<162>-Footnote-2215825613
Ref: ライブラリ<162>-Footnote-2225825680
Ref: ライブラリ<162>-Footnote-2235825747
Ref: ライブラリ<162>-Footnote-2245825814
Ref: ライブラリ<162>-Footnote-2255825881
Ref: ライブラリ<162>-Footnote-2265825948
Ref: ライブラリ<162>-Footnote-2275826015
Ref: ライブラリ<162>-Footnote-2285826082
Ref: ライブラリ<162>-Footnote-2295826149
Ref: ライブラリ<162>-Footnote-2305826216
Ref: ライブラリ<162>-Footnote-2315826283
Ref: ライブラリ<162>-Footnote-2325826350
Ref: ライブラリ<162>-Footnote-2335826417
Ref: ライブラリ<162>-Footnote-2345826484
Ref: ライブラリ<162>-Footnote-2355826551
Ref: ライブラリ<162>-Footnote-2365826618
Ref: ライブラリ<162>-Footnote-2375826685
Ref: ライブラリ<162>-Footnote-2385826752
Ref: ライブラリ<162>-Footnote-2395826819
Ref: ライブラリ<162>-Footnote-2405826886
Ref: ライブラリ<162>-Footnote-2415826953
Ref: ライブラリ<162>-Footnote-2425827020
Ref: ライブラリ<162>-Footnote-2435827087
Ref: ライブラリ<162>-Footnote-2445827154
Ref: ライブラリ<162>-Footnote-2455827221
Ref: ライブラリ<162>-Footnote-2465827288
Ref: ライブラリ<162>-Footnote-2475827355
Ref: ライブラリ<162>-Footnote-2485827422
Ref: ライブラリ<162>-Footnote-2495827489
Ref: ライブラリ<162>-Footnote-2505827556
Ref: ライブラリ<162>-Footnote-2515827623
Ref: ライブラリ<162>-Footnote-2525827690
Ref: ライブラリ<162>-Footnote-2535827757
Ref: ライブラリ<162>-Footnote-2545827824
Ref: ライブラリ<162>-Footnote-2555827891
Ref: ライブラリ<162>-Footnote-2565827958
Ref: ライブラリ<162>-Footnote-2575828025
Ref: ライブラリ<162>-Footnote-2585828092
Ref: ライブラリ<162>-Footnote-2595828159
Ref: ライブラリ<162>-Footnote-2605828226
Ref: ライブラリ<162>-Footnote-2615828292
Ref: ライブラリ<162>-Footnote-2625828359
Ref: ライブラリ<162>-Footnote-2635828426
Ref: ライブラリ<162>-Footnote-2645828493
Ref: ライブラリ<162>-Footnote-2655828560
Ref: ライブラリ<162>-Footnote-2665828627
Ref: ライブラリ<162>-Footnote-2675828694
Ref: ライブラリ<162>-Footnote-2685828761
Ref: ライブラリ<162>-Footnote-2695828828
Ref: ライブラリ<162>-Footnote-2705828895
Ref: ライブラリ<162>-Footnote-2715828962
Ref: ライブラリ<162>-Footnote-2725829029
Ref: ライブラリ<162>-Footnote-2735829096
Ref: ライブラリ<162>-Footnote-2745829163
Ref: ライブラリ<162>-Footnote-2755829230
Ref: ライブラリ<162>-Footnote-2765829297
Ref: ライブラリ<162>-Footnote-2775829364
Ref: ライブラリ<162>-Footnote-2785829431
Ref: ライブラリ<162>-Footnote-2795829498
Ref: ライブラリ<162>-Footnote-2805829565
Ref: ライブラリ<162>-Footnote-2815829632
Ref: ライブラリ<162>-Footnote-2825829699
Ref: ライブラリ<162>-Footnote-2835829766
Ref: ライブラリ<162>-Footnote-2845829833
Ref: ライブラリ<162>-Footnote-2855829900
Ref: ライブラリ<162>-Footnote-2865829967
Ref: ライブラリ<162>-Footnote-2875830034
Ref: ライブラリ<162>-Footnote-2885830101
Ref: ライブラリ<162>-Footnote-2895830168
Ref: ライブラリ<162>-Footnote-2905830235
Ref: ライブラリ<162>-Footnote-2915830302
Ref: ライブラリ<162>-Footnote-2925830369
Ref: ライブラリ<162>-Footnote-2935830436
Ref: ライブラリ<162>-Footnote-2945830503
Ref: ライブラリ<162>-Footnote-2955830570
Ref: ライブラリ<162>-Footnote-2965830637
Ref: ライブラリ<162>-Footnote-2975830704
Ref: ライブラリ<162>-Footnote-2985830771
Ref: ライブラリ<162>-Footnote-2995830838
Ref: ライブラリ<162>-Footnote-3005830905
Ref: ライブラリ<162>-Footnote-3015830972
Ref: ライブラリ<162>-Footnote-3025831039
Ref: ライブラリ<162>-Footnote-3035831106
Ref: ライブラリ<162>-Footnote-3045831173
Ref: ライブラリ<162>-Footnote-3055831240
Ref: ライブラリ<162>-Footnote-3065831307
Ref: ライブラリ<162>-Footnote-3075831374
Ref: ライブラリ<162>-Footnote-3085831441
Ref: ライブラリ<162>-Footnote-3095831508
Ref: ライブラリ<162>-Footnote-3105831575
Ref: ライブラリ<162>-Footnote-3115831642
Ref: ライブラリ<162>-Footnote-3125831709
Ref: ライブラリ<162>-Footnote-3135831776
Ref: ライブラリ<162>-Footnote-3145831843
Ref: ライブラリ<162>-Footnote-3155831910
Ref: ライブラリ<162>-Footnote-3165831977
Ref: ライブラリ<162>-Footnote-3175832044
Ref: ライブラリ<162>-Footnote-3185832111
Ref: ライブラリ<162>-Footnote-3195832178
Ref: ライブラリ<162>-Footnote-3205832245
Ref: ライブラリ<162>-Footnote-3215832312
Ref: ライブラリ<162>-Footnote-3225832379
Ref: ライブラリ<162>-Footnote-3235832446
Ref: ライブラリ<162>-Footnote-3245832513
Ref: ライブラリ<162>-Footnote-3255832580
Ref: ライブラリ<162>-Footnote-3265832647
Ref: ライブラリ<162>-Footnote-3275832714
Ref: ライブラリ<162>-Footnote-3285832781
Ref: ライブラリ<162>-Footnote-3295832849
Ref: ライブラリ<162>-Footnote-3305832916
Ref: ライブラリ<162>-Footnote-3315832983
Ref: ライブラリ<162>-Footnote-3325833050
Ref: ライブラリ<162>-Footnote-3335833117
Ref: ライブラリ<162>-Footnote-3345833184
Ref: ライブラリ<162>-Footnote-3355833251
Ref: ライブラリ<162>-Footnote-3365833318
Ref: ライブラリ<162>-Footnote-3375833385
Ref: ライブラリ<162>-Footnote-3385833452
Ref: ライブラリ<162>-Footnote-3395833519
Ref: ライブラリ<162>-Footnote-3405833586
Ref: ライブラリ<162>-Footnote-3415833653
Ref: ライブラリ<162>-Footnote-3425833720
Ref: ライブラリ<162>-Footnote-3435833787
Ref: ライブラリ<162>-Footnote-3445833854
Ref: ライブラリ<162>-Footnote-3455833921
Ref: ライブラリ<162>-Footnote-3465833965
Ref: ライブラリ<162>-Footnote-3475834032
Ref: ライブラリ<162>-Footnote-3485834099
Ref: ライブラリ<162>-Footnote-3495834166
Ref: ライブラリ<162>-Footnote-3505834210
Ref: ライブラリ<162>-Footnote-3515834277
Ref: ライブラリ<162>-Footnote-3525834344
Ref: ライブラリ<162>-Footnote-3535834411
Ref: ライブラリ<162>-Footnote-3545834478
Ref: ライブラリ<162>-Footnote-3555834545
Ref: ライブラリ<162>-Footnote-3565834612
Ref: ライブラリ<162>-Footnote-3575834679
Ref: ライブラリ<162>-Footnote-3585834746
Ref: ライブラリ<162>-Footnote-3595834813
Ref: ライブラリ<162>-Footnote-3605834880
Ref: ライブラリ<162>-Footnote-3615834947
Ref: ライブラリ<162>-Footnote-3625835014
Ref: ライブラリ<162>-Footnote-3635835081
Ref: ライブラリ<162>-Footnote-3645835148
Ref: ライブラリ<162>-Footnote-3655835215
Ref: ライブラリ<162>-Footnote-3665835282
Ref: ライブラリ<162>-Footnote-3675835349
Ref: ライブラリ<162>-Footnote-3685835416
Ref: ライブラリ<162>-Footnote-3695835483
Ref: ライブラリ<162>-Footnote-3705835550
Ref: ライブラリ<162>-Footnote-3715835617
Ref: ライブラリ<162>-Footnote-3725835684
Ref: ライブラリ<162>-Footnote-3735835751
Ref: ライブラリ<162>-Footnote-3745835818
Ref: ライブラリ<162>-Footnote-3755835885
Ref: ライブラリ<162>-Footnote-3765835952
Ref: ライブラリ<162>-Footnote-3775836019
Ref: ライブラリ<162>-Footnote-3785836086
Ref: ライブラリ<162>-Footnote-3795836153
Ref: ライブラリ<162>-Footnote-3805836220
Ref: ライブラリ<162>-Footnote-3815836287
Ref: ライブラリ<162>-Footnote-3825836354
Ref: ライブラリ<162>-Footnote-3835836421
Ref: ライブラリ<162>-Footnote-3845836488
Ref: ライブラリ<162>-Footnote-3855836555
Ref: ライブラリ<162>-Footnote-3865836622
Ref: ライブラリ<162>-Footnote-3875836689
Ref: ライブラリ<162>-Footnote-3885836756
Ref: ライブラリ<162>-Footnote-3895836823
Ref: ライブラリ<162>-Footnote-3905836890
Ref: ライブラリ<162>-Footnote-3915836957
Ref: ライブラリ<162>-Footnote-3925837024
Ref: ライブラリ<162>-Footnote-3935837091
Ref: ライブラリ<162>-Footnote-3945837158
Ref: ライブラリ<162>-Footnote-3955837225
Ref: ライブラリ<162>-Footnote-3965837292
Ref: ライブラリ<162>-Footnote-3975837359
Ref: ライブラリ<162>-Footnote-3985837426
Ref: ライブラリ<162>-Footnote-3995837493
Ref: ライブラリ<162>-Footnote-4005837560
Ref: ライブラリ<162>-Footnote-4015837627
Ref: ライブラリ<162>-Footnote-4025837694
Ref: ライブラリ<162>-Footnote-4035837761
Ref: ライブラリ<162>-Footnote-4045837828
Ref: ライブラリ<162>-Footnote-4055837895
Ref: ライブラリ<162>-Footnote-4065837962
Ref: ライブラリ<162>-Footnote-4075838029
Ref: ライブラリ<162>-Footnote-4085838096
Ref: ライブラリ<162>-Footnote-4095838163
Ref: ライブラリ<162>-Footnote-4105838230
Ref: ライブラリ<162>-Footnote-4115838297
Ref: ライブラリ<162>-Footnote-4125838364
Ref: ライブラリ<162>-Footnote-4135838431
Ref: ライブラリ<162>-Footnote-4145838498
Ref: ライブラリ<162>-Footnote-4155838565
Ref: ライブラリ<162>-Footnote-4165838632
Ref: ライブラリ<162>-Footnote-4175838699
Ref: ライブラリ<162>-Footnote-4185838766
Ref: ライブラリ<162>-Footnote-4195838833
Ref: ライブラリ<162>-Footnote-4205838900
Ref: ライブラリ<162>-Footnote-4215838967
Ref: ライブラリ<162>-Footnote-4225839034
Ref: ライブラリ<162>-Footnote-4235839100
Ref: ライブラリ<162>-Footnote-4245839167
Ref: ライブラリ<162>-Footnote-4255839234
Ref: ライブラリ<162>-Footnote-4265839301
Ref: ライブラリ<162>-Footnote-4275839368
Ref: ライブラリ<162>-Footnote-4285839435
Ref: ライブラリ<162>-Footnote-4295839502
Ref: ライブラリ<162>-Footnote-4305839569
Ref: ライブラリ<162>-Footnote-4315839636
Ref: ライブラリ<162>-Footnote-4325839703
Ref: ライブラリ<162>-Footnote-4335839770
Ref: ライブラリ<162>-Footnote-4345839837
Ref: ライブラリ<162>-Footnote-4355839904
Ref: ライブラリ<162>-Footnote-4365839971
Ref: ライブラリ<162>-Footnote-4375840038
Node: ドキュメント<56>5840105
Ref: whatsnew/changelog id7475840235
Ref: 1e275840235
Ref: ドキュメント<56>-Footnote-15846920
Ref: ドキュメント<56>-Footnote-25846985
Ref: ドキュメント<56>-Footnote-35847050
Ref: ドキュメント<56>-Footnote-45847115
Ref: ドキュメント<56>-Footnote-55847180
Ref: ドキュメント<56>-Footnote-65847245
Ref: ドキュメント<56>-Footnote-75847310
Ref: ドキュメント<56>-Footnote-85847375
Ref: ドキュメント<56>-Footnote-95847440
Ref: ドキュメント<56>-Footnote-105847505
Ref: ドキュメント<56>-Footnote-115847571
Ref: ドキュメント<56>-Footnote-125847637
Ref: ドキュメント<56>-Footnote-135847703
Ref: ドキュメント<56>-Footnote-145847769
Ref: ドキュメント<56>-Footnote-155847835
Ref: ドキュメント<56>-Footnote-165847901
Ref: ドキュメント<56>-Footnote-175847967
Ref: ドキュメント<56>-Footnote-185848033
Ref: ドキュメント<56>-Footnote-195848099
Ref: ドキュメント<56>-Footnote-205848165
Ref: ドキュメント<56>-Footnote-215848231
Ref: ドキュメント<56>-Footnote-225848297
Ref: ドキュメント<56>-Footnote-235848363
Ref: ドキュメント<56>-Footnote-245848406
Ref: ドキュメント<56>-Footnote-255848472
Ref: ドキュメント<56>-Footnote-265848538
Ref: ドキュメント<56>-Footnote-275848604
Ref: ドキュメント<56>-Footnote-285848670
Ref: ドキュメント<56>-Footnote-295848736
Ref: ドキュメント<56>-Footnote-305848779
Ref: ドキュメント<56>-Footnote-315848845
Ref: ドキュメント<56>-Footnote-325848911
Ref: ドキュメント<56>-Footnote-335848977
Ref: ドキュメント<56>-Footnote-345849043
Ref: ドキュメント<56>-Footnote-355849109
Ref: ドキュメント<56>-Footnote-365849175
Ref: ドキュメント<56>-Footnote-375849241
Ref: ドキュメント<56>-Footnote-385849307
Ref: ドキュメント<56>-Footnote-395849373
Ref: ドキュメント<56>-Footnote-405849439
Ref: ドキュメント<56>-Footnote-415849505
Ref: ドキュメント<56>-Footnote-425849571
Ref: ドキュメント<56>-Footnote-435849637
Ref: ドキュメント<56>-Footnote-445849703
Ref: ドキュメント<56>-Footnote-455849769
Ref: ドキュメント<56>-Footnote-465849835
Ref: ドキュメント<56>-Footnote-475849901
Ref: ドキュメント<56>-Footnote-485849967
Ref: ドキュメント<56>-Footnote-495850033
Ref: ドキュメント<56>-Footnote-505850099
Ref: ドキュメント<56>-Footnote-515850164
Ref: ドキュメント<56>-Footnote-525850230
Ref: ドキュメント<56>-Footnote-535850296
Ref: ドキュメント<56>-Footnote-545850362
Ref: ドキュメント<56>-Footnote-555850428
Ref: ドキュメント<56>-Footnote-565850494
Ref: ドキュメント<56>-Footnote-575850559
Ref: ドキュメント<56>-Footnote-585850625
Ref: ドキュメント<56>-Footnote-595850691
Node: テスト<54>5850757
Ref: whatsnew/changelog id7485850880
Ref: 1e295850880
Ref: テスト<54>-Footnote-15858477
Ref: テスト<54>-Footnote-25858542
Ref: テスト<54>-Footnote-35858607
Ref: テスト<54>-Footnote-45858672
Ref: テスト<54>-Footnote-55858737
Ref: テスト<54>-Footnote-65858802
Ref: テスト<54>-Footnote-75858867
Ref: テスト<54>-Footnote-85858932
Ref: テスト<54>-Footnote-95858997
Ref: テスト<54>-Footnote-105859062
Ref: テスト<54>-Footnote-115859128
Ref: テスト<54>-Footnote-125859194
Ref: テスト<54>-Footnote-135859260
Ref: テスト<54>-Footnote-145859326
Ref: テスト<54>-Footnote-155859392
Ref: テスト<54>-Footnote-165859458
Ref: テスト<54>-Footnote-175859524
Ref: テスト<54>-Footnote-185859590
Ref: テスト<54>-Footnote-195859656
Ref: テスト<54>-Footnote-205859722
Ref: テスト<54>-Footnote-215859788
Ref: テスト<54>-Footnote-225859854
Ref: テスト<54>-Footnote-235859920
Ref: テスト<54>-Footnote-245859986
Ref: テスト<54>-Footnote-255860052
Ref: テスト<54>-Footnote-265860118
Ref: テスト<54>-Footnote-275860184
Ref: テスト<54>-Footnote-285860250
Ref: テスト<54>-Footnote-295860316
Ref: テスト<54>-Footnote-305860382
Ref: テスト<54>-Footnote-315860448
Ref: テスト<54>-Footnote-325860514
Ref: テスト<54>-Footnote-335860580
Ref: テスト<54>-Footnote-345860646
Ref: テスト<54>-Footnote-355860712
Ref: テスト<54>-Footnote-365860778
Ref: テスト<54>-Footnote-375860844
Ref: テスト<54>-Footnote-385860910
Ref: テスト<54>-Footnote-395860976
Ref: テスト<54>-Footnote-405861042
Ref: テスト<54>-Footnote-415861108
Ref: テスト<54>-Footnote-425861174
Ref: テスト<54>-Footnote-435861240
Ref: テスト<54>-Footnote-445861306
Ref: テスト<54>-Footnote-455861372
Ref: テスト<54>-Footnote-465861438
Ref: テスト<54>-Footnote-475861504
Ref: テスト<54>-Footnote-485861570
Node: ビルド<61>5861636
Ref: whatsnew/changelog id7495861748
Ref: 1e2a5861748
Ref: ビルド<61>-Footnote-15866863
Ref: ビルド<61>-Footnote-25866928
Ref: ビルド<61>-Footnote-35866993
Ref: ビルド<61>-Footnote-45867058
Ref: ビルド<61>-Footnote-55867123
Ref: ビルド<61>-Footnote-65867188
Ref: ビルド<61>-Footnote-75867253
Ref: ビルド<61>-Footnote-85867318
Ref: ビルド<61>-Footnote-95867383
Ref: ビルド<61>-Footnote-105867448
Ref: ビルド<61>-Footnote-115867514
Ref: ビルド<61>-Footnote-125867580
Ref: ビルド<61>-Footnote-135867646
Ref: ビルド<61>-Footnote-145867712
Ref: ビルド<61>-Footnote-155867778
Ref: ビルド<61>-Footnote-165867844
Ref: ビルド<61>-Footnote-175867910
Ref: ビルド<61>-Footnote-185867976
Ref: ビルド<61>-Footnote-195868042
Ref: ビルド<61>-Footnote-205868108
Ref: ビルド<61>-Footnote-215868174
Ref: ビルド<61>-Footnote-225868240
Ref: ビルド<61>-Footnote-235868306
Ref: ビルド<61>-Footnote-245868371
Ref: ビルド<61>-Footnote-255868437
Ref: ビルド<61>-Footnote-265868503
Ref: ビルド<61>-Footnote-275868569
Ref: ビルド<61>-Footnote-285868635
Ref: ビルド<61>-Footnote-295868701
Ref: ビルド<61>-Footnote-305868767
Ref: ビルド<61>-Footnote-315868833
Ref: ビルド<61>-Footnote-325868899
Ref: ビルド<61>-Footnote-335868965
Ref: ビルド<61>-Footnote-345869031
Ref: ビルド<61>-Footnote-355869097
Ref: ビルド<61>-Footnote-365869163
Ref: ビルド<61>-Footnote-375869229
Node: Windows<55>5869295
Ref: whatsnew/changelog id7505869403
Ref: 1e2c5869403
Ref: Windows<55>-Footnote-15873812
Ref: Windows<55>-Footnote-25873877
Ref: Windows<55>-Footnote-35873942
Ref: Windows<55>-Footnote-45874007
Ref: Windows<55>-Footnote-55874072
Ref: Windows<55>-Footnote-65874137
Ref: Windows<55>-Footnote-75874202
Ref: Windows<55>-Footnote-85874267
Ref: Windows<55>-Footnote-95874332
Ref: Windows<55>-Footnote-105874397
Ref: Windows<55>-Footnote-115874463
Ref: Windows<55>-Footnote-125874529
Ref: Windows<55>-Footnote-135874595
Ref: Windows<55>-Footnote-145874661
Ref: Windows<55>-Footnote-155874727
Ref: Windows<55>-Footnote-165874793
Ref: Windows<55>-Footnote-175874859
Ref: Windows<55>-Footnote-185874925
Ref: Windows<55>-Footnote-195874991
Ref: Windows<55>-Footnote-205875057
Ref: Windows<55>-Footnote-215875123
Ref: Windows<55>-Footnote-225875189
Ref: Windows<55>-Footnote-235875255
Ref: Windows<55>-Footnote-245875321
Ref: Windows<55>-Footnote-255875387
Ref: Windows<55>-Footnote-265875453
Ref: Windows<55>-Footnote-275875519
Ref: Windows<55>-Footnote-285875585
Ref: Windows<55>-Footnote-295875651
Ref: Windows<55>-Footnote-305875717
Ref: Windows<55>-Footnote-315875783
Ref: Windows<55>-Footnote-325875849
Ref: Windows<55>-Footnote-335875915
Ref: Windows<55>-Footnote-345875981
Ref: Windows<55>-Footnote-355876047
Ref: Windows<55>-Footnote-365876113
Ref: Windows<55>-Footnote-375876179
Ref: Windows<55>-Footnote-385876245
Ref: Windows<55>-Footnote-395876311
Ref: Windows<55>-Footnote-405876377
Node: macOS<42>5876442
Ref: whatsnew/changelog id7515876545
Ref: 1e2d5876545
Ref: macOS<42>-Footnote-15878150
Ref: macOS<42>-Footnote-25878215
Ref: macOS<42>-Footnote-35878280
Ref: macOS<42>-Footnote-45878345
Ref: macOS<42>-Footnote-55878410
Ref: macOS<42>-Footnote-65878475
Ref: macOS<42>-Footnote-75878540
Ref: macOS<42>-Footnote-85878605
Ref: macOS<42>-Footnote-95878670
Ref: macOS<42>-Footnote-105878735
Node: IDLE<37>5878801
Ref: whatsnew/changelog id7525878908
Ref: 1e2e5878908
Ref: IDLE<37>-Footnote-15887270
Ref: IDLE<37>-Footnote-25887335
Ref: IDLE<37>-Footnote-35887400
Ref: IDLE<37>-Footnote-45887465
Ref: IDLE<37>-Footnote-55887530
Ref: IDLE<37>-Footnote-65887595
Ref: IDLE<37>-Footnote-75887660
Ref: IDLE<37>-Footnote-85887725
Ref: IDLE<37>-Footnote-95887790
Ref: IDLE<37>-Footnote-105887855
Ref: IDLE<37>-Footnote-115887921
Ref: IDLE<37>-Footnote-125887987
Ref: IDLE<37>-Footnote-135888053
Ref: IDLE<37>-Footnote-145888119
Ref: IDLE<37>-Footnote-155888185
Ref: IDLE<37>-Footnote-165888251
Ref: IDLE<37>-Footnote-175888317
Ref: IDLE<37>-Footnote-185888383
Ref: IDLE<37>-Footnote-195888449
Ref: IDLE<37>-Footnote-205888515
Ref: IDLE<37>-Footnote-215888581
Ref: IDLE<37>-Footnote-225888647
Ref: IDLE<37>-Footnote-235888713
Ref: IDLE<37>-Footnote-245888779
Ref: IDLE<37>-Footnote-255888845
Ref: IDLE<37>-Footnote-265888911
Ref: IDLE<37>-Footnote-275888977
Ref: IDLE<37>-Footnote-285889045
Ref: IDLE<37>-Footnote-295889111
Ref: IDLE<37>-Footnote-305889177
Ref: IDLE<37>-Footnote-315889243
Ref: IDLE<37>-Footnote-325889309
Ref: IDLE<37>-Footnote-335889375
Ref: IDLE<37>-Footnote-345889441
Ref: IDLE<37>-Footnote-355889507
Ref: IDLE<37>-Footnote-365889573
Ref: IDLE<37>-Footnote-375889639
Ref: IDLE<37>-Footnote-385889705
Ref: IDLE<37>-Footnote-395889771
Ref: IDLE<37>-Footnote-405889837
Ref: IDLE<37>-Footnote-415889903
Ref: IDLE<37>-Footnote-425889969
Ref: IDLE<37>-Footnote-435890035
Ref: IDLE<37>-Footnote-445890101
Ref: IDLE<37>-Footnote-455890167
Ref: IDLE<37>-Footnote-465890233
Ref: IDLE<37>-Footnote-475890299
Ref: IDLE<37>-Footnote-485890365
Ref: IDLE<37>-Footnote-495890431
Ref: IDLE<37>-Footnote-505890497
Ref: IDLE<37>-Footnote-515890563
Ref: IDLE<37>-Footnote-525890629
Ref: IDLE<37>-Footnote-535890695
Ref: IDLE<37>-Footnote-545890761
Ref: IDLE<37>-Footnote-555890827
Ref: IDLE<37>-Footnote-565890893
Ref: IDLE<37>-Footnote-575890959
Ref: IDLE<37>-Footnote-585891025
Ref: IDLE<37>-Footnote-595891091
Node: Tools/Demos<37>5891157
Ref: whatsnew/changelog id7535891264
Ref: 1e2f5891264
Ref: Tools/Demos<37>-Footnote-15892909
Ref: Tools/Demos<37>-Footnote-25892974
Ref: Tools/Demos<37>-Footnote-35893039
Ref: Tools/Demos<37>-Footnote-45893104
Ref: Tools/Demos<37>-Footnote-55893169
Ref: Tools/Demos<37>-Footnote-65893234
Ref: Tools/Demos<37>-Footnote-75893299
Ref: Tools/Demos<37>-Footnote-85893364
Ref: Tools/Demos<37>-Footnote-95893429
Ref: Tools/Demos<37>-Footnote-105893494
Ref: Tools/Demos<37>-Footnote-115893560
Ref: Tools/Demos<37>-Footnote-125893626
Node: C API<56>5893692
Ref: whatsnew/changelog id7545893782
Ref: 1e305893782
Ref: C API<56>-Footnote-15897199
Ref: C API<56>-Footnote-25897264
Ref: C API<56>-Footnote-35897329
Ref: C API<56>-Footnote-45897394
Ref: C API<56>-Footnote-55897459
Ref: C API<56>-Footnote-65897524
Ref: C API<56>-Footnote-75897589
Ref: C API<56>-Footnote-85897654
Ref: C API<56>-Footnote-95897719
Ref: C API<56>-Footnote-105897784
Ref: C API<56>-Footnote-115897850
Ref: C API<56>-Footnote-125897916
Ref: C API<56>-Footnote-135897982
Ref: C API<56>-Footnote-145898048
Ref: C API<56>-Footnote-155898114
Ref: C API<56>-Footnote-165898180
Ref: C API<56>-Footnote-175898246
Ref: C API<56>-Footnote-185898312
Ref: C API<56>-Footnote-195898378
Ref: C API<56>-Footnote-205898444
Ref: C API<56>-Footnote-215898510
Ref: C API<56>-Footnote-225898576
Node: Python 3 7 0 final5898642
Ref: whatsnew/changelog python-3-7-0-final5898779
Ref: 1e395898779
Node: ライブラリ<163>5898933
Ref: whatsnew/changelog id7555899026
Ref: 1e3a5899026
Ref: ライブラリ<163>-Footnote-15899207
Node: C API<57>5899272
Ref: whatsnew/changelog id7565899365
Ref: 1e3c5899365
Ref: C API<57>-Footnote-15899576
Node: Python 3 7 0 release candidate 15899641
Ref: whatsnew/changelog python-3-7-0-release-candidate-15899777
Ref: 1e3d5899777
Node: Core and Builtins<160>5900100
Ref: whatsnew/changelog id7575900220
Ref: 1e3e5900220
Ref: Core and Builtins<160>-Footnote-15900862
Ref: Core and Builtins<160>-Footnote-25900927
Ref: Core and Builtins<160>-Footnote-35900992
Ref: Core and Builtins<160>-Footnote-45901057
Node: ライブラリ<164>5901122
Ref: whatsnew/changelog id7585901273
Ref: 1e3f5901273
Ref: ライブラリ<164>-Footnote-15902980
Ref: ライブラリ<164>-Footnote-25903045
Ref: ライブラリ<164>-Footnote-35903110
Ref: ライブラリ<164>-Footnote-45903175
Ref: ライブラリ<164>-Footnote-55903240
Ref: ライブラリ<164>-Footnote-65903305
Ref: ライブラリ<164>-Footnote-75903370
Ref: ライブラリ<164>-Footnote-85903435
Ref: ライブラリ<164>-Footnote-95903500
Ref: ライブラリ<164>-Footnote-105903565
Ref: ライブラリ<164>-Footnote-115903631
Ref: ライブラリ<164>-Footnote-125903697
Ref: ライブラリ<164>-Footnote-135903763
Node: ドキュメント<57>5903829
Ref: whatsnew/changelog id7595903971
Ref: 1e405903971
Ref: ドキュメント<57>-Footnote-15904478
Ref: ドキュメント<57>-Footnote-25904543
Ref: ドキュメント<57>-Footnote-35904585
Ref: ドキュメント<57>-Footnote-45904650
Node: ビルド<62>5904715
Ref: whatsnew/changelog id7605904848
Ref: 1e415904848
Ref: ビルド<62>-Footnote-15905115
Node: Windows<56>5905179
Ref: whatsnew/changelog id7615905298
Ref: 1e425905298
Ref: Windows<56>-Footnote-15905455
Node: IDLE<38>5905520
Ref: whatsnew/changelog id7625905617
Ref: 1e435905617
Ref: IDLE<38>-Footnote-15906837
Ref: IDLE<38>-Footnote-25906902
Ref: IDLE<38>-Footnote-35906967
Ref: IDLE<38>-Footnote-45907032
Ref: IDLE<38>-Footnote-55907097
Ref: IDLE<38>-Footnote-65907162
Node: Python 3 7 0 beta 55907227
Ref: whatsnew/changelog python-3-7-0-beta-55907364
Ref: 1e445907364
Node: Core and Builtins<161>5907685
Ref: whatsnew/changelog id7635907792
Ref: 1e455907792
Ref: Core and Builtins<161>-Footnote-15909304
Ref: Core and Builtins<161>-Footnote-25909369
Ref: Core and Builtins<161>-Footnote-35909434
Ref: Core and Builtins<161>-Footnote-45909499
Ref: Core and Builtins<161>-Footnote-55909564
Ref: Core and Builtins<161>-Footnote-65909629
Ref: Core and Builtins<161>-Footnote-75909694
Ref: Core and Builtins<161>-Footnote-85909759
Ref: Core and Builtins<161>-Footnote-95909824
Node: ライブラリ<165>5909889
Ref: whatsnew/changelog id7645910027
Ref: 1e465910027
Ref: ライブラリ<165>-Footnote-15915630
Ref: ライブラリ<165>-Footnote-25915695
Ref: ライブラリ<165>-Footnote-35915760
Ref: ライブラリ<165>-Footnote-45915825
Ref: ライブラリ<165>-Footnote-55915890
Ref: ライブラリ<165>-Footnote-65915955
Ref: ライブラリ<165>-Footnote-75916020
Ref: ライブラリ<165>-Footnote-85916085
Ref: ライブラリ<165>-Footnote-95916150
Ref: ライブラリ<165>-Footnote-105916215
Ref: ライブラリ<165>-Footnote-115916281
Ref: ライブラリ<165>-Footnote-125916347
Ref: ライブラリ<165>-Footnote-135916413
Ref: ライブラリ<165>-Footnote-145916479
Ref: ライブラリ<165>-Footnote-155916545
Ref: ライブラリ<165>-Footnote-165916611
Ref: ライブラリ<165>-Footnote-175916677
Ref: ライブラリ<165>-Footnote-185916743
Ref: ライブラリ<165>-Footnote-195916809
Ref: ライブラリ<165>-Footnote-205916875
Ref: ライブラリ<165>-Footnote-215916941
Ref: ライブラリ<165>-Footnote-225917007
Ref: ライブラリ<165>-Footnote-235917073
Ref: ライブラリ<165>-Footnote-245917139
Ref: ライブラリ<165>-Footnote-255917205
Ref: ライブラリ<165>-Footnote-265917271
Ref: ライブラリ<165>-Footnote-275917337
Ref: ライブラリ<165>-Footnote-285917403
Ref: ライブラリ<165>-Footnote-295917469
Ref: ライブラリ<165>-Footnote-305917535
Ref: ライブラリ<165>-Footnote-315917601
Ref: ライブラリ<165>-Footnote-325917667
Ref: ライブラリ<165>-Footnote-335917733
Ref: ライブラリ<165>-Footnote-345917799
Ref: ライブラリ<165>-Footnote-355917865
Ref: ライブラリ<165>-Footnote-365917931
Ref: ライブラリ<165>-Footnote-375917997
Ref: ライブラリ<165>-Footnote-385918063
Node: ドキュメント<58>5918129
Ref: whatsnew/changelog id7655918258
Ref: 1e475918258
Ref: ドキュメント<58>-Footnote-15918732
Ref: ドキュメント<58>-Footnote-25918797
Ref: ドキュメント<58>-Footnote-35918862
Ref: ドキュメント<58>-Footnote-45918904
Ref: ドキュメント<58>-Footnote-55918969
Ref: ドキュメント<58>-Footnote-65919034
Node: テスト<55>5919099
Ref: whatsnew/changelog id7665919221
Ref: 1e485919221
Ref: テスト<55>-Footnote-15919575
Ref: テスト<55>-Footnote-25919640
Node: ビルド<63>5919705
Ref: whatsnew/changelog id7675919814
Ref: 1e495919814
Ref: ビルド<63>-Footnote-15920298
Ref: ビルド<63>-Footnote-25920363
Ref: ビルド<63>-Footnote-35920428
Node: macOS<43>5920493
Ref: whatsnew/changelog id7685920597
Ref: 1e4a5920597
Ref: macOS<43>-Footnote-15920837
Node: IDLE<39>5920902
Ref: whatsnew/changelog id7695920984
Ref: 1e4b5920984
Ref: IDLE<39>-Footnote-15921261
Ref: IDLE<39>-Footnote-25921326
Ref: IDLE<39>-Footnote-35921391
Node: Python 3 7 0 beta 45921456
Ref: whatsnew/changelog python-3-7-0-beta-45921580
Ref: 1e4c5921580
Node: Core and Builtins<162>5921957
Ref: whatsnew/changelog id7705922064
Ref: 1e4d5922064
Ref: Core and Builtins<162>-Footnote-15923190
Ref: Core and Builtins<162>-Footnote-25923255
Ref: Core and Builtins<162>-Footnote-35923320
Ref: Core and Builtins<162>-Footnote-45923385
Ref: Core and Builtins<162>-Footnote-55923450
Ref: Core and Builtins<162>-Footnote-65923515
Ref: Core and Builtins<162>-Footnote-75923580
Node: ライブラリ<166>5923645
Ref: whatsnew/changelog id7715923783
Ref: 1e4e5923783
Ref: ライブラリ<166>-Footnote-15926624
Ref: ライブラリ<166>-Footnote-25926689
Ref: ライブラリ<166>-Footnote-35926754
Ref: ライブラリ<166>-Footnote-45926819
Ref: ライブラリ<166>-Footnote-55926885
Ref: ライブラリ<166>-Footnote-65926950
Ref: ライブラリ<166>-Footnote-75927015
Ref: ライブラリ<166>-Footnote-85927080
Ref: ライブラリ<166>-Footnote-95927145
Ref: ライブラリ<166>-Footnote-105927210
Ref: ライブラリ<166>-Footnote-115927276
Ref: ライブラリ<166>-Footnote-125927342
Ref: ライブラリ<166>-Footnote-135927408
Ref: ライブラリ<166>-Footnote-145927474
Ref: ライブラリ<166>-Footnote-155927540
Ref: ライブラリ<166>-Footnote-165927606
Ref: ライブラリ<166>-Footnote-175927672
Ref: ライブラリ<166>-Footnote-185927715
Ref: ライブラリ<166>-Footnote-195927781
Ref: ライブラリ<166>-Footnote-205927847
Ref: ライブラリ<166>-Footnote-215927913
Ref: ライブラリ<166>-Footnote-225927979
Node: ドキュメント<59>5928045
Ref: whatsnew/changelog id7725928174
Ref: 1e4f5928174
Ref: ドキュメント<59>-Footnote-15928929
Ref: ドキュメント<59>-Footnote-25928994
Ref: ドキュメント<59>-Footnote-35929059
Ref: ドキュメント<59>-Footnote-45929124
Ref: ドキュメント<59>-Footnote-55929189
Ref: ドキュメント<59>-Footnote-65929253
Node: テスト<56>5929318
Ref: whatsnew/changelog id7735929440
Ref: 1e505929440
Ref: テスト<56>-Footnote-15929661
Node: ビルド<64>5929726
Ref: whatsnew/changelog id7745929837
Ref: 1e515929837
Ref: ビルド<64>-Footnote-15930532
Ref: ビルド<64>-Footnote-25930597
Ref: ビルド<64>-Footnote-35930662
Ref: ビルド<64>-Footnote-45930727
Ref: ビルド<64>-Footnote-55930792
Node: Windows<57>5930857
Ref: whatsnew/changelog id7755930964
Ref: 1e525930964
Ref: Windows<57>-Footnote-15931105
Node: macOS<44>5931170
Ref: whatsnew/changelog id7765931272
Ref: 1e535931272
Ref: macOS<44>-Footnote-15931413
Node: IDLE<40>5931478
Ref: whatsnew/changelog id7775931584
Ref: 1e545931584
Ref: IDLE<40>-Footnote-15932162
Ref: IDLE<40>-Footnote-25932227
Node: Tools/Demos<38>5932292
Ref: whatsnew/changelog id7785932380
Ref: 1e555932380
Ref: Tools/Demos<38>-Footnote-15932984
Ref: Tools/Demos<38>-Footnote-25933049
Ref: Tools/Demos<38>-Footnote-35933114
Ref: Tools/Demos<38>-Footnote-45933179
Node: Python 3 7 0 beta 35933244
Ref: whatsnew/changelog python-3-7-0-beta-35933368
Ref: 1e565933368
Node: セキュリティ<47>5933811
Ref: whatsnew/changelog id7795933920
Ref: 1e575933920
Ref: セキュリティ<47>-Footnote-15934566
Ref: セキュリティ<47>-Footnote-25934631
Ref: セキュリティ<47>-Footnote-35934686
Ref: セキュリティ<47>-Footnote-45934751
Ref: セキュリティ<47>-Footnote-55934816
Ref: セキュリティ<47>-Footnote-65934871
Node: Core and Builtins<163>5934926
Ref: whatsnew/changelog id7805935064
Ref: 1e585935064
Ref: Core and Builtins<163>-Footnote-15936260
Ref: Core and Builtins<163>-Footnote-25936325
Ref: Core and Builtins<163>-Footnote-35936390
Ref: Core and Builtins<163>-Footnote-45936455
Ref: Core and Builtins<163>-Footnote-55936520
Ref: Core and Builtins<163>-Footnote-65936585
Ref: Core and Builtins<163>-Footnote-75936650
Node: ライブラリ<167>5936715
Ref: whatsnew/changelog id7815936853
Ref: 1e595936853
Ref: ライブラリ<167>-Footnote-15940907
Ref: ライブラリ<167>-Footnote-25940972
Ref: ライブラリ<167>-Footnote-35941037
Ref: ライブラリ<167>-Footnote-45941102
Ref: ライブラリ<167>-Footnote-55941167
Ref: ライブラリ<167>-Footnote-65941232
Ref: ライブラリ<167>-Footnote-75941297
Ref: ライブラリ<167>-Footnote-85941362
Ref: ライブラリ<167>-Footnote-95941427
Ref: ライブラリ<167>-Footnote-105941492
Ref: ライブラリ<167>-Footnote-115941558
Ref: ライブラリ<167>-Footnote-125941624
Ref: ライブラリ<167>-Footnote-135941690
Ref: ライブラリ<167>-Footnote-145941756
Ref: ライブラリ<167>-Footnote-155941822
Ref: ライブラリ<167>-Footnote-165941888
Ref: ライブラリ<167>-Footnote-175941954
Ref: ライブラリ<167>-Footnote-185942020
Ref: ライブラリ<167>-Footnote-195942086
Ref: ライブラリ<167>-Footnote-205942152
Ref: ライブラリ<167>-Footnote-215942218
Ref: ライブラリ<167>-Footnote-225942284
Ref: ライブラリ<167>-Footnote-235942350
Ref: ライブラリ<167>-Footnote-245942416
Ref: ライブラリ<167>-Footnote-255942482
Ref: ライブラリ<167>-Footnote-265942548
Ref: ライブラリ<167>-Footnote-275942614
Node: ドキュメント<60>5942680
Ref: whatsnew/changelog id7825942809
Ref: 1e5a5942809
Ref: ドキュメント<60>-Footnote-15943450
Ref: ドキュメント<60>-Footnote-25943515
Ref: ドキュメント<60>-Footnote-35943580
Ref: ドキュメント<60>-Footnote-45943645
Ref: ドキュメント<60>-Footnote-55943710
Node: テスト<57>5943775
Ref: whatsnew/changelog id7835943897
Ref: 1e5b5943897
Ref: テスト<57>-Footnote-15944235
Ref: テスト<57>-Footnote-25944300
Ref: テスト<57>-Footnote-35944365
Node: ビルド<65>5944430
Ref: whatsnew/changelog id7845944541
Ref: 1e5c5944541
Ref: ビルド<65>-Footnote-15944683
Node: Windows<58>5944748
Ref: whatsnew/changelog id7855944855
Ref: 1e5d5944855
Ref: Windows<58>-Footnote-15945134
Ref: Windows<58>-Footnote-25945199
Node: macOS<45>5945264
Ref: whatsnew/changelog id7865945366
Ref: 1e5e5945366
Ref: macOS<45>-Footnote-15945798
Node: IDLE<41>5945863
Ref: whatsnew/changelog id7875945969
Ref: 1e5f5945969
Ref: IDLE<41>-Footnote-15946683
Ref: IDLE<41>-Footnote-25946748
Node: Tools/Demos<39>5946813
Ref: whatsnew/changelog id7885946919
Ref: 1e605946919
Ref: Tools/Demos<39>-Footnote-15947149
Node: C API<58>5947214
Ref: whatsnew/changelog id7895947303
Ref: 1e615947303
Ref: C API<58>-Footnote-15947687
Ref: C API<58>-Footnote-25947752
Node: Python 3 7 0 beta 25947817
Ref: whatsnew/changelog python-3-7-0-beta-25947941
Ref: 1e625947941
Node: セキュリティ<48>5948364
Ref: whatsnew/changelog id7905948473
Ref: 1e635948473
Ref: セキュリティ<48>-Footnote-15948672
Node: Core and Builtins<164>5948737
Ref: whatsnew/changelog id7915948875
Ref: 1e645948875
Ref: Core and Builtins<164>-Footnote-15949706
Ref: Core and Builtins<164>-Footnote-25949771
Ref: Core and Builtins<164>-Footnote-35949836
Ref: Core and Builtins<164>-Footnote-45949901
Ref: Core and Builtins<164>-Footnote-55949966
Ref: Core and Builtins<164>-Footnote-65950031
Ref: Core and Builtins<164>-Footnote-75950096
Node: ライブラリ<168>5950161
Ref: whatsnew/changelog id7925950299
Ref: 1e655950299
Ref: ライブラリ<168>-Footnote-15956705
Ref: ライブラリ<168>-Footnote-25956770
Ref: ライブラリ<168>-Footnote-35956835
Ref: ライブラリ<168>-Footnote-45956900
Ref: ライブラリ<168>-Footnote-55956965
Ref: ライブラリ<168>-Footnote-65957030
Ref: ライブラリ<168>-Footnote-75957095
Ref: ライブラリ<168>-Footnote-85957160
Ref: ライブラリ<168>-Footnote-95957225
Ref: ライブラリ<168>-Footnote-105957290
Ref: ライブラリ<168>-Footnote-115957356
Ref: ライブラリ<168>-Footnote-125957422
Ref: ライブラリ<168>-Footnote-135957488
Ref: ライブラリ<168>-Footnote-145957554
Ref: ライブラリ<168>-Footnote-155957620
Ref: ライブラリ<168>-Footnote-165957686
Ref: ライブラリ<168>-Footnote-175957752
Ref: ライブラリ<168>-Footnote-185957818
Ref: ライブラリ<168>-Footnote-195957884
Ref: ライブラリ<168>-Footnote-205957950
Ref: ライブラリ<168>-Footnote-215958016
Ref: ライブラリ<168>-Footnote-225958082
Ref: ライブラリ<168>-Footnote-235958148
Ref: ライブラリ<168>-Footnote-245958214
Ref: ライブラリ<168>-Footnote-255958280
Ref: ライブラリ<168>-Footnote-265958346
Ref: ライブラリ<168>-Footnote-275958412
Ref: ライブラリ<168>-Footnote-285958478
Ref: ライブラリ<168>-Footnote-295958544
Ref: ライブラリ<168>-Footnote-305958610
Ref: ライブラリ<168>-Footnote-315958676
Ref: ライブラリ<168>-Footnote-325958742
Ref: ライブラリ<168>-Footnote-335958808
Ref: ライブラリ<168>-Footnote-345958874
Node: ドキュメント<61>5958940
Ref: whatsnew/changelog id7935959069
Ref: 1e665959069
Ref: ドキュメント<61>-Footnote-15960024
Ref: ドキュメント<61>-Footnote-25960089
Ref: ドキュメント<61>-Footnote-35960154
Ref: ドキュメント<61>-Footnote-45960219
Ref: ドキュメント<61>-Footnote-55960284
Ref: ドキュメント<61>-Footnote-65960349
Ref: ドキュメント<61>-Footnote-75960413
Ref: ドキュメント<61>-Footnote-85960478
Node: テスト<58>5960543
Ref: whatsnew/changelog id7945960665
Ref: 1e675960665
Ref: テスト<58>-Footnote-15960813
Node: ビルド<66>5960878
Ref: whatsnew/changelog id7955960989
Ref: 1e685960989
Ref: ビルド<66>-Footnote-15961135
Node: Windows<59>5961200
Ref: whatsnew/changelog id7965961307
Ref: 1e695961307
Ref: Windows<59>-Footnote-15962043
Ref: Windows<59>-Footnote-25962108
Ref: Windows<59>-Footnote-35962173
Ref: Windows<59>-Footnote-45962238
Ref: Windows<59>-Footnote-55962303
Ref: Windows<59>-Footnote-65962368
Node: macOS<46>5962433
Ref: whatsnew/changelog id7975962535
Ref: 1e6a5962535
Ref: macOS<46>-Footnote-15962670
Node: IDLE<42>5962735
Ref: whatsnew/changelog id7985962841
Ref: 1e6b5962841
Ref: IDLE<42>-Footnote-15963676
Ref: IDLE<42>-Footnote-25963741
Ref: IDLE<42>-Footnote-35963806
Ref: IDLE<42>-Footnote-45963871
Ref: IDLE<42>-Footnote-55963936
Ref: IDLE<42>-Footnote-65964001
Node: Tools/Demos<40>5964066
Ref: whatsnew/changelog id7995964154
Ref: 1e6c5964154
Ref: Tools/Demos<40>-Footnote-15964373
Node: Python 3 7 0 beta 15964438
Ref: whatsnew/changelog python-3-7-0-beta-15964563
Ref: 1e6d5964563
Node: Core and Builtins<165>5964910
Ref: whatsnew/changelog id8005965017
Ref: 1e6e5965017
Ref: Core and Builtins<165>-Footnote-15968431
Ref: Core and Builtins<165>-Footnote-25968496
Ref: Core and Builtins<165>-Footnote-35968561
Ref: Core and Builtins<165>-Footnote-45968626
Ref: Core and Builtins<165>-Footnote-55968691
Ref: Core and Builtins<165>-Footnote-65968756
Ref: Core and Builtins<165>-Footnote-75968821
Ref: Core and Builtins<165>-Footnote-85968886
Ref: Core and Builtins<165>-Footnote-95968951
Ref: Core and Builtins<165>-Footnote-105968993
Ref: Core and Builtins<165>-Footnote-115969059
Ref: Core and Builtins<165>-Footnote-125969125
Ref: Core and Builtins<165>-Footnote-135969191
Ref: Core and Builtins<165>-Footnote-145969257
Ref: Core and Builtins<165>-Footnote-155969323
Ref: Core and Builtins<165>-Footnote-165969389
Ref: Core and Builtins<165>-Footnote-175969455
Ref: Core and Builtins<165>-Footnote-185969521
Ref: Core and Builtins<165>-Footnote-195969564
Ref: Core and Builtins<165>-Footnote-205969630
Ref: Core and Builtins<165>-Footnote-215969696
Ref: Core and Builtins<165>-Footnote-225969762
Ref: Core and Builtins<165>-Footnote-235969828
Node: ライブラリ<169>5969894
Ref: whatsnew/changelog id8015970032
Ref: 1e6f5970032
Ref: ライブラリ<169>-Footnote-15977410
Ref: ライブラリ<169>-Footnote-25977475
Ref: ライブラリ<169>-Footnote-35977540
Ref: ライブラリ<169>-Footnote-45977605
Ref: ライブラリ<169>-Footnote-55977670
Ref: ライブラリ<169>-Footnote-65977735
Ref: ライブラリ<169>-Footnote-75977800
Ref: ライブラリ<169>-Footnote-85977865
Ref: ライブラリ<169>-Footnote-95977930
Ref: ライブラリ<169>-Footnote-105977995
Ref: ライブラリ<169>-Footnote-115978061
Ref: ライブラリ<169>-Footnote-125978127
Ref: ライブラリ<169>-Footnote-135978193
Ref: ライブラリ<169>-Footnote-145978259
Ref: ライブラリ<169>-Footnote-155978325
Ref: ライブラリ<169>-Footnote-165978391
Ref: ライブラリ<169>-Footnote-175978457
Ref: ライブラリ<169>-Footnote-185978523
Ref: ライブラリ<169>-Footnote-195978566
Ref: ライブラリ<169>-Footnote-205978632
Ref: ライブラリ<169>-Footnote-215978698
Ref: ライブラリ<169>-Footnote-225978764
Ref: ライブラリ<169>-Footnote-235978830
Ref: ライブラリ<169>-Footnote-245978896
Ref: ライブラリ<169>-Footnote-255978962
Ref: ライブラリ<169>-Footnote-265979028
Ref: ライブラリ<169>-Footnote-275979094
Ref: ライブラリ<169>-Footnote-285979160
Ref: ライブラリ<169>-Footnote-295979226
Ref: ライブラリ<169>-Footnote-305979292
Ref: ライブラリ<169>-Footnote-315979358
Ref: ライブラリ<169>-Footnote-325979424
Ref: ライブラリ<169>-Footnote-335979490
Ref: ライブラリ<169>-Footnote-345979556
Ref: ライブラリ<169>-Footnote-355979622
Ref: ライブラリ<169>-Footnote-365979688
Ref: ライブラリ<169>-Footnote-375979754
Ref: ライブラリ<169>-Footnote-385979820
Ref: ライブラリ<169>-Footnote-395979886
Ref: ライブラリ<169>-Footnote-405979952
Ref: ライブラリ<169>-Footnote-415980018
Ref: ライブラリ<169>-Footnote-425980084
Ref: ライブラリ<169>-Footnote-435980150
Ref: ライブラリ<169>-Footnote-445980216
Ref: ライブラリ<169>-Footnote-455980282
Ref: ライブラリ<169>-Footnote-465980348
Ref: ライブラリ<169>-Footnote-475980414
Node: ドキュメント<62>5980480
Ref: whatsnew/changelog id8025980609
Ref: 1e705980609
Ref: ドキュメント<62>-Footnote-15981154
Ref: ドキュメント<62>-Footnote-25981219
Ref: ドキュメント<62>-Footnote-35981284
Node: テスト<59>5981349
Ref: whatsnew/changelog id8035981471
Ref: 1e715981471
Ref: テスト<59>-Footnote-15982384
Ref: テスト<59>-Footnote-25982449
Ref: テスト<59>-Footnote-35982514
Ref: テスト<59>-Footnote-45982579
Ref: テスト<59>-Footnote-55982644
Ref: テスト<59>-Footnote-65982709
Node: ビルド<67>5982774
Ref: whatsnew/changelog id8045982885
Ref: 1e725982885
Ref: ビルド<67>-Footnote-15983493
Ref: ビルド<67>-Footnote-25983558
Ref: ビルド<67>-Footnote-35983623
Ref: ビルド<67>-Footnote-45983688
Node: Windows<60>5983753
Ref: whatsnew/changelog id8055983860
Ref: 1e735983860
Ref: Windows<60>-Footnote-15984241
Ref: Windows<60>-Footnote-25984306
Ref: Windows<60>-Footnote-35984371
Node: macOS<47>5984436
Ref: whatsnew/changelog id8065984539
Ref: 1e745984539
Ref: macOS<47>-Footnote-15985061
Ref: macOS<47>-Footnote-25985126
Node: C API<59>5985191
Ref: whatsnew/changelog id8075985274
Ref: 1e755985274
Ref: C API<59>-Footnote-15985592
Ref: C API<59>-Footnote-25985657
Node: Python 3 7 0 alpha 45985722
Ref: whatsnew/changelog python-3-7-0-alpha-45985848
Ref: 1e765985848
Node: Core and Builtins<166>5986181
Ref: whatsnew/changelog id8085986289
Ref: 1e775986289
Ref: Core and Builtins<166>-Footnote-15989790
Ref: Core and Builtins<166>-Footnote-25989855
Ref: Core and Builtins<166>-Footnote-35989920
Ref: Core and Builtins<166>-Footnote-45989985
Ref: Core and Builtins<166>-Footnote-55990050
Ref: Core and Builtins<166>-Footnote-65990115
Ref: Core and Builtins<166>-Footnote-75990180
Ref: Core and Builtins<166>-Footnote-85990245
Ref: Core and Builtins<166>-Footnote-95990310
Ref: Core and Builtins<166>-Footnote-105990375
Ref: Core and Builtins<166>-Footnote-115990441
Ref: Core and Builtins<166>-Footnote-125990507
Ref: Core and Builtins<166>-Footnote-135990573
Ref: Core and Builtins<166>-Footnote-145990639
Ref: Core and Builtins<166>-Footnote-155990705
Ref: Core and Builtins<166>-Footnote-165990771
Ref: Core and Builtins<166>-Footnote-175990837
Ref: Core and Builtins<166>-Footnote-185990903
Ref: Core and Builtins<166>-Footnote-195990969
Ref: Core and Builtins<166>-Footnote-205991012
Ref: Core and Builtins<166>-Footnote-215991078
Ref: Core and Builtins<166>-Footnote-225991121
Ref: Core and Builtins<166>-Footnote-235991187
Ref: Core and Builtins<166>-Footnote-245991230
Ref: Core and Builtins<166>-Footnote-255991296
Ref: Core and Builtins<166>-Footnote-265991362
Ref: Core and Builtins<166>-Footnote-275991405
Node: ライブラリ<170>5991471
Ref: whatsnew/changelog id8095991610
Ref: 1e795991610
Ref: ライブラリ<170>-Footnote-15999600
Ref: ライブラリ<170>-Footnote-25999665
Ref: ライブラリ<170>-Footnote-35999730
Ref: ライブラリ<170>-Footnote-45999795
Ref: ライブラリ<170>-Footnote-55999860
Ref: ライブラリ<170>-Footnote-65999925
Ref: ライブラリ<170>-Footnote-75999990
Ref: ライブラリ<170>-Footnote-86000055
Ref: ライブラリ<170>-Footnote-96000120
Ref: ライブラリ<170>-Footnote-106000185
Ref: ライブラリ<170>-Footnote-116000251
Ref: ライブラリ<170>-Footnote-126000317
Ref: ライブラリ<170>-Footnote-136000383
Ref: ライブラリ<170>-Footnote-146000449
Ref: ライブラリ<170>-Footnote-156000515
Ref: ライブラリ<170>-Footnote-166000581
Ref: ライブラリ<170>-Footnote-176000647
Ref: ライブラリ<170>-Footnote-186000713
Ref: ライブラリ<170>-Footnote-196000779
Ref: ライブラリ<170>-Footnote-206000845
Ref: ライブラリ<170>-Footnote-216000911
Ref: ライブラリ<170>-Footnote-226000977
Ref: ライブラリ<170>-Footnote-236001043
Ref: ライブラリ<170>-Footnote-246001109
Ref: ライブラリ<170>-Footnote-256001175
Ref: ライブラリ<170>-Footnote-266001241
Ref: ライブラリ<170>-Footnote-276001307
Ref: ライブラリ<170>-Footnote-286001373
Ref: ライブラリ<170>-Footnote-296001439
Ref: ライブラリ<170>-Footnote-306001505
Ref: ライブラリ<170>-Footnote-316001571
Ref: ライブラリ<170>-Footnote-326001637
Ref: ライブラリ<170>-Footnote-336001703
Ref: ライブラリ<170>-Footnote-346001769
Ref: ライブラリ<170>-Footnote-356001835
Ref: ライブラリ<170>-Footnote-366001901
Ref: ライブラリ<170>-Footnote-376001967
Ref: ライブラリ<170>-Footnote-386002033
Ref: ライブラリ<170>-Footnote-396002099
Ref: ライブラリ<170>-Footnote-406002165
Ref: ライブラリ<170>-Footnote-416002231
Ref: ライブラリ<170>-Footnote-426002297
Ref: ライブラリ<170>-Footnote-436002363
Ref: ライブラリ<170>-Footnote-446002429
Ref: ライブラリ<170>-Footnote-456002495
Ref: ライブラリ<170>-Footnote-466002561
Ref: ライブラリ<170>-Footnote-476002627
Ref: ライブラリ<170>-Footnote-486002693
Ref: ライブラリ<170>-Footnote-496002759
Ref: ライブラリ<170>-Footnote-506002825
Ref: ライブラリ<170>-Footnote-516002891
Ref: ライブラリ<170>-Footnote-526002957
Ref: ライブラリ<170>-Footnote-536003023
Ref: ライブラリ<170>-Footnote-546003089
Node: ドキュメント<63>6003155
Ref: whatsnew/changelog id8106003285
Ref: 1e7a6003285
Ref: ドキュメント<63>-Footnote-16003459
Node: テスト<60>6003524
Ref: whatsnew/changelog id8116003645
Ref: 1e7b6003645
Ref: テスト<60>-Footnote-16004045
Ref: テスト<60>-Footnote-26004110
Node: Windows<61>6004175
Ref: whatsnew/changelog id8126004289
Ref: 1e7c6004289
Ref: Windows<61>-Footnote-16004488
Node: Tools/Demos<41>6004553
Ref: whatsnew/changelog id8136004663
Ref: 1e7d6004663
Ref: Tools/Demos<41>-Footnote-16004945
Node: C API<60>6005010
Ref: whatsnew/changelog id8146005100
Ref: 1e7e6005100
Ref: C API<60>-Footnote-16005742
Ref: C API<60>-Footnote-26005807
Ref: C API<60>-Footnote-36005872
Ref: C API<60>-Footnote-46005937
Node: Python 3 7 0 alpha 36006002
Ref: whatsnew/changelog python-3-7-0-alpha-36006129
Ref: 1e7f6006129
Node: Core and Builtins<167>6006528
Ref: whatsnew/changelog id8156006636
Ref: 1e806006636
Ref: Core and Builtins<167>-Footnote-16011757
Ref: Core and Builtins<167>-Footnote-26011822
Ref: Core and Builtins<167>-Footnote-36011887
Ref: Core and Builtins<167>-Footnote-46011952
Ref: Core and Builtins<167>-Footnote-56012017
Ref: Core and Builtins<167>-Footnote-66012082
Ref: Core and Builtins<167>-Footnote-76012147
Ref: Core and Builtins<167>-Footnote-86012212
Ref: Core and Builtins<167>-Footnote-96012277
Ref: Core and Builtins<167>-Footnote-106012342
Ref: Core and Builtins<167>-Footnote-116012408
Ref: Core and Builtins<167>-Footnote-126012474
Ref: Core and Builtins<167>-Footnote-136012540
Ref: Core and Builtins<167>-Footnote-146012606
Ref: Core and Builtins<167>-Footnote-156012672
Ref: Core and Builtins<167>-Footnote-166012738
Ref: Core and Builtins<167>-Footnote-176012804
Ref: Core and Builtins<167>-Footnote-186012870
Ref: Core and Builtins<167>-Footnote-196012936
Ref: Core and Builtins<167>-Footnote-206013002
Ref: Core and Builtins<167>-Footnote-216013068
Ref: Core and Builtins<167>-Footnote-226013134
Node: ライブラリ<171>6013200
Ref: whatsnew/changelog id8166013339
Ref: 1e816013339
Ref: ライブラリ<171>-Footnote-16029360
Ref: ライブラリ<171>-Footnote-26029425
Ref: ライブラリ<171>-Footnote-36029490
Ref: ライブラリ<171>-Footnote-46029555
Ref: ライブラリ<171>-Footnote-56029620
Ref: ライブラリ<171>-Footnote-66029685
Ref: ライブラリ<171>-Footnote-76029750
Ref: ライブラリ<171>-Footnote-86029815
Ref: ライブラリ<171>-Footnote-96029880
Ref: ライブラリ<171>-Footnote-106029945
Ref: ライブラリ<171>-Footnote-116030011
Ref: ライブラリ<171>-Footnote-126030077
Ref: ライブラリ<171>-Footnote-136030143
Ref: ライブラリ<171>-Footnote-146030209
Ref: ライブラリ<171>-Footnote-156030275
Ref: ライブラリ<171>-Footnote-166030341
Ref: ライブラリ<171>-Footnote-176030407
Ref: ライブラリ<171>-Footnote-186030473
Ref: ライブラリ<171>-Footnote-196030539
Ref: ライブラリ<171>-Footnote-206030605
Ref: ライブラリ<171>-Footnote-216030671
Ref: ライブラリ<171>-Footnote-226030737
Ref: ライブラリ<171>-Footnote-236030803
Ref: ライブラリ<171>-Footnote-246030869
Ref: ライブラリ<171>-Footnote-256030935
Ref: ライブラリ<171>-Footnote-266031003
Ref: ライブラリ<171>-Footnote-276031069
Ref: ライブラリ<171>-Footnote-286031135
Ref: ライブラリ<171>-Footnote-296031201
Ref: ライブラリ<171>-Footnote-306031267
Ref: ライブラリ<171>-Footnote-316031333
Ref: ライブラリ<171>-Footnote-326031399
Ref: ライブラリ<171>-Footnote-336031442
Ref: ライブラリ<171>-Footnote-346031508
Ref: ライブラリ<171>-Footnote-356031574
Ref: ライブラリ<171>-Footnote-366031640
Ref: ライブラリ<171>-Footnote-376031706
Ref: ライブラリ<171>-Footnote-386031772
Ref: ライブラリ<171>-Footnote-396031838
Ref: ライブラリ<171>-Footnote-406031904
Ref: ライブラリ<171>-Footnote-416031970
Ref: ライブラリ<171>-Footnote-426032036
Ref: ライブラリ<171>-Footnote-436032102
Ref: ライブラリ<171>-Footnote-446032168
Ref: ライブラリ<171>-Footnote-456032234
Ref: ライブラリ<171>-Footnote-466032300
Ref: ライブラリ<171>-Footnote-476032365
Ref: ライブラリ<171>-Footnote-486032431
Ref: ライブラリ<171>-Footnote-496032497
Ref: ライブラリ<171>-Footnote-506032563
Ref: ライブラリ<171>-Footnote-516032629
Ref: ライブラリ<171>-Footnote-526032695
Ref: ライブラリ<171>-Footnote-536032761
Ref: ライブラリ<171>-Footnote-546032827
Ref: ライブラリ<171>-Footnote-556032893
Ref: ライブラリ<171>-Footnote-566032959
Ref: ライブラリ<171>-Footnote-576033025
Ref: ライブラリ<171>-Footnote-586033091
Ref: ライブラリ<171>-Footnote-596033157
Ref: ライブラリ<171>-Footnote-606033223
Ref: ライブラリ<171>-Footnote-616033289
Ref: ライブラリ<171>-Footnote-626033355
Ref: ライブラリ<171>-Footnote-636033398
Ref: ライブラリ<171>-Footnote-646033464
Ref: ライブラリ<171>-Footnote-656033530
Ref: ライブラリ<171>-Footnote-666033596
Ref: ライブラリ<171>-Footnote-676033662
Ref: ライブラリ<171>-Footnote-686033728
Ref: ライブラリ<171>-Footnote-696033794
Ref: ライブラリ<171>-Footnote-706033860
Ref: ライブラリ<171>-Footnote-716033926
Ref: ライブラリ<171>-Footnote-726033992
Ref: ライブラリ<171>-Footnote-736034058
Ref: ライブラリ<171>-Footnote-746034124
Ref: ライブラリ<171>-Footnote-756034190
Ref: ライブラリ<171>-Footnote-766034256
Ref: ライブラリ<171>-Footnote-776034322
Ref: ライブラリ<171>-Footnote-786034388
Ref: ライブラリ<171>-Footnote-796034454
Ref: ライブラリ<171>-Footnote-806034520
Ref: ライブラリ<171>-Footnote-816034586
Ref: ライブラリ<171>-Footnote-826034652
Ref: ライブラリ<171>-Footnote-836034695
Ref: ライブラリ<171>-Footnote-846034761
Ref: ライブラリ<171>-Footnote-856034827
Ref: ライブラリ<171>-Footnote-866034893
Ref: ライブラリ<171>-Footnote-876034959
Ref: ライブラリ<171>-Footnote-886035025
Ref: ライブラリ<171>-Footnote-896035091
Ref: ライブラリ<171>-Footnote-906035157
Ref: ライブラリ<171>-Footnote-916035223
Ref: ライブラリ<171>-Footnote-926035289
Ref: ライブラリ<171>-Footnote-936035355
Ref: ライブラリ<171>-Footnote-946035421
Ref: ライブラリ<171>-Footnote-956035487
Ref: ライブラリ<171>-Footnote-966035553
Ref: ライブラリ<171>-Footnote-976035619
Ref: ライブラリ<171>-Footnote-986035685
Node: ドキュメント<64>6035751
Ref: whatsnew/changelog id8176035881
Ref: 1e866035881
Ref: ドキュメント<64>-Footnote-16036068
Node: テスト<61>6036133
Ref: whatsnew/changelog id8186036256
Ref: 1e876036256
Ref: テスト<61>-Footnote-16037467
Ref: テスト<61>-Footnote-26037532
Ref: テスト<61>-Footnote-36037597
Ref: テスト<61>-Footnote-46037662
Ref: テスト<61>-Footnote-56037727
Ref: テスト<61>-Footnote-66037792
Ref: テスト<61>-Footnote-76037857
Node: ビルド<68>6037922
Ref: whatsnew/changelog id8196038034
Ref: 1e886038034
Ref: ビルド<68>-Footnote-16039253
Ref: ビルド<68>-Footnote-26039318
Ref: ビルド<68>-Footnote-36039383
Ref: ビルド<68>-Footnote-46039448
Ref: ビルド<68>-Footnote-56039513
Ref: ビルド<68>-Footnote-66039578
Ref: ビルド<68>-Footnote-76039643
Ref: ビルド<68>-Footnote-86039708
Ref: ビルド<68>-Footnote-96039773
Ref: ビルド<68>-Footnote-106039838
Ref: ビルド<68>-Footnote-116039904
Ref: ビルド<68>-Footnote-126039970
Node: Windows<62>6040036
Ref: whatsnew/changelog id8206040144
Ref: 1e896040144
Ref: Windows<62>-Footnote-16040677
Ref: Windows<62>-Footnote-26040741
Ref: Windows<62>-Footnote-36040806
Ref: Windows<62>-Footnote-46040871
Node: macOS<48>6040936
Ref: whatsnew/changelog id8216041039
Ref: 1e8a6041039
Ref: macOS<48>-Footnote-16041173
Node: IDLE<43>6041238
Ref: whatsnew/changelog id8226041345
Ref: 1e8b6041345
Ref: IDLE<43>-Footnote-16043426
Ref: IDLE<43>-Footnote-26043491
Ref: IDLE<43>-Footnote-36043556
Ref: IDLE<43>-Footnote-46043621
Ref: IDLE<43>-Footnote-56043686
Ref: IDLE<43>-Footnote-66043751
Ref: IDLE<43>-Footnote-76043816
Ref: IDLE<43>-Footnote-86043881
Node: Tools/Demos<42>6043946
Ref: whatsnew/changelog id8236044053
Ref: 1e8c6044053
Ref: Tools/Demos<42>-Footnote-16044583
Ref: Tools/Demos<42>-Footnote-26044648
Node: C API<61>6044713
Ref: whatsnew/changelog id8246044803
Ref: 1e8d6044803
Ref: C API<61>-Footnote-16045929
Ref: C API<61>-Footnote-26045994
Ref: C API<61>-Footnote-36046059
Ref: C API<61>-Footnote-46046124
Ref: C API<61>-Footnote-56046189
Ref: C API<61>-Footnote-66046254
Node: Python 3 7 0 alpha 26046319
Ref: whatsnew/changelog python-3-7-0-alpha-26046446
Ref: 1e8e6046446
Node: Core and Builtins<168>6046741
Ref: whatsnew/changelog id8256046849
Ref: 1e8f6046849
Ref: Core and Builtins<168>-Footnote-16051030
Ref: Core and Builtins<168>-Footnote-26051095
Ref: Core and Builtins<168>-Footnote-36051160
Ref: Core and Builtins<168>-Footnote-46051225
Ref: Core and Builtins<168>-Footnote-56051290
Ref: Core and Builtins<168>-Footnote-66051355
Ref: Core and Builtins<168>-Footnote-76051420
Ref: Core and Builtins<168>-Footnote-86051485
Ref: Core and Builtins<168>-Footnote-96051550
Ref: Core and Builtins<168>-Footnote-106051615
Ref: Core and Builtins<168>-Footnote-116051681
Ref: Core and Builtins<168>-Footnote-126051747
Ref: Core and Builtins<168>-Footnote-136051813
Ref: Core and Builtins<168>-Footnote-146051879
Ref: Core and Builtins<168>-Footnote-156051945
Ref: Core and Builtins<168>-Footnote-166052011
Ref: Core and Builtins<168>-Footnote-176052077
Ref: Core and Builtins<168>-Footnote-186052143
Ref: Core and Builtins<168>-Footnote-196052209
Ref: Core and Builtins<168>-Footnote-206052275
Ref: Core and Builtins<168>-Footnote-216052318
Ref: Core and Builtins<168>-Footnote-226052384
Ref: Core and Builtins<168>-Footnote-236052450
Ref: Core and Builtins<168>-Footnote-246052516
Ref: Core and Builtins<168>-Footnote-256052582
Ref: Core and Builtins<168>-Footnote-266052648
Ref: Core and Builtins<168>-Footnote-276052714
Node: ライブラリ<172>6052757
Ref: whatsnew/changelog id8266052896
Ref: 1e906052896
Ref: ライブラリ<172>-Footnote-16056946
Ref: ライブラリ<172>-Footnote-26057011
Ref: ライブラリ<172>-Footnote-36057076
Ref: ライブラリ<172>-Footnote-46057141
Ref: ライブラリ<172>-Footnote-56057206
Ref: ライブラリ<172>-Footnote-66057271
Ref: ライブラリ<172>-Footnote-76057336
Ref: ライブラリ<172>-Footnote-86057401
Ref: ライブラリ<172>-Footnote-96057466
Ref: ライブラリ<172>-Footnote-106057531
Ref: ライブラリ<172>-Footnote-116057597
Ref: ライブラリ<172>-Footnote-126057663
Ref: ライブラリ<172>-Footnote-136057729
Ref: ライブラリ<172>-Footnote-146057795
Ref: ライブラリ<172>-Footnote-156057861
Ref: ライブラリ<172>-Footnote-166057927
Ref: ライブラリ<172>-Footnote-176057993
Ref: ライブラリ<172>-Footnote-186058059
Ref: ライブラリ<172>-Footnote-196058125
Ref: ライブラリ<172>-Footnote-206058191
Ref: ライブラリ<172>-Footnote-216058257
Ref: ライブラリ<172>-Footnote-226058323
Ref: ライブラリ<172>-Footnote-236058389
Ref: ライブラリ<172>-Footnote-246058455
Ref: ライブラリ<172>-Footnote-256058521
Ref: ライブラリ<172>-Footnote-266058587
Node: ドキュメント<65>6058653
Ref: whatsnew/changelog id8276058783
Ref: 1e916058783
Ref: ドキュメント<65>-Footnote-16059178
Ref: ドキュメント<65>-Footnote-26059243
Node: ビルド<69>6059308
Ref: whatsnew/changelog id8286059426
Ref: 1e926059426
Ref: ビルド<69>-Footnote-16060054
Ref: ビルド<69>-Footnote-26060119
Ref: ビルド<69>-Footnote-36060184
Ref: ビルド<69>-Footnote-46060249
Ref: ビルド<69>-Footnote-56060314
Ref: ビルド<69>-Footnote-66060379
Node: IDLE<44>6060444
Ref: whatsnew/changelog id8296060549
Ref: 1e936060549
Ref: IDLE<44>-Footnote-16061851
Ref: IDLE<44>-Footnote-26061916
Ref: IDLE<44>-Footnote-36061981
Ref: IDLE<44>-Footnote-46062046
Ref: IDLE<44>-Footnote-56062111
Ref: IDLE<44>-Footnote-66062176
Node: C API<62>6062243
Ref: whatsnew/changelog id8306062326
Ref: 1e946062326
Ref: C API<62>-Footnote-16063050
Ref: C API<62>-Footnote-26063115
Ref: C API<62>-Footnote-36063180
Ref: C API<62>-Footnote-46063245
Node: Python 3 7 0 alpha 16063287
Ref: whatsnew/changelog python-3-7-0-alpha-16063412
Ref: 1e956063412
Node: セキュリティ<49>6063837
Ref: whatsnew/changelog id8316063947
Ref: 1e966063947
Ref: セキュリティ<49>-Footnote-16065611
Ref: セキュリティ<49>-Footnote-26065676
Ref: セキュリティ<49>-Footnote-36065741
Ref: セキュリティ<49>-Footnote-46065806
Ref: セキュリティ<49>-Footnote-56065871
Ref: セキュリティ<49>-Footnote-66065936
Ref: セキュリティ<49>-Footnote-76065991
Ref: セキュリティ<49>-Footnote-86066046
Ref: セキュリティ<49>-Footnote-96066101
Ref: セキュリティ<49>-Footnote-106066156
Ref: セキュリティ<49>-Footnote-116066212
Ref: セキュリティ<49>-Footnote-126066268
Ref: セキュリティ<49>-Footnote-136066334
Ref: セキュリティ<49>-Footnote-146066400
Ref: セキュリティ<49>-Footnote-156066456
Node: Core and Builtins<169>6066512
Ref: whatsnew/changelog id8326066651
Ref: 1e976066651
Ref: Core and Builtins<169>-Footnote-16087465
Ref: Core and Builtins<169>-Footnote-26087530
Ref: Core and Builtins<169>-Footnote-36087595
Ref: Core and Builtins<169>-Footnote-46087660
Ref: Core and Builtins<169>-Footnote-56087725
Ref: Core and Builtins<169>-Footnote-66087790
Ref: Core and Builtins<169>-Footnote-76087855
Ref: Core and Builtins<169>-Footnote-86087920
Ref: Core and Builtins<169>-Footnote-96087985
Ref: Core and Builtins<169>-Footnote-106088050
Ref: Core and Builtins<169>-Footnote-116088116
Ref: Core and Builtins<169>-Footnote-126088182
Ref: Core and Builtins<169>-Footnote-136088248
Ref: Core and Builtins<169>-Footnote-146088314
Ref: Core and Builtins<169>-Footnote-156088380
Ref: Core and Builtins<169>-Footnote-166088446
Ref: Core and Builtins<169>-Footnote-176088512
Ref: Core and Builtins<169>-Footnote-186088578
Ref: Core and Builtins<169>-Footnote-196088644
Ref: Core and Builtins<169>-Footnote-206088710
Ref: Core and Builtins<169>-Footnote-216088776
Ref: Core and Builtins<169>-Footnote-226088842
Ref: Core and Builtins<169>-Footnote-236088908
Ref: Core and Builtins<169>-Footnote-246088974
Ref: Core and Builtins<169>-Footnote-256089040
Ref: Core and Builtins<169>-Footnote-266089106
Ref: Core and Builtins<169>-Footnote-276089172
Ref: Core and Builtins<169>-Footnote-286089238
Ref: Core and Builtins<169>-Footnote-296089304
Ref: Core and Builtins<169>-Footnote-306089370
Ref: Core and Builtins<169>-Footnote-316089436
Ref: Core and Builtins<169>-Footnote-326089502
Ref: Core and Builtins<169>-Footnote-336089568
Ref: Core and Builtins<169>-Footnote-346089634
Ref: Core and Builtins<169>-Footnote-356089700
Ref: Core and Builtins<169>-Footnote-366089743
Ref: Core and Builtins<169>-Footnote-376089809
Ref: Core and Builtins<169>-Footnote-386089875
Ref: Core and Builtins<169>-Footnote-396089941
Ref: Core and Builtins<169>-Footnote-406090007
Ref: Core and Builtins<169>-Footnote-416090073
Ref: Core and Builtins<169>-Footnote-426090139
Ref: Core and Builtins<169>-Footnote-436090205
Ref: Core and Builtins<169>-Footnote-446090271
Ref: Core and Builtins<169>-Footnote-456090337
Ref: Core and Builtins<169>-Footnote-466090403
Ref: Core and Builtins<169>-Footnote-476090469
Ref: Core and Builtins<169>-Footnote-486090535
Ref: Core and Builtins<169>-Footnote-496090601
Ref: Core and Builtins<169>-Footnote-506090667
Ref: Core and Builtins<169>-Footnote-516090733
Ref: Core and Builtins<169>-Footnote-526090799
Ref: Core and Builtins<169>-Footnote-536090865
Ref: Core and Builtins<169>-Footnote-546090931
Ref: Core and Builtins<169>-Footnote-556090997
Ref: Core and Builtins<169>-Footnote-566091063
Ref: Core and Builtins<169>-Footnote-576091129
Ref: Core and Builtins<169>-Footnote-586091195
Ref: Core and Builtins<169>-Footnote-596091261
Ref: Core and Builtins<169>-Footnote-606091327
Ref: Core and Builtins<169>-Footnote-616091393
Ref: Core and Builtins<169>-Footnote-626091459
Ref: Core and Builtins<169>-Footnote-636091525
Ref: Core and Builtins<169>-Footnote-646091591
Ref: Core and Builtins<169>-Footnote-656091657
Ref: Core and Builtins<169>-Footnote-666091723
Ref: Core and Builtins<169>-Footnote-676091789
Ref: Core and Builtins<169>-Footnote-686091855
Ref: Core and Builtins<169>-Footnote-696091921
Ref: Core and Builtins<169>-Footnote-706091987
Ref: Core and Builtins<169>-Footnote-716092053
Ref: Core and Builtins<169>-Footnote-726092119
Ref: Core and Builtins<169>-Footnote-736092185
Ref: Core and Builtins<169>-Footnote-746092251
Ref: Core and Builtins<169>-Footnote-756092317
Ref: Core and Builtins<169>-Footnote-766092383
Ref: Core and Builtins<169>-Footnote-776092449
Ref: Core and Builtins<169>-Footnote-786092515
Ref: Core and Builtins<169>-Footnote-796092581
Ref: Core and Builtins<169>-Footnote-806092647
Ref: Core and Builtins<169>-Footnote-816092713
Ref: Core and Builtins<169>-Footnote-826092779
Ref: Core and Builtins<169>-Footnote-836092845
Ref: Core and Builtins<169>-Footnote-846092911
Ref: Core and Builtins<169>-Footnote-856092977
Ref: Core and Builtins<169>-Footnote-866093043
Ref: Core and Builtins<169>-Footnote-876093109
Ref: Core and Builtins<169>-Footnote-886093175
Ref: Core and Builtins<169>-Footnote-896093241
Ref: Core and Builtins<169>-Footnote-906093307
Ref: Core and Builtins<169>-Footnote-916093350
Ref: Core and Builtins<169>-Footnote-926093416
Ref: Core and Builtins<169>-Footnote-936093482
Ref: Core and Builtins<169>-Footnote-946093548
Ref: Core and Builtins<169>-Footnote-956093614
Ref: Core and Builtins<169>-Footnote-966093680
Ref: Core and Builtins<169>-Footnote-976093746
Ref: Core and Builtins<169>-Footnote-986093812
Ref: Core and Builtins<169>-Footnote-996093878
Ref: Core and Builtins<169>-Footnote-1006093944
Ref: Core and Builtins<169>-Footnote-1016094011
Ref: Core and Builtins<169>-Footnote-1026094078
Ref: Core and Builtins<169>-Footnote-1036094145
Ref: Core and Builtins<169>-Footnote-1046094212
Ref: Core and Builtins<169>-Footnote-1056094279
Ref: Core and Builtins<169>-Footnote-1066094346
Ref: Core and Builtins<169>-Footnote-1076094413
Ref: Core and Builtins<169>-Footnote-1086094480
Ref: Core and Builtins<169>-Footnote-1096094547
Ref: Core and Builtins<169>-Footnote-1106094614
Ref: Core and Builtins<169>-Footnote-1116094681
Ref: Core and Builtins<169>-Footnote-1126094748
Ref: Core and Builtins<169>-Footnote-1136094815
Ref: Core and Builtins<169>-Footnote-1146094882
Ref: Core and Builtins<169>-Footnote-1156094949
Ref: Core and Builtins<169>-Footnote-1166095016
Ref: Core and Builtins<169>-Footnote-1176095083
Ref: Core and Builtins<169>-Footnote-1186095150
Ref: Core and Builtins<169>-Footnote-1196095217
Ref: Core and Builtins<169>-Footnote-1206095284
Ref: Core and Builtins<169>-Footnote-1216095351
Ref: Core and Builtins<169>-Footnote-1226095418
Ref: Core and Builtins<169>-Footnote-1236095485
Ref: Core and Builtins<169>-Footnote-1246095552
Ref: Core and Builtins<169>-Footnote-1256095619
Ref: Core and Builtins<169>-Footnote-1266095686
Ref: Core and Builtins<169>-Footnote-1276095753
Ref: Core and Builtins<169>-Footnote-1286095820
Ref: Core and Builtins<169>-Footnote-1296095887
Ref: Core and Builtins<169>-Footnote-1306095954
Ref: Core and Builtins<169>-Footnote-1316096021
Ref: Core and Builtins<169>-Footnote-1326096088
Ref: Core and Builtins<169>-Footnote-1336096155
Ref: Core and Builtins<169>-Footnote-1346096222
Ref: Core and Builtins<169>-Footnote-1356096289
Ref: Core and Builtins<169>-Footnote-1366096356
Ref: Core and Builtins<169>-Footnote-1376096423
Ref: Core and Builtins<169>-Footnote-1386096490
Ref: Core and Builtins<169>-Footnote-1396096557
Ref: Core and Builtins<169>-Footnote-1406096624
Ref: Core and Builtins<169>-Footnote-1416096691
Ref: Core and Builtins<169>-Footnote-1426096758
Ref: Core and Builtins<169>-Footnote-1436096825
Ref: Core and Builtins<169>-Footnote-1446096892
Ref: Core and Builtins<169>-Footnote-1456096959
Ref: Core and Builtins<169>-Footnote-1466097026
Ref: Core and Builtins<169>-Footnote-1476097093
Ref: Core and Builtins<169>-Footnote-1486097160
Node: ライブラリ<173>6097227
Ref: whatsnew/changelog id8336097366
Ref: 1e986097366
Ref: ライブラリ<173>-Footnote-16143875
Ref: ライブラリ<173>-Footnote-26143940
Ref: ライブラリ<173>-Footnote-36144005
Ref: ライブラリ<173>-Footnote-46144070
Ref: ライブラリ<173>-Footnote-56144135
Ref: ライブラリ<173>-Footnote-66144200
Ref: ライブラリ<173>-Footnote-76144265
Ref: ライブラリ<173>-Footnote-86144330
Ref: ライブラリ<173>-Footnote-96144395
Ref: ライブラリ<173>-Footnote-106144460
Ref: ライブラリ<173>-Footnote-116144526
Ref: ライブラリ<173>-Footnote-126144592
Ref: ライブラリ<173>-Footnote-136144658
Ref: ライブラリ<173>-Footnote-146144724
Ref: ライブラリ<173>-Footnote-156144790
Ref: ライブラリ<173>-Footnote-166144856
Ref: ライブラリ<173>-Footnote-176144922
Ref: ライブラリ<173>-Footnote-186144988
Ref: ライブラリ<173>-Footnote-196145054
Ref: ライブラリ<173>-Footnote-206145120
Ref: ライブラリ<173>-Footnote-216145186
Ref: ライブラリ<173>-Footnote-226145254
Ref: ライブラリ<173>-Footnote-236145320
Ref: ライブラリ<173>-Footnote-246145386
Ref: ライブラリ<173>-Footnote-256145452
Ref: ライブラリ<173>-Footnote-266145518
Ref: ライブラリ<173>-Footnote-276145561
Ref: ライブラリ<173>-Footnote-286145627
Ref: ライブラリ<173>-Footnote-296145693
Ref: ライブラリ<173>-Footnote-306145759
Ref: ライブラリ<173>-Footnote-316145825
Ref: ライブラリ<173>-Footnote-326145891
Ref: ライブラリ<173>-Footnote-336145957
Ref: ライブラリ<173>-Footnote-346146023
Ref: ライブラリ<173>-Footnote-356146088
Ref: ライブラリ<173>-Footnote-366146154
Ref: ライブラリ<173>-Footnote-376146220
Ref: ライブラリ<173>-Footnote-386146286
Ref: ライブラリ<173>-Footnote-396146352
Ref: ライブラリ<173>-Footnote-406146417
Ref: ライブラリ<173>-Footnote-416146483
Ref: ライブラリ<173>-Footnote-426146549
Ref: ライブラリ<173>-Footnote-436146615
Ref: ライブラリ<173>-Footnote-446146681
Ref: ライブラリ<173>-Footnote-456146747
Ref: ライブラリ<173>-Footnote-466146813
Ref: ライブラリ<173>-Footnote-476146879
Ref: ライブラリ<173>-Footnote-486146945
Ref: ライブラリ<173>-Footnote-496147011
Ref: ライブラリ<173>-Footnote-506147077
Ref: ライブラリ<173>-Footnote-516147143
Ref: ライブラリ<173>-Footnote-526147209
Ref: ライブラリ<173>-Footnote-536147274
Ref: ライブラリ<173>-Footnote-546147340
Ref: ライブラリ<173>-Footnote-556147406
Ref: ライブラリ<173>-Footnote-566147472
Ref: ライブラリ<173>-Footnote-576147538
Ref: ライブラリ<173>-Footnote-586147604
Ref: ライブラリ<173>-Footnote-596147670
Ref: ライブラリ<173>-Footnote-606147736
Ref: ライブラリ<173>-Footnote-616147802
Ref: ライブラリ<173>-Footnote-626147868
Ref: ライブラリ<173>-Footnote-636147934
Ref: ライブラリ<173>-Footnote-646148000
Ref: ライブラリ<173>-Footnote-656148066
Ref: ライブラリ<173>-Footnote-666148132
Ref: ライブラリ<173>-Footnote-676148198
Ref: ライブラリ<173>-Footnote-686148264
Ref: ライブラリ<173>-Footnote-696148330
Ref: ライブラリ<173>-Footnote-706148396
Ref: ライブラリ<173>-Footnote-716148462
Ref: ライブラリ<173>-Footnote-726148528
Ref: ライブラリ<173>-Footnote-736148593
Ref: ライブラリ<173>-Footnote-746148659
Ref: ライブラリ<173>-Footnote-756148725
Ref: ライブラリ<173>-Footnote-766148791
Ref: ライブラリ<173>-Footnote-776148857
Ref: ライブラリ<173>-Footnote-786148923
Ref: ライブラリ<173>-Footnote-796148989
Ref: ライブラリ<173>-Footnote-806149055
Ref: ライブラリ<173>-Footnote-816149121
Ref: ライブラリ<173>-Footnote-826149187
Ref: ライブラリ<173>-Footnote-836149253
Ref: ライブラリ<173>-Footnote-846149319
Ref: ライブラリ<173>-Footnote-856149385
Ref: ライブラリ<173>-Footnote-866149451
Ref: ライブラリ<173>-Footnote-876149517
Ref: ライブラリ<173>-Footnote-886149583
Ref: ライブラリ<173>-Footnote-896149649
Ref: ライブラリ<173>-Footnote-906149715
Ref: ライブラリ<173>-Footnote-916149781
Ref: ライブラリ<173>-Footnote-926149847
Ref: ライブラリ<173>-Footnote-936149913
Ref: ライブラリ<173>-Footnote-946149979
Ref: ライブラリ<173>-Footnote-956150045
Ref: ライブラリ<173>-Footnote-966150111
Ref: ライブラリ<173>-Footnote-976150177
Ref: ライブラリ<173>-Footnote-986150243
Ref: ライブラリ<173>-Footnote-996150309
Ref: ライブラリ<173>-Footnote-1006150375
Ref: ライブラリ<173>-Footnote-1016150442
Ref: ライブラリ<173>-Footnote-1026150509
Ref: ライブラリ<173>-Footnote-1036150576
Ref: ライブラリ<173>-Footnote-1046150643
Ref: ライブラリ<173>-Footnote-1056150710
Ref: ライブラリ<173>-Footnote-1066150777
Ref: ライブラリ<173>-Footnote-1076150844
Ref: ライブラリ<173>-Footnote-1086150911
Ref: ライブラリ<173>-Footnote-1096150978
Ref: ライブラリ<173>-Footnote-1106151045
Ref: ライブラリ<173>-Footnote-1116151112
Ref: ライブラリ<173>-Footnote-1126151179
Ref: ライブラリ<173>-Footnote-1136151246
Ref: ライブラリ<173>-Footnote-1146151313
Ref: ライブラリ<173>-Footnote-1156151380
Ref: ライブラリ<173>-Footnote-1166151447
Ref: ライブラリ<173>-Footnote-1176151513
Ref: ライブラリ<173>-Footnote-1186151580
Ref: ライブラリ<173>-Footnote-1196151647
Ref: ライブラリ<173>-Footnote-1206151714
Ref: ライブラリ<173>-Footnote-1216151781
Ref: ライブラリ<173>-Footnote-1226151848
Ref: ライブラリ<173>-Footnote-1236151915
Ref: ライブラリ<173>-Footnote-1246151982
Ref: ライブラリ<173>-Footnote-1256152049
Ref: ライブラリ<173>-Footnote-1266152116
Ref: ライブラリ<173>-Footnote-1276152183
Ref: ライブラリ<173>-Footnote-1286152250
Ref: ライブラリ<173>-Footnote-1296152317
Ref: ライブラリ<173>-Footnote-1306152384
Ref: ライブラリ<173>-Footnote-1316152451
Ref: ライブラリ<173>-Footnote-1326152518
Ref: ライブラリ<173>-Footnote-1336152585
Ref: ライブラリ<173>-Footnote-1346152652
Ref: ライブラリ<173>-Footnote-1356152719
Ref: ライブラリ<173>-Footnote-1366152786
Ref: ライブラリ<173>-Footnote-1376152853
Ref: ライブラリ<173>-Footnote-1386152920
Ref: ライブラリ<173>-Footnote-1396152987
Ref: ライブラリ<173>-Footnote-1406153054
Ref: ライブラリ<173>-Footnote-1416153121
Ref: ライブラリ<173>-Footnote-1426153188
Ref: ライブラリ<173>-Footnote-1436153255
Ref: ライブラリ<173>-Footnote-1446153322
Ref: ライブラリ<173>-Footnote-1456153389
Ref: ライブラリ<173>-Footnote-1466153456
Ref: ライブラリ<173>-Footnote-1476153522
Ref: ライブラリ<173>-Footnote-1486153589
Ref: ライブラリ<173>-Footnote-1496153656
Ref: ライブラリ<173>-Footnote-1506153723
Ref: ライブラリ<173>-Footnote-1516153790
Ref: ライブラリ<173>-Footnote-1526153857
Ref: ライブラリ<173>-Footnote-1536153924
Ref: ライブラリ<173>-Footnote-1546153991
Ref: ライブラリ<173>-Footnote-1556154058
Ref: ライブラリ<173>-Footnote-1566154125
Ref: ライブラリ<173>-Footnote-1576154192
Ref: ライブラリ<173>-Footnote-1586154259
Ref: ライブラリ<173>-Footnote-1596154326
Ref: ライブラリ<173>-Footnote-1606154393
Ref: ライブラリ<173>-Footnote-1616154460
Ref: ライブラリ<173>-Footnote-1626154527
Ref: ライブラリ<173>-Footnote-1636154594
Ref: ライブラリ<173>-Footnote-1646154661
Ref: ライブラリ<173>-Footnote-1656154728
Ref: ライブラリ<173>-Footnote-1666154795
Ref: ライブラリ<173>-Footnote-1676154862
Ref: ライブラリ<173>-Footnote-1686154929
Ref: ライブラリ<173>-Footnote-1696154996
Ref: ライブラリ<173>-Footnote-1706155062
Ref: ライブラリ<173>-Footnote-1716155129
Ref: ライブラリ<173>-Footnote-1726155196
Ref: ライブラリ<173>-Footnote-1736155263
Ref: ライブラリ<173>-Footnote-1746155330
Ref: ライブラリ<173>-Footnote-1756155397
Ref: ライブラリ<173>-Footnote-1766155464
Ref: ライブラリ<173>-Footnote-1776155531
Ref: ライブラリ<173>-Footnote-1786155598
Ref: ライブラリ<173>-Footnote-1796155665
Ref: ライブラリ<173>-Footnote-1806155732
Ref: ライブラリ<173>-Footnote-1816155798
Ref: ライブラリ<173>-Footnote-1826155865
Ref: ライブラリ<173>-Footnote-1836155932
Ref: ライブラリ<173>-Footnote-1846155999
Ref: ライブラリ<173>-Footnote-1856156066
Ref: ライブラリ<173>-Footnote-1866156133
Ref: ライブラリ<173>-Footnote-1876156199
Ref: ライブラリ<173>-Footnote-1886156266
Ref: ライブラリ<173>-Footnote-1896156333
Ref: ライブラリ<173>-Footnote-1906156400
Ref: ライブラリ<173>-Footnote-1916156467
Ref: ライブラリ<173>-Footnote-1926156534
Ref: ライブラリ<173>-Footnote-1936156601
Ref: ライブラリ<173>-Footnote-1946156668
Ref: ライブラリ<173>-Footnote-1956156735
Ref: ライブラリ<173>-Footnote-1966156802
Ref: ライブラリ<173>-Footnote-1976156869
Ref: ライブラリ<173>-Footnote-1986156936
Ref: ライブラリ<173>-Footnote-1996157003
Ref: ライブラリ<173>-Footnote-2006157070
Ref: ライブラリ<173>-Footnote-2016157137
Ref: ライブラリ<173>-Footnote-2026157204
Ref: ライブラリ<173>-Footnote-2036157271
Ref: ライブラリ<173>-Footnote-2046157338
Ref: ライブラリ<173>-Footnote-2056157405
Ref: ライブラリ<173>-Footnote-2066157472
Ref: ライブラリ<173>-Footnote-2076157539
Ref: ライブラリ<173>-Footnote-2086157606
Ref: ライブラリ<173>-Footnote-2096157673
Ref: ライブラリ<173>-Footnote-2106157740
Ref: ライブラリ<173>-Footnote-2116157807
Ref: ライブラリ<173>-Footnote-2126157874
Ref: ライブラリ<173>-Footnote-2136157941
Ref: ライブラリ<173>-Footnote-2146158008
Ref: ライブラリ<173>-Footnote-2156158075
Ref: ライブラリ<173>-Footnote-2166158142
Ref: ライブラリ<173>-Footnote-2176158209
Ref: ライブラリ<173>-Footnote-2186158276
Ref: ライブラリ<173>-Footnote-2196158343
Ref: ライブラリ<173>-Footnote-2206158410
Ref: ライブラリ<173>-Footnote-2216158477
Ref: ライブラリ<173>-Footnote-2226158544
Ref: ライブラリ<173>-Footnote-2236158611
Ref: ライブラリ<173>-Footnote-2246158678
Ref: ライブラリ<173>-Footnote-2256158744
Ref: ライブラリ<173>-Footnote-2266158811
Ref: ライブラリ<173>-Footnote-2276158878
Ref: ライブラリ<173>-Footnote-2286158945
Ref: ライブラリ<173>-Footnote-2296159012
Ref: ライブラリ<173>-Footnote-2306159079
Ref: ライブラリ<173>-Footnote-2316159146
Ref: ライブラリ<173>-Footnote-2326159213
Ref: ライブラリ<173>-Footnote-2336159280
Ref: ライブラリ<173>-Footnote-2346159347
Ref: ライブラリ<173>-Footnote-2356159414
Ref: ライブラリ<173>-Footnote-2366159481
Ref: ライブラリ<173>-Footnote-2376159548
Ref: ライブラリ<173>-Footnote-2386159615
Ref: ライブラリ<173>-Footnote-2396159682
Ref: ライブラリ<173>-Footnote-2406159749
Ref: ライブラリ<173>-Footnote-2416159816
Ref: ライブラリ<173>-Footnote-2426159883
Ref: ライブラリ<173>-Footnote-2436159950
Ref: ライブラリ<173>-Footnote-2446160017
Ref: ライブラリ<173>-Footnote-2456160084
Ref: ライブラリ<173>-Footnote-2466160151
Ref: ライブラリ<173>-Footnote-2476160218
Ref: ライブラリ<173>-Footnote-2486160285
Ref: ライブラリ<173>-Footnote-2496160352
Ref: ライブラリ<173>-Footnote-2506160419
Ref: ライブラリ<173>-Footnote-2516160486
Ref: ライブラリ<173>-Footnote-2526160553
Ref: ライブラリ<173>-Footnote-2536160620
Ref: ライブラリ<173>-Footnote-2546160687
Ref: ライブラリ<173>-Footnote-2556160754
Ref: ライブラリ<173>-Footnote-2566160821
Ref: ライブラリ<173>-Footnote-2576160888
Ref: ライブラリ<173>-Footnote-2586160955
Ref: ライブラリ<173>-Footnote-2596161022
Ref: ライブラリ<173>-Footnote-2606161089
Ref: ライブラリ<173>-Footnote-2616161156
Ref: ライブラリ<173>-Footnote-2626161223
Ref: ライブラリ<173>-Footnote-2636161290
Ref: ライブラリ<173>-Footnote-2646161357
Ref: ライブラリ<173>-Footnote-2656161424
Ref: ライブラリ<173>-Footnote-2666161491
Ref: ライブラリ<173>-Footnote-2676161558
Ref: ライブラリ<173>-Footnote-2686161625
Ref: ライブラリ<173>-Footnote-2696161692
Ref: ライブラリ<173>-Footnote-2706161759
Ref: ライブラリ<173>-Footnote-2716161826
Ref: ライブラリ<173>-Footnote-2726161893
Ref: ライブラリ<173>-Footnote-2736161949
Ref: ライブラリ<173>-Footnote-2746162016
Ref: ライブラリ<173>-Footnote-2756162083
Ref: ライブラリ<173>-Footnote-2766162150
Ref: ライブラリ<173>-Footnote-2776162217
Ref: ライブラリ<173>-Footnote-2786162284
Ref: ライブラリ<173>-Footnote-2796162351
Ref: ライブラリ<173>-Footnote-2806162418
Ref: ライブラリ<173>-Footnote-2816162485
Ref: ライブラリ<173>-Footnote-2826162552
Ref: ライブラリ<173>-Footnote-2836162619
Ref: ライブラリ<173>-Footnote-2846162686
Ref: ライブラリ<173>-Footnote-2856162753
Ref: ライブラリ<173>-Footnote-2866162820
Ref: ライブラリ<173>-Footnote-2876162887
Ref: ライブラリ<173>-Footnote-2886162954
Ref: ライブラリ<173>-Footnote-2896163021
Ref: ライブラリ<173>-Footnote-2906163088
Ref: ライブラリ<173>-Footnote-2916163155
Ref: ライブラリ<173>-Footnote-2926163222
Ref: ライブラリ<173>-Footnote-2936163289
Ref: ライブラリ<173>-Footnote-2946163356
Ref: ライブラリ<173>-Footnote-2956163423
Ref: ライブラリ<173>-Footnote-2966163490
Ref: ライブラリ<173>-Footnote-2976163557
Ref: ライブラリ<173>-Footnote-2986163624
Ref: ライブラリ<173>-Footnote-2996163691
Ref: ライブラリ<173>-Footnote-3006163758
Ref: ライブラリ<173>-Footnote-3016163825
Ref: ライブラリ<173>-Footnote-3026163892
Ref: ライブラリ<173>-Footnote-3036163959
Ref: ライブラリ<173>-Footnote-3046164026
Ref: ライブラリ<173>-Footnote-3056164093
Ref: ライブラリ<173>-Footnote-3066164160
Ref: ライブラリ<173>-Footnote-3076164227
Ref: ライブラリ<173>-Footnote-3086164294
Ref: ライブラリ<173>-Footnote-3096164361
Ref: ライブラリ<173>-Footnote-3106164428
Ref: ライブラリ<173>-Footnote-3116164495
Ref: ライブラリ<173>-Footnote-3126164562
Ref: ライブラリ<173>-Footnote-3136164629
Ref: ライブラリ<173>-Footnote-3146164696
Ref: ライブラリ<173>-Footnote-3156164763
Ref: ライブラリ<173>-Footnote-3166164830
Ref: ライブラリ<173>-Footnote-3176164897
Ref: ライブラリ<173>-Footnote-3186164964
Ref: ライブラリ<173>-Footnote-3196165031
Ref: ライブラリ<173>-Footnote-3206165098
Ref: ライブラリ<173>-Footnote-3216165165
Ref: ライブラリ<173>-Footnote-3226165232
Ref: ライブラリ<173>-Footnote-3236165299
Ref: ライブラリ<173>-Footnote-3246165366
Ref: ライブラリ<173>-Footnote-3256165433
Ref: ライブラリ<173>-Footnote-3266165500
Node: ドキュメント<66>6165567
Ref: whatsnew/changelog id8346165697
Ref: 1e996165697
Ref: ドキュメント<66>-Footnote-16167865
Ref: ドキュメント<66>-Footnote-26167930
Ref: ドキュメント<66>-Footnote-36167995
Ref: ドキュメント<66>-Footnote-46168060
Ref: ドキュメント<66>-Footnote-56168125
Ref: ドキュメント<66>-Footnote-66168190
Ref: ドキュメント<66>-Footnote-76168255
Ref: ドキュメント<66>-Footnote-86168320
Ref: ドキュメント<66>-Footnote-96168385
Ref: ドキュメント<66>-Footnote-106168450
Ref: ドキュメント<66>-Footnote-116168516
Ref: ドキュメント<66>-Footnote-126168582
Ref: ドキュメント<66>-Footnote-136168648
Ref: ドキュメント<66>-Footnote-146168714
Ref: ドキュメント<66>-Footnote-156168780
Ref: ドキュメント<66>-Footnote-166168846
Ref: ドキュメント<66>-Footnote-176168889
Node: テスト<62>6168955
Ref: whatsnew/changelog id8356169078
Ref: 1e9c6169078
Ref: テスト<62>-Footnote-16171829
Ref: テスト<62>-Footnote-26171894
Ref: テスト<62>-Footnote-36171959
Ref: テスト<62>-Footnote-46172024
Ref: テスト<62>-Footnote-56172089
Ref: テスト<62>-Footnote-66172154
Ref: テスト<62>-Footnote-76172219
Ref: テスト<62>-Footnote-86172284
Ref: テスト<62>-Footnote-96172349
Ref: テスト<62>-Footnote-106172414
Ref: テスト<62>-Footnote-116172480
Ref: テスト<62>-Footnote-126172546
Ref: テスト<62>-Footnote-136172612
Ref: テスト<62>-Footnote-146172678
Ref: テスト<62>-Footnote-156172744
Ref: テスト<62>-Footnote-166172810
Ref: テスト<62>-Footnote-176172876
Ref: テスト<62>-Footnote-186172942
Ref: テスト<62>-Footnote-196173008
Node: ビルド<70>6173074
Ref: whatsnew/changelog id8366173186
Ref: 1e9d6173186
Ref: ビルド<70>-Footnote-16177944
Ref: ビルド<70>-Footnote-26178009
Ref: ビルド<70>-Footnote-36178074
Ref: ビルド<70>-Footnote-46178139
Ref: ビルド<70>-Footnote-56178181
Ref: ビルド<70>-Footnote-66178246
Ref: ビルド<70>-Footnote-76178311
Ref: ビルド<70>-Footnote-86178376
Ref: ビルド<70>-Footnote-96178441
Ref: ビルド<70>-Footnote-106178506
Ref: ビルド<70>-Footnote-116178572
Ref: ビルド<70>-Footnote-126178638
Ref: ビルド<70>-Footnote-136178704
Ref: ビルド<70>-Footnote-146178770
Ref: ビルド<70>-Footnote-156178836
Ref: ビルド<70>-Footnote-166178902
Ref: ビルド<70>-Footnote-176178968
Ref: ビルド<70>-Footnote-186179034
Ref: ビルド<70>-Footnote-196179100
Ref: ビルド<70>-Footnote-206179166
Ref: ビルド<70>-Footnote-216179232
Ref: ビルド<70>-Footnote-226179298
Ref: ビルド<70>-Footnote-236179364
Ref: ビルド<70>-Footnote-246179430
Ref: ビルド<70>-Footnote-256179496
Ref: ビルド<70>-Footnote-266179562
Ref: ビルド<70>-Footnote-276179628
Ref: ビルド<70>-Footnote-286179694
Ref: ビルド<70>-Footnote-296179760
Ref: ビルド<70>-Footnote-306179826
Ref: ビルド<70>-Footnote-316179892
Ref: ビルド<70>-Footnote-326179958
Ref: ビルド<70>-Footnote-336180024
Ref: ビルド<70>-Footnote-346180090
Ref: ビルド<70>-Footnote-356180156
Ref: ビルド<70>-Footnote-366180222
Ref: ビルド<70>-Footnote-376180288
Node: Windows<63>6180354
Ref: whatsnew/changelog id8376180461
Ref: 1e9e6180461
Ref: Windows<63>-Footnote-16182947
Ref: Windows<63>-Footnote-26183012
Ref: Windows<63>-Footnote-36183077
Ref: Windows<63>-Footnote-46183142
Ref: Windows<63>-Footnote-56183207
Ref: Windows<63>-Footnote-66183272
Ref: Windows<63>-Footnote-76183337
Ref: Windows<63>-Footnote-86183402
Ref: Windows<63>-Footnote-96183467
Ref: Windows<63>-Footnote-106183532
Ref: Windows<63>-Footnote-116183598
Ref: Windows<63>-Footnote-126183664
Ref: Windows<63>-Footnote-136183730
Ref: Windows<63>-Footnote-146183796
Ref: Windows<63>-Footnote-156183862
Ref: Windows<63>-Footnote-166183928
Ref: Windows<63>-Footnote-176183994
Ref: Windows<63>-Footnote-186184060
Ref: Windows<63>-Footnote-196184126
Ref: Windows<63>-Footnote-206184192
Ref: Windows<63>-Footnote-216184258
Ref: Windows<63>-Footnote-226184324
Ref: Windows<63>-Footnote-236184390
Ref: Windows<63>-Footnote-246184456
Ref: Windows<63>-Footnote-256184522
Node: IDLE<45>6184588
Ref: whatsnew/changelog id8386184697
Ref: 1e9f6184697
Ref: IDLE<45>-Footnote-16194606
Ref: IDLE<45>-Footnote-26194671
Ref: IDLE<45>-Footnote-36194736
Ref: IDLE<45>-Footnote-46194801
Ref: IDLE<45>-Footnote-56194866
Ref: IDLE<45>-Footnote-66194931
Ref: IDLE<45>-Footnote-76194996
Ref: IDLE<45>-Footnote-86195061
Ref: IDLE<45>-Footnote-96195126
Ref: IDLE<45>-Footnote-106195191
Ref: IDLE<45>-Footnote-116195257
Ref: IDLE<45>-Footnote-126195323
Ref: IDLE<45>-Footnote-136195389
Ref: IDLE<45>-Footnote-146195455
Ref: IDLE<45>-Footnote-156195521
Ref: IDLE<45>-Footnote-166195587
Ref: IDLE<45>-Footnote-176195653
Ref: IDLE<45>-Footnote-186195719
Ref: IDLE<45>-Footnote-196195785
Ref: IDLE<45>-Footnote-206195851
Ref: IDLE<45>-Footnote-216195917
Ref: IDLE<45>-Footnote-226195983
Ref: IDLE<45>-Footnote-236196049
Ref: IDLE<45>-Footnote-246196115
Ref: IDLE<45>-Footnote-256196181
Ref: IDLE<45>-Footnote-266196247
Ref: IDLE<45>-Footnote-276196313
Ref: IDLE<45>-Footnote-286196379
Ref: IDLE<45>-Footnote-296196445
Ref: IDLE<45>-Footnote-306196511
Ref: IDLE<45>-Footnote-316196577
Ref: IDLE<45>-Footnote-326196643
Ref: IDLE<45>-Footnote-336196709
Ref: IDLE<45>-Footnote-346196775
Ref: IDLE<45>-Footnote-356196840
Ref: IDLE<45>-Footnote-366196906
Ref: IDLE<45>-Footnote-376196972
Ref: IDLE<45>-Footnote-386197038
Ref: IDLE<45>-Footnote-396197104
Ref: IDLE<45>-Footnote-406197170
Ref: IDLE<45>-Footnote-416197236
Ref: IDLE<45>-Footnote-426197302
Ref: IDLE<45>-Footnote-436197368
Ref: IDLE<45>-Footnote-446197433
Ref: IDLE<45>-Footnote-456197499
Ref: IDLE<45>-Footnote-466197565
Ref: IDLE<45>-Footnote-476197631
Ref: IDLE<45>-Footnote-486197697
Ref: IDLE<45>-Footnote-496197763
Ref: IDLE<45>-Footnote-506197829
Ref: IDLE<45>-Footnote-516197895
Node: Tools/Demos<43>6197961
Ref: whatsnew/changelog id8396198068
Ref: 1ea06198068
Ref: Tools/Demos<43>-Footnote-16199550
Ref: Tools/Demos<43>-Footnote-26199615
Ref: Tools/Demos<43>-Footnote-36199657
Ref: Tools/Demos<43>-Footnote-46199722
Ref: Tools/Demos<43>-Footnote-56199787
Ref: Tools/Demos<43>-Footnote-66199852
Ref: Tools/Demos<43>-Footnote-76199917
Ref: Tools/Demos<43>-Footnote-86199982
Node: C API<63>6200047
Ref: whatsnew/changelog id8406200137
Ref: 1ea16200137
Ref: C API<63>-Footnote-16203191
Ref: C API<63>-Footnote-26203256
Ref: C API<63>-Footnote-36203321
Ref: C API<63>-Footnote-46203386
Ref: C API<63>-Footnote-56203451
Ref: C API<63>-Footnote-66203515
Ref: C API<63>-Footnote-76203580
Ref: C API<63>-Footnote-86203645
Ref: C API<63>-Footnote-96203710
Ref: C API<63>-Footnote-106203775
Ref: C API<63>-Footnote-116203841
Ref: C API<63>-Footnote-126203907
Ref: C API<63>-Footnote-136203973
Ref: C API<63>-Footnote-146204039
Ref: C API<63>-Footnote-156204105
Node: Python 3 6 6 final6204171
Ref: whatsnew/changelog python-3-6-6-final6204308
Ref: 1ea26204308
Node: Python 3 6 6 release candidate 16204436
Ref: whatsnew/changelog python-3-6-6-release-candidate-16204571
Ref: 1ea36204571
Node: Core and Builtins<170>6204994
Ref: whatsnew/changelog id8416205114
Ref: 1ea46205114
Ref: Core and Builtins<170>-Footnote-16206692
Ref: Core and Builtins<170>-Footnote-26206757
Ref: Core and Builtins<170>-Footnote-36206822
Ref: Core and Builtins<170>-Footnote-46206887
Ref: Core and Builtins<170>-Footnote-56206952
Ref: Core and Builtins<170>-Footnote-66207017
Ref: Core and Builtins<170>-Footnote-76207082
Ref: Core and Builtins<170>-Footnote-86207147
Ref: Core and Builtins<170>-Footnote-96207212
Ref: Core and Builtins<170>-Footnote-106207277
Ref: Core and Builtins<170>-Footnote-116207343
Ref: Core and Builtins<170>-Footnote-126207409
Node: ライブラリ<174>6207475
Ref: whatsnew/changelog id8426207626
Ref: 1ea56207626
Ref: ライブラリ<174>-Footnote-16213104
Ref: ライブラリ<174>-Footnote-26213169
Ref: ライブラリ<174>-Footnote-36213234
Ref: ライブラリ<174>-Footnote-46213299
Ref: ライブラリ<174>-Footnote-56213364
Ref: ライブラリ<174>-Footnote-66213429
Ref: ライブラリ<174>-Footnote-76213494
Ref: ライブラリ<174>-Footnote-86213559
Ref: ライブラリ<174>-Footnote-96213624
Ref: ライブラリ<174>-Footnote-106213689
Ref: ライブラリ<174>-Footnote-116213755
Ref: ライブラリ<174>-Footnote-126213821
Ref: ライブラリ<174>-Footnote-136213887
Ref: ライブラリ<174>-Footnote-146213953
Ref: ライブラリ<174>-Footnote-156214019
Ref: ライブラリ<174>-Footnote-166214085
Ref: ライブラリ<174>-Footnote-176214151
Ref: ライブラリ<174>-Footnote-186214217
Ref: ライブラリ<174>-Footnote-196214283
Ref: ライブラリ<174>-Footnote-206214349
Ref: ライブラリ<174>-Footnote-216214415
Ref: ライブラリ<174>-Footnote-226214482
Ref: ライブラリ<174>-Footnote-236214548
Ref: ライブラリ<174>-Footnote-246214614
Ref: ライブラリ<174>-Footnote-256214680
Ref: ライブラリ<174>-Footnote-266214746
Ref: ライブラリ<174>-Footnote-276214812
Ref: ライブラリ<174>-Footnote-286214878
Ref: ライブラリ<174>-Footnote-296214921
Ref: ライブラリ<174>-Footnote-306214987
Ref: ライブラリ<174>-Footnote-316215053
Ref: ライブラリ<174>-Footnote-326215119
Ref: ライブラリ<174>-Footnote-336215185
Ref: ライブラリ<174>-Footnote-346215251
Ref: ライブラリ<174>-Footnote-356215317
Ref: ライブラリ<174>-Footnote-366215383
Ref: ライブラリ<174>-Footnote-376215449
Ref: ライブラリ<174>-Footnote-386215515
Ref: ライブラリ<174>-Footnote-396215581
Node: ドキュメント<67>6215647
Ref: whatsnew/changelog id8436215789
Ref: 1ea66215789
Ref: ドキュメント<67>-Footnote-16217284
Ref: ドキュメント<67>-Footnote-26217349
Ref: ドキュメント<67>-Footnote-36217414
Ref: ドキュメント<67>-Footnote-46217479
Ref: ドキュメント<67>-Footnote-56217544
Ref: ドキュメント<67>-Footnote-66217609
Ref: ドキュメント<67>-Footnote-76217674
Ref: ドキュメント<67>-Footnote-86217739
Ref: ドキュメント<67>-Footnote-96217804
Ref: ドキュメント<67>-Footnote-106217869
Ref: ドキュメント<67>-Footnote-116217935
Ref: ドキュメント<67>-Footnote-126218001
Ref: ドキュメント<67>-Footnote-136218066
Node: テスト<63>6218132
Ref: whatsnew/changelog id8446218267
Ref: 1ea76218267
Ref: テスト<63>-Footnote-16218494
Ref: テスト<63>-Footnote-26218559
Node: ビルド<71>6218624
Ref: whatsnew/changelog id8456218748
Ref: 1ea86218748
Ref: ビルド<71>-Footnote-16219550
Ref: ビルド<71>-Footnote-26219614
Ref: ビルド<71>-Footnote-36219679
Ref: ビルド<71>-Footnote-46219744
Ref: ビルド<71>-Footnote-56219809
Node: Windows<64>6219874
Ref: whatsnew/changelog id8466219994
Ref: 1ea96219994
Ref: Windows<64>-Footnote-16220131
Node: macOS<49>6220196
Ref: whatsnew/changelog id8476220311
Ref: 1eaa6220311
Ref: macOS<49>-Footnote-16220452
Node: IDLE<46>6220517
Ref: whatsnew/changelog id8486220636
Ref: 1eab6220636
Ref: IDLE<46>-Footnote-16222691
Ref: IDLE<46>-Footnote-26222756
Ref: IDLE<46>-Footnote-36222821
Ref: IDLE<46>-Footnote-46222886
Ref: IDLE<46>-Footnote-56222951
Ref: IDLE<46>-Footnote-66223016
Ref: IDLE<46>-Footnote-76223081
Ref: IDLE<46>-Footnote-86223146
Ref: IDLE<46>-Footnote-96223211
Ref: IDLE<46>-Footnote-106223276
Ref: IDLE<46>-Footnote-116223342
Ref: IDLE<46>-Footnote-126223408
Node: Tools/Demos<44>6223474
Ref: whatsnew/changelog id8496223593
Ref: 1eac6223593
Ref: Tools/Demos<44>-Footnote-16224344
Ref: Tools/Demos<44>-Footnote-26224409
Ref: Tools/Demos<44>-Footnote-36224474
Ref: Tools/Demos<44>-Footnote-46224539
Ref: Tools/Demos<44>-Footnote-56224604
Node: C API<64>6224669
Ref: whatsnew/changelog id8506224771
Ref: 1ead6224771
Ref: C API<64>-Footnote-16224984
Node: Python 3 6 5 final6225049
Ref: whatsnew/changelog python-3-6-5-final6225198
Ref: 1eae6225198
Node: テスト<64>6225347
Ref: whatsnew/changelog id8516225437
Ref: 1eaf6225437
Ref: テスト<64>-Footnote-16225596
Node: ビルド<72>6225661
Ref: whatsnew/changelog id8526225751
Ref: 1eb06225751
Ref: ビルド<72>-Footnote-16225893
Node: Python 3 6 5 release candidate 16225958
Ref: whatsnew/changelog python-3-6-5-release-candidate-16226093
Ref: 1eb16226093
Node: セキュリティ<50>6226562
Ref: whatsnew/changelog id8536226684
Ref: 1eb26226684
Ref: セキュリティ<50>-Footnote-16227129
Ref: セキュリティ<50>-Footnote-26227194
Ref: セキュリティ<50>-Footnote-36227259
Ref: セキュリティ<50>-Footnote-46227314
Node: Core and Builtins<171>6227369
Ref: whatsnew/changelog id8546227520
Ref: 1eb36227520
Ref: Core and Builtins<171>-Footnote-16229682
Ref: Core and Builtins<171>-Footnote-26229747
Ref: Core and Builtins<171>-Footnote-36229812
Ref: Core and Builtins<171>-Footnote-46229877
Ref: Core and Builtins<171>-Footnote-56229942
Ref: Core and Builtins<171>-Footnote-66230007
Ref: Core and Builtins<171>-Footnote-76230072
Ref: Core and Builtins<171>-Footnote-86230137
Ref: Core and Builtins<171>-Footnote-96230202
Ref: Core and Builtins<171>-Footnote-106230267
Ref: Core and Builtins<171>-Footnote-116230333
Ref: Core and Builtins<171>-Footnote-126230399
Ref: Core and Builtins<171>-Footnote-136230465
Ref: Core and Builtins<171>-Footnote-146230531
Node: ライブラリ<175>6230597
Ref: whatsnew/changelog id8556230748
Ref: 1eb46230748
Ref: ライブラリ<175>-Footnote-16236668
Ref: ライブラリ<175>-Footnote-26236733
Ref: ライブラリ<175>-Footnote-36236798
Ref: ライブラリ<175>-Footnote-46236863
Ref: ライブラリ<175>-Footnote-56236928
Ref: ライブラリ<175>-Footnote-66236993
Ref: ライブラリ<175>-Footnote-76237058
Ref: ライブラリ<175>-Footnote-86237123
Ref: ライブラリ<175>-Footnote-96237188
Ref: ライブラリ<175>-Footnote-106237253
Ref: ライブラリ<175>-Footnote-116237319
Ref: ライブラリ<175>-Footnote-126237385
Ref: ライブラリ<175>-Footnote-136237451
Ref: ライブラリ<175>-Footnote-146237517
Ref: ライブラリ<175>-Footnote-156237583
Ref: ライブラリ<175>-Footnote-166237649
Ref: ライブラリ<175>-Footnote-176237715
Ref: ライブラリ<175>-Footnote-186237781
Ref: ライブラリ<175>-Footnote-196237847
Ref: ライブラリ<175>-Footnote-206237913
Ref: ライブラリ<175>-Footnote-216237979
Ref: ライブラリ<175>-Footnote-226238045
Ref: ライブラリ<175>-Footnote-236238111
Ref: ライブラリ<175>-Footnote-246238177
Ref: ライブラリ<175>-Footnote-256238243
Ref: ライブラリ<175>-Footnote-266238309
Ref: ライブラリ<175>-Footnote-276238375
Ref: ライブラリ<175>-Footnote-286238441
Ref: ライブラリ<175>-Footnote-296238507
Ref: ライブラリ<175>-Footnote-306238573
Ref: ライブラリ<175>-Footnote-316238639
Ref: ライブラリ<175>-Footnote-326238705
Ref: ライブラリ<175>-Footnote-336238771
Ref: ライブラリ<175>-Footnote-346238837
Ref: ライブラリ<175>-Footnote-356238903
Ref: ライブラリ<175>-Footnote-366238969
Ref: ライブラリ<175>-Footnote-376239035
Ref: ライブラリ<175>-Footnote-386239101
Ref: ライブラリ<175>-Footnote-396239167
Ref: ライブラリ<175>-Footnote-406239233
Node: ドキュメント<68>6239299
Ref: whatsnew/changelog id8566239441
Ref: 1eb56239441
Ref: ドキュメント<68>-Footnote-16240281
Ref: ドキュメント<68>-Footnote-26240346
Ref: ドキュメント<68>-Footnote-36240411
Ref: ドキュメント<68>-Footnote-46240475
Ref: ドキュメント<68>-Footnote-56240540
Ref: ドキュメント<68>-Footnote-66240605
Node: テスト<65>6240670
Ref: whatsnew/changelog id8576240805
Ref: 1eb66240805
Ref: テスト<65>-Footnote-16241471
Ref: テスト<65>-Footnote-26241536
Ref: テスト<65>-Footnote-36241601
Ref: テスト<65>-Footnote-46241666
Node: ビルド<73>6241731
Ref: whatsnew/changelog id8586241855
Ref: 1eb76241855
Ref: ビルド<73>-Footnote-16242049
Node: Windows<65>6242114
Ref: whatsnew/changelog id8596242234
Ref: 1eb86242234
Ref: Windows<65>-Footnote-16243184
Ref: Windows<65>-Footnote-26243249
Ref: Windows<65>-Footnote-36243314
Ref: Windows<65>-Footnote-46243379
Ref: Windows<65>-Footnote-56243444
Ref: Windows<65>-Footnote-66243509
Ref: Windows<65>-Footnote-76243574
Ref: Windows<65>-Footnote-86243639
Node: macOS<50>6243704
Ref: whatsnew/changelog id8606243819
Ref: 1eb96243819
Ref: macOS<50>-Footnote-16244212
Node: IDLE<47>6244277
Ref: whatsnew/changelog id8616244396
Ref: 1eba6244396
Ref: IDLE<47>-Footnote-16245878
Ref: IDLE<47>-Footnote-26245943
Ref: IDLE<47>-Footnote-36246008
Ref: IDLE<47>-Footnote-46246073
Ref: IDLE<47>-Footnote-56246138
Ref: IDLE<47>-Footnote-66246203
Ref: IDLE<47>-Footnote-76246268
Ref: IDLE<47>-Footnote-86246333
Node: Tools/Demos<45>6246398
Ref: whatsnew/changelog id8626246517
Ref: 1ebb6246517
Ref: Tools/Demos<45>-Footnote-16246937
Ref: Tools/Demos<45>-Footnote-26247002
Node: C API<65>6247067
Ref: whatsnew/changelog id8636247169
Ref: 1ebc6247169
Ref: C API<65>-Footnote-16247419
Node: Python 3 6 4 final6247484
Ref: whatsnew/changelog python-3-6-4-final6247633
Ref: 1ebd6247633
Node: Python 3 6 4 release candidate 16247782
Ref: whatsnew/changelog python-3-6-4-release-candidate-16247917
Ref: 1ebe6247917
Node: Core and Builtins<172>6248340
Ref: whatsnew/changelog id8646248460
Ref: 1ebf6248460
Ref: Core and Builtins<172>-Footnote-16253178
Ref: Core and Builtins<172>-Footnote-26253243
Ref: Core and Builtins<172>-Footnote-36253308
Ref: Core and Builtins<172>-Footnote-46253373
Ref: Core and Builtins<172>-Footnote-56253438
Ref: Core and Builtins<172>-Footnote-66253503
Ref: Core and Builtins<172>-Footnote-76253568
Ref: Core and Builtins<172>-Footnote-86253633
Ref: Core and Builtins<172>-Footnote-96253698
Ref: Core and Builtins<172>-Footnote-106253763
Ref: Core and Builtins<172>-Footnote-116253829
Ref: Core and Builtins<172>-Footnote-126253895
Ref: Core and Builtins<172>-Footnote-136253961
Ref: Core and Builtins<172>-Footnote-146254027
Ref: Core and Builtins<172>-Footnote-156254093
Ref: Core and Builtins<172>-Footnote-166254159
Ref: Core and Builtins<172>-Footnote-176254225
Ref: Core and Builtins<172>-Footnote-186254291
Ref: Core and Builtins<172>-Footnote-196254357
Ref: Core and Builtins<172>-Footnote-206254423
Ref: Core and Builtins<172>-Footnote-216254489
Ref: Core and Builtins<172>-Footnote-226254555
Ref: Core and Builtins<172>-Footnote-236254621
Ref: Core and Builtins<172>-Footnote-246254687
Node: ライブラリ<176>6254753
Ref: whatsnew/changelog id8656254904
Ref: 1ec06254904
Ref: ライブラリ<176>-Footnote-16262226
Ref: ライブラリ<176>-Footnote-26262291
Ref: ライブラリ<176>-Footnote-36262356
Ref: ライブラリ<176>-Footnote-46262421
Ref: ライブラリ<176>-Footnote-56262486
Ref: ライブラリ<176>-Footnote-66262551
Ref: ライブラリ<176>-Footnote-76262616
Ref: ライブラリ<176>-Footnote-86262681
Ref: ライブラリ<176>-Footnote-96262746
Ref: ライブラリ<176>-Footnote-106262811
Ref: ライブラリ<176>-Footnote-116262877
Ref: ライブラリ<176>-Footnote-126262943
Ref: ライブラリ<176>-Footnote-136263009
Ref: ライブラリ<176>-Footnote-146263075
Ref: ライブラリ<176>-Footnote-156263141
Ref: ライブラリ<176>-Footnote-166263207
Ref: ライブラリ<176>-Footnote-176263272
Ref: ライブラリ<176>-Footnote-186263338
Ref: ライブラリ<176>-Footnote-196263404
Ref: ライブラリ<176>-Footnote-206263470
Ref: ライブラリ<176>-Footnote-216263536
Ref: ライブラリ<176>-Footnote-226263602
Ref: ライブラリ<176>-Footnote-236263668
Ref: ライブラリ<176>-Footnote-246263734
Ref: ライブラリ<176>-Footnote-256263800
Ref: ライブラリ<176>-Footnote-266263866
Ref: ライブラリ<176>-Footnote-276263932
Ref: ライブラリ<176>-Footnote-286263998
Ref: ライブラリ<176>-Footnote-296264064
Ref: ライブラリ<176>-Footnote-306264130
Ref: ライブラリ<176>-Footnote-316264196
Ref: ライブラリ<176>-Footnote-326264262
Ref: ライブラリ<176>-Footnote-336264328
Ref: ライブラリ<176>-Footnote-346264394
Ref: ライブラリ<176>-Footnote-356264460
Ref: ライブラリ<176>-Footnote-366264526
Ref: ライブラリ<176>-Footnote-376264592
Ref: ライブラリ<176>-Footnote-386264658
Ref: ライブラリ<176>-Footnote-396264724
Ref: ライブラリ<176>-Footnote-406264790
Ref: ライブラリ<176>-Footnote-416264856
Ref: ライブラリ<176>-Footnote-426264922
Ref: ライブラリ<176>-Footnote-436264988
Ref: ライブラリ<176>-Footnote-446265054
Ref: ライブラリ<176>-Footnote-456265120
Ref: ライブラリ<176>-Footnote-466265186
Ref: ライブラリ<176>-Footnote-476265252
Ref: ライブラリ<176>-Footnote-486265318
Ref: ライブラリ<176>-Footnote-496265384
Ref: ライブラリ<176>-Footnote-506265450
Ref: ライブラリ<176>-Footnote-516265516
Ref: ライブラリ<176>-Footnote-526265582
Node: ドキュメント<69>6265648
Ref: whatsnew/changelog id8666265790
Ref: 1ec16265790
Ref: ドキュメント<69>-Footnote-16266283
Ref: ドキュメント<69>-Footnote-26266348
Ref: ドキュメント<69>-Footnote-36266413
Node: テスト<66>6266478
Ref: whatsnew/changelog id8676266613
Ref: 1ec26266613
Ref: テスト<66>-Footnote-16267296
Ref: テスト<66>-Footnote-26267361
Ref: テスト<66>-Footnote-36267426
Ref: テスト<66>-Footnote-46267491
Node: ビルド<74>6267556
Ref: whatsnew/changelog id8686267680
Ref: 1ec36267680
Ref: ビルド<74>-Footnote-16268589
Ref: ビルド<74>-Footnote-26268654
Ref: ビルド<74>-Footnote-36268719
Ref: ビルド<74>-Footnote-46268784
Ref: ビルド<74>-Footnote-56268849
Ref: ビルド<74>-Footnote-66268914
Ref: ビルド<74>-Footnote-76268979
Ref: ビルド<74>-Footnote-86269044
Ref: ビルド<74>-Footnote-96269109
Node: Windows<66>6269174
Ref: whatsnew/changelog id8696269294
Ref: 1ec46269294
Ref: Windows<66>-Footnote-16269612
Ref: Windows<66>-Footnote-26269676
Node: macOS<51>6269741
Ref: whatsnew/changelog id8706269856
Ref: 1ec56269856
Ref: macOS<51>-Footnote-16269990
Node: IDLE<48>6270055
Ref: whatsnew/changelog id8716270174
Ref: 1ec66270174
Ref: IDLE<48>-Footnote-16273495
Ref: IDLE<48>-Footnote-26273560
Ref: IDLE<48>-Footnote-36273625
Ref: IDLE<48>-Footnote-46273690
Ref: IDLE<48>-Footnote-56273755
Ref: IDLE<48>-Footnote-66273820
Ref: IDLE<48>-Footnote-76273885
Ref: IDLE<48>-Footnote-86273950
Ref: IDLE<48>-Footnote-96274015
Ref: IDLE<48>-Footnote-106274080
Ref: IDLE<48>-Footnote-116274146
Ref: IDLE<48>-Footnote-126274212
Ref: IDLE<48>-Footnote-136274278
Ref: IDLE<48>-Footnote-146274344
Node: Tools/Demos<46>6274412
Ref: whatsnew/changelog id8726274531
Ref: 1ec76274531
Ref: Tools/Demos<46>-Footnote-16274819
Node: C API<66>6274884
Ref: whatsnew/changelog id8736274986
Ref: 1ec86274986
Ref: C API<66>-Footnote-16275714
Ref: C API<66>-Footnote-26275779
Ref: C API<66>-Footnote-36275844
Ref: C API<66>-Footnote-46275909
Node: Python 3 6 3 final6275974
Ref: whatsnew/changelog python-3-6-3-final6276123
Ref: 1ec96276123
Node: ライブラリ<177>6276285
Ref: whatsnew/changelog id8746276382
Ref: 1eca6276382
Ref: ライブラリ<177>-Footnote-16276595
Node: ビルド<75>6276660
Ref: whatsnew/changelog id8756276757
Ref: 1ecb6276757
Ref: ビルド<75>-Footnote-16277053
Ref: ビルド<75>-Footnote-26277118
Node: Python 3 6 3 release candidate 16277183
Ref: whatsnew/changelog python-3-6-3-release-candidate-16277318
Ref: 1ecc6277318
Node: セキュリティ<51>6277747
Ref: whatsnew/changelog id8766277869
Ref: 1ecd6277869
Ref: セキュリティ<51>-Footnote-16278189
Ref: セキュリティ<51>-Footnote-26278254
Node: Core and Builtins<173>6278319
Ref: whatsnew/changelog id8776278470
Ref: 1ece6278470
Ref: Core and Builtins<173>-Footnote-16281988
Ref: Core and Builtins<173>-Footnote-26282053
Ref: Core and Builtins<173>-Footnote-36282118
Ref: Core and Builtins<173>-Footnote-46282183
Ref: Core and Builtins<173>-Footnote-56282248
Ref: Core and Builtins<173>-Footnote-66282313
Ref: Core and Builtins<173>-Footnote-76282378
Ref: Core and Builtins<173>-Footnote-86282443
Ref: Core and Builtins<173>-Footnote-96282508
Ref: Core and Builtins<173>-Footnote-106282573
Ref: Core and Builtins<173>-Footnote-116282639
Ref: Core and Builtins<173>-Footnote-126282705
Ref: Core and Builtins<173>-Footnote-136282771
Ref: Core and Builtins<173>-Footnote-146282837
Ref: Core and Builtins<173>-Footnote-156282903
Ref: Core and Builtins<173>-Footnote-166282969
Ref: Core and Builtins<173>-Footnote-176283035
Ref: Core and Builtins<173>-Footnote-186283101
Ref: Core and Builtins<173>-Footnote-196283167
Ref: Core and Builtins<173>-Footnote-206283233
Ref: Core and Builtins<173>-Footnote-216283299
Ref: Core and Builtins<173>-Footnote-226283365
Node: ライブラリ<178>6283431
Ref: whatsnew/changelog id8786283582
Ref: 1ecf6283582
Ref: ライブラリ<178>-Footnote-16289580
Ref: ライブラリ<178>-Footnote-26289645
Ref: ライブラリ<178>-Footnote-36289710
Ref: ライブラリ<178>-Footnote-46289775
Ref: ライブラリ<178>-Footnote-56289840
Ref: ライブラリ<178>-Footnote-66289905
Ref: ライブラリ<178>-Footnote-76289970
Ref: ライブラリ<178>-Footnote-86290035
Ref: ライブラリ<178>-Footnote-96290100
Ref: ライブラリ<178>-Footnote-106290165
Ref: ライブラリ<178>-Footnote-116290231
Ref: ライブラリ<178>-Footnote-126290297
Ref: ライブラリ<178>-Footnote-136290363
Ref: ライブラリ<178>-Footnote-146290429
Ref: ライブラリ<178>-Footnote-156290495
Ref: ライブラリ<178>-Footnote-166290560
Ref: ライブラリ<178>-Footnote-176290626
Ref: ライブラリ<178>-Footnote-186290692
Ref: ライブラリ<178>-Footnote-196290735
Ref: ライブラリ<178>-Footnote-206290801
Ref: ライブラリ<178>-Footnote-216290867
Ref: ライブラリ<178>-Footnote-226290933
Ref: ライブラリ<178>-Footnote-236290999
Ref: ライブラリ<178>-Footnote-246291065
Ref: ライブラリ<178>-Footnote-256291131
Ref: ライブラリ<178>-Footnote-266291197
Ref: ライブラリ<178>-Footnote-276291263
Ref: ライブラリ<178>-Footnote-286291329
Ref: ライブラリ<178>-Footnote-296291395
Ref: ライブラリ<178>-Footnote-306291461
Ref: ライブラリ<178>-Footnote-316291527
Ref: ライブラリ<178>-Footnote-326291593
Ref: ライブラリ<178>-Footnote-336291659
Ref: ライブラリ<178>-Footnote-346291725
Ref: ライブラリ<178>-Footnote-356291791
Ref: ライブラリ<178>-Footnote-366291857
Ref: ライブラリ<178>-Footnote-376291923
Ref: ライブラリ<178>-Footnote-386291989
Ref: ライブラリ<178>-Footnote-396292055
Ref: ライブラリ<178>-Footnote-406292121
Ref: ライブラリ<178>-Footnote-416292187
Ref: ライブラリ<178>-Footnote-426292253
Node: ドキュメント<70>6292319
Ref: whatsnew/changelog id8796292461
Ref: 1ed06292461
Ref: ドキュメント<70>-Footnote-16292888
Ref: ドキュメント<70>-Footnote-26292953
Ref: ドキュメント<70>-Footnote-36293018
Node: テスト<67>6293083
Ref: whatsnew/changelog id8806293218
Ref: 1ed16293218
Ref: テスト<67>-Footnote-16293924
Ref: テスト<67>-Footnote-26293989
Ref: テスト<67>-Footnote-36294054
Ref: テスト<67>-Footnote-46294119
Node: ビルド<76>6294184
Ref: whatsnew/changelog id8816294308
Ref: 1ed26294308
Ref: ビルド<76>-Footnote-16294486
Node: Windows<67>6294551
Ref: whatsnew/changelog id8826294670
Ref: 1ed36294670
Ref: Windows<67>-Footnote-16295178
Ref: Windows<67>-Footnote-26295243
Ref: Windows<67>-Footnote-36295308
Ref: Windows<67>-Footnote-46295373
Node: IDLE<49>6295438
Ref: whatsnew/changelog id8836295559
Ref: 1ed46295559
Ref: IDLE<49>-Footnote-16304304
Ref: IDLE<49>-Footnote-26304369
Ref: IDLE<49>-Footnote-36304434
Ref: IDLE<49>-Footnote-46304499
Ref: IDLE<49>-Footnote-56304564
Ref: IDLE<49>-Footnote-66304629
Ref: IDLE<49>-Footnote-76304694
Ref: IDLE<49>-Footnote-86304759
Ref: IDLE<49>-Footnote-96304824
Ref: IDLE<49>-Footnote-106304889
Ref: IDLE<49>-Footnote-116304955
Ref: IDLE<49>-Footnote-126305021
Ref: IDLE<49>-Footnote-136305087
Ref: IDLE<49>-Footnote-146305153
Ref: IDLE<49>-Footnote-156305219
Ref: IDLE<49>-Footnote-166305285
Ref: IDLE<49>-Footnote-176305351
Ref: IDLE<49>-Footnote-186305417
Ref: IDLE<49>-Footnote-196305483
Ref: IDLE<49>-Footnote-206305549
Ref: IDLE<49>-Footnote-216305615
Ref: IDLE<49>-Footnote-226305681
Ref: IDLE<49>-Footnote-236305747
Ref: IDLE<49>-Footnote-246305813
Ref: IDLE<49>-Footnote-256305879
Ref: IDLE<49>-Footnote-266305945
Ref: IDLE<49>-Footnote-276306011
Ref: IDLE<49>-Footnote-286306077
Ref: IDLE<49>-Footnote-296306143
Ref: IDLE<49>-Footnote-306306209
Ref: IDLE<49>-Footnote-316306275
Ref: IDLE<49>-Footnote-326306341
Ref: IDLE<49>-Footnote-336306407
Ref: IDLE<49>-Footnote-346306473
Ref: IDLE<49>-Footnote-356306538
Ref: IDLE<49>-Footnote-366306604
Ref: IDLE<49>-Footnote-376306670
Ref: IDLE<49>-Footnote-386306736
Ref: IDLE<49>-Footnote-396306802
Ref: IDLE<49>-Footnote-406306868
Ref: IDLE<49>-Footnote-416306934
Ref: IDLE<49>-Footnote-426307000
Ref: IDLE<49>-Footnote-436307066
Node: Tools/Demos<47>6307131
Ref: whatsnew/changelog id8846307232
Ref: 1ed56307232
Ref: Tools/Demos<47>-Footnote-16307790
Ref: Tools/Demos<47>-Footnote-26307855
Node: Python 3 6 2 final6307897
Ref: whatsnew/changelog python-3-6-2-final6308046
Ref: 1ed66308046
Node: Python 3 6 2 release candidate 26308167
Ref: whatsnew/changelog python-3-6-2-release-candidate-26308316
Ref: 1ed76308316
Node: セキュリティ<52>6308483
Ref: whatsnew/changelog id8856308574
Ref: 1ed86308574
Ref: セキュリティ<52>-Footnote-16309709
Ref: セキュリティ<52>-Footnote-26309774
Ref: セキュリティ<52>-Footnote-36309839
Ref: セキュリティ<52>-Footnote-46309894
Ref: セキュリティ<52>-Footnote-56309949
Ref: セキュリティ<52>-Footnote-66310004
Ref: セキュリティ<52>-Footnote-76310059
Ref: セキュリティ<52>-Footnote-86310114
Ref: セキュリティ<52>-Footnote-96310169
Node: Python 3 6 2 release candidate 16310234
Ref: whatsnew/changelog python-3-6-2-release-candidate-16310383
Ref: 1ed96310383
Node: セキュリティ<53>6310832
Ref: whatsnew/changelog id8866310954
Ref: 1eda6310954
Ref: セキュリティ<53>-Footnote-16311241
Ref: セキュリティ<53>-Footnote-26311306
Ref: セキュリティ<53>-Footnote-36311361
Node: Core and Builtins<174>6311416
Ref: whatsnew/changelog id8876311567
Ref: 1edb6311567
Ref: Core and Builtins<174>-Footnote-16313541
Ref: Core and Builtins<174>-Footnote-26313606
Ref: Core and Builtins<174>-Footnote-36313671
Ref: Core and Builtins<174>-Footnote-46313736
Ref: Core and Builtins<174>-Footnote-56313801
Ref: Core and Builtins<174>-Footnote-66313866
Ref: Core and Builtins<174>-Footnote-76313931
Ref: Core and Builtins<174>-Footnote-86313996
Ref: Core and Builtins<174>-Footnote-96314061
Ref: Core and Builtins<174>-Footnote-106314126
Ref: Core and Builtins<174>-Footnote-116314192
Ref: Core and Builtins<174>-Footnote-126314258
Ref: Core and Builtins<174>-Footnote-136314324
Ref: Core and Builtins<174>-Footnote-146314390
Ref: Core and Builtins<174>-Footnote-156314456
Node: ライブラリ<179>6314522
Ref: whatsnew/changelog id8886314659
Ref: 1edc6314659
Ref: ライブラリ<179>-Footnote-16323068
Ref: ライブラリ<179>-Footnote-26323133
Ref: ライブラリ<179>-Footnote-36323198
Ref: ライブラリ<179>-Footnote-46323263
Ref: ライブラリ<179>-Footnote-56323328
Ref: ライブラリ<179>-Footnote-66323393
Ref: ライブラリ<179>-Footnote-76323458
Ref: ライブラリ<179>-Footnote-86323523
Ref: ライブラリ<179>-Footnote-96323588
Ref: ライブラリ<179>-Footnote-106323653
Ref: ライブラリ<179>-Footnote-116323719
Ref: ライブラリ<179>-Footnote-126323785
Ref: ライブラリ<179>-Footnote-136323851
Ref: ライブラリ<179>-Footnote-146323917
Ref: ライブラリ<179>-Footnote-156323983
Ref: ライブラリ<179>-Footnote-166324049
Ref: ライブラリ<179>-Footnote-176324115
Ref: ライブラリ<179>-Footnote-186324181
Ref: ライブラリ<179>-Footnote-196324247
Ref: ライブラリ<179>-Footnote-206324313
Ref: ライブラリ<179>-Footnote-216324379
Ref: ライブラリ<179>-Footnote-226324445
Ref: ライブラリ<179>-Footnote-236324511
Ref: ライブラリ<179>-Footnote-246324577
Ref: ライブラリ<179>-Footnote-256324643
Ref: ライブラリ<179>-Footnote-266324709
Ref: ライブラリ<179>-Footnote-276324775
Ref: ライブラリ<179>-Footnote-286324841
Ref: ライブラリ<179>-Footnote-296324907
Ref: ライブラリ<179>-Footnote-306324973
Ref: ライブラリ<179>-Footnote-316325039
Ref: ライブラリ<179>-Footnote-326325105
Ref: ライブラリ<179>-Footnote-336325171
Ref: ライブラリ<179>-Footnote-346325237
Ref: ライブラリ<179>-Footnote-356325303
Ref: ライブラリ<179>-Footnote-366325369
Ref: ライブラリ<179>-Footnote-376325435
Ref: ライブラリ<179>-Footnote-386325501
Ref: ライブラリ<179>-Footnote-396325567
Ref: ライブラリ<179>-Footnote-406325633
Ref: ライブラリ<179>-Footnote-416325699
Ref: ライブラリ<179>-Footnote-426325765
Ref: ライブラリ<179>-Footnote-436325831
Ref: ライブラリ<179>-Footnote-446325897
Ref: ライブラリ<179>-Footnote-456325963
Ref: ライブラリ<179>-Footnote-466326029
Ref: ライブラリ<179>-Footnote-476326095
Ref: ライブラリ<179>-Footnote-486326161
Ref: ライブラリ<179>-Footnote-496326227
Ref: ライブラリ<179>-Footnote-506326293
Ref: ライブラリ<179>-Footnote-516326359
Ref: ライブラリ<179>-Footnote-526326425
Ref: ライブラリ<179>-Footnote-536326491
Ref: ライブラリ<179>-Footnote-546326557
Ref: ライブラリ<179>-Footnote-556326623
Ref: ライブラリ<179>-Footnote-566326688
Ref: ライブラリ<179>-Footnote-576326754
Ref: ライブラリ<179>-Footnote-586326820
Ref: ライブラリ<179>-Footnote-596326886
Ref: ライブラリ<179>-Footnote-606326952
Node: IDLE<50>6327018
Ref: whatsnew/changelog id8896327142
Ref: 1edd6327142
Ref: IDLE<50>-Footnote-16328145
Ref: IDLE<50>-Footnote-26328210
Ref: IDLE<50>-Footnote-36328275
Ref: IDLE<50>-Footnote-46328340
Ref: IDLE<50>-Footnote-56328405
Ref: IDLE<50>-Footnote-66328470
Node: C API<67>6328535
Ref: whatsnew/changelog id8906328652
Ref: 1ede6328652
Ref: C API<67>-Footnote-16328840
Node: ビルド<77>6328905
Ref: whatsnew/changelog id8916329036
Ref: 1edf6329036
Ref: ビルド<77>-Footnote-16329846
Ref: ビルド<77>-Footnote-26329911
Ref: ビルド<77>-Footnote-36329976
Ref: ビルド<77>-Footnote-46330041
Ref: ビルド<77>-Footnote-56330106
Node: ドキュメント<71>6330171
Ref: whatsnew/changelog id8926330308
Ref: 1ee06330308
Ref: ドキュメント<71>-Footnote-16331041
Ref: ドキュメント<71>-Footnote-26331106
Ref: ドキュメント<71>-Footnote-36331171
Node: Tools/Demos<48>6331236
Ref: whatsnew/changelog id8936331373
Ref: 1ee16331373
Ref: Tools/Demos<48>-Footnote-16331563
Node: テスト<68>6331628
Ref: whatsnew/changelog id8946331754
Ref: 1ee26331754
Ref: テスト<68>-Footnote-16332414
Ref: テスト<68>-Footnote-26332479
Node: Windows<68>6332544
Ref: whatsnew/changelog id8956332646
Ref: 1ee36332646
Ref: Windows<68>-Footnote-16333090
Ref: Windows<68>-Footnote-26333155
Node: Python 3 6 1 final6333220
Ref: whatsnew/changelog python-3-6-1-final6333369
Ref: 1ee46333369
Node: Core and Builtins<175>6333535
Ref: whatsnew/changelog id8966333634
Ref: 1ee56333634
Ref: Core and Builtins<175>-Footnote-16334251
Ref: Core and Builtins<175>-Footnote-26334316
Node: ビルド<78>6334381
Ref: whatsnew/changelog id8976334480
Ref: 1ee66334480
Ref: ビルド<78>-Footnote-16334667
Node: Python 3 6 1 release candidate 16334732
Ref: whatsnew/changelog python-3-6-1-release-candidate-16334867
Ref: 1ee76334867
Node: Core and Builtins<176>6335238
Ref: whatsnew/changelog id8986335358
Ref: 1ee86335358
Ref: Core and Builtins<176>-Footnote-16338190
Ref: Core and Builtins<176>-Footnote-26338255
Ref: Core and Builtins<176>-Footnote-36338320
Ref: Core and Builtins<176>-Footnote-46338385
Ref: Core and Builtins<176>-Footnote-56338450
Ref: Core and Builtins<176>-Footnote-66338515
Ref: Core and Builtins<176>-Footnote-76338580
Ref: Core and Builtins<176>-Footnote-86338645
Ref: Core and Builtins<176>-Footnote-96338710
Ref: Core and Builtins<176>-Footnote-106338775
Ref: Core and Builtins<176>-Footnote-116338841
Ref: Core and Builtins<176>-Footnote-126338907
Ref: Core and Builtins<176>-Footnote-136338973
Ref: Core and Builtins<176>-Footnote-146339039
Ref: Core and Builtins<176>-Footnote-156339105
Ref: Core and Builtins<176>-Footnote-166339171
Ref: Core and Builtins<176>-Footnote-176339237
Ref: Core and Builtins<176>-Footnote-186339303
Ref: Core and Builtins<176>-Footnote-196339369
Ref: Core and Builtins<176>-Footnote-206339435
Ref: Core and Builtins<176>-Footnote-216339501
Ref: Core and Builtins<176>-Footnote-226339567
Node: ライブラリ<180>6339633
Ref: whatsnew/changelog id8996339770
Ref: 1ee96339770
Ref: ライブラリ<180>-Footnote-16345416
Ref: ライブラリ<180>-Footnote-26345481
Ref: ライブラリ<180>-Footnote-36345546
Ref: ライブラリ<180>-Footnote-46345611
Ref: ライブラリ<180>-Footnote-56345676
Ref: ライブラリ<180>-Footnote-66345741
Ref: ライブラリ<180>-Footnote-76345806
Ref: ライブラリ<180>-Footnote-86345871
Ref: ライブラリ<180>-Footnote-96345936
Ref: ライブラリ<180>-Footnote-106346001
Ref: ライブラリ<180>-Footnote-116346067
Ref: ライブラリ<180>-Footnote-126346133
Ref: ライブラリ<180>-Footnote-136346199
Ref: ライブラリ<180>-Footnote-146346265
Ref: ライブラリ<180>-Footnote-156346331
Ref: ライブラリ<180>-Footnote-166346397
Ref: ライブラリ<180>-Footnote-176346463
Ref: ライブラリ<180>-Footnote-186346529
Ref: ライブラリ<180>-Footnote-196346595
Ref: ライブラリ<180>-Footnote-206346661
Ref: ライブラリ<180>-Footnote-216346727
Ref: ライブラリ<180>-Footnote-226346793
Ref: ライブラリ<180>-Footnote-236346859
Ref: ライブラリ<180>-Footnote-246346925
Ref: ライブラリ<180>-Footnote-256346991
Ref: ライブラリ<180>-Footnote-266347057
Ref: ライブラリ<180>-Footnote-276347123
Ref: ライブラリ<180>-Footnote-286347166
Ref: ライブラリ<180>-Footnote-296347232
Ref: ライブラリ<180>-Footnote-306347298
Ref: ライブラリ<180>-Footnote-316347364
Ref: ライブラリ<180>-Footnote-326347430
Ref: ライブラリ<180>-Footnote-336347496
Ref: ライブラリ<180>-Footnote-346347562
Ref: ライブラリ<180>-Footnote-356347628
Ref: ライブラリ<180>-Footnote-366347693
Ref: ライブラリ<180>-Footnote-376347759
Ref: ライブラリ<180>-Footnote-386347825
Ref: ライブラリ<180>-Footnote-396347891
Ref: ライブラリ<180>-Footnote-406347957
Ref: ライブラリ<180>-Footnote-416348023
Ref: ライブラリ<180>-Footnote-426348089
Ref: ライブラリ<180>-Footnote-436348155
Ref: ライブラリ<180>-Footnote-446348221
Node: IDLE<51>6348287
Ref: whatsnew/changelog id9006348413
Ref: 1eea6348413
Ref: IDLE<51>-Footnote-16348700
Ref: IDLE<51>-Footnote-26348765
Node: Windows<69>6348830
Ref: whatsnew/changelog id9016348945
Ref: 1eeb6348945
Ref: Windows<69>-Footnote-16349592
Ref: Windows<69>-Footnote-26349657
Ref: Windows<69>-Footnote-36349722
Ref: Windows<69>-Footnote-46349787
Ref: Windows<69>-Footnote-56349852
Ref: Windows<69>-Footnote-66349894
Ref: Windows<69>-Footnote-76349959
Ref: Windows<69>-Footnote-86350024
Node: C API<68>6350089
Ref: whatsnew/changelog id9026350218
Ref: 1eec6350218
Ref: C API<68>-Footnote-16351044
Ref: C API<68>-Footnote-26351109
Ref: C API<68>-Footnote-36351174
Node: ドキュメント<72>6351239
Ref: whatsnew/changelog id9036351370
Ref: 1eed6351370
Ref: ドキュメント<72>-Footnote-16351911
Ref: ドキュメント<72>-Footnote-26351976
Ref: ドキュメント<72>-Footnote-36352041
Ref: ドキュメント<72>-Footnote-46352106
Node: テスト<69>6352171
Ref: whatsnew/changelog id9046352306
Ref: 1eee6352306
Ref: テスト<69>-Footnote-16353296
Ref: テスト<69>-Footnote-26353361
Ref: テスト<69>-Footnote-36353426
Ref: テスト<69>-Footnote-46353491
Ref: テスト<69>-Footnote-56353556
Node: ビルド<79>6353621
Ref: whatsnew/changelog id9056353725
Ref: 1eef6353725
Ref: ビルド<79>-Footnote-16354991
Ref: ビルド<79>-Footnote-26355056
Ref: ビルド<79>-Footnote-36355121
Ref: ビルド<79>-Footnote-46355186
Ref: ビルド<79>-Footnote-56355251
Ref: ビルド<79>-Footnote-66355316
Ref: ビルド<79>-Footnote-76355381
Ref: ビルド<79>-Footnote-86355446
Ref: ビルド<79>-Footnote-96355511
Ref: ビルド<79>-Footnote-106355576
Node: Python 3 6 0 final6355642
Ref: whatsnew/changelog python-3-6-0-final6355791
Ref: 1ef06355791
Node: Python 3 6 0 release candidate 26355912
Ref: whatsnew/changelog python-3-6-0-release-candidate-26356061
Ref: 1ef16356061
Node: Core and Builtins<177>6356311
Ref: whatsnew/changelog id9066356426
Ref: 1ef26356426
Ref: Core and Builtins<177>-Footnote-16356811
Ref: Core and Builtins<177>-Footnote-26356876
Node: Tools/Demos<49>6356941
Ref: whatsnew/changelog id9076357076
Ref: 1ef36357076
Ref: Tools/Demos<49>-Footnote-16357210
Node: Windows<70>6357275
Ref: whatsnew/changelog id9086357401
Ref: 1ef46357401
Ref: Windows<70>-Footnote-16357527
Node: ビルド<80>6357592
Ref: whatsnew/changelog id9096357694
Ref: 1ef56357694
Ref: ビルド<80>-Footnote-16357854
Node: Python 3 6 0 release candidate 16357919
Ref: whatsnew/changelog python-3-6-0-release-candidate-16358069
Ref: 1ef66358069
Node: Core and Builtins<178>6358374
Ref: whatsnew/changelog id9106358494
Ref: 1ef76358494
Ref: Core and Builtins<178>-Footnote-16359301
Ref: Core and Builtins<178>-Footnote-26359366
Ref: Core and Builtins<178>-Footnote-36359431
Ref: Core and Builtins<178>-Footnote-46359496
Node: ライブラリ<181>6359561
Ref: whatsnew/changelog id9116359699
Ref: 1ef86359699
Ref: ライブラリ<181>-Footnote-16360749
Ref: ライブラリ<181>-Footnote-26360814
Ref: ライブラリ<181>-Footnote-36360879
Ref: ライブラリ<181>-Footnote-46360944
Ref: ライブラリ<181>-Footnote-56361009
Ref: ライブラリ<181>-Footnote-66361074
Node: C API<69>6361139
Ref: whatsnew/changelog id9126361277
Ref: 1ef96361277
Ref: C API<69>-Footnote-16361435
Node: ドキュメント<73>6361500
Ref: whatsnew/changelog id9136361633
Ref: 1efa6361633
Ref: ドキュメント<73>-Footnote-16361975
Ref: ドキュメント<73>-Footnote-26362040
Node: Tools/Demos<50>6362082
Ref: whatsnew/changelog id9146362197
Ref: 1efb6362197
Ref: Tools/Demos<50>-Footnote-16362361
Node: Python 3 6 0 beta 46362426
Ref: whatsnew/changelog python-3-6-0-beta-46362563
Ref: 1efc6362563
Node: Core and Builtins<179>6362846
Ref: whatsnew/changelog id9156362953
Ref: 1efd6362953
Ref: Core and Builtins<179>-Footnote-16364501
Ref: Core and Builtins<179>-Footnote-26364566
Ref: Core and Builtins<179>-Footnote-36364631
Ref: Core and Builtins<179>-Footnote-46364696
Ref: Core and Builtins<179>-Footnote-56364761
Ref: Core and Builtins<179>-Footnote-66364826
Ref: Core and Builtins<179>-Footnote-76364891
Ref: Core and Builtins<179>-Footnote-86364956
Ref: Core and Builtins<179>-Footnote-96365021
Ref: Core and Builtins<179>-Footnote-106365086
Ref: Core and Builtins<179>-Footnote-116365152
Node: ライブラリ<182>6365218
Ref: whatsnew/changelog id9166365356
Ref: 1efe6365356
Ref: ライブラリ<182>-Footnote-16367365
Ref: ライブラリ<182>-Footnote-26367430
Ref: ライブラリ<182>-Footnote-36367495
Ref: ライブラリ<182>-Footnote-46367560
Ref: ライブラリ<182>-Footnote-56367625
Ref: ライブラリ<182>-Footnote-66367690
Ref: ライブラリ<182>-Footnote-76367755
Ref: ライブラリ<182>-Footnote-86367820
Ref: ライブラリ<182>-Footnote-96367885
Ref: ライブラリ<182>-Footnote-106367950
Ref: ライブラリ<182>-Footnote-116368016
Ref: ライブラリ<182>-Footnote-126368082
Ref: ライブラリ<182>-Footnote-136368148
Ref: ライブラリ<182>-Footnote-146368214
Ref: ライブラリ<182>-Footnote-156368280
Ref: ライブラリ<182>-Footnote-166368346
Ref: ライブラリ<182>-Footnote-176368412
Ref: ライブラリ<182>-Footnote-186368478
Node: ドキュメント<74>6368544
Ref: whatsnew/changelog id9176368673
Ref: 1eff6368673
Ref: ドキュメント<74>-Footnote-16368828
Node: テスト<70>6368893
Ref: whatsnew/changelog id9186369015
Ref: 1f006369015
Ref: テスト<70>-Footnote-16369282
Ref: テスト<70>-Footnote-26369347
Node: ビルド<81>6369412
Ref: whatsnew/changelog id9196369503
Ref: 1f016369503
Ref: ビルド<81>-Footnote-16369863
Ref: ビルド<81>-Footnote-26369928
Ref: ビルド<81>-Footnote-36369993
Node: Python 3 6 0 beta 36370058
Ref: whatsnew/changelog python-3-6-0-beta-36370182
Ref: 1f026370182
Node: Core and Builtins<180>6370443
Ref: whatsnew/changelog id9206370550
Ref: 1f036370550
Ref: Core and Builtins<180>-Footnote-16371453
Ref: Core and Builtins<180>-Footnote-26371518
Ref: Core and Builtins<180>-Footnote-36371583
Ref: Core and Builtins<180>-Footnote-46371648
Ref: Core and Builtins<180>-Footnote-56371713
Ref: Core and Builtins<180>-Footnote-66371778
Ref: Core and Builtins<180>-Footnote-76371843
Node: ライブラリ<183>6371908
Ref: whatsnew/changelog id9216372035
Ref: 1f046372035
Ref: ライブラリ<183>-Footnote-16375068
Ref: ライブラリ<183>-Footnote-26375133
Ref: ライブラリ<183>-Footnote-36375198
Ref: ライブラリ<183>-Footnote-46375263
Ref: ライブラリ<183>-Footnote-56375328
Ref: ライブラリ<183>-Footnote-66375393
Ref: ライブラリ<183>-Footnote-76375458
Ref: ライブラリ<183>-Footnote-86375523
Ref: ライブラリ<183>-Footnote-96375588
Ref: ライブラリ<183>-Footnote-106375653
Ref: ライブラリ<183>-Footnote-116375719
Ref: ライブラリ<183>-Footnote-126375785
Ref: ライブラリ<183>-Footnote-136375851
Ref: ライブラリ<183>-Footnote-146375917
Ref: ライブラリ<183>-Footnote-156375983
Ref: ライブラリ<183>-Footnote-166376049
Ref: ライブラリ<183>-Footnote-176376115
Ref: ライブラリ<183>-Footnote-186376181
Ref: ライブラリ<183>-Footnote-196376247
Ref: ライブラリ<183>-Footnote-206376313
Ref: ライブラリ<183>-Footnote-216376379
Ref: ライブラリ<183>-Footnote-226376445
Ref: ライブラリ<183>-Footnote-236376511
Ref: ライブラリ<183>-Footnote-246376577
Node: Windows<71>6376643
Ref: whatsnew/changelog id9226376761
Ref: 1f056376761
Ref: Windows<71>-Footnote-16376905
Node: ビルド<82>6376970
Ref: whatsnew/changelog id9236377081
Ref: 1f066377081
Ref: ビルド<82>-Footnote-16377405
Ref: ビルド<82>-Footnote-26377470
Ref: ビルド<82>-Footnote-36377535
Node: テスト<71>6377600
Ref: whatsnew/changelog id9246377691
Ref: 1f076377691
Ref: テスト<71>-Footnote-16377951
Ref: テスト<71>-Footnote-26378016
Node: Python 3 6 0 beta 26378081
Ref: whatsnew/changelog python-3-6-0-beta-26378205
Ref: 1f086378205
Node: Core and Builtins<181>6378486
Ref: whatsnew/changelog id9256378593
Ref: 1f096378593
Ref: Core and Builtins<181>-Footnote-16381326
Ref: Core and Builtins<181>-Footnote-26381391
Ref: Core and Builtins<181>-Footnote-36381456
Ref: Core and Builtins<181>-Footnote-46381521
Ref: Core and Builtins<181>-Footnote-56381586
Ref: Core and Builtins<181>-Footnote-66381651
Ref: Core and Builtins<181>-Footnote-76381716
Ref: Core and Builtins<181>-Footnote-86381781
Ref: Core and Builtins<181>-Footnote-96381846
Ref: Core and Builtins<181>-Footnote-106381911
Ref: Core and Builtins<181>-Footnote-116381977
Ref: Core and Builtins<181>-Footnote-126382043
Ref: Core and Builtins<181>-Footnote-136382109
Ref: Core and Builtins<181>-Footnote-146382175
Ref: Core and Builtins<181>-Footnote-156382241
Ref: Core and Builtins<181>-Footnote-166382307
Ref: Core and Builtins<181>-Footnote-176382373
Ref: Core and Builtins<181>-Footnote-186382439
Ref: Core and Builtins<181>-Footnote-196382505
Ref: Core and Builtins<181>-Footnote-206382571
Ref: Core and Builtins<181>-Footnote-216382637
Ref: Core and Builtins<181>-Footnote-226382703
Ref: Core and Builtins<181>-Footnote-236382769
Node: ライブラリ<184>6382835
Ref: whatsnew/changelog id9266382962
Ref: 1f0a6382962
Ref: ライブラリ<184>-Footnote-16388753
Ref: ライブラリ<184>-Footnote-26388818
Ref: ライブラリ<184>-Footnote-36388883
Ref: ライブラリ<184>-Footnote-46388948
Ref: ライブラリ<184>-Footnote-56389013
Ref: ライブラリ<184>-Footnote-66389078
Ref: ライブラリ<184>-Footnote-76389143
Ref: ライブラリ<184>-Footnote-86389208
Ref: ライブラリ<184>-Footnote-96389273
Ref: ライブラリ<184>-Footnote-106389338
Ref: ライブラリ<184>-Footnote-116389404
Ref: ライブラリ<184>-Footnote-126389470
Ref: ライブラリ<184>-Footnote-136389536
Ref: ライブラリ<184>-Footnote-146389602
Ref: ライブラリ<184>-Footnote-156389668
Ref: ライブラリ<184>-Footnote-166389734
Ref: ライブラリ<184>-Footnote-176389800
Ref: ライブラリ<184>-Footnote-186389866
Ref: ライブラリ<184>-Footnote-196389932
Ref: ライブラリ<184>-Footnote-206389998
Ref: ライブラリ<184>-Footnote-216390064
Ref: ライブラリ<184>-Footnote-226390130
Ref: ライブラリ<184>-Footnote-236390196
Ref: ライブラリ<184>-Footnote-246390262
Ref: ライブラリ<184>-Footnote-256390328
Ref: ライブラリ<184>-Footnote-266390394
Ref: ライブラリ<184>-Footnote-276390460
Ref: ライブラリ<184>-Footnote-286390526
Ref: ライブラリ<184>-Footnote-296390592
Ref: ライブラリ<184>-Footnote-306390658
Ref: ライブラリ<184>-Footnote-316390724
Ref: ライブラリ<184>-Footnote-326390790
Ref: ライブラリ<184>-Footnote-336390856
Ref: ライブラリ<184>-Footnote-346390922
Ref: ライブラリ<184>-Footnote-356390988
Ref: ライブラリ<184>-Footnote-366391054
Ref: ライブラリ<184>-Footnote-376391120
Ref: ライブラリ<184>-Footnote-386391186
Ref: ライブラリ<184>-Footnote-396391252
Ref: ライブラリ<184>-Footnote-406391318
Ref: ライブラリ<184>-Footnote-416391384
Ref: ライブラリ<184>-Footnote-426391450
Ref: ライブラリ<184>-Footnote-436391516
Ref: ライブラリ<184>-Footnote-446391582
Ref: ライブラリ<184>-Footnote-456391648
Ref: ライブラリ<184>-Footnote-466391714
Ref: ライブラリ<184>-Footnote-476391780
Ref: ライブラリ<184>-Footnote-486391846
Node: Windows<72>6391912
Ref: whatsnew/changelog id9276392026
Ref: 1f0b6392026
Ref: Windows<72>-Footnote-16392837
Ref: Windows<72>-Footnote-26392902
Ref: Windows<72>-Footnote-36392967
Ref: Windows<72>-Footnote-46393032
Ref: Windows<72>-Footnote-56393097
Ref: Windows<72>-Footnote-66393162
Ref: Windows<72>-Footnote-76393227
Ref: Windows<72>-Footnote-86393292
Ref: Windows<72>-Footnote-96393357
Ref: Windows<72>-Footnote-106393422
Node: C API<70>6393488
Ref: whatsnew/changelog id9286393595
Ref: 1f0c6393595
Ref: C API<70>-Footnote-16393849
Node: ビルド<83>6393914
Ref: whatsnew/changelog id9296394023
Ref: 1f0d6394023
Ref: ビルド<83>-Footnote-16394454
Ref: ビルド<83>-Footnote-26394519
Ref: ビルド<83>-Footnote-36394584
Node: テスト<72>6394649
Ref: whatsnew/changelog id9306394740
Ref: 1f0e6394740
Ref: テスト<72>-Footnote-16394882
Node: Python 3 6 0 beta 16394947
Ref: whatsnew/changelog python-3-6-0-beta-16395072
Ref: 1f0f6395072
Node: Core and Builtins<182>6395403
Ref: whatsnew/changelog id9316395510
Ref: 1f106395510
Ref: Core and Builtins<182>-Footnote-16401677
Ref: Core and Builtins<182>-Footnote-26401742
Ref: Core and Builtins<182>-Footnote-36401807
Ref: Core and Builtins<182>-Footnote-46401872
Ref: Core and Builtins<182>-Footnote-56401914
Ref: Core and Builtins<182>-Footnote-66401979
Ref: Core and Builtins<182>-Footnote-76402044
Ref: Core and Builtins<182>-Footnote-86402109
Ref: Core and Builtins<182>-Footnote-96402174
Ref: Core and Builtins<182>-Footnote-106402239
Ref: Core and Builtins<182>-Footnote-116402305
Ref: Core and Builtins<182>-Footnote-126402371
Ref: Core and Builtins<182>-Footnote-136402437
Ref: Core and Builtins<182>-Footnote-146402480
Ref: Core and Builtins<182>-Footnote-156402546
Ref: Core and Builtins<182>-Footnote-166402612
Ref: Core and Builtins<182>-Footnote-176402655
Ref: Core and Builtins<182>-Footnote-186402721
Ref: Core and Builtins<182>-Footnote-196402764
Ref: Core and Builtins<182>-Footnote-206402830
Ref: Core and Builtins<182>-Footnote-216402896
Ref: Core and Builtins<182>-Footnote-226402962
Ref: Core and Builtins<182>-Footnote-236403028
Ref: Core and Builtins<182>-Footnote-246403094
Ref: Core and Builtins<182>-Footnote-256403160
Ref: Core and Builtins<182>-Footnote-266403226
Ref: Core and Builtins<182>-Footnote-276403292
Ref: Core and Builtins<182>-Footnote-286403335
Ref: Core and Builtins<182>-Footnote-296403401
Ref: Core and Builtins<182>-Footnote-306403467
Ref: Core and Builtins<182>-Footnote-316403533
Ref: Core and Builtins<182>-Footnote-326403599
Ref: Core and Builtins<182>-Footnote-336403665
Ref: Core and Builtins<182>-Footnote-346403731
Ref: Core and Builtins<182>-Footnote-356403797
Ref: Core and Builtins<182>-Footnote-366403863
Ref: Core and Builtins<182>-Footnote-376403929
Ref: Core and Builtins<182>-Footnote-386403995
Ref: Core and Builtins<182>-Footnote-396404061
Ref: Core and Builtins<182>-Footnote-406404127
Ref: Core and Builtins<182>-Footnote-416404193
Ref: Core and Builtins<182>-Footnote-426404259
Ref: Core and Builtins<182>-Footnote-436404325
Ref: Core and Builtins<182>-Footnote-446404391
Ref: Core and Builtins<182>-Footnote-456404457
Ref: Core and Builtins<182>-Footnote-466404523
Ref: Core and Builtins<182>-Footnote-476404566
Node: ライブラリ<185>6404632
Ref: whatsnew/changelog id9326404756
Ref: 1f116404756
Ref: ライブラリ<185>-Footnote-16415710
Ref: ライブラリ<185>-Footnote-26415775
Ref: ライブラリ<185>-Footnote-36415840
Ref: ライブラリ<185>-Footnote-46415905
Ref: ライブラリ<185>-Footnote-56415970
Ref: ライブラリ<185>-Footnote-66416035
Ref: ライブラリ<185>-Footnote-76416100
Ref: ライブラリ<185>-Footnote-86416165
Ref: ライブラリ<185>-Footnote-96416230
Ref: ライブラリ<185>-Footnote-106416295
Ref: ライブラリ<185>-Footnote-116416361
Ref: ライブラリ<185>-Footnote-126416427
Ref: ライブラリ<185>-Footnote-136416493
Ref: ライブラリ<185>-Footnote-146416559
Ref: ライブラリ<185>-Footnote-156416625
Ref: ライブラリ<185>-Footnote-166416691
Ref: ライブラリ<185>-Footnote-176416757
Ref: ライブラリ<185>-Footnote-186416825
Ref: ライブラリ<185>-Footnote-196416891
Ref: ライブラリ<185>-Footnote-206416957
Ref: ライブラリ<185>-Footnote-216417023
Ref: ライブラリ<185>-Footnote-226417089
Ref: ライブラリ<185>-Footnote-236417155
Ref: ライブラリ<185>-Footnote-246417221
Ref: ライブラリ<185>-Footnote-256417287
Ref: ライブラリ<185>-Footnote-266417354
Ref: ライブラリ<185>-Footnote-276417420
Ref: ライブラリ<185>-Footnote-286417486
Ref: ライブラリ<185>-Footnote-296417552
Ref: ライブラリ<185>-Footnote-306417618
Ref: ライブラリ<185>-Footnote-316417684
Ref: ライブラリ<185>-Footnote-326417750
Ref: ライブラリ<185>-Footnote-336417816
Ref: ライブラリ<185>-Footnote-346417882
Ref: ライブラリ<185>-Footnote-356417948
Ref: ライブラリ<185>-Footnote-366418014
Ref: ライブラリ<185>-Footnote-376418080
Ref: ライブラリ<185>-Footnote-386418146
Ref: ライブラリ<185>-Footnote-396418212
Ref: ライブラリ<185>-Footnote-406418278
Ref: ライブラリ<185>-Footnote-416418344
Ref: ライブラリ<185>-Footnote-426418410
Ref: ライブラリ<185>-Footnote-436418453
Ref: ライブラリ<185>-Footnote-446418519
Ref: ライブラリ<185>-Footnote-456418562
Ref: ライブラリ<185>-Footnote-466418628
Ref: ライブラリ<185>-Footnote-476418694
Ref: ライブラリ<185>-Footnote-486418760
Ref: ライブラリ<185>-Footnote-496418826
Ref: ライブラリ<185>-Footnote-506418892
Ref: ライブラリ<185>-Footnote-516418958
Ref: ライブラリ<185>-Footnote-526419024
Ref: ライブラリ<185>-Footnote-536419090
Ref: ライブラリ<185>-Footnote-546419146
Ref: ライブラリ<185>-Footnote-556419212
Ref: ライブラリ<185>-Footnote-566419278
Ref: ライブラリ<185>-Footnote-576419344
Ref: ライブラリ<185>-Footnote-586419410
Ref: ライブラリ<185>-Footnote-596419476
Ref: ライブラリ<185>-Footnote-606419542
Ref: ライブラリ<185>-Footnote-616419608
Ref: ライブラリ<185>-Footnote-626419674
Ref: ライブラリ<185>-Footnote-636419740
Ref: ライブラリ<185>-Footnote-646419806
Ref: ライブラリ<185>-Footnote-656419872
Ref: ライブラリ<185>-Footnote-666419938
Ref: ライブラリ<185>-Footnote-676420004
Ref: ライブラリ<185>-Footnote-686420070
Ref: ライブラリ<185>-Footnote-696420136
Ref: ライブラリ<185>-Footnote-706420202
Ref: ライブラリ<185>-Footnote-716420268
Ref: ライブラリ<185>-Footnote-726420334
Ref: ライブラリ<185>-Footnote-736420400
Ref: ライブラリ<185>-Footnote-746420466
Ref: ライブラリ<185>-Footnote-756420532
Ref: ライブラリ<185>-Footnote-766420598
Ref: ライブラリ<185>-Footnote-776420663
Ref: ライブラリ<185>-Footnote-786420728
Ref: ライブラリ<185>-Footnote-796420794
Ref: ライブラリ<185>-Footnote-806420860
Ref: ライブラリ<185>-Footnote-816420925
Ref: ライブラリ<185>-Footnote-826420991
Node: IDLE<52>6421057
Ref: whatsnew/changelog id9336421168
Ref: 1f126421168
Ref: IDLE<52>-Footnote-16421924
Ref: IDLE<52>-Footnote-26421989
Ref: IDLE<52>-Footnote-36422054
Ref: IDLE<52>-Footnote-46422119
Ref: IDLE<52>-Footnote-56422184
Ref: IDLE<52>-Footnote-66422249
Node: C API<71>6422314
Ref: whatsnew/changelog id9346422418
Ref: 1f136422418
Ref: C API<71>-Footnote-16422690
Ref: C API<71>-Footnote-26422755
Node: テスト<73>6422820
Ref: whatsnew/changelog id9356422929
Ref: 1f146422929
Ref: テスト<73>-Footnote-16423450
Ref: テスト<73>-Footnote-26423515
Ref: テスト<73>-Footnote-36423580
Ref: テスト<73>-Footnote-46423645
Node: ビルド<84>6423710
Ref: whatsnew/changelog id9366423825
Ref: 1f156423825
Ref: ビルド<84>-Footnote-16425213
Ref: ビルド<84>-Footnote-26425278
Ref: ビルド<84>-Footnote-36425343
Ref: ビルド<84>-Footnote-46425408
Ref: ビルド<84>-Footnote-56425473
Ref: ビルド<84>-Footnote-66425538
Ref: ビルド<84>-Footnote-76425603
Ref: ビルド<84>-Footnote-86425668
Ref: ビルド<84>-Footnote-96425733
Ref: ビルド<84>-Footnote-106425798
Ref: ビルド<84>-Footnote-116425864
Node: Tools/Demos<51>6425930
Ref: whatsnew/changelog id9376426043
Ref: 1f166426043
Ref: Tools/Demos<51>-Footnote-16426318
Node: Windows<73>6426383
Ref: whatsnew/changelog id9386426474
Ref: 1f176426474
Ref: Windows<73>-Footnote-16427441
Ref: Windows<73>-Footnote-26427506
Ref: Windows<73>-Footnote-36427571
Ref: Windows<73>-Footnote-46427635
Ref: Windows<73>-Footnote-56427700
Ref: Windows<73>-Footnote-66427765
Ref: Windows<73>-Footnote-76427829
Ref: Windows<73>-Footnote-86427894
Ref: Windows<73>-Footnote-96427959
Ref: Windows<73>-Footnote-106428024
Ref: Windows<73>-Footnote-116428090
Node: Python 3 6 0 alpha 46428156
Ref: whatsnew/changelog python-3-6-0-alpha-46428282
Ref: 1f186428282
Node: Core and Builtins<183>6428563
Ref: whatsnew/changelog id9396428671
Ref: 1f196428671
Ref: Core and Builtins<183>-Footnote-16430615
Ref: Core and Builtins<183>-Footnote-26430680
Ref: Core and Builtins<183>-Footnote-36430745
Ref: Core and Builtins<183>-Footnote-46430810
Ref: Core and Builtins<183>-Footnote-56430875
Ref: Core and Builtins<183>-Footnote-66430940
Ref: Core and Builtins<183>-Footnote-76431005
Ref: Core and Builtins<183>-Footnote-86431070
Ref: Core and Builtins<183>-Footnote-96431135
Ref: Core and Builtins<183>-Footnote-106431199
Ref: Core and Builtins<183>-Footnote-116431265
Ref: Core and Builtins<183>-Footnote-126431331
Ref: Core and Builtins<183>-Footnote-136431397
Ref: Core and Builtins<183>-Footnote-146431463
Node: ライブラリ<186>6431506
Ref: whatsnew/changelog id9406431631
Ref: 1f1a6431631
Ref: ライブラリ<186>-Footnote-16436133
Ref: ライブラリ<186>-Footnote-26436198
Ref: ライブラリ<186>-Footnote-36436240
Ref: ライブラリ<186>-Footnote-46436305
Ref: ライブラリ<186>-Footnote-56436370
Ref: ライブラリ<186>-Footnote-66436435
Ref: ライブラリ<186>-Footnote-76436500
Ref: ライブラリ<186>-Footnote-86436565
Ref: ライブラリ<186>-Footnote-96436630
Ref: ライブラリ<186>-Footnote-106436695
Ref: ライブラリ<186>-Footnote-116436761
Ref: ライブラリ<186>-Footnote-126436804
Ref: ライブラリ<186>-Footnote-136436870
Ref: ライブラリ<186>-Footnote-146436936
Ref: ライブラリ<186>-Footnote-156437002
Ref: ライブラリ<186>-Footnote-166437068
Ref: ライブラリ<186>-Footnote-176437133
Ref: ライブラリ<186>-Footnote-186437199
Ref: ライブラリ<186>-Footnote-196437265
Ref: ライブラリ<186>-Footnote-206437331
Ref: ライブラリ<186>-Footnote-216437397
Ref: ライブラリ<186>-Footnote-226437463
Ref: ライブラリ<186>-Footnote-236437529
Ref: ライブラリ<186>-Footnote-246437595
Ref: ライブラリ<186>-Footnote-256437661
Ref: ライブラリ<186>-Footnote-266437727
Ref: ライブラリ<186>-Footnote-276437793
Ref: ライブラリ<186>-Footnote-286437859
Ref: ライブラリ<186>-Footnote-296437918
Ref: ライブラリ<186>-Footnote-306437983
Ref: ライブラリ<186>-Footnote-316438049
Ref: ライブラリ<186>-Footnote-326438115
Ref: ライブラリ<186>-Footnote-336438181
Ref: ライブラリ<186>-Footnote-346438224
Ref: ライブラリ<186>-Footnote-356438290
Ref: ライブラリ<186>-Footnote-366438355
Ref: ライブラリ<186>-Footnote-376438421
Ref: ライブラリ<186>-Footnote-386438487
Ref: ライブラリ<186>-Footnote-396438553
Node: IDLE<53>6438619
Ref: whatsnew/changelog id9416438735
Ref: 1f1b6438735
Ref: IDLE<53>-Footnote-16440055
Ref: IDLE<53>-Footnote-26440120
Ref: IDLE<53>-Footnote-36440185
Ref: IDLE<53>-Footnote-46440250
Ref: IDLE<53>-Footnote-56440315
Ref: IDLE<53>-Footnote-66440380
Ref: IDLE<53>-Footnote-76440445
Ref: IDLE<53>-Footnote-86440510
Node: テスト<74>6440575
Ref: whatsnew/changelog id9426440682
Ref: 1f1c6440682
Ref: テスト<74>-Footnote-16441274
Ref: テスト<74>-Footnote-26441339
Ref: テスト<74>-Footnote-36441404
Ref: テスト<74>-Footnote-46441469
Node: Windows<74>6441534
Ref: whatsnew/changelog id9436441646
Ref: 1f1d6441646
Ref: Windows<74>-Footnote-16442022
Ref: Windows<74>-Footnote-26442087
Ref: Windows<74>-Footnote-36442152
Ref: Windows<74>-Footnote-46442194
Ref: Windows<74>-Footnote-56442259
Node: ビルド<85>6442324
Ref: whatsnew/changelog id9446442414
Ref: 1f1e6442414
Ref: ビルド<85>-Footnote-16443318
Ref: ビルド<85>-Footnote-26443383
Ref: ビルド<85>-Footnote-36443448
Ref: ビルド<85>-Footnote-46443513
Ref: ビルド<85>-Footnote-56443578
Ref: ビルド<85>-Footnote-66443643
Node: Python 3 6 0 alpha 36443708
Ref: whatsnew/changelog python-3-6-0-alpha-36443835
Ref: 1f1f6443835
Node: セキュリティ<54>6444236
Ref: whatsnew/changelog id9456444346
Ref: 1f206444346
Ref: セキュリティ<54>-Footnote-16444738
Ref: セキュリティ<54>-Footnote-26444803
Node: Core and Builtins<184>6444868
Ref: whatsnew/changelog id9466445007
Ref: 1f216445007
Ref: Core and Builtins<184>-Footnote-16445754
Ref: Core and Builtins<184>-Footnote-26445819
Ref: Core and Builtins<184>-Footnote-36445884
Ref: Core and Builtins<184>-Footnote-46445949
Node: ライブラリ<187>6446014
Ref: whatsnew/changelog id9476446139
Ref: 1f226446139
Ref: ライブラリ<187>-Footnote-16450233
Ref: ライブラリ<187>-Footnote-26450298
Ref: ライブラリ<187>-Footnote-36450363
Ref: ライブラリ<187>-Footnote-46450428
Ref: ライブラリ<187>-Footnote-56450493
Ref: ライブラリ<187>-Footnote-66450558
Ref: ライブラリ<187>-Footnote-76450623
Ref: ライブラリ<187>-Footnote-86450688
Ref: ライブラリ<187>-Footnote-96450753
Ref: ライブラリ<187>-Footnote-106450818
Ref: ライブラリ<187>-Footnote-116450884
Ref: ライブラリ<187>-Footnote-126450950
Ref: ライブラリ<187>-Footnote-136451016
Ref: ライブラリ<187>-Footnote-146451082
Ref: ライブラリ<187>-Footnote-156451148
Ref: ライブラリ<187>-Footnote-166451214
Ref: ライブラリ<187>-Footnote-176451280
Ref: ライブラリ<187>-Footnote-186451346
Ref: ライブラリ<187>-Footnote-196451412
Ref: ライブラリ<187>-Footnote-206451478
Ref: ライブラリ<187>-Footnote-216451544
Ref: ライブラリ<187>-Footnote-226451587
Ref: ライブラリ<187>-Footnote-236451653
Ref: ライブラリ<187>-Footnote-246451719
Ref: ライブラリ<187>-Footnote-256451784
Ref: ライブラリ<187>-Footnote-266451850
Node: IDLE<54>6451916
Ref: whatsnew/changelog id9486452028
Ref: 1f236452028
Ref: IDLE<54>-Footnote-16453684
Ref: IDLE<54>-Footnote-26453749
Ref: IDLE<54>-Footnote-36453814
Ref: IDLE<54>-Footnote-46453879
Ref: IDLE<54>-Footnote-56453944
Ref: IDLE<54>-Footnote-66454009
Ref: IDLE<54>-Footnote-76454074
Ref: IDLE<54>-Footnote-86454139
Ref: IDLE<54>-Footnote-96454204
Ref: IDLE<54>-Footnote-106454269
Node: C API<72>6454335
Ref: whatsnew/changelog id9496454440
Ref: 1f246454440
Ref: C API<72>-Footnote-16454680
Node: ビルド<86>6454745
Ref: whatsnew/changelog id9506454857
Ref: 1f256454857
Ref: ビルド<86>-Footnote-16455833
Ref: ビルド<86>-Footnote-26455898
Ref: ビルド<86>-Footnote-36455963
Ref: ビルド<86>-Footnote-46456028
Ref: ビルド<86>-Footnote-56456093
Node: Tools/Demos<52>6456158
Ref: whatsnew/changelog id9516456283
Ref: 1f266456283
Ref: Tools/Demos<52>-Footnote-16456567
Ref: Tools/Demos<52>-Footnote-26456632
Node: ドキュメント<75>6456697
Ref: whatsnew/changelog id9526456822
Ref: 1f276456822
Ref: ドキュメント<75>-Footnote-16457203
Ref: ドキュメント<75>-Footnote-26457268
Node: テスト<75>6457333
Ref: whatsnew/changelog id9536457434
Ref: 1f286457434
Ref: テスト<75>-Footnote-16457607
Node: Python 3 6 0 alpha 26457672
Ref: whatsnew/changelog python-3-6-0-alpha-26457799
Ref: 1f296457799
Node: セキュリティ<55>6458224
Ref: whatsnew/changelog id9546458334
Ref: 1f2a6458334
Ref: セキュリティ<55>-Footnote-16458839
Ref: セキュリティ<55>-Footnote-26458904
Ref: セキュリティ<55>-Footnote-36458959
Ref: セキュリティ<55>-Footnote-46459014
Node: Core and Builtins<185>6459079
Ref: whatsnew/changelog id9556459218
Ref: 1f2b6459218
Ref: Core and Builtins<185>-Footnote-16460850
Ref: Core and Builtins<185>-Footnote-26460915
Ref: Core and Builtins<185>-Footnote-36460980
Ref: Core and Builtins<185>-Footnote-46461045
Ref: Core and Builtins<185>-Footnote-56461110
Ref: Core and Builtins<185>-Footnote-66461175
Ref: Core and Builtins<185>-Footnote-76461217
Ref: Core and Builtins<185>-Footnote-86461282
Ref: Core and Builtins<185>-Footnote-96461347
Ref: Core and Builtins<185>-Footnote-106461412
Ref: Core and Builtins<185>-Footnote-116461478
Ref: Core and Builtins<185>-Footnote-126461544
Node: ライブラリ<188>6461610
Ref: whatsnew/changelog id9566461735
Ref: 1f2c6461735
Ref: ライブラリ<188>-Footnote-16466945
Ref: ライブラリ<188>-Footnote-26467010
Ref: ライブラリ<188>-Footnote-36467075
Ref: ライブラリ<188>-Footnote-46467140
Ref: ライブラリ<188>-Footnote-56467205
Ref: ライブラリ<188>-Footnote-66467270
Ref: ライブラリ<188>-Footnote-76467335
Ref: ライブラリ<188>-Footnote-86467400
Ref: ライブラリ<188>-Footnote-96467465
Ref: ライブラリ<188>-Footnote-106467507
Ref: ライブラリ<188>-Footnote-116467573
Ref: ライブラリ<188>-Footnote-126467639
Ref: ライブラリ<188>-Footnote-136467705
Ref: ライブラリ<188>-Footnote-146467748
Ref: ライブラリ<188>-Footnote-156467814
Ref: ライブラリ<188>-Footnote-166467857
Ref: ライブラリ<188>-Footnote-176467900
Ref: ライブラリ<188>-Footnote-186467966
Ref: ライブラリ<188>-Footnote-196468032
Ref: ライブラリ<188>-Footnote-206468098
Ref: ライブラリ<188>-Footnote-216468164
Ref: ライブラリ<188>-Footnote-226468230
Ref: ライブラリ<188>-Footnote-236468296
Ref: ライブラリ<188>-Footnote-246468362
Ref: ライブラリ<188>-Footnote-256468428
Ref: ライブラリ<188>-Footnote-266468494
Ref: ライブラリ<188>-Footnote-276468560
Ref: ライブラリ<188>-Footnote-286468626
Ref: ライブラリ<188>-Footnote-296468692
Ref: ライブラリ<188>-Footnote-306468758
Ref: ライブラリ<188>-Footnote-316468824
Ref: ライブラリ<188>-Footnote-326468890
Ref: ライブラリ<188>-Footnote-336468956
Ref: ライブラリ<188>-Footnote-346469022
Ref: ライブラリ<188>-Footnote-356469088
Node: IDLE<55>6469154
Ref: whatsnew/changelog id9576469279
Ref: 1f2d6469279
Ref: IDLE<55>-Footnote-16471918
Ref: IDLE<55>-Footnote-26471982
Ref: IDLE<55>-Footnote-36472047
Ref: IDLE<55>-Footnote-46472112
Ref: IDLE<55>-Footnote-56472177
Ref: IDLE<55>-Footnote-66472242
Ref: IDLE<55>-Footnote-76472307
Ref: IDLE<55>-Footnote-86472372
Ref: IDLE<55>-Footnote-96472437
Ref: IDLE<55>-Footnote-106472502
Ref: IDLE<55>-Footnote-116472568
Ref: IDLE<55>-Footnote-126472634
Ref: IDLE<55>-Footnote-136472700
Ref: IDLE<55>-Footnote-146472766
Ref: IDLE<55>-Footnote-156472832
Ref: IDLE<55>-Footnote-166472898
Ref: IDLE<55>-Footnote-176472964
Ref: IDLE<55>-Footnote-186473030
Ref: IDLE<55>-Footnote-196473096
Node: ドキュメント<76>6473162
Ref: whatsnew/changelog id9586473280
Ref: 1f2e6473280
Ref: ドキュメント<76>-Footnote-16473727
Ref: ドキュメント<76>-Footnote-26473792
Ref: ドキュメント<76>-Footnote-36473857
Ref: ドキュメント<76>-Footnote-46473899
Node: テスト<76>6473964
Ref: whatsnew/changelog id9596474085
Ref: 1f2f6474085
Ref: テスト<76>-Footnote-16474470
Ref: テスト<76>-Footnote-26474535
Node: Windows<75>6474600
Ref: whatsnew/changelog id9606474712
Ref: 1f306474712
Ref: Windows<75>-Footnote-16475122
Ref: Windows<75>-Footnote-26475187
Node: ビルド<87>6475252
Ref: whatsnew/changelog id9616475360
Ref: 1f316475360
Ref: ビルド<87>-Footnote-16475642
Ref: ビルド<87>-Footnote-26475707
Node: C API<73>6475772
Ref: whatsnew/changelog id9626475884
Ref: 1f326475884
Ref: C API<73>-Footnote-16476122
Ref: C API<73>-Footnote-26476187
Ref: C API<73>-Footnote-36476229
Node: Tools/Demos<53>6476294
Ref: whatsnew/changelog id9636476384
Ref: 1f336476384
Ref: Tools/Demos<53>-Footnote-16476582
Node: Python 3 6 0 alpha 16476647
Ref: whatsnew/changelog python-3-6-0-alpha-16476772
Ref: 1f346476772
Node: セキュリティ<56>6477197
Ref: whatsnew/changelog id9646477307
Ref: 1f356477307
Ref: セキュリティ<56>-Footnote-16477812
Ref: セキュリティ<56>-Footnote-26477877
Ref: セキュリティ<56>-Footnote-36477942
Node: Core and Builtins<186>6478007
Ref: whatsnew/changelog id9656478146
Ref: 1f366478146
Ref: Core and Builtins<186>-Footnote-16491293
Ref: Core and Builtins<186>-Footnote-26491358
Ref: Core and Builtins<186>-Footnote-36491423
Ref: Core and Builtins<186>-Footnote-46491488
Ref: Core and Builtins<186>-Footnote-56491553
Ref: Core and Builtins<186>-Footnote-66491618
Ref: Core and Builtins<186>-Footnote-76491683
Ref: Core and Builtins<186>-Footnote-86491748
Ref: Core and Builtins<186>-Footnote-96491813
Ref: Core and Builtins<186>-Footnote-106491878
Ref: Core and Builtins<186>-Footnote-116491944
Ref: Core and Builtins<186>-Footnote-126492010
Ref: Core and Builtins<186>-Footnote-136492076
Ref: Core and Builtins<186>-Footnote-146492142
Ref: Core and Builtins<186>-Footnote-156492208
Ref: Core and Builtins<186>-Footnote-166492274
Ref: Core and Builtins<186>-Footnote-176492317
Ref: Core and Builtins<186>-Footnote-186492383
Ref: Core and Builtins<186>-Footnote-196492449
Ref: Core and Builtins<186>-Footnote-206492515
Ref: Core and Builtins<186>-Footnote-216492581
Ref: Core and Builtins<186>-Footnote-226492647
Ref: Core and Builtins<186>-Footnote-236492713
Ref: Core and Builtins<186>-Footnote-246492756
Ref: Core and Builtins<186>-Footnote-256492822
Ref: Core and Builtins<186>-Footnote-266492888
Ref: Core and Builtins<186>-Footnote-276492954
Ref: Core and Builtins<186>-Footnote-286493020
Ref: Core and Builtins<186>-Footnote-296493086
Ref: Core and Builtins<186>-Footnote-306493152
Ref: Core and Builtins<186>-Footnote-316493218
Ref: Core and Builtins<186>-Footnote-326493284
Ref: Core and Builtins<186>-Footnote-336493350
Ref: Core and Builtins<186>-Footnote-346493416
Ref: Core and Builtins<186>-Footnote-356493482
Ref: Core and Builtins<186>-Footnote-366493548
Ref: Core and Builtins<186>-Footnote-376493613
Ref: Core and Builtins<186>-Footnote-386493679
Ref: Core and Builtins<186>-Footnote-396493745
Ref: Core and Builtins<186>-Footnote-406493811
Ref: Core and Builtins<186>-Footnote-416493877
Ref: Core and Builtins<186>-Footnote-426493943
Ref: Core and Builtins<186>-Footnote-436494009
Ref: Core and Builtins<186>-Footnote-446494075
Ref: Core and Builtins<186>-Footnote-456494141
Ref: Core and Builtins<186>-Footnote-466494207
Ref: Core and Builtins<186>-Footnote-476494273
Ref: Core and Builtins<186>-Footnote-486494339
Ref: Core and Builtins<186>-Footnote-496494405
Ref: Core and Builtins<186>-Footnote-506494471
Ref: Core and Builtins<186>-Footnote-516494537
Ref: Core and Builtins<186>-Footnote-526494603
Ref: Core and Builtins<186>-Footnote-536494668
Ref: Core and Builtins<186>-Footnote-546494734
Ref: Core and Builtins<186>-Footnote-556494800
Ref: Core and Builtins<186>-Footnote-566494866
Ref: Core and Builtins<186>-Footnote-576494932
Ref: Core and Builtins<186>-Footnote-586494998
Ref: Core and Builtins<186>-Footnote-596495064
Ref: Core and Builtins<186>-Footnote-606495130
Ref: Core and Builtins<186>-Footnote-616495196
Ref: Core and Builtins<186>-Footnote-626495262
Ref: Core and Builtins<186>-Footnote-636495328
Ref: Core and Builtins<186>-Footnote-646495394
Ref: Core and Builtins<186>-Footnote-656495460
Ref: Core and Builtins<186>-Footnote-666495526
Ref: Core and Builtins<186>-Footnote-676495592
Ref: Core and Builtins<186>-Footnote-686495658
Ref: Core and Builtins<186>-Footnote-696495724
Ref: Core and Builtins<186>-Footnote-706495790
Ref: Core and Builtins<186>-Footnote-716495856
Ref: Core and Builtins<186>-Footnote-726495922
Ref: Core and Builtins<186>-Footnote-736495988
Ref: Core and Builtins<186>-Footnote-746496054
Ref: Core and Builtins<186>-Footnote-756496120
Ref: Core and Builtins<186>-Footnote-766496186
Ref: Core and Builtins<186>-Footnote-776496252
Ref: Core and Builtins<186>-Footnote-786496318
Ref: Core and Builtins<186>-Footnote-796496383
Ref: Core and Builtins<186>-Footnote-806496449
Ref: Core and Builtins<186>-Footnote-816496492
Ref: Core and Builtins<186>-Footnote-826496558
Ref: Core and Builtins<186>-Footnote-836496624
Ref: Core and Builtins<186>-Footnote-846496690
Ref: Core and Builtins<186>-Footnote-856496756
Ref: Core and Builtins<186>-Footnote-866496822
Ref: Core and Builtins<186>-Footnote-876496888
Node: ライブラリ<189>6496954
Ref: whatsnew/changelog id9666497079
Ref: 1f386497079
Ref: ライブラリ<189>-Footnote-16528009
Ref: ライブラリ<189>-Footnote-26528074
Ref: ライブラリ<189>-Footnote-36528139
Ref: ライブラリ<189>-Footnote-46528204
Ref: ライブラリ<189>-Footnote-56528269
Ref: ライブラリ<189>-Footnote-66528334
Ref: ライブラリ<189>-Footnote-76528399
Ref: ライブラリ<189>-Footnote-86528464
Ref: ライブラリ<189>-Footnote-96528529
Ref: ライブラリ<189>-Footnote-106528594
Ref: ライブラリ<189>-Footnote-116528660
Ref: ライブラリ<189>-Footnote-126528726
Ref: ライブラリ<189>-Footnote-136528792
Ref: ライブラリ<189>-Footnote-146528858
Ref: ライブラリ<189>-Footnote-156528924
Ref: ライブラリ<189>-Footnote-166528990
Ref: ライブラリ<189>-Footnote-176529056
Ref: ライブラリ<189>-Footnote-186529122
Ref: ライブラリ<189>-Footnote-196529165
Ref: ライブラリ<189>-Footnote-206529231
Ref: ライブラリ<189>-Footnote-216529297
Ref: ライブラリ<189>-Footnote-226529363
Ref: ライブラリ<189>-Footnote-236529429
Ref: ライブラリ<189>-Footnote-246529495
Ref: ライブラリ<189>-Footnote-256529561
Ref: ライブラリ<189>-Footnote-266529627
Ref: ライブラリ<189>-Footnote-276529693
Ref: ライブラリ<189>-Footnote-286529759
Ref: ライブラリ<189>-Footnote-296529825
Ref: ライブラリ<189>-Footnote-306529891
Ref: ライブラリ<189>-Footnote-316529957
Ref: ライブラリ<189>-Footnote-326530023
Ref: ライブラリ<189>-Footnote-336530089
Ref: ライブラリ<189>-Footnote-346530155
Ref: ライブラリ<189>-Footnote-356530221
Ref: ライブラリ<189>-Footnote-366530287
Ref: ライブラリ<189>-Footnote-376530353
Ref: ライブラリ<189>-Footnote-386530419
Ref: ライブラリ<189>-Footnote-396530485
Ref: ライブラリ<189>-Footnote-406530551
Ref: ライブラリ<189>-Footnote-416530617
Ref: ライブラリ<189>-Footnote-426530683
Ref: ライブラリ<189>-Footnote-436530749
Ref: ライブラリ<189>-Footnote-446530815
Ref: ライブラリ<189>-Footnote-456530881
Ref: ライブラリ<189>-Footnote-466530947
Ref: ライブラリ<189>-Footnote-476531013
Ref: ライブラリ<189>-Footnote-486531079
Ref: ライブラリ<189>-Footnote-496531145
Ref: ライブラリ<189>-Footnote-506531211
Ref: ライブラリ<189>-Footnote-516531277
Ref: ライブラリ<189>-Footnote-526531343
Ref: ライブラリ<189>-Footnote-536531409
Ref: ライブラリ<189>-Footnote-546531475
Ref: ライブラリ<189>-Footnote-556531541
Ref: ライブラリ<189>-Footnote-566531607
Ref: ライブラリ<189>-Footnote-576531673
Ref: ライブラリ<189>-Footnote-586531739
Ref: ライブラリ<189>-Footnote-596531805
Ref: ライブラリ<189>-Footnote-606531871
Ref: ライブラリ<189>-Footnote-616531937
Ref: ライブラリ<189>-Footnote-626532003
Ref: ライブラリ<189>-Footnote-636532069
Ref: ライブラリ<189>-Footnote-646532135
Ref: ライブラリ<189>-Footnote-656532201
Ref: ライブラリ<189>-Footnote-666532267
Ref: ライブラリ<189>-Footnote-676532333
Ref: ライブラリ<189>-Footnote-686532399
Ref: ライブラリ<189>-Footnote-696532465
Ref: ライブラリ<189>-Footnote-706532531
Ref: ライブラリ<189>-Footnote-716532597
Ref: ライブラリ<189>-Footnote-726532663
Ref: ライブラリ<189>-Footnote-736532729
Ref: ライブラリ<189>-Footnote-746532795
Ref: ライブラリ<189>-Footnote-756532861
Ref: ライブラリ<189>-Footnote-766532927
Ref: ライブラリ<189>-Footnote-776532993
Ref: ライブラリ<189>-Footnote-786533059
Ref: ライブラリ<189>-Footnote-796533125
Ref: ライブラリ<189>-Footnote-806533191
Ref: ライブラリ<189>-Footnote-816533256
Ref: ライブラリ<189>-Footnote-826533322
Ref: ライブラリ<189>-Footnote-836533388
Ref: ライブラリ<189>-Footnote-846533454
Ref: ライブラリ<189>-Footnote-856533520
Ref: ライブラリ<189>-Footnote-866533586
Ref: ライブラリ<189>-Footnote-876533652
Ref: ライブラリ<189>-Footnote-886533718
Ref: ライブラリ<189>-Footnote-896533784
Ref: ライブラリ<189>-Footnote-906533850
Ref: ライブラリ<189>-Footnote-916533916
Ref: ライブラリ<189>-Footnote-926533982
Ref: ライブラリ<189>-Footnote-936534048
Ref: ライブラリ<189>-Footnote-946534114
Ref: ライブラリ<189>-Footnote-956534180
Ref: ライブラリ<189>-Footnote-966534246
Ref: ライブラリ<189>-Footnote-976534312
Ref: ライブラリ<189>-Footnote-986534378
Ref: ライブラリ<189>-Footnote-996534444
Ref: ライブラリ<189>-Footnote-1006534510
Ref: ライブラリ<189>-Footnote-1016534577
Ref: ライブラリ<189>-Footnote-1026534644
Ref: ライブラリ<189>-Footnote-1036534711
Ref: ライブラリ<189>-Footnote-1046534778
Ref: ライブラリ<189>-Footnote-1056534845
Ref: ライブラリ<189>-Footnote-1066534912
Ref: ライブラリ<189>-Footnote-1076534979
Ref: ライブラリ<189>-Footnote-1086535046
Ref: ライブラリ<189>-Footnote-1096535113
Ref: ライブラリ<189>-Footnote-1106535180
Ref: ライブラリ<189>-Footnote-1116535247
Ref: ライブラリ<189>-Footnote-1126535314
Ref: ライブラリ<189>-Footnote-1136535381
Ref: ライブラリ<189>-Footnote-1146535448
Ref: ライブラリ<189>-Footnote-1156535515
Ref: ライブラリ<189>-Footnote-1166535582
Ref: ライブラリ<189>-Footnote-1176535649
Ref: ライブラリ<189>-Footnote-1186535716
Ref: ライブラリ<189>-Footnote-1196535783
Ref: ライブラリ<189>-Footnote-1206535850
Ref: ライブラリ<189>-Footnote-1216535917
Ref: ライブラリ<189>-Footnote-1226535984
Ref: ライブラリ<189>-Footnote-1236536051
Ref: ライブラリ<189>-Footnote-1246536118
Ref: ライブラリ<189>-Footnote-1256536185
Ref: ライブラリ<189>-Footnote-1266536252
Ref: ライブラリ<189>-Footnote-1276536319
Ref: ライブラリ<189>-Footnote-1286536386
Ref: ライブラリ<189>-Footnote-1296536453
Ref: ライブラリ<189>-Footnote-1306536520
Ref: ライブラリ<189>-Footnote-1316536587
Ref: ライブラリ<189>-Footnote-1326536654
Ref: ライブラリ<189>-Footnote-1336536721
Ref: ライブラリ<189>-Footnote-1346536788
Ref: ライブラリ<189>-Footnote-1356536855
Ref: ライブラリ<189>-Footnote-1366536922
Ref: ライブラリ<189>-Footnote-1376536989
Ref: ライブラリ<189>-Footnote-1386537056
Ref: ライブラリ<189>-Footnote-1396537123
Ref: ライブラリ<189>-Footnote-1406537190
Ref: ライブラリ<189>-Footnote-1416537257
Ref: ライブラリ<189>-Footnote-1426537324
Ref: ライブラリ<189>-Footnote-1436537391
Ref: ライブラリ<189>-Footnote-1446537458
Ref: ライブラリ<189>-Footnote-1456537524
Ref: ライブラリ<189>-Footnote-1466537591
Ref: ライブラリ<189>-Footnote-1476537658
Ref: ライブラリ<189>-Footnote-1486537725
Ref: ライブラリ<189>-Footnote-1496537792
Ref: ライブラリ<189>-Footnote-1506537859
Ref: ライブラリ<189>-Footnote-1516537925
Ref: ライブラリ<189>-Footnote-1526537992
Ref: ライブラリ<189>-Footnote-1536538059
Ref: ライブラリ<189>-Footnote-1546538126
Ref: ライブラリ<189>-Footnote-1556538193
Ref: ライブラリ<189>-Footnote-1566538260
Ref: ライブラリ<189>-Footnote-1576538327
Ref: ライブラリ<189>-Footnote-1586538394
Ref: ライブラリ<189>-Footnote-1596538461
Ref: ライブラリ<189>-Footnote-1606538528
Ref: ライブラリ<189>-Footnote-1616538594
Ref: ライブラリ<189>-Footnote-1626538661
Ref: ライブラリ<189>-Footnote-1636538728
Ref: ライブラリ<189>-Footnote-1646538795
Ref: ライブラリ<189>-Footnote-1656538862
Ref: ライブラリ<189>-Footnote-1666538929
Ref: ライブラリ<189>-Footnote-1676538996
Ref: ライブラリ<189>-Footnote-1686539063
Ref: ライブラリ<189>-Footnote-1696539130
Ref: ライブラリ<189>-Footnote-1706539197
Ref: ライブラリ<189>-Footnote-1716539264
Ref: ライブラリ<189>-Footnote-1726539331
Ref: ライブラリ<189>-Footnote-1736539398
Ref: ライブラリ<189>-Footnote-1746539465
Ref: ライブラリ<189>-Footnote-1756539532
Ref: ライブラリ<189>-Footnote-1766539599
Ref: ライブラリ<189>-Footnote-1776539666
Ref: ライブラリ<189>-Footnote-1786539733
Ref: ライブラリ<189>-Footnote-1796539800
Ref: ライブラリ<189>-Footnote-1806539867
Ref: ライブラリ<189>-Footnote-1816539934
Ref: ライブラリ<189>-Footnote-1826540001
Ref: ライブラリ<189>-Footnote-1836540068
Ref: ライブラリ<189>-Footnote-1846540135
Ref: ライブラリ<189>-Footnote-1856540202
Ref: ライブラリ<189>-Footnote-1866540269
Ref: ライブラリ<189>-Footnote-1876540336
Ref: ライブラリ<189>-Footnote-1886540403
Ref: ライブラリ<189>-Footnote-1896540470
Ref: ライブラリ<189>-Footnote-1906540537
Ref: ライブラリ<189>-Footnote-1916540604
Ref: ライブラリ<189>-Footnote-1926540671
Ref: ライブラリ<189>-Footnote-1936540738
Ref: ライブラリ<189>-Footnote-1946540805
Ref: ライブラリ<189>-Footnote-1956540872
Ref: ライブラリ<189>-Footnote-1966540939
Ref: ライブラリ<189>-Footnote-1976541006
Ref: ライブラリ<189>-Footnote-1986541073
Ref: ライブラリ<189>-Footnote-1996541140
Ref: ライブラリ<189>-Footnote-2006541207
Ref: ライブラリ<189>-Footnote-2016541274
Ref: ライブラリ<189>-Footnote-2026541341
Ref: ライブラリ<189>-Footnote-2036541408
Ref: ライブラリ<189>-Footnote-2046541475
Ref: ライブラリ<189>-Footnote-2056541542
Ref: ライブラリ<189>-Footnote-2066541609
Ref: ライブラリ<189>-Footnote-2076541676
Ref: ライブラリ<189>-Footnote-2086541743
Ref: ライブラリ<189>-Footnote-2096541809
Ref: ライブラリ<189>-Footnote-2106541875
Ref: ライブラリ<189>-Footnote-2116541942
Ref: ライブラリ<189>-Footnote-2126542009
Ref: ライブラリ<189>-Footnote-2136542076
Ref: ライブラリ<189>-Footnote-2146542143
Ref: ライブラリ<189>-Footnote-2156542210
Ref: ライブラリ<189>-Footnote-2166542277
Ref: ライブラリ<189>-Footnote-2176542344
Ref: ライブラリ<189>-Footnote-2186542411
Ref: ライブラリ<189>-Footnote-2196542478
Ref: ライブラリ<189>-Footnote-2206542545
Ref: ライブラリ<189>-Footnote-2216542612
Ref: ライブラリ<189>-Footnote-2226542679
Ref: ライブラリ<189>-Footnote-2236542746
Ref: ライブラリ<189>-Footnote-2246542813
Node: IDLE<56>6542880
Ref: whatsnew/changelog id9676543005
Ref: 1f3a6543005
Ref: IDLE<56>-Footnote-16548536
Ref: IDLE<56>-Footnote-26548601
Ref: IDLE<56>-Footnote-36548666
Ref: IDLE<56>-Footnote-46548731
Ref: IDLE<56>-Footnote-56548796
Ref: IDLE<56>-Footnote-66548861
Ref: IDLE<56>-Footnote-76548926
Ref: IDLE<56>-Footnote-86548991
Ref: IDLE<56>-Footnote-96549056
Ref: IDLE<56>-Footnote-106549121
Ref: IDLE<56>-Footnote-116549187
Ref: IDLE<56>-Footnote-126549253
Ref: IDLE<56>-Footnote-136549319
Ref: IDLE<56>-Footnote-146549385
Ref: IDLE<56>-Footnote-156549451
Ref: IDLE<56>-Footnote-166549517
Ref: IDLE<56>-Footnote-176549583
Ref: IDLE<56>-Footnote-186549649
Ref: IDLE<56>-Footnote-196549715
Ref: IDLE<56>-Footnote-206549781
Ref: IDLE<56>-Footnote-216549847
Ref: IDLE<56>-Footnote-226549913
Ref: IDLE<56>-Footnote-236549979
Ref: IDLE<56>-Footnote-246550045
Ref: IDLE<56>-Footnote-256550111
Ref: IDLE<56>-Footnote-266550177
Ref: IDLE<56>-Footnote-276550243
Ref: IDLE<56>-Footnote-286550309
Node: ドキュメント<77>6550375
Ref: whatsnew/changelog id9686550493
Ref: 1f3b6550493
Ref: ドキュメント<77>-Footnote-16551281
Ref: ドキュメント<77>-Footnote-26551346
Ref: ドキュメント<77>-Footnote-36551410
Ref: ドキュメント<77>-Footnote-46551475
Ref: ドキュメント<77>-Footnote-56551540
Node: テスト<77>6551605
Ref: whatsnew/changelog id9696551728
Ref: 1f3c6551728
Ref: テスト<77>-Footnote-16553476
Ref: テスト<77>-Footnote-26553541
Ref: テスト<77>-Footnote-36553606
Ref: テスト<77>-Footnote-46553671
Ref: テスト<77>-Footnote-56553736
Ref: テスト<77>-Footnote-66553801
Ref: テスト<77>-Footnote-76553866
Ref: テスト<77>-Footnote-86553931
Ref: テスト<77>-Footnote-96553996
Ref: テスト<77>-Footnote-106554061
Ref: テスト<77>-Footnote-116554127
Ref: テスト<77>-Footnote-126554193
Ref: テスト<77>-Footnote-136554259
Node: ビルド<88>6554325
Ref: whatsnew/changelog id9706554437
Ref: 1f3d6554437
Ref: ビルド<88>-Footnote-16557166
Ref: ビルド<88>-Footnote-26557231
Ref: ビルド<88>-Footnote-36557296
Ref: ビルド<88>-Footnote-46557361
Ref: ビルド<88>-Footnote-56557426
Ref: ビルド<88>-Footnote-66557491
Ref: ビルド<88>-Footnote-76557556
Ref: ビルド<88>-Footnote-86557621
Ref: ビルド<88>-Footnote-96557686
Ref: ビルド<88>-Footnote-106557751
Ref: ビルド<88>-Footnote-116557817
Ref: ビルド<88>-Footnote-126557883
Ref: ビルド<88>-Footnote-136557949
Ref: ビルド<88>-Footnote-146558015
Ref: ビルド<88>-Footnote-156558081
Ref: ビルド<88>-Footnote-166558147
Ref: ビルド<88>-Footnote-176558213
Ref: ビルド<88>-Footnote-186558279
Ref: ビルド<88>-Footnote-196558345
Node: Windows<76>6558411
Ref: whatsnew/changelog id9716558525
Ref: 1f3e6558525
Ref: Windows<76>-Footnote-16559171
Ref: Windows<76>-Footnote-26559236
Ref: Windows<76>-Footnote-36559301
Ref: Windows<76>-Footnote-46559366
Ref: Windows<76>-Footnote-56559431
Ref: Windows<76>-Footnote-66559496
Node: Tools/Demos<54>6559561
Ref: whatsnew/changelog id9726559671
Ref: 1f3f6559671
Ref: Tools/Demos<54>-Footnote-16560457
Ref: Tools/Demos<54>-Footnote-26560522
Ref: Tools/Demos<54>-Footnote-36560587
Ref: Tools/Demos<54>-Footnote-46560652
Ref: Tools/Demos<54>-Footnote-56560717
Ref: Tools/Demos<54>-Footnote-66560782
Node: C API<74>6560847
Ref: whatsnew/changelog id9736560937
Ref: 1f406560937
Ref: C API<74>-Footnote-16561426
Ref: C API<74>-Footnote-26561491
Node: Python 3 5 5 final6561556
Ref: whatsnew/changelog python-3-5-5-final6561693
Ref: 1f416561693
Node: Python 3 5 5 release candidate 16561821
Ref: whatsnew/changelog python-3-5-5-release-candidate-16561956
Ref: 1f426561956
Node: セキュリティ<57>6562209
Ref: whatsnew/changelog id9746562331
Ref: 1f436562331
Ref: セキュリティ<57>-Footnote-16563614
Ref: セキュリティ<57>-Footnote-26563679
Ref: セキュリティ<57>-Footnote-36563744
Ref: セキュリティ<57>-Footnote-46563809
Ref: セキュリティ<57>-Footnote-56563874
Ref: セキュリティ<57>-Footnote-66563932
Node: Core and Builtins<187>6563997
Ref: whatsnew/changelog id9756564148
Ref: 1f446564148
Ref: Core and Builtins<187>-Footnote-16564371
Node: ライブラリ<190>6564436
Ref: whatsnew/changelog id9766564556
Ref: 1f456564556
Ref: ライブラリ<190>-Footnote-16565094
Ref: ライブラリ<190>-Footnote-26565159
Node: Python 3 5 4 final6565224
Ref: whatsnew/changelog python-3-5-4-final6565373
Ref: 1f466565373
Node: ライブラリ<191>6565509
Ref: whatsnew/changelog id9776565584
Ref: 1f476565584
Ref: ライブラリ<191>-Footnote-16565795
Node: Python 3 5 4 release candidate 16565860
Ref: whatsnew/changelog python-3-5-4-release-candidate-16565995
Ref: 1f486565995
Node: セキュリティ<58>6566396
Ref: whatsnew/changelog id9786566518
Ref: 1f496566518
Ref: セキュリティ<58>-Footnote-16567856
Ref: セキュリティ<58>-Footnote-26567921
Ref: セキュリティ<58>-Footnote-36567986
Ref: セキュリティ<58>-Footnote-46568041
Ref: セキュリティ<58>-Footnote-56568096
Ref: セキュリティ<58>-Footnote-66568151
Ref: セキュリティ<58>-Footnote-76568206
Ref: セキュリティ<58>-Footnote-86568261
Ref: セキュリティ<58>-Footnote-96568316
Ref: セキュリティ<58>-Footnote-106568381
Ref: セキュリティ<58>-Footnote-116568447
Ref: セキュリティ<58>-Footnote-126568503
Node: Core and Builtins<188>6568559
Ref: whatsnew/changelog id9796568710
Ref: 1f4a6568710
Ref: Core and Builtins<188>-Footnote-16570967
Ref: Core and Builtins<188>-Footnote-26571032
Ref: Core and Builtins<188>-Footnote-36571097
Ref: Core and Builtins<188>-Footnote-46571162
Ref: Core and Builtins<188>-Footnote-56571227
Ref: Core and Builtins<188>-Footnote-66571292
Ref: Core and Builtins<188>-Footnote-76571357
Ref: Core and Builtins<188>-Footnote-86571422
Ref: Core and Builtins<188>-Footnote-96571487
Ref: Core and Builtins<188>-Footnote-106571552
Ref: Core and Builtins<188>-Footnote-116571618
Ref: Core and Builtins<188>-Footnote-126571684
Ref: Core and Builtins<188>-Footnote-136571750
Ref: Core and Builtins<188>-Footnote-146571816
Ref: Core and Builtins<188>-Footnote-156571882
Node: ライブラリ<192>6571948
Ref: whatsnew/changelog id9806572099
Ref: 1f4b6572099
Ref: ライブラリ<192>-Footnote-16582273
Ref: ライブラリ<192>-Footnote-26582338
Ref: ライブラリ<192>-Footnote-36582403
Ref: ライブラリ<192>-Footnote-46582468
Ref: ライブラリ<192>-Footnote-56582533
Ref: ライブラリ<192>-Footnote-66582598
Ref: ライブラリ<192>-Footnote-76582663
Ref: ライブラリ<192>-Footnote-86582728
Ref: ライブラリ<192>-Footnote-96582793
Ref: ライブラリ<192>-Footnote-106582858
Ref: ライブラリ<192>-Footnote-116582924
Ref: ライブラリ<192>-Footnote-126582990
Ref: ライブラリ<192>-Footnote-136583056
Ref: ライブラリ<192>-Footnote-146583122
Ref: ライブラリ<192>-Footnote-156583188
Ref: ライブラリ<192>-Footnote-166583254
Ref: ライブラリ<192>-Footnote-176583320
Ref: ライブラリ<192>-Footnote-186583386
Ref: ライブラリ<192>-Footnote-196583452
Ref: ライブラリ<192>-Footnote-206583518
Ref: ライブラリ<192>-Footnote-216583584
Ref: ライブラリ<192>-Footnote-226583650
Ref: ライブラリ<192>-Footnote-236583716
Ref: ライブラリ<192>-Footnote-246583782
Ref: ライブラリ<192>-Footnote-256583848
Ref: ライブラリ<192>-Footnote-266583914
Ref: ライブラリ<192>-Footnote-276583980
Ref: ライブラリ<192>-Footnote-286584046
Ref: ライブラリ<192>-Footnote-296584112
Ref: ライブラリ<192>-Footnote-306584178
Ref: ライブラリ<192>-Footnote-316584244
Ref: ライブラリ<192>-Footnote-326584310
Ref: ライブラリ<192>-Footnote-336584376
Ref: ライブラリ<192>-Footnote-346584442
Ref: ライブラリ<192>-Footnote-356584508
Ref: ライブラリ<192>-Footnote-366584574
Ref: ライブラリ<192>-Footnote-376584640
Ref: ライブラリ<192>-Footnote-386584706
Ref: ライブラリ<192>-Footnote-396584772
Ref: ライブラリ<192>-Footnote-406584838
Ref: ライブラリ<192>-Footnote-416584904
Ref: ライブラリ<192>-Footnote-426584970
Ref: ライブラリ<192>-Footnote-436585036
Ref: ライブラリ<192>-Footnote-446585102
Ref: ライブラリ<192>-Footnote-456585168
Ref: ライブラリ<192>-Footnote-466585234
Ref: ライブラリ<192>-Footnote-476585300
Ref: ライブラリ<192>-Footnote-486585366
Ref: ライブラリ<192>-Footnote-496585432
Ref: ライブラリ<192>-Footnote-506585498
Ref: ライブラリ<192>-Footnote-516585564
Ref: ライブラリ<192>-Footnote-526585630
Ref: ライブラリ<192>-Footnote-536585696
Ref: ライブラリ<192>-Footnote-546585762
Ref: ライブラリ<192>-Footnote-556585827
Ref: ライブラリ<192>-Footnote-566585893
Ref: ライブラリ<192>-Footnote-576585959
Ref: ライブラリ<192>-Footnote-586586025
Ref: ライブラリ<192>-Footnote-596586091
Ref: ライブラリ<192>-Footnote-606586157
Ref: ライブラリ<192>-Footnote-616586223
Ref: ライブラリ<192>-Footnote-626586289
Ref: ライブラリ<192>-Footnote-636586355
Ref: ライブラリ<192>-Footnote-646586421
Ref: ライブラリ<192>-Footnote-656586487
Ref: ライブラリ<192>-Footnote-666586553
Ref: ライブラリ<192>-Footnote-676586619
Ref: ライブラリ<192>-Footnote-686586685
Ref: ライブラリ<192>-Footnote-696586751
Ref: ライブラリ<192>-Footnote-706586817
Ref: ライブラリ<192>-Footnote-716586883
Ref: ライブラリ<192>-Footnote-726586949
Ref: ライブラリ<192>-Footnote-736587015
Ref: ライブラリ<192>-Footnote-746587081
Node: ドキュメント<78>6587147
Ref: whatsnew/changelog id9816587289
Ref: 1f4c6587289
Ref: ドキュメント<78>-Footnote-16588005
Ref: ドキュメント<78>-Footnote-26588070
Ref: ドキュメント<78>-Footnote-36588135
Ref: ドキュメント<78>-Footnote-46588200
Ref: ドキュメント<78>-Footnote-56588265
Ref: ドキュメント<78>-Footnote-66588330
Node: テスト<78>6588395
Ref: whatsnew/changelog id9826588530
Ref: 1f4d6588530
Ref: テスト<78>-Footnote-16590614
Ref: テスト<78>-Footnote-26590679
Ref: テスト<78>-Footnote-36590744
Ref: テスト<78>-Footnote-46590809
Ref: テスト<78>-Footnote-56590874
Ref: テスト<78>-Footnote-66590939
Ref: テスト<78>-Footnote-76591004
Ref: テスト<78>-Footnote-86591069
Ref: テスト<78>-Footnote-96591134
Node: ビルド<89>6591199
Ref: whatsnew/changelog id9836591323
Ref: 1f4e6591323
Ref: ビルド<89>-Footnote-16591842
Ref: ビルド<89>-Footnote-26591907
Ref: ビルド<89>-Footnote-36591972
Node: Windows<77>6592037
Ref: whatsnew/changelog id9846592157
Ref: 1f4f6592157
Ref: Windows<77>-Footnote-16592417
Ref: Windows<77>-Footnote-26592482
Node: C API<75>6592547
Ref: whatsnew/changelog id9856592645
Ref: 1f506592645
Ref: C API<75>-Footnote-16593254
Ref: C API<75>-Footnote-26593319
Node: Python 3 5 3 final6593384
Ref: whatsnew/changelog python-3-5-3-final6593533
Ref: 1f516593533
Node: Python 3 5 3 release candidate 16593680
Ref: whatsnew/changelog python-3-5-3-release-candidate-16593815
Ref: 1f526593815
Node: セキュリティ<59>6594266
Ref: whatsnew/changelog id9866594388
Ref: 1f536594388
Ref: セキュリティ<59>-Footnote-16594782
Ref: セキュリティ<59>-Footnote-26594847
Node: Core and Builtins<189>6594912
Ref: whatsnew/changelog id9876595063
Ref: 1f546595063
Ref: Core and Builtins<189>-Footnote-16600495
Ref: Core and Builtins<189>-Footnote-26600560
Ref: Core and Builtins<189>-Footnote-36600625
Ref: Core and Builtins<189>-Footnote-46600690
Ref: Core and Builtins<189>-Footnote-56600755
Ref: Core and Builtins<189>-Footnote-66600820
Ref: Core and Builtins<189>-Footnote-76600885
Ref: Core and Builtins<189>-Footnote-86600950
Ref: Core and Builtins<189>-Footnote-96601015
Ref: Core and Builtins<189>-Footnote-106601080
Ref: Core and Builtins<189>-Footnote-116601146
Ref: Core and Builtins<189>-Footnote-126601212
Ref: Core and Builtins<189>-Footnote-136601278
Ref: Core and Builtins<189>-Footnote-146601344
Ref: Core and Builtins<189>-Footnote-156601410
Ref: Core and Builtins<189>-Footnote-166601476
Ref: Core and Builtins<189>-Footnote-176601542
Ref: Core and Builtins<189>-Footnote-186601608
Ref: Core and Builtins<189>-Footnote-196601674
Ref: Core and Builtins<189>-Footnote-206601740
Ref: Core and Builtins<189>-Footnote-216601806
Ref: Core and Builtins<189>-Footnote-226601872
Ref: Core and Builtins<189>-Footnote-236601938
Ref: Core and Builtins<189>-Footnote-246602004
Ref: Core and Builtins<189>-Footnote-256602070
Ref: Core and Builtins<189>-Footnote-266602136
Ref: Core and Builtins<189>-Footnote-276602202
Ref: Core and Builtins<189>-Footnote-286602268
Ref: Core and Builtins<189>-Footnote-296602334
Ref: Core and Builtins<189>-Footnote-306602400
Ref: Core and Builtins<189>-Footnote-316602466
Ref: Core and Builtins<189>-Footnote-326602532
Ref: Core and Builtins<189>-Footnote-336602598
Ref: Core and Builtins<189>-Footnote-346602664
Ref: Core and Builtins<189>-Footnote-356602730
Ref: Core and Builtins<189>-Footnote-366602796
Ref: Core and Builtins<189>-Footnote-376602862
Ref: Core and Builtins<189>-Footnote-386602928
Ref: Core and Builtins<189>-Footnote-396602994
Ref: Core and Builtins<189>-Footnote-406603060
Ref: Core and Builtins<189>-Footnote-416603126
Ref: Core and Builtins<189>-Footnote-426603192
Ref: Core and Builtins<189>-Footnote-436603258
Node: ライブラリ<193>6603324
Ref: whatsnew/changelog id9886603461
Ref: 1f556603461
Ref: ライブラリ<193>-Footnote-16619404
Ref: ライブラリ<193>-Footnote-26619469
Ref: ライブラリ<193>-Footnote-36619534
Ref: ライブラリ<193>-Footnote-46619599
Ref: ライブラリ<193>-Footnote-56619664
Ref: ライブラリ<193>-Footnote-66619728
Ref: ライブラリ<193>-Footnote-76619793
Ref: ライブラリ<193>-Footnote-86619858
Ref: ライブラリ<193>-Footnote-96619923
Ref: ライブラリ<193>-Footnote-106619988
Ref: ライブラリ<193>-Footnote-116620054
Ref: ライブラリ<193>-Footnote-126620120
Ref: ライブラリ<193>-Footnote-136620186
Ref: ライブラリ<193>-Footnote-146620252
Ref: ライブラリ<193>-Footnote-156620318
Ref: ライブラリ<193>-Footnote-166620384
Ref: ライブラリ<193>-Footnote-176620450
Ref: ライブラリ<193>-Footnote-186620516
Ref: ライブラリ<193>-Footnote-196620582
Ref: ライブラリ<193>-Footnote-206620648
Ref: ライブラリ<193>-Footnote-216620714
Ref: ライブラリ<193>-Footnote-226620780
Ref: ライブラリ<193>-Footnote-236620846
Ref: ライブラリ<193>-Footnote-246620912
Ref: ライブラリ<193>-Footnote-256620978
Ref: ライブラリ<193>-Footnote-266621044
Ref: ライブラリ<193>-Footnote-276621110
Ref: ライブラリ<193>-Footnote-286621176
Ref: ライブラリ<193>-Footnote-296621242
Ref: ライブラリ<193>-Footnote-306621308
Ref: ライブラリ<193>-Footnote-316621374
Ref: ライブラリ<193>-Footnote-326621440
Ref: ライブラリ<193>-Footnote-336621508
Ref: ライブラリ<193>-Footnote-346621574
Ref: ライブラリ<193>-Footnote-356621640
Ref: ライブラリ<193>-Footnote-366621706
Ref: ライブラリ<193>-Footnote-376621772
Ref: ライブラリ<193>-Footnote-386621838
Ref: ライブラリ<193>-Footnote-396621904
Ref: ライブラリ<193>-Footnote-406621970
Ref: ライブラリ<193>-Footnote-416622036
Ref: ライブラリ<193>-Footnote-426622102
Ref: ライブラリ<193>-Footnote-436622168
Ref: ライブラリ<193>-Footnote-446622234
Ref: ライブラリ<193>-Footnote-456622300
Ref: ライブラリ<193>-Footnote-466622366
Ref: ライブラリ<193>-Footnote-476622432
Ref: ライブラリ<193>-Footnote-486622498
Ref: ライブラリ<193>-Footnote-496622564
Ref: ライブラリ<193>-Footnote-506622630
Ref: ライブラリ<193>-Footnote-516622696
Ref: ライブラリ<193>-Footnote-526622762
Ref: ライブラリ<193>-Footnote-536622828
Ref: ライブラリ<193>-Footnote-546622894
Ref: ライブラリ<193>-Footnote-556622960
Ref: ライブラリ<193>-Footnote-566623026
Ref: ライブラリ<193>-Footnote-576623092
Ref: ライブラリ<193>-Footnote-586623158
Ref: ライブラリ<193>-Footnote-596623224
Ref: ライブラリ<193>-Footnote-606623290
Ref: ライブラリ<193>-Footnote-616623346
Ref: ライブラリ<193>-Footnote-626623412
Ref: ライブラリ<193>-Footnote-636623478
Ref: ライブラリ<193>-Footnote-646623544
Ref: ライブラリ<193>-Footnote-656623610
Ref: ライブラリ<193>-Footnote-666623676
Ref: ライブラリ<193>-Footnote-676623742
Ref: ライブラリ<193>-Footnote-686623808
Ref: ライブラリ<193>-Footnote-696623874
Ref: ライブラリ<193>-Footnote-706623940
Ref: ライブラリ<193>-Footnote-716624006
Ref: ライブラリ<193>-Footnote-726624072
Ref: ライブラリ<193>-Footnote-736624137
Ref: ライブラリ<193>-Footnote-746624203
Ref: ライブラリ<193>-Footnote-756624269
Ref: ライブラリ<193>-Footnote-766624335
Ref: ライブラリ<193>-Footnote-776624401
Ref: ライブラリ<193>-Footnote-786624467
Ref: ライブラリ<193>-Footnote-796624533
Ref: ライブラリ<193>-Footnote-806624599
Ref: ライブラリ<193>-Footnote-816624658
Ref: ライブラリ<193>-Footnote-826624724
Ref: ライブラリ<193>-Footnote-836624790
Ref: ライブラリ<193>-Footnote-846624856
Ref: ライブラリ<193>-Footnote-856624922
Ref: ライブラリ<193>-Footnote-866624988
Ref: ライブラリ<193>-Footnote-876625054
Ref: ライブラリ<193>-Footnote-886625120
Ref: ライブラリ<193>-Footnote-896625186
Ref: ライブラリ<193>-Footnote-906625252
Ref: ライブラリ<193>-Footnote-916625318
Ref: ライブラリ<193>-Footnote-926625384
Ref: ライブラリ<193>-Footnote-936625450
Ref: ライブラリ<193>-Footnote-946625516
Ref: ライブラリ<193>-Footnote-956625582
Ref: ライブラリ<193>-Footnote-966625648
Ref: ライブラリ<193>-Footnote-976625714
Ref: ライブラリ<193>-Footnote-986625757
Ref: ライブラリ<193>-Footnote-996625823
Ref: ライブラリ<193>-Footnote-1006625889
Ref: ライブラリ<193>-Footnote-1016625956
Ref: ライブラリ<193>-Footnote-1026626023
Ref: ライブラリ<193>-Footnote-1036626090
Ref: ライブラリ<193>-Footnote-1046626157
Ref: ライブラリ<193>-Footnote-1056626224
Ref: ライブラリ<193>-Footnote-1066626291
Ref: ライブラリ<193>-Footnote-1076626358
Ref: ライブラリ<193>-Footnote-1086626425
Ref: ライブラリ<193>-Footnote-1096626492
Ref: ライブラリ<193>-Footnote-1106626559
Ref: ライブラリ<193>-Footnote-1116626626
Ref: ライブラリ<193>-Footnote-1126626693
Ref: ライブラリ<193>-Footnote-1136626760
Ref: ライブラリ<193>-Footnote-1146626827
Ref: ライブラリ<193>-Footnote-1156626894
Ref: ライブラリ<193>-Footnote-1166626961
Ref: ライブラリ<193>-Footnote-1176627028
Ref: ライブラリ<193>-Footnote-1186627095
Ref: ライブラリ<193>-Footnote-1196627162
Ref: ライブラリ<193>-Footnote-1206627229
Ref: ライブラリ<193>-Footnote-1216627296
Ref: ライブラリ<193>-Footnote-1226627363
Ref: ライブラリ<193>-Footnote-1236627430
Ref: ライブラリ<193>-Footnote-1246627497
Ref: ライブラリ<193>-Footnote-1256627564
Ref: ライブラリ<193>-Footnote-1266627631
Node: IDLE<57>6627698
Ref: whatsnew/changelog id9896627822
Ref: 1f566627822
Ref: IDLE<57>-Footnote-16629063
Ref: IDLE<57>-Footnote-26629128
Ref: IDLE<57>-Footnote-36629193
Ref: IDLE<57>-Footnote-46629258
Ref: IDLE<57>-Footnote-56629323
Ref: IDLE<57>-Footnote-66629388
Ref: IDLE<57>-Footnote-76629453
Ref: IDLE<57>-Footnote-86629518
Node: C API<76>6629583
Ref: whatsnew/changelog id9906629709
Ref: 1f576629709
Ref: C API<76>-Footnote-16630041
Ref: C API<76>-Footnote-26630106
Node: ドキュメント<79>6630171
Ref: whatsnew/changelog id9916630302
Ref: 1f586630302
Ref: ドキュメント<79>-Footnote-16630459
Node: テスト<79>6630524
Ref: whatsnew/changelog id9926630661
Ref: 1f596630661
Ref: テスト<79>-Footnote-16631355
Ref: テスト<79>-Footnote-26631420
Ref: テスト<79>-Footnote-36631485
Ref: テスト<79>-Footnote-46631550
Ref: テスト<79>-Footnote-56631615
Ref: テスト<79>-Footnote-66631680
Node: Tools/Demos<55>6631745
Ref: whatsnew/changelog id9936631871
Ref: 1f5a6631871
Ref: Tools/Demos<55>-Footnote-16632351
Ref: Tools/Demos<55>-Footnote-26632416
Ref: Tools/Demos<55>-Footnote-36632481
Node: Windows<78>6632546
Ref: whatsnew/changelog id9946632672
Ref: 1f5b6632672
Ref: Windows<78>-Footnote-16633174
Ref: Windows<78>-Footnote-26633239
Ref: Windows<78>-Footnote-36633304
Ref: Windows<78>-Footnote-46633369
Ref: Windows<78>-Footnote-56633434
Node: ビルド<90>6633499
Ref: whatsnew/changelog id9956633601
Ref: 1f5c6633601
Ref: ビルド<90>-Footnote-16636301
Ref: ビルド<90>-Footnote-26636366
Ref: ビルド<90>-Footnote-36636431
Ref: ビルド<90>-Footnote-46636496
Ref: ビルド<90>-Footnote-56636561
Ref: ビルド<90>-Footnote-66636626
Ref: ビルド<90>-Footnote-76636691
Ref: ビルド<90>-Footnote-86636756
Ref: ビルド<90>-Footnote-96636821
Ref: ビルド<90>-Footnote-106636886
Ref: ビルド<90>-Footnote-116636952
Ref: ビルド<90>-Footnote-126637018
Ref: ビルド<90>-Footnote-136637084
Ref: ビルド<90>-Footnote-146637150
Ref: ビルド<90>-Footnote-156637216
Ref: ビルド<90>-Footnote-166637282
Ref: ビルド<90>-Footnote-176637348
Ref: ビルド<90>-Footnote-186637414
Ref: ビルド<90>-Footnote-196637480
Ref: ビルド<90>-Footnote-206637546
Ref: ビルド<90>-Footnote-216637612
Ref: ビルド<90>-Footnote-226637678
Node: Python 3 5 2 final6637744
Ref: whatsnew/changelog python-3-5-2-final6637893
Ref: 1f5d6637893
Node: Core and Builtins<190>6638079
Ref: whatsnew/changelog id9966638178
Ref: 1f5e6638178
Ref: Core and Builtins<190>-Footnote-16638338
Node: テスト<80>6638403
Ref: whatsnew/changelog id9976638519
Ref: 1f5f6638519
Ref: テスト<80>-Footnote-16638684
Node: IDLE<58>6638749
Ref: whatsnew/changelog id9986638834
Ref: 1f606638834
Ref: IDLE<58>-Footnote-16638990
Node: Python 3 5 2 release candidate 16639055
Ref: whatsnew/changelog python-3-5-2-release-candidate-16639190
Ref: 1f616639190
Node: セキュリティ<60>6639621
Ref: whatsnew/changelog id9996639743
Ref: 1f626639743
Ref: セキュリティ<60>-Footnote-16640666
Ref: セキュリティ<60>-Footnote-26640731
Ref: セキュリティ<60>-Footnote-36640786
Ref: セキュリティ<60>-Footnote-46640841
Ref: セキュリティ<60>-Footnote-56640906
Ref: セキュリティ<60>-Footnote-66640971
Ref: セキュリティ<60>-Footnote-76641036
Node: Core and Builtins<191>6641101
Ref: whatsnew/changelog id10006641252
Ref: 1f636641252
Ref: Core and Builtins<191>-Footnote-16647093
Ref: Core and Builtins<191>-Footnote-26647158
Ref: Core and Builtins<191>-Footnote-36647223
Ref: Core and Builtins<191>-Footnote-46647288
Ref: Core and Builtins<191>-Footnote-56647353
Ref: Core and Builtins<191>-Footnote-66647418
Ref: Core and Builtins<191>-Footnote-76647483
Ref: Core and Builtins<191>-Footnote-86647548
Ref: Core and Builtins<191>-Footnote-96647613
Ref: Core and Builtins<191>-Footnote-106647678
Ref: Core and Builtins<191>-Footnote-116647744
Ref: Core and Builtins<191>-Footnote-126647810
Ref: Core and Builtins<191>-Footnote-136647876
Ref: Core and Builtins<191>-Footnote-146647942
Ref: Core and Builtins<191>-Footnote-156648008
Ref: Core and Builtins<191>-Footnote-166648074
Ref: Core and Builtins<191>-Footnote-176648140
Ref: Core and Builtins<191>-Footnote-186648205
Ref: Core and Builtins<191>-Footnote-196648271
Ref: Core and Builtins<191>-Footnote-206648337
Ref: Core and Builtins<191>-Footnote-216648403
Ref: Core and Builtins<191>-Footnote-226648469
Ref: Core and Builtins<191>-Footnote-236648535
Ref: Core and Builtins<191>-Footnote-246648601
Ref: Core and Builtins<191>-Footnote-256648667
Ref: Core and Builtins<191>-Footnote-266648733
Ref: Core and Builtins<191>-Footnote-276648799
Ref: Core and Builtins<191>-Footnote-286648865
Ref: Core and Builtins<191>-Footnote-296648931
Ref: Core and Builtins<191>-Footnote-306648997
Ref: Core and Builtins<191>-Footnote-316649063
Ref: Core and Builtins<191>-Footnote-326649106
Ref: Core and Builtins<191>-Footnote-336649172
Ref: Core and Builtins<191>-Footnote-346649238
Ref: Core and Builtins<191>-Footnote-356649304
Ref: Core and Builtins<191>-Footnote-366649370
Ref: Core and Builtins<191>-Footnote-376649436
Ref: Core and Builtins<191>-Footnote-386649502
Node: ライブラリ<194>6649568
Ref: whatsnew/changelog id10016649705
Ref: 1f646649705
Ref: ライブラリ<194>-Footnote-16666466
Ref: ライブラリ<194>-Footnote-26666531
Ref: ライブラリ<194>-Footnote-36666596
Ref: ライブラリ<194>-Footnote-46666638
Ref: ライブラリ<194>-Footnote-56666703
Ref: ライブラリ<194>-Footnote-66666768
Ref: ライブラリ<194>-Footnote-76666833
Ref: ライブラリ<194>-Footnote-86666898
Ref: ライブラリ<194>-Footnote-96666963
Ref: ライブラリ<194>-Footnote-106667028
Ref: ライブラリ<194>-Footnote-116667094
Ref: ライブラリ<194>-Footnote-126667160
Ref: ライブラリ<194>-Footnote-136667226
Ref: ライブラリ<194>-Footnote-146667292
Ref: ライブラリ<194>-Footnote-156667358
Ref: ライブラリ<194>-Footnote-166667424
Ref: ライブラリ<194>-Footnote-176667490
Ref: ライブラリ<194>-Footnote-186667556
Ref: ライブラリ<194>-Footnote-196667622
Ref: ライブラリ<194>-Footnote-206667688
Ref: ライブラリ<194>-Footnote-216667754
Ref: ライブラリ<194>-Footnote-226667820
Ref: ライブラリ<194>-Footnote-236667886
Ref: ライブラリ<194>-Footnote-246667952
Ref: ライブラリ<194>-Footnote-256668018
Ref: ライブラリ<194>-Footnote-266668084
Ref: ライブラリ<194>-Footnote-276668150
Ref: ライブラリ<194>-Footnote-286668216
Ref: ライブラリ<194>-Footnote-296668282
Ref: ライブラリ<194>-Footnote-306668348
Ref: ライブラリ<194>-Footnote-316668414
Ref: ライブラリ<194>-Footnote-326668480
Ref: ライブラリ<194>-Footnote-336668546
Ref: ライブラリ<194>-Footnote-346668612
Ref: ライブラリ<194>-Footnote-356668678
Ref: ライブラリ<194>-Footnote-366668744
Ref: ライブラリ<194>-Footnote-376668810
Ref: ライブラリ<194>-Footnote-386668876
Ref: ライブラリ<194>-Footnote-396668942
Ref: ライブラリ<194>-Footnote-406669008
Ref: ライブラリ<194>-Footnote-416669074
Ref: ライブラリ<194>-Footnote-426669140
Ref: ライブラリ<194>-Footnote-436669206
Ref: ライブラリ<194>-Footnote-446669272
Ref: ライブラリ<194>-Footnote-456669338
Ref: ライブラリ<194>-Footnote-466669404
Ref: ライブラリ<194>-Footnote-476669470
Ref: ライブラリ<194>-Footnote-486669536
Ref: ライブラリ<194>-Footnote-496669602
Ref: ライブラリ<194>-Footnote-506669668
Ref: ライブラリ<194>-Footnote-516669734
Ref: ライブラリ<194>-Footnote-526669800
Ref: ライブラリ<194>-Footnote-536669866
Ref: ライブラリ<194>-Footnote-546669932
Ref: ライブラリ<194>-Footnote-556669998
Ref: ライブラリ<194>-Footnote-566670064
Ref: ライブラリ<194>-Footnote-576670130
Ref: ライブラリ<194>-Footnote-586670196
Ref: ライブラリ<194>-Footnote-596670262
Ref: ライブラリ<194>-Footnote-606670328
Ref: ライブラリ<194>-Footnote-616670394
Ref: ライブラリ<194>-Footnote-626670459
Ref: ライブラリ<194>-Footnote-636670525
Ref: ライブラリ<194>-Footnote-646670591
Ref: ライブラリ<194>-Footnote-656670657
Ref: ライブラリ<194>-Footnote-666670723
Ref: ライブラリ<194>-Footnote-676670789
Ref: ライブラリ<194>-Footnote-686670855
Ref: ライブラリ<194>-Footnote-696670921
Ref: ライブラリ<194>-Footnote-706670987
Ref: ライブラリ<194>-Footnote-716671053
Ref: ライブラリ<194>-Footnote-726671119
Ref: ライブラリ<194>-Footnote-736671185
Ref: ライブラリ<194>-Footnote-746671251
Ref: ライブラリ<194>-Footnote-756671317
Ref: ライブラリ<194>-Footnote-766671383
Ref: ライブラリ<194>-Footnote-776671449
Ref: ライブラリ<194>-Footnote-786671515
Ref: ライブラリ<194>-Footnote-796671581
Ref: ライブラリ<194>-Footnote-806671647
Ref: ライブラリ<194>-Footnote-816671713
Ref: ライブラリ<194>-Footnote-826671779
Ref: ライブラリ<194>-Footnote-836671845
Ref: ライブラリ<194>-Footnote-846671911
Ref: ライブラリ<194>-Footnote-856671977
Ref: ライブラリ<194>-Footnote-866672043
Ref: ライブラリ<194>-Footnote-876672109
Ref: ライブラリ<194>-Footnote-886672175
Ref: ライブラリ<194>-Footnote-896672241
Ref: ライブラリ<194>-Footnote-906672307
Ref: ライブラリ<194>-Footnote-916672373
Ref: ライブラリ<194>-Footnote-926672439
Ref: ライブラリ<194>-Footnote-936672505
Ref: ライブラリ<194>-Footnote-946672571
Ref: ライブラリ<194>-Footnote-956672637
Ref: ライブラリ<194>-Footnote-966672703
Ref: ライブラリ<194>-Footnote-976672769
Ref: ライブラリ<194>-Footnote-986672835
Ref: ライブラリ<194>-Footnote-996672901
Ref: ライブラリ<194>-Footnote-1006672967
Ref: ライブラリ<194>-Footnote-1016673034
Ref: ライブラリ<194>-Footnote-1026673100
Ref: ライブラリ<194>-Footnote-1036673167
Ref: ライブラリ<194>-Footnote-1046673234
Ref: ライブラリ<194>-Footnote-1056673301
Ref: ライブラリ<194>-Footnote-1066673368
Ref: ライブラリ<194>-Footnote-1076673435
Ref: ライブラリ<194>-Footnote-1086673502
Ref: ライブラリ<194>-Footnote-1096673569
Ref: ライブラリ<194>-Footnote-1106673636
Ref: ライブラリ<194>-Footnote-1116673703
Ref: ライブラリ<194>-Footnote-1126673770
Ref: ライブラリ<194>-Footnote-1136673837
Ref: ライブラリ<194>-Footnote-1146673904
Ref: ライブラリ<194>-Footnote-1156673971
Ref: ライブラリ<194>-Footnote-1166674038
Ref: ライブラリ<194>-Footnote-1176674105
Ref: ライブラリ<194>-Footnote-1186674172
Ref: ライブラリ<194>-Footnote-1196674239
Ref: ライブラリ<194>-Footnote-1206674306
Node: IDLE<59>6674373
Ref: whatsnew/changelog id10026674510
Ref: 1f656674510
Ref: IDLE<59>-Footnote-16676845
Ref: IDLE<59>-Footnote-26676909
Ref: IDLE<59>-Footnote-36676974
Ref: IDLE<59>-Footnote-46677039
Ref: IDLE<59>-Footnote-56677104
Ref: IDLE<59>-Footnote-66677169
Ref: IDLE<59>-Footnote-76677234
Ref: IDLE<59>-Footnote-86677299
Ref: IDLE<59>-Footnote-96677364
Ref: IDLE<59>-Footnote-106677429
Ref: IDLE<59>-Footnote-116677495
Ref: IDLE<59>-Footnote-126677561
Ref: IDLE<59>-Footnote-136677627
Ref: IDLE<59>-Footnote-146677693
Ref: IDLE<59>-Footnote-156677759
Node: ドキュメント<80>6677825
Ref: whatsnew/changelog id10036677955
Ref: 1f666677955
Ref: ドキュメント<80>-Footnote-16678915
Ref: ドキュメント<80>-Footnote-26678980
Ref: ドキュメント<80>-Footnote-36679045
Ref: ドキュメント<80>-Footnote-46679087
Ref: ドキュメント<80>-Footnote-56679152
Ref: ドキュメント<80>-Footnote-66679216
Ref: ドキュメント<80>-Footnote-76679281
Ref: ドキュメント<80>-Footnote-86679346
Node: テスト<81>6679411
Ref: whatsnew/changelog id10046679546
Ref: 1f676679546
Ref: テスト<81>-Footnote-16680426
Ref: テスト<81>-Footnote-26680491
Ref: テスト<81>-Footnote-36680556
Ref: テスト<81>-Footnote-46680621
Ref: テスト<81>-Footnote-56680686
Ref: テスト<81>-Footnote-66680751
Ref: テスト<81>-Footnote-76680816
Node: ビルド<91>6680881
Ref: whatsnew/changelog id10056681005
Ref: 1f686681005
Ref: ビルド<91>-Footnote-16683534
Ref: ビルド<91>-Footnote-26683599
Ref: ビルド<91>-Footnote-36683664
Ref: ビルド<91>-Footnote-46683729
Ref: ビルド<91>-Footnote-56683794
Ref: ビルド<91>-Footnote-66683859
Ref: ビルド<91>-Footnote-76683924
Ref: ビルド<91>-Footnote-86683989
Ref: ビルド<91>-Footnote-96684054
Ref: ビルド<91>-Footnote-106684119
Ref: ビルド<91>-Footnote-116684185
Ref: ビルド<91>-Footnote-126684251
Ref: ビルド<91>-Footnote-136684317
Ref: ビルド<91>-Footnote-146684383
Ref: ビルド<91>-Footnote-156684449
Ref: ビルド<91>-Footnote-166684515
Ref: ビルド<91>-Footnote-176684581
Node: Windows<79>6684647
Ref: whatsnew/changelog id10066684773
Ref: 1f696684773
Ref: Windows<79>-Footnote-16685481
Ref: Windows<79>-Footnote-26685546
Ref: Windows<79>-Footnote-36685611
Ref: Windows<79>-Footnote-46685676
Ref: Windows<79>-Footnote-56685741
Ref: Windows<79>-Footnote-66685806
Node: Tools/Demos<56>6685871
Ref: whatsnew/changelog id10076685975
Ref: 1f6a6685975
Ref: Tools/Demos<56>-Footnote-16686597
Ref: Tools/Demos<56>-Footnote-26686662
Ref: Tools/Demos<56>-Footnote-36686727
Ref: Tools/Demos<56>-Footnote-46686792
Node: Python 3 5 1 final6686857
Ref: whatsnew/changelog python-3-5-1-final6687006
Ref: 1f6b6687006
Node: Core and Builtins<192>6687170
Ref: whatsnew/changelog id10086687267
Ref: 1f6c6687267
Ref: Core and Builtins<192>-Footnote-16687453
Node: Windows<80>6687518
Ref: whatsnew/changelog id10096687615
Ref: 1f6d6687615
Ref: Windows<80>-Footnote-16687807
Node: Python 3 5 1 release candidate 16687872
Ref: whatsnew/changelog python-3-5-1-release-candidate-16688007
Ref: 1f6e6688007
Node: Core and Builtins<193>6688392
Ref: whatsnew/changelog id10106688512
Ref: 1f6f6688512
Ref: Core and Builtins<193>-Footnote-16691650
Ref: Core and Builtins<193>-Footnote-26691715
Ref: Core and Builtins<193>-Footnote-36691780
Ref: Core and Builtins<193>-Footnote-46691845
Ref: Core and Builtins<193>-Footnote-56691910
Ref: Core and Builtins<193>-Footnote-66691975
Ref: Core and Builtins<193>-Footnote-76692040
Ref: Core and Builtins<193>-Footnote-86692105
Ref: Core and Builtins<193>-Footnote-96692170
Ref: Core and Builtins<193>-Footnote-106692235
Ref: Core and Builtins<193>-Footnote-116692301
Ref: Core and Builtins<193>-Footnote-126692367
Ref: Core and Builtins<193>-Footnote-136692433
Ref: Core and Builtins<193>-Footnote-146692499
Ref: Core and Builtins<193>-Footnote-156692565
Ref: Core and Builtins<193>-Footnote-166692631
Ref: Core and Builtins<193>-Footnote-176692697
Ref: Core and Builtins<193>-Footnote-186692763
Ref: Core and Builtins<193>-Footnote-196692829
Node: ライブラリ<195>6692895
Ref: whatsnew/changelog id10116693032
Ref: 1f706693032
Ref: ライブラリ<195>-Footnote-16703383
Ref: ライブラリ<195>-Footnote-26703448
Ref: ライブラリ<195>-Footnote-36703513
Ref: ライブラリ<195>-Footnote-46703578
Ref: ライブラリ<195>-Footnote-56703642
Ref: ライブラリ<195>-Footnote-66703707
Ref: ライブラリ<195>-Footnote-76703772
Ref: ライブラリ<195>-Footnote-86703837
Ref: ライブラリ<195>-Footnote-96703902
Ref: ライブラリ<195>-Footnote-106703967
Ref: ライブラリ<195>-Footnote-116704033
Ref: ライブラリ<195>-Footnote-126704099
Ref: ライブラリ<195>-Footnote-136704165
Ref: ライブラリ<195>-Footnote-146704231
Ref: ライブラリ<195>-Footnote-156704297
Ref: ライブラリ<195>-Footnote-166704363
Ref: ライブラリ<195>-Footnote-176704429
Ref: ライブラリ<195>-Footnote-186704495
Ref: ライブラリ<195>-Footnote-196704561
Ref: ライブラリ<195>-Footnote-206704627
Ref: ライブラリ<195>-Footnote-216704693
Ref: ライブラリ<195>-Footnote-226704759
Ref: ライブラリ<195>-Footnote-236704825
Ref: ライブラリ<195>-Footnote-246704891
Ref: ライブラリ<195>-Footnote-256704957
Ref: ライブラリ<195>-Footnote-266705023
Ref: ライブラリ<195>-Footnote-276705089
Ref: ライブラリ<195>-Footnote-286705155
Ref: ライブラリ<195>-Footnote-296705221
Ref: ライブラリ<195>-Footnote-306705287
Ref: ライブラリ<195>-Footnote-316705353
Ref: ライブラリ<195>-Footnote-326705419
Ref: ライブラリ<195>-Footnote-336705485
Ref: ライブラリ<195>-Footnote-346705551
Ref: ライブラリ<195>-Footnote-356705617
Ref: ライブラリ<195>-Footnote-366705683
Ref: ライブラリ<195>-Footnote-376705749
Ref: ライブラリ<195>-Footnote-386705815
Ref: ライブラリ<195>-Footnote-396705881
Ref: ライブラリ<195>-Footnote-406705947
Ref: ライブラリ<195>-Footnote-416706013
Ref: ライブラリ<195>-Footnote-426706079
Ref: ライブラリ<195>-Footnote-436706145
Ref: ライブラリ<195>-Footnote-446706211
Ref: ライブラリ<195>-Footnote-456706277
Ref: ライブラリ<195>-Footnote-466706343
Ref: ライブラリ<195>-Footnote-476706409
Ref: ライブラリ<195>-Footnote-486706475
Ref: ライブラリ<195>-Footnote-496706541
Ref: ライブラリ<195>-Footnote-506706607
Ref: ライブラリ<195>-Footnote-516706673
Ref: ライブラリ<195>-Footnote-526706739
Ref: ライブラリ<195>-Footnote-536706805
Ref: ライブラリ<195>-Footnote-546706871
Ref: ライブラリ<195>-Footnote-556706937
Ref: ライブラリ<195>-Footnote-566707003
Ref: ライブラリ<195>-Footnote-576707069
Ref: ライブラリ<195>-Footnote-586707135
Ref: ライブラリ<195>-Footnote-596707201
Ref: ライブラリ<195>-Footnote-606707267
Ref: ライブラリ<195>-Footnote-616707333
Ref: ライブラリ<195>-Footnote-626707399
Ref: ライブラリ<195>-Footnote-636707465
Ref: ライブラリ<195>-Footnote-646707531
Ref: ライブラリ<195>-Footnote-656707597
Ref: ライブラリ<195>-Footnote-666707663
Ref: ライブラリ<195>-Footnote-676707729
Ref: ライブラリ<195>-Footnote-686707795
Ref: ライブラリ<195>-Footnote-696707861
Ref: ライブラリ<195>-Footnote-706707927
Node: IDLE<60>6707993
Ref: whatsnew/changelog id10126708130
Ref: 1f716708130
Ref: IDLE<60>-Footnote-16713049
Ref: IDLE<60>-Footnote-26713114
Ref: IDLE<60>-Footnote-36713179
Ref: IDLE<60>-Footnote-46713244
Ref: IDLE<60>-Footnote-56713309
Ref: IDLE<60>-Footnote-66713374
Ref: IDLE<60>-Footnote-76713439
Ref: IDLE<60>-Footnote-86713504
Ref: IDLE<60>-Footnote-96713569
Ref: IDLE<60>-Footnote-106713634
Ref: IDLE<60>-Footnote-116713700
Ref: IDLE<60>-Footnote-126713766
Ref: IDLE<60>-Footnote-136713832
Ref: IDLE<60>-Footnote-146713898
Ref: IDLE<60>-Footnote-156713964
Ref: IDLE<60>-Footnote-166714030
Ref: IDLE<60>-Footnote-176714096
Ref: IDLE<60>-Footnote-186714162
Ref: IDLE<60>-Footnote-196714228
Ref: IDLE<60>-Footnote-206714294
Ref: IDLE<60>-Footnote-216714360
Ref: IDLE<60>-Footnote-226714426
Ref: IDLE<60>-Footnote-236714492
Ref: IDLE<60>-Footnote-246714558
Ref: IDLE<60>-Footnote-256714624
Node: ドキュメント<81>6714690
Ref: whatsnew/changelog id10136714820
Ref: 1f726714820
Ref: ドキュメント<81>-Footnote-16715897
Ref: ドキュメント<81>-Footnote-26715962
Ref: ドキュメント<81>-Footnote-36716027
Ref: ドキュメント<81>-Footnote-46716092
Ref: ドキュメント<81>-Footnote-56716157
Ref: ドキュメント<81>-Footnote-66716222
Node: テスト<82>6716287
Ref: whatsnew/changelog id10146716422
Ref: 1f736716422
Ref: テスト<82>-Footnote-16716936
Ref: テスト<82>-Footnote-26717001
Ref: テスト<82>-Footnote-36717066
Node: ビルド<92>6717131
Ref: whatsnew/changelog id10156717255
Ref: 1f746717255
Ref: ビルド<92>-Footnote-16717687
Ref: ビルド<92>-Footnote-26717752
Ref: ビルド<92>-Footnote-36717817
Node: Windows<81>6717882
Ref: whatsnew/changelog id10166718008
Ref: 1f756718008
Ref: Windows<81>-Footnote-16719283
Ref: Windows<81>-Footnote-26719348
Ref: Windows<81>-Footnote-36719413
Ref: Windows<81>-Footnote-46719478
Ref: Windows<81>-Footnote-56719543
Ref: Windows<81>-Footnote-66719608
Ref: Windows<81>-Footnote-76719673
Ref: Windows<81>-Footnote-86719738
Ref: Windows<81>-Footnote-96719803
Ref: Windows<81>-Footnote-106719868
Ref: Windows<81>-Footnote-116719934
Ref: Windows<81>-Footnote-126720000
Ref: Windows<81>-Footnote-136720066
Ref: Windows<81>-Footnote-146720132
Node: Tools/Demos<57>6720198
Ref: whatsnew/changelog id10176720302
Ref: 1f766720302
Ref: Tools/Demos<57>-Footnote-16720452
Node: Python 3 5 0 final6720517
Ref: whatsnew/changelog python-3-5-0-final6720666
Ref: 1f776720666
Node: ビルド<93>6720789
Ref: whatsnew/changelog id10186720857
Ref: 1f786720857
Ref: ビルド<93>-Footnote-16721040
Node: Python 3 5 0 release candidate 46721105
Ref: whatsnew/changelog python-3-5-0-release-candidate-46721254
Ref: 1f796721254
Node: ライブラリ<196>6721446
Ref: whatsnew/changelog id10196721557
Ref: 1f7a6721557
Ref: ライブラリ<196>-Footnote-16721699
Node: ビルド<94>6721764
Ref: whatsnew/changelog id10206721875
Ref: 1f7b6721875
Ref: ビルド<94>-Footnote-16722064
Node: Python 3 5 0 release candidate 36722129
Ref: whatsnew/changelog python-3-5-0-release-candidate-36722292
Ref: 1f7c6722292
Node: Core and Builtins<194>6722501
Ref: whatsnew/changelog id10216722621
Ref: 1f7d6722621
Ref: Core and Builtins<194>-Footnote-16722991
Ref: Core and Builtins<194>-Footnote-26723056
Ref: Core and Builtins<194>-Footnote-36723121
Ref: Core and Builtins<194>-Footnote-46723186
Node: ライブラリ<197>6723228
Ref: whatsnew/changelog id10226723348
Ref: 1f7e6723348
Ref: ライブラリ<197>-Footnote-16724135
Ref: ライブラリ<197>-Footnote-26724200
Ref: ライブラリ<197>-Footnote-36724265
Ref: ライブラリ<197>-Footnote-46724330
Ref: ライブラリ<197>-Footnote-56724395
Node: Python 3 5 0 release candidate 26724460
Ref: whatsnew/changelog python-3-5-0-release-candidate-26724623
Ref: 1f7f6724623
Node: Core and Builtins<195>6724832
Ref: whatsnew/changelog id10236724952
Ref: 1f806724952
Ref: Core and Builtins<195>-Footnote-16725494
Ref: Core and Builtins<195>-Footnote-26725559
Ref: Core and Builtins<195>-Footnote-36725624
Node: ライブラリ<198>6725689
Ref: whatsnew/changelog id10246725809
Ref: 1f816725809
Ref: ライブラリ<198>-Footnote-16726099
Ref: ライブラリ<198>-Footnote-26726164
Ref: ライブラリ<198>-Footnote-36726229
Node: Python 3 5 0 release candidate 16726294
Ref: whatsnew/changelog python-3-5-0-release-candidate-16726444
Ref: 1f826726444
Node: Core and Builtins<196>6726745
Ref: whatsnew/changelog id10256726865
Ref: 1f836726865
Ref: Core and Builtins<196>-Footnote-16727045
Node: ライブラリ<199>6727110
Ref: whatsnew/changelog id10266727247
Ref: 1f846727247
Ref: ライブラリ<199>-Footnote-16728836
Ref: ライブラリ<199>-Footnote-26728901
Ref: ライブラリ<199>-Footnote-36728966
Ref: ライブラリ<199>-Footnote-46729031
Ref: ライブラリ<199>-Footnote-56729095
Ref: ライブラリ<199>-Footnote-66729160
Ref: ライブラリ<199>-Footnote-76729225
Ref: ライブラリ<199>-Footnote-86729290
Ref: ライブラリ<199>-Footnote-96729355
Ref: ライブラリ<199>-Footnote-106729420
Ref: ライブラリ<199>-Footnote-116729486
Ref: ライブラリ<199>-Footnote-126729552
Ref: ライブラリ<199>-Footnote-136729618
Ref: ライブラリ<199>-Footnote-146729684
Ref: ライブラリ<199>-Footnote-156729750
Node: IDLE<61>6729816
Ref: whatsnew/changelog id10276729953
Ref: 1f856729953
Ref: IDLE<61>-Footnote-16730702
Ref: IDLE<61>-Footnote-26730767
Ref: IDLE<61>-Footnote-36730832
Ref: IDLE<61>-Footnote-46730897
Node: ドキュメント<82>6730962
Ref: whatsnew/changelog id10286731092
Ref: 1f866731092
Ref: ドキュメント<82>-Footnote-16731758
Ref: ドキュメント<82>-Footnote-26731823
Ref: ドキュメント<82>-Footnote-36731888
Ref: ドキュメント<82>-Footnote-46731953
Node: テスト<83>6732018
Ref: whatsnew/changelog id10296732131
Ref: 1f876732131
Ref: テスト<83>-Footnote-16732376
Node: Python 3 5 0 beta 46732441
Ref: whatsnew/changelog python-3-5-0-beta-46732578
Ref: 1f886732578
Node: Core and Builtins<197>6732789
Ref: whatsnew/changelog id10306732896
Ref: 1f896732896
Ref: Core and Builtins<197>-Footnote-16733699
Ref: Core and Builtins<197>-Footnote-26733764
Ref: Core and Builtins<197>-Footnote-36733829
Ref: Core and Builtins<197>-Footnote-46733871
Ref: Core and Builtins<197>-Footnote-56733936
Ref: Core and Builtins<197>-Footnote-66734001
Ref: Core and Builtins<197>-Footnote-76734066
Ref: Core and Builtins<197>-Footnote-86734131
Node: ライブラリ<200>6734196
Ref: whatsnew/changelog id10316734325
Ref: 1f8a6734325
Ref: ライブラリ<200>-Footnote-16736607
Ref: ライブラリ<200>-Footnote-26736672
Ref: ライブラリ<200>-Footnote-36736737
Ref: ライブラリ<200>-Footnote-46736802
Ref: ライブラリ<200>-Footnote-56736867
Ref: ライブラリ<200>-Footnote-66736932
Ref: ライブラリ<200>-Footnote-76736997
Ref: ライブラリ<200>-Footnote-86737062
Ref: ライブラリ<200>-Footnote-96737127
Ref: ライブラリ<200>-Footnote-106737192
Ref: ライブラリ<200>-Footnote-116737258
Ref: ライブラリ<200>-Footnote-126737324
Ref: ライブラリ<200>-Footnote-136737390
Ref: ライブラリ<200>-Footnote-146737456
Ref: ライブラリ<200>-Footnote-156737522
Ref: ライブラリ<200>-Footnote-166737588
Ref: ライブラリ<200>-Footnote-176737654
Ref: ライブラリ<200>-Footnote-186737720
Ref: ライブラリ<200>-Footnote-196737786
Node: ビルド<95>6737852
Ref: whatsnew/changelog id10326737950
Ref: 1f8b6737950
Ref: ビルド<95>-Footnote-16738120
Node: Python 3 5 0 beta 36738185
Ref: whatsnew/changelog python-3-5-0-beta-36738309
Ref: 1f8c6738309
Node: Core and Builtins<198>6738594
Ref: whatsnew/changelog id10336738701
Ref: 1f8d6738701
Ref: Core and Builtins<198>-Footnote-16740014
Ref: Core and Builtins<198>-Footnote-26740079
Ref: Core and Builtins<198>-Footnote-36740144
Ref: Core and Builtins<198>-Footnote-46740209
Ref: Core and Builtins<198>-Footnote-56740251
Ref: Core and Builtins<198>-Footnote-66740316
Node: ライブラリ<201>6740381
Ref: whatsnew/changelog id10346740510
Ref: 1f8e6740510
Ref: ライブラリ<201>-Footnote-16742469
Ref: ライブラリ<201>-Footnote-26742534
Ref: ライブラリ<201>-Footnote-36742599
Ref: ライブラリ<201>-Footnote-46742664
Ref: ライブラリ<201>-Footnote-56742729
Ref: ライブラリ<201>-Footnote-66742794
Ref: ライブラリ<201>-Footnote-76742859
Ref: ライブラリ<201>-Footnote-86742924
Ref: ライブラリ<201>-Footnote-96742989
Ref: ライブラリ<201>-Footnote-106743054
Ref: ライブラリ<201>-Footnote-116743120
Ref: ライブラリ<201>-Footnote-126743186
Ref: ライブラリ<201>-Footnote-136743252
Ref: ライブラリ<201>-Footnote-146743318
Ref: ライブラリ<201>-Footnote-156743384
Ref: ライブラリ<201>-Footnote-166743450
Ref: ライブラリ<201>-Footnote-176743516
Ref: ライブラリ<201>-Footnote-186743582
Node: テスト<84>6743648
Ref: whatsnew/changelog id10356743777
Ref: 1f8f6743777
Ref: テスト<84>-Footnote-16744064
Ref: テスト<84>-Footnote-26744129
Node: ドキュメント<83>6744194
Ref: whatsnew/changelog id10366744316
Ref: 1f906744316
Ref: ドキュメント<83>-Footnote-16744660
Ref: ドキュメント<83>-Footnote-26744725
Node: ビルド<96>6744790
Ref: whatsnew/changelog id10376744890
Ref: 1f916744890
Ref: ビルド<96>-Footnote-16745060
Node: Python 3 5 0 beta 26745125
Ref: whatsnew/changelog python-3-5-0-beta-26745249
Ref: 1f926745249
Node: Core and Builtins<199>6745432
Ref: whatsnew/changelog id10386745539
Ref: 1f936745539
Ref: Core and Builtins<199>-Footnote-16746292
Ref: Core and Builtins<199>-Footnote-26746357
Ref: Core and Builtins<199>-Footnote-36746422
Ref: Core and Builtins<199>-Footnote-46746487
Ref: Core and Builtins<199>-Footnote-56746552
Node: ライブラリ<202>6746617
Ref: whatsnew/changelog id10396746724
Ref: 1f946746724
Ref: ライブラリ<202>-Footnote-16747442
Ref: ライブラリ<202>-Footnote-26747507
Ref: ライブラリ<202>-Footnote-36747572
Ref: ライブラリ<202>-Footnote-46747614
Ref: ライブラリ<202>-Footnote-56747678
Ref: ライブラリ<202>-Footnote-66747743
Ref: ライブラリ<202>-Footnote-76747808
Node: Python 3 5 0 beta 16747873
Ref: whatsnew/changelog python-3-5-0-beta-16747998
Ref: 1f956747998
Node: Core and Builtins<200>6748305
Ref: whatsnew/changelog id10406748412
Ref: 1f966748412
Ref: Core and Builtins<200>-Footnote-16750285
Ref: Core and Builtins<200>-Footnote-26750350
Ref: Core and Builtins<200>-Footnote-36750415
Ref: Core and Builtins<200>-Footnote-46750480
Ref: Core and Builtins<200>-Footnote-56750545
Ref: Core and Builtins<200>-Footnote-66750610
Ref: Core and Builtins<200>-Footnote-76750675
Ref: Core and Builtins<200>-Footnote-86750740
Ref: Core and Builtins<200>-Footnote-96750805
Ref: Core and Builtins<200>-Footnote-106750870
Ref: Core and Builtins<200>-Footnote-116750935
Ref: Core and Builtins<200>-Footnote-126751001
Ref: Core and Builtins<200>-Footnote-136751067
Ref: Core and Builtins<200>-Footnote-146751133
Ref: Core and Builtins<200>-Footnote-156751199
Ref: Core and Builtins<200>-Footnote-166751265
Ref: Core and Builtins<200>-Footnote-176751331
Ref: Core and Builtins<200>-Footnote-186751396
Ref: Core and Builtins<200>-Footnote-196751462
Node: ライブラリ<203>6751528
Ref: whatsnew/changelog id10416751652
Ref: 1f976751652
Ref: ライブラリ<203>-Footnote-16759299
Ref: ライブラリ<203>-Footnote-26759364
Ref: ライブラリ<203>-Footnote-36759429
Ref: ライブラリ<203>-Footnote-46759494
Ref: ライブラリ<203>-Footnote-56759559
Ref: ライブラリ<203>-Footnote-66759624
Ref: ライブラリ<203>-Footnote-76759689
Ref: ライブラリ<203>-Footnote-86759754
Ref: ライブラリ<203>-Footnote-96759819
Ref: ライブラリ<203>-Footnote-106759884
Ref: ライブラリ<203>-Footnote-116759949
Ref: ライブラリ<203>-Footnote-126760015
Ref: ライブラリ<203>-Footnote-136760081
Ref: ライブラリ<203>-Footnote-146760147
Ref: ライブラリ<203>-Footnote-156760212
Ref: ライブラリ<203>-Footnote-166760278
Ref: ライブラリ<203>-Footnote-176760344
Ref: ライブラリ<203>-Footnote-186760410
Ref: ライブラリ<203>-Footnote-196760476
Ref: ライブラリ<203>-Footnote-206760542
Ref: ライブラリ<203>-Footnote-216760608
Ref: ライブラリ<203>-Footnote-226760674
Ref: ライブラリ<203>-Footnote-236760740
Ref: ライブラリ<203>-Footnote-246760806
Ref: ライブラリ<203>-Footnote-256760872
Ref: ライブラリ<203>-Footnote-266760937
Ref: ライブラリ<203>-Footnote-276761003
Ref: ライブラリ<203>-Footnote-286761069
Ref: ライブラリ<203>-Footnote-296761135
Ref: ライブラリ<203>-Footnote-306761201
Ref: ライブラリ<203>-Footnote-316761267
Ref: ライブラリ<203>-Footnote-326761333
Ref: ライブラリ<203>-Footnote-336761399
Ref: ライブラリ<203>-Footnote-346761465
Ref: ライブラリ<203>-Footnote-356761531
Ref: ライブラリ<203>-Footnote-366761597
Ref: ライブラリ<203>-Footnote-376761663
Ref: ライブラリ<203>-Footnote-386761729
Ref: ライブラリ<203>-Footnote-396761795
Ref: ライブラリ<203>-Footnote-406761861
Ref: ライブラリ<203>-Footnote-416761927
Ref: ライブラリ<203>-Footnote-426761992
Ref: ライブラリ<203>-Footnote-436762058
Ref: ライブラリ<203>-Footnote-446762124
Ref: ライブラリ<203>-Footnote-456762190
Ref: ライブラリ<203>-Footnote-466762256
Ref: ライブラリ<203>-Footnote-476762322
Ref: ライブラリ<203>-Footnote-486762388
Ref: ライブラリ<203>-Footnote-496762454
Ref: ライブラリ<203>-Footnote-506762520
Ref: ライブラリ<203>-Footnote-516762586
Ref: ライブラリ<203>-Footnote-526762652
Ref: ライブラリ<203>-Footnote-536762718
Ref: ライブラリ<203>-Footnote-546762784
Ref: ライブラリ<203>-Footnote-556762850
Ref: ライブラリ<203>-Footnote-566762916
Node: IDLE<62>6762982
Ref: whatsnew/changelog id10426763097
Ref: 1f986763097
Ref: IDLE<62>-Footnote-16763266
Node: テスト<85>6763331
Ref: whatsnew/changelog id10436763448
Ref: 1f996763448
Ref: テスト<85>-Footnote-16763747
Ref: テスト<85>-Footnote-26763812
Node: ドキュメント<84>6763876
Ref: whatsnew/changelog id10446764000
Ref: 1f9a6764000
Ref: ドキュメント<84>-Footnote-16764411
Ref: ドキュメント<84>-Footnote-26764476
Ref: ドキュメント<84>-Footnote-36764541
Node: Tools/Demos<58>6764606
Ref: whatsnew/changelog id10456764708
Ref: 1f9b6764708
Ref: Tools/Demos<58>-Footnote-16765217
Ref: Tools/Demos<58>-Footnote-26765282
Ref: Tools/Demos<58>-Footnote-36765347
Ref: Tools/Demos<58>-Footnote-46765412
Node: Python 3 5 0 alpha 46765477
Ref: whatsnew/changelog python-3-5-0-alpha-46765603
Ref: 1f9c6765603
Node: Core and Builtins<201>6765896
Ref: whatsnew/changelog id10466766004
Ref: 1f9d6766004
Ref: Core and Builtins<201>-Footnote-16767369
Ref: Core and Builtins<201>-Footnote-26767434
Ref: Core and Builtins<201>-Footnote-36767476
Ref: Core and Builtins<201>-Footnote-46767541
Ref: Core and Builtins<201>-Footnote-56767606
Ref: Core and Builtins<201>-Footnote-66767648
Ref: Core and Builtins<201>-Footnote-76767713
Ref: Core and Builtins<201>-Footnote-86767778
Ref: Core and Builtins<201>-Footnote-96767843
Ref: Core and Builtins<201>-Footnote-106767908
Ref: Core and Builtins<201>-Footnote-116767974
Node: ライブラリ<204>6768040
Ref: whatsnew/changelog id10476768170
Ref: 1f9e6768170
Ref: ライブラリ<204>-Footnote-16774880
Ref: ライブラリ<204>-Footnote-26774945
Ref: ライブラリ<204>-Footnote-36775010
Ref: ライブラリ<204>-Footnote-46775074
Ref: ライブラリ<204>-Footnote-56775139
Ref: ライブラリ<204>-Footnote-66775204
Ref: ライブラリ<204>-Footnote-76775268
Ref: ライブラリ<204>-Footnote-86775333
Ref: ライブラリ<204>-Footnote-96775398
Ref: ライブラリ<204>-Footnote-106775463
Ref: ライブラリ<204>-Footnote-116775529
Ref: ライブラリ<204>-Footnote-126775595
Ref: ライブラリ<204>-Footnote-136775661
Ref: ライブラリ<204>-Footnote-146775727
Ref: ライブラリ<204>-Footnote-156775793
Ref: ライブラリ<204>-Footnote-166775859
Ref: ライブラリ<204>-Footnote-176775925
Ref: ライブラリ<204>-Footnote-186775991
Ref: ライブラリ<204>-Footnote-196776057
Ref: ライブラリ<204>-Footnote-206776123
Ref: ライブラリ<204>-Footnote-216776189
Ref: ライブラリ<204>-Footnote-226776255
Ref: ライブラリ<204>-Footnote-236776321
Ref: ライブラリ<204>-Footnote-246776387
Ref: ライブラリ<204>-Footnote-256776453
Ref: ライブラリ<204>-Footnote-266776519
Ref: ライブラリ<204>-Footnote-276776585
Ref: ライブラリ<204>-Footnote-286776651
Ref: ライブラリ<204>-Footnote-296776717
Ref: ライブラリ<204>-Footnote-306776783
Ref: ライブラリ<204>-Footnote-316776848
Ref: ライブラリ<204>-Footnote-326776914
Ref: ライブラリ<204>-Footnote-336776980
Ref: ライブラリ<204>-Footnote-346777046
Ref: ライブラリ<204>-Footnote-356777112
Ref: ライブラリ<204>-Footnote-366777178
Ref: ライブラリ<204>-Footnote-376777244
Ref: ライブラリ<204>-Footnote-386777310
Ref: ライブラリ<204>-Footnote-396777376
Ref: ライブラリ<204>-Footnote-406777442
Ref: ライブラリ<204>-Footnote-416777508
Ref: ライブラリ<204>-Footnote-426777574
Ref: ライブラリ<204>-Footnote-436777617
Ref: ライブラリ<204>-Footnote-446777683
Ref: ライブラリ<204>-Footnote-456777749
Ref: ライブラリ<204>-Footnote-466777815
Ref: ライブラリ<204>-Footnote-476777881
Ref: ライブラリ<204>-Footnote-486777947
Node: ビルド<97>6778013
Ref: whatsnew/changelog id10486778134
Ref: 1f9f6778134
Ref: ビルド<97>-Footnote-16778416
Ref: ビルド<97>-Footnote-26778481
Node: テスト<86>6778546
Ref: whatsnew/changelog id10496778662
Ref: 1fa06778662
Ref: テスト<86>-Footnote-16778968
Ref: テスト<86>-Footnote-26779033
Node: Tools/Demos<59>6779098
Ref: whatsnew/changelog id10506779210
Ref: 1fa16779210
Ref: Tools/Demos<59>-Footnote-16780234
Ref: Tools/Demos<59>-Footnote-26780299
Ref: Tools/Demos<59>-Footnote-36780364
Ref: Tools/Demos<59>-Footnote-46780429
Ref: Tools/Demos<59>-Footnote-56780494
Ref: Tools/Demos<59>-Footnote-66780559
Node: C API<77>6780624
Ref: whatsnew/changelog id10516780714
Ref: 1fa26780714
Ref: C API<77>-Footnote-16780869
Node: Python 3 5 0 alpha 36780934
Ref: whatsnew/changelog python-3-5-0-alpha-36781061
Ref: 1fa36781061
Node: Core and Builtins<202>6781334
Ref: whatsnew/changelog id10526781442
Ref: 1fa46781442
Ref: Core and Builtins<202>-Footnote-16782236
Ref: Core and Builtins<202>-Footnote-26782301
Ref: Core and Builtins<202>-Footnote-36782366
Ref: Core and Builtins<202>-Footnote-46782431
Ref: Core and Builtins<202>-Footnote-56782496
Ref: Core and Builtins<202>-Footnote-66782561
Node: ライブラリ<205>6782626
Ref: whatsnew/changelog id10536782756
Ref: 1fa56782756
Ref: ライブラリ<205>-Footnote-16789177
Ref: ライブラリ<205>-Footnote-26789242
Ref: ライブラリ<205>-Footnote-36789307
Ref: ライブラリ<205>-Footnote-46789372
Ref: ライブラリ<205>-Footnote-56789437
Ref: ライブラリ<205>-Footnote-66789502
Ref: ライブラリ<205>-Footnote-76789567
Ref: ライブラリ<205>-Footnote-86789632
Ref: ライブラリ<205>-Footnote-96789697
Ref: ライブラリ<205>-Footnote-106789762
Ref: ライブラリ<205>-Footnote-116789828
Ref: ライブラリ<205>-Footnote-126789894
Ref: ライブラリ<205>-Footnote-136789960
Ref: ライブラリ<205>-Footnote-146790026
Ref: ライブラリ<205>-Footnote-156790091
Ref: ライブラリ<205>-Footnote-166790157
Ref: ライブラリ<205>-Footnote-176790223
Ref: ライブラリ<205>-Footnote-186790289
Ref: ライブラリ<205>-Footnote-196790355
Ref: ライブラリ<205>-Footnote-206790421
Ref: ライブラリ<205>-Footnote-216790487
Ref: ライブラリ<205>-Footnote-226790553
Ref: ライブラリ<205>-Footnote-236790619
Ref: ライブラリ<205>-Footnote-246790685
Ref: ライブラリ<205>-Footnote-256790751
Ref: ライブラリ<205>-Footnote-266790817
Ref: ライブラリ<205>-Footnote-276790883
Ref: ライブラリ<205>-Footnote-286790949
Ref: ライブラリ<205>-Footnote-296791015
Ref: ライブラリ<205>-Footnote-306791081
Ref: ライブラリ<205>-Footnote-316791146
Ref: ライブラリ<205>-Footnote-326791212
Ref: ライブラリ<205>-Footnote-336791278
Ref: ライブラリ<205>-Footnote-346791344
Ref: ライブラリ<205>-Footnote-356791409
Ref: ライブラリ<205>-Footnote-366791475
Ref: ライブラリ<205>-Footnote-376791541
Ref: ライブラリ<205>-Footnote-386791607
Ref: ライブラリ<205>-Footnote-396791673
Ref: ライブラリ<205>-Footnote-406791739
Ref: ライブラリ<205>-Footnote-416791805
Ref: ライブラリ<205>-Footnote-426791871
Node: ビルド<98>6791937
Ref: whatsnew/changelog id10546792058
Ref: 1fa66792058
Ref: ビルド<98>-Footnote-16792208
Node: テスト<87>6792273
Ref: whatsnew/changelog id10556792389
Ref: 1fa76792389
Ref: テスト<87>-Footnote-16792619
Ref: テスト<87>-Footnote-26792684
Node: Tools/Demos<60>6792749
Ref: whatsnew/changelog id10566792843
Ref: 1fa86792843
Ref: Tools/Demos<60>-Footnote-16793112
Node: Python 3 5 0 alpha 26793177
Ref: whatsnew/changelog python-3-5-0-alpha-26793304
Ref: 1fa96793304
Node: Core and Builtins<203>6793561
Ref: whatsnew/changelog id10576793669
Ref: 1faa6793669
Ref: Core and Builtins<203>-Footnote-16793967
Node: ライブラリ<206>6794032
Ref: whatsnew/changelog id10586794162
Ref: 1fab6794162
Ref: ライブラリ<206>-Footnote-16798466
Ref: ライブラリ<206>-Footnote-26798531
Ref: ライブラリ<206>-Footnote-36798573
Ref: ライブラリ<206>-Footnote-46798638
Ref: ライブラリ<206>-Footnote-56798703
Ref: ライブラリ<206>-Footnote-66798768
Ref: ライブラリ<206>-Footnote-76798833
Ref: ライブラリ<206>-Footnote-86798898
Ref: ライブラリ<206>-Footnote-96798963
Ref: ライブラリ<206>-Footnote-106799027
Ref: ライブラリ<206>-Footnote-116799093
Ref: ライブラリ<206>-Footnote-126799159
Ref: ライブラリ<206>-Footnote-136799225
Ref: ライブラリ<206>-Footnote-146799291
Ref: ライブラリ<206>-Footnote-156799357
Ref: ライブラリ<206>-Footnote-166799423
Ref: ライブラリ<206>-Footnote-176799488
Ref: ライブラリ<206>-Footnote-186799555
Ref: ライブラリ<206>-Footnote-196799620
Ref: ライブラリ<206>-Footnote-206799686
Ref: ライブラリ<206>-Footnote-216799751
Ref: ライブラリ<206>-Footnote-226799817
Ref: ライブラリ<206>-Footnote-236799883
Ref: ライブラリ<206>-Footnote-246799949
Ref: ライブラリ<206>-Footnote-256800015
Ref: ライブラリ<206>-Footnote-266800081
Ref: ライブラリ<206>-Footnote-276800147
Ref: ライブラリ<206>-Footnote-286800213
Ref: ライブラリ<206>-Footnote-296800279
Ref: ライブラリ<206>-Footnote-306800345
Ref: ライブラリ<206>-Footnote-316800411
Ref: ライブラリ<206>-Footnote-326800477
Ref: ライブラリ<206>-Footnote-336800543
Ref: ライブラリ<206>-Footnote-346800609
Ref: ライブラリ<206>-Footnote-356800675
Ref: ライブラリ<206>-Footnote-366800741
Ref: ライブラリ<206>-Footnote-376800807
Node: ビルド<99>6800873
Ref: whatsnew/changelog id10596800990
Ref: 1fac6800990
Ref: ビルド<99>-Footnote-16801262
Ref: ビルド<99>-Footnote-26801327
Node: C API<78>6801392
Ref: whatsnew/changelog id10606801500
Ref: 1fad6801500
Ref: C API<78>-Footnote-16801682
Node: Windows<82>6801747
Ref: whatsnew/changelog id10616801833
Ref: 1fae6801833
Ref: Windows<82>-Footnote-16802130
Ref: Windows<82>-Footnote-26802195
Ref: Windows<82>-Footnote-36802237
Node: Python 3 5 0 alpha 16802302
Ref: whatsnew/changelog python-3-5-0-alpha-16802400
Ref: 1faf6802400
Node: Core and Builtins<204>6802782
Ref: whatsnew/changelog id10626802890
Ref: 1fb06802890
Ref: Core and Builtins<204>-Footnote-16812733
Ref: Core and Builtins<204>-Footnote-26812798
Ref: Core and Builtins<204>-Footnote-36812863
Ref: Core and Builtins<204>-Footnote-46812928
Ref: Core and Builtins<204>-Footnote-56812993
Ref: Core and Builtins<204>-Footnote-66813058
Ref: Core and Builtins<204>-Footnote-76813123
Ref: Core and Builtins<204>-Footnote-86813188
Ref: Core and Builtins<204>-Footnote-96813253
Ref: Core and Builtins<204>-Footnote-106813318
Ref: Core and Builtins<204>-Footnote-116813384
Ref: Core and Builtins<204>-Footnote-126813450
Ref: Core and Builtins<204>-Footnote-136813516
Ref: Core and Builtins<204>-Footnote-146813582
Ref: Core and Builtins<204>-Footnote-156813648
Ref: Core and Builtins<204>-Footnote-166813714
Ref: Core and Builtins<204>-Footnote-176813780
Ref: Core and Builtins<204>-Footnote-186813846
Ref: Core and Builtins<204>-Footnote-196813912
Ref: Core and Builtins<204>-Footnote-206813978
Ref: Core and Builtins<204>-Footnote-216814044
Ref: Core and Builtins<204>-Footnote-226814110
Ref: Core and Builtins<204>-Footnote-236814176
Ref: Core and Builtins<204>-Footnote-246814242
Ref: Core and Builtins<204>-Footnote-256814308
Ref: Core and Builtins<204>-Footnote-266814374
Ref: Core and Builtins<204>-Footnote-276814440
Ref: Core and Builtins<204>-Footnote-286814506
Ref: Core and Builtins<204>-Footnote-296814572
Ref: Core and Builtins<204>-Footnote-306814638
Ref: Core and Builtins<204>-Footnote-316814704
Ref: Core and Builtins<204>-Footnote-326814770
Ref: Core and Builtins<204>-Footnote-336814836
Ref: Core and Builtins<204>-Footnote-346814904
Ref: Core and Builtins<204>-Footnote-356814970
Ref: Core and Builtins<204>-Footnote-366815036
Ref: Core and Builtins<204>-Footnote-376815102
Ref: Core and Builtins<204>-Footnote-386815168
Ref: Core and Builtins<204>-Footnote-396815234
Ref: Core and Builtins<204>-Footnote-406815300
Ref: Core and Builtins<204>-Footnote-416815366
Ref: Core and Builtins<204>-Footnote-426815432
Ref: Core and Builtins<204>-Footnote-436815498
Ref: Core and Builtins<204>-Footnote-446815564
Ref: Core and Builtins<204>-Footnote-456815630
Ref: Core and Builtins<204>-Footnote-466815696
Ref: Core and Builtins<204>-Footnote-476815762
Ref: Core and Builtins<204>-Footnote-486815828
Ref: Core and Builtins<204>-Footnote-496815894
Ref: Core and Builtins<204>-Footnote-506815960
Ref: Core and Builtins<204>-Footnote-516816026
Ref: Core and Builtins<204>-Footnote-526816092
Ref: Core and Builtins<204>-Footnote-536816158
Ref: Core and Builtins<204>-Footnote-546816224
Ref: Core and Builtins<204>-Footnote-556816290
Ref: Core and Builtins<204>-Footnote-566816356
Ref: Core and Builtins<204>-Footnote-576816422
Ref: Core and Builtins<204>-Footnote-586816488
Ref: Core and Builtins<204>-Footnote-596816554
Ref: Core and Builtins<204>-Footnote-606816620
Ref: Core and Builtins<204>-Footnote-616816686
Ref: Core and Builtins<204>-Footnote-626816752
Ref: Core and Builtins<204>-Footnote-636816818
Ref: Core and Builtins<204>-Footnote-646816884
Ref: Core and Builtins<204>-Footnote-656816950
Ref: Core and Builtins<204>-Footnote-666817016
Ref: Core and Builtins<204>-Footnote-676817081
Ref: Core and Builtins<204>-Footnote-686817147
Ref: Core and Builtins<204>-Footnote-696817213
Ref: Core and Builtins<204>-Footnote-706817279
Ref: Core and Builtins<204>-Footnote-716817345
Ref: Core and Builtins<204>-Footnote-726817411
Ref: Core and Builtins<204>-Footnote-736817476
Node: ライブラリ<207>6817542
Ref: whatsnew/changelog id10636817667
Ref: 1fb16817667
Ref: ライブラリ<207>-Footnote-16869982
Ref: ライブラリ<207>-Footnote-26870047
Ref: ライブラリ<207>-Footnote-36870112
Ref: ライブラリ<207>-Footnote-46870177
Ref: ライブラリ<207>-Footnote-56870242
Ref: ライブラリ<207>-Footnote-66870307
Ref: ライブラリ<207>-Footnote-76870372
Ref: ライブラリ<207>-Footnote-86870437
Ref: ライブラリ<207>-Footnote-96870502
Ref: ライブラリ<207>-Footnote-106870567
Ref: ライブラリ<207>-Footnote-116870633
Ref: ライブラリ<207>-Footnote-126870699
Ref: ライブラリ<207>-Footnote-136870765
Ref: ライブラリ<207>-Footnote-146870831
Ref: ライブラリ<207>-Footnote-156870897
Ref: ライブラリ<207>-Footnote-166870963
Ref: ライブラリ<207>-Footnote-176871029
Ref: ライブラリ<207>-Footnote-186871095
Ref: ライブラリ<207>-Footnote-196871161
Ref: ライブラリ<207>-Footnote-206871227
Ref: ライブラリ<207>-Footnote-216871293
Ref: ライブラリ<207>-Footnote-226871359
Ref: ライブラリ<207>-Footnote-236871425
Ref: ライブラリ<207>-Footnote-246871491
Ref: ライブラリ<207>-Footnote-256871557
Ref: ライブラリ<207>-Footnote-266871623
Ref: ライブラリ<207>-Footnote-276871689
Ref: ライブラリ<207>-Footnote-286871755
Ref: ライブラリ<207>-Footnote-296871821
Ref: ライブラリ<207>-Footnote-306871887
Ref: ライブラリ<207>-Footnote-316871953
Ref: ライブラリ<207>-Footnote-326872019
Ref: ライブラリ<207>-Footnote-336872085
Ref: ライブラリ<207>-Footnote-346872151
Ref: ライブラリ<207>-Footnote-356872217
Ref: ライブラリ<207>-Footnote-366872283
Ref: ライブラリ<207>-Footnote-376872349
Ref: ライブラリ<207>-Footnote-386872415
Ref: ライブラリ<207>-Footnote-396872481
Ref: ライブラリ<207>-Footnote-406872547
Ref: ライブラリ<207>-Footnote-416872613
Ref: ライブラリ<207>-Footnote-426872679
Ref: ライブラリ<207>-Footnote-436872745
Ref: ライブラリ<207>-Footnote-446872811
Ref: ライブラリ<207>-Footnote-456872877
Ref: ライブラリ<207>-Footnote-466872943
Ref: ライブラリ<207>-Footnote-476873009
Ref: ライブラリ<207>-Footnote-486873075
Ref: ライブラリ<207>-Footnote-496873141
Ref: ライブラリ<207>-Footnote-506873207
Ref: ライブラリ<207>-Footnote-516873273
Ref: ライブラリ<207>-Footnote-526873339
Ref: ライブラリ<207>-Footnote-536873405
Ref: ライブラリ<207>-Footnote-546873471
Ref: ライブラリ<207>-Footnote-556873537
Ref: ライブラリ<207>-Footnote-566873605
Ref: ライブラリ<207>-Footnote-576873671
Ref: ライブラリ<207>-Footnote-586873737
Ref: ライブラリ<207>-Footnote-596873803
Ref: ライブラリ<207>-Footnote-606873869
Ref: ライブラリ<207>-Footnote-616873935
Ref: ライブラリ<207>-Footnote-626873991
Ref: ライブラリ<207>-Footnote-636874057
Ref: ライブラリ<207>-Footnote-646874123
Ref: ライブラリ<207>-Footnote-656874189
Ref: ライブラリ<207>-Footnote-666874255
Ref: ライブラリ<207>-Footnote-676874321
Ref: ライブラリ<207>-Footnote-686874387
Ref: ライブラリ<207>-Footnote-696874453
Ref: ライブラリ<207>-Footnote-706874519
Ref: ライブラリ<207>-Footnote-716874585
Ref: ライブラリ<207>-Footnote-726874651
Ref: ライブラリ<207>-Footnote-736874717
Ref: ライブラリ<207>-Footnote-746874783
Ref: ライブラリ<207>-Footnote-756874849
Ref: ライブラリ<207>-Footnote-766874915
Ref: ライブラリ<207>-Footnote-776874981
Ref: ライブラリ<207>-Footnote-786875047
Ref: ライブラリ<207>-Footnote-796875113
Ref: ライブラリ<207>-Footnote-806875179
Ref: ライブラリ<207>-Footnote-816875245
Ref: ライブラリ<207>-Footnote-826875311
Ref: ライブラリ<207>-Footnote-836875377
Ref: ライブラリ<207>-Footnote-846875443
Ref: ライブラリ<207>-Footnote-856875509
Ref: ライブラリ<207>-Footnote-866875575
Ref: ライブラリ<207>-Footnote-876875641
Ref: ライブラリ<207>-Footnote-886875707
Ref: ライブラリ<207>-Footnote-896875773
Ref: ライブラリ<207>-Footnote-906875839
Ref: ライブラリ<207>-Footnote-916875905
Ref: ライブラリ<207>-Footnote-926875971
Ref: ライブラリ<207>-Footnote-936876037
Ref: ライブラリ<207>-Footnote-946876103
Ref: ライブラリ<207>-Footnote-956876169
Ref: ライブラリ<207>-Footnote-966876235
Ref: ライブラリ<207>-Footnote-976876300
Ref: ライブラリ<207>-Footnote-986876366
Ref: ライブラリ<207>-Footnote-996876432
Ref: ライブラリ<207>-Footnote-1006876498
Ref: ライブラリ<207>-Footnote-1016876564
Ref: ライブラリ<207>-Footnote-1026876631
Ref: ライブラリ<207>-Footnote-1036876698
Ref: ライブラリ<207>-Footnote-1046876765
Ref: ライブラリ<207>-Footnote-1056876832
Ref: ライブラリ<207>-Footnote-1066876899
Ref: ライブラリ<207>-Footnote-1076876966
Ref: ライブラリ<207>-Footnote-1086877032
Ref: ライブラリ<207>-Footnote-1096877098
Ref: ライブラリ<207>-Footnote-1106877165
Ref: ライブラリ<207>-Footnote-1116877232
Ref: ライブラリ<207>-Footnote-1126877299
Ref: ライブラリ<207>-Footnote-1136877366
Ref: ライブラリ<207>-Footnote-1146877433
Ref: ライブラリ<207>-Footnote-1156877500
Ref: ライブラリ<207>-Footnote-1166877567
Ref: ライブラリ<207>-Footnote-1176877634
Ref: ライブラリ<207>-Footnote-1186877701
Ref: ライブラリ<207>-Footnote-1196877768
Ref: ライブラリ<207>-Footnote-1206877835
Ref: ライブラリ<207>-Footnote-1216877902
Ref: ライブラリ<207>-Footnote-1226877971
Ref: ライブラリ<207>-Footnote-1236878038
Ref: ライブラリ<207>-Footnote-1246878105
Ref: ライブラリ<207>-Footnote-1256878172
Ref: ライブラリ<207>-Footnote-1266878239
Ref: ライブラリ<207>-Footnote-1276878306
Ref: ライブラリ<207>-Footnote-1286878373
Ref: ライブラリ<207>-Footnote-1296878440
Ref: ライブラリ<207>-Footnote-1306878507
Ref: ライブラリ<207>-Footnote-1316878574
Ref: ライブラリ<207>-Footnote-1326878641
Ref: ライブラリ<207>-Footnote-1336878708
Ref: ライブラリ<207>-Footnote-1346878775
Ref: ライブラリ<207>-Footnote-1356878842
Ref: ライブラリ<207>-Footnote-1366878909
Ref: ライブラリ<207>-Footnote-1376878976
Ref: ライブラリ<207>-Footnote-1386879043
Ref: ライブラリ<207>-Footnote-1396879110
Ref: ライブラリ<207>-Footnote-1406879177
Ref: ライブラリ<207>-Footnote-1416879244
Ref: ライブラリ<207>-Footnote-1426879311
Ref: ライブラリ<207>-Footnote-1436879377
Ref: ライブラリ<207>-Footnote-1446879443
Ref: ライブラリ<207>-Footnote-1456879510
Ref: ライブラリ<207>-Footnote-1466879577
Ref: ライブラリ<207>-Footnote-1476879644
Ref: ライブラリ<207>-Footnote-1486879711
Ref: ライブラリ<207>-Footnote-1496879778
Ref: ライブラリ<207>-Footnote-1506879845
Ref: ライブラリ<207>-Footnote-1516879912
Ref: ライブラリ<207>-Footnote-1526879979
Ref: ライブラリ<207>-Footnote-1536880046
Ref: ライブラリ<207>-Footnote-1546880113
Ref: ライブラリ<207>-Footnote-1556880180
Ref: ライブラリ<207>-Footnote-1566880247
Ref: ライブラリ<207>-Footnote-1576880314
Ref: ライブラリ<207>-Footnote-1586880380
Ref: ライブラリ<207>-Footnote-1596880447
Ref: ライブラリ<207>-Footnote-1606880514
Ref: ライブラリ<207>-Footnote-1616880581
Ref: ライブラリ<207>-Footnote-1626880648
Ref: ライブラリ<207>-Footnote-1636880715
Ref: ライブラリ<207>-Footnote-1646880782
Ref: ライブラリ<207>-Footnote-1656880849
Ref: ライブラリ<207>-Footnote-1666880916
Ref: ライブラリ<207>-Footnote-1676880983
Ref: ライブラリ<207>-Footnote-1686881050
Ref: ライブラリ<207>-Footnote-1696881117
Ref: ライブラリ<207>-Footnote-1706881184
Ref: ライブラリ<207>-Footnote-1716881251
Ref: ライブラリ<207>-Footnote-1726881318
Ref: ライブラリ<207>-Footnote-1736881385
Ref: ライブラリ<207>-Footnote-1746881452
Ref: ライブラリ<207>-Footnote-1756881519
Ref: ライブラリ<207>-Footnote-1766881586
Ref: ライブラリ<207>-Footnote-1776881653
Ref: ライブラリ<207>-Footnote-1786881720
Ref: ライブラリ<207>-Footnote-1796881787
Ref: ライブラリ<207>-Footnote-1806881854
Ref: ライブラリ<207>-Footnote-1816881921
Ref: ライブラリ<207>-Footnote-1826881988
Ref: ライブラリ<207>-Footnote-1836882055
Ref: ライブラリ<207>-Footnote-1846882122
Ref: ライブラリ<207>-Footnote-1856882189
Ref: ライブラリ<207>-Footnote-1866882256
Ref: ライブラリ<207>-Footnote-1876882323
Ref: ライブラリ<207>-Footnote-1886882390
Ref: ライブラリ<207>-Footnote-1896882456
Ref: ライブラリ<207>-Footnote-1906882523
Ref: ライブラリ<207>-Footnote-1916882590
Ref: ライブラリ<207>-Footnote-1926882657
Ref: ライブラリ<207>-Footnote-1936882724
Ref: ライブラリ<207>-Footnote-1946882791
Ref: ライブラリ<207>-Footnote-1956882858
Ref: ライブラリ<207>-Footnote-1966882925
Ref: ライブラリ<207>-Footnote-1976882991
Ref: ライブラリ<207>-Footnote-1986883058
Ref: ライブラリ<207>-Footnote-1996883125
Ref: ライブラリ<207>-Footnote-2006883192
Ref: ライブラリ<207>-Footnote-2016883259
Ref: ライブラリ<207>-Footnote-2026883326
Ref: ライブラリ<207>-Footnote-2036883393
Ref: ライブラリ<207>-Footnote-2046883459
Ref: ライブラリ<207>-Footnote-2056883526
Ref: ライブラリ<207>-Footnote-2066883593
Ref: ライブラリ<207>-Footnote-2076883660
Ref: ライブラリ<207>-Footnote-2086883727
Ref: ライブラリ<207>-Footnote-2096883794
Ref: ライブラリ<207>-Footnote-2106883861
Ref: ライブラリ<207>-Footnote-2116883928
Ref: ライブラリ<207>-Footnote-2126883995
Ref: ライブラリ<207>-Footnote-2136884062
Ref: ライブラリ<207>-Footnote-2146884129
Ref: ライブラリ<207>-Footnote-2156884196
Ref: ライブラリ<207>-Footnote-2166884263
Ref: ライブラリ<207>-Footnote-2176884330
Ref: ライブラリ<207>-Footnote-2186884397
Ref: ライブラリ<207>-Footnote-2196884464
Ref: ライブラリ<207>-Footnote-2206884531
Ref: ライブラリ<207>-Footnote-2216884598
Ref: ライブラリ<207>-Footnote-2226884665
Ref: ライブラリ<207>-Footnote-2236884732
Ref: ライブラリ<207>-Footnote-2246884799
Ref: ライブラリ<207>-Footnote-2256884865
Ref: ライブラリ<207>-Footnote-2266884931
Ref: ライブラリ<207>-Footnote-2276884998
Ref: ライブラリ<207>-Footnote-2286885065
Ref: ライブラリ<207>-Footnote-2296885132
Ref: ライブラリ<207>-Footnote-2306885199
Ref: ライブラリ<207>-Footnote-2316885266
Ref: ライブラリ<207>-Footnote-2326885333
Ref: ライブラリ<207>-Footnote-2336885400
Ref: ライブラリ<207>-Footnote-2346885467
Ref: ライブラリ<207>-Footnote-2356885534
Ref: ライブラリ<207>-Footnote-2366885601
Ref: ライブラリ<207>-Footnote-2376885668
Ref: ライブラリ<207>-Footnote-2386885735
Ref: ライブラリ<207>-Footnote-2396885802
Ref: ライブラリ<207>-Footnote-2406885869
Ref: ライブラリ<207>-Footnote-2416885936
Ref: ライブラリ<207>-Footnote-2426886003
Ref: ライブラリ<207>-Footnote-2436886070
Ref: ライブラリ<207>-Footnote-2446886137
Ref: ライブラリ<207>-Footnote-2456886204
Ref: ライブラリ<207>-Footnote-2466886270
Ref: ライブラリ<207>-Footnote-2476886337
Ref: ライブラリ<207>-Footnote-2486886404
Ref: ライブラリ<207>-Footnote-2496886471
Ref: ライブラリ<207>-Footnote-2506886538
Ref: ライブラリ<207>-Footnote-2516886605
Ref: ライブラリ<207>-Footnote-2526886672
Ref: ライブラリ<207>-Footnote-2536886739
Ref: ライブラリ<207>-Footnote-2546886806
Ref: ライブラリ<207>-Footnote-2556886873
Ref: ライブラリ<207>-Footnote-2566886940
Ref: ライブラリ<207>-Footnote-2576887007
Ref: ライブラリ<207>-Footnote-2586887074
Ref: ライブラリ<207>-Footnote-2596887141
Ref: ライブラリ<207>-Footnote-2606887208
Ref: ライブラリ<207>-Footnote-2616887275
Ref: ライブラリ<207>-Footnote-2626887342
Ref: ライブラリ<207>-Footnote-2636887409
Ref: ライブラリ<207>-Footnote-2646887476
Ref: ライブラリ<207>-Footnote-2656887543
Ref: ライブラリ<207>-Footnote-2666887610
Ref: ライブラリ<207>-Footnote-2676887677
Ref: ライブラリ<207>-Footnote-2686887744
Ref: ライブラリ<207>-Footnote-2696887811
Ref: ライブラリ<207>-Footnote-2706887878
Ref: ライブラリ<207>-Footnote-2716887945
Ref: ライブラリ<207>-Footnote-2726888012
Ref: ライブラリ<207>-Footnote-2736888079
Ref: ライブラリ<207>-Footnote-2746888146
Ref: ライブラリ<207>-Footnote-2756888213
Ref: ライブラリ<207>-Footnote-2766888280
Ref: ライブラリ<207>-Footnote-2776888347
Ref: ライブラリ<207>-Footnote-2786888413
Ref: ライブラリ<207>-Footnote-2796888480
Ref: ライブラリ<207>-Footnote-2806888547
Ref: ライブラリ<207>-Footnote-2816888614
Ref: ライブラリ<207>-Footnote-2826888681
Ref: ライブラリ<207>-Footnote-2836888748
Ref: ライブラリ<207>-Footnote-2846888815
Ref: ライブラリ<207>-Footnote-2856888882
Ref: ライブラリ<207>-Footnote-2866888949
Ref: ライブラリ<207>-Footnote-2876889016
Ref: ライブラリ<207>-Footnote-2886889083
Ref: ライブラリ<207>-Footnote-2896889150
Ref: ライブラリ<207>-Footnote-2906889194
Ref: ライブラリ<207>-Footnote-2916889261
Ref: ライブラリ<207>-Footnote-2926889328
Ref: ライブラリ<207>-Footnote-2936889395
Ref: ライブラリ<207>-Footnote-2946889462
Ref: ライブラリ<207>-Footnote-2956889529
Ref: ライブラリ<207>-Footnote-2966889596
Ref: ライブラリ<207>-Footnote-2976889663
Ref: ライブラリ<207>-Footnote-2986889730
Ref: ライブラリ<207>-Footnote-2996889797
Ref: ライブラリ<207>-Footnote-3006889864
Ref: ライブラリ<207>-Footnote-3016889931
Ref: ライブラリ<207>-Footnote-3026889998
Ref: ライブラリ<207>-Footnote-3036890065
Ref: ライブラリ<207>-Footnote-3046890132
Ref: ライブラリ<207>-Footnote-3056890199
Ref: ライブラリ<207>-Footnote-3066890266
Ref: ライブラリ<207>-Footnote-3076890333
Ref: ライブラリ<207>-Footnote-3086890400
Ref: ライブラリ<207>-Footnote-3096890467
Ref: ライブラリ<207>-Footnote-3106890534
Ref: ライブラリ<207>-Footnote-3116890601
Ref: ライブラリ<207>-Footnote-3126890668
Ref: ライブラリ<207>-Footnote-3136890735
Ref: ライブラリ<207>-Footnote-3146890802
Ref: ライブラリ<207>-Footnote-3156890869
Ref: ライブラリ<207>-Footnote-3166890935
Ref: ライブラリ<207>-Footnote-3176891002
Ref: ライブラリ<207>-Footnote-3186891069
Ref: ライブラリ<207>-Footnote-3196891136
Ref: ライブラリ<207>-Footnote-3206891203
Ref: ライブラリ<207>-Footnote-3216891270
Ref: ライブラリ<207>-Footnote-3226891337
Ref: ライブラリ<207>-Footnote-3236891404
Ref: ライブラリ<207>-Footnote-3246891471
Ref: ライブラリ<207>-Footnote-3256891538
Ref: ライブラリ<207>-Footnote-3266891605
Ref: ライブラリ<207>-Footnote-3276891672
Ref: ライブラリ<207>-Footnote-3286891739
Ref: ライブラリ<207>-Footnote-3296891806
Ref: ライブラリ<207>-Footnote-3306891873
Ref: ライブラリ<207>-Footnote-3316891940
Ref: ライブラリ<207>-Footnote-3326892007
Ref: ライブラリ<207>-Footnote-3336892074
Ref: ライブラリ<207>-Footnote-3346892141
Ref: ライブラリ<207>-Footnote-3356892208
Ref: ライブラリ<207>-Footnote-3366892274
Ref: ライブラリ<207>-Footnote-3376892341
Ref: ライブラリ<207>-Footnote-3386892408
Ref: ライブラリ<207>-Footnote-3396892465
Ref: ライブラリ<207>-Footnote-3406892532
Ref: ライブラリ<207>-Footnote-3416892599
Ref: ライブラリ<207>-Footnote-3426892666
Ref: ライブラリ<207>-Footnote-3436892733
Ref: ライブラリ<207>-Footnote-3446892800
Ref: ライブラリ<207>-Footnote-3456892867
Ref: ライブラリ<207>-Footnote-3466892934
Ref: ライブラリ<207>-Footnote-3476893001
Ref: ライブラリ<207>-Footnote-3486893068
Ref: ライブラリ<207>-Footnote-3496893135
Ref: ライブラリ<207>-Footnote-3506893202
Ref: ライブラリ<207>-Footnote-3516893269
Ref: ライブラリ<207>-Footnote-3526893336
Ref: ライブラリ<207>-Footnote-3536893403
Ref: ライブラリ<207>-Footnote-3546893470
Ref: ライブラリ<207>-Footnote-3556893537
Ref: ライブラリ<207>-Footnote-3566893604
Ref: ライブラリ<207>-Footnote-3576893671
Ref: ライブラリ<207>-Footnote-3586893738
Ref: ライブラリ<207>-Footnote-3596893805
Ref: ライブラリ<207>-Footnote-3606893872
Ref: ライブラリ<207>-Footnote-3616893939
Ref: ライブラリ<207>-Footnote-3626894006
Ref: ライブラリ<207>-Footnote-3636894073
Ref: ライブラリ<207>-Footnote-3646894140
Ref: ライブラリ<207>-Footnote-3656894207
Ref: ライブラリ<207>-Footnote-3666894274
Ref: ライブラリ<207>-Footnote-3676894341
Ref: ライブラリ<207>-Footnote-3686894408
Ref: ライブラリ<207>-Footnote-3696894475
Ref: ライブラリ<207>-Footnote-3706894542
Ref: ライブラリ<207>-Footnote-3716894609
Ref: ライブラリ<207>-Footnote-3726894676
Ref: ライブラリ<207>-Footnote-3736894742
Ref: ライブラリ<207>-Footnote-3746894809
Ref: ライブラリ<207>-Footnote-3756894876
Ref: ライブラリ<207>-Footnote-3766894943
Ref: ライブラリ<207>-Footnote-3776895010
Ref: ライブラリ<207>-Footnote-3786895077
Ref: ライブラリ<207>-Footnote-3796895144
Ref: ライブラリ<207>-Footnote-3806895211
Ref: ライブラリ<207>-Footnote-3816895278
Ref: ライブラリ<207>-Footnote-3826895345
Ref: ライブラリ<207>-Footnote-3836895412
Ref: ライブラリ<207>-Footnote-3846895479
Ref: ライブラリ<207>-Footnote-3856895546
Ref: ライブラリ<207>-Footnote-3866895612
Ref: ライブラリ<207>-Footnote-3876895679
Ref: ライブラリ<207>-Footnote-3886895746
Ref: ライブラリ<207>-Footnote-3896895813
Ref: ライブラリ<207>-Footnote-3906895880
Ref: ライブラリ<207>-Footnote-3916895945
Ref: ライブラリ<207>-Footnote-3926896012
Ref: ライブラリ<207>-Footnote-3936896079
Ref: ライブラリ<207>-Footnote-3946896146
Ref: ライブラリ<207>-Footnote-3956896213
Ref: ライブラリ<207>-Footnote-3966896280
Ref: ライブラリ<207>-Footnote-3976896347
Ref: ライブラリ<207>-Footnote-3986896414
Node: IDLE<63>6896481
Ref: whatsnew/changelog id10646896598
Ref: 1fb26896598
Ref: IDLE<63>-Footnote-16900080
Ref: IDLE<63>-Footnote-26900145
Ref: IDLE<63>-Footnote-36900210
Ref: IDLE<63>-Footnote-46900274
Ref: IDLE<63>-Footnote-56900339
Ref: IDLE<63>-Footnote-66900403
Ref: IDLE<63>-Footnote-76900468
Ref: IDLE<63>-Footnote-86900533
Ref: IDLE<63>-Footnote-96900598
Ref: IDLE<63>-Footnote-106900663
Ref: IDLE<63>-Footnote-116900729
Ref: IDLE<63>-Footnote-126900795
Ref: IDLE<63>-Footnote-136900861
Ref: IDLE<63>-Footnote-146900927
Ref: IDLE<63>-Footnote-156900993
Ref: IDLE<63>-Footnote-166901059
Ref: IDLE<63>-Footnote-176901125
Ref: IDLE<63>-Footnote-186901191
Ref: IDLE<63>-Footnote-196901257
Ref: IDLE<63>-Footnote-206901323
Ref: IDLE<63>-Footnote-216901389
Ref: IDLE<63>-Footnote-226901455
Ref: IDLE<63>-Footnote-236901521
Ref: IDLE<63>-Footnote-246901564
Ref: IDLE<63>-Footnote-256901630
Ref: IDLE<63>-Footnote-266901696
Node: ビルド<100>6901762
Ref: whatsnew/changelog id10656901868
Ref: 1fb36901868
Ref: ビルド<100>-Footnote-16905281
Ref: ビルド<100>-Footnote-26905346
Ref: ビルド<100>-Footnote-36905411
Ref: ビルド<100>-Footnote-46905476
Ref: ビルド<100>-Footnote-56905541
Ref: ビルド<100>-Footnote-66905606
Ref: ビルド<100>-Footnote-76905671
Ref: ビルド<100>-Footnote-86905736
Ref: ビルド<100>-Footnote-96905801
Ref: ビルド<100>-Footnote-106905866
Ref: ビルド<100>-Footnote-116905932
Ref: ビルド<100>-Footnote-126905998
Ref: ビルド<100>-Footnote-136906064
Ref: ビルド<100>-Footnote-146906130
Ref: ビルド<100>-Footnote-156906196
Ref: ビルド<100>-Footnote-166906262
Ref: ビルド<100>-Footnote-176906328
Ref: ビルド<100>-Footnote-186906394
Ref: ビルド<100>-Footnote-196906460
Ref: ビルド<100>-Footnote-206906526
Ref: ビルド<100>-Footnote-216906592
Ref: ビルド<100>-Footnote-226906658
Ref: ビルド<100>-Footnote-236906724
Ref: ビルド<100>-Footnote-246906790
Ref: ビルド<100>-Footnote-256906856
Ref: ビルド<100>-Footnote-266906922
Node: C API<79>6906988
Ref: whatsnew/changelog id10666907108
Ref: 1fb46907108
Ref: C API<79>-Footnote-16908473
Ref: C API<79>-Footnote-26908538
Ref: C API<79>-Footnote-36908603
Ref: C API<79>-Footnote-46908668
Ref: C API<79>-Footnote-56908733
Ref: C API<79>-Footnote-66908798
Ref: C API<79>-Footnote-76908863
Node: ドキュメント<85>6908928
Ref: whatsnew/changelog id10676909047
Ref: 1fb56909047
Ref: ドキュメント<85>-Footnote-16910858
Ref: ドキュメント<85>-Footnote-26910923
Ref: ドキュメント<85>-Footnote-36910988
Ref: ドキュメント<85>-Footnote-46911053
Ref: ドキュメント<85>-Footnote-56911118
Ref: ドキュメント<85>-Footnote-66911182
Ref: ドキュメント<85>-Footnote-76911247
Ref: ドキュメント<85>-Footnote-86911312
Ref: ドキュメント<85>-Footnote-96911377
Ref: ドキュメント<85>-Footnote-106911442
Ref: ドキュメント<85>-Footnote-116911508
Node: テスト<88>6911574
Ref: whatsnew/changelog id10686911699
Ref: 1fb66911699
Ref: テスト<88>-Footnote-16915895
Ref: テスト<88>-Footnote-26915960
Ref: テスト<88>-Footnote-36916025
Ref: テスト<88>-Footnote-46916090
Ref: テスト<88>-Footnote-56916155
Ref: テスト<88>-Footnote-66916220
Ref: テスト<88>-Footnote-76916285
Ref: テスト<88>-Footnote-86916350
Ref: テスト<88>-Footnote-96916415
Ref: テスト<88>-Footnote-106916480
Ref: テスト<88>-Footnote-116916546
Ref: テスト<88>-Footnote-126916612
Ref: テスト<88>-Footnote-136916678
Ref: テスト<88>-Footnote-146916744
Ref: テスト<88>-Footnote-156916809
Ref: テスト<88>-Footnote-166916875
Ref: テスト<88>-Footnote-176916941
Ref: テスト<88>-Footnote-186917007
Ref: テスト<88>-Footnote-196917073
Ref: テスト<88>-Footnote-206917139
Ref: テスト<88>-Footnote-216917205
Ref: テスト<88>-Footnote-226917271
Ref: テスト<88>-Footnote-236917337
Ref: テスト<88>-Footnote-246917403
Ref: テスト<88>-Footnote-256917469
Ref: テスト<88>-Footnote-266917535
Ref: テスト<88>-Footnote-276917601
Ref: テスト<88>-Footnote-286917667
Ref: テスト<88>-Footnote-296917733
Ref: テスト<88>-Footnote-306917799
Ref: テスト<88>-Footnote-316917865
Ref: テスト<88>-Footnote-326917931
Ref: テスト<88>-Footnote-336917997
Ref: テスト<88>-Footnote-346918063
Ref: テスト<88>-Footnote-356918129
Ref: テスト<88>-Footnote-366918195
Ref: テスト<88>-Footnote-376918261
Node: Tools/Demos<61>6918327
Ref: whatsnew/changelog id10696918441
Ref: 1fb76918441
Ref: Tools/Demos<61>-Footnote-16920103
Ref: Tools/Demos<61>-Footnote-26920168
Ref: Tools/Demos<61>-Footnote-36920233
Ref: Tools/Demos<61>-Footnote-46920298
Ref: Tools/Demos<61>-Footnote-56920363
Ref: Tools/Demos<61>-Footnote-66920428
Ref: Tools/Demos<61>-Footnote-76920493
Ref: Tools/Demos<61>-Footnote-86920558
Ref: Tools/Demos<61>-Footnote-96920623
Ref: Tools/Demos<61>-Footnote-106920688
Ref: Tools/Demos<61>-Footnote-116920731
Ref: Tools/Demos<61>-Footnote-126920797
Ref: Tools/Demos<61>-Footnote-136920863
Node: Windows<83>6920929
Ref: whatsnew/changelog id10706921021
Ref: 1fb86921021
Ref: Windows<83>-Footnote-16922228
Ref: Windows<83>-Footnote-26922293
Ref: Windows<83>-Footnote-36922358
Ref: Windows<83>-Footnote-46922423
Ref: Windows<83>-Footnote-56922488
Ref: Windows<83>-Footnote-66922553
Ref: Windows<83>-Footnote-76922618
Node: Python チュートリアル6922683
Ref: tutorial/index doc6922826
Ref: 1fb96922826
Ref: tutorial/index the-python-tutorial6922826
Ref: 1fba6922826
Ref: tutorial/index translation-repo6922826
Ref: 1fbb6922826
Ref: tutorial/index tutorial-index6922826
Ref: 1fbc6922826
Node: やる気を高めよう6926667
Ref: tutorial/appetite doc6926799
Ref: 1fc06926799
Ref: tutorial/appetite tut-intro6926799
Ref: 1fc16926799
Ref: tutorial/appetite whetting-your-appetite6926799
Ref: 1fc26926799
Node: Python インタプリタを使う6933048
Ref: tutorial/interpreter doc6933224
Ref: 1fc36933224
Ref: tutorial/interpreter translation-repo6933224
Ref: 1fc46933224
Ref: tutorial/interpreter tut-using6933224
Ref: 1fc56933224
Ref: tutorial/interpreter using-the-python-interpreter6933224
Ref: 1fc66933224
Node: インタプリタを起動する6933380
Ref: tutorial/interpreter invoking-the-interpreter6933526
Ref: 1fc76933526
Ref: tutorial/interpreter tut-invoking6933526
Ref: 1fc86933526
Ref: インタプリタを起動する-Footnote-16937392
Node: 引数の受け渡し6937664
Ref: tutorial/interpreter argument-passing6937779
Ref: 1fcc6937779
Ref: tutorial/interpreter tut-argpassing6937779
Ref: 1fcd6937779
Node: 対話モード6938983
Ref: tutorial/interpreter interactive-mode6939098
Ref: 1fce6939098
Ref: tutorial/interpreter tut-interactive6939098
Ref: 4436939098
Node: インタプリタとその環境6940533
Ref: tutorial/interpreter the-interpreter-and-its-environment6940679
Ref: 1fcf6940679
Ref: tutorial/interpreter tut-interp6940679
Ref: 1fd06940679
Node: ソースコードの文字コード6940800
Ref: tutorial/interpreter source-code-encoding6940906
Ref: 1fd16940906
Ref: tutorial/interpreter tut-source-encoding6940906
Ref: 1fd26940906
Node: 形式ばらない Python の紹介6942619
Ref: tutorial/introduction doc6942807
Ref: 1fd46942807
Ref: tutorial/introduction an-informal-introduction-to-python6942807
Ref: 1fd56942807
Ref: tutorial/introduction translation-repo6942807
Ref: 1fd66942807
Ref: tutorial/introduction tut-informal6942807
Ref: 1fd76942807
Node: Python を電卓として使う6944289
Ref: tutorial/introduction tut-calculator6944437
Ref: 1fd86944437
Ref: tutorial/introduction using-python-as-a-calculator6944437
Ref: 1fd96944437
Node: 数6944822
Ref: tutorial/introduction numbers6944914
Ref: 1fda6944914
Ref: tutorial/introduction tut-numbers6944914
Ref: 1fdb6944914
Ref: 数-Footnote-16948320
Node: テキスト6948558
Ref: tutorial/introduction text6948676
Ref: 1fdd6948676
Ref: tutorial/introduction tut-strings6948676
Ref: 1fde6948676
Ref: テキスト-Footnote-16958720
Node: リスト型 list6959109
Ref: tutorial/introduction lists6959215
Ref: 1fe26959215
Ref: tutorial/introduction tut-lists6959215
Ref: 1fe36959215
Node: プログラミングへの第一歩6962957
Ref: tutorial/introduction first-steps-towards-programming6963105
Ref: 1fe56963105
Ref: tutorial/introduction tut-firststeps6963105
Ref: 1fe66963105
Ref: プログラミングへの第一歩-Footnote-16967013
Node: その他の制御フローツール6967070
Ref: tutorial/controlflow doc6967239
Ref: 1fe76967239
Ref: tutorial/controlflow more-control-flow-tools6967239
Ref: 1fe86967239
Ref: tutorial/controlflow translation-repo6967239
Ref: 1fe96967239
Ref: tutorial/controlflow tut-morecontrol6967239
Ref: 1fea6967239
Node: if 文6967763
Ref: tutorial/controlflow if-statements6967858
Ref: 1feb6967858
Ref: tutorial/controlflow tut-if6967858
Ref: 1fec6967858
Node: for 文6968935
Ref: tutorial/controlflow for-statements6969051
Ref: 1fee6969051
Ref: tutorial/controlflow tut-for6969051
Ref: 1fef6969051
Node: range 関数6970731
Ref: tutorial/controlflow the-range-function6970866
Ref: 1ff06970866
Ref: tutorial/controlflow tut-range6970866
Ref: 1ff16970866
Node: break 文と continue 文6973371
Ref: tutorial/controlflow break-and-continue-statements6973520
Ref: 1ff46973520
Ref: tutorial/controlflow tut-break6973520
Ref: 1ff56973520
Ref: tutorial/controlflow tut-for-else6974639
Ref: 1ff66974639
Node: ループの else 節6974640
Ref: tutorial/controlflow break-and-continue-statements-and-else-clauses-on-loops6974785
Ref: 1ff76974785
Ref: tutorial/controlflow else-clauses-on-loops6974785
Ref: 1ff86974785
Node: pass 文6977244
Ref: tutorial/controlflow pass-statements6977373
Ref: 1ffa6977373
Ref: tutorial/controlflow tut-pass6977373
Ref: 1ffb6977373
Node: match 文6978709
Ref: tutorial/controlflow match-statements6978838
Ref: 1ffd6978838
Ref: tutorial/controlflow tut-match6978838
Ref: 1fed6978838
Ref: match 文-Footnote-16986644
Node: 関数を定義する6986686
Ref: tutorial/controlflow defining-functions6986843
Ref: 1ffe6986843
Ref: tutorial/controlflow tut-functions6986843
Ref: 1fff6986843
Ref: 関数を定義する-Footnote-16993543
Node: 関数定義についてもう少し6993948
Ref: tutorial/controlflow more-on-defining-functions6994136
Ref: 20026994136
Ref: tutorial/controlflow tut-defining6994136
Ref: 20036994136
Node: デフォルトの引数値6994651
Ref: tutorial/controlflow default-argument-values6994781
Ref: 20046994781
Ref: tutorial/controlflow tut-defaultargs6994781
Ref: 20056994781
Node: キーワード引数6997125
Ref: tutorial/controlflow keyword-arguments6997288
Ref: 20066997288
Ref: tutorial/controlflow tut-keywordargs6997288
Ref: 20076997288
Node: 特殊なパラメータ7001434
Ref: tutorial/controlflow special-parameters7001591
Ref: 20097001591
Node: 位置またはキーワード引数7002938
Ref: tutorial/controlflow positional-or-keyword-arguments7003065
Ref: 200a7003065
Node: 位置専用引数<2>7003273
Ref: tutorial/controlflow positional-only-parameters7003436
Ref: 200b7003436
Node: キーワード専用引数7004104
Ref: tutorial/controlflow keyword-only-arguments7004243
Ref: 200c7004243
Node: 関数の例7004546
Ref: tutorial/controlflow function-examples7004670
Ref: 200d7004670
Node: 要約7007992
Ref: tutorial/controlflow recap7008080
Ref: 200e7008080
Node: 任意引数リスト7009141
Ref: tutorial/controlflow arbitrary-argument-lists7009310
Ref: 200f7009310
Ref: tutorial/controlflow tut-arbitraryargs7009310
Ref: 20107009310
Node: 引数リストのアンパック7010398
Ref: tutorial/controlflow tut-unpacking-arguments7010555
Ref: 20117010555
Ref: tutorial/controlflow unpacking-argument-lists7010555
Ref: 20127010555
Node: ラムダ式7011984
Ref: tutorial/controlflow lambda-expressions7012159
Ref: 20137012159
Ref: tutorial/controlflow tut-lambda7012159
Ref: 20147012159
Node: ドキュメンテーション文字列7013536
Ref: tutorial/controlflow documentation-strings7013708
Ref: 20157013708
Ref: tutorial/controlflow tut-docstrings7013708
Ref: 20007013708
Node: 関数のアノテーション7015352
Ref: tutorial/controlflow function-annotations7015503
Ref: 20167015503
Ref: tutorial/controlflow tut-annotations7015503
Ref: 20177015503
Ref: 関数のアノテーション-Footnote-17016931
Ref: 関数のアノテーション-Footnote-27016973
Node: 間奏曲 コーディングスタイル7017015
Ref: tutorial/controlflow intermezzo-coding-style7017173
Ref: 201a7017173
Ref: tutorial/controlflow tut-codingstyle7017173
Ref: 201b7017173
Ref: 間奏曲 コーディングスタイル-Footnote-17019979
Node: データ構造7020021
Ref: tutorial/datastructures doc7020173
Ref: 201d7020173
Ref: tutorial/datastructures data-structures7020173
Ref: 201e7020173
Ref: tutorial/datastructures translation-repo7020173
Ref: 201f7020173
Ref: tutorial/datastructures tut-structures7020173
Ref: 1ff37020173
Node: リスト型についてもう少し7020627
Ref: tutorial/datastructures more-on-lists7020731
Ref: 20207020731
Ref: tutorial/datastructures tut-morelists7020731
Ref: 20217020731
Ref: リスト型についてもう少し-Footnote-17025497
Node: リストをスタックとして使う7025695
Ref: tutorial/datastructures tut-lists-as-stacks7025852
Ref: 20237025852
Ref: tutorial/datastructures using-lists-as-stacks7025852
Ref: 20247025852
Node: リストをキューとして使う7026673
Ref: tutorial/datastructures tut-lists-as-queues7026866
Ref: 20267026866
Ref: tutorial/datastructures using-lists-as-queues7026866
Ref: 20277026866
Node: リストの内包表記<2>7028317
Ref: tutorial/datastructures list-comprehensions7028510
Ref: 20287028510
Ref: tutorial/datastructures tut-listcomps7028510
Ref: 20297028510
Node: ネストしたリストの内包表記7032258
Ref: tutorial/datastructures nested-list-comprehensions7032406
Ref: 202a7032406
Node: del 文7034274
Ref: tutorial/datastructures the-del-statement7034414
Ref: 202b7034414
Ref: tutorial/datastructures tut-del7034414
Ref: 202c7034414
Node: タプルとシーケンス7035423
Ref: tutorial/datastructures tuples-and-sequences7035536
Ref: 202d7035536
Ref: tutorial/datastructures tut-tuples7035536
Ref: 20087035536
Node: 集合型7039393
Ref: tutorial/datastructures sets7039519
Ref: 202f7039519
Ref: tutorial/datastructures tut-sets7039519
Ref: 20307039519
Node: 辞書型 dictionary7041556
Ref: tutorial/datastructures dictionaries7041682
Ref: 20327041682
Ref: tutorial/datastructures tut-dictionaries7041682
Ref: 20337041682
Node: ループのテクニック7045925
Ref: tutorial/datastructures looping-techniques7046072
Ref: 20357046072
Ref: tutorial/datastructures tut-loopidioms7046072
Ref: 1ff27046072
Node: 条件についてもう少し7049124
Ref: tutorial/datastructures more-on-conditions7049293
Ref: 20367049293
Ref: tutorial/datastructures tut-conditions7049293
Ref: 20377049293
Node: シーケンスとその他の型の比較7051977
Ref: tutorial/datastructures comparing-sequences-and-other-types7052110
Ref: 20397052110
Ref: tutorial/datastructures tut-comparing7052110
Ref: 203a7052110
Node: モジュール<2>7054146
Ref: tutorial/modules doc7054277
Ref: 203b7054277
Ref: tutorial/modules modules7054277
Ref: 203c7054277
Ref: tutorial/modules translation-repo7054277
Ref: 203d7054277
Ref: tutorial/modules tut-modules7054277
Ref: 203e7054277
Node: モジュールについてもうすこし7057653
Ref: tutorial/modules more-on-modules7057780
Ref: 20417057780
Ref: tutorial/modules tut-moremodules7057780
Ref: 20427057780
Ref: モジュールについてもうすこし-Footnote-17062322
Node: モジュールをスクリプトとして実行する7062542
Ref: tutorial/modules executing-modules-as-scripts7062711
Ref: 20437062711
Ref: tutorial/modules tut-modulesasscripts7062711
Ref: 20447062711
Node: モジュール検索パス7063939
Ref: tutorial/modules the-module-search-path7064164
Ref: 20457064164
Ref: tutorial/modules tut-searchpath7064164
Ref: 20467064164
Node: "コンパイル" された Python ファイル7066360
Ref: tutorial/modules compiled-python-files7066522
Ref: 20497066522
Ref: tutorial/modules tut-pycache7066522
Ref: 8eb7066522
Ref: "コンパイル" された Python ファイル-Footnote-17070064
Node: 標準モジュール7070106
Ref: tutorial/modules standard-modules7070252
Ref: 204a7070252
Ref: tutorial/modules tut-standardmodules7070252
Ref: 20487070252
Node: dir 関数7072010
Ref: tutorial/modules the-dir-function7072129
Ref: 204b7072129
Ref: tutorial/modules tut-dir7072129
Ref: 204c7072129
Node: パッケージ7076850
Ref: tutorial/modules packages7076939
Ref: 204d7076939
Ref: tutorial/modules tut-packages7076939
Ref: 204e7076939
Node: パッケージから * を import する7082833
Ref: tutorial/modules importing-from-a-package7082959
Ref: 204f7082959
Ref: tutorial/modules tut-pkg-import-star7082959
Ref: 20507082959
Node: パッケージ内参照7087690
Ref: tutorial/modules id27087870
Ref: 20517087870
Ref: tutorial/modules intra-package-references7087870
Ref: 20527087870
Node: 複数ディレクトリ中のパッケージ7089132
Ref: tutorial/modules packages-in-multiple-directories7089262
Ref: 20537089262
Node: 入力と出力7090111
Ref: tutorial/inputoutput doc7090245
Ref: 20557090245
Ref: tutorial/inputoutput input-and-output7090245
Ref: 20567090245
Ref: tutorial/inputoutput translation-repo7090245
Ref: 20577090245
Ref: tutorial/inputoutput tut-io7090245
Ref: 20587090245
Node: 出力を見やすくフォーマットする7090679
Ref: tutorial/inputoutput fancier-output-formatting7090818
Ref: 20597090818
Ref: tutorial/inputoutput tut-formatting7090818
Ref: 205a7090818
Node: フォーマット済み文字列リテラル7095744
Ref: tutorial/inputoutput formatted-string-literals7095912
Ref: 205d7095912
Ref: tutorial/inputoutput tut-f-strings7095912
Ref: 205c7095912
Node: 文字列の format メソッド7098302
Ref: tutorial/inputoutput the-string-format-method7098524
Ref: 205e7098524
Ref: tutorial/inputoutput tut-string-format7098524
Ref: 205f7098524
Node: 文字列の手作業でのフォーマット7101659
Ref: tutorial/inputoutput manual-string-formatting7101869
Ref: 20607101869
Node: 古い文字列書式設定方法7103845
Ref: tutorial/inputoutput old-string-formatting7104014
Ref: 20647104014
Node: ファイルを読み書きする7104672
Ref: tutorial/inputoutput reading-and-writing-files7104811
Ref: 20657104811
Ref: tutorial/inputoutput tut-files7104811
Ref: 20667104811
Node: ファイルオブジェクトのメソッド7109061
Ref: tutorial/inputoutput methods-of-file-objects7109235
Ref: 20677109235
Ref: tutorial/inputoutput tut-filemethods7109235
Ref: 20687109235
Node: json による構造化されたデータの保存7114228
Ref: tutorial/inputoutput saving-structured-data-with-json7114402
Ref: 206a7114402
Ref: tutorial/inputoutput tut-json7114402
Ref: 206b7114402
Ref: json による構造化されたデータの保存-Footnote-17118260
Node: エラーと例外7118285
Ref: tutorial/errors doc7118410
Ref: 206f7118410
Ref: tutorial/errors errors-and-exceptions7118410
Ref: 20707118410
Ref: tutorial/errors translation-repo7118410
Ref: 20717118410
Ref: tutorial/errors tut-errors7118410
Ref: 20727118410
Node: 構文エラー7119194
Ref: tutorial/errors syntax-errors7119279
Ref: 20737119279
Ref: tutorial/errors tut-syntaxerrors7119279
Ref: 20747119279
Node: 例外7120319
Ref: tutorial/errors exceptions7120434
Ref: 20757120434
Ref: tutorial/errors tut-exceptions7120434
Ref: 20767120434
Node: 例外を処理する7122805
Ref: tutorial/errors handling-exceptions7122926
Ref: 20777122926
Ref: tutorial/errors tut-handling7122926
Ref: 1ff97122926
Node: 例外を送出する7130934
Ref: tutorial/errors raising-exceptions7131064
Ref: 20787131064
Ref: tutorial/errors tut-raising7131064
Ref: 20797131064
Node: 例外の連鎖7132464
Ref: tutorial/errors exception-chaining7132597
Ref: 207a7132597
Ref: tutorial/errors tut-exception-chaining7132597
Ref: 207b7132597
Node: ユーザー定義例外7134896
Ref: tutorial/errors tut-userexceptions7135050
Ref: 207c7135050
Ref: tutorial/errors user-defined-exceptions7135050
Ref: 207d7135050
Node: クリーンアップ動作を定義する7136110
Ref: tutorial/errors defining-clean-up-actions7136288
Ref: 207e7136288
Ref: tutorial/errors tut-cleanup7136288
Ref: 207f7136288
Ref: クリーンアップ動作を定義する-Footnote-17140333
Ref: クリーンアップ動作を定義する-Footnote-27140375
Node: 定義済みクリーンアップ処理7140417
Ref: tutorial/errors predefined-clean-up-actions7140619
Ref: 20807140619
Ref: tutorial/errors tut-cleanup-with7140619
Ref: 20817140619
Node: 複数の関連しない例外の送出と処理7141917
Ref: tutorial/errors raising-and-handling-multiple-unrelated-exceptions7142122
Ref: 20827142122
Ref: tutorial/errors tut-exception-groups7142122
Ref: 20837142122
Node: ノートによって例外を充実させる7145837
Ref: tutorial/errors enriching-exceptions-with-notes7145994
Ref: 20847145994
Ref: tutorial/errors tut-exception-notes7145994
Ref: 20857145994
Node: クラス7149014
Ref: tutorial/classes doc7149160
Ref: 20867149160
Ref: tutorial/classes classes7149160
Ref: 20877149160
Ref: tutorial/classes translation-repo7149160
Ref: 20887149160
Ref: tutorial/classes tut-classes7149160
Ref: 20017149160
Node: 名前とオブジェクトについて7152560
Ref: tutorial/classes a-word-about-names-and-objects7152691
Ref: 208a7152691
Ref: tutorial/classes tut-object7152691
Ref: 208b7152691
Node: Python のスコープと名前空間7154014
Ref: tutorial/classes python-scopes-and-namespaces7154169
Ref: 208c7154169
Ref: tutorial/classes tut-scopes7154169
Ref: 20407154169
Ref: Python のスコープと名前空間-Footnote-17162405
Node: スコープと名前空間の例7162941
Ref: tutorial/classes scopes-and-namespaces-example7163048
Ref: 208e7163048
Ref: tutorial/classes tut-scopeexample7163048
Ref: 208f7163048
Node: クラス初見7164536
Ref: tutorial/classes a-first-look-at-classes7164676
Ref: 20907164676
Ref: tutorial/classes tut-firstclasses7164676
Ref: 201c7164676
Node: クラス定義の構文7165069
Ref: tutorial/classes class-definition-syntax7165181
Ref: 20917165181
Ref: tutorial/classes tut-classdefinition7165181
Ref: 20927165181
Node: クラスオブジェクト7167124
Ref: tutorial/classes class-objects7167281
Ref: 20937167281
Ref: tutorial/classes tut-classobjects7167281
Ref: 20947167281
Node: インスタンスオブジェクト7170214
Ref: tutorial/classes instance-objects7170377
Ref: 20967170377
Ref: tutorial/classes tut-instanceobjects7170377
Ref: 20977170377
Node: メソッドオブジェクト7172206
Ref: tutorial/classes method-objects7172378
Ref: 20987172378
Ref: tutorial/classes tut-methodobjects7172378
Ref: 20997172378
Node: クラスとインスタンス変数7174863
Ref: tutorial/classes class-and-instance-variables7174990
Ref: 209a7174990
Ref: tutorial/classes tut-class-and-instance-variables7174990
Ref: 209b7174990
Node: いろいろな注意点7177239
Ref: tutorial/classes random-remarks7177348
Ref: 209c7177348
Ref: tutorial/classes tut-remarks7177348
Ref: 209d7177348
Node: 継承7182499
Ref: tutorial/classes inheritance7182617
Ref: 209e7182617
Ref: tutorial/classes tut-inheritance7182617
Ref: 209f7182617
Node: 多重継承7186491
Ref: tutorial/classes multiple-inheritance7186546
Ref: 20a07186546
Ref: tutorial/classes tut-multiple7186546
Ref: 20a17186546
Node: プライベート変数7189048
Ref: tutorial/classes private-variables7189163
Ref: 20a27189163
Ref: tutorial/classes tut-private7189163
Ref: 20897189163
Node: 残りのはしばし7192652
Ref: tutorial/classes odds-and-ends7192785
Ref: 20a47192785
Ref: tutorial/classes tut-odds7192785
Ref: 20a57192785
Node: イテレータ iterator7194224
Ref: tutorial/classes iterators7194361
Ref: 20a87194361
Ref: tutorial/classes tut-iterators7194361
Ref: 20a97194361
Node: ジェネレータ generator7197160
Ref: tutorial/classes generators7197297
Ref: 20ab7197297
Ref: tutorial/classes tut-generators7197297
Ref: 20ac7197297
Node: ジェネレータ式7199235
Ref: tutorial/classes generator-expressions7199339
Ref: 20af7199339
Ref: tutorial/classes tut-genexps7199339
Ref: 20b07199339
Node: 標準ライブラリミニツアー7200515
Ref: tutorial/stdlib doc7200692
Ref: 20b17200692
Ref: tutorial/stdlib brief-tour-of-the-standard-library7200692
Ref: 20b27200692
Ref: tutorial/stdlib translation-repo7200692
Ref: 20b37200692
Ref: tutorial/stdlib tut-brieftour7200692
Ref: 20b47200692
Node: OSへのインターフェース7201176
Ref: tutorial/stdlib operating-system-interface7201332
Ref: 20b57201332
Ref: tutorial/stdlib tut-os-interface7201332
Ref: 20b67201332
Node: ファイルのワイルドカード表記7202859
Ref: tutorial/stdlib file-wildcards7203051
Ref: 20b77203051
Ref: tutorial/stdlib tut-file-wildcards7203051
Ref: 20b87203051
Node: コマンドライン引数7203407
Ref: tutorial/stdlib command-line-arguments7203630
Ref: 20b97203630
Ref: tutorial/stdlib tut-command-line-arguments7203630
Ref: 20ba7203630
Node: エラー出力のリダイレクトとプログラムの終了7205005
Ref: tutorial/stdlib error-output-redirection-and-program-termination7205225
Ref: 20bb7205225
Ref: tutorial/stdlib tut-stderr7205225
Ref: 20bc7205225
Node: 文字列のパターンマッチング7205848
Ref: tutorial/stdlib string-pattern-matching7206047
Ref: 20bd7206047
Ref: tutorial/stdlib tut-string-pattern-matching7206047
Ref: 20be7206047
Node: 数学7206766
Ref: tutorial/stdlib mathematics7206941
Ref: 20bf7206941
Ref: tutorial/stdlib tut-mathematics7206941
Ref: 20c07206941
Node: インターネットへのアクセス7208281
Ref: tutorial/stdlib internet-access7208432
Ref: 20c17208432
Ref: tutorial/stdlib tut-internet-access7208432
Ref: 20c27208432
Node: 日付と時刻7209669
Ref: tutorial/stdlib dates-and-times7209829
Ref: 20c37209829
Ref: tutorial/stdlib tut-dates-and-times7209829
Ref: 20c47209829
Node: データ圧縮7210823
Ref: tutorial/stdlib data-compression7210974
Ref: 20c57210974
Ref: tutorial/stdlib tut-data-compression7210974
Ref: 20c67210974
Node: パフォーマンスの計測7211538
Ref: tutorial/stdlib performance-measurement7211686
Ref: 20c77211686
Ref: tutorial/stdlib tut-performance-measurement7211686
Ref: 20c87211686
Node: 品質管理7212839
Ref: tutorial/stdlib quality-control7212993
Ref: 20c97212993
Ref: tutorial/stdlib tut-quality-control7212993
Ref: 20ca7212993
Node: バッテリー同梱7214885
Ref: tutorial/stdlib batteries-included7215000
Ref: 20cb7215000
Ref: tutorial/stdlib tut-batteries-included7215000
Ref: 20cc7215000
Ref: バッテリー同梱-Footnote-17217418
Node: 標準ライブラリミニツアー --- その 27217477
Ref: tutorial/stdlib2 doc7217675
Ref: 20cd7217675
Ref: tutorial/stdlib2 brief-tour-of-the-standard-library-part-ii7217675
Ref: 20ce7217675
Ref: tutorial/stdlib2 translation-repo7217675
Ref: 20cf7217675
Ref: tutorial/stdlib2 tut-brieftourtwo7217675
Ref: 20d07217675
Node: 出力のフォーマット7218318
Ref: tutorial/stdlib2 output-formatting7218467
Ref: 20d17218467
Ref: tutorial/stdlib2 tut-output-formatting7218467
Ref: 20d27218467
Node: 文字列テンプレート7220897
Ref: tutorial/stdlib2 templating7221097
Ref: 20d37221097
Ref: tutorial/stdlib2 tut-templating7221097
Ref: 20d47221097
Node: バイナリデータレコードの操作7224454
Ref: tutorial/stdlib2 tut-binary-formats7224660
Ref: 20d77224660
Ref: tutorial/stdlib2 working-with-binary-data-record-layouts7224660
Ref: 20d87224660
Node: マルチスレッディング<2>7226023
Ref: tutorial/stdlib2 multi-threading7226214
Ref: 20d97226214
Ref: tutorial/stdlib2 tut-multi-threading7226214
Ref: 20da7226214
Node: ログ記録7228671
Ref: tutorial/stdlib2 logging7228829
Ref: 20db7228829
Ref: tutorial/stdlib2 tut-logging7228829
Ref: 20dc7228829
Node: 弱参照7230405
Ref: tutorial/stdlib2 tut-weak-references7230566
Ref: 20e37230566
Ref: tutorial/stdlib2 weak-references7230566
Ref: 20e47230566
Node: リスト操作のためのツール7232714
Ref: tutorial/stdlib2 tools-for-working-with-lists7232887
Ref: 20e57232887
Ref: tutorial/stdlib2 tut-list-tools7232887
Ref: 20e67232887
Node: 10 進浮動小数演算7235840
Ref: tutorial/stdlib2 decimal-floating-point-arithmetic7235995
Ref: 20e77235995
Ref: tutorial/stdlib2 tut-decimal-fp7235995
Ref: 20e87235995
Node: 仮想環境とパッケージ7238321
Ref: tutorial/venv doc7238498
Ref: 20e97238498
Ref: tutorial/venv translation-repo7238498
Ref: 20ea7238498
Ref: tutorial/venv tut-venv7238498
Ref: 20eb7238498
Ref: tutorial/venv virtual-environments-and-packages7238498
Ref: 20ec7238498
Node: はじめに<4>7238672
Ref: tutorial/venv introduction7238784
Ref: 20ed7238784
Node: 仮想環境の作成7240594
Ref: tutorial/venv creating-virtual-environments7240752
Ref: 20ef7240752
Node: pip を使ったパッケージ管理7243108
Ref: tutorial/venv managing-packages-with-pip7243242
Ref: 20f07243242
Ref: pip を使ったパッケージ管理-Footnote-17247813
Ref: pip を使ったパッケージ管理-Footnote-27247838
Node: さあ何を？7247916
Ref: tutorial/whatnow doc7248077
Ref: 20f17248077
Ref: tutorial/whatnow translation-repo7248077
Ref: 20f27248077
Ref: tutorial/whatnow tut-whatnow7248077
Ref: 20f37248077
Ref: tutorial/whatnow what-now7248077
Ref: 20f47248077
Ref: さあ何を？-Footnote-17252350
Node: 対話入力編集と履歴置換7252493
Ref: tutorial/interactive doc7252669
Ref: 20f67252669
Ref: tutorial/interactive interactive-input-editing-and-history-substitution7252669
Ref: 20f77252669
Ref: tutorial/interactive translation-repo7252669
Ref: 20f87252669
Ref: tutorial/interactive tut-interacting7252669
Ref: 1fcb7252669
Ref: 対話入力編集と履歴置換-Footnote-17253365
Node: タブ補完と履歴編集7253426
Ref: tutorial/interactive tab-completion-and-history-editing7253571
Ref: 20f97253571
Ref: tutorial/interactive tut-keybindings7253571
Ref: 20fa7253571
Node: 対話的インタープリタの代替7254670
Ref: tutorial/interactive alternatives-to-the-interactive-interpreter7254815
Ref: 20fb7254815
Ref: tutorial/interactive tut-commentary7254815
Ref: 20fc7254815
Ref: 対話的インタープリタの代替-Footnote-17256012
Ref: 対話的インタープリタの代替-Footnote-27256041
Node: 浮動小数点演算、その問題と制限7256082
Ref: tutorial/floatingpoint doc7256249
Ref: 20fe7256249
Ref: tutorial/floatingpoint floating-point-arithmetic-issues-and-limitations7256249
Ref: 20ff7256249
Ref: tutorial/floatingpoint translation-repo7256249
Ref: 21007256249
Ref: tutorial/floatingpoint tut-fp-issues7256249
Ref: 21017256249
Ref: 浮動小数点演算、その問題と制限-Footnote-17267443
Ref: 浮動小数点演算、その問題と制限-Footnote-27267521
Node: 表現エラー7267572
Ref: tutorial/floatingpoint representation-error7267669
Ref: 21047267669
Ref: tutorial/floatingpoint tut-fp-error7267669
Ref: 21057267669
Node: 付録7271744
Ref: tutorial/appendix doc7271869
Ref: 21067271869
Ref: tutorial/appendix appendix7271869
Ref: 21077271869
Ref: tutorial/appendix translation-repo7271869
Ref: 21087271869
Ref: tutorial/appendix tut-appendix7271869
Ref: 21097271869
Node: 対話モード<2>7271941
Ref: tutorial/appendix interactive-mode7272002
Ref: 210a7272002
Ref: tutorial/appendix tut-interac7272002
Ref: 4947272002
Node: エラー処理7273321
Ref: tutorial/appendix error-handling7273438
Ref: 210b7273438
Ref: tutorial/appendix tut-error7273438
Ref: 210c7273438
Ref: エラー処理-Footnote-17274819
Node: 実行可能な Python スクリプト7274926
Ref: tutorial/appendix executable-python-scripts7275100
Ref: 210d7275100
Ref: tutorial/appendix tut-scripts7275100
Ref: 1fd37275100
Node: 対話モード用の起動時実行ファイル7276665
Ref: tutorial/appendix the-interactive-startup-file7276860
Ref: 210e7276860
Ref: tutorial/appendix tut-startup7276860
Ref: 210f7276860
Node: カスタマイズ用モジュール7278957
Ref: tutorial/appendix the-customization-modules7279105
Ref: 21107279105
Ref: tutorial/appendix tut-customize7279105
Ref: 21117279105
Node: Python のセットアップと利用7280355
Ref: using/index doc7280509
Ref: 21127280509
Ref: using/index python-setup-and-usage7280509
Ref: 21137280509
Ref: using/index translation-repo7280509
Ref: 21147280509
Ref: using/index using-index7280509
Ref: 21157280509
Node: コマンドラインと環境<2>7281111
Ref: using/cmdline doc7281276
Ref: 21167281276
Ref: using/cmdline command-line-and-environment7281276
Ref: 21177281276
Ref: using/cmdline using-on-general7281276
Ref: 1da77281276
Node: コマンドライン7281680
Ref: using/cmdline command-line7281792
Ref: 21197281792
Ref: using/cmdline using-on-cmdline7281792
Ref: 12097281792
Node: インターフェイスオプション7282289
Ref: using/cmdline interface-options7282416
Ref: 211a7282416
Ref: using/cmdline using-on-interface-options7282416
Ref: 211b7282416
Ref: using/cmdline cmdoption-c7284270
Ref: 1a87284270
Ref: using/cmdline cmdoption-m7285128
Ref: 23c7285128
Ref: using/cmdline cmdarg-dash7288145
Ref: 211c7288145
Ref: using/cmdline cmdarg-script7288698
Ref: 211d7288698
Ref: インターフェイスオプション-Footnote-17290943
Node: 一般オプション7290985
Ref: using/cmdline generic-options7291148
Ref: 211e7291148
Ref: using/cmdline using-on-generic-options7291148
Ref: 211f7291148
Ref: using/cmdline cmdoption-07291202
Ref: 16417291202
Ref: using/cmdline cmdoption-h7291217
Ref: 21207291217
Ref: using/cmdline cmdoption-help7291232
Ref: 8067291232
Ref: using/cmdline cmdoption-help-env7291367
Ref: 8087291367
Ref: using/cmdline cmdoption-help-xoptions7291508
Ref: 8097291508
Ref: using/cmdline cmdoption-help-all7291657
Ref: 80a7291657
Ref: using/cmdline cmdoption-V7291759
Ref: 49b7291759
Ref: using/cmdline cmdoption-version7291774
Ref: f177291774
Node: その他のオプション7292159
Ref: using/cmdline miscellaneous-options7292295
Ref: 21217292295
Ref: using/cmdline using-on-misc-options7292295
Ref: 120a7292295
Ref: using/cmdline cmdoption-b7292359
Ref: 7f97292359
Ref: using/cmdline cmdoption-B7292782
Ref: 15e67292782
Ref: using/cmdline cmdoption-check-hash-based-pycs7293033
Ref: 21227293033
Ref: using/cmdline cmdoption-d7293752
Ref: 21237293752
Ref: using/cmdline cmdoption-E7293983
Ref: b567293983
Ref: using/cmdline cmdoption-i7294207
Ref: 16f47294207
Ref: using/cmdline cmdoption-I7294933
Ref: b577294933
Ref: using/cmdline cmdoption-O7295433
Ref: 18c7295433
Ref: using/cmdline cmdoption-OO7295848
Ref: fb57295848
Ref: using/cmdline cmdoption-P7296180
Ref: 7c17296180
Ref: using/cmdline cmdoption-q7296841
Ref: 177e7296841
Ref: using/cmdline cmdoption-R7297008
Ref: 1e787297008
Ref: using/cmdline cmdoption-s7298154
Ref: 15a67298154
Ref: using/cmdline cmdoption-S7298447
Ref: 13c07298447
Ref: using/cmdline cmdoption-u7298845
Ref: 1d8d7298845
Ref: using/cmdline cmdoption-v7299150
Ref: 163e7299150
Ref: using/cmdline using-on-warnings7299851
Ref: 21297299851
Ref: using/cmdline cmdoption-W7299851
Ref: ac67299851
Ref: using/cmdline cmdoption-x7302566
Ref: 212b7302566
Ref: using/cmdline cmdoption-X7302772
Ref: 16f7302772
Ref: その他のオプション-Footnote-17311680
Ref: その他のオプション-Footnote-27311722
Ref: その他のオプション-Footnote-37311764
Ref: その他のオプション-Footnote-47311806
Ref: その他のオプション-Footnote-57311848
Ref: その他のオプション-Footnote-67311890
Ref: その他のオプション-Footnote-77311932
Ref: その他のオプション-Footnote-87311974
Node: 色の制御7312006
Ref: using/cmdline controlling-color7312112
Ref: 21327312112
Ref: using/cmdline using-on-controlling-color7312112
Ref: 1b77312112
Ref: 色の制御-Footnote-17313399
Ref: 色の制御-Footnote-27313432
Node: 環境変数7313462
Ref: using/cmdline environment-variables7313574
Ref: 21337313574
Ref: using/cmdline using-on-envvars7313574
Ref: 8077313574
Ref: using/cmdline envvar-PYTHONHOME7313893
Ref: 3f07313893
Ref: using/cmdline envvar-PYTHONPATH7314657
Ref: 121f7314657
Ref: using/cmdline envvar-PYTHONSAFEPATH7316082
Ref: 7c27316082
Ref: using/cmdline envvar-PYTHONPLATLIBDIR7316307
Ref: 1d237316307
Ref: using/cmdline envvar-PYTHONSTARTUP7316471
Ref: 1b87316471
Ref: using/cmdline envvar-PYTHONOPTIMIZE7317302
Ref: 21257317302
Ref: using/cmdline envvar-PYTHONBREAKPOINT7317579
Ref: cd27317579
Ref: using/cmdline envvar-PYTHONDEBUG7318188
Ref: 21247318188
Ref: using/cmdline envvar-PYTHONINSPECT7318570
Ref: 16f37318570
Ref: using/cmdline envvar-PYTHONUNBUFFERED7319298
Ref: 1d8e7319298
Ref: using/cmdline envvar-PYTHONVERBOSE7319472
Ref: 21287319472
Ref: using/cmdline envvar-PYTHONCASEOK7319750
Ref: b557319750
Ref: using/cmdline envvar-PYTHONDONTWRITEBYTECODE7319988
Ref: 15e77319988
Ref: using/cmdline envvar-PYTHONPYCACHEPREFIX7320308
Ref: b9b7320308
Ref: using/cmdline envvar-PYTHONHASHSEED7320643
Ref: 12897320643
Ref: using/cmdline envvar-PYTHONINTMAXSTRDIGITS7321487
Ref: 1b3a7321487
Ref: using/cmdline envvar-PYTHONIOENCODING7321717
Ref: 120c7321717
Ref: using/cmdline envvar-PYTHONNOUSERSITE7322673
Ref: 15a77322673
Ref: using/cmdline envvar-PYTHONUSERBASE7322995
Ref: 15a57322995
Ref: using/cmdline envvar-PYTHONEXECUTABLE7323354
Ref: 21387323354
Ref: using/cmdline envvar-PYTHONWARNINGS7323613
Ref: da37323613
Ref: using/cmdline envvar-PYTHONFAULTHANDLER7324614
Ref: 12917324614
Ref: using/cmdline envvar-PYTHONTRACEMALLOC7325057
Ref: 212d7325057
Ref: using/cmdline envvar-PYTHONPROFILEIMPORTTIME7325620
Ref: ced7325620
Ref: using/cmdline envvar-PYTHONASYNCIODEBUG7326101
Ref: 21397326101
Ref: using/cmdline envvar-PYTHONMALLOC7326348
Ref: e5e7326348
Ref: using/cmdline envvar-PYTHONMALLOCSTATS7327807
Ref: 1f377327807
Ref: using/cmdline envvar-PYTHONLEGACYWINDOWSFSENCODING7328482
Ref: 33f7328482
Ref: using/cmdline envvar-PYTHONLEGACYWINDOWSSTDIO7329023
Ref: e557329023
Ref: using/cmdline envvar-PYTHONCOERCECLOCALE7329488
Ref: ccc7329488
Ref: using/cmdline envvar-PYTHONDEVMODE7332245
Ref: ce77332245
Ref: using/cmdline envvar-PYTHONUTF87332584
Ref: ccf7332584
Ref: using/cmdline envvar-PYTHONWARNDEFAULTENCODING7332872
Ref: 9bf7332872
Ref: using/cmdline envvar-PYTHONNODEBUGRANGES7333192
Ref: 7d37333192
Ref: using/cmdline envvar-PYTHONPERFSUPPORT7333653
Ref: 6997333653
Ref: using/cmdline envvar-PYTHON_PERF_JIT_SUPPORT7334057
Ref: 4af7334057
Ref: using/cmdline envvar-PYTHON_DISABLE_REMOTE_DEBUG7334500
Ref: 16e7334500
Ref: using/cmdline envvar-PYTHON_CPU_COUNT7334960
Ref: 51e7334960
Ref: using/cmdline envvar-PYTHON_FROZEN_MODULES7335253
Ref: 4ad7335253
Ref: using/cmdline envvar-PYTHON_COLORS7335890
Ref: 4767335890
Ref: using/cmdline envvar-PYTHON_BASIC_REPL7336144
Ref: 1b67336144
Ref: using/cmdline envvar-PYTHON_HISTORY7336445
Ref: 4b07336445
Ref: using/cmdline envvar-PYTHON_GIL7336686
Ref: 49a7336686
Ref: using/cmdline envvar-PYTHON_THREAD_INHERIT_CONTEXT7337127
Ref: 18687337127
Ref: using/cmdline envvar-PYTHON_CONTEXT_AWARE_WARNINGS7337589
Ref: 185b7337589
Ref: using/cmdline envvar-PYTHON_JIT7337977
Ref: 44d7337977
Ref: using/cmdline envvar-PYTHON_TLBC7338222
Ref: 21307338222
Ref: 環境変数-Footnote-17338643
Ref: 環境変数-Footnote-27338685
Ref: 環境変数-Footnote-37338727
Ref: 環境変数-Footnote-47338769
Ref: 環境変数-Footnote-57338811
Node: デバッグモード変数7338853
Ref: using/cmdline debug-mode-variables7338929
Ref: 21417338929
Ref: using/cmdline envvar-PYTHONDUMPREFS7338993
Ref: b9e7338993
Ref: using/cmdline envvar-PYTHONDUMPREFSFILE7339288
Ref: 1c3f7339288
Ref: using/cmdline envvar-PYTHON_PRESITE7339636
Ref: 212f7339636
Node: Unix プラットフォームで Python を使う7340373
Ref: using/unix doc7340569
Ref: 21427340569
Ref: using/unix translation-repo7340569
Ref: 21437340569
Ref: using/unix using-on-unix7340569
Ref: 21447340569
Ref: using/unix using-python-on-unix-platforms7340569
Ref: 21457340569
Node: 最新バージョンの Python の取得とインストール7340870
Ref: using/unix getting-and-installing-the-latest-version-of-python7341046
Ref: 21467341046
Node: Linux7341211
Ref: using/unix on-linux7341343
Ref: 21477341343
Node: IDLE のインストール7342303
Ref: using/unix installing-idle7342371
Ref: 21487342371
Ref: using/unix installing-idle-on-linux7342371
Ref: 21497342371
Node: FreeBSD と OpenBSD7342894
Ref: using/unix on-freebsd-and-openbsd7343026
Ref: 214a7343026
Node: Python のビルド7343702
Ref: using/unix building-python7343930
Ref: 214b7343930
Ref: using/unix building-python-on-unix7343930
Ref: 10f67343930
Ref: Python のビルド-Footnote-17345051
Ref: Python のビルド-Footnote-27345119
Ref: Python のビルド-Footnote-37345168
Ref: Python のビルド-Footnote-47345231
Node: Python に関係するパスとファイル7345294
Ref: using/unix python-related-paths-and-files7345472
Ref: 214e7345472
Node: その他<2>7347095
Ref: using/unix miscellaneous7347277
Ref: 21517347277
Node: カスタムの OpenSSL7348059
Ref: using/unix custom-openssl7348189
Ref: 21527348189
Ref: using/unix unix-custom-openssl7348189
Ref: 21537348189
Node: Python を構成する7349818
Ref: using/configure doc7350009
Ref: 21547350009
Ref: using/configure configure-python7350009
Ref: 21557350009
Ref: using/configure translation-repo7350009
Ref: 21567350009
Node: ビルド要件7350213
Ref: using/configure build-requirements7350323
Ref: 214c7350323
Ref: using/configure id17350323
Ref: 21577350323
Ref: ビルド要件-Footnote-17351356
Ref: ビルド要件-Footnote-27351399
Ref: ビルド要件-Footnote-37351482
Ref: ビルド要件-Footnote-47351529
Ref: ビルド要件-Footnote-57351586
Ref: ビルド要件-Footnote-67351628
Node: オプションのモジュールの要件7351670
Ref: using/configure optional-module-requirements7351764
Ref: 21587351764
Ref: using/configure requirements-for-optional-modules7351764
Ref: 21597351764
Ref: オプションのモジュールの要件-Footnote-17357415
Ref: オプションのモジュールの要件-Footnote-27357453
Ref: オプションのモジュールの要件-Footnote-37357492
Ref: オプションのモジュールの要件-Footnote-47357524
Ref: オプションのモジュールの要件-Footnote-57357581
Ref: オプションのモジュールの要件-Footnote-67357742
Ref: オプションのモジュールの要件-Footnote-77357803
Ref: オプションのモジュールの要件-Footnote-87357845
Ref: オプションのモジュールの要件-Footnote-97357946
Ref: オプションのモジュールの要件-Footnote-107357990
Ref: オプションのモジュールの要件-Footnote-117358113
Ref: オプションのモジュールの要件-Footnote-127358168
Ref: オプションのモジュールの要件-Footnote-137358371
Ref: オプションのモジュールの要件-Footnote-147358409
Ref: オプションのモジュールの要件-Footnote-157358616
Ref: オプションのモジュールの要件-Footnote-167358645
Ref: オプションのモジュールの要件-Footnote-177358680
Ref: オプションのモジュールの要件-Footnote-187358710
Ref: オプションのモジュールの要件-Footnote-197358752
Ref: オプションのモジュールの要件-Footnote-207358843
Node: 生成されるファイル7358880
Ref: using/configure generated-files7359023
Ref: 215e7359023
Node: 構成スクリプト7359508
Ref: using/configure configure-script7359593
Ref: 215f7359593
Ref: 構成スクリプト-Footnote-17360452
Ref: 構成スクリプト-Footnote-27360494
Ref: 構成スクリプト-Footnote-37360540
Node: Configureオプション7360602
Ref: using/configure configure-options7360758
Ref: 214d7360758
Ref: using/configure id127360758
Ref: 21607360758
Node: 一般的なオプション7361609
Ref: using/configure general-options7361741
Ref: 21617361741
Ref: using/configure cmdoption-enable-loadable-sqlite-extensions7361805
Ref: 21627361805
Ref: using/configure cmdoption-disable-ipv67362162
Ref: 21637362162
Ref: using/configure cmdoption-enable-big-digits7362369
Ref: 9537362369
Ref: using/configure cmdoption-with-suffix7362767
Ref: 21647362767
Ref: using/configure cmdoption-with-tzpath7363409
Ref: 21657363409
Ref: using/configure cmdoption-without-decimal-contextvar7363932
Ref: 21687363932
Ref: using/configure cmdoption-with-dbmliborder7364407
Ref: 216a7364407
Ref: using/configure cmdoption-without-c-locale-coercion7364764
Ref: 216b7364764
Ref: using/configure cmdoption-with-platlibdir7365101
Ref: 216c7365101
Ref: using/configure cmdoption-with-wheel-pkg-dir7365417
Ref: a8d7365417
Ref: using/configure cmdoption-with-pkg-config7366034
Ref: 216d7366034
Ref: using/configure cmdoption-enable-pystats7366491
Ref: 1b387366491
Ref: using/configure free-threading-build7368838
Ref: 216e7368838
Ref: using/configure cmdoption-disable-gil7368838
Ref: 4997368838
Ref: using/configure cmdoption-enable-experimental-jit7369198
Ref: 44e7369198
Ref: using/configure cmdoption-arg-PKG_CONFIG7370383
Ref: 216f7370383
Ref: using/configure cmdoption-arg-PKG_CONFIG_LIBDIR7370447
Ref: 21707370447
Ref: using/configure cmdoption-arg-PKG_CONFIG_PATH7370478
Ref: 21717370478
Ref: 一般的なオプション-Footnote-17370575
Node: C コンパイラのオプション7370617
Ref: using/configure c-compiler-options7370785
Ref: 21727370785
Ref: using/configure cmdoption-arg-CC7370863
Ref: 21737370863
Ref: using/configure cmdoption-arg-CFLAGS7370921
Ref: 21747370921
Ref: using/configure cmdoption-arg-CPP7370980
Ref: 21757370980
Ref: using/configure cmdoption-arg-CPPFLAGS7371045
Ref: 21767371045
Node: リンカのオプション7371141
Ref: using/configure linker-options7371333
Ref: 21777371333
Ref: using/configure cmdoption-arg-LDFLAGS7371397
Ref: 21787371397
Ref: using/configure cmdoption-arg-LIBS7371484
Ref: 21797371484
Ref: using/configure cmdoption-arg-MACHDEP7371570
Ref: 217a7371570
Node: サードパーティ依存関係のオプション7371655
Ref: using/configure configure-options-for-dependencies7371839
Ref: 215d7371839
Ref: using/configure options-for-third-party-dependencies7371839
Ref: 217b7371839
Ref: using/configure cmdoption-arg-BZIP2_CFLAGS7371967
Ref: 217c7371967
Ref: using/configure cmdoption-arg-BZIP2_LIBS7371993
Ref: 217d7371993
Ref: using/configure cmdoption-arg-CURSES_CFLAGS7372148
Ref: 217e7372148
Ref: using/configure cmdoption-arg-CURSES_LIBS7372175
Ref: 217f7372175
Ref: using/configure cmdoption-arg-GDBM_CFLAGS7372345
Ref: 21807372345
Ref: using/configure cmdoption-arg-GDBM_LIBS7372370
Ref: 21817372370
Ref: using/configure cmdoption-arg-LIBEDIT_CFLAGS7372443
Ref: 21827372443
Ref: using/configure cmdoption-arg-LIBEDIT_LIBS7372471
Ref: 21837372471
Ref: using/configure cmdoption-arg-LIBFFI_CFLAGS7372620
Ref: 21847372620
Ref: using/configure cmdoption-arg-LIBFFI_LIBS7372647
Ref: 21857372647
Ref: using/configure cmdoption-arg-LIBMPDEC_CFLAGS7372792
Ref: 21867372792
Ref: using/configure cmdoption-arg-LIBMPDEC_LIBS7372821
Ref: 21877372821
Ref: using/configure cmdoption-arg-LIBLZMA_CFLAGS7373098
Ref: 21887373098
Ref: using/configure cmdoption-arg-LIBLZMA_LIBS7373126
Ref: 21897373126
Ref: using/configure cmdoption-arg-LIBREADLINE_CFLAGS7373271
Ref: 218a7373271
Ref: using/configure cmdoption-arg-LIBREADLINE_LIBS7373303
Ref: 218b7373303
Ref: using/configure cmdoption-arg-LIBSQLITE3_CFLAGS7373460
Ref: 218c7373460
Ref: using/configure cmdoption-arg-LIBSQLITE3_LIBS7373491
Ref: 218d7373491
Ref: using/configure cmdoption-arg-LIBUUID_CFLAGS7373645
Ref: 218e7373645
Ref: using/configure cmdoption-arg-LIBUUID_LIBS7373673
Ref: 218f7373673
Ref: using/configure cmdoption-arg-LIBZSTD_CFLAGS7373819
Ref: 21907373819
Ref: using/configure cmdoption-arg-LIBZSTD_LIBS7373847
Ref: 21917373847
Ref: using/configure cmdoption-arg-PANEL_CFLAGS7374033
Ref: 21927374033
Ref: using/configure cmdoption-arg-PANEL_LIBS7374059
Ref: 21937374059
Ref: using/configure cmdoption-arg-TCLTK_CFLAGS7374304
Ref: 21947374304
Ref: using/configure cmdoption-arg-TCLTK_LIBS7374330
Ref: 21957374330
Ref: using/configure cmdoption-arg-ZLIB_CFLAGS7374428
Ref: 21967374428
Ref: using/configure cmdoption-arg-ZLIB_LIBS7374453
Ref: 21977374453
Node: WebAssembly オプション7374595
Ref: using/configure webassembly-options7374785
Ref: 21987374785
Ref: using/configure cmdoption-enable-wasm-dynamic-linking7374853
Ref: 1bbe7374853
Ref: using/configure cmdoption-enable-wasm-pthreads7375237
Ref: 1b8d7375237
Node: インストールオプション7375363
Ref: using/configure install-options7375550
Ref: 21997375550
Ref: using/configure cmdoption-prefix7375624
Ref: 214f7375624
Ref: using/configure cmdoption-exec-prefix7376111
Ref: 21507376111
Ref: using/configure cmdoption-disable-test-modules7376412
Ref: a8c7376412
Ref: using/configure cmdoption-with-ensurepip7376729
Ref: 219a7376729
Node: パフォーマンスに関するオプション7377221
Ref: using/configure performance-options7377409
Ref: 219b7377409
Ref: using/configure cmdoption-enable-optimizations7377707
Ref: a627377707
Ref: using/configure envvar-PROFILE_TASK7378859
Ref: 1a7e7378859
Ref: using/configure cmdoption-with-lto7379182
Ref: 9527379182
Ref: using/configure cmdoption-enable-bolt7379708
Ref: 219c7379708
Ref: using/configure cmdoption-arg-BOLT_APPLY_FLAGS7380775
Ref: 219d7380775
Ref: using/configure cmdoption-arg-BOLT_INSTRUMENT_FLAGS7380911
Ref: 219e7380911
Ref: using/configure cmdoption-with-computed-gotos7381039
Ref: 219f7381039
Ref: using/configure cmdoption-with-tail-call-interp7381171
Ref: 1727381171
Ref: using/configure cmdoption-without-mimalloc7381577
Ref: 21a07381577
Ref: using/configure cmdoption-without-pymalloc7381753
Ref: 21a17381753
Ref: using/configure cmdoption-without-doc-strings7381949
Ref: 21a27381949
Ref: using/configure cmdoption-enable-profiling7382244
Ref: 21a37382244
Ref: using/configure cmdoption-with-strict-overflow7382352
Ref: 1ad37382352
Ref: using/configure cmdoption-without-remote-debug7382507
Ref: 1707382507
Ref: using/configure c Py_REMOTE_DEBUG7382953
Ref: 21a47382953
Ref: パフォーマンスに関するオプション-Footnote-17383325
Ref: パフォーマンスに関するオプション-Footnote-27383385
Ref: パフォーマンスに関するオプション-Footnote-37383433
Ref: パフォーマンスに関するオプション-Footnote-47383507
Ref: パフォーマンスに関するオプション-Footnote-57383549
Node: Python デバッグビルド7383591
Ref: using/configure debug-build7383759
Ref: 5097383759
Ref: using/configure python-debug-build7383759
Ref: 21a57383759
Node: Debug options7386003
Ref: using/configure debug-options7386153
Ref: 21a67386153
Ref: using/configure cmdoption-with-pydebug7386198
Ref: 6667386198
Ref: using/configure cmdoption-with-trace-refs7386332
Ref: 6367386332
Ref: using/configure cmdoption-with-assertions7386981
Ref: 62d7386981
Ref: using/configure cmdoption-with-valgrind7387367
Ref: 21a87387367
Ref: using/configure cmdoption-with-dtrace7387443
Ref: 21a97387443
Ref: using/configure cmdoption-with-address-sanitizer7387613
Ref: 21aa7387613
Ref: using/configure cmdoption-with-memory-sanitizer7387983
Ref: 21ab7387983
Ref: using/configure cmdoption-with-undefined-behavior-sanitizer7388137
Ref: 21ac7388137
Ref: using/configure cmdoption-with-thread-sanitizer7388318
Ref: 21ad7388318
Node: リンカのオプション<2>7388461
Ref: using/configure id137388600
Ref: 21ae7388600
Ref: using/configure cmdoption-enable-shared7388666
Ref: a637388666
Ref: using/configure cmdoption-without-static-libpython7388780
Ref: a8e7388780
Node: Libraries options7388968
Ref: using/configure libraries-options7389110
Ref: 21af7389110
Ref: using/configure cmdoption-with-libs7389165
Ref: 21b07389165
Ref: using/configure cmdoption-with-system-expat7389258
Ref: 1b2d7389258
Ref: using/configure cmdoption-with-system-libmpdec7389389
Ref: 6577389389
Ref: using/configure cmdoption-with-readline7390281
Ref: 215b7390281
Ref: using/configure cmdoption-without-readline7390527
Ref: 21b17390527
Ref: using/configure cmdoption-with-libm7390710
Ref: 21b27390710
Ref: using/configure cmdoption-with-libc7390829
Ref: 21b37390829
Ref: using/configure cmdoption-with-openssl7390945
Ref: 21b47390945
Ref: using/configure cmdoption-with-openssl-rpath7391042
Ref: a8f7391042
Node: Security Options7391380
Ref: using/configure security-options7391516
Ref: 21b57391516
Ref: using/configure cmdoption-with-hash-algorithm7391569
Ref: 21b67391569
Ref: using/configure cmdoption-with-builtin-hashlib-hashes7391894
Ref: 215c7391894
Ref: using/configure cmdoption-with-ssl-default-suites7392195
Ref: 21b77392195
Ref: using/configure cmdoption-disable-safety7392680
Ref: 4457392680
Ref: using/configure cmdoption-enable-slower-safety7393374
Ref: 4467393374
Ref: Security Options-Footnote-17394042
Ref: Security Options-Footnote-27394198
Ref: Security Options-Footnote-37394410
Ref: Security Options-Footnote-47394630
Ref: Security Options-Footnote-57394786
Node: macOS のオプション7395001
Ref: using/configure macos-options7395142
Ref: 21b87395142
Ref: using/configure cmdoption-enable-universalsdk7395237
Ref: b637395237
Ref: using/configure cmdoption-07395272
Ref: 21b97395272
Ref: using/configure cmdoption-enable-framework7395535
Ref: 21ba7395535
Ref: using/configure cmdoption-17395567
Ref: 21bb7395567
Ref: using/configure cmdoption-with-universal-archs7395845
Ref: 21bc7395845
Ref: using/configure cmdoption-with-framework-name7396699
Ref: 21bd7396699
Ref: using/configure cmdoption-with-app-store-compliance7396945
Ref: 19977396945
Ref: using/configure cmdoption-27396986
Ref: 21be7396986
Ref: macOS のオプション-Footnote-17397690
Ref: macOS のオプション-Footnote-27397757
Node: iOS のオプション7397855
Ref: using/configure ios-options7398022
Ref: 21bf7398022
Ref: using/configure cmdoption-37398113
Ref: 21c07398113
Ref: using/configure cmdoption-47398306
Ref: 21c17398306
Ref: iOS のオプション-Footnote-17398478
Node: クロスコンパイルのオプション7398545
Ref: using/configure cross-compiling-options7398679
Ref: 21c27398679
Ref: using/configure cmdoption-build7399236
Ref: 21c37399236
Ref: using/configure cmdoption-host7399386
Ref: 21c47399386
Ref: using/configure cmdoption-with-build-python7399555
Ref: 21c57399555
Ref: using/configure cmdoption-arg-CONFIG_SITE7399719
Ref: 21c67399719
Ref: using/configure cmdoption-arg-HOSTRUNNER7400006
Ref: 21c77400006
Node: Python ビルドシステム7400395
Ref: using/configure python-build-system7400549
Ref: 21c87400549
Node: ビルドシステムの主要なファイル7400751
Ref: using/configure main-files-of-the-build-system7400900
Ref: 21c97400900
Node: 主要なビルドステップ7401337
Ref: using/configure main-build-steps7401516
Ref: 21ca7401516
Node: Main Makefile targets7401914
Ref: using/configure main-makefile-targets7402060
Ref: 21cb7402060
Node: make7402297
Ref: using/configure make7402381
Ref: 21cc7402381
Node: make platform7403822
Ref: using/configure make-platform7403931
Ref: 21cd7403931
Node: make profile-opt7404247
Ref: using/configure make-profile-opt7404362
Ref: 21ce7404362
Node: make clean7404630
Ref: using/configure make-clean7404746
Ref: 21cf7404746
Node: make distclean7404806
Ref: using/configure make-distclean7404918
Ref: 21d07404918
Ref: make distclean-Footnote-17405163
Node: make install7405582
Ref: using/configure make-install7405693
Ref: 21d17405693
Node: make test7405784
Ref: using/configure make-test7405888
Ref: 21d27405888
Node: make ci7406247
Ref: using/configure make-ci7406356
Ref: 21d37406356
Node: make buildbottest7406500
Ref: using/configure make-buildbottest7406614
Ref: 21d47406614
Node: make regen-all7406812
Ref: using/configure make-regen-all7406910
Ref: 21d57406910
Node: C extensions7407211
Ref: using/configure c-extensions7407318
Ref: 21d67407318
Node: Compiler and linker flags7408986
Ref: using/configure compiler-and-linker-flags7409107
Ref: 21d77409107
Node: Preprocessor flags7409340
Ref: using/configure preprocessor-flags7409443
Ref: 21d87409443
Ref: using/configure envvar-CONFIGURE_CPPFLAGS7409498
Ref: 21d97409498
Ref: using/configure envvar-CPPFLAGS7409655
Ref: 16d27409655
Ref: using/configure envvar-BASECPPFLAGS7410022
Ref: 21da7410022
Ref: using/configure envvar-PY_CPPFLAGS7410082
Ref: 21db7410082
Node: Compiler flags7410327
Ref: using/configure compiler-flags7410451
Ref: 21dc7410451
Ref: using/configure envvar-CC7410498
Ref: 16cf7410498
Ref: using/configure envvar-CXX7410597
Ref: 21dd7410597
Ref: using/configure envvar-CFLAGS7410683
Ref: 16d07410683
Ref: using/configure envvar-CFLAGS_NODIST7410748
Ref: 21de7410748
Ref: using/configure envvar-COMPILEALL_OPTS7411546
Ref: 21df7411546
Ref: using/configure envvar-EXTRA_CFLAGS7411746
Ref: 21e07411746
Ref: using/configure envvar-CONFIGURE_CFLAGS7411808
Ref: 21e17411808
Ref: using/configure envvar-CONFIGURE_CFLAGS_NODIST7411961
Ref: 21e27411961
Ref: using/configure envvar-BASECFLAGS7412128
Ref: 21e37412128
Ref: using/configure envvar-OPT7412185
Ref: 21a77412185
Ref: using/configure envvar-CFLAGS_ALIASING7412234
Ref: 21e47412234
Ref: using/configure envvar-CCSHARED7412381
Ref: 21e57412381
Ref: using/configure envvar-CFLAGSFORSHARED7412522
Ref: 21e67412522
Ref: using/configure envvar-PY_CFLAGS7412735
Ref: 21e77412735
Ref: using/configure envvar-PY_CFLAGS_NODIST7412858
Ref: 21e87412858
Ref: using/configure envvar-PY_STDMODULE_CFLAGS7413022
Ref: 21e97413022
Ref: using/configure envvar-PY_CORE_CFLAGS7413245
Ref: 21ea7413245
Ref: using/configure envvar-PY_BUILTIN_MODULE_CFLAGS7413368
Ref: 21eb7413368
Ref: using/configure envvar-PURIFY7413636
Ref: 21ec7413636
Ref: Compiler flags-Footnote-17413798
Node: Linker flags7413853
Ref: using/configure linker-flags7413950
Ref: 21ed7413950
Ref: using/configure envvar-LINKCC7413993
Ref: 21ee7413993
Ref: using/configure envvar-CONFIGURE_LDFLAGS7414146
Ref: 21ef7414146
Ref: using/configure envvar-LDFLAGS_NODIST7414485
Ref: 21f07414485
Ref: using/configure envvar-CONFIGURE_LDFLAGS_NODIST7415074
Ref: 21f17415074
Ref: using/configure envvar-LDFLAGS7415243
Ref: 16d17415243
Ref: using/configure envvar-LIBS7415579
Ref: 21f27415579
Ref: using/configure envvar-LDSHARED7415722
Ref: 21f37415722
Ref: using/configure envvar-BLDSHARED7415838
Ref: 21f47415838
Ref: using/configure envvar-PY_LDFLAGS7415975
Ref: 21f57415975
Ref: using/configure envvar-PY_LDFLAGS_NODIST7416059
Ref: 21f67416059
Ref: using/configure envvar-PY_CORE_LDFLAGS7416192
Ref: 21f77416192
Ref: Linker flags-Footnote-17416371
Node: Windows で Python を使う7416426
Ref: using/windows doc7416594
Ref: 21f87416594
Ref: using/windows translation-repo7416594
Ref: 21f97416594
Ref: using/windows using-on-windows7416594
Ref: c9e7416594
Ref: using/windows using-python-on-windows7416594
Ref: 21fa7416594
Ref: using/windows pymanager7419038
Ref: 21fe7419038
Ref: using/windows windows-store7419038
Ref: 1fc97419038
Ref: using/windows setting-envvars7419038
Ref: 1fca7419038
Ref: using/windows windows-path-mod7419038
Ref: 125c7419038
Ref: Windows で Python を使う-Footnote-17419579
Ref: Windows で Python を使う-Footnote-27419621
Node: Python install manager7419676
Ref: using/windows launcher7419808
Ref: 7da7419808
Ref: using/windows python-install-manager7419808
Ref: 21ff7419808
Node: Installation7420182
Ref: using/windows installation7420283
Ref: 22007420283
Ref: Installation-Footnote-17422259
Ref: Installation-Footnote-27422314
Node: 基本的な使い方7422356
Ref: using/windows basic-use7422478
Ref: 22027422478
Node: Command help7426664
Ref: using/windows command-help7426790
Ref: 22067426790
Node: Listing runtimes7427667
Ref: using/windows listing-runtimes7427791
Ref: 22077427791
Node: Installing runtimes7429690
Ref: using/windows installing-runtimes7429818
Ref: 22087429818
Node: Offline installs7432012
Ref: using/windows offline-installs7432145
Ref: 220b7432145
Ref: using/windows pymanager-offline7432145
Ref: 22097432145
Node: Uninstalling runtimes7433349
Ref: using/windows uninstalling-runtimes7433476
Ref: 220c7433476
Node: Configuration7434636
Ref: using/windows configuration7434760
Ref: 220d7434760
Ref: using/windows pymanager-config7434760
Ref: 22047434760
Ref: using/windows envvar-PYTHON_MANAGER_DEFAULT7436576
Ref: 22037436576
Ref: using/windows envvar-PYTHON_MANAGER_AUTOMATIC_INSTALL7438703
Ref: 220a7438703
Node: Shebang lines7445477
Ref: using/windows pymanager-shebang7445601
Ref: 22057445601
Ref: using/windows shebang-lines7445601
Ref: 220e7445601
Ref: Shebang lines-Footnote-17449156
Node: Advanced installation7449224
Ref: using/windows advanced-installation7449363
Ref: 220f7449363
Ref: using/windows pymanager-advancedinstall7449363
Ref: 22017449363
Ref: Advanced installation-Footnote-17453840
Ref: Advanced installation-Footnote-27453916
Ref: Advanced installation-Footnote-37453995
Ref: Advanced installation-Footnote-47454082
Node: Administrative configuration7454172
Ref: using/windows administrative-configuration7454331
Ref: 22117454331
Ref: using/windows pymanager-admin-config7454331
Ref: 22107454331
Node: Installing free-threaded binaries7460539
Ref: using/windows install-freethreaded-windows7460692
Ref: 4977460692
Ref: using/windows installing-free-threaded-binaries7460692
Ref: 22127460692
Node: Troubleshooting7461306
Ref: using/windows pymanager-troubleshoot7461422
Ref: 21fb7461422
Ref: using/windows troubleshooting7461422
Ref: 22137461422
Ref: Troubleshooting-Footnote-17473098
Ref: Troubleshooting-Footnote-27473149
Ref: Troubleshooting-Footnote-37473217
Node: 埋め込み可能なパッケージ7473285
Ref: using/windows the-embeddable-package7473451
Ref: 22147473451
Ref: using/windows windows-embeddable7473451
Ref: 21fd7473451
Node: Python application7475595
Ref: using/windows python-application7475717
Ref: 22157475717
Node: Python の埋め込み7477879
Ref: using/windows embedding-python7478001
Ref: 22167478001
Node: nuget org パッケージ7479058
Ref: using/windows the-nuget-org-packages7479220
Ref: 22177479220
Ref: using/windows windows-nuget7479220
Ref: 21fc7479220
Ref: nuget org パッケージ-Footnote-17482447
Ref: nuget org パッケージ-Footnote-27482478
Ref: nuget org パッケージ-Footnote-37482524
Ref: nuget org パッケージ-Footnote-47482573
Node: フリースレッドパッケージ Free-threaded packages7482624
Ref: using/windows free-threaded-packages7482745
Ref: 22187482745
Ref: フリースレッドパッケージ Free-threaded packages-Footnote-17483366
Ref: フリースレッドパッケージ Free-threaded packages-Footnote-27483425
Ref: フリースレッドパッケージ Free-threaded packages-Footnote-37483487
Node: 別のバンドル7483551
Ref: using/windows alternative-bundles7483703
Ref: 22197483703
Ref: 別のバンドル-Footnote-17485010
Ref: 別のバンドル-Footnote-27485063
Ref: 別のバンドル-Footnote-37485106
Ref: 別のバンドル-Footnote-47485158
Ref: 別のバンドル-Footnote-57485325
Node: Supported Windows versions7485362
Ref: using/windows supported-windows-versions7485521
Ref: 221a7485521
Ref: Supported Windows versions-Footnote-17485951
Node: Removing the MAX_PATH limitation7485993
Ref: using/windows max-path7486149
Ref: e3b7486149
Ref: using/windows removing-the-max-path-limitation7486149
Ref: 221b7486149
Node: UTF-8 モード7487041
Ref: using/windows utf-8-mode7487195
Ref: 221c7487195
Ref: using/windows win-utf8-mode7487195
Ref: 221d7487195
Ref: UTF-8 モード-Footnote-17488706
Ref: UTF-8 モード-Footnote-27488748
Node: モジュールの検索7488790
Ref: using/windows finding-modules7488936
Ref: 221e7488936
Ref: using/windows windows-finding-modules7488936
Ref: e1a7488936
Node: 追加のモジュール7495147
Ref: using/windows additional-modules7495324
Ref: 221f7495324
Node: PyWin327495843
Ref: using/windows pywin327495929
Ref: 22217495929
Ref: PyWin32-Footnote-17496600
Ref: PyWin32-Footnote-27496642
Ref: PyWin32-Footnote-37496731
Ref: PyWin32-Footnote-47496800
Ref: PyWin32-Footnote-57496894
Ref: PyWin32-Footnote-67496953
Node: cx_Freeze7497003
Ref: using/windows cx-freeze7497089
Ref: 22227497089
Ref: cx_Freeze-Footnote-17497363
Node: Windows 上で Python をコンパイルする7497415
Ref: using/windows compiling-python-on-windows7497597
Ref: 22237497597
Ref: Windows 上で Python をコンパイルする-Footnote-17498552
Ref: Windows 上で Python をコンパイルする-Footnote-27498601
Node: The full installer deprecated7498664
Ref: using/windows the-full-installer-deprecated7498860
Ref: 22257498860
Ref: using/windows windows-full7498860
Ref: 22267498860
Node: インストール手順7499416
Ref: using/windows installation-steps7499550
Ref: 22277499550
Node: Removing the MAX_PATH limitation<2>7502684
Ref: using/windows id27502848
Ref: 22297502848
Node: Installing without UI7503948
Ref: using/windows install-quiet-option7504118
Ref: 8047504118
Ref: using/windows installing-without-ui7504118
Ref: 222a7504118
Node: Installing without downloading7516702
Ref: using/windows install-layout-option7516867
Ref: 22287516867
Ref: using/windows installing-without-downloading7516867
Ref: 222b7516867
Node: インストール後の変更7518357
Ref: using/windows modifying-an-install7518537
Ref: 222c7518537
Node: Installing free-threaded binaries<2>7519890
Ref: using/windows id37520031
Ref: 222d7520031
Ref: Installing free-threaded binaries<2>-Footnote-17521778
Node: Python launcher for Windows deprecated7521820
Ref: using/windows python-launcher-for-windows-deprecated7521961
Ref: 222e7521961
Ref: Python launcher for Windows deprecated-Footnote-17523270
Node: 最初に7523312
Ref: using/windows getting-started7523421
Ref: 222f7523421
Node: コマンドラインから起動する7523673
Ref: using/windows from-the-command-line7523800
Ref: 22307523800
Ref: コマンドラインから起動する-Footnote-17526837
Node: 仮想環境 Virtual environments7526879
Ref: using/windows virtual-environments7527048
Ref: 22317527048
Node: スクリプトから起動する7527718
Ref: using/windows from-a-script7527893
Ref: 22327527893
Node: ファイルの関連付けから起動する7529290
Ref: using/windows from-file-associations7529423
Ref: 22337529423
Node: Shebang lines<2>7530144
Ref: using/windows id47530286
Ref: 22347530286
Node: シェバン行の引数7535022
Ref: using/windows arguments-in-shebang-lines7535173
Ref: 22367535173
Node: カスタマイズ7535554
Ref: using/windows customization7535695
Ref: 22377535695
Node: INI ファイルによるカスタマイズ7535869
Ref: using/windows customization-via-ini-files7536036
Ref: 22387536036
Ref: using/windows launcher-ini7536036
Ref: 22357536036
Node: デフォルトのPythonバージョンのカスタマイズ7536957
Ref: using/windows customizing-default-python-versions7537124
Ref: 22397537124
Node: 診断7541969
Ref: using/windows diagnostics7542093
Ref: 223a7542093
Node: Dry run7542571
Ref: using/windows dry-run7542694
Ref: 223b7542694
Node: Install on demand7543128
Ref: using/windows install-on-demand7543257
Ref: 223c7543257
Node: Return codes7543840
Ref: using/windows return-codes7543953
Ref: 223d7543953
Node: macOS で Python を使う7545708
Ref: using/mac doc7545882
Ref: 223e7545882
Ref: using/mac translation-repo7545882
Ref: 223f7545882
Ref: using/mac using-on-mac7545882
Ref: 22407545882
Ref: using/mac using-python-on-macos7545882
Ref: 22417545882
Ref: using/mac getting-osx7546597
Ref: 22437546597
Ref: macOS で Python を使う-Footnote-17546893
Node: Using Python for macOS from python org7546935
Ref: using/mac getting-and-installing-macpython7547070
Ref: 22447547070
Ref: using/mac using-python-for-macos-from-python-org7547070
Ref: 22457547070
Node: インストール手順<2>7547278
Ref: using/mac installation-steps7547426
Ref: 22467547426
Ref: インストール手順<2>-Footnote-17552553
Ref: インストール手順<2>-Footnote-27552595
Ref: インストール手順<2>-Footnote-37552643
Ref: インストール手順<2>-Footnote-47552698
Ref: インストール手順<2>-Footnote-57552745
Node: Python スクリプトの実行方法7552794
Ref: using/mac how-to-run-a-python-script7552942
Ref: 22477552942
Node: Alternative Distributions7554945
Ref: using/mac alternative-bundles7555142
Ref: 22427555142
Ref: using/mac alternative-distributions7555142
Ref: 22497555142
Ref: Alternative Distributions-Footnote-17556216
Ref: Alternative Distributions-Footnote-27556269
Ref: Alternative Distributions-Footnote-37556312
Ref: Alternative Distributions-Footnote-47556336
Node: 追加の Python パッケージのインストール7556369
Ref: using/mac installing-additional-python-packages7556553
Ref: 224a7556553
Ref: using/mac mac-package-manager7556553
Ref: 224b7556553
Ref: using/mac osx-gui-scripts7556724
Ref: 224c7556724
Ref: 追加の Python パッケージのインストール-Footnote-17556762
Node: GUI プログラミング7556841
Ref: using/mac gui-programming7557021
Ref: 224d7557021
Ref: using/mac gui-programming-on-the-mac7557021
Ref: 224e7557021
Ref: GUI プログラミング-Footnote-17557997
Ref: GUI プログラミング-Footnote-27558038
Ref: GUI プログラミング-Footnote-37558078
Ref: GUI プログラミング-Footnote-47558119
Ref: GUI プログラミング-Footnote-57558173
Ref: GUI プログラミング-Footnote-67558198
Ref: GUI プログラミング-Footnote-77558234
Ref: GUI プログラミング-Footnote-87558262
Node: 高度なトピック7558291
Ref: using/mac advanced-topics7558436
Ref: 224f7558436
Node: フリースレッドバイナリ Free-threaded Binaries のインストール7558782
Ref: using/mac install-freethreaded-macos7558960
Ref: 4987558960
Ref: using/mac installing-free-threaded-binaries7558960
Ref: 22507558960
Ref: フリースレッドバイナリ Free-threaded Binaries のインストール-Footnote-17564140
Node: Installing using the command line7564182
Ref: using/mac installing-using-the-command-line7564409
Ref: 22527564409
Node: Python アプリケーションの配布7567213
Ref: using/mac distributing-python-applications7567396
Ref: 22537567396
Ref: using/mac distributing-python-applications-on-the-mac7567396
Ref: 22547567396
Ref: Python アプリケーションの配布-Footnote-17568068
Ref: Python アプリケーションの配布-Footnote-27568109
Ref: Python アプリケーションの配布-Footnote-37568150
Ref: Python アプリケーションの配布-Footnote-47568178
Node: App Store コンプライアンス7568211
Ref: using/mac app-store-compliance7568352
Ref: 22557568352
Ref: App Store コンプライアンス-Footnote-17569478
Node: 他のリソース7569572
Ref: using/mac other-resources7569683
Ref: 22567569683
Ref: 他のリソース-Footnote-17569949
Ref: 他のリソース-Footnote-27569992
Node: Android で Python を使う7570061
Ref: using/android doc7570231
Ref: 22577570231
Ref: using/android translation-repo7570231
Ref: 22587570231
Ref: using/android using-android7570231
Ref: 22597570231
Ref: using/android using-python-on-android7570231
Ref: 225a7570231
Node: Android アプリに Python を追加する7572093
Ref: using/android adding-python-to-an-android-app7572268
Ref: 225d7572268
Ref: Android アプリに Python を追加する-Footnote-17573954
Ref: Android アプリに Python を追加する-Footnote-27573995
Ref: Android アプリに Python を追加する-Footnote-37574036
Ref: Android アプリに Python を追加する-Footnote-47574072
Ref: Android アプリに Python を追加する-Footnote-57574139
Ref: Android アプリに Python を追加する-Footnote-67574170
Ref: Android アプリに Python を追加する-Footnote-77574238
Ref: Android アプリに Python を追加する-Footnote-87574288
Ref: Android アプリに Python を追加する-Footnote-97574358
Ref: Android アプリに Python を追加する-Footnote-107574448
Ref: Android アプリに Python を追加する-Footnote-117574571
Node: Android 向けの Python パッケージをビルドする7574672
Ref: using/android building-a-python-package-for-android7574847
Ref: 225e7574847
Ref: Android 向けの Python パッケージをビルドする-Footnote-17575260
Node: iOS で Python を使う7575326
Ref: using/ios doc7575489
Ref: 225f7575489
Ref: using/ios translation-repo7575489
Ref: 22607575489
Ref: using/ios using-ios7575489
Ref: 22617575489
Ref: using/ios using-python-on-ios7575489
Ref: 22627575489
Ref: iOS で Python を使う-Footnote-17577720
Ref: iOS で Python を使う-Footnote-27577748
Node: iOS ランタイムでの Python7577773
Ref: using/ios python-at-runtime-on-ios7577914
Ref: 22637577914
Node: iOS のバージョン互換性7578193
Ref: using/ios ios-version-compatibility7578335
Ref: 22647578335
Node: プラットフォームの識別7579061
Ref: using/ios platform-identification7579251
Ref: 22657579251
Node: 標準ライブラリの利用可能性7580104
Ref: using/ios standard-library-availability7580296
Ref: 22687580296
Node: バイナリ拡張モジュール7580595
Ref: using/ios binary-extension-modules7580790
Ref: 22697580790
Node: コンパイラスタブバイナリ7584608
Ref: using/ios compiler-stub-binaries7584755
Ref: 226d7584755
Node: iOS での Python のインストール7586654
Ref: using/ios installing-python-on-ios7586841
Ref: 226e7586841
Node: iOS アプリビルド用のツール7587069
Ref: using/ios tools-for-building-ios-apps7587239
Ref: 226f7587239
Node: iOS プロジェクトに Python を追加する7588307
Ref: using/ios adding-ios7588520
Ref: 226a7588520
Ref: using/ios adding-python-to-an-ios-project7588520
Ref: 22707588520
Ref: iOS プロジェクトに Python を追加する-Footnote-17595234
Ref: iOS プロジェクトに Python を追加する-Footnote-27595279
Node: Python パッケージのテスト7595351
Ref: using/ios testing-a-python-package7595518
Ref: 22737595518
Ref: Python パッケージのテスト-Footnote-17598603
Ref: Python パッケージのテスト-Footnote-27598673
Node: App Store コンプライアンス<2>7598745
Ref: using/ios app-store-compliance7598891
Ref: 22747598891
Node: 標準ライブラリ内の互換性のないコード7599495
Ref: using/ios incompatible-code-in-the-standard-library7599668
Ref: 22757599668
Ref: 標準ライブラリ内の互換性のないコード-Footnote-17600534
Node: プライバシーマニフェスト7600628
Ref: using/ios privacy-manifests7600801
Ref: 22767600801
Ref: プライバシーマニフェスト-Footnote-17601566
Node: エディタと IDE7601639
Ref: using/editors doc7601765
Ref: 22777601765
Ref: using/editors editors7601765
Ref: 22487601765
Ref: using/editors editors-and-ides7601765
Ref: 22787601765
Ref: using/editors translation-repo7601765
Ref: 22797601765
Ref: エディタと IDE-Footnote-17602211
Node: IDLE --- Python のエディタとシェル7602253
Ref: using/editors idle-python-editor-and-shell7602383
Ref: 227a7602383
Node: Other Editors and IDEs7602735
Ref: using/editors other-editors-and-ides7602865
Ref: 227b7602865
Ref: Other Editors and IDEs-Footnote-17603150
Ref: Other Editors and IDEs-Footnote-27603201
Node: Python 言語リファレンス7603272
Ref: reference/index doc7603426
Ref: 227c7603426
Ref: reference/index reference-index7603426
Ref: 14a7603426
Ref: reference/index the-python-language-reference7603426
Ref: 227d7603426
Ref: reference/index translation-repo7603426
Ref: 227e7603426
Node: はじめに<5>7604936
Ref: reference/introduction doc7605040
Ref: 227f7605040
Ref: reference/introduction id17605040
Ref: 22807605040
Ref: reference/introduction introduction7605040
Ref: 22817605040
Node: 別のPythonの実装7607610
Ref: reference/introduction alternate-implementations7607731
Ref: 22827607731
Ref: reference/introduction implementations7607731
Ref: 21187607731
Ref: 別のPythonの実装-Footnote-17610607
Ref: 別のPythonの実装-Footnote-27610639
Ref: 別のPythonの実装-Footnote-37610676
Ref: 別のPythonの実装-Footnote-47610708
Node: 本マニュアルにおける表記法7610734
Ref: reference/introduction id27610855
Ref: 22837610855
Ref: reference/introduction notation7610855
Ref: 22847610855
Ref: reference/introduction grammar-token-notation-name7611061
Ref: 22857611061
Ref: reference/introduction grammar-token-notation-letter7611144
Ref: 22867611144
Ref: reference/introduction grammar-token-notation-digit7611179
Ref: 22877611179
Ref: reference/introduction lexical-lookaheads7613917
Ref: 228e7613917
Ref: reference/introduction grammar-token-notation-literal7614502
Ref: 228f7614502
Ref: reference/introduction grammar-token-notation-alt-literal7614756
Ref: 22907614756
Ref: 本マニュアルにおける表記法-Footnote-17615027
Ref: 本マニュアルにおける表記法-Footnote-27615099
Ref: 本マニュアルにおける表記法-Footnote-37615164
Node: Lexical and Syntactic definitions7615206
Ref: reference/introduction lexical-and-syntactic-definitions7615315
Ref: 22917615315
Ref: reference/introduction notation-lexical-vs-syntactic7615315
Ref: 228d7615315
Node: 字句解析7616340
Ref: reference/lexical_analysis doc7616471
Ref: 22967616471
Ref: reference/lexical_analysis lexical7616471
Ref: 22957616471
Ref: reference/lexical_analysis lexical-analysis7616471
Ref: 22977616471
Ref: reference/lexical_analysis translation-repo7616471
Ref: 22987616471
Node: 行構造7621245
Ref: reference/lexical_analysis id17621336
Ref: 22a37621336
Ref: reference/lexical_analysis line-structure7621336
Ref: 229b7621336
Node: 論理行 logical line7621843
Ref: reference/lexical_analysis id27621943
Ref: 22a47621943
Ref: reference/lexical_analysis logical-lines7621943
Ref: 22a57621943
Node: 物理行 physical line7622386
Ref: reference/lexical_analysis id37622516
Ref: 22a77622516
Ref: reference/lexical_analysis physical-lines7622516
Ref: 22a87622516
Ref: reference/lexical_analysis grammar-token-python-grammar-newline7623240
Ref: 22a97623240
Ref: 物理行 physical line-Footnote-17623339
Node: コメント Comments7623392
Ref: reference/lexical_analysis comments7623542
Ref: 229e7623542
Ref: reference/lexical_analysis id57623542
Ref: 22aa7623542
Node: エンコード宣言 encoding declaration7623920
Ref: reference/lexical_analysis encoding-declarations7624068
Ref: 22ab7624068
Ref: reference/lexical_analysis encodings7624068
Ref: 22997624068
Ref: reference/lexical_analysis lexical-source-character7625529
Ref: 229a7625529
Ref: reference/lexical_analysis grammar-token-python-grammar-source_character7625751
Ref: 22ac7625751
Node: 明示的な行継続7625813
Ref: reference/lexical_analysis explicit-joining7625964
Ref: 229d7625964
Ref: reference/lexical_analysis explicit-line-joining7625964
Ref: 22ad7625964
Node: 非明示的な行継続7627353
Ref: reference/lexical_analysis implicit-joining7627468
Ref: 22a67627468
Ref: reference/lexical_analysis implicit-line-joining7627468
Ref: 22ae7627468
Node: 空行7628497
Ref: reference/lexical_analysis blank-lines7628606
Ref: 22af7628606
Ref: reference/lexical_analysis id67628606
Ref: 22b07628606
Node: インデント7629085
Ref: reference/lexical_analysis id77629194
Ref: 22b17629194
Ref: reference/lexical_analysis indentation7629194
Ref: 229c7629194
Node: トークン間の空白7633236
Ref: reference/lexical_analysis whitespace7633349
Ref: 22937633349
Ref: reference/lexical_analysis whitespace-between-tokens7633349
Ref: 22b37633349
Ref: reference/lexical_analysis grammar-token-python-grammar-whitespace7633572
Ref: 22b47633572
Node: End marker7633913
Ref: reference/lexical_analysis end-marker7634002
Ref: 22b57634002
Ref: reference/lexical_analysis endmarker-token7634002
Ref: 22a27634002
Node: その他のトークン7634145
Ref: reference/lexical_analysis id87634275
Ref: 22b77634275
Ref: reference/lexical_analysis other-tokens7634275
Ref: 22b87634275
Node: Names identifiers and keywords7634881
Ref: reference/lexical_analysis identifiers7635014
Ref: 22a07635014
Ref: reference/lexical_analysis names-identifiers-and-keywords7635014
Ref: 22bc7635014
Ref: reference/lexical_analysis grammar-token-python-grammar-NAME7635754
Ref: 22be7635754
Ref: reference/lexical_analysis grammar-token-python-grammar-name_start7635826
Ref: 22bf7635826
Ref: reference/lexical_analysis grammar-token-python-grammar-name_continue7635898
Ref: 22c07635898
Ref: reference/lexical_analysis grammar-token-python-grammar-identifier7635941
Ref: 22c17635941
Node: キーワード keyword7636371
Ref: reference/lexical_analysis id97636494
Ref: 22c27636494
Ref: reference/lexical_analysis keywords7636494
Ref: 22897636494
Node: ソフトキーワード7637112
Ref: reference/lexical_analysis id107637303
Ref: 22c37637303
Ref: reference/lexical_analysis soft-keywords7637303
Ref: a0d7637303
Node: 予約済みの識別子種 reserved classes of identifiers7637994
Ref: reference/lexical_analysis id-classes7638191
Ref: 22c47638191
Ref: reference/lexical_analysis reserved-classes-of-identifiers7638191
Ref: 22c57638191
Node: Non-ASCII characters in names7640643
Ref: reference/lexical_analysis lexical-names-nonascii7640807
Ref: 22bd7640807
Ref: reference/lexical_analysis non-ascii-characters-in-names7640807
Ref: 22c77640807
Ref: Non-ASCII characters in names-Footnote-17644360
Ref: Non-ASCII characters in names-Footnote-27644417
Ref: Non-ASCII characters in names-Footnote-37644463
Ref: Non-ASCII characters in names-Footnote-47644509
Ref: Non-ASCII characters in names-Footnote-57644586
Ref: Non-ASCII characters in names-Footnote-67644649
Ref: Non-ASCII characters in names-Footnote-77644712
Ref: Non-ASCII characters in names-Footnote-87644754
Node: リテラル7644796
Ref: reference/lexical_analysis id117644947
Ref: 22c87644947
Ref: reference/lexical_analysis literals7644947
Ref: 22c97644947
Node: 文字列およびバイト列リテラル7645352
Ref: reference/lexical_analysis string-and-bytes-literals7645491
Ref: 22cb7645491
Ref: reference/lexical_analysis strings7645491
Ref: 229f7645491
Node: Triple-quoted strings7646672
Ref: reference/lexical_analysis triple-quoted-strings7646796
Ref: 22cc7646796
Node: String prefixes7647425
Ref: reference/lexical_analysis string-prefixes7647572
Ref: 22cd7647572
Ref: String prefixes-Footnote-17648827
Node: Formal grammar7648869
Ref: reference/lexical_analysis formal-grammar7649011
Ref: 22d07649011
Ref: reference/lexical_analysis grammar-token-python-grammar-STRING7649305
Ref: 22d17649305
Ref: reference/lexical_analysis grammar-token-python-grammar-stringprefix7649384
Ref: 22d27649384
Ref: reference/lexical_analysis grammar-token-python-grammar-stringcontent7649458
Ref: 22d37649458
Ref: reference/lexical_analysis grammar-token-python-grammar-stringitem7649702
Ref: 22d57649702
Ref: reference/lexical_analysis grammar-token-python-grammar-stringchar7649779
Ref: 22d67649779
Ref: reference/lexical_analysis grammar-token-python-grammar-longstringitem7649866
Ref: 22d47649866
Ref: reference/lexical_analysis grammar-token-python-grammar-stringescapeseq7649922
Ref: 22d77649922
Node: Escape sequences7650142
Ref: reference/lexical_analysis escape-sequences7650283
Ref: 6877650283
Ref: reference/lexical_analysis id127650283
Ref: 22d87650283
Node: Ignored end of line7654195
Ref: reference/lexical_analysis ignored-end-of-line7654294
Ref: 22df7654294
Ref: reference/lexical_analysis string-escape-ignore7654294
Ref: 22d97654294
Node: Escaped characters7654714
Ref: reference/lexical_analysis escaped-characters7654837
Ref: 22e17654837
Ref: reference/lexical_analysis string-escape-escaped-char7654837
Ref: 22da7654837
Node: Octal character7655262
Ref: reference/lexical_analysis octal-character7655387
Ref: 22e27655387
Ref: reference/lexical_analysis string-escape-oct7655387
Ref: 22db7655387
Node: Hexadecimal character7656066
Ref: reference/lexical_analysis hexadecimal-character7656196
Ref: 22e37656196
Ref: reference/lexical_analysis string-escape-hex7656196
Ref: 22dc7656196
Node: Named Unicode character7656595
Ref: reference/lexical_analysis named-unicode-character7656740
Ref: 22e47656740
Ref: reference/lexical_analysis string-escape-named7656740
Ref: 22dd7656740
Ref: Named Unicode character-Footnote-17657138
Node: Hexadecimal Unicode characters7657204
Ref: reference/lexical_analysis hexadecimal-unicode-characters7657357
Ref: 22e57657357
Ref: reference/lexical_analysis string-escape-long-hex7657357
Ref: 22de7657357
Node: Unrecognized escape sequences7657822
Ref: reference/lexical_analysis unrecognized-escape-sequences7657943
Ref: 22e67657943
Node: Bytes literals7658675
Ref: reference/lexical_analysis bytes-literal7658821
Ref: 22ce7658821
Ref: reference/lexical_analysis bytes-literals7658821
Ref: 22e77658821
Node: Raw string literals7659470
Ref: reference/lexical_analysis raw-string-literals7659609
Ref: 22e87659609
Ref: reference/lexical_analysis raw-strings7659609
Ref: 22cf7659609
Ref: reference/lexical_analysis f-strings7660926
Ref: 19a7660926
Node: f-strings7660926
Ref: reference/lexical_analysis formatted-string-literals7661060
Ref: 22e97661060
Ref: reference/lexical_analysis id137661060
Ref: 22ea7661060
Ref: reference/lexical_analysis t-strings7666095
Ref: 17fa7666095
Ref: f-strings-Footnote-17666131
Ref: f-strings-Footnote-27666173
Node: t-strings7666215
Ref: reference/lexical_analysis id147666358
Ref: 22ed7666358
Ref: reference/lexical_analysis template-string-literals7666358
Ref: 22ee7666358
Node: Formal grammar for f-strings7666712
Ref: reference/lexical_analysis formal-grammar-for-f-strings7666837
Ref: 22f07666837
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring7668244
Ref: 22f47668244
Ref: reference/lexical_analysis grammar-token-python-grammar-FSTRING_START7668343
Ref: 22f57668343
Ref: reference/lexical_analysis grammar-token-python-grammar-FSTRING_END7668423
Ref: 22f77668423
Ref: reference/lexical_analysis grammar-token-python-grammar-fstringprefix7668469
Ref: 22f87668469
Ref: reference/lexical_analysis grammar-token-python-grammar-f_debug_specifier7668534
Ref: 22fa7668534
Ref: reference/lexical_analysis grammar-token-python-grammar-f_quote7668563
Ref: 22f97668563
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring_middle7668636
Ref: 22f67668636
Ref: reference/lexical_analysis grammar-token-python-grammar-FSTRING_MIDDLE7668744
Ref: 22fc7668744
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring_replacement_field7668988
Ref: 22fb7668988
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring_conversion7669185
Ref: 22fe7669185
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring_full_format_spec7669242
Ref: 22ff7669242
Ref: reference/lexical_analysis grammar-token-python-grammar-fstring_format_spec7669321
Ref: 23007669321
Ref: reference/lexical_analysis grammar-token-python-grammar-f_expression7669434
Ref: 22fd7669434
Ref: reference/lexical_analysis grammar-token-python-grammar-tstring7670064
Ref: 23047670064
Node: 数値リテラル7670183
Ref: reference/lexical_analysis numbers7670334
Ref: 22a17670334
Ref: reference/lexical_analysis numeric-literals7670334
Ref: 23057670334
Ref: reference/lexical_analysis grammar-token-python-grammar-NUMBER7670524
Ref: 23067670524
Node: 整数リテラル7671157
Ref: reference/lexical_analysis integer-literals7671262
Ref: 230a7671262
Ref: reference/lexical_analysis integers7671262
Ref: 230b7671262
Ref: reference/lexical_analysis grammar-token-python-grammar-integer7672716
Ref: 23077672716
Ref: reference/lexical_analysis grammar-token-python-grammar-decinteger7672864
Ref: 230c7672864
Ref: reference/lexical_analysis grammar-token-python-grammar-bininteger7672937
Ref: 230d7672937
Ref: reference/lexical_analysis grammar-token-python-grammar-octinteger7673003
Ref: 230e7673003
Ref: reference/lexical_analysis grammar-token-python-grammar-hexinteger7673069
Ref: 230f7673069
Ref: reference/lexical_analysis grammar-token-python-grammar-zerointeger7673135
Ref: 23107673135
Ref: reference/lexical_analysis grammar-token-python-grammar-nonzerodigit7673172
Ref: 23117673172
Ref: reference/lexical_analysis grammar-token-python-grammar-digit7673201
Ref: 23127673201
Ref: reference/lexical_analysis grammar-token-python-grammar-bindigit7673230
Ref: 23137673230
Ref: reference/lexical_analysis grammar-token-python-grammar-octdigit7673259
Ref: 23147673259
Ref: reference/lexical_analysis grammar-token-python-grammar-hexdigit7673288
Ref: 23157673288
Node: Floating-point literals7673499
Ref: reference/lexical_analysis floating7673642
Ref: 23167673642
Ref: reference/lexical_analysis floating-point-literals7673642
Ref: 23177673642
Ref: reference/lexical_analysis grammar-token-python-grammar-floatnumber7675115
Ref: 23087675115
Ref: reference/lexical_analysis grammar-token-python-grammar-digitpart7675335
Ref: 23197675335
Ref: reference/lexical_analysis grammar-token-python-grammar-exponent7675398
Ref: 231a7675398
Node: 虚数 imaginary リテラル7675610
Ref: reference/lexical_analysis imaginary7675726
Ref: 231b7675726
Ref: reference/lexical_analysis imaginary-literals7675726
Ref: 231c7675726
Ref: reference/lexical_analysis grammar-token-python-grammar-imagnumber7677254
Ref: 23097677254
Ref: reference/lexical_analysis delimiters7677335
Ref: 228b7677335
Ref: reference/lexical_analysis operators7677335
Ref: 228c7677335
Node: Operators and delimiters7677336
Ref: reference/lexical_analysis lexical-ellipsis7677436
Ref: 22ca7677436
Ref: reference/lexical_analysis operators-and-delimiters7677436
Ref: 231d7677436
Ref: reference/lexical_analysis grammar-token-python-grammar-OP7677726
Ref: 231f7677726
Ref: reference/lexical_analysis grammar-token-python-grammar-assignment_operator7677944
Ref: 23207677944
Ref: reference/lexical_analysis grammar-token-python-grammar-bitwise_operator7678102
Ref: 23217678102
Ref: reference/lexical_analysis grammar-token-python-grammar-comparison_operator7678172
Ref: 23227678172
Ref: reference/lexical_analysis grammar-token-python-grammar-enclosing_delimiter7678242
Ref: 23237678242
Ref: reference/lexical_analysis grammar-token-python-grammar-other_delimiter7678311
Ref: 23247678311
Ref: reference/lexical_analysis grammar-token-python-grammar-arithmetic_operator7678381
Ref: 23257678381
Ref: reference/lexical_analysis grammar-token-python-grammar-other_op7678458
Ref: 23267678458
Node: データモデル7679507
Ref: reference/datamodel doc7679638
Ref: 23297679638
Ref: reference/datamodel data-model7679638
Ref: 232a7679638
Ref: reference/datamodel datamodel7679638
Ref: 1d5a7679638
Ref: reference/datamodel translation-repo7679638
Ref: 232b7679638
Node: オブジェクト、値、および型7679802
Ref: reference/datamodel objects7679923
Ref: 232c7679923
Ref: reference/datamodel objects-values-and-types7679923
Ref: 232d7679923
Ref: オブジェクト、値、および型-Footnote-17686259
Node: 標準型の階層7686534
Ref: reference/datamodel the-standard-type-hierarchy7686685
Ref: 232e7686685
Ref: reference/datamodel types7686685
Ref: 232f7686685
Node: None7688266
Ref: reference/datamodel none7688348
Ref: 23307688348
Node: NotImplemented7688830
Ref: reference/datamodel notimplemented7688929
Ref: 23317688929
Node: Ellipsis7689840
Ref: reference/datamodel ellipsis7689949
Ref: 23337689949
Node: numbers Number7690289
Ref: reference/datamodel numbers-number7690411
Ref: 23347690411
Node: numbers Integral 整数7691917
Ref: reference/datamodel numbers-integral7692025
Ref: 23357692025
Node: numbers Real float 実数7693355
Ref: reference/datamodel datamodel-float7693495
Ref: 23187693495
Ref: reference/datamodel numbers-real-float7693495
Ref: 23367693495
Node: numbers Complex complex7694096
Ref: reference/datamodel numbers-complex-complex7694204
Ref: 23377694204
Node: シーケンス型 sequence7694584
Ref: reference/datamodel datamodel-sequences7694710
Ref: 23387694710
Ref: reference/datamodel sequences7694710
Ref: 23397694710
Node: 変更不能なシーケンス immutable sequence7696708
Ref: reference/datamodel immutable-sequences7696880
Ref: 233a7696880
Node: 変更可能なシーケンス型 mutable sequence7699315
Ref: reference/datamodel mutable-sequences7699487
Ref: 233c7699487
Node: 集合型<2>7700919
Ref: reference/datamodel set-types7701057
Ref: 233d7701057
Node: マッピング型 mapping7702602
Ref: reference/datamodel datamodel-mappings7702748
Ref: 233f7702748
Ref: reference/datamodel mappings7702748
Ref: 23407702748
Node: 辞書型 dictionary<2>7703454
Ref: reference/datamodel dictionaries7703540
Ref: 23417703540
Node: 呼び出し可能型 callable type7705237
Ref: reference/datamodel callable-types7705389
Ref: 23427705389
Node: ユーザ定義関数 user-defined function7706272
Ref: reference/datamodel user-defined-funcs7706426
Ref: 59c7706426
Ref: reference/datamodel user-defined-functions7706426
Ref: 23437706426
Node: Special read-only attributes7706873
Ref: reference/datamodel special-read-only-attributes7707017
Ref: 23447707017
Ref: reference/datamodel function __builtins__7707417
Ref: 23457707417
Ref: reference/datamodel function __globals__7707863
Ref: 14eb7707863
Ref: reference/datamodel function __closure__7708368
Ref: 14e87708368
Node: Special writable attributes7709188
Ref: reference/datamodel special-writable-attributes7709332
Ref: 23487709332
Ref: reference/datamodel function __doc__7709789
Ref: 13f17709789
Ref: reference/datamodel function __name__7710152
Ref: 14ec7710152
Ref: reference/datamodel function __qualname__7710446
Ref: 23497710446
Ref: reference/datamodel function __module__7710893
Ref: 234a7710893
Ref: reference/datamodel function __defaults__7711251
Ref: 14e97711251
Ref: reference/datamodel function __code__7711745
Ref: 59d7711745
Ref: reference/datamodel function __dict__7712039
Ref: 14ea7712039
Ref: reference/datamodel function __annotations__7712425
Ref: 13f07712425
Ref: reference/datamodel function __annotate__7713309
Ref: 234c7713309
Ref: reference/datamodel function __kwdefaults__7713866
Ref: 12297713866
Ref: reference/datamodel function __type_params__7714178
Ref: 234d7714178
Ref: Special writable attributes-Footnote-17715207
Node: インスタンスメソッド7715249
Ref: reference/datamodel id27715455
Ref: 234f7715455
Ref: reference/datamodel instance-methods7715455
Ref: 20a77715455
Ref: reference/datamodel method __self__7715789
Ref: 15e27715789
Ref: reference/datamodel method __func__7716092
Ref: 15147716092
Ref: reference/datamodel method __doc__7716312
Ref: 23517716312
Ref: reference/datamodel method __name__7716804
Ref: 23527716804
Ref: reference/datamodel method __module__7717102
Ref: 23537717102
Ref: reference/datamodel method-binding7717671
Ref: 23507717671
Node: ジェネレータ関数 generator function7719139
Ref: reference/datamodel generator-functions7719342
Ref: 23547719342
Node: コルーチン関数 coroutine function7720147
Ref: reference/datamodel coroutine-functions7720385
Ref: 23557720385
Node: 非同期ジェネレータ関数 asynchronous generator function7720961
Ref: reference/datamodel asynchronous-generator-functions7721192
Ref: 23577721192
Node: 組み込み関数 built-in function7722289
Ref: reference/datamodel built-in-functions7722520
Ref: 23587722520
Ref: reference/datamodel builtin-functions7722520
Ref: 234e7722520
Node: 組み込みメソッド built-in method7723340
Ref: reference/datamodel built-in-methods7723518
Ref: 23597723518
Ref: reference/datamodel builtin-methods7723518
Ref: 235a7723518
Node: クラス<2>7724051
Ref: reference/datamodel classes7724223
Ref: 235b7724223
Ref: reference/datamodel id37724223
Ref: 235c7724223
Node: クラスのインスタンス7724577
Ref: reference/datamodel class-instances7724700
Ref: 235d7724700
Node: モジュール<3>7724927
Ref: reference/datamodel module-objects7725077
Ref: 235e7725077
Ref: reference/datamodel modules7725077
Ref: 235f7725077
Node: Import-related attributes on module objects7726151
Ref: reference/datamodel import-mod-attrs7726301
Ref: 23617726301
Ref: reference/datamodel import-related-attributes-on-module-objects7726301
Ref: 23627726301
Ref: reference/datamodel module __name__7727938
Ref: 15a37727938
Ref: reference/datamodel module __spec__7728277
Ref: 23647728277
Ref: reference/datamodel module __package__7728534
Ref: 3237728534
Ref: reference/datamodel module __loader__7730638
Ref: 33b7730638
Ref: reference/datamodel module __path__7731866
Ref: 20547731866
Ref: reference/datamodel module __file__7732321
Ref: 23697732321
Ref: reference/datamodel module __cached__7732353
Ref: 3217732353
Ref: Import-related attributes on module objects-Footnote-17734336
Ref: Import-related attributes on module objects-Footnote-27734378
Node: Other writable attributes on module objects7734420
Ref: reference/datamodel other-writable-attributes-on-module-objects7734598
Ref: 236b7734598
Ref: reference/datamodel module __doc__7734821
Ref: 1bef7734821
Ref: reference/datamodel module __annotations__7734970
Ref: 236c7734970
Ref: reference/datamodel module __annotate__7735318
Ref: 236d7735318
Ref: Other writable attributes on module objects-Footnote-17735583
Node: Module dictionaries7735625
Ref: reference/datamodel module-dictionaries7735751
Ref: 236e7735751
Ref: reference/datamodel module __dict__7735879
Ref: 236f7735879
Node: カスタムクラス型7736540
Ref: reference/datamodel class-attrs-and-methods7736697
Ref: 23707736697
Ref: reference/datamodel custom-classes7736697
Ref: 23717736697
Node: Special attributes7738427
Ref: reference/datamodel special-attributes7738530
Ref: 23727738530
Ref: reference/datamodel type __name__7738902
Ref: 16c47738902
Ref: reference/datamodel type __qualname__7739193
Ref: 23737739193
Ref: reference/datamodel type __module__7739504
Ref: 6177739504
Ref: reference/datamodel type __dict__7739733
Ref: e577739733
Ref: reference/datamodel type __bases__7740138
Ref: 16c57740138
Ref: reference/datamodel type __base__7740644
Ref: 23747740644
Ref: reference/datamodel type __doc__7741176
Ref: 20957741176
Ref: reference/datamodel type __annotations__7741501
Ref: 18437741501
Ref: reference/datamodel type __annotate__7743973
Ref: 18677743973
Ref: reference/datamodel type __type_params__7744530
Ref: 23767744530
Ref: reference/datamodel type __static_attributes__7745045
Ref: 4777745045
Ref: reference/datamodel type __firstlineno__7745589
Ref: 4787745589
Ref: reference/datamodel type __mro__7746244
Ref: 23787746244
Ref: Special attributes-Footnote-17746587
Ref: Special attributes-Footnote-27746648
Node: Special methods7746690
Ref: reference/datamodel special-methods7746793
Ref: 23797746793
Ref: reference/datamodel type mro7746966
Ref: 237a7746966
Ref: reference/datamodel type __subclasses__7747205
Ref: 7937747205
Node: クラスインスタンス class instance7747561
Ref: reference/datamodel id47747762
Ref: 237b7747762
Node: Special attributes<2>7749526
Ref: reference/datamodel id57749626
Ref: 237e7749626
Ref: reference/datamodel object __class__7749683
Ref: 16c67749683
Ref: reference/datamodel object __dict__7749786
Ref: 77d7749786
Node: I/O オブジェクト ファイルオブジェクトの別名7750037
Ref: reference/datamodel i-o-objects-also-known-as-file-objects7750237
Ref: 23807750237
Node: 内部型 internal type7751222
Ref: reference/datamodel internal-types7751371
Ref: 23827751371
Node: コードオブジェクト7752205
Ref: reference/datamodel code-objects7752338
Ref: 4e67752338
Ref: reference/datamodel id67752338
Ref: 23837752338
Node: Special read-only attributes<2>7753410
Ref: reference/datamodel id77753537
Ref: 23847753537
Ref: reference/datamodel codeobject co_name7753647
Ref: 23857753647
Ref: reference/datamodel codeobject co_qualname7753839
Ref: 23867753839
Ref: reference/datamodel codeobject co_argcount7754177
Ref: 23877754177
Ref: reference/datamodel codeobject co_posonlyargcount7754670
Ref: 23887754670
Ref: reference/datamodel codeobject co_kwonlyargcount7755067
Ref: 23897755067
Ref: reference/datamodel codeobject co_nlocals7755455
Ref: 238a7755455
Ref: reference/datamodel codeobject co_varnames7755768
Ref: 238b7755768
Ref: reference/datamodel codeobject co_cellvars7756164
Ref: 238c7756164
Ref: reference/datamodel codeobject co_freevars7756656
Ref: 23477756656
Ref: reference/datamodel codeobject co_code7757407
Ref: 238e7757407
Ref: reference/datamodel codeobject co_consts7757722
Ref: 189b7757722
Ref: reference/datamodel codeobject co_names7758039
Ref: 238f7758039
Ref: reference/datamodel codeobject co_filename7758357
Ref: 15857758357
Ref: reference/datamodel codeobject co_firstlineno7758639
Ref: 23907758639
Ref: reference/datamodel codeobject co_lnotab7758854
Ref: 3307758854
Ref: reference/datamodel codeobject co_stacksize7759609
Ref: 23917759609
Ref: reference/datamodel codeobject co_flags7759818
Ref: 18db7759818
Node: Methods on code objects7760999
Ref: reference/datamodel methods-on-code-objects7761126
Ref: 23957761126
Ref: reference/datamodel codeobject co_positions7761193
Ref: 7d07761193
Ref: reference/datamodel codeobject co_lines7762748
Ref: 3507762748
Ref: reference/datamodel codeobject replace7764379
Ref: 23967764379
Ref: Methods on code objects-Footnote-17764672
Node: フレーム frame オブジェクト7764714
Ref: reference/datamodel frame-objects7764906
Ref: 8ef7764906
Ref: reference/datamodel id87764906
Ref: 23977764906
Node: Special read-only attributes<3>7765301
Ref: reference/datamodel id97765445
Ref: 23987765445
Ref: reference/datamodel frame f_back7765549
Ref: 98f7765549
Ref: reference/datamodel frame f_code7765879
Ref: 23997765879
Ref: reference/datamodel frame f_locals7766408
Ref: 4a57766408
Ref: reference/datamodel frame f_globals7767150
Ref: 239a7767150
Ref: reference/datamodel frame f_builtins7767450
Ref: 239b7767450
Ref: reference/datamodel frame f_lasti7767756
Ref: a887767756
Ref: reference/datamodel frame f_generator7768173
Ref: 239c7768173
Node: Special writable attributes<2>7768630
Ref: reference/datamodel id107768803
Ref: 239d7768803
Ref: reference/datamodel frame f_trace7768906
Ref: 239e7768906
Ref: reference/datamodel frame f_trace_lines7769452
Ref: dd67769452
Ref: reference/datamodel frame f_trace_opcodes7769779
Ref: dd77769779
Ref: reference/datamodel frame f_lineno7770385
Ref: 9af7770385
Node: Frame object methods7770929
Ref: reference/datamodel frame-object-methods7771062
Ref: 239f7771062
Ref: reference/datamodel frame clear7771201
Ref: 5857771201
Node: トレースバック traceback オブジェクト7771896
Ref: reference/datamodel id117772098
Ref: 23a07772098
Ref: reference/datamodel traceback-objects7772098
Ref: cec7772098
Ref: reference/datamodel traceback tb_frame7773479
Ref: 23a17773479
Ref: reference/datamodel traceback tb_lineno7774125
Ref: 23a27774125
Ref: reference/datamodel traceback tb_lasti7774345
Ref: 23a37774345
Ref: reference/datamodel traceback tb_next7774709
Ref: ceb7774709
Node: スライス slice オブジェクト7775000
Ref: reference/datamodel slice-objects7775216
Ref: 23a47775216
Ref: reference/datamodel slice indices7775899
Ref: 12287775899
Node: 静的メソッド static method オブジェクト7776540
Ref: reference/datamodel static-method-objects7776745
Ref: 23a87776745
Node: クラスメソッドオブジェクト7777713
Ref: reference/datamodel class-method-objects7777872
Ref: 23a97777872
Node: 特殊メソッド名7778340
Ref: reference/datamodel special-method-names7778467
Ref: 23aa7778467
Ref: reference/datamodel specialnames7778467
Ref: e687778467
Ref: 特殊メソッド名-Footnote-17780911
Node: 基本的なカスタマイズ7781248
Ref: reference/datamodel basic-customization7781393
Ref: 23ac7781393
Ref: reference/datamodel customization7781393
Ref: 23ad7781393
Ref: reference/datamodel object __new__7781462
Ref: 7a07781462
Ref: reference/datamodel object __init__7783548
Ref: 8bf7783548
Ref: reference/datamodel object __del__7784688
Ref: 11ff7784688
Ref: reference/datamodel object __repr__7788726
Ref: 82f7788726
Ref: reference/datamodel object __str__7789826
Ref: 8307789826
Ref: reference/datamodel object __bytes__7790590
Ref: 7fe7790590
Ref: reference/datamodel object __format__7790852
Ref: 8317790852
Ref: reference/datamodel richcmpfuncs7792350
Ref: 23ae7792350
Ref: reference/datamodel object __lt__7792350
Ref: 14b87792350
Ref: reference/datamodel object __le__7792396
Ref: 15227792396
Ref: reference/datamodel object __eq__7792442
Ref: cf27792442
Ref: reference/datamodel object __ne__7792488
Ref: 17307792488
Ref: reference/datamodel object __gt__7792534
Ref: 15237792534
Ref: reference/datamodel object __ge__7792580
Ref: 15247792580
Ref: reference/datamodel object __hash__7795923
Ref: cf37795923
Ref: reference/datamodel object __bool__7801252
Ref: 14ed7801252
Node: 属性値アクセスをカスタマイズする7801758
Ref: reference/datamodel attribute-access7801954
Ref: 23af7801954
Ref: reference/datamodel customizing-attribute-access7801954
Ref: 23b07801954
Ref: reference/datamodel object __getattr__7802288
Ref: 6fa7802288
Ref: reference/datamodel object __getattribute__7803613
Ref: dcb7803613
Ref: reference/datamodel object __setattr__7805006
Ref: 237c7805006
Ref: reference/datamodel object __delattr__7805863
Ref: 237d7805863
Ref: reference/datamodel object __dir__7806396
Ref: 17e27806396
Node: モジュールの属性値アクセスをカスタマイズする7806845
Ref: reference/datamodel customizing-module-attribute-access7807044
Ref: 23b27807044
Ref: reference/datamodel module __getattr__7807173
Ref: cd87807173
Ref: reference/datamodel module __dir__7807213
Ref: cd97807213
Ref: reference/datamodel module __class__7808189
Ref: 23b37808189
Ref: モジュールの属性値アクセスをカスタマイズする-Footnote-17809690
Node: デスクリプタ descriptor の実装7809732
Ref: reference/datamodel descriptors7809973
Ref: e497809973
Ref: reference/datamodel implementing-descriptors7809973
Ref: 23b47809973
Ref: reference/datamodel object __get__7810550
Ref: 17017810550
Ref: reference/datamodel object __set__7811669
Ref: 23b57811669
Ref: reference/datamodel object __delete__7812138
Ref: 194f7812138
Ref: reference/datamodel object __objclass__7812398
Ref: 23b77812398
Ref: デスクリプタ descriptor の実装-Footnote-17812965
Node: デスクリプタの呼び出し7813007
Ref: reference/datamodel descriptor-invocation7813194
Ref: 23b67813194
Ref: reference/datamodel invoking-descriptors7813194
Ref: 23b87813194
Node: __slots__<2>7817428
Ref: reference/datamodel id137817567
Ref: 23b97817567
Ref: reference/datamodel slots7817567
Ref: 237f7817567
Ref: reference/datamodel object __slots__7818067
Ref: 17047818067
Ref: reference/datamodel datamodel-note-slots7818504
Ref: 23ba7818504
Node: クラス生成をカスタマイズする7822281
Ref: reference/datamodel class-customization7822516
Ref: e457822516
Ref: reference/datamodel customizing-class-creation7822516
Ref: 23bc7822516
Ref: reference/datamodel object __init_subclass__7823182
Ref: 8437823182
Ref: reference/datamodel object __set_name__7824864
Ref: e487824864
Node: メタクラス7825945
Ref: reference/datamodel id147826073
Ref: 23bd7826073
Ref: reference/datamodel metaclasses7826073
Ref: 23be7826073
Node: MRO エントリの解決7827312
Ref: reference/datamodel resolving-mro-entries7827482
Ref: 23bf7827482
Ref: reference/datamodel object __mro_entries__7827544
Ref: ce37827544
Ref: MRO エントリの解決-Footnote-17828553
Node: 適切なメタクラスの決定7828595
Ref: reference/datamodel determining-the-appropriate-metaclass7828783
Ref: 23c07828783
Node: クラスの名前空間の準備7829982
Ref: reference/datamodel prepare7830169
Ref: e587830169
Ref: reference/datamodel preparing-the-class-namespace7830169
Ref: 23c17830169
Ref: クラスの名前空間の準備-Footnote-17831212
Node: クラス本体の実行7831254
Ref: reference/datamodel executing-the-class-body7831444
Ref: 23c27831444
Node: クラスオブジェクトの作成7832414
Ref: reference/datamodel class-object-creation7832595
Ref: e447832595
Ref: reference/datamodel creating-the-class-object7832595
Ref: 23c37832595
Ref: クラスオブジェクトの作成-Footnote-17835754
Node: メタクラスの用途7835796
Ref: reference/datamodel uses-for-metaclasses7835944
Ref: 23c47835944
Node: インスタンスのカスタマイズとサブクラスチェック7836386
Ref: reference/datamodel customizing-instance-and-subclass-checks7836621
Ref: 23c57836621
Ref: reference/datamodel type __instancecheck__7837230
Ref: 23c67837230
Ref: reference/datamodel type __subclasscheck__7837542
Ref: 23c77837542
Ref: インスタンスのカスタマイズとサブクラスチェック-Footnote-17838670
Node: ジェネリック型をエミュレートする7838712
Ref: reference/datamodel emulating-generic-types7838968
Ref: 23c87838968
Ref: reference/datamodel object __class_getitem__7839977
Ref: 9437839977
Ref: ジェネリック型をエミュレートする-Footnote-17840498
Node: The purpose of __class_getitem__7840540
Ref: reference/datamodel the-purpose-of-class-getitem7840702
Ref: 23ca7840702
Node: __class_getitem__ versus __getitem__7841593
Ref: reference/datamodel class-getitem-versus-getitem7841755
Ref: 23cc7841755
Ref: reference/datamodel classgetitem-versus-getitem7841755
Ref: 23cd7841755
Ref: __class_getitem__ versus __getitem__-Footnote-17845119
Node: 呼び出し可能オブジェクトをエミュレートする7845161
Ref: reference/datamodel emulating-callable-objects7845387
Ref: 23d17845387
Ref: reference/datamodel id157845387
Ref: 23d27845387
Ref: reference/datamodel object __call__7845513
Ref: 77a7845513
Node: コンテナをエミュレートする7845818
Ref: reference/datamodel emulating-container-types7846032
Ref: 23d37846032
Ref: reference/datamodel sequence-types7846032
Ref: 23d47846032
Ref: reference/datamodel object __len__7848482
Ref: 178f7848482
Ref: reference/datamodel object __length_hint__7849215
Ref: 110f7849215
Ref: reference/datamodel object __getitem__7850092
Ref: 5887850092
Ref: reference/datamodel object __setitem__7851727
Ref: 14e37851727
Ref: reference/datamodel object __delitem__7852388
Ref: 14e47852388
Ref: reference/datamodel object __missing__7852934
Ref: 13d57852934
Ref: reference/datamodel object __iter__7853208
Ref: e697853208
Ref: reference/datamodel object __reversed__7853706
Ref: e867853706
Ref: reference/datamodel object __contains__7854900
Ref: 15d37854900
Node: 数値型をエミュレートする7855700
Ref: reference/datamodel emulating-numeric-types7855894
Ref: 23e77855894
Ref: reference/datamodel numeric-types7855894
Ref: 23e87855894
Ref: reference/datamodel object __add__7856332
Ref: 23dd7856332
Ref: reference/datamodel object __sub__7856379
Ref: 23e97856379
Ref: reference/datamodel object __mul__7856426
Ref: 23e07856426
Ref: reference/datamodel object __matmul__7856473
Ref: f797856473
Ref: reference/datamodel object __truediv__7856523
Ref: 10907856523
Ref: reference/datamodel object __floordiv__7856574
Ref: 170d7856574
Ref: reference/datamodel object __mod__7856626
Ref: 23ea7856626
Ref: reference/datamodel object __divmod__7856673
Ref: 10917856673
Ref: reference/datamodel object __pow__7856723
Ref: 9d47856723
Ref: reference/datamodel object __lshift__7856780
Ref: 23eb7856780
Ref: reference/datamodel object __rshift__7856830
Ref: 23ec7856830
Ref: reference/datamodel object __and__7856880
Ref: 23ed7856880
Ref: reference/datamodel object __xor__7856927
Ref: 23ee7856927
Ref: reference/datamodel object __or__7856974
Ref: 23ef7856974
Ref: reference/datamodel object __radd__7857991
Ref: 23de7857991
Ref: reference/datamodel object __rsub__7858039
Ref: 23f07858039
Ref: reference/datamodel object __rmul__7858087
Ref: 23e17858087
Ref: reference/datamodel object __rmatmul__7858135
Ref: f7a7858135
Ref: reference/datamodel object __rtruediv__7858186
Ref: 23f17858186
Ref: reference/datamodel object __rfloordiv__7858238
Ref: 23f27858238
Ref: reference/datamodel object __rmod__7858291
Ref: fd57858291
Ref: reference/datamodel object __rdivmod__7858339
Ref: 23f37858339
Ref: reference/datamodel object __rpow__7858390
Ref: 1a57858390
Ref: reference/datamodel object __rlshift__7858448
Ref: 23f47858448
Ref: reference/datamodel object __rrshift__7858499
Ref: 23f57858499
Ref: reference/datamodel object __rand__7858550
Ref: 23f67858550
Ref: reference/datamodel object __rxor__7858598
Ref: 23f77858598
Ref: reference/datamodel object __ror__7858646
Ref: 23f87858646
Ref: reference/datamodel object __iadd__7860469
Ref: 23df7860469
Ref: reference/datamodel object __isub__7860517
Ref: 23f97860517
Ref: reference/datamodel object __imul__7860565
Ref: 23e27860565
Ref: reference/datamodel object __imatmul__7860613
Ref: f7b7860613
Ref: reference/datamodel object __itruediv__7860664
Ref: 23fa7860664
Ref: reference/datamodel object __ifloordiv__7860716
Ref: 23fb7860716
Ref: reference/datamodel object __imod__7860769
Ref: 23fc7860769
Ref: reference/datamodel object __ipow__7860817
Ref: 9d37860817
Ref: reference/datamodel object __ilshift__7860875
Ref: 23fd7860875
Ref: reference/datamodel object __irshift__7860926
Ref: 23fe7860926
Ref: reference/datamodel object __iand__7860977
Ref: 23ff7860977
Ref: reference/datamodel object __ixor__7861025
Ref: 24007861025
Ref: reference/datamodel object __ior__7861073
Ref: 24017861073
Ref: reference/datamodel object __neg__7862297
Ref: 24037862297
Ref: reference/datamodel object __pos__7862337
Ref: 24047862337
Ref: reference/datamodel object __abs__7862377
Ref: 24057862377
Ref: reference/datamodel object __invert__7862417
Ref: 24067862417
Ref: reference/datamodel object __complex__7862586
Ref: 7fd7862586
Ref: reference/datamodel object __int__7862630
Ref: 19d7862630
Ref: reference/datamodel object __float__7862670
Ref: bc17862670
Ref: reference/datamodel object __index__7862910
Ref: 19e7862910
Ref: reference/datamodel object __round__7863767
Ref: 24077863767
Ref: reference/datamodel object __trunc__7863820
Ref: 19c7863820
Ref: reference/datamodel object __floor__7863862
Ref: 24087863862
Ref: reference/datamodel object __ceil__7863904
Ref: 24097863904
Ref: 数値型をエミュレートする-Footnote-17864548
Ref: 数値型をエミュレートする-Footnote-27864862
Ref: 数値型をエミュレートする-Footnote-37865073
Node: with文とコンテキストマネージャ7865249
Ref: reference/datamodel context-managers7865470
Ref: 240b7865470
Ref: reference/datamodel with-statement-context-managers7865470
Ref: 240c7865470
Ref: reference/datamodel object __enter__7866544
Ref: 7e47866544
Ref: reference/datamodel object __exit__7866804
Ref: 15187866804
Ref: with文とコンテキストマネージャ-Footnote-17867908
Node: クラスパターンマッチの位置引数のカスタマイズ7867950
Ref: reference/datamodel class-pattern-matching7868157
Ref: 240e7868157
Ref: reference/datamodel customizing-positional-arguments-in-class-pattern-matching7868157
Ref: 240f7868157
Ref: reference/datamodel object __match_args__7868640
Ref: 1c757868640
Ref: クラスパターンマッチの位置引数のカスタマイズ-Footnote-17869715
Node: Emulating buffer types7869757
Ref: reference/datamodel emulating-buffer-types7869932
Ref: 24107869932
Ref: reference/datamodel python-buffer-protocol7869932
Ref: 24117869932
Ref: reference/datamodel object __buffer__7870389
Ref: 68c7870389
Ref: reference/datamodel object __release_buffer__7870874
Ref: 1a657870874
Ref: Emulating buffer types-Footnote-17871613
Node: Annotations7871655
Ref: reference/datamodel annotations7871788
Ref: 24127871788
Ref: reference/datamodel object __annotations__7871990
Ref: 4587871990
Ref: reference/datamodel object __annotate__7872409
Ref: 19837872409
Ref: Annotations-Footnote-17873755
Node: 特殊メソッド検索7873797
Ref: reference/datamodel special-lookup7873899
Ref: 23b17873899
Ref: reference/datamodel special-method-lookup7873899
Ref: 24137873899
Node: コルーチン7876943
Ref: reference/datamodel coroutines7877043
Ref: 24147877043
Node: 待機可能オブジェクト Awaitable Object7877483
Ref: reference/datamodel awaitable-objects7877624
Ref: 24157877624
Ref: reference/datamodel object __await__7878248
Ref: f757878248
Ref: 待機可能オブジェクト Awaitable Object-Footnote-17879153
Node: コルーチンオブジェクト7879195
Ref: reference/datamodel coroutine-objects7879391
Ref: 23567879391
Ref: reference/datamodel id197879391
Ref: 24167879391
Ref: reference/datamodel coroutine send7880582
Ref: 24197880582
Ref: reference/datamodel coroutine throw7881116
Ref: 71b7881116
Ref: reference/datamodel coroutine close7882037
Ref: 241a7882037
Node: 非同期イテレータ Asynchronous Iterator7882810
Ref: reference/datamodel async-iterators7883030
Ref: f777883030
Ref: reference/datamodel asynchronous-iterators7883030
Ref: 241b7883030
Ref: reference/datamodel object __aiter__7883395
Ref: df67883395
Ref: reference/datamodel object __anext__7883529
Ref: 18827883529
Node: 非同期コンテキストマネージャ Asynchronous Context Manager7884563
Ref: reference/datamodel async-context-managers7884741
Ref: 8127884741
Ref: reference/datamodel asynchronous-context-managers7884741
Ref: 241c7884741
Ref: reference/datamodel object __aenter__7885259
Ref: 241d7885259
Ref: reference/datamodel object __aexit__7885424
Ref: 19a17885424
Node: 実行モデル7885927
Ref: reference/executionmodel doc7886073
Ref: 241e7886073
Ref: reference/executionmodel execmodel7886073
Ref: 241f7886073
Ref: reference/executionmodel execution-model7886073
Ref: 24207886073
Ref: reference/executionmodel translation-repo7886073
Ref: 24217886073
Node: プログラムの構造7886280
Ref: reference/executionmodel prog-structure7886405
Ref: 24227886405
Ref: reference/executionmodel structure-of-a-program7886405
Ref: 24237886405
Node: 名前づけと束縛 naming and binding7887926
Ref: reference/executionmodel naming7888069
Ref: 23467888069
Ref: reference/executionmodel naming-and-binding7888069
Ref: 24247888069
Node: 名前の束縛7888329
Ref: reference/executionmodel bind-names7888442
Ref: 24257888442
Ref: reference/executionmodel binding-of-names7888442
Ref: 24267888442
Node: 名前解決7890414
Ref: reference/executionmodel resolution-of-names7890553
Ref: 24297890553
Ref: reference/executionmodel resolve-names7890553
Ref: 242a7890553
Node: Annotation scopes7895084
Ref: reference/executionmodel annotation-scopes7895223
Ref: 4ab7895223
Ref: reference/executionmodel id17895223
Ref: 242c7895223
Ref: Annotation scopes-Footnote-17897956
Ref: Annotation scopes-Footnote-27897998
Ref: Annotation scopes-Footnote-37898040
Ref: Annotation scopes-Footnote-47898082
Node: Lazy evaluation7898124
Ref: reference/executionmodel id27898287
Ref: 242e7898287
Ref: reference/executionmodel lazy-evaluation7898287
Ref: 6857898287
Node: 組み込みと制限付きの実行7900035
Ref: reference/executionmodel builtins-and-restricted-execution7900214
Ref: 242f7900214
Ref: reference/executionmodel restrict-exec7900214
Ref: 24307900214
Node: 動的な機能とのやりとり7901304
Ref: reference/executionmodel dynamic-features7901459
Ref: 24317901459
Ref: reference/executionmodel interaction-with-dynamic-features7901459
Ref: 24327901459
Ref: 動的な機能とのやりとり-Footnote-17902398
Node: 例外<2>7902579
Ref: reference/executionmodel exceptions7902716
Ref: 24337902716
Ref: reference/executionmodel id47902716
Ref: 24347902716
Node: Runtime Components7905695
Ref: reference/executionmodel execcomponents7905783
Ref: 24357905783
Ref: reference/executionmodel runtime-components7905783
Ref: 24367905783
Node: General Computing Model7905897
Ref: reference/executionmodel general-computing-model7906004
Ref: 24377906004
Node: Python Runtime Model7908913
Ref: reference/executionmodel python-runtime-model7909020
Ref: 24387909020
Ref: Python Runtime Model-Footnote-17914407
Node: インポートシステム7914466
Ref: reference/import doc7914608
Ref: 24397914608
Ref: reference/import importsystem7914608
Ref: 23607914608
Ref: reference/import the-import-system7914608
Ref: 243a7914608
Ref: reference/import translation-repo7914608
Ref: 243b7914608
Ref: インポートシステム-Footnote-17917950
Ref: インポートシステム-Footnote-27918019
Ref: インポートシステム-Footnote-37918061
Node: importlib<10>7918103
Ref: reference/import importlib7918207
Ref: 243d7918207
Node: パッケージ<2>7918695
Ref: reference/import packages7918814
Ref: 243e7918814
Node: 通常のパッケージ7920872
Ref: reference/import regular-packages7920987
Ref: 243f7920987
Node: 名前空間パッケージ7922579
Ref: reference/import namespace-packages7922694
Ref: 24417922694
Ref: reference/import reference-namespace-package7922694
Ref: 24427922694
Ref: 名前空間パッケージ-Footnote-17924631
Node: 検索7924673
Ref: reference/import searching7924788
Ref: 24447924788
Node: モジュールキャッシュ7925869
Ref: reference/import the-module-cache7925984
Ref: 24457925984
Node: ファインダーとローダー7928261
Ref: reference/import finders-and-loaders7928409
Ref: 24467928409
Ref: reference/import id27928409
Ref: 24477928409
Node: インポートフック7931317
Ref: reference/import import-hooks7931447
Ref: 244b7931447
Node: メタパス7932692
Ref: reference/import the-meta-path7932780
Ref: 244c7932780
Node: ロード7936677
Ref: reference/import loading7936810
Ref: 244e7936810
Ref: ロード-Footnote-17940678
Node: ローダー7941200
Ref: reference/import loaders7941288
Ref: 244f7941288
Node: サブモジュール7945947
Ref: reference/import submodules7946056
Ref: 24507946056
Node: Module specs7947731
Ref: reference/import id47947858
Ref: 24517947858
Ref: reference/import module-specs7947858
Ref: 23667947858
Node: __path__ attributes on modules7949193
Ref: reference/import package-path-rules7949322
Ref: 23677949322
Ref: reference/import path-attributes-on-modules7949322
Ref: 24547949322
Ref: __path__ attributes on modules-Footnote-17950643
Ref: __path__ attributes on modules-Footnote-27950685
Node: モジュールの repr7950727
Ref: reference/import module-reprs7950898
Ref: 24557950898
Node: キャッシュされたバイトコードの無効化7952819
Ref: reference/import cached-bytecode-invalidation7952951
Ref: 24567952951
Ref: reference/import pyc-invalidation7952951
Ref: 8027952951
Node: パスベース・ファインダー7954331
Ref: reference/import the-path-based-finder7954512
Ref: 24577954512
Node: パスエントリ・ファインダー7958196
Ref: reference/import path-entry-finders7958374
Ref: 24597958374
Node: パスエントリ・ファインダー・プロトコル7964520
Ref: reference/import path-entry-finder-protocol7964698
Ref: 245b7964698
Node: 標準のインポートシステムを置き換える7967948
Ref: reference/import replacing-the-standard-import-system7968144
Ref: 245c7968144
Node: Package Relative Imports7969221
Ref: reference/import package-relative-imports7969417
Ref: 245d7969417
Ref: reference/import relativeimports7969417
Ref: 245e7969417
Node: __main__ に対する特別な考慮7970620
Ref: reference/import import-dunder-main7970774
Ref: 245f7970774
Ref: reference/import special-considerations-for-main7970774
Ref: 24607970774
Node: __main__ __spec__7971597
Ref: reference/import id57971687
Ref: 24617971687
Ref: reference/import main-spec7971687
Ref: 24537971687
Node: 参考資料7973856
Ref: reference/import references7973977
Ref: 24627973977
Ref: 参考資料-Footnote-17975610
Ref: 参考資料-Footnote-27975662
Ref: 参考資料-Footnote-37975704
Ref: 参考資料-Footnote-47975746
Ref: 参考資料-Footnote-57975788
Ref: 参考資料-Footnote-67975830
Ref: 参考資料-Footnote-77975872
Ref: 参考資料-Footnote-87975914
Ref: 参考資料-Footnote-97975956
Ref: 参考資料-Footnote-107975998
Node: 式 expression7976041
Ref: reference/expressions doc7976194
Ref: 24637976194
Ref: reference/expressions expressions7976194
Ref: 23277976194
Ref: reference/expressions id17976194
Ref: 24647976194
Ref: reference/expressions translation-repo7976194
Ref: 24657976194
Ref: reference/expressions grammar-token-python-grammar-name7976528
Ref: 24667976528
Node: 算術変換 arithmetic conversion7977804
Ref: reference/expressions arithmetic-conversions7977930
Ref: 24677977930
Ref: reference/expressions conversions7977930
Ref: 24687977930
Node: アトム、原子的要素 atom7978511
Ref: reference/expressions atoms7978661
Ref: 246a7978661
Ref: reference/expressions id27978661
Ref: 246b7978661
Ref: reference/expressions grammar-token-python-grammar-atom7978974
Ref: 246c7978974
Ref: reference/expressions grammar-token-python-grammar-enclosure7979151
Ref: 246e7979151
Node: Built-in constants7979787
Ref: reference/expressions atom-singletons7979926
Ref: 24757979926
Ref: reference/expressions built-in-constants7979926
Ref: 24767979926
Node: 識別子 identifier、または名前 name7980573
Ref: reference/expressions atom-identifiers7980736
Ref: 22c67980736
Ref: reference/expressions identifiers-names7980736
Ref: 24787980736
Ref: reference/expressions private-name-mangling7981406
Ref: 20a37981406
Node: Private name mangling7981442
Ref: reference/expressions id37981543
Ref: 24797981543
Node: リテラル<2>7983322
Ref: reference/expressions atom-literals7983501
Ref: 247a7983501
Ref: reference/expressions literals7983501
Ref: 247b7983501
Ref: reference/expressions grammar-token-python-grammar-literal7984649
Ref: 246d7984649
Node: Literals and object identity7984846
Ref: reference/expressions literals-and-object-identity7984979
Ref: 247f7984979
Node: 文字列リテラルの結合 concatenation7986794
Ref: reference/expressions string-concatenation7986927
Ref: 22e07986927
Ref: reference/expressions string-literal-concatenation7986927
Ref: 24817986927
Ref: reference/expressions grammar-token-python-grammar-strings7988359
Ref: 247e7988359
Node: 丸括弧形式 parenthesized form7988444
Ref: reference/expressions parenthesized7988616
Ref: 24827988616
Ref: reference/expressions parenthesized-forms7988616
Ref: 24837988616
Ref: reference/expressions grammar-token-python-grammar-parenth_form7988792
Ref: 246f7988792
Node: リスト、集合、辞書の表示7989951
Ref: reference/expressions comprehensions7990123
Ref: 7ec7990123
Ref: reference/expressions displays-for-lists-sets-and-dictionaries7990123
Ref: 24857990123
Ref: reference/expressions grammar-token-python-grammar-comprehension7990639
Ref: 24867990639
Ref: reference/expressions grammar-token-python-grammar-comp_for7990716
Ref: 24877990716
Ref: reference/expressions grammar-token-python-grammar-comp_iter7990828
Ref: 248a7990828
Ref: reference/expressions grammar-token-python-grammar-comp_if7990893
Ref: 248b7990893
Ref: リスト、集合、辞書の表示-Footnote-17993810
Node: リスト表示7993852
Ref: reference/expressions list-displays7994002
Ref: 248c7994002
Ref: reference/expressions lists7994002
Ref: 248d7994002
Ref: reference/expressions grammar-token-python-grammar-list_display7994170
Ref: 24707994170
Node: 集合表示7994756
Ref: reference/expressions set7994882
Ref: 248f7994882
Ref: reference/expressions set-displays7994882
Ref: 24907994882
Ref: reference/expressions grammar-token-python-grammar-set_display7995050
Ref: 24727995050
Node: 辞書表示7995706
Ref: reference/expressions dict7995841
Ref: f7f7995841
Ref: reference/expressions dictionary-displays7995841
Ref: 24917995841
Ref: reference/expressions grammar-token-python-grammar-dict_display7995989
Ref: 24717995989
Ref: reference/expressions grammar-token-python-grammar-dict_item_list7996086
Ref: 24927996086
Ref: reference/expressions grammar-token-python-grammar-dict_item7996170
Ref: 24947996170
Ref: reference/expressions grammar-token-python-grammar-dict_comprehension7996273
Ref: 24937996273
Ref: 辞書表示-Footnote-17998243
Ref: 辞書表示-Footnote-27998285
Node: ジェネレータ式<2>7998327
Ref: reference/expressions generator-expressions7998459
Ref: 24957998459
Ref: reference/expressions genexpr7998459
Ref: 24967998459
Ref: reference/expressions grammar-token-python-grammar-generator_expression7998645
Ref: 24737998645
Node: Yield 式8001017
Ref: reference/expressions yield-expressions8001128
Ref: 24978001128
Ref: reference/expressions yieldexpr8001128
Ref: 24988001128
Ref: reference/expressions grammar-token-python-grammar-yield_atom8001166
Ref: 24748001166
Ref: reference/expressions grammar-token-python-grammar-yield_from8001227
Ref: 24998001227
Ref: reference/expressions grammar-token-python-grammar-yield_expression8001288
Ref: 23038001288
Ref: Yield 式-Footnote-18006975
Ref: Yield 式-Footnote-28007017
Ref: Yield 式-Footnote-38007059
Ref: Yield 式-Footnote-48007101
Ref: Yield 式-Footnote-58007143
Node: ジェネレータ-イテレータメソッド8007185
Ref: reference/expressions generator-iterator-methods8007295
Ref: 249d8007295
Ref: reference/expressions generator-methods8007295
Ref: 24188007295
Ref: reference/expressions generator __next__8007749
Ref: 20ae8007749
Ref: reference/expressions generator send8008542
Ref: 126d8008542
Ref: reference/expressions generator throw8009209
Ref: 71c8009209
Ref: reference/expressions generator close8010568
Ref: 17938010568
Node: 使用例8011618
Ref: reference/expressions examples8011805
Ref: 249e8011805
Node: 非同期ジェネレータ関数 asynchronous generator function<2>8012916
Ref: reference/expressions asynchronous-generator-functions8013111
Ref: 249c8013111
Ref: reference/expressions id48013111
Ref: 249f8013111
Ref: 非同期ジェネレータ関数 asynchronous generator function<2>-Footnote-18017109
Node: 非同期ジェネレータイテレータメソッド8017189
Ref: reference/expressions asynchronous-generator-iterator-methods8017366
Ref: 24a18017366
Ref: reference/expressions asynchronous-generator-methods8017366
Ref: 24a28017366
Ref: reference/expressions agen __anext__8017642
Ref: 24a08017642
Ref: reference/expressions agen asend8018598
Ref: ad68018598
Ref: reference/expressions agen athrow8019459
Ref: 71d8019459
Ref: reference/expressions agen aclose8020356
Ref: ad58020356
Node: プライマリ8021374
Ref: reference/expressions id58021499
Ref: 24a38021499
Ref: reference/expressions primaries8021499
Ref: 24a48021499
Ref: reference/expressions grammar-token-python-grammar-primary8021666
Ref: 24a58021666
Node: 属性参照8021875
Ref: reference/expressions attribute-references8021974
Ref: 24a98021974
Ref: reference/expressions id68021974
Ref: 24aa8021974
Ref: reference/expressions grammar-token-python-grammar-attributeref8022106
Ref: 24a68022106
Node: Subscriptions and slicings8022920
Ref: reference/expressions subscriptions8023045
Ref: 23ce8023045
Ref: reference/expressions subscriptions-and-slicings8023045
Ref: 24ab8023045
Node: スライス表記 slicing8025750
Ref: reference/expressions id78025874
Ref: 24ac8025874
Ref: reference/expressions slicings8025874
Ref: 24ad8025874
Node: Comma-separated subscripts8027395
Ref: reference/expressions comma-separated-subscripts8027551
Ref: 24af8027551
Node: "Starred" subscriptions8028401
Ref: reference/expressions starred-subscriptions8028558
Ref: 24b08028558
Ref: "Starred" subscriptions-Footnote-18029270
Node: Formal subscription grammar8029312
Ref: reference/expressions formal-subscription-grammar8029434
Ref: 24b18029434
Ref: reference/expressions grammar-token-python-grammar-subscription8029507
Ref: 24a78029507
Ref: reference/expressions grammar-token-python-grammar-subscript8029582
Ref: 24b28029582
Ref: reference/expressions grammar-token-python-grammar-single_subscript8029666
Ref: 24b38029666
Ref: reference/expressions grammar-token-python-grammar-proper_slice8029752
Ref: 24b58029752
Ref: reference/expressions grammar-token-python-grammar-tuple_subscript8029862
Ref: 24b48029862
Node: 呼び出し call8030150
Ref: reference/expressions calls8030254
Ref: f7d8030254
Ref: reference/expressions id88030254
Ref: 24b68030254
Ref: reference/expressions grammar-token-python-grammar-call8030522
Ref: 24a88030522
Ref: reference/expressions grammar-token-python-grammar-argument_list8030642
Ref: 24b88030642
Ref: reference/expressions grammar-token-python-grammar-positional_arguments8030972
Ref: 24b98030972
Ref: reference/expressions grammar-token-python-grammar-positional_item8031064
Ref: 24bc8031064
Ref: reference/expressions grammar-token-python-grammar-starred_and_keywords8031155
Ref: 24ba8031155
Ref: reference/expressions grammar-token-python-grammar-keywords_arguments8031332
Ref: 24bb8031332
Ref: reference/expressions grammar-token-python-grammar-keyword_item8031511
Ref: 24bd8031511
Ref: 呼び出し call-Footnote-18039860
Node: Await 式8039902
Ref: reference/expressions await8040025
Ref: 18d8040025
Ref: reference/expressions await-expression8040025
Ref: 24be8040025
Ref: reference/expressions grammar-token-python-grammar-await_expr8040227
Ref: 24bf8040227
Node: べき乗演算 power operator8040297
Ref: reference/expressions power8040486
Ref: 24c08040486
Ref: reference/expressions the-power-operator8040486
Ref: 24c18040486
Ref: reference/expressions grammar-token-python-grammar-power8040802
Ref: 24c28040802
Node: 単項算術演算とビット単位演算 unary arithmetic and bitwise operation8042209
Ref: reference/expressions unary8042435
Ref: 247c8042435
Ref: reference/expressions unary-arithmetic-and-bitwise-operations8042435
Ref: 24c48042435
Ref: reference/expressions grammar-token-python-grammar-u_expr8042701
Ref: 24c38042701
Node: 二項算術演算 binary arithmetic operation8043527
Ref: reference/expressions binary8043757
Ref: 247d8043757
Ref: reference/expressions binary-arithmetic-operations8043757
Ref: 24c58043757
Ref: reference/expressions grammar-token-python-grammar-m_expr8044223
Ref: 24c68044223
Ref: reference/expressions grammar-token-python-grammar-a_expr8044513
Ref: 24c78044513
Ref: 二項算術演算 binary arithmetic operation-Footnote-18048839
Ref: 二項算術演算 binary arithmetic operation-Footnote-28049653
Node: シフト演算 shifting operation8049998
Ref: reference/expressions shifting8050208
Ref: 24c98050208
Ref: reference/expressions shifting-operations8050208
Ref: 24ca8050208
Ref: reference/expressions grammar-token-python-grammar-shift_expr8050374
Ref: 24cb8050374
Node: ビット単位演算の二項演算 binary bitwise operation8051145
Ref: reference/expressions binary-bitwise-operations8051315
Ref: 24cc8051315
Ref: reference/expressions bitwise8051315
Ref: 24cd8051315
Ref: reference/expressions grammar-token-python-grammar-and_expr8051552
Ref: 24ce8051552
Ref: reference/expressions grammar-token-python-grammar-xor_expr8051643
Ref: 24cf8051643
Ref: reference/expressions grammar-token-python-grammar-or_expr8051730
Ref: 23028051730
Node: 比較8052450
Ref: reference/expressions comparisons8052619
Ref: 24d08052619
Ref: reference/expressions id118052619
Ref: 24d18052619
Ref: reference/expressions grammar-token-python-grammar-comparison8052984
Ref: 24d28052984
Ref: reference/expressions grammar-token-python-grammar-comp_operator8053076
Ref: 24d38053076
Node: 値の比較8054420
Ref: reference/expressions expressions-value-comparisons8054502
Ref: 1c208054502
Ref: reference/expressions value-comparisons8054502
Ref: 24d48054502
Ref: reference/expressions in8063833
Ref: 34b8063833
Ref: reference/expressions not-in8063833
Ref: 8418063833
Ref: 値の比較-Footnote-18063871
Ref: 値の比較-Footnote-28063913
Node: 所属検査演算8065330
Ref: reference/expressions membership-test-details8065439
Ref: 23e68065439
Ref: reference/expressions membership-test-operations8065439
Ref: 24d58065439
Ref: reference/expressions is8067613
Ref: 34c8067613
Node: 同一性の比較8067613
Ref: reference/expressions identity-comparisons8067701
Ref: 24d68067701
Ref: reference/expressions is-not8067701
Ref: 24d78067701
Ref: reference/expressions booleans8068189
Ref: 24d88068189
Ref: reference/expressions and8068189
Ref: 3498068189
Ref: reference/expressions or8068189
Ref: 34d8068189
Ref: 同一性の比較-Footnote-18068227
Node: ブール演算 boolean operation8068626
Ref: reference/expressions boolean-operations8068746
Ref: 24d98068746
Ref: reference/expressions not8068746
Ref: 24da8068746
Ref: reference/expressions grammar-token-python-grammar-or_test8068828
Ref: 24898068828
Ref: reference/expressions grammar-token-python-grammar-and_test8068915
Ref: 24db8068915
Ref: reference/expressions grammar-token-python-grammar-not_test8069004
Ref: 24dc8069004
Node: 代入式<2>8070595
Ref: reference/expressions assignment-expressions8070742
Ref: 24dd8070742
Ref: reference/expressions id148070742
Ref: 24de8070742
Ref: reference/expressions grammar-token-python-grammar-assignment_expression8070774
Ref: 242d8070774
Ref: 代入式<2>-Footnote-18071858
Node: 条件式 Conditional Expressions8071900
Ref: reference/expressions conditional-expressions8072030
Ref: 24df8072030
Ref: reference/expressions if-expr8072030
Ref: 17d8072030
Ref: reference/expressions grammar-token-python-grammar-conditional_expression8072114
Ref: 23018072114
Ref: reference/expressions grammar-token-python-grammar-expression8072222
Ref: 1828072222
Ref: reference/expressions lambdas8072818
Ref: 24e18072818
Ref: 条件式 Conditional Expressions-Footnote-18072856
Node: ラムダ lambda8072898
Ref: reference/expressions id158073031
Ref: 24e28073031
Ref: reference/expressions lambda8073031
Ref: 14b58073031
Ref: reference/expressions grammar-token-python-grammar-lambda_expr8073081
Ref: 24e08073081
Node: 式のリスト8073747
Ref: reference/expressions expression-lists8073859
Ref: 24e48073859
Ref: reference/expressions exprlists8073859
Ref: f7e8073859
Ref: reference/expressions grammar-token-python-grammar-starred_expression8073901
Ref: 24848073901
Ref: reference/expressions grammar-token-python-grammar-flexible_expression8073982
Ref: 24e58073982
Ref: reference/expressions grammar-token-python-grammar-flexible_expression_list8074082
Ref: 248e8074082
Ref: reference/expressions grammar-token-python-grammar-starred_expression_list8074192
Ref: 24e68074192
Ref: reference/expressions grammar-token-python-grammar-expression_list8074300
Ref: 24e78074300
Ref: reference/expressions grammar-token-python-grammar-yield_list8074390
Ref: 249a8074390
Ref: 式のリスト-Footnote-18075716
Ref: 式のリスト-Footnote-28075758
Node: 評価順序8075800
Ref: reference/expressions evalorder8075920
Ref: 24e88075920
Ref: reference/expressions evaluation-order8075920
Ref: 24e98075920
Node: 演算子の優先順位8076442
Ref: reference/expressions operator-precedence8076538
Ref: 24ea8076538
Ref: reference/expressions operator-summary8076538
Ref: 24eb8076538
Ref: 演算子の優先順位-Footnote-18081203
Ref: 演算子の優先順位-Footnote-28081423
Node: 単純文 simple statement8081543
Ref: reference/simple_stmts doc8081697
Ref: 24ec8081697
Ref: reference/simple_stmts simple8081697
Ref: 24ed8081697
Ref: reference/simple_stmts simple-statements8081697
Ref: 24ee8081697
Ref: reference/simple_stmts translation-repo8081697
Ref: 24ef8081697
Ref: reference/simple_stmts grammar-token-python-grammar-simple_stmt8081985
Ref: 24f08081985
Node: 式文 expression statement8083126
Ref: reference/simple_stmts expression-statements8083255
Ref: 25028083255
Ref: reference/simple_stmts exprstmts8083255
Ref: 25038083255
Ref: reference/simple_stmts grammar-token-python-grammar-expression_stmt8083773
Ref: 24f18083773
Node: 代入文 assignment statement8084277
Ref: reference/simple_stmts assignment8084425
Ref: 24278084425
Ref: reference/simple_stmts assignment-statements8084425
Ref: 25048084425
Ref: reference/simple_stmts grammar-token-python-grammar-assignment_stmt8084659
Ref: 24f38084659
Ref: reference/simple_stmts grammar-token-python-grammar-target_list8084779
Ref: 24888084779
Ref: reference/simple_stmts grammar-token-python-grammar-target8084854
Ref: 25058084854
Ref: reference/simple_stmts attr-target-note8089287
Ref: 25068089287
Ref: 代入文 assignment statement-Footnote-18093645
Node: 累算代入文 augmented assignment statement8093687
Ref: reference/simple_stmts augassign8093862
Ref: 25078093862
Ref: reference/simple_stmts augmented-assignment-statements8093862
Ref: 25088093862
Ref: reference/simple_stmts grammar-token-python-grammar-augmented_assignment_stmt8094074
Ref: 24f48094074
Ref: reference/simple_stmts grammar-token-python-grammar-augtarget8094211
Ref: 25098094211
Ref: reference/simple_stmts grammar-token-python-grammar-augop8094323
Ref: 250a8094323
Node: 注釈付き代入文 annotated assignment statements8096131
Ref: reference/simple_stmts annassign8096306
Ref: 250b8096306
Ref: reference/simple_stmts annotated-assignment-statements8096306
Ref: 250c8096306
Ref: reference/simple_stmts grammar-token-python-grammar-annotated_assignment_stmt8096585
Ref: 24f58096585
Ref: 注釈付き代入文 annotated assignment statements-Footnote-18098889
Ref: 注釈付き代入文 annotated assignment statements-Footnote-28098931
Node: assert 文8098973
Ref: reference/simple_stmts assert8099105
Ref: b608099105
Ref: reference/simple_stmts the-assert-statement8099105
Ref: 250d8099105
Ref: reference/simple_stmts grammar-token-python-grammar-assert_stmt8099288
Ref: 24f28099288
Node: pass 文<2>8100432
Ref: reference/simple_stmts pass8100544
Ref: 17e8100544
Ref: reference/simple_stmts the-pass-statement8100544
Ref: 250e8100544
Ref: reference/simple_stmts grammar-token-python-grammar-pass_stmt8100582
Ref: 24f68100582
Node: del 文<2>8101032
Ref: reference/simple_stmts del8101144
Ref: 1b1f8101144
Ref: reference/simple_stmts the-del-statement8101144
Ref: 250f8101144
Ref: reference/simple_stmts grammar-token-python-grammar-del_stmt8101180
Ref: 24f78101180
Node: return 文8102321
Ref: reference/simple_stmts return8102431
Ref: 1af8102431
Ref: reference/simple_stmts the-return-statement8102431
Ref: 25108102431
Ref: reference/simple_stmts grammar-token-python-grammar-return_stmt8102473
Ref: 24f88102473
Node: yield 文8103796
Ref: reference/simple_stmts the-yield-statement8103905
Ref: 25118103905
Ref: reference/simple_stmts yield8103905
Ref: bc28103905
Ref: reference/simple_stmts grammar-token-python-grammar-yield_stmt8103945
Ref: 24f98103945
Node: raise 文8104808
Ref: reference/simple_stmts raise8104916
Ref: 8038104916
Ref: reference/simple_stmts the-raise-statement8104916
Ref: 25128104916
Ref: reference/simple_stmts grammar-token-python-grammar-raise_stmt8104956
Ref: 24fa8104956
Node: break 文8109327
Ref: reference/simple_stmts break8109438
Ref: 17f8109438
Ref: reference/simple_stmts the-break-statement8109438
Ref: 25158109438
Ref: reference/simple_stmts grammar-token-python-grammar-break_stmt8109478
Ref: 24fb8109478
Node: continue 文8110284
Ref: reference/simple_stmts continue8110396
Ref: 1808110396
Ref: reference/simple_stmts the-continue-statement8110396
Ref: 25168110396
Ref: reference/simple_stmts grammar-token-python-grammar-continue_stmt8110444
Ref: 24fc8110444
Ref: reference/simple_stmts import8111006
Ref: 7f88111006
Node: import 文8111008
Ref: reference/simple_stmts from8111121
Ref: 14c38111121
Ref: reference/simple_stmts the-import-statement8111121
Ref: 25178111121
Ref: reference/simple_stmts grammar-token-python-grammar-import_stmt8111165
Ref: 24fd8111165
Ref: reference/simple_stmts grammar-token-python-grammar-module8111808
Ref: 25188111808
Ref: reference/simple_stmts grammar-token-python-grammar-relative_module8111885
Ref: 25198111885
Ref: reference/simple_stmts module __all__8116002
Ref: f3b8116002
Ref: import 文-Footnote-18118851
Node: future 文 future statement8118908
Ref: reference/simple_stmts future8118982
Ref: 45d8118982
Ref: reference/simple_stmts future-statements8118982
Ref: 251a8118982
Ref: reference/simple_stmts grammar-token-python-grammar-future_stmt8119625
Ref: 24fe8119625
Ref: reference/simple_stmts grammar-token-python-grammar-feature8119993
Ref: 251b8119993
Ref: future 文 future statement-Footnote-18123467
Ref: future 文 future statement-Footnote-28123509
Node: global 文8123551
Ref: reference/simple_stmts global8123664
Ref: 4ac8123664
Ref: reference/simple_stmts the-global-statement8123664
Ref: 251c8123664
Ref: reference/simple_stmts grammar-token-python-grammar-global_stmt8123708
Ref: 24ff8123708
Node: nonlocal 文8125229
Ref: reference/simple_stmts nonlocal8125350
Ref: 14bf8125350
Ref: reference/simple_stmts the-nonlocal-statement8125350
Ref: 251d8125350
Ref: reference/simple_stmts grammar-token-python-grammar-nonlocal_stmt8125398
Ref: 25008125398
Ref: nonlocal 文-Footnote-18126578
Node: The type statement8126620
Ref: reference/simple_stmts the-type-statement8126722
Ref: 251e8126722
Ref: reference/simple_stmts type8126722
Ref: 66d8126722
Ref: reference/simple_stmts grammar-token-python-grammar-type_stmt8126783
Ref: 25018126783
Ref: The type statement-Footnote-18128101
Node: 複合文 compound statement8128143
Ref: reference/compound_stmts doc8128307
Ref: 25208128307
Ref: reference/compound_stmts compound8128307
Ref: 25218128307
Ref: reference/compound_stmts compound-statements8128307
Ref: 25228128307
Ref: reference/compound_stmts translation-repo8128307
Ref: 25238128307
Ref: reference/compound_stmts grammar-token-python-grammar-compound_stmt8130483
Ref: 25248130483
Ref: reference/compound_stmts grammar-token-python-grammar-suite8130986
Ref: 25308130986
Ref: reference/compound_stmts grammar-token-python-grammar-statement8131085
Ref: 25328131085
Ref: reference/compound_stmts grammar-token-python-grammar-stmt_list8131165
Ref: 25318131165
Ref: reference/compound_stmts if8131807
Ref: 1818131807
Ref: reference/compound_stmts elif8131807
Ref: 17b8131807
Node: if 文<2>8132060
Ref: reference/compound_stmts else8132152
Ref: 17c8132152
Ref: reference/compound_stmts the-if-statement8132152
Ref: 25338132152
Ref: reference/compound_stmts grammar-token-python-grammar-if_stmt8132264
Ref: 25258132264
Node: while 文8133020
Ref: reference/compound_stmts the-while-statement8133131
Ref: 25348133131
Ref: reference/compound_stmts while8133131
Ref: 19738133131
Ref: reference/compound_stmts grammar-token-python-grammar-while_stmt8133278
Ref: 25268133278
Node: for 文<2>8134049
Ref: reference/compound_stmts for8134158
Ref: 34a8134158
Ref: reference/compound_stmts the-for-statement8134158
Ref: 25358134158
Ref: reference/compound_stmts grammar-token-python-grammar-for_stmt8134421
Ref: 25278134421
Node: try 文8136507
Ref: reference/compound_stmts the-try-statement8136615
Ref: 25368136615
Ref: reference/compound_stmts try8136615
Ref: 8f88136615
Ref: reference/compound_stmts grammar-token-python-grammar-try_stmt8136789
Ref: 25288136789
Ref: reference/compound_stmts grammar-token-python-grammar-try1_stmt8136878
Ref: 25378136878
Ref: reference/compound_stmts grammar-token-python-grammar-try2_stmt8137129
Ref: 25388137129
Ref: reference/compound_stmts grammar-token-python-grammar-try3_stmt8137382
Ref: 25398137382
Ref: try 文-Footnote-18137938
Node: except 節8137980
Ref: reference/compound_stmts except8138054
Ref: 1ab8138054
Ref: reference/compound_stmts except-clause8138054
Ref: 253a8138054
Ref: except 節-Footnote-18141962
Node: except* 節8142177
Ref: reference/compound_stmts except-star8142268
Ref: 1ac8142268
Ref: reference/compound_stmts id28142268
Ref: 253b8142268
Node: else 節8145271
Ref: reference/compound_stmts else-clause8145363
Ref: 253c8145363
Ref: reference/compound_stmts except-else8145363
Ref: 253d8145363
Node: finally 節8145802
Ref: reference/compound_stmts finally8145874
Ref: 1b08145874
Ref: reference/compound_stmts finally-clause8145874
Ref: 253e8145874
Ref: reference/compound_stmts with8147835
Ref: 1868147835
Ref: finally 節-Footnote-18147871
Node: with 文8147913
Ref: reference/compound_stmts as8148023
Ref: 253f8148023
Ref: reference/compound_stmts the-with-statement8148023
Ref: 25408148023
Ref: reference/compound_stmts grammar-token-python-grammar-with_stmt8148515
Ref: 25298148515
Ref: reference/compound_stmts grammar-token-python-grammar-with_stmt_contents8148653
Ref: 25418148653
Ref: reference/compound_stmts grammar-token-python-grammar-with_item8148731
Ref: 25428148731
Ref: reference/compound_stmts match8152560
Ref: a0e8152560
Ref: with 文-Footnote-18152596
Node: match 文<2>8152638
Ref: reference/compound_stmts case8152753
Ref: 25438152753
Ref: reference/compound_stmts the-match-statement8152753
Ref: 25448152753
Ref: reference/compound_stmts grammar-token-python-grammar-match_stmt8152902
Ref: 252a8152902
Ref: reference/compound_stmts grammar-token-python-grammar-subject_expr8153006
Ref: 25458153006
Ref: reference/compound_stmts grammar-token-python-grammar-case_block8153122
Ref: 25468153122
Ref: match 文<2>-Footnote-18154282
Ref: match 文<2>-Footnote-28154324
Node: 概要8154366
Ref: reference/compound_stmts overview8154442
Ref: 25498154442
Node: ガード<2>8157723
Ref: reference/compound_stmts guards8157847
Ref: 254b8157847
Ref: reference/compound_stmts grammar-token-python-grammar-guard8157881
Ref: 25488157881
Node: 論駁不可能なケースブロック8159426
Ref: reference/compound_stmts irrefutable-case8159556
Ref: 254c8159556
Ref: reference/compound_stmts irrefutable-case-blocks8159556
Ref: 254d8159556
Node: パターン8160637
Ref: reference/compound_stmts patterns8160746
Ref: 25518160746
Ref: reference/compound_stmts grammar-token-python-grammar-patterns8161123
Ref: 25478161123
Ref: reference/compound_stmts grammar-token-python-grammar-pattern8161202
Ref: 25538161202
Ref: reference/compound_stmts grammar-token-python-grammar-closed_pattern8161273
Ref: 25568161273
Node: OR パターン8162520
Ref: reference/compound_stmts id38162608
Ref: 255f8162608
Ref: reference/compound_stmts or-patterns8162608
Ref: 254f8162608
Ref: reference/compound_stmts grammar-token-python-grammar-or_pattern8162759
Ref: 25558162759
Node: AS パターン8163709
Ref: reference/compound_stmts as-patterns8163830
Ref: 254e8163830
Ref: reference/compound_stmts id48163830
Ref: 25608163830
Ref: reference/compound_stmts grammar-token-python-grammar-as_pattern8164033
Ref: 25548164033
Node: リテラルパターン8164574
Ref: reference/compound_stmts id58164707
Ref: 25618164707
Ref: reference/compound_stmts literal-patterns8164707
Ref: 25628164707
Ref: reference/compound_stmts grammar-token-python-grammar-literal_pattern8164881
Ref: 25578164881
Ref: reference/compound_stmts grammar-token-python-grammar-signed_number8165193
Ref: 25638165193
Node: キャプチャパターン8166003
Ref: reference/compound_stmts capture-patterns8166154
Ref: 25508166154
Ref: reference/compound_stmts id68166154
Ref: 25658166154
Ref: reference/compound_stmts grammar-token-python-grammar-capture_pattern8166312
Ref: 25588166312
Ref: キャプチャパターン-Footnote-18167314
Node: ワイルドカードパターン8167356
Ref: reference/compound_stmts id78167498
Ref: 25668167498
Ref: reference/compound_stmts wildcard-patterns8167498
Ref: a0f8167498
Ref: reference/compound_stmts grammar-token-python-grammar-wildcard_pattern8167707
Ref: 25598167707
Node: 値パターン8168128
Ref: reference/compound_stmts id88168267
Ref: 25678168267
Ref: reference/compound_stmts value-patterns8168267
Ref: 25688168267
Ref: reference/compound_stmts grammar-token-python-grammar-value_pattern8168397
Ref: 255a8168397
Ref: reference/compound_stmts grammar-token-python-grammar-attr8168435
Ref: 25698168435
Ref: reference/compound_stmts grammar-token-python-grammar-name_or_attr8168490
Ref: 256a8168490
Node: グループパターン8169302
Ref: reference/compound_stmts group-patterns8169435
Ref: 256b8169435
Ref: reference/compound_stmts id98169435
Ref: 256c8169435
Ref: reference/compound_stmts grammar-token-python-grammar-group_pattern8169647
Ref: 255b8169647
Node: シーケンスパターン8169756
Ref: reference/compound_stmts id108169901
Ref: 256d8169901
Ref: reference/compound_stmts sequence-patterns8169901
Ref: 256e8169901
Ref: reference/compound_stmts grammar-token-python-grammar-sequence_pattern8170117
Ref: 255c8170117
Ref: reference/compound_stmts grammar-token-python-grammar-open_sequence_pattern8170268
Ref: 25528170268
Ref: reference/compound_stmts grammar-token-python-grammar-maybe_sequence_pattern8170371
Ref: 256f8170371
Ref: reference/compound_stmts grammar-token-python-grammar-maybe_star_pattern8170442
Ref: 25708170442
Ref: reference/compound_stmts grammar-token-python-grammar-star_pattern8170520
Ref: 25718170520
Ref: シーケンスパターン-Footnote-18173569
Node: マッピングパターン8174290
Ref: reference/compound_stmts id128174432
Ref: 25728174432
Ref: reference/compound_stmts mapping-patterns8174432
Ref: 25738174432
Ref: reference/compound_stmts grammar-token-python-grammar-mapping_pattern8174627
Ref: 255d8174627
Ref: reference/compound_stmts grammar-token-python-grammar-items_pattern8174690
Ref: 25748174690
Ref: reference/compound_stmts grammar-token-python-grammar-key_value_pattern8174757
Ref: 25758174757
Ref: reference/compound_stmts grammar-token-python-grammar-double_star_pattern8174929
Ref: 25768174929
Ref: マッピングパターン-Footnote-18176580
Node: クラスパターン8177054
Ref: reference/compound_stmts class-patterns8177160
Ref: 25778177160
Ref: reference/compound_stmts id148177160
Ref: 25788177160
Ref: reference/compound_stmts grammar-token-python-grammar-class_pattern8177312
Ref: 255e8177312
Ref: reference/compound_stmts grammar-token-python-grammar-pattern_arguments8177410
Ref: 25798177410
Ref: reference/compound_stmts grammar-token-python-grammar-positional_patterns8177563
Ref: 257a8177563
Ref: reference/compound_stmts grammar-token-python-grammar-keyword_patterns8177615
Ref: 257b8177615
Ref: reference/compound_stmts grammar-token-python-grammar-keyword_pattern8177675
Ref: 257c8177675
Ref: reference/compound_stmts function8181745
Ref: 20188181745
Ref: クラスパターン-Footnote-18181781
Ref: クラスパターン-Footnote-28181823
Node: 関数定義8181865
Ref: reference/compound_stmts def8181987
Ref: 16738181987
Ref: reference/compound_stmts function-definitions8181987
Ref: 257d8181987
Ref: reference/compound_stmts grammar-token-python-grammar-funcdef8182144
Ref: 252b8182144
Ref: reference/compound_stmts grammar-token-python-grammar-decorators8182380
Ref: 257e8182380
Ref: reference/compound_stmts grammar-token-python-grammar-decorator8182436
Ref: 25808182436
Ref: reference/compound_stmts grammar-token-python-grammar-parameter_list8182515
Ref: 24e38182515
Ref: reference/compound_stmts grammar-token-python-grammar-parameter_list_no_posonly8182736
Ref: 25828182736
Ref: reference/compound_stmts grammar-token-python-grammar-parameter_list_starargs8182943
Ref: 25838182943
Ref: reference/compound_stmts grammar-token-python-grammar-parameter_star_kwargs8183268
Ref: 25858183268
Ref: reference/compound_stmts grammar-token-python-grammar-parameter8183334
Ref: 25868183334
Ref: reference/compound_stmts grammar-token-python-grammar-star_parameter8183419
Ref: 25848183419
Ref: reference/compound_stmts grammar-token-python-grammar-defparameter8183510
Ref: 25818183510
Ref: reference/compound_stmts grammar-token-python-grammar-funcname8183594
Ref: 257f8183594
Ref: 関数定義-Footnote-18191324
Ref: 関数定義-Footnote-28191521
Ref: 関数定義-Footnote-38191563
Ref: 関数定義-Footnote-48191605
Ref: 関数定義-Footnote-58191647
Ref: 関数定義-Footnote-68191689
Ref: 関数定義-Footnote-78191731
Ref: 関数定義-Footnote-88191773
Ref: 関数定義-Footnote-98191815
Ref: 関数定義-Footnote-108191857
Node: クラス定義8191900
Ref: reference/compound_stmts class8192028
Ref: 14ef8192028
Ref: reference/compound_stmts class-definitions8192028
Ref: 25888192028
Ref: reference/compound_stmts grammar-token-python-grammar-classdef8192181
Ref: 252c8192181
Ref: reference/compound_stmts grammar-token-python-grammar-inheritance8192333
Ref: 258a8192333
Ref: reference/compound_stmts grammar-token-python-grammar-classname8192388
Ref: 25898192388
Ref: クラス定義-Footnote-18196358
Ref: クラス定義-Footnote-28196545
Ref: クラス定義-Footnote-38196587
Ref: クラス定義-Footnote-48196629
Ref: クラス定義-Footnote-58196671
Node: コルーチン<2>8196713
Ref: reference/compound_stmts async8196849
Ref: 93b8196849
Ref: reference/compound_stmts coroutines8196849
Ref: 258b8196849
Node: コルーチン関数定義8196991
Ref: reference/compound_stmts async-def8197095
Ref: 7ed8197095
Ref: reference/compound_stmts coroutine-function-definition8197095
Ref: 258c8197095
Ref: reference/compound_stmts grammar-token-python-grammar-async_funcdef8197159
Ref: 252f8197159
Node: async for 文8198181
Ref: reference/compound_stmts async-for8198308
Ref: ca18198308
Ref: reference/compound_stmts the-async-for-statement8198308
Ref: 258d8198308
Ref: reference/compound_stmts grammar-token-python-grammar-async_for_stmt8198360
Ref: 252e8198360
Node: async with 文8199403
Ref: reference/compound_stmts async-with8199494
Ref: 1858199494
Ref: reference/compound_stmts the-async-with-statement8199494
Ref: 258e8199494
Ref: reference/compound_stmts grammar-token-python-grammar-async_with_stmt8199548
Ref: 252d8199548
Ref: async with 文-Footnote-18200766
Node: Type parameter lists8200808
Ref: reference/compound_stmts type-parameter-lists8200943
Ref: 258f8200943
Ref: reference/compound_stmts type-params8200943
Ref: 5ad8200943
Ref: reference/compound_stmts grammar-token-python-grammar-type_params8201112
Ref: 251f8201112
Ref: reference/compound_stmts grammar-token-python-grammar-type_param8201194
Ref: 25908201194
Ref: reference/compound_stmts grammar-token-python-grammar-typevar8201287
Ref: 25918201287
Ref: reference/compound_stmts grammar-token-python-grammar-typevartuple8201390
Ref: 25928201390
Ref: reference/compound_stmts grammar-token-python-grammar-paramspec8201467
Ref: 25938201467
Ref: Type parameter lists-Footnote-18205845
Node: Generic functions8205887
Ref: reference/compound_stmts generic-functions8205985
Ref: 6828205985
Ref: reference/compound_stmts id178205985
Ref: 25958205985
Node: Generic classes8207789
Ref: reference/compound_stmts generic-classes8207916
Ref: 23778207916
Ref: reference/compound_stmts id188207916
Ref: 25968207916
Node: Generic type aliases8209058
Ref: reference/compound_stmts generic-type-aliases8209159
Ref: 6848209159
Ref: reference/compound_stmts id198209159
Ref: 25978209159
Node: Annotations<2>8209963
Ref: reference/compound_stmts annotations8210071
Ref: 25878210071
Ref: reference/compound_stmts id208210071
Ref: 25988210071
Ref: Annotations<2>-Footnote-18211919
Node: トップレベル要素8211961
Ref: reference/toplevel_components doc8212120
Ref: 25998212120
Ref: reference/toplevel_components top-level8212120
Ref: 259a8212120
Ref: reference/toplevel_components top-level-components8212120
Ref: 259b8212120
Ref: reference/toplevel_components translation-repo8212120
Ref: 259c8212120
Node: 完全な Python プログラム8212653
Ref: reference/toplevel_components complete-python-programs8212773
Ref: 259d8212773
Ref: reference/toplevel_components programs8212773
Ref: 24528212773
Node: ファイル入力8214751
Ref: reference/toplevel_components file-input8214895
Ref: 259e8214895
Ref: reference/toplevel_components id18214895
Ref: 259f8214895
Ref: reference/toplevel_components grammar-token-python-grammar-file_input8215024
Ref: 25a08215024
Node: 対話的入力8215394
Ref: reference/toplevel_components interactive8215515
Ref: 25a18215515
Ref: reference/toplevel_components interactive-input8215515
Ref: 25a28215515
Ref: reference/toplevel_components grammar-token-python-grammar-interactive_input8215639
Ref: 25a38215639
Node: 式入力8215998
Ref: reference/toplevel_components expression-input8216092
Ref: 25a48216092
Ref: reference/toplevel_components id28216092
Ref: 25a58216092
Ref: reference/toplevel_components grammar-token-python-grammar-eval_input8216332
Ref: 25a68216332
Node: 完全な文法仕様8216398
Ref: reference/grammar doc8216520
Ref: 25648216520
Ref: reference/grammar full-grammar-specification8216520
Ref: 25a78216520
Ref: reference/grammar id18216520
Ref: 25a88216520
Ref: reference/grammar translation-repo8216520
Ref: 25a98216520
Ref: 完全な文法仕様-Footnote-18295980
Node: Python 標準ライブラリ8296052
Ref: library/index doc8296218
Ref: 25aa8296218
Ref: library/index library-index8296218
Ref: 1498296218
Ref: library/index the-python-standard-library8296218
Ref: 25ab8296218
Ref: library/index translation-repo8296218
Ref: 25ac8296218
Ref: Python 標準ライブラリ-Footnote-18299947
Node: はじめに<6>8299972
Ref: library/intro doc8300079
Ref: 25ad8300079
Ref: library/intro introduction8300079
Ref: 25ae8300079
Ref: library/intro library-intro8300079
Ref: 25af8300079
Node: 利用可能性について8304085
Ref: library/intro availability8304164
Ref: 213f8304164
Ref: library/intro notes-on-availability8304164
Ref: 25b08304164
Node: WebAssembly プラットフォーム8305154
Ref: library/intro wasm-availability8305299
Ref: 1b6a8305299
Ref: library/intro webassembly-platforms8305299
Ref: 25b18305299
Ref: library/intro mobile-availability8308405
Ref: 225c8308405
Ref: WebAssembly プラットフォーム-Footnote-18308442
Ref: WebAssembly プラットフォーム-Footnote-28308475
Ref: WebAssembly プラットフォーム-Footnote-38308507
Ref: WebAssembly プラットフォーム-Footnote-48308533
Ref: WebAssembly プラットフォーム-Footnote-58308565
Ref: WebAssembly プラットフォーム-Footnote-68308591
Ref: WebAssembly プラットフォーム-Footnote-78308621
Ref: WebAssembly プラットフォーム-Footnote-88308650
Ref: WebAssembly プラットフォーム-Footnote-98308680
Node: モバイルプラットフォーム8308740
Ref: library/intro ios-availability8308885
Ref: 25b28308885
Ref: library/intro mobile-platforms8308885
Ref: 25b38308885
Ref: モバイルプラットフォーム-Footnote-18311737
Node: 組み込み関数8311803
Ref: library/functions doc8311937
Ref: 25b48311937
Ref: library/functions built-in-funcs8311937
Ref: 14748311937
Ref: library/functions built-in-functions8311937
Ref: 25b58311937
Ref: library/functions translation-repo8311937
Ref: 25b68311937
Ref: library/functions abs8315407
Ref: 208d8315407
Ref: library/functions aiter8315680
Ref: 9d58315680
Ref: library/functions all8316030
Ref: 163b8316030
Ref: library/functions anext8316390
Ref: 9d68316390
Ref: library/functions any8317375
Ref: 163a8317375
Ref: library/functions ascii8317749
Ref: 15ff8317749
Ref: library/functions bin8318200
Ref: 14c08318200
Ref: library/functions bool8319163
Ref: 3c38319163
Ref: library/functions breakpoint8320028
Ref: 2718320028
Ref: library/functions func-bytearray8321698
Ref: 1e9b8321698
Ref: library/functions func-bytes8323460
Ref: 1e9a8323460
Ref: library/functions callable8324459
Ref: 13de8324459
Ref: library/functions chr8325249
Ref: 19ef8325249
Ref: library/functions classmethod8325708
Ref: 48e8325708
Ref: library/functions compile8327902
Ref: 4b18327902
Ref: library/functions complex8333191
Ref: 1978333191
Ref: library/functions grammar-token-float-complexvalue8334815
Ref: 25c98334815
Ref: library/functions delattr8336950
Ref: 25b78336950
Ref: library/functions func-dict8337537
Ref: 25b88337537
Ref: library/functions dir8338138
Ref: 8448338138
Ref: library/functions divmod8341448
Ref: b998341448
Ref: library/functions enumerate8342264
Ref: 169a8342264
Ref: library/functions func-eval8343336
Ref: 25cd8343336
Ref: library/functions eval8343336
Ref: 4a38343336
Ref: library/functions exec8347294
Ref: 4a28347294
Ref: library/functions filter8351863
Ref: a648351863
Ref: library/functions float8352852
Ref: 1968352852
Ref: library/functions grammar-token-float-sign8353851
Ref: 25cb8353851
Ref: library/functions grammar-token-float-infinity8353886
Ref: 25cf8353886
Ref: library/functions grammar-token-float-nan8353930
Ref: 25d08353930
Ref: library/functions grammar-token-float-digit8353961
Ref: 25d18353961
Ref: library/functions grammar-token-float-digitpart8354060
Ref: 25d28354060
Ref: library/functions grammar-token-float-number8354132
Ref: 25d38354132
Ref: library/functions grammar-token-float-exponent8354240
Ref: 25d48354240
Ref: library/functions grammar-token-float-floatnumber8354320
Ref: 25d58354320
Ref: library/functions grammar-token-float-absfloatvalue8354389
Ref: 25cc8354389
Ref: library/functions grammar-token-float-floatvalue8354482
Ref: 25ca8354482
Ref: library/functions format8355979
Ref: 1998355979
Ref: library/functions func-frozenset8357227
Ref: 25b98357227
Ref: library/functions getattr8357853
Ref: dca8357853
Ref: library/functions globals8359057
Ref: 1c0a8359057
Ref: library/functions hasattr8359367
Ref: 6f98359367
Ref: library/functions hash8359788
Ref: 8018359788
Ref: library/functions help8360460
Ref: ad48360460
Ref: library/functions hex8361924
Ref: 14e78361924
Ref: library/functions id8363182
Ref: 163c8363182
Ref: library/functions input8363726
Ref: 14f08363726
Ref: library/functions int8364759
Ref: 19b8364759
Ref: library/functions isinstance8368990
Ref: 2ad8368990
Ref: library/functions issubclass8370189
Ref: 9c48370189
Ref: library/functions iter8371030
Ref: 9d78371030
Ref: library/functions len8372876
Ref: 8408372876
Ref: library/functions func-list8373334
Ref: 25ba8373334
Ref: library/functions locals8373625
Ref: 46f8373625
Ref: library/functions map8376804
Ref: 19f8376804
Ref: library/functions max8377576
Ref: 110c8377576
Ref: library/functions func-memoryview8379176
Ref: 25bb8379176
Ref: library/functions min8379409
Ref: 110b8379409
Ref: library/functions next8380996
Ref: 9d88380996
Ref: library/functions object8381416
Ref: c7e8381416
Ref: library/functions oct8381947
Ref: 14e68381947
Ref: library/functions open8382901
Ref: 3168382901
Ref: library/functions filemodes8385053
Ref: 25d98385053
Ref: library/functions open-newline-parameter8392227
Ref: 9488392227
Ref: library/functions ord8398474
Ref: 233b8398474
Ref: library/functions pow8399013
Ref: 1a48399013
Ref: library/functions print8401504
Ref: 11778401504
Ref: library/functions property8403146
Ref: 4b38403146
Ref: library/functions property getter8404979
Ref: 19d98404979
Ref: library/functions property setter8405008
Ref: 19da8405008
Ref: library/functions property deleter8405037
Ref: 19db8405037
Ref: library/functions property __name__8406451
Ref: 4b28406451
Ref: library/functions func-range8406634
Ref: 25bc8406634
Ref: library/functions repr8406956
Ref: 1c18406956
Ref: library/functions reversed8408134
Ref: a658408134
Ref: library/functions round8408602
Ref: 14f28408602
Ref: library/functions func-set8410213
Ref: 25bd8410213
Ref: library/functions setattr8410811
Ref: 25be8410811
Ref: library/functions slice8412171
Ref: 6948412171
Ref: library/functions slice start8412743
Ref: 23a58412743
Ref: library/functions slice stop8412769
Ref: 23a68412769
Ref: library/functions slice step8412794
Ref: 23a78412794
Ref: library/functions sorted8413344
Ref: dc78413344
Ref: library/functions staticmethod8415589
Ref: 4538415589
Ref: library/functions func-str8417754
Ref: 25bf8417754
Ref: library/functions sum8418273
Ref: 6958418273
Ref: library/functions super8419570
Ref: 1a68419570
Ref: library/functions func-tuple8425081
Ref: 25c08425081
Ref: library/functions type8425374
Ref: f448425374
Ref: library/functions vars8427519
Ref: 1e238427519
Ref: library/functions zip8428804
Ref: 1a08428804
Ref: library/functions import__8433706
Ref: ad18433706
Ref: 組み込み関数-Footnote-18437886
Ref: 組み込み関数-Footnote-28438139
Ref: 組み込み関数-Footnote-38438181
Ref: 組み込み関数-Footnote-48438223
Ref: 組み込み関数-Footnote-58438265
Ref: 組み込み関数-Footnote-68438307
Ref: 組み込み関数-Footnote-78438384
Ref: 組み込み関数-Footnote-88438432
Ref: 組み込み関数-Footnote-98438474
Node: 組み込み定数8438516
Ref: library/constants doc8438650
Ref: 25e18438650
Ref: library/constants built-in-constants8438650
Ref: 25e28438650
Ref: library/constants built-in-consts8438650
Ref: 24778438650
Ref: library/constants translation-repo8438650
Ref: 25e38438650
Ref: library/constants False8438778
Ref: d2b8438778
Ref: library/constants True8438934
Ref: e078438934
Ref: library/constants None8439088
Ref: 8858439088
Ref: library/constants NotImplemented8439447
Ref: 1a28439447
Ref: library/constants Ellipsis8441573
Ref: 23288441573
Ref: library/constants debug__8441919
Ref: 9da8441919
Node: site モジュールで追加される定数8442535
Ref: library/constants constants-added-by-the-site-module8442634
Ref: 25e48442634
Ref: library/constants site-consts8442634
Ref: 25e58442634
Ref: library/constants quit8443124
Ref: 25e68443124
Ref: library/constants exit8443156
Ref: 25e78443156
Ref: library/constants copyright8443724
Ref: 17888443724
Ref: library/constants credits8443749
Ref: 17898443749
Ref: library/constants license8443942
Ref: 17878443942
Node: 組み込み型8444259
Ref: library/stdtypes doc8444393
Ref: 25e88444393
Ref: library/stdtypes bltin-types8444393
Ref: 25e98444393
Ref: library/stdtypes built-in-types8444393
Ref: 25ea8444393
Ref: library/stdtypes translation-repo8444393
Ref: 25eb8444393
Node: 真理値判定8446429
Ref: library/stdtypes truth8446535
Ref: 18588446535
Ref: library/stdtypes truth-value-testing8446535
Ref: 25ec8446535
Ref: 真理値判定-Footnote-18447919
Node: ブール演算 --- and or not8448119
Ref: library/stdtypes boolean8448243
Ref: 25ed8448243
Ref: library/stdtypes boolean-operations-and-or-not8448243
Ref: 25ee8448243
Node: 比較<2>8449716
Ref: library/stdtypes comparisons8449852
Ref: 25ef8449852
Ref: library/stdtypes stdcomparisons8449852
Ref: 25f08449852
Node: 数値型 int float complex8452785
Ref: library/stdtypes numeric-types-int-float-complex8452916
Ref: 25f18452916
Ref: library/stdtypes typesnumeric8452916
Ref: 1fdc8452916
Ref: library/stdtypes stdtypes-mixed-arithmetic8454647
Ref: 24698454647
Ref: 数値型 int float complex-Footnote-18462422
Ref: 数値型 int float complex-Footnote-28462572
Node: 整数型におけるビット単位演算8462649
Ref: library/stdtypes bitstring-ops8462806
Ref: 25f38462806
Ref: library/stdtypes bitwise-operations-on-integer-types8462806
Ref: 25f48462806
Node: 整数型における追加のメソッド8465383
Ref: library/stdtypes additional-methods-on-integer-types8465600
Ref: 25f58465600
Ref: library/stdtypes int bit_length8465855
Ref: 25f68465855
Ref: library/stdtypes int bit_count8466763
Ref: 9cf8466763
Ref: library/stdtypes int to_bytes8467163
Ref: 1c328467163
Ref: library/stdtypes int from_bytes8469555
Ref: 1be98469555
Ref: library/stdtypes int as_integer_ratio8471674
Ref: bc08471674
Ref: library/stdtypes int is_integer8472004
Ref: 1aeb8472004
Node: 浮動小数点数に対する追加のメソッド8472236
Ref: library/stdtypes additional-methods-on-float8472453
Ref: 25f98472453
Ref: library/stdtypes float from_number8472753
Ref: 1948472753
Ref: library/stdtypes float as_integer_ratio8473475
Ref: 21028473475
Ref: library/stdtypes float is_integer8473832
Ref: 25f88473832
Ref: library/stdtypes float hex8474602
Ref: 21038474602
Ref: library/stdtypes float fromhex8474826
Ref: 25fa8474826
Node: 複素数に対する追加のメソッド8476650
Ref: library/stdtypes additional-methods-on-complex8476852
Ref: 25fb8476852
Ref: library/stdtypes complex from_number8477136
Ref: 1958477136
Node: 数値型のハッシュ化8477706
Ref: library/stdtypes hashing-of-numeric-types8477848
Ref: 25fd8477848
Ref: library/stdtypes numeric-hash8477848
Ref: 25fe8477848
Ref: library/stdtypes bltin-boolean-values8482513
Ref: 26008482513
Node: ブーリアン型 - bool8482514
Ref: library/stdtypes boolean-type-bool8482654
Ref: 26018482654
Ref: library/stdtypes typebool8482654
Ref: 25c18482654
Node: イテレータ型8484190
Ref: library/stdtypes iterator-types8484342
Ref: 26028484342
Ref: library/stdtypes typeiter8484342
Ref: 25d78484342
Ref: library/stdtypes container __iter__8484954
Ref: 20aa8484954
Ref: library/stdtypes iterator __iter__8485969
Ref: 20ad8485969
Ref: library/stdtypes iterator __next__8486414
Ref: 14e58486414
Node: ジェネレータ型8487422
Ref: library/stdtypes generator-types8487498
Ref: 26038487498
Ref: library/stdtypes id38487498
Ref: 26048487498
Node: シーケンス型 --- list tuple range8488171
Ref: library/stdtypes sequence-types-list-tuple-range8488343
Ref: 26058488343
Ref: library/stdtypes typesseq8488343
Ref: 202e8488343
Node: 共通のシーケンス演算8488990
Ref: library/stdtypes common-sequence-operations8489147
Ref: 26068489147
Ref: library/stdtypes typesseq-common8489147
Ref: 26078489147
Ref: library/stdtypes list count8498729
Ref: 15df8498729
Ref: library/stdtypes sequence count8498729
Ref: 23d88498729
Ref: library/stdtypes list index8498849
Ref: 15de8498849
Ref: library/stdtypes sequence index8498849
Ref: 19798498849
Ref: 共通のシーケンス演算-Footnote-18499527
Node: イミュータブルなシーケンス型8499678
Ref: library/stdtypes immutable-sequence-types8499883
Ref: 260b8499883
Ref: library/stdtypes typesseq-immutable8499883
Ref: 260c8499883
Node: ミュータブルなシーケンス型8500611
Ref: library/stdtypes mutable-sequence-types8500806
Ref: 260d8500806
Ref: library/stdtypes typesseq-mutable8500806
Ref: 25c28500806
Ref: library/stdtypes bytearray append8504780
Ref: 15bf8504780
Ref: library/stdtypes sequence append8504780
Ref: 23d68504780
Ref: library/stdtypes bytearray clear8504949
Ref: 260e8504949
Ref: library/stdtypes sequence clear8504949
Ref: 23d78504949
Ref: library/stdtypes bytearray copy8505113
Ref: 260f8505113
Ref: library/stdtypes sequence copy8505113
Ref: 26108505113
Ref: library/stdtypes bytearray extend8505458
Ref: 17918505458
Ref: library/stdtypes sequence extend8505458
Ref: 23d98505458
Ref: library/stdtypes bytearray insert8505663
Ref: 26118505663
Ref: library/stdtypes sequence insert8505663
Ref: 23da8505663
Ref: library/stdtypes bytearray pop8505850
Ref: 15c08505850
Ref: library/stdtypes sequence pop8505850
Ref: 23db8505850
Ref: library/stdtypes bytearray remove8506038
Ref: 26128506038
Ref: library/stdtypes sequence remove8506038
Ref: 197a8506038
Ref: library/stdtypes bytearray reverse8506270
Ref: 15c18506270
Ref: library/stdtypes sequence reverse8506270
Ref: 23dc8506270
Node: リスト型 list<2>8506513
Ref: library/stdtypes lists8506684
Ref: 26138506684
Ref: library/stdtypes typesseq-list8506684
Ref: 20228506684
Ref: library/stdtypes list8506975
Ref: 24d8506975
Ref: library/stdtypes list sort8508390
Ref: dc88508390
Ref: library/stdtypes thread-safety-list8511307
Ref: 26148511307
Node: タプル型 tuple8514772
Ref: library/stdtypes tuples8514909
Ref: 261a8514909
Ref: library/stdtypes typesseq-tuple8514909
Ref: 254a8514909
Ref: library/stdtypes tuple8515434
Ref: 6148515434
Node: range8517311
Ref: library/stdtypes ranges8517419
Ref: 261b8517419
Ref: library/stdtypes typesseq-range8517419
Ref: 25dd8517419
Ref: library/stdtypes range8517629
Ref: b3d8517629
Ref: library/stdtypes range start8519908
Ref: 261c8519908
Ref: library/stdtypes range stop8520027
Ref: 261d8520027
Ref: library/stdtypes range step8520085
Ref: 261e8520085
Ref: range-Footnote-18522467
Node: Text and Binary Sequence Type Methods Summary8522553
Ref: library/stdtypes text-and-binary-sequence-type-methods-summary8522745
Ref: 261f8522745
Ref: library/stdtypes text-methods-summary8522745
Ref: 26208522745
Node: テキストシーケンス型 --- str8533751
Ref: library/stdtypes text-sequence-type-str8533965
Ref: 264e8533965
Ref: library/stdtypes textseq8533965
Ref: 1fe08533965
Ref: library/stdtypes str8536260
Ref: 1698536260
Node: 文字列メソッド<2>8539247
Ref: library/stdtypes id58539390
Ref: 26518539390
Ref: library/stdtypes string-methods8539390
Ref: 1fe18539390
Ref: library/stdtypes str capitalize8540444
Ref: 263e8540444
Ref: library/stdtypes str casefold8540931
Ref: fd68540931
Ref: library/stdtypes str center8541769
Ref: 20638541769
Ref: library/stdtypes str count8542238
Ref: 19818542238
Ref: library/stdtypes str encode8542970
Ref: ad28542970
Ref: library/stdtypes str endswith8544519
Ref: 10cc8544519
Ref: library/stdtypes str expandtabs8545309
Ref: 26478545309
Ref: library/stdtypes str find8546544
Ref: 10a88546544
Ref: library/stdtypes str format8547355
Ref: 8338547355
Ref: library/stdtypes str format_map8549396
Ref: fd78549396
Ref: library/stdtypes str index8549961
Ref: 19bc8549961
Ref: library/stdtypes str isalnum8550510
Ref: 26318550510
Ref: library/stdtypes str isalpha8551086
Ref: 262b8551086
Ref: library/stdtypes str isascii8551905
Ref: ce98551905
Ref: library/stdtypes str isdecimal8552270
Ref: 262d8552270
Ref: library/stdtypes str isdigit8552891
Ref: 262e8552891
Ref: library/stdtypes str isidentifier8553497
Ref: 1d468553497
Ref: library/stdtypes str islower8554130
Ref: 26338554130
Ref: library/stdtypes str isnumeric8554404
Ref: 26308554404
Ref: library/stdtypes str isprintable8555356
Ref: fd88555356
Ref: library/stdtypes str isspace8556378
Ref: 26398556378
Ref: library/stdtypes str istitle8556892
Ref: 26378556892
Ref: library/stdtypes str isupper8557521
Ref: 26358557521
Ref: library/stdtypes meth-str-join8557986
Ref: 26558557986
Ref: library/stdtypes str join8557986
Ref: 26098557986
Ref: library/stdtypes str ljust8558510
Ref: 20628558510
Ref: library/stdtypes str lower8559079
Ref: 1b768559079
Ref: library/stdtypes str lstrip8559423
Ref: 16c98559423
Ref: library/stdtypes str maketrans8560360
Ref: fd98560360
Ref: library/stdtypes str partition8561259
Ref: 10ab8561259
Ref: library/stdtypes str removeprefix8562009
Ref: acc8562009
Ref: library/stdtypes str removesuffix8562444
Ref: acd8562444
Ref: library/stdtypes str replace8562908
Ref: 4b88562908
Ref: library/stdtypes str rfind8563528
Ref: 10a98563528
Ref: library/stdtypes str rindex8564029
Ref: 146f8564029
Ref: library/stdtypes str rjust8564608
Ref: 20618564608
Ref: library/stdtypes str rpartition8564948
Ref: 14708564948
Ref: library/stdtypes str rsplit8565701
Ref: 146d8565701
Ref: library/stdtypes str rstrip8566274
Ref: 16ca8566274
Ref: library/stdtypes str split8567127
Ref: 10aa8567127
Ref: library/stdtypes str splitlines8569434
Ref: 146e8569434
Ref: library/stdtypes str startswith8572190
Ref: 10cb8572190
Ref: library/stdtypes str strip8572930
Ref: 16c88572930
Ref: library/stdtypes str swapcase8574007
Ref: 26428574007
Ref: library/stdtypes str title8574253
Ref: 26408574253
Ref: library/stdtypes str translate8575634
Ref: 264c8575634
Ref: library/stdtypes str upper8576942
Ref: 263c8576942
Ref: library/stdtypes str zfill8577515
Ref: 16cb8577515
Ref: 文字列メソッド<2>-Footnote-18578041
Ref: 文字列メソッド<2>-Footnote-28578125
Ref: 文字列メソッド<2>-Footnote-38578209
Ref: 文字列メソッド<2>-Footnote-48578466
Ref: 文字列メソッド<2>-Footnote-58578723
Ref: 文字列メソッド<2>-Footnote-68578980
Ref: 文字列メソッド<2>-Footnote-78579064
Ref: 文字列メソッド<2>-Footnote-88579321
Node: Formatted String Literals f-strings8579405
Ref: library/stdtypes formatted-string-literals-f-strings8579591
Ref: 26578579591
Ref: library/stdtypes stdtypes-fstrings8579591
Ref: 22eb8579591
Node: Debug specifier8580797
Ref: library/stdtypes debug-specifier8580913
Ref: 26588580913
Node: Conversion specifier8581501
Ref: library/stdtypes conversion-specifier8581642
Ref: 26598581642
Node: Format specifier8582626
Ref: library/stdtypes format-specifier8582743
Ref: 265a8582743
Node: Template String Literals t-strings8583510
Ref: library/stdtypes stdtypes-tstrings8583706
Ref: 22ef8583706
Ref: library/stdtypes template-string-literals-t-strings8583706
Ref: 265b8583706
Node: printf 形式の文字列書式化8585576
Ref: library/stdtypes old-string-formatting8585728
Ref: 8db8585728
Ref: library/stdtypes printf-style-string-formatting8585728
Ref: 265d8585728
Ref: printf 形式の文字列書式化-Footnote-18596368
Ref: printf 形式の文字列書式化-Footnote-28596584
Node: バイナリシーケンス型 --- bytes bytearray memoryview8596626
Ref: library/stdtypes binary-sequence-types-bytes-bytearray-memoryview8596831
Ref: 265e8596831
Ref: library/stdtypes binaryseq8596831
Ref: 25c48596831
Node: バイトオブジェクト8597722
Ref: library/stdtypes bytes-objects8597884
Ref: 265f8597884
Ref: library/stdtypes typebytes8597884
Ref: 25c68597884
Ref: library/stdtypes bytes8598325
Ref: 1928598325
Ref: library/stdtypes bytes fromhex8601255
Ref: 1908601255
Ref: library/stdtypes bytes hex8602266
Ref: f658602266
Node: bytearray オブジェクト8604378
Ref: library/stdtypes bytearray-objects8604578
Ref: 26608604578
Ref: library/stdtypes typebytearray8604578
Ref: 25c58604578
Ref: library/stdtypes bytearray8604768
Ref: 3448604768
Ref: library/stdtypes bytearray fromhex8606036
Ref: 1918606036
Ref: library/stdtypes bytearray hex8607082
Ref: f668607082
Ref: library/stdtypes bytearray resize8607772
Ref: 18ac8607772
Node: bytes と bytearray の操作8609499
Ref: library/stdtypes bytes-and-bytearray-operations8609710
Ref: 26618609710
Ref: library/stdtypes bytes-methods8609710
Ref: 25c38609710
Ref: library/stdtypes bytes count8611385
Ref: 19828611385
Ref: library/stdtypes bytearray count8611437
Ref: 17948611437
Ref: library/stdtypes bytes removeprefix8612216
Ref: 26628612216
Ref: library/stdtypes bytearray removeprefix8612265
Ref: 26638612265
Ref: library/stdtypes bytes removesuffix8612998
Ref: 26648612998
Ref: library/stdtypes bytearray removesuffix8613047
Ref: 26658613047
Ref: library/stdtypes bytes decode8613811
Ref: ad38613811
Ref: library/stdtypes bytearray decode8613878
Ref: 26668613878
Ref: library/stdtypes bytes endswith8615587
Ref: 26248615587
Ref: library/stdtypes bytearray endswith8615645
Ref: 15bc8615645
Ref: library/stdtypes bytes find8616282
Ref: 1bd48616282
Ref: library/stdtypes bytearray find8616333
Ref: 15bd8616333
Ref: library/stdtypes bytes index8617467
Ref: 26218617467
Ref: library/stdtypes bytearray index8617519
Ref: 17958617519
Ref: library/stdtypes bytes join8618034
Ref: 260a8618034
Ref: library/stdtypes bytearray join8618077
Ref: 26678618077
Ref: library/stdtypes bytes maketrans8618585
Ref: 148c8618585
Ref: library/stdtypes bytearray maketrans8618640
Ref: 148d8618640
Ref: library/stdtypes bytes partition8619114
Ref: 26298619114
Ref: library/stdtypes bytearray partition8619157
Ref: 26688619157
Ref: library/stdtypes bytes replace8619838
Ref: 26258619838
Ref: library/stdtypes bytearray replace8619894
Ref: 26698619894
Ref: library/stdtypes bytes rfind8620569
Ref: 1bd58620569
Ref: library/stdtypes bytearray rfind8620621
Ref: 15be8620621
Ref: library/stdtypes bytes rindex8621307
Ref: 26228621307
Ref: library/stdtypes bytearray rindex8621360
Ref: 17968621360
Ref: library/stdtypes bytes rpartition8621884
Ref: 262a8621884
Ref: library/stdtypes bytearray rpartition8621928
Ref: 266a8621928
Ref: library/stdtypes bytes startswith8622589
Ref: 26238622589
Ref: library/stdtypes bytearray startswith8622649
Ref: 15bb8622649
Ref: library/stdtypes bytes translate8623288
Ref: 264d8623288
Ref: library/stdtypes bytearray translate8623345
Ref: 15138623345
Ref: library/stdtypes bytes center8624671
Ref: 26468624671
Ref: library/stdtypes bytearray center8624728
Ref: 266b8624728
Ref: library/stdtypes bytes ljust8625360
Ref: 26448625360
Ref: library/stdtypes bytearray ljust8625416
Ref: 266c8625416
Ref: library/stdtypes bytes lstrip8626044
Ref: 264a8626044
Ref: library/stdtypes bytearray lstrip8626091
Ref: 266d8626091
Ref: library/stdtypes bytes rjust8627426
Ref: 26458627426
Ref: library/stdtypes bytearray rjust8627482
Ref: 266e8627482
Ref: library/stdtypes bytes rsplit8628110
Ref: 26278628110
Ref: library/stdtypes bytearray rsplit8628165
Ref: 17998628165
Ref: library/stdtypes bytes rstrip8628801
Ref: 264b8628801
Ref: library/stdtypes bytearray rstrip8628848
Ref: 266f8628848
Ref: library/stdtypes bytes split8630165
Ref: 26268630165
Ref: library/stdtypes bytearray split8630219
Ref: 17988630219
Ref: library/stdtypes bytes strip8632443
Ref: 26498632443
Ref: library/stdtypes bytearray strip8632489
Ref: 26708632489
Ref: library/stdtypes bytes capitalize8633863
Ref: 263f8633863
Ref: library/stdtypes bytearray capitalize8633901
Ref: 26718633901
Ref: library/stdtypes bytes expandtabs8634410
Ref: 26488634410
Ref: library/stdtypes bytearray expandtabs8634457
Ref: 26728634457
Ref: library/stdtypes bytes isalnum8636180
Ref: 26328636180
Ref: library/stdtypes bytearray isalnum8636215
Ref: 26738636215
Ref: library/stdtypes bytes isalpha8636868
Ref: 262c8636868
Ref: library/stdtypes bytearray isalpha8636903
Ref: 26748636903
Ref: library/stdtypes bytes isascii8637448
Ref: 26758637448
Ref: library/stdtypes bytearray isascii8637483
Ref: 26768637483
Ref: library/stdtypes bytes isdigit8637796
Ref: 262f8637796
Ref: library/stdtypes bytearray isdigit8637831
Ref: 26778637831
Ref: library/stdtypes bytes islower8638273
Ref: 26348638273
Ref: library/stdtypes bytearray islower8638308
Ref: 26788638308
Ref: library/stdtypes bytes isspace8638990
Ref: 263a8638990
Ref: library/stdtypes bytearray isspace8639025
Ref: 26798639025
Ref: library/stdtypes bytes istitle8639505
Ref: 26388639505
Ref: library/stdtypes bytearray istitle8639540
Ref: 267a8639540
Ref: library/stdtypes bytes isupper8640026
Ref: 26368640026
Ref: library/stdtypes bytearray isupper8640061
Ref: 267b8640061
Ref: library/stdtypes bytes lower8640743
Ref: 263b8640743
Ref: library/stdtypes bytearray lower8640776
Ref: 267c8640776
Ref: library/stdtypes bytes splitlines8641540
Ref: 26288641540
Ref: library/stdtypes bytearray splitlines8641592
Ref: 267d8641592
Ref: library/stdtypes bytes swapcase8642760
Ref: 26438642760
Ref: library/stdtypes bytearray swapcase8642796
Ref: 267e8642796
Ref: library/stdtypes bytes title8643933
Ref: 26418643933
Ref: library/stdtypes bytearray title8643966
Ref: 267f8643966
Ref: library/stdtypes bytes upper8645995
Ref: 263d8645995
Ref: library/stdtypes bytearray upper8646028
Ref: 26808646028
Ref: library/stdtypes bytes zfill8646792
Ref: 26818646792
Ref: library/stdtypes bytearray zfill8646833
Ref: 26828646833
Node: printf 形式での bytes の書式化8647623
Ref: library/stdtypes bytes-formatting8647824
Ref: f818647824
Ref: library/stdtypes printf-style-bytes-formatting8647824
Ref: 26838647824
Ref: printf 形式での bytes の書式化-Footnote-18658804
Ref: printf 形式での bytes の書式化-Footnote-28659020
Ref: printf 形式での bytes の書式化-Footnote-38659062
Node: メモリビュー8659104
Ref: library/stdtypes memory-views8659267
Ref: 26848659267
Ref: library/stdtypes typememoryview8659267
Ref: 25d88659267
Ref: library/stdtypes memoryview8659566
Ref: 1658659566
Ref: library/stdtypes memoryview __eq__8664783
Ref: 26878664783
Ref: library/stdtypes memoryview tobytes8667166
Ref: 26888667166
Ref: library/stdtypes memoryview hex8668735
Ref: f678668735
Ref: library/stdtypes memoryview tolist8669477
Ref: 26858669477
Ref: library/stdtypes memoryview toreadonly8670199
Ref: 26898670199
Ref: library/stdtypes memoryview release8670942
Ref: 13d68670942
Ref: library/stdtypes memoryview cast8672691
Ref: 124d8672691
Ref: library/stdtypes memoryview count8676714
Ref: 18f88676714
Ref: library/stdtypes memoryview index8676859
Ref: 18f78676859
Ref: library/stdtypes memoryview obj8677260
Ref: 268a8677260
Ref: library/stdtypes memoryview nbytes8677546
Ref: 268b8677546
Ref: library/stdtypes memoryview readonly8678800
Ref: 268c8678800
Ref: library/stdtypes memoryview format8678921
Ref: 124c8678921
Ref: library/stdtypes memoryview itemsize8679748
Ref: 26868679748
Ref: library/stdtypes memoryview ndim8680176
Ref: 12508680176
Ref: library/stdtypes memoryview shape8680296
Ref: 12518680296
Ref: library/stdtypes memoryview strides8680641
Ref: 12528680641
Ref: library/stdtypes memoryview suboffsets8681068
Ref: 12538681068
Ref: library/stdtypes memoryview c_contiguous8681261
Ref: 268d8681261
Ref: library/stdtypes memoryview f_contiguous8681496
Ref: 268e8681496
Ref: library/stdtypes memoryview contiguous8681735
Ref: 268f8681735
Ref: メモリビュー-Footnote-18681982
Node: set（集合）型 --- set frozenset8682024
Ref: library/stdtypes set-types-set-frozenset8682218
Ref: 26908682218
Ref: library/stdtypes types-set8682218
Ref: 20318682218
Ref: library/stdtypes set8684082
Ref: 1848684082
Ref: library/stdtypes frozenset8684118
Ref: 7f28684118
Ref: library/stdtypes frozenset isdisjoint8685388
Ref: 26928685388
Ref: library/stdtypes set isdisjoint8685438
Ref: 26938685438
Ref: library/stdtypes frozenset issubset8685699
Ref: 26948685699
Ref: library/stdtypes set issubset8685747
Ref: 26958685747
Ref: library/stdtypes frozenset issuperset8686068
Ref: 26968686068
Ref: library/stdtypes set issuperset8686118
Ref: 1b858686118
Ref: library/stdtypes frozenset union8686441
Ref: 169c8686441
Ref: library/stdtypes set union8686485
Ref: 26978686485
Ref: library/stdtypes frozenset intersection8686641
Ref: 169d8686641
Ref: library/stdtypes set intersection8686692
Ref: 1b848686692
Ref: library/stdtypes frozenset difference8686867
Ref: 26988686867
Ref: library/stdtypes set difference8686916
Ref: 26998686916
Ref: library/stdtypes frozenset symmetric_difference8687122
Ref: 269a8687122
Ref: library/stdtypes set symmetric_difference8687182
Ref: 269b8687182
Ref: library/stdtypes frozenset copy8687383
Ref: 269c8687383
Ref: library/stdtypes set copy8687419
Ref: 269d8687419
Ref: library/stdtypes set update8690016
Ref: 269e8690016
Ref: library/stdtypes set intersection_update8690163
Ref: 169e8690163
Ref: library/stdtypes set difference_update8690358
Ref: 269f8690358
Ref: library/stdtypes set symmetric_difference_update8690523
Ref: 169f8690523
Ref: library/stdtypes set add8690727
Ref: 233e8690727
Ref: library/stdtypes set remove8690814
Ref: 26918690814
Ref: library/stdtypes set discard8691004
Ref: 26a08691004
Ref: library/stdtypes set pop8691122
Ref: 26a18691122
Ref: library/stdtypes set clear8691295
Ref: 26a28691295
Node: マッピング型 --- dict8691830
Ref: library/stdtypes mapping-types-dict8691999
Ref: 26a38691999
Ref: library/stdtypes typesmapping8691999
Ref: cbd8691999
Ref: library/stdtypes dict8693113
Ref: 1838693113
Ref: library/stdtypes dict clear8699166
Ref: 17d68699166
Ref: library/stdtypes dict copy8699256
Ref: dc98699256
Ref: library/stdtypes dict fromkeys8699342
Ref: 24e8699342
Ref: library/stdtypes dict get8700103
Ref: 20348700103
Ref: library/stdtypes dict items8700500
Ref: 9d28700500
Ref: library/stdtypes dict keys8700727
Ref: 9d08700727
Ref: library/stdtypes dict pop8700927
Ref: 5e68700927
Ref: library/stdtypes dict popitem8701303
Ref: 173f8701303
Ref: library/stdtypes dict setdefault8702266
Ref: 12858702266
Ref: library/stdtypes dict update8702585
Ref: 167e8702585
Ref: library/stdtypes dict values8703353
Ref: 9d18703353
Ref: library/stdtypes thread-safety-dict8705248
Ref: 26a48705248
Node: 辞書ビューオブジェクト8709598
Ref: library/stdtypes dict-views8709695
Ref: 26188709695
Ref: library/stdtypes dictionary-view-objects8709695
Ref: 26a58709695
Node: コンテキストマネージャ型8713984
Ref: library/stdtypes context-manager-types8714199
Ref: 26a78714199
Ref: library/stdtypes typecontextmanager8714199
Ref: 240d8714199
Ref: library/stdtypes contextmanager __enter__8714661
Ref: 26a88714661
Ref: library/stdtypes contextmanager __exit__8715922
Ref: 26a98715922
Node: 型アノテーション型 --- ジェネリックエイリアス 、 ユニオン8719014
Ref: library/stdtypes type-annotation-types-generic-alias-union8719229
Ref: 26aa8719229
Node: ジェネリックエイリアス型8719611
Ref: library/stdtypes generic-alias-type8719784
Ref: 26ab8719784
Ref: library/stdtypes types-genericalias8719784
Ref: 8c18719784
Node: 標準ジェネリッククラス8725959
Ref: library/stdtypes standard-generic-classes8726123
Ref: 26ad8726123
Node: GenericAlias オブジェクトの特別な属性8728624
Ref: library/stdtypes special-attributes-of-genericalias-objects8728788
Ref: 26ba8728788
Ref: library/stdtypes genericalias __origin__8729032
Ref: 26bb8729032
Ref: library/stdtypes genericalias __args__8729249
Ref: 26ac8729249
Ref: library/stdtypes genericalias __parameters__8729546
Ref: 26bc8729546
Ref: library/stdtypes genericalias __unpacked__8730228
Ref: 26bd8730228
Ref: GenericAlias オブジェクトの特別な属性-Footnote-18731347
Ref: GenericAlias オブジェクトの特別な属性-Footnote-28731389
Node: Union 型8731431
Ref: library/stdtypes types-union8731604
Ref: 9c58731604
Ref: library/stdtypes union-type8731604
Ref: 26be8731604
Ref: Union 型-Footnote-18735693
Node: その他の組み込み型8735735
Ref: library/stdtypes other-built-in-types8735926
Ref: 26bf8735926
Ref: library/stdtypes typesother8735926
Ref: 26c08735926
Node: モジュール<4>8736539
Ref: library/stdtypes modules8736675
Ref: 26c18736675
Ref: library/stdtypes typesmodules8736675
Ref: 26c28736675
Node: クラスおよびクラスインスタンス8738214
Ref: library/stdtypes classes-and-class-instances8738365
Ref: 26c38738365
Ref: library/stdtypes typesobjects8738365
Ref: 26c48738365
Node: 関数8738610
Ref: library/stdtypes functions8738755
Ref: 26c58738755
Ref: library/stdtypes typesfunctions8738755
Ref: 26c68738755
Node: メソッド8739324
Ref: library/stdtypes methods8739454
Ref: 26c78739454
Ref: library/stdtypes typesmethods8739454
Ref: 26c88739454
Node: コードオブジェクト<2>8741734
Ref: library/stdtypes bltin-code-objects8741879
Ref: 26c98741879
Ref: library/stdtypes code-objects8741879
Ref: 26ca8741879
Node: 型オブジェクト8742970
Ref: library/stdtypes bltin-type-objects8743127
Ref: 25e08743127
Ref: library/stdtypes type-objects8743127
Ref: 26cb8743127
Node: ヌルオブジェクト8743590
Ref: library/stdtypes bltin-null-object8743744
Ref: 26cc8743744
Ref: library/stdtypes the-null-object8743744
Ref: 26cd8743744
Node: Ellipsis オブジェクト8744184
Ref: library/stdtypes bltin-ellipsis-object8744350
Ref: 1ffc8744350
Ref: library/stdtypes the-ellipsis-object8744350
Ref: 26ce8744350
Ref: Ellipsis オブジェクト-Footnote-18745577
Node: NotImplemented オブジェクト8745662
Ref: library/stdtypes bltin-notimplemented-object8745828
Ref: 26d18745828
Ref: library/stdtypes the-notimplemented-object8745828
Ref: 26d28745828
Node: 内部オブジェクト8746342
Ref: library/stdtypes internal-objects8746472
Ref: 26d38746472
Ref: library/stdtypes typesinternal8746472
Ref: 26d48746472
Node: 特殊属性8746751
Ref: library/stdtypes special-attributes8746905
Ref: 26d58746905
Ref: library/stdtypes specialattrs8746905
Ref: 26d68746905
Ref: library/stdtypes definition __name__8747175
Ref: 12728747175
Ref: library/stdtypes definition __qualname__8747335
Ref: 12718747335
Ref: library/stdtypes definition __module__8747544
Ref: 26d78747544
Ref: library/stdtypes definition __doc__8747653
Ref: b218747653
Ref: library/stdtypes definition __type_params__8747776
Ref: 25948747776
Node: 整数と文字列の変換での長さ制限8748034
Ref: library/stdtypes int-max-str-digits8748152
Ref: 80b8748152
Ref: library/stdtypes integer-string-conversion-length-limitation8748152
Ref: 26d88748152
Ref: 整数と文字列の変換での長さ制限-Footnote-18751255
Node: 影響のあるAPI8751311
Ref: library/stdtypes affected-apis8751444
Ref: 26d98751444
Node: 上限値を設定する8752469
Ref: library/stdtypes configuring-the-limit8752623
Ref: 26da8752623
Node: 推奨設定8755768
Ref: library/stdtypes recommended-configuration8755895
Ref: 26dd8755895
Node: 組み込み例外8757035
Ref: library/exceptions doc8757181
Ref: 26de8757181
Ref: library/exceptions bltin-exceptions8757181
Ref: 1c278757181
Ref: library/exceptions built-in-exceptions8757181
Ref: 26df8757181
Ref: library/exceptions translation-repo8757181
Ref: 26e08757181
Node: 例外コンテキスト8759341
Ref: library/exceptions exception-context8759465
Ref: 26e18759465
Ref: library/exceptions BaseException __context__8759636
Ref: 14df8759636
Ref: library/exceptions BaseException __cause__8759677
Ref: 14e08759677
Ref: library/exceptions BaseException __suppress_context__8759716
Ref: 25148759716
Node: 組み込み例外から継承する8761623
Ref: library/exceptions inheriting-from-built-in-exceptions8761771
Ref: 26e28761771
Ref: 組み込み例外から継承する-Footnote-18762633
Node: 基底クラス8762706
Ref: library/exceptions base-classes8762842
Ref: 26e38762842
Ref: library/exceptions BaseException8762968
Ref: 7d68762968
Ref: library/exceptions BaseException args8763416
Ref: 78d8763416
Ref: library/exceptions BaseException with_traceback8763844
Ref: 25138763844
Ref: library/exceptions BaseException __traceback__8764750
Ref: 14de8764750
Ref: library/exceptions BaseException add_note8764942
Ref: 7d78764942
Ref: library/exceptions BaseException __notes__8765294
Ref: 26e48765294
Ref: library/exceptions Exception8765534
Ref: bcd8765534
Ref: library/exceptions ArithmeticError8765756
Ref: 26e58765756
Ref: library/exceptions BufferError8765993
Ref: 17978765993
Ref: library/exceptions LookupError8766128
Ref: 23e58766128
Ref: 基底クラス-Footnote-18766502
Node: 具象例外8766544
Ref: library/exceptions concrete-exceptions8766650
Ref: 26e78766650
Ref: library/exceptions AssertionError8766744
Ref: 8b88766744
Ref: library/exceptions AttributeError8766846
Ref: 5f08766846
Ref: library/exceptions AttributeError name8767251
Ref: 26e88767251
Ref: library/exceptions AttributeError obj8767349
Ref: 26e98767349
Ref: library/exceptions EOFError8767562
Ref: 14f18767562
Ref: library/exceptions FloatingPointError8767837
Ref: 26e68767837
Ref: library/exceptions GeneratorExit8767912
Ref: 15e18767912
Ref: library/exceptions ImportError8768335
Ref: 65b8768335
Ref: library/exceptions ImportError name8768754
Ref: 26ea8768754
Ref: library/exceptions ImportError path8768846
Ref: 26eb8768846
Ref: library/exceptions ModuleNotFoundError8769058
Ref: d3d8769058
Ref: library/exceptions IndexError8769374
Ref: 174e8769374
Ref: library/exceptions KeyError8769694
Ref: 5e78769694
Ref: library/exceptions KeyboardInterrupt8769853
Ref: bc58769853
Ref: library/exceptions MemoryError8770784
Ref: 179e8770784
Ref: library/exceptions NameError8771521
Ref: 4528771521
Ref: library/exceptions NameError name8771948
Ref: 26ed8771948
Ref: library/exceptions NotImplementedError8772135
Ref: 36b8772135
Ref: library/exceptions OSError8773198
Ref: 2c08773198
Ref: library/exceptions OSError errno8774417
Ref: 17b38774417
Ref: library/exceptions OSError winerror8774525
Ref: 26ef8774525
Ref: library/exceptions OSError strerror8775148
Ref: 26f08775148
Ref: library/exceptions OSError filename8775384
Ref: 26f18775384
Ref: library/exceptions OSError filename28775413
Ref: 26f28775413
Ref: library/exceptions OverflowError8776533
Ref: a818776533
Ref: library/exceptions PythonFinalizationError8777114
Ref: 47a8777114
Ref: library/exceptions RecursionError8777899
Ref: f688777899
Ref: library/exceptions ReferenceError8778265
Ref: 17268778265
Ref: library/exceptions RuntimeError8778669
Ref: 2448778669
Ref: library/exceptions StopIteration8778888
Ref: df58778888
Ref: library/exceptions StopIteration value8779165
Ref: 24178779165
Ref: library/exceptions StopAsyncIteration8780573
Ref: 1e0f8780573
Ref: library/exceptions SyntaxError8780841
Ref: 18e8780841
Ref: library/exceptions SyntaxError filename8781414
Ref: 26f38781414
Ref: library/exceptions SyntaxError lineno8781510
Ref: 26f48781510
Ref: library/exceptions SyntaxError offset8781703
Ref: 26f58781703
Ref: library/exceptions SyntaxError text8781881
Ref: 26f68781881
Ref: library/exceptions SyntaxError end_lineno8781973
Ref: 26f78781973
Ref: library/exceptions SyntaxError end_offset8782179
Ref: 26f88782179
Ref: library/exceptions IndentationError8782807
Ref: 17508782807
Ref: library/exceptions TabError8782994
Ref: 7658782994
Ref: library/exceptions SystemError8783207
Ref: 7958783207
Ref: library/exceptions SystemExit8784104
Ref: f3c8784104
Ref: library/exceptions SystemExit code8785471
Ref: 26fa8785471
Ref: library/exceptions TypeError8785641
Ref: 1988785641
Ref: library/exceptions UnboundLocalError8786684
Ref: 174f8786684
Ref: library/exceptions UnicodeError8786951
Ref: 4628786951
Ref: library/exceptions UnicodeError encoding8787436
Ref: 26fb8787436
Ref: library/exceptions UnicodeError reason8787544
Ref: 26fc8787544
Ref: library/exceptions UnicodeError object8787647
Ref: 18fc8787647
Ref: library/exceptions UnicodeError start8787797
Ref: 18c08787797
Ref: library/exceptions UnicodeError end8788068
Ref: 18c18788068
Ref: library/exceptions UnicodeEncodeError8788343
Ref: 8878788343
Ref: library/exceptions UnicodeDecodeError8788529
Ref: c088788529
Ref: library/exceptions UnicodeTranslateError8788712
Ref: 18fd8788712
Ref: library/exceptions ValueError8788892
Ref: 2ec8788892
Ref: library/exceptions ZeroDivisionError8789152
Ref: b3f8789152
Ref: library/exceptions EnvironmentError8789562
Ref: 125f8789562
Ref: library/exceptions IOError8789592
Ref: 125e8789592
Ref: library/exceptions WindowsError8789613
Ref: 12608789613
Ref: 具象例外-Footnote-18789744
Ref: 具象例外-Footnote-28789786
Node: OS 例外8789828
Ref: library/exceptions os-exceptions8789886
Ref: 26ee8789886
Ref: library/exceptions BlockingIOError8790053
Ref: 2358790053
Ref: library/exceptions BlockingIOError characters_written8790535
Ref: 27018790535
Ref: library/exceptions ChildProcessError8790787
Ref: 12638790787
Ref: library/exceptions ConnectionError8790952
Ref: 100b8790952
Ref: library/exceptions BrokenPipeError8791222
Ref: 12678791222
Ref: library/exceptions ConnectionAbortedError8791612
Ref: 12688791612
Ref: library/exceptions ConnectionRefusedError8791863
Ref: 12698791863
Ref: library/exceptions ConnectionResetError8792114
Ref: 126a8792114
Ref: library/exceptions FileExistsError8792359
Ref: 12218792359
Ref: library/exceptions FileNotFoundError8792565
Ref: 2648792565
Ref: library/exceptions InterruptedError8792758
Ref: f888792758
Ref: library/exceptions IsADirectoryError8793304
Ref: 12648793304
Ref: library/exceptions NotADirectoryError8793532
Ref: 12658793532
Ref: library/exceptions PermissionError8793990
Ref: f3e8793990
Ref: library/exceptions ProcessLookupError8794416
Ref: 12668794416
Ref: library/exceptions TimeoutError8794587
Ref: a368794587
Ref: OS 例外-Footnote-18794995
Ref: OS 例外-Footnote-28795037
Node: 警告8795079
Ref: library/exceptions warning-categories-as-exceptions8795188
Ref: 270f8795188
Ref: library/exceptions warnings8795188
Ref: 27108795188
Ref: library/exceptions Warning8795380
Ref: 27128795380
Ref: library/exceptions UserWarning8795453
Ref: 27138795453
Ref: library/exceptions DeprecationWarning8795563
Ref: 1a38795563
Ref: library/exceptions PendingDeprecationWarning8796041
Ref: ac58796041
Ref: library/exceptions SyntaxWarning8796746
Ref: 1ae8796746
Ref: library/exceptions RuntimeWarning8796991
Ref: 4d78796991
Ref: library/exceptions FutureWarning8797107
Ref: 6598797107
Ref: library/exceptions ImportWarning8797328
Ref: 71e8797328
Ref: library/exceptions UnicodeWarning8797650
Ref: 163d8797650
Ref: library/exceptions EncodingWarning8797741
Ref: 212e8797741
Ref: library/exceptions BytesWarning8797961
Ref: e1c8797961
Ref: library/exceptions ResourceWarning8798092
Ref: 54c8798092
Ref: 警告-Footnote-18798438
Ref: 警告-Footnote-28798480
Ref: 警告-Footnote-38798522
Node: 例外グループ8798564
Ref: library/exceptions exception-groups8798685
Ref: 27148798685
Ref: library/exceptions lib-exception-groups8798685
Ref: 27158798685
Ref: library/exceptions ExceptionGroup8799123
Ref: 4d28799123
Ref: library/exceptions BaseExceptionGroup8799163
Ref: 5668799163
Ref: library/exceptions BaseExceptionGroup message8800296
Ref: 27168800296
Ref: library/exceptions BaseExceptionGroup exceptions8800423
Ref: 27178800423
Ref: library/exceptions BaseExceptionGroup subgroup8800619
Ref: 1a388800619
Ref: library/exceptions BaseExceptionGroup split8801980
Ref: 18d88801980
Ref: library/exceptions BaseExceptionGroup derive8802248
Ref: 1a378802248
Node: 例外のクラス階層8805382
Ref: library/exceptions exception-hierarchy8805488
Ref: 27188805488
Ref: library/text stringservices8808384
Ref: 26508808384
Node: テキスト処理サービス8808384
Ref: library/text doc8808542
Ref: 27198808542
Ref: library/text text-processing-services8808542
Ref: 271a8808542
Ref: library/text textservices8808542
Ref: 26528808542
Ref: library/text translation-repo8808542
Ref: 271b8808542
Node: string --- 一般的な文字列操作8809933
Ref: library/string doc8810124
Ref: 271d8810124
Ref: library/string module-string8810124
Ref: d88810124
Ref: library/string string-common-string-operations8810124
Ref: 271e8810124
Ref: string --- 一般的な文字列操作-Footnote-18810645
Node: 文字列定数8810721
Ref: library/string string-constants8810853
Ref: 271f8810853
Ref: library/string string ascii_letters8810975
Ref: 14db8810975
Ref: library/string string ascii_lowercase8811168
Ref: 27208811168
Ref: library/string string ascii_uppercase8811325
Ref: 27218811325
Ref: library/string string digits8811482
Ref: 27228811482
Ref: library/string string hexdigits8811557
Ref: 27238811557
Ref: library/string string octdigits8811647
Ref: 27248811647
Ref: library/string string punctuation8811723
Ref: 27258811723
Ref: library/string string printable8811940
Ref: 18b78811940
Ref: library/string string whitespace8812408
Ref: 27268812408
Ref: 文字列定数-Footnote-18812766
Node: カスタムの文字列書式化8812812
Ref: library/string custom-string-formatting8812983
Ref: 27278812983
Ref: library/string string-formatting8812983
Ref: 264f8812983
Ref: library/string string Formatter8813433
Ref: 10bd8813433
Ref: library/string string Formatter format8813548
Ref: dfa8813548
Ref: library/string string Formatter vformat8813993
Ref: 27288813993
Ref: library/string string Formatter parse8814908
Ref: 27298814908
Ref: library/string string Formatter get_field8815877
Ref: 272a8815877
Ref: library/string string Formatter get_value8816524
Ref: 272b8816524
Ref: library/string string Formatter check_unused_args8818018
Ref: 272c8818018
Ref: library/string string Formatter format_field8818711
Ref: 272d8818711
Ref: library/string string Formatter convert_field8819023
Ref: 272e8819023
Ref: カスタムの文字列書式化-Footnote-18819433
Ref: カスタムの文字列書式化-Footnote-28819475
Node: 書式指定文字列の文法8819517
Ref: library/string format-string-syntax8819699
Ref: 272f8819699
Ref: library/string formatstrings8819699
Ref: 15b38819699
Ref: library/string grammar-token-format-string-replacement_field8820663
Ref: 27308820663
Ref: library/string grammar-token-format-string-field_name8820782
Ref: 27318820782
Ref: library/string grammar-token-format-string-arg_name8820900
Ref: 27348820900
Ref: library/string grammar-token-format-string-attribute_name8820972
Ref: 27358820972
Ref: library/string grammar-token-format-string-element_index8821020
Ref: 27368821020
Ref: library/string grammar-token-format-string-index_string8821092
Ref: 27378821092
Ref: library/string grammar-token-format-string-conversion8821152
Ref: 27328821152
Ref: library/string grammar-token-format-string-format_spec8821192
Ref: 27338821192
Ref: library/string formatstrings-conversion8823973
Ref: 27398823973
Node: 書式指定ミニ言語仕様8826035
Ref: library/string format-specification-mini-language8826156
Ref: 273b8826156
Ref: library/string formatspec8826156
Ref: 4f98826156
Ref: library/string grammar-token-format-spec-format_spec8827152
Ref: 27388827152
Ref: library/string grammar-token-format-spec-options8827258
Ref: 273c8827258
Ref: library/string grammar-token-format-spec-fill8827362
Ref: 273f8827362
Ref: library/string grammar-token-format-spec-align8827408
Ref: 27408827408
Ref: library/string grammar-token-format-spec-sign8827460
Ref: 27418827460
Ref: library/string grammar-token-format-spec-width_and_precision8827506
Ref: 273d8827506
Ref: library/string grammar-token-format-spec-width_with_grouping8827609
Ref: 27428827609
Ref: library/string grammar-token-format-spec-precision_with_grouping8827683
Ref: 27438827683
Ref: library/string grammar-token-format-spec-width8827793
Ref: 27448827793
Ref: library/string grammar-token-format-spec-precision8827843
Ref: 27468827843
Ref: library/string grammar-token-format-spec-grouping8827893
Ref: 27458827893
Ref: library/string grammar-token-format-spec-type8827933
Ref: 273e8827933
Ref: 書式指定ミニ言語仕様-Footnote-18844116
Ref: 書式指定ミニ言語仕様-Footnote-28844158
Ref: 書式指定ミニ言語仕様-Footnote-38844200
Node: 書式指定例8844242
Ref: library/string format-examples8844363
Ref: 27488844363
Ref: library/string formatexamples8844363
Ref: 273a8844363
Node: Template strings $-strings8849415
Ref: library/string template-strings-pep2928849582
Ref: 27498849582
Ref: library/string template-strings-strings8849582
Ref: 274a8849582
Ref: library/string string Template8852145
Ref: 8978852145
Ref: library/string string Template substitute8852291
Ref: 20d58852291
Ref: library/string string Template safe_substitute8852964
Ref: 20d68852964
Ref: library/string string Template is_valid8854203
Ref: 8968854203
Ref: library/string string Template get_identifiers8854439
Ref: 8958854439
Ref: library/string string Template template8854819
Ref: 274c8854819
Ref: Template strings $-strings-Footnote-18859943
Ref: Template strings $-strings-Footnote-28859985
Node: ヘルパー関数8860037
Ref: library/string helper-functions8860165
Ref: 274d8860165
Ref: library/string string capwords8860214
Ref: 26568860214
Node: string templatelib --- テンプレート文字列リテラルのサポート8860843
Ref: library/string templatelib doc8861068
Ref: 274e8861068
Ref: library/string templatelib module-string templatelib8861068
Ref: d98861068
Ref: library/string templatelib string-templatelib-support-for-template-string-literals8861068
Ref: 274f8861068
Ref: library/string templatelib translation-repo8861068
Ref: 27508861068
Ref: string templatelib --- テンプレート文字列リテラルのサポート-Footnote-18861648
Ref: string templatelib --- テンプレート文字列リテラルのサポート-Footnote-28861727
Node: テンプレート文字列8861769
Ref: library/string templatelib id18861922
Ref: 27518861922
Ref: library/string templatelib template-strings8861922
Ref: 274b8861922
Node: 型8862633
Ref: library/string templatelib types8862816
Ref: 27528862816
Ref: library/string templatelib string templatelib Template8862840
Ref: 16a8862840
Ref: library/string templatelib string templatelib Template strings8864343
Ref: 27538864343
Ref: library/string templatelib string templatelib Template interpolations8865307
Ref: 27548865307
Ref: library/string templatelib string templatelib Template values8865887
Ref: 27558865887
Ref: library/string templatelib string templatelib Template __new__8866417
Ref: 27568866417
Ref: library/string templatelib string templatelib Interpolation8870250
Ref: 16b8870250
Ref: library/string templatelib string templatelib Interpolation value8871096
Ref: 27578871096
Ref: library/string templatelib string templatelib Interpolation expression8871268
Ref: 27588871268
Ref: library/string templatelib string templatelib Interpolation conversion8872119
Ref: 265c8872119
Ref: library/string templatelib string templatelib Interpolation format_spec8872884
Ref: 275a8872884
Ref: library/string templatelib string templatelib Interpolation __new__8873801
Ref: 275b8873801
Node: ヘルパー関数<2>8874571
Ref: library/string templatelib helper-functions8874718
Ref: 275c8874718
Ref: library/string templatelib string templatelib convert8874767
Ref: 27598874767
Node: re --- 正規表現操作8875365
Ref: library/re doc8875588
Ref: 275d8875588
Ref: library/re module-re8875588
Ref: be8875588
Ref: library/re re-regular-expression-operations8875588
Ref: 275e8875588
Ref: library/re translation-repo8875588
Ref: 275f8875588
Ref: re --- 正規表現操作-Footnote-18878707
Ref: re --- 正規表現操作-Footnote-28878767
Node: 正規表現のシンタックス8878807
Ref: library/re re-syntax8878941
Ref: 92e8878941
Ref: library/re regular-expression-syntax8878941
Ref: 27608878941
Ref: library/re re-conditional-expression8903582
Ref: 1b288903582
Ref: library/re re-special-sequences8904453
Ref: 276d8904453
Ref: 正規表現のシンタックス-Footnote-18911963
Ref: 正規表現のシンタックス-Footnote-28912005
Node: モジュールコンテンツ8912077
Ref: library/re contents-of-module-re8912250
Ref: 276c8912250
Ref: library/re module-contents8912250
Ref: 276e8912250
Node: フラグ8912741
Ref: library/re flags8912835
Ref: 276f8912835
Ref: library/re re RegexFlag8913041
Ref: 83f8913041
Ref: library/re re A8913212
Ref: 27658913212
Ref: library/re re ASCII8913232
Ref: 83e8913232
Ref: library/re re DEBUG8913967
Ref: 27708913967
Ref: library/re re I8914141
Ref: 27668914141
Ref: library/re re IGNORECASE8914161
Ref: 1a968914161
Ref: library/re re L8915233
Ref: 27678915233
Ref: library/re re LOCALE8915253
Ref: d638915253
Ref: library/re re M8916348
Ref: 27688916348
Ref: library/re re MULTILINE8916368
Ref: 27648916368
Ref: library/re re NOFLAG8916969
Ref: 27718916969
Ref: library/re re S8917365
Ref: 27698917365
Ref: library/re re DOTALL8917385
Ref: 27638917385
Ref: library/re re U8917706
Ref: 276a8917706
Ref: library/re re UNICODE8917726
Ref: d648917726
Ref: library/re re X8918027
Ref: 276b8918027
Ref: library/re re VERBOSE8918047
Ref: 27728918047
Node: 関数<2>8919290
Ref: library/re functions8919402
Ref: 27738919402
Ref: library/re re compile8919431
Ref: dce8919431
Ref: library/re re search8920710
Ref: 14448920710
Ref: library/re re match8921395
Ref: 14458921395
Ref: library/re re fullmatch8922417
Ref: 11878922417
Ref: library/re re split8922991
Ref: 5a28922991
Ref: library/re re findall8925488
Ref: 122b8925488
Ref: library/re re finditer8926757
Ref: 17138926757
Ref: library/re re sub8927491
Ref: 5a38927491
Ref: library/re re subn8931782
Ref: 5a48931782
Ref: library/re re escape8932180
Ref: e038932180
Ref: library/re re purge8933807
Ref: 27778933807
Node: 例外<3>8933893
Ref: library/re exceptions8933987
Ref: 27788933987
Ref: library/re re PatternError8934016
Ref: 5468934016
Ref: library/re re PatternError msg8934466
Ref: 104b8934466
Ref: library/re re PatternError pattern8934572
Ref: 104c8934572
Ref: library/re re PatternError pos8934649
Ref: 104d8934649
Ref: library/re re PatternError lineno8934813
Ref: 104e8934813
Ref: library/re re PatternError colno8934924
Ref: 104f8934924
Node: 正規表現オブジェクト8935269
Ref: library/re re-objects8935436
Ref: 11898935436
Ref: library/re regular-expression-objects8935436
Ref: 27798935436
Ref: library/re re Pattern8935505
Ref: 1b678935505
Ref: library/re re Pattern search8935804
Ref: 27758935804
Ref: library/re re Pattern match8937534
Ref: 27748937534
Ref: library/re re Pattern fullmatch8938538
Ref: 11888938538
Ref: library/re re Pattern split8939410
Ref: 277a8939410
Ref: library/re re Pattern findall8939575
Ref: 277b8939575
Ref: library/re re Pattern finditer8939885
Ref: 277c8939885
Ref: library/re re Pattern sub8940197
Ref: 277d8940197
Ref: library/re re Pattern subn8940361
Ref: 277e8940361
Ref: library/re re Pattern flags8940527
Ref: 277f8940527
Ref: library/re re Pattern groups8940886
Ref: 27808940886
Ref: library/re re Pattern groupindex8940984
Ref: 27818940984
Ref: library/re re Pattern pattern8941281
Ref: 27828941281
Node: マッチオブジェクト8941659
Ref: library/re id38941814
Ref: 27838941814
Ref: library/re match-objects8941814
Ref: 118a8941814
Ref: library/re re Match8942212
Ref: ec38942212
Ref: library/re re Match expand8942497
Ref: 27848942497
Ref: library/re re Match group8943137
Ref: 122c8943137
Ref: library/re re Match __getitem__8945619
Ref: 27858945619
Ref: library/re re Match groups8946350
Ref: 122d8946350
Ref: library/re re Match groupdict8947314
Ref: 27868947314
Ref: library/re re Match start8947837
Ref: 27878947837
Ref: library/re re Match end8947877
Ref: 27888947877
Ref: library/re re Match span8949176
Ref: 27898949176
Ref: library/re re Match pos8949479
Ref: 278a8949479
Ref: library/re re Match endpos8949766
Ref: 278b8949766
Ref: library/re re Match lastindex8950050
Ref: 278c8950050
Ref: library/re re Match lastgroup8950500
Ref: 278d8950500
Ref: library/re re Match re8950734
Ref: 278e8950734
Ref: library/re re Match string8950959
Ref: 278f8950959
Node: 正規表現の例8951303
Ref: library/re re-examples8951419
Ref: 14758951419
Ref: library/re regular-expression-examples8951419
Ref: 27908951419
Node: ペアの確認8951803
Ref: library/re checking-for-a-pair8951915
Ref: 27918951915
Node: scanf をシミュレートする8954191
Ref: library/re simulating-scanf8954327
Ref: 27928954327
Node: search vs match8956513
Ref: library/re id48956652
Ref: 27938956652
Ref: library/re search-vs-match8956652
Ref: 27768956652
Node: 電話帳を作る8958129
Ref: library/re making-a-phonebook8958256
Ref: 27948958256
Node: テキストの秘匿8960710
Ref: library/re text-munging8960852
Ref: 27958960852
Node: 全ての副詞を見つける8961777
Ref: library/re finding-all-adverbs8961946
Ref: 27968961946
Node: 全ての副詞とその位置を見つける8962481
Ref: library/re finding-all-adverbs-and-their-positions8962648
Ref: 27978962648
Node: Raw 文字列記法8963374
Ref: library/re raw-string-notation8963538
Ref: 27988963538
Node: トークナイザを書く8964598
Ref: library/re writing-a-tokenizer8964708
Ref: 27998964708
Ref: library/re frie098968195
Ref: 27618968195
Ref: トークナイザを書く-Footnote-18968511
Node: difflib --- 差分の計算の補助8968566
Ref: library/difflib doc8968767
Ref: 279a8968767
Ref: library/difflib difflib-helpers-for-computing-deltas8968767
Ref: 279b8968767
Ref: library/difflib module-difflib8968767
Ref: 3b8968767
Ref: library/difflib translation-repo8968767
Ref: 279c8968767
Ref: library/difflib difflib Differ8971972
Ref: 279d8971972
Ref: library/difflib difflib HtmlDiff8973298
Ref: 2018973298
Ref: library/difflib difflib HtmlDiff __init__8973821
Ref: 279e8973821
Ref: library/difflib difflib HtmlDiff make_file8974879
Ref: ff08974879
Ref: library/difflib difflib HtmlDiff make_table8977025
Ref: 27a08977025
Ref: library/difflib difflib context_diff8977512
Ref: 19868977512
Ref: library/difflib difflib get_close_matches8979884
Ref: 27a38979884
Ref: library/difflib difflib ndiff8981245
Ref: 279f8981245
Ref: library/difflib difflib restore8983003
Ref: 27a58983003
Ref: library/difflib difflib unified_diff8983877
Ref: 19858983877
Ref: library/difflib difflib diff_bytes8986083
Ref: ff18986083
Ref: library/difflib difflib IS_LINE_JUNK8987343
Ref: 2d78987343
Ref: library/difflib difflib IS_CHARACTER_JUNK8987719
Ref: 27a48987719
Ref: difflib --- 差分の計算の補助-Footnote-18988507
Ref: difflib --- 差分の計算の補助-Footnote-28988574
Node: SequenceMatcherオブジェクト8988654
Ref: library/difflib sequence-matcher8988791
Ref: 27a78988791
Ref: library/difflib sequencematcher-objects8988791
Ref: 27a88988791
Ref: library/difflib difflib SequenceMatcher8988975
Ref: 121b8988975
Ref: library/difflib difflib SequenceMatcher set_seqs8991016
Ref: 27a98991016
Ref: library/difflib difflib SequenceMatcher set_seq18991569
Ref: 27ab8991569
Ref: library/difflib difflib SequenceMatcher set_seq28991757
Ref: 27aa8991757
Ref: library/difflib difflib SequenceMatcher find_longest_match8991945
Ref: 1d4b8991945
Ref: library/difflib difflib SequenceMatcher get_matching_blocks8994484
Ref: 27ac8994484
Ref: library/difflib difflib SequenceMatcher get_opcodes8995573
Ref: 27ad8995573
Ref: library/difflib difflib SequenceMatcher get_grouped_opcodes8997684
Ref: 27ae8997684
Ref: library/difflib difflib SequenceMatcher ratio8998226
Ref: 27af8998226
Ref: library/difflib difflib SequenceMatcher quick_ratio8999497
Ref: 27b08999497
Ref: library/difflib difflib SequenceMatcher real_quick_ratio8999617
Ref: 27b18999617
Node: SequenceMatcher の例9000168
Ref: library/difflib id19000339
Ref: 27b29000339
Ref: library/difflib sequencematcher-examples9000339
Ref: 27b39000339
Ref: SequenceMatcher の例-Footnote-19002106
Node: Differ オブジェクト9002183
Ref: library/difflib differ-objects9002334
Ref: 27b49002334
Ref: library/difflib id29002334
Ref: 27b59002334
Ref: library/difflib difflib Differ compare9004309
Ref: 27a69004309
Node: Differ の例9005082
Ref: library/difflib differ-example9005267
Ref: 27b69005267
Ref: library/difflib differ-examples9005267
Ref: 27b79005267
Node: difflib のコマンドラインインターフェース9007698
Ref: library/difflib a-command-line-interface-to-difflib9007871
Ref: 27b89007871
Ref: library/difflib difflib-interface9007871
Ref: 27a29007871
Node: ndiff example9010536
Ref: library/difflib ndiff-example9010687
Ref: 27b99010687
Node: textwrap --- テキストの折り返しと詰め込み9014337
Ref: library/textwrap doc9014555
Ref: 27ba9014555
Ref: library/textwrap module-textwrap9014555
Ref: f29014555
Ref: library/textwrap textwrap-text-wrapping-and-filling9014555
Ref: 27bb9014555
Ref: library/textwrap translation-repo9014555
Ref: 27bc9014555
Ref: library/textwrap textwrap wrap9015108
Ref: 16e09015108
Ref: library/textwrap textwrap fill9015982
Ref: 16df9015982
Ref: library/textwrap textwrap shorten9016691
Ref: 11d29016691
Ref: library/textwrap textwrap dedent9018161
Ref: 1a99018161
Ref: library/textwrap textwrap indent9019555
Ref: 57d9019555
Ref: library/textwrap textwrap TextWrapper9021204
Ref: 11cf9021204
Ref: library/textwrap textwrap TextWrapper width9022046
Ref: 27c39022046
Ref: library/textwrap textwrap TextWrapper expand_tabs9022381
Ref: 27bf9022381
Ref: library/textwrap textwrap TextWrapper tabsize9022647
Ref: 27be9022647
Ref: library/textwrap textwrap TextWrapper replace_whitespace9022949
Ref: 27c19022949
Ref: library/textwrap textwrap TextWrapper drop_whitespace9023954
Ref: 27c09023954
Ref: library/textwrap textwrap TextWrapper initial_indent9024418
Ref: 27c49024418
Ref: library/textwrap textwrap TextWrapper subsequent_indent9024672
Ref: 27c59024672
Ref: library/textwrap textwrap TextWrapper fix_sentence_endings9024965
Ref: 27c69024965
Ref: library/textwrap textwrap TextWrapper break_long_words9026333
Ref: 27c29026333
Ref: library/textwrap textwrap TextWrapper break_on_hyphens9026896
Ref: 27c79026896
Ref: library/textwrap textwrap TextWrapper max_lines9027570
Ref: 11d09027570
Ref: library/textwrap textwrap TextWrapper placeholder9027872
Ref: 11d19027872
Ref: library/textwrap textwrap TextWrapper wrap9028214
Ref: 27bd9028214
Ref: library/textwrap textwrap TextWrapper fill9028681
Ref: 27c89028681
Ref: textwrap --- テキストの折り返しと詰め込み-Footnote-19028912
Node: unicodedata --- Unicode データベース9028980
Ref: library/unicodedata doc9029216
Ref: 27c99029216
Ref: library/unicodedata module-unicodedata9029216
Ref: 10b9029216
Ref: library/unicodedata translation-repo9029216
Ref: 27ca9029216
Ref: library/unicodedata unicodedata-unicode-database9029216
Ref: 27cb9029216
Ref: library/unicodedata unicodedata lookup9029965
Ref: 12849029965
Ref: library/unicodedata unicodedata name9030618
Ref: 27cc9030618
Ref: library/unicodedata unicodedata decimal9031014
Ref: 27cd9031014
Ref: library/unicodedata unicodedata digit9031431
Ref: 27ce9031431
Ref: library/unicodedata unicodedata numeric9031745
Ref: 147a9031745
Ref: library/unicodedata unicodedata category9032047
Ref: 27cf9032047
Ref: library/unicodedata unicodedata bidirectional9032448
Ref: 27d09032448
Ref: library/unicodedata unicodedata combining9032908
Ref: 27d19032908
Ref: library/unicodedata unicodedata east_asian_width9033214
Ref: 27d29033214
Ref: library/unicodedata unicodedata mirrored9033439
Ref: 27d39033439
Ref: library/unicodedata unicodedata decomposition9033766
Ref: 27d49033766
Ref: library/unicodedata unicodedata normalize9034065
Ref: 8e49034065
Ref: library/unicodedata unicodedata is_normalized9036073
Ref: c3c9036073
Ref: library/unicodedata unicodedata unidata_version9036383
Ref: 27d59036383
Ref: library/unicodedata unicodedata ucd_3_2_09036524
Ref: 164d9036524
Ref: unicodedata --- Unicode データベース-Footnote-19036946
Ref: unicodedata --- Unicode データベース-Footnote-29036996
Ref: unicodedata --- Unicode データベース-Footnote-39037042
Ref: unicodedata --- Unicode データベース-Footnote-49037114
Ref: unicodedata --- Unicode データベース-Footnote-59037189
Ref: unicodedata --- Unicode データベース-Footnote-69037272
Ref: unicodedata --- Unicode データベース-Footnote-79037349
Ref: unicodedata --- Unicode データベース-Footnote-89037441
Node: stringprep --- インターネットの文字列調製9037499
Ref: library/stringprep doc9037733
Ref: 27d69037733
Ref: library/stringprep module-stringprep9037733
Ref: da9037733
Ref: library/stringprep stringprep-internet-string-preparation9037733
Ref: 27d79037733
Ref: library/stringprep translation-repo9037733
Ref: 27d89037733
Ref: library/stringprep stringprep in_table_a19040021
Ref: 27d99040021
Ref: library/stringprep stringprep in_table_b19040223
Ref: 27da9040223
Ref: library/stringprep stringprep map_table_b29040420
Ref: 27db9040420
Ref: library/stringprep stringprep map_table_b39040616
Ref: 27dc9040616
Ref: library/stringprep stringprep in_table_c119040813
Ref: 27dd9040813
Ref: library/stringprep stringprep in_table_c129040953
Ref: 27de9040953
Ref: library/stringprep stringprep in_table_c11_c129041103
Ref: 27df9041103
Ref: library/stringprep stringprep in_table_c219041282
Ref: 27e09041282
Ref: library/stringprep stringprep in_table_c229041416
Ref: 27e19041416
Ref: library/stringprep stringprep in_table_c21_c229041554
Ref: 27e29041554
Ref: library/stringprep stringprep in_table_c39041727
Ref: 27e39041727
Ref: library/stringprep stringprep in_table_c49041864
Ref: 27e49041864
Ref: library/stringprep stringprep in_table_c59042039
Ref: 27e59042039
Ref: library/stringprep stringprep in_table_c69042182
Ref: 27e69042182
Ref: library/stringprep stringprep in_table_c79042337
Ref: 27e79042337
Ref: library/stringprep stringprep in_table_c89042512
Ref: 27e89042512
Ref: library/stringprep stringprep in_table_c99042676
Ref: 27e99042676
Ref: library/stringprep stringprep in_table_d19042801
Ref: 27ea9042801
Ref: library/stringprep stringprep in_table_d29042978
Ref: 27eb9042978
Ref: stringprep --- インターネットの文字列調製-Footnote-19043177
Ref: stringprep --- インターネットの文字列調製-Footnote-29043247
Ref: stringprep --- インターネットの文字列調製-Footnote-39043306
Node: readline --- GNU readline のインターフェース9043365
Ref: library/readline doc9043601
Ref: 27ec9043601
Ref: library/readline module-readline9043601
Ref: bf9043601
Ref: library/readline readline-gnu-readline-interface9043601
Ref: 27ed9043601
Ref: library/readline translation-repo9043601
Ref: 27ee9043601
Ref: library/readline readline backend9046165
Ref: 1a279046165
Ref: readline --- GNU readline のインターフェース-Footnote-19046532
Node: 初期化ファイル9046617
Ref: library/readline init-file9046752
Ref: 27ef9046752
Ref: library/readline readline parse_and_bind9046896
Ref: 27f09046896
Ref: library/readline readline read_init_file9047078
Ref: 17da9047078
Node: 行バッファ9047552
Ref: library/readline line-buffer9047714
Ref: 27f19047714
Ref: library/readline readline get_line_buffer9047812
Ref: 27f29047812
Ref: library/readline readline insert_text9047964
Ref: 27f39047964
Ref: library/readline readline redisplay9048175
Ref: 16de9048175
Node: 履歴ファイル9048379
Ref: library/readline history-file9048535
Ref: 27f49048535
Ref: library/readline readline read_history_file9048641
Ref: 17db9048641
Ref: library/readline readline write_history_file9049067
Ref: 17dc9049067
Ref: library/readline readline append_history_file9049517
Ref: 10519049517
Ref: library/readline readline get_history_length9050115
Ref: 27f59050115
Ref: library/readline readline set_history_length9050161
Ref: 19269050161
Node: 履歴リスト9050525
Ref: library/readline history-list9050681
Ref: 27f69050681
Ref: library/readline readline clear_history9050797
Ref: 27f79050797
Ref: library/readline readline get_current_history_length9051046
Ref: 16dd9051046
Ref: library/readline readline get_history_item9051267
Ref: 16dc9051267
Ref: library/readline readline remove_history_item9051478
Ref: 27f89051478
Ref: library/readline readline replace_history_item9051699
Ref: 27f99051699
Ref: library/readline readline add_history9051931
Ref: 27fa9051931
Ref: library/readline readline set_auto_history9052116
Ref: ec59052116
Node: 開始フック9052574
Ref: library/readline startup-hooks9052718
Ref: 27fb9052718
Ref: library/readline readline set_startup_hook9052762
Ref: 27fc9052762
Ref: library/readline readline set_pre_input_hook9053167
Ref: 27fd9053167
Node: 補完9053740
Ref: library/readline completion9053881
Ref: 27fe9053881
Ref: library/readline readline-completion9053881
Ref: 27ff9053881
Ref: library/readline readline set_completer9054352
Ref: 28009054352
Ref: library/readline readline get_completer9055323
Ref: 28019055323
Ref: library/readline readline get_completion_type9055493
Ref: 28029055493
Ref: library/readline readline get_begidx9055694
Ref: 1ca49055694
Ref: library/readline readline get_endidx9055732
Ref: 1ca59055732
Ref: library/readline readline set_completer_delims9056178
Ref: 1a2a9056178
Ref: library/readline readline get_completer_delims9056232
Ref: 28039056232
Ref: library/readline readline set_completion_display_matches_hook9056554
Ref: 28049056554
Node: 使用例<2>9057144
Ref: library/readline example9057261
Ref: 28059057261
Ref: library/readline readline-example9057261
Ref: 28069057261
Node: rlcompleter --- GNU readline の補完機能9060234
Ref: library/rlcompleter doc9060407
Ref: 28089060407
Ref: library/rlcompleter module-rlcompleter9060407
Ref: c29060407
Ref: library/rlcompleter rlcompleter-completion-function-for-gnu-readline9060407
Ref: 28099060407
Ref: library/rlcompleter translation-repo9060407
Ref: 280a9060407
Ref: library/rlcompleter completer-objects9061938
Ref: 280c9061938
Ref: library/rlcompleter rlcompleter Completer9061938
Ref: 1d2b9061938
Ref: library/rlcompleter rlcompleter Completer complete9062056
Ref: 280b9062056
Ref: rlcompleter --- GNU readline の補完機能-Footnote-19063127
Node: バイナリデータ処理9063198
Ref: library/binary doc9063350
Ref: 280d9063350
Ref: library/binary binary-data-services9063350
Ref: 280e9063350
Ref: library/binary binaryservices9063350
Ref: 271c9063350
Ref: library/binary translation-repo9063350
Ref: 280f9063350
Node: struct --- バイト列をパックされたバイナリデータとして解釈する9064494
Ref: library/struct doc9064703
Ref: 28109064703
Ref: library/struct struct-interpret-bytes-as-packed-binary-data9064703
Ref: 28119064703
Ref: library/struct module-struct9064871
Ref: db9064871
Ref: struct --- バイト列をパックされたバイナリデータとして解釈する-Footnote-19066704
Node: 関数と例外9066770
Ref: library/struct functions-and-exceptions9066932
Ref: 28149066932
Ref: library/struct struct error9067051
Ref: 153b9067051
Ref: library/struct struct pack9067201
Ref: 148e9067201
Ref: library/struct struct pack_into9067520
Ref: 28159067520
Ref: library/struct struct unpack9067850
Ref: 185a9067850
Ref: library/struct struct unpack_from9068328
Ref: 28169068328
Ref: library/struct struct iter_unpack9068823
Ref: 11c19068823
Ref: library/struct struct calcsize9069475
Ref: 1da99069475
Node: 書式文字列9069703
Ref: library/struct format-strings9069898
Ref: 28179069898
Ref: library/struct struct-format-strings9069898
Ref: 28129069898
Node: バイトオーダ、サイズ、アラインメント9070529
Ref: library/struct byte-order-size-and-alignment9070662
Ref: 28189070662
Ref: library/struct struct-alignment9070662
Ref: 28139070662
Ref: バイトオーダ、サイズ、アラインメント-Footnote-19075351
Node: 書式指定文字9075405
Ref: library/struct format-characters9075559
Ref: 124b9075559
Ref: library/struct id19075559
Ref: 281a9075559
Ref: 書式指定文字-Footnote-19089757
Ref: 書式指定文字-Footnote-29089818
Node: 使用例<3>9089894
Ref: library/struct examples9089985
Ref: 281b9089985
Ref: library/struct struct-examples9089985
Ref: 28199089985
Node: アプリケーション9092609
Ref: library/struct applications9092801
Ref: 281c9092801
Ref: library/struct id29092801
Ref: 281d9092801
Node: Native Formats9093313
Ref: library/struct native-formats9093413
Ref: 28209093413
Ref: library/struct struct-native-formats9093413
Ref: 281e9093413
Node: Standard Formats9094561
Ref: library/struct standard-formats9094661
Ref: 28219094661
Ref: library/struct struct-standard-formats9094661
Ref: 281f9094661
Node: クラス<3>9096100
Ref: library/struct classes9096268
Ref: 28229096268
Ref: library/struct struct-objects9096268
Ref: 28239096268
Ref: library/struct struct Struct9096360
Ref: 17789096360
Ref: library/struct struct Struct pack9097241
Ref: 28249097241
Ref: library/struct struct Struct pack_into9097501
Ref: 28269097501
Ref: library/struct struct Struct unpack9097709
Ref: 28279097709
Ref: library/struct struct Struct unpack_from9097989
Ref: 28289097989
Ref: library/struct struct Struct iter_unpack9098341
Ref: 11c29098341
Ref: library/struct struct Struct format9098664
Ref: e009098664
Ref: library/struct struct Struct size9098946
Ref: 28259098946
Node: codecs --- codec レジストリと基底クラス9099322
Ref: library/codecs doc9099531
Ref: 28299099531
Ref: library/codecs codecs-codec-registry-and-base-classes9099531
Ref: 282a9099531
Ref: library/codecs module-codecs9099531
Ref: 1c9099531
Ref: library/codecs translation-repo9099531
Ref: 282b9099531
Ref: library/codecs codecs encode9100728
Ref: 11049100728
Ref: library/codecs codecs decode9101440
Ref: 11059101440
Ref: library/codecs codecs charmap_build9102120
Ref: 282d9102120
Ref: library/codecs codecs lookup9102648
Ref: b5c9102648
Ref: library/codecs codecs CodecInfo9103345
Ref: 1a6c9103345
Ref: library/codecs codecs CodecInfo name9103677
Ref: 282e9103677
Ref: library/codecs codecs CodecInfo encode9103757
Ref: 282f9103757
Ref: library/codecs codecs CodecInfo decode9103784
Ref: 28309103784
Ref: library/codecs codecs CodecInfo incrementalencoder9104335
Ref: 28349104335
Ref: library/codecs codecs CodecInfo incrementaldecoder9104374
Ref: 28359104374
Ref: library/codecs codecs CodecInfo streamwriter9104875
Ref: 28389104875
Ref: library/codecs codecs CodecInfo streamreader9104908
Ref: 28399104908
Ref: library/codecs codecs getencoder9105590
Ref: 283c9105590
Ref: library/codecs codecs getdecoder9105871
Ref: 283d9105871
Ref: library/codecs codecs getincrementalencoder9106149
Ref: 283e9106149
Ref: library/codecs codecs getincrementaldecoder9106583
Ref: 283f9106583
Ref: library/codecs codecs getreader9107011
Ref: 28409107011
Ref: library/codecs codecs getwriter9107334
Ref: 28419107334
Ref: library/codecs codecs register9107795
Ref: 28429107795
Ref: library/codecs codecs unregister9108281
Ref: 9e99108281
Ref: library/codecs codecs open9108904
Ref: 3159108904
Ref: library/codecs codecs EncodedFile9110810
Ref: 28449110810
Ref: library/codecs codecs iterencode9111991
Ref: 28459111991
Ref: library/codecs codecs iterdecode9112689
Ref: 28469112689
Ref: library/codecs codecs readbuffer_encode9113464
Ref: 28479113464
Ref: library/codecs codecs BOM9114012
Ref: 28489114012
Ref: library/codecs codecs BOM_BE9114038
Ref: 28499114038
Ref: library/codecs codecs BOM_LE9114067
Ref: 284a9114067
Ref: library/codecs codecs BOM_UTF89114096
Ref: 284b9114096
Ref: library/codecs codecs BOM_UTF169114127
Ref: 284c9114127
Ref: library/codecs codecs BOM_UTF16_BE9114159
Ref: 284d9114159
Ref: library/codecs codecs BOM_UTF16_LE9114194
Ref: 284e9114194
Ref: library/codecs codecs BOM_UTF329114229
Ref: 284f9114229
Ref: library/codecs codecs BOM_UTF32_BE9114261
Ref: 28509114261
Ref: library/codecs codecs BOM_UTF32_LE9114296
Ref: 28519114296
Ref: codecs --- codec レジストリと基底クラス-Footnote-19115796
Node: Codec 基底クラス9115862
Ref: library/codecs codec-base-classes9116014
Ref: 282c9116014
Ref: library/codecs id19116014
Ref: 28529116014
Ref: library/codecs surrogateescape9116806
Ref: 28539116806
Node: エラーハンドラ9117014
Ref: library/codecs error-handlers9117153
Ref: 1b6f9117153
Ref: library/codecs id29117153
Ref: 28549117153
Ref: library/codecs codecs register_error9122454
Ref: 16b49122454
Ref: library/codecs codecs lookup_error9124350
Ref: 16b59124350
Ref: library/codecs codecs strict_errors9124689
Ref: 28559124689
Ref: library/codecs codecs ignore_errors9124862
Ref: 28569124862
Ref: library/codecs codecs replace_errors9125059
Ref: 18c29125059
Ref: library/codecs codecs backslashreplace_errors9125310
Ref: 18c39125310
Ref: library/codecs codecs xmlcharrefreplace_errors9125780
Ref: 18c49125780
Ref: library/codecs codecs namereplace_errors9126145
Ref: 28579126145
Ref: エラーハンドラ-Footnote-19126709
Node: ステートレスなエンコードとデコード9126751
Ref: library/codecs codec-objects9126956
Ref: 28339126956
Ref: library/codecs stateless-encoding-and-decoding9126956
Ref: 28589126956
Ref: library/codecs codecs Codec9127286
Ref: 28599127286
Ref: library/codecs codecs Codec encode9127315
Ref: 28319127315
Ref: library/codecs codecs Codec decode9128445
Ref: 28329128445
Node: インクリメンタルなエンコードとデコード9130023
Ref: library/codecs incremental-encoding-and-decoding9130255
Ref: 285a9130255
Node: IncrementalEncoder オブジェクト9131465
Ref: library/codecs incremental-encoder-objects9131642
Ref: 285d9131642
Ref: library/codecs incrementalencoder-objects9131642
Ref: 285e9131642
Ref: library/codecs codecs IncrementalEncoder9132077
Ref: 28369132077
Ref: library/codecs codecs IncrementalEncoder encode9133130
Ref: 285b9133130
Ref: library/codecs codecs IncrementalEncoder reset9133536
Ref: 285f9133536
Ref: library/codecs codecs IncrementalEncoder getstate9133909
Ref: 28609133909
Ref: library/codecs codecs IncrementalEncoder setstate9134385
Ref: 28619134385
Node: IncrementalDecoder オブジェクト9134634
Ref: library/codecs incremental-decoder-objects9134811
Ref: 28629134811
Ref: library/codecs incrementaldecoder-objects9134811
Ref: 28639134811
Ref: library/codecs codecs IncrementalDecoder9135240
Ref: 28379135240
Ref: library/codecs codecs IncrementalDecoder decode9136290
Ref: 285c9136290
Ref: library/codecs codecs IncrementalDecoder reset9137163
Ref: 28649137163
Ref: library/codecs codecs IncrementalDecoder getstate9137262
Ref: 28659137262
Ref: library/codecs codecs IncrementalDecoder setstate9138395
Ref: 28669138395
Node: ストリームのエンコードとデコード9138641
Ref: library/codecs stream-encoding-and-decoding9138813
Ref: 28679138813
Node: StreamWriter オブジェクト9139308
Ref: library/codecs stream-writer-objects9139464
Ref: 28689139464
Ref: library/codecs streamwriter-objects9139464
Ref: 28699139464
Ref: library/codecs codecs StreamWriter9139844
Ref: 283a9139844
Ref: library/codecs codecs StreamWriter write9141100
Ref: 286a9141100
Ref: library/codecs codecs StreamWriter writelines9141232
Ref: 286b9141232
Ref: library/codecs codecs StreamWriter reset9141544
Ref: 286c9141544
Node: StreamReader オブジェクト9142167
Ref: library/codecs stream-reader-objects9142369
Ref: 286d9142369
Ref: library/codecs streamreader-objects9142369
Ref: 286e9142369
Ref: library/codecs codecs StreamReader9142749
Ref: 283b9142749
Ref: library/codecs codecs StreamReader read9144118
Ref: 286f9144118
Ref: library/codecs codecs StreamReader readline9145782
Ref: 28709145782
Ref: library/codecs codecs StreamReader readlines9146207
Ref: 28719146207
Ref: library/codecs codecs StreamReader reset9146720
Ref: 28729146720
Node: StreamReaderWriter オブジェクト9147286
Ref: library/codecs stream-reader-writer9147489
Ref: 28739147489
Ref: library/codecs streamreaderwriter-objects9147489
Ref: 28749147489
Ref: library/codecs codecs StreamReaderWriter9147844
Ref: 28439147844
Node: StreamRecoder オブジェクト9148720
Ref: library/codecs stream-recoder-objects9148883
Ref: 28759148883
Ref: library/codecs streamrecoder-objects9148883
Ref: 28769148883
Ref: library/codecs codecs StreamRecoder9149317
Ref: 1dd49149317
Node: エンコーディングと Unicode9150790
Ref: library/codecs encodings-and-unicode9150981
Ref: 28779150981
Ref: library/codecs encodings-overview9150981
Ref: 28789150981
Ref: エンコーディングと Unicode-Footnote-19159256
Node: 標準エンコーディング9159298
Ref: library/codecs id39159508
Ref: 28799159508
Ref: library/codecs standard-encodings9159508
Ref: fb89159508
Ref: 標準エンコーディング-Footnote-19182913
Node: Python 特有のエンコーディング9182991
Ref: library/codecs python-specific-encodings9183197
Ref: 287a9183197
Node: テキストエンコーディング9184210
Ref: library/codecs text-encodings9184368
Ref: 287b9184368
Ref: テキストエンコーディング-Footnote-19188436
Ref: テキストエンコーディング-Footnote-29188495
Node: バイナリ変換 Binary Transforms9188554
Ref: library/codecs binary-transforms9188747
Ref: 11069188747
Ref: library/codecs id49188747
Ref: 287c9188747
Ref: バイナリ変換 Binary Transforms-Footnote-19192906
Node: Standalone Codec Functions9193112
Ref: library/codecs id69193303
Ref: 28829193303
Ref: library/codecs standalone-codec-functions9193303
Ref: 28839193303
Ref: library/codecs codecs codecs escape_encode9193717
Ref: 28849193717
Ref: library/codecs codecs codecs escape_decode9194090
Ref: 28859194090
Node: テキスト変換 Text Transforms9194414
Ref: library/codecs id79194560
Ref: 28869194560
Ref: library/codecs text-transforms9194560
Ref: 11079194560
Node: encodings --- Encodings package9195613
Ref: library/codecs encodings-encodings-package9195854
Ref: 28879195854
Ref: library/codecs module-encodings9195854
Ref: 559195854
Ref: library/codecs encodings normalize_encoding9195992
Ref: 9fd9195992
Ref: library/codecs encodings search_function9196572
Ref: 28889196572
Ref: library/codecs encodings win32_code_page_search_function9197268
Ref: 28899197268
Ref: library/codecs encodings CodecRegistryError9197651
Ref: 288a9197651
Node: encodings idna --- Internationalized Domain Names in Applications9197747
Ref: library/codecs encodings-idna-internationalized-domain-names-in-applications9197988
Ref: 288b9197988
Ref: library/codecs module-encodings idna9197988
Ref: 569197988
Ref: library/codecs encodings idna nameprep9201301
Ref: 288c9201301
Ref: library/codecs encodings idna ToASCII9201528
Ref: 288d9201528
Ref: library/codecs encodings idna ToUnicode9201717
Ref: 288e9201717
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-19201881
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-29201940
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-39201999
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-49202058
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-59202117
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-69202156
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-79202227
Ref: encodings idna --- Internationalized Domain Names in Applications-Footnote-89202286
Node: encodings mbcs --- Windows ANSI codepage9202345
Ref: library/codecs encodings-mbcs-windows-ansi-codepage9202609
Ref: 288f9202609
Ref: library/codecs module-encodings mbcs9202609
Ref: 579202609
Node: encodings utf_8_sig --- UTF-8 codec with BOM signature9203083
Ref: library/codecs encodings-utf-8-sig-utf-8-codec-with-bom-signature9203273
Ref: 28909203273
Ref: library/codecs module-encodings utf_8_sig9203273
Ref: 589203273
Node: データ型9203917
Ref: library/datatypes doc9204069
Ref: 28919204069
Ref: library/datatypes data-types9204069
Ref: 28929204069
Ref: library/datatypes datatypes9204069
Ref: 28939204069
Ref: library/datatypes translation-repo9204069
Ref: 28949204069
Node: datetime --- 基本的な日付と時間の型9206185
Ref: library/datetime doc9206340
Ref: 28959206340
Ref: library/datetime datetime-basic-date-and-time-types9206340
Ref: 28969206340
Ref: library/datetime module-datetime9206340
Ref: 349206340
Ref: datetime --- 基本的な日付と時間の型-Footnote-19207859
Ref: datetime --- 基本的な日付と時間の型-Footnote-29207927
Ref: datetime --- 基本的な日付と時間の型-Footnote-39207978
Node: Aware and naive objects9208021
Ref: library/datetime aware-and-naive-objects9208142
Ref: 28989208142
Ref: library/datetime datetime-naive-aware9208142
Ref: 28999208142
Ref: Aware and naive objects-Footnote-19210798
Node: 定数9210873
Ref: library/datetime constants9211018
Ref: 289a9211018
Ref: library/datetime datetime MINYEAR9211125
Ref: 289b9211125
Ref: library/datetime datetime MAXYEAR9211332
Ref: 289c9211332
Ref: library/datetime datetime UTC9211542
Ref: 7139211542
Node: Available types9211699
Ref: library/datetime available-types9211838
Ref: 289d9211838
Node: Common properties9213954
Ref: library/datetime common-properties9214074
Ref: 28ae9214074
Node: Determining if an object is aware or naive9214660
Ref: library/datetime determining-if-an-object-is-aware-or-naive9214780
Ref: 28af9214780
Node: timedelta objects9215812
Ref: library/datetime datetime-timedelta9215957
Ref: 28b09215957
Ref: library/datetime timedelta-objects9215957
Ref: 28b19215957
Ref: library/datetime datetime timedelta9216193
Ref: bc39216193
Ref: library/datetime datetime timedelta min9219180
Ref: 28b29219180
Ref: library/datetime datetime timedelta max9219328
Ref: 28b39219328
Ref: library/datetime datetime timedelta resolution9219540
Ref: 28b49219540
Ref: library/datetime datetime timedelta days9220009
Ref: 28b59220009
Ref: library/datetime datetime timedelta seconds9220103
Ref: 28b69220103
Ref: library/datetime datetime timedelta microseconds9220638
Ref: 28b79220638
Ref: library/datetime datetime timedelta total_seconds9227395
Ref: 151d9227395
Node: Examples of usage timedelta9228012
Ref: library/datetime examples-of-usage-timedelta9228093
Ref: 28b89228093
Node: date objects9229025
Ref: library/datetime date-objects9229171
Ref: 28b99229171
Ref: library/datetime datetime-date9229171
Ref: 28ba9229171
Ref: library/datetime datetime date9229511
Ref: 1fa9229511
Ref: library/datetime datetime date today9230038
Ref: 16e39230038
Ref: library/datetime datetime date fromtimestamp9230201
Ref: dcd9230201
Ref: library/datetime datetime date fromordinal9231428
Ref: dcc9231428
Ref: library/datetime datetime date fromisoformat9231831
Ref: 8289231831
Ref: library/datetime datetime date fromisocalendar9232846
Ref: bdf9232846
Ref: library/datetime datetime date strptime9233132
Ref: 1f99233132
Ref: library/datetime datetime date min9234667
Ref: 28bb9234667
Ref: library/datetime datetime date max9234773
Ref: 28bc9234773
Ref: library/datetime datetime date resolution9234884
Ref: 28bd9234884
Ref: library/datetime datetime date year9235076
Ref: 289e9235076
Ref: library/datetime datetime date month9235204
Ref: 289f9235204
Ref: library/datetime datetime date day9235290
Ref: 28a09235290
Ref: library/datetime datetime date replace9238526
Ref: 19f99238526
Ref: library/datetime datetime date timetuple9239014
Ref: 28be9239014
Ref: library/datetime datetime date toordinal9239516
Ref: 28bf9239516
Ref: library/datetime datetime date weekday9239818
Ref: 28c09239818
Ref: library/datetime datetime date isoweekday9240095
Ref: 28c19240095
Ref: library/datetime datetime date isocalendar9240405
Ref: af19240405
Ref: library/datetime datetime date isoformat9241651
Ref: 28c29241651
Ref: library/datetime datetime date __str__9241886
Ref: 28c39241886
Ref: library/datetime datetime date ctime9241998
Ref: 28c49241998
Ref: library/datetime datetime date strftime9242563
Ref: e8f9242563
Ref: library/datetime datetime date __format__9242914
Ref: 28c69242914
Ref: date objects-Footnote-19243467
Ref: date objects-Footnote-29243866
Node: Examples of usage date9244104
Ref: library/datetime examples-of-usage-date9244175
Ref: 28c79244175
Node: datetime objects9246090
Ref: library/datetime datetime-datetime9246231
Ref: 28c89246231
Ref: library/datetime datetime-objects9246231
Ref: 28c99246231
Ref: library/datetime datetime datetime9246851
Ref: 4e29246851
Ref: library/datetime datetime datetime today9247839
Ref: 28ca9247839
Ref: library/datetime datetime datetime now9248284
Ref: 7119248284
Ref: library/datetime datetime datetime utcnow9249368
Ref: 3519249368
Ref: library/datetime datetime datetime fromtimestamp9250447
Ref: 7129250447
Ref: library/datetime datetime datetime utcfromtimestamp9252742
Ref: 3529252742
Ref: library/datetime datetime datetime fromordinal9255061
Ref: 28cb9255061
Ref: library/datetime datetime datetime combine9255564
Ref: e909255564
Ref: library/datetime datetime datetime fromisoformat9256504
Ref: 82a9256504
Ref: library/datetime datetime datetime fromisocalendar9258702
Ref: be09258702
Ref: library/datetime datetime datetime strptime9259099
Ref: 19509259099
Ref: library/datetime datetime datetime min9260711
Ref: 1b659260711
Ref: library/datetime datetime datetime max9260860
Ref: 28cc9260860
Ref: library/datetime datetime datetime resolution9261034
Ref: 28cd9261034
Ref: library/datetime datetime datetime year9261254
Ref: 28a69261254
Ref: library/datetime datetime datetime month9261386
Ref: 28a79261386
Ref: library/datetime datetime datetime day9261476
Ref: 28a89261476
Ref: library/datetime datetime datetime hour9261583
Ref: 28a99261583
Ref: library/datetime datetime datetime minute9261660
Ref: 28aa9261660
Ref: library/datetime datetime datetime second9261739
Ref: 28ab9261739
Ref: library/datetime datetime datetime microsecond9261818
Ref: 28ac9261818
Ref: library/datetime datetime datetime tzinfo9261907
Ref: 28ad9261907
Ref: library/datetime datetime datetime fold9262136
Ref: e519262136
Ref: library/datetime datetime datetime date9267644
Ref: 28ce9267644
Ref: library/datetime datetime datetime time9267765
Ref: 28cf9267765
Ref: library/datetime datetime datetime timetz9268164
Ref: 28d09268164
Ref: library/datetime datetime datetime replace9268549
Ref: 16e49268549
Ref: library/datetime datetime datetime astimezone9269271
Ref: bc49269271
Ref: library/datetime datetime datetime utcoffset9272565
Ref: 28d19272565
Ref: library/datetime datetime datetime dst9273099
Ref: 28d29273099
Ref: library/datetime datetime datetime tzname9273621
Ref: 28d49273621
Ref: library/datetime datetime datetime timetuple9273950
Ref: 28d59273950
Ref: library/datetime datetime datetime utctimetuple9274957
Ref: 28d79274957
Ref: library/datetime datetime datetime toordinal9276244
Ref: 28d89276244
Ref: library/datetime datetime datetime timestamp9276412
Ref: 12ac9276412
Ref: library/datetime datetime datetime weekday9278316
Ref: 28d99278316
Ref: library/datetime datetime datetime isoweekday9278554
Ref: 28da9278554
Ref: library/datetime datetime datetime isocalendar9278824
Ref: af29278824
Ref: library/datetime datetime datetime isoformat9279038
Ref: d259279038
Ref: library/datetime datetime datetime __str__9282339
Ref: 28db9282339
Ref: library/datetime datetime datetime ctime9282488
Ref: 28dc9282488
Ref: library/datetime datetime datetime strftime9283219
Ref: e8e9283219
Ref: library/datetime datetime datetime __format__9283515
Ref: 28dd9283515
Node: Examples of usage datetime9284054
Ref: library/datetime examples-of-usage-datetime9284133
Ref: 28de9284133
Node: time objects9288540
Ref: library/datetime datetime-time9288683
Ref: 28df9288683
Ref: library/datetime time-objects9288683
Ref: 28e09288683
Ref: library/datetime datetime time9288971
Ref: 1fb9288971
Ref: library/datetime datetime time min9289798
Ref: 28e19289798
Ref: library/datetime datetime time max9289914
Ref: 28e29289914
Ref: library/datetime datetime time resolution9290046
Ref: 28e39290046
Ref: library/datetime datetime time hour9290385
Ref: 28a19290385
Ref: library/datetime datetime time minute9290458
Ref: 28a29290458
Ref: library/datetime datetime time second9290533
Ref: 28a39290533
Ref: library/datetime datetime time microsecond9290608
Ref: 28a49290608
Ref: library/datetime datetime time tzinfo9290693
Ref: 28a59290693
Ref: library/datetime datetime time fold9290914
Ref: e8d9290914
Ref: library/datetime datetime time fromisoformat9292731
Ref: 8299292731
Ref: library/datetime datetime time strptime9294358
Ref: 194c9294358
Ref: library/datetime datetime time replace9295046
Ref: 19fa9295046
Ref: library/datetime datetime time isoformat9295699
Ref: 28e49295699
Ref: library/datetime datetime time __str__9298017
Ref: 28e69298017
Ref: library/datetime datetime time strftime9298129
Ref: 1af89298129
Ref: library/datetime datetime time __format__9298403
Ref: 28e79298403
Ref: library/datetime datetime time utcoffset9298860
Ref: 28e59298860
Ref: library/datetime datetime time dst9299390
Ref: 28e89299390
Ref: library/datetime datetime time tzname9299908
Ref: 28e99299908
Ref: time objects-Footnote-19300330
Node: Examples of usage time9300395
Ref: library/datetime examples-of-usage-time9300466
Ref: 28ea9300466
Node: tzinfo objects9301345
Ref: library/datetime datetime-tzinfo9301488
Ref: 28eb9301488
Ref: library/datetime tzinfo-objects9301488
Ref: 28ec9301488
Ref: library/datetime datetime tzinfo9301545
Ref: 7f69301545
Ref: library/datetime datetime tzinfo utcoffset9303808
Ref: 28ed9303808
Ref: library/datetime datetime tzinfo dst9305481
Ref: 28ee9305481
Ref: library/datetime datetime tzinfo tzname9308781
Ref: 28ef9308781
Ref: library/datetime datetime tzinfo fromutc9311650
Ref: 28d39311650
Ref: tzinfo objects-Footnote-19325526
Node: timezone objects9325566
Ref: library/datetime datetime-timezone9325727
Ref: 28f09325727
Ref: library/datetime timezone-objects9325727
Ref: 28f19325727
Ref: library/datetime datetime timezone9326277
Ref: 12d59326277
Ref: library/datetime datetime timezone utcoffset9327117
Ref: 28f29327117
Ref: library/datetime datetime timezone tzname9327578
Ref: 28f39327578
Ref: library/datetime datetime timezone dst9328420
Ref: 28f49328420
Ref: library/datetime datetime timezone fromutc9328500
Ref: 28f59328500
Ref: library/datetime datetime timezone utc9328783
Ref: 8279328783
Node: strftime and strptime behavior9328880
Ref: library/datetime strftime-and-strptime-behavior9329018
Ref: 28f69329018
Ref: library/datetime strftime-strptime-behavior9329018
Ref: 1b549329018
Ref: library/datetime format-codes9330945
Ref: 28979330945
Node: strftime and strptime format codes9331054
Ref: library/datetime strftime-and-strptime-format-codes9331180
Ref: 28f79331180
Ref: strftime and strptime format codes-Footnote-19342905
Node: Technical detail9342953
Ref: library/datetime technical-detail9343079
Ref: 28f89343079
Ref: Technical detail-Footnote-19352215
Node: zoneinfo --- IANA タイムゾーンのサポート9352270
Ref: library/zoneinfo doc9352498
Ref: 28f99352498
Ref: library/zoneinfo module-zoneinfo9352498
Ref: 13a9352498
Ref: library/zoneinfo translation-repo9352498
Ref: 28fa9352498
Ref: library/zoneinfo zoneinfo-iana-time-zone-support9352498
Ref: 28fb9352498
Ref: zoneinfo --- IANA タイムゾーンのサポート-Footnote-19353939
Ref: zoneinfo --- IANA タイムゾーンのサポート-Footnote-29354004
Ref: zoneinfo --- IANA タイムゾーンのサポート-Footnote-39354046
Ref: zoneinfo --- IANA タイムゾーンのサポート-Footnote-49354087
Node: ZoneInfo を使用する9354128
Ref: library/zoneinfo using-zoneinfo9354267
Ref: 28fc9354267
Ref: ZoneInfo を使用する-Footnote-19356291
Node: データソース9356333
Ref: library/zoneinfo data-sources9356499
Ref: 28fd9356499
Ref: データソース-Footnote-19357189
Node: Configuring the data sources9357230
Ref: library/zoneinfo configuring-the-data-sources9357313
Ref: 28fe9357313
Ref: library/zoneinfo zoneinfo-data-configuration9357313
Ref: 28ff9357313
Node: Compile-time configuration9358066
Ref: library/zoneinfo compile-time-configuration9358191
Ref: 29029358191
Ref: library/zoneinfo zoneinfo-data-compile-time-config9358191
Ref: 21679358191
Node: Environment configuration9358921
Ref: library/zoneinfo environment-configuration9359076
Ref: 29039359076
Ref: library/zoneinfo zoneinfo-data-environment-var9359076
Ref: 29009359076
Ref: library/zoneinfo envvar-PYTHONTZPATH9359395
Ref: 29049359395
Node: Runtime configuration9360048
Ref: library/zoneinfo runtime-configuration9360168
Ref: 29069360168
Ref: library/zoneinfo zoneinfo-data-runtime-config9360168
Ref: 29019360168
Node: ZoneInfo クラス9360536
Ref: library/zoneinfo the-zoneinfo-class9360687
Ref: 29079360687
Ref: library/zoneinfo zoneinfo ZoneInfo9360747
Ref: adc9360747
Ref: library/zoneinfo zoneinfo ZoneInfo from_file9361712
Ref: 177c9361712
Ref: library/zoneinfo zoneinfo ZoneInfo no_cache9362479
Ref: 290a9362479
Ref: library/zoneinfo zoneinfo ZoneInfo clear_cache9363218
Ref: 29089363218
Ref: library/zoneinfo zoneinfo ZoneInfo key9364020
Ref: 290b9364020
Node: 文字列表現9364871
Ref: library/zoneinfo string-representations9364970
Ref: 290d9364970
Node: Pickle serialization9365758
Ref: library/zoneinfo pickle-serialization9365857
Ref: 290e9365857
Ref: library/zoneinfo pickling9365857
Ref: 29099365857
Node: 関数<3>9368252
Ref: library/zoneinfo functions9368392
Ref: 290f9368392
Ref: library/zoneinfo zoneinfo available_timezones9368423
Ref: 1d489368423
Ref: library/zoneinfo zoneinfo reset_tzpath9369393
Ref: 17c09369393
Node: Globals9370090
Ref: library/zoneinfo globals9370227
Ref: 29109370227
Ref: library/zoneinfo zoneinfo TZPATH9370262
Ref: 21669370262
Node: 例外と警告9371040
Ref: library/zoneinfo exceptions-and-warnings9371159
Ref: 29119371159
Ref: library/zoneinfo zoneinfo ZoneInfoNotFoundError9371205
Ref: 18169371205
Ref: library/zoneinfo zoneinfo InvalidTZPathWarning9371433
Ref: 29059371433
Node: calendar --- 一般的なカレンダーに関係する機能群9371607
Ref: library/calendar doc9371829
Ref: 29129371829
Ref: library/calendar calendar-general-calendar-related-functions9371829
Ref: 29139371829
Ref: library/calendar module-calendar9371829
Ref: 159371829
Ref: library/calendar translation-repo9371829
Ref: 29149371829
Ref: library/calendar calendar Calendar9373317
Ref: 29169373317
Ref: library/calendar calendar Calendar firstweekday9374010
Ref: 29199374010
Ref: library/calendar calendar Calendar getfirstweekday9374250
Ref: 291b9374250
Ref: library/calendar calendar Calendar setfirstweekday9374439
Ref: 291a9374439
Ref: library/calendar calendar Calendar iterweekdays9374663
Ref: 291c9374663
Ref: library/calendar calendar Calendar itermonthdates9374918
Ref: e139374918
Ref: library/calendar calendar Calendar itermonthdays9375348
Ref: 291d9375348
Ref: library/calendar calendar Calendar itermonthdays29375739
Ref: 291e9375739
Ref: library/calendar calendar Calendar itermonthdays39376095
Ref: e149376095
Ref: library/calendar calendar Calendar itermonthdays49376483
Ref: e159376483
Ref: library/calendar calendar Calendar monthdatescalendar9376891
Ref: 291f9376891
Ref: library/calendar calendar Calendar monthdays2calendar9377124
Ref: 29209377124
Ref: library/calendar calendar Calendar monthdayscalendar9377364
Ref: 29219377364
Ref: library/calendar calendar Calendar yeardatescalendar9377567
Ref: 29229377567
Ref: library/calendar calendar Calendar yeardays2calendar9378013
Ref: 29239378013
Ref: library/calendar calendar Calendar yeardayscalendar9378373
Ref: 29249378373
Ref: library/calendar calendar TextCalendar9378682
Ref: 18aa9378682
Ref: library/calendar calendar TextCalendar formatday9378934
Ref: 29259378934
Ref: library/calendar calendar TextCalendar formatweek9379248
Ref: 29269379248
Ref: library/calendar calendar TextCalendar formatweekday9379599
Ref: 29279379599
Ref: library/calendar calendar TextCalendar formatweekheader9379909
Ref: 29289379909
Ref: library/calendar calendar TextCalendar formatmonth9380189
Ref: 29299380189
Ref: library/calendar calendar TextCalendar formatmonthname9380664
Ref: 292a9380664
Ref: library/calendar calendar TextCalendar prmonth9381072
Ref: 292b9381072
Ref: library/calendar calendar TextCalendar formatyear9381250
Ref: 292c9381250
Ref: library/calendar calendar TextCalendar pryear9381837
Ref: 292d9381837
Ref: library/calendar calendar HTMLCalendar9382010
Ref: d189382010
Ref: library/calendar calendar HTMLCalendar formatmonth9382237
Ref: 292e9382237
Ref: library/calendar calendar HTMLCalendar formatyear9382548
Ref: 292f9382548
Ref: library/calendar calendar HTMLCalendar formatyearpage9382819
Ref: 29309382819
Ref: library/calendar calendar HTMLCalendar formatmonthname9383556
Ref: 29319383556
Ref: library/calendar calendar HTMLCalendar cssclasses9383936
Ref: 29329383936
Ref: library/calendar calendar HTMLCalendar cssclass_noday9384350
Ref: 29339384350
Ref: library/calendar calendar HTMLCalendar cssclasses_weekday_head9384511
Ref: 29349384511
Ref: library/calendar calendar HTMLCalendar cssclass_month_head9384726
Ref: 29359384726
Ref: library/calendar calendar HTMLCalendar cssclass_month9384927
Ref: 29369384927
Ref: library/calendar calendar HTMLCalendar cssclass_year9385134
Ref: 29379385134
Ref: library/calendar calendar HTMLCalendar cssclass_year_head9385347
Ref: 29389385347
Ref: library/calendar calendar LocaleTextCalendar9386256
Ref: 94b9386256
Ref: library/calendar calendar LocaleHTMLCalendar9386501
Ref: 94c9386501
Ref: library/calendar calendar setfirstweekday9387156
Ref: 29159387156
Ref: library/calendar calendar firstweekday9387665
Ref: 293e9387665
Ref: library/calendar calendar isleap9387779
Ref: 293f9387779
Ref: library/calendar calendar leapdays9387934
Ref: 29409387934
Ref: library/calendar calendar weekday9388207
Ref: 29419388207
Ref: library/calendar calendar weekheader9388420
Ref: 29429388420
Ref: library/calendar calendar monthrange9388594
Ref: 29439388594
Ref: library/calendar calendar monthcalendar9388736
Ref: 29449388736
Ref: library/calendar calendar prmonth9389042
Ref: 29459389042
Ref: library/calendar calendar month9389211
Ref: 190b9389211
Ref: library/calendar calendar prcal9389410
Ref: 29469389410
Ref: library/calendar calendar calendar9389572
Ref: 29479389572
Ref: library/calendar calendar timegm9389795
Ref: 29489389795
Ref: library/calendar calendar day_name9390374
Ref: 29499390374
Ref: library/calendar calendar day_abbr9390678
Ref: 294a9390678
Ref: library/calendar calendar MONDAY9390962
Ref: 29179390962
Ref: library/calendar calendar TUESDAY9390993
Ref: 29399390993
Ref: library/calendar calendar WEDNESDAY9391025
Ref: 293a9391025
Ref: library/calendar calendar THURSDAY9391059
Ref: 293b9391059
Ref: library/calendar calendar FRIDAY9391092
Ref: 293c9391092
Ref: library/calendar calendar SATURDAY9391123
Ref: 293d9391123
Ref: library/calendar calendar SUNDAY9391156
Ref: 29189391156
Ref: library/calendar calendar Day9391321
Ref: 6aa9391321
Ref: library/calendar calendar month_name9391572
Ref: 294b9391572
Ref: library/calendar calendar month_abbr9392045
Ref: 294c9392045
Ref: library/calendar calendar JANUARY9392492
Ref: 34e9392492
Ref: library/calendar calendar FEBRUARY9392524
Ref: 34f9392524
Ref: library/calendar calendar MARCH9392557
Ref: 294d9392557
Ref: library/calendar calendar APRIL9392587
Ref: 294e9392587
Ref: library/calendar calendar MAY9392617
Ref: 294f9392617
Ref: library/calendar calendar JUNE9392645
Ref: 29509392645
Ref: library/calendar calendar JULY9392674
Ref: 29519392674
Ref: library/calendar calendar AUGUST9392703
Ref: 29529392703
Ref: library/calendar calendar SEPTEMBER9392734
Ref: 29539392734
Ref: library/calendar calendar OCTOBER9392768
Ref: 29549392768
Ref: library/calendar calendar NOVEMBER9392800
Ref: 29559392800
Ref: library/calendar calendar DECEMBER9392833
Ref: 29569392833
Ref: library/calendar calendar Month9393006
Ref: 6a99393006
Ref: library/calendar calendar IllegalMonthError9393324
Ref: 190a9393324
Ref: library/calendar calendar IllegalMonthError month9393497
Ref: 29579393497
Ref: library/calendar calendar IllegalWeekdayError9393561
Ref: 29589393561
Ref: library/calendar calendar IllegalWeekdayError weekday9393739
Ref: 29599393739
Ref: calendar --- 一般的なカレンダーに関係する機能群-Footnote-19394169
Node: コマンドラインでの使用9394237
Ref: library/calendar calendar-cli9394371
Ref: 1d09394371
Ref: library/calendar command-line-usage9394371
Ref: 295a9394371
Ref: library/calendar cmdoption-calendar-help9397140
Ref: 295b9397140
Ref: library/calendar cmdoption-calendar-h9397140
Ref: 295c9397140
Ref: library/calendar cmdoption-calendar-locale9397228
Ref: 295d9397228
Ref: library/calendar cmdoption-calendar-L9397228
Ref: 295e9397228
Ref: library/calendar cmdoption-calendar-encoding9397348
Ref: 295f9397348
Ref: library/calendar cmdoption-calendar-e9397348
Ref: 29609397348
Ref: library/calendar cmdoption-calendar-type9397505
Ref: 29619397505
Ref: library/calendar cmdoption-calendar-t9397505
Ref: 29629397505
Ref: library/calendar cmdoption-calendar-first-weekday9397627
Ref: 29639397627
Ref: library/calendar cmdoption-calendar-f9397627
Ref: 29649397627
Ref: library/calendar cmdoption-calendar-arg-year9397829
Ref: 29659397829
Ref: library/calendar cmdoption-calendar-arg-month9397920
Ref: 29669397920
Ref: library/calendar cmdoption-calendar-width9398172
Ref: 29679398172
Ref: library/calendar cmdoption-calendar-w9398172
Ref: 29689398172
Ref: library/calendar cmdoption-calendar-lines9398370
Ref: 29699398370
Ref: library/calendar cmdoption-calendar-l9398370
Ref: 296a9398370
Ref: library/calendar cmdoption-calendar-spacing9398561
Ref: 296b9398561
Ref: library/calendar cmdoption-calendar-s9398561
Ref: 296c9398561
Ref: library/calendar cmdoption-calendar-months9398704
Ref: 296d9398704
Ref: library/calendar cmdoption-calendar-m9398704
Ref: 296e9398704
Ref: library/calendar cmdoption-calendar-css9398970
Ref: 296f9398970
Ref: library/calendar cmdoption-calendar-c9398970
Ref: 29709398970
Node: collections --- コンテナデータ型9399167
Ref: library/collections doc9399394
Ref: 29719399394
Ref: library/collections collections-container-datatypes9399394
Ref: 29729399394
Ref: library/collections module-collections9399394
Ref: 1e9399394
Ref: library/collections translation-repo9399394
Ref: 29739399394
Ref: collections --- コンテナデータ型-Footnote-19401787
Node: ChainMap オブジェクト9401868
Ref: library/collections chainmap-objects9402007
Ref: 29749402007
Ref: library/collections collections ChainMap9402506
Ref: e169402506
Ref: library/collections collections ChainMap maps9403842
Ref: 29759403842
Ref: library/collections collections ChainMap new_child9404332
Ref: 11269404332
Ref: library/collections collections ChainMap parents9405451
Ref: 29769405451
Ref: ChainMap オブジェクト-Footnote-19407869
Ref: ChainMap オブジェクト-Footnote-29407911
Ref: ChainMap オブジェクト-Footnote-39407958
Ref: ChainMap オブジェクト-Footnote-49408053
Ref: ChainMap オブジェクト-Footnote-59408132
Ref: ChainMap オブジェクト-Footnote-69408229
Node: ChainMap の例とレシピ9408282
Ref: library/collections chainmap-examples-and-recipes9408373
Ref: 29779408373
Node: Counter オブジェクト9411587
Ref: library/collections counter-objects9411759
Ref: 29789411759
Ref: library/collections collections Counter9412514
Ref: 12a39412514
Ref: library/collections collections Counter elements9414915
Ref: 151b9414915
Ref: library/collections collections Counter most_common9415382
Ref: 151a9415382
Ref: library/collections collections Counter subtract9415900
Ref: 13f79415900
Ref: library/collections collections Counter total9416487
Ref: 29799416487
Ref: library/collections collections Counter fromkeys9416927
Ref: 297a9416927
Ref: library/collections collections Counter update9417100
Ref: 177d9417100
Ref: Counter オブジェクト-Footnote-19423224
Ref: Counter オブジェクト-Footnote-29423303
Ref: Counter オブジェクト-Footnote-39423350
Node: deque オブジェクト9423443
Ref: library/collections deque-objects9423618
Ref: 297b9423618
Ref: library/collections collections deque9423687
Ref: 7f49423687
Ref: library/collections collections deque append9425644
Ref: 297c9425644
Ref: library/collections collections deque appendleft9425738
Ref: 297d9425738
Ref: library/collections collections deque clear9425836
Ref: 297e9425836
Ref: library/collections collections deque copy9425953
Ref: fd29425953
Ref: library/collections collections deque count9426075
Ref: 13f99426075
Ref: library/collections collections deque extend9426210
Ref: 297f9426210
Ref: library/collections collections deque extendleft9426382
Ref: 29809426382
Ref: library/collections collections deque index9426670
Ref: fd09426670
Ref: library/collections collections deque insert9427032
Ref: fd19427032
Ref: library/collections collections deque pop9427327
Ref: 29819427327
Ref: library/collections collections deque popleft9427567
Ref: 29829427567
Ref: library/collections collections deque remove9427811
Ref: 1ccf9427811
Ref: library/collections collections deque reverse9428016
Ref: 13fa9428016
Ref: library/collections collections deque rotate9428176
Ref: 1c909428176
Ref: library/collections collections deque maxlen9428739
Ref: 151c9428739
Node: deque のレシピ9431568
Ref: library/collections deque-recipes9431647
Ref: 29839431647
Ref: deque のレシピ-Footnote-19434493
Node: defaultdict オブジェクト9434554
Ref: library/collections defaultdict-objects9434783
Ref: 29849434783
Ref: library/collections collections defaultdict9434864
Ref: 13d49434864
Ref: library/collections collections defaultdict __missing__9435802
Ref: 29869435802
Ref: library/collections collections defaultdict default_factory9437386
Ref: 29859437386
Ref: defaultdict オブジェクト-Footnote-19437916
Node: defaultdict の使用例9437958
Ref: library/collections defaultdict-examples9438049
Ref: 29879438049
Node: namedtuple 名前付きフィールドを持つタプルのファクトリ関数9440946
Ref: library/collections namedtuple-factory-function-for-tuples-with-named-fields9441181
Ref: 29889441181
Ref: library/collections collections namedtuple9441735
Ref: 4e09441735
Ref: library/collections collections somenamedtuple _make9446694
Ref: 298a9446694
Ref: library/collections collections somenamedtuple _asdict9446951
Ref: bd49446951
Ref: library/collections collections somenamedtuple _replace9447761
Ref: 298b9447761
Ref: library/collections collections somenamedtuple _fields9448496
Ref: 298c9448496
Ref: library/collections collections somenamedtuple _field_defaults9449065
Ref: 29899449065
Node: OrderedDict オブジェクト9452400
Ref: library/collections ordereddict-objects9452632
Ref: 298d9452632
Ref: library/collections collections OrderedDict9455632
Ref: 7f39455632
Ref: library/collections collections OrderedDict popitem9455858
Ref: 15059455858
Ref: library/collections collections OrderedDict move_to_end9456159
Ref: 13f89456159
Ref: library/collections collections-ordereddict-eq9457031
Ref: 19499457031
Ref: OrderedDict オブジェクト-Footnote-19458089
Ref: OrderedDict オブジェクト-Footnote-29458131
Node: OrderedDict の例とレシピ9458173
Ref: library/collections ordereddict-examples-and-recipes9458270
Ref: 298f9458270
Node: UserDict オブジェクト9461316
Ref: library/collections userdict-objects9461495
Ref: 29909461495
Ref: library/collections collections UserDict9461977
Ref: 1d7d9461977
Ref: library/collections collections UserDict data9462676
Ref: 29919462676
Node: UserList オブジェクト9462825
Ref: library/collections userlist-objects9463003
Ref: 29929463003
Ref: library/collections collections UserList9463730
Ref: 16fd9463730
Ref: library/collections collections UserList data9464490
Ref: 29939464490
Node: UserString オブジェクト9465555
Ref: library/collections userstring-objects9465697
Ref: 29949465697
Ref: library/collections collections UserString9466189
Ref: fd39466189
Ref: library/collections collections UserString data9466879
Ref: 29959466879
Node: collections abc --- コンテナの抽象基底クラス9467232
Ref: library/collections abc doc9467441
Ref: 29969467441
Ref: library/collections abc collections-abc-abstract-base-classes-for-containers9467441
Ref: 29979467441
Ref: library/collections abc module-collections abc9467441
Ref: 1f9467441
Ref: library/collections abc translation-repo9467441
Ref: 29989467441
Ref: collections abc --- コンテナの抽象基底クラス-Footnote-19472040
Ref: collections abc --- コンテナの抽象基底クラス-Footnote-29472117
Node: コレクション抽象基底クラス9472159
Ref: library/collections abc collections-abstract-base-classes9472361
Ref: a789472361
Ref: library/collections abc id19472361
Ref: 29999472361
Ref: コレクション抽象基底クラス-Footnote-19482177
Ref: コレクション抽象基底クラス-Footnote-29482710
Ref: コレクション抽象基底クラス-Footnote-39483243
Ref: コレクション抽象基底クラス-Footnote-49483776
Ref: コレクション抽象基底クラス-Footnote-59484252
Ref: コレクション抽象基底クラス-Footnote-69484785
Ref: コレクション抽象基底クラス-Footnote-79485318
Ref: コレクション抽象基底クラス-Footnote-89485851
Ref: コレクション抽象基底クラス-Footnote-99486384
Ref: コレクション抽象基底クラス-Footnote-109486917
Ref: コレクション抽象基底クラス-Footnote-119487451
Ref: コレクション抽象基底クラス-Footnote-129487985
Ref: コレクション抽象基底クラス-Footnote-139488519
Ref: コレクション抽象基底クラス-Footnote-149489053
Ref: コレクション抽象基底クラス-Footnote-159489587
Ref: コレクション抽象基底クラス-Footnote-169490121
Node: コレクションの抽象基底クラス -- 詳細な説明9490655
Ref: library/collections abc collections-abstract-base-classes-detailed-descriptions9490881
Ref: 299b9490881
Ref: library/collections abc collections abc Container9491001
Ref: 26b09491001
Ref: library/collections abc collections abc Hashable9491131
Ref: 7199491131
Ref: library/collections abc collections abc Sized9491255
Ref: 71a9491255
Ref: library/collections abc collections abc Callable9491376
Ref: 9eb9491376
Ref: library/collections abc collections abc Iterable9491695
Ref: 26ae9491695
Ref: library/collections abc collections abc Collection9492318
Ref: e849492318
Ref: library/collections abc collections abc Iterator9492470
Ref: 26af9492470
Ref: library/collections abc collections abc Reversible9492708
Ref: e859492708
Ref: library/collections abc collections abc Generator9492886
Ref: fdb9492886
Ref: library/collections abc collections abc Sequence9493395
Ref: 13dc9493395
Ref: library/collections abc collections abc MutableSequence9493435
Ref: 4bf9493435
Ref: library/collections abc collections abc ByteString9493482
Ref: 3429493482
Ref: library/collections abc collections abc ByteString index9494206
Ref: 299d9494206
Ref: library/collections abc collections abc Set9495617
Ref: 26a69495617
Ref: library/collections abc collections abc MutableSet9495652
Ref: 26b19495652
Ref: library/collections abc collections abc Mapping9495782
Ref: ac79495782
Ref: library/collections abc collections abc MutableMapping9495821
Ref: 12c09495821
Ref: library/collections abc collections abc MappingView9496008
Ref: 26b29496008
Ref: library/collections abc collections abc ItemsView9496051
Ref: 26b49496051
Ref: library/collections abc collections abc KeysView9496092
Ref: 26b39496092
Ref: library/collections abc collections abc ValuesView9496132
Ref: 26b59496132
Ref: library/collections abc collections abc Awaitable9496265
Ref: fdc9496265
Ref: library/collections abc collections abc Coroutine9497107
Ref: fdd9497107
Ref: library/collections abc collections abc AsyncIterable9498331
Ref: fdf9498331
Ref: library/collections abc collections abc AsyncIterator9498559
Ref: fde9498559
Ref: library/collections abc collections abc AsyncGenerator9498814
Ref: e879498814
Ref: library/collections abc collections abc Buffer9499220
Ref: 3439499220
Ref: コレクションの抽象基底クラス -- 詳細な説明-Footnote-19499499
Ref: コレクションの抽象基底クラス -- 詳細な説明-Footnote-29499541
Ref: コレクションの抽象基底クラス -- 詳細な説明-Footnote-39499599
Ref: コレクションの抽象基底クラス -- 詳細な説明-Footnote-49499641
Ref: コレクションの抽象基底クラス -- 詳細な説明-Footnote-59499683
Node: 例とレシピ9499725
Ref: library/collections abc examples-and-recipes9499903
Ref: 299e9499903
Ref: 例とレシピ-Footnote-19503370
Ref: 例とレシピ-Footnote-29503423
Node: heapq --- ヒープキューアルゴリズム9503465
Ref: library/heapq doc9503678
Ref: 299f9503678
Ref: library/heapq heapq-heap-queue-algorithm9503678
Ref: 29a09503678
Ref: library/heapq module-heapq9503678
Ref: 6d9503678
Ref: library/heapq translation-repo9503678
Ref: 29a19503678
Ref: library/heapq heapq heapify9506127
Ref: 29a29506127
Ref: library/heapq heapq heappush9506229
Ref: 16d59506229
Ref: library/heapq heapq heappop9506359
Ref: 16d69506359
Ref: library/heapq heapq heappushpop9506629
Ref: 29a39506629
Ref: library/heapq heapq heapreplace9506953
Ref: 29a49506953
Ref: library/heapq heapq heapify_max9507984
Ref: 2219507984
Ref: library/heapq heapq heappush_max9508119
Ref: 2229508119
Ref: library/heapq heapq heappop_max9508291
Ref: 2239508291
Ref: library/heapq heapq heappushpop_max9508608
Ref: 2259508608
Ref: library/heapq heapq heapreplace_max9508927
Ref: 2249508927
Ref: library/heapq heapq merge9509462
Ref: 10059509462
Ref: library/heapq heapq nlargest9510994
Ref: 29a59510994
Ref: library/heapq heapq nsmallest9511473
Ref: 29a69511473
Ref: heapq --- ヒープキューアルゴリズム-Footnote-19512497
Node: 基本的な例9512562
Ref: library/heapq basic-examples9512687
Ref: 29a79512687
Ref: 基本的な例-Footnote-19513764
Node: Other Applications9513858
Ref: library/heapq other-applications9514025
Ref: 29a89514025
Ref: Other Applications-Footnote-19515285
Ref: Other Applications-Footnote-29515330
Node: 優先度キュー実装の注釈9515385
Ref: library/heapq priority-queue-implementation-notes9515543
Ref: 29a99515543
Ref: 優先度キュー実装の注釈-Footnote-19518982
Node: 理論9519094
Ref: library/heapq theory9519225
Ref: 29aa9519225
Ref: 理論-Footnote-19525017
Node: bisect --- 配列二分法アルゴリズム9525932
Ref: library/bisect doc9526123
Ref: 29ab9526123
Ref: library/bisect bisect-array-bisection-algorithm9526123
Ref: 29ac9526123
Ref: library/bisect module-bisect9526123
Ref: 129526123
Ref: library/bisect translation-repo9526123
Ref: 29ad9526123
Ref: library/bisect bisect-functions9527643
Ref: 29af9527643
Ref: library/bisect bisect bisect_left9527685
Ref: 29b09527685
Ref: library/bisect bisect bisect_right9529097
Ref: 29b19529097
Ref: library/bisect bisect bisect9529169
Ref: 29b29529169
Ref: library/bisect bisect insort_left9529823
Ref: 29ae9529823
Ref: library/bisect bisect insort_right9530519
Ref: 29b39530519
Ref: library/bisect bisect insort9530591
Ref: 29b49530591
Ref: bisect --- 配列二分法アルゴリズム-Footnote-19531549
Node: パフォーマンスに関するメモ9531615
Ref: library/bisect performance-notes9531777
Ref: 29b59531777
Ref: パフォーマンスに関するメモ-Footnote-19533298
Ref: パフォーマンスに関するメモ-Footnote-29533353
Node: ソート済みリストの探索9533423
Ref: library/bisect searching-sorted-lists9533606
Ref: 29b69533606
Node: 使用例<4>9534955
Ref: library/bisect examples9535090
Ref: 29b79535090
Ref: library/bisect bisect-example9535124
Ref: 29b89535124
Node: array --- 効率的な数値配列9537859
Ref: library/array doc9538031
Ref: 29b99538031
Ref: library/array array-efficient-arrays-of-numeric-values9538031
Ref: 29ba9538031
Ref: library/array module-array9538031
Ref: 89538031
Ref: library/array translation-repo9538031
Ref: 29bb9538031
Ref: library/array array typecodes9543117
Ref: 29bd9543117
Ref: library/array array array9543282
Ref: 4be9543282
Ref: library/array array array typecode9544578
Ref: 29c09544578
Ref: library/array array array itemsize9544680
Ref: 29bc9544680
Ref: library/array array array append9544797
Ref: 29c19544797
Ref: library/array array array buffer_info9544912
Ref: 29c29544912
Ref: library/array array array byteswap9546393
Ref: 29c39546393
Ref: library/array array array count9546972
Ref: 29c49546972
Ref: library/array array array extend9547077
Ref: 29bf9547077
Ref: library/array array array frombytes9547672
Ref: 14899547672
Ref: library/array array array fromfile9548090
Ref: 14d89548090
Ref: library/array array array fromlist9548539
Ref: 29c59548539
Ref: library/array array array fromunicode9548803
Ref: 29be9548803
Ref: library/array array array index9549163
Ref: 9e19549163
Ref: library/array array array insert9549623
Ref: 29c69549623
Ref: library/array array array pop9549863
Ref: 29c79549863
Ref: library/array array array remove9550156
Ref: 29c89550156
Ref: library/array array array clear9550283
Ref: 4c09550283
Ref: library/array array array reverse9550397
Ref: 29c99550397
Ref: library/array array array tobytes9550492
Ref: 14889550492
Ref: library/array array array tofile9550856
Ref: 14d99550856
Ref: library/array array array tolist9551018
Ref: 29ca9551018
Ref: library/array array array tounicode9551136
Ref: 29cb9551136
Ref: array --- 効率的な数値配列-Footnote-19552444
Node: weakref --- Weak references9552471
Ref: library/weakref doc9552654
Ref: 29cc9552654
Ref: library/weakref mod-weakref9552654
Ref: 110d9552654
Ref: library/weakref module-weakref9552654
Ref: 11a9552654
Ref: library/weakref translation-repo9552654
Ref: 29cd9552654
Ref: library/weakref weakref-weak-references9552654
Ref: 29ce9552654
Ref: library/weakref weakref ref9557599
Ref: 11f29557599
Ref: library/weakref weakref ref __callback__9559785
Ref: 11f39559785
Ref: library/weakref weakref proxy9560229
Ref: c469560229
Ref: library/weakref weakref getweakrefcount9561640
Ref: 29d09561640
Ref: library/weakref weakref getweakrefs9561768
Ref: 29d19561768
Ref: library/weakref weakref WeakKeyDictionary9561934
Ref: 19299561934
Ref: library/weakref weakref WeakKeyDictionary keyrefs9564072
Ref: 29d29564072
Ref: library/weakref weakref WeakValueDictionary9564203
Ref: 192a9564203
Ref: library/weakref weakref WeakValueDictionary valuerefs9564725
Ref: 29d39564725
Ref: library/weakref weakref WeakSet9564857
Ref: 7f59564857
Ref: library/weakref weakref WeakMethod9565044
Ref: 11f19565044
Ref: library/weakref weakref finalize9566228
Ref: c6f9566228
Ref: library/weakref weakref finalize __call__9567941
Ref: 29d49567941
Ref: library/weakref weakref finalize detach9568158
Ref: 29d59568158
Ref: library/weakref weakref finalize peek9568365
Ref: 29d69568365
Ref: library/weakref weakref finalize alive9568540
Ref: 29d79568540
Ref: library/weakref weakref finalize atexit9568704
Ref: 29d89568704
Ref: library/weakref weakref ReferenceType9569307
Ref: 1b5d9569307
Ref: library/weakref weakref ProxyType9569415
Ref: 1b5e9569415
Ref: library/weakref weakref CallableProxyType9569552
Ref: 1b5f9569552
Ref: library/weakref weakref ProxyTypes9569691
Ref: 29d99569691
Ref: weakref --- Weak references-Footnote-19570439
Ref: weakref --- Weak references-Footnote-29570506
Ref: weakref --- Weak references-Footnote-39570548
Ref: weakref --- Weak references-Footnote-49570590
Node: 弱参照オブジェクト9570632
Ref: library/weakref weak-reference-objects9570744
Ref: 29da9570744
Ref: library/weakref weakref-objects9570744
Ref: 29db9570744
Node: 使用例<5>9573875
Ref: library/weakref example9574035
Ref: 29dc9574035
Ref: library/weakref weakref-example9574035
Ref: 29dd9574035
Node: ファイナライザオブジェクト9574710
Ref: library/weakref finalize-examples9574884
Ref: 29de9574884
Ref: library/weakref finalizer-objects9574884
Ref: 29df9574884
Node: Comparing finalizers with __del__ methods9576831
Ref: library/weakref comparing-finalizers-with-del-methods9576984
Ref: 29e09576984
Node: types --- 動的な型生成と組み込み型の名前9579940
Ref: library/types doc9580143
Ref: 29e19580143
Ref: library/types module-types9580143
Ref: 1099580143
Ref: library/types translation-repo9580143
Ref: 29e29580143
Ref: library/types types-dynamic-type-creation-and-names-for-built-in-types9580143
Ref: 29e39580143
Ref: types --- 動的な型生成と組み込み型の名前-Footnote-19581124
Node: 動的な型生成9581189
Ref: library/types dynamic-type-creation9581341
Ref: 29e49581341
Ref: library/types types new_class9581392
Ref: 13799581392
Ref: library/types types prepare_class9582216
Ref: 137a9582216
Ref: library/types types resolve_bases9583556
Ref: d959583556
Ref: library/types types get_original_bases9584125
Ref: 6f59584125
Ref: 動的な型生成-Footnote-19585720
Ref: 動的な型生成-Footnote-29585762
Ref: 動的な型生成-Footnote-39585804
Ref: 動的な型生成-Footnote-49585846
Node: 標準的なインタプリタ型9585888
Ref: library/types standard-interpreter-types9586097
Ref: 29e59586097
Ref: library/types types NoneType9586880
Ref: a529586880
Ref: library/types types FunctionType9586979
Ref: a839586979
Ref: library/types types LambdaType9587013
Ref: 29e69587013
Ref: library/types types GeneratorType9587464
Ref: 19ab9587464
Ref: library/types types CoroutineType9587645
Ref: 10899587645
Ref: library/types types AsyncGeneratorType9587824
Ref: 29e79587824
Ref: library/types types CodeType9588055
Ref: 32f9588055
Ref: library/types types CellType9588676
Ref: 29e89588676
Ref: library/types types MethodType9588857
Ref: 1b839588857
Ref: library/types types BuiltinFunctionType9588978
Ref: 29e99588978
Ref: library/types types BuiltinMethodType9589019
Ref: 29ea9589019
Ref: library/types types WrapperDescriptorType9589308
Ref: d929589308
Ref: library/types types MethodWrapperType9589531
Ref: 85b9589531
Ref: library/types types NotImplementedType9589739
Ref: a539589739
Ref: library/types types MethodDescriptorType9589858
Ref: d939589858
Ref: library/types types ClassMethodDescriptorType9590020
Ref: d949590020
Ref: library/types types ModuleType9590212
Ref: 10149590212
Ref: library/types types EllipsisType9591019
Ref: a519591019
Ref: library/types types GenericAlias9591127
Ref: 9ec9591127
Ref: library/types types UnionType9592085
Ref: 2a79592085
Ref: library/types types TracebackType9592292
Ref: cea9592292
Ref: library/types types FrameType9592656
Ref: 1bee9592656
Ref: library/types types GetSetDescriptorType9592814
Ref: 29eb9592814
Ref: library/types types MemberDescriptorType9593186
Ref: 29ec9593186
Ref: library/types types MappingProxyType9594076
Ref: 6989594076
Ref: library/types types MappingProxyType copy9595394
Ref: 29ed9595394
Ref: library/types types MappingProxyType get9595504
Ref: 29ee9595504
Ref: library/types types MappingProxyType items9595958
Ref: 29ef9595958
Ref: library/types types MappingProxyType keys9596136
Ref: 29f09596136
Ref: library/types types MappingProxyType values9596267
Ref: 29f19596267
Ref: library/types types CapsuleType9596677
Ref: 29f29596677
Ref: 標準的なインタプリタ型-Footnote-19596823
Ref: 標準的なインタプリタ型-Footnote-29596865
Node: 追加のユーティリティクラスと関数9596907
Ref: library/types additional-utility-classes-and-functions9597140
Ref: 29f49597140
Ref: library/types types SimpleNamespace9597241
Ref: 4e59597241
Ref: library/types types DynamicClassAttribute9599419
Ref: 83c9599419
Node: コルーチンユーティリティ関数9600281
Ref: library/types coroutine-utility-functions9600472
Ref: 29f59600472
Ref: library/types types coroutine9600563
Ref: 10889600563
Node: copy --- 浅いコピーおよび深いコピー操作9601663
Ref: library/copy doc9601874
Ref: 29f69601874
Ref: library/copy copy-shallow-and-deep-copy-operations9601874
Ref: 29f79601874
Ref: library/copy module-copy9601874
Ref: 299601874
Ref: library/copy translation-repo9601874
Ref: 29f89601874
Ref: library/copy copy copy9602727
Ref: 7579602727
Ref: library/copy copy deepcopy9602819
Ref: d659602819
Ref: library/copy copy replace9602920
Ref: 1c09602920
Ref: library/copy copy Error9603102
Ref: 29f99603102
Ref: library/copy shallow-vs-deep-copy9603186
Ref: 1fe49603186
Ref: library/copy object __copy__9605839
Ref: 17e09605839
Ref: library/copy object __deepcopy__9605976
Ref: 17e19605976
Ref: library/copy object __replace__9606686
Ref: 47d9606686
Ref: copy --- 浅いコピーおよび深いコピー操作-Footnote-19607125
Node: pprint --- データの整形表示9607189
Ref: library/pprint doc9607387
Ref: 29fa9607387
Ref: library/pprint module-pprint9607387
Ref: b39607387
Ref: library/pprint pprint-data-pretty-printer9607387
Ref: 29fb9607387
Ref: library/pprint translation-repo9607387
Ref: 29fc9607387
Ref: pprint --- データの整形表示-Footnote-19608614
Node: 関数<4>9608680
Ref: library/pprint functions9608802
Ref: 29fd9608802
Ref: library/pprint pprint-functions9608802
Ref: 29fe9608802
Ref: library/pprint pprint pp9608833
Ref: c189608833
Ref: library/pprint pprint pprint9611653
Ref: a299611653
Ref: library/pprint pprint pformat9612052
Ref: 11829612052
Ref: library/pprint pprint isreadable9612505
Ref: 29ff9612505
Ref: library/pprint pprint isrecursive9612854
Ref: 2a009612854
Ref: library/pprint pprint saferepr9613156
Ref: 2a019613156
Node: PrettyPrinter オブジェクト9613805
Ref: library/pprint id19613948
Ref: 2a029613948
Ref: library/pprint prettyprinter-objects9613948
Ref: 2a039613948
Ref: library/pprint pprint PrettyPrinter9614027
Ref: 11819614027
Ref: library/pprint pprint PrettyPrinter pformat9615793
Ref: 2a049615793
Ref: library/pprint pprint PrettyPrinter pprint9616042
Ref: 2a059616042
Ref: library/pprint pprint PrettyPrinter isreadable9616495
Ref: 2a069616495
Ref: library/pprint pprint PrettyPrinter isrecursive9617012
Ref: 2a079617012
Ref: library/pprint pprint PrettyPrinter format9617404
Ref: 1ce79617404
Node: 使用例<6>9618782
Ref: library/pprint example9618907
Ref: 2a089618907
Ref: library/pprint pprint-example9618907
Ref: 2a099618907
Ref: 使用例<6>-Footnote-19626385
Node: reprlib --- もう一つの repr の実装9626410
Ref: library/reprlib doc9626587
Ref: 2a0a9626587
Ref: library/reprlib module-reprlib9626587
Ref: c09626587
Ref: library/reprlib reprlib-alternate-repr-implementation9626587
Ref: 2a0b9626587
Ref: library/reprlib translation-repo9626587
Ref: 2a0c9626587
Ref: library/reprlib reprlib Repr9627196
Ref: 2a0d9627196
Ref: library/reprlib reprlib aRepr9628266
Ref: 2a0f9628266
Ref: library/reprlib reprlib repr9628606
Ref: 2a109628606
Ref: library/reprlib reprlib recursive_repr9629039
Ref: 140c9629039
Ref: reprlib --- もう一つの repr の実装-Footnote-19629873
Node: Reprオブジェクト9629940
Ref: library/reprlib id19630099
Ref: 2a0e9630099
Ref: library/reprlib repr-objects9630099
Ref: 2a129630099
Ref: library/reprlib reprlib Repr fillvalue9630411
Ref: 2a139630411
Ref: library/reprlib reprlib Repr maxlevel9630560
Ref: 2a149630560
Ref: library/reprlib reprlib Repr maxdict9630684
Ref: 2a159630684
Ref: library/reprlib reprlib Repr maxlist9630712
Ref: 2a169630712
Ref: library/reprlib reprlib Repr maxtuple9630740
Ref: 2a179630740
Ref: library/reprlib reprlib Repr maxset9630769
Ref: 2a189630769
Ref: library/reprlib reprlib Repr maxfrozenset9630796
Ref: 2a199630796
Ref: library/reprlib reprlib Repr maxdeque9630829
Ref: 2a1a9630829
Ref: library/reprlib reprlib Repr maxarray9630858
Ref: 2a1b9630858
Ref: library/reprlib reprlib Repr maxlong9631148
Ref: 2a1c9631148
Ref: library/reprlib reprlib Repr maxstring9631317
Ref: 2a1d9631317
Ref: library/reprlib reprlib Repr maxother9631739
Ref: 2a1e9631739
Ref: library/reprlib reprlib Repr indent9632111
Ref: 2a1f9632111
Ref: library/reprlib reprlib Repr repr9633606
Ref: 2a119633606
Ref: library/reprlib reprlib Repr repr19633778
Ref: 2a209633778
Node: Reprオブジェクトをサブクラス化する9634841
Ref: library/reprlib subclassing-repr-objects9635000
Ref: 2a219635000
Ref: library/reprlib subclassing-reprs9635000
Ref: 2a229635000
Node: enum --- 列挙型のサポート9635732
Ref: library/enum doc9635923
Ref: 2a239635923
Ref: library/enum enum-support-for-enumerations9635923
Ref: 2a249635923
Ref: library/enum module-enum9635923
Ref: 5a9635923
Ref: library/enum translation-repo9635923
Ref: 2a259635923
Ref: enum --- 列挙型のサポート-Footnote-19638173
Node: モジュールコンテンツ<2>9638237
Ref: library/enum module-contents9638364
Ref: 2a2a9638364
Node: データ型<2>9642550
Ref: library/enum data-types9642725
Ref: 2a2e9642725
Ref: library/enum enum EnumType9642766
Ref: 4f79642766
Ref: library/enum enum EnumType __call__9643466
Ref: 2a309643466
Ref: library/enum enum EnumType __contains__9644778
Ref: 2a319644778
Ref: library/enum enum EnumType __dir__9645264
Ref: 2a329645264
Ref: library/enum enum EnumType __getitem__9645667
Ref: 2a339645667
Ref: library/enum enum EnumType __iter__9645894
Ref: 2a349645894
Ref: library/enum enum EnumType __len__9646093
Ref: 2a359646093
Ref: library/enum enum EnumType __members__9646240
Ref: 2a369646240
Ref: library/enum enum EnumType __reversed__9646364
Ref: 2a379646364
Ref: library/enum enum Enum9646593
Ref: 8429646593
Ref: library/enum enum Enum name9646689
Ref: 2a389646689
Ref: library/enum enum Enum value9646854
Ref: 2a399646854
Ref: library/enum enum Enum _name_9647801
Ref: 2a3b9647801
Ref: library/enum enum Enum _value_9647860
Ref: 2a3c9647860
Ref: library/enum enum Enum _order_9647958
Ref: 2a3d9647958
Ref: library/enum enum Enum _ignore_9648108
Ref: 2a3e9648108
Ref: library/enum enum Enum __dir__9648492
Ref: 1c049648492
Ref: library/enum enum Enum _generate_next_value_9649370
Ref: 2a409649370
Ref: library/enum enum Enum __init__9650346
Ref: 2a419650346
Ref: library/enum enum Enum __init_subclass__9650855
Ref: 2a429650855
Ref: library/enum enum Enum _missing_9651063
Ref: 2a439651063
Ref: library/enum enum Enum __new__9652025
Ref: 2a3a9652025
Ref: library/enum enum Enum __repr__9652756
Ref: 1afa9652756
Ref: library/enum enum Enum __str__9653619
Ref: 8349653619
Ref: library/enum enum Enum __format__9654386
Ref: 8329654386
Ref: library/enum enum Enum _add_alias_9655461
Ref: 2a449655461
Ref: library/enum enum Enum _add_value_alias_9655815
Ref: 2a459655815
Ref: library/enum enum IntEnum9656177
Ref: edb9656177
Ref: library/enum enum StrEnum9657342
Ref: 82d9657342
Ref: library/enum enum Flag9658854
Ref: 8359658854
Ref: library/enum enum Flag __contains__9659141
Ref: 2a469659141
Ref: library/enum enum Flag __or__9660721
Ref: 2a479660721
Ref: library/enum enum Flag __and__9660940
Ref: 2a489660940
Ref: library/enum enum Flag __xor__9661216
Ref: 2a499661216
Ref: library/enum enum Flag _numeric_repr_9661807
Ref: 2a4a9661807
Ref: library/enum enum IntFlag9662331
Ref: e9a9662331
Ref: library/enum enum ReprEnum9664097
Ref: 82e9664097
Ref: library/enum enum EnumCheck9664664
Ref: 8389664664
Ref: library/enum enum EnumCheck UNIQUE9664943
Ref: 2a4b9664943
Ref: library/enum enum EnumCheck CONTINUOUS9665466
Ref: 2a4c9665466
Ref: library/enum enum EnumCheck NAMED_FLAGS9665997
Ref: 2a4d9665997
Ref: library/enum enum FlagBoundary9666976
Ref: 8369666976
Ref: library/enum enum FlagBoundary STRICT9667125
Ref: 2a4e9667125
Ref: library/enum enum FlagBoundary CONFORM9667782
Ref: 2a4f9667782
Ref: library/enum enum FlagBoundary EJECT9668251
Ref: 2a509668251
Ref: library/enum enum FlagBoundary KEEP9668691
Ref: 2a519668691
Ref: library/enum enum EnumDict9669217
Ref: 4f69669217
Ref: library/enum enum EnumDict member_names9669947
Ref: 2a529669947
Node: __dunder__ 名のサポート9670189
Ref: library/enum supported-dunder-names9670306
Ref: 2a539670306
Node: _sunder_ 名のサポート9670788
Ref: library/enum supported-sunder-names9670905
Ref: 2a549670905
Ref: _sunder_ 名のサポート-Footnote-19672885
Node: ユーティリティとデコレータ9672972
Ref: library/enum ipython-s-rich-display9673120
Ref: 2a559673120
Ref: library/enum utilities-and-decorators9673120
Ref: 2a569673120
Ref: library/enum enum auto9673206
Ref: e9b9673206
Ref: library/enum enum property9675001
Ref: 83b9675001
Ref: library/enum enum unique9675525
Ref: 2a2c9675525
Ref: library/enum enum verify9676177
Ref: 8379676177
Ref: library/enum enum member9676453
Ref: 8399676453
Ref: library/enum enum nonmember9676611
Ref: 83a9676611
Ref: library/enum enum global_enum9676775
Ref: 83d9676775
Ref: library/enum enum show_flag_values9677145
Ref: 2a2d9677145
Ref: library/enum enum bin9677321
Ref: 178d9677321
Node: 注釈9677808
Ref: library/enum notes9677932
Ref: 2a2b9677932
Node: graphlib --- グラフ構造を操作する機能9679025
Ref: library/graphlib doc9679165
Ref: 2a579679165
Ref: library/graphlib graphlib-functionality-to-operate-with-graph-like-structures9679165
Ref: 2a589679165
Ref: library/graphlib module-graphlib9679165
Ref: 699679165
Ref: library/graphlib translation-repo9679165
Ref: 2a599679165
Ref: library/graphlib graphlib TopologicalSorter9679384
Ref: ade9679384
Ref: library/graphlib graphlib TopologicalSorter add9683149
Ref: 2a5a9683149
Ref: library/graphlib graphlib TopologicalSorter prepare9684071
Ref: 21f9684071
Ref: library/graphlib graphlib TopologicalSorter is_active9684905
Ref: 2a5b9684905
Ref: library/graphlib graphlib TopologicalSorter done9685859
Ref: 2a5d9685859
Ref: library/graphlib graphlib TopologicalSorter get_ready9686560
Ref: 2a5c9686560
Ref: library/graphlib graphlib TopologicalSorter static_order9687164
Ref: 2a5e9687164
Ref: graphlib --- グラフ構造を操作する機能-Footnote-19688695
Node: 例外<4>9688763
Ref: library/graphlib exceptions9688858
Ref: 2a609688858
Ref: library/graphlib graphlib CycleError9688957
Ref: 2a5f9688957
Node: 数値と数学モジュール9689626
Ref: library/numeric doc9689799
Ref: 2a619689799
Ref: library/numeric numeric9689799
Ref: 2a629689799
Ref: library/numeric numeric-and-mathematical-modules9689799
Ref: 2a639689799
Ref: library/numeric translation-repo9689799
Ref: 2a649689799
Node: numbers --- 数の抽象基底クラス9690980
Ref: library/numbers doc9691116
Ref: 2a659691116
Ref: library/numbers module-numbers9691116
Ref: a29691116
Ref: library/numbers numbers-numeric-abstract-base-classes9691116
Ref: 2a669691116
Ref: library/numbers numbers Number9691540
Ref: 2a679691540
Ref: numbers --- 数の抽象基底クラス-Footnote-19691847
Ref: numbers --- 数の抽象基底クラス-Footnote-29691914
Node: 数値塔9691956
Ref: library/numbers the-numeric-tower9692077
Ref: 2a689692077
Ref: library/numbers numbers Complex9692111
Ref: 25fc9692111
Ref: library/numbers numbers Complex real9692640
Ref: 2a699692640
Ref: library/numbers numbers Complex imag9692744
Ref: 2a6a9692744
Ref: library/numbers numbers Complex conjugate9692848
Ref: 2a6b9692848
Ref: library/numbers numbers Real9693036
Ref: 25f29693036
Ref: library/numbers numbers Rational9693596
Ref: 14d69693596
Ref: library/numbers numbers Rational numerator9694049
Ref: 2a6c9694049
Ref: library/numbers numbers Rational denominator9694141
Ref: 2a6d9694141
Ref: library/numbers numbers Integral9694237
Ref: 240a9694237
Node: Notes for type implementers9694705
Ref: library/numbers notes-for-type-implementers9694826
Ref: 2a6e9694826
Node: さらに数のABCを追加する9695668
Ref: library/numbers adding-more-numeric-abcs9695795
Ref: 2a6f9695795
Node: 算術演算の実装9696303
Ref: library/numbers id19696430
Ref: 2a709696430
Ref: library/numbers implementing-the-arithmetic-operations9696430
Ref: 23329696430
Node: math --- 数学関数9701375
Ref: library/math doc9701557
Ref: 2a719701557
Ref: library/math math-mathematical-functions9701557
Ref: 2a729701557
Ref: library/math module-math9701557
Ref: 929701557
Ref: library/math translation-repo9701557
Ref: 2a739701557
Ref: math --- 数学関数-Footnote-19716256
Ref: math --- 数学関数-Footnote-29716309
Ref: math --- 数学関数-Footnote-39716362
Ref: math --- 数学関数-Footnote-49716415
Node: Number-theoretic functions9716468
Ref: library/math number-theoretic-functions9716586
Ref: 2a849716586
Ref: library/math math comb9716657
Ref: 8df9716657
Ref: library/math math factorial9717284
Ref: b419717284
Ref: library/math math gcd9717486
Ref: b0c9717486
Ref: library/math math isqrt9718048
Ref: bf89718048
Ref: library/math math lcm9718568
Ref: b0d9718568
Ref: library/math math perm9718962
Ref: 8e09718962
Node: Floating point arithmetic9719546
Ref: library/math floating-point-arithmetic9719710
Ref: 2a859719710
Ref: library/math math ceil9719779
Ref: 15d89719779
Ref: library/math math fabs9720042
Ref: 2a749720042
Ref: library/math math floor9720113
Ref: 15d79720113
Ref: library/math math fma9720375
Ref: 5149720375
Ref: library/math math fmod9721060
Ref: 24c89721060
Ref: library/math math modf9722099
Ref: 2a759722099
Ref: library/math math remainder9722570
Ref: d4a9722570
Ref: library/math math trunc9723735
Ref: 15d99723735
Node: Floating point manipulation functions9724712
Ref: library/math floating-point-manipulation-functions9724893
Ref: 2a869724893
Ref: library/math math copysign9724986
Ref: 15ec9724986
Ref: library/math math frexp9725268
Ref: 2a769725268
Ref: library/math math isclose9726018
Ref: fb09726018
Ref: library/math math isfinite9727649
Ref: 14049727649
Ref: library/math math isinf9727908
Ref: 15ea9727908
Ref: library/math math isnan9728079
Ref: 15eb9728079
Ref: library/math math ldexp9728255
Ref: 18409728255
Ref: library/math math nextafter9728401
Ref: 6c09728401
Ref: library/math math ulp9729117
Ref: b0e9729117
Ref: Floating point manipulation functions-Footnote-19730360
Node: Power exponential and logarithmic functions9730402
Ref: library/math power-exponential-and-logarithmic-functions9730589
Ref: 2a879730589
Ref: library/math math cbrt9730696
Ref: 8719730696
Ref: library/math math exp9730796
Ref: 152b9730796
Ref: library/math math exp29731031
Ref: 8709731031
Ref: library/math math expm19731130
Ref: 14059731130
Ref: library/math math log9731747
Ref: 16d99731747
Ref: library/math math log1p9732015
Ref: 15f19732015
Ref: library/math math log29732220
Ref: 12f39732220
Ref: library/math math log109732626
Ref: 19489732626
Ref: library/math math pow9732799
Ref: 8729732799
Ref: library/math math sqrt9733782
Ref: bf99733782
Ref: Power exponential and logarithmic functions-Footnote-19733889
Node: Summation and product functions9733948
Ref: library/math summation-and-product-functions9734110
Ref: 2a889734110
Ref: library/math math dist9734191
Ref: bf59734191
Ref: library/math math fsum9734580
Ref: 15ed9734580
Ref: library/math math hypot9735336
Ref: bf69735336
Ref: library/math math prod9736196
Ref: bf79736196
Ref: library/math math sumprod9736598
Ref: 6bf9736598
Ref: Summation and product functions-Footnote-19737073
Node: 角度変換9737178
Ref: library/math angular-conversion9737309
Ref: 2a899737309
Ref: library/math math degrees9737348
Ref: 2a779737348
Ref: library/math math radians9737441
Ref: 2a789737441
Node: 三角関数9737534
Ref: library/math trigonometric-functions9737649
Ref: 2a8a9737649
Ref: library/math math acos9737688
Ref: 2a799737688
Ref: library/math math asin9737823
Ref: 2a7a9737823
Ref: library/math math atan9737970
Ref: 2a7b9737970
Ref: library/math math atan29738117
Ref: 2a7c9738117
Ref: library/math math cos9738750
Ref: 16d89738750
Ref: library/math math sin9738829
Ref: 16d79738829
Ref: library/math math tan9738908
Ref: 2a7d9738908
Node: 双曲線関数9738987
Ref: library/math hyperbolic-functions9739102
Ref: 2a8b9739102
Ref: library/math math acosh9739259
Ref: 15ee9739259
Ref: library/math math asinh9739340
Ref: 15ef9739340
Ref: library/math math atanh9739421
Ref: 15f09739421
Ref: library/math math cosh9739502
Ref: 2a7e9739502
Ref: library/math math sinh9739579
Ref: 2a7f9739579
Ref: library/math math tanh9739656
Ref: 2a809739656
Ref: 双曲線関数-Footnote-19739769
Node: 特殊関数9739828
Ref: library/math special-functions9739940
Ref: 2a8c9739940
Ref: library/math math erf9739979
Ref: dd39739979
Ref: library/math math erfc9740408
Ref: dd49740408
Ref: library/math math gamma9740710
Ref: 14069740710
Ref: library/math math lgamma9740821
Ref: 14079740821
Ref: 特殊関数-Footnote-19740991
Ref: 特殊関数-Footnote-29741067
Ref: 特殊関数-Footnote-39741138
Ref: 特殊関数-Footnote-49741214
Ref: 特殊関数-Footnote-59741300
Node: 定数<2>9741385
Ref: library/math constants9741473
Ref: 2a8d9741473
Ref: library/math math pi9741504
Ref: 2a819741504
Ref: library/math math e9741615
Ref: 2a829741615
Ref: library/math math tau9741733
Ref: 2a839741733
Ref: library/math math inf9742115
Ref: e7e9742115
Ref: library/math math nan9742324
Ref: 8739742324
Ref: 定数<2>-Footnote-19744338
Ref: 定数<2>-Footnote-29744374
Ref: 定数<2>-Footnote-39744402
Node: cmath --- 複素数用の数学関数9744449
Ref: library/cmath doc9744651
Ref: 2a8e9744651
Ref: library/cmath cmath-mathematical-functions-for-complex-numbers9744651
Ref: 2a8f9744651
Ref: library/cmath module-cmath9744651
Ref: 199744651
Ref: library/cmath translation-repo9744651
Ref: 2a909744651
Node: 極座標変換9752948
Ref: library/cmath conversions-to-and-from-polar-coordinates9753073
Ref: 2aa99753073
Ref: library/cmath cmath phase9753791
Ref: 2a929753791
Ref: library/cmath cmath polar9754533
Ref: 2a939754533
Ref: library/cmath cmath rect9754789
Ref: 2a949754789
Node: 指数関数と対数関数9754971
Ref: library/cmath power-and-logarithmic-functions9755120
Ref: 2aaa9755120
Ref: library/cmath cmath exp9755184
Ref: 2a959755184
Ref: library/cmath cmath log9755306
Ref: 2a969755306
Ref: library/cmath cmath log109755551
Ref: 2a979755551
Ref: library/cmath cmath sqrt9755683
Ref: 2a919755683
Node: 三角関数<2>9755808
Ref: library/cmath trigonometric-functions9755960
Ref: 2aab9755960
Ref: library/cmath cmath acos9755999
Ref: 2a989755999
Ref: library/cmath cmath asin9756218
Ref: 2a999756218
Ref: library/cmath cmath atan9756342
Ref: 2a9a9756342
Ref: library/cmath cmath cos9756589
Ref: 2a9b9756589
Ref: library/cmath cmath sin9756651
Ref: 2a9c9756651
Ref: library/cmath cmath tan9756711
Ref: 2a9d9756711
Node: 双曲線関数<2>9756774
Ref: library/cmath hyperbolic-functions9756911
Ref: 2aac9756911
Ref: library/cmath cmath acosh9756955
Ref: 2a9e9756955
Ref: library/cmath cmath asinh9757120
Ref: 2a9f9757120
Ref: library/cmath cmath atanh9757380
Ref: 2aa09757380
Ref: library/cmath cmath cosh9757629
Ref: 2aa19757629
Ref: library/cmath cmath sinh9757703
Ref: 2aa29757703
Ref: library/cmath cmath tanh9757775
Ref: 2aa39757775
Node: 類別関数9757850
Ref: library/cmath classification-functions9757981
Ref: 2aad9757981
Ref: library/cmath cmath isfinite9758020
Ref: 2aa49758020
Ref: library/cmath cmath isinf9758195
Ref: 2aa59758195
Ref: library/cmath cmath isnan9758347
Ref: 2aa69758347
Ref: library/cmath cmath isclose9758493
Ref: fb19758493
Ref: 類別関数-Footnote-19760151
Node: 定数<3>9760193
Ref: library/cmath constants9760297
Ref: 2aae9760297
Ref: library/cmath cmath pi9760326
Ref: 2aa79760326
Ref: library/cmath cmath e9760414
Ref: 2aa89760414
Ref: library/cmath cmath tau9760509
Ref: e7d9760509
Ref: library/cmath cmath inf9760621
Ref: e7f9760621
Ref: library/cmath cmath infj9760764
Ref: e819760764
Ref: library/cmath cmath nan9760945
Ref: e809760945
Ref: library/cmath cmath nanj9761121
Ref: e829761121
Node: decimal --- 10進固定小数点と浮動小数点の演算9762685
Ref: library/decimal doc9762889
Ref: 2aaf9762889
Ref: library/decimal decimal-decimal-fixed-point-and-floating-point-arithmetic9762889
Ref: 2ab09762889
Ref: library/decimal module-decimal9762889
Ref: 3a9762889
Ref: library/decimal translation-repo9762889
Ref: 2ab19762889
Ref: decimal --- 10進固定小数点と浮動小数点の演算-Footnote-19769429
Ref: decimal --- 10進固定小数点と浮動小数点の演算-Footnote-29769496
Ref: decimal --- 10進固定小数点と浮動小数点の演算-Footnote-39769559
Node: Quick-start tutorial9769613
Ref: library/decimal decimal-tutorial9769764
Ref: 12b19769764
Ref: library/decimal quick-start-tutorial9769764
Ref: 2ac19769764
Node: Decimal オブジェクト9778415
Ref: library/decimal decimal-decimal9778601
Ref: 2ac49778601
Ref: library/decimal decimal-objects9778601
Ref: 2ac59778601
Ref: library/decimal decimal Decimal9778666
Ref: 1fe9778666
Ref: library/decimal decimal Decimal adjusted9784760
Ref: 2ac69784760
Ref: library/decimal decimal Decimal as_integer_ratio9785117
Ref: e929785117
Ref: library/decimal decimal Decimal as_tuple9785613
Ref: 2ac79785613
Ref: library/decimal decimal Decimal canonical9785802
Ref: 2ac89785802
Ref: library/decimal decimal Decimal compare9786118
Ref: 2ac99786118
Ref: library/decimal decimal Decimal compare_signal9786598
Ref: 2aca9786598
Ref: library/decimal decimal Decimal compare_total9787034
Ref: 2acb9787034
Ref: library/decimal decimal Decimal compare_total_mag9788413
Ref: 2acc9788413
Ref: library/decimal decimal Decimal conjugate9789152
Ref: 2acd9789152
Ref: library/decimal decimal Decimal copy_abs9789325
Ref: 2ace9789325
Ref: library/decimal decimal Decimal copy_negate9789564
Ref: 2acf9789564
Ref: library/decimal decimal Decimal copy_sign9789812
Ref: 2ad09789812
Ref: library/decimal decimal Decimal exp9790458
Ref: 12be9790458
Ref: library/decimal decimal Decimal from_float9790882
Ref: 141d9790882
Ref: library/decimal decimal Decimal from_number9792108
Ref: 1fd9792108
Ref: library/decimal decimal Decimal fma9792662
Ref: 2ad19792662
Ref: library/decimal decimal Decimal is_canonical9792954
Ref: 2ad29792954
Ref: library/decimal decimal Decimal is_finite9793323
Ref: 2ad39793323
Ref: library/decimal decimal Decimal is_infinite9793503
Ref: 2ad49793503
Ref: library/decimal decimal Decimal is_nan9793692
Ref: 2ad59793692
Ref: library/decimal decimal Decimal is_normal9793890
Ref: 2ad69793890
Ref: library/decimal decimal Decimal is_qnan9794172
Ref: 2ad79794172
Ref: library/decimal decimal Decimal is_signed9794343
Ref: 2ad89794343
Ref: library/decimal decimal Decimal is_snan9794615
Ref: 2ad99794615
Ref: library/decimal decimal Decimal is_subnormal9794786
Ref: 2ada9794786
Ref: library/decimal decimal Decimal is_zero9794987
Ref: 2adb9794987
Ref: library/decimal decimal Decimal ln9795174
Ref: 12bf9795174
Ref: library/decimal decimal Decimal log109795387
Ref: 2adc9795387
Ref: library/decimal decimal Decimal logb9795590
Ref: 2add9795590
Ref: library/decimal decimal Decimal logical_and9796039
Ref: 2ade9796039
Ref: library/decimal decimal Decimal logical_invert9796311
Ref: 2ae09796311
Ref: library/decimal decimal Decimal logical_or9796490
Ref: 2ae19796490
Ref: library/decimal decimal Decimal logical_xor9796758
Ref: 2ae29796758
Ref: library/decimal decimal Decimal max9797037
Ref: 2ae39797037
Ref: library/decimal decimal Decimal max_mag9797445
Ref: 2ae49797445
Ref: library/decimal decimal Decimal min9797616
Ref: 2ae59797616
Ref: library/decimal decimal Decimal min_mag9798024
Ref: 2ae69798024
Ref: library/decimal decimal Decimal next_minus9798195
Ref: 2ae79798195
Ref: library/decimal decimal Decimal next_plus9798488
Ref: 2ae89798488
Ref: library/decimal decimal Decimal next_toward9798780
Ref: 2ae99798780
Ref: library/decimal decimal Decimal normalize9799145
Ref: 2aea9799145
Ref: library/decimal decimal Decimal number_class9800197
Ref: 2aeb9800197
Ref: library/decimal decimal Decimal quantize9801256
Ref: 12c49801256
Ref: library/decimal decimal Decimal radix9802809
Ref: 2aed9802809
Ref: library/decimal decimal Decimal remainder_near9803062
Ref: 2aee9803062
Ref: library/decimal decimal Decimal rotate9803954
Ref: 2aef9803954
Ref: library/decimal decimal Decimal same_quantum9804646
Ref: 2af09804646
Ref: library/decimal decimal Decimal scaleb9805233
Ref: 2af19805233
Ref: library/decimal decimal Decimal shift9805580
Ref: 2af29805580
Ref: library/decimal decimal Decimal sqrt9806267
Ref: 2af39806267
Ref: library/decimal decimal Decimal to_eng_string9806374
Ref: 2af49806374
Ref: library/decimal decimal Decimal to_integral9806924
Ref: 2af59806924
Ref: library/decimal decimal Decimal to_integral_exact9807189
Ref: 2af79807189
Ref: library/decimal decimal Decimal to_integral_value9807810
Ref: 2af69807810
Node: 論理引数9810404
Ref: library/decimal logical-operands9810479
Ref: 2af89810479
Ref: library/decimal logical-operands-label9810479
Ref: 2adf9810479
Node: Context オブジェクト9810893
Ref: library/decimal context-objects9811068
Ref: 2af99811068
Ref: library/decimal decimal-context9811068
Ref: 27479811068
Ref: library/decimal decimal getcontext9811636
Ref: 19379811636
Ref: library/decimal decimal setcontext9811759
Ref: 2ac29811759
Ref: library/decimal decimal localcontext9812042
Ref: 159e9812042
Ref: library/decimal decimal IEEEContext9813584
Ref: 1ff9813584
Ref: library/decimal decimal BasicContext9814109
Ref: 12b89814109
Ref: library/decimal decimal ExtendedContext9814724
Ref: 12b99814724
Ref: library/decimal decimal DefaultContext9815550
Ref: 12b79815550
Ref: library/decimal decimal Context9817067
Ref: 12c39817067
Ref: library/decimal decimal Context prec9817573
Ref: 2afb9817573
Ref: library/decimal decimal Context rounding9817743
Ref: 2afc9817743
Ref: library/decimal decimal Context traps9817865
Ref: 12c29817865
Ref: library/decimal decimal Context flags9817891
Ref: 12c19817891
Ref: library/decimal decimal Context Emin9818045
Ref: 12bb9818045
Ref: library/decimal decimal Context Emax9818070
Ref: 12ba9818070
Ref: library/decimal decimal Context capitals9818304
Ref: 2afe9818304
Ref: library/decimal decimal Context clamp9818539
Ref: 13b69818539
Ref: library/decimal decimal Context clear_flags9820494
Ref: 2ac39820494
Ref: library/decimal decimal Context clear_traps9820599
Ref: 2aff9820599
Ref: library/decimal decimal Context copy9820740
Ref: 2b009820740
Ref: library/decimal decimal Context copy_decimal9820829
Ref: 2b019820829
Ref: library/decimal decimal Context create_decimal9820948
Ref: 12bd9820948
Ref: library/decimal decimal Context create_decimal_from_float9822522
Ref: 2b029822522
Ref: library/decimal decimal Context Etiny9823393
Ref: 2aec9823393
Ref: library/decimal decimal Context Etop9823666
Ref: 2b039823666
Ref: library/decimal decimal Context abs9824387
Ref: 2b049824387
Ref: library/decimal decimal Context add9824468
Ref: 2b059824468
Ref: library/decimal decimal Context canonical9824554
Ref: 151e9824554
Ref: library/decimal decimal Context compare9824663
Ref: 2b069824663
Ref: library/decimal decimal Context compare_signal9824765
Ref: 2b079824765
Ref: library/decimal decimal Context compare_total9824889
Ref: 2b089824889
Ref: library/decimal decimal Context compare_total_mag9825021
Ref: 2b099825021
Ref: library/decimal decimal Context copy_abs9825175
Ref: 2b0a9825175
Ref: library/decimal decimal Context copy_negate9825291
Ref: 2b0b9825291
Ref: library/decimal decimal Context copy_sign9825401
Ref: 2b0c9825401
Ref: library/decimal decimal Context divide9825505
Ref: 2b0d9825505
Ref: library/decimal decimal Context divide_int9825606
Ref: 2b0e9825606
Ref: library/decimal decimal Context divmod9825735
Ref: 2b0f9825735
Ref: library/decimal decimal Context exp9825863
Ref: 2b109825863
Ref: library/decimal decimal Context fma9825941
Ref: 2b119825941
Ref: library/decimal decimal Context is_canonical9826056
Ref: 151f9826056
Ref: library/decimal decimal Context is_finite9826232
Ref: 2b129826232
Ref: library/decimal decimal Context is_infinite9826391
Ref: 2b139826391
Ref: library/decimal decimal Context is_nan9826552
Ref: 2b149826552
Ref: library/decimal decimal Context is_normal9826719
Ref: 2b159826719
Ref: library/decimal decimal Context is_qnan9826883
Ref: 2b169826883
Ref: library/decimal decimal Context is_signed9827047
Ref: 2b179827047
Ref: library/decimal decimal Context is_snan9827211
Ref: 2b189827211
Ref: library/decimal decimal Context is_subnormal9827375
Ref: 2b199827375
Ref: library/decimal decimal Context is_zero9827545
Ref: 2b1a9827545
Ref: library/decimal decimal Context ln9827705
Ref: 2b1b9827705
Ref: library/decimal decimal Context log109827805
Ref: 2b1c9827805
Ref: library/decimal decimal Context logb9827895
Ref: 2b1d9827895
Ref: library/decimal decimal Context logical_and9828005
Ref: 2b1e9828005
Ref: library/decimal decimal Context logical_invert9828127
Ref: 2b1f9828127
Ref: library/decimal decimal Context logical_or9828228
Ref: 2b209828228
Ref: library/decimal decimal Context logical_xor9828348
Ref: 2b219828348
Ref: library/decimal decimal Context max9828470
Ref: 2b229828470
Ref: library/decimal decimal Context max_mag9828595
Ref: 2b239828595
Ref: library/decimal decimal Context min9828709
Ref: 2b249828709
Ref: library/decimal decimal Context min_mag9828834
Ref: 2b259828834
Ref: library/decimal decimal Context minus9828948
Ref: 2b269828948
Ref: library/decimal decimal Context multiply9829073
Ref: 2b279829073
Ref: library/decimal decimal Context next_minus9829164
Ref: 2b289829164
Ref: library/decimal decimal Context next_plus9829282
Ref: 2b299829282
Ref: library/decimal decimal Context next_toward9829399
Ref: 2b2a9829399
Ref: library/decimal decimal Context normalize9829526
Ref: 2b2b9829526
Ref: library/decimal decimal Context number_class9829625
Ref: 2b2c9829625
Ref: library/decimal decimal Context plus9829736
Ref: 2b2d9829736
Ref: library/decimal decimal Context power9830002
Ref: 2b2e9830002
Ref: library/decimal decimal Context quantize9832050
Ref: 2b2f9832050
Ref: library/decimal decimal Context radix9832180
Ref: 2b309832180
Ref: library/decimal decimal Context remainder9832280
Ref: 2b319832280
Ref: library/decimal decimal Context remainder_near9832480
Ref: 2b329832480
Ref: library/decimal decimal Context rotate9832746
Ref: 2b339832746
Ref: library/decimal decimal Context same_quantum9832853
Ref: 2b349832853
Ref: library/decimal decimal Context scaleb9833003
Ref: 2b359833003
Ref: library/decimal decimal Context shift9833146
Ref: 2b369833146
Ref: library/decimal decimal Context sqrt9833255
Ref: 2b379833255
Ref: library/decimal decimal Context subtract9833361
Ref: 2b389833361
Ref: library/decimal decimal Context to_eng_string9833458
Ref: 2b399833458
Ref: library/decimal decimal Context to_integral_exact9833885
Ref: 2b3a9833885
Ref: library/decimal decimal Context to_sci_string9833988
Ref: 2b3b9833988
Node: 定数<4>9834099
Ref: library/decimal constants9834263
Ref: 2b3c9834263
Ref: library/decimal decimal-rounding-modes9834263
Ref: 2b3d9834263
Ref: library/decimal decimal MAX_PREC9834759
Ref: 12b49834759
Ref: library/decimal decimal MAX_EMAX9834985
Ref: 12b59834985
Ref: library/decimal decimal MIN_EMIN9835211
Ref: 12b69835211
Ref: library/decimal decimal MIN_ETINY9835439
Ref: 2b3e9835439
Ref: library/decimal decimal IEEE_CONTEXT_MAX_BITS9835649
Ref: 2afa9835649
Ref: library/decimal decimal HAVE_THREADS9835782
Ref: 12b29835782
Ref: library/decimal decimal HAVE_CONTEXTVAR9835992
Ref: 21699835992
Node: 丸めモード9836360
Ref: library/decimal rounding-modes9836510
Ref: 2afd9836510
Ref: library/decimal decimal ROUND_CEILING9836554
Ref: 2ab29836554
Ref: library/decimal decimal ROUND_DOWN9836638
Ref: 2ab39836638
Ref: library/decimal decimal ROUND_FLOOR9836710
Ref: 2ab49836710
Ref: library/decimal decimal ROUND_HALF_DOWN9836793
Ref: 2ab59836793
Ref: library/decimal decimal ROUND_HALF_EVEN9836909
Ref: 2ab69836909
Ref: library/decimal decimal ROUND_HALF_UP9837031
Ref: 2ab79837031
Ref: library/decimal decimal ROUND_UP9837157
Ref: 2ab89837157
Ref: library/decimal decimal ROUND_05UP9837239
Ref: 2ab99837239
Node: シグナル9837437
Ref: library/decimal decimal-signals9837598
Ref: 12b09837598
Ref: library/decimal signals9837598
Ref: 2b3f9837598
Ref: library/decimal decimal Clamped9838579
Ref: 2aba9838579
Ref: library/decimal decimal DecimalException9839041
Ref: 2b409839041
Ref: library/decimal decimal DivisionByZero9839194
Ref: 2abb9839194
Ref: library/decimal decimal Inexact9839621
Ref: 2abc9839621
Ref: library/decimal decimal InvalidOperation9840048
Ref: 12bc9840048
Ref: library/decimal decimal Overflow9840676
Ref: 2abf9840676
Ref: library/decimal decimal Rounded9841330
Ref: 2abd9841330
Ref: library/decimal decimal Subnormal9841883
Ref: 2abe9841883
Ref: library/decimal decimal Underflow9842239
Ref: 2ac09842239
Ref: library/decimal decimal FloatOperation9842605
Ref: 12af9842605
Node: Floating-point notes9844119
Ref: library/decimal decimal-notes9844295
Ref: 2b419844295
Ref: library/decimal floating-point-notes9844295
Ref: 2b429844295
Node: 精度を上げて丸め誤差を抑制する9844428
Ref: library/decimal mitigating-round-off-error-with-increased-precision9844548
Ref: 2b439844548
Node: 特殊値9846296
Ref: library/decimal special-values9846416
Ref: 2b449846416
Node: スレッドを使った処理9850268
Ref: library/decimal decimal-threads9850441
Ref: 2b459850441
Ref: library/decimal working-with-threads9850441
Ref: 2b469850441
Node: レシピ9852411
Ref: library/decimal decimal-recipes9852575
Ref: 2b479852575
Ref: library/decimal recipes9852575
Ref: 2b489852575
Node: Decimal FAQ9857460
Ref: library/decimal decimal-faq9857585
Ref: 2b499857585
Ref: library/decimal id19857585
Ref: 2b4a9857585
Ref: Decimal FAQ-Footnote-19866694
Ref: Decimal FAQ-Footnote-29866761
Ref: Decimal FAQ-Footnote-39866792
Ref: Decimal FAQ-Footnote-49866850
Ref: Decimal FAQ-Footnote-59866953
Node: fractions --- 有理数9867070
Ref: library/fractions doc9867275
Ref: 2b4b9867275
Ref: library/fractions fractions-rational-numbers9867275
Ref: 2b4c9867275
Ref: library/fractions module-fractions9867275
Ref: 619867275
Ref: library/fractions translation-repo9867275
Ref: 2b4d9867275
Ref: library/fractions fractions Fraction9867640
Ref: 2139867640
Ref: library/fractions fractions Fraction numerator9872394
Ref: 2b4f9872394
Ref: library/fractions fractions Fraction denominator9872491
Ref: 2b509872491
Ref: library/fractions fractions Fraction as_integer_ratio9872618
Ref: 2b519872618
Ref: library/fractions fractions Fraction is_integer9872867
Ref: 2b529872867
Ref: library/fractions fractions Fraction from_float9872999
Ref: 141e9872999
Ref: library/fractions fractions Fraction from_decimal9873488
Ref: 141f9873488
Ref: library/fractions fractions Fraction from_number9873908
Ref: 2149873908
Ref: library/fractions fractions Fraction limit_denominator9874276
Ref: 2b4e9874276
Ref: library/fractions fractions Fraction __floor__9875178
Ref: 1af79875178
Ref: library/fractions fractions Fraction __ceil__9875491
Ref: 1af69875491
Ref: library/fractions fractions Fraction __round__9875699
Ref: 1af59875699
Ref: library/fractions fractions Fraction __format__9876218
Ref: 2b539876218
Ref: fractions --- 有理数-Footnote-19878551
Ref: fractions --- 有理数-Footnote-29878620
Node: random --- 疑似乱数を生成する9878662
Ref: library/random doc9878844
Ref: 2b549878844
Ref: library/random module-random9878844
Ref: bd9878844
Ref: library/random random-generate-pseudo-random-numbers9878844
Ref: 2b559878844
Ref: library/random translation-repo9878844
Ref: 2b569878844
Ref: random --- 疑似乱数を生成する-Footnote-19882754
Ref: random --- 疑似乱数を生成する-Footnote-29882820
Node: 保守 bookkeeping 関数9882910
Ref: library/random bookkeeping-functions9883043
Ref: 2b589883043
Ref: library/random random seed9883112
Ref: 148b9883112
Ref: library/random random getstate9884515
Ref: 2b599884515
Ref: library/random random setstate9884774
Ref: 2b5a9884774
Node: バイト列用の関数9885066
Ref: library/random functions-for-bytes9885226
Ref: 2b5b9885226
Ref: library/random random randbytes9885285
Ref: 18269885285
Node: 整数用の関数9885629
Ref: library/random functions-for-integers9885791
Ref: 2b5d9885791
Ref: library/random random randrange9885840
Ref: a6b9885840
Ref: library/random random randint9887027
Ref: 14479887027
Ref: library/random random getrandbits9887209
Ref: 120f9887209
Node: シーケンス用の関数9887808
Ref: library/random functions-for-sequences9887968
Ref: 2b5e9887968
Ref: library/random random choice9888032
Ref: 14489888032
Ref: library/random random choices9888237
Ref: ec19888237
Ref: library/random random shuffle9890728
Ref: 94e9890728
Ref: library/random random sample9891645
Ref: 94d9891645
Node: Discrete distributions9893608
Ref: library/random discrete-distributions9893762
Ref: 2b5f9893762
Ref: library/random random binomialvariate9893884
Ref: 6d79893884
Ref: Discrete distributions-Footnote-19894447
Node: 実数分布9894511
Ref: library/random id19894653
Ref: 2b609894653
Ref: library/random real-valued-distributions9894653
Ref: 2b619894653
Ref: library/random random random9894998
Ref: 94f9894998
Ref: library/random random uniform9895125
Ref: 2b629895125
Ref: library/random random triangular9895503
Ref: 2b639895503
Ref: library/random random betavariate9895916
Ref: 2b649895916
Ref: library/random random expovariate9896130
Ref: 6d89896130
Ref: library/random random gammavariate9896597
Ref: 2b659896597
Ref: library/random random gauss9897088
Ref: 1bd89897088
Ref: library/random random lognormvariate9897877
Ref: 2b669897877
Ref: library/random random normalvariate9898214
Ref: 1bd99898214
Ref: library/random random vonmisesvariate9898460
Ref: 2b679898460
Ref: library/random random paretovariate9898845
Ref: 2b689898845
Ref: library/random random weibullvariate9898966
Ref: 2b699898966
Node: 他の生成器9899135
Ref: library/random alternative-generator9899276
Ref: 2b6a9899276
Ref: library/random random Random9899320
Ref: 1c5c9899320
Ref: library/random random Random seed9899891
Ref: 1d6a9899891
Ref: library/random random Random getstate9900070
Ref: 2b6b9900070
Ref: library/random random Random setstate9900240
Ref: 2b6c9900240
Ref: library/random random Random random9900415
Ref: 2b6d9900415
Ref: library/random random Random getrandbits9900669
Ref: 2b6e9900669
Ref: library/random random Random randbytes9900846
Ref: b239900846
Ref: library/random random SystemRandom9901019
Ref: 2b579901019
Node: 再現性について9901687
Ref: library/random notes-on-reproducibility9901828
Ref: 2b6f9901828
Node: 使用例<7>9902707
Ref: library/random examples9902845
Ref: 2b709902845
Ref: library/random random-examples9902845
Ref: 13f59902845
Ref: 使用例<7>-Footnote-19908256
Ref: 使用例<7>-Footnote-29908377
Ref: 使用例<7>-Footnote-39908423
Ref: 使用例<7>-Footnote-49908504
Ref: 使用例<7>-Footnote-59908556
Ref: 使用例<7>-Footnote-69908611
Ref: 使用例<7>-Footnote-79908679
Ref: 使用例<7>-Footnote-89908715
Ref: 使用例<7>-Footnote-99908785
Node: レシピ<2>9908821
Ref: library/random recipes9908974
Ref: 2b719908974
Ref: レシピ<2>-Footnote-19912709
Node: コマンドラインでの使用<2>9912777
Ref: library/random command-line-usage9912945
Ref: 2b729912945
Ref: library/random random-cli9912945
Ref: 47f9912945
Ref: library/random cmdoption-random-h9913253
Ref: 2b739913253
Ref: library/random cmdoption-random-help9913253
Ref: 2b749913253
Ref: library/random cmdoption-random-c9913341
Ref: 2b759913341
Ref: library/random cmdoption-random-choice9913376
Ref: 2b769913376
Ref: library/random cmdoption-random-i9913507
Ref: 2b779913507
Ref: library/random cmdoption-random-integer9913526
Ref: 2b789913526
Ref: library/random cmdoption-random-f9913675
Ref: 2b799913675
Ref: library/random cmdoption-random-float9913694
Ref: 2b7a9913694
Node: コマンドラインの例9914110
Ref: library/random command-line-example9914257
Ref: 2b7b9914257
Ref: library/random random-cli-example9914257
Ref: 2b7c9914257
Node: statistics --- 数学的統計関数9915109
Ref: library/statistics doc9915259
Ref: 2b7d9915259
Ref: library/statistics module-statistics9915259
Ref: d79915259
Ref: library/statistics statistics-mathematical-statistics-functions9915259
Ref: 2b7e9915259
Ref: library/statistics translation-repo9915259
Ref: 2b7f9915259
Ref: statistics --- 数学的統計関数-Footnote-19917933
Ref: statistics --- 数学的統計関数-Footnote-29918003
Ref: statistics --- 数学的統計関数-Footnote-39918029
Node: 平均及び中心位置の測度9918056
Ref: library/statistics averages-and-measures-of-central-location9918186
Ref: 2b809918186
Node: 分散の測度9920019
Ref: library/statistics measures-of-spread9920186
Ref: 2b859920186
Node: 2入力間の関係の統計9920811
Ref: library/statistics statistics-for-relations-between-two-inputs9920960
Ref: 2b879920960
Node: 関数の詳細9921475
Ref: library/statistics function-details9921618
Ref: 2b889921618
Ref: library/statistics statistics mean9921832
Ref: 8e19921832
Ref: library/statistics statistics fmean9923457
Ref: c299923457
Ref: library/statistics statistics geometric_mean9924448
Ref: c2a9924448
Ref: library/statistics statistics harmonic_mean9925138
Ref: edd9925138
Ref: library/statistics statistics kde9926720
Ref: 5539926720
Ref: library/statistics statistics kde_random9928605
Ref: 5549928605
Ref: library/statistics statistics median9929661
Ref: 2b819929661
Ref: library/statistics statistics median_low9930822
Ref: 2b829930822
Ref: library/statistics statistics median_high9931548
Ref: 2b839931548
Ref: library/statistics statistics median_grouped9932268
Ref: 2b849932268
Ref: library/statistics statistics mode9934180
Ref: c859934180
Ref: library/statistics statistics multimode9935745
Ref: c2b9935745
Ref: library/statistics statistics pstdev9936167
Ref: 17b09936167
Ref: library/statistics statistics pvariance9936446
Ref: 2b869936446
Ref: library/statistics statistics stdev9938739
Ref: 8e39938739
Ref: library/statistics statistics variance9939023
Ref: 8e29939023
Ref: library/statistics statistics quantiles9941379
Ref: c2c9941379
Ref: library/statistics statistics covariance9944363
Ref: a319944363
Ref: library/statistics statistics correlation9944980
Ref: 6e39944980
Ref: library/statistics statistics linear_regression9947067
Ref: a329947067
Ref: 関数の詳細-Footnote-19949660
Ref: 関数の詳細-Footnote-29949708
Ref: 関数の詳細-Footnote-39949754
Ref: 関数の詳細-Footnote-49949809
Ref: 関数の詳細-Footnote-59949905
Ref: 関数の詳細-Footnote-69949963
Ref: 関数の詳細-Footnote-79950035
Ref: 関数の詳細-Footnote-89950086
Ref: 関数の詳細-Footnote-99950156
Ref: 関数の詳細-Footnote-109950237
Ref: 関数の詳細-Footnote-119950310
Ref: 関数の詳細-Footnote-129950374
Node: 例外<5>9950432
Ref: library/statistics exceptions9950576
Ref: 2b8a9950576
Ref: library/statistics statistics StatisticsError9950645
Ref: 2b899950645
Node: NormalDist オブジェクト9950760
Ref: library/statistics normaldist-objects9950907
Ref: 2b8b9950907
Ref: library/statistics statistics NormalDist9951311
Ref: c2d9951311
Ref: library/statistics statistics NormalDist mean9951601
Ref: 2b8c9951601
Ref: library/statistics statistics NormalDist median9951722
Ref: 2b8d9951722
Ref: library/statistics statistics NormalDist mode9951836
Ref: 2b8e9951836
Ref: library/statistics statistics NormalDist stdev9951936
Ref: 2b8f9951936
Ref: library/statistics statistics NormalDist variance9952061
Ref: 2b909952061
Ref: library/statistics statistics NormalDist from_samples9952227
Ref: 2b919952227
Ref: library/statistics statistics NormalDist samples9952841
Ref: 2b929952841
Ref: library/statistics statistics NormalDist pdf9953467
Ref: 2b939953467
Ref: library/statistics statistics NormalDist cdf9954070
Ref: 18529954070
Ref: library/statistics statistics NormalDist inv_cdf9954319
Ref: 2b949954319
Ref: library/statistics statistics NormalDist overlap9954764
Ref: 2b959954764
Ref: library/statistics statistics NormalDist quantiles9955026
Ref: 2b969955026
Ref: library/statistics statistics NormalDist zscore9955487
Ref: 2b979955487
Ref: NormalDist オブジェクト-Footnote-19956916
Ref: NormalDist オブジェクト-Footnote-29956980
Ref: NormalDist オブジェクト-Footnote-39957040
Ref: NormalDist オブジェクト-Footnote-49957094
Ref: NormalDist オブジェクト-Footnote-59957151
Ref: NormalDist オブジェクト-Footnote-69957205
Ref: NormalDist オブジェクト-Footnote-79957250
Ref: NormalDist オブジェクト-Footnote-89957306
Ref: NormalDist オブジェクト-Footnote-99957363
Ref: NormalDist オブジェクト-Footnote-109957410
Ref: NormalDist オブジェクト-Footnote-119957478
Ref: NormalDist オブジェクト-Footnote-129957550
Ref: NormalDist オブジェクト-Footnote-139957607
Ref: NormalDist オブジェクト-Footnote-149957742
Ref: NormalDist オブジェクト-Footnote-159957789
Ref: NormalDist オブジェクト-Footnote-169957867
Node: 例とレシピ<2>9957952
Ref: library/statistics examples-and-recipes9958081
Ref: 2b989958081
Node: Classic probability problems9958278
Ref: library/statistics classic-probability-problems9958404
Ref: 2b999958404
Ref: Classic probability problems-Footnote-19959231
Ref: Classic probability problems-Footnote-29959302
Ref: Classic probability problems-Footnote-39959349
Node: Monte Carlo inputs for simulations9959394
Ref: library/statistics monte-carlo-inputs-for-simulations9959565
Ref: 2b9a9959565
Ref: Monte Carlo inputs for simulations-Footnote-19960253
Node: Approximating binomial distributions9960310
Ref: library/statistics approximating-binomial-distributions9960478
Ref: 2b9b9960478
Ref: Approximating binomial distributions-Footnote-19961908
Node: Naive bayesian classifier9961972
Ref: library/statistics naive-bayesian-classifier9962097
Ref: 2b9c9962097
Ref: Naive bayesian classifier-Footnote-19963988
Ref: Naive bayesian classifier-Footnote-29964072
Ref: Naive bayesian classifier-Footnote-39964128
Node: 関数型プログラミング用モジュール9964198
Ref: library/functional doc9964410
Ref: 2b9d9964410
Ref: library/functional functional-programming-modules9964410
Ref: 2b9e9964410
Ref: library/functional translation-repo9964410
Ref: 2b9f9964410
Node: itertools --- 効率的なループ用のイテレータ生成関数群9965147
Ref: library/itertools doc9965386
Ref: 2ba09965386
Ref: library/itertools itertools-functions-creating-iterators-for-efficient-looping9965386
Ref: 2ba19965386
Ref: library/itertools module-itertools9965386
Ref: 859965386
Node: Itertool関数9976757
Ref: library/itertools itertool-functions9976907
Ref: 2ba89976907
Ref: library/itertools itertools-functions9976907
Ref: 2ba99976907
Ref: library/itertools itertools accumulate9977137
Ref: bf09977137
Ref: library/itertools itertools batched9979622
Ref: 5119979622
Ref: library/itertools itertools chain9981184
Ref: 25de9981184
Ref: library/itertools itertools chain from_iterable9981664
Ref: 2ba39981664
Ref: library/itertools itertools combinations9982160
Ref: 15299982160
Ref: library/itertools itertools combinations_with_replacement9983785
Ref: 14999983785
Ref: library/itertools itertools compress9985384
Ref: 149a9985384
Ref: library/itertools itertools count9985882
Ref: 149b9985882
Ref: library/itertools itertools cycle9986743
Ref: 2ba29986743
Ref: library/itertools itertools dropwhile9987447
Ref: 2ba49987447
Ref: library/itertools itertools filterfalse9988155
Ref: 25ce9988155
Ref: library/itertools itertools groupby9988741
Ref: 2ba59988741
Ref: library/itertools itertools islice9991720
Ref: d439991720
Ref: library/itertools itertools pairwise9993496
Ref: a169993496
Ref: library/itertools itertools permutations9994120
Ref: 1cdd9994120
Ref: library/itertools itertools product9996216
Ref: 152a9996216
Ref: library/itertools itertools repeat9998110
Ref: 18599998110
Ref: library/itertools itertools starmap9998821
Ref: 12fa9998821
Ref: library/itertools itertools takewhile9999466
Ref: 2ba69999466
Ref: library/itertools itertools tee10000270
Ref: 2ba710000270
Ref: library/itertools itertools zip_longest10003160
Ref: 14b610003160
Ref: Itertool関数-Footnote-110004676
Ref: Itertool関数-Footnote-210004750
Ref: Itertool関数-Footnote-310004805
Ref: Itertool関数-Footnote-410004861
Node: Itertools レシピ10004959
Ref: library/itertools id110005109
Ref: 2bab10005109
Ref: library/itertools itertools-recipes10005109
Ref: 147610005109
Ref: Itertools レシピ-Footnote-110019815
Ref: Itertools レシピ-Footnote-210019864
Node: functools --- 高階関数と呼び出し可能オブジェクトの操作10019935
Ref: library/functools doc10020226
Ref: 2bac10020226
Ref: library/functools functools-higher-order-functions-and-operations-on-callable-objects10020226
Ref: 2bad10020226
Ref: library/functools module-functools10020226
Ref: 6310020226
Ref: library/functools translation-repo10020226
Ref: 2bae10020226
Ref: library/functools functools cache10020752
Ref: 17c810020752
Ref: library/functools functools cached_property10022031
Ref: 76310022031
Ref: library/functools functools cmp_to_key10025994
Ref: 13f210025994
Ref: library/functools functools lru_cache10027243
Ref: be210027243
Ref: library/functools functools lru_cache cache_info10030163
Ref: 2bb010030163
Ref: library/functools functools lru_cache cache_clear10030428
Ref: 2bb110030428
Ref: library/functools functools total_ordering10033337
Ref: 114410033337
Ref: library/functools functools Placeholder10035874
Ref: 21610035874
Ref: library/functools functools partial10036106
Ref: 21710036106
Ref: library/functools functools partialmethod10039367
Ref: 21810039367
Ref: library/functools functools reduce10041427
Ref: 21a10041427
Ref: library/functools functools singledispatch10042809
Ref: 84b10042809
Ref: library/functools functools singledispatch register10043441
Ref: 2bb210043441
Ref: library/functools functools singledispatchmethod10049502
Ref: be510049502
Ref: library/functools functools update_wrapper10051259
Ref: 122310051259
Ref: library/functools functools wraps10054150
Ref: 115f10054150
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-110055481
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-210055550
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-310055600
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-410055642
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-510055734
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-610055788
Ref: functools --- 高階関数と呼び出し可能オブジェクトの操作-Footnote-710055848
Node: partial オブジェクト10055913
Ref: library/functools id110056050
Ref: 2bb410056050
Ref: library/functools partial-objects10056050
Ref: 21910056050
Ref: library/functools functools partial func10056344
Ref: 2bb510056344
Ref: library/functools functools partial args10056594
Ref: 2bb610056594
Ref: library/functools functools partial keywords10056792
Ref: 2bb710056792
Node: operator --- 関数形式の標準演算子10057223
Ref: library/operator doc10057434
Ref: 2bb810057434
Ref: library/operator module-operator10057434
Ref: a310057434
Ref: library/operator operator-standard-operators-as-functions10057434
Ref: 2bb910057434
Ref: library/operator translation-repo10057434
Ref: 2bba10057434
Ref: library/operator operator lt10058401
Ref: 2bbb10058401
Ref: library/operator operator le10058435
Ref: 2bbc10058435
Ref: library/operator operator eq10058469
Ref: 2bbd10058469
Ref: library/operator operator ne10058503
Ref: 2bbe10058503
Ref: library/operator operator ge10058537
Ref: 2bbf10058537
Ref: library/operator operator gt10058571
Ref: 2bc010058571
Ref: library/operator operator __lt__10058605
Ref: 2bc110058605
Ref: library/operator operator __le__10058643
Ref: 2bc210058643
Ref: library/operator operator __eq__10058681
Ref: 2bc310058681
Ref: library/operator operator __ne__10058719
Ref: 2bc410058719
Ref: library/operator operator __ge__10058757
Ref: 2bc510058757
Ref: library/operator operator __gt__10058795
Ref: 2bc610058795
Ref: library/operator operator not_10059582
Ref: 2bc710059582
Ref: library/operator operator __not__10059617
Ref: 2bc810059617
Ref: library/operator operator truth10060028
Ref: 2bc910060028
Ref: library/operator operator is_10060279
Ref: 2bca10060279
Ref: library/operator operator is_not10060404
Ref: 2bcb10060404
Ref: library/operator operator is_none10060536
Ref: 25510060536
Ref: library/operator operator is_not_none10060656
Ref: 25610060656
Ref: library/operator operator abs10060868
Ref: 2bcc10060868
Ref: library/operator operator __abs__10060902
Ref: 2bcd10060902
Ref: library/operator operator add10060984
Ref: 2bce10060984
Ref: library/operator operator __add__10061019
Ref: 2bcf10061019
Ref: library/operator operator and_10061134
Ref: 2bd010061134
Ref: library/operator operator __and__10061170
Ref: 2bd110061170
Ref: library/operator operator floordiv10061274
Ref: 2bd210061274
Ref: library/operator operator __floordiv__10061314
Ref: 2bd310061314
Ref: library/operator operator index10061397
Ref: 1cd210061397
Ref: library/operator operator __index__10061431
Ref: 2bd410061431
Ref: library/operator operator inv10061762
Ref: 2bd510061762
Ref: library/operator operator invert10061796
Ref: 2bd610061796
Ref: library/operator operator __inv__10061833
Ref: 2bd710061833
Ref: library/operator operator __invert__10061871
Ref: 2bd810061871
Ref: library/operator operator lshift10061997
Ref: 2bd910061997
Ref: library/operator operator __lshift__10062035
Ref: 2bda10062035
Ref: library/operator operator mod10062136
Ref: 2bdb10062136
Ref: library/operator operator __mod__10062171
Ref: 2bdc10062171
Ref: library/operator operator mul10062248
Ref: 2baa10062248
Ref: library/operator operator __mul__10062283
Ref: 2bdd10062283
Ref: library/operator operator matmul10062398
Ref: 103510062398
Ref: library/operator operator __matmul__10062436
Ref: 2bde10062436
Ref: library/operator operator neg10062544
Ref: 2bdf10062544
Ref: library/operator operator __neg__10062578
Ref: 2be010062578
Ref: library/operator operator or_10062668
Ref: 2be110062668
Ref: library/operator operator __or__10062703
Ref: 2be210062703
Ref: library/operator operator pos10062806
Ref: 2be310062806
Ref: library/operator operator __pos__10062840
Ref: 2be410062840
Ref: library/operator operator pow10062930
Ref: 2be510062930
Ref: library/operator operator __pow__10062965
Ref: 2be610062965
Ref: library/operator operator rshift10063081
Ref: 2be710063081
Ref: library/operator operator __rshift__10063119
Ref: 2be810063119
Ref: library/operator operator sub10063220
Ref: 2be910063220
Ref: library/operator operator __sub__10063255
Ref: 2bea10063255
Ref: library/operator operator truediv10063332
Ref: 2beb10063332
Ref: library/operator operator __truediv__10063371
Ref: 2bec10063371
Ref: library/operator operator xor10063557
Ref: 2bed10063557
Ref: library/operator operator __xor__10063592
Ref: 2bee10063592
Ref: library/operator operator concat10063856
Ref: 2bef10063856
Ref: library/operator operator __concat__10063894
Ref: 2bf010063894
Ref: library/operator operator contains10064021
Ref: ad710064021
Ref: library/operator operator __contains__10064061
Ref: 2bf110064061
Ref: library/operator operator countOf10064237
Ref: ad910064237
Ref: library/operator operator delitem10064341
Ref: 2bf210064341
Ref: library/operator operator __delitem__10064380
Ref: 2bf310064380
Ref: library/operator operator getitem10064488
Ref: 2bf410064488
Ref: library/operator operator __getitem__10064527
Ref: 2bf510064527
Ref: library/operator operator indexOf10064632
Ref: ad810064632
Ref: library/operator operator setitem10064757
Ref: 2bf610064757
Ref: library/operator operator __setitem__10064799
Ref: 2bf710064799
Ref: library/operator operator length_hint10064918
Ref: 116f10064918
Ref: library/operator operator call10065339
Ref: 1c2210065339
Ref: library/operator operator __call__10065394
Ref: 2bf810065394
Ref: library/operator operator attrgetter10065817
Ref: 103310065817
Ref: library/operator operator itemgetter10067275
Ref: c5710067275
Ref: library/operator operator methodcaller10069329
Ref: 103410069329
Ref: operator --- 関数形式の標準演算子-Footnote-110070322
Node: 演算子から関数への対応表10070390
Ref: library/operator mapping-operators-to-functions10070552
Ref: 2bf910070552
Ref: library/operator operator-map10070552
Ref: 2bfa10070552
Node: インプレース in-place 演算子10078541
Ref: library/operator in-place-operators10078703
Ref: 2bfb10078703
Ref: library/operator operator iadd10080218
Ref: 2bfd10080218
Ref: library/operator operator __iadd__10080254
Ref: 2bfe10080254
Ref: library/operator operator iand10080358
Ref: 2bff10080358
Ref: library/operator operator __iand__10080394
Ref: 2c0010080394
Ref: library/operator operator iconcat10080498
Ref: 2c0110080498
Ref: library/operator operator __iconcat__10080537
Ref: 2c0210080537
Ref: library/operator operator ifloordiv10080699
Ref: 2c0310080699
Ref: library/operator operator __ifloordiv__10080740
Ref: 2c0410080740
Ref: library/operator operator ilshift10080855
Ref: 2c0510080855
Ref: library/operator operator __ilshift__10080894
Ref: 2c0610080894
Ref: library/operator operator imod10081005
Ref: 2c0710081005
Ref: library/operator operator __imod__10081041
Ref: 2c0810081041
Ref: library/operator operator imul10081145
Ref: 2c0910081145
Ref: library/operator operator __imul__10081181
Ref: 2c0a10081181
Ref: library/operator operator imatmul10081285
Ref: 103610081285
Ref: library/operator operator __imatmul__10081324
Ref: 2c0b10081324
Ref: library/operator operator ior10081462
Ref: 2c0c10081462
Ref: library/operator operator __ior__10081497
Ref: 2c0d10081497
Ref: library/operator operator ipow10081599
Ref: 2c0e10081599
Ref: library/operator operator __ipow__10081635
Ref: 2c0f10081635
Ref: library/operator operator irshift10081740
Ref: 2c1010081740
Ref: library/operator operator __irshift__10081779
Ref: 2c1110081779
Ref: library/operator operator isub10081890
Ref: 2c1210081890
Ref: library/operator operator __isub__10081926
Ref: 2c1310081926
Ref: library/operator operator itruediv10082030
Ref: 2c1410082030
Ref: library/operator operator __itruediv__10082070
Ref: 2c1510082070
Ref: library/operator operator ixor10082182
Ref: 2c1610082182
Ref: library/operator operator __ixor__10082218
Ref: 2c1710082218
Node: ファイルとディレクトリへのアクセス10082322
Ref: library/filesys doc10082525
Ref: 2c1810082525
Ref: library/filesys file-and-directory-access10082525
Ref: 2c1910082525
Ref: library/filesys filesys10082525
Ref: 2c1a10082525
Ref: library/filesys translation-repo10082525
Ref: 2c1b10082525
Node: pathlib --- オブジェクト指向のファイルシステムパス10083959
Ref: library/pathlib doc10084164
Ref: 2c1c10084164
Ref: library/pathlib module-pathlib10084164
Ref: a810084164
Ref: library/pathlib pathlib-object-oriented-filesystem-paths10084164
Ref: 2c1d10084164
Ref: pathlib --- オブジェクト指向のファイルシステムパス-Footnote-110086954
Ref: pathlib --- オブジェクト指向のファイルシステムパス-Footnote-210087019
Node: 基本的な使い方<2>10087061
Ref: library/pathlib basic-use10087209
Ref: 2c2110087209
Node: 例外<6>10088318
Ref: library/pathlib exceptions10088487
Ref: 2c2210088487
Ref: library/pathlib pathlib UnsupportedOperation10088518
Ref: 53310088518
Node: 純粋パス10088772
Ref: library/pathlib id110088929
Ref: 2c2310088929
Ref: library/pathlib pure-paths10088929
Ref: 2c1e10088929
Ref: library/pathlib pathlib PurePath10089231
Ref: 6cd10089231
Ref: library/pathlib pathlib PurePosixPath10092218
Ref: 2c2410092218
Ref: library/pathlib pathlib PureWindowsPath10092551
Ref: 1a7510092551
Ref: 純粋パス-Footnote-110093387
Node: 全般的な性質10093446
Ref: library/pathlib general-properties10093531
Ref: 2c2510093531
Node: 演算子10094694
Ref: library/pathlib operators10094827
Ref: 2c2610094827
Node: 個別の構成要素へのアクセス10096792
Ref: library/pathlib accessing-individual-parts10096937
Ref: 2c2710096937
Ref: library/pathlib pathlib PurePath parts10097133
Ref: 2c2810097133
Node: メソッドとプロパティ10097593
Ref: library/pathlib methods-and-properties10097720
Ref: 2c2910097720
Ref: library/pathlib pathlib PurePath parser10097866
Ref: 53610097866
Ref: library/pathlib pathlib PurePath drive10098088
Ref: 2c2a10098088
Ref: library/pathlib pathlib PurePath root10098553
Ref: 2c2b10098553
Ref: library/pathlib pathlib PurePath anchor10099741
Ref: 2c2c10099741
Ref: library/pathlib pathlib PurePath parents10100132
Ref: a2110100132
Ref: library/pathlib pathlib PurePath parent10100712
Ref: 1a9d10100712
Ref: library/pathlib pathlib PurePath name10101685
Ref: 2c2d10101685
Ref: library/pathlib pathlib PurePath suffix10102124
Ref: 195710102124
Ref: library/pathlib pathlib PurePath suffixes10102634
Ref: 195810102634
Ref: library/pathlib pathlib PurePath stem10103077
Ref: 2c2e10103077
Ref: library/pathlib pathlib PurePath as_posix10103499
Ref: 2c2f10103499
Ref: library/pathlib pathlib PurePath is_absolute10103787
Ref: 1a9c10103787
Ref: library/pathlib pathlib PurePath is_relative_to10104450
Ref: 2fe10104450
Ref: library/pathlib pathlib PurePath is_reserved10105227
Ref: 32a10105227
Ref: library/pathlib pathlib PurePath joinpath10105882
Ref: 2c3010105882
Ref: library/pathlib pathlib PurePath full_match10106501
Ref: 53510106501
Ref: library/pathlib pathlib PurePath match10107489
Ref: 6d310107489
Ref: library/pathlib pathlib PurePath relative_to10108474
Ref: 2fd10108474
Ref: library/pathlib pathlib PurePath with_name10110865
Ref: 1a6810110865
Ref: library/pathlib pathlib PurePath with_stem10111655
Ref: 19dc10111655
Ref: library/pathlib pathlib PurePath with_suffix10112749
Ref: 195610112749
Ref: library/pathlib pathlib PurePath with_segments10113649
Ref: 6ce10113649
Ref: メソッドとプロパティ-Footnote-110114591
Node: 具象パス10114683
Ref: library/pathlib concrete-paths10114847
Ref: 2c1f10114847
Ref: library/pathlib id210114847
Ref: 2c3210114847
Ref: library/pathlib pathlib Path10115184
Ref: 26610115184
Ref: library/pathlib pathlib PosixPath10115631
Ref: 2c3310115631
Ref: library/pathlib pathlib WindowsPath10116209
Ref: 2c2010116209
Node: URIのパースと生成10118043
Ref: library/pathlib parsing-and-generating-uris10118149
Ref: 2c3410118149
Ref: library/pathlib pathlib Path from_uri10118425
Ref: 53410118425
Ref: library/pathlib pathlib Path as_uri10119764
Ref: 31c10119764
Ref: URIのパースと生成-Footnote-110120434
Node: パスの展開と解決10120493
Ref: library/pathlib expanding-and-resolving-paths10120668
Ref: 2c3610120668
Ref: library/pathlib pathlib Path home10120731
Ref: 104310120731
Ref: library/pathlib pathlib Path expanduser10121164
Ref: 104210121164
Ref: library/pathlib pathlib Path cwd10121652
Ref: 1a9b10121652
Ref: library/pathlib pathlib Path absolute10121901
Ref: 1a2610121901
Ref: library/pathlib pathlib Path resolve10122254
Ref: 1a6d10122254
Ref: library/pathlib pathlib Path readlink10123513
Ref: b1910123513
Node: ファイルの種類とステータスを問い合わせる10124071
Ref: library/pathlib querying-file-type-and-status10124258
Ref: 2c3710124258
Ref: library/pathlib pathlib Path stat10125209
Ref: a2410125209
Ref: library/pathlib pathlib Path lstat10126011
Ref: 2c3810126011
Ref: library/pathlib pathlib Path exists10126270
Ref: c0b10126270
Ref: library/pathlib pathlib Path is_file10127119
Ref: 53910127119
Ref: library/pathlib pathlib Path is_dir10127763
Ref: 53a10127763
Ref: library/pathlib pathlib Path is_symlink10128430
Ref: c0d10128430
Ref: library/pathlib pathlib Path is_junction10128784
Ref: 6d210128784
Ref: library/pathlib pathlib Path is_mount10129083
Ref: c0c10129083
Ref: library/pathlib pathlib Path is_socket10130090
Ref: c1110130090
Ref: library/pathlib pathlib Path is_fifo10130402
Ref: c1010130402
Ref: library/pathlib pathlib Path is_block_device10130696
Ref: c0e10130696
Ref: library/pathlib pathlib Path is_char_device10131016
Ref: c0f10131016
Ref: library/pathlib pathlib Path samefile10131343
Ref: 104010131343
Ref: library/pathlib pathlib Path info10132045
Ref: 26b10132045
Node: ファイルを読み書きする<2>10133296
Ref: library/pathlib reading-and-writing-files10133486
Ref: 2c3910133486
Ref: library/pathlib pathlib Path open10133564
Ref: 2c3a10133564
Ref: library/pathlib pathlib Path read_text10133937
Ref: 104510133937
Ref: library/pathlib pathlib Path read_bytes10134533
Ref: 2df10134533
Ref: library/pathlib pathlib Path write_text10134862
Ref: 104410134862
Ref: library/pathlib pathlib Path write_bytes10135539
Ref: 104610135539
Node: ディレクトリを読む10135986
Ref: library/pathlib reading-directories10136158
Ref: 2c3b10136158
Ref: library/pathlib pathlib Path iterdir10136226
Ref: 26e10136226
Ref: library/pathlib pathlib Path glob10137238
Ref: 53710137238
Ref: library/pathlib pathlib Path rglob10139699
Ref: 53810139699
Ref: library/pathlib pathlib Path walk10140706
Ref: 6cf10140706
Node: ファイルとディレクトリの作成10145772
Ref: library/pathlib creating-files-and-directories10145935
Ref: 2c3d10145935
Ref: library/pathlib pathlib Path touch10146028
Ref: 2c3e10146028
Ref: library/pathlib pathlib Path mkdir10146759
Ref: 104110146759
Ref: library/pathlib pathlib Path symlink_to10148099
Ref: a2310148099
Ref: library/pathlib pathlib Path hardlink_to10149527
Ref: a2210149527
Node: Copying moving and deleting10150047
Ref: library/pathlib copying-moving-and-deleting10150216
Ref: 2c3f10150216
Ref: library/pathlib pathlib Path copy10150295
Ref: 26710150295
Ref: library/pathlib pathlib Path copy_into10151454
Ref: 26810151454
Ref: library/pathlib pathlib Path rename10151837
Ref: 189110151837
Ref: library/pathlib pathlib Path replace10153084
Ref: 2c4010153084
Ref: library/pathlib pathlib Path move10153810
Ref: 26910153810
Ref: library/pathlib pathlib Path move_into10154493
Ref: 26a10154493
Ref: library/pathlib pathlib Path unlink10154749
Ref: 1dd510154749
Ref: library/pathlib pathlib Path rmdir10155413
Ref: 2c3c10155413
Node: パーミッションと所有者10155564
Ref: library/pathlib permissions-and-ownership10155682
Ref: 2c4110155682
Ref: library/pathlib pathlib Path owner10155760
Ref: 53b10155760
Ref: library/pathlib pathlib Path group10156619
Ref: 53c10156619
Ref: library/pathlib pathlib Path chmod10157481
Ref: a2510157481
Ref: library/pathlib pathlib Path lchmod10158289
Ref: 2c4210158289
Node: Pattern language10158563
Ref: library/pathlib pathlib-pattern-language10158747
Ref: 2c3110158747
Ref: library/pathlib pattern-language10158747
Ref: 2c4310158747
Node: glob モジュールとの比較10161302
Ref: library/pathlib comparison-to-the-glob-module10161513
Ref: 2c4410161513
Node: os と os path モジュールの比較10162942
Ref: library/pathlib comparison-to-the-os-and-os-path-modules10163152
Ref: 2c4510163152
Node: 対応するツール10165312
Ref: library/pathlib corresponding-tools10165409
Ref: 2c4610165409
Ref: 対応するツール-Footnote-110170725
Ref: 対応するツール-Footnote-210171033
Ref: 対応するツール-Footnote-310171213
Ref: 対応するツール-Footnote-410171435
Node: プロトコル10171667
Ref: library/pathlib module-pathlib types10171836
Ref: a910171836
Ref: library/pathlib protocols10171836
Ref: 2c4910171836
Ref: library/pathlib pathlib types PathInfo10171981
Ref: 26c10171981
Ref: library/pathlib pathlib types PathInfo exists10172177
Ref: 2c4a10172177
Ref: library/pathlib pathlib types PathInfo is_dir10172532
Ref: 2c4b10172532
Ref: library/pathlib pathlib types PathInfo is_file10173047
Ref: 2c4c10173047
Ref: library/pathlib pathlib types PathInfo is_symlink10173562
Ref: 2c4d10173562
Node: os path --- 一般的なパス名操作10173789
Ref: library/os path doc10174041
Ref: 2c4e10174041
Ref: library/os path module-os path10174041
Ref: a610174041
Ref: library/os path os-path-common-pathname-manipulations10174041
Ref: 2c4f10174041
Ref: library/os path translation-repo10174041
Ref: 2c5010174041
Ref: library/os path os path abspath10176482
Ref: 153210176482
Ref: library/os path os path basename10176903
Ref: 2c4810176903
Ref: library/os path os path commonpath10177517
Ref: 103d10177517
Ref: library/os path os path commonprefix10178141
Ref: 103e10178141
Ref: library/os path os path dirname10178978
Ref: 2c4710178978
Ref: library/os path os path exists10179323
Ref: c0310179323
Ref: library/os path os path lexists10180210
Ref: c0410180210
Ref: library/os path os path expanduser10180552
Ref: c0910180552
Ref: library/os path os path expandvars10181970
Ref: 15f210181970
Ref: library/os path os path getatime10182607
Ref: 2c5210182607
Ref: library/os path os path getmtime10182911
Ref: 2c5310182911
Ref: library/os path os path getctime10183339
Ref: 2c5410183339
Ref: library/os path os path getsize10183979
Ref: 2c5510183979
Ref: library/os path os path isabs10184330
Ref: 53110184330
Ref: library/os path os path isfile10184886
Ref: c0610184886
Ref: library/os path os path isdir10185341
Ref: c0510185341
Ref: library/os path os path isjunction10185797
Ref: 6ca10185797
Ref: library/os path os path islink10186065
Ref: c0110186065
Ref: library/os path os path ismount10186519
Ref: c0710186519
Ref: library/os path os path isdevdrive10187588
Ref: 19c210187588
Ref: library/os path os path isreserved10188432
Ref: 32b10188432
Ref: library/os path os path join10189290
Ref: 19a910189290
Ref: library/os path os path normcase10190791
Ref: 2c5610190791
Ref: library/os path os path normpath10191247
Ref: 153110191247
Ref: library/os path os path realpath10192338
Ref: 26210192338
Ref: library/os path os path ALLOW_MISSING10194704
Ref: 26310194704
Ref: library/os path os path relpath10194853
Ref: 6d110194853
Ref: library/os path os path samefile10195530
Ref: 117310195530
Ref: library/os path os path sameopenfile10196266
Ref: 2c5810196266
Ref: library/os path os path samestat10196639
Ref: 117210196639
Ref: library/os path os path split10197182
Ref: 2c5110197182
Ref: library/os path os path splitdrive10198044
Ref: def10198044
Ref: library/os path os path splitroot10199038
Ref: 6cb10199038
Ref: library/os path os path splitext10200309
Ref: 195910200309
Ref: library/os path os path supports_unicode_filenames10201324
Ref: 16a710201324
Ref: os path --- 一般的なパス名操作-Footnote-110201557
Ref: os path --- 一般的なパス名操作-Footnote-210201628
Ref: os path --- 一般的なパス名操作-Footnote-310201697
Ref: os path --- 一般的なパス名操作-Footnote-410201763
Ref: os path --- 一般的なパス名操作-Footnote-510201818
Ref: os path --- 一般的なパス名操作-Footnote-610201910
Node: stat --- stat の結果を解釈する10202002
Ref: library/stat doc10202239
Ref: 2c5910202239
Ref: library/stat module-stat10202239
Ref: d610202239
Ref: library/stat stat-interpreting-stat-results10202239
Ref: 2c5a10202239
Ref: library/stat translation-repo10202239
Ref: 2c5b10202239
Ref: library/stat stat S_ISDIR10202956
Ref: 2c5c10202956
Ref: library/stat stat S_ISCHR10203092
Ref: 2c5d10203092
Ref: library/stat stat S_ISBLK10203267
Ref: 2c5e10203267
Ref: library/stat stat S_ISREG10203439
Ref: 2c5f10203439
Ref: library/stat stat S_ISFIFO10203575
Ref: 2c6010203575
Ref: library/stat stat S_ISLNK10203730
Ref: 2c6110203730
Ref: library/stat stat S_ISSOCK10203881
Ref: 2c6210203881
Ref: library/stat stat S_ISDOOR10204012
Ref: 1dab10204012
Ref: library/stat stat S_ISPORT10204165
Ref: 1dac10204165
Ref: library/stat stat S_ISWHT10204333
Ref: 1dad10204333
Ref: library/stat stat S_IMODE10204612
Ref: 2c6310204612
Ref: library/stat stat S_IFMT10205059
Ref: 2c6410205059
Ref: library/stat stat filemode10206664
Ref: 136310206664
Ref: library/stat stat ST_MODE10207212
Ref: 11bc10207212
Ref: library/stat stat ST_INO10207279
Ref: 2c6510207279
Ref: library/stat stat ST_DEV10207333
Ref: 2c6610207333
Ref: library/stat stat ST_NLINK10207408
Ref: 2c6710207408
Ref: library/stat stat ST_UID10207489
Ref: 2c6810207489
Ref: library/stat stat ST_GID10207566
Ref: 2c6910207566
Ref: library/stat stat ST_SIZE10207646
Ref: 2c6a10207646
Ref: library/stat stat ST_ATIME10207801
Ref: 2c6b10207801
Ref: library/stat stat ST_MTIME10207874
Ref: 2c6c10207874
Ref: library/stat stat ST_CTIME10207944
Ref: 2c6d10207944
Ref: library/stat stat S_IFSOCK10209397
Ref: 2c6e10209397
Ref: library/stat stat S_IFLNK10209449
Ref: 2c6f10209449
Ref: library/stat stat S_IFREG10209515
Ref: 2c7010209515
Ref: library/stat stat S_IFBLK10209575
Ref: 2c7110209575
Ref: library/stat stat S_IFDIR10209638
Ref: 2c7210209638
Ref: library/stat stat S_IFCHR10209695
Ref: 2c7310209695
Ref: library/stat stat S_IFIFO10209764
Ref: 2c7410209764
Ref: library/stat stat S_IFDOOR10209807
Ref: 11bd10209807
Ref: library/stat stat S_IFPORT10209881
Ref: 11be10209881
Ref: library/stat stat S_IFWHT10209970
Ref: 11bf10209970
Ref: library/stat stat S_ISUID10210402
Ref: 2c7510210402
Ref: library/stat stat S_ISGID10210469
Ref: 2c7610210469
Ref: library/stat stat S_ISVTX10211351
Ref: 2c7910211351
Ref: library/stat stat S_IRWXU10211762
Ref: 2c7a10211762
Ref: library/stat stat S_IRUSR10211855
Ref: 2c7b10211855
Ref: library/stat stat S_IWUSR10211942
Ref: 2c7c10211942
Ref: library/stat stat S_IXUSR10212029
Ref: 2c7d10212029
Ref: library/stat stat S_IRWXG10212113
Ref: 2c7e10212113
Ref: library/stat stat S_IRGRP10212194
Ref: 2c7f10212194
Ref: library/stat stat S_IWGRP10212281
Ref: 2c8010212281
Ref: library/stat stat S_IXGRP10212368
Ref: 2c7710212368
Ref: library/stat stat S_IRWXO10212452
Ref: 2c8110212452
Ref: library/stat stat S_IROTH10212549
Ref: 2c8210212549
Ref: library/stat stat S_IWOTH10212633
Ref: 2c8310212633
Ref: library/stat stat S_IXOTH10212717
Ref: 2c8410212717
Ref: library/stat stat S_ENFMT10212798
Ref: 2c7810212798
Ref: library/stat stat S_IREAD10213115
Ref: 2c8510213115
Ref: library/stat stat S_IWRITE10213205
Ref: 2c8610213205
Ref: library/stat stat S_IEXEC10213296
Ref: 2c8710213296
Ref: library/stat stat UF_SETTABLE10213483
Ref: 2c8810213483
Ref: library/stat stat UF_NODUMP10213576
Ref: 2c8910213576
Ref: library/stat stat UF_IMMUTABLE10213650
Ref: 2c8a10213650
Ref: library/stat stat UF_APPEND10213727
Ref: 2c8b10213727
Ref: library/stat stat UF_OPAQUE10213807
Ref: 2c8c10213807
Ref: library/stat stat UF_NOUNLINK10213968
Ref: 2c8d10213968
Ref: library/stat stat UF_COMPRESSED10214059
Ref: 2c8e10214059
Ref: library/stat stat UF_TRACKED10214160
Ref: 2c8f10214160
Ref: library/stat stat UF_DATAVAULT10214266
Ref: 2c9010214266
Ref: library/stat stat UF_HIDDEN10214403
Ref: 2c9110214403
Ref: library/stat stat SF_SETTABLE10214511
Ref: 2c9210214511
Ref: library/stat stat SF_SUPPORTED10214611
Ref: 2c9310214611
Ref: library/stat stat SF_SYNTHETIC10214750
Ref: 2c9410214750
Ref: library/stat stat SF_ARCHIVED10214899
Ref: 2c9510214899
Ref: library/stat stat SF_IMMUTABLE10215008
Ref: 2c9610215008
Ref: library/stat stat SF_APPEND10215085
Ref: 2c9710215085
Ref: library/stat stat SF_RESTRICTED10215165
Ref: 2c9810215165
Ref: library/stat stat SF_NOUNLINK10215292
Ref: 2c9910215292
Ref: library/stat stat SF_SNAPSHOT10215383
Ref: 2c9a10215383
Ref: library/stat stat SF_FIRMLINK10215489
Ref: 2c9b10215489
Ref: library/stat stat SF_DATALESS10215595
Ref: 2c9c10215595
Ref: library/stat stat FILE_ATTRIBUTE_ARCHIVE10216120
Ref: 2c9d10216120
Ref: library/stat stat FILE_ATTRIBUTE_COMPRESSED10216163
Ref: 2c9e10216163
Ref: library/stat stat FILE_ATTRIBUTE_DEVICE10216209
Ref: 2c9f10216209
Ref: library/stat stat FILE_ATTRIBUTE_DIRECTORY10216251
Ref: 2ca010216251
Ref: library/stat stat FILE_ATTRIBUTE_ENCRYPTED10216296
Ref: 2ca110216296
Ref: library/stat stat FILE_ATTRIBUTE_HIDDEN10216341
Ref: 2ca210216341
Ref: library/stat stat FILE_ATTRIBUTE_INTEGRITY_STREAM10216383
Ref: 2ca310216383
Ref: library/stat stat FILE_ATTRIBUTE_NORMAL10216435
Ref: 2ca410216435
Ref: library/stat stat FILE_ATTRIBUTE_NOT_CONTENT_INDEXED10216477
Ref: 2ca510216477
Ref: library/stat stat FILE_ATTRIBUTE_NO_SCRUB_DATA10216532
Ref: 2ca610216532
Ref: library/stat stat FILE_ATTRIBUTE_OFFLINE10216581
Ref: 2ca710216581
Ref: library/stat stat FILE_ATTRIBUTE_READONLY10216624
Ref: 2ca810216624
Ref: library/stat stat FILE_ATTRIBUTE_REPARSE_POINT10216668
Ref: 2ca910216668
Ref: library/stat stat FILE_ATTRIBUTE_SPARSE_FILE10216717
Ref: 2caa10216717
Ref: library/stat stat FILE_ATTRIBUTE_SYSTEM10216764
Ref: 2cab10216764
Ref: library/stat stat FILE_ATTRIBUTE_TEMPORARY10216806
Ref: 2cac10216806
Ref: library/stat stat FILE_ATTRIBUTE_VIRTUAL10216851
Ref: 2cad10216851
Ref: library/stat stat IO_REPARSE_TAG_SYMLINK10217165
Ref: 2cae10217165
Ref: library/stat stat IO_REPARSE_TAG_MOUNT_POINT10217208
Ref: 2caf10217208
Ref: library/stat stat IO_REPARSE_TAG_APPEXECLINK10217255
Ref: 2cb010217255
Ref: stat --- stat の結果を解釈する-Footnote-110217367
Ref: stat --- stat の結果を解釈する-Footnote-210217431
Ref: stat --- stat の結果を解釈する-Footnote-310217478
Node: filecmp --- ファイルとディレクトリの比較10217558
Ref: library/filecmp doc10217817
Ref: 2cb110217817
Ref: library/filecmp filecmp-file-and-directory-comparisons10217817
Ref: 2cb210217817
Ref: library/filecmp module-filecmp10217817
Ref: 5e10217817
Ref: library/filecmp translation-repo10217817
Ref: 2cb310217817
Ref: library/filecmp filecmp cmp10218293
Ref: 19dd10218293
Ref: library/filecmp filecmp cmpfiles10219276
Ref: 194510219276
Ref: library/filecmp filecmp clear_cache10220502
Ref: 114010220502
Ref: filecmp --- ファイルとディレクトリの比較-Footnote-110220840
Node: dircmp クラス10220907
Ref: library/filecmp dircmp-objects10221014
Ref: 2cb410221014
Ref: library/filecmp the-dircmp-class10221014
Ref: 2cb510221014
Ref: library/filecmp filecmp dircmp10221072
Ref: 114210221072
Ref: library/filecmp filecmp dircmp report10221774
Ref: 2cb610221774
Ref: library/filecmp filecmp dircmp report_partial_closure10221892
Ref: 2cb710221892
Ref: library/filecmp filecmp dircmp report_full_closure10222094
Ref: 2cb810222094
Ref: library/filecmp filecmp dircmp left10222745
Ref: 2cb910222745
Ref: library/filecmp filecmp dircmp right10222815
Ref: 2cba10222815
Ref: library/filecmp filecmp dircmp left_list10222886
Ref: 2cbb10222886
Ref: library/filecmp filecmp dircmp right_list10223068
Ref: 2cbc10223068
Ref: library/filecmp filecmp dircmp common10223251
Ref: 2cbd10223251
Ref: library/filecmp filecmp dircmp left_only10223392
Ref: 2cbe10223392
Ref: library/filecmp filecmp dircmp right_only10223508
Ref: 2cbf10223508
Ref: library/filecmp filecmp dircmp common_dirs10223625
Ref: 2cc010223625
Ref: library/filecmp filecmp dircmp common_files10223739
Ref: 2cc110223739
Ref: library/filecmp filecmp dircmp common_funny10223842
Ref: 2cc210223842
Ref: library/filecmp filecmp dircmp same_files10224063
Ref: 2cc310224063
Ref: library/filecmp filecmp dircmp diff_files10224239
Ref: 2cc410224239
Ref: library/filecmp filecmp dircmp funny_files10224429
Ref: 2cc510224429
Ref: library/filecmp filecmp dircmp subdirs10224558
Ref: 1ce510224558
Ref: library/filecmp filecmp DEFAULT_IGNORES10225027
Ref: 114110225027
Node: tempfile --- 一時ファイルやディレクトリの作成10225790
Ref: library/tempfile doc10226064
Ref: 2cc610226064
Ref: library/tempfile module-tempfile10226064
Ref: e610226064
Ref: library/tempfile tempfile-generate-temporary-files-and-directories10226064
Ref: 2cc710226064
Ref: library/tempfile translation-repo10226064
Ref: 2cc810226064
Ref: library/tempfile tempfile TemporaryFile10227609
Ref: 2cc910227609
Ref: library/tempfile tempfile NamedTemporaryFile10230465
Ref: 6ed10230465
Ref: library/tempfile tempfile SpooledTemporaryFile10234338
Ref: 8a210234338
Ref: library/tempfile tempfile SpooledTemporaryFile rollover10234961
Ref: 2ccc10234961
Ref: library/tempfile tempfile TemporaryDirectory10236303
Ref: 144c10236303
Ref: library/tempfile tempfile TemporaryDirectory name10236971
Ref: 2ccd10236971
Ref: library/tempfile tempfile TemporaryDirectory cleanup10237376
Ref: 2cce10237376
Ref: library/tempfile tempfile mkstemp10238723
Ref: 2cca10238723
Ref: library/tempfile tempfile mkdtemp10242531
Ref: 52d10242531
Ref: library/tempfile tempfile gettempdir10244104
Ref: 1c9310244104
Ref: library/tempfile tempfile gettempdirb10245529
Ref: 1c9410245529
Ref: library/tempfile tempfile gettempprefix10245675
Ref: 2cd010245675
Ref: library/tempfile tempfile gettempprefixb10245884
Ref: 2cd110245884
Ref: library/tempfile tempfile tempdir10246464
Ref: 1c9210246464
Ref: tempfile --- 一時ファイルやディレクトリの作成-Footnote-110247642
Node: 使用例<8>10247710
Ref: library/tempfile examples10247856
Ref: 2cd210247856
Ref: library/tempfile tempfile-examples10247856
Ref: 2ccb10247856
Node: 非推奨の関数と変数10249245
Ref: library/tempfile deprecated-functions-and-variables10249391
Ref: 2cd310249391
Ref: library/tempfile tempfile-mktemp-deprecated10249391
Ref: 2cd410249391
Ref: library/tempfile tempfile mktemp10250180
Ref: 1c3010250180
Node: glob --- Unix 形式のパス名のパターン展開10251594
Ref: library/glob doc10251870
Ref: 2cd510251870
Ref: library/glob glob-unix-style-pathname-pattern-expansion10251870
Ref: 2cd610251870
Ref: library/glob module-glob10251870
Ref: 6810251870
Ref: library/glob translation-repo10251870
Ref: 2cd710251870
Ref: library/glob glob glob10253083
Ref: 5a010253083
Ref: library/glob glob iglob10256083
Ref: a0810256083
Ref: library/glob glob escape10257206
Ref: 114710257206
Ref: library/glob glob translate10257717
Ref: 4fb10257717
Ref: glob --- Unix 形式のパス名のパターン展開-Footnote-110259682
Node: 使用例<9>10259746
Ref: library/glob examples10259848
Ref: 2cd810259848
Node: fnmatch --- Unix のファイル名パターンマッチ10261167
Ref: library/fnmatch doc10261447
Ref: 2cd910261447
Ref: library/fnmatch fnmatch-unix-filename-pattern-matching10261447
Ref: 2cda10261447
Ref: library/fnmatch module-fnmatch10261447
Ref: 6010261447
Ref: library/fnmatch translation-repo10261447
Ref: 2cdb10261447
Ref: library/fnmatch fnmatch fnmatch10263731
Ref: 1c5410263731
Ref: library/fnmatch fnmatch fnmatchcase10264621
Ref: 1c5510264621
Ref: library/fnmatch fnmatch filter10264947
Ref: 1c5610264947
Ref: library/fnmatch fnmatch filterfalse10265240
Ref: 21110265240
Ref: library/fnmatch fnmatch translate10265579
Ref: 184f10265579
Ref: fnmatch --- Unix のファイル名パターンマッチ-Footnote-110266220
Node: linecache --- テキストラインへのランダムアクセス10266287
Ref: library/linecache doc10266555
Ref: 2cdc10266555
Ref: library/linecache linecache-random-access-to-text-lines10266555
Ref: 2cdd10266555
Ref: library/linecache module-linecache10266555
Ref: 8910266555
Ref: library/linecache translation-repo10266555
Ref: 2cde10266555
Ref: library/linecache linecache getline10267517
Ref: 24010267517
Ref: library/linecache linecache clearcache10268776
Ref: 2ce010268776
Ref: library/linecache linecache checkcache10269029
Ref: 18eb10269029
Ref: library/linecache linecache lazycache10269434
Ref: 102410269434
Ref: linecache --- テキストラインへのランダムアクセス-Footnote-110270121
Ref: linecache --- テキストラインへのランダムアクセス-Footnote-210270190
Node: shutil --- 高水準のファイル操作10270232
Ref: library/shutil doc10270435
Ref: 2ce110270435
Ref: library/shutil module-shutil10270435
Ref: ca10270435
Ref: library/shutil shutil-high-level-file-operations10270435
Ref: 2ce210270435
Ref: library/shutil translation-repo10270435
Ref: 2ce310270435
Ref: shutil --- 高水準のファイル操作-Footnote-110271827
Node: ディレクトリとファイルの操作10271893
Ref: library/shutil directory-and-files-operations10272046
Ref: 2ce410272046
Ref: library/shutil file-operations10272046
Ref: 2ce510272046
Ref: library/shutil shutil copyfileobj10272137
Ref: c5210272137
Ref: library/shutil shutil copyfile10273368
Ref: c4e10273368
Ref: library/shutil shutil SpecialFileError10275589
Ref: 153310275589
Ref: library/shutil shutil SameFileError10275774
Ref: 11a010275774
Ref: library/shutil shutil copymode10275944
Ref: 1a2410275944
Ref: library/shutil shutil copystat10277131
Ref: 134610277131
Ref: library/shutil shutil copy10279774
Ref: c4f10279774
Ref: library/shutil shutil copy210281891
Ref: c5010281891
Ref: library/shutil shutil ignore_patterns10284054
Ref: 2ce710284054
Ref: library/shutil shutil copytree10284426
Ref: c1e10284426
Ref: library/shutil shutil rmtree10288797
Ref: 35610288797
Ref: library/shutil shutil rmtree avoids_symlink_attacks10292245
Ref: 2ce810292245
Ref: library/shutil shutil move10292721
Ref: c5110292721
Ref: library/shutil shutil disk_usage10295153
Ref: 134510295153
Ref: library/shutil shutil chown10296066
Ref: 54810296066
Ref: library/shutil shutil which10296862
Ref: 6db10296862
Ref: library/shutil shutil Error10299618
Ref: 119f10299618
Node: プラットフォーム依存の効率的なコピー操作10300028
Ref: library/shutil platform-dependent-efficient-copy-operations10300191
Ref: 2cea10300191
Ref: library/shutil shutil-platform-dependent-efficient-copy-operations10300191
Ref: c5310300191
Ref: プラットフォーム依存の効率的なコピー操作-Footnote-110302035
Ref: プラットフォーム依存の効率的なコピー操作-Footnote-210302100
Node: copytree の例10302148
Ref: library/shutil copytree-example10302333
Ref: 2ceb10302333
Ref: library/shutil shutil-copytree-example10302333
Ref: 2cec10302333
Node: rmtree の例10303035
Ref: library/shutil rmtree-example10303151
Ref: 2ced10303151
Ref: library/shutil shutil-rmtree-example10303151
Ref: 2ce910303151
Node: アーカイブ化操作10303826
Ref: library/shutil archiving-operations10304030
Ref: 143110304030
Ref: library/shutil id110304030
Ref: 2cee10304030
Ref: library/shutil shutil make_archive10304440
Ref: 6da10304440
Ref: library/shutil shutil get_archive_formats10307510
Ref: 2cf110307510
Ref: library/shutil shutil register_archive_format10308796
Ref: 2cf010308796
Ref: library/shutil shutil unregister_archive_format10310356
Ref: 2cf210310356
Ref: library/shutil shutil unpack_archive10310556
Ref: 69610310556
Ref: library/shutil shutil register_unpack_format10312885
Ref: 2cf310312885
Ref: library/shutil shutil unregister_unpack_format10313928
Ref: 2cf610313928
Ref: library/shutil shutil get_unpack_formats10314103
Ref: 2cf510314103
Ref: アーカイブ化操作-Footnote-110315517
Node: アーカイブ化の例10315559
Ref: library/shutil archiving-example10315698
Ref: 2cf710315698
Ref: library/shutil shutil-archiving-example10315698
Ref: 2cf810315698
Node: base_dir を使ったアーカイブ化の例10316873
Ref: library/shutil archiving-example-with-base-dir10317012
Ref: 2cf910317012
Ref: library/shutil shutil-archiving-example-with-basedir10317012
Ref: 2cef10317012
Node: 出力ターミナルのサイズの取得10318292
Ref: library/shutil querying-the-size-of-the-output-terminal10318445
Ref: 2cfa10318445
Ref: library/shutil shutil get_terminal_size10318536
Ref: 131b10318536
Ref: 出力ターミナルのサイズの取得-Footnote-110320529
Node: データの永続化10320612
Ref: library/persistence doc10320800
Ref: 2cfd10320800
Ref: library/persistence data-persistence10320800
Ref: 2cfe10320800
Ref: library/persistence persistence10320800
Ref: 2cff10320800
Ref: library/persistence translation-repo10320800
Ref: 2d0010320800
Node: pickle --- Python オブジェクトの直列化10322133
Ref: library/pickle doc10322300
Ref: 2d0110322300
Ref: library/pickle module-pickle10322300
Ref: ab10322300
Ref: library/pickle pickle-python-object-serialization10322300
Ref: 2d0210322300
Ref: pickle --- Python オブジェクトの直列化-Footnote-110324513
Ref: pickle --- Python オブジェクトの直列化-Footnote-210324579
Node: 他の Python モジュールとの関係10324676
Ref: library/pickle relationship-to-other-python-modules10324844
Ref: 2d0410324844
Node: marshal との比較10324993
Ref: library/pickle comparison-with-marshal10325117
Ref: 2d0510325117
Node: json との比較10326449
Ref: library/pickle comparison-with-json10326573
Ref: 2d0310326573
Ref: library/pickle id210326573
Ref: 2d0610326573
Ref: json との比較-Footnote-110327991
Node: データストリームの形式10328016
Ref: library/pickle data-stream-format10328232
Ref: 2d0810328232
Ref: library/pickle pickle-protocols10328232
Ref: 27b10328232
Ref: データストリームの形式-Footnote-110331974
Ref: データストリームの形式-Footnote-210332016
Ref: データストリームの形式-Footnote-310332058
Node: モジュールインターフェース10332100
Ref: library/pickle module-interface10332317
Ref: 2d0b10332317
Ref: library/pickle pickle HIGHEST_PROTOCOL10332902
Ref: 16be10332902
Ref: library/pickle pickle DEFAULT_PROTOCOL10333231
Ref: a2f10333231
Ref: library/pickle pickle dump10334030
Ref: 2d0c10334030
Ref: library/pickle pickle dumps10334618
Ref: 16bd10334618
Ref: library/pickle pickle load10335118
Ref: f0c10335118
Ref: library/pickle pickle loads10336048
Ref: f0d10336048
Ref: library/pickle pickle PickleError10336950
Ref: 2d0d10336950
Ref: library/pickle pickle PicklingError10337094
Ref: 194210337094
Ref: library/pickle pickle UnpicklingError10337490
Ref: 2d0f10337490
Ref: library/pickle pickle Pickler10338131
Ref: c1310338131
Ref: library/pickle pickle Pickler dump10340437
Ref: 1e2510340437
Ref: library/pickle pickle Pickler persistent_id10340659
Ref: 190c10340659
Ref: library/pickle pickle Pickler dispatch_table10341747
Ref: 133a10341747
Ref: library/pickle pickle Pickler reducer_override10343239
Ref: c1410343239
Ref: library/pickle pickle Pickler fast10344169
Ref: 2d1510344169
Ref: library/pickle pickle Pickler clear_memo10344836
Ref: 2d1710344836
Ref: library/pickle pickle Unpickler10345171
Ref: 177710345171
Ref: library/pickle pickle Unpickler load10348088
Ref: 2d1810348088
Ref: library/pickle pickle Unpickler persistent_load10348487
Ref: 191410348487
Ref: library/pickle pickle Unpickler find_class10349219
Ref: 2d1910349219
Ref: library/pickle pickle PickleBuffer10350223
Ref: 177b10350223
Ref: library/pickle pickle PickleBuffer raw10351131
Ref: 2d1b10351131
Ref: library/pickle pickle PickleBuffer release10351571
Ref: 2d1c10351571
Ref: モジュールインターフェース-Footnote-110351771
Node: pickle 化、非 pickle 化できるもの10351813
Ref: library/pickle pickle-picklable10352038
Ref: 2d0e10352038
Ref: library/pickle what-can-be-pickled-and-unpickled10352038
Ref: 2d1d10352038
Ref: pickle 化、非 pickle 化できるもの-Footnote-110355689
Ref: pickle 化、非 pickle 化できるもの-Footnote-210355876
Node: クラスインスタンスの pickle 化10356028
Ref: library/pickle pickle-inst10356310
Ref: 2d0710356310
Ref: library/pickle pickling-class-instances10356310
Ref: 2d1e10356310
Ref: library/pickle object __getnewargs_ex__10357632
Ref: 2d1f10357632
Ref: library/pickle object __getnewargs__10358565
Ref: fd410358565
Ref: library/pickle object __getstate__10359303
Ref: 7f110359303
Ref: library/pickle object __setstate__10360658
Ref: bc710360658
Ref: library/pickle object __reduce__10363245
Ref: bc610363245
Ref: library/pickle object __reduce_ex__10367197
Ref: 196b10367197
Ref: クラスインスタンスの pickle 化-Footnote-110368070
Node: 外部オブジェクトの永続化10368204
Ref: library/pickle persistence-of-external-objects10368357
Ref: 2d2110368357
Ref: library/pickle pickle-persistent10368357
Ref: 2d1110368357
Ref: 外部オブジェクトの永続化-Footnote-110373126
Node: ディスパッチテーブル10373454
Ref: library/pickle dispatch-tables10373658
Ref: 2d2210373658
Ref: library/pickle pickle-dispatch10373658
Ref: 2d1310373658
Node: 状態を持つオブジェクトの扱い10375231
Ref: library/pickle handling-stateful-objects10375390
Ref: 2d2310375390
Ref: library/pickle pickle-state10375390
Ref: 2d2010375390
Node: 型、関数、その他のオブジェクトに対するリダクションのカスタマイズ10377695
Ref: library/pickle custom-reduction-for-types-functions-and-other-objects10377974
Ref: 2d2410377974
Ref: library/pickle reducer-override10377974
Ref: 2d1410377974
Node: アウトオブバウンドバッファ10380456
Ref: library/pickle out-of-band-buffers10380730
Ref: 2d2510380730
Ref: library/pickle pickle-oob10380730
Ref: 2d1010380730
Node: 生産者 API10381634
Ref: library/pickle provider-api10381745
Ref: 2d2610381745
Node: 消費者 API10382476
Ref: library/pickle consumer-api10382609
Ref: 2d2710382609
Node: 使用例<10>10384293
Ref: library/pickle example10384404
Ref: 2d2810384404
Ref: 使用例<10>-Footnote-110387280
Node: グローバル変数を制限する10387322
Ref: library/pickle pickle-restrict10387509
Ref: 2d1a10387509
Ref: library/pickle restricting-globals10387509
Ref: 2d2910387509
Node: 性能<2>10390889
Ref: library/pickle performance10391050
Ref: 2d2a10391050
Node: 使用例<11>10391309
Ref: library/pickle examples10391482
Ref: 2d2b10391482
Ref: library/pickle pickle-example10391482
Ref: 2d2c10391482
Node: コマンドライン・インターフェース10392309
Ref: library/pickle command-line-interface10392464
Ref: 2d2d10392464
Ref: library/pickle pickle-cli10392464
Ref: 2d2e10392464
Ref: library/pickle cmdoption-pickle-arg-pickle_file10392987
Ref: 2d3010392987
Node: copyreg --- pickle サポート関数を登録する10393636
Ref: library/copyreg doc10393860
Ref: 2d3110393860
Ref: library/copyreg copyreg-register-pickle-support-functions10393860
Ref: 2d3210393860
Ref: library/copyreg module-copyreg10393860
Ref: 2a10393860
Ref: library/copyreg translation-repo10393860
Ref: 2d3310393860
Ref: library/copyreg copyreg constructor10394458
Ref: 2d3410394458
Ref: library/copyreg copyreg pickle10394754
Ref: 2d1210394754
Ref: copyreg --- pickle サポート関数を登録する-Footnote-110395724
Node: 使用例<12>10395791
Ref: library/copyreg example10395893
Ref: 2d3510395893
Node: shelve --- Python オブジェクトの永続化10396475
Ref: library/shelve doc10396719
Ref: 2d3610396719
Ref: library/shelve module-shelve10396719
Ref: c810396719
Ref: library/shelve shelve-python-object-persistence10396719
Ref: 2d3710396719
Ref: library/shelve translation-repo10396719
Ref: 2d3810396719
Ref: library/shelve shelve open10397498
Ref: 1a7110397498
Ref: library/shelve shelve-security10400177
Ref: 2d3c10400177
Ref: library/shelve shelve Shelf sync10400696
Ref: 2d3a10400696
Ref: library/shelve shelve Shelf close10401158
Ref: 2d3b10401158
Ref: shelve --- Python オブジェクトの永続化-Footnote-110401618
Ref: shelve --- Python オブジェクトの永続化-Footnote-210401684
Node: 制限事項10401789
Ref: library/shelve restrictions10401908
Ref: 2d3d10401908
Ref: library/shelve shelve Shelf10403285
Ref: 119d10403285
Ref: library/shelve shelve BsdDbShelf10405147
Ref: 26b810405147
Ref: library/shelve shelve DbfilenameShelf10405875
Ref: 26b910405875
Ref: 制限事項-Footnote-110406638
Node: 使用例<13>10406691
Ref: library/shelve example10406810
Ref: 2d3e10406810
Ref: library/shelve shelve-example10406810
Ref: 2d3910406810
Node: marshal --- 内部使用向けの Python オブジェクト直列化10408605
Ref: library/marshal doc10408861
Ref: 2d3f10408861
Ref: library/marshal marshal-internal-python-object-serialization10408861
Ref: 2d4010408861
Ref: library/marshal module-marshal10408861
Ref: 9110408861
Ref: library/marshal translation-repo10408861
Ref: 2d4110408861
Ref: library/marshal marshal dump10412105
Ref: 2d4310412105
Ref: library/marshal marshal load10413122
Ref: 1df610413122
Ref: library/marshal marshal dumps10414194
Ref: 10a510414194
Ref: library/marshal marshal loads10414958
Ref: 2d4410414958
Ref: library/marshal marshal version10415780
Ref: 2d4210415780
Ref: marshal --- 内部使用向けの Python オブジェクト直列化-Footnote-110417003
Node: dbm --- Unix "データベース" へのインターフェース10417547
Ref: library/dbm doc10417834
Ref: 2d4510417834
Ref: library/dbm dbm-interfaces-to-unix-databases10417834
Ref: 2d4610417834
Ref: library/dbm module-dbm10417834
Ref: 3510417834
Ref: library/dbm translation-repo10417834
Ref: 2d4710417834
Ref: library/dbm dbm error10418414
Ref: 2d4810418414
Ref: library/dbm dbm whichdb10418900
Ref: 2d4910418900
Ref: library/dbm dbm open10419599
Ref: 112d10419599
Ref: dbm --- Unix "データベース" へのインターフェース-Footnote-110423562
Ref: dbm --- Unix "データベース" へのインターフェース-Footnote-210423634
Node: dbm sqlite3 --- SQLite backend for dbm10423687
Ref: library/dbm dbm-sqlite3-sqlite-backend-for-dbm10423867
Ref: 2d4a10423867
Ref: library/dbm module-dbm sqlite310423867
Ref: 3910423867
Ref: library/dbm dbm sqlite3 open10424571
Ref: 2d4b10424571
Ref: library/dbm dbm sqlite3 sqlite3 close10425702
Ref: 2d4c10425702
Ref: dbm sqlite3 --- SQLite backend for dbm-Footnote-110425817
Node: dbm gnu --- GNU database manager10425888
Ref: library/dbm dbm-gnu-gnu-database-manager10426110
Ref: 2d4d10426110
Ref: library/dbm module-dbm gnu10426110
Ref: 3710426110
Ref: library/dbm dbm gnu error10426881
Ref: c9110426881
Ref: library/dbm dbm gnu open_flags10427078
Ref: 2d4e10427078
Ref: library/dbm dbm gnu open10427201
Ref: 1e2010427201
Ref: library/dbm dbm gnu gdbm close10429377
Ref: 2d4f10429377
Ref: library/dbm dbm gnu gdbm firstkey10429451
Ref: 2d5010429451
Ref: library/dbm dbm gnu gdbm nextkey10429789
Ref: 2d5110429789
Ref: library/dbm dbm gnu gdbm reorganize10430273
Ref: 2d5210430273
Ref: library/dbm dbm gnu gdbm sync10430716
Ref: 2d5310430716
Ref: dbm gnu --- GNU database manager-Footnote-110430989
Node: dbm ndbm --- New Database Manager10431056
Ref: library/dbm dbm-ndbm-new-database-manager10431280
Ref: 2d5410431280
Ref: library/dbm module-dbm ndbm10431280
Ref: 3810431280
Ref: library/dbm dbm ndbm error10432363
Ref: c9210432363
Ref: library/dbm dbm ndbm library10432562
Ref: 2d5510432562
Ref: library/dbm dbm ndbm open10432647
Ref: 1e2110432647
Ref: library/dbm dbm ndbm ndbm close10434239
Ref: 2d5610434239
Ref: dbm ndbm --- New Database Manager-Footnote-110434349
Node: dbm dumb --- Portable DBM implementation10434417
Ref: library/dbm dbm-dumb-portable-dbm-implementation10434600
Ref: 2d5710434600
Ref: library/dbm module-dbm dumb10434600
Ref: 3610434600
Ref: library/dbm dbm dumb error10435357
Ref: c9010435357
Ref: library/dbm dbm dumb open10435556
Ref: c8d10435556
Ref: library/dbm dbm dumb dumbdbm close10437591
Ref: 2d5810437591
Ref: library/dbm dbm dumb dumbdbm sync10437663
Ref: 2d5910437663
Ref: dbm dumb --- Portable DBM implementation-Footnote-110437881
Node: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース10437949
Ref: library/sqlite3 doc10438159
Ref: 2d5a10438159
Ref: library/sqlite3 module-sqlite310438159
Ref: d410438159
Ref: library/sqlite3 sqlite3-db-api-2-0-interface-for-sqlite-databases10438159
Ref: 2d5b10438159
Ref: library/sqlite3 translation-repo10438159
Ref: 2d5c10438159
Ref: library/sqlite3 sqlite3-intro10438363
Ref: 2d5d10438363
Ref: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース-Footnote-110440513
Ref: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース-Footnote-210440578
Ref: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース-Footnote-310440620
Ref: sqlite3 --- SQLite データベース用の DB-API 2 0 インターフェース-Footnote-410440648
Node: チュートリアル10440690
Ref: library/sqlite3 sqlite3-tutorial10440854
Ref: 2d5e10440854
Ref: library/sqlite3 tutorial10440854
Ref: 2d6210440854
Ref: チュートリアル-Footnote-110448486
Ref: チュートリアル-Footnote-210448543
Ref: チュートリアル-Footnote-310448602
Ref: チュートリアル-Footnote-410448651
Ref: チュートリアル-Footnote-510448697
Node: リファレンス10448749
Ref: library/sqlite3 reference10448946
Ref: 2d6c10448946
Ref: library/sqlite3 sqlite3-reference10448946
Ref: 2d5f10448946
Ref: library/sqlite3 sqlite3-module-contents10448997
Ref: 2d6d10448997
Node: モジュール関数10449568
Ref: library/sqlite3 module-functions10449674
Ref: 2d6e10449674
Ref: library/sqlite3 sqlite3-module-functions10449674
Ref: 2d6f10449674
Ref: library/sqlite3 sqlite3 connect10449730
Ref: 5a610449730
Ref: library/sqlite3 sqlite3 complete_statement10455232
Ref: 2d7810455232
Ref: library/sqlite3 sqlite3 enable_callback_tracebacks10456247
Ref: 2d7910456247
Ref: library/sqlite3 sqlite3 register_adapter10457087
Ref: 2d7a10457087
Ref: library/sqlite3 sqlite3 register_converter10457562
Ref: 2d7110457562
Ref: モジュール関数-Footnote-110458406
Ref: モジュール関数-Footnote-210458449
Ref: モジュール関数-Footnote-310458491
Node: モジュール定数10458568
Ref: library/sqlite3 module-constants10458712
Ref: 2d7c10458712
Ref: library/sqlite3 sqlite3-module-constants10458712
Ref: 2d7d10458712
Ref: library/sqlite3 sqlite3 LEGACY_TRANSACTION_CONTROL10458768
Ref: 2d7610458768
Ref: library/sqlite3 sqlite3 PARSE_DECLTYPES10459148
Ref: 2d7210459148
Ref: library/sqlite3 sqlite3 PARSE_COLNAMES10460259
Ref: 2d7310460259
Ref: library/sqlite3 sqlite3 SQLITE_OK10460905
Ref: 2d7e10460905
Ref: library/sqlite3 sqlite3 SQLITE_DENY10460938
Ref: 2d7f10460938
Ref: library/sqlite3 sqlite3 SQLITE_IGNORE10460973
Ref: 2d8010460973
Ref: library/sqlite3 sqlite3 apilevel10461560
Ref: 2d8110461560
Ref: library/sqlite3 sqlite3 paramstyle10461767
Ref: 2d8210461767
Ref: library/sqlite3 sqlite3 sqlite_version10462172
Ref: 30310462172
Ref: library/sqlite3 sqlite3 sqlite_version_info10462326
Ref: 30410462326
Ref: library/sqlite3 sqlite3 threadsafety10462507
Ref: 88c10462507
Ref: library/sqlite3 sqlite3-dbconfig-constants10465429
Ref: 2d8310465429
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_DEFENSIVE10465429
Ref: 2d8410465429
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_DQS_DDL10465478
Ref: 2d8510465478
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_DQS_DML10465525
Ref: 2d8610465525
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_FKEY10465572
Ref: 2d8710465572
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER10465623
Ref: 2d8810465623
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION10465684
Ref: 2d8910465684
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_QPSG10465745
Ref: 2d8a10465745
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_TRIGGER10465796
Ref: 2d8b10465796
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_VIEW10465850
Ref: 2d8c10465850
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_LEGACY_ALTER_TABLE10465901
Ref: 2d8d10465901
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_LEGACY_FILE_FORMAT10465959
Ref: 2d8e10465959
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE10466017
Ref: 2d8f10466017
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_RESET_DATABASE10466073
Ref: 2d9010466073
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_TRIGGER_EQP10466127
Ref: 2d9110466127
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_TRUSTED_SCHEMA10466178
Ref: 2d9210466178
Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_WRITABLE_SCHEMA10466232
Ref: 2d9310466232
Ref: モジュール定数-Footnote-110466924
Ref: モジュール定数-Footnote-210466967
Ref: モジュール定数-Footnote-310467022
Node: Connection オブジェクト10467073
Ref: library/sqlite3 connection-objects10467221
Ref: 2d9410467221
Ref: library/sqlite3 sqlite3-connection-objects10467221
Ref: 2d9510467221
Ref: library/sqlite3 sqlite3 Connection10467294
Ref: 54d10467294
Ref: library/sqlite3 sqlite3 Connection cursor10468172
Ref: 2d6310468172
Ref: library/sqlite3 sqlite3 Connection blobopen10468658
Ref: 89110468658
Ref: library/sqlite3 sqlite3 Connection commit10470120
Ref: 2d6710470120
Ref: library/sqlite3 sqlite3 Connection rollback10470650
Ref: 2d9710470650
Ref: library/sqlite3 sqlite3 Connection close10471193
Ref: 54e10471193
Ref: library/sqlite3 sqlite3 Connection execute10471789
Ref: 2d9810471789
Ref: library/sqlite3 sqlite3 Connection executemany10472084
Ref: 2d9910472084
Ref: library/sqlite3 sqlite3 Connection executescript10472390
Ref: 2d9a10472390
Ref: library/sqlite3 sqlite3 Connection create_function10472686
Ref: 5a710472686
Ref: library/sqlite3 sqlite3 Connection create_aggregate10474748
Ref: 5a810474748
Ref: library/sqlite3 sqlite3 Connection create_window_function10476823
Ref: 89010476823
Ref: library/sqlite3 sqlite3 Connection create_collation10480337
Ref: 88610480337
Ref: library/sqlite3 sqlite3 Connection interrupt10482092
Ref: 2d9e10482092
Ref: library/sqlite3 sqlite3 Connection set_authorizer10482423
Ref: 5a910482423
Ref: library/sqlite3 sqlite3 Connection set_progress_handler10484489
Ref: 5aa10484489
Ref: library/sqlite3 sqlite3 Connection set_trace_callback10485528
Ref: 5ab10485528
Ref: library/sqlite3 sqlite3 Connection enable_load_extension10487142
Ref: a3f10487142
Ref: library/sqlite3 sqlite3 Connection load_extension10489899
Ref: 6df10489899
Ref: library/sqlite3 sqlite3 Connection iterdump10491152
Ref: 54f10491152
Ref: library/sqlite3 sqlite3 Connection backup10492283
Ref: d7310492283
Ref: library/sqlite3 sqlite3 Connection getlimit10495180
Ref: 88b10495180
Ref: library/sqlite3 sqlite3 Connection setlimit10495976
Ref: 88a10495976
Ref: library/sqlite3 sqlite3 Connection getconfig10497318
Ref: 6e010497318
Ref: library/sqlite3 sqlite3 Connection setconfig10497645
Ref: 6e110497645
Ref: library/sqlite3 sqlite3 Connection serialize10498190
Ref: 88e10498190
Ref: library/sqlite3 sqlite3 Connection deserialize10499193
Ref: 88f10499193
Ref: library/sqlite3 sqlite3 Connection autocommit10500657
Ref: 6dd10500657
Ref: library/sqlite3 sqlite3 Connection in_transaction10502555
Ref: 2da110502555
Ref: library/sqlite3 sqlite3 Connection isolation_level10502939
Ref: 2d7410502939
Ref: library/sqlite3 sqlite3 Connection row_factory10504189
Ref: 19a510504189
Ref: library/sqlite3 sqlite3 Connection text_factory10504887
Ref: 2da310504887
Ref: library/sqlite3 sqlite3 Connection total_changes10505426
Ref: 2da410505426
Ref: Connection オブジェクト-Footnote-110505661
Ref: Connection オブジェクト-Footnote-210505707
Ref: Connection オブジェクト-Footnote-310505772
Ref: Connection オブジェクト-Footnote-410505831
Ref: Connection オブジェクト-Footnote-510505890
Ref: Connection オブジェクト-Footnote-610505932
Ref: Connection オブジェクト-Footnote-710505974
Ref: Connection オブジェクト-Footnote-810506066
Ref: Connection オブジェクト-Footnote-910506108
Ref: Connection オブジェクト-Footnote-1010506200
Node: Cursor オブジェクト10506301
Ref: library/sqlite3 cursor-objects10506450
Ref: 2da510506450
Ref: library/sqlite3 sqlite3-cursor-objects10506450
Ref: 2da610506450
Ref: library/sqlite3 sqlite3 Cursor10507313
Ref: 2d6410507313
Ref: library/sqlite3 sqlite3 Cursor execute10507440
Ref: 5b010507440
Ref: library/sqlite3 sqlite3 Cursor executemany10509247
Ref: 5b110509247
Ref: library/sqlite3 sqlite3 Cursor executescript10510925
Ref: 2d9b10510925
Ref: library/sqlite3 sqlite3 Cursor fetchone10511917
Ref: 2d6510511917
Ref: library/sqlite3 sqlite3 Cursor fetchmany10512308
Ref: 17a710512308
Ref: library/sqlite3 sqlite3 Cursor fetchall10513429
Ref: 2d6810513429
Ref: library/sqlite3 sqlite3 Cursor close10513812
Ref: 2da710513812
Ref: library/sqlite3 sqlite3 Cursor setinputsizes10514197
Ref: 2da810514197
Ref: library/sqlite3 sqlite3 Cursor setoutputsize10514325
Ref: 2da910514325
Ref: library/sqlite3 sqlite3 Cursor arraysize10514465
Ref: 17a810514465
Ref: library/sqlite3 sqlite3 Cursor connection10514886
Ref: 2daa10514886
Ref: library/sqlite3 sqlite3 Cursor description10515436
Ref: 18ab10515436
Ref: library/sqlite3 sqlite3 Cursor lastrowid10515884
Ref: ecc10515884
Ref: library/sqlite3 sqlite3 Cursor rowcount10516649
Ref: 1b6010516649
Ref: library/sqlite3 sqlite3 Cursor row_factory10517235
Ref: 2da210517235
Ref: library/sqlite3 sqlite3-columns-by-name10518337
Ref: 2dab10518337
Ref: Cursor オブジェクト-Footnote-110518373
Ref: Cursor オブジェクト-Footnote-210518430
Node: Row オブジェクト10518481
Ref: library/sqlite3 row-objects10518624
Ref: 2dac10518624
Ref: library/sqlite3 sqlite3-row-objects10518624
Ref: 2dad10518624
Ref: library/sqlite3 sqlite3 Row10518683
Ref: 107110518683
Ref: library/sqlite3 sqlite3 Row keys10519412
Ref: 2dae10519412
Node: Blob オブジェクト10519779
Ref: library/sqlite3 blob-objects10519931
Ref: 2daf10519931
Ref: library/sqlite3 sqlite3-blob-objects10519931
Ref: 2db010519931
Ref: library/sqlite3 sqlite3 Blob10519992
Ref: 89210519992
Ref: library/sqlite3 sqlite3 Blob close10521332
Ref: 2db110521332
Ref: library/sqlite3 sqlite3 Blob read10521630
Ref: 2db210521630
Ref: library/sqlite3 sqlite3 Blob write10522195
Ref: 2db310522195
Ref: library/sqlite3 sqlite3 Blob tell10522505
Ref: 2db410522505
Ref: library/sqlite3 sqlite3 Blob seek10522640
Ref: 2db510522640
Node: PrepareProtocol オブジェクト10523070
Ref: library/sqlite3 prepareprotocol-objects10523209
Ref: 2db610523209
Ref: library/sqlite3 sqlite3 PrepareProtocol10523292
Ref: 1b6b10523292
Ref: PrepareProtocol オブジェクト-Footnote-110523678
Node: 例外<7>10523720
Ref: library/sqlite3 exceptions10523860
Ref: 2db810523860
Ref: library/sqlite3 sqlite3-exceptions10523860
Ref: 2db910523860
Ref: library/sqlite3 sqlite3 Warning10523969
Ref: 1bb610523969
Ref: library/sqlite3 sqlite3 Error10524371
Ref: 1c2510524371
Ref: library/sqlite3 sqlite3 Error sqlite_errorcode10524789
Ref: 88810524789
Ref: library/sqlite3 sqlite3 Error sqlite_errorname10524923
Ref: 88910524923
Ref: library/sqlite3 sqlite3 InterfaceError10525069
Ref: 88d10525069
Ref: library/sqlite3 sqlite3 DatabaseError10525394
Ref: 2d9f10525394
Ref: library/sqlite3 sqlite3 DataError10525817
Ref: 1c5110525817
Ref: library/sqlite3 sqlite3 OperationalError10526094
Ref: 1c5210526094
Ref: library/sqlite3 sqlite3 IntegrityError10526506
Ref: 2dba10526506
Ref: library/sqlite3 sqlite3 InternalError10526785
Ref: 2dbb10526785
Ref: library/sqlite3 sqlite3 ProgrammingError10527135
Ref: 30510527135
Ref: library/sqlite3 sqlite3 NotSupportedError10527551
Ref: 2d9d10527551
Ref: 例外<7>-Footnote-110528113
Ref: 例外<7>-Footnote-210528155
Ref: 例外<7>-Footnote-310528195
Node: SQLite と Python の型10528235
Ref: library/sqlite3 sqlite-and-python-types10528435
Ref: 2dbc10528435
Ref: library/sqlite3 sqlite3-types10528435
Ref: 2d7010528435
Node: デフォルトの適合関数 adapters とデフォルトの変換関数 converters 非推奨10530539
Ref: library/sqlite3 default-adapters-and-converters-deprecated10530781
Ref: 2dbd10530781
Ref: library/sqlite3 sqlite3-default-converters10530781
Ref: 71410530781
Ref: デフォルトの適合関数 adapters とデフォルトの変換関数 converters 非推奨-Footnote-110532581
Node: コマンドライン・インターフェース<2>10532628
Ref: library/sqlite3 command-line-interface10532837
Ref: 2dbe10532837
Ref: library/sqlite3 sqlite3-cli10532837
Ref: 67410532837
Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-h10533326
Ref: 2dbf10533326
Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-help10533326
Ref: 2dc010533326
Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-v10533382
Ref: 2dc110533382
Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-version10533382
Ref: 2dc210533382
Node: ハウツー・ガイド10533511
Ref: library/sqlite3 how-to-guides10533693
Ref: 2dc310533693
Ref: library/sqlite3 sqlite3-howtos10533693
Ref: 2d6010533693
Node: プレースホルダを使用して SQL クエリに値を結び付ける方法10534484
Ref: library/sqlite3 how-to-use-placeholders-to-bind-values-in-sql-queries10534695
Ref: 2dc410534695
Ref: library/sqlite3 sqlite3-placeholders10534695
Ref: 5b210534695
Ref: プレースホルダを使用して SQL クエリに値を結び付ける方法-Footnote-110537617
Ref: プレースホルダを使用して SQL クエリに値を結び付ける方法-Footnote-210537669
Node: カスタム Python 型を SQLite 値に適合させる方法10537711
Ref: library/sqlite3 how-to-adapt-custom-python-types-to-sqlite-values10537988
Ref: 2dc510537988
Ref: library/sqlite3 sqlite3-adapters10537988
Ref: 2d6910537988
Node: 適合可能オブジェクトの書き方10539246
Ref: library/sqlite3 how-to-write-adaptable-objects10539474
Ref: 2dc610539474
Ref: library/sqlite3 sqlite3-conform10539474
Ref: 2db710539474
Node: 適合用呼び出し可能オブジェクト adapter callables の登録方法10540485
Ref: library/sqlite3 how-to-register-adapter-callables10540713
Ref: 2dc710540713
Node: SQLite 値をカスタム Python 型に変換する方法10541473
Ref: library/sqlite3 how-to-convert-sqlite-values-to-custom-python-types10541712
Ref: 2dc810541712
Ref: library/sqlite3 sqlite3-converters10541712
Ref: 2d6a10541712
Node: 適合関数と変換関数のレシピ集10544665
Ref: library/sqlite3 adapter-and-converter-recipes10544909
Ref: 2dc910544909
Ref: library/sqlite3 sqlite3-adapter-converter-recipes10544909
Ref: 71510544909
Node: 接続 connection ショートカット・メソッドの使い方10546403
Ref: library/sqlite3 how-to-use-connection-shortcut-methods10546653
Ref: 2dca10546653
Ref: library/sqlite3 sqlite3-connection-shortcuts10546653
Ref: 2d9610546653
Node: 接続 connection コンテキストマネージャの使い方10548128
Ref: library/sqlite3 how-to-use-the-connection-context-manager10548362
Ref: 2dcb10548362
Ref: library/sqlite3 sqlite3-connection-context-manager10548362
Ref: 1b6c10548362
Node: SQLite URI の操作方法10550520
Ref: library/sqlite3 how-to-work-with-sqlite-uris10550742
Ref: 2dcc10550742
Ref: library/sqlite3 sqlite3-uri-tricks10550742
Ref: 2d7710550742
Ref: SQLite URI の操作方法-Footnote-110552200
Node: 行工場 row factories の作成方法と使用方法10552240
Ref: library/sqlite3 how-to-create-and-use-row-factories10552437
Ref: 2dcd10552437
Ref: library/sqlite3 sqlite3-howto-row-factory10552437
Ref: 2d6b10552437
Node: How to handle non-UTF-8 text encodings10555976
Ref: library/sqlite3 how-to-handle-non-utf-8-text-encodings10556138
Ref: 2dce10556138
Ref: library/sqlite3 sqlite3-howto-encoding10556138
Ref: 2da010556138
Ref: How to handle non-UTF-8 text encodings-Footnote-110557470
Node: 説明10557519
Ref: library/sqlite3 explanation10557674
Ref: 2dcf10557674
Ref: library/sqlite3 sqlite3-explanation10557674
Ref: 2d6110557674
Ref: library/sqlite3 sqlite3-transaction-control10557707
Ref: 2dd010557707
Node: トランザクション制御10557752
Ref: library/sqlite3 sqlite3-controlling-transactions10557825
Ref: 2d6610557825
Ref: library/sqlite3 transaction-control10557825
Ref: 2dd110557825
Node: autocommit 属性に依るトランザクション制御10558439
Ref: library/sqlite3 sqlite3-transaction-control-autocommit10558632
Ref: 6de10558632
Ref: library/sqlite3 transaction-control-via-the-autocommit-attribute10558632
Ref: 2dd210558632
Ref: autocommit 属性に依るトランザクション制御-Footnote-110561102
Ref: autocommit 属性に依るトランザクション制御-Footnote-210561144
Ref: autocommit 属性に依るトランザクション制御-Footnote-310561236
Node: isolation_level 属性に依るトランザクション制御10561278
Ref: library/sqlite3 sqlite3-transaction-control-isolation-level10561471
Ref: 2d7510561471
Ref: library/sqlite3 transaction-control-via-the-isolation-level-attribute10561471
Ref: 2dd310561471
Ref: isolation_level 属性に依るトランザクション制御-Footnote-110564288
Ref: isolation_level 属性に依るトランザクション制御-Footnote-210564388
Node: データ圧縮とアーカイブ10564480
Ref: library/archiving doc10564647
Ref: 2d0910564647
Ref: library/archiving archiving10564647
Ref: 2dd410564647
Ref: library/archiving data-compression-and-archiving10564647
Ref: 2dd510564647
Ref: library/archiving translation-repo10564647
Ref: 2dd610564647
Node: compression パッケージ10565680
Ref: library/compression doc10565855
Ref: 2dd710565855
Ref: library/compression module-compression10565855
Ref: 2210565855
Ref: library/compression the-compression-package10565855
Ref: 2dd810565855
Node: compression zstd --- Compression compatible with the Zstandard format10566704
Ref: library/compression zstd doc10566917
Ref: 2dd910566917
Ref: library/compression zstd compression-zstd-compression-compatible-with-the-zstandard-format10566917
Ref: 2dda10566917
Ref: library/compression zstd module-compression zstd10566917
Ref: 2310566917
Ref: library/compression zstd translation-repo10566917
Ref: 2ddb10566917
Ref: compression zstd --- Compression compatible with the Zstandard format-Footnote-110568968
Ref: compression zstd --- Compression compatible with the Zstandard format-Footnote-210569054
Node: 例外<8>10569121
Ref: library/compression zstd exceptions10569281
Ref: 2de810569281
Ref: library/compression zstd compression zstd ZstdError10569312
Ref: 2de910569312
Node: 圧縮ファイルへの読み書き10569494
Ref: library/compression zstd reading-and-writing-compressed-files10569696
Ref: 2dea10569696
Ref: library/compression zstd compression zstd open10569777
Ref: 2ddc10569777
Ref: library/compression zstd compression zstd ZstdFile10571976
Ref: 2ddd10571976
Ref: library/compression zstd compression zstd ZstdFile peek10574174
Ref: 2dec10574174
Ref: library/compression zstd compression zstd ZstdFile mode10574863
Ref: 2ded10574863
Ref: library/compression zstd compression zstd ZstdFile name10574973
Ref: 2dee10574973
Node: メモリ上での圧縮と展開10575142
Ref: library/compression zstd compressing-and-decompressing-data-in-memory10575357
Ref: 2df010575357
Ref: library/compression zstd compression zstd compress10575433
Ref: 2de010575433
Ref: library/compression zstd compression zstd decompress10576651
Ref: 2de110576651
Ref: library/compression zstd compression zstd ZstdCompressor10577480
Ref: 2dde10577480
Ref: library/compression zstd compression zstd ZstdCompressor compress10578816
Ref: 2df310578816
Ref: library/compression zstd compression zstd ZstdCompressor flush10579856
Ref: 2df410579856
Ref: library/compression zstd compression zstd ZstdCompressor set_pledged_input_size10580264
Ref: 2df810580264
Ref: library/compression zstd compression zstd ZstdCompressor CONTINUE10581570
Ref: 2df510581570
Ref: library/compression zstd compression zstd ZstdCompressor FLUSH_BLOCK10581823
Ref: 2df610581823
Ref: library/compression zstd compression zstd ZstdCompressor FLUSH_FRAME10582124
Ref: 2df710582124
Ref: library/compression zstd compression zstd ZstdCompressor last_mode10582336
Ref: 2dfa10582336
Ref: library/compression zstd compression zstd ZstdDecompressor10582706
Ref: 2ddf10582706
Ref: library/compression zstd compression zstd ZstdDecompressor decompress10583961
Ref: 2dfb10583961
Ref: library/compression zstd compression zstd ZstdDecompressor eof10585240
Ref: 2dfe10585240
Ref: library/compression zstd compression zstd ZstdDecompressor unused_data10585355
Ref: 2dfd10585355
Ref: library/compression zstd compression zstd ZstdDecompressor needs_input10585554
Ref: 2dfc10585554
Node: Zstandard dictionaries10585734
Ref: library/compression zstd zstandard-dictionaries10585939
Ref: 2dff10585939
Ref: library/compression zstd compression zstd train_dict10586004
Ref: 2de210586004
Ref: library/compression zstd compression zstd finalize_dict10587097
Ref: 2de310587097
Ref: library/compression zstd compression zstd ZstdDict10588238
Ref: 2de410588238
Ref: library/compression zstd compression zstd ZstdDict dict_content10591535
Ref: 2e0010591535
Ref: library/compression zstd compression zstd ZstdDict dict_id10591847
Ref: 2e0110591847
Ref: library/compression zstd compression zstd ZstdDict as_digested_dict10592467
Ref: 2e0310592467
Ref: library/compression zstd compression zstd ZstdDict as_undigested_dict10592557
Ref: 2e0410592557
Node: Advanced parameter control10592652
Ref: library/compression zstd advanced-parameter-control10592836
Ref: 2e0510592836
Ref: library/compression zstd compression zstd CompressionParameter10592909
Ref: 2de510592909
Ref: library/compression zstd compression zstd CompressionParameter bounds10593735
Ref: 2df210593735
Ref: library/compression zstd compression zstd CompressionParameter compression_level10594209
Ref: 2df110594209
Ref: library/compression zstd compression zstd CompressionParameter window_log10594775
Ref: 2e0610594775
Ref: library/compression zstd compression zstd CompressionParameter hash_log10595213
Ref: 2e0810595213
Ref: library/compression zstd compression zstd CompressionParameter chain_log10595624
Ref: 2e0a10595624
Ref: library/compression zstd compression zstd CompressionParameter search_log10596140
Ref: 2e0c10596140
Ref: library/compression zstd compression zstd CompressionParameter min_match10596473
Ref: 2e0d10596473
Ref: library/compression zstd compression zstd CompressionParameter target_length10597042
Ref: 2e0f10597042
Ref: library/compression zstd compression zstd CompressionParameter strategy10597695
Ref: 2e1210597695
Ref: library/compression zstd compression zstd CompressionParameter enable_long_distance_matching10597985
Ref: 2e1310597985
Ref: library/compression zstd compression zstd CompressionParameter ldm_hash_log10598665
Ref: 2e1410598665
Ref: library/compression zstd compression zstd CompressionParameter ldm_min_match10598961
Ref: 2e1510598961
Ref: library/compression zstd compression zstd CompressionParameter ldm_bucket_size_log10599207
Ref: 2e1610599207
Ref: library/compression zstd compression zstd CompressionParameter ldm_hash_rate_log10599519
Ref: 2e1710599519
Ref: library/compression zstd compression zstd CompressionParameter content_size_flag10599890
Ref: 2df910599890
Ref: library/compression zstd compression zstd CompressionParameter checksum_flag10601023
Ref: 2e1810601023
Ref: library/compression zstd compression zstd CompressionParameter dict_id_flag10601436
Ref: 2e1910601436
Ref: library/compression zstd compression zstd CompressionParameter nb_workers10601708
Ref: 2e1a10601708
Ref: library/compression zstd compression zstd CompressionParameter job_size10602131
Ref: 2e1b10602131
Ref: library/compression zstd compression zstd CompressionParameter overlap_log10602491
Ref: 2e1c10602491
Ref: library/compression zstd compression zstd DecompressionParameter10603145
Ref: 2de610603145
Ref: library/compression zstd compression zstd DecompressionParameter bounds10603880
Ref: 2e1d10603880
Ref: library/compression zstd compression zstd DecompressionParameter window_log_max10604170
Ref: 2e1e10604170
Ref: library/compression zstd compression zstd Strategy10604546
Ref: 2de710604546
Ref: library/compression zstd compression zstd Strategy fast10605031
Ref: 2e0b10605031
Ref: library/compression zstd compression zstd Strategy dfast10605057
Ref: 2e0910605057
Ref: library/compression zstd compression zstd Strategy greedy10605084
Ref: 2e1f10605084
Ref: library/compression zstd compression zstd Strategy lazy10605112
Ref: 2e2010605112
Ref: library/compression zstd compression zstd Strategy lazy210605138
Ref: 2e2110605138
Ref: library/compression zstd compression zstd Strategy btlazy210605165
Ref: 2e2210605165
Ref: library/compression zstd compression zstd Strategy btopt10605194
Ref: 2e0e10605194
Ref: library/compression zstd compression zstd Strategy btultra10605221
Ref: 2e1010605221
Ref: library/compression zstd compression zstd Strategy btultra210605250
Ref: 2e1110605250
Node: その他<3>10605280
Ref: library/compression zstd miscellaneous10605455
Ref: 2e2310605455
Ref: library/compression zstd compression zstd get_frame_info10605491
Ref: 2e0210605491
Ref: library/compression zstd compression zstd FrameInfo10605723
Ref: 2e2410605723
Ref: library/compression zstd compression zstd FrameInfo decompressed_size10605811
Ref: 2e2510605811
Ref: library/compression zstd compression zstd FrameInfo dictionary_id10605913
Ref: 2e2610605913
Ref: library/compression zstd compression zstd COMPRESSION_LEVEL_DEFAULT10606274
Ref: 2e0710606274
Ref: library/compression zstd compression zstd zstd_version_info10606393
Ref: 2e2710606393
Node: 使用例<14>10606546
Ref: library/compression zstd examples10606686
Ref: 2e2810606686
Node: zlib --- gzip 互換の圧縮10608105
Ref: library/zlib doc10608332
Ref: 2e2910608332
Ref: library/zlib module-zlib10608332
Ref: 13910608332
Ref: library/zlib translation-repo10608332
Ref: 2e2a10608332
Ref: library/zlib zlib-compression-compatible-with-gzip10608332
Ref: 2e2b10608332
Ref: library/zlib zlib error10609303
Ref: 2e2c10609303
Ref: library/zlib zlib adler3210609412
Ref: 1bba10609412
Ref: library/zlib zlib compress10610454
Ref: 84f10610454
Ref: library/zlib compress-wbits10610995
Ref: 2e3110610995
Ref: library/zlib zlib compressobj10612247
Ref: 2e3310612247
Ref: library/zlib zlib crc3210614285
Ref: 1a1010614285
Ref: library/zlib zlib decompress10615224
Ref: f0910615224
Ref: library/zlib decompress-wbits10615658
Ref: 2e3a10615658
Ref: library/zlib zlib decompressobj10617521
Ref: 2e3b10617521
Ref: library/zlib zlib Compress compress10618710
Ref: 2e3c10618710
Ref: library/zlib zlib Compress flush10619220
Ref: 2e3d10619220
Ref: library/zlib zlib Compress copy10620032
Ref: 2e4410620032
Ref: library/zlib zlib Decompress unused_data10620471
Ref: 2e4510620471
Ref: library/zlib zlib Decompress unconsumed_tail10620953
Ref: 2e4610620953
Ref: library/zlib zlib Decompress eof10621535
Ref: 138510621535
Ref: library/zlib zlib Decompress decompress10621869
Ref: 2e4710621869
Ref: library/zlib zlib Decompress flush10623154
Ref: 2e4810623154
Ref: library/zlib zlib Decompress copy10623679
Ref: 2e4910623679
Ref: library/zlib zlib DEFLATED10624265
Ref: 2e3410624265
Ref: library/zlib zlib MAX_WBITS10624333
Ref: 2e3210624333
Ref: library/zlib zlib DEF_MEM_LEVEL10624517
Ref: 2e4a10624517
Ref: library/zlib zlib DEF_BUF_SIZE10624608
Ref: 2e4b10624608
Ref: library/zlib zlib Z_NO_COMPRESSION10624702
Ref: 2e2f10624702
Ref: library/zlib zlib Z_BEST_SPEED10624817
Ref: 2e2d10624817
Ref: library/zlib zlib Z_BEST_COMPRESSION10624928
Ref: 2e2e10624928
Ref: library/zlib zlib Z_DEFAULT_COMPRESSION10625044
Ref: 2e3010625044
Ref: library/zlib zlib Z_DEFAULT_STRATEGY10625232
Ref: 2e3510625232
Ref: library/zlib zlib Z_FILTERED10625325
Ref: 2e3610625325
Ref: library/zlib zlib Z_HUFFMAN_ONLY10625430
Ref: 2e3710625430
Ref: library/zlib zlib Z_RLE10625526
Ref: 2e3810625526
Ref: library/zlib zlib Z_FIXED10625767
Ref: 2e3910625767
Ref: library/zlib zlib Z_NO_FLUSH10626000
Ref: 2e3e10626000
Ref: library/zlib zlib Z_PARTIAL_FLUSH10626117
Ref: 2e3f10626117
Ref: library/zlib zlib Z_SYNC_FLUSH10626215
Ref: 2e4010626215
Ref: library/zlib zlib Z_FULL_FLUSH10626349
Ref: 2e4110626349
Ref: library/zlib zlib Z_FINISH10626473
Ref: 2e4310626473
Ref: library/zlib zlib Z_BLOCK10626594
Ref: 2e4210626594
Ref: library/zlib zlib Z_TREES10626816
Ref: 2e4c10626816
Ref: library/zlib zlib ZLIB_VERSION10627207
Ref: 2e4d10627207
Ref: library/zlib zlib ZLIB_RUNTIME_VERSION10627553
Ref: 138610627553
Ref: library/zlib zlib ZLIBNG_VERSION10627738
Ref: 2e4e10627738
Ref: zlib --- gzip 互換の圧縮-Footnote-110628669
Ref: zlib --- gzip 互換の圧縮-Footnote-210628698
Ref: zlib --- gzip 互換の圧縮-Footnote-310628739
Node: gzip --- gzip ファイルのサポート10628792
Ref: library/gzip doc10628985
Ref: 2e4f10628985
Ref: library/gzip gzip-support-for-gzip-files10628985
Ref: 2e5010628985
Ref: library/gzip module-gzip10628985
Ref: 6b10628985
Ref: library/gzip translation-repo10628985
Ref: 2e5110628985
Ref: library/gzip gzip open10630374
Ref: 2e5210630374
Ref: library/gzip gzip BadGzipFile10632330
Ref: bea10632330
Ref: library/gzip gzip GzipFile10632580
Ref: 65c10632580
Ref: library/gzip gzip GzipFile peek10636515
Ref: 142510636515
Ref: library/gzip gzip GzipFile mode10637101
Ref: 2e5510637101
Ref: library/gzip gzip GzipFile mtime10637323
Ref: 2e5310637323
Ref: library/gzip gzip GzipFile name10637663
Ref: 73110637663
Ref: library/gzip gzip compress10639172
Ref: 84e10639172
Ref: library/gzip gzip decompress10640380
Ref: 142610640380
Ref: gzip --- gzip ファイルのサポート-Footnote-110641123
Node: 使い方の例10641187
Ref: library/gzip examples-of-usage10641340
Ref: 2e5710641340
Ref: library/gzip gzip-usage-examples10641340
Ref: 2e5810641340
Ref: 使い方の例-Footnote-110642453
Node: コマンドライン・インターフェース<3>10642506
Ref: library/gzip command-line-interface10642659
Ref: 2e5910642659
Ref: library/gzip gzip-cli10642659
Ref: 2e5a10642659
Node: コマンドラインオプション10643128
Ref: library/gzip command-line-options10643252
Ref: 2e5b10643252
Ref: library/gzip cmdoption-gzip-arg-file10643333
Ref: 2e5c10643333
Ref: library/gzip cmdoption-gzip-fast10643417
Ref: 2e5d10643417
Ref: library/gzip cmdoption-gzip-best10643504
Ref: 2e5e10643504
Ref: library/gzip cmdoption-gzip-d10643591
Ref: 2e5f10643591
Ref: library/gzip cmdoption-gzip-decompress10643591
Ref: 2e6010643591
Ref: library/gzip cmdoption-gzip-h10643654
Ref: 2e6110643654
Ref: library/gzip cmdoption-gzip-help10643654
Ref: 2e6210643654
Node: bz2 --- bzip2 圧縮のサポート10643727
Ref: library/bz2 doc10643944
Ref: 2e6310643944
Ref: library/bz2 bz2-support-for-bzip2-compression10643944
Ref: 2e6410643944
Ref: library/bz2 module-bz210643944
Ref: 1410643944
Ref: library/bz2 translation-repo10643944
Ref: 2e6510643944
Ref: bz2 --- bzip2 圧縮のサポート-Footnote-110645157
Node: ファイルの圧縮/解凍10645220
Ref: library/bz2 de-compression-of-files10645356
Ref: 2e6610645356
Ref: library/bz2 bz2 open10645424
Ref: 129f10645424
Ref: library/bz2 bz2 BZ2File10647272
Ref: a6610647272
Ref: library/bz2 bz2 BZ2File peek10649066
Ref: 2e6710649066
Ref: library/bz2 bz2 BZ2File fileno10649814
Ref: 2e6810649814
Ref: library/bz2 bz2 BZ2File readable10649944
Ref: 2e6910649944
Ref: library/bz2 bz2 BZ2File seekable10650072
Ref: 2e6a10650072
Ref: library/bz2 bz2 BZ2File writable10650194
Ref: 2e6b10650194
Ref: library/bz2 bz2 BZ2File read110650322
Ref: 2e6c10650322
Ref: library/bz2 bz2 BZ2File readinto10650647
Ref: 2e6d10650647
Ref: library/bz2 bz2 BZ2File mode10650806
Ref: 2e6e10650806
Ref: library/bz2 bz2 BZ2File name10650950
Ref: 2e6f10650950
Node: 逐次圧縮および展開10652558
Ref: library/bz2 incremental-de-compression10652722
Ref: 2e7010652722
Ref: library/bz2 bz2 BZ2Compressor10652788
Ref: 1ace10652788
Ref: library/bz2 bz2 BZ2Compressor compress10653266
Ref: 2e7110653266
Ref: library/bz2 bz2 BZ2Compressor flush10653766
Ref: 2e7210653766
Ref: library/bz2 bz2 BZ2Decompressor10654079
Ref: 1acc10654079
Ref: library/bz2 bz2 BZ2Decompressor decompress10654876
Ref: fca10654876
Ref: library/bz2 bz2 BZ2Decompressor eof10656490
Ref: 2e7510656490
Ref: library/bz2 bz2 BZ2Decompressor unused_data10656638
Ref: 2e7410656638
Ref: library/bz2 bz2 BZ2Decompressor needs_input10656903
Ref: 2e7310656903
Node: 一括圧縮/解凍10657153
Ref: library/bz2 one-shot-de-compression10657307
Ref: 2e7610657307
Ref: library/bz2 bz2 compress10657360
Ref: 287d10657360
Ref: library/bz2 bz2 decompress10657781
Ref: 12a010657781
Node: 使い方の例<2>10658211
Ref: library/bz2 bz2-usage-examples10658329
Ref: 2e7710658329
Ref: library/bz2 examples-of-usage10658329
Ref: 2e7810658329
Node: lzma --- LZMA アルゴリズムを使用した圧縮10661401
Ref: library/lzma doc10661617
Ref: 2e7910661617
Ref: library/lzma lzma-compression-using-the-lzma-algorithm10661617
Ref: 2e7a10661617
Ref: library/lzma module-lzma10661617
Ref: 8e10661617
Ref: library/lzma translation-repo10661617
Ref: 2e7b10661617
Ref: library/lzma lzma LZMAError10662948
Ref: 2e7c10662948
Ref: lzma --- LZMA アルゴリズムを使用した圧縮-Footnote-110663441
Node: 圧縮ファイルへの読み書き<2>10663505
Ref: library/lzma reading-and-writing-compressed-files10663679
Ref: 2e7d10663679
Ref: library/lzma lzma open10663760
Ref: 2e7e10663760
Ref: library/lzma lzma LZMAFile10666044
Ref: 120e10666044
Ref: library/lzma lzma LZMAFile peek10668534
Ref: 2e7f10668534
Ref: library/lzma lzma LZMAFile mode10669279
Ref: 2e8010669279
Ref: library/lzma lzma LZMAFile name10669423
Ref: 2e8110669423
Node: メモリ上での圧縮と展開<2>10670004
Ref: library/lzma compressing-and-decompressing-data-in-memory10670199
Ref: 2e8210670199
Ref: library/lzma lzma LZMACompressor10670275
Ref: 1acd10670275
Ref: library/lzma lzma LZMACompressor compress10674182
Ref: 2e8510674182
Ref: library/lzma lzma LZMACompressor flush10674755
Ref: 2e8610674755
Ref: library/lzma lzma LZMADecompressor10675079
Ref: 1acb10675079
Ref: library/lzma lzma LZMADecompressor decompress10676889
Ref: 102e10676889
Ref: library/lzma lzma LZMADecompressor check10678504
Ref: 2e8a10678504
Ref: library/lzma lzma LZMADecompressor eof10678862
Ref: 2e8b10678862
Ref: library/lzma lzma LZMADecompressor unused_data10678977
Ref: 2e8910678977
Ref: library/lzma lzma LZMADecompressor needs_input10679195
Ref: 2e8810679195
Ref: library/lzma lzma compress10679446
Ref: 2e8310679446
Ref: library/lzma lzma decompress10679864
Ref: 2e8710679864
Node: その他<4>10680423
Ref: library/lzma miscellaneous10680624
Ref: 2e8c10680624
Ref: library/lzma lzma is_check_supported10680660
Ref: 2e8d10680660
Node: カスタムフィルタチェインの指定10681119
Ref: library/lzma filter-chain-specs10681297
Ref: 2e8410681297
Ref: library/lzma specifying-custom-filter-chains10681297
Ref: 2e8e10681297
Node: 使用例<15>10684528
Ref: library/lzma examples10684685
Ref: 2e8f10684685
Node: zipfile --- ZIP アーカイブの処理10686115
Ref: library/zipfile doc10686354
Ref: 2e9010686354
Ref: library/zipfile module-zipfile10686354
Ref: 13710686354
Ref: library/zipfile translation-repo10686354
Ref: 2e9110686354
Ref: library/zipfile zipfile-work-with-zip-archives10686354
Ref: 2e9210686354
Ref: library/zipfile zipfile BadZipFile10687871
Ref: 1b6810687871
Ref: library/zipfile zipfile BadZipfile10688018
Ref: 2e9310688018
Ref: library/zipfile zipfile LargeZipFile10688234
Ref: 2e9410688234
Ref: library/zipfile zipfile ZipInfo10689058
Ref: 2cb10689058
Ref: library/zipfile zipfile ZipInfo _for_archive10690005
Ref: 2ca10690005
Ref: library/zipfile zipfile is_zipfile10690289
Ref: 154210690289
Ref: library/zipfile zipfile ZIP_STORED10690747
Ref: 2e9910690747
Ref: library/zipfile zipfile ZIP_DEFLATED10690925
Ref: 2e9a10690925
Ref: library/zipfile zipfile ZIP_BZIP210691094
Ref: 2e9b10691094
Ref: library/zipfile zipfile ZIP_LZMA10691278
Ref: 2e9c10691278
Ref: library/zipfile zipfile ZIP_ZSTANDARD10691461
Ref: 2e9d10691461
Ref: zipfile --- ZIP アーカイブの処理-Footnote-110693008
Ref: zipfile --- ZIP アーカイブの処理-Footnote-210693073
Ref: zipfile --- ZIP アーカイブの処理-Footnote-310693141
Ref: zipfile --- ZIP アーカイブの処理-Footnote-410693209
Node: ZipFile objects10693250
Ref: library/zipfile id110693363
Ref: 2e9e10693363
Ref: library/zipfile zipfile-objects10693363
Ref: 2e9510693363
Ref: library/zipfile zipfile ZipFile10693414
Ref: 8d310693414
Ref: library/zipfile zipfile ZipFile close10699632
Ref: 2e9f10699632
Ref: library/zipfile zipfile ZipFile getinfo10699936
Ref: 2e9610699936
Ref: library/zipfile zipfile ZipFile infolist10700268
Ref: 2e9710700268
Ref: library/zipfile zipfile ZipFile namelist10700610
Ref: 2ea010700610
Ref: library/zipfile zipfile ZipFile open10700719
Ref: 65d10700719
Ref: library/zipfile zipfile ZipFile extract10703773
Ref: 2ea310703773
Ref: library/zipfile zipfile ZipFile extractall10705426
Ref: 2ea410705426
Ref: library/zipfile zipfile ZipFile printdir10706719
Ref: 2ea510706719
Ref: library/zipfile zipfile ZipFile setpassword10706840
Ref: 2ea610706840
Ref: library/zipfile zipfile ZipFile read10706983
Ref: 2ea210706983
Ref: library/zipfile zipfile ZipFile testzip10707955
Ref: 2ea710707955
Ref: library/zipfile zipfile ZipFile write10708336
Ref: f4910708336
Ref: library/zipfile zipfile ZipFile writestr10710331
Ref: 2cc10710331
Ref: library/zipfile zipfile ZipFile mkdir10712053
Ref: 8d410712053
Ref: library/zipfile zipfile ZipFile filename10712594
Ref: 2ea810712594
Ref: library/zipfile zipfile ZipFile debug10712668
Ref: 2ea910712668
Ref: library/zipfile zipfile ZipFile comment10712987
Ref: 2eaa10712987
Node: Path objects10713435
Ref: library/zipfile id210713574
Ref: 2eab10713574
Ref: library/zipfile path-objects10713574
Ref: 2eac10713574
Ref: library/zipfile zipfile Path10713619
Ref: 8d810713619
Ref: library/zipfile zipfile Path name10714789
Ref: 2ead10714789
Ref: library/zipfile zipfile Path open10714847
Ref: 190710714847
Ref: library/zipfile zipfile Path iterdir10715748
Ref: 2eae10715748
Ref: library/zipfile zipfile Path is_dir10715838
Ref: 2eaf10715838
Ref: library/zipfile zipfile Path is_file10715943
Ref: 2eb010715943
Ref: library/zipfile zipfile Path is_symlink10716044
Ref: 2eb110716044
Ref: library/zipfile zipfile Path exists10716300
Ref: 2eb210716300
Ref: library/zipfile zipfile Path suffix10716434
Ref: 8d610716434
Ref: library/zipfile zipfile Path stem10716649
Ref: 8d510716649
Ref: library/zipfile zipfile Path suffixes10716794
Ref: 8d710716794
Ref: library/zipfile zipfile Path read_text10716967
Ref: 1ade10716967
Ref: library/zipfile zipfile Path read_bytes10717556
Ref: 2eb310717556
Ref: library/zipfile zipfile Path joinpath10717632
Ref: 2eb410717632
Ref: Path objects-Footnote-110718295
Node: PyZipFile objects10718334
Ref: library/zipfile id310718473
Ref: 2eb510718473
Ref: library/zipfile pyzipfile-objects10718473
Ref: 2eb610718473
Ref: library/zipfile zipfile PyZipFile10718700
Ref: 11fa10718700
Ref: library/zipfile zipfile PyZipFile writepy10719125
Ref: 11fb10719125
Node: ZipInfo objects10722419
Ref: library/zipfile id410722597
Ref: 2eb710722597
Ref: library/zipfile zipinfo-objects10722597
Ref: 2e9810722597
Ref: library/zipfile zipfile ZipInfo from_file10723045
Ref: f0610723045
Ref: library/zipfile zipfile ZipInfo is_dir10724198
Ref: f0710724198
Ref: library/zipfile zipfile ZipInfo filename10724441
Ref: 2eb810724441
Ref: library/zipfile zipfile ZipInfo date_time10724520
Ref: 2eb910724520
Ref: library/zipfile zipfile ZipInfo compress_type10726114
Ref: 2eba10726114
Ref: library/zipfile zipfile ZipInfo comment10726201
Ref: 2ebb10726201
Ref: library/zipfile zipfile ZipInfo extra10726317
Ref: 2ebc10726317
Ref: library/zipfile zipfile ZipInfo create_system10726567
Ref: 2ebd10726567
Ref: library/zipfile zipfile ZipInfo create_version10726685
Ref: 2ebe10726685
Ref: library/zipfile zipfile ZipInfo extract_version10726795
Ref: 2ebf10726795
Ref: library/zipfile zipfile ZipInfo reserved10726921
Ref: 2ec010726921
Ref: library/zipfile zipfile ZipInfo flag_bits10727015
Ref: 2ec110727015
Ref: library/zipfile zipfile ZipInfo volume10727084
Ref: 2ec210727084
Ref: library/zipfile zipfile ZipInfo internal_attr10727170
Ref: 2ec310727170
Ref: library/zipfile zipfile ZipInfo external_attr10727230
Ref: 2ec410727230
Ref: library/zipfile zipfile ZipInfo header_offset10727302
Ref: 2ec510727302
Ref: library/zipfile zipfile ZipInfo CRC10727401
Ref: 2ec610727401
Ref: library/zipfile zipfile ZipInfo compress_size10727492
Ref: 2ec710727492
Ref: library/zipfile zipfile ZipInfo file_size10727573
Ref: 2ea110727573
Ref: ZipInfo objects-Footnote-110727689
Node: コマンドライン・インターフェース<4>10727757
Ref: library/zipfile command-line-interface10727940
Ref: 2ec810727940
Ref: library/zipfile zipfile-commandline10727940
Ref: 2ec910727940
Node: コマンドラインオプション<2>10728890
Ref: library/zipfile command-line-options10729017
Ref: 2ecd10729017
Ref: library/zipfile cmdoption-zipfile-l10729098
Ref: 2ecc10729098
Ref: library/zipfile cmdoption-zipfile-list10729123
Ref: 2ece10729123
Ref: library/zipfile cmdoption-zipfile-c10729213
Ref: 2eca10729213
Ref: library/zipfile cmdoption-zipfile-create10729262
Ref: 2ecf10729262
Ref: library/zipfile cmdoption-zipfile-e10729382
Ref: 2ecb10729382
Ref: library/zipfile cmdoption-zipfile-extract10729420
Ref: 2ed010729420
Ref: library/zipfile cmdoption-zipfile-t10729538
Ref: 2ed110729538
Ref: library/zipfile cmdoption-zipfile-test10729563
Ref: 2ed210729563
Ref: library/zipfile cmdoption-zipfile-metadata-encoding10729644
Ref: 2ed310729644
Node: Decompression pitfalls10729817
Ref: library/zipfile decompression-pitfalls10729976
Ref: 2ed410729976
Node: From file itself10730259
Ref: library/zipfile from-file-itself10730366
Ref: 2ed510730366
Node: File system limitations10730545
Ref: library/zipfile file-system-limitations10730682
Ref: 2ed610730682
Node: Resources limitations10730984
Ref: library/zipfile resources-limitations10731117
Ref: 2ed710731117
Ref: library/zipfile zipfile-resources-limitations10731117
Ref: 2ed810731117
Ref: Resources limitations-Footnote-110731404
Node: Interruption10731451
Ref: library/zipfile interruption10731592
Ref: 2ed910731592
Node: Default behaviors of extraction10731798
Ref: library/zipfile default-behaviors-of-extraction10731909
Ref: 2eda10731909
Node: tarfile --- tar アーカイブファイルの読み書き10732174
Ref: library/tarfile doc10732351
Ref: 2edb10732351
Ref: library/tarfile module-tarfile10732351
Ref: e410732351
Ref: library/tarfile tarfile-read-and-write-tar-archive-files10732351
Ref: 2edc10732351
Ref: library/tarfile translation-repo10732351
Ref: 2edd10732351
Ref: library/tarfile tarfile open10734842
Ref: 107710734842
Ref: library/tarfile tarfile is_tarfile10744447
Ref: 1bdb10744447
Ref: library/tarfile tarfile TarError10744856
Ref: 2ee210744856
Ref: library/tarfile tarfile ReadError10744937
Ref: 1c4f10744937
Ref: library/tarfile tarfile CompressionError10745100
Ref: 2ee010745100
Ref: library/tarfile tarfile StreamError10745286
Ref: 2ee310745286
Ref: library/tarfile tarfile ExtractError10745453
Ref: 2ee410745453
Ref: library/tarfile tarfile HeaderError10745696
Ref: 2ee510745696
Ref: library/tarfile tarfile FilterError10745863
Ref: 2ee710745863
Ref: library/tarfile tarfile FilterError tarinfo10745958
Ref: 2ee910745958
Ref: library/tarfile tarfile AbsolutePathError10746097
Ref: 2eeb10746097
Ref: library/tarfile tarfile OutsideDestinationError10746202
Ref: 2eec10746202
Ref: library/tarfile tarfile SpecialFileError10746330
Ref: 2eed10746330
Ref: library/tarfile tarfile AbsoluteLinkError10746448
Ref: 2eee10746448
Ref: library/tarfile tarfile LinkOutsideDestinationError10746560
Ref: 2eef10746560
Ref: library/tarfile tarfile LinkFallbackError10746708
Ref: 29d10746708
Ref: library/tarfile tarfile ENCODING10747128
Ref: 2ef010747128
Ref: library/tarfile tarfile REGTYPE10747327
Ref: 2ef110747327
Ref: library/tarfile tarfile AREGTYPE10747358
Ref: 2ef210747358
Ref: library/tarfile tarfile LNKTYPE10747430
Ref: 2ef410747430
Ref: library/tarfile tarfile SYMTYPE10747510
Ref: 2ef510747510
Ref: library/tarfile tarfile CHRTYPE10747582
Ref: 2ef610747582
Ref: library/tarfile tarfile BLKTYPE10747665
Ref: 2ef710747665
Ref: library/tarfile tarfile DIRTYPE10747744
Ref: 2ef810747744
Ref: library/tarfile tarfile FIFOTYPE10747812
Ref: 2ef910747812
Ref: library/tarfile tarfile CONTTYPE10747891
Ref: 2efa10747891
Ref: library/tarfile tarfile GNUTYPE_LONGNAME10747966
Ref: 2efb10747966
Ref: library/tarfile tarfile GNUTYPE_LONGLINK10748050
Ref: 2efc10748050
Ref: library/tarfile tarfile GNUTYPE_SPARSE10748134
Ref: 2efd10748134
Ref: library/tarfile tarfile USTAR_FORMAT10748417
Ref: 2eff10748417
Ref: library/tarfile tarfile GNU_FORMAT10748503
Ref: 2f0010748503
Ref: library/tarfile tarfile PAX_FORMAT10748574
Ref: 2f0110748574
Ref: library/tarfile tarfile DEFAULT_FORMAT10748656
Ref: 2f0210748656
Ref: tarfile --- tar アーカイブファイルの読み書き-Footnote-110749740
Ref: tarfile --- tar アーカイブファイルの読み書き-Footnote-210749807
Node: TarFile オブジェクト10749879
Ref: library/tarfile id110750035
Ref: 2f0310750035
Ref: library/tarfile tarfile-objects10750035
Ref: 2edf10750035
Ref: library/tarfile tarfile TarFile10751370
Ref: 142910751370
Ref: library/tarfile tarfile TarFile open10755724
Ref: 1bdc10755724
Ref: library/tarfile tarfile TarFile getmember10755974
Ref: 1bf010755974
Ref: library/tarfile tarfile TarFile getmembers10756396
Ref: 107910756396
Ref: library/tarfile tarfile TarFile getnames10756633
Ref: 2f0510756633
Ref: library/tarfile tarfile TarFile list10756825
Ref: 107810756825
Ref: library/tarfile tarfile TarFile next10757364
Ref: 2f0610757364
Ref: library/tarfile tarfile TarFile extractall10757688
Ref: 29b10757688
Ref: library/tarfile tarfile TarFile extract10760022
Ref: 29c10760022
Ref: library/tarfile tarfile TarFile extractfile10761651
Ref: 2f0710761651
Ref: library/tarfile tarfile TarFile errorlevel10762601
Ref: 29e10762601
Ref: library/tarfile tarfile TarFile extraction_filter10763532
Ref: 2f0810763532
Ref: library/tarfile tarfile TarFile add10764816
Ref: dee10764816
Ref: library/tarfile tarfile TarFile addfile10766165
Ref: 19a710766165
Ref: library/tarfile tarfile TarFile gettarinfo10766698
Ref: 2f0910766698
Ref: library/tarfile tarfile TarFile close10768178
Ref: 2f0c10768178
Ref: library/tarfile tarfile TarFile pax_headers10768377
Ref: 2f0d10768377
Node: TarInfo オブジェクト10768519
Ref: library/tarfile id210768702
Ref: 2f0e10768702
Ref: library/tarfile tarinfo-objects10768702
Ref: 2eea10768702
Ref: library/tarfile tarfile TarInfo10770093
Ref: 142a10770093
Ref: library/tarfile tarfile TarInfo frombuf10770202
Ref: 2ee610770202
Ref: library/tarfile tarfile TarInfo fromtarfile10770479
Ref: 2f1010770479
Ref: library/tarfile tarfile TarInfo tobuf10770733
Ref: 2f1110770733
Ref: library/tarfile tarfile TarInfo name10771280
Ref: 2f0b10771280
Ref: library/tarfile tarfile TarInfo size10771372
Ref: 2f0a10771372
Ref: library/tarfile tarfile TarInfo mtime10771458
Ref: 2f1210771458
Ref: library/tarfile tarfile TarInfo mode10771825
Ref: 2f1510771825
Ref: library/tarfile tarfile TarInfo type10772104
Ref: 2ef310772104
Ref: library/tarfile tarfile TarInfo linkname10772648
Ref: 2f1610772648
Ref: library/tarfile tarfile TarInfo uid10773095
Ref: 2f1710773095
Ref: library/tarfile tarfile TarInfo gid10773405
Ref: 2f1810773405
Ref: library/tarfile tarfile TarInfo uname10773715
Ref: 2f1910773715
Ref: library/tarfile tarfile TarInfo gname10774027
Ref: 2f1a10774027
Ref: library/tarfile tarfile TarInfo chksum10774339
Ref: 2f1b10774339
Ref: library/tarfile tarfile TarInfo devmajor10774410
Ref: 2f1c10774410
Ref: library/tarfile tarfile TarInfo devminor10774487
Ref: 2f1d10774487
Ref: library/tarfile tarfile TarInfo offset10774564
Ref: 2f1e10774564
Ref: library/tarfile tarfile TarInfo offset_data10774646
Ref: 2f1f10774646
Ref: library/tarfile tarfile TarInfo sparse10774734
Ref: 2f2010774734
Ref: library/tarfile tarfile TarInfo pax_headers10774798
Ref: 2f2110774798
Ref: library/tarfile tarfile TarInfo replace10774936
Ref: 2f0f10774936
Ref: library/tarfile tarfile TarInfo isfile10775670
Ref: 2f2210775670
Ref: library/tarfile tarfile TarInfo isreg10775796
Ref: 2f2310775796
Ref: library/tarfile tarfile TarInfo isdir10775879
Ref: 2f2410775879
Ref: library/tarfile tarfile TarInfo issym10775988
Ref: 2f2510775988
Ref: library/tarfile tarfile TarInfo islnk10776106
Ref: 2f2610776106
Ref: library/tarfile tarfile TarInfo ischr10776215
Ref: 2f2710776215
Ref: library/tarfile tarfile TarInfo isblk10776336
Ref: 2f2810776336
Ref: library/tarfile tarfile TarInfo isfifo10776451
Ref: 2f2910776451
Ref: library/tarfile tarfile TarInfo isdev10776548
Ref: 2f2a10776548
Node: Extraction filters10776735
Ref: library/tarfile extraction-filters10776937
Ref: 2f2b10776937
Ref: library/tarfile tarfile-extraction-filter10776937
Ref: 69710776937
Ref: Extraction filters-Footnote-110780145
Node: Default named filters10780187
Ref: library/tarfile default-named-filters10780285
Ref: 2f2d10780285
Ref: library/tarfile tarfile fully_trusted_filter10780449
Ref: 2ede10780449
Ref: library/tarfile tarfile tar_filter10780598
Ref: 2f2c10780598
Ref: library/tarfile tarfile data_filter10781406
Ref: 29a10781406
Node: Filter errors10783264
Ref: library/tarfile filter-errors10783401
Ref: 2f2e10783401
Ref: library/tarfile tarfile-extraction-refuse10783401
Ref: 2ee810783401
Node: Hints for further verification10783761
Ref: library/tarfile hints-for-further-verification10783909
Ref: 2f2f10783909
Ref: library/tarfile tarfile-further-verification10783909
Ref: 2cf410783909
Node: Supporting older Python versions10785648
Ref: library/tarfile supporting-older-python-versions10785817
Ref: 2f3010785817
Node: Stateful extraction filter example10787377
Ref: library/tarfile stateful-extraction-filter-example10787507
Ref: 2f3110787507
Node: コマンドラインインターフェイス10788299
Ref: library/tarfile command-line-interface10788488
Ref: 2f3210788488
Ref: library/tarfile tarfile-commandline10788488
Ref: 11cd10788488
Node: コマンドラインオプション<3>10789640
Ref: library/tarfile command-line-options10789761
Ref: 2f3610789761
Ref: library/tarfile cmdoption-tarfile-l10789844
Ref: 2f3510789844
Ref: library/tarfile cmdoption-tarfile-list10789869
Ref: 2f3710789869
Ref: library/tarfile cmdoption-tarfile-c10789959
Ref: 2f3310789959
Ref: library/tarfile cmdoption-tarfile-create10790008
Ref: 2f3810790008
Ref: library/tarfile cmdoption-tarfile-e10790128
Ref: 2f3410790128
Ref: library/tarfile cmdoption-tarfile-extract10790168
Ref: 2f3910790168
Ref: library/tarfile cmdoption-tarfile-t10790340
Ref: 2f3a10790340
Ref: library/tarfile cmdoption-tarfile-test10790365
Ref: 2f3b10790365
Ref: library/tarfile cmdoption-tarfile-v10790446
Ref: 2f3c10790446
Ref: library/tarfile cmdoption-tarfile-verbose10790446
Ref: 2f3d10790446
Ref: library/tarfile cmdoption-tarfile-filter10790507
Ref: 2f3e10790507
Node: 使用例<16>10790742
Ref: library/tarfile examples10790960
Ref: 2f3f10790960
Ref: library/tarfile tar-examples10790960
Ref: 2ee110790960
Node: Reading examples10791050
Ref: library/tarfile reading-examples10791141
Ref: 2f4010791141
Node: Writing examples10792327
Ref: library/tarfile writing-examples10792418
Ref: 2f4110792418
Node: サポートしている tar フォーマット10793633
Ref: library/tarfile supported-tar-formats10793832
Ref: 2f4210793832
Ref: library/tarfile tar-formats10793832
Ref: 2efe10793832
Node: Unicode に関する問題10796335
Ref: library/tarfile tar-unicode10796512
Ref: 2f0410796512
Ref: library/tarfile unicode-issues10796512
Ref: 2f4310796512
Node: ファイルフォーマット10799253
Ref: library/fileformats doc10799426
Ref: 2f4510799426
Ref: library/fileformats file-formats10799426
Ref: 2f4610799426
Ref: library/fileformats fileformats10799426
Ref: 2f4710799426
Ref: library/fileformats translation-repo10799426
Ref: 2f4810799426
Node: csv --- CSV ファイルの読み書き10800114
Ref: library/csv doc10800279
Ref: 2f4910800279
Ref: library/csv csv-csv-file-reading-and-writing10800279
Ref: 2f4a10800279
Ref: library/csv module-csv10800279
Ref: 2d10800279
Ref: csv --- CSV ファイルの読み書き-Footnote-110802736
Ref: csv --- CSV ファイルの読み書き-Footnote-210802799
Ref: csv --- CSV ファイルの読み書き-Footnote-310802858
Node: モジュールコンテンツ<3>10802900
Ref: library/csv csv-contents10803062
Ref: 2f4b10803062
Ref: library/csv module-contents10803062
Ref: 2f4c10803062
Ref: library/csv csv reader10803188
Ref: 6ae10803188
Ref: library/csv csv writer10804983
Ref: 6af10804983
Ref: library/csv csv register_dialect10807203
Ref: 193910807203
Ref: library/csv csv unregister_dialect10807794
Ref: 1b9310807794
Ref: library/csv csv get_dialect10808037
Ref: 1b9210808037
Ref: library/csv csv list_dialects10808307
Ref: 1b9410808307
Ref: library/csv csv field_size_limit10808411
Ref: 1b9110808411
Ref: library/csv csv DictReader10808731
Ref: bd810808731
Ref: library/csv csv DictWriter10810923
Ref: 141710810923
Ref: library/csv csv Dialect10812816
Ref: 182710812816
Ref: library/csv csv excel10813774
Ref: 2f5010813774
Ref: library/csv csv excel_tab10814027
Ref: 2f5110814027
Ref: library/csv csv unix_dialect10814298
Ref: 141610814298
Ref: library/csv csv Sniffer10814709
Ref: 2f5210814709
Ref: library/csv csv Sniffer sniff10814952
Ref: 2f5310814952
Ref: library/csv csv Sniffer has_header10815352
Ref: 1c5710815352
Ref: library/csv csv-constants10816560
Ref: 2f5410816560
Ref: library/csv csv QUOTE_ALL10816615
Ref: 2f5510816615
Ref: library/csv csv QUOTE_MINIMAL10816779
Ref: 2f5610816779
Ref: library/csv csv QUOTE_NONNUMERIC10817098
Ref: 194710817098
Ref: library/csv csv QUOTE_NONE10817790
Ref: 2f5710817790
Ref: library/csv csv QUOTE_NOTNULL10818439
Ref: 6ac10818439
Ref: library/csv csv QUOTE_STRINGS10818882
Ref: 6ad10818882
Ref: library/csv csv Error10819410
Ref: 2f4f10819410
Ref: モジュールコンテンツ<3>-Footnote-110819569
Ref: モジュールコンテンツ<3>-Footnote-210819912
Node: Dialect クラスと書式化パラメータ10820255
Ref: library/csv csv-fmt-params10820451
Ref: 2f4e10820451
Ref: library/csv dialects-and-formatting-parameters10820451
Ref: 2f5810820451
Ref: library/csv csv Dialect delimiter10821264
Ref: 2f5910821264
Ref: library/csv csv Dialect doublequote10821445
Ref: 2f5a10821445
Ref: library/csv csv Dialect escapechar10822148
Ref: 2f5b10822148
Ref: library/csv csv Dialect lineterminator10822880
Ref: 2f5c10822880
Ref: library/csv csv Dialect quotechar10823355
Ref: 2f5d10823355
Ref: library/csv csv Dialect quoting10823868
Ref: 2f5e10823868
Ref: library/csv csv Dialect skipinitialspace10824180
Ref: 2f5f10824180
Ref: library/csv csv Dialect strict10824465
Ref: 2f6010824465
Node: reader オブジェクト10824649
Ref: library/csv id310824837
Ref: 2f6110824837
Ref: library/csv reader-objects10824837
Ref: 2f4d10824837
Ref: library/csv csv csvreader __next__10825116
Ref: 2f6210825116
Ref: library/csv csv csvreader dialect10825656
Ref: 2f6310825656
Ref: library/csv csv csvreader line_num10825772
Ref: 2f6410825772
Ref: library/csv csv DictReader fieldnames10826088
Ref: 2f6510826088
Node: writer オブジェクト10826352
Ref: library/csv writer-objects10826509
Ref: 2f6610826509
Ref: library/csv csv csvwriter writerow10827440
Ref: fe910827440
Ref: library/csv csv csvwriter writerows10827878
Ref: 2f6710827878
Ref: library/csv csv csvwriter dialect10828230
Ref: 2f6810828230
Ref: library/csv csv DictWriter writeheader10828432
Ref: 141810828432
Node: 使用例<17>10828957
Ref: library/csv csv-examples10829080
Ref: 2f6910829080
Ref: library/csv examples10829080
Ref: 2f6a10829080
Node: configparser --- 設定ファイルのパーサー10831361
Ref: library/configparser doc10831573
Ref: 2f6b10831573
Ref: library/configparser configparser-configuration-file-parser10831573
Ref: 2f6c10831573
Ref: library/configparser module-configparser10831573
Ref: 2610831573
Ref: library/configparser translation-repo10831573
Ref: 2f6d10831573
Ref: configparser --- 設定ファイルのパーサー-Footnote-110833277
Node: クイックスタート10833349
Ref: library/configparser quick-start10833502
Ref: 2f6e10833502
Ref: クイックスタート-Footnote-110837528
Ref: クイックスタート-Footnote-210837766
Node: サポートされるデータ型10838004
Ref: library/configparser supported-datatypes10838175
Ref: 2f7210838175
Ref: サポートされるデータ型-Footnote-110839699
Ref: サポートされるデータ型-Footnote-210839937
Node: 代替値10840175
Ref: library/configparser fallback-values10840365
Ref: 2f7610840365
Node: サポートするINI ファイルの構造10841924
Ref: library/configparser supported-ini-file-structure10842097
Ref: 2f6f10842097
Ref: サポートするINI ファイルの構造-Footnote-110844916
Ref: サポートするINI ファイルの構造-Footnote-210845154
Ref: サポートするINI ファイルの構造-Footnote-310845392
Ref: サポートするINI ファイルの構造-Footnote-410845630
Ref: サポートするINI ファイルの構造-Footnote-510845868
Node: Unnamed Sections10846106
Ref: library/configparser id1010846282
Ref: 2f7810846282
Ref: library/configparser unnamed-sections10846282
Ref: 2f7910846282
Node: 値の補間10846762
Ref: library/configparser interpolation-of-values10846934
Ref: 2f7a10846934
Ref: library/configparser configparser BasicInterpolation10847221
Ref: 92c10847221
Ref: library/configparser configparser ExtendedInterpolation10848638
Ref: 92d10848638
Ref: 値の補間-Footnote-110850268
Node: マップ型プロトコルアクセス10850506
Ref: library/configparser mapping-protocol-access10850716
Ref: 2f7010850716
Ref: マップ型プロトコルアクセス-Footnote-110854167
Node: パーサーの振る舞いをカスタマイズする10854405
Ref: library/configparser customizing-parser-behaviour10854629
Ref: 2f7110854629
Ref: library/configparser configparser ConfigParser BOOLEAN_STATES10866328
Ref: 2f7d10866328
Ref: library/configparser configparser ConfigParser SECTCRE10868730
Ref: 2f7710868730
Node: レガシーな API の例10870189
Ref: library/configparser legacy-api-examples10870405
Ref: 2f7e10870405
Node: ConfigParser オブジェクト10874305
Ref: library/configparser configparser-objects10874501
Ref: 2f7f10874501
Ref: library/configparser id1310874501
Ref: 2f8010874501
Ref: library/configparser configparser ConfigParser10874580
Ref: 4de10874580
Ref: library/configparser configparser ConfigParser defaults10880407
Ref: 2f8310880407
Ref: library/configparser configparser ConfigParser sections10880539
Ref: 2f8410880539
Ref: library/configparser configparser ConfigParser add_section10880712
Ref: 148510880712
Ref: library/configparser configparser ConfigParser has_section10881404
Ref: 2f8510881404
Ref: library/configparser configparser ConfigParser options10881591
Ref: 2f8610881591
Ref: library/configparser configparser ConfigParser has_option10881748
Ref: 2f8710881748
Ref: library/configparser configparser ConfigParser read10882144
Ref: 168110882144
Ref: library/configparser configparser ConfigParser read_file10884376
Ref: 72a10884376
Ref: library/configparser configparser ConfigParser read_string10884930
Ref: 2f7c10884930
Ref: library/configparser configparser ConfigParser read_dict10885378
Ref: 2f7b10885378
Ref: library/configparser configparser ConfigParser get10886216
Ref: 148310886216
Ref: library/configparser configparser ConfigParser getint10887201
Ref: 2f7410887201
Ref: library/configparser configparser ConfigParser getfloat10887529
Ref: 2f7510887529
Ref: library/configparser configparser ConfigParser getboolean10887839
Ref: 2f7310887839
Ref: library/configparser configparser ConfigParser items10888570
Ref: 2f8810888570
Ref: library/configparser configparser ConfigParser set10889367
Ref: 148410889367
Ref: library/configparser configparser ConfigParser write10889799
Ref: 1de10889799
Ref: library/configparser configparser ConfigParser remove_option10890800
Ref: 2f8a10890800
Ref: library/configparser configparser ConfigParser remove_section10891216
Ref: 2f8b10891216
Ref: library/configparser configparser ConfigParser optionxform10891484
Ref: 2f8110891484
Ref: library/configparser configparser UNNAMED_SECTION10892686
Ref: 178a10892686
Ref: library/configparser configparser MAX_INTERPOLATION_DEPTH10892862
Ref: 2f8c10892862
Node: RawConfigParser オブジェクト10893100
Ref: library/configparser id1510893279
Ref: 2f8d10893279
Ref: library/configparser rawconfigparser-objects10893279
Ref: 2f8e10893279
Ref: library/configparser configparser RawConfigParser10893364
Ref: 116610893364
Ref: library/configparser configparser RawConfigParser add_section10894843
Ref: 2f8f10894843
Ref: library/configparser configparser RawConfigParser set10895687
Ref: 2f9110895687
Node: 例外<9>10896817
Ref: library/configparser exceptions10896956
Ref: 2f9210896956
Ref: library/configparser configparser Error10896989
Ref: 2f9310896989
Ref: library/configparser configparser NoSectionError10897083
Ref: 2f8910897083
Ref: library/configparser configparser DuplicateSectionError10897215
Ref: 148610897215
Ref: library/configparser configparser DuplicateOptionError10897628
Ref: 148710897628
Ref: library/configparser configparser NoOptionError10898073
Ref: 2f9410898073
Ref: library/configparser configparser InterpolationError10898249
Ref: 2f9510898249
Ref: library/configparser configparser InterpolationDepthError10898394
Ref: 2f9610898394
Ref: library/configparser configparser InterpolationMissingOptionError10898683
Ref: 2f9710898683
Ref: library/configparser configparser InterpolationSyntaxError10898906
Ref: 2f9810898906
Ref: library/configparser configparser MissingSectionHeaderError10899153
Ref: 2f9910899153
Ref: library/configparser configparser ParsingError10899332
Ref: 72910899332
Ref: library/configparser configparser MultilineContinuationError10899666
Ref: 2f8210899666
Ref: library/configparser configparser UnnamedSectionDisabledError10899853
Ref: 2f9010899853
Ref: library/configparser configparser InvalidWriteError10900046
Ref: 1df10900046
Node: tomllib --- TOML ファイルの解析10900490
Ref: library/tomllib doc10900700
Ref: 2f9a10900700
Ref: library/tomllib module-tomllib10900700
Ref: 10210900700
Ref: library/tomllib tomllib-parse-toml-files10900700
Ref: 2f9b10900700
Ref: library/tomllib translation-repo10900700
Ref: 2f9c10900700
Ref: library/tomllib tomllib load10901768
Ref: 2f9d10901768
Ref: library/tomllib tomllib loads10902796
Ref: 192c10902796
Ref: library/tomllib tomllib TOMLDecodeError10903310
Ref: 190d10903310
Ref: library/tomllib tomllib TOMLDecodeError msg10903457
Ref: 2f9f10903457
Ref: library/tomllib tomllib TOMLDecodeError doc10903563
Ref: 2fa010903563
Ref: library/tomllib tomllib TOMLDecodeError pos10903651
Ref: 2fa110903651
Ref: library/tomllib tomllib TOMLDecodeError lineno10903742
Ref: 2fa210903742
Ref: library/tomllib tomllib TOMLDecodeError colno10903815
Ref: 2fa310903815
Ref: tomllib --- TOML ファイルの解析-Footnote-110904285
Ref: tomllib --- TOML ファイルの解析-Footnote-210904349
Ref: tomllib --- TOML ファイルの解析-Footnote-310904377
Ref: tomllib --- TOML ファイルの解析-Footnote-410904419
Node: 使用例<18>10904461
Ref: library/tomllib examples10904567
Ref: 2fa410904567
Node: 変換表10904934
Ref: library/tomllib conversion-table10905040
Ref: 2fa510905040
Ref: library/tomllib toml-to-py-table10905076
Ref: 2f9e10905076
Node: netrc --- netrc ファイルの処理10906597
Ref: library/netrc doc10906818
Ref: 2fa610906818
Ref: library/netrc module-netrc10906818
Ref: 9f10906818
Ref: library/netrc netrc-netrc-file-processing10906818
Ref: 2fa710906818
Ref: library/netrc translation-repo10906818
Ref: 2fa810906818
Ref: library/netrc netrc netrc10907215
Ref: 1c7910907215
Ref: library/netrc netrc NetrcParseError10909317
Ref: 2fa910909317
Ref: library/netrc netrc NetrcParseError msg10909570
Ref: 2faa10909570
Ref: library/netrc netrc NetrcParseError filename10909649
Ref: 2fab10909649
Ref: library/netrc netrc NetrcParseError lineno10909724
Ref: 2fac10909724
Ref: netrc --- netrc ファイルの処理-Footnote-110909878
Node: netrc オブジェクト10909943
Ref: library/netrc id110910041
Ref: 2fad10910041
Ref: library/netrc netrc-objects10910041
Ref: 2fae10910041
Ref: library/netrc netrc netrc authenticators10910189
Ref: 2faf10910189
Ref: library/netrc netrc netrc __repr__10910645
Ref: 2fb010910645
Ref: library/netrc netrc netrc hosts10911017
Ref: 2fb110911017
Ref: library/netrc netrc netrc macros10911276
Ref: 2fb210911276
Node: plistlib --- Apple plist ファイルを生成・解析する10911387
Ref: library/plistlib doc10911561
Ref: 2fb310911561
Ref: library/plistlib module-plistlib10911561
Ref: b010911561
Ref: library/plistlib plistlib-generate-and-parse-apple-plist-files10911561
Ref: 2fb410911561
Ref: library/plistlib translation-repo10911561
Ref: 2fb510911561
Ref: library/plistlib plistlib load10913569
Ref: b4810913569
Ref: library/plistlib plistlib loads10915072
Ref: b4910915072
Ref: library/plistlib plistlib dump10915520
Ref: b4a10915520
Ref: library/plistlib plistlib dumps10917191
Ref: b4b10917191
Ref: library/plistlib plistlib UID10917590
Ref: c1610917590
Ref: library/plistlib plistlib UID data10917851
Ref: 2fb610917851
Ref: library/plistlib plistlib FMT_XML10918036
Ref: 117b10918036
Ref: library/plistlib plistlib FMT_BINARY10918142
Ref: 117c10918142
Ref: library/plistlib plistlib InvalidFileException10918304
Ref: 1cfa10918304
Ref: plistlib --- Apple plist ファイルを生成・解析する-Footnote-110918492
Ref: plistlib --- Apple plist ファイルを生成・解析する-Footnote-210918560
Node: 使用例<19>10918659
Ref: library/plistlib examples10918770
Ref: 2fb710918770
Node: 暗号関連のサービス10919636
Ref: library/crypto doc10919830
Ref: 2fb810919830
Ref: library/crypto crypto10919830
Ref: 2fb910919830
Ref: library/crypto cryptographic-services10919830
Ref: 2fba10919830
Ref: library/crypto translation-repo10919830
Ref: 2fbb10919830
Node: hashlib --- セキュアハッシュとメッセージダイジェスト10920570
Ref: library/hashlib doc10920781
Ref: 2fbc10920781
Ref: library/hashlib hashlib-secure-hashes-and-message-digests10920781
Ref: 2fbd10920781
Ref: library/hashlib module-hashlib10920781
Ref: 6c10920781
Ref: hashlib --- セキュアハッシュとメッセージダイジェスト-Footnote-110921781
Ref: hashlib --- セキュアハッシュとメッセージダイジェスト-Footnote-210921848
Ref: hashlib --- セキュアハッシュとメッセージダイジェスト-Footnote-310921905
Ref: hashlib --- セキュアハッシュとメッセージダイジェスト-Footnote-410921955
Ref: hashlib --- セキュアハッシュとメッセージダイジェスト-Footnote-510922025
Node: ハッシュアルゴリズム10922084
Ref: library/hashlib hash-algorithms10922241
Ref: 2fbe10922241
Ref: library/hashlib id110922241
Ref: 2fbf10922241
Ref: library/hashlib hashlib-usedforsecurity10924554
Ref: 2fc810924554
Ref: ハッシュアルゴリズム-Footnote-110925260
Ref: ハッシュアルゴリズム-Footnote-210925368
Node: 使用法10925415
Ref: library/hashlib usage10925602
Ref: 2fc910925602
Node: コンストラクタ10926362
Ref: library/hashlib constructors10926525
Ref: 2fca10926525
Ref: library/hashlib hashlib new10926581
Ref: 1d2e10926581
Ref: library/hashlib hashlib md510927221
Ref: 182310927221
Ref: library/hashlib hashlib sha110927283
Ref: 2fc310927283
Ref: library/hashlib hashlib sha22410927346
Ref: 2fc410927346
Ref: library/hashlib hashlib sha25610927411
Ref: 18ae10927411
Ref: library/hashlib hashlib sha38410927476
Ref: 2fc510927476
Ref: library/hashlib hashlib sha51210927541
Ref: 2fc610927541
Ref: library/hashlib hashlib sha3_22410927606
Ref: ea010927606
Ref: library/hashlib hashlib sha3_25610927673
Ref: ea110927673
Ref: library/hashlib hashlib sha3_38410927740
Ref: ea210927740
Ref: library/hashlib hashlib sha3_51210927807
Ref: ea310927807
Node: 属性10927972
Ref: library/hashlib attributes10928138
Ref: 2fcb10928138
Ref: library/hashlib hashlib algorithms_guaranteed10928229
Ref: 158b10928229
Ref: library/hashlib hashlib algorithms_available10928775
Ref: 158c10928775
Node: Hash Objects10929249
Ref: library/hashlib hash-objects10929427
Ref: 2fcc10929427
Ref: library/hashlib hashlib hash digest_size10929599
Ref: 2fcd10929599
Ref: library/hashlib hashlib hash block_size10929684
Ref: 2fce10929684
Ref: library/hashlib hashlib hash name10929882
Ref: 114910929882
Ref: library/hashlib hashlib hash update10930456
Ref: 2fc010930456
Ref: library/hashlib hashlib hash digest10930843
Ref: 2fc110930843
Ref: library/hashlib hashlib hash hexdigest10931132
Ref: 2fc210931132
Ref: library/hashlib hashlib hash copy10931392
Ref: 2fcf10931392
Node: SHAKE 可変長ダイジェスト10931653
Ref: library/hashlib shake-variable-length-digests10931855
Ref: 2fd010931855
Ref: library/hashlib hashlib shake_12810931933
Ref: ea410931933
Ref: library/hashlib hashlib shake_25610932001
Ref: ea510932001
Ref: library/hashlib hashlib shake digest10932330
Ref: 1e1a10932330
Ref: library/hashlib hashlib shake hexdigest10932610
Ref: 1e1b10932610
Node: ファイルのハッシュ化10933038
Ref: library/hashlib file-hashing10933237
Ref: 2fd110933237
Ref: library/hashlib hashlib file_digest10933408
Ref: 85410933408
Node: 鍵導出10935114
Ref: library/hashlib key-derivation10935286
Ref: 2fd210935286
Ref: library/hashlib hashlib pbkdf2_hmac10935731
Ref: 73310935731
Ref: library/hashlib hashlib scrypt10937774
Ref: e3810937774
Ref: 鍵導出-Footnote-110938679
Ref: 鍵導出-Footnote-210938741
Ref: 鍵導出-Footnote-310938828
Ref: 鍵導出-Footnote-410938939
Node: BLAKE210938998
Ref: library/hashlib blake210939131
Ref: 2fd310939131
Ref: library/hashlib hashlib-blake210939131
Ref: 2fd410939131
Ref: BLAKE2-Footnote-110939886
Ref: BLAKE2-Footnote-210939917
Ref: BLAKE2-Footnote-310939976
Node: ハッシュオブジェクトの作成10940054
Ref: library/hashlib creating-hash-objects10940154
Ref: 2fd510940154
Ref: library/hashlib hashlib blake2b10940360
Ref: 85210940360
Ref: library/hashlib hashlib blake2s10940597
Ref: 85310940597
Ref: ハッシュオブジェクトの作成-Footnote-110943777
Node: 定数<5>10943828
Ref: library/hashlib constants10943950
Ref: 2fd610943950
Ref: library/hashlib hashlib blake2b SALT_SIZE10943983
Ref: 2fd710943983
Ref: library/hashlib hashlib blake2s SALT_SIZE10944017
Ref: 2fd810944017
Ref: library/hashlib hashlib blake2b PERSON_SIZE10944122
Ref: 2fd910944122
Ref: library/hashlib hashlib blake2s PERSON_SIZE10944158
Ref: 2fda10944158
Ref: library/hashlib hashlib blake2b MAX_KEY_SIZE10944268
Ref: 2fdb10944268
Ref: library/hashlib hashlib blake2s MAX_KEY_SIZE10944305
Ref: 2fdc10944305
Ref: library/hashlib hashlib blake2b MAX_DIGEST_SIZE10944359
Ref: 2fdd10944359
Ref: library/hashlib hashlib blake2s MAX_DIGEST_SIZE10944399
Ref: 2fde10944399
Node: 使用例<20>10944507
Ref: library/hashlib examples10944605
Ref: 2fdf10944605
Node: 簡単なハッシュ化10944799
Ref: library/hashlib simple-hashing10944910
Ref: 2fe010944910
Node: Using different digest sizes10946376
Ref: library/hashlib using-different-digest-sizes10946509
Ref: 2fe110946509
Node: Keyed hashing10947754
Ref: library/hashlib keyed-hashing10947881
Ref: 2fe210947881
Ref: Keyed hashing-Footnote-110949888
Node: Randomized hashing10949931
Ref: library/hashlib randomized-hashing10950045
Ref: 2fe310950045
Ref: Randomized hashing-Footnote-110952647
Ref: Randomized hashing-Footnote-210952699
Node: Personalization10952734
Ref: library/hashlib personalization10952853
Ref: 2fe410952853
Ref: Personalization-Footnote-110954871
Node: ツリーモード10954941
Ref: library/hashlib tree-mode10955033
Ref: 2fe510955033
Node: クレジット10956357
Ref: library/hashlib credits10956437
Ref: 2fe610956437
Ref: library/hashlib hashlib-seealso10958175
Ref: 2fc710958175
Ref: クレジット-Footnote-110959312
Ref: クレジット-Footnote-210959343
Ref: クレジット-Footnote-310959404
Ref: クレジット-Footnote-410959482
Ref: クレジット-Footnote-510959519
Ref: クレジット-Footnote-610959562
Node: hmac --- メッセージ認証のための鍵付きハッシュ化10959605
Ref: library/hmac doc10959891
Ref: 2fe710959891
Ref: library/hmac hmac-keyed-hashing-for-message-authentication10959891
Ref: 2fe810959891
Ref: library/hmac module-hmac10959891
Ref: 6e10959891
Ref: library/hmac translation-repo10959891
Ref: 2fe910959891
Ref: library/hmac hmac new10960380
Ref: c9610960380
Ref: library/hmac hmac digest10961354
Ref: d3210961354
Ref: library/hmac hmac HMAC10962088
Ref: d3310962088
Ref: library/hmac hmac HMAC update10962190
Ref: 114b10962190
Ref: library/hmac hmac HMAC digest10962695
Ref: 2fea10962695
Ref: library/hmac hmac HMAC hexdigest10963368
Ref: 2feb10963368
Ref: library/hmac hmac HMAC copy10963973
Ref: 178210963973
Ref: library/hmac hmac HMAC digest_size10964338
Ref: 114e10964338
Ref: library/hmac hmac HMAC block_size10964435
Ref: 114c10964435
Ref: library/hmac hmac HMAC name10964586
Ref: 114d10964586
Ref: library/hmac hmac compare_digest10964945
Ref: 12e010964945
Ref: hmac --- メッセージ認証のための鍵付きハッシュ化-Footnote-110966109
Ref: hmac --- メッセージ認証のための鍵付きハッシュ化-Footnote-210966173
Node: secrets --- 機密を扱うために安全な乱数を生成する10966232
Ref: library/secrets doc10966437
Ref: 2fec10966437
Ref: library/secrets module-secrets10966437
Ref: c510966437
Ref: library/secrets secrets-generate-secure-random-numbers-for-managing-secrets10966437
Ref: 2fed10966437
Ref: library/secrets translation-repo10966437
Ref: 2fee10966437
Ref: secrets --- 機密を扱うために安全な乱数を生成する-Footnote-110967294
Ref: secrets --- 機密を扱うために安全な乱数を生成する-Footnote-210967361
Node: 乱数10967403
Ref: library/secrets random-numbers10967542
Ref: 2fef10967542
Ref: library/secrets secrets SystemRandom10967692
Ref: 2ff010967692
Ref: library/secrets secrets choice10967953
Ref: 2ff110967953
Ref: library/secrets secrets randbelow10968081
Ref: 2ff210968081
Ref: library/secrets secrets randbits10968226
Ref: 2ff310968226
Node: トークンの生成10968335
Ref: library/secrets generating-tokens10968501
Ref: 2ff410968501
Ref: library/secrets secrets token_bytes10968716
Ref: 2b5c10968716
Ref: library/secrets secrets token_hex10969026
Ref: 1b2610969026
Ref: library/secrets secrets token_urlsafe10969383
Ref: 2ff610969383
Node: トークンは何バイト使うべきか？10969846
Ref: library/secrets how-many-bytes-should-tokens-use10969949
Ref: 2ff710969949
Ref: library/secrets secrets DEFAULT_ENTROPY10970873
Ref: 2ff510970873
Ref: トークンは何バイト使うべきか？-Footnote-110971135
Node: その他の関数10971192
Ref: library/secrets other-functions10971391
Ref: 2ff810971391
Ref: library/secrets secrets compare_digest10971442
Ref: 2ff910971442
Ref: その他の関数-Footnote-110971914
Node: レシピとベストプラクティス10971971
Ref: library/secrets recipes-and-best-practices10972140
Ref: 2ffa10972140
Ref: レシピとベストプラクティス-Footnote-110974105
Ref: レシピとベストプラクティス-Footnote-210974161
Node: 汎用オペレーティングシステムサービス10974191
Ref: library/allos doc10974415
Ref: 2ffb10974415
Ref: library/allos allos10974415
Ref: 2ffc10974415
Ref: library/allos generic-operating-system-services10974415
Ref: 2ffd10974415
Ref: library/allos translation-repo10974415
Ref: 2ffe10974415
Node: os --- 雑多なオペレーティングシステムインターフェース10975973
Ref: library/os doc10976195
Ref: 2fff10976195
Ref: library/os module-os10976195
Ref: a510976195
Ref: library/os os-miscellaneous-operating-system-interfaces10976195
Ref: 300010976195
Ref: library/os os error10978955
Ref: 300210978955
Ref: library/os os name10979062
Ref: 300310979062
Ref: library/os os-filenames10979634
Ref: 2f4410979634
Ref: os --- 雑多なオペレーティングシステムインターフェース-Footnote-110980063
Node: ファイル名、コマンドライン引数、および環境変数10980125
Ref: library/os file-names-command-line-arguments-and-environment-variables10980333
Ref: 300410980333
Ref: library/os filesystem-encoding10980333
Ref: 2c3510980333
Node: Python UTF-8 Mode10982195
Ref: library/os python-utf-8-mode10982445
Ref: 300510982445
Ref: library/os utf8-mode10982445
Ref: 86610982445
Ref: Python UTF-8 Mode-Footnote-110985320
Ref: Python UTF-8 Mode-Footnote-210985362
Node: プロセスのパラメーター10985404
Ref: library/os os-procinfo10985624
Ref: 300610985624
Ref: library/os process-parameters10985624
Ref: 300710985624
Ref: library/os os ctermid10985877
Ref: 300810985877
Ref: library/os os environ10986038
Ref: 25910986038
Ref: library/os os environb10988523
Ref: 25a10988523
Ref: library/os os reload_environ10989192
Ref: 25810989192
Ref: library/os os fsencode10990275
Ref: e4f10990275
Ref: library/os os fsdecode10990828
Ref: e4e10990828
Ref: library/os os fspath10991379
Ref: e4d10991379
Ref: library/os os PathLike10991931
Ref: e4b10991931
Ref: library/os os PathLike __fspath__10992144
Ref: e4c10992144
Ref: library/os os getenv10992475
Ref: 300910992475
Ref: library/os os getenvb10993399
Ref: 142f10993399
Ref: library/os os get_exec_path10994218
Ref: 300b10994218
Ref: library/os os getegid10994670
Ref: 300c10994670
Ref: library/os os geteuid10994939
Ref: 1b7210994939
Ref: library/os os getgid10995089
Ref: 300d10995089
Ref: library/os os getgrouplist10995344
Ref: 132c10995344
Ref: library/os os getgroups10995740
Ref: 300e10995740
Ref: library/os os getlogin10997285
Ref: 182210997285
Ref: library/os os getpgid10997807
Ref: 301010997807
Ref: library/os os getpgrp10998082
Ref: 301110998082
Ref: library/os os getpid10998226
Ref: 300110998226
Ref: library/os os getppid10998424
Ref: 19cc10998424
Ref: library/os os getpriority10998924
Ref: 131710998924
Ref: library/os os PRIO_PROCESS10999764
Ref: 301210999764
Ref: library/os os PRIO_PGRP10999795
Ref: 301310999795
Ref: library/os os PRIO_USER10999823
Ref: 301410999823
Ref: library/os os PRIO_DARWIN_THREAD11000030
Ref: 301511000030
Ref: library/os os PRIO_DARWIN_PROCESS11000067
Ref: 301611000067
Ref: library/os os PRIO_DARWIN_BG11000105
Ref: 301711000105
Ref: library/os os PRIO_DARWIN_NONUI11000138
Ref: 301811000138
Ref: library/os os getresuid11000344
Ref: 152d11000344
Ref: library/os os getresgid11000630
Ref: 152c11000630
Ref: library/os os getuid11000916
Ref: 181711000916
Ref: library/os os initgroups11001171
Ref: 153011001171
Ref: library/os os putenv11001494
Ref: 25b11001494
Ref: library/os os setegid11002987
Ref: 301a11002987
Ref: library/os os seteuid11003163
Ref: 301b11003163
Ref: library/os os setgid11003339
Ref: 301c11003339
Ref: library/os os setgroups11003507
Ref: 300f11003507
Ref: library/os os setns11004367
Ref: 1b4111004367
Ref: library/os os setpgrp11005880
Ref: 301e11005880
Ref: library/os os setpgid11006177
Ref: 301f11006177
Ref: library/os os setpriority11006523
Ref: 131811006523
Ref: library/os os setregid11007545
Ref: 302011007545
Ref: library/os os setresgid11007753
Ref: 152e11007753
Ref: library/os os setresuid11008033
Ref: 152f11008033
Ref: library/os os setreuid11008310
Ref: 302111008310
Ref: library/os os getsid11008518
Ref: 302211008518
Ref: library/os os setsid11008750
Ref: 1dba11008750
Ref: library/os os setuid11008976
Ref: 302311008976
Ref: library/os os strerror11009141
Ref: 302411009141
Ref: library/os os supports_bytes_environ11009443
Ref: 142e11009443
Ref: library/os os umask11009654
Ref: 302511009654
Ref: library/os os uname11009889
Ref: 132e11009889
Ref: library/os os unsetenv11011517
Ref: 25c11011517
Ref: library/os os unshare11012511
Ref: 1b4211012511
Ref: library/os os-unshare-clone-flags11013214
Ref: 301d11013214
Ref: library/os os CLONE_FILES11013384
Ref: 302711013384
Ref: library/os os CLONE_FS11013414
Ref: 302811013414
Ref: library/os os CLONE_NEWCGROUP11013441
Ref: 302911013441
Ref: library/os os CLONE_NEWIPC11013475
Ref: 302a11013475
Ref: library/os os CLONE_NEWNET11013506
Ref: 302b11013506
Ref: library/os os CLONE_NEWNS11013537
Ref: 302c11013537
Ref: library/os os CLONE_NEWPID11013567
Ref: 302d11013567
Ref: library/os os CLONE_NEWTIME11013598
Ref: 302e11013598
Ref: library/os os CLONE_NEWUSER11013630
Ref: 302f11013630
Ref: library/os os CLONE_NEWUTS11013662
Ref: 303011013662
Ref: library/os os CLONE_SIGHAND11013693
Ref: 303111013693
Ref: library/os os CLONE_SYSVSEM11013725
Ref: 303211013725
Ref: library/os os CLONE_THREAD11013757
Ref: 303311013757
Ref: library/os os CLONE_VM11013788
Ref: 303411013788
Ref: プロセスのパラメーター-Footnote-111013852
Ref: プロセスのパラメーター-Footnote-211013894
Ref: プロセスのパラメーター-Footnote-311013936
Ref: プロセスのパラメーター-Footnote-411013981
Ref: プロセスのパラメーター-Footnote-511014031
Ref: プロセスのパラメーター-Footnote-611014078
Node: ファイルオブジェクトの生成11014125
Ref: library/os file-object-creation11014358
Ref: 303511014358
Ref: library/os os-newstreams11014358
Ref: 303611014358
Ref: library/os os fdopen11014640
Ref: 238111014640
Node: ファイル記述子の操作11015038
Ref: library/os file-descriptor-operations11015271
Ref: 303711015271
Ref: library/os os-fd-ops11015271
Ref: 303811015271
Ref: library/os os close11016444
Ref: d6b11016444
Ref: library/os os closerange11017026
Ref: 303911017026
Ref: library/os os copy_file_range11017391
Ref: 18b411017391
Ref: library/os os device_encoding11019109
Ref: 1c3511019109
Ref: library/os os dup11019658
Ref: 1dc211019658
Ref: library/os os dup211020184
Ref: d5a11020184
Ref: library/os os fchmod11020836
Ref: 52a11020836
Ref: library/os os fchown11021527
Ref: f8a11021527
Ref: library/os os fdatasync11022244
Ref: f8b11022244
Ref: library/os os fpathconf11022552
Ref: 303b11022552
Ref: library/os os fstat11023778
Ref: f8c11023778
Ref: library/os os fstatvfs11024064
Ref: f8d11024064
Ref: library/os os fsync11024406
Ref: f8e11024406
Ref: library/os os ftruncate11024994
Ref: f8f11024994
Ref: library/os os get_blocking11025527
Ref: 103911025527
Ref: library/os os grantpt11026242
Ref: 19fe11026242
Ref: library/os os isatty11026627
Ref: 1c3411026627
Ref: library/os os lockf11026889
Ref: 132b11026889
Ref: library/os os F_LOCK11027603
Ref: 303d11027603
Ref: library/os os F_TLOCK11027628
Ref: 303e11027628
Ref: library/os os F_ULOCK11027654
Ref: 303f11027654
Ref: library/os os F_TEST11027680
Ref: 304011027680
Ref: library/os os login_tty11027849
Ref: 1aca11027849
Ref: library/os os lseek11028209
Ref: 132f11028209
Ref: library/os os SEEK_SET11029059
Ref: 14a511029059
Ref: library/os os SEEK_CUR11029086
Ref: 14a611029086
Ref: library/os os SEEK_END11029113
Ref: 14a711029113
Ref: library/os os SEEK_HOLE11029697
Ref: 304111029697
Ref: library/os os SEEK_DATA11029725
Ref: 304211029725
Ref: library/os os open11030457
Ref: f9211030457
Ref: library/os os O_RDONLY11033139
Ref: 304311033139
Ref: library/os os O_WRONLY11033166
Ref: 304411033166
Ref: library/os os O_RDWR11033193
Ref: 304611033193
Ref: library/os os O_APPEND11033218
Ref: 304711033218
Ref: library/os os O_CREAT11033245
Ref: 304811033245
Ref: library/os os O_EXCL11033271
Ref: 2ccf11033271
Ref: library/os os O_TRUNC11033296
Ref: 304911033296
Ref: library/os os O_DSYNC11033396
Ref: 304a11033396
Ref: library/os os O_RSYNC11033422
Ref: 304b11033422
Ref: library/os os O_SYNC11033448
Ref: 304c11033448
Ref: library/os os O_NDELAY11033473
Ref: 304d11033473
Ref: library/os os O_NONBLOCK11033500
Ref: 103b11033500
Ref: library/os os O_NOCTTY11033529
Ref: 304e11033529
Ref: library/os os O_CLOEXEC11033556
Ref: 128811033556
Ref: library/os os O_BINARY11033747
Ref: 304511033747
Ref: library/os os O_NOINHERIT11033774
Ref: 304f11033774
Ref: library/os os O_SHORT_LIVED11033804
Ref: 305011033804
Ref: library/os os O_TEMPORARY11033836
Ref: 305111033836
Ref: library/os os O_RANDOM11033866
Ref: 305211033866
Ref: library/os os O_SEQUENTIAL11033893
Ref: 305311033893
Ref: library/os os O_TEXT11033924
Ref: 305411033924
Ref: library/os os O_EVTONLY11034014
Ref: a1b11034014
Ref: library/os os O_FSYNC11034042
Ref: a1c11034042
Ref: library/os os O_SYMLINK11034068
Ref: a1d11034068
Ref: library/os os O_NOFOLLOW_ANY11034096
Ref: a1e11034096
Ref: library/os os O_ASYNC11034350
Ref: 305511034350
Ref: library/os os O_DIRECT11034376
Ref: 305611034376
Ref: library/os os O_DIRECTORY11034403
Ref: 305711034403
Ref: library/os os O_NOFOLLOW11034433
Ref: 305811034433
Ref: library/os os O_NOATIME11034462
Ref: 305911034462
Ref: library/os os O_PATH11034490
Ref: 117411034490
Ref: library/os os O_TMPFILE11034515
Ref: 117511034515
Ref: library/os os O_SHLOCK11034543
Ref: 164811034543
Ref: library/os os O_EXLOCK11034570
Ref: 164911034570
Ref: library/os os openpty11034978
Ref: 305a11034978
Ref: library/os os pipe11035493
Ref: 1b6411035493
Ref: library/os os pipe211035905
Ref: 130111035905
Ref: library/os os posix_fallocate11036343
Ref: f9411036343
Ref: library/os os posix_fadvise11036645
Ref: f9311036645
Ref: library/os os POSIX_FADV_NORMAL11037389
Ref: 305b11037389
Ref: library/os os POSIX_FADV_SEQUENTIAL11037425
Ref: 305c11037425
Ref: library/os os POSIX_FADV_RANDOM11037465
Ref: 305d11037465
Ref: library/os os POSIX_FADV_NOREUSE11037501
Ref: 305e11037501
Ref: library/os os POSIX_FADV_WILLNEED11037538
Ref: 305f11037538
Ref: library/os os POSIX_FADV_DONTNEED11037576
Ref: 306011037576
Ref: library/os os pread11037847
Ref: d5611037847
Ref: library/os os posix_openpt11038296
Ref: 19fd11038296
Ref: library/os os preadv11038895
Ref: d5411038895
Ref: library/os os RWF_NOWAIT11040232
Ref: 306211040232
Ref: library/os os RWF_HIPRI11040805
Ref: 306111040805
Ref: library/os os ptsname11041361
Ref: 1a0011041361
Ref: library/os os pwrite11041904
Ref: d5911041904
Ref: library/os os pwritev11042252
Ref: d5711042252
Ref: library/os os RWF_DSYNC11043429
Ref: 306311043429
Ref: library/os os RWF_SYNC11043795
Ref: 306411043795
Ref: library/os os RWF_APPEND11044159
Ref: 1d2d11044159
Ref: library/os os read11044721
Ref: f9511044721
Ref: library/os os readinto11045946
Ref: 25f11045946
Ref: library/os os sendfile11047162
Ref: d0511047162
Ref: library/os os SF_NODISKIO11049170
Ref: 306511049170
Ref: library/os os SF_MNOWAIT11049200
Ref: 306611049200
Ref: library/os os SF_SYNC11049229
Ref: 306711049229
Ref: library/os os SF_NOCACHE11049451
Ref: 306811049451
Ref: library/os os set_blocking11049738
Ref: 103a11049738
Ref: library/os os splice11050476
Ref: a1a11050476
Ref: library/os os SPLICE_F_MOVE11052895
Ref: 306911052895
Ref: library/os os SPLICE_F_NONBLOCK11052927
Ref: 306a11052927
Ref: library/os os SPLICE_F_MORE11052963
Ref: 306b11052963
Ref: library/os os readv11053025
Ref: d5511053025
Ref: library/os os tcgetpgrp11053782
Ref: 306c11053782
Ref: library/os os tcsetpgrp11054050
Ref: 306d11054050
Ref: library/os os ttyname11054334
Ref: 306e11054334
Ref: library/os os unlockpt11054631
Ref: 19ff11054631
Ref: library/os os write11055008
Ref: f9b11055008
Ref: library/os os writev11056121
Ref: d5811056121
Ref: ファイル記述子の操作-Footnote-111057025
Ref: ファイル記述子の操作-Footnote-211057067
Ref: ファイル記述子の操作-Footnote-311057111
Ref: ファイル記述子の操作-Footnote-411057174
Ref: ファイル記述子の操作-Footnote-511057216
Ref: ファイル記述子の操作-Footnote-611057262
Node: ターミナルのサイズの問い合わせ11057304
Ref: library/os querying-the-size-of-a-terminal11057455
Ref: 306f11057455
Ref: library/os terminal-size11057455
Ref: 307011057455
Ref: library/os os get_terminal_size11057574
Ref: 131a11057574
Ref: library/os os terminal_size11058293
Ref: 2cfc11058293
Ref: library/os os terminal_size columns11058456
Ref: 307111058456
Ref: library/os os terminal_size lines11058558
Ref: 307211058558
Node: ファイル記述子の継承11058658
Ref: library/os fd-inheritance11058809
Ref: 10fc11058809
Ref: library/os inheritance-of-file-descriptors11058809
Ref: 307311058809
Ref: library/os os get_inheritable11060308
Ref: 10fd11060308
Ref: library/os os set_inheritable11060472
Ref: 10fe11060472
Ref: library/os os get_handle_inheritable11060642
Ref: 10ff11060642
Ref: library/os os set_handle_inheritable11060849
Ref: 110011060849
Node: ファイルとディレクトリ11061057
Ref: library/os files-and-directories11061269
Ref: 307411061269
Ref: library/os os-file-dir11061269
Ref: 300a11061269
Ref: library/os path-fd11061496
Ref: d5311061496
Ref: library/os dir-fd11062592
Ref: 130211062592
Ref: library/os follow-symlinks11063344
Ref: 130311063344
Ref: library/os os access11063969
Ref: 130411063969
Ref: library/os os F_OK11067465
Ref: 307511067465
Ref: library/os os R_OK11067488
Ref: 307611067488
Ref: library/os os W_OK11067511
Ref: 307711067511
Ref: library/os os X_OK11067534
Ref: 307811067534
Ref: library/os os chdir11067798
Ref: 82111067798
Ref: library/os os chflags11068786
Ref: 130511068786
Ref: library/os os chmod11070068
Ref: 52911070068
Ref: library/os os chown11072413
Ref: 130611072413
Ref: library/os os chroot11073726
Ref: 1d7c11073726
Ref: library/os os fchdir11074029
Ref: f8911074029
Ref: library/os os getcwd11074557
Ref: 190911074557
Ref: library/os os getcwdb11074662
Ref: c8211074662
Ref: library/os os lchflags11075098
Ref: 307a11075098
Ref: library/os os lchmod11075705
Ref: 52811075705
Ref: library/os os lchown11076752
Ref: 307b11076752
Ref: library/os os link11077392
Ref: 130711077392
Ref: library/os os listdir11078371
Ref: 131211078371
Ref: library/os os listdrives11080310
Ref: 6c511080310
Ref: library/os os listmounts11080944
Ref: 6c711080944
Ref: library/os os listvolumes11081786
Ref: 6c611081786
Ref: library/os os lstat11082507
Ref: 6c811082507
Ref: library/os os mkdir11083795
Ref: 52b11083795
Ref: library/os mkdir-modebits11084114
Ref: 307c11084114
Ref: library/os os makedirs11085653
Ref: 52c11085653
Ref: library/os os mkfifo11087787
Ref: f9011087787
Ref: library/os os mknod11089025
Ref: f9111089025
Ref: library/os os major11090263
Ref: 195e11090263
Ref: library/os os minor11090435
Ref: 195f11090435
Ref: library/os os makedev11090607
Ref: 196011090607
Ref: library/os os pathconf11090778
Ref: 131311090778
Ref: library/os os pathconf_names11092111
Ref: 307e11092111
Ref: library/os os readlink11092538
Ref: b1a11092538
Ref: library/os os remove11094258
Ref: 130811094258
Ref: library/os os removedirs11095378
Ref: 307f11095378
Ref: library/os os rename11096514
Ref: 130911096514
Ref: library/os os renames11098349
Ref: 308011098349
Ref: library/os os replace11099302
Ref: 130a11099302
Ref: library/os os rmdir11100477
Ref: 130b11100477
Ref: library/os os scandir11101245
Ref: c5411101245
Ref: library/os os scandir close11103469
Ref: eb811103469
Ref: library/os os DirEntry11105277
Ref: 6c311105277
Ref: library/os os DirEntry name11106861
Ref: 308211106861
Ref: library/os os DirEntry path11107264
Ref: 19f811107264
Ref: library/os os DirEntry inode11107997
Ref: 1a4d11107997
Ref: library/os os DirEntry is_dir11108498
Ref: 308111108498
Ref: library/os os DirEntry is_file11110620
Ref: f8411110620
Ref: library/os os DirEntry is_symlink11111620
Ref: 308311111620
Ref: library/os os DirEntry is_junction11112836
Ref: 6c411112836
Ref: library/os os DirEntry stat11113275
Ref: 1a6b11113275
Ref: library/os os stat11115368
Ref: 26d11115368
Ref: library/os os stat_result11118188
Ref: 16da11118188
Ref: library/os os stat_result st_mode11118438
Ref: bff11118438
Ref: library/os os stat_result st_ino11118587
Ref: 308411118587
Ref: library/os os stat_result st_dev11118836
Ref: 308511118836
Ref: library/os os stat_result st_nlink11118936
Ref: 308611118936
Ref: library/os os stat_result st_uid11119005
Ref: 308711119005
Ref: library/os os stat_result st_gid11119090
Ref: 308811119090
Ref: library/os os stat_result st_size11119178
Ref: 308911119178
Ref: library/os os stat_result st_atime11119559
Ref: 308a11119559
Ref: library/os os stat_result st_mtime11119643
Ref: 2f1411119643
Ref: library/os os stat_result st_ctime11119727
Ref: 308b11119727
Ref: library/os os stat_result st_atime_ns11120104
Ref: 308c11120104
Ref: library/os os stat_result st_mtime_ns11120240
Ref: 308d11120240
Ref: library/os os stat_result st_ctime_ns11120376
Ref: 308e11120376
Ref: library/os os stat_result st_birthtime11120823
Ref: 308f11120823
Ref: library/os os stat_result st_birthtime_ns11121105
Ref: 309011121105
Ref: library/os os stat_result st_blocks11122723
Ref: 309111122723
Ref: library/os os stat_result st_blksize11123014
Ref: 309211123014
Ref: library/os os stat_result st_rdev11123346
Ref: 17bf11123346
Ref: library/os os stat_result st_flags11123435
Ref: 309311123435
Ref: library/os os stat_result st_gen11123739
Ref: 309411123739
Ref: library/os os stat_result st_fstype11123890
Ref: d5b11123890
Ref: library/os os stat_result st_rsize11124097
Ref: 309511124097
Ref: library/os os stat_result st_creator11124172
Ref: 309611124172
Ref: library/os os stat_result st_type11124240
Ref: 309711124240
Ref: library/os os stat_result st_file_attributes11124373
Ref: 103811124373
Ref: library/os os stat_result st_reparse_tag11124753
Ref: c0011124753
Ref: library/os os statvfs11127165
Ref: 131411127165
Ref: library/os os supports_dir_fd11129745
Ref: 130f11129745
Ref: library/os os supports_effective_ids11130945
Ref: 131611130945
Ref: library/os os supports_fd11131736
Ref: 131511131736
Ref: library/os os supports_follow_symlinks11132560
Ref: 131011132560
Ref: library/os os symlink11133692
Ref: 130c11133692
Ref: library/os os sync11136154
Ref: 132a11136154
Ref: library/os os truncate11136336
Ref: 103c11136336
Ref: library/os os unlink11137014
Ref: 130d11137014
Ref: library/os os utime11137647
Ref: 130e11137647
Ref: library/os os walk11140137
Ref: 6d011140137
Ref: library/os os fwalk11146649
Ref: d5211146649
Ref: library/os os memfd_create11149590
Ref: bfe11149590
Ref: library/os os MFD_CLOEXEC11150451
Ref: 309811150451
Ref: library/os os MFD_ALLOW_SEALING11150481
Ref: 309911150481
Ref: library/os os MFD_HUGETLB11150517
Ref: 309a11150517
Ref: library/os os MFD_HUGE_SHIFT11150547
Ref: 309b11150547
Ref: library/os os MFD_HUGE_MASK11150580
Ref: 309c11150580
Ref: library/os os MFD_HUGE_64KB11150612
Ref: 309d11150612
Ref: library/os os MFD_HUGE_512KB11150644
Ref: 309e11150644
Ref: library/os os MFD_HUGE_1MB11150677
Ref: 309f11150677
Ref: library/os os MFD_HUGE_2MB11150708
Ref: 30a011150708
Ref: library/os os MFD_HUGE_8MB11150739
Ref: 30a111150739
Ref: library/os os MFD_HUGE_16MB11150770
Ref: 30a211150770
Ref: library/os os MFD_HUGE_32MB11150802
Ref: 30a311150802
Ref: library/os os MFD_HUGE_256MB11150834
Ref: 30a411150834
Ref: library/os os MFD_HUGE_512MB11150867
Ref: 30a511150867
Ref: library/os os MFD_HUGE_1GB11150900
Ref: 30a611150900
Ref: library/os os MFD_HUGE_2GB11150931
Ref: 30a711150931
Ref: library/os os MFD_HUGE_16GB11150962
Ref: 30a811150962
Ref: library/os os eventfd11151220
Ref: a1911151220
Ref: library/os os eventfd_read11153261
Ref: 30aa11153261
Ref: library/os os eventfd_write11153551
Ref: 30ab11153551
Ref: library/os os EFD_CLOEXEC11153853
Ref: 1b5811153853
Ref: library/os os EFD_NONBLOCK11154043
Ref: 1b5911154043
Ref: library/os os EFD_SEMAPHORE11154251
Ref: 1b5a11154251
Ref: ファイルとディレクトリ-Footnote-111154617
Ref: ファイルとディレクトリ-Footnote-211154663
Ref: ファイルとディレクトリ-Footnote-311154705
Ref: ファイルとディレクトリ-Footnote-411154770
Ref: ファイルとディレクトリ-Footnote-511154850
Ref: ファイルとディレクトリ-Footnote-611154932
Ref: ファイルとディレクトリ-Footnote-711155021
Ref: ファイルとディレクトリ-Footnote-811155110
Ref: ファイルとディレクトリ-Footnote-911155168
Node: Timer File Descriptors11155215
Ref: library/os os-timerfd11155334
Ref: 47e11155334
Ref: library/os timer-file-descriptors11155334
Ref: 30ac11155334
Ref: library/os os timerfd_create11155546
Ref: 51f11155546
Ref: library/os os timerfd_settime11158222
Ref: 52011158222
Ref: library/os os timerfd_settime_ns11160922
Ref: 52111160922
Ref: library/os os timerfd_gettime11161276
Ref: 52211161276
Ref: library/os os timerfd_gettime_ns11161856
Ref: 52311161856
Ref: library/os os TFD_NONBLOCK11162082
Ref: 52411162082
Ref: library/os os TFD_CLOEXEC11162449
Ref: 52511162449
Ref: library/os os TFD_TIMER_ABSTIME11162739
Ref: 52611162739
Ref: library/os os TFD_TIMER_CANCEL_ON_SET11163129
Ref: 52711163129
Ref: Timer File Descriptors-Footnote-111163545
Ref: Timer File Descriptors-Footnote-211163599
Ref: Timer File Descriptors-Footnote-311163653
Ref: Timer File Descriptors-Footnote-411163708
Ref: Timer File Descriptors-Footnote-511163760
Ref: Timer File Descriptors-Footnote-611163813
Ref: Timer File Descriptors-Footnote-711163857
Node: Linux 拡張属性11163912
Ref: library/os linux-extended-attributes11164031
Ref: 30ae11164031
Ref: library/os os getxattr11164175
Ref: 131c11164175
Ref: library/os os listxattr11164957
Ref: 131d11164957
Ref: library/os os removexattr11165773
Ref: 131e11165773
Ref: library/os os setxattr11166586
Ref: 131f11166586
Ref: library/os os XATTR_SIZE_MAX11167977
Ref: 30b111167977
Ref: library/os os XATTR_CREATE11168127
Ref: 30b011168127
Ref: library/os os XATTR_REPLACE11168326
Ref: 30af11168326
Node: プロセス管理11168538
Ref: library/os os-process11168771
Ref: 30b211168771
Ref: library/os process-management11168771
Ref: 30b311168771
Ref: library/os os abort11169615
Ref: 30b511169615
Ref: library/os os add_dll_directory11170114
Ref: bdd11170114
Ref: library/os os execl11171303
Ref: 30b411171303
Ref: library/os os execle11171351
Ref: 30b611171351
Ref: library/os os execlp11171405
Ref: 30b711171405
Ref: library/os os execlpe11171454
Ref: 30b811171454
Ref: library/os os execv11171509
Ref: 301911171509
Ref: library/os os execve11171546
Ref: 131111171546
Ref: library/os os execvp11171589
Ref: 30b911171589
Ref: library/os os execvpe11171627
Ref: 30ba11171627
Ref: library/os os _exit11175601
Ref: 26f911175601
Ref: library/os os EX_OK11176588
Ref: 30bb11176588
Ref: library/os os EX_USAGE11176827
Ref: 30bc11176827
Ref: library/os os EX_DATAERR11177040
Ref: 30bd11177040
Ref: library/os os EX_NOINPUT11177192
Ref: 30be11177192
Ref: library/os os EX_NOUSER11177401
Ref: 30bf11177401
Ref: library/os os EX_NOHOST11177570
Ref: 30c011177570
Ref: library/os os EX_UNAVAILABLE11177736
Ref: 30c111177736
Ref: library/os os EX_SOFTWARE11177907
Ref: 30c211177907
Ref: library/os os EX_OSERR11178078
Ref: 30c311178078
Ref: library/os os EX_OSFILE11178326
Ref: 30c411178326
Ref: library/os os EX_CANTCREAT11178567
Ref: 30c511178567
Ref: library/os os EX_IOERR11178763
Ref: 30c611178763
Ref: library/os os EX_TEMPFAIL11178942
Ref: 30c711178942
Ref: library/os os EX_PROTOCOL11179296
Ref: 30c811179296
Ref: library/os os EX_NOPERM11179491
Ref: 30c911179491
Ref: library/os os EX_CONFIG11179717
Ref: 30ca11179717
Ref: library/os os EX_NOTFOUND11179865
Ref: 30cb11179865
Ref: library/os os fork11180022
Ref: 4b511180022
Ref: library/os os forkpty11182217
Ref: 4b611182217
Ref: library/os os kill11183455
Ref: 157f11183455
Ref: library/os os killpg11184467
Ref: 1dbb11184467
Ref: library/os os nice11184771
Ref: 131911184771
Ref: library/os os pidfd_open11184970
Ref: 6a411184970
Ref: library/os os PIDFD_NONBLOCK11185382
Ref: 6c211185382
Ref: library/os os plock11185838
Ref: 30cc11185838
Ref: library/os os popen11186144
Ref: 31a11186144
Ref: library/os os posix_spawn11188740
Ref: 52e11188740
Ref: library/os os POSIX_SPAWN_OPEN11190096
Ref: 30cd11190096
Ref: library/os os POSIX_SPAWN_CLOSE11190286
Ref: 30ce11190286
Ref: library/os os POSIX_SPAWN_DUP211190426
Ref: 30cf11190426
Ref: library/os os POSIX_SPAWN_CLOSEFROM11190581
Ref: 52f11190581
Ref: library/os os posix_spawnp11193516
Ref: 1e1111193516
Ref: library/os os register_at_fork11194299
Ref: 35511194299
Ref: library/os os spawnl11195749
Ref: 31b11195749
Ref: library/os os spawnle11195792
Ref: 30d011195792
Ref: library/os os spawnlp11195841
Ref: 30d111195841
Ref: library/os os spawnlpe11195885
Ref: 30d211195885
Ref: library/os os spawnv11195935
Ref: 30d311195935
Ref: library/os os spawnve11195979
Ref: 30d411195979
Ref: library/os os spawnvp11196029
Ref: 30d511196029
Ref: library/os os spawnvpe11196074
Ref: 30d611196074
Ref: library/os os P_NOWAIT11200740
Ref: 30d711200740
Ref: library/os os P_NOWAITO11200767
Ref: 30d911200767
Ref: library/os os P_WAIT11201121
Ref: 30d811201121
Ref: library/os os P_DETACH11201546
Ref: 30da11201546
Ref: library/os os P_OVERLAY11201573
Ref: 30db11201573
Ref: library/os os startfile11202197
Ref: 1c8311202197
Ref: library/os os system11204864
Ref: 167611204864
Ref: library/os os times11206784
Ref: 132d11206784
Ref: library/os os wait11207927
Ref: f9811207927
Ref: library/os os waitid11209009
Ref: f9911209009
Ref: library/os os waitpid11210454
Ref: f9a11210454
Ref: library/os os wait311213371
Ref: f9611213371
Ref: library/os os wait411214116
Ref: f9711214116
Ref: library/os os P_PID11214808
Ref: 30dc11214808
Ref: library/os os P_PGID11214832
Ref: 30dd11214832
Ref: library/os os P_ALL11214857
Ref: 30de11214857
Ref: library/os os P_PIDFD11214881
Ref: b1611214881
Ref: library/os os WCONTINUED11215646
Ref: 30e111215646
Ref: library/os os WEXITED11216000
Ref: 30df11216000
Ref: library/os os WSTOPPED11216372
Ref: 30e011216372
Ref: library/os os WUNTRACED11216717
Ref: 30e611216717
Ref: library/os os WNOHANG11217128
Ref: 30e211217128
Ref: library/os os WNOWAIT11217430
Ref: 30e311217430
Ref: library/os os CLD_EXITED11217799
Ref: 30e511217799
Ref: library/os os CLD_KILLED11217828
Ref: b1411217828
Ref: library/os os CLD_DUMPED11217857
Ref: 30e711217857
Ref: library/os os CLD_TRAPPED11217886
Ref: 30e811217886
Ref: library/os os CLD_STOPPED11217916
Ref: b1511217916
Ref: library/os os CLD_CONTINUED11217946
Ref: 30e911217946
Ref: library/os os waitstatus_to_exitcode11218290
Ref: b1711218290
Ref: library/os os WCOREDUMP11220143
Ref: 30f011220143
Ref: library/os os WIFCONTINUED11220529
Ref: 30f111220529
Ref: library/os os WIFSTOPPED11220914
Ref: 30ee11220914
Ref: library/os os WIFSIGNALED11221499
Ref: 30ec11221499
Ref: library/os os WIFEXITED11221777
Ref: 30ea11221777
Ref: library/os os WEXITSTATUS11222165
Ref: 30eb11222165
Ref: library/os os WSTOPSIG11222448
Ref: 30ef11222448
Ref: library/os os WTERMSIG11222741
Ref: 30ed11222741
Ref: プロセス管理-Footnote-111223074
Ref: プロセス管理-Footnote-211223146
Ref: プロセス管理-Footnote-311223189
Ref: プロセス管理-Footnote-411223239
Ref: プロセス管理-Footnote-511223285
Ref: プロセス管理-Footnote-611223330
Ref: プロセス管理-Footnote-711223382
Ref: プロセス管理-Footnote-811223491
Ref: プロセス管理-Footnote-911223533
Node: スケジューラーへのインターフェイス11223579
Ref: library/os interface-to-the-scheduler11223806
Ref: 30f311223806
Ref: library/os os-scheduling-policy11224366
Ref: 30f411224366
Ref: library/os os SCHED_OTHER11224366
Ref: 30f511224366
Ref: library/os os SCHED_BATCH11224467
Ref: 30f611224467
Ref: library/os os SCHED_DEADLINE11224678
Ref: 25d11224678
Ref: library/os os SCHED_IDLE11224802
Ref: 30f711224802
Ref: library/os os SCHED_NORMAL11224956
Ref: 25e11224956
Ref: library/os os SCHED_SPORADIC11225058
Ref: 30f811225058
Ref: library/os os SCHED_FIFO11225189
Ref: 30f911225189
Ref: library/os os SCHED_RR11225304
Ref: 30fa11225304
Ref: library/os os SCHED_RESET_ON_FORK11225411
Ref: 30fb11225411
Ref: library/os os sched_param11225772
Ref: 191011225772
Ref: library/os os sched_param sched_priority11226164
Ref: 30fc11226164
Ref: library/os os sched_get_priority_min11226293
Ref: 132111226293
Ref: library/os os sched_get_priority_max11226504
Ref: 132011226504
Ref: library/os os sched_setscheduler11226715
Ref: 132811226715
Ref: library/os os sched_getscheduler11227117
Ref: 132411227117
Ref: library/os os sched_setparam11227423
Ref: 132711227423
Ref: library/os os sched_getparam11227722
Ref: 132311227722
Ref: library/os os sched_rr_get_interval11227996
Ref: 132511227996
Ref: library/os os sched_yield11228217
Ref: 132911228217
Ref: library/os os sched_setaffinity11228335
Ref: 132611228335
Ref: library/os os sched_getaffinity11228622
Ref: 132211228622
Ref: スケジューラーへのインターフェイス-Footnote-111228951
Node: 雑多なシステム情報11229002
Ref: library/os miscellaneous-system-information11229220
Ref: 30fd11229220
Ref: library/os os-path11229220
Ref: 30fe11229220
Ref: library/os os confstr11229288
Ref: 18ec11229288
Ref: library/os os confstr_names11230454
Ref: 30ff11230454
Ref: library/os os cpu_count11230829
Ref: 4db11230829
Ref: library/os os getloadavg11231331
Ref: 192511231331
Ref: library/os os process_cpu_count11231626
Ref: 4da11231626
Ref: library/os os sysconf11232240
Ref: 18ed11232240
Ref: library/os os sysconf_names11232735
Ref: 310011232735
Ref: library/os os curdir11233474
Ref: 2c5711233474
Ref: library/os os pardir11233745
Ref: 307d11233745
Ref: library/os os sep11234014
Ref: 87a11234014
Ref: library/os os altsep11234634
Ref: 87b11234634
Ref: library/os os extsep11235086
Ref: 310111235086
Ref: library/os os pathsep11235298
Ref: 213411235298
Ref: library/os os defpath11235651
Ref: 1de411235651
Ref: library/os os linesep11235920
Ref: 25dc11235920
Ref: library/os os devnull11236545
Ref: 1e1411236545
Ref: library/os os RTLD_LAZY11236785
Ref: 133011236785
Ref: library/os os RTLD_NOW11236813
Ref: 133111236813
Ref: library/os os RTLD_GLOBAL11236840
Ref: 133211236840
Ref: library/os os RTLD_LOCAL11236870
Ref: 133311236870
Ref: library/os os RTLD_NODELETE11236899
Ref: 133411236899
Ref: library/os os RTLD_NOLOAD11236931
Ref: 133511236931
Ref: library/os os RTLD_DEEPBIND11236961
Ref: 133611236961
Ref: 雑多なシステム情報-Footnote-111237320
Node: 乱数<2>11237366
Ref: library/os random-numbers11237524
Ref: 310211237524
Ref: library/os os getrandom11237557
Ref: eb911237557
Ref: library/os os urandom11238577
Ref: 74611238577
Ref: library/os os GRND_NONBLOCK11241528
Ref: 310411241528
Ref: library/os os GRND_RANDOM11242144
Ref: 310311242144
Ref: 乱数<2>-Footnote-111242424
Ref: 乱数<2>-Footnote-211242487
Node: io --- ストリームを扱うコアツール11242529
Ref: library/io doc11242811
Ref: 310511242811
Ref: library/io io-core-tools-for-working-with-streams11242811
Ref: 310611242811
Ref: library/io module-io11242811
Ref: 8311242811
Ref: library/io translation-repo11242811
Ref: 310711242811
Ref: io --- ストリームを扱うコアツール-Footnote-111243217
Node: 概要<2>11243279
Ref: library/io io-overview11243393
Ref: 25da11243393
Ref: library/io overview11243393
Ref: 310811243393
Node: テキスト I/O11244869
Ref: library/io text-i-o11244956
Ref: 310911244956
Node: バイナリ I/O11246088
Ref: library/io binary-i-o11246191
Ref: 310a11246191
Node: Raw I/O11247339
Ref: library/io raw-i-o11247417
Ref: 310b11247417
Node: Text Encoding11248045
Ref: library/io io-text-encoding11248219
Ref: 9c011248219
Ref: library/io text-encoding11248219
Ref: 310c11248219
Ref: Text Encoding-Footnote-111249387
Node: Opt-in EncodingWarning11249429
Ref: library/io io-encoding-warning11249501
Ref: 214011249501
Ref: library/io opt-in-encodingwarning11249501
Ref: 310d11249501
Ref: Opt-in EncodingWarning-Footnote-111250317
Node: 高水準のモジュールインターフェイス11250359
Ref: library/io high-level-module-interface11250539
Ref: 310e11250539
Ref: library/io io DEFAULT_BUFFER_SIZE11250645
Ref: 1a3d11250645
Ref: library/io io open11250958
Ref: 74011250958
Ref: library/io io open_code11251387
Ref: 1a9811251387
Ref: library/io io text_encoding11252086
Ref: 1a3c11252086
Ref: library/io io BlockingIOError11253224
Ref: 310f11253224
Ref: library/io io UnsupportedOperation11253370
Ref: 1d7f11253370
Node: クラス階層11253755
Ref: library/io class-hierarchy11253935
Ref: 311011253935
Node: I/O 基底クラス11259324
Ref: library/io i-o-base-classes11259422
Ref: 311111259422
Ref: library/io io IOBase11259476
Ref: 50511259476
Ref: library/io io IOBase close11261785
Ref: 50611261785
Ref: library/io io IOBase closed11262386
Ref: 1e0e11262386
Ref: library/io io IOBase fileno11262501
Ref: 17ad11262501
Ref: library/io io IOBase flush11262811
Ref: 2ce611262811
Ref: library/io io IOBase isatty11263047
Ref: 206911263047
Ref: library/io io IOBase readable11263250
Ref: 15c711263250
Ref: library/io io IOBase readline11263418
Ref: 154111263418
Ref: library/io io IOBase readlines11263907
Ref: 27a111263907
Ref: library/io io IOBase seek11264640
Ref: 14a411264640
Ref: library/io io IOBase seekable11265620
Ref: 15c911265620
Ref: library/io io IOBase tell11265966
Ref: 15c611265966
Ref: library/io io IOBase truncate11266058
Ref: 152811266058
Ref: library/io io IOBase writable11266901
Ref: 15c811266901
Ref: library/io io IOBase writelines11267108
Ref: 177a11267108
Ref: library/io io IOBase __del__11267380
Ref: 311211267380
Ref: library/io io RawIOBase11267678
Ref: 12e711267678
Ref: library/io io RawIOBase read11268343
Ref: 101d11268343
Ref: library/io io RawIOBase readall11269341
Ref: 311311269341
Ref: library/io io RawIOBase readinto11269556
Ref: 101e11269556
Ref: library/io io RawIOBase write11270013
Ref: 15c511270013
Ref: library/io io BufferedIOBase11270847
Ref: 8a311270847
Ref: library/io io BufferedIOBase raw11272151
Ref: 15ca11272151
Ref: library/io io BufferedIOBase detach11272464
Ref: 2deb11272464
Ref: library/io io BufferedIOBase read11273001
Ref: 154011273001
Ref: library/io io BufferedIOBase read111274288
Ref: 2e5611274288
Ref: library/io io BufferedIOBase readinto11274879
Ref: 189511274879
Ref: library/io io BufferedIOBase readinto111275626
Ref: 101c11275626
Ref: library/io io BufferedIOBase write11276282
Ref: ed711276282
Ref: I/O 基底クラス-Footnote-111277472
Ref: I/O 基底クラス-Footnote-211277514
Node: 生ファイルI/O11277556
Ref: library/io raw-file-i-o11277696
Ref: 311411277696
Ref: library/io io FileIO11277750
Ref: 152711277750
Ref: library/io io FileIO mode11280653
Ref: 311511280653
Ref: library/io io FileIO name11280745
Ref: 2def11280745
Node: バッファ付きストリーム11280914
Ref: library/io buffered-streams11281054
Ref: 311611281054
Ref: library/io io BytesIO11281272
Ref: 10a411281272
Ref: library/io io BytesIO getbuffer11281844
Ref: 140a11281844
Ref: library/io io BytesIO getvalue11282536
Ref: 2e5411282536
Ref: library/io io BytesIO read111282654
Ref: 311711282654
Ref: library/io io BytesIO readinto111282904
Ref: 311811282904
Ref: library/io io BufferedReader11283103
Ref: 142711283103
Ref: library/io io BufferedReader peek11284248
Ref: 311911284248
Ref: library/io io BufferedReader read11284554
Ref: 311a11284554
Ref: library/io io BufferedReader read111284706
Ref: 311b11284706
Ref: library/io io BufferedWriter11284946
Ref: 15cb11284946
Ref: library/io io BufferedWriter flush11286350
Ref: 311c11286350
Ref: library/io io BufferedWriter write11286613
Ref: 311d11286613
Ref: library/io io BufferedRandom11286976
Ref: 15cc11286976
Ref: library/io io BufferedRWPair11287790
Ref: 15cd11287790
Node: テキスト I/O<2>11288903
Ref: library/io id111289016
Ref: 311e11289016
Ref: library/io io TextIOBase11289067
Ref: 8a411289067
Ref: library/io io TextIOBase encoding11289427
Ref: 311f11289427
Ref: library/io io TextIOBase errors11289666
Ref: 152611289666
Ref: library/io io TextIOBase newlines11289769
Ref: 312011289769
Ref: library/io io TextIOBase buffer11290079
Ref: 14bb11290079
Ref: library/io io TextIOBase detach11290378
Ref: 178111290378
Ref: library/io io TextIOBase read11290957
Ref: 206c11290957
Ref: library/io io TextIOBase readline11291219
Ref: 20a611291219
Ref: library/io io TextIOBase seek11291503
Ref: 312111291503
Ref: library/io io TextIOBase tell11292488
Ref: 312211292488
Ref: library/io io TextIOBase write11292714
Ref: 205b11292714
Ref: library/io io TextIOWrapper11292869
Ref: 9be11292869
Ref: library/io io TextIOWrapper line_buffering11297625
Ref: 312311297625
Ref: library/io io TextIOWrapper write_through11297721
Ref: 312411297721
Ref: library/io io TextIOWrapper reconfigure11297891
Ref: d4011297891
Ref: library/io io TextIOWrapper seek11298980
Ref: 312511298980
Ref: library/io io TextIOWrapper tell11299901
Ref: 17b111299901
Ref: library/io io StringIO11300130
Ref: 112a11300130
Ref: library/io io StringIO getvalue11301462
Ref: 312611301462
Ref: library/io io IncrementalNewlineDecoder11302119
Ref: 1a3e11302119
Node: Static Typing11302310
Ref: library/io static-typing11302448
Ref: 312711302448
Ref: library/io io Reader11302691
Ref: 23611302691
Ref: library/io io Reader read11302941
Ref: 312811302941
Ref: library/io io Writer11303340
Ref: 23711303340
Ref: library/io io Writer write11303595
Ref: 312911303595
Node: 性能<3>11304009
Ref: library/io performance11304123
Ref: 312b11304123
Node: バイナリ I/O<2>11304452
Ref: library/io id211304545
Ref: 312c11304545
Node: テキスト I/O<3>11305526
Ref: library/io id311305661
Ref: 312d11305661
Node: マルチスレッディング<3>11306273
Ref: library/io multi-threading11306413
Ref: 312e11306413
Ref: マルチスレッディング<3>-Footnote-111307137
Node: リエントラント性11307181
Ref: library/io reentrancy11307293
Ref: 312f11307293
Node: time --- 時刻データへのアクセスと変換11308350
Ref: library/time doc11308599
Ref: 313011308599
Ref: library/time module-time11308599
Ref: f411308599
Ref: library/time time-time-access-and-conversions11308599
Ref: 313111308599
Ref: library/time translation-repo11308599
Ref: 313211308599
Ref: library/time epoch11309577
Ref: 2f1311309577
Ref: time --- 時刻データへのアクセスと変換-Footnote-111315024
Ref: time --- 時刻データへのアクセスと変換-Footnote-211315074
Ref: time --- 時刻データへのアクセスと変換-Footnote-311315139
Node: 関数<5>11315197
Ref: library/time functions11315321
Ref: 313511315321
Ref: library/time time-functions11315321
Ref: 313611315321
Ref: library/time time asctime11315352
Ref: 140011315352
Ref: library/time time pthread_getcpuclockid11316036
Ref: d8b11316036
Ref: library/time time clock_getres11316678
Ref: 137511316678
Ref: library/time time clock_gettime11317000
Ref: 137611317000
Ref: library/time time clock_gettime_ns11317433
Ref: cdb11317433
Ref: library/time time clock_settime11317662
Ref: 137711317662
Ref: library/time time clock_settime_ns11318089
Ref: cdc11318089
Ref: library/time time ctime11318347
Ref: 28c511318347
Ref: library/time time get_clock_info11318989
Ref: 137411318989
Ref: library/time time gmtime11320327
Ref: 13d811320327
Ref: library/time time localtime11320975
Ref: 171211320975
Ref: library/time time mktime11321713
Ref: 140111321713
Ref: library/time time monotonic11322661
Ref: 55c11322661
Ref: library/time time monotonic_ns11323798
Ref: cdd11323798
Ref: library/time time perf_counter11323973
Ref: c7a11323973
Ref: library/time time perf_counter_ns11324917
Ref: cde11324917
Ref: library/time time process_time11325098
Ref: c7b11325098
Ref: library/time time process_time_ns11325641
Ref: cdf11325641
Ref: library/time time sleep11325822
Ref: 8ac11325822
Ref: library/time time strftime11328042
Ref: 140211328042
Ref: library/time leap-second11336149
Ref: 313811336149
Ref: library/time time strptime11337622
Ref: 164611337622
Ref: library/time time struct_time11339834
Ref: ee611339834
Ref: library/time time struct_time tm_year11340551
Ref: 171111340551
Ref: library/time time struct_time tm_mon11340815
Ref: 313911340815
Ref: library/time time struct_time tm_mday11341084
Ref: 313a11341084
Ref: library/time time struct_time tm_hour11341352
Ref: 313b11341352
Ref: library/time time struct_time tm_min11341619
Ref: 313c11341619
Ref: library/time time struct_time tm_sec11341887
Ref: 313d11341887
Ref: library/time time struct_time tm_wday11342366
Ref: 313e11342366
Ref: library/time time struct_time tm_yday11342640
Ref: 313f11342640
Ref: library/time time struct_time tm_isdst11342910
Ref: 28d611342910
Ref: library/time time struct_time tm_zone11343292
Ref: 313411343292
Ref: library/time time struct_time tm_gmtoff11343573
Ref: 313311343573
Ref: library/time time time11344451
Ref: 55d11344451
Ref: library/time time time_ns11346379
Ref: ce011346379
Ref: library/time time thread_time11346591
Ref: b3011346591
Ref: library/time time thread_time_ns11347275
Ref: d8a11347275
Ref: library/time time tzset11347454
Ref: 314011347454
Ref: 関数<5>-Footnote-111352163
Ref: 関数<5>-Footnote-211352224
Ref: 関数<5>-Footnote-311352323
Ref: 関数<5>-Footnote-411352365
Ref: 関数<5>-Footnote-511353146
Ref: 関数<5>-Footnote-611353927
Ref: 関数<5>-Footnote-711353977
Ref: 関数<5>-Footnote-811354036
Ref: 関数<5>-Footnote-911354817
Ref: 関数<5>-Footnote-1011354865
Ref: 関数<5>-Footnote-1111354916
Ref: 関数<5>-Footnote-1211354965
Node: Clock ID Constants11355012
Ref: library/time clock-id-constants11355163
Ref: 314111355163
Ref: library/time time-clock-id-constants11355163
Ref: 30ad11355163
Ref: library/time time CLOCK_BOOTTIME11355325
Ref: d8711355325
Ref: library/time time CLOCK_HIGHRES11355808
Ref: 314211355808
Ref: library/time time CLOCK_MONOTONIC11356185
Ref: 8a811356185
Ref: library/time time CLOCK_MONOTONIC_RAW11356419
Ref: 314311356419
Ref: library/time time CLOCK_MONOTONIC_RAW_APPROX11356731
Ref: 314411356731
Ref: library/time time CLOCK_PROCESS_CPUTIME_ID11356998
Ref: 314511356998
Ref: library/time time CLOCK_PROF11357188
Ref: d8811357188
Ref: library/time time CLOCK_TAI11357389
Ref: 1d5711357389
Ref: library/time time CLOCK_THREAD_CPUTIME_ID11357689
Ref: 314611357689
Ref: library/time time CLOCK_UPTIME11357864
Ref: d8911357864
Ref: library/time time CLOCK_UPTIME_RAW11358152
Ref: c3711358152
Ref: library/time time CLOCK_UPTIME_RAW_APPROX11358456
Ref: 314711358456
Ref: library/time time CLOCK_REALTIME11358810
Ref: 8a911358810
Ref: Clock ID Constants-Footnote-111359072
Node: Timezone Constants11359199
Ref: library/time time-timezone-constants11359332
Ref: 314811359332
Ref: library/time timezone-constants11359332
Ref: 314911359332
Ref: library/time time altzone11359389
Ref: 314a11359389
Ref: library/time time daylight11359835
Ref: 314b11359835
Ref: library/time time timezone11360011
Ref: 314c11360011
Ref: library/time time tzname11360378
Ref: 314d11360378
Node: logging --- Python 用のログ記録手段11361873
Ref: library/logging doc11362122
Ref: 314e11362122
Ref: library/logging logging-logging-facility-for-python11362122
Ref: 314f11362122
Ref: library/logging module-logging11362122
Ref: 8b11362122
Ref: library/logging translation-repo11362122
Ref: 315011362122
Ref: logging --- Python 用のログ記録手段-Footnote-111366766
Node: ロガーオブジェクト11366843
Ref: library/logging logger11366980
Ref: 315111366980
Ref: library/logging logger-objects11366980
Ref: 315211366980
Ref: library/logging logging Logger11368504
Ref: d4611368504
Ref: library/logging logging Logger name11368535
Ref: 315311368535
Ref: library/logging logging Logger level11368819
Ref: 315411368819
Ref: library/logging logging Logger parent11369259
Ref: 315511369259
Ref: library/logging logging Logger propagate11369613
Ref: 16ae11369613
Ref: library/logging logging Logger handlers11372168
Ref: 315611372168
Ref: library/logging logging Logger disabled11372726
Ref: 315911372726
Ref: library/logging logging Logger setLevel11373146
Ref: 16ac11373146
Ref: library/logging logging Logger isEnabledFor11375532
Ref: 150e11375532
Ref: library/logging logging Logger getEffectiveLevel11375984
Ref: 315b11375984
Ref: library/logging logging Logger getChild11376608
Ref: 150c11376608
Ref: library/logging logging Logger getChildren11377183
Ref: 1b5211377183
Ref: library/logging logging Logger debug11377938
Ref: 102b11377938
Ref: library/logging logging Logger info11384620
Ref: 20dd11384620
Ref: library/logging logging Logger warning11384850
Ref: 1a7411384850
Ref: library/logging logging Logger error11385348
Ref: 315e11385348
Ref: library/logging logging Logger critical11385580
Ref: 102a11385580
Ref: library/logging logging Logger log11385818
Ref: 102811385818
Ref: library/logging logging Logger exception11386085
Ref: 102911386085
Ref: library/logging logging Logger addFilter11386487
Ref: 315f11386487
Ref: library/logging logging Logger removeFilter11386618
Ref: 316011386618
Ref: library/logging logging Logger filter11386758
Ref: 316111386758
Ref: library/logging logging Logger addHandler11387347
Ref: 315711387347
Ref: library/logging logging Logger removeHandler11387475
Ref: 315811387475
Ref: library/logging logging Logger findCaller11387612
Ref: 316211387612
Ref: library/logging logging Logger handle11388656
Ref: 316311388656
Ref: library/logging logging Logger makeRecord11389266
Ref: 316411389266
Ref: library/logging logging Logger hasHandlers11389609
Ref: 316511389609
Node: ロギングレベル11390414
Ref: library/logging levels11390590
Ref: 86a11390590
Ref: library/logging logging-levels11390590
Ref: 316611390590
Ref: library/logging logging NOTSET11391361
Ref: 315a11391361
Ref: library/logging logging DEBUG11392199
Ref: 20de11392199
Ref: library/logging logging INFO11392569
Ref: 20df11392569
Ref: library/logging logging WARNING11392818
Ref: 20e011392818
Ref: library/logging logging ERROR11393416
Ref: 20e111393416
Ref: library/logging logging CRITICAL11393697
Ref: 20e211393697
Node: ハンドラオブジェクト11393924
Ref: library/logging handler11394109
Ref: 316711394109
Ref: library/logging handler-objects11394109
Ref: 316811394109
Ref: library/logging logging Handler11394594
Ref: 16af11394594
Ref: library/logging logging Handler __init__11394626
Ref: 316911394626
Ref: library/logging logging Handler createLock11394992
Ref: 316a11394992
Ref: library/logging logging Handler acquire11395240
Ref: 316b11395240
Ref: library/logging logging Handler release11395384
Ref: 316c11395384
Ref: library/logging logging Handler setLevel11395511
Ref: 316d11395511
Ref: library/logging logging Handler setFormatter11396250
Ref: 316e11396250
Ref: library/logging logging Handler addFilter11396437
Ref: 316f11396437
Ref: library/logging logging Handler removeFilter11396571
Ref: 317011396571
Ref: library/logging logging Handler filter11396711
Ref: 317111396711
Ref: library/logging logging Handler flush11397236
Ref: 317211397236
Ref: library/logging logging Handler close11397478
Ref: 317311397478
Ref: library/logging logging Handler handle11397828
Ref: 317411397828
Ref: library/logging logging Handler handleError11398139
Ref: 317511398139
Ref: library/logging logging Handler format11399211
Ref: 317711399211
Ref: library/logging logging Handler emit11399516
Ref: 317611399516
Node: フォーマッタオブジェクト11401947
Ref: library/logging formatter-objects11402141
Ref: 317811402141
Ref: library/logging id111402141
Ref: 317911402141
Ref: library/logging logging Formatter11402222
Ref: 16b011402222
Ref: library/logging logging Formatter format11404947
Ref: 317c11404947
Ref: library/logging logging Formatter formatTime11406741
Ref: 317a11406741
Ref: library/logging logging Formatter formatException11409774
Ref: 317d11409774
Ref: library/logging logging Formatter formatStack11410143
Ref: 317e11410143
Ref: library/logging logging BufferingFormatter11410528
Ref: 317f11410528
Ref: library/logging logging BufferingFormatter formatHeader11411066
Ref: 318011411066
Ref: library/logging logging BufferingFormatter formatFooter11411550
Ref: 318111411550
Ref: library/logging logging BufferingFormatter format11411978
Ref: 318211411978
Node: フィルタオブジェクト11412507
Ref: library/logging filter11412699
Ref: 318311412699
Ref: library/logging filter-objects11412699
Ref: 318411412699
Ref: library/logging logging Filter11413417
Ref: 141411413417
Ref: library/logging logging Filter filter11413838
Ref: 318511413838
Node: LogRecord オブジェクト11417166
Ref: library/logging log-record11417338
Ref: 318811417338
Ref: library/logging logrecord-objects11417338
Ref: 318911417338
Ref: library/logging logging LogRecord11417737
Ref: 11e811417737
Ref: library/logging logging LogRecord getMessage11420641
Ref: 318c11420641
Node: LogRecord 属性11422513
Ref: library/logging id211422687
Ref: 318f11422687
Ref: library/logging logrecord-attributes11422687
Ref: 315c11422687
Node: LoggerAdapter オブジェクト11432487
Ref: library/logging logger-adapter11432657
Ref: 319011432657
Ref: library/logging loggeradapter-objects11432657
Ref: 319111432657
Ref: library/logging logging LoggerAdapter11433006
Ref: 150d11433006
Ref: library/logging logging LoggerAdapter process11433599
Ref: 319311433599
Ref: library/logging logging LoggerAdapter manager11434153
Ref: 319411434153
Ref: library/logging logging LoggerAdapter _log11434293
Ref: 319511434293
Node: スレッドセーフ性11435682
Ref: library/logging thread-safety11435869
Ref: 319611435869
Node: モジュールレベルの関数11436813
Ref: library/logging module-level-functions11436998
Ref: 319711436998
Ref: library/logging logging getLogger11437186
Ref: b5911437186
Ref: library/logging logging getLoggerClass11438088
Ref: 319811438088
Ref: library/logging logging getLogRecordFactory11438704
Ref: 318d11438704
Ref: library/logging logging debug11439281
Ref: 315d11439281
Ref: library/logging logging info11440409
Ref: 318611440409
Ref: library/logging logging warning11440677
Ref: 35411440677
Ref: library/logging logging error11441190
Ref: 319a11441190
Ref: library/logging logging critical11441459
Ref: 319b11441459
Ref: library/logging logging exception11441734
Ref: 16ad11441734
Ref: library/logging logging log11442151
Ref: 319c11442151
Ref: library/logging logging disable11442430
Ref: 319d11442430
Ref: library/logging logging addLevelName11443805
Ref: 319e11443805
Ref: library/logging logging getLevelNamesMapping11444658
Ref: 86911444658
Ref: library/logging logging getLevelName11445083
Ref: 31a011445083
Ref: library/logging logging getHandlerByName11447030
Ref: 1b6211447030
Ref: library/logging logging getHandlerNames11447262
Ref: 1a6e11447262
Ref: library/logging logging makeLogRecord11447428
Ref: 318a11447428
Ref: library/logging logging basicConfig11447838
Ref: bf311447838
Ref: library/logging logging shutdown11454170
Ref: 31a111454170
Ref: library/logging logging setLoggerClass11454845
Ref: 319911454845
Ref: library/logging logging setLogRecordFactory11455755
Ref: 318e11455755
Ref: モジュールレベルの関数-Footnote-111457267
Node: モジュールレベル属性11457332
Ref: library/logging module-level-attributes11457529
Ref: 31a211457529
Ref: library/logging logging lastResort11457602
Ref: 141311457602
Ref: library/logging logging raiseExceptions11458425
Ref: 141211458425
Node: warnings モジュールとの統合11459015
Ref: library/logging integration-with-the-warnings-module11459170
Ref: 31a311459170
Ref: library/logging logging captureWarnings11459378
Ref: 31a411459378
Ref: warnings モジュールとの統合-Footnote-111461009
Ref: warnings モジュールとの統合-Footnote-211461051
Node: logging config --- ログ記録の環境設定11461104
Ref: library/logging config doc11461350
Ref: 31a511461350
Ref: library/logging config logging-config-logging-configuration11461350
Ref: 31a611461350
Ref: library/logging config module-logging config11461350
Ref: 8c11461350
Ref: library/logging config translation-repo11461350
Ref: 31a711461350
Ref: logging config --- ログ記録の環境設定-Footnote-111462181
Node: 環境設定のための関数11462255
Ref: library/logging config configuration-functions11462416
Ref: 31a811462416
Ref: library/logging config logging-config-api11462416
Ref: 150911462416
Ref: library/logging config logging config dictConfig11462856
Ref: 13c811462856
Ref: library/logging config logging config fileConfig11465110
Ref: d4811465110
Ref: library/logging config logging config listen11468360
Ref: 116711468360
Ref: library/logging config logging-eval-security11470580
Ref: 31ac11470580
Ref: library/logging config logging config stopListening11472814
Ref: 31ab11472814
Node: セキュリティで考慮すべき点11473096
Ref: library/logging config security-considerations11473296
Ref: 31ad11473296
Node: 環境設定辞書スキーマ11474448
Ref: library/logging config configuration-dictionary-schema11474651
Ref: 31af11474651
Ref: library/logging config logging-config-dictschema11474651
Ref: 31a911474651
Node: 辞書スキーマの詳細11475946
Ref: library/logging config dictionary-schema-details11476061
Ref: 31b111476061
Ref: library/logging config logging-config-dictschema-formatters11477157
Ref: 31b211477157
Node: 増分設定11483141
Ref: library/logging config incremental-configuration11483292
Ref: 31b411483292
Ref: library/logging config logging-config-dict-incremental11483292
Ref: 31b311483292
Node: オブジェクトの接続11485040
Ref: library/logging config logging-config-dict-connections11485197
Ref: 31b011485197
Ref: library/logging config object-connections11485197
Ref: 31b511485197
Node: ユーザ定義オブジェクト11488002
Ref: library/logging config logging-config-dict-userdef11488174
Ref: 31ae11488174
Ref: library/logging config user-defined-objects11488174
Ref: 31b611488174
Node: ハンドラの設定順序11493889
Ref: library/logging config handler-config-dict-order11494076
Ref: 31b711494076
Ref: library/logging config handler-configuration-order11494076
Ref: 31b811494076
Node: 外部オブジェクトへのアクセス11495380
Ref: library/logging config access-to-external-objects11495576
Ref: 31b911495576
Ref: library/logging config logging-config-dict-externalobj11495576
Ref: 31ba11495576
Node: 内部オブジェクトへのアクセス11497065
Ref: library/logging config access-to-internal-objects11497288
Ref: 31bb11497288
Ref: library/logging config logging-config-dict-internalobj11497288
Ref: 31bc11497288
Node: インポート解決とカスタムインポーター11501172
Ref: library/logging config import-resolution-and-custom-importers11501395
Ref: 31be11501395
Ref: library/logging config logging-import-resolution11501395
Ref: 31bf11501395
Node: Configuring QueueHandler and QueueListener11502668
Ref: library/logging config configure-queue11502840
Ref: 194611502840
Ref: library/logging config configuring-queuehandler-and-queuelistener11502840
Ref: 31c011502840
Node: 環境設定ファイルの書式11506073
Ref: library/logging config configuration-file-format11506228
Ref: 31c511506228
Ref: library/logging config logging-config-fileformat11506228
Ref: 31aa11506228
Node: logging handlers --- ログ記録ハンドラー11515288
Ref: library/logging handlers doc11515567
Ref: 31c611515567
Ref: library/logging handlers logging-handlers-logging-handlers11515567
Ref: 31c711515567
Ref: library/logging handlers module-logging handlers11515567
Ref: 8d11515567
Ref: library/logging handlers translation-repo11515567
Ref: 31c811515567
Ref: logging handlers --- ログ記録ハンドラー-Footnote-111516874
Node: StreamHandler11516951
Ref: library/logging handlers stream-handler11517069
Ref: 31c911517069
Ref: library/logging handlers streamhandler11517069
Ref: 31ca11517069
Ref: library/logging handlers logging StreamHandler11517524
Ref: 141111517524
Ref: library/logging handlers logging StreamHandler emit11517866
Ref: 31cb11517866
Ref: library/logging handlers logging StreamHandler flush11518334
Ref: 31cd11518334
Ref: library/logging handlers logging StreamHandler setStream11518734
Ref: d4711518734
Ref: library/logging handlers logging StreamHandler terminator11519242
Ref: 31cc11519242
Node: FileHandler11519804
Ref: library/logging handlers file-handler11519942
Ref: 31ce11519942
Ref: library/logging handlers filehandler11519942
Ref: 31cf11519942
Ref: library/logging handlers logging FileHandler11520242
Ref: 1c5311520242
Ref: library/logging handlers logging FileHandler close11521116
Ref: 31d111521116
Ref: library/logging handlers logging FileHandler emit11521191
Ref: 31d011521191
Ref: FileHandler-Footnote-111521595
Node: NullHandler11521660
Ref: library/logging handlers null-handler11521803
Ref: 31d211521803
Ref: library/logging handlers nullhandler11521803
Ref: 31d311521803
Ref: library/logging handlers logging NullHandler11522116
Ref: 149c11522116
Ref: library/logging handlers logging NullHandler emit11522241
Ref: 31d411522241
Ref: library/logging handlers logging NullHandler handle11522333
Ref: 31d511522333
Ref: library/logging handlers logging NullHandler createLock11522427
Ref: 31d611522427
Node: WatchedFileHandler11522793
Ref: library/logging handlers watched-file-handler11522944
Ref: 31d811522944
Ref: library/logging handlers watchedfilehandler11522944
Ref: 31d911522944
Ref: library/logging handlers logging handlers WatchedFileHandler11524336
Ref: 31da11524336
Ref: library/logging handlers logging handlers WatchedFileHandler reopenIfNeeded11525222
Ref: eb411525222
Ref: library/logging handlers logging handlers WatchedFileHandler emit11525587
Ref: 31db11525587
Node: BaseRotatingHandler11525832
Ref: library/logging handlers base-rotating-handler11525991
Ref: 31dc11525991
Ref: library/logging handlers baserotatinghandler11525991
Ref: 31dd11525991
Ref: library/logging handlers logging handlers BaseRotatingHandler11526374
Ref: 31de11526374
Ref: library/logging handlers logging handlers BaseRotatingHandler namer11526585
Ref: 31df11526585
Ref: library/logging handlers logging handlers BaseRotatingHandler rotator11528823
Ref: 31e211528823
Ref: library/logging handlers logging handlers BaseRotatingHandler rotation_filename11529147
Ref: 31e011529147
Ref: library/logging handlers logging handlers BaseRotatingHandler rotate11529888
Ref: 31e311529888
Node: RotatingFileHandler11531513
Ref: library/logging handlers rotating-file-handler11531678
Ref: 31e511531678
Ref: library/logging handlers rotatingfilehandler11531678
Ref: 31e611531678
Ref: library/logging handlers logging handlers RotatingFileHandler11531865
Ref: 194111531865
Ref: library/logging handlers logging handlers RotatingFileHandler doRollover11534583
Ref: 31e811534583
Ref: library/logging handlers logging handlers RotatingFileHandler emit11534696
Ref: 31e711534696
Ref: library/logging handlers logging handlers RotatingFileHandler shouldRollover11534862
Ref: 31e911534862
Node: TimedRotatingFileHandler11535016
Ref: library/logging handlers timed-rotating-file-handler11535175
Ref: 31ea11535175
Ref: library/logging handlers timedrotatingfilehandler11535175
Ref: 31eb11535175
Ref: library/logging handlers logging handlers TimedRotatingFileHandler11535404
Ref: 116311535404
Ref: library/logging handlers logging handlers TimedRotatingFileHandler doRollover11541424
Ref: 31ed11541424
Ref: library/logging handlers logging handlers TimedRotatingFileHandler emit11541537
Ref: 31ec11541537
Ref: library/logging handlers logging handlers TimedRotatingFileHandler getFilesToDelete11541712
Ref: 31e111541712
Ref: library/logging handlers logging handlers TimedRotatingFileHandler shouldRollover11542033
Ref: 31ee11542033
Node: SocketHandler11542203
Ref: library/logging handlers socket-handler11542358
Ref: 31ef11542358
Ref: library/logging handlers sockethandler11542358
Ref: 31f011542358
Ref: library/logging handlers logging handlers SocketHandler11542567
Ref: 116411542567
Ref: library/logging handlers logging handlers SocketHandler close11543076
Ref: 31f111543076
Ref: library/logging handlers logging handlers SocketHandler emit11543151
Ref: 31f211543151
Ref: library/logging handlers logging handlers SocketHandler handleError11543684
Ref: 31f311543684
Ref: library/logging handlers logging handlers SocketHandler makeSocket11543966
Ref: 31f411543966
Ref: library/logging handlers logging handlers SocketHandler makePickle11544275
Ref: 31f511544275
Ref: library/logging handlers logging handlers SocketHandler send11545310
Ref: 31f611545310
Ref: library/logging handlers logging handlers SocketHandler createSocket11545726
Ref: 86d11545726
Node: DatagramHandler11547103
Ref: library/logging handlers datagram-handler11547247
Ref: 31f711547247
Ref: library/logging handlers datagramhandler11547247
Ref: 31f811547247
Ref: library/logging handlers logging handlers DatagramHandler11547480
Ref: 116511547480
Ref: library/logging handlers logging handlers DatagramHandler emit11548807
Ref: 31f911548807
Ref: library/logging handlers logging handlers DatagramHandler makeSocket11549340
Ref: 31fa11549340
Ref: library/logging handlers logging handlers DatagramHandler send11549587
Ref: 31fb11549587
Node: SysLogHandler11549870
Ref: library/logging handlers syslog-handler11550018
Ref: 31fc11550018
Ref: library/logging handlers sysloghandler11550018
Ref: 31fd11550018
Ref: library/logging handlers logging handlers SysLogHandler11550219
Ref: 86c11550219
Ref: library/logging handlers logging handlers SysLogHandler close11552952
Ref: 31fe11552952
Ref: library/logging handlers logging handlers SysLogHandler createSocket11553048
Ref: 86b11553048
Ref: library/logging handlers logging handlers SysLogHandler emit11553503
Ref: 31ff11553503
Ref: library/logging handlers logging handlers SysLogHandler encodePriority11555945
Ref: 320011555945
Ref: library/logging handlers logging handlers SysLogHandler mapPriority11560112
Ref: 320111560112
Ref: SysLogHandler-Footnote-111560754
Ref: SysLogHandler-Footnote-211560809
Ref: SysLogHandler-Footnote-311560874
Ref: SysLogHandler-Footnote-411560933
Node: NTEventLogHandler11560998
Ref: library/logging handlers nt-eventlog-handler11561142
Ref: 320211561142
Ref: library/logging handlers nteventloghandler11561142
Ref: 320311561142
Ref: library/logging handlers logging handlers NTEventLogHandler11561470
Ref: 320411561470
Ref: library/logging handlers logging handlers NTEventLogHandler close11562679
Ref: 320511562679
Ref: library/logging handlers logging handlers NTEventLogHandler emit11563265
Ref: 320611563265
Ref: library/logging handlers logging handlers NTEventLogHandler getEventCategory11563465
Ref: 320711563465
Ref: library/logging handlers logging handlers NTEventLogHandler getEventType11563795
Ref: 320811563795
Ref: library/logging handlers logging handlers NTEventLogHandler getMessageID11564533
Ref: 320911564533
Node: SMTPHandler11565038
Ref: library/logging handlers smtp-handler11565182
Ref: 320a11565182
Ref: library/logging handlers smtphandler11565182
Ref: 320b11565182
Ref: library/logging handlers logging handlers SMTPHandler11565374
Ref: 18b211565374
Ref: library/logging handlers logging handlers SMTPHandler emit11567000
Ref: 320c11567000
Ref: library/logging handlers logging handlers SMTPHandler getSubject11567128
Ref: 320d11567128
Node: MemoryHandler11567327
Ref: library/logging handlers memory-handler11567465
Ref: 320e11567465
Ref: library/logging handlers memoryhandler11567465
Ref: 320f11567465
Ref: library/logging handlers logging handlers BufferingHandler11568329
Ref: 321011568329
Ref: library/logging handlers logging handlers BufferingHandler emit11568567
Ref: 321111568567
Ref: library/logging handlers logging handlers BufferingHandler flush11568822
Ref: 321311568822
Ref: library/logging handlers logging handlers BufferingHandler shouldFlush11569065
Ref: 321211569065
Ref: library/logging handlers logging handlers MemoryHandler11569354
Ref: 31bd11569354
Ref: library/logging handlers logging handlers MemoryHandler close11570475
Ref: 321511570475
Ref: library/logging handlers logging handlers MemoryHandler flush11570648
Ref: 321611570648
Ref: library/logging handlers logging handlers MemoryHandler setTarget11570961
Ref: 321411570961
Ref: library/logging handlers logging handlers MemoryHandler shouldFlush11571085
Ref: 321711571085
Node: HTTPHandler11571278
Ref: library/logging handlers http-handler11571417
Ref: 321811571417
Ref: library/logging handlers httphandler11571417
Ref: 321911571417
Ref: library/logging handlers logging handlers HTTPHandler11571644
Ref: 102c11571644
Ref: library/logging handlers logging handlers HTTPHandler mapLogRecord11572776
Ref: 321a11572776
Ref: library/logging handlers logging handlers HTTPHandler emit11573347
Ref: 321b11573347
Node: QueueHandler11574309
Ref: library/logging handlers queue-handler11574448
Ref: 321c11574448
Ref: library/logging handlers queuehandler11574448
Ref: 321d11574448
Ref: library/logging handlers logging handlers QueueHandler11575357
Ref: 1b6111575357
Ref: library/logging handlers logging handlers QueueHandler emit11576755
Ref: 322011576755
Ref: library/logging handlers logging handlers QueueHandler prepare11577264
Ref: 322111577264
Ref: library/logging handlers logging handlers QueueHandler enqueue11580113
Ref: 321e11580113
Ref: library/logging handlers logging handlers QueueHandler listener11580441
Ref: 31c111580441
Node: QueueListener11580736
Ref: library/logging handlers queue-listener11580855
Ref: 322211580855
Ref: library/logging handlers queuelistener11580855
Ref: 322311580855
Ref: library/logging handlers logging handlers QueueListener11582044
Ref: 24211582044
Ref: library/logging handlers logging handlers QueueListener dequeue11584008
Ref: 322411584008
Ref: library/logging handlers logging handlers QueueListener prepare11584454
Ref: 322511584454
Ref: library/logging handlers logging handlers QueueListener handle11584906
Ref: 322611584906
Ref: library/logging handlers logging handlers QueueListener start11585240
Ref: 24311585240
Ref: library/logging handlers logging handlers QueueListener stop11585604
Ref: 322711585604
Ref: library/logging handlers logging handlers QueueListener enqueue_sentinel11586014
Ref: 322811586014
Node: platform --- 実行中プラットフォームの固有情報を参照する11586678
Ref: library/platform doc11586961
Ref: 322911586961
Ref: library/platform module-platform11586961
Ref: af11586961
Ref: library/platform platform-access-to-underlying-platform-s-identifying-data11586961
Ref: 322a11586961
Ref: library/platform translation-repo11586961
Ref: 322b11586961
Ref: platform --- 実行中プラットフォームの固有情報を参照する-Footnote-111587669
Node: Cross platform11587737
Ref: library/platform cross-platform11587886
Ref: 322c11587886
Ref: library/platform platform architecture11587935
Ref: 1a0611587935
Ref: library/platform platform machine11589594
Ref: 322d11589594
Ref: library/platform platform node11589837
Ref: 322e11589837
Ref: library/platform platform platform11590054
Ref: 1ac611590054
Ref: library/platform platform processor11591260
Ref: 323011591260
Ref: library/platform platform python_build11591650
Ref: 323111591650
Ref: library/platform platform python_compiler11591800
Ref: 323211591800
Ref: library/platform platform python_branch11591956
Ref: 323311591956
Ref: library/platform platform python_implementation11592119
Ref: 323411592119
Ref: library/platform platform python_revision11592315
Ref: 323511592315
Ref: library/platform platform python_version11592483
Ref: 323611592483
Ref: library/platform platform python_version_tuple11592752
Ref: 323711592752
Ref: library/platform platform release11593041
Ref: 323811593041
Ref: library/platform platform system11593233
Ref: 226711593233
Ref: library/platform platform system_alias11593668
Ref: 322f11593668
Ref: library/platform platform version11593956
Ref: 323911593956
Ref: library/platform platform uname11594281
Ref: 1e1311594281
Ref: library/platform platform invalidate_caches11595106
Ref: 27d11595106
Node: Java platform11595425
Ref: library/platform java-platform11595599
Ref: 323a11595599
Ref: library/platform platform java_ver11595646
Ref: 32c11595646
Node: Windows platform11596302
Ref: library/platform windows-platform11596476
Ref: 323b11596476
Ref: library/platform platform win32_ver11596529
Ref: 1d4a11596529
Ref: library/platform platform win32_edition11597358
Ref: 323c11597358
Ref: library/platform platform win32_is_iot11597689
Ref: 323d11597689
Node: macOS platform11597916
Ref: library/platform macos-platform11598089
Ref: 323e11598089
Ref: library/platform platform mac_ver11598138
Ref: 1e1511598138
Node: iOS platform11598536
Ref: library/platform ios-platform11598707
Ref: 323f11598707
Ref: library/platform platform ios_ver11598752
Ref: 226611598752
Node: Unix platforms11599717
Ref: library/platform unix-platforms11599889
Ref: 324011599889
Ref: library/platform platform libc_ver11599938
Ref: 17f511599938
Node: Linux platforms11600733
Ref: library/platform linux-platforms11600909
Ref: 324111600909
Ref: library/platform platform freedesktop_os_release11600960
Ref: a2711600960
Ref: Linux platforms-Footnote-111602453
Node: Android platform11602526
Ref: library/platform android-platform11602724
Ref: 324211602724
Ref: library/platform platform android_ver11602777
Ref: 19c611602777
Ref: Android platform-Footnote-111603956
Ref: Android platform-Footnote-211604035
Ref: Android platform-Footnote-311604106
Ref: Android platform-Footnote-411604178
Node: コマンドラインでの使用<3>11604252
Ref: library/platform command-line-usage11604426
Ref: 324311604426
Ref: library/platform platform-cli11604426
Ref: 324411604426
Ref: library/platform cmdoption-platform-terse11604722
Ref: 324511604722
Ref: library/platform cmdoption-platform-nonaliased11604912
Ref: 324611604912
Node: errno --- 標準の errno システムシンボル11605306
Ref: library/errno doc11605592
Ref: 324711605592
Ref: library/errno errno-standard-errno-system-symbols11605592
Ref: 324811605592
Ref: library/errno module-errno11605592
Ref: 5b11605592
Ref: library/errno translation-repo11605592
Ref: 324911605592
Ref: library/errno errno errorcode11606090
Ref: 324a11606090
Ref: library/errno errno EPERM11606829
Ref: 1b5611606829
Ref: library/errno errno ENOENT11606960
Ref: 270911606960
Ref: library/errno errno ESRCH11607096
Ref: 270d11607096
Ref: library/errno errno EINTR11607223
Ref: f8711607223
Ref: library/errno errno EIO11607355
Ref: 324b11607355
Ref: library/errno errno ENXIO11607419
Ref: 324c11607419
Ref: library/errno errno E2BIG11607556
Ref: 324d11607556
Ref: library/errno errno ENOEXEC11607644
Ref: 324e11607644
Ref: library/errno errno EBADF11607740
Ref: b5411607740
Ref: library/errno errno ECHILD11607835
Ref: 270211607835
Ref: library/errno errno EAGAIN11607965
Ref: 26fd11607965
Ref: library/errno errno ENOMEM11608083
Ref: 324f11608083
Ref: library/errno errno EACCES11608168
Ref: 270c11608168
Ref: library/errno errno EFAULT11608294
Ref: 325011608294
Ref: library/errno errno ENOTBLK11608371
Ref: 325111608371
Ref: library/errno errno EBUSY11608471
Ref: 325211608471
Ref: library/errno errno EEXIST11608589
Ref: 270811608589
Ref: library/errno errno EXDEV11608710
Ref: 303a11608710
Ref: library/errno errno ENODEV11608807
Ref: 325311608807
Ref: library/errno errno ENOTDIR11608905
Ref: 270b11608905
Ref: library/errno errno EISDIR11609034
Ref: 270a11609034
Ref: library/errno errno EINVAL11609160
Ref: 1dd211609160
Ref: library/errno errno ENFILE11609236
Ref: 325411609236
Ref: library/errno errno EMFILE11609354
Ref: 325511609354
Ref: library/errno errno ENOTTY11609454
Ref: 325611609454
Ref: library/errno errno ETXTBSY11609548
Ref: 325711609548
Ref: library/errno errno EFBIG11609644
Ref: 325811609644
Ref: library/errno errno ENOSPC11609729
Ref: 325911609729
Ref: library/errno errno ESPIPE11609833
Ref: 325a11609833
Ref: library/errno errno EROFS11609908
Ref: 325b11609908
Ref: library/errno errno EMLINK11610021
Ref: 325c11610021
Ref: library/errno errno EPIPE11610101
Ref: 270311610101
Ref: library/errno errno EDOM11610221
Ref: 325d11610221
Ref: library/errno errno ERANGE11610352
Ref: 325e11610352
Ref: library/errno errno EDEADLK11610479
Ref: 325f11610479
Ref: library/errno errno ENAMETOOLONG11610596
Ref: 326011610596
Ref: library/errno errno ENOLCK11610692
Ref: 326111610692
Ref: library/errno errno ENOSYS11610807
Ref: 1b5711610807
Ref: library/errno errno ENOTEMPTY11610906
Ref: 326211610906
Ref: library/errno errno ELOOP11611012
Ref: 326311611012
Ref: library/errno errno EWOULDBLOCK11611153
Ref: 26ff11611153
Ref: library/errno errno ENOMSG11611288
Ref: 326411611288
Ref: library/errno errno EIDRM11611407
Ref: 326511611407
Ref: library/errno errno ECHRNG11611496
Ref: 326611611496
Ref: library/errno errno EL2NSYNC11611607
Ref: 326711611607
Ref: library/errno errno EL3HLT11611717
Ref: 326811611717
Ref: library/errno errno EL3RST11611803
Ref: 326911611803
Ref: library/errno errno ELNRNG11611894
Ref: 326a11611894
Ref: library/errno errno EUNATCH11612002
Ref: 326b11612002
Ref: library/errno errno ENOCSI11612132
Ref: 326c11612132
Ref: library/errno errno EL2HLT11612228
Ref: 326d11612228
Ref: library/errno errno EBADE11612314
Ref: 326e11612314
Ref: library/errno errno EBADR11612389
Ref: 326f11612389
Ref: library/errno errno EXFULL11612483
Ref: 327011612483
Ref: library/errno errno ENOANO11612568
Ref: 327111612568
Ref: library/errno errno EBADRQC11612639
Ref: 327211612639
Ref: library/errno errno EBADSLT11612738
Ref: 327311612738
Ref: library/errno errno EDEADLOCK11612817
Ref: 327411612817
Ref: library/errno errno EBFONT11612957
Ref: 327511612957
Ref: library/errno errno ENOSTR11613070
Ref: 327611613070
Ref: library/errno errno ENODATA11613173
Ref: 327711613173
Ref: library/errno errno ETIME11613272
Ref: 327811613272
Ref: library/errno errno ENOSR11613341
Ref: 327911613341
Ref: library/errno errno ENONET11613454
Ref: 327a11613454
Ref: library/errno errno ENOPKG11613573
Ref: 327b11613573
Ref: library/errno errno EREMOTE11613690
Ref: 327c11613690
Ref: library/errno errno ENOLINK11613779
Ref: 327d11613779
Ref: library/errno errno EADV11613870
Ref: 327e11613870
Ref: library/errno errno ESRMNT11613947
Ref: 327f11613947
Ref: library/errno errno ECOMM11614022
Ref: 328011614022
Ref: library/errno errno EPROTO11614120
Ref: 328111614120
Ref: library/errno errno EMULTIHOP11614203
Ref: 328211614203
Ref: library/errno errno EDOTDOT11614296
Ref: 328311614296
Ref: library/errno errno EBADMSG11614382
Ref: 328411614382
Ref: library/errno errno EOVERFLOW11614485
Ref: 328511614485
Ref: library/errno errno ENOTUNIQ11614632
Ref: 328611614632
Ref: library/errno errno EBADFD11614756
Ref: 328711614756
Ref: library/errno errno EREMCHG11614868
Ref: 328811614868
Ref: library/errno errno ELIBACC11614975
Ref: 328911614975
Ref: library/errno errno ELIBBAD11615118
Ref: 328a11615118
Ref: library/errno errno ELIBSCN11615259
Ref: 328b11615259
Ref: library/errno errno ELIBMAX11615386
Ref: 328c11615386
Ref: library/errno errno ELIBEXEC11615538
Ref: 328d11615538
Ref: library/errno errno EILSEQ11615687
Ref: 328e11615687
Ref: library/errno errno ERESTART11615774
Ref: 328f11615774
Ref: library/errno errno ESTRPIPE11615935
Ref: 329011615935
Ref: library/errno errno EUSERS11616036
Ref: 329111616036
Ref: library/errno errno ENOTSOCK11616116
Ref: 329211616116
Ref: library/errno errno EDESTADDRREQ11616238
Ref: 329311616238
Ref: library/errno errno EMSGSIZE11616344
Ref: 329411616344
Ref: library/errno errno EPROTOTYPE11616434
Ref: 329511616434
Ref: library/errno errno ENOPROTOOPT11616569
Ref: 329611616569
Ref: library/errno errno EPROTONOSUPPORT11616674
Ref: 329711616674
Ref: library/errno errno ESOCKTNOSUPPORT11616795
Ref: 329811616795
Ref: library/errno errno EOPNOTSUPP11616919
Ref: 329911616919
Ref: library/errno errno ENOTSUP11617078
Ref: 329a11617078
Ref: library/errno errno EPFNOSUPPORT11617166
Ref: 329b11617166
Ref: library/errno errno EAFNOSUPPORT11617308
Ref: 329c11617308
Ref: library/errno errno EADDRINUSE11617476
Ref: 329d11617476
Ref: library/errno errno EADDRNOTAVAIL11617571
Ref: 329e11617571
Ref: library/errno errno ENETDOWN11617710
Ref: 329f11617710
Ref: library/errno errno ENETUNREACH11617811
Ref: 1de911617811
Ref: library/errno errno ENETRESET11617919
Ref: 32a011617919
Ref: library/errno errno ECONNABORTED11618078
Ref: 270511618078
Ref: library/errno errno ECONNRESET11618233
Ref: 270711618233
Ref: library/errno errno ENOBUFS11618376
Ref: 1b7111618376
Ref: library/errno errno EISCONN11618480
Ref: 32a111618480
Ref: library/errno errno ENOTCONN11618612
Ref: 32a211618612
Ref: library/errno errno ESHUTDOWN11618730
Ref: 270411618730
Ref: library/errno errno ETOOMANYREFS11618888
Ref: 32a311618888
Ref: library/errno errno ETIMEDOUT11619019
Ref: 270e11619019
Ref: library/errno errno ECONNREFUSED11619148
Ref: 270611619148
Ref: library/errno errno EHOSTDOWN11619289
Ref: 32a411619289
Ref: library/errno errno EHOSTUNREACH11619391
Ref: 32a511619391
Ref: library/errno errno EHWPOISON11619491
Ref: 20b11619491
Ref: library/errno errno EALREADY11619590
Ref: 26fe11619590
Ref: library/errno errno EINPROGRESS11619730
Ref: 270011619730
Ref: library/errno errno ESTALE11619869
Ref: 32a611619869
Ref: library/errno errno EUCLEAN11619973
Ref: 32a711619973
Ref: library/errno errno ENOTNAM11620079
Ref: 32a811620079
Ref: library/errno errno ENAVAIL11620197
Ref: 32a911620197
Ref: library/errno errno EISNAM11620308
Ref: 32aa11620308
Ref: library/errno errno EREMOTEIO11620397
Ref: 32ab11620397
Ref: library/errno errno EDQUOT11620487
Ref: 32ac11620487
Ref: library/errno errno EQFULL11620582
Ref: 32ad11620582
Ref: library/errno errno ENOMEDIUM11620677
Ref: 32ae11620677
Ref: library/errno errno EMEDIUMTYPE11620731
Ref: 32af11620731
Ref: library/errno errno ENOKEY11620789
Ref: 32b011620789
Ref: library/errno errno EKEYEXPIRED11620851
Ref: 32b111620851
Ref: library/errno errno EKEYREVOKED11620907
Ref: 32b211620907
Ref: library/errno errno EKEYREJECTED11620968
Ref: 32b311620968
Ref: library/errno errno ERFKILL11621037
Ref: 32b411621037
Ref: library/errno errno ELOCKUNMAPPED11621111
Ref: 32b511621111
Ref: library/errno errno ENOTACTIVE11621178
Ref: 32b611621178
Ref: library/errno errno EAUTH11621240
Ref: 32b711621240
Ref: library/errno errno EBADARCH11621323
Ref: 32b811621323
Ref: library/errno errno EBADEXEC11621415
Ref: 32b911621415
Ref: library/errno errno EBADMACHO11621515
Ref: 32ba11621515
Ref: library/errno errno EDEVERR11621603
Ref: 32bb11621603
Ref: library/errno errno EFTYPE11621680
Ref: 32bc11621680
Ref: library/errno errno ENEEDAUTH11621777
Ref: 32bd11621777
Ref: library/errno errno ENOATTR11621862
Ref: 32be11621862
Ref: library/errno errno ENOPOLICY11621946
Ref: 32bf11621946
Ref: library/errno errno EPROCLIM11622029
Ref: 32c011622029
Ref: library/errno errno EPROCUNAVAIL11622113
Ref: 32c111622113
Ref: library/errno errno EPROGMISMATCH11622208
Ref: 32c211622208
Ref: library/errno errno EPROGUNAVAIL11622300
Ref: 32c311622300
Ref: library/errno errno EPWROFF11622390
Ref: 32c411622390
Ref: library/errno errno EBADRPC11622474
Ref: 32c511622474
Ref: library/errno errno ERPCMISMATCH11622556
Ref: 32c611622556
Ref: library/errno errno ESHLIBVERS11622643
Ref: 32c711622643
Ref: library/errno errno ENOTCAPABLE11622742
Ref: 1b3f11622742
Ref: library/errno errno ECANCELED11622959
Ref: 17c211622959
Ref: library/errno errno EOWNERDEAD11623044
Ref: 32c811623044
Ref: library/errno errno ENOTRECOVERABLE11623122
Ref: 32c911623122
Node: ctypes --- Python 用の外部関数ライブラリ11623216
Ref: library/ctypes doc11623417
Ref: 32ca11623417
Ref: library/ctypes ctypes-a-foreign-function-library-for-python11623417
Ref: 32cb11623417
Ref: library/ctypes module-ctypes11623417
Ref: 2e11623417
Ref: library/ctypes translation-repo11623417
Ref: 32cc11623417
Ref: ctypes --- Python 用の外部関数ライブラリ-Footnote-111624215
Node: ctypes チュートリアル11624278
Ref: library/ctypes ctypes-ctypes-tutorial11624427
Ref: 32cd11624427
Ref: library/ctypes ctypes-tutorial11624427
Ref: 32ce11624427
Node: 動的リンクライブラリをロードする11626316
Ref: library/ctypes ctypes-loading-dynamic-link-libraries11626489
Ref: 32d111626489
Ref: library/ctypes loading-dynamic-link-libraries11626489
Ref: 32d211626489
Node: ロードしたdllから関数にアクセスする11628796
Ref: library/ctypes accessing-functions-from-loaded-dlls11628999
Ref: 32d411628999
Ref: library/ctypes ctypes-accessing-functions-from-loaded-dlls11628999
Ref: 32d511628999
Node: 関数を呼び出す11631530
Ref: library/ctypes calling-functions11631703
Ref: 32d611631703
Ref: library/ctypes ctypes-calling-functions11631703
Ref: 32d711631703
Node: 基本データ型11634211
Ref: library/ctypes ctypes-fundamental-data-types11634360
Ref: 32d811634360
Ref: library/ctypes fundamental-data-types11634360
Ref: 32d911634360
Node: 続・関数を呼び出す11646044
Ref: library/ctypes calling-functions-continued11646198
Ref: 32ee11646198
Ref: library/ctypes ctypes-calling-functions-continued11646198
Ref: 32ef11646198
Node: Calling variadic functions11647360
Ref: library/ctypes calling-variadic-functions11647550
Ref: 32f011647550
Ref: library/ctypes ctypes-calling-variadic-functions11647550
Ref: 32f111647550
Node: 自作のデータ型とともに関数を呼び出す11648245
Ref: library/ctypes calling-functions-with-your-own-custom-data-types11648475
Ref: 32f211648475
Ref: library/ctypes ctypes-calling-functions-with-own-custom-data-types11648475
Ref: 32f311648475
Node: 要求される引数の型を指定する 関数プロトタイプ11649364
Ref: library/ctypes ctypes-specifying-required-argument-types11649583
Ref: 32f411649583
Ref: library/ctypes specifying-the-required-argument-types-function-prototypes11649583
Ref: 32f511649583
Node: 戻り値の型11651498
Ref: library/ctypes ctypes-return-types11651727
Ref: 32f711651727
Ref: library/ctypes return-types11651727
Ref: 32f811651727
Node: ポインタを渡す または、パラメータの参照渡し11654966
Ref: library/ctypes ctypes-passing-pointers11655149
Ref: 32fc11655149
Ref: library/ctypes passing-pointers-or-passing-parameters-by-reference11655149
Ref: 32fd11655149
Node: 構造体と共用体11656363
Ref: library/ctypes ctypes-structures-unions11656578
Ref: 32ff11656578
Ref: library/ctypes structures-and-unions11656578
Ref: 330011656578
Ref: library/ctypes ctypes-structureunion-alignment-byte-order11658845
Ref: 330111658845
Node: Structure/union layout alignment and byte order11659165
Ref: library/ctypes structure-union-layout-alignment-and-byte-order11659373
Ref: 330211659373
Node: 構造体と共用体におけるビットフィールド11660325
Ref: library/ctypes bit-fields-in-structures-and-unions11660521
Ref: 330511660521
Ref: library/ctypes ctypes-bit-fields-in-structures-unions11660521
Ref: 1e411660521
Node: 配列<2>11661548
Ref: library/ctypes arrays11661709
Ref: 330611661709
Ref: library/ctypes ctypes-arrays11661709
Ref: 330711661709
Node: ポインタ11663140
Ref: library/ctypes ctypes-pointers11663273
Ref: 330811663273
Ref: library/ctypes pointers11663273
Ref: 330911663273
Node: Thread safety without the GIL11666249
Ref: library/ctypes ctypes-thread-safety11666382
Ref: 330b11666382
Ref: library/ctypes thread-safety-without-the-gil11666382
Ref: 330c11666382
Node: 型変換11667390
Ref: library/ctypes ctypes-type-conversions11667523
Ref: 330d11667523
Ref: library/ctypes type-conversions11667523
Ref: 330e11667523
Node: 不完全型11670362
Ref: library/ctypes ctypes-incomplete-types11670490
Ref: 31811670490
Ref: library/ctypes incomplete-types11670490
Ref: 331011670490
Node: コールバック関数11672186
Ref: library/ctypes callback-functions11672365
Ref: 331111672365
Ref: library/ctypes ctypes-callback-functions11672365
Ref: 331211672365
Node: dllからエクスポートされた値へアクセスする11676721
Ref: library/ctypes accessing-values-exported-from-dlls11676906
Ref: 331511676906
Ref: library/ctypes ctypes-accessing-values-exported-from-dlls11676906
Ref: 331611676906
Node: びっくり仰天11680128
Ref: library/ctypes ctypes-surprises11680319
Ref: 331911680319
Ref: library/ctypes surprises11680319
Ref: 331a11680319
Node: 可変サイズのデータ型11683046
Ref: library/ctypes ctypes-variable-sized-data-types11683168
Ref: 331b11683168
Ref: library/ctypes variable-sized-data-types11683168
Ref: 331c11683168
Node: ctypesリファレンス11684793
Ref: library/ctypes ctypes-ctypes-reference11684942
Ref: 331e11684942
Ref: library/ctypes ctypes-reference11684942
Ref: 331f11684942
Node: 共有ライブラリを見つける11685371
Ref: library/ctypes ctypes-finding-shared-libraries11685508
Ref: 332011685508
Ref: library/ctypes finding-shared-libraries11685508
Ref: 332111685508
Node: Listing loaded shared libraries11688560
Ref: library/ctypes ctypes-listing-loaded-shared-libraries11688745
Ref: 332211688745
Ref: library/ctypes listing-loaded-shared-libraries11688745
Ref: 332311688745
Node: 共有ライブラリをロードする11689634
Ref: library/ctypes ctypes-loading-shared-libraries11689795
Ref: 332411689795
Ref: library/ctypes loading-shared-libraries11689795
Ref: 332511689795
Ref: library/ctypes ctypes CDLL11690072
Ref: bdc11690072
Ref: library/ctypes ctypes OleDLL11691270
Ref: 1ae211691270
Ref: library/ctypes ctypes WinDLL11692153
Ref: 1ae311692153
Ref: library/ctypes ctypes PyDLL11692807
Ref: 1ae411692807
Ref: library/ctypes ctypes PyDLL _handle11697301
Ref: 332b11697301
Ref: library/ctypes ctypes PyDLL _name11697416
Ref: 332c11697416
Ref: library/ctypes ctypes LibraryLoader11697778
Ref: 332d11697778
Ref: library/ctypes ctypes LibraryLoader LoadLibrary11698286
Ref: 32d311698286
Ref: 共有ライブラリをロードする-Footnote-111700156
Ref: 共有ライブラリをロードする-Footnote-211700222
Node: 外部関数11700268
Ref: library/ctypes ctypes-foreign-functions11700422
Ref: 332e11700422
Ref: library/ctypes foreign-functions11700422
Ref: 332f11700422
Ref: library/ctypes ctypes _CFuncPtr11701104
Ref: 18d211701104
Ref: library/ctypes ctypes _CFuncPtr restype11701517
Ref: 32f911701517
Ref: library/ctypes ctypes _CFuncPtr argtypes11702216
Ref: 17c111702216
Ref: library/ctypes ctypes _CFuncPtr errcheck11703457
Ref: 32fb11703457
Node: 関数プロトタイプ11705281
Ref: library/ctypes ctypes-function-prototypes11705426
Ref: 333011705426
Ref: library/ctypes function-prototypes11705426
Ref: 333111705426
Ref: library/ctypes ctypes CFUNCTYPE11706140
Ref: 331311706140
Ref: library/ctypes ctypes WINFUNCTYPE11706717
Ref: 331411706717
Ref: library/ctypes ctypes PYFUNCTYPE11707099
Ref: 333211707099
Node: ユーティリティー関数11713440
Ref: library/ctypes ctypes-utility-functions11713588
Ref: 333311713588
Ref: library/ctypes utility-functions11713588
Ref: 333411713588
Ref: library/ctypes ctypes addressof11713661
Ref: 333511713661
Ref: library/ctypes ctypes alignment11713978
Ref: 333611713978
Ref: library/ctypes ctypes byref11714190
Ref: 32fe11714190
Ref: library/ctypes ctypes CopyComPointer11714835
Ref: 1ea11714835
Ref: library/ctypes ctypes cast11715431
Ref: 330f11715431
Ref: library/ctypes ctypes create_string_buffer11715817
Ref: 32ed11715817
Ref: library/ctypes ctypes create_unicode_buffer11717375
Ref: 1db411717375
Ref: library/ctypes ctypes DllCanUnloadNow11717971
Ref: 333711717971
Ref: library/ctypes ctypes DllGetClassObject11718244
Ref: 333811718244
Ref: library/ctypes ctypes util find_library11718527
Ref: f4511718527
Ref: library/ctypes ctypes util find_msvcrt11719155
Ref: 333911719155
Ref: library/ctypes ctypes util dllist11719682
Ref: 1f011719682
Ref: library/ctypes ctypes FormatError11720257
Ref: 333a11720257
Ref: library/ctypes ctypes GetLastError11720538
Ref: 32fa11720538
Ref: library/ctypes ctypes get_errno11720834
Ref: 332711720834
Ref: library/ctypes ctypes get_last_error11721105
Ref: 332911721105
Ref: library/ctypes ctypes memmove11721423
Ref: 333b11721423
Ref: library/ctypes ctypes memset11721746
Ref: 333c11721746
Ref: library/ctypes ctypes POINTER11722094
Ref: 1f111722094
Ref: library/ctypes ctypes pointer11722756
Ref: 1a5611722756
Ref: library/ctypes ctypes resize11723096
Ref: 331d11723096
Ref: library/ctypes ctypes set_errno11723523
Ref: 332811723523
Ref: library/ctypes ctypes set_last_error11723879
Ref: 332a11723879
Ref: library/ctypes ctypes sizeof11724263
Ref: 333d11724263
Ref: library/ctypes ctypes string_at11724484
Ref: 1ec11724484
Ref: library/ctypes ctypes WinError11724797
Ref: 333e11724797
Ref: library/ctypes ctypes wstring_at11725312
Ref: 333f11725312
Ref: library/ctypes ctypes memoryview_at11725671
Ref: 1eb11725671
Node: データ型<3>11726641
Ref: library/ctypes ctypes-data-types11726786
Ref: 334111726786
Ref: library/ctypes data-types11726786
Ref: 334211726786
Ref: library/ctypes ctypes _CData11726829
Ref: 334311726829
Ref: library/ctypes ctypes _CData from_buffer11727676
Ref: 334511727676
Ref: library/ctypes ctypes _CData from_buffer_copy11728499
Ref: 334611728499
Ref: library/ctypes ctypes _CData from_address11729207
Ref: 334011729207
Ref: library/ctypes ctypes _CData from_param11729637
Ref: 32f611729637
Ref: library/ctypes ctypes _CData in_dll11730275
Ref: 331711730275
Ref: library/ctypes ctypes _CData __pointer_type__11730675
Ref: 1f211730675
Ref: library/ctypes ctypes _CData _b_base_11731007
Ref: 334711731007
Ref: library/ctypes ctypes _CData _b_needsfree_11731408
Ref: 334811731408
Ref: library/ctypes ctypes _CData _objects11731702
Ref: 334411731702
Node: 基本データ型<2>11732130
Ref: library/ctypes ctypes-fundamental-data-types-211732266
Ref: 334911732266
Ref: library/ctypes id111732266
Ref: 334a11732266
Ref: library/ctypes ctypes _SimpleCData11732319
Ref: 334b11732319
Ref: library/ctypes ctypes _SimpleCData value11732914
Ref: 334c11732914
Ref: library/ctypes ctypes c_byte11734341
Ref: 1ae011734341
Ref: library/ctypes ctypes c_char11734618
Ref: 32db11734618
Ref: library/ctypes ctypes c_char_p11734905
Ref: 1a5711734905
Ref: library/ctypes ctypes c_double11735325
Ref: 1cb811735325
Ref: library/ctypes ctypes c_longdouble11735505
Ref: 1cb911735505
Ref: library/ctypes ctypes c_float11735830
Ref: 32ec11735830
Ref: library/ctypes ctypes c_double_complex11736008
Ref: 1ee11736008
Ref: library/ctypes ctypes c_float_complex11736214
Ref: 1ed11736214
Ref: library/ctypes ctypes c_longdouble_complex11736418
Ref: 1ef11736418
Ref: library/ctypes ctypes c_int11736633
Ref: 32cf11736633
Ref: library/ctypes ctypes c_int811736988
Ref: 32df11736988
Ref: library/ctypes ctypes c_int1611737113
Ref: 32e011737113
Ref: library/ctypes ctypes c_int3211737264
Ref: 32e111737264
Ref: library/ctypes ctypes c_int6411737413
Ref: 32e211737413
Ref: library/ctypes ctypes c_long11737567
Ref: 32d011737567
Ref: library/ctypes ctypes c_longlong11737798
Ref: 32e911737798
Ref: library/ctypes ctypes c_short11738044
Ref: 32dd11738044
Ref: library/ctypes ctypes c_size_t11738277
Ref: 32eb11738277
Ref: library/ctypes ctypes c_ssize_t11738361
Ref: 145411738361
Ref: library/ctypes ctypes c_time_t11738475
Ref: 1b6311738475
Ref: library/ctypes ctypes c_ubyte11738582
Ref: 1ae111738582
Ref: library/ctypes ctypes c_uint11738867
Ref: 32e311738867
Ref: library/ctypes ctypes c_uint811739239
Ref: 32e411739239
Ref: library/ctypes ctypes c_uint1611739368
Ref: 32e511739368
Ref: library/ctypes ctypes c_uint3211739523
Ref: 32e611739523
Ref: library/ctypes ctypes c_uint6411739676
Ref: 32e711739676
Ref: library/ctypes ctypes c_ulong11739834
Ref: 32e811739834
Ref: library/ctypes ctypes c_ulonglong11740068
Ref: 32ea11740068
Ref: library/ctypes ctypes c_ushort11740317
Ref: 32de11740317
Ref: library/ctypes ctypes c_void_p11740553
Ref: 1a5911740553
Ref: library/ctypes ctypes c_wchar11740759
Ref: 32dc11740759
Ref: library/ctypes ctypes c_wchar_p11741083
Ref: 1a5811741083
Ref: library/ctypes ctypes c_bool11741341
Ref: 32da11741341
Ref: library/ctypes ctypes HRESULT11741620
Ref: 332611741620
Ref: library/ctypes ctypes py_object11741812
Ref: 1f311741812
Node: 構造化データ型11742325
Ref: library/ctypes ctypes-structured-data-types11742467
Ref: 334d11742467
Ref: library/ctypes structured-data-types11742467
Ref: 334e11742467
Ref: library/ctypes ctypes Union11742525
Ref: 1e611742525
Ref: library/ctypes ctypes BigEndianUnion11742793
Ref: 1bb711742793
Ref: library/ctypes ctypes LittleEndianUnion11742992
Ref: 1bb811742992
Ref: library/ctypes ctypes BigEndianStructure11743194
Ref: 330311743194
Ref: library/ctypes ctypes LittleEndianStructure11743368
Ref: 330411743368
Ref: library/ctypes ctypes Structure11743786
Ref: 1e511743786
Ref: library/ctypes ctypes Structure _fields_11744247
Ref: 193611744247
Ref: library/ctypes ctypes Structure _pack_11746464
Ref: 31711746464
Ref: library/ctypes ctypes Structure _align_11747550
Ref: 4e811747550
Ref: library/ctypes ctypes Structure _layout_11748383
Ref: 1e711748383
Ref: library/ctypes ctypes Structure _anonymous_11749668
Ref: 334f11749668
Ref: library/ctypes ctypes CField11752441
Ref: 1e811752441
Ref: library/ctypes ctypes CField name11753606
Ref: 335011753606
Ref: library/ctypes ctypes CField type11753675
Ref: 335111753675
Ref: library/ctypes ctypes CField offset11753762
Ref: 335211753762
Ref: library/ctypes ctypes CField byte_offset11753789
Ref: 335311753789
Ref: library/ctypes ctypes CField byte_size11753994
Ref: 335511753994
Ref: library/ctypes ctypes CField size11754219
Ref: 335611754219
Ref: library/ctypes ctypes CField is_bitfield11754533
Ref: 335811754533
Ref: library/ctypes ctypes CField bit_offset11754605
Ref: 335411754605
Ref: library/ctypes ctypes CField bit_size11754636
Ref: 335711754636
Ref: library/ctypes ctypes CField is_anonymous11755150
Ref: 335911755150
Node: 配列とポインタ11755347
Ref: library/ctypes arrays-and-pointers11755478
Ref: 335a11755478
Ref: library/ctypes ctypes-arrays-pointers11755478
Ref: 335b11755478
Ref: library/ctypes ctypes Array11755536
Ref: 1e0c11755536
Ref: library/ctypes ctypes Array _length_11756066
Ref: 335c11756066
Ref: library/ctypes ctypes Array _type_11756319
Ref: 335d11756319
Ref: library/ctypes ctypes ARRAY11756567
Ref: 59e11756567
Ref: library/ctypes ctypes _Pointer11756859
Ref: 335e11756859
Ref: library/ctypes ctypes _Pointer _type_11757751
Ref: 185011757751
Ref: library/ctypes ctypes _Pointer contents11757833
Ref: 330a11757833
Node: 例外<10>11758066
Ref: library/ctypes ctypes-exceptions11758167
Ref: 335f11758167
Ref: library/ctypes exceptions11758167
Ref: 336011758167
Ref: library/ctypes ctypes ArgumentError11758200
Ref: 336111758200
Ref: library/ctypes ctypes COMError11758364
Ref: 1e911758364
Ref: library/ctypes ctypes COMError hresult11758480
Ref: 336211758480
Ref: library/ctypes ctypes COMError text11758567
Ref: 336311758567
Ref: library/ctypes ctypes COMError details11758623
Ref: 336411758623
Node: コマンドラインインターフェースライブラリ11759146
Ref: library/cmdlinelibs doc11759355
Ref: 336511759355
Ref: library/cmdlinelibs cmdlinelibs11759355
Ref: 336611759355
Ref: library/cmdlinelibs command-line-interface-libraries11759355
Ref: 336711759355
Ref: library/cmdlinelibs translation-repo11759355
Ref: 336811759355
Node: argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー11760869
Ref: library/argparse doc11761119
Ref: 336911761119
Ref: library/argparse argparse-parser-for-command-line-options-arguments-and-subcommands11761119
Ref: 336a11761119
Ref: library/argparse module-argparse11761119
Ref: 711761119
Ref: argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー-Footnote-111764433
Node: ArgumentParser オブジェクト11764501
Ref: library/argparse argumentparser-objects11764705
Ref: 336f11764705
Ref: library/argparse argparse ArgumentParser11764786
Ref: 1bd11764786
Node: prog11768377
Ref: library/argparse id111768465
Ref: 337d11768465
Ref: library/argparse prog11768465
Ref: 1bc11768465
Node: usage11770196
Ref: library/argparse usage11770304
Ref: 337011770304
Node: description11771371
Ref: library/argparse description11771481
Ref: 337111771481
Ref: library/argparse id211771481
Ref: 337e11771481
Node: epilog11772054
Ref: library/argparse epilog11772166
Ref: 337211772166
Node: parents11772962
Ref: library/argparse parents11773078
Ref: 337311773078
Node: formatter_class11774829
Ref: library/argparse formatter-class11774951
Ref: 337411774951
Ref: library/argparse id311774951
Ref: 337f11774951
Ref: library/argparse argparse RawDescriptionHelpFormatter11775242
Ref: 338011775242
Ref: library/argparse argparse RawTextHelpFormatter11775294
Ref: 338111775294
Ref: library/argparse argparse ArgumentDefaultsHelpFormatter11775339
Ref: 1c5011775339
Ref: library/argparse argparse MetavarTypeHelpFormatter11775393
Ref: 338211775393
Node: prefix_chars11778872
Ref: library/argparse prefix-chars11779008
Ref: 337511779008
Node: fromfile_prefix_chars11779781
Ref: library/argparse fromfile-prefix-chars11779918
Ref: 337611779918
Node: argument_default11782019
Ref: library/argparse argument-default11782156
Ref: 337711782156
Node: allow_abbrev11783143
Ref: library/argparse allow-abbrev11783275
Ref: fbe11783275
Ref: library/argparse id411783275
Ref: 338711783275
Node: conflict_handler11783962
Ref: library/argparse conflict-handler11784086
Ref: 337811784086
Node: add_help11785909
Ref: library/argparse add-help11786034
Ref: 337911786034
Node: exit_on_error11787286
Ref: library/argparse exit-on-error11787411
Ref: 337a11787411
Node: suggest_on_error11788323
Ref: library/argparse suggest-on-error11788445
Ref: 337b11788445
Node: color11789923
Ref: library/argparse color11790023
Ref: 337c11790023
Ref: color-Footnote-111791248
Ref: color-Footnote-211791303
Node: add_argument メソッド11791333
Ref: library/argparse the-add-argument-method11791569
Ref: 338811791569
Ref: library/argparse argparse ArgumentParser add_argument11791642
Ref: 4bc11791642
Node: name または flags11793681
Ref: library/argparse id511793778
Ref: 338e11793778
Ref: library/argparse name-or-flags11793778
Ref: 338911793778
Node: action11795876
Ref: library/argparse action11795987
Ref: 192b11795987
Ref: library/argparse id611795987
Ref: 338f11795987
Node: nargs11802654
Ref: library/argparse id711802750
Ref: 339111802750
Ref: library/argparse nargs11802750
Ref: 193111802750
Node: const11806798
Ref: library/argparse const11806895
Ref: 193311806895
Ref: library/argparse id811806895
Ref: 339311806895
Node: default11808323
Ref: library/argparse default11808419
Ref: 193211808419
Ref: library/argparse id911808419
Ref: 339411808419
Node: type11811093
Ref: library/argparse argparse-type11811191
Ref: 339511811191
Ref: library/argparse type11811191
Ref: 338311811191
Node: choices11814820
Ref: library/argparse choices11814919
Ref: 192d11814919
Ref: library/argparse id1011814919
Ref: 339711814919
Node: required11817137
Ref: library/argparse id1111817236
Ref: 339811817236
Ref: library/argparse required11817236
Ref: 338a11817236
Node: help11818280
Ref: library/argparse help11818379
Ref: 338b11818379
Ref: library/argparse id1211818379
Ref: 339911818379
Node: metavar11820059
Ref: library/argparse id1311820154
Ref: 339a11820154
Ref: library/argparse metavar11820154
Ref: 338c11820154
Node: dest11822431
Ref: library/argparse dest11822532
Ref: 338411822532
Ref: library/argparse id1411822532
Ref: 339b11822532
Node: deprecated11824359
Ref: library/argparse deprecated11824469
Ref: 338d11824469
Ref: library/argparse id1511824469
Ref: 339c11824469
Node: Action クラス11825381
Ref: library/argparse action-classes11825478
Ref: 339d11825478
Ref: library/argparse argparse Action11825772
Ref: 1b8c11825772
Ref: library/argparse argparse Action __call__11826670
Ref: 339e11826670
Ref: library/argparse argparse Action format_usage11827970
Ref: 339f11827970
Ref: library/argparse argparse BooleanOptionalAction11828284
Ref: 1bf211828284
Node: parse_args メソッド11828878
Ref: library/argparse the-parse-args-method11829114
Ref: 33a011829114
Ref: library/argparse argparse ArgumentParser parse_args11829183
Ref: 336d11829183
Node: オプション値の文法11830223
Ref: library/argparse option-value-syntax11830334
Ref: 33a311830334
Node: 不正な引数11832024
Ref: library/argparse invalid-arguments11832161
Ref: 33a411832161
Node: - を含む引数11833190
Ref: library/argparse arguments-containing11833352
Ref: 33a511833352
Node: 引数の短縮形 先頭文字でのマッチング11835528
Ref: library/argparse argument-abbreviations-prefix-matching11835690
Ref: 33a611835690
Ref: library/argparse prefix-matching11835690
Ref: fbf11835690
Node: sys argv 以外11836725
Ref: library/argparse args11836898
Ref: 33a111836898
Ref: library/argparse beyond-sys-argv11836898
Ref: 33a711836898
Node: Namespace オブジェクト11837858
Ref: library/argparse namespace11837970
Ref: 33a211837970
Ref: library/argparse the-namespace-object11837970
Ref: 33a811837970
Ref: library/argparse argparse Namespace11838043
Ref: 336e11838043
Node: その他のユーティリティ11839332
Ref: library/argparse other-utilities11839553
Ref: 33a911839553
Node: Subcommands11839946
Ref: library/argparse subcommands11840063
Ref: 33aa11840063
Ref: library/argparse argparse ArgumentParser add_subparsers11840108
Ref: e1111840108
Node: FileType オブジェクト11850133
Ref: library/argparse filetype-objects11850277
Ref: 33ab11850277
Ref: library/argparse argparse FileType11850348
Ref: 30c11850348
Node: 引数グループ11852390
Ref: library/argparse argument-groups11852535
Ref: 33ac11852535
Ref: library/argparse argparse ArgumentParser add_argument_group11852588
Ref: 2eb11852588
Node: 相互排他11855493
Ref: library/argparse mutual-exclusion11855644
Ref: 33ad11855644
Ref: library/argparse argparse ArgumentParser add_mutually_exclusive_group11855687
Ref: 2ed11855687
Node: パーサーのデフォルト値11858435
Ref: library/argparse parser-defaults11858586
Ref: 33ae11858586
Ref: library/argparse argparse ArgumentParser set_defaults11858664
Ref: 338611858664
Ref: library/argparse argparse ArgumentParser get_default11860050
Ref: 33af11860050
Node: ヘルプの表示11860435
Ref: library/argparse printing-help11860586
Ref: 33b011860586
Ref: library/argparse argparse ArgumentParser print_usage11860910
Ref: 33b111860910
Ref: library/argparse argparse ArgumentParser print_help11861192
Ref: 33b211861192
Ref: library/argparse argparse ArgumentParser format_usage11861629
Ref: 1db011861629
Ref: library/argparse argparse ArgumentParser format_help11861836
Ref: 33b311861836
Node: 部分解析11862076
Ref: library/argparse partial-parsing11862233
Ref: 33b411862233
Ref: library/argparse argparse ArgumentParser parse_known_args11862276
Ref: 33b511862276
Node: ファイル解析のカスタマイズ11863531
Ref: library/argparse customizing-file-parsing11863688
Ref: 33b611863688
Ref: library/argparse argparse ArgumentParser convert_arg_line_to_args11863776
Ref: 338511863776
Node: 終了メソッド11864914
Ref: library/argparse exiting-methods11865086
Ref: 33b711865086
Ref: library/argparse argparse ArgumentParser exit11865139
Ref: 33b811865139
Ref: library/argparse argparse ArgumentParser error11865708
Ref: 33b911865708
Node: 混在した引数の解析11865913
Ref: library/argparse intermixed-parsing11866081
Ref: 33ba11866081
Ref: library/argparse argparse ArgumentParser parse_intermixed_args11866149
Ref: cf711866149
Ref: library/argparse argparse ArgumentParser parse_known_intermixed_args11866243
Ref: 33bb11866243
Node: Registering custom types or actions11868038
Ref: library/argparse registering-custom-types-or-actions11868179
Ref: 33bc11868179
Ref: library/argparse argparse ArgumentParser register11868272
Ref: 339011868272
Node: 例外<11>11869744
Ref: library/argparse exceptions11869933
Ref: 33bd11869933
Ref: library/argparse argparse ArgumentError11869966
Ref: 33be11869966
Ref: library/argparse argparse ArgumentTypeError11870263
Ref: 339611870263
Node: Argparse チュートリアル11870576
Ref: howto/argparse doc11870697
Ref: 33bf11870697
Ref: howto/argparse argparse-tutorial11870697
Ref: 336c11870697
Ref: howto/argparse id111870697
Ref: 33c011870697
Node: コンセプト11872042
Ref: howto/argparse concepts11872139
Ref: 33c111872139
Node: 基礎11874804
Ref: howto/argparse the-basics11874931
Ref: 33c211874931
Node: 位置引数の入門11876358
Ref: howto/argparse introducing-positional-arguments11876493
Ref: 33c311876493
Node: Optional引数の導入11880191
Ref: howto/argparse introducing-optional-arguments11880358
Ref: 33c411880358
Node: 短いオプション11883990
Ref: howto/argparse short-options11884071
Ref: 33c511884071
Node: 位置引数とOptional引数の併用11884982
Ref: howto/argparse combining-positional-and-optional-arguments11885158
Ref: 33c611885158
Node: もうちょっとだけ学ぶ11894208
Ref: howto/argparse getting-a-little-more-advanced11894400
Ref: 33c711894400
Node: 多義性のある引数の指定11896495
Ref: howto/argparse id211896631
Ref: 33c811896631
Ref: howto/argparse specifying-ambiguous-arguments11896631
Ref: 339211896631
Node: 競合するオプション11897677
Ref: howto/argparse conflicting-options11897813
Ref: 33c911897813
Node: argparse の出力を翻訳するには11901242
Ref: howto/argparse how-to-translate-the-argparse-output11901418
Ref: 33ca11901418
Ref: argparse の出力を翻訳するには-Footnote-111903581
Node: Custom type converters11903614
Ref: howto/argparse custom-type-converters11903766
Ref: 33cc11903766
Node: 結び11905528
Ref: howto/argparse conclusion11905632
Ref: 33cd11905632
Ref: howto/argparse-optparse upgrading-optparse-code11906040
Ref: 13c611906040
Node: Migrating optparse code to argparse11906040
Ref: howto/argparse-optparse doc11906161
Ref: 33ce11906161
Ref: howto/argparse-optparse migrating-optparse-code11906161
Ref: 33cf11906161
Ref: howto/argparse-optparse migrating-optparse-code-to-argparse11906161
Ref: 33d011906161
Ref: howto/argparse-optparse translation-repo11906161
Ref: 33d111906161
Node: optparse --- Parser for command line options11909539
Ref: library/optparse doc11909855
Ref: 33d711909855
Ref: library/optparse module-optparse11909855
Ref: a411909855
Ref: library/optparse optparse-parser-for-command-line-options11909855
Ref: 33d811909855
Ref: library/optparse translation-repo11909855
Ref: 33d911909855
Ref: optparse --- Parser for command line options-Footnote-111910379
Node: Choosing an argument parsing library11910447
Ref: library/optparse choosing-an-argument-parser11910588
Ref: 336b11910588
Ref: library/optparse choosing-an-argument-parsing-library11910588
Ref: 33da11910588
Ref: Choosing an argument parsing library-Footnote-111916197
Ref: Choosing an argument parsing library-Footnote-211916237
Ref: Choosing an argument parsing library-Footnote-311916277
Node: はじめに<7>11916325
Ref: library/optparse introduction11916481
Ref: 33db11916481
Node: 背景11918990
Ref: library/optparse background11919134
Ref: 33dc11919134
Ref: library/optparse optparse-background11919134
Ref: 33dd11919134
Node: 用語集11919710
Ref: library/optparse optparse-terminology11919798
Ref: 33de11919798
Ref: library/optparse terminology11919798
Ref: 33df11919798
Node: オプションとは何か11924294
Ref: library/optparse optparse-what-options-for11924415
Ref: 33e011924415
Ref: library/optparse what-are-options-for11924415
Ref: 33e111924415
Node: 位置引数とは何か11926988
Ref: library/optparse optparse-what-positional-arguments-for11927091
Ref: 33e211927091
Ref: library/optparse what-are-positional-arguments-for11927091
Ref: 33e311927091
Node: チュートリアル<2>11928818
Ref: library/optparse optparse-tutorial11928974
Ref: 33e411928974
Ref: library/optparse tutorial11928974
Ref: 33e511928974
Node: オプション・アクションを理解する11932174
Ref: library/optparse optparse-understanding-option-actions11932313
Ref: 33ea11932313
Ref: library/optparse understanding-option-actions11932313
Ref: 33eb11932313
Node: store アクション11932905
Ref: library/optparse optparse-store-action11933100
Ref: 33ed11933100
Ref: library/optparse the-store-action11933100
Ref: 33ee11933100
Node: ブール値 フラグ オプションの処理11935500
Ref: library/optparse handling-boolean-flag-options11935674
Ref: 33ef11935674
Ref: library/optparse optparse-handling-boolean-options11935674
Ref: 33f011935674
Node: その他のアクション11936630
Ref: library/optparse optparse-other-actions11936801
Ref: 33f111936801
Ref: library/optparse other-actions11936801
Ref: 33f211936801
Node: デフォルト値11937398
Ref: library/optparse default-values11937540
Ref: 33f611937540
Ref: library/optparse optparse-default-values11937540
Ref: 33f711937540
Node: ヘルプの生成11939838
Ref: library/optparse generating-help11939983
Ref: 33f811939983
Ref: library/optparse optparse-generating-help11939983
Ref: 33f911939983
Node: オプションをグループ化する11944467
Ref: library/optparse grouping-options11944561
Ref: 33fa11944561
Ref: library/optparse optparse OptionGroup11945021
Ref: 33fb11945021
Ref: library/optparse optparse OptionParser get_option_group11948717
Ref: 33fc11948717
Node: バージョン番号の出力11949072
Ref: library/optparse optparse-printing-version-string11949226
Ref: 33fd11949226
Ref: library/optparse printing-a-version-string11949226
Ref: 33fe11949226
Ref: library/optparse optparse OptionParser print_version11950135
Ref: 33ff11950135
Ref: library/optparse optparse OptionParser get_version11950597
Ref: 340111950597
Node: How optparse handles errors11950773
Ref: library/optparse how-optparse-handles-errors11950939
Ref: 340211950939
Ref: library/optparse optparse-how-optparse-handles-errors11950939
Ref: 340311950939
Node: 全てをつなぎ合わせる11953080
Ref: library/optparse optparse-putting-it-all-together11953207
Ref: 340411953207
Ref: library/optparse putting-it-all-together11953207
Ref: 340511953207
Node: リファレンスガイド11954122
Ref: library/optparse optparse-reference-guide11954311
Ref: 33f411954311
Ref: library/optparse reference-guide11954311
Ref: 340611954311
Node: parserを作る11954759
Ref: library/optparse creating-the-parser11954883
Ref: 340711954883
Ref: library/optparse optparse-creating-parser11954883
Ref: 340811954883
Ref: library/optparse optparse OptionParser11955012
Ref: 16e611955012
Node: パーザへのオプション追加11958526
Ref: library/optparse optparse-populating-parser11958683
Ref: 340a11958683
Ref: library/optparse populating-the-parser11958683
Ref: 340b11958683
Node: オプションの定義11960266
Ref: library/optparse defining-options11960429
Ref: 340d11960429
Ref: library/optparse optparse-defining-options11960429
Ref: 340e11960429
Ref: library/optparse optparse OptionParser add_option11961031
Ref: 33d211961031
Ref: library/optparse optparse Values11963508
Ref: 33d411963508
Node: オプション属性11964845
Ref: library/optparse option-attributes11965017
Ref: 341111965017
Ref: library/optparse optparse-option-attributes11965017
Ref: 341211965017
Ref: library/optparse optparse Option11965075
Ref: 340c11965075
Ref: library/optparse optparse Option action11965692
Ref: 33e611965692
Ref: library/optparse optparse Option type11965916
Ref: 33e711965916
Ref: library/optparse optparse Option dest11966205
Ref: 33e811966205
Ref: library/optparse optparse Option default11966552
Ref: 341411966552
Ref: library/optparse optparse Option nargs11966785
Ref: 341611966785
Ref: library/optparse optparse Option const11967021
Ref: 33f311967021
Ref: library/optparse optparse Option choices11967120
Ref: 341711967120
Ref: library/optparse optparse Option callback11967278
Ref: 341811967278
Ref: library/optparse optparse Option callback_args11967652
Ref: 341911967652
Ref: library/optparse optparse Option callback_kwargs11967688
Ref: 341a11967688
Ref: library/optparse optparse Option help11967879
Ref: 33e911967879
Ref: library/optparse optparse Option metavar11968349
Ref: 341b11968349
Node: 標準的なオプション・アクション11968619
Ref: library/optparse optparse-standard-option-actions11968794
Ref: 340f11968794
Ref: library/optparse standard-option-actions11968794
Ref: 341c11968794
Node: 標準のオプション型11977725
Ref: library/optparse optparse-standard-option-types11977900
Ref: 341311977900
Ref: library/optparse standard-option-types11977900
Ref: 341d11977900
Node: 引数を解析する11979647
Ref: library/optparse optparse-parsing-arguments11979831
Ref: 341011979831
Ref: library/optparse parsing-arguments11979831
Ref: 341e11979831
Ref: library/optparse optparse OptionParser parse_args11980051
Ref: 16e711980051
Node: オプション解析器への問い合わせと操作11981744
Ref: library/optparse optparse-querying-manipulating-option-parser11981928
Ref: 341f11981928
Ref: library/optparse querying-and-manipulating-your-option-parser11981928
Ref: 342011981928
Ref: library/optparse optparse OptionParser disable_interspersed_args11982332
Ref: 33d311982332
Ref: library/optparse optparse OptionParser enable_interspersed_args11983381
Ref: 342111983381
Ref: library/optparse optparse OptionParser get_option11983703
Ref: 342211983703
Ref: library/optparse optparse OptionParser has_option11983945
Ref: 342311983945
Ref: library/optparse optparse OptionParser remove_option11984157
Ref: 342411984157
Node: オプション間の衝突11984703
Ref: library/optparse conflicts-between-options11984887
Ref: 342511984887
Ref: library/optparse optparse-conflicts-between-options11984887
Ref: 340911984887
Node: クリーンアップ11987611
Ref: library/optparse cleanup11987765
Ref: 342711987765
Ref: library/optparse optparse-cleanup11987765
Ref: 342811987765
Node: その他のメソッド11988393
Ref: library/optparse optparse-other-methods11988511
Ref: 342911988511
Ref: library/optparse other-methods11988511
Ref: 342a11988511
Ref: library/optparse optparse OptionParser set_usage11988665
Ref: 342b11988665
Ref: library/optparse optparse OptionParser print_usage11989069
Ref: 340011989069
Ref: library/optparse optparse OptionParser get_usage11989476
Ref: 342c11989476
Ref: library/optparse optparse OptionParser set_defaults11989666
Ref: 341511989666
Node: オプション処理コールバック11991116
Ref: library/optparse option-callbacks11991299
Ref: 342d11991299
Ref: library/optparse optparse-option-callbacks11991299
Ref: 33f511991299
Node: callbackオプションの定義11992957
Ref: library/optparse defining-a-callback-option11993137
Ref: 342e11993137
Ref: library/optparse optparse-defining-callback-option11993137
Ref: 342f11993137
Node: コールバック関数はどのように呼び出されるか11995476
Ref: library/optparse how-callbacks-are-called11995710
Ref: 343011995710
Ref: library/optparse optparse-how-callbacks-called11995710
Ref: 343111995710
Node: コールバック中で例外を送出する11998885
Ref: library/optparse optparse-raising-errors-in-callback11999147
Ref: 343211999147
Ref: library/optparse raising-errors-in-a-callback11999147
Ref: 343311999147
Node: コールバックの例 1 ありふれたコールバック11999639
Ref: library/optparse callback-example-1-trivial-callback11999910
Ref: 343411999910
Ref: library/optparse optparse-callback-example-111999910
Ref: 343511999910
Node: コールバックの例 2 オプションの順番をチェックする12000443
Ref: library/optparse callback-example-2-check-option-order12000751
Ref: 343612000751
Ref: library/optparse optparse-callback-example-212000751
Ref: 343712000751
Node: コールバックの例 3 オプションの順番をチェックする 汎用的12001407
Ref: library/optparse callback-example-3-check-option-order-generalized12001718
Ref: 343812001718
Ref: library/optparse optparse-callback-example-312001718
Ref: 343912001718
Node: コールバックの例 4 任意の条件をチェックする12002658
Ref: library/optparse callback-example-4-check-arbitrary-condition12002935
Ref: 343a12002935
Ref: library/optparse optparse-callback-example-412002935
Ref: 343b12002935
Node: コールバックの例5 固定引数12003839
Ref: library/optparse callback-example-5-fixed-arguments12004078
Ref: 343c12004078
Ref: library/optparse optparse-callback-example-512004078
Ref: 343d12004078
Node: コールバックの例6 可変個の引数12005319
Ref: library/optparse callback-example-6-variable-arguments12005486
Ref: 343e12005486
Ref: library/optparse optparse-callback-example-612005486
Ref: 343f12005486
Node: Extending optparse12007729
Ref: library/optparse extending-optparse12007895
Ref: 344012007895
Ref: library/optparse optparse-extending-optparse12007895
Ref: 33ec12007895
Node: 新しい型の追加12008247
Ref: library/optparse adding-new-types12008365
Ref: 344112008365
Ref: library/optparse optparse-adding-new-types12008365
Ref: 344212008365
Ref: library/optparse optparse Option TYPES12008650
Ref: 344312008650
Ref: library/optparse optparse Option TYPE_CHECKER12008902
Ref: 344412008902
Node: 新しいアクションの追加12012365
Ref: library/optparse adding-new-actions12012483
Ref: 344512012483
Ref: library/optparse optparse-adding-new-actions12012483
Ref: 344612012483
Ref: library/optparse optparse Option ACTIONS12013899
Ref: 344712013899
Ref: library/optparse optparse Option STORE_ACTIONS12014027
Ref: 344812014027
Ref: library/optparse optparse Option TYPED_ACTIONS12014133
Ref: 344912014133
Ref: library/optparse optparse Option ALWAYS_TYPED_ACTIONS12014239
Ref: 344a12014239
Node: 例外<12>12018057
Ref: library/optparse exceptions12018175
Ref: 344b12018175
Ref: library/optparse optparse OptionError12018208
Ref: 33d512018208
Ref: library/optparse optparse OptionConflictError12018346
Ref: 342612018346
Ref: library/optparse optparse OptionValueError12018471
Ref: 33d612018471
Ref: library/optparse optparse BadOptionError12018591
Ref: 344c12018591
Ref: library/optparse optparse AmbiguousOptionError12018693
Ref: 344d12018693
Node: getpass --- 可搬性のあるパスワード入力機構12018803
Ref: library/getpass doc12019096
Ref: 344e12019096
Ref: library/getpass getpass-portable-password-input12019096
Ref: 344f12019096
Ref: library/getpass module-getpass12019096
Ref: 6612019096
Ref: library/getpass translation-repo12019096
Ref: 345012019096
Ref: library/getpass getpass getpass12019592
Ref: 21d12019592
Ref: library/getpass getpass GetPassWarning12021485
Ref: 345112021485
Ref: library/getpass getpass getuser12021649
Ref: 65a12021649
Ref: getpass --- 可搬性のあるパスワード入力機構-Footnote-112022465
Ref: getpass --- 可搬性のあるパスワード入力機構-Footnote-212022532
Node: fileinput --- 複数の入力ストリームをまたいだ行を反復する12022612
Ref: library/fileinput doc12022914
Ref: 345212022914
Ref: library/fileinput fileinput-iterate-over-lines-from-multiple-input-streams12022914
Ref: 345312022914
Ref: library/fileinput module-fileinput12022914
Ref: 5f12022914
Ref: library/fileinput translation-repo12022914
Ref: 345412022914
Ref: library/fileinput fileinput input12025998
Ref: a0012025998
Ref: library/fileinput fileinput filename12027513
Ref: 345512027513
Ref: library/fileinput fileinput fileno12027686
Ref: 164712027686
Ref: library/fileinput fileinput lineno12027959
Ref: 345612027959
Ref: library/fileinput fileinput filelineno12028255
Ref: 345712028255
Ref: library/fileinput fileinput isfirstline12028558
Ref: 345812028558
Ref: library/fileinput fileinput isstdin12028739
Ref: 345912028739
Ref: library/fileinput fileinput nextfile12028939
Ref: 345a12028939
Ref: library/fileinput fileinput close12029700
Ref: 345b12029700
Ref: library/fileinput fileinput FileInput12029908
Ref: 94012029908
Ref: library/fileinput fileinput hook_compressed12033557
Ref: a0112033557
Ref: library/fileinput fileinput hook_encoded12034472
Ref: e9e12034472
Ref: fileinput --- 複数の入力ストリームをまたいだ行を反復する-Footnote-112035156
Node: curses --- 文字セル表示のターミナル処理12035225
Ref: library/curses doc12035526
Ref: 345c12035526
Ref: library/curses curses-terminal-handling-for-character-cell-displays12035526
Ref: 345d12035526
Ref: library/curses module-curses12035526
Ref: 2f12035526
Ref: library/curses translation-repo12035526
Ref: 345e12035526
Ref: curses --- 文字セル表示のターミナル処理-Footnote-112037894
Node: 関数<6>12037957
Ref: library/curses curses-functions12038090
Ref: 346012038090
Ref: library/curses functions12038090
Ref: 346112038090
Ref: library/curses curses error12038179
Ref: 346212038179
Ref: library/curses curses assume_default_colors12038641
Ref: 1f612038641
Ref: library/curses curses baudrate12039265
Ref: 346412039265
Ref: library/curses curses beep12039802
Ref: 346512039802
Ref: library/curses curses can_change_color12039885
Ref: 346612039885
Ref: library/curses curses cbreak12040079
Ref: 346712040079
Ref: library/curses curses color_content12040795
Ref: 9f212040795
Ref: library/curses curses color_pair12041268
Ref: 346912041268
Ref: library/curses curses curs_set12041656
Ref: 346d12041656
Ref: library/curses curses def_prog_mode12042241
Ref: 346e12042241
Ref: library/curses curses def_shell_mode12042652
Ref: 347012042652
Ref: library/curses curses delay_output12043099
Ref: 347212043099
Ref: library/curses curses doupdate12043204
Ref: 347312043204
Ref: library/curses curses echo12044358
Ref: 347612044358
Ref: library/curses curses endwin12044553
Ref: 347712044553
Ref: library/curses curses erasechar12044677
Ref: 347812044677
Ref: library/curses curses filter12045039
Ref: 347912045039
Ref: library/curses curses flash12045844
Ref: 347a12045844
Ref: library/curses curses flushinp12046150
Ref: 347b12046150
Ref: library/curses curses getmouse12046447
Ref: 347c12046447
Ref: library/curses curses getsyx12047719
Ref: 348612047719
Ref: library/curses curses getwin12047974
Ref: 348712047974
Ref: library/curses curses has_colors12048230
Ref: 348912048230
Ref: library/curses curses has_extended_color_support12048409
Ref: 9f612048409
Ref: library/curses curses has_ic12048796
Ref: 348a12048796
Ref: library/curses curses has_il12049086
Ref: 348b12049086
Ref: library/curses curses has_key12049373
Ref: 348c12049373
Ref: library/curses curses halfdelay12049551
Ref: 348d12049551
Ref: library/curses curses init_color12050089
Ref: 9f312050089
Ref: library/curses curses init_pair12050836
Ref: 9f412050836
Ref: library/curses curses initscr12051636
Ref: 190f12051636
Ref: library/curses curses is_term_resized12052011
Ref: 348f12052011
Ref: library/curses curses isendwin12052245
Ref: 349012052245
Ref: library/curses curses keyname12052473
Ref: 349112052473
Ref: library/curses curses killchar12053132
Ref: 349212053132
Ref: library/curses curses longname12053402
Ref: 349312053402
Ref: library/curses curses meta12053749
Ref: 349412053749
Ref: library/curses curses mouseinterval12053956
Ref: 349512053956
Ref: library/curses curses mousemask12054298
Ref: 349612054298
Ref: library/curses curses napms12054881
Ref: 190e12054881
Ref: library/curses curses newpad12054963
Ref: 349712054963
Ref: library/curses curses newwin12056284
Ref: 349912056284
Ref: library/curses curses nl12056674
Ref: 349a12056674
Ref: library/curses curses nocbreak12056989
Ref: 348e12056989
Ref: library/curses curses noecho12057153
Ref: 349b12057153
Ref: library/curses curses nonl12057282
Ref: 349c12057282
Ref: library/curses curses noqiflush12057887
Ref: 349d12057887
Ref: library/curses curses noraw12058366
Ref: 349e12058366
Ref: library/curses curses pair_content12058524
Ref: 9f512058524
Ref: library/curses curses pair_number12058769
Ref: 346c12058769
Ref: library/curses curses putp12058955
Ref: 349f12058955
Ref: library/curses curses qiflush12059236
Ref: 34a012059236
Ref: library/curses curses raw12059542
Ref: 346812059542
Ref: library/curses curses reset_prog_mode12059875
Ref: 346f12059875
Ref: library/curses curses reset_shell_mode12060057
Ref: 347112060057
Ref: library/curses curses resetty12060239
Ref: 34a112060239
Ref: library/curses curses resize_term12060394
Ref: 193012060394
Ref: library/curses curses resizeterm12061038
Ref: 192f12061038
Ref: library/curses curses savetty12061346
Ref: 34a212061346
Ref: library/curses curses get_escdelay12061509
Ref: aec12061509
Ref: library/curses curses set_escdelay12061636
Ref: aed12061636
Ref: library/curses curses get_tabsize12061935
Ref: aee12061935
Ref: library/curses curses set_tabsize12062060
Ref: aef12062060
Ref: library/curses curses setsyx12062274
Ref: 34a312062274
Ref: library/curses curses setupterm12062505
Ref: 34a412062505
Ref: library/curses curses start_color12062968
Ref: 34a512062968
Ref: library/curses curses termattrs12063751
Ref: 34a812063751
Ref: library/curses curses termname12064032
Ref: 34a912064032
Ref: library/curses curses tigetflag12064210
Ref: 34aa12064210
Ref: library/curses curses tigetnum12064558
Ref: 34ab12064558
Ref: library/curses curses tigetstr12064900
Ref: 34ac12064900
Ref: library/curses curses tparm12065207
Ref: 34ad12065207
Ref: library/curses curses typeahead12065675
Ref: 34ae12065675
Ref: library/curses curses unctrl12066424
Ref: 34af12066424
Ref: library/curses curses ungetch12066706
Ref: 34b012066706
Ref: library/curses curses update_lines_cols12066992
Ref: feb12066992
Ref: library/curses curses unget_wch12067186
Ref: 12aa12067186
Ref: library/curses curses ungetmouse12067506
Ref: 34b112067506
Ref: library/curses curses use_env12067710
Ref: 34b212067710
Ref: library/curses curses use_default_colors12068351
Ref: 1f712068351
Ref: library/curses curses wrapper12068453
Ref: c7312068453
Node: Window オブジェクト12069507
Ref: library/curses curses-window-objects12069658
Ref: 198912069658
Ref: library/curses window-objects12069658
Ref: 34b312069658
Ref: library/curses curses window12069723
Ref: 12a712069723
Ref: library/curses curses window addch12069901
Ref: 34b412069901
Ref: library/curses curses window addnstr12070581
Ref: 34b512070581
Ref: library/curses curses window addstr12070877
Ref: 347412070877
Ref: library/curses curses window attroff12071920
Ref: 34b612071920
Ref: library/curses curses window attron12072126
Ref: 34b712072126
Ref: library/curses curses window attrset12072267
Ref: 34b812072267
Ref: library/curses curses window bkgd12072442
Ref: 34b912072442
Ref: library/curses curses window bkgdset12072935
Ref: 34ba12072935
Ref: library/curses curses window border12073547
Ref: 34bb12073547
Ref: library/curses curses window box12075696
Ref: 34c212075696
Ref: library/curses curses window chgat12075987
Ref: 34c312075987
Ref: library/curses curses window clear12076635
Ref: 34c512076635
Ref: library/curses curses window clearok12076851
Ref: 34c712076851
Ref: library/curses curses window clrtobot12077017
Ref: 34c812077017
Ref: library/curses curses window clrtoeol12077247
Ref: 34c912077247
Ref: library/curses curses window cursyncup12077349
Ref: 34ca12077349
Ref: library/curses curses window delch12077530
Ref: 34cb12077530
Ref: library/curses curses window deleteln12077627
Ref: 34cc12077627
Ref: library/curses curses window derwin12077783
Ref: 34cd12077783
Ref: library/curses curses window echochar12078263
Ref: 34cf12078263
Ref: library/curses curses window enclose12078452
Ref: 1c9112078452
Ref: library/curses curses window encoding12078974
Ref: 12a812078974
Ref: library/curses curses window erase12079482
Ref: 34c612079482
Ref: library/curses curses window getbegyx12079563
Ref: 34d012079563
Ref: library/curses curses window getbkgd12079672
Ref: 34d112079672
Ref: library/curses curses window getch12079806
Ref: 182512079806
Ref: library/curses curses window get_wch12080267
Ref: 12a912080267
Ref: library/curses curses window getkey12080624
Ref: 34d212080624
Ref: library/curses curses window getmaxyx12081016
Ref: 34d312081016
Ref: library/curses curses window getparyx12081147
Ref: 34d412081147
Ref: library/curses curses window getstr12081390
Ref: 183e12081390
Ref: library/curses curses window getyx12081768
Ref: 34d512081768
Ref: library/curses curses window hline12081940
Ref: 34d612081940
Ref: library/curses curses window idcok12082152
Ref: 34d712082152
Ref: library/curses curses window idlok12082556
Ref: 34d812082556
Ref: library/curses curses window immedok12082750
Ref: 34d912082750
Ref: library/curses curses window inch12083264
Ref: 34da12083264
Ref: library/curses curses window insch12083464
Ref: 34db12083464
Ref: library/curses curses window insdelln12083697
Ref: 34dc12083697
Ref: library/curses curses window insertln12084172
Ref: 34dd12084172
Ref: library/curses curses window insnstr12084331
Ref: 34de12084331
Ref: library/curses curses window insstr12084913
Ref: 34df12084913
Ref: library/curses curses window instr12085373
Ref: 183d12085373
Ref: library/curses curses window is_linetouched12085923
Ref: 34e012085923
Ref: library/curses curses window is_wintouched12086310
Ref: 34e112086310
Ref: library/curses curses window keypad12086575
Ref: 34e212086575
Ref: library/curses curses window leaveok12086846
Ref: 34e312086846
Ref: library/curses curses window move12087293
Ref: 34e412087293
Ref: library/curses curses window mvderwin12087404
Ref: 34e512087404
Ref: library/curses curses window mvwin12087747
Ref: 34e612087747
Ref: library/curses curses window nodelay12087889
Ref: 34e712087889
Ref: library/curses curses window notimeout12088037
Ref: 34e812088037
Ref: library/curses curses window noutrefresh12088391
Ref: 347512088391
Ref: library/curses curses window overlay12088784
Ref: 34e912088784
Ref: library/curses curses window overwrite12089521
Ref: 34ea12089521
Ref: library/curses curses window putwin12090263
Ref: 348812090263
Ref: library/curses curses window redrawln12090558
Ref: 34eb12090558
Ref: library/curses curses window redrawwin12090827
Ref: 34ec12090827
Ref: library/curses curses window refresh12091017
Ref: 349812091017
Ref: library/curses curses window resize12092250
Ref: 34ed12092250
Ref: library/curses curses window scroll12092598
Ref: 34ee12092598
Ref: library/curses curses window scrollok12092743
Ref: 34ef12092743
Ref: library/curses curses window setscrreg12093383
Ref: 34f012093383
Ref: library/curses curses window standend12093580
Ref: 34f112093580
Ref: library/curses curses window standout12093779
Ref: 34f212093779
Ref: library/curses curses window subpad12093867
Ref: 34f312093867
Ref: library/curses curses window subwin12094153
Ref: 34ce12094153
Ref: library/curses curses window syncdown12094578
Ref: 34f412094578
Ref: library/curses curses window syncok12094929
Ref: 34f512094929
Ref: library/curses curses window syncup12095128
Ref: 34f612095128
Ref: library/curses curses window timeout12095294
Ref: 34f712095294
Ref: library/curses curses window touchline12095913
Ref: 34c412095913
Ref: library/curses curses window touchwin12096265
Ref: 34f812096265
Ref: library/curses curses window untouchwin12096433
Ref: 34f912096433
Ref: library/curses curses window vline12096642
Ref: 1afe12096642
Ref: Window オブジェクト-Footnote-112096913
Node: 定数<6>12096956
Ref: library/curses constants12097089
Ref: 34fa12097089
Ref: library/curses curses ERR12097181
Ref: 34fb12097181
Ref: library/curses curses OK12097364
Ref: 34fc12097364
Ref: library/curses curses version12097545
Ref: 34fd12097545
Ref: library/curses curses ncurses_version12097645
Ref: bda12097645
Ref: library/curses curses COLORS12098069
Ref: 34a612098069
Ref: library/curses curses COLOR_PAIRS12098230
Ref: 34a712098230
Ref: library/curses curses COLS12098401
Ref: fed12098401
Ref: library/curses curses LINES12098666
Ref: fec12098666
Ref: library/curses curses A_ALTCHARSET12099230
Ref: 34fe12099230
Ref: library/curses curses A_BLINK12099339
Ref: 34ff12099339
Ref: library/curses curses A_BOLD12099446
Ref: 350012099446
Ref: library/curses curses A_DIM12099553
Ref: 350112099553
Ref: library/curses curses A_INVIS12099666
Ref: 350212099666
Ref: library/curses curses A_ITALIC12099767
Ref: 350312099767
Ref: library/curses curses A_NORMAL12099855
Ref: 346312099855
Ref: library/curses curses A_PROTECT12099934
Ref: 350412099934
Ref: library/curses curses A_REVERSE12100012
Ref: 346b12100012
Ref: library/curses curses A_STANDOUT12100174
Ref: 346a12100174
Ref: library/curses curses A_UNDERLINE12100253
Ref: 350512100253
Ref: library/curses curses A_HORIZONTAL12100332
Ref: 350612100332
Ref: library/curses curses A_LEFT12100430
Ref: 350712100430
Ref: library/curses curses A_LOW12100536
Ref: 350812100536
Ref: library/curses curses A_RIGHT12100644
Ref: 350912100644
Ref: library/curses curses A_TOP12100750
Ref: 350a12100750
Ref: library/curses curses A_VERTICAL12100843
Ref: 350b12100843
Ref: library/curses curses A_ATTRIBUTES12101252
Ref: 350c12101252
Ref: library/curses curses A_CHARTEXT12101348
Ref: 350d12101348
Ref: library/curses curses A_COLOR12101460
Ref: 350e12101460
Ref: library/curses curses KEY_MIN12101928
Ref: 350f12101928
Ref: library/curses curses KEY_BREAK12102027
Ref: 351012102027
Ref: library/curses curses KEY_DOWN12102158
Ref: 351112102158
Ref: library/curses curses KEY_UP12102261
Ref: 351212102261
Ref: library/curses curses KEY_LEFT12102368
Ref: 351312102368
Ref: library/curses curses KEY_RIGHT12102457
Ref: 351412102457
Ref: library/curses curses KEY_HOME12102548
Ref: 351512102548
Ref: library/curses curses KEY_BACKSPACE12102673
Ref: 351612102673
Ref: library/curses curses KEY_F012102809
Ref: 351712102809
Ref: library/curses curses KEY_Fn12103011
Ref: 351812103011
Ref: library/curses curses KEY_DL12103145
Ref: 351912103145
Ref: library/curses curses KEY_IL12103264
Ref: 351a12103264
Ref: library/curses curses KEY_DC12103383
Ref: 351b12103383
Ref: library/curses curses KEY_IC12103505
Ref: 351c12103505
Ref: library/curses curses KEY_EIC12103656
Ref: 351d12103656
Ref: library/curses curses KEY_CLEAR12103773
Ref: 351e12103773
Ref: library/curses curses KEY_EOS12103866
Ref: 351f12103866
Ref: library/curses curses KEY_EOL12103989
Ref: 352012103989
Ref: library/curses curses KEY_SF12104105
Ref: 352112104105
Ref: library/curses curses KEY_SR12104228
Ref: 352212104228
Ref: library/curses curses KEY_NPAGE12104353
Ref: 352312104353
Ref: library/curses curses KEY_PPAGE12104446
Ref: 352412104446
Ref: library/curses curses KEY_STAB12104555
Ref: 352512104555
Ref: library/curses curses KEY_CTAB12104663
Ref: 352612104663
Ref: library/curses curses KEY_CATAB12104761
Ref: 352712104761
Ref: library/curses curses KEY_ENTER12104860
Ref: 352812104860
Ref: library/curses curses KEY_SRESET12104971
Ref: 352912104971
Ref: library/curses curses KEY_RESET12105165
Ref: 352a12105165
Ref: library/curses curses KEY_PRINT12105297
Ref: 352b12105297
Ref: library/curses curses KEY_LL12105391
Ref: 352c12105391
Ref: library/curses curses KEY_A112105539
Ref: 352d12105539
Ref: library/curses curses KEY_A312105665
Ref: 352e12105665
Ref: library/curses curses KEY_B212105791
Ref: 352f12105791
Ref: library/curses curses KEY_C112105917
Ref: 353012105917
Ref: library/curses curses KEY_C312106043
Ref: 353112106043
Ref: library/curses curses KEY_BTAB12106171
Ref: 353212106171
Ref: library/curses curses KEY_BEG12106274
Ref: 353312106274
Ref: library/curses curses KEY_CANCEL12106367
Ref: 353412106367
Ref: library/curses curses KEY_CLOSE12106457
Ref: 353512106457
Ref: library/curses curses KEY_COMMAND12106540
Ref: 353612106540
Ref: library/curses curses KEY_COPY12106640
Ref: 353712106640
Ref: library/curses curses KEY_CREATE12106736
Ref: 353812106736
Ref: library/curses curses KEY_END12106832
Ref: 353912106832
Ref: library/curses curses KEY_EXIT12106941
Ref: 353a12106941
Ref: library/curses curses KEY_FIND12107050
Ref: 353b12107050
Ref: library/curses curses KEY_HELP12107159
Ref: 353c12107159
Ref: library/curses curses KEY_MARK12107271
Ref: 353d12107271
Ref: library/curses curses KEY_MESSAGE12107367
Ref: 353e12107367
Ref: library/curses curses KEY_MOVE12107474
Ref: 353f12107474
Ref: library/curses curses KEY_NEXT12107583
Ref: 354012107583
Ref: library/curses curses KEY_OPEN12107692
Ref: 354112107692
Ref: library/curses curses KEY_OPTIONS12107785
Ref: 354212107785
Ref: library/curses curses KEY_PREVIOUS12107866
Ref: 354312107866
Ref: library/curses curses KEY_REDO12107961
Ref: 354412107961
Ref: library/curses curses KEY_REFERENCE12108060
Ref: 354512108060
Ref: library/curses curses KEY_REFRESH12108138
Ref: 354612108138
Ref: library/curses curses KEY_REPLACE12108220
Ref: 354712108220
Ref: library/curses curses KEY_RESTART12108302
Ref: 354812108302
Ref: library/curses curses KEY_RESUME12108387
Ref: 354912108387
Ref: library/curses curses KEY_SAVE12108484
Ref: 354a12108484
Ref: library/curses curses KEY_SBEG12108593
Ref: 354b12108593
Ref: library/curses curses KEY_SCANCEL12108692
Ref: 354c12108692
Ref: library/curses curses KEY_SCOMMAND12108780
Ref: 354d12108780
Ref: library/curses curses KEY_SCOPY12108869
Ref: 354e12108869
Ref: library/curses curses KEY_SCREATE12108955
Ref: 354f12108955
Ref: library/curses curses KEY_SDC12109058
Ref: 355012109058
Ref: library/curses curses KEY_SDL12109181
Ref: 355112109181
Ref: library/curses curses KEY_SELECT12109289
Ref: 355212109289
Ref: library/curses curses KEY_SEND12109386
Ref: 355312109386
Ref: library/curses curses KEY_SEOL12109501
Ref: 355412109501
Ref: library/curses curses KEY_SEXIT12109607
Ref: 355512109607
Ref: library/curses curses KEY_SFIND12109693
Ref: 355612109693
Ref: library/curses curses KEY_SHELP12109779
Ref: 355712109779
Ref: library/curses curses KEY_SHOME12109865
Ref: 355812109865
Ref: library/curses curses KEY_SIC12109966
Ref: 355912109966
Ref: library/curses curses KEY_SLEFT12110068
Ref: 355a12110068
Ref: library/curses curses KEY_SMESSAGE12110160
Ref: 355b12110160
Ref: library/curses curses KEY_SMOVE12110249
Ref: 355c12110249
Ref: library/curses curses KEY_SNEXT12110335
Ref: 355d12110335
Ref: library/curses curses KEY_SOPTIONS12110421
Ref: 355e12110421
Ref: library/curses curses KEY_SPREVIOUS12110510
Ref: 355f12110510
Ref: library/curses curses KEY_SPRINT12110596
Ref: 356012110596
Ref: library/curses curses KEY_SREDO12110683
Ref: 356112110683
Ref: library/curses curses KEY_SREPLACE12110769
Ref: 356212110769
Ref: library/curses curses KEY_SRIGHT12110858
Ref: 356312110858
Ref: library/curses curses KEY_SRSUME12110951
Ref: 356412110951
Ref: library/curses curses KEY_SSAVE12111039
Ref: 356512111039
Ref: library/curses curses KEY_SSUSPEND12111125
Ref: 356612111125
Ref: library/curses curses KEY_SUNDO12111214
Ref: 356712111214
Ref: library/curses curses KEY_SUSPEND12111300
Ref: 356812111300
Ref: library/curses curses KEY_UNDO12111404
Ref: 356912111404
Ref: library/curses curses KEY_MOUSE12111503
Ref: 347d12111503
Ref: library/curses curses KEY_RESIZE12111596
Ref: 356a12111596
Ref: library/curses curses KEY_MAX12111707
Ref: 356b12111707
Ref: library/curses curses-acs-codes12112910
Ref: 356c12112910
Ref: library/curses curses ACS_BBSS12113574
Ref: 356d12113574
Ref: library/curses curses ACS_BLOCK12113656
Ref: 356e12113656
Ref: library/curses curses ACS_BOARD12113741
Ref: 356f12113741
Ref: library/curses curses ACS_BSBS12113826
Ref: 357012113826
Ref: library/curses curses ACS_BSSB12113908
Ref: 357112113908
Ref: library/curses curses ACS_BSSS12113990
Ref: 357212113990
Ref: library/curses curses ACS_BTEE12114084
Ref: 357312114084
Ref: library/curses curses ACS_BULLET12114169
Ref: 357412114169
Ref: library/curses curses ACS_CKBOARD12114247
Ref: 357512114247
Ref: library/curses curses ACS_DARROW12114353
Ref: 357612114353
Ref: library/curses curses ACS_DEGREE12114432
Ref: 357712114432
Ref: library/curses curses ACS_DIAMOND12114505
Ref: 357812114505
Ref: library/curses curses ACS_GEQUAL12114587
Ref: 357912114587
Ref: library/curses curses ACS_HLINE12114672
Ref: 34bd12114672
Ref: library/curses curses ACS_LANTERN12114745
Ref: 357a12114745
Ref: library/curses curses ACS_LARROW12114843
Ref: 357b12114843
Ref: library/curses curses ACS_LEQUAL12114922
Ref: 357c12114922
Ref: library/curses curses ACS_LLCORNER12115007
Ref: 34c012115007
Ref: library/curses curses ACS_LRCORNER12115080
Ref: 34c112115080
Ref: library/curses curses ACS_LTEE12115153
Ref: 357d12115153
Ref: library/curses curses ACS_NEQUAL12115238
Ref: 357e12115238
Ref: library/curses curses ACS_PI12115325
Ref: 357f12115325
Ref: library/curses curses ACS_PLMINUS12115416
Ref: 358012115416
Ref: library/curses curses ACS_PLUS12115507
Ref: 358112115507
Ref: library/curses curses ACS_RARROW12115589
Ref: 358212115589
Ref: library/curses curses ACS_RTEE12115668
Ref: 358312115668
Ref: library/curses curses ACS_S112115767
Ref: 358412115767
Ref: library/curses curses ACS_S312115883
Ref: 358512115883
Ref: library/curses curses ACS_S712115999
Ref: 358612115999
Ref: library/curses curses ACS_S912116115
Ref: 358712116115
Ref: library/curses curses ACS_SBBS12116217
Ref: 358812116217
Ref: library/curses curses ACS_SBSB12116299
Ref: 358912116299
Ref: library/curses curses ACS_SBSS12116381
Ref: 358a12116381
Ref: library/curses curses ACS_SSBB12116475
Ref: 358b12116475
Ref: library/curses curses ACS_SSBS12116557
Ref: 358c12116557
Ref: library/curses curses ACS_SSSB12116651
Ref: 358d12116651
Ref: library/curses curses ACS_SSSS12116745
Ref: 358e12116745
Ref: library/curses curses ACS_STERLING12116857
Ref: 358f12116857
Ref: library/curses curses ACS_TTEE12116954
Ref: 359012116954
Ref: library/curses curses ACS_UARROW12117039
Ref: 359112117039
Ref: library/curses curses ACS_ULCORNER12117118
Ref: 34be12117118
Ref: library/curses curses ACS_URCORNER12117191
Ref: 34bf12117191
Ref: library/curses curses ACS_VLINE12117264
Ref: 34bc12117264
Ref: library/curses curses BUTTONn_PRESSED12117659
Ref: 347e12117659
Ref: library/curses curses BUTTONn_RELEASED12117807
Ref: 347f12117807
Ref: library/curses curses BUTTONn_CLICKED12117954
Ref: 348012117954
Ref: library/curses curses BUTTONn_DOUBLE_CLICKED12118078
Ref: 348112118078
Ref: library/curses curses BUTTONn_TRIPLE_CLICKED12118193
Ref: 348212118193
Ref: library/curses curses BUTTON_SHIFT12118328
Ref: 348312118328
Ref: library/curses curses BUTTON_CTRL12118491
Ref: 348412118491
Ref: library/curses curses BUTTON_ALT12118656
Ref: 348512118656
Ref: library/curses curses COLOR_BLACK12119133
Ref: 359212119133
Ref: library/curses curses COLOR_BLUE12119202
Ref: 359312119202
Ref: library/curses curses COLOR_CYAN12119271
Ref: 359412119271
Ref: library/curses curses COLOR_GREEN12119373
Ref: 359512119373
Ref: library/curses curses COLOR_MAGENTA12119442
Ref: 359612119442
Ref: library/curses curses COLOR_RED12119541
Ref: 359712119541
Ref: library/curses curses COLOR_WHITE12119610
Ref: 359812119610
Ref: library/curses curses COLOR_YELLOW12119679
Ref: 359912119679
Node: curses textpad --- Text input widget for curses programs12119737
Ref: library/curses curses-textpad-text-input-widget-for-curses-programs12120017
Ref: 359a12120017
Ref: library/curses module-curses textpad12120017
Ref: 3212120017
Ref: library/curses curses textpad rectangle12120596
Ref: 359c12120596
Node: Textbox オブジェクト12121453
Ref: library/curses curses-textpad-objects12121572
Ref: 359d12121572
Ref: library/curses textbox-objects12121572
Ref: 359e12121572
Ref: library/curses curses textpad Textbox12121755
Ref: 359b12121755
Ref: library/curses curses textpad Textbox edit12122430
Ref: 35a012122430
Ref: library/curses curses textpad Textbox do_command12123234
Ref: 35a112123234
Ref: library/curses curses textpad Textbox gather12127632
Ref: 35a212127632
Ref: library/curses curses textpad Textbox stripspaces12127884
Ref: 359f12127884
Node: curses ascii --- ASCII 文字のユーティリティー12128428
Ref: library/curses ascii doc12128718
Ref: 35a312128718
Ref: library/curses ascii curses-ascii-utilities-for-ascii-characters12128718
Ref: 35a412128718
Ref: library/curses ascii module-curses ascii12128718
Ref: 3012128718
Ref: library/curses ascii translation-repo12128718
Ref: 35a512128718
Ref: library/curses ascii curses ascii NUL12129326
Ref: 35a612129326
Ref: library/curses ascii curses ascii SOH12129369
Ref: 35a712129369
Ref: library/curses ascii curses ascii STX12129472
Ref: 35a812129472
Ref: library/curses ascii curses ascii ETX12129542
Ref: 35a912129542
Ref: library/curses ascii curses ascii EOT12129612
Ref: 35aa12129612
Ref: library/curses ascii curses ascii ENQ12129688
Ref: 35ab12129688
Ref: library/curses ascii curses ascii ACK12129803
Ref: 35ac12129803
Ref: library/curses ascii curses ascii BEL12129867
Ref: 35ad12129867
Ref: library/curses ascii curses ascii BS12129925
Ref: 35ae12129925
Ref: library/curses ascii curses ascii TAB12129991
Ref: 35af12129991
Ref: library/curses ascii curses ascii HT12130049
Ref: 35b012130049
Ref: library/curses ascii curses ascii LF12130142
Ref: 35b112130142
Ref: library/curses ascii curses ascii NL12130199
Ref: 35b212130199
Ref: library/curses ascii curses ascii VT12130285
Ref: 35b312130285
Ref: library/curses ascii curses ascii FF12130348
Ref: 35b412130348
Ref: library/curses ascii curses ascii CR12130405
Ref: 35b512130405
Ref: library/curses ascii curses ascii SO12130462
Ref: 35b612130462
Ref: library/curses ascii curses ascii SI12130564
Ref: 35b712130564
Ref: library/curses ascii curses ascii DLE12130666
Ref: 35b812130666
Ref: library/curses ascii curses ascii DC112130757
Ref: 35b912130757
Ref: library/curses ascii curses ascii DC212130857
Ref: 35ba12130857
Ref: library/curses ascii curses ascii DC312130962
Ref: 35bb12130962
Ref: library/curses ascii curses ascii DC412131063
Ref: 35bc12131063
Ref: library/curses ascii curses ascii NAK12131129
Ref: 35bd12131129
Ref: library/curses ascii curses ascii SYN12131193
Ref: 35be12131193
Ref: library/curses ascii curses ascii ETB12131257
Ref: 35bf12131257
Ref: library/curses ascii curses ascii CAN12131333
Ref: 35c012131333
Ref: library/curses ascii curses ascii EM12131409
Ref: 35c112131409
Ref: library/curses ascii curses ascii SUB12131472
Ref: 35c212131472
Ref: library/curses ascii curses ascii ESC12131536
Ref: 35c312131536
Ref: library/curses ascii curses ascii FS12131609
Ref: 35c412131609
Ref: library/curses ascii curses ascii GS12131687
Ref: 35c512131687
Ref: library/curses ascii curses ascii RS12131765
Ref: 35c612131765
Ref: library/curses ascii curses ascii US12131876
Ref: 35c712131876
Ref: library/curses ascii curses ascii SP12131948
Ref: 35c812131948
Ref: library/curses ascii curses ascii DEL12132011
Ref: 35c912132011
Ref: library/curses ascii curses ascii isalnum12132474
Ref: 35ca12132474
Ref: library/curses ascii curses ascii isalpha12132624
Ref: 35cb12132624
Ref: library/curses ascii curses ascii isascii12132788
Ref: 35cc12132788
Ref: library/curses ascii curses ascii isblank12132915
Ref: 35cd12132915
Ref: library/curses ascii curses ascii iscntrl12133053
Ref: 35ce12133053
Ref: library/curses ascii curses ascii isdigit12133199
Ref: 35cf12133199
Ref: library/curses ascii curses ascii isgraph12133402
Ref: 35d012133402
Ref: library/curses ascii curses ascii islower12133520
Ref: 35d112133520
Ref: library/curses ascii curses ascii isprint12133613
Ref: 35d212133613
Ref: library/curses ascii curses ascii ispunct12133739
Ref: 35d312133739
Ref: library/curses ascii curses ascii isspace12133875
Ref: 35d412133875
Ref: library/curses ascii curses ascii isupper12134055
Ref: 35d512134055
Ref: library/curses ascii curses ascii isxdigit12134148
Ref: 35d612134148
Ref: library/curses ascii curses ascii isctrl12134297
Ref: 35d712134297
Ref: library/curses ascii curses ascii ismeta12134420
Ref: 35d812134420
Ref: library/curses ascii curses ascii ascii12135197
Ref: 35d912135197
Ref: library/curses ascii curses ascii ctrl12135316
Ref: 35da12135316
Ref: library/curses ascii curses ascii alt12135480
Ref: 35db12135480
Ref: library/curses ascii curses ascii unctrl12135769
Ref: 35dc12135769
Ref: library/curses ascii curses ascii controlnames12136455
Ref: 35dd12136455
Ref: curses ascii --- ASCII 文字のユーティリティー-Footnote-112136730
Node: curses panel --- curses のためのパネルスタック拡張12136802
Ref: library/curses panel doc12137107
Ref: 35de12137107
Ref: library/curses panel curses-panel-a-panel-stack-extension-for-curses12137107
Ref: 35df12137107
Ref: library/curses panel module-curses panel12137107
Ref: 3112137107
Ref: library/curses panel translation-repo12137107
Ref: 35e012137107
Node: 関数<7>12137748
Ref: library/curses panel cursespanel-functions12137890
Ref: 35e112137890
Ref: library/curses panel functions12137890
Ref: 35e212137890
Ref: library/curses panel curses panel bottom_panel12137985
Ref: 35e312137985
Ref: library/curses panel curses panel new_panel12138100
Ref: 35e412138100
Ref: library/curses panel curses panel top_panel12138534
Ref: 35e512138534
Ref: library/curses panel curses panel update_panels12138646
Ref: 35e612138646
Node: Panel オブジェクト12138926
Ref: library/curses panel curses-panel-objects12139068
Ref: 35e712139068
Ref: library/curses panel panel-objects12139068
Ref: 35e812139068
Ref: library/curses panel curses panel Panel above12139547
Ref: 35e912139547
Ref: library/curses panel curses panel Panel below12139648
Ref: 35ea12139648
Ref: library/curses panel curses panel Panel bottom12139749
Ref: 35eb12139749
Ref: library/curses panel curses panel Panel hidden12139854
Ref: 35ec12139854
Ref: library/curses panel curses panel Panel hide12140036
Ref: 35ed12140036
Ref: library/curses panel curses panel Panel move12140238
Ref: 35ee12140238
Ref: library/curses panel curses panel Panel replace12140350
Ref: 35ef12140350
Ref: library/curses panel curses panel Panel set_userptr12140475
Ref: 35f012140475
Ref: library/curses panel curses panel Panel show12140759
Ref: 35f112140759
Ref: library/curses panel curses panel Panel top12140856
Ref: 35f212140856
Ref: library/curses panel curses panel Panel userptr12140958
Ref: 35f312140958
Ref: library/curses panel curses panel Panel window12141096
Ref: 35f412141096
Node: cmd --- 行指向のコマンドインタープリターのサポート12141228
Ref: library/cmd doc12141468
Ref: 35f512141468
Ref: library/cmd cmd-support-for-line-oriented-command-interpreters12141468
Ref: 35f612141468
Ref: library/cmd module-cmd12141468
Ref: 1a12141468
Ref: library/cmd translation-repo12141468
Ref: 35f712141468
Ref: library/cmd cmd Cmd12142087
Ref: 184e12142087
Ref: cmd --- 行指向のコマンドインタープリターのサポート-Footnote-112144074
Node: Cmdオブジェクト12144137
Ref: library/cmd cmd-objects12144285
Ref: 35f912144285
Ref: library/cmd id112144285
Ref: 35fa12144285
Ref: library/cmd cmd Cmd cmdloop12144419
Ref: 35fb12144419
Ref: library/cmd cmd Cmd do_help12146756
Ref: 1a2b12146756
Ref: library/cmd cmd Cmd onecmd12147295
Ref: 35fe12147295
Ref: library/cmd cmd Cmd emptyline12147892
Ref: 360112147892
Ref: library/cmd cmd Cmd default12148178
Ref: 360012148178
Ref: library/cmd cmd Cmd completedefault12148463
Ref: 360212148463
Ref: library/cmd cmd Cmd columnize12148691
Ref: 1c0912148691
Ref: library/cmd cmd Cmd precmd12148933
Ref: 35ff12148933
Ref: library/cmd cmd Cmd postcmd12149590
Ref: 35fd12149590
Ref: library/cmd cmd Cmd preloop12150293
Ref: 360312150293
Ref: library/cmd cmd Cmd postloop12150594
Ref: 360412150594
Ref: library/cmd cmd Cmd prompt12151022
Ref: 360512151022
Ref: library/cmd cmd Cmd identchars12151116
Ref: 360612151116
Ref: library/cmd cmd Cmd lastcmd12151232
Ref: 360712151232
Ref: library/cmd cmd Cmd cmdqueue12151312
Ref: 360812151312
Ref: library/cmd cmd Cmd intro12151665
Ref: 35fc12151665
Ref: library/cmd cmd Cmd doc_header12151901
Ref: 360912151901
Ref: library/cmd cmd Cmd misc_header12152053
Ref: 360a12152053
Ref: library/cmd cmd Cmd undoc_header12152272
Ref: 360b12152272
Ref: library/cmd cmd Cmd ruler12152488
Ref: 360c12152488
Ref: library/cmd cmd Cmd use_rawinput12152738
Ref: 35f812152738
Node: Cmd の例12153214
Ref: library/cmd cmd-example12153362
Ref: 360d12153362
Ref: library/cmd id212153362
Ref: 360e12153362
Node: 並行実行12158735
Ref: library/concurrency doc12158938
Ref: 361012158938
Ref: library/concurrency concurrency12158938
Ref: 361112158938
Ref: library/concurrency concurrent-execution12158938
Ref: 361212158938
Ref: library/concurrency translation-repo12158938
Ref: 361312158938
Node: threading --- スレッドベースの並列処理12160442
Ref: library/threading doc12160606
Ref: 361412160606
Ref: library/threading module-threading12160606
Ref: f312160606
Ref: library/threading threading-thread-based-parallelism12160606
Ref: 361512160606
Ref: threading --- スレッドベースの並列処理-Footnote-112161445
Node: はじめに<8>12161514
Ref: library/threading introduction12161659
Ref: 361612161659
Ref: はじめに<8>-Footnote-112164734
Node: GIL and performance considerations12164791
Ref: library/threading gil-and-performance-considerations12164966
Ref: 361712164966
Ref: GIL and performance considerations-Footnote-112165757
Node: リファレンス<2>12165799
Ref: library/threading reference12166024
Ref: 361812166024
Ref: library/threading threading active_count12166141
Ref: 35f12166141
Ref: library/threading threading current_thread12166431
Ref: 35e12166431
Ref: library/threading threading excepthook12166821
Ref: a4b12166821
Ref: library/threading threading __excepthook__12168195
Ref: a4a12168195
Ref: library/threading threading get_ident12168472
Ref: 137212168472
Ref: library/threading threading get_native_id12168990
Ref: c3212168990
Ref: library/threading threading enumerate12169552
Ref: 1c5a12169552
Ref: library/threading threading main_thread12170067
Ref: 11d412170067
Ref: library/threading threading settrace12170326
Ref: a4812170326
Ref: library/threading threading settrace_all_threads12170583
Ref: 6ef12170583
Ref: library/threading threading gettrace12170938
Ref: a4612170938
Ref: library/threading threading setprofile12171095
Ref: a4912171095
Ref: library/threading threading setprofile_all_threads12171359
Ref: 6f012171359
Ref: library/threading threading getprofile12171721
Ref: a4712171721
Ref: library/threading threading stack_size12171894
Ref: 361912171894
Ref: library/threading threading TIMEOUT_MAX12173636
Ref: 361a12173636
Node: Thread-local data12175270
Ref: library/threading thread-local-data12175368
Ref: 361b12175368
Ref: library/threading threading local12178472
Ref: 185f12178472
Node: Thread objects12178571
Ref: library/threading id112178690
Ref: 361c12178690
Ref: library/threading thread-objects12178690
Ref: 361d12178690
Ref: library/threading threading Thread12182598
Ref: 17612182598
Ref: library/threading threading Thread start12185226
Ref: 17812185226
Ref: library/threading threading Thread run12186082
Ref: c3112186082
Ref: library/threading meth-thread-join12187026
Ref: 361e12187026
Ref: library/threading threading Thread join12187026
Ref: 13fd12187026
Ref: library/threading threading Thread name12188834
Ref: 2a012188834
Ref: library/threading threading Thread getName12189695
Ref: 362012189695
Ref: library/threading threading Thread setName12189729
Ref: 35d12189729
Ref: library/threading threading Thread ident12189954
Ref: 313712189954
Ref: library/threading threading Thread native_id12190440
Ref: c3312190440
Ref: library/threading threading Thread is_alive12191255
Ref: b4612191255
Ref: library/threading threading Thread daemon12191693
Ref: 35c12191693
Ref: library/threading threading Thread isDaemon12192486
Ref: 362112192486
Ref: library/threading threading Thread setDaemon12192521
Ref: 35b12192521
Node: Lock objects12192750
Ref: library/threading id212192865
Ref: 362212192865
Ref: library/threading lock-objects12192865
Ref: 362312192865
Ref: library/threading threading Lock12194944
Ref: 19f412194944
Ref: library/threading threading Lock acquire12195503
Ref: 8a712195503
Ref: library/threading threading Lock release12197300
Ref: 14da12197300
Ref: library/threading threading Lock locked12198041
Ref: 362512198041
Node: RLock objects12198141
Ref: library/threading id312198259
Ref: 362612198259
Ref: library/threading rlock-objects12198259
Ref: 362712198259
Ref: library/threading threading RLock12199838
Ref: 32e12199838
Ref: library/threading threading RLock acquire12200581
Ref: 107b12200581
Ref: library/threading threading RLock release12202613
Ref: 362812202613
Ref: library/threading threading RLock locked12203593
Ref: 183c12203593
Node: Condition objects12203751
Ref: library/threading condition-objects12203874
Ref: 362912203874
Ref: library/threading id412203874
Ref: 362a12203874
Ref: library/threading threading Condition12207931
Ref: 136d12207931
Ref: library/threading threading Condition acquire12208718
Ref: 362b12208718
Ref: library/threading threading Condition release12208981
Ref: 362c12208981
Ref: library/threading threading Condition locked12209210
Ref: 362e12209210
Ref: library/threading threading Condition wait12209368
Ref: 1c6612209368
Ref: library/threading threading Condition wait_for12211423
Ref: 362d12211423
Ref: library/threading threading Condition notify12212730
Ref: 1b6612212730
Ref: library/threading threading Condition notify_all12213973
Ref: 35912213973
Node: Semaphore objects12214484
Ref: library/threading id512214611
Ref: 362f12214611
Ref: library/threading semaphore-objects12214611
Ref: 363012214611
Ref: library/threading threading Semaphore12215512
Ref: 136e12215512
Ref: library/threading threading Semaphore acquire12216449
Ref: 146b12216449
Ref: library/threading threading Semaphore release12217915
Ref: 363112217915
Ref: library/threading threading BoundedSemaphore12218484
Ref: 136f12218484
Node: Semaphore example12219260
Ref: library/threading semaphore-example12219383
Ref: 363212219383
Ref: library/threading semaphore-examples12219383
Ref: 363312219383
Node: Event objects12220405
Ref: library/threading event-objects12220524
Ref: 363412220524
Ref: library/threading id612220524
Ref: 363512220524
Ref: library/threading threading Event12221093
Ref: 137012221093
Ref: library/threading threading Event is_set12221706
Ref: 35a12221706
Ref: library/threading threading Event set12221906
Ref: 363612221906
Ref: library/threading threading Event clear12222270
Ref: 363712222270
Ref: library/threading threading Event wait12222613
Ref: 153e12222613
Node: Timer objects12223385
Ref: library/threading id712223502
Ref: 363812223502
Ref: library/threading timer-objects12223502
Ref: 363912223502
Ref: library/threading threading Timer12224283
Ref: 137112224283
Ref: library/threading threading Timer cancel12224784
Ref: 363a12224784
Node: Barrier objects12225024
Ref: library/threading barrier-objects12225119
Ref: 363b12225119
Ref: library/threading threading Barrier12226247
Ref: 13fc12226247
Ref: library/threading threading Barrier wait12226748
Ref: 363c12226748
Ref: library/threading threading Barrier reset12228217
Ref: 363d12228217
Ref: library/threading threading Barrier abort12228826
Ref: 363e12228826
Ref: library/threading threading Barrier parties12229540
Ref: 363f12229540
Ref: library/threading threading Barrier n_waiting12229644
Ref: 364012229644
Ref: library/threading threading Barrier broken12229747
Ref: 364112229747
Ref: library/threading threading BrokenBarrierError12229870
Ref: 13fe12229870
Node: with 文でのロック・条件変数・セマフォの使い方12230097
Ref: library/threading using-locks-conditions-and-semaphores-in-the-with-statement12230279
Ref: 364212230279
Ref: library/threading with-locks12230279
Ref: 362412230279
Node: multiprocessing --- プロセスベースの並列処理12231174
Ref: library/multiprocessing doc12231441
Ref: 364312231441
Ref: library/multiprocessing module-multiprocessing12231441
Ref: 9812231441
Ref: library/multiprocessing multiprocessing-process-based-parallelism12231441
Ref: 364412231441
Ref: library/multiprocessing translation-repo12231441
Ref: 364512231441
Ref: multiprocessing --- プロセスベースの並列処理-Footnote-112232095
Node: はじめに<9>12232168
Ref: library/multiprocessing introduction12232306
Ref: 364612232306
Node: Process クラス12234395
Ref: library/multiprocessing the-process-class12234506
Ref: 364712234506
Node: コンテキストと開始方式12236057
Ref: library/multiprocessing contexts-and-start-methods12236222
Ref: 364912236222
Ref: library/multiprocessing multiprocessing-start-methods12236222
Ref: 1d512236222
Ref: library/multiprocessing multiprocessing-start-method-spawn12236415
Ref: 1d812236415
Ref: library/multiprocessing multiprocessing-start-method-fork12237036
Ref: 1d712237036
Ref: library/multiprocessing multiprocessing-start-method-forkserver12238190
Ref: 1d412238190
Ref: コンテキストと開始方式-Footnote-112242656
Ref: コンテキストと開始方式-Footnote-212242721
Node: プロセス間でのオブジェクト交換12242776
Ref: library/multiprocessing exchanging-objects-between-processes12242948
Ref: 364b12242948
Node: プロセス間の同期12245200
Ref: library/multiprocessing synchronization-between-processes12245375
Ref: 364d12245375
Node: プロセス間での状態の共有12246126
Ref: library/multiprocessing sharing-state-between-processes12246301
Ref: 364e12246301
Node: ワーカープロセスのプールを使用12250578
Ref: library/multiprocessing using-a-pool-of-workers12250720
Ref: 365612250720
Node: リファレンス<3>12254441
Ref: library/multiprocessing reference12254627
Ref: 365712254627
Node: Global start method12255312
Ref: library/multiprocessing global-start-method12255424
Ref: 365812255424
Ref: library/multiprocessing id112255424
Ref: 365912255424
Node: Process クラスと例外12256041
Ref: library/multiprocessing process-and-exceptions12256195
Ref: 365a12256195
Ref: library/multiprocessing multiprocessing Process12256272
Ref: 25212256272
Ref: library/multiprocessing multiprocessing Process run12259563
Ref: 364a12259563
Ref: library/multiprocessing multiprocessing Process start12260599
Ref: 15a912260599
Ref: library/multiprocessing multiprocessing Process join12260965
Ref: 15ab12260965
Ref: library/multiprocessing multiprocessing Process name12261959
Ref: 365b12261959
Ref: library/multiprocessing multiprocessing Process is_alive12262571
Ref: 15aa12262571
Ref: library/multiprocessing multiprocessing Process daemon12262884
Ref: 365c12262884
Ref: library/multiprocessing multiprocessing Process pid12264176
Ref: 365f12264176
Ref: library/multiprocessing multiprocessing Process exitcode12264325
Ref: 365e12264325
Ref: library/multiprocessing multiprocessing Process authkey12264922
Ref: 366012264922
Ref: library/multiprocessing multiprocessing Process sentinel12265502
Ref: 12f912265502
Ref: library/multiprocessing multiprocessing Process interrupt12266164
Ref: 25112266164
Ref: library/multiprocessing multiprocessing Process terminate12267086
Ref: 185712267086
Ref: library/multiprocessing multiprocessing Process kill12268130
Ref: d4f12268130
Ref: library/multiprocessing multiprocessing Process close12268294
Ref: d4e12268294
Ref: library/multiprocessing multiprocessing ProcessError12269729
Ref: 366212269729
Ref: library/multiprocessing multiprocessing BufferTooShort12269833
Ref: 366312269833
Ref: library/multiprocessing multiprocessing AuthenticationError12270196
Ref: 366412270196
Ref: library/multiprocessing multiprocessing TimeoutError12270309
Ref: 366512270309
Ref: Process クラスと例外-Footnote-112270514
Node: パイプ Pipe とキュー Queue12270570
Ref: library/multiprocessing pipes-and-queues12270717
Ref: 366612270717
Ref: library/multiprocessing multiprocessing Pipe12275855
Ref: 364c12275855
Ref: library/multiprocessing multiprocessing Queue12276433
Ref: 1b8912276433
Ref: library/multiprocessing multiprocessing Queue qsize12277322
Ref: 367112277322
Ref: library/multiprocessing multiprocessing Queue empty12277697
Ref: 196812277697
Ref: library/multiprocessing multiprocessing Queue full12278057
Ref: 367212278057
Ref: library/multiprocessing multiprocessing Queue put12278329
Ref: 1e1d12278329
Ref: library/multiprocessing multiprocessing Queue put_nowait12279346
Ref: 367312279346
Ref: library/multiprocessing multiprocessing Queue get12279439
Ref: 1e1e12279439
Ref: library/multiprocessing multiprocessing Queue get_nowait12280383
Ref: 366e12280383
Ref: library/multiprocessing multiprocessing Queue close12280685
Ref: 1b8a12280685
Ref: library/multiprocessing multiprocessing Queue join_thread12281150
Ref: 367412281150
Ref: library/multiprocessing multiprocessing Queue cancel_join_thread12281953
Ref: 366f12281953
Ref: library/multiprocessing multiprocessing SimpleQueue12283538
Ref: b1012283538
Ref: library/multiprocessing multiprocessing SimpleQueue close12283836
Ref: b1112283836
Ref: library/multiprocessing multiprocessing SimpleQueue empty12284153
Ref: 196912284153
Ref: library/multiprocessing multiprocessing SimpleQueue get12284391
Ref: 367512284391
Ref: library/multiprocessing multiprocessing SimpleQueue put12284485
Ref: 367612284485
Ref: library/multiprocessing multiprocessing JoinableQueue12284572
Ref: 366712284572
Ref: library/multiprocessing multiprocessing JoinableQueue task_done12284958
Ref: 366a12284958
Ref: library/multiprocessing multiprocessing JoinableQueue join12285875
Ref: 367712285875
Ref: パイプ Pipe とキュー Queue-Footnote-112286486
Node: その他<5>12286550
Ref: library/multiprocessing miscellaneous12286703
Ref: 367812286703
Ref: library/multiprocessing multiprocessing active_children12286741
Ref: 367912286741
Ref: library/multiprocessing multiprocessing cpu_count12287030
Ref: 117112287030
Ref: library/multiprocessing multiprocessing current_process12287775
Ref: 367a12287775
Ref: library/multiprocessing multiprocessing parent_process12288011
Ref: 367b12288011
Ref: library/multiprocessing multiprocessing freeze_support12288281
Ref: 183b12288281
Ref: library/multiprocessing multiprocessing get_all_start_methods12289354
Ref: 116b12289354
Ref: library/multiprocessing multiprocessing get_context12289717
Ref: 24a12289717
Ref: library/multiprocessing multiprocessing get_start_method12290367
Ref: 116c12290367
Ref: library/multiprocessing multiprocessing set_executable12291195
Ref: 1b9012291195
Ref: library/multiprocessing multiprocessing set_forkserver_preload12291816
Ref: 190812291816
Ref: library/multiprocessing multiprocessing set_start_method12292535
Ref: 24b12292535
Ref: その他<5>-Footnote-112293695
Node: Connection オブジェクト<2>12293760
Ref: library/multiprocessing connection-objects12293904
Ref: 367c12293904
Ref: library/multiprocessing multiprocessing connection Connection12294420
Ref: 12f812294420
Ref: library/multiprocessing multiprocessing connection Connection send12294474
Ref: 367e12294474
Ref: library/multiprocessing multiprocessing connection Connection recv12294931
Ref: 367f12294931
Ref: library/multiprocessing multiprocessing connection Connection fileno12295304
Ref: 368012295304
Ref: library/multiprocessing multiprocessing connection Connection close12295443
Ref: 368112295443
Ref: library/multiprocessing multiprocessing connection Connection poll12295655
Ref: 368212295655
Ref: library/multiprocessing multiprocessing connection Connection send_bytes12296306
Ref: 368312296306
Ref: library/multiprocessing multiprocessing connection Connection recv_bytes12296917
Ref: 368412296917
Ref: library/multiprocessing multiprocessing connection Connection recv_bytes_into12297748
Ref: 368512297748
Ref: library/multiprocessing multiprocessing-recv-pickle-security12299775
Ref: 368612299775
Node: 同期プリミティブ12300648
Ref: library/multiprocessing synchronization-primitives12300812
Ref: 368712300812
Ref: library/multiprocessing multiprocessing Barrier12301336
Ref: 365512301336
Ref: library/multiprocessing multiprocessing BoundedSemaphore12301660
Ref: 365312301660
Ref: library/multiprocessing multiprocessing BoundedSemaphore locked12302190
Ref: 368912302190
Ref: library/multiprocessing multiprocessing Condition12302499
Ref: 365412302499
Ref: library/multiprocessing multiprocessing Event12302983
Ref: 1c0612302983
Ref: library/multiprocessing multiprocessing Lock12303206
Ref: 185312303206
Ref: library/multiprocessing multiprocessing Lock acquire12304492
Ref: 368812304492
Ref: library/multiprocessing multiprocessing Lock release12306211
Ref: 368a12306211
Ref: library/multiprocessing multiprocessing Lock locked12306671
Ref: 187712306671
Ref: library/multiprocessing multiprocessing RLock12306829
Ref: 185412306829
Ref: library/multiprocessing multiprocessing RLock acquire12307942
Ref: 368b12307942
Ref: library/multiprocessing multiprocessing RLock release12310190
Ref: 368c12310190
Ref: library/multiprocessing multiprocessing RLock locked12311576
Ref: 187812311576
Ref: library/multiprocessing multiprocessing Semaphore12311734
Ref: 365212311734
Ref: library/multiprocessing multiprocessing Semaphore get_value12312247
Ref: 368d12312247
Ref: library/multiprocessing multiprocessing Semaphore locked12312493
Ref: 368e12312493
Ref: 同期プリミティブ-Footnote-112313425
Node: 共有 ctypes オブジェクト12313489
Ref: library/multiprocessing shared-ctypes-objects12313639
Ref: 368f12313639
Ref: library/multiprocessing multiprocessing Value12313861
Ref: 364f12313861
Ref: library/multiprocessing multiprocessing Array12315659
Ref: 365012315659
Node: The multiprocessing sharedctypes module12317449
Ref: library/multiprocessing module-multiprocessing sharedctypes12317557
Ref: 9e12317557
Ref: library/multiprocessing the-multiprocessing-sharedctypes-module12317557
Ref: 369012317557
Ref: library/multiprocessing multiprocessing sharedctypes RawArray12318351
Ref: 369112318351
Ref: library/multiprocessing multiprocessing sharedctypes RawValue12319415
Ref: 369312319415
Ref: library/multiprocessing multiprocessing sharedctypes Array12320431
Ref: 369212320431
Ref: library/multiprocessing multiprocessing sharedctypes Value12321535
Ref: 369412321535
Ref: library/multiprocessing multiprocessing sharedctypes copy12322634
Ref: 369512322634
Ref: library/multiprocessing multiprocessing sharedctypes synchronized12322832
Ref: 103112322832
Node: マネージャー12326519
Ref: library/multiprocessing managers12326669
Ref: 369612326669
Ref: library/multiprocessing multiprocessing-managers12326669
Ref: 366b12326669
Ref: library/multiprocessing multiprocessing Manager12327185
Ref: 25012327185
Ref: library/multiprocessing module-multiprocessing managers12327647
Ref: 9b12327647
Ref: library/multiprocessing multiprocessing managers BaseManager12327884
Ref: 369712327884
Ref: library/multiprocessing multiprocessing managers BaseManager start12329680
Ref: 369812329680
Ref: library/multiprocessing multiprocessing managers BaseManager get_server12329986
Ref: 369a12329986
Ref: library/multiprocessing multiprocessing managers BaseManager connect12330599
Ref: 369c12330599
Ref: library/multiprocessing multiprocessing managers BaseManager shutdown12330915
Ref: 369912330915
Ref: library/multiprocessing multiprocessing managers BaseManager register12331241
Ref: 369d12331241
Ref: library/multiprocessing multiprocessing managers BaseManager address12334219
Ref: 369b12334219
Ref: library/multiprocessing multiprocessing managers SyncManager12335040
Ref: 189412335040
Ref: library/multiprocessing multiprocessing managers SyncManager Barrier12335521
Ref: 36a012335521
Ref: library/multiprocessing multiprocessing managers SyncManager BoundedSemaphore12335750
Ref: 36a112335750
Ref: library/multiprocessing multiprocessing managers SyncManager Condition12335943
Ref: 36a212335943
Ref: library/multiprocessing multiprocessing managers SyncManager Event12336412
Ref: 36a312336412
Ref: library/multiprocessing multiprocessing managers SyncManager Lock12336576
Ref: 15af12336576
Ref: library/multiprocessing multiprocessing managers SyncManager Namespace12336738
Ref: 36a412336738
Ref: library/multiprocessing multiprocessing managers SyncManager Queue12336900
Ref: 31c412336900
Ref: library/multiprocessing multiprocessing managers SyncManager RLock12337069
Ref: 15b012337069
Ref: library/multiprocessing multiprocessing managers SyncManager Semaphore12337232
Ref: 15b112337232
Ref: library/multiprocessing multiprocessing managers SyncManager Array12337411
Ref: 36a512337411
Ref: library/multiprocessing multiprocessing managers SyncManager Value12337534
Ref: 36a612337534
Ref: library/multiprocessing multiprocessing managers SyncManager dict12337699
Ref: 36a712337699
Ref: library/multiprocessing multiprocessing managers SyncManager list12337929
Ref: 36a812337929
Ref: library/multiprocessing multiprocessing managers SyncManager set12338120
Ref: 24f12338120
Ref: library/multiprocessing multiprocessing managers Namespace12338703
Ref: 365112338703
Node: カスタマイズされたマネージャー12339731
Ref: library/multiprocessing customized-managers12339885
Ref: 36a912339885
Node: リモートマネージャーを使用する12340792
Ref: library/multiprocessing using-a-remote-manager12340946
Ref: 36aa12340946
Node: Proxy オブジェクト12343422
Ref: library/multiprocessing multiprocessing-proxy-objects12343561
Ref: 24c12343561
Ref: library/multiprocessing proxy-objects12343561
Ref: 36ab12343561
Ref: library/multiprocessing multiprocessing managers BaseProxy12347537
Ref: 369e12347537
Ref: library/multiprocessing multiprocessing managers BaseProxy _callmethod12347706
Ref: 369f12347706
Ref: library/multiprocessing multiprocessing managers BaseProxy _getvalue12349479
Ref: 36ac12349479
Ref: library/multiprocessing multiprocessing managers BaseProxy __repr__12349652
Ref: 36ad12349652
Ref: library/multiprocessing multiprocessing managers BaseProxy __str__12349775
Ref: 36ae12349775
Node: クリーンアップ<2>12349940
Ref: library/multiprocessing cleanup12350025
Ref: 36af12350025
Node: プロセスプール12350504
Ref: library/multiprocessing module-multiprocessing pool12350658
Ref: 9c12350658
Ref: library/multiprocessing process-pools12350658
Ref: 36b012350658
Ref: library/multiprocessing multiprocessing pool Pool12350836
Ref: 116d12350836
Ref: library/multiprocessing multiprocessing pool Pool apply12354194
Ref: 15ad12354194
Ref: library/multiprocessing multiprocessing pool Pool apply_async12354645
Ref: 15ae12354645
Ref: library/multiprocessing multiprocessing pool Pool map12355792
Ref: 12fb12355792
Ref: library/multiprocessing multiprocessing pool Pool map_async12356725
Ref: 12fc12356725
Ref: library/multiprocessing multiprocessing pool Pool imap12357875
Ref: 36b412357875
Ref: library/multiprocessing multiprocessing pool Pool imap_unordered12358750
Ref: 36b512358750
Ref: library/multiprocessing multiprocessing pool Pool starmap12359113
Ref: 12fd12359113
Ref: library/multiprocessing multiprocessing pool Pool starmap_async12359559
Ref: 12fe12359559
Ref: library/multiprocessing multiprocessing pool Pool close12360050
Ref: 36b112360050
Ref: library/multiprocessing multiprocessing pool Pool terminate12360268
Ref: 36b212360268
Ref: library/multiprocessing multiprocessing pool Pool join12360556
Ref: 36b612360556
Ref: library/multiprocessing multiprocessing pool AsyncResult12361247
Ref: 36b312361247
Ref: library/multiprocessing multiprocessing pool AsyncResult get12361417
Ref: 36b712361417
Ref: library/multiprocessing multiprocessing pool AsyncResult wait12361855
Ref: 36b812361855
Ref: library/multiprocessing multiprocessing pool AsyncResult ready12361982
Ref: 36b912361982
Ref: library/multiprocessing multiprocessing pool AsyncResult successful12362096
Ref: 36ba12362096
Node: リスナーとクライアント12363466
Ref: library/multiprocessing listeners-and-clients12363608
Ref: 36bb12363608
Ref: library/multiprocessing module-multiprocessing connection12363608
Ref: 9912363608
Ref: library/multiprocessing multiprocessing-listeners-clients12363608
Ref: 367d12363608
Ref: library/multiprocessing multiprocessing connection deliver_challenge12364192
Ref: 36bc12364192
Ref: library/multiprocessing multiprocessing connection answer_challenge12364700
Ref: 36bd12364700
Ref: library/multiprocessing multiprocessing connection Client12365094
Ref: 36be12365094
Ref: library/multiprocessing multiprocessing connection Listener12365954
Ref: 1a2312365954
Ref: library/multiprocessing multiprocessing connection Listener accept12368081
Ref: 19df12368081
Ref: library/multiprocessing multiprocessing connection Listener close12368430
Ref: 36c012368430
Ref: library/multiprocessing multiprocessing connection Listener address12368894
Ref: 36c112368894
Ref: library/multiprocessing multiprocessing connection Listener last_accepted12369001
Ref: 36c212369001
Ref: library/multiprocessing multiprocessing connection wait12369628
Ref: 12f712369628
Node: アドレスフォーマット12373998
Ref: library/multiprocessing address-formats12374098
Ref: 36c312374098
Ref: library/multiprocessing multiprocessing-address-formats12374098
Ref: 36bf12374098
Node: 認証キー12375006
Ref: library/multiprocessing authentication-keys12375142
Ref: 36c412375142
Ref: library/multiprocessing multiprocessing-auth-keys12375142
Ref: 366112375142
Node: ログ記録<2>12376690
Ref: library/multiprocessing logging12376825
Ref: 36c512376825
Ref: library/multiprocessing multiprocessing get_logger12377192
Ref: 321f12377192
Ref: library/multiprocessing multiprocessing log_to_stderr12377766
Ref: 36c612377766
Node: The multiprocessing dummy module12379036
Ref: library/multiprocessing module-multiprocessing dummy12379150
Ref: 9a12379150
Ref: library/multiprocessing the-multiprocessing-dummy-module12379150
Ref: 36c712379150
Ref: library/multiprocessing multiprocessing pool ThreadPool12379660
Ref: 1cd412379660
Node: プログラミングガイドライン12381458
Ref: library/multiprocessing multiprocessing-programming12381642
Ref: 364812381642
Ref: library/multiprocessing programming-guidelines12381642
Ref: 36c812381642
Node: すべての開始方式について12381940
Ref: library/multiprocessing all-start-methods12382113
Ref: 36c912382113
Ref: library/multiprocessing multiprocessing-programming-spawn12389281
Ref: 365d12389281
Ref: すべての開始方式について-Footnote-112389318
Ref: すべての開始方式について-Footnote-212389382
Ref: すべての開始方式について-Footnote-312389446
Node: 開始方式が spawn および forkserver の場合12389510
Ref: library/multiprocessing multiprocessing-programming-forkserver12389683
Ref: 1d912389683
Ref: library/multiprocessing the-spawn-and-forkserver-start-methods12389683
Ref: 36ca12389683
Ref: library/multiprocessing multiprocessing-safe-main-import12390599
Ref: 36cb12390599
Node: 使用例<21>12392107
Ref: library/multiprocessing examples12392261
Ref: 36cc12392261
Ref: library/multiprocessing multiprocessing-examples12392261
Ref: 367012392261
Node: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ12401280
Ref: library/multiprocessing shared_memory doc12401523
Ref: 36cd12401523
Ref: library/multiprocessing shared_memory module-multiprocessing shared_memory12401523
Ref: 9d12401523
Ref: library/multiprocessing shared_memory multiprocessing-shared-memory-shared-memory-for-direct-access-across-processes12401523
Ref: 36ce12401523
Ref: library/multiprocessing shared_memory translation-repo12401523
Ref: 36cf12401523
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory12403215
Ref: 19d812403215
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory close12406529
Ref: 36d112406529
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory unlink12407012
Ref: 36d212407012
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory buf12407638
Ref: 36d312407638
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory name12407727
Ref: 36d412407727
Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory size12407838
Ref: 36d512407838
Ref: library/multiprocessing shared_memory multiprocessing managers SharedMemoryManager12410928
Ref: 36d012410928
Ref: library/multiprocessing shared_memory multiprocessing managers SharedMemoryManager SharedMemory12412332
Ref: 36d612412332
Ref: library/multiprocessing shared_memory multiprocessing managers SharedMemoryManager ShareableList12412490
Ref: 36d712412490
Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList12414351
Ref: 1d5812414351
Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList count12416851
Ref: 36d812416851
Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList index12416945
Ref: 36d912416945
Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList format12417101
Ref: 36da12417101
Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList shm12417255
Ref: 36db12417255
Ref: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ-Footnote-112419846
Ref: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ-Footnote-212419936
Ref: multiprocessing shared_memory --- プロセス間で直接アクセス可能な共有メモリ-Footnote-312419963
Node: concurrent パッケージ12420019
Ref: library/concurrent doc12420250
Ref: 36dc12420250
Ref: library/concurrent the-concurrent-package12420250
Ref: 36dd12420250
Ref: library/concurrent translation-repo12420250
Ref: 36de12420250
Node: concurrent futures --- 並列タスク実行12420518
Ref: library/concurrent futures doc12420724
Ref: 36df12420724
Ref: library/concurrent futures concurrent-futures-launching-parallel-tasks12420724
Ref: 36e012420724
Ref: library/concurrent futures module-concurrent futures12420724
Ref: 2412420724
Ref: library/concurrent futures translation-repo12420724
Ref: 36e112420724
Ref: concurrent futures --- 並列タスク実行-Footnote-112422197
Ref: concurrent futures --- 並列タスク実行-Footnote-212422283
Ref: concurrent futures --- 並列タスク実行-Footnote-312422370
Node: Executor オブジェクト12422461
Ref: library/concurrent futures executor-objects12422596
Ref: 36e412422596
Ref: library/concurrent futures concurrent futures Executor12422665
Ref: 36e212422665
Ref: library/concurrent futures concurrent futures Executor submit12422914
Ref: c7512422914
Ref: library/concurrent futures concurrent futures Executor map12423420
Ref: 1dc12423420
Ref: library/concurrent futures concurrent futures Executor shutdown12425459
Ref: aea12425459
Node: ThreadPoolExecutor12427841
Ref: library/concurrent futures threadpoolexecutor12428008
Ref: 36e512428008
Ref: library/concurrent futures concurrent futures ThreadPoolExecutor12429179
Ref: 94912429179
Node: ThreadPoolExecutor の例12431792
Ref: library/concurrent futures id112431872
Ref: 36e712431872
Ref: library/concurrent futures threadpoolexecutor-example12431872
Ref: 13cb12431872
Node: InterpreterPoolExecutor12433076
Ref: library/concurrent futures interpreterpoolexecutor12433235
Ref: 36e812433235
Ref: library/concurrent futures concurrent futures InterpreterPoolExecutor12435949
Ref: 1d212435949
Ref: InterpreterPoolExecutor-Footnote-112437944
Node: ProcessPoolExecutor12437986
Ref: library/concurrent futures processpoolexecutor12438152
Ref: 36ea12438152
Ref: library/concurrent futures concurrent futures ProcessPoolExecutor12439380
Ref: 1d612439380
Ref: library/concurrent futures concurrent futures ProcessPoolExecutor terminate_workers12443237
Ref: 1da12443237
Ref: library/concurrent futures concurrent futures ProcessPoolExecutor kill_workers12443729
Ref: 1db12443729
Ref: ProcessPoolExecutor-Footnote-112444283
Node: ProcessPoolExecutor の例12444339
Ref: library/concurrent futures id212444421
Ref: 36ec12444421
Ref: library/concurrent futures processpoolexecutor-example12444421
Ref: 13cc12444421
Node: Future オブジェクト12445323
Ref: library/concurrent futures future-objects12445490
Ref: 36ed12445490
Ref: library/concurrent futures concurrent futures Future12445783
Ref: 13ca12445783
Ref: library/concurrent futures concurrent futures Future cancel12446084
Ref: 36ee12446084
Ref: library/concurrent futures concurrent futures Future cancelled12446389
Ref: 36ef12446389
Ref: library/concurrent futures concurrent futures Future running12446522
Ref: 36f012446522
Ref: library/concurrent futures concurrent futures Future done12446676
Ref: 36f112446676
Ref: library/concurrent futures concurrent futures Future result12446830
Ref: 36f212446830
Ref: library/concurrent futures concurrent futures Future exception12447636
Ref: 36f312447636
Ref: library/concurrent futures concurrent futures Future add_done_callback12448469
Ref: 36f412448469
Ref: library/concurrent futures concurrent futures Future set_running_or_notify_cancel12449638
Ref: 36f512449638
Ref: library/concurrent futures concurrent futures Future set_result12450902
Ref: 36f612450902
Ref: library/concurrent futures concurrent futures Future set_exception12451394
Ref: 36f712451394
Node: モジュール関数<2>12451916
Ref: library/concurrent futures module-functions12452079
Ref: 36f812452079
Ref: library/concurrent futures concurrent futures wait12452135
Ref: 1c0512452135
Ref: library/concurrent futures concurrent futures FIRST_COMPLETED12453514
Ref: 36f912453514
Ref: library/concurrent futures concurrent futures FIRST_EXCEPTION12453857
Ref: 36fa12453857
Ref: library/concurrent futures concurrent futures ALL_COMPLETED12454381
Ref: 36fb12454381
Ref: library/concurrent futures concurrent futures as_completed12454609
Ref: 19c712454609
Ref: モジュール関数<2>-Footnote-112455631
Node: 例外クラス12455673
Ref: library/concurrent futures exception-classes12455802
Ref: 36fc12455802
Ref: library/concurrent futures concurrent futures CancelledError12455848
Ref: bce12455848
Ref: library/concurrent futures concurrent futures TimeoutError12455966
Ref: 36fd12455966
Ref: library/concurrent futures concurrent futures BrokenExecutor12456255
Ref: 36fe12456255
Ref: library/concurrent futures concurrent futures InvalidStateError12456510
Ref: 195112456510
Ref: library/concurrent futures concurrent futures thread BrokenThreadPool12456691
Ref: 36e612456691
Ref: library/concurrent futures concurrent futures interpreter BrokenInterpreterPool12456948
Ref: 36ff12456948
Ref: library/concurrent futures concurrent futures process BrokenProcessPool12457223
Ref: 36eb12457223
Node: concurrent interpreters --- Multiple interpreters in the same process12457588
Ref: library/concurrent interpreters doc12457807
Ref: 370012457807
Ref: library/concurrent interpreters concurrent-interpreters-multiple-interpreters-in-the-same-process12457807
Ref: 370112457807
Ref: library/concurrent interpreters module-concurrent interpreters12457807
Ref: 2512457807
Ref: library/concurrent interpreters translation-repo12457807
Ref: 370212457807
Ref: library/concurrent interpreters interp-concurrency12458719
Ref: 370312458719
Ref: concurrent interpreters --- Multiple interpreters in the same process-Footnote-112459404
Ref: concurrent interpreters --- Multiple interpreters in the same process-Footnote-212459485
Ref: concurrent interpreters --- Multiple interpreters in the same process-Footnote-312459527
Ref: concurrent interpreters --- Multiple interpreters in the same process-Footnote-412459569
Node: Key details12459611
Ref: library/concurrent interpreters key-details12459753
Ref: 370412459753
Ref: library/concurrent interpreters interp-isolation12459937
Ref: 370512459937
Node: はじめに<10>12460046
Ref: library/concurrent interpreters interpreters-intro12460218
Ref: 370612460218
Ref: library/concurrent interpreters introduction12460218
Ref: 370712460218
Node: Multiple Interpreters and Isolation12461068
Ref: library/concurrent interpreters multiple-interpreters-and-isolation12461190
Ref: 370812461190
Node: Running in an Interpreter12462164
Ref: library/concurrent interpreters running-in-an-interpreter12462322
Ref: 370912462322
Ref: library/concurrent interpreters interp-call-in-thread12462824
Ref: 370a12462824
Node: Concurrency and Parallelism12463270
Ref: library/concurrent interpreters concurrency-and-parallelism12463427
Ref: 370b12463427
Node: Communication Between Interpreters12465000
Ref: library/concurrent interpreters communication-between-interpreters12465149
Ref: 370c12465149
Node: "Sharing" Objects12465610
Ref: library/concurrent interpreters interp-object-sharing12465723
Ref: 370e12465723
Ref: library/concurrent interpreters sharing-objects12465723
Ref: 370f12465723
Node: リファレンス<4>12466750
Ref: library/concurrent interpreters reference12466935
Ref: 371112466935
Ref: library/concurrent interpreters concurrent interpreters list_all12467052
Ref: 371212467052
Ref: library/concurrent interpreters concurrent interpreters get_current12467213
Ref: 371412467213
Ref: library/concurrent interpreters concurrent interpreters get_main12467360
Ref: 371512467360
Ref: library/concurrent interpreters concurrent interpreters create12467643
Ref: 17bc12467643
Ref: library/concurrent interpreters concurrent interpreters create_queue12467800
Ref: 370d12467800
Node: Interpreter objects12468050
Ref: library/concurrent interpreters interpreter-objects12468146
Ref: 371612468146
Ref: library/concurrent interpreters concurrent interpreters Interpreter12468205
Ref: 371312468205
Ref: library/concurrent interpreters concurrent interpreters Interpreter id12468468
Ref: 371712468468
Ref: library/concurrent interpreters concurrent interpreters Interpreter whence12468559
Ref: 371812468559
Ref: library/concurrent interpreters concurrent interpreters Interpreter is_running12468674
Ref: 371912468674
Ref: library/concurrent interpreters concurrent interpreters Interpreter close12468854
Ref: 17d112468854
Ref: library/concurrent interpreters concurrent interpreters Interpreter prepare_main12468936
Ref: 371a12468936
Ref: library/concurrent interpreters concurrent interpreters Interpreter exec12469236
Ref: 371b12469236
Ref: library/concurrent interpreters concurrent interpreters Interpreter call12469379
Ref: 371c12469379
Ref: library/concurrent interpreters concurrent interpreters Interpreter call_in_thread12469560
Ref: 371d12469560
Node: 例外<13>12469702
Ref: library/concurrent interpreters exceptions12469841
Ref: 371e12469841
Ref: library/concurrent interpreters concurrent interpreters InterpreterError12469874
Ref: 371f12469874
Ref: library/concurrent interpreters concurrent interpreters InterpreterNotFoundError12470044
Ref: 372012470044
Ref: library/concurrent interpreters concurrent interpreters ExecutionFailed12470235
Ref: 36e912470235
Ref: library/concurrent interpreters concurrent interpreters ExecutionFailed excinfo12470421
Ref: 372112470421
Ref: library/concurrent interpreters concurrent interpreters NotShareableError12470538
Ref: 372212470538
Node: Communicating Between Interpreters12470720
Ref: library/concurrent interpreters communicating-between-interpreters12470831
Ref: 372312470831
Ref: library/concurrent interpreters concurrent interpreters Queue12470922
Ref: 371012470922
Ref: library/concurrent interpreters concurrent interpreters Queue id12471339
Ref: 372412471339
Ref: library/concurrent interpreters concurrent interpreters QueueEmptyError12471413
Ref: 372512471413
Ref: library/concurrent interpreters concurrent interpreters QueueFullError12471624
Ref: 372612471624
Node: 基本的な使い方<3>12471827
Ref: library/concurrent interpreters basic-usage12471987
Ref: 372712471987
Node: subprocess --- サブプロセス管理12472655
Ref: library/subprocess doc12472873
Ref: 372812472873
Ref: library/subprocess module-subprocess12472873
Ref: dc12472873
Ref: library/subprocess subprocess-subprocess-management12472873
Ref: 372912472873
Ref: library/subprocess translation-repo12472873
Ref: 372a12472873
Ref: subprocess --- サブプロセス管理-Footnote-112474131
Ref: subprocess --- サブプロセス管理-Footnote-212474201
Node: Using the subprocess Module12474243
Ref: library/subprocess using-the-subprocess-module12474397
Ref: 372b12474397
Ref: library/subprocess subprocess run12474760
Ref: d7f12474760
Ref: library/subprocess subprocess CompletedProcess12480169
Ref: 107312480169
Ref: library/subprocess subprocess CompletedProcess args12480304
Ref: 372e12480304
Ref: library/subprocess subprocess CompletedProcess returncode12480469
Ref: 372f12480469
Ref: library/subprocess subprocess CompletedProcess stdout12480812
Ref: 373012480812
Ref: library/subprocess subprocess CompletedProcess stderr12481442
Ref: 373112481442
Ref: library/subprocess subprocess CompletedProcess check_returncode12481837
Ref: 373212481837
Ref: library/subprocess subprocess DEVNULL12482035
Ref: 136612482035
Ref: library/subprocess subprocess PIPE12482300
Ref: d8012482300
Ref: library/subprocess subprocess STDOUT12482580
Ref: 372d12482580
Ref: library/subprocess subprocess SubprocessError12482802
Ref: 373312482802
Ref: library/subprocess subprocess TimeoutExpired12482961
Ref: 17ab12482961
Ref: library/subprocess subprocess TimeoutExpired cmd12483183
Ref: 373412483183
Ref: library/subprocess subprocess TimeoutExpired timeout12483283
Ref: 373512483283
Ref: library/subprocess subprocess TimeoutExpired output12483351
Ref: 373612483351
Ref: library/subprocess subprocess TimeoutExpired stdout12483841
Ref: 373712483841
Ref: library/subprocess subprocess TimeoutExpired stderr12483944
Ref: 373812483944
Ref: library/subprocess subprocess CalledProcessError12484579
Ref: 153c12484579
Ref: library/subprocess subprocess CalledProcessError returncode12484944
Ref: 373a12484944
Ref: library/subprocess subprocess CalledProcessError cmd12485164
Ref: 373b12485164
Ref: library/subprocess subprocess CalledProcessError output12485264
Ref: 373c12485264
Ref: library/subprocess subprocess CalledProcessError stdout12485493
Ref: 373d12485493
Ref: library/subprocess subprocess CalledProcessError stderr12485596
Ref: 373e12485596
Node: よく使われる引数12485993
Ref: library/subprocess frequently-used-arguments12486120
Ref: 372c12486120
Ref: library/subprocess id112486120
Ref: 373f12486120
Node: Popen コンストラクター12491048
Ref: library/subprocess popen-constructor12491194
Ref: 374412491194
Ref: library/subprocess subprocess Popen12491594
Ref: 4b712491594
Ref: Popen コンストラクター-Footnote-112511687
Node: 例外<14>12511747
Ref: library/subprocess exceptions12511860
Ref: 375512511860
Node: セキュリティで考慮すべき点<2>12513225
Ref: library/subprocess security-considerations12513412
Ref: 374312513412
Ref: library/subprocess subprocess-security12513412
Ref: 375612513412
Ref: セキュリティで考慮すべき点<2>-Footnote-112514545
Ref: セキュリティで考慮すべき点<2>-Footnote-212514615
Node: Popen オブジェクト12514671
Ref: library/subprocess popen-objects12514857
Ref: 375812514857
Ref: library/subprocess subprocess Popen poll12515026
Ref: 375912515026
Ref: library/subprocess subprocess Popen wait12515248
Ref: ee012515248
Ref: library/subprocess subprocess Popen communicate12516442
Ref: 17aa12516442
Ref: library/subprocess subprocess Popen send_signal12518964
Ref: 15f712518964
Ref: library/subprocess subprocess Popen terminate12519387
Ref: 15f512519387
Ref: library/subprocess subprocess Popen kill12519612
Ref: 15f612519612
Ref: library/subprocess subprocess Popen args12519973
Ref: 375a12519973
Ref: library/subprocess subprocess Popen stdin12520181
Ref: 374012520181
Ref: library/subprocess subprocess Popen stdout12520622
Ref: 374112520622
Ref: library/subprocess subprocess Popen stderr12521135
Ref: 374212521135
Ref: library/subprocess subprocess Popen pid12522003
Ref: 375b12522003
Ref: library/subprocess subprocess Popen returncode12522217
Ref: c8312522217
Node: Windows Popen ヘルパー12522748
Ref: library/subprocess windows-popen-helpers12522911
Ref: 375c12522911
Ref: library/subprocess subprocess STARTUPINFO12523079
Ref: 374812523079
Ref: library/subprocess subprocess STARTUPINFO dwFlags12523544
Ref: 375d12523544
Ref: library/subprocess subprocess STARTUPINFO hStdInput12523901
Ref: 375e12523901
Ref: library/subprocess subprocess STARTUPINFO hStdOutput12524249
Ref: 376012524249
Ref: library/subprocess subprocess STARTUPINFO hStdError12524607
Ref: 376112524607
Ref: library/subprocess subprocess STARTUPINFO wShowWindow12524976
Ref: 376212524976
Ref: library/subprocess subprocess STARTUPINFO lpAttributeList12525546
Ref: e0812525546
Ref: Windows Popen ヘルパー-Footnote-112526802
Ref: Windows Popen ヘルパー-Footnote-212526874
Ref: Windows Popen ヘルパー-Footnote-312526946
Node: Windows Constants12527035
Ref: library/subprocess windows-constants12527115
Ref: 376512527115
Ref: library/subprocess subprocess STD_INPUT_HANDLE12527232
Ref: 376612527232
Ref: library/subprocess subprocess STD_OUTPUT_HANDLE12527401
Ref: 376712527401
Ref: library/subprocess subprocess STD_ERROR_HANDLE12527585
Ref: 376812527585
Ref: library/subprocess subprocess SW_HIDE12527771
Ref: 376412527771
Ref: library/subprocess subprocess STARTF_USESTDHANDLES12527903
Ref: 375f12527903
Ref: library/subprocess subprocess STARTF_USESHOWWINDOW12528141
Ref: 376312528141
Ref: library/subprocess subprocess STARTF_FORCEONFEEDBACK12528297
Ref: 376912528297
Ref: library/subprocess subprocess STARTF_FORCEOFFFEEDBACK12528596
Ref: 376a12528596
Ref: library/subprocess subprocess CREATE_NEW_CONSOLE12528811
Ref: 374912528811
Ref: library/subprocess subprocess CREATE_NEW_PROCESS_GROUP12529024
Ref: 374a12529024
Ref: library/subprocess subprocess ABOVE_NORMAL_PRIORITY_CLASS12529441
Ref: 374b12529441
Ref: library/subprocess subprocess BELOW_NORMAL_PRIORITY_CLASS12529652
Ref: 374c12529652
Ref: library/subprocess subprocess HIGH_PRIORITY_CLASS12529862
Ref: 374d12529862
Ref: library/subprocess subprocess IDLE_PRIORITY_CLASS12530055
Ref: 374e12530055
Ref: library/subprocess subprocess NORMAL_PRIORITY_CLASS12530258
Ref: 374f12530258
Ref: library/subprocess subprocess REALTIME_PRIORITY_CLASS12530466
Ref: 375012530466
Ref: library/subprocess subprocess CREATE_NO_WINDOW12531003
Ref: 375112531003
Ref: library/subprocess subprocess DETACHED_PROCESS12531192
Ref: 375212531192
Ref: library/subprocess subprocess CREATE_DEFAULT_ERROR_MODE12531451
Ref: 375312531451
Ref: library/subprocess subprocess CREATE_BREAKAWAY_FROM_JOB12531858
Ref: 375412531858
Node: 古い高水準 API12532062
Ref: library/subprocess call-function-trio12532253
Ref: 376b12532253
Ref: library/subprocess older-high-level-api12532253
Ref: 376c12532253
Ref: library/subprocess subprocess call12532622
Ref: d8112532622
Ref: library/subprocess subprocess check_call12534405
Ref: 373912534405
Ref: library/subprocess subprocess check_output12536447
Ref: 11c412536447
Node: Replacing Older Functions with the subprocess Module12539454
Ref: library/subprocess replacing-older-functions-with-the-subprocess-module12539661
Ref: 376d12539661
Ref: library/subprocess subprocess-replacements12539661
Ref: 13a012539661
Node: Replacing /bin/sh shell command substitution12540940
Ref: library/subprocess replacing-bin-sh-shell-command-substitution12541130
Ref: 376e12541130
Node: シェルのパイプラインを置き換える12541367
Ref: library/subprocess replacing-shell-pipeline12541594
Ref: 376f12541594
Node: os system を置き換える12542432
Ref: library/subprocess replacing-os-system12542651
Ref: 377012542651
Node: os spawn 関数群を置き換える12543638
Ref: library/subprocess replacing-the-os-spawn-family12543827
Ref: 377112543827
Node: Replacing os popen12544485
Ref: library/subprocess replacing-os-popen12544637
Ref: 377212544637
Node: レガシーなシェル呼び出し関数12545074
Ref: library/subprocess legacy-shell-invocation-functions12545271
Ref: 377312545271
Ref: library/subprocess subprocess getstatusoutput12545725
Ref: 11c612545725
Ref: library/subprocess subprocess getoutput12547120
Ref: 11c512547120
Node: 注釈<2>12547742
Ref: library/subprocess notes12547878
Ref: 377412547878
Node: Timeout Behavior12548075
Ref: library/subprocess subprocess-timeout-behavior12548214
Ref: 377512548214
Ref: library/subprocess timeout-behavior12548214
Ref: 377612548214
Node: Windows における引数シーケンスから文字列への変換12549001
Ref: library/subprocess converting-an-argument-sequence-to-a-string-on-windows12549175
Ref: 377712549175
Ref: library/subprocess converting-argument-sequence12549175
Ref: 374512549175
Node: Disable use of posix_spawn12550688
Ref: library/subprocess disable-posix-spawn12550837
Ref: 377812550837
Ref: library/subprocess disable-use-of-posix-spawn12550837
Ref: 377912550837
Node: sched --- イベントスケジューラー12551672
Ref: library/sched doc12551855
Ref: 377a12551855
Ref: library/sched module-sched12551855
Ref: c412551855
Ref: library/sched sched-event-scheduler12551855
Ref: 377b12551855
Ref: library/sched translation-repo12551855
Ref: 377c12551855
Ref: library/sched sched scheduler12552152
Ref: 133f12552152
Ref: sched --- イベントスケジューラー-Footnote-112554643
Node: スケジューラオブジェクト12554708
Ref: library/sched id112554824
Ref: 377d12554824
Ref: library/sched scheduler-objects12554824
Ref: 377e12554824
Ref: library/sched sched scheduler enterabs12555003
Ref: 134112555003
Ref: library/sched sched scheduler enter12556194
Ref: 134012556194
Ref: library/sched sched scheduler cancel12556672
Ref: 1cfb12556672
Ref: library/sched sched scheduler empty12556927
Ref: 377f12556927
Ref: library/sched sched scheduler run12557047
Ref: 133e12557047
Ref: library/sched sched scheduler queue12558561
Ref: 378012558561
Node: queue --- 同期キュークラス12558891
Ref: library/queue doc12559075
Ref: 378112559075
Ref: library/queue module-queue12559075
Ref: bb12559075
Ref: library/queue queue-a-synchronized-queue-class12559075
Ref: 378212559075
Ref: library/queue translation-repo12559075
Ref: 378312559075
Ref: library/queue queue Queue12560659
Ref: 15ac12560659
Ref: library/queue queue LifoQueue12561065
Ref: 26b612561065
Ref: library/queue queue PriorityQueue12561475
Ref: 26b712561475
Ref: library/queue queue SimpleQueue12562562
Ref: d6112562562
Ref: library/queue queue Empty12562742
Ref: 366c12562742
Ref: library/queue queue Full12562974
Ref: 366d12562974
Ref: library/queue queue ShutDown12563208
Ref: 54312563208
Ref: queue --- 同期キュークラス-Footnote-112563519
Node: キューオブジェクト12563584
Ref: library/queue queue-objects12563721
Ref: 378612563721
Ref: library/queue queueobjects12563721
Ref: 378712563721
Ref: library/queue queue Queue qsize12563946
Ref: 378812563946
Ref: library/queue queue Queue empty12564262
Ref: 378912564262
Ref: library/queue queue Queue full12564695
Ref: 378a12564695
Ref: library/queue queue Queue put12565128
Ref: 378512565128
Ref: library/queue queue Queue put_nowait12566006
Ref: 31c212566006
Ref: library/queue queue Queue get12566103
Ref: 31c312566103
Ref: library/queue queue Queue get_nowait12567380
Ref: 378412567380
Ref: library/queue queue Queue task_done12567637
Ref: 366812567637
Ref: library/queue queue Queue join12568439
Ref: 366912568439
Node: Waiting for task completion12569109
Ref: library/queue waiting-for-task-completion12569227
Ref: 378b12569227
Node: Terminating queues12569884
Ref: library/queue terminating-queues12570002
Ref: 378c12570002
Ref: library/queue queue Queue shutdown12570188
Ref: 54212570188
Node: SimpleQueue オブジェクト12571612
Ref: library/queue simplequeue-objects12571749
Ref: 378d12571749
Ref: library/queue queue SimpleQueue qsize12571926
Ref: 378e12571926
Ref: library/queue queue SimpleQueue empty12572202
Ref: 378f12572202
Ref: library/queue queue SimpleQueue put12572495
Ref: 379012572495
Ref: library/queue queue SimpleQueue put_nowait12573260
Ref: 379112573260
Ref: library/queue queue SimpleQueue get12573448
Ref: 379212573448
Ref: library/queue queue SimpleQueue get_nowait12574270
Ref: 379312574270
Node: contextvars --- コンテキスト変数12574750
Ref: library/contextvars doc12574931
Ref: 379412574931
Ref: library/contextvars contextvars-context-variables12574931
Ref: 379512574931
Ref: library/contextvars module-contextvars12574931
Ref: 2812574931
Ref: library/contextvars translation-repo12574931
Ref: 379612574931
Ref: contextvars --- コンテキスト変数-Footnote-112575987
Node: コンテキスト変数12576029
Ref: library/contextvars context-variables12576184
Ref: 379712576184
Ref: library/contextvars contextvars ContextVar12576247
Ref: 187512576247
Ref: library/contextvars contextvars ContextVar name12577199
Ref: 379912577199
Ref: library/contextvars contextvars ContextVar get12577335
Ref: 379812577335
Ref: library/contextvars contextvars ContextVar set12577959
Ref: 179212577959
Ref: library/contextvars contextvars ContextVar reset12579260
Ref: 379a12579260
Ref: library/contextvars contextvars Token12579851
Ref: 1e212579851
Ref: library/contextvars contextvars Token var12580428
Ref: 379b12580428
Ref: library/contextvars contextvars Token old_value12580608
Ref: 379c12580608
Ref: library/contextvars contextvars Token MISSING12580984
Ref: 17f912580984
Node: マニュアルでのコンテキスト管理12581122
Ref: library/contextvars manual-context-management12581306
Ref: 379d12581306
Ref: library/contextvars contextvars copy_context12581404
Ref: 361f12581404
Ref: library/contextvars contextvars Context12582016
Ref: 17712582016
Ref: library/contextvars contextvars Context run12584039
Ref: 194b12584039
Ref: library/contextvars contextvars Context copy12585368
Ref: 379e12585368
Ref: library/contextvars contextvars Context get12585930
Ref: 379f12585930
Ref: library/contextvars contextvars Context keys12586524
Ref: 37a012586524
Ref: library/contextvars contextvars Context values12586658
Ref: 37a112586658
Ref: library/contextvars contextvars Context items12586811
Ref: 37a212586811
Node: asyncio サポート12587021
Ref: library/contextvars asyncio-support12587172
Ref: 37a312587172
Node: _thread --- 低水準なスレッド API12588949
Ref: library/_thread doc12589087
Ref: 37a412589087
Ref: library/_thread module-_thread12589087
Ref: 212589087
Ref: library/_thread thread-low-level-threading-api12589087
Ref: 37a512589087
Ref: library/_thread translation-repo12589087
Ref: 37a612589087
Ref: library/_thread thread error12590074
Ref: 37a712590074
Ref: library/_thread thread LockType12590256
Ref: 37a812590256
Ref: library/_thread thread start_new_thread12590353
Ref: 4b412590353
Ref: library/_thread thread interrupt_main12591448
Ref: a4412591448
Ref: library/_thread thread exit12592375
Ref: 37a912592375
Ref: library/_thread thread allocate_lock12592548
Ref: 37aa12592548
Ref: library/_thread thread get_ident12592779
Ref: 37ab12592779
Ref: library/_thread thread get_native_id12593267
Ref: 37ac12593267
Ref: library/_thread thread stack_size12593827
Ref: 177912593827
Ref: library/_thread thread TIMEOUT_MAX12595498
Ref: 37ad12595498
Ref: library/_thread thread lock acquire12595827
Ref: 37ae12595827
Ref: library/_thread thread lock release12597317
Ref: 37af12597317
Ref: library/_thread thread lock locked12597578
Ref: 37b012597578
Node: ネットワーク通信とプロセス間通信12598716
Ref: library/ipc doc12598904
Ref: 37b112598904
Ref: library/ipc ipc12598904
Ref: 37b212598904
Ref: library/ipc networking-and-interprocess-communication12598904
Ref: 37b312598904
Ref: library/ipc translation-repo12598904
Ref: 37b412598904
Node: asyncio --- 非同期 I/O12600221
Ref: library/asyncio doc12600402
Ref: 37b512600402
Ref: library/asyncio asyncio-asynchronous-i-o12600402
Ref: 37b612600402
Ref: library/asyncio module-asyncio12600402
Ref: b12600402
Ref: library/asyncio asyncio-cli12602585
Ref: 37c212602585
Node: Runners12603989
Ref: library/asyncio-runner doc12604090
Ref: 37c312604090
Ref: library/asyncio-runner runners12604090
Ref: 37c412604090
Ref: Runners-Footnote-112604679
Node: 非同期プログラムの実行12604755
Ref: library/asyncio-runner running-an-asyncio-program12604863
Ref: 37c512604863
Ref: library/asyncio-runner asyncio run12604939
Ref: 2f312604939
Node: Runner context manager12607289
Ref: library/asyncio-runner runner-context-manager12607436
Ref: 37c712607436
Ref: library/asyncio-runner asyncio Runner12607501
Ref: 2f512607501
Ref: library/asyncio-runner asyncio Runner run12608819
Ref: 194d12608819
Ref: library/asyncio-runner asyncio Runner close12609569
Ref: 37c812609569
Ref: library/asyncio-runner asyncio Runner get_loop12609797
Ref: 37c912609797
Node: Handling Keyboard Interruption12610245
Ref: library/asyncio-runner handling-keyboard-interruption12610350
Ref: 37ca12610350
Node: コルーチンと Task12611858
Ref: library/asyncio-task doc12611983
Ref: 37cb12611983
Ref: library/asyncio-task coroutines-and-tasks12611983
Ref: 37cc12611983
Ref: library/asyncio-task translation-repo12611983
Ref: 37cd12611983
Node: コルーチン<3>12612591
Ref: library/asyncio-task coroutine12612687
Ref: 37b812612687
Ref: library/asyncio-task coroutines12612687
Ref: 37ce12612687
Ref: コルーチン<3>-Footnote-112616343
Node: Awaitable12616422
Ref: library/asyncio-task asyncio-awaitables12616541
Ref: 37cf12616541
Ref: library/asyncio-task awaitables12616541
Ref: 37d012616541
Node: Task の作成12619710
Ref: library/asyncio-task creating-tasks12619838
Ref: 37d112619838
Ref: library/asyncio-task asyncio create_task12619999
Ref: 1c912619999
Ref: Task の作成-Footnote-112622909
Node: タスクのキャンセル12622982
Ref: library/asyncio-task task-cancellation12623112
Ref: 37d212623112
Node: Task Groups12624230
Ref: library/asyncio-task task-groups12624358
Ref: 37d312624358
Ref: library/asyncio-task taskgroups12624358
Ref: 37d412624358
Ref: library/asyncio-task asyncio TaskGroup12624525
Ref: 4d112624525
Ref: library/asyncio-task asyncio TaskGroup create_task12624794
Ref: 1cb12624794
Node: Terminating a Task Group12628983
Ref: library/asyncio-task terminating-a-task-group12629055
Ref: 37d512629055
Node: スリープ12630390
Ref: library/asyncio-task sleeping12630512
Ref: 37d612630512
Ref: library/asyncio-task asyncio sleep12630555
Ref: c6412630555
Ref: library/asyncio-task asyncio-example-sleep12631221
Ref: 37d712631221
Node: 並行な Task 実行12631905
Ref: library/asyncio-task running-tasks-concurrently12632034
Ref: 37d812632034
Ref: library/asyncio-task asyncio gather12632094
Ref: 81312632094
Ref: library/asyncio-task asyncio-example-gather12634199
Ref: 37d912634199
Node: Eager Task Factory12636410
Ref: library/asyncio-task eager-task-factory12636557
Ref: 37da12636557
Ref: library/asyncio-task id212636557
Ref: 37db12636557
Ref: library/asyncio-task asyncio eager_task_factory12636616
Ref: 6a212636616
Ref: library/asyncio-task asyncio create_eager_task_factory12637763
Ref: 6a312637763
Node: キャンセルからの保護12638434
Ref: library/asyncio-task shielding-from-cancellation12638578
Ref: 37dc12638578
Ref: library/asyncio-task asyncio shield12638651
Ref: c6512638651
Node: タイムアウト12640548
Ref: library/asyncio-task timeouts12640695
Ref: 37dd12640695
Ref: library/asyncio-task asyncio timeout12640748
Ref: 81412640748
Ref: library/asyncio-task asyncio Timeout12642520
Ref: 1a4012642520
Ref: library/asyncio-task asyncio Timeout when12643164
Ref: 37df12643164
Ref: library/asyncio-task asyncio Timeout reschedule12643342
Ref: 37de12643342
Ref: library/asyncio-task asyncio Timeout expired12643453
Ref: 37e012643453
Ref: library/asyncio-task asyncio timeout_at12644325
Ref: 1bb312644325
Ref: library/asyncio-task asyncio wait_for12644967
Ref: 81512644967
Ref: library/asyncio-task asyncio-example-waitfor12646001
Ref: 37e112646001
Node: 要素の終了待機12646903
Ref: library/asyncio-task waiting-primitives12647047
Ref: 37e212647047
Ref: library/asyncio-task asyncio wait12647105
Ref: 6a712647105
Ref: library/asyncio-task asyncio FIRST_COMPLETED12648429
Ref: 37e312648429
Ref: library/asyncio-task asyncio FIRST_EXCEPTION12648772
Ref: 37e412648772
Ref: library/asyncio-task asyncio ALL_COMPLETED12649296
Ref: 37e512649296
Ref: library/asyncio-task asyncio as_completed12649967
Ref: 4c612649967
Node: スレッド内での実行12652867
Ref: library/asyncio-task running-in-threads12653038
Ref: 37e612653038
Ref: library/asyncio-task asyncio to_thread12653106
Ref: ae512653106
Node: 外部スレッドからのスケジュール12655400
Ref: library/asyncio-task scheduling-from-other-threads12655580
Ref: 37e712655580
Ref: library/asyncio-task asyncio run_coroutine_threadsafe12655678
Ref: a8212655678
Node: イントロスペクション12659211
Ref: library/asyncio-task introspection12659387
Ref: 37e912659387
Ref: library/asyncio-task asyncio current_task12659460
Ref: 6a512659460
Ref: library/asyncio-task asyncio all_tasks12659826
Ref: b4f12659826
Ref: library/asyncio-task asyncio iscoroutine12660178
Ref: 6a612660178
Node: Task オブジェクト12660304
Ref: library/asyncio-task asyncio-task-obj12660426
Ref: 37ea12660426
Ref: library/asyncio-task task-object12660426
Ref: 37eb12660426
Ref: library/asyncio-task asyncio Task12660489
Ref: 1c712660489
Ref: library/asyncio-task asyncio Task done12664009
Ref: 37ee12664009
Ref: library/asyncio-task asyncio Task result12664316
Ref: 37ef12664316
Ref: library/asyncio-task asyncio Task exception12664905
Ref: 37f112664905
Ref: library/asyncio-task asyncio Task add_done_callback12665531
Ref: 37f212665531
Ref: library/asyncio-task asyncio Task remove_done_callback12665960
Ref: 37f312665960
Ref: library/asyncio-task asyncio Task get_stack12666358
Ref: 37f412666358
Ref: library/asyncio-task asyncio Task print_stack12667706
Ref: 1ad012667706
Ref: library/asyncio-task asyncio Task get_coro12668320
Ref: bcf12668320
Ref: library/asyncio-task asyncio Task get_context12668793
Ref: 37f512668793
Ref: library/asyncio-task asyncio Task get_name12668963
Ref: bd112668963
Ref: library/asyncio-task asyncio Task set_name12669310
Ref: bd012669310
Ref: library/asyncio-task asyncio Task cancel12669714
Ref: 4d312669714
Ref: library/asyncio-task asyncio-example-task-cancel12670980
Ref: 37f612670980
Ref: library/asyncio-task asyncio Task cancelled12672278
Ref: 37ec12672278
Ref: library/asyncio-task asyncio Task uncancel12672718
Ref: 4d612672718
Ref: library/asyncio-task asyncio Task cancelling12675035
Ref: 4d512675035
Node: ストリーム12675847
Ref: library/asyncio-stream doc12675992
Ref: 37f712675992
Ref: library/asyncio-stream asyncio-streams12675992
Ref: 37b912675992
Ref: library/asyncio-stream streams12675992
Ref: 37f812675992
Ref: library/asyncio-stream translation-repo12675992
Ref: 37f912675992
Ref: library/asyncio-stream asyncio-example-stream12676463
Ref: 37fa12676463
Ref: library/asyncio-stream asyncio open_connection12677283
Ref: d0e12677283
Ref: library/asyncio-stream asyncio start_server12678812
Ref: d0f12678812
Ref: library/asyncio-stream asyncio open_unix_connection12680836
Ref: 37fe12680836
Ref: library/asyncio-stream asyncio start_unix_server12681984
Ref: 380012681984
Ref: ストリーム-Footnote-112683507
Node: StreamReader12683583
Ref: library/asyncio-stream streamreader12683668
Ref: 380112683668
Ref: library/asyncio-stream asyncio StreamReader12683715
Ref: 1c7d12683715
Ref: library/asyncio-stream asyncio StreamReader feed_eof12684165
Ref: 380212684165
Ref: library/asyncio-stream asyncio StreamReader read12684250
Ref: 380312684250
Ref: library/asyncio-stream asyncio StreamReader readline12685123
Ref: 380412685123
Ref: library/asyncio-stream asyncio StreamReader readexactly12685598
Ref: e7612685598
Ref: library/asyncio-stream asyncio StreamReader readuntil12686003
Ref: 4d012686003
Ref: library/asyncio-stream asyncio StreamReader at_eof12687484
Ref: 380712687484
Node: StreamWriter12687646
Ref: library/asyncio-stream streamwriter12687753
Ref: 380812687753
Ref: library/asyncio-stream asyncio StreamWriter12687800
Ref: 1a7012687800
Ref: library/asyncio-stream asyncio StreamWriter write12688192
Ref: 380912688192
Ref: library/asyncio-stream asyncio StreamWriter writelines12688805
Ref: 380a12688805
Ref: library/asyncio-stream asyncio StreamWriter close12689361
Ref: 37fc12689361
Ref: library/asyncio-stream asyncio StreamWriter can_write_eof12689685
Ref: 380b12689685
Ref: library/asyncio-stream asyncio StreamWriter write_eof12689949
Ref: 380c12689949
Ref: library/asyncio-stream asyncio StreamWriter transport12690153
Ref: 380d12690153
Ref: library/asyncio-stream asyncio StreamWriter get_extra_info12690259
Ref: 380e12690259
Ref: library/asyncio-stream asyncio StreamWriter drain12690496
Ref: 1b2912690496
Ref: library/asyncio-stream asyncio StreamWriter start_tls12691249
Ref: 81912691249
Ref: library/asyncio-stream asyncio StreamWriter is_closing12692331
Ref: d0312692331
Ref: library/asyncio-stream asyncio StreamWriter wait_closed12692541
Ref: d0212692541
Node: 使用例<22>12692894
Ref: library/asyncio-stream examples12692980
Ref: 37fb12692980
Node: ストリームを使った TCP Echo クライアント12693256
Ref: library/asyncio-stream asyncio-tcp-echo-client-streams12693419
Ref: 380f12693419
Ref: library/asyncio-stream tcp-echo-client-using-streams12693419
Ref: 381012693419
Node: ストリームを使った TCP Echo サーバー12694299
Ref: library/asyncio-stream asyncio-tcp-echo-server-streams12694497
Ref: 381212694497
Ref: library/asyncio-stream tcp-echo-server-using-streams12694497
Ref: 381312694497
Node: HTTP ヘッダーの取得12695606
Ref: library/asyncio-stream get-http-headers12695827
Ref: 381512695827
Node: ストリームを使ってデータを待つオープンソケットの登録12697158
Ref: library/asyncio-stream asyncio-example-create-connection-streams12697321
Ref: 381612697321
Ref: library/asyncio-stream register-an-open-socket-to-wait-for-data-using-streams12697321
Ref: 381712697321
Node: 同期プリミティブ<2>12698919
Ref: library/asyncio-sync doc12699059
Ref: 381b12699059
Ref: library/asyncio-sync asyncio-sync12699059
Ref: 37bc12699059
Ref: library/asyncio-sync synchronization-primitives12699059
Ref: 381c12699059
Ref: library/asyncio-sync translation-repo12699059
Ref: 381d12699059
Ref: 同期プリミティブ<2>-Footnote-112700336
Node: Lock12700409
Ref: library/asyncio-sync lock12700491
Ref: 381e12700491
Ref: library/asyncio-sync asyncio Lock12700522
Ref: c6612700522
Ref: library/asyncio-sync asyncio Lock acquire12701400
Ref: 381f12701400
Ref: library/asyncio-sync asyncio Lock release12702084
Ref: 382012702084
Ref: library/asyncio-sync asyncio Lock locked12702408
Ref: 382112702408
Node: Event12702514
Ref: library/asyncio-sync event12702614
Ref: 382212702614
Ref: library/asyncio-sync asyncio Event12702647
Ref: 2f412702647
Ref: library/asyncio-sync asyncio-example-sync-event12703441
Ref: 382612703441
Ref: library/asyncio-sync asyncio Event wait12704096
Ref: 382512704096
Ref: library/asyncio-sync asyncio Event set12704444
Ref: 382312704444
Ref: library/asyncio-sync asyncio Event clear12704681
Ref: 382412704681
Ref: library/asyncio-sync asyncio Event is_set12704916
Ref: 382712704916
Node: Condition12705037
Ref: library/asyncio-sync condition12705142
Ref: 382812705142
Ref: library/asyncio-sync asyncio Condition12705183
Ref: c6712705183
Ref: library/asyncio-sync asyncio Condition acquire12706822
Ref: 382912706822
Ref: library/asyncio-sync asyncio Condition notify12707094
Ref: 19f712707094
Ref: library/asyncio-sync asyncio Condition locked12707642
Ref: 382a12707642
Ref: library/asyncio-sync asyncio Condition notify_all12707760
Ref: 382b12707760
Ref: library/asyncio-sync asyncio Condition release12708425
Ref: 382c12708425
Ref: library/asyncio-sync asyncio Condition wait12708654
Ref: 1a2012708654
Ref: library/asyncio-sync asyncio Condition wait_for12709598
Ref: 382d12709598
Node: Semaphore12709983
Ref: library/asyncio-sync semaphore12710099
Ref: 382e12710099
Ref: library/asyncio-sync asyncio Semaphore12710140
Ref: c6812710140
Ref: library/asyncio-sync asyncio Semaphore acquire12711707
Ref: 1a2112711707
Ref: library/asyncio-sync asyncio Semaphore locked12712105
Ref: 383012712105
Ref: library/asyncio-sync asyncio Semaphore release12712229
Ref: 382f12712229
Node: BoundedSemaphore12712638
Ref: library/asyncio-sync boundedsemaphore12712752
Ref: 383112712752
Ref: library/asyncio-sync asyncio BoundedSemaphore12712807
Ref: c6912712807
Node: Barrier12713307
Ref: library/asyncio-sync barrier12713403
Ref: 383212713403
Ref: library/asyncio-sync asyncio Barrier12713440
Ref: 81612713440
Ref: library/asyncio-sync asyncio-example-barrier12714039
Ref: 383412714039
Ref: library/asyncio-sync asyncio Barrier wait12714939
Ref: 383312714939
Ref: library/asyncio-sync asyncio Barrier reset12716018
Ref: 383512716018
Ref: library/asyncio-sync asyncio Barrier abort12716320
Ref: 383612716320
Ref: library/asyncio-sync asyncio Barrier parties12716639
Ref: 383712716639
Ref: library/asyncio-sync asyncio Barrier n_waiting12716729
Ref: 383812716729
Ref: library/asyncio-sync asyncio Barrier broken12716849
Ref: 383912716849
Ref: library/asyncio-sync asyncio BrokenBarrierError12716972
Ref: 81712716972
Node: サブプロセス12717590
Ref: library/asyncio-subprocess doc12717724
Ref: 383a12717724
Ref: library/asyncio-subprocess asyncio-subprocess12717724
Ref: 37ba12717724
Ref: library/asyncio-subprocess subprocesses12717724
Ref: 383b12717724
Ref: library/asyncio-subprocess translation-repo12717724
Ref: 383c12717724
Ref: library/asyncio-subprocess asyncio-example-subprocess-shell12718068
Ref: 383d12718068
Ref: サブプロセス-Footnote-112719630
Ref: サブプロセス-Footnote-212719709
Node: サブプロセスの生成12719793
Ref: library/asyncio-subprocess creating-subprocesses12719893
Ref: 383f12719893
Ref: library/asyncio-subprocess asyncio create_subprocess_exec12719961
Ref: c6b12719961
Ref: library/asyncio-subprocess asyncio create_subprocess_shell12720770
Ref: c6c12720770
Ref: サブプロセスの生成-Footnote-112722718
Node: 定数<7>12722788
Ref: library/asyncio-subprocess constants12722936
Ref: 384a12722936
Ref: library/asyncio-subprocess asyncio subprocess PIPE12722969
Ref: 384b12722969
Ref: library/asyncio-subprocess asyncio subprocess STDOUT12723428
Ref: 384d12723428
Ref: library/asyncio-subprocess asyncio subprocess DEVNULL12723636
Ref: 384e12723636
Node: サブプロセスとやりとりする12723956
Ref: library/asyncio-subprocess interacting-with-subprocesses12724068
Ref: 384f12724068
Ref: library/asyncio-subprocess asyncio subprocess Process12724483
Ref: 384212724483
Ref: library/asyncio-subprocess asyncio subprocess Process wait12725682
Ref: 385012725682
Ref: library/asyncio-subprocess asyncio subprocess Process communicate12726410
Ref: 1a9f12726410
Ref: library/asyncio-subprocess asyncio subprocess Process send_signal12728350
Ref: 194a12728350
Ref: library/asyncio-subprocess asyncio subprocess Process terminate12728786
Ref: 385312728786
Ref: library/asyncio-subprocess asyncio subprocess Process kill12729087
Ref: 385412729087
Ref: library/asyncio-subprocess asyncio subprocess Process stdin12729393
Ref: 384c12729393
Ref: library/asyncio-subprocess asyncio subprocess Process stdout12729555
Ref: 384012729555
Ref: library/asyncio-subprocess asyncio subprocess Process stderr12729720
Ref: 384112729720
Ref: library/asyncio-subprocess asyncio subprocess Process pid12730224
Ref: 385512730224
Ref: library/asyncio-subprocess asyncio subprocess Process returncode12730479
Ref: 385212730479
Node: サブプロセスとスレッド12730967
Ref: library/asyncio-subprocess asyncio-subprocess-threads12731098
Ref: 385112731098
Ref: library/asyncio-subprocess subprocess-and-threads12731098
Ref: 385612731098
Node: 使用例<23>12731805
Ref: library/asyncio-subprocess examples12731936
Ref: 383e12731936
Ref: library/asyncio-subprocess asyncio-example-create-subprocess-exec12732162
Ref: 385712732162
Node: キュー12733010
Ref: library/asyncio-queue doc12733127
Ref: 385912733127
Ref: library/asyncio-queue asyncio-queues12733127
Ref: 37bb12733127
Ref: library/asyncio-queue queues12733127
Ref: 385a12733127
Ref: library/asyncio-queue translation-repo12733127
Ref: 385b12733127
Ref: キュー-Footnote-112734049
Node: Queue12734123
Ref: library/asyncio-queue queue12734210
Ref: 385d12734210
Ref: library/asyncio-queue asyncio Queue12734243
Ref: c6a12734243
Ref: library/asyncio-queue asyncio Queue maxsize12735074
Ref: 386012735074
Ref: library/asyncio-queue asyncio Queue empty12735166
Ref: 386112735166
Ref: library/asyncio-queue asyncio Queue full12735316
Ref: 386212735316
Ref: library/asyncio-queue asyncio Queue get12735593
Ref: 385e12735593
Ref: library/asyncio-queue asyncio Queue get_nowait12735940
Ref: 386312735940
Ref: library/asyncio-queue asyncio Queue join12736130
Ref: fc612736130
Ref: library/asyncio-queue asyncio Queue put12736771
Ref: 386512736771
Ref: library/asyncio-queue asyncio Queue put_nowait12737093
Ref: 386612737093
Ref: library/asyncio-queue asyncio Queue qsize12737334
Ref: 385f12737334
Ref: library/asyncio-queue asyncio Queue shutdown12737421
Ref: 4cc12737421
Ref: library/asyncio-queue asyncio Queue task_done12738986
Ref: fc712738986
Node: 優先度付きのキュー12739782
Ref: library/asyncio-queue priority-queue12739892
Ref: 386812739892
Ref: library/asyncio-queue asyncio PriorityQueue12739960
Ref: 386912739960
Node: LIFO キュー12740243
Ref: library/asyncio-queue lifo-queue12740358
Ref: 386a12740358
Ref: library/asyncio-queue asyncio LifoQueue12740406
Ref: 386b12740406
Node: 例外<15>12740594
Ref: library/asyncio-queue exceptions12740695
Ref: 386c12740695
Ref: library/asyncio-queue asyncio QueueEmpty12740728
Ref: 386412740728
Ref: library/asyncio-queue asyncio QueueFull12740899
Ref: 386712740899
Ref: library/asyncio-queue asyncio QueueShutDown12741092
Ref: 4cd12741092
Node: 使用例<24>12741277
Ref: library/asyncio-queue examples12741355
Ref: 385c12741355
Ref: library/asyncio-queue asyncio-example-queue-dist12741393
Ref: 386d12741393
Node: 例外<16>12743201
Ref: library/asyncio-exceptions doc12743324
Ref: 386e12743324
Ref: library/asyncio-exceptions asyncio-exceptions12743324
Ref: 386f12743324
Ref: library/asyncio-exceptions exceptions12743324
Ref: 387012743324
Ref: library/asyncio-exceptions translation-repo12743324
Ref: 387112743324
Ref: library/asyncio-exceptions asyncio TimeoutError12743477
Ref: 1ab512743477
Ref: library/asyncio-exceptions asyncio CancelledError12743779
Ref: 4d412743779
Ref: library/asyncio-exceptions asyncio InvalidStateError12744321
Ref: 37f012744321
Ref: library/asyncio-exceptions asyncio SendfileNotAvailableError12744670
Ref: 387212744670
Ref: library/asyncio-exceptions asyncio IncompleteReadError12744930
Ref: 1ce812744930
Ref: library/asyncio-exceptions asyncio IncompleteReadError expected12745194
Ref: 387312745194
Ref: library/asyncio-exceptions asyncio IncompleteReadError partial12745294
Ref: 380512745294
Ref: library/asyncio-exceptions asyncio LimitOverrunError12745443
Ref: 380612745443
Ref: library/asyncio-exceptions asyncio LimitOverrunError consumed12745657
Ref: 387412745657
Ref: 例外<16>-Footnote-112745777
Node: Call Graph Introspection12745856
Ref: library/asyncio-graph doc12745991
Ref: 387512745991
Ref: library/asyncio-graph asyncio-graph12745991
Ref: 387612745991
Ref: library/asyncio-graph call-graph-introspection12745991
Ref: 387712745991
Ref: library/asyncio-graph translation-repo12745991
Ref: 387812745991
Ref: library/asyncio-graph asyncio print_call_graph12746478
Ref: 1cd12746478
Ref: library/asyncio-graph asyncio format_call_graph12748444
Ref: 387912748444
Ref: library/asyncio-graph asyncio capture_call_graph12748705
Ref: 1cc12748705
Ref: Call Graph Introspection-Footnote-112749928
Node: Low level utility functions12750001
Ref: library/asyncio-graph low-level-utility-functions12750089
Ref: 387a12750089
Ref: library/asyncio-graph asyncio future_add_to_awaited_by12750606
Ref: 387b12750606
Ref: library/asyncio-graph asyncio future_discard_from_awaited_by12751077
Ref: 387c12751077
Node: イベントループ12751381
Ref: library/asyncio-eventloop doc12751512
Ref: 387d12751512
Ref: library/asyncio-eventloop asyncio-event-loop12751512
Ref: f7612751512
Ref: library/asyncio-eventloop event-loop12751512
Ref: 387e12751512
Ref: library/asyncio-eventloop translation-repo12751512
Ref: 387f12751512
Ref: library/asyncio-eventloop asyncio get_running_loop12752627
Ref: d0112752627
Ref: library/asyncio-eventloop asyncio get_event_loop12752933
Ref: 2f212752933
Ref: library/asyncio-eventloop asyncio set_event_loop12754240
Ref: 1b5512754240
Ref: library/asyncio-eventloop asyncio new_event_loop12754373
Ref: 37c612754373
Ref: イベントループ-Footnote-112755944
Ref: イベントループ-Footnote-212756020
Node: イベントループのメソッド12756094
Ref: library/asyncio-eventloop asyncio-event-loop-methods12756230
Ref: 388612756230
Ref: library/asyncio-eventloop event-loop-methods12756230
Ref: 388112756230
Node: ループの開始と停止12757065
Ref: library/asyncio-eventloop running-and-stopping-the-loop12757219
Ref: 388712757219
Ref: library/asyncio-eventloop asyncio loop run_until_complete12757287
Ref: e7212757287
Ref: library/asyncio-eventloop asyncio loop run_forever12757714
Ref: 388812757714
Ref: library/asyncio-eventloop asyncio loop stop12758942
Ref: e7712758942
Ref: library/asyncio-eventloop asyncio loop is_running12759023
Ref: 388912759023
Ref: library/asyncio-eventloop asyncio loop is_closed12759146
Ref: fc312759146
Ref: library/asyncio-eventloop asyncio loop close12759271
Ref: 388a12759271
Ref: library/asyncio-eventloop asyncio loop shutdown_asyncgens12759960
Ref: e7912759960
Ref: library/asyncio-eventloop asyncio loop shutdown_default_executor12760960
Ref: ae412760960
Node: コールバックのスケジューリング12762000
Ref: library/asyncio-eventloop scheduling-callbacks12762214
Ref: 388b12762214
Ref: library/asyncio-eventloop asyncio loop call_soon12762312
Ref: cfa12762312
Ref: library/asyncio-eventloop asyncio loop call_soon_threadsafe12763242
Ref: cfb12763242
Ref: library/asyncio-eventloop asyncio-pass-keywords12764347
Ref: 388c12764347
Ref: コールバックのスケジューリング-Footnote-112765088
Node: 遅延コールバックのスケジューリング12765130
Ref: library/asyncio-eventloop asyncio-delayed-calls12765356
Ref: 388d12765356
Ref: library/asyncio-eventloop scheduling-delayed-callbacks12765356
Ref: 388e12765356
Ref: library/asyncio-eventloop asyncio loop call_later12765745
Ref: cfc12765745
Ref: library/asyncio-eventloop asyncio loop call_at12767634
Ref: cfd12767634
Ref: library/asyncio-eventloop asyncio loop time12768920
Ref: 388f12768920
Ref: 遅延コールバックのスケジューリング-Footnote-112769550
Ref: 遅延コールバックのスケジューリング-Footnote-212769592
Node: フューチャーとタスクの生成12769634
Ref: library/asyncio-eventloop creating-futures-and-tasks12769848
Ref: 389012769848
Ref: library/asyncio-eventloop asyncio loop create_future12769936
Ref: e7412769936
Ref: library/asyncio-eventloop asyncio loop create_task12770458
Ref: 1ca12770458
Ref: library/asyncio-eventloop asyncio loop set_task_factory12772615
Ref: 1c812772615
Ref: library/asyncio-eventloop asyncio loop get_task_factory12773558
Ref: fc512773558
Node: ネットワーク接続の確立12773753
Ref: library/asyncio-eventloop opening-network-connections12773952
Ref: 389112773952
Ref: library/asyncio-eventloop asyncio loop create_connection12774030
Ref: 81812774030
Ref: library/asyncio-eventloop asyncio loop create_datagram_endpoint12782784
Ref: 93c12782784
Ref: library/asyncio-eventloop asyncio loop create_unix_connection12787999
Ref: 37ff12787999
Ref: ネットワーク接続の確立-Footnote-112789266
Ref: ネットワーク接続の確立-Footnote-212789325
Node: ネットワークサーバの生成12789384
Ref: library/asyncio-eventloop creating-network-servers12789565
Ref: 389912789565
Ref: library/asyncio-eventloop loop-create-server12789648
Ref: 37bd12789648
Ref: library/asyncio-eventloop asyncio loop create_server12789648
Ref: d0912789648
Ref: library/asyncio-eventloop asyncio loop create_unix_server12795763
Ref: 4ca12795763
Ref: library/asyncio-eventloop asyncio loop connect_accepted_socket12797171
Ref: 9de12797171
Node: ファイルの転送12799093
Ref: library/asyncio-eventloop transferring-files12799272
Ref: 389b12799272
Ref: library/asyncio-eventloop asyncio loop sendfile12799330
Ref: 389c12799330
Node: TLS へのアップグレード12800951
Ref: library/asyncio-eventloop tls-upgrade12801124
Ref: 389d12801124
Ref: library/asyncio-eventloop asyncio loop start_tls12801200
Ref: cff12801200
Node: ファイル記述子の監視12803472
Ref: library/asyncio-eventloop watching-file-descriptors12803681
Ref: 389e12803681
Ref: library/asyncio-eventloop asyncio loop add_reader12803754
Ref: 381a12803754
Ref: library/asyncio-eventloop asyncio loop remove_reader12804138
Ref: 389f12804138
Ref: library/asyncio-eventloop asyncio loop add_writer12804325
Ref: 38a012804325
Ref: library/asyncio-eventloop asyncio loop remove_writer12804813
Ref: 38a112804813
Node: ソケットオブジェクトと直接やりとりする12805160
Ref: library/asyncio-eventloop working-with-socket-objects-directly12805341
Ref: 38a312805341
Ref: library/asyncio-eventloop asyncio loop sock_recv12805903
Ref: e0b12805903
Ref: library/asyncio-eventloop asyncio loop sock_recv_into12806659
Ref: d0012806659
Ref: library/asyncio-eventloop asyncio loop sock_recvfrom12807126
Ref: 81b12807126
Ref: library/asyncio-eventloop asyncio loop sock_recvfrom_into12807475
Ref: 81c12807475
Ref: library/asyncio-eventloop asyncio loop sock_sendall12807861
Ref: e0c12807861
Ref: library/asyncio-eventloop asyncio loop sock_sendto12808914
Ref: 81a12808914
Ref: library/asyncio-eventloop asyncio loop sock_connect12809238
Ref: fc812809238
Ref: library/asyncio-eventloop asyncio loop sock_accept12810052
Ref: e0d12810052
Ref: library/asyncio-eventloop asyncio loop sock_sendfile12811170
Ref: d0412811170
Node: DNS12813025
Ref: library/asyncio-eventloop dns12813206
Ref: 38a412813206
Ref: library/asyncio-eventloop asyncio loop getaddrinfo12813235
Ref: e0e12813235
Ref: library/asyncio-eventloop asyncio loop getnameinfo12813404
Ref: e0f12813404
Node: パイプとやりとりする12814405
Ref: library/asyncio-eventloop working-with-pipes12814546
Ref: 38a512814546
Ref: library/asyncio-eventloop asyncio loop connect_read_pipe12814619
Ref: 384612814619
Ref: library/asyncio-eventloop asyncio loop connect_write_pipe12815470
Ref: 384712815470
Node: Unix シグナル12816620
Ref: library/asyncio-eventloop unix-signals12816827
Ref: 38a812816827
Ref: library/asyncio-eventloop loop-add-signal-handler12816880
Ref: 37bf12816880
Ref: library/asyncio-eventloop asyncio loop add_signal_handler12816880
Ref: 38a912816880
Ref: library/asyncio-eventloop asyncio loop remove_signal_handler12818002
Ref: 38aa12818002
Node: スレッドまたはプロセスプールでコードを実行する12818412
Ref: library/asyncio-eventloop executing-code-in-thread-or-process-pools12818620
Ref: 38ab12818620
Ref: library/asyncio-eventloop asyncio loop run_in_executor12818758
Ref: ae612818758
Ref: library/asyncio-eventloop asyncio loop set_default_executor12821958
Ref: 94a12821958
Node: エラーハンドリング API12822337
Ref: library/asyncio-eventloop error-handling-api12822561
Ref: 38ac12822561
Ref: library/asyncio-eventloop asyncio loop set_exception_handler12822723
Ref: 38ad12822723
Ref: library/asyncio-eventloop asyncio loop get_exception_handler12823839
Ref: e7512823839
Ref: library/asyncio-eventloop asyncio loop default_exception_handler12824072
Ref: 38af12824072
Ref: library/asyncio-eventloop asyncio loop call_exception_handler12824581
Ref: 38ae12824581
Node: デバッグモードの有効化12825898
Ref: library/asyncio-eventloop enabling-debug-mode12826080
Ref: 38b012826080
Ref: library/asyncio-eventloop asyncio loop get_debug12826158
Ref: fc212826158
Ref: library/asyncio-eventloop asyncio loop set_debug12826499
Ref: fc112826499
Ref: library/asyncio-eventloop asyncio loop slow_callback_duration12826807
Ref: 38b112826807
Node: サブプロセスの実行12827132
Ref: library/asyncio-eventloop running-subprocesses12827274
Ref: 38b212827274
Ref: library/asyncio-eventloop loop-subprocess-exec12827861
Ref: 37be12827861
Ref: library/asyncio-eventloop asyncio loop subprocess_exec12827861
Ref: 384312827861
Ref: library/asyncio-eventloop asyncio loop subprocess_shell12832849
Ref: 384412832849
Ref: サブプロセスの実行-Footnote-112834700
Node: コールバックのハンドル12834770
Ref: library/asyncio-eventloop callback-handles12834939
Ref: 388212834939
Ref: library/asyncio-eventloop asyncio Handle12835017
Ref: 1e8412835017
Ref: library/asyncio-eventloop asyncio Handle get_context12835184
Ref: 38b512835184
Ref: library/asyncio-eventloop asyncio Handle cancel12835356
Ref: 38b612835356
Ref: library/asyncio-eventloop asyncio Handle cancelled12835590
Ref: d1012835590
Ref: library/asyncio-eventloop asyncio TimerHandle12835753
Ref: 1add12835753
Ref: library/asyncio-eventloop asyncio TimerHandle when12835972
Ref: d0d12835972
Node: Serverオブジェクト12836302
Ref: library/asyncio-eventloop server-objects12836465
Ref: 388312836465
Ref: library/asyncio-eventloop asyncio Server12836803
Ref: d0812836803
Ref: library/asyncio-eventloop asyncio Server close12837649
Ref: 37fd12837649
Ref: library/asyncio-eventloop asyncio Server close_clients12838161
Ref: 4ce12838161
Ref: library/asyncio-eventloop asyncio Server abort_clients12838535
Ref: 4cf12838535
Ref: library/asyncio-eventloop asyncio Server get_loop12838983
Ref: d0712838983
Ref: library/asyncio-eventloop asyncio Server start_serving12839145
Ref: d0a12839145
Ref: library/asyncio-eventloop asyncio Server serve_forever12839951
Ref: d0b12839951
Ref: library/asyncio-eventloop asyncio Server is_serving12841040
Ref: d0c12841040
Ref: library/asyncio-eventloop asyncio Server wait_closed12841230
Ref: 1a3f12841230
Ref: library/asyncio-eventloop asyncio Server sockets12841391
Ref: e1012841391
Ref: library/asyncio-eventloop asyncio-event-loops12841863
Ref: 38b812841863
Node: イベントループの実装12841863
Ref: library/asyncio-eventloop asyncio-event-loop-implementations12842006
Ref: 38b912842006
Ref: library/asyncio-eventloop event-loop-implementations12842006
Ref: 388412842006
Ref: library/asyncio-eventloop asyncio SelectorEventLoop12842292
Ref: 31412842292
Ref: library/asyncio-eventloop asyncio ProactorEventLoop12842920
Ref: 81d12842920
Ref: library/asyncio-eventloop asyncio EventLoop12843188
Ref: 1a6712843188
Ref: library/asyncio-eventloop asyncio AbstractEventLoop12843502
Ref: b5812843502
Ref: イベントループの実装-Footnote-112843843
Node: 使用例<25>12843922
Ref: library/asyncio-eventloop examples12844032
Ref: 388512844032
Node: call_soon を使った Hello World12844814
Ref: library/asyncio-eventloop asyncio-example-lowlevel-helloworld12844951
Ref: 38ba12844951
Ref: library/asyncio-eventloop hello-world-with-call-soon12844951
Ref: 38bb12844951
Node: call_later で現在の日時を表示する12845788
Ref: library/asyncio-eventloop asyncio-example-call-later12845991
Ref: 38bc12845991
Ref: library/asyncio-eventloop display-the-current-date-with-call-later12845991
Ref: 38bd12845991
Node: 読み込みイベント用ファイル記述子の監視12847037
Ref: library/asyncio-eventloop asyncio-example-watch-fd12847273
Ref: 381912847273
Ref: library/asyncio-eventloop watch-a-file-descriptor-for-read-events12847273
Ref: 38be12847273
Node: SIGINT および SIGTERM 用のシグナルハンドラーの設定12848725
Ref: library/asyncio-eventloop asyncio-example-unix-signals12848908
Ref: 38bf12848908
Ref: library/asyncio-eventloop set-signal-handlers-for-sigint-and-sigterm12848908
Ref: 38c012848908
Node: Future12849895
Ref: library/asyncio-future doc12850041
Ref: 36e312850041
Ref: library/asyncio-future asyncio-futures12850041
Ref: 37c112850041
Ref: library/asyncio-future futures12850041
Ref: 38c112850041
Ref: library/asyncio-future translation-repo12850041
Ref: 38c212850041
Ref: Future-Footnote-112850508
Ref: Future-Footnote-212850584
Node: Future の関数12850665
Ref: library/asyncio-future future-functions12850761
Ref: 38c312850761
Ref: library/asyncio-future asyncio isfuture12850813
Ref: 38c412850813
Ref: library/asyncio-future asyncio ensure_future12851216
Ref: e7112851216
Ref: library/asyncio-future asyncio wrap_future12852931
Ref: 1c7c12852931
Node: Future オブジェクト<2>12853318
Ref: library/asyncio-future asyncio-future-obj12853414
Ref: 38c512853414
Ref: library/asyncio-future future-object12853414
Ref: 38c612853414
Ref: library/asyncio-future asyncio Future12853481
Ref: dc612853481
Ref: library/asyncio-future asyncio Future result12854888
Ref: 38c712854888
Ref: library/asyncio-future asyncio Future set_result12855615
Ref: 37ed12855615
Ref: library/asyncio-future asyncio Future set_exception12855837
Ref: e7812855837
Ref: library/asyncio-future asyncio Future done12856065
Ref: 38c812856065
Ref: library/asyncio-future asyncio Future cancelled12856446
Ref: 38c912856446
Ref: library/asyncio-future asyncio Future add_done_callback12856873
Ref: cfe12856873
Ref: library/asyncio-future asyncio Future remove_done_callback12858260
Ref: 191112858260
Ref: library/asyncio-future asyncio Future cancel12858565
Ref: 1ba912858565
Ref: library/asyncio-future asyncio Future exception12859076
Ref: 38ca12859076
Ref: library/asyncio-future asyncio Future get_loop12859641
Ref: d0612859641
Ref: library/asyncio-future asyncio-example-future12859810
Ref: 38cb12859810
Ref: Future オブジェクト<2>-Footnote-112862296
Node: トランスポートとプロトコル12862338
Ref: library/asyncio-protocol doc12862475
Ref: 38cc12862475
Ref: library/asyncio-protocol asyncio-transports-protocols12862475
Ref: 37c012862475
Ref: library/asyncio-protocol translation-repo12862475
Ref: 38cd12862475
Ref: library/asyncio-protocol transports-and-protocols12862475
Ref: 38ce12862475
Node: トランスポート12865731
Ref: library/asyncio-protocol asyncio-transport12865855
Ref: 389312865855
Ref: library/asyncio-protocol transports12865855
Ref: 38cf12865855
Ref: トランスポート-Footnote-112866947
Node: トランスポートのクラス階層構造12867026
Ref: library/asyncio-protocol transports-hierarchy12867165
Ref: 38d612867165
Ref: library/asyncio-protocol asyncio BaseTransport12867263
Ref: 38d112867263
Ref: library/asyncio-protocol asyncio WriteTransport12867464
Ref: 38a712867464
Ref: library/asyncio-protocol asyncio ReadTransport12867895
Ref: 38a612867895
Ref: library/asyncio-protocol asyncio Transport12868267
Ref: 38d212868267
Ref: library/asyncio-protocol asyncio DatagramTransport12869145
Ref: 1b2712869145
Ref: library/asyncio-protocol asyncio SubprocessTransport12869456
Ref: 38b412869456
Node: 基底トランスポート12869833
Ref: library/asyncio-protocol base-transport12870023
Ref: 38d712870023
Ref: library/asyncio-protocol asyncio BaseTransport close12870091
Ref: 389612870091
Ref: library/asyncio-protocol asyncio BaseTransport is_closing12870733
Ref: e7312870733
Ref: library/asyncio-protocol asyncio BaseTransport get_extra_info12870886
Ref: c9312870886
Ref: library/asyncio-protocol asyncio BaseTransport set_protocol12873571
Ref: 38db12873571
Ref: library/asyncio-protocol asyncio BaseTransport get_protocol12873879
Ref: 38dc12873879
Node: 読み出し専用のトランスポート12873977
Ref: library/asyncio-protocol read-only-transports12874164
Ref: 38dd12874164
Ref: library/asyncio-protocol asyncio ReadTransport is_reading12874257
Ref: d1112874257
Ref: library/asyncio-protocol asyncio ReadTransport pause_reading12874432
Ref: d1312874432
Ref: library/asyncio-protocol asyncio ReadTransport resume_reading12874951
Ref: d1212874951
Node: 書き込み専用のトランスポート12875415
Ref: library/asyncio-protocol write-only-transports12875614
Ref: 38de12875614
Ref: library/asyncio-protocol asyncio WriteTransport abort12875707
Ref: 38b712875707
Ref: library/asyncio-protocol asyncio WriteTransport can_write_eof12876160
Ref: 38df12876160
Ref: library/asyncio-protocol asyncio WriteTransport get_write_buffer_size12876415
Ref: 38e112876415
Ref: library/asyncio-protocol asyncio WriteTransport get_write_buffer_limits12876592
Ref: fc412876592
Ref: library/asyncio-protocol asyncio WriteTransport set_write_buffer_limits12877000
Ref: 38e212877000
Ref: library/asyncio-protocol asyncio WriteTransport write12878806
Ref: 17ca12878806
Ref: library/asyncio-protocol asyncio WriteTransport writelines12879069
Ref: 17c912879069
Ref: library/asyncio-protocol asyncio WriteTransport write_eof12879450
Ref: 38e012879450
Node: データグラムトランスポート12879933
Ref: library/asyncio-protocol datagram-transports12880141
Ref: 38e512880141
Ref: library/asyncio-protocol asyncio DatagramTransport sendto12880229
Ref: 4cb12880229
Ref: library/asyncio-protocol asyncio DatagramTransport abort12881064
Ref: 38e612881064
Node: サブプロセス化されたトランスポート12881520
Ref: library/asyncio-protocol asyncio-subprocess-transports12881677
Ref: 384812881677
Ref: library/asyncio-protocol subprocess-transports12881677
Ref: 38e712881677
Ref: library/asyncio-protocol asyncio SubprocessTransport get_pid12881785
Ref: 38e812881785
Ref: library/asyncio-protocol asyncio SubprocessTransport get_pipe_transport12881906
Ref: 38e912881906
Ref: library/asyncio-protocol asyncio SubprocessTransport get_returncode12882674
Ref: 38ea12882674
Ref: library/asyncio-protocol asyncio SubprocessTransport kill12882976
Ref: 38eb12882976
Ref: library/asyncio-protocol asyncio SubprocessTransport send_signal12883345
Ref: 38ed12883345
Ref: library/asyncio-protocol asyncio SubprocessTransport terminate12883543
Ref: 38ec12883543
Ref: library/asyncio-protocol asyncio SubprocessTransport close12883979
Ref: 38ee12883979
Node: プロトコル<2>12884322
Ref: library/asyncio-protocol asyncio-protocol12884468
Ref: 389212884468
Ref: library/asyncio-protocol protocols12884468
Ref: 38d012884468
Ref: プロトコル<2>-Footnote-112885635
Node: 基底プロトコル12885713
Ref: library/asyncio-protocol base-protocols12885822
Ref: 38ef12885822
Ref: library/asyncio-protocol asyncio BaseProtocol12885880
Ref: 38d312885880
Ref: library/asyncio-protocol asyncio Protocol12886050
Ref: 38d412886050
Ref: library/asyncio-protocol asyncio BufferedProtocol12886227
Ref: c9412886227
Ref: library/asyncio-protocol asyncio DatagramProtocol12886425
Ref: 8de12886425
Ref: library/asyncio-protocol asyncio SubprocessProtocol12886576
Ref: 38b312886576
Node: 基底プロトコル<2>12886774
Ref: library/asyncio-protocol base-protocol12886928
Ref: 38f012886928
Ref: library/asyncio-protocol asyncio BaseProtocol connection_made12887453
Ref: 389412887453
Ref: library/asyncio-protocol asyncio BaseProtocol connection_lost12887777
Ref: 38d812887777
Ref: library/asyncio-protocol asyncio BaseProtocol pause_writing12888591
Ref: 38e312888591
Ref: library/asyncio-protocol asyncio BaseProtocol resume_writing12888782
Ref: 38e412888782
Node: ストリーミングプロトコル12889503
Ref: library/asyncio-protocol streaming-protocols12889702
Ref: 38f112889702
Ref: library/asyncio-protocol asyncio Protocol data_received12890189
Ref: 1b0212890189
Ref: library/asyncio-protocol asyncio Protocol eof_received12891214
Ref: 38f212891214
Node: バッファリングされたストリーミングプロトコル12892354
Ref: library/asyncio-protocol buffered-streaming-protocols12892562
Ref: 38f312892562
Ref: library/asyncio-protocol asyncio BufferedProtocol get_buffer12893589
Ref: 38f412893589
Ref: library/asyncio-protocol asyncio BufferedProtocol buffer_updated12894303
Ref: 38f512894303
Ref: library/asyncio-protocol asyncio BufferedProtocol eof_received12894533
Ref: 38f612894533
Node: データグラムプロトコル12895238
Ref: library/asyncio-protocol datagram-protocols12895443
Ref: 38f712895443
Ref: library/asyncio-protocol asyncio DatagramProtocol datagram_received12895725
Ref: 38f812895725
Ref: library/asyncio-protocol asyncio DatagramProtocol error_received12896070
Ref: 38f912896070
Node: サブプロセスプロトコル12897452
Ref: library/asyncio-protocol asyncio-subprocess-protocols12897582
Ref: 384912897582
Ref: library/asyncio-protocol subprocess-protocols12897582
Ref: 38fa12897582
Ref: library/asyncio-protocol asyncio SubprocessProtocol pipe_data_received12897894
Ref: 1b5012897894
Ref: library/asyncio-protocol asyncio SubprocessProtocol pipe_connection_lost12898268
Ref: 38fb12898268
Ref: library/asyncio-protocol asyncio SubprocessProtocol process_exited12898542
Ref: 1b4f12898542
Node: 使用例<26>12898830
Ref: library/asyncio-protocol examples12898946
Ref: 38d512898946
Node: TCP エコーサーバー12899258
Ref: library/asyncio-protocol asyncio-example-tcp-echo-server-protocol12899373
Ref: 381412899373
Ref: library/asyncio-protocol tcp-echo-server12899373
Ref: 38fc12899373
Node: TCP エコークライアント12900772
Ref: library/asyncio-protocol asyncio-example-tcp-echo-client-protocol12900921
Ref: 381112900921
Ref: library/asyncio-protocol tcp-echo-client12900921
Ref: 38fd12900921
Node: UDP エコーサーバー12902608
Ref: library/asyncio-protocol asyncio-udp-echo-server-protocol12902763
Ref: 389812902763
Ref: library/asyncio-protocol udp-echo-server12902763
Ref: 38fe12902763
Node: UDP エコークライアント12903961
Ref: library/asyncio-protocol asyncio-udp-echo-client-protocol12904118
Ref: 389712904118
Ref: library/asyncio-protocol udp-echo-client12904118
Ref: 38ff12904118
Node: 既存のソケットへの接続12905729
Ref: library/asyncio-protocol asyncio-example-create-connection12905904
Ref: 381812905904
Ref: library/asyncio-protocol connecting-existing-sockets12905904
Ref: 390012905904
Node: loop subprocess_exec と SubprocessProtocol12908006
Ref: library/asyncio-protocol asyncio-example-subprocess-proto12908141
Ref: 385812908141
Ref: library/asyncio-protocol loop-subprocess-exec-and-subprocessprotocol12908141
Ref: 390112908141
Node: ポリシー12910564
Ref: library/asyncio-policy doc12910737
Ref: 390212910737
Ref: library/asyncio-policy asyncio-policies12910737
Ref: 388012910737
Ref: library/asyncio-policy policies12910737
Ref: 390312910737
Ref: library/asyncio-policy translation-repo12910737
Ref: 390412910737
Node: ポリシーの取得と設定12911979
Ref: library/asyncio-policy asyncio-policy-get-set12912097
Ref: 390512912097
Ref: library/asyncio-policy getting-and-setting-the-policy12912097
Ref: 390912912097
Ref: library/asyncio-policy asyncio get_event_loop_policy12912290
Ref: 31212912290
Ref: library/asyncio-policy asyncio set_event_loop_policy12912560
Ref: 31312912560
Node: ポリシーオブジェクト12912973
Ref: library/asyncio-policy asyncio-policy-objects12913133
Ref: 390812913133
Ref: library/asyncio-policy policy-objects12913133
Ref: 390a12913133
Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy12913313
Ref: 30e12913313
Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy get_event_loop12913421
Ref: 390b12913421
Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy set_event_loop12913819
Ref: 390c12913819
Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy new_event_loop12913957
Ref: 390d12913957
Ref: library/asyncio-policy asyncio-policy-builtin12914309
Ref: 390612914309
Ref: library/asyncio-policy asyncio DefaultEventLoopPolicy12914374
Ref: 30f12914374
Ref: library/asyncio-policy asyncio WindowsSelectorEventLoopPolicy12915266
Ref: 31012915266
Ref: library/asyncio-policy asyncio WindowsProactorEventLoopPolicy12915642
Ref: 31112915642
Node: ポリシーのカスタマイズ12916018
Ref: library/asyncio-policy asyncio-custom-policies12916139
Ref: 390712916139
Ref: library/asyncio-policy custom-policies12916139
Ref: 390e12916139
Node: プラットフォームでのサポート12916856
Ref: library/asyncio-platforms doc12916999
Ref: 390f12916999
Ref: library/asyncio-platforms asyncio-platform-support12916999
Ref: 38a212916999
Ref: library/asyncio-platforms platform-support12916999
Ref: 391012916999
Ref: library/asyncio-platforms translation-repo12916999
Ref: 391112916999
Node: 全てのプラットホーム12917445
Ref: library/asyncio-platforms all-platforms12917574
Ref: 391212917574
Node: Windows<84>12917793
Ref: library/asyncio-platforms windows12917940
Ref: 391312917940
Ref: Windows<84>-Footnote-112920228
Ref: Windows<84>-Footnote-212920312
Ref: Windows<84>-Footnote-312920395
Ref: Windows<84>-Footnote-412920477
Node: Windows におけるサブプロセスのサポート12920542
Ref: library/asyncio-platforms asyncio-windows-subprocess12920643
Ref: 384512920643
Ref: library/asyncio-platforms subprocess-support-on-windows12920643
Ref: 391512920643
Node: macOS<52>12920967
Ref: library/asyncio-platforms macos12921075
Ref: 391612921075
Node: Extending12921931
Ref: library/asyncio-extending doc12922097
Ref: 391812922097
Ref: library/asyncio-extending extending12922097
Ref: 391912922097
Ref: library/asyncio-extending translation-repo12922097
Ref: 391a12922097
Node: Writing a Custom Event Loop12922579
Ref: library/asyncio-extending writing-a-custom-event-loop12922697
Ref: 391b12922697
Node: Future and Task private constructors12923416
Ref: library/asyncio-extending future-and-task-private-constructors12923564
Ref: 391c12923564
Ref: library/asyncio-extending asyncio Future __init__12924128
Ref: 391d12924128
Ref: library/asyncio-extending asyncio Task __init__12924268
Ref: 391e12924268
Node: Task lifetime support12924601
Ref: library/asyncio-extending task-lifetime-support12924713
Ref: 391f12924713
Ref: library/asyncio-extending asyncio _register_task12924949
Ref: 392012924949
Ref: library/asyncio-extending asyncio _unregister_task12925097
Ref: 392112925097
Ref: library/asyncio-extending asyncio _enter_task12925275
Ref: 392212925275
Ref: library/asyncio-extending asyncio _leave_task12925534
Ref: 392312925534
Node: 高水準の API インデックス12925759
Ref: library/asyncio-api-index doc12925918
Ref: a7912925918
Ref: library/asyncio-api-index high-level-api-index12925918
Ref: 392412925918
Ref: library/asyncio-api-index translation-repo12925918
Ref: 392512925918
Node: Task12926290
Ref: library/asyncio-api-index tasks12926387
Ref: 392612926387
Node: キュー<2>12931149
Ref: library/asyncio-api-index queues12931276
Ref: 392712931276
Node: サブプロセス<2>12932186
Ref: library/asyncio-api-index subprocesses12932327
Ref: 392812932327
Node: ストリーム<2>12933040
Ref: library/asyncio-api-index streams12933175
Ref: 392912933175
Node: 同期12934930
Ref: library/asyncio-api-index synchronization12935054
Ref: 392a12935054
Node: 例外<17>12936614
Ref: library/asyncio-api-index exceptions12936711
Ref: 392b12936711
Node: 低水準の API インデックス12937616
Ref: library/asyncio-llapi-index doc12937786
Ref: 392c12937786
Ref: library/asyncio-llapi-index low-level-api-index12937786
Ref: 392d12937786
Ref: library/asyncio-llapi-index translation-repo12937786
Ref: 392e12937786
Node: イベントループの取得12938212
Ref: library/asyncio-llapi-index obtaining-the-event-loop12938362
Ref: 392f12938362
Node: イベントループのメソッド<2>12939658
Ref: library/asyncio-llapi-index event-loop-methods12939841
Ref: 393012939841
Node: トランスポート<2>12953823
Ref: library/asyncio-llapi-index transports12953994
Ref: 393112953994
Node: プロトコル<3>12961404
Ref: library/asyncio-llapi-index protocols12961572
Ref: 393212961572
Node: イベントループのポリシー12966135
Ref: library/asyncio-llapi-index event-loop-policies12966270
Ref: 393312966270
Node: asyncio での開発12967291
Ref: library/asyncio-dev doc12967417
Ref: 393412967417
Ref: library/asyncio-dev asyncio-dev12967417
Ref: 393512967417
Ref: library/asyncio-dev developing-with-asyncio12967417
Ref: 393612967417
Ref: library/asyncio-dev translation-repo12967417
Ref: 393712967417
Node: デバッグモード12967963
Ref: library/asyncio-dev asyncio-debug-mode12968092
Ref: 213a12968092
Ref: library/asyncio-dev debug-mode12968092
Ref: 393812968092
Node: 並行処理とマルチスレッド処理12969932
Ref: library/asyncio-dev asyncio-multithreading12970106
Ref: 37e812970106
Ref: library/asyncio-dev concurrency-and-multithreading12970106
Ref: 393a12970106
Node: ブロッキングコードの実行12973321
Ref: library/asyncio-dev asyncio-handle-blocking12973489
Ref: 393b12973489
Ref: library/asyncio-dev running-blocking-code12973489
Ref: 393c12973489
Node: ログ記録<3>12974130
Ref: library/asyncio-dev asyncio-logger12974313
Ref: 393912974313
Ref: library/asyncio-dev logging12974313
Ref: 393d12974313
Node: 待ち受け処理を伴わないコルーチンの検出12974974
Ref: library/asyncio-dev asyncio-coroutine-not-scheduled12975154
Ref: 393f12975154
Ref: library/asyncio-dev detect-never-awaited-coroutines12975154
Ref: 394012975154
Node: 回収されない例外の検出12976378
Ref: library/asyncio-dev detect-never-retrieved-exceptions12976534
Ref: 394112976534
Ref: 回収されない例外の検出-Footnote-112978375
Node: socket --- 低水準ネットワークインターフェース12978440
Ref: library/socket doc12978695
Ref: 394212978695
Ref: library/socket module-socket12978695
Ref: d112978695
Ref: library/socket socket-low-level-networking-interface12978695
Ref: 394312978695
Ref: library/socket translation-repo12978695
Ref: 394412978695
Ref: socket --- 低水準ネットワークインターフェース-Footnote-112980714
Node: ソケットファミリー12980780
Ref: library/socket socket-families12980939
Ref: 394512980939
Ref: library/socket host-port12982670
Ref: 394612982670
Ref: ソケットファミリー-Footnote-112995558
Ref: ソケットファミリー-Footnote-212995600
Node: モジュールの内容12995645
Ref: library/socket module-contents12995838
Ref: 395212995838
Node: 例外<18>12996030
Ref: library/socket exceptions12996119
Ref: 395312996119
Ref: library/socket socket error12996150
Ref: 126112996150
Ref: library/socket socket herror12996390
Ref: 395412996390
Ref: library/socket socket gaierror12997109
Ref: 1ac412997109
Ref: library/socket socket timeout12997744
Ref: a3512997744
Ref: 例外<18>-Footnote-112998578
Node: 定数<8>12998620
Ref: library/socket constants12998727
Ref: 395612998727
Ref: library/socket socket AF_UNIX12998911
Ref: 1bb012998911
Ref: library/socket socket AF_INET12998941
Ref: 1bad12998941
Ref: library/socket socket AF_INET612998971
Ref: 1bae12998971
Ref: library/socket socket AF_UNSPEC12999290
Ref: 389a12999290
Ref: library/socket socket SOCK_STREAM12999506
Ref: 150b12999506
Ref: library/socket socket SOCK_DGRAM12999540
Ref: 150a12999540
Ref: library/socket socket SOCK_RAW12999573
Ref: 395712999573
Ref: library/socket socket SOCK_RDM12999604
Ref: 395812999604
Ref: library/socket socket SOCK_SEQPACKET12999635
Ref: 395912999635
Ref: library/socket socket SOCK_CLOEXEC12999941
Ref: e0512999941
Ref: library/socket socket SOCK_NONBLOCK12999976
Ref: e0412999976
Ref: library/socket socket-unix-constants13000490
Ref: d6c13000490
Ref: library/socket socket SOMAXCONN13000510
Ref: 105f13000510
Ref: library/socket socket AF_CAN13003579
Ref: 394713003579
Ref: library/socket socket PF_CAN13003608
Ref: 395a13003608
Ref: library/socket socket CAN_BCM13004083
Ref: 11a513004083
Ref: library/socket socket CAN_RAW_FD_FRAMES13004570
Ref: 10ca13004570
Ref: library/socket socket CAN_RAW_JOIN_FILTERS13005191
Ref: b2b13005191
Ref: library/socket socket CAN_ISOTP13005531
Ref: 394813005531
Ref: library/socket socket CAN_J193913005788
Ref: b2c13005788
Ref: library/socket socket AF_DIVERT13006029
Ref: 395b13006029
Ref: library/socket socket PF_DIVERT13006061
Ref: 395c13006061
Ref: library/socket socket AF_PACKET13006293
Ref: 394e13006293
Ref: library/socket socket PF_PACKET13006325
Ref: 395d13006325
Ref: library/socket socket ETH_P_ALL13006556
Ref: 1b2313006556
Ref: library/socket socket AF_RDS13006911
Ref: 395e13006911
Ref: library/socket socket PF_RDS13006940
Ref: 395f13006940
Ref: library/socket socket SOL_RDS13006969
Ref: 396013006969
Ref: library/socket socket SIO_RCVALL13007226
Ref: 396113007226
Ref: library/socket socket SIO_KEEPALIVE_VALS13007259
Ref: 396213007259
Ref: library/socket socket SIO_LOOPBACK_FAST_PATH13007300
Ref: ecf13007300
Ref: library/socket socket AF_ALG13007853
Ref: ed213007853
Ref: library/socket socket SOL_ALG13007882
Ref: 396313007882
Ref: library/socket socket AF_VSOCK13008065
Ref: d6d13008065
Ref: library/socket socket IOCTL_VM_SOCKETS_GET_LOCAL_CID13008096
Ref: 396413008096
Ref: library/socket socket AF_LINK13008324
Ref: 11a613008324
Ref: library/socket socket has_ipv613008428
Ref: 396513008428
Ref: library/socket socket AF_BLUETOOTH13008573
Ref: 1baf13008573
Ref: library/socket socket BTPROTO_L2CAP13008608
Ref: 28313008608
Ref: library/socket socket BTPROTO_RFCOMM13008644
Ref: 394c13008644
Ref: library/socket socket BTPROTO_HCI13008681
Ref: 28113008681
Ref: library/socket socket BTPROTO_SCO13008715
Ref: 28213008715
Ref: library/socket socket BDADDR_ANY13008808
Ref: 396613008808
Ref: library/socket socket BDADDR_LOCAL13008841
Ref: 396713008841
Ref: library/socket socket BDADDR_BREDR13009187
Ref: 394913009187
Ref: library/socket socket BDADDR_LE_PUBLIC13009222
Ref: 394a13009222
Ref: library/socket socket BDADDR_LE_RANDOM13009261
Ref: 394b13009261
Ref: library/socket socket SOL_RFCOMM13009504
Ref: 396813009504
Ref: library/socket socket SOL_L2CAP13009537
Ref: 396913009537
Ref: library/socket socket SOL_HCI13009569
Ref: 396a13009569
Ref: library/socket socket SOL_SCO13009599
Ref: 396b13009599
Ref: library/socket socket SOL_BLUETOOTH13009629
Ref: 396c13009629
Ref: library/socket socket L2CAP_LM13009969
Ref: 396d13009969
Ref: library/socket socket HCI_FILTER13010539
Ref: 396e13010539
Ref: library/socket socket HCI_TIME_STAMP13010572
Ref: 396f13010572
Ref: library/socket socket HCI_DATA_DIR13010609
Ref: 397013010609
Ref: library/socket socket SO_HCI_EVT_FILTER13010644
Ref: 397113010644
Ref: library/socket socket SO_HCI_PKT_FILTER13010684
Ref: 397213010684
Ref: library/socket socket HCI_DEV_NONE13011050
Ref: 397313011050
Ref: library/socket socket HCI_CHANNEL_RAW13011271
Ref: 394d13011271
Ref: library/socket socket HCI_CHANNEL_USER13011309
Ref: 397413011309
Ref: library/socket socket HCI_CHANNEL_MONITOR13011348
Ref: 397513011348
Ref: library/socket socket HCI_CHANNEL_CONTROL13011390
Ref: 397613011390
Ref: library/socket socket HCI_CHANNEL_LOGGING13011432
Ref: 397713011432
Ref: library/socket socket AF_QIPCRTR13011634
Ref: 394f13011634
Ref: library/socket socket SCM_CREDS213011833
Ref: 397813011833
Ref: library/socket socket LOCAL_CREDS13011866
Ref: 397913011866
Ref: library/socket socket LOCAL_CREDS_PERSISTENT13011900
Ref: 397a13011900
Ref: library/socket socket SO_INCOMING_CPU13012343
Ref: 397b13012343
Ref: library/socket socket SO_REUSEPORT_LB13012554
Ref: 18d413012554
Ref: library/socket socket AF_HYPERV13012768
Ref: 395013012768
Ref: library/socket socket HV_PROTOCOL_RAW13012800
Ref: 397c13012800
Ref: library/socket socket HVSOCKET_CONNECT_TIMEOUT13012838
Ref: 397d13012838
Ref: library/socket socket HVSOCKET_CONNECT_TIMEOUT_MAX13012885
Ref: 397e13012885
Ref: library/socket socket HVSOCKET_CONNECTED_SUSPEND13012936
Ref: 397f13012936
Ref: library/socket socket HVSOCKET_ADDRESS_FLAG_PASSTHRU13012985
Ref: 398013012985
Ref: library/socket socket HV_GUID_ZERO13013038
Ref: 398113013038
Ref: library/socket socket HV_GUID_WILDCARD13013073
Ref: 398213013073
Ref: library/socket socket HV_GUID_BROADCAST13013112
Ref: 398313013112
Ref: library/socket socket HV_GUID_CHILDREN13013152
Ref: 398413013152
Ref: library/socket socket HV_GUID_LOOPBACK13013191
Ref: 398513013191
Ref: library/socket socket HV_GUID_PARENT13013230
Ref: 398613013230
Ref: library/socket socket-ethernet-types13013419
Ref: 1b2413013419
Ref: library/socket socket ETHERTYPE_ARP13013419
Ref: 398713013419
Ref: library/socket socket ETHERTYPE_IP13013455
Ref: 398813013455
Ref: library/socket socket ETHERTYPE_IPV613013490
Ref: 398913013490
Ref: library/socket socket ETHERTYPE_VLAN13013527
Ref: 398a13013527
Ref: library/socket socket SHUT_RD13013699
Ref: 398b13013699
Ref: library/socket socket SHUT_WR13013729
Ref: 398c13013729
Ref: library/socket socket SHUT_RDWR13013759
Ref: 398d13013759
Ref: 定数<8>-Footnote-113013964
Ref: 定数<8>-Footnote-213014016
Ref: 定数<8>-Footnote-313014062
Node: 関数<8>13014142
Ref: library/socket functions13014230
Ref: 398f13014230
Node: ソケットの作成13014342
Ref: library/socket creating-sockets13014439
Ref: 399013014439
Ref: library/socket socket socket13014570
Ref: fa113014570
Ref: library/socket socket socketpair13017525
Ref: df013017525
Ref: library/socket socket create_connection13018426
Ref: 88213018426
Ref: library/socket socket create_server13020241
Ref: c2013020241
Ref: library/socket socket has_dualstack_ipv613022074
Ref: c2113022074
Ref: library/socket socket fromfd13022272
Ref: 399213022272
Ref: library/socket socket fromshare13023204
Ref: e0113023204
Ref: library/socket socket SocketType13023522
Ref: 399413023522
Node: その他の関数<2>13023680
Ref: library/socket other-functions13023777
Ref: 399513023777
Ref: library/socket socket close13023899
Ref: d6a13023899
Ref: library/socket socket getaddrinfo13024171
Ref: 1ac313024171
Ref: library/socket socket getfqdn13028486
Ref: 1aed13028486
Ref: library/socket socket gethostbyname13029104
Ref: 399613029104
Ref: library/socket socket gethostbyname_ex13029944
Ref: 1c8513029944
Ref: library/socket socket gethostname13030757
Ref: 302613030757
Ref: library/socket socket gethostbyaddr13031293
Ref: 1c8413031293
Ref: library/socket socket getnameinfo13032059
Ref: 1a3a13032059
Ref: library/socket socket getprotobyname13032856
Ref: 399713032856
Ref: library/socket socket getservbyname13033350
Ref: 399813033350
Ref: library/socket socket getservbyport13033961
Ref: 399913033961
Ref: library/socket socket ntohl13034540
Ref: 399a13034540
Ref: library/socket socket ntohs13034943
Ref: a8013034943
Ref: library/socket socket htonl13035472
Ref: 399b13035472
Ref: library/socket socket htons13035875
Ref: a7f13035875
Ref: library/socket socket inet_aton13036404
Ref: b5a13036404
Ref: library/socket socket inet_ntoa13037397
Ref: 399c13037397
Ref: library/socket socket inet_pton13038429
Ref: b5b13038429
Ref: library/socket socket inet_ntop13039345
Ref: 11a713039345
Ref: library/socket socket CMSG_LEN13040617
Ref: 1e1813040617
Ref: library/socket socket CMSG_SPACE13041574
Ref: 1e1713041574
Ref: library/socket socket getdefaulttimeout13042728
Ref: 399313042728
Ref: library/socket socket setdefaulttimeout13043122
Ref: 395513043122
Ref: library/socket socket sethostname13043554
Ref: 135313043554
Ref: library/socket socket if_nameindex13043943
Ref: c2213043943
Ref: library/socket socket if_nametoindex13044856
Ref: c2313044856
Ref: library/socket socket if_indextoname13045453
Ref: c2413045453
Ref: library/socket socket send_fds13046049
Ref: b2d13046049
Ref: library/socket socket recv_fds13046525
Ref: b2e13046525
Ref: その他の関数<2>-Footnote-113047113
Ref: その他の関数<2>-Footnote-213047166
Ref: その他の関数<2>-Footnote-313047217
Ref: その他の関数<2>-Footnote-413047261
Node: socket オブジェクト13047320
Ref: library/socket id113047531
Ref: 399d13047531
Ref: library/socket socket-objects13047531
Ref: 399113047531
Ref: library/socket socket socket accept13048025
Ref: fa213048025
Ref: library/socket socket socket bind13049013
Ref: 12d713049013
Ref: library/socket socket socket close13049465
Ref: f3f13049465
Ref: library/socket socket socket connect13050540
Ref: fa313050540
Ref: library/socket socket socket connect_ex13051858
Ref: 175313051858
Ref: library/socket socket socket detach13052636
Ref: 143513052636
Ref: library/socket socket socket dup13052932
Ref: 399e13052932
Ref: library/socket socket socket fileno13053237
Ref: 399f13053237
Ref: library/socket socket socket get_inheritable13053705
Ref: 110113053705
Ref: library/socket socket socket getpeername13054043
Ref: 38d913054043
Ref: library/socket socket socket getsockname13054468
Ref: 28413054468
Ref: library/socket socket socket getsockopt13054779
Ref: ed013054779
Ref: library/socket socket socket getblocking13055537
Ref: d6913055537
Ref: library/socket socket socket gettimeout13055767
Ref: 39a013055767
Ref: library/socket socket socket ioctl13056197
Ref: ece13056197
Ref: library/socket socket socket listen13057041
Ref: 105e13057041
Ref: library/socket socket socket makefile13057664
Ref: 13b713057664
Ref: library/socket socket socket recv13059132
Ref: fa413059132
Ref: library/socket socket socket recvfrom13059948
Ref: fa513059948
Ref: library/socket socket socket recvmsg13061097
Ref: fa613061097
Ref: library/socket socket socket recvmsg_into13065886
Ref: 135213065886
Ref: library/socket socket socket recvfrom_into13067825
Ref: 153613067825
Ref: library/socket socket socket recv_into13068516
Ref: 153513068516
Ref: library/socket socket socket send13069139
Ref: fa713069139
Ref: library/socket socket socket sendall13070257
Ref: fa813070257
Ref: library/socket socket socket sendto13071558
Ref: fa913071558
Ref: library/socket socket socket sendmsg13072605
Ref: 6a113072605
Ref: library/socket socket socket sendmsg_afalg13075312
Ref: ed313075312
Ref: library/socket socket socket sendfile13075728
Ref: 105d13075728
Ref: library/socket socket socket set_inheritable13076899
Ref: 110213076899
Ref: library/socket socket socket setblocking13077130
Ref: 303c13077130
Ref: library/socket socket socket settimeout13077862
Ref: 395113077862
Ref: library/socket socket socket setsockopt13078633
Ref: ed113078633
Ref: library/socket socket socket shutdown13079801
Ref: 398e13079801
Ref: library/socket socket socket share13080212
Ref: e0213080212
Ref: library/socket socket socket family13081496
Ref: 39a313081496
Ref: library/socket socket socket type13081563
Ref: e0613081563
Ref: library/socket socket socket proto13081622
Ref: 39a413081622
Ref: socket オブジェクト-Footnote-113081724
Ref: socket オブジェクト-Footnote-213081766
Ref: socket オブジェクト-Footnote-313081808
Ref: socket オブジェクト-Footnote-413081858
Ref: socket オブジェクト-Footnote-513081932
Ref: socket オブジェクト-Footnote-613081976
Ref: socket オブジェクト-Footnote-713082018
Ref: socket オブジェクト-Footnote-813082062
Ref: socket オブジェクト-Footnote-913082104
Ref: socket オブジェクト-Footnote-1013082146
Ref: socket オブジェクト-Footnote-1113082191
Ref: socket オブジェクト-Footnote-1213082236
Ref: socket オブジェクト-Footnote-1313082279
Ref: socket オブジェクト-Footnote-1413082322
Ref: socket オブジェクト-Footnote-1513082365
Ref: socket オブジェクト-Footnote-1613082408
Node: ソケットタイムアウトの注意事項13082459
Ref: library/socket notes-on-socket-timeouts13082659
Ref: 39a513082659
Ref: library/socket socket-timeouts13082659
Ref: 39a213082659
Node: タイムアウトと connect メソッド13084610
Ref: library/socket timeouts-and-the-connect-method13084784
Ref: 39a613084784
Node: タイムアウトと accept メソッド13085350
Ref: library/socket timeouts-and-the-accept-method13085524
Ref: 39a713085524
Node: 使用例<27>13086592
Ref: library/socket example13086758
Ref: 39a813086758
Ref: library/socket socket-example13086758
Ref: 39a913086758
Ref: 使用例<27>-Footnote-113095025
Node: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー13095084
Ref: library/ssl doc13095344
Ref: 39aa13095344
Ref: library/ssl module-ssl13095344
Ref: d513095344
Ref: library/ssl ssl-tls-ssl-wrapper-for-socket-objects13095344
Ref: 39ab13095344
Ref: library/ssl translation-repo13095344
Ref: 39ac13095344
Ref: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー-Footnote-113098910
Ref: ssl --- ソケットオブジェクト用の TLS/SSL ラッパー-Footnote-213098973
Node: 関数、定数、例外13099015
Ref: library/ssl functions-constants-and-exceptions13099166
Ref: 39ad13099166
Node: ソケットの作成<2>13099409
Ref: library/ssl socket-creation13099530
Ref: 39ae13099530
Node: コンテキストの作成13101063
Ref: library/ssl context-creation13101203
Ref: 39af13101203
Ref: library/ssl ssl create_default_context13101419
Ref: 48013101419
Ref: コンテキストの作成-Footnote-113105944
Ref: コンテキストの作成-Footnote-213106003
Ref: コンテキストの作成-Footnote-313106048
Node: 例外<19>13106107
Ref: library/ssl exceptions13106235
Ref: 39b413106235
Ref: library/ssl ssl SSLError13106266
Ref: 149113106266
Ref: library/ssl ssl SSLError library13106968
Ref: 135f13106968
Ref: library/ssl ssl SSLError reason13107275
Ref: 136013107275
Ref: library/ssl ssl SSLZeroReturnError13107555
Ref: 39b513107555
Ref: library/ssl ssl SSLWantReadError13107958
Ref: 106913107958
Ref: library/ssl ssl SSLWantWriteError13108352
Ref: 106a13108352
Ref: library/ssl ssl SSLSyscallError13108747
Ref: 39b713108747
Ref: library/ssl ssl SSLEOFError13109092
Ref: 1ab813109092
Ref: library/ssl ssl SSLCertVerificationError13109419
Ref: d7513109419
Ref: library/ssl ssl SSLCertVerificationError verify_code13109583
Ref: 39b813109583
Ref: library/ssl ssl SSLCertVerificationError verify_message13109687
Ref: 39b913109687
Ref: library/ssl ssl CertificateError13109785
Ref: 39ba13109785
Node: 乱数生成13110001
Ref: library/ssl random-generation13110126
Ref: 39bb13110126
Ref: library/ssl ssl RAND_bytes13110167
Ref: 74713110167
Ref: library/ssl ssl RAND_status13111161
Ref: 1c7e13111161
Ref: library/ssl ssl RAND_add13111528
Ref: 39bc13111528
Ref: 乱数生成-Footnote-113112023
Ref: 乱数生成-Footnote-213112117
Ref: 乱数生成-Footnote-313112255
Node: 証明書の取り扱い13112314
Ref: library/ssl certificate-handling13112438
Ref: 39bd13112438
Ref: library/ssl ssl cert_time_to_seconds13112499
Ref: 106b13112499
Ref: library/ssl ssl get_server_certificate13113524
Ref: a3d13113524
Ref: library/ssl ssl DER_cert_to_PEM_cert13114776
Ref: 39bf13114776
Ref: library/ssl ssl PEM_cert_to_DER_cert13115007
Ref: 39c013115007
Ref: library/ssl ssl get_default_verify_paths13115220
Ref: 11ac13115220
Ref: library/ssl ssl enum_certificates13116188
Ref: 11b713116188
Ref: library/ssl ssl enum_crls13117275
Ref: 11b813117275
Ref: 証明書の取り扱い-Footnote-113117995
Node: 定数<9>13118054
Ref: library/ssl constants13118157
Ref: 39c113118157
Ref: library/ssl ssl CERT_NONE13118367
Ref: 39c213118367
Ref: library/ssl ssl CERT_OPTIONAL13119005
Ref: 39c313119005
Ref: library/ssl ssl CERT_REQUIRED13119761
Ref: 39b113119761
Ref: library/ssl ssl VerifyMode13120737
Ref: 39c513120737
Ref: library/ssl ssl VERIFY_DEFAULT13120872
Ref: 11b113120872
Ref: library/ssl ssl VERIFY_CRL_CHECK_LEAF13121200
Ref: 11b213121200
Ref: library/ssl ssl VERIFY_CRL_CHECK_CHAIN13121740
Ref: 11b313121740
Ref: library/ssl ssl VERIFY_X509_STRICT13122026
Ref: 55113122026
Ref: library/ssl ssl VERIFY_ALLOW_PROXY_CERTS13122249
Ref: 1c9513122249
Ref: library/ssl ssl VERIFY_X509_TRUSTED_FIRST13122433
Ref: 39c613122433
Ref: library/ssl ssl VERIFY_X509_PARTIAL_CHAIN13122792
Ref: 48113122792
Ref: library/ssl ssl VerifyFlags13123232
Ref: 39c713123232
Ref: library/ssl ssl PROTOCOL_TLS13123370
Ref: 39b313123370
Ref: library/ssl ssl PROTOCOL_TLS_CLIENT13123976
Ref: a7213123976
Ref: library/ssl ssl PROTOCOL_TLS_SERVER13124294
Ref: a7313124294
Ref: library/ssl ssl PROTOCOL_SSLv2313124514
Ref: 39c813124514
Ref: library/ssl ssl PROTOCOL_SSLv313124726
Ref: 39be13124726
Ref: library/ssl ssl PROTOCOL_TLSv113125440
Ref: 39c913125440
Ref: library/ssl ssl PROTOCOL_TLSv1_113125672
Ref: 11aa13125672
Ref: library/ssl ssl PROTOCOL_TLSv1_213125993
Ref: 11ab13125993
Ref: library/ssl ssl OP_ALL13126316
Ref: 39ca13126316
Ref: library/ssl ssl OP_NO_SSLv213126707
Ref: a3a13126707
Ref: library/ssl ssl OP_NO_SSLv313127112
Ref: a3b13127112
Ref: library/ssl ssl OP_NO_TLSv113127517
Ref: 39cb13127517
Ref: library/ssl ssl OP_NO_TLSv1_113128056
Ref: 39cc13128056
Ref: library/ssl ssl OP_NO_TLSv1_213128565
Ref: 39cd13128565
Ref: library/ssl ssl OP_NO_TLSv1_313129074
Ref: 1c5b13129074
Ref: library/ssl ssl OP_NO_RENEGOTIATION13129671
Ref: 39ce13129671
Ref: library/ssl ssl OP_CIPHER_SERVER_PREFERENCE13129975
Ref: 136113129975
Ref: library/ssl ssl OP_SINGLE_DH_USE13130299
Ref: 39cf13130299
Ref: library/ssl ssl OP_SINGLE_ECDH_USE13130559
Ref: 39d013130559
Ref: library/ssl ssl OP_ENABLE_MIDDLEBOX_COMPAT13130823
Ref: 39d113130823
Ref: library/ssl ssl OP_NO_COMPRESSION13131123
Ref: 135e13131123
Ref: library/ssl ssl Options13131374
Ref: 39d213131374
Ref: library/ssl ssl OP_NO_TICKET13131476
Ref: 39d313131476
Ref: library/ssl ssl OP_IGNORE_UNEXPECTED_EOF13131655
Ref: a3813131655
Ref: library/ssl ssl OP_ENABLE_KTLS13131863
Ref: 1b0f13131863
Ref: library/ssl ssl OP_LEGACY_SERVER_CONNECT13132593
Ref: 1af113132593
Ref: library/ssl ssl HAS_ALPN13132758
Ref: 106613132758
Ref: library/ssl ssl HAS_NEVER_CHECK_COMMON_NAME13133008
Ref: 39d413133008
Ref: library/ssl ssl HAS_ECDH13133251
Ref: 39d513133251
Ref: library/ssl ssl HAS_SNI13133581
Ref: 39d613133581
Ref: library/ssl ssl HAS_NPN13133807
Ref: 39d713133807
Ref: library/ssl ssl HAS_SSLv213134231
Ref: 39d813134231
Ref: library/ssl ssl HAS_SSLv313134412
Ref: 39d913134412
Ref: library/ssl ssl HAS_TLSv113134593
Ref: 39da13134593
Ref: library/ssl ssl HAS_TLSv1_113134774
Ref: d7c13134774
Ref: library/ssl ssl HAS_TLSv1_213134957
Ref: 39db13134957
Ref: library/ssl ssl HAS_TLSv1_313135140
Ref: 39dc13135140
Ref: library/ssl ssl HAS_PSK13135323
Ref: 39dd13135323
Ref: library/ssl ssl HAS_PHA13135448
Ref: 28613135448
Ref: library/ssl ssl CHANNEL_BINDING_TYPES13135573
Ref: 39de13135573
Ref: library/ssl ssl OPENSSL_VERSION13135857
Ref: 143713135857
Ref: library/ssl ssl OPENSSL_VERSION_INFO13136109
Ref: 143813136109
Ref: library/ssl ssl OPENSSL_VERSION_NUMBER13136335
Ref: 143913136335
Ref: library/ssl ssl ALERT_DESCRIPTION_HANDSHAKE_FAILURE13136627
Ref: 39df13136627
Ref: library/ssl ssl ALERT_DESCRIPTION_INTERNAL_ERROR13136682
Ref: 39e013136682
Ref: library/ssl ssl AlertDescription13137147
Ref: 39e113137147
Ref: library/ssl ssl Purpose SERVER_AUTH13137308
Ref: 11b513137308
Ref: library/ssl ssl Purpose CLIENT_AUTH13137718
Ref: 11b613137718
Ref: library/ssl ssl SSLErrorNumber13138128
Ref: 39e213138128
Ref: library/ssl ssl TLSVersion13138273
Ref: 39e313138273
Ref: library/ssl ssl TLSVersion MINIMUM_SUPPORTED13138494
Ref: 39e413138494
Ref: library/ssl ssl TLSVersion MAXIMUM_SUPPORTED13138539
Ref: 39e513138539
Ref: library/ssl ssl TLSVersion SSLv313138760
Ref: 39e613138760
Ref: library/ssl ssl TLSVersion TLSv113138793
Ref: 39e713138793
Ref: library/ssl ssl TLSVersion TLSv1_113138826
Ref: 39e813138826
Ref: library/ssl ssl TLSVersion TLSv1_213138861
Ref: 39e913138861
Ref: library/ssl ssl TLSVersion TLSv1_313138896
Ref: 39ea13138896
Ref: 定数<9>-Footnote-113139171
Ref: 定数<9>-Footnote-213139230
Ref: 定数<9>-Footnote-313139289
Ref: 定数<9>-Footnote-413139367
Ref: 定数<9>-Footnote-513139426
Node: SSL ソケット13139519
Ref: library/ssl ssl-sockets13139701
Ref: 39eb13139701
Ref: library/ssl ssl SSLSocket13139750
Ref: ae713139750
Ref: library/ssl ssl SSLSocket read13142571
Ref: 106e13142571
Ref: library/ssl ssl SSLSocket write13143700
Ref: 106f13143700
Ref: library/ssl ssl SSLSocket do_handshake13145284
Ref: 106d13145284
Ref: library/ssl ssl SSLSocket getpeercert13146363
Ref: 11ba13146363
Ref: library/ssl ssl SSLSocket get_verified_chain13150303
Ref: 195c13150303
Ref: library/ssl ssl SSLSocket get_unverified_chain13150618
Ref: 195d13150618
Ref: library/ssl ssl SSLSocket cipher13150818
Ref: 38da13150818
Ref: library/ssl ssl SSLSocket shared_ciphers13151156
Ref: 106c13151156
Ref: library/ssl ssl SSLSocket compression13151796
Ref: 135d13151796
Ref: library/ssl ssl SSLSocket get_channel_binding13152232
Ref: 135c13152232
Ref: library/ssl ssl SSLSocket selected_alpn_protocol13153073
Ref: 106513153073
Ref: library/ssl ssl SSLSocket selected_npn_protocol13153614
Ref: a7413153614
Ref: library/ssl ssl SSLSocket unwrap13154136
Ref: 39ec13154136
Ref: library/ssl ssl SSLSocket verify_client_post_handshake13154698
Ref: c2713154698
Ref: library/ssl ssl SSLSocket version13155585
Ref: 106813155585
Ref: library/ssl ssl SSLSocket pending13156134
Ref: 39ee13156134
Ref: library/ssl ssl SSLSocket context13156307
Ref: 39ed13156307
Ref: library/ssl ssl SSLSocket server_side13156437
Ref: 39ef13156437
Ref: library/ssl ssl SSLSocket server_hostname13156670
Ref: d7813156670
Ref: library/ssl ssl SSLSocket session13157222
Ref: 193d13157222
Ref: library/ssl ssl SSLSocket session_reused13157700
Ref: 39f013157700
Ref: SSL ソケット-Footnote-113157805
Ref: SSL ソケット-Footnote-213157864
Node: SSL コンテキスト13157923
Ref: library/ssl ssl-contexts13158090
Ref: 39f113158090
Ref: library/ssl ssl SSLContext13158565
Ref: 35713158565
Ref: library/ssl ssl SSLContext cert_store_stats13163610
Ref: 11ae13163610
Ref: library/ssl ssl SSLContext load_cert_chain13164070
Ref: 59813164070
Ref: library/ssl ssl SSLContext load_default_certs13165996
Ref: 11b413165996
Ref: library/ssl ssl SSLContext load_verify_locations13166989
Ref: 10ee13166989
Ref: library/ssl ssl SSLContext get_ca_certs13168780
Ref: 11af13168780
Ref: library/ssl ssl SSLContext get_ciphers13169631
Ref: eda13169631
Ref: library/ssl ssl SSLContext set_default_verify_paths13171022
Ref: 11ad13171022
Ref: library/ssl ssl SSLContext set_ciphers13171663
Ref: 39f313171663
Ref: library/ssl ssl SSLContext set_alpn_protocols13172300
Ref: 106413172300
Ref: library/ssl ssl SSLContext set_npn_protocols13173047
Ref: 35813173047
Ref: library/ssl ssl SSLContext sni_callback13173887
Ref: 1c8f13173887
Ref: library/ssl ssl SSLContext set_servername_callback13176863
Ref: 11b913176863
Ref: library/ssl ssl SSLContext load_dh_params13177543
Ref: 135a13177543
Ref: library/ssl ssl SSLContext set_ecdh_curve13178294
Ref: 135b13178294
Ref: library/ssl ssl SSLContext wrap_socket13179222
Ref: 74813179222
Ref: library/ssl ssl SSLContext sslsocket_class13182686
Ref: 39f413182686
Ref: library/ssl ssl SSLContext wrap_bio13183003
Ref: d7b13183003
Ref: library/ssl ssl SSLContext sslobject_class13183794
Ref: 39f513183794
Ref: library/ssl ssl SSLContext session_stats13184089
Ref: 39f613184089
Ref: library/ssl ssl SSLContext check_hostname13184560
Ref: 39c413184560
Ref: library/ssl ssl SSLContext keylog_filename13186117
Ref: 39b213186117
Ref: library/ssl ssl SSLContext maximum_version13186563
Ref: a7113186563
Ref: library/ssl ssl SSLContext minimum_version13187421
Ref: a7013187421
Ref: library/ssl ssl SSLContext num_tickets13187634
Ref: 39f713187634
Ref: library/ssl ssl SSLContext options13187867
Ref: a3913187867
Ref: library/ssl ssl SSLContext post_handshake_auth13188676
Ref: c2613188676
Ref: library/ssl ssl SSLContext protocol13189493
Ref: 39f813189493
Ref: library/ssl ssl SSLContext hostname_checks_common_name13189665
Ref: d7613189665
Ref: library/ssl ssl SSLContext security_level13190105
Ref: 39f913190105
Ref: library/ssl ssl SSLContext verify_flags13190280
Ref: 11b013190280
Ref: library/ssl ssl SSLContext verify_mode13190919
Ref: 39b013190919
Ref: library/ssl ssl SSLContext set_psk_client_callback13191533
Ref: 39fa13191533
Ref: library/ssl ssl SSLContext set_psk_server_callback13193538
Ref: 39fb13193538
Ref: SSL コンテキスト-Footnote-113195426
Ref: SSL コンテキスト-Footnote-213195580
Ref: SSL コンテキスト-Footnote-313195712
Ref: SSL コンテキスト-Footnote-413195845
Ref: SSL コンテキスト-Footnote-513195999
Ref: SSL コンテキスト-Footnote-613196131
Ref: SSL コンテキスト-Footnote-713196264
Ref: SSL コンテキスト-Footnote-813196341
Ref: SSL コンテキスト-Footnote-913196395
Ref: SSL コンテキスト-Footnote-1013196454
Ref: SSL コンテキスト-Footnote-1113196533
Ref: SSL コンテキスト-Footnote-1213196593
Ref: SSL コンテキスト-Footnote-1313196670
Ref: SSL コンテキスト-Footnote-1413196736
Node: 証明書13196810
Ref: library/ssl certificates13196974
Ref: 39fc13196974
Ref: library/ssl ssl-certificates13196974
Ref: 39f213196974
Ref: 証明書-Footnote-113199718
Node: 証明書チェイン13199777
Ref: library/ssl certificate-chains13199865
Ref: 39fd13199865
Node: CA 証明書13201227
Ref: library/ssl ca-certificates13201363
Ref: 39fe13201363
Node: 秘密鍵と証明書の組み合わせ13202073
Ref: library/ssl combined-key-and-certificate13202209
Ref: 39ff13202209
Node: 自己署名証明書13202834
Ref: library/ssl self-signed-certificates13202949
Ref: 3a0013202949
Node: 使用例<28>13204563
Ref: library/ssl examples13204768
Ref: 3a0113204768
Node: SSLサポートをテストする13204927
Ref: library/ssl testing-for-ssl-support13205055
Ref: 3a0213205055
Node: クライアントサイドの処理13205471
Ref: library/ssl client-side-operation13205635
Ref: 3a0313205635
Node: サーバサイドの処理13210763
Ref: library/ssl server-side-operation13210885
Ref: 3a0413210885
Node: ノンブロッキングソケットについての注意事項13213210
Ref: library/ssl notes-on-non-blocking-sockets13213435
Ref: 3a0513213435
Ref: library/ssl ssl-nonblocking13213435
Ref: 39b613213435
Node: メモリ BIO サポート<2>13217257
Ref: library/ssl memory-bio-support13217488
Ref: 3a0613217488
Ref: library/ssl ssl SSLObject13218973
Ref: d7a13218973
Ref: library/ssl ssl MemoryBIO13223260
Ref: 106213223260
Ref: library/ssl ssl MemoryBIO pending13223435
Ref: 3a0713223435
Ref: library/ssl ssl MemoryBIO eof13223545
Ref: 3a0813223545
Ref: library/ssl ssl MemoryBIO read13223664
Ref: 3a0913223664
Ref: library/ssl ssl MemoryBIO write13223883
Ref: 3a0a13223883
Ref: library/ssl ssl MemoryBIO write_eof13224264
Ref: 3a0b13224264
Node: SSL セッション13224624
Ref: library/ssl ssl-session13224834
Ref: 3a0c13224834
Ref: library/ssl ssl SSLSession13224913
Ref: ed913224913
Ref: library/ssl ssl SSLSession id13225029
Ref: 3a0d13225029
Ref: library/ssl ssl SSLSession time13225053
Ref: 3a0e13225053
Ref: library/ssl ssl SSLSession timeout13225079
Ref: 3a0f13225079
Ref: library/ssl ssl SSLSession ticket_lifetime_hint13225108
Ref: 3a1013225108
Ref: library/ssl ssl SSLSession has_ticket13225150
Ref: 3a1113225150
Node: セキュリティで考慮すべき点<3>13225182
Ref: library/ssl security-considerations13225370
Ref: 3a1213225370
Ref: library/ssl ssl-security13225370
Ref: 389513225370
Node: 最善のデフォルト値13225552
Ref: library/ssl best-defaults13225685
Ref: 3a1313225685
Node: 手動での設定13227164
Ref: library/ssl manual-settings13227330
Ref: 3a1413227330
Node: 証明書の検証13227474
Ref: library/ssl verifying-certificates13227589
Ref: 3a1513227589
Node: プロトコルのバージョン13228846
Ref: library/ssl protocol-versions13228985
Ref: 3a1613228985
Node: 暗号の選択13229938
Ref: library/ssl cipher-selection13230050
Ref: 3a1713230050
Ref: 暗号の選択-Footnote-113230697
Node: マルチプロセス化13230769
Ref: library/ssl multi-processing13230899
Ref: 3a1813230899
Node: TLS 1 313231428
Ref: library/ssl ssl-tlsv1-313231588
Ref: d7913231588
Ref: library/ssl tls-1-313231588
Ref: 3a1913231588
Ref: TLS 1 3-Footnote-113233792
Ref: TLS 1 3-Footnote-213233858
Ref: TLS 1 3-Footnote-313233917
Ref: TLS 1 3-Footnote-413233976
Ref: TLS 1 3-Footnote-513234035
Ref: TLS 1 3-Footnote-613234094
Ref: TLS 1 3-Footnote-713234153
Ref: TLS 1 3-Footnote-813234229
Ref: TLS 1 3-Footnote-913234288
Node: select --- I/O 完了の待機13234346
Ref: library/select doc13234584
Ref: 3a1a13234584
Ref: library/select module-select13234584
Ref: c613234584
Ref: library/select select-waiting-for-i-o-completion13234584
Ref: 3a1b13234584
Ref: library/select translation-repo13234584
Ref: 3a1c13234584
Ref: library/select select error13236074
Ref: 126213236074
Ref: library/select select devpoll13236314
Ref: 119813236314
Ref: library/select select epoll13237272
Ref: 119613237272
Ref: library/select select poll13239213
Ref: 30a913239213
Ref: library/select select kqueue13239812
Ref: 1a4313239812
Ref: library/select select kevent13240305
Ref: 3a2013240305
Ref: library/select select select13240707
Ref: fa013240707
Ref: library/select select PIPE_BUF13243555
Ref: 142313243555
Ref: select --- I/O 完了の待機-Footnote-113244404
Ref: select --- I/O 完了の待機-Footnote-213244446
Node: /dev/poll ポーリングオブジェクト13244488
Ref: library/select dev-poll-polling-objects13244683
Ref: 3a2213244683
Ref: library/select devpoll-objects13244683
Ref: 3a2313244683
Ref: library/select select devpoll close13245074
Ref: 119a13245074
Ref: library/select select devpoll closed13245220
Ref: 119b13245220
Ref: library/select select devpoll fileno13245364
Ref: 119913245364
Ref: library/select select devpoll register13245517
Ref: 3a2413245517
Ref: library/select select devpoll modify13246644
Ref: 3a2513246644
Ref: library/select select devpoll unregister13246858
Ref: 3a2613246858
Ref: library/select select devpoll poll13247317
Ref: f9c13247317
Ref: /dev/poll ポーリングオブジェクト-Footnote-113249021
Node: エッジおよびレベルトリガポーリング epoll オブジェクト13249063
Ref: library/select edge-and-level-trigger-polling-epoll-objects13249300
Ref: 3a2713249300
Ref: library/select epoll-objects13249300
Ref: 3a1e13249300
Ref: library/select select epoll close13252826
Ref: 119713252826
Ref: library/select select epoll closed13252942
Ref: 3a2813252942
Ref: library/select select epoll fileno13253041
Ref: 3a2913253041
Ref: library/select select epoll fromfd13253140
Ref: 3a2a13253140
Ref: library/select select epoll register13253241
Ref: 3a2b13253241
Ref: library/select select epoll modify13253375
Ref: 3a2c13253375
Ref: library/select select epoll unregister13253484
Ref: b5313253484
Ref: library/select select epoll poll13253725
Ref: f9d13253725
Ref: エッジおよびレベルトリガポーリング epoll オブジェクト-Footnote-113254371
Node: ポーリングオブジェクト13254413
Ref: library/select poll-objects13254632
Ref: 3a1d13254632
Ref: library/select polling-objects13254632
Ref: 3a2d13254632
Ref: library/select select poll register13255232
Ref: 3a2e13255232
Ref: library/select select poll modify13257697
Ref: 3a2f13257697
Ref: library/select select poll unregister13258076
Ref: 3a3013258076
Ref: library/select select poll poll13258562
Ref: f9f13258562
Ref: ポーリングオブジェクト-Footnote-113260268
Node: kqueue オブジェクト13260310
Ref: library/select id113260478
Ref: 3a3113260478
Ref: library/select kqueue-objects13260478
Ref: 3a1f13260478
Ref: library/select select kqueue close13260543
Ref: 3a3213260543
Ref: library/select select kqueue closed13260658
Ref: 3a3313260658
Ref: library/select select kqueue fileno13260765
Ref: 3a3413260765
Ref: library/select select kqueue fromfd13260865
Ref: 3a3513260865
Ref: library/select select kqueue control13260998
Ref: f9e13260998
Ref: kqueue オブジェクト-Footnote-113261865
Node: kevent オブジェクト13261907
Ref: library/select id213262033
Ref: 3a3613262033
Ref: library/select kevent-objects13262033
Ref: 3a2113262033
Ref: library/select select kevent ident13262164
Ref: 3a3713262164
Ref: library/select select kevent filter13262552
Ref: 3a3813262552
Ref: library/select select kevent flags13264370
Ref: 3a3913264370
Ref: library/select select kevent fflags13266119
Ref: 3a3a13266119
Ref: library/select select kevent data13270150
Ref: 3a3b13270150
Ref: library/select select kevent udata13270218
Ref: 3a3c13270218
Node: selectors --- 高水準の I/O 多重化13270278
Ref: library/selectors doc13270516
Ref: 3a3d13270516
Ref: library/selectors module-selectors13270516
Ref: c713270516
Ref: library/selectors selectors-high-level-i-o-multiplexing13270516
Ref: 3a3e13270516
Ref: library/selectors translation-repo13270516
Ref: 3a3f13270516
Ref: selectors --- 高水準の I/O 多重化-Footnote-113270881
Node: はじめに<11>13270950
Ref: library/selectors introduction13271064
Ref: 3a4013271064
Node: クラス<4>13272935
Ref: library/selectors classes13273071
Ref: 3a4313273071
Ref: library/selectors selectors EVENT_READ13273654
Ref: 3a4413273654
Ref: library/selectors selectors EVENT_WRITE13273746
Ref: 3a4513273746
Ref: library/selectors selectors SelectorKey13273820
Ref: 3a4613273820
Ref: library/selectors selectors SelectorKey fileobj13274198
Ref: 3a4713274198
Ref: library/selectors selectors SelectorKey fd13274293
Ref: 3a4813274293
Ref: library/selectors selectors SelectorKey events13274368
Ref: 3a4913274368
Ref: library/selectors selectors SelectorKey data13274501
Ref: 3a4a13274501
Ref: library/selectors selectors BaseSelector13274790
Ref: 3a4113274790
Ref: library/selectors selectors BaseSelector register13275772
Ref: 3a4b13275772
Ref: library/selectors selectors BaseSelector unregister13276684
Ref: 3a4c13276684
Ref: library/selectors selectors BaseSelector modify13277519
Ref: dcf13277519
Ref: library/selectors selectors BaseSelector select13278264
Ref: 3a4d13278264
Ref: library/selectors selectors BaseSelector close13280155
Ref: 3a4e13280155
Ref: library/selectors selectors BaseSelector get_key13280436
Ref: 3a4f13280436
Ref: library/selectors selectors BaseSelector get_map13280850
Ref: 3a5013280850
Ref: library/selectors selectors DefaultSelector13281262
Ref: 3a4213281262
Ref: library/selectors selectors SelectSelector13281534
Ref: 391413281534
Ref: library/selectors selectors PollSelector13281649
Ref: dd113281649
Ref: library/selectors selectors EpollSelector13281761
Ref: dd013281761
Ref: library/selectors selectors EpollSelector fileno13281875
Ref: 3a5113281875
Ref: library/selectors selectors DevpollSelector13282048
Ref: dd213282048
Ref: library/selectors selectors DevpollSelector fileno13282166
Ref: 3a5213282166
Ref: library/selectors selectors KqueueSelector13282369
Ref: 391713282369
Ref: library/selectors selectors KqueueSelector fileno13282485
Ref: 3a5313282485
Ref: クラス<4>-Footnote-113282695
Node: 使用例<29>13282737
Ref: library/selectors examples13282848
Ref: 3a5413282848
Node: signal --- 非同期イベントにハンドラーを設定する13283873
Ref: library/signal doc13284135
Ref: 3a5513284135
Ref: library/signal module-signal13284135
Ref: cb13284135
Ref: library/signal signal-set-handlers-for-asynchronous-events13284135
Ref: 3a5613284135
Ref: library/signal translation-repo13284135
Ref: 3a5713284135
Ref: signal --- 非同期イベントにハンドラーを設定する-Footnote-113284708
Node: 一般的なルール13284774
Ref: library/signal general-rules13284933
Ref: 3a5813284933
Node: Python のシグナルハンドラの実行13286240
Ref: library/signal execution-of-python-signal-handlers13286377
Ref: 3a5a13286377
Node: シグナルとスレッド13287758
Ref: library/signal id113287895
Ref: 3a5c13287895
Ref: library/signal signals-and-threads13287895
Ref: 3a5d13287895
Node: モジュールの内容<2>13288700
Ref: library/signal module-contents13288881
Ref: 3a5e13288881
Ref: library/signal signal Signals13289512
Ref: 3a6213289512
Ref: library/signal signal Handlers13289662
Ref: 3a6313289662
Ref: library/signal signal Sigmasks13289832
Ref: 3a6413289832
Ref: library/signal signal SIG_DFL13290241
Ref: 1bb213290241
Ref: library/signal signal SIG_IGN13290659
Ref: 1bb113290659
Ref: library/signal signal SIGABRT13290817
Ref: 128e13290817
Ref: library/signal signal SIGALRM13290891
Ref: 3a6613290891
Ref: library/signal signal SIGBREAK13291004
Ref: 3a6713291004
Ref: library/signal signal SIGBUS13291124
Ref: 128f13291124
Ref: library/signal signal SIGCHLD13291230
Ref: 30e413291230
Ref: library/signal signal SIGCLD13291343
Ref: 3a6813291343
Ref: library/signal signal SIGCONT13291472
Ref: 30f213291472
Ref: library/signal signal SIGFPE13291596
Ref: 128d13291596
Ref: library/signal signal SIGHUP13291832
Ref: 3a6913291832
Ref: library/signal signal SIGILL13291985
Ref: 129013291985
Ref: library/signal signal SIGINT13292042
Ref: 25313292042
Ref: library/signal signal SIGKILL13292177
Ref: d5013292177
Ref: library/signal signal SIGPIPE13292314
Ref: 3a5913292314
Ref: library/signal signal SIGPROF13292480
Ref: 3a6a13292480
Ref: library/signal signal SIGQUIT13292581
Ref: 3a6513292581
Ref: library/signal signal SIGSEGV13292679
Ref: 128c13292679
Ref: library/signal signal SIGSTOP13292762
Ref: 3a6b13292762
Ref: library/signal signal SIGSTKFLT13292845
Ref: 1c0713292845
Ref: library/signal signal SIGTERM13293190
Ref: 15f813293190
Ref: library/signal signal SIGUSR113293247
Ref: 3a6c13293247
Ref: library/signal signal SIGUSR213293346
Ref: 3a6d13293346
Ref: library/signal signal SIGVTALRM13293445
Ref: 3a6e13293445
Ref: library/signal signal SIGWINCH13293546
Ref: 3a6f13293546
Ref: library/signal signal SIGXCPU13293645
Ref: 3a7013293645
Ref: library/signal signal CTRL_C_EVENT13294314
Ref: 158013294314
Ref: library/signal signal CTRL_BREAK_EVENT13294577
Ref: 158113294577
Ref: library/signal signal NSIG13294848
Ref: 1b8b13294848
Ref: library/signal signal ITIMER_REAL13295005
Ref: 3a7213295005
Ref: library/signal signal ITIMER_VIRTUAL13295204
Ref: 3a7313295204
Ref: library/signal signal ITIMER_PROF13295429
Ref: 3a7413295429
Ref: library/signal signal SIG_BLOCK13295943
Ref: 3a5f13295943
Ref: library/signal signal SIG_UNBLOCK13296148
Ref: 3a6013296148
Ref: library/signal signal SIG_SETMASK13296361
Ref: 3a6113296361
Ref: library/signal signal ItimerError13296610
Ref: 3a7513296610
Ref: library/signal signal alarm13297259
Ref: 3a7813297259
Ref: library/signal signal getsignal13298168
Ref: 1a2513298168
Ref: library/signal signal strsignal13298903
Ref: 1e1f13298903
Ref: library/signal signal valid_signals13299206
Ref: 3a7113299206
Ref: library/signal signal pause13299452
Ref: 3a7913299452
Ref: library/signal signal raise_signal13299908
Ref: 1b8f13299908
Ref: library/signal signal pidfd_send_signal13300044
Ref: b2513300044
Ref: library/signal signal pthread_kill13300672
Ref: 134913300672
Ref: library/signal signal pthread_sigmask13301951
Ref: 134813301951
Ref: library/signal signal setitimer13303808
Ref: 3a7613303808
Ref: library/signal signal getitimer13305074
Ref: 3a7713305074
Ref: library/signal signal set_wakeup_fd13305250
Ref: d6713305250
Ref: library/signal signal siginterrupt13307770
Ref: 134d13307770
Ref: library/signal signal signal13308481
Ref: 134c13308481
Ref: library/signal signal sigpending13310339
Ref: 134a13310339
Ref: library/signal signal sigwait13310874
Ref: 134b13310874
Ref: library/signal signal sigwaitinfo13311533
Ref: fab13311533
Ref: library/signal signal sigtimedwait13312828
Ref: faa13312828
Ref: モジュールの内容<2>-Footnote-113313628
Ref: モジュールの内容<2>-Footnote-213313679
Ref: モジュールの内容<2>-Footnote-313313734
Ref: モジュールの内容<2>-Footnote-413313779
Ref: モジュールの内容<2>-Footnote-513313824
Ref: モジュールの内容<2>-Footnote-613313870
Ref: モジュールの内容<2>-Footnote-713313916
Ref: モジュールの内容<2>-Footnote-813313962
Ref: モジュールの内容<2>-Footnote-913314007
Ref: モジュールの内容<2>-Footnote-1013314053
Ref: モジュールの内容<2>-Footnote-1113314111
Ref: モジュールの内容<2>-Footnote-1213314164
Ref: モジュールの内容<2>-Footnote-1313314216
Ref: モジュールの内容<2>-Footnote-1413314272
Ref: モジュールの内容<2>-Footnote-1513314325
Ref: モジュールの内容<2>-Footnote-1613314372
Ref: モジュールの内容<2>-Footnote-1713314423
Ref: モジュールの内容<2>-Footnote-1813314471
Ref: モジュールの内容<2>-Footnote-1913314523
Ref: モジュールの内容<2>-Footnote-2013314566
Ref: モジュールの内容<2>-Footnote-2113314619
Node: 使用例<30>13314662
Ref: library/signal examples13314837
Ref: 3a7a13314837
Ref: library/signal signal-example13314837
Ref: 3a7b13314837
Node: Note on SIGPIPE13316049
Ref: library/signal note-on-sigpipe13316235
Ref: 3a7c13316235
Ref: Note on SIGPIPE-Footnote-113317682
Node: Note on Signal Handlers and Exceptions13317726
Ref: library/signal handlers-and-exceptions13317890
Ref: 26ec13317890
Ref: library/signal note-on-signal-handlers-and-exceptions13317890
Ref: 3a7d13317890
Node: mmap --- メモリマップファイルのサポート13320497
Ref: library/mmap doc13320710
Ref: 3a7e13320710
Ref: library/mmap mmap-memory-mapped-file-support13320710
Ref: 3a7f13320710
Ref: library/mmap module-mmap13320710
Ref: 9413320710
Ref: library/mmap translation-repo13320710
Ref: 3a8013320710
Ref: library/mmap mmap mmap13324478
Ref: 51913324478
Ref: library/mmap mmap mmap close13331114
Ref: 3a8613331114
Ref: library/mmap mmap mmap closed13331468
Ref: 3a8713331468
Ref: library/mmap mmap mmap find13331607
Ref: 3a8813331607
Ref: library/mmap mmap mmap flush13332195
Ref: c8f13332195
Ref: library/mmap mmap mmap madvise13333156
Ref: bfb13333156
Ref: library/mmap mmap mmap move13333730
Ref: 3a8a13333730
Ref: library/mmap mmap mmap read13334048
Ref: 12f513334048
Ref: library/mmap mmap mmap read_byte13334663
Ref: 3a8b13334663
Ref: library/mmap mmap mmap readline13334830
Ref: 3a8c13334830
Ref: library/mmap mmap mmap resize13335061
Ref: 3a8513335061
Ref: library/mmap mmap mmap rfind13335933
Ref: 3a8d13335933
Ref: library/mmap mmap mmap seek13336522
Ref: 51b13336522
Ref: library/mmap mmap mmap seekable13337119
Ref: 51a13337119
Ref: library/mmap mmap mmap size13337295
Ref: 3a8413337295
Ref: library/mmap mmap mmap tell13337464
Ref: 3a8e13337464
Ref: library/mmap mmap mmap write13337565
Ref: f4613337565
Ref: library/mmap mmap mmap write_byte13338469
Ref: 3a8f13338469
Node: MADV_* 定数13338895
Ref: library/mmap madv-constants13339020
Ref: 3a9013339020
Ref: library/mmap madvise-constants13339020
Ref: 3a8913339020
Ref: library/mmap mmap MADV_NORMAL13339065
Ref: 3a9113339065
Ref: library/mmap mmap MADV_RANDOM13339097
Ref: 3a9213339097
Ref: library/mmap mmap MADV_SEQUENTIAL13339129
Ref: 3a9313339129
Ref: library/mmap mmap MADV_WILLNEED13339165
Ref: 3a9413339165
Ref: library/mmap mmap MADV_DONTNEED13339199
Ref: 3a9513339199
Ref: library/mmap mmap MADV_REMOVE13339233
Ref: 3a9613339233
Ref: library/mmap mmap MADV_DONTFORK13339265
Ref: 3a9713339265
Ref: library/mmap mmap MADV_DOFORK13339299
Ref: 3a9813339299
Ref: library/mmap mmap MADV_HWPOISON13339331
Ref: 3a9913339331
Ref: library/mmap mmap MADV_MERGEABLE13339365
Ref: 3a9a13339365
Ref: library/mmap mmap MADV_UNMERGEABLE13339400
Ref: 3a9b13339400
Ref: library/mmap mmap MADV_SOFT_OFFLINE13339437
Ref: 3a9c13339437
Ref: library/mmap mmap MADV_HUGEPAGE13339475
Ref: 3a9d13339475
Ref: library/mmap mmap MADV_NOHUGEPAGE13339509
Ref: 3a9e13339509
Ref: library/mmap mmap MADV_DONTDUMP13339545
Ref: 3a9f13339545
Ref: library/mmap mmap MADV_DODUMP13339579
Ref: 3aa013339579
Ref: library/mmap mmap MADV_FREE13339611
Ref: 3aa113339611
Ref: library/mmap mmap MADV_NOSYNC13339641
Ref: 3aa213339641
Ref: library/mmap mmap MADV_AUTOSYNC13339673
Ref: 3aa313339673
Ref: library/mmap mmap MADV_NOCORE13339707
Ref: 3aa413339707
Ref: library/mmap mmap MADV_CORE13339739
Ref: 3aa513339739
Ref: library/mmap mmap MADV_PROTECT13339769
Ref: 3aa613339769
Ref: library/mmap mmap MADV_FREE_REUSABLE13339802
Ref: 3aa713339802
Ref: library/mmap mmap MADV_FREE_REUSE13339841
Ref: 3aa813339841
Node: MAP_* 定数13340086
Ref: library/mmap id113340211
Ref: 3aa913340211
Ref: library/mmap map-constants13340211
Ref: 3a8313340211
Ref: library/mmap mmap MAP_SHARED13340254
Ref: 3a8213340254
Ref: library/mmap mmap MAP_PRIVATE13340285
Ref: 3a8113340285
Ref: library/mmap mmap MAP_32BIT13340317
Ref: 1a1c13340317
Ref: library/mmap mmap MAP_ALIGNED_SUPER13340347
Ref: 1ac713340347
Ref: library/mmap mmap MAP_ANON13340385
Ref: 3aaa13340385
Ref: library/mmap mmap MAP_ANONYMOUS13340414
Ref: 3aab13340414
Ref: library/mmap mmap MAP_CONCEAL13340448
Ref: 1ac813340448
Ref: library/mmap mmap MAP_DENYWRITE13340480
Ref: 3aac13340480
Ref: library/mmap mmap MAP_EXECUTABLE13340514
Ref: 3aad13340514
Ref: library/mmap mmap MAP_HASSEMAPHORE13340549
Ref: 1a1713340549
Ref: library/mmap mmap MAP_JIT13340586
Ref: 1a1913340586
Ref: library/mmap mmap MAP_NOCACHE13340614
Ref: 1a1813340614
Ref: library/mmap mmap MAP_NOEXTEND13340646
Ref: 1a1613340646
Ref: library/mmap mmap MAP_NORESERVE13340679
Ref: 1a1513340679
Ref: library/mmap mmap MAP_POPULATE13340713
Ref: 1d2f13340713
Ref: library/mmap mmap MAP_RESILIENT_CODESIGN13340746
Ref: 1a1a13340746
Ref: library/mmap mmap MAP_RESILIENT_MEDIA13340789
Ref: 1a1b13340789
Ref: library/mmap mmap MAP_STACK13340829
Ref: 3aae13340829
Ref: library/mmap mmap MAP_TPRO13340859
Ref: 1a1f13340859
Ref: library/mmap mmap MAP_TRANSLATED_ALLOW_EXECUTE13340888
Ref: 1a1d13340888
Ref: library/mmap mmap MAP_UNIX0313340937
Ref: 1a1e13340937
Node: インターネット上のデータの操作13341893
Ref: library/netdata doc13342105
Ref: 3aaf13342105
Ref: library/netdata internet-data-handling13342105
Ref: 3ab013342105
Ref: library/netdata netdata13342105
Ref: 3ab113342105
Ref: library/netdata translation-repo13342105
Ref: 3ab213342105
Node: email --- 電子メールと MIME 処理のためのパッケージ13343265
Ref: library/email doc13343473
Ref: 3ab313343473
Ref: library/email email-an-email-and-mime-handling-package13343473
Ref: 3ab413343473
Ref: library/email module-email13343473
Ref: 3f13343473
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-113350289
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-213350363
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-313350422
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-413350481
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-513350540
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-613350599
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-713350658
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-813350717
Ref: email --- 電子メールと MIME 処理のためのパッケージ-Footnote-913350776
Node: email message Representing an email message13350835
Ref: library/email message doc13351026
Ref: 3ab513351026
Ref: library/email message email-message-representing-an-email-message13351026
Ref: 3ab613351026
Ref: library/email message module-email message13351026
Ref: 4813351026
Ref: library/email message email message EmailMessage13353502
Ref: 58013353502
Ref: library/email message email message EmailMessage as_string13353992
Ref: 3ab813353992
Ref: library/email message email message EmailMessage __str__13355940
Ref: 3aba13355940
Ref: library/email message email message EmailMessage as_bytes13356422
Ref: 3abb13356422
Ref: library/email message email message EmailMessage __bytes__13357678
Ref: 3abc13357678
Ref: library/email message email message EmailMessage is_multipart13357860
Ref: 3abd13357860
Ref: library/email message email message EmailMessage set_unixfrom13358541
Ref: 3abe13358541
Ref: library/email message email message EmailMessage get_unixfrom13358767
Ref: 3ac013358767
Ref: library/email message email message EmailMessage __len__13360007
Ref: 3ac213360007
Ref: library/email message email message EmailMessage __contains__13360129
Ref: 3ac313360129
Ref: library/email message email message EmailMessage __getitem__13360525
Ref: 3ac413360525
Ref: library/email message email message EmailMessage __setitem__13361246
Ref: 3ac713361246
Ref: library/email message email message EmailMessage __delitem__13362476
Ref: 3ac813362476
Ref: library/email message email message EmailMessage keys13362764
Ref: 3ac113362764
Ref: library/email message email message EmailMessage values13362918
Ref: 3ac913362918
Ref: library/email message email message EmailMessage items13363054
Ref: 3aca13363054
Ref: library/email message email message EmailMessage get13363242
Ref: 3acb13363242
Ref: library/email message email message EmailMessage get_all13363596
Ref: 3ac513363596
Ref: library/email message email message EmailMessage add_header13363930
Ref: 3acc13363930
Ref: library/email message email message EmailMessage replace_header13366015
Ref: 3acd13366015
Ref: library/email message email message EmailMessage get_content_type13366327
Ref: 3ace13366327
Ref: library/email message email message EmailMessage get_content_maintype13367214
Ref: 3ad013367214
Ref: library/email message email message EmailMessage get_content_subtype13367462
Ref: 3ad113367462
Ref: library/email message email message EmailMessage get_default_type13367739
Ref: 3acf13367739
Ref: library/email message email message EmailMessage set_default_type13368116
Ref: 3ad213368116
Ref: library/email message email message EmailMessage set_param13368564
Ref: 3ad313368564
Ref: library/email message email message EmailMessage del_param13370222
Ref: 3ad513370222
Ref: library/email message email message EmailMessage get_filename13370785
Ref: 3ad613370785
Ref: library/email message email message EmailMessage get_boundary13371383
Ref: 3ad813371383
Ref: library/email message email message EmailMessage set_boundary13371844
Ref: 3ad913371844
Ref: library/email message email message EmailMessage get_content_charset13372618
Ref: 3adb13372618
Ref: library/email message email message EmailMessage get_charsets13373058
Ref: 3adc13373058
Ref: library/email message email message EmailMessage is_attachment13373941
Ref: 3add13373941
Ref: library/email message email message EmailMessage get_content_disposition13374410
Ref: 3adf13374410
Ref: library/email message email message EmailMessage walk13374891
Ref: 3ae013374891
Ref: library/email message email message EmailMessage get_body13377132
Ref: 3ae113377132
Ref: library/email message email message EmailMessage iter_attachments13379260
Ref: 3ae213379260
Ref: library/email message email message EmailMessage iter_parts13380234
Ref: 3ae313380234
Ref: library/email message email message EmailMessage get_content13380453
Ref: 3ae413380453
Ref: library/email message email message EmailMessage set_content13380869
Ref: 1c5d13380869
Ref: library/email message email message EmailMessage make_related13381285
Ref: 3ae713381285
Ref: library/email message email message EmailMessage make_alternative13381779
Ref: 3ae813381779
Ref: library/email message email message EmailMessage make_mixed13382304
Ref: 3ae913382304
Ref: library/email message email message EmailMessage add_related13382849
Ref: 3aea13382849
Ref: library/email message email message EmailMessage add_alternative13383612
Ref: 3aec13383612
Ref: library/email message email message EmailMessage add_attachment13384308
Ref: 3aed13384308
Ref: library/email message email message EmailMessage clear13385299
Ref: 3aee13385299
Ref: library/email message email message EmailMessage clear_content13385401
Ref: 3aef13385401
Ref: library/email message email message EmailMessage preamble13385698
Ref: 3af013385698
Ref: library/email message email message EmailMessage epilogue13387451
Ref: 3af113387451
Ref: library/email message email message EmailMessage defects13387797
Ref: 3af213387797
Ref: library/email message email message MIMEPart13388153
Ref: 113d13388153
Ref: email message Representing an email message-Footnote-113388536
Ref: email message Representing an email message-Footnote-213388609
Ref: email message Representing an email message-Footnote-313388821
Ref: email message Representing an email message-Footnote-413388880
Ref: email message Representing an email message-Footnote-513388939
Ref: email message Representing an email message-Footnote-613388998
Ref: email message Representing an email message-Footnote-713389320
Ref: email message Representing an email message-Footnote-813389379
Ref: email message Representing an email message-Footnote-913389438
Ref: email message Representing an email message-Footnote-1013389497
Ref: email message Representing an email message-Footnote-1113389557
Ref: email message Representing an email message-Footnote-1213389617
Ref: email message Representing an email message-Footnote-1313389677
Ref: email message Representing an email message-Footnote-1413389737
Node: email parser Parsing email messages13389797
Ref: library/email parser doc13390038
Ref: 3af313390038
Ref: library/email parser email-parser-parsing-email-messages13390038
Ref: 3af413390038
Ref: library/email parser module-email parser13390038
Ref: 5213390038
Ref: library/email parser translation-repo13390038
Ref: 3af513390038
Ref: email parser Parsing email messages-Footnote-113392433
Node: FeedParser API13392505
Ref: library/email parser feedparser-api13392610
Ref: 3af613392610
Ref: library/email parser email parser BytesFeedParser13394210
Ref: 13e313394210
Ref: library/email parser email parser BytesFeedParser feed13395462
Ref: 3af713395462
Ref: library/email parser email parser BytesFeedParser close13396013
Ref: 3af813396013
Ref: library/email parser email parser FeedParser13396259
Ref: 178513396259
Node: Parser API13396766
Ref: library/email parser parser-api13396892
Ref: 3af913396892
Ref: library/email parser email parser BytesParser13397614
Ref: 13e413397614
Ref: library/email parser email parser BytesParser parse13398315
Ref: 3afa13398315
Ref: library/email parser email parser BytesParser parsebytes13399404
Ref: 3afb13399404
Ref: library/email parser email parser BytesHeaderParser13399945
Ref: 12d113399945
Ref: library/email parser email parser Parser13400170
Ref: 13b513400170
Ref: library/email parser email parser Parser parse13400545
Ref: 3afc13400545
Ref: library/email parser email parser Parser parsestr13401221
Ref: 3afd13401221
Ref: library/email parser email parser HeaderParser13401813
Ref: 12d213401813
Ref: library/email parser email message_from_bytes13402318
Ref: 13e113402318
Ref: library/email parser email message_from_binary_file13402902
Ref: 13e213402902
Ref: library/email parser email message_from_string13403486
Ref: 3afe13403486
Ref: library/email parser email message_from_file13403970
Ref: 3aff13403970
Ref: Parser API-Footnote-113404835
Ref: Parser API-Footnote-213404894
Node: 追記事項13404953
Ref: library/email parser additional-notes13405056
Ref: 3b0013405056
Node: email generator Generating MIME documents13406827
Ref: library/email generator doc13407052
Ref: 3b0213407052
Ref: library/email generator email-generator-generating-mime-documents13407052
Ref: 3b0313407052
Ref: library/email generator module-email generator13407052
Ref: 4413407052
Ref: library/email generator translation-repo13407052
Ref: 3b0413407052
Ref: library/email generator email generator BytesGenerator13409146
Ref: 13e713409146
Ref: library/email generator email generator BytesGenerator flatten13411104
Ref: 3b0613411104
Ref: library/email generator email generator BytesGenerator clone13413021
Ref: 3b0913413021
Ref: library/email generator email generator BytesGenerator write13413226
Ref: 3b0713413226
Ref: library/email generator email generator Generator13414282
Ref: 13e613414282
Ref: library/email generator email generator Generator flatten13416178
Ref: 3b0a13416178
Ref: library/email generator email generator Generator clone13418086
Ref: 3b0c13418086
Ref: library/email generator email generator Generator write13418278
Ref: 3b0b13418278
Ref: library/email generator email generator DecodedGenerator13419190
Ref: e9513419190
Ref: email generator Generating MIME documents-Footnote-113420654
Ref: email generator Generating MIME documents-Footnote-213420730
Ref: email generator Generating MIME documents-Footnote-313421237
Ref: email generator Generating MIME documents-Footnote-413421289
Ref: email generator Generating MIME documents-Footnote-513421348
Ref: email generator Generating MIME documents-Footnote-613421400
Node: email policy Policy Objects13421459
Ref: library/email policy doc13421690
Ref: 3b0d13421690
Ref: library/email policy email-policy-policy-objects13421690
Ref: 3b0e13421690
Ref: library/email policy module-email policy13421690
Ref: 5313421690
Ref: library/email policy translation-repo13421690
Ref: 3b0f13421690
Ref: library/email policy email policy Policy13428065
Ref: 12c713428065
Ref: library/email policy email policy Policy max_line_length13428892
Ref: 3ab913428892
Ref: library/email policy email policy Policy linesep13429279
Ref: 3b1013429279
Ref: library/email policy email policy Policy cte_type13429546
Ref: 3b0813429546
Ref: library/email policy email policy Policy raise_on_defect13430653
Ref: 3b1213430653
Ref: library/email policy email policy Policy mangle_from_13430897
Ref: ff713430897
Ref: library/email policy email policy Policy message_factory13431222
Ref: e9613431222
Ref: library/email policy email policy Policy verify_generated_headers13431499
Ref: 4f213431499
Ref: library/email policy email policy Policy clone13432345
Ref: 12c913432345
Ref: library/email policy email policy Policy handle_defect13432837
Ref: 3b1513432837
Ref: library/email policy email policy Policy register_defect13433335
Ref: 3b1313433335
Ref: library/email policy email policy Policy header_max_count13434047
Ref: 3b1713434047
Ref: library/email policy email policy Policy header_source_parse13435131
Ref: 3b1813435131
Ref: library/email policy email policy Policy header_store_parse13436226
Ref: 3b1913436226
Ref: library/email policy email policy Policy header_fetch_parse13437004
Ref: 3b1a13437004
Ref: library/email policy email policy Policy fold13437938
Ref: 3b1b13437938
Ref: library/email policy email policy Policy fold_binary13438755
Ref: 3b1113438755
Ref: library/email policy email policy EmailPolicy13439201
Ref: 12cb13439201
Ref: library/email policy email policy EmailPolicy utf813440038
Ref: ff913440038
Ref: library/email policy email policy EmailPolicy refold_source13440430
Ref: 3b0513440430
Ref: library/email policy email policy EmailPolicy header_factory13441238
Ref: 3b1c13441238
Ref: library/email policy email policy EmailPolicy content_manager13441849
Ref: 113c13441849
Ref: library/email policy email policy EmailPolicy header_max_count13442551
Ref: 3b1e13442551
Ref: library/email policy email policy EmailPolicy header_source_parse13442763
Ref: 191213442763
Ref: library/email policy email policy EmailPolicy header_store_parse13443150
Ref: 3b2013443150
Ref: library/email policy email policy EmailPolicy header_fetch_parse13443637
Ref: 3b2113443637
Ref: library/email policy email policy EmailPolicy fold13444069
Ref: 19f213444069
Ref: library/email policy email policy EmailPolicy fold_binary13445234
Ref: 3b2213445234
Ref: library/email policy email policy default13446082
Ref: 12cc13446082
Ref: library/email policy email policy SMTP13446341
Ref: 12cd13446341
Ref: library/email policy email policy SMTPUTF813446548
Ref: 3b2313446548
Ref: library/email policy email policy HTTP13446968
Ref: 3b2413446968
Ref: library/email policy email policy strict13447165
Ref: 3b2513447165
Ref: library/email policy email policy Compat3213448569
Ref: 12c813448569
Ref: library/email policy email policy Compat32 mangle_from_13449092
Ref: 3b2613449092
Ref: library/email policy email policy Compat32 header_source_parse13449284
Ref: 191313449284
Ref: library/email policy email policy Compat32 header_store_parse13449671
Ref: 3b2713449671
Ref: library/email policy email policy Compat32 header_fetch_parse13449791
Ref: 3b2813449791
Ref: library/email policy email policy Compat32 fold13450039
Ref: 3b2913450039
Ref: library/email policy email policy Compat32 fold_binary13450388
Ref: 3b2a13450388
Ref: library/email policy email policy compat3213450924
Ref: e9713450924
Ref: email policy Policy Objects-Footnote-113451413
Ref: email policy Policy Objects-Footnote-213451485
Ref: email policy Policy Objects-Footnote-313451544
Ref: email policy Policy Objects-Footnote-413451603
Ref: email policy Policy Objects-Footnote-513451662
Ref: email policy Policy Objects-Footnote-613451721
Ref: email policy Policy Objects-Footnote-713451780
Ref: email policy Policy Objects-Footnote-813451839
Ref: email policy Policy Objects-Footnote-913451909
Ref: email policy Policy Objects-Footnote-1013451968
Ref: email policy Policy Objects-Footnote-1113452028
Ref: email policy Policy Objects-Footnote-1213452088
Node: email errors Exception and Defect classes13452148
Ref: library/email errors doc13452380
Ref: 3b2b13452380
Ref: library/email errors email-errors-exception-and-defect-classes13452380
Ref: 3b2c13452380
Ref: library/email errors module-email errors13452380
Ref: 4313452380
Ref: library/email errors translation-repo13452380
Ref: 3b2d13452380
Ref: library/email errors email errors MessageError13452686
Ref: 3b2e13452686
Ref: library/email errors email errors MessageParseError13452980
Ref: 3b2f13452980
Ref: library/email errors email errors HeaderParseError13453254
Ref: 3ada13453254
Ref: library/email errors email errors BoundaryError13453894
Ref: 3b3013453894
Ref: library/email errors email errors MultipartConversionError13453971
Ref: 3b3113453971
Ref: library/email errors email errors HeaderWriteError13454329
Ref: 3b1413454329
Ref: library/email errors email errors MessageDefect13454458
Ref: 3b1613454458
Ref: library/email errors email errors HeaderDefect13454626
Ref: 3b3413454626
Ref: library/email errors email errors NoBoundaryInMultipartDefect13455411
Ref: 3b3513455411
Ref: library/email errors email errors StartBoundaryNotFoundDefect13455550
Ref: 3b3613455550
Ref: library/email errors email errors CloseBoundaryNotFoundDefect13455692
Ref: 3b3713455692
Ref: library/email errors email errors FirstHeaderLineIsContinuationDefect13455865
Ref: 3b3813455865
Ref: library/email errors email errors MisplacedEnvelopeHeaderDefect13455995
Ref: 3b3913455995
Ref: library/email errors email errors MissingHeaderBodySeparatorDefect13456121
Ref: 3b3a13456121
Ref: library/email errors email errors MalformedHeaderDefect13456398
Ref: 3b3b13456398
Ref: library/email errors email errors MultipartInvariantViolationDefect13456664
Ref: 3b0113456664
Ref: library/email errors email errors InvalidBase64PaddingDefect13456979
Ref: 3b3c13456979
Ref: library/email errors email errors InvalidBase64CharactersDefect13457220
Ref: 3b3d13457220
Ref: library/email errors email errors InvalidBase64LengthDefect13457473
Ref: 3b3e13457473
Ref: library/email errors email errors InvalidDateDefect13457710
Ref: 3b3f13457710
Ref: email errors Exception and Defect classes-Footnote-113457887
Ref: email errors Exception and Defect classes-Footnote-213457959
Node: email headerregistry Custom Header Objects13458018
Ref: library/email headerregistry doc13458265
Ref: 3b4013458265
Ref: library/email headerregistry email-headerregistry-custom-header-objects13458265
Ref: 3b4113458265
Ref: library/email headerregistry module-email headerregistry13458265
Ref: 4613458265
Ref: library/email headerregistry translation-repo13458265
Ref: 3b4213458265
Ref: library/email headerregistry email headerregistry BaseHeader13460721
Ref: 3ac613460721
Ref: library/email headerregistry email headerregistry BaseHeader name13461116
Ref: 3b4513461116
Ref: library/email headerregistry email headerregistry BaseHeader defects13461399
Ref: 3b4613461399
Ref: library/email headerregistry email headerregistry BaseHeader max_count13461890
Ref: 3b1f13461890
Ref: library/email headerregistry email headerregistry BaseHeader fold13462558
Ref: 3b4713462558
Ref: library/email headerregistry email headerregistry UnstructuredHeader13465315
Ref: 3b4413465315
Ref: library/email headerregistry email headerregistry DateHeader13466774
Ref: 3b4813466774
Ref: library/email headerregistry email headerregistry DateHeader datetime13467136
Ref: 3b4913467136
Ref: library/email headerregistry email headerregistry AddressHeader13468909
Ref: 3b4a13468909
Ref: library/email headerregistry email headerregistry AddressHeader groups13469266
Ref: 3b4b13469266
Ref: library/email headerregistry email headerregistry AddressHeader addresses13469667
Ref: 3b4e13469667
Ref: library/email headerregistry email headerregistry SingleAddressHeader13470922
Ref: 3b5013470922
Ref: library/email headerregistry email headerregistry SingleAddressHeader address13471071
Ref: 3b5113471071
Ref: library/email headerregistry email headerregistry MIMEVersionHeader13471603
Ref: 3b5213471603
Ref: library/email headerregistry email headerregistry MIMEVersionHeader version13471999
Ref: 3b5313471999
Ref: library/email headerregistry email headerregistry MIMEVersionHeader major13472118
Ref: 3b5413472118
Ref: library/email headerregistry email headerregistry MIMEVersionHeader minor13472199
Ref: 3b5513472199
Ref: library/email headerregistry email headerregistry ParameterizedMIMEHeader13472280
Ref: 3b5613472280
Ref: library/email headerregistry email headerregistry ParameterizedMIMEHeader params13472663
Ref: 3ad413472663
Ref: library/email headerregistry email headerregistry ContentTypeHeader13472760
Ref: 3b5713472760
Ref: library/email headerregistry email headerregistry ContentTypeHeader content_type13472921
Ref: 3b5813472921
Ref: library/email headerregistry email headerregistry ContentTypeHeader maintype13473027
Ref: 3b5913473027
Ref: library/email headerregistry email headerregistry ContentTypeHeader subtype13473057
Ref: 3b5a13473057
Ref: library/email headerregistry email headerregistry ContentDispositionHeader13473086
Ref: 3b5b13473086
Ref: library/email headerregistry email headerregistry ContentDispositionHeader content_disposition13473260
Ref: 3b5c13473260
Ref: library/email headerregistry email headerregistry ContentTransferEncodingHeader13473397
Ref: 3b5d13473397
Ref: library/email headerregistry email headerregistry ContentTransferEncodingHeader cte13473530
Ref: 3b5e13473530
Ref: library/email headerregistry email headerregistry HeaderRegistry13473732
Ref: 3b4313473732
Ref: library/email headerregistry email headerregistry HeaderRegistry map_to_type13475493
Ref: 3b5f13475493
Ref: library/email headerregistry email headerregistry HeaderRegistry __getitem__13475834
Ref: 3b6013475834
Ref: library/email headerregistry email headerregistry HeaderRegistry __call__13475963
Ref: 3b6113475963
Ref: library/email headerregistry email headerregistry Address13476609
Ref: 3b4f13476609
Ref: library/email headerregistry email headerregistry Address display_name13477500
Ref: 3b6213477500
Ref: library/email headerregistry email headerregistry Address username13477726
Ref: 3b6313477726
Ref: library/email headerregistry email headerregistry Address domain13477847
Ref: 3b6413477847
Ref: library/email headerregistry email headerregistry Address addr_spec13477925
Ref: 3b6513477925
Ref: library/email headerregistry email headerregistry Address __str__13478143
Ref: 3b6613478143
Ref: library/email headerregistry email headerregistry Group13478588
Ref: 3b4c13478588
Ref: library/email headerregistry email headerregistry Group display_name13479179
Ref: 3b4d13479179
Ref: library/email headerregistry email headerregistry Group addresses13479434
Ref: 3b6713479434
Ref: library/email headerregistry email headerregistry Group __str__13479582
Ref: 3b6813479582
Ref: email headerregistry Custom Header Objects-Footnote-113480041
Ref: email headerregistry Custom Header Objects-Footnote-213480122
Ref: email headerregistry Custom Header Objects-Footnote-313480191
Ref: email headerregistry Custom Header Objects-Footnote-413480250
Ref: email headerregistry Custom Header Objects-Footnote-513480309
Ref: email headerregistry Custom Header Objects-Footnote-613480368
Ref: email headerregistry Custom Header Objects-Footnote-713480427
Ref: email headerregistry Custom Header Objects-Footnote-813480486
Ref: email headerregistry Custom Header Objects-Footnote-913480545
Ref: email headerregistry Custom Header Objects-Footnote-1013480604
Ref: email headerregistry Custom Header Objects-Footnote-1113480664
Ref: email headerregistry Custom Header Objects-Footnote-1213480724
Ref: email headerregistry Custom Header Objects-Footnote-1313480784
Ref: email headerregistry Custom Header Objects-Footnote-1413480844
Ref: email headerregistry Custom Header Objects-Footnote-1513480904
Ref: email headerregistry Custom Header Objects-Footnote-1613480964
Ref: email headerregistry Custom Header Objects-Footnote-1713481024
Node: email contentmanager Managing MIME Content13481084
Ref: library/email contentmanager doc13481305
Ref: 3b6913481305
Ref: library/email contentmanager email-contentmanager-managing-mime-content13481305
Ref: 3b6a13481305
Ref: library/email contentmanager module-email contentmanager13481305
Ref: 4113481305
Ref: library/email contentmanager translation-repo13481305
Ref: 3b6b13481305
Ref: library/email contentmanager email contentmanager ContentManager13481571
Ref: 3b6c13481571
Ref: library/email contentmanager email contentmanager ContentManager get_content13481864
Ref: 3ae513481864
Ref: library/email contentmanager email contentmanager ContentManager set_content13482673
Ref: 3ae613482673
Ref: library/email contentmanager email contentmanager ContentManager add_get_handler13484290
Ref: 3b6d13484290
Ref: library/email contentmanager email contentmanager ContentManager add_set_handler13484488
Ref: 3b6f13484488
Ref: email contentmanager Managing MIME Content-Footnote-113484859
Ref: email contentmanager Managing MIME Content-Footnote-213484940
Node: Content Manager Instances13485009
Ref: library/email contentmanager content-manager-instances13485113
Ref: 3b7113485113
Ref: library/email contentmanager email contentmanager raw_data_manager13485455
Ref: 3b1d13485455
Ref: library/email contentmanager email contentmanager get_content13486190
Ref: 3b6e13486190
Ref: library/email contentmanager email contentmanager set_content13486795
Ref: 3b7013486795
Ref: Content Manager Instances-Footnote-113491610
Node: email 使用例13491669
Ref: library/email examples doc13491937
Ref: 3b7213491937
Ref: library/email examples email-examples13491937
Ref: 113e13491937
Ref: library/email examples id113491937
Ref: 3b7313491937
Ref: library/email examples translation-repo13491937
Ref: 3b7413491937
Ref: email 使用例-Footnote-113507055
Ref: email 使用例-Footnote-213507113
Node: email message Message compat32 API を使用した電子メールメッセージの表現13507198
Ref: library/email compat32-message doc13507479
Ref: 3b7513507479
Ref: library/email compat32-message compat32-message13507479
Ref: 3ab713507479
Ref: library/email compat32-message email-message-message-representing-an-email-message-using-the-compat32-api13507479
Ref: 3b7613507479
Ref: library/email compat32-message translation-repo13507479
Ref: 3b7713507479
Ref: library/email compat32-message email message Message13510065
Ref: 58113510065
Ref: library/email compat32-message email message Message as_string13510627
Ref: 113813510627
Ref: library/email compat32-message email message Message __str__13512907
Ref: 3b7813512907
Ref: library/email compat32-message email message Message as_bytes13513079
Ref: 113913513079
Ref: library/email compat32-message email message Message __bytes__13514730
Ref: 113a13514730
Ref: library/email compat32-message email message Message is_multipart13514944
Ref: 3ade13514944
Ref: library/email compat32-message email message Message set_unixfrom13515616
Ref: 3b7913515616
Ref: library/email compat32-message email message Message get_unixfrom13515819
Ref: 3b7a13515819
Ref: library/email compat32-message email message Message attach13516041
Ref: 3aeb13516041
Ref: library/email compat32-message email message Message get_payload13516879
Ref: 13e513516879
Ref: library/email compat32-message email message Message set_payload13519786
Ref: 3b7b13519786
Ref: library/email compat32-message email message Message set_charset13520381
Ref: 3b7c13520381
Ref: library/email compat32-message email message Message get_charset13522438
Ref: 3b7d13522438
Ref: library/email compat32-message email message Message __len__13524240
Ref: 3b7f13524240
Ref: library/email compat32-message email message Message __contains__13524362
Ref: 1af413524362
Ref: library/email compat32-message email message Message __getitem__13524908
Ref: 3b8013524908
Ref: library/email compat32-message email message Message __setitem__13525598
Ref: 187d13525598
Ref: library/email compat32-message email message Message __delitem__13526353
Ref: 3b8213526353
Ref: library/email compat32-message email message Message keys13526641
Ref: 3b7e13526641
Ref: library/email compat32-message email message Message values13526795
Ref: 3b8313526795
Ref: library/email compat32-message email message Message items13526931
Ref: 3b8413526931
Ref: library/email compat32-message email message Message get13527119
Ref: 3b8513527119
Ref: library/email compat32-message email message Message get_all13527465
Ref: 3b8113527465
Ref: library/email compat32-message email message Message add_header13527799
Ref: 187e13527799
Ref: library/email compat32-message email message Message replace_header13530236
Ref: 3b8613530236
Ref: library/email compat32-message email message Message get_content_type13530624
Ref: 3b8713530624
Ref: library/email compat32-message email message Message get_content_maintype13531889
Ref: 3b8913531889
Ref: library/email compat32-message email message Message get_content_subtype13532137
Ref: 3b8a13532137
Ref: library/email compat32-message email message Message get_default_type13532414
Ref: 3b8813532414
Ref: library/email compat32-message email message Message set_default_type13532791
Ref: 3b8b13532791
Ref: library/email compat32-message email message Message get_params13533163
Ref: 3b8c13533163
Ref: library/email compat32-message email message Message get_param13534518
Ref: 3b8d13534518
Ref: library/email compat32-message email message Message set_param13537072
Ref: 113b13537072
Ref: library/email compat32-message email message Message del_param13538727
Ref: 3b8f13538727
Ref: library/email compat32-message email message Message set_type13539352
Ref: 3b9013539352
Ref: library/email compat32-message email message Message get_filename13540528
Ref: 3b9113540528
Ref: library/email compat32-message email message Message get_boundary13541126
Ref: 3b9213541126
Ref: library/email compat32-message email message Message set_boundary13541587
Ref: 3b9313541587
Ref: library/email compat32-message email message Message get_content_charset13542553
Ref: 3b9413542553
Ref: library/email compat32-message email message Message get_charsets13543299
Ref: 3b9513543299
Ref: library/email compat32-message email message Message get_content_disposition13544194
Ref: ff813544194
Ref: library/email compat32-message email message Message walk13544563
Ref: 3b9613544563
Ref: library/email compat32-message email message Message preamble13547012
Ref: 3b9713547012
Ref: library/email compat32-message email message Message epilogue13548765
Ref: 3b9813548765
Ref: library/email compat32-message email message Message defects13549189
Ref: 3b9913549189
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-113549581
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-213549640
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-313549699
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-413549758
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-513549817
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-613549876
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-713549935
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-813549994
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-913550053
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-1013550112
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-1113550172
Ref: email message Message compat32 API を使用した電子メールメッセージの表現-Footnote-1213550232
Node: email mime Creating email and MIME objects from scratch13550292
Ref: library/email mime doc13550601
Ref: 3b9a13550601
Ref: library/email mime email-mime-creating-email-and-mime-objects-from-scratch13550601
Ref: 3b9b13550601
Ref: library/email mime module-email mime13550601
Ref: 4913550601
Ref: library/email mime translation-repo13550601
Ref: 3b9c13550601
Ref: library/email mime module-email mime base13552452
Ref: 4c13552452
Ref: library/email mime email mime base MIMEBase13552452
Ref: 3b9d13552452
Ref: library/email mime module-email mime nonmultipart13553920
Ref: 5013553920
Ref: library/email mime email mime nonmultipart MIMENonMultipart13553920
Ref: 3b3213553920
Ref: library/email mime module-email mime multipart13554554
Ref: 4f13554554
Ref: library/email mime email mime multipart MIMEMultipart13554554
Ref: 3b9e13554554
Ref: library/email mime module-email mime application13556352
Ref: 4a13556352
Ref: library/email mime email mime application MIMEApplication13556352
Ref: 3b9f13556352
Ref: library/email mime module-email mime audio13558002
Ref: 4b13558002
Ref: library/email mime email mime audio MIMEAudio13558002
Ref: 3ba013558002
Ref: library/email mime module-email mime image13559879
Ref: 4d13559879
Ref: library/email mime email mime image MIMEImage13559879
Ref: 3b3313559879
Ref: library/email mime module-email mime message13561809
Ref: 4e13561809
Ref: library/email mime email mime message MIMEMessage13561809
Ref: 3ba113561809
Ref: library/email mime module-email mime text13562847
Ref: 5113562847
Ref: library/email mime email mime text MIMEText13562847
Ref: ffa13562847
Ref: email mime Creating email and MIME objects from scratch-Footnote-113564979
Node: email header 国際化されたヘッダー13565047
Ref: library/email header doc13565302
Ref: 3ba213565302
Ref: library/email header email-header-internationalized-headers13565302
Ref: 3ba313565302
Ref: library/email header module-email header13565302
Ref: 4513565302
Ref: library/email header translation-repo13565302
Ref: 3ba413565302
Ref: library/email header email header Header13568432
Ref: 1c5e13568432
Ref: library/email header email header Header append13570869
Ref: 3ba513570869
Ref: library/email header email header Header encode13572611
Ref: 3ba613572611
Ref: library/email header email header Header __str__13574607
Ref: 3ba713574607
Ref: library/email header email header Header __eq__13575206
Ref: 3ba813575206
Ref: library/email header email header Header __ne__13575409
Ref: 3ba913575409
Ref: library/email header email header decode_header13575705
Ref: 12ce13575705
Ref: library/email header email header make_header13577205
Ref: 12cf13577205
Ref: email header 国際化されたヘッダー-Footnote-113578250
Ref: email header 国際化されたヘッダー-Footnote-213578322
Ref: email header 国際化されたヘッダー-Footnote-313578381
Ref: email header 国際化されたヘッダー-Footnote-413578439
Ref: email header 国際化されたヘッダー-Footnote-513578498
Ref: email header 国際化されたヘッダー-Footnote-613578557
Ref: email header 国際化されたヘッダー-Footnote-713578616
Ref: email header 国際化されたヘッダー-Footnote-813578675
Ref: email header 国際化されたヘッダー-Footnote-913578734
Ref: email header 国際化されたヘッダー-Footnote-1013578793
Ref: email header 国際化されたヘッダー-Footnote-1113578853
Ref: email header 国際化されたヘッダー-Footnote-1213578913
Ref: email header 国際化されたヘッダー-Footnote-1313578973
Ref: email header 国際化されたヘッダー-Footnote-1413579033
Ref: email header 国際化されたヘッダー-Footnote-1513579093
Node: email charset 文字集合の表現13579153
Ref: library/email charset doc13579386
Ref: 3baa13579386
Ref: library/email charset email-charset-representing-character-sets13579386
Ref: 3bab13579386
Ref: library/email charset module-email charset13579386
Ref: 4013579386
Ref: library/email charset translation-repo13579386
Ref: 3bac13579386
Ref: library/email charset email charset Charset13580312
Ref: ffb13580312
Ref: library/email charset email charset Charset input_charset13582381
Ref: 3bad13582381
Ref: library/email charset email charset Charset header_encoding13582718
Ref: 3bae13582718
Ref: library/email charset email charset Charset body_encoding13583265
Ref: 3baf13583265
Ref: library/email charset email charset Charset output_charset13583642
Ref: 3bb013583642
Ref: library/email charset email charset Charset input_codec13584144
Ref: 3bb113584144
Ref: library/email charset email charset Charset output_codec13584396
Ref: 3bb213584396
Ref: library/email charset email charset Charset get_body_encoding13584836
Ref: 3bb313584836
Ref: library/email charset email charset Charset get_output_charset13585814
Ref: 3bb413585814
Ref: library/email charset email charset Charset header_encode13586098
Ref: 3bb513586098
Ref: library/email charset email charset Charset header_encode_lines13586365
Ref: 3bb613586365
Ref: library/email charset email charset Charset body_encode13586944
Ref: 3bb713586944
Ref: library/email charset email charset Charset __str__13587375
Ref: 3bb813587375
Ref: library/email charset email charset Charset __eq__13587588
Ref: 3bb913587588
Ref: library/email charset email charset Charset __ne__13587783
Ref: 3bba13587783
Ref: library/email charset email charset add_charset13588132
Ref: 3bbb13588132
Ref: library/email charset email charset add_alias13590030
Ref: 3bbd13590030
Ref: library/email charset email charset add_codec13590512
Ref: 3bbc13590512
Ref: email charset 文字集合の表現-Footnote-113590938
Node: email encoders エンコーダー13591011
Ref: library/email encoders doc13591236
Ref: 3bbe13591236
Ref: library/email encoders email-encoders-encoders13591236
Ref: 3bbf13591236
Ref: library/email encoders module-email encoders13591236
Ref: 4213591236
Ref: library/email encoders translation-repo13591236
Ref: 3bc013591236
Ref: library/email encoders email encoders encode_quopri13593282
Ref: 3bc113593282
Ref: library/email encoders email encoders encode_base6413593736
Ref: 3bc213593736
Ref: library/email encoders email encoders encode_7or8bit13594303
Ref: 3bc313594303
Ref: library/email encoders email encoders encode_noop13594593
Ref: 3bc413594593
Ref: email encoders エンコーダー-Footnote-113594824
Ref: email encoders エンコーダー-Footnote-213594898
Node: email utils Miscellaneous utilities13595059
Ref: library/email utils doc13595280
Ref: 3bc513595280
Ref: library/email utils email-utils-miscellaneous-utilities13595280
Ref: 3bc613595280
Ref: library/email utils module-email utils13595280
Ref: 5413595280
Ref: library/email utils translation-repo13595280
Ref: 3bc713595280
Ref: library/email utils email utils localtime13595578
Ref: 2f713595578
Ref: library/email utils email utils make_msgid13596123
Ref: 3bc813596123
Ref: library/email utils email utils quote13597048
Ref: 3bc913597048
Ref: library/email utils email utils unquote13597340
Ref: 3ad713597340
Ref: library/email utils email utils parseaddr13597710
Ref: 4f413597710
Ref: library/email utils email utils formataddr13598333
Ref: 13b213598333
Ref: library/email utils email utils getaddresses13599079
Ref: 4f313599079
Ref: library/email utils email utils parsedate13599931
Ref: 3bca13599931
Ref: library/email utils email utils parsedate_tz13600733
Ref: 1c2313600733
Ref: library/email utils email utils parsedate_to_datetime13601312
Ref: 12d413601312
Ref: library/email utils email utils mktime_tz13602195
Ref: 3bcb13602195
Ref: library/email utils email utils formatdate13602526
Ref: 168313602526
Ref: library/email utils email utils format_datetime13603682
Ref: 12d313603682
Ref: library/email utils email utils decode_rfc223113604369
Ref: 3bcc13604369
Ref: library/email utils email utils encode_rfc223113604488
Ref: 3bcd13604488
Ref: library/email utils email utils collapse_rfc2231_value13605080
Ref: 3b8e13605080
Ref: library/email utils email utils decode_params13606419
Ref: 182413606419
Ref: email utils Miscellaneous utilities-Footnote-113606698
Ref: email utils Miscellaneous utilities-Footnote-213606769
Ref: email utils Miscellaneous utilities-Footnote-313606828
Ref: email utils Miscellaneous utilities-Footnote-413606887
Ref: email utils Miscellaneous utilities-Footnote-513606946
Ref: email utils Miscellaneous utilities-Footnote-613607005
Ref: email utils Miscellaneous utilities-Footnote-713607311
Ref: email utils Miscellaneous utilities-Footnote-813607370
Ref: email utils Miscellaneous utilities-Footnote-913607429
Ref: email utils Miscellaneous utilities-Footnote-1013607488
Ref: email utils Miscellaneous utilities-Footnote-1113607548
Ref: email utils Miscellaneous utilities-Footnote-1213607608
Node: email iterators イテレータ13607668
Ref: library/email iterators doc13607847
Ref: 3bce13607847
Ref: library/email iterators email-iterators-iterators13607847
Ref: 3bcf13607847
Ref: library/email iterators module-email iterators13607847
Ref: 4713607847
Ref: library/email iterators translation-repo13607847
Ref: 3bd013607847
Ref: library/email iterators email iterators body_line_iterator13608256
Ref: 3bd113608256
Ref: library/email iterators email iterators typed_subpart_iterator13609031
Ref: 3bd213609031
Ref: library/email iterators email iterators _structure13610041
Ref: 3bd313610041
Ref: email iterators イテレータ-Footnote-113611671
Node: json --- JSON エンコーダーとデコーダー13611747
Ref: library/json doc13612030
Ref: 3bd413612030
Ref: library/json json-json-encoder-and-decoder13612030
Ref: 3bd513612030
Ref: library/json module-json13612030
Ref: 8613612030
Ref: library/json translation-repo13612030
Ref: 3bd613612030
Ref: json --- JSON エンコーダーとデコーダー-Footnote-113617371
Ref: json --- JSON エンコーダーとデコーダー-Footnote-213617444
Ref: json --- JSON エンコーダーとデコーダー-Footnote-313617469
Ref: json --- JSON エンコーダーとデコーダー-Footnote-413617528
Ref: json --- JSON エンコーダーとデコーダー-Footnote-513617587
Ref: json --- JSON エンコーダーとデコーダー-Footnote-613617674
Ref: json --- JSON エンコーダーとデコーダー-Footnote-713617723
Ref: json --- JSON エンコーダーとデコーダー-Footnote-813618027
Node: 基本的な使い方<4>13618053
Ref: library/json basic-usage13618203
Ref: 3bd713618203
Ref: library/json json dump13618259
Ref: f4013618259
Ref: library/json json dumps13622910
Ref: f4113622910
Ref: library/json json load13623858
Ref: eb213623858
Ref: library/json json loads13627720
Ref: b4e13627720
Ref: 基本的な使い方<4>-Footnote-113628537
Node: エンコーダとデコーダ13628569
Ref: library/json encoders-and-decoders13628738
Ref: 3bdb13628738
Ref: library/json json JSONDecoder13628809
Ref: f4313628809
Ref: library/json json-to-py-table13629100
Ref: 3bda13629100
Ref: library/json json JSONDecoder decode13632289
Ref: 3bdc13632289
Ref: library/json json JSONDecoder raw_decode13632588
Ref: 3bdd13632588
Ref: library/json json JSONEncoder13633049
Ref: f4213633049
Ref: library/json py-to-json-table13633403
Ref: 3bd813633403
Ref: library/json json JSONEncoder default13639059
Ref: 3bd913639059
Ref: library/json json JSONEncoder encode13639859
Ref: 3bde13639859
Ref: library/json json JSONEncoder iterencode13640100
Ref: 3bdf13640100
Ref: エンコーダとデコーダ-Footnote-113640440
Node: 例外<20>13640472
Ref: library/json exceptions13640647
Ref: 3be013640647
Ref: library/json json JSONDecodeError13640678
Ref: 102213640678
Ref: library/json json JSONDecodeError msg13640822
Ref: 3be113640822
Ref: library/json json JSONDecodeError doc13640928
Ref: 3be213640928
Ref: library/json json JSONDecodeError pos13641013
Ref: 3be313641013
Ref: library/json json JSONDecodeError lineno13641113
Ref: 3be413641113
Ref: library/json json JSONDecodeError colno13641186
Ref: 3be513641186
Node: 標準への準拠と互換性13641286
Ref: library/json standard-compliance-and-interoperability13641482
Ref: 3be613641482
Ref: 標準への準拠と互換性-Footnote-113642797
Ref: 標準への準拠と互換性-Footnote-213642856
Node: 文字エンコーディング13642943
Ref: library/json character-encodings13643078
Ref: 3be713643078
Node: 無限および NaN の数値13644802
Ref: library/json infinite-and-nan-number-values13644997
Ref: 3be813644997
Node: オブジェクト中に重複した名前の扱い13645908
Ref: library/json repeated-names-within-an-object13646142
Ref: 3be913646142
Node: トップレベルの非オブジェクト、非配列の値の扱い13646829
Ref: library/json top-level-non-object-non-array-values13647049
Ref: 3bea13647049
Ref: トップレベルの非オブジェクト、非配列の値の扱い-Footnote-113648025
Ref: トップレベルの非オブジェクト、非配列の値の扱い-Footnote-213648084
Node: 実装の制限13648143
Ref: library/json implementation-limitations13648303
Ref: 3beb13648303
Node: コマンドライン・インターフェース<5>13649466
Ref: library/json command-line-interface13649643
Ref: 3bec13649643
Ref: library/json json-commandline13649643
Ref: 23e13649643
Ref: library/json module-json tool13649643
Ref: 8713649643
Ref: コマンドライン・インターフェース<5>-Footnote-113650988
Node: コマンドラインオプション<4>13651057
Ref: library/json command-line-options13651184
Ref: 3bee13651184
Ref: library/json cmdoption-json-arg-infile13651267
Ref: 3bef13651267
Ref: library/json cmdoption-json-arg-outfile13651812
Ref: 3bf013651812
Ref: library/json cmdoption-json-sort-keys13651973
Ref: 3bed13651973
Ref: library/json cmdoption-json-no-ensure-ascii13652111
Ref: 3bf113652111
Ref: library/json cmdoption-json-json-lines13652314
Ref: 3bf213652314
Ref: library/json cmdoption-json-indent13652461
Ref: 3bf313652461
Ref: library/json cmdoption-json-tab13652461
Ref: 3bf413652461
Ref: library/json cmdoption-json-no-indent13652461
Ref: 3bf513652461
Ref: library/json cmdoption-json-compact13652461
Ref: 3bf613652461
Ref: library/json cmdoption-json-h13652612
Ref: 3bf713652612
Ref: library/json cmdoption-json-help13652612
Ref: 3bf813652612
Node: mailbox --- 様々な形式のメールボックスを操作する13652698
Ref: library/mailbox doc13652979
Ref: 3bf913652979
Ref: library/mailbox mailbox-manipulate-mailboxes-in-various-formats13652979
Ref: 3bfa13652979
Ref: library/mailbox module-mailbox13652979
Ref: 8f13652979
Ref: library/mailbox translation-repo13652979
Ref: 3bfb13652979
Ref: mailbox --- 様々な形式のメールボックスを操作する-Footnote-113654087
Node: Mailbox オブジェクト13654154
Ref: library/mailbox id113654318
Ref: 3bfc13654318
Ref: library/mailbox mailbox-objects13654318
Ref: 3bfd13654318
Ref: library/mailbox mailbox Mailbox13654393
Ref: 146313654393
Ref: library/mailbox mailbox Mailbox add13658260
Ref: 146413658260
Ref: library/mailbox mailbox Mailbox remove13659303
Ref: 3bfe13659303
Ref: library/mailbox mailbox Mailbox __delitem__13659339
Ref: 3c0213659339
Ref: library/mailbox mailbox Mailbox discard13659380
Ref: 3bff13659380
Ref: library/mailbox mailbox Mailbox __setitem__13660131
Ref: 3c0313660131
Ref: library/mailbox mailbox Mailbox iterkeys13661247
Ref: 3c0413661247
Ref: library/mailbox mailbox Mailbox keys13661339
Ref: 3c0513661339
Ref: library/mailbox mailbox Mailbox itervalues13661507
Ref: 3c0613661507
Ref: library/mailbox mailbox Mailbox __iter__13661544
Ref: 3c0713661544
Ref: library/mailbox mailbox Mailbox values13662187
Ref: 3c0813662187
Ref: library/mailbox mailbox Mailbox iteritems13662359
Ref: 3c0913662359
Ref: library/mailbox mailbox Mailbox items13662883
Ref: 3c0a13662883
Ref: library/mailbox mailbox Mailbox get13663082
Ref: 3c0b13663082
Ref: library/mailbox mailbox Mailbox __getitem__13663129
Ref: 3c0c13663129
Ref: library/mailbox mailbox Mailbox get_message13663862
Ref: 3c0d13663862
Ref: library/mailbox mailbox Mailbox get_bytes13664202
Ref: 146613664202
Ref: library/mailbox mailbox Mailbox get_string13664470
Ref: 146713664470
Ref: library/mailbox mailbox Mailbox get_file13664872
Ref: 146513664872
Ref: library/mailbox mailbox Mailbox __contains__13666254
Ref: 3c0e13666254
Ref: library/mailbox mailbox Mailbox __len__13666437
Ref: 3c0f13666437
Ref: library/mailbox mailbox Mailbox clear13666547
Ref: 3c1013666547
Ref: library/mailbox mailbox Mailbox pop13666664
Ref: 3c1113666664
Ref: library/mailbox mailbox Mailbox popitem13667132
Ref: 3c1213667132
Ref: library/mailbox mailbox Mailbox update13667782
Ref: 3c1313667782
Ref: library/mailbox mailbox Mailbox flush13668753
Ref: 19c113668753
Ref: library/mailbox mailbox Mailbox lock13669173
Ref: 3c0013669173
Ref: library/mailbox mailbox Mailbox unlock13669669
Ref: 3c0113669669
Ref: library/mailbox mailbox Mailbox close13669790
Ref: 3c1513669790
Node: Maildir オブジェクト13670219
Ref: library/mailbox mailbox-maildir13670340
Ref: 3c1613670340
Ref: library/mailbox maildir-objects13670340
Ref: 3c1713670340
Ref: library/mailbox mailbox Maildir13670415
Ref: 65e13670415
Ref: library/mailbox mailbox Maildir colon13673248
Ref: 3c1913673248
Ref: library/mailbox mailbox Maildir list_folders13674288
Ref: 3c1a13674288
Ref: library/mailbox mailbox Maildir get_folder13674394
Ref: 3c1b13674394
Ref: library/mailbox mailbox Maildir add_folder13674688
Ref: 3c1d13674688
Ref: library/mailbox mailbox Maildir remove_folder13674876
Ref: 3c1e13674876
Ref: library/mailbox mailbox Maildir clean13675178
Ref: 3c2013675178
Ref: library/mailbox mailbox Maildir get_flags13675477
Ref: 1a4613675477
Ref: library/mailbox mailbox Maildir set_flags13676284
Ref: 1a4713676284
Ref: library/mailbox mailbox Maildir add_flag13677039
Ref: 1a4813677039
Ref: library/mailbox mailbox Maildir remove_flag13677555
Ref: 1a4913677555
Ref: library/mailbox mailbox Maildir get_info13678082
Ref: 1a4413678082
Ref: library/mailbox mailbox Maildir set_info13678814
Ref: 1a4513678814
Ref: library/mailbox mailbox Maildir add13679651
Ref: 3c2813679651
Ref: library/mailbox mailbox Maildir __setitem__13679688
Ref: 3c2513679688
Ref: library/mailbox mailbox Maildir update13679738
Ref: 3c2913679738
Ref: library/mailbox mailbox Maildir flush13680217
Ref: 3c2a13680217
Ref: library/mailbox mailbox Maildir lock13680392
Ref: 3c2b13680392
Ref: library/mailbox mailbox Maildir unlock13680423
Ref: 3c2c13680423
Ref: library/mailbox mailbox Maildir close13680613
Ref: 3c2d13680613
Ref: library/mailbox mailbox Maildir get_file13680871
Ref: 3c2e13680871
Ref: Maildir オブジェクト-Footnote-113681545
Ref: Maildir オブジェクト-Footnote-213681594
Node: mbox オブジェクト13681638
Ref: library/mailbox mailbox-mbox13681789
Ref: 3c2f13681789
Ref: library/mailbox mbox-objects13681789
Ref: 3c3013681789
Ref: library/mailbox mailbox mbox13681858
Ref: 19fb13681858
Ref: library/mailbox mailbox mbox get_bytes13683599
Ref: 3c3113683599
Ref: library/mailbox mailbox mbox get_file13683898
Ref: 3c3213683898
Ref: library/mailbox mailbox mbox get_string13684486
Ref: 3c3313684486
Ref: library/mailbox mailbox mbox lock13684786
Ref: 3c3413684786
Ref: library/mailbox mailbox mbox unlock13684817
Ref: 3c3513684817
Ref: mbox オブジェクト-Footnote-113685536
Ref: mbox オブジェクト-Footnote-213685596
Ref: mbox オブジェクト-Footnote-313685648
Node: MH オブジェクト13685726
Ref: library/mailbox mailbox-mh13685875
Ref: 3c3613685875
Ref: library/mailbox mh-objects13685875
Ref: 3c3713685875
Ref: library/mailbox mailbox MH13685940
Ref: 1a2d13685940
Ref: library/mailbox mailbox MH list_folders13688061
Ref: 3c3913688061
Ref: library/mailbox mailbox MH get_folder13688167
Ref: 3c3a13688167
Ref: library/mailbox mailbox MH add_folder13688446
Ref: 3c3b13688446
Ref: library/mailbox mailbox MH remove_folder13688631
Ref: 3c3c13688631
Ref: library/mailbox mailbox MH get_sequences13688933
Ref: 3c3d13688933
Ref: library/mailbox mailbox MH set_sequences13689147
Ref: 3c3e13689147
Ref: library/mailbox mailbox MH pack13689430
Ref: 3c3f13689430
Ref: library/mailbox mailbox MH remove13689993
Ref: 3c4013689993
Ref: library/mailbox mailbox MH __delitem__13690029
Ref: 3c4113690029
Ref: library/mailbox mailbox MH discard13690070
Ref: 3c4213690070
Ref: library/mailbox mailbox MH lock13690338
Ref: 3c4313690338
Ref: library/mailbox mailbox MH unlock13690369
Ref: 3c4413690369
Ref: library/mailbox mailbox MH get_file13690840
Ref: 3c4513690840
Ref: library/mailbox mailbox MH flush13691067
Ref: 3c4613691067
Ref: library/mailbox mailbox MH close13691237
Ref: 3c4713691237
Ref: MH オブジェクト-Footnote-113691780
Ref: MH オブジェクト-Footnote-213691816
Node: Babyl オブジェクト13691861
Ref: library/mailbox babyl-objects13692010
Ref: 3c4813692010
Ref: library/mailbox mailbox-babyl13692010
Ref: 3c4913692010
Ref: library/mailbox mailbox Babyl13692081
Ref: 3c4a13692081
Ref: library/mailbox mailbox Babyl get_labels13694090
Ref: 3c4c13694090
Ref: library/mailbox mailbox Babyl get_file13694782
Ref: 3c4d13694782
Ref: library/mailbox mailbox Babyl lock13695415
Ref: 3c4e13695415
Ref: library/mailbox mailbox Babyl unlock13695446
Ref: 3c4f13695446
Ref: Babyl オブジェクト-Footnote-113695924
Ref: Babyl オブジェクト-Footnote-213695968
Node: MMDF オブジェクト13696046
Ref: library/mailbox mailbox-mmdf13696165
Ref: 3c5013696165
Ref: library/mailbox mmdf-objects13696165
Ref: 3c5113696165
Ref: library/mailbox mailbox MMDF13696234
Ref: 19fc13696234
Ref: library/mailbox mailbox MMDF get_bytes13697777
Ref: 3c5313697777
Ref: library/mailbox mailbox MMDF get_file13698076
Ref: 3c5413698076
Ref: library/mailbox mailbox MMDF lock13698664
Ref: 3c5513698664
Ref: library/mailbox mailbox MMDF unlock13698695
Ref: 3c5613698695
Ref: MMDF オブジェクト-Footnote-113699192
Ref: MMDF オブジェクト-Footnote-213699252
Node: Message オブジェクト13699295
Ref: library/mailbox mailbox-message-objects13699478
Ref: 3c5713699478
Ref: library/mailbox message-objects13699478
Ref: 3c5813699478
Ref: library/mailbox mailbox Message13699553
Ref: 146813699553
Ref: Message オブジェクト-Footnote-113702175
Node: MaildirMessage オブジェクト13702234
Ref: library/mailbox mailbox-maildirmessage13702369
Ref: 3c5913702369
Ref: library/mailbox maildirmessage-objects13702369
Ref: 3c5a13702369
Ref: library/mailbox mailbox MaildirMessage13702458
Ref: 3c1813702458
Ref: library/mailbox mailbox MaildirMessage get_subdir13704673
Ref: 3c5b13704673
Ref: library/mailbox mailbox MaildirMessage set_subdir13705334
Ref: 3c5c13705334
Ref: library/mailbox mailbox MaildirMessage get_flags13705598
Ref: 3c2113705598
Ref: library/mailbox mailbox MaildirMessage set_flags13706181
Ref: 3c2213706181
Ref: library/mailbox mailbox MaildirMessage add_flag13706324
Ref: 3c2313706324
Ref: library/mailbox mailbox MaildirMessage remove_flag13706738
Ref: 3c2413706738
Ref: library/mailbox mailbox MaildirMessage get_date13707092
Ref: 3c5d13707092
Ref: library/mailbox mailbox MaildirMessage set_date13707259
Ref: 3c5e13707259
Ref: library/mailbox mailbox MaildirMessage get_info13707463
Ref: 3c2613707463
Ref: library/mailbox mailbox MaildirMessage set_info13707735
Ref: 3c2713707735
Node: mboxMessage オブジェクト13710762
Ref: library/mailbox mailbox-mboxmessage13710934
Ref: 3c5f13710934
Ref: library/mailbox mboxmessage-objects13710934
Ref: 3c6013710934
Ref: library/mailbox mailbox mboxMessage13711017
Ref: 3abf13711017
Ref: library/mailbox mailbox mboxMessage get_from13713119
Ref: 3c6113713119
Ref: library/mailbox mailbox mboxMessage set_from13713368
Ref: 3c6213713368
Ref: library/mailbox mailbox mboxMessage get_flags13714067
Ref: 3c6313714067
Ref: library/mailbox mailbox mboxMessage set_flags13714410
Ref: 3c6413714410
Ref: library/mailbox mailbox mboxMessage add_flag13714694
Ref: 3c6513714694
Ref: library/mailbox mailbox mboxMessage remove_flag13714993
Ref: 3c6613714993
Node: MHMessage オブジェクト13718313
Ref: library/mailbox mailbox-mhmessage13718483
Ref: 3c6713718483
Ref: library/mailbox mhmessage-objects13718483
Ref: 3c6813718483
Ref: library/mailbox mailbox MHMessage13718564
Ref: 3c3813718564
Ref: library/mailbox mailbox MHMessage get_sequences13719732
Ref: 3c6913719732
Ref: library/mailbox mailbox MHMessage set_sequences13719863
Ref: 3c6a13719863
Ref: library/mailbox mailbox MHMessage add_sequence13720003
Ref: 3c6b13720003
Ref: library/mailbox mailbox MHMessage remove_sequence13720163
Ref: 3c6c13720163
Node: BabylMessage オブジェクト13722250
Ref: library/mailbox babylmessage-objects13722420
Ref: 3c6d13722420
Ref: library/mailbox mailbox-babylmessage13722420
Ref: 3c6e13722420
Ref: library/mailbox mailbox BabylMessage13722507
Ref: 3c4b13722507
Ref: library/mailbox mailbox BabylMessage get_labels13724163
Ref: 3c6f13724163
Ref: library/mailbox mailbox BabylMessage set_labels13724285
Ref: 3c7013724285
Ref: library/mailbox mailbox BabylMessage add_label13724443
Ref: 3c7113724443
Ref: library/mailbox mailbox BabylMessage remove_label13724584
Ref: 3c7213724584
Ref: library/mailbox mailbox BabylMessage get_visible13724742
Ref: 3c7313724742
Ref: library/mailbox mailbox BabylMessage set_visible13724948
Ref: 3c7413724948
Ref: library/mailbox mailbox BabylMessage update_visible13725400
Ref: 3c7513725400
Node: MMDFMessage オブジェクト13728154
Ref: library/mailbox mailbox-mmdfmessage13728287
Ref: 3c7613728287
Ref: library/mailbox mmdfmessage-objects13728287
Ref: 3c7713728287
Ref: library/mailbox mailbox MMDFMessage13728372
Ref: 3c5213728372
Ref: library/mailbox mailbox MMDFMessage get_from13730265
Ref: 3c7813730265
Ref: library/mailbox mailbox MMDFMessage set_from13730514
Ref: 3c7913730514
Ref: library/mailbox mailbox MMDFMessage get_flags13731213
Ref: 3c7a13731213
Ref: library/mailbox mailbox MMDFMessage set_flags13731556
Ref: 3c7b13731556
Ref: library/mailbox mailbox MMDFMessage add_flag13731840
Ref: 3c7c13731840
Ref: library/mailbox mailbox MMDFMessage remove_flag13732139
Ref: 3c7d13732139
Node: 例外<21>13735453
Ref: library/mailbox exceptions13735623
Ref: 3c7e13735623
Ref: library/mailbox mailbox Error13735745
Ref: 3c7f13735745
Ref: library/mailbox mailbox NoSuchMailboxError13735835
Ref: 3c1c13735835
Ref: library/mailbox mailbox NotEmptyError13736303
Ref: 3c1f13736303
Ref: library/mailbox mailbox ExternalClashError13736570
Ref: 3c1413736570
Ref: library/mailbox mailbox FormatError13736873
Ref: 3c8013736873
Node: 使用例<31>13737134
Ref: library/mailbox examples13737269
Ref: 3c8113737269
Ref: library/mailbox mailbox-examples13737269
Ref: 3c8213737269
Node: mimetypes --- ファイル名を MIME タイプへマップする13739759
Ref: library/mimetypes doc13740056
Ref: 3c8313740056
Ref: library/mimetypes mimetypes-map-filenames-to-mime-types13740056
Ref: 3c8413740056
Ref: library/mimetypes module-mimetypes13740056
Ref: 9313740056
Ref: library/mimetypes translation-repo13740056
Ref: 3c8513740056
Ref: library/mimetypes mimetypes guess_type13741229
Ref: 51713741229
Ref: library/mimetypes mimetypes guess_file_type13743320
Ref: 51613743320
Ref: library/mimetypes mimetypes guess_all_extensions13743652
Ref: 1c4a13743652
Ref: library/mimetypes mimetypes guess_extension13744261
Ref: 3c8713744261
Ref: library/mimetypes mimetypes init13745040
Ref: 3c8613745040
Ref: library/mimetypes mimetypes read_mime_types13746381
Ref: 1d2a13746381
Ref: library/mimetypes mimetypes add_type13746859
Ref: 3c8913746859
Ref: library/mimetypes mimetypes inited13747419
Ref: 3c8a13747419
Ref: library/mimetypes mimetypes knownfiles13747633
Ref: 3c8813747633
Ref: library/mimetypes mimetypes suffix_map13747923
Ref: 3c8b13747923
Ref: library/mimetypes mimetypes encodings_map13748317
Ref: 3c8c13748317
Ref: library/mimetypes mimetypes types_map13748442
Ref: 3c8d13748442
Ref: library/mimetypes mimetypes common_types13748548
Ref: 3c8e13748548
Ref: mimetypes --- ファイル名を MIME タイプへマップする-Footnote-113749262
Ref: mimetypes --- ファイル名を MIME タイプへマップする-Footnote-213749331
Node: MimeTypes objects13749402
Ref: library/mimetypes id113749566
Ref: 3c8f13749566
Ref: library/mimetypes mimetypes-objects13749566
Ref: 3c9013749566
Ref: library/mimetypes mimetypes MimeTypes13749810
Ref: 171413749810
Ref: library/mimetypes mimetypes MimeTypes suffix_map13750767
Ref: 3c9313750767
Ref: library/mimetypes mimetypes MimeTypes encodings_map13751335
Ref: 3c9413751335
Ref: library/mimetypes mimetypes MimeTypes types_map13751596
Ref: 3c9513751596
Ref: library/mimetypes mimetypes MimeTypes types_map_inv13751928
Ref: 3c9613751928
Ref: library/mimetypes mimetypes MimeTypes guess_extension13752275
Ref: 3c9713752275
Ref: library/mimetypes mimetypes MimeTypes guess_type13752485
Ref: 1e1913752485
Ref: library/mimetypes mimetypes MimeTypes guess_file_type13752683
Ref: 3c9813752683
Ref: library/mimetypes mimetypes MimeTypes guess_all_extensions13752903
Ref: 3c9913752903
Ref: library/mimetypes mimetypes MimeTypes read13753117
Ref: 3c9113753117
Ref: library/mimetypes mimetypes MimeTypes readfp13753596
Ref: 3c9213753596
Ref: library/mimetypes mimetypes MimeTypes read_windows_registry13754084
Ref: 3c9a13754084
Ref: library/mimetypes mimetypes MimeTypes add_type13754532
Ref: 31913754532
Node: コマンドラインでの使用<4>13755293
Ref: library/mimetypes command-line-usage13755496
Ref: 3c9b13755496
Ref: library/mimetypes mimetypes-cli13755496
Ref: 24713755496
Ref: library/mimetypes cmdoption-mimetypes-h13755756
Ref: 3c9c13755756
Ref: library/mimetypes cmdoption-mimetypes-help13755795
Ref: 3c9d13755795
Ref: library/mimetypes cmdoption-mimetypes-e13755903
Ref: 3c9e13755903
Ref: library/mimetypes cmdoption-mimetypes-extension13755942
Ref: 3c9f13755942
Ref: library/mimetypes cmdoption-mimetypes-l13756030
Ref: 3ca013756030
Ref: library/mimetypes cmdoption-mimetypes-lenient13756069
Ref: 3ca113756069
Node: コマンドラインの例<2>13756546
Ref: library/mimetypes command-line-example13756723
Ref: 3ca213756723
Node: base64 --- Base16 Base32 Base64 Base85 データのエンコード13758346
Ref: library/base64 doc13758625
Ref: 3ca313758625
Ref: library/base64 base64-base16-base32-base64-base85-data-encodings13758625
Ref: 3ca413758625
Ref: library/base64 module-base6413758625
Ref: f13758625
Ref: library/base64 translation-repo13758625
Ref: 3ca513758625
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-113760947
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-213761013
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-313761072
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-413761131
Ref: base64 --- Base16 Base32 Base64 Base85 データのエンコード-Footnote-513761190
Node: RFC 4648 エンコーディング13761249
Ref: library/base64 base64-rfc-464813761425
Ref: 3ca613761425
Ref: library/base64 rfc-4648-encodings13761425
Ref: 3ca913761425
Ref: library/base64 base64 b64encode13761728
Ref: 3caa13761728
Ref: library/base64 base64 b64decode13762632
Ref: 1d9013762632
Ref: library/base64 base64 standard_b64encode13763865
Ref: 3cab13763865
Ref: library/base64 base64 standard_b64decode13764106
Ref: 3cac13764106
Ref: library/base64 base64 urlsafe_b64encode13764362
Ref: 3cad13764362
Ref: library/base64 base64 urlsafe_b64decode13764805
Ref: 3cae13764805
Ref: library/base64 base64 b32encode13765234
Ref: 3caf13765234
Ref: library/base64 base64 b32decode13765427
Ref: 122613765427
Ref: library/base64 base64 b32hexencode13766882
Ref: 9e413766882
Ref: library/base64 base64 b32hexdecode13767099
Ref: 9e513767099
Ref: library/base64 base64 b16encode13767587
Ref: 3cb013767587
Ref: library/base64 base64 b16decode13767780
Ref: 2d313767780
Ref: RFC 4648 エンコーディング-Footnote-113768522
Ref: RFC 4648 エンコーディング-Footnote-213768581
Node: Base85 エンコーディング13768640
Ref: library/base64 base64-base-8513768861
Ref: 3ca713768861
Ref: library/base64 base85-encodings13768861
Ref: 3cb113768861
Ref: library/base64 base64 a85encode13769660
Ref: 112113769660
Ref: library/base64 base64 a85decode13770819
Ref: 112213770819
Ref: library/base64 base64 b85encode13771759
Ref: 112313771759
Ref: library/base64 base64 b85decode13772253
Ref: 112413772253
Ref: library/base64 base64 z85encode13772581
Ref: 47b13772581
Ref: library/base64 base64 z85decode13772827
Ref: 47c13772827
Ref: Base85 エンコーディング-Footnote-113773107
Ref: Base85 エンコーディング-Footnote-213773147
Node: レガシーインターフェース13773187
Ref: library/base64 base64-legacy13773417
Ref: 3ca813773417
Ref: library/base64 legacy-interface13773417
Ref: 3cb213773417
Ref: library/base64 base64 decode13773498
Ref: 3cb313773498
Ref: library/base64 base64 decodebytes13773870
Ref: b4d13773870
Ref: library/base64 base64 encode13774189
Ref: 3cb413774189
Ref: library/base64 base64 encodebytes13774794
Ref: b4c13774794
Ref: レガシーインターフェース-Footnote-113775519
Ref: レガシーインターフェース-Footnote-213775578
Node: セキュリティで考慮すべき点<4>13775637
Ref: library/base64 base64-security13775827
Ref: 3cb513775827
Ref: library/base64 security-considerations13775827
Ref: 3cb613775827
Ref: セキュリティで考慮すべき点<4>-Footnote-113776538
Ref: セキュリティで考慮すべき点<4>-Footnote-213776597
Node: binascii --- バイナリ と ASCII 間の変換13776656
Ref: library/binascii doc13776945
Ref: 3cb713776945
Ref: library/binascii binascii-convert-between-binary-and-ascii13776945
Ref: 3cb813776945
Ref: library/binascii module-binascii13776945
Ref: 1113776945
Ref: library/binascii translation-repo13776945
Ref: 3cb913776945
Ref: library/binascii binascii a2b_uu13778066
Ref: 3cba13778066
Ref: library/binascii binascii b2a_uu13778441
Ref: d1613778441
Ref: library/binascii binascii a2b_base6413778845
Ref: 19a413778845
Ref: library/binascii binascii b2a_base6413779616
Ref: e7b13779616
Ref: library/binascii binascii a2b_qp13780052
Ref: 3cbb13780052
Ref: library/binascii binascii b2a_qp13780459
Ref: 3cbc13780459
Ref: library/binascii binascii crc_hqx13781603
Ref: 93d13781603
Ref: library/binascii binascii crc3213781962
Ref: 1a1113781962
Ref: library/binascii binascii b2a_hex13782801
Ref: 287e13782801
Ref: library/binascii binascii hexlify13782866
Ref: 3cbd13782866
Ref: library/binascii binascii a2b_hex13784087
Ref: 287f13784087
Ref: library/binascii binascii unhexlify13784128
Ref: 1e2613784128
Ref: library/binascii binascii Error13784722
Ref: 122713784722
Ref: library/binascii binascii Incomplete13784868
Ref: 3cbe13784868
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-113785463
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-213785522
Ref: binascii --- バイナリ と ASCII 間の変換-Footnote-313785581
Node: quopri --- MIME quoted-printable データのエンコードとデコード13785640
Ref: library/quopri doc13785854
Ref: 3cbf13785854
Ref: library/quopri module-quopri13785854
Ref: bc13785854
Ref: library/quopri quopri-encode-and-decode-mime-quoted-printable-data13785854
Ref: 3cc013785854
Ref: library/quopri translation-repo13785854
Ref: 3cc113785854
Ref: library/quopri quopri decode13786790
Ref: 288113786790
Ref: library/quopri quopri encode13787557
Ref: 288013787557
Ref: library/quopri quopri decodestring13788484
Ref: 3cc213788484
Ref: library/quopri quopri encodestring13788713
Ref: 3cc313788713
Ref: quopri --- MIME quoted-printable データのエンコードとデコード-Footnote-113789249
Ref: quopri --- MIME quoted-printable データのエンコードとデコード-Footnote-213789315
Ref: quopri --- MIME quoted-printable データのエンコードとデコード-Footnote-313789374
Ref: quopri --- MIME quoted-printable データのエンコードとデコード-Footnote-413789433
Ref: quopri --- MIME quoted-printable データのエンコードとデコード-Footnote-513789492
Node: 構造化マークアップツール13789551
Ref: library/markup doc13789766
Ref: 3cc413789766
Ref: library/markup markup13789766
Ref: 3cc513789766
Ref: library/markup structured-markup-processing-tools13789766
Ref: 3cc613789766
Ref: library/markup translation-repo13789766
Ref: 3cc713789766
Node: html --- HyperText Markup Language のサポート13791611
Ref: library/html doc13791804
Ref: 3cc813791804
Ref: library/html html-hypertext-markup-language-support13791804
Ref: 3cc913791804
Ref: library/html module-html13791804
Ref: 6f13791804
Ref: library/html html escape13792132
Ref: 121013792132
Ref: library/html html unescape13792713
Ref: b5013792713
Ref: html --- HyperText Markup Language のサポート-Footnote-113793494
Node: html parser --- HTML と XHTML のシンプルなパーサー13793567
Ref: library/html parser doc13793813
Ref: 3cca13793813
Ref: library/html parser html-parser-simple-html-and-xhtml-parser13793813
Ref: 3ccb13793813
Ref: library/html parser module-html parser13793813
Ref: 7113793813
Ref: library/html parser translation-repo13793813
Ref: 3ccc13793813
Ref: library/html parser html parser HTMLParser13794351
Ref: a7713794351
Ref: html parser --- HTML と XHTML のシンプルなパーサー-Footnote-113796038
Node: HTML パーサーアプリケーションの例13796109
Ref: library/html parser example-html-parser-application13796286
Ref: 3ccd13796286
Node: HTMLParser メソッド13797526
Ref: library/html parser htmlparser-methods13797725
Ref: 3cce13797725
Ref: library/html parser html parser HTMLParser feed13797882
Ref: 3ccf13797882
Ref: library/html parser html parser HTMLParser close13798315
Ref: 184113798315
Ref: library/html parser html parser HTMLParser reset13798892
Ref: 3cd013798892
Ref: library/html parser html parser HTMLParser getpos13799106
Ref: 3cd113799106
Ref: library/html parser html parser HTMLParser get_starttag_text13799216
Ref: 3cd213799216
Ref: library/html parser html parser HTMLParser handle_starttag13799983
Ref: 3cd413799983
Ref: library/html parser html parser HTMLParser handle_endtag13800878
Ref: 3cd513800878
Ref: library/html parser html parser HTMLParser handle_startendtag13801121
Ref: 3cd313801121
Ref: library/html parser html parser HTMLParser handle_data13801624
Ref: 3cd613801624
Ref: library/html parser html parser HTMLParser handle_entityref13801814
Ref: 3cd713801814
Ref: library/html parser html parser HTMLParser handle_charref13802118
Ref: 3cd813802118
Ref: library/html parser html parser HTMLParser handle_comment13802564
Ref: 3cd913802564
Ref: library/html parser html parser HTMLParser handle_decl13803193
Ref: 3cda13803193
Ref: library/html parser html parser HTMLParser handle_pi13803501
Ref: 3cdb13803501
Ref: library/html parser html parser HTMLParser unknown_decl13804223
Ref: 3cdc13804223
Node: 使用例<32>13804637
Ref: library/html parser examples13804780
Ref: 3cdd13804780
Ref: library/html parser htmlparser-examples13804780
Ref: 3cde13804780
Node: html entities --- HTML 一般実体の定義13808338
Ref: library/html entities doc13808564
Ref: 3cdf13808564
Ref: library/html entities html-entities-definitions-of-html-general-entities13808564
Ref: 3ce013808564
Ref: library/html entities module-html entities13808564
Ref: 7013808564
Ref: library/html entities translation-repo13808564
Ref: 3ce113808564
Ref: library/html entities html entities html513808970
Ref: 12e913808970
Ref: library/html entities html entities entitydefs13809491
Ref: 3ce413809491
Ref: library/html entities html entities name2codepoint13809653
Ref: 3ce213809653
Ref: library/html entities html entities codepoint2name13809789
Ref: 3ce313809789
Ref: html entities --- HTML 一般実体の定義-Footnote-113809974
Ref: html entities --- HTML 一般実体の定義-Footnote-213810047
Node: XMLを扱うモジュール群13810160
Ref: library/xml doc13810370
Ref: 3ce513810370
Ref: library/xml module-xml13810370
Ref: 12613810370
Ref: library/xml translation-repo13810370
Ref: 3ce613810370
Ref: library/xml xml13810370
Ref: 3ce713810370
Ref: library/xml xml-processing-modules13810370
Ref: 3ce813810370
Ref: library/xml xml-security13811690
Ref: 3ce913811690
Ref: XMLを扱うモジュール群-Footnote-113811753
Node: XML security13811814
Ref: library/xml id113811893
Ref: 3cea13811893
Ref: library/xml xml-vulnerabilities13811893
Ref: 3ceb13811893
Ref: XML security-Footnote-113814646
Ref: XML security-Footnote-213814691
Ref: XML security-Footnote-313814744
Ref: XML security-Footnote-413814797
Ref: XML security-Footnote-513814918
Node: xml etree ElementTree --- ElementTree XML API13814974
Ref: library/xml etree elementtree doc13815201
Ref: 3cec13815201
Ref: library/xml etree elementtree module-xml etree ElementTree13815201
Ref: 12b13815201
Ref: library/xml etree elementtree translation-repo13815201
Ref: 3ced13815201
Ref: library/xml etree elementtree xml-etree-elementtree-the-elementtree-xml-api13815201
Ref: 3cee13815201
Ref: xml etree ElementTree --- ElementTree XML API-Footnote-113816114
Node: チュートリアル<3>13816196
Ref: library/xml etree elementtree tutorial13816329
Ref: 3cef13816329
Node: XML 木構造と要素13816792
Ref: library/xml etree elementtree xml-tree-and-elements13816897
Ref: 3cf013816897
Node: XML の解析13817499
Ref: library/xml etree elementtree elementtree-parsing-xml13817659
Ref: 3cf113817659
Ref: library/xml etree elementtree parsing-xml13817659
Ref: 3cf213817659
Node: 非ブロックパースのためのプル API13820563
Ref: library/xml etree elementtree elementtree-pull-parsing13820728
Ref: 11f613820728
Ref: library/xml etree elementtree pull-api-for-non-blocking-parsing13820728
Ref: 3cf413820728
Node: 関心ある要素の検索13823396
Ref: library/xml etree elementtree finding-interesting-elements13823573
Ref: 3cf713823573
Node: XML ファイルの編集13824922
Ref: library/xml etree elementtree modifying-an-xml-file13825072
Ref: 3cfa13825072
Node: XML 文書の構築13828176
Ref: library/xml etree elementtree building-xml-documents13828334
Ref: 3cfd13828334
Node: 名前空間のある XML の解析13828711
Ref: library/xml etree elementtree parsing-xml-with-namespaces13828835
Ref: 3cff13828835
Ref: 名前空間のある XML の解析-Footnote-113831363
Ref: 名前空間のある XML の解析-Footnote-213831415
Node: XPath サポート13831467
Ref: library/xml etree elementtree elementtree-xpath13831630
Ref: da613831630
Ref: library/xml etree elementtree xpath-support13831630
Ref: 3d0013831630
Ref: XPath サポート-Footnote-113832093
Node: 使用例<33>13832129
Ref: library/xml etree elementtree example13832246
Ref: 3d0113832246
Node: サポートされている XPath 構文13833254
Ref: library/xml etree elementtree supported-xpath-syntax13833371
Ref: 3d0213833371
Node: リファレンス<5>13838576
Ref: library/xml etree elementtree reference13838736
Ref: 3d0313838736
Node: 関数<9>13838820
Ref: library/xml etree elementtree elementtree-functions13838887
Ref: 3d0413838887
Ref: library/xml etree elementtree functions13838887
Ref: 3d0513838887
Ref: library/xml etree elementtree xml etree ElementTree canonicalize13838920
Ref: c4813838920
Ref: library/xml etree elementtree xml etree ElementTree Comment13841310
Ref: 3d0613841310
Ref: library/xml etree elementtree xml etree ElementTree dump13842131
Ref: 3d0713842131
Ref: library/xml etree elementtree xml etree ElementTree fromstring13842725
Ref: 3cf313842725
Ref: library/xml etree elementtree xml etree ElementTree fromstringlist13843230
Ref: 13e913843230
Ref: library/xml etree elementtree xml etree ElementTree indent13843804
Ref: 3d0913843804
Ref: library/xml etree elementtree xml etree ElementTree iselement13844333
Ref: 3d0a13844333
Ref: library/xml etree elementtree xml etree ElementTree iterparse13844620
Ref: 57a13844620
Ref: library/xml etree elementtree xml etree ElementTree parse13846991
Ref: 3d0b13846991
Ref: library/xml etree elementtree xml etree ElementTree ProcessingInstruction13847497
Ref: 3d0c13847497
Ref: library/xml etree elementtree xml etree ElementTree register_namespace13848283
Ref: 13ea13848283
Ref: library/xml etree elementtree xml etree ElementTree SubElement13848854
Ref: 3cfe13848854
Ref: library/xml etree elementtree xml etree ElementTree tostring13849526
Ref: 11f713849526
Ref: library/xml etree elementtree xml etree ElementTree tostringlist13850788
Ref: 11f813850788
Ref: library/xml etree elementtree xml etree ElementTree XML13852267
Ref: 3d0813852267
Ref: library/xml etree elementtree xml etree ElementTree XMLID13852825
Ref: 3d0d13852825
Ref: 関数<9>-Footnote-113853404
Ref: 関数<9>-Footnote-213853445
Ref: 関数<9>-Footnote-313853837
Node: XInclude サポート13854229
Ref: library/xml etree elementtree elementtree-xinclude13854392
Ref: 3d0e13854392
Ref: library/xml etree elementtree xinclude-support13854392
Ref: 3d0f13854392
Ref: XInclude サポート-Footnote-113854768
Node: 使用例<34>13854808
Ref: library/xml etree elementtree id313854879
Ref: 3d1013854879
Node: リファレンス<6>13856678
Ref: library/xml etree elementtree id413856811
Ref: 3d1113856811
Node: 関数<10>13857118
Ref: library/xml etree elementtree elementinclude-functions13857221
Ref: 3d1213857221
Ref: library/xml etree elementtree id513857221
Ref: 3d1313857221
Ref: library/xml etree elementtree module-xml etree ElementInclude13857254
Ref: 12a13857254
Ref: library/xml etree elementtree xml etree ElementInclude default_loader13857254
Ref: 3d1413857254
Ref: library/xml etree elementtree xml etree ElementInclude include13857842
Ref: 3d1513857842
Node: Element オブジェクト13858734
Ref: library/xml etree elementtree element-objects13858876
Ref: 3d1613858876
Ref: library/xml etree elementtree elementtree-element-objects13858876
Ref: 3d1713858876
Ref: library/xml etree elementtree xml etree ElementTree Element13858945
Ref: 36313858945
Ref: library/xml etree elementtree xml etree ElementTree Element tag13859565
Ref: 156513859565
Ref: library/xml etree elementtree xml etree ElementTree Element text13859721
Ref: 3cf813859721
Ref: library/xml etree elementtree xml etree ElementTree Element tail13859746
Ref: 3d1813859746
Ref: library/xml etree elementtree xml etree ElementTree Element attrib13861170
Ref: 3d1913861170
Ref: library/xml etree elementtree xml etree ElementTree Element clear13861750
Ref: 3d1a13861750
Ref: library/xml etree elementtree xml etree ElementTree Element get13861977
Ref: 3cf913861977
Ref: library/xml etree elementtree xml etree ElementTree Element items13862187
Ref: 3d1b13862187
Ref: library/xml etree elementtree xml etree ElementTree Element keys13862381
Ref: 3d1c13862381
Ref: library/xml etree elementtree xml etree ElementTree Element set13862547
Ref: 3cfb13862547
Ref: library/xml etree elementtree xml etree ElementTree Element append13862750
Ref: 3cfc13862750
Ref: library/xml etree elementtree xml etree ElementTree Element extend13863013
Ref: 13eb13863013
Ref: library/xml etree elementtree xml etree ElementTree Element find13863250
Ref: 187a13863250
Ref: library/xml etree elementtree xml etree ElementTree Element findall13863678
Ref: 187c13863678
Ref: library/xml etree elementtree xml etree ElementTree Element findtext13864103
Ref: 187b13864103
Ref: library/xml etree elementtree xml etree ElementTree Element insert13864713
Ref: 3d1d13864713
Ref: library/xml etree elementtree xml etree ElementTree Element iter13864966
Ref: 156613864966
Ref: library/xml etree elementtree xml etree ElementTree Element iterfind13865579
Ref: 13ec13865579
Ref: library/xml etree elementtree xml etree ElementTree Element itertext13866058
Ref: 13ed13866058
Ref: library/xml etree elementtree xml etree ElementTree Element makeelement13866356
Ref: 3d1e13866356
Ref: library/xml etree elementtree xml etree ElementTree Element remove13866638
Ref: 187613866638
Ref: Element オブジェクト-Footnote-113869496
Node: ElementTree オブジェクト13869539
Ref: library/xml etree elementtree elementtree-elementtree-objects13869695
Ref: 3d1f13869695
Ref: library/xml etree elementtree elementtree-objects13869695
Ref: 3d2013869695
Ref: library/xml etree elementtree xml etree ElementTree ElementTree13869772
Ref: b4713869772
Ref: library/xml etree elementtree xml etree ElementTree ElementTree _setroot13870174
Ref: 3d2113870174
Ref: library/xml etree elementtree xml etree ElementTree ElementTree find13870480
Ref: 3d2213870480
Ref: library/xml etree elementtree xml etree ElementTree ElementTree findall13870639
Ref: 3d2313870639
Ref: library/xml etree elementtree xml etree ElementTree ElementTree findtext13870804
Ref: 3d2413870804
Ref: library/xml etree elementtree xml etree ElementTree ElementTree getroot13870985
Ref: 3d2513870985
Ref: library/xml etree elementtree xml etree ElementTree ElementTree iter13871077
Ref: 3d2613871077
Ref: library/xml etree elementtree xml etree ElementTree ElementTree iterfind13871415
Ref: 3d2713871415
Ref: library/xml etree elementtree xml etree ElementTree ElementTree parse13871615
Ref: 3d2813871615
Ref: library/xml etree elementtree xml etree ElementTree ElementTree write13872099
Ref: c8c13872099
Ref: ElementTree オブジェクト-Footnote-113875352
Node: QName オブジェクト13875744
Ref: library/xml etree elementtree elementtree-qname-objects13875904
Ref: 3d2913875904
Ref: library/xml etree elementtree qname-objects13875904
Ref: 3d2a13875904
Ref: library/xml etree elementtree xml etree ElementTree QName13875969
Ref: 3d2b13875969
Node: TreeBuilder オブジェクト13876593
Ref: library/xml etree elementtree elementtree-treebuilder-objects13876751
Ref: 3d2c13876751
Ref: library/xml etree elementtree treebuilder-objects13876751
Ref: 3d2d13876751
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder13876828
Ref: c4a13876828
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder close13878008
Ref: 3d2e13878008
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder data13878223
Ref: 3d2f13878223
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder end13878443
Ref: 13ee13878443
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder start13878606
Ref: 1d6c13878606
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder comment13878832
Ref: 3d3013878832
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder pi13879036
Ref: 3d3113879036
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder doctype13879407
Ref: c8e13879407
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder start_ns13879787
Ref: 3d3213879787
Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder end_ns13880189
Ref: 3d3313880189
Ref: library/xml etree elementtree xml etree ElementTree C14NWriterTarget13880444
Ref: 3d3413880444
Ref: TreeBuilder オブジェクト-Footnote-113880997
Node: XMLParser オブジェクト13881038
Ref: library/xml etree elementtree elementtree-xmlparser-objects13881204
Ref: 3d3513881204
Ref: library/xml etree elementtree xmlparser-objects13881204
Ref: 3d3613881204
Ref: library/xml etree elementtree xml etree ElementTree XMLParser13881277
Ref: c4913881277
Ref: library/xml etree elementtree xml etree ElementTree XMLParser close13882223
Ref: 3d3813882223
Ref: library/xml etree elementtree xml etree ElementTree XMLParser feed13882533
Ref: 3d3713882533
Ref: library/xml etree elementtree xml etree ElementTree XMLParser flush13882687
Ref: 57613882687
Ref: XMLParser オブジェクト-Footnote-113885518
Node: XMLPullParser オブジェクト13885910
Ref: library/xml etree elementtree elementtree-xmlpullparser-objects13886056
Ref: 3d3913886056
Ref: library/xml etree elementtree xmlpullparser-objects13886056
Ref: 3d3a13886056
Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser13886137
Ref: 11f513886137
Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser feed13887044
Ref: 3cf513887044
Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser flush13887152
Ref: 57713887152
Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser close13888017
Ref: 3d3b13888017
Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser read_events13888445
Ref: 3cf613888445
Node: 例外<22>13890389
Ref: library/xml etree elementtree exceptions13890498
Ref: 3d3c13890498
Ref: library/xml etree elementtree xml etree ElementTree ParseError13890531
Ref: 148f13890531
Ref: library/xml etree elementtree xml etree ElementTree ParseError code13890895
Ref: 3d3d13890895
Ref: library/xml etree elementtree xml etree ElementTree ParseError position13891159
Ref: 3d3e13891159
Node: xml dom --- ドキュメントオブジェクトモデル API13891312
Ref: library/xml dom doc13891555
Ref: 3d3f13891555
Ref: library/xml dom module-xml dom13891555
Ref: 12713891555
Ref: library/xml dom translation-repo13891555
Ref: 3d4013891555
Ref: library/xml dom xml-dom-the-document-object-model-api13891555
Ref: 3d4113891555
Ref: xml dom --- ドキュメントオブジェクトモデル API-Footnote-113896646
Ref: xml dom --- ドキュメントオブジェクトモデル API-Footnote-213896723
Ref: xml dom --- ドキュメントオブジェクトモデル API-Footnote-313896789
Ref: xml dom --- ドキュメントオブジェクトモデル API-Footnote-413896836
Node: モジュールコンテンツ<4>13896882
Ref: library/xml dom module-contents13897050
Ref: 3d4413897050
Ref: library/xml dom xml dom registerDOMImplementation13897174
Ref: 3d4513897174
Ref: library/xml dom xml dom getDOMImplementation13897806
Ref: 3d4213897806
Ref: library/xml dom xml dom EMPTY_NAMESPACE13898903
Ref: 3d4613898903
Ref: library/xml dom xml dom XML_NAMESPACE13899278
Ref: 3d4713899278
Ref: library/xml dom xml dom XMLNS_NAMESPACE13899493
Ref: 3d4813899493
Ref: library/xml dom xml dom XHTML_NAMESPACE13899693
Ref: 3d4913899693
Ref: モジュールコンテンツ<4>-Footnote-113900438
Ref: モジュールコンテンツ<4>-Footnote-213900483
Ref: モジュールコンテンツ<4>-Footnote-313900540
Node: DOM 内のオブジェクト13900578
Ref: library/xml dom dom-objects13900764
Ref: 3d4a13900764
Ref: library/xml dom objects-in-the-dom13900764
Ref: 3d4b13900764
Node: DOMImplementation オブジェクト13905715
Ref: library/xml dom dom-implementation-objects13905848
Ref: 3d4c13905848
Ref: library/xml dom domimplementation-objects13905848
Ref: 3d5513905848
Ref: library/xml dom xml dom DOMImplementation hasFeature13906349
Ref: 3d5613906349
Ref: library/xml dom xml dom DOMImplementation createDocument13906578
Ref: 3d5713906578
Ref: library/xml dom xml dom DOMImplementation createDocumentType13907346
Ref: 3d5813907346
Node: Node オブジェクト13907711
Ref: library/xml dom dom-node-objects13907880
Ref: 3d4d13907880
Ref: library/xml dom node-objects13907880
Ref: 3d5913907880
Ref: library/xml dom xml dom Node nodeType13908019
Ref: 3d5a13908019
Ref: library/xml dom xml dom Node parentNode13908541
Ref: 3d5b13908541
Ref: library/xml dom xml dom Node attributes13909124
Ref: 3d5c13909124
Ref: library/xml dom xml dom Node previousSibling13909407
Ref: 3d5d13909407
Ref: library/xml dom xml dom Node nextSibling13910037
Ref: 3d5e13910037
Ref: library/xml dom xml dom Node childNodes13910406
Ref: 3d5f13910406
Ref: library/xml dom xml dom Node firstChild13910568
Ref: 3d6013910568
Ref: library/xml dom xml dom Node lastChild13910781
Ref: 3d6113910781
Ref: library/xml dom xml dom Node localName13910993
Ref: 3d6213910993
Ref: library/xml dom xml dom Node prefix13911182
Ref: 3d6313911182
Ref: library/xml dom xml dom Node namespaceURI13911387
Ref: 3d6413911387
Ref: library/xml dom xml dom Node nodeName13911566
Ref: 3d6513911566
Ref: library/xml dom xml dom Node nodeValue13912100
Ref: 3d6613912100
Ref: library/xml dom xml dom Node hasAttributes13912403
Ref: 3d6713912403
Ref: library/xml dom xml dom Node hasChildNodes13912538
Ref: 3d6813912538
Ref: library/xml dom xml dom Node isSameNode13912679
Ref: 3d6913912679
Ref: library/xml dom xml dom Node appendChild13913655
Ref: 3d6a13913655
Ref: library/xml dom xml dom Node insertBefore13913918
Ref: 3d6b13913918
Ref: library/xml dom xml dom Node removeChild13914373
Ref: 3d6c13914373
Ref: library/xml dom xml dom Node replaceChild13914800
Ref: 3d6d13914800
Ref: library/xml dom xml dom Node normalize13915109
Ref: 3d6e13915109
Ref: library/xml dom xml dom Node cloneNode13915443
Ref: 3d6f13915443
Node: NodeList オブジェクト13915675
Ref: library/xml dom dom-nodelist-objects13915839
Ref: 23ab13915839
Ref: library/xml dom nodelist-objects13915839
Ref: 3d7013915839
Ref: library/xml dom xml dom NodeList item13916627
Ref: 3d7113916627
Ref: library/xml dom xml dom NodeList length13916883
Ref: 3d7213916883
Node: DocumentType オブジェクト13917752
Ref: library/xml dom documenttype-objects13917920
Ref: 3d7313917920
Ref: library/xml dom dom-documenttype-objects13917920
Ref: 3d4e13917920
Ref: library/xml dom xml dom DocumentType publicId13918746
Ref: 3d7413918746
Ref: library/xml dom xml dom DocumentType systemId13918969
Ref: 3d7513918969
Ref: library/xml dom xml dom DocumentType internalSubset13919212
Ref: 3d7613919212
Ref: library/xml dom xml dom DocumentType name13919515
Ref: 3d7713919515
Ref: library/xml dom xml dom DocumentType entities13919669
Ref: 3d7813919669
Ref: library/xml dom xml dom DocumentType notations13920167
Ref: 3d7913920167
Node: Document オブジェクト13920640
Ref: library/xml dom document-objects13920810
Ref: 3d7a13920810
Ref: library/xml dom dom-document-objects13920810
Ref: 3d4f13920810
Ref: library/xml dom xml dom Document documentElement13921150
Ref: 178013921150
Ref: library/xml dom xml dom Document createElement13921258
Ref: 3d7b13921258
Ref: library/xml dom xml dom Document createElementNS13921618
Ref: 3d7c13921618
Ref: library/xml dom xml dom Document createTextNode13922081
Ref: 3d7d13922081
Ref: library/xml dom xml dom Document createComment13922379
Ref: 3d7e13922379
Ref: library/xml dom xml dom Document createProcessingInstruction13922676
Ref: 3d7f13922676
Ref: library/xml dom xml dom Document createAttribute13923013
Ref: 3d8013923013
Ref: library/xml dom xml dom Document createAttributeNS13923406
Ref: 3d8113923406
Ref: library/xml dom xml dom Document getElementsByTagName13923931
Ref: 3d8213923931
Ref: library/xml dom xml dom Document getElementsByTagNameNS13924136
Ref: 3d8313924136
Node: Element オブジェクト<2>13924476
Ref: library/xml dom dom-element-objects13924638
Ref: 3d5013924638
Ref: library/xml dom element-objects13924638
Ref: 3d8413924638
Ref: library/xml dom xml dom Element tagName13924836
Ref: 3d8513924836
Ref: library/xml dom xml dom Element getElementsByTagName13925022
Ref: 3d8613925022
Ref: library/xml dom xml dom Element getElementsByTagNameNS13925165
Ref: 3d8713925165
Ref: library/xml dom xml dom Element hasAttribute13925326
Ref: 3d8813925326
Ref: library/xml dom xml dom Element hasAttributeNS13925490
Ref: 3d8913925490
Ref: library/xml dom xml dom Element getAttribute13925702
Ref: 3d8a13925702
Ref: library/xml dom xml dom Element getAttributeNode13925970
Ref: 3d8b13925970
Ref: library/xml dom xml dom Element getAttributeNS13926109
Ref: 3d8c13926109
Ref: library/xml dom xml dom Element getAttributeNodeNS13926431
Ref: 3d8d13926431
Ref: library/xml dom xml dom Element removeAttribute13926620
Ref: 3d8e13926620
Ref: library/xml dom xml dom Element removeAttributeNode13926818
Ref: 3d9013926818
Ref: library/xml dom xml dom Element removeAttributeNS13927049
Ref: 3d9113927049
Ref: library/xml dom xml dom Element setAttribute13927352
Ref: 3d9213927352
Ref: library/xml dom xml dom Element setAttributeNode13927464
Ref: 3d9313927464
Ref: library/xml dom xml dom Element setAttributeNodeNS13927870
Ref: 3d9513927870
Ref: library/xml dom xml dom Element setAttributeNS13928321
Ref: 3d9613928321
Node: Attr オブジェクト13928643
Ref: library/xml dom attr-objects13928798
Ref: 3d9713928798
Ref: library/xml dom dom-attr-objects13928798
Ref: 3d5113928798
Ref: library/xml dom xml dom Attr name13928953
Ref: 3d9813928953
Ref: library/xml dom xml dom Attr localName13929115
Ref: 3d9913929115
Ref: library/xml dom xml dom Attr prefix13929261
Ref: 3d9a13929261
Ref: library/xml dom xml dom Attr value13929404
Ref: 3d9b13929404
Node: NamedNodeMap Objects13929517
Ref: library/xml dom dom-attributelist-objects13929669
Ref: 3d9c13929669
Ref: library/xml dom namednodemap-objects13929669
Ref: 3d9d13929669
Ref: library/xml dom xml dom NamedNodeMap length13929802
Ref: 3d9e13929802
Ref: library/xml dom xml dom NamedNodeMap item13929878
Ref: 3d9f13929878
Node: Comment オブジェクト13930542
Ref: library/xml dom comment-objects13930735
Ref: 3da013930735
Ref: library/xml dom dom-comment-objects13930735
Ref: 3d5213930735
Ref: library/xml dom xml dom Comment data13930982
Ref: 3da113930982
Node: Text オブジェクトおよび CDATASection オブジェクト13931297
Ref: library/xml dom dom-text-objects13931510
Ref: 3d5313931510
Ref: library/xml dom text-and-cdatasection-objects13931510
Ref: 3da213931510
Ref: library/xml dom xml dom Text data13932257
Ref: 3da313932257
Node: ProcessingInstruction オブジェクト13932881
Ref: library/xml dom dom-pi-objects13933078
Ref: 3d5413933078
Ref: library/xml dom processinginstruction-objects13933078
Ref: 3da413933078
Ref: library/xml dom xml dom ProcessingInstruction target13933339
Ref: 3da513933339
Ref: library/xml dom xml dom ProcessingInstruction data13933487
Ref: 3da613933487
Node: 例外<23>13933597
Ref: library/xml dom dom-exceptions13933721
Ref: 3da713933721
Ref: library/xml dom exceptions13933721
Ref: 3da813933721
Ref: library/xml dom xml dom DOMException13934567
Ref: 3da913934567
Ref: library/xml dom xml dom DomstringSizeErr13934778
Ref: 3daa13934778
Ref: library/xml dom xml dom HierarchyRequestErr13935112
Ref: 3dab13935112
Ref: library/xml dom xml dom IndexSizeErr13935253
Ref: 3dac13935253
Ref: library/xml dom xml dom InuseAttributeErr13935435
Ref: 3d9413935435
Ref: library/xml dom xml dom InvalidAccessErr13935598
Ref: 3dad13935598
Ref: library/xml dom xml dom InvalidCharacterErr13935775
Ref: 3dae13935775
Ref: library/xml dom xml dom InvalidModificationErr13936149
Ref: 3daf13936149
Ref: library/xml dom xml dom InvalidStateErr13936272
Ref: 3db013936272
Ref: library/xml dom xml dom NamespaceErr13936475
Ref: 3db113936475
Ref: library/xml dom xml dom NotFoundErr13936684
Ref: 3d8f13936684
Ref: library/xml dom xml dom NotSupportedErr13937011
Ref: 3db213937011
Ref: library/xml dom xml dom NoDataAllowedErr13937181
Ref: 3db313937181
Ref: library/xml dom xml dom NoModificationAllowedErr13937334
Ref: 3db413937334
Ref: library/xml dom xml dom SyntaxErr13937565
Ref: 3db513937565
Ref: library/xml dom xml dom WrongDocumentErr13937681
Ref: 3db613937681
Ref: 例外<23>-Footnote-113940768
Node: 適合性13940813
Ref: library/xml dom conformance13940957
Ref: 3db713940957
Ref: library/xml dom dom-conformance13940957
Ref: 3d4313940957
Node: 型の対応付け13941237
Ref: library/xml dom dom-type-mapping13941334
Ref: 3db813941334
Ref: library/xml dom type-mapping13941334
Ref: 3db913941334
Node: アクセサメソッド13942207
Ref: library/xml dom accessor-methods13942304
Ref: 3dba13942304
Ref: library/xml dom dom-accessor-methods13942304
Ref: 3dbb13942304
Node: xml dom minidom --- 最小限の DOM の実装13944828
Ref: library/xml dom minidom doc13945093
Ref: 3dbc13945093
Ref: library/xml dom minidom module-xml dom minidom13945093
Ref: 12813945093
Ref: library/xml dom minidom translation-repo13945093
Ref: 3dbd13945093
Ref: library/xml dom minidom xml-dom-minidom-minimal-dom-implementation13945093
Ref: 3dbe13945093
Ref: library/xml dom minidom xml dom minidom parse13946368
Ref: 3dbf13946368
Ref: library/xml dom minidom xml dom minidom parseString13947135
Ref: 3dc013947135
Ref: xml dom minidom --- 最小限の DOM の実装-Footnote-113949895
Ref: xml dom minidom --- 最小限の DOM の実装-Footnote-213949971
Node: DOM オブジェクト13950018
Ref: library/xml dom minidom dom-objects13950142
Ref: 3dc113950142
Ref: library/xml dom minidom minidom-objects13950142
Ref: 3dc213950142
Ref: library/xml dom minidom xml dom minidom Node unlink13950388
Ref: 3dc313950388
Ref: library/xml dom minidom xml dom minidom Node writexml13951528
Ref: c8913951528
Ref: library/xml dom minidom xml dom minidom Node toxml13953106
Ref: c8a13953106
Ref: library/xml dom minidom xml dom minidom Node toprettyxml13954154
Ref: c8b13954154
Ref: DOM オブジェクト-Footnote-113955016
Node: DOM の例13955502
Ref: library/xml dom minidom dom-example13955657
Ref: 3dc413955657
Ref: library/xml dom minidom id213955657
Ref: 3dc513955657
Node: minidom と DOM 標準13957713
Ref: library/xml dom minidom minidom-and-dom13957837
Ref: 3dc613957837
Ref: library/xml dom minidom minidom-and-the-dom-standard13957837
Ref: 3dc713957837
Node: xml dom pulldom --- 部分的な DOM ツリー構築のサポート13961148
Ref: library/xml dom pulldom doc13961396
Ref: 3dc813961396
Ref: library/xml dom pulldom module-xml dom pulldom13961396
Ref: 12913961396
Ref: library/xml dom pulldom translation-repo13961396
Ref: 3dc913961396
Ref: library/xml dom pulldom xml-dom-pulldom-support-for-building-partial-dom-trees13961396
Ref: 3dca13961396
Ref: library/xml dom pulldom xml dom pulldom PullDOM13964285
Ref: 3dcc13964285
Ref: library/xml dom pulldom xml dom pulldom SAX2DOM13964426
Ref: 3dce13964426
Ref: library/xml dom pulldom xml dom pulldom parse13964567
Ref: 3dcf13964567
Ref: library/xml dom pulldom xml dom pulldom parseString13965337
Ref: 3dd113965337
Ref: library/xml dom pulldom xml dom pulldom default_bufsize13965498
Ref: 3dd213965498
Ref: xml dom pulldom --- 部分的な DOM ツリー構築のサポート-Footnote-113965887
Node: DOMEventStream オブジェクト13965963
Ref: library/xml dom pulldom domeventstream-objects13966100
Ref: 3dd313966100
Ref: library/xml dom pulldom id113966100
Ref: 3dd413966100
Ref: library/xml dom pulldom xml dom pulldom DOMEventStream13966181
Ref: 93e13966181
Ref: library/xml dom pulldom xml dom pulldom DOMEventStream getEvent13966379
Ref: 3dd513966379
Ref: library/xml dom pulldom xml dom pulldom DOMEventStream expandNode13966906
Ref: 3dcb13966906
Ref: library/xml dom pulldom xml dom pulldom DOMEventStream reset13967634
Ref: 3dd613967634
Node: xml sax --- SAX2 バーサーのサポート13967667
Ref: library/xml sax doc13967926
Ref: 3dd713967926
Ref: library/xml sax module-xml sax13967926
Ref: 12f13967926
Ref: library/xml sax translation-repo13967926
Ref: 3dd813967926
Ref: library/xml sax xml-sax-support-for-sax2-parsers13967926
Ref: 3dd913967926
Ref: library/xml sax xml sax make_parser13969184
Ref: 1e1c13969184
Ref: library/xml sax xml sax parse13969866
Ref: 1de613969866
Ref: library/xml sax xml sax parseString13970748
Ref: 109c13970748
Ref: library/xml sax xml sax SAXException13973116
Ref: 3dde13973116
Ref: library/xml sax xml sax SAXParseException13974171
Ref: 3ddc13974171
Ref: library/xml sax xml sax SAXNotRecognizedException13974667
Ref: 3ddf13974667
Ref: library/xml sax xml sax SAXNotSupportedException13975060
Ref: 3de013975060
Ref: xml sax --- SAX2 バーサーのサポート-Footnote-113976221
Ref: xml sax --- SAX2 バーサーのサポート-Footnote-213976298
Node: SAXException オブジェクト13976333
Ref: library/xml sax sax-exception-objects13976445
Ref: 3de113976445
Ref: library/xml sax saxexception-objects13976445
Ref: 3de213976445
Ref: library/xml sax xml sax SAXException getMessage13976621
Ref: 3de313976621
Ref: library/xml sax xml sax SAXException getException13976737
Ref: 3de413976737
Node: xml sax handler --- SAX ハンドラーの基底クラス13976876
Ref: library/xml sax handler doc13977117
Ref: 3de513977117
Ref: library/xml sax handler module-xml sax handler13977117
Ref: 13013977117
Ref: library/xml sax handler translation-repo13977117
Ref: 3de613977117
Ref: library/xml sax handler xml-sax-handler-base-classes-for-sax-handlers13977117
Ref: 3de713977117
Ref: library/xml sax handler xml sax handler ContentHandler13977827
Ref: 3dcd13977827
Ref: library/xml sax handler xml sax handler DTDHandler13978150
Ref: 3de813978150
Ref: library/xml sax handler xml sax handler EntityResolver13978422
Ref: 3de913978422
Ref: library/xml sax handler xml sax handler ErrorHandler13978782
Ref: 3ddb13978782
Ref: library/xml sax handler xml sax handler LexicalHandler13979161
Ref: a5c13979161
Ref: library/xml sax handler xml sax handler feature_namespaces13979450
Ref: 3dea13979450
Ref: library/xml sax handler xml sax handler feature_namespace_prefixes13979850
Ref: 3deb13979850
Ref: library/xml sax handler xml sax handler feature_string_interning13980378
Ref: 3dec13980378
Ref: library/xml sax handler xml sax handler feature_validation13980896
Ref: 3ded13980896
Ref: library/xml sax handler xml sax handler feature_external_ges13981327
Ref: 17cd13981327
Ref: library/xml sax handler xml sax handler feature_external_pes13981956
Ref: 3dee13981956
Ref: library/xml sax handler xml sax handler all_features13982413
Ref: 3def13982413
Ref: library/xml sax handler xml sax handler property_lexical_handler13982489
Ref: 3df013982489
Ref: library/xml sax handler xml sax handler property_declaration_handler13982839
Ref: 3df113982839
Ref: library/xml sax handler xml sax handler property_dom_node13983231
Ref: 3df213983231
Ref: library/xml sax handler xml sax handler property_xml_string13983677
Ref: 3df313983677
Ref: library/xml sax handler xml sax handler all_properties13983946
Ref: 3df413983946
Ref: xml sax handler --- SAX ハンドラーの基底クラス-Footnote-113984264
Ref: xml sax handler --- SAX ハンドラーの基底クラス-Footnote-213984340
Ref: xml sax handler --- SAX ハンドラーの基底クラス-Footnote-313984405
Node: ContentHandler オブジェクト13984456
Ref: library/xml sax handler content-handler-objects13984621
Ref: 3df513984621
Ref: library/xml sax handler contenthandler-objects13984621
Ref: 3df613984621
Ref: library/xml sax handler xml sax handler ContentHandler setDocumentLocator13984977
Ref: 3df713984977
Ref: library/xml sax handler xml sax handler ContentHandler startDocument13986280
Ref: 3df813986280
Ref: library/xml sax handler xml sax handler ContentHandler endDocument13986610
Ref: 3df913986610
Ref: library/xml sax handler xml sax handler ContentHandler startPrefixMapping13987047
Ref: 3dfa13987047
Ref: library/xml sax handler xml sax handler ContentHandler endPrefixMapping13988421
Ref: 3dfb13988421
Ref: library/xml sax handler xml sax handler ContentHandler startElement13988850
Ref: 175c13988850
Ref: library/xml sax handler xml sax handler ContentHandler endElement13989467
Ref: 175d13989467
Ref: library/xml sax handler xml sax handler ContentHandler startElementNS13989713
Ref: 3dfd13989713
Ref: library/xml sax handler xml sax handler ContentHandler endElementNS13990699
Ref: 3dff13990699
Ref: library/xml sax handler xml sax handler ContentHandler characters13990983
Ref: 175e13990983
Ref: library/xml sax handler xml sax handler ContentHandler ignorableWhitespace13992387
Ref: 3e0013992387
Ref: library/xml sax handler xml sax handler ContentHandler processingInstruction13993304
Ref: 3e0113993304
Ref: library/xml sax handler xml sax handler ContentHandler skippedEntity13993876
Ref: 3e0213993876
Node: DTDHandler オブジェクト13994525
Ref: library/xml sax handler dtd-handler-objects13994732
Ref: 3e0313994732
Ref: library/xml sax handler dtdhandler-objects13994732
Ref: 3e0413994732
Ref: library/xml sax handler xml sax handler DTDHandler notationDecl13994894
Ref: 3e0513994894
Ref: library/xml sax handler xml sax handler DTDHandler unparsedEntityDecl13995022
Ref: 3e0613995022
Node: EntityResolver オブジェクト13995200
Ref: library/xml sax handler entity-resolver-objects13995405
Ref: 3e0713995405
Ref: library/xml sax handler entityresolver-objects13995405
Ref: 3e0813995405
Ref: library/xml sax handler xml sax handler EntityResolver resolveEntity13995488
Ref: 3e0913995488
Node: ErrorHandler オブジェクト13995823
Ref: library/xml sax handler errorhandler-objects13996021
Ref: 3e0a13996021
Ref: library/xml sax handler sax-error-handler13996021
Ref: 3e0b13996021
Ref: library/xml sax handler xml sax handler ErrorHandler error13996692
Ref: 3e0c13996692
Ref: library/xml sax handler xml sax handler ErrorHandler fatalError13997172
Ref: 3e0d13997172
Ref: library/xml sax handler xml sax handler ErrorHandler warning13997409
Ref: 3e0e13997409
Node: LexicalHandler Objects13997827
Ref: library/xml sax handler lexical-handler-objects13997983
Ref: 3e0f13997983
Ref: library/xml sax handler lexicalhandler-objects13997983
Ref: 3e1013997983
Ref: library/xml sax handler xml sax handler LexicalHandler comment13998588
Ref: 3e1113998588
Ref: library/xml sax handler xml sax handler LexicalHandler startDTD13998748
Ref: 3e1213998748
Ref: library/xml sax handler xml sax handler LexicalHandler endDTD13998912
Ref: 3e1313998912
Ref: library/xml sax handler xml sax handler LexicalHandler startCDATA13998998
Ref: 3e1413998998
Ref: library/xml sax handler xml sax handler LexicalHandler endCDATA13999198
Ref: 3e1513999198
Node: xml sax saxutils --- SAX ユーティリティー13999293
Ref: library/xml sax utils doc13999555
Ref: 3e1613999555
Ref: library/xml sax utils module-xml sax saxutils13999555
Ref: 13113999555
Ref: library/xml sax utils translation-repo13999555
Ref: 3e1713999555
Ref: library/xml sax utils xml-sax-saxutils-sax-utilities13999555
Ref: 3e1813999555
Ref: library/xml sax utils xml sax saxutils escape13999965
Ref: 3e1913999965
Ref: library/xml sax utils xml sax saxutils unescape14000757
Ref: 3e1a14000757
Ref: library/xml sax utils xml sax saxutils quoteattr14001266
Ref: 3e1b14001266
Ref: library/xml sax utils xml sax saxutils XMLGenerator14002227
Ref: 3e1c14002227
Ref: library/xml sax utils xml sax saxutils XMLFilterBase14003291
Ref: 3e1d14003291
Ref: library/xml sax utils xml sax saxutils prepare_input_source14003904
Ref: 3e1e14003904
Ref: xml sax saxutils --- SAX ユーティリティー-Footnote-114004495
Node: xml sax xmlreader --- XML パーサーのインターフェース14004572
Ref: library/xml sax reader doc14004840
Ref: 3e2014004840
Ref: library/xml sax reader module-xml sax xmlreader14004840
Ref: 13214004840
Ref: library/xml sax reader translation-repo14004840
Ref: 3e2114004840
Ref: library/xml sax reader xml-sax-xmlreader-interface-for-xml-parsers14004840
Ref: 3e2214004840
Ref: library/xml sax reader xml sax xmlreader XMLReader14005441
Ref: 3dd014005441
Ref: library/xml sax reader xml sax xmlreader IncrementalParser14005547
Ref: 3e2314005547
Ref: library/xml sax reader xml sax xmlreader Locator14007068
Ref: 3ddd14007068
Ref: library/xml sax reader xml sax xmlreader InputSource14007506
Ref: 109b14007506
Ref: library/xml sax reader xml sax xmlreader AttributesImpl14008478
Ref: 3e2414008478
Ref: library/xml sax reader xml sax xmlreader AttributesNSImpl14009174
Ref: 3e2514009174
Ref: xml sax xmlreader --- XML パーサーのインターフェース-Footnote-114010045
Node: XMLReader オブジェクト14010123
Ref: library/xml sax reader id114010298
Ref: 3e2614010298
Ref: library/xml sax reader xmlreader-objects14010298
Ref: 3e2714010298
Ref: library/xml sax reader xml sax xmlreader XMLReader parse14010442
Ref: 3e1f14010442
Ref: library/xml sax reader xml sax xmlreader XMLReader getContentHandler14011236
Ref: 3e2814011236
Ref: library/xml sax reader xml sax xmlreader XMLReader setContentHandler14011349
Ref: 3e2914011349
Ref: library/xml sax reader xml sax xmlreader XMLReader getDTDHandler14011590
Ref: 3e2a14011590
Ref: library/xml sax reader xml sax xmlreader XMLReader setDTDHandler14011695
Ref: 3e2b14011695
Ref: library/xml sax reader xml sax xmlreader XMLReader getEntityResolver14011910
Ref: 3e2c14011910
Ref: library/xml sax reader xml sax xmlreader XMLReader setEntityResolver14012023
Ref: 3e2d14012023
Ref: library/xml sax reader xml sax xmlreader XMLReader getErrorHandler14012390
Ref: 3e2e14012390
Ref: library/xml sax reader xml sax xmlreader XMLReader setErrorHandler14012499
Ref: 3e2f14012499
Ref: library/xml sax reader xml sax xmlreader XMLReader setLocale14012752
Ref: 3e3014012752
Ref: library/xml sax reader xml sax xmlreader XMLReader getFeature14013260
Ref: 3e3114013260
Ref: library/xml sax reader xml sax xmlreader XMLReader setFeature14013584
Ref: 3dda14013584
Ref: library/xml sax reader xml sax xmlreader XMLReader getProperty14013974
Ref: 3e3214013974
Ref: library/xml sax reader xml sax xmlreader XMLReader setProperty14014301
Ref: 3e3314014301
Node: IncrementalParser オブジェクト14014694
Ref: library/xml sax reader incremental-parser-objects14014904
Ref: 3e3414014904
Ref: library/xml sax reader incrementalparser-objects14014904
Ref: 3e3514014904
Ref: library/xml sax reader xml sax xmlreader IncrementalParser feed14015094
Ref: 3e3614015094
Ref: library/xml sax reader xml sax xmlreader IncrementalParser close14015193
Ref: 3e3714015193
Ref: library/xml sax reader xml sax xmlreader IncrementalParser reset14015426
Ref: 3e3814015426
Node: Locator オブジェクト14015764
Ref: library/xml sax reader id214015976
Ref: 3e3914015976
Ref: library/xml sax reader locator-objects14015976
Ref: 3e3a14015976
Ref: library/xml sax reader xml sax xmlreader Locator getColumnNumber14016129
Ref: 3e3b14016129
Ref: library/xml sax reader xml sax xmlreader Locator getLineNumber14016245
Ref: 3e3c14016245
Ref: library/xml sax reader xml sax xmlreader Locator getPublicId14016359
Ref: 3e3d14016359
Ref: library/xml sax reader xml sax xmlreader Locator getSystemId14016471
Ref: 3e3e14016471
Node: InputSource オブジェクト14016583
Ref: library/xml sax reader input-source-objects14016794
Ref: 3e3f14016794
Ref: library/xml sax reader inputsource-objects14016794
Ref: 3e4014016794
Ref: library/xml sax reader xml sax xmlreader InputSource setPublicId14016871
Ref: 3e4114016871
Ref: library/xml sax reader xml sax xmlreader InputSource getPublicId14016997
Ref: 3e4214016997
Ref: library/xml sax reader xml sax xmlreader InputSource setSystemId14017118
Ref: 3e4314017118
Ref: library/xml sax reader xml sax xmlreader InputSource getSystemId14017250
Ref: 3e4414017250
Ref: library/xml sax reader xml sax xmlreader InputSource setEncoding14017377
Ref: 3e4514017377
Ref: library/xml sax reader xml sax xmlreader InputSource getEncoding14017876
Ref: 3e4614017876
Ref: library/xml sax reader xml sax xmlreader InputSource setByteStream14018002
Ref: 3e4714018002
Ref: library/xml sax reader xml sax xmlreader InputSource getByteStream14018592
Ref: 3e4814018592
Ref: library/xml sax reader xml sax xmlreader InputSource setCharacterStream14018888
Ref: 3e4914018888
Ref: library/xml sax reader xml sax xmlreader InputSource getCharacterStream14019241
Ref: 3e4a14019241
Node: Attributes インターフェース14019367
Ref: library/xml sax reader attributes-objects14019589
Ref: 3dfc14019589
Ref: library/xml sax reader the-attributes-interface14019589
Ref: 3e4b14019589
Ref: library/xml sax reader xml sax xmlreader Attributes getLength14019968
Ref: 3e4c14019968
Ref: library/xml sax reader xml sax xmlreader Attributes getNames14020048
Ref: 3e4d14020048
Ref: library/xml sax reader xml sax xmlreader Attributes getType14020130
Ref: 3e4e14020130
Ref: library/xml sax reader xml sax xmlreader Attributes getValue14020262
Ref: 3e4f14020262
Node: AttributesNS インターフェース14020353
Ref: library/xml sax reader attributes-ns-objects14020536
Ref: 3dfe14020536
Ref: library/xml sax reader the-attributesns-interface14020536
Ref: 3e5014020536
Ref: library/xml sax reader xml sax xmlreader AttributesNS getValueByQName14021007
Ref: 3e5114021007
Ref: library/xml sax reader xml sax xmlreader AttributesNS getNameByQName14021102
Ref: 3e5214021102
Ref: library/xml sax reader xml sax xmlreader AttributesNS getQNameByName14021258
Ref: 3e5314021258
Ref: library/xml sax reader xml sax xmlreader AttributesNS getQNames14021399
Ref: 3e5414021399
Node: xml parsers expat --- Expat を使用した高速な XML 解析14021499
Ref: library/pyexpat doc14021709
Ref: 3e5514021709
Ref: library/pyexpat module-xml parsers expat14021709
Ref: 12c14021709
Ref: library/pyexpat translation-repo14021709
Ref: 3e5614021709
Ref: library/pyexpat xml-parsers-expat-fast-xml-parsing-using-expat14021709
Ref: 3e5714021709
Ref: library/pyexpat xml parsers expat ExpatError14022805
Ref: 149014022805
Ref: library/pyexpat xml parsers expat error14023060
Ref: 3e5914023060
Ref: library/pyexpat xml parsers expat XMLParserType14023146
Ref: 3e5a14023146
Ref: library/pyexpat xml parsers expat ErrorString14023346
Ref: 3e5c14023346
Ref: library/pyexpat xml parsers expat ParserCreate14023488
Ref: 3e5b14023488
Ref: library/pyexpat xmlparser-non-root14024250
Ref: 3e5d14024250
Ref: xml parsers expat --- Expat を使用した高速な XML 解析-Footnote-114026690
Ref: xml parsers expat --- Expat を使用した高速な XML 解析-Footnote-214027084
Node: XMLParser オブジェクト<2>14027117
Ref: library/pyexpat id214027274
Ref: 3e5e14027274
Ref: library/pyexpat xmlparser-objects14027274
Ref: 17bb14027274
Ref: library/pyexpat xml parsers expat xmlparser Parse14027432
Ref: 3e5f14027432
Ref: library/pyexpat xml parsers expat xmlparser ParseFile14027929
Ref: 3e6014027929
Ref: library/pyexpat xml parsers expat xmlparser SetBase14028248
Ref: 3e6114028248
Ref: library/pyexpat xml parsers expat xmlparser GetBase14028701
Ref: 3e6514028701
Ref: library/pyexpat xml parsers expat xmlparser GetInputContext14028956
Ref: 3e6614028956
Ref: library/pyexpat xml parsers expat xmlparser ExternalEntityParserCreate14029349
Ref: 17ee14029349
Ref: library/pyexpat xml parsers expat xmlparser SetParamEntityParsing14029974
Ref: 3e6914029974
Ref: library/pyexpat xml parsers expat xmlparser UseForeignDTD14030377
Ref: 3e6a14030377
Ref: library/pyexpat xml parsers expat xmlparser SetReparseDeferralEnabled14031530
Ref: 57914031530
Ref: library/pyexpat xml parsers expat xmlparser GetReparseDeferralEnabled14033044
Ref: 57814033044
Ref: library/pyexpat xml parsers expat xmlparser SetAllocTrackerActivationThreshold14033330
Ref: 17b914033330
Ref: library/pyexpat xml parsers expat xmlparser SetAllocTrackerMaximumAmplification14033941
Ref: 17ba14033941
Ref: library/pyexpat xml parsers expat xmlparser buffer_size14035433
Ref: 3e6f14035433
Ref: library/pyexpat xml parsers expat xmlparser buffer_text14035758
Ref: 16db14035758
Ref: library/pyexpat xml parsers expat xmlparser buffer_used14036304
Ref: 3e7114036304
Ref: library/pyexpat xml parsers expat xmlparser ordered_attributes14036642
Ref: 3e6714036642
Ref: library/pyexpat xml parsers expat xmlparser specified_attributes14037265
Ref: 3e6814037265
Ref: library/pyexpat xml parsers expat xmlparser ErrorByteIndex14038267
Ref: 3e7214038267
Ref: library/pyexpat xml parsers expat xmlparser ErrorCode14038375
Ref: 3e7314038375
Ref: library/pyexpat xml parsers expat xmlparser ErrorColumnNumber14038624
Ref: 3e7414038624
Ref: library/pyexpat xml parsers expat xmlparser ErrorLineNumber14038723
Ref: 3e7514038723
Ref: library/pyexpat xml parsers expat xmlparser CurrentByteIndex14039299
Ref: 3e7614039299
Ref: library/pyexpat xml parsers expat xmlparser CurrentColumnNumber14039415
Ref: 3e7714039415
Ref: library/pyexpat xml parsers expat xmlparser CurrentLineNumber14039522
Ref: 3e7814039522
Ref: library/pyexpat xml parsers expat xmlparser XmlDeclHandler14040105
Ref: 3e7914040105
Ref: library/pyexpat xml parsers expat xmlparser StartDoctypeDeclHandler14040766
Ref: 3e6b14040766
Ref: library/pyexpat xml parsers expat xmlparser EndDoctypeDeclHandler14041324
Ref: 3e6c14041324
Ref: library/pyexpat xml parsers expat xmlparser ElementDeclHandler14041536
Ref: 17b414041536
Ref: library/pyexpat xml parsers expat xmlparser AttlistDeclHandler14041777
Ref: 3e7a14041777
Ref: library/pyexpat xml parsers expat xmlparser StartElementHandler14042850
Ref: 3e7b14042850
Ref: library/pyexpat xml parsers expat xmlparser EndElementHandler14043289
Ref: 3e7c14043289
Ref: library/pyexpat xml parsers expat xmlparser ProcessingInstructionHandler14043413
Ref: 3e7d14043413
Ref: library/pyexpat xml parsers expat xmlparser CharacterDataHandler14043553
Ref: 3e7014043553
Ref: library/pyexpat xml parsers expat xmlparser UnparsedEntityDeclHandler14044224
Ref: 3e6414044224
Ref: library/pyexpat xml parsers expat xmlparser EntityDeclHandler14044804
Ref: 3e8014044804
Ref: library/pyexpat xml parsers expat xmlparser NotationDeclHandler14045883
Ref: 3e6314045883
Ref: library/pyexpat xml parsers expat xmlparser StartNamespaceDeclHandler14046266
Ref: 3e8114046266
Ref: library/pyexpat xml parsers expat xmlparser EndNamespaceDeclHandler14046585
Ref: 3e8214046585
Ref: library/pyexpat xml parsers expat xmlparser CommentHandler14047178
Ref: 3e8314047178
Ref: library/pyexpat xml parsers expat xmlparser StartCdataSectionHandler14047404
Ref: 3e7e14047404
Ref: library/pyexpat xml parsers expat xmlparser EndCdataSectionHandler14047714
Ref: 3e7f14047714
Ref: library/pyexpat xml parsers expat xmlparser DefaultHandler14047836
Ref: 3e8414047836
Ref: library/pyexpat xml parsers expat xmlparser DefaultHandlerExpand14048229
Ref: 3e8514048229
Ref: library/pyexpat xml parsers expat xmlparser NotStandaloneHandler14048491
Ref: 3e8614048491
Ref: library/pyexpat xml parsers expat xmlparser ExternalEntityRefHandler14049113
Ref: 3e6214049113
Ref: XMLParser オブジェクト<2>-Footnote-114050963
Ref: XMLParser オブジェクト<2>-Footnote-214051028
Node: ExpatError 例外14051079
Ref: library/pyexpat expaterror-exceptions14051258
Ref: 3e8714051258
Ref: library/pyexpat expaterror-objects14051258
Ref: 3e5814051258
Ref: library/pyexpat xml parsers expat ExpatError code14051403
Ref: 3e8814051403
Ref: library/pyexpat xml parsers expat ExpatError lineno14052161
Ref: 3e6d14052161
Ref: library/pyexpat xml parsers expat ExpatError offset14052298
Ref: 3e6e14052298
Node: 使用例<35>14052461
Ref: library/pyexpat example14052633
Ref: 3e8b14052633
Ref: library/pyexpat expat-example14052633
Ref: 3e8c14052633
Node: 内容モデルの記述14053810
Ref: library/pyexpat content-model-descriptions14053986
Ref: 3e8d14053986
Ref: library/pyexpat expat-content-models14053986
Ref: 3e8e14053986
Ref: library/pyexpat module-xml parsers expat model14053986
Ref: 12e14053986
Node: Expat エラー定数14056207
Ref: library/pyexpat expat-error-constants14056361
Ref: 3e8f14056361
Ref: library/pyexpat expat-errors14056361
Ref: 3e9014056361
Ref: library/pyexpat module-xml parsers expat errors14056361
Ref: 12d14056361
Ref: library/pyexpat xml parsers expat errors codes14056950
Ref: 3e8a14056950
Ref: library/pyexpat xml parsers expat errors messages14057104
Ref: 3e8914057104
Ref: library/pyexpat xml parsers expat errors XML_ERROR_ASYNC_ENTITY14057273
Ref: 3e9114057273
Ref: library/pyexpat xml parsers expat errors XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF14057337
Ref: 3e9214057337
Ref: library/pyexpat xml parsers expat errors XML_ERROR_BAD_CHAR_REF14057570
Ref: 3e9314057570
Ref: library/pyexpat xml parsers expat errors XML_ERROR_BINARY_ENTITY_REF14057767
Ref: 3e9414057767
Ref: library/pyexpat xml parsers expat errors XML_ERROR_DUPLICATE_ATTRIBUTE14057993
Ref: 3e9514057993
Ref: library/pyexpat xml parsers expat errors XML_ERROR_INCORRECT_ENCODING14058158
Ref: 3e9614058158
Ref: library/pyexpat xml parsers expat errors XML_ERROR_INVALID_TOKEN14058228
Ref: 3e9714058228
Ref: library/pyexpat xml parsers expat errors XML_ERROR_JUNK_AFTER_DOC_ELEMENT14058496
Ref: 3e9814058496
Ref: library/pyexpat xml parsers expat errors XML_ERROR_MISPLACED_XML_PI14058649
Ref: 3e9914058649
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NO_ELEMENTS14058804
Ref: 3e9a14058804
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NO_MEMORY14059034
Ref: 3e9b14059034
Ref: library/pyexpat xml parsers expat errors XML_ERROR_PARAM_ENTITY_REF14059162
Ref: 3e9c14059162
Ref: library/pyexpat xml parsers expat errors XML_ERROR_PARTIAL_CHAR14059330
Ref: 3e9d14059330
Ref: library/pyexpat xml parsers expat errors XML_ERROR_RECURSIVE_ENTITY_REF14059455
Ref: 3e9e14059455
Ref: library/pyexpat xml parsers expat errors XML_ERROR_SYNTAX14059727
Ref: 3e9f14059727
Ref: library/pyexpat xml parsers expat errors XML_ERROR_TAG_MISMATCH14059870
Ref: 3ea014059870
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNCLOSED_TOKEN14060025
Ref: 3ea114060025
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNDEFINED_ENTITY14060255
Ref: 3ea214060255
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNKNOWN_ENCODING14060408
Ref: 3ea314060408
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNCLOSED_CDATA_SECTION14060568
Ref: 3ea414060568
Ref: library/pyexpat xml parsers expat errors XML_ERROR_EXTERNAL_ENTITY_HANDLING14060702
Ref: 3ea514060702
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NOT_STANDALONE14060778
Ref: 3ea614060778
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNEXPECTED_STATE14061075
Ref: 3ea714061075
Ref: library/pyexpat xml parsers expat errors XML_ERROR_ENTITY_DECLARED_IN_PE14061143
Ref: 3ea814061143
Ref: library/pyexpat xml parsers expat errors XML_ERROR_FEATURE_REQUIRES_XML_DTD14061216
Ref: 3ea914061216
Ref: library/pyexpat xml parsers expat errors XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING14061521
Ref: 3eaa14061521
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNBOUND_PREFIX14061864
Ref: 3eab14061864
Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNDECLARING_PREFIX14062051
Ref: 3eac14062051
Ref: library/pyexpat xml parsers expat errors XML_ERROR_INCOMPLETE_PE14062236
Ref: 3ead14062236
Ref: library/pyexpat xml parsers expat errors XML_ERROR_XML_DECL14062398
Ref: 3eae14062398
Ref: library/pyexpat xml parsers expat errors XML_ERROR_TEXT_DECL14062507
Ref: 3eaf14062507
Ref: library/pyexpat xml parsers expat errors XML_ERROR_PUBLICID14062653
Ref: 3eb014062653
Ref: library/pyexpat xml parsers expat errors XML_ERROR_SUSPENDED14062791
Ref: 3eb114062791
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NOT_SUSPENDED14063153
Ref: 3eb214063153
Ref: library/pyexpat xml parsers expat errors XML_ERROR_ABORTED14063312
Ref: 3eb314063312
Ref: library/pyexpat xml parsers expat errors XML_ERROR_FINISHED14063438
Ref: 3eb414063438
Ref: library/pyexpat xml parsers expat errors XML_ERROR_SUSPEND_PE14063814
Ref: 3eb514063814
Ref: library/pyexpat xml parsers expat errors XML_ERROR_RESERVED_PREFIX_XML14063876
Ref: 3eb614063876
Ref: library/pyexpat xml parsers expat errors XML_ERROR_RESERVED_PREFIX_XMLNS14064067
Ref: 3eb714064067
Ref: library/pyexpat xml parsers expat errors XML_ERROR_RESERVED_NAMESPACE_URI14064234
Ref: 3eb814064234
Ref: library/pyexpat xml parsers expat errors XML_ERROR_INVALID_ARGUMENT14064449
Ref: 3eb914064449
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NO_BUFFER14064584
Ref: 3eba14064584
Ref: library/pyexpat xml parsers expat errors XML_ERROR_AMPLIFICATION_LIMIT_BREACH14064712
Ref: 3ebb14064712
Ref: library/pyexpat xml parsers expat errors XML_ERROR_NOT_STARTED14064894
Ref: 18d314064894
Node: インターネットプロトコルとサポート14065072
Ref: library/internet doc14065275
Ref: 3ebc14065275
Ref: library/internet internet14065275
Ref: 3ebd14065275
Ref: library/internet internet-protocols-and-support14065275
Ref: 3ebe14065275
Ref: library/internet translation-repo14065275
Ref: 3ebf14065275
Node: webbrowser --- 便利なウェブブラウザコントローラー14068373
Ref: library/webbrowser doc14068601
Ref: 3ec014068601
Ref: library/webbrowser module-webbrowser14068601
Ref: 11b14068601
Ref: library/webbrowser webbrowser-convenient-web-browser-controller14068601
Ref: 3ec114068601
Ref: webbrowser --- 便利なウェブブラウザコントローラー-Footnote-114071387
Ref: webbrowser --- 便利なウェブブラウザコントローラー-Footnote-214071457
Node: コマンドライン・インターフェース<6>14071635
Ref: library/webbrowser command-line-interface14071824
Ref: 3ec214071824
Ref: library/webbrowser webbrowser-cli14071824
Ref: 3ec314071824
Ref: library/webbrowser cmdoption-webbrowser-n14072191
Ref: 3ec414072191
Ref: library/webbrowser cmdoption-webbrowser-new-window14072191
Ref: 3ec514072191
Ref: library/webbrowser cmdoption-webbrowser-t14072279
Ref: 3ec614072279
Ref: library/webbrowser cmdoption-webbrowser-new-tab14072279
Ref: 3ec714072279
Ref: library/webbrowser webbrowser Error14072564
Ref: 3ec814072564
Ref: library/webbrowser webbrowser open14072724
Ref: 188914072724
Ref: library/webbrowser webbrowser open_new14073901
Ref: 3ec914073901
Ref: library/webbrowser webbrowser open_new_tab14074258
Ref: 3eca14074258
Ref: library/webbrowser webbrowser get14074612
Ref: 3ecb14074612
Ref: library/webbrowser webbrowser register14074905
Ref: 3ecc14074905
Node: Browser controller objects14081911
Ref: library/webbrowser browser-controller-objects14082100
Ref: 3ecd14082100
Ref: library/webbrowser browser-controllers14082100
Ref: 3ece14082100
Ref: library/webbrowser webbrowser controller name14082317
Ref: 59a14082317
Ref: library/webbrowser webbrowser controller open14082395
Ref: 3ecf14082395
Ref: library/webbrowser webbrowser controller open_new14082778
Ref: 3ed014082778
Ref: library/webbrowser webbrowser controller open_new_tab14083118
Ref: 3ed114083118
Node: wsgiref --- WSGI ユーティリティとリファレンス実装14083415
Ref: library/wsgiref doc14083694
Ref: 3ed214083694
Ref: library/wsgiref module-wsgiref14083694
Ref: 11e14083694
Ref: library/wsgiref translation-repo14083694
Ref: 3ed314083694
Ref: library/wsgiref wsgiref-wsgi-utilities-and-reference-implementation14083694
Ref: 3ed414083694
Ref: wsgiref --- WSGI ユーティリティとリファレンス実装-Footnote-114086134
Ref: wsgiref --- WSGI ユーティリティとリファレンス実装-Footnote-214086198
Ref: wsgiref --- WSGI ユーティリティとリファレンス実装-Footnote-314086240
Node: wsgiref util -- WSGI environment utilities14086277
Ref: library/wsgiref module-wsgiref util14086475
Ref: 12314086475
Ref: library/wsgiref wsgiref-util-wsgi-environment-utilities14086475
Ref: 3ed514086475
Ref: library/wsgiref wsgiref util guess_scheme14087110
Ref: 3ed714087110
Ref: library/wsgiref wsgiref util request_uri14087932
Ref: 3ed814087932
Ref: library/wsgiref wsgiref util application_uri14088326
Ref: 3ed914088326
Ref: library/wsgiref wsgiref util shift_path_info14088648
Ref: 3eda14088648
Ref: library/wsgiref wsgiref util setup_testing_defaults14090763
Ref: 3edb14090763
Ref: library/wsgiref wsgiref util is_hop_by_hop14092814
Ref: 1a3b14092814
Ref: library/wsgiref wsgiref util FileWrapper14093015
Ref: 93f14093015
Ref: wsgiref util -- WSGI environment utilities-Footnote-114094352
Ref: wsgiref util -- WSGI environment utilities-Footnote-214094394
Ref: wsgiref util -- WSGI environment utilities-Footnote-314094436
Ref: wsgiref util -- WSGI environment utilities-Footnote-414094478
Ref: wsgiref util -- WSGI environment utilities-Footnote-514094520
Node: wsgiref headers -- WSGI response header tools14094579
Ref: library/wsgiref module-wsgiref headers14094836
Ref: 12014094836
Ref: library/wsgiref wsgiref-headers-wsgi-response-header-tools14094836
Ref: 3ede14094836
Ref: library/wsgiref wsgiref headers Headers14095145
Ref: 109814095145
Ref: library/wsgiref wsgiref headers Headers get_all14097926
Ref: 3edf14097926
Ref: library/wsgiref wsgiref headers Headers add_header14098498
Ref: 3ee014098498
Ref: wsgiref headers -- WSGI response header tools-Footnote-114100033
Node: wsgiref simple_server -- a simple WSGI HTTP server14100075
Ref: library/wsgiref module-wsgiref simple_server14100335
Ref: 12114100335
Ref: library/wsgiref wsgiref-simple-server-a-simple-wsgi-http-server14100335
Ref: 3ee114100335
Ref: library/wsgiref wsgiref simple_server make_server14101153
Ref: 3ee214101153
Ref: library/wsgiref wsgiref simple_server demo_app14102094
Ref: 3edc14102094
Ref: library/wsgiref wsgiref simple_server WSGIServer14102620
Ref: 3ee414102620
Ref: library/wsgiref wsgiref simple_server WSGIServer set_app14103517
Ref: 3ee614103517
Ref: library/wsgiref wsgiref simple_server WSGIServer get_app14103724
Ref: 3ee714103724
Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler14104153
Ref: 3ee814104153
Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler get_environ14104991
Ref: 3ee914104991
Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler get_stderr14105582
Ref: 3eea14105582
Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler handle14105802
Ref: 3eeb14105802
Ref: wsgiref simple_server -- a simple WSGI HTTP server-Footnote-114106169
Ref: wsgiref simple_server -- a simple WSGI HTTP server-Footnote-214106211
Node: wsgiref validate --- WSGI conformance checker14106253
Ref: library/wsgiref module-wsgiref validate14106515
Ref: 12414106515
Ref: library/wsgiref wsgiref-validate-wsgi-conformance-checker14106515
Ref: 3eec14106515
Ref: library/wsgiref wsgiref validate validator14107573
Ref: 3eed14107573
Ref: wsgiref validate --- WSGI conformance checker-Footnote-114110139
Ref: wsgiref validate --- WSGI conformance checker-Footnote-214110181
Ref: wsgiref validate --- WSGI conformance checker-Footnote-314110240
Node: wsgiref handlers -- server/gateway base classes14110282
Ref: library/wsgiref module-wsgiref handlers14110546
Ref: 11f14110546
Ref: library/wsgiref wsgiref-handlers-server-gateway-base-classes14110546
Ref: 3eee14110546
Ref: library/wsgiref wsgiref handlers CGIHandler14111020
Ref: 3eef14111020
Ref: library/wsgiref wsgiref handlers IISCGIHandler14111909
Ref: 3ef114111909
Ref: library/wsgiref wsgiref handlers BaseCGIHandler14113363
Ref: 3ef014113363
Ref: library/wsgiref wsgiref handlers SimpleHandler14114444
Ref: 3ef214114444
Ref: library/wsgiref wsgiref handlers BaseHandler14115493
Ref: 1dd314115493
Ref: library/wsgiref wsgiref handlers BaseHandler run14116001
Ref: 3ef814116001
Ref: library/wsgiref wsgiref handlers BaseHandler _write14116511
Ref: 3ef614116511
Ref: library/wsgiref wsgiref handlers BaseHandler _flush14116971
Ref: 3ef714116971
Ref: library/wsgiref wsgiref handlers BaseHandler get_stdin14117257
Ref: 3ef314117257
Ref: library/wsgiref wsgiref handlers BaseHandler get_stderr14117466
Ref: 3ef414117466
Ref: library/wsgiref wsgiref handlers BaseHandler add_cgi_vars14117677
Ref: 3ef514117677
Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_multithread14118328
Ref: 3efb14118328
Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_multiprocess14118687
Ref: 3efc14118687
Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_run_once14119048
Ref: 3efd14119048
Ref: library/wsgiref wsgiref handlers BaseHandler os_environ14119319
Ref: 3efe14119319
Ref: library/wsgiref wsgiref handlers BaseHandler server_software14119817
Ref: 3eff14119817
Ref: library/wsgiref wsgiref handlers BaseHandler get_scheme14120500
Ref: 3f0114120500
Ref: library/wsgiref wsgiref handlers BaseHandler setup_environ14120870
Ref: 3f0214120870
Ref: library/wsgiref wsgiref handlers BaseHandler log_exception14121604
Ref: 3f0414121604
Ref: library/wsgiref wsgiref handlers BaseHandler traceback_limit14122280
Ref: 3f0514122280
Ref: library/wsgiref wsgiref handlers BaseHandler error_output14122573
Ref: 3f0614122573
Ref: library/wsgiref wsgiref handlers BaseHandler error_status14124027
Ref: 3f0714124027
Ref: library/wsgiref wsgiref handlers BaseHandler error_headers14124299
Ref: 3f0814124299
Ref: library/wsgiref wsgiref handlers BaseHandler error_body14124711
Ref: 3f0914124711
Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_file_wrapper14125190
Ref: 3f0314125190
Ref: library/wsgiref wsgiref handlers BaseHandler sendfile14125463
Ref: 3f0a14125463
Ref: library/wsgiref wsgiref handlers BaseHandler origin_server14126119
Ref: 3f0014126119
Ref: library/wsgiref wsgiref handlers BaseHandler http_version14126732
Ref: 3f0b14126732
Ref: library/wsgiref wsgiref handlers read_environ14127014
Ref: 13d114127014
Ref: wsgiref handlers -- server/gateway base classes-Footnote-114127923
Ref: wsgiref handlers -- server/gateway base classes-Footnote-214127965
Ref: wsgiref handlers -- server/gateway base classes-Footnote-314128007
Ref: wsgiref handlers -- server/gateway base classes-Footnote-414128049
Ref: wsgiref handlers -- server/gateway base classes-Footnote-514128091
Node: wsgiref types -- WSGI types for static type checking14128133
Ref: library/wsgiref module-wsgiref types14128365
Ref: 12214128365
Ref: library/wsgiref wsgiref-types-wsgi-types-for-static-type-checking14128365
Ref: 3f0c14128365
Ref: library/wsgiref wsgiref types StartResponse14128610
Ref: 3ee314128610
Ref: library/wsgiref wsgiref types WSGIEnvironment14128752
Ref: 3ed614128752
Ref: library/wsgiref wsgiref types WSGIApplication14128859
Ref: 3f0d14128859
Ref: library/wsgiref wsgiref types InputStream14128964
Ref: 3ef914128964
Ref: library/wsgiref wsgiref types ErrorStream14129077
Ref: 3efa14129077
Ref: library/wsgiref wsgiref types FileWrapper14129190
Ref: 3edd14129190
Ref: wsgiref types -- WSGI types for static type checking-Footnote-114129434
Ref: wsgiref types -- WSGI types for static type checking-Footnote-214129476
Ref: wsgiref types -- WSGI types for static type checking-Footnote-314129546
Ref: wsgiref types -- WSGI types for static type checking-Footnote-414129588
Ref: wsgiref types -- WSGI types for static type checking-Footnote-514129654
Ref: wsgiref types -- WSGI types for static type checking-Footnote-614129720
Node: 使用例<36>14129804
Ref: library/wsgiref examples14129980
Ref: 3f0e14129980
Node: urllib --- URL を扱うモジュール群14132807
Ref: library/urllib doc14133088
Ref: 3f0f14133088
Ref: library/urllib module-urllib14133088
Ref: 10e14133088
Ref: library/urllib translation-repo14133088
Ref: 3f1014133088
Ref: library/urllib urllib-url-handling-modules14133088
Ref: 3f1114133088
Ref: urllib --- URL を扱うモジュール群-Footnote-114133838
Node: urllib request --- URL を開くための大規模なライブラリ14133902
Ref: library/urllib request doc14134169
Ref: 3f1214134169
Ref: library/urllib request module-urllib request14134169
Ref: 11114134169
Ref: library/urllib request translation-repo14134169
Ref: 3f1314134169
Ref: library/urllib request urllib-request-extensible-library-for-opening-urls14134169
Ref: 3f1414134169
Ref: library/urllib request urllib request urlopen14135368
Ref: 30714135368
Ref: library/urllib request urllib request install_opener14139807
Ref: 3f1a14139807
Ref: library/urllib request urllib request build_opener14140552
Ref: 30914140552
Ref: library/urllib request urllib request pathname2url14141960
Ref: 2bf14141960
Ref: library/urllib request urllib request url2pathname14143111
Ref: 2bd14143111
Ref: library/urllib request urllib request getproxies14145040
Ref: 3f1514145040
Ref: library/urllib request urllib request Request14146518
Ref: 11da14146518
Ref: library/urllib request urllib request OpenerDirector14152159
Ref: 3f1814152159
Ref: library/urllib request urllib request BaseHandler14152490
Ref: 3f1b14152490
Ref: library/urllib request urllib request HTTPDefaultErrorHandler14152759
Ref: 3f1c14152759
Ref: library/urllib request urllib request HTTPRedirectHandler14153005
Ref: 3f1d14153005
Ref: library/urllib request urllib request HTTPCookieProcessor14153114
Ref: 3f2214153114
Ref: library/urllib request urllib request ProxyHandler14153237
Ref: 1db514153237
Ref: library/urllib request urllib request HTTPPasswordMgr14154716
Ref: 3f2314154716
Ref: library/urllib request urllib request HTTPPasswordMgrWithDefaultRealm14154869
Ref: 3f2414154869
Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth14155170
Ref: 109414155170
Ref: library/urllib request urllib request AbstractBasicAuthHandler14155619
Ref: 1c6f14155619
Ref: library/urllib request urllib request HTTPBasicAuthHandler14157302
Ref: 3f2714157302
Ref: library/urllib request urllib request ProxyBasicAuthHandler14157899
Ref: 3f2814157899
Ref: library/urllib request urllib request AbstractDigestAuthHandler14158367
Ref: 1d6b14158367
Ref: library/urllib request urllib request HTTPDigestAuthHandler14159071
Ref: 3f2914159071
Ref: library/urllib request urllib request ProxyDigestAuthHandler14160100
Ref: 3f2a14160100
Ref: library/urllib request urllib request HTTPHandler14160569
Ref: ef814160569
Ref: library/urllib request urllib request HTTPSHandler14160650
Ref: 143c14160650
Ref: library/urllib request urllib request FileHandler14161020
Ref: 3f1f14161020
Ref: library/urllib request urllib request DataHandler14161112
Ref: 11d914161112
Ref: library/urllib request urllib request FTPHandler14161217
Ref: 3f1e14161217
Ref: library/urllib request urllib request CacheFTPHandler14161296
Ref: 1a9914161296
Ref: library/urllib request urllib request UnknownHandler14161502
Ref: 3f1914161502
Ref: library/urllib request urllib request HTTPErrorProcessor14161647
Ref: 3f2014161647
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-114162851
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-214162925
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-314162976
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-414163045
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-514163104
Ref: urllib request --- URL を開くための大規模なライブラリ-Footnote-614163163
Node: Request オブジェクト14163222
Ref: library/urllib request id114163395
Ref: 3f2b14163395
Ref: library/urllib request request-objects14163395
Ref: 3f2c14163395
Ref: library/urllib request urllib request Request full_url14163792
Ref: 11dc14163792
Ref: library/urllib request urllib request Request type14164169
Ref: 3f2d14164169
Ref: library/urllib request urllib request Request host14164230
Ref: 3f2e14164230
Ref: library/urllib request urllib request Request origin_req_host14164417
Ref: 3f2f14164417
Ref: library/urllib request urllib request Request selector14164560
Ref: 3f3014164560
Ref: library/urllib request urllib request Request data14164762
Ref: 11dd14164762
Ref: library/urllib request urllib request Request unverifiable14165174
Ref: 3f3114165174
Ref: library/urllib request urllib request Request method14165349
Ref: 11db14165349
Ref: library/urllib request urllib request Request get_method14166210
Ref: 138114166210
Ref: library/urllib request urllib request Request add_header14166784
Ref: 3f2114166784
Ref: library/urllib request urllib request Request add_unredirected_header14167821
Ref: 3f3214167821
Ref: library/urllib request urllib request Request has_header14167992
Ref: 3f3314167992
Ref: library/urllib request urllib request Request remove_header14168215
Ref: 11df14168215
Ref: library/urllib request urllib request Request get_full_url14168463
Ref: 3f3414168463
Ref: library/urllib request urllib request Request set_proxy14168667
Ref: 3f3514168667
Ref: library/urllib request urllib request Request get_header14169019
Ref: 3f3614169019
Ref: library/urllib request urllib request Request header_items14169216
Ref: 3f3714169216
Ref: Request オブジェクト-Footnote-114169648
Node: OpenerDirector オブジェクト14169707
Ref: library/urllib request opener-director-objects14169919
Ref: 3f3814169919
Ref: library/urllib request openerdirector-objects14169919
Ref: 3f3914169919
Ref: library/urllib request urllib request OpenerDirector add_handler14170094
Ref: 3f3a14170094
Ref: library/urllib request urllib request OpenerDirector open14171992
Ref: 11de14171992
Ref: library/urllib request urllib request OpenerDirector error14172906
Ref: 3f3f14172906
Node: BaseHandler オブジェクト14175359
Ref: library/urllib request base-handler-objects14175583
Ref: 3f4214175583
Ref: library/urllib request basehandler-objects14175583
Ref: 3f4314175583
Ref: library/urllib request urllib request BaseHandler add_parent14175917
Ref: 3f4414175917
Ref: library/urllib request urllib request BaseHandler close14176047
Ref: 3f4514176047
Ref: library/urllib request urllib request BaseHandler parent14176538
Ref: 3f4614176538
Ref: library/urllib request urllib request BaseHandler default_open14176749
Ref: 3f4014176749
Ref: library/urllib request protocol-open14177733
Ref: 3f3b14177733
Ref: library/urllib request urllib request BaseHandler unknown_open14178222
Ref: 3f4114178222
Ref: library/urllib request urllib request BaseHandler http_error_default14178789
Ref: 3f4714178789
Ref: library/urllib request http-error-nnn14179853
Ref: 3f3c14179853
Ref: library/urllib request protocol-request14180612
Ref: 3f3d14180612
Ref: library/urllib request protocol-response14181228
Ref: 3f3e14181228
Node: HTTPRedirectHandler オブジェクト14182075
Ref: library/urllib request http-redirect-handler14182304
Ref: 3f4814182304
Ref: library/urllib request httpredirecthandler-objects14182304
Ref: 3f4914182304
Ref: library/urllib request urllib request HTTPRedirectHandler redirect_request14182988
Ref: 3f4a14182988
Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30114184457
Ref: 3f4b14184457
Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30214184829
Ref: 3f4c14184829
Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30314185043
Ref: 3f4d14185043
Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30714185261
Ref: 3f4e14185261
Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30814185537
Ref: 3f4f14185537
Ref: HTTPRedirectHandler オブジェクト-Footnote-114185878
Ref: HTTPRedirectHandler オブジェクト-Footnote-214185937
Ref: HTTPRedirectHandler オブジェクト-Footnote-314185996
Node: HTTPCookieProcessor オブジェクト14186055
Ref: library/urllib request http-cookie-processor14186285
Ref: 3f5014186285
Ref: library/urllib request httpcookieprocessor-objects14186285
Ref: 3f5114186285
Ref: library/urllib request urllib request HTTPCookieProcessor cookiejar14186469
Ref: 3f5214186469
Node: ProxyHandler オブジェクト14186619
Ref: library/urllib request proxy-handler14186845
Ref: 3f5414186845
Ref: library/urllib request proxyhandler-objects14186845
Ref: 3f5514186845
Node: HTTPPasswordMgr オブジェクト14187530
Ref: library/urllib request http-password-mgr14187765
Ref: 3f2514187765
Ref: library/urllib request httppasswordmgr-objects14187765
Ref: 3f5614187765
Ref: library/urllib request urllib request HTTPPasswordMgr add_password14188001
Ref: 3f5714188001
Ref: library/urllib request urllib request HTTPPasswordMgr find_user_password14188461
Ref: 1bd614188461
Node: HTTPPasswordMgrWithPriorAuth オブジェクト14189043
Ref: library/urllib request http-password-mgr-with-prior-auth14189290
Ref: 3f2614189290
Ref: library/urllib request httppasswordmgrwithpriorauth-objects14189290
Ref: 3f5814189290
Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth add_password14189618
Ref: 3f5914189618
Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth find_user_password14190114
Ref: 3f5a14190114
Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth update_authenticated14190335
Ref: 3f5b14190335
Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth is_authenticated14190562
Ref: 1bd714190562
Node: AbstractBasicAuthHandler オブジェクト14190752
Ref: library/urllib request abstract-basic-auth-handler14191004
Ref: 3f5c14191004
Ref: library/urllib request abstractbasicauthhandler-objects14191004
Ref: 3f5d14191004
Ref: library/urllib request urllib request AbstractBasicAuthHandler http_error_auth_reqed14191105
Ref: 3f5e14191105
Node: HTTPBasicAuthHandler オブジェクト14192167
Ref: library/urllib request http-basic-auth-handler14192412
Ref: 3f5f14192412
Ref: library/urllib request httpbasicauthhandler-objects14192412
Ref: 3f6014192412
Ref: library/urllib request urllib request HTTPBasicAuthHandler http_error_40114192507
Ref: 3f6114192507
Node: ProxyBasicAuthHandler オブジェクト14192696
Ref: library/urllib request proxy-basic-auth-handler14192942
Ref: 3f6214192942
Ref: library/urllib request proxybasicauthhandler-objects14192942
Ref: 3f6314192942
Ref: library/urllib request urllib request ProxyBasicAuthHandler http_error_40714193039
Ref: 3f6414193039
Node: AbstractDigestAuthHandler オブジェクト14193229
Ref: library/urllib request abstract-digest-auth-handler14193476
Ref: 3f6514193476
Ref: library/urllib request abstractdigestauthhandler-objects14193476
Ref: 3f6614193476
Ref: library/urllib request urllib request AbstractDigestAuthHandler http_error_auth_reqed14193581
Ref: 3f6714193581
Node: HTTPDigestAuthHandler オブジェクト14194020
Ref: library/urllib request http-digest-auth-handler14194268
Ref: 3f6814194268
Ref: library/urllib request httpdigestauthhandler-objects14194268
Ref: 3f6914194268
Ref: library/urllib request urllib request HTTPDigestAuthHandler http_error_40114194365
Ref: 3f6a14194365
Node: ProxyDigestAuthHandler オブジェクト14194555
Ref: library/urllib request proxy-digest-auth-handler14194789
Ref: 3f6b14194789
Ref: library/urllib request proxydigestauthhandler-objects14194789
Ref: 3f6c14194789
Ref: library/urllib request urllib request ProxyDigestAuthHandler http_error_40714194888
Ref: 3f6d14194888
Node: HTTPHandler オブジェクト14195079
Ref: library/urllib request http-handler-objects14195304
Ref: 3f6e14195304
Ref: library/urllib request httphandler-objects14195304
Ref: 3f6f14195304
Ref: library/urllib request urllib request HTTPHandler http_open14195381
Ref: 3f7014195381
Node: HTTPSHandler オブジェクト14195578
Ref: library/urllib request https-handler-objects14195792
Ref: 3f7114195792
Ref: library/urllib request httpshandler-objects14195792
Ref: 3f7214195792
Ref: library/urllib request urllib request HTTPSHandler https_open14195871
Ref: 3f7314195871
Node: FileHandler オブジェクト14196070
Ref: library/urllib request file-handler-objects14196284
Ref: 3f7414196284
Ref: library/urllib request filehandler-objects14196284
Ref: 3f7514196284
Ref: library/urllib request urllib request FileHandler file_open14196361
Ref: 3f7614196361
Node: DataHandler オブジェクト14196792
Ref: library/urllib request data-handler-objects14197004
Ref: 3f7714197004
Ref: library/urllib request datahandler-objects14197004
Ref: 3f7814197004
Ref: library/urllib request urllib request DataHandler data_open14197081
Ref: 3f7914197081
Ref: DataHandler オブジェクト-Footnote-114197643
Node: FTPHandler オブジェクト14197702
Ref: library/urllib request ftp-handler-objects14197918
Ref: 3f7a14197918
Ref: library/urllib request ftphandler-objects14197918
Ref: 3f7b14197918
Ref: library/urllib request urllib request FTPHandler ftp_open14197993
Ref: 3f7c14197993
Node: CacheFTPHandler オブジェクト14198215
Ref: library/urllib request cacheftp-handler-objects14198434
Ref: 3f7d14198434
Ref: library/urllib request cacheftphandler-objects14198434
Ref: 3f7e14198434
Ref: library/urllib request urllib request CacheFTPHandler setTimeout14198667
Ref: 3f7f14198667
Ref: library/urllib request urllib request CacheFTPHandler setMaxConns14198783
Ref: 3f8014198783
Node: UnknownHandler オブジェクト14198915
Ref: library/urllib request unknown-handler-objects14199142
Ref: 3f8114199142
Ref: library/urllib request unknownhandler-objects14199142
Ref: 3f8214199142
Ref: library/urllib request urllib request UnknownHandler unknown_open14199225
Ref: 3f8314199225
Node: HTTPErrorProcessor オブジェクト14199330
Ref: library/urllib request http-error-processor-objects14199536
Ref: 3f8414199536
Ref: library/urllib request httperrorprocessor-objects14199536
Ref: 3f8514199536
Ref: library/urllib request urllib request HTTPErrorProcessor http_response14199627
Ref: 3f8614199627
Ref: library/urllib request urllib request HTTPErrorProcessor https_response14200230
Ref: 3f8714200230
Node: 使用例<37>14200425
Ref: library/urllib request examples14200637
Ref: 3f8814200637
Ref: library/urllib request urllib-request-examples14200637
Ref: 3f8914200637
Ref: library/urllib request urllib-examples14207372
Ref: 3f8b14207372
Node: レガシーインターフェース<2>14209159
Ref: library/urllib request legacy-interface14209361
Ref: 3f8c14209361
Ref: library/urllib request urllib request urlretrieve14209665
Ref: 30814209665
Ref: library/urllib request urllib request urlcleanup14212896
Ref: 1dbc14212896
Node: urllib request Restrictions14213095
Ref: library/urllib request urllib-request-restrictions14213275
Ref: 3f8e14213275
Node: urllib response --- Response classes used by urllib14216627
Ref: library/urllib request module-urllib response14216903
Ref: 11214216903
Ref: library/urllib request urllib-response-response-classes-used-by-urllib14216903
Ref: 3f8f14216903
Ref: library/urllib request urllib response addinfourl14217354
Ref: 3f1614217354
Ref: library/urllib request urllib response addinfourl url14217397
Ref: 18e814217397
Ref: library/urllib request urllib response addinfourl headers14217575
Ref: 3f9014217575
Ref: library/urllib request urllib response addinfourl status14217714
Ref: 3f9114217714
Ref: library/urllib request urllib response addinfourl geturl14217838
Ref: 3f9214217838
Ref: library/urllib request urllib response addinfourl info14218004
Ref: 3f9314218004
Ref: library/urllib request urllib response addinfourl code14218171
Ref: 3f9414218171
Ref: library/urllib request urllib response addinfourl getcode14218331
Ref: 3f9514218331
Node: urllib parse --- URL を構成要素に解析する14218500
Ref: library/urllib parse doc14218782
Ref: 3f9614218782
Ref: library/urllib parse module-urllib parse14218782
Ref: 11014218782
Ref: library/urllib parse translation-repo14218782
Ref: 3f9714218782
Ref: library/urllib parse urllib-parse-parse-urls-into-components14218782
Ref: 3f9814218782
Ref: urllib parse --- URL を構成要素に解析する-Footnote-114221033
Ref: urllib parse --- URL を構成要素に解析する-Footnote-214221105
Ref: urllib parse --- URL を構成要素に解析する-Footnote-314221164
Node: URL の解析14221223
Ref: library/urllib parse url-parsing14221353
Ref: 3f9914221353
Ref: library/urllib parse urllib parse urlsplit14221562
Ref: f3a14221562
Ref: library/urllib parse urllib parse parse_qs14230138
Ref: 31f14230138
Ref: library/urllib parse urllib parse parse_qsl14232985
Ref: 31e14232985
Ref: library/urllib parse urllib parse urlunsplit14235482
Ref: 193e14235482
Ref: library/urllib parse urllib parse urlparse14235886
Ref: 36214235886
Ref: library/urllib parse urllib parse urlunparse14236808
Ref: 193f14236808
Ref: library/urllib parse urllib parse urljoin14237252
Ref: 109614237252
Ref: library/urllib parse urllib parse urldefrag14239144
Ref: 145f14239144
Ref: library/urllib parse urllib parse unwrap14240790
Ref: 3fa014240790
Ref: URL の解析-Footnote-114241139
Ref: URL の解析-Footnote-214241198
Ref: URL の解析-Footnote-314241260
Ref: URL の解析-Footnote-414241319
Ref: URL の解析-Footnote-514241378
Ref: URL の解析-Footnote-614241437
Ref: URL の解析-Footnote-714241496
Ref: URL の解析-Footnote-814241555
Node: URL parsing security14241614
Ref: library/urllib parse id114241795
Ref: 3fa114241795
Ref: library/urllib parse url-parsing-security14241795
Ref: 3f9d14241795
Ref: URL parsing security-Footnote-114243253
Ref: URL parsing security-Footnote-214243315
Node: ASCII エンコードバイト列の解析14243374
Ref: library/urllib parse id214243572
Ref: 3fa214243572
Ref: library/urllib parse parsing-ascii-encoded-bytes14243572
Ref: 146114243572
Node: 構造化された解析結果14246172
Ref: library/urllib parse structured-parse-results14246369
Ref: 3fa314246369
Ref: library/urllib parse urlparse-result-object14246369
Ref: 3f9c14246369
Ref: library/urllib parse urllib parse urllib parse SplitResult geturl14246788
Ref: 3fa414246788
Ref: library/urllib parse urllib parse DefragResult14248090
Ref: 3fa514248090
Ref: library/urllib parse urllib parse ParseResult14248397
Ref: 3f9e14248397
Ref: library/urllib parse urllib parse SplitResult14248714
Ref: 3f9a14248714
Ref: library/urllib parse urllib parse DefragResultBytes14249177
Ref: 3fa614249177
Ref: library/urllib parse urllib parse ParseResultBytes14249487
Ref: 3f9f14249487
Ref: library/urllib parse urllib parse SplitResultBytes14249826
Ref: 3f9b14249826
Node: URL のクオート14250166
Ref: library/urllib parse url-quoting14250312
Ref: 3fa714250312
Ref: library/urllib parse urllib parse quote14250763
Ref: d9c14250763
Ref: library/urllib parse urllib parse quote_plus14252392
Ref: 146014252392
Ref: library/urllib parse urllib parse quote_from_bytes14252903
Ref: 1b5114252903
Ref: library/urllib parse urllib parse unquote14253259
Ref: 1afb14253259
Ref: library/urllib parse urllib parse unquote_plus14254224
Ref: 3fa814254224
Ref: library/urllib parse urllib parse unquote_to_bytes14254636
Ref: 1afc14254636
Ref: library/urllib parse urllib parse urlencode14255210
Ref: 109514255210
Ref: URL のクオート-Footnote-114260267
Ref: URL のクオート-Footnote-214260326
Ref: URL のクオート-Footnote-314260385
Ref: URL のクオート-Footnote-414260422
Ref: URL のクオート-Footnote-514260481
Ref: URL のクオート-Footnote-614260540
Ref: URL のクオート-Footnote-714260599
Ref: URL のクオート-Footnote-814260658
Ref: URL のクオート-Footnote-914260717
Node: urllib error --- urllib request によって送出される例外クラス14260776
Ref: library/urllib error doc14261059
Ref: 3fa914261059
Ref: library/urllib error module-urllib error14261059
Ref: 10f14261059
Ref: library/urllib error translation-repo14261059
Ref: 3faa14261059
Ref: library/urllib error urllib-error-exception-classes-raised-by-urllib-request14261059
Ref: 3fab14261059
Ref: library/urllib error urllib error URLError14261568
Ref: 2be14261568
Ref: library/urllib error urllib error URLError reason14261823
Ref: 3fac14261823
Ref: library/urllib error urllib error HTTPError14262173
Ref: 11e014262173
Ref: library/urllib error urllib error HTTPError url14262632
Ref: 3fad14262632
Ref: library/urllib error urllib error HTTPError code14262752
Ref: 3fae14262752
Ref: library/urllib error urllib error HTTPError reason14263028
Ref: 3fb014263028
Ref: library/urllib error urllib error HTTPError headers14263194
Ref: 11e114263194
Ref: library/urllib error urllib error HTTPError fp14263421
Ref: 3fb114263421
Ref: library/urllib error urllib error ContentTooShortError14263557
Ref: 3f8d14263557
Ref: library/urllib error urllib error ContentTooShortError content14263863
Ref: 3fb214263863
Ref: urllib error --- urllib request によって送出される例外クラス-Footnote-114264019
Ref: urllib error --- urllib request によって送出される例外クラス-Footnote-214264091
Node: urllib robotparser --- robots txt 用のパーサー14264150
Ref: library/urllib robotparser doc14264414
Ref: 3fb314264414
Ref: library/urllib robotparser module-urllib robotparser14264414
Ref: 11314264414
Ref: library/urllib robotparser translation-repo14264414
Ref: 3fb414264414
Ref: library/urllib robotparser urllib-robotparser-parser-for-robots-txt14264414
Ref: 3fb514264414
Ref: library/urllib robotparser urllib robotparser RobotFileParser14264971
Ref: efa14264971
Ref: library/urllib robotparser urllib robotparser RobotFileParser set_url14265152
Ref: 3fb614265152
Ref: library/urllib robotparser urllib robotparser RobotFileParser read14265281
Ref: 18d114265281
Ref: library/urllib robotparser urllib robotparser RobotFileParser parse14265394
Ref: 1e8314265394
Ref: library/urllib robotparser urllib robotparser RobotFileParser can_fetch14265489
Ref: 3fb714265489
Ref: library/urllib robotparser urllib robotparser RobotFileParser mtime14265756
Ref: 3fb814265756
Ref: library/urllib robotparser urllib robotparser RobotFileParser modified14266085
Ref: 3fb914266085
Ref: library/urllib robotparser urllib robotparser RobotFileParser crawl_delay14266242
Ref: 3fba14266242
Ref: library/urllib robotparser urllib robotparser RobotFileParser request_rate14266777
Ref: 3fbb14266777
Ref: library/urllib robotparser urllib robotparser RobotFileParser site_maps14267349
Ref: 1e2214267349
Ref: urllib robotparser --- robots txt 用のパーサー-Footnote-114268320
Node: http --- HTTP モジュール群14268399
Ref: library/http doc14268643
Ref: 3fbc14268643
Ref: library/http http-http-modules14268643
Ref: 3fbd14268643
Ref: library/http module-http14268643
Ref: 7214268643
Ref: library/http translation-repo14268643
Ref: 3fbe14268643
Ref: library/http http HTTPStatus14269599
Ref: afc14269599
Ref: http --- HTTP モジュール群-Footnote-114270429
Node: HTTP ステータスコード14270502
Ref: library/http http-status-codes14270650
Ref: 3fbf14270650
Ref: library/http id114270650
Ref: 3fc014270650
Ref: HTTP ステータスコード-Footnote-114285172
Ref: HTTP ステータスコード-Footnote-214285256
Ref: HTTP ステータスコード-Footnote-314285315
Ref: HTTP ステータスコード-Footnote-414285374
Ref: HTTP ステータスコード-Footnote-514285433
Ref: HTTP ステータスコード-Footnote-614285492
Ref: HTTP ステータスコード-Footnote-714285551
Ref: HTTP ステータスコード-Footnote-814285610
Ref: HTTP ステータスコード-Footnote-914285669
Ref: HTTP ステータスコード-Footnote-1014285728
Ref: HTTP ステータスコード-Footnote-1114285788
Ref: HTTP ステータスコード-Footnote-1214285848
Ref: HTTP ステータスコード-Footnote-1314285908
Ref: HTTP ステータスコード-Footnote-1414285968
Ref: HTTP ステータスコード-Footnote-1514286028
Ref: HTTP ステータスコード-Footnote-1614286088
Ref: HTTP ステータスコード-Footnote-1714286148
Ref: HTTP ステータスコード-Footnote-1814286208
Ref: HTTP ステータスコード-Footnote-1914286268
Ref: HTTP ステータスコード-Footnote-2014286328
Ref: HTTP ステータスコード-Footnote-2114286388
Ref: HTTP ステータスコード-Footnote-2214286448
Ref: HTTP ステータスコード-Footnote-2314286508
Ref: HTTP ステータスコード-Footnote-2414286568
Ref: HTTP ステータスコード-Footnote-2514286628
Ref: HTTP ステータスコード-Footnote-2614286688
Ref: HTTP ステータスコード-Footnote-2714286748
Ref: HTTP ステータスコード-Footnote-2814286808
Ref: HTTP ステータスコード-Footnote-2914286868
Ref: HTTP ステータスコード-Footnote-3014286928
Ref: HTTP ステータスコード-Footnote-3114286988
Ref: HTTP ステータスコード-Footnote-3214287048
Ref: HTTP ステータスコード-Footnote-3314287108
Ref: HTTP ステータスコード-Footnote-3414287168
Ref: HTTP ステータスコード-Footnote-3514287228
Ref: HTTP ステータスコード-Footnote-3614287288
Ref: HTTP ステータスコード-Footnote-3714287348
Ref: HTTP ステータスコード-Footnote-3814287408
Ref: HTTP ステータスコード-Footnote-3914287468
Ref: HTTP ステータスコード-Footnote-4014287528
Ref: HTTP ステータスコード-Footnote-4114287588
Ref: HTTP ステータスコード-Footnote-4214287648
Ref: HTTP ステータスコード-Footnote-4314287708
Ref: HTTP ステータスコード-Footnote-4414287768
Ref: HTTP ステータスコード-Footnote-4514287828
Ref: HTTP ステータスコード-Footnote-4614287888
Ref: HTTP ステータスコード-Footnote-4714287948
Ref: HTTP ステータスコード-Footnote-4814288008
Ref: HTTP ステータスコード-Footnote-4914288068
Ref: HTTP ステータスコード-Footnote-5014288128
Ref: HTTP ステータスコード-Footnote-5114288188
Ref: HTTP ステータスコード-Footnote-5214288248
Ref: HTTP ステータスコード-Footnote-5314288308
Ref: HTTP ステータスコード-Footnote-5414288368
Ref: HTTP ステータスコード-Footnote-5514288428
Ref: HTTP ステータスコード-Footnote-5614288488
Ref: HTTP ステータスコード-Footnote-5714288548
Ref: HTTP ステータスコード-Footnote-5814288608
Ref: HTTP ステータスコード-Footnote-5914288668
Ref: HTTP ステータスコード-Footnote-6014288728
Ref: HTTP ステータスコード-Footnote-6114288788
Ref: HTTP ステータスコード-Footnote-6214288848
Ref: HTTP ステータスコード-Footnote-6314288908
Node: HTTP ステータスコードカテゴリ14288968
Ref: library/http http-status-category14289142
Ref: 3fc114289142
Ref: library/http http HTTPMethod14290824
Ref: 3fc214290824
Ref: HTTP ステータスコードカテゴリ-Footnote-114291675
Ref: HTTP ステータスコードカテゴリ-Footnote-214291734
Ref: HTTP ステータスコードカテゴリ-Footnote-314291793
Ref: HTTP ステータスコードカテゴリ-Footnote-414291852
Ref: HTTP ステータスコードカテゴリ-Footnote-514291911
Node: HTTP メソッド14291970
Ref: library/http http-methods14292106
Ref: 3fc314292106
Ref: library/http id214292106
Ref: 3fc414292106
Ref: HTTP メソッド-Footnote-114294535
Ref: HTTP メソッド-Footnote-214294608
Ref: HTTP メソッド-Footnote-314294667
Ref: HTTP メソッド-Footnote-414294726
Ref: HTTP メソッド-Footnote-514294785
Ref: HTTP メソッド-Footnote-614294844
Ref: HTTP メソッド-Footnote-714294903
Ref: HTTP メソッド-Footnote-814294962
Ref: HTTP メソッド-Footnote-914295021
Ref: HTTP メソッド-Footnote-1014295080
Node: http client --- HTTP プロトコルクライアント14295140
Ref: library/http client doc14295380
Ref: 3fc514295380
Ref: library/http client http-client-http-protocol-client14295380
Ref: 3fc614295380
Ref: library/http client module-http client14295380
Ref: 7314295380
Ref: library/http client translation-repo14295380
Ref: 3fc714295380
Ref: library/http client http client HTTPConnection14296598
Ref: d3514296598
Ref: library/http client http client HTTPSConnection14298678
Ref: d3614298678
Ref: library/http client http client HTTPResponse14300851
Ref: 12e514300851
Ref: library/http client http client parse_headers14301393
Ref: 1e2814301393
Ref: library/http client http client HTTPException14302356
Ref: 3fcb14302356
Ref: library/http client http client NotConnected14302538
Ref: 3fcc14302538
Ref: library/http client http client InvalidURL14302634
Ref: 3fcd14302634
Ref: library/http client http client UnknownProtocol14302887
Ref: 3fce14302887
Ref: library/http client http client UnknownTransferEncoding14302986
Ref: 3fcf14302986
Ref: library/http client http client UnimplementedFileMode14303093
Ref: 3fd014303093
Ref: library/http client http client IncompleteRead14303198
Ref: 3fd114303198
Ref: library/http client http client ImproperConnectionState14303296
Ref: 3fd214303296
Ref: library/http client http client CannotSendRequest14303403
Ref: 3fd314303403
Ref: library/http client http client CannotSendHeader14303517
Ref: 3fd414303517
Ref: library/http client http client ResponseNotReady14303630
Ref: 3fd514303630
Ref: library/http client http client BadStatusLine14303743
Ref: 3fd614303743
Ref: library/http client http client LineTooLong14303944
Ref: 3fd714303944
Ref: library/http client http client RemoteDisconnected14304119
Ref: 100a14304119
Ref: library/http client http client HTTP_PORT14304634
Ref: 3fd814304634
Ref: library/http client http client HTTPS_PORT14304751
Ref: 3fd914304751
Ref: library/http client http client responses14304871
Ref: 3fda14304871
Ref: http client --- HTTP プロトコルクライアント-Footnote-114305454
Ref: http client --- HTTP プロトコルクライアント-Footnote-214305525
Ref: http client --- HTTP プロトコルクライアント-Footnote-314305576
Node: HTTPConnection オブジェクト14305635
Ref: library/http client httpconnection-objects14305799
Ref: 3fdb14305799
Ref: library/http client id114305799
Ref: 3fdc14305799
Ref: library/http client http client HTTPConnection request14305972
Ref: ea714305972
Ref: library/http client http client HTTPConnection getresponse14309859
Ref: 100914309859
Ref: library/http client http client HTTPConnection set_debuglevel14310526
Ref: 3fde14310526
Ref: library/http client http client HTTPConnection set_tunnel14310936
Ref: 144014310936
Ref: library/http client http client HTTPConnection get_proxy_response_headers14312678
Ref: 1a7314312678
Ref: library/http client http client HTTPConnection connect14312965
Ref: 3fdf14312965
Ref: library/http client http client HTTPConnection close14313327
Ref: 3fdd14313327
Ref: library/http client http client HTTPConnection blocksize14313416
Ref: 3fe014313416
Ref: library/http client http client HTTPConnection putrequest14313708
Ref: 3fe114313708
Ref: library/http client http client HTTPConnection putheader14314389
Ref: 3fe214314389
Ref: library/http client http client HTTPConnection endheaders14314801
Ref: ea814314801
Ref: library/http client http client HTTPConnection send14316250
Ref: 3fe314316250
Ref: HTTPConnection オブジェクト-Footnote-114316678
Ref: HTTPConnection オブジェクト-Footnote-214316751
Ref: HTTPConnection オブジェクト-Footnote-314316824
Ref: HTTPConnection オブジェクト-Footnote-414316897
Ref: HTTPConnection オブジェクト-Footnote-514316965
Ref: HTTPConnection オブジェクト-Footnote-614317023
Node: HTTPResponse オブジェクト14317082
Ref: library/http client httpresponse-objects14317268
Ref: 3fe414317268
Ref: library/http client id214317268
Ref: 3fe514317268
Ref: library/http client http client HTTPResponse read14317841
Ref: 18af14317841
Ref: library/http client http client HTTPResponse readinto14317971
Ref: 12e614317971
Ref: library/http client http client HTTPResponse getheader14318208
Ref: 3fe614318208
Ref: library/http client http client HTTPResponse getheaders14318597
Ref: 3fe714318597
Ref: library/http client http client HTTPResponse fileno14318717
Ref: 3fe814318717
Ref: library/http client http client HTTPResponse msg14318813
Ref: 3fc914318813
Ref: library/http client http client HTTPResponse version14319032
Ref: 3fe914319032
Ref: library/http client http client HTTPResponse url14319207
Ref: 3fea14319207
Ref: library/http client http client HTTPResponse headers14319383
Ref: 3feb14319383
Ref: library/http client http client HTTPResponse status14319522
Ref: 3fec14319522
Ref: library/http client http client HTTPResponse reason14319616
Ref: 3f1714319616
Ref: library/http client http client HTTPResponse debuglevel14319713
Ref: 3fed14319713
Ref: library/http client http client HTTPResponse closed14319908
Ref: 3fee14319908
Ref: library/http client http client HTTPResponse geturl14320020
Ref: 3fef14320020
Ref: library/http client http client HTTPResponse info14320184
Ref: 3ff014320184
Ref: library/http client http client HTTPResponse getcode14320350
Ref: 3ff114320350
Node: 使用例<38>14320518
Ref: library/http client examples14320701
Ref: 3ff214320701
Node: HTTPMessage オブジェクト14323665
Ref: library/http client httpmessage-objects14323808
Ref: 3ff314323808
Ref: library/http client id314323808
Ref: 3ff414323808
Ref: library/http client http client HTTPMessage14323885
Ref: 3fc814323885
Node: ftplib --- FTP プロトコルクライアント14324151
Ref: library/ftplib doc14324408
Ref: 3ff514324408
Ref: library/ftplib ftplib-ftp-protocol-client14324408
Ref: 3ff614324408
Ref: library/ftplib module-ftplib14324408
Ref: 6214324408
Ref: library/ftplib translation-repo14324408
Ref: 3ff714324408
Ref: ftplib --- FTP プロトコルクライアント-Footnote-114326598
Ref: ftplib --- FTP プロトコルクライアント-Footnote-214326664
Ref: ftplib --- FTP プロトコルクライアント-Footnote-314326722
Node: リファレンス<7>14326781
Ref: library/ftplib ftplib-reference14326887
Ref: 3ff814326887
Ref: library/ftplib reference14326887
Ref: 3ff914326887
Node: FTP オブジェクト14327034
Ref: library/ftplib ftp-objects14327149
Ref: 3ffa14327149
Ref: library/ftplib id114327149
Ref: 3ffb14327149
Ref: library/ftplib ftplib FTP14327210
Ref: af614327210
Ref: library/ftplib ftplib FTP set_debuglevel14330182
Ref: 3ffd14330182
Ref: library/ftplib ftplib FTP connect14330743
Ref: 3ffc14330743
Ref: library/ftplib ftplib FTP getwelcome14332180
Ref: 3ffe14332180
Ref: library/ftplib ftplib FTP login14332489
Ref: 3fff14332489
Ref: library/ftplib ftplib FTP abort14333533
Ref: 400014333533
Ref: library/ftplib ftplib FTP sendcmd14333742
Ref: 400114333742
Ref: library/ftplib ftplib FTP voidcmd14334049
Ref: 400214334049
Ref: library/ftplib ftplib FTP retrbinary14334482
Ref: 400414334482
Ref: library/ftplib ftplib FTP retrlines14335544
Ref: 400614335544
Ref: library/ftplib ftplib FTP set_pasv14336287
Ref: 400714336287
Ref: library/ftplib ftplib FTP storbinary14336501
Ref: 152114336501
Ref: library/ftplib ftplib FTP storlines14337683
Ref: 400814337683
Ref: library/ftplib ftplib FTP transfercmd14338187
Ref: 400514338187
Ref: library/ftplib ftplib FTP ntransfercmd14339492
Ref: 400914339492
Ref: library/ftplib ftplib FTP mlsd14339885
Ref: 12d914339885
Ref: library/ftplib ftplib FTP nlst14340646
Ref: 12da14340646
Ref: library/ftplib ftplib FTP dir14341190
Ref: 12db14341190
Ref: library/ftplib ftplib FTP rename14341895
Ref: 400a14341895
Ref: library/ftplib ftplib FTP delete14342059
Ref: 400b14342059
Ref: library/ftplib ftplib FTP cwd14342405
Ref: 400d14342405
Ref: library/ftplib ftplib FTP mkd14342519
Ref: 400e14342519
Ref: library/ftplib ftplib FTP pwd14342630
Ref: 400f14342630
Ref: library/ftplib ftplib FTP rmd14342745
Ref: 401014342745
Ref: library/ftplib ftplib FTP size14342860
Ref: 401114342860
Ref: library/ftplib ftplib FTP quit14343275
Ref: 401214343275
Ref: library/ftplib ftplib FTP close14343828
Ref: 401314343828
Ref: FTP オブジェクト-Footnote-114344444
Ref: FTP オブジェクト-Footnote-214344502
Ref: FTP オブジェクト-Footnote-314344561
Ref: FTP オブジェクト-Footnote-414344619
Node: FTP_TLS オブジェクト14344678
Ref: library/ftplib ftp-tls-objects14344823
Ref: 401414344823
Ref: library/ftplib ftplib FTP_TLS14344892
Ref: af714344892
Ref: library/ftplib ftplib FTP_TLS ssl_version14348694
Ref: 401614348694
Ref: library/ftplib ftplib FTP_TLS auth14348819
Ref: 401714348819
Ref: library/ftplib ftplib FTP_TLS ccc14349265
Ref: 12d814349265
Ref: library/ftplib ftplib FTP_TLS prot_p14349530
Ref: 401514349530
Ref: library/ftplib ftplib FTP_TLS prot_c14349636
Ref: 401814349636
Ref: FTP_TLS オブジェクト-Footnote-114349772
Ref: FTP_TLS オブジェクト-Footnote-214349831
Ref: FTP_TLS オブジェクト-Footnote-314349889
Node: モジュール変数14349948
Ref: library/ftplib module-variables14350062
Ref: 401914350062
Ref: library/ftplib ftplib error_reply14350120
Ref: 400314350120
Ref: library/ftplib ftplib error_temp14350237
Ref: 401a14350237
Ref: library/ftplib ftplib error_perm14350407
Ref: 400c14350407
Ref: library/ftplib ftplib error_proto14350574
Ref: 401b14350574
Ref: library/ftplib ftplib all_errors14350795
Ref: 401c14350795
Node: poplib --- POP3 プロトコルクライアント14351487
Ref: library/poplib doc14351741
Ref: 401d14351741
Ref: library/poplib module-poplib14351741
Ref: b114351741
Ref: library/poplib poplib-pop3-protocol-client14351741
Ref: 401e14351741
Ref: library/poplib translation-repo14351741
Ref: 401f14351741
Ref: library/poplib poplib POP314353507
Ref: b1d14353507
Ref: library/poplib poplib POP3_SSL14354667
Ref: b1e14354667
Ref: library/poplib poplib error_proto14356649
Ref: 13b414356649
Ref: poplib --- POP3 プロトコルクライアント-Footnote-114357437
Ref: poplib --- POP3 プロトコルクライアント-Footnote-214357503
Ref: poplib --- POP3 プロトコルクライアント-Footnote-314357562
Ref: poplib --- POP3 プロトコルクライアント-Footnote-414357621
Ref: poplib --- POP3 プロトコルクライアント-Footnote-514357680
Node: POP3 オブジェクト14357742
Ref: library/poplib id114357871
Ref: 402014357871
Ref: library/poplib pop3-objects14357871
Ref: 402114357871
Ref: library/poplib poplib POP3 set_debuglevel14358240
Ref: 402214358240
Ref: library/poplib poplib POP3 getwelcome14358774
Ref: 402314358774
Ref: library/poplib poplib POP3 capa14358907
Ref: 117e14358907
Ref: library/poplib poplib POP3 user14359138
Ref: 402414359138
Ref: library/poplib poplib POP3 pass_14359273
Ref: 402514359273
Ref: library/poplib poplib POP3 apop14359569
Ref: 402614359569
Ref: library/poplib poplib POP3 rpop14359724
Ref: 402714359724
Ref: library/poplib poplib POP3 stat14359889
Ref: 402814359889
Ref: library/poplib poplib POP3 list14360078
Ref: 402914360078
Ref: library/poplib poplib POP3 retr14360364
Ref: 402a14360364
Ref: library/poplib poplib POP3 dele14360616
Ref: 402b14360616
Ref: library/poplib poplib POP3 rset14361056
Ref: 402c14361056
Ref: library/poplib poplib POP3 noop14361167
Ref: 402d14361167
Ref: library/poplib poplib POP3 quit14361269
Ref: 13b314361269
Ref: library/poplib poplib POP3 top14361433
Ref: 402e14361433
Ref: library/poplib poplib POP3 uidl14362229
Ref: 402f14362229
Ref: library/poplib poplib POP3 utf814362644
Ref: 104914362644
Ref: library/poplib poplib POP3 stls14362938
Ref: 117f14362938
Ref: POP3 オブジェクト-Footnote-114364024
Ref: POP3 オブジェクト-Footnote-214364083
Ref: POP3 オブジェクト-Footnote-314364142
Node: POP3 の例14364201
Ref: library/poplib id214364330
Ref: 403014364330
Ref: library/poplib pop3-example14364330
Ref: 403114364330
Node: imaplib --- IMAP4 プロトコルクライアント14364913
Ref: library/imaplib doc14365169
Ref: 403214365169
Ref: library/imaplib imaplib-imap4-protocol-client14365169
Ref: 403314365169
Ref: library/imaplib module-imaplib14365169
Ref: 7814365169
Ref: library/imaplib translation-repo14365169
Ref: 403414365169
Ref: library/imaplib imaplib IMAP414366262
Ref: aff14366262
Ref: library/imaplib imaplib IMAP4 error14367534
Ref: 17f714367534
Ref: library/imaplib imaplib IMAP4 abort14367716
Ref: 403514367716
Ref: library/imaplib imaplib IMAP4 readonly14368052
Ref: 403614368052
Ref: library/imaplib imaplib IMAP4_SSL14368613
Ref: b0014368613
Ref: library/imaplib imaplib IMAP4_stream14370232
Ref: b0214370232
Ref: library/imaplib imaplib Internaldate2tuple14370549
Ref: 403714370549
Ref: library/imaplib imaplib Int2AP14370866
Ref: 403814370866
Ref: library/imaplib imaplib ParseFlags14371024
Ref: 403914371024
Ref: library/imaplib imaplib Time2Internaldate14371163
Ref: 403a14371163
Ref: imaplib --- IMAP4 プロトコルクライアント-Footnote-114372684
Ref: imaplib --- IMAP4 プロトコルクライアント-Footnote-214372751
Ref: imaplib --- IMAP4 プロトコルクライアント-Footnote-314372810
Node: IMAP4 オブジェクト14372869
Ref: library/imaplib id114373008
Ref: 403b14373008
Ref: library/imaplib imap4-objects14373008
Ref: 403c14373008
Ref: library/imaplib imaplib IMAP4 append14374837
Ref: 403d14374837
Ref: library/imaplib imaplib IMAP4 authenticate14374993
Ref: 403e14374993
Ref: library/imaplib imaplib IMAP4 check14375945
Ref: 403f14375945
Ref: library/imaplib imaplib IMAP4 close14376070
Ref: b0414376070
Ref: library/imaplib imaplib IMAP4 copy14376343
Ref: 404014376343
Ref: library/imaplib imaplib IMAP4 create14376511
Ref: 404114376511
Ref: library/imaplib imaplib IMAP4 delete14376642
Ref: 404214376642
Ref: library/imaplib imaplib IMAP4 deleteacl14376770
Ref: 404314376770
Ref: library/imaplib imaplib IMAP4 enable14376908
Ref: 100e14376908
Ref: library/imaplib imaplib IMAP4 expunge14377234
Ref: 404414377234
Ref: library/imaplib imaplib IMAP4 fetch14377612
Ref: 404514377612
Ref: library/imaplib imaplib IMAP4 getacl14378034
Ref: 404614378034
Ref: library/imaplib imaplib IMAP4 getannotation14378242
Ref: 404714378242
Ref: library/imaplib imaplib IMAP4 getquota14378482
Ref: 404814378482
Ref: library/imaplib imaplib IMAP4 getquotaroot14378719
Ref: 404914378719
Ref: library/imaplib imaplib IMAP4 idle14378977
Ref: 22d14378977
Ref: library/imaplib imaplib IMAP4 Idler burst14380548
Ref: 404b14380548
Ref: library/imaplib imaplib IMAP4 list14382705
Ref: 404c14382705
Ref: library/imaplib imaplib IMAP4 login14383096
Ref: 404d14383096
Ref: library/imaplib imaplib IMAP4 login_cram_md514383270
Ref: 17f614383270
Ref: library/imaplib imaplib IMAP4 logout14383679
Ref: c8414383679
Ref: library/imaplib imaplib IMAP4 lsub14383918
Ref: 404e14383918
Ref: library/imaplib imaplib IMAP4 myrights14384430
Ref: 404f14384430
Ref: library/imaplib imaplib IMAP4 namespace14384606
Ref: 405014384606
Ref: library/imaplib imaplib IMAP4 noop14384715
Ref: 405114384715
Ref: library/imaplib imaplib IMAP4 open14384800
Ref: b0114384800
Ref: library/imaplib imaplib IMAP4 partial14385791
Ref: 405614385791
Ref: library/imaplib imaplib IMAP4 proxyauth14386057
Ref: 405714386057
Ref: library/imaplib imaplib IMAP4 read14386284
Ref: 405214386284
Ref: library/imaplib imaplib IMAP4 readline14386465
Ref: 405314386465
Ref: library/imaplib imaplib IMAP4 recent14386635
Ref: 405814386635
Ref: library/imaplib imaplib IMAP4 rename14386856
Ref: 405914386856
Ref: library/imaplib imaplib IMAP4 response14387022
Ref: 404a14387022
Ref: library/imaplib imaplib IMAP4 search14387280
Ref: 405a14387280
Ref: library/imaplib imaplib IMAP4 select14387988
Ref: 405b14387988
Ref: library/imaplib imaplib IMAP4 send14388369
Ref: 405414388369
Ref: library/imaplib imaplib IMAP4 setacl14388672
Ref: 405c14388672
Ref: library/imaplib imaplib IMAP4 setannotation14388882
Ref: 405d14388882
Ref: library/imaplib imaplib IMAP4 setquota14389120
Ref: 405e14389120
Ref: library/imaplib imaplib IMAP4 shutdown14389344
Ref: 405514389344
Ref: library/imaplib imaplib IMAP4 socket14389607
Ref: 405f14389607
Ref: library/imaplib imaplib IMAP4 sort14389739
Ref: 406014389739
Ref: library/imaplib imaplib IMAP4 starttls14390817
Ref: 143e14390817
Ref: library/imaplib imaplib IMAP4 status14391375
Ref: 406114391375
Ref: library/imaplib imaplib IMAP4 store14391504
Ref: 406214391504
Ref: library/imaplib imaplib IMAP4 subscribe14392882
Ref: 406314392882
Ref: library/imaplib imaplib IMAP4 thread14392998
Ref: 406414392998
Ref: library/imaplib imaplib IMAP4 uid14394193
Ref: 406514394193
Ref: library/imaplib imaplib IMAP4 unsubscribe14394598
Ref: 406614394598
Ref: library/imaplib imaplib IMAP4 unselect14394724
Ref: b0314394724
Ref: library/imaplib imaplib IMAP4 xatom14395127
Ref: 406714395127
Ref: library/imaplib imaplib IMAP4 PROTOCOL_VERSION14395383
Ref: 406814395383
Ref: library/imaplib imaplib IMAP4 debug14395558
Ref: 406914395558
Ref: library/imaplib imaplib IMAP4 utf8_enabled14395790
Ref: 100f14395790
Ref: IMAP4 オブジェクト-Footnote-114396071
Ref: IMAP4 オブジェクト-Footnote-214396130
Ref: IMAP4 オブジェクト-Footnote-314396189
Ref: IMAP4 オブジェクト-Footnote-414396248
Ref: IMAP4 オブジェクト-Footnote-514396307
Ref: IMAP4 オブジェクト-Footnote-614396366
Ref: IMAP4 オブジェクト-Footnote-714396425
Ref: IMAP4 オブジェクト-Footnote-814396484
Ref: IMAP4 オブジェクト-Footnote-914396543
Ref: IMAP4 オブジェクト-Footnote-1014396602
Node: IMAP4 の使用例14396662
Ref: library/imaplib id214396801
Ref: 406a14396801
Ref: library/imaplib imap4-example14396801
Ref: 406b14396801
Node: smtplib --- SMTP プロトコルクライアント14397368
Ref: library/smtplib doc14397629
Ref: 406c14397629
Ref: library/smtplib module-smtplib14397629
Ref: cf14397629
Ref: library/smtplib smtplib-smtp-protocol-client14397629
Ref: 406d14397629
Ref: library/smtplib translation-repo14397629
Ref: 406e14397629
Ref: library/smtplib smtplib SMTP14398360
Ref: b2714398360
Ref: library/smtplib smtplib SMTP_SSL14401618
Ref: b2814401618
Ref: library/smtplib smtplib LMTP14403278
Ref: b2914403278
Ref: library/smtplib smtplib SMTPException14404350
Ref: 11a314404350
Ref: library/smtplib smtplib SMTPServerDisconnected14404647
Ref: 407114404647
Ref: library/smtplib smtplib SMTPResponseException14404877
Ref: 407214404877
Ref: library/smtplib smtplib SMTPResponseException smtp_code14405092
Ref: 407314405092
Ref: library/smtplib smtplib SMTPResponseException smtp_error14405156
Ref: 407414405156
Ref: library/smtplib smtplib SMTPSenderRefused14405218
Ref: 407514405218
Ref: library/smtplib smtplib SMTPRecipientsRefused14405497
Ref: 407614405497
Ref: library/smtplib smtplib SMTPRecipientsRefused recipients14405579
Ref: 407714405579
Ref: library/smtplib smtplib SMTPDataError14405766
Ref: 407814405766
Ref: library/smtplib smtplib SMTPConnectError14405938
Ref: 406f14405938
Ref: library/smtplib smtplib SMTPHeloError14406073
Ref: 407914406073
Ref: library/smtplib smtplib SMTPNotSupportedError14406208
Ref: 1dae14406208
Ref: library/smtplib smtplib SMTPAuthenticationError14406379
Ref: 407a14406379
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-114407272
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-214407339
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-314407397
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-414407456
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-514407515
Ref: smtplib --- SMTP プロトコルクライアント-Footnote-614407573
Node: SMTP オブジェクト14407632
Ref: library/smtplib id114407765
Ref: 407b14407765
Ref: library/smtplib smtp-objects14407765
Ref: 407c14407765
Ref: library/smtplib smtplib SMTP set_debuglevel14407914
Ref: 105814407914
Ref: library/smtplib smtplib SMTP docmd14408365
Ref: 407d14408365
Ref: library/smtplib smtplib SMTP connect14409309
Ref: 1daf14409309
Ref: library/smtplib smtplib SMTP helo14410144
Ref: 407e14410144
Ref: library/smtplib smtplib SMTP ehlo14410597
Ref: 408014410597
Ref: library/smtplib smtplib SMTP ehlo_or_helo_if_needed14411661
Ref: 408514411661
Ref: library/smtplib smtplib SMTP has_extn14412128
Ref: 408114412128
Ref: library/smtplib smtplib SMTP verify14412387
Ref: 408614412387
Ref: library/smtplib smtplib SMTP login14412914
Ref: 408714412914
Ref: library/smtplib smtplib SMTP auth14414740
Ref: 105714414740
Ref: library/smtplib smtplib SMTP starttls14416987
Ref: 135014416987
Ref: library/smtplib smtplib SMTP sendmail14418682
Ref: 105914418682
Ref: library/smtplib smtplib SMTP send_message14422615
Ref: 105a14422615
Ref: library/smtplib smtplib SMTP quit14424697
Ref: 407014424697
Ref: library/smtplib smtplib SMTP helo_resp14425255
Ref: 407f14425255
Ref: library/smtplib smtplib SMTP ehlo_resp14425356
Ref: 408214425356
Ref: library/smtplib smtplib SMTP does_esmtp14425457
Ref: 408314425457
Ref: library/smtplib smtplib SMTP esmtp_features14425586
Ref: 408414425586
Ref: SMTP オブジェクト-Footnote-114425771
Ref: SMTP オブジェクト-Footnote-214425829
Ref: SMTP オブジェクト-Footnote-314425888
Ref: SMTP オブジェクト-Footnote-414425947
Ref: SMTP オブジェクト-Footnote-514426005
Ref: SMTP オブジェクト-Footnote-614426063
Node: SMTP 使用例14426122
Ref: library/smtplib id214426255
Ref: 408814426255
Ref: library/smtplib smtp-example14426255
Ref: 408914426255
Ref: SMTP 使用例-Footnote-114427739
Node: uuid --- RFC 9562 に基づく UUID オブジェクト14427797
Ref: library/uuid doc14428078
Ref: 408a14428078
Ref: library/uuid module-uuid14428078
Ref: 11614428078
Ref: library/uuid translation-repo14428078
Ref: 408b14428078
Ref: library/uuid uuid-uuid-objects-according-to-rfc-956214428078
Ref: 408c14428078
Ref: library/uuid uuid SafeUUID14429507
Ref: 408e14429507
Ref: library/uuid uuid SafeUUID safe14429565
Ref: 408f14429565
Ref: library/uuid uuid SafeUUID unsafe14429686
Ref: 409014429686
Ref: library/uuid uuid SafeUUID unknown14429829
Ref: 409114429829
Ref: library/uuid uuid UUID14429988
Ref: c5614429988
Ref: library/uuid uuid UUID bytes14432090
Ref: 409314432090
Ref: library/uuid uuid UUID bytes_le14432260
Ref: 409414432260
Ref: library/uuid uuid UUID fields14432423
Ref: 409514432423
Ref: library/uuid uuid UUID time_low14432827
Ref: 409614432827
Ref: library/uuid uuid UUID time_mid14433111
Ref: 409714433111
Ref: library/uuid uuid UUID time_hi_version14433401
Ref: 409814433401
Ref: library/uuid uuid UUID clock_seq_hi_variant14433689
Ref: 409914433689
Ref: library/uuid uuid UUID clock_seq_low14433971
Ref: 409a14433971
Ref: library/uuid uuid UUID node14434251
Ref: 409b14434251
Ref: library/uuid uuid UUID time14434534
Ref: 409c14434534
Ref: library/uuid uuid UUID clock_seq14435149
Ref: 409d14435149
Ref: library/uuid uuid UUID hex14435354
Ref: 188f14435354
Ref: library/uuid uuid UUID int14435440
Ref: 409214435440
Ref: library/uuid uuid UUID urn14435505
Ref: 409e14435505
Ref: library/uuid uuid UUID variant14435583
Ref: 409f14435583
Ref: library/uuid uuid UUID version14435842
Ref: 40a414435842
Ref: library/uuid uuid UUID is_safe14436050
Ref: d9f14436050
Ref: library/uuid uuid getnode14436311
Ref: da014436311
Ref: library/uuid uuid-factory-functions14437590
Ref: 408d14437590
Ref: library/uuid uuid uuid114437590
Ref: da114437590
Ref: library/uuid uuid uuid314438122
Ref: 2e514438122
Ref: library/uuid uuid uuid414438397
Ref: 2e714438397
Ref: library/uuid uuid uuid514438531
Ref: 2e614438531
Ref: library/uuid uuid uuid614438809
Ref: 2c214438809
Ref: library/uuid uuid uuid714439448
Ref: 2c314439448
Ref: library/uuid uuid uuid814439788
Ref: 2c414439788
Ref: library/uuid uuid NAMESPACE_DNS14440609
Ref: 40a514440609
Ref: library/uuid uuid NAMESPACE_URL14440757
Ref: 40a614440757
Ref: library/uuid uuid NAMESPACE_OID14440877
Ref: 40a714440877
Ref: library/uuid uuid NAMESPACE_X50014441001
Ref: 40a814441001
Ref: library/uuid uuid RESERVED_NCS14441292
Ref: 40a014441292
Ref: library/uuid uuid RFC_412214441385
Ref: 40a114441385
Ref: library/uuid uuid RESERVED_MICROSOFT14441592
Ref: 40a214441592
Ref: library/uuid uuid RESERVED_FUTURE14441700
Ref: 40a314441700
Ref: library/uuid uuid NIL14441857
Ref: 2c514441857
Ref: library/uuid uuid MAX14442030
Ref: 2c614442030
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-114442592
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-214442656
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-314442715
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-414442774
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-514442833
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-614442892
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-714442951
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-814443022
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-914443093
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1014443164
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1114443236
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1214443308
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1314443380
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1414443452
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1514443512
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1614443572
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1714443632
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1814443704
Ref: uuid --- RFC 9562 に基づく UUID オブジェクト-Footnote-1914443777
Node: コマンドラインからの使用14443837
Ref: library/uuid command-line-usage14443986
Ref: 40a914443986
Ref: library/uuid uuid-cli14443986
Ref: 67614443986
Ref: library/uuid cmdoption-uuid-h14444315
Ref: 40aa14444315
Ref: library/uuid cmdoption-uuid-help14444315
Ref: 40ab14444315
Ref: library/uuid cmdoption-uuid-u14444403
Ref: 40ac14444403
Ref: library/uuid cmdoption-uuid-uuid14444425
Ref: 40ad14444425
Ref: library/uuid cmdoption-uuid-n14444640
Ref: 40ae14444640
Ref: library/uuid cmdoption-uuid-namespace14444667
Ref: 40af14444667
Ref: library/uuid cmdoption-uuid-N14444979
Ref: 40b014444979
Ref: library/uuid cmdoption-uuid-name14445001
Ref: 40b114445001
Ref: library/uuid cmdoption-uuid-C14445157
Ref: 40b214445157
Ref: library/uuid cmdoption-uuid-count14445178
Ref: 2c714445178
Node: 使用例<39>14445268
Ref: library/uuid example14445446
Ref: 40b314445446
Ref: library/uuid uuid-example14445446
Ref: 40b414445446
Node: Command-Line Example14447503
Ref: library/uuid command-line-example14447636
Ref: 40b514447636
Ref: library/uuid uuid-cli-example14447636
Ref: 40b614447636
Node: socketserver --- ネットワークサーバーのフレームワーク14448084
Ref: library/socketserver doc14448348
Ref: 40b714448348
Ref: library/socketserver module-socketserver14448348
Ref: d214448348
Ref: library/socketserver socketserver-a-framework-for-network-servers14448348
Ref: 40b814448348
Ref: library/socketserver translation-repo14448348
Ref: 40b914448348
Ref: library/socketserver socketserver TCPServer14448963
Ref: 153714448963
Ref: library/socketserver socketserver UDPServer14449439
Ref: 40bc14449439
Ref: library/socketserver socketserver UnixStreamServer14449746
Ref: 40bd14449746
Ref: library/socketserver socketserver UnixDatagramServer14449863
Ref: 40be14449863
Ref: socketserver --- ネットワークサーバーのフレームワーク-Footnote-114452905
Node: サーバ生成に関するノート14452977
Ref: library/socketserver server-creation-notes14453157
Ref: 40c114453157
Ref: library/socketserver socketserver ForkingMixIn14454002
Ref: d7114454002
Ref: library/socketserver socketserver ThreadingMixIn14454043
Ref: d3a14454043
Ref: library/socketserver socketserver ThreadingMixIn block_on_close14454892
Ref: d7014454892
Ref: library/socketserver socketserver ThreadingMixIn max_children14455281
Ref: 40c314455281
Ref: library/socketserver socketserver ThreadingMixIn daemon_threads14455545
Ref: 40c414455545
Ref: library/socketserver socketserver ForkingTCPServer14456082
Ref: 40c514456082
Ref: library/socketserver socketserver ForkingUDPServer14456127
Ref: 40c614456127
Ref: library/socketserver socketserver ThreadingTCPServer14456172
Ref: 40c714456172
Ref: library/socketserver socketserver ThreadingUDPServer14456219
Ref: 40c214456219
Ref: library/socketserver socketserver ForkingUnixStreamServer14456266
Ref: 40c814456266
Ref: library/socketserver socketserver ForkingUnixDatagramServer14456318
Ref: 40c914456318
Ref: library/socketserver socketserver ThreadingUnixStreamServer14456372
Ref: 40ca14456372
Ref: library/socketserver socketserver ThreadingUnixDatagramServer14456426
Ref: 40cb14456426
Node: Serverオブジェクト<2>14459490
Ref: library/socketserver server-objects14459702
Ref: 40cd14459702
Ref: library/socketserver socketserver BaseServer14459767
Ref: 135514459767
Ref: library/socketserver socketserver BaseServer fileno14460180
Ref: 40d014460180
Ref: library/socketserver socketserver BaseServer handle_request14460513
Ref: 153a14460513
Ref: library/socketserver socketserver BaseServer serve_forever14461219
Ref: 135714461219
Ref: library/socketserver socketserver BaseServer service_actions14461885
Ref: 135614461885
Ref: library/socketserver socketserver BaseServer shutdown14462194
Ref: 1e1614462194
Ref: library/socketserver socketserver BaseServer server_close14462482
Ref: d6f14462482
Ref: library/socketserver socketserver BaseServer address_family14462603
Ref: 40d414462603
Ref: library/socketserver socketserver BaseServer RequestHandlerClass14463015
Ref: 40cf14463015
Ref: library/socketserver socketserver BaseServer server_address14463207
Ref: 40ce14463207
Ref: library/socketserver socketserver BaseServer socket14463697
Ref: 40d514463697
Ref: library/socketserver socketserver BaseServer allow_reuse_address14463904
Ref: 40d614463904
Ref: library/socketserver socketserver BaseServer request_queue_size14464199
Ref: 40d714464199
Ref: library/socketserver socketserver BaseServer socket_type14464799
Ref: 40d814464799
Ref: library/socketserver socketserver BaseServer timeout14465014
Ref: 153814465014
Ref: library/socketserver socketserver BaseServer finish_request14465630
Ref: 40d914465630
Ref: library/socketserver socketserver BaseServer get_request14465872
Ref: 40d114465872
Ref: library/socketserver socketserver BaseServer handle_error14466173
Ref: f3d14466173
Ref: library/socketserver socketserver BaseServer handle_timeout14466700
Ref: 153914466700
Ref: library/socketserver socketserver BaseServer process_request14467191
Ref: 40d314467191
Ref: library/socketserver socketserver BaseServer server_activate14467671
Ref: 40bb14467671
Ref: library/socketserver socketserver BaseServer server_bind14467921
Ref: 40ba14467921
Ref: library/socketserver socketserver BaseServer verify_request14468154
Ref: 40d214468154
Node: Request Handler Objects14468881
Ref: library/socketserver request-handler-objects14469070
Ref: 40da14469070
Ref: library/socketserver socketserver BaseRequestHandler14469139
Ref: 40bf14469139
Ref: library/socketserver socketserver BaseRequestHandler setup14469497
Ref: 40db14469497
Ref: library/socketserver socketserver BaseRequestHandler handle14469716
Ref: 40c014469716
Ref: library/socketserver socketserver BaseRequestHandler finish14470437
Ref: 40df14470437
Ref: library/socketserver socketserver BaseRequestHandler request14470805
Ref: 40dc14470805
Ref: library/socketserver socketserver BaseRequestHandler client_address14470941
Ref: 40dd14470941
Ref: library/socketserver socketserver BaseRequestHandler server14471063
Ref: 40de14471063
Ref: library/socketserver socketserver StreamRequestHandler14471164
Ref: ed614471164
Ref: library/socketserver socketserver DatagramRequestHandler14471213
Ref: 40cc14471213
Ref: library/socketserver socketserver DatagramRequestHandler rfile14471464
Ref: 40e014471464
Ref: library/socketserver socketserver DatagramRequestHandler wfile14471629
Ref: ed514471629
Node: 使用例<40>14471912
Ref: library/socketserver examples14472065
Ref: 40e114472065
Node: socketserver TCPServer の例14472271
Ref: library/socketserver socketserver-tcpserver-example14472388
Ref: 40e214472388
Node: socketserver UDPServer の例14476316
Ref: library/socketserver socketserver-udpserver-example14476467
Ref: 40e314476467
Node: 非同期処理の Mix-in14478075
Ref: library/socketserver asynchronous-mixins14478188
Ref: 40e414478188
Node: http server --- HTTP サーバー14480674
Ref: library/http server doc14480921
Ref: 40e514480921
Ref: library/http server http-server-http-servers14480921
Ref: 40e614480921
Ref: library/http server module-http server14480921
Ref: 7614480921
Ref: library/http server translation-repo14480921
Ref: 40e714480921
Ref: library/http server http server HTTPServer14482121
Ref: 3ee514482121
Ref: library/http server http server ThreadingHTTPServer14482568
Ref: d3914482568
Ref: library/http server http server HTTPSServer14482945
Ref: 22814482945
Ref: library/http server http server ThreadingHTTPSServer14484292
Ref: 40e914484292
Ref: library/http server http server BaseHTTPRequestHandler14484992
Ref: 12e214484992
Ref: library/http server http server BaseHTTPRequestHandler client_address14486169
Ref: 40ea14486169
Ref: library/http server http server BaseHTTPRequestHandler server14486360
Ref: 40eb14486360
Ref: library/http server http server BaseHTTPRequestHandler close_connection14486449
Ref: 40ec14486449
Ref: library/http server http server BaseHTTPRequestHandler requestline14486750
Ref: 40ee14486750
Ref: library/http server http server BaseHTTPRequestHandler command14487153
Ref: 40ef14487153
Ref: library/http server http server BaseHTTPRequestHandler path14487296
Ref: 40f014487296
Ref: library/http server http server BaseHTTPRequestHandler request_version14487570
Ref: 40f114487570
Ref: library/http server http server BaseHTTPRequestHandler headers14487731
Ref: 3fca14487731
Ref: library/http server http server BaseHTTPRequestHandler rfile14488158
Ref: 40f314488158
Ref: library/http server http server BaseHTTPRequestHandler wfile14488310
Ref: 40f414488310
Ref: library/http server http server BaseHTTPRequestHandler server_version14488777
Ref: 40f514488777
Ref: library/http server http server BaseHTTPRequestHandler sys_version14489180
Ref: 40f614489180
Ref: library/http server http server BaseHTTPRequestHandler error_message_format14489459
Ref: 115214489459
Ref: library/http server http server BaseHTTPRequestHandler error_content_type14489822
Ref: 40f814489822
Ref: library/http server http server BaseHTTPRequestHandler protocol_version14490054
Ref: 40f914490054
Ref: library/http server http server BaseHTTPRequestHandler MessageClass14490648
Ref: 40f214490648
Ref: library/http server http server BaseHTTPRequestHandler responses14490973
Ref: 3faf14490973
Ref: library/http server http server BaseHTTPRequestHandler handle14491568
Ref: 40fc14491568
Ref: library/http server http server BaseHTTPRequestHandler handle_one_request14491874
Ref: 40ed14491874
Ref: library/http server http server BaseHTTPRequestHandler handle_expect_10014492078
Ref: 40fd14492078
Ref: library/http server http server BaseHTTPRequestHandler send_error14492714
Ref: 115114492714
Ref: library/http server http server BaseHTTPRequestHandler send_response14493855
Ref: 40fe14493855
Ref: library/http server http server BaseHTTPRequestHandler send_header14494686
Ref: 40fa14494686
Ref: library/http server http server BaseHTTPRequestHandler send_response_only14495285
Ref: 40fb14495285
Ref: library/http server http server BaseHTTPRequestHandler end_headers14495713
Ref: 12e314495713
Ref: library/http server http server BaseHTTPRequestHandler flush_headers14496054
Ref: 12e414496054
Ref: library/http server http server BaseHTTPRequestHandler log_request14496265
Ref: 410014496265
Ref: library/http server http server BaseHTTPRequestHandler log_error14496655
Ref: 410114496655
Ref: library/http server http server BaseHTTPRequestHandler log_message14496965
Ref: 410214496965
Ref: library/http server http server BaseHTTPRequestHandler version_string14497605
Ref: 40f714497605
Ref: library/http server http server BaseHTTPRequestHandler date_time_string14497876
Ref: 40ff14497876
Ref: library/http server http server BaseHTTPRequestHandler log_date_time_string14498361
Ref: 410314498361
Ref: library/http server http server BaseHTTPRequestHandler address_string14498511
Ref: 410414498511
Ref: library/http server http server SimpleHTTPRequestHandler14498791
Ref: d3814498791
Ref: library/http server http server SimpleHTTPRequestHandler server_version14499638
Ref: 410714499638
Ref: library/http server http server SimpleHTTPRequestHandler extensions_map14499840
Ref: 410814499840
Ref: library/http server http server SimpleHTTPRequestHandler do_HEAD14500362
Ref: 410614500362
Ref: library/http server http server SimpleHTTPRequestHandler do_GET14500773
Ref: 410514500773
Ref: library/http server http server CGIHTTPRequestHandler14503462
Ref: 32514503462
Ref: library/http server http server CGIHTTPRequestHandler cgi_directories14505108
Ref: 410914505108
Ref: library/http server http server CGIHTTPRequestHandler do_POST14505412
Ref: 410a14505412
Ref: http server --- HTTP サーバー-Footnote-114506631
Ref: http server --- HTTP サーバー-Footnote-214506702
Ref: http server --- HTTP サーバー-Footnote-314506761
Ref: http server --- HTTP サーバー-Footnote-414506820
Node: コマンドライン・インターフェース<7>14506891
Ref: library/http server command-line-interface14507063
Ref: 410b14507063
Ref: library/http server http-server-cli14507063
Ref: 115314507063
Ref: library/http server cmdoption-http server-arg-port14507448
Ref: 410c14507448
Ref: library/http server cmdoption-http server-b14507641
Ref: 410d14507641
Ref: library/http server cmdoption-http server-bind14507641
Ref: 410e14507641
Ref: library/http server cmdoption-http server-d14508088
Ref: 183f14508088
Ref: library/http server cmdoption-http server-directory14508088
Ref: 410f14508088
Ref: library/http server cmdoption-http server-p14508391
Ref: 411014508391
Ref: library/http server cmdoption-http server-protocol14508391
Ref: 411114508391
Ref: library/http server cmdoption-http server-cgi14508712
Ref: 411214508712
Ref: library/http server cmdoption-http server-tls-cert14509322
Ref: 22914509322
Ref: library/http server cmdoption-http server-tls-key14509496
Ref: 22a14509496
Ref: library/http server cmdoption-http server-tls-password-file14509667
Ref: 22b14509667
Node: セキュリティで考慮すべき点<5>14510022
Ref: library/http server http-server-security14510194
Ref: 40e814510194
Ref: library/http server security-considerations14510194
Ref: 411314510194
Node: http cookies --- HTTP の状態管理14510863
Ref: library/http cookies doc14511101
Ref: 411414511101
Ref: library/http cookies http-cookies-http-state-management14511101
Ref: 411514511101
Ref: library/http cookies module-http cookies14511101
Ref: 7514511101
Ref: library/http cookies translation-repo14511101
Ref: 411614511101
Ref: library/http cookies http cookies CookieError14512687
Ref: 411714512687
Ref: library/http cookies http cookies BaseCookie14512874
Ref: 411814512874
Ref: library/http cookies http cookies SimpleCookie14513352
Ref: 1e2414513352
Ref: http cookies --- HTTP の状態管理-Footnote-114514349
Ref: http cookies --- HTTP の状態管理-Footnote-214514421
Ref: http cookies --- HTTP の状態管理-Footnote-314514480
Ref: http cookies --- HTTP の状態管理-Footnote-414514539
Ref: http cookies --- HTTP の状態管理-Footnote-514514598
Node: Cookieオブジェクト14514657
Ref: library/http cookies cookie-objects14514788
Ref: 411c14514788
Ref: library/http cookies id114514788
Ref: 411d14514788
Ref: library/http cookies http cookies BaseCookie value_decode14514853
Ref: 411a14514853
Ref: library/http cookies http cookies BaseCookie value_encode14515226
Ref: 411b14515226
Ref: library/http cookies http cookies BaseCookie output14515840
Ref: 411e14515840
Ref: library/http cookies http cookies BaseCookie js_output14516212
Ref: 412014516212
Ref: library/http cookies http cookies BaseCookie load14516522
Ref: 411914516522
Node: Morselオブジェクト14516852
Ref: library/http cookies id214517005
Ref: 412114517005
Ref: library/http cookies morsel-objects14517005
Ref: 412214517005
Ref: library/http cookies http cookies Morsel14517070
Ref: dfe14517070
Ref: library/http cookies http cookies Morsel expires14517322
Ref: 412314517322
Ref: library/http cookies http cookies Morsel path14517355
Ref: 412414517355
Ref: library/http cookies http cookies Morsel comment14517385
Ref: 412514517385
Ref: library/http cookies http cookies Morsel domain14517418
Ref: 412614517418
Ref: library/http cookies http cookies Morsel secure14517484
Ref: 412714517484
Ref: library/http cookies http cookies Morsel version14517516
Ref: 412814517516
Ref: library/http cookies http cookies Morsel httponly14517549
Ref: 15e914517549
Ref: library/http cookies http cookies Morsel samesite14517583
Ref: 412914517583
Ref: library/http cookies http cookies Morsel partitioned14517617
Ref: 412a14517617
Ref: library/http cookies http cookies Morsel value14519650
Ref: dfc14519650
Ref: library/http cookies http cookies Morsel coded_value14519707
Ref: dfd14519707
Ref: library/http cookies http cookies Morsel key14519818
Ref: dfb14519818
Ref: library/http cookies http cookies Morsel set14519870
Ref: dff14519870
Ref: library/http cookies http cookies Morsel isReservedKey14520006
Ref: 412b14520006
Ref: library/http cookies http cookies Morsel output14520135
Ref: 411f14520135
Ref: library/http cookies http cookies Morsel js_output14520537
Ref: 412c14520537
Ref: library/http cookies http cookies Morsel OutputString14520843
Ref: 412d14520843
Ref: library/http cookies http cookies Morsel update14521046
Ref: 10c914521046
Ref: library/http cookies http cookies Morsel copy14521373
Ref: 10c814521373
Ref: library/http cookies http cookies Morsel setdefault14521580
Ref: 412e14521580
Ref: Morselオブジェクト-Footnote-114521861
Ref: Morselオブジェクト-Footnote-214521920
Ref: Morselオブジェクト-Footnote-314521979
Ref: Morselオブジェクト-Footnote-414522042
Ref: Morselオブジェクト-Footnote-514522101
Node: 使用例<41>14522160
Ref: library/http cookies cookie-example14522280
Ref: 412f14522280
Ref: library/http cookies example14522280
Ref: 413014522280
Node: http cookiejar --- HTTP クライアント用の Cookie 処理14523919
Ref: library/http cookiejar doc14524193
Ref: 413114524193
Ref: library/http cookiejar http-cookiejar-cookie-handling-for-http-clients14524193
Ref: 413214524193
Ref: library/http cookiejar module-http cookiejar14524193
Ref: 7414524193
Ref: library/http cookiejar translation-repo14524193
Ref: 413314524193
Ref: library/http cookiejar http cookiejar LoadError14525793
Ref: 413414525793
Ref: library/http cookiejar http cookiejar CookieJar14526325
Ref: 3f5314526325
Ref: library/http cookiejar http cookiejar FileCookieJar14527037
Ref: 413514527037
Ref: library/http cookiejar http cookiejar CookiePolicy14528162
Ref: 413614528162
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy14528384
Ref: 1df414528384
Ref: library/http cookiejar http cookiejar Cookie14530627
Ref: 413b14530627
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-114532545
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-214532619
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-314532678
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-414532737
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-514532796
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-614532855
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-714532914
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-814532973
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-914533032
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-1014533091
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-1114533151
Ref: http cookiejar --- HTTP クライアント用の Cookie 処理-Footnote-1214533211
Node: CookieJar および FileCookieJar オブジェクト14533271
Ref: library/http cookiejar cookie-jar-objects14533495
Ref: 413c14533495
Ref: library/http cookiejar cookiejar-and-filecookiejar-objects14533495
Ref: 413d14533495
Ref: library/http cookiejar http cookiejar CookieJar add_cookie_header14533919
Ref: 413e14533919
Ref: library/http cookiejar http cookiejar CookieJar extract_cookies14535075
Ref: 413f14535075
Ref: library/http cookiejar http cookiejar CookieJar set_policy14536741
Ref: 414114536741
Ref: library/http cookiejar http cookiejar CookieJar make_cookies14536875
Ref: 414214536875
Ref: library/http cookiejar http cookiejar CookieJar set_cookie_if_ok14537256
Ref: 414314537256
Ref: library/http cookiejar http cookiejar CookieJar set_cookie14537429
Ref: 414414537429
Ref: library/http cookiejar http cookiejar CookieJar clear14537638
Ref: 414514537638
Ref: library/http cookiejar http cookiejar CookieJar clear_session_cookies14538365
Ref: 414614538365
Ref: library/http cookiejar http cookiejar FileCookieJar save14539240
Ref: 414714539240
Ref: library/http cookiejar http cookiejar FileCookieJar load14540518
Ref: 413714540518
Ref: library/http cookiejar http cookiejar FileCookieJar revert14541340
Ref: 413814541340
Ref: library/http cookiejar http cookiejar FileCookieJar filename14541862
Ref: 414814541862
Ref: library/http cookiejar http cookiejar FileCookieJar delayload14542049
Ref: 414914542049
Node: FileCookieJar のサブクラスと web ブラウザとの連携14542739
Ref: library/http cookiejar file-cookie-jar-classes14543003
Ref: 413914543003
Ref: library/http cookiejar filecookiejar-subclasses-and-co-operation-with-web-browsers14543003
Ref: 414a14543003
Ref: library/http cookiejar http cookiejar MozillaCookieJar14543262
Ref: 414b14543262
Ref: library/http cookiejar http cookiejar LWPCookieJar14544372
Ref: 414c14544372
Ref: FileCookieJar のサブクラスと web ブラウザとの連携-Footnote-114544927
Node: CookiePolicy オブジェクト14544986
Ref: library/http cookiejar cookie-policy-objects14545236
Ref: 414d14545236
Ref: library/http cookiejar cookiepolicy-objects14545236
Ref: 414e14545236
Ref: library/http cookiejar http cookiejar CookiePolicy set_ok14545456
Ref: 414014545456
Ref: library/http cookiejar http cookiejar CookiePolicy return_ok14545870
Ref: 414f14545870
Ref: library/http cookiejar http cookiejar CookiePolicy domain_return_ok14546277
Ref: 415014546277
Ref: library/http cookiejar http cookiejar CookiePolicy path_return_ok14548323
Ref: 415114548323
Ref: library/http cookiejar http cookiejar CookiePolicy netscape14548957
Ref: 415214548957
Ref: library/http cookiejar http cookiejar CookiePolicy rfc296514549071
Ref: 415314549071
Ref: library/http cookiejar http cookiejar CookiePolicy hide_cookie214549187
Ref: 415414549187
Ref: CookiePolicy オブジェクト-Footnote-114550005
Ref: CookiePolicy オブジェクト-Footnote-214550064
Node: DefaultCookiePolicy オブジェクト14550123
Ref: library/http cookiejar default-cookie-policy-objects14550336
Ref: 415514550336
Ref: library/http cookiejar defaultcookiepolicy-objects14550336
Ref: 415614550336
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy blocked_domains14553524
Ref: 415714553524
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy set_blocked_domains14553683
Ref: 415814553683
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy is_blocked14553818
Ref: 415914553818
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy allowed_domains14553998
Ref: 415a14553998
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy set_allowed_domains14554183
Ref: 415b14554183
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy is_not_allowed14554345
Ref: 415c14554345
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy rfc2109_as_netscape14554776
Ref: 413a14554776
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_domain14555557
Ref: 415d14555557
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_rfc2965_unverifiable14555981
Ref: 415e14555981
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_unverifiable14556489
Ref: 415f14556489
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_domain14556694
Ref: 416014556694
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_set_initial_dollar14556967
Ref: 416114556967
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_set_path14557130
Ref: 416214557130
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainStrictNoDots14557471
Ref: 416314557471
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainStrictNonDomain14557846
Ref: 416414557846
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainRFC2965Match14558293
Ref: 416514558293
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainLiberal14558618
Ref: 416614558618
Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainStrict14558801
Ref: 416714558801
Ref: DefaultCookiePolicy オブジェクト-Footnote-114558958
Ref: DefaultCookiePolicy オブジェクト-Footnote-214559017
Ref: DefaultCookiePolicy オブジェクト-Footnote-314559076
Ref: DefaultCookiePolicy オブジェクト-Footnote-414559135
Ref: DefaultCookiePolicy オブジェクト-Footnote-514559194
Ref: DefaultCookiePolicy オブジェクト-Footnote-614559253
Ref: DefaultCookiePolicy オブジェクト-Footnote-714559312
Node: Cookieオブジェクト<2>14559371
Ref: library/http cookiejar cookie-objects14559566
Ref: 416814559566
Ref: library/http cookiejar http cookiejar Cookie version14560447
Ref: 416914560447
Ref: library/http cookiejar http cookiejar Cookie name14560796
Ref: 416a14560796
Ref: library/http cookiejar http cookiejar Cookie value14560867
Ref: 416b14560867
Ref: library/http cookiejar http cookiejar Cookie port14560969
Ref: 416c14560969
Ref: library/http cookiejar http cookiejar Cookie domain14561140
Ref: 416d14561140
Ref: library/http cookiejar http cookiejar Cookie path14561220
Ref: 416e14561220
Ref: library/http cookiejar http cookiejar Cookie secure14561332
Ref: 416f14561332
Ref: library/http cookiejar http cookiejar Cookie expires14561477
Ref: 417014561477
Ref: library/http cookiejar http cookiejar Cookie discard14561719
Ref: 417214561719
Ref: library/http cookiejar http cookiejar Cookie comment14561835
Ref: 417314561835
Ref: library/http cookiejar http cookiejar Cookie comment_url14561998
Ref: 417414561998
Ref: library/http cookiejar http cookiejar Cookie rfc210914562173
Ref: 417514562173
Ref: library/http cookiejar http cookiejar Cookie port_specified14562569
Ref: 417614562569
Ref: library/http cookiejar http cookiejar Cookie domain_specified14562801
Ref: 417714562801
Ref: library/http cookiejar http cookiejar Cookie domain_initial_dot14562947
Ref: 417814562947
Ref: library/http cookiejar http cookiejar Cookie has_nonstandard_attr14563303
Ref: 417914563303
Ref: library/http cookiejar http cookiejar Cookie get_nonstandard_attr14563492
Ref: 417a14563492
Ref: library/http cookiejar http cookiejar Cookie set_nonstandard_attr14563734
Ref: 417b14563734
Ref: library/http cookiejar http cookiejar Cookie is_expired14563945
Ref: 417114563945
Ref: Cookieオブジェクト<2>-Footnote-114564293
Ref: Cookieオブジェクト<2>-Footnote-214564352
Ref: Cookieオブジェクト<2>-Footnote-314564411
Ref: Cookieオブジェクト<2>-Footnote-414564470
Node: 使用例<42>14564529
Ref: library/http cookiejar examples14564677
Ref: 417c14564677
Ref: 使用例<42>-Footnote-114566322
Node: xmlrpc --- XMLRPC サーバーとクライアントモジュール群14566381
Ref: library/xmlrpc doc14566674
Ref: 417d14566674
Ref: library/xmlrpc module-xmlrpc14566674
Ref: 13314566674
Ref: library/xmlrpc translation-repo14566674
Ref: 417e14566674
Ref: library/xmlrpc xmlrpc-xmlrpc-server-and-client-modules14566674
Ref: 417f14566674
Node: xmlrpc client --- XML-RPC クライアントアクセス14567404
Ref: library/xmlrpc client doc14567686
Ref: 418014567686
Ref: library/xmlrpc client module-xmlrpc client14567686
Ref: 13414567686
Ref: library/xmlrpc client translation-repo14567686
Ref: 418114567686
Ref: library/xmlrpc client xmlrpc-client-xml-rpc-client-access14567686
Ref: 418214567686
Ref: library/xmlrpc client xmlrpc client ServerProxy14569021
Ref: c4c14569021
Ref: xmlrpc client --- XML-RPC クライアントアクセス-Footnote-114578067
Ref: xmlrpc client --- XML-RPC クライアントアクセス-Footnote-214578140
Ref: xmlrpc client --- XML-RPC クライアントアクセス-Footnote-314578234
Ref: xmlrpc client --- XML-RPC クライアントアクセス-Footnote-414578290
Ref: xmlrpc client --- XML-RPC クライアントアクセス-Footnote-514578349
Node: ServerProxy オブジェクト14578395
Ref: library/xmlrpc client id114578554
Ref: 418614578554
Ref: library/xmlrpc client serverproxy-objects14578554
Ref: 418714578554
Ref: library/xmlrpc client xmlrpc client ServerProxy system listMethods14579316
Ref: 418814579316
Ref: library/xmlrpc client xmlrpc client ServerProxy system methodSignature14579502
Ref: 418914579502
Ref: library/xmlrpc client xmlrpc client ServerProxy system methodHelp14580620
Ref: 418a14580620
Node: DateTime オブジェクト14581750
Ref: library/xmlrpc client datetime-objects14581943
Ref: 418b14581943
Ref: library/xmlrpc client id214581943
Ref: 418c14581943
Ref: library/xmlrpc client xmlrpc client DateTime14582014
Ref: 15fc14582014
Ref: library/xmlrpc client xmlrpc client DateTime decode14582474
Ref: 418d14582474
Ref: library/xmlrpc client xmlrpc client DateTime encode14582613
Ref: 418e14582613
Node: Binary オブジェクト14583783
Ref: library/xmlrpc client binary-objects14583970
Ref: 418f14583970
Ref: library/xmlrpc client id314583970
Ref: 419014583970
Ref: library/xmlrpc client xmlrpc client Binary14584037
Ref: 418314584037
Ref: library/xmlrpc client xmlrpc client Binary data14584245
Ref: 419114584245
Ref: library/xmlrpc client xmlrpc client Binary decode14584617
Ref: 419214584617
Ref: library/xmlrpc client xmlrpc client Binary encode14584803
Ref: 419314584803
Ref: Binary オブジェクト-Footnote-114586176
Node: Fault オブジェクト14586247
Ref: library/xmlrpc client fault-objects14586439
Ref: 419414586439
Ref: library/xmlrpc client id414586439
Ref: 419514586439
Ref: library/xmlrpc client xmlrpc client Fault14586504
Ref: 418414586504
Ref: library/xmlrpc client xmlrpc client Fault faultCode14586690
Ref: 419614586690
Ref: library/xmlrpc client xmlrpc client Fault faultString14586769
Ref: 419714586769
Node: ProtocolError オブジェクト14587732
Ref: library/xmlrpc client protocol-error-objects14587927
Ref: 419814587927
Ref: library/xmlrpc client protocolerror-objects14587927
Ref: 419914587927
Ref: library/xmlrpc client xmlrpc client ProtocolError14588008
Ref: 418514588008
Ref: library/xmlrpc client xmlrpc client ProtocolError url14588317
Ref: 419a14588317
Ref: library/xmlrpc client xmlrpc client ProtocolError errcode14588402
Ref: 419b14588402
Ref: library/xmlrpc client xmlrpc client ProtocolError errmsg14588464
Ref: 419c14588464
Ref: library/xmlrpc client xmlrpc client ProtocolError headers14588555
Ref: 419d14588555
Node: MultiCall オブジェクト14589277
Ref: library/xmlrpc client multicall-objects14589460
Ref: 419e14589460
Ref: library/xmlrpc client xmlrpc client MultiCall14589716
Ref: 419f14589716
Ref: MultiCall オブジェクト-Footnote-114591777
Node: 補助関数14591975
Ref: library/xmlrpc client convenience-functions14592159
Ref: 41a014592159
Ref: library/xmlrpc client xmlrpc client dumps14592202
Ref: 41a114592202
Ref: library/xmlrpc client xmlrpc client loads14592913
Ref: 164e14592913
Node: クライアントのサンプル14593971
Ref: library/xmlrpc client example-of-client-usage14594172
Ref: 41a214594172
Ref: library/xmlrpc client xmlrpc-client-example14594172
Ref: 41a314594172
Node: クライアントとサーバーの利用例14595541
Ref: library/xmlrpc client example-of-client-and-server-usage14595721
Ref: 41a414595721
Node: xmlrpc server --- 基本的な XML-RPC サーバー14595903
Ref: library/xmlrpc server doc14596161
Ref: 41a614596161
Ref: library/xmlrpc server module-xmlrpc server14596161
Ref: 13514596161
Ref: library/xmlrpc server translation-repo14596161
Ref: 41a714596161
Ref: library/xmlrpc server xmlrpc-server-basic-xml-rpc-servers14596161
Ref: 41a814596161
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer14597062
Ref: 41a914597062
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler14598880
Ref: 41aa14598880
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCRequestHandler14599609
Ref: 153f14599609
Ref: xmlrpc server --- 基本的な XML-RPC サーバー-Footnote-114600197
Node: SimpleXMLRPCServer オブジェクト14600270
Ref: library/xmlrpc server simple-xmlrpc-servers14600427
Ref: 41ab14600427
Ref: library/xmlrpc server simplexmlrpcserver-objects14600427
Ref: 41ac14600427
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_function14600725
Ref: 41ad14600725
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_instance14601795
Ref: 41ae14601795
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_introspection_functions14603677
Ref: 41af14603677
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_multicall_functions14603921
Ref: 41b014603921
Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCRequestHandler rpc_paths14604099
Ref: 41b114604099
Node: SimpleXMLRPCServer の例14604637
Ref: library/xmlrpc server id114604736
Ref: 41b214604736
Ref: library/xmlrpc server simplexmlrpcserver-example14604736
Ref: 41a514604736
Node: CGIXMLRPCRequestHandler14609431
Ref: library/xmlrpc server cgixmlrpcrequesthandler14609625
Ref: 41b314609625
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_function14609863
Ref: 41b414609863
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_instance14610938
Ref: 41b514610938
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_introspection_functions14611944
Ref: 41b614611944
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_multicall_functions14612203
Ref: 41b714612203
Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler handle_request14612362
Ref: 41b814612362
Node: XMLRPC サーバの文書化14613058
Ref: library/xmlrpc server documenting-xmlrpc-server14613249
Ref: 41b914613249
Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer14613665
Ref: 1da614613665
Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler14614250
Ref: 41ba14614250
Ref: library/xmlrpc server xmlrpc server DocXMLRPCRequestHandler14614419
Ref: 41bb14614419
Node: DocXMLRPCServer オブジェクト14614840
Ref: library/xmlrpc server doc-xmlrpc-servers14615034
Ref: 41bc14615034
Ref: library/xmlrpc server docxmlrpcserver-objects14615034
Ref: 41bd14615034
Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer set_server_title14615587
Ref: 41be14615587
Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer set_server_name14615808
Ref: 41bf14615808
Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer set_server_documentation14616034
Ref: 41c014616034
Node: DocCGIXMLRPCRequestHandler14616305
Ref: library/xmlrpc server doccgixmlrpcrequesthandler14616462
Ref: 41c114616462
Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler set_server_title14617006
Ref: 41c214617006
Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler set_server_name14617238
Ref: 41c314617238
Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler set_server_documentation14617475
Ref: 41c414617475
Node: ipaddress --- IPv4/IPv6 操作ライブラリ14617757
Ref: library/ipaddress doc14617950
Ref: 41c514617950
Ref: library/ipaddress ipaddress-ipv4-ipv6-manipulation-library14617950
Ref: 41c614617950
Ref: library/ipaddress module-ipaddress14617950
Ref: 8414617950
Ref: library/ipaddress translation-repo14617950
Ref: 41c714617950
Ref: ipaddress --- IPv4/IPv6 操作ライブラリ-Footnote-114619185
Node: 便利なファクトリ関数14619254
Ref: library/ipaddress convenience-factory-functions14619390
Ref: 41c914619390
Ref: library/ipaddress ipaddress ip_address14619580
Ref: 41ca14619580
Ref: library/ipaddress ipaddress ip_network14620252
Ref: 41cb14620252
Ref: library/ipaddress ipaddress ip_interface14621148
Ref: 41cc14621148
Node: IP アドレス14622212
Ref: library/ipaddress ip-addresses14622384
Ref: 41cd14622384
Node: Address オブジェクト14622536
Ref: library/ipaddress address-objects14622653
Ref: 41ce14622653
Ref: library/ipaddress ipaddress IPv4Address14623182
Ref: 50c14623182
Ref: library/ipaddress ipaddress IPv4Address version14624579
Ref: 41d014624579
Ref: library/ipaddress ipaddress IPv4Address max_prefixlen14624765
Ref: 41d114624765
Ref: library/ipaddress ipaddress IPv4Address compressed14625208
Ref: 41d214625208
Ref: library/ipaddress ipaddress IPv4Address exploded14625240
Ref: 41d314625240
Ref: library/ipaddress ipaddress IPv4Address packed14625787
Ref: 41d414625787
Ref: library/ipaddress ipaddress IPv4Address reverse_pointer14626041
Ref: 102014626041
Ref: library/ipaddress ipaddress IPv4Address is_multicast14626588
Ref: 41d514626588
Ref: library/ipaddress ipaddress IPv4Address is_private14626786
Ref: 19c314626786
Ref: library/ipaddress ipaddress IPv4Address is_global14628444
Ref: 116114628444
Ref: library/ipaddress ipaddress IPv4Address is_unspecified14629366
Ref: 41d714629366
Ref: library/ipaddress ipaddress IPv4Address is_reserved14629525
Ref: 41d814629525
Ref: library/ipaddress ipaddress IPv4Address is_loopback14630231
Ref: 41da14630231
Ref: library/ipaddress ipaddress IPv4Address is_link_local14630404
Ref: 41db14630404
Ref: library/ipaddress ipaddress IPv4Address ipv6_mapped14630574
Ref: 50b14630574
Ref: library/ipaddress ipaddress IPv4Address __format__14630755
Ref: 41dc14630755
Ref: library/ipaddress ipaddress IPv6Address14632011
Ref: 50d14632011
Ref: library/ipaddress ipaddress IPv6Address compressed14633492
Ref: 41dd14633492
Ref: library/ipaddress ipaddress IPv6Address exploded14633842
Ref: 41de14633842
Ref: library/ipaddress ipaddress IPv6Address packed14634180
Ref: 41df14634180
Ref: library/ipaddress ipaddress IPv6Address reverse_pointer14634208
Ref: 193a14634208
Ref: library/ipaddress ipaddress IPv6Address version14634245
Ref: 41e014634245
Ref: library/ipaddress ipaddress IPv6Address max_prefixlen14634274
Ref: 41e114634274
Ref: library/ipaddress ipaddress IPv6Address is_multicast14634309
Ref: 41e214634309
Ref: library/ipaddress ipaddress IPv6Address is_private14634343
Ref: 19c414634343
Ref: library/ipaddress ipaddress IPv6Address is_global14634375
Ref: 19c514634375
Ref: library/ipaddress ipaddress IPv6Address is_unspecified14634439
Ref: 41e314634439
Ref: library/ipaddress ipaddress IPv6Address is_reserved14634475
Ref: 41e414634475
Ref: library/ipaddress ipaddress IPv6Address is_loopback14634508
Ref: 19aa14634508
Ref: library/ipaddress ipaddress IPv6Address is_link_local14634541
Ref: 41e514634541
Ref: library/ipaddress ipaddress IPv6Address is_site_local14634576
Ref: 41d914634576
Ref: library/ipaddress ipaddress IPv6Address ipv4_mapped14635099
Ref: 41d614635099
Ref: library/ipaddress ipaddress IPv6Address scope_id14635419
Ref: b0a14635419
Ref: library/ipaddress ipaddress IPv6Address sixtofour14635717
Ref: 41e614635717
Ref: library/ipaddress ipaddress IPv6Address teredo14636057
Ref: 41e714636057
Ref: library/ipaddress ipaddress IPv6Address __format__14636427
Ref: 41e814636427
Ref: Address オブジェクト-Footnote-114636654
Ref: Address オブジェクト-Footnote-214636713
Ref: Address オブジェクト-Footnote-314636772
Ref: Address オブジェクト-Footnote-414636874
Ref: Address オブジェクト-Footnote-514636976
Ref: Address オブジェクト-Footnote-614637078
Ref: Address オブジェクト-Footnote-714637180
Ref: Address オブジェクト-Footnote-814637239
Ref: Address オブジェクト-Footnote-914637298
Ref: Address オブジェクト-Footnote-1014637384
Ref: Address オブジェクト-Footnote-1114637487
Ref: Address オブジェクト-Footnote-1214637547
Ref: Address オブジェクト-Footnote-1314637607
Ref: Address オブジェクト-Footnote-1414637667
Ref: Address オブジェクト-Footnote-1514637727
Ref: Address オブジェクト-Footnote-1614637787
Ref: Address オブジェクト-Footnote-1714637847
Ref: Address オブジェクト-Footnote-1814637907
Ref: Address オブジェクト-Footnote-1914637967
Ref: Address オブジェクト-Footnote-2014638027
Ref: Address オブジェクト-Footnote-2114638087
Ref: Address オブジェクト-Footnote-2214638147
Node: 文字列と整数への変換14638207
Ref: library/ipaddress conversion-to-strings-and-integers14638345
Ref: 41e914638345
Node: 演算子<2>14639010
Ref: library/ipaddress operators14639113
Ref: 41ea14639113
Node: 比較演算子14639430
Ref: library/ipaddress comparison-operators14639515
Ref: 41eb14639515
Node: 算術演算14640094
Ref: library/ipaddress arithmetic-operators14640179
Ref: 41ec14640179
Node: IP ネットワーク定義14640674
Ref: library/ipaddress ip-network-definitions14640858
Ref: 41ed14640858
Node: プリフィックス ネットマスク、ホストマスク14641755
Ref: library/ipaddress prefix-net-mask-and-host-mask14641915
Ref: 41ee14641915
Node: Network オブジェクト14642816
Ref: library/ipaddress network-objects14642997
Ref: 41ef14642997
Ref: library/ipaddress ipaddress IPv4Network14643591
Ref: 50e14643591
Ref: library/ipaddress ipaddress IPv4Network version14646466
Ref: 41f114646466
Ref: library/ipaddress ipaddress IPv4Network max_prefixlen14646495
Ref: 41f214646495
Ref: library/ipaddress ipaddress IPv4Network is_multicast14646649
Ref: 41f314646649
Ref: library/ipaddress ipaddress IPv4Network is_private14646683
Ref: 41f414646683
Ref: library/ipaddress ipaddress IPv4Network is_unspecified14646715
Ref: 41f514646715
Ref: library/ipaddress ipaddress IPv4Network is_reserved14646751
Ref: 41f614646751
Ref: library/ipaddress ipaddress IPv4Network is_loopback14646784
Ref: 41f714646784
Ref: library/ipaddress ipaddress IPv4Network is_link_local14646817
Ref: 41f814646817
Ref: library/ipaddress ipaddress IPv4Network network_address14647009
Ref: 41f914647009
Ref: library/ipaddress ipaddress IPv4Network broadcast_address14647246
Ref: 41fa14647246
Ref: library/ipaddress ipaddress IPv4Network hostmask14647526
Ref: 41fb14647526
Ref: library/ipaddress ipaddress IPv4Network netmask14647667
Ref: 41fc14647667
Ref: library/ipaddress ipaddress IPv4Network with_prefixlen14647807
Ref: 41fd14647807
Ref: library/ipaddress ipaddress IPv4Network compressed14647843
Ref: 41fe14647843
Ref: library/ipaddress ipaddress IPv4Network exploded14647875
Ref: 41ff14647875
Ref: library/ipaddress ipaddress IPv4Network with_netmask14648176
Ref: 420014648176
Ref: library/ipaddress ipaddress IPv4Network with_hostmask14648307
Ref: 420114648307
Ref: library/ipaddress ipaddress IPv4Network num_addresses14648440
Ref: 420214648440
Ref: library/ipaddress ipaddress IPv4Network prefixlen14648532
Ref: 420314648532
Ref: library/ipaddress ipaddress IPv4Network hosts14648632
Ref: 17ae14648632
Ref: library/ipaddress ipaddress IPv4Network overlaps14649635
Ref: 420414649635
Ref: library/ipaddress ipaddress IPv4Network address_exclude14649813
Ref: 420514649813
Ref: library/ipaddress ipaddress IPv4Network subnets14650425
Ref: 10a014650425
Ref: library/ipaddress ipaddress IPv4Network supernet14651979
Ref: 10a114651979
Ref: library/ipaddress ipaddress IPv4Network subnet_of14652791
Ref: 420614652791
Ref: library/ipaddress ipaddress IPv4Network supernet_of14653146
Ref: 420714653146
Ref: library/ipaddress ipaddress IPv4Network compare_networks14653511
Ref: 420814653511
Ref: library/ipaddress ipaddress IPv6Network14654281
Ref: 50f14654281
Ref: library/ipaddress ipaddress IPv6Network version14656370
Ref: 420914656370
Ref: library/ipaddress ipaddress IPv6Network max_prefixlen14656399
Ref: 420a14656399
Ref: library/ipaddress ipaddress IPv6Network is_multicast14656434
Ref: 420b14656434
Ref: library/ipaddress ipaddress IPv6Network is_private14656468
Ref: 420c14656468
Ref: library/ipaddress ipaddress IPv6Network is_unspecified14656500
Ref: 420d14656500
Ref: library/ipaddress ipaddress IPv6Network is_reserved14656536
Ref: 420e14656536
Ref: library/ipaddress ipaddress IPv6Network is_loopback14656569
Ref: 420f14656569
Ref: library/ipaddress ipaddress IPv6Network is_link_local14656602
Ref: 421014656602
Ref: library/ipaddress ipaddress IPv6Network network_address14656637
Ref: 421114656637
Ref: library/ipaddress ipaddress IPv6Network broadcast_address14656674
Ref: 421214656674
Ref: library/ipaddress ipaddress IPv6Network hostmask14656713
Ref: 421314656713
Ref: library/ipaddress ipaddress IPv6Network netmask14656743
Ref: 421414656743
Ref: library/ipaddress ipaddress IPv6Network with_prefixlen14656772
Ref: 421514656772
Ref: library/ipaddress ipaddress IPv6Network compressed14656808
Ref: 421614656808
Ref: library/ipaddress ipaddress IPv6Network exploded14656840
Ref: 421714656840
Ref: library/ipaddress ipaddress IPv6Network with_netmask14656870
Ref: 421814656870
Ref: library/ipaddress ipaddress IPv6Network with_hostmask14656904
Ref: 421914656904
Ref: library/ipaddress ipaddress IPv6Network num_addresses14656939
Ref: 421a14656939
Ref: library/ipaddress ipaddress IPv6Network prefixlen14656974
Ref: 421b14656974
Ref: library/ipaddress ipaddress IPv6Network hosts14657005
Ref: 17af14657005
Ref: library/ipaddress ipaddress IPv6Network overlaps14657461
Ref: 421c14657461
Ref: library/ipaddress ipaddress IPv6Network address_exclude14657502
Ref: 421d14657502
Ref: library/ipaddress ipaddress IPv6Network subnets14657552
Ref: 421e14657552
Ref: library/ipaddress ipaddress IPv6Network supernet14657620
Ref: 421f14657620
Ref: library/ipaddress ipaddress IPv6Network subnet_of14657689
Ref: 422014657689
Ref: library/ipaddress ipaddress IPv6Network supernet_of14657731
Ref: 422114657731
Ref: library/ipaddress ipaddress IPv6Network compare_networks14657775
Ref: 422214657775
Ref: library/ipaddress ipaddress IPv6Network is_site_local14657943
Ref: 422314657943
Node: 演算子<3>14658119
Ref: library/ipaddress id114658230
Ref: 422414658230
Node: 論理演算子14658620
Ref: library/ipaddress logical-operators14658714
Ref: 422514658714
Node: イテレーション14658910
Ref: library/ipaddress iteration14659070
Ref: 422614659070
Node: アドレスのコンテナとしてのネットワーク14659915
Ref: library/ipaddress networks-as-containers-of-addresses14660051
Ref: 422714660051
Node: インターフェイスオブジェクト14660595
Ref: library/ipaddress interface-objects14660806
Ref: 422814660806
Ref: library/ipaddress ipaddress IPv4Interface14661028
Ref: 1b9914661028
Ref: library/ipaddress ipaddress IPv4Interface ip14661448
Ref: 422914661448
Ref: library/ipaddress ipaddress IPv4Interface network14661694
Ref: 422a14661694
Ref: library/ipaddress ipaddress IPv4Interface with_prefixlen14661951
Ref: 422b14661951
Ref: library/ipaddress ipaddress IPv4Interface with_netmask14662219
Ref: 422c14662219
Ref: library/ipaddress ipaddress IPv4Interface with_hostmask14662492
Ref: 422d14662492
Ref: library/ipaddress ipaddress IPv6Interface14662764
Ref: 1b9a14662764
Ref: library/ipaddress ipaddress IPv6Interface ip14663184
Ref: 422e14663184
Ref: library/ipaddress ipaddress IPv6Interface network14663208
Ref: 422f14663208
Ref: library/ipaddress ipaddress IPv6Interface with_prefixlen14663237
Ref: 423014663237
Ref: library/ipaddress ipaddress IPv6Interface with_netmask14663273
Ref: 423114663273
Ref: library/ipaddress ipaddress IPv6Interface with_hostmask14663307
Ref: 423214663307
Node: 演算子<4>14663501
Ref: library/ipaddress id214663592
Ref: 423314663592
Node: 論理演算子<2>14663915
Ref: library/ipaddress id314663982
Ref: 423414663982
Node: その他のモジュールレベル関数14664630
Ref: library/ipaddress other-module-level-functions14664831
Ref: 423514664831
Ref: library/ipaddress ipaddress v4_int_to_packed14665016
Ref: 423614665016
Ref: library/ipaddress ipaddress v6_int_to_packed14665595
Ref: 423714665595
Ref: library/ipaddress ipaddress summarize_address_range14666009
Ref: 10a214666009
Ref: library/ipaddress ipaddress collapse_addresses14667033
Ref: 10a314667033
Ref: library/ipaddress ipaddress get_mixed_type_key14667615
Ref: 423814667615
Node: Custom Exceptions14668332
Ref: library/ipaddress custom-exceptions14668482
Ref: 423914668482
Ref: library/ipaddress ipaddress AddressValueError14668695
Ref: 41cf14668695
Ref: library/ipaddress ipaddress NetmaskValueError14668795
Ref: 41f014668795
Node: マルチメディアサービス14668896
Ref: library/mm doc14669072
Ref: 423a14669072
Ref: library/mm mmedia14669072
Ref: 423b14669072
Ref: library/mm multimedia-services14669072
Ref: 423c14669072
Ref: library/mm translation-repo14669072
Ref: 423d14669072
Node: wave --- WAV ファイルの読み書き14669613
Ref: library/wave doc14669766
Ref: 423e14669766
Ref: library/wave module-wave14669766
Ref: 11914669766
Ref: library/wave wave-read-and-write-wav-files14669766
Ref: 423f14669766
Ref: library/wave wave open14670362
Ref: b4514670362
Ref: library/wave wave Error14671774
Ref: 424214671774
Ref: wave --- WAV ファイルの読み書き-Footnote-114672047
Node: Wave_read オブジェクト14672111
Ref: library/wave id114672254
Ref: 424314672254
Ref: library/wave wave-read-objects14672254
Ref: 424414672254
Ref: library/wave wave Wave_read14672325
Ref: 33614672325
Ref: library/wave wave Wave_read close14672510
Ref: 424014672510
Ref: library/wave wave Wave_read getnchannels14672707
Ref: 424514672707
Ref: library/wave wave Wave_read getsampwidth14672884
Ref: 424614672884
Ref: library/wave wave Wave_read getframerate14672990
Ref: 424714672990
Ref: library/wave wave Wave_read getnframes14673087
Ref: 424814673087
Ref: library/wave wave Wave_read getcomptype14673185
Ref: 424914673185
Ref: library/wave wave Wave_read getcompname14673345
Ref: 424a14673345
Ref: library/wave wave Wave_read getparams14673565
Ref: 11ec14673565
Ref: library/wave wave Wave_read readframes14673788
Ref: 424b14673788
Ref: library/wave wave Wave_read rewind14673975
Ref: 424c14673975
Ref: library/wave wave Wave_read getmarkers14674242
Ref: 33514674242
Ref: library/wave wave Wave_read getmark14674524
Ref: 33414674524
Ref: library/wave wave Wave_read setpos14674962
Ref: 424d14674962
Ref: library/wave wave Wave_read tell14675080
Ref: 424e14675080
Node: Wave_write オブジェクト14675184
Ref: library/wave id214675327
Ref: 424f14675327
Ref: library/wave wave-write-objects14675327
Ref: 11ed14675327
Ref: library/wave wave Wave_write14675400
Ref: 33714675400
Ref: library/wave wave Wave_write close14676488
Ref: 424114676488
Ref: library/wave wave Wave_write setnchannels14676835
Ref: 425214676835
Ref: library/wave wave Wave_write setsampwidth14676927
Ref: 425314676927
Ref: library/wave wave Wave_write setframerate14677039
Ref: 425414677039
Ref: library/wave wave Wave_write setnframes14677313
Ref: 425014677313
Ref: library/wave wave Wave_write setcomptype14677643
Ref: 425514677643
Ref: library/wave wave Wave_write setparams14677868
Ref: 425114677868
Ref: library/wave wave Wave_write tell14678103
Ref: 425614678103
Ref: library/wave wave Wave_write writeframesraw14678373
Ref: 11ee14678373
Ref: library/wave wave Wave_write writeframes14678654
Ref: 11ef14678654
Node: colorsys --- 色体系間の変換14679408
Ref: library/colorsys doc14679561
Ref: 425714679561
Ref: library/colorsys colorsys-conversions-between-color-systems14679561
Ref: 425814679561
Ref: library/colorsys module-colorsys14679561
Ref: 2014679561
Ref: library/colorsys translation-repo14679561
Ref: 425914679561
Ref: library/colorsys colorsys rgb_to_yiq14680522
Ref: 425a14680522
Ref: library/colorsys colorsys yiq_to_rgb14680611
Ref: 425b14680611
Ref: library/colorsys colorsys rgb_to_hls14680700
Ref: 1a7214680700
Ref: library/colorsys colorsys hls_to_rgb14680789
Ref: 425c14680789
Ref: library/colorsys colorsys rgb_to_hsv14680878
Ref: 425d14680878
Ref: library/colorsys colorsys hsv_to_rgb14680967
Ref: 425e14680967
Ref: colorsys --- 色体系間の変換-Footnote-114681284
Node: 国際化14681352
Ref: library/i18n doc14681510
Ref: 425f14681510
Ref: library/i18n i18n14681510
Ref: 426014681510
Ref: library/i18n internationalization14681510
Ref: 426114681510
Ref: library/i18n translation-repo14681510
Ref: 426214681510
Node: gettext --- 多言語国際化サービス14682058
Ref: library/gettext doc14682187
Ref: 426314682187
Ref: library/gettext gettext-multilingual-internationalization-services14682187
Ref: 426414682187
Ref: library/gettext module-gettext14682187
Ref: 6714682187
Ref: gettext --- 多言語国際化サービス-Footnote-114683193
Node: GNU gettext API14683260
Ref: library/gettext gnu-gettext-api14683385
Ref: 426514683385
Ref: library/gettext gettext bindtextdomain14683924
Ref: 426614683924
Ref: library/gettext gettext textdomain14684555
Ref: 426714684555
Ref: library/gettext gettext gettext14684951
Ref: 168214684951
Ref: library/gettext gettext dgettext14685221
Ref: 426814685221
Ref: library/gettext gettext ngettext14685393
Ref: 426914685393
Ref: library/gettext gettext dngettext14686360
Ref: 426a14686360
Ref: library/gettext gettext pgettext14686546
Ref: be814686546
Ref: library/gettext gettext dpgettext14686598
Ref: 426b14686598
Ref: library/gettext gettext npgettext14686659
Ref: 426c14686659
Ref: library/gettext gettext dnpgettext14686724
Ref: 426d14686724
Ref: GNU gettext API-Footnote-114687554
Ref: GNU gettext API-Footnote-214688034
Node: クラス形式の API14688099
Ref: library/gettext class-based-api14688284
Ref: 426e14688284
Ref: library/gettext gettext find14688817
Ref: 427014688817
Ref: library/gettext gettext translation14690699
Ref: c6d14690699
Ref: library/gettext gettext install14692229
Ref: c6e14692229
Ref: クラス形式の API-Footnote-114693322
Node: NullTranslations クラス14693417
Ref: library/gettext the-nulltranslations-class14693536
Ref: 427314693536
Ref: library/gettext gettext NullTranslations14694136
Ref: 427114694136
Ref: library/gettext gettext NullTranslations _parse14694789
Ref: 427514694789
Ref: library/gettext gettext NullTranslations add_fallback14695351
Ref: 427414695351
Ref: library/gettext gettext NullTranslations gettext14695740
Ref: 427614695740
Ref: library/gettext gettext NullTranslations ngettext14696090
Ref: 427714696090
Ref: library/gettext gettext NullTranslations pgettext14696487
Ref: 427814696487
Ref: library/gettext gettext NullTranslations npgettext14696860
Ref: 427914696860
Ref: library/gettext gettext NullTranslations info14697248
Ref: 427a14697248
Ref: library/gettext gettext NullTranslations charset14697380
Ref: 427b14697380
Ref: library/gettext gettext NullTranslations install14697511
Ref: 427214697511
Node: GNUTranslations クラス14698787
Ref: library/gettext the-gnutranslations-class14698971
Ref: 427c14698971
Ref: library/gettext gettext GNUTranslations14700606
Ref: 426f14700606
Ref: library/gettext gettext GNUTranslations gettext14700744
Ref: 427d14700744
Ref: library/gettext gettext GNUTranslations ngettext14701283
Ref: 427e14701283
Ref: library/gettext gettext GNUTranslations pgettext14702401
Ref: 427f14702401
Ref: library/gettext gettext GNUTranslations npgettext14703021
Ref: 428014703021
Ref: GNUTranslations クラス-Footnote-114703876
Node: Solaris メッセージカタログ機構のサポート14703934
Ref: library/gettext solaris-message-catalog-support14704121
Ref: 428114704121
Node: Catalog コンストラクタ14704498
Ref: library/gettext the-catalog-constructor14704651
Ref: 428214704651
Node: プログラムやモジュールを国際化する14705450
Ref: library/gettext i18n-howto14705629
Ref: 33cb14705629
Ref: library/gettext internationalizing-your-programs-and-modules14705629
Ref: 428314705629
Ref: プログラムやモジュールを国際化する-Footnote-114710037
Ref: プログラムやモジュールを国際化する-Footnote-214710070
Node: モジュールを地域化する14710113
Ref: library/gettext localizing-your-module14710285
Ref: 428414710285
Node: アプリケーションを地域化する14711029
Ref: library/gettext localizing-your-application14711258
Ref: 428514711258
Node: 動作中 on the fly に言語を切り替える14712052
Ref: library/gettext changing-languages-on-the-fly14712275
Ref: 428614712275
Node: 翻訳処理の遅延解決14713052
Ref: library/gettext deferred-translations14713224
Ref: 428714713224
Node: 謝辞<9>14715685
Ref: library/gettext acknowledgements14715833
Ref: 428814715833
Node: locale --- 国際化サービス14716264
Ref: library/locale doc14716393
Ref: 428914716393
Ref: library/locale locale-internationalization-services14716393
Ref: 428a14716393
Ref: library/locale module-locale14716393
Ref: 8a14716393
Ref: library/locale translation-repo14716393
Ref: 428b14716393
Ref: library/locale locale Error14717090
Ref: 428c14717090
Ref: library/locale locale setlocale14717237
Ref: 32814717237
Ref: library/locale locale localeconv14719298
Ref: df814719298
Ref: library/locale locale nl_langinfo14727706
Ref: 45414727706
Ref: library/locale locale CODESET14728322
Ref: 429114728322
Ref: library/locale locale D_T_FMT14728504
Ref: 429214728504
Ref: library/locale locale D_FMT14728759
Ref: 429314728759
Ref: library/locale locale T_FMT14729003
Ref: 429414729003
Ref: library/locale locale T_FMT_AMPM14729247
Ref: 429514729247
Ref: library/locale locale DAY_114729493
Ref: 429614729493
Ref: library/locale locale DAY_214729526
Ref: 429714729526
Ref: library/locale locale DAY_314729559
Ref: 429814729559
Ref: library/locale locale DAY_414729592
Ref: 429914729592
Ref: library/locale locale DAY_514729625
Ref: 429a14729625
Ref: library/locale locale DAY_614729658
Ref: 429b14729658
Ref: library/locale locale DAY_714729691
Ref: 429c14729691
Ref: library/locale locale ABDAY_114730039
Ref: 429d14730039
Ref: library/locale locale ABDAY_214730074
Ref: 429e14730074
Ref: library/locale locale ABDAY_314730109
Ref: 429f14730109
Ref: library/locale locale ABDAY_414730144
Ref: 42a014730144
Ref: library/locale locale ABDAY_514730179
Ref: 42a114730179
Ref: library/locale locale ABDAY_614730214
Ref: 42a214730214
Ref: library/locale locale ABDAY_714730249
Ref: 42a314730249
Ref: library/locale locale MON_114730368
Ref: 42a414730368
Ref: library/locale locale MON_214730401
Ref: 42a514730401
Ref: library/locale locale MON_314730434
Ref: 42a614730434
Ref: library/locale locale MON_414730467
Ref: 42a714730467
Ref: library/locale locale MON_514730500
Ref: 42a814730500
Ref: library/locale locale MON_614730533
Ref: 42a914730533
Ref: library/locale locale MON_714730566
Ref: 42aa14730566
Ref: library/locale locale MON_814730599
Ref: 42ab14730599
Ref: library/locale locale MON_914730632
Ref: 42ac14730632
Ref: library/locale locale MON_1014730665
Ref: 42ad14730665
Ref: library/locale locale MON_1114730699
Ref: 42ae14730699
Ref: library/locale locale MON_1214730733
Ref: 42af14730733
Ref: library/locale locale ABMON_114730824
Ref: 42b014730824
Ref: library/locale locale ABMON_214730859
Ref: 42b114730859
Ref: library/locale locale ABMON_314730894
Ref: 42b214730894
Ref: library/locale locale ABMON_414730929
Ref: 42b314730929
Ref: library/locale locale ABMON_514730964
Ref: 42b414730964
Ref: library/locale locale ABMON_614730999
Ref: 42b514730999
Ref: library/locale locale ABMON_714731034
Ref: 42b614731034
Ref: library/locale locale ABMON_814731069
Ref: 42b714731069
Ref: library/locale locale ABMON_914731104
Ref: 42b814731104
Ref: library/locale locale ABMON_1014731139
Ref: 42b914731139
Ref: library/locale locale ABMON_1114731175
Ref: 42ba14731175
Ref: library/locale locale ABMON_1214731211
Ref: 42bb14731211
Ref: library/locale locale RADIXCHAR14731319
Ref: 42bc14731319
Ref: library/locale locale THOUSEP14731460
Ref: 42bd14731460
Ref: library/locale locale YESEXPR14731614
Ref: 42be14731614
Ref: library/locale locale NOEXPR14731823
Ref: 42bf14731823
Ref: library/locale locale CRNCYSTR14732287
Ref: 42c014732287
Ref: library/locale locale ERA14732590
Ref: 42c114732590
Ref: library/locale locale ERA_D_T_FMT14733419
Ref: 42c214733419
Ref: library/locale locale ERA_D_FMT14733706
Ref: 42c314733706
Ref: library/locale locale ERA_T_FMT14733975
Ref: 42c414733975
Ref: library/locale locale ALT_DIGITS14734244
Ref: 42c514734244
Ref: library/locale locale getdefaultlocale14734933
Ref: 32614734933
Ref: library/locale locale getlocale14736525
Ref: 32714736525
Ref: library/locale locale getpreferredencoding14737098
Ref: 75c14737098
Ref: library/locale locale getencoding14738517
Ref: 32914738517
Ref: library/locale locale normalize14739292
Ref: 42c914739292
Ref: library/locale locale strcoll14739909
Ref: 42ca14739909
Ref: library/locale locale strxfrm14740319
Ref: 17bd14740319
Ref: library/locale locale format_string14740737
Ref: 74214740737
Ref: library/locale locale currency14741500
Ref: 42cc14741500
Ref: library/locale locale str14742333
Ref: 42cd14742333
Ref: library/locale locale delocalize14742523
Ref: 102614742523
Ref: library/locale locale localize14742734
Ref: 42ce14742734
Ref: library/locale locale atof14742955
Ref: 42cf14742955
Ref: library/locale locale atoi14743181
Ref: 42d014743181
Ref: library/locale locale LC_CTYPE14743331
Ref: 42c714743331
Ref: library/locale locale LC_COLLATE14743997
Ref: 42cb14743997
Ref: library/locale locale LC_TIME14744190
Ref: 42d114744190
Ref: library/locale locale LC_MONETARY14744398
Ref: 429014744398
Ref: library/locale locale LC_MESSAGES14744628
Ref: 42d214744628
Ref: library/locale locale LC_NUMERIC14745214
Ref: 428e14745214
Ref: library/locale locale LC_ALL14745537
Ref: 42c614745537
Ref: library/locale locale CHAR_MAX14746171
Ref: 428f14746171
Ref: locale --- 国際化サービス-Footnote-114746576
Ref: locale --- 国際化サービス-Footnote-214746642
Ref: locale --- 国際化サービス-Footnote-314746740
Ref: locale --- 国際化サービス-Footnote-414746782
Node: ロケールの背景、詳細、ヒント、助言および補足説明14746824
Ref: library/locale background-details-hints-tips-and-caveats14746986
Ref: 42d314746986
Node: Locale names14749886
Ref: library/locale locale-name14750143
Ref: 428d14750143
Ref: library/locale locale-names14750143
Ref: 42d414750143
Ref: Locale names-Footnote-114751757
Ref: Locale names-Footnote-214751907
Ref: Locale names-Footnote-314751957
Ref: Locale names-Footnote-414752013
Ref: Locale names-Footnote-514752186
Ref: Locale names-Footnote-614752275
Ref: Locale names-Footnote-714752321
Node: Python 拡張の作者と、Python を埋め込むようなプログラムに関して14752363
Ref: library/locale embedding-locale14752593
Ref: 42d514752593
Ref: library/locale for-extension-writers-and-programs-that-embed-python14752593
Ref: 42d614752593
Node: メッセージカタログへのアクセス14753524
Ref: library/locale access-to-message-catalogs14753733
Ref: 42d714753733
Ref: library/locale locale-gettext14753733
Ref: 42d814753733
Ref: library/locale locale gettext14753829
Ref: 42d914753829
Ref: library/locale locale dgettext14753866
Ref: 42da14753866
Ref: library/locale locale dcgettext14753912
Ref: 42db14753912
Ref: library/locale locale textdomain14753969
Ref: 42dc14753969
Ref: library/locale locale bindtextdomain14754012
Ref: 42dd14754012
Ref: library/locale locale bind_textdomain_codeset14754064
Ref: 42de14754064
Node: Graphical user interfaces with Tk14755274
Ref: library/tk doc14755414
Ref: 42df14755414
Ref: library/tk graphical-user-interfaces-with-tk14755414
Ref: 42e014755414
Ref: library/tk tkinter14755414
Ref: 42e114755414
Ref: library/tk translation-repo14755414
Ref: 42e214755414
Ref: Graphical user interfaces with Tk-Footnote-114757999
Node: tkinter --- Tcl/Tk の Python インターフェース14758051
Ref: library/tkinter doc14758239
Ref: 42e314758239
Ref: library/tkinter module-tkinter14758239
Ref: f614758239
Ref: library/tkinter tkinter-python-interface-to-tcl-tk14758239
Ref: 42e414758239
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-114761581
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-214761658
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-314761686
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-414761726
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-514761783
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-614761810
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-714761847
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-814761945
Ref: tkinter --- Tcl/Tk の Python インターフェース-Footnote-914761997
Node: Architecture14762056
Ref: library/tkinter architecture14762191
Ref: 42e514762191
Ref: Architecture-Footnote-114764509
Node: Tkinter モジュール14764549
Ref: library/tkinter tkinter-modules14764716
Ref: 42e714764716
Ref: library/tkinter tkinter Tk14765049
Ref: 19ac14765049
Ref: library/tkinter tkinter Tk tk14767199
Ref: 42e914767199
Ref: library/tkinter tkinter Tk master14767498
Ref: 42ea14767498
Ref: library/tkinter tkinter Tk children14768085
Ref: 42eb14768085
Ref: library/tkinter tkinter Tcl14768295
Ref: 42e814768295
Ref: library/tkinter module-_tkinter14770309
Ref: 314770309
Node: Tkinter お助け手帳14771248
Ref: library/tkinter tkinter-life-preserver14771418
Ref: 42ec14771418
Node: A Hello World Program14772271
Ref: library/tkinter a-hello-world-program14772382
Ref: 42ed14772382
Node: Important Tk Concepts14773835
Ref: library/tkinter important-tk-concepts14773993
Ref: 42ee14773993
Node: Understanding How Tkinter Wraps Tcl/Tk14775335
Ref: library/tkinter understanding-how-tkinter-wraps-tcl-tk14775501
Ref: 42ef14775501
Node: How do I ? What option does ?14777636
Ref: library/tkinter how-do-i-what-option-does14777819
Ref: 42f014777819
Node: Navigating the Tcl/Tk Reference Manual14779558
Ref: library/tkinter navigating-the-tcl-tk-reference-manual14779694
Ref: 42f114779694
Ref: Navigating the Tcl/Tk Reference Manual-Footnote-114781760
Ref: Navigating the Tcl/Tk Reference Manual-Footnote-214781817
Ref: Navigating the Tcl/Tk Reference Manual-Footnote-314781876
Ref: Navigating the Tcl/Tk Reference Manual-Footnote-414781929
Ref: Navigating the Tcl/Tk Reference Manual-Footnote-514781985
Ref: Navigating the Tcl/Tk Reference Manual-Footnote-614782044
Node: Threading model14782098
Ref: library/tkinter threading-model14782272
Ref: 42e614782272
Node: 簡単なリファレンス14785239
Ref: library/tkinter handy-reference14785414
Ref: 42f214785414
Node: オプションの設定14785748
Ref: library/tkinter setting-options14785851
Ref: 42f314785851
Ref: library/tkinter tkinter-setting-options14785851
Ref: 42f414785851
Ref: オプションの設定-Footnote-114790071
Node: Packer14790118
Ref: library/tkinter the-packer14790255
Ref: 42f514790255
Node: Packer のオプション14792134
Ref: library/tkinter packer-options14792289
Ref: 42f614792289
Node: ウィジェット変数を関連付ける14793104
Ref: library/tkinter coupling-widget-variables14793283
Ref: 42f714793283
Node: ウィンドウマネージャ14795807
Ref: library/tkinter the-window-manager14795991
Ref: 42f814795991
Node: Tk オプションデータ型14797427
Ref: library/tkinter tk-option-data-types14797596
Ref: 42f914797596
Node: バインドとイベント14801494
Ref: library/tkinter bindings-and-events14801654
Ref: 42fa14801654
Ref: library/tkinter id214801654
Ref: 42fb14801654
Ref: バインドとイベント-Footnote-114805010
Node: index パラメータ14805056
Ref: library/tkinter the-index-parameter14805192
Ref: 42fc14805192
Node: 画像14807813
Ref: library/tkinter images14807913
Ref: 42fd14807913
Ref: 画像-Footnote-114809489
Node: ファイルハンドラ14809524
Ref: library/tkinter file-handlers14809675
Ref: 42fe14809675
Ref: library/tkinter tkinter-file-handlers14809675
Ref: 42ff14809675
Ref: library/tkinter tkinter Widget tk createfilehandler14810931
Ref: 430014810931
Ref: library/tkinter tkinter Widget tk deletefilehandler14811504
Ref: 430114811504
Ref: library/tkinter tkinter READABLE14811619
Ref: 430214811619
Ref: library/tkinter tkinter WRITABLE14811652
Ref: 430314811652
Ref: library/tkinter tkinter EXCEPTION14811685
Ref: 430414811685
Node: tkinter colorchooser --- カラー選択ダイアログ14811764
Ref: library/tkinter colorchooser doc14812010
Ref: 430514812010
Ref: library/tkinter colorchooser module-tkinter colorchooser14812010
Ref: f714812010
Ref: library/tkinter colorchooser tkinter-colorchooser-color-choosing-dialog14812010
Ref: 430614812010
Ref: library/tkinter colorchooser translation-repo14812010
Ref: 430714812010
Ref: library/tkinter colorchooser tkinter colorchooser Chooser14812519
Ref: 430814812519
Ref: library/tkinter colorchooser tkinter colorchooser askcolor14812589
Ref: 430a14812589
Ref: tkinter colorchooser --- カラー選択ダイアログ-Footnote-114813071
Node: tkinter font --- Tkinter フォントラッパー14813152
Ref: library/tkinter font doc14813367
Ref: 430b14813367
Ref: library/tkinter font module-tkinter font14813367
Ref: fb14813367
Ref: library/tkinter font tkinter-font-tkinter-font-wrapper14813367
Ref: 430c14813367
Ref: library/tkinter font translation-repo14813367
Ref: 430d14813367
Ref: library/tkinter font tkinter font NORMAL14813742
Ref: 430e14813742
Ref: library/tkinter font tkinter font BOLD14813777
Ref: 430f14813777
Ref: library/tkinter font tkinter font ITALIC14813810
Ref: 431014813810
Ref: library/tkinter font tkinter font ROMAN14813845
Ref: 431114813845
Ref: library/tkinter font tkinter font Font14813880
Ref: 1cce14813880
Ref: library/tkinter font tkinter font Font actual14815188
Ref: 431214815188
Ref: library/tkinter font tkinter font Font cget14815295
Ref: 431314815295
Ref: library/tkinter font tkinter font Font config14815379
Ref: 431414815379
Ref: library/tkinter font tkinter font Font copy14815464
Ref: 431514815464
Ref: library/tkinter font tkinter font Font measure14815548
Ref: 431614815548
Ref: library/tkinter font tkinter font Font metrics14815813
Ref: 431714815813
Ref: library/tkinter font tkinter font families14816396
Ref: 431814816396
Ref: library/tkinter font tkinter font names14816504
Ref: 431914816504
Ref: library/tkinter font tkinter font nametofont14816592
Ref: 1cd014816592
Ref: tkinter font --- Tkinter フォントラッパー-Footnote-114816824
Node: Tkinter ダイアログ14816896
Ref: library/dialog doc14817117
Ref: 431a14817117
Ref: library/dialog tkinter-dialogs14817117
Ref: 431b14817117
Ref: library/dialog translation-repo14817117
Ref: 431c14817117
Node: tkinter simpledialog --- Standard Tkinter input dialogs14817487
Ref: library/dialog module-tkinter simpledialog14817656
Ref: fe14817656
Ref: library/dialog tkinter-simpledialog-standard-tkinter-input-dialogs14817656
Ref: 431d14817656
Ref: library/dialog tkinter simpledialog askfloat14818061
Ref: 431e14818061
Ref: library/dialog tkinter simpledialog askinteger14818128
Ref: 1cd114818128
Ref: library/dialog tkinter simpledialog askstring14818197
Ref: 431f14818197
Ref: library/dialog tkinter simpledialog Dialog14818396
Ref: 432014818396
Ref: library/dialog tkinter simpledialog Dialog body14818525
Ref: 432114818525
Ref: library/dialog tkinter simpledialog Dialog buttonbox14818733
Ref: 432214818733
Ref: tkinter simpledialog --- Standard Tkinter input dialogs-Footnote-114818987
Node: tkinter filedialog --- File selection dialogs14819068
Ref: library/dialog module-tkinter filedialog14819294
Ref: fa14819294
Ref: library/dialog tkinter-filedialog-file-selection-dialogs14819294
Ref: 432314819294
Ref: tkinter filedialog --- File selection dialogs-Footnote-114819757
Node: ネイティブの読み込み/保存ダイアログ14819836
Ref: library/dialog native-load-save-dialogs14819970
Ref: 432414819970
Ref: library/dialog tkinter filedialog askopenfile14821213
Ref: 432514821213
Ref: library/dialog tkinter filedialog askopenfiles14821281
Ref: 432614821281
Ref: library/dialog tkinter filedialog asksaveasfile14821477
Ref: 432814821477
Ref: library/dialog tkinter filedialog askopenfilename14821647
Ref: 432a14821647
Ref: library/dialog tkinter filedialog askopenfilenames14821709
Ref: 432b14821709
Ref: library/dialog tkinter filedialog asksaveasfilename14821921
Ref: 432c14821921
Ref: library/dialog tkinter filedialog askdirectory14822067
Ref: 432d14822067
Ref: library/dialog tkinter filedialog Open14822294
Ref: 432714822294
Ref: library/dialog tkinter filedialog SaveAs14822358
Ref: 432914822358
Ref: library/dialog tkinter filedialog Directory14822682
Ref: 432e14822682
Ref: library/dialog tkinter filedialog FileDialog14822920
Ref: 432f14822920
Ref: library/dialog tkinter filedialog FileDialog cancel_command14823031
Ref: 433014823031
Ref: library/dialog tkinter filedialog FileDialog dirs_double_event14823140
Ref: 433114823140
Ref: library/dialog tkinter filedialog FileDialog dirs_select_event14823252
Ref: 433214823252
Ref: library/dialog tkinter filedialog FileDialog files_double_event14823357
Ref: 433314823357
Ref: library/dialog tkinter filedialog FileDialog files_select_event14823465
Ref: 433414823465
Ref: library/dialog tkinter filedialog FileDialog filter_command14823573
Ref: 433514823573
Ref: library/dialog tkinter filedialog FileDialog get_filter14823667
Ref: 433614823667
Ref: library/dialog tkinter filedialog FileDialog get_selection14823759
Ref: 433714823759
Ref: library/dialog tkinter filedialog FileDialog go14823849
Ref: 433814823849
Ref: library/dialog tkinter filedialog FileDialog ok_event14823997
Ref: 433914823997
Ref: library/dialog tkinter filedialog FileDialog quit14824090
Ref: 433a14824090
Ref: library/dialog tkinter filedialog FileDialog set_filter14824181
Ref: 433b14824181
Ref: library/dialog tkinter filedialog FileDialog set_selection14824259
Ref: 433c14824259
Ref: library/dialog tkinter filedialog LoadFileDialog14824360
Ref: 433d14824360
Ref: library/dialog tkinter filedialog LoadFileDialog ok_command14824528
Ref: 433e14824528
Ref: library/dialog tkinter filedialog SaveFileDialog14824675
Ref: 433f14824675
Ref: library/dialog tkinter filedialog SaveFileDialog ok_command14824845
Ref: 434014824845
Node: tkinter commondialog --- Dialog window templates14825063
Ref: library/dialog module-tkinter commondialog14825225
Ref: f814825225
Ref: library/dialog tkinter-commondialog-dialog-window-templates14825225
Ref: 434114825225
Ref: library/dialog tkinter commondialog Dialog14825613
Ref: 430914825613
Ref: library/dialog tkinter commondialog Dialog show14825682
Ref: 434214825682
Ref: tkinter commondialog --- Dialog window templates-Footnote-114825895
Node: tkinter messagebox --- Tkinter メッセージプロンプト14825976
Ref: library/tkinter messagebox doc14826227
Ref: 434314826227
Ref: library/tkinter messagebox module-tkinter messagebox14826227
Ref: fc14826227
Ref: library/tkinter messagebox tkinter-messagebox-tkinter-message-prompts14826227
Ref: 434414826227
Ref: library/tkinter messagebox translation-repo14826227
Ref: 434514826227
Ref: library/tkinter messagebox tkinter messagebox Message14826947
Ref: 434a14826947
Ref: library/tkinter messagebox tkinter messagebox Message show14829092
Ref: 434f14829092
Ref: library/tkinter messagebox tkinter messagebox showinfo14829413
Ref: 435014829413
Ref: library/tkinter messagebox tkinter messagebox showwarning14829639
Ref: 435114829639
Ref: library/tkinter messagebox tkinter messagebox showerror14829826
Ref: 435214829826
Ref: library/tkinter messagebox tkinter messagebox askquestion14830047
Ref: 435314830047
Ref: library/tkinter messagebox tkinter messagebox askokcancel14830298
Ref: 435414830298
Ref: library/tkinter messagebox tkinter messagebox askretrycancel14830564
Ref: 435514830564
Ref: library/tkinter messagebox tkinter messagebox askyesno14830839
Ref: 435714830839
Ref: library/tkinter messagebox tkinter messagebox askyesnocancel14831077
Ref: 435814831077
Ref: library/tkinter messagebox messagebox-buttons14831371
Ref: 434b14831371
Ref: library/tkinter messagebox tkinter messagebox ABORT14831399
Ref: 435914831399
Ref: library/tkinter messagebox tkinter messagebox RETRY14831450
Ref: 435614831450
Ref: library/tkinter messagebox tkinter messagebox IGNORE14831501
Ref: 435a14831501
Ref: library/tkinter messagebox tkinter messagebox OK14831554
Ref: 434614831554
Ref: library/tkinter messagebox tkinter messagebox CANCEL14831599
Ref: 434714831599
Ref: library/tkinter messagebox tkinter messagebox YES14831652
Ref: 434814831652
Ref: library/tkinter messagebox tkinter messagebox NO14831699
Ref: 434914831699
Ref: library/tkinter messagebox messagebox-types14831743
Ref: 434e14831743
Ref: library/tkinter messagebox tkinter messagebox ABORTRETRYIGNORE14831772
Ref: 435b14831772
Ref: library/tkinter messagebox tkinter messagebox OKCANCEL14832076
Ref: 435c14832076
Ref: library/tkinter messagebox tkinter messagebox RETRYCANCEL14832230
Ref: 435d14832230
Ref: library/tkinter messagebox tkinter messagebox YESNO14832393
Ref: 435e14832393
Ref: library/tkinter messagebox tkinter messagebox YESNOCANCEL14832538
Ref: 435f14832538
Ref: library/tkinter messagebox messagebox-icons14832716
Ref: 434c14832716
Ref: library/tkinter messagebox tkinter messagebox ERROR14832730
Ref: 436014832730
Ref: library/tkinter messagebox tkinter messagebox INFO14832781
Ref: 434d14832781
Ref: library/tkinter messagebox tkinter messagebox QUESTION14832830
Ref: 436114832830
Ref: library/tkinter messagebox tkinter messagebox WARNING14832887
Ref: 436214832887
Ref: tkinter messagebox --- Tkinter メッセージプロンプト-Footnote-114832978
Node: tkinter scrolledtext --- スクロール可能なテキストウィジェット14833057
Ref: library/tkinter scrolledtext doc14833349
Ref: 436314833349
Ref: library/tkinter scrolledtext module-tkinter scrolledtext14833349
Ref: fd14833349
Ref: library/tkinter scrolledtext tkinter-scrolledtext-scrolled-text-widget14833349
Ref: 436414833349
Ref: library/tkinter scrolledtext translation-repo14833349
Ref: 436514833349
Ref: library/tkinter scrolledtext tkinter scrolledtext ScrolledText14834428
Ref: 436614834428
Ref: library/tkinter scrolledtext tkinter scrolledtext ScrolledText frame14834498
Ref: 436714834498
Ref: library/tkinter scrolledtext tkinter scrolledtext ScrolledText vbar14834621
Ref: 436814834621
Ref: tkinter scrolledtext --- スクロール可能なテキストウィジェット-Footnote-114834737
Node: tkinter dnd --- ドラッグアンドドロップのサポート14834818
Ref: library/tkinter dnd doc14835104
Ref: 436914835104
Ref: library/tkinter dnd module-tkinter dnd14835104
Ref: f914835104
Ref: library/tkinter dnd tkinter-dnd-drag-and-drop-support14835104
Ref: 436a14835104
Ref: library/tkinter dnd translation-repo14835104
Ref: 436b14835104
Ref: library/tkinter dnd tkinter dnd DndHandler14836648
Ref: 436d14836648
Ref: library/tkinter dnd tkinter dnd DndHandler cancel14836840
Ref: 436e14836840
Ref: library/tkinter dnd tkinter dnd DndHandler finish14836929
Ref: 436f14836929
Ref: library/tkinter dnd tkinter dnd DndHandler on_motion14837029
Ref: 437014837029
Ref: library/tkinter dnd tkinter dnd DndHandler on_release14837161
Ref: 437114837161
Ref: library/tkinter dnd tkinter dnd dnd_start14837273
Ref: 436c14837273
Ref: tkinter dnd --- ドラッグアンドドロップのサポート-Footnote-114837468
Node: tkinter ttk --- Tk のテーマ付きウィジェット14837539
Ref: library/tkinter ttk doc14837792
Ref: 437214837792
Ref: library/tkinter ttk module-tkinter ttk14837792
Ref: ff14837792
Ref: library/tkinter ttk tkinter-ttk-tk-themed-widgets14837792
Ref: 437314837792
Ref: library/tkinter ttk translation-repo14837792
Ref: 437414837792
Ref: tkinter ttk --- Tk のテーマ付きウィジェット-Footnote-114838841
Ref: tkinter ttk --- Tk のテーマ付きウィジェット-Footnote-214838912
Node: Ttk を使う14838965
Ref: library/tkinter ttk using-ttk14839101
Ref: 437514839101
Ref: Ttk を使う-Footnote-114840555
Node: Ttk ウィジェット14840619
Ref: library/tkinter ttk ttk-widgets14840782
Ref: 437614840782
Node: ウィジェット14842065
Ref: library/tkinter ttk widget14842236
Ref: 437c14842236
Node: 標準オプション14842729
Ref: library/tkinter ttk standard-options14842871
Ref: 437d14842871
Node: スクロール可能ウィジェットのオプション14844860
Ref: library/tkinter ttk scrollable-widget-options14845035
Ref: 437e14845035
Node: ラベルオプション14846323
Ref: library/tkinter ttk label-options14846501
Ref: 437f14846501
Node: 互換性オプション14849288
Ref: library/tkinter ttk compatibility-options14849436
Ref: 438014849436
Node: ウィジェットの状態14850037
Ref: library/tkinter ttk widget-states14850171
Ref: 438214850171
Node: ttk Widget14852141
Ref: library/tkinter ttk ttk-widget14852242
Ref: 438314852242
Ref: library/tkinter ttk tkinter ttk Widget14852484
Ref: 437a14852484
Ref: library/tkinter ttk tkinter ttk Widget identify14852519
Ref: 438414852519
Ref: library/tkinter ttk tkinter ttk Widget instate14852797
Ref: 438514852797
Ref: library/tkinter ttk tkinter ttk Widget state14853362
Ref: 438114853362
Node: コンボボックス14853887
Ref: library/tkinter ttk combobox14854043
Ref: 438614854043
Node: オプション14854879
Ref: library/tkinter ttk options14854979
Ref: 438714854979
Node: 仮想イベント14857679
Ref: library/tkinter ttk virtual-events14857800
Ref: 438814857800
Node: ttk Combobox14858019
Ref: library/tkinter ttk ttk-combobox14858116
Ref: 438914858116
Ref: library/tkinter ttk tkinter ttk Combobox14858163
Ref: 437714858163
Ref: library/tkinter ttk tkinter ttk Combobox current14858200
Ref: 438a14858200
Ref: library/tkinter ttk tkinter ttk Combobox get14858608
Ref: 438b14858608
Ref: library/tkinter ttk tkinter ttk Combobox set14858705
Ref: 438c14858705
Node: Spinbox14858813
Ref: library/tkinter ttk spinbox14858969
Ref: 438d14858969
Node: オプション<2>14859814
Ref: library/tkinter ttk id114859906
Ref: 438e14859906
Node: 仮想イベント<2>14862326
Ref: library/tkinter ttk id214862438
Ref: 438f14862438
Node: ttk Spinbox14862648
Ref: library/tkinter ttk ttk-spinbox14862733
Ref: 439014862733
Ref: library/tkinter ttk tkinter ttk Spinbox14862778
Ref: d8d14862778
Ref: library/tkinter ttk tkinter ttk Spinbox get14862814
Ref: 439114862814
Ref: library/tkinter ttk tkinter ttk Spinbox set14862898
Ref: 439214862898
Node: ノートブック14862987
Ref: library/tkinter ttk notebook14863143
Ref: 439314863143
Node: オプション<3>14863670
Ref: library/tkinter ttk id314863773
Ref: 439414863773
Node: タブオプション14865093
Ref: library/tkinter ttk tab-options14865220
Ref: 439514865220
Node: タブ識別子14867401
Ref: library/tkinter ttk tab-identifiers14867531
Ref: 439714867531
Node: 仮想イベント<3>14868018
Ref: library/tkinter ttk id414868139
Ref: 439914868139
Node: ttk Notebook14868325
Ref: library/tkinter ttk ttk-notebook14868422
Ref: 439a14868422
Ref: library/tkinter ttk tkinter ttk Notebook14868469
Ref: 437814868469
Ref: library/tkinter ttk tkinter ttk Notebook add14868506
Ref: 439b14868506
Ref: library/tkinter ttk tkinter ttk Notebook forget14868913
Ref: 439c14868913
Ref: library/tkinter ttk tkinter ttk Notebook hide14869129
Ref: 439d14869129
Ref: library/tkinter ttk tkinter ttk Notebook identify14869509
Ref: 439e14869509
Ref: library/tkinter ttk tkinter ttk Notebook index14869679
Ref: 439814869679
Ref: library/tkinter ttk tkinter ttk Notebook insert14869884
Ref: 439f14869884
Ref: library/tkinter ttk tkinter ttk Notebook select14870401
Ref: 43a014870401
Ref: library/tkinter ttk tkinter ttk Notebook tab14870836
Ref: 43a114870836
Ref: library/tkinter ttk tkinter ttk Notebook tabs14871308
Ref: 43a214871308
Ref: library/tkinter ttk tkinter ttk Notebook enable_traversal14871439
Ref: 439614871439
Node: プログレスバー14872623
Ref: library/tkinter ttk progressbar14872787
Ref: 43a314872787
Node: オプション<4>14873287
Ref: library/tkinter ttk id514873387
Ref: 43a414873387
Node: ttk Progressbar14875404
Ref: library/tkinter ttk ttk-progressbar14875504
Ref: 43a514875504
Ref: library/tkinter ttk tkinter ttk Progressbar14875557
Ref: 437914875557
Ref: library/tkinter ttk tkinter ttk Progressbar start14875597
Ref: 43a614875597
Ref: library/tkinter ttk tkinter ttk Progressbar step14875961
Ref: 43a714875961
Ref: library/tkinter ttk tkinter ttk Progressbar stop14876196
Ref: 43a814876196
Node: セパレータ14876459
Ref: library/tkinter ttk separator14876626
Ref: 43a914876626
Node: オプション<5>14876920
Ref: library/tkinter ttk id614876990
Ref: 43aa14876990
Node: サイズグリップ14877397
Ref: library/tkinter ttk sizegrip14877561
Ref: 43ab14877561
Node: プラットフォーム固有のメモ14878079
Ref: library/tkinter ttk platform-specific-notes14878191
Ref: 43ac14878191
Node: バグ14878561
Ref: library/tkinter ttk bugs14878673
Ref: 43ad14878673
Node: ツリービュー14879099
Ref: library/tkinter ttk treeview14879264
Ref: 43ae14879264
Node: オプション<6>14881132
Ref: library/tkinter ttk id714881235
Ref: 43b214881235
Node: 要素オプション14884022
Ref: library/tkinter ttk item-options14884155
Ref: 43b314884155
Node: タグオプション14885387
Ref: library/tkinter ttk tag-options14885520
Ref: 43b414885520
Node: カラム識別子14886264
Ref: library/tkinter ttk column-identifiers14886397
Ref: 43af14886397
Node: 仮想イベント<4>14887554
Ref: library/tkinter ttk id814887678
Ref: 43b514887678
Node: ttk Treeview14888653
Ref: library/tkinter ttk ttk-treeview14888750
Ref: 43b714888750
Ref: library/tkinter ttk tkinter ttk Treeview14888797
Ref: c8714888797
Ref: library/tkinter ttk tkinter ttk Treeview bbox14888834
Ref: 43b814888834
Ref: library/tkinter ttk tkinter ttk Treeview get_children14889459
Ref: 43b914889459
Ref: library/tkinter ttk tkinter ttk Treeview set_children14889689
Ref: 43ba14889689
Ref: library/tkinter ttk tkinter ttk Treeview column14890190
Ref: 43bb14890190
Ref: library/tkinter ttk tkinter ttk Treeview delete14891914
Ref: 43bc14891914
Ref: library/tkinter ttk tkinter ttk Treeview detach14892092
Ref: 43bd14892092
Ref: library/tkinter ttk tkinter ttk Treeview exists14892496
Ref: 43be14892496
Ref: library/tkinter ttk tkinter ttk Treeview focus14892629
Ref: 43b614892629
Ref: library/tkinter ttk tkinter ttk Treeview heading14892964
Ref: 43bf14892964
Ref: library/tkinter ttk tkinter ttk Treeview identify14894209
Ref: 43c014894209
Ref: library/tkinter ttk tkinter ttk Treeview identify_row14894842
Ref: 43c114894842
Ref: library/tkinter ttk tkinter ttk Treeview identify_column14894965
Ref: 43c214894965
Ref: library/tkinter ttk tkinter ttk Treeview identify_region14895196
Ref: 43c314895196
Ref: library/tkinter ttk tkinter ttk Treeview identify_element14895901
Ref: 43c414895901
Ref: library/tkinter ttk tkinter ttk Treeview index14896079
Ref: 43c514896079
Ref: library/tkinter ttk tkinter ttk Treeview insert14896217
Ref: 43c614896217
Ref: library/tkinter ttk tkinter ttk Treeview item14897225
Ref: 43c714897225
Ref: library/tkinter ttk tkinter ttk Treeview move14897756
Ref: 43c814897756
Ref: library/tkinter ttk tkinter ttk Treeview next14898263
Ref: 43c914898263
Ref: library/tkinter ttk tkinter ttk Treeview parent14898449
Ref: 43ca14898449
Ref: library/tkinter ttk tkinter ttk Treeview prev14898607
Ref: 43cb14898607
Ref: library/tkinter ttk tkinter ttk Treeview reattach14898793
Ref: 43cc14898793
Ref: library/tkinter ttk tkinter ttk Treeview see14898916
Ref: 43cd14898916
Ref: library/tkinter ttk tkinter ttk Treeview selection14899235
Ref: c8614899235
Ref: library/tkinter ttk tkinter ttk Treeview selection_set14899496
Ref: c8814899496
Ref: library/tkinter ttk tkinter ttk Treeview selection_add14899767
Ref: 43ce14899767
Ref: library/tkinter ttk tkinter ttk Treeview selection_remove14900038
Ref: 43cf14900038
Ref: library/tkinter ttk tkinter ttk Treeview selection_toggle14900312
Ref: 43d014900312
Ref: library/tkinter ttk tkinter ttk Treeview set14900597
Ref: 43d114900597
Ref: library/tkinter ttk tkinter ttk Treeview tag_bind14901059
Ref: 43d214901059
Ref: library/tkinter ttk tkinter ttk Treeview tag_configure14901418
Ref: 43d314901418
Ref: library/tkinter ttk tkinter ttk Treeview tag_has14901954
Ref: 43d414901954
Ref: library/tkinter ttk tkinter ttk Treeview xview14902367
Ref: 43b014902367
Ref: library/tkinter ttk tkinter ttk Treeview yview14902524
Ref: 43b114902524
Node: Ttk スタイル14902681
Ref: library/tkinter ttk ttk-styling14902816
Ref: 43d514902816
Ref: library/tkinter ttk ttkstyling14902816
Ref: 437b14902816
Ref: library/tkinter ttk tkinter ttk Style14903631
Ref: 56014903631
Ref: library/tkinter ttk tkinter ttk Style configure14903762
Ref: 43d614903762
Ref: library/tkinter ttk tkinter ttk Style map14904605
Ref: 1ce614904605
Ref: library/tkinter ttk tkinter ttk Style lookup14906126
Ref: 43d714906126
Ref: library/tkinter ttk tkinter ttk Style layout14906808
Ref: 43d814906808
Ref: library/tkinter ttk tkinter ttk Style element_create14908372
Ref: 55f14908372
Ref: library/tkinter ttk tkinter ttk Style element_names14914036
Ref: 43da14914036
Ref: library/tkinter ttk tkinter ttk Style element_options14914167
Ref: 43db14914167
Ref: library/tkinter ttk tkinter ttk Style theme_create14914295
Ref: 43dc14914295
Ref: library/tkinter ttk tkinter ttk Style theme_settings14914837
Ref: 43dd14914837
Ref: library/tkinter ttk tkinter ttk Style theme_names14916397
Ref: 43de14916397
Ref: library/tkinter ttk tkinter ttk Style theme_use14916505
Ref: 43df14916505
Ref: Ttk スタイル-Footnote-114916941
Node: レイアウト14917003
Ref: library/tkinter ttk layouts14917071
Ref: 43d914917071
Ref: library/tkinter ttk layout14918345
Ref: 43e014918345
Node: IDLE --- Python のエディタとシェル<2>14918346
Ref: library/idle doc14918561
Ref: 43e114918561
Ref: library/idle idle14918561
Ref: 121714918561
Ref: library/idle idle-python-editor-and-shell14918561
Ref: 43e214918561
Ref: library/idle translation-repo14918561
Ref: 43e314918561
Ref: IDLE --- Python のエディタとシェル<2>-Footnote-114920254
Node: メニュー14920319
Ref: library/idle menus14920445
Ref: 43e414920445
Node: File メニュー Shell ウィンドウ、Editor ウィンドウ14922583
Ref: library/idle file-menu-shell-and-editor14922769
Ref: 43e514922769
Node: Edit メニュー Shell ウィンドウ、Editor ウィンドウ14925341
Ref: library/idle edit-menu-shell-and-editor14925602
Ref: 43e614925602
Node: Format メニュー Shell ウィンドウ、Editor ウィンドウ14928164
Ref: library/idle format-menu14928406
Ref: 43e914928406
Ref: library/idle format-menu-editor-window-only14928406
Ref: 43ea14928406
Node: Run メニュー Editor ウィンドウのみ14930385
Ref: library/idle run-menu-editor-window-only14930609
Ref: 43ec14930609
Ref: library/idle run-module14930713
Ref: 43ed14930713
Ref: library/idle run-custom14931434
Ref: 43ef14931434
Ref: library/idle check-module14931694
Ref: 43ee14931694
Ref: library/idle python-shell14932157
Ref: 43f014932157
Node: Shell メニュー Shell ウィンドウのみ14932259
Ref: library/idle shell-menu-shell-window-only14932463
Ref: 43f114932463
Node: Debug メニュー Shell ウィンドウのみ14933180
Ref: library/idle debug-menu-shell-window-only14933406
Ref: 43f214933406
Node: Options メニュー Shell ウィンドウ、Editor ウィンドウ14934829
Ref: library/idle options-menu-shell-and-editor14935075
Ref: 43f314935075
Node: Window メニュー Shell ウィンドウ、Editor ウィンドウ14936934
Ref: library/idle window-menu-shell-and-editor14937198
Ref: 43f614937198
Node: Help メニュー Shell ウィンドウ、Editor ウィンドウ14937451
Ref: library/idle help-menu-shell-and-editor14937661
Ref: 43f714937661
Node: Context menus14938936
Ref: library/idle context-menus14939071
Ref: 43f914939071
Node: Editing and Navigation14940876
Ref: library/idle editing-and-navigation14941037
Ref: 43fa14941037
Ref: library/idle id114941037
Ref: 43fb14941037
Node: Editor windows14941382
Ref: library/idle editor-windows14941476
Ref: 43fc14941476
Node: Key bindings14942090
Ref: library/idle key-bindings14942214
Ref: 43fd14942214
Node: 自動的な字下げ14943716
Ref: library/idle automatic-indentation14943841
Ref: 43fe14943841
Node: 検索と置換14944587
Ref: library/idle search-and-replace14944718
Ref: 43ff14944718
Node: 補完 Completions14945041
Ref: library/idle completions14945181
Ref: 43e714945181
Ref: library/idle id214945181
Ref: 440014945181
Node: 呼び出しヒント Calltips14947820
Ref: library/idle calltips14947957
Ref: 43e814947957
Ref: library/idle id314947957
Ref: 440114947957
Node: Format block14949608
Ref: library/idle format-block14949739
Ref: 43eb14949739
Ref: library/idle id414949739
Ref: 440214949739
Node: Code Context14950258
Ref: library/idle code-context14950371
Ref: 43f514950371
Ref: library/idle id514950371
Ref: 440314950371
Node: Shell window14951259
Ref: library/idle shell-window14951378
Ref: 440414951378
Node: テキストの色14953053
Ref: library/idle text-colors14953151
Ref: 440514953151
Node: Startup and Code Execution14954599
Ref: library/idle startup-and-code-execution14954768
Ref: 440614954768
Node: コマンドラインでの使用<5>14956155
Ref: library/idle command-line-usage14956278
Ref: 440714956278
Ref: library/idle idlelib-cli14956278
Ref: 440814956278
Ref: library/idle cmdoption-idle-c14956528
Ref: 440914956528
Ref: library/idle cmdoption-idle-d14956740
Ref: 440a14956740
Ref: library/idle cmdoption-idle-e14956809
Ref: 440b14956809
Ref: library/idle cmdoption-idle-h14956854
Ref: 440c14956854
Ref: library/idle cmdoption-idle-i14956942
Ref: 440d14956942
Ref: library/idle cmdoption-idle-r14956985
Ref: 440e14956985
Ref: library/idle cmdoption-idle-s14957058
Ref: 440f14957058
Ref: library/idle cmdoption-idle-t14957233
Ref: 441014957233
Ref: library/idle cmdoption-idle-014957298
Ref: 441114957298
Node: Startup failure14957885
Ref: library/idle startup-failure14958034
Ref: 441214958034
Node: Running user code14961208
Ref: library/idle running-user-code14961341
Ref: 441314961341
Node: User output in Shell14964121
Ref: library/idle user-output-in-shell14964270
Ref: 441414964270
Node: Developing tkinter applications14967340
Ref: library/idle developing-tkinter-applications14967520
Ref: 441514967520
Node: サブプロセスを起こさずに起動する14968769
Ref: library/idle running-without-a-subprocess14968920
Ref: 441614968920
Node: Help and Preferences14970987
Ref: library/idle help-and-preferences14971180
Ref: 441714971180
Node: Help sources14971354
Ref: library/idle help-sources14971469
Ref: 43f814971469
Ref: library/idle id614971469
Ref: 441814971469
Node: Setting preferences [お好み設定]14972327
Ref: library/idle preferences14972464
Ref: 43f414972464
Ref: library/idle setting-preferences14972464
Ref: 441914972464
Node: IDLE on macOS14973502
Ref: library/idle idle-on-macos14973646
Ref: 441a14973646
Node: Extensions [拡張]14973905
Ref: library/idle extensions14974003
Ref: 441b14974003
Node: idlelib --- implementation of IDLE application14974370
Ref: library/idle idlelib-implementation-of-idle-application14974528
Ref: 441c14974528
Ref: library/idle module-idlelib14974528
Ref: 7714974528
Ref: idlelib --- implementation of IDLE application-Footnote-114975228
Ref: idlelib --- implementation of IDLE application-Footnote-214975292
Node: turtle --- Turtle graphics14975334
Ref: library/turtle doc14975485
Ref: 441d14975485
Ref: library/turtle module-turtle14975485
Ref: 10714975485
Ref: library/turtle translation-repo14975485
Ref: 441e14975485
Ref: library/turtle turtle-turtle-graphics14975485
Ref: 441f14975485
Ref: turtle --- Turtle graphics-Footnote-114976230
Node: はじめに<12>14976296
Ref: library/turtle introduction14976395
Ref: 442014976395
Ref: はじめに<12>-Footnote-114976910
Node: Get started14976963
Ref: library/turtle get-started14977095
Ref: 442114977095
Node: チュートリアル<4>14978343
Ref: library/turtle turtle-tutorial14978465
Ref: 442214978465
Ref: library/turtle tutorial14978465
Ref: 442314978465
Node: Starting a turtle environment14978717
Ref: library/turtle starting-a-turtle-environment14978829
Ref: 442414978829
Node: Basic drawing14979142
Ref: library/turtle basic-drawing14979290
Ref: 442514979290
Node: Pen の制御14979929
Ref: library/turtle pen-control14980022
Ref: 442614980022
Node: The turtle's position14980353
Ref: library/turtle the-turtle-s-position14980446
Ref: 442714980446
Node: Making algorithmic patterns14980885
Ref: library/turtle making-algorithmic-patterns14980995
Ref: 442814980995
Node: How to14981968
Ref: library/turtle how-to14982104
Ref: 442914982104
Ref: library/turtle turtle-how-to14982104
Ref: 442a14982104
Node: Get started as quickly as possible14982413
Ref: library/turtle get-started-as-quickly-as-possible14982534
Ref: 442b14982534
Ref: library/turtle note14983286
Ref: 442c14983286
Node: Automatically begin and end filling14983554
Ref: library/turtle automatically-begin-and-end-filling14983715
Ref: 442d14983715
Node: Use the turtle module namespace14984292
Ref: library/turtle use-the-turtle-module-namespace14984450
Ref: 443014984450
Node: Use turtle graphics in a script14985112
Ref: library/turtle use-turtle-graphics-in-a-script14985270
Ref: 443114985270
Node: Use object-oriented turtle graphics14985962
Ref: library/turtle use-object-oriented-turtle-graphics14986080
Ref: 443214986080
Node: Turtle graphics reference14987300
Ref: library/turtle turtle-graphics-reference14987465
Ref: 443514987465
Node: Turtle のメソッド14987832
Ref: library/turtle turtle-methods14987960
Ref: 443614987960
Node: TurtleScreen/Screen のメソッド14991104
Ref: library/turtle methods-of-turtlescreen-screen14991232
Ref: 448114991232
Node: RawTurtle/Turtle のメソッドと対応する関数14992683
Ref: library/turtle methods-of-rawturtle-turtle-and-corresponding-functions14992898
Ref: 44a014992898
Node: Turtle の動き14993363
Ref: library/turtle turtle-motion14993503
Ref: 44a114993503
Ref: library/turtle turtle forward14993557
Ref: 360f14993557
Ref: library/turtle turtle fd14993598
Ref: 443714993598
Ref: library/turtle turtle back14994067
Ref: 443a14994067
Ref: library/turtle turtle bk14994105
Ref: 443914994105
Ref: library/turtle turtle backward14994141
Ref: 443814994141
Ref: library/turtle turtle right14994550
Ref: 443b14994550
Ref: library/turtle turtle rt14994586
Ref: 443c14994586
Ref: library/turtle turtle left14995173
Ref: 443d14995173
Ref: library/turtle turtle lt14995208
Ref: 443e14995208
Ref: library/turtle turtle goto14995793
Ref: 443f14995793
Ref: library/turtle turtle setpos14995832
Ref: 444014995832
Ref: library/turtle turtle setposition14995873
Ref: 444114995873
Ref: library/turtle turtle teleport14996728
Ref: 1a9714996728
Ref: library/turtle turtle setx14997743
Ref: 444214997743
Ref: library/turtle turtle sety14998086
Ref: 444314998086
Ref: library/turtle turtle setheading14998428
Ref: 444414998428
Ref: library/turtle turtle seth14998472
Ref: 444514998472
Ref: library/turtle turtle home14999344
Ref: 444614999344
Ref: library/turtle turtle circle14999822
Ref: 444714999822
Ref: library/turtle turtle dot15001365
Ref: 444815001365
Ref: library/turtle turtle stamp15002099
Ref: 444915002099
Ref: library/turtle turtle clearstamp15002528
Ref: 444a15002528
Ref: library/turtle turtle clearstamps15003091
Ref: 444b15003091
Ref: library/turtle turtle undo15003694
Ref: 444c15003694
Ref: library/turtle turtle speed15004086
Ref: 444d15004086
Node: Turtle の状態を知る15005350
Ref: library/turtle tell-turtle-s-state15005514
Ref: 44a315005514
Ref: library/turtle turtle position15005583
Ref: 444e15005583
Ref: library/turtle turtle pos15005617
Ref: 444f15005617
Ref: library/turtle turtle towards15005805
Ref: 445015005805
Ref: library/turtle turtle xcor15006379
Ref: 445115006379
Ref: library/turtle turtle ycor15006667
Ref: 445215006667
Ref: library/turtle turtle heading15006962
Ref: 445315006962
Ref: library/turtle turtle distance15007276
Ref: 445415007276
Node: 設定と計測15007974
Ref: library/turtle settings-for-measurement15008138
Ref: 44a415008138
Ref: library/turtle turtle degrees15008188
Ref: 445515008188
Ref: library/turtle turtle radians15008875
Ref: 445615008875
Node: Pen の制御<2>15009219
Ref: library/turtle id115009379
Ref: 44a515009379
Node: 描画状態15009539
Ref: library/turtle drawing-state15009628
Ref: 44a615009628
Ref: library/turtle turtle pendown15009673
Ref: 445715009673
Ref: library/turtle turtle pd15009706
Ref: 445815009706
Ref: library/turtle turtle down15009734
Ref: 445915009734
Ref: library/turtle turtle penup15009832
Ref: 445a15009832
Ref: library/turtle turtle pu15009863
Ref: 445b15009863
Ref: library/turtle turtle up15009891
Ref: 445c15009891
Ref: library/turtle turtle pensize15009990
Ref: 445d15009990
Ref: library/turtle turtle width15010033
Ref: 445e15010033
Ref: library/turtle turtle pen15010537
Ref: 445f15010537
Ref: library/turtle turtle isdown15012461
Ref: 446015012461
Node: 色の制御<2>15012762
Ref: library/turtle color-control15012875
Ref: 44a715012875
Ref: library/turtle turtle pencolor15012920
Ref: 446215012920
Ref: library/turtle turtle fillcolor15014841
Ref: 446315014841
Ref: library/turtle turtle color15016711
Ref: 446115016711
Node: 塗りつぶし15018325
Ref: library/turtle filling15018453
Ref: 44a815018453
Ref: library/turtle turtle filling15018503
Ref: 446415018503
Ref: library/turtle turtle fill15018763
Ref: 2a315018763
Ref: library/turtle turtle begin_fill15019307
Ref: 442e15019307
Ref: library/turtle turtle end_fill15019405
Ref: 442f15019405
Node: さらなる描画の制御15019993
Ref: library/turtle more-drawing-control15020097
Ref: 44a915020097
Ref: library/turtle turtle reset15020167
Ref: 446515020167
Ref: library/turtle turtle clear15020670
Ref: 446615020670
Ref: library/turtle turtle write15020940
Ref: 446715020940
Node: タートルの状態15021770
Ref: library/turtle turtle-state15021942
Ref: 44aa15021942
Node: 可視性15022040
Ref: library/turtle visibility15022125
Ref: 44ab15022125
Ref: library/turtle turtle hideturtle15022165
Ref: 446a15022165
Ref: library/turtle turtle ht15022201
Ref: 446b15022201
Ref: library/turtle turtle showturtle15022529
Ref: 446815022529
Ref: library/turtle turtle st15022565
Ref: 446915022565
Ref: library/turtle turtle isvisible15022681
Ref: 446c15022681
Node: 見た目15023011
Ref: library/turtle appearance15023096
Ref: 44ac15023096
Ref: library/turtle turtle shape15023136
Ref: 446d15023136
Ref: library/turtle turtle resizemode15023932
Ref: 446e15023932
Ref: library/turtle turtle shapesize15025040
Ref: 446f15025040
Ref: library/turtle turtle turtlesize15025133
Ref: 447015025133
Ref: library/turtle turtle shearfactor15026251
Ref: 447115026251
Ref: library/turtle turtle tilt15026917
Ref: 447215026917
Ref: library/turtle turtle tiltangle15027391
Ref: 92f15027391
Ref: library/turtle turtle shapetransform15028115
Ref: 447315028115
Ref: library/turtle turtle get_shapepoly15029145
Ref: 447415029145
Node: イベントを利用する15029517
Ref: library/turtle using-events15029705
Ref: 44ad15029705
Ref: library/turtle turtle onrelease15030764
Ref: 447615030764
Ref: library/turtle turtle ondrag15031920
Ref: 447715031920
Node: 特別な Turtle のメソッド15033022
Ref: library/turtle special-turtle-methods15033204
Ref: 44ae15033204
Ref: library/turtle turtle poly15033285
Ref: 2a415033285
Ref: library/turtle turtle begin_poly15033629
Ref: 447815033629
Ref: library/turtle turtle end_poly15033781
Ref: 447915033781
Ref: library/turtle turtle get_poly15033982
Ref: 447a15033982
Ref: library/turtle turtle clone15034403
Ref: 447b15034403
Ref: library/turtle turtle getturtle15034629
Ref: 447c15034629
Ref: library/turtle turtle getpen15034664
Ref: 447d15034664
Ref: library/turtle turtle getscreen15034967
Ref: 447e15034967
Ref: library/turtle turtle setundobuffer15035348
Ref: 447f15035348
Ref: library/turtle turtle undobufferentries15035918
Ref: 448015035918
Node: Compound shapes15036099
Ref: library/turtle compound-shapes15036245
Ref: 44b015036245
Ref: library/turtle compoundshapes15036245
Ref: 44b115036245
Node: TurtleScreen/Screen のメソッドと対応する関数15037495
Ref: library/turtle methods-of-turtlescreen-screen-and-corresponding-functions15037699
Ref: 44b415037699
Node: ウィンドウの制御15038203
Ref: library/turtle window-control15038359
Ref: 44b515038359
Ref: library/turtle turtle bgcolor15038424
Ref: 448215038424
Ref: library/turtle turtle bgpic15039770
Ref: 448315039770
Ref: library/turtle turtle clearscreen15040809
Ref: 448415040809
Ref: library/turtle turtle resetscreen15041437
Ref: 448515041437
Ref: library/turtle turtle screensize15041578
Ref: 448615041578
Ref: library/turtle turtle setworldcoordinates15042765
Ref: 448715042765
Node: アニメーションの制御15043781
Ref: library/turtle animation-control15043988
Ref: 44b615043988
Ref: library/turtle turtle no_animation15044063
Ref: 2a515044063
Ref: library/turtle turtle delay15044468
Ref: 448815044468
Ref: library/turtle turtle tracer15044969
Ref: 448915044969
Ref: library/turtle turtle update15045799
Ref: 448a15045799
Node: スクリーンイベントを利用する15046016
Ref: library/turtle using-screen-events15046217
Ref: 44b715046217
Ref: library/turtle turtle listen15046312
Ref: 448b15046312
Ref: library/turtle turtle onkey15046594
Ref: 448c15046594
Ref: library/turtle turtle onkeyrelease15046633
Ref: 448d15046633
Ref: library/turtle turtle onkeypress15047402
Ref: 448e15047402
Ref: library/turtle turtle onclick15048016
Ref: 447515048016
Ref: library/turtle turtle onscreenclick15048069
Ref: 448f15048069
Ref: library/turtle turtle ontimer15049481
Ref: 449015049481
Ref: library/turtle turtle mainloop15049970
Ref: 449115049970
Ref: library/turtle turtle done15050004
Ref: 449215050004
Node: 入力メソッド15050329
Ref: library/turtle input-methods15050530
Ref: 44b815050530
Ref: library/turtle turtle textinput15050585
Ref: 1c7a15050585
Ref: library/turtle turtle numinput15051041
Ref: 1c7b15051041
Node: 設定と特殊なメソッド15051960
Ref: library/turtle settings-and-special-methods15052193
Ref: 44b915052193
Ref: library/turtle turtle mode15052268
Ref: 449315052268
Ref: library/turtle turtle colormode15053534
Ref: 449415053534
Ref: library/turtle turtle getcanvas15054273
Ref: 449515054273
Ref: library/turtle turtle getshapes15054557
Ref: 449615054557
Ref: library/turtle turtle register_shape15054775
Ref: 449715054775
Ref: library/turtle turtle addshape15054831
Ref: 449815054831
Ref: library/turtle turtle turtles15056493
Ref: 449915056493
Ref: library/turtle turtle window_height15056682
Ref: 449a15056682
Ref: library/turtle turtle window_width15056835
Ref: 449b15056835
Node: Screen 独自のメソッド、TurtleScreen から継承したもの以外15056983
Ref: library/turtle methods-specific-to-screen-not-inherited-from-turtlescreen15057189
Ref: 44ba15057189
Ref: library/turtle screenspecific15057189
Ref: 44bb15057189
Ref: library/turtle turtle bye15057344
Ref: 449c15057344
Ref: library/turtle turtle exitonclick15057466
Ref: 449d15057466
Ref: library/turtle turtle save15058084
Ref: 197015058084
Ref: library/turtle turtle setup15058673
Ref: 449e15058673
Ref: library/turtle turtle title15060194
Ref: 449f15060194
Node: Public classes15060518
Ref: library/turtle public-classes15060678
Ref: 44bc15060678
Ref: library/turtle turtle RawTurtle15060731
Ref: 44bd15060731
Ref: library/turtle turtle RawPen15060772
Ref: 44be15060772
Ref: library/turtle turtle Turtle15061099
Ref: 44c015061099
Ref: library/turtle turtle TurtleScreen15061347
Ref: 44af15061347
Ref: library/turtle turtle Screen15061570
Ref: 443415061570
Ref: library/turtle turtle ScrolledCanvas15061707
Ref: 44bf15061707
Ref: library/turtle turtle Shape15062072
Ref: 44b215062072
Ref: library/turtle turtle Shape addcomponent15062938
Ref: 44b315062938
Ref: library/turtle turtle Vec2D15063557
Ref: 44a215063557
Node: 説明<2>15064211
Ref: library/turtle explanation15064333
Ref: 44c115064333
Ref: library/turtle turtle-explanation15064333
Ref: 443315064333
Node: ヘルプと設定15065751
Ref: library/turtle help-and-configuration15065886
Ref: 44c215065886
Node: ヘルプの使い方15066062
Ref: library/turtle how-to-use-help15066183
Ref: 44c315066183
Node: ドキュメント文字列の翻訳15068734
Ref: library/turtle translation-of-docstrings-into-different-languages15068903
Ref: 44c415068903
Ref: library/turtle turtle write_docstringdict15069186
Ref: 44c515069186
Node: Screen および Turtle の設定方法15070556
Ref: library/turtle how-to-configure-screen-and-turtles15070695
Ref: 44c615070695
Node: turtledemo --- Demo scripts15073908
Ref: library/turtle module-turtledemo15074062
Ref: 10815074062
Ref: library/turtle turtledemo-demo-scripts15074062
Ref: 44c715074062
Node: python 2 6からの変更点15080748
Ref: library/turtle changes-since-python-2-615080912
Ref: 44c815080912
Node: python 3 0からの変更点15081954
Ref: library/turtle changes-since-python-3-015082082
Ref: 44c915082082
Node: 開発ツール15083204
Ref: library/development doc15083368
Ref: 44ca15083368
Ref: library/development development15083368
Ref: 44cb15083368
Ref: library/development development-tools15083368
Ref: 44cc15083368
Ref: library/development translation-repo15083368
Ref: 44cd15083368
Node: typing --- Support for type hints15085670
Ref: library/typing doc15085837
Ref: 44ce15085837
Ref: library/typing typing-support-for-type-hints15085837
Ref: 44cf15085837
Ref: library/typing module-typing15085926
Ref: 10a15085926
Ref: typing --- Support for type hints-Footnote-115088758
Ref: typing --- Support for type hints-Footnote-215088824
Ref: typing --- Support for type hints-Footnote-315088876
Ref: typing --- Support for type hints-Footnote-415088943
Ref: typing --- Support for type hints-Footnote-515089000
Node: Python 型システムの仕様15089045
Ref: library/typing relevant-peps15089173
Ref: 44d015089173
Ref: library/typing specification-for-the-python-type-system15089173
Ref: 44d115089173
Ref: Python 型システムの仕様-Footnote-115089412
Node: 型エイリアス15089472
Ref: library/typing id215089616
Ref: 44d215089616
Ref: library/typing type-aliases15089616
Ref: 68315089616
Node: NewType15091334
Ref: library/typing distinct15091507
Ref: 44d315091507
Ref: library/typing newtype15091507
Ref: 44d415091507
Ref: NewType-Footnote-115095238
Node: 呼び出し可能オブジェクトのアノテーション15095280
Ref: library/typing annotating-callable-objects15095453
Ref: 44d515095453
Ref: library/typing annotating-callables15095453
Ref: 26cf15095453
Ref: 呼び出し可能オブジェクトのアノテーション-Footnote-115098946
Node: ジェネリクス15098988
Ref: library/typing generics15099187
Ref: 23c915099187
Ref: library/typing id315099187
Ref: 44d715099187
Node: タプルのアノテーション15100571
Ref: library/typing annotating-tuples15100743
Ref: 26d015100743
Ref: library/typing id415100743
Ref: 44d815100743
Node: クラスオブジェクトの型15103227
Ref: library/typing the-type-of-class-objects15103417
Ref: 44d915103417
Ref: library/typing type-of-class-objects15103417
Ref: 44da15103417
Node: Annotating generators and coroutines15105097
Ref: library/typing annotating-generators-and-coroutines15105296
Ref: 299c15105296
Ref: library/typing id515105296
Ref: 44dc15105296
Node: ユーザー定義のジェネリック型15107861
Ref: library/typing user-defined-generic-types15108034
Ref: 44dd15108034
Ref: library/typing user-defined-generics15108034
Ref: 6f615108034
Ref: ユーザー定義のジェネリック型-Footnote-115114138
Node: Any 型15114180
Ref: library/typing the-any-type15114357
Ref: 44df15114357
Node: 名前的部分型 vs 構造的部分型15117342
Ref: library/typing nominal-vs-structural-subtyping15117504
Ref: 44e015117504
Ref: 名前的部分型 vs 構造的部分型-Footnote-115119471
Ref: 名前的部分型 vs 構造的部分型-Footnote-215119513
Ref: 名前的部分型 vs 構造的部分型-Footnote-315119555
Node: モジュールの内容<3>15119597
Ref: library/typing module-contents15119794
Ref: 44e115119794
Node: 特殊型付けプリミティブ15120179
Ref: library/typing special-typing-primitives15120303
Ref: 44e215120303
Node: 特殊型15120495
Ref: library/typing special-types15120595
Ref: 44e315120595
Ref: library/typing typing Any15120727
Ref: 8bb15120727
Ref: library/typing typing AnyStr15121161
Ref: 5ac15121161
Ref: library/typing typing LiteralString15122975
Ref: 7e615122975
Ref: library/typing typing Never15124228
Ref: 8b715124228
Ref: library/typing typing NoReturn15124256
Ref: 44e515124256
Ref: library/typing typing Self15125499
Ref: 7e315125499
Ref: library/typing typing TypeAlias15127461
Ref: 9cc15127461
Ref: 特殊型-Footnote-115129124
Ref: 特殊型-Footnote-215129166
Ref: 特殊型-Footnote-315129208
Ref: 特殊型-Footnote-415129258
Ref: 特殊型-Footnote-515129300
Node: 特殊形式15129342
Ref: library/typing special-forms15129490
Ref: 44e615129490
Ref: library/typing typing Union15129735
Ref: 2a815129735
Ref: library/typing typing Optional15131937
Ref: 8c215131937
Ref: library/typing typing Concatenate15133020
Ref: 9c715133020
Ref: library/typing typing Literal15135442
Ref: a5515135442
Ref: library/typing typing ClassVar15137763
Ref: 56d15137763
Ref: library/typing typing Final15139211
Ref: 56e15139211
Ref: library/typing typing Required15140003
Ref: 7e015140003
Ref: library/typing typing NotRequired15140276
Ref: 7e115140276
Ref: library/typing typing ReadOnly15140538
Ref: 48a15140538
Ref: library/typing typing Annotated15141070
Ref: b3715141070
Ref: library/typing typing TypeIs15146831
Ref: 48b15146831
Ref: library/typing typing TypeGuard15150626
Ref: 48c15150626
Ref: library/typing typing Unpack15153050
Ref: 19a615153050
Ref: 特殊形式-Footnote-115154760
Ref: 特殊形式-Footnote-215154802
Ref: 特殊形式-Footnote-315154844
Ref: 特殊形式-Footnote-415154886
Ref: 特殊形式-Footnote-515154928
Ref: 特殊形式-Footnote-615154970
Ref: 特殊形式-Footnote-715155012
Ref: 特殊形式-Footnote-815155054
Ref: 特殊形式-Footnote-915155096
Ref: 特殊形式-Footnote-1015155138
Ref: 特殊形式-Footnote-1115155181
Node: Building generic types and type aliases15155224
Ref: library/typing building-generic-types-and-type-aliases15155387
Ref: 44e815155387
Ref: library/typing typing Generic15155898
Ref: 17b615155898
Ref: library/typing typevar15157161
Ref: 44de15157161
Ref: library/typing typing TypeVar15157161
Ref: 48615157161
Ref: library/typing typing-constrained-typevar15160694
Ref: 44e415160694
Ref: library/typing typing TypeVar __name__15161312
Ref: 44e915161312
Ref: library/typing typing TypeVar __covariant__15161384
Ref: 44ea15161384
Ref: library/typing typing TypeVar __contravariant__15161492
Ref: 44eb15161492
Ref: library/typing typing TypeVar __infer_variance__15161618
Ref: 44ec15161618
Ref: library/typing typing TypeVar __bound__15161787
Ref: 44ed15161787
Ref: library/typing typing TypeVar evaluate_bound15162150
Ref: 44ee15162150
Ref: library/typing typing TypeVar __constraints__15162681
Ref: 44f115162681
Ref: library/typing typing TypeVar evaluate_constraints15163086
Ref: 44f215163086
Ref: library/typing typing TypeVar __default__15163635
Ref: 44f315163635
Ref: library/typing typing TypeVar evaluate_default15163817
Ref: 44f415163817
Ref: library/typing typing TypeVar has_default15164354
Ref: 44f515164354
Ref: library/typing typevartuple15165021
Ref: 44e715165021
Ref: library/typing typing TypeVarTuple15165021
Ref: 48815165021
Ref: library/typing typing TypeVarTuple __name__15169289
Ref: 44f615169289
Ref: library/typing typing TypeVarTuple __default__15169367
Ref: 44f715169367
Ref: library/typing typing TypeVarTuple evaluate_default15169555
Ref: 44f815169555
Ref: library/typing typing TypeVarTuple has_default15170092
Ref: 44f915170092
Ref: library/typing typing ParamSpec15170755
Ref: 48715170755
Ref: library/typing typing ParamSpec args15173251
Ref: 44fb15173251
Ref: library/typing typing ParamSpec kwargs15173277
Ref: 44fc15173277
Ref: library/typing typing ParamSpec __name__15174041
Ref: 44fd15174041
Ref: library/typing typing ParamSpec __default__15174123
Ref: 44fe15174123
Ref: library/typing typing ParamSpec evaluate_default15174315
Ref: 44ff15174315
Ref: library/typing typing ParamSpec has_default15174852
Ref: 450015174852
Ref: library/typing typing ParamSpecArgs15176240
Ref: 9c915176240
Ref: library/typing typing ParamSpecKwargs15176276
Ref: 9ca15176276
Ref: library/typing typing TypeAliasType15176996
Ref: 2ae15176996
Ref: library/typing typing TypeAliasType __name__15177289
Ref: 450115177289
Ref: library/typing typing TypeAliasType __module__15177452
Ref: 450215177452
Ref: library/typing typing TypeAliasType __type_params__15177654
Ref: 450315177654
Ref: library/typing typing TypeAliasType __value__15178025
Ref: 450415178025
Ref: library/typing typing TypeAliasType evaluate_value15178583
Ref: 450515178583
Ref: Building generic types and type aliases-Footnote-115180093
Ref: Building generic types and type aliases-Footnote-215180135
Ref: Building generic types and type aliases-Footnote-315180177
Ref: Building generic types and type aliases-Footnote-415180219
Ref: Building generic types and type aliases-Footnote-515180261
Ref: Building generic types and type aliases-Footnote-615180303
Ref: Building generic types and type aliases-Footnote-715180345
Node: Other special directives15180387
Ref: library/typing other-special-directives15180529
Ref: 450615180529
Ref: library/typing typing NamedTuple15180755
Ref: 33115180755
Ref: library/typing typing NewType15184674
Ref: ef115184674
Ref: library/typing typing NewType __module__15185123
Ref: 450715185123
Ref: library/typing typing NewType __name__15185223
Ref: 450815185223
Ref: library/typing typing NewType __supertype__15185290
Ref: 450915185290
Ref: library/typing typing Protocol15185502
Ref: 56b15185502
Ref: library/typing typing runtime_checkable15186943
Ref: 67515186943
Ref: library/typing typing TypedDict15189627
Ref: 33215189627
Ref: library/typing typing TypedDict __total__15194482
Ref: 450a15194482
Ref: library/typing typing TypedDict __required_keys__15195546
Ref: 450b15195546
Ref: library/typing typing TypedDict __optional_keys__15195618
Ref: 450c15195618
Ref: library/typing typing TypedDict __readonly_keys__15197433
Ref: 450d15197433
Ref: library/typing typing TypedDict __mutable_keys__15197675
Ref: 450e15197675
Ref: Other special directives-Footnote-115199220
Ref: Other special directives-Footnote-215199262
Ref: Other special directives-Footnote-315199304
Ref: Other special directives-Footnote-415199378
Node: プロトコル<4>15199420
Ref: library/typing protocols15199592
Ref: 450f15199592
Ref: library/typing typing SupportsAbs15199761
Ref: 451015199761
Ref: library/typing typing SupportsBytes15199889
Ref: 80015199889
Ref: library/typing typing SupportsComplex15199994
Ref: 7ff15199994
Ref: library/typing typing SupportsFloat15200103
Ref: 451115200103
Ref: library/typing typing SupportsIndex15200208
Ref: c3a15200208
Ref: library/typing typing SupportsInt15200341
Ref: c3915200341
Ref: library/typing typing SupportsRound15200442
Ref: 451215200442
Node: ABCs and Protocols for working with I/O15200574
Ref: library/typing abcs-and-protocols-for-working-with-i-o15200737
Ref: 451315200737
Ref: library/typing typing-io15200737
Ref: 312a15200737
Ref: library/typing typing IO15200838
Ref: 23815200838
Ref: library/typing typing TextIO15200872
Ref: 23915200872
Ref: library/typing typing BinaryIO15200901
Ref: 23a15200901
Node: Functions and decorators15201746
Ref: library/typing functions-and-decorators15201912
Ref: 451415201912
Ref: library/typing typing cast15201983
Ref: 44fa15201983
Ref: library/typing typing assert_type15202382
Ref: 8ba15202382
Ref: library/typing typing assert_never15203474
Ref: 8b615203474
Ref: library/typing typing reveal_type15204900
Ref: 8b915204900
Ref: library/typing typing dataclass_transform15206095
Ref: 6fb15206095
Ref: library/typing overload15212140
Ref: 44d615212140
Ref: library/typing typing overload15212140
Ref: 451515212140
Ref: library/typing typing get_overloads15213689
Ref: 8bd15213689
Ref: library/typing typing clear_overloads15214365
Ref: 8be15214365
Ref: library/typing typing final15214566
Ref: 8bc15214566
Ref: library/typing typing no_type_check15215868
Ref: 8c315215868
Ref: library/typing typing no_type_check_decorator15216383
Ref: 33315216383
Ref: library/typing typing override15216883
Ref: 67d15216883
Ref: library/typing typing type_check_only15218228
Ref: 451615218228
Ref: Functions and decorators-Footnote-115219078
Ref: Functions and decorators-Footnote-215219146
Ref: Functions and decorators-Footnote-315219188
Ref: Functions and decorators-Footnote-415219230
Ref: Functions and decorators-Footnote-515219272
Node: Introspection helpers15219314
Ref: library/typing introspection-helpers15219451
Ref: 451715219451
Ref: library/typing typing get_type_hints15219516
Ref: 8c015219516
Ref: library/typing typing get_origin15222380
Ref: 2ab15222380
Ref: library/typing typing get_args15223236
Ref: 2ac15223236
Ref: library/typing typing get_protocol_members15223874
Ref: 56a15223874
Ref: library/typing typing is_protocol15224333
Ref: 56c15224333
Ref: library/typing typing is_typeddict15224638
Ref: a5615224638
Ref: library/typing typing ForwardRef15225083
Ref: 1bda15225083
Ref: library/typing typing evaluate_forward_ref15225979
Ref: 181515225979
Ref: library/typing typing NoDefault15226881
Ref: 56915226881
Ref: Introspection helpers-Footnote-115227274
Ref: Introspection helpers-Footnote-215227316
Node: 定数<10>15227358
Ref: library/typing constant15227498
Ref: 451915227498
Ref: library/typing typing TYPE_CHECKING15227531
Ref: ef015227531
Ref: library/typing generic-concrete-collections15228930
Ref: 451a15228930
Ref: 定数<10>-Footnote-115228966
Node: 非推奨のエイリアス15229008
Ref: library/typing deprecated-aliases15229118
Ref: 451b15229118
Ref: library/typing id615229118
Ref: 451c15229118
Ref: 非推奨のエイリアス-Footnote-115230711
Node: Aliases to built-in types15230753
Ref: library/typing aliases-to-built-in-types15230882
Ref: 451d15230882
Ref: library/typing corresponding-to-built-in-types15230882
Ref: 451e15230882
Ref: library/typing typing Dict15230955
Ref: 451f15230955
Ref: library/typing typing List15231504
Ref: 452015231504
Ref: library/typing typing Set15232076
Ref: 452115232076
Ref: library/typing typing FrozenSet15232624
Ref: 452215232624
Ref: library/typing typing Tuple15232997
Ref: 452315232997
Ref: library/typing typing Type15233484
Ref: 44db15233484
Ref: Aliases to built-in types-Footnote-115234041
Ref: Aliases to built-in types-Footnote-215234083
Ref: Aliases to built-in types-Footnote-315234125
Ref: Aliases to built-in types-Footnote-415234167
Ref: Aliases to built-in types-Footnote-515234209
Ref: Aliases to built-in types-Footnote-615234251
Node: Aliases to types in collections15234293
Ref: library/typing aliases-to-types-in-collections15234462
Ref: 452415234462
Ref: library/typing corresponding-to-types-in-collections15234462
Ref: 452515234462
Ref: library/typing typing DefaultDict15234555
Ref: 452615234555
Ref: library/typing typing OrderedDict15235016
Ref: 452715235016
Ref: library/typing typing ChainMap15235475
Ref: 452815235475
Ref: library/typing typing Counter15235922
Ref: 452915235922
Ref: library/typing typing Deque15236347
Ref: 452a15236347
Ref: Aliases to types in collections-Footnote-115236791
Ref: Aliases to types in collections-Footnote-215236833
Ref: Aliases to types in collections-Footnote-315236875
Ref: Aliases to types in collections-Footnote-415236917
Ref: Aliases to types in collections-Footnote-515236959
Node: Aliases to other concrete types15237001
Ref: library/typing aliases-to-other-concrete-types15237189
Ref: 452b15237189
Ref: library/typing other-concrete-types15237189
Ref: 452c15237189
Ref: library/typing typing Pattern15237274
Ref: 93515237274
Ref: library/typing typing Match15237304
Ref: 452d15237304
Ref: library/typing typing Text15237911
Ref: 36015237911
Ref: library/typing abstract-base-classes15238722
Ref: 452e15238722
Ref: Aliases to other concrete types-Footnote-115238758
Node: Aliases to container ABCs in collections abc15238800
Ref: library/typing aliases-to-container-abcs-in-collections-abc15239004
Ref: 452f15239004
Ref: library/typing corresponding-to-collections-in-collections-abc15239004
Ref: 453015239004
Ref: library/typing typing AbstractSet15239123
Ref: 453115239123
Ref: library/typing typing ByteString15239505
Ref: 34515239505
Ref: library/typing typing Collection15240571
Ref: eef15240571
Ref: library/typing typing Container15241014
Ref: 453215241014
Ref: library/typing typing ItemsView15241403
Ref: 453315241403
Ref: library/typing typing KeysView15241834
Ref: 453415241834
Ref: library/typing typing Mapping15242238
Ref: 453515242238
Ref: library/typing typing MappingView15242640
Ref: 453615242640
Ref: library/typing typing MutableMapping15243027
Ref: 453715243027
Ref: library/typing typing MutableSequence15243432
Ref: 453815243432
Ref: library/typing typing MutableSet15243835
Ref: 453915243835
Ref: library/typing typing Sequence15244229
Ref: 453a15244229
Ref: library/typing typing ValuesView15244637
Ref: 453b15244637
Ref: Aliases to container ABCs in collections abc-Footnote-115245084
Ref: Aliases to container ABCs in collections abc-Footnote-215245126
Ref: Aliases to container ABCs in collections abc-Footnote-315245184
Ref: Aliases to container ABCs in collections abc-Footnote-415245226
Ref: Aliases to container ABCs in collections abc-Footnote-515245268
Ref: Aliases to container ABCs in collections abc-Footnote-615245310
Ref: Aliases to container ABCs in collections abc-Footnote-715245352
Ref: Aliases to container ABCs in collections abc-Footnote-815245394
Ref: Aliases to container ABCs in collections abc-Footnote-915245436
Ref: Aliases to container ABCs in collections abc-Footnote-1015245478
Ref: Aliases to container ABCs in collections abc-Footnote-1115245521
Ref: Aliases to container ABCs in collections abc-Footnote-1215245564
Ref: Aliases to container ABCs in collections abc-Footnote-1315245607
Node: Aliases to asynchronous ABCs in collections abc15245650
Ref: library/typing aliases-to-asynchronous-abcs-in-collections-abc15245863
Ref: 453c15245863
Ref: library/typing asynchronous-programming15245863
Ref: 453d15245863
Ref: library/typing typing Coroutine15245988
Ref: 1d3115245988
Ref: library/typing typing AsyncGenerator15246642
Ref: 19a315246642
Ref: library/typing typing AsyncIterable15247397
Ref: 453e15247397
Ref: library/typing typing AsyncIterator15247825
Ref: 453f15247825
Ref: library/typing typing Awaitable15248259
Ref: 454015248259
Ref: Aliases to asynchronous ABCs in collections abc-Footnote-115248712
Ref: Aliases to asynchronous ABCs in collections abc-Footnote-215248754
Ref: Aliases to asynchronous ABCs in collections abc-Footnote-315248796
Ref: Aliases to asynchronous ABCs in collections abc-Footnote-415248838
Ref: Aliases to asynchronous ABCs in collections abc-Footnote-515248880
Node: Aliases to other ABCs in collections abc15248922
Ref: library/typing aliases-to-other-abcs-in-collections-abc15249117
Ref: 454115249117
Ref: library/typing corresponding-to-other-types-in-collections-abc15249117
Ref: 454215249117
Ref: library/typing typing Iterable15249228
Ref: 454315249228
Ref: library/typing typing Iterator15249614
Ref: 454415249614
Ref: library/typing typing Callable15250001
Ref: 9c815250001
Ref: library/typing typing Generator15250773
Ref: 19a215250773
Ref: library/typing typing Hashable15251495
Ref: 71715251495
Ref: library/typing typing Reversible15251737
Ref: 454515251737
Ref: library/typing typing Sized15252128
Ref: 71815252128
Ref: Aliases to other ABCs in collections abc-Footnote-115252397
Ref: Aliases to other ABCs in collections abc-Footnote-215252439
Ref: Aliases to other ABCs in collections abc-Footnote-315252481
Ref: Aliases to other ABCs in collections abc-Footnote-415252523
Ref: Aliases to other ABCs in collections abc-Footnote-515252565
Ref: Aliases to other ABCs in collections abc-Footnote-615252607
Node: Aliases to contextlib ABCs15252649
Ref: library/typing aliases-to-contextlib-abcs15252788
Ref: 454615252788
Ref: library/typing context-manager-types15252788
Ref: 454715252788
Ref: library/typing typing ContextManager15252871
Ref: e8b15252871
Ref: library/typing typing AsyncContextManager15253710
Ref: 19a015253710
Ref: Aliases to contextlib ABCs-Footnote-115254612
Ref: Aliases to contextlib ABCs-Footnote-215254654
Node: メジャーな機能の非推奨時系列15254696
Ref: library/typing deprecation-timeline-of-major-features15254844
Ref: 454815254844
Ref: メジャーな機能の非推奨時系列-Footnote-115257718
Ref: メジャーな機能の非推奨時系列-Footnote-215257760
Ref: メジャーな機能の非推奨時系列-Footnote-315257815
Ref: メジャーな機能の非推奨時系列-Footnote-415257870
Ref: メジャーな機能の非推奨時系列-Footnote-515257925
Ref: メジャーな機能の非推奨時系列-Footnote-615257967
Ref: メジャーな機能の非推奨時系列-Footnote-715258023
Node: pydoc --- ドキュメント生成とオンラインヘルプシステム15258079
Ref: library/pydoc doc15258277
Ref: 454915258277
Ref: library/pydoc module-pydoc15258277
Ref: ba15258277
Ref: library/pydoc pydoc-documentation-generator-and-online-help-system15258277
Ref: 454a15258277
Ref: library/pydoc translation-repo15258277
Ref: 454b15258277
Ref: pydoc --- ドキュメント生成とオンラインヘルプシステム-Footnote-115264363
Node: Python 開発モード15264428
Ref: library/devmode doc15264649
Ref: 454c15264649
Ref: library/devmode devmode15264649
Ref: 50815264649
Ref: library/devmode python-development-mode15264649
Ref: 454d15264649
Ref: library/devmode translation-repo15264649
Ref: 454e15264649
Node: Python 開発モードの影響15265269
Ref: library/devmode effects-of-the-python-development-mode15265390
Ref: 454f15265390
Node: ResourceWarning の例15269169
Ref: library/devmode resourcewarning-example15269332
Ref: 455015269332
Node: Bad file descriptor error example15271270
Ref: library/devmode bad-file-descriptor-error-example15271393
Ref: 455115271393
Ref: Bad file descriptor error example-Footnote-115272937
Node: doctest --- 対話型の Python の例をテストする15273002
Ref: library/doctest doc15273205
Ref: 455215273205
Ref: library/doctest doctest-test-interactive-python-examples15273205
Ref: 455315273205
Ref: library/doctest module-doctest15273205
Ref: 3e15273205
Ref: library/doctest translation-repo15273205
Ref: 455415273205
Ref: doctest --- 対話型の Python の例をテストする-Footnote-115277859
Node: 簡単な利用法 docstring 中の実行例をチェックする15277926
Ref: library/doctest doctest-simple-testmod15278172
Ref: 455515278172
Ref: library/doctest simple-usage-checking-examples-in-docstrings15278172
Ref: 455615278172
Node: 簡単な利用法 テキストファイル中の実行例をチェックする15280029
Ref: library/doctest doctest-simple-testfile15280320
Ref: 455915280320
Ref: library/doctest simple-usage-checking-examples-in-a-text-file15280320
Ref: 455a15280320
Node: コマンドラインでの使用<6>15282910
Ref: library/doctest command-line-usage15283159
Ref: 455c15283159
Ref: library/doctest doctest-cli15283159
Ref: 455715283159
Ref: library/doctest cmdoption-doctest-v15283373
Ref: 455d15283373
Ref: library/doctest cmdoption-doctest-verbose15283373
Ref: 455e15283373
Ref: library/doctest cmdoption-doctest-o15284121
Ref: 455f15284121
Ref: library/doctest cmdoption-doctest-option15284121
Ref: 456015284121
Ref: library/doctest cmdoption-doctest-f15284305
Ref: 456115284305
Ref: library/doctest cmdoption-doctest-fail-fast15284305
Ref: 456215284305
Node: doctest のからくり15284410
Ref: library/doctest doctest-how-it-works15284590
Ref: 456315284590
Ref: library/doctest how-it-works15284590
Ref: 456415284590
Node: どの docstring が検証されるのか?15285581
Ref: library/doctest doctest-which-docstrings15285754
Ref: 456515285754
Ref: library/doctest which-docstrings-are-examined15285754
Ref: 456615285754
Ref: library/doctest module __test__15286056
Ref: 456715286056
Node: docstring 内の実行例をどのように認識するのか?15287752
Ref: library/doctest doctest-finding-examples15287971
Ref: 456815287971
Ref: library/doctest how-are-docstring-examples-recognized15287971
Ref: 456915287971
Node: 実行コンテキストとは何か?15291944
Ref: library/doctest doctest-execution-context15292155
Ref: 456d15292155
Ref: library/doctest what-s-the-execution-context15292155
Ref: 456e15292155
Node: 例外はどう扱えばよいか?15292879
Ref: library/doctest doctest-exceptions15293052
Ref: 456f15293052
Ref: library/doctest what-about-exceptions15293052
Ref: 457015293052
Ref: library/doctest option-flags-and-directives15298988
Ref: 457115298988
Ref: 例外はどう扱えばよいか?-Footnote-115299025
Node: オプションフラグ15299300
Ref: library/doctest doctest-options15299468
Ref: 113415299468
Ref: library/doctest option-flags15299468
Ref: 457215299468
Ref: library/doctest doctest DONT_ACCEPT_TRUE_FOR_115300321
Ref: 457315300321
Ref: library/doctest doctest DONT_ACCEPT_BLANKLINE15301262
Ref: 457415301262
Ref: library/doctest doctest NORMALIZE_WHITESPACE15301893
Ref: 456a15301893
Ref: library/doctest doctest ELLIPSIS15302503
Ref: 168715302503
Ref: library/doctest doctest IGNORE_EXCEPTION_DETAIL15303138
Ref: 152015303138
Ref: library/doctest doctest SKIP15304680
Ref: 457515304680
Ref: library/doctest doctest COMPARISON_FLAGS15305353
Ref: 457615305353
Ref: library/doctest doctest REPORT_UDIFF15305581
Ref: 168815305581
Ref: library/doctest doctest REPORT_CDIFF15305822
Ref: 168915305822
Ref: library/doctest doctest REPORT_NDIFF15306063
Ref: 168a15306063
Ref: library/doctest doctest REPORT_ONLY_FIRST_FAILURE15306779
Ref: 457715306779
Ref: library/doctest doctest FAIL_FAST15307652
Ref: 113515307652
Ref: library/doctest doctest REPORTING_FLAGS15308065
Ref: 457815308065
Ref: library/doctest doctest register_optionflag15308373
Ref: 457915308373
Node: ディレクティブ Directives15308960
Ref: library/doctest directives15309103
Ref: 457c15309103
Ref: library/doctest doctest-directives15309103
Ref: 456b15309103
Ref: library/doctest grammar-token-doctest-directive15309439
Ref: 457d15309439
Ref: library/doctest grammar-token-doctest-directive_options15309513
Ref: 457e15309513
Ref: library/doctest grammar-token-doctest-directive_option15309608
Ref: 457f15309608
Ref: library/doctest grammar-token-doctest-on_or_off15309694
Ref: 458015309694
Ref: library/doctest grammar-token-doctest-directive_option_name15309732
Ref: 458115309732
Node: 警告<2>15312368
Ref: library/doctest doctest-warnings15312478
Ref: 458215312478
Ref: library/doctest warnings15312478
Ref: 458315312478
Node: 基本 API15314496
Ref: library/doctest basic-api15314659
Ref: 458415314659
Ref: library/doctest doctest-basic-api15314659
Ref: 455815314659
Ref: library/doctest doctest testfile15315178
Ref: 455b15315178
Ref: library/doctest doctest testmod15320858
Ref: 168615320858
Ref: library/doctest doctest run_docstring_examples15323119
Ref: 458615323119
Node: 単体テスト API15324416
Ref: library/doctest doctest-unittest-api15324566
Ref: 458715324566
Ref: library/doctest unittest-api15324566
Ref: 458815324566
Ref: library/doctest doctest DocFileSuite15325393
Ref: 458a15325393
Ref: library/doctest doctest DocTestSuite15330501
Ref: ff415330501
Ref: library/doctest doctest set_unittest_reportflags15334204
Ref: 458d15334204
Node: 拡張 API15335465
Ref: library/doctest advanced-api15335617
Ref: 458e15335617
Ref: library/doctest doctest-advanced-api15335617
Ref: 458f15335617
Node: DocTest オブジェクト15338186
Ref: library/doctest doctest-doctest15338294
Ref: 459115338294
Ref: library/doctest doctest-objects15338294
Ref: 459215338294
Ref: library/doctest doctest DocTest15338363
Ref: 1a2915338363
Ref: library/doctest doctest DocTest examples15338878
Ref: 459315338878
Ref: library/doctest doctest DocTest globs15339123
Ref: 458c15339123
Ref: library/doctest doctest DocTest name15339567
Ref: 459415339567
Ref: library/doctest doctest DocTest filename15339787
Ref: 459515339787
Ref: library/doctest doctest DocTest lineno15340017
Ref: 17c715340017
Ref: library/doctest doctest DocTest docstring15340315
Ref: 459615340315
Node: Example オブジェクト15340605
Ref: library/doctest doctest-example15340754
Ref: 459715340754
Ref: library/doctest example-objects15340754
Ref: 459815340754
Ref: library/doctest doctest Example15340823
Ref: 459015340823
Ref: library/doctest doctest Example source15341395
Ref: 459915341395
Ref: library/doctest doctest Example want15341659
Ref: 459a15341659
Ref: library/doctest doctest Example exc_msg15342151
Ref: 459b15342151
Ref: library/doctest doctest Example lineno15342692
Ref: 459c15342692
Ref: library/doctest doctest Example indent15342887
Ref: 459d15342887
Ref: library/doctest doctest Example options15343088
Ref: 459e15343088
Node: DocTestFinder オブジェクト15343499
Ref: library/doctest doctest-doctestfinder15343654
Ref: 459f15343654
Ref: library/doctest doctestfinder-objects15343654
Ref: 45a015343654
Ref: library/doctest doctest DocTestFinder15343735
Ref: 19a815343735
Ref: library/doctest doctest DocTestFinder find15345246
Ref: 1a6f15345246
Node: DocTestParser オブジェクト15348035
Ref: library/doctest doctest-doctestparser15348183
Ref: 45a115348183
Ref: library/doctest doctestparser-objects15348183
Ref: 45a215348183
Ref: library/doctest doctest DocTestParser15348264
Ref: 456c15348264
Ref: library/doctest doctest DocTestParser get_doctest15348575
Ref: 45a315348575
Ref: library/doctest doctest DocTestParser get_examples15348998
Ref: 45a415348998
Ref: library/doctest doctest DocTestParser parse15349460
Ref: 45a515349460
Node: TestResults objects15349854
Ref: library/doctest testresults-objects15350002
Ref: 45a615350002
Ref: library/doctest doctest TestResults15350063
Ref: 45a715350063
Ref: library/doctest doctest TestResults failed15350119
Ref: 45a815350119
Ref: library/doctest doctest TestResults attempted15350182
Ref: 45a915350182
Ref: library/doctest doctest TestResults skipped15350251
Ref: 4f015350251
Node: DocTestRunner オブジェクト15350350
Ref: library/doctest doctest-doctestrunner15350498
Ref: 45aa15350498
Ref: library/doctest doctestrunner-objects15350498
Ref: 45ab15350498
Ref: library/doctest doctest DocTestRunner15350579
Ref: 457b15350579
Ref: library/doctest doctest DocTestRunner report_start15353421
Ref: 45ac15353421
Ref: library/doctest doctest DocTestRunner report_success15354006
Ref: 45ad15354006
Ref: library/doctest doctest DocTestRunner report_failure15354683
Ref: 45af15354683
Ref: library/doctest doctest DocTestRunner report_unexpected_exception15355369
Ref: 45ae15355369
Ref: library/doctest doctest DocTestRunner run15356192
Ref: 4ee15356192
Ref: library/doctest doctest DocTestRunner summarize15357396
Ref: 458515357396
Ref: library/doctest doctest DocTestRunner tries15357919
Ref: 45b015357919
Ref: library/doctest doctest DocTestRunner failures15357987
Ref: 45b115357987
Ref: library/doctest doctest DocTestRunner skips15358055
Ref: 4ef15358055
Node: OutputChecker オブジェクト15358155
Ref: library/doctest doctest-outputchecker15358275
Ref: 45b215358275
Ref: library/doctest outputchecker-objects15358275
Ref: 45b315358275
Ref: library/doctest doctest OutputChecker15358356
Ref: 457a15358356
Ref: library/doctest doctest OutputChecker check_output15358983
Ref: 45b415358983
Ref: library/doctest doctest OutputChecker output_difference15359666
Ref: 45b515359666
Node: デバッグ15360057
Ref: library/doctest debugging15360205
Ref: 45b615360205
Ref: library/doctest doctest-debugging15360205
Ref: 45b715360205
Ref: library/doctest doctest script_from_examples15362743
Ref: 45ba15362743
Ref: library/doctest doctest testsource15363826
Ref: 45bb15363826
Ref: library/doctest doctest debug15364649
Ref: 45b915364649
Ref: library/doctest doctest debug_src15365985
Ref: 45bd15365985
Ref: library/doctest doctest DebugRunner15367116
Ref: 45b815367116
Ref: library/doctest doctest DocTestFailure15368127
Ref: 45bf15368127
Ref: library/doctest doctest DocTestFailure test15368558
Ref: 45c015368558
Ref: library/doctest doctest DocTestFailure example15368707
Ref: 45c115368707
Ref: library/doctest doctest DocTestFailure got15368814
Ref: 45c215368814
Ref: library/doctest doctest UnexpectedException15368892
Ref: 45be15368892
Ref: library/doctest doctest UnexpectedException test15369313
Ref: 45c315369313
Ref: library/doctest doctest UnexpectedException example15369467
Ref: 45c415369467
Ref: library/doctest doctest UnexpectedException exc_info15369579
Ref: 45c515369579
Node: アドバイス15369769
Ref: library/doctest doctest-soapbox15369898
Ref: 45c615369898
Ref: library/doctest soapbox15369898
Ref: 45c715369898
Node: unittest --- ユニットテストフレームワーク15374720
Ref: library/unittest doc15374961
Ref: 45c815374961
Ref: library/unittest module-unittest15374961
Ref: 10c15374961
Ref: library/unittest translation-repo15374961
Ref: 45c915374961
Ref: library/unittest unittest-unit-testing-framework15374961
Ref: 45ca15374961
Ref: unittest --- ユニットテストフレームワーク-Footnote-115378991
Ref: unittest --- ユニットテストフレームワーク-Footnote-215379069
Ref: unittest --- ユニットテストフレームワーク-Footnote-315379162
Ref: unittest --- ユニットテストフレームワーク-Footnote-415379195
Ref: unittest --- ユニットテストフレームワーク-Footnote-515379259
Ref: unittest --- ユニットテストフレームワーク-Footnote-615379317
Ref: unittest --- ユニットテストフレームワーク-Footnote-715379347
Ref: unittest --- ユニットテストフレームワーク-Footnote-815379379
Ref: unittest --- ユニットテストフレームワーク-Footnote-915379423
Node: 基本的な例<2>15379457
Ref: library/unittest basic-example15379624
Ref: 45cc15379624
Ref: library/unittest unittest-minimal-example15379624
Ref: 45cd15379624
Node: コマンドラインインターフェイス<2>15382940
Ref: library/unittest command-line-interface15383143
Ref: 45cf15383143
Ref: library/unittest unittest-command-line-interface15383143
Ref: 113615383143
Node: コマンドラインオプション<5>15385272
Ref: library/unittest command-line-options15385396
Ref: 45d115385396
Ref: library/unittest cmdoption-unittest-b15385561
Ref: 154915385561
Ref: library/unittest cmdoption-unittest-buffer15385561
Ref: 45d215385561
Ref: library/unittest cmdoption-unittest-c15385912
Ref: 154a15385912
Ref: library/unittest cmdoption-unittest-catch15385912
Ref: 45d315385912
Ref: library/unittest cmdoption-unittest-f15386325
Ref: 154c15386325
Ref: library/unittest cmdoption-unittest-failfast15386325
Ref: 45d515386325
Ref: library/unittest cmdoption-unittest-k15386435
Ref: 45d615386435
Ref: library/unittest cmdoption-unittest-locals15387387
Ref: 45d715387387
Ref: library/unittest cmdoption-unittest-durations15387476
Ref: 45d815387476
Node: テストディスカバリ15388107
Ref: library/unittest test-discovery15388319
Ref: 45d915388319
Ref: library/unittest unittest-test-discovery15388319
Ref: 45d015388319
Ref: library/unittest cmdoption-unittest-discover-v15389510
Ref: 45da15389510
Ref: library/unittest cmdoption-unittest-discover-verbose15389510
Ref: 45db15389510
Ref: library/unittest cmdoption-unittest-discover-s15389559
Ref: 45dc15389559
Ref: library/unittest cmdoption-unittest-discover-start-directory15389559
Ref: 45dd15389559
Ref: library/unittest cmdoption-unittest-discover-p15389691
Ref: 45de15389691
Ref: library/unittest cmdoption-unittest-discover-pattern15389691
Ref: 45df15389691
Ref: library/unittest cmdoption-unittest-discover-t15389820
Ref: 45e015389820
Ref: library/unittest cmdoption-unittest-discover-top-level-directory15389820
Ref: 45e115389820
Node: テストコードの構成15392596
Ref: library/unittest organizing-test-code15392796
Ref: 45e315392796
Ref: library/unittest organizing-tests15392796
Ref: 45ce15392796
Node: 既存テストコードの再利用15398387
Ref: library/unittest legacy-unit-tests15398608
Ref: 45e415398608
Ref: library/unittest re-using-old-test-code15398608
Ref: 45e515398608
Node: テストのスキップと予期された失敗15400290
Ref: library/unittest skipping-tests-and-expected-failures15400556
Ref: 45e615400556
Ref: library/unittest unittest-skipping15400556
Ref: 45e715400556
Ref: library/unittest unittest skip15404209
Ref: 1dbe15404209
Ref: library/unittest unittest skipIf15404403
Ref: 45ea15404403
Ref: library/unittest unittest skipUnless15404550
Ref: 45eb15404550
Ref: library/unittest unittest expectedFailure15404701
Ref: 45e915404701
Ref: library/unittest unittest SkipTest15405105
Ref: 11e615405105
Node: サブテストを利用して繰り返しテストの区別を付ける15405820
Ref: library/unittest distinguishing-test-iterations-using-subtests15406068
Ref: 45ec15406068
Ref: library/unittest subtests15406068
Ref: 11e415406068
Node: クラスと関数15408776
Ref: library/unittest classes-and-functions15409024
Ref: 45ed15409024
Ref: library/unittest unittest-contents15409024
Ref: 45ee15409024
Node: テストクラス15409235
Ref: library/unittest test-cases15409344
Ref: 45ef15409344
Ref: library/unittest testcase-objects15409344
Ref: 45f015409344
Ref: library/unittest unittest TestCase15409397
Ref: 2b315409397
Ref: library/unittest unittest TestCase setUp15411076
Ref: 155115411076
Ref: library/unittest unittest TestCase tearDown15411533
Ref: 155215411533
Ref: library/unittest unittest TestCase setUpClass15412443
Ref: c4315412443
Ref: library/unittest unittest TestCase tearDownClass15413019
Ref: 154f15413019
Ref: library/unittest unittest TestCase run15413615
Ref: 137e15413615
Ref: library/unittest unittest TestCase skipTest15414541
Ref: 45e815414541
Ref: library/unittest unittest TestCase subTest15414878
Ref: 11e315414878
Ref: library/unittest unittest TestCase debug15415623
Ref: 1c4915415623
Ref: library/unittest assert-methods15415861
Ref: 45cb15415861
Ref: library/unittest unittest TestCase assertEqual15420456
Ref: 74c15420456
Ref: library/unittest unittest TestCase assertNotEqual15421499
Ref: 74d15421499
Ref: library/unittest unittest TestCase assertTrue15421710
Ref: 74a15421710
Ref: library/unittest unittest TestCase assertFalse15421761
Ref: 74b15421761
Ref: library/unittest unittest TestCase assertIs15422515
Ref: 155315422515
Ref: library/unittest unittest TestCase assertIsNot15422573
Ref: 155415422573
Ref: library/unittest unittest TestCase assertIsNone15422812
Ref: 14a215422812
Ref: library/unittest unittest TestCase assertIsNotNone15422865
Ref: 14a315422865
Ref: library/unittest unittest TestCase assertIn15423076
Ref: 155c15423076
Ref: library/unittest unittest TestCase assertNotIn15423138
Ref: 155d15423138
Ref: library/unittest unittest TestCase assertIsInstance15423363
Ref: 155515423363
Ref: library/unittest unittest TestCase assertNotIsInstance15423424
Ref: 155615423424
Ref: library/unittest unittest TestCase assertIsSubclass15423957
Ref: 2b615423957
Ref: library/unittest unittest TestCase assertNotIsSubclass15424025
Ref: 2b715424025
Ref: library/unittest unittest TestCase assertRaises15427402
Ref: 75015427402
Ref: library/unittest unittest TestCase assertRaisesRegex15429628
Ref: 75215429628
Ref: library/unittest unittest TestCase assertWarns15430830
Ref: 137c15430830
Ref: library/unittest unittest TestCase assertWarnsRegex15433024
Ref: 137d15433024
Ref: library/unittest unittest TestCase assertLogs15434113
Ref: a5915434113
Ref: library/unittest unittest TestCase records15435524
Ref: 45f415435524
Ref: library/unittest unittest TestCase output15435697
Ref: 45f515435697
Ref: library/unittest unittest TestCase assertNoLogs15436301
Ref: a5815436301
Ref: library/unittest unittest TestCase assertAlmostEqual15441658
Ref: 74e15441658
Ref: library/unittest unittest TestCase assertNotAlmostEqual15441762
Ref: 74f15441762
Ref: library/unittest unittest TestCase assertGreater15443074
Ref: 155715443074
Ref: library/unittest unittest TestCase assertGreaterEqual15443137
Ref: 155815443137
Ref: library/unittest unittest TestCase assertLess15443205
Ref: 155915443205
Ref: library/unittest unittest TestCase assertLessEqual15443265
Ref: 155a15443265
Ref: library/unittest unittest TestCase assertRegex15443709
Ref: 75115443709
Ref: library/unittest unittest TestCase assertNotRegex15443768
Ref: 75315443768
Ref: library/unittest unittest TestCase assertCountEqual15444711
Ref: 144215444711
Ref: library/unittest unittest TestCase assertStartsWith15445573
Ref: 2b815445573
Ref: library/unittest unittest TestCase assertNotStartsWith15445636
Ref: 2b915445636
Ref: library/unittest unittest TestCase assertEndsWith15445901
Ref: 2ba15445901
Ref: library/unittest unittest TestCase assertNotEndsWith15445962
Ref: 2bb15445962
Ref: library/unittest unittest TestCase assertHasAttr15446221
Ref: 2b415446221
Ref: library/unittest unittest TestCase assertNotHasAttr15446281
Ref: 2b515446281
Ref: library/unittest type-specific-methods15446464
Ref: 45f315446464
Ref: library/unittest unittest TestCase addTypeEqualityFunc15446903
Ref: 156015446903
Ref: library/unittest unittest TestCase assertMultiLineEqual15450035
Ref: 155b15450035
Ref: library/unittest unittest TestCase assertSequenceEqual15450545
Ref: 14a115450545
Ref: library/unittest unittest TestCase assertListEqual15451274
Ref: 149f15451274
Ref: library/unittest unittest TestCase assertTupleEqual15451339
Ref: 14a015451339
Ref: library/unittest unittest TestCase assertSetEqual15451885
Ref: 149d15451885
Ref: library/unittest unittest TestCase assertDictEqual15452453
Ref: 149e15452453
Ref: library/unittest other-methods-and-attrs15452858
Ref: 45f615452858
Ref: library/unittest unittest TestCase fail15452951
Ref: 45f715452951
Ref: library/unittest unittest TestCase failureException15453145
Ref: 458b15453145
Ref: library/unittest unittest TestCase longMessage15453547
Ref: 154d15453547
Ref: library/unittest unittest TestCase maxDiff15454515
Ref: 144315454515
Ref: library/unittest unittest TestCase countTestCases15455298
Ref: 45f815455298
Ref: library/unittest unittest TestCase defaultTestResult15455513
Ref: 45f215455513
Ref: library/unittest unittest TestCase id15456102
Ref: 45f915456102
Ref: library/unittest unittest TestCase shortDescription15456337
Ref: 45fa15456337
Ref: library/unittest unittest TestCase addCleanup15457039
Ref: c7415457039
Ref: library/unittest unittest TestCase enterContext15457788
Ref: 8c815457788
Ref: library/unittest unittest TestCase doCleanups15458123
Ref: 155015458123
Ref: library/unittest unittest TestCase addClassCleanup15458927
Ref: c4115458927
Ref: library/unittest unittest TestCase enterClassContext15459727
Ref: 8c915459727
Ref: library/unittest unittest TestCase doClassCleanups15460084
Ref: 45fb15460084
Ref: library/unittest unittest IsolatedAsyncioTestCase15460938
Ref: 36115460938
Ref: library/unittest unittest IsolatedAsyncioTestCase loop_factory15461178
Ref: 45fc15461178
Ref: library/unittest unittest IsolatedAsyncioTestCase asyncSetUp15461434
Ref: 45fd15461434
Ref: library/unittest unittest IsolatedAsyncioTestCase asyncTearDown15462036
Ref: 45fe15462036
Ref: library/unittest unittest IsolatedAsyncioTestCase addAsyncCleanup15463044
Ref: 45ff15463044
Ref: library/unittest unittest IsolatedAsyncioTestCase enterAsyncContext15463249
Ref: 8ca15463249
Ref: library/unittest unittest IsolatedAsyncioTestCase run15463616
Ref: 460015463616
Ref: library/unittest unittest FunctionTestCase15465578
Ref: 1a7915465578
Node: テストのグループ化15466054
Ref: library/unittest grouping-tests15466202
Ref: 460115466202
Ref: library/unittest testsuite-objects15466202
Ref: 460215466202
Ref: library/unittest unittest TestSuite15466270
Ref: ff515466270
Ref: library/unittest unittest TestSuite addTest15467565
Ref: 460315467565
Ref: library/unittest unittest TestSuite addTests15467734
Ref: 460415467734
Ref: library/unittest unittest TestSuite run15468244
Ref: 460515468244
Ref: library/unittest unittest TestSuite debug15468595
Ref: 460615468595
Ref: library/unittest unittest TestSuite countTestCases15468941
Ref: 460715468941
Ref: library/unittest unittest TestSuite __iter__15469174
Ref: 122a15469174
Node: テストのロードと起動15471117
Ref: library/unittest loading-and-running-tests15471238
Ref: 460815471238
Ref: library/unittest unittest TestLoader15471311
Ref: 59315471311
Ref: library/unittest unittest TestLoader errors15471819
Ref: 108c15471819
Ref: library/unittest unittest TestLoader loadTestsFromTestCase15472423
Ref: 59515472423
Ref: library/unittest unittest TestLoader loadTestsFromModule15473142
Ref: 59415473142
Ref: library/unittest unittest TestLoader loadTestsFromName15474913
Ref: 155e15474913
Ref: library/unittest unittest TestLoader loadTestsFromNames15477023
Ref: 460a15477023
Ref: library/unittest unittest TestLoader getTestCaseNames15477411
Ref: 59615477411
Ref: library/unittest unittest TestLoader discover15477698
Ref: 11e715477698
Ref: library/unittest unittest TestLoader testMethodPrefix15481998
Ref: 460b15481998
Ref: library/unittest unittest TestLoader sortTestMethodsUsing15482338
Ref: 460c15482338
Ref: library/unittest unittest TestLoader suiteClass15482555
Ref: 155f15482555
Ref: library/unittest unittest TestLoader testNamePatterns15482917
Ref: 460d15482917
Ref: library/unittest unittest TestResult15483966
Ref: 137f15483966
Ref: library/unittest unittest TestResult errors15484916
Ref: 460e15484916
Ref: library/unittest unittest TestResult failures15485209
Ref: 460f15485209
Ref: library/unittest unittest TestResult skipped15485557
Ref: 461015485557
Ref: library/unittest unittest TestResult expectedFailures15485793
Ref: 461115485793
Ref: library/unittest unittest TestResult unexpectedSuccesses15486099
Ref: 461215486099
Ref: library/unittest unittest TestResult collectedDurations15486289
Ref: 1a7c15486289
Ref: library/unittest unittest TestResult shouldStop15486499
Ref: 461315486499
Ref: library/unittest unittest TestResult testsRun15486655
Ref: 461515486655
Ref: library/unittest unittest TestResult buffer15486751
Ref: 461615486751
Ref: library/unittest unittest TestResult failfast15487323
Ref: 461915487323
Ref: library/unittest unittest TestResult tb_locals15487547
Ref: 461a15487547
Ref: library/unittest unittest TestResult wasSuccessful15487698
Ref: 461b15487698
Ref: library/unittest unittest TestResult stop15488122
Ref: 461415488122
Ref: library/unittest unittest TestResult startTest15489263
Ref: 461715489263
Ref: library/unittest unittest TestResult stopTest15489371
Ref: 461815489371
Ref: library/unittest unittest TestResult startTestRun15489505
Ref: 156115489505
Ref: library/unittest unittest TestResult stopTestRun15489665
Ref: 156215489665
Ref: library/unittest unittest TestResult addError15489824
Ref: 1c4c15489824
Ref: library/unittest unittest TestResult addFailure15490398
Ref: 1c4b15490398
Ref: library/unittest unittest TestResult addSuccess15490951
Ref: 461c15490951
Ref: library/unittest unittest TestResult addSkip15491142
Ref: 1c4d15491142
Ref: library/unittest unittest TestResult addExpectedFailure15491508
Ref: 461d15491508
Ref: library/unittest unittest TestResult addUnexpectedSuccess15492013
Ref: 461e15492013
Ref: library/unittest unittest TestResult addSubTest15492356
Ref: 1c4e15492356
Ref: library/unittest unittest TestResult addDuration15493141
Ref: 1ab715493141
Ref: library/unittest unittest TextTestResult15493393
Ref: 75415493393
Ref: library/unittest unittest defaultTestLoader15493829
Ref: 460915493829
Ref: library/unittest unittest TextTestRunner15494167
Ref: 1ab615494167
Ref: library/unittest unittest TextTestRunner _makeResult15495926
Ref: 462015495926
Ref: library/unittest unittest TextTestRunner run15496812
Ref: 462115496812
Ref: library/unittest unittest main15497299
Ref: 11e515497299
Node: load_tests プロトコル15500798
Ref: library/unittest id115500891
Ref: 45e215500891
Ref: library/unittest load-tests-protocol15500891
Ref: 458915500891
Node: クラスとモジュールのフィクスチャ15504206
Ref: library/unittest class-and-module-fixtures15504412
Ref: 45f115504412
Node: setUpClass と tearDownClass15506881
Ref: library/unittest setupclass-and-teardownclass15507033
Ref: 462215507033
Node: setUpModule と tearDownModule15508072
Ref: library/unittest setupmodule-and-teardownmodule15508224
Ref: 462315508224
Ref: library/unittest unittest setUpModule15508306
Ref: c4215508306
Ref: library/unittest unittest addModuleCleanup15508959
Ref: c4015508959
Ref: library/unittest unittest enterModuleContext15509693
Ref: 8cb15509693
Ref: library/unittest unittest doModuleCleanups15510016
Ref: 1bd315510016
Node: シグナルハンドリング15510811
Ref: library/unittest signal-handling15510990
Ref: 45d415510990
Ref: library/unittest unittest installHandler15512606
Ref: 462415512606
Ref: library/unittest unittest registerResult15512913
Ref: 462515512913
Ref: library/unittest unittest removeResult15513514
Ref: 462615513514
Ref: library/unittest unittest removeHandler15513791
Ref: 154b15513791
Node: unittest mock --- モックオブジェクトライブラリ15514299
Ref: library/unittest mock doc15514508
Ref: 462715514508
Ref: library/unittest mock module-unittest mock15514508
Ref: 10d15514508
Ref: library/unittest mock translation-repo15514508
Ref: 462815514508
Ref: library/unittest mock unittest-mock-mock-object-library15514508
Ref: 462915514508
Ref: unittest mock --- モックオブジェクトライブラリ-Footnote-115516363
Ref: unittest mock --- モックオブジェクトライブラリ-Footnote-215516436
Node: クイックガイド15516475
Ref: library/unittest mock quick-guide15516616
Ref: 462a15516616
Node: Mock クラス15522903
Ref: library/unittest mock the-mock-class15523060
Ref: 462f15523060
Ref: library/unittest mock unittest mock Mock15524367
Ref: c3f15524367
Ref: library/unittest mock unittest mock Mock assert_called15528735
Ref: ef415528735
Ref: library/unittest mock unittest mock Mock assert_called_once15529074
Ref: ef515529074
Ref: library/unittest mock unittest mock Mock assert_called_with15529748
Ref: 1e0315529748
Ref: library/unittest mock unittest mock Mock assert_called_once_with15530138
Ref: 463515530138
Ref: library/unittest mock unittest mock Mock assert_any_call15530857
Ref: 463615530857
Ref: library/unittest mock unittest mock Mock assert_has_calls15531561
Ref: 1a2215531561
Ref: library/unittest mock unittest mock Mock assert_not_called15532651
Ref: 108e15532651
Ref: library/unittest mock unittest mock Mock reset_mock15533168
Ref: ef615533168
Ref: library/unittest mock unittest mock Mock mock_add_spec15534820
Ref: 463815534820
Ref: library/unittest mock unittest mock Mock attach_mock15535230
Ref: 195515535230
Ref: library/unittest mock unittest mock Mock configure_mock15535528
Ref: 463415535528
Ref: library/unittest mock unittest mock Mock __dir__15536816
Ref: 463a15536816
Ref: library/unittest mock unittest mock Mock _get_child_mock15537263
Ref: 463c15537263
Ref: library/unittest mock unittest mock Mock called15537822
Ref: 463d15537822
Ref: library/unittest mock unittest mock Mock call_count15538106
Ref: 178315538106
Ref: library/unittest mock unittest mock Mock return_value15538433
Ref: 463315538433
Ref: library/unittest mock unittest mock Mock side_effect15539278
Ref: 462b15539278
Ref: library/unittest mock unittest mock Mock call_args15541948
Ref: 1d6915541948
Ref: library/unittest mock unittest mock Mock call_args_list15543916
Ref: 463e15543916
Ref: library/unittest mock unittest mock Mock method_calls15545167
Ref: 463915545167
Ref: library/unittest mock unittest mock Mock mock_calls15545994
Ref: 463715545994
Ref: library/unittest mock unittest mock Mock __class__15547698
Ref: 464015547698
Ref: library/unittest mock unittest mock NonCallableMock15548535
Ref: 463015548535
Ref: library/unittest mock unittest mock PropertyMock15551424
Ref: 464115551424
Ref: library/unittest mock unittest mock AsyncMock15553528
Ref: c3e15553528
Ref: library/unittest mock unittest mock AsyncMock assert_awaited15556400
Ref: 464215556400
Ref: library/unittest mock unittest mock AsyncMock assert_awaited_once15557141
Ref: 464315557141
Ref: library/unittest mock unittest mock AsyncMock assert_awaited_with15557705
Ref: 464415557705
Ref: library/unittest mock unittest mock AsyncMock assert_awaited_once_with15558381
Ref: 464515558381
Ref: library/unittest mock unittest mock AsyncMock assert_any_await15559112
Ref: 464615559112
Ref: library/unittest mock unittest mock AsyncMock assert_has_awaits15559761
Ref: 464715559761
Ref: library/unittest mock unittest mock AsyncMock assert_not_awaited15560862
Ref: 464815560862
Ref: library/unittest mock unittest mock AsyncMock reset_mock15561043
Ref: 464915561043
Ref: library/unittest mock unittest mock AsyncMock await_count15561280
Ref: 464a15561280
Ref: library/unittest mock unittest mock AsyncMock await_args15561726
Ref: 464b15561726
Ref: library/unittest mock unittest mock AsyncMock await_args_list15562345
Ref: 1d6815562345
Ref: library/unittest mock unittest mock ThreadingMock15563057
Ref: 464c15563057
Ref: library/unittest mock unittest mock ThreadingMock wait_until_called15563769
Ref: 464e15563769
Ref: library/unittest mock unittest mock ThreadingMock wait_until_any_call_with15564328
Ref: 464f15564328
Ref: library/unittest mock unittest mock ThreadingMock DEFAULT_TIMEOUT15564933
Ref: 464d15564933
Ref: Mock クラス-Footnote-115565265
Node: 呼び出し15565796
Ref: library/unittest mock calling15565883
Ref: 465015565883
Node: 属性の削除15569443
Ref: library/unittest mock deleting-attributes15569568
Ref: 465115569568
Ref: library/unittest mock id215569568
Ref: 465215569568
Node: Mock の名前と name 属性15570395
Ref: library/unittest mock mock-names-and-the-name-attribute15570547
Ref: 465315570547
Node: 属性として設定されるモック15571224
Ref: library/unittest mock attaching-mocks-as-attributes15571352
Ref: 465415571352
Node: patcher15573359
Ref: library/unittest mock the-patchers15573537
Ref: 465515573537
Node: patch15574290
Ref: library/unittest mock patch15574360
Ref: 465615574360
Ref: library/unittest mock unittest mock patch15574560
Ref: 109215574560
Node: patch object15584498
Ref: library/unittest mock patch-object15584587
Ref: 465815584587
Ref: library/unittest mock unittest mock patch object15584632
Ref: 190615584632
Node: patch dict15586348
Ref: library/unittest mock patch-dict15586446
Ref: 465915586446
Ref: library/unittest mock unittest mock patch dict15586489
Ref: 196715586489
Node: patch multiple15590899
Ref: library/unittest mock patch-multiple15591021
Ref: 465b15591021
Ref: library/unittest mock unittest mock patch multiple15591072
Ref: 465c15591072
Node: patch のメソッド start と stop15594308
Ref: library/unittest mock patch-methods-start-and-stop15594453
Ref: 465d15594453
Ref: library/unittest mock start-and-stop15594453
Ref: 465e15594453
Ref: library/unittest mock unittest mock patch stopall15597338
Ref: 465f15597338
Node: ビルトインをパッチする15597498
Ref: library/unittest mock id415597640
Ref: 466015597640
Ref: library/unittest mock patch-builtins15597640
Ref: 466115597640
Node: TEST_PREFIX15598061
Ref: library/unittest mock id515598206
Ref: 466215598206
Ref: library/unittest mock test-prefix15598206
Ref: 465a15598206
Node: patch デコレータをネストする15599204
Ref: library/unittest mock nesting-patch-decorators15599343
Ref: 466315599343
Node: どこにパッチするか15600379
Ref: library/unittest mock id615600576
Ref: 465715600576
Ref: library/unittest mock where-to-patch15600576
Ref: 462c15600576
Node: デスクリプタやプロキシオブジェクトにパッチする15602858
Ref: library/unittest mock patching-descriptors-and-proxy-objects15603007
Ref: 466415603007
Ref: デスクリプタやプロキシオブジェクトにパッチする-Footnote-115603673
Node: MagicMock と magic method のサポート15603798
Ref: library/unittest mock magicmock-and-magic-method-support15603974
Ref: 466515603974
Node: Magic Method をモックする15604136
Ref: library/unittest mock magic-methods15604265
Ref: 462d15604265
Ref: library/unittest mock mocking-magic-methods15604265
Ref: 466615604265
Ref: Magic Method をモックする-Footnote-115608515
Ref: Magic Method をモックする-Footnote-215608894
Node: Magic Mock15609018
Ref: library/unittest mock magic-mock15609147
Ref: 466815609147
Ref: library/unittest mock unittest mock MagicMock15609317
Ref: 108f15609317
Ref: library/unittest mock unittest mock NonCallableMagicMock15609827
Ref: 463115609827
Node: ヘルパー15613562
Ref: library/unittest mock helpers15613788
Ref: 466915613788
Node: sentinel15613973
Ref: library/unittest mock sentinel15614046
Ref: 466a15614046
Ref: library/unittest mock unittest mock sentinel15614085
Ref: d9915614085
Node: DEFAULT15615546
Ref: library/unittest mock default15615632
Ref: 466b15615632
Ref: library/unittest mock unittest mock DEFAULT15615669
Ref: 463215615669
Node: call15615970
Ref: library/unittest mock call15616063
Ref: 466c15616063
Ref: library/unittest mock unittest mock call15616094
Ref: 1db315616094
Ref: library/unittest mock unittest mock call call_list15616713
Ref: 466d15616713
Ref: library/unittest mock calls-as-tuples15617847
Ref: 463f15617847
Node: create_autospec15619660
Ref: library/unittest mock create-autospec15619749
Ref: 466e15619749
Ref: library/unittest mock unittest mock create_autospec15619802
Ref: 193415619802
Node: ANY15621345
Ref: library/unittest mock any15621440
Ref: 466f15621440
Ref: library/unittest mock unittest mock ANY15621469
Ref: 1db115621469
Node: FILTER_DIR15622749
Ref: library/unittest mock filter-dir15622838
Ref: 467015622838
Ref: library/unittest mock unittest mock FILTER_DIR15622881
Ref: 463b15622881
Node: mock_open15625276
Ref: library/unittest mock mock-open15625380
Ref: 467115625380
Ref: library/unittest mock unittest mock mock_open15625421
Ref: 11e915625421
Ref: mock_open-Footnote-115628584
Node: autospec を使う15628609
Ref: library/unittest mock auto-speccing15628716
Ref: 462e15628716
Ref: library/unittest mock autospeccing15628716
Ref: 467215628716
Ref: autospec を使う-Footnote-115638419
Node: Sealing mocks15638787
Ref: library/unittest mock sealing-mocks15638876
Ref: 467315638876
Ref: library/unittest mock unittest mock seal15638925
Ref: d9a15638925
Node: Order of precedence of side_effect return_value and wraps15639738
Ref: library/unittest mock order-of-precedence-of-side-effect-return-value-and-wraps15639913
Ref: 467415639913
Node: unittest mock --- 入門15643996
Ref: library/unittest mock-examples doc15644194
Ref: 467515644194
Ref: library/unittest mock-examples translation-repo15644194
Ref: 467615644194
Ref: library/unittest mock-examples unittest-mock-getting-started15644194
Ref: 467715644194
Ref: library/unittest mock-examples getting-started15644286
Ref: 467815644286
Node: Mock を使う15644361
Ref: library/unittest mock-examples using-mock15644466
Ref: 467915644466
Node: Mock のパッチ用メソッド15645078
Ref: library/unittest mock-examples mock-patching-methods15645236
Ref: 467a15645236
Node: オブジェクトのメソッド呼び出しに対するモック15647087
Ref: library/unittest mock-examples mock-for-method-calls-on-an-object15647281
Ref: 467b15647281
Node: クラスをモックする15648862
Ref: library/unittest mock-examples mocking-classes15649054
Ref: 467c15649054
Node: モックに名前をつける15650341
Ref: library/unittest mock-examples naming-your-mocks15650509
Ref: 467d15650509
Node: 全ての呼び出しのトラッキング15651049
Ref: library/unittest mock-examples tracking-all-calls15651223
Ref: 467e15651223
Node: 戻り値や属性を設定する15652834
Ref: library/unittest mock-examples setting-return-values-and-attributes15653017
Ref: 467f15653017
Node: モックから例外を発生させる15654640
Ref: library/unittest mock-examples raising-exceptions-with-mocks15654814
Ref: 468015654814
Node: side_effect の関数と iterable15655258
Ref: library/unittest mock-examples side-effect-functions-and-iterables15655441
Ref: 468115655441
Node: 非同期イテレータをモックする15656614
Ref: library/unittest mock-examples mocking-asynchronous-iterators15656818
Ref: 468215656818
Node: 非同期コンテキストマネージャをモックする15657488
Ref: library/unittest mock-examples mocking-asynchronous-context-manager15657707
Ref: 468315657707
Node: 既存のオブジェクトから Mock を作る15658737
Ref: library/unittest mock-examples creating-a-mock-from-an-existing-object15658958
Ref: 468415658958
Node: Using side_effect to return per file content15661008
Ref: library/unittest mock-examples using-side-effect-to-return-per-file-content15661160
Ref: 468515661160
Node: patch デコレータ15662011
Ref: library/unittest mock-examples patch-decorators15662140
Ref: 468615662140
Node: さらなる例15667871
Ref: library/unittest mock-examples further-examples15667977
Ref: 468715667977
Ref: library/unittest mock-examples id115667977
Ref: 468815667977
Node: chained call をモックする15668724
Ref: library/unittest mock-examples mocking-chained-calls15668837
Ref: 468915668837
Node: 部分的なモック15672639
Ref: library/unittest mock-examples partial-mocking15672809
Ref: 468a15672809
Ref: 部分的なモック-Footnote-115675095
Node: ジェネレータメソッドをモックする15675196
Ref: library/unittest mock-examples mocking-a-generator-method15675389
Ref: 468b15675389
Ref: ジェネレータメソッドをモックする-Footnote-115676822
Node: 同じパッチを全てのメソッドに適用する15677207
Ref: library/unittest mock-examples applying-the-same-patch-to-every-test-method15677416
Ref: 468c15677416
Node: Unboundメソッドをモックする15680003
Ref: library/unittest mock-examples mocking-unbound-methods15680221
Ref: 468d15680221
Node: モックで複数回の呼び出しをチェックする15682063
Ref: library/unittest mock-examples checking-multiple-calls-with-mock15682269
Ref: 468e15682269
Node: ミュータブルな引数に対処する15684068
Ref: library/unittest mock-examples coping-with-mutable-arguments15684261
Ref: 468f15684261
Node: patch をネストする15688824
Ref: library/unittest mock-examples nesting-patches15688997
Ref: 469015688997
Node: MagicMock で辞書をモックする15690824
Ref: library/unittest mock-examples mocking-a-dictionary-with-magicmock15690987
Ref: 469115690987
Node: Mock のサブクラスと属性15693630
Ref: library/unittest mock-examples mock-subclasses-and-their-attributes15693809
Ref: 469215693809
Ref: Mock のサブクラスと属性-Footnote-115695918
Ref: Mock のサブクラスと属性-Footnote-215696086
Ref: Mock のサブクラスと属性-Footnote-315696144
Node: patch dict で import をモックする15696225
Ref: library/unittest mock-examples mocking-imports-with-patch-dict15696423
Ref: 469315696423
Node: Tracking order of calls and less verbose call assertions15699066
Ref: library/unittest mock-examples tracking-order-of-calls-and-less-verbose-call-assertions15699262
Ref: 469415699262
Node: More complex argument matching15702595
Ref: library/unittest mock-examples more-complex-argument-matching15702742
Ref: 469515702742
Ref: More complex argument matching-Footnote-115705811
Ref: More complex argument matching-Footnote-215705854
Node: test --- Regression tests package for Python15705976
Ref: library/test doc15706166
Ref: 469615706166
Ref: library/test module-test15706166
Ref: e815706166
Ref: library/test test-regression-tests-package-for-python15706166
Ref: 469715706166
Ref: library/test translation-repo15706166
Ref: 469815706166
Node: Writing Unit Tests for the test package15707662
Ref: library/test writing-tests15707875
Ref: 469915707875
Ref: library/test writing-unit-tests-for-the-test-package15707875
Ref: 469a15707875
Node: コマンドラインインターフェースを利用してテストを実行する15713867
Ref: library/test module-test regrtest15714080
Ref: e915714080
Ref: library/test regrtest15714080
Ref: 120b15714080
Ref: library/test running-tests-using-the-command-line-interface15714080
Ref: 469b15714080
Node: test support --- Utilities for the Python test suite15716264
Ref: library/test module-test support15716487
Ref: ea15716487
Ref: library/test test-support-utilities-for-the-python-test-suite15716487
Ref: 469c15716487
Ref: library/test test support TestFailed15716999
Ref: 469d15716999
Ref: library/test test support ResourceDenied15717273
Ref: 469e15717273
Ref: library/test test support verbose15717618
Ref: 46a015717618
Ref: library/test test support is_jython15717905
Ref: 46a115717905
Ref: library/test test support is_android15718031
Ref: 46a215718031
Ref: library/test test support is_emscripten15718128
Ref: 46a315718128
Ref: library/test test support is_wasi15718231
Ref: 46a415718231
Ref: library/test test support is_apple_mobile15718322
Ref: 46a515718322
Ref: library/test test support is_apple15718450
Ref: 46a615718450
Ref: library/test test support unix_shell15718588
Ref: 46a715718588
Ref: library/test test support LOOPBACK_TIMEOUT15718726
Ref: 1d9c15718726
Ref: library/test test support INTERNET_TIMEOUT15719349
Ref: 1d9d15719349
Ref: library/test test support SHORT_TIMEOUT15719876
Ref: 1c6315719876
Ref: library/test test support LONG_TIMEOUT15720272
Ref: 1d9e15720272
Ref: library/test test support PGO15720785
Ref: 46a915720785
Ref: library/test test support PIPE_MAX_SIZE15720953
Ref: 46aa15720953
Ref: library/test test support Py_DEBUG15721142
Ref: 46ab15721142
Ref: library/test test support SOCK_MAX_SIZE15721352
Ref: 46ac15721352
Ref: library/test test support TEST_SUPPORT_DIR15721544
Ref: 46ad15721544
Ref: library/test test support TEST_HOME_DIR15721661
Ref: 46ae15721661
Ref: library/test test support TEST_DATA_DIR15721786
Ref: 46af15721786
Ref: library/test test support MAX_Py_ssize_t15721917
Ref: 46b015721917
Ref: library/test test support max_memuse15722069
Ref: 46b115722069
Ref: library/test test support real_max_memuse15722302
Ref: 46b315722302
Ref: library/test test support MISSING_C_DOCSTRINGS15722552
Ref: 46b415722552
Ref: library/test test support HAVE_DOCSTRINGS15722844
Ref: 46b515722844
Ref: library/test test support TEST_HTTP_URL15723124
Ref: 46b615723124
Ref: library/test test support ALWAYS_EQ15723257
Ref: 46b715723257
Ref: library/test test support NEVER_EQ15723378
Ref: 46b815723378
Ref: library/test test support LARGEST15723535
Ref: 46b915723535
Ref: library/test test support SMALLEST15723674
Ref: 46ba15723674
Ref: library/test test support busy_retry15723875
Ref: 46bb15723875
Ref: library/test test support sleeping_retry15724544
Ref: 46bc15724544
Ref: library/test test support is_resource_enabled15725429
Ref: 46bd15725429
Ref: library/test test support get_resource_value15725716
Ref: 46be15725716
Ref: library/test test support python_is_optimized15725928
Ref: 46bf15725928
Ref: library/test test support with_pymalloc15726057
Ref: 46c015726057
Ref: library/test test support requires15726147
Ref: 469f15726147
Ref: library/test test support sortdict15726619
Ref: 46c115726619
Ref: library/test test support findfile15726712
Ref: 46c215726712
Ref: library/test test support get_pagesize15727267
Ref: 46c315727267
Ref: library/test test support setswitchinterval15727376
Ref: 46c415727376
Ref: library/test test support check_impl_detail15727603
Ref: 46c515727603
Ref: library/test test support set_memlimit15728120
Ref: 46b215728120
Ref: library/test test support record_original_stdout15728279
Ref: 46c615728279
Ref: library/test test support get_original_stdout15728446
Ref: 46c715728446
Ref: library/test test support args_from_interpreter_flags15728618
Ref: 46c815728618
Ref: library/test test support optim_args_from_interpreter_flags15728808
Ref: 46c915728808
Ref: library/test test support captured_stdin15728991
Ref: 46ca15728991
Ref: library/test test support captured_stdout15729037
Ref: 46cb15729037
Ref: library/test test support captured_stderr15729084
Ref: 1dd815729084
Ref: library/test test support disable_faulthandler15729865
Ref: 46cc15729865
Ref: library/test test support gc_collect15729990
Ref: 46cd15729990
Ref: library/test test support disable_gc15730327
Ref: 46ce15730327
Ref: library/test test support swap_attr15730509
Ref: 46cf15730509
Ref: library/test test support swap_item15731092
Ref: 46d015731092
Ref: library/test test support flush_std_streams15731673
Ref: 46d115731673
Ref: library/test test support print_warning15731950
Ref: 46d215731950
Ref: library/test test support wait_process15732225
Ref: 1d5d15732225
Ref: library/test test support calcobjsize15732745
Ref: 46d415732745
Ref: library/test test support calcvobjsize15732979
Ref: 46d515732979
Ref: library/test test support checksizeof15733218
Ref: 46d715733218
Ref: library/test test support anticipate_failure15733390
Ref: 46d815733390
Ref: library/test test support system_must_validate_cert15733704
Ref: 46d915733704
Ref: library/test test support run_with_locale15733858
Ref: 46da15733858
Ref: library/test test support run_with_tz15734296
Ref: 46db15734296
Ref: library/test test support requires_freebsd_version15734459
Ref: 46dc15734459
Ref: library/test test support requires_linux_version15734674
Ref: 46dd15734674
Ref: library/test test support requires_mac_version15734884
Ref: 46de15734884
Ref: library/test test support requires_gil_enabled15735091
Ref: 46df15735091
Ref: library/test test support requires_IEEE_75415735268
Ref: 46e015735268
Ref: library/test test support requires_zlib15735378
Ref: 46e115735378
Ref: library/test test support requires_gzip15735492
Ref: 46e215735492
Ref: library/test test support requires_bz215735605
Ref: 46e315735605
Ref: library/test test support requires_lzma15735716
Ref: 46e415735716
Ref: library/test test support requires_resource15735829
Ref: 46e515735829
Ref: library/test test support requires_docstrings15735955
Ref: 46e615735955
Ref: library/test test support requires_limited_api15736079
Ref: 46e715736079
Ref: library/test test support cpython_only15736220
Ref: 46e815736220
Ref: library/test test support impl_detail15736317
Ref: 46e915736317
Ref: library/test test support thread_unsafe15736548
Ref: 46ea15736548
Ref: library/test test support no_tracing15736749
Ref: 46eb15736749
Ref: library/test test support refcount_test15736873
Ref: 46ec15736873
Ref: library/test test support bigmemtest15737178
Ref: 46ed15737178
Ref: library/test test support bigaddrspacetest15737924
Ref: 46ee15737924
Ref: library/test test support linked_to_musl15738026
Ref: 46ef15738026
Ref: library/test test support check_syntax_error15738482
Ref: 46f015738482
Ref: library/test test support open_urlresource15739037
Ref: 46f115739037
Ref: library/test test support reap_children15739167
Ref: 46f215739167
Ref: library/test test support get_attribute15739442
Ref: 46f315739442
Ref: library/test test support catch_unraisable_exception15739606
Ref: 1dbd15739606
Ref: library/test test support load_package_tests15740499
Ref: 46f415740499
Ref: library/test test support detect_api_mismatch15741128
Ref: 46f515741128
Ref: library/test test support patch15741592
Ref: 46f615741592
Ref: library/test test support run_in_subinterp15741929
Ref: 46f715741929
Ref: library/test test support check_free_after_iterating15742100
Ref: 46f815742100
Ref: library/test test support missing_compiler_executable15742258
Ref: 46f915742258
Ref: library/test test support check__all__15742581
Ref: 1d3315742581
Ref: library/test test support skip_if_broken_multiprocessing_synchronize15744392
Ref: 1d3415744392
Ref: library/test test support check_disallow_instantiation15744686
Ref: 46fa15744686
Ref: library/test test support adjust_int_max_str_digits15744895
Ref: 46fb15744895
Ref: library/test test support SuppressCrashReport15745362
Ref: 46fc15745362
Ref: library/test test support SaveSignals15745867
Ref: 46fe15745867
Ref: library/test test support SaveSignals save15746002
Ref: 46ff15746002
Ref: library/test test support SaveSignals restore15746154
Ref: 470015746154
Ref: library/test test support Matcher15746299
Ref: 470115746299
Ref: library/test test support Matcher matches15746336
Ref: 470215746336
Ref: library/test test support Matcher match_value15746455
Ref: 470315746455
Ref: test support --- Utilities for the Python test suite-Footnote-115746636
Node: test support socket_helper --- Utilities for socket tests15746716
Ref: library/test module-test support socket_helper15746966
Ref: ef15746966
Ref: library/test test-support-socket-helper-utilities-for-socket-tests15746966
Ref: 470415746966
Ref: library/test test support socket_helper IPV6_ENABLED15747208
Ref: 470515747208
Ref: library/test test support socket_helper find_unused_port15747344
Ref: 470615747344
Ref: library/test test support socket_helper bind_port15748666
Ref: 470715748666
Ref: library/test test support socket_helper bind_unix_socket15749612
Ref: 470815749612
Ref: library/test test support socket_helper skip_unless_bind_unix_socket15749797
Ref: 470915749797
Ref: library/test test support socket_helper transient_internet15749968
Ref: 46a815749968
Node: test support script_helper --- Utilities for the Python execution tests15750242
Ref: library/test module-test support script_helper15750526
Ref: ee15750526
Ref: library/test test-support-script-helper-utilities-for-the-python-execution-tests15750526
Ref: 470a15750526
Ref: library/test test support script_helper interpreter_requires_environment15750792
Ref: 470b15750792
Ref: library/test test support script_helper run_python_until_end15751765
Ref: 470c15751765
Ref: library/test test support script_helper assert_python_ok15752151
Ref: 470d15752151
Ref: library/test test support script_helper assert_python_failure15752792
Ref: 470e15752792
Ref: library/test test support script_helper spawn_python15753234
Ref: 470f15753234
Ref: library/test test support script_helper kill_python15753548
Ref: 471015753548
Ref: library/test test support script_helper make_script15753705
Ref: 471115753705
Ref: library/test test support script_helper make_zip_script15754015
Ref: 471215754015
Ref: library/test test support script_helper make_pkg15754385
Ref: 471315754385
Ref: library/test test support script_helper make_zip_pkg15754589
Ref: 471415754589
Node: test support bytecode_helper --- Support tools for testing correct bytecode generation15755120
Ref: library/test module-test support bytecode_helper15755410
Ref: eb15755410
Ref: library/test test-support-bytecode-helper-support-tools-for-testing-correct-bytecode-generation15755410
Ref: 471515755410
Ref: library/test test support bytecode_helper BytecodeTestCase15755783
Ref: 471615755783
Ref: library/test test support bytecode_helper BytecodeTestCase get_disassembly_as_string15755946
Ref: 471715755946
Ref: library/test test support bytecode_helper BytecodeTestCase assertInBytecode15756061
Ref: 471815756061
Ref: library/test test support bytecode_helper BytecodeTestCase assertNotInBytecode15756247
Ref: 471915756247
Node: test support threading_helper --- Utilities for threading tests15756408
Ref: library/test module-test support threading_helper15756676
Ref: f015756676
Ref: library/test test-support-threading-helper-utilities-for-threading-tests15756676
Ref: 471a15756676
Ref: library/test test support threading_helper join_thread15756937
Ref: 471b15756937
Ref: library/test test support threading_helper reap_threads15757160
Ref: 471c15757160
Ref: library/test test support threading_helper start_threads15757302
Ref: 471d15757302
Ref: library/test test support threading_helper threading_cleanup15757711
Ref: 471e15757711
Ref: library/test test support threading_helper threading_setup15757950
Ref: 471f15757950
Ref: library/test test support threading_helper wait_threads_exit15758079
Ref: 472015758079
Ref: library/test test support threading_helper catch_threading_exception15758263
Ref: 472115758263
Ref: library/test test support threading_helper run_concurrently15759229
Ref: 472215759229
Node: test support os_helper --- Utilities for os tests15759502
Ref: library/test module-test support os_helper15759741
Ref: ed15759741
Ref: library/test test-support-os-helper-utilities-for-os-tests15759741
Ref: 472315759741
Ref: library/test test support os_helper FS_NONASCII15759960
Ref: 472415759960
Ref: library/test test support os_helper SAVEDCWD15760091
Ref: 472515760091
Ref: library/test test support os_helper TESTFN15760195
Ref: 472615760195
Ref: library/test test support os_helper TESTFN_NONASCII15760456
Ref: 472715760456
Ref: library/test test support os_helper TESTFN_UNENCODABLE15760844
Ref: 472815760844
Ref: library/test test support os_helper TESTFN_UNDECODABLE15761176
Ref: 472915761176
Ref: library/test test support os_helper TESTFN_UNICODE15761507
Ref: 472a15761507
Ref: library/test test support os_helper EnvironmentVarGuard15761623
Ref: 15fb15761623
Ref: library/test test support os_helper FakePath15762288
Ref: 472b15762288
Ref: library/test test support os_helper EnvironmentVarGuard set15762554
Ref: 472c15762554
Ref: library/test test support os_helper EnvironmentVarGuard unset15762689
Ref: 187215762689
Ref: library/test test support os_helper can_symlink15762903
Ref: 472d15762903
Ref: library/test test support os_helper can_xattr15763106
Ref: 472e15763106
Ref: library/test test support os_helper change_cwd15763231
Ref: 472f15763231
Ref: library/test test support os_helper create_empty_file15763696
Ref: 473015763696
Ref: library/test test support os_helper fd_count15763849
Ref: 473115763849
Ref: library/test test support os_helper fs_is_case_insensitive15763949
Ref: 473215763949
Ref: library/test test support os_helper make_bad_fd15764108
Ref: 473315764108
Ref: library/test test support os_helper rmdir15764304
Ref: 473415764304
Ref: library/test test support os_helper rmtree15764613
Ref: 473515764613
Ref: library/test test support os_helper skip_unless_symlink15764957
Ref: 473615764957
Ref: library/test test support os_helper skip_unless_xattr15765141
Ref: 473715765141
Ref: library/test test support os_helper temp_cwd15765267
Ref: 473815765267
Ref: library/test test support os_helper temp_dir15766117
Ref: 473915766117
Ref: library/test test support os_helper temp_umask15766574
Ref: 473a15766574
Ref: library/test test support os_helper unlink15766724
Ref: 473b15766724
Node: test support import_helper --- Utilities for import tests15766970
Ref: library/test module-test support import_helper15767207
Ref: ec15767207
Ref: library/test test-support-import-helper-utilities-for-import-tests15767207
Ref: 473c15767207
Ref: library/test test support import_helper forget15767450
Ref: 473d15767450
Ref: library/test test support import_helper import_fresh_module15767690
Ref: 1c6215767690
Ref: library/test test support import_helper import_module15769597
Ref: 473e15769597
Ref: library/test test support import_helper modules_setup15770331
Ref: 473f15770331
Ref: library/test test support import_helper modules_cleanup15770439
Ref: 474015770439
Ref: library/test test support import_helper unload15770618
Ref: 474115770618
Ref: library/test test support import_helper make_legacy_pyc15770735
Ref: 474215770735
Ref: library/test test support import_helper CleanImport15771085
Ref: 474315771085
Ref: library/test test support import_helper DirsOnSysPath15771479
Ref: 474415771479
Ref: test support import_helper --- Utilities for import tests-Footnote-115772040
Ref: test support import_helper --- Utilities for import tests-Footnote-215772082
Node: test support warnings_helper --- Utilities for warnings tests15772124
Ref: library/test module-test support warnings_helper15772303
Ref: f115772303
Ref: library/test test-support-warnings-helper-utilities-for-warnings-tests15772303
Ref: 474515772303
Ref: library/test test support warnings_helper ignore_warnings15772558
Ref: 474615772558
Ref: library/test test support warnings_helper check_no_resource_warning15773072
Ref: 474715773072
Ref: library/test test support warnings_helper check_syntax_warning15773363
Ref: 474815773363
Ref: library/test test support warnings_helper check_warnings15774183
Ref: 474915774183
Ref: library/test test support warnings_helper WarningsRecorder15777659
Ref: 474a15777659
Node: デバッグとプロファイル15777902
Ref: library/debug doc15778078
Ref: 474b15778078
Ref: library/debug debugging-and-profiling15778078
Ref: 474c15778078
Ref: library/debug translation-repo15778078
Ref: 474d15778078
Ref: library/audit_events audit-events15778555
Ref: 1c1315778555
Node: 監査イベント表15779223
Ref: library/audit_events doc15779367
Ref: 474e15779367
Ref: library/audit_events audit-events-table15779367
Ref: 474f15779367
Ref: 監査イベント表-Footnote-115839965
Node: bdb --- デバッガーフレームワーク15840007
Ref: library/bdb doc15840223
Ref: 477115840223
Ref: library/bdb bdb-debugger-framework15840223
Ref: 477215840223
Ref: library/bdb module-bdb15840223
Ref: 1015840223
Ref: library/bdb translation-repo15840223
Ref: 477315840223
Ref: library/bdb bdb BdbQuit15840593
Ref: 27815840593
Ref: library/bdb bdb Breakpoint15840764
Ref: 477415840764
Ref: library/bdb bdb Breakpoint deleteMe15842145
Ref: 477b15842145
Ref: library/bdb bdb Breakpoint enable15842516
Ref: 477c15842516
Ref: library/bdb bdb Breakpoint disable15842616
Ref: 477d15842616
Ref: library/bdb bdb Breakpoint bpformat15842717
Ref: 477e15842717
Ref: library/bdb bdb Breakpoint bpprint15843141
Ref: 477f15843141
Ref: library/bdb bdb Breakpoint file15843426
Ref: 477715843426
Ref: library/bdb bdb Breakpoint line15843504
Ref: 478015843504
Ref: library/bdb bdb Breakpoint temporary15843619
Ref: 478115843619
Ref: library/bdb bdb Breakpoint cond15843741
Ref: 477a15843741
Ref: library/bdb bdb Breakpoint funcname15843856
Ref: 477815843856
Ref: library/bdb bdb Breakpoint enabled15844003
Ref: 478215844003
Ref: library/bdb bdb Breakpoint bpbynumber15844093
Ref: 477515844093
Ref: library/bdb bdb Breakpoint bplist15844211
Ref: 477615844211
Ref: library/bdb bdb Breakpoint ignore15844365
Ref: 478315844365
Ref: library/bdb bdb Breakpoint hits15844456
Ref: 477915844456
Ref: library/bdb bdb Bdb15844572
Ref: 2d515844572
Ref: library/bdb bdb Bdb canonic15846428
Ref: 478415846428
Ref: library/bdb bdb Bdb start_trace15846813
Ref: 478515846813
Ref: library/bdb bdb Bdb stop_trace15847026
Ref: 478615847026
Ref: library/bdb bdb Bdb reset15847222
Ref: 478715847222
Ref: library/bdb bdb Bdb trace_dispatch15847420
Ref: 478915847420
Ref: library/bdb bdb Bdb dispatch_line15849180
Ref: 478a15849180
Ref: library/bdb bdb Bdb dispatch_call15849662
Ref: 478c15849662
Ref: library/bdb bdb Bdb dispatch_return15850151
Ref: 478e15850151
Ref: library/bdb bdb Bdb dispatch_exception15850648
Ref: 479015850648
Ref: library/bdb bdb Bdb is_skipped_module15851396
Ref: 479215851396
Ref: library/bdb bdb Bdb stop_here15851524
Ref: 479315851524
Ref: library/bdb bdb Bdb break_here15851658
Ref: 479415851658
Ref: library/bdb bdb Bdb break_anywhere15851972
Ref: 479615851972
Ref: library/bdb bdb Bdb user_call15852235
Ref: 478d15852235
Ref: library/bdb bdb Bdb user_line15852542
Ref: 478b15852542
Ref: library/bdb bdb Bdb user_return15852771
Ref: 478f15852771
Ref: library/bdb bdb Bdb user_exception15852977
Ref: 479115852977
Ref: library/bdb bdb Bdb do_clear15853185
Ref: 479715853185
Ref: library/bdb bdb Bdb set_step15853638
Ref: 479815853638
Ref: library/bdb bdb Bdb set_next15853734
Ref: 479915853734
Ref: library/bdb bdb Bdb set_return15853908
Ref: 479a15853908
Ref: library/bdb bdb Bdb set_until15854038
Ref: 479b15854038
Ref: library/bdb bdb Bdb set_trace15854267
Ref: 479c15854267
Ref: library/bdb bdb Bdb set_continue15854672
Ref: 479e15854672
Ref: library/bdb bdb Bdb set_quit15854956
Ref: 478815854956
Ref: library/bdb bdb Bdb set_break15855473
Ref: 479f15855473
Ref: library/bdb bdb Bdb clear_break15855919
Ref: 47a015855919
Ref: library/bdb bdb Bdb clear_bpbynumber15856185
Ref: 47a115856185
Ref: library/bdb bdb Bdb clear_all_file_breaks15856483
Ref: 47a215856483
Ref: library/bdb bdb Bdb clear_all_breaks15856736
Ref: 47a315856736
Ref: library/bdb bdb Bdb get_bpbynumber15856968
Ref: 47a415856968
Ref: library/bdb bdb Bdb get_break15857416
Ref: 47a515857416
Ref: library/bdb bdb Bdb get_breaks15857561
Ref: 47a615857561
Ref: library/bdb bdb Bdb get_file_breaks15857809
Ref: 47a715857809
Ref: library/bdb bdb Bdb get_all_breaks15858041
Ref: 47a815858041
Ref: library/bdb bdb Bdb disable_current_event15858377
Ref: 47a915858377
Ref: library/bdb bdb Bdb restart_events15858652
Ref: 47aa15858652
Ref: library/bdb bdb Bdb get_stack15859216
Ref: 47ab15859216
Ref: library/bdb bdb Bdb format_stack_entry15859513
Ref: 47ac15859513
Ref: library/bdb bdb Bdb run15860147
Ref: 47ad15860147
Ref: library/bdb bdb Bdb runeval15860383
Ref: 47ae15860383
Ref: library/bdb bdb Bdb runctx15860621
Ref: 47af15860621
Ref: library/bdb bdb Bdb runcall15860793
Ref: c7115860793
Ref: library/bdb bdb checkfuncname15861016
Ref: 47b015861016
Ref: library/bdb bdb effective15861470
Ref: 479515861470
Ref: library/bdb bdb set_trace15862239
Ref: 479d15862239
Ref: bdb --- デバッガーフレームワーク-Footnote-115862451
Node: faulthandler --- Python トレースバックをダンプする15862514
Ref: library/faulthandler doc15862736
Ref: 47b115862736
Ref: library/faulthandler faulthandler-dump-the-python-traceback15862736
Ref: 47b215862736
Ref: library/faulthandler module-faulthandler15862736
Ref: 5c15862736
Ref: library/faulthandler translation-repo15862736
Ref: 47b315862736
Node: tracebackのダンプ15866075
Ref: library/faulthandler dumping-the-traceback15866224
Ref: 47b415866224
Ref: library/faulthandler faulthandler dump_traceback15866283
Ref: fff15866283
Node: Dumping the C stack15866764
Ref: library/faulthandler dumping-the-c-stack15866958
Ref: 47b515866958
Ref: library/faulthandler faulthandler dump_c_stack15867041
Ref: 20e15867041
Node: C Stack Compatibility15867369
Ref: library/faulthandler c-stack-compatibility15867446
Ref: 20d15867446
Ref: library/faulthandler id115867446
Ref: 47b615867446
Ref: C Stack Compatibility-Footnote-115868065
Ref: C Stack Compatibility-Footnote-215868114
Node: フォールトハンドラの状態15868161
Ref: library/faulthandler fault-handler-state15868385
Ref: 47b715868385
Ref: library/faulthandler faulthandler enable15868466
Ref: 20f15868466
Ref: library/faulthandler faulthandler disable15869836
Ref: 47b915869836
Ref: library/faulthandler faulthandler is_enabled15870062
Ref: 47ba15870062
Node: タイムアウト後にtracebackをダンプする15870184
Ref: library/faulthandler dumping-the-tracebacks-after-a-timeout15870449
Ref: 47bb15870449
Ref: library/faulthandler faulthandler dump_traceback_later15870558
Ref: 100015870558
Ref: library/faulthandler faulthandler cancel_dump_traceback_later15871603
Ref: 47bc15871603
Node: ユーザシグナルに対してtracebackをダンプする15871766
Ref: library/faulthandler dumping-the-traceback-on-a-user-signal15872025
Ref: 47bd15872025
Ref: library/faulthandler faulthandler register15872149
Ref: ffe15872149
Ref: library/faulthandler faulthandler unregister15872928
Ref: 47be15872928
Node: ファイル記述子の問題15873328
Ref: library/faulthandler faulthandler-fd15873549
Ref: 47b815873549
Ref: library/faulthandler issue-with-file-descriptors15873549
Ref: 47bf15873549
Node: 使用例<43>15874163
Ref: library/faulthandler example15874315
Ref: 47c015874315
Node: pdb --- The Python Debugger15877620
Ref: library/pdb doc15877823
Ref: 47c115877823
Ref: library/pdb debugger15877823
Ref: 47c215877823
Ref: library/pdb module-pdb15877823
Ref: aa15877823
Ref: library/pdb pdb-the-python-debugger15877823
Ref: 47c315877823
Ref: library/pdb translation-repo15877823
Ref: 47c415877823
Ref: pdb --- The Python Debugger-Footnote-115880308
Node: コマンドライン・インターフェース<8>15880371
Ref: library/pdb command-line-interface15880512
Ref: 47c615880512
Ref: library/pdb pdb-cli15880512
Ref: 2e215880512
Ref: library/pdb cmdoption-pdb-c15881316
Ref: 47c715881316
Ref: library/pdb cmdoption-pdb-command15881316
Ref: 47c815881316
Ref: library/pdb cmdoption-pdb-m15881544
Ref: 47ca15881544
Ref: library/pdb cmdoption-pdb-p15881829
Ref: 27015881829
Ref: library/pdb cmdoption-pdb-pid15881829
Ref: 47cb15881829
Ref: library/pdb pdb run15883317
Ref: 45bc15883317
Ref: library/pdb pdb runeval15884241
Ref: 47ce15884241
Ref: library/pdb pdb runcall15884636
Ref: 47cf15884636
Ref: library/pdb pdb set_trace15885053
Ref: 27215885053
Ref: library/pdb pdb set_trace_async15885812
Ref: 27915885812
Ref: library/pdb pdb post_mortem15886226
Ref: 15f315886226
Ref: library/pdb pdb pm15886609
Ref: 53f15886609
Ref: library/pdb pdb set_default_backend15886725
Ref: 47d015886725
Ref: library/pdb pdb get_default_backend15887290
Ref: 47d115887290
Ref: library/pdb pdb Pdb15887709
Ref: 27315887709
Ref: library/pdb pdb Pdb run15890844
Ref: 47d215890844
Ref: library/pdb pdb Pdb runeval15890910
Ref: 47d315890910
Ref: library/pdb pdb Pdb runcall15890981
Ref: 47d415890981
Ref: library/pdb pdb Pdb set_trace15891038
Ref: 27415891038
Ref: コマンドライン・インターフェース<8>-Footnote-115891198
Ref: コマンドライン・インターフェース<8>-Footnote-215891240
Node: Debugger commands15891382
Ref: library/pdb debugger-commands15891523
Ref: 47c915891523
Ref: library/pdb id215891523
Ref: 47d515891523
Ref: library/pdb pdbcommand-help15895657
Ref: 47d815895657
Ref: library/pdb pdbcommand-where15896191
Ref: 47d915896191
Ref: library/pdb pdbcommand-down15896657
Ref: 47da15896657
Ref: library/pdb pdbcommand-up15896845
Ref: 47db15896845
Ref: library/pdb pdbcommand-break15897028
Ref: 47dc15897028
Ref: library/pdb pdbcommand-tbreak15898306
Ref: 47dd15898306
Ref: library/pdb pdbcommand-clear15898551
Ref: 47de15898551
Ref: library/pdb pdbcommand-disable15899029
Ref: 47df15899029
Ref: library/pdb pdbcommand-enable15899451
Ref: 47e015899451
Ref: library/pdb pdbcommand-ignore15899566
Ref: 47e115899566
Ref: library/pdb pdbcommand-condition15900129
Ref: 47e215900129
Ref: library/pdb pdbcommand-commands15900556
Ref: 27615900556
Ref: library/pdb pdbcommand-step15902488
Ref: 47cc15902488
Ref: library/pdb pdbcommand-next15902697
Ref: 47cd15902697
Ref: library/pdb pdbcommand-until15903135
Ref: 47e415903135
Ref: library/pdb pdbcommand-return15903561
Ref: 47e315903561
Ref: library/pdb pdbcommand-continue15903651
Ref: 47c515903651
Ref: library/pdb pdbcommand-jump15903760
Ref: 47e515903760
Ref: library/pdb pdbcommand-list15904221
Ref: 47d615904221
Ref: library/pdb pdbcommand-ll15905206
Ref: 47e715905206
Ref: library/pdb pdbcommand-args15905443
Ref: 47e815905443
Ref: library/pdb pdbcommand-p15905548
Ref: 117815905548
Ref: library/pdb pdbcommand-pp15905905
Ref: 47e915905905
Ref: library/pdb pdbcommand-whatis15906107
Ref: 47ea15906107
Ref: library/pdb pdbcommand-source15906189
Ref: 47eb15906189
Ref: library/pdb pdbcommand-display15906350
Ref: 27515906350
Ref: library/pdb pdbcommand-undisplay15907883
Ref: 47ec15907883
Ref: library/pdb pdbcommand-interact15908189
Ref: 47ed15908189
Ref: library/pdb debugger-aliases15909106
Ref: 47d715909106
Ref: library/pdb pdbcommand-alias15909106
Ref: 47ee15909106
Ref: library/pdb pdbcommand-unalias15910416
Ref: 47ef15910416
Ref: library/pdb pdbcommand-015910509
Ref: 47f015910509
Ref: library/pdb pdbcommand-run15910996
Ref: 47f115910996
Ref: library/pdb pdbcommand-restart15911027
Ref: 47f215911027
Ref: library/pdb pdbcommand-quit15911650
Ref: 47e615911650
Ref: library/pdb pdbcommand-debug15912277
Ref: 47f315912277
Ref: library/pdb pdbcommand-retval15912465
Ref: 47f415912465
Ref: library/pdb pdbcommand-exceptions15912563
Ref: 54015912563
Node: Python プロファイラ15913929
Ref: library/profile doc15914134
Ref: 47f515914134
Ref: library/profile profile15914134
Ref: 47f615914134
Ref: library/profile the-python-profilers15914134
Ref: 47f715914134
Ref: library/profile translation-repo15914134
Ref: 47f815914134
Ref: Python プロファイラ-Footnote-115914709
Ref: Python プロファイラ-Footnote-215914776
Node: プロファイラとは15914842
Ref: library/profile introduction-to-the-profilers15914973
Ref: 47f915914973
Ref: library/profile profiler-introduction15914973
Ref: 47fa15914973
Node: かんたんユーザマニュアル15917351
Ref: library/profile instant-user-s-manual15917528
Ref: 47fb15917528
Ref: library/profile profile-instant15917528
Ref: 47fc15917528
Ref: library/profile profile-cli15920793
Ref: 47fe15920793
Ref: library/profile cmdoption-cProfile-o15921067
Ref: 47ff15921067
Ref: library/profile cmdoption-cProfile-s15921162
Ref: 480015921162
Ref: library/profile cmdoption-cProfile-m15921346
Ref: 480215921346
Node: profile and cProfile Module Reference15924806
Ref: library/profile module-cProfile15924974
Ref: 2b15924974
Ref: library/profile profile-and-cprofile-module-reference15924974
Ref: 480515924974
Ref: library/profile module-profile15925085
Ref: b415925085
Ref: library/profile profile run15925174
Ref: 480615925174
Ref: library/profile profile runctx15925974
Ref: 480715925974
Ref: library/profile profile Profile15926379
Ref: bd615926379
Ref: library/profile profile Profile enable15928162
Ref: 480815928162
Ref: library/profile profile Profile disable15928265
Ref: 480915928265
Ref: library/profile profile Profile create_stats15928368
Ref: 480a15928368
Ref: library/profile profile Profile print_stats15928560
Ref: 480b15928560
Ref: library/profile profile Profile dump_stats15929096
Ref: 480c15929096
Ref: library/profile profile Profile run15929229
Ref: 480d15929229
Ref: library/profile profile Profile runctx15929344
Ref: 480e15929344
Ref: library/profile profile Profile runcall15929553
Ref: c7015929553
Node: Stats クラス15929929
Ref: library/profile profile-stats15930103
Ref: 480f15930103
Ref: library/profile the-stats-class15930103
Ref: 481015930103
Ref: library/profile module-pstats15930252
Ref: b515930252
Ref: library/profile pstats Stats15930252
Ref: 47fd15930252
Ref: library/profile pstats Stats strip_dirs15931936
Ref: 480315931936
Ref: library/profile pstats Stats add15932838
Ref: 481115932838
Ref: library/profile pstats Stats dump_stats15933417
Ref: 481215933417
Ref: library/profile pstats Stats sort_stats15933917
Ref: 480115933917
Ref: library/profile pstats Stats reverse_order15939682
Ref: 481315939682
Ref: library/profile pstats Stats print_stats15940013
Ref: 480415940013
Ref: library/profile pstats Stats print_callers15941614
Ref: 481415941614
Ref: library/profile pstats Stats print_callees15942957
Ref: 481515942957
Ref: library/profile pstats Stats get_stats_profile15943344
Ref: 481615943344
Node: 決定論的プロファイリングとは15943895
Ref: library/profile deterministic-profiling15944047
Ref: 481715944047
Ref: library/profile what-is-deterministic-profiling15944047
Ref: 481815944047
Node: 制限事項<2>15946537
Ref: library/profile limitations15946708
Ref: 481915946708
Ref: library/profile profile-limitations15946708
Ref: 481a15946708
Node: キャリブレーション 補正15949014
Ref: library/profile calibration15949188
Ref: 481b15949188
Ref: library/profile profile-calibration15949188
Ref: 481c15949188
Node: カスタムな時刻取得用関数を使う15951375
Ref: library/profile profile-timers15951525
Ref: 481d15951525
Ref: library/profile using-a-custom-timer15951525
Ref: 481e15951525
Node: timeit --- 小さなコードスニペットの実行時間計測15954405
Ref: library/timeit doc15954633
Ref: 481f15954633
Ref: library/timeit module-timeit15954633
Ref: f515954633
Ref: library/timeit timeit-measure-execution-time-of-small-code-snippets15954633
Ref: 482015954633
Ref: library/timeit translation-repo15954633
Ref: 482115954633
Ref: timeit --- 小さなコードスニペットの実行時間計測-Footnote-115955597
Node: 基本的な例<3>15955663
Ref: library/timeit basic-examples15955823
Ref: 482415955823
Node: Python インターフェイス15957272
Ref: library/timeit id115957489
Ref: 482615957489
Ref: library/timeit python-interface15957489
Ref: 482315957489
Ref: library/timeit timeit timeit15957663
Ref: 107e15957663
Ref: library/timeit timeit repeat15958177
Ref: 482715958177
Ref: library/timeit timeit default_timer15958849
Ref: 482915958849
Ref: library/timeit timeit Timer15959233
Ref: 16e115959233
Ref: library/timeit timeit Timer timeit15961048
Ref: ee915961048
Ref: library/timeit timeit Timer autorange15962393
Ref: ee815962393
Ref: library/timeit timeit Timer repeat15963203
Ref: 482815963203
Ref: library/timeit timeit Timer print_exc15964638
Ref: 482a15964638
Node: コマンドラインインターフェイス<3>15965356
Ref: library/timeit command-line-interface15965568
Ref: 482b15965568
Ref: library/timeit timeit-command-line-interface15965568
Ref: 482215965568
Ref: library/timeit cmdoption-timeit-n15965899
Ref: 482c15965899
Ref: library/timeit cmdoption-timeit-number15965899
Ref: 482d15965899
Ref: library/timeit cmdoption-timeit-r15965969
Ref: 482e15965969
Ref: library/timeit cmdoption-timeit-repeat15965969
Ref: 482f15965969
Ref: library/timeit cmdoption-timeit-s15966058
Ref: 483015966058
Ref: library/timeit cmdoption-timeit-setup15966058
Ref: 483115966058
Ref: library/timeit cmdoption-timeit-p15966160
Ref: 483215966160
Ref: library/timeit cmdoption-timeit-process15966160
Ref: 483315966160
Ref: library/timeit cmdoption-timeit-u15966404
Ref: 483415966404
Ref: library/timeit cmdoption-timeit-unit15966404
Ref: 483515966404
Ref: library/timeit cmdoption-timeit-v15966595
Ref: 483615966595
Ref: library/timeit cmdoption-timeit-verbose15966595
Ref: 483715966595
Ref: library/timeit cmdoption-timeit-h15966707
Ref: 483815966707
Ref: library/timeit cmdoption-timeit-help15966707
Ref: 483915966707
Node: 使用例<44>15968370
Ref: library/timeit examples15968542
Ref: 483a15968542
Ref: library/timeit timeit-examples15968542
Ref: 482515968542
Node: trace --- Python 文実行のトレースと追跡15972356
Ref: library/trace doc15972605
Ref: 483b15972605
Ref: library/trace module-trace15972605
Ref: 10315972605
Ref: library/trace trace-trace-or-track-python-statement-execution15972605
Ref: 483c15972605
Ref: library/trace translation-repo15972605
Ref: 483d15972605
Ref: trace --- Python 文実行のトレースと追跡-Footnote-115973461
Ref: trace --- Python 文実行のトレースと追跡-Footnote-215973526
Node: コマンドラインからの使用<2>15973567
Ref: library/trace command-line-usage15973747
Ref: 483e15973747
Ref: library/trace trace-cli15973747
Ref: 483f15973747
Ref: library/trace cmdoption-trace-help15974135
Ref: 484015974135
Ref: library/trace cmdoption-trace-version15974204
Ref: 484115974204
Node: 主要なオプション15974496
Ref: library/trace main-options15974629
Ref: 484215974629
Ref: library/trace cmdoption-trace-c15975019
Ref: 484515975019
Ref: library/trace cmdoption-trace-count15975019
Ref: 484615975019
Ref: library/trace cmdoption-trace-t15975309
Ref: 484415975309
Ref: library/trace cmdoption-trace-trace15975309
Ref: 484a15975309
Ref: library/trace cmdoption-trace-l15975389
Ref: 484315975389
Ref: library/trace cmdoption-trace-listfuncs15975389
Ref: 484b15975389
Ref: library/trace cmdoption-trace-r15975497
Ref: 484c15975497
Ref: library/trace cmdoption-trace-report15975497
Ref: 484d15975497
Ref: library/trace cmdoption-trace-T15975759
Ref: 484e15975759
Ref: library/trace cmdoption-trace-trackcalls15975759
Ref: 484f15975759
Node: 修飾的オプション15975892
Ref: library/trace modifiers15976064
Ref: 485015976064
Ref: library/trace cmdoption-trace-f15976125
Ref: 484815976125
Ref: library/trace cmdoption-trace-file15976125
Ref: 485115976125
Ref: library/trace cmdoption-trace-C15976370
Ref: 484715976370
Ref: library/trace cmdoption-trace-coverdir15976370
Ref: 485215976370
Ref: library/trace cmdoption-trace-m15976631
Ref: 485315976631
Ref: library/trace cmdoption-trace-missing15976631
Ref: 485415976631
Ref: library/trace cmdoption-trace-s15976778
Ref: 485515976778
Ref: library/trace cmdoption-trace-summary15976778
Ref: 485615976778
Ref: library/trace cmdoption-trace-R15976999
Ref: 484915976999
Ref: library/trace cmdoption-trace-no-report15976999
Ref: 485715976999
Ref: library/trace cmdoption-trace-g15977239
Ref: 485815977239
Ref: library/trace cmdoption-trace-timing15977239
Ref: 485915977239
Node: フィルターオプション15977392
Ref: library/trace filters15977531
Ref: 485a15977531
Ref: library/trace cmdoption-trace-ignore-module15977664
Ref: 485b15977664
Ref: library/trace cmdoption-trace-ignore-dir15977898
Ref: 485c15977898
Node: プログラミングインターフェース15978166
Ref: library/trace programmatic-interface15978346
Ref: 485d15978346
Ref: library/trace trace-api15978346
Ref: 485e15978346
Ref: library/trace trace Trace15978442
Ref: 485f15978442
Ref: library/trace trace Trace run15979507
Ref: 486015979507
Ref: library/trace trace Trace runctx15979803
Ref: 486115979803
Ref: library/trace trace Trace runfunc15980189
Ref: c7215980189
Ref: library/trace trace Trace results15980438
Ref: 486215980438
Ref: library/trace trace CoverageResults15980807
Ref: 486315980807
Ref: library/trace trace CoverageResults update15981026
Ref: 486415981026
Ref: library/trace trace CoverageResults write_results15981175
Ref: 486515981175
Node: tracemalloc --- メモリ割り当ての追跡15982810
Ref: library/tracemalloc doc15982985
Ref: 486615982985
Ref: library/tracemalloc module-tracemalloc15982985
Ref: 10515982985
Ref: library/tracemalloc tracemalloc-trace-memory-allocations15982985
Ref: 486715982985
Ref: library/tracemalloc translation-repo15982985
Ref: 486815982985
Ref: tracemalloc --- メモリ割り当ての追跡-Footnote-115984742
Node: 使用例<45>15984813
Ref: library/tracemalloc examples15984921
Ref: 486915984921
Node: 上位10を表示する15985110
Ref: library/tracemalloc display-the-top-1015985210
Ref: 486a15985210
Node: 差を計算する15986876
Ref: library/tracemalloc compute-differences15987045
Ref: 486c15987045
Node: メモリブロックのトレースバックを取得する15989575
Ref: library/tracemalloc get-the-traceback-of-a-memory-block15989743
Ref: 486f15989743
Node: top を整形化する15992474
Ref: library/tracemalloc pretty-top15992615
Ref: 487015992615
Node: Record the current and peak size of all traced memory blocks15995174
Ref: library/tracemalloc record-the-current-and-peak-size-of-all-traced-memory-blocks15995293
Ref: 487115995293
Node: API15996985
Ref: library/tracemalloc api15997093
Ref: 487315997093
Node: 関数<11>15997259
Ref: library/tracemalloc functions15997330
Ref: 487415997330
Ref: library/tracemalloc tracemalloc clear_traces15997361
Ref: 487515997361
Ref: library/tracemalloc tracemalloc get_object_traceback15997551
Ref: 1f3915997551
Ref: library/tracemalloc tracemalloc get_traceback_limit15997971
Ref: 487615997971
Ref: library/tracemalloc tracemalloc get_traced_memory15998331
Ref: 487215998331
Ref: library/tracemalloc tracemalloc reset_peak15998527
Ref: b3515998527
Ref: library/tracemalloc tracemalloc get_tracemalloc_memory15999172
Ref: 487815999172
Ref: library/tracemalloc tracemalloc is_tracing15999365
Ref: 487915999365
Ref: library/tracemalloc tracemalloc start15999625
Ref: 212c15999625
Ref: library/tracemalloc tracemalloc stop16001245
Ref: 18ad16001245
Ref: library/tracemalloc tracemalloc take_snapshot16001881
Ref: 487716001881
Node: DomainFilter16002724
Ref: library/tracemalloc domainfilter16002810
Ref: 487d16002810
Ref: library/tracemalloc tracemalloc DomainFilter16002855
Ref: eed16002855
Ref: library/tracemalloc tracemalloc DomainFilter inclusive16003025
Ref: 487e16003025
Ref: library/tracemalloc tracemalloc DomainFilter domain16003325
Ref: 487f16003325
Node: Filter16003430
Ref: library/tracemalloc filter16003511
Ref: 488016003511
Ref: library/tracemalloc tracemalloc Filter16003546
Ref: 488116003546
Ref: library/tracemalloc tracemalloc Filter domain16004559
Ref: 488216004559
Ref: library/tracemalloc tracemalloc Filter inclusive16004830
Ref: 488316004830
Ref: library/tracemalloc tracemalloc Filter lineno16005262
Ref: 488516005262
Ref: library/tracemalloc tracemalloc Filter filename_pattern16005451
Ref: 488416005451
Ref: library/tracemalloc tracemalloc Filter all_frames16005623
Ref: 488616005623
Node: Frame16006129
Ref: library/tracemalloc frame16006206
Ref: 488816006206
Ref: library/tracemalloc tracemalloc Frame16006239
Ref: 488916006239
Ref: library/tracemalloc tracemalloc Frame filename16006440
Ref: 488a16006440
Ref: library/tracemalloc tracemalloc Frame lineno16006512
Ref: 488b16006512
Node: Snapshot16006576
Ref: library/tracemalloc snapshot16006656
Ref: 488c16006656
Ref: library/tracemalloc tracemalloc Snapshot16006695
Ref: 487c16006695
Ref: library/tracemalloc tracemalloc Snapshot compare_to16006950
Ref: 487b16006950
Ref: library/tracemalloc tracemalloc Snapshot dump16007795
Ref: 486d16007795
Ref: library/tracemalloc tracemalloc Snapshot filter_traces16008026
Ref: 489316008026
Ref: library/tracemalloc tracemalloc Snapshot load16008716
Ref: 486e16008716
Ref: library/tracemalloc tracemalloc Snapshot statistics16008908
Ref: 486b16008908
Ref: library/tracemalloc tracemalloc Snapshot traceback_limit16010167
Ref: 488716010167
Ref: library/tracemalloc tracemalloc Snapshot traces16010441
Ref: 489416010441
Node: Statistic16010820
Ref: library/tracemalloc statistic16010908
Ref: 489916010908
Ref: library/tracemalloc tracemalloc Statistic16010949
Ref: 489516010949
Ref: library/tracemalloc tracemalloc Statistic count16011226
Ref: 489116011226
Ref: library/tracemalloc tracemalloc Statistic size16011304
Ref: 489616011304
Ref: library/tracemalloc tracemalloc Statistic traceback16011411
Ref: 489716011411
Node: StatisticDiff16011582
Ref: library/tracemalloc statisticdiff16011667
Ref: 489a16011667
Ref: library/tracemalloc tracemalloc StatisticDiff16011716
Ref: 488d16011716
Ref: library/tracemalloc tracemalloc StatisticDiff count16012059
Ref: 489b16012059
Ref: library/tracemalloc tracemalloc StatisticDiff count_diff16012313
Ref: 489016012313
Ref: library/tracemalloc tracemalloc StatisticDiff size16012574
Ref: 488f16012574
Ref: library/tracemalloc tracemalloc StatisticDiff size_diff16012857
Ref: 488e16012857
Ref: library/tracemalloc tracemalloc StatisticDiff traceback16013127
Ref: 489216013127
Node: Trace16013305
Ref: library/tracemalloc trace16013390
Ref: 489c16013390
Ref: library/tracemalloc tracemalloc Trace16013423
Ref: 489816013423
Ref: library/tracemalloc tracemalloc Trace domain16013722
Ref: 489d16013722
Ref: library/tracemalloc tracemalloc Trace size16014000
Ref: 489e16014000
Ref: library/tracemalloc tracemalloc Trace traceback16014104
Ref: 489f16014104
Node: Traceback16014275
Ref: library/tracemalloc traceback16014338
Ref: 48a016014338
Ref: library/tracemalloc tracemalloc Traceback16014379
Ref: d8f16014379
Ref: library/tracemalloc tracemalloc Traceback total_nframe16015308
Ref: 487a16015308
Ref: library/tracemalloc tracemalloc Traceback format16015634
Ref: d9016015634
Node: ソフトウェア・パッケージと配布16016734
Ref: library/distribution doc16016929
Ref: 48a216016929
Ref: library/distribution software-packaging-and-distribution16016929
Ref: 48a316016929
Ref: library/distribution translation-repo16016929
Ref: 48a416016929
Ref: ソフトウェア・パッケージと配布-Footnote-116017768
Node: ensurepip --- pip インストーラーのブートストラップ16017793
Ref: library/ensurepip doc16017980
Ref: 48a516017980
Ref: library/ensurepip ensurepip-bootstrapping-the-pip-installer16017980
Ref: 48a616017980
Ref: library/ensurepip module-ensurepip16017980
Ref: 5916017980
Ref: ensurepip --- pip インストーラーのブートストラップ-Footnote-116020356
Ref: ensurepip --- pip インストーラーのブートストラップ-Footnote-216020422
Node: コマンドライン・インターフェース<9>16020464
Ref: library/ensurepip command-line-interface16020646
Ref: 48a716020646
Ref: library/ensurepip ensurepip-cli16020646
Ref: 48a816020646
Ref: library/ensurepip cmdoption-ensurepip-root16021664
Ref: 48a916021664
Ref: library/ensurepip cmdoption-ensurepip-user16021893
Ref: 48aa16021893
Ref: library/ensurepip cmdoption-ensurepip-altinstall16022381
Ref: 48ab16022381
Ref: library/ensurepip cmdoption-ensurepip-default-pip16022508
Ref: 48ac16022508
Node: モジュール API16022761
Ref: library/ensurepip module-api16022943
Ref: 48ad16022943
Ref: library/ensurepip ensurepip version16023058
Ref: 48ae16023058
Ref: library/ensurepip ensurepip bootstrap16023269
Ref: 475b16023269
Node: venv --- 仮想環境の作成16025675
Ref: library/venv doc16025939
Ref: 48af16025939
Ref: library/venv module-venv16025939
Ref: 11716025939
Ref: library/venv translation-repo16025939
Ref: 48b016025939
Ref: library/venv venv-creation-of-virtual-environments16025939
Ref: 48b116025939
Ref: library/venv venv-def16026142
Ref: 3e816026142
Ref: library/venv venv-intro16026142
Ref: 48b216026142
Ref: venv --- 仮想環境の作成-Footnote-116028435
Ref: venv --- 仮想環境の作成-Footnote-216028497
Ref: venv --- 仮想環境の作成-Footnote-316028535
Ref: venv --- 仮想環境の作成-Footnote-416028577
Node: 仮想環境の作成<2>16028705
Ref: library/venv creating-virtual-environments16028829
Ref: 48b516028829
Ref: library/venv venv-cli16030645
Ref: 48b616030645
Ref: library/venv cmdoption-venv-arg-ENV_DIR16030645
Ref: 48b716030645
Ref: library/venv cmdoption-venv-system-site-packages16030752
Ref: 48b816030752
Ref: library/venv cmdoption-venv-symlinks16030874
Ref: 48b916030874
Ref: library/venv cmdoption-venv-copies16031001
Ref: 48ba16031001
Ref: library/venv cmdoption-venv-clear16031127
Ref: 48bb16031127
Ref: library/venv cmdoption-venv-upgrade16031259
Ref: 48bc16031259
Ref: library/venv cmdoption-venv-without-pip16031402
Ref: 48bd16031402
Ref: library/venv cmdoption-venv-prompt16031535
Ref: 48be16031535
Ref: library/venv cmdoption-venv-upgrade-deps16031632
Ref: 48bf16031632
Ref: library/venv cmdoption-venv-without-scm-ignore-files16031729
Ref: 48c016031729
Ref: 仮想環境の作成<2>-Footnote-116034248
Node: 仮想環境のしくみ16034303
Ref: library/venv how-venvs-work16034442
Ref: 48c116034442
Ref: library/venv venv-explanation16034442
Ref: 67e16034442
Node: API<2>16039795
Ref: library/venv api16039939
Ref: 48c216039939
Ref: library/venv venv-api16039939
Ref: 10f516039939
Ref: library/venv venv EnvBuilder16040236
Ref: 57116040236
Ref: library/venv venv EnvBuilder create16042870
Ref: 48c416042870
Ref: library/venv venv EnvBuilder ensure_directories16044263
Ref: 48c516044263
Ref: library/venv venv EnvBuilder create_configuration16047555
Ref: 48c616047555
Ref: library/venv venv EnvBuilder setup_python16047694
Ref: 48c716047694
Ref: library/venv venv EnvBuilder setup_scripts16048208
Ref: 48c816048208
Ref: library/venv venv EnvBuilder upgrade_dependencies16048390
Ref: 48cb16048390
Ref: library/venv venv EnvBuilder post_setup16048835
Ref: 48c916048835
Ref: library/venv venv EnvBuilder install_scripts16049181
Ref: 48ca16049181
Ref: library/venv venv EnvBuilder create_git_ignore_file16050739
Ref: 48c316050739
Ref: library/venv venv create16051840
Ref: 57216051840
Ref: API<2>-Footnote-116052636
Node: EnvBuilder を拡張する例16052681
Ref: library/venv an-example-of-extending-envbuilder16052792
Ref: 48cc16052792
Ref: EnvBuilder を拡張する例-Footnote-116063000
Node: zipapp --- 実行可能な Python zip アーカイブを管理する16063047
Ref: library/zipapp doc16063236
Ref: 48cd16063236
Ref: library/zipapp module-zipapp16063236
Ref: 13616063236
Ref: library/zipapp translation-repo16063236
Ref: 48ce16063236
Ref: library/zipapp zipapp-manage-executable-python-zip-archives16063236
Ref: 48cf16063236
Ref: zipapp --- 実行可能な Python zip アーカイブを管理する-Footnote-116064237
Node: 基本的な例<4>16064303
Ref: library/zipapp basic-example16064483
Ref: 48d216064483
Node: コマンドラインインターフェイス<4>16064995
Ref: library/zipapp command-line-interface16065194
Ref: 48d316065194
Ref: library/zipapp zipapp-command-line-interface16065194
Ref: 48d016065194
Ref: library/zipapp cmdoption-zipapp-o16065886
Ref: 48d416065886
Ref: library/zipapp cmdoption-zipapp-output16065886
Ref: 48d516065886
Ref: library/zipapp cmdoption-zipapp-p16066639
Ref: 48d616066639
Ref: library/zipapp cmdoption-zipapp-python16066639
Ref: 48d716066639
Ref: library/zipapp cmdoption-zipapp-m16066970
Ref: 48d816066970
Ref: library/zipapp cmdoption-zipapp-main16066970
Ref: 48d916066970
Ref: library/zipapp cmdoption-zipapp-c16067561
Ref: 48da16067561
Ref: library/zipapp cmdoption-zipapp-compress16067561
Ref: 48db16067561
Ref: library/zipapp cmdoption-zipapp-info16067861
Ref: 48dc16067861
Ref: library/zipapp cmdoption-zipapp-h16068133
Ref: 48dd16068133
Ref: library/zipapp cmdoption-zipapp-help16068133
Ref: 48de16068133
Node: Python API16068215
Ref: library/zipapp python-api16068409
Ref: 48df16068409
Ref: library/zipapp zipapp-python-api16068409
Ref: 48d116068409
Ref: library/zipapp zipapp create_archive16068522
Ref: da916068522
Ref: library/zipapp zipapp get_interpreter16073120
Ref: 48e016073120
Node: 使用例<46>16073570
Ref: library/zipapp examples16073746
Ref: 48e116073746
Ref: library/zipapp zipapp-examples16073746
Ref: 48e216073746
Node: インタープリタの指定16075407
Ref: library/zipapp specifying-the-interpreter16075617
Ref: 48e316075617
Ref: library/zipapp zipapp-specifying-the-interpreter16075617
Ref: 48e416075617
Node: Creating Standalone Applications with zipapp16076822
Ref: library/zipapp creating-standalone-applications-with-zipapp16077060
Ref: 48e516077060
Node: Caveats16078761
Ref: library/zipapp caveats16078849
Ref: 48e616078849
Node: The Python Zip Application Archive Format16079586
Ref: library/zipapp the-python-zip-application-archive-format16079785
Ref: 48e716079785
Node: Python ランタイムサービス16081676
Ref: library/python doc16081876
Ref: 48e816081876
Ref: library/python python16081876
Ref: 48e916081876
Ref: library/python python-runtime-services16081876
Ref: 48ea16081876
Ref: library/python translation-repo16081876
Ref: 48eb16081876
Node: sys --- システム固有のパラメーターと関数16083692
Ref: library/sys doc16083883
Ref: 48ec16083883
Ref: library/sys module-sys16083883
Ref: df16083883
Ref: library/sys sys-system-specific-parameters-and-functions16083883
Ref: 48ed16083883
Ref: library/sys sys abiflags16084307
Ref: c5916084307
Ref: library/sys sys addaudithook16084748
Ref: 475016084748
Ref: library/sys sys argv16087000
Ref: 147c16087000
Ref: library/sys auditing16088193
Ref: 1c6e16088193
Ref: library/sys sys audit16088193
Ref: 191b16088193
Ref: library/sys sys base_exec_prefix16089594
Ref: 3ea16089594
Ref: library/sys sys base_prefix16090086
Ref: 3e616090086
Ref: library/sys sys byteorder16090556
Ref: 25f716090556
Ref: library/sys sys builtin_module_names16090865
Ref: 204716090865
Ref: library/sys sys call_tracing16091298
Ref: 1bc316091298
Ref: library/sys sys copyright16091821
Ref: 48ee16091821
Ref: library/sys sys _clear_type_cache16091928
Ref: 29216091928
Ref: library/sys sys _clear_internal_caches16092493
Ref: 36416092493
Ref: library/sys sys _current_frames16092733
Ref: 164c16092733
Ref: library/sys sys _current_exceptions16093914
Ref: 6e916093914
Ref: library/sys sys breakpointhook16094655
Ref: cd116094655
Ref: library/sys sys _debugmallocstats16097306
Ref: 48ef16097306
Ref: library/sys sys dllhandle16097826
Ref: 48f016097826
Ref: library/sys sys displayhook16097954
Ref: 173816097954
Ref: library/sys sys dont_write_bytecode16099646
Ref: 48f116099646
Ref: library/sys sys _emscripten_info16100160
Ref: 1b8e16100160
Ref: library/sys sys _emscripten_info emscripten_version16100380
Ref: 48f216100380
Ref: library/sys sys _emscripten_info runtime16100540
Ref: 48f316100540
Ref: library/sys sys _emscripten_info pthreads16100695
Ref: 48f416100695
Ref: library/sys sys _emscripten_info shared_memory16100820
Ref: 48f516100820
Ref: library/sys sys pycache_prefix16101018
Ref: b9c16101018
Ref: library/sys sys excepthook16101996
Ref: a0c16101996
Ref: library/sys sys __breakpointhook__16103358
Ref: 48f616103358
Ref: library/sys sys __displayhook__16103396
Ref: 48f716103396
Ref: library/sys sys __excepthook__16103431
Ref: 48f816103431
Ref: library/sys sys __unraisablehook__16103465
Ref: 48f916103465
Ref: library/sys sys exception16104051
Ref: 89b16104051
Ref: library/sys sys exc_info16104522
Ref: 89a16104522
Ref: library/sys sys exec_prefix16105536
Ref: 3eb16105536
Ref: library/sys sys executable16107006
Ref: 3ed16107006
Ref: library/sys sys exit16107394
Ref: 27716107394
Ref: library/sys sys flags16109134
Ref: 89c16109134
Ref: library/sys sys flags debug16109378
Ref: 48fa16109378
Ref: library/sys sys flags inspect16109581
Ref: 179016109581
Ref: library/sys sys flags interactive16109786
Ref: 48fb16109786
Ref: library/sys sys flags isolated16109984
Ref: 48fc16109984
Ref: library/sys sys flags optimize16110184
Ref: 48fd16110184
Ref: library/sys sys flags dont_write_bytecode16110421
Ref: 48fe16110421
Ref: library/sys sys flags no_user_site16110615
Ref: 48ff16110615
Ref: library/sys sys flags no_site16110811
Ref: 490016110811
Ref: library/sys sys flags ignore_environment16111023
Ref: 490116111023
Ref: library/sys sys flags verbose16111212
Ref: 490216111212
Ref: library/sys sys flags bytes_warning16111419
Ref: 490316111419
Ref: library/sys sys flags quiet16111611
Ref: 490416111611
Ref: library/sys sys flags hash_randomization16111825
Ref: 490516111825
Ref: library/sys sys flags dev_mode16112016
Ref: 1e8216112016
Ref: library/sys sys flags utf8_mode16112319
Ref: 490616112319
Ref: library/sys sys flags safe_path16112524
Ref: 53e16112524
Ref: library/sys sys flags int_max_str_digits16112733
Ref: 26db16112733
Ref: library/sys sys flags warn_default_encoding16113073
Ref: 490716113073
Ref: library/sys sys flags gil16113277
Ref: 490816113277
Ref: library/sys sys flags thread_inherit_context16113527
Ref: 17516113527
Ref: library/sys sys flags context_aware_warnings16113857
Ref: 18a16113857
Ref: library/sys sys float_info16115365
Ref: 1dcf16115365
Ref: library/sys sys float_info epsilon16116353
Ref: 490a16116353
Ref: library/sys sys float_info dig16117156
Ref: 490b16117156
Ref: library/sys sys float_info mant_dig16117670
Ref: 490c16117670
Ref: library/sys sys float_info max16118165
Ref: 490d16118165
Ref: library/sys sys float_info max_exp16118551
Ref: 490e16118551
Ref: library/sys sys float_info max_10_exp16119054
Ref: 490f16119054
Ref: library/sys sys float_info min16119555
Ref: 491016119555
Ref: library/sys sys float_info min_exp16120367
Ref: 491116120367
Ref: library/sys sys float_info min_10_exp16120860
Ref: 491216120860
Ref: library/sys sys float_info radix16121257
Ref: 491316121257
Ref: library/sys sys float_info rounds16121629
Ref: 491416121629
Ref: library/sys sys float_repr_style16124561
Ref: 151216124561
Ref: library/sys sys getallocatedblocks16125209
Ref: 11c916125209
Ref: library/sys sys getunicodeinternedsize16125852
Ref: 491516125852
Ref: library/sys sys getandroidapilevel16125995
Ref: d8316125995
Ref: library/sys sys getdefaultencoding16126341
Ref: 491616126341
Ref: library/sys sys getdlopenflags16126512
Ref: 172716126512
Ref: library/sys sys getfilesystemencoding16126826
Ref: e5316126826
Ref: library/sys sys getfilesystemencodeerrors16128636
Ref: ee216128636
Ref: library/sys sys get_int_max_str_digits16129567
Ref: 181816129567
Ref: library/sys sys getrefcount16129796
Ref: 2ce16129796
Ref: library/sys sys getrecursionlimit16130798
Ref: 6eb16130798
Ref: library/sys sys getsizeof16131265
Ref: 1adb16131265
Ref: library/sys sys getswitchinterval16132379
Ref: b4316132379
Ref: library/sys sys _getframe16132557
Ref: 8f016132557
Ref: library/sys sys _getframemodulename16133385
Ref: 1adf16133385
Ref: library/sys sys getobjects16134128
Ref: 28e16134128
Ref: library/sys sys getprofile16135253
Ref: 15f916135253
Ref: library/sys sys gettrace16135392
Ref: 15fa16135392
Ref: library/sys sys getwindowsversion16135882
Ref: ee316135882
Ref: library/sys sys get_asyncgen_hooks16138809
Ref: 1bc416138809
Ref: library/sys sys get_coroutine_origin_tracking_depth16139562
Ref: d8416139562
Ref: library/sys sys hash_info16139917
Ref: 120116139917
Ref: library/sys sys hash_info width16140179
Ref: 491916140179
Ref: library/sys sys hash_info modulus16140266
Ref: 25ff16140266
Ref: library/sys sys hash_info inf16140365
Ref: 491a16140365
Ref: library/sys sys hash_info nan16140459
Ref: 491b16140459
Ref: library/sys sys hash_info imag16140540
Ref: 491c16140540
Ref: library/sys sys hash_info algorithm16140650
Ref: 491d16140650
Ref: library/sys sys hash_info hash_bits16140780
Ref: 491e16140780
Ref: library/sys sys hash_info seed_bits16140879
Ref: 491f16140879
Ref: library/sys sys hash_info cutoff16140978
Ref: 492016140978
Ref: library/sys sys hexversion16141239
Ref: 492116141239
Ref: library/sys sys implementation16142248
Ref: 73b16142248
Ref: library/sys sys int_info16145315
Ref: 14ab16145315
Ref: library/sys sys int_info bits_per_digit16145507
Ref: 492316145507
Ref: library/sys sys int_info sizeof_digit16145693
Ref: 492416145693
Ref: library/sys sys int_info default_max_str_digits16145806
Ref: 26dc16145806
Ref: library/sys sys int_info str_digits_check_threshold16145992
Ref: 492516145992
Ref: library/sys sys __interactivehook__16146392
Ref: 11ca16146392
Ref: library/sys sys intern16147037
Ref: 14f316147037
Ref: library/sys sys _is_gil_enabled16148030
Ref: 492616148030
Ref: library/sys sys is_finalizing16148310
Ref: c8016148310
Ref: library/sys sys _jit16148573
Ref: 29316148573
Ref: library/sys sys _jit is_available16148934
Ref: 44f16148934
Ref: library/sys sys _jit is_enabled16149304
Ref: 45016149304
Ref: library/sys sys _jit is_active16149741
Ref: 186116149741
Ref: library/sys sys last_exc16151071
Ref: 6e516151071
Ref: library/sys sys _is_immortal16151649
Ref: 28f16151649
Ref: library/sys sys _is_interned16152220
Ref: 55916152220
Ref: library/sys sys last_type16152492
Ref: 6e616152492
Ref: library/sys sys last_value16152521
Ref: 6e716152521
Ref: library/sys sys last_traceback16152551
Ref: 6e816152551
Ref: library/sys sys maxsize16152785
Ref: 13dd16152785
Ref: library/sys sys maxunicode16153062
Ref: 125816153062
Ref: library/sys sys meta_path16153508
Ref: f2716153508
Ref: library/sys sys modules16154824
Ref: 17e616154824
Ref: library/sys sys orig_argv16155437
Ref: a4116155437
Ref: library/sys sys path16155916
Ref: 3e416155916
Ref: library/sys sys path_hooks16157351
Ref: 122516157351
Ref: library/sys sys path_importer_cache16157809
Ref: 7fa16157809
Ref: library/sys sys platform16158331
Ref: 29116158331
Ref: library/sys sys platlibdir16161016
Ref: b3216161016
Ref: library/sys sys prefix16162025
Ref: 3e716162025
Ref: library/sys sys ps116163166
Ref: 213516163166
Ref: library/sys sys ps216163189
Ref: 213616163189
Ref: library/sys sys setdlopenflags16163717
Ref: 133716163717
Ref: library/sys sys set_int_max_str_digits16164319
Ref: 18f116164319
Ref: library/sys sys setprofile16164557
Ref: 171716164557
Ref: library/sys sys setrecursionlimit16167260
Ref: 6ea16167260
Ref: library/sys sys setswitchinterval16168235
Ref: b4416168235
Ref: library/sys sys settrace16168991
Ref: 2e116168991
Ref: library/sys sys set_asyncgen_hooks16174060
Ref: 199d16174060
Ref: library/sys sys set_coroutine_origin_tracking_depth16175200
Ref: d8516175200
Ref: library/sys sys activate_stack_trampoline16176021
Ref: 69a16176021
Ref: library/sys sys deactivate_stack_trampoline16176456
Ref: 69b16176456
Ref: library/sys sys is_stack_trampoline_active16176710
Ref: 69c16176710
Ref: library/sys sys remote_exec16176895
Ref: 16d16176895
Ref: library/sys sys _enablelegacywindowsfsencoding16178568
Ref: 33e16178568
Ref: library/sys sys stdin16179560
Ref: 75f16179560
Ref: library/sys sys stdout16179585
Ref: ccd16179585
Ref: library/sys sys stderr16179611
Ref: b3316179611
Ref: library/sys sys __stdin__16183072
Ref: 492916183072
Ref: library/sys sys __stdout__16183101
Ref: 2cfb16183101
Ref: library/sys sys __stderr__16183131
Ref: 46d316183131
Ref: library/sys sys stdlib_module_names16184338
Ref: a4216184338
Ref: library/sys sys thread_info16185078
Ref: 136816185078
Ref: library/sys sys thread_info name16185214
Ref: 492a16185214
Ref: library/sys sys thread_info lock16185568
Ref: 492b16185568
Ref: library/sys sys thread_info version16185867
Ref: 492c16185867
Ref: library/sys sys tracebacklimit16186064
Ref: 194416186064
Ref: library/sys sys unraisablehook16186437
Ref: 50716186437
Ref: library/sys sys version16188255
Ref: 49c16188255
Ref: library/sys sys api_version16188705
Ref: 492d16188705
Ref: library/sys sys version_info16189004
Ref: 8af16189004
Ref: library/sys sys warnoptions16189695
Ref: 3f516189695
Ref: library/sys sys winver16189912
Ref: 492f16189912
Ref: library/sys sys _xoptions16190558
Ref: 213116190558
Ref: library/sys c9916191445
Ref: 490916191445
Ref: sys --- システム固有のパラメーターと関数-Footnote-116191671
Ref: sys --- システム固有のパラメーターと関数-Footnote-216191713
Ref: sys --- システム固有のパラメーターと関数-Footnote-316191755
Ref: sys --- システム固有のパラメーターと関数-Footnote-416191797
Ref: sys --- システム固有のパラメーターと関数-Footnote-516191902
Ref: sys --- システム固有のパラメーターと関数-Footnote-616191944
Ref: sys --- システム固有のパラメーターと関数-Footnote-716191986
Ref: sys --- システム固有のパラメーターと関数-Footnote-816192028
Ref: sys --- システム固有のパラメーターと関数-Footnote-916192070
Ref: sys --- システム固有のパラメーターと関数-Footnote-1016192112
Ref: sys --- システム固有のパラメーターと関数-Footnote-1116192155
Ref: sys --- システム固有のパラメーターと関数-Footnote-1216192198
Ref: sys --- システム固有のパラメーターと関数-Footnote-1316192241
Ref: sys --- システム固有のパラメーターと関数-Footnote-1416192284
Ref: sys --- システム固有のパラメーターと関数-Footnote-1516192327
Ref: sys --- システム固有のパラメーターと関数-Footnote-1616192370
Ref: sys --- システム固有のパラメーターと関数-Footnote-1716192413
Ref: sys --- システム固有のパラメーターと関数-Footnote-1816192494
Ref: sys --- システム固有のパラメーターと関数-Footnote-1916192537
Ref: sys --- システム固有のパラメーターと関数-Footnote-2016192580
Ref: sys --- システム固有のパラメーターと関数-Footnote-2116192623
Node: sys monitoring --- 実行イベントモニタリング16192666
Ref: library/sys monitoring doc16192935
Ref: 493016192935
Ref: library/sys monitoring module-sys monitoring16192935
Ref: e016192935
Ref: library/sys monitoring sys-monitoring-execution-event-monitoring16192935
Ref: 493116192935
Ref: library/sys monitoring translation-repo16192935
Ref: 493216192935
Node: Tool identifiers16193969
Ref: library/sys monitoring tool-identifiers16194092
Ref: 493316194092
Node: Registering and using tools16194649
Ref: library/sys monitoring registering-and-using-tools16194729
Ref: 493616194729
Ref: library/sys monitoring sys monitoring use_tool_id16194804
Ref: 493716194804
Ref: library/sys monitoring sys monitoring clear_tool_id16195062
Ref: 192e16195062
Ref: library/sys monitoring sys monitoring free_tool_id16195216
Ref: 493816195216
Ref: library/sys monitoring sys monitoring get_tool16195424
Ref: 493916195424
Node: Events16195928
Ref: library/sys monitoring events16196085
Ref: 493416196085
Ref: library/sys monitoring monitoring-event-BRANCH_LEFT16196155
Ref: 29516196155
Ref: library/sys monitoring monitoring-event-BRANCH_RIGHT16196484
Ref: 29616196484
Ref: library/sys monitoring monitoring-event-CALL16196581
Ref: 19bd16196581
Ref: library/sys monitoring monitoring-event-C_RAISE16196691
Ref: 493a16196691
Ref: library/sys monitoring monitoring-event-C_RETURN16196853
Ref: 493b16196853
Ref: library/sys monitoring monitoring-event-EXCEPTION_HANDLED16197005
Ref: 493c16197005
Ref: library/sys monitoring monitoring-event-INSTRUCTION16197099
Ref: 493d16197099
Ref: library/sys monitoring monitoring-event-JUMP16197204
Ref: 493e16197204
Ref: library/sys monitoring monitoring-event-LINE16197317
Ref: 493f16197317
Ref: library/sys monitoring monitoring-event-PY_RESUME16197482
Ref: 494016197482
Ref: library/sys monitoring monitoring-event-PY_RETURN16197653
Ref: 494116197653
Ref: library/sys monitoring monitoring-event-PY_START16197830
Ref: 494216197830
Ref: library/sys monitoring monitoring-event-PY_THROW16197999
Ref: 185516197999
Ref: library/sys monitoring monitoring-event-PY_UNWIND16198113
Ref: 494316198113
Ref: library/sys monitoring monitoring-event-PY_YIELD16198349
Ref: 494416198349
Ref: library/sys monitoring monitoring-event-RAISE16198523
Ref: 197416198523
Ref: library/sys monitoring monitoring-event-RERAISE16198670
Ref: 494616198670
Ref: library/sys monitoring monitoring-event-STOP_ITERATION16198816
Ref: 494516198816
Ref: library/sys monitoring monitoring-event-NO_EVENTS16199368
Ref: 494816199368
Node: Local events16199727
Ref: library/sys monitoring local-events16199807
Ref: 494916199807
Ref: library/sys monitoring monitoring-event-local16199807
Ref: 494a16199807
Node: Deprecated event16200328
Ref: library/sys monitoring deprecated-event16200433
Ref: 494b16200433
Node: Ancillary events16200692
Ref: library/sys monitoring ancillary-events16200797
Ref: 494c16200797
Node: Other events16201240
Ref: library/sys monitoring monitoring-event-global16201353
Ref: 494d16201353
Ref: library/sys monitoring other-events16201353
Ref: 494e16201353
Node: The STOP_ITERATION event16201700
Ref: library/sys monitoring the-stop-iteration-event16201788
Ref: 494716201788
Ref: The STOP_ITERATION event-Footnote-116202787
Node: Turning events on and off16202868
Ref: library/sys monitoring turning-events-on-and-off16203039
Ref: 495016203039
Node: Setting events globally16203489
Ref: library/sys monitoring setting-events-globally16203605
Ref: 495116203605
Ref: library/sys monitoring sys monitoring get_events16203757
Ref: 495216203757
Ref: library/sys monitoring sys monitoring set_events16203888
Ref: 495316203888
Node: Per code object events16204139
Ref: library/sys monitoring per-code-object-events16204280
Ref: 495416204280
Ref: library/sys monitoring sys monitoring get_local_events16204609
Ref: 495516204609
Ref: library/sys monitoring sys monitoring set_local_events16204767
Ref: 495616204767
Node: Disabling events16205045
Ref: library/sys monitoring disabling-events16205154
Ref: 495716205154
Ref: library/sys monitoring sys monitoring DISABLE16205209
Ref: 494f16205209
Ref: library/sys monitoring sys monitoring restart_events16206049
Ref: 495816206049
Node: Registering callback functions16206212
Ref: library/sys monitoring callbacks16206368
Ref: 493516206368
Ref: library/sys monitoring registering-callback-functions16206368
Ref: 495916206368
Ref: library/sys monitoring sys monitoring register_callback16206451
Ref: 476016206451
Node: Callback function arguments16207424
Ref: library/sys monitoring callback-function-arguments16207518
Ref: 495a16207518
Ref: library/sys monitoring sys monitoring MISSING16207595
Ref: 495b16207595
Node: sysconfig --- Python の構成情報へのアクセスを提供する16209631
Ref: library/sysconfig doc16209887
Ref: 495c16209887
Ref: library/sysconfig module-sysconfig16209887
Ref: e116209887
Ref: library/sysconfig sysconfig-provide-access-to-python-s-configuration-information16209887
Ref: 495d16209887
Ref: library/sysconfig translation-repo16209887
Ref: 495e16209887
Ref: sysconfig --- Python の構成情報へのアクセスを提供する-Footnote-116210642
Node: 構成変数16210708
Ref: library/sysconfig configuration-variables16210859
Ref: 495f16210859
Ref: library/sysconfig sysconfig get_config_vars16211398
Ref: 29816211398
Ref: library/sysconfig sysconfig get_config_var16211817
Ref: 17416211817
Node: インストールパス16212282
Ref: library/sysconfig id116212453
Ref: 496016212453
Ref: library/sysconfig installation-paths16212453
Ref: 44916212453
Node: User scheme16215147
Ref: library/sysconfig sysconfig-user-scheme16215317
Ref: 213716215317
Ref: library/sysconfig user-scheme16215317
Ref: 496116215317
Node: posix_user16215842
Ref: library/sysconfig posix-user16215916
Ref: 496216215916
Node: nt_user16216774
Ref: library/sysconfig nt-user16216875
Ref: 496316216875
Node: osx_framework_user16217721
Ref: library/sysconfig osx-framework-user16217803
Ref: 496416217803
Node: Home scheme16218657
Ref: library/sysconfig home-scheme16218816
Ref: 496516218816
Ref: library/sysconfig sysconfig-home-scheme16218816
Ref: 496616218816
Node: posix_home16219473
Ref: library/sysconfig posix-home16219531
Ref: 496716219531
Node: Prefix scheme16220395
Ref: library/sysconfig prefix-scheme16220570
Ref: 496816220570
Ref: library/sysconfig sysconfig-prefix-scheme16220570
Ref: 496916220570
Node: posix_prefix16222168
Ref: library/sysconfig posix-prefix16222241
Ref: 496a16222241
Node: nt16223184
Ref: library/sysconfig nt16223257
Ref: 496b16223257
Node: Installation path functions16224112
Ref: library/sysconfig installation-path-functions16224297
Ref: 496c16224297
Ref: library/sysconfig sysconfig get_scheme_names16224454
Ref: 496d16224454
Ref: library/sysconfig sysconfig get_default_scheme16224589
Ref: 1bb516224589
Ref: library/sysconfig sysconfig get_preferred_scheme16224957
Ref: 89f16224957
Ref: library/sysconfig sysconfig _get_preferred_schemes16225551
Ref: 496e16225551
Ref: library/sysconfig sysconfig get_path_names16226219
Ref: 496f16226219
Ref: library/sysconfig sysconfig get_path16226355
Ref: 154516226355
Ref: library/sysconfig sysconfig get_paths16227884
Ref: 34016227884
Node: その他の関数<3>16228679
Ref: library/sysconfig other-functions16228887
Ref: 497016228887
Ref: library/sysconfig sysconfig get_python_version16228940
Ref: 145b16228940
Ref: library/sysconfig sysconfig get_platform16229142
Ref: 145a16229142
Ref: library/sysconfig sysconfig is_python_build16230236
Ref: 32d16230236
Ref: library/sysconfig sysconfig parse_config_h16230621
Ref: 497116230621
Ref: library/sysconfig sysconfig get_config_h_filename16231115
Ref: 497216231115
Ref: library/sysconfig sysconfig get_makefile_filename16231217
Ref: 497316231217
Ref: library/sysconfig sysconfig-cli16231316
Ref: 497416231316
Node: コマンドラインでの使用<7>16231317
Ref: library/sysconfig command-line-usage16231489
Ref: 497516231489
Ref: library/sysconfig using-sysconfig-as-a-script16231489
Ref: 497616231489
Node: builtins --- 組み込みオブジェクト16232557
Ref: library/builtins doc16232807
Ref: 497716232807
Ref: library/builtins builtins-built-in-objects16232807
Ref: 497816232807
Ref: library/builtins module-builtins16232807
Ref: 1316232807
Ref: library/builtins translation-repo16232807
Ref: 497916232807
Node: __main__ --- トップレベルのコード環境16234681
Ref: library/__main__ doc16234890
Ref: 497a16234890
Ref: library/__main__ main-top-level-code-environment16234890
Ref: 497b16234890
Ref: library/__main__ module-__main__16234890
Ref: 116234890
Ref: library/__main__ translation-repo16234890
Ref: 497c16234890
Node: __name__ == '__main__'16235919
Ref: library/__main__ name-equals-main16236066
Ref: 497d16236066
Ref: library/__main__ name-main16236066
Ref: 497e16236066
Node: 「トップレベルのスクリプト環境」とは16237097
Ref: library/__main__ what-is-the-top-level-code-environment16237240
Ref: 497f16237240
Node: 通常の使われ方16239855
Ref: library/__main__ idiomatic-usage16240049
Ref: 498016240049
Node: パッケージングで考慮すべき点16242586
Ref: library/__main__ packaging-considerations16242717
Ref: 498116242717
Ref: パッケージングで考慮すべき点-Footnote-116244240
Ref: パッケージングで考慮すべき点-Footnote-216244269
Node: __main__ py in Python Packages16244307
Ref: library/__main__ main-py-in-python-packages16244478
Ref: 498216244478
Node: 通常の使われ方<2>16245907
Ref: library/__main__ id116245998
Ref: 498316245998
Node: import __main__16247330
Ref: library/__main__ import-main16247470
Ref: 498416247470
Node: warnings --- 警告の制御16250358
Ref: library/warnings doc16250558
Ref: 498516250558
Ref: library/warnings module-warnings16250558
Ref: 11816250558
Ref: library/warnings translation-repo16250558
Ref: 498616250558
Ref: library/warnings warnings-warning-control16250558
Ref: 498716250558
Ref: warnings --- 警告の制御-Footnote-116253618
Node: 警告カテゴリ16253686
Ref: library/warnings id116253796
Ref: 498b16253796
Ref: library/warnings warning-categories16253796
Ref: 271116253796
Node: 警告フィルタ16258411
Ref: library/warnings the-warnings-filter16258563
Ref: 498c16258563
Ref: library/warnings warning-filter16258563
Ref: 1b116258563
Node: Repeated Warning Suppression Criteria16262246
Ref: library/warnings id216262373
Ref: 498d16262373
Ref: library/warnings repeated-warning-suppression-criteria16262373
Ref: 498e16262373
Node: Describing Warning Filters16263008
Ref: library/warnings describing-warning-filters16263180
Ref: 212a16263180
Ref: library/warnings id316263180
Ref: 498f16263180
Node: デフォルトの警告フィルタ16264896
Ref: library/warnings default-warning-filter16265060
Ref: 499016265060
Ref: library/warnings id416265060
Ref: 499116265060
Node: Overriding the default filter16266321
Ref: library/warnings overriding-the-default-filter16266450
Ref: 499216266450
Ref: library/warnings warning-disable16266450
Ref: 499316266450
Node: 一時的に警告を抑制する16267885
Ref: library/warnings temporarily-suppressing-warnings16268037
Ref: 499416268037
Ref: library/warnings warning-suppress16268037
Ref: 499516268037
Node: 警告のテスト16269112
Ref: library/warnings testing-warnings16269292
Ref: 499716269292
Ref: library/warnings warning-testing16269292
Ref: 499816269292
Node: Updating Code For New Versions of Dependencies16271545
Ref: library/warnings updating-code-for-new-versions-of-dependencies16271713
Ref: 499916271713
Ref: library/warnings warning-ignored16271713
Ref: 461f16271713
Node: 利用可能な関数16273099
Ref: library/warnings available-functions16273300
Ref: 499a16273300
Ref: library/warnings warning-functions16273300
Ref: 499b16273300
Ref: library/warnings warnings warn16273358
Ref: 173216273358
Ref: library/warnings warnings warn_explicit16276162
Ref: efd16276162
Ref: library/warnings warnings showwarning16277732
Ref: 498a16277732
Ref: library/warnings warnings formatwarning16278512
Ref: 1df816278512
Ref: library/warnings warnings filterwarnings16279037
Ref: 16c216279037
Ref: library/warnings warnings simplefilter16279869
Ref: 8d016279869
Ref: library/warnings warnings resetwarnings16280386
Ref: 498916280386
Ref: library/warnings warnings deprecated16280747
Ref: 48916280747
Ref: 利用可能な関数-Footnote-116282621
Node: 利用可能なコンテキストマネージャー16282663
Ref: library/warnings available-context-managers16282855
Ref: 499c16282855
Ref: library/warnings warnings catch_warnings16282963
Ref: 17916282963
Node: Concurrent safety of Context Managers16284769
Ref: library/warnings concurrent-safety-of-context-managers16284931
Ref: 499d16284931
Ref: library/warnings warning-concurrent-safe16284931
Ref: 499616284931
Node: dataclasses --- データクラス16288007
Ref: library/dataclasses doc16288223
Ref: 499e16288223
Ref: library/dataclasses dataclasses-data-classes16288223
Ref: 499f16288223
Ref: library/dataclasses module-dataclasses16288223
Ref: 3316288223
Ref: library/dataclasses translation-repo16288223
Ref: 49a016288223
Ref: dataclasses --- データクラス-Footnote-116290215
Ref: dataclasses --- データクラス-Footnote-216290286
Ref: dataclasses --- データクラス-Footnote-316290328
Node: モジュールの内容<4>16290370
Ref: library/dataclasses module-contents16290498
Ref: 49a116290498
Ref: library/dataclasses dataclasses dataclass16290559
Ref: 4e116290559
Ref: library/dataclasses dataclasses field16300595
Ref: 195a16300595
Ref: library/dataclasses dataclasses Field16305407
Ref: 195b16305407
Ref: library/dataclasses dataclasses InitVar16306227
Ref: 1bb416306227
Ref: library/dataclasses dataclasses fields16306638
Ref: 193516306638
Ref: library/dataclasses dataclasses asdict16307171
Ref: 1a9516307171
Ref: library/dataclasses dataclasses astuple16308214
Ref: 1a9e16308214
Ref: library/dataclasses dataclasses make_dataclass16308946
Ref: 185c16308946
Ref: library/dataclasses dataclasses replace16311135
Ref: 1a6a16311135
Ref: library/dataclasses dataclasses is_dataclass16312634
Ref: 1c1716312634
Ref: library/dataclasses dataclasses MISSING16313205
Ref: 49a416313205
Ref: library/dataclasses dataclasses KW_ONLY16313356
Ref: 49a316313356
Ref: library/dataclasses dataclasses FrozenInstanceError16314313
Ref: 49a716314313
Ref: モジュールの内容<4>-Footnote-116314691
Node: 初期化後の処理16314746
Ref: library/dataclasses id116314898
Ref: 49a816314898
Ref: library/dataclasses post-init-processing16314898
Ref: 49a916314898
Ref: library/dataclasses dataclasses __post_init__16314954
Ref: 49a616314954
Node: クラス変数16316886
Ref: library/dataclasses class-variables16317032
Ref: 49aa16317032
Ref: library/dataclasses dataclasses-class-variables16317032
Ref: 49ab16317032
Ref: クラス変数-Footnote-116317585
Node: 初期化限定変数16317627
Ref: library/dataclasses dataclasses-init-only-variables16317785
Ref: 49a516317785
Ref: library/dataclasses init-only-variables16317785
Ref: 49ac16317785
Node: 凍結されたインスタンス16319079
Ref: library/dataclasses dataclasses-frozen16319231
Ref: 49a216319231
Ref: library/dataclasses frozen-instances16319231
Ref: 49ad16319231
Node: 継承<2>16319851
Ref: library/dataclasses dataclasses-inheritance16320032
Ref: 49ae16320032
Ref: library/dataclasses inheritance16320032
Ref: 49af16320032
Node: Re-ordering of keyword-only parameters in __init__16321074
Ref: library/dataclasses re-ordering-of-keyword-only-parameters-in-init16321258
Ref: 49b016321258
Node: デフォルトファクトリ関数16322728
Ref: library/dataclasses default-factory-functions16322930
Ref: 49b116322930
Node: 可変なデフォルト値16323558
Ref: library/dataclasses mutable-default-values16323733
Ref: 49b216323733
Node: Descriptor-typed fields16325976
Ref: library/dataclasses descriptor-typed-fields16326106
Ref: 49b316326106
Node: contextlib --- with 文コンテキスト用ユーティリティ16328074
Ref: library/contextlib doc16328291
Ref: 49b416328291
Ref: library/contextlib contextlib-utilities-for-with-statement-contexts16328291
Ref: 49b516328291
Ref: library/contextlib module-contextlib16328291
Ref: 2716328291
Ref: library/contextlib translation-repo16328291
Ref: 49b616328291
Ref: contextlib --- with 文コンテキスト用ユーティリティ-Footnote-116329063
Node: ユーティリティ16329133
Ref: library/contextlib utilities16329283
Ref: 49b716329283
Ref: library/contextlib contextlib AbstractContextManager16329393
Ref: e8a16329393
Ref: library/contextlib contextlib AbstractAsyncContextManager16329979
Ref: d2016329979
Ref: library/contextlib contextlib contextmanager16330633
Ref: 141b16330633
Ref: library/contextlib contextlib asynccontextmanager16334534
Ref: d1f16334534
Ref: library/contextlib contextlib closing16337139
Ref: 15a116337139
Ref: library/contextlib contextlib aclosing16338535
Ref: 9ee16338535
Ref: library/contextlib simplifying-support-for-single-optional-context-managers16339965
Ref: 49b816339965
Ref: library/contextlib contextlib nullcontext16339965
Ref: 9ef16339965
Ref: library/contextlib contextlib suppress16341932
Ref: 112916341932
Ref: library/contextlib contextlib redirect_stdout16343619
Ref: fe716343619
Ref: library/contextlib contextlib redirect_stderr16345655
Ref: fe616345655
Ref: library/contextlib contextlib chdir16346054
Ref: 82016346054
Ref: library/contextlib contextlib ContextDecorator16347151
Ref: 141a16347151
Ref: library/contextlib contextlib AsyncContextDecorator16350034
Ref: 9f016350034
Ref: library/contextlib contextlib ExitStack16351182
Ref: d1e16351182
Ref: library/contextlib contextlib ExitStack enter_context16353415
Ref: 7ee16353415
Ref: library/contextlib contextlib ExitStack push16354090
Ref: 49ba16354090
Ref: library/contextlib contextlib ExitStack callback16355001
Ref: c7616355001
Ref: library/contextlib contextlib ExitStack pop_all16355490
Ref: 49bb16355490
Ref: library/contextlib contextlib ExitStack close16356622
Ref: 49bc16356622
Ref: library/contextlib contextlib AsyncExitStack16356977
Ref: d2116356977
Ref: library/contextlib contextlib AsyncExitStack enter_async_context16357441
Ref: 7ef16357441
Ref: library/contextlib contextlib AsyncExitStack push_async_exit16357843
Ref: 49be16357843
Ref: library/contextlib contextlib AsyncExitStack push_async_callback16358028
Ref: c7716358028
Ref: library/contextlib contextlib AsyncExitStack aclose16358200
Ref: 49bd16358200
Node: 例とレシピ<3>16358816
Ref: library/contextlib examples-and-recipes16359074
Ref: 49bf16359074
Node: 可変数個のコンテキストマネージャーをサポートする16359579
Ref: library/contextlib supporting-a-variable-number-of-context-managers16359773
Ref: 49c016359773
Node: __enter__ メソッドからの例外をキャッチする16361097
Ref: library/contextlib catching-exceptions-from-enter-methods16361343
Ref: 49c116361343
Node: __enter__ 実装内のクリーンアップ16362734
Ref: library/contextlib cleaning-up-in-an-enter-implementation16362963
Ref: 49c216362963
Node: try-finally + flag 変数パターンを置き換える16364927
Ref: library/contextlib replacing-any-use-of-try-finally-and-flag-variables16365176
Ref: 49c316365176
Node: コンテキストマネージャーを関数デコレーターとして使う16367959
Ref: library/contextlib using-a-context-manager-as-a-function-decorator16368156
Ref: 49c416368156
Ref: コンテキストマネージャーを関数デコレーターとして使う-Footnote-116370188
Node: 単回使用、再利用可能、およびリエントラントなコンテキストマネージャ16370230
Ref: library/contextlib single-use-reusable-and-reentrant-cms16370458
Ref: 112b16370458
Ref: library/contextlib single-use-reusable-and-reentrant-context-managers16370458
Ref: 49c516370458
Node: リエントラントなコンテキストマネージャ16372423
Ref: library/contextlib reentrant-cms16372676
Ref: 49b916372676
Ref: library/contextlib reentrant-context-managers16372676
Ref: 49c616372676
Node: 再利用可能なコンテキストマネージャ16374647
Ref: library/contextlib reusable-cms16374900
Ref: 49c716374900
Ref: library/contextlib reusable-context-managers16374900
Ref: 49c816374900
Node: abc --- 抽象基底クラス16378203
Ref: library/abc doc16378418
Ref: 49c916378418
Ref: library/abc abc-abstract-base-classes16378418
Ref: 49ca16378418
Ref: library/abc module-abc16378418
Ref: 416378418
Ref: library/abc translation-repo16378418
Ref: 49cb16378418
Ref: library/abc abc ABC16379768
Ref: 111b16379768
Ref: library/abc abc ABCMeta16380678
Ref: 111c16380678
Ref: library/abc abc ABCMeta register16381651
Ref: 129a16381651
Ref: library/abc abc ABCMeta __subclasshook__16382456
Ref: 299a16382456
Ref: library/abc abc abstractmethod16385408
Ref: 129716385408
Ref: library/abc abc abstractclassmethod16388622
Ref: 129816388622
Ref: library/abc abc abstractstaticmethod16389480
Ref: 129916389480
Ref: library/abc abc abstractproperty16390336
Ref: 129616390336
Ref: library/abc abc get_cache_token16392032
Ref: 111a16392032
Ref: library/abc abc update_abstractmethods16392529
Ref: 49cc16392529
Ref: abc --- 抽象基底クラス-Footnote-116393194
Ref: abc --- 抽象基底クラス-Footnote-216393257
Ref: abc --- 抽象基底クラス-Footnote-316393299
Ref: abc --- 抽象基底クラス-Footnote-416393341
Node: atexit --- 終了ハンドラー16393497
Ref: library/atexit doc16393709
Ref: 49cd16393709
Ref: library/atexit atexit-exit-handlers16393709
Ref: 49ce16393709
Ref: library/atexit module-atexit16393709
Ref: d16393709
Ref: library/atexit translation-repo16393709
Ref: 49cf16393709
Ref: library/atexit atexit register16394906
Ref: a7e16394906
Ref: library/atexit atexit unregister16396961
Ref: 177f16396961
Node: atexit Example16397647
Ref: library/atexit atexit-example16397730
Ref: 49d016397730
Ref: library/atexit id116397730
Ref: 49d116397730
Node: traceback --- スタックトレースの表示または取得16399189
Ref: library/traceback doc16399406
Ref: 49d216399406
Ref: library/traceback module-traceback16399406
Ref: 10416399406
Ref: library/traceback traceback-print-or-retrieve-a-stack-traceback16399406
Ref: 49d316399406
Ref: library/traceback translation-repo16399406
Ref: 49d416399406
Ref: traceback --- スタックトレースの表示または取得-Footnote-116401612
Node: モジュールレベルの関数<2>16401681
Ref: library/traceback module-level-functions16401862
Ref: 49d516401862
Ref: library/traceback traceback print_tb16401940
Ref: 108516401940
Ref: library/traceback traceback print_exception16402912
Ref: a4f16402912
Ref: library/traceback traceback print_exc16404624
Ref: 1c2416404624
Ref: library/traceback traceback print_last16404808
Ref: 49d616404808
Ref: library/traceback traceback print_stack16405121
Ref: 108616405121
Ref: library/traceback traceback extract_tb16405884
Ref: 49d716405884
Ref: library/traceback traceback extract_stack16406712
Ref: 49dc16406712
Ref: library/traceback traceback print_list16407070
Ref: 18ef16407070
Ref: library/traceback traceback format_list16407374
Ref: 49dd16407374
Ref: library/traceback traceback format_exception_only16408068
Ref: a4e16408068
Ref: library/traceback traceback format_exception16409482
Ref: a4d16409482
Ref: library/traceback traceback format_exc16410308
Ref: 49de16410308
Ref: library/traceback traceback format_tb16410508
Ref: 48a116410508
Ref: library/traceback traceback format_stack16410633
Ref: 49df16410633
Ref: library/traceback traceback clear_frames16410767
Ref: 11d616410767
Ref: library/traceback traceback walk_stack16411013
Ref: 108116411013
Ref: library/traceback traceback walk_tb16411570
Ref: 108216411570
Node: TracebackException オブジェクト16411813
Ref: library/traceback tracebackexception-objects16412034
Ref: 49e116412034
Ref: library/traceback traceback TracebackException16412533
Ref: 56316412533
Ref: library/traceback traceback TracebackException __cause__16413943
Ref: 49e316413943
Ref: library/traceback traceback TracebackException __context__16414050
Ref: 49e216414050
Ref: library/traceback traceback TracebackException exceptions16414161
Ref: 49e516414161
Ref: library/traceback traceback TracebackException __suppress_context__16414440
Ref: 49e416414440
Ref: library/traceback traceback TracebackException __notes__16414555
Ref: 49e616414555
Ref: library/traceback traceback TracebackException stack16414865
Ref: 49e716414865
Ref: library/traceback traceback TracebackException exc_type16414963
Ref: 56416414963
Ref: library/traceback traceback TracebackException exc_type_str16415096
Ref: 56216415096
Ref: library/traceback traceback TracebackException filename16415230
Ref: 49e816415230
Ref: library/traceback traceback TracebackException lineno16415341
Ref: 49e916415341
Ref: library/traceback traceback TracebackException end_lineno16415438
Ref: 49ea16415438
Ref: library/traceback traceback TracebackException text16415626
Ref: 49eb16415626
Ref: library/traceback traceback TracebackException offset16415724
Ref: 49ec16415724
Ref: library/traceback traceback TracebackException end_offset16415845
Ref: 49ed16415845
Ref: library/traceback traceback TracebackException msg16416042
Ref: 49ee16416042
Ref: library/traceback traceback TracebackException from_exception16416145
Ref: 49ef16416145
Ref: library/traceback traceback TracebackException print16416635
Ref: 8b316416635
Ref: library/traceback traceback TracebackException format16416849
Ref: 49f016416849
Ref: library/traceback traceback TracebackException format_exception_only16417362
Ref: 56516417362
Node: StackSummary オブジェクト16418471
Ref: library/traceback stacksummary-objects16418687
Ref: 49f116418687
Ref: library/traceback traceback StackSummary16418915
Ref: 108316418915
Ref: library/traceback traceback StackSummary extract16418954
Ref: 49e016418954
Ref: library/traceback traceback StackSummary from_list16419972
Ref: 49f216419972
Ref: library/traceback traceback StackSummary format16420283
Ref: 49f316420283
Ref: library/traceback traceback StackSummary format_frame_summary16420928
Ref: 8b216420928
Node: FrameSummary オブジェクト16421339
Ref: library/traceback framesummary-objects16421562
Ref: 49f416421562
Ref: library/traceback traceback FrameSummary16421766
Ref: 108416421766
Ref: library/traceback traceback FrameSummary filename16422698
Ref: 49d816422698
Ref: library/traceback traceback FrameSummary lineno16422901
Ref: 49d916422901
Ref: library/traceback traceback FrameSummary name16422991
Ref: 49da16422991
Ref: library/traceback traceback FrameSummary line16423127
Ref: 49db16423127
Ref: library/traceback traceback FrameSummary end_lineno16423336
Ref: 49f516423336
Ref: library/traceback traceback FrameSummary colno16423626
Ref: 49f616423626
Ref: library/traceback traceback FrameSummary end_colno16423787
Ref: 49f716423787
Node: Examples of Using the Module-Level Functions16423957
Ref: library/traceback examples-of-using-the-module-level-functions16424185
Ref: 49f816424185
Ref: library/traceback traceback-example16424185
Ref: 49f916424185
Node: Examples of Using TracebackException16429746
Ref: library/traceback examples-of-using-tracebackexception16429934
Ref: 49fa16429934
Node: __future__ --- future 文の定義16432590
Ref: library/__future__ doc16432833
Ref: 49fb16432833
Ref: library/__future__ future-future-statement-definitions16432833
Ref: 49fc16432833
Ref: library/__future__ module-__future__16432833
Ref: 016432833
Ref: library/__future__ translation-repo16432833
Ref: 49fd16432833
Ref: __future__ --- future 文の定義-Footnote-116434502
Node: モジュールコンテンツ<5>16434572
Ref: library/__future__ module-contents16434676
Ref: 49fe16434676
Ref: library/__future__ future__ nested_scopes16435353
Ref: 49ff16435353
Ref: library/__future__ future__ generators16435757
Ref: 4a0016435757
Ref: library/__future__ future__ division16436154
Ref: 4a0116436154
Ref: library/__future__ future__ absolute_import16436564
Ref: 4a0216436564
Ref: library/__future__ future__ with_statement16437075
Ref: 4a0316437075
Ref: library/__future__ future__ print_function16437479
Ref: 4a0416437479
Ref: library/__future__ future__ unicode_literals16437881
Ref: 4a0516437881
Ref: library/__future__ future__ generator_stop16438291
Ref: 4a0616438291
Ref: library/__future__ future__ annotations16438711
Ref: 4a0716438711
Ref: library/__future__ future-classes16439362
Ref: 4a0816439362
Ref: library/__future__ future__ _Feature16439362
Ref: 25c816439362
Ref: library/__future__ future__ _Feature getOptionalRelease16440096
Ref: 4a0916440096
Ref: library/__future__ future__ _Feature getMandatoryRelease16440252
Ref: 4a0a16440252
Ref: library/__future__ future__ _Feature compiler_flag16441000
Ref: 239316441000
Ref: モジュールコンテンツ<5>-Footnote-116441655
Ref: モジュールコンテンツ<5>-Footnote-216441697
Ref: モジュールコンテンツ<5>-Footnote-316441739
Ref: モジュールコンテンツ<5>-Footnote-416441781
Ref: モジュールコンテンツ<5>-Footnote-516441823
Ref: モジュールコンテンツ<5>-Footnote-616441865
Ref: モジュールコンテンツ<5>-Footnote-716441907
Ref: モジュールコンテンツ<5>-Footnote-816441949
Ref: モジュールコンテンツ<5>-Footnote-916441991
Ref: モジュールコンテンツ<5>-Footnote-1016442308
Ref: モジュールコンテンツ<5>-Footnote-1116442351
Ref: モジュールコンテンツ<5>-Footnote-1216442394
Node: gc --- ガベージコレクターインターフェース16442437
Ref: library/gc doc16442675
Ref: 4a0b16442675
Ref: library/gc gc-garbage-collector-interface16442675
Ref: 4a0c16442675
Ref: library/gc module-gc16442675
Ref: 6416442675
Ref: library/gc translation-repo16442675
Ref: 4a0d16442675
Ref: library/gc gc enable16443885
Ref: 4a0e16443885
Ref: library/gc gc disable16443981
Ref: 4a0f16443981
Ref: library/gc gc isenabled16444078
Ref: 4a1016444078
Ref: library/gc gc collect16444198
Ref: 1b316444198
Ref: library/gc gc set_debug16445346
Ref: 4a1116445346
Ref: library/gc gc get_debug16445629
Ref: 4a1216445629
Ref: library/gc gc get_objects16445716
Ref: a0416445716
Ref: library/gc gc get_stats16446366
Ref: 2dc16446366
Ref: library/gc gc set_threshold16447133
Ref: 2da16447133
Ref: library/gc gc get_count16448768
Ref: 2db16448768
Ref: library/gc gc get_threshold16448893
Ref: 2d916448893
Ref: library/gc gc get_referrers16449043
Ref: a0516449043
Ref: library/gc gc get_referents16450366
Ref: a0616450366
Ref: library/gc gc is_tracked16451383
Ref: 152516451383
Ref: library/gc gc is_finalized16452435
Ref: af916452435
Ref: library/gc gc freeze16452948
Ref: d2e16452948
Ref: library/gc gc unfreeze16453782
Ref: d2f16453782
Ref: library/gc gc get_freeze_count16453971
Ref: d3016453971
Ref: library/gc gc garbage16454297
Ref: 13d916454297
Ref: library/gc gc callbacks16455418
Ref: 12de16455418
Ref: library/gc gc DEBUG_STATS16457039
Ref: 4a1416457039
Ref: library/gc gc DEBUG_COLLECTABLE16457197
Ref: 4a1516457197
Ref: library/gc gc DEBUG_UNCOLLECTABLE16457316
Ref: 13da16457316
Ref: library/gc gc DEBUG_SAVEALL16457845
Ref: 4a1316457845
Ref: library/gc gc DEBUG_LEAK16458111
Ref: 4a1616458111
Ref: gc --- ガベージコレクターインターフェース-Footnote-116458357
Ref: gc --- ガベージコレクターインターフェース-Footnote-216458444
Node: inspect --- 活動中のオブジェクトを調査する16458486
Ref: library/inspect doc16458751
Ref: 4a1716458751
Ref: library/inspect inspect-inspect-live-objects16458751
Ref: 4a1816458751
Ref: library/inspect translation-repo16458751
Ref: 4a1916458751
Ref: library/inspect module-inspect16458875
Ref: 8216458875
Ref: inspect --- 活動中のオブジェクトを調査する-Footnote-116460242
Node: 型とメンバー16460309
Ref: library/inspect inspect-types16460463
Ref: 1d9216460463
Ref: library/inspect types-and-members16460463
Ref: 4a1a16460463
Ref: library/inspect inspect getmembers16481709
Ref: 1bf116481709
Ref: library/inspect inspect getmembers_static16482484
Ref: 85916482484
Ref: library/inspect inspect getmodulename16483564
Ref: f3416483564
Ref: library/inspect inspect ismodule16484527
Ref: 4a1c16484527
Ref: library/inspect inspect isclass16484651
Ref: 4a1d16484651
Ref: library/inspect inspect ismethod16484815
Ref: 4a1e16484815
Ref: library/inspect inspect ispackage16484936
Ref: 23216484936
Ref: library/inspect inspect isfunction16485071
Ref: 4a1f16485071
Ref: library/inspect inspect isgeneratorfunction16485264
Ref: 1b5b16485264
Ref: library/inspect inspect isgenerator16485924
Ref: 4a2016485924
Ref: library/inspect inspect iscoroutinefunction16486054
Ref: 30d16486054
Ref: library/inspect inspect markcoroutinefunction16487259
Ref: 6b816487259
Ref: library/inspect inspect iscoroutine16488082
Ref: 101716488082
Ref: library/inspect inspect isawaitable16488297
Ref: 101816488297
Ref: library/inspect inspect isasyncgenfunction16488829
Ref: 1b5c16488829
Ref: library/inspect inspect isasyncgen16489671
Ref: 4a2116489671
Ref: library/inspect inspect istraceback16489946
Ref: 4a2216489946
Ref: library/inspect inspect isframe16490082
Ref: 4a2316490082
Ref: library/inspect inspect iscode16490205
Ref: 4a2416490205
Ref: library/inspect inspect isbuiltin16490324
Ref: 4a2516490324
Ref: library/inspect inspect ismethodwrapper16490502
Ref: 85a16490502
Ref: library/inspect inspect isroutine16490874
Ref: 1bdd16490874
Ref: library/inspect inspect isabstract16491052
Ref: 4a2616491052
Ref: library/inspect inspect ismethoddescriptor16491193
Ref: 194e16491193
Ref: library/inspect inspect isdatadescriptor16493000
Ref: 4a2716493000
Ref: library/inspect inspect isgetsetdescriptor16493972
Ref: 4a2816493972
Ref: library/inspect inspect ismemberdescriptor16494384
Ref: 4a2916494384
Node: ソースコードの情報取得16494821
Ref: library/inspect inspect-source16495066
Ref: 4a2a16495066
Ref: library/inspect retrieving-source-code16495066
Ref: 4a2b16495066
Ref: library/inspect inspect getdoc16495144
Ref: bed16495144
Ref: library/inspect inspect getcomments16495967
Ref: 193816495967
Ref: library/inspect inspect getfile16496572
Ref: 1e8516496572
Ref: library/inspect inspect getmodule16496881
Ref: 1b6d16496881
Ref: library/inspect inspect getsourcefile16497096
Ref: 1b6e16497096
Ref: library/inspect inspect getsourcelines16497454
Ref: 17b716497454
Ref: library/inspect inspect getsource16498475
Ref: 17c316498475
Ref: library/inspect inspect cleandoc16499328
Ref: 1a2c16499328
Node: Signature オブジェクトで呼び出し可能オブジェクトを内省する16499785
Ref: library/inspect inspect-signature-object16500033
Ref: 4a2c16500033
Ref: library/inspect introspecting-callables-with-the-signature-object16500033
Ref: 4a2d16500033
Ref: library/inspect inspect signature16500503
Ref: 22f16500503
Ref: library/inspect inspect Signature16504834
Ref: 4e316504834
Ref: library/inspect inspect Signature empty16506536
Ref: 4a3016506536
Ref: library/inspect inspect Signature parameters16506683
Ref: 4a2e16506683
Ref: library/inspect inspect Signature return_annotation16507308
Ref: 4a3116507308
Ref: library/inspect inspect Signature bind16507617
Ref: 189216507617
Ref: library/inspect inspect Signature bind_partial16508032
Ref: 4a3216508032
Ref: library/inspect inspect Signature replace16508498
Ref: 4a2f16508498
Ref: library/inspect inspect Signature format16509572
Ref: 23116509572
Ref: library/inspect inspect Signature from_callable16510690
Ref: 94216510690
Ref: library/inspect inspect Parameter16511632
Ref: 4e416511632
Ref: library/inspect inspect Parameter empty16512297
Ref: 4a3416512297
Ref: library/inspect inspect Parameter name16512458
Ref: 4a3516512458
Ref: library/inspect inspect Parameter default16513049
Ref: 4a3616513049
Ref: library/inspect inspect Parameter annotation16513251
Ref: 4a3716513251
Ref: library/inspect inspect Parameter kind16513462
Ref: 4a3816513462
Ref: library/inspect inspect Parameter kind description16516425
Ref: 4a3916516425
Ref: library/inspect inspect Parameter replace16517003
Ref: 4a3316517003
Ref: library/inspect inspect BoundArguments16518461
Ref: 127516518461
Ref: library/inspect inspect BoundArguments arguments16518728
Ref: b0816518728
Ref: library/inspect inspect BoundArguments args16519814
Ref: 4a3a16519814
Ref: library/inspect inspect BoundArguments kwargs16519966
Ref: 4a3b16519966
Ref: library/inspect inspect BoundArguments signature16520264
Ref: 4a3c16520264
Ref: library/inspect inspect BoundArguments apply_defaults16520375
Ref: 101616520375
Ref: Signature オブジェクトで呼び出し可能オブジェクトを内省する-Footnote-116521486
Node: クラスと関数<2>16521528
Ref: library/inspect classes-and-functions16521776
Ref: 4a3d16521776
Ref: library/inspect inspect-classes-functions16521776
Ref: 4a3e16521776
Ref: library/inspect inspect getclasstree16521829
Ref: 4a3f16521829
Ref: library/inspect inspect getfullargspec16522474
Ref: 94116522474
Ref: library/inspect inspect getargvalues16525471
Ref: 10bf16525471
Ref: library/inspect inspect formatargvalues16526095
Ref: 10c016526095
Ref: library/inspect inspect getmro16526594
Ref: 4a4016526594
Ref: library/inspect inspect getcallargs16527077
Ref: 10be16527077
Ref: library/inspect inspect getclosurevars16528620
Ref: 12ec16528620
Ref: library/inspect inspect unwrap16529630
Ref: 115e16529630
Ref: library/inspect inspect get_annotations16530748
Ref: a1416530748
Node: インタープリタスタック16531615
Ref: library/inspect inspect-stack16531811
Ref: 4a4116531811
Ref: library/inspect the-interpreter-stack16531811
Ref: 4a4216531811
Ref: library/inspect inspect FrameInfo16532255
Ref: 85c16532255
Ref: library/inspect inspect FrameInfo frame16532289
Ref: 4a4316532289
Ref: library/inspect inspect FrameInfo filename16532414
Ref: 4a4416532414
Ref: library/inspect inspect FrameInfo lineno16532575
Ref: 4a4516532575
Ref: library/inspect inspect FrameInfo function16532746
Ref: 4a4616532746
Ref: library/inspect inspect FrameInfo code_context16532878
Ref: 4a4716532878
Ref: library/inspect inspect FrameInfo index16533094
Ref: 4a4816533094
Ref: library/inspect inspect FrameInfo positions16533248
Ref: 4a4916533248
Ref: library/inspect inspect Traceback16533918
Ref: 85d16533918
Ref: library/inspect inspect Traceback filename16533952
Ref: 4a4a16533952
Ref: library/inspect inspect Traceback lineno16534122
Ref: 4a4b16534122
Ref: library/inspect inspect Traceback function16534302
Ref: 4a4c16534302
Ref: library/inspect inspect Traceback code_context16534454
Ref: 4a4d16534454
Ref: library/inspect inspect Traceback index16534679
Ref: 4a4e16534679
Ref: library/inspect inspect Traceback positions16534833
Ref: 4a4f16534833
Ref: library/inspect inspect getframeinfo16537066
Ref: 85f16537066
Ref: library/inspect inspect getouterframes16537449
Ref: 86016537449
Ref: library/inspect inspect getinnerframes16538310
Ref: 86116538310
Ref: library/inspect inspect currentframe16539109
Ref: 8f116539109
Ref: library/inspect inspect stack16539546
Ref: 86216539546
Ref: library/inspect inspect trace16540212
Ref: 86316540212
Node: 属性の静的なフェッチ16540886
Ref: library/inspect fetching-attributes-statically16541127
Ref: 4a5016541127
Ref: library/inspect inspect getattr_static16541881
Ref: 6bc16541881
Node: Current State of Generators Coroutines and Asynchronous Generators16543687
Ref: library/inspect current-state-of-generators-coroutines-and-asynchronous-generators16543917
Ref: 4a5116543917
Ref: library/inspect inspect getgeneratorstate16544399
Ref: 144e16544399
Ref: library/inspect inspect getcoroutinestate16544879
Ref: 101a16544879
Ref: library/inspect inspect getasyncgenstate16545525
Ref: 6ba16545525
Ref: library/inspect inspect getgeneratorlocals16546455
Ref: 12ed16546455
Ref: library/inspect inspect getcoroutinelocals16547321
Ref: 101916547321
Ref: library/inspect inspect getasyncgenlocals16547560
Ref: 6bb16547560
Node: Code Objects Bit Flags16547849
Ref: library/inspect code-objects-bit-flags16548061
Ref: 4a5216548061
Ref: library/inspect inspect-module-co-flags16548061
Ref: 239216548061
Ref: library/inspect inspect CO_OPTIMIZED16548231
Ref: 4a5316548231
Ref: library/inspect inspect CO_NEWLOCALS16548323
Ref: 4a5416548323
Ref: library/inspect inspect CO_VARARGS16548477
Ref: 4a5516548477
Ref: library/inspect inspect CO_VARKEYWORDS16548590
Ref: 4a5616548590
Ref: library/inspect inspect CO_NESTED16548707
Ref: 4a5716548707
Ref: library/inspect inspect CO_GENERATOR16548806
Ref: 4a5816548806
Ref: library/inspect inspect CO_COROUTINE16548986
Ref: 4a5916548986
Ref: library/inspect inspect CO_ITERABLE_COROUTINE16549228
Ref: 4a5a16549228
Ref: library/inspect inspect CO_ASYNC_GENERATOR16549548
Ref: 4a5b16549548
Ref: library/inspect inspect CO_HAS_DOCSTRING16549824
Ref: 239416549824
Ref: library/inspect inspect CO_METHOD16550053
Ref: 4a5c16550053
Ref: Code Objects Bit Flags-Footnote-116550573
Ref: Code Objects Bit Flags-Footnote-216550615
Ref: Code Objects Bit Flags-Footnote-316550657
Node: Buffer flags16550699
Ref: library/inspect buffer-flags16550897
Ref: 4a5d16550897
Ref: library/inspect inspect BufferFlags16550944
Ref: 68d16550944
Ref: library/inspect inspect BufferFlags SIMPLE16551277
Ref: 4a5e16551277
Ref: library/inspect inspect BufferFlags WRITABLE16551305
Ref: 4a5f16551305
Ref: library/inspect inspect BufferFlags FORMAT16551335
Ref: 4a6016551335
Ref: library/inspect inspect BufferFlags ND16551363
Ref: 4a6116551363
Ref: library/inspect inspect BufferFlags STRIDES16551387
Ref: 4a6216551387
Ref: library/inspect inspect BufferFlags C_CONTIGUOUS16551416
Ref: 4a6316551416
Ref: library/inspect inspect BufferFlags F_CONTIGUOUS16551450
Ref: 4a6416551450
Ref: library/inspect inspect BufferFlags ANY_CONTIGUOUS16551484
Ref: 4a6516551484
Ref: library/inspect inspect BufferFlags INDIRECT16551520
Ref: 4a6616551520
Ref: library/inspect inspect BufferFlags CONTIG16551550
Ref: 4a6716551550
Ref: library/inspect inspect BufferFlags CONTIG_RO16551578
Ref: 4a6816551578
Ref: library/inspect inspect BufferFlags STRIDED16551609
Ref: 4a6916551609
Ref: library/inspect inspect BufferFlags STRIDED_RO16551638
Ref: 4a6a16551638
Ref: library/inspect inspect BufferFlags RECORDS16551670
Ref: 4a6b16551670
Ref: library/inspect inspect BufferFlags RECORDS_RO16551699
Ref: 4a6c16551699
Ref: library/inspect inspect BufferFlags FULL16551731
Ref: 4a6d16551731
Ref: library/inspect inspect BufferFlags FULL_RO16551757
Ref: 4a6e16551757
Ref: library/inspect inspect BufferFlags READ16551786
Ref: 18f516551786
Ref: library/inspect inspect BufferFlags WRITE16551812
Ref: 18f616551812
Node: コマンドライン・インターフェース<10>16551868
Ref: library/inspect command-line-interface16552035
Ref: 4a6f16552035
Ref: library/inspect inspect-module-cli16552035
Ref: 115d16552035
Ref: library/inspect cmdoption-inspect-details16552443
Ref: 4a7016552443
Node: annotationlib --- Functionality for introspecting annotations16552550
Ref: library/annotationlib doc16552799
Ref: 4a7116552799
Ref: library/annotationlib annotationlib-functionality-for-introspecting-annotations16552799
Ref: 4a7216552799
Ref: library/annotationlib module-annotationlib16552799
Ref: 616552799
Ref: library/annotationlib translation-repo16552799
Ref: 4a7316552799
Ref: annotationlib --- Functionality for introspecting annotations-Footnote-116555785
Ref: annotationlib --- Functionality for introspecting annotations-Footnote-216555858
Ref: annotationlib --- Functionality for introspecting annotations-Footnote-316555900
Ref: annotationlib --- Functionality for introspecting annotations-Footnote-416555942
Ref: annotationlib --- Functionality for introspecting annotations-Footnote-516555984
Node: Annotation semantics16556036
Ref: library/annotationlib annotation-semantics16556175
Ref: 4a7416556175
Ref: Annotation semantics-Footnote-116558824
Ref: Annotation semantics-Footnote-216558866
Ref: Annotation semantics-Footnote-316558908
Ref: Annotation semantics-Footnote-416558950
Ref: Annotation semantics-Footnote-516558992
Ref: Annotation semantics-Footnote-616559034
Ref: Annotation semantics-Footnote-716559076
Ref: Annotation semantics-Footnote-816559118
Ref: Annotation semantics-Footnote-916559160
Node: クラス<5>16559202
Ref: library/annotationlib classes16559360
Ref: 4a7516559360
Ref: library/annotationlib annotationlib Format16559398
Ref: 23016559398
Ref: library/annotationlib annotationlib Format VALUE16559737
Ref: 15e16559737
Ref: library/annotationlib annotationlib Format VALUE_WITH_FAKE_GLOBALS16559853
Ref: 4a7616559853
Ref: library/annotationlib annotationlib Format FORWARDREF16560426
Ref: 15f16560426
Ref: library/annotationlib annotationlib Format STRING16560735
Ref: 16016560735
Ref: library/annotationlib annotationlib ForwardRef16561127
Ref: 177616561127
Ref: library/annotationlib annotationlib ForwardRef __forward_arg__16561519
Ref: 4a7716561519
Ref: library/annotationlib annotationlib ForwardRef evaluate16561740
Ref: 17b216561740
Node: 関数<12>16564872
Ref: library/annotationlib functions16565022
Ref: 4a7816565022
Ref: library/annotationlib annotationlib annotations_to_string16565055
Ref: 4a7916565055
Ref: library/annotationlib annotationlib call_annotate_function16565899
Ref: 17be16565899
Ref: library/annotationlib annotationlib call_evaluate_function16567125
Ref: 44f016567125
Ref: library/annotationlib annotationlib get_annotate_from_class_namespace16569041
Ref: 45b16569041
Ref: library/annotationlib annotationlib get_annotations16569604
Ref: 45916569604
Ref: library/annotationlib annotationlib type_repr16574949
Ref: 185616574949
Ref: 関数<12>-Footnote-116575641
Node: レシピ<3>16575732
Ref: library/annotationlib recipes16575902
Ref: 4a7b16575902
Node: Using annotations in a metaclass16575987
Ref: library/annotationlib annotationlib-metaclass16576068
Ref: 4a7a16576068
Ref: library/annotationlib using-annotations-in-a-metaclass16576068
Ref: 4a7c16576068
Node: Limitations of the STRING format16579202
Ref: library/annotationlib limitations-of-the-string-format16579398
Ref: 4a7d16579398
Node: Limitations of the FORWARDREF format16583200
Ref: library/annotationlib limitations-of-the-forwardref-format16583434
Ref: 4aa216583434
Node: Security implications of introspecting annotations16584534
Ref: library/annotationlib annotationlib-security16584727
Ref: 451816584727
Ref: library/annotationlib security-implications-of-introspecting-annotations16584727
Ref: 4aa316584727
Node: site --- サイト固有の設定フック16585951
Ref: library/site doc16586134
Ref: 4aa416586134
Ref: library/site module-site16586134
Ref: cc16586134
Ref: library/site site-site-specific-configuration-hook16586134
Ref: 4aa516586134
Ref: library/site translation-repo16586134
Ref: 4aa616586134
Ref: library/site site-virtual-environments-configuration16588593
Ref: 48b416588593
Ref: site --- サイト固有の設定フック-Footnote-116592287
Node: sitecustomize16592351
Ref: library/site module-sitecustomize16592465
Ref: cd16592465
Ref: library/site sitecustomize16592465
Ref: 4aa716592465
Node: usercustomize16593216
Ref: library/site module-usercustomize16593357
Ref: 11416593357
Ref: library/site usercustomize16593357
Ref: 4aa816593357
Node: readline の設定16594151
Ref: library/site readline-configuration16594306
Ref: 4aaa16594306
Ref: library/site rlcompleter-config16594306
Ref: 11cb16594306
Node: モジュールの内容<5>16595023
Ref: library/site module-contents16595217
Ref: 4aab16595217
Ref: library/site site PREFIXES16595280
Ref: 4aac16595280
Ref: library/site site ENABLE_USER_SITE16595378
Ref: 4aa916595378
Ref: library/site site USER_SITE16596066
Ref: 212616596066
Ref: library/site site USER_BASE16596682
Ref: 153416596682
Ref: library/site site main16597443
Ref: 212716597443
Ref: library/site site addsitedir16597874
Ref: 227216597874
Ref: library/site site getsitepackages16598154
Ref: 145616598154
Ref: library/site site getuserbase16598319
Ref: 145716598319
Ref: library/site site getusersitepackages16598605
Ref: 145816598605
Node: コマンドライン・インターフェース<11>16599091
Ref: library/site command-line-interface16599258
Ref: 4aad16599258
Ref: library/site site-commandline16599258
Ref: 4aae16599258
Ref: library/site cmdoption-site-user-base16599887
Ref: 4aaf16599887
Ref: library/site cmdoption-site-user-site16599979
Ref: 4ab016599979
Ref: コマンドライン・インターフェース<11>-Footnote-116601057
Node: カスタム Python インタプリタ16601099
Ref: library/custominterp doc16601287
Ref: 4ab116601287
Ref: library/custominterp custom-python-interpreters16601287
Ref: 4ab216601287
Ref: library/custominterp custominterp16601287
Ref: 4ab316601287
Ref: library/custominterp translation-repo16601287
Ref: 4ab416601287
Node: code --- インタープリター基底クラス16602179
Ref: library/code doc16602362
Ref: 4ab516602362
Ref: library/code code-interpreter-base-classes16602362
Ref: 4ab616602362
Ref: library/code module-code16602362
Ref: 1b16602362
Ref: library/code code InteractiveInterpreter16602895
Ref: 194316602895
Ref: library/code code InteractiveConsole16603841
Ref: 280716603841
Ref: library/code code interact16604563
Ref: 189016604563
Ref: library/code code compile_command16605813
Ref: 4ab916605813
Ref: code --- インタープリター基底クラス-Footnote-116607473
Node: 対話的なインタプリタオブジェクト16607537
Ref: library/code interactive-interpreter-objects16607724
Ref: 4aba16607724
Ref: library/code interpreter-objects16607724
Ref: 4abb16607724
Ref: library/code code InteractiveInterpreter runsource16607825
Ref: 4abc16607825
Ref: library/code code InteractiveInterpreter runcode16609386
Ref: 4abe16609386
Ref: library/code code InteractiveInterpreter showsyntaxerror16610062
Ref: 4abd16610062
Ref: library/code code InteractiveInterpreter showtraceback16610712
Ref: fce16610712
Ref: library/code code InteractiveInterpreter write16611225
Ref: 4abf16611225
Node: 対話的なコンソールオブジェクト16611515
Ref: library/code console-objects16611702
Ref: 4ac016611702
Ref: library/code interactive-console-objects16611702
Ref: 4ac116611702
Ref: library/code code InteractiveConsole interact16612038
Ref: 4ab816612038
Ref: library/code code InteractiveConsole push16613215
Ref: 4ac216613215
Ref: library/code code InteractiveConsole resetbuffer16614172
Ref: 4ac316614172
Ref: library/code code InteractiveConsole raw_input16614325
Ref: 4ab716614325
Node: codeop --- Python コードをコンパイルする16614779
Ref: library/codeop doc16614962
Ref: 4ac416614962
Ref: library/codeop codeop-compile-python-code16614962
Ref: 4ac516614962
Ref: library/codeop module-codeop16614962
Ref: 1d16614962
Ref: library/codeop translation-repo16614962
Ref: 4ac616614962
Ref: library/codeop codeop compile_command16616116
Ref: 1b5316616116
Ref: library/codeop codeop Compile16617921
Ref: 4ac716617921
Ref: library/codeop codeop CommandCompiler16618453
Ref: 4ac816618453
Ref: codeop --- Python コードをコンパイルする-Footnote-116619026
Node: モジュールのインポート16619092
Ref: library/modules doc16619270
Ref: 4ac916619270
Ref: library/modules importing-modules16619270
Ref: 4aca16619270
Ref: library/modules modules16619270
Ref: 4acb16619270
Ref: library/modules translation-repo16619270
Ref: 4acc16619270
Node: zipimport --- Zip アーカイブからモジュールをインポートする16620800
Ref: library/zipimport doc16621011
Ref: 4acd16621011
Ref: library/zipimport module-zipimport16621011
Ref: 13816621011
Ref: library/zipimport zipimport-import-modules-from-zip-archives16621011
Ref: 4ace16621011
Ref: library/zipimport zipimport ZipImportError16623883
Ref: 4acf16623883
Ref: zipimport --- Zip アーカイブからモジュールをインポートする-Footnote-116624221
Ref: zipimport --- Zip アーカイブからモジュールをインポートする-Footnote-216624290
Ref: zipimport --- Zip アーカイブからモジュールをインポートする-Footnote-316624358
Ref: zipimport --- Zip アーカイブからモジュールをインポートする-Footnote-416624400
Ref: zipimport --- Zip アーカイブからモジュールをインポートする-Footnote-516624442
Node: zipimporter オブジェクト16624484
Ref: library/zipimport id116624651
Ref: 4ad016624651
Ref: library/zipimport zipimporter-objects16624651
Ref: 4ad116624651
Ref: library/zipimport zipimport zipimporter16624817
Ref: 4ad216624817
Ref: library/zipimport zipimport zipimporter create_module16625645
Ref: a5f16625645
Ref: library/zipimport zipimport zipimporter exec_module16625897
Ref: 33916625897
Ref: library/zipimport zipimport zipimporter find_spec16626053
Ref: a5e16626053
Ref: library/zipimport zipimport zipimporter get_code16626240
Ref: 4ad316626240
Ref: library/zipimport zipimport zipimporter get_data16626519
Ref: 4ad416626519
Ref: library/zipimport zipimport zipimporter get_filename16626927
Ref: 4ad516626927
Ref: library/zipimport zipimport zipimporter get_source16627287
Ref: 4ad616627287
Ref: library/zipimport zipimport zipimporter is_package16627681
Ref: 4ad716627681
Ref: library/zipimport zipimport zipimporter load_module16627956
Ref: 33816627956
Ref: library/zipimport zipimport zipimporter invalidate_caches16628390
Ref: a6016628390
Ref: library/zipimport zipimport zipimporter archive16628576
Ref: 4ad816628576
Ref: library/zipimport zipimport zipimporter prefix16628741
Ref: 4ad916628741
Node: 使用例<47>16629217
Ref: library/zipimport examples16629384
Ref: 4ada16629384
Ref: library/zipimport zipimport-examples16629384
Ref: 4adb16629384
Node: pkgutil --- パッケージ拡張ユーティリティ16630043
Ref: library/pkgutil doc16630346
Ref: 4adc16630346
Ref: library/pkgutil module-pkgutil16630346
Ref: ae16630346
Ref: library/pkgutil pkgutil-package-extension-utility16630346
Ref: 4add16630346
Ref: library/pkgutil translation-repo16630346
Ref: 4ade16630346
Ref: library/pkgutil pkgutil ModuleInfo16630707
Ref: f4816630707
Ref: library/pkgutil pkgutil extend_path16630862
Ref: 192416630862
Ref: library/pkgutil pkgutil get_importer16632798
Ref: 4adf16632798
Ref: library/pkgutil pkgutil iter_importers16633487
Ref: 13b116633487
Ref: library/pkgutil pkgutil iter_modules16634394
Ref: f4716634394
Ref: library/pkgutil pkgutil walk_packages16635526
Ref: df916635526
Ref: library/pkgutil pkgutil get_data16637549
Ref: 4ae016637549
Ref: library/pkgutil pkgutil resolve_name16638824
Ref: 4ae216638824
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-116640680
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-216640747
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-316640789
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-416640831
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-516640873
Ref: pkgutil --- パッケージ拡張ユーティリティ-Footnote-616640915
Node: modulefinder --- スクリプト中で使用されているモジュールの検索16640980
Ref: library/modulefinder doc16641261
Ref: 4ae316641261
Ref: library/modulefinder module-modulefinder16641261
Ref: 9516641261
Ref: library/modulefinder modulefinder-find-modules-used-by-a-script16641261
Ref: 4ae416641261
Ref: library/modulefinder translation-repo16641261
Ref: 4ae516641261
Ref: library/modulefinder modulefinder AddPackagePath16641968
Ref: 4ae616641968
Ref: library/modulefinder modulefinder ReplacePackage16642145
Ref: 4ae716642145
Ref: library/modulefinder modulefinder ModuleFinder16642380
Ref: 1de516642380
Ref: library/modulefinder modulefinder ModuleFinder report16643337
Ref: 4ae916643337
Ref: library/modulefinder modulefinder ModuleFinder run_script16643694
Ref: 4ae816643694
Ref: library/modulefinder modulefinder ModuleFinder modules16643910
Ref: 4aea16643910
Ref: modulefinder --- スクリプト中で使用されているモジュールの検索-Footnote-116644167
Node: ModuleFinder の使用例16644239
Ref: library/modulefinder example-usage-of-modulefinder16644384
Ref: 4aec16644384
Ref: library/modulefinder modulefinder-example16644384
Ref: 4aeb16644384
Node: runpy --- Python モジュールの位置特定と実行16645785
Ref: library/runpy doc16646042
Ref: 4aed16646042
Ref: library/runpy module-runpy16646042
Ref: c316646042
Ref: library/runpy runpy-locating-and-executing-python-modules16646042
Ref: 4aee16646042
Ref: library/runpy translation-repo16646042
Ref: 4aef16646042
Ref: library/runpy runpy run_module16647189
Ref: 1b9716647189
Ref: library/runpy runpy run_path16650812
Ref: 4a416650812
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-116655414
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-216655479
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-316655521
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-416655563
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-516655605
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-616655647
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-716655689
Ref: runpy --- Python モジュールの位置特定と実行-Footnote-816655731
Node: importlib --- import の実装16655773
Ref: library/importlib doc16656042
Ref: 4af016656042
Ref: library/importlib importlib-the-implementation-of-import16656042
Ref: 4af116656042
Ref: library/importlib module-importlib16656042
Ref: 7b16656042
Ref: library/importlib translation-repo16656042
Ref: 4af216656042
Ref: importlib --- import の実装-Footnote-116656706
Node: はじめに<13>16656785
Ref: library/importlib introduction16656887
Ref: 4af316656887
Ref: はじめに<13>-Footnote-116659485
Ref: はじめに<13>-Footnote-216659537
Ref: はじめに<13>-Footnote-316659579
Ref: はじめに<13>-Footnote-416659621
Ref: はじめに<13>-Footnote-516659663
Ref: はじめに<13>-Footnote-616659705
Ref: はじめに<13>-Footnote-716659747
Ref: はじめに<13>-Footnote-816659789
Ref: はじめに<13>-Footnote-916659831
Ref: はじめに<13>-Footnote-1016659873
Ref: はじめに<13>-Footnote-1116659916
Ref: はじめに<13>-Footnote-1216659959
Ref: はじめに<13>-Footnote-1316660002
Node: 関数<13>16660045
Ref: library/importlib functions16660212
Ref: 4af416660212
Ref: library/importlib importlib __import__16660243
Ref: 127916660243
Ref: library/importlib importlib import_module16660601
Ref: 73c16660601
Ref: library/importlib importlib invalidate_caches16662287
Ref: e0a16662287
Ref: library/importlib importlib reload16663088
Ref: 73d16663088
Node: importlib abc -- Abstract base classes related to import16668144
Ref: library/importlib importlib-abc-abstract-base-classes-related-to-import16668342
Ref: 4af516668342
Ref: library/importlib module-importlib abc16668342
Ref: 7c16668342
Ref: library/importlib importlib abc MetaPathFinder16669149
Ref: a6e16669149
Ref: library/importlib importlib abc MetaPathFinder find_spec16669374
Ref: a6816669374
Ref: library/importlib importlib abc MetaPathFinder invalidate_caches16670125
Ref: 4af616670125
Ref: library/importlib importlib abc PathEntryFinder16670645
Ref: a6f16670645
Ref: library/importlib importlib abc PathEntryFinder find_spec16671154
Ref: a6c16671154
Ref: library/importlib importlib abc PathEntryFinder invalidate_caches16671995
Ref: 4af716671995
Ref: library/importlib importlib abc Loader16672399
Ref: 10c716672399
Ref: library/importlib importlib abc Loader create_module16672946
Ref: eac16672946
Ref: library/importlib importlib abc Loader exec_module16673548
Ref: a6a16673548
Ref: library/importlib importlib abc Loader load_module16674216
Ref: a6916674216
Ref: library/importlib importlib abc ResourceLoader16676556
Ref: de216676556
Ref: library/importlib importlib abc ResourceLoader get_data16677190
Ref: 4ae116677190
Ref: library/importlib importlib abc InspectLoader16678033
Ref: 115616678033
Ref: library/importlib importlib abc InspectLoader get_code16678260
Ref: 115716678260
Ref: library/importlib importlib abc InspectLoader get_source16679082
Ref: 115a16679082
Ref: library/importlib importlib abc InspectLoader is_package16679858
Ref: 4af916679858
Ref: library/importlib importlib abc InspectLoader source_to_code16680364
Ref: 101216680364
Ref: library/importlib importlib abc InspectLoader exec_module16681203
Ref: 121416681203
Ref: library/importlib importlib abc InspectLoader load_module16681344
Ref: 4afa16681344
Ref: library/importlib importlib abc ExecutionLoader16681609
Ref: 4afb16681609
Ref: library/importlib importlib abc ExecutionLoader get_filename16681947
Ref: 4afc16681947
Ref: library/importlib importlib abc FileLoader16682652
Ref: 127f16682652
Ref: library/importlib importlib abc FileLoader name16683206
Ref: 4afd16683206
Ref: library/importlib importlib abc FileLoader path16683301
Ref: 4afe16683301
Ref: library/importlib importlib abc FileLoader load_module16683390
Ref: 4aff16683390
Ref: library/importlib importlib abc FileLoader get_filename16683670
Ref: 4b0016683670
Ref: library/importlib importlib abc FileLoader get_data16683781
Ref: 4b0116683781
Ref: library/importlib importlib abc SourceLoader16683953
Ref: 4b0216683953
Ref: library/importlib importlib abc SourceLoader path_stats16685427
Ref: 13a116685427
Ref: library/importlib importlib abc SourceLoader path_mtime16686276
Ref: 13a216686276
Ref: library/importlib importlib abc SourceLoader set_data16686920
Ref: 4b0316686920
Ref: library/importlib importlib abc SourceLoader get_code16687528
Ref: 4b0416687528
Ref: library/importlib importlib abc SourceLoader exec_module16687646
Ref: 121516687646
Ref: library/importlib importlib abc SourceLoader load_module16687793
Ref: 4b0516687793
Ref: library/importlib importlib abc SourceLoader get_source16688064
Ref: 122216688064
Ref: library/importlib importlib abc SourceLoader is_package16688186
Ref: 4b0616688186
Ref: importlib abc -- Abstract base classes related to import-Footnote-116688773
Ref: importlib abc -- Abstract base classes related to import-Footnote-216688846
Ref: importlib abc -- Abstract base classes related to import-Footnote-316688888
Ref: importlib abc -- Abstract base classes related to import-Footnote-416688930
Ref: importlib abc -- Abstract base classes related to import-Footnote-516688972
Node: importlib machinery -- Importers and path hooks16689014
Ref: library/importlib importlib-machinery-importers-and-path-hooks16689246
Ref: 4b0716689246
Ref: library/importlib module-importlib machinery16689246
Ref: 7d16689246
Ref: library/importlib importlib machinery SOURCE_SUFFIXES16689649
Ref: 73816689649
Ref: library/importlib importlib machinery DEBUG_BYTECODE_SUFFIXES16689850
Ref: 18b016689850
Ref: library/importlib importlib machinery OPTIMIZED_BYTECODE_SUFFIXES16690157
Ref: 18b116690157
Ref: library/importlib importlib machinery BYTECODE_SUFFIXES16690459
Ref: 73a16690459
Ref: library/importlib importlib machinery EXTENSION_SUFFIXES16690816
Ref: 73916690816
Ref: library/importlib importlib machinery all_suffixes16691035
Ref: 4a1b16691035
Ref: library/importlib importlib machinery BuiltinImporter16691587
Ref: ead16691587
Ref: library/importlib importlib machinery FrozenImporter16692340
Ref: 122016692340
Ref: library/importlib importlib machinery WindowsRegistryFinder16692895
Ref: f2616692895
Ref: library/importlib importlib machinery PathFinder16693588
Ref: 122416693588
Ref: library/importlib importlib machinery PathFinder find_spec16694005
Ref: 121316694005
Ref: library/importlib importlib machinery PathFinder invalidate_caches16695553
Ref: e0916695553
Ref: library/importlib importlib machinery FileFinder16696255
Ref: 127e16696255
Ref: library/importlib importlib machinery FileFinder path16697871
Ref: 4b0816697871
Ref: library/importlib importlib machinery FileFinder find_spec16697960
Ref: 10c616697960
Ref: library/importlib importlib machinery FileFinder invalidate_caches16698158
Ref: 4b0916698158
Ref: library/importlib importlib machinery FileFinder path_hook16698266
Ref: 4b0a16698266
Ref: library/importlib importlib machinery SourceFileLoader16698752
Ref: 128016698752
Ref: library/importlib importlib machinery SourceFileLoader name16699055
Ref: 4b0b16699055
Ref: library/importlib importlib machinery SourceFileLoader path16699153
Ref: 4b0c16699153
Ref: library/importlib importlib machinery SourceFileLoader is_package16699233
Ref: 4b0d16699233
Ref: library/importlib importlib machinery SourceFileLoader path_stats16699372
Ref: 4b0e16699372
Ref: library/importlib importlib machinery SourceFileLoader set_data16699514
Ref: 4b0f16699514
Ref: library/importlib importlib machinery SourceFileLoader load_module16699658
Ref: f2416699658
Ref: library/importlib importlib machinery SourcelessFileLoader16700055
Ref: 128116700055
Ref: library/importlib importlib machinery SourcelessFileLoader name16700702
Ref: 4b1016700702
Ref: library/importlib importlib machinery SourcelessFileLoader path16700794
Ref: 4b1116700794
Ref: library/importlib importlib machinery SourcelessFileLoader is_package16700883
Ref: 4b1216700883
Ref: library/importlib importlib machinery SourcelessFileLoader get_code16701058
Ref: 4b1316701058
Ref: library/importlib importlib machinery SourcelessFileLoader get_source16701231
Ref: 4b1416701231
Ref: library/importlib importlib machinery SourcelessFileLoader load_module16701429
Ref: f2516701429
Ref: library/importlib importlib machinery ExtensionFileLoader16701802
Ref: eae16701802
Ref: library/importlib importlib machinery ExtensionFileLoader name16702510
Ref: 4b1516702510
Ref: library/importlib importlib machinery ExtensionFileLoader path16702614
Ref: 4b1616702614
Ref: library/importlib importlib machinery ExtensionFileLoader create_module16702694
Ref: 4b1716702694
Ref: library/importlib importlib machinery ExtensionFileLoader exec_module16702906
Ref: 4b1816702906
Ref: library/importlib importlib machinery ExtensionFileLoader is_package16703103
Ref: 4b1916703103
Ref: library/importlib importlib machinery ExtensionFileLoader get_code16703290
Ref: 4b1a16703290
Ref: library/importlib importlib machinery ExtensionFileLoader get_source16703453
Ref: 4b1b16703453
Ref: library/importlib importlib machinery ExtensionFileLoader get_filename16703598
Ref: 115b16703598
Ref: library/importlib importlib machinery NamespaceLoader16703727
Ref: 115816703727
Ref: library/importlib importlib machinery ModuleSpec16704394
Ref: 226c16704394
Ref: library/importlib importlib machinery ModuleSpec name16705191
Ref: 236516705191
Ref: library/importlib importlib machinery ModuleSpec loader16705399
Ref: 33c16705399
Ref: library/importlib importlib machinery ModuleSpec origin16705602
Ref: 4b1c16705602
Ref: library/importlib importlib machinery ModuleSpec submodule_search_locations16706104
Ref: 236816706104
Ref: library/importlib importlib machinery ModuleSpec loader_state16706752
Ref: 4b1d16706752
Ref: library/importlib importlib machinery ModuleSpec cached16706996
Ref: 32216706996
Ref: library/importlib importlib machinery ModuleSpec parent16707292
Ref: 32416707292
Ref: library/importlib importlib machinery ModuleSpec has_location16707583
Ref: 4b1e16707583
Ref: library/importlib importlib machinery AppleFrameworkLoader16707866
Ref: 226b16707866
Ref: library/importlib importlib machinery AppleFrameworkLoader name16711577
Ref: 4b1f16711577
Ref: library/importlib importlib machinery AppleFrameworkLoader path16711681
Ref: 4b2016711681
Ref: importlib machinery -- Importers and path hooks-Footnote-116711820
Ref: importlib machinery -- Importers and path hooks-Footnote-216711900
Ref: importlib machinery -- Importers and path hooks-Footnote-316711942
Ref: importlib machinery -- Importers and path hooks-Footnote-416711984
Ref: importlib machinery -- Importers and path hooks-Footnote-516712026
Node: importlib util -- Utility code for importers16712068
Ref: library/importlib importlib-util-utility-code-for-importers16712257
Ref: 4b2116712257
Ref: library/importlib module-importlib util16712257
Ref: 8116712257
Ref: library/importlib importlib util MAGIC_NUMBER16712620
Ref: 73716712620
Ref: library/importlib importlib util cache_from_source16712934
Ref: 35316712934
Ref: library/importlib importlib util source_from_cache16715336
Ref: 73e16715336
Ref: library/importlib importlib util decode_source16716166
Ref: 115916716166
Ref: library/importlib importlib util resolve_name16716531
Ref: b0616716531
Ref: library/importlib importlib util find_spec16717621
Ref: 5af16717621
Ref: library/importlib importlib util module_from_spec16718620
Ref: 101316718620
Ref: library/importlib importlib util spec_from_loader16719486
Ref: a6d16719486
Ref: library/importlib importlib util spec_from_file_location16719811
Ref: eaf16719811
Ref: library/importlib importlib util source_hash16720461
Ref: d3e16720461
Ref: library/importlib importlib util _incompatible_extension_module_restrictions16720733
Ref: 4b2216720733
Ref: library/importlib importlib util LazyLoader16721848
Ref: eab16721848
Ref: library/importlib importlib util LazyLoader factory16723510
Ref: 4b2316723510
Ref: importlib util -- Utility code for importers-Footnote-116724149
Ref: importlib util -- Utility code for importers-Footnote-216724223
Ref: importlib util -- Utility code for importers-Footnote-316724265
Ref: importlib util -- Utility code for importers-Footnote-416724307
Ref: importlib util -- Utility code for importers-Footnote-516724349
Ref: importlib util -- Utility code for importers-Footnote-616724391
Ref: importlib util -- Utility code for importers-Footnote-716724433
Node: 使用例<48>16724475
Ref: library/importlib examples16724608
Ref: 4b2416724608
Ref: library/importlib importlib-examples16724608
Ref: 4b2516724608
Node: プログラムからのインポート16724975
Ref: library/importlib importing-programmatically16725130
Ref: 4b2616725130
Node: モジュールがインポートできるか確認する16725431
Ref: library/importlib checking-if-a-module-can-be-imported16725649
Ref: 4b2716725649
Node: ソースファイルから直接インポートする16726637
Ref: library/importlib importing-a-source-file-directly16726841
Ref: 4b2816726841
Node: Implementing lazy imports16728035
Ref: library/importlib implementing-lazy-imports16728221
Ref: 4b2916728221
Node: インポーターのセットアップ16728940
Ref: library/importlib setting-up-an-importer16729109
Ref: 4b2a16729109
Node: Approximating importlib import_module16730707
Ref: library/importlib approximating-importlib-import-module16730842
Ref: 4b2b16730842
Node: importlib resources -- パッケージリソースの読み取り、オープン、アクセス16732342
Ref: library/importlib resources doc16732618
Ref: 4b2c16732618
Ref: library/importlib resources importlib-resources-package-resource-reading-opening-and-access16732618
Ref: 4b2d16732618
Ref: library/importlib resources module-importlib resources16732618
Ref: 7f16732618
Ref: library/importlib resources translation-repo16732618
Ref: 4b2e16732618
Ref: library/importlib resources importlib resources Anchor16734967
Ref: 4b2f16734967
Ref: library/importlib resources importlib resources files16735170
Ref: 6b616735170
Ref: library/importlib resources importlib resources as_file16736215
Ref: 6b516736215
Ref: importlib resources -- パッケージリソースの読み取り、オープン、アクセス-Footnote-116737058
Ref: importlib resources -- パッケージリソースの読み取り、オープン、アクセス-Footnote-216737147
Ref: importlib resources -- パッケージリソースの読み取り、オープン、アクセス-Footnote-316737218
Ref: importlib resources -- パッケージリソースの読み取り、オープン、アクセス-Footnote-416737312
Ref: importlib resources -- パッケージリソースの読み取り、オープン、アクセス-Footnote-516737384
Node: 関数 API16737461
Ref: library/importlib resources functional-api16737603
Ref: 4b3016737603
Ref: library/importlib resources importlib-resources-functional16737603
Ref: 4b3116737603
Ref: library/importlib resources importlib resources open_binary16738833
Ref: 4fe16738833
Ref: library/importlib resources importlib resources open_text16739325
Ref: 4ff16739325
Ref: library/importlib resources importlib resources read_binary16740277
Ref: 50116740277
Ref: library/importlib resources importlib resources read_text16740697
Ref: 50216740697
Ref: library/importlib resources importlib resources path16741574
Ref: 50016741574
Ref: library/importlib resources importlib resources is_resource16742570
Ref: 4fd16742570
Ref: library/importlib resources importlib resources contents16743047
Ref: 50316743047
Node: importlib resources abc -- リソースの抽象基底クラス16743755
Ref: library/importlib resources abc doc16744071
Ref: 4b3216744071
Ref: library/importlib resources abc importlib-resources-abc-abstract-base-classes-for-resources16744071
Ref: 4b3316744071
Ref: library/importlib resources abc module-importlib resources abc16744071
Ref: 8016744071
Ref: library/importlib resources abc translation-repo16744071
Ref: 4b3416744071
Ref: library/importlib resources abc importlib resources abc ResourceReader16744357
Ref: 4af816744357
Ref: library/importlib resources abc importlib resources abc ResourceReader open_resource16746218
Ref: 4b3516746218
Ref: library/importlib resources abc importlib resources abc ResourceReader resource_path16746513
Ref: 4b3616746513
Ref: library/importlib resources abc importlib resources abc ResourceReader is_resource16746806
Ref: 4b3716746806
Ref: library/importlib resources abc importlib resources abc ResourceReader contents16747122
Ref: 4b3816747122
Ref: library/importlib resources abc importlib resources abc Traversable16747997
Ref: 2fa16747997
Ref: library/importlib resources abc importlib resources abc Traversable name16748287
Ref: 4b3916748287
Ref: library/importlib resources abc importlib resources abc Traversable iterdir16748405
Ref: 4b3a16748405
Ref: library/importlib resources abc importlib resources abc Traversable is_dir16748501
Ref: 4b3b16748501
Ref: library/importlib resources abc importlib resources abc Traversable is_file16748603
Ref: 4b3c16748603
Ref: library/importlib resources abc importlib resources abc Traversable joinpath16748701
Ref: 4b3d16748701
Ref: library/importlib resources abc importlib resources abc Traversable __truediv__16749828
Ref: 4b3e16749828
Ref: library/importlib resources abc importlib resources abc Traversable open16749980
Ref: 4b3f16749980
Ref: library/importlib resources abc importlib resources abc Traversable read_bytes16750342
Ref: 4b4016750342
Ref: library/importlib resources abc importlib resources abc Traversable read_text16750423
Ref: 4b4116750423
Ref: library/importlib resources abc importlib resources abc TraversableResources16750515
Ref: 2f916750515
Ref: library/importlib resources abc importlib resources abc TraversableResources files16751041
Ref: 4b4216751041
Ref: importlib resources abc -- リソースの抽象基底クラス-Footnote-116751235
Node: importlib metadata -- パッケージメタデータへのアクセス16751319
Ref: library/importlib metadata doc16751588
Ref: 4b4316751588
Ref: library/importlib metadata importlib-metadata-accessing-package-metadata16751588
Ref: 4b4416751588
Ref: library/importlib metadata module-importlib metadata16751588
Ref: 7e16751588
Ref: library/importlib metadata translation-repo16751588
Ref: 4b4516751588
Ref: library/importlib metadata using16751588
Ref: 4b4616751588
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-116754240
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-216754328
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-316754412
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-416754490
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-516754575
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-616754660
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-716754698
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-816754790
Ref: importlib metadata -- パッケージメタデータへのアクセス-Footnote-916754859
Node: 概要<3>16754935
Ref: library/importlib metadata overview16755070
Ref: 4b4716755070
Ref: library/importlib metadata importlib metadata PackageNotFoundError16756714
Ref: 4b4c16756714
Ref: 概要<3>-Footnote-116757004
Node: 機能 API16757088
Ref: library/importlib metadata functional-api16757245
Ref: 4b4d16757245
Node: エントリポイント16757557
Ref: library/importlib metadata entry-points16757661
Ref: 58916757661
Ref: library/importlib metadata id216757661
Ref: 4b4e16757661
Ref: library/importlib metadata importlib metadata entry_points16757722
Ref: 4b4f16757722
Ref: library/importlib metadata importlib metadata EntryPoints16758295
Ref: 4b5016758295
Ref: library/importlib metadata importlib metadata EntryPoint16758579
Ref: 4b5116758579
Ref: エントリポイント-Footnote-116761483
Ref: エントリポイント-Footnote-216761555
Node: 配布物メタデータ16761623
Ref: library/importlib metadata distribution-metadata16761760
Ref: 4b5216761760
Ref: library/importlib metadata metadata16761760
Ref: 4b4816761760
Ref: library/importlib metadata importlib metadata metadata16761821
Ref: 4b5316761821
Ref: library/importlib metadata importlib metadata PackageMetadata16762159
Ref: 4b5416762159
Ref: 配布物メタデータ-Footnote-116763485
Ref: 配布物メタデータ-Footnote-216763590
Ref: 配布物メタデータ-Footnote-316763674
Ref: 配布物メタデータ-Footnote-416763716
Node: 配布物バージョン16763808
Ref: library/importlib metadata distribution-versions16763942
Ref: 4b5516763942
Ref: library/importlib metadata version16763942
Ref: 4b4916763942
Ref: library/importlib metadata importlib metadata version16764003
Ref: 196616764003
Ref: 配布物バージョン-Footnote-116764495
Ref: 配布物バージョン-Footnote-216764581
Node: 配布物ファイル16764665
Ref: library/importlib metadata distribution-files16764793
Ref: 4b5616764793
Ref: library/importlib metadata files16764793
Ref: 4b4a16764793
Ref: library/importlib metadata importlib metadata files16764849
Ref: 4b5716764849
Ref: library/importlib metadata importlib metadata PackagePath16765319
Ref: 4b5816765319
Ref: 配布物ファイル-Footnote-116766928
Ref: 配布物ファイル-Footnote-216767012
Node: 配布物の要件16767109
Ref: library/importlib metadata distribution-requirements16767252
Ref: 4b5916767252
Ref: library/importlib metadata requirements16767252
Ref: 4b4b16767252
Ref: library/importlib metadata importlib metadata requires16767303
Ref: 4b5a16767303
Ref: library/importlib metadata package-distributions16767800
Ref: a1116767800
Ref: 配布物の要件-Footnote-116767837
Node: Mapping import to distribution packages16767921
Ref: library/importlib metadata import-distribution-package-mapping16768034
Ref: 4b5b16768034
Ref: library/importlib metadata mapping-import-to-distribution-packages16768034
Ref: 4b5c16768034
Ref: library/importlib metadata importlib metadata packages_distributions16768133
Ref: 4b5d16768133
Ref: Mapping import to distribution packages-Footnote-116769220
Ref: Mapping import to distribution packages-Footnote-216769298
Ref: Mapping import to distribution packages-Footnote-316769382
Node: Distributions16769444
Ref: library/importlib metadata distributions16769614
Ref: a1216769614
Ref: library/importlib metadata id916769614
Ref: 4b5e16769614
Ref: library/importlib metadata importlib metadata distribution16769661
Ref: 4b5f16769661
Ref: library/importlib metadata importlib metadata Distribution16769965
Ref: 4b6016769965
Ref: Distributions-Footnote-116771590
Ref: Distributions-Footnote-216771674
Ref: Distributions-Footnote-316771716
Node: Distribution Discovery16771808
Ref: library/importlib metadata distribution-discovery16771997
Ref: 4b6116771997
Ref: Distribution Discovery-Footnote-116772855
Node: Implementing Custom Providers16772939
Ref: library/importlib metadata implementing-custom-providers16773106
Ref: 4b6216773106
Ref: Implementing Custom Providers-Footnote-116775449
Node: 使用例<49>16775533
Ref: library/importlib metadata example16775612
Ref: 4b6316775612
Node: sys path モジュール検索パスの初期化16778890
Ref: library/sys_path_init doc16779087
Ref: 4b6416779087
Ref: library/sys_path_init sys-path-init16779087
Ref: 18dc16779087
Ref: library/sys_path_init the-initialization-of-the-sys-path-module-search-path16779087
Ref: 4b6516779087
Ref: library/sys_path_init translation-repo16779087
Ref: 4b6616779087
Node: Virtual Environments16783305
Ref: library/sys_path_init sys-path-init-virtual-environments16783429
Ref: 48b316783429
Ref: library/sys_path_init virtual-environments16783429
Ref: 4b6716783429
Node: _pth files16784504
Ref: library/sys_path_init pth-files16784659
Ref: 4b6816784659
Node: 埋め込みの Python16785987
Ref: library/sys_path_init embedded-python16786113
Ref: 4b6916786113
Node: Python言語サービス16786698
Ref: library/language doc16786870
Ref: 4b6a16786870
Ref: library/language language16786870
Ref: 4b6b16786870
Ref: library/language python-language-services16786870
Ref: 4b6c16786870
Ref: library/language translation-repo16786870
Ref: 4b6d16786870
Node: ast --- Abstract syntax trees16788560
Ref: library/ast doc16788720
Ref: 4b6e16788720
Ref: library/ast ast-abstract-syntax-trees16788720
Ref: 4b6f16788720
Ref: library/ast module-ast16788720
Ref: 916788720
Ref: ast --- Abstract syntax trees-Footnote-116789913
Node: Abstract grammar16789976
Ref: library/ast abstract-grammar16790081
Ref: 4b7116790081
Ref: library/ast id116790081
Ref: 4b7216790081
Node: Node クラス16797639
Ref: library/ast node-classes16797764
Ref: 4b7316797764
Ref: library/ast ast AST16797810
Ref: 4c316797810
Ref: library/ast ast AST _fields16798779
Ref: 17d716798779
Ref: library/ast ast AST _field_types16799934
Ref: 4c416799934
Ref: library/ast ast AST lineno16800326
Ref: 4b7416800326
Ref: library/ast ast AST col_offset16800353
Ref: 4b7516800353
Ref: library/ast ast AST end_lineno16800384
Ref: 4b7616800384
Ref: library/ast ast AST end_col_offset16800415
Ref: 4b7716800415
Ref: Node クラス-Footnote-116804838
Node: Root nodes16804896
Ref: library/ast ast-root-nodes16804981
Ref: 4b7816804981
Ref: library/ast root-nodes16804981
Ref: 4b7916804981
Ref: library/ast ast Module16805022
Ref: 4b7a16805022
Ref: library/ast ast Expression16805706
Ref: 4b7c16805706
Ref: library/ast ast Interactive16806088
Ref: 187916806088
Ref: library/ast ast FunctionType16806817
Ref: 4b7e16806817
Ref: Root nodes-Footnote-116807865
Node: リテラル<3>16807907
Ref: library/ast literals16808007
Ref: 4b7f16808007
Ref: library/ast ast Constant16808048
Ref: 2ef16808048
Ref: library/ast ast FormattedValue16808576
Ref: 4a9616808576
Ref: library/ast ast JoinedStr16809721
Ref: 1a5c16809721
Ref: library/ast ast TemplateStr16810720
Ref: 4b8016810720
Ref: library/ast ast Interpolation16811775
Ref: 17b516811775
Ref: library/ast ast List16813224
Ref: 4a9316813224
Ref: library/ast ast Tuple16813260
Ref: 4a9416813260
Ref: library/ast ast Set16814284
Ref: 4a8316814284
Ref: library/ast ast Dict16814729
Ref: 1d4916814729
Node: 変数16815645
Ref: library/ast variables16815752
Ref: 4b8216815752
Ref: library/ast ast Name16815783
Ref: 1d2216815783
Ref: library/ast ast Load16815969
Ref: 4c216815969
Ref: library/ast ast Store16815993
Ref: 4b8116815993
Ref: library/ast ast Del16816018
Ref: 4b8316816018
Ref: library/ast ast Starred16816981
Ref: 4a9216816981
Node: 式 expression<2>16817873
Ref: library/ast ast-expressions16817979
Ref: 4b7d16817979
Ref: library/ast expressions16817979
Ref: 4b8416817979
Ref: library/ast ast Expr16818031
Ref: 4b8516818031
Ref: library/ast ast UnaryOp16818806
Ref: 4a7e16818806
Ref: library/ast ast UAdd16818985
Ref: 4a8016818985
Ref: library/ast ast USub16819009
Ref: 4a8116819009
Ref: library/ast ast Not16819033
Ref: 4a8216819033
Ref: library/ast ast Invert16819056
Ref: 4a7f16819056
Ref: library/ast ast BinOp16819492
Ref: 1db216819492
Ref: library/ast ast Add16819962
Ref: 4b8616819962
Ref: library/ast ast Sub16819985
Ref: 4b8716819985
Ref: library/ast ast Mult16820008
Ref: 4b8816820008
Ref: library/ast ast Div16820032
Ref: 4b8916820032
Ref: library/ast ast FloorDiv16820055
Ref: 4b8a16820055
Ref: library/ast ast Mod16820083
Ref: 4b8b16820083
Ref: library/ast ast Pow16820106
Ref: 4b8c16820106
Ref: library/ast ast LShift16820129
Ref: 4b8d16820129
Ref: library/ast ast RShift16820155
Ref: 4b8e16820155
Ref: library/ast ast BitOr16820181
Ref: 4b8f16820181
Ref: library/ast ast BitXor16820206
Ref: 4b9016820206
Ref: library/ast ast BitAnd16820232
Ref: 4b9116820232
Ref: library/ast ast MatMult16820258
Ref: 4b9216820258
Ref: library/ast ast BoolOp16820341
Ref: 4a9716820341
Ref: library/ast ast And16821116
Ref: 4b9416821116
Ref: library/ast ast Or16821139
Ref: 4b9316821139
Ref: library/ast ast Compare16821217
Ref: 4a8416821217
Ref: library/ast ast Eq16821850
Ref: 4a8516821850
Ref: library/ast ast NotEq16821872
Ref: 4a8616821872
Ref: library/ast ast Lt16821897
Ref: 4a8716821897
Ref: library/ast ast LtE16821919
Ref: 4a8816821919
Ref: library/ast ast Gt16821942
Ref: 4a8916821942
Ref: library/ast ast GtE16821964
Ref: 4a8a16821964
Ref: library/ast ast Is16821987
Ref: 4a8b16821987
Ref: library/ast ast IsNot16822009
Ref: 4a8c16822009
Ref: library/ast ast In16822034
Ref: 4a8d16822034
Ref: library/ast ast NotIn16822056
Ref: 4a8e16822056
Ref: library/ast ast Call16822137
Ref: 4a8f16822137
Ref: library/ast ast keyword16823325
Ref: 4b9516823325
Ref: library/ast ast IfExp16823600
Ref: 4a9816823600
Ref: library/ast ast Attribute16824153
Ref: 4a9016824153
Ref: library/ast ast NamedExpr16824841
Ref: 4a9e16824841
Node: 配列要素の参照 Subscripting16825730
Ref: library/ast subscripting16825853
Ref: 4b9716825853
Ref: library/ast ast Subscript16825939
Ref: 4a9116825939
Ref: library/ast ast Slice16827021
Ref: 4a9516827021
Node: 内包表記 Comprehension16827706
Ref: library/ast comprehensions16827829
Ref: 4b9816827829
Ref: library/ast ast ListComp16827902
Ref: 4a9a16827902
Ref: library/ast ast SetComp16827948
Ref: 4a9b16827948
Ref: library/ast ast GeneratorExp16827993
Ref: 4a9d16827993
Ref: library/ast ast DictComp16828043
Ref: 4a9c16828043
Ref: library/ast ast comprehension16830015
Ref: 4b9916830015
Node: 文 Statements16833194
Ref: library/ast ast-statements16833309
Ref: 4b7b16833309
Ref: library/ast statements16833309
Ref: 4b9a16833309
Ref: library/ast ast Assign16833361
Ref: 4b9616833361
Ref: library/ast ast Assign type_comment16833792
Ref: 4b9b16833792
Ref: library/ast ast AnnAssign16834770
Ref: 4b9c16834770
Ref: library/ast ast AugAssign16837037
Ref: 4b9d16837037
Ref: library/ast ast Raise16837858
Ref: 4b9e16837858
Ref: library/ast ast Assert16838484
Ref: 4b9f16838484
Ref: library/ast ast Delete16838960
Ref: 4ba016838960
Ref: library/ast ast Pass16839486
Ref: 4ba116839486
Ref: library/ast ast TypeAlias16839682
Ref: 1a5516839682
Node: インポート16840411
Ref: library/ast imports16840477
Ref: 4ba316840477
Ref: library/ast ast Import16840525
Ref: 4ba416840525
Ref: library/ast ast ImportFrom16840961
Ref: 4ba516840961
Ref: library/ast ast alias16841815
Ref: 1c7416841815
Node: 制御フロー16842388
Ref: library/ast control-flow16842502
Ref: 4ba616842502
Ref: library/ast ast If16842693
Ref: 4ba716842693
Ref: library/ast ast For16844038
Ref: 4ba816844038
Ref: library/ast ast For type_comment16844580
Ref: 4ba916844580
Ref: library/ast ast While16845342
Ref: 4baa16845342
Ref: library/ast ast Break16846063
Ref: 4bab16846063
Ref: library/ast ast Continue16846088
Ref: 4bac16846088
Ref: library/ast ast Try16847105
Ref: 4bad16847105
Ref: library/ast ast TryStar16848743
Ref: 4baf16848743
Ref: library/ast ast ExceptHandler16849753
Ref: 4bae16849753
Ref: library/ast ast With16851081
Ref: 4bb016851081
Ref: library/ast ast With type_comment16851410
Ref: 4bb216851410
Ref: library/ast ast withitem16851582
Ref: 4bb116851582
Node: Pattern matching16853075
Ref: library/ast pattern-matching16853191
Ref: 4bb316853191
Ref: library/ast ast Match16853246
Ref: 4bb416853246
Ref: library/ast ast match_case16853559
Ref: 4bb516853559
Ref: library/ast ast MatchValue16855526
Ref: 4bb616855526
Ref: library/ast ast MatchSingleton16856500
Ref: 4bb716856500
Ref: library/ast ast MatchSequence16857360
Ref: 4bb816857360
Ref: library/ast ast MatchStar16858555
Ref: 4bb916858555
Ref: library/ast ast MatchMapping16860168
Ref: 4bba16860168
Ref: library/ast ast MatchClass16862138
Ref: 4bbb16862138
Ref: library/ast ast MatchAs16865077
Ref: 4bbc16865077
Ref: library/ast ast MatchOr16866695
Ref: 4bbd16866695
Node: Type annotations16867942
Ref: library/ast type-annotations16868058
Ref: 4bbe16868058
Ref: library/ast ast TypeIgnore16868113
Ref: 1b0e16868113
Node: Type parameters16869365
Ref: library/ast ast-type-params16869495
Ref: 4ba216869495
Ref: library/ast type-parameters16869495
Ref: 4bbf16869495
Ref: library/ast ast TypeVar16869628
Ref: 4bc016869628
Ref: library/ast ast ParamSpec16870830
Ref: 4bc116870830
Ref: library/ast ast TypeVarTuple16872215
Ref: 4bc216872215
Node: 関数およびクラス定義16873432
Ref: library/ast function-and-class-definitions16873561
Ref: 4bc316873561
Ref: library/ast ast FunctionDef16873634
Ref: 1a7816873634
Ref: library/ast ast FunctionDef type_comment16874434
Ref: 4bc516874434
Ref: library/ast ast Lambda16874669
Ref: 4a9916874669
Ref: library/ast ast arguments16875320
Ref: 4bc416875320
Ref: library/ast ast arg16876247
Ref: 4bc616876247
Ref: library/ast ast arg type_comment16876467
Ref: 4bc716876467
Ref: library/ast ast Return16878073
Ref: 4bc816878073
Ref: library/ast ast Yield16878318
Ref: 4aa016878318
Ref: library/ast ast YieldFrom16878351
Ref: 4aa116878351
Ref: library/ast ast Global16879022
Ref: 4bc916879022
Ref: library/ast ast Nonlocal16879056
Ref: 4bca16879056
Ref: library/ast ast ClassDef16879730
Ref: 1a7616879730
Ref: 関数およびクラス定義-Footnote-116881550
Node: async と await16881592
Ref: library/ast async-and-await16881697
Ref: 4bcb16881697
Ref: library/ast ast AsyncFunctionDef16881749
Ref: 1a7716881749
Ref: library/ast ast Await16882077
Ref: 4a9f16882077
Ref: library/ast ast AsyncFor16882736
Ref: 4bcc16882736
Ref: library/ast ast AsyncWith16882807
Ref: 4bcd16882807
Node: ast helpers16883527
Ref: library/ast ast-helpers16883653
Ref: 4bce16883653
Ref: library/ast ast parse16883839
Ref: 1c216883839
Ref: library/ast ast unparse16887130
Ref: ae216887130
Ref: library/ast ast literal_eval16887874
Ref: e1216887874
Ref: library/ast ast get_docstring16889975
Ref: 1e3b16889975
Ref: library/ast ast get_source_segment16890624
Ref: bcb16890624
Ref: library/ast ast fix_missing_locations16891141
Ref: 4bd016891141
Ref: library/ast ast increment_lineno16891617
Ref: 1b0d16891617
Ref: library/ast ast copy_location16891890
Ref: 4bd116891890
Ref: library/ast ast iter_fields16892150
Ref: 4bd216892150
Ref: library/ast ast iter_child_nodes16892347
Ref: 4bd316892347
Ref: library/ast ast walk16892655
Ref: 4bd416892655
Ref: library/ast ast NodeVisitor16892954
Ref: 2f016892954
Ref: library/ast ast NodeVisitor visit16893397
Ref: 4bd516893397
Ref: library/ast ast NodeVisitor generic_visit16893750
Ref: 4bd616893750
Ref: library/ast ast NodeVisitor visit_Constant16894233
Ref: c6316894233
Ref: library/ast ast NodeTransformer16894897
Ref: 4bd716894897
Ref: library/ast ast dump16897027
Ref: ae116897027
Ref: ast helpers-Footnote-116899735
Ref: ast helpers-Footnote-216899777
Ref: ast helpers-Footnote-316899819
Node: Compiler flags<2>16899861
Ref: library/ast ast-compiler-flags16900009
Ref: 25c716900009
Ref: library/ast compiler-flags16900009
Ref: 4bd816900009
Ref: library/ast ast PyCF_ALLOW_TOP_LEVEL_AWAIT16900212
Ref: 4bd916900212
Ref: library/ast ast PyCF_ONLY_AST16900436
Ref: 4b7016900436
Ref: library/ast ast PyCF_OPTIMIZED_AST16900594
Ref: 4bda16900594
Ref: library/ast ast PyCF_TYPE_COMMENTS16900792
Ref: 4bcf16900792
Ref: library/ast ast compare16901020
Ref: 1bf16901020
Ref: Compiler flags<2>-Footnote-116901590
Ref: Compiler flags<2>-Footnote-216901632
Node: コマンドラインでの使用<8>16901674
Ref: library/ast ast-cli16901802
Ref: 4bdb16901802
Ref: library/ast command-line-usage16901802
Ref: 4bdc16901802
Ref: library/ast cmdoption-ast-h16902091
Ref: 4bdd16902091
Ref: library/ast cmdoption-ast-help16902091
Ref: 4bde16902091
Ref: library/ast cmdoption-ast-m16902179
Ref: 4bdf16902179
Ref: library/ast cmdoption-ast-mode16902201
Ref: 4be016902201
Ref: library/ast cmdoption-ast-no-type-comments16902356
Ref: 4be116902356
Ref: library/ast cmdoption-ast-a16902437
Ref: 4be216902437
Ref: library/ast cmdoption-ast-include-attributes16902437
Ref: 4be316902437
Ref: library/ast cmdoption-ast-i16902545
Ref: 4be416902545
Ref: library/ast cmdoption-ast-indent16902569
Ref: 4be516902569
Ref: library/ast cmdoption-ast-feature-version16902675
Ref: 1c316902675
Ref: library/ast cmdoption-ast-O16902863
Ref: 4be616902863
Ref: library/ast cmdoption-ast-optimize16902886
Ref: 1c416902886
Ref: library/ast cmdoption-ast-show-empty16903014
Ref: 1c516903014
Ref: コマンドラインでの使用<8>-Footnote-116904345
Ref: コマンドラインでの使用<8>-Footnote-216904393
Ref: コマンドラインでの使用<8>-Footnote-316904460
Ref: コマンドラインでの使用<8>-Footnote-416904534
Ref: コマンドラインでの使用<8>-Footnote-516904573
Node: symtable --- コンパイラーの記号表へのアクセス16904610
Ref: library/symtable doc16904826
Ref: 4be716904826
Ref: library/symtable module-symtable16904826
Ref: de16904826
Ref: library/symtable symtable-access-to-the-compiler-s-symbol-tables16904826
Ref: 4be816904826
Ref: library/symtable translation-repo16904826
Ref: 4be916904826
Ref: symtable --- コンパイラーの記号表へのアクセス-Footnote-116905482
Node: 記号表の生成16905550
Ref: library/symtable generating-symbol-tables16905693
Ref: 4bea16905693
Ref: library/symtable symtable symtable16905744
Ref: 1dd116905744
Node: 記号表の検査16906092
Ref: library/symtable examining-symbol-tables16906283
Ref: 4bec16906283
Ref: library/symtable symtable SymbolTableType16906334
Ref: 195216906334
Ref: library/symtable symtable SymbolTableType MODULE16906459
Ref: 4bed16906459
Ref: library/symtable symtable SymbolTableType FUNCTION16906548
Ref: 4bee16906548
Ref: library/symtable symtable SymbolTableType CLASS16906643
Ref: 4bef16906643
Ref: library/symtable symtable SymbolTableType ANNOTATION16906822
Ref: 4bf016906822
Ref: library/symtable symtable SymbolTableType TYPE_ALIAS16906966
Ref: 4bf116906966
Ref: library/symtable symtable SymbolTableType TYPE_PARAMETERS16907085
Ref: 4bf216907085
Ref: library/symtable symtable SymbolTableType TYPE_VARIABLE16907254
Ref: 4bf316907254
Ref: library/symtable symtable SymbolTable16907623
Ref: 4beb16907623
Ref: library/symtable symtable SymbolTable get_type16907787
Ref: 195316907787
Ref: library/symtable symtable SymbolTable get_id16908473
Ref: 4bf416908473
Ref: library/symtable symtable SymbolTable get_name16908558
Ref: 4bf516908558
Ref: library/symtable symtable SymbolTable get_lineno16909208
Ref: 4bf616909208
Ref: library/symtable symtable SymbolTable is_optimized16909342
Ref: 4bf716909342
Ref: library/symtable symtable SymbolTable is_nested16909513
Ref: 4bf816909513
Ref: library/symtable symtable SymbolTable has_children16909652
Ref: 4bf916909652
Ref: library/symtable symtable SymbolTable get_identifiers16909899
Ref: 4bfb16909899
Ref: library/symtable symtable SymbolTable lookup16910082
Ref: 4bfc16910082
Ref: library/symtable symtable SymbolTable get_symbols16910255
Ref: 4bfd16910255
Ref: library/symtable symtable SymbolTable get_children16910415
Ref: 4bfa16910415
Ref: library/symtable symtable Function16910527
Ref: 4bfe16910527
Ref: library/symtable symtable Function get_parameters16910661
Ref: 4bff16910661
Ref: library/symtable symtable Function get_locals16910778
Ref: 4c0016910778
Ref: library/symtable symtable Function get_globals16910909
Ref: 4c0116910909
Ref: library/symtable symtable Function get_nonlocals16911044
Ref: 4c0216911044
Ref: library/symtable symtable Function get_frees16911189
Ref: 4c0316911189
Ref: library/symtable symtable Class16911338
Ref: 4c0416911338
Ref: library/symtable symtable Class get_methods16911455
Ref: 31d16911455
Ref: library/symtable symtable Symbol16912776
Ref: 28916912776
Ref: library/symtable symtable Symbol get_name16912981
Ref: 4c0516912981
Ref: library/symtable symtable Symbol is_referenced16913062
Ref: 4c0616913062
Ref: library/symtable symtable Symbol is_imported16913202
Ref: 4c0716913202
Ref: library/symtable symtable Symbol is_parameter16913333
Ref: 4c0816913333
Ref: library/symtable symtable Symbol is_type_parameter16913448
Ref: 195416913448
Ref: library/symtable symtable Symbol is_global16913591
Ref: 4c0916913591
Ref: library/symtable symtable Symbol is_nonlocal16913703
Ref: 1e0d16913703
Ref: library/symtable symtable Symbol is_declared_global16913817
Ref: 153d16913817
Ref: library/symtable symtable Symbol is_local16914001
Ref: 4c0a16914001
Ref: library/symtable symtable Symbol is_annotated16914139
Ref: 4c0b16914139
Ref: library/symtable symtable Symbol is_free16914284
Ref: 4c0c16914284
Ref: library/symtable symtable Symbol is_free_class16914474
Ref: 28c16914474
Ref: library/symtable symtable Symbol is_assigned16915151
Ref: 4c0d16915151
Ref: library/symtable symtable Symbol is_comp_iter16915309
Ref: 28b16915309
Ref: library/symtable symtable Symbol is_comp_cell16915475
Ref: 28a16915475
Ref: library/symtable symtable Symbol is_namespace16915641
Ref: 4c0e16915641
Ref: library/symtable symtable Symbol get_namespaces16916481
Ref: 4c0f16916481
Ref: library/symtable symtable Symbol get_namespace16916607
Ref: 4c1016916607
Node: コマンドラインからの使用<3>16916871
Ref: library/symtable command-line-usage16917035
Ref: 4c1116917035
Ref: library/symtable symtable-cli16917035
Ref: 4c1216917035
Node: token --- Python 解析木で使われる定数16917408
Ref: library/token doc16917641
Ref: 4c1316917641
Ref: library/token module-token16917641
Ref: 10016917641
Ref: library/token token-constants-used-with-python-parse-trees16917641
Ref: 4c1416917641
Ref: library/token translation-repo16917641
Ref: 4c1516917641
Ref: library/token token tok_name16918700
Ref: 4c1816918700
Ref: library/token token ISTERMINAL16918933
Ref: 4c1916918933
Ref: library/token token ISNONTERMINAL16919043
Ref: 4c1a16919043
Ref: library/token token ISEOF16919159
Ref: 4c1b16919159
Ref: library/token token NAME16919310
Ref: 22b916919310
Ref: library/token token NUMBER16919408
Ref: 22ba16919408
Ref: library/token token STRING16919501
Ref: 22bb16919501
Ref: library/token token OP16919851
Ref: 228a16919851
Ref: library/token token COMMENT16920154
Ref: 4c1c16920154
Ref: library/token token NEWLINE16920277
Ref: 229416920277
Ref: library/token token NL16920379
Ref: 4c1d16920379
Ref: library/token token INDENT16920615
Ref: 20fd16920615
Ref: library/token token DEDENT16920776
Ref: 22b216920776
Ref: library/token token FSTRING_START16920935
Ref: 22f116920935
Ref: library/token token FSTRING_MIDDLE16921202
Ref: 22f216921202
Ref: library/token token FSTRING_END16921628
Ref: 22f316921628
Ref: library/token token TSTRING_START16921817
Ref: 4c2216921817
Ref: library/token token TSTRING_MIDDLE16922108
Ref: 4c2316922108
Ref: library/token token TSTRING_END16922557
Ref: 4c2416922557
Ref: library/token token ENDMARKER16922779
Ref: 22b616922779
Ref: library/token token ENCODING16922913
Ref: 4c2516922913
Ref: library/token token TYPE_IGNORE16923455
Ref: 4c2616923455
Ref: library/token token TYPE_COMMENT16923708
Ref: 4c2716923708
Ref: library/token token SOFT_KEYWORD16923943
Ref: 4c1716923943
Ref: library/token token ERRORTOKEN16924201
Ref: 4c2916924201
Ref: library/token token-operators-delimiters16924537
Ref: 231e16924537
Ref: library/token token LPAR16925081
Ref: 4c2a16925081
Ref: library/token token RPAR16925261
Ref: 4c2b16925261
Ref: library/token token LSQB16925441
Ref: 4c2c16925441
Ref: library/token token RSQB16925621
Ref: 4c2d16925621
Ref: library/token token COLON16925802
Ref: 4c2116925802
Ref: library/token token COMMA16925982
Ref: 4c2e16925982
Ref: library/token token SEMI16926161
Ref: 4c2f16926161
Ref: library/token token PLUS16926341
Ref: 4c1616926341
Ref: library/token token MINUS16926522
Ref: 4c3016926522
Ref: library/token token STAR16926701
Ref: 4c3116926701
Ref: library/token token SLASH16926882
Ref: 4c3216926882
Ref: library/token token VBAR16927061
Ref: 4c3316927061
Ref: library/token token AMPER16927242
Ref: 4c3416927242
Ref: library/token token LESS16927421
Ref: 4c3516927421
Ref: library/token token GREATER16927604
Ref: 4c3616927604
Ref: library/token token EQUAL16927782
Ref: 4c3716927782
Ref: library/token token DOT16927960
Ref: 4c3816927960
Ref: library/token token PERCENT16928144
Ref: 4c3916928144
Ref: library/token token LBRACE16928323
Ref: 4c1e16928323
Ref: library/token token RBRACE16928503
Ref: 4c1f16928503
Ref: library/token token EQEQUAL16928684
Ref: 4c3a16928684
Ref: library/token token NOTEQUAL16928866
Ref: 4c3b16928866
Ref: library/token token LESSEQUAL16929048
Ref: 4c3c16929048
Ref: library/token token GREATEREQUAL16929232
Ref: 4c3d16929232
Ref: library/token token TILDE16929406
Ref: 4c3e16929406
Ref: library/token token CIRCUMFLEX16929591
Ref: 4c3f16929591
Ref: library/token token LEFTSHIFT16929770
Ref: 4c4016929770
Ref: library/token token RIGHTSHIFT16929952
Ref: 4c4116929952
Ref: library/token token DOUBLESTAR16930133
Ref: 4c4216930133
Ref: library/token token PLUSEQUAL16930313
Ref: 4c4316930313
Ref: library/token token MINEQUAL16930493
Ref: 4c4416930493
Ref: library/token token STAREQUAL16930675
Ref: 4c4516930675
Ref: library/token token SLASHEQUAL16930857
Ref: 4c4616930857
Ref: library/token token PERCENTEQUAL16931040
Ref: 4c4716931040
Ref: library/token token AMPEREQUAL16931219
Ref: 4c4816931219
Ref: library/token token VBAREQUAL16931399
Ref: 4c4916931399
Ref: library/token token CIRCUMFLEXEQUAL16931586
Ref: 4c4a16931586
Ref: library/token token LEFTSHIFTEQUAL16931766
Ref: 4c4b16931766
Ref: library/token token RIGHTSHIFTEQUAL16931949
Ref: 4c4c16931949
Ref: library/token token DOUBLESTAREQUAL16932131
Ref: 4c4d16932131
Ref: library/token token DOUBLESLASH16932309
Ref: 4c4e16932309
Ref: library/token token DOUBLESLASHEQUAL16932495
Ref: 4c4f16932495
Ref: library/token token AT16932663
Ref: 4c5016932663
Ref: library/token token ATEQUAL16932848
Ref: 4c5116932848
Ref: library/token token RARROW16933028
Ref: 4c5216933028
Ref: library/token token ELLIPSIS16933211
Ref: 4c5316933211
Ref: library/token token COLONEQUAL16933395
Ref: 4c5416933395
Ref: library/token token EXCLAMATION16933577
Ref: 4c2016933577
Ref: library/token token N_TOKENS16933719
Ref: 4c5516933719
Ref: library/token token EXACT_TOKEN_TYPES16933806
Ref: 18e716933806
Ref: token --- Python 解析木で使われる定数-Footnote-116934793
Node: keyword --- Python キーワードのテスト16934858
Ref: library/keyword doc16935086
Ref: 4c5616935086
Ref: library/keyword keyword-testing-for-python-keywords16935086
Ref: 4c5716935086
Ref: library/keyword module-keyword16935086
Ref: 8816935086
Ref: library/keyword translation-repo16935086
Ref: 4c5816935086
Ref: library/keyword keyword iskeyword16935498
Ref: 265416935498
Ref: library/keyword keyword kwlist16935639
Ref: 4c5916935639
Ref: library/keyword keyword issoftkeyword16935921
Ref: 4c2816935921
Ref: library/keyword keyword softkwlist16936102
Ref: 4c5a16936102
Ref: keyword --- Python キーワードのテスト-Footnote-116936469
Node: tokenize --- Python ソース用のトークナイザー16936536
Ref: library/tokenize doc16936769
Ref: 4c5b16936769
Ref: library/tokenize module-tokenize16936769
Ref: 10116936769
Ref: library/tokenize tokenize-tokenizer-for-python-source16936769
Ref: 4c5c16936769
Ref: library/tokenize translation-repo16936769
Ref: 4c5d16936769
Ref: tokenize --- Python ソース用のトークナイザー-Footnote-116938210
Node: 入力のトークナイズ16938278
Ref: library/tokenize tokenizing-input16938446
Ref: 4c5e16938446
Ref: library/tokenize tokenize tokenize16938590
Ref: 70016938590
Ref: library/tokenize tokenize generate_tokens16940382
Ref: 70116940382
Ref: library/tokenize tokenize untokenize16941261
Ref: 18b316941261
Ref: library/tokenize tokenize detect_encoding16942355
Ref: 17b816942355
Ref: library/tokenize tokenize open16943619
Ref: 2cdf16943619
Ref: library/tokenize tokenize TokenError16943858
Ref: 76416943858
Ref: 入力のトークナイズ-Footnote-116944201
Ref: 入力のトークナイズ-Footnote-216944243
Node: コマンドラインからの使用<4>16944285
Ref: library/tokenize command-line-usage16944475
Ref: 4c5f16944475
Ref: library/tokenize tokenize-cli16944475
Ref: 4c6016944475
Ref: library/tokenize cmdoption-tokenize-h16944769
Ref: 4c6116944769
Ref: library/tokenize cmdoption-tokenize-help16944769
Ref: 4c6216944769
Ref: library/tokenize cmdoption-tokenize-e16944860
Ref: 4c6316944860
Ref: library/tokenize cmdoption-tokenize-exact16944860
Ref: 4c6416944860
Node: 使用例<50>16945143
Ref: library/tokenize examples16945297
Ref: 4c6516945297
Node: tabnanny --- あいまいなインデントの検出16949859
Ref: library/tabnanny doc16950106
Ref: 4c6616950106
Ref: library/tabnanny module-tabnanny16950106
Ref: e316950106
Ref: library/tabnanny tabnanny-detection-of-ambiguous-indentation16950106
Ref: 4c6716950106
Ref: library/tabnanny translation-repo16950106
Ref: 4c6816950106
Ref: library/tabnanny tabnanny check16950764
Ref: 4c6916950764
Ref: library/tabnanny tabnanny verbose16951347
Ref: 4c6a16951347
Ref: library/tabnanny tabnanny filename_only16951579
Ref: 4c6b16951579
Ref: library/tabnanny tabnanny NannyNag16951874
Ref: 4c6c16951874
Ref: library/tabnanny tabnanny process_tokens16952103
Ref: 4c6d16952103
Ref: tabnanny --- あいまいなインデントの検出-Footnote-116952465
Node: pyclbr --- Python モジュールブラウザーサポート16952533
Ref: library/pyclbr doc16952791
Ref: 4c6e16952791
Ref: library/pyclbr module-pyclbr16952791
Ref: b916952791
Ref: library/pyclbr pyclbr-python-module-browser-support16952791
Ref: 4c6f16952791
Ref: library/pyclbr translation-repo16952791
Ref: 4c7016952791
Ref: library/pyclbr pyclbr readmodule16953518
Ref: a2c16953518
Ref: library/pyclbr pyclbr readmodule_ex16954130
Ref: a2d16954130
Ref: pyclbr --- Python モジュールブラウザーサポート-Footnote-116955248
Node: Function オブジェクト16955314
Ref: library/pyclbr function-objects16955477
Ref: 4c7116955477
Ref: library/pyclbr pyclbr-function-objects16955477
Ref: 4c7216955477
Ref: library/pyclbr pyclbr Function16955546
Ref: 4c7316955546
Ref: library/pyclbr pyclbr Function file16955703
Ref: 4c7416955703
Ref: library/pyclbr pyclbr Function module16955791
Ref: 4c7516955791
Ref: library/pyclbr pyclbr Function name16955886
Ref: 4c7616955886
Ref: library/pyclbr pyclbr Function lineno16955948
Ref: 4c7716955948
Ref: library/pyclbr pyclbr Function parent16956044
Ref: 4c7816956044
Ref: library/pyclbr pyclbr Function children16956198
Ref: 4c7916956198
Ref: library/pyclbr pyclbr Function is_async16956370
Ref: 4c7a16956370
Node: クラスオブジェクト<2>16956555
Ref: library/pyclbr class-objects16956718
Ref: 4c7b16956718
Ref: library/pyclbr pyclbr-class-objects16956718
Ref: 4c7c16956718
Ref: library/pyclbr pyclbr Class16956784
Ref: 4c7d16956784
Ref: library/pyclbr pyclbr Class file16956974
Ref: 4c7e16956974
Ref: library/pyclbr pyclbr Class module16957059
Ref: 4c7f16957059
Ref: library/pyclbr pyclbr Class name16957151
Ref: 4c8016957151
Ref: library/pyclbr pyclbr Class lineno16957216
Ref: 4c8116957216
Ref: library/pyclbr pyclbr Class parent16957312
Ref: 4c8216957312
Ref: library/pyclbr pyclbr Class children16957462
Ref: 4c8316957462
Ref: library/pyclbr pyclbr Class super16957622
Ref: 4c8416957622
Ref: library/pyclbr pyclbr Class methods16957983
Ref: 4c8516957983
Node: py_compile --- Python ソースファイルをコンパイルする16958211
Ref: library/py_compile doc16958487
Ref: 4c8616958487
Ref: library/py_compile module-py_compile16958487
Ref: b816958487
Ref: library/py_compile py-compile-compile-python-source-files16958487
Ref: 4c8716958487
Ref: library/py_compile translation-repo16958487
Ref: 4c8816958487
Ref: library/py_compile py_compile PyCompileError16959264
Ref: 4c8916959264
Ref: library/py_compile py_compile compile16959397
Ref: c1a16959397
Ref: library/py_compile py_compile PycInvalidationMode16963772
Ref: 4c8a16963772
Ref: library/py_compile py_compile PycInvalidationMode TIMESTAMP16964226
Ref: 4c8c16964226
Ref: library/py_compile py_compile PycInvalidationMode CHECKED_HASH16964508
Ref: 4c8b16964508
Ref: library/py_compile py_compile PycInvalidationMode UNCHECKED_HASH16964754
Ref: 4c8d16964754
Ref: py_compile --- Python ソースファイルをコンパイルする-Footnote-116965348
Ref: py_compile --- Python ソースファイルをコンパイルする-Footnote-216965418
Ref: py_compile --- Python ソースファイルをコンパイルする-Footnote-316965460
Ref: py_compile --- Python ソースファイルをコンパイルする-Footnote-416965502
Ref: py_compile --- Python ソースファイルをコンパイルする-Footnote-516965544
Node: コマンドラインインターフェイス<5>16965586
Ref: library/py_compile command-line-interface16965738
Ref: 4c8e16965738
Ref: library/py_compile py-compile-cli16965738
Ref: 4c8f16965738
Ref: library/py_compile cmdoption-python-m-py_compile-arg-file16966198
Ref: 4c9016966198
Ref: library/py_compile cmdoption-python-m-py_compile16966229
Ref: 4c9116966229
Ref: library/py_compile cmdoption-python-m-py_compile-q16966381
Ref: 4c9216966381
Ref: library/py_compile cmdoption-python-m-py_compile-quiet16966381
Ref: 4c9316966381
Node: compileall --- Python ライブラリをバイトコンパイルする16966786
Ref: library/compileall doc16967059
Ref: 4c9416967059
Ref: library/compileall compileall-byte-compile-python-libraries16967059
Ref: 4c9516967059
Ref: library/compileall module-compileall16967059
Ref: 2116967059
Ref: library/compileall translation-repo16967059
Ref: 4c9616967059
Ref: compileall --- Python ライブラリをバイトコンパイルする-Footnote-116968233
Node: コマンドラインでの使用<9>16968303
Ref: library/compileall command-line-use16968479
Ref: 4c9716968479
Ref: library/compileall compileall-cli16968479
Ref: 4c9816968479
Ref: library/compileall cmdoption-compileall-arg-directory16968710
Ref: 4c9916968710
Ref: library/compileall cmdoption-compileall-arg-file16968736
Ref: 4c9a16968736
Ref: library/compileall cmdoption-compileall-l16969057
Ref: 4c9b16969057
Ref: library/compileall cmdoption-compileall-f16969269
Ref: 4c9c16969269
Ref: library/compileall cmdoption-compileall-q16969370
Ref: 4c9d16969370
Ref: library/compileall cmdoption-compileall-d16969624
Ref: 4c9e16969624
Ref: library/compileall cmdoption-compileall-s16970099
Ref: 4c9f16970099
Ref: library/compileall cmdoption-compileall-p16970314
Ref: 4ca016970314
Ref: library/compileall cmdoption-compileall-x16970534
Ref: 4ca116970534
Ref: library/compileall cmdoption-compileall-i16970728
Ref: 4ca216970728
Ref: library/compileall cmdoption-compileall-b16971013
Ref: 4ca316971013
Ref: library/compileall cmdoption-compileall-r16971413
Ref: 4ca416971413
Ref: library/compileall cmdoption-compileall-j16971725
Ref: 4ca516971725
Ref: library/compileall cmdoption-compileall-invalidation-mode16971912
Ref: 4ca616971912
Ref: library/compileall cmdoption-compileall-o16973004
Ref: 4ca716973004
Ref: library/compileall cmdoption-compileall-e16973197
Ref: 4ca816973197
Ref: library/compileall cmdoption-compileall-hardlink-dupes16973277
Ref: 4ca916973277
Ref: コマンドラインでの使用<9>-Footnote-116974763
Node: パブリックな関数16974805
Ref: library/compileall public-functions16974981
Ref: 4caa16974981
Ref: library/compileall compileall compile_dir16975042
Ref: d1b16975042
Ref: library/compileall compileall compile_file16979880
Ref: fe116979880
Ref: library/compileall compileall compile_path16983378
Ref: fe216983378
Ref: パブリックな関数-Footnote-116985504
Ref: パブリックな関数-Footnote-216985546
Node: dis --- Python バイトコードの逆アセンブラー16985588
Ref: library/dis doc16985844
Ref: 4cab16985844
Ref: library/dis dis-disassembler-for-python-bytecode16985844
Ref: 4cac16985844
Ref: library/dis module-dis16985844
Ref: 3c16985844
Ref: library/dis translation-repo16985844
Ref: 4cad16985844
Ref: dis --- Python バイトコードの逆アセンブラー-Footnote-116989037
Node: コマンドライン・インターフェース<12>16989100
Ref: library/dis command-line-interface16989279
Ref: 4cae16989279
Ref: library/dis dis-cli16989279
Ref: 4caf16989279
Ref: library/dis cmdoption-dis-h16989556
Ref: 4cb016989556
Ref: library/dis cmdoption-dis-help16989556
Ref: 4cb116989556
Ref: library/dis cmdoption-dis-C16989629
Ref: 4cb216989629
Ref: library/dis cmdoption-dis-show-caches16989629
Ref: 4cb316989629
Ref: library/dis cmdoption-dis-O16989715
Ref: 4eb16989715
Ref: library/dis cmdoption-dis-show-offsets16989715
Ref: 4cb416989715
Ref: library/dis cmdoption-dis-P16989812
Ref: 20816989812
Ref: library/dis cmdoption-dis-show-positions16989812
Ref: 4cb516989812
Ref: library/dis cmdoption-dis-S16989932
Ref: 20916989932
Ref: library/dis cmdoption-dis-specialized16989932
Ref: 4cb616989932
Node: バイトコード解析16990187
Ref: library/dis bytecode-analysis16990387
Ref: 4cb716990387
Ref: library/dis dis Bytecode16990703
Ref: 20416990703
Ref: library/dis dis Bytecode from_traceback16992763
Ref: 113116992763
Ref: library/dis dis Bytecode codeobj16993065
Ref: 4cb816993065
Ref: library/dis dis Bytecode first_line16993160
Ref: 4cb916993160
Ref: library/dis dis Bytecode dis16993285
Ref: 113016993285
Ref: library/dis dis Bytecode info16993507
Ref: 4cba16993507
Node: 解析関数16994250
Ref: library/dis analysis-functions16994429
Ref: 4cbb16994429
Ref: library/dis dis code_info16994712
Ref: 145116994712
Ref: library/dis dis show_code16995337
Ref: 112f16995337
Ref: library/dis dis dis16995940
Ref: 20516995940
Ref: library/dis dis distb16998107
Ref: 20616998107
Ref: library/dis dis disassemble16998969
Ref: 20716998969
Ref: library/dis dis disco16999128
Ref: 4cbc16999128
Ref: library/dis dis get_instructions17000638
Ref: 4ec17000638
Ref: library/dis dis findlinestarts17001940
Ref: 4cbd17001940
Ref: library/dis dis findlabels17002669
Ref: 4cbe17002669
Ref: library/dis dis stack_effect17002840
Ref: 113217002840
Ref: 解析関数-Footnote-117003798
Node: Python バイトコード命令17003840
Ref: library/dis bytecodes17004028
Ref: 7cf17004028
Ref: library/dis python-bytecode-instructions17004028
Ref: 4cbf17004028
Ref: library/dis dis Instruction17004287
Ref: 20317004287
Ref: library/dis dis Instruction opcode17004359
Ref: 4cc017004359
Ref: library/dis dis Instruction opname17004569
Ref: 4cc217004569
Ref: library/dis dis Instruction baseopcode17004642
Ref: 4cc317004642
Ref: library/dis dis Instruction baseopname17004799
Ref: 4cc417004799
Ref: library/dis dis Instruction arg17004963
Ref: 4cc617004963
Ref: library/dis dis Instruction oparg17005065
Ref: 4cc717005065
Ref: library/dis dis Instruction argval17005130
Ref: 4cc817005130
Ref: library/dis dis Instruction argrepr17005219
Ref: 4cc917005219
Ref: library/dis dis Instruction offset17005355
Ref: 4cca17005355
Ref: library/dis dis Instruction start_offset17005449
Ref: 4ccb17005449
Ref: library/dis dis Instruction cache_offset17005665
Ref: 4ccc17005665
Ref: library/dis dis Instruction end_offset17005767
Ref: 4ccd17005767
Ref: library/dis dis Instruction starts_line17005865
Ref: 4cce17005865
Ref: library/dis dis Instruction line_number17005979
Ref: 4ccf17005979
Ref: library/dis dis Instruction is_jump_target17006111
Ref: 4cd017006111
Ref: library/dis dis Instruction jump_target17006278
Ref: 4cd117006278
Ref: library/dis dis Instruction positions17006416
Ref: 4cd217006416
Ref: library/dis dis Instruction cache_info17006576
Ref: 4cd317006576
Ref: library/dis dis Positions17007304
Ref: 194017007304
Ref: library/dis dis Positions lineno17007420
Ref: 4cd417007420
Ref: library/dis dis Positions end_lineno17007448
Ref: 4cd517007448
Ref: library/dis dis Positions col_offset17007480
Ref: 4cd617007480
Ref: library/dis dis Positions end_col_offset17007512
Ref: 4cd717007512
Ref: library/dis opcode-NOP17007886
Ref: 4cd817007886
Ref: library/dis opcode-NOT_TAKEN17008018
Ref: 37617008018
Ref: library/dis opcode-POP_ITER17008228
Ref: 37017008228
Ref: library/dis opcode-POP_TOP17008333
Ref: 4cd917008333
Ref: library/dis opcode-END_FOR17008414
Ref: 4cda17008414
Ref: library/dis opcode-END_SEND17008591
Ref: 4cdb17008591
Ref: library/dis opcode-COPY17008727
Ref: 91717008727
Ref: library/dis opcode-SWAP17008938
Ref: 91817008938
Ref: library/dis opcode-CACHE17009099
Ref: 90817009099
Ref: library/dis opcode-UNARY_NEGATIVE17009977
Ref: 4cdc17009977
Ref: library/dis opcode-UNARY_NOT17010052
Ref: 1a6117010052
Ref: library/dis opcode-UNARY_INVERT17010233
Ref: 4cdd17010233
Ref: library/dis opcode-GET_ITER17010306
Ref: 4cde17010306
Ref: library/dis opcode-GET_YIELD_FROM_ITER17010380
Ref: 4cdf17010380
Ref: library/dis opcode-TO_BOOL17010620
Ref: 1a5e17010620
Ref: library/dis opcode-BINARY_OP17011137
Ref: 36617011137
Ref: library/dis opcode-STORE_SUBSCR17011514
Ref: 1bab17011514
Ref: library/dis opcode-DELETE_SUBSCR17011684
Ref: 4ce017011684
Ref: library/dis opcode-BINARY_SLICE17011821
Ref: 70517011821
Ref: library/dis opcode-STORE_SLICE17012032
Ref: 70617012032
Ref: library/dis opcode-GET_AWAITABLE17012300
Ref: 1bc717012300
Ref: library/dis opcode-GET_AITER17012933
Ref: 4ce117012933
Ref: library/dis opcode-GET_ANEXT17013157
Ref: 4ce217013157
Ref: library/dis opcode-END_ASYNC_FOR17013364
Ref: ca017013364
Ref: library/dis opcode-CLEANUP_THROW17013856
Ref: 70917013856
Ref: library/dis opcode-SET_ADD17014249
Ref: 4ce317014249
Ref: library/dis opcode-LIST_APPEND17014401
Ref: 4ce417014401
Ref: library/dis opcode-MAP_ADD17014562
Ref: ca217014562
Ref: library/dis opcode-RETURN_VALUE17015221
Ref: 1b2017015221
Ref: library/dis opcode-YIELD_VALUE17015313
Ref: 5ba17015313
Ref: library/dis opcode-SETUP_ANNOTATIONS17015730
Ref: f5017015730
Ref: library/dis opcode-POP_EXCEPT17016030
Ref: 4ce517016030
Ref: library/dis opcode-RERAISE17016259
Ref: 4ce617016259
Ref: library/dis opcode-PUSH_EXC_INFO17016624
Ref: 91217016624
Ref: library/dis opcode-CHECK_EXC_MATCH17016864
Ref: 91917016864
Ref: library/dis opcode-CHECK_EG_MATCH17017126
Ref: 91117017126
Ref: library/dis opcode-WITH_EXCEPT_START17017583
Ref: 4ce717017583
Ref: library/dis opcode-LOAD_COMMON_CONSTANT17018126
Ref: 36a17018126
Ref: library/dis opcode-LOAD_BUILD_CLASS17018415
Ref: 4ce817018415
Ref: library/dis opcode-GET_LEN17018554
Ref: 4ce917018554
Ref: library/dis opcode-MATCH_MAPPING17018751
Ref: 4cea17018751
Ref: library/dis opcode-MATCH_SEQUENCE17019072
Ref: 4ceb17019072
Ref: library/dis opcode-MATCH_KEYS17019486
Ref: 92017019486
Ref: library/dis opcode-STORE_NAME17019960
Ref: 4cec17019960
Ref: library/dis opcode-DELETE_NAME17020244
Ref: 4cee17020244
Ref: library/dis opcode-UNPACK_SEQUENCE17020410
Ref: 1bc917020410
Ref: library/dis opcode-UNPACK_EX17020702
Ref: 4cef17020702
Ref: library/dis opcode-STORE_ATTR17021661
Ref: 1bc817021661
Ref: library/dis opcode-DELETE_ATTR17021899
Ref: 4cf017021899
Ref: library/dis opcode-STORE_GLOBAL17022106
Ref: 4ced17022106
Ref: library/dis opcode-DELETE_GLOBAL17022267
Ref: 4cf117022267
Ref: library/dis opcode-LOAD_CONST17022423
Ref: 4cf217022423
Ref: library/dis opcode-LOAD_SMALL_INT17022529
Ref: 36e17022529
Ref: library/dis opcode-LOAD_NAME17022676
Ref: 4cf317022676
Ref: library/dis opcode-LOAD_LOCALS17022872
Ref: 70e17022872
Ref: library/dis opcode-LOAD_FROM_DICT_OR_GLOBALS17023137
Ref: 70d17023137
Ref: library/dis opcode-BUILD_TEMPLATE17023530
Ref: 36817023530
Ref: library/dis opcode-BUILD_INTERPOLATION17023889
Ref: 36717023889
Ref: library/dis opcode-BUILD_TUPLE17024902
Ref: 4cf417024902
Ref: library/dis opcode-BUILD_LIST17025228
Ref: 4cf517025228
Ref: library/dis opcode-BUILD_SET17025385
Ref: 4cf617025385
Ref: library/dis opcode-BUILD_MAP17025537
Ref: 36917025537
Ref: library/dis opcode-BUILD_STRING17025925
Ref: f4d17025925
Ref: library/dis opcode-LIST_EXTEND17026090
Ref: 4cf717026090
Ref: library/dis opcode-SET_UPDATE17026259
Ref: 4cf817026259
Ref: library/dis opcode-DICT_UPDATE17026425
Ref: 4cf917026425
Ref: library/dis opcode-DICT_MERGE17026594
Ref: 4cfa17026594
Ref: library/dis opcode-LOAD_ATTR17026735
Ref: 70417026735
Ref: library/dis opcode-LOAD_SUPER_ATTR17027678
Ref: 70217027678
Ref: library/dis opcode-COMPARE_OP17028749
Ref: b6117028749
Ref: library/dis opcode-IS_OP17029135
Ref: 193c17029135
Ref: library/dis opcode-CONTAINS_OP17029265
Ref: 193b17029265
Ref: library/dis opcode-IMPORT_NAME17029401
Ref: 4cfb17029401
Ref: library/dis opcode-IMPORT_FROM17029821
Ref: 4cfc17029821
Ref: library/dis opcode-JUMP_FORWARD17030070
Ref: 197217030070
Ref: library/dis opcode-JUMP_BACKWARD17030180
Ref: 91a17030180
Ref: library/dis opcode-JUMP_BACKWARD_NO_INTERRUPT17030314
Ref: 90e17030314
Ref: library/dis opcode-POP_JUMP_IF_TRUE17030474
Ref: 1a5f17030474
Ref: library/dis opcode-POP_JUMP_IF_FALSE17031037
Ref: 1a6017031037
Ref: library/dis opcode-POP_JUMP_IF_NOT_NONE17031603
Ref: 1b8017031603
Ref: library/dis opcode-POP_JUMP_IF_NONE17031873
Ref: 1b7f17031873
Ref: library/dis opcode-FOR_ITER17032135
Ref: 1ac217032135
Ref: library/dis opcode-LOAD_GLOBAL17032555
Ref: 1a5a17032555
Ref: library/dis opcode-LOAD_FAST17032851
Ref: 4cfd17032851
Ref: library/dis opcode-LOAD_FAST_BORROW17033191
Ref: 36c17033191
Ref: library/dis opcode-LOAD_FAST_LOAD_FAST17033355
Ref: 4cfe17033355
Ref: library/dis opcode-LOAD_FAST_BORROW_LOAD_FAST_BORROW17033546
Ref: 36d17033546
Ref: library/dis opcode-LOAD_FAST_CHECK17033760
Ref: 70b17033760
Ref: library/dis opcode-LOAD_FAST_AND_CLEAR17034009
Ref: 70a17034009
Ref: library/dis opcode-STORE_FAST17034307
Ref: 1a6317034307
Ref: library/dis opcode-STORE_FAST_STORE_FAST17034415
Ref: 4cff17034415
Ref: library/dis opcode-STORE_FAST_LOAD_FAST17034621
Ref: 4d0017034621
Ref: library/dis opcode-DELETE_FAST17034869
Ref: 4d0117034869
Ref: library/dis opcode-MAKE_CELL17034975
Ref: 90f17034975
Ref: library/dis opcode-LOAD_DEREF17035149
Ref: 4d0217035149
Ref: library/dis opcode-LOAD_FROM_DICT_OR_DEREF17035437
Ref: 70c17035437
Ref: library/dis opcode-STORE_DEREF17035964
Ref: 4d0317035964
Ref: library/dis opcode-DELETE_DEREF17036212
Ref: 4d0417036212
Ref: library/dis opcode-COPY_FREE_VARS17036508
Ref: 90d17036508
Ref: library/dis opcode-RAISE_VARARGS17036754
Ref: 4d0517036754
Ref: library/dis opcode-CALL17037223
Ref: 91517037223
Ref: library/dis opcode-CALL_KW17038008
Ref: 37217038008
Ref: library/dis opcode-CALL_FUNCTION_EX17038840
Ref: f4f17038840
Ref: library/dis opcode-PUSH_NULL17039518
Ref: 91617039518
Ref: library/dis opcode-MAKE_FUNCTION17039716
Ref: f4e17039716
Ref: library/dis opcode-SET_FUNCTION_ATTRIBUTE17040214
Ref: 4d0617040214
Ref: library/dis opcode-BUILD_SLICE17041134
Ref: 4d0717041134
Ref: library/dis opcode-EXTENDED_ARG17041603
Ref: 1b1e17041603
Ref: library/dis opcode-CONVERT_VALUE17041940
Ref: 4d0817041940
Ref: library/dis opcode-FORMAT_SIMPLE17042416
Ref: 4d0917042416
Ref: library/dis opcode-FORMAT_WITH_SPEC17042682
Ref: 4d0a17042682
Ref: library/dis opcode-MATCH_CLASS17042999
Ref: 91f17042999
Ref: library/dis opcode-RESUME17043723
Ref: 5bb17043723
Ref: library/dis opcode-RETURN_GENERATOR17044468
Ref: 90b17044468
Ref: library/dis opcode-SEND17044762
Ref: 90c17044762
Ref: library/dis opcode-HAVE_ARGUMENT17045127
Ref: 6b117045127
Ref: library/dis opcode-CALL_INTRINSIC_117045999
Ref: 70717045999
Ref: library/dis opcode-CALL_INTRINSIC_217049322
Ref: 70817049322
Ref: library/dis opcode-LOAD_SPECIAL17051183
Ref: 36f17051183
Ref: library/dis opcode-SETUP_FINALLY17051701
Ref: 4d0b17051701
Ref: library/dis opcode-SETUP_CLEANUP17051965
Ref: 4d0c17051965
Ref: library/dis opcode-SETUP_WITH17052370
Ref: 4d0d17052370
Ref: library/dis opcode-POP_BLOCK17052800
Ref: 4d0e17052800
Ref: library/dis opcode-LOAD_CONST_IMMORTAL17052953
Ref: 37517052953
Ref: library/dis opcode-JUMP17053083
Ref: 4d0f17053083
Ref: library/dis opcode-JUMP_NO_INTERRUPT17053100
Ref: 1ba517053100
Ref: library/dis opcode-JUMP_IF_TRUE17053267
Ref: 37317053267
Ref: library/dis opcode-JUMP_IF_FALSE17053292
Ref: 37417053292
Ref: library/dis opcode-LOAD_CLOSURE17053464
Ref: 1a5d17053464
Node: 命令コードコレクション17053762
Ref: library/dis id117053929
Ref: 4d1017053929
Ref: library/dis opcode-collections17053929
Ref: 4cc117053929
Ref: library/dis dis opname17054344
Ref: 4cc517054344
Ref: library/dis dis opmap17054490
Ref: 4d1117054490
Ref: library/dis dis cmp_op17054589
Ref: 4d1217054589
Ref: library/dis dis hasarg17054671
Ref: 59f17054671
Ref: library/dis dis hasconst17054780
Ref: 4d1317054780
Ref: library/dis dis hasfree17054876
Ref: 4d1417054876
Ref: library/dis dis hasname17055225
Ref: 4d1517055225
Ref: library/dis dis hasjump17055338
Ref: 4d1617055338
Ref: library/dis dis haslocal17055478
Ref: 4d1717055478
Ref: library/dis dis hascompare17055586
Ref: 4d1817055586
Ref: library/dis dis hasexc17055675
Ref: 6b217055675
Ref: library/dis dis hasjrel17055790
Ref: 4d1917055790
Ref: library/dis dis hasjabs17055988
Ref: 4d1a17055988
Node: pickletools --- pickle 開発者用のツール群17056181
Ref: library/pickletools doc17056358
Ref: 4d1b17056358
Ref: library/pickletools module-pickletools17056358
Ref: ac17056358
Ref: library/pickletools pickletools-tools-for-pickle-developers17056358
Ref: 4d1c17056358
Ref: library/pickletools translation-repo17056358
Ref: 4d1d17056358
Ref: pickletools --- pickle 開発者用のツール群-Footnote-117057159
Node: コマンドラインでの使用<10>17057230
Ref: library/pickletools command-line-usage17057385
Ref: 4d1e17057385
Ref: library/pickletools pickletools-cli17057385
Ref: 2d2f17057385
Node: コマンドラインオプション<6>17058620
Ref: library/pickletools command-line-options17058733
Ref: 4d1f17058733
Ref: library/pickletools cmdoption-pickletools-a17058816
Ref: 4d2017058816
Ref: library/pickletools cmdoption-pickletools-annotate17058816
Ref: 4d2117058816
Ref: library/pickletools cmdoption-pickletools-o17058926
Ref: 4d2217058926
Ref: library/pickletools cmdoption-pickletools-output17058926
Ref: 4d2317058926
Ref: library/pickletools cmdoption-pickletools-l17059011
Ref: 4d2417059011
Ref: library/pickletools cmdoption-pickletools-indentlevel17059011
Ref: 4d2517059011
Ref: library/pickletools cmdoption-pickletools-m17059127
Ref: 4d2617059127
Ref: library/pickletools cmdoption-pickletools-memo17059127
Ref: 4d2717059127
Ref: library/pickletools cmdoption-pickletools-p17059281
Ref: 4d2817059281
Ref: library/pickletools cmdoption-pickletools-preamble17059281
Ref: 4d2917059281
Ref: library/pickletools cmdoption-pickletools-arg-pickle_file17059422
Ref: 4d2a17059422
Node: Programmatic interface17059533
Ref: library/pickletools programmatic-interface17059688
Ref: 4d2b17059688
Ref: library/pickletools pickletools dis17059755
Ref: ebe17059755
Ref: library/pickletools pickletools genops17060805
Ref: 4d2c17060805
Ref: library/pickletools pickletools optimize17061402
Ref: 2d1617061402
Node: MS Windows 固有のサービス17061791
Ref: library/windows doc17061952
Ref: 4d2d17061952
Ref: library/windows ms-windows-specific-services17061952
Ref: 4d2e17061952
Ref: library/windows mswin-specific-services17061952
Ref: 222017061952
Ref: library/windows translation-repo17061952
Ref: 4d2f17061952
Node: msvcrt --- MS VC++ ランタイムの有用なルーチン群17062521
Ref: library/msvcrt doc17062712
Ref: 4d3017062712
Ref: library/msvcrt module-msvcrt17062712
Ref: 9717062712
Ref: library/msvcrt msvcrt-useful-routines-from-the-ms-vc-runtime17062712
Ref: 4d3117062712
Node: ファイル操作関連17064194
Ref: library/msvcrt file-operations17064351
Ref: 4d3217064351
Ref: library/msvcrt msvcrt-files17064351
Ref: 4d3317064351
Ref: library/msvcrt msvcrt locking17064412
Ref: 475e17064412
Ref: library/msvcrt msvcrt LK_LOCK17065100
Ref: 4d3417065100
Ref: library/msvcrt msvcrt LK_RLCK17065130
Ref: 4d3517065130
Ref: library/msvcrt msvcrt LK_NBLCK17065376
Ref: 4d3617065376
Ref: library/msvcrt msvcrt LK_NBRLCK17065407
Ref: 4d3717065407
Ref: library/msvcrt msvcrt LK_UNLCK17065606
Ref: 4d3817065606
Ref: library/msvcrt msvcrt setmode17065792
Ref: 4d3917065792
Ref: library/msvcrt msvcrt open_osfhandle17066119
Ref: 475f17066119
Ref: library/msvcrt msvcrt get_osfhandle17066795
Ref: 475d17066795
Node: コンソール I/O 関連17067080
Ref: library/msvcrt console-i-o17067264
Ref: 4d3a17067264
Ref: library/msvcrt msvcrt-console17067264
Ref: 4d3b17067264
Ref: library/msvcrt msvcrt kbhit17067330
Ref: 4d3c17067330
Ref: library/msvcrt msvcrt getch17067455
Ref: 4d3d17067455
Ref: library/msvcrt msvcrt getwch17067943
Ref: 160e17067943
Ref: library/msvcrt msvcrt getche17068063
Ref: 4d3e17068063
Ref: library/msvcrt msvcrt getwche17068211
Ref: 160f17068211
Ref: library/msvcrt msvcrt putch17068333
Ref: 4d3f17068333
Ref: library/msvcrt msvcrt putwch17068486
Ref: 161017068486
Ref: library/msvcrt msvcrt ungetch17068633
Ref: 4d4017068633
Ref: library/msvcrt msvcrt ungetwch17068928
Ref: 4d4117068928
Node: その多の関数17069079
Ref: library/msvcrt msvcrt-other17069230
Ref: 4d4217069230
Ref: library/msvcrt other-functions17069230
Ref: 4d4317069230
Ref: library/msvcrt msvcrt heapmin17069281
Ref: 4d4417069281
Ref: library/msvcrt msvcrt set_error_mode17069475
Ref: 4d4517069475
Ref: library/msvcrt msvcrt OUT_TO_DEFAULT17069848
Ref: 4d4717069848
Ref: library/msvcrt msvcrt OUT_TO_STDERR17069994
Ref: 4d4817069994
Ref: library/msvcrt msvcrt OUT_TO_MSGBOX17070127
Ref: 4d4917070127
Ref: library/msvcrt msvcrt REPORT_ERRMODE17070257
Ref: 4d4617070257
Ref: library/msvcrt msvcrt CrtSetReportMode17070396
Ref: 4d4a17070396
Ref: library/msvcrt msvcrt CrtSetReportFile17070785
Ref: 4d4b17070785
Ref: library/msvcrt msvcrt CRT_WARN17071183
Ref: 4d4d17071183
Ref: library/msvcrt msvcrt CRT_ERROR17071301
Ref: 4d4e17071301
Ref: library/msvcrt msvcrt CRT_ASSERT17071422
Ref: 4d4f17071422
Ref: library/msvcrt msvcrt CRTDBG_MODE_DEBUG17071482
Ref: 4d5017071482
Ref: library/msvcrt msvcrt CRTDBG_MODE_FILE17071581
Ref: 4d4c17071581
Ref: library/msvcrt msvcrt CRTDBG_MODE_WNDW17071803
Ref: 4d5117071803
Ref: library/msvcrt msvcrt CRTDBG_REPORT_MODE17071966
Ref: 4d5217071966
Ref: library/msvcrt msvcrt CRT_ASSEMBLY_VERSION17072063
Ref: 157717072063
Ref: library/msvcrt msvcrt VC_ASSEMBLY_PUBLICKEYTOKEN17072178
Ref: 157817072178
Ref: library/msvcrt msvcrt LIBRARIES_ASSEMBLY_NAME_PREFIX17072312
Ref: 157917072312
Node: winreg --- Windows レジストリへのアクセス17072452
Ref: library/winreg doc17072715
Ref: 4d5317072715
Ref: library/winreg module-winreg17072715
Ref: 11c17072715
Ref: library/winreg translation-repo17072715
Ref: 4d5417072715
Ref: library/winreg winreg-windows-registry-access17072715
Ref: 4d5517072715
Ref: library/winreg exception-changed17073339
Ref: 4d5717073339
Node: 関数<14>17073649
Ref: library/winreg functions17073767
Ref: 4d5817073767
Ref: library/winreg id117073767
Ref: 4d5917073767
Ref: library/winreg winreg CloseKey17073861
Ref: 4d5a17073861
Ref: library/winreg winreg ConnectRegistry17074291
Ref: 476417074291
Ref: library/winreg winreg CreateKey17075192
Ref: 476517075192
Ref: library/winreg winreg CreateKeyEx17076412
Ref: 157a17076412
Ref: library/winreg winreg DeleteKey17078143
Ref: 476617078143
Ref: library/winreg winreg DeleteKeyEx17079144
Ref: 157b17079144
Ref: library/winreg winreg DeleteValue17080845
Ref: 476717080845
Ref: library/winreg winreg EnumKey17081314
Ref: 476817081314
Ref: library/winreg winreg EnumValue17082137
Ref: 476917082137
Ref: library/winreg winreg ExpandEnvironmentStrings17083645
Ref: 161117083645
Ref: library/winreg winreg FlushKey17084043
Ref: 4d6117084043
Ref: library/winreg winreg LoadKey17085137
Ref: 476a17085137
Ref: library/winreg winreg OpenKey17086601
Ref: 476b17086601
Ref: library/winreg winreg OpenKeyEx17086675
Ref: 4d6417086675
Ref: library/winreg winreg QueryInfoKey17088097
Ref: 476d17088097
Ref: library/winreg winreg QueryValue17089084
Ref: 476e17089084
Ref: library/winreg winreg QueryValueEx17090211
Ref: 178417090211
Ref: library/winreg winreg SaveKey17091270
Ref: 476f17091270
Ref: library/winreg winreg SetValue17092492
Ref: 477017092492
Ref: library/winreg winreg SetValueEx17093953
Ref: 1b0317093953
Ref: library/winreg winreg DisableReflectionKey17095545
Ref: 157c17095545
Ref: library/winreg winreg EnableReflectionKey17096374
Ref: 157d17096374
Ref: library/winreg winreg QueryReflectionKey17097035
Ref: 157e17097035
Ref: 関数<14>-Footnote-117097645
Ref: 関数<14>-Footnote-217097722
Node: 定数<11>17097799
Ref: library/winreg constants17097971
Ref: 4d6917097971
Ref: library/winreg id217097971
Ref: 4d6a17097971
Node: HKEY_* 定数17098144
Ref: library/winreg hkey-constants17098231
Ref: 4d5c17098231
Ref: library/winreg id317098231
Ref: 4d6b17098231
Ref: library/winreg winreg HKEY_CLASSES_ROOT17098276
Ref: 4d6c17098276
Ref: library/winreg winreg HKEY_CURRENT_USER17098598
Ref: 4d6d17098598
Ref: library/winreg winreg HKEY_LOCAL_MACHINE17098970
Ref: 4d6317098970
Ref: library/winreg winreg HKEY_USERS17099295
Ref: 4d6217099295
Ref: library/winreg winreg HKEY_PERFORMANCE_DATA17099549
Ref: 4d6e17099549
Ref: library/winreg winreg HKEY_CURRENT_CONFIG17099907
Ref: 4d6f17099907
Ref: library/winreg winreg HKEY_DYN_DATA17100089
Ref: 4d7017100089
Node: アクセス権限17100224
Ref: library/winreg access-rights17100329
Ref: 4d5e17100329
Ref: library/winreg id417100329
Ref: 4d7117100329
Ref: library/winreg winreg KEY_ALL_ACCESS17100489
Ref: 4d7217100489
Ref: library/winreg winreg KEY_WRITE17100792
Ref: 4d5d17100792
Ref: library/winreg winreg KEY_READ17100959
Ref: 4d6517100959
Ref: library/winreg winreg KEY_EXECUTE17101160
Ref: 4d7817101160
Ref: library/winreg winreg KEY_QUERY_VALUE17101236
Ref: 4d7317101236
Ref: library/winreg winreg KEY_SET_VALUE17101345
Ref: 4d6717101345
Ref: library/winreg winreg KEY_CREATE_SUB_KEY17101458
Ref: 4d7417101458
Ref: library/winreg winreg KEY_ENUMERATE_SUB_KEYS17101567
Ref: 4d7517101567
Ref: library/winreg winreg KEY_NOTIFY17101686
Ref: 4d7617101686
Ref: library/winreg winreg KEY_CREATE_LINK17101823
Ref: 4d7717101823
Ref: アクセス権限-Footnote-117102011
Node: 64-bit 特有のアクセス権17102088
Ref: library/winreg bit-access-rights17102174
Ref: 4d7917102174
Ref: library/winreg bit-specific17102174
Ref: 4d7a17102174
Ref: library/winreg winreg KEY_WOW64_64KEY17102362
Ref: 4d5f17102362
Ref: library/winreg winreg KEY_WOW64_32KEY17102604
Ref: 4d7b17102604
Ref: 64-bit 特有のアクセス権-Footnote-117102882
Node: 値の型17102954
Ref: library/winreg id517103037
Ref: 4d7c17103037
Ref: library/winreg value-types17103037
Ref: 4d6817103037
Ref: library/winreg winreg REG_BINARY17103169
Ref: 4d7d17103169
Ref: library/winreg winreg REG_DWORD17103255
Ref: 4d7e17103255
Ref: library/winreg winreg REG_DWORD_LITTLE_ENDIAN17103316
Ref: 4d7f17103316
Ref: library/winreg winreg REG_DWORD_BIG_ENDIAN17103468
Ref: 4d8017103468
Ref: library/winreg winreg REG_EXPAND_SZ17103576
Ref: 4d6017103576
Ref: library/winreg winreg REG_LINK17103715
Ref: 4d8117103715
Ref: library/winreg winreg REG_MULTI_SZ17103795
Ref: 1dc317103795
Ref: library/winreg winreg REG_NONE17104016
Ref: 4d8217104016
Ref: library/winreg winreg REG_QWORD17104094
Ref: eff17104094
Ref: library/winreg winreg REG_QWORD_LITTLE_ENDIAN17104183
Ref: 4d8317104183
Ref: library/winreg winreg REG_RESOURCE_LIST17104362
Ref: 4d8417104362
Ref: library/winreg winreg REG_FULL_RESOURCE_DESCRIPTOR17104461
Ref: 4d8517104461
Ref: library/winreg winreg REG_RESOURCE_REQUIREMENTS_LIST17104559
Ref: 4d8617104559
Ref: library/winreg winreg REG_SZ17104662
Ref: 4d6617104662
Ref: 値の型-Footnote-117104777
Node: レジストリハンドルオブジェクト17104854
Ref: library/winreg handle-object17105007
Ref: 4d5617105007
Ref: library/winreg registry-handle-objects17105007
Ref: 4d8717105007
Ref: library/winreg winreg PyHKEY Close17106494
Ref: 4d5b17106494
Ref: library/winreg winreg PyHKEY Detach17106675
Ref: 476c17106675
Ref: library/winreg winreg PyHKEY __enter__17107473
Ref: 4d8817107473
Ref: library/winreg winreg PyHKEY __exit__17107511
Ref: 4d8917107511
Node: winsound --- Windows 用の音声再生インターフェース17108002
Ref: library/winsound doc17108195
Ref: 4d8a17108195
Ref: library/winsound module-winsound17108195
Ref: 11d17108195
Ref: library/winsound translation-repo17108195
Ref: 4d8b17108195
Ref: library/winsound winsound-sound-playing-interface-for-windows17108195
Ref: 4d8c17108195
Ref: library/winsound winsound Beep17108592
Ref: f0117108592
Ref: library/winsound winsound PlaySound17109048
Ref: f0317109048
Ref: library/winsound winsound MessageBeep17109789
Ref: f0217109789
Ref: library/winsound winsound SND_FILENAME17110585
Ref: 4d8d17110585
Ref: library/winsound winsound SND_ALIAS17110777
Ref: 4d8e17110777
Ref: library/winsound winsound SND_LOOP17112689
Ref: 4d9017112689
Ref: library/winsound winsound SND_MEMORY17113001
Ref: 4d9217113001
Ref: library/winsound winsound SND_PURGE17113550
Ref: 4d9317113550
Ref: library/winsound winsound SND_ASYNC17113816
Ref: 4d9117113816
Ref: library/winsound winsound SND_NODEFAULT17113954
Ref: 4d8f17113954
Ref: library/winsound winsound SND_NOSTOP17114126
Ref: 4d9417114126
Ref: library/winsound winsound SND_NOWAIT17114238
Ref: 4d9517114238
Ref: library/winsound winsound SND_APPLICATION17114520
Ref: 4d9617114520
Ref: library/winsound winsound SND_SENTRY17114760
Ref: 4d9717114760
Ref: library/winsound winsound SND_SYNC17114886
Ref: 4d9817114886
Ref: library/winsound winsound SND_SYSTEM17115021
Ref: 4d9917115021
Ref: library/winsound winsound MB_ICONASTERISK17115167
Ref: 4d9a17115167
Ref: library/winsound winsound MB_ICONEXCLAMATION17115263
Ref: 4d9b17115263
Ref: library/winsound winsound MB_ICONHAND17115366
Ref: 4d9c17115366
Ref: library/winsound winsound MB_ICONQUESTION17115455
Ref: 4d9d17115455
Ref: library/winsound winsound MB_OK17115552
Ref: 4d9e17115552
Ref: library/winsound winsound MB_ICONERROR17115638
Ref: 4d9f17115638
Ref: library/winsound winsound MB_ICONINFORMATION17115757
Ref: 4da017115757
Ref: library/winsound winsound MB_ICONSTOP17115885
Ref: 4da117115885
Ref: library/winsound winsound MB_ICONWARNING17116003
Ref: 4da217116003
Node: Unix-specific services17116131
Ref: library/unix doc17116335
Ref: 4da317116335
Ref: library/unix translation-repo17116335
Ref: 4da417116335
Ref: library/unix unix17116335
Ref: 4da517116335
Ref: library/unix unix-specific-services17116335
Ref: 4da617116335
Node: shlex --- 単純な字句解析17117544
Ref: library/shlex doc17117702
Ref: 4da717117702
Ref: library/shlex module-shlex17117702
Ref: c917117702
Ref: library/shlex shlex-simple-lexical-analysis17117702
Ref: 4da817117702
Ref: library/shlex shlex split17118247
Ref: 75e17118247
Ref: library/shlex shlex join17118940
Ref: c1c17118940
Ref: library/shlex shlex quote17119399
Ref: 58217119399
Ref: library/shlex shlex-quote-warning17119681
Ref: 375717119681
Ref: library/shlex shlex shlex17121380
Ref: ec817121380
Ref: shlex --- 単純な字句解析-Footnote-117123650
Node: shlex オブジェクト17123715
Ref: library/shlex id117123828
Ref: 4dac17123828
Ref: library/shlex shlex-objects17123828
Ref: 4dad17123828
Ref: library/shlex shlex shlex get_token17123975
Ref: 4dae17123975
Ref: library/shlex shlex shlex push_token17124513
Ref: 4daf17124513
Ref: library/shlex shlex shlex read_token17124631
Ref: 4db117124631
Ref: library/shlex shlex shlex sourcehook17124969
Ref: 4db217124969
Ref: library/shlex shlex shlex push_source17127135
Ref: 4db417127135
Ref: library/shlex shlex shlex pop_source17127526
Ref: 4db517127526
Ref: library/shlex shlex shlex error_leader17127805
Ref: 4db617127805
Ref: library/shlex shlex shlex commenters17128668
Ref: 4da917128668
Ref: library/shlex shlex shlex wordchars17128935
Ref: 4dab17128935
Ref: library/shlex shlex shlex whitespace17129631
Ref: 4db817129631
Ref: library/shlex shlex shlex escape17129908
Ref: 4db917129908
Ref: library/shlex shlex shlex quotes17130115
Ref: 4dba17130115
Ref: library/shlex shlex shlex escapedquotes17130532
Ref: 4dbb17130532
Ref: library/shlex shlex shlex whitespace_split17130820
Ref: 4db717130820
Ref: library/shlex shlex shlex infile17131365
Ref: 4daa17131365
Ref: library/shlex shlex shlex instream17131686
Ref: 4dbc17131686
Ref: library/shlex shlex shlex source17131829
Ref: 4db317131829
Ref: library/shlex shlex shlex debug17132647
Ref: 4dbd17132647
Ref: library/shlex shlex shlex lineno17133012
Ref: 4dbe17133012
Ref: library/shlex shlex shlex token17133127
Ref: 4dbf17133127
Ref: library/shlex shlex shlex eof17133285
Ref: 4db017133285
Ref: library/shlex shlex shlex punctuation_chars17133502
Ref: 1db617133502
Node: 解析規則17133909
Ref: library/shlex parsing-rules17134065
Ref: 4dc017134065
Ref: library/shlex shlex-parsing-rules17134065
Ref: 4dc117134065
Node: Improved Compatibility with Shells17136201
Ref: library/shlex improved-compatibility-with-shells17136324
Ref: 4dc217136324
Ref: library/shlex improved-shell-compatibility17136324
Ref: ec917136324
Node: posix --- 最も一般的な POSIX システムコール群17139159
Ref: library/posix doc17139367
Ref: 4dc317139367
Ref: library/posix module-posix17139367
Ref: b217139367
Ref: library/posix posix-the-most-common-posix-system-calls17139367
Ref: 4dc417139367
Ref: library/posix translation-repo17139367
Ref: 4dc517139367
Node: ラージファイルのサポート17140812
Ref: library/posix large-file-support17140992
Ref: 4dc617140992
Ref: library/posix posix-large-files17140992
Ref: 4dc717140992
Node: 注目すべきモジュールの内容17142575
Ref: library/posix notable-module-contents17142755
Ref: 4dc817142755
Ref: library/posix posix-contents17142755
Ref: 4dc917142755
Ref: library/posix posix environ17142970
Ref: 4dca17142970
Node: pwd --- パスワードデータベース17144283
Ref: library/pwd doc17144498
Ref: 4dcb17144498
Ref: library/pwd module-pwd17144498
Ref: b717144498
Ref: library/pwd pwd-the-password-database17144498
Ref: 4dcc17144498
Ref: library/pwd translation-repo17144498
Ref: 4dcd17144498
Ref: library/pwd pwd getpwuid17147154
Ref: 1e1217147154
Ref: library/pwd pwd getpwnam17147295
Ref: 374717147295
Ref: library/pwd pwd getpwall17147452
Ref: 4dce17147452
Node: grp --- グループデータベース17147786
Ref: library/grp doc17147987
Ref: 4dcf17147987
Ref: library/grp grp-the-group-database17147987
Ref: 4dd017147987
Ref: library/grp module-grp17147987
Ref: 6a17147987
Ref: library/grp translation-repo17147987
Ref: 4dd117147987
Ref: library/grp grp getgrgid17150152
Ref: f2217150152
Ref: library/grp grp getgrnam17150578
Ref: 374617150578
Ref: library/grp grp getgrall17150841
Ref: 18e917150841
Node: termios --- POSIX スタイルの端末制御17151136
Ref: library/termios doc17151331
Ref: 4dd217151331
Ref: library/termios module-termios17151331
Ref: e717151331
Ref: library/termios termios-posix-style-tty-control17151331
Ref: 4dd317151331
Ref: library/termios translation-repo17151331
Ref: 4dd417151331
Ref: library/termios termios tcgetattr17152808
Ref: 19f317152808
Ref: library/termios termios tcsetattr17153382
Ref: 1a6917153382
Ref: library/termios termios TCSANOW17153662
Ref: 4dd517153662
Ref: library/termios termios TCSADRAIN17153741
Ref: 4dd617153741
Ref: library/termios termios TCSAFLUSH17153847
Ref: 4dd717153847
Ref: library/termios termios tcsendbreak17153995
Ref: 4dd817153995
Ref: library/termios termios tcdrain17154301
Ref: 4dd917154301
Ref: library/termios termios tcflush17154453
Ref: 4dda17154453
Ref: library/termios termios tcflow17154775
Ref: 4ddb17154775
Ref: library/termios termios tcgetwinsize17155193
Ref: 4ddc17155193
Ref: library/termios termios tcsetwinsize17155438
Ref: 4ddd17155438
Ref: termios --- POSIX スタイルの端末制御-Footnote-117156054
Node: 使用例<51>17156101
Ref: library/termios example17156196
Ref: 4dde17156196
Ref: library/termios termios-example17156196
Ref: 4ddf17156196
Node: tty --- 端末制御用の関数群17156995
Ref: library/tty doc17157193
Ref: 4de017157193
Ref: library/tty module-tty17157193
Ref: 10617157193
Ref: library/tty translation-repo17157193
Ref: 4de117157193
Ref: library/tty tty-terminal-control-functions17157193
Ref: 4de217157193
Ref: library/tty tty cfmakeraw17157683
Ref: 1a4217157683
Ref: library/tty tty cfmakecbreak17157908
Ref: 19f617157908
Ref: library/tty tty setraw17158484
Ref: 1a4117158484
Ref: library/tty tty setcbreak17158976
Ref: 19f517158976
Ref: tty --- 端末制御用の関数群-Footnote-117160010
Node: pty --- 擬似端末ユーティリティ17160073
Ref: library/pty doc17160279
Ref: 4de317160279
Ref: library/pty module-pty17160279
Ref: b617160279
Ref: library/pty pty-pseudo-terminal-utilities17160279
Ref: 4de417160279
Ref: library/pty translation-repo17160279
Ref: 4de517160279
Ref: library/pty pty fork17160959
Ref: 1ac917160959
Ref: library/pty pty openpty17161627
Ref: 30117161627
Ref: library/pty pty spawn17162027
Ref: 118417162027
Ref: pty --- 擬似端末ユーティリティ-Footnote-117164358
Node: 使用例<52>17164421
Ref: library/pty example17164512
Ref: 4de617164512
Ref: 使用例<52>-Footnote-117165776
Node: fcntl --- fcntl および ioctl システムコール17165822
Ref: library/fcntl doc17166030
Ref: 4de717166030
Ref: library/fcntl fcntl-the-fcntl-and-ioctl-system-calls17166030
Ref: 4de817166030
Ref: library/fcntl module-fcntl17166030
Ref: 5d17166030
Ref: library/fcntl translation-repo17166030
Ref: 4de917166030
Ref: library/fcntl fcntl fcntl17169874
Ref: 185117169874
Ref: library/fcntl fcntl ioctl17171930
Ref: 169417171930
Ref: library/fcntl fcntl flock17174721
Ref: 475c17174721
Ref: library/fcntl fcntl lockf17175404
Ref: 160517175404
Ref: library/fcntl fcntl LOCK_UN17175861
Ref: 4dea17175861
Ref: library/fcntl fcntl LOCK_SH17175933
Ref: 4deb17175933
Ref: library/fcntl fcntl LOCK_EX17176002
Ref: 4dec17176002
Ref: library/fcntl fcntl LOCK_NB17176075
Ref: 4ded17176075
Ref: fcntl --- fcntl および ioctl システムコール-Footnote-117178535
Ref: fcntl --- fcntl および ioctl システムコール-Footnote-217178580
Ref: fcntl --- fcntl および ioctl システムコール-Footnote-317178625
Node: resource --- リソース使用情報17178670
Ref: library/resource doc17178890
Ref: 4dee17178890
Ref: library/resource module-resource17178890
Ref: c117178890
Ref: library/resource resource-resource-usage-information17178890
Ref: 4def17178890
Ref: library/resource translation-repo17178890
Ref: 4df017178890
Ref: library/resource resource error17179561
Ref: 4df117179561
Ref: resource --- リソース使用情報-Footnote-117179907
Node: リソースの制限17179949
Ref: library/resource resource-limits17180080
Ref: 4df217180080
Ref: library/resource resource RLIM_INFINITY17181449
Ref: 17c517181449
Ref: library/resource resource getrlimit17181561
Ref: 17c417181561
Ref: library/resource resource setrlimit17181941
Ref: 17c617181941
Ref: library/resource resource prlimit17183188
Ref: 118c17183188
Ref: library/resource resource RLIMIT_CORE17185392
Ref: 46fd17185392
Ref: library/resource resource RLIMIT_CPU17185761
Ref: 4df417185761
Ref: library/resource resource RLIMIT_FSIZE17186133
Ref: 4df517186133
Ref: library/resource resource RLIMIT_DATA17186244
Ref: 4df617186244
Ref: library/resource resource RLIMIT_STACK17186352
Ref: 4df717186352
Ref: library/resource resource RLIMIT_RSS17186609
Ref: 4df817186609
Ref: library/resource resource RLIMIT_NPROC17186750
Ref: 4df917186750
Ref: library/resource resource RLIMIT_NOFILE17186864
Ref: 4df317186864
Ref: library/resource resource RLIMIT_OFILE17186982
Ref: 4dfa17186982
Ref: library/resource resource RLIMIT_MEMLOCK17187083
Ref: 4dfb17187083
Ref: library/resource resource RLIMIT_VMEM17187196
Ref: 4dfc17187196
Ref: library/resource resource RLIMIT_AS17187410
Ref: 4dfd17187410
Ref: library/resource resource RLIMIT_MSGQUEUE17187543
Ref: 118d17187543
Ref: library/resource resource RLIMIT_NICE17187755
Ref: 118e17187755
Ref: library/resource resource RLIMIT_RTPRIO17187932
Ref: 118f17187932
Ref: library/resource resource RLIMIT_RTTIME17188104
Ref: 119017188104
Ref: library/resource resource RLIMIT_SIGPENDING17188426
Ref: 119117188426
Ref: library/resource resource RLIMIT_SBSIZE17188613
Ref: 119217188613
Ref: library/resource resource RLIMIT_SWAP17188970
Ref: 119317188970
Ref: library/resource resource RLIMIT_NPTS17189449
Ref: 119417189449
Ref: library/resource resource RLIMIT_KQUEUES17189638
Ref: 1ca617189638
Ref: リソースの制限-Footnote-117189862
Ref: リソースの制限-Footnote-217189911
Ref: リソースの制限-Footnote-317189960
Node: リソースの使用状態17190027
Ref: library/resource resource-usage17190158
Ref: 4dfe17190158
Ref: library/resource resource getrusage17190308
Ref: 164a17190308
Ref: library/resource resource getpagesize17195152
Ref: 4dff17195152
Ref: library/resource resource RUSAGE_SELF17195486
Ref: 4e0017195486
Ref: library/resource resource RUSAGE_CHILDREN17195744
Ref: 4e0117195744
Ref: library/resource resource RUSAGE_BOTH17195998
Ref: 4e0217195998
Ref: library/resource resource RUSAGE_THREAD17196268
Ref: 4e0317196268
Ref: リソースの使用状態-Footnote-117196565
Node: syslog --- Unix syslog ライブラリルーチン群17196614
Ref: library/syslog doc17196772
Ref: 4e0417196772
Ref: library/syslog module-syslog17196772
Ref: e217196772
Ref: library/syslog syslog-unix-syslog-library-routines17196772
Ref: 4e0517196772
Ref: library/syslog translation-repo17196772
Ref: 4e0617196772
Ref: library/syslog syslog syslog17197622
Ref: 76217197622
Ref: library/syslog syslog openlog17199313
Ref: 76017199313
Ref: library/syslog syslog closelog17200981
Ref: 76117200981
Ref: library/syslog syslog setlogmask17202008
Ref: 476217202008
Ref: library/syslog syslog LOG_EMERG17202780
Ref: 4e0917202780
Ref: library/syslog syslog LOG_ALERT17202812
Ref: 4e0a17202812
Ref: library/syslog syslog LOG_CRIT17202844
Ref: 4e0b17202844
Ref: library/syslog syslog LOG_ERR17202875
Ref: 4e0c17202875
Ref: library/syslog syslog LOG_WARNING17202905
Ref: 4e0d17202905
Ref: library/syslog syslog LOG_NOTICE17202939
Ref: 4e0e17202939
Ref: library/syslog syslog LOG_INFO17202972
Ref: 4e0717202972
Ref: library/syslog syslog LOG_DEBUG17203003
Ref: 4e0f17203003
Ref: library/syslog syslog LOG_AUTH17203089
Ref: 4e1017203089
Ref: library/syslog syslog LOG_AUTHPRIV17203120
Ref: 4e1117203120
Ref: library/syslog syslog LOG_CRON17203155
Ref: 4e1217203155
Ref: library/syslog syslog LOG_DAEMON17203186
Ref: 4e1317203186
Ref: library/syslog syslog LOG_FTP17203219
Ref: 4e1417203219
Ref: library/syslog syslog LOG_INSTALL17203249
Ref: 4e1517203249
Ref: library/syslog syslog LOG_KERN17203283
Ref: 4e1617203283
Ref: library/syslog syslog LOG_LAUNCHD17203314
Ref: 4e1717203314
Ref: library/syslog syslog LOG_LPR17203348
Ref: 4e1817203348
Ref: library/syslog syslog LOG_MAIL17203378
Ref: 4e1917203378
Ref: library/syslog syslog LOG_NETINFO17203409
Ref: 4e1a17203409
Ref: library/syslog syslog LOG_NEWS17203443
Ref: 4e1b17203443
Ref: library/syslog syslog LOG_RAS17203474
Ref: 4e1c17203474
Ref: library/syslog syslog LOG_REMOTEAUTH17203504
Ref: 4e1d17203504
Ref: library/syslog syslog LOG_SYSLOG17203541
Ref: 4e1e17203541
Ref: library/syslog syslog LOG_USER17203574
Ref: 4e0817203574
Ref: library/syslog syslog LOG_UUCP17203605
Ref: 4e1f17203605
Ref: library/syslog syslog LOG_LOCAL017203636
Ref: 4e2017203636
Ref: library/syslog syslog LOG_LOCAL117203669
Ref: 4e2117203669
Ref: library/syslog syslog LOG_LOCAL217203702
Ref: 4e2217203702
Ref: library/syslog syslog LOG_LOCAL317203735
Ref: 4e2317203735
Ref: library/syslog syslog LOG_LOCAL417203768
Ref: 4e2417203768
Ref: library/syslog syslog LOG_LOCAL517203801
Ref: 4e2517203801
Ref: library/syslog syslog LOG_LOCAL617203834
Ref: 4e2617203834
Ref: library/syslog syslog LOG_LOCAL717203867
Ref: 4e2717203867
Ref: library/syslog syslog LOG_PID17204337
Ref: 4e2817204337
Ref: library/syslog syslog LOG_CONS17204367
Ref: 4e2917204367
Ref: library/syslog syslog LOG_NDELAY17204398
Ref: 4e2a17204398
Ref: library/syslog syslog LOG_ODELAY17204431
Ref: 4e2b17204431
Ref: library/syslog syslog LOG_NOWAIT17204464
Ref: 4e2c17204464
Ref: library/syslog syslog LOG_PERROR17204497
Ref: 4e2d17204497
Node: 使用例<53>17204724
Ref: library/syslog examples17204827
Ref: 4e2e17204827
Node: シンプルな例17204898
Ref: library/syslog simple-example17204966
Ref: 4e2f17204966
Node: モジュールのコマンドラインインターフェース CLI17205510
Ref: library/cmdline doc17205724
Ref: 4e3017205724
Ref: library/cmdline library-cmdline17205724
Ref: 4e3117205724
Ref: library/cmdline modules-command-line-interface-cli17205724
Ref: 4e3217205724
Ref: library/cmdline translation-repo17205724
Ref: 4e3317205724
Node: 取って代わられたモジュール群17207375
Ref: library/superseded doc17207597
Ref: 4e3417207597
Ref: library/superseded superseded17207597
Ref: 4e3517207597
Ref: library/superseded superseded-modules17207597
Ref: 4e3617207597
Ref: library/superseded translation-repo17207597
Ref: 4e3717207597
Ref: 取って代わられたモジュール群-Footnote-117208773
Node: getopt --- C-style parser for command line options17208815
Ref: library/getopt doc17208944
Ref: 4e3817208944
Ref: library/getopt getopt-c-style-parser-for-command-line-options17208944
Ref: 4e3917208944
Ref: library/getopt module-getopt17208944
Ref: 6517208944
Ref: library/getopt getopt getopt17210395
Ref: 16d417210395
Ref: library/getopt getopt gnu_getopt17212962
Ref: 16d317212962
Ref: library/getopt getopt GetoptError17214144
Ref: 18ea17214144
Ref: library/getopt getopt error17214721
Ref: 4e3a17214721
Ref: getopt --- C-style parser for command line options-Footnote-117218786
Node: 削除されたモジュール17218852
Ref: library/removed doc17219049
Ref: 4e3b17219049
Ref: library/removed removed17219049
Ref: 4e3c17219049
Ref: library/removed removed-modules17219049
Ref: 4e3d17219049
Ref: library/removed translation-repo17219049
Ref: 4e3e17219049
Node: aifc --- Read and write AIFF and AIFC files17221281
Ref: library/aifc doc17221457
Ref: 4e3f17221457
Ref: library/aifc aifc-read-and-write-aiff-and-aifc-files17221457
Ref: 4e4017221457
Ref: library/aifc module-aifc17221457
Ref: 517221457
Ref: aifc --- Read and write AIFF and AIFC files-Footnote-117222014
Ref: aifc --- Read and write AIFF and AIFC files-Footnote-217222056
Node: asynchat --- Asynchronous socket command/response handler17222111
Ref: library/asynchat doc17222336
Ref: 4e4117222336
Ref: library/asynchat asynchat-asynchronous-socket-command-response-handler17222336
Ref: 4e4217222336
Ref: library/asynchat module-asynchat17222336
Ref: a17222336
Ref: library/asynchat translation-repo17222336
Ref: 4e4317222336
Ref: asynchat --- Asynchronous socket command/response handler-Footnote-117222899
Ref: asynchat --- Asynchronous socket command/response handler-Footnote-217222941
Node: asyncore --- Asynchronous socket handler17223000
Ref: library/asyncore doc17223219
Ref: 4e4417223219
Ref: library/asyncore asyncore-asynchronous-socket-handler17223219
Ref: 4e4517223219
Ref: library/asyncore module-asyncore17223219
Ref: c17223219
Ref: library/asyncore translation-repo17223219
Ref: 4e4617223219
Ref: asyncore --- Asynchronous socket handler-Footnote-117223748
Ref: asyncore --- Asynchronous socket handler-Footnote-217223790
Node: audioop --- Manipulate raw audio data17223849
Ref: library/audioop doc17224059
Ref: 4e4717224059
Ref: library/audioop audioop-manipulate-raw-audio-data17224059
Ref: 4e4817224059
Ref: library/audioop module-audioop17224059
Ref: e17224059
Ref: library/audioop translation-repo17224059
Ref: 4e4917224059
Ref: audioop --- Manipulate raw audio data-Footnote-117224607
Ref: audioop --- Manipulate raw audio data-Footnote-217224649
Node: cgi --- Common Gateway Interface のサポート17224707
Ref: library/cgi doc17224920
Ref: 4e4a17224920
Ref: library/cgi cgi-common-gateway-interface-support17224920
Ref: 4e4b17224920
Ref: library/cgi module-cgi17224920
Ref: 1617224920
Ref: library/cgi translation-repo17224920
Ref: 4e4c17224920
Ref: cgi --- Common Gateway Interface のサポート-Footnote-117225778
Ref: cgi --- Common Gateway Interface のサポート-Footnote-217225820
Ref: cgi --- Common Gateway Interface のサポート-Footnote-317225865
Node: cgitb --- Traceback manager for CGI scripts17225919
Ref: library/cgitb doc17226126
Ref: 4e4d17226126
Ref: library/cgitb cgitb-traceback-manager-for-cgi-scripts17226126
Ref: 4e4e17226126
Ref: library/cgitb module-cgitb17226126
Ref: 1717226126
Ref: library/cgitb translation-repo17226126
Ref: 4e4f17226126
Ref: cgitb --- Traceback manager for CGI scripts-Footnote-117226847
Ref: cgitb --- Traceback manager for CGI scripts-Footnote-217226889
Ref: cgitb --- Traceback manager for CGI scripts-Footnote-317226934
Node: chunk --- Read IFF chunked data17226990
Ref: library/chunk doc17227191
Ref: 4e5017227191
Ref: library/chunk chunk-read-iff-chunked-data17227191
Ref: 4e5117227191
Ref: library/chunk module-chunk17227191
Ref: 1817227191
Ref: library/chunk translation-repo17227191
Ref: 4e5217227191
Ref: chunk --- Read IFF chunked data-Footnote-117227725
Ref: chunk --- Read IFF chunked data-Footnote-217227767
Node: crypt --- Function to check Unix passwords17227823
Ref: library/crypt doc17228033
Ref: 4e5317228033
Ref: library/crypt crypt-function-to-check-unix-passwords17228033
Ref: 4e5417228033
Ref: library/crypt module-crypt17228033
Ref: 2c17228033
Ref: library/crypt translation-repo17228033
Ref: 4e5517228033
Ref: crypt --- Function to check Unix passwords-Footnote-117228844
Ref: crypt --- Function to check Unix passwords-Footnote-217228886
Ref: crypt --- Function to check Unix passwords-Footnote-317228932
Ref: crypt --- Function to check Unix passwords-Footnote-417228973
Ref: crypt --- Function to check Unix passwords-Footnote-517229019
Node: distutils --- Building and installing Python modules17229075
Ref: library/distutils doc17229295
Ref: 4e5617229295
Ref: library/distutils distutils-building-and-installing-python-modules17229295
Ref: 4e5717229295
Ref: library/distutils module-distutils17229295
Ref: 3d17229295
Ref: library/distutils translation-repo17229295
Ref: 4e5817229295
Ref: distutils --- Building and installing Python modules-Footnote-117229820
Ref: distutils --- Building and installing Python modules-Footnote-217229862
Ref: distutils --- Building and installing Python modules-Footnote-317229921
Node: imghdr --- Determine the type of an image17229981
Ref: library/imghdr doc17230194
Ref: 4e5917230194
Ref: library/imghdr imghdr-determine-the-type-of-an-image17230194
Ref: 4e5a17230194
Ref: library/imghdr module-imghdr17230194
Ref: 7917230194
Ref: library/imghdr translation-repo17230194
Ref: 4e5b17230194
Ref: imghdr --- Determine the type of an image-Footnote-117230922
Ref: imghdr --- Determine the type of an image-Footnote-217230964
Ref: imghdr --- Determine the type of an image-Footnote-317231007
Ref: imghdr --- Determine the type of an image-Footnote-417231051
Ref: imghdr --- Determine the type of an image-Footnote-517231098
Node: imp --- Access the import internals17231155
Ref: library/imp doc17231349
Ref: 4e5c17231349
Ref: library/imp imp-access-the-import-internals17231349
Ref: 4e5d17231349
Ref: library/imp module-imp17231349
Ref: 7a17231349
Ref: library/imp translation-repo17231349
Ref: 4e5e17231349
Ref: imp --- Access the import internals-Footnote-117231871
Node: mailcap --- Mailcap file handling17231925
Ref: library/mailcap doc17232129
Ref: 4e5f17232129
Ref: library/mailcap mailcap-mailcap-file-handling17232129
Ref: 4e6017232129
Ref: library/mailcap module-mailcap17232129
Ref: 9017232129
Ref: library/mailcap translation-repo17232129
Ref: 4e6117232129
Ref: mailcap --- Mailcap file handling-Footnote-117232671
Ref: mailcap --- Mailcap file handling-Footnote-217232713
Node: msilib --- Read and write Microsoft Installer files17232771
Ref: library/msilib doc17232985
Ref: 4e6217232985
Ref: library/msilib module-msilib17232985
Ref: 9617232985
Ref: library/msilib msilib-read-and-write-microsoft-installer-files17232985
Ref: 4e6317232985
Ref: library/msilib translation-repo17232985
Ref: 4e6417232985
Ref: msilib --- Read and write Microsoft Installer files-Footnote-117233562
Ref: msilib --- Read and write Microsoft Installer files-Footnote-217233604
Node: nis --- Interface to Sun’s NIS Yellow Pages17233661
Ref: library/nis doc17233874
Ref: 4e6517233874
Ref: library/nis module-nis17233874
Ref: a017233874
Ref: library/nis nis-interface-to-suns-nis-yellow-pages17233874
Ref: 4e6617233874
Ref: library/nis translation-repo17233874
Ref: 4e6717233874
Ref: nis --- Interface to Sun’s NIS Yellow Pages-Footnote-117234438
Ref: nis --- Interface to Sun’s NIS Yellow Pages-Footnote-217234480
Node: nntplib --- NNTP protocol client17234534
Ref: library/nntplib doc17234750
Ref: 4e6817234750
Ref: library/nntplib module-nntplib17234750
Ref: a117234750
Ref: library/nntplib nntplib-nntp-protocol-client17234750
Ref: 4e6917234750
Ref: library/nntplib translation-repo17234750
Ref: 4e6a17234750
Ref: nntplib --- NNTP protocol client-Footnote-117235290
Ref: nntplib --- NNTP protocol client-Footnote-217235332
Node: ossaudiodev --- Access to OSS-compatible audio devices17235390
Ref: library/ossaudiodev doc17235599
Ref: 4e6b17235599
Ref: library/ossaudiodev module-ossaudiodev17235599
Ref: a717235599
Ref: library/ossaudiodev ossaudiodev-access-to-oss-compatible-audio-devices17235599
Ref: 4e6c17235599
Ref: library/ossaudiodev translation-repo17235599
Ref: 4e6d17235599
Ref: ossaudiodev --- Access to OSS-compatible audio devices-Footnote-117236187
Ref: ossaudiodev --- Access to OSS-compatible audio devices-Footnote-217236229
Node: pipes --- Interface to shell pipelines17236291
Ref: library/pipes doc17236489
Ref: 4e6e17236489
Ref: library/pipes module-pipes17236489
Ref: ad17236489
Ref: library/pipes pipes-interface-to-shell-pipelines17236489
Ref: 4e6f17236489
Ref: library/pipes translation-repo17236489
Ref: 4e7017236489
Ref: pipes --- Interface to shell pipelines-Footnote-117237106
Ref: pipes --- Interface to shell pipelines-Footnote-217237148
Node: smtpd --- SMTP Server17237204
Ref: library/smtpd doc17237387
Ref: 4e7117237387
Ref: library/smtpd module-smtpd17237387
Ref: ce17237387
Ref: library/smtpd smtpd-smtp-server17237387
Ref: 4e7217237387
Ref: library/smtpd translation-repo17237387
Ref: 4e7317237387
Ref: smtpd --- SMTP Server-Footnote-117237948
Ref: smtpd --- SMTP Server-Footnote-217237990
Ref: smtpd --- SMTP Server-Footnote-317238033
Node: sndhdr --- Determine type of sound file17238089
Ref: library/sndhdr doc17238271
Ref: 4e7417238271
Ref: library/sndhdr module-sndhdr17238271
Ref: d017238271
Ref: library/sndhdr sndhdr-determine-type-of-sound-file17238271
Ref: 4e7517238271
Ref: library/sndhdr translation-repo17238271
Ref: 4e7617238271
Ref: sndhdr --- Determine type of sound file-Footnote-117238993
Ref: sndhdr --- Determine type of sound file-Footnote-217239035
Ref: sndhdr --- Determine type of sound file-Footnote-317239078
Ref: sndhdr --- Determine type of sound file-Footnote-417239122
Ref: sndhdr --- Determine type of sound file-Footnote-517239169
Node: spwd --- The shadow password database17239226
Ref: library/spwd doc17239424
Ref: 4e7717239424
Ref: library/spwd module-spwd17239424
Ref: d317239424
Ref: library/spwd spwd-the-shadow-password-database17239424
Ref: 4e7817239424
Ref: library/spwd translation-repo17239424
Ref: 4e7917239424
Ref: spwd --- The shadow password database-Footnote-117240107
Ref: spwd --- The shadow password database-Footnote-217240149
Ref: spwd --- The shadow password database-Footnote-317240194
Node: sunau --- Read and write Sun AU files17240249
Ref: library/sunau doc17240435
Ref: 4e7a17240435
Ref: library/sunau module-sunau17240435
Ref: dd17240435
Ref: library/sunau sunau-read-and-write-sun-au-files17240435
Ref: 4e7b17240435
Ref: library/sunau translation-repo17240435
Ref: 4e7c17240435
Ref: sunau --- Read and write Sun AU files-Footnote-117240983
Ref: sunau --- Read and write Sun AU files-Footnote-217241025
Node: telnetlib --- Telnet client17241081
Ref: library/telnetlib doc17241269
Ref: 4e7d17241269
Ref: library/telnetlib module-telnetlib17241269
Ref: e517241269
Ref: library/telnetlib telnetlib-telnet-client17241269
Ref: 4e7e17241269
Ref: library/telnetlib translation-repo17241269
Ref: 4e7f17241269
Ref: telnetlib --- Telnet client-Footnote-117241955
Ref: telnetlib --- Telnet client-Footnote-217241997
Ref: telnetlib --- Telnet client-Footnote-317242042
Ref: telnetlib --- Telnet client-Footnote-417242085
Node: uu --- Encode and decode uuencode files17242145
Ref: library/uu doc17242333
Ref: 4e8017242333
Ref: library/uu module-uu17242333
Ref: 11517242333
Ref: library/uu translation-repo17242333
Ref: 4e8117242333
Ref: library/uu uu-encode-and-decode-uuencode-files17242333
Ref: 4e8217242333
Ref: uu --- Encode and decode uuencode files-Footnote-117242882
Ref: uu --- Encode and decode uuencode files-Footnote-217242924
Node: xdrlib --- Encode and decode XDR data17242977
Ref: library/xdrlib doc17243129
Ref: 4e8317243129
Ref: library/xdrlib module-xdrlib17243129
Ref: 12517243129
Ref: library/xdrlib translation-repo17243129
Ref: 4e8417243129
Ref: library/xdrlib xdrlib-encode-and-decode-xdr-data17243129
Ref: 4e8517243129
Ref: library/security_warnings security-warnings17243642
Ref: 4e8617243642
Ref: xdrlib --- Encode and decode XDR data-Footnote-117243678
Ref: xdrlib --- Encode and decode XDR data-Footnote-217243720
Node: セキュリティで考慮すべき点<6>17243777
Ref: library/security_warnings doc17243923
Ref: 4e8717243923
Ref: library/security_warnings security-considerations17243923
Ref: 4e8817243923
Ref: library/security_warnings translation-repo17243923
Ref: 4e8917243923
Ref: セキュリティで考慮すべき点<6>-Footnote-117245713
Node: Python インタプリタの拡張と埋め込み17245772
Ref: extending/index doc17245953
Ref: 4e8a17245953
Ref: extending/index extending-and-embedding-the-python-interpreter17245953
Ref: 4e8b17245953
Ref: extending/index extending-index17245953
Ref: 1fbd17245953
Ref: extending/index translation-repo17245953
Ref: 4e8c17245953
Node: おすすめのサードパーティツール17247936
Ref: extending/index recommended-third-party-tools17248130
Ref: 4e8d17248130
Node: サードパーティツールなしで拡張を作る17248554
Ref: extending/index creating-extensions-without-third-party-tools17248837
Ref: 4e8f17248837
Ref: サードパーティツールなしで拡張を作る-Footnote-117249696
Node: C や C++ による Python の拡張17249738
Ref: extending/extending doc17249917
Ref: 4e9017249917
Ref: extending/extending extending-intro17249917
Ref: 4e9117249917
Ref: extending/extending extending-python-with-c-or-c17249917
Ref: 4e9217249917
Ref: C や C++ による Python の拡張-Footnote-117252403
Node: 簡単な例17252440
Ref: extending/extending a-simple-example17252565
Ref: 4e9317252565
Ref: extending/extending extending-simpleexample17252565
Ref: 4e9417252565
Ref: 簡単な例-Footnote-117257820
Node: 幕間小話 エラーと例外17258025
Ref: extending/extending extending-errors17258171
Ref: 4e9517258171
Ref: extending/extending intermezzo-errors-and-exceptions17258171
Ref: 4e9617258171
Node: 例に戻る17267366
Ref: extending/extending back-to-the-example17267560
Ref: 4e9d17267560
Ref: extending/extending backtoexample17267560
Ref: 4e9e17267560
Node: モジュールのメソッドテーブルと初期化関数17269472
Ref: extending/extending methodtable17269662
Ref: 4ea017269662
Ref: extending/extending the-module-s-method-table-and-initialization-function17269662
Ref: 4ea117269662
Node: コンパイルとリンク17274842
Ref: extending/extending compilation17275057
Ref: 4ea517275057
Ref: extending/extending compilation-and-linkage17275057
Ref: 4ea617275057
Node: C から Python 関数を呼び出す17277050
Ref: extending/extending calling-python-functions-from-c17277256
Ref: 4ea817277256
Ref: extending/extending callingpython17277256
Ref: 4ea917277256
Node: 拡張モジュール関数でのパラメタ展開17286236
Ref: extending/extending extracting-parameters-in-extension-functions17286472
Ref: 4ead17286472
Ref: extending/extending parsetuple17286472
Ref: 4eaa17286472
Node: 拡張モジュール関数のキーワードパラメタ17289550
Ref: extending/extending keyword-parameters-for-extension-functions17289776
Ref: 4eae17289776
Ref: extending/extending parsetupleandkeywords17289776
Ref: 4eaf17289776
Node: 任意の値を構築する17292752
Ref: extending/extending building-arbitrary-values17292948
Ref: 4eb017292948
Ref: extending/extending buildvalue17292948
Ref: 4eb117292948
Node: 参照カウント法17295485
Ref: extending/extending refcounts17295660
Ref: 4eab17295660
Ref: extending/extending reference-counts17295660
Ref: 4eb217295660
Node: Python における参照カウント法17301722
Ref: extending/extending refcountsinpython17301859
Ref: 4eb317301859
Ref: extending/extending reference-counting-in-python17301859
Ref: 4eb417301859
Ref: Python における参照カウント法-Footnote-117305129
Ref: Python における参照カウント法-Footnote-217305328
Node: 所有権にまつわる規則17305587
Ref: extending/extending ownership-rules17305739
Ref: 4eb517305739
Ref: extending/extending ownershiprules17305739
Ref: 4eb617305739
Node: 薄氷17308916
Ref: extending/extending thin-ice17309045
Ref: 4eba17309045
Ref: extending/extending thinice17309045
Ref: 4ebb17309045
Ref: 薄氷-Footnote-117313043
Node: NULL ポインタ17313085
Ref: extending/extending null-pointers17313175
Ref: 4ebe17313175
Ref: extending/extending nullpointers17313175
Ref: 4ebf17313175
Ref: NULL ポインタ-Footnote-117315523
Node: C++での拡張モジュール作成17315723
Ref: extending/extending cplusplus17315917
Ref: 4ec017315917
Ref: extending/extending writing-extensions-in-c17315917
Ref: 4ec117315917
Node: 拡張モジュールに C API を提供する17316998
Ref: extending/extending providing-a-c-api-for-an-extension-module17317162
Ref: 4ec217317162
Ref: extending/extending using-capsules17317162
Ref: 157517317162
Node: 拡張の型の定義 チュートリアル17327428
Ref: extending/newtypes_tutorial doc17327659
Ref: 1bbb17327659
Ref: extending/newtypes_tutorial defining-extension-types-tutorial17327659
Ref: 4ec417327659
Ref: extending/newtypes_tutorial defining-new-types17327659
Ref: 4ec517327659
Ref: extending/newtypes_tutorial translation-repo17327659
Ref: 4ec617327659
Node: 基本的なこと17328440
Ref: extending/newtypes_tutorial dnt-basics17328610
Ref: 4ec717328610
Ref: extending/newtypes_tutorial the-basics17328610
Ref: 4ec817328610
Node: 基本のサンプルにデータとメソッドを追加する17340338
Ref: extending/newtypes_tutorial adding-data-and-methods-to-the-basic-example17340559
Ref: 4ece17340559
Ref: 基本のサンプルにデータとメソッドを追加する-Footnote-117358893
Ref: 基本のサンプルにデータとメソッドを追加する-Footnote-217359026
Node: データ属性をこまかく制御する17359161
Ref: extending/newtypes_tutorial providing-finer-control-over-data-attributes17359421
Ref: 4ed617359421
Ref: データ属性をこまかく制御する-Footnote-117369699
Node: 循環ガベージコレクションをサポートする17370073
Ref: extending/newtypes_tutorial supporting-cyclic-garbage-collection17370306
Ref: 4ed817370306
Ref: 循環ガベージコレクションをサポートする-Footnote-117381681
Node: 他の型のサブクラスを作る17381855
Ref: extending/newtypes_tutorial subclassing-other-types17382037
Ref: 4eda17382037
Node: 拡張の型の定義 雑多なトピック17387480
Ref: extending/newtypes doc17387709
Ref: 4edc17387709
Ref: extending/newtypes defining-extension-types-assorted-topics17387709
Ref: 4edd17387709
Ref: extending/newtypes new-types-topics17387709
Ref: 4ede17387709
Ref: extending/newtypes translation-repo17387709
Ref: 4edf17387709
Ref: extending/newtypes dnt-type-methods17387798
Ref: 4ee017387798
Node: ファイナライズとメモリ解放17393782
Ref: extending/newtypes finalization-and-de-allocation17393934
Ref: 4ee117393934
Ref: ファイナライズとメモリ解放-Footnote-117398359
Node: オブジェクト表現17398401
Ref: extending/newtypes object-presentation17398583
Ref: 4ee317398583
Node: 属性を管理する17400672
Ref: extending/newtypes attribute-management17400842
Ref: 4ee617400842
Node: 総称的な属性を管理する17402397
Ref: extending/newtypes generic-attribute-management17402539
Ref: 4ed317402539
Ref: extending/newtypes id117402539
Ref: 4ee717402539
Node: 特定の型に特化した属性の管理17406567
Ref: extending/newtypes type-specific-attribute-management17406709
Ref: 4eec17406709
Node: オブジェクトの比較17408523
Ref: extending/newtypes object-comparison17408711
Ref: 4eef17408711
Node: 抽象的なプロトコルのサポート17410592
Ref: extending/newtypes abstract-protocol-support17410799
Ref: 4ef217410799
Node: 弱参照 Weak Reference のサポート17417045
Ref: extending/newtypes weak-reference-support17417246
Ref: 4ef717417246
Ref: extending/newtypes weakref-support17417246
Ref: 29cf17417246
Node: その他いろいろ17418522
Ref: extending/newtypes more-suggestions17418672
Ref: 4ef817418672
Node: C および C++ 拡張のビルド17419638
Ref: extending/building doc17419891
Ref: 4ef917419891
Ref: extending/building building17419891
Ref: 4ea717419891
Ref: extending/building building-c-and-c-extensions17419891
Ref: 4efa17419891
Ref: extending/building translation-repo17419891
Ref: 4efb17419891
Ref: extending/building install-index17420181
Ref: 10f917420181
Node: setuptools による C および C++ 拡張のビルド17420252
Ref: extending/building building-c-and-c-extensions-with-setuptools17420378
Ref: 4efd17420378
Ref: extending/building setuptools-index17420378
Ref: 10fa17420378
Node: Windows 上での C および C++ 拡張モジュールのビルド17420965
Ref: extending/windows doc17421166
Ref: 4efe17421166
Ref: extending/windows building-c-and-c-extensions-on-windows17421166
Ref: 4eff17421166
Ref: extending/windows building-on-windows17421166
Ref: 222417421166
Ref: extending/windows translation-repo17421166
Ref: 4f0017421166
Node: 型どおりのアプローチ17422783
Ref: extending/windows a-cookbook-approach17422955
Ref: 4f0117422955
Ref: extending/windows win-cookbook17422955
Ref: 4f0217422955
Ref: 型どおりのアプローチ-Footnote-117423607
Node: Unix と Windows の相違点17423685
Ref: extending/windows differences-between-unix-and-windows17423885
Ref: 4f0317423885
Ref: extending/windows dynamic-linking17423885
Ref: 4f0417423885
Ref: extending/windows c Py_NO_LINK_LIB17428245
Ref: 44417428245
Node: DLL 使用の実際17428436
Ref: extending/windows using-dlls-in-practice17428597
Ref: 4f0517428597
Ref: extending/windows win-dlls17428597
Ref: 4f0617428597
Node: 大規模なアプリケーションへの Python ランタイムの埋め込み17431695
Ref: extending/index embedding-the-cpython-runtime-in-a-larger-application17431924
Ref: 4f0817431924
Node: 他のアプリケーションへの Python の埋め込み17432482
Ref: extending/embedding doc17432658
Ref: 4f0917432658
Ref: extending/embedding embedding17432658
Ref: 225b17432658
Ref: extending/embedding embedding-python-in-another-application17432658
Ref: 4f0a17432658
Node: 高水準の埋め込み17435980
Ref: extending/embedding high-level-embedding17436161
Ref: 4f0d17436161
Ref: extending/embedding very-high-level-embedding17436161
Ref: 4f0e17436161
Node: 超高水準の埋め込みから踏み出す 概要17438707
Ref: extending/embedding beyond-very-high-level-embedding-an-overview17438918
Ref: 4f0f17438918
Ref: extending/embedding lower-level-embedding17438918
Ref: 4f1017438918
Node: 純粋な埋め込み17441378
Ref: extending/embedding id117441600
Ref: 4f1117441600
Ref: extending/embedding pure-embedding17441600
Ref: 4f1217441600
Node: 埋め込まれた Python の拡張17446864
Ref: extending/embedding extending-embedded-python17447069
Ref: 4f1417447069
Ref: extending/embedding extending-with-embedding17447069
Ref: 4f1517447069
Node: C++による Python の埋め込み17449660
Ref: extending/embedding embedding-python-in-c17449903
Ref: 4f1617449903
Ref: extending/embedding embeddingincplusplus17449903
Ref: 4f1717449903
Node: Unix 系システムにおけるコンパイルとリンク17450410
Ref: extending/embedding compiling17450609
Ref: 4f1317450609
Ref: extending/embedding compiling-and-linking-under-unix-like-systems17450609
Ref: 4f1817450609
Node: Python/C API リファレンスマニュアル17453327
Ref: c-api/index doc17453523
Ref: 4f1a17453523
Ref: c-api/index c-api-index17453523
Ref: 1fbe17453523
Ref: c-api/index python-c-api-reference-manual17453523
Ref: 4f1b17453523
Ref: c-api/index translation-repo17453523
Ref: 4f1c17453523
Node: はじめに<14>17454994
Ref: c-api/intro doc17455120
Ref: 4f1d17455120
Ref: c-api/intro api-intro17455120
Ref: 4f1e17455120
Ref: c-api/intro introduction17455120
Ref: 4f1f17455120
Node: 言語バージョン互換性17457544
Ref: c-api/intro language-version-compatibility17457660
Ref: 4f2017457660
Node: コーディング基準17457965
Ref: c-api/intro coding-standards17458120
Ref: 4f2117458120
Ref: コーディング基準-Footnote-117458683
Node: インクルードファイル17458725
Ref: c-api/intro api-includes17458868
Ref: 98717458868
Ref: c-api/intro include-files17458868
Ref: 4f2217458868
Node: 便利なマクロ17462280
Ref: c-api/intro useful-macros17462450
Ref: 4f2317462450
Ref: c-api/intro c Py_CAN_START_THREADS17462777
Ref: 4f2417462777
Ref: c-api/intro c Py_GETENV17463088
Ref: 4f2517463088
Ref: 便利なマクロ-Footnote-117463412
Node: Docstring macros17463454
Ref: c-api/intro docstring-macros17463556
Ref: 4f2617463556
Ref: c-api/intro c PyDoc_STRVAR17463607
Ref: 1d5b17463607
Ref: c-api/intro c PyDoc_STR17464196
Ref: 1b9617464196
Ref: c-api/intro c PyDoc_VAR17464630
Ref: 1df017464630
Node: General utility macros17465003
Ref: c-api/intro general-utility-macros17465135
Ref: 4f2717465135
Ref: c-api/intro c Py_UNUSED17465265
Ref: 1a8a17465265
Ref: c-api/intro c Py_GCC_ATTRIBUTE17465522
Ref: 4f2817465522
Node: Numeric utilities17465937
Ref: c-api/intro numeric-utilities17466041
Ref: 4f2917466041
Ref: c-api/intro c Py_ABS17466094
Ref: 4f2a17466094
Ref: c-api/intro c Py_MAX17466535
Ref: 4f2b17466535
Ref: c-api/intro c Py_MIN17466569
Ref: 4f2c17466569
Ref: c-api/intro c Py_ARITHMETIC_RIGHT_SHIFT17466915
Ref: 4f2d17466915
Ref: c-api/intro c Py_CHARMASK17467879
Ref: 4f2e17467879
Node: Assertion utilities17468134
Ref: c-api/intro assertion-utilities17468266
Ref: 4f2f17468266
Ref: c-api/intro c Py_UNREACHABLE17468323
Ref: dae17468323
Ref: c-api/intro c Py_SAFE_DOWNCAST17469597
Ref: 4f3017469597
Ref: c-api/intro c Py_BUILD_ASSERT17470280
Ref: 19b317470280
Ref: c-api/intro c Py_BUILD_ASSERT_EXPR17470667
Ref: 19b417470667
Node: Type size utilities17471075
Ref: c-api/intro type-size-utilities17471216
Ref: 4f3117471216
Ref: c-api/intro c Py_ARRAY_LENGTH17471273
Ref: 4f3217471273
Ref: c-api/intro c Py_MEMBER_SIZE17471743
Ref: 4f3317471743
Node: Macro definition utilities17471954
Ref: c-api/intro macro-definition-utilities17472067
Ref: 4f3417472067
Ref: c-api/intro c Py_FORCE_EXPANSION17472138
Ref: 4f3517472138
Ref: c-api/intro c Py_STRINGIFY17472347
Ref: 4f3617472347
Node: Declaration utilities17472514
Ref: c-api/intro declaration-utilities17472645
Ref: 4f3717472645
Ref: c-api/intro c Py_ALWAYS_INLINE17472946
Ref: 1c6b17472946
Ref: c-api/intro c Py_NO_INLINE17474027
Ref: 180217474027
Ref: c-api/intro c Py_DEPRECATED17474424
Ref: c9b17474424
Ref: c-api/intro c Py_LOCAL17474798
Ref: 166317474798
Ref: c-api/intro c Py_LOCAL_INLINE17475038
Ref: 166417475038
Ref: c-api/intro c Py_LOCAL_SYMBOL17475180
Ref: 4f3817475180
Ref: c-api/intro c Py_EXPORTED_SYMBOL17475476
Ref: 4f3917475476
Ref: c-api/intro c Py_IMPORTED_SYMBOL17475844
Ref: 4f3a17475844
Ref: c-api/intro c PyAPI_FUNC17476085
Ref: 4f3b17476085
Ref: c-api/intro c PyAPI_DATA17476393
Ref: 4f3c17476393
Ref: Declaration utilities-Footnote-117476752
Node: Outdated macros17476817
Ref: c-api/intro outdated-macros17476917
Ref: 4f3d17476917
Ref: c-api/intro c Py_ALIGNED17477051
Ref: 4f3e17477051
Ref: c-api/intro c Py_LL17477243
Ref: 4f3f17477243
Ref: c-api/intro c Py_ULL17477278
Ref: 4f4017477278
Ref: c-api/intro c Py_MEMCPY17477660
Ref: 199017477660
Ref: c-api/intro c Py_VA_COPY17477900
Ref: 4f4117477900
Node: オブジェクト、型および参照カウント17478199
Ref: c-api/intro api-objects17478349
Ref: 4f4217478349
Ref: c-api/intro objects-types-and-reference-counts17478349
Ref: 4f4317478349
Node: 参照カウント法<2>17480217
Ref: c-api/intro api-refcounts17480344
Ref: 4f4417480344
Ref: c-api/intro reference-counts17480344
Ref: 4f4517480344
Node: 参照カウントの詳細17484273
Ref: c-api/intro api-refcountdetails17484361
Ref: 4f4617484361
Ref: c-api/intro reference-count-details17484361
Ref: 4f4717484361
Node: 型<2>17492758
Ref: c-api/intro api-types17492885
Ref: 4f4a17492885
Ref: c-api/intro types17492885
Ref: 4f4b17492885
Ref: c-api/intro c Py_ssize_t17493498
Ref: c5517493498
Ref: 型<2>-Footnote-117493915
Node: 例外<24>17493957
Ref: c-api/intro api-exceptions17494114
Ref: 4f4c17494114
Ref: c-api/intro exceptions17494114
Ref: 4f4d17494114
Node: Python の埋め込み<2>17502275
Ref: c-api/intro api-embedding17502422
Ref: 4f4f17502422
Ref: c-api/intro embedding-python17502422
Ref: 4f5017502422
Node: デバッグ版ビルド Debugging Builds17506505
Ref: c-api/intro api-debugging17506690
Ref: 4f5217506690
Ref: c-api/intro debugging-builds17506690
Ref: 4f5317506690
Ref: c-api/intro c Py_DEBUG17507591
Ref: 183417507591
Node: おすすめのサードパーティツール<2>17508928
Ref: c-api/intro c-api-tools17509079
Ref: 4e8e17509079
Ref: c-api/intro recommended-third-party-tools17509079
Ref: 4f5417509079
Ref: おすすめのサードパーティツール<2>-Footnote-117510532
Ref: おすすめのサードパーティツール<2>-Footnote-217510560
Ref: おすすめのサードパーティツール<2>-Footnote-317510596
Ref: おすすめのサードパーティツール<2>-Footnote-417510628
Ref: おすすめのサードパーティツール<2>-Footnote-517510671
Ref: おすすめのサードパーティツール<2>-Footnote-617510705
Ref: おすすめのサードパーティツール<2>-Footnote-717510746
Ref: おすすめのサードパーティツール<2>-Footnote-817510771
Ref: おすすめのサードパーティツール<2>-Footnote-917510800
Node: C API の安定性17510873
Ref: c-api/stable doc17511029
Ref: 4f5517511029
Ref: c-api/stable c-api-stability17511029
Ref: 4f5617511029
Ref: c-api/stable stable17511029
Ref: 77517511029
Ref: c-api/stable translation-repo17511029
Ref: 4f5717511029
Ref: C API の安定性-Footnote-117512658
Ref: C API の安定性-Footnote-217512700
Node: Unstable C API17512755
Ref: c-api/stable id117512878
Ref: 4f5917512878
Ref: c-api/stable unstable-c-api17512878
Ref: 76917512878
Node: 安定 ABI Stable Appliction Binary Interface17513376
Ref: c-api/stable id217513553
Ref: 4f5a17513553
Ref: c-api/stable stable-application-binary-interface17513553
Ref: 4f0717513553
Node: Limited C API17513957
Ref: c-api/stable id317514071
Ref: 4f5b17514071
Ref: c-api/stable limited-c-api17514071
Ref: 63717514071
Ref: c-api/stable c Py_LIMITED_API17514352
Ref: 66017514352
Node: Stable ABI17515449
Ref: c-api/stable id417515620
Ref: 4f5c17515620
Ref: c-api/stable stable-abi17515620
Ref: 4f5d17515620
Ref: Stable ABI-Footnote-117517396
Node: APIスコープとパフォーマンスの制限17517438
Ref: c-api/stable limited-api-scope-and-performance17517623
Ref: 4f5e17517623
Node: 制限付きAPIの注意点17519209
Ref: c-api/stable limited-api-caveats17519375
Ref: 4f6017519375
Node: プラットフォームで考慮すべき点17521480
Ref: c-api/stable platform-considerations17521664
Ref: 4f6117521664
Ref: c-api/stable stable-abi-platform17521664
Ref: 4f5817521664
Node: 限定版APIの内容17522382
Ref: c-api/stable contents-of-limited-api17522512
Ref: 4f6217522512
Ref: c-api/stable limited-api-list17522512
Ref: 99d17522512
Node: 超高水準レイヤ17565073
Ref: c-api/veryhigh doc17565231
Ref: 51bd17565231
Ref: c-api/veryhigh the-very-high-level-layer17565231
Ref: 51be17565231
Ref: c-api/veryhigh translation-repo17565231
Ref: 51bf17565231
Ref: c-api/veryhigh veryhigh17565231
Ref: 51c017565231
Ref: c-api/veryhigh c PyRun_AnyFile17566317
Ref: 51c517566317
Ref: c-api/veryhigh c PyRun_AnyFileFlags17566557
Ref: 51c717566557
Ref: c-api/veryhigh c PyRun_AnyFileEx17566807
Ref: 51c817566807
Ref: c-api/veryhigh c PyRun_AnyFileExFlags17567044
Ref: 51c617567044
Ref: c-api/veryhigh c PyRun_SimpleString17567894
Ref: 4f0b17567894
Ref: c-api/veryhigh c PyRun_SimpleStringFlags17568126
Ref: 51ca17568126
Ref: c-api/veryhigh c PyRun_SimpleFile17568905
Ref: 4f0c17568905
Ref: c-api/veryhigh c PyRun_SimpleFileEx17569152
Ref: 51cb17569152
Ref: c-api/veryhigh c PyRun_SimpleFileExFlags17569394
Ref: 1cca17569394
Ref: c-api/veryhigh c PyRun_InteractiveOneObject17570293
Ref: 51cc17570293
Ref: c-api/veryhigh c PyRun_InteractiveOne17571195
Ref: 51cd17571195
Ref: c-api/veryhigh c PyRun_InteractiveOneFlags17571418
Ref: 51ce17571418
Ref: c-api/veryhigh c PyRun_InteractiveLoop17571711
Ref: 51c917571711
Ref: c-api/veryhigh c PyRun_InteractiveLoopFlags17571936
Ref: 51cf17571936
Ref: c-api/veryhigh c PyOS_InputHook17572519
Ref: 7a417572519
Ref: c-api/veryhigh c PyOS_ReadlineFunctionPointer17573147
Ref: 7a517573147
Ref: c-api/veryhigh c PyRun_String17574538
Ref: 1dc017574538
Ref: c-api/veryhigh c PyRun_StringFlags17574837
Ref: 51d017574837
Ref: c-api/veryhigh c PyRun_File17575588
Ref: 51d217575588
Ref: c-api/veryhigh c PyRun_FileEx17575938
Ref: 51d417575938
Ref: c-api/veryhigh c PyRun_FileFlags17576275
Ref: 51d517576275
Ref: c-api/veryhigh c PyRun_FileExFlags17576625
Ref: 51d317576625
Ref: c-api/veryhigh c Py_CompileString17577359
Ref: a8517577359
Ref: c-api/veryhigh c Py_CompileStringFlags17577704
Ref: 51d617577704
Ref: c-api/veryhigh c Py_CompileStringObject17578028
Ref: 51d817578028
Ref: c-api/veryhigh c Py_CompileStringExFlags17579196
Ref: 51d717579196
Ref: c-api/veryhigh c PyEval_EvalCode17579669
Ref: a8617579669
Ref: c-api/veryhigh c PyEval_EvalCodeEx17580125
Ref: 1ada17580125
Ref: c-api/veryhigh c PyEval_EvalFrame17580940
Ref: 4fdb17580940
Ref: c-api/veryhigh c PyEval_EvalFrameEx17581294
Ref: 122f17581294
Ref: c-api/veryhigh c PyEval_MergeCompilerFlags17582231
Ref: 51d917582231
Ref: c-api/veryhigh c PyCompilerFlags17582441
Ref: c9817582441
Ref: c-api/veryhigh c PyCompilerFlags cf_flags17583062
Ref: 51da17583062
Ref: c-api/veryhigh c PyCompilerFlags cf_feature_version17583146
Ref: 51db17583146
Ref: c-api/veryhigh c PyCF_ALLOW_TOP_LEVEL_AWAIT17583594
Ref: 51dc17583594
Ref: c-api/veryhigh c PyCF_ONLY_AST17583646
Ref: 51dd17583646
Ref: c-api/veryhigh c PyCF_OPTIMIZED_AST17583685
Ref: 51de17583685
Ref: c-api/veryhigh c PyCF_TYPE_COMMENTS17583729
Ref: 51df17583729
Node: Available start symbols17584264
Ref: c-api/veryhigh available-start-symbols17584367
Ref: 51e217584367
Ref: c-api/veryhigh start-symbols17584367
Ref: 51d117584367
Ref: c-api/veryhigh c Py_eval_input17584428
Ref: 51c117584428
Ref: c-api/veryhigh c Py_file_input17584589
Ref: 51c217584589
Ref: c-api/veryhigh c Py_single_input17584931
Ref: 51c317584931
Ref: c-api/veryhigh c Py_func_type_input17585175
Ref: 51c417585175
Ref: Available start symbols-Footnote-117585618
Ref: Available start symbols-Footnote-217585660
Node: Stack Effects17585702
Ref: c-api/veryhigh stack-effects17585805
Ref: 51e317585805
Ref: c-api/veryhigh c PY_INVALID_STACK_EFFECT17585892
Ref: 51e417585892
Ref: c-api/veryhigh c PyCompile_OpcodeStackEffect17586077
Ref: 51e517586077
Ref: c-api/veryhigh c PyCompile_OpcodeStackEffectWithJump17586392
Ref: 1e3217586392
Node: 参照カウント17586921
Ref: c-api/refcounting doc17587073
Ref: 51e617587073
Ref: c-api/refcounting countingrefs17587073
Ref: 51e717587073
Ref: c-api/refcounting reference-counting17587073
Ref: 51e817587073
Ref: c-api/refcounting translation-repo17587073
Ref: 51e917587073
Ref: c-api/refcounting c Py_REFCNT17587251
Ref: 2cf17587251
Ref: c-api/refcounting c Py_SET_REFCNT17588721
Ref: aa817588721
Ref: c-api/refcounting c Py_INCREF17589302
Ref: 78f17589302
Ref: c-api/refcounting c Py_XINCREF17590366
Ref: c5a17590366
Ref: c-api/refcounting c Py_NewRef17590572
Ref: a9a17590572
Ref: c-api/refcounting c Py_XNewRef17591300
Ref: a9b17591300
Ref: c-api/refcounting c Py_DECREF17591625
Ref: 79017591625
Ref: c-api/refcounting c Py_XDECREF17593381
Ref: 99217593381
Ref: c-api/refcounting c Py_CLEAR17593621
Ref: 79817593621
Ref: c-api/refcounting c Py_IncRef17594460
Ref: 513217594460
Ref: c-api/refcounting c Py_DecRef17594745
Ref: 512a17594745
Ref: c-api/refcounting c Py_SETREF17595018
Ref: 79917595018
Ref: c-api/refcounting c Py_XSETREF17595784
Ref: 79a17595784
Ref: 参照カウント-Footnote-117596174
Ref: 参照カウント-Footnote-217596216
Node: 例外処理17596258
Ref: c-api/exceptions doc17596419
Ref: 51ea17596419
Ref: c-api/exceptions exception-handling17596419
Ref: 51eb17596419
Ref: c-api/exceptions exceptionhandling17596419
Ref: 498817596419
Ref: c-api/exceptions translation-repo17596419
Ref: 51ec17596419
Node: 出力とクリア17599546
Ref: c-api/exceptions printing-and-clearing17599637
Ref: 51ed17599637
Ref: c-api/exceptions c PyErr_Clear17599682
Ref: 123217599682
Ref: c-api/exceptions c PyErr_PrintEx17599929
Ref: 4fce17599929
Ref: c-api/exceptions c PyErr_Print17601099
Ref: 1d2c17601099
Ref: c-api/exceptions c PyErr_WriteUnraisable17601246
Ref: 5f217601246
Ref: c-api/exceptions c PyErr_FormatUnraisable17602306
Ref: 5f117602306
Ref: c-api/exceptions c PyErr_DisplayException17602821
Ref: 43517602821
Node: 例外の送出17603115
Ref: c-api/exceptions raising-exceptions17603224
Ref: 51ee17603224
Ref: c-api/exceptions c PyErr_SetString17603521
Ref: 79c17603521
Ref: c-api/exceptions c PyErr_SetObject17604045
Ref: 79b17604045
Ref: c-api/exceptions c PyErr_Format17604356
Ref: 10b117604356
Ref: c-api/exceptions c PyErr_FormatV17604951
Ref: 10b017604951
Ref: c-api/exceptions c PyErr_SetNone17605347
Ref: 4fd717605347
Ref: c-api/exceptions c PyErr_BadArgument17605536
Ref: 4fcb17605536
Ref: c-api/exceptions c PyErr_NoMemory17605904
Ref: 4e9917605904
Ref: c-api/exceptions c PyErr_SetFromErrno17606324
Ref: 4e9817606324
Ref: c-api/exceptions c PyErr_SetFromErrnoWithFilenameObject17607261
Ref: 4fd317607261
Ref: c-api/exceptions c PyErr_SetFromErrnoWithFilenameObjects17607803
Ref: 4fd417607803
Ref: c-api/exceptions c PyErr_SetFromErrnoWithFilename17608358
Ref: 1a8517608358
Ref: c-api/exceptions c PyErr_SetFromWindowsErr17608850
Ref: 4fd517608850
Ref: c-api/exceptions c PyErr_SetExcFromWindowsErr17609777
Ref: 4fd017609777
Ref: c-api/exceptions c PyErr_SetFromWindowsErrWithFilename17610199
Ref: 1a8717610199
Ref: c-api/exceptions c PyErr_SetExcFromWindowsErrWithFilenameObject17610850
Ref: 4fd117610850
Ref: c-api/exceptions c PyErr_SetExcFromWindowsErrWithFilenameObjects17611463
Ref: 4fd217611463
Ref: c-api/exceptions c PyErr_SetExcFromWindowsErrWithFilename17611993
Ref: 1a8617611993
Ref: c-api/exceptions c PyErr_SetImportError17612471
Ref: f3917612471
Ref: c-api/exceptions c PyErr_SetImportErrorSubclass17613081
Ref: f1217613081
Ref: c-api/exceptions c PyErr_SyntaxLocationObject17613573
Ref: 51ef17613573
Ref: c-api/exceptions c PyErr_RangedSyntaxLocationObject17614023
Ref: 51f017614023
Ref: c-api/exceptions c PyErr_SyntaxLocationEx17614373
Ref: 4fd917614373
Ref: c-api/exceptions c PyErr_SyntaxLocation17614832
Ref: 4fd817614832
Ref: c-api/exceptions c PyErr_BadInternalCall17615097
Ref: 4fcc17615097
Ref: c-api/exceptions c PyErr_ProgramTextObject17615505
Ref: 51f117615505
Ref: c-api/exceptions c PyErr_ProgramText17615896
Ref: 4fcf17615896
Node: 警告<3>17616263
Ref: c-api/exceptions issuing-warnings17616399
Ref: 51f217616399
Ref: c-api/exceptions c PyErr_WarnEx17617452
Ref: 166517617452
Ref: c-api/exceptions c PyErr_WarnExplicitObject17618982
Ref: 51f417618982
Ref: c-api/exceptions c PyErr_WarnExplicit17619634
Ref: 1a8d17619634
Ref: c-api/exceptions c PyErr_WarnFormat17620188
Ref: 4fda17620188
Ref: c-api/exceptions c PyErr_WarnExplicitFormat17620643
Ref: 51f517620643
Ref: c-api/exceptions c PyErr_ResourceWarning17621031
Ref: f1317621031
Node: エラーインジケータの問い合わせ17621432
Ref: c-api/exceptions querying-the-error-indicator17621586
Ref: 51f617621586
Ref: c-api/exceptions c PyErr_Occurred17621676
Ref: 1caf17621676
Ref: c-api/exceptions c PyErr_ExceptionMatches17622853
Ref: 4f4e17622853
Ref: c-api/exceptions c PyErr_GivenExceptionMatches17623238
Ref: 4fcd17623238
Ref: c-api/exceptions c PyErr_GetRaisedException17623802
Ref: 42917623802
Ref: c-api/exceptions c PyErr_SetRaisedException17624786
Ref: 42c17624786
Ref: c-api/exceptions c PyErr_Fetch17625170
Ref: 42817625170
Ref: c-api/exceptions c PyErr_Restore17626493
Ref: 42b17626493
Ref: c-api/exceptions c PyErr_NormalizeException17627670
Ref: 42a17627670
Ref: c-api/exceptions c PyErr_GetHandledException17628911
Ref: 97317628911
Ref: c-api/exceptions c PyErr_SetHandledException17629847
Ref: 97417629847
Ref: c-api/exceptions c PyErr_GetExcInfo17630639
Ref: 97617630639
Ref: c-api/exceptions c PyErr_SetExcInfo17631742
Ref: 97517631742
Node: シグナルハンドリング<2>17633040
Ref: c-api/exceptions signal-handling17633203
Ref: 51f717633203
Ref: c-api/exceptions c PyErr_CheckSignals17633268
Ref: 69317633268
Ref: c-api/exceptions c PyErr_SetInterrupt17634532
Ref: 4fd617634532
Ref: c-api/exceptions c PyErr_SetInterruptEx17634921
Ref: a9e17634921
Ref: c-api/exceptions c PySignal_SetWakeupFd17636111
Ref: 15f417636111
Node: 例外クラス<2>17637035
Ref: c-api/exceptions exception-classes17637177
Ref: 51f817637177
Ref: c-api/exceptions c PyErr_NewException17637217
Ref: 148117637217
Ref: c-api/exceptions c PyErr_NewExceptionWithDoc17638392
Ref: 148017638392
Ref: c-api/exceptions c PyExceptionClass_Check17638892
Ref: 51f917638892
Ref: c-api/exceptions c PyExceptionClass_Name17639057
Ref: c5b17639057
Node: 例外オブジェクト17639267
Ref: c-api/exceptions exception-objects17639408
Ref: 51fa17639408
Ref: c-api/exceptions c PyExceptionInstance_Check17639463
Ref: 51fb17639463
Ref: c-api/exceptions c PyExceptionInstance_Class17639650
Ref: 51fc17639650
Ref: c-api/exceptions c PyException_GetTraceback17639746
Ref: 502117639746
Ref: c-api/exceptions c PyException_SetTraceback17640163
Ref: 1dce17640163
Ref: c-api/exceptions c PyException_GetContext17640437
Ref: 502017640437
Ref: c-api/exceptions c PyException_SetContext17640903
Ref: 502317640903
Ref: c-api/exceptions c PyException_GetCause17641327
Ref: 501f17641327
Ref: c-api/exceptions c PyException_SetCause17641723
Ref: 502217641723
Ref: c-api/exceptions c PyException_GetArgs17642194
Ref: 78b17642194
Ref: c-api/exceptions c PyException_SetArgs17642432
Ref: 78c17642432
Ref: c-api/exceptions c PyUnstable_Exc_PrepReraiseStar17642643
Ref: 51fd17642643
Node: Unicode 例外オブジェクト17643636
Ref: c-api/exceptions unicode-exception-objects17643774
Ref: 51fe17643774
Ref: c-api/exceptions unicodeexceptions17643774
Ref: 46117643774
Ref: c-api/exceptions c PyUnicodeDecodeError_Create17643958
Ref: 50dd17643958
Ref: c-api/exceptions c PyUnicodeDecodeError_GetEncoding17644490
Ref: 50de17644490
Ref: c-api/exceptions c PyUnicodeEncodeError_GetEncoding17644588
Ref: 50e617644588
Ref: c-api/exceptions c PyUnicodeDecodeError_GetObject17644855
Ref: 50e017644855
Ref: c-api/exceptions c PyUnicodeEncodeError_GetObject17644951
Ref: 50e717644951
Ref: c-api/exceptions c PyUnicodeTranslateError_GetObject17645047
Ref: 50ee17645047
Ref: c-api/exceptions c PyUnicodeDecodeError_GetStart17645313
Ref: 50e217645313
Ref: c-api/exceptions c PyUnicodeEncodeError_GetStart17645409
Ref: 18fe17645409
Ref: c-api/exceptions c PyUnicodeTranslateError_GetStart17645505
Ref: 50f017645505
Ref: c-api/exceptions c PyUnicodeDecodeError_SetStart17646137
Ref: 50e517646137
Ref: c-api/exceptions c PyUnicodeEncodeError_SetStart17646232
Ref: 50eb17646232
Ref: c-api/exceptions c PyUnicodeTranslateError_SetStart17646327
Ref: 50f317646327
Ref: c-api/exceptions c PyUnicodeDecodeError_GetEnd17646775
Ref: 50df17646775
Ref: c-api/exceptions c PyUnicodeEncodeError_GetEnd17646867
Ref: 18fb17646867
Ref: c-api/exceptions c PyUnicodeTranslateError_GetEnd17646959
Ref: 50ed17646959
Ref: c-api/exceptions c PyUnicodeDecodeError_SetEnd17647509
Ref: 50e317647509
Ref: c-api/exceptions c PyUnicodeEncodeError_SetEnd17647600
Ref: 50e917647600
Ref: c-api/exceptions c PyUnicodeTranslateError_SetEnd17647691
Ref: 50f117647691
Ref: c-api/exceptions c PyUnicodeDecodeError_GetReason17648064
Ref: 50e117648064
Ref: c-api/exceptions c PyUnicodeEncodeError_GetReason17648160
Ref: 50e817648160
Ref: c-api/exceptions c PyUnicodeTranslateError_GetReason17648256
Ref: 50ef17648256
Ref: c-api/exceptions c PyUnicodeDecodeError_SetReason17648519
Ref: 50e417648519
Ref: c-api/exceptions c PyUnicodeEncodeError_SetReason17648617
Ref: 50ea17648617
Ref: c-api/exceptions c PyUnicodeTranslateError_SetReason17648715
Ref: 50f217648715
Node: 再帰の管理17649043
Ref: c-api/exceptions recursion17649184
Ref: 51ff17649184
Ref: c-api/exceptions recursion-control17649184
Ref: 520017649184
Ref: c-api/exceptions c Py_EnterRecursiveCall17649607
Ref: 3d217649607
Ref: c-api/exceptions c Py_LeaveRecursiveCall17650530
Ref: b6b17650530
Ref: c-api/exceptions c Py_ReprEnter17651413
Ref: 513517651413
Ref: c-api/exceptions c Py_ReprLeave17652412
Ref: 513617652412
Ref: c-api/exceptions c Py_GetRecursionLimit17652693
Ref: 513017652693
Ref: c-api/exceptions c Py_SetRecursionLimit17653169
Ref: 513717653169
Node: Exception and warning types17653505
Ref: c-api/exceptions exception-and-warning-types17653624
Ref: 520117653624
Ref: c-api/exceptions standardexceptions17653624
Ref: 520217653624
Node: Exception types17654039
Ref: c-api/exceptions exception-types17654142
Ref: 520317654142
Ref: c-api/exceptions c PyExc_BaseException17654517
Ref: 4fe217654517
Ref: c-api/exceptions c PyExc_BaseExceptionGroup17654708
Ref: 4fe317654708
Ref: c-api/exceptions c PyExc_Exception17654958
Ref: 4ff117654958
Ref: c-api/exceptions c PyExc_ArithmeticError17655083
Ref: 4fdf17655083
Ref: c-api/exceptions c PyExc_AssertionError17655277
Ref: 4fe017655277
Ref: c-api/exceptions c PyExc_AttributeError17655469
Ref: 4fe117655469
Ref: c-api/exceptions c PyExc_BlockingIOError17655661
Ref: 4fe417655661
Ref: c-api/exceptions c PyExc_BrokenPipeError17655890
Ref: 4fe517655890
Ref: c-api/exceptions c PyExc_BufferError17656139
Ref: 4fe617656139
Ref: c-api/exceptions c PyExc_ChildProcessError17656265
Ref: 4fe817656265
Ref: c-api/exceptions c PyExc_ConnectionAbortedError17656497
Ref: 4fe917656497
Ref: c-api/exceptions c PyExc_ConnectionError17656734
Ref: 4fea17656734
Ref: c-api/exceptions c PyExc_ConnectionRefusedError17656964
Ref: 4feb17656964
Ref: c-api/exceptions c PyExc_ConnectionResetError17657201
Ref: 4fec17657201
Ref: c-api/exceptions c PyExc_EOFError17657452
Ref: 4fee17657452
Ref: c-api/exceptions c PyExc_FileExistsError17657578
Ref: 4ff217657578
Ref: c-api/exceptions c PyExc_FileNotFoundError17657808
Ref: 4ff317657808
Ref: c-api/exceptions c PyExc_FloatingPointError17658039
Ref: 4ff417658039
Ref: c-api/exceptions c PyExc_GeneratorExit17658236
Ref: 4ff617658236
Ref: c-api/exceptions c PyExc_ImportError17658447
Ref: 4ff817658447
Ref: c-api/exceptions c PyExc_IndentationError17658572
Ref: 4ffa17658572
Ref: c-api/exceptions c PyExc_IndexError17658785
Ref: 4ffb17658785
Ref: c-api/exceptions c PyExc_InterruptedError17658911
Ref: 4ffc17658911
Ref: c-api/exceptions c PyExc_IsADirectoryError17659141
Ref: 4ffd17659141
Ref: c-api/exceptions c PyExc_KeyError17659389
Ref: 4ffe17659389
Ref: c-api/exceptions c PyExc_KeyboardInterrupt17659514
Ref: 4fff17659514
Ref: c-api/exceptions c PyExc_LookupError17659728
Ref: 500017659728
Ref: c-api/exceptions c PyExc_MemoryError17659873
Ref: 500117659873
Ref: c-api/exceptions c PyExc_ModuleNotFoundError17659999
Ref: 500217659999
Ref: c-api/exceptions c PyExc_NameError17660249
Ref: 500317660249
Ref: c-api/exceptions c PyExc_NotADirectoryError17660374
Ref: 500417660374
Ref: c-api/exceptions c PyExc_NotImplementedError17660607
Ref: 500517660607
Ref: c-api/exceptions c PyExc_OSError17660819
Ref: 4e9b17660819
Ref: c-api/exceptions c PyExc_OverflowError17660944
Ref: 500617660944
Ref: c-api/exceptions c PyExc_PermissionError17661135
Ref: 500817661135
Ref: c-api/exceptions c PyExc_ProcessLookupError17661364
Ref: 500917661364
Ref: c-api/exceptions c PyExc_PythonFinalizationError17661597
Ref: 520417661597
Ref: c-api/exceptions c PyExc_RecursionError17661747
Ref: 10b217661747
Ref: c-api/exceptions c PyExc_ReferenceError17661975
Ref: 500a17661975
Ref: c-api/exceptions c PyExc_RuntimeError17662188
Ref: 500c17662188
Ref: c-api/exceptions c PyExc_StopAsyncIteration17662313
Ref: 500e17662313
Ref: c-api/exceptions c PyExc_StopIteration17662546
Ref: 500f17662546
Ref: c-api/exceptions c PyExc_SyntaxError17662756
Ref: 501017662756
Ref: c-api/exceptions c PyExc_SystemError17662900
Ref: 501217662900
Ref: c-api/exceptions c PyExc_SystemExit17663043
Ref: 501317663043
Ref: c-api/exceptions c PyExc_TabError17663184
Ref: 501417663184
Ref: c-api/exceptions c PyExc_TimeoutError17663329
Ref: 501517663329
Ref: c-api/exceptions c PyExc_TypeError17663500
Ref: 4e9a17663500
Ref: c-api/exceptions c PyExc_UnboundLocalError17663625
Ref: 501617663625
Ref: c-api/exceptions c PyExc_UnicodeDecodeError17663821
Ref: 501717663821
Ref: c-api/exceptions c PyExc_UnicodeEncodeError17664017
Ref: 501817664017
Ref: c-api/exceptions c PyExc_UnicodeError17664233
Ref: 501917664233
Ref: c-api/exceptions c PyExc_UnicodeTranslateError17664358
Ref: 501a17664358
Ref: c-api/exceptions c PyExc_ValueError17664576
Ref: 4e9c17664576
Ref: c-api/exceptions c PyExc_ZeroDivisionError17664701
Ref: 4e9717664701
Ref: Exception types-Footnote-117665814
Node: OSError aliases17665856
Ref: c-api/exceptions oserror-aliases17665981
Ref: 520517665981
Ref: c-api/exceptions c PyExc_EnvironmentError17666609
Ref: 4ff017666609
Ref: c-api/exceptions c PyExc_IOError17666765
Ref: 4ff717666765
Ref: c-api/exceptions c PyExc_WindowsError17666921
Ref: 501e17666921
Ref: c-api/exceptions win17667179
Ref: 520617667179
Node: Warning types17667335
Ref: c-api/exceptions standardwarningcategories17667436
Ref: 51f317667436
Ref: c-api/exceptions warning-types17667436
Ref: 520717667436
Ref: c-api/exceptions c PyExc_Warning17667822
Ref: 501d17667822
Ref: c-api/exceptions c PyExc_BytesWarning17667968
Ref: 4fe717667968
Ref: c-api/exceptions c PyExc_DeprecationWarning17668093
Ref: 4fed17668093
Ref: c-api/exceptions c PyExc_EncodingWarning17668289
Ref: 4fef17668289
Ref: c-api/exceptions c PyExc_FutureWarning17668520
Ref: 4ff517668520
Ref: c-api/exceptions c PyExc_ImportWarning17668711
Ref: 4ff917668711
Ref: c-api/exceptions c PyExc_PendingDeprecationWarning17668902
Ref: 500717668902
Ref: c-api/exceptions c PyExc_ResourceWarning17669105
Ref: 500b17669105
Ref: c-api/exceptions c PyExc_RuntimeWarning17669334
Ref: 500d17669334
Ref: c-api/exceptions c PyExc_SyntaxWarning17669526
Ref: 501117669526
Ref: c-api/exceptions c PyExc_UnicodeWarning17669717
Ref: 501b17669717
Ref: c-api/exceptions c PyExc_UserWarning17669929
Ref: 501c17669929
Node: Tracebacks17670138
Ref: c-api/exceptions tracebacks17670233
Ref: 520817670233
Ref: c-api/exceptions c PyTraceBack_Type17670270
Ref: 50d417670270
Ref: c-api/exceptions c PyTraceBack_Check17670499
Ref: 520917670499
Ref: c-api/exceptions c PyTraceBack_Here17670671
Ref: 50d217670671
Ref: c-api/exceptions c PyTraceBack_Print17671113
Ref: 50d317671113
Node: 拡張モジュールの定義17671390
Ref: c-api/extension-modules doc17671557
Ref: 520a17671557
Ref: c-api/extension-modules defining-extension-modules17671557
Ref: 520b17671557
Ref: c-api/extension-modules extension-modules17671557
Ref: 4efc17671557
Ref: c-api/extension-modules translation-repo17671557
Ref: 520c17671557
Ref: 拡張モジュールの定義-Footnote-117674083
Node: 複数のモジュールインスタンス17674125
Ref: c-api/extension-modules multiple-module-instances17674258
Ref: 520f17674258
Node: 初期化関数17675760
Ref: c-api/extension-modules extension-export-hook17675920
Ref: 520d17675920
Ref: c-api/extension-modules initialization-function17675920
Ref: 521117675920
Ref: c-api/extension-modules c PyInit_modulename17676068
Ref: 521217676068
Ref: c-api/extension-modules c PyMODINIT_FUNC17676970
Ref: 16ec17676970
Ref: 初期化関数-Footnote-117678098
Ref: 初期化関数-Footnote-217678172
Node: 多段階初期化17678214
Ref: c-api/extension-modules id117678359
Ref: 521417678359
Ref: c-api/extension-modules multi-phase-initialization17678359
Ref: 521317678359
Ref: c-api/extension-modules c PyModuleDef_Init17678671
Ref: 4ea317678671
Node: 従来の一段階初期化17679397
Ref: c-api/extension-modules legacy-single-phase-initialization17679518
Ref: 521617679518
Ref: c-api/extension-modules single-phase-initialization17679518
Ref: 520e17679518
Ref: 従来の一段階初期化-Footnote-117681966
Node: ユーティリティ<2>17682099
Ref: c-api/utilities doc17682310
Ref: 521817682310
Ref: c-api/utilities id117682310
Ref: 521917682310
Ref: c-api/utilities translation-repo17682310
Ref: 521a17682310
Ref: c-api/utilities utilities17682310
Ref: 521b17682310
Node: オペレーティングシステム関連のユーティリティ17683276
Ref: c-api/sys doc17683430
Ref: 521c17683430
Ref: c-api/sys operating-system-utilities17683430
Ref: 521d17683430
Ref: c-api/sys os17683430
Ref: 521e17683430
Ref: c-api/sys c PyOS_FSPath17683555
Ref: f1417683555
Ref: c-api/sys c Py_FdIsInteractive17684211
Ref: 521f17684211
Ref: c-api/sys c PyOS_BeforeFork17684757
Ref: db817684757
Ref: c-api/sys c PyOS_AfterFork_Parent17685509
Ref: db917685509
Ref: c-api/sys c PyOS_AfterFork_Child17686361
Ref: 43017686361
Ref: c-api/sys c PyOS_AfterFork17687402
Ref: 42f17687402
Ref: c-api/sys c PyOS_CheckStack17688035
Ref: 1ba117688035
Ref: c-api/sys c PyOS_sighandler_t17688564
Ref: 508317688564
Ref: c-api/sys c PyOS_getsig17688678
Ref: 175717688678
Ref: c-api/sys c PyOS_setsig17688973
Ref: 175817688973
Ref: c-api/sys c PyOS_InterruptOccurred17689334
Ref: 1d4217689334
Ref: c-api/sys c Py_DecodeLocale17690083
Ref: dc017690083
Ref: c-api/sys c Py_EncodeLocale17692936
Ref: dc117692936
Ref: c-api/sys c Py_fopen17695055
Ref: 39317695055
Ref: c-api/sys c Py_fclose17695710
Ref: 39417695710
Ref: オペレーティングシステム関連のユーティリティ-Footnote-117696137
Node: システム関数17696179
Ref: c-api/sys system-functions17696360
Ref: 522117696360
Ref: c-api/sys systemfunctions17696360
Ref: 522217696360
Ref: c-api/sys c PySys_GetObject17696736
Ref: 62a17696736
Ref: c-api/sys c PySys_SetObject17697052
Ref: 50bf17697052
Ref: c-api/sys c PySys_ResetWarnOptions17697455
Ref: 3f417697455
Ref: c-api/sys c PySys_WriteStdout17697829
Ref: 50c117697829
Ref: c-api/sys c PySys_WriteStderr17699022
Ref: 50c017699022
Ref: c-api/sys c PySys_FormatStdout17699274
Ref: 50bd17699274
Ref: c-api/sys c PySys_FormatStderr17699645
Ref: 50bc17699645
Ref: c-api/sys c PySys_GetXOptions17699927
Ref: 50be17699927
Ref: c-api/sys c PySys_Audit17700337
Ref: 61317700337
Ref: c-api/sys c PySys_AuditTuple17701698
Ref: 61217701698
Ref: c-api/sys c PySys_AddAuditHook17702056
Ref: 475117702056
Ref: c-api/sys c Py_AuditHookFunction17703769
Ref: 522317703769
Ref: システム関数-Footnote-117704285
Node: プロセス制御17704327
Ref: c-api/sys process-control17704478
Ref: 522517704478
Ref: c-api/sys processcontrol17704478
Ref: 522617704478
Ref: c-api/sys c Py_FatalError17704523
Ref: b7a17704523
Ref: c-api/sys c Py_Exit17705314
Ref: f4b17705314
Ref: c-api/sys c Py_AtExit17705816
Ref: 512817705816
Node: モジュールのインポート<2>17706770
Ref: c-api/import doc17706954
Ref: 522717706954
Ref: c-api/import importing17706954
Ref: 522817706954
Ref: c-api/import importing-modules17706954
Ref: 522917706954
Ref: c-api/import translation-repo17706954
Ref: 522a17706954
Ref: c-api/import c PyImport_ImportModule17707024
Ref: 3dc17707024
Ref: c-api/import c PyImport_ImportModuleNoBlock17707341
Ref: 3db17707341
Ref: c-api/import c PyImport_ImportModuleEx17708168
Ref: 13bd17708168
Ref: c-api/import c PyImport_ImportModuleLevelObject17709183
Ref: 503917709183
Ref: c-api/import c PyImport_ImportModuleLevel17710267
Ref: 13bc17710267
Ref: c-api/import c PyImport_Import17710833
Ref: 161517710833
Ref: c-api/import c PyImport_ReloadModule17711550
Ref: 503a17711550
Ref: c-api/import c PyImport_AddModuleRef17712068
Ref: 5fb17712068
Ref: c-api/import c PyImport_AddModuleObject17713084
Ref: 503017713084
Ref: c-api/import c PyImport_AddModule17713468
Ref: 5fc17713468
Ref: c-api/import c PyImport_ExecCodeModule17713736
Ref: 503117713736
Ref: c-api/import c PyImport_ExecCodeModuleEx17715920
Ref: 503217715920
Ref: c-api/import c PyImport_ExecCodeModuleObject17716395
Ref: 503317716395
Ref: c-api/import c PyImport_ExecCodeModuleWithPathnames17717069
Ref: 503417717069
Ref: c-api/import c PyImport_GetMagicNumber17717948
Ref: 13bb17717948
Ref: c-api/import c PyImport_GetMagicTag17718487
Ref: 503517718487
Ref: c-api/import c PyImport_GetModuleDict17718914
Ref: 503617718914
Ref: c-api/import c PyImport_GetModule17719265
Ref: dac17719265
Ref: c-api/import c PyImport_GetImporter17719841
Ref: 1a8417719841
Ref: c-api/import c PyImport_ImportFrozenModuleObject17720575
Ref: 503817720575
Ref: c-api/import c PyImport_ImportFrozenModule17721505
Ref: 503717721505
Ref: c-api/import c _frozen17721851
Ref: 97917721851
Ref: c-api/import c PyImport_FrozenModules17722585
Ref: 331817722585
Ref: c-api/import c PyImport_AppendInittab17723188
Ref: 1b1c17723188
Ref: c-api/import c _inittab17723908
Ref: 522b17723908
Ref: c-api/import c _inittab name17724238
Ref: 522c17724238
Ref: c-api/import c _inittab initfunc17724343
Ref: 522d17724343
Ref: c-api/import c PyImport_ExtendInittab17724501
Ref: 1b1d17724501
Ref: c-api/import c PyImport_Inittab17725322
Ref: 1b1b17725322
Ref: c-api/import c PyImport_ImportModuleAttr17725581
Ref: 39617725581
Ref: c-api/import c PyImport_ImportModuleAttrString17726141
Ref: 39717726141
Ref: モジュールのインポート<2>-Footnote-117726511
Node: データ整列化 data marshalling のサポート17726553
Ref: c-api/marshal doc17726749
Ref: 522e17726749
Ref: c-api/marshal data-marshalling-support17726749
Ref: 522f17726749
Ref: c-api/marshal marshalling-utils17726749
Ref: 523017726749
Ref: c-api/marshal translation-repo17726749
Ref: 523117726749
Ref: c-api/marshal c Py_MARSHAL_VERSION17727454
Ref: 523217727454
Ref: c-api/marshal c PyMarshal_WriteLongToFile17727562
Ref: 99917727562
Ref: c-api/marshal c PyMarshal_WriteObjectToFile17728132
Ref: 99a17728132
Ref: c-api/marshal c PyMarshal_WriteObjectToString17728570
Ref: 99c17728570
Ref: c-api/marshal c PyMarshal_ReadLongFromFile17728949
Ref: 523317728949
Ref: c-api/marshal c PyMarshal_ReadShortFromFile17729399
Ref: 523417729399
Ref: c-api/marshal c PyMarshal_ReadObjectFromFile17729851
Ref: 523517729851
Ref: c-api/marshal c PyMarshal_ReadLastObjectFromFile17730264
Ref: 523617730264
Ref: c-api/marshal c PyMarshal_ReadObjectFromString17731063
Ref: 99b17731063
Node: 引数の解釈と値の構築17731522
Ref: c-api/arg doc17731712
Ref: 523717731712
Ref: c-api/arg arg-parsing17731712
Ref: 3d517731712
Ref: c-api/arg parsing-arguments-and-building-values17731712
Ref: 523817731712
Ref: c-api/arg translation-repo17731712
Ref: 523917731712
Node: 引数を解析する<2>17732479
Ref: c-api/arg parsing-arguments17732591
Ref: 523a17732591
Node: 文字列とバッファ17733452
Ref: c-api/arg arg-parsing-string-and-buffers17733552
Ref: 62c17733552
Ref: c-api/arg strings-and-buffers17733552
Ref: 523b17733552
Ref: c-api/arg c-arg-borrowed-buffer17735218
Ref: 3d617735218
Node: 数<2>17747410
Ref: c-api/arg numbers17747549
Ref: 523c17747549
Node: その他のオブジェクト17750873
Ref: c-api/arg other-objects17750998
Ref: 523e17750998
Ref: c-api/arg o-ampersand17752116
Ref: 523f17752116
Ref: c-api/arg c Py_CLEANUP_SUPPORTED17752964
Ref: 524017752964
Node: API 関数17758114
Ref: c-api/arg api-functions17758224
Ref: 524117758224
Ref: c-api/arg c PyArg_ParseTuple17758261
Ref: 3c117758261
Ref: c-api/arg c PyArg_VaParse17758634
Ref: 4f6417758634
Ref: c-api/arg c PyArg_ParseTupleAndKeywords17758916
Ref: 62417758916
Ref: c-api/arg c PyArg_VaParseTupleAndKeywords17760031
Ref: 62517760031
Ref: c-api/arg c PyArg_ValidateKeywordArguments17760387
Ref: 4f6517760387
Ref: c-api/arg c PyArg_Parse17760836
Ref: 180e17760836
Ref: c-api/arg c PyArg_UnpackTuple17761543
Ref: 171f17761543
Ref: c-api/arg c PY_CXX_CONST17763879
Ref: 62617763879
Node: 値の構築17764305
Ref: c-api/arg building-values17764417
Ref: 524217764417
Ref: c-api/arg c Py_BuildValue17764456
Ref: 3c217764456
Ref: c-api/arg capi-py-buildvalue-format-k17770440
Ref: 186b17770440
Ref: c-api/arg c Py_VaBuildValue17774301
Ref: 514a17774301
Node: 文字列の変換と書式化17774608
Ref: c-api/conversion doc17774786
Ref: 524317774786
Ref: c-api/conversion string-conversion17774786
Ref: 524417774786
Ref: c-api/conversion string-conversion-and-formatting17774786
Ref: 524517774786
Ref: c-api/conversion translation-repo17774786
Ref: 524617774786
Ref: c-api/conversion c PyOS_snprintf17774919
Ref: 172217774919
Ref: c-api/conversion c PyOS_vsnprintf17775273
Ref: 172317775273
Ref: c-api/conversion c PyOS_strtoul17777187
Ref: 508517777187
Ref: c-api/conversion c PyOS_strtol17778226
Ref: 508417778226
Ref: c-api/conversion c PyOS_string_to_double17778752
Ref: 14ad17778752
Ref: c-api/conversion c PyOS_double_to_string17780741
Ref: 508217780741
Ref: c-api/conversion c Py_DTSF_SIGN17781479
Ref: 524717781479
Ref: c-api/conversion c Py_DTSF_ADD_DOT_017781628
Ref: 524817781628
Ref: c-api/conversion c Py_DTSF_ALT17781746
Ref: 524917781746
Ref: c-api/conversion c Py_DTSF_NO_NEG_017781934
Ref: 524a17781934
Ref: c-api/conversion c Py_DTST_FINITE17782565
Ref: 524b17782565
Ref: c-api/conversion c Py_DTST_INFINITE17782767
Ref: 524c17782767
Ref: c-api/conversion c Py_DTST_NAN17782964
Ref: 524d17782964
Ref: c-api/conversion c PyOS_mystricmp17783370
Ref: 1d3b17783370
Ref: c-api/conversion c PyOS_mystrnicmp17783443
Ref: 1d3a17783443
Ref: c-api/conversion c PyOS_stricmp17784244
Ref: 524e17784244
Ref: c-api/conversion c PyOS_strnicmp17784315
Ref: 524f17784315
Ref: 文字列の変換と書式化-Footnote-117784723
Ref: 文字列の変換と書式化-Footnote-217784771
Ref: 文字列の変換と書式化-Footnote-317784820
Ref: 文字列の変換と書式化-Footnote-417784867
Node: Character classification and conversion17784913
Ref: c-api/conversion character-classification-and-conversion17785071
Ref: 525017785071
Ref: c-api/conversion c Py_ISALNUM17785349
Ref: 156917785349
Ref: c-api/conversion c Py_ISALPHA17785454
Ref: 156a17785454
Ref: c-api/conversion c Py_ISDIGIT17785588
Ref: 156b17785588
Ref: c-api/conversion c Py_ISLOWER17785695
Ref: 156c17785695
Ref: c-api/conversion c Py_ISUPPER17785816
Ref: 156e17785816
Ref: c-api/conversion c Py_ISSPACE17785938
Ref: 156d17785938
Ref: c-api/conversion c Py_ISXDIGIT17786112
Ref: 156f17786112
Ref: c-api/conversion c Py_TOLOWER17786255
Ref: 157017786255
Ref: c-api/conversion c Py_TOUPPER17786351
Ref: 157117786351
Node: PyHash API17786447
Ref: c-api/hash doc17786596
Ref: 525117786596
Ref: c-api/hash pyhash-api17786596
Ref: 525217786596
Ref: c-api/hash translation-repo17786596
Ref: 525317786596
Ref: c-api/hash c Py_hash_t17786751
Ref: 147b17786751
Ref: c-api/hash c Py_uhash_t17786866
Ref: 525417786866
Ref: c-api/hash c Py_HASH_ALGORITHM17786982
Ref: 525517786982
Ref: c-api/hash c Py_HASH_FNV17787289
Ref: 525617787289
Ref: c-api/hash c Py_HASH_SIPHASH2417787321
Ref: 525717787321
Ref: c-api/hash c Py_HASH_SIPHASH1317787359
Ref: 525817787359
Ref: c-api/hash c Py_HASH_CUTOFF17787766
Ref: 525917787766
Ref: c-api/hash c PyHASH_MODULUS17788460
Ref: 19e817788460
Ref: c-api/hash c PyHASH_BITS17788682
Ref: 19e917788682
Ref: c-api/hash c PyHASH_MULTIPLIER17788813
Ref: 199417788813
Ref: c-api/hash c PyHASH_INF17788945
Ref: 19ea17788945
Ref: c-api/hash c PyHASH_IMAG17789132
Ref: 19eb17789132
Ref: c-api/hash c PyHash_FuncDef17789336
Ref: 525a17789336
Ref: c-api/hash c PyHash_FuncDef hash17789452
Ref: 525c17789452
Ref: c-api/hash c PyHash_FuncDef name17789599
Ref: 525d17789599
Ref: c-api/hash c PyHash_FuncDef hash_bits17789794
Ref: 525e17789794
Ref: c-api/hash c PyHash_FuncDef seed_bits17789990
Ref: 525f17789990
Ref: c-api/hash c PyHash_GetFuncDef17790201
Ref: 525b17790201
Ref: c-api/hash c Py_HashPointer17790426
Ref: 42517790426
Ref: c-api/hash c Py_HashBuffer17790736
Ref: 39517790736
Ref: c-api/hash c PyObject_GenericHash17791377
Ref: 60c17791377
Ref: PyHash API-Footnote-117791786
Ref: PyHash API-Footnote-217791839
Node: リフレクション17791881
Ref: c-api/reflection doc17792033
Ref: 526017792033
Ref: c-api/reflection id117792033
Ref: 526117792033
Ref: c-api/reflection reflection17792033
Ref: 526217792033
Ref: c-api/reflection translation-repo17792033
Ref: 526317792033
Ref: c-api/reflection c PyEval_GetBuiltins17792085
Ref: 5f417792085
Ref: c-api/reflection c PyEval_GetLocals17792529
Ref: 5f817792529
Ref: c-api/reflection c PyEval_GetGlobals17794075
Ref: 5f617794075
Ref: c-api/reflection c PyEval_GetFrame17794466
Ref: 1b3917794466
Ref: c-api/reflection c PyEval_GetFrameBuiltins17794787
Ref: 5f317794787
Ref: c-api/reflection c PyEval_GetFrameLocals17795209
Ref: 5f717795209
Ref: c-api/reflection c PyEval_GetFrameGlobals17795856
Ref: 5f517795856
Ref: c-api/reflection c PyEval_GetFuncName17796278
Ref: 4fdd17796278
Ref: c-api/reflection c PyEval_GetFuncDesc17796559
Ref: 4fdc17796559
Ref: リフレクション-Footnote-117797024
Node: codec レジストリとサポート関数17797066
Ref: c-api/codec doc17797220
Ref: 526417797220
Ref: c-api/codec codec-registry17797220
Ref: f3017797220
Ref: c-api/codec codec-registry-and-support-functions17797220
Ref: 526517797220
Ref: c-api/codec translation-repo17797220
Ref: 526617797220
Ref: c-api/codec c PyCodec_Register17797309
Ref: 4fa617797309
Ref: c-api/codec c PyCodec_Unregister17797653
Ref: a9717797653
Ref: c-api/codec c PyCodec_KnownEncoding17798132
Ref: 4fa417798132
Ref: c-api/codec c PyCodec_Encode17798427
Ref: 3e217798427
Ref: c-api/codec c PyCodec_Decode17799112
Ref: 3e117799112
Node: コーデック検索API17799793
Ref: c-api/codec codec-lookup-api17799956
Ref: 526717799956
Ref: c-api/codec c PyCodec_Encoder17800290
Ref: 4fa017800290
Ref: c-api/codec c PyCodec_Decoder17800538
Ref: 4f9f17800538
Ref: c-api/codec c PyCodec_IncrementalEncoder17800783
Ref: 4fa317800783
Ref: c-api/codec c PyCodec_IncrementalDecoder17801098
Ref: 4fa217801098
Ref: c-api/codec c PyCodec_StreamReader17801413
Ref: 4fa917801413
Ref: c-api/codec c PyCodec_StreamWriter17801737
Ref: 4faa17801737
Node: Unicode エラーハンドラ用レジストリ API17802061
Ref: c-api/codec registry-api-for-unicode-encoding-error-handlers17802256
Ref: 526817802256
Ref: c-api/codec c PyCodec_RegisterError17802366
Ref: 4fa717802366
Ref: c-api/codec c PyCodec_LookupError17803753
Ref: 4fa517803753
Ref: c-api/codec c PyCodec_StrictErrors17804182
Ref: 4fab17804182
Ref: c-api/codec c PyCodec_IgnoreErrors17804389
Ref: 4fa117804389
Ref: c-api/codec c PyCodec_ReplaceErrors17804628
Ref: 4fa817804628
Ref: c-api/codec c PyCodec_XMLCharRefReplaceErrors17804874
Ref: 4fac17804874
Ref: c-api/codec c PyCodec_BackslashReplaceErrors17805127
Ref: 4f9e17805127
Ref: c-api/codec c PyCodec_NameReplaceErrors17805439
Ref: 10af17805439
Node: Codec utility variables17805751
Ref: c-api/codec codec-utility-variables17805913
Ref: 526917805913
Ref: c-api/codec c Py_hexdigits17805980
Ref: 526a17805980
Node: PyTime C API17806148
Ref: c-api/time doc17806302
Ref: 48317806302
Ref: c-api/time c-api-time17806302
Ref: 5d217806302
Ref: c-api/time pytime-c-api17806302
Ref: 526b17806302
Ref: c-api/time translation-repo17806302
Ref: 526c17806302
Node: 型<3>17806772
Ref: c-api/time types17806851
Ref: 526e17806851
Ref: c-api/time c PyTime_t17806877
Ref: 5d317806877
Ref: c-api/time c PyTime_MIN17807413
Ref: 5d417807413
Ref: c-api/time c PyTime_MAX17807504
Ref: 5d517807504
Node: Clock Functions17807595
Ref: c-api/time clock-functions17807702
Ref: 526f17807702
Ref: c-api/time c PyTime_Monotonic17808428
Ref: 5d717808428
Ref: c-api/time c PyTime_PerfCounter17808594
Ref: 5d917808594
Ref: c-api/time c PyTime_Time17808769
Ref: 5db17808769
Node: Raw Clock Functions17808931
Ref: c-api/time raw-clock-functions17809052
Ref: 527017809052
Ref: c-api/time c PyTime_MonotonicRaw17809596
Ref: 5d817809596
Ref: c-api/time c PyTime_PerfCounterRaw17809807
Ref: 5da17809807
Ref: c-api/time c PyTime_TimeRaw17810022
Ref: 5dc17810022
Node: Conversion functions17810218
Ref: c-api/time conversion-functions17810315
Ref: 527117810315
Ref: c-api/time c PyTime_AsSecondsDouble17810376
Ref: 5d617810376
Node: Support for Perf Maps17810598
Ref: c-api/perfmaps doc17810701
Ref: 527217810701
Ref: c-api/perfmaps perfmaps17810701
Ref: 527317810701
Ref: c-api/perfmaps support-for-perf-maps17810701
Ref: 527417810701
Ref: c-api/perfmaps translation-repo17810701
Ref: 527517810701
Ref: c-api/perfmaps c PyUnstable_PerfMapState_Init17811376
Ref: 1aaa17811376
Ref: c-api/perfmaps c PyUnstable_WritePerfMapEntry17812284
Ref: 1aa917812284
Ref: c-api/perfmaps c PyUnstable_PerfMapState_Fini17813149
Ref: 1aab17813149
Ref: Support for Perf Maps-Footnote-117813781
Ref: Support for Perf Maps-Footnote-217813838
Node: 抽象オブジェクトレイヤ Abstract Objects Layer17813962
Ref: c-api/abstract doc17814193
Ref: 527617814193
Ref: c-api/abstract abstract17814193
Ref: 4ef317814193
Ref: c-api/abstract abstract-objects-layer17814193
Ref: 527717814193
Ref: c-api/abstract translation-repo17814193
Ref: 527817814193
Node: オブジェクトプロトコル object protocol17815596
Ref: c-api/object doc17815767
Ref: 527917815767
Ref: c-api/object object17815767
Ref: 527a17815767
Ref: c-api/object object-protocol17815767
Ref: 527b17815767
Ref: c-api/object c Py_GetConstant17815873
Ref: 5f917815873
Ref: c-api/object c Py_CONSTANT_NONE17816570
Ref: 527c17816570
Ref: c-api/object c Py_CONSTANT_FALSE17816778
Ref: 527d17816778
Ref: c-api/object c Py_CONSTANT_TRUE17816985
Ref: 527e17816985
Ref: c-api/object c Py_CONSTANT_ELLIPSIS17817196
Ref: 527f17817196
Ref: c-api/object c Py_CONSTANT_NOT_IMPLEMENTED17817387
Ref: 528017817387
Ref: c-api/object c Py_CONSTANT_ZERO17817561
Ref: 528117817561
Ref: c-api/object c Py_CONSTANT_ONE17817758
Ref: 528217817758
Ref: c-api/object c Py_CONSTANT_EMPTY_STR17817962
Ref: 528317817962
Ref: c-api/object c Py_CONSTANT_EMPTY_BYTES17818163
Ref: 528417818163
Ref: c-api/object c Py_CONSTANT_EMPTY_TUPLE17818363
Ref: 528517818363
Ref: c-api/object c Py_GetConstantBorrowed17818678
Ref: 5fa17818678
Ref: c-api/object c Py_NotImplemented17819231
Ref: 528617819231
Ref: c-api/object c Py_RETURN_NOTIMPLEMENTED17819492
Ref: 17e717819492
Ref: c-api/object c Py_PRINT_RAW17819734
Ref: 528717819734
Ref: c-api/object c PyObject_Print17820029
Ref: 198b17820029
Ref: c-api/object c PyObject_HasAttrWithError17820412
Ref: 61b17820412
Ref: c-api/object c PyObject_HasAttrStringWithError17820812
Ref: 61d17820812
Ref: c-api/object c PyObject_HasAttr17821210
Ref: 61c17821210
Ref: c-api/object c PyObject_HasAttrString17821868
Ref: 61e17821868
Ref: c-api/object c PyObject_GetAttr17822624
Ref: 5ee17822624
Ref: c-api/object c PyObject_GetAttrString17823184
Ref: 5ef17823184
Ref: c-api/object c PyObject_GetOptionalAttr17823692
Ref: 5ec17823692
Ref: c-api/object c PyObject_GetOptionalAttrString17824429
Ref: 5ed17824429
Ref: c-api/object c PyObject_GenericGetAttr17824847
Ref: 508e17824847
Ref: c-api/object c PyObject_SetAttr17825718
Ref: 509717825718
Ref: c-api/object c PyObject_SetAttrString17826385
Ref: 198e17826385
Ref: c-api/object c PyObject_GenericSetAttr17827360
Ref: 508f17827360
Ref: c-api/object c PyObject_DelAttr17828195
Ref: 183117828195
Ref: c-api/object c PyObject_DelAttrString17828565
Ref: 183217828565
Ref: c-api/object c PyObject_GenericGetDict17829384
Ref: 1d0517829384
Ref: c-api/object c PyObject_GenericSetDict17830158
Ref: 509017830158
Ref: c-api/object c _PyObject_GetDictPtr17830530
Ref: 528817830530
Ref: c-api/object c PyObject_RichCompare17830959
Ref: 4ef117830959
Ref: c-api/object c PyObject_RichCompareBool17831692
Ref: 1d8c17831692
Ref: c-api/object c PyObject_Format17832242
Ref: 508d17832242
Ref: c-api/object c PyObject_Repr17832693
Ref: 123017832693
Ref: c-api/object c PyObject_ASCII17833371
Ref: 508617833371
Ref: c-api/object c PyObject_Str17834024
Ref: 123117834024
Ref: c-api/object c PyObject_Bytes17834740
Ref: 508817834740
Ref: c-api/object c PyObject_IsSubclass17835338
Ref: 10a717835338
Ref: c-api/object c PyObject_IsInstance17836529
Ref: 10a617836529
Ref: c-api/object c PyObject_Hash17837718
Ref: 43617837718
Ref: c-api/object c PyObject_HashNotImplemented17838199
Ref: 15e017838199
Ref: c-api/object c PyObject_IsTrue17838633
Ref: 509317838633
Ref: c-api/object c PyObject_Not17838956
Ref: 509517838956
Ref: c-api/object c PyObject_Type17839272
Ref: 509917839272
Ref: c-api/object c PyObject_TypeCheck17839979
Ref: 1cb517839979
Ref: c-api/object c PyObject_Size17840205
Ref: 509817840205
Ref: c-api/object c PyObject_Length17840273
Ref: 509417840273
Ref: c-api/object c PyObject_LengthHint17840736
Ref: 120617840736
Ref: c-api/object c PyObject_GetItem17841217
Ref: 5ea17841217
Ref: c-api/object c PyObject_SetItem17841571
Ref: 4f4817841571
Ref: c-api/object c PyObject_DelItem17842023
Ref: 508a17842023
Ref: c-api/object c PyObject_DelItemString17842328
Ref: 508b17842328
Ref: c-api/object c PyObject_Dir17842623
Ref: 508c17842623
Ref: c-api/object c PyObject_GetIter17843338
Ref: 509217843338
Ref: c-api/object c PyObject_SelfIter17843874
Ref: 509617843874
Ref: c-api/object c PyObject_GetAIter17844226
Ref: 509117844226
Ref: c-api/object c PyObject_GetTypeData17844805
Ref: 76b17844805
Ref: c-api/object c PyType_GetTypeDataSize17845296
Ref: 76c17845296
Ref: c-api/object c PyObject_GetItemData17846001
Ref: 76e17846001
Ref: c-api/object c PyObject_VisitManagedDict17846345
Ref: 60d17846345
Ref: c-api/object c PyObject_ClearManagedDict17846661
Ref: 60e17846661
Ref: c-api/object c PyUnstable_Object_EnableDeferredRefcount17846937
Ref: 3c517846937
Ref: c-api/object c PyUnstable_Object_IsUniqueReferencedTemporary17848522
Ref: 3c717848522
Ref: c-api/object c PyUnstable_IsImmortal17850151
Ref: 3c417850151
Ref: c-api/object c PyUnstable_TryIncRef17850733
Ref: 18c917850733
Ref: c-api/object c PyUnstable_EnableTryIncRef17853465
Ref: 18ca17853465
Ref: c-api/object c PyUnstable_Object_IsUniquelyReferenced17853976
Ref: 3c617853976
Ref: オブジェクトプロトコル object protocol-Footnote-117855004
Ref: オブジェクトプロトコル object protocol-Footnote-217855046
Ref: オブジェクトプロトコル object protocol-Footnote-317855088
Node: Call プロトコル17855158
Ref: c-api/call doc17855378
Ref: 529017855378
Ref: c-api/call call17855378
Ref: 7a317855378
Ref: c-api/call call-protocol17855378
Ref: 529117855378
Ref: c-api/call translation-repo17855378
Ref: 529217855378
Node: The tp_call Protocol17855612
Ref: c-api/call the-tp-call-protocol17855721
Ref: 529317855721
Node: The Vectorcall Protocol17856457
Ref: c-api/call the-vectorcall-protocol17856593
Ref: 529517856593
Ref: c-api/call vectorcall17856593
Ref: 77417856593
Ref: c-api/call c vectorcallfunc17858373
Ref: 77917858373
Ref: c-api/call c PY_VECTORCALL_ARGUMENTS_OFFSET17859485
Ref: 78017859485
Ref: The Vectorcall Protocol-Footnote-117860643
Node: 再帰の管理<2>17860685
Ref: c-api/call recursion-control17860794
Ref: 529717860794
Node: Vectorcall Support API17861197
Ref: c-api/call vectorcall-support-api17861306
Ref: 529817861306
Ref: c-api/call c PyVectorcall_NARGS17861369
Ref: 77717861369
Ref: c-api/call c PyVectorcall_Function17861839
Ref: 529917861839
Ref: c-api/call c PyVectorcall_Call17862389
Ref: 77817862389
Node: Object Calling API17863018
Ref: c-api/call capi-call17863150
Ref: 529417863150
Ref: c-api/call object-calling-api17863150
Ref: 529a17863150
Ref: c-api/call c PyObject_Call17867777
Ref: 63d17867777
Ref: c-api/call c PyObject_CallNoArgs17868596
Ref: 63c17868596
Ref: c-api/call c PyObject_CallOneArg17869114
Ref: b6f17869114
Ref: c-api/call c PyObject_CallObject17869518
Ref: 4eac17869518
Ref: c-api/call c PyObject_CallFunction17870143
Ref: 63f17870143
Ref: c-api/call c PyObject_CallMethod17871184
Ref: 64017871184
Ref: c-api/call c PyObject_CallFunctionObjArgs17872288
Ref: 508917872288
Ref: c-api/call c PyObject_CallMethodObjArgs17872933
Ref: 1ddf17872933
Ref: c-api/call c PyObject_CallMethodNoArgs17873590
Ref: 529b17873590
Ref: c-api/call c PyObject_CallMethodOneArg17873997
Ref: 529c17873997
Ref: c-api/call c _PyObject_Vectorcall17874441
Ref: 529e17874441
Ref: c-api/call c PyObject_Vectorcall17874441
Ref: 77e17874441
Ref: c-api/call c PyObject_VectorcallDict17875261
Ref: 529d17875261
Ref: c-api/call c PyObject_VectorcallMethod17875974
Ref: 77f17875974
Node: Call Support API17877130
Ref: c-api/call call-support-api17877230
Ref: 529f17877230
Ref: c-api/call c PyCallable_Check17877281
Ref: 4f9217877281
Node: 数値型プロトコル number protocol17877677
Ref: c-api/number doc17877899
Ref: 52a017877899
Ref: c-api/number number17877899
Ref: 52a117877899
Ref: c-api/number number-protocol17877899
Ref: 52a217877899
Ref: c-api/number translation-repo17877899
Ref: 52a317877899
Ref: c-api/number c PyNumber_Check17877990
Ref: c5c17877990
Ref: c-api/number c PyNumber_Add17878426
Ref: 506517878426
Ref: c-api/number c PyNumber_Subtract17878768
Ref: 507f17878768
Ref: c-api/number c PyNumber_Multiply17879118
Ref: 507817879118
Ref: c-api/number c PyNumber_MatrixMultiply17879465
Ref: 10b617879465
Ref: c-api/number c PyNumber_FloorDivide17879889
Ref: 506917879889
Ref: c-api/number c PyNumber_TrueDivide17880213
Ref: 508017880213
Ref: c-api/number c PyNumber_Remainder17880832
Ref: 507d17880832
Ref: c-api/number c PyNumber_Divmod17881180
Ref: 506817881180
Ref: c-api/number c PyNumber_Power17881538
Ref: 507c17881538
Ref: c-api/number c PyNumber_Negative17882149
Ref: 507917882149
Ref: c-api/number c PyNumber_Positive17882450
Ref: 507b17882450
Ref: c-api/number c PyNumber_Absolute17882736
Ref: 506417882736
Ref: c-api/number c PyNumber_Invert17883036
Ref: 507617883036
Ref: c-api/number c PyNumber_Lshift17883363
Ref: 507717883363
Ref: c-api/number c PyNumber_Rshift17883718
Ref: 507e17883718
Ref: c-api/number c PyNumber_And17884073
Ref: 506617884073
Ref: c-api/number c PyNumber_Xor17884439
Ref: 508117884439
Ref: c-api/number c PyNumber_Or17884828
Ref: 507a17884828
Ref: c-api/number c PyNumber_InPlaceAdd17885189
Ref: 506a17885189
Ref: c-api/number c PyNumber_InPlaceSubtract17885634
Ref: 507317885634
Ref: c-api/number c PyNumber_InPlaceMultiply17886087
Ref: 506e17886087
Ref: c-api/number c PyNumber_InPlaceMatrixMultiply17886537
Ref: 10b717886537
Ref: c-api/number c PyNumber_InPlaceFloorDivide17887066
Ref: 506c17887066
Ref: c-api/number c PyNumber_InPlaceTrueDivide17887526
Ref: 507417887526
Ref: c-api/number c PyNumber_InPlaceRemainder17888214
Ref: 507117888214
Ref: c-api/number c PyNumber_InPlacePower17888667
Ref: 507017888667
Ref: c-api/number c PyNumber_InPlaceLshift17889471
Ref: 506d17889471
Ref: c-api/number c PyNumber_InPlaceRshift17889929
Ref: 507217889929
Ref: c-api/number c PyNumber_InPlaceAnd17890387
Ref: 506b17890387
Ref: c-api/number c PyNumber_InPlaceXor17890856
Ref: 507517890856
Ref: c-api/number c PyNumber_InPlaceOr17891347
Ref: 506f17891347
Ref: c-api/number c PyNumber_Long17891811
Ref: c5d17891811
Ref: c-api/number c PyNumber_Float17892126
Ref: c5e17892126
Ref: c-api/number c PyNumber_Index17892455
Ref: a9317892455
Ref: c-api/number c PyNumber_ToBase17892992
Ref: 1b7317892992
Ref: c-api/number c PyNumber_AsSsize_t17893639
Ref: 506717893639
Ref: c-api/number c PyIndex_Check17894491
Ref: b8117894491
Node: シーケンス型プロトコル sequence protocol17894892
Ref: c-api/sequence doc17895138
Ref: 52a417895138
Ref: c-api/sequence sequence17895138
Ref: 52a517895138
Ref: c-api/sequence sequence-protocol17895138
Ref: 52a617895138
Ref: c-api/sequence translation-repo17895138
Ref: 52a717895138
Ref: c-api/sequence c PySequence_Check17895248
Ref: 50a017895248
Ref: c-api/sequence c PySequence_Size17895714
Ref: 1e3317895714
Ref: c-api/sequence c PySequence_Length17895784
Ref: 50a817895784
Ref: c-api/sequence c PySequence_Concat17896106
Ref: 50a117896106
Ref: c-api/sequence c PySequence_Repeat17896457
Ref: 50aa17896457
Ref: c-api/sequence c PySequence_InPlaceConcat17896822
Ref: 50a517896822
Ref: c-api/sequence c PySequence_InPlaceRepeat17897276
Ref: 50a617897276
Ref: c-api/sequence c PySequence_GetItem17897743
Ref: 1e3417897743
Ref: c-api/sequence c PySequence_GetSlice17898079
Ref: 50a417898079
Ref: c-api/sequence c PySequence_SetItem17898460
Ref: 1e3517898460
Ref: c-api/sequence c PySequence_DelItem17899094
Ref: 1e3617899094
Ref: c-api/sequence c PySequence_SetSlice17899366
Ref: 50ab17899366
Ref: c-api/sequence c PySequence_DelSlice17899672
Ref: 50a317899672
Ref: c-api/sequence c PySequence_Count17900033
Ref: 50a217900033
Ref: c-api/sequence c PySequence_Contains17900420
Ref: 3d917900420
Ref: c-api/sequence c PySequence_In17900854
Ref: 3d817900854
Ref: c-api/sequence c PySequence_Index17901160
Ref: 50a717901160
Ref: c-api/sequence c PySequence_List17901523
Ref: 50a917901523
Ref: c-api/sequence c PySequence_Tuple17902002
Ref: 50ac17902002
Ref: c-api/sequence c PySequence_Fast17902550
Ref: 18a217902550
Ref: c-api/sequence c PySequence_Fast_GET_SIZE17903509
Ref: 3ca17903509
Ref: c-api/sequence c PySequence_Fast_GET_ITEM17904018
Ref: 3cb17904018
Ref: c-api/sequence c PySequence_Fast_ITEMS17904392
Ref: 3cc17904392
Ref: c-api/sequence c PySequence_ITEM17905022
Ref: 52a917905022
Node: マップ型プロトコル mapping protocol17905441
Ref: c-api/mapping doc17905695
Ref: 52aa17905695
Ref: c-api/mapping mapping17905695
Ref: 52ab17905695
Ref: c-api/mapping mapping-protocol17905695
Ref: 52ac17905695
Ref: c-api/mapping translation-repo17905695
Ref: 52ad17905695
Ref: c-api/mapping c PyMapping_Check17905920
Ref: 505117905920
Ref: c-api/mapping c PyMapping_Size17906359
Ref: 1e3717906359
Ref: c-api/mapping c PyMapping_Length17906428
Ref: 505217906428
Ref: c-api/mapping c PyMapping_GetItemString17906741
Ref: 5eb17906741
Ref: c-api/mapping c PyMapping_GetOptionalItem17907100
Ref: 5e817907100
Ref: c-api/mapping c PyMapping_GetOptionalItemString17907800
Ref: 5e917907800
Ref: c-api/mapping c PyMapping_SetItemString17908207
Ref: 505317908207
Ref: c-api/mapping c PyMapping_DelItem17908526
Ref: 52ae17908526
Ref: c-api/mapping c PyMapping_DelItemString17908653
Ref: 52af17908653
Ref: c-api/mapping c PyMapping_HasKeyWithError17908903
Ref: 61f17908903
Ref: c-api/mapping c PyMapping_HasKeyStringWithError17909274
Ref: 62117909274
Ref: c-api/mapping c PyMapping_HasKey17909660
Ref: 62017909660
Ref: c-api/mapping c PyMapping_HasKeyString17910359
Ref: 62217910359
Ref: c-api/mapping c PyMapping_Keys17911048
Ref: db517911048
Ref: c-api/mapping c PyMapping_Values17911466
Ref: db617911466
Ref: c-api/mapping c PyMapping_Items17911883
Ref: db717911883
Node: イテレータプロトコル iterator protocol17912375
Ref: c-api/iter doc17912621
Ref: 52b017912621
Ref: c-api/iter iterator17912621
Ref: 52b117912621
Ref: c-api/iter iterator-protocol17912621
Ref: 52b217912621
Ref: c-api/iter translation-repo17912621
Ref: 52b317912621
Ref: c-api/iter c PyIter_Check17912800
Ref: 1cb217912800
Ref: c-api/iter c PyAIter_Check17913088
Ref: 4f6317913088
Ref: c-api/iter c PyIter_NextItem17913391
Ref: 39817913391
Ref: c-api/iter c PyIter_Next17913864
Ref: 39917913864
Ref: c-api/iter c PySendResult17914520
Ref: 52b417914520
Ref: c-api/iter c PyIter_Send17914682
Ref: a9817914682
Node: バッファプロトコル buffer Protocol17915286
Ref: c-api/buffer doc17915479
Ref: 52b517915479
Ref: c-api/buffer buffer-protocol17915479
Ref: 52b617915479
Ref: c-api/buffer bufferobjects17915479
Ref: 26017915479
Ref: c-api/buffer translation-repo17915479
Ref: 52b717915479
Node: buffer 構造体17919180
Ref: c-api/buffer buffer-structure17919324
Ref: 52b817919324
Ref: c-api/buffer id117919324
Ref: 52b917919324
Ref: c-api/buffer c Py_buffer17920759
Ref: 95c17920759
Ref: c-api/buffer c Py_buffer buf17920920
Ref: 52bb17920920
Ref: c-api/buffer c Py_buffer obj17921453
Ref: 52bd17921453
Ref: c-api/buffer c Py_buffer len17922283
Ref: 52be17922283
Ref: c-api/buffer c Py_buffer readonly17923005
Ref: 52bf17923005
Ref: c-api/buffer c Py_buffer itemsize17923218
Ref: 52c017923218
Ref: c-api/buffer c Py_buffer format17924327
Ref: 52c117924327
Ref: c-api/buffer c Py_buffer ndim17924692
Ref: 52c317924692
Ref: c-api/buffer c Py_buffer shape17925128
Ref: 52c217925128
Ref: c-api/buffer c Py_buffer strides17925775
Ref: 52bc17925775
Ref: c-api/buffer c Py_buffer suboffsets17926483
Ref: 52c417926483
Ref: c-api/buffer c Py_buffer internal17927664
Ref: 52c617927664
Ref: c-api/buffer c PyBUF_MAX_NDIM17928242
Ref: 4f6d17928242
Node: バッファリクエストのタイプ17928596
Ref: c-api/buffer buffer-request-types17928764
Ref: 124917928764
Ref: c-api/buffer id217928764
Ref: 52c717928764
Node: リクエストに依存しないフィールド17929561
Ref: c-api/buffer request-independent-fields17929709
Ref: 52c817929709
Node: readonly format17930008
Ref: c-api/buffer readonly-format17930189
Ref: 52c917930189
Ref: c-api/buffer c PyBUF_WRITABLE17930240
Ref: 15cf17930240
Ref: c-api/buffer c PyBUF_WRITEABLE17930807
Ref: 52ca17930807
Ref: c-api/buffer c PyBUF_FORMAT17930945
Ref: 4f6917930945
Node: shape strides suboffsets17931933
Ref: c-api/buffer shape-strides-suboffsets17932093
Ref: 52cb17932093
Ref: c-api/buffer c PyBUF_INDIRECT17932730
Ref: 4f6c17932730
Ref: c-api/buffer c PyBUF_STRIDES17932943
Ref: 4f7417932943
Ref: c-api/buffer c PyBUF_ND17933141
Ref: 4f6e17933141
Ref: c-api/buffer c PyBUF_SIMPLE17933348
Ref: 4f7117933348
Node: 隣接性のリクエスト17933519
Ref: c-api/buffer contiguity-requests17933685
Ref: 52cc17933685
Ref: c-api/buffer c PyBUF_C_CONTIGUOUS17934405
Ref: 15d017934405
Ref: c-api/buffer c PyBUF_F_CONTIGUOUS17934651
Ref: 15d117934651
Ref: c-api/buffer c PyBUF_ANY_CONTIGUOUS17934899
Ref: 4f6617934899
Node: 複合リクエスト17935281
Ref: c-api/buffer compound-requests17935414
Ref: 52cd17935414
Ref: c-api/buffer c PyBUF_FULL17936446
Ref: 4f6a17936446
Ref: c-api/buffer c PyBUF_FULL_RO17936750
Ref: 4f6b17936750
Ref: c-api/buffer c PyBUF_RECORDS17937052
Ref: 4f6f17937052
Ref: c-api/buffer c PyBUF_RECORDS_RO17937351
Ref: 4f7017937351
Ref: c-api/buffer c PyBUF_STRIDED17937645
Ref: 4f7217937645
Ref: c-api/buffer c PyBUF_STRIDED_RO17937945
Ref: 4f7317937945
Ref: c-api/buffer c PyBUF_CONTIG17938239
Ref: 4f6717938239
Ref: c-api/buffer c PyBUF_CONTIG_RO17938539
Ref: 4f6817938539
Node: 複雑な配列17938802
Ref: c-api/buffer complex-arrays17938981
Ref: 52c517938981
Node: NumPy スタイル shape strides17939198
Ref: c-api/buffer numpy-style-shape-and-strides17939332
Ref: 52ce17939332
Node: PIL スタイル shape strides suboffsets17941421
Ref: c-api/buffer pil-style-shape-strides-and-suboffsets17941555
Ref: 52cf17941555
Node: バッファ関連の関数17942856
Ref: c-api/buffer buffer-related-functions17942987
Ref: 52d017942987
Ref: c-api/buffer c PyObject_CheckBuffer17943053
Ref: 63917943053
Ref: c-api/buffer c PyObject_GetBuffer17943523
Ref: 63a17943523
Ref: c-api/buffer c PyBuffer_Release17944919
Ref: 63b17944919
Ref: c-api/buffer c PyBuffer_SizeFromFormat17945500
Ref: 95e17945500
Ref: c-api/buffer c PyBuffer_IsContiguous17945826
Ref: 96217945826
Ref: c-api/buffer c PyBuffer_GetPointer17946375
Ref: 95d17946375
Ref: c-api/buffer c PyBuffer_FromContiguous17946791
Ref: 96017946791
Ref: c-api/buffer c PyBuffer_ToContiguous17947307
Ref: 95f17947307
Ref: c-api/buffer c PyObject_CopyData17947925
Ref: 96117947925
Ref: c-api/buffer c PyBuffer_FillContiguousStrides17948273
Ref: 96317948273
Ref: c-api/buffer c PyBuffer_FillInfo17948754
Ref: 96417948754
Node: 具象オブジェクト concrete object レイヤ17950070
Ref: c-api/concrete doc17950346
Ref: 52d117950346
Ref: c-api/concrete concrete17950346
Ref: 52d217950346
Ref: c-api/concrete concrete-objects-layer17950346
Ref: 52d317950346
Ref: c-api/concrete translation-repo17950346
Ref: 52d417950346
Node: 基本オブジェクト fundamental object17952124
Ref: c-api/concrete fundamental17952305
Ref: 52d617952305
Ref: c-api/concrete fundamental-objects17952305
Ref: 52d717952305
Node: 型オブジェクト<2>17952631
Ref: c-api/type doc17952767
Ref: 52d817952767
Ref: c-api/type type-objects17952767
Ref: 52d917952767
Ref: c-api/type typeobjects17952767
Ref: 52da17952767
Ref: c-api/type c PyTypeObject17952821
Ref: c9c17952821
Ref: c-api/type c PyType_Type17953059
Ref: 76f17953059
Ref: c-api/type c PyType_Check17953318
Ref: 1d8717953318
Ref: c-api/type c PyType_CheckExact17953565
Ref: 1d8817953565
Ref: c-api/type c PyType_ClearCache17953795
Ref: 50da17953795
Ref: c-api/type c PyType_GetFlags17954008
Ref: 1d3d17954008
Ref: c-api/type c PyType_GetDict17954587
Ref: 1a8b17954587
Ref: c-api/type c PyType_Modified17955317
Ref: 1b7b17955317
Ref: c-api/type c PyType_AddWatcher17955685
Ref: 78517955685
Ref: c-api/type c PyType_ClearWatcher17956204
Ref: 52db17956204
Ref: c-api/type c PyType_Watch17956676
Ref: 78617956676
Ref: c-api/type c PyType_Unwatch17957380
Ref: 52dc17957380
Ref: c-api/type c PyType_WatchCallback17957893
Ref: 52dd17957893
Ref: c-api/type c PyType_HasFeature17958259
Ref: 1d3c17958259
Ref: c-api/type c PyType_FastSubclass17958455
Ref: 52de17958455
Ref: c-api/type c PyType_IS_GC17958944
Ref: 52e017958944
Ref: c-api/type c PyType_IsSubtype17959136
Ref: 50db17959136
Ref: c-api/type c PyType_GenericAlloc17959574
Ref: c6117959574
Ref: c-api/type c PyType_GenericNew17960814
Ref: 4ecc17960814
Ref: c-api/type c PyType_Ready17961199
Ref: 98017961199
Ref: c-api/type c PyType_GetName17962286
Ref: 95817962286
Ref: c-api/type c PyType_GetQualName17962607
Ref: 95917962607
Ref: c-api/type c PyType_GetFullyQualifiedName17962956
Ref: 61617962956
Ref: c-api/type c PyType_GetModuleName17963404
Ref: 61817963404
Ref: c-api/type c PyType_GetSlot17963714
Ref: a9c17963714
Ref: c-api/type c PyType_GetModule17964480
Ref: b6617964480
Ref: c-api/type c PyType_GetModuleState17965451
Ref: b6717965451
Ref: c-api/type c PyType_GetModuleByDef17966063
Ref: 63517966063
Ref: c-api/type c PyType_GetBaseByToken17967062
Ref: 3b017967062
Ref: c-api/type c PyUnstable_Type_AssignVersionTag17967903
Ref: 52e317967903
Ref: c-api/type c PyType_SUPPORTS_WEAKREFS17968444
Ref: 52e417968444
Node: Creating Heap-Allocated Types17968827
Ref: c-api/type creating-heap-allocated-types17968917
Ref: 52e517968917
Ref: c-api/type c PyType_FromMetaclass17969073
Ref: 77217969073
Ref: c-api/type c PyType_FromModuleAndSpec17971276
Ref: 77317971276
Ref: c-api/type c PyType_FromSpecWithBases17972295
Ref: 79e17972295
Ref: c-api/type c PyType_FromSpec17973145
Ref: 79d17973145
Ref: c-api/type c PyType_Freeze17973918
Ref: 3af17973918
Ref: c-api/type c PyType_Spec17974464
Ref: 1a8917974464
Ref: c-api/type c PyType_Spec name17974636
Ref: 52e617974636
Ref: c-api/type c PyType_Spec basicsize17974770
Ref: 76a17974770
Ref: c-api/type c PyType_Spec itemsize17975553
Ref: 52e717975553
Ref: c-api/type c PyType_Spec flags17976686
Ref: 52e817976686
Ref: c-api/type c PyType_Spec slots17976940
Ref: 52e917976940
Ref: c-api/type c PyType_Slot17977184
Ref: 50dc17977184
Ref: c-api/type c PyType_Slot slot17977418
Ref: 52e117977418
Ref: c-api/type c PyType_Slot pfunc17979979
Ref: 52f217979979
Ref: c-api/type c Py_tp_token17980382
Ref: 3b117980382
Ref: c-api/type c Py_TP_USE_SPEC17981496
Ref: 513917981496
Node: None オブジェクト17981816
Ref: c-api/none doc17981952
Ref: 52f317981952
Ref: c-api/none noneobject17981952
Ref: 52f417981952
Ref: c-api/none the-none-object17981952
Ref: 52f517981952
Ref: c-api/none translation-repo17981952
Ref: 52f617981952
Ref: c-api/none c Py_None17982383
Ref: 4e9f17982383
Ref: c-api/none c Py_RETURN_NONE17982693
Ref: 168c17982693
Node: 数値型オブジェクト numeric object17982788
Ref: c-api/concrete numeric-objects17983027
Ref: 52f717983027
Ref: c-api/concrete numericobjects17983027
Ref: 52f817983027
Node: 整数型オブジェクト integer object17983313
Ref: c-api/long doc17983469
Ref: 52f917983469
Ref: c-api/long integer-objects17983469
Ref: 52fa17983469
Ref: c-api/long longobjects17983469
Ref: 52fb17983469
Ref: c-api/long c PyLongObject17983913
Ref: 39e17983913
Ref: c-api/long c PyLong_Type17984128
Ref: 504f17984128
Ref: c-api/long c PyLong_Check17984429
Ref: 52fc17984429
Ref: c-api/long c PyLong_CheckExact17984651
Ref: 52fd17984651
Ref: c-api/long c PyLong_FromLong17984887
Ref: 1bd017984887
Ref: c-api/long c PyLong_FromUnsignedLong17985431
Ref: 18bd17985431
Ref: c-api/long c PyLong_FromSsize_t17985777
Ref: 189e17985777
Ref: c-api/long c PyLong_FromSize_t17986119
Ref: 18bf17986119
Ref: c-api/long c PyLong_FromLongLong17986446
Ref: 1bd117986446
Ref: c-api/long c PyLong_FromInt3217986774
Ref: 3a317986774
Ref: c-api/long c PyLong_FromInt6417986846
Ref: 3a417986846
Ref: c-api/long c PyLong_FromUnsignedLongLong17987169
Ref: 18be17987169
Ref: c-api/long c PyLong_FromUInt3217987533
Ref: 3a517987533
Ref: c-api/long c PyLong_FromUInt6417987607
Ref: 3a617987607
Ref: c-api/long c PyLong_FromDouble17987937
Ref: b3c17987937
Ref: c-api/long c PyLong_FromString17988257
Ref: 504c17988257
Ref: c-api/long c PyLong_FromUnicodeObject17989549
Ref: ab717989549
Ref: c-api/long c PyLong_FromVoidPtr17989800
Ref: 504d17989800
Ref: c-api/long c PyLong_FromNativeBytes17990127
Ref: 60717990127
Ref: c-api/long c PyLong_FromUnsignedNativeBytes17990887
Ref: 60817990887
Ref: c-api/long c PyLong_FromPid17991509
Ref: 52fe17991509
Ref: c-api/long c PyLong_AsLong17991816
Ref: 60517991816
Ref: c-api/long c PyLong_AS_LONG17992640
Ref: 52ff17992640
Ref: c-api/long c PyLong_AsInt17992985
Ref: 60417992985
Ref: c-api/long c PyLong_AsLongAndOverflow17993249
Ref: 147d17993249
Ref: c-api/long c PyLong_AsLongLong17994294
Ref: 504617994294
Ref: c-api/long c PyLong_AsLongLongAndOverflow17995137
Ref: 147e17995137
Ref: c-api/long c PyLong_AsSsize_t17996226
Ref: 504817996226
Ref: c-api/long c PyLong_AsUnsignedLong17996823
Ref: 504917996823
Ref: c-api/long c PyLong_AsSize_t17997414
Ref: 504717997414
Ref: c-api/long c PyLong_AsUnsignedLongLong17997983
Ref: 14ac17997983
Ref: c-api/long c PyLong_AsUnsignedLongMask17998798
Ref: 504a17998798
Ref: c-api/long c PyLong_AsUnsignedLongLongMask17999692
Ref: 1dca17999692
Ref: c-api/long c PyLong_AsInt3218000621
Ref: 39f18000621
Ref: c-api/long c PyLong_AsInt6418000689
Ref: 3a018000689
Ref: c-api/long c PyLong_AsUInt3218001348
Ref: 3a118001348
Ref: c-api/long c PyLong_AsUInt6418001418
Ref: 3a218001418
Ref: c-api/long c PyLong_AsDouble18002158
Ref: 197518002158
Ref: c-api/long c PyLong_AsVoidPtr18002709
Ref: 504b18002709
Ref: c-api/long c PyLong_AsNativeBytes18003334
Ref: 60618003334
Ref: c-api/long c Py_ASNATIVEBYTES_DEFAULTS18007574
Ref: 512318007574
Ref: c-api/long c Py_ASNATIVEBYTES_BIG_ENDIAN18007746
Ref: 512218007746
Ref: c-api/long c Py_ASNATIVEBYTES_LITTLE_ENDIAN18007918
Ref: 512418007918
Ref: c-api/long c Py_ASNATIVEBYTES_NATIVE_ENDIAN18008087
Ref: 512518008087
Ref: c-api/long c Py_ASNATIVEBYTES_UNSIGNED_BUFFER18008225
Ref: 512718008225
Ref: c-api/long c Py_ASNATIVEBYTES_REJECT_NEGATIVE18008447
Ref: 512618008447
Ref: c-api/long c Py_ASNATIVEBYTES_ALLOW_INDEX18008698
Ref: 512118008698
Ref: c-api/long c PyLong_AsPid18010686
Ref: 19cf18010686
Ref: c-api/long c PyLong_GetSign18011017
Ref: 39a18011017
Ref: c-api/long c PyLong_IsPositive18011436
Ref: 39b18011436
Ref: c-api/long c PyLong_IsNegative18011775
Ref: 39c18011775
Ref: c-api/long c PyLong_IsZero18012114
Ref: 39d18012114
Ref: c-api/long c PyLong_GetInfo18012425
Ref: 504e18012425
Ref: c-api/long c PyUnstable_Long_IsCompact18012840
Ref: 7a618012840
Ref: c-api/long c PyUnstable_Long_CompactValue18013711
Ref: 7a718013711
Node: Export API18014310
Ref: c-api/long export-api18014424
Ref: 530018014424
Ref: c-api/long c PyLongLayout18014487
Ref: 530118014487
Ref: c-api/long c PyLongLayout bits_per_digit18014936
Ref: 530218014936
Ref: c-api/long c PyLongLayout digit_size18015110
Ref: 530318015110
Ref: c-api/long c PyLongLayout digits_order18015263
Ref: 530418015263
Ref: c-api/long c PyLongLayout digit_endianness18015456
Ref: 530518015456
Ref: c-api/long c PyLong_GetNativeLayout18015684
Ref: 3a718015684
Ref: c-api/long c PyLongExport18016154
Ref: 530618016154
Ref: c-api/long c PyLongExport value18016507
Ref: 530818016507
Ref: c-api/long c PyLongExport negative18016689
Ref: 530918016689
Ref: c-api/long c PyLongExport ndigits18016867
Ref: 530a18016867
Ref: c-api/long c PyLongExport digits18017052
Ref: 530718017052
Ref: c-api/long c PyLong_Export18017170
Ref: 3a818017170
Ref: c-api/long c PyLong_FreeExport18017782
Ref: 3a918017782
Node: PyLongWriter API18018064
Ref: c-api/long pylongwriter-api18018201
Ref: 530b18018201
Ref: c-api/long c PyLongWriter18018345
Ref: 530c18018345
Ref: c-api/long c PyLongWriter_Create18018545
Ref: 3aa18018545
Ref: c-api/long c PyLongWriter_Finish18019670
Ref: 3ab18019670
Ref: c-api/long c PyLongWriter_Discard18020198
Ref: 3ac18020198
Node: Deprecated API18020499
Ref: c-api/long deprecated-api18020617
Ref: 530d18020617
Ref: c-api/long c PyLong_SHIFT18021103
Ref: 530e18021103
Ref: c-api/long c PyLong_BASE18021252
Ref: 1c0018021252
Ref: c-api/long c PyLong_MASK18021354
Ref: 530f18021354
Node: Boolean オブジェクト18021467
Ref: c-api/bool doc18021654
Ref: 531018021654
Ref: c-api/bool boolean-objects18021654
Ref: 531118021654
Ref: c-api/bool boolobjects18021654
Ref: 531218021654
Ref: c-api/bool translation-repo18021654
Ref: 531318021654
Ref: c-api/bool c PyBool_Type18022058
Ref: 4f7718022058
Ref: c-api/bool c PyBool_Check18022355
Ref: 531618022355
Ref: c-api/bool c Py_False18022525
Ref: 531418022525
Ref: c-api/bool c Py_True18022813
Ref: 531518022813
Ref: c-api/bool c Py_RETURN_FALSE18023097
Ref: 168e18023097
Ref: c-api/bool c Py_RETURN_TRUE18023194
Ref: 168d18023194
Ref: c-api/bool c PyBool_FromLong18023289
Ref: 4f7618023289
Node: Floating-Point Objects18023548
Ref: c-api/float doc18023720
Ref: 531718023720
Ref: c-api/float floating-point-objects18023720
Ref: 531818023720
Ref: c-api/float floatobjects18023720
Ref: 531918023720
Ref: c-api/float translation-repo18023720
Ref: 531a18023720
Ref: c-api/float c PyFloatObject18023783
Ref: 531b18023783
Ref: c-api/float c PyFloat_Type18023917
Ref: 502b18023917
Ref: c-api/float c PyFloat_Check18024184
Ref: 531c18024184
Ref: c-api/float c PyFloat_CheckExact18024411
Ref: 531d18024411
Ref: c-api/float c PyFloat_FromString18024657
Ref: 502a18024657
Ref: c-api/float c PyFloat_FromDouble18024971
Ref: 502918024971
Ref: c-api/float c PyFloat_AsDouble18025268
Ref: c5f18025268
Ref: c-api/float c PyFloat_AS_DOUBLE18025964
Ref: 531e18025964
Ref: c-api/float c PyFloat_GetInfo18026154
Ref: 160918026154
Ref: c-api/float c PyFloat_GetMax18026493
Ref: 160718026493
Ref: c-api/float c PyFloat_GetMin18026683
Ref: 160818026683
Ref: c-api/float c Py_INFINITY18026879
Ref: 531f18026879
Ref: c-api/float c Py_NAN18027144
Ref: 532018027144
Ref: c-api/float c Py_HUGE_VAL18027411
Ref: 532118027411
Ref: c-api/float c Py_MATH_E18027562
Ref: 532218027562
Ref: c-api/float c Py_MATH_El18027685
Ref: 532318027685
Ref: c-api/float c Py_MATH_PI18027791
Ref: 532418027791
Ref: c-api/float c Py_MATH_PIl18027916
Ref: 532518027916
Ref: c-api/float c Py_MATH_TAU18028029
Ref: 532618028029
Ref: c-api/float c Py_RETURN_NAN18028184
Ref: 532718028184
Ref: c-api/float c Py_RETURN_INF18028360
Ref: 532818028360
Ref: c-api/float c Py_IS_FINITE18028642
Ref: 532918028642
Ref: c-api/float c Py_IS_INFINITY18028969
Ref: 532a18028969
Ref: c-api/float c Py_IS_NAN18029247
Ref: 168f18029247
Node: Pack and Unpack functions18029557
Ref: c-api/float pack-and-unpack-functions18029641
Ref: 532b18029641
Node: Pack functions18031077
Ref: c-api/float pack-functions18031178
Ref: 532c18031178
Ref: c-api/float c PyFloat_Pack218031952
Ref: 96918031952
Ref: c-api/float c PyFloat_Pack418032086
Ref: 96a18032086
Ref: c-api/float c PyFloat_Pack818032222
Ref: 96b18032222
Node: Unpack functions18032358
Ref: c-api/float unpack-functions18032459
Ref: 532d18032459
Ref: c-api/float c PyFloat_Unpack218033210
Ref: 96c18033210
Ref: c-api/float c PyFloat_Unpack418033347
Ref: 96d18033347
Ref: c-api/float c PyFloat_Unpack818033486
Ref: 96e18033486
Node: 複素数オブジェクト18033625
Ref: c-api/complex doc18033762
Ref: 532e18033762
Ref: c-api/complex complex-number-objects18033762
Ref: 532f18033762
Ref: c-api/complex complexobjects18033762
Ref: 533018033762
Ref: c-api/complex translation-repo18033762
Ref: 533118033762
Node: C 構造体としての複素数18034296
Ref: c-api/complex complex-numbers-as-c-structures18034450
Ref: 533218034450
Ref: c-api/complex c Py_complex18034790
Ref: 523d18034790
Ref: c-api/complex c Py_complex real18035075
Ref: 533318035075
Ref: c-api/complex c Py_complex imag18035118
Ref: 533418035118
Ref: c-api/complex c _Py_c_sum18035303
Ref: 533518035303
Ref: c-api/complex c _Py_c_diff18035487
Ref: 533618035487
Ref: c-api/complex c _Py_c_neg18035672
Ref: 533718035672
Ref: c-api/complex c _Py_c_prod18035831
Ref: 533818035831
Ref: c-api/complex c _Py_c_quot18036016
Ref: 533918036016
Ref: c-api/complex c _Py_c_pow18036344
Ref: 18f218036344
Node: Python オブジェクトとしての複素数型18036750
Ref: c-api/complex complex-numbers-as-python-objects18036904
Ref: 533a18036904
Ref: c-api/complex c PyComplexObject18037009
Ref: 533b18037009
Ref: c-api/complex c PyComplex_Type18037160
Ref: 4fae18037160
Ref: c-api/complex c PyComplex_Check18037455
Ref: 533c18037455
Ref: c-api/complex c PyComplex_CheckExact18037687
Ref: 533d18037687
Ref: c-api/complex c PyComplex_FromCComplex18037939
Ref: 533e18037939
Ref: c-api/complex c PyComplex_FromDoubles18038207
Ref: 4fad18038207
Ref: c-api/complex c PyComplex_RealAsDouble18038522
Ref: 1a1218038522
Ref: c-api/complex c PyComplex_ImagAsDouble18039253
Ref: 1a1318039253
Ref: c-api/complex c PyComplex_AsCComplex18039994
Ref: 160a18039994
Node: シーケンスオブジェクト sequence object18040870
Ref: c-api/concrete sequence-objects18041094
Ref: 533f18041094
Ref: c-api/concrete sequenceobjects18041094
Ref: 534018041094
Node: バイトオブジェクト<2>18041790
Ref: c-api/bytes doc18041946
Ref: 534118041946
Ref: c-api/bytes bytes-objects18041946
Ref: 534218041946
Ref: c-api/bytes bytesobjects18041946
Ref: 534318041946
Ref: c-api/bytes c PyBytesObject18042223
Ref: 99518042223
Ref: c-api/bytes c PyBytes_Type18042383
Ref: 4f8818042383
Ref: c-api/bytes c PyBytes_Check18042667
Ref: 15b718042667
Ref: c-api/bytes c PyBytes_CheckExact18042911
Ref: 534418042911
Ref: c-api/bytes c PyBytes_FromString18043163
Ref: 4f8518043163
Ref: c-api/bytes c PyBytes_FromStringAndSize18043587
Ref: 15b818043587
Ref: c-api/bytes c PyBytes_FromFormat18044070
Ref: 1e0b18044070
Ref: c-api/bytes c PyBytes_FromFormatV18047893
Ref: 4f8318047893
Ref: c-api/bytes c PyBytes_FromObject18048204
Ref: 4f8418048204
Ref: c-api/bytes c PyBytes_Size18048468
Ref: 4f8718048468
Ref: c-api/bytes c PyBytes_GET_SIZE18048672
Ref: 534518048672
Ref: c-api/bytes c PyBytes_AsString18048851
Ref: a8718048851
Ref: c-api/bytes c PyBytes_AS_STRING18049654
Ref: 534618049654
Ref: c-api/bytes c PyBytes_AsStringAndSize18049825
Ref: 4f7f18049825
Ref: c-api/bytes c PyBytes_Concat18051172
Ref: 4f8018051172
Ref: c-api/bytes c PyBytes_ConcatAndDel18051759
Ref: 4f8118051759
Ref: c-api/bytes c PyBytes_Join18052123
Ref: 38318052123
Ref: c-api/bytes c _PyBytes_Resize18052768
Ref: 19ce18052768
Ref: c-api/bytes c PyBytes_Repr18053490
Ref: 4f8618053490
Ref: c-api/bytes c PyBytes_DecodeEscape18054436
Ref: 4f8218054436
Ref: バイトオブジェクト<2>-Footnote-118055282
Ref: バイトオブジェクト<2>-Footnote-218055402
Ref: バイトオブジェクト<2>-Footnote-318055522
Ref: バイトオブジェクト<2>-Footnote-418055642
Ref: バイトオブジェクト<2>-Footnote-518055762
Ref: バイトオブジェクト<2>-Footnote-618055882
Ref: バイトオブジェクト<2>-Footnote-718056002
Ref: バイトオブジェクト<2>-Footnote-818056122
Node: bytearray オブジェクト<2>18056242
Ref: c-api/bytearray doc18056442
Ref: 534718056442
Ref: c-api/bytearray byte-array-objects18056442
Ref: 534818056442
Ref: c-api/bytearray bytearrayobjects18056442
Ref: 534918056442
Ref: c-api/bytearray translation-repo18056442
Ref: 534a18056442
Ref: c-api/bytearray c PyByteArrayObject18056511
Ref: 534b18056511
Ref: c-api/bytearray c PyByteArray_Type18056678
Ref: 4f7d18056678
Node: 型チェックマクロ18057063
Ref: c-api/bytearray type-check-macros18057190
Ref: 534c18057190
Ref: c-api/bytearray c PyByteArray_Check18057249
Ref: 534d18057249
Ref: c-api/bytearray c PyByteArray_CheckExact18057511
Ref: 534e18057511
Node: ダイレクト API 関数18057781
Ref: c-api/bytearray direct-api-functions18057926
Ref: 534f18057926
Ref: c-api/bytearray c PyByteArray_FromObject18057990
Ref: 15c218057990
Ref: c-api/bytearray c PyByteArray_FromStringAndSize18058370
Ref: 15c318058370
Ref: c-api/bytearray c PyByteArray_Concat18058700
Ref: 4f7a18058700
Ref: c-api/bytearray c PyByteArray_Size18059039
Ref: 4f7c18059039
Ref: c-api/bytearray c PyByteArray_AsString18059275
Ref: 4f7918059275
Ref: c-api/bytearray c PyByteArray_Resize18059594
Ref: 4f7b18059594
Node: マクロ18059969
Ref: c-api/bytearray macros18060081
Ref: 535018060081
Ref: c-api/bytearray c PyByteArray_AS_STRING18060262
Ref: 535118060262
Ref: c-api/bytearray c PyByteArray_GET_SIZE18060445
Ref: 535218060445
Node: Unicode オブジェクトと codec18060650
Ref: c-api/unicode doc18060860
Ref: 13b818060860
Ref: c-api/unicode translation-repo18060860
Ref: 535318060860
Ref: c-api/unicode unicode-objects-and-codecs18060860
Ref: 535418060860
Ref: c-api/unicode unicodeobjects18060860
Ref: 535518060860
Node: Unicode オブジェクト18061228
Ref: c-api/unicode unicode-objects18061368
Ref: 535618061368
Ref: Unicode オブジェクト-Footnote-118062417
Ref: Unicode オブジェクト-Footnote-218062459
Node: Unicode 型18062501
Ref: c-api/unicode unicode-type18062613
Ref: 535718062613
Ref: c-api/unicode c PyUnicode_Type18062758
Ref: 511b18062758
Ref: c-api/unicode c PyUnicodeIter_Type18063002
Ref: 50ec18063002
Ref: c-api/unicode c Py_UCS418063262
Ref: 33d18063262
Ref: c-api/unicode c Py_UCS218063298
Ref: 138c18063298
Ref: c-api/unicode c Py_UCS118063334
Ref: 138b18063334
Ref: c-api/unicode c PyASCIIObject18063737
Ref: 138d18063737
Ref: c-api/unicode c PyCompactUnicodeObject18063779
Ref: 138e18063779
Ref: c-api/unicode c PyUnicodeObject18063830
Ref: 99718063830
Ref: c-api/unicode c PyUnicode_IS_COMPACT18064492
Ref: 535818064492
Ref: c-api/unicode c PyUnicode_IS_COMPACT_ASCII18064665
Ref: 535918064665
Ref: c-api/unicode c PyUnicode_Check18064961
Ref: 535a18064961
Ref: c-api/unicode c PyUnicode_CheckExact18065215
Ref: 535b18065215
Ref: c-api/unicode c PyUnicode_GET_LENGTH18065462
Ref: ab118065462
Ref: c-api/unicode c PyUnicode_1BYTE_DATA18065813
Ref: 139218065813
Ref: c-api/unicode c PyUnicode_2BYTE_DATA18065903
Ref: 139318065903
Ref: c-api/unicode c PyUnicode_4BYTE_DATA18065993
Ref: 139418065993
Ref: c-api/unicode c PyUnicode_1BYTE_KIND18066495
Ref: 139618066495
Ref: c-api/unicode c PyUnicode_2BYTE_KIND18066536
Ref: 139718066536
Ref: c-api/unicode c PyUnicode_4BYTE_KIND18066577
Ref: 139818066577
Ref: c-api/unicode c PyUnicode_KIND18066807
Ref: 139518066807
Ref: c-api/unicode c PyUnicode_DATA18067249
Ref: 139118067249
Ref: c-api/unicode c PyUnicode_WRITE18067565
Ref: 139b18067565
Ref: c-api/unicode c PyUnicode_READ18068224
Ref: 139918068224
Ref: c-api/unicode c PyUnicode_READ_CHAR18068603
Ref: 139a18068603
Ref: c-api/unicode c PyUnicode_MAX_CHAR_VALUE18069056
Ref: 139c18069056
Ref: c-api/unicode c PyUnicode_IsIdentifier18069503
Ref: 1d8618069503
Ref: c-api/unicode c PyUnicode_IS_ASCII18069965
Ref: 535c18069965
Node: Unicode 文字プロパティ18070172
Ref: c-api/unicode unicode-character-properties18070334
Ref: 535d18070334
Ref: c-api/unicode c Py_UNICODE_ISSPACE18070707
Ref: 1cc518070707
Ref: c-api/unicode c Py_UNICODE_ISLOWER18070857
Ref: 535e18070857
Ref: c-api/unicode c Py_UNICODE_ISUPPER18071004
Ref: 535f18071004
Ref: c-api/unicode c Py_UNICODE_ISTITLE18071151
Ref: 536018071151
Ref: c-api/unicode c Py_UNICODE_ISLINEBREAK18071344
Ref: 536118071344
Ref: c-api/unicode c Py_UNICODE_ISDECIMAL18071498
Ref: 536218071498
Ref: c-api/unicode c Py_UNICODE_ISDIGIT18071653
Ref: 536318071653
Ref: c-api/unicode c Py_UNICODE_ISNUMERIC18071804
Ref: 536418071804
Ref: c-api/unicode c Py_UNICODE_ISALPHA18071973
Ref: 536518071973
Ref: c-api/unicode c Py_UNICODE_ISALNUM18072144
Ref: 536618072144
Ref: c-api/unicode c Py_UNICODE_ISPRINTABLE18072294
Ref: 536718072294
Ref: c-api/unicode c Py_UNICODE_TOLOWER18072570
Ref: 536818072570
Ref: c-api/unicode c Py_UNICODE_TOUPPER18072703
Ref: 536918072703
Ref: c-api/unicode c Py_UNICODE_TOTITLE18072836
Ref: 536a18072836
Ref: c-api/unicode c Py_UNICODE_TODECIMAL18072987
Ref: 536b18072987
Ref: c-api/unicode c Py_UNICODE_TODIGIT18073209
Ref: 536c18073209
Ref: c-api/unicode c Py_UNICODE_TONUMERIC18073425
Ref: 536d18073425
Ref: c-api/unicode c Py_UNICODE_IS_SURROGATE18073701
Ref: 536e18073701
Ref: c-api/unicode c Py_UNICODE_IS_HIGH_SURROGATE18073867
Ref: 536f18073867
Ref: c-api/unicode c Py_UNICODE_IS_LOW_SURROGATE18074044
Ref: 537018074044
Ref: c-api/unicode c Py_UNICODE_HIGH_SURROGATE18074220
Ref: 537118074220
Ref: c-api/unicode c Py_UNICODE_LOW_SURROGATE18074437
Ref: 537218074437
Ref: c-api/unicode c Py_UNICODE_JOIN_SURROGATES18074652
Ref: 537318074652
Node: Unicode 文字列の生成とアクセス18075058
Ref: c-api/unicode creating-and-accessing-unicode-strings18075245
Ref: 537418075245
Ref: c-api/unicode c PyUnicode_New18075530
Ref: aa918075530
Ref: c-api/unicode c PyUnicode_FromKindAndData18077014
Ref: 138f18077014
Ref: c-api/unicode c PyUnicode_FromStringAndSize18077935
Ref: 511318077935
Ref: c-api/unicode c PyUnicode_FromString18078619
Ref: 511218078619
Ref: c-api/unicode c PyUnicode_FromFormat18078925
Ref: 62b18078925
Ref: c-api/unicode c PyUnicode_FromFormatV18091887
Ref: 79418091887
Ref: c-api/unicode c PyUnicode_FromObject18092201
Ref: 511018092201
Ref: c-api/unicode c PyUnicode_FromOrdinal18092704
Ref: 511118092704
Ref: c-api/unicode c PyUnicode_FromEncodedObject18093057
Ref: 510f18093057
Ref: c-api/unicode c PyUnicode_Append18094220
Ref: 50f418094220
Ref: c-api/unicode c PyUnicode_AppendAndDel18094690
Ref: 50f518094690
Ref: c-api/unicode c PyUnicode_BuildEncodingMap18094993
Ref: 1a6218094993
Ref: c-api/unicode c PyUnicode_GetDefaultEncoding18095568
Ref: 511418095568
Ref: c-api/unicode c PyUnicode_GetLength18095901
Ref: ab018095901
Ref: c-api/unicode c PyUnicode_CopyCharacters18096238
Ref: ab218096238
Ref: c-api/unicode c PyUnicode_Resize18096906
Ref: 511618096906
Ref: c-api/unicode c PyUnicode_Fill18097595
Ref: 13a518097595
Ref: c-api/unicode c PyUnicode_WriteChar18098272
Ref: 138a18098272
Ref: c-api/unicode c PyUnicode_ReadChar18099017
Ref: 138918099017
Ref: c-api/unicode c PyUnicode_Substring18099616
Ref: ab318099616
Ref: c-api/unicode c PyUnicode_AsUCS418100099
Ref: 139018100099
Ref: c-api/unicode c PyUnicode_AsUCS4Copy18100648
Ref: ab818100648
Node: ロケールエンコーディング18101203
Ref: c-api/unicode locale-encoding18101409
Ref: 537618101409
Ref: c-api/unicode c PyUnicode_DecodeLocaleAndSize18101634
Ref: dc218101634
Ref: c-api/unicode c PyUnicode_DecodeLocale18102974
Ref: 510118102974
Ref: c-api/unicode c PyUnicode_EncodeLocale18103349
Ref: dc318103349
Ref: ロケールエンコーディング-Footnote-118104702
Ref: ロケールエンコーディング-Footnote-218104744
Node: ファイルシステムエンコーディング18104786
Ref: c-api/unicode file-system-encoding18104971
Ref: 537718104971
Ref: c-api/unicode c PyUnicode_FSConverter18105372
Ref: f1518105372
Ref: c-api/unicode c PyUnicode_FSDecoder18106686
Ref: 79718106686
Ref: c-api/unicode c PyUnicode_DecodeFSDefaultAndSize18107845
Ref: 50ff18107845
Ref: c-api/unicode c PyUnicode_DecodeFSDefault18108419
Ref: 1a8818108419
Ref: c-api/unicode c PyUnicode_EncodeFSDefault18108886
Ref: 1e3118108886
Ref: ファイルシステムエンコーディング-Footnote-118109607
Ref: ファイルシステムエンコーディング-Footnote-218109649
Node: wchar_t サポート18109691
Ref: c-api/unicode wchar-t-support18109831
Ref: 537818109831
Ref: c-api/unicode c PyUnicode_FromWideChar18109977
Ref: 13a418109977
Ref: c-api/unicode c PyUnicode_AsWideChar18110418
Ref: 1e3818110418
Ref: c-api/unicode c PyUnicode_AsWideCharString18111421
Ref: ab918111421
Node: 組み込み codec built-in codec18112578
Ref: c-api/unicode built-in-codecs18112780
Ref: 537918112780
Ref: c-api/unicode builtincodecs18112780
Ref: 537518112780
Node: 汎用 codec18114420
Ref: c-api/unicode generic-codecs18114523
Ref: 537a18114523
Ref: c-api/unicode c Py_UNICODE_REPLACEMENT_CHARACTER18114600
Ref: 537b18114600
Ref: c-api/unicode c PyUnicode_Decode18114893
Ref: 1dc718114893
Ref: c-api/unicode c PyUnicode_AsEncodedString18115476
Ref: 50f718115476
Node: UTF-8 Codecs18116170
Ref: c-api/unicode utf-8-codecs18116295
Ref: 537c18116295
Ref: c-api/unicode c PyUnicode_DecodeUTF818116378
Ref: 510b18116378
Ref: c-api/unicode c PyUnicode_DecodeUTF8Stateful18116799
Ref: 1b1718116799
Ref: c-api/unicode c PyUnicode_AsUTF8String18117429
Ref: 13a618117429
Ref: c-api/unicode c PyUnicode_AsUTF8AndSize18117969
Ref: a9918117969
Ref: c-api/unicode c PyUnicode_AsUTF818119489
Ref: 42418119489
Ref: UTF-8 Codecs-Footnote-118120310
Node: UTF-32 Codecs18120363
Ref: c-api/unicode utf-32-codecs18120489
Ref: 537d18120489
Ref: c-api/unicode c PyUnicode_DecodeUTF3218120572
Ref: 510718120572
Ref: c-api/unicode c PyUnicode_DecodeUTF32Stateful18122064
Ref: 510818122064
Ref: c-api/unicode c PyUnicode_AsUTF32String18122839
Ref: 50f918122839
Node: UTF-16 Codecs18123336
Ref: c-api/unicode utf-16-codecs18123462
Ref: 537e18123462
Ref: c-api/unicode c PyUnicode_DecodeUTF1618123548
Ref: 510518123548
Ref: c-api/unicode c PyUnicode_DecodeUTF16Stateful18125160
Ref: 510618125160
Ref: c-api/unicode c PyUnicode_AsUTF16String18125925
Ref: 50f818125925
Node: UTF-7 Codecs18126422
Ref: c-api/unicode utf-7-codecs18126556
Ref: 537f18126556
Ref: c-api/unicode c PyUnicode_DecodeUTF718126640
Ref: 510918126640
Ref: c-api/unicode c PyUnicode_DecodeUTF7Stateful18127007
Ref: 510a18127007
Node: Unicode-Escape Codecs18127633
Ref: c-api/unicode unicode-escape-codecs18127779
Ref: 538018127779
Ref: c-api/unicode c PyUnicode_DecodeUnicodeEscape18127892
Ref: 510c18127892
Ref: c-api/unicode c PyUnicode_AsUnicodeEscapeString18128277
Ref: 13a718128277
Node: Raw-Unicode-Escape Codecs18128721
Ref: c-api/unicode raw-unicode-escape-codecs18128869
Ref: 538118128869
Ref: c-api/unicode c PyUnicode_DecodeRawUnicodeEscape18128993
Ref: 510418128993
Ref: c-api/unicode c PyUnicode_AsRawUnicodeEscapeString18129385
Ref: 13a818129385
Node: Latin-1 Codecs18129837
Ref: c-api/unicode latin-1-codecs18129976
Ref: 538218129976
Ref: c-api/unicode c PyUnicode_DecodeLatin118130196
Ref: 510018130196
Ref: c-api/unicode c PyUnicode_AsLatin1String18130620
Ref: 13a918130620
Node: ASCII Codecs18131052
Ref: c-api/unicode ascii-codecs18131186
Ref: 538318131186
Ref: c-api/unicode c PyUnicode_DecodeASCII18131381
Ref: 50fc18131381
Ref: c-api/unicode c PyUnicode_AsASCIIString18131749
Ref: 13aa18131749
Node: Character Map Codecs18132179
Ref: c-api/unicode character-map-codecs18132324
Ref: 538418132324
Ref: c-api/unicode c PyUnicode_DecodeCharmap18132992
Ref: 50fd18132992
Ref: c-api/unicode c PyUnicode_AsCharmapString18133984
Ref: 50f618133984
Ref: c-api/unicode c PyUnicode_Translate18134888
Ref: 511a18134888
Node: Windows 用の MBCS codec18135941
Ref: c-api/unicode mbcs-codecs-for-windows18136065
Ref: 538518136065
Ref: c-api/unicode c PyUnicode_DecodeMBCS18136672
Ref: 510218136672
Ref: c-api/unicode c PyUnicode_DecodeMBCSStateful18137080
Ref: 510318137080
Ref: c-api/unicode c PyUnicode_DecodeCodePageStateful18137753
Ref: 50fe18137753
Ref: c-api/unicode c PyUnicode_AsMBCSString18138184
Ref: 13ab18138184
Ref: c-api/unicode c PyUnicode_EncodeCodePage18138665
Ref: 13ac18138665
Node: メソッドおよびスロット関数 slot function18139170
Ref: c-api/unicode methods-and-slot-functions18139361
Ref: 538618139361
Ref: c-api/unicode unicodemethodsandslots18139361
Ref: 538718139361
Ref: c-api/unicode c PyUnicode_Concat18139837
Ref: 13b918139837
Ref: c-api/unicode c PyUnicode_Split18140112
Ref: 511818140112
Ref: c-api/unicode c PyUnicode_RSplit18140912
Ref: 189718140912
Ref: c-api/unicode c PyUnicode_Splitlines18141335
Ref: 511918141335
Ref: c-api/unicode c PyUnicode_Partition18141756
Ref: 189818141756
Ref: c-api/unicode c PyUnicode_RPartition18142391
Ref: 189918142391
Ref: c-api/unicode c PyUnicode_Join18142953
Ref: 13ba18142953
Ref: c-api/unicode c PyUnicode_Tailmatch18143289
Ref: ab518143289
Ref: c-api/unicode c PyUnicode_Find18143757
Ref: 510d18143757
Ref: c-api/unicode c PyUnicode_FindChar18144517
Ref: ab618144517
Ref: c-api/unicode c PyUnicode_Count18145452
Ref: 50fb18145452
Ref: c-api/unicode c PyUnicode_Replace18145820
Ref: 511518145820
Ref: c-api/unicode c PyUnicode_Compare18146335
Ref: ab418146335
Ref: c-api/unicode c PyUnicode_Equal18146949
Ref: 3b218146949
Ref: c-api/unicode c PyUnicode_EqualToUTF8AndSize18147661
Ref: 61918147661
Ref: c-api/unicode c PyUnicode_EqualToUTF818148288
Ref: 61a18148288
Ref: c-api/unicode c PyUnicode_CompareWithASCIIString18148690
Ref: 147f18148690
Ref: c-api/unicode c PyUnicode_RichCompare18149376
Ref: 511718149376
Ref: c-api/unicode c PyUnicode_Format18150119
Ref: 510e18150119
Ref: c-api/unicode c PyUnicode_Contains18150483
Ref: 50fa18150483
Ref: c-api/unicode c PyUnicode_InternInPlace18150896
Ref: aae18150896
Ref: c-api/unicode c PyUnicode_InternFromString18152278
Ref: 198c18152278
Ref: c-api/unicode c PyUnicode_CHECK_INTERNED18153130
Ref: 538818153130
Node: PyUnicodeWriter18153642
Ref: c-api/unicode pyunicodewriter18153817
Ref: 538918153817
Ref: c-api/unicode c PyUnicodeWriter18153984
Ref: 3b318153984
Ref: c-api/unicode c PyUnicodeWriter_Create18154207
Ref: 3b418154207
Ref: c-api/unicode c PyUnicodeWriter_Finish18154562
Ref: 3b718154562
Ref: c-api/unicode c PyUnicodeWriter_Discard18154861
Ref: 3b618154861
Ref: c-api/unicode c PyUnicodeWriter_WriteChar18155128
Ref: 3ba18155128
Ref: c-api/unicode c PyUnicodeWriter_WriteUTF818155402
Ref: 3bf18155402
Ref: c-api/unicode c PyUnicodeWriter_WriteASCII18155929
Ref: 3b918155929
Ref: c-api/unicode c PyUnicodeWriter_WriteWideChar18156495
Ref: 3c018156495
Ref: c-api/unicode c PyUnicodeWriter_WriteUCS418156918
Ref: 3be18156918
Ref: c-api/unicode c PyUnicodeWriter_WriteStr18157245
Ref: 3bc18157245
Ref: c-api/unicode c PyUnicodeWriter_WriteRepr18157549
Ref: 3bb18157549
Ref: c-api/unicode c PyUnicodeWriter_WriteSubstring18157855
Ref: 3bd18157855
Ref: c-api/unicode c PyUnicodeWriter_Format18158362
Ref: 3b818158362
Ref: c-api/unicode c PyUnicodeWriter_DecodeUTF8Stateful18158687
Ref: 3b518158687
Node: Deprecated API<2>18159624
Ref: c-api/unicode deprecated-api18159737
Ref: 538a18159737
Ref: c-api/unicode c Py_UNICODE18159820
Ref: 3e018159820
Ref: c-api/unicode c PyUnicode_READY18160372
Ref: 43418160372
Ref: c-api/unicode c PyUnicode_IS_READY18160803
Ref: 538b18160803
Node: タプルオブジェクト tuple object18161212
Ref: c-api/tuple doc18161425
Ref: 538c18161425
Ref: c-api/tuple translation-repo18161425
Ref: 538d18161425
Ref: c-api/tuple tuple-objects18161425
Ref: 538e18161425
Ref: c-api/tuple tupleobjects18161425
Ref: 538f18161425
Ref: c-api/tuple c PyTupleObject18161521
Ref: 522418161521
Ref: c-api/tuple c PyTuple_Type18161685
Ref: 50d918161685
Ref: c-api/tuple c PyTuple_Check18161984
Ref: 539018161984
Ref: c-api/tuple c PyTuple_CheckExact18162213
Ref: 539118162213
Ref: c-api/tuple c PyTuple_New18162450
Ref: 63e18162450
Ref: c-api/tuple c PyTuple_Pack18162700
Ref: 50d718162700
Ref: c-api/tuple c PyTuple_Size18163139
Ref: 50d818163139
Ref: c-api/tuple c PyTuple_GET_SIZE18163388
Ref: 539218163388
Ref: c-api/tuple c PyTuple_GetItem18163527
Ref: 4eb718163527
Ref: c-api/tuple c PyTuple_GET_ITEM18164237
Ref: 539318164237
Ref: c-api/tuple c PyTuple_GetSlice18164490
Ref: 50d618164490
Ref: c-api/tuple c PyTuple_SetItem18164949
Ref: 4eb818164949
Ref: c-api/tuple c PyTuple_SET_ITEM18165630
Ref: 62e18165630
Ref: c-api/tuple c _PyTuple_Resize18166715
Ref: 172418166715
Node: Struct Sequence オブジェクト18167799
Ref: c-api/tuple id118168004
Ref: 539418168004
Ref: c-api/tuple struct-sequence-objects18168004
Ref: 13d718168004
Ref: c-api/tuple c PyStructSequence_NewType18168437
Ref: 50b918168437
Ref: c-api/tuple c PyStructSequence_InitType18168894
Ref: 120418168894
Ref: c-api/tuple c PyStructSequence_InitType218169108
Ref: 120518169108
Ref: c-api/tuple c PyStructSequence_Desc18169380
Ref: db418169380
Ref: c-api/tuple c PyStructSequence_Desc name18169597
Ref: 539518169597
Ref: c-api/tuple c PyStructSequence_Desc doc18169772
Ref: 539618169772
Ref: c-api/tuple c PyStructSequence_Desc fields18169888
Ref: 539718169888
Ref: c-api/tuple c PyStructSequence_Desc n_in_sequence18170057
Ref: 539818170057
Ref: c-api/tuple c PyStructSequence_Field18170192
Ref: db318170192
Ref: c-api/tuple c PyStructSequence_Field name18170633
Ref: 539918170633
Ref: c-api/tuple c PyStructSequence_Field doc18170846
Ref: 539a18170846
Ref: c-api/tuple c PyStructSequence_UnnamedField18170944
Ref: b7918170944
Ref: c-api/tuple c PyStructSequence_New18171257
Ref: 50b818171257
Ref: c-api/tuple c PyStructSequence_GetItem18171673
Ref: 50b718171673
Ref: c-api/tuple c PyStructSequence_GET_ITEM18172078
Ref: 539b18172078
Ref: c-api/tuple c PyStructSequence_SetItem18172386
Ref: 50ba18172386
Ref: c-api/tuple c PyStructSequence_SET_ITEM18172987
Ref: 539c18172987
Node: リストオブジェクト18173259
Ref: c-api/list doc18173415
Ref: 539d18173415
Ref: c-api/list list-objects18173415
Ref: 539e18173415
Ref: c-api/list listobjects18173415
Ref: 539f18173415
Ref: c-api/list translation-repo18173415
Ref: 53a018173415
Ref: c-api/list c PyListObject18173481
Ref: 52a818173481
Ref: c-api/list c PyList_Type18173644
Ref: 4edb18173644
Ref: c-api/list c PyList_Check18173951
Ref: 53a118173951
Ref: c-api/list c PyList_CheckExact18174179
Ref: 53a218174179
Ref: c-api/list c PyList_New18174415
Ref: 4f4918174415
Ref: c-api/list c PyList_Size18175242
Ref: 163318175242
Ref: c-api/list c PyList_GET_SIZE18175511
Ref: 53a318175511
Ref: c-api/list c PyList_GetItemRef18175691
Ref: 5fe18175691
Ref: c-api/list c PyList_GetItem18176243
Ref: 5ff18176243
Ref: c-api/list c PyList_GET_ITEM18176557
Ref: 4f5f18176557
Ref: c-api/list c PyList_SetItem18176790
Ref: 18ba18176790
Ref: c-api/list c PyList_SET_ITEM18177468
Ref: 62f18177468
Ref: c-api/list c PyList_Insert18178383
Ref: 18b918178383
Ref: c-api/list c PyList_Append18178811
Ref: 503f18178811
Ref: c-api/list c PyList_GetSlice18179178
Ref: 504118179178
Ref: c-api/list c PyList_SetSlice18179723
Ref: 504318179723
Ref: c-api/list c PyList_Extend18180377
Ref: 60018180377
Ref: c-api/list c PyList_Clear18180821
Ref: 60118180821
Ref: c-api/list c PyList_Sort18181196
Ref: 504418181196
Ref: c-api/list c PyList_Reverse18181500
Ref: 504218181500
Ref: c-api/list c PyList_AsTuple18181807
Ref: 504018181807
Node: Container オブジェクト18182090
Ref: c-api/concrete container-objects18182302
Ref: 53a418182302
Ref: c-api/concrete mapobjects18182302
Ref: 53a518182302
Node: 辞書オブジェクト dictionary object18182496
Ref: c-api/dict doc18182634
Ref: 53a618182634
Ref: c-api/dict dictionary-objects18182634
Ref: 53a718182634
Ref: c-api/dict dictobjects18182634
Ref: 53a818182634
Ref: c-api/dict c PyDictObject18182733
Ref: 64f18182733
Ref: c-api/dict c PyDict_Type18182893
Ref: 4fc618182893
Ref: c-api/dict c PyDict_Check18183215
Ref: 52d518183215
Ref: c-api/dict c PyDict_CheckExact18183437
Ref: 53a918183437
Ref: c-api/dict c PyDict_New18183667
Ref: 4fc418183667
Ref: c-api/dict c PyDictProxy_New18183896
Ref: 4fb718183896
Ref: c-api/dict c PyDictProxy_Type18184414
Ref: 4fb818184414
Ref: c-api/dict c PyDict_Clear18185010
Ref: 4fbd18185010
Ref: c-api/dict c PyDict_Contains18185212
Ref: 5de18185212
Ref: c-api/dict c PyDict_ContainsString18185555
Ref: 5dd18185555
Ref: c-api/dict c PyDict_Copy18185830
Ref: 66218185830
Ref: c-api/dict c PyDict_SetItem18186064
Ref: 4eb918186064
Ref: c-api/dict c PyDict_SetItemString18186629
Ref: 198d18186629
Ref: c-api/dict c PyDict_DelItem18186945
Ref: 4fbe18186945
Ref: c-api/dict c PyDict_DelItemString18187483
Ref: 4fbf18187483
Ref: c-api/dict c PyDict_GetItemRef18187774
Ref: 5e018187774
Ref: c-api/dict c PyDict_GetItem18188439
Ref: 62818188439
Ref: c-api/dict c PyDict_GetItemWithError18189214
Ref: 5e118189214
Ref: c-api/dict c PyDict_GetItemString18189683
Ref: 62918189683
Ref: c-api/dict c PyDict_GetItemStringRef18190395
Ref: 42118190395
Ref: c-api/dict c PyDict_SetDefault18190775
Ref: 5e418190775
Ref: c-api/dict c PyDict_SetDefaultRef18191385
Ref: 5e318191385
Ref: c-api/dict c PyDict_Pop18192482
Ref: 42218192482
Ref: c-api/dict c PyDict_PopString18193228
Ref: 5e518193228
Ref: c-api/dict c PyDict_Items18193513
Ref: 4fc018193513
Ref: c-api/dict c PyDict_Keys18193757
Ref: 4fc118193757
Ref: c-api/dict c PyDict_Values18193997
Ref: 4fc818193997
Ref: c-api/dict c PyDict_Size18194240
Ref: 4fc518194240
Ref: c-api/dict c PyDict_GET_SIZE18194481
Ref: 53aa18194481
Ref: c-api/dict c PyDict_Next18194624
Ref: 198f18194624
Ref: c-api/dict c PyDict_Merge18197821
Ref: 4fc218197821
Ref: c-api/dict c PyDict_Update18198642
Ref: 4fc718198642
Ref: c-api/dict c PyDict_MergeFromSeq218199176
Ref: 4fc318199176
Ref: c-api/dict c PyDict_AddWatcher18200211
Ref: 3d018200211
Ref: c-api/dict c PyDict_ClearWatcher18200574
Ref: 53ac18200574
Ref: c-api/dict c PyDict_Watch18200878
Ref: 78418200878
Ref: c-api/dict c PyDict_Unwatch18201205
Ref: 53ad18201205
Ref: c-api/dict c PyDict_WatchEvent18201620
Ref: 53ae18201620
Ref: c-api/dict c PyDict_WatchCallback18201941
Ref: 53af18201941
Node: Dictionary View Objects18204282
Ref: c-api/dict dictionary-view-objects18204413
Ref: 53b018204413
Ref: c-api/dict c PyDictViewSet_Check18204478
Ref: 53b118204478
Ref: c-api/dict c PyDictKeys_Type18204780
Ref: 4fb618204780
Ref: c-api/dict c PyDictKeys_Check18205020
Ref: 53b218205020
Ref: c-api/dict c PyDictValues_Type18205179
Ref: 4fbc18205179
Ref: c-api/dict c PyDictValues_Check18205425
Ref: 53b418205425
Ref: c-api/dict c PyDictItems_Type18205587
Ref: 4fb218205587
Ref: c-api/dict c PyDictItems_Check18205830
Ref: 53b318205830
Node: Ordered Dictionaries18205990
Ref: c-api/dict ordered-dictionaries18206121
Ref: 53b518206121
Ref: c-api/dict c PyODict_Type18206408
Ref: 53b618206408
Ref: c-api/dict c PyODict_Check18206595
Ref: 53b718206595
Ref: c-api/dict c PyODict_CheckExact18206811
Ref: 53b818206811
Ref: c-api/dict c PyODictKeys_Type18207038
Ref: 53b918207038
Ref: c-api/dict c PyODictValues_Type18207169
Ref: 53ba18207169
Ref: c-api/dict c PyODictItems_Type18207309
Ref: 53bb18207309
Ref: c-api/dict c PyODict_New18207447
Ref: 53bc18207447
Ref: c-api/dict c PyODict_SetItem18207630
Ref: 53bd18207630
Ref: c-api/dict c PyODict_DelItem18207940
Ref: 53be18207940
Ref: c-api/dict c PyODict_GetItem18208621
Ref: 53bf18208621
Ref: c-api/dict c PyODict_GetItemWithError18208830
Ref: 53c018208830
Ref: c-api/dict c PyODict_GetItemString18209036
Ref: 53c118209036
Ref: c-api/dict c PyODict_Contains18209237
Ref: 53c218209237
Ref: c-api/dict c PyODict_Size18209429
Ref: 53c318209429
Ref: c-api/dict c PyODict_SIZE18209627
Ref: 53c418209627
Node: Set オブジェクト18209737
Ref: c-api/set doc18209875
Ref: 53c518209875
Ref: c-api/set set-objects18209875
Ref: 53c618209875
Ref: c-api/set setobjects18209875
Ref: 53c718209875
Ref: c-api/set translation-repo18209875
Ref: 53c818209875
Ref: c-api/set c PySetObject18210712
Ref: 53c918210712
Ref: c-api/set c PySet_Type18211505
Ref: 50b018211505
Ref: c-api/set c PyFrozenSet_Type18211721
Ref: 502c18211721
Ref: c-api/set c PySet_Check18212214
Ref: 53ca18212214
Ref: c-api/set c PyFrozenSet_Check18212424
Ref: 53cb18212424
Ref: c-api/set c PyAnySet_Check18212647
Ref: 53cc18212647
Ref: c-api/set c PySet_CheckExact18212901
Ref: a9d18212901
Ref: c-api/set c PyAnySet_CheckExact18213158
Ref: 53cd18213158
Ref: c-api/set c PyFrozenSet_CheckExact18213457
Ref: 53ce18213457
Ref: c-api/set c PySet_New18213697
Ref: 165d18213697
Ref: c-api/set c PyFrozenSet_New18214322
Ref: 165e18214322
Ref: c-api/set c PySet_Size18215023
Ref: 166218215023
Ref: c-api/set c PySet_GET_SIZE18215394
Ref: 53cf18215394
Ref: c-api/set c PySet_Contains18215563
Ref: 166118215563
Ref: c-api/set c PySet_Add18216124
Ref: 165f18216124
Ref: c-api/set c PySet_Discard18217134
Ref: 166018217134
Ref: c-api/set c PySet_Pop18217751
Ref: 50af18217751
Ref: c-api/set c PySet_Clear18218311
Ref: 50ae18218311
Node: Deprecated API<3>18218656
Ref: c-api/set deprecated-api18218732
Ref: 53d018218732
Ref: c-api/set c PySet_MINSIZE18218779
Ref: 53d118218779
Node: Function オブジェクト<2>18219354
Ref: c-api/concrete function-objects18219550
Ref: 53d218219550
Ref: c-api/concrete otherobjects18219550
Ref: 53d318219550
Node: Function オブジェクト<3>18220093
Ref: c-api/function doc18220271
Ref: 53d418220271
Ref: c-api/function function-objects18220271
Ref: 53d518220271
Ref: c-api/function id118220271
Ref: 53d618220271
Ref: c-api/function c PyFunctionObject18220402
Ref: 78318220402
Ref: c-api/function c PyFunction_Type18220492
Ref: 53d718220492
Ref: c-api/function c PyFunction_Check18220757
Ref: 53d818220757
Ref: c-api/function c PyFunction_New18221025
Ref: 53d918221025
Ref: c-api/function c PyFunction_NewWithQualName18221844
Ref: 53da18221844
Ref: c-api/function c PyFunction_GetCode18222481
Ref: 53db18222481
Ref: c-api/function c PyFunction_GetGlobals18222695
Ref: 53dc18222695
Ref: c-api/function c PyFunction_GetModule18222898
Ref: 53dd18222898
Ref: c-api/function c PyFunction_GetDefaults18223287
Ref: 53de18223287
Ref: c-api/function c PyFunction_SetDefaults18223546
Ref: 53df18223546
Ref: c-api/function c PyFunction_SetVectorcall18223909
Ref: 78218223909
Ref: c-api/function c PyFunction_GetKwDefaults18224235
Ref: 53e018224235
Ref: c-api/function c PyFunction_SetKwDefaults18224500
Ref: 53e118224500
Ref: c-api/function c PyFunction_GetClosure18224867
Ref: 53e218224867
Ref: c-api/function c PyFunction_SetClosure18225126
Ref: 53e318225126
Ref: c-api/function c PyFunction_GetAnnotations18225513
Ref: 1b3718225513
Ref: c-api/function c PyFunction_SetAnnotations18225784
Ref: 53e418225784
Ref: c-api/function c PyFunction_GET_CODE18226149
Ref: 53e518226149
Ref: c-api/function c PyFunction_GET_GLOBALS18226223
Ref: 53e618226223
Ref: c-api/function c PyFunction_GET_MODULE18226310
Ref: 53e718226310
Ref: c-api/function c PyFunction_GET_DEFAULTS18226386
Ref: 53e818226386
Ref: c-api/function c PyFunction_GET_KW_DEFAULTS18226474
Ref: 53e918226474
Ref: c-api/function c PyFunction_GET_CLOSURE18226565
Ref: 53ea18226565
Ref: c-api/function c PyFunction_GET_ANNOTATIONS18226652
Ref: 53eb18226652
Ref: c-api/function c PyFunction_AddWatcher18226990
Ref: 53ec18226990
Ref: c-api/function c PyFunction_ClearWatcher18227372
Ref: 53ed18227372
Ref: c-api/function c PyFunction_WatchEvent18227741
Ref: 53ee18227741
Ref: c-api/function c PyFunction_WatchCallback18228137
Ref: 53ef18228137
Node: インスタンスメソッドオブジェクト Instance Method Objects18230351
Ref: c-api/method doc18230571
Ref: 53f018230571
Ref: c-api/method instance-method-objects18230571
Ref: 53f118230571
Ref: c-api/method instancemethod-objects18230571
Ref: 53f218230571
Ref: c-api/method translation-repo18230571
Ref: 53f318230571
Ref: c-api/method c PyInstanceMethod_Type18230922
Ref: 53f418230922
Ref: c-api/method c PyInstanceMethod_Check18231185
Ref: 53f518231185
Ref: c-api/method c PyInstanceMethod_New18231488
Ref: 53f618231488
Ref: c-api/method c PyInstanceMethod_Function18231869
Ref: 53f718231869
Ref: c-api/method c PyInstanceMethod_GET_FUNCTION18232103
Ref: 53f818232103
Node: メソッドオブジェクト<2>18232343
Ref: c-api/method id118232569
Ref: 53f918232569
Ref: c-api/method method-objects18232569
Ref: 53fa18232569
Ref: c-api/method c PyMethod_Type18232941
Ref: 53fb18232941
Ref: c-api/method c PyMethod_Check18233232
Ref: 53fc18233232
Ref: c-api/method c PyMethod_New18233502
Ref: 53fd18233502
Ref: c-api/method c PyMethod_Function18233990
Ref: 53fe18233990
Ref: c-api/method c PyMethod_GET_FUNCTION18234198
Ref: 53ff18234198
Ref: c-api/method c PyMethod_Self18234424
Ref: 540018234424
Ref: c-api/method c PyMethod_GET_SELF18234616
Ref: 540118234616
Node: セルオブジェクト cell object18234824
Ref: c-api/cell doc18235008
Ref: 540218235008
Ref: c-api/cell cell-objects18235008
Ref: 91018235008
Ref: c-api/cell id118235008
Ref: 540318235008
Ref: c-api/cell translation-repo18235008
Ref: 540418235008
Ref: c-api/cell c PyCellObject18235692
Ref: 540518235692
Ref: c-api/cell c PyCell_Type18235801
Ref: 540618235801
Ref: c-api/cell c PyCell_Check18235929
Ref: 540718235929
Ref: c-api/cell c PyCell_New18236148
Ref: 540818236148
Ref: c-api/cell c PyCell_Get18236397
Ref: 540918236397
Ref: c-api/cell c PyCell_GET18236652
Ref: 540a18236652
Ref: c-api/cell c PyCell_Set18236903
Ref: 540b18236903
Ref: c-api/cell c PyCell_SET18237276
Ref: aab18237276
Node: コードオブジェクト<3>18237661
Ref: c-api/code doc18237829
Ref: 540c18237829
Ref: c-api/code code-objects18237829
Ref: 540d18237829
Ref: c-api/code codeobjects18237829
Ref: 7d218237829
Ref: c-api/code translation-repo18237829
Ref: 540e18237829
Ref: c-api/code c PyCodeObject18238106
Ref: 97b18238106
Ref: c-api/code c PyCode_Type18238306
Ref: 540f18238306
Ref: c-api/code c PyCode_Check18238465
Ref: 541018238465
Ref: c-api/code c PyCode_GetNumFree18238607
Ref: 541118238607
Ref: c-api/code c PyUnstable_Code_GetFirstFree18238783
Ref: 62718238783
Ref: c-api/code c PyUnstable_Code_New18239413
Ref: 541218239413
Ref: c-api/code c PyCode_NewWithPosOnlyArgs18240914
Ref: 541318240914
Ref: c-api/code c PyUnstable_Code_NewWithPosOnlyArgs18240914
Ref: 541418240914
Ref: c-api/code c PyCode_NewEmpty18242206
Ref: 156818242206
Ref: c-api/code c PyCode_Addr2Line18242553
Ref: a8918242553
Ref: c-api/code c PyCode_Addr2Location18242957
Ref: 7d118242957
Ref: c-api/code c PyCode_GetCode18243438
Ref: 97c18243438
Ref: c-api/code c PyCode_GetVarnames18244023
Ref: 97d18244023
Ref: c-api/code c PyCode_GetCellvars18244388
Ref: 97e18244388
Ref: c-api/code c PyCode_GetFreevars18244798
Ref: 97f18244798
Ref: c-api/code c PyCode_AddWatcher18245184
Ref: 78718245184
Ref: c-api/code c PyCode_ClearWatcher18245546
Ref: 78818245546
Ref: c-api/code c PyCodeEvent18245906
Ref: 541518245906
Ref: c-api/code c PyCode_WatchCallback18246098
Ref: 541618246098
Ref: c-api/code c PyCode_Optimize18247889
Ref: 541718247889
Ref: コードオブジェクト<3>-Footnote-118248306
Node: Code Object Flags18248388
Ref: c-api/code c-codeobject-flags18248537
Ref: 51e118248537
Ref: c-api/code code-object-flags18248537
Ref: 541818248537
Ref: c-api/code c CO_OPTIMIZED18249591
Ref: 541918249591
Ref: c-api/code c CO_NEWLOCALS18249796
Ref: 541a18249796
Ref: c-api/code c CO_VARARGS18249999
Ref: 541b18249999
Ref: c-api/code c CO_VARKEYWORDS18250206
Ref: 541c18250206
Ref: c-api/code c CO_NESTED18250408
Ref: 541d18250408
Ref: c-api/code c CO_GENERATOR18250613
Ref: 541e18250613
Ref: c-api/code c CO_COROUTINE18250818
Ref: 541f18250818
Ref: c-api/code c CO_ITERABLE_COROUTINE18251032
Ref: 542018251032
Ref: c-api/code c CO_ASYNC_GENERATOR18251243
Ref: 542118251243
Ref: c-api/code c CO_HAS_DOCSTRING18251452
Ref: 542218251452
Ref: c-api/code c CO_METHOD18251654
Ref: 542318251654
Ref: c-api/code c CO_FUTURE_DIVISION18251865
Ref: 542418251865
Ref: c-api/code c CO_FUTURE_ABSOLUTE_IMPORT18252088
Ref: 542518252088
Ref: c-api/code c CO_FUTURE_WITH_STATEMENT18252310
Ref: 542618252310
Ref: c-api/code c CO_FUTURE_PRINT_FUNCTION18252532
Ref: 542718252532
Ref: c-api/code c CO_FUTURE_UNICODE_LITERALS18252756
Ref: 542818252756
Ref: c-api/code c CO_FUTURE_GENERATOR_STOP18252978
Ref: 542918252978
Ref: c-api/code c CO_FUTURE_ANNOTATIONS18253197
Ref: 51e018253197
Node: Extra information18253308
Ref: c-api/code extra-information18253418
Ref: 542a18253418
Ref: c-api/code c _PyEval_RequestCodeExtraIndex18253791
Ref: 542b18253791
Ref: c-api/code c PyUnstable_Eval_RequestCodeExtraIndex18253791
Ref: 542c18253791
Ref: c-api/code c _PyCode_GetExtra18254883
Ref: 542d18254883
Ref: c-api/code c PyUnstable_Code_GetExtra18254883
Ref: 542e18254883
Ref: c-api/code c _PyCode_SetExtra18255715
Ref: 542f18255715
Ref: c-api/code c PyUnstable_Code_SetExtra18255715
Ref: 543018255715
Node: その他のオブジェクト<2>18256430
Ref: c-api/concrete other-objects18256625
Ref: 543118256625
Node: ファイルオブジェクト18257693
Ref: c-api/file doc18257849
Ref: 543218257849
Ref: c-api/file file-objects18257849
Ref: 543318257849
Ref: c-api/file fileobjects18257849
Ref: 543418257849
Ref: c-api/file c PyFile_FromFd18258725
Ref: 502418258725
Ref: c-api/file c PyObject_AsFileDescriptor18260019
Ref: 508718260019
Ref: c-api/file c PyFile_GetLine18260620
Ref: 502518260620
Ref: c-api/file c PyFile_SetOpenCodeHook18261685
Ref: 1a9a18261685
Ref: c-api/file c Py_OpenCodeHookFunction18261984
Ref: 543518261984
Ref: c-api/file c PyFile_OpenCodeObject18263551
Ref: 543618263551
Ref: c-api/file c PyFile_OpenCode18264152
Ref: 543718264152
Ref: c-api/file c PyFile_WriteObject18264357
Ref: 502618264357
Ref: c-api/file c PyFile_WriteString18264992
Ref: 502718264992
Node: Deprecated API<4>18265371
Ref: c-api/file deprecated-api18265455
Ref: 543818265455
Ref: c-api/file c PyFile_NewStdPrinter18265679
Ref: 543918265679
Ref: c-api/file c PyStdPrinter_Type18265863
Ref: 543a18265863
Node: モジュールオブジェクト module object18266133
Ref: c-api/module doc18266316
Ref: 543b18266316
Ref: c-api/module module-objects18266316
Ref: 543c18266316
Ref: c-api/module moduleobjects18266316
Ref: 543d18266316
Ref: c-api/module translation-repo18266316
Ref: 543e18266316
Ref: c-api/module c PyModule_Type18266422
Ref: 506318266422
Ref: c-api/module c PyModule_Check18266689
Ref: 543f18266689
Ref: c-api/module c PyModule_CheckExact18266925
Ref: 544018266925
Ref: c-api/module c PyModule_NewObject18267170
Ref: 506118267170
Ref: c-api/module c PyModule_New18267919
Ref: 506018267919
Ref: c-api/module c PyModule_GetDict18268242
Ref: 505d18268242
Ref: c-api/module c PyModule_GetNameObject18269148
Ref: 505f18269148
Ref: c-api/module c PyModule_GetName18269573
Ref: 505e18269573
Ref: c-api/module c PyModule_GetState18270014
Ref: b7718270014
Ref: c-api/module c PyModule_GetDef18270389
Ref: 505c18270389
Ref: c-api/module c PyModule_GetFilenameObject18270920
Ref: 42e18270920
Ref: c-api/module c PyModule_GetFilename18271409
Ref: 42d18271409
Node: Module definitions18272114
Ref: c-api/module module-definitions18272305
Ref: 544118272305
Ref: c-api/module pymoduledef18272305
Ref: 544218272305
Ref: c-api/module c PyModuleDef18273142
Ref: b7418273142
Ref: c-api/module c PyModuleDef m_base18273592
Ref: 544418273592
Ref: c-api/module c PyModuleDef m_name18273760
Ref: 544518273760
Ref: c-api/module c PyModuleDef m_doc18273859
Ref: 544618273859
Ref: c-api/module c PyModuleDef m_size18274051
Ref: b7618274051
Ref: c-api/module c PyModuleDef m_methods18275292
Ref: 544718275292
Ref: c-api/module c PyModuleDef m_slots18275587
Ref: 521518275587
Ref: c-api/module c PyModuleDef m_slots m_reload18276068
Ref: 544818276068
Ref: c-api/module c PyModuleDef m_traverse18276140
Ref: b7118276140
Ref: c-api/module c PyModuleDef m_clear18276927
Ref: b7218276927
Ref: c-api/module c PyModuleDef m_free18278063
Ref: b7318278063
Ref: Module definitions-Footnote-118278902
Node: Module slots18278944
Ref: c-api/module module-slots18279011
Ref: 544a18279011
Ref: c-api/module c PyModuleDef_Slot18279054
Ref: 505918279054
Ref: c-api/module c PyModuleDef_Slot slot18279221
Ref: 544b18279221
Ref: c-api/module c PyModuleDef_Slot value18279380
Ref: 544c18279380
Ref: c-api/module c Py_mod_create18279585
Ref: 515118279585
Ref: c-api/module c Py_mod_create create_module18279947
Ref: 544d18279947
Ref: c-api/module c Py_mod_exec18281844
Ref: b7518281844
Ref: c-api/module c Py_mod_exec exec_module18282272
Ref: 544e18282272
Ref: c-api/module c Py_mod_multiple_interpreters18282512
Ref: 515218282512
Ref: c-api/module c Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED18282688
Ref: 4ea418282688
Ref: c-api/module c Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED18282831
Ref: 544f18282831
Ref: c-api/module c Py_MOD_PER_INTERPRETER_GIL_SUPPORTED18283090
Ref: 545018283090
Ref: c-api/module c Py_mod_gil18283712
Ref: 48218283712
Ref: c-api/module c Py_MOD_GIL_USED18283870
Ref: 545118283870
Ref: c-api/module c Py_MOD_GIL_NOT_USED18284069
Ref: 545218284069
Ref: Module slots-Footnote-118284717
Node: Creating extension modules dynamically18284759
Ref: c-api/module creating-extension-modules-dynamically18284921
Ref: 545318284921
Ref: c-api/module moduledef-dynamic18284921
Ref: 544318284921
Ref: c-api/module c PyModule_Create18285199
Ref: 521718285199
Ref: c-api/module c PyModule_Create218285590
Ref: 505b18285590
Ref: c-api/module c PyModule_FromDefAndSpec18286552
Ref: 10b318286552
Ref: c-api/module c PyModule_FromDefAndSpec218286938
Ref: 10b418286938
Ref: c-api/module c PyModule_ExecDef18288137
Ref: 10b518288137
Ref: c-api/module c PYTHON_API_VERSION18288433
Ref: 492e18288433
Ref: c-api/module c PYTHON_ABI_VERSION18288677
Ref: 545418288677
Node: サポート関数18288912
Ref: c-api/module support-functions18289105
Ref: 545518289105
Ref: c-api/module c PyModule_AddObjectRef18289425
Ref: 60a18289425
Ref: c-api/module c PyModule_Add18291515
Ref: 60918291515
Ref: c-api/module c PyModule_AddObject18292106
Ref: 60b18292106
Ref: c-api/module c PyModule_AddIntConstant18293555
Ref: 175518293555
Ref: c-api/module c PyModule_AddStringConstant18294092
Ref: 175618294092
Ref: c-api/module c PyModule_AddIntMacro18294704
Ref: 160c18294704
Ref: c-api/module c PyModule_AddStringMacro18295068
Ref: 160b18295068
Ref: c-api/module c PyModule_AddType18295185
Ref: b6c18295185
Ref: c-api/module c PyModule_AddFunctions18295684
Ref: 505a18295684
Ref: c-api/module c PyModule_SetDocString18296785
Ref: 506218296785
Ref: c-api/module c PyUnstable_Module_SetGIL18297335
Ref: 49d18297335
Node: Module lookup single-phase initialization18298399
Ref: c-api/module module-lookup-single-phase-initialization18298495
Ref: 545618298495
Ref: c-api/module c PyState_FindModule18299077
Ref: 50b518299077
Ref: c-api/module c PyState_AddModule18299779
Ref: 50b418299779
Ref: c-api/module c PyState_RemoveModule18301131
Ref: 50b618301131
Node: イテレータオブジェクト iterator object18301519
Ref: c-api/iterator doc18301728
Ref: 545718301728
Ref: c-api/iterator id118301728
Ref: 545818301728
Ref: c-api/iterator iterator-objects18301728
Ref: 545918301728
Ref: c-api/iterator translation-repo18301728
Ref: 545a18301728
Ref: c-api/iterator c PySeqIter_Type18302339
Ref: 509f18302339
Ref: c-api/iterator c PySeqIter_Check18302704
Ref: 545b18302704
Ref: c-api/iterator c PySeqIter_New18302881
Ref: 509e18302881
Ref: c-api/iterator c PyCallIter_Type18303274
Ref: 4f9118303274
Ref: c-api/iterator c PyCallIter_Check18303561
Ref: 545c18303561
Ref: c-api/iterator c PyCallIter_New18303747
Ref: 4f9018303747
Node: Range Objects18304487
Ref: c-api/iterator range-objects18304617
Ref: 545d18304617
Ref: c-api/iterator c PyRange_Type18304664
Ref: 509c18304664
Ref: c-api/iterator c PyRange_Check18304821
Ref: 545e18304821
Node: Builtin Iterator Types18304990
Ref: c-api/iterator builtin-iterator-types18305151
Ref: 545f18305151
Ref: c-api/iterator c PyEnum_Type18305703
Ref: 4fca18305703
Ref: c-api/iterator c PyFilter_Type18305848
Ref: 502818305848
Ref: c-api/iterator c PyMap_Type18305984
Ref: 505018305984
Ref: c-api/iterator c PyReversed_Type18306125
Ref: 509d18306125
Ref: c-api/iterator c PyZip_Type18306261
Ref: 512018306261
Node: Other Iterator Objects18306348
Ref: c-api/iterator other-iterator-objects18306487
Ref: 546018306487
Ref: c-api/iterator c PyByteArrayIter_Type18306552
Ref: 4f7818306552
Ref: c-api/iterator c PyBytesIter_Type18306664
Ref: 4f7e18306664
Ref: c-api/iterator c PyListIter_Type18306772
Ref: 503d18306772
Ref: c-api/iterator c PyListRevIter_Type18306879
Ref: 503e18306879
Ref: c-api/iterator c PySetIter_Type18306989
Ref: 50ad18306989
Ref: c-api/iterator c PyTupleIter_Type18307095
Ref: 50d518307095
Ref: c-api/iterator c PyRangeIter_Type18307203
Ref: 509b18307203
Ref: c-api/iterator c PyLongRangeIter_Type18307311
Ref: 504518307311
Ref: c-api/iterator c PyDictIterKey_Type18307423
Ref: 4fb418307423
Ref: c-api/iterator c PyDictRevIterKey_Type18307533
Ref: 4fba18307533
Ref: c-api/iterator c PyDictIterValue_Type18307676
Ref: 4fb518307676
Ref: c-api/iterator c PyDictRevIterValue_Type18307788
Ref: 4fbb18307788
Ref: c-api/iterator c PyDictIterItem_Type18307933
Ref: 4fb318307933
Ref: c-api/iterator c PyDictRevIterItem_Type18308044
Ref: 4fb918308044
Ref: c-api/iterator c PyODictIter_Type18308188
Ref: 546118308188
Node: デスクリプタオブジェクト descriptor object18308726
Ref: c-api/descriptor doc18308960
Ref: 546218308960
Ref: c-api/descriptor descriptor-objects18308960
Ref: 546318308960
Ref: c-api/descriptor id118308960
Ref: 546418308960
Ref: c-api/descriptor translation-repo18308960
Ref: 546518308960
Ref: c-api/descriptor c PyProperty_Type18309314
Ref: 509a18309314
Ref: c-api/descriptor c PyDescr_NewGetSet18309495
Ref: 4fb018309495
Ref: c-api/descriptor c PyDescr_NewMember18309694
Ref: 4fb118309694
Ref: c-api/descriptor c PyMemberDescr_Type18309891
Ref: 505418309891
Ref: c-api/descriptor c PyGetSetDescr_Type18310265
Ref: 502f18310265
Ref: c-api/descriptor c PyDescr_NewMethod18310638
Ref: 1d7518310638
Ref: c-api/descriptor c PyMethodDescr_Type18310835
Ref: 505818310835
Ref: c-api/descriptor c PyDescr_NewWrapper18311199
Ref: 546618311199
Ref: c-api/descriptor c PyWrapperDescr_Type18311370
Ref: 511e18311370
Ref: c-api/descriptor c PyDescr_NewClassMethod18311808
Ref: 4faf18311808
Ref: c-api/descriptor c PyDescr_IsData18312005
Ref: 1cb318312005
Ref: c-api/descriptor c PyWrapper_New18312256
Ref: 511f18312256
Node: Built-in descriptors18312450
Ref: c-api/descriptor built-in-descriptors18312561
Ref: 546718312561
Ref: c-api/descriptor c PySuper_Type18312622
Ref: 50bb18312622
Ref: c-api/descriptor c PyClassMethod_Type18312839
Ref: 546818312839
Ref: c-api/descriptor c PyClassMethodDescr_Type18313016
Ref: 4f9d18313016
Ref: c-api/descriptor c PyClassMethod_New18313379
Ref: 546918313379
Ref: c-api/descriptor c PyStaticMethod_Type18313793
Ref: 546a18313793
Ref: c-api/descriptor c PyStaticMethod_New18313973
Ref: 546b18313973
Node: スライスオブジェクト slice object18314390
Ref: c-api/slice doc18314604
Ref: 546c18314604
Ref: c-api/slice id118314604
Ref: 546d18314604
Ref: c-api/slice slice-objects18314604
Ref: 546e18314604
Ref: c-api/slice translation-repo18314604
Ref: 546f18314604
Ref: c-api/slice c PySlice_Type18314705
Ref: 50b318314705
Ref: c-api/slice c PySlice_Check18314980
Ref: 547018314980
Ref: c-api/slice c PySlice_New18315206
Ref: 50b218315206
Ref: c-api/slice c PySlice_GetIndices18315797
Ref: 50b118315797
Ref: c-api/slice c PySlice_GetIndicesEx18316728
Ref: 43118316728
Ref: c-api/slice c PySlice_Unpack18318801
Ref: 43218318801
Ref: c-api/slice c PySlice_AdjustIndices18319484
Ref: 43318319484
Node: Ellipsis オブジェクト<2>18320090
Ref: c-api/slice ellipsis-object18320200
Ref: 547118320200
Ref: c-api/slice c PyEllipsis_Type18320269
Ref: 4fc918320269
Ref: c-api/slice c Py_Ellipsis18320498
Ref: 547218320498
Ref: c-api/memoryview memoryview-objects18320877
Ref: 52ba18320877
Node: memoryview オブジェクト18320877
Ref: c-api/memoryview doc18321058
Ref: 547318321058
Ref: c-api/memoryview id118321058
Ref: 547418321058
Ref: c-api/memoryview translation-repo18321058
Ref: 547518321058
Ref: c-api/memoryview c PyMemoryView_Type18321356
Ref: 505718321356
Ref: c-api/memoryview c PyMemoryView_FromObject18321629
Ref: 505518321629
Ref: c-api/memoryview c PyBUF_READ18322262
Ref: 1a0b18322262
Ref: c-api/memoryview c PyBUF_WRITE18322416
Ref: 1a0c18322416
Ref: c-api/memoryview c PyMemoryView_FromMemory18322571
Ref: 138818322571
Ref: c-api/memoryview c PyMemoryView_FromBuffer18323032
Ref: 96518323032
Ref: c-api/memoryview c PyMemoryView_GetContiguous18323499
Ref: 505618323499
Ref: c-api/memoryview c PyMemoryView_Check18324292
Ref: 547618324292
Ref: c-api/memoryview c PyMemoryView_GET_BUFFER18324584
Ref: 547718324584
Ref: c-api/memoryview c PyMemoryView_GET_BASE18325059
Ref: 547818325059
Ref: c-api/picklebuffer picklebuffer-objects18325445
Ref: 547918325445
Node: Pickle buffer objects18325445
Ref: c-api/picklebuffer doc18325613
Ref: 547a18325613
Ref: c-api/picklebuffer pickle-buffer-objects18325613
Ref: 547b18325613
Ref: c-api/picklebuffer translation-repo18325613
Ref: 547c18325613
Ref: c-api/picklebuffer c PyPickleBuffer_Type18325851
Ref: 547d18325851
Ref: c-api/picklebuffer c PyPickleBuffer_Check18326093
Ref: 547e18326093
Ref: c-api/picklebuffer c PyPickleBuffer_FromObject18326243
Ref: 547f18326243
Ref: c-api/picklebuffer c PyPickleBuffer_GetBuffer18326679
Ref: 548018326679
Ref: c-api/picklebuffer c PyPickleBuffer_Release18327242
Ref: 548118327242
Node: 弱参照オブジェクト<2>18327547
Ref: c-api/weakref doc18327701
Ref: 548218327701
Ref: c-api/weakref translation-repo18327701
Ref: 548318327701
Ref: c-api/weakref weak-reference-objects18327701
Ref: 548418327701
Ref: c-api/weakref weakrefobjects18327701
Ref: 528f18327701
Ref: c-api/weakref c PyWeakref_Check18328147
Ref: 548518328147
Ref: c-api/weakref c PyWeakref_CheckRef18328305
Ref: 548618328305
Ref: c-api/weakref c PyWeakref_CheckRefExact18328487
Ref: 548718328487
Ref: c-api/weakref c PyWeakref_CheckProxy18328680
Ref: 548818328680
Ref: c-api/weakref c PyWeakref_NewRef18328824
Ref: 1be618328824
Ref: c-api/weakref c PyWeakref_NewProxy18329786
Ref: 511d18329786
Ref: c-api/weakref c PyWeakref_GetRef18330746
Ref: 3df18330746
Ref: c-api/weakref c PyWeakref_GetObject18331297
Ref: 3dd18331297
Ref: c-api/weakref c PyWeakref_GET_OBJECT18332043
Ref: 3de18332043
Ref: c-api/weakref c PyWeakref_IsDead18332351
Ref: 18df18332351
Ref: c-api/weakref c PyObject_ClearWeakRefs18332614
Ref: 79618332614
Ref: c-api/weakref c PyUnstable_Object_ClearWeakRefsNoCallbacks18333005
Ref: 199518333005
Node: カプセル<2>18333983
Ref: c-api/capsule doc18334156
Ref: 548918334156
Ref: c-api/capsule capsules18334156
Ref: 29f318334156
Ref: c-api/capsule id118334156
Ref: 548a18334156
Ref: c-api/capsule translation-repo18334156
Ref: 548b18334156
Ref: c-api/capsule c PyCapsule18334391
Ref: 148a18334391
Ref: c-api/capsule c PyCapsule_Type18334847
Ref: 4f9c18334847
Ref: c-api/capsule c PyCapsule_Destructor18335094
Ref: 4f9318335094
Ref: c-api/capsule c PyCapsule_CheckExact18335499
Ref: 548c18335499
Ref: c-api/capsule c PyCapsule_New18335674
Ref: 4ec318335674
Ref: c-api/capsule c PyCapsule_GetPointer18336885
Ref: 4f9718336885
Ref: c-api/capsule c PyCapsule_GetDestructor18337448
Ref: 4f9518337448
Ref: c-api/capsule c PyCapsule_GetContext18338086
Ref: 4f9418338086
Ref: c-api/capsule c PyCapsule_GetName18338691
Ref: 4f9618338691
Ref: c-api/capsule c PyCapsule_Import18339267
Ref: 1c1018339267
Ref: c-api/capsule c PyCapsule_IsValid18340339
Ref: 157418340339
Ref: c-api/capsule c PyCapsule_SetContext18341264
Ref: 4f9818341264
Ref: c-api/capsule c PyCapsule_SetDestructor18341598
Ref: 4f9918341598
Ref: c-api/capsule c PyCapsule_SetName18341944
Ref: 4f9a18341944
Ref: c-api/capsule c PyCapsule_SetPointer18342508
Ref: 4f9b18342508
Node: フレーム frame オブジェクト<2>18342881
Ref: c-api/frame doc18343060
Ref: 548d18343060
Ref: c-api/frame frame-objects18343060
Ref: 548e18343060
Ref: c-api/frame translation-repo18343060
Ref: 548f18343060
Ref: c-api/frame c PyFrameObject18343149
Ref: 98c18343149
Ref: c-api/frame c PyFrame_Type18343787
Ref: 98a18343787
Ref: c-api/frame c PyFrame_New18344077
Ref: 1aef18344077
Ref: c-api/frame c PyFrame_Check18344425
Ref: 98818344425
Ref: c-api/frame c PyFrame_GetBack18344654
Ref: 98918344654
Ref: c-api/frame c PyFrame_GetBuiltins18344941
Ref: 96f18344941
Ref: c-api/frame c PyFrame_GetCode18345235
Ref: 98d18345235
Ref: c-api/frame c PyFrame_GetGenerator18345594
Ref: 97018345594
Ref: c-api/frame c PyFrame_GetGlobals18346026
Ref: 97118346026
Ref: c-api/frame c PyFrame_GetLasti18346318
Ref: 97218346318
Ref: c-api/frame c PyFrame_GetVar18346518
Ref: 78918346518
Ref: c-api/frame c PyFrame_GetVarString18347026
Ref: 78a18347026
Ref: c-api/frame c PyFrame_GetLocals18347303
Ref: 66118347303
Ref: c-api/frame c PyFrame_GetLineNumber18348015
Ref: 98e18348015
Ref: フレーム frame オブジェクト<2>-Footnote-118348354
Node: Frame Locals Proxies18348396
Ref: c-api/frame frame-locals-proxies18348528
Ref: 549118348528
Ref: c-api/frame c PyFrameLocalsProxy_Type18348988
Ref: 549018348988
Ref: c-api/frame c PyFrameLocalsProxy_Check18349112
Ref: 549218349112
Ref: Frame Locals Proxies-Footnote-118349281
Node: Legacy Local Variable APIs18349323
Ref: c-api/frame legacy-local-variable-apis18349479
Ref: 549318349479
Ref: c-api/frame c PyFrame_LocalsToFast18349681
Ref: 549418349681
Ref: c-api/frame c PyFrame_FastToLocals18350228
Ref: 549518350228
Ref: c-api/frame c PyFrame_FastToLocalsWithError18350692
Ref: 549618350692
Ref: Legacy Local Variable APIs-Footnote-118351150
Node: Internal Frames18351192
Ref: c-api/frame internal-frames18351319
Ref: 549718351319
Ref: c-api/frame c _PyInterpreterFrame18351420
Ref: 196e18351420
Ref: c-api/frame c PyUnstable_InterpreterFrame_GetCode18351546
Ref: 549818351546
Ref: c-api/frame c PyUnstable_InterpreterFrame_GetLasti18352037
Ref: 549918352037
Ref: c-api/frame c PyUnstable_InterpreterFrame_GetLine18352483
Ref: 549a18352483
Ref: Internal Frames-Footnote-118352988
Node: ジェネレータオブジェクト18353030
Ref: c-api/gen doc18353230
Ref: 549b18353230
Ref: c-api/gen gen-objects18353230
Ref: 549c18353230
Ref: c-api/gen generator-objects18353230
Ref: 549d18353230
Ref: c-api/gen translation-repo18353230
Ref: 549e18353230
Ref: c-api/gen c PyGenObject18353700
Ref: 54a118353700
Ref: c-api/gen c PyGen_Type18353826
Ref: 54a218353826
Ref: c-api/gen c PyGen_Check18353965
Ref: 54a318353965
Ref: c-api/gen c PyGen_CheckExact18354193
Ref: 54a418354193
Ref: c-api/gen c PyGen_New18354418
Ref: 549f18354418
Ref: c-api/gen c PyGen_NewWithQualName18354767
Ref: 54a018354767
Ref: c-api/gen c PyGen_GetCode18355258
Ref: 54a518355258
Node: Asynchronous Generator Objects18355539
Ref: c-api/gen asynchronous-generator-objects18355668
Ref: 54a618355668
Ref: c-api/gen c PyAsyncGen_Type18355774
Ref: 54a718355774
Ref: c-api/gen c PyAsyncGen_New18356019
Ref: 54a818356019
Ref: c-api/gen c PyAsyncGen_CheckExact18356562
Ref: 54a918356562
Ref: Asynchronous Generator Objects-Footnote-118356802
Node: Deprecated API<5>18356844
Ref: c-api/gen deprecated-api18356973
Ref: 54aa18356973
Ref: c-api/gen c PyAsyncGenASend_CheckExact18357022
Ref: 54ab18357022
Node: コルーチンオブジェクト<2>18357239
Ref: c-api/coro doc18357441
Ref: 54ac18357441
Ref: c-api/coro coro-objects18357441
Ref: 10d018357441
Ref: c-api/coro coroutine-objects18357441
Ref: 54ad18357441
Ref: c-api/coro translation-repo18357441
Ref: 54ae18357441
Ref: c-api/coro c PyCoroObject18357673
Ref: 54af18357673
Ref: c-api/coro c PyCoro_Type18357782
Ref: 54b018357782
Ref: c-api/coro c PyCoro_CheckExact18357913
Ref: 54b118357913
Ref: c-api/coro c PyCoro_New18358141
Ref: 54b218358141
Node: コンテキスト変数オブジェクト18358621
Ref: c-api/contextvars doc18358829
Ref: 54b318358829
Ref: c-api/contextvars context-variables-objects18358829
Ref: 54b418358829
Ref: c-api/contextvars contextvarsobjects18358829
Ref: cf018358829
Ref: c-api/contextvars translation-repo18358829
Ref: 54b518358829
Ref: c-api/contextvars contextvarsobjects-pointertype-change18358920
Ref: e1f18358920
Ref: c-api/contextvars c PyContext18359582
Ref: 54b618359582
Ref: c-api/contextvars c PyContextVar18359723
Ref: 54b718359723
Ref: c-api/contextvars c PyContextToken18359870
Ref: 54b818359870
Ref: c-api/contextvars c PyContext_Type18360014
Ref: 54b918360014
Ref: c-api/contextvars c PyContextVar_Type18360139
Ref: 54ba18360139
Ref: c-api/contextvars c PyContextToken_Type18360273
Ref: 54bb18360273
Ref: c-api/contextvars c PyContext_CheckExact18360448
Ref: 54bc18360448
Ref: c-api/contextvars c PyContextVar_CheckExact18360679
Ref: 54bd18360679
Ref: c-api/contextvars c PyContextToken_CheckExact18360916
Ref: 54be18360916
Ref: c-api/contextvars c PyContext_New18361217
Ref: 54bf18361217
Ref: c-api/contextvars c PyContext_Copy18361455
Ref: 54c018361455
Ref: c-api/contextvars c PyContext_CopyCurrent18361725
Ref: 54c118361725
Ref: c-api/contextvars c PyContext_Enter18361983
Ref: 54c218361983
Ref: c-api/contextvars c PyContext_Exit18362204
Ref: 54c318362204
Ref: c-api/contextvars c PyContext_AddWatcher18362495
Ref: 199218362495
Ref: c-api/contextvars c PyContext_ClearWatcher18362880
Ref: 199318362880
Ref: c-api/contextvars c PyContextEvent18363247
Ref: 54c418363247
Ref: c-api/contextvars c PyContext_WatchCallback18363653
Ref: 54c518363653
Ref: c-api/contextvars c PyContextVar_New18364589
Ref: 54c618364589
Ref: c-api/contextvars c PyContextVar_Get18365091
Ref: 54c718365091
Ref: c-api/contextvars c PyContextVar_Set18365928
Ref: 54c818365928
Ref: c-api/contextvars c PyContextVar_Reset18366290
Ref: 54c918366290
Ref: コンテキスト変数オブジェクト-Footnote-118366663
Node: 型ヒントのためのオブジェクト18366728
Ref: c-api/typehints doc18366891
Ref: 54ca18366891
Ref: c-api/typehints objects-for-type-hinting18366891
Ref: 54cb18366891
Ref: c-api/typehints translation-repo18366891
Ref: 54cc18366891
Ref: c-api/typehints typehintobjects18366891
Ref: 54cd18366891
Ref: c-api/typehints c Py_GenericAlias18367156
Ref: 512b18367156
Ref: c-api/typehints c Py_GenericAliasType18368736
Ref: 512c18368736
Node: C API for extension modules18369062
Ref: c-api/concrete c-api-for-extension-modules18369218
Ref: 54ce18369218
Node: Curses C API18369430
Ref: c-api/curses doc18369528
Ref: 54cf18369528
Ref: c-api/curses curses-c-api18369528
Ref: 54d018369528
Ref: c-api/curses c import_curses18370013
Ref: 54d118370013
Ref: c-api/curses c PyCurses_API18370492
Ref: 54d218370492
Ref: c-api/curses c PyCurses_API_pointers18371449
Ref: 54d718371449
Ref: c-api/curses c PyCursesWindow_Type18371632
Ref: 54d318371632
Ref: c-api/curses c PyCursesWindow_Check18371773
Ref: 54d818371773
Ref: c-api/curses c PyCursesSetupTermCalled18372105
Ref: 54d418372105
Ref: c-api/curses c PyCursesInitialised18372519
Ref: 54d518372519
Ref: c-api/curses c PyCursesInitialisedColor18372923
Ref: 54d618372923
Node: Internal data18373349
Ref: c-api/curses internal-data18373486
Ref: 54d918373486
Ref: c-api/curses c PyCurses_CAPSULE_NAME18373619
Ref: 54da18373619
Node: DateTime オブジェクト<2>18373811
Ref: c-api/datetime doc18373952
Ref: 54db18373952
Ref: c-api/datetime datetime-objects18373952
Ref: 54dc18373952
Ref: c-api/datetime datetimeobjects18373952
Ref: 526d18373952
Ref: c-api/datetime translation-repo18373952
Ref: 54dd18373952
Ref: c-api/datetime c PyDateTime_IMPORT18374628
Ref: 54de18374628
Ref: c-api/datetime c PyDateTime_CAPI18375088
Ref: 54e018375088
Ref: c-api/datetime c PyDateTimeAPI18375337
Ref: 54df18375337
Ref: c-api/datetime c PyDateTime_Date18375551
Ref: 54e118375551
Ref: c-api/datetime c PyDateTime_DateTime18375712
Ref: 54e218375712
Ref: c-api/datetime c PyDateTime_Time18375880
Ref: 54e318375880
Ref: c-api/datetime c PyDateTime_Delta18376043
Ref: 54e418376043
Ref: c-api/datetime c PyDateTime_DateType18376203
Ref: 54e518376203
Ref: c-api/datetime c PyDateTime_DateTimeType18376466
Ref: 54e618376466
Ref: c-api/datetime c PyDateTime_TimeType18376744
Ref: 54e718376744
Ref: c-api/datetime c PyDateTime_DeltaType18377007
Ref: 54e818377007
Ref: c-api/datetime c PyDateTime_TZInfoType18377278
Ref: 54e918377278
Ref: c-api/datetime c PyDateTime_TimeZone_UTC18377626
Ref: dbc18377626
Ref: c-api/datetime c PyDate_Check18377906
Ref: 54ea18377906
Ref: c-api/datetime c PyDate_CheckExact18378215
Ref: 54eb18378215
Ref: c-api/datetime c PyDateTime_Check18378450
Ref: 54ec18378450
Ref: c-api/datetime c PyDateTime_CheckExact18378777
Ref: 54ed18378777
Ref: c-api/datetime c PyTime_Check18379020
Ref: 54ee18379020
Ref: c-api/datetime c PyTime_CheckExact18379329
Ref: 54ef18379329
Ref: c-api/datetime c PyDelta_Check18379564
Ref: 54f018379564
Ref: c-api/datetime c PyDelta_CheckExact18379882
Ref: 54f118379882
Ref: c-api/datetime c PyTZInfo_Check18380119
Ref: 54f218380119
Ref: c-api/datetime c PyTZInfo_CheckExact18380440
Ref: 54f318380440
Ref: c-api/datetime c PyDate_FromDate18380748
Ref: 54f418380748
Ref: c-api/datetime c PyDateTime_FromDateAndTime18380981
Ref: 54f518380981
Ref: c-api/datetime c PyDateTime_FromDateAndTimeAndFold18381322
Ref: 54f618381322
Ref: c-api/datetime c PyTime_FromTime18381720
Ref: 54f718381720
Ref: c-api/datetime c PyTime_FromTimeAndFold18381991
Ref: 54f818381991
Ref: c-api/datetime c PyDelta_FromDSU18382315
Ref: 54f918382315
Ref: c-api/datetime c PyTimeZone_FromOffset18382735
Ref: dba18382735
Ref: c-api/datetime c PyTimeZone_FromOffsetAndName18383050
Ref: dbb18383050
Ref: c-api/datetime c PyDateTime_GET_YEAR18383768
Ref: 54fa18383768
Ref: c-api/datetime c PyDateTime_GET_MONTH18383874
Ref: 54fb18383874
Ref: c-api/datetime c PyDateTime_GET_DAY18383997
Ref: 54fc18383997
Ref: c-api/datetime c PyDateTime_DATE_GET_HOUR18384441
Ref: 54fd18384441
Ref: c-api/datetime c PyDateTime_DATE_GET_MINUTE18384572
Ref: 54fe18384572
Ref: c-api/datetime c PyDateTime_DATE_GET_SECOND18384705
Ref: 54ff18384705
Ref: c-api/datetime c PyDateTime_DATE_GET_MICROSECOND18384838
Ref: 550018384838
Ref: c-api/datetime c PyDateTime_DATE_GET_FOLD18385002
Ref: 550118385002
Ref: c-api/datetime c PyDateTime_DATE_GET_TZINFO18385239
Ref: a9518385239
Ref: c-api/datetime c PyDateTime_TIME_GET_HOUR18385736
Ref: 550218385736
Ref: c-api/datetime c PyDateTime_TIME_GET_MINUTE18385863
Ref: 550318385863
Ref: c-api/datetime c PyDateTime_TIME_GET_SECOND18385992
Ref: 550418385992
Ref: c-api/datetime c PyDateTime_TIME_GET_MICROSECOND18386121
Ref: 550518386121
Ref: c-api/datetime c PyDateTime_TIME_GET_FOLD18386271
Ref: 550618386271
Ref: c-api/datetime c PyDateTime_TIME_GET_TZINFO18386504
Ref: a9618386504
Ref: c-api/datetime c PyDateTime_DELTA_GET_DAYS18386998
Ref: 550718386998
Ref: c-api/datetime c PyDateTime_DELTA_GET_SECONDS18387174
Ref: 550818387174
Ref: c-api/datetime c PyDateTime_DELTA_GET_MICROSECONDS18387340
Ref: 550918387340
Ref: c-api/datetime c PyDateTime_FromTimestamp18387602
Ref: 550a18387602
Ref: c-api/datetime c PyDate_FromTimestamp18387896
Ref: 1df118387896
Node: Internal data<2>18388178
Ref: c-api/datetime internal-data18388297
Ref: 550b18388297
Ref: c-api/datetime c PyDateTime_CAPSULE_NAME18388430
Ref: 550c18388430
Node: 初期化 initialization 、終了処理 finalization 、スレッド18388630
Ref: c-api/init doc18388872
Ref: 550d18388872
Ref: c-api/init initialization18388872
Ref: 550e18388872
Ref: c-api/init initialization-finalization-and-threads18388872
Ref: 550f18388872
Ref: c-api/init translation-repo18388872
Ref: 551018388872
Node: Python 初期化以前18389997
Ref: c-api/init before-python-initialization18390164
Ref: 551118390164
Ref: c-api/init pre-init-safe18390164
Ref: dbe18390164
Node: グローバルな設定変数18392872
Ref: c-api/init global-conf-vars18393096
Ref: 551218393096
Ref: c-api/init global-configuration-variables18393096
Ref: 551618393096
Ref: c-api/init c Py_BytesWarningFlag18393722
Ref: 40618393722
Ref: c-api/init c Py_DebugFlag18394380
Ref: 3f818394380
Ref: c-api/init c Py_DontWriteBytecodeFlag18394914
Ref: 40c18394914
Ref: c-api/init c Py_FrozenFlag18395484
Ref: 40818395484
Ref: c-api/init c Py_HashRandomizationFlag18396052
Ref: 41218396052
Ref: c-api/init c Py_IgnoreEnvironmentFlag18396688
Ref: 40a18396688
Ref: c-api/init c Py_InspectFlag18397211
Ref: 40018397211
Ref: c-api/init c Py_InteractiveFlag18397928
Ref: 3fe18397928
Ref: c-api/init c Py_IsolatedFlag18398273
Ref: 41518398273
Ref: c-api/init c Py_LegacyWindowsFSEncodingFlag18398867
Ref: 41718398867
Ref: c-api/init c Py_LegacyWindowsStdioFlag18399682
Ref: 41918399682
Ref: c-api/init c Py_NoSiteFlag18400380
Ref: 40418400380
Ref: c-api/init c Py_NoUserSiteDirectory18401102
Ref: 40e18401102
Ref: c-api/init c Py_OptimizeFlag18401661
Ref: 40218401661
Ref: c-api/init c Py_QuietFlag18402059
Ref: 3fc18402059
Ref: c-api/init c Py_UnbufferedStdioFlag18402543
Ref: 41018402543
Ref: c-api/init c Py_VerboseFlag18403044
Ref: 3fa18403044
Ref: グローバルな設定変数-Footnote-118403931
Ref: グローバルな設定変数-Footnote-218403973
Node: インタープリタの初期化と終了処理18404015
Ref: c-api/init initializing-and-finalizing-the-interpreter18404256
Ref: 551718404256
Ref: c-api/init c Py_Initialize18404353
Ref: 46018404353
Ref: c-api/init c Py_InitializeEx18405746
Ref: 513318405746
Ref: c-api/init c Py_InitializeFromConfig18406231
Ref: 3f618406231
Ref: c-api/init c Py_IsInitialized18406658
Ref: 4f5118406658
Ref: c-api/init c Py_IsFinalizing18407040
Ref: 5fd18407040
Ref: c-api/init c Py_FinalizeEx18407317
Ref: f1118407317
Ref: c-api/init c Py_Finalize18410827
Ref: 45f18410827
Ref: c-api/init c Py_BytesMain18411042
Ref: bb818411042
Ref: c-api/init c Py_Main18411391
Ref: e1e18411391
Ref: c-api/init c Py_RunMain18413765
Ref: bbc18413765
Ref: c-api/init c PyUnstable_AtExit18415335
Ref: 18fa18415335
Node: プロセスワイドのパラメータ18415999
Ref: c-api/init process-wide-parameters18416311
Ref: 551d18416311
Ref: c-api/init c Py_SetProgramName18416393
Ref: 19b618416393
Ref: c-api/init c Py_GetProgramName18417852
Ref: 3ee18417852
Ref: c-api/init c Py_GetPrefix18418528
Ref: 3e518418528
Ref: c-api/init c Py_GetExecPrefix18419882
Ref: 3e918419882
Ref: c-api/init c Py_GetProgramFullPath18423296
Ref: 3ec18423296
Ref: c-api/init c Py_GetPath18424170
Ref: 3e318424170
Ref: c-api/init c Py_GetVersion18425317
Ref: 513118425317
Ref: c-api/init c Py_GetPlatform18426149
Ref: 512f18426149
Ref: c-api/init c Py_GetCopyright18426982
Ref: 512e18426982
Ref: c-api/init c Py_GetCompiler18427517
Ref: 512d18427517
Ref: c-api/init c Py_GetBuildInfo18428087
Ref: 164b18428087
Ref: c-api/init c PySys_SetArgvEx18428650
Ref: 19b718428650
Ref: c-api/init c PySys_SetArgv18431503
Ref: 19b818431503
Ref: c-api/init c Py_SetPythonHome18432516
Ref: 19b518432516
Ref: c-api/init c Py_GetPythonHome18433441
Ref: 3ef18433441
Ref: プロセスワイドのパラメータ-Footnote-118434148
Node: スレッド状態 thread state とグローバルインタプリタロック global interpreter lock18434203
Ref: c-api/init thread-state-and-the-global-interpreter-lock18434503
Ref: 551e18434503
Ref: c-api/init threads18434503
Ref: 551f18434503
Node: Detaching the thread state from extension code18437365
Ref: c-api/init detaching-the-thread-state-from-extension-code18437598
Ref: 552018437598
Node: Python 以外で作られたスレッド18440183
Ref: c-api/init gilstate18440473
Ref: 552118440473
Ref: c-api/init non-python-created-threads18440473
Ref: 552218440473
Node: Supporting subinterpreters in non-Python threads18442428
Ref: c-api/init supporting-subinterpreters-in-non-python-threads18442691
Ref: 552318442691
Node: Cautions about fork18443769
Ref: c-api/init cautions-about-fork18444031
Ref: 552418444031
Ref: c-api/init fork-and-threads18444031
Ref: 522018444031
Node: Cautions regarding runtime finalization18445950
Ref: c-api/init cautions-regarding-runtime-finalization18446179
Ref: 552518446179
Ref: c-api/init id118446179
Ref: 552618446179
Node: 高レベルAPI18447752
Ref: c-api/init high-level-api18447977
Ref: 552718447977
Ref: c-api/init c PyInterpreterState18448164
Ref: aba18448164
Ref: c-api/init c PyThreadState18449249
Ref: 99018449249
Ref: c-api/init c PyThreadState interp18449482
Ref: 552918449482
Ref: c-api/init c PyEval_InitThreads18449597
Ref: 19b918449597
Ref: c-api/init c PyEval_SaveThread18450277
Ref: 64718450277
Ref: c-api/init c PyEval_RestoreThread18450533
Ref: 64818450533
Ref: c-api/init c PyThreadState_Get18451313
Ref: 61518451313
Ref: c-api/init c PyThreadState_GetUnchecked18451748
Ref: 42318451748
Ref: c-api/init c PyThreadState_Swap18452133
Ref: 50c418452133
Ref: c-api/init c PyGILState_STATE18452945
Ref: 502e18452945
Ref: c-api/init c PyGILState_STATE PyGILState_LOCKED18453166
Ref: 552a18453166
Ref: c-api/init c PyGILState_STATE PyGILState_UNLOCKED18453314
Ref: 552b18453314
Ref: c-api/init c PyGILState_Ensure18453460
Ref: 64a18453460
Ref: c-api/init c PyGILState_Release18455368
Ref: 64b18455368
Ref: c-api/init c PyGILState_GetThisThreadState18456022
Ref: 502d18456022
Ref: c-api/init c PyGILState_Check18456802
Ref: 552c18456802
Ref: c-api/init c Py_BEGIN_ALLOW_THREADS18457815
Ref: 4ebd18457815
Ref: c-api/init c Py_END_ALLOW_THREADS18458316
Ref: c7f18458316
Ref: c-api/init c Py_BLOCK_THREADS18458801
Ref: 512918458801
Ref: c-api/init c Py_UNBLOCK_THREADS18459064
Ref: 514918459064
Ref: 高レベルAPI-Footnote-118459368
Node: 低レベルAPI18459410
Ref: c-api/init low-level-api18459587
Ref: 552d18459587
Ref: c-api/init c PyInterpreterState_New18459884
Ref: 475418459884
Ref: c-api/init c PyInterpreterState_Clear18460319
Ref: 475318460319
Ref: c-api/init c PyInterpreterState_Delete18460706
Ref: 503b18460706
Ref: c-api/init c PyThreadState_New18461100
Ref: 50c318461100
Ref: c-api/init c PyThreadState_Clear18461394
Ref: 199118461394
Ref: c-api/init c PyThreadState_Delete18461904
Ref: 1d8918461904
Ref: c-api/init c PyThreadState_DeleteCurrent18462234
Ref: 1db818462234
Ref: c-api/init c PyThreadState_GetFrame18462549
Ref: 99118462549
Ref: c-api/init c PyThreadState_GetID18463048
Ref: b6a18463048
Ref: c-api/init c PyThreadState_GetInterpreter18463401
Ref: b6918463401
Ref: c-api/init c PyThreadState_EnterTracing18463759
Ref: 95a18463759
Ref: c-api/init c PyThreadState_LeaveTracing18464019
Ref: 95b18464019
Ref: c-api/init c PyUnstable_ThreadState_SetStackProtection18464364
Ref: 46618464364
Ref: c-api/init c PyUnstable_ThreadState_ResetStackProtection18466363
Ref: 46718466363
Ref: c-api/init c PyInterpreterState_Get18467417
Ref: 64c18467417
Ref: c-api/init c PyInterpreterState_GetID18467756
Ref: dbf18467756
Ref: c-api/init c PyInterpreterState_GetDict18468192
Ref: 503c18468192
Ref: c-api/init c _PyFrameEvalFunction18469082
Ref: 97a18469082
Ref: c-api/init c _PyInterpreterState_GetEvalFrameFunc18469657
Ref: 1d7718469657
Ref: c-api/init c _PyInterpreterState_SetEvalFrameFunc18469932
Ref: 1d7818469932
Ref: c-api/init c PyThreadState_GetDict18470202
Ref: 50c218470202
Ref: c-api/init c PyThreadState_SetAsyncExc18470761
Ref: dbd18470761
Ref: c-api/init c PyEval_AcquireThread18471634
Ref: 64918471634
Ref: c-api/init c PyEval_ReleaseThread18472842
Ref: 4fde18472842
Ref: 低レベルAPI-Footnote-118473399
Ref: 低レベルAPI-Footnote-218473493
Ref: 低レベルAPI-Footnote-318473587
Ref: 低レベルAPI-Footnote-418473629
Node: サブインタプリタサポート18473671
Ref: c-api/init id318473947
Ref: 552e18473947
Ref: c-api/init sub-interpreter-support18473947
Ref: 16318473947
Ref: c-api/init c PyInterpreterConfig18475180
Ref: 78e18475180
Ref: c-api/init c PyInterpreterConfig use_main_obmalloc18475486
Ref: 491718475486
Ref: c-api/init c PyInterpreterConfig allow_fork18475934
Ref: 553318475934
Ref: c-api/init c PyInterpreterConfig allow_exec18476280
Ref: 553418476280
Ref: c-api/init c PyInterpreterConfig allow_threads18476686
Ref: 553518476686
Ref: c-api/init c PyInterpreterConfig allow_daemon_threads18476885
Ref: 553618476885
Ref: c-api/init c PyInterpreterConfig check_multi_interp_extensions18477177
Ref: 553018477177
Ref: c-api/init c PyInterpreterConfig gil18477712
Ref: 553118477712
Ref: c-api/init c PyInterpreterConfig_DEFAULT_GIL18477872
Ref: 553718477872
Ref: c-api/init c PyInterpreterConfig_SHARED_GIL18478039
Ref: 553818478039
Ref: c-api/init c PyInterpreterConfig_OWN_GIL18478157
Ref: 553218478157
Ref: c-api/init c Py_NewInterpreterFromConfig18478413
Ref: 68918478413
Ref: c-api/init c Py_NewInterpreter18483365
Ref: 1b3118483365
Ref: c-api/init c Py_EndInterpreter18483848
Ref: 184518483848
Ref: サブインタプリタサポート-Footnote-118484492
Node: A Per-Interpreter GIL18484534
Ref: c-api/init a-per-interpreter-gil18484658
Ref: 553a18484658
Ref: c-api/init per-interpreter-gil18484658
Ref: 552818484658
Ref: A Per-Interpreter GIL-Footnote-118486718
Ref: A Per-Interpreter GIL-Footnote-218486760
Node: バグと注意事項18486802
Ref: c-api/init bugs-and-caveats18486926
Ref: 553918486926
Node: 非同期通知18488745
Ref: c-api/init asynchronous-notifications18488975
Ref: 553b18488975
Ref: c-api/init c Py_AddPendingCall18489240
Ref: b7818489240
Ref: c-api/init c Py_MakePendingCalls18491893
Ref: 513418491893
Node: プロファイルとトレース profiling and tracing18492517
Ref: c-api/init profiling18492728
Ref: 553c18492728
Ref: c-api/init profiling-and-tracing18492728
Ref: 553d18492728
Ref: c-api/init c Py_tracefunc18493852
Ref: 553e18493852
Ref: c-api/init c PyTrace_CALL18496307
Ref: 553f18496307
Ref: c-api/init c PyTrace_EXCEPTION18496798
Ref: 554018496798
Ref: c-api/init c PyTrace_LINE18497405
Ref: 554118497405
Ref: c-api/init c PyTrace_RETURN18497705
Ref: 554218497705
Ref: c-api/init c PyTrace_C_CALL18497859
Ref: 554318497859
Ref: c-api/init c PyTrace_C_EXCEPTION18498014
Ref: 554418498014
Ref: c-api/init c PyTrace_C_RETURN18498182
Ref: 554518498182
Ref: c-api/init c PyTrace_OPCODE18498336
Ref: 554618498336
Ref: c-api/init c PyEval_SetProfile18498674
Ref: 171618498674
Ref: c-api/init c PyEval_SetProfileAllThreads18499387
Ref: 78118499387
Ref: c-api/init c PyEval_SetTrace18499918
Ref: 66318499918
Ref: c-api/init c PyEval_SetTraceAllThreads18500630
Ref: 66418500630
Node: Reference tracing18501146
Ref: c-api/init reference-tracing18501401
Ref: 554718501401
Ref: c-api/init c PyRefTracer18501476
Ref: 554818501476
Ref: c-api/init c PyRefTracer_CREATE18502049
Ref: 554918502049
Ref: c-api/init c PyRefTracer_DESTROY18502211
Ref: 554a18502211
Ref: c-api/init c PyRefTracer_SetTracer18502376
Ref: 61018502376
Ref: c-api/init c PyRefTracer_GetTracer18503225
Ref: 61118503225
Node: 高度なデバッガサポート advanced debugger support18503715
Ref: c-api/init advanced-debugger-support18503969
Ref: 554b18503969
Ref: c-api/init advanced-debugging18503969
Ref: 554c18503969
Ref: c-api/init c PyInterpreterState_Head18504194
Ref: 171818504194
Ref: c-api/init c PyInterpreterState_Main18504398
Ref: 552f18504398
Ref: c-api/init c PyInterpreterState_Next18504554
Ref: 171918504554
Ref: c-api/init c PyInterpreterState_ThreadHead18504803
Ref: 171a18504803
Ref: c-api/init c PyThreadState_Next18505111
Ref: 171b18505111
Node: スレッドローカルストレージのサポート18505411
Ref: c-api/init thread-local-storage18505675
Ref: 554d18505675
Ref: c-api/init thread-local-storage-support18505675
Ref: 554e18505675
Node: スレッド固有ストレージ Thread Specific Storage TSS API18507253
Ref: c-api/init thread-specific-storage-api18507465
Ref: cd518507465
Ref: c-api/init thread-specific-storage-tss-api18507465
Ref: 554f18507465
Ref: c-api/init c Py_tss_t18507999
Ref: cd618507999
Ref: c-api/init c Py_tss_NEEDS_INIT18508527
Ref: 555018508527
Ref: スレッド固有ストレージ Thread Specific Storage TSS API-Footnote-118508858
Node: 動的メモリ確保18508900
Ref: c-api/init dynamic-allocation18509047
Ref: 555118509047
Ref: c-api/init c PyThread_tss_alloc18509372
Ref: 43818509372
Ref: c-api/init c PyThread_tss_free18509685
Ref: 43a18509685
Node: メソッド<2>18510189
Ref: c-api/init methods18510336
Ref: 555218510336
Ref: c-api/init c PyThread_tss_is_created18510648
Ref: 50d118510648
Ref: c-api/init c PyThread_tss_create18510918
Ref: 50d018510918
Ref: c-api/init c PyThread_tss_delete18511414
Ref: 44018511414
Ref: c-api/init c PyThread_tss_set18511923
Ref: 43c18511923
Ref: c-api/init c PyThread_tss_get18512261
Ref: 43e18512261
Node: スレッドローカルストレージ TLS API18512573
Ref: c-api/init thread-local-storage-api18512785
Ref: cd418512785
Ref: c-api/init thread-local-storage-tls-api18512785
Ref: 555318512785
Ref: c-api/init c PyThread_create_key18513470
Ref: 43718513470
Ref: c-api/init c PyThread_delete_key18513566
Ref: 43918513566
Ref: c-api/init c PyThread_set_key_value18513670
Ref: 43b18513670
Ref: c-api/init c PyThread_get_key_value18513789
Ref: 43d18513789
Ref: c-api/init c PyThread_delete_key_value18513897
Ref: 43f18513897
Ref: c-api/init c PyThread_ReInitTLS18514007
Ref: 44118514007
Node: 同期プリミティブ<3>18514103
Ref: c-api/init synchronization-primitives18514336
Ref: 555418514336
Ref: c-api/init c PyMutex18514446
Ref: 48418514446
Ref: c-api/init c PyMutex_Lock18515081
Ref: 5d018515081
Ref: c-api/init c PyMutex_Unlock18515393
Ref: 5d118515393
Ref: c-api/init c PyMutex_IsLocked18515581
Ref: 46318515581
Node: Python Critical Section API18516046
Ref: c-api/init id418516165
Ref: 555518516165
Ref: c-api/init python-critical-section-api18516165
Ref: 555618516165
Ref: c-api/init c Py_BEGIN_CRITICAL_SECTION18519029
Ref: 53ab18519029
Ref: c-api/init c Py_BEGIN_CRITICAL_SECTION_MUTEX18519434
Ref: 555818519434
Ref: c-api/init c Py_END_CRITICAL_SECTION18519966
Ref: 555918519966
Ref: c-api/init c Py_BEGIN_CRITICAL_SECTION218520284
Ref: 555718520284
Ref: c-api/init c Py_BEGIN_CRITICAL_SECTION2_MUTEX18520829
Ref: 555a18520829
Ref: c-api/init c Py_END_CRITICAL_SECTION218521391
Ref: 555b18521391
Node: Legacy Locking APIs18521713
Ref: c-api/init legacy-locking-apis18521832
Ref: 555c18521832
Ref: c-api/init c PyThread_type_lock18522072
Ref: 555d18522072
Ref: c-api/init c PyLockStatus18522164
Ref: 555e18522164
Ref: c-api/init c PY_LOCK_FAILURE18522259
Ref: 555f18522259
Ref: c-api/init c PY_LOCK_ACQUIRED18522349
Ref: 556018522349
Ref: c-api/init c PY_LOCK_INTR18522448
Ref: 556118522448
Ref: c-api/init c PyThread_allocate_lock18522545
Ref: 50c818522545
Ref: c-api/init c PyThread_free_lock18523085
Ref: 50ca18523085
Ref: c-api/init c PyThread_acquire_lock_timed18523370
Ref: 50c718523370
Ref: c-api/init c PyThread_acquire_lock18524375
Ref: 50c618524375
Ref: c-api/init c PyThread_release_lock18525145
Ref: 50ce18525145
Node: Operating System Thread APIs18525435
Ref: c-api/init operating-system-thread-apis18525605
Ref: 556218525605
Ref: c-api/init c PYTHREAD_INVALID_THREAD_ID18525680
Ref: 556318525680
Ref: c-api/init c PyThread_start_new_thread18525838
Ref: 1e2b18525838
Ref: c-api/init c PyThread_get_thread_ident18526404
Ref: 50cc18526404
Ref: c-api/init c PyThread_GetInfo18526774
Ref: 50c518526774
Ref: c-api/init c PY_HAVE_THREAD_NATIVE_ID18527340
Ref: 556418527340
Ref: c-api/init c PyThread_get_thread_native_id18527458
Ref: 1ba218527458
Ref: c-api/init c PyThread_exit_thread18528046
Ref: 50c918528046
Ref: c-api/init c PyThread_init_thread18529074
Ref: 50cd18529074
Ref: c-api/init c PyThread_set_stacksize18529326
Ref: 50cf18529326
Ref: c-api/init c PyThread_get_stacksize18529779
Ref: 50cb18529779
Ref: Operating System Thread APIs-Footnote-118530125
Node: Python 初期化設定18530177
Ref: c-api/init_config doc18530384
Ref: 556518530384
Ref: c-api/init_config init-config18530384
Ref: 64618530384
Ref: c-api/init_config python-initialization-configuration18530384
Ref: 556618530384
Ref: c-api/init_config translation-repo18530384
Ref: 556718530384
Node: PyInitConfig C API18530622
Ref: c-api/init_config pyinitconfig-api18530729
Ref: 37918530729
Ref: c-api/init_config pyinitconfig-c-api18530729
Ref: 556818530729
Ref: PyInitConfig C API-Footnote-118531358
Node: 使用例<54>18531400
Ref: c-api/init_config example18531492
Ref: 556918531492
Node: 設定の作成18532782
Ref: c-api/init_config create-config18532901
Ref: 556a18532901
Ref: c-api/init_config c PyInitConfig18532947
Ref: 556b18532947
Ref: c-api/init_config c PyInitConfig_Create18533062
Ref: 38718533062
Ref: c-api/init_config c PyInitConfig_Free18533357
Ref: 38818533357
Node: エラー処理<2>18533545
Ref: c-api/init_config error-handling18533662
Ref: 556d18533662
Ref: c-api/init_config c PyInitConfig_GetError18533708
Ref: 38a18533708
Ref: c-api/init_config c PyInitConfig_GetExitCode18534280
Ref: 38b18534280
Node: Get Options18534875
Ref: c-api/init_config get-options18534988
Ref: 556e18534988
Ref: c-api/init_config c PyInitConfig_HasOption18535171
Ref: 38f18535171
Ref: c-api/init_config c PyInitConfig_GetInt18535400
Ref: 38c18535400
Ref: c-api/init_config c PyInitConfig_GetStr18535674
Ref: 38d18535674
Ref: c-api/init_config c PyInitConfig_GetStrList18536195
Ref: 38e18536195
Ref: c-api/init_config c PyInitConfig_FreeStrList18536671
Ref: 38918536671
Node: Set Options18536843
Ref: c-api/init_config set-options18536944
Ref: 557018536944
Ref: c-api/init_config c PyInitConfig_SetInt18537401
Ref: 39018537401
Ref: c-api/init_config c PyInitConfig_SetStr18537656
Ref: 39118537656
Ref: c-api/init_config c PyInitConfig_SetStrList18537985
Ref: 39218537985
Node: Module18538355
Ref: c-api/init_config module18538462
Ref: 557118538462
Ref: c-api/init_config c PyInitConfig_AddModule18538495
Ref: 37b18538495
Node: Initialize Python18539163
Ref: c-api/init_config initialize-python18539250
Ref: 557218539250
Ref: c-api/init_config c Py_InitializeFromInitConfig18539305
Ref: 38618539305
Node: Configuration Options18539707
Ref: c-api/init_config configuration-options18539855
Ref: 557318539855
Ref: c-api/init_config pyinitconfig-opts18539855
Ref: 556f18539855
Node: Runtime Python configuration API18560810
Ref: c-api/init_config runtime-python-configuration-api18560954
Ref: 559218560954
Ref: c-api/init_config c PyConfig_Get18561446
Ref: 37c18561446
Ref: c-api/init_config c PyConfig_GetInt18562100
Ref: 38418562100
Ref: c-api/init_config c PyConfig_Names18562368
Ref: 38518562368
Ref: c-api/init_config c PyConfig_Set18562794
Ref: 37d18562794
Node: PyConfig C API18563568
Ref: c-api/init_config pyconfig-api18563705
Ref: 37a18563705
Ref: c-api/init_config pyconfig-c-api18563705
Ref: 559318563705
Ref: PyConfig C API-Footnote-118565184
Node: 使用例<55>18565226
Ref: c-api/init_config id118565315
Ref: 559418565315
Node: PyWideStringList18566329
Ref: c-api/init_config pywidestringlist18566435
Ref: 559518566435
Ref: c-api/init_config c PyWideStringList18566488
Ref: ba518566488
Ref: c-api/init_config c PyWideStringList_Append18566753
Ref: bb618566753
Ref: c-api/init_config c PyWideStringList_Insert18566997
Ref: bb718566997
Ref: c-api/init_config c PyWideStringList length18567505
Ref: 559618567505
Ref: c-api/init_config c PyWideStringList items18567600
Ref: 559718567600
Node: PyStatus18567681
Ref: c-api/init_config pystatus18567785
Ref: 559818567785
Ref: c-api/init_config c PyStatus18567822
Ref: ba418567822
Ref: c-api/init_config c PyStatus exitcode18568086
Ref: 559918568086
Ref: c-api/init_config c PyStatus err_msg18568210
Ref: 559a18568210
Ref: c-api/init_config c PyStatus func18568301
Ref: 559b18568301
Ref: c-api/init_config c PyStatus_Ok18568483
Ref: bb518568483
Ref: c-api/init_config c PyStatus_Error18568567
Ref: baf18568567
Ref: c-api/init_config c PyStatus_NoMemory18568780
Ref: bb418568780
Ref: c-api/init_config c PyStatus_Exit18568911
Ref: bb118568911
Ref: c-api/init_config c PyStatus_Exception18569091
Ref: bb018569091
Ref: c-api/init_config c PyStatus_IsError18569323
Ref: bb218569323
Ref: c-api/init_config c PyStatus_IsExit18569420
Ref: bb318569420
Ref: c-api/init_config c Py_ExitStatusException18569515
Ref: bb918569515
Node: PyPreConfig18570485
Ref: c-api/init_config pypreconfig18570610
Ref: 559c18570610
Ref: c-api/init_config c PyPreConfig18570653
Ref: ba318570653
Ref: c-api/init_config c PyPreConfig_InitPythonConfig18570789
Ref: bae18570789
Ref: c-api/init_config c PyPreConfig_InitIsolatedConfig18570978
Ref: bad18570978
Ref: c-api/init_config c PyPreConfig allocator18571203
Ref: 557418571203
Ref: c-api/init_config c PyPreConfig configure_locale18572998
Ref: 557d18572998
Ref: c-api/init_config c PyPreConfig coerce_c_locale18573371
Ref: 557a18573371
Ref: c-api/init_config c PyPreConfig coerce_c_locale_warn18573702
Ref: 557b18573702
Ref: c-api/init_config c PyPreConfig dev_mode18573901
Ref: 559e18573901
Ref: c-api/init_config c PyPreConfig isolated18574110
Ref: 559f18574110
Ref: c-api/init_config c PyPreConfig legacy_windows_fs_encoding18574285
Ref: 41818574285
Ref: c-api/init_config c PyPreConfig parse_argv18574869
Ref: 55a018574869
Ref: c-api/init_config c PyPreConfig use_environment18575266
Ref: 55a118575266
Ref: c-api/init_config c PyPreConfig utf8_mode18575497
Ref: 41d18575497
Node: Preinitialize Python with PyPreConfig18575920
Ref: c-api/init_config c-preinit18576045
Ref: 42c818576045
Ref: c-api/init_config preinitialize-python-with-pypreconfig18576045
Ref: 55a218576045
Ref: c-api/init_config c Py_PreInitialize18576538
Ref: 41e18576538
Ref: c-api/init_config c Py_PreInitializeFromBytesArgs18576739
Ref: bbb18576739
Ref: c-api/init_config c Py_PreInitializeFromArgs18577100
Ref: bba18577100
Node: PyConfig18579038
Ref: c-api/init_config pyconfig18579180
Ref: 55a318579180
Ref: c-api/init_config c PyConfig18579217
Ref: 3f718579217
Ref: c-api/init_config c PyConfig_InitPythonConfig18579458
Ref: ba818579458
Ref: c-api/init_config c PyConfig_InitIsolatedConfig18579620
Ref: ba718579620
Ref: c-api/init_config c PyConfig_SetString18579786
Ref: bac18579786
Ref: c-api/init_config c PyConfig_SetBytesString18580059
Ref: bab18580059
Ref: c-api/init_config c PyConfig_SetArgv18580390
Ref: ba918580390
Ref: c-api/init_config c PyConfig_SetBytesArgv18580707
Ref: baa18580707
Ref: c-api/init_config c PyConfig_SetWideStringList18581077
Ref: 1dc918581077
Ref: c-api/init_config c PyConfig_Read18581385
Ref: 99318581385
Ref: c-api/init_config c PyConfig_Clear18582755
Ref: ba618582755
Ref: c-api/init_config c PyConfig argv18583888
Ref: 3f118583888
Ref: c-api/init_config c PyConfig safe_path18584910
Ref: 97718584910
Ref: c-api/init_config c PyConfig base_exec_prefix18585796
Ref: 557518585796
Ref: c-api/init_config c PyConfig base_executable18586053
Ref: 557618586053
Ref: c-api/init_config c PyConfig base_prefix18586463
Ref: 557718586463
Ref: c-api/init_config c PyConfig buffered_stdio18586705
Ref: 41118586705
Ref: c-api/init_config c PyConfig bytes_warning18587130
Ref: 40718587130
Ref: c-api/init_config c PyConfig warn_default_encoding18587587
Ref: 559018587587
Ref: c-api/init_config c PyConfig code_debug_ranges18587911
Ref: 557918587911
Ref: c-api/init_config c PyConfig check_hash_pycs_mode18588396
Ref: 557818588396
Ref: c-api/init_config c PyConfig configure_c_stdio18589068
Ref: 557c18589068
Ref: c-api/init_config c PyConfig dev_mode18589629
Ref: 557f18589629
Ref: c-api/init_config c PyConfig dump_refs18589941
Ref: 558018589941
Ref: c-api/init_config c PyConfig dump_refs_file18590366
Ref: 558118590366
Ref: c-api/init_config c PyConfig exec_prefix18590627
Ref: 558218590627
Ref: c-api/init_config c PyConfig executable18590991
Ref: 64518590991
Ref: c-api/init_config c PyConfig faulthandler18591321
Ref: 558318591321
Ref: c-api/init_config c PyConfig filesystem_encoding18591687
Ref: 41b18591687
Ref: c-api/init_config c PyConfig filesystem_errors18592926
Ref: 41c18592926
Ref: c-api/init_config c PyConfig use_frozen_modules18593607
Ref: 558f18593607
Ref: c-api/init_config c PyConfig hash_seed18593892
Ref: 41418593892
Ref: c-api/init_config c PyConfig use_hash_seed18593948
Ref: 41318593948
Ref: c-api/init_config c PyConfig home18594367
Ref: 3f318594367
Ref: c-api/init_config c PyConfig import_time18594727
Ref: 558418594727
Ref: c-api/init_config c PyConfig inspect18595215
Ref: 40118595215
Ref: c-api/init_config c PyConfig install_signal_handlers18595815
Ref: abb18595815
Ref: c-api/init_config c PyConfig interactive18595988
Ref: 3ff18595988
Ref: c-api/init_config c PyConfig int_max_str_digits18596204
Ref: 558518596204
Ref: c-api/init_config c PyConfig cpu_count18597105
Ref: 557e18597105
Ref: c-api/init_config c PyConfig isolated18597605
Ref: 41618597605
Ref: c-api/init_config c PyConfig legacy_windows_stdio18598610
Ref: 41a18598610
Ref: c-api/init_config c PyConfig malloc_stats18599247
Ref: 558618599247
Ref: c-api/init_config c PyConfig platlibdir18599643
Ref: 1d2118599643
Ref: c-api/init_config c PyConfig pythonpath_env18600473
Ref: 55a418600473
Ref: c-api/init_config c PyConfig module_search_paths18600825
Ref: 64318600825
Ref: c-api/init_config c PyConfig module_search_paths_set18600921
Ref: 80518600921
Ref: c-api/init_config c PyConfig optimization_level18601458
Ref: 40318601458
Ref: c-api/init_config c PyConfig orig_argv18601965
Ref: a9418601965
Ref: c-api/init_config c PyConfig parse_argv18602649
Ref: 1cf118602649
Ref: c-api/init_config c PyConfig parser_debug18603567
Ref: 3f918603567
Ref: c-api/init_config c PyConfig pathconfig_warnings18604055
Ref: 40918604055
Ref: c-api/init_config c PyConfig prefix18604493
Ref: 558818604493
Ref: c-api/init_config c PyConfig program_name18604834
Ref: 3f218604834
Ref: c-api/init_config c PyConfig pycache_prefix18605578
Ref: 558918605578
Ref: c-api/init_config c PyConfig quiet18606052
Ref: 3fd18606052
Ref: c-api/init_config c PyConfig run_command18606328
Ref: 551918606328
Ref: c-api/init_config c PyConfig run_filename18606517
Ref: 551a18606517
Ref: c-api/init_config c PyConfig run_module18606996
Ref: 551b18606996
Ref: c-api/init_config c PyConfig run_presite18607184
Ref: 558a18607184
Ref: c-api/init_config c PyConfig show_ref_count18607687
Ref: 558b18607687
Ref: c-api/init_config c PyConfig site_import18608054
Ref: 40518608054
Ref: c-api/init_config c PyConfig skip_source_first_line18608719
Ref: 558c18608719
Ref: c-api/init_config c PyConfig stdio_encoding18609104
Ref: 64418609104
Ref: c-api/init_config c PyConfig stdio_errors18609160
Ref: 492818609160
Ref: c-api/init_config c PyConfig tracemalloc18610072
Ref: 558e18610072
Ref: c-api/init_config c PyConfig perf_profiling18610437
Ref: 558718610437
Ref: c-api/init_config c PyConfig stdlib_dir18611255
Ref: 558d18611255
Ref: c-api/init_config c PyConfig use_environment18611426
Ref: 40b18611426
Ref: c-api/init_config c PyConfig use_system_logger18611760
Ref: 227118611760
Ref: c-api/init_config c PyConfig user_site_directory18612126
Ref: 40f18612126
Ref: c-api/init_config c PyConfig verbose18612533
Ref: 3fb18612533
Ref: c-api/init_config c PyConfig warnoptions18613153
Ref: 64118613153
Ref: c-api/init_config c PyConfig write_bytecode18614007
Ref: 40d18614007
Ref: c-api/init_config c PyConfig xoptions18614476
Ref: 64218614476
Ref: c-api/init_config c PyConfig _pystats18614677
Ref: 559118614677
Ref: PyConfig-Footnote-118615366
Ref: PyConfig-Footnote-218615408
Node: Initialization with PyConfig18615450
Ref: c-api/init_config init-from-config18615577
Ref: 551818615577
Ref: c-api/init_config initialization-with-pyconfig18615577
Ref: 55a518615577
Node: Isolated Configuration18619276
Ref: c-api/init_config init-isolated-conf18619415
Ref: 556c18619415
Ref: c-api/init_config isolated-configuration18619415
Ref: 55a618619415
Node: Python Configuration18620186
Ref: c-api/init_config init-python-config18620322
Ref: 551c18620322
Ref: c-api/init_config python-configuration18620322
Ref: 55a718620322
Ref: Python Configuration-Footnote-118620958
Ref: Python Configuration-Footnote-218621000
Node: Python Path Configuration18621042
Ref: c-api/init_config init-path-config18621147
Ref: aaa18621147
Ref: c-api/init_config python-path-configuration18621147
Ref: 55a818621147
Node: Py_GetArgcArgv18625492
Ref: c-api/init_config py-getargcargv18625627
Ref: 55a918625627
Ref: c-api/init_config c Py_GetArgcArgv18625676
Ref: 1d4118625676
Node: Delaying main module execution18625878
Ref: c-api/init_config delaying-main-module-execution18625990
Ref: 55aa18625990
Node: メモリ管理18626496
Ref: c-api/memory doc18626700
Ref: 55ab18626700
Ref: c-api/memory memory18626700
Ref: 559d18626700
Ref: c-api/memory memory-management18626700
Ref: 55ac18626700
Ref: c-api/memory translation-repo18626700
Ref: 55ad18626700
Node: 概要<4>18627148
Ref: c-api/memory memoryoverview18627235
Ref: 55ae18627235
Ref: c-api/memory overview18627235
Ref: 55af18627235
Node: Allocator Domains18632844
Ref: c-api/memory allocator-domains18632976
Ref: 55b018632976
Ref: c-api/memory id118633027
Ref: 55b118633027
Node: 生メモリインターフェース18635066
Ref: c-api/memory raw-memory-interface18635222
Ref: 55b718635222
Ref: c-api/memory raw-memoryinterface18635222
Ref: 55b318635222
Ref: c-api/memory c PyMem_RawMalloc18635712
Ref: 63118635712
Ref: c-api/memory c PyMem_RawCalloc18636286
Ref: 63218636286
Ref: c-api/memory c PyMem_RawRealloc18637018
Ref: 63318637018
Ref: c-api/memory c PyMem_RawFree18638042
Ref: 63418638042
Node: メモリインターフェース18638602
Ref: c-api/memory memory-interface18638774
Ref: 55b818638774
Ref: c-api/memory memoryinterface18638774
Ref: 55b418638774
Ref: c-api/memory c PyMem_Malloc18639454
Ref: e5f18639454
Ref: c-api/memory c PyMem_Calloc18639993
Ref: 10ad18639993
Ref: c-api/memory c PyMem_Realloc18640719
Ref: 123318640719
Ref: c-api/memory c PyMem_Free18641707
Ref: 165b18641707
Ref: c-api/memory c PyMem_New18642382
Ref: 173d18642382
Ref: c-api/memory c PyMem_Resize18642624
Ref: 55b918642624
Ref: c-api/memory c PyMem_Del18643141
Ref: 173e18643141
Node: 非推奨のエイリアス<2>18643308
Ref: c-api/memory deprecated-aliases18643408
Ref: 55ba18643408
Ref: c-api/memory c PyMem_MALLOC18643961
Ref: 55bb18643961
Ref: c-api/memory c PyMem_NEW18644162
Ref: 55bc18644162
Ref: c-api/memory c PyMem_REALLOC18644359
Ref: 55bd18644359
Ref: c-api/memory c PyMem_RESIZE18644564
Ref: 55be18644564
Ref: c-api/memory c PyMem_FREE18644747
Ref: 55bf18644747
Ref: c-api/memory c PyMem_DEL18644943
Ref: 55c018644943
Node: オブジェクトアロケータ18645317
Ref: c-api/memory object-allocators18645478
Ref: 55c118645478
Ref: c-api/memory objectinterface18645478
Ref: 55b518645478
Ref: c-api/memory c PyObject_Malloc18646300
Ref: e6218646300
Ref: c-api/memory c PyObject_Calloc18646845
Ref: 10ae18646845
Ref: c-api/memory c PyObject_Realloc18647576
Ref: 165c18647576
Ref: c-api/memory c PyObject_Free18648589
Ref: e6018648589
Node: Default Memory Allocators18649876
Ref: c-api/memory default-memory-allocators18650055
Ref: 213b18650055
Ref: c-api/memory id218650055
Ref: 55c318650055
Node: メモリアロケータをカスタマイズする18652581
Ref: c-api/memory customize-memory-allocators18652770
Ref: 55c218652770
Ref: c-api/memory id318652770
Ref: 55c418652770
Ref: c-api/memory c PyMemAllocatorEx18652895
Ref: 10ce18652895
Ref: c-api/memory c PyMemAllocatorDomain18654934
Ref: 55b218654934
Ref: c-api/memory c PYMEM_DOMAIN_RAW18655076
Ref: 213c18655076
Ref: c-api/memory c PYMEM_DOMAIN_MEM18655321
Ref: e6318655321
Ref: c-api/memory c PYMEM_DOMAIN_OBJ18655557
Ref: e6118655557
Ref: c-api/memory c PyMem_GetAllocator18655804
Ref: 551418655804
Ref: c-api/memory c PyMem_SetAllocator18656009
Ref: 7a818656009
Ref: c-api/memory c PyMem_SetupDebugHooks18658168
Ref: e6418658168
Node: Debug hooks on the Python memory allocators18658319
Ref: c-api/memory debug-hooks-on-the-python-memory-allocators18658507
Ref: 55c518658507
Ref: c-api/memory pymem-debug-hooks18658507
Ref: 213e18658507
Node: pymalloc アロケータ18663815
Ref: c-api/memory pymalloc18663974
Ref: f0b18663974
Ref: c-api/memory the-pymalloc-allocator18663974
Ref: 55c618663974
Node: pymalloc アリーナアロケータのカスタマイズ18665336
Ref: c-api/memory customize-pymalloc-arena-allocator18665454
Ref: 55c718665454
Ref: c-api/memory c PyObjectArenaAllocator18665596
Ref: 55c818665596
Ref: c-api/memory c PyObject_GetArenaAllocator18666708
Ref: 551518666708
Ref: c-api/memory c PyObject_SetArenaAllocator18666859
Ref: 551318666859
Node: The mimalloc allocator18667010
Ref: c-api/memory mimalloc18667143
Ref: 213d18667143
Ref: c-api/memory the-mimalloc-allocator18667143
Ref: 55c918667143
Node: tracemalloc C API18667500
Ref: c-api/memory tracemalloc-c-api18667622
Ref: 55ca18667622
Ref: c-api/memory c PyTraceMalloc_Track18667698
Ref: daf18667698
Ref: c-api/memory c PyTraceMalloc_Untrack18668112
Ref: db018668112
Node: 使用例<56>18668405
Ref: c-api/memory examples18668496
Ref: 55cb18668496
Ref: c-api/memory memoryexamples18668496
Ref: 55cc18668496
Node: オブジェクト実装サポート object implementation support18670707
Ref: c-api/objimpl doc18670925
Ref: 55cd18670925
Ref: c-api/objimpl newtypes18670925
Ref: 55ce18670925
Ref: c-api/objimpl object-implementation-support18670925
Ref: 55cf18670925
Ref: c-api/objimpl translation-repo18670925
Ref: 55d018670925
Node: オブジェクトをヒープ上にメモリ確保する18671529
Ref: c-api/allocation doc18671715
Ref: 55d118671715
Ref: c-api/allocation allocating-objects18671715
Ref: 55d218671715
Ref: c-api/allocation allocating-objects-on-the-heap18671715
Ref: 55d318671715
Ref: c-api/allocation c _PyObject_New18671827
Ref: 55d418671827
Ref: c-api/allocation c _PyObject_NewVar18671939
Ref: 55d518671939
Ref: c-api/allocation c PyObject_Init18672085
Ref: c6018672085
Ref: c-api/allocation c PyObject_InitVar18673079
Ref: 1d4018673079
Ref: c-api/allocation c PyObject_New18673556
Ref: b7c18673556
Ref: c-api/allocation c PyObject_NewVar18675412
Ref: b7d18675412
Ref: c-api/allocation c _Py_NoneStruct18677365
Ref: 55d618677365
Node: 非推奨のエイリアス<3>18677870
Ref: c-api/allocation deprecated-aliases18677994
Ref: 55d718677994
Ref: c-api/allocation c PyObject_NEW18678531
Ref: 55d818678531
Ref: c-api/allocation c PyObject_NEW_VAR18678734
Ref: 55d918678734
Ref: c-api/allocation c PyObject_INIT18678925
Ref: 1d3e18678925
Ref: c-api/allocation c PyObject_INIT_VAR18679131
Ref: 1d3f18679131
Ref: c-api/allocation c PyObject_MALLOC18679319
Ref: 55da18679319
Ref: c-api/allocation c PyObject_REALLOC18679524
Ref: 55db18679524
Ref: c-api/allocation c PyObject_FREE18679721
Ref: 55dc18679721
Ref: c-api/allocation c PyObject_DEL18679919
Ref: 55dd18679919
Ref: c-api/allocation c PyObject_Del18680118
Ref: 16ea18680118
Node: Object Life Cycle18680226
Ref: c-api/lifecycle doc18680481
Ref: 55de18680481
Ref: c-api/lifecycle life-cycle18680481
Ref: 55df18680481
Ref: c-api/lifecycle object-life-cycle18680481
Ref: 55e018680481
Ref: c-api/lifecycle translation-repo18680481
Ref: 55e118680481
Node: Life Events18680905
Ref: c-api/lifecycle life-events18681005
Ref: 55e218681005
Node: Cyclic Isolate Destruction18686295
Ref: c-api/lifecycle cyclic-isolate-destruction18686414
Ref: 55e518686414
Ref: Cyclic Isolate Destruction-Footnote-118691682
Node: 関数<15>18691724
Ref: c-api/lifecycle functions18691823
Ref: 55e618691823
Ref: c-api/lifecycle c PyObject_CallFinalizer18691959
Ref: 55e718691959
Ref: c-api/lifecycle c PyObject_CallFinalizerFromDealloc18692512
Ref: 55e318692512
Node: 共通のオブジェクト構造体 common object structure18693095
Ref: c-api/structures doc18693315
Ref: 55e818693315
Ref: c-api/structures common-object-structures18693315
Ref: 55e918693315
Ref: c-api/structures common-structs18693315
Ref: 55ea18693315
Ref: c-api/structures translation-repo18693315
Ref: 55eb18693315
Node: Base object types and macros18693757
Ref: c-api/structures base-object-types-and-macros18693925
Ref: 55ec18693925
Ref: c-api/structures c PyObject18694431
Ref: 5df18694431
Ref: c-api/structures c PyObject ob_refcnt18695155
Ref: a9f18695155
Ref: c-api/structures c PyObject ob_type18695651
Ref: 4ecd18695651
Ref: c-api/structures c PyVarObject18695908
Ref: 46d618695908
Ref: c-api/structures c PyVarObject ob_size18696397
Ref: 511c18696397
Ref: c-api/structures c PyObject_HEAD18697160
Ref: 14f518697160
Ref: c-api/structures c PyObject_VAR_HEAD18697513
Ref: 55ed18697513
Ref: c-api/structures c PyBaseObject_Type18697914
Ref: 4f7518697914
Ref: c-api/structures c Py_Is18698108
Ref: aa018698108
Ref: c-api/structures c Py_IsNone18698362
Ref: aa118698362
Ref: c-api/structures c Py_IsTrue18698615
Ref: aa218698615
Ref: c-api/structures c Py_IsFalse18698868
Ref: aa318698868
Ref: c-api/structures c Py_TYPE18699124
Ref: 3c918699124
Ref: c-api/structures c Py_IS_TYPE18699647
Ref: 1ba018699647
Ref: c-api/structures c Py_SET_TYPE18699869
Ref: 98418699869
Ref: c-api/structures c Py_SIZE18700521
Ref: 98518700521
Ref: c-api/structures c Py_SET_SIZE18700813
Ref: 98618700813
Ref: c-api/structures c PyObject_HEAD_INIT18700969
Ref: 55ee18700969
Ref: c-api/structures c PyVarObject_HEAD_INIT18701222
Ref: 55ef18701222
Node: Implementing functions and methods18701513
Ref: c-api/structures implementing-functions-and-methods18701729
Ref: 55f018701729
Ref: c-api/structures c PyCFunction18701818
Ref: 169118701818
Ref: c-api/structures c PyCFunctionWithKeywords18702477
Ref: 4f8b18702477
Ref: c-api/structures c PyCFunctionFast18702923
Ref: 4f8918702923
Ref: c-api/structures c PyCFunctionFastWithKeywords18703359
Ref: 4f8a18703359
Ref: c-api/structures c PyCMethod18703931
Ref: 96818703931
Ref: c-api/structures c PyMethodDef18704432
Ref: 16f018704432
Ref: c-api/structures c PyMethodDef ml_name18704708
Ref: 4ee918704708
Ref: c-api/structures c PyMethodDef ml_meth18704791
Ref: 55f318704791
Ref: c-api/structures c PyMethodDef ml_flags18704900
Ref: 55f418704900
Ref: c-api/structures c PyMethodDef ml_doc18705014
Ref: 55f518705014
Ref: c-api/structures c METH_VARARGS18705757
Ref: 172118705757
Ref: c-api/structures c METH_KEYWORDS18706451
Ref: 4ea218706451
Ref: c-api/structures meth-varargs-meth-keywords18706711
Ref: 55f118706711
Ref: c-api/structures c METH_FASTCALL18707148
Ref: 199e18707148
Ref: c-api/structures meth-fastcall-meth-keywords18707742
Ref: 55f218707742
Ref: c-api/structures c METH_METHOD18708410
Ref: b6818708410
Ref: c-api/structures meth-method-meth-fastcall-meth-keywords18708645
Ref: 1a0918708645
Ref: c-api/structures c METH_NOARGS18709170
Ref: 16ed18709170
Ref: c-api/structures c METH_O18709783
Ref: 172018709783
Ref: c-api/structures c METH_CLASS18710436
Ref: 16ee18710436
Ref: c-api/structures c METH_STATIC18710842
Ref: 16ef18710842
Ref: c-api/structures c METH_COEXIST18711353
Ref: 169018711353
Ref: c-api/structures c PyCMethod_Type18712077
Ref: 55f618712077
Ref: c-api/structures c PyCMethod_Check18712286
Ref: 55f718712286
Ref: c-api/structures c PyCMethod_CheckExact18712477
Ref: 55f818712477
Ref: c-api/structures c PyCMethod_New18712632
Ref: 1cab18712632
Ref: c-api/structures c PyCFunction_Type18713787
Ref: 4f8f18713787
Ref: c-api/structures c PyCFunction_Check18714048
Ref: 55f918714048
Ref: c-api/structures c PyCFunction_CheckExact18714243
Ref: 55fa18714243
Ref: c-api/structures c PyCFunction_NewEx18714402
Ref: 1d7618714402
Ref: c-api/structures c PyCFunction_New18714668
Ref: 1cb118714668
Ref: c-api/structures c PyCFunction_GetFlags18714949
Ref: 4f8c18714949
Ref: c-api/structures c PyCFunction_GET_FLAGS18715369
Ref: 55fb18715369
Ref: c-api/structures c PyCFunction_GetFunction18715533
Ref: 4f8d18715533
Ref: c-api/structures c PyCFunction_GET_FUNCTION18715985
Ref: 55fc18715985
Ref: c-api/structures c PyCFunction_GetSelf18716155
Ref: 4f8e18716155
Ref: c-api/structures c PyCFunction_GET_SELF18716826
Ref: 55fd18716826
Node: Accessing attributes of extension types18717016
Ref: c-api/structures accessing-attributes-of-extension-types18717195
Ref: 55fe18717195
Ref: c-api/structures c PyMemberDef18717294
Ref: 77118717294
Ref: c-api/structures c PyMemberDef name18717668
Ref: 55ff18717668
Ref: c-api/structures c PyMemberDef type18717881
Ref: 4eea18717881
Ref: c-api/structures c PyMemberDef offset18718039
Ref: 560018718039
Ref: c-api/structures c PyMemberDef flags18718200
Ref: 4eeb18718200
Ref: c-api/structures c PyMemberDef doc18718336
Ref: 560218718336
Ref: c-api/structures pymemberdef-offsets18718888
Ref: 52ed18718888
Ref: c-api/structures c PyMember_GetOne18720265
Ref: 7aa18720265
Ref: c-api/structures c PyMember_SetOne18720731
Ref: 7ab18720731
Node: Member flags18721323
Ref: c-api/structures member-flags18721432
Ref: 560318721432
Ref: c-api/structures pymemberdef-flags18721432
Ref: 560118721432
Ref: c-api/structures c Py_READONLY18721547
Ref: 7ae18721547
Ref: c-api/structures c Py_AUDIT_READ18721681
Ref: 7af18721681
Ref: c-api/structures c Py_RELATIVE_OFFSET18721882
Ref: 77018721882
Node: Member types18723190
Ref: c-api/structures member-types18723336
Ref: 560418723336
Ref: c-api/structures pymemberdef-types18723336
Ref: 19f018723336
Ref: c-api/structures c Py_T_BYTE18724233
Ref: 513b18724233
Ref: c-api/structures c Py_T_SHORT18724470
Ref: 514118724470
Ref: c-api/structures c Py_T_INT18724704
Ref: 7ac18724704
Ref: c-api/structures c Py_T_LONG18724941
Ref: 513e18724941
Ref: c-api/structures c Py_T_LONGLONG18725181
Ref: 513f18725181
Ref: c-api/structures c Py_T_UBYTE18725414
Ref: 514418725414
Ref: c-api/structures c Py_T_UINT18725649
Ref: 514518725649
Ref: c-api/structures c Py_T_USHORT18725887
Ref: 514818725887
Ref: c-api/structures c Py_T_ULONG18726122
Ref: 514618726122
Ref: c-api/structures c Py_T_ULONGLONG18726362
Ref: 514718726362
Ref: c-api/structures c Py_T_PYSSIZET18726597
Ref: 514018726597
Ref: c-api/structures c Py_T_FLOAT18726830
Ref: 513d18726830
Ref: c-api/structures c Py_T_DOUBLE18727069
Ref: 7ad18727069
Ref: c-api/structures c Py_T_BOOL18727305
Ref: 513a18727305
Ref: c-api/structures c Py_T_STRING18727544
Ref: 514218727544
Ref: c-api/structures c Py_T_STRING_INPLACE18727773
Ref: 514318727773
Ref: c-api/structures c Py_T_CHAR18728045
Ref: 513c18728045
Ref: c-api/structures c Py_T_OBJECT_EX18728291
Ref: 7b118728291
Ref: c-api/structures c T_OBJECT18729227
Ref: 7b018729227
Ref: c-api/structures c T_NONE18729449
Ref: 7b218729449
Node: Defining Getters and Setters18729545
Ref: c-api/structures defining-getters-and-setters18729670
Ref: 560518729670
Ref: c-api/structures c PyGetSetDef18729747
Ref: db218729747
Ref: c-api/structures c PyGetSetDef name18730064
Ref: 560618730064
Ref: c-api/structures c PyGetSetDef get18730134
Ref: 560718730134
Ref: c-api/structures c PyGetSetDef set18730234
Ref: 560818730234
Ref: c-api/structures c PyGetSetDef doc18730407
Ref: 560918730407
Ref: c-api/structures c PyGetSetDef closure18730515
Ref: 560a18730515
Ref: c-api/structures c getter18730659
Ref: 51a818730659
Ref: c-api/structures c setter18731085
Ref: 51b618731085
Node: Type Object Structures18731621
Ref: c-api/typeobj doc18731887
Ref: 560b18731887
Ref: c-api/typeobj translation-repo18731887
Ref: 560c18731887
Ref: c-api/typeobj type-object-structures18731887
Ref: 560d18731887
Ref: c-api/typeobj type-structs18731887
Ref: b8418731887
Node: クイックリファレンス18733808
Ref: c-api/typeobj quick-reference18733925
Ref: 560f18733925
Node: tp スロット18734112
Ref: c-api/typeobj tp-slots18734212
Ref: 561018734212
Ref: c-api/typeobj tp-slots-table18734212
Ref: 561118734212
Ref: tp スロット-Footnote-118747482
Ref: tp スロット-Footnote-218747794
Node: sub-slots18748569
Ref: c-api/typeobj id318748710
Ref: 561c18748710
Ref: c-api/typeobj sub-slots18748710
Ref: 561318748710
Node: スロットの定義型 typedef18759069
Ref: c-api/typeobj slot-typedefs18759186
Ref: 564c18759186
Ref: c-api/typeobj slot-typedefs-table18759186
Ref: 561218759186
Node: PyTypeObject 定義18767090
Ref: c-api/typeobj pytypeobject-definition18767237
Ref: 564e18767237
Node: PyObject スロット18770846
Ref: c-api/typeobj pyobject-slots18770987
Ref: 564f18770987
Node: PyVarObject スロット18773130
Ref: c-api/typeobj pyvarobject-slots18773277
Ref: 565018773277
Node: PyTypeObject スロット18773871
Ref: c-api/typeobj pytypeobject-slots18774009
Ref: 565118774009
Ref: c-api/typeobj c PyTypeObject tp_name18774373
Ref: 1cb018774373
Ref: c-api/typeobj c PyTypeObject tp_basicsize18776237
Ref: b7e18776237
Ref: c-api/typeobj c PyTypeObject tp_itemsize18776333
Ref: 23bb18776333
Ref: c-api/typeobj c PyTypeObject tp_dealloc18780526
Ref: 4ebc18780526
Ref: c-api/typeobj c Py_tp_dealloc18780731
Ref: 518618780731
Ref: c-api/typeobj c PyTypeObject tp_vectorcall_offset18786075
Ref: 529618786075
Ref: c-api/typeobj c PyTypeObject tp_getattr18788019
Ref: 4eed18788019
Ref: c-api/typeobj c Py_tp_getattr18788225
Ref: 518d18788225
Ref: c-api/typeobj c PyTypeObject tp_setattr18789110
Ref: 4eee18789110
Ref: c-api/typeobj c Py_tp_setattr18789316
Ref: 519a18789316
Ref: c-api/typeobj c PyTypeObject tp_as_async18790204
Ref: 10cf18790204
Ref: c-api/typeobj c PyTypeObject tp_repr18790984
Ref: 4ee418790984
Ref: c-api/typeobj c Py_tp_repr18791181
Ref: 519818791181
Ref: c-api/typeobj c PyTypeObject tp_as_number18792351
Ref: b8218792351
Ref: c-api/typeobj c PyTypeObject tp_as_sequence18792846
Ref: 561418792846
Ref: c-api/typeobj c PyTypeObject tp_as_mapping18793365
Ref: 561518793365
Ref: c-api/typeobj c PyTypeObject tp_hash18793876
Ref: 4ef618793876
Ref: c-api/typeobj c Py_tp_hash18794073
Ref: 519018794073
Ref: c-api/typeobj c PyTypeObject tp_call18796008
Ref: 77b18796008
Ref: c-api/typeobj c Py_tp_call18796208
Ref: 518418796208
Ref: c-api/typeobj c PyTypeObject tp_str18796685
Ref: 4ee518796685
Ref: c-api/typeobj c Py_tp_str18796870
Ref: 519c18796870
Ref: c-api/typeobj c PyTypeObject tp_getattro18798164
Ref: 1a6418798164
Ref: c-api/typeobj c Py_tp_getattro18798373
Ref: 518e18798373
Ref: c-api/typeobj c PyTypeObject tp_setattro18799366
Ref: 4ee818799366
Ref: c-api/typeobj c Py_tp_setattro18799575
Ref: 519b18799575
Ref: c-api/typeobj c PyTypeObject tp_as_buffer18800719
Ref: b8018800719
Ref: c-api/typeobj c PyTypeObject tp_flags18801339
Ref: 1c7118801339
Ref: c-api/typeobj c Py_TPFLAGS_HEAPTYPE18803668
Ref: aac18803668
Ref: c-api/typeobj c Py_TPFLAGS_BASETYPE18804474
Ref: 4ed518804474
Ref: c-api/typeobj c Py_TPFLAGS_READY18804906
Ref: 565718804906
Ref: c-api/typeobj c Py_TPFLAGS_READYING18805129
Ref: 565818805129
Ref: c-api/typeobj c Py_TPFLAGS_HAVE_GC18805351
Ref: 98118805351
Ref: c-api/typeobj c Py_TPFLAGS_DEFAULT18806444
Ref: 4eca18806444
Ref: c-api/typeobj c Py_TPFLAGS_METHOD_DESCRIPTOR18806840
Ref: 513818806840
Ref: c-api/typeobj c Py_TPFLAGS_MANAGED_DICT18807856
Ref: 60f18807856
Ref: c-api/typeobj c Py_TPFLAGS_MANAGED_WEAKREF18808524
Ref: 77c18808524
Ref: c-api/typeobj c Py_TPFLAGS_ITEMS_AT_END18808847
Ref: 76d18808847
Ref: c-api/typeobj c Py_TPFLAGS_LONG_SUBCLASS18809604
Ref: 52df18809604
Ref: c-api/typeobj c Py_TPFLAGS_LIST_SUBCLASS18809655
Ref: 565918809655
Ref: c-api/typeobj c Py_TPFLAGS_TUPLE_SUBCLASS18809706
Ref: 565a18809706
Ref: c-api/typeobj c Py_TPFLAGS_BYTES_SUBCLASS18809758
Ref: 565b18809758
Ref: c-api/typeobj c Py_TPFLAGS_UNICODE_SUBCLASS18809810
Ref: 565c18809810
Ref: c-api/typeobj c Py_TPFLAGS_DICT_SUBCLASS18809864
Ref: 565d18809864
Ref: c-api/typeobj c Py_TPFLAGS_BASE_EXC_SUBCLASS18809915
Ref: 565e18809915
Ref: c-api/typeobj c Py_TPFLAGS_TYPE_SUBCLASS18809970
Ref: 565f18809970
Ref: c-api/typeobj c Py_TPFLAGS_HAVE_FINALIZE18810585
Ref: 42718810585
Ref: c-api/typeobj c _Py_TPFLAGS_HAVE_VECTORCALL18811011
Ref: 566018811011
Ref: c-api/typeobj c Py_TPFLAGS_HAVE_VECTORCALL18811011
Ref: 77618811011
Ref: c-api/typeobj c Py_TPFLAGS_IMMUTABLETYPE18811884
Ref: 3cf18811884
Ref: c-api/typeobj c Py_TPFLAGS_DISALLOW_INSTANTIATION18812254
Ref: 7a218812254
Ref: c-api/typeobj c Py_TPFLAGS_MAPPING18813385
Ref: 1c5818813385
Ref: c-api/typeobj c Py_TPFLAGS_SEQUENCE18814228
Ref: 1c5918814228
Ref: c-api/typeobj c Py_TPFLAGS_VALID_VERSION_TAG18815072
Ref: 566118815072
Ref: c-api/typeobj c PyTypeObject tp_doc18815412
Ref: 4ecb18815412
Ref: c-api/typeobj c Py_tp_doc18815587
Ref: 518a18815587
Ref: c-api/typeobj c PyTypeObject tp_traverse18815881
Ref: 98218815881
Ref: c-api/typeobj c Py_tp_traverse18816090
Ref: 519d18816090
Ref: c-api/typeobj c PyTypeObject tp_clear18820673
Ref: 4ee218820673
Ref: c-api/typeobj c Py_tp_clear18820871
Ref: 518518820871
Ref: c-api/typeobj c PyTypeObject tp_richcompare18828250
Ref: 4ef018828250
Ref: c-api/typeobj c Py_tp_richcompare18828464
Ref: 519918828464
Ref: c-api/typeobj c Py_LT18829469
Ref: 528918829469
Ref: c-api/typeobj c Py_LE18829573
Ref: 528a18829573
Ref: c-api/typeobj c Py_EQ18829678
Ref: 528b18829678
Ref: c-api/typeobj c Py_NE18829783
Ref: 528c18829783
Ref: c-api/typeobj c Py_GT18829888
Ref: 528d18829888
Ref: c-api/typeobj c Py_GE18829992
Ref: 528e18829992
Ref: c-api/typeobj c Py_RETURN_RICHCOMPARE18830165
Ref: dad18830165
Ref: c-api/typeobj c PyTypeObject tp_weaklistoffset18831664
Ref: b7f18831664
Ref: c-api/typeobj c PyTypeObject tp_iter18833576
Ref: 170818833576
Ref: c-api/typeobj c Py_tp_iter18833776
Ref: 519318833776
Ref: c-api/typeobj c PyTypeObject tp_iternext18834404
Ref: 170918834404
Ref: c-api/typeobj c Py_tp_iternext18834613
Ref: 519418834613
Ref: c-api/typeobj c PyTypeObject tp_methods18835701
Ref: 4ed418835701
Ref: c-api/typeobj c Py_tp_methods18835915
Ref: 519618835915
Ref: c-api/typeobj c PyTypeObject tp_members18836485
Ref: 4ed218836485
Ref: c-api/typeobj c Py_tp_members18836698
Ref: 519518836698
Ref: c-api/typeobj c PyTypeObject tp_getset18837298
Ref: 4ed718837298
Ref: c-api/typeobj c Py_tp_getset18837509
Ref: 518f18837509
Ref: c-api/typeobj c PyTypeObject tp_base18838091
Ref: 237518838091
Ref: c-api/typeobj c Py_tp_base18838292
Ref: 518218838292
Ref: c-api/typeobj c PyTypeObject tp_dict18839747
Ref: 1a8c18839747
Ref: c-api/typeobj c PyTypeObject tp_descr_get18841380
Ref: 561618841380
Ref: c-api/typeobj c Py_tp_descr_get18841591
Ref: 518818841591
Ref: c-api/typeobj c PyTypeObject tp_descr_set18841907
Ref: 1cb418841907
Ref: c-api/typeobj c Py_tp_descr_set18842118
Ref: 518918842118
Ref: c-api/typeobj c PyTypeObject tp_dictoffset18842543
Ref: 52ec18842543
Ref: c-api/typeobj c PyTypeObject tp_init18844583
Ref: 7a118844583
Ref: c-api/typeobj c Py_tp_init18844780
Ref: 519118844780
Ref: c-api/typeobj c PyTypeObject tp_alloc18846352
Ref: 4ed018846352
Ref: c-api/typeobj c Py_tp_alloc18846552
Ref: 518118846552
Ref: c-api/typeobj c PyTypeObject tp_new18847166
Ref: 79f18847166
Ref: c-api/typeobj c Py_tp_new18847350
Ref: 519718847350
Ref: c-api/typeobj c PyTypeObject tp_free18849280
Ref: 4ecf18849280
Ref: c-api/typeobj c Py_tp_free18849477
Ref: 518c18849477
Ref: c-api/typeobj c PyTypeObject tp_is_gc18850511
Ref: 561718850511
Ref: c-api/typeobj c Py_tp_is_gc18850709
Ref: 519218850709
Ref: c-api/typeobj c PyTypeObject tp_bases18851945
Ref: 561818851945
Ref: c-api/typeobj c Py_tp_bases18852144
Ref: 518318852144
Ref: c-api/typeobj c PyTypeObject tp_mro18852867
Ref: 52ee18852867
Ref: c-api/typeobj c PyTypeObject tp_cache18853514
Ref: 52ef18853514
Ref: c-api/typeobj c PyTypeObject tp_subclasses18853756
Ref: 79218853756
Ref: c-api/typeobj c PyTypeObject tp_weaklist18854246
Ref: 52f018854246
Ref: c-api/typeobj c PyTypeObject tp_del18854847
Ref: 561918854847
Ref: c-api/typeobj c Py_tp_del18855044
Ref: 518718855044
Ref: c-api/typeobj c PyTypeObject tp_version_tag18855173
Ref: 561a18855173
Ref: c-api/typeobj c PyTypeObject tp_finalize18855459
Ref: c9d18855459
Ref: c-api/typeobj c Py_tp_finalize18855696
Ref: 518b18855696
Ref: c-api/typeobj c PyTypeObject tp_vectorcall18863111
Ref: 198a18863111
Ref: c-api/typeobj c Py_tp_vectorcall18863356
Ref: 519e18863356
Ref: c-api/typeobj c PyTypeObject tp_watched18864987
Ref: 561b18864987
Ref: PyTypeObject スロット-Footnote-118865157
Ref: PyTypeObject スロット-Footnote-218865199
Ref: PyTypeObject スロット-Footnote-318865241
Ref: PyTypeObject スロット-Footnote-418865284
Node: Static Types18865326
Ref: c-api/typeobj id418865450
Ref: 566218865450
Ref: c-api/typeobj static-types18865450
Ref: 98318865450
Node: Heap Types18866355
Ref: c-api/typeobj heap-types18866487
Ref: b5e18866487
Ref: c-api/typeobj id518866487
Ref: 566318866487
Node: 数値オブジェクト構造体18866990
Ref: c-api/typeobj number-object-structures18867146
Ref: 566418867146
Ref: c-api/typeobj number-structs18867146
Ref: 565318867146
Ref: c-api/typeobj c PyNumberMethods18867224
Ref: 163718867224
Ref: c-api/typeobj c PyNumberMethods nb_add18869949
Ref: 52e218869949
Ref: c-api/typeobj c Py_nb_add18870150
Ref: 515718870150
Ref: c-api/typeobj c PyNumberMethods nb_subtract18870152
Ref: 562318870152
Ref: c-api/typeobj c Py_nb_subtract18870363
Ref: 517618870363
Ref: c-api/typeobj c PyNumberMethods nb_multiply18870365
Ref: 562518870365
Ref: c-api/typeobj c Py_nb_multiply18870576
Ref: 516f18870576
Ref: c-api/typeobj c PyNumberMethods nb_remainder18870578
Ref: 562718870578
Ref: c-api/typeobj c Py_nb_remainder18870791
Ref: 517418870791
Ref: c-api/typeobj c PyNumberMethods nb_divmod18870793
Ref: 562918870793
Ref: c-api/typeobj c Py_nb_divmod18871000
Ref: 515a18871000
Ref: c-api/typeobj c PyNumberMethods nb_power18871002
Ref: 562a18871002
Ref: c-api/typeobj c Py_nb_power18871208
Ref: 517318871208
Ref: c-api/typeobj c PyNumberMethods nb_negative18871210
Ref: 562c18871210
Ref: c-api/typeobj c Py_nb_negative18871420
Ref: 517018871420
Ref: c-api/typeobj c PyNumberMethods nb_positive18871422
Ref: 562d18871422
Ref: c-api/typeobj c Py_nb_positive18871632
Ref: 517218871632
Ref: c-api/typeobj c PyNumberMethods nb_absolute18871634
Ref: 562e18871634
Ref: c-api/typeobj c Py_nb_absolute18871844
Ref: 515618871844
Ref: c-api/typeobj c PyNumberMethods nb_bool18871846
Ref: 562f18871846
Ref: c-api/typeobj c Py_nb_bool18872046
Ref: 515918872046
Ref: c-api/typeobj c PyNumberMethods nb_invert18872048
Ref: 563018872048
Ref: c-api/typeobj c Py_nb_invert18872254
Ref: 516c18872254
Ref: c-api/typeobj c PyNumberMethods nb_lshift18872256
Ref: 563118872256
Ref: c-api/typeobj c Py_nb_lshift18872463
Ref: 516d18872463
Ref: c-api/typeobj c PyNumberMethods nb_rshift18872465
Ref: 563318872465
Ref: c-api/typeobj c Py_nb_rshift18872672
Ref: 517518872672
Ref: c-api/typeobj c PyNumberMethods nb_and18872674
Ref: 563518872674
Ref: c-api/typeobj c Py_nb_and18872875
Ref: 515818872875
Ref: c-api/typeobj c PyNumberMethods nb_xor18872877
Ref: 563718872877
Ref: c-api/typeobj c Py_nb_xor18873078
Ref: 517818873078
Ref: c-api/typeobj c PyNumberMethods nb_or18873080
Ref: 563918873080
Ref: c-api/typeobj c Py_nb_or18873279
Ref: 517118873279
Ref: c-api/typeobj c PyNumberMethods nb_int18873281
Ref: 563b18873281
Ref: c-api/typeobj c Py_nb_int18873481
Ref: 516b18873481
Ref: c-api/typeobj c PyNumberMethods nb_reserved18873483
Ref: 563c18873483
Ref: c-api/typeobj c PyNumberMethods nb_float18873556
Ref: 563d18873556
Ref: c-api/typeobj c Py_nb_float18873760
Ref: 515b18873760
Ref: c-api/typeobj c PyNumberMethods nb_inplace_add18873762
Ref: 562218873762
Ref: c-api/typeobj c Py_nb_inplace_add18873979
Ref: 515e18873979
Ref: c-api/typeobj c PyNumberMethods nb_inplace_subtract18873981
Ref: 562418873981
Ref: c-api/typeobj c Py_nb_inplace_subtract18874208
Ref: 516818874208
Ref: c-api/typeobj c PyNumberMethods nb_inplace_multiply18874210
Ref: 562618874210
Ref: c-api/typeobj c Py_nb_inplace_multiply18874437
Ref: 516318874437
Ref: c-api/typeobj c PyNumberMethods nb_inplace_remainder18874439
Ref: 562818874439
Ref: c-api/typeobj c Py_nb_inplace_remainder18874668
Ref: 516618874668
Ref: c-api/typeobj c PyNumberMethods nb_inplace_power18874670
Ref: 562b18874670
Ref: c-api/typeobj c Py_nb_inplace_power18874892
Ref: 516518874892
Ref: c-api/typeobj c PyNumberMethods nb_inplace_lshift18874894
Ref: 563218874894
Ref: c-api/typeobj c Py_nb_inplace_lshift18875117
Ref: 516118875117
Ref: c-api/typeobj c PyNumberMethods nb_inplace_rshift18875119
Ref: 563418875119
Ref: c-api/typeobj c Py_nb_inplace_rshift18875342
Ref: 516718875342
Ref: c-api/typeobj c PyNumberMethods nb_inplace_and18875344
Ref: 563618875344
Ref: c-api/typeobj c Py_nb_inplace_and18875561
Ref: 515f18875561
Ref: c-api/typeobj c PyNumberMethods nb_inplace_xor18875563
Ref: 563818875563
Ref: c-api/typeobj c Py_nb_inplace_xor18875780
Ref: 516a18875780
Ref: c-api/typeobj c PyNumberMethods nb_inplace_or18875782
Ref: 563a18875782
Ref: c-api/typeobj c Py_nb_inplace_or18875997
Ref: 516418875997
Ref: c-api/typeobj c PyNumberMethods nb_floor_divide18875999
Ref: 563e18875999
Ref: c-api/typeobj c Py_nb_floor_divide18876218
Ref: 515c18876218
Ref: c-api/typeobj c PyNumberMethods nb_true_divide18876220
Ref: 564018876220
Ref: c-api/typeobj c Py_nb_true_divide18876437
Ref: 517718876437
Ref: c-api/typeobj c PyNumberMethods nb_inplace_floor_divide18876439
Ref: 563f18876439
Ref: c-api/typeobj c Py_nb_inplace_floor_divide18876675
Ref: 516018876675
Ref: c-api/typeobj c PyNumberMethods nb_inplace_true_divide18876676
Ref: 564118876676
Ref: c-api/typeobj c Py_nb_inplace_true_divide18876910
Ref: 516918876910
Ref: c-api/typeobj c PyNumberMethods nb_index18876911
Ref: 163618876911
Ref: c-api/typeobj c Py_nb_index18877115
Ref: 515d18877115
Ref: c-api/typeobj c PyNumberMethods nb_matrix_multiply18877117
Ref: 564218877117
Ref: c-api/typeobj c Py_nb_matrix_multiply18877372
Ref: 516e18877372
Ref: c-api/typeobj c PyNumberMethods nb_inplace_matrix_multiply18877374
Ref: 564318877374
Ref: c-api/typeobj c Py_nb_inplace_matrix_multiply18877650
Ref: 516218877650
Node: マップオブジェクト構造体18877652
Ref: c-api/typeobj mapping-object-structures18877840
Ref: 566518877840
Ref: c-api/typeobj mapping-structs18877840
Ref: 565518877840
Ref: c-api/typeobj c PyMappingMethods18877923
Ref: 4ef518877923
Ref: c-api/typeobj c PyMappingMethods mp_length18878165
Ref: 564418878165
Ref: c-api/typeobj c Py_mp_length18878370
Ref: 515418878370
Ref: c-api/typeobj c PyMappingMethods mp_subscript18878697
Ref: 1cf618878697
Ref: c-api/typeobj c Py_mp_subscript18878911
Ref: 515518878911
Ref: c-api/typeobj c PyMappingMethods mp_ass_subscript18879286
Ref: 564518879286
Ref: c-api/typeobj c Py_mp_ass_subscript18879511
Ref: 515318879511
Node: シーケンスオブジェクト構造体18879907
Ref: c-api/typeobj sequence-object-structures18880125
Ref: 566618880125
Ref: c-api/typeobj sequence-structs18880125
Ref: 565418880125
Ref: c-api/typeobj c PySequenceMethods18880218
Ref: 4ef418880218
Ref: c-api/typeobj c PySequenceMethods sq_length18880419
Ref: 52eb18880419
Ref: c-api/typeobj c Py_sq_length18880625
Ref: 517f18880625
Ref: c-api/typeobj c PySequenceMethods sq_concat18880881
Ref: 564618880881
Ref: c-api/typeobj c Py_sq_concat18881090
Ref: 517a18881090
Ref: c-api/typeobj c PySequenceMethods sq_repeat18881352
Ref: 564718881352
Ref: c-api/typeobj c Py_sq_repeat18881563
Ref: 518018881563
Ref: c-api/typeobj c PySequenceMethods sq_item18881829
Ref: 1cf518881829
Ref: c-api/typeobj c Py_sq_item18882036
Ref: 517e18882036
Ref: c-api/typeobj c PySequenceMethods sq_ass_item18882706
Ref: 564818882706
Ref: c-api/typeobj c Py_sq_ass_item18882924
Ref: 517918882924
Ref: c-api/typeobj c PySequenceMethods sq_contains18883319
Ref: 564918883319
Ref: c-api/typeobj c Py_sq_contains18883532
Ref: 517b18883532
Ref: c-api/typeobj c PySequenceMethods sq_inplace_concat18883874
Ref: 564a18883874
Ref: c-api/typeobj c Py_sq_inplace_concat18884099
Ref: 517c18884099
Ref: c-api/typeobj c PySequenceMethods sq_inplace_repeat18884553
Ref: 564b18884553
Ref: c-api/typeobj c Py_sq_inplace_repeat18884780
Ref: 517d18884780
Node: バッファオブジェクト構造体 buffer object structure18885245
Ref: c-api/typeobj buffer-object-structures18885460
Ref: 566718885460
Ref: c-api/typeobj buffer-structs18885460
Ref: 124818885460
Ref: c-api/typeobj c PyBufferProcs18885600
Ref: 52f118885600
Ref: c-api/typeobj c PyBufferProcs bf_getbuffer18885972
Ref: 96618885972
Ref: c-api/typeobj c Py_bf_getbuffer18886217
Ref: 514f18886217
Ref: c-api/typeobj c PyBufferProcs bf_releasebuffer18888722
Ref: 96718888722
Ref: c-api/typeobj c Py_bf_releasebuffer18888979
Ref: 515018888979
Node: async オブジェクト構造体18890500
Ref: c-api/typeobj async-object-structures18890691
Ref: 566818890691
Ref: c-api/typeobj async-structs18890691
Ref: 565218890691
Ref: c-api/typeobj c PyAsyncMethods18890794
Ref: 52ea18890794
Ref: c-api/typeobj c PyAsyncMethods am_await18891283
Ref: 561d18891283
Ref: c-api/typeobj c Py_am_await18891516
Ref: 514d18891516
Ref: c-api/typeobj c PyAsyncMethods am_aiter18891994
Ref: 561e18891994
Ref: c-api/typeobj c Py_am_aiter18892227
Ref: 514b18892227
Ref: c-api/typeobj c PyAsyncMethods am_anext18892609
Ref: 561f18892609
Ref: c-api/typeobj c Py_am_anext18892842
Ref: 514c18892842
Ref: c-api/typeobj c PyAsyncMethods am_send18893089
Ref: 562018893089
Ref: c-api/typeobj c Py_am_send18893320
Ref: 514e18893320
Node: Slot Type typedefs18893587
Ref: c-api/typeobj id618893728
Ref: 564d18893728
Ref: c-api/typeobj slot-type-typedefs18893728
Ref: 566918893728
Ref: c-api/typeobj c allocfunc18893787
Ref: 519f18893787
Ref: c-api/typeobj c destructor18894974
Ref: 51a318894974
Ref: c-api/typeobj c freefunc18895099
Ref: 544918895099
Ref: c-api/typeobj c newfunc18895213
Ref: 51ae18895213
Ref: c-api/typeobj c initproc18895479
Ref: 51aa18895479
Ref: c-api/typeobj c reprfunc18895715
Ref: 51b218895715
Ref: c-api/typeobj c getattrfunc18895924
Ref: 51a418895924
Ref: c-api/typeobj c setattrfunc18896153
Ref: 51b418896153
Ref: c-api/typeobj c getattrofunc18896487
Ref: 51a518896487
Ref: c-api/typeobj c setattrofunc18896795
Ref: 51b518896795
Ref: c-api/typeobj c descrgetfunc18897218
Ref: 51a118897218
Ref: c-api/typeobj c descrsetfunc18897481
Ref: 51a218897481
Ref: c-api/typeobj c hashfunc18897726
Ref: 51a918897726
Ref: c-api/typeobj c richcmpfunc18897936
Ref: 51b318897936
Ref: c-api/typeobj c getiterfunc18898182
Ref: 51a718898182
Ref: c-api/typeobj c iternextfunc18898394
Ref: 51ac18898394
Ref: c-api/typeobj c lenfunc18898611
Ref: 51ad18898611
Ref: c-api/typeobj c getbufferproc18898761
Ref: 51a618898761
Ref: c-api/typeobj c releasebufferproc18898958
Ref: 51b118898958
Ref: c-api/typeobj c unaryfunc18899155
Ref: 51bb18899155
Ref: c-api/typeobj c binaryfunc18899306
Ref: 51a018899306
Ref: c-api/typeobj c sendfunc18899481
Ref: 562118899481
Ref: c-api/typeobj c ternaryfunc18899699
Ref: 51b918899699
Ref: c-api/typeobj c ssizeargfunc18899898
Ref: 51b718899898
Ref: c-api/typeobj c ssizeobjargproc18900076
Ref: 51b818900076
Ref: c-api/typeobj c objobjproc18900261
Ref: 51b018900261
Ref: c-api/typeobj c objobjargproc18900418
Ref: 51af18900418
Node: 使用例<57>18900601
Ref: c-api/typeobj examples18900700
Ref: 566a18900700
Ref: c-api/typeobj typedef-examples18900700
Ref: 560e18900700
Node: 循環参照ガベージコレクションをサポートする18906327
Ref: c-api/gcsupport doc18906524
Ref: 566b18906524
Ref: c-api/gcsupport supporting-cycle-detection18906524
Ref: 565618906524
Ref: c-api/gcsupport supporting-cyclic-garbage-collection18906524
Ref: 566c18906524
Ref: c-api/gcsupport translation-repo18906524
Ref: 566d18906524
Ref: c-api/gcsupport c PyObject_GC_New18909460
Ref: c9918909460
Ref: c-api/gcsupport c PyObject_GC_NewVar18910267
Ref: c9a18910267
Ref: c-api/gcsupport c PyUnstable_Object_GC_NewWithExtraData18911089
Ref: 1aa818911089
Ref: c-api/gcsupport c PyObject_GC_Resize18912328
Ref: 1aad18912328
Ref: c-api/gcsupport c PyObject_GC_Track18912718
Ref: 171d18912718
Ref: c-api/gcsupport c PyObject_IS_GC18913329
Ref: b7b18913329
Ref: c-api/gcsupport c PyObject_GC_IsTracked18913581
Ref: b6d18913581
Ref: c-api/gcsupport c PyObject_GC_IsFinalized18913987
Ref: b6e18913987
Ref: c-api/gcsupport c PyObject_GC_Del18914396
Ref: 171c18914396
Ref: c-api/gcsupport c PyObject_GC_UnTrack18915187
Ref: 171e18915187
Ref: c-api/gcsupport c visitproc18916109
Ref: 51bc18916109
Ref: c-api/gcsupport c traverseproc18916909
Ref: 51ba18916909
Ref: c-api/gcsupport c Py_VISIT18918259
Ref: 4ed918918259
Ref: c-api/gcsupport c inquiry18918920
Ref: 51ab18918920
Node: Controlling the Garbage Collector State18919794
Ref: c-api/gcsupport controlling-the-garbage-collector-state18919974
Ref: 566e18919974
Ref: c-api/gcsupport c PyGC_Collect18920158
Ref: b8518920158
Ref: c-api/gcsupport c PyGC_Enable18920734
Ref: aa418920734
Ref: c-api/gcsupport c PyGC_Disable18921024
Ref: aa518921024
Ref: c-api/gcsupport c PyGC_IsEnabled18921317
Ref: aa618921317
Node: Querying Garbage Collector State18921630
Ref: c-api/gcsupport querying-garbage-collector-state18921810
Ref: 566f18921810
Ref: c-api/gcsupport c PyUnstable_GC_VisitObjects18921993
Ref: 567018921993
Ref: c-api/gcsupport c gcvisitobjects_t18922845
Ref: 567118922845
Node: API と ABI のバージョニング18923343
Ref: c-api/apiabiversion doc18923562
Ref: 567218923562
Ref: c-api/apiabiversion api-and-abi-versioning18923562
Ref: 567318923562
Ref: c-api/apiabiversion apiabiversion18923562
Ref: 492218923562
Ref: c-api/apiabiversion translation-repo18923562
Ref: 567418923562
Node: Build-time version constants18923725
Ref: c-api/apiabiversion build-time-version-constants18923851
Ref: 567518923851
Ref: c-api/apiabiversion c PY_MAJOR_VERSION18924239
Ref: 567618924239
Ref: c-api/apiabiversion c PY_MINOR_VERSION18924313
Ref: 567718924313
Ref: c-api/apiabiversion c PY_MICRO_VERSION18924387
Ref: 567818924387
Ref: c-api/apiabiversion c PY_RELEASE_LEVEL18924461
Ref: 567918924461
Ref: c-api/apiabiversion c PY_RELEASE_SERIAL18924684
Ref: 567a18924684
Ref: c-api/apiabiversion c PY_VERSION_HEX18924804
Ref: 38218924804
Ref: Build-time version constants-Footnote-118925153
Node: Run-time version18925226
Ref: c-api/apiabiversion run-time-version18925379
Ref: 567b18925379
Ref: c-api/apiabiversion c Py_Version18925428
Ref: 38118925428
Node: Bit-packing macros18925878
Ref: c-api/apiabiversion bit-packing-macros18925994
Ref: 567c18925994
Ref: c-api/apiabiversion c Py_PACK_FULL_VERSION18926047
Ref: 38018926047
Ref: c-api/apiabiversion c Py_PACK_VERSION18929706
Ref: 37f18929706
Node: Monitoring C API18930056
Ref: c-api/monitoring doc18930236
Ref: 567d18930236
Ref: c-api/monitoring c-api-monitoring18930236
Ref: 48518930236
Ref: c-api/monitoring monitoring-c-api18930236
Ref: 567e18930236
Ref: c-api/monitoring translation-repo18930236
Ref: 567f18930236
Node: Generating Execution Events18930490
Ref: c-api/monitoring generating-execution-events18930625
Ref: 568018930625
Ref: c-api/monitoring c PyMonitoringState18931560
Ref: 5be18931560
Ref: c-api/monitoring c PyMonitoring_FirePyStartEvent18931933
Ref: 5bf18931933
Ref: c-api/monitoring c PyMonitoring_FirePyResumeEvent18932093
Ref: 5c018932093
Ref: c-api/monitoring c PyMonitoring_FirePyReturnEvent18932255
Ref: 5c118932255
Ref: c-api/monitoring c PyMonitoring_FirePyYieldEvent18932435
Ref: 5c218932435
Ref: c-api/monitoring c PyMonitoring_FireCallEvent18932613
Ref: 5c318932613
Ref: c-api/monitoring c PyMonitoring_FireLineEvent18932812
Ref: 5c418932812
Ref: c-api/monitoring c PyMonitoring_FireJumpEvent18932977
Ref: 5c518932977
Ref: c-api/monitoring c PyMonitoring_FireBranchLeftEvent18933155
Ref: 3ad18933155
Ref: c-api/monitoring c PyMonitoring_FireBranchRightEvent18933356
Ref: 3ae18933356
Ref: c-api/monitoring c PyMonitoring_FireCReturnEvent18933559
Ref: 5c618933559
Ref: c-api/monitoring c PyMonitoring_FirePyThrowEvent18933737
Ref: 5c718933737
Ref: c-api/monitoring c PyMonitoring_FireRaiseEvent18933985
Ref: 5c818933985
Ref: c-api/monitoring c PyMonitoring_FireCRaiseEvent18934228
Ref: 5c918934228
Ref: c-api/monitoring c PyMonitoring_FireReraiseEvent18934474
Ref: 5ca18934474
Ref: c-api/monitoring c PyMonitoring_FireExceptionHandledEvent18934721
Ref: 5cb18934721
Ref: c-api/monitoring c PyMonitoring_FirePyUnwindEvent18934988
Ref: 5cc18934988
Ref: c-api/monitoring c PyMonitoring_FireStopIterationEvent18935238
Ref: 5cd18935238
Node: Managing the Monitoring State18935656
Ref: c-api/monitoring managing-the-monitoring-state18935749
Ref: 568118935749
Ref: c-api/monitoring c PyMonitoring_EnterScope18935952
Ref: 5ce18935952
Ref: c-api/monitoring c PY_MONITORING_EVENT_BRANCH_LEFT18938014
Ref: 568218938014
Ref: c-api/monitoring c PY_MONITORING_EVENT_BRANCH_RIGHT18938225
Ref: 568318938225
Ref: c-api/monitoring c PY_MONITORING_EVENT_CALL18938428
Ref: 568418938428
Ref: c-api/monitoring c PY_MONITORING_EVENT_C_RAISE18938635
Ref: 568518938635
Ref: c-api/monitoring c PY_MONITORING_EVENT_C_RETURN18938843
Ref: 568618938843
Ref: c-api/monitoring c PY_MONITORING_EVENT_EXCEPTION_HANDLED18939022
Ref: 568718939022
Ref: c-api/monitoring c PY_MONITORING_EVENT_INSTRUCTION18939211
Ref: 568818939211
Ref: c-api/monitoring c PY_MONITORING_EVENT_JUMP18939415
Ref: 568918939415
Ref: c-api/monitoring c PY_MONITORING_EVENT_LINE18939619
Ref: 568a18939619
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_RESUME18939828
Ref: 568b18939828
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_RETURN18940037
Ref: 568c18940037
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_START18940245
Ref: 568d18940245
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_THROW18940453
Ref: 568e18940453
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_UNWIND18940662
Ref: 568f18940662
Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_YIELD18940870
Ref: 569018940870
Ref: c-api/monitoring c PY_MONITORING_EVENT_RAISE18941075
Ref: 569118941075
Ref: c-api/monitoring c PY_MONITORING_EVENT_RERAISE18941282
Ref: 569218941282
Ref: c-api/monitoring c PY_MONITORING_EVENT_STOP_ITERATION18941496
Ref: 569318941496
Ref: c-api/monitoring c PyMonitoring_ExitScope18941591
Ref: 5cf18941591
Ref: c-api/monitoring c PY_MONITORING_IS_INSTRUMENTED_EVENT18941729
Ref: 569418941729
Node: Python モジュールのインストール18942021
Ref: installing/index doc18942180
Ref: 569518942180
Ref: installing/index installing-index18942180
Ref: 10f818942180
Ref: installing/index installing-python-modules18942180
Ref: 569618942180
Ref: installing/index translation-repo18942180
Ref: 569718942180
Ref: Python モジュールのインストール-Footnote-118943929
Node: 重要用語集18944007
Ref: installing/index key-terms18944135
Ref: 569818944135
Ref: 重要用語集-Footnote-118946922
Ref: 重要用語集-Footnote-218946947
Ref: 重要用語集-Footnote-318946976
Ref: 重要用語集-Footnote-418947008
Node: 基本的な使い方<5>18947088
Ref: installing/index basic-usage18947253
Ref: 569918947253
Ref: 基本的な使い方<5>-Footnote-118949262
Ref: 基本的な使い方<5>-Footnote-218949299
Node: どうすればいいの ？18949348
Ref: installing/index how-do-i18949546
Ref: 569a18949546
Node: pip を 3 4 より前のバージョンの Python でインストールするには？18950434
Ref: installing/index install-pip-in-versions-of-python-prior-to-python-3-418950675
Ref: 569b18950675
Ref: pip を 3 4 より前のバージョンの Python でインストールするには？-Footnote-118951196
Node: パッケージを現在のユーザ用のみにインストールするには？18951283
Ref: installing/index install-packages-just-for-the-current-user18951616
Ref: 569c18951616
Node: 科学技術計算用の Python パッケージをインストールするには？18952003
Ref: installing/index install-scientific-python-packages18952342
Ref: 569d18952342
Ref: 科学技術計算用の Python パッケージをインストールするには？-Footnote-118953040
Ref: 科学技術計算用の Python パッケージをインストールするには？-Footnote-218953086
Node: インストールされた複数のバージョンの Python を並行して使うには？18953132
Ref: installing/index work-with-multiple-versions-of-python-installed-in-parallel18953381
Ref: 569e18953381
Node: よくあるインストールに関する問題18954550
Ref: installing/index common-installation-issues18954715
Ref: 569f18954715
Node: Linux で、システムの Python 内にインストールする18954981
Ref: installing/index installing-into-the-system-python-on-linux18955183
Ref: 56a018955183
Node: pip がインストールされていない18956092
Ref: installing/index pip-not-installed18956345
Ref: 56a118956345
Ref: pip がインストールされていない-Footnote-118956739
Node: バイナリの拡張のインストール18956865
Ref: installing/index installing-binary-extensions18957044
Ref: 56a218957044
Ref: バイナリの拡張のインストール-Footnote-118958219
Ref: バイナリの拡張のインストール-Footnote-218958265
Node: Python HOWTO18958314
Ref: howto/index doc18958452
Ref: 56a318958452
Ref: howto/index how-tos18958452
Ref: 56a418958452
Ref: howto/index python-howtos18958452
Ref: 56a518958452
Ref: howto/index translation-repo18958452
Ref: 56a618958452
Node: A Conceptual Overview of asyncio18959915
Ref: howto/a-conceptual-overview-of-asyncio doc18960047
Ref: 56a718960047
Ref: howto/a-conceptual-overview-of-asyncio a-conceptual-overview-of-asyncio18960047
Ref: 37b718960047
Ref: howto/a-conceptual-overview-of-asyncio id118960047
Ref: 56a818960047
Ref: A Conceptual Overview of asyncio-Footnote-118961413
Ref: A Conceptual Overview of asyncio-Footnote-218961494
Ref: A Conceptual Overview of asyncio-Footnote-318961587
Node: A conceptual overview part 1 the high-level18961668
Ref: howto/a-conceptual-overview-of-asyncio a-conceptual-overview-part-1-the-high-level18961836
Ref: 56a918961836
Node: イベントループ<2>18962228
Ref: howto/a-conceptual-overview-of-asyncio event-loop18962378
Ref: 56aa18962378
Node: Asynchronous functions and coroutines18963991
Ref: howto/a-conceptual-overview-of-asyncio asynchronous-functions-and-coroutines18964157
Ref: 56ab18964157
Node: Task<2>18967079
Ref: howto/a-conceptual-overview-of-asyncio tasks18967226
Ref: 56ac18967226
Node: await18970150
Ref: howto/a-conceptual-overview-of-asyncio await18970251
Ref: 56ad18970251
Node: A conceptual overview part 2 the nuts and bolts18974421
Ref: howto/a-conceptual-overview-of-asyncio a-conceptual-overview-part-2-the-nuts-and-bolts18974589
Ref: 56ae18974589
Node: The inner workings of coroutines18975075
Ref: howto/a-conceptual-overview-of-asyncio the-inner-workings-of-coroutines18975209
Ref: 56af18975209
Node: Future<2>18978860
Ref: howto/a-conceptual-overview-of-asyncio futures18979027
Ref: 56b018979027
Node: A homemade asyncio sleep18980282
Ref: howto/a-conceptual-overview-of-asyncio a-homemade-asyncio-sleep18980408
Ref: 56b118980408
Node: Python 3 への拡張モジュール移植18985014
Ref: howto/cporting doc18985194
Ref: 56b218985194
Ref: howto/cporting cporting-howto18985194
Ref: 14f818985194
Ref: howto/cporting porting-extension-modules-to-python-318985194
Ref: 56b318985194
Ref: howto/cporting translation-repo18985194
Ref: 56b418985194
Ref: Python 3 への拡張モジュール移植-Footnote-118986023
Ref: Python 3 への拡張モジュール移植-Footnote-218986074
Node: Python で Curses プログラミング18986131
Ref: howto/curses doc18986307
Ref: 56b518986307
Ref: howto/curses curses-howto18986307
Ref: 345f18986307
Ref: howto/curses curses-programming-with-python18986307
Ref: 56b618986307
Ref: howto/curses translation-repo18986307
Ref: 56b718986307
Node: curses ってなに?18986822
Ref: howto/curses what-is-curses18986976
Ref: 56b818986976
Ref: curses ってなに?-Footnote-118989933
Ref: curses ってなに?-Footnote-218989973
Node: Python の curses module18990017
Ref: howto/curses the-python-curses-module18990098
Ref: 56b918990098
Node: curses アプリケーションの起動と終了18991067
Ref: howto/curses starting-and-ending-a-curses-application18991257
Ref: 56ba18991257
Node: ウィンドウとパッド18994954
Ref: howto/curses windows-and-pads18995145
Ref: 56bb18995145
Node: テキストの表示18999779
Ref: howto/curses displaying-text18999936
Ref: 56bc18999936
Node: 属性とカラー19004038
Ref: howto/curses attributes-and-color19004114
Ref: 56bd19004114
Node: ユーザ入力19009018
Ref: howto/curses user-input19009169
Ref: 56be19009169
Ref: ユーザ入力-Footnote-119013058
Node: より多くの情報19013098
Ref: howto/curses for-more-information19013219
Ref: 56bf19013219
Ref: より多くの情報-Footnote-119014831
Ref: より多くの情報-Footnote-219014868
Ref: より多くの情報-Footnote-319014932
Ref: より多くの情報-Footnote-419014976
Ref: より多くの情報-Footnote-519015038
Ref: より多くの情報-Footnote-619015090
Node: デスクリプタ ガイド19015161
Ref: howto/descriptor doc19015352
Ref: 56c019015352
Ref: howto/descriptor descriptor-guide19015352
Ref: 56c119015352
Ref: howto/descriptor descriptorhowto19015352
Ref: 170619015352
Ref: howto/descriptor translation-repo19015352
Ref: 56c219015352
Node: 入門19017059
Ref: howto/descriptor primer19017163
Ref: 56c319017163
Node: シンプルな例 定数を返すデスクリプタ19017545
Ref: howto/descriptor simple-example-a-descriptor-that-returns-a-constant19017676
Ref: 56c419017676
Node: 動的なルックアップ19019462
Ref: howto/descriptor dynamic-lookups19019623
Ref: 56c519019623
Node: 管理された属性19021140
Ref: howto/descriptor managed-attributes19021276
Ref: 56c619021276
Node: 名前のカスタマイズ19024188
Ref: howto/descriptor customized-names19024306
Ref: 56c719024306
Node: まとめ19026788
Ref: howto/descriptor closing-thoughts19026876
Ref: 56c819026876
Node: 実践的なサンプル19028777
Ref: howto/descriptor complete-practical-example19028923
Ref: 56c919028923
Node: バリデータクラス19029264
Ref: howto/descriptor validator-class19029385
Ref: 56ca19029385
Node: カスタムバリデータ19030508
Ref: howto/descriptor custom-validators19030674
Ref: 56cb19030674
Ref: カスタムバリデータ-Footnote-119033377
Node: 実践的なアプリケーション19033446
Ref: howto/descriptor practical-application19033579
Ref: 56cc19033579
Node: 技術的なチュートリアル19035064
Ref: howto/descriptor technical-tutorial19035234
Ref: 56cd19035234
Node: 概要<5>19035796
Ref: howto/descriptor abstract19035899
Ref: 56ce19035899
Node: 定義と導入19036348
Ref: howto/descriptor definition-and-introduction19036493
Ref: 56cf19036493
Node: デスクリプタプロトコル19037880
Ref: howto/descriptor descriptor-protocol19038055
Ref: 56d019038055
Node: デスクリプタ呼び出しの概要19039542
Ref: howto/descriptor overview-of-descriptor-invocation19039741
Ref: 56d119039741
Node: インスタンスからの呼び出し19040501
Ref: howto/descriptor invocation-from-an-instance19040697
Ref: 56d219040697
Node: クラスからの呼び出し19043354
Ref: howto/descriptor invocation-from-a-class19043537
Ref: 56d319043537
Ref: クラスからの呼び出し-Footnote-119044203
Node: superからの呼び出し19044276
Ref: howto/descriptor invocation-from-super19044456
Ref: 56d419044456
Ref: superからの呼び出し-Footnote-119045218
Ref: superからの呼び出し-Footnote-219045291
Node: 呼び出しロジックのまとめ19045371
Ref: howto/descriptor summary-of-invocation-logic19045548
Ref: 56d519045548
Node: 自動的の名前の伝達19046662
Ref: howto/descriptor automatic-name-notification19046831
Ref: 56d619046831
Ref: 自動的の名前の伝達-Footnote-119047728
Node: ORMのサンプル19047801
Ref: howto/descriptor orm-example19047925
Ref: 56d719047925
Ref: ORMのサンプル-Footnote-119050154
Ref: ORMのサンプル-Footnote-219050226
Node: ピュアPythonの等価実装19050279
Ref: howto/descriptor pure-python-equivalents19050416
Ref: 56d819050416
Node: プロパティ19051047
Ref: howto/descriptor properties19051159
Ref: 56d919051159
Node: 関数とメソッド19054285
Ref: howto/descriptor functions-and-methods19054427
Ref: 56da19054427
Node: メソッドの種類19058058
Ref: howto/descriptor kinds-of-methods19058203
Ref: 56db19058203
Node: 静的メソッド19059610
Ref: howto/descriptor static-methods19059755
Ref: 56dc19059755
Node: クラスメソッド19062025
Ref: howto/descriptor class-methods19062192
Ref: 56dd19062192
Node: メンバーオブジェクトと __slots__19064516
Ref: howto/descriptor member-objects-and-slots19064656
Ref: 56de19064656
Ref: メンバーオブジェクトと __slots__-Footnote-119072643
Node: Debugging C API extensions and CPython Internals with GDB19072699
Ref: howto/gdb_helpers doc19072866
Ref: 56df19072866
Ref: howto/gdb_helpers debugging-c-api-extensions-and-cpython-internals-with-gdb19072866
Ref: 56e019072866
Ref: howto/gdb_helpers gdb19072866
Ref: 56e119072866
Ref: howto/gdb_helpers translation-repo19072866
Ref: 56e219072866
Ref: Debugging C API extensions and CPython Internals with GDB-Footnote-119074268
Ref: Debugging C API extensions and CPython Internals with GDB-Footnote-219074304
Node: Prerequisites19074358
Ref: howto/gdb_helpers prerequisites19074516
Ref: 56e319074516
Node: Setup with Python built from source19075157
Ref: howto/gdb_helpers setup-with-python-built-from-source19075287
Ref: 56e419075287
Node: Setup for Python from a Linux distro19076054
Ref: howto/gdb_helpers setup-for-python-from-a-linux-distro19076184
Ref: 56e519076184
Node: Using the Debug build and Development mode19076832
Ref: howto/gdb_helpers using-the-debug-build-and-development-mode19077029
Ref: 56e619077029
Node: Using the python-gdb extension19077633
Ref: howto/gdb_helpers using-the-python-gdb-extension19077838
Ref: 56e719077838
Node: Pretty-printers19078144
Ref: howto/gdb_helpers pretty-printers19078242
Ref: 56e819078242
Node: py-list19082767
Ref: howto/gdb_helpers py-list19082891
Ref: 56e919082891
Node: py-up and py-down19083779
Ref: howto/gdb_helpers py-up-and-py-down19083893
Ref: 56ea19083893
Node: py-bt19088608
Ref: howto/gdb_helpers py-bt19088723
Ref: 56eb19088723
Node: py-print19090974
Ref: howto/gdb_helpers py-print19091081
Ref: 56ec19091081
Node: py-locals19091830
Ref: howto/gdb_helpers py-locals19091923
Ref: 56ed19091923
Node: Use with GDB commands19092826
Ref: howto/gdb_helpers use-with-gdb-commands19092980
Ref: 56ee19092980
Node: 列挙型 HOWTO19098999
Ref: howto/enum doc19099174
Ref: 56ef19099174
Ref: howto/enum enum-howto19099174
Ref: 56f019099174
Ref: howto/enum id119099174
Ref: 56f119099174
Ref: howto/enum translation-repo19099174
Ref: 56f219099174
Ref: howto/enum enum-basic-tutorial19099212
Ref: 2a2619099212
Node: 列挙型メンバーおよびそれらの属性へのプログラム的アクセス19105750
Ref: howto/enum enum-advanced-tutorial19105931
Ref: 2a2719105931
Ref: howto/enum programmatic-access-to-enumeration-members-and-their-attributes19105931
Ref: 56f319105931
Node: 列挙型メンバーと値の重複19106849
Ref: howto/enum duplicating-enum-members-and-values19107090
Ref: 56f419107090
Node: 番号付けの値が一意であることの確認19108473
Ref: howto/enum ensuring-unique-enumeration-values19108657
Ref: 56f519108657
Node: 値の自動設定を使う19109281
Ref: howto/enum using-automatic-values19109453
Ref: 56f619109453
Node: イテレーション<2>19110403
Ref: howto/enum iteration19110533
Ref: 56f719110533
Node: 比較<3>19112042
Ref: howto/enum comparisons19112190
Ref: 56f819112190
Node: 列挙型で許されるメンバーと属性19113486
Ref: howto/enum allowed-members-and-attributes-of-enumerations19113644
Ref: 56fa19113644
Node: Enumのサブクラス化の制限19115944
Ref: howto/enum restricted-enum-subclassing19116126
Ref: 56fe19116126
Node: データクラスのサポート19117516
Ref: howto/enum dataclass-support19117663
Ref: 570019117663
Ref: howto/enum enum-dataclass-support19117663
Ref: 1af919117663
Node: Pickle 化19119229
Ref: howto/enum pickling19119355
Ref: 570119119355
Node: 関数 API<2>19120504
Ref: howto/enum functional-api19120612
Ref: 56fb19120612
Node: 派生列挙型19124532
Ref: howto/enum derived-enumerations19124661
Ref: 570219124661
Node: IntEnum19124785
Ref: howto/enum intenum19124860
Ref: 56f919124860
Node: StrEnum19126029
Ref: howto/enum strenum19126120
Ref: 570319126120
Node: IntFlag19126468
Ref: howto/enum intflag19126556
Ref: 570419126556
Node: Flag19129384
Ref: howto/enum flag19129477
Ref: 570519129477
Node: その他<6>19132141
Ref: howto/enum others19132218
Ref: 570619132218
Node: When to use __new__ vs __init__19134570
Ref: howto/enum new-vs-init19134721
Ref: 56fd19134721
Ref: howto/enum when-to-use-new-vs-init19134721
Ref: 570719134721
Node: 細かい点19136057
Ref: howto/enum finer-points19136137
Ref: 570819136137
Node: __dunder__ 名のサポート<2>19136580
Ref: howto/enum supported-dunder-names19136700
Ref: 570919136700
Node: _sunder_ 名のサポート<2>19137133
Ref: howto/enum supported-sunder-names19137277
Ref: 570a19137277
Node: _Private__names19139596
Ref: howto/enum private-names19139728
Ref: 570c19139728
Node: Enum メンバー型19139923
Ref: howto/enum enum-member-type19140078
Ref: 570d19140078
Node: Creating members that are mixed with other data types19140544
Ref: howto/enum creating-members-that-are-mixed-with-other-data-types19140725
Ref: 570e19140725
Node: Enum クラスとメンバーの真偽値19141258
Ref: howto/enum boolean-value-of-enum-classes-and-members19141455
Ref: 570f19141455
Node: メソッド付きの Enum クラス19142129
Ref: howto/enum enum-classes-with-methods19142311
Ref: 571019142311
Node: Flag のメンバーの組み合わせ19142950
Ref: howto/enum combining-members-of-flag19143115
Ref: 571119143115
Node: Flag and IntFlag minutia19143692
Ref: howto/enum flag-and-intflag-minutia19143812
Ref: 571219143812
Node: EnumとFlagはどう違うのか？19146579
Ref: howto/enum enum-class-differences19146738
Ref: 2a2919146738
Ref: howto/enum how-are-enums-and-flags-different19146738
Ref: 571319146738
Node: Enum クラス19147155
Ref: howto/enum enum-classes19147264
Ref: 571419147264
Node: Flag クラス19147855
Ref: howto/enum flag-classes19148009
Ref: 571519148009
Node: Enum メンバー インスタンス19148376
Ref: howto/enum enum-members-aka-instances19148533
Ref: 571619148533
Node: Flag メンバー19148931
Ref: howto/enum flag-members19149065
Ref: 571719149065
Node: Enum クックブック19149774
Ref: howto/enum enum-cookbook19149938
Ref: 2a2819149938
Ref: howto/enum id219149938
Ref: 571819149938
Node: 値の省略19150485
Ref: howto/enum omitting-values19150577
Ref: 571919150577
Node: auto を使う19151485
Ref: howto/enum using-auto19151573
Ref: 571a19151573
Node: object を使う19151848
Ref: howto/enum using-object19151969
Ref: 571b19151969
Node: 解説文字列を使う19152645
Ref: howto/enum using-a-descriptive-string19152774
Ref: 571c19152774
Node: Using a custom __new__19153066
Ref: howto/enum using-a-custom-new19153170
Ref: 571d19153170
Node: OrderedEnum19155069
Ref: howto/enum orderedenum19155187
Ref: 56ff19155187
Node: DuplicateFreeEnum19156404
Ref: howto/enum duplicatefreeenum19156524
Ref: 571e19156524
Node: MultiValueEnum19157702
Ref: howto/enum multivalueenum19157817
Ref: 570b19157817
Node: Planet19158400
Ref: howto/enum planet19158508
Ref: 56fc19158508
Node: TimePeriod19159569
Ref: howto/enum enum-time-period19159654
Ref: 2a3f19159654
Ref: howto/enum timeperiod19159654
Ref: 571f19159654
Node: EnumType のサブクラスを作る19160276
Ref: howto/enum enumtype-examples19160396
Ref: 2a2f19160396
Ref: howto/enum subclassing-enumtype19160396
Ref: 572019160396
Node: 関数型プログラミング HOWTO19160683
Ref: howto/functional doc19160814
Ref: 572119160814
Ref: howto/functional functional-howto19160814
Ref: 572219160814
Ref: howto/functional functional-programming-howto19160814
Ref: 572319160814
Ref: howto/functional translation-repo19160814
Ref: 572419160814
Node: はじめに<15>19161844
Ref: howto/functional introduction19161969
Ref: 572519161969
Node: 形式的証明可能性19167987
Ref: howto/functional formal-provability19168091
Ref: 572719168091
Node: モジュラー性19170557
Ref: howto/functional modularity19170706
Ref: 572819170706
Node: デバッグやテストの簡単さ19171229
Ref: howto/functional ease-of-debugging-and-testing19171363
Ref: 572919171363
Node: 結合性19172332
Ref: howto/functional composability19172439
Ref: 572a19172439
Node: イテレータ iterator<2>19173293
Ref: howto/functional functional-howto-iterators19173472
Ref: 572619173472
Ref: howto/functional iterators19173472
Ref: 572b19173472
Node: イテレータ対応のデータ型19177778
Ref: howto/functional data-types-that-support-iterators19177878
Ref: 572c19177878
Node: ジェネレータ式とリスト内包表記19180243
Ref: howto/functional generator-expressions-and-list-comprehensions19180437
Ref: 572d19180437
Node: ジェネレータ generator<2>19185650
Ref: howto/functional generators19185856
Ref: 572e19185856
Ref: ジェネレータ generator<2>-Footnote-119190478
Node: ジェネレータに値を渡す19190559
Ref: howto/functional passing-values-into-a-generator19190660
Ref: 572f19190660
Ref: ジェネレータに値を渡す-Footnote-119195302
Node: 組み込み関数 built-in function<2>19195344
Ref: howto/functional built-in-functions19195530
Ref: 573019195530
Ref: 組み込み関数 built-in function<2>-Footnote-119200108
Ref: 組み込み関数 built-in function<2>-Footnote-219200162
Node: itertools モジュール19200238
Ref: howto/functional the-itertools-module19200418
Ref: 573119200418
Node: 新しいイテレータを作る19201286
Ref: howto/functional creating-new-iterators19201423
Ref: 573219201423
Node: 要素に対して関数を呼ぶ19204322
Ref: howto/functional calling-functions-on-elements19204489
Ref: 573319204489
Node: 要素を選択する19205407
Ref: howto/functional selecting-elements19205556
Ref: 573419205556
Node: 組合せ関数19207170
Ref: howto/functional combinatoric-functions19207319
Ref: 573519207319
Node: 要素をグループ分けする19209855
Ref: howto/functional grouping-elements19209974
Ref: 573619209974
Node: functools モジュール19211764
Ref: howto/functional the-functools-module19211935
Ref: 573719211935
Node: operator モジュール19216083
Ref: howto/functional the-operator-module19216169
Ref: 573819216169
Node: 小さな関数とラムダ式19217074
Ref: howto/functional small-functions-and-the-lambda-expression19217241
Ref: 573919217241
Node: 更新履歴と謝辞19220706
Ref: howto/functional revision-history-and-acknowledgements19220863
Ref: 573a19220863
Node: 参考資料<2>19221591
Ref: howto/functional references19221709
Ref: 573b19221709
Node: 一般論19221812
Ref: howto/functional general19221901
Ref: 573c19221901
Node: Python 特有の話19223108
Ref: howto/functional python-specific19223219
Ref: 573d19223219
Ref: Python 特有の話-Footnote-119223797
Ref: Python 特有の話-Footnote-219223848
Ref: Python 特有の話-Footnote-319223901
Node: Python 文書19223954
Ref: howto/functional python-documentation19224047
Ref: 573e19224047
Ref: Python 文書-Footnote-119224440
Ref: Python 文書-Footnote-219224482
Node: Logging HOWTO19224524
Ref: howto/logging doc19224666
Ref: 573f19224666
Ref: howto/logging id119224666
Ref: 574019224666
Ref: howto/logging logging-howto19224666
Ref: 574119224666
Ref: howto/logging translation-repo19224666
Ref: 574219224666
Ref: howto/logging logging-basic-tutorial19224759
Ref: 140e19224759
Node: 基本 logging チュートリアル19225270
Ref: howto/logging basic-logging-tutorial19225404
Ref: 574419225404
Node: logging を使うとき19226417
Ref: howto/logging when-to-use-logging19226537
Ref: 574519226537
Node: 簡単な例<2>19230853
Ref: howto/logging a-simple-example19231008
Ref: 574619231008
Ref: howto/logging howto-minimal-example19231008
Ref: 574719231008
Node: ファイルへの logging19232281
Ref: howto/logging logging-to-a-file19232443
Ref: 574819232443
Node: 変数データのロギング19236029
Ref: howto/logging logging-variable-data19236236
Ref: 574919236236
Node: 表示されるメッセージのフォーマットの変更19237335
Ref: howto/logging changing-the-format-of-displayed-messages19237564
Ref: 574a19237564
Node: メッセージ内での日付と時刻の表示19238740
Ref: howto/logging displaying-the-date-time-in-messages19238957
Ref: 574b19238957
Ref: メッセージ内での日付と時刻の表示-Footnote-119240202
Node: 次のステップ19240261
Ref: howto/logging next-steps19240409
Ref: 574c19240409
Ref: 次のステップ-Footnote-119241471
Node: 上級ロギングチュートリアル19241515
Ref: howto/logging advanced-logging-tutorial19241682
Ref: 574d19241682
Ref: howto/logging logging-advanced-tutorial19241682
Ref: 140f19241682
Node: Logging Flow19246244
Ref: howto/logging logging-flow19246350
Ref: 574e19246350
Node: ロガー19246545
Ref: howto/logging loggers19246672
Ref: 574f19246672
Node: ハンドラ19252249
Ref: howto/logging handler-basic19252382
Ref: 575019252382
Ref: howto/logging handlers19252382
Ref: 575119252382
Node: フォーマッタ19255145
Ref: howto/logging formatters19255296
Ref: 575319255296
Ref: howto/logging logging logging Formatter __init__19255991
Ref: 575419255991
Node: ロギングの環境設定19258234
Ref: howto/logging configuring-logging19258424
Ref: 575519258424
Node: 環境設定が与えられないとどうなるか19265649
Ref: howto/logging what-happens-if-no-configuration-is-provided19265869
Ref: 575619265869
Node: ライブラリのためのロギングの設定19267442
Ref: howto/logging configuring-logging-for-a-library19267626
Ref: 575719267626
Ref: howto/logging library-config19267626
Ref: 31d719267626
Node: ロギングレベル<2>19271373
Ref: howto/logging logging-levels19271525
Ref: 575819271525
Node: カスタムレベル19275154
Ref: howto/logging custom-levels19275236
Ref: 319f19275236
Ref: howto/logging id219275236
Ref: 575919275236
Node: 便利なハンドラ19275970
Ref: howto/logging id319276119
Ref: 575a19276119
Ref: howto/logging useful-handlers19276119
Ref: 575219276119
Node: ログ記録中に発生する例外19281658
Ref: howto/logging exceptions-raised-during-logging19281843
Ref: 575b19281843
Ref: howto/logging logging-exceptions19281843
Ref: 575c19281843
Node: 任意のオブジェクトをメッセージに使用する19283317
Ref: howto/logging arbitrary-object-messages19283494
Ref: 318b19283494
Ref: howto/logging using-arbitrary-objects-as-messages19283494
Ref: 575d19283494
Node: 最適化<19>19284381
Ref: howto/logging optimization19284546
Ref: 575e19284546
Node: その他のリソース19288938
Ref: howto/logging other-resources19289034
Ref: 575f19289034
Ref: howto/logging tutorial-ref-links19289034
Ref: 574319289034
Node: Logging クックブック19289467
Ref: howto/logging-cookbook doc19289591
Ref: 576019289591
Ref: howto/logging-cookbook id119289591
Ref: 576119289591
Ref: howto/logging-cookbook logging-cookbook19289591
Ref: 141019289591
Ref: howto/logging-cookbook translation-repo19289591
Ref: 576219289591
Node: 複数のモジュールで logging を使う19292248
Ref: howto/logging-cookbook using-logging-in-multiple-modules19292407
Ref: 576419292407
Node: 複数のスレッドからのロギング19296207
Ref: howto/logging-cookbook logging-from-multiple-threads19296406
Ref: 576519296406
Node: 複数の handler と formatter19298284
Ref: howto/logging-cookbook multiple-handlers-and-formatters19298480
Ref: 576619298480
Node: 複数の出力先にログを出力する19301072
Ref: howto/logging-cookbook logging-to-multiple-destinations19301262
Ref: 576719301262
Ref: howto/logging-cookbook multiple-destinations19301262
Ref: 576819301262
Node: ログレベルのカスタム処理19304953
Ref: howto/logging-cookbook custom-handling-of-levels19305133
Ref: 576919305133
Ref: howto/logging-cookbook custom-level-handling19305133
Ref: 576a19305133
Node: 設定サーバの例19311535
Ref: howto/logging-cookbook configuration-server-example19311709
Ref: 576b19311709
Node: ブロックする handler を扱う19313312
Ref: howto/logging-cookbook blocking-handlers19313510
Ref: 393e19313510
Ref: howto/logging-cookbook dealing-with-handlers-that-block19313510
Ref: 576c19313510
Node: ネットワーク越しの logging イベントの送受信19319184
Ref: howto/logging-cookbook network-logging19319421
Ref: 576d19319421
Ref: howto/logging-cookbook sending-and-receiving-logging-events-across-a-network19319421
Ref: 576e19319421
Node: 作成中のロギングソケットのリスナーを実行する19325182
Ref: howto/logging-cookbook running-a-logging-socket-listener-in-production19325345
Ref: 576f19325345
Ref: 作成中のロギングソケットのリスナーを実行する-Footnote-119330473
Ref: 作成中のロギングソケットのリスナーを実行する-Footnote-219330505
Ref: 作成中のロギングソケットのリスナーを実行する-Footnote-319330577
Ref: 作成中のロギングソケットのリスナーを実行する-Footnote-419330607
Node: コンテキスト情報をログ記録出力に付加する19330679
Ref: howto/logging-cookbook adding-contextual-information-to-your-logging-output19330901
Ref: 577019330901
Ref: howto/logging-cookbook context-info19330901
Ref: 319219330901
Node: LoggerAdapter を使ったコンテキスト情報の伝達19332357
Ref: howto/logging-cookbook using-loggeradapters-to-impart-contextual-information19332574
Ref: 577119332574
Node: コンテキスト情報を渡すために dict 以外のオブジェクトを使う19336542
Ref: howto/logging-cookbook using-objects-other-than-dicts-to-pass-contextual-information19336722
Ref: 577219336722
Node: Filter を使ったコンテキスト情報の伝達19337252
Ref: howto/logging-cookbook filters-contextual19337469
Ref: 318719337469
Ref: howto/logging-cookbook using-filters-to-impart-contextual-information19337469
Ref: 577319337469
Node: contextvars の利用19341557
Ref: howto/logging-cookbook use-of-contextvars19341773
Ref: 577419341773
Node: ハンドラ内でのコンテキスト情報の付与19352040
Ref: howto/logging-cookbook imparting-contextual-information-in-handlers19352262
Ref: 577519352262
Node: 複数のプロセスからの単一ファイルへのログ記録19353307
Ref: howto/logging-cookbook logging-to-a-single-file-from-multiple-processes19353544
Ref: 577619353544
Ref: howto/logging-cookbook multiple-processes19353544
Ref: 577719353544
Node: concurrent futures ProcessPoolExecutorの利用19364409
Ref: howto/logging-cookbook using-concurrent-futures-processpoolexecutor19364643
Ref: 577819364643
Node: Gunicorn と uWSGI を用いた Web アプリケーションのデプロイ19365867
Ref: howto/logging-cookbook deploying-web-applications-using-gunicorn-and-uwsgi19366101
Ref: 577919366101
Ref: Gunicorn と uWSGI を用いた Web アプリケーションのデプロイ-Footnote-119367106
Ref: Gunicorn と uWSGI を用いた Web アプリケーションのデプロイ-Footnote-219367136
Node: ファイルをローテートする19367189
Ref: howto/logging-cookbook using-file-rotation19367413
Ref: 577a19367413
Node: 別の format スタイルを利用する19369611
Ref: howto/logging-cookbook format-styles19369800
Ref: 577b19369800
Ref: howto/logging-cookbook use-of-alternative-formatting-styles19369800
Ref: 577c19369800
Node: LogRecord のカスタマイズ19377650
Ref: howto/logging-cookbook custom-logrecord19377863
Ref: 577d19377863
Ref: howto/logging-cookbook customizing-logrecord19377863
Ref: 577e19377863
Node: Subclassing QueueHandler and QueueListener- a ZeroMQ example19382590
Ref: howto/logging-cookbook subclassing-queuehandler-and-queuelistener-a-zeromq-example19382821
Ref: 577f19382821
Ref: howto/logging-cookbook zeromq-handlers19382821
Ref: 578019382821
Node: Subclass QueueHandler19383021
Ref: howto/logging-cookbook subclass-queuehandler19383170
Ref: 578119383170
Node: Subclass QueueListener19384523
Ref: howto/logging-cookbook subclass-queuelistener19384672
Ref: 578219384672
Node: Subclassing QueueHandler and QueueListener- a pynng example19385459
Ref: howto/logging-cookbook pynng-handlers19385692
Ref: 578319385692
Ref: howto/logging-cookbook subclassing-queuehandler-and-queuelistener-a-pynng-example19385692
Ref: 578419385692
Ref: Subclassing QueueHandler and QueueListener- a pynng example-Footnote-119386316
Ref: Subclassing QueueHandler and QueueListener- a pynng example-Footnote-219386356
Node: Subclass QueueListener<2>19386389
Ref: howto/logging-cookbook id319386543
Ref: 578519386543
Node: Subclass QueueHandler<2>19388519
Ref: howto/logging-cookbook id419388673
Ref: 578619388673
Node: 辞書ベースで構成する例19392385
Ref: howto/logging-cookbook an-example-dictionary-based-configuration19392636
Ref: 578719392636
Ref: 辞書ベースで構成する例-Footnote-119394605
Ref: 辞書ベースで構成する例-Footnote-219394691
Node: rotator と namer を使ってログローテートをカスタマイズする19394777
Ref: howto/logging-cookbook cookbook-rotator-namer19395013
Ref: 31e419395013
Ref: howto/logging-cookbook using-a-rotator-and-namer-to-customize-log-rotation-processing19395013
Ref: 578819395013
Node: より手の込んだ multiprocessing の例19396540
Ref: howto/logging-cookbook a-more-elaborate-multiprocessing-example19396804
Ref: 578919396804
Node: SysLogHandler に送るメッセージに BOM を挿入する19406627
Ref: howto/logging-cookbook inserting-a-bom-into-messages-sent-to-a-sysloghandler19406843
Ref: 578a19406843
Ref: SysLogHandler に送るメッセージに BOM を挿入する-Footnote-119409355
Ref: SysLogHandler に送るメッセージに BOM を挿入する-Footnote-219409414
Ref: SysLogHandler に送るメッセージに BOM を挿入する-Footnote-319409483
Ref: SysLogHandler に送るメッセージに BOM を挿入する-Footnote-419409542
Node: 構造化ログを実装する19409601
Ref: howto/logging-cookbook implementing-structured-logging19409832
Ref: 578b19409832
Node: handler を dictConfig を使ってカスタマイズする19412557
Ref: howto/logging-cookbook custom-handlers19412799
Ref: 578c19412799
Ref: howto/logging-cookbook customizing-handlers-with-dictconfig19412799
Ref: 578d19412799
Node: 固有の書式化スタイルをアプリケーション全体で使う19418424
Ref: howto/logging-cookbook formatting-styles19418694
Ref: 317b19418694
Ref: howto/logging-cookbook using-particular-formatting-styles-throughout-your-application19418694
Ref: 578e19418694
Node: LogRecord ファクトリを使う19421319
Ref: howto/logging-cookbook using-logrecord-factories19421528
Ref: 578f19421528
Node: カスタムなメッセージオブジェクトを使う19422776
Ref: howto/logging-cookbook using-custom-message-objects19422985
Ref: 579019422985
Node: filter を dictConfig を使ってカスタマイズする19426296
Ref: howto/logging-cookbook configuring-filters-with-dictconfig19426552
Ref: 579119426552
Ref: howto/logging-cookbook filters-dictconfig19426552
Ref: 579219426552
Node: 例外の書式化をカスタマイズする19430212
Ref: howto/logging-cookbook custom-format-exception19430432
Ref: 579319430432
Ref: howto/logging-cookbook customized-exception-formatting19430432
Ref: 579419430432
Node: ロギングメッセージを喋る19432622
Ref: howto/logging-cookbook speaking-logging-messages19432871
Ref: 579519432871
Ref: howto/logging-cookbook spoken-messages19432871
Ref: 579619432871
Node: ロギングメッセージをバッファリングし、条件に従って出力する19435456
Ref: howto/logging-cookbook buffered-logging19435745
Ref: 579719435745
Ref: howto/logging-cookbook buffering-logging-messages-and-outputting-them-conditionally19435745
Ref: 579819435745
Node: バッファリングしながらロギングメッセージを email で送信する19441890
Ref: howto/logging-cookbook buffered-smtp19442197
Ref: 579919442197
Ref: howto/logging-cookbook sending-logging-messages-to-email-with-buffering19442197
Ref: 579a19442197
Node: 設定によって時刻を UTC GMT で書式化する19446150
Ref: howto/logging-cookbook formatting-times-using-utc-gmt-via-configuration19446436
Ref: 579b19446436
Ref: howto/logging-cookbook utc-formatting19446436
Ref: 579c19446436
Node: ロギングの選択にコンテキストマネージャを使う19448545
Ref: howto/logging-cookbook context-manager19448806
Ref: 579d19448806
Ref: howto/logging-cookbook using-a-context-manager-for-selective-logging19448806
Ref: 579e19448806
Node: CLIアプリケーションスターターテンプレート19454397
Ref: howto/logging-cookbook a-cli-application-starter-template19454625
Ref: 579f19454625
Ref: howto/logging-cookbook starter-template19454625
Ref: 57a019454625
Node: Qt GUIのログ出力19461044
Ref: howto/logging-cookbook a-qt-gui-for-logging19461261
Ref: 57a119461261
Ref: howto/logging-cookbook qt-gui19461261
Ref: 57a219461261
Ref: Qt GUIのログ出力-Footnote-119471772
Ref: Qt GUIのログ出力-Footnote-219471799
Ref: Qt GUIのログ出力-Footnote-319471841
Node: RFC5424 をサポートする syslog へのロギング19471881
Ref: howto/logging-cookbook logging-to-syslog-with-rfc5424-support19472101
Ref: 57a319472101
Ref: RFC5424 をサポートする syslog へのロギング-Footnote-119476278
Ref: RFC5424 をサポートする syslog へのロギング-Footnote-219476337
Node: ロガーを出力ストリームのように取り扱う方法19476396
Ref: howto/logging-cookbook how-to-treat-a-logger-like-an-output-stream19476645
Ref: 57a419476645
Node: How to uniformly handle newlines in logging output19481878
Ref: howto/logging-cookbook how-to-uniformly-handle-newlines-in-logging-output19482099
Ref: 57a519482099
Ref: How to uniformly handle newlines in logging output-Footnote-119485627
Node: 避けるべきパターン19485689
Ref: howto/logging-cookbook patterns-to-avoid19485874
Ref: 57a619485874
Node: 同じログファイルを何度も開く19486555
Ref: howto/logging-cookbook opening-the-same-log-file-multiple-times19486739
Ref: 57a719486739
Node: ロガーをクラスの属性にするか、パラメータで渡す19489404
Ref: howto/logging-cookbook using-loggers-as-attributes-in-a-class-or-passing-them-as-parameters19489682
Ref: 57a819489682
Node: ライブラリ内でロガーに NullHandler 以外のハンドラーを追加する19490492
Ref: howto/logging-cookbook adding-handlers-other-than-nullhandler-to-a-logger-in-a-library19490761
Ref: 57a919490761
Node: 大量のロガーを作成する19491366
Ref: howto/logging-cookbook creating-a-lot-of-loggers19491557
Ref: 57aa19491557
Node: その他のリソース<2>19492257
Ref: howto/logging-cookbook cookbook-ref-links19492383
Ref: 576319492383
Ref: howto/logging-cookbook other-resources19492383
Ref: 57ab19492383
Node: 正規表現 HOWTO19492857
Ref: howto/regex doc19493007
Ref: 57ac19493007
Ref: howto/regex regex-howto19493007
Ref: 276219493007
Ref: howto/regex regular-expression-howto19493007
Ref: 57ad19493007
Ref: howto/regex translation-repo19493007
Ref: 57ae19493007
Node: はじめに<16>19493595
Ref: howto/regex introduction19493696
Ref: 57af19493696
Node: 単純なパターン19495762
Ref: howto/regex simple-patterns19495893
Ref: 57b019495893
Node: 文字のマッチング19496477
Ref: howto/regex matching-characters19496580
Ref: 57b119496580
Node: 繰り返し19502430
Ref: howto/regex repeating-things19502533
Ref: 57b219502533
Node: 正規表現を使う19508774
Ref: howto/regex using-regular-expressions19508922
Ref: 57b319508922
Node: 正規表現をコンパイルする19509595
Ref: howto/regex compiling-regular-expressions19509731
Ref: 57b419509731
Node: バックスラッシュ感染症19511407
Ref: howto/regex id119511570
Ref: 57b519511570
Ref: howto/regex the-backslash-plague19511570
Ref: 57b619511570
Node: マッチの実行19515436
Ref: howto/regex performing-matches19515599
Ref: 57b719515599
Node: モジュールレベルの関数<3>19522408
Ref: howto/regex module-level-functions19522562
Ref: 57b819522562
Node: コンパイルフラグ19524101
Ref: howto/regex compilation-flags19524228
Ref: 57b919524228
Node: パターンの能力をさらに19533244
Ref: howto/regex more-pattern-power19533395
Ref: 57bb19533395
Node: さらなる特殊文字19533951
Ref: howto/regex id219534072
Ref: 57bc19534072
Ref: howto/regex more-metacharacters19534072
Ref: 57ba19534072
Node: グルーピング19539726
Ref: howto/regex grouping19539913
Ref: 57bd19539913
Node: 取り出さないグループと名前つきグループ19544013
Ref: howto/regex non-capturing-and-named-groups19544224
Ref: 57be19544224
Node: 先読みアサーション Lookahead Assertions19550663
Ref: howto/regex lookahead-assertions19550847
Ref: 57bf19550847
Node: 文字列を変更する19554992
Ref: howto/regex modifying-strings19555140
Ref: 57c019555140
Node: 文字列の分割19556263
Ref: howto/regex splitting-strings19556369
Ref: 57c119556369
Node: 検索と置換<2>19558924
Ref: howto/regex search-and-replace19559030
Ref: 57c219559030
Node: よくある問題19564202
Ref: howto/regex common-problems19564338
Ref: 57c319564338
Node: 文字列メソッドを利用する19564888
Ref: howto/regex use-string-methods19565004
Ref: 57c419565004
Node: match 対 search19567117
Ref: howto/regex match-versus-search19567279
Ref: 57c519567279
Node: 貪欲 greedy 対非貪欲 non-greedy19569352
Ref: howto/regex greedy-versus-non-greedy19569498
Ref: 57c619569498
Node: re VERBOSE の利用19572018
Ref: howto/regex using-re-verbose19572139
Ref: 57c719572139
Node: フィードバック19574012
Ref: howto/regex feedback19574115
Ref: 57c819574115
Node: ソケットプログラミング HOWTO19575216
Ref: howto/sockets doc19575367
Ref: 57c919575367
Ref: howto/sockets socket-howto19575367
Ref: 39a119575367
Ref: howto/sockets socket-programming-howto19575367
Ref: 57ca19575367
Ref: howto/sockets translation-repo19575367
Ref: 57cb19575367
Node: ソケット19576208
Ref: howto/sockets sockets19576329
Ref: 57cc19576329
Node: 歴史19577883
Ref: howto/sockets history19577938
Ref: 57cd19577938
Node: ソケットの作成<3>19578666
Ref: howto/sockets creating-a-socket19578817
Ref: 57ce19578817
Node: IPC19582715
Ref: howto/sockets ipc19582779
Ref: 57cf19582779
Node: ソケットの利用19583375
Ref: howto/sockets using-a-socket19583520
Ref: 57d019583520
Node: バイナリデータ19591174
Ref: howto/sockets binary-data19591253
Ref: 57d119591253
Ref: バイナリデータ-Footnote-119592533
Node: 切断19592593
Ref: howto/sockets disconnecting19592750
Ref: 57d219592750
Node: ソケットが死ぬと19594528
Ref: howto/sockets when-sockets-die19594595
Ref: 57d319594595
Node: ノンブロッキングソケット19595831
Ref: howto/sockets non-blocking-sockets19595958
Ref: 57d419595958
Node: ソートのテクニック19600906
Ref: howto/sorting doc19601052
Ref: 57d519601052
Ref: howto/sorting sorting-techniques19601052
Ref: 57d619601052
Ref: howto/sorting sortinghowto19601052
Ref: 13f319601052
Ref: howto/sorting translation-repo19601052
Ref: 57d719601052
Node: ソートの基本19601984
Ref: howto/sorting sorting-basics19602085
Ref: 57d819602085
Node: Key 関数19603159
Ref: howto/sorting key-functions19603335
Ref: 57d919603335
Node: operator モジュールの関数や partial 関数による評価19605675
Ref: howto/sorting operator-module-functions-and-partial-function-evaluation19605848
Ref: 57da19605848
Ref: operator モジュールの関数や partial 関数による評価-Footnote-119607850
Node: 昇順と降順19607894
Ref: howto/sorting ascending-and-descending19608102
Ref: 57db19608102
Node: ソートの安定性と複合的なソート19608717
Ref: howto/sorting sort-stability-and-complex-sorts19608914
Ref: 57dc19608914
Ref: ソートの安定性と複合的なソート-Footnote-119610869
Ref: ソートの安定性と複合的なソート-Footnote-219610935
Node: デコレート - ソート - アンデコレート DSU19610981
Ref: howto/sorting decorate-sort-undecorate19611175
Ref: 57dd19611175
Ref: デコレート - ソート - アンデコレート DSU-Footnote-119613397
Node: 比較関数19613457
Ref: howto/sorting comparison-functions19613649
Ref: 57de19613649
Ref: 比較関数-Footnote-119614856
Node: Strategies For Unorderable Types and Values19614943
Ref: howto/sorting strategies-for-unorderable-types-and-values19615104
Ref: 57df19615104
Ref: Strategies For Unorderable Types and Values-Footnote-119616839
Node: 残りのはしばし<2>19616886
Ref: howto/sorting odds-and-ends19617056
Ref: 57e019617056
Ref: 残りのはしばし<2>-Footnote-119619794
Node: 部分的なソート19619836
Ref: howto/sorting partial-sorts19619954
Ref: 57e119619954
Node: Unicode HOWTO19621252
Ref: howto/unicode doc19621453
Ref: 57e219621453
Ref: howto/unicode id119621453
Ref: 57e319621453
Ref: howto/unicode translation-repo19621453
Ref: 57e419621453
Ref: howto/unicode unicode-howto19621453
Ref: 14bc19621453
Node: Unicode 入門19621890
Ref: howto/unicode introduction-to-unicode19621994
Ref: 57e519621994
Node: 定義19622148
Ref: howto/unicode definitions19622241
Ref: 57e619622241
Ref: 定義-Footnote-119625680
Node: エンコーディング<3>19625737
Ref: howto/unicode encodings19625854
Ref: 57e719625854
Node: 参考資料<3>19630271
Ref: howto/unicode references19630373
Ref: 57e819630373
Ref: 参考資料<3>-Footnote-119631334
Ref: 参考資料<3>-Footnote-219631366
Ref: 参考資料<3>-Footnote-319631407
Ref: 参考資料<3>-Footnote-419631459
Ref: 参考資料<3>-Footnote-519631506
Ref: 参考資料<3>-Footnote-619631680
Ref: 参考資料<3>-Footnote-719631737
Node: Python の Unicode サポート19631781
Ref: howto/unicode python-s-unicode-support19631932
Ref: 57e919631932
Node: 文字列型19632340
Ref: howto/unicode the-string-type19632453
Ref: 57ea19632453
Node: バイト列への変換19636167
Ref: howto/unicode converting-to-bytes19636341
Ref: 57eb19636341
Node: Python ソースコード内の Unicode リテラル19638577
Ref: howto/unicode unicode-literals-in-python-source-code19638762
Ref: 57ec19638762
Ref: Python ソースコード内の Unicode リテラル-Footnote-119641499
Node: Unicode プロパティ19641541
Ref: howto/unicode id219641719
Ref: 57ed19641719
Ref: howto/unicode unicode-properties19641719
Ref: 265319641719
Ref: Unicode プロパティ-Footnote-119643558
Node: Comparing Strings19643628
Ref: howto/unicode comparing-strings19643774
Ref: 57ee19643774
Node: Unicode 正規表現19646616
Ref: howto/unicode unicode-regular-expressions19646754
Ref: 57ef19646754
Node: 参考資料<4>19648206
Ref: howto/unicode id319648318
Ref: 57f019648318
Ref: 参考資料<4>-Footnote-119649311
Ref: 参考資料<4>-Footnote-219649407
Ref: 参考資料<4>-Footnote-319649459
Node: Unicode データを読み書きする19649528
Ref: howto/unicode reading-and-writing-unicode-data19649675
Ref: 57f119649675
Node: Unicode ファイル名19654327
Ref: howto/unicode unicode-filenames19654489
Ref: 57f219654489
Node: Unicode 対応のプログラムを書くための Tips19657119
Ref: howto/unicode tips-for-writing-unicode-aware-programs19657305
Ref: 57f319657305
Node: ファイルエンコーディングの変換19659137
Ref: howto/unicode converting-between-file-encodings19659331
Ref: 57f419659331
Node: 不明なエンコーディングのファイル19660107
Ref: howto/unicode files-in-an-unknown-encoding19660301
Ref: 57f519660301
Node: 参考資料<5>19661222
Ref: howto/unicode id419661376
Ref: 57f619661376
Ref: 参考資料<5>-Footnote-119662219
Ref: 参考資料<5>-Footnote-219662291
Node: 謝辞<10>19662360
Ref: howto/unicode acknowledgements19662467
Ref: 57f719662467
Node: urllib パッケージを使ってインターネット上のリソースを取得するには19663028
Ref: howto/urllib2 doc19663235
Ref: 57f819663235
Ref: howto/urllib2 howto-fetch-internet-resources-using-the-urllib-package19663235
Ref: 57f919663235
Ref: howto/urllib2 translation-repo19663235
Ref: 57fa19663235
Ref: howto/urllib2 urllib-howto19663235
Ref: 3f8a19663235
Ref: urllib パッケージを使ってインターネット上のリソースを取得するには-Footnote-119663711
Node: はじめに<17>19663750
Ref: howto/urllib2 introduction19663925
Ref: 57fb19663925
Ref: はじめに<17>-Footnote-119665880
Ref: はじめに<17>-Footnote-219665997
Node: URL を取得する19666056
Ref: howto/urllib2 fetching-urls19666264
Ref: 57fc19666264
Node: データ19669073
Ref: howto/urllib2 data19669156
Ref: 57fd19669156
Ref: データ-Footnote-119672510
Node: ヘッダ19672579
Ref: howto/urllib2 headers19672662
Ref: 57fe19672662
Ref: ヘッダ-Footnote-119674550
Ref: ヘッダ-Footnote-219674587
Ref: ヘッダ-Footnote-319674913
Ref: ヘッダ-Footnote-419675050
Node: 例外を処理する<2>19675207
Ref: howto/urllib2 handling-exceptions19675414
Ref: 580019675414
Node: URLError19675942
Ref: howto/urllib2 urlerror19676029
Ref: 580119676029
Node: HTTPError19676626
Ref: howto/urllib2 httperror19676749
Ref: 580219676749
Ref: HTTPError-Footnote-119677644
Node: エラーコード19677703
Ref: howto/urllib2 error-codes19677767
Ref: 580319677767
Ref: エラーコード-Footnote-119680101
Node: エラーをラップする19680160
Ref: howto/urllib2 wrapping-it-up19680266
Ref: 580419680266
Node: その119680513
Ref: howto/urllib2 number-119680600
Ref: 580519680600
Node: その219681224
Ref: howto/urllib2 number-219681311
Ref: 580619681311
Node: info と geturl19681839
Ref: howto/urllib2 info-and-geturl19682047
Ref: 57ff19682047
Ref: info と geturl-Footnote-119683093
Node: Openers と Handlers19683131
Ref: howto/urllib2 openers-and-handlers19683327
Ref: 580719683327
Node: Basic 認証19685671
Ref: howto/urllib2 basic-authentication19685864
Ref: 580819685864
Ref: Basic 認証-Footnote-119689734
Node: プロキシ19689851
Ref: howto/urllib2 proxies19690051
Ref: 580919690051
Ref: プロキシ-Footnote-119691333
Ref: プロキシ-Footnote-219691854
Node: ソケットとレイヤー19692021
Ref: howto/urllib2 sockets-and-layers19692215
Ref: 580a19692215
Node: 脚注19693604
Ref: howto/urllib2 footnotes19693777
Ref: 580b19693777
Node: ipaddressモジュールの紹介19693888
Ref: howto/ipaddress doc19694130
Ref: 580c19694130
Ref: howto/ipaddress an-introduction-to-the-ipaddress-module19694130
Ref: 580d19694130
Ref: howto/ipaddress ipaddress-howto19694130
Ref: 41c819694130
Ref: howto/ipaddress translation-repo19694130
Ref: 580e19694130
Node: アドレス/ネットワーク/インターフェースオブジェクトの作成19695079
Ref: howto/ipaddress creating-address-network-interface-objects19695315
Ref: 580f19695315
Node: IPバージョンについての注意19695942
Ref: howto/ipaddress a-note-on-ip-versions19696132
Ref: 581019696132
Node: IPホストアドレス19697167
Ref: howto/ipaddress ip-host-addresses19697399
Ref: 581119697399
Node: ネットワークを定義する19698730
Ref: howto/ipaddress defining-networks19698957
Ref: 581219698957
Node: ホストインターフェース19702022
Ref: howto/ipaddress host-interfaces19702217
Ref: 581319702217
Node: アドレス/ネットワーク/インターフェースオブジェクト19703477
Ref: howto/ipaddress inspecting-address-network-interface-objects19703776
Ref: 581419703776
Node: アドレスのリストとしてのネットワーク19706472
Ref: howto/ipaddress networks-as-lists-of-addresses19706697
Ref: 581519706697
Node: 比較<4>19707737
Ref: howto/ipaddress comparisons19707941
Ref: 581619707941
Node: 他のモジュールでIPアドレスを使用する19708372
Ref: howto/ipaddress using-ip-addresses-with-other-modules19708603
Ref: 581719708603
Node: インスタンスの生成に失敗した場合にさらに詳細を取得する19709137
Ref: howto/ipaddress getting-more-detail-when-instance-creation-fails19709350
Ref: 581819709350
Node: DTrace と SystemTap で CPython を測定する19711771
Ref: howto/instrumentation doc19711961
Ref: 581919711961
Ref: howto/instrumentation instrumentation19711961
Ref: e6619711961
Ref: howto/instrumentation instrumenting-cpython-with-dtrace-and-systemtap19711961
Ref: 581a19711961
Ref: howto/instrumentation translation-repo19711961
Ref: 581b19711961
Node: 静的マーカーの有効化19713471
Ref: howto/instrumentation enabling-the-static-markers19713621
Ref: 581c19713621
Node: 静的 DTrace プローブ19717982
Ref: howto/instrumentation static-dtrace-probes19718170
Ref: 581d19718170
Node: 静的 SystemTap マーカー19720639
Ref: howto/instrumentation static-systemtap-markers19720830
Ref: 581e19720830
Node: 利用可能な静的マーカー19723052
Ref: howto/instrumentation available-static-markers19723233
Ref: 581f19723233
Ref: howto/instrumentation static-markers19723233
Ref: db119723233
Node: SystemTap Tapset19726026
Ref: howto/instrumentation systemtap-tapsets19726191
Ref: 582019726191
Node: 使用例<58>19727799
Ref: howto/instrumentation examples19727922
Ref: 582119727922
Node: Python support for the Linux perf profiler19729242
Ref: howto/perf_profiling doc19729425
Ref: 1aac19729425
Ref: howto/perf_profiling perf-profiling19729425
Ref: 4ae19729425
Ref: howto/perf_profiling python-support-for-the-linux-perf-profiler19729425
Ref: 582219729425
Ref: howto/perf_profiling translation-repo19729425
Ref: 582319729425
Ref: Python support for the Linux perf profiler-Footnote-119737310
Node: How to enable perf profiling support19737347
Ref: howto/perf_profiling how-to-enable-perf-profiling-support19737501
Ref: 582419737501
Node: How to obtain the best results19738643
Ref: howto/perf_profiling how-to-obtain-the-best-results19738840
Ref: 582519738840
Node: How to work without frame pointers19739618
Ref: howto/perf_profiling how-to-work-without-frame-pointers19739770
Ref: 582619739770
Node: Annotations Best Practices19743633
Ref: howto/annotations doc19743804
Ref: 582719743804
Ref: howto/annotations annotations-best-practices19743804
Ref: 582819743804
Ref: howto/annotations annotations-howto19743804
Ref: 9d919743804
Ref: howto/annotations translation-repo19743804
Ref: 582919743804
Node: Accessing The Annotations Dict Of An Object In Python 3 10 And Newer19745154
Ref: howto/annotations accessing-the-annotations-dict-of-an-object-in-python-3-10-and-newer19745361
Ref: 582a19745361
Node: Accessing The Annotations Dict Of An Object In Python 3 9 And Older19747238
Ref: howto/annotations accessing-the-annotations-dict-of-an-object-in-python-3-9-and-older19747500
Ref: 582b19747500
Node: Manually Un-Stringizing Stringized Annotations19749878
Ref: howto/annotations manually-un-stringizing-stringized-annotations19750128
Ref: 582c19750128
Ref: Manually Un-Stringizing Stringized Annotations-Footnote-119752449
Node: Best Practices For __annotations__ In Any Python Version19752491
Ref: howto/annotations best-practices-for-annotations-in-any-python-version19752696
Ref: 582d19752696
Node: __annotations__ Quirks19753660
Ref: howto/annotations annotations-quirks19753810
Ref: 582e19753810
Ref: __annotations__ Quirks-Footnote-119756356
Node: 拡張モジュールを分離する19756417
Ref: howto/isolating-extensions doc19756573
Ref: 582f19756573
Ref: howto/isolating-extensions isolating-extension-modules19756573
Ref: 583019756573
Ref: howto/isolating-extensions isolating-extensions-howto19756573
Ref: 16619756573
Ref: howto/isolating-extensions translation-repo19756573
Ref: 583119756573
Node: Who should read this19757321
Ref: howto/isolating-extensions who-should-read-this19757432
Ref: 583219757432
Node: 背景<2>19757670
Ref: howto/isolating-extensions background19757836
Ref: 583319757836
Node: Enter Per-Module State19759425
Ref: howto/isolating-extensions enter-per-module-state19759525
Ref: 583419759525
Node: Isolated Module Objects19760684
Ref: howto/isolating-extensions isolated-module-objects19760814
Ref: 583519760814
Node: Surprising Edge Cases19761851
Ref: howto/isolating-extensions surprising-edge-cases19761950
Ref: 583719761950
Node: Making Modules Safe with Multiple Interpreters19762962
Ref: howto/isolating-extensions making-modules-safe-with-multiple-interpreters19763121
Ref: 583819763121
Node: Managing Global State19763440
Ref: howto/isolating-extensions managing-global-state19763578
Ref: 583619763578
Node: Managing Per-Module State19764534
Ref: howto/isolating-extensions managing-per-module-state19764730
Ref: 583919764730
Ref: Managing Per-Module State-Footnote-119766402
Node: Opt-Out Limiting to One Module Object per Process19766476
Ref: howto/isolating-extensions isolating-extensions-optout19766685
Ref: 521019766685
Ref: howto/isolating-extensions opt-out-limiting-to-one-module-object-per-process19766685
Ref: 583a19766685
Node: Module State Access from Functions19768043
Ref: howto/isolating-extensions module-state-access-from-functions19768218
Ref: 583b19768218
Node: Heap Types<2>19769000
Ref: howto/isolating-extensions heap-types19769177
Ref: 583c19769177
Node: Changing Static Types to Heap Types19770825
Ref: howto/isolating-extensions changing-static-types-to-heap-types19770938
Ref: 583d19770938
Node: Defining Heap Types19771914
Ref: howto/isolating-extensions defining-heap-types19772063
Ref: 583e19772063
Node: Garbage-Collection Protocol19772716
Ref: howto/isolating-extensions garbage-collection-protocol19772862
Ref: 583f19772862
Node: tp_traverse in Python 3 8 and lower19773956
Ref: howto/isolating-extensions tp-traverse-in-python-3-8-and-lower19774086
Ref: 584019774086
Node: Delegating tp_traverse19774854
Ref: howto/isolating-extensions delegating-tp-traverse19775012
Ref: 584119775012
Node: Defining tp_dealloc19775820
Ref: howto/isolating-extensions defining-tp-dealloc19775965
Ref: 584219775965
Node: Not overriding tp_free19776733
Ref: howto/isolating-extensions not-overriding-tp-free19776877
Ref: 584319776877
Node: Avoiding PyObject_New19777084
Ref: howto/isolating-extensions avoiding-pyobject-new19777200
Ref: 584419777200
Node: Module State Access from Classes19777987
Ref: howto/isolating-extensions module-state-access-from-classes19778154
Ref: 584519778154
Node: Module State Access from Regular Methods19778725
Ref: howto/isolating-extensions module-state-access-from-regular-methods19778922
Ref: 584619778922
Node: Module State Access from Slot Methods Getters and Setters19781425
Ref: howto/isolating-extensions module-state-access-from-slot-methods-getters-and-setters19781618
Ref: 584719781618
Node: Lifetime of the Module State19783065
Ref: howto/isolating-extensions lifetime-of-the-module-state19783209
Ref: 584819783209
Node: 取り掛かり中の問題19783752
Ref: howto/isolating-extensions open-issues19783874
Ref: 584919783874
Ref: 取り掛かり中の問題-Footnote-119784224
Node: クラスごとのスコープ19784279
Ref: howto/isolating-extensions per-class-scope19784415
Ref: 584a19784415
Node: Lossless Conversion to Heap Types19784728
Ref: howto/isolating-extensions lossless-conversion-to-heap-types19784864
Ref: 584b19784864
Node: timer file descriptor HOWTO19785102
Ref: howto/timerfd doc19785270
Ref: 584c19785270
Ref: howto/timerfd timer-file-descriptor-howto19785270
Ref: 584d19785270
Ref: howto/timerfd timerfd-howto19785270
Ref: 584e19785270
Ref: howto/timerfd translation-repo19785270
Ref: 584f19785270
Node: 使用例<59>19785472
Ref: howto/timerfd examples19785549
Ref: 585019785549
Node: The Python 2 3 Method Resolution Order19794355
Ref: howto/mro doc19794520
Ref: 585119794520
Ref: howto/mro python-2-3-mro19794520
Ref: 16c319794520
Ref: howto/mro the-python-2-3-method-resolution-order19794520
Ref: 585219794520
Ref: howto/mro translation-repo19794520
Ref: 585319794520
Ref: The Python 2 3 Method Resolution Order-Footnote-119796131
Node: The beginning19796178
Ref: howto/mro the-beginning19796305
Ref: 585419796305
Ref: The beginning-Footnote-119800882
Ref: The beginning-Footnote-219801019
Node: The C3 Method Resolution Order19801131
Ref: howto/mro the-c3-method-resolution-order19801280
Ref: 585519801280
Node: 使用例<60>19803612
Ref: howto/mro examples19803776
Ref: 585619803776
Node: Bad Method Resolution Orders19809324
Ref: howto/mro bad-method-resolution-orders19809465
Ref: 585719809465
Ref: Bad Method Resolution Orders-Footnote-119815713
Node: The end19815897
Ref: howto/mro the-end19816034
Ref: 585819816034
Node: Resources19819209
Ref: howto/mro resources19819309
Ref: 585919819309
Node: Python support for free threading19819344
Ref: howto/free-threading-python doc19819524
Ref: 585a19819524
Ref: howto/free-threading-python freethreading-python-howto19819524
Ref: 261919819524
Ref: howto/free-threading-python python-support-for-free-threading19819524
Ref: 585b19819524
Ref: howto/free-threading-python translation-repo19819524
Ref: 585c19819524
Ref: Python support for free threading-Footnote-119820829
Node: Installation<2>19820871
Ref: howto/free-threading-python installation19820997
Ref: 585e19820997
Ref: Installation<2>-Footnote-119821583
Node: Identifying free-threaded Python19821647
Ref: howto/free-threading-python identifying-free-threaded-python19821833
Ref: 585f19821833
Node: The global interpreter lock in free-threaded Python19822500
Ref: howto/free-threading-python the-global-interpreter-lock-in-free-threaded-python19822684
Ref: 586019822684
Node: Thread safety19823434
Ref: howto/free-threading-python thread-safety19823603
Ref: 586119823603
Node: Known limitations19824395
Ref: howto/free-threading-python known-limitations19824531
Ref: 586219824531
Node: Immortalization19824866
Ref: howto/free-threading-python immortalization19824984
Ref: 586319824984
Node: フレーム frame オブジェクト<3>19825511
Ref: howto/free-threading-python frame-objects19825665
Ref: 586419825665
Node: イテレータ iterator<3>19825935
Ref: howto/free-threading-python iterators19826101
Ref: 586519826101
Node: Single-threaded performance19826324
Ref: howto/free-threading-python single-threaded-performance19826441
Ref: 586619826441
Node: Behavioral changes19826826
Ref: howto/free-threading-python behavioral-changes19826940
Ref: 586719826940
Node: Context variables19827127
Ref: howto/free-threading-python context-variables19827223
Ref: 586819827223
Node: Warning filters19827642
Ref: howto/free-threading-python warning-filters19827738
Ref: 586919827738
Node: C API Extension Support for Free Threading19828248
Ref: howto/free-threading-extensions doc19828426
Ref: 586a19828426
Ref: howto/free-threading-extensions c-api-extension-support-for-free-threading19828426
Ref: 586b19828426
Ref: howto/free-threading-extensions freethreading-extensions-howto19828426
Ref: 585d19828426
Ref: howto/free-threading-extensions translation-repo19828426
Ref: 586c19828426
Node: Identifying the Free-Threaded Build in C19829086
Ref: howto/free-threading-extensions identifying-the-free-threaded-build-in-c19829235
Ref: 586d19829235
Node: Module Initialization19829939
Ref: howto/free-threading-extensions module-initialization19830119
Ref: 586e19830119
Node: Multi-Phase Initialization19830613
Ref: howto/free-threading-extensions multi-phase-initialization19830733
Ref: 586f19830733
Node: Single-Phase Initialization19831406
Ref: howto/free-threading-extensions single-phase-initialization19831526
Ref: 587019831526
Node: General API Guidelines19832366
Ref: howto/free-threading-extensions general-api-guidelines19832525
Ref: 587119832525
Node: Container Thread Safety19833468
Ref: howto/free-threading-extensions container-thread-safety19833550
Ref: 587319833550
Node: PyDict_Next19833885
Ref: howto/free-threading-extensions id119833956
Ref: 587419833956
Ref: howto/free-threading-extensions pydict-next19833956
Ref: 587519833956
Node: Borrowed References19834444
Ref: howto/free-threading-extensions borrowed-references19834604
Ref: 587619834604
Ref: howto/free-threading-extensions id219834659
Ref: 587219834659
Ref: Borrowed References-Footnote-119837595
Node: Memory Allocation APIs19837647
Ref: howto/free-threading-extensions free-threaded-memory-allocation19837810
Ref: 55b619837810
Ref: howto/free-threading-extensions memory-allocation-apis19837810
Ref: 587719837810
Node: Thread State and GIL APIs19838545
Ref: howto/free-threading-extensions thread-state-and-gil-apis19838724
Ref: 587819838724
Node: Protecting Internal Extension State19839690
Ref: howto/free-threading-extensions protecting-internal-extension-state19839864
Ref: 587919839864
Ref: Protecting Internal Extension State-Footnote-119840620
Node: Critical Sections19840686
Ref: howto/free-threading-extensions critical-sections19840882
Ref: 587a19840882
Ref: howto/free-threading-extensions id319840933
Ref: 587b19840933
Node: What Are Critical Sections?19841462
Ref: howto/free-threading-extensions what-are-critical-sections19841575
Ref: 587c19841575
Node: Using Critical Sections19842052
Ref: howto/free-threading-extensions using-critical-sections19842200
Ref: 587d19842200
Node: How Critical Sections Work19843450
Ref: howto/free-threading-extensions how-critical-sections-work19843589
Ref: 587e19843589
Node: Deadlock Avoidance19844496
Ref: howto/free-threading-extensions deadlock-avoidance19844636
Ref: 587f19844636
Node: Important Considerations19845796
Ref: howto/free-threading-extensions important-considerations19845901
Ref: 588019845901
Node: Building Extensions for the Free-Threaded Build19847846
Ref: howto/free-threading-extensions building-extensions-for-the-free-threaded-build19847998
Ref: 588119847998
Ref: Building Extensions for the Free-Threaded Build-Footnote-119848726
Ref: Building Extensions for the Free-Threaded Build-Footnote-219848768
Ref: Building Extensions for the Free-Threaded Build-Footnote-319848813
Node: Limited C API and Stable ABI19848876
Ref: howto/free-threading-extensions limited-c-api-and-stable-abi19849008
Ref: 588219849008
Ref: Limited C API and Stable ABI-Footnote-119849707
Node: Windows<85>19849768
Ref: howto/free-threading-extensions windows19849900
Ref: 588319849900
Ref: Windows<85>-Footnote-119850252
Node: Remote debugging attachment protocol19850305
Ref: howto/remote_debugging doc19850473
Ref: 588419850473
Ref: howto/remote_debugging remote-debugging19850473
Ref: 492719850473
Ref: howto/remote_debugging remote-debugging-attachment-protocol19850473
Ref: 588519850473
Ref: howto/remote_debugging translation-repo19850473
Ref: 588619850473
Node: Disabling remote debugging19850791
Ref: howto/remote_debugging disabling-remote-debugging19850890
Ref: 588719850890
Node: Permission requirements19851299
Ref: howto/remote_debugging id119851457
Ref: 588819851457
Ref: howto/remote_debugging permission-requirements19851457
Ref: 588919851457
Node: Locating the PyRuntime structure19855122
Ref: howto/remote_debugging locating-the-pyruntime-structure19855268
Ref: 588a19855268
Ref: Locating the PyRuntime structure-Footnote-119865311
Ref: Locating the PyRuntime structure-Footnote-219865380
Ref: Locating the PyRuntime structure-Footnote-319865487
Ref: Locating the PyRuntime structure-Footnote-419865583
Node: Reading _Py_DebugOffsets19865678
Ref: howto/remote_debugging reading-py-debugoffsets19865842
Ref: 588b19865842
Node: Locating the interpreter and thread state19869646
Ref: howto/remote_debugging locating-the-interpreter-and-thread-state19869805
Ref: 588c19869805
Node: Writing control information19874399
Ref: howto/remote_debugging writing-control-information19874541
Ref: 588d19874541
Node: Summary19878321
Ref: howto/remote_debugging summary19878413
Ref: 588e19878413
Node: Python よくある質問19880488
Ref: faq/index doc19880596
Ref: 588f19880596
Ref: faq/index faq-index19880596
Ref: 20f519880596
Ref: faq/index python-frequently-asked-questions19880596
Ref: 589019880596
Ref: faq/index translation-repo19880596
Ref: 589119880596
Node: 一般 Python FAQ19880997
Ref: faq/general doc19881110
Ref: 589219881110
Ref: faq/general general-python-faq19881110
Ref: 589319881110
Node: 一般情報19881212
Ref: faq/general general-information19881312
Ref: 589419881312
Node: Python とは何ですか？19882613
Ref: faq/general what-is-python19882747
Ref: 589519882747
Ref: Python とは何ですか？-Footnote-119884224
Node: Python Software Foundation とは何ですか？19884276
Ref: faq/general what-is-the-python-software-foundation19884480
Ref: 589619884480
Ref: Python Software Foundation とは何ですか？-Footnote-119885153
Node: Python を使うのに著作権の制限はありますか？19885199
Ref: faq/general are-there-copyright-restrictions-on-the-use-of-python19885431
Ref: 589719885431
Ref: Python を使うのに著作権の制限はありますか？-Footnote-119886478
Ref: Python を使うのに著作権の制限はありますか？-Footnote-219886525
Node: そもそも Python は何故創られたのですか？19886572
Ref: faq/general why-was-python-created-in-the-first-place19886808
Ref: 589819886808
Node: Python は何をするのに向いていますか？19889570
Ref: faq/general what-is-python-good-for19889827
Ref: 589919889827
Ref: Python は何をするのに向いていますか？-Footnote-119890913
Node: Python のバージョン番号の仕組みはどうなっているのですか？19890938
Ref: faq/general faq-version-numbering-scheme19891206
Ref: 589a19891206
Ref: faq/general how-does-the-python-version-numbering-scheme-work19891206
Ref: 589b19891206
Ref: Python のバージョン番号の仕組みはどうなっているのですか？-Footnote-119893992
Ref: Python のバージョン番号の仕組みはどうなっているのですか？-Footnote-219894066
Node: Python のソースのコピーはどこで手に入りますか？19894108
Ref: faq/general how-do-i-obtain-a-copy-of-the-python-source19894388
Ref: 589c19894388
Ref: Python のソースのコピーはどこで手に入りますか？-Footnote-119895446
Node: Python のドキュメントはどこで手に入りますか？19895489
Ref: faq/general how-do-i-get-documentation-on-python19895799
Ref: 589d19895799
Ref: Python のドキュメントはどこで手に入りますか？-Footnote-119896486
Node: プログラミングをしたことがないのですが、Python のチュートリアルはありますか？19896522
Ref: faq/general i-ve-never-programmed-before-is-there-a-python-tutorial19896856
Ref: 589e19896856
Ref: プログラミングをしたことがないのですが、Python のチュートリアルはありますか？-Footnote-119897424
Node: Python のためのニュースグループやメーリングリストはありますか？19897476
Ref: faq/general is-there-a-newsgroup-or-mailing-list-devoted-to-python19897813
Ref: 589f19897813
Ref: Python のためのニュースグループやメーリングリストはありますか？-Footnote-119898993
Ref: Python のためのニュースグループやメーリングリストはありますか？-Footnote-219899054
Node: Python のベータテスト版はどこで手に入りますか？19899135
Ref: faq/general how-do-i-get-a-beta-test-version-of-python19899445
Ref: 58a019899445
Ref: Python のベータテスト版はどこで手に入りますか？-Footnote-119900089
Node: Python のバグ報告やパッチを上げるにはどうしたら良いですか？19900126
Ref: faq/general how-do-i-submit-bug-reports-and-patches-for-python19900418
Ref: 58a119900418
Ref: Python のバグ報告やパッチを上げるにはどうしたら良いですか？-Footnote-119900871
Node: Python について発行された記事を何か参照できますか？19900908
Ref: faq/general are-there-any-published-articles-about-python-that-i-can-reference19901167
Ref: 58a219901167
Ref: Python について発行された記事を何か参照できますか？-Footnote-119901739
Node: Python の本はありますか？19901775
Ref: faq/general are-there-any-books-on-python19902006
Ref: 58a319902006
Node: www python org は世界のどこにあるのですか？19902457
Ref: faq/general where-in-the-world-is-www-python-org-located19902662
Ref: 58a419902662
Ref: www python org は世界のどこにあるのですか？-Footnote-119902994
Node: なぜ Python という名前なのですか？19903023
Ref: faq/general why-is-it-called-python19903281
Ref: 58a519903281
Ref: なぜ Python という名前なのですか？-Footnote-119903788
Node: 『空飛ぶモンティ・パイソン』を好きでなくてはいけませんか？19903839
Ref: faq/general do-i-have-to-like-monty-python-s-flying-circus19904031
Ref: 58a619904031
Node: 現実世界での Python19904269
Ref: faq/general python-in-the-real-world19904369
Ref: 58a719904369
Node: Python はどれくらい安定していますか？19904874
Ref: faq/general how-stable-is-python19905056
Ref: 58a819905056
Ref: Python はどれくらい安定していますか？-Footnote-119906370
Ref: Python はどれくらい安定していますか？-Footnote-219906412
Ref: Python はどれくらい安定していますか？-Footnote-319906454
Node: どれくらいの人が Python を使っていますか？19906496
Ref: faq/general how-many-people-are-using-python19906757
Ref: 58a919906757
Node: Python で行われた大きなプロジェクトはありますか？19907456
Ref: faq/general have-any-significant-projects-been-done-in-python19907739
Ref: 58aa19907739
Ref: Python で行われた大きなプロジェクトはありますか？-Footnote-119908656
Ref: Python で行われた大きなプロジェクトはありますか？-Footnote-219908708
Ref: Python で行われた大きなプロジェクトはありますか？-Footnote-319908737
Ref: Python で行われた大きなプロジェクトはありますか？-Footnote-419908766
Node: 将来 Python にどのような新しい開発が期待されますか？19908797
Ref: faq/general what-new-developments-are-expected-for-python-in-the-future19909100
Ref: 58ab19909100
Ref: 将来 Python にどのような新しい開発が期待されますか？-Footnote-119909737
Node: Python の互換性を無くすような提案をしてもいいのですか？19909807
Ref: faq/general is-it-reasonable-to-propose-incompatible-changes-to-python19910110
Ref: 58ac19910110
Ref: Python の互換性を無くすような提案をしてもいいのですか？-Footnote-119911205
Node: Python は初心者プログラマに向いている言語ですか？19911247
Ref: faq/general is-python-a-good-language-for-beginning-programmers19911467
Ref: 58ad19911467
Ref: Python は初心者プログラマに向いている言語ですか？-Footnote-119916149
Ref: Python は初心者プログラマに向いている言語ですか？-Footnote-219916200
Node: プログラミング FAQ19916262
Ref: faq/programming doc19916409
Ref: 244919916409
Ref: faq/programming programming-faq19916409
Ref: 58ae19916409
Ref: faq/programming translation-repo19916409
Ref: 58af19916409
Node: 一般的な質問19916695
Ref: faq/programming general-questions19916796
Ref: 58b019916796
Node: ブレークポイントやシングルステップ実行などを備えたソースコードレベルデバッガはありますか？19917293
Ref: faq/programming is-there-a-source-code-level-debugger-with-breakpoints-single-stepping-etc19917564
Ref: 58b119917564
Ref: ブレークポイントやシングルステップ実行などを備えたソースコードレベルデバッガはありますか？-Footnote-119919451
Ref: ブレークポイントやシングルステップ実行などを備えたソースコードレベルデバッガはありますか？-Footnote-219919523
Ref: ブレークポイントやシングルステップ実行などを備えたソースコードレベルデバッガはありますか？-Footnote-319919567
Ref: ブレークポイントやシングルステップ実行などを備えたソースコードレベルデバッガはありますか？-Footnote-419919620
Ref: ブレークポイントやシングルステップ実行などを備えたソースコードレベルデバッガはありますか？-Footnote-519919666
Ref: ブレークポイントやシングルステップ実行などを備えたソースコードレベルデバッガはありますか？-Footnote-619919715
Ref: ブレークポイントやシングルステップ実行などを備えたソースコードレベルデバッガはありますか？-Footnote-719919754
Ref: ブレークポイントやシングルステップ実行などを備えたソースコードレベルデバッガはありますか？-Footnote-819919784
Ref: ブレークポイントやシングルステップ実行などを備えたソースコードレベルデバッガはありますか？-Footnote-919919841
Node: バグの発見や静的解析に役立つツールはありますか？19919884
Ref: faq/programming are-there-tools-to-help-find-bugs-or-perform-static-analysis19920262
Ref: 58b219920262
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-119920707
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-219920761
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-319920803
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-419920834
Ref: バグの発見や静的解析に役立つツールはありますか？-Footnote-519920866
Node: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？19920907
Ref: faq/programming faq-create-standalone-binary19921265
Ref: 58b319921265
Ref: faq/programming how-can-i-create-a-stand-alone-binary-from-a-python-script19921265
Ref: 58b419921265
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-119923437
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-219923502
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-319923530
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-419923563
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-519923616
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-619923668
Ref: どうしたら Python スクリプトからスタンドアロンバイナリを作れますか？-Footnote-719923717
Node: Python プログラムのためのコーディングスタンダードやスタイルガイドはありますか？19923749
Ref: faq/programming are-there-coding-standards-or-a-style-guide-for-python-programs19924026
Ref: 58b519924026
Ref: Python プログラムのためのコーディングスタンダードやスタイルガイドはありますか？-Footnote-119924424
Node: コア言語19924466
Ref: faq/programming core-language19924591
Ref: 58b619924591
Node: なぜ変数に値があるのに UnboundLocalError が出るのですか？19926392
Ref: faq/programming faq-unboundlocalerror19926602
Ref: 242b19926602
Ref: faq/programming why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value19926602
Ref: 58b719926602
Node: Python のローカルとグローバル変数のルールは何ですか？19928771
Ref: faq/programming what-are-the-rules-for-local-and-global-variables-in-python19929098
Ref: 58b819929098
Node: ループの中で異なる値で定義されたラムダ式が、同じ値を返すのはなぜですか？19930193
Ref: faq/programming why-do-lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result19930540
Ref: 58b919930540
Node: グローバル変数をモジュール間で共有するにはどうしたらいいですか？19932936
Ref: faq/programming how-do-i-share-global-variables-across-modules19933299
Ref: 58ba19933299
Node: モジュールで import を使う際の「ベストプラクティス」は何ですか？19934423
Ref: faq/programming what-are-the-best-practices-for-using-import-in-a-module19934759
Ref: 58bb19934759
Node: なぜオブジェクト間でデフォルト値が共有されるのですか？19938548
Ref: faq/programming why-are-default-values-shared-between-objects19938920
Ref: 58bc19938920
Node: オプションパラメータやキーワードパラメータを関数から関数へ渡すにはどうしたらいいですか？19941874
Ref: faq/programming how-can-i-pass-optional-or-keyword-parameters-from-one-function-to-another19942200
Ref: 58bd19942200
Node: 実引数と仮引数の違いは何ですか?19942914
Ref: faq/programming faq-argument-vs-parameter19943234
Ref: 58be19943234
Ref: faq/programming what-is-the-difference-between-arguments-and-parameters19943234
Ref: 58bf19943234
Node: なぜ list 'y' を変更すると list 'x' も変更されるのですか?19943997
Ref: faq/programming why-did-changing-list-y-also-change-list-x19944262
Ref: 58c019944262
Node: 出力引数のある関数 参照渡し はどのように書きますか？19948627
Ref: faq/programming how-do-i-write-a-function-with-output-parameters-call-by-reference19948907
Ref: 58c119948907
Node: Python で高次関数はどのようにつくりますか？19951572
Ref: faq/programming how-do-you-make-a-higher-order-function-in-python19951847
Ref: 58c219951847
Node: Python のオブジェクトはどのようにコピーしますか？19953742
Ref: faq/programming how-do-i-copy-an-object-in-python19954021
Ref: 58c319954021
Node: オブジェクトのメソッドや属性はどのように見つけますか？19954605
Ref: faq/programming how-can-i-find-the-methods-or-attributes-of-an-object19954907
Ref: 58c419954907
Node: コードはどのようにオブジェクトの名前を見つけるのですか？19955305
Ref: faq/programming how-can-my-code-discover-the-name-of-an-object19955594
Ref: 58c519955594
Node: カンマ演算子はなぜ優先されるのですか？19957702
Ref: faq/programming what-s-up-with-the-comma-operator-s-precedence19957975
Ref: 58c619957975
Node: C の "? " 三項演算子と等価なものはありますか？19958624
Ref: faq/programming is-there-an-equivalent-of-c-s-ternary-operator19958889
Ref: 58c719958889
Node: Python で解し難いワンライナーを書くことはできますか？19959653
Ref: faq/programming is-it-possible-to-write-obfuscated-one-liners-in-python19959942
Ref: 58c819959942
Node: 関数の引数リストにあるスラッシュ / は何を意味しますか？19961534
Ref: faq/programming faq-positional-only-arguments19961749
Ref: 25d619961749
Ref: faq/programming what-does-the-slash-in-the-parameter-list-of-a-function-mean19961749
Ref: 58c919961749
Node: 数と文字列19963039
Ref: faq/programming numbers-and-strings19963155
Ref: 58ca19963155
Node: 十六進数や八進数を指定するにはどうしたらいいですか？19964201
Ref: faq/programming how-do-i-specify-hexadecimal-and-octal-integers19964388
Ref: 58cb19964388
Node: なぜ -22 // 10 は -3 を返すのですか？19965161
Ref: faq/programming why-does-22-10-return-319965454
Ref: 58cc19965454
Node: どうすれば SyntaxError を起こさずに整数リテラルの属性を得られますか？19966374
Ref: faq/programming how-do-i-get-int-literal-attribute-instead-of-syntaxerror19966658
Ref: 58cd19966658
Node: 文字列を数に変換するにはどうしたらいいですか？19967313
Ref: faq/programming how-do-i-convert-a-string-to-a-number19967618
Ref: 58ce19967618
Node: 数を文字列に変換するにはどうしたらいいですか？19969234
Ref: faq/programming how-do-i-convert-a-number-to-a-string19969526
Ref: 58cf19969526
Node: 文字列をインプレースに変更するにはどうしたらいいですか？19970288
Ref: faq/programming how-do-i-modify-a-string-in-place19970604
Ref: 58d019970604
Node: 関数やメソッドを呼ぶのに文字列を使うにはどうしたらいいですか？19971614
Ref: faq/programming how-do-i-use-strings-to-call-functions-methods19971944
Ref: 58d119971944
Node: Is there an equivalent to Perl's chomp for removing trailing newlines from strings?19973494
Ref: faq/programming is-there-an-equivalent-to-perl-s-chomp-for-removing-trailing-newlines-from-strings19973778
Ref: 58d219973778
Node: Is there a scanf or sscanf equivalent?19974583
Ref: faq/programming is-there-a-scanf-or-sscanf-equivalent19974836
Ref: 58d319974836
Node: What does UnicodeDecodeError or UnicodeEncodeError error mean?19975554
Ref: faq/programming what-does-unicodedecodeerror-or-unicodeencodeerror-error-mean19975813
Ref: 58d419975813
Node: raw string を奇数個のバックスラッシュで終えることはできますか？19976032
Ref: faq/programming can-i-end-a-raw-string-with-an-odd-number-of-backslashes19976244
Ref: 58d519976244
Ref: faq/programming faq-programming-raw-string-backslash19976244
Ref: 1fdf19976244
Node: 性能<4>19977759
Ref: faq/programming performance19977898
Ref: 58d619977898
Node: プログラムが遅すぎます。どうしたら速くなりますか？19978101
Ref: faq/programming my-program-is-too-slow-how-do-i-speed-it-up19978312
Ref: 58d719978312
Ref: プログラムが遅すぎます。どうしたら速くなりますか？-Footnote-119981788
Ref: プログラムが遅すぎます。どうしたら速くなりますか？-Footnote-219981815
Node: 多くの文字列を結合するのに最も効率的な方法は何ですか？19981880
Ref: faq/programming efficient-string-concatenation19982091
Ref: 58d819982091
Ref: faq/programming what-is-the-most-efficient-way-to-concatenate-many-strings-together19982091
Ref: 58d919982091
Node: シーケンス タプル/リスト19983270
Ref: faq/programming sequences-tuples-lists19983412
Ref: 58da19983412
Node: タプル、リスト間の変更はどのようにするのですか？19984341
Ref: faq/programming how-do-i-convert-between-tuples-and-lists19984527
Ref: 58db19984527
Node: 負の添え字は何ですか？19985615
Ref: faq/programming what-s-a-negative-index19985897
Ref: 58dc19985897
Node: シーケンスを逆順にイテレートするにはどうしたらいいですか？19986610
Ref: faq/programming how-do-i-iterate-over-a-sequence-in-reverse-order19986883
Ref: 58dd19986883
Node: リストから重複を取り除くにはどうしますか？19987327
Ref: faq/programming how-do-you-remove-duplicates-from-a-list19987612
Ref: 58de19987612
Node: How do you remove multiple items from a list?19988627
Ref: faq/programming how-do-you-remove-multiple-items-from-a-list19988877
Ref: 58df19988877
Node: Python で配列を作るにはどうしますか？19989445
Ref: faq/programming how-do-you-make-an-array-in-python19989689
Ref: 58e019989689
Ref: Python で配列を作るにはどうしますか？-Footnote-119991006
Node: 多次元のリストを作るにはどうしますか？19991033
Ref: faq/programming faq-multidimensional-list19991334
Ref: 260819991334
Ref: faq/programming how-do-i-create-a-multidimensional-list19991334
Ref: 58e119991334
Ref: 多次元のリストを作るにはどうしますか？-Footnote-119992873
Node: オブジェクトのシーケンスにメソッドや関数を適用するにはどうしますか？19992900
Ref: faq/programming how-do-i-apply-a-method-or-function-to-a-sequence-of-objects19993240
Ref: 58e219993240
Node: なぜ加算はされるのに a_tuple[i] += ['item'] は例外を送出するのですか?19993925
Ref: faq/programming faq-augmented-assignment-tuple-error19994305
Ref: 240219994305
Ref: faq/programming why-does-a-tuple-i-item-raise-an-exception-when-the-addition-works19994305
Ref: 58e319994305
Node: 複雑なソートがしたいのですが、Python でシュワルツ変換はできますか？19997969
Ref: faq/programming i-want-to-do-a-complicated-sort-can-you-do-a-schwartzian-transform-in-python19998334
Ref: 58e419998334
Node: リストを別のリストの値によってソートするにはどうしますか？19998918
Ref: faq/programming how-can-i-sort-one-list-by-values-from-another-list19999183
Ref: 58e519999183
Node: オブジェクト19999849
Ref: faq/programming objects20000000
Ref: 58e620000000
Node: クラスとは何ですか？20001705
Ref: faq/programming what-is-a-class20001832
Ref: 58e720001832
Node: メソッドとは何ですか？20002898
Ref: faq/programming what-is-a-method20003060
Ref: 58e820003060
Node: self とは何ですか？20003445
Ref: faq/programming what-is-self20003727
Ref: 58e920003727
Node: あるオブジェクトが、与えられたクラスやそのサブクラスのインスタンスであるかを調べるにはどうしますか？20004349
Ref: faq/programming how-do-i-check-if-an-object-is-an-instance-of-a-given-class-or-of-a-subclass-of-it20004625
Ref: 58eb20004625
Node: 委譲とは何ですか？20007374
Ref: faq/programming what-is-delegation20007765
Ref: 58ec20007765
Node: 基底クラスで定義されたメソッドを、そのクラスを継承した派生クラスから呼び出すにはどうしますか？20010224
Ref: faq/programming how-do-i-call-a-method-defined-in-a-base-class-from-a-derived-class-that-extends-it20010552
Ref: 58ed20010552
Node: 基底クラスの名前を変えやすいコードを書くにはどうしますか？20011277
Ref: faq/programming how-can-i-organize-my-code-to-make-it-easier-to-change-the-base-class20011674
Ref: 58ee20011674
Node: 静的なクラスデータや静的なクラスメソッドを作るにはどうしますか？20012353
Ref: faq/programming how-do-i-create-static-class-data-and-static-class-methods20012726
Ref: 58ef20012726
Node: Python でコンストラクタ やメソッド をオーバーロードするにはどうしたらいいですか？20014699
Ref: faq/programming how-can-i-overload-constructors-or-methods-in-python20015071
Ref: 58f020015071
Node: __spam を使おうとしたら _SomeClassName__spam からエラーがでました。20016259
Ref: faq/programming i-try-to-use-spam-and-i-get-an-error-about-someclassname-spam20016667
Ref: 58f120016667
Node: クラスに __del__ メソッドを定義しているのですが、オブジェクトを削除したときに呼ばれません。20018022
Ref: faq/programming my-class-defines-del-but-it-is-not-called-when-i-delete-the-object20018418
Ref: 58f220018418
Node: 与えられたクラスのすべてのインスタンスのリストを得るにはどうしますか？20021005
Ref: faq/programming how-do-i-get-a-list-of-all-instances-of-a-given-class20021383
Ref: 58f320021383
Node: なぜ id の結果は一意でないように見えるのですか?20021866
Ref: faq/programming why-does-the-result-of-id-appear-to-be-not-unique20022176
Ref: 58f420022176
Node: いつ is 演算子での同一性テストが頼れますか？20023292
Ref: faq/programming faq-identity-with-is20023626
Ref: 248020023626
Ref: faq/programming when-can-i-rely-on-identity-tests-with-the-is-operator20023626
Ref: 58f520023626
Ref: いつ is 演算子での同一性テストが頼れますか？-Footnote-120027489
Node: どうすればサブクラスはイミュータブルなインスタンスに格納されたデータを制御できますか？20027531
Ref: faq/programming how-can-a-subclass-control-what-data-is-stored-in-an-immutable-instance20027885
Ref: 58f620027885
Node: メソッド呼び出しをキャッシュするには どうしたらいいですか？20029549
Ref: faq/programming faq-cache-method-calls20029830
Ref: 2baf20029830
Ref: faq/programming how-do-i-cache-method-calls20029830
Ref: 58f720029830
Node: モジュール<5>20033396
Ref: faq/programming modules20033503
Ref: 58f820033503
Node: pyc ファイルを作るにはどうしますか？20034190
Ref: faq/programming how-do-i-create-a-pyc-file20034369
Ref: 58f920034369
Ref: pyc ファイルを作るにはどうしますか？-Footnote-120037790
Node: 現在のモジュール名を知るにはどうしますか？20037832
Ref: faq/programming how-do-i-find-the-current-module-name20038116
Ref: 58fa20038116
Node: 相互にインポートしあうモジュールを作るにはどうしたらいいですか？20038880
Ref: faq/programming how-can-i-have-modules-that-mutually-import-each-other20039213
Ref: 58fb20039213
Node: __import__ 'x y z' は <module 'x'> を返しますが、z を得るためにはどうしますか？20041920
Ref: faq/programming import-x-y-z-returns-module-x-how-do-i-get-z20042331
Ref: 58fc20042331
Node: インポートされたモジュールを編集してから再インポートしましたが、変化が現れません。なぜですか？20042747
Ref: faq/programming when-i-edit-an-imported-module-and-reimport-it-the-changes-don-t-show-up-why-does-this-happen20043053
Ref: 58fd20043053
Node: デザインと歴史 FAQ20044880
Ref: faq/design doc20045038
Ref: 58fe20045038
Ref: faq/design design-and-history-faq20045038
Ref: 58ff20045038
Ref: faq/design translation-repo20045038
Ref: 590020045038
Node: Python はなぜ文のグループ化にインデントを使うのですか？20047976
Ref: faq/design why-does-python-use-indentation-for-grouping-of-statements20048195
Ref: 590120048195
Node: なぜ単純な算術演算が奇妙な結果になるのですか？20050400
Ref: faq/design why-am-i-getting-strange-results-with-simple-arithmetic-operations20050703
Ref: 590220050703
Node: なぜ浮動小数点数の計算はこんなに不正確なんですか？20050879
Ref: faq/design why-are-floating-point-calculations-so-inaccurate20051171
Ref: 590320051171
Node: なぜ Python の文字列はイミュータブルなのですか？20052973
Ref: faq/design why-are-python-strings-immutable20053309
Ref: 590420053309
Node: なぜメソッドの定義や呼び出しにおいて 'self' を明示しなければならないのですか？20054047
Ref: faq/design why-must-self-be-used-explicitly-in-method-definitions-and-calls20054362
Ref: 590520054362
Ref: faq/design why-self20054362
Ref: 58ea20054362
Node: 式中で代入ができないのはなぜですか？20057556
Ref: faq/design id220057927
Ref: 590620057927
Ref: faq/design why-can-t-i-use-an-assignment-in-an-expression20057927
Ref: 203820057927
Ref: 式中で代入ができないのはなぜですか？-Footnote-120058323
Node: Python にメソッドを使う機能 list index 等 と関数を使う機能 len list 等 があるのはなぜですか？20058365
Ref: faq/design why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list20058730
Ref: 590720058730
Node: join がリストやタプルのメソッドではなく文字列のメソッドなのはなぜですか？20060074
Ref: faq/design why-is-join-a-string-method-instead-of-a-list-or-tuple-method20060430
Ref: 590820060430
Node: 例外はどれくらい速いのですか？20062755
Ref: faq/design how-fast-are-exceptions20063050
Ref: 590920063050
Node: Python に switch や case 文がないのはなぜですか？20064080
Ref: faq/design why-isn-t-there-a-switch-or-case-statement-in-python20064409
Ref: 590a20064409
Node: OS 特有のスレッド実装に依らずにインタプリタでスレッドをエミュレートすることはできないのですか？20066118
Ref: faq/design can-t-you-emulate-threads-in-the-interpreter-instead-of-relying-on-an-os-specific-thread-implementation20066469
Ref: 590b20066469
Ref: OS 特有のスレッド実装に依らずにインタプリタでスレッドをエミュレートすることはできないのですか？-Footnote-120067323
Node: なぜラムダ式は文を含むことができないのですか?20067379
Ref: faq/design why-can-t-lambda-expressions-contain-statements20067758
Ref: 590c20067758
Node: Python は C やその他の言語のように機械語にコンパイルできますか？20068795
Ref: faq/design can-python-be-compiled-to-machine-code-c-or-some-other-language20069097
Ref: 590d20069097
Ref: Python は C やその他の言語のように機械語にコンパイルできますか？-Footnote-120069510
Ref: Python は C やその他の言語のように機械語にコンパイルできますか？-Footnote-220069538
Node: Python はメモリをどのように管理するのですか？20069566
Ref: faq/design how-does-python-manage-memory20069902
Ref: 590e20069902
Ref: Python はメモリをどのように管理するのですか？-Footnote-120071940
Ref: Python はメモリをどのように管理するのですか？-Footnote-220071971
Node: CPython はなぜ伝統的なガベージコレクションスキームを使わないのですか？20071996
Ref: faq/design why-doesn-t-cpython-use-a-more-traditional-garbage-collection-scheme20072343
Ref: 590f20072343
Node: なぜ CPython の終了時にすべてのメモリが解放されるわけではないのですか？20073635
Ref: faq/design why-isn-t-all-memory-freed-when-cpython-exits20074011
Ref: 591020074011
Node: なぜタプルとリストという別のデータ型が用意されているのですか？20075021
Ref: faq/design why-are-there-separate-tuple-and-list-data-types20075369
Ref: 591120075369
Node: CPythonでリストはどのように実装されているのですか？20076892
Ref: faq/design how-are-lists-implemented-in-cpython20077202
Ref: 591220077202
Node: CPythonで辞書はどのように実装されていますか？20078236
Ref: faq/design how-are-dictionaries-implemented-in-cpython20078540
Ref: 591320078540
Node: なぜ辞書のキーはイミュータブルでなくてはならないのですか？20079727
Ref: faq/design why-must-dictionary-keys-be-immutable20080035
Ref: 591420080035
Node: なぜ list sort はソートされたリストを返さないのですか？20085373
Ref: faq/design why-doesn-t-list-sort-return-the-sorted-list20085714
Ref: 591520085714
Node: Python ではどのようにインターフェース仕様を特定し適用するのですか？20086862
Ref: faq/design how-do-you-specify-and-enforce-an-interface-spec-in-python20087152
Ref: 591620087152
Node: なぜ goto が無いのですか？20090180
Ref: faq/design why-is-there-no-goto20090496
Ref: 591720090496
Node: なぜ raw 文字列 r-strings はバックスラッシュで終わってはいけないのですか？20091907
Ref: faq/design why-can-t-raw-strings-r-strings-end-with-a-backslash20092194
Ref: 591820092194
Node: 属性の代入に "with" 文が使えないのはなぜですか？20093733
Ref: faq/design why-doesn-t-python-have-a-with-statement-for-attribute-assignments20094059
Ref: 591920094059
Node: なぜジェネレータは with 文をサポートしないのですか？20096954
Ref: faq/design why-don-t-generators-support-the-with-statement20097247
Ref: 591a20097247
Node: if/while/def/class 文にコロンが必要なのはなぜですか？20097808
Ref: faq/design why-are-colons-required-for-the-if-while-def-class-statements20098131
Ref: 591b20098131
Node: なぜ Python ではリストやタプルの最後にカンマがあっても良いのですか？20098961
Ref: faq/design why-does-python-allow-commas-at-the-end-of-lists-and-tuples20099200
Ref: 591c20099200
Node: ライブラリと拡張 FAQ20100623
Ref: faq/library doc20100781
Ref: 591d20100781
Ref: faq/library library-and-extension-faq20100781
Ref: 591e20100781
Ref: faq/library translation-repo20100781
Ref: 591f20100781
Node: ライブラリ一般の質問20101072
Ref: faq/library general-library-questions20101194
Ref: 592020101194
Node: 作業 X を行うためのモジュールやアプリケーションを探すにはどうしますか？20101942
Ref: faq/library how-do-i-find-a-module-or-application-to-perform-task-x20102208
Ref: 592120102208
Ref: 作業 X を行うためのモジュールやアプリケーションを探すにはどうしますか？-Footnote-120103072
Ref: 作業 X を行うためのモジュールやアプリケーションを探すにはどうしますか？-Footnote-220103097
Node: math py socket py regex py etc のソースファイルはどこにありますか？20103128
Ref: faq/library where-is-the-math-py-socket-py-regex-py-etc-source-file20103488
Ref: 592220103488
Node: Python のスクリプトを Unix で実行可能にするにはどうしますか？20104610
Ref: faq/library how-do-i-make-a-python-script-executable-on-unix20104930
Ref: 592320104930
Node: Python には curses/termcap パッケージはありますか？20106890
Ref: faq/library is-there-a-curses-termcap-package-for-python20107194
Ref: 592420107194
Ref: Python には curses/termcap パッケージはありますか？-Footnote-120108265
Node: Python には C の onexit に相当するものはありますか？20108325
Ref: faq/library is-there-an-equivalent-to-c-s-onexit-in-python20108613
Ref: 592520108613
Node: シグナルハンドラが動かないのですがなぜですか？20108873
Ref: faq/library why-don-t-my-signal-handlers-work20109087
Ref: 592620109087
Node: よくある作業20109545
Ref: faq/library common-tasks20109688
Ref: 592720109688
Node: Python のプログラムやコンポーネントをテストするにはどうしますか？20110023
Ref: faq/library how-do-i-test-a-python-program-or-component20110284
Ref: 592820110284
Node: Python のドキュメント文字列からドキュメントを生成するにはどうしますか？20112982
Ref: faq/library how-do-i-create-documentation-from-doc-strings20113318
Ref: 592920113318
Ref: Python のドキュメント文字列からドキュメントを生成するにはどうしますか？-Footnote-120113880
Ref: Python のドキュメント文字列からドキュメントを生成するにはどうしますか？-Footnote-220113920
Node: 一度に一つの押鍵を取得するにはどうしますか？20113955
Ref: faq/library how-do-i-get-a-single-keypress-at-a-time20114188
Ref: 592a20114188
Node: スレッド20114501
Ref: faq/library threads20114632
Ref: 592b20114632
Node: スレッドを使ったプログラムを書くにはどうしますか？20115285
Ref: faq/library how-do-i-program-using-threads20115499
Ref: 592c20115499
Node: スレッドが一つも実行されていないようです。なぜですか？20115934
Ref: faq/library none-of-my-threads-seem-to-run-why20116247
Ref: 592d20116247
Node: たくさんのワーカースレッドに作業を割り振るにはどうしますか？20118226
Ref: faq/library how-do-i-parcel-out-work-among-a-bunch-of-worker-threads20118560
Ref: 592e20118560
Node: グローバルな値のどんな種類の変更がスレッドセーフになるのですか？20121530
Ref: faq/library what-kinds-of-global-value-mutation-are-thread-safe20121901
Ref: 592f20121901
Node: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？20123842
Ref: faq/library can-t-we-get-rid-of-the-global-interpreter-lock20124114
Ref: 593020124114
Ref: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？-Footnote-120127581
Ref: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？-Footnote-220127623
Ref: グローバルインタプリタロック Global Interpreter Lock を取り除くことはできないのですか？-Footnote-320127666
Node: 入力と出力<2>20127726
Ref: faq/library input-and-output20127900
Ref: 593120127900
Node: ファイルを削除するにはどうしますか？ その他、ファイルに関する質問20128898
Ref: faq/library how-do-i-delete-a-file-and-other-file-questions20129116
Ref: 593220129116
Node: ファイルをコピーするにはどうしますか？20130859
Ref: faq/library how-do-i-copy-a-file20131155
Ref: 593320131155
Ref: ファイルをコピーするにはどうしますか？-Footnote-120131870
Ref: ファイルをコピーするにはどうしますか？-Footnote-220131941
Node: バイナリデータを読み書きするにはどうしますか？20131993
Ref: faq/library how-do-i-read-or-write-binary-data20132303
Ref: 593420132303
Node: os popen によって作られたパイプで os read が使われていないようです。なぜですか？20133953
Ref: faq/library i-can-t-seem-to-use-os-read-on-a-pipe-created-with-os-popen-why20134282
Ref: 593520134282
Node: シリアル RS232 ポートにアクセスするにはどうしますか？20135016
Ref: faq/library how-do-i-access-the-serial-rs232-port20135378
Ref: 593620135378
Ref: シリアル RS232 ポートにアクセスするにはどうしますか？-Footnote-120135801
Node: sys stdout stdin stderr を閉じようとしても実際に閉じられないのはなぜですか？20135844
Ref: faq/library why-doesn-t-closing-sys-stdout-stdin-stderr-really-close-it20136086
Ref: 593720136086
Node: ネットワーク/インターネットプログラミング20137818
Ref: faq/library network-internet-programming20137998
Ref: 593820137998
Node: Python の WWW ツールには何がありますか？20138550
Ref: faq/library what-www-tools-are-there-for-python20138777
Ref: 593920138777
Node: どのモジュールが HTML の生成の役に立ちますか？20139445
Ref: faq/library what-module-should-i-use-to-help-with-generating-html20139757
Ref: 593a20139757
Ref: どのモジュールが HTML の生成の役に立ちますか？-Footnote-120140036
Node: Python のスクリプトからメールを送るにはどうしますか？20140088
Ref: faq/library how-do-i-send-mail-from-a-python-script20140448
Ref: 593b20140448
Node: ソケットの connect メソッドでブロッキングされなくするにはどうしますか？20142077
Ref: faq/library how-do-i-avoid-blocking-in-the-connect-method-of-a-socket20142362
Ref: 593c20142362
Ref: ソケットの connect メソッドでブロッキングされなくするにはどうしますか？-Footnote-120144121
Node: データベース20144150
Ref: faq/library databases20144324
Ref: 593d20144324
Node: Python にはデータベースパッケージへのインターフェースはありますか？20144570
Ref: faq/library are-there-any-interfaces-to-database-packages-in-python20144813
Ref: 593e20144813
Ref: Python にはデータベースパッケージへのインターフェースはありますか？-Footnote-120145494
Node: Python で永続的なオブジェクトを実装するにはどうしますか？20145551
Ref: faq/library how-do-you-implement-persistent-objects-in-python20145794
Ref: 593f20145794
Node: 数学と数20146365
Ref: faq/library mathematics-and-numerics20146469
Ref: 594020146469
Node: Python で乱数を生成するにはどうしますか？20146579
Ref: faq/library how-do-i-generate-random-numbers-in-python20146686
Ref: 594120146686
Node: 拡張と埋め込み FAQ20147875
Ref: faq/extending doc20148033
Ref: 594220148033
Ref: faq/extending extending-embedding-faq20148033
Ref: 594320148033
Ref: faq/extending translation-repo20148033
Ref: 594420148033
Node: C で独自の関数を作ることはできますか？20150215
Ref: faq/extending can-i-create-my-own-functions-in-c20150400
Ref: 594520150400
Node: C++ で独自の関数を作ることはできますか？20150855
Ref: faq/extending id220151117
Ref: 594620151117
Node: C を書くのは大変です。他の方法はありませんか？20151593
Ref: faq/extending c-wrapper-software20151869
Ref: 594720151869
Ref: faq/extending writing-c-is-hard-are-there-any-alternatives20151869
Ref: 594820151869
Node: C から任意の Python 文を実行するにはどうしますか？20152251
Ref: faq/extending how-can-i-execute-arbitrary-python-statements-from-c20152539
Ref: 594920152539
Node: C から任意の Python 式を評価するにはどうしますか？20153179
Ref: faq/extending how-can-i-evaluate-an-arbitrary-python-expression-from-c20153481
Ref: 594a20153481
Node: Python オブジェクトから C の値を取り出すにはどうしますか？20153831
Ref: faq/extending how-do-i-extract-c-values-from-a-python-object20154137
Ref: 594b20154137
Node: Py_BuildValue で任意長のタプルを作るにはどうしますか？20155786
Ref: faq/extending how-do-i-use-py-buildvalue-to-create-a-tuple-of-arbitrary-length20156105
Ref: 594c20156105
Node: C からオブジェクトのメソッドを呼び出すにはどうしますか？20156342
Ref: faq/extending how-do-i-call-an-object-s-method-from-c20156694
Ref: 594d20156694
Node: PyErr_Print その他 stdout/stderr に印字するもの からの出力を受け取るにはどうしますか？20158193
Ref: faq/extending how-do-i-catch-the-output-from-pyerr-print-or-anything-that-prints-to-stdout-stderr20158565
Ref: 594e20158565
Node: C から Python で書かれたモジュールにアクセスするにはどうしますか？20160001
Ref: faq/extending how-do-i-access-a-module-written-in-python-from-c20160368
Ref: 594f20160368
Node: Python から C++ へインターフェースするにはどうしますか？20161539
Ref: faq/extending how-do-i-interface-to-c-objects-from-python20161920
Ref: 595020161920
Node: セットアップファイルでモジュールを追加しようとしたらメイクに失敗しました。なぜですか？20162689
Ref: faq/extending i-added-a-module-using-the-setup-file-and-the-make-fails-why20163030
Ref: 595120163030
Node: 拡張をデバッグするにはどうしますか？20163582
Ref: faq/extending how-do-i-debug-an-extension20163997
Ref: 595220163997
Node: Linux システムで Python モジュールをコンパイルしたいのですが、見つからないファイルがあります。なぜですか？20164659
Ref: faq/extending i-want-to-compile-a-python-module-on-my-linux-system-but-some-files-are-missing-why20165057
Ref: 595320165057
Node: "不完全 incomplete な入力" を "不適切 invalid な入力" から区別するにはどうしますか？20165550
Ref: faq/extending how-do-i-tell-incomplete-input-from-invalid-input20165999
Ref: 595420165999
Node: 未定義の g++ シンボル __builtin_new や __pure_virtual を見つけるにはどうしますか？20167288
Ref: faq/extending how-do-i-find-undefined-g-symbols-builtin-new-or-pure-virtual20167742
Ref: 595520167742
Node: メソッドのいくつかは C で、その他は Python で実装されたオブジェクトクラスを 継承などで 作ることはできますか？20168242
Ref: faq/extending can-i-create-an-object-class-with-some-methods-implemented-in-c-and-others-in-python-e-g-through-inheritance20168575
Ref: 595620168575
Node: Windows 上の Python FAQ20169226
Ref: faq/windows doc20169411
Ref: 595720169411
Ref: faq/windows python-on-windows-faq20169411
Ref: 595820169411
Ref: faq/windows translation-repo20169411
Ref: 595920169411
Ref: faq/windows windows-faq20169411
Ref: 595a20169411
Node: Python プログラムを Windows で動かすにはどうしますか？20170381
Ref: faq/windows faq-run-program-under-windows20170598
Ref: 595b20170598
Ref: faq/windows how-do-i-run-a-python-program-under-windows20170598
Ref: 595c20170598
Node: Python スクリプトを実行可能にするにはどうしますか？20175148
Ref: faq/windows how-do-i-make-python-scripts-executable20175450
Ref: 595d20175450
Node: Python の起動に時間がかかることがあるのはなぜですか？20176154
Ref: faq/windows why-does-python-sometimes-take-so-long-to-start20176448
Ref: 595e20176448
Node: どうすれば Python スクリプトを EXE に出来ますか?20177496
Ref: faq/windows how-do-i-make-an-executable-from-a-python-script20177764
Ref: 595f20177764
Node: * pyd ファイルは DLL と同じですか？20178094
Ref: faq/windows is-a-pyd-file-the-same-as-a-dll20178383
Ref: 596020178383
Node: Python を Windows アプリケーションに埋め込むにはどうしたらいいですか？20179647
Ref: faq/windows how-can-i-embed-python-into-a-windows-application20179981
Ref: 596120179981
Node: エディタが Python ソースにタブを勝手に挿入しないようにするにはどうしますか？20185622
Ref: faq/windows how-do-i-keep-editors-from-inserting-tabs-into-my-python-source20185987
Ref: 596220185987
Ref: エディタが Python ソースにタブを勝手に挿入しないようにするにはどうしますか？-Footnote-120187301
Node: ブロックすることなく押鍵を検出するにはどうしますか？20187343
Ref: faq/windows how-do-i-check-for-a-keypress-without-blocking20187704
Ref: 596320187704
Node: missing api-ms-win-crt-runtime-l1-1-0 dll エラーを解決するにはどうしますか？20188142
Ref: faq/windows how-do-i-solve-the-missing-api-ms-win-crt-runtime-l1-1-0-dll-error20188384
Ref: 596420188384
Ref: missing api-ms-win-crt-runtime-l1-1-0 dll エラーを解決するにはどうしますか？-Footnote-120189082
Node: グラフィックユーザインターフェース FAQ20189140
Ref: faq/gui doc20189398
Ref: 596520189398
Ref: faq/gui graphic-user-interface-faq20189398
Ref: 596620189398
Ref: faq/gui translation-repo20189398
Ref: 596720189398
Node: 一般的な GUI の質問20189635
Ref: faq/gui general-gui-questions20189825
Ref: 596820189825
Node: Python の GUI ツールキットには何がありますか？20189887
Ref: faq/gui what-gui-toolkits-exist-for-python20190103
Ref: 596920190103
Ref: Python の GUI ツールキットには何がありますか？-Footnote-120191151
Ref: Python の GUI ツールキットには何がありますか？-Footnote-220191193
Ref: Python の GUI ツールキットには何がありますか？-Footnote-320191220
Ref: Python の GUI ツールキットには何がありますか？-Footnote-420191299
Node: Tkinter の質問20191381
Ref: faq/gui tkinter-questions20191562
Ref: 596a20191562
Node: Tkinter アプリケーションを凍結するにはどうしますか？20191863
Ref: faq/gui how-do-i-freeze-tkinter-applications20192068
Ref: 596b20192068
Node: I/O を待つ間に扱われる Tk イベントを作れますか？20192789
Ref: faq/gui can-i-have-tk-events-handled-while-waiting-for-i-o20193089
Ref: 596c20193089
Node: Tkinter で働くキーバインディングが得られません。なぜですか？20193720
Ref: faq/gui i-can-t-get-key-bindings-to-work-in-tkinter-why20193937
Ref: 596d20193937
Node: "なぜ Python が私のコンピュータにインストールされているのですか？" FAQ20194789
Ref: faq/installed doc20195013
Ref: 596e20195013
Ref: faq/installed translation-repo20195013
Ref: 596f20195013
Ref: faq/installed why-is-python-installed-on-my-computer-faq20195013
Ref: 597020195013
Node: Python とは何ですか？<2>20195405
Ref: faq/installed what-is-python20195663
Ref: 597120195663
Ref: Python とは何ですか？<2>-Footnote-120196301
Node: なぜ Python が私のマシンにインストールされているのですか？20196353
Ref: faq/installed why-is-python-installed-on-my-machine20196663
Ref: 597220196663
Node: Python を削除してもいいですか？20198295
Ref: faq/installed can-i-delete-python20198565
Ref: 597320198565
Node: 非推奨<14>20199698
Ref: deprecations/index doc20199806
Ref: 597420199806
Ref: deprecations/index deprecations20199806
Ref: 597520199806
Ref: deprecations/index translation-repo20199806
Ref: 597620199806
Node: Pending removal in Python 3 15<7>20200285
Ref: deprecations/index pending-removal-in-python-3-1520200410
Ref: 597720200410
Ref: Pending removal in Python 3 15<7>-Footnote-120204959
Ref: Pending removal in Python 3 15<7>-Footnote-220205014
Ref: Pending removal in Python 3 15<7>-Footnote-320205069
Ref: Pending removal in Python 3 15<7>-Footnote-420205124
Ref: Pending removal in Python 3 15<7>-Footnote-520205180
Ref: Pending removal in Python 3 15<7>-Footnote-620205222
Ref: Pending removal in Python 3 15<7>-Footnote-720205278
Node: Pending removal in Python 3 16<7>20205334
Ref: deprecations/index pending-removal-in-python-3-1620205501
Ref: 597820205501
Ref: Pending removal in Python 3 16<7>-Footnote-120209736
Ref: Pending removal in Python 3 16<7>-Footnote-220209792
Ref: Pending removal in Python 3 16<7>-Footnote-320209848
Ref: Pending removal in Python 3 16<7>-Footnote-420209904
Node: Pending removal in Python 3 17<4>20209959
Ref: deprecations/index pending-removal-in-python-3-1720210126
Ref: 597920210126
Ref: Pending removal in Python 3 17<4>-Footnote-120213054
Ref: Pending removal in Python 3 17<4>-Footnote-220213112
Ref: Pending removal in Python 3 17<4>-Footnote-320213167
Ref: Pending removal in Python 3 17<4>-Footnote-420213225
Node: Pending removal in Python 3 18<5>20213280
Ref: deprecations/index pending-removal-in-python-3-1820213447
Ref: 597a20213447
Ref: Pending removal in Python 3 18<5>-Footnote-120213867
Node: Pending removal in Python 3 19<3>20213922
Ref: deprecations/index pending-removal-in-python-3-1920214093
Ref: 597b20214093
Node: Pending removal in future versions<7>20214365
Ref: deprecations/index pending-removal-in-future-versions20214521
Ref: 597c20214521
Ref: Pending removal in future versions<7>-Footnote-120221712
Ref: Pending removal in future versions<7>-Footnote-220221767
Ref: Pending removal in future versions<7>-Footnote-320221823
Ref: Pending removal in future versions<7>-Footnote-420221879
Ref: Pending removal in future versions<7>-Footnote-520221935
Ref: Pending removal in future versions<7>-Footnote-620221990
Ref: Pending removal in future versions<7>-Footnote-720222045
Node: C API deprecations20222101
Ref: deprecations/index c-api-deprecations20222215
Ref: 597d20222215
Node: Pending removal in Python 3 15<8>20222489
Ref: deprecations/index id120222619
Ref: 597e20222619
Ref: Pending removal in Python 3 15<8>-Footnote-120229264
Ref: Pending removal in Python 3 15<8>-Footnote-220229317
Node: Pending removal in Python 3 18<6>20229370
Ref: deprecations/index id220229546
Ref: 597f20229546
Ref: Pending removal in Python 3 18<6>-Footnote-120232217
Ref: Pending removal in Python 3 18<6>-Footnote-220232270
Node: Pending removal in future versions<8>20232326
Ref: deprecations/index id320232460
Ref: 598020232460
Node: 用語集<2>20234295
Ref: glossary doc20234414
Ref: 598120234414
Ref: glossary glossary20234414
Ref: 1fbf20234414
Ref: glossary id120234414
Ref: 598220234414
Ref: glossary translation-repo20234414
Ref: 598320234414
Ref: glossary term-020234438
Ref: 49220234438
Ref: glossary term-20234646
Ref: 49320234646
Ref: glossary term-abstract-base-class20235154
Ref: 13ce20235154
Ref: glossary term-annotate-function20236288
Ref: 15d20236288
Ref: glossary term-annotation20236588
Ref: 15c20236588
Ref: glossary term-argument20237414
Ref: 67b20237414
Ref: glossary term-asynchronous-context-manager20239006
Ref: 7f020239006
Ref: glossary term-asynchronous-generator20239315
Ref: 249b20239315
Ref: glossary term-asynchronous-generator-iterator20240210
Ref: 491820240210
Ref: glossary term-asynchronous-iterable20241140
Ref: f7420241140
Ref: glossary term-asynchronous-iterator20241456
Ref: 4c720241456
Ref: glossary term-atomic-operation20241990
Ref: 261520241990
Ref: glossary term-attached-thread-state20242472
Ref: 4ed120242472
Ref: glossary term-attribute20243535
Ref: 290c20243535
Ref: glossary term-awaitable20244270
Ref: 4c920244270
Ref: glossary term-BDFL20244541
Ref: 598720244541
Ref: glossary term-binary-file20244691
Ref: 206e20244691
Ref: glossary term-borrowed-reference20245364
Ref: 3d720245364
Ref: glossary term-bytes-like-object20246070
Ref: 19320246070
Ref: glossary term-bytecode20247426
Ref: 4aa20247426
Ref: glossary term-callable20248397
Ref: 2d7b20248397
Ref: glossary term-callback20248791
Ref: 2d9c20248791
Ref: glossary term-class20248916
Ref: 1cfd20248916
Ref: glossary term-class-variable20249168
Ref: 598820249168
Ref: glossary term-closure-variable20249390
Ref: 189320249390
Ref: glossary term-complex-number20250485
Ref: 598920250485
Ref: glossary term-concurrency20251293
Ref: 598a20251293
Ref: glossary term-concurrent-modification20251867
Ref: 598c20251867
Ref: glossary term-context20252140
Ref: 196320252140
Ref: glossary term-context-management-protocol20252730
Ref: 196520252730
Ref: glossary term-context-manager20252905
Ref: 1e120252905
Ref: glossary term-context-variable20253095
Ref: 598d20253095
Ref: glossary term-contiguous20253387
Ref: 124e20253387
Ref: glossary term-coroutine20254062
Ref: 6b920254062
Ref: glossary term-coroutine-function20254522
Ref: f7320254522
Ref: glossary term-CPython20254901
Ref: 90520254901
Ref: glossary term-current-context20255187
Ref: 196420255187
Ref: glossary term-cyclic-isolate20255659
Ref: 55e420255659
Ref: glossary term-data-race20255987
Ref: 598620255987
Ref: glossary term-deadlock20256621
Ref: 599320256621
Ref: glossary term-decorator20257292
Ref: 93a20257292
Ref: glossary term-descriptor20258092
Ref: 188120258092
Ref: glossary term-dictionary20258992
Ref: 23d520258992
Ref: glossary term-dictionary-comprehension20259198
Ref: 599520259198
Ref: glossary term-dictionary-view20259639
Ref: 298e20259639
Ref: glossary term-docstring20260158
Ref: 22ec20260158
Ref: glossary term-duck-typing20260555
Ref: 598420260555
Ref: glossary term-dunder20261565
Ref: 599620261565
Ref: glossary term-EAFP20261755
Ref: 307920261755
Ref: glossary term-evaluate-function20262468
Ref: 44ef20262468
Ref: glossary term-expression20262667
Ref: 23cf20262667
Ref: glossary term-extension-module20263225
Ref: 225120263225
Ref: glossary term-f-string20263423
Ref: 66b20263423
Ref: glossary term-f-strings20263433
Ref: 599820263433
Ref: glossary term-file-object20263621
Ref: 13db20263621
Ref: glossary term-file-like-object20264548
Ref: 17ac20264548
Ref: glossary term-filesystem-encoding-and-error-handler20264616
Ref: 75d20264616
Ref: glossary term-finder20265778
Ref: 236a20265778
Ref: glossary term-floor-division20266240
Ref: b3e20266240
Ref: glossary term-free-threading20266783
Ref: 1f420266783
Ref: glossary term-free-threaded-build20267078
Ref: 176d20267078
Ref: glossary term-free-variable20267317
Ref: 242820267317
Ref: glossary term-function20267746
Ref: 24b720267746
Ref: glossary term-function-annotation20268101
Ref: 201920268101
Ref: glossary term-__future__20268987
Ref: fad20268987
Ref: glossary term-garbage-collection20269784
Ref: 17d820269784
Ref: glossary term-generator20270195
Ref: 126c20270195
Ref: glossary term-generator-iterator20270882
Ref: dd920270882
Ref: glossary term-generator-expression20271333
Ref: 599920271333
Ref: glossary term-generic-function20271789
Ref: be420271789
Ref: glossary term-generic-type20272195
Ref: 1a120272195
Ref: glossary term-GIL20272558
Ref: 16420272558
Ref: glossary term-global-interpreter-lock20272636
Ref: 47420272636
Ref: glossary term-global-state20274360
Ref: 599a20274360
Ref: glossary term-hash-based-pyc20274717
Ref: 599b20274717
Ref: glossary term-hashable20275084
Ref: 82420275084
Ref: glossary term-IDLE20276294
Ref: 599c20276294
Ref: glossary term-immortal20276621
Ref: 29020276621
Ref: glossary term-immutable20277137
Ref: 15b920277137
Ref: glossary term-import-path20277698
Ref: 244a20277698
Ref: glossary term-importing20278050
Ref: 243c20278050
Ref: glossary term-importer20278201
Ref: 244820278201
Ref: glossary term-index20278376
Ref: 23e320278376
Ref: glossary term-interactive20278815
Ref: 1b520278815
Ref: glossary term-interpreted20279303
Ref: 599e20279303
Ref: glossary term-interpreter-shutdown20280016
Ref: 47920280016
Ref: glossary term-iterable20281018
Ref: 12f120281018
Ref: glossary term-iterator20282553
Ref: 4c820282553
Ref: glossary term-key20284343
Ref: 23e420284343
Ref: glossary term-key-function20284453
Ref: 100620284453
Ref: glossary term-keyword-argument20285753
Ref: f0e20285753
Ref: glossary term-lambda20285829
Ref: 2bb320285829
Ref: glossary term-LBYL20286079
Ref: 599720286079
Ref: glossary term-lexical-analyzer20286918
Ref: 229220286918
Ref: glossary term-list20286998
Ref: 599f20286998
Ref: glossary term-list-comprehension20287182
Ref: 8dd20287182
Ref: glossary term-lock20287754
Ref: 598f20287754
Ref: glossary term-lock-free20288574
Ref: 261720288574
Ref: glossary term-loader20289161
Ref: 1a2820289161
Ref: glossary term-locale-encoding20289537
Ref: 54a20289537
Ref: glossary term-magic-method20290018
Ref: 466720290018
Ref: glossary term-mapping20290100
Ref: 13d320290100
Ref: glossary term-meta-path-finder20290581
Ref: 127c20290581
Ref: glossary term-metaclass20290931
Ref: 23d020290931
Ref: glossary term-method20291989
Ref: 186420291989
Ref: glossary term-method-resolution-order20292445
Ref: 25df20292445
Ref: glossary term-module20292731
Ref: 19de20292731
Ref: glossary term-module-spec20293116
Ref: 236320293116
Ref: glossary term-MRO20293375
Ref: 18dd20293375
Ref: glossary term-mutable20293454
Ref: 15ba20293454
Ref: glossary term-named-tuple20293834
Ref: 85e20293834
Ref: glossary term-namespace20295157
Ref: 203f20295157
Ref: glossary term-namespace-package20296099
Ref: 2b220296099
Ref: glossary term-native-code20296709
Ref: 599120296709
Ref: glossary term-nested-scope20297098
Ref: 238d20297098
Ref: glossary term-new-style-class20297807
Ref: 2d0a20297807
Ref: glossary term-non-deterministic20298132
Ref: 598e20298132
Ref: glossary term-object20298590
Ref: 59a020298590
Ref: glossary term-optimized-scope20298838
Ref: 4a120298838
Ref: glossary term-optional-module20299369
Ref: 215a20299369
Ref: glossary term-package20299790
Ref: 23320299790
Ref: glossary term-parallelism20300166
Ref: 598b20300166
Ref: glossary term-parameter20300689
Ref: 234b20300689
Ref: glossary positional-only-parameter20301281
Ref: c7820301281
Ref: glossary keyword-only-parameter20301703
Ref: 5a520301703
Ref: glossary term-per-object-lock20303299
Ref: 261620303299
Ref: glossary term-path-entry20303857
Ref: 245820303857
Ref: glossary term-path-entry-finder20304007
Ref: 127d20304007
Ref: glossary term-path-entry-hook20304451
Ref: 245a20304451
Ref: glossary term-path-based-finder20304652
Ref: 244d20304652
Ref: glossary term-path-like-object20304810
Ref: 5a120304810
Ref: glossary term-PEP20305642
Ref: 59a220305642
Ref: glossary term-portion20306417
Ref: 244320306417
Ref: glossary term-positional-argument20306651
Ref: f0f20306651
Ref: glossary term-provisional-API20306746
Ref: 3d120306746
Ref: glossary term-provisional-package20307875
Ref: 124320307875
Ref: glossary term-Python-300020307961
Ref: 59a320307961
Ref: glossary term-Pythonic20308170
Ref: 59a420308170
Ref: glossary term-qualified-name20308870
Ref: 1d2420308870
Ref: glossary term-race-condition20309865
Ref: 598520309865
Ref: glossary term-reference-count20310503
Ref: 4ec920310503
Ref: glossary term-regular-package20311423
Ref: 244020311423
Ref: glossary term-reentrant20311627
Ref: 599420311627
Ref: glossary term-REPL20312556
Ref: 49120312556
Ref: glossary term-__slots__20312688
Ref: 7f720312688
Ref: glossary term-sequence20313219
Ref: 71620313219
Ref: glossary term-set-comprehension20314346
Ref: 59a520314346
Ref: glossary term-single-dispatch20314779
Ref: be320314779
Ref: glossary term-slice20314910
Ref: 24ae20314910
Ref: glossary term-soft-deprecated20315205
Ref: 23d20315205
Ref: glossary term-special-method20315577
Ref: 1c6020315577
Ref: glossary term-standard-library20315975
Ref: 59a120315975
Ref: glossary term-statement20316486
Ref: 2bfc20316486
Ref: glossary term-static-type-checker20316783
Ref: 57420316783
Ref: glossary term-stdlib20316990
Ref: 178620316990
Ref: glossary term-strong-reference20317053
Ref: 5e220317053
Ref: glossary term-subscript20317709
Ref: 599d20317709
Ref: glossary term-synchronization-primitive20318053
Ref: 599020318053
Ref: glossary term-t-string20318767
Ref: 59a620318767
Ref: glossary term-t-strings20318777
Ref: 59a720318777
Ref: glossary term-text-encoding20318942
Ref: 25db20318942
Ref: glossary term-text-file20319452
Ref: 206d20319452
Ref: glossary term-thread-state20320235
Ref: 184620320235
Ref: glossary term-thread-safe20321257
Ref: 599220321257
Ref: glossary term-token20321971
Ref: 228820321971
Ref: glossary term-triple-quoted-string20322358
Ref: 59a820322358
Ref: glossary term-type20322956
Ref: 1cfe20322956
Ref: glossary term-type-alias20323188
Ref: 66e20323188
Ref: glossary term-type-hint20323841
Ref: 23cb20323841
Ref: glossary term-universal-newlines20324483
Ref: f3520324483
Ref: glossary term-variable-annotation20324876
Ref: f5120324876
Ref: glossary term-virtual-environment20325842
Ref: 20ee20325842
Ref: glossary term-virtual-machine20326269
Ref: 3a5b20326269
Ref: glossary term-walrus-operator20326526
Ref: 59a920326526
Ref: glossary term-Zen-of-Python20326708
Ref: 59aa20326708
Ref: 用語集<2>-Footnote-120327012
Ref: 用語集<2>-Footnote-220327054
Ref: 用語集<2>-Footnote-320327096
Ref: 用語集<2>-Footnote-420327138
Ref: 用語集<2>-Footnote-520327180
Ref: 用語集<2>-Footnote-620327222
Ref: 用語集<2>-Footnote-720327264
Ref: 用語集<2>-Footnote-820327306
Ref: 用語集<2>-Footnote-920327348
Ref: 用語集<2>-Footnote-1020327390
Ref: 用語集<2>-Footnote-1120327433
Ref: 用語集<2>-Footnote-1220327472
Ref: 用語集<2>-Footnote-1320327515
Ref: 用語集<2>-Footnote-1420327558
Ref: 用語集<2>-Footnote-1520327601
Ref: 用語集<2>-Footnote-1620327644
Ref: 用語集<2>-Footnote-1720327676
Ref: 用語集<2>-Footnote-1820327719
Ref: 用語集<2>-Footnote-1920327762
Ref: 用語集<2>-Footnote-2020327805
Ref: 用語集<2>-Footnote-2120327848
Ref: 用語集<2>-Footnote-2220327891
Ref: 用語集<2>-Footnote-2320327934
Ref: 用語集<2>-Footnote-2420327977
Ref: 用語集<2>-Footnote-2520328020
Ref: 用語集<2>-Footnote-2620328063
Ref: 用語集<2>-Footnote-2720328106
Ref: 用語集<2>-Footnote-2820328149
Ref: 用語集<2>-Footnote-2920328192
Ref: 用語集<2>-Footnote-3020328235
Ref: 用語集<2>-Footnote-3120328278
Ref: 用語集<2>-Footnote-3220328321
Ref: 用語集<2>-Footnote-3320328364
Ref: 用語集<2>-Footnote-3420328407
Ref: 用語集<2>-Footnote-3520328450
Ref: 用語集<2>-Footnote-3620328510
Ref: 用語集<2>-Footnote-3720328553
Ref: 用語集<2>-Footnote-3820328596
Ref: 用語集<2>-Footnote-3920328639
Ref: 用語集<2>-Footnote-4020328682
Ref: 用語集<2>-Footnote-4120328725
Node: このドキュメントについて20328768
Ref: about doc20328892
Ref: 59ab20328892
Ref: about about-this-documentation20328892
Ref: 59ac20328892
Ref: about translation-repo20328892
Ref: 59ad20328892
Ref: このドキュメントについて-Footnote-120330199
Ref: このドキュメントについて-Footnote-220330235
Ref: このドキュメントについて-Footnote-320330284
Ref: このドキュメントについて-Footnote-420330346
Node: Pythonドキュメントへの貢献者20330387
Ref: about contributors-to-the-python-documentation20330499
Ref: 59ae20330499
Ref: Pythonドキュメントへの貢献者-Footnote-120331081
Node: バグへの対処20331143
Ref: bugs doc20331264
Ref: 59af20331264
Ref: bugs dealing-with-bugs20331264
Ref: 59b020331264
Ref: bugs reporting-bugs20331264
Ref: 4f1920331264
Ref: bugs translation-repo20331264
Ref: 59b120331264
Node: ドキュメントの不備20331825
Ref: bugs documentation-bugs20331959
Ref: 59b320331959
Ref: ドキュメントの不備-Footnote-120333162
Ref: ドキュメントの不備-Footnote-220333211
Ref: ドキュメントの不備-Footnote-320333265
Ref: ドキュメントの不備-Footnote-420333317
Ref: ドキュメントの不備-Footnote-520333403
Ref: ドキュメントの不備-Footnote-620333448
Ref: ドキュメントの不備-Footnote-720333524
Node: Python の課題管理システムを使う20333587
Ref: bugs using-the-python-issue-tracker20333764
Ref: 59b420333764
Ref: bugs using-the-tracker20333764
Ref: 55720333764
Ref: Python の課題管理システムを使う-Footnote-120336542
Ref: Python の課題管理システムを使う-Footnote-220336605
Node: Python への貢献をはじめる20336673
Ref: bugs contributing-to-python20336814
Ref: 59b220336814
Ref: bugs getting-started-contributing-to-python-yourself20336814
Ref: 59b520336814
Ref: Python への貢献をはじめる-Footnote-120337333
Ref: Python への貢献をはじめる-Footnote-220337370
Node: Copyright20337446
Ref: copyright doc20337555
Ref: 59b620337555
Ref: copyright copyright20337555
Ref: 59b720337555
Ref: copyright translation-repo20337555
Ref: 59b820337555
Node: 歴史とライセンス20338111
Ref: license doc20338229
Ref: 59ba20338229
Ref: license history-and-license20338229
Ref: 59b920338229
Ref: license id120338229
Ref: 59bb20338229
Ref: license translation-repo20338229
Ref: 59bc20338229
Node: Python の歴史20338434
Ref: license history-of-the-software20338580
Ref: 59bd20338580
Node: Terms and conditions for accessing or otherwise using Python20343432
Ref: license terms-and-conditions-for-accessing-or-otherwise-using-python20343642
Ref: 59be20343642
Node: PYTHON SOFTWARE FOUNDATION LICENSE VERSION 220344712
Ref: license psf-license20344905
Ref: 59c120344905
Ref: license python-software-foundation-license-version-220344905
Ref: 59c220344905
Node: BEOPEN COM LICENSE AGREEMENT FOR PYTHON 2 020347522
Ref: license beopen-com-license-agreement-for-python-2-020347763
Ref: 59c320347763
Node: CNRI LICENSE AGREEMENT FOR PYTHON 1 6 120350471
Ref: license cnri-license-agreement-for-python-1-6-120350718
Ref: 59c420350718
Node: CWI LICENSE AGREEMENT FOR PYTHON 0 9 0 THROUGH 1 220354896
Ref: license cwi-license-agreement-for-python-0-9-0-through-1-220355160
Ref: 59c520355160
Node: ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION20356430
Ref: license bsd020356646
Ref: 59bf20356646
Ref: license zero-clause-bsd-license-for-code-in-the-python-documentation20356646
Ref: 59c620356646
Node: Licenses and Acknowledgements for Incorporated Software20357436
Ref: license licenses-and-acknowledgements-for-incorporated-software20357621
Ref: 59c720357621
Ref: license otherlicenses20357621
Ref: 59c020357621
Node: Mersenne Twister20358405
Ref: license mersenne-twister20358537
Ref: 59c820358537
Node: ソケット<2>20360856
Ref: license sockets20361025
Ref: 59c920361025
Node: Asynchronous socket services20362864
Ref: license asynchronous-socket-services20363034
Ref: 59ca20363034
Node: Cookie management20364272
Ref: license cookie-management20364444
Ref: 59cb20364444
Node: Execution tracing20365661
Ref: license execution-tracing20365836
Ref: 59cc20365836
Node: UUencode and UUdecode functions20367096
Ref: license uuencode-and-uudecode-functions20367280
Ref: 59cd20367280
Node: XML Remote Procedure Calls20368855
Ref: license xml-remote-procedure-calls20369032
Ref: 59ce20369032
Node: test_epoll20370557
Ref: license test-epoll20370716
Ref: 59cf20370716
Node: Select kqueue20371981
Ref: license select-kqueue20372123
Ref: 59d020372123
Node: SipHash2420373709
Ref: license siphash2420373856
Ref: 59d120373856
Node: strtod と dtoa20375035
Ref: license strtod-and-dtoa20375179
Ref: 59d220375179
Node: OpenSSL<2>20376575
Ref: license openssl20376715
Ref: 59d320376715
Node: expat20387633
Ref: license expat20387764
Ref: 59d420387764
Node: libffi20389170
Ref: license libffi20389298
Ref: 59d520389298
Node: zlib<4>20390679
Ref: license zlib20390809
Ref: 59d620390809
Node: cfuhash20392042
Ref: license cfuhash20392174
Ref: 59d720392174
Node: libmpdec20394073
Ref: license libmpdec20394217
Ref: 59d820394217
Node: W3C C14N test suite20395827
Ref: license w3c-c14n-test-suite20395972
Ref: 59d920395972
Node: mimalloc20397874
Ref: license mimalloc20398022
Ref: 59da20398022
Ref: license mimalloc-license20398022
Ref: 65620398022
Node: asyncio<15>20399235
Ref: license asyncio20399394
Ref: 59db20399394
Ref: asyncio<15>-Footnote-120400751
Node: Global Unbounded Sequences GUS20400809
Ref: license global-unbounded-sequences-gus20400978
Ref: 59dc20400978
Ref: Global Unbounded Sequences GUS-Footnote-120402654
Node: Zstandard bindings20402732
Ref: license zstandard-bindings20402881
Ref: 59dd20402881
Ref: Zstandard bindings-Footnote-120404820
Node: Pythonモジュール索引20404863
Node: 索引20424569
Ref: library/asyncio audit_event_cpython_run_stdin_222872925
Ref: library/stdtypes list clear22872926
Ref: library/stdtypes list remove22872928
Ref: 197822872930
Ref: 154e22872932
Ref: library/unittest unittest tearDownModule22872934
Ref: 475522872936
Ref: 475a22872938
Ref: 202522872940
Ref: 475822872942
Ref: library/stdtypes list append22872944
Ref: 475222872946
Ref: 476322872948
Ref: library/stdtypes tuple count22872950
Ref: 475922872952
Ref: library/stdtypes list extend22872954
Ref: 475722872956
Ref: 60222872958
Ref: 476122872960
Ref: library/_thread start_new_thread22872962
Ref: library/stdtypes tuple index22872964
Ref: 475622872966
Ref: library/stdtypes list pop22872968
Ref: library/sys script_path22872970
Ref: 15dd22872972
Ref: library/sys audit_event_cpython_remote_debugger_script_022872974
Ref: library/stdtypes list insert22872976
Ref: library/ctypes audit_event_ctypes_memoryview_at_022872978
Ref: 60322872980
Ref: using/cmdline audit_event_cpython_run_file_022872982
Ref: using/cmdline audit_event_cpython_run_stdin_122872984
Ref: library/time audit_event_time_sleep_022872986
Ref: 15dc22872988
Ref: using/cmdline audit_event_cpython_run_stdin_022872990
Ref: 13b022872992
Ref: 8dc22872994
Ref: library/stdtypes range index22872996
Ref: 1a5b22872998

End Tag Table


Local Variables:
coding: utf-8
End:
